diff -Nru a/CREDITS b/CREDITS
--- a/CREDITS	Tue Jun 15 22:20:42 2004
+++ b/CREDITS	Tue Jun 15 22:20:42 2004
@@ -830,10 +830,10 @@
 S: USA
 
 N: Thomas Dunbar
-E: tdunbar@vtaix.cc.vt.edu
+E: tdunbar@vt.edu
 D: TeX & METAFONT hacking/maintenance
-S: Dean, Graduate School
-S: Virginia Tech
+S: Virginia Tech Computing Center
+S: 1700 Pratt Drive
 S: Blacksburg, Virginia 24061
 S: USA
 
@@ -1284,8 +1284,8 @@
 D: National Language Support
 D: Linux Internationalization Project
 D: German Localization for Linux and GNU software
-S: Helenenstrasse 18
-S: 65183 Wiesbaden
+S: Kriemhildring 12a
+S: 65795 Hattersheim am Main
 S: Germany
 
 N: Christoph Hellwig
@@ -1951,9 +1951,9 @@
 
 N: Robert M. Love
 E: rml@tech9.net
-E: rml@ufl.edu
+E: rml@novell.com
 D: misc. kernel hacking and debugging
-S: Gainesville, Florida 32608
+S: Cambridge, MA 02139
 S: USA
 
 N: Martin von Löwis
diff -Nru a/Documentation/DocBook/kernel-hacking.tmpl b/Documentation/DocBook/kernel-hacking.tmpl
--- a/Documentation/DocBook/kernel-hacking.tmpl	Tue Jun 15 22:20:41 2004
+++ b/Documentation/DocBook/kernel-hacking.tmpl	Tue Jun 15 22:20:41 2004
@@ -779,62 +779,7 @@
    </para>
   </sect1>
 
-  <sect1 id="routines-module-use-counters">
-   <title> <function>MOD_INC_USE_COUNT</function>/<function>MOD_DEC_USE_COUNT</function>
-    <filename class="headerfile">include/linux/module.h</filename></title>
-
-   <para>
-    These manipulate the module usage count, to protect against
-    removal (a module also can't be removed if another module uses
-    one of its exported symbols: see below).  Every reference to
-    the module from user context should be reflected by this
-    counter (e.g. for every data structure or socket) before the
-    function sleeps.  To quote Tim Waugh:
-   </para>
-
-   <programlisting>
-/* THIS IS BAD */
-foo_open (...)
-{
-        stuff..
-        if (fail)
-                return -EBUSY;
-        sleep.. (might get unloaded here)
-        stuff..
-        MOD_INC_USE_COUNT;
-        return 0;
-}
-
-/* THIS IS GOOD /
-foo_open (...)
-{
-        MOD_INC_USE_COUNT;
-        stuff..
-        if (fail) {
-                MOD_DEC_USE_COUNT;
-                return -EBUSY;
-        }
-        sleep.. (safe now)
-        stuff..
-        return 0;
-}
-   </programlisting>
-
-   <para>
-   You can often avoid having to deal with these problems by using the 
-   <structfield>owner</structfield> field of the 
-   <structname>file_operations</structname> structure. Set this field
-   as the macro <symbol>THIS_MODULE</symbol>.
-   </para>
-
-   <para>
-   For more complicated module unload locking requirements, you can set the
-   <structfield>can_unload</structfield> function pointer to your own routine,
-   which should return <returnvalue>0</returnvalue> if the module is
-   unloadable, or <returnvalue>-EBUSY</returnvalue> otherwise.
-   </para> 
-  
-  </sect1>
+ <!-- add info on new-style module refcounting here -->
  </chapter>
 
  <chapter id="queues">
diff -Nru a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl
--- a/Documentation/DocBook/libata.tmpl	Tue Jun 15 22:20:40 2004
+++ b/Documentation/DocBook/libata.tmpl	Tue Jun 15 22:20:40 2004
@@ -64,12 +64,16 @@
   <chapter id="libataExt">
      <title>libata Library</title>
 !Edrivers/scsi/libata-core.c
-!Edrivers/scsi/libata-scsi.c
   </chapter>
 
   <chapter id="libataInt">
-     <title>libata Internals</title>
+     <title>libata Core Internals</title>
 !Idrivers/scsi/libata-core.c
+  </chapter>
+
+  <chapter id="libataScsiInt">
+     <title>libata SCSI translation/emulation</title>
+!Edrivers/scsi/libata-scsi.c
 !Idrivers/scsi/libata-scsi.c
   </chapter>
 
@@ -81,11 +85,6 @@
   <chapter id="SILInt">
      <title>ata_sil Internals</title>
 !Idrivers/scsi/sata_sil.c
-  </chapter>
-
-  <chapter id="VIAInt">
-     <title>ata_via Internals</title>
-!Idrivers/scsi/sata_via.c
   </chapter>
 
 </book>
diff -Nru a/Documentation/DocBook/videobook.tmpl b/Documentation/DocBook/videobook.tmpl
--- a/Documentation/DocBook/videobook.tmpl	Tue Jun 15 22:21:05 2004
+++ b/Documentation/DocBook/videobook.tmpl	Tue Jun 15 22:21:05 2004
@@ -232,7 +232,6 @@
         if(users)
                 return -EBUSY;
         users++;
-        MOD_INC_USE_COUNT;
         return 0;
 }
 
@@ -248,7 +247,6 @@
 static int radio_close(struct video_device *dev)
 {
         users--;
-        MOD_DEC_USE_COUNT;
 }
 
   </programlisting>
@@ -954,7 +952,6 @@
         if(request_irq(irq, camera_irq, 0, "camera", dev)&lt;0)
                 return -EBUSY;
         users++;
-        MOD_INC_USE_COUNT;
         return 0;
 }
 
@@ -963,7 +960,6 @@
 {
         users--;
         free_irq(irq, dev);
-        MOD_DEC_USE_COUNT;
 }
   </programlisting>
   <para>
diff -Nru a/Documentation/SubmittingDrivers b/Documentation/SubmittingDrivers
--- a/Documentation/SubmittingDrivers	Tue Jun 15 22:20:42 2004
+++ b/Documentation/SubmittingDrivers	Tue Jun 15 22:20:42 2004
@@ -121,6 +121,19 @@
 	Weekly summary of kernel list activity (much easier to read)
 	http://www.kerneltraffic.org/kernel-traffic/
 
+LWN.net:
+	Weekly summary of kernel development activity - http://lwn.net/
+	2.6 driver porting information:
+		http://lwn.net/Articles/driver-porting/
+
+KernelTrap:
+	Occasional Linux kernel articles and developer interviews
+	http://kerneltrap.org/
+
+KernelNewbies:
+	Documentation and assistance for new kernel programmers
+	http://kernelnewbies.org/
+
 Linux USB project:
 	http://sourceforge.net/projects/linux-usb/
 
diff -Nru a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
--- a/Documentation/SubmittingPatches	Tue Jun 15 22:20:36 2004
+++ b/Documentation/SubmittingPatches	Tue Jun 15 22:20:36 2004
@@ -132,6 +132,21 @@
 usually be sent first to linux-kernel.  Only after the patch is
 discussed should the patch then be submitted to Linus.
 
+For small patches you may want to CC the Trivial Patch Monkey
+trivial@rustcorp.com.au set up by Rusty Russell; which collects "trivial"
+patches. Trivial patches must qualify for one of the following rules:
+ Spelling fixes in documentation
+ Spelling fixes which could break grep(1).
+ Warning fixes (cluttering with useless warnings is bad)
+ Compilation fixes (only if they are actually correct)
+ Runtime fixes (only if they actually fix things)
+ Removing use of deprecated functions/macros (eg. check_region).
+ Contact detail and documentation fixes
+ Non-portable code replaced by portable code (even in arch-specific,
+ since people copy, as long as it's trivial)
+ Any fix by the author/maintainer of the file. (ie. patch monkey
+ in re-transmission mode)
+
 
 
 5) Select your CC (e-mail carbon copy) list.
@@ -242,6 +257,47 @@
 and other kernel developers more easily distinguish patches from other
 e-mail discussions.
 
+
+
+11) Sign your work
+
+To improve tracking of who did what, especially with patches that can
+percolate to their final resting place in the kernel through several
+layers of maintainers, we've introduced a "sign-off" procedure on
+patches that are being emailed around.
+
+The sign-off is a simple line at the end of the explanation for the
+patch, which certifies that you wrote it or otherwise have the right to
+pass it on as a open-source patch.  The rules are pretty simple: if you
+can certify the below:
+
+        Developer's Certificate of Origin 1.0
+
+        By making a contribution to this project, I certify that:
+
+        (a) The contribution was created in whole or in part by me and I
+            have the right to submit it under the open source license
+            indicated in the file; or
+
+        (b) The contribution is based upon previous work that, to the best
+            of my knowledge, is covered under an appropriate open source
+            license and I have the right under that license to submit that
+            work with modifications, whether created in whole or in part
+            by me, under the same open source license (unless I am
+            permitted to submit under a different license), as indicated
+            in the file; or
+
+        (c) The contribution was provided directly to me by some other
+            person who certified (a), (b) or (c) and I have not modified
+            it.
+
+then you just add a line saying
+
+	Signed-off-by: Random J Developer <random@developer.org>
+
+Some people also put extra tags at the end.  They'll just be ignored for
+now, but you can do this to mark internal company procedures or just
+point out some special detail about the sign-off. 
 
 
 -----------------------------------
diff -Nru a/Documentation/arm/IXP4xx b/Documentation/arm/IXP4xx
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/Documentation/arm/IXP4xx	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,155 @@
+
+-------------------------------------------------------------------------
+Release Notes for Linux on Intel's IXP4xx Network Processor
+
+Maintained by Deepak Saxena <dsaxena@plexity.net>
+-------------------------------------------------------------------------
+
+1. Overview
+
+Intel's IXP4xx network processor is a highly integrated SOC that
+is targeted for network applications, though it has become popular 
+in industrial control and other areas due to low cost and power
+consumption. The IXP4xx family currently consists of several processors
+that support different network offload functions such as encryption,
+routing, firewalling, etc. For more information on the various
+versions of the CPU, see:
+
+   http://developer.intel.com/design/network/products/npfamily/ixp4xx.htm
+
+Intel also made the IXCP1100 CPU for sometime which is an IXP4xx 
+stripped of much of the network intelligence.
+
+2. Linux Support
+
+Linux currently supports the following features on the IXP4xx chips:
+
+- Dual serial ports
+- PCI interface
+- Flash access (MTD/JFFS)
+- I2C through GPIO
+- GPIO for input/output/interrupts 
+  See include/asm-arm/arch-ixp4xx/platform.h for access functions.
+- Timers (watchdog, OS)
+
+The following components of the chips are not supported by Linux and
+require the use of Intel's propietary CSR softare:
+
+- USB device interface
+- Network interfaces (HSS, Utopia, NPEs, etc)
+- Network offload functionality
+
+If you need to use any of the above, you need to download Intel's
+software from:
+
+   http://developer.intel.com/design/network/products/npfamily/ixp425swr1.htm
+
+DO NOT POST QUESTIONS TO THE LINUX MAILING LISTS REGARDING THE PROPIETARY
+SOFTWARE.
+
+There are several websites that provide directions/pointers on using
+Intel's software:
+
+http://ixp4xx-osdg.sourceforge.net/ 
+   Open Source Developer's Guide for using uClinux and the Intel libraries 
+
+http://gatewaymaker.sourceforge.net/ 
+   Simple one page summary of building a gateway using an IXP425 and Linux
+
+http://ixp425.sourceforge.net/
+   ATM device driver for IXP425 that relies on Intel's libraries
+
+3. Known Issues/Limitations
+
+3a. Limited inbound PCI window
+
+The IXP4xx family allows for up to 256MB of memory but the PCI interface
+can only expose 64MB of that memory to the PCI bus. This means that if
+you are running with > 64MB, all PCI buffers outside of the accessible
+range will be bounced using the routines in arch/arm/common/dmabounce.c.
+   
+3b. Limited outbound PCI window
+
+IXP4xx provides two methods of accessing PCI memory space:
+
+1) A direct mapped window from 0x48000000 to 0x4bffffff (64MB).
+   To access PCI via this space, we simply ioremap() the BAR
+   into the kernel and we can use the standard read[bwl]/write[bwl]
+   macros. This is the preffered method due to speed but it
+   limits the system to just 64MB of PCI memory. This can be 
+   problamatic if using video cards and other memory-heavy devices.
+          
+2) If > 64MB of memory space is required, the IXP4xx can be 
+   configured to use indirect registers to access PCI This allows 
+   for up to 128MB (0x48000000 to 0x4fffffff) of memory on the bus. 
+   The disadvantadge of this is that every PCI access requires 
+   three local register accesses plus a spinlock, but in some 
+   cases the performance hit is acceptable. In addition, you cannot 
+   mmap() PCI devices in this case due to the indirect nature
+   of the PCI window.
+
+By default, the direct method is used for performance reasons. If
+you need more PCI memory, enable the IXP4XX_INDIRECT_PCI config option.
+
+3c. GPIO as Interrupts
+
+Currently the code only handles level-sensitive GPIO interrupts 
+
+4. Supported platforms
+
+ADI Engineering Coyote Gateway Reference Platform
+http://www.adiengineering.com/productsCoyote.html
+
+   The ADI Coyote platform is reference design for those building 
+   small residential/office gateways. One NPE is connected to a 10/100
+   interface, one to 4-port 10/100 switch, and the third to and ADSL
+   interface. In addition, it also supports to POTs interfaces connected
+   via SLICs. Note that those are not supported by Linux ATM. Finally,
+   the platform has two mini-PCI slots used for 802.11[bga] cards.
+   Finally, there is an IDE port hanging off the expansion bus.
+
+Gateworks Avila Network Platform
+http://www.gateworks.com/avila_sbc.htm
+
+   The Avila platform is basically and IXDP425 with the 4 PCI slots
+   replaced with mini-PCI slots and a CF IDE interface hanging off
+   the expansion bus.
+
+Intel IXDP425 Development Platform
+http://developer.intel.com/design/network/products/npfamily/ixdp425.htm
+
+   This is Intel's standard reference platform for the IXDP425 and is 
+   also known as the Richfield board. It contains 4 PCI slots, 16MB
+   of flash, two 10/100 ports and one ADSL port.
+
+Motorola PrPMC1100 Processor Mezanine Card
+http://www.fountainsys.com/datasheet/PrPMC1100.pdf
+
+   The PrPMC1100 is based on the IXCP1100 and is meant to plug into
+   and IXP2400/2800 system to act as the system controller. It simply
+   contains a CPU and 16MB of flash on the board and needs to be
+   plugged into a carrier board to function. Currently Linux only
+   supports the Motorola PrPMC carrier board for this platform.
+   See https://mcg.motorola.com/us/ds/pdf/ds0144.pdf for info
+   on the carrier board.
+
+5. TODO LIST
+
+- Add support for Coyote IDE
+- Add support for edge-based GPIO interrupts
+- Add support for CF IDE on expansion bus
+
+6. Thanks
+
+The IXP4xx work has been funded by Intel Corp. and MontaVista Software, Inc.
+
+The following people have contributed patches/comments/etc:
+
+Lutz Jaenicke
+Justin Mayfield
+Robert E. Ranslam
+[I know I've forgotten others, please email me to be added] 
+
+-------------------------------------------------------------------------
+
+Last Update: 5/13/2004
diff -Nru a/Documentation/arm/SA1100/PCMCIA b/Documentation/arm/SA1100/PCMCIA
--- a/Documentation/arm/SA1100/PCMCIA	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,374 +0,0 @@
-Kernel Low-Level PCMCIA Interface Documentation
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-John G Dorsey <john+@cs.cmu.edu>
-Updated: 30 June, 2000
-
-
-Note: this interface has not been finalized!
-See also: http://www.cs.cmu.edu/~wearable/software/pcmcia-arm.html
-
-
-Introduction
-
-Early versions of PCMCIA Card Services for StrongARM were designed to
-permit a single socket driver to run on a variety of SA-1100 boards by
-using a userland configuration process. During the conversion to the 2.3
-kernel series, all of the configuration has moved into sub-drivers in the
-kernel proper (see linux/drivers/pcmcia/sa1100*). This document describes
-the low-level interface between those sub-drivers and the sa1100 socket
-driver module.
-
-Presently, there are six operations which must be provided by the
-board-specific code. Only functions whose implementation is likely to
-differ across board designs are required at this level. Some examples
-include:
-
-  - configuring card detect lines to generate interrupts
-  - sensing the legal voltage levels for inserted cards
-  - asserting the reset signal for a card
-
-Functions which are assumed to be the same across all designs are
-performed within the generic socket driver itself. Some examples of these
-kinds of operations include:
-
-  - configuring memory access times based on the core clock frequency
-  - reads/writes on memory, byte swizzling, ...
-
-The current implementation allows the specific per-board set of low-level
-operations to be determined at run time. For each specific board, the
-following structure should be filled in:
-
-  struct pcmcia_low_level {
-    int (*init)(struct pcmcia_init *);
-    int (*shutdown)(void);
-    int (*socket_state)(struct pcmcia_state_array *);
-    int (*get_irq_info)(struct pcmcia_irq_info *);
-    int (*configure_socket)(const struct pcmcia_configure *);
-  };
-
-The component functions are described in detail below. Using the
-machine_is_*() tests, the pointer `pcmcia_low_level' should be assigned to
-the location of the table for your board.
-
-
-0. init(struct pcmcia_init *init)
-
-This operation has three responsibilities:
-
-  - perform any board-specific initialization tasks
-  - associate the given handler with any interrupt-generating signals
-    such as card detection, or battery voltage detection
-  - set up any necessary edge detection for card ready signals
-
-Argument passing for this operation is implemented by the following
-structure:
-
-  struct pcmcia_init {
-    void (*handler)(int irq, void *dev, struct pt_regs *regs);
-    struct pcmcia_maps *maps;
-  };
-
-Here, `handler' is provided by the socket driver, and `maps' must be
-modified if the default mapping isn't appropriate. This operation should
-return one of two values:
-
-  - the highest-numbered socket available, plus one
-  - a negative number, indicating an error in configuration
-
-Note that the former case is _not_ the same as "the number of sockets
-available." In particular, if your design uses SA-1100 slot "one" but
-not slot "zero," you MUST report "2" to the socket driver.
-
-
-1. shutdown(void)
-
-This operation takes no arguments, and will be called during cleanup for
-the socket driver module. Any state associated with the socket controller,
-including allocated data structures, reserved IRQs, etc. should be
-released in this routine.
-
-The return value for this operation is not examined.
-
-
-2. socket_state(struct pcmcia_state_array *state_array)
-
-This operation will be invoked from the interrupt handler which was set up
-in the earlier call to init(). Note, however, that it should not include
-any side effects which would be inappropriate if the operation were to
-occur when no interrupt is pending. (An extra invocation of this operation
-currently takes place to initialize state in the socket driver.)
-
-Argument passing for this operation is handled by a structure which
-contains an array of the following type:
-
-  struct pcmcia_state {
-    unsigned detect: 1,
-              ready: 1,
-               bvd1: 1,
-               bvd2: 1,
-             wrprot: 1,
-              vs_3v: 1,
-              vs_Xv: 1;
-  };
-
-Upon return from the operation, a struct pcmcia_state should be filled in
-for each socket available in the hardware. For every array element (up to
-`size' in the struct pcmcia_state_saarray) which does not correspond to an
-available socket, zero the element bits. (This includes element [0] if
-socket zero is not used.)
-
-Regardless of how the various signals are routed to the SA-1100, the bits
-in struct pcmcia_state always have the following semantics:
-
-  detect - 1 if a card is fully inserted, 0 otherwise
-  ready  - 1 if the card ready signal is asserted, 0 otherwise
-  bvd1   - the value of the Battery Voltage Detect 1 signal
-  bvd2   - the value of the Battery Voltage Detect 2 signal
-  wrprot - 1 if the card is write-protected, 0 otherwise
-  vs_3v  - 1 if the card must be operated at 3.3V, 0 otherwise
-  vs_Xv  - 1 if the card must be operated at X.XV, 0 otherwise
-
-A note about the BVD signals: if your board does not make both lines
-directly observable to the processor, just return reasonable values. The
-standard interpretation of the BVD signals is:
-
-  BVD1  BVD2
-
-   0     x    battery is dead
-   1     0    battery warning
-   1     1    battery ok
-
-Regarding the voltage sense flags (vs_3v, vs_Xv), these bits should be set
-based on a sampling of the Voltage Sense pins, if available. The standard
-interpretation of the VS signals (for a "low-voltage" socket) is:
-
-  VS1   VS2
-
-   0     0    X.XV, else 3.3V, else none
-   0     1    3.3V, else none
-   1     0    X.XV, else none
-   1     1    5V, else none
-
-More information about the BVD and VS conventions is available in chapter
-5 of "PCMCIA System Architecture," 2nd ed., by Don Anderson.
-
-This operation should return 1 if an IRQ is actually pending for the
-socket controller, 0 if no IRQ is pending (but no error condition exists,
-such as an undersized state array), or -1 on any error.
-
-
-3. get_irq_info(struct pcmcia_irq_info *info)
-
-This operation obtains the IRQ assignment which is legal for the given
-socket. An argument of the following type is passed:
-
-  struct pcmcia_irq_info {
-    unsigned int sock;
-    unsigned int irq ;
-  };
-
-The `sock' field contains the socket index being queried. The `irq' field
-should contain the IRQ number corresponding to the card ready signal from
-the device.
-
-This operation should return 0 on success, or -1 on any error.
-
-
-4. configure_socket(const struct pcmcia_configure *configure)
-
-This operation allows the caller to apply power to the socket, issue a
-reset, or enable various outputs. The argument is of the following type:
-
-  struct pcmcia_configure {
-    unsigned sock: 8,
-              vcc: 8,
-              vpp: 8,
-           output: 1,
-          speaker: 1,
-            reset: 1;
-  };
-
-The `sock' field contains the index of the socket to be configured. The
-`vcc' and `vpp' fields contain the voltages to be applied for Vcc and Vpp,
-respectively, in units of 0.1V. (Note that vpp==120 indicates that
-programming voltage should be applied.)
-
-The two output enables, `output' and `speaker', refer to the card data
-signal enable and the card speaker enable, respectively. The `reset' bit,
-when set, indicates that the card reset should be asserted.
-
-This operation should return 0 on success, or -1 on any error.
-
-
-Board-Specific Notes
-
-The following information is known about various SA-11x0 board designs
-which may be used as reference while adding support to the kernel.
-
-
-Carnegie Mellon Itsy/Cue (http://www.cs.cmu.edu/~wearable/itsy/)
-
-  Itsy Chip Select 3 (CS3) Interface
-  ("ITSY MEMORY/PCMCIA ADD-ON BOARD with BATTERY and CHARGER CIRCUITRY,"
-   memo dated 5-20-99, from Tim Manns to Richard Martin, et. al)
-
-  Read:
-    ABVD2    (SS)D0          A slot, Battery Voltage Detect
-    ABVD1    (SS)D1
-    AVSS2    (SS)D2          A slot, Voltage Sense
-    AVSS1    (SS)D3
-    GND      (SS)D4
-    GND      (SS)D5
-    GND      (SS)D6
-    GND      (SS)D7
-  
-    BBVD2    (SS)D8          B slot, Battery Voltage Detect
-    BBVD1    (SS)D9
-    BVSS2    (SS)D10         B slot, Voltage Sense
-    BVSS1    (SS)D11
-    GND      (SS)D12
-    GND      (SS)D13
-    GND      (SS)D14
-    GND      (SS)D15
-  
-  Write:
-    (SS)D0   A_VPP_VCC       LTC1472 VPPEN1
-    (SS)D1   A_VPP_PGM       LTC1472 VPPEN0
-    (SS)D2   A_VCC_3         LTC1472 VCCEN0
-    (SS)D3   A_VCC_5         LTC1472 VCCEN1
-    (SS)D4   RESET (A SLOT)
-    (SS)D5   GND
-    (SS)D6   GND
-    (SS)D7   GND
- 
-    (SS)D8   B_VPP_VCC       LTC1472 VPPEN1
-    (SS)D9   B_VPP_PGM       LTC1472 VPPEN0
-    (SS)D10  B_VCC_3         LTC1472 VCCEN0
-    (SS)D11  B_VCC_5         LTC1472 VCCEN1
-    (SS)D12  RESET (B SLOT)
-    (SS)D13  GND
-    (SS)D14  GND
-    (SS)D15  GND
- 
-  GPIO pin assignments are as follows: (from schematics)
- 
-    GPIO 10                  Slot 0 Card Detect
-    GPIO 11                  Slot 1 Card Detect
-    GPIO 12                  Slot 0 Ready/Interrupt
-    GPIO 13                  Slot 1 Ready/Interrupt
-
-
-
-Intel SA-1100 Multimedia Board (http://developer.intel.com/design/strong/)
-
-  CPLD Registers
-  SA-1100 Multimedia Development Board with Companion SA-1101 Development
-    Board User's Guide, p.4-42
-
-  This SA-1100/1101 development package uses only one GPIO pin (24) to
-  signal changes in card status, and requires software to inspect a
-  PCMCIA status register to determine the source.
-
-  Read: (PCMCIA Power Sense Register - 0x19400000)
-    S0VS1           0        Slot 0 voltage sense
-    S0VS2           1
-    S0BVD1          2        Slot 0 battery voltage sense
-    S0BVD2          3
-    S1VS1           4        Slot 1 voltage sense
-    S1VS2           5
-    S1BVD1          6        Slot 1 battery voltage sense
-    S1BVD2          7
-
-  Read/Write: (PCMCIA Power Control Register - 0x19400002)
-    S0VPP0          0        Slot 0 Vpp
-    S0VPP1          1
-    S0VCC0          2        Slot 0 Vcc
-    S0VCC1          3
-    S1VPP0          4        Slot 1 Vpp
-    S1VPP1          5
-    S1VCC0          6        Slot 1 Vcc
-    S1VCC1          7
-
-  Read: (PCMCIA Status Register - 0x19400004)
-    S0CD1           0        Slot 0 Card Detect 1
-    S0RDY           1        Slot 0 Ready/Interrupt
-    S0STSCHG        2        Slot 0 Status Change
-    S0Reset         3        Slot 0 Reset (RW)
-    S1CD1           4        Slot 1 Card Detect 1
-    S1RDY           5        Slot 1 Ready/Interrupt
-    S1STSCHG        6        Slot 1 Status Change
-    S1Reset         7        Slot 1 Reset (RW)
-
-
-
-Intel SA-1100 Evaluation Platform (http://developer.intel.com/design/strong/)
-
-  Brutus I/O Pins and Chipselect Register
-  pcmcia-brutus.c, by Ivo Clarysse
-  (What's the official reference for this info?)
-
-  This SA-1100 development board uses more GPIO pins than say, the Itsy
-  or the SA-1100/1101 multimedia package. The pin assignments are as
-  follows:
-
-    GPIO 2                   Slot 0 Battery Voltage Detect 1
-    GPIO 3                   Slot 0 Ready/Interrupt
-    GPIO 4                   Slot 0 Card Detect
-    GPIO 5                   Slot 1 Battery Voltage Detect 1
-    GPIO 6                   Slot 1 Ready/Interrupt
-    GPIO 7                   Slot 1 Card Detect
-
-  Like the Itsy, Brutus uses a chipselect register in static memory
-  bank 3 for the other signals, such as voltage sense or reset:
-
-  Read:
-    P0_VS1          8        Slot 0 Voltage Sense
-    P0_VS2          9
-    P0_STSCHG      10        Slot 0 Status Change
-    P1_VS1         12        Slot 1 Voltage Sense
-    P1_VS2         13
-    P1_STSCHG      14        Slot 1 Status Change
-
-  Read/Write:
-    P0_            16        Slot 0 MAX1600EAI control line
-    P0_            17        Slot 0 MAX1600EAI control line
-    P0_            18        Slot 0 MAX1600EAI control line
-    P0_            19        Slot 0 MAX1600EAI control line
-    P0_            20        Slot 0 12V
-    P0_            21        Slot 0 Vpp to Vcc (CONFIRM?)
-    P0_            22        Slot 0 enable fan-out drivers & xcvrs
-    P0_SW_RST      23        Slot 0 Reset
-    P1_            24        Slot 1 MAX1600EAI control line
-    P1_            25        Slot 1 MAX1600EAI control line
-    P1_            26        Slot 1 MAX1600EAI control line
-    P1_            27        Slot 1 MAX1600EAI control line
-    P1_            28        Slot 1 12V
-    P1_            29        Slot 1 Vpp to Vcc (CONFIRM?)
-    P1_            30        Slot 1 enable fan-out drivers & xcvrs
-    P1_SW_RST      31        Slot 1 Reset
-
-  For each slot, the bits labelled "MAX1600EAI" should (apparently)
-  be written with the value 0101 for Vcc 3.3V, and 1001 for Vcc 5V.
-
-
-
-Intel SA-1110 Development Platform (http://developer.intel.com/design/strong/)
-
-  GPIO Pin Descriptions and Board Control Register
-  SA-1110 Microprocessor Development Board User's Guide, p.4-7, 4-10
-
-  The Assabet board contains only a single Compact Flash slot,
-  attached to slot 1 on the SA-1110. Card detect, ready, and BVD
-  signals are routed through GPIO, with power and reset placed in a
-  control register. Note that the CF bus must be enabled before use.
-
-    GPIO 21                  Slot 1 Compact Flash interrupt
-    GPIO 22                  Slot 1 card detect (CD1 NOR CD2)
-    GPIO 24                  Slot 1 Battery Voltage Detect 2
-    GPIO 25                  Slot 1 Battery Voltage Detect 1
-
-  Write-only: (Board Control Register - 0x12000000)
-    CF_PWR          0        CF bus power (3.3V)
-    CF_RST          1        CF reset
-    CF_Bus_On       7        CF bus enable
-
diff -Nru a/Documentation/arm/XScale/ADIFCC/80200EVB b/Documentation/arm/XScale/ADIFCC/80200EVB
--- a/Documentation/arm/XScale/ADIFCC/80200EVB	Tue Jun 15 22:21:03 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,110 +0,0 @@
-
-Board Overview
------------------------------
-
-This is an beta release of the Xscale Linux port to the ADI 80200EVB
-evaluation board.
-
-The 80200EVB is an evaluation platform for ADI Engineering's high-performance
-80200FCC chipset for the Intel 80200 XScale CPU. The 80200FCC is an open
-source FPGA based system that contains a PCI unit and a high performance
-memory controller.
-
-In addition to the 80200FCC, the board also contains a 16C550 UART, and 4MB
-of flash.
-
-The board is still under development and currently only the UART is functional
-as the PCI bits have not been programmed into the FPGA.
-
-For more information on the board, see http://www.adiengineering.com
-
-Port Status
------------------------------
-
-Supported:
-
-- Onboard UART (Polled operation only)
-- Cache/TLB locking on 80200 CPU
-
-TODO:
-
-- PCI when hardware supports it
-
-Building the Kernel
------------------------------
-change Linux makefile
-make adi_evb_config
-make oldconfig
-make zImage
-
-Loading Linux
------------------------------
-
-Before you can use Linux on the ADI board, you need to grab the following:
-
-ADI 80200EVB Monitor:
-	ftp://source.mvista.com/pub/xscale/ADI_EVB/monitor.srec
-
-ADI JFFS2 Image:
-	ftp://source.mvista.com/pub/xscale/ADI_EVB/adi.jffs2
-
-Once you've got the Cygnus prompt, type in the following command:
-
-	load
-
-On another terminal window:
-
-	cat monitor.srec > /dev/ttyS0
-
-(replace ttyS0 with the serial port you are using)
-
-Once completed, just type 'go' at the cygmon prompt and you should see:
-
-	MontaVista IQ80310 Monitor Version 0.1
-	monitor>
-
-Type 'b 115200' at the prompt and change your terminal speed to 115200
-
-The first thing to do is to upload and burn the jffs2 filesystem image
-onto the boards 4MB of flash:
-
-	monitor> u c1000000
-	Uploading file at 0xc1000000
-	Now send file with ymodem
-
-Do as the monitor says and transfer the file adi.jffs2.  Once complete,
-the following will copy the jffs2 image to location 0x80000 in the flash.
-
-	monitor> f 8000 c1000000 200000
-	Erasing sector 0x00080000
-	Writing sector 0x00080000 with data at 0xC1000000
-	Erasing sector 0x000A0000
-	Writing sector 0x000A0000 with data at 0xC1020000
-	Erasing sector 0x000C0000
-	...
-
-Now use the same command as above to upload your zImage to location c1000000.
-When you've done that, type 'j c1000000' to run Linux.  Login as
-root and you're all set to go.
-
-Misc Notes
------------------------------
-
-The current version of the HW does not have an onboard timer, so the 80200
-PMU is not available for general use as it is being used for a timer source.
-
-By default, the MTD driver reserves the first 512K for bootloaders and
-the remaining 3.5MB for the filesystem. You can edit drivers/mtd/map/adi_evb.c
-to change this as needed for your application.
-
-Contributors
------------------------------
-
-Thanks to ADI Engineering for providing the hardware for development
-
-Deepak Saxena <dsaxena@mvista.com> - Initial port
-
------------------------------
-Enjoy.  If you have any problem please contact Deepak Saxena
-dsaxena@mvista.com
-
diff -Nru a/Documentation/arm/XScale/IOP3XX/IQ80310 b/Documentation/arm/XScale/IOP3XX/IQ80310
--- a/Documentation/arm/XScale/IOP3XX/IQ80310	Tue Jun 15 22:20:58 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,247 +0,0 @@
-
-Board Overview
------------------------------
-
-The Cyclone IQ80310 board is an evaluation platform for Intel's 80200 Xscale
-CPU and 80312 Intelligent I/O chipset (collectively called IOP310 chipset).
-
-The 80312 contains dual PCI hoses (called the ATUs), a PCI-to-PCI bridge,
-three DMA channels (1 on secondary PCI, one on primary PCI ), I2C, I2O
-messaging unit, XOR unit for RAID operations, a bus performance monitoring
-unit, and a memory controller with ECC features.
-
-For more information on the board, see http://developer.intel.com/iio
-
-Port Status
------------------------------
-
-Supported:
-
-- MTD/JFFS/JFFS2
-- NFS root
-- RAMDISK root
-- 2ndary PCI slots
-- Onboard ethernet
-- Serial ports (ttyS0/S1)
-- Cache/TLB locking on 80200 CPU
-- Performance monitoring unit on 80200 CPU
-- 80200 Performance Monitoring Unit
-- Acting as a system controller on Cyclone 80303BP PCI backplane
-- DMA engines (EXPERIMENTAL)
-- 80312 Bus Performance Monitor (EXPERIMENTAL)
-- Application Accelerator Unit (XOR engine for RAID) (EXPERIMENTAL)
-- Messaging Unit (EXPERIMENTAL)
-
-TODO:
-- I2C
-
-Building the Kernel
------------------------------
-make iq80310_config
-make oldconfig
-make zImage
-
-This will build an image setup for BOOTP/NFS root support.  To change this,
-just run make menuconfig and disable nfs root or add a "root=" option.
-
-Preparing the Hardware
------------------------------
-
-This document assumes you're using a Rev D or newer board running
-Redboot as the bootloader.  Note that the version of RedBoot provided
-with the boards has a major issue and you need to replace it with the
-latest RedBoot. You can grab the source from the ECOS CVS or you can
-get a prebuilt image and burn it in using FRU at:
-
-   ftp://source.mvista.com/pub/xscale/iq80310/redboot.bin
-
-Make sure you do an 'fis init' command once you boot with the new
-RedBoot image.
-
-
-
-Downloading Linux
------------------------------
-
-Assuming you have your development system setup to act as a bootp/dhcp
-server and running tftp:
-
-   RedBoot> load -r -b 0xa1008000 /tftpboot/zImage.xs
-   Raw file loaded 0xa1008000-0xa1094bd8
-
-If you're not using dhcp/tftp, you can use y-modem instead:
-
-   RedBoot> load -r -b 0xa1008000 -m y
-
-Note that on Rev D. of the board, tftp does not work due to intermittent
-interrupt issues, so you need to download using ymodem.
-
-Once the download is completed:
-
-   RedBoot> go 0xa1008000
-
-Root Devices
------------------------------
-
-A kernel is not useful without a root filesystem, and you have several
-choices with this board:  NFS root, RAMDISK, or JFFS/JFFS2.  For development
-purposes, it is suggested that you use NFS root for easy access to various
-tools.  Once you're ready to deploy, probably want to utilize JFFS/JFFS2 on
-the flash device.
-
-MTD on the IQ80310
------------------------------
-
-Linux on the IQ80310 supports RedBoot FIS paritioning if it is enabled.
-Out of the box, once you've done 'fis init' on RedBoot, you will get
-the following partitioning scheme:
-
-   root@192.168.0.14:~# cat /proc/mtd
-   dev:    size   erasesize  name
-   mtd0: 00040000 00020000 "RedBoot"
-   mtd1: 00040000 00020000 "RedBoot[backup]"
-   mtd2: 0075f000 00020000 "unallocated space"
-   mtd3: 00001000 00020000 "RedBoot config"
-   mtd4: 00020000 00020000 "FIS directory"
-
-To create an FIS directory, you need to use the fis command in RedBoot.
-As an example, you can burn the kernel into the flash once it's downloaded:
-
-   RedBoot> fis create -b 0xa1008000 -l 0x8CBAC -r 0xa1008000 -f 0x80000 kernel
-   ... Erase from 0x00080000-0x00120000: .....
-   ... Program from 0xa1008000-0xa1094bac at 0x00080000: .....
-   ... Unlock from 0x007e0000-0x00800000: .
-   ... Erase from 0x007e0000-0x00800000: .
-   ... Program from 0xa1fdf000-0xa1fff000 at 0x007e0000: .
-   ... Lock from 0x007e0000-0x00800000: .
-
-   RedBoot> fis list
-   Name              FLASH addr  Mem addr    Length      Entry point
-   RedBoot           0x00000000  0x00000000  0x00040000  0x00000000
-   RedBoot[backup]   0x00040000  0x00040000  0x00040000  0x00000000
-   RedBoot config    0x007DF000  0x007DF000  0x00001000  0x00000000
-   FIS directory     0x007E0000  0x007E0000  0x00020000  0x00000000
-   kernel            0x00080000  0xA1008000  0x000A0000  0x00000000
-
-This leads to the following Linux MTD setup:
-
-   mtroot@192.168.0.14:~# cat /proc/mtd
-   dev:    size   erasesize  name
-   mtd0: 00040000 00020000 "RedBoot"
-   mtd1: 00040000 00020000 "RedBoot[backup]"
-   mtd2: 000a0000 00020000 "kernel"
-   mtd3: 006bf000 00020000 "unallocated space"
-   mtd4: 00001000 00020000 "RedBoot config"
-   mtd5: 00020000 00020000 "FIS directory"
-
-Note that there is not a 1:1 mapping to the number of RedBoot paritions to
-MTD partitions as unused space also gets allocated into MTD partitions.
-
-As an aside, the -r option when creating the Kernel entry allows you to
-simply do an 'fis load kernel' to copy the image from flash into memory.
-You can then do an 'fis go 0xa1008000' to start Linux.
-
-If you choose to use static partitioning instead of the RedBoot partioning:
-
-   /dev/mtd0  0x00000000 - 0x0007ffff: Boot Monitor     (512k)
-   /dev/mtd1  0x00080000 - 0x0011ffff: Kernel Image     (640K)
-   /dev/mtd2  0x00120000 - 0x0071ffff: File System      (6M)
-   /dev/mtd3  0x00720000 - 0x00800000: RedBoot Reserved (896K)
-
-To use a JFFS1/2 root FS, you need to donwload the JFFS image using either
-tftp or ymodem, and then copy it to flash:
-
-   RedBoot> load -r -b 0xa1000000 /tftpboot/jffs.img
-   Raw file loaded 0xa1000000-0xa1600000
-   RedBoot> fis create -b 0xa1000000 -l 0x600000 -f 0x120000 jffs
-   ... Erase from 0x00120000-0x00720000: ..................................
-   ... Program from 0xa1000000-0xa1600000 at 0x00120000: ..................
-   ......................
-   ... Unlock from 0x007e0000-0x00800000: .
-   ... Erase from 0x007e0000-0x00800000: .
-   ... Program from 0xa1fdf000-0xa1fff000 at 0x007e0000: .
-   ... Lock from 0x007e0000-0x00800000: .
-   RedBoot> fis list
-   Name              FLASH addr  Mem addr    Length      Entry point
-   RedBoot           0x00000000  0x00000000  0x00040000  0x00000000
-   RedBoot[backup]   0x00040000  0x00040000  0x00040000  0x00000000
-   RedBoot config    0x007DF000  0x007DF000  0x00001000  0x00000000
-   FIS directory     0x007E0000  0x007E0000  0x00020000  0x00000000
-   kernel            0x00080000  0xA1008000  0x000A0000  0xA1008000
-   jffs              0x00120000  0x00120000  0x00600000  0x00000000
-
-This looks like this in Linux:
-
-   root@192.168.0.14:~# cat /proc/mtd
-   dev:    size   erasesize  name
-   mtd0: 00040000 00020000 "RedBoot"
-   mtd1: 00040000 00020000 "RedBoot[backup]"
-   mtd2: 000a0000 00020000 "kernel"
-   mtd3: 00600000 00020000 "jffs"
-   mtd4: 000bf000 00020000 "unallocated space"
-   mtd5: 00001000 00020000 "RedBoot config"
-   mtd6: 00020000 00020000 "FIS directory"
-
-You need to boot the kernel once and watch the boot messages to see how the
-JFFS RedBoot partition mapped into the MTD partition scheme.
-
-You can grab a pre-built JFFS image to use as a root file system at:
-
-   ftp://source.mvista.com/pub/xscale/iq80310/jffs.img
-
-For detailed info on using MTD and creating a JFFS image go to:
-
-   http://www.linux-mtd.infradead.org.
-
-For details on using RedBoot's FIS commands, type 'fis help' or consult
-your RedBoot manual.
-
-Contributors
------------------------------
-
-Thanks to Intel Corporation for providing the hardware.
-
-John Clark <jclark@teamasa.com> - Initial discovery of RedBoot issues
-Dave Jiang <dave.jiang@intel.com> - IRQ demux fixes, AAU, DMA, MU
-Nicolas Pitre <nico@cam.org> - Initial port, cleanup, debugging
-Matt Porter <mporter@mvista.com> - PCI subsystem development, debugging
-Tim Sanders <tsanders@sanders.org> - Initial PCI code
-Mark Salter <msalter@redhat.com> - RedBoot fixes
-Deepak Saxena <dsaxena@mvista.com> - Cleanup, debug, cache lock, PMU
-
------------------------------
-Enjoy.
-
-If you have any problems please contact Deepak Saxena <dsaxena@mvista.com>
-
-A few notes from rmk
------------------------------
-
-These are notes of my initial experience getting the IQ80310 Rev D up and
-running.  In total, it has taken many hours to work out what's going on...
-The version of redboot used is:
-
- RedBoot(tm) bootstrap and debug environment, version UNKNOWN - built 14:58:21, Aug 15 2001
-
-
-1. I've had a corrupted download of the redboot.bin file from Montavista's
-   FTP site.  It would be a good idea if there were md5sums, sum or gpg
-   signatures available to ensure the integrity of the downloaded files.
-   The result of this was an apparantly 100% dead card.
-
-2. RedBoot Intel EtherExpress Pro 100 driver seems to be very unstable -
-   I've had it take out the whole of a 100mbit network for several minutes.
-   The Hub indiates ZERO activity, despite machines attempting to communicate.
-   Further to this, while tftping the kernel, the transfer will stall regularly,
-   and might even drop the link LED.
-
-3. There appears to be a bug in the Intel Documentation Pack that comes with
-   the IQ80310 board.  Serial port 1, which is the socket next to the LEDs
-   is address 0xfe810000, not 0xfe800000.
-
-   Note that RedBoot uses either serial port 1 OR serial port 2, so if you
-   have your console connected to the wrong port, you'll see redboot messages
-   but not kernel boot messages.
-
-4. Trying to use fconfig to setup a boot script fails - it hangs when trying
-   to erase the flash.
diff -Nru a/Documentation/arm/XScale/IOP3XX/IQ80321 b/Documentation/arm/XScale/IOP3XX/IQ80321
--- a/Documentation/arm/XScale/IOP3XX/IQ80321	Tue Jun 15 22:20:44 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,215 +0,0 @@
-
-Board Overview
------------------------------
-
-The Worcester IQ80321 board is an evaluation platform for Intel's 80321 Xscale
-CPU (sometimes called IOP321 chipset).
-
-The 80321 contains a single PCI hose (called the ATUs), a PCI-to-PCI bridge,
-two DMA channels, I2C, I2O messaging unit, XOR unit for RAID operations,
-a bus performance monitoring unit, and a memory controller with ECC features.
-
-For more information on the board, see http://developer.intel.com/iio
-
-Port Status
------------------------------
-
-Supported:
-
-- MTD/JFFS/JFFS2 root
-- NFS root
-- RAMDISK root
-- Serial port (ttyS0)
-- Cache/TLB locking on 80321 CPU
-- Performance monitoring unit on 80321 CPU
-
-TODO:
-
-- DMA engines
-- I2C
-- 80321 Bus Performance Monitor
-- Application Accelerator Unit (XOR engine for RAID)
-- I2O Messaging Unit
-- I2C unit
-- SSP
-
-Building the Kernel
------------------------------
-make iq80321_config
-make oldconfig
-make zImage
-
-This will build an image setup for BOOTP/NFS root support.  To change this,
-just run make menuconfig and disable nfs root or add a "root=" option.
-
-Preparing the Hardware
------------------------------
-
-Make sure you do an 'fis init' command once you boot with the new
-RedBoot image.
-
-Downloading Linux
------------------------------
-
-Assuming you have your development system setup to act as a bootp/dhcp
-server and running tftp:
-
-NOTE: The 80321 board uses a different default memory map than the 80310.
-
-   RedBoot> load -r -b 0x01008000 -m y
-
-Once the download is completed:
-
-   RedBoot> go 0x01008000
-
-There is a version of RedBoot floating around that has DHCP support, but
-I've never been able to cleanly transfer a kernel image and have it run.
-
-Root Devices
------------------------------
-
-A kernel is not useful without a root filesystem, and you have several
-choices with this board:  NFS root, RAMDISK, or JFFS/JFFS2.  For development
-purposes, it is suggested that you use NFS root for easy access to various
-tools.  Once you're ready to deploy, probably want to utilize JFFS/JFFS2 on
-the flash device.
-
-MTD on the IQ80321
------------------------------
-
-Linux on the IQ80321 supports RedBoot FIS paritioning if it is enabled.
-Out of the box, once you've done 'fis init' on RedBoot, you will get
-the following partitioning scheme:
-
-   root@192.168.0.14:~# cat /proc/mtd
-   dev:    size   erasesize  name
-   mtd0: 00040000 00020000 "RedBoot"
-   mtd1: 00040000 00020000 "RedBoot[backup]"
-   mtd2: 0075f000 00020000 "unallocated space"
-   mtd3: 00001000 00020000 "RedBoot config"
-   mtd4: 00020000 00020000 "FIS directory"
-
-To create an FIS directory, you need to use the fis command in RedBoot.
-As an example, you can burn the kernel into the flash once it's downloaded:
-
-   RedBoot> fis create -b 0x01008000 -l 0x8CBAC -r 0x01008000 -f 0x80000 kernel
-   ... Erase from 0x00080000-0x00120000: .....
-   ... Program from 0x01008000-0x01094bac at 0x00080000: .....
-   ... Unlock from 0x007e0000-0x00800000: .
-   ... Erase from 0x007e0000-0x00800000: .
-   ... Program from 0x01fdf000-0x01fff000 at 0x007e0000: .
-   ... Lock from 0x007e0000-0x00800000: .
-
-   RedBoot> fis list
-   Name              FLASH addr  Mem addr    Length      Entry point
-   RedBoot           0x00000000  0x00000000  0x00040000  0x00000000
-   RedBoot[backup]   0x00040000  0x00040000  0x00040000  0x00000000
-   RedBoot config    0x007DF000  0x007DF000  0x00001000  0x00000000
-   FIS directory     0x007E0000  0x007E0000  0x00020000  0x00000000
-   kernel            0x00080000  0x01008000  0x000A0000  0x00000000
-
-This leads to the following Linux MTD setup:
-
-   mtroot@192.168.0.14:~# cat /proc/mtd
-   dev:    size   erasesize  name
-   mtd0: 00040000 00020000 "RedBoot"
-   mtd1: 00040000 00020000 "RedBoot[backup]"
-   mtd2: 000a0000 00020000 "kernel"
-   mtd3: 006bf000 00020000 "unallocated space"
-   mtd4: 00001000 00020000 "RedBoot config"
-   mtd5: 00020000 00020000 "FIS directory"
-
-Note that there is not a 1:1 mapping to the number of RedBoot paritions to
-MTD partitions as unused space also gets allocated into MTD partitions.
-
-As an aside, the -r option when creating the Kernel entry allows you to
-simply do an 'fis load kernel' to copy the image from flash into memory.
-You can then do an 'fis go 0x01008000' to start Linux.
-
-If you choose to use static partitioning instead of the RedBoot partioning:
-
-   /dev/mtd0  0x00000000 - 0x0007ffff: Boot Monitor     (512k)
-   /dev/mtd1  0x00080000 - 0x0011ffff: Kernel Image     (640K)
-   /dev/mtd2  0x00120000 - 0x0071ffff: File System      (6M)
-   /dev/mtd3  0x00720000 - 0x00800000: RedBoot Reserved (896K)
-
-To use a JFFS1/2 root FS, you need to donwload the JFFS image using either
-tftp or ymodem, and then copy it to flash:
-
-   RedBoot> load -r -b 0x01000000 /tftpboot/jffs.img
-   Raw file loaded 0x01000000-0x01600000
-   RedBoot> fis create -b 0x01000000 -l 0x600000 -f 0x120000 jffs
-   ... Erase from 0x00120000-0x00720000: ..................................
-   ... Program from 0x01000000-0x01600000 at 0x00120000: ..................
-   ......................
-   ... Unlock from 0x007e0000-0x00800000: .
-   ... Erase from 0x007e0000-0x00800000: .
-   ... Program from 0x01fdf000-0x01fff000 at 0x007e0000: .
-   ... Lock from 0x007e0000-0x00800000: .
-   RedBoot> fis list
-   Name              FLASH addr  Mem addr    Length      Entry point
-   RedBoot           0x00000000  0x00000000  0x00040000  0x00000000
-   RedBoot[backup]   0x00040000  0x00040000  0x00040000  0x00000000
-   RedBoot config    0x007DF000  0x007DF000  0x00001000  0x00000000
-   FIS directory     0x007E0000  0x007E0000  0x00020000  0x00000000
-   kernel            0x00080000  0x01008000  0x000A0000  0x01008000
-   jffs              0x00120000  0x00120000  0x00600000  0x00000000
-
-This looks like this in Linux:
-
-   root@192.168.0.14:~# cat /proc/mtd
-   dev:    size   erasesize  name
-   mtd0: 00040000 00020000 "RedBoot"
-   mtd1: 00040000 00020000 "RedBoot[backup]"
-   mtd2: 000a0000 00020000 "kernel"
-   mtd3: 00600000 00020000 "jffs"
-   mtd4: 000bf000 00020000 "unallocated space"
-   mtd5: 00001000 00020000 "RedBoot config"
-   mtd6: 00020000 00020000 "FIS directory"
-
-You need to boot the kernel once and watch the boot messages to see how the
-JFFS RedBoot partition mapped into the MTD partition scheme.
-
-You can grab a pre-built JFFS image to use as a root file system at:
-
-   ftp://source.mvista.com/pub/xscale/iq80310/jffs.img
-
-For detailed info on using MTD and creating a JFFS image go to:
-
-   http://www.linux-mtd.infradead.org.
-
-For details on using RedBoot's FIS commands, type 'fis help' or consult
-your RedBoot manual.
-
-BUGS and ISSUES
------------------------------
-
-* As shipped from Intel, pre-production boards have two issues:
-
-- The on board ethernet is disabled S8E1-2 is off. You will need to turn it on.
-
-- The PCIXCAPs are configured for a 100Mhz clock, but the clock selected is
-  actually only 66Mhz. This causes the wrong PPL multiplier to be used and the
-  board only runs at 400Mhz instead of 600Mhz. The way to observe this is to
-  use a independent clock to time a "sleep 10" command from the prompt. If it
-  takes 15 seconds instead of 10, you are running at 400Mhz.
-
-- The experimental IOP310 drivers for the AAU, DMA, etc. are not supported yet.
-
-Contributors
------------------------------
-The port to the IQ80321 was performed by:
-
-Rory Bolt <rorybolt@pacbell.net> - Initial port, debugging.
-
-This port was based on the IQ80310 port with the following contributors:
-
-Nicolas Pitre <nico@cam.org> - Initial port, cleanup, debugging
-Matt Porter <mporter@mvista.com> - PCI subsystem development, debugging
-Tim Sanders <tsanders@sanders.org> - Initial PCI code
-Deepak Saxena <dsaxena@mvista.com> - Cleanup, debug, cache lock, PMU
-
-The port is currently maintained by Deepak Saxena <dsaxena@mvista.com>
-
------------------------------
-Enjoy.
diff -Nru a/Documentation/arm/XScale/IOP3XX/aau.txt b/Documentation/arm/XScale/IOP3XX/aau.txt
--- a/Documentation/arm/XScale/IOP3XX/aau.txt	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,178 +0,0 @@
-Support functions for the Intel 80310 AAU
-===========================================
-
-Dave Jiang <dave.jiang@intel.com>
-Last updated: 09/18/2001
-
-The Intel 80312 companion chip in the 80310 chipset contains an AAU. The
-AAU is capable of processing up to 8 data block sources and perform XOR
-operations on them. This unit is typically used to accelerated XOR
-operations utilized by RAID storage device drivers such as RAID 5. This
-API is designed to provide a set of functions to take adventage of the
-AAU. The AAU can also be used to transfer data blocks and used as a memory
-copier. The AAU transfer the memory faster than the operation performed by
-using CPU copy therefore it is recommended to use the AAU for memory copy.
-
-------------------
-int aau_request(u32 *aau_context, const char *device_id);
-This function allows the user the acquire the control of the the AAU. The
-function will return a context of AAU to the user and allocate
-an interrupt for the AAU. The user must pass the context as a parameter to
-various AAU API calls.
-
-int aau_queue_buffer(u32 aau_context, aau_head_t *listhead);
-This function starts the AAU operation. The user must create a SGL
-header with a SGL attached. The format is presented below. The SGL is
-built from kernel memory.
-
-/* hardware descriptor */
-typedef struct _aau_desc
-{
-    u32 NDA;                    /* next descriptor address [READONLY] */
-    u32 SAR[AAU_SAR_GROUP];     /* src addrs */
-    u32 DAR;                    /* destination addr */
-    u32 BC;                     /* byte count */
-    u32 DC;                     /* descriptor control */
-    u32 SARE[AAU_SAR_GROUP];    /* extended src addrs */
-} aau_desc_t;
-
-/* user SGL format */
-typedef struct _aau_sgl
-{
-    aau_desc_t          aau_desc;  /* AAU HW Desc */
-    u32		        status;    /* status of SGL [READONLY] */
-    struct _aau_sgl	*next;     /* pointer to next SG [READONLY] */
-    void                *dest;     /* destination addr */
-    void                *src[AAU_SAR_GROUP]; 	    /* source addr[4] */
-    void                *ext_src[AAU_SAR_GROUP];    /* ext src addr[4] */
-    u32                 total_src; /* total number of source */
-} aau_sgl_t;
-
-/* header for user SGL */
-typedef struct _aau_head
-{
-    u32		total;      /* total descriptors allocated */
-    u32         status;     /* SGL status */
-    aau_sgl_t   *list;      /* ptr to head of list */
-    aau_callback_t  callback;  /* callback func ptr */
-} aau_head_t;
-
-
-The function will call aau_start() and start the AAU after it queues
-the SGL to the processing queue. When the function will either
-a. Sleep on the wait queue aau->wait_q if no callback has been provided, or
-b. Continue and then call the provided callback function when DMA interrupt
-   has been triggered.
-
-int aau_suspend(u32 aau_context);
-Stops/Suspends the AAU operation
-
-int aau_free(u32 aau_context);
-Frees the ownership of AAU. Called when no longer need AAU service.
-
-aau_sgl_t * aau_get_buffer(u32 aau_context, int num_buf);
-This function obtains an AAU SGL for the user. User must specify the number
-of descriptors to be allocated in the chain that is returned.
-
-void aau_return_buffer(u32 aau_context, aau_sgl_t *list);
-This function returns all SGL back to the API after user is done.
-
-int aau_memcpy(void *dest, void *src, u32 size);
-This function is a short cut for user to do memory copy utilizing the AAU for
-better large block memory copy vs using the CPU. This is similar to using
-typical memcpy() call.
-
-* User is responsible for the source address(es) and the destination address.
-  The source and destination should all be cached memory.
-
-
-
-void aau_test()
-{
-	u32 aau;
-	char dev_id[] = "AAU";
-	int size = 2;
-	int err = 0;
-	aau_head_t *head;
-	aau_sgl_t *list;
-	u32 i;
-	u32 result = 0;
-	void *src, *dest;
-
-	printk("Starting AAU test\n");
-	if((err = aau_request(&aau, dev_id))<0)
-	{
-		printk("test - AAU request failed: %d\n", err);
-		return;
-	}
-	else
-	{
-		printk("test - AAU request successful\n");
-	}
-
-	head = kmalloc(sizeof(aau_head_t), GFP_KERNEL);
-	head->total = size;
-	head->status = 0;
-	head->callback = NULL;
-
-	list = aau_get_buffer(aau, size);
-	if(!list)
-	{
-		printk("Can't get buffers\n");
-		return;
-	}
-	head->list = list;
-
-	src = kmalloc(1024, GFP_KERNEL);
-	dest = kmalloc(1024, GFP_KERNEL);
-
-	while(list)
-	{
-		list->status = 0;
-		list->aau_desc->SAR[0] = (u32)src;
-		list->aau_desc->DAR = (u32)dest;
-		list->aau_desc->BC = 1024;
-
-		/* see iop310-aau.h for more DCR commands */
-		list->aau_desc->DC = AAU_DCR_WRITE | AAU_DCR_BLKCTRL_1_DF;
-		if(!list->next)
-		{
-			list->aau_desc->DC = AAU_DCR_IE;
-			break;
-		}
-		list = list->next;
-	}
-
-	printk("test- Queueing buffer for AAU operation\n");
-	err = aau_queue_buffer(aau, head);
-	if(err >= 0)
-	{
-		printk("AAU Queue Buffer is done...\n");
-	}
-	else
-	{
-		printk("AAU Queue Buffer failed...: %d\n", err);
-	}
-
-
-
-#if 1
-	printk("freeing the AAU\n");
-	aau_return_buffer(aau, head->list);
-	aau_free(aau);
-	kfree(src);
-	kfree(dest);
-	kfree((void *)head);
-#endif
-}
-
-All Disclaimers apply. Use this at your own discretion. Neither Intel nor I
-will be responsible if anything goes wrong. =)
-
-
-TODO
-____
-* Testing
-* Do zero-size AAU transfer/channel at init
-  so all we have to do is chainining
-
diff -Nru a/Documentation/arm/XScale/IOP3XX/dma.txt b/Documentation/arm/XScale/IOP3XX/dma.txt
--- a/Documentation/arm/XScale/IOP3XX/dma.txt	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,214 +0,0 @@
-Support functions forthe Intel 80310 DMA channels
-==================================================
-
-Dave Jiang <dave.jiang@intel.com>
-Last updated: 09/18/2001
-
-The Intel 80310 XScale chipset provides 3 DMA channels via the 80312 I/O
-companion chip. Two of them resides on the primary PCI bus and one on the
-secondary PCI bus.
-
-The DMA API provided is not compatible with the generic interface in the
-ARM tree unfortunately due to how the 80312 DMACs work. Hopefully some time
-in the near future a software interface can be done to bridge the differences.
-The DMA API has been modeled after Nicholas Pitre's SA11x0 DMA API therefore
-they will look somewhat similar.
-
-
-80310 DMA API
--------------
-
-int dma_request(dmach_t channel, const char *device_id);
-
-This function will attempt to allocate the channel depending on what the
-user requests:
-
-IOP310_DMA_P0: PCI Primary 1
-IOP310_DMA_P1: PCI Primary 2
-IOP310_DMA_S0: PCI Secondary 1
-/*EOF*/
-
-Once the user allocates the DMA channel it is owned until released. Although
-other users can also use the same DMA channel, but no new resources will be
-allocated. The function will return the allocated channel number if successful.
-
-int dma_queue_buffer(dmach_t channel, dma_sghead_t *listhead);
-
-The user will construct a SGL in the form of below:
-/*
- * Scattered Gather DMA List for user
- */
-typedef struct _dma_desc
-{
-    u32  NDAR;       /* next descriptor adress [READONLY] */
-    u32  PDAR;       /* PCI address */
-    u32  PUADR;      /* upper PCI address */
-    u32  LADR;       /* local address */
-    u32  BC;         /* byte count */
-    u32  DC;         /* descriptor control */
-} dma_desc_t;
-
-typedef struct _dma_sgl
-{
-    dma_desc_t      dma_desc;     /* DMA descriptor */
-    u32             status;       /* descriptor status [READONLY] */
-    u32	    	    data;	  /* user defined data */
-    struct _dma_sgl *next;	  /* next descriptor [READONLY] */
-} dma_sgl_t;
-
-/* dma sgl head */
-typedef struct _dma_head
-{
-    u32		    total;	/* total elements in SGL */
-    u32		    status;	/* status of sgl */
-    u32		    mode;	/* read or write mode */
-    dma_sgl_t	    *list;	/* pointer to list */
-    dma_callback_t  callback;   /* callback function */
-} dma_head_t;
-
-
-The user shall allocate user SGL elements by calling the function:
-dma_get_buffer(). This function will give the user an SGL element. The user
-is responsible for creating the SGL head however. The user is also
-responsible for allocating the memory for DMA data. The following code segment
-shows how a DMA operation can be performed:
-
-#include <asm/arch/iop310-dma.h>
-
-void dma_test(void)
-{
-	char dev_id[] = "Primary 0";
-	dma_head_t *sgl_head = NULL;
-	dma_sgl_t *sgl = NULL;
-	int err = 0;
-	int channel = -1;
-	u32 *test_ptr = 0;
-	DECLARE_WAIT_QUEUE_HEAD(wait_q);
-
-
-	*(IOP310_ATUCR) = (IOP310_ATUCR_PRIM_OUT_ENAB |
-			IOP310_ATUCR_DIR_ADDR_ENAB);
-
-	channel = dma_request(IOP310_DMA_P0, dev_id);
-
-	sgl_head = (dma_head_t *)kmalloc(sizeof(dma_head_t), GFP_KERNEL);
-	sgl_head->callback = NULL;      /* no callback created */
-	sgl_head->total = 2; /* allocating 2 DMA descriptors */
-	sgl_head->mode = (DMA_MOD_WRITE);
-	sgl_head->status = 0;
-
-	/* now we get the two descriptors */
-	sgl = dma_get_buffer(channel, 2);
-
-    	/* we set the header to point to the list we allocated */
-    	sgl_head->list = sgl;
-
-	/* allocate 1k of DMA data */
-    	sgl->data = (u32)kmalloc(1024, GFP_KERNEL);
-
-    	/* Local address is physical */
-	sgl->dma_desc.LADR = (u32)virt_to_phys(sgl->data);
-
-	/* write to arbitrary location over the PCI bus */
-    	sgl->dma_desc.PDAR = 0x00600000;
-	sgl->dma_desc.PUADR = 0;
-	sgl->dma_desc.BC = 1024;
-
-    	/* set write & invalidate PCI command */
-	sgl->dma_desc.DC = DMA_DCR_PCI_MWI;
-	sgl->status = 0;
-
-    	/* set a pattern */
-    	memset(sgl->data, 0xFF, 1024);
-
-	/* User's responsibility to keep buffers cached coherent */
-	cpu_dcache_clean(sgl->data, sgl->data + 1024);
-
-	sgl = sgl->next;
-
-	sgl->data = (u32)kmalloc(1024, GFP_KERNEL);
-	sgl->dma_desc.LADR = (u32)virt_to_phys(sgl->data);
-	sgl->dma_desc.PDAR = 0x00610000;
-	sgl->dma_desc.PUADR = 0;
-	sgl->dma_desc.BC = 1024;
-
-	/* second descriptor has interrupt flag enabled */
-	sgl->dma_desc.DC = (DMA_DCR_PCI_MWI | DMA_DCR_IE);
-
-	/* must set end of chain flag */
-	sgl->status = DMA_END_CHAIN; /* DO NOT FORGET THIS!!!! */
-
-    	memset(sgl->data, 0x0f, 1024);
-	/* User's responsibility to keep buffers cached coherent */
-	cpu_dcache_clean(sgl->data, sgl->data + 1024);
-
-    	/* queuing the buffer, this function will sleep since no callback */
-    	err = dma_queue_buffer(channel, sgl_head);
-
-    	/* now we are woken from DMA complete */
-
-    	/* do data operations here */
-
-    	/* free DMA data if necessary */
-
-	/* return the descriptors */
-	dma_return_buffer(channel, sgl_head->list);
-
-	/* free the DMA */
-	dma_free(channel);
-
-	kfree((void *)sgl_head);
-}
-
-
-dma_sgl_t * dma_get_buffer(dmach_t channel, int buf_num);
-
-This call allocates DMA descriptors for the user.
-
-
-void dma_return_buffer(dmach_t channel, dma_sgl_t *list);
-
-This call returns the allocated descriptors back to the API.
-
-
-int dma_suspend(dmach_t channel);
-
-This call suspends any DMA transfer on the given channel.
-
-
-
-int dma_resume(dmach_t channel);
-
-This call resumes a DMA transfer which would have been stopped through
-dma_suspend().
-
-
-int dma_flush_all(dmach_t channel);
-
-This completely flushes all queued buffers and on-going DMA transfers on a
-given channel. This is called when DMA channel errors have occurred.
-
-
-void dma_free(dmach_t channel);
-
-This clears all activities on a given DMA channel and releases it for future
-requests.
-
-
-
-Buffer Allocation
------------------
-It is the user's responsibility to allocate, free, and keep track of the
-allocated DMA data memory. Upon calling dma_queue_buffer() the user must
-relinquish the control of the buffers to the kernel and not change the
-state of the buffers that it has passed to the kernel. The user will regain
-the control of the buffers when it has been woken up by the bottom half of
-the DMA interrupt handler. The user can allocate cached buffers or non-cached
-via pci_alloc_consistent(). It is the user's responsibility to ensure that
-the data is cache coherent.
-
-*Reminder*
-The user is responsble to ensure the ATU is setup properly for DMA transfers.
-
-All Disclaimers apply. Use this at your own discretion. Neither Intel nor I
-will be responsible ifanything goes wrong.
diff -Nru a/Documentation/arm/XScale/IOP3XX/message.txt b/Documentation/arm/XScale/IOP3XX/message.txt
--- a/Documentation/arm/XScale/IOP3XX/message.txt	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,110 +0,0 @@
-Support functions for the Intel 80310 MU
-===========================================
-
-Dave Jiang <dave.jiang@intel.com>
-Last updated: 10/11/2001
-
-The messaging unit of the IOP310 contains 4 components and is utilized for
-passing messages between the PCI agents on the primary bus and the Intel(R)
-80200 CPU. The four components are:
-Messaging Component
-Doorbell Component
-Circular Queues Component
-Index Registers Component
-
-Messaging Component:
-Contains 4 32bit registers, 2 in and 2 out. Writing to the registers assert
-interrupt on the PCI bus or to the 80200 depend on incoming or outgoing.
-
-int mu_msg_request(u32 *mu_context);
-Request the usage of Messaging Component. mu_context is written back by the
-API. The MU context is passed to other Messaging calls as a parameter.
-
-int mu_msg_set_callback(u32 mu_context, u8 reg, mu_msg_cb_t func);
-Setup the callback function for incoming messages. Callback can be setup for
-outbound 0, 1, or both outbound registers.
-
-int mu_msg_post(u32 mu_context, u32 val, u8 reg);
-Posting a message in the val parameter. The reg parameter denotes whether
-to use register 0, 1.
-
-int mu_msg_free(u32 mu_context, u8 mode);
-Free the usage of messaging component. mode can be specified soft or hard. In
-hardmode all resources are unallocated.
-
-Doorbell Component:
-The doorbell registers contains 1 inbound and 1 outbound. Depending on the bits
-being set different interrupts are asserted.
-
-int mu_db_request(u32 *mu_context);
-Request the usage of the doorbell register.
-
-int mu_db_set_callback(u32 mu_context, mu_db_cb_t func);
-Setting up the inbound callback.
-
-void mu_db_ring(u32 mu_context, u32 mask);
-Write to the outbound db register with mask.
-
-int mu_db_free(u32 mu_context);
-Free the usage of doorbell component.
-
-Circular Queues Component:
-The circular queue component has 4 circular queues. Inbound post, inbound free,
-outbound post, outbound free. These queues are used to pass messages.
-
-int mu_cq_request(u32 *mu_context, u32 q_size);
-Request the usage of the queue. See code comment header for q_size. It tells
-the API how big of queues to setup.
-
-int mu_cq_inbound_init(u32 mu_context, mfa_list_t *list, u32 size,
-                       mu_cq_cb_t func);
-Init inbound queues. The user must provide a list of free message frames to
-be put in inbound free queue and the callback function to handle the inbound
-messages.
-
-int mu_cq_enable(u32 mu_context);
-Enables the circular queues mechanism. Called once all the setup functions
-are called.
-
-u32 mu_cq_get_frame(u32 mu_context);
-Obtain the address of an outbound free frame for the user.
-
-int mu_cq_post_frame(u32 mu_context, u32 mfa);
-The user can post the frame once getting the frame and put information in the
-frame.
-
-int mu_cq_free(u32 mu_context);
-Free the usage of circular queues mechanism.
-
-Index Registers Component:
-The index register provides the mechanism to receive inbound messages.
-
-int mu_ir_request(u32 *mu_context);
-Request of Index Register component usage.
-
-int mu_ir_set_callback(u32 mu_context, mu_ir_cb_t callback);
-Setting up callback for inbound messages. The callback will receive the
-value of the register that IAR offsets to.
-
-int mu_ir_free(u32 mu_context);
-Free the usage of Index Registers component.
-
-void mu_set_irq_threshold(u32 mu_context, int thresh);
-Setup the IRQ threshold before relinquish processing in IRQ space. Default
-is set at 10 loops.
-
-
-*NOTE: Example of host driver that utilize the MU can be found in the Linux I2O
-driver. Specifically i2o_pci and some functions of i2o_core. The I2O driver
-only utilize the circular queues mechanism. The other 3 components are simple
-enough that they can be easily setup. The MU API provides no flow control for
-the messaging mechanism. Flow control of the messaging needs to be established
-by a higher layer of software on the IOP or the host driver.
-
-All Disclaimers apply. Use this at your own discretion. Neither Intel nor I
-will be responsible if anything goes wrong. =)
-
-
-TODO
-____
-
diff -Nru a/Documentation/arm/XScale/IOP3XX/pmon.txt b/Documentation/arm/XScale/IOP3XX/pmon.txt
--- a/Documentation/arm/XScale/IOP3XX/pmon.txt	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,71 +0,0 @@
-
-Intel's XScale Microarchitecture 80312 companion processor provides a
-Performance Monitoring Unit (PMON) that can be utilized to provide
-information that can be useful for fine tuning of code.  This text
-file describes the API that's been developed for use by Linux kernel
-programmers.  Note that to get the most usage out of the PMON,
-I highly reccomend getting the XScale reference manual from Intel[1]
-and looking at chapter 12.
-
-To use the PMON, you must #include <asm-arm/arch-iop310/pmon.h> in your
-source file.
-
-Since there's only one PMON, only one user can currently use the PMON
-at a given time.  To claim the PMON for usage, call iop310_pmon_claim() which
-returns an identifier.  When you are done using the PMON, call
-iop310_pmon_release() with the id you were given earlier.
-
-The PMON consists of 14 registers that can be used for performance measurements.
-By combining different statistics, you can derive complex performance metrics.
-
-To start the PMON, just call iop310_pmon_start(mode).  Mode tells the PMON what
-statistics to capture and can each be one of:
-
-    IOP310_PMU_MODE0
-    Performance Monitoring Disabled
-
-    IOP310_PMU_MODE1
-    Primary PCI bus and internal agents (bridge, dma Ch0, dam Ch1, patu)
-
-    IOP310_PMU_MODE2
-    Secondary PCI bus and internal agents (bridge, dma Ch0, dam Ch1, patu)
-
-    IOP310_PMU_MODE3
-    Secondary PCI bus and internal agents (external masters 0..2 and Intel
-    80312 I/O companion chip)
-
-    IOP310_PMU_MODE4
-    Secondary PCI bus and internal agents (external masters 3..5 and Intel
-    80312 I/O companion chip)
-
-    IOP310_PMU_MODE5
-    Intel 80312 I/O companion chip internal bus, DMA Channels and Application
-    Accelerator
-
-    IOP310_PMU_MODE6
-    Intel 80312 I/O companion chip internal bus, PATU, SATU and Intel 80200
-    processor
-
-    IOP310_PMU_MODE7
-    Intel 80312 I/O companion chip internal bus, Primary PCI bus, Secondary
-    PCI bus and Secondary PCI agents (external masters 0..5 & Intel 80312 I/O
-    companion chip)
-
-To get the results back, call iop310_pmon_stop(&results) where results is
-defined as follows:
-
-typedef struct _iop310_pmon_result
-{
-	u32 timestamp;			/* Global Time Stamp Register */
-	u32 timestamp_overflow;		/* Time Stamp overflow count */
-	u32 event_count[14];		/* Programmable Event Counter
-					   Registers 1-14 */
-	u32 event_overflow[14];		/* Overflow counter for PECR1-14 */
-} iop310_pmon_res_t;
-
-
---
-This code is still under development, so please feel free to send patches,
-questions, comments, etc to me.
-
-Deepak Saxena <dsaxena@mvista.com>
diff -Nru a/Documentation/arm/XScale/cache-lock.txt b/Documentation/arm/XScale/cache-lock.txt
--- a/Documentation/arm/XScale/cache-lock.txt	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,123 +0,0 @@
-
-Intel's XScale Microarchitecture provides support for locking of data
-and instructions into the appropriate caches. This  file provides
-an overview of the API that has been developed to take advantage of this
-feature from kernel space. Note that there is NO support for user space
-cache locking.
-
-For example usage of this code, grab:
-
-	ftp://source.mvista.com/pub/xscale/cache-test.c
-
-If you have any questions, comments, patches, etc, please contact me.
-
-Deepak Saxena <dsaxena@mvista.com>
-
-API DESCRIPTION
-
-
-I. Header File
-
-   #include <asm/xscale-lock.h>
-
-II. Cache Capability Discovery
-
-   SYNOPSIS
-
-   int cache_query(u8 cache_type,
-                           struct cache_capabilities *pcache);
-
-   struct cache_capabilities
-   {
-      u32   flags;      /* Flags defining capabilities  */
-      u32   cache_size; /* Cache size in K (1024 bytes) */
-      u32   max_lock;   /* Maximum lockable region in K */
-   }
-
-   /*
-    * Flags
-    */
-
-   /*
-    * Bit 0: Cache lockability
-    * Bits 1-31: Reserved for future use
-    */
-   #define CACHE_LOCKABLE    0x00000001   /* Cache can be locked */
-
-   /*
-    * Cache Types
-    */
-   #define ICACHE            0x00
-   #define DCACHE            0x01
-
-   DESCRIPTION
-
-   This function fills out the pcache capability identifier for the
-   requested cache. cache_type is either DCACHE or ICACHE. This
-   function is not very useful at the moment as all XScale CPU's
-   have the same size Cache, but is is provided for future XScale
-   based processors that may have larger cache sizes.
-
-   RETURN VALUE
-
-   This function returns 0 if no error occurs, otherwise it returns
-   a negative, errno compatible value.
-
-      -EIO   Unknown hardware error
-
-III. Cache Locking
-
-   SYNOPSIS
-
-   int cache_lock(void *addr, u32 len, u8 cache_type, const char *desc);
-
-   DESCRIPTION
-
-   This function locks a physically contigous portion of memory starting
-   at the virtual address pointed to by addr into the cache referenced
-   by cache_type.
-
-   The address of the data/instruction that is to be locked must be
-   aligned on a cache line boundary (L1_CACHE_ALIGNEMENT).
-
-   The desc parameter is an optional (pass NULL if not used) human readable
-   descriptor of the locked memory region that is used by the cache
-   management code to build the /proc/cache_locks table.
-
-   Note that this function does not check whether the address is valid
-   or not before locking it into the cache.  That duty is up to the
-   caller.  Also, it does not check for duplicate or overlaping
-   entries.
-
-   RETURN VALUE
-
-   If the function is successful in locking the entry into cache, a
-   zero is returned.
-
-   If an error occurs, an appropriate error value is returned.
-
-      -EINVAL   The memory address provided was not cache line aligned
-      -ENOMEM   Could not allocate memory to complete operation
-      -ENOSPC   Not enough space left on cache to lock in requested region
-      -EIO      Unknown error
-
-III. Cache Unlocking
-
-   SYNOPSIS
-
-   int cache_unlock(void *addr)
-
-   DESCRIPTION
-
-   This function unlocks a portion of memory that was previously locked
-   into either the I or D cache.
-
-   RETURN VALUE
-
-   If the entry is cleanly unlocked from the cache, a 0 is returned.
-   In the case of an error, an appropriate error is returned.
-
-      -ENOENT    No entry with given address associated with this cache
-      -EIO       Unknown error
-
-
diff -Nru a/Documentation/arm/XScale/pmu.txt b/Documentation/arm/XScale/pmu.txt
--- a/Documentation/arm/XScale/pmu.txt	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,168 +0,0 @@
-
-Intel's XScale Microarchitecture processors provide a Performance
-Monitoring Unit (PMU) that can be utilized to provide information
-that can be useful for fine tuning of code.  This text file describes
-the API that's been developed for use by Linux kernel programmers.
-When I have some extra time on my hand, I will extend the code to
-provide support for user mode performance monitoring (which is
-probably much more useful).  Note that to get the most usage out
-of the PMU, I highly reccomend getting the XScale reference manual
-from Intel and looking at chapter 12.
-
-To use the PMU, you must #include <asm/xscale-pmu.h> in your source file.
-
-Since there's only one PMU, only one user can currently use the PMU
-at a given time.  To claim the PMU for usage, call pmu_claim() which
-returns an identifier.  When you are done using the PMU, call
-pmu_release() with the identifier that you were given by pmu_claim.
-
-In addition, the PMU can only be used on XScale based systems that
-provide an external timer.  Systems that the PMU is currently supported
-on are:
-
-	- Cyclone IQ80310
-
-Before delving into how to use the PMU code, let's do a quick overview
-of the PMU itself.  The PMU consists of three registers that can be
-used for performance measurements.  The first is the CCNT register with
-provides the number of clock cycles elapsed since the PMU was started.
-The next two register, PMN0 and PMN1, are eace user programmable to
-provide 1 of 20 different performance statistics.  By combining different
-statistics, you can derive complex performance metrics.
-
-To start the PMU, just call pmu_start(pm0, pmn1).  pmn0 and pmn1 tell
-the PMU what statistics to capture and can each be one of:
-
-EVT_ICACHE_MISS
-	Instruction fetches requiring access to external memory
-
-EVT_ICACHE_NO_DELIVER
-	Instruction cache could not deliver an instruction.  Either an
-	ICACHE miss or an instruction TLB miss.
-
-EVT_ICACHE_DATA_STALL
-	Stall in execution due to a data dependency. This counter is
-	incremented each cycle in which the condition is present.
-
-EVT_ITLB_MISS
-	Instruction TLB miss
-
-EVT_DTLB_MISS
-	Data TLB miss
-
-EVT_BRANCH
-	A branch instruction was executed and it may or may not have
-	changed program flow
-
-EVT_BRANCH_MISS
-	A branch (B or BL instructions only) was mispredicted
-
-EVT_INSTRUCTION
-	An instruction was executed
-
-EVT_DCACHE_FULL_STALL
-	Stall because data cache buffers are full.  Incremented on every
-	cycle in which condition is present.
-
-EVT_DCACHE_FULL_STALL_CONTIG
-	Stall because data cache buffers are full.  Incremented on every
-	cycle in which condition is contigous.
-
-EVT_DCACHE_ACCESS
-	Data cache access (data fetch)
-
-EVT_DCACHE_MISS
-	Data cache miss
-
-EVT_DCACHE_WRITE_BACK
-	Data cache write back.  This counter is incremented for every
-	1/2 line (four words) that are written back.
-
-EVT_PC_CHANGED
-	Software changed the PC.  This is incremented only when the
-	software changes the PC and there is no mode change.  For example,
-	a MOV instruction that targets the PC would increment the counter.
-	An SWI would not as it triggers a mode change.
-
-EVT_BCU_REQUEST
-	The Bus Control Unit(BCU) received a request from the core
-
-EVT_BCU_FULL
-	The BCU request queue if full.  A high value for this event means
-	that the BCU is often waiting for to complete on the external bus.
-
-EVT_BCU_DRAIN
-	The BCU queues were drained due to either a Drain Write Buffer
-	command or an I/O transaction for a page that was marked as
-	uncacheable and unbufferable.
-
-EVT_BCU_ECC_NO_ELOG
-	The BCU detected an ECC error on the memory bus but noe ELOG
-	register was available to to log the errors.
-
-EVT_BCU_1_BIT_ERR
-	The BCU detected a 1-bit error while reading from the bus.
-
-EVT_RMW
-	An RMW cycle occurred due to narrow write on ECC protected memory.
-
-To get the results back, call pmu_stop(&results) where results is defined
-as a struct pmu_results:
-
-	struct pmu_results
-	{
-		u32     ccnt;	/* Clock Counter Register */
-		u32	ccnt_of; /
-		u32     pmn0;	/* Performance Counter Register 0 */
-		u32	pmn0_of;
-		u32     pmn1;	/* Performance Counter Register 1 */
-		u32	pmn1_of;
-	};
-
-Pretty simple huh?  Following are some examples of how to get some commonly
-wanted numbers out of the PMU data.  Note that since you will be dividing
-things, this isn't super useful from the kernel and you need to printk the
-data out to syslog.  See [1] for more examples.
-
-Instruction Cache Efficiency
-
-	pmu_start(EVT_INSTRUCTION, EVT_ICACHE_MISS);
-	...
-	pmu_stop(&results);
-
-	icache_miss_rage = results.pmn1 / results.pmn0;
-	cycles_per_instruction = results.ccnt / results.pmn0;
-
-Data Cache Efficiency
-
-	pmu_start(EVT_DCACHE_ACCESS, EVT_DCACHE_MISS);
-	...
-	pmu_stop(&results);
-
-	dcache_miss_rage = results.pmn1 / results.pmn0;
-
-Instruction Fetch Latency
-
-	pmu_start(EVT_ICACHE_NO_DELIVER, EVT_ICACHE_MISS);
-	...
-	pmu_stop(&results);
-
-	average_stall_waiting_for_instruction_fetch =
-		results.pmn0 / results.pmn1;
-
-	percent_stall_cycles_due_to_instruction_fetch =
-		results.pmn0 / results.ccnt;
-
-
-ToDo:
-
-- Add support for usermode PMU usage.  This might require hooking into
-  the scheduler so that we pause the PMU when the task that requested
-  statistics is scheduled out.
-
---
-This code is still under development, so please feel free to send patches,
-questions, comments, etc to me.
-
-Deepak Saxena <dsaxena@mvista.com>
-
diff -Nru a/Documentation/arm/XScale/tlb-lock.txt b/Documentation/arm/XScale/tlb-lock.txt
--- a/Documentation/arm/XScale/tlb-lock.txt	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,64 +0,0 @@
-
-Intel's XScale Microarchitecture provides support for locking of TLB
-entries in both the instruction and data TLBs.  This  file provides
-an overview of the API that has been developed to take advantage of this
-feature from kernel space. Note that there is NO support for user space.
-
-In general, this feature should be used in conjunction with locking
-data or instructions into the appropriate caches.  See the file
-cache-lock.txt in this directory.
-
-If you have any questions, comments, patches, etc, please contact me.
-
-Deepak Saxena <dsaxena@mvista.com>
-
-
-API DESCRIPTION
-
-I. Header file
-
-   #include <asm/xscale-lock.h>
-
-II. Locking an entry into the TLB
-
-    SYNOPSIS
-
-    xscale_tlb_lock(u8 tlb_type, u32 addr);
-
-    /*
-     * TLB types
-     */
-    #define ITLB	0x0
-    #define DTLB	0x1
-
-    DESCRIPTION
-
-    This function locks the virtual to physical mapping for virtual
-    address addr into the requested TLB.
-
-    RETURN VALUE
-
-    If the entry is properly locked into the TLB, a 0 is returned.
-    In case of an error, an appropriate error is returned.
-
-       -ENOSPC No more entries left in the TLB
-       -EIO    Unknown error
-
-III. Unlocking an entry from a TLB
-
-     SYNOPSIS
-
-     xscale_tlb_unlock(u8 tlb_type, u32 addr);
-
-     DESCRIPTION
-
-     This function unlocks the entry for virtual address addr from the
-     specified cache.
-
-     RETURN VALUE
-
-     If the TLB entry is properly unlocked, a 0 is returned.
-     In case of an error, an appropriate error is returned.
-
-        -ENOENT  No entry for given address in specified TLB
-
diff -Nru a/Documentation/arm/memory.txt b/Documentation/arm/memory.txt
--- a/Documentation/arm/memory.txt	Tue Jun 15 22:21:05 2004
+++ b/Documentation/arm/memory.txt	Tue Jun 15 22:21:05 2004
@@ -1,7 +1,7 @@
 		Kernel Memory Layout on ARM Linux
 
 		Russell King <rmk@arm.linux.org.uk>
-			April 27, 2003 (2.5.68)
+			May 21, 2004 (2.6.6)
 
 This document describes the virtual memory layout which the Linux
 kernel uses for ARM processors.  It indicates which regions are
@@ -29,32 +29,30 @@
 				CPU supports vector relocation (control
 				register V bit.)
 
-ffe00000	fffeffff	Free for platform use, not recommended.
+ffc00000	fffeffff	DMA memory mapping region.  Memory returned
+				by the dma_alloc_xxx functions will be
+				dynamically mapped here.
 
-ffc00000	ffdfffff	2MB consistent memory mapping.
-				Memory returned by the consistent_alloc
-				low level function will be dynamically
-				mapped here.
+ff000000	ffbfffff	Reserved for future expansion of DMA
+				mapping region.
 
-ff000000	ffbfffff	Free for platform use, not recommended.
+VMALLOC_END	feffffff	Free for platform use, recommended.
 
-VMALLOC_END	ff000000	Free for platform use, recommended.
-
-VMALLOC_START	VMALLOC_END	vmalloc() / ioremap() space.
+VMALLOC_START	VMALLOC_END-1	vmalloc() / ioremap() space.
 				Memory returned by vmalloc/ioremap will
 				be dynamically placed in this region.
 				VMALLOC_START may be based upon the value
 				of the high_memory variable.
 
-PAGE_OFFSET	high_memory	Kernel direct-mapped RAM region.
+PAGE_OFFSET	high_memory-1	Kernel direct-mapped RAM region.
 				This maps the platforms RAM, and typically
 				maps all platform RAM in a 1:1 relationship.
 
-TASK_SIZE	PAGE_OFFSET	Kernel module space
+TASK_SIZE	PAGE_OFFSET-1	Kernel module space
 				Kernel modules inserted via insmod are
 				placed here using dynamic mappings.
 
-00001000	TASK_SIZE	User space mappings
+00001000	TASK_SIZE-1	User space mappings
 				Per-thread mappings are placed here via
 				the mmap() system call.
 
diff -Nru a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt
--- a/Documentation/cachetlb.txt	Tue Jun 15 22:20:39 2004
+++ b/Documentation/cachetlb.txt	Tue Jun 15 22:20:39 2004
@@ -322,10 +322,10 @@
 	about doing this.
 
 	The idea is, first at flush_dcache_page() time, if
-	page->mapping->i_mmap{,_shared} are empty lists, just mark the
-	architecture private page flag bit.  Later, in
-	update_mmu_cache(), a check is made of this flag bit, and if
-	set the flush is done and the flag bit is cleared.
+	page->mapping->i_mmap is an empty tree and ->i_mmap_nonlinear
+	an empty list, just mark the architecture private page flag bit.
+	Later, in update_mmu_cache(), a check is made of this flag bit,
+	and if set the flush is done and the flag bit is cleared.
 
 	IMPORTANT NOTE: It is often important, if you defer the flush,
 			that the actual flush occurs on the same CPU
diff -Nru a/Documentation/cdrom/cdrom-standard.tex b/Documentation/cdrom/cdrom-standard.tex
--- a/Documentation/cdrom/cdrom-standard.tex	Tue Jun 15 22:20:38 2004
+++ b/Documentation/cdrom/cdrom-standard.tex	Tue Jun 15 22:20:38 2004
@@ -352,11 +352,6 @@
 \item[1] Open for $ioctl$ commands, as done by audio-CD playing
 programs.
 \end{itemize}
-In case the driver supports modules, the call $MOD_INC_USE_COUNT$
-should be performed exactly once, if the $open()$ was successful. The
-return value is negative on error, and zero on success. The
-open-for-ioctl call can only fail if there is no hardware.
-
 Notice that any strategic code (closing tray upon $open()$, etc.)\ is
 done by the calling routine in \cdromc, so the low-level routine
 should only be concerned with proper initialization, such as spinning
diff -Nru a/Documentation/cpu-freq/amd-powernow.txt b/Documentation/cpu-freq/amd-powernow.txt
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/Documentation/cpu-freq/amd-powernow.txt	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,38 @@
+
+PowerNow! and Cool'n'Quiet are AMD names for frequency
+management capabilities in AMD processors. As the hardware
+implementation changes in new generations of the processors,
+there is a different cpu-freq driver for each generation.
+
+Note that the driver's will not load on the "wrong" hardware,
+so it is safe to try each driver in turn when in doubt as to
+which is the correct driver.
+
+Note that the functionality to change frequency (and voltage)
+is not available in all processors. The drivers will refuse
+to load on processors without this capability. The capability
+is detected with the cpuid instruction.
+
+The drivers use BIOS supplied tables to obtain frequency and
+voltage information appropriate for a particular platform.
+Frequency transitions will be unavailable if the BIOS does
+not supply these tables.
+
+6th Generation: powernow-k6
+
+7th Generation: powernow-k7: Athlon, Duron, Geode.
+
+8th Generation: powernow-k8: Athlon, Athlon 64, Opteron, Sempron.
+Documentation on this functionality in 8th generation processors
+is available in the "BIOS and Kernel Developer's Guide", publication
+26094, in chapter 9, available for download from www.amd.com. 
+
+BIOS supplied data, for powernow-k7 and for powernow-k8, may be
+from either the PSB table or from ACPI objects. The ACPI support
+is only available if the kernel config sets CONFIG_ACPI_PROCESSOR.
+The powernow-k8 driver will attempt to use ACPI if so configured,
+and fall back to PST if that fails.
+The powernow-k7 driver will try to use the PSB support first, and
+fall back to ACPI if the PSB support fails. A module parameter,
+acpi_force, is provided to force ACPI support to be used instead 
+of PSB support.
diff -Nru a/Documentation/cpu-freq/core.txt b/Documentation/cpu-freq/core.txt
--- a/Documentation/cpu-freq/core.txt	Tue Jun 15 22:20:43 2004
+++ b/Documentation/cpu-freq/core.txt	Tue Jun 15 22:20:43 2004
@@ -92,3 +92,7 @@
 cpu	- number of the affected CPU
 old	- old frequency
 new	- new frequency
+
+If the cpufreq core detects the frequency has changed while the system
+was suspended, these notifiers are called with CPUFREQ_RESUMECHANGE as
+second argument.
diff -Nru a/Documentation/fb/framebuffer.txt b/Documentation/fb/framebuffer.txt
--- a/Documentation/fb/framebuffer.txt	Tue Jun 15 22:20:41 2004
+++ b/Documentation/fb/framebuffer.txt	Tue Jun 15 22:20:41 2004
@@ -190,7 +190,7 @@
     1/(32.141E-6 s) = 31.113E3 Hz
 
 A full screen counts 480 (yres) lines, but we have to consider the vertical
-retrace too (e.g. 49 `pixels'). So a full screen will take
+retrace too (e.g. 49 `lines'). So a full screen will take
 
     (480+49)*32.141E-6 s = 17.002E-3 s
 
diff -Nru a/Documentation/fb/pxafb.txt b/Documentation/fb/pxafb.txt
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/Documentation/fb/pxafb.txt	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,54 @@
+Driver for PXA25x LCD controller
+================================
+
+The driver supports the following options, either via
+options=<OPTIONS> when modular or video=pxafb:<OPTIONS> when built in.
+
+For example:
+	modprobe pxafb options=mode:640x480-8,passive
+or on the kernel command line
+	video=pxafb:mode:640x480-8,passive
+
+mode:XRESxYRES[-BPP]
+	XRES == LCCR1_PPL + 1
+	YRES == LLCR2_LPP + 1
+		The resolution of the display in pixels
+	BPP == The bit depth. Valid values are 1, 2, 4, 8 and 16.
+
+pixclock:PIXCLOCK
+	Pixel clock in picoseconds
+
+left:LEFT == LCCR1_BLW + 1
+right:RIGHT == LCCR1_ELW + 1
+hsynclen:HSYNC == LCCR1_HSW + 1
+upper:UPPER == LCCR2_BFW
+lower:LOWER == LCCR2_EFR
+vsynclen:VSYNC == LCCR2_VSW + 1
+	Display margins and sync times
+
+color | mono => LCCR0_CMS
+	umm...
+
+active | passive => LCCR0_PAS
+	Active (TFT) or Passive (STN) display
+
+single | dual => LCCR0_SDS
+	Single or dual panel passive display
+
+4pix | 8pix => LCCR0_DPD
+	4 or 8 pixel monochrome single panel data
+
+hsync:HSYNC
+vsync:VSYNC
+	Horizontal and vertical sync. 0 => active low, 1 => active
+	high.
+
+dpc:DPC
+	Double pixel clock. 1=>true, 0=>false
+
+outputen:POLARITY
+	Output Enable Polarity. 0 => active low, 1 => active high
+
+pixclockpol:POLARITY
+	pixel clock polarity
+	0 => falling edge, 1 => rising edge
diff -Nru a/Documentation/fb/vesafb.txt b/Documentation/fb/vesafb.txt
--- a/Documentation/fb/vesafb.txt	Tue Jun 15 22:20:43 2004
+++ b/Documentation/fb/vesafb.txt	Tue Jun 15 22:20:43 2004
@@ -146,6 +146,10 @@
 
 mtrr	setup memory type range registers for the vesafb framebuffer.
 
+vram:n	remap 'n' MiB of video RAM. If 0 or not specified, remap memory
+	according to video mode. (2.5.66 patch/idea by Antonino Daplas
+	reversed to give override possibility (allocate more fb memory
+	than the kernel would) to 2.4 by tmb@iki.fi)
 
 Have fun!
 
diff -Nru a/Documentation/filesystems/Exporting b/Documentation/filesystems/Exporting
--- a/Documentation/filesystems/Exporting	Tue Jun 15 22:20:39 2004
+++ b/Documentation/filesystems/Exporting	Tue Jun 15 22:20:39 2004
@@ -32,7 +32,7 @@
 all of the ancestors of that filesystem object are also in the dcache.
 As normal access is by filename this prefix is created naturally and
 maintained easily (by each object maintaining a reference count on
-it's parent).
+its parent).
 
 However when objects are included into the dcache by interpreting a
 filehandle fragment, there is no automatic creation of a path prefix
@@ -44,15 +44,15 @@
 2/ The dcache must be prepared for a newly found (via ->lookup) directory
    to already have a (non-connected) dentry, and must be able to move
    that dentry into place (based on the parent and name in the
-   ->lookup).   This is particuarly needed for directories as
+   ->lookup).   This is particularly needed for directories as
    it is a dcache invariant that directories only have one dentry.
 
 To implement these features, the dcache has:
 
-a/ A dentry flag  DCACHE_DISCONNECTED which is set on
-   and dentry that might not be part of the proper prefix.
+a/ A dentry flag DCACHE_DISCONNECTED which is set on
+   any dentry that might not be part of the proper prefix.
    This is set when anonymous dentries are created, and cleared when a
-   dentry is noticed to be a child on a dentry which is in the proper
+   dentry is noticed to be a child of a dentry which is in the proper
    prefix. 
 
 b/ A per-superblock list "s_anon" of dentries which are the roots of
@@ -123,9 +123,9 @@
   get_name.  When given a parent dentry and a child dentry, this
     should find a name in the directory identified by the parent
     dentry, which leads to the object identified by the child dentry.
-    If no get_name function is supplied, a default implementation
-    which used vfs_readdir to find potential names, and matches inode
-    numbers to find the correct match.
+    If no get_name function is supplied, a default implementation is
+    provided which uses vfs_readdir to find potential names, and
+    matches inode numbers to find the correct match.
 
   get_parent.  When given a dentry for a directory, this should return 
     a dentry for the parent.  Quite possibly the parent dentry will
@@ -135,7 +135,7 @@
     ->lookup("..") is *not* used as a default as it can leave ".."
     entries in the dcache which are too messy to work with.
 
-  get_dentry.  When given a opaque datum, this should find the
+  get_dentry.  When given an opaque datum, this should find the
     implied object and create a dentry for it (possibly with
     d_alloc_anon). 
     The opaque datum is whatever is passed down by the decode_fh
@@ -143,7 +143,7 @@
     fragment.
     decode_fh passes two datums through find_exported_dentry.  One that 
     should be used to identify the target object, and one that can be
-    used to identify the objects parent, should that be necessary.
+    used to identify the object's parent, should that be necessary.
     The default get_dentry function assumes that the datum contains an
     inode number and a generation number, and it attempts to get the
     inode using "iget" and check it's validity by matching the
@@ -164,8 +164,8 @@
 passed them to find_exported_dentry.
 
 
-A filehandle fragment consists of an array of 1 or more 4byte words.
-Together with a one byte "type".
+A filehandle fragment consists of an array of 1 or more 4byte words,
+together with a one byte "type".
 The decode_fh routine should not depend on the stated size that is
 passed to it.  This size may be larger than the original filehandle
 generated by encode_fh, in which case it will have been padded with
diff -Nru a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
--- a/Documentation/filesystems/Locking	Tue Jun 15 22:20:58 2004
+++ b/Documentation/filesystems/Locking	Tue Jun 15 22:20:58 2004
@@ -203,20 +203,34 @@
 
 If the filesystem is not called for "sync" and it determines that it
 would need to block against in-progress I/O to be able to start new I/O
-against the page the filesystem shoud redirty the page (usually with
-__set_page_dirty_nobuffers()), then unlock the page and return zero. 
+against the page the filesystem should redirty the page with
+redirty_page_for_writepage(), then unlock the page and return zero.
 This may also be done to avoid internal deadlocks, but rarely.
 
 If the filesytem is called for sync then it must wait on any
 in-progress I/O and then start new I/O.
 
 The filesystem should unlock the page synchronously, before returning
-to the caller.  If the page has write I/O underway against it,
-writepage() should run SetPageWriteback() against the page prior to
-unlocking it.  The write I/O completion handler should run
-end_page_writeback() against the page.
+to the caller.
 
-That is: after 2.5.12, pages which are under writeout are *not* locked.
+Unless the filesystem is going to redirty_page_for_writepage(), unlock the page
+and return zero, writepage *must* run set_page_writeback() against the page,
+followed by unlocking it.  Once set_page_writeback() has been run against the
+page, write I/O can be submitted and the write I/O completion handler must run
+end_page_writeback() once the I/O is complete.  If no I/O is submitted, the
+filesystem must run end_page_writeback() against the page before returning from
+writepage.
+
+That is: after 2.5.12, pages which are under writeout are *not* locked.  Note,
+if the filesystem needs the page to be locked during writeout, that is ok, too,
+the page is allowed to be unlocked at any point in time between the calls to
+set_page_writeback() and end_page_writeback().
+
+Note, failure to run either redirty_page_for_writepage() or the combination of
+set_page_writeback()/end_page_writeback() on a page submitted to writepage
+will leave the page itself marked clean but it will be tagged as dirty in the
+radix tree.  This incoherency can lead to all sorts of hard-to-debug problems
+in the filesystem like having dirty inodes at umount and losing written data.
 
 	->sync_page() locking rules are not well-defined - usually it is called
 with lock on page, but that is not guaranteed. Considering the currently
diff -Nru a/Documentation/filesystems/befs.txt b/Documentation/filesystems/befs.txt
--- a/Documentation/filesystems/befs.txt	Tue Jun 15 22:20:39 2004
+++ b/Documentation/filesystems/befs.txt	Tue Jun 15 22:20:39 2004
@@ -17,8 +17,8 @@
 
 AUTHOR
 =====
-Current maintainer: Will Dyson <will_dyson@pobox.com>
-Has been working on the code since Aug 13, 2001. See the changelog for
+The largest part of the code written by Will Dyson <will_dyson@pobox.com>
+He has been working on the code since Aug 13, 2001. See the changelog for
 details.
 
 Original Author: Makoto Kato <m_kato@ga2.so-net.ne.jp>
@@ -26,6 +26,8 @@
 <http://hp.vector.co.jp/authors/VA008030/bfs/>
 Does anyone know of a more current email address for Makoto? He doesn't
 respond to the address given above...
+
+Current maintainer: Sergey S. Kostyliov <rathamahata@php4.ru>
 
 WHAT IS THIS DRIVER?
 ==================
diff -Nru a/Documentation/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt
--- a/Documentation/filesystems/ntfs.txt	Tue Jun 15 22:20:40 2004
+++ b/Documentation/filesystems/ntfs.txt	Tue Jun 15 22:20:40 2004
@@ -273,6 +273,31 @@
 
 Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
 
+2.1.14:
+	- Fix an NFSd caused deadlock reported by several users.
+2.1.13:
+	- Implement writing of inodes (access time updates are not implemented
+	  yet so mounting with -o noatime,nodiratime is enforced).
+	- Enable writing out of resident files so you can now overwrite any
+	  uncompressed, unencrypted, nonsparse file as long as you do not
+	  change the file size.
+	- Add housekeeping of ntfs system files so that ntfsfix no longer needs
+	  to be run after writing to an NTFS volume.
+	  NOTE:  This still leaves quota tracking and user space journalling on
+	  the side but they should not cause data corruption.  In the worst
+	  case the charged quotas will be out of date ($Quota) and some
+	  userspace applications might get confused due to the out of date
+	  userspace journal ($UsnJrnl).
+2.1.12:
+	- Fix the second fix to the decompression engine from the 2.1.9 release
+	  and some further internals cleanups.
+2.1.11:
+	- Driver internal cleanups.
+2.1.10:
+	- Force read-only (re)mounting of volumes with unsupported volume
+	  flags and various cleanups.
+2.1.9:
+	- Fix two bugs in handling of corner cases in the decompression engine.
 2.1.8:
 	- Read the $MFT mirror and compare it to the $MFT and if the two do not
 	  match, force a read-only mount and do not allow read-write remounts.
diff -Nru a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
--- a/Documentation/filesystems/proc.txt	Tue Jun 15 22:20:38 2004
+++ b/Documentation/filesystems/proc.txt	Tue Jun 15 22:20:38 2004
@@ -852,7 +852,8 @@
 The value  in  file-max  denotes  the  maximum number of file handles that the
 Linux kernel will allocate. When you get a lot of error messages about running
 out of  file handles, you might want to raise this limit. The default value is
-4096. To change it, just write the new number into the file:
+10% of  RAM in kilobytes.  To  change it, just  write the new number  into the
+file:
 
   # cat /proc/sys/fs/file-max 
   4096 
@@ -864,11 +865,14 @@
 This method  of  revision  is  useful  for  all customizable parameters of the
 kernel - simply echo the new value to the corresponding file.
 
-The three  values  in file-nr denote the number of allocated file handles, the
-number of  used file handles, and the maximum number of file handles. When the
-allocated file  handles  come close to the maximum, but the number of actually
-used ones  is  far  behind,  you've  encountered  a peak in your usage of file
-handles and you don't need to increase the maximum.
+Historically, the three values in file-nr denoted the number of allocated file
+handles,  the number of  allocated but  unused file  handles, and  the maximum
+number of file handles. Linux 2.6 always  reports 0 as the number of free file
+handles -- this  is not an error,  it just means that the  number of allocated
+file handles exactly matches the number of used file handles.
+
+Attempts to  allocate more  file descriptors than  file-max are  reported with
+printk, look for "VFS: file-max limit <number> reached".
 
 inode-state and inode-nr
 ------------------------
@@ -1208,6 +1212,14 @@
 and thrash the system to death, so large and/or important servers will want to
 set this value to 0.
 
+nr_hugepages and hugetlb_shm_group
+----------------------------------
+
+nr_hugepages configures number of hugetlb page reserved for the system.
+
+hugetlb_shm_group contains group id that is allowed to create SysV shared
+memory segment using hugetlb page.
+
 2.5 /proc/sys/dev - Device specific parameters
 ----------------------------------------------
 
@@ -1848,10 +1860,3 @@
 command to write value into these files, thereby changing the default settings
 of the kernel.
 ------------------------------------------------------------------------------
-
-
-
-
-
-
-
diff -Nru a/Documentation/i2c/i2c-old-porting b/Documentation/i2c/i2c-old-porting
--- a/Documentation/i2c/i2c-old-porting	Tue Jun 15 22:20:58 2004
+++ b/Documentation/i2c/i2c-old-porting	Tue Jun 15 22:20:58 2004
@@ -386,7 +386,6 @@
 +	if(client == NULL) 
  		return -ENOMEM;
 -
--	MOD_INC_USE_COUNT;
 +	client_template.adapter = adap;
 +	client_template.addr = addr;
 +	memcpy(client, &client_template, sizeof(*client));
@@ -432,7 +431,6 @@
  
 +	init_MUTEX(&decoder->lock);
 +	i2c_attach_client(client);
-+	MOD_INC_USE_COUNT;
  	/* setup and implicit mode 0 select has been performed */
  	return 0;
  }
@@ -463,7 +461,6 @@
 +	kfree(decoder);
 +	kfree(client);
  
- 	MOD_DEC_USE_COUNT;
  	return 0;
  }
  
@@ -593,12 +590,15 @@
 -	I2C_SAA7110, I2C_SAA7110+1,	/* Addr range */
 -
 -	saa7110_attach,
-+	IF_NAME,			/* name */
-+	I2C_DRIVERID_SAA7110,	/* in i2c.h */
-+	I2C_DF_NOTIFY,	/* Addr range */
-+	saa7110_probe,
- 	saa7110_detach,
- 	saa7110_command
+-	saa7110_detach,
+-	saa7110_command
++	.owner		= THIS_MODULE,
++	.name		= IF_NAME,
++	.id		= I2C_DRIVERID_SAA7110,
++	.flags		= I2C_DF_NOTIFY,
++	.attach_adapter	= saa7110_probe,
++	.detach_adapter	= saa7110_detach,
++	.command	= saa7110_command,
  };
 +static struct i2c_client client_template = {
 +	"saa7110_client",
diff -Nru a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
--- a/Documentation/i2c/porting-clients	Tue Jun 15 22:20:38 2004
+++ b/Documentation/i2c/porting-clients	Tue Jun 15 22:20:38 2004
@@ -62,9 +62,9 @@
   patch to the Documentation/i2c/sysfs-interface file.
 
 * [Attach] For I2C drivers, the attach function should make sure
-  that the adapter's class has I2C_ADAP_CLASS_SMBUS, using the
+  that the adapter's class has I2C_CLASS_HWMON, using the
   following construct:
-  if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+  if (!(adapter->class & I2C_CLASS_HWMON))
           return 0;
   ISA-only drivers of course don't need this.
 
diff -Nru a/Documentation/ide.txt b/Documentation/ide.txt
--- a/Documentation/ide.txt	Tue Jun 15 22:20:42 2004
+++ b/Documentation/ide.txt	Tue Jun 15 22:20:42 2004
@@ -248,6 +248,13 @@
  			  allowing ide-floppy, ide-tape, and ide-cdrom|writers
  			  to use ide-scsi emulation on a device specific option.
 
+ "hdx=stroke"		: Should you have a system w/ an AWARD Bios and your
+			  drives are larger than 32GB and it will not boot,
+			  one is required to perform a few OEM operations first.
+			  The option is called "stroke" because it allows one
+			  to "soft clip" the drive to work around a barrier
+			  limit.
+
  "idebus=xx"		: inform IDE driver of VESA/PCI bus speed in MHz,
 			  where "xx" is between 20 and 66 inclusive,
 			  used when tuning chipset PIO modes.
diff -Nru a/Documentation/initrd.txt b/Documentation/initrd.txt
--- a/Documentation/initrd.txt	Tue Jun 15 22:20:42 2004
+++ b/Documentation/initrd.txt	Tue Jun 15 22:20:42 2004
@@ -333,8 +333,8 @@
 ---------
 
 [1] Almesberger, Werner; "Booting Linux: The History and the Future"
-    ftp://icaftp.epfl.ch/pub/people/almesber/booting/bootinglinux-current.ps.gz
+    http://www.almesberger.net/cv/papers/ols2k-9.ps.gz
 [2] newlib package (experimental), with initrd example
-    ftp://icaftp.epfl.ch/pub/people/almesber/misc/newlib-linux/
+    http://sources.redhat.com/newlib/
 [3] Brouwer, Andries; "util-linux: Miscellaneous utilities for Linux"
     ftp://ftp.win.tue.nl/pub/linux-local/utils/util-linux/
diff -Nru a/Documentation/isdn/INTERFACE b/Documentation/isdn/INTERFACE
--- a/Documentation/isdn/INTERFACE	Tue Jun 15 22:20:43 2004
+++ b/Documentation/isdn/INTERFACE	Tue Jun 15 22:20:43 2004
@@ -412,30 +412,6 @@
     Returnvalue:
       current protocol-Id (one of the constants ISDN_L3_PROTO)
 
-  ISDN_CMD_LOCK:
-
-    With this command the HL-driver is told, that it will be used by the
-    LL and therefore may not be unloaded. The HL-driver should use
-    MOD_INC_USE_COUNT to tell that to the kernel.
-
-    Parameter:
-      driver      = driver-Id.
-      command     = ISDN_CMD_LOCK
-      arg         = unused.
-      parm        = unused.
-
-  ISDN_CMD_UNLOCK:
-
-    With this command the HL-driver is told, that it is no more used by the
-    LL and therefore may be unloaded. The HL-driver should use
-    DEC_INC_USE_COUNT to tell that to the kernel.
-
-    Parameter:
-      driver      = driver-Id.
-      command     = ISDN_CMD_UNLOCK
-      arg         = unused.
-      parm        = unused.
-
   ISDN_CMD_PROCEED: 
 
     With this command, the HL-driver is told to proceed with a incoming call.
diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
--- a/Documentation/kernel-parameters.txt	Tue Jun 15 22:21:05 2004
+++ b/Documentation/kernel-parameters.txt	Tue Jun 15 22:21:05 2004
@@ -896,8 +896,8 @@
 	psmouse.rate=	[HW,MOUSE] Set desired mouse report rate, in reports
 			per second.
 	psmouse.resetafter=
-			[HW,MOUSE] Try to reset Synaptics Touchpad after so many
-			bad packets (0 = never).
+			[HW,MOUSE] Try to reset the device after so many bad packets
+			(0 = never).
 	psmouse.resolution=
 			[HW,MOUSE] Set desired mouse resolution, in dpi.
 	psmouse.smartscroll=
diff -Nru a/Documentation/laptop-mode.txt b/Documentation/laptop-mode.txt
--- a/Documentation/laptop-mode.txt	Tue Jun 15 22:20:44 2004
+++ b/Documentation/laptop-mode.txt	Tue Jun 15 22:20:44 2004
@@ -69,12 +69,10 @@
 * If you have your filesystems listed as type "auto" in fstab, like I did, then
   the control script will not recognize them as filesystems that need remounting.
 
-* If you have XFS, make SURE that you set the XFS_HZ value in the control script
-  correctly, to the value of HZ of your running kernel. Laptop mode will not
-  work correctly if it is set too low, and you may lose data if it is set too
-  high. The reason for this problem is that XFS does not export its sysctl
-  variables in centisecs (like most other subsystems do) but in "jiffies",
-  which is an internal kernel measure. Once this is fixed things will get better.
+* It has been reported that some versions of the mutt mail client use file access
+  times to determine whether a folder contains new mail. If you use mutt and
+  experience this, you must disable the noatime remounting in the control script
+  by setting DO_REMOUNT_NOATIME=0.
 
 
 The details
@@ -281,7 +279,13 @@
 	fi
 }
 
-KLEVEL="$(uname -r | cut -c1-3)"
+KLEVEL=$(
+           uname -r |
+             (
+	       IFS="." read a b c
+	       echo $a.$b
+	     )
+	 )
 case "$KLEVEL" in
 	"2.4"|"2.6")
 		true
@@ -295,6 +299,9 @@
 # Shall we remount journaled fs. with appropiate commit interval? (1=yes)
 DO_REMOUNTS=1
 
+# And shall we add the "noatime" option to that as well? (1=yes)
+DO_REMOUNT_NOATIME=1
+
 # age time, in seconds. should be put into a sysconfig file
 MAX_AGE=600
 
@@ -319,11 +326,15 @@
 DEF_DIRTY_RATIO=40
 DEF_XFS_AGE_BUFFER=15
 DEF_XFS_SYNC_INTERVAL=30
+DEF_XFS_BUFD_INTERVAL=1
 
-# This must be adjusted manually to the value of HZ in the running kernel,
-# until the XFS people change their external interfaces to work in centisecs
-# like the rest of the external world. Unfortunately this cannot be automated. :(
-XFS_HZ=1000
+# This must be adjusted manually to the value of HZ in the running kernel
+# on 2.4, until the XFS people change their 2.4 external interfaces to work in
+# centisecs. This can be automated, but it's a work in progress that still needs
+# some fixes. On 2.6 kernels, XFS uses USER_HZ instead of HZ for external
+# interfaces, and that is currently always set to 100. So you don't need to
+# change this on 2.6.
+XFS_HZ=100
 
 if [ ! -e /proc/sys/vm/laptop_mode ]; then
 	echo "Kernel is not patched with laptop_mode patch."
@@ -335,6 +346,10 @@
 	exit 1
 fi
 
+if [ $DO_REMOUNT_NOATIME -eq 1 ]; then
+	NOATIME_OPT=",noatime"
+fi
+
 case "$1" in
 	start)
 		AGE=$((100*$MAX_AGE))
@@ -342,19 +357,29 @@
 		echo -n "Starting laptop_mode"
 
 		if [ -d /proc/sys/vm/pagebuf ] ; then
+			# (For 2.4 and early 2.6.)
 			# This only needs to be set, not reset -- it is only used when
 			# laptop mode is enabled.
 			echo $XFS_AGE > /proc/sys/vm/pagebuf/lm_flush_age
 			echo $XFS_AGE > /proc/sys/fs/xfs/lm_sync_interval
 		elif [ -f /proc/sys/fs/xfs/lm_age_buffer ] ; then
+			# (A couple of early 2.6 laptop mode patches had these.)
 			# The same goes for these.
 			echo $XFS_AGE > /proc/sys/fs/xfs/lm_age_buffer
 			echo $XFS_AGE > /proc/sys/fs/xfs/lm_sync_interval
 		elif [ -f /proc/sys/fs/xfs/age_buffer ] ; then
+			# (2.6.6)
 			# But not for these -- they are also used in normal
 			# operation.
 			echo $XFS_AGE > /proc/sys/fs/xfs/age_buffer
 			echo $XFS_AGE > /proc/sys/fs/xfs/sync_interval
+		elif [ -f /proc/sys/fs/xfs/age_buffer_centisecs ] ; then
+			# (2.6.7 upwards)
+			# And not for these either. These are in centisecs,
+			# not USER_HZ, so we have to use $AGE, not $XFS_AGE.
+			echo $AGE > /proc/sys/fs/xfs/age_buffer_centisecs
+			echo $AGE > /proc/sys/fs/xfs/xfssyncd_centisecs
+			echo 3000 > /proc/sys/fs/xfs/xfsbufd_centisecs
 		fi
 
 		case "$KLEVEL" in
@@ -376,10 +401,10 @@
 				case "$FST" in
 					"ext3"|"reiserfs")
 						PARSEDOPTS="$(parse_mount_opts commit "$OPTS")"
-						mount $DEV -t $FST $MP -o remount,$PARSEDOPTS,commit=$MAX_AGE,noatime
+						mount $DEV -t $FST $MP -o remount,$PARSEDOPTS,commit=$MAX_AGE$NOATIME_OPT
 						;;
 					"xfs")
-						mount $DEV -t $FST $MP -o remount,$OPTS,noatime
+						mount $DEV -t $FST $MP -o remount,$OPTS$NOATIME_OPT
 						;;
 				esac
 				if [ -b $DEV ] ; then
@@ -395,9 +420,14 @@
 		echo -n "Stopping laptop_mode"
 		echo "0" > /proc/sys/vm/laptop_mode
 		if [ -f /proc/sys/fs/xfs/age_buffer ] && [ ! -f /proc/sys/fs/xfs/lm_age_buffer ] ; then
-			# These need to be restored though, if there are no lm_*.
+			# These need to be restored, if there are no lm_*.
 			echo "$(($XFS_HZ*$DEF_XFS_AGE_BUFFER))" 	> /proc/sys/fs/xfs/age_buffer
 			echo "$(($XFS_HZ*$DEF_XFS_SYNC_INTERVAL))" 	> /proc/sys/fs/xfs/sync_interval
+		elif [ -f /proc/sys/fs/xfs/age_buffer_centisecs ] ; then
+			# These need to be restored as well.
+			echo "$((100*$DEF_XFS_AGE_BUFFER))" > /proc/sys/fs/xfs/age_buffer_centisecs
+			echo "$((100*$DEF_XFS_SYNC_INTERVAL))" > /proc/sys/fs/xfs/xfssyncd_centisecs
+			echo "$((100*$DEF_XFS_BUFD_INTERVAL))" > /proc/sys/fs/xfs/xfsbufd_centisecs
 		fi
 		case "$KLEVEL" in
 			"2.4")
@@ -472,16 +502,16 @@
 
 case $status in
         "on-line")
-                echo "Setting HD spindown to 2 hours"
-                /sbin/laptop-mode stop
+                echo "Setting HD spindown for AC mode."
+                /sbin/laptop_mode stop
                 /sbin/hdparm -S $ACAD_HD /dev/hda > /dev/null 2>&1
                 /sbin/hdparm -B 255 /dev/hda > /dev/null 2>&1
                 #echo -n $ACAD_CPU:$ACAD_THR > /proc/acpi/processor/CPU0/limit
                 exit 0
         ;;
         "off-line")
-                echo "Setting HD spindown to 20 seconds"
-                /sbin/laptop-mode start
+                echo "Setting HD spindown for battery mode."
+                /sbin/laptop_mode start
                 /sbin/hdparm -S $BATT_HD /dev/hda > /dev/null 2>&1
                 /sbin/hdparm -B 1 /dev/hda > /dev/null 2>&1
                 #echo -n $BATT_CPU:$BATT_THR > /proc/acpi/processor/CPU0/limit
diff -Nru a/Documentation/md.txt b/Documentation/md.txt
--- a/Documentation/md.txt	Tue Jun 15 22:20:42 2004
+++ b/Documentation/md.txt	Tue Jun 15 22:20:42 2004
@@ -2,6 +2,8 @@
    http://www.<country>.kernel.org/pub/linux/utils/raid/....
 
 
+Boot time assembly of RAID arrays
+---------------------------------
 
 You can boot with your md device with the following kernel command
 lines:
@@ -11,6 +13,8 @@
 
 for raid arrays with persistent superblocks
   md=<md device no.>,dev0,dev1,...,devn
+or, to assemble a partitionable array:
+  md=d<md device no.>,dev0,dev1,...,devn
   
 md device no. = the number of the md device ... 
               0 means md0, 
@@ -34,7 +38,22 @@
 
 e:\loadlin\loadlin e:\zimage root=/dev/md0 md=0,0,4,0,/dev/hdb2,/dev/hdc3 ro
 
--------------------------------
+
+Boot time autodetection of RAID arrays
+--------------------------------------
+
+When md is compiled into the kernel (not as module), partitions of
+type 0xfd are scanned and automatically assembled into RAID arrays.
+This autodetection may be suppressed with the kernel parameter
+"raid=noautodetect".
+
+The kernel parameter "raid=partitionable" (or "raid=part") means
+that all auto-detected arrays are assembled as partitionable.
+
+
+Superblock formats
+------------------
+
 The md driver can support a variety of different superblock formats.
 (It doesn't yet, but it can)
 
@@ -82,7 +101,7 @@
 
 
 Specific Rules that apply to format-0 super block arrays, and
-       arrays with no superblock (non-presistant).
+       arrays with no superblock (non-persistant).
 -------------------------------------------------------------
 
 An array can be 'created' by describing the array (level, chunksize
diff -Nru a/Documentation/networking/bridge.txt b/Documentation/networking/bridge.txt
--- a/Documentation/networking/bridge.txt	Tue Jun 15 22:20:42 2004
+++ b/Documentation/networking/bridge.txt	Tue Jun 15 22:20:42 2004
@@ -1,11 +1,8 @@
-In order to use the ethernet bridging functionality you'll need the
-userspace tools available at http://www.math.leidenuniv.nl/~buytenh/bridge.
-The tarball available there contains extensive documentation, but if you
-still have questions, don't hesitate to post to the mailing list (more info
-at http://www.math.leidenuniv.nl/mailman/listinfo/bridge). You can also
-mail me at buytenh@gnu.org.
+In order to use the Ethernet bridging functionality, you'll need the
+userspace tools. These programs and documentation are available
+at http://bridge.sourceforge.net.  The download page is
+http://prdownloads.sourceforge.net/bridge.
 
+If you still have questions, don't hesitate to post to the mailing list 
+(more info http://lists.osdl.org/mailman/listinfo/bridge).
 
-
-Lennert Buytenhek
-<buytenh@gnu.org>
diff -Nru a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
--- a/Documentation/networking/ip-sysctl.txt	Tue Jun 15 22:20:39 2004
+++ b/Documentation/networking/ip-sysctl.txt	Tue Jun 15 22:20:39 2004
@@ -340,6 +340,11 @@
 	more rapidly.
 	Default: 1
 
+tcp_default_win_scale - INTEGER
+	Sets the minimum window scale TCP will negotiate for on all
+	conections.
+	Default: 7
+
 ip_local_port_range - 2 INTEGERS
 	Defines the local port range that is used by TCP and UDP to
 	choose the local port. The first number is the first, the 
diff -Nru a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt
--- a/Documentation/networking/packet_mmap.txt	Tue Jun 15 22:20:36 2004
+++ b/Documentation/networking/packet_mmap.txt	Tue Jun 15 22:20:36 2004
@@ -1,11 +1,3 @@
-
-DaveM:
-
-If you agree with it I will send two small patches to modify
-kernel's configure help. 
-
-	Ulisses
-
 --------------------------------------------------------------------------------
 + ABSTRACT
 --------------------------------------------------------------------------------
@@ -405,8 +397,3 @@
    
    Jesse Brandeburg, for fixing my grammathical/spelling errors
 
->>> EOF
--
-To unsubscribe from this list: send the line "unsubscribe linux-net" in
-the body of a message to majordomo@vger.kernel.org
-More majordomo info at  http://vger.kernel.org/majordomo-info.html
\ No newline at end of file
diff -Nru a/Documentation/numastat.txt b/Documentation/numastat.txt
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/Documentation/numastat.txt	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,22 @@
+
+Numa policy hit/miss statistics
+
+/sys/devices/system/node/node*/numastat
+
+All units are pages. Hugepages have separate counters.
+
+numa_hit			A process wanted to allocate memory from this node,
+					and succeeded.
+numa_miss			A process wanted to allocate memory from this node,
+					but ended up with memory from another.
+numa_foreign		A process wanted to allocate on another node,
+				    but ended up with memory from this one.
+local_node			A process ran on this node and got memory from it.
+other_node			A process ran on this node and got memory from another node.
+interleave_hit 		Interleaving wanted to allocate from this node
+					and succeeded.
+
+For easier reading you can use the numastat utility from the numactl package
+(ftp://ftp.suse.com/pub/people/ak/numa/numactl*). Note that it only works
+well right now on machines with a small number of CPUs.
+
diff -Nru a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt
--- a/Documentation/power/swsusp.txt	Tue Jun 15 22:20:35 2004
+++ b/Documentation/power/swsusp.txt	Tue Jun 15 22:20:35 2004
@@ -123,10 +123,79 @@
 replace ethernet card, resume. If you are fast your users will not
 even see broken connections.
 
-Any other idea you might have tell me!
 
-Contacting the author
-If you have any question or any patch that solves the above or detected
-problems please contact me at seasons@falcon.sch.bme.hu. I might delay
-answering, sorry about that.
+Q: Maybe I'm missing something, but why don't the regular I/O paths work?
 
+A: We do use the regular I/O paths. However we cannot restore the data
+to its original location as we load it. That would create an
+inconsistent kernel state which would certainly result in an oops.
+Instead, we load the image into unused memory and then atomically copy
+it back to it original location. This implies, of course, a maximum
+image size of half the amount of memory.
+
+There are two solutions to this:
+
+* require half of memory to be free during suspend. That way you can
+read "new" data onto free spots, then cli and copy
+
+* assume we had special "polling" ide driver that only uses memory
+between 0-640KB. That way, I'd have to make sure that 0-640KB is free
+during suspending, but otherwise it would work...
+
+suspend2 shares this fundamental limitation, but does not include user
+data and disk caches into "used memory" by saving them in
+advance. That means that the limitation goes away in practice.
+
+Q: Does linux support ACPI S4?
+
+A: No.
+
+When swsusp was created, ACPI was not too widespread, so we tried to
+avoid using ACPI-specific stuff. ACPI also is/was notoriously
+buggy. These days swsusp works on APM-only i386 machines and even
+without any power managment at all. Some versions also work on PPC.
+
+That means that machine does not enter S4 on suspend-to-disk, but
+simply enters S5. That has few advantages, you can for example boot
+windows on next boot, and return to your Linux session later. You
+could even have few different Linuxes on your box (not sharing any
+partitions), and switch between them.
+
+It also has disadvantages. On HP nx5000, if you unplug power cord
+while machine is suspended-to-disk, Linux will fail to notice that.
+
+Q: My machine doesn't work with ACPI. How can I use swsusp than ?
+
+A: Do a reboot() syscall with right parameters. Warning: glibc gets in
+its way, so check with strace:
+
+reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, 0xd000fce2)
+
+(Thanks to Peter Osterlund:)
+
+#include <unistd.h>
+#include <syscall.h>
+
+#define LINUX_REBOOT_MAGIC1     0xfee1dead
+#define LINUX_REBOOT_MAGIC2     672274793
+#define LINUX_REBOOT_CMD_SW_SUSPEND     0xD000FCE2
+
+int main()
+{
+    syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
+            LINUX_REBOOT_CMD_SW_SUSPEND, 0);
+    return 0;
+}
+
+Q: What is 'suspend2'?
+
+A: suspend2 is 'Software Suspend 2', a forked implementation of
+suspend-to-disk which is available as separate patches for 2.4 and 2.6
+kernels from swsusp.sourceforge.net. It includes support for SMP, 4GB
+highmem and preemption. It also has a extensible architecture that
+allows for arbitrary transformations on the image (compression,
+encryption) and arbitrary backends for writing the image (eg to swap
+or an NFS share[Work In Progress]). Questions regarding suspend2
+should be sent to the mailing list available through the suspend2
+website, and not to the Linux Kernel Mailing List. We are working
+toward merging suspend2 into the mainline kernel.
diff -Nru a/Documentation/power/tricks.txt b/Documentation/power/tricks.txt
--- a/Documentation/power/tricks.txt	Tue Jun 15 22:21:02 2004
+++ b/Documentation/power/tricks.txt	Tue Jun 15 22:21:02 2004
@@ -7,6 +7,8 @@
 * go with minimal config, turn off drivers like USB, AGP you don't
   really need
 
+* turn off APIC and preempt
+
 * use ext2. At least it has working fsck. [If something seemes to go
   wrong, force fsck when you have a chance]
 
diff -Nru a/Documentation/power/video.txt b/Documentation/power/video.txt
--- a/Documentation/power/video.txt	Tue Jun 15 22:20:41 2004
+++ b/Documentation/power/video.txt	Tue Jun 15 22:20:41 2004
@@ -30,6 +30,10 @@
   patched X, and plain text console (no vesafb or radeonfb), see
   http://www.doesi.gmxhome.de/linux/tm800s3/s3.html. (Acer TM 800)
 
+* 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)
+
 Now, if you pass acpi_sleep=something, and it does not work with your
 bios, you'll get hard crash during resume. Be carefull.
 
diff -Nru a/Documentation/sched-domains.txt b/Documentation/sched-domains.txt
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/Documentation/sched-domains.txt	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,55 @@
+Each CPU has a "base" scheduling domain (struct sched_domain). These are
+accessed via cpu_sched_domain(i) and this_sched_domain() macros. The domain
+hierarchy is built from these base domains via the ->parent pointer. ->parent
+MUST be NULL terminated, and domain structures should be per-CPU as they
+are locklessly updated.
+
+Each scheduling domain spans a number of CPUs (stored in the ->span field).
+A domain's span MUST be a superset of it child's span, and a base domain
+for CPU i MUST span at least i. The top domain for each CPU will generally
+span all CPUs in the system although strictly it doesn't have to, but this
+could lead to a case where some CPUs will never be given tasks to run unless
+the CPUs allowed mask is explicitly set. A sched domain's span means "balance
+process load among these CPUs".
+
+Each scheduling domain must have one or more CPU groups (struct sched_group)
+which are organised as a circular one way linked list from the ->groups
+pointer. The union of cpumasks of these groups MUST be the same as the
+domain's span. The intersection of cpumasks from any two of these groups
+MUST be the empty set. The group pointed to by the ->groups pointer MUST
+contain the CPU to which the domain belongs. Groups may be shared among
+CPUs as they contain read only data after they have been set up.
+
+Balancing within a sched domain occurs between groups. That is, each group
+is treated as one entity. The load of a group is defined as the sum of the
+load of each of its member CPUs, and only when the load of a group becomes
+out of balance are tasks moved between groups.
+
+In kernel/sched.c, rebalance_tick is run periodically on each CPU. This
+function takes its CPU's base sched domain and checks to see if has reached
+its rebalance interval. If so, then it will run load_balance on that domain.
+rebalance_tick then checks the parent sched_domain (if it exists), and the
+parent of the parent and so forth.
+
+*** Implementing sched domains ***
+The "base" domain will "span" the first level of the hierarchy. In the case
+of SMT, you'll span all siblings of the physical CPU, with each group being
+a single virtual CPU.
+
+In SMP, the parent of the base domain will span all physical CPUs in the
+node. Each group being a single physical CPU. Then with NUMA, the parent
+of the SMP domain will span the entire machine, with each group having the
+cpumask of a node. Or, you could do multi-level NUMA or Opteron, for example,
+might have just one domain covering its one NUMA level.
+
+The implementor should read comments in include/linux/sched.h:
+struct sched_domain fields, SD_FLAG_*, SD_*_INIT to get an idea of
+the specifics and what to tune.
+
+Implementors should change the line
+#undef SCHED_DOMAIN_DEBUG
+to
+#define SCHED_DOMAIN_DEBUG
+in kernel/sched.c as this enables an error checking parse of the sched domains
+which should catch most possible errors (described above). It also prints out
+the domain structure in a visual format.
diff -Nru a/Documentation/scsi/00-INDEX b/Documentation/scsi/00-INDEX
--- a/Documentation/scsi/00-INDEX	Tue Jun 15 22:20:41 2004
+++ b/Documentation/scsi/00-INDEX	Tue Jun 15 22:20:41 2004
@@ -62,6 +62,8 @@
 	- info on API between SCSI layer and low level drivers
 st.txt
 	- info on scsi tape driver
+sym53c500_cs.txt
+	- info on PCMCIA driver for Symbios Logic 53c500 based adapters
 sym53c8xx_2.txt
 	- info on second generation driver for sym53c8xx based adapters
 tmscsim.txt
diff -Nru a/Documentation/scsi/sym53c500_cs.txt b/Documentation/scsi/sym53c500_cs.txt
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/Documentation/scsi/sym53c500_cs.txt	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,23 @@
+The sym53c500_cs driver originated as an add-on to David Hinds' pcmcia-cs
+package, and was written by Tom Corner (tcorner@via.at).  A rewrite was
+long overdue, and the current version addresses the following concerns:
+
+	(1) extensive kernel changes between 2.4 and 2.6.
+	(2) deprecated PCMCIA support outside the kernel.
+
+All the USE_BIOS code has been ripped out.  It was never used, and could
+not have worked anyway.  The USE_DMA code is likewise gone.  Many thanks
+to YOKOTA Hiroshi (nsp_cs driver) and David Hinds (qlogic_cs driver) for
+the code fragments I shamelessly adapted for this work.  Thanks also to
+Christoph Hellwig for his patient tutelage while I stumbled about.
+
+The Symbios Logic 53c500 chip was used in the "newer" (circa 1997) version
+of the New Media Bus Toaster PCMCIA SCSI controller.  Presumably there are
+other products using this chip, but I've never laid eyes (much less hands)
+on one.
+
+Through the years, there have been a number of downloads of the pcmcia-cs
+version of this driver, and I guess it worked for those users.  It worked
+for Tom Corner, and it works for me.  Your mileage will probably vary.
+
+--Bob Tracy (rct@frus.com)
diff -Nru a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
--- a/Documentation/sound/alsa/ALSA-Configuration.txt	Tue Jun 15 22:20:36 2004
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt	Tue Jun 15 22:20:36 2004
@@ -416,7 +416,8 @@
 	* Creative Card w/Digital out + Digital I/O 2	[0x0fc3/0x1f0f]
 	* Creative Card w/Digital CD in + Digital I/O 2	[0x0fcf/0x1f0f]
         * Creative Card 5.1/w Digital out + LiveDrive	[0x3fc3/0x1fff]
-        * Creative Card all ins and outs		[0x3fff/0x1fff]
+	* Creative Card 5.1 (c) 2003			[0x3fc3/0x7cff]
+        * Creative Card all ins and outs		[0x3fff/0x7fff]
     
   Module snd-ens1370
   ------------------
@@ -609,6 +610,10 @@
                         * Hoontech SoundTrack DSP 24 Media 7.1
                         * Digigram VX442
 
+    model       - Use the given board model, one of the following:
+		  delta1010, dio2496, delta66, delta44, audiophile, delta410,
+		  delta1010lt, vx442, ewx2496, ews88mt, ews88mt_new, ews88d,
+		  dmx6fire, dsp24, dsp24_71, ez8
     omni	- Omni I/O support for MidiMan M-Audio Delta44/66
     cs8427_timeout - reset timeout for the CS8427 chip (S/PDIF transciever)
                      in msec resolution, default value is 500 (0.5 sec)
@@ -625,6 +630,9 @@
 			* AMP Ltd AUDIO2000
 			* TerraTec Aureon Sky-5.1, Space-7.1
 
+    model       - Use the given board model, one of the following:
+		  revo71, amp2000, prodigy71, aureon51, aureon71
+
     Module supports up to 8 cards and autoprobe.
 
   Module snd-intel8x0
@@ -787,6 +795,8 @@
 
     Module supports autoprobe and multiple chips (max 8).
 
+    The power-management is supported.
+
     Note: on some notebooks the buffer address cannot be detected
     automatically, or causes hang-up during initialization.
     In such a case, specify the buffer top address explicity via
@@ -796,9 +806,24 @@
       Sony F270: buffer_top=0x272800
     The driver supports only ac97 codec.  It's possible to force
     to initialize/use ac97 although it's not detected.  In such a
-    case, use force_ac97=1 option.
+    case, use force_ac97=1 option - but *NO* guarantee whether it
+    works!
 
-    The power-management is supported.
+    Note: The NM256 chip can be linked internally with non-AC97
+    codecs.  This driver supports only the AC97 codec, and won't work
+    with machines with other (most likely CS423x or OPL3SAx) chips,
+    even though the device is detected in lspci.  In such a case, try
+    other drivers, e.g. snd-cs4232 or snd-opl3sa2.  Some has ISA-PnP
+    but some doesn't have ISA PnP.  You'll need to speicfy isapnp=0
+    and proper hardware parameters in the case without ISA PnP.
+
+    Note: This driver is really crappy.  It's a porting from the
+    OSS driver, which is a result of black-magic reverse engineering.
+    The detection of codec will fail if the driver is loaded *after*
+    X-server as described above.  You might be able to force to load
+    the module, but it may result in hang-up.   Hence, make sure that
+    you load this module *before* X if you encounter this kind of
+    problem.
 
   Module snd-opl3sa2
   ------------------
diff -Nru a/Documentation/sound/alsa/Audigy-mixer.txt b/Documentation/sound/alsa/Audigy-mixer.txt
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/Documentation/sound/alsa/Audigy-mixer.txt	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,345 @@
+
+		Sound Blaster Audigy mixer / default DSP code
+		===========================================
+
+This is based on SB-Live-mixer.txt.
+
+The EMU10K2 chips have a DSP part which can be programmed to support 
+various ways of sample processing, which is described here.
+(This acticle does not deal with the overall functionality of the 
+EMU10K2 chips. See the manuals section for further details.)
+
+The ALSA driver programs this portion of chip by default code
+(can be altered later) which offers the following functionality:
+
+
+1) Digital mixer controls
+-------------------------
+
+These controls are built using the DSP instructions. They offer extended
+functionality. Only the default build-in code in the ALSA driver is described
+here. Note that the controls work as attenuators: the maximum value is the 
+neutral position leaving the signal unchanged. Note that if the  same destination 
+is mentioned in multiple controls, the signal is accumulated and can be wrapped 
+(set to maximal or minimal value without checking of overflow).
+
+
+Explanation of used abbreviations:
+
+DAC    - digital to analog converter
+ADC    - analog to digital converter
+I2S    - one-way three wire serial bus for digital sound by Philips Semiconductors
+         (this standard is used for connecting standalone DAC and ADC converters)
+LFE    - low frequency effects (subwoofer signal)
+AC97   - a chip containing an analog mixer, DAC and ADC converters
+IEC958 - S/PDIF
+FX-bus - the EMU10K2 chip has an effect bus containing 64 accumulators.
+         Each of the synthesizer voices can feed its output to these accumulators
+         and the DSP microcontroller can operate with the resulting sum.
+
+name='PCM Front Playback Volume',index=0
+
+This control is used to attenuate samples for left and right front PCM FX-bus
+accumulators. ALSA uses accumulators 8 and 9 for left and right front PCM 
+samples for 5.1 playback. The result samples are forwarded to the front DAC PCM 
+slots of the Philips DAC.
+
+name='PCM Surround Playback Volume',index=0
+
+This control is used to attenuate samples for left and right surround PCM FX-bus
+accumulators. ALSA uses accumulators 2 and 3 for left and right surround PCM 
+samples for 5.1 playback. The result samples are forwarded to the surround DAC PCM 
+slots of the Philips DAC.
+
+name='PCM Center Playback Volume',index=0
+
+This control is used to attenuate samples for center PCM FX-bus accumulator.
+ALSA uses accumulator 6 for center PCM sample for 5.1 playback. The result sample
+is forwarded to the center DAC PCM slot of the Philips DAC.
+
+name='PCM LFE Playback Volume',index=0
+
+This control is used to attenuate sample for LFE PCM FX-bus accumulator. 
+ALSA uses accumulator 7 for LFE PCM sample for 5.1 playback. The result sample 
+is forwarded to the LFE DAC PCM slot of the Philips DAC.
+
+name='PCM Playback Volume',index=0
+
+This control is used to attenuate samples for left and right PCM FX-bus
+accumulators. ALSA uses accumulators 0 and 1 for left and right PCM samples for
+stereo playback. The result samples are forwarded to the front DAC PCM slots 
+of the Philips DAC.
+
+name='PCM Capture Volume',index=0
+
+This control is used to attenuate samples for left and right PCM FX-bus
+accumulator. ALSA uses accumulators 0 and 1 for left and right PCM.
+The result is forwarded to the ADC capture FIFO (thus to the standard capture
+PCM device).
+
+name='Music Playback Volume',index=0
+
+This control is used to attenuate samples for left and right MIDI FX-bus
+accumulators. ALSA uses accumulators 4 and 5 for left and right MIDI samples.
+The result samples are forwarded to the front DAC PCM slots of the AC97 codec.
+
+name='Music Capture Volume',index=0
+
+These controls are used to attenuate samples for left and right MIDI FX-bus
+accumulator. ALSA uses accumulators 4 and 5 for left and right PCM.
+The result is forwarded to the ADC capture FIFO (thus to the standard capture
+PCM device).
+
+name='Mic Playback Volume',index=0
+
+This control is used to attenuate samples for left and right Mic input.
+For Mic input is used AC97 codec. The result samples are forwarded to 
+the front DAC PCM slots of the Philips DAC. Samples are forwarded to Mic
+capture FIFO (device 1 - 16bit/8KHz mono) too without volume control.
+
+name='Mic Capture Volume',index=0
+
+This control is used to attenuate samples for left and right Mic input.
+The result is forwarded to the ADC capture FIFO (thus to the standard capture
+PCM device).
+
+name='Audigy CD Playback Volume',index=0
+
+This control is used to attenuate samples from left and right IEC958 TTL
+digital inputs (usually used by a CDROM drive). The result samples are
+forwarded to the front DAC PCM slots of the Philips DAC.
+
+name='Audigy CD Capture Volume',index=0
+
+This control is used to attenuate samples from left and right IEC958 TTL
+digital inputs (usually used by a CDROM drive). The result samples are
+forwarded to the ADC capture FIFO (thus to the standard capture PCM device).
+
+name='IEC958 Optical Playback Volume',index=0
+
+This control is used to attenuate samples from left and right IEC958 optical
+digital input. The result samples are forwarded to the front DAC PCM slots
+of the Philips DAC.
+
+name='IEC958 Optical Capture Volume',index=0
+
+This control is used to attenuate samples from left and right IEC958 optical
+digital inputs. The result samples are forwarded to the ADC capture FIFO
+(thus to the standard capture PCM device).
+
+name='Line2 Playback Volume',index=0
+
+This control is used to attenuate samples from left and right I2S ADC
+inputs (on the AudigyDrive). The result samples are forwarded to the front
+DAC PCM slots of the Philips DAC.
+
+name='Line2 Capture Volume',index=1
+
+This control is used to attenuate samples from left and right I2S ADC
+inputs (on the AudigyDrive). The result samples are forwarded to the ADC
+capture FIFO (thus to the standard capture PCM device).
+
+name='Analog Mix Playback Volume',index=0
+
+This control is used to attenuate samples from left and right I2S ADC
+inputs from Philips ADC. The result samples are forwarded to the front
+DAC PCM slots of the Philips DAC. This contains mix from analog sources
+like CD, Line In, Aux, ....
+
+name='Analog Mix Capture Volume',index=1
+
+This control is used to attenuate samples from left and right I2S ADC
+inputs Philips ADC. The result samples are forwarded to the ADC
+capture FIFO (thus to the standard capture PCM device).
+
+name='Aux2 Playback Volume',index=0
+
+This control is used to attenuate samples from left and right I2S ADC
+inputs (on the AudigyDrive). The result samples are forwarded to the front
+DAC PCM slots of the Philips DAC.
+
+name='Aux2 Capture Volume',index=1
+
+This control is used to attenuate samples from left and right I2S ADC
+inputs (on the AudigyDrive). The result samples are forwarded to the ADC
+capture FIFO (thus to the standard capture PCM device).
+
+name='Front Playback Volume',index=0
+
+All stereo signals are mixed together and mirrored to surround, center and LFE.
+This control is used to attenuate samples for left and right front speakers of
+this mix.
+
+name='Surround Playback Volume',index=0
+
+All stereo signals are mixed together and mirrored to surround, center and LFE.
+This control is used to attenuate samples for left and right surround speakers of
+this mix.
+
+name='Center Playback Volume',index=0
+
+All stereo signals are mixed together and mirrored to surround, center and LFE.
+This control is used to attenuate sample for center speaker of this mix.
+
+name='LFE Playback Volume',index=0
+
+All stereo signals are mixed together and mirrored to surround, center and LFE.
+This control is used to attenuate sample for LFE speaker of this mix.
+
+name='Tone Control - Switch',index=0
+
+This control turns the tone control on or off. The samples for front, rear
+and center / LFE outputs are affected.
+
+name='Tone Control - Bass',index=0
+
+This control sets the bass intensity. There is no neutral value!!
+When the tone control code is activated, the samples are always modified.
+The closest value to pure signal is 20.
+
+name='Tone Control - Treble',index=0
+
+This control sets the treble intensity. There is no neutral value!!
+When the tone control code is activated, the samples are always modified.
+The closest value to pure signal is 20.
+
+name='Master Playback Volume',index=0
+
+This control is used to attenuate samples for front, surround, center and 
+LFE outputs.
+
+name='IEC958 Optical Raw Playback Switch',index=0
+
+If this switch is on, then the samples for the IEC958 (S/PDIF) digital
+output are taken only from the raw FX8010 PCM, otherwise standard front
+PCM samples are taken.
+
+
+2) PCM stream related controls
+------------------------------
+
+name='EMU10K1 PCM Volume',index 0-31
+
+Channel volume attenuation in range 0-0xffff. The maximum value (no
+attenuation) is default. The channel mapping for three values is
+as follows:
+
+	0 - mono, default 0xffff (no attenuation)
+	1 - left, default 0xffff (no attenuation)
+	2 - right, default 0xffff (no attenuation)
+
+name='EMU10K1 PCM Send Routing',index 0-31
+
+This control specifies the destination - FX-bus accumulators. There 24
+values with this mapping:
+
+	 0 -  mono, A destination (FX-bus 0-63), default 0
+	 1 -  mono, B destination (FX-bus 0-63), default 1
+	 2 -  mono, C destination (FX-bus 0-63), default 2
+	 3 -  mono, D destination (FX-bus 0-63), default 3
+	 4 -  mono, E destination (FX-bus 0-63), default 0
+	 5 -  mono, F destination (FX-bus 0-63), default 0
+	 6 -  mono, G destination (FX-bus 0-63), default 0
+	 7 -  mono, H destination (FX-bus 0-63), default 0
+	 8 -  left, A destination (FX-bus 0-63), default 0
+	 9 -  left, B destination (FX-bus 0-63), default 1
+	10 -  left, C destination (FX-bus 0-63), default 2
+	11 -  left, D destination (FX-bus 0-63), default 3
+	12 -  left, E destination (FX-bus 0-63), default 0
+	13 -  left, F destination (FX-bus 0-63), default 0
+	14 -  left, G destination (FX-bus 0-63), default 0
+	15 -  left, H destination (FX-bus 0-63), default 0
+	16 - right, A destination (FX-bus 0-63), default 0
+	17 - right, B destination (FX-bus 0-63), default 1
+	18 - right, C destination (FX-bus 0-63), default 2
+	19 - right, D destination (FX-bus 0-63), default 3
+	20 - right, E destination (FX-bus 0-63), default 0
+	21 - right, F destination (FX-bus 0-63), default 0
+	22 - right, G destination (FX-bus 0-63), default 0
+	23 - right, H destination (FX-bus 0-63), default 0
+
+Don't forget that it's illegal to assign a channel to the same FX-bus accumulator 
+more than once (it means 0=0 && 1=0 is an invalid combination).
+ 
+name='EMU10K1 PCM Send Volume',index 0-31
+
+It specifies the attenuation (amount) for given destination in range 0-255.
+The channel mapping is following:
+
+	 0 -  mono, A destination attn, default 255 (no attenuation)
+	 1 -  mono, B destination attn, default 255 (no attenuation)
+	 2 -  mono, C destination attn, default 0 (mute)
+	 3 -  mono, D destination attn, default 0 (mute)
+	 4 -  mono, E destination attn, default 0 (mute)
+	 5 -  mono, F destination attn, default 0 (mute)
+	 6 -  mono, G destination attn, default 0 (mute)
+	 7 -  mono, H destination attn, default 0 (mute)
+	 8 -  left, A destination attn, default 255 (no attenuation)
+	 9 -  left, B destination attn, default 0 (mute)
+	10 -  left, C destination attn, default 0 (mute)
+	11 -  left, D destination attn, default 0 (mute)
+	12 -  left, E destination attn, default 0 (mute)
+	13 -  left, F destination attn, default 0 (mute)
+	14 -  left, G destination attn, default 0 (mute)
+	15 -  left, H destination attn, default 0 (mute)
+	16 - right, A destination attn, default 0 (mute)
+	17 - right, B destination attn, default 255 (no attenuation)
+	18 - right, C destination attn, default 0 (mute)
+	19 - right, D destination attn, default 0 (mute)
+	20 - right, E destination attn, default 0 (mute)
+	21 - right, F destination attn, default 0 (mute)
+	22 - right, G destination attn, default 0 (mute)
+	23 - right, H destination attn, default 0 (mute)
+
+
+
+4) MANUALS/PATENTS:
+-------------------
+
+ftp://opensource.creative.com/pub/doc
+-------------------------------------
+
+        Files:
+        LM4545.pdf      AC97 Codec
+
+        m2049.pdf       The EMU10K1 Digital Audio Processor
+
+        hog63.ps        FX8010 - A DSP Chip Architecture for Audio Effects
+
+
+WIPO Patents
+------------
+        Patent numbers:
+        WO 9901813 (A1) Audio Effects Processor with multiple asynchronous (Jan. 14, 1999)
+                        streams
+
+        WO 9901814 (A1) Processor with Instruction Set for Audio Effects (Jan. 14, 1999)
+
+        WO 9901953 (A1) Audio Effects Processor having Decoupled Instruction
+                        Execution and Audio Data Sequencing (Jan. 14, 1999)
+
+
+US Patents (http://www.uspto.gov/)
+----------------------------------
+
+        US 5925841      Digital Sampling Instrument employing cache memory (Jul. 20, 1999)
+
+        US 5928342      Audio Effects Processor integrated on a single chip (Jul. 27, 1999)
+                        with a multiport memory onto which multiple asynchronous
+                        digital sound samples can be concurrently loaded
+
+        US 5930158      Processor with Instruction Set for Audio Effects (Jul. 27, 1999)
+
+        US 6032235      Memory initialization circuit (Tram) (Feb. 29, 2000)
+
+        US 6138207      Interpolation looping of audio samples in cache connected to    (Oct. 24, 2000)
+                        system bus with prioritization and modification of bus transfers
+                        in accordance with loop ends and minimum block sizes
+
+        US 6151670      Method for conserving memory storage using a (Nov. 21, 2000)
+                        pool of  short term memory registers
+
+        US 6195715      Interrupt control for multiple programs communicating with      (Feb. 27, 2001)
+                        a common interrupt by associating programs to GP registers,
+                        defining interrupt register, polling GP registers, and invoking
+                        callback routine associated with defined interrupt register
diff -Nru a/Documentation/sound/alsa/CMIPCI.txt b/Documentation/sound/alsa/CMIPCI.txt
--- a/Documentation/sound/alsa/CMIPCI.txt	Tue Jun 15 22:20:36 2004
+++ b/Documentation/sound/alsa/CMIPCI.txt	Tue Jun 15 22:20:36 2004
@@ -180,8 +180,8 @@
 device automatically to the previous state.
 
 On the model 033, AC3 is implemented by the software conversion in
-the driver.  This prevents the mmap support.  If you need mmap
-support, pass the "soft_ac3=0" module option.  This doesn't matter
+the alsa-lib.  If you need to bypass the software conversion of IEC958
+subframes, pass the "soft_ac3=0" module option.  This doesn't matter
 on the newer models.
 
 
diff -Nru a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl	Tue Jun 15 22:20:38 2004
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl	Tue Jun 15 22:20:38 2004
@@ -511,7 +511,7 @@
           }
 
           // (7)
-          pci_set_drvdata(pci, chip);
+          pci_set_drvdata(pci, card);
           dev++;
           return 0;
   }
@@ -519,10 +519,7 @@
   // destructor -- see "Destructor" sub-section
   static void __devexit snd_mychip_remove(struct pci_dev *pci)
   {
-          mychip_t *chip = snd_magic_cast(mychip_t,
-                                     pci_get_drvdata(pci), return);
-          if (chip)
-                  snd_card_free(chip->card);
+          snd_card_free(pci_get_drvdata(pci));
           pci_set_drvdata(pci, NULL);
   }
 ]]>
@@ -691,21 +688,16 @@
           <informalexample>
             <programlisting>
 <![CDATA[
-        pci_set_drvdata(pci, chip);
+        pci_set_drvdata(pci, card);
         dev++;
         return 0;
 ]]>
             </programlisting>
           </informalexample>
 
-          In the above, the chip record is stored. This pointer is
+          In the above, the card record is stored. This pointer is
         referred in the remove callback and power-management
         callbacks, too. 
-	If the card doesn't support the suspend/resume, you can store
-        the card pointer instead of the chip pointer, so that
-        <function>snd_card_free</function> can be called directly
-        without cast in the remove callback.  But anyway, be sure
-        which pointer is used.
         </para>
       </section>
     </section>
@@ -726,21 +718,15 @@
 <![CDATA[
   static void __devexit snd_mychip_remove(struct pci_dev *pci)
   {
-          mychip_t *chip = snd_magic_cast(mychip_t,
-                                    pci_get_drvdata(pci), return);
-          if (chip)
-                  snd_card_free(chip->card);
+          snd_card_free(pci_get_drvdata(pci));
           pci_set_drvdata(pci, NULL);
   }
 ]]>
           </programlisting>
         </informalexample>
 
-        The above code assumes that the chip is allocated
-	with snd_magic stuff and
-      has the field to hold the card pointer (see <link
-      linkend="card-management"><citetitle>the next
-      section</citetitle></link>). 
+        The above code assumes that the card pointer is set to the PCI
+	driver data.
       </para>
     </section>
 
@@ -1355,16 +1341,7 @@
   // initialization of the module
   static int __init alsa_card_mychip_init(void)
   {
-          int err;
-
-          if ((err = pci_module_init(&driver)) < 0) {
-  #ifdef MODULE
-                  printk(KERN_ERR "My chip soundcard not found "
-                                  "or device busy\n");
-  #endif
-                  return err;
-          }
-          return 0;
+          return pci_module_init(&driver);
   }
 
   // clean up the module
@@ -1781,16 +1758,7 @@
 <![CDATA[
   static int __init alsa_card_mychip_init(void)
   {
-          int err;
-
-          if ((err = pci_module_init(&driver)) < 0) {
-  #ifdef MODULE
-                  printk(KERN_ERR "My chip soundcard not found"
-                                  " or device busy\n");
-  #endif
-                  return err;
-          }
-          return 0;
+          return pci_module_init(&driver);
   }
 
   static void __exit alsa_card_mychip_exit(void)
@@ -5254,47 +5222,23 @@
     </para>
 
     <para>
-      Basic jobs of suspend/resume are done in
-      <structfield>suspend</structfield> and
-      <structfield>resume</structfield> callbacks of
-      <structname>pci_driver</structname> struct. Unfortunately, the
-      API of these callbacks was changed at the middle time of Linux
-      2.4.x, if you want to keep the support for older kernels, you
-      have to write two different callbacks. The example below is the
-      skeleton callbacks which just call the real suspend and resume
-      functions. 
+      ALSA provides the common power-management layer. Each card driver
+      needs to have only low-level suspend and resume callbacks.
 
       <informalexample>
         <programlisting>
 <![CDATA[
-  #ifndef PCI_OLD_SUSPEND
-  static int snd_my_suspend(struct pci_dev *dev, u32 state)
+  #ifdef CONFIG_PM
+  static int snd_my_suspend(snd_card_t *card, unsigned int state)
   {
-          mychip_t *chip = snd_magic_cast(mychip_t,
-                             pci_get_drvdata(dev), return -ENXIO);
-          mychip_suspend(chip);
+          .... // do things for suspsend
           return 0;
   }
-  static int snd_my_resume(struct pci_dev *dev)
+  static int snd_my_resume(snd_card_t *card, unsigned int state)
   {
-          mychip_t *chip = snd_magic_cast(mychip_t,
-                             pci_get_drvdata(dev), return -ENXIO);
-          mychip_resume(chip);
+          .... // do things for suspsend
           return 0;
   }
-  #else
-  static void snd_my_suspend(struct pci_dev *dev)
-  {
-          mychip_t *chip = snd_magic_cast(mychip_t,
-                             pci_get_drvdata(dev), return);
-          mychip_suspend(chip);
-  }
-  static void snd_mychip_resume(struct pci_dev *dev)
-  {
-          mychip_t *chip = snd_magic_cast(mychip_t,
-                             pci_get_drvdata(dev), return);
-          mychip_resume(chip);
-  }
   #endif
 ]]>
         </programlisting>
@@ -5302,17 +5246,10 @@
     </para>
 
     <para>
-      For keeping the readability of 2.6 source code, it's recommended to
-      separate the above ifdef condition as the patch file in alsa-driver
-      directory.
-      See <filename>alsa-driver/pci/ali5451.c</filename> for example.
-   </para>
-
-    <para>
       The scheme of the real suspend job is as following.
 
       <orderedlist>
-        <listitem><para>Check whether the power-state is already D3hot. If yes, skip the job.</para></listitem>
+        <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem>
         <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem>
         <listitem><para>Save the register values if necessary.</para></listitem>
         <listitem><para>Stop the hardware if necessary.</para></listitem>
@@ -5326,12 +5263,11 @@
       <informalexample>
         <programlisting>
 <![CDATA[
-  static void mychip_suspend(mychip_t *chip)
+  static int mychip_suspend(snd_card_t *card, unsigned int state)
   {
-          snd_card_t *card = chip->card;
           // (1)
-          if (card->power_state == SNDRV_CTL_POWER_D3hot)
-                  return;
+          mychip_t *chip = snd_magic_cast(mychip_t, card->pm_private_data,
+                                          return -ENXIO);
           // (2)
           snd_pcm_suspend_all(chip->pcm);
           // (3)
@@ -5340,6 +5276,7 @@
           snd_mychip_stop_hardware(chip);
           // (5)
           snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+          return 0;
   }
 ]]>
         </programlisting>
@@ -5350,8 +5287,7 @@
     The scheme of the real resume job is as following.
 
     <orderedlist>
-    <listitem><para>Check whether the power-state is already D0.
-    If yes, skip the job.</para></listitem>
+    <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem>
     <listitem><para>Enable the pci device again by calling
     <function>pci_enable_device()</function>.</para></listitem>
     <listitem><para>Re-initialize the chip.</para></listitem>
@@ -5372,10 +5308,9 @@
 <![CDATA[
   static void mychip_resume(mychip_t *chip)
   {
-          snd_card_t *card = chip->card;
           // (1)
-          if (card->power_state == SNDRV_CTL_POWER_D0)
-                  return;
+          mychip_t *chip = snd_magic_cast(mychip_t, card->pm_private_data,
+                                          return -ENXIO);
           // (2)
           pci_enable_device(chip->pci);
           // (3)
@@ -5388,38 +5323,6 @@
           snd_mychip_restart_chip(chip);
           // (7)
           snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-  }
-]]>
-        </programlisting>
-      </informalexample>
-    </para>
-
-    <para>
-      In addition to the callbacks above, you should define a callback
-      for the changes via the ALSA control interface. It's defined
-      like below: 
-
-      <informalexample>
-        <programlisting>
-<![CDATA[
-  static int snd_mychip_set_power_state(snd_card_t *card,
-                                        unsigned int power_state)
-  {
-          mychip_t *chip = snd_magic_cast(mychip_t,
-                   card->power_state_private_data, return -ENXIO);
-          switch (power_state) {
-          case SNDRV_CTL_POWER_D0:
-          case SNDRV_CTL_POWER_D1:
-          case SNDRV_CTL_POWER_D2:
-                  mychip_resume(chip);
-                  break;
-          case SNDRV_CTL_POWER_D3hot:
-          case SNDRV_CTL_POWER_D3cold:
-                  mychip_suspend(chip);
-                  break;
-          default:
-                  return -EINVAL;
-          }
           return 0;
   }
 ]]>
@@ -5439,41 +5342,42 @@
   {
           ....
           snd_card_t *card;
+          mychip_t *chip;
           ....
-  #ifdef CONFIG_PM
-          card->set_power_state = snd_mychip_set_power_state;
-          card->power_state_private_data = chip;
-  #endif
+          snd_card_set_pm_callback(card, snd_my_suspend, snd_my_resume, chip);
           ....
   }
 ]]>
         </programlisting>
       </informalexample>
+
+    Here you don't have to put ifdef CONFIG_PM around, since it's already
+    checked in the header and expanded to empty if not needed.
     </para>
 
     <para>
       If you need a space for saving the registers, you'll need to
-    allocate the buffer for it here, too, since you cannot call
-    <function>kmalloc()</function> with
-    <constant>GFP_KERNEL</constant> flag or
-    <function>vmalloc()</function> in the suspend callback.
+    allocate the buffer for it here, too, since it would be fatal
+    if you cannot allocate a memory in the suspend phase.
     The allocated buffer should be released in the corresponding
     destructor.
     </para>
 
     <para>
       And next, set suspend/resume callbacks to the pci_driver,
+      This can be done by passing a macro SND_PCI_PM_CALLBACKS
+      in the pci_driver struct.  This macro is expanded to the correct
+      (global) callbacks if CONFIG_PM is set.
 
       <informalexample>
         <programlisting>
 <![CDATA[
   static struct pci_driver driver = {
           .name = "My Chip",
-          ....
-  #ifdef CONFIG_PM
-          .suspend = snd_mychip_suspend,
-          .resume = snd_mychip_resume,
-  #endif
+          .id_table = snd_my_ids,
+          .probe = snd_my_probe,
+          .remove = __devexit_p(snd_my_remove),
+          SND_PCI_PM_CALLBACKS
   };
 ]]>
         </programlisting>
@@ -5521,7 +5425,8 @@
 
     <para>
       The module parameters must be declared with the standard
-    <function>MODULE_PARM()</function> and
+    <function>module_param()()</function>,
+    <function>module_param_array()()</function> and
     <function>MODULE_PARM_DESC()</function> macros. The ALSA provides
     an additional macro, <function>MODULE_PARM_SYNTAX()</function>,
     for describing its syntax. The strings will be written to
@@ -5545,18 +5450,22 @@
 <![CDATA[
   #define CARD_NAME "My Chip"
 
-  MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+  static int boot_devs;
+  module_param_array(index, int, boot_devs, 0444);
   MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
   MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-  MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+  module_param_array(id, charp, boot_devs, 0444);
   MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
   MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-  MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+  module_param_array(enable, bool, boot_devs, 0444);
   MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
   MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 ]]>
         </programlisting>
       </informalexample>
+
+    Here boot_devs is passed but simply ignored since we don't care
+    the number of parsed parameters.
     </para>
 
     <para>
@@ -5577,39 +5486,6 @@
       </informalexample>
     </para>
 
-    <para>
-      For building the driver into kernel, you should define the
-      <function>setup()</function> function in addition, too. 
-      ALSA provides <function>get_id()</function> function to retrieve
-      a string argument from the kernel boot parameters.
-
-      <informalexample>
-        <programlisting>
-<![CDATA[
-  #ifndef MODULE
-
-  /* format is: snd-mychip=enable,index,id */
-
-  static int __init alsa_card_mychip_setup(char *str)
-  {
-          static unsigned __initdata nr_dev = 0;
-
-          if (nr_dev >= SNDRV_CARDS)
-                  return 0;
-          (void)(get_option(&str,&enable[nr_dev]) == 2 &&
-                 get_option(&str,&index[nr_dev]) == 2 &&
-                 get_id(&str,&id[nr_dev]) == 2);
-          nr_dev++;
-          return 1;
-  }
-
-  __setup("snd-mychip=", alsa_card_mychip_setup);
-
-  #endif /* ifndef MODULE */
-]]>
-        </programlisting>
-      </informalexample>
-    </para>
   </chapter>
 
 
@@ -5631,10 +5507,14 @@
 	Suppose that you'll create a new PCI driver for the card
 	<quote>xyz</quote>.  The card module name would be
 	snd-xyz.  The new driver is usually put into alsa-driver
-	tree.  Then the driver is evaluated, audited and tested
+	tree, <filename>alsa-driver/pci</filename> directory in
+	the case of PCI cards.
+	Then the driver is evaluated, audited and tested
 	by developers and users.  After a certain time, the driver
-	will go to alsa-kernel tree and eventually integrated into
-	Linux 2.6 tree.
+	will go to alsa-kernel tree (to the corresponding directory,
+	such as <filename>alsa-kernel/pci</filename>) and eventually
+	integrated into Linux 2.6 tree (the directory would be
+	<filename>linux/sound/pci</filename>).
 	</para>
 
 	<para>
@@ -5661,7 +5541,7 @@
         <programlisting>
 <![CDATA[
   snd-xyz-objs := xyz.o
-  extra-obj-$(CONFIG_SND_XYZ) += snd-xyz.o
+  obj-$(CONFIG_SND_XYZ) += snd-xyz.o
 ]]>
         </programlisting>
       </informalexample>
@@ -5678,8 +5558,8 @@
       <informalexample>
         <programlisting>
 <![CDATA[
-  config SND_BT87X
-          tristate "Foobar XYX"
+  config SND_XYZ
+          tristate "Foobar XYZ"
           depends on SND
           select SND_PCM
           help
@@ -5730,7 +5610,8 @@
 	<orderedlist>
 	<listitem>
 	<para>
-	Add a new directory (xyz) to extra-subdir-y list in alsa-driver/pci/Makefile
+	Add a new directory (<filename>xyz</filename>) in
+	<filename>alsa-driver/pci/Makefile</filename> like below
 
       <informalexample>
         <programlisting>
@@ -5744,7 +5625,7 @@
 
 	<listitem>
 	<para>
-	Under the directory xyz, create a Makefile
+	Under the directory <filename>xyz</filename>, create a Makefile
 
       <example>
 	<title>Sample Makefile for a driver xyz</title>
diff -Nru a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt
--- a/Documentation/sound/alsa/Procfile.txt	Tue Jun 15 22:20:40 2004
+++ b/Documentation/sound/alsa/Procfile.txt	Tue Jun 15 22:20:40 2004
@@ -131,6 +131,12 @@
 card*/codec97#0/ac97#?-?+regs
 	Shows the AC97 register dump.  Useful for debugging.
 
+	When CONFIG_SND_DEBUG is enabled, you can write to this file for
+	changing an AC97 register directly.  Pass two hex numbers.
+	For example,
+
+	# echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs
+
 
 Sequencer Information
 ---------------------
diff -Nru a/Documentation/sound/oss/OPL3-SA b/Documentation/sound/oss/OPL3-SA
--- a/Documentation/sound/oss/OPL3-SA	Tue Jun 15 22:20:40 2004
+++ b/Documentation/sound/oss/OPL3-SA	Tue Jun 15 22:20:40 2004
@@ -34,7 +34,7 @@
 	mpu_irq: This is the MPU401's IRQ.
 
 If you'd like to use the OPL3 FM Synthesizer, make sure you enable
-CONFIG_YM3812 (in 'make config'). That'll build the opl3.o module.
+CONFIG_SOUND_YM3812 (in 'make config'). That'll build the opl3.o module.
 
 Then a simple 'insmod opl3 io=0x388', and you now have FM Synth.
 
diff -Nru a/Documentation/sound/oss/VIBRA16 b/Documentation/sound/oss/VIBRA16
--- a/Documentation/sound/oss/VIBRA16	Tue Jun 15 22:20:37 2004
+++ b/Documentation/sound/oss/VIBRA16	Tue Jun 15 22:20:37 2004
@@ -62,12 +62,12 @@
 
 	Or, take the hard way:
 
-insmod souncore
-insmod sound
-insmod uart401
-insmod sb io=0x220 irq=5 dma=1 dma16=3
+modprobe soundcore
+modprobe sound
+modprobe uart401
+modprobe sb io=0x220 irq=5 dma=1 dma16=3
 # do you need MIDI?
-insmod opl3=0x388
+modprobe opl3=0x388
 
 	Just in case, the kernel sound support should be:
 
diff -Nru a/Documentation/usb/mtouchusb.txt b/Documentation/usb/mtouchusb.txt
--- a/Documentation/usb/mtouchusb.txt	Tue Jun 15 22:21:03 2004
+++ b/Documentation/usb/mtouchusb.txt	Tue Jun 15 22:21:03 2004
@@ -1,26 +1,38 @@
 CHANGES
 
-- Created based off of scanner & INSTALL from the original touchscreen
+- 0.3 - Created based off of scanner & INSTALL from the original touchscreen
   driver on freshmeat (http://freshmeat.net/projects/3mtouchscreendriver)
 - Amended for linux-2.4.18, then 2.4.19
 
-- Complete rewrite using Linux Input in 2.6.3
+- 0.5 - Complete rewrite using Linux Input in 2.6.3
    Unfortunately no calibration support at this time
 
+- 1.4 - Multiple changes to support the EXII 5000UC and house cleaning
+   Changed reset from standard USB dev reset to vendor reset
+   Changed data sent to host from compensated to raw coordinates
+   Eliminated vendor/product module params
+   Performed multiple successfull tests with an EXII-5010UC
 
-DRIVER NOTES:
+SUPPORTED HARDWARE:
+
+        All controllers have the Vendor: 0x0596 & Product: 0x0001
 
-Installation is simple, you only need to add Linux Input, Linux USB, and the 
-driver to the kernel.  The driver can also be optionally built as a module.
 
-If you have another MicroTouch device that you wish to experiment with
-or try using this driver with, but the Vendor and Product ID's are not 
-coded in, don't despair.  If the driver was compiled as a module, you can 
-pass options to the driver.  Simply try:
+        Controller Description          Part Number
+        ------------------------------------------------------
 
-  /sbin/modprobe mtouchusb vendor=0x#### product=0x****
+        USB Capacitive - Pearl Case     14-205  (Discontinued)
+        USB Capacitive - Black Case     14-124  (Discontinued)
+        USB Capacitive - No Case        14-206  (Discontinued)
+
+        USB Capacitive - Pearl Case     EXII-5010UC
+        USB Capacitive - Black Case     EXII-5030UC
+        USB Capacitive - No Case        EXII-5050UC
+
+DRIVER NOTES:
 
-If it works, send me the iVendor & iProduct (or a patch) and I will add...
+Installation is simple, you only need to add Linux Input, Linux USB, and the 
+driver to the kernel.  The driver can also be optionally built as a module.
 
 This driver appears to be one of possible 2 Linux USB Input Touchscreen
 drivers.  Although 3M produces a binary only driver available for
@@ -28,53 +40,28 @@
 touchscreen for embedded apps using QTEmbedded, DirectFB, etc. So I feel the
 logical choice is to use Linux Imput.
 
-A little info about the MicroTouch USB controller (14-206):
-
-Y is inverted, and the device has a total possible resolution of 0 - 65535.
-
-Y is inverted by the driver by:
+Currently there is no way to calibrate the device via this driver.  Even if
+the device could be calibrated, the driver pulls to raw coordinate data from
+the controller.  This means calibration must be performed within the
+userspace.
+
+The controller screen resolution is now 0 to 16384 for both X and Y reporting
+the raw touch data.  This is the same for the old and new capacitive USB
+controllers.
+
+Perhaps at some point an abstract function will be placed into evdev so 
+generic functions like calibrations, resets, and vendor information can be 
+requested from the userspace (And the drivers would handle the vendor specific
+tasks).
 
-        input.absmin[ABS_Y] =  MTOUCHUSB_MAX_YC;
-        input.absmax[ABS_Y] =  MTOUCHUSB_MIN_YC;
-
-absmin & absmax are also used to scale the data, sine it is rather high 
-resolution.
-
-    ---------------touch screen area-----------------
-    I                        MicroTouch (xmax,ymax) @I
-    I                      X                         I
-    I   ########visible monitor area##############   I
-    I   #@ (xmin,ymin)                           #   I
-    I   #                                        #   I
-    I   #                                        #   I
-    I   #                                        #   I
-    I   #                                        #   I
-    I   #                                        #   I
-    I Y #                                        #   I
-    I   #                                        #   I
-    I   #                                        #   I
-    I   #                                        #   I
-    I   #                                        #   I
-    I   #                                        #   I
-    I   #                           (xmax,ymax) @#   I
-    I   ##########################################   I
-    I                                                I
-    I@ MicroTouch (xmin,ymin)                        I
-    -------------------------------------------------
-
-Currently there is no way to calibrate the device via this driver.  Perhaps 
-at some point an abstract function will be placed into evdev so generic 
-functions like calibrations, resets, and vendor information can be requested 
-(And the drivers would handle the vendor specific tasks).
-
-ADDITIONAL INFORMATION/UPDATES:
+ADDITIONAL INFORMATION/UPDATES/X CONFIGURATION EXAMPLE:
 
 http://groomlakelabs.com/grandamp/code/microtouch/
 
 TODO:
 
 Implement a control urb again to handle requests to and from the device
-such as calibration, etc.
+such as calibration, etc once/if it becomes available.
 
 DISCLAMER:
 
@@ -83,3 +70,7 @@
 
 http://www.3m.com/3MTouchSystems/downloads/
 
+THANKS:
+
+A huge thank you to 3M Touch Systems for the EXII-5010UC controllers for
+testing!
diff -Nru a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
--- a/Documentation/vm/hugetlbpage.txt	Tue Jun 15 22:20:37 2004
+++ b/Documentation/vm/hugetlbpage.txt	Tue Jun 15 22:20:37 2004
@@ -91,9 +91,12 @@
 used to change the file attributes on hugetlbfs.
 
 Also, it is important to note that no such mount command is required if the
-applications are going to use only shmat/shmget system calls.  It is possible
-for same or different applications to use any combination of mmaps and shm*
-calls.  Though the mount of filesystem will be required for using mmaps.
+applications are going to use only shmat/shmget system calls.  Users who
+wish to use hugetlb page via shared memory segment should be a member of
+a supplementary group and system admin needs to configure that gid into
+/proc/sys/vm/hugetlb_shm_group.  It is possible for same or different
+applications to use any combination of mmaps and shm* calls.  Though the
+mount of filesystem will be required for using mmaps.
 
 /* Example of using hugepage in user application using Sys V shared memory
  * system calls.  In this example, app is requesting memory of size 256MB that
diff -Nru a/Documentation/vm/locking b/Documentation/vm/locking
--- a/Documentation/vm/locking	Tue Jun 15 22:20:38 2004
+++ b/Documentation/vm/locking	Tue Jun 15 22:20:38 2004
@@ -66,7 +66,7 @@
 expand_stack(), it is hard to come up with a destructive scenario without 
 having the vmlist protection in this case.
 
-The page_table_lock nests with the inode i_shared_sem and the kmem cache
+The page_table_lock nests with the inode i_mmap_lock and the kmem cache
 c_spinlock spinlocks.  This is okay, since the kmem code asks for pages after
 dropping c_spinlock.  The page_table_lock also nests with pagecache_lock and
 pagemap_lru_lock spinlocks, and no code asks for memory with these locks
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS	Tue Jun 15 22:20:41 2004
+++ b/MAINTAINERS	Tue Jun 15 22:20:41 2004
@@ -168,10 +168,8 @@
 
 AACRAID SCSI RAID DRIVER
 P:	Adaptec OEM Raid Solutions
-M:	linux-aacraid-devel@dell.com
-L:	linux-aacraid-devel@dell.com
-L:	linux-aacraid-announce@dell.com
-W:	http://domsch.com/linux
+L:	linux-scsi@vger.kernel.org
+W:	http://linux.dell.com/storage.shtml
 S:	Supported
 
 ACPI
@@ -187,6 +185,11 @@
 W:	http://www.tu-darmstadt.de/~tek01/projects/linux.html
 S:	Maintained
 
+ADT746X FAN DRIVER
+P:	Colin Leroy
+M:	colin@colino.net
+S:	Maintained
+
 ADVANSYS SCSI DRIVER
 P:	Bob Frey
 M:	linux@advansys.com
@@ -326,6 +329,12 @@
 W:	http://www.baycom.org/~tom/ham/ham.html
 S:	Maintained
 
+BEFS FILE SYSTEM
+P:	Sergey S. Kostyliov
+M:	rathamahata@php4.ru
+L:	linux-kernel@vger.kernel.org
+S:	Maintained
+
 BERKSHIRE PRODUCTS PC WATCHDOG DRIVER
 P:	Kenji Hollis
 W:	http://ftp.bitgate.com/pcwd/
@@ -350,6 +359,8 @@
 M:	maxk@qualcomm.com
 L:	bluez-devel@lists.sf.net
 W:	http://bluez.sf.net
+W:	http://www.bluez.org
+W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH RFCOMM LAYER
@@ -357,7 +368,6 @@
 M:	marcel@holtmann.org
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
 BLUETOOTH BNEP LAYER
@@ -365,71 +375,60 @@
 M:	marcel@holtmann.org
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
 BLUETOOTH CMTP LAYER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
-BLUETOOTH HCI USB DRIVER
+BLUETOOTH HCI UART DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
-BLUETOOTH HCI UART DRIVER
+BLUETOOTH HCI USB DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
 BLUETOOTH HCI BCM203X DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI BFUSB DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI DTL1 DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI BLUECARD DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI BT3C DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI BTUART DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
-W:	http://www.holtmann.org/linux/bluetooth/
 S:	Maintained
 
 BLUETOOTH HCI VHCI DRIVER
 P:	Maxim Krasnyansky
 M:	maxk@qualcomm.com
-W:	http://bluez.sf.net
 S:	Maintained
 
 BONDING DRIVER
@@ -512,11 +511,6 @@
 L:	linux-computone@lazuli.wittsend.com
 S:	Supported
 
-COMX/MULTIGATE SYNC SERIAL DRIVERS
-P:	Pasztor Szilard
-M:	Pasztor Szilard <don@itc.hu>
-S:	Supported
-
 COSA/SRP SYNC SERIAL DRIVER
 P:	Jan "Yenya" Kasprzak
 M:	kas@fi.muni.cz
@@ -539,11 +533,6 @@
 W:     http://sourceforge.net/projects/cramfs/
 S:     Orphan
 
-CREDITS FILE
-P:	John A. Martin
-M:	jam@acm.org
-S:	Maintained
-
 CRIS PORT
 P:	Bjorn Wesen
 M:	bjornw@axis.com
@@ -574,14 +563,12 @@
 S:	Maintained
 
 CYCLADES ASYNC MUX DRIVER
-P:	Henrique Gobbi
-M:	henrique@cyclades.com
+M:	async@cyclades.com
 W:	http://www.cyclades.com/
 S:	Supported
 
 CYCLADES PC300 DRIVER
-P:	Henrique Gobbi
-M:	henrique@cyclades.com
+M:	pc300@cyclades.com
 W:	http://www.cyclades.com/
 S:	Supported
 
@@ -636,10 +623,9 @@
 S:	Maintained
 
 DEVICE-MAPPER
-P:	Joe Thornber
-M:	dm@uk.sistina.com
-L:	linux-lvm@sistina.com
-W:	http://www.sistina.com/lvm
+P:	Alasdair Kergon
+L:	dm-devel@redhat.com
+W:	http://sources.redhat.com/dm
 S:	Maintained
 
 DEVICE NUMBER REGISTRY
@@ -796,7 +782,7 @@
 P:	James Simmons, Geert Uytterhoeven	
 M:	jsimmons@infradead.org, geert@linux-m68k.org	
 L:	linux-fbdev-devel@lists.sourceforge.net	
-W:	http://www.linux-fbdev.org
+W:	http://linux-fbdev.sourceforge.net/
 S:	Supported
 
 FILE LOCKING (flock() and fcntl()/lockf())
@@ -958,15 +944,15 @@
 IA64 (Itanium) PLATFORM
 P:	David Mosberger-Tang
 M:	davidm@hpl.hp.com
-L:	linux-ia64@linuxia64.org
-W:	http://www.linuxia64.org/
+L:	linux-ia64@vger.kernel.org
+W:	http://www.ia64-linux.org/
 S:	Maintained
 
 SN-IA64 (Itanium) SUB-PLATFORM
 P:	Jesse Barnes
 M:	jbarnes@sgi.com
 L:	linux-altix@sgi.com
-L:	linux-ia64@linuxia64.org
+L:	linux-ia64@vger.kernel.org
 W:	http://www.sgi.com/altix
 S:	Maintained
 
@@ -976,6 +962,11 @@
 W:	http://www.uni-mainz.de/~langm000/linux.html
 S:	Maintained
 
+IBM Power Linux RAID adapter
+P:	Brian King
+M:	brking@us.ibm.com
+S:	Supported
+
 IBM ServeRAID RAID DRIVER
 P:	Jack Hammer
 P:	Dave Jeffery
@@ -1182,8 +1173,8 @@
 S:	Odd Fixes
 
 KERNEL AUTOMOUNTER v4 (AUTOFS4)
-P:	Jeremy Fitzhardinge
-M:	jeremy@goop.org
+P:	Ian Kent
+M:	raven@themaw.net
 L:	autofs@linux.kernel.org
 S:	Maintained
 
@@ -1228,6 +1219,13 @@
 L:	linux-scsi@vger.kernel.org
 S:	Maintained
 
+LEGO USB Tower driver
+P:	Juergen Stuber
+M:	starblue@users.sourceforge.net
+L:	legousb-devel@lists.sourceforge.net
+W:	http://legousb.sourceforge.net/
+S:	Maintained
+
 LINUX FOR IBM pSERIES (RS/6000)
 P:	Paul Mackerras
 M:	paulus@au.ibm.com
@@ -1392,8 +1390,6 @@
 NCP FILESYSTEM
 P:	Petr Vandrovec
 M:	vandrove@vc.cvut.cz
-P:	Volker Lendecke
-M:	vl@kki.org
 L:	linware@sh.cvut.cz
 S:	Maintained
 
@@ -1803,6 +1799,12 @@
 W:	http://www.nsa.gov/selinux
 S:	Supported
 
+SERIAL ATA (SATA) SUBSYSTEM:
+P:	Jeff Garzik
+M:	jgarzik@pobox.com
+L:	linux-ide@vger.kernel.org
+S:	Supported
+
 SGI SN-IA64 (Altix) SERIAL CONSOLE DRIVER
 P:	Pat Gefre
 M:	pfg@sgi.com
@@ -2354,7 +2356,7 @@
 
 XFS FILESYSTEM
 P:	Silicon Graphics Inc
-M:	owner-xfs@oss.sgi.com
+M:	xfs-masters@oss.sgi.com
 M:	nathans@sgi.com
 L:	linux-xfs@oss.sgi.com
 W:	http://oss.sgi.com/projects/xfs
diff -Nru a/Makefile b/Makefile
--- a/Makefile	Tue Jun 15 22:20:42 2004
+++ b/Makefile	Tue Jun 15 22:20:42 2004
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 6
+SUBLEVEL = 7
 EXTRAVERSION =
 NAME=Zonked Quokka
 
@@ -110,7 +110,7 @@
 $(filter-out _all,$(MAKECMDGOALS)) _all:
 	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT)		\
 	KBUILD_SRC=$(CURDIR)	     KBUILD_VERBOSE=$(KBUILD_VERBOSE)	\
-	KBUILD_CHECK=$(KBUILD_CHECK) KBUILD_EXTMOD=$(KBUILD_EXTMOD)     \
+	KBUILD_CHECK=$(KBUILD_CHECK) KBUILD_EXTMOD="$(KBUILD_EXTMOD)"	\
         -f $(CURDIR)/Makefile $@
 
 # Leave processing to above invocation of make
@@ -325,7 +325,7 @@
 # When compiling out-of-tree modules, put MODVERDIR in the module
 # tree rather than in the kernel tree. The kernel tree might
 # even be read-only.
-export MODVERDIR := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/).tmp_versions
+export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
 
 # The temporary file to save gcc -MD generated dependencies must not
 # contain a comma
@@ -567,7 +567,7 @@
 kallsyms.o := .tmp_kallsyms2.o
 
 quiet_cmd_kallsyms = KSYM    $@
-cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) > $@
+cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
 
 .tmp_kallsyms1.o .tmp_kallsyms2.o: %.o: %.S scripts FORCE
 	$(call if_changed_dep,as_o_S)
@@ -680,7 +680,7 @@
 uts_len := 64
 
 define filechk_version.h
-	if ((`echo -n "$(KERNELRELEASE)" | wc -c ` > $(uts_len))); then \
+	if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
 	  echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
 	  exit 1; \
 	fi; \
@@ -904,6 +904,7 @@
 	@echo  '  rpm		  - Build a kernel as an RPM package'
 	@echo  '  tags/TAGS	  - Generate tags file for editors'
 	@echo  '  cscope	  - Generate cscope index'
+	@echo  '  checkstack      - Generate a list of stack hogs'
 	@echo  ''
 	@echo  'Documentation targets:'
 	@$(MAKE) -f $(srctree)/Documentation/DocBook/Makefile dochelp
@@ -952,15 +953,15 @@
 # We are always building modules
 KBUILD_MODULES := 1
 .PHONY: crmodverdir
-crmodverdir: FORCE
+crmodverdir:
 	$(Q)mkdir -p $(MODVERDIR)
 
-.PHONY: $(KBUILD_EXTMOD)
-$(KBUILD_EXTMOD): crmodverdir FORCE
-	$(Q)$(MAKE) $(build)=$@
+module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
+.PHONY: $(module-dirs) modules
+$(module-dirs): crmodverdir
+	$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
 
-.PHONY: modules
-modules: $(KBUILD_EXTMOD)
+modules: $(module-dirs)
 	@echo '  Building modules, stage 2.';
 	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
 
@@ -968,7 +969,7 @@
 modules_install:
 	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
 
-clean-dirs := _clean_$(KBUILD_EXTMOD)
+clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
 
 .PHONY: $(clean-dirs) clean
 $(clean-dirs):
@@ -1001,6 +1002,8 @@
 	       -name '*.[chS]' -print; \
 	  find arch/$(ARCH) $(RCS_FIND_IGNORE) \
 	       -name '*.[chS]' -print; \
+	  find security/selinux/include $(RCS_FIND_IGNORE) \
+	       -name '*.[chS]' -print; \
 	  find include $(RCS_FIND_IGNORE) \
 	       \( -name config -o -name 'asm-*' \) -prune \
 	       -o -name '*.[chS]' -print; \
@@ -1057,8 +1060,17 @@
 		-name '*.[hcS]' -type f -print | sort \
 		| xargs $(PERL) -w scripts/checkversion.pl
 
+buildcheck:
+	$(PERL) scripts/reference_discarded.pl
+	$(PERL) scripts/reference_init.pl
+
 endif #ifeq ($(config-targets),1)
 endif #ifeq ($(mixed-targets),1)
+
+.PHONY: checkstack
+checkstack:
+	$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
+	$(PERL) scripts/checkstack.pl $(ARCH)
 
 # FIXME Should go into a make.lib or something 
 # ===========================================================================
diff -Nru a/arch/alpha/Kconfig b/arch/alpha/Kconfig
--- a/arch/alpha/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/alpha/Kconfig	Tue Jun 15 22:20:43 2004
@@ -626,8 +626,8 @@
 	  identify kernel problems.
 
 config MATHEMU
-	tristate "Kernel FP software completion" if DEBUG_KERNEL
-	default y if !DEBUG_KERNEL
+	tristate "Kernel FP software completion" if DEBUG_KERNEL && !SMP
+	default y if !DEBUG_KERNEL || SMP
 	help
 	  This option is required for IEEE compliant floating point arithmetic
 	  on the Alpha. The only time you would ever not say Y is to say M in
diff -Nru a/arch/alpha/Makefile b/arch/alpha/Makefile
--- a/arch/alpha/Makefile	Tue Jun 15 22:20:42 2004
+++ b/arch/alpha/Makefile	Tue Jun 15 22:20:42 2004
@@ -106,10 +106,10 @@
 all boot: $(boot)/vmlinux.gz
 
 $(boot)/vmlinux.gz: vmlinux
-	$(Q)$(MAKE) -f scripts/Makefile.build obj=$(boot) $@
+	$(Q)$(MAKE) $(build)=$(boot) $@
 
 bootimage bootpfile bootpzfile: vmlinux
-	$(Q)$(MAKE) -f scripts/Makefile.build obj=$(boot) $(boot)/$@
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 
 prepare: include/asm-$(ARCH)/asm_offsets.h
@@ -121,7 +121,7 @@
 	$(call filechk,gen-asm-offsets)
 
 archclean:
-	$(Q)$(MAKE) -f scripts/Makefile.clean obj=$(boot)
+	$(Q)$(MAKE) $(clean)=$(boot)
 
 CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
 
diff -Nru a/arch/alpha/kernel/core_cia.c b/arch/alpha/kernel/core_cia.c
--- a/arch/alpha/kernel/core_cia.c	Tue Jun 15 22:20:41 2004
+++ b/arch/alpha/kernel/core_cia.c	Tue Jun 15 22:20:41 2004
@@ -762,7 +762,7 @@
 		*(vip)CIA_IOC_PCI_W3_MASK = 0xfff00000;
 		*(vip)CIA_IOC_PCI_T3_BASE = 0 >> 2;
 
-		alpha_mv.pci_dac_offset = 0x200000000;
+		alpha_mv.pci_dac_offset = 0x200000000UL;
 		*(vip)CIA_IOC_PCI_W_DAC = alpha_mv.pci_dac_offset >> 32;
 	}
 
diff -Nru a/arch/alpha/kernel/core_irongate.c b/arch/alpha/kernel/core_irongate.c
--- a/arch/alpha/kernel/core_irongate.c	Tue Jun 15 22:20:42 2004
+++ b/arch/alpha/kernel/core_irongate.c	Tue Jun 15 22:20:42 2004
@@ -287,9 +287,9 @@
 	hose->sparse_mem_base = 0;
 	hose->sparse_io_base = 0;
 	hose->dense_mem_base
-	  = (IRONGATE_MEM & 0xffffffffff) | 0x80000000000;
+	  = (IRONGATE_MEM & 0xffffffffffUL) | 0x80000000000UL;
 	hose->dense_io_base
-	  = (IRONGATE_IO & 0xffffffffff) | 0x80000000000;
+	  = (IRONGATE_IO & 0xffffffffffUL) | 0x80000000000UL;
 
 	hose->sg_isa = hose->sg_pci = NULL;
 	__direct_map_base = 0;
diff -Nru a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c
--- a/arch/alpha/kernel/core_marvel.c	Tue Jun 15 22:20:36 2004
+++ b/arch/alpha/kernel/core_marvel.c	Tue Jun 15 22:20:36 2004
@@ -718,7 +718,7 @@
 	if (((long)addr >> 41) == -2)
 		return;	/* kseg map, nothing to do */
 	if (addr)
-		return vfree((void *)(PAGE_MASK & addr)); 
+		vfree((void *)(PAGE_MASK & addr)); 
 }
 
 #ifndef CONFIG_ALPHA_GENERIC
diff -Nru a/arch/alpha/kernel/core_titan.c b/arch/alpha/kernel/core_titan.c
--- a/arch/alpha/kernel/core_titan.c	Tue Jun 15 22:20:38 2004
+++ b/arch/alpha/kernel/core_titan.c	Tue Jun 15 22:20:38 2004
@@ -258,9 +258,9 @@
 	hose->sparse_mem_base = 0;
 	hose->sparse_io_base = 0;
 	hose->dense_mem_base
-	  = (TITAN_MEM(index) & 0xffffffffff) | 0x80000000000;
+	  = (TITAN_MEM(index) & 0xffffffffffUL) | 0x80000000000UL;
 	hose->dense_io_base
-	  = (TITAN_IO(index) & 0xffffffffff) | 0x80000000000;
+	  = (TITAN_IO(index) & 0xffffffffffUL) | 0x80000000000UL;
 
 	hose->config_space_base = TITAN_CONF(index);
 	hose->index = index;
diff -Nru a/arch/alpha/kernel/core_wildfire.c b/arch/alpha/kernel/core_wildfire.c
--- a/arch/alpha/kernel/core_wildfire.c	Tue Jun 15 22:20:35 2004
+++ b/arch/alpha/kernel/core_wildfire.c	Tue Jun 15 22:20:35 2004
@@ -285,8 +285,8 @@
 		    fe = WILDFIRE_fe(soft_qbb, i);
 
 		    if ((iop->iop_hose[i].init.csr & 1) == 1 &&
-			((ne->ne_what_am_i.csr & 0xf00000300) == 0x100000300) &&
-			((fe->fe_what_am_i.csr & 0xf00000300) == 0x100000200))
+			((ne->ne_what_am_i.csr & 0xf00000300UL) == 0x100000300UL) &&
+			((fe->fe_what_am_i.csr & 0xf00000300UL) == 0x100000200UL))
 		    {
 		        wildfire_pca_mask |= 1 << ((soft_qbb << 2) + i);
 		    }
diff -Nru a/arch/alpha/kernel/err_marvel.c b/arch/alpha/kernel/err_marvel.c
--- a/arch/alpha/kernel/err_marvel.c	Tue Jun 15 22:21:03 2004
+++ b/arch/alpha/kernel/err_marvel.c	Tue Jun 15 22:21:03 2004
@@ -1077,7 +1077,8 @@
 
 	default:
 		/* Don't know it - pass it up.  */
-		return ev7_machine_check(vector, la_ptr, regs);
+		ev7_machine_check(vector, la_ptr, regs);
+		return;
 	}	
 
 	/*
diff -Nru a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c
--- a/arch/alpha/kernel/err_titan.c	Tue Jun 15 22:21:02 2004
+++ b/arch/alpha/kernel/err_titan.c	Tue Jun 15 22:21:02 2004
@@ -407,8 +407,10 @@
 	/*
 	 * Only handle system errors here 
 	 */
-	if ((vector != SCB_Q_SYSMCHK) && (vector != SCB_Q_SYSERR)) 
-		return ev6_machine_check(vector, la_ptr, regs);
+	if ((vector != SCB_Q_SYSMCHK) && (vector != SCB_Q_SYSERR)) {
+		ev6_machine_check(vector, la_ptr, regs);
+		return;
+	}
 
 	/* 
 	 * It's a system error, handle it here
diff -Nru a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
--- a/arch/alpha/kernel/irq.c	Tue Jun 15 22:20:43 2004
+++ b/arch/alpha/kernel/irq.c	Tue Jun 15 22:20:43 2004
@@ -260,7 +260,7 @@
 }
 
 static unsigned int
-parse_hex_value (const char *buffer,
+parse_hex_value (const char __user *buffer,
 		 unsigned long count, unsigned long *ret)
 {
 	unsigned char hexnum [HEX_DIGITS];
@@ -298,7 +298,7 @@
 }
 
 static int
-irq_affinity_write_proc(struct file *file, const char *buffer,
+irq_affinity_write_proc(struct file *file, const char __user *buffer,
 			unsigned long count, void *data)
 {
 	int irq = (long) data, full_count = count, err;
@@ -341,7 +341,7 @@
 }
 
 static int
-prof_cpu_mask_write_proc(struct file *file, const char *buffer,
+prof_cpu_mask_write_proc(struct file *file, const char __user *buffer,
 			 unsigned long count, void *data)
 {
 	unsigned long *mask = (unsigned long *) data, full_count = count, err;
diff -Nru a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
--- a/arch/alpha/kernel/machvec_impl.h	Tue Jun 15 22:20:43 2004
+++ b/arch/alpha/kernel/machvec_impl.h	Tue Jun 15 22:20:43 2004
@@ -20,10 +20,10 @@
 #define TITAN_HAE_ADDRESS	(&alpha_mv.hae_cache)
 #define WILDFIRE_HAE_ADDRESS	(&alpha_mv.hae_cache)
 
-#if CIA_ONE_HAE_WINDOW
+#ifdef CIA_ONE_HAE_WINDOW
 #define CIA_HAE_ADDRESS		(&alpha_mv.hae_cache)
 #endif
-#if MCPCIA_ONE_HAE_WINDOW
+#ifdef MCPCIA_ONE_HAE_WINDOW
 #define MCPCIA_HAE_ADDRESS	(&alpha_mv.hae_cache)
 #endif
 
diff -Nru a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
--- a/arch/alpha/kernel/module.c	Tue Jun 15 22:20:36 2004
+++ b/arch/alpha/kernel/module.c	Tue Jun 15 22:20:36 2004
@@ -234,6 +234,10 @@
 			   value was resolved from somewhere else.  */
 			if (sym->st_shndx == SHN_UNDEF)
 				goto reloc_overflow;
+			if ((sym->st_other & STO_ALPHA_STD_GPLOAD) ==
+			    STO_ALPHA_STD_GPLOAD)
+				/* Omit the prologue. */
+				value += 8;
 			/* FALLTHRU */
 		case R_ALPHA_BRADDR:
 			value -= (u64)location + 4;
diff -Nru a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
--- a/arch/alpha/kernel/osf_sys.c	Tue Jun 15 22:20:35 2004
+++ b/arch/alpha/kernel/osf_sys.c	Tue Jun 15 22:20:35 2004
@@ -91,7 +91,7 @@
  * braindamage (it can't really handle filesystems where the directory
  * offset differences aren't the same as "d_reclen").
  */
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+3) & ~3)
 
 struct osf_dirent {
@@ -102,8 +102,8 @@
 };
 
 struct osf_dirent_callback {
-	struct osf_dirent *dirent;
-	long *basep;
+	struct osf_dirent __user *dirent;
+	long __user *basep;
 	unsigned int count;
 	int error;
 };
@@ -112,7 +112,7 @@
 osf_filldir(void *__buf, const char *name, int namlen, loff_t offset,
 	    ino_t ino, unsigned int d_type)
 {
-	struct osf_dirent *dirent;
+	struct osf_dirent __user *dirent;
 	struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf;
 	unsigned int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
@@ -131,15 +131,15 @@
 	if (copy_to_user(dirent->d_name, name, namlen) ||
 	    put_user(0, dirent->d_name + namlen))
 		return -EFAULT;
-	dirent = (void *)dirent + reclen;
+	dirent = (void __user *)dirent + reclen;
 	buf->dirent = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
 asmlinkage int
-osf_getdirentries(unsigned int fd, struct osf_dirent *dirent,
-		  unsigned int count, long *basep)
+osf_getdirentries(unsigned int fd, struct osf_dirent __user *dirent,
+		  unsigned int count, long __user *basep)
 {
 	int error;
 	struct file *file;
@@ -215,10 +215,10 @@
 	int f_files;
 	int f_ffree;
 	__kernel_fsid_t f_fsid;
-} *osf_stat;
+};
 
 static int
-linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs *osf_stat,
+linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_stat,
 		    unsigned long bufsiz)
 {
 	struct osf_statfs tmp_stat;
@@ -239,7 +239,7 @@
 }
 
 static int
-do_osf_statfs(struct dentry * dentry, struct osf_statfs *buffer,
+do_osf_statfs(struct dentry * dentry, struct osf_statfs __user *buffer,
 	      unsigned long bufsiz)
 {
 	struct kstatfs linux_stat;
@@ -250,7 +250,7 @@
 }
 
 asmlinkage int
-osf_statfs(char *path, struct osf_statfs *buffer, unsigned long bufsiz)
+osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bufsiz)
 {
 	struct nameidata nd;
 	int retval;
@@ -264,7 +264,7 @@
 }
 
 asmlinkage int
-osf_fstatfs(unsigned long fd, struct osf_statfs *buffer, unsigned long bufsiz)
+osf_fstatfs(unsigned long fd, struct osf_statfs __user *buffer, unsigned long bufsiz)
 {
 	struct file *file;
 	int retval;
@@ -284,13 +284,13 @@
  * Although to be frank, neither are the native Linux/i386 ones..
  */
 struct ufs_args {
-	char *devname;
+	char __user *devname;
 	int flags;
 	uid_t exroot;
 };
 
 struct cdfs_args {
-	char *devname;
+	char __user *devname;
 	int flags;
 	uid_t exroot;
 
@@ -299,7 +299,7 @@
 };
 
 struct procfs_args {
-	char *devname;
+	char __user *devname;
 	int flags;
 	uid_t exroot;
 };
@@ -313,7 +313,7 @@
  * unhappy with OSF UFS. [CHECKME]
  */
 static int
-osf_ufs_mount(char *dirname, struct ufs_args *args, int flags)
+osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags)
 {
 	int retval;
 	struct cdfs_args tmp;
@@ -333,7 +333,7 @@
 }
 
 static int
-osf_cdfs_mount(char *dirname, struct cdfs_args *args, int flags)
+osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags)
 {
 	int retval;
 	struct cdfs_args tmp;
@@ -353,7 +353,7 @@
 }
 
 static int
-osf_procfs_mount(char *dirname, struct procfs_args *args, int flags)
+osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags)
 {
 	struct procfs_args tmp;
 
@@ -364,7 +364,7 @@
 }
 
 asmlinkage int
-osf_mount(unsigned long typenr, char *path, int flag, void *data)
+osf_mount(unsigned long typenr, char __user *path, int flag, void __user *data)
 {
 	int retval = -EINVAL;
 	char *name;
@@ -377,13 +377,13 @@
 		goto out;
 	switch (typenr) {
 	case 1:
-		retval = osf_ufs_mount(name, (struct ufs_args *) data, flag);
+		retval = osf_ufs_mount(name, data, flag);
 		break;
 	case 6:
-		retval = osf_cdfs_mount(name, (struct cdfs_args *) data, flag);
+		retval = osf_cdfs_mount(name, data, flag);
 		break;
 	case 9:
-		retval = osf_procfs_mount(name, (struct procfs_args *) data, flag);
+		retval = osf_procfs_mount(name, data, flag);
 		break;
 	default:
 		printk("osf_mount(%ld, %x)\n", typenr, flag);
@@ -395,7 +395,7 @@
 }
 
 asmlinkage int
-osf_utsname(char *name)
+osf_utsname(char __user *name)
 {
 	int error;
 
@@ -434,7 +434,7 @@
  * For compatibility with OSF/1 only.  Use utsname(2) instead.
  */
 asmlinkage int
-osf_getdomainname(char *name, int namelen)
+osf_getdomainname(char __user *name, int namelen)
 {
 	unsigned len;
 	int i, error;
@@ -459,7 +459,7 @@
 }
 
 asmlinkage long
-osf_shmat(int shmid, void *shmaddr, int shmflg)
+osf_shmat(int shmid, void __user *shmaddr, int shmflg)
 {
 	unsigned long raddr;
 	long err;
@@ -497,39 +497,39 @@
 
 union pl_args {
 	struct setargs {
-		char *path;
+		char __user *path;
 		long follow;
 		long nbytes;
-		char *buf;
+		char __user *buf;
 	} set;
 	struct fsetargs {
 		long fd;
 		long nbytes;
-		char *buf;
+		char __user *buf;
 	} fset;
 	struct getargs {
-		char *path;
+		char __user *path;
 		long follow;
-		struct proplistname_args *name_args;
+		struct proplistname_args __user *name_args;
 		long nbytes;
-		char *buf;
-		int *min_buf_size;
+		char __user *buf;
+		int __user *min_buf_size;
 	} get;
 	struct fgetargs {
 		long fd;
-		struct proplistname_args *name_args;
+		struct proplistname_args __user *name_args;
 		long nbytes;
-		char *buf;
-		int *min_buf_size;
+		char __user *buf;
+		int __user *min_buf_size;
 	} fget;
 	struct delargs {
-		char *path;
+		char __user *path;
 		long follow;
-		struct proplistname_args *name_args;
+		struct proplistname_args __user *name_args;
 	} del;
 	struct fdelargs {
 		long fd;
-		struct proplistname_args *name_args;
+		struct proplistname_args __user *name_args;
 	} fdel;
 };
 
@@ -540,24 +540,20 @@
 };
 
 asmlinkage long
-osf_proplist_syscall(enum pl_code code, union pl_args *args)
+osf_proplist_syscall(enum pl_code code, union pl_args __user *args)
 {
 	long error;
-	int *min_buf_size_ptr;
+	int __user *min_buf_size_ptr;
 
 	lock_kernel();
 	switch (code) {
 	case PL_SET:
-		error = verify_area(VERIFY_READ, &args->set.nbytes,
-				    sizeof(args->set.nbytes));
-		if (!error)
-			error = args->set.nbytes;
+		if (get_user(error, &args->set.nbytes))
+			error = -EFAULT;
 		break;
 	case PL_FSET:
-		error = verify_area(VERIFY_READ, &args->fset.nbytes,
-				    sizeof(args->fset.nbytes));
-		if (!error)
-			error = args->fset.nbytes;
+		if (get_user(error, &args->fset.nbytes))
+			error = -EFAULT;
 		break;
 	case PL_GET:
 		error = get_user(min_buf_size_ptr, &args->get.min_buf_size);
@@ -584,7 +580,7 @@
 }
 
 asmlinkage int
-osf_sigstack(struct sigstack *uss, struct sigstack *uoss)
+osf_sigstack(struct sigstack __user *uss, struct sigstack __user *uoss)
 {
 	unsigned long usp = rdusp();
 	unsigned long oss_sp = current->sas_ss_sp + current->sas_ss_size;
@@ -625,7 +621,7 @@
 }
 
 asmlinkage long
-osf_sysinfo(int command, char *buf, long count)
+osf_sysinfo(int command, char __user *buf, long count)
 {
 	static char * sysinfo_table[] = {
 		system_utsname.sysname,
@@ -664,8 +660,8 @@
 }
 
 asmlinkage unsigned long
-osf_getsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
-	       int *start, void *arg)
+osf_getsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
+	       int __user *start, void __user *arg)
 {
 	unsigned long w;
 	struct percpu_struct *cpu;
@@ -677,7 +673,7 @@
 
  		w = current_thread_info()->ieee_state & IEEE_SW_MASK;
  		w = swcr_update_status(w, rdfpcr());
-		if (put_user(w, (unsigned long *) buffer))
+		if (put_user(w, (unsigned long __user *) buffer))
 			return -EFAULT;
 		return 0;
 
@@ -693,7 +689,7 @@
 		if (nbytes < sizeof(unsigned int))
 			return -EINVAL;
  		w = (current_thread_info()->flags >> UAC_SHIFT) & UAC_BITMASK;
- 		if (put_user(w, (unsigned int *)buffer))
+ 		if (put_user(w, (unsigned int __user *)buffer))
  			return -EFAULT;
  		return 1;
 
@@ -703,7 +699,7 @@
 		cpu = (struct percpu_struct*)
 		  ((char*)hwrpb + hwrpb->processor_offset);
 		w = cpu->type;
-		if (put_user(w, (unsigned long *)buffer))
+		if (put_user(w, (unsigned long  __user*)buffer))
 			return -EFAULT;
 		return 1;
 
@@ -722,8 +718,8 @@
 }
 
 asmlinkage unsigned long
-osf_setsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
-	       int *start, void *arg)
+osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
+	       int __user *start, void __user *arg)
 {
 	switch (op) {
 	case SSI_IEEE_FP_CONTROL: {
@@ -737,7 +733,7 @@
 		 */
 
 		/* Update softare trap enable bits.  */
-		if (get_user(swcr, (unsigned long *)buffer))
+		if (get_user(swcr, (unsigned long __user *)buffer))
 			return -EFAULT;
 		current_thread_info()->ieee_state
 		  = ((current_thread_info()->ieee_state & ~IEEE_SW_MASK)
@@ -788,9 +784,9 @@
 		
  		for (i = 0; i < nbytes; ++i) {
 
- 			if (get_user(v, 2*i + (unsigned int *)buffer))
+ 			if (get_user(v, 2*i + (unsigned int __user *)buffer))
  				return -EFAULT;
- 			if (get_user(w, 2*i + 1 + (unsigned int *)buffer))
+ 			if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer))
  				return -EFAULT;
  			switch (v) {
  			case SSIN_UACPROC:
@@ -835,7 +831,7 @@
 };
 
 static inline long
-get_tv32(struct timeval *o, struct timeval32 *i)
+get_tv32(struct timeval *o, struct timeval32 __user *i)
 {
 	return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
 		(__get_user(o->tv_sec, &i->tv_sec) |
@@ -843,7 +839,7 @@
 }
 
 static inline long
-put_tv32(struct timeval32 *o, struct timeval *i)
+put_tv32(struct timeval32 __user *o, struct timeval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
 		(__put_user(i->tv_sec, &o->tv_sec) |
@@ -851,7 +847,7 @@
 }
 
 static inline long
-get_it32(struct itimerval *o, struct itimerval32 *i)
+get_it32(struct itimerval *o, struct itimerval32 __user *i)
 {
 	return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
 		(__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) |
@@ -861,7 +857,7 @@
 }
 
 static inline long
-put_it32(struct itimerval32 *o, struct itimerval *i)
+put_it32(struct itimerval32 __user *o, struct itimerval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
 		(__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) |
@@ -878,7 +874,7 @@
 }
 
 asmlinkage int
-osf_gettimeofday(struct timeval32 *tv, struct timezone *tz)
+osf_gettimeofday(struct timeval32 __user *tv, struct timezone __user *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -894,7 +890,7 @@
 }
 
 asmlinkage int
-osf_settimeofday(struct timeval32 *tv, struct timezone *tz)
+osf_settimeofday(struct timeval32 __user *tv, struct timezone __user *tz)
 {
 	struct timespec kts;
 	struct timezone ktz;
@@ -914,7 +910,7 @@
 }
 
 asmlinkage int
-osf_getitimer(int which, struct itimerval32 *it)
+osf_getitimer(int which, struct itimerval32 __user *it)
 {
 	struct itimerval kit;
 	int error;
@@ -927,7 +923,7 @@
 }
 
 asmlinkage int
-osf_setitimer(int which, struct itimerval32 *in, struct itimerval32 *out)
+osf_setitimer(int which, struct itimerval32 __user *in, struct itimerval32 __user *out)
 {
 	struct itimerval kin, kout;
 	int error;
@@ -950,16 +946,9 @@
 }
 
 asmlinkage int
-osf_utimes(const char *filename, struct timeval32 *tvs)
+osf_utimes(char __user *filename, struct timeval32 __user *tvs)
 {
-	char *kfilename;
 	struct timeval ktvs[2];
-	mm_segment_t old_fs;
-	int ret;
-
-	kfilename = getname(filename);
-	if (IS_ERR(kfilename))
-		return PTR_ERR(kfilename);
 
 	if (tvs) {
 		if (get_tv32(&ktvs[0], &tvs[0]) ||
@@ -967,22 +956,15 @@
 			return -EFAULT;
 	}
 
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_utimes(kfilename, tvs ? ktvs : 0);
-	set_fs(old_fs);
-
-	putname(kfilename);
-
-	return ret;
+	return do_utimes(filename, tvs ? ktvs : 0);
 }
 
 #define MAX_SELECT_SECONDS \
 	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
 
 asmlinkage int
-osf_select(int n, fd_set *inp, fd_set *outp, fd_set *exp,
-	   struct timeval32 *tvp)
+osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
+	   struct timeval32 __user *tvp)
 {
 	fd_set_bits fds;
 	char *bits;
@@ -1081,7 +1063,7 @@
 };
 
 asmlinkage int
-osf_getrusage(int who, struct rusage32 *ru)
+osf_getrusage(int who, struct rusage32 __user *ru)
 {
 	struct rusage32 r;
 
@@ -1116,7 +1098,7 @@
 }
 
 asmlinkage int
-osf_wait4(pid_t pid, int *ustatus, int options, struct rusage32 *ur)
+osf_wait4(pid_t pid, int __user *ustatus, int options, struct rusage32 __user *ur)
 {
 	if (!ur) {
 		return sys_wait4(pid, ustatus, options, NULL);
@@ -1163,7 +1145,7 @@
  * one is the time remaining.. Ho humm.. No documentation.
  */
 asmlinkage int
-osf_usleep_thread(struct timeval32 *sleep, struct timeval32 *remain)
+osf_usleep_thread(struct timeval32 __user *sleep, struct timeval32 __user *remain)
 {
 	struct timeval tmp;
 	unsigned long ticks;
@@ -1221,7 +1203,7 @@
 };
 
 asmlinkage int
-sys_old_adjtimex(struct timex32 *txc_p)
+sys_old_adjtimex(struct timex32 __user *txc_p)
 {
         struct timex txc;
 	int ret;
@@ -1316,12 +1298,12 @@
    compatibility with old versions of OSF/1 where iov_len
    was defined as int. */
 static int
-osf_fix_iov_len(const struct iovec *iov, unsigned long count)
+osf_fix_iov_len(const struct iovec __user *iov, unsigned long count)
 {
 	unsigned long i;
 
 	for (i = 0 ; i < count ; i++) {
-		int *iov_len_high = (int *)&iov[i].iov_len + 1;
+		int *iov_len_high = (int __user *)&iov[i].iov_len + 1;
 
 		if (put_user(0, iov_len_high))
 			return -EFAULT;
@@ -1330,7 +1312,7 @@
 }
 
 asmlinkage ssize_t
-osf_readv(unsigned long fd, const struct iovec * vector, unsigned long count)
+osf_readv(unsigned long fd, const struct iovec __user * vector, unsigned long count)
 {
 	if (unlikely(personality(current->personality) == PER_OSF4))
 		if (osf_fix_iov_len(vector, count))
@@ -1339,7 +1321,7 @@
 }
 
 asmlinkage ssize_t
-osf_writev(unsigned long fd, const struct iovec * vector, unsigned long count)
+osf_writev(unsigned long fd, const struct iovec __user * vector, unsigned long count)
 {
 	if (unlikely(personality(current->personality) == PER_OSF4))
 		if (osf_fix_iov_len(vector, count))
diff -Nru a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
--- a/arch/alpha/kernel/process.c	Tue Jun 15 22:20:44 2004
+++ b/arch/alpha/kernel/process.c	Tue Jun 15 22:20:44 2004
@@ -239,8 +239,9 @@
  * with parameters (SIGCHLD, 0).
  */
 int
-alpha_clone(unsigned long clone_flags, unsigned long usp, int *parent_tid,
-	    int *child_tid, unsigned long tls_value, struct pt_regs *regs)
+alpha_clone(unsigned long clone_flags, unsigned long usp,
+	    int __user *parent_tid, int __user *child_tid,
+	    unsigned long tls_value, struct pt_regs *regs)
 {
 	if (!usp)
 		usp = rdusp();
@@ -464,7 +465,8 @@
  * Don't do this at home.
  */
 asmlinkage int
-sys_execve(char *ufilename, char **argv, char **envp,
+sys_execve(char __user *ufilename, char __user * __user *argv,
+	   char __user * __user *envp,
 	   unsigned long a3, unsigned long a4, unsigned long a5,
 	   struct pt_regs regs)
 {
@@ -510,12 +512,6 @@
 	return 0;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 unsigned long
 get_wchan(struct task_struct *p)
 {
@@ -534,7 +530,7 @@
 	 */
 
 	pc = thread_saved_pc(p);
-	if (pc >= first_sched && pc < last_sched) {
+	if (in_sched_functions(pc)) {
 		schedule_frame = ((unsigned long *)p->thread_info->pcb.ksp)[6];
 		return ((unsigned long *)schedule_frame)[12];
 	}
diff -Nru a/arch/alpha/kernel/semaphore.c b/arch/alpha/kernel/semaphore.c
--- a/arch/alpha/kernel/semaphore.c	Tue Jun 15 22:20:40 2004
+++ b/arch/alpha/kernel/semaphore.c	Tue Jun 15 22:20:40 2004
@@ -163,7 +163,7 @@
 void __sched
 down(struct semaphore *sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 #ifdef CONFIG_DEBUG_SEMAPHORE
@@ -177,7 +177,7 @@
 int __sched
 down_interruptible(struct semaphore *sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 #ifdef CONFIG_DEBUG_SEMAPHORE
@@ -193,7 +193,7 @@
 {
 	int ret;
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
@@ -212,7 +212,7 @@
 void
 up(struct semaphore *sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 #ifdef CONFIG_DEBUG_SEMAPHORE
diff -Nru a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
--- a/arch/alpha/kernel/setup.c	Tue Jun 15 22:20:37 2004
+++ b/arch/alpha/kernel/setup.c	Tue Jun 15 22:20:37 2004
@@ -1359,7 +1359,7 @@
 		L1I = L1D = CSHAPE(8*1024, 5, 1);
 		L3 = -1;
 
-		car = *(vuip) phys_to_virt (0x120000078);
+		car = *(vuip) phys_to_virt (0x120000078UL);
 		size = 64*1024 * (1 << ((car >> 5) & 7));
 		/* No typo -- 8 byte cacheline size.  Whodathunk.  */
 		L2 = (car & 1 ? CSHAPE (size, 3, 1) : -1);
@@ -1374,7 +1374,7 @@
 		L1I = L1D = CSHAPE(8*1024, 5, 1);
 
 		/* Check the line size of the Scache.  */
-		sc_ctl = *(vulp) phys_to_virt (0xfffff000a8);
+		sc_ctl = *(vulp) phys_to_virt (0xfffff000a8UL);
 		width = sc_ctl & 0x1000 ? 6 : 5;
 		L2 = CSHAPE (96*1024, width, 3);
 
@@ -1406,7 +1406,7 @@
 		}
 		L3 = -1;
 
-		cbox_config = *(vulp) phys_to_virt (0xfffff00008);
+		cbox_config = *(vulp) phys_to_virt (0xfffff00008UL);
 		size = 512*1024 * (1 << ((cbox_config >> 12) & 3));
 
 #if 0
diff -Nru a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c
--- a/arch/alpha/kernel/signal.c	Tue Jun 15 22:20:40 2004
+++ b/arch/alpha/kernel/signal.c	Tue Jun 15 22:20:40 2004
@@ -84,8 +84,8 @@
 }
 
 asmlinkage int 
-osf_sigaction(int sig, const struct osf_sigaction *act,
-	      struct osf_sigaction *oact)
+osf_sigaction(int sig, const struct osf_sigaction __user *act,
+	      struct osf_sigaction __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -115,8 +115,9 @@
 }
 
 asmlinkage long
-sys_rt_sigaction(int sig, const struct sigaction *act, struct sigaction *oact,
-		 size_t sigsetsize, void *restorer)
+sys_rt_sigaction(int sig, const struct sigaction __user *act,
+		 struct sigaction __user *oact,
+		 size_t sigsetsize, void __user *restorer)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -165,7 +166,7 @@
 }
 
 asmlinkage int
-do_rt_sigsuspend(sigset_t *uset, size_t sigsetsize,
+do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize,
 		 struct pt_regs *reg, struct switch_stack *sw)
 {
 	sigset_t oldset, set;
@@ -192,7 +193,7 @@
 }
 
 asmlinkage int
-sys_sigaltstack(const stack_t *uss, stack_t *uoss)
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
 {
 	return do_sigaltstack(uss, uoss, rdusp());
 }
@@ -223,7 +224,7 @@
 #define INSN_CALLSYS		0x00000083
 
 static long
-restore_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
+restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
 		   struct switch_stack *sw)
 {
 	unsigned long usp;
@@ -276,7 +277,7 @@
    registers and transfer control from userland.  */
 
 asmlinkage void
-do_sigreturn(struct sigcontext *sc, struct pt_regs *regs,
+do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
 	     struct switch_stack *sw)
 {
 	sigset_t set;
@@ -314,7 +315,7 @@
 }
 
 asmlinkage void
-do_rt_sigreturn(struct rt_sigframe *frame, struct pt_regs *regs,
+do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs,
 		struct switch_stack *sw)
 {
 	sigset_t set;
@@ -356,17 +357,17 @@
  * Set up a signal frame.
  */
 
-static inline void *
+static inline void __user *
 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
 	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
 		sp = current->sas_ss_sp + current->sas_ss_size;
 
-	return (void *)((sp - frame_size) & -32ul);
+	return (void __user *)((sp - frame_size) & -32ul);
 }
 
 static long
-setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, 
+setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, 
 		 struct switch_stack *sw, unsigned long mask, unsigned long sp)
 {
 	long i, err = 0;
@@ -426,7 +427,7 @@
 	    struct pt_regs *regs, struct switch_stack * sw)
 {
 	unsigned long oldsp, r26, err = 0;
-	struct sigframe *frame;
+	struct sigframe __user *frame;
 
 	oldsp = rdusp();
 	frame = get_sigframe(ka, oldsp, sizeof(*frame));
@@ -479,7 +480,7 @@
 	       sigset_t *set, struct pt_regs *regs, struct switch_stack * sw)
 {
 	unsigned long oldsp, r26, err = 0;
-	struct rt_sigframe *frame;
+	struct rt_sigframe __user *frame;
 
 	oldsp = rdusp();
 	frame = get_sigframe(ka, oldsp, sizeof(*frame));
diff -Nru a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
--- a/arch/alpha/kernel/smp.c	Tue Jun 15 22:20:38 2004
+++ b/arch/alpha/kernel/smp.c	Tue Jun 15 22:20:38 2004
@@ -779,7 +779,7 @@
 void
 smp_send_reschedule(int cpu)
 {
-#if DEBUG_IPI_MSG
+#ifdef DEBUG_IPI_MSG
 	if (cpu == hard_smp_processor_id())
 		printk(KERN_WARNING
 		       "smp_send_reschedule: Sending IPI to self.\n");
@@ -791,7 +791,7 @@
 smp_send_stop(void)
 {
 	unsigned long to_whom = cpu_present_mask & ~(1UL << smp_processor_id());
-#if DEBUG_IPI_MSG
+#ifdef DEBUG_IPI_MSG
 	if (hard_smp_processor_id() != boot_cpu_id)
 		printk(KERN_WARNING "smp_send_stop: Not on boot cpu.\n");
 #endif
@@ -820,6 +820,9 @@
 	unsigned long timeout;
 	int num_cpus_to_call;
 	
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data.func = func;
 	data.info = info;
 	data.wait = wait;
diff -Nru a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
--- a/arch/alpha/kernel/srm_env.c	Tue Jun 15 22:20:37 2004
+++ b/arch/alpha/kernel/srm_env.c	Tue Jun 15 22:20:37 2004
@@ -132,7 +132,7 @@
 
 
 static int
-srm_env_write(struct file *file, const char *buffer, unsigned long count,
+srm_env_write(struct file *file, const char __user *buffer, unsigned long count,
 		void *data)
 {
 	int res;
diff -Nru a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
--- a/arch/alpha/kernel/sys_eiger.c	Tue Jun 15 22:20:37 2004
+++ b/arch/alpha/kernel/sys_eiger.c	Tue Jun 15 22:20:37 2004
@@ -194,27 +194,20 @@
 	   case 0x0f: bridge_count = 4; break; /* 4 */
 	};
 
-	/*  Check first for the built-in bridges on hose 0. */
-	if (hose->index == 0
-	    && PCI_SLOT(dev->bus->self->devfn) > 20-bridge_count) {
-		slot = PCI_SLOT(dev->devfn);
-	} else {
+	slot = PCI_SLOT(dev->devfn);
+	while (dev->bus->self) {
+		/* Check for built-in bridges on hose 0. */
+		if (hose->index == 0
+		    && (PCI_SLOT(dev->bus->self->devfn)
+			> 20 - bridge_count)) {
+			slot = PCI_SLOT(dev->devfn);
+			break;
+		}
 		/* Must be a card-based bridge.  */
-		do {
-			/* Check for built-in bridges on hose 0. */
-			if (hose->index == 0
-			    && (PCI_SLOT(dev->bus->self->devfn)
-				> 20 - bridge_count)) {
-                  		slot = PCI_SLOT(dev->devfn);
-				break;
-			}
-			pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
+		pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
 
-			/* Move up the chain of bridges.  */
-			dev = dev->bus->self;
-			/* Slot of the next bridge.  */
-			slot = PCI_SLOT(dev->devfn);
-		} while (dev->bus->self);
+		/* Move up the chain of bridges.  */
+		dev = dev->bus->self;
 	}
 	*pinp = pin;
 	return slot;
diff -Nru a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c
--- a/arch/alpha/kernel/sys_ruffian.c	Tue Jun 15 22:20:41 2004
+++ b/arch/alpha/kernel/sys_ruffian.c	Tue Jun 15 22:20:41 2004
@@ -25,6 +25,7 @@
 #include <asm/pgtable.h>
 #include <asm/core_cia.h>
 #include <asm/tlbflush.h>
+#include <asm/8253pit.h>
 
 #include "proto.h"
 #include "irq_impl.h"
@@ -64,6 +65,8 @@
 	common_init_isa_dma();
 }
 
+#define RUFFIAN_LATCH	((PIT_TICK_RATE + HZ / 2) / HZ)
+
 static void __init
 ruffian_init_rtc(void)
 {
@@ -72,8 +75,8 @@
 
 	/* Setup interval timer.  */
 	outb(0x34, 0x43);		/* binary, mode 2, LSB/MSB, ch 0 */
-	outb(LATCH & 0xff, 0x40);	/* LSB */
-	outb(LATCH >> 8, 0x40);		/* MSB */
+	outb(RUFFIAN_LATCH & 0xff, 0x40);	/* LSB */
+	outb(RUFFIAN_LATCH >> 8, 0x40);		/* MSB */
 
 	outb(0xb6, 0x43);		/* pit counter 2: speaker */
 	outb(0x31, 0x42);
diff -Nru a/arch/alpha/kernel/sys_sx164.c b/arch/alpha/kernel/sys_sx164.c
--- a/arch/alpha/kernel/sys_sx164.c	Tue Jun 15 22:20:40 2004
+++ b/arch/alpha/kernel/sys_sx164.c	Tue Jun 15 22:20:40 2004
@@ -51,7 +51,7 @@
 	if (alpha_using_srm)
 		init_srm_irqs(40, 0x3f0000);
 	else
-		init_pyxis_irqs(0xff00003f0000);
+		init_pyxis_irqs(0xff00003f0000UL);
 
 	setup_irq(16+6, &timer_cascade_irqaction);
 }
diff -Nru a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c
--- a/arch/alpha/kernel/sys_takara.c	Tue Jun 15 22:20:37 2004
+++ b/arch/alpha/kernel/sys_takara.c	Tue Jun 15 22:20:37 2004
@@ -231,8 +231,12 @@
 	int slot = PCI_SLOT(dev->devfn);
 	int pin = *pinp;
 	unsigned int ctlreg = inl(0x500);
-	unsigned int busslot = PCI_SLOT(dev->bus->self->devfn);
+	unsigned int busslot;
 
+	if (!dev->bus->self)
+		return slot;
+
+	busslot = PCI_SLOT(dev->bus->self->devfn);
 	/* Check for built-in bridges.  */
 	if (dev->bus->number != 0
 	    && busslot > 16
diff -Nru a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
--- a/arch/alpha/kernel/systbls.S	Tue Jun 15 22:20:42 2004
+++ b/arch/alpha/kernel/systbls.S	Tue Jun 15 22:20:42 2004
@@ -389,7 +389,7 @@
 	.quad sys_getcwd
 	.quad sys_capget
 	.quad sys_capset
-	.quad sys_sendfile			/* 370 */
+	.quad sys_sendfile64			/* 370 */
 	.quad sys_setresgid
 	.quad sys_getresgid
 	.quad sys_ni_syscall			/* sys_dipc */
diff -Nru a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
--- a/arch/alpha/kernel/time.c	Tue Jun 15 22:20:40 2004
+++ b/arch/alpha/kernel/time.c	Tue Jun 15 22:20:40 2004
@@ -45,6 +45,7 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/hwrpb.h>
+#include <asm/8253pit.h>
 
 #include <linux/mc146818rtc.h>
 #include <linux/time.h>
@@ -254,12 +255,11 @@
  * arch/i386/time.c.
  */
 
-#define PIC_TICK_RATE	1193180UL
 #define CALIBRATE_LATCH	0xffff
 #define TIMEOUT_COUNT	0x100000
 
 static unsigned long __init
-calibrate_cc_with_pic(void)
+calibrate_cc_with_pit(void)
 {
 	int cc, count = 0;
 
@@ -287,7 +287,7 @@
 	if (count <= 1 || count == TIMEOUT_COUNT)
 		return 0;
 
-	return ((long)cc * PIC_TICK_RATE) / (CALIBRATE_LATCH + 1);
+	return ((long)cc * PIT_TICK_RATE) / (CALIBRATE_LATCH + 1);
 }
 
 /* The Linux interpretation of the CMOS clock register contents:
@@ -313,7 +313,7 @@
 
 	/* Calibrate CPU clock -- attempt #1.  */
 	if (!est_cycle_freq)
-		est_cycle_freq = validate_cc_value(calibrate_cc_with_pic());
+		est_cycle_freq = validate_cc_value(calibrate_cc_with_pit());
 
 	cc1 = rpcc_after_update_in_progress();
 
diff -Nru a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c
--- a/arch/alpha/lib/csum_partial_copy.c	Tue Jun 15 22:20:40 2004
+++ b/arch/alpha/lib/csum_partial_copy.c	Tue Jun 15 22:20:40 2004
@@ -99,7 +99,7 @@
  * Ok. This isn't fun, but this is the EASY case.
  */
 static inline unsigned long
-csum_partial_cfu_aligned(const unsigned long *src, unsigned long *dst,
+csum_partial_cfu_aligned(const unsigned long __user *src, unsigned long *dst,
 			 long len, unsigned long checksum,
 			 int *errp)
 {
@@ -139,7 +139,8 @@
  * easy.
  */
 static inline unsigned long
-csum_partial_cfu_dest_aligned(const unsigned long *src, unsigned long *dst,
+csum_partial_cfu_dest_aligned(const unsigned long __user *src,
+			      unsigned long *dst,
 			      unsigned long soff,
 			      long len, unsigned long checksum,
 			      int *errp)
@@ -327,7 +328,7 @@
 }
 
 static unsigned int
-do_csum_partial_copy_from_user(const char *src, char *dst, int len,
+do_csum_partial_copy_from_user(const char __user *src, char *dst, int len,
 			       unsigned int sum, int *errp)
 {
 	unsigned long checksum = (unsigned) sum;
@@ -338,12 +339,12 @@
 		if (!doff) {
 			if (!soff)
 				checksum = csum_partial_cfu_aligned(
-					(const unsigned long *) src,
+					(const unsigned long __user *) src,
 					(unsigned long *) dst,
 					len-8, checksum, errp);
 			else
 				checksum = csum_partial_cfu_dest_aligned(
-					(const unsigned long *) src,
+					(const unsigned long __user *) src,
 					(unsigned long *) dst,
 					soff, len-8, checksum, errp);
 		} else {
@@ -351,13 +352,13 @@
 			ldq_u(partial_dest, dst);
 			if (!soff)
 				checksum = csum_partial_cfu_src_aligned(
-					(const unsigned long *) src,
+					(const unsigned long __user *) src,
 					(unsigned long *) dst,
 					doff, len-8, checksum,
 					partial_dest, errp);
 			else
 				checksum = csum_partial_cfu_unaligned(
-					(const unsigned long *) src,
+					(const unsigned long __user *) src,
 					(unsigned long *) dst,
 					soff, doff, len-8, checksum,
 					partial_dest, errp);
@@ -368,7 +369,7 @@
 }
 
 unsigned int
-csum_partial_copy_from_user(const char *src, char *dst, int len,
+csum_partial_copy_from_user(const char __user *src, char *dst, int len,
 			    unsigned int sum, int *errp)
 {
 	if (!access_ok(src, len, VERIFY_READ)) {
diff -Nru a/arch/alpha/math-emu/Makefile b/arch/alpha/math-emu/Makefile
--- a/arch/alpha/math-emu/Makefile	Tue Jun 15 22:20:41 2004
+++ b/arch/alpha/math-emu/Makefile	Tue Jun 15 22:20:41 2004
@@ -4,4 +4,6 @@
 
 EXTRA_CFLAGS := -w
 
-obj-$(CONFIG_MATHEMU) += math.o qrnnd.o
+obj-$(CONFIG_MATHEMU) += math-emu.o
+
+math-emu-objs := math.o qrnnd.o
diff -Nru a/arch/alpha/math-emu/math.c b/arch/alpha/math-emu/math.c
--- a/arch/alpha/math-emu/math.c	Tue Jun 15 22:21:04 2004
+++ b/arch/alpha/math-emu/math.c	Tue Jun 15 22:21:04 2004
@@ -106,9 +106,7 @@
 	__u32 insn;
 	long si_code;
 
-	MOD_INC_USE_COUNT;
-
-	get_user(insn, (__u32*)pc);
+	get_user(insn, (__u32 __user *)pc);
 	fc     = (insn >>  0) & 0x1f;	/* destination register */
 	fb     = (insn >> 16) & 0x1f;
 	fa     = (insn >> 21) & 0x1f;
@@ -173,7 +171,7 @@
 					_FP_FRAC_SET_1(DB, _FP_ZEROFRAC_1);
 			}
 			FP_CMP_D(res, DA, DB, 3);
-			vc = 0x4000000000000000;
+			vc = 0x4000000000000000UL;
 			/* CMPTEQ, CMPTUN don't trap on QNaN,
 			   while CMPTLT and CMPTLE do */
 			if (res == 3
@@ -320,7 +318,6 @@
 			if (_fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV;
 		}
 
-		MOD_DEC_USE_COUNT;
 		return si_code;
 	}
 
@@ -328,13 +325,11 @@
 	   requires that the result *always* be written... so we do the write
 	   immediately after the operations above.  */
 
-	MOD_DEC_USE_COUNT;
 	return 0;
 
 bad_insn:
 	printk(KERN_ERR "alpha_fp_emul: Invalid FP insn %#x at %#lx\n",
 	       insn, pc);
-	MOD_DEC_USE_COUNT;
 	return -1;
 }
 
@@ -344,8 +339,6 @@
 	unsigned long trigger_pc = regs->pc - 4;
 	unsigned long insn, opcode, rc, si_code = 0;
 
-	MOD_INC_USE_COUNT;
-
 	/*
 	 * Turn off the bits corresponding to registers that are the
 	 * target of instructions that set bits in the exception
@@ -358,7 +351,7 @@
 	 * up to the first occurrence of such an instruction.
 	 */
 	while (write_mask) {
-		get_user(insn, (__u32*)(trigger_pc));
+		get_user(insn, (__u32 __user *)(trigger_pc));
 		opcode = insn >> 26;
 		rc = insn & 0x1f;
 
@@ -403,6 +396,5 @@
 	}
 
 egress:
-	MOD_DEC_USE_COUNT;
 	return si_code;
 }
diff -Nru a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
--- a/arch/alpha/mm/fault.c	Tue Jun 15 22:20:38 2004
+++ b/arch/alpha/mm/fault.c	Tue Jun 15 22:20:38 2004
@@ -40,7 +40,7 @@
 unsigned long last_asn = ASN_FIRST_VERSION;
 #endif
 
-extern void
+void
 __load_new_mm_context(struct mm_struct *next_mm)
 {
 	unsigned long mmc;
diff -Nru a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
--- a/arch/alpha/mm/init.c	Tue Jun 15 22:20:59 2004
+++ b/arch/alpha/mm/init.c	Tue Jun 15 22:20:59 2004
@@ -117,7 +117,7 @@
 		else if (!page_count(mem_map+i))
 			free++;
 		else
-			shared += atomic_read(&mem_map[i].count) - 1;
+			shared += page_count(mem_map + i) - 1;
 	}
 	printk("%ld pages of RAM\n",total);
 	printk("%ld free pages\n",free);
@@ -152,9 +152,9 @@
 
 	/* Set the vptb.  This is often done by the bootloader, but 
 	   shouldn't be required.  */
-	if (hwrpb->vptb != 0xfffffffe00000000) {
-		wrvptptr(0xfffffffe00000000);
-		hwrpb->vptb = 0xfffffffe00000000;
+	if (hwrpb->vptb != 0xfffffffe00000000UL) {
+		wrvptptr(0xfffffffe00000000UL);
+		hwrpb->vptb = 0xfffffffe00000000UL;
 		hwrpb_update_checksum(hwrpb);
 	}
 
@@ -301,8 +301,8 @@
 	/* Move the vptb back to where the SRM console expects it.  */
 	swapper_pg_dir[1] = swapper_pg_dir[1023];
 	tbia();
-	wrvptptr(0x200000000);
-	hwrpb->vptb = 0x200000000;
+	wrvptptr(0x200000000UL);
+	hwrpb->vptb = 0x200000000UL;
 	hwrpb_update_checksum(hwrpb);
 
 	/* Reload the page tables that the console had in use.  */
diff -Nru a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
--- a/arch/alpha/mm/numa.c	Tue Jun 15 22:20:36 2004
+++ b/arch/alpha/mm/numa.c	Tue Jun 15 22:20:36 2004
@@ -384,7 +384,7 @@
 			else if (!page_count(lmem_map+i))
 				free++;
 			else
-				shared += atomic_read(&lmem_map[i].count) - 1;
+				shared += page_count(lmem_map + i) - 1;
 		}
 	}
 	printk("%ld pages of RAM\n",total);
diff -Nru a/arch/arm/Kconfig b/arch/arm/Kconfig
--- a/arch/arm/Kconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/arm/Kconfig	Tue Jun 15 22:20:41 2004
@@ -84,9 +84,6 @@
 config ARCH_CO285
 	bool "Co-EBSA285"
 
-config ARCH_PXA
-	bool "PXA250/210-based"
-
 config ARCH_EBSA110
 	bool "EBSA-110"
 	help
@@ -111,6 +108,9 @@
 config ARCH_IOP3XX
 	bool "IOP3xx-based"
 
+config ARCH_IXP4XX
+	bool "IXP4xx-based"
+
 config ARCH_L7200
 	bool "LinkUp-L7200"
 	help
@@ -123,6 +123,9 @@
 	  If you have any questions or comments about the Linux kernel port
 	  to this board, send e-mail to sjhill@cotw.com.
 
+config ARCH_PXA
+	bool "PXA2xx-based"
+
 config ARCH_RPC
 	bool "RiscPC"
 	help
@@ -132,9 +135,6 @@
 config ARCH_SA1100
 	bool "SA1100-based"
 
-config ARCH_SHARK
-	bool "Shark"
-
 config ARCH_S3C2410
 	bool "Samsung S3C2410"
 	help
@@ -142,8 +142,8 @@
 	  BAST (http://www.simtec.co.uk/products/EB110ITX/), the IPAQ 1940 or
 	  the Samsung SMDK2410 development board (and derviatives).
 
-config ARCH_OMAP
-	bool "TI OMAP"
+config ARCH_SHARK
+	bool "Shark"
 
 config ARCH_LH7A40X
 	bool "Sharp LH7A40X"
@@ -153,6 +153,9 @@
 	  core with a wide array of integrated devices for
 	  hand-held and low-power applications.
 
+config ARCH_OMAP
+	bool "TI OMAP"
+
 config ARCH_VERSATILE_PB
 	bool "Versatile PB"
 	help
@@ -170,6 +173,8 @@
 
 source "arch/arm/mach-iop3xx/Kconfig"
 
+source "arch/arm/mach-ixp4xx/Kconfig"
+
 source "arch/arm/mach-pxa/Kconfig"
 
 source "arch/arm/mach-sa1100/Kconfig"
@@ -222,7 +227,7 @@
 
 config DMABOUNCE
 	bool
-	depends on SA1111
+	depends on SA1111 || ARCH_IXP4XX
 	default y
 
 source arch/arm/mm/Kconfig
@@ -252,7 +257,7 @@
 # Now handle the bus types
 config PCI
 	bool "PCI support" if ARCH_INTEGRATOR_AP
-	default y if ARCH_FTVPCI || ARCH_SHARK || FOOTBRIDGE_HOST || ARCH_IOP3XX
+	default y if ARCH_FTVPCI || ARCH_SHARK || FOOTBRIDGE_HOST || ARCH_IOP3XX || ARCH_IXP4XX
 	help
 	  Find out whether you have a PCI motherboard. PCI is the name of a
 	  bus system, i.e. the way the CPU talks to the other stuff inside
@@ -534,7 +539,7 @@
 
 config LEDS
 	bool "Timer and CPU usage LEDs"
-	depends on ARCH_NETWINDER || ARCH_EBSA110 || ARCH_EBSA285 || ARCH_FTVPCI || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_CDB89712 || ARCH_P720T || ARCH_OMAP || ARCH_VERSATILE_PB
+	depends on ARCH_NETWINDER || ARCH_EBSA110 || ARCH_EBSA285 || ARCH_FTVPCI || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_CDB89712 || ARCH_P720T || ARCH_OMAP || ARCH_VERSATILE_PB
 	help
 	  If you say Y here, the LEDs on your machine will be used
 	  to provide useful information about your current system status.
@@ -547,8 +552,8 @@
 	  system, but the driver will do nothing.
 
 config LEDS_TIMER
-	bool "Timer LED" if LEDS && (ARCH_NETWINDER || ARCH_EBSA285 || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_P720T || ARCH_VERSATILE_PB)
-	depends on ARCH_NETWINDER || ARCH_EBSA110 || ARCH_EBSA285 || ARCH_FTVPCI || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_CDB89712 || ARCH_P720T || ARCH_OMAP || ARCH_VERSATILE_PB
+	bool "Timer LED" if LEDS && (ARCH_NETWINDER || ARCH_EBSA285 || ARCH_SHARK || MACH_MAINSTONE || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_P720T || ARCH_VERSATILE_PB)
+	depends on ARCH_NETWINDER || ARCH_EBSA110 || ARCH_EBSA285 || ARCH_FTVPCI || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_CDB89712 || ARCH_P720T || ARCH_OMAP || ARCH_VERSATILE_PB
 	default y if ARCH_EBSA110
 	help
 	  If you say Y here, one of the system LEDs (the green one on the
@@ -563,7 +568,7 @@
 
 config LEDS_CPU
 	bool "CPU usage LED"
-	depends on LEDS && (ARCH_NETWINDER || ARCH_EBSA285 || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_P720T || ARCH_VERSATILE_PB)
+	depends on LEDS && (ARCH_NETWINDER || ARCH_EBSA285 || ARCH_SHARK || ARCH_CO285 || ARCH_SA1100 || ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_PXA_IDP || ARCH_INTEGRATOR || ARCH_P720T || ARCH_VERSATILE_PB)
 	help
 	  If you say Y here, the red LED will be used to give a good real
 	  time indication of CPU usage, by lighting whenever the idle task
@@ -576,7 +581,7 @@
 config ALIGNMENT_TRAP
 	bool
 	depends on CPU_32
-	default y
+	default y if !ARCH_EBSA110
 	help
 	  ARM processors can not fetch/store information which is not
 	  naturally aligned on the bus, i.e., a 4 byte fetch must start at an
@@ -604,7 +609,9 @@
 
 source "net/Kconfig"
 
+if ARCH_CLPS7500 || ARCH_IOP3XX || ARCH_IXP4XX || ARCH_L7200 || ARCH_LH7A40X || ARCH_FTVPCI || ARCH_PXA || ARCH_RPC || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE
 source "drivers/ide/Kconfig"
+endif
 
 source "drivers/scsi/Kconfig"
 
@@ -791,8 +798,8 @@
 	  before it is used.
 
 config DEBUG_S3C2410_UART
-	int
 	depends on DEBUG_LL && ARCH_S3C2410
+	int "S3C2410 UART to use for low-level debug"
 	default "0"
 	help
 	  Choice for UART for kernel low-level using S3C2410 UARTS,
diff -Nru a/arch/arm/Makefile b/arch/arm/Makefile
--- a/arch/arm/Makefile	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/Makefile	Tue Jun 15 22:20:39 2004
@@ -92,6 +92,7 @@
 textaddr-$(CONFIG_ARCH_FORTUNET)   := 0xc0008000
  machine-$(CONFIG_ARCH_IOP3XX)	   := iop3xx
  machine-$(CONFIG_ARCH_ADIFCC)	   := adifcc
+ machine-$(CONFIG_ARCH_IXP4XX)	   := ixp4xx
  machine-$(CONFIG_ARCH_OMAP)	   := omap
  machine-$(CONFIG_ARCH_S3C2410)	   := s3c2410
  machine-$(CONFIG_ARCH_LH7A40X)	   := lh7a40x
diff -Nru a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
--- a/arch/arm/boot/Makefile	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/boot/Makefile	Tue Jun 15 22:20:37 2004
@@ -51,6 +51,8 @@
 params_phys-$(CONFIG_ARCH_IOP3XX)	:= 0xa0000100
    zreladdr-$(CONFIG_ARCH_ADIFCC)	:= 0xc0008000
 params_phys-$(CONFIG_ARCH_ADIFCC)	:= 0xc0000100
+   zreladdr-$(CONFIG_ARCH_IXP4XX)	:= 0x00008000
+params-phys-$(CONFIG_ARCH_IXP4XX)	:= 0x00000100
    zreladdr-$(CONFIG_ARCH_OMAP)		:= 0x10008000
 params_phys-$(CONFIG_ARCH_OMAP)		:= 0x10000100
 initrd_phys-$(CONFIG_ARCH_OMAP)		:= 0x10800000
diff -Nru a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
--- a/arch/arm/boot/compressed/head.S	Tue Jun 15 22:20:58 2004
+++ b/arch/arm/boot/compressed/head.S	Tue Jun 15 22:20:58 2004
@@ -73,6 +73,12 @@
 		.macro	writeb, rb
 		str	\rb, [r3, #0x14]	@ UTDR
 		.endm
+#elif defined(CONFIG_ARCH_IXP4XX)
+		.macro	loadsp, rb
+		mov	\rb, #0xc8000000
+		.endm
+		.macro	writeb, rb
+		str	\rb, [r3, #0]
 #elif defined(CONFIG_ARCH_LH7A40X)
 		.macro	loadsp, rb
 		ldr	\rb, =0x80000700	@ UART2 UARTBASE
@@ -80,6 +86,20 @@
 		.macro	writeb, rb
 		strb	\rb, [r3, #0]
 		.endm
+#elif defined(CONFIG_ARCH_OMAP)
+		.macro  loadsp, rb
+		mov	\rb, #0xff000000	@ physical base address
+		add	\rb, \rb, #0x00fb0000
+#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3)
+		add	\rb, \rb, #0x00000800
+#endif
+#ifdef CONFIG_OMAP_LL_DEBUG_UART3
+		add	\rb, \rb, #0x00009000
+#endif
+		.endm
+		.macro	writeb, rb
+		strb	\rb, [r3]
+		.endm
 #else
 #error no serial architecture defined
 #endif
@@ -176,7 +196,7 @@
 		ldmia	r0, {r1, r2, r3, r4, r5, r6, ip, sp}
 		subs	r0, r0, r1		@ calculate the delta offset
 
-						@ if delta is zero, we're
+						@ if delta is zero, we are
 		beq	not_relocated		@ running at the address we
 						@ were linked at.
 
diff -Nru a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
--- a/arch/arm/common/dmabounce.c	Tue Jun 15 22:20:35 2004
+++ b/arch/arm/common/dmabounce.c	Tue Jun 15 22:20:35 2004
@@ -100,6 +100,7 @@
 		if (d->dev == dev)
 			return d;
 	}
+	return NULL;
 }
 
 
@@ -185,7 +186,7 @@
 static inline void
 free_safe_buffer(struct dmabounce_device_info *device_info, struct safe_buffer *buf)
 {
-	dev_dbg(dev_info->dev, "%s(buf=%p)\n", __func__, buf);
+	dev_dbg(device_info->dev, "%s(buf=%p)\n", __func__, buf);
 
 	list_del(&buf->node);
 
diff -Nru a/arch/arm/configs/ebsa110_defconfig b/arch/arm/configs/ebsa110_defconfig
--- a/arch/arm/configs/ebsa110_defconfig	Tue Jun 15 22:20:36 2004
+++ b/arch/arm/configs/ebsa110_defconfig	Tue Jun 15 22:20:36 2004
@@ -2,137 +2,120 @@
 # Automatically generated make config: don't edit
 #
 CONFIG_ARM=y
-# CONFIG_EISA is not set
-# CONFIG_SBUS is not set
-# CONFIG_MCA is not set
+CONFIG_MMU=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
-# CONFIG_OBSOLETE is not set
+CONFIG_CLEAN_COMPILE=y
+CONFIG_STANDALONE=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
+CONFIG_BSD_PROCESS_ACCT=y
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_HOTPLUG=y
+# CONFIG_IKCONFIG is not set
+CONFIG_EMBEDDED=y
+CONFIG_KALLSYMS=y
+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=y
 
 #
 # Loadable module support
 #
 CONFIG_MODULES=y
+# CONFIG_MODULE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
 CONFIG_KMOD=y
 
 #
 # System Type
 #
-# CONFIG_ARCH_ARCA5K is not set
+# CONFIG_ARCH_ADIFCC is not set
 # CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
 CONFIG_ARCH_EBSA110=y
-# CONFIG_ARCH_L7200 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_L7200 is not set
+# CONFIG_ARCH_PXA is not set
 # CONFIG_ARCH_RPC is not set
 # CONFIG_ARCH_SA1100 is not set
-# CONFIG_ARCH_CLPS711X 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_PB is not set
 
 #
-# Archimedes/A5000 Implementations
-#
-
-#
-# Archimedes/A5000 Implementations (select only ONE)
-#
-# CONFIG_ARCH_ARC is not set
-# CONFIG_ARCH_A5K is not set
-
-#
-# Footbridge Implementations
-#
-# CONFIG_ARCH_CATS is not set
-# CONFIG_ARCH_PERSONAL_SERVER is not set
-# CONFIG_ARCH_EBSA285_ADDIN is not set
-# CONFIG_ARCH_EBSA285_HOST is not set
-# CONFIG_ARCH_NETWINDER is not set
-
-#
-# SA11x0 Implementations
-#
-# CONFIG_SA1100_ASSABET is not set
-# CONFIG_ASSABET_NEPONSET is not set
-# CONFIG_SA1100_BRUTUS is not set
-# CONFIG_SA1100_CERF is not set
-# CONFIG_SA1100_BITSY is not set
-# CONFIG_SA1100_EXTENEX1 is not set
-# CONFIG_SA1100_FREEBIRD is not set
-# CONFIG_SA1100_GRAPHICSCLIENT is not set
-# CONFIG_SA1100_JORNADA720 is not set
-# CONFIG_SA1100_HUW_WEBPANEL is not set
-# CONFIG_SA1100_ITSY is not set
-# CONFIG_SA1100_LART is not set
-# CONFIG_SA1100_NANOENGINE is not set
-# CONFIG_SA1100_OMNIMETER is not set
-# CONFIG_SA1100_PANGOLIN is not set
-# CONFIG_SA1100_PLEB is not set
-# CONFIG_SA1100_SHERMAN is not set
-# CONFIG_SA1100_PFS168 is not set
-# CONFIG_SA1100_VICTOR is not set
-# CONFIG_SA1100_XP860 is not set
-# CONFIG_SA1100_YOPY is not set
-
-#
-# CLPS711X/EP721X Implementations
+# Processor Type
 #
-# CONFIG_ARCH_P720T is not set
-# CONFIG_ARCH_ACORN is not set
-# CONFIG_FOOTBRIDGE is not set
-# CONFIG_FOOTBRIDGE_HOST is not set
-# CONFIG_FOOTBRIDGE_ADDIN is not set
 CONFIG_CPU_32=y
-# CONFIG_CPU_26 is not set
+CONFIG_CPU_SA110=y
+CONFIG_CPU_32v4=y
+CONFIG_CPU_ABRT_EV4=y
+CONFIG_CPU_CACHE_V4WB=y
+CONFIG_CPU_COPY_V4WB=y
+CONFIG_CPU_TLB_V4WB=y
 
 #
-# Processor Type
+# Processor Features
 #
-# CONFIG_CPU_32v3 is not set
-CONFIG_CPU_32v4=y
-# CONFIG_CPU_ARM610 is not set
-# CONFIG_CPU_ARM710 is not set
-# CONFIG_CPU_ARM720T is not set
-# CONFIG_CPU_ARM920T is not set
-# CONFIG_CPU_ARM1020 is not set
-CONFIG_CPU_SA110=y
-# CONFIG_CPU_SA1100 is not set
-# CONFIG_DISCONTIGMEM is not set
 
 #
 # General setup
 #
-# CONFIG_PCI is not set
 CONFIG_ISA=y
-# CONFIG_ISA_DMA is not set
-CONFIG_HOTPLUG=y
+# CONFIG_ZBOOT_ROM is not set
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
 
 #
 # PCMCIA/CardBus support
 #
 CONFIG_PCMCIA=m
-CONFIG_I82365=y
+# CONFIG_PCMCIA_DEBUG is not set
+CONFIG_I82365=m
 # CONFIG_TCIC is not set
-# CONFIG_PCMCIA_CLPS6700 is not set
-# CONFIG_PCMCIA_SA1100 is not set
-CONFIG_NET=y
-CONFIG_SYSVIPC=y
-CONFIG_BSD_PROCESS_ACCT=y
-CONFIG_SYSCTL=y
+CONFIG_PCMCIA_PROBE=y
+
+#
+# At least one math emulation must be selected
+#
 CONFIG_FPE_NWFPE=y
+# CONFIG_FPE_NWFPE_XP is not set
 CONFIG_FPE_FASTFPE=y
-CONFIG_KCORE_ELF=y
-# CONFIG_KCORE_AOUT is not set
-CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_AOUT=y
 # CONFIG_BINFMT_MISC is not set
+
+#
+# Generic Driver Options
+#
+# CONFIG_FW_LOADER is not set
 # CONFIG_PM is not set
+# CONFIG_PREEMPT is not set
 # CONFIG_ARTHUR is not set
 CONFIG_CMDLINE="root=/dev/nfs rw mem=16M console=ttyS1,38400n8"
 CONFIG_LEDS=y
@@ -143,22 +126,18 @@
 #
 CONFIG_PARPORT=y
 CONFIG_PARPORT_PC=y
+CONFIG_PARPORT_PC_CML1=y
 CONFIG_PARPORT_PC_FIFO=y
 # CONFIG_PARPORT_PC_SUPERIO is not set
 # CONFIG_PARPORT_PC_PCMCIA is not set
 # CONFIG_PARPORT_ARC is not set
-# CONFIG_PARPORT_AMIGA is not set
-# CONFIG_PARPORT_MFC3 is not set
-# CONFIG_PARPORT_ATARI is not set
-# CONFIG_PARPORT_SUNBPP is not set
 # CONFIG_PARPORT_OTHER is not set
 CONFIG_PARPORT_1284=y
 
 #
-# Plug and Play configuration
+# Plug and Play support
 #
 # CONFIG_PNP is not set
-# CONFIG_ISAPNP is not set
 
 #
 # Block devices
@@ -166,9 +145,6 @@
 # CONFIG_BLK_DEV_FD is not set
 # CONFIG_BLK_DEV_XD is not set
 # CONFIG_PARIDE is not set
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
@@ -179,37 +155,29 @@
 # Multi-device support (RAID and LVM)
 #
 # 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_BLK_DEV_LVM is not set
+
+#
+# Networking support
+#
+CONFIG_NET=y
 
 #
 # Networking options
 #
 CONFIG_PACKET=y
 CONFIG_PACKET_MMAP=y
-CONFIG_NETLINK=y
-CONFIG_RTNETLINK=y
 # CONFIG_NETLINK_DEV is not set
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-# CONFIG_FILTER is not set
 CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_RTNETLINK=y
-CONFIG_NETLINK=y
 CONFIG_IP_MULTIPLE_TABLES=y
 CONFIG_IP_ROUTE_FWMARK=y
 CONFIG_IP_ROUTE_NAT=y
 # CONFIG_IP_ROUTE_MULTIPATH is not set
 # CONFIG_IP_ROUTE_TOS is not set
 CONFIG_IP_ROUTE_VERBOSE=y
-# CONFIG_IP_ROUTE_LARGE_TABLES is not set
 CONFIG_IP_PNP=y
 # CONFIG_IP_PNP_DHCP is not set
 CONFIG_IP_PNP_BOOTP=y
@@ -218,64 +186,113 @@
 # 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 is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+
+#
+# IP: Virtual Server Configuration
+#
+# CONFIG_IP_VS is not set
+CONFIG_IPV6=y
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
+# CONFIG_IPV6_TUNNEL is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
 
 #
-#   IP: Netfilter Configuration
+# IP: Netfilter Configuration
 #
 CONFIG_IP_NF_CONNTRACK=y
 CONFIG_IP_NF_FTP=y
 CONFIG_IP_NF_IRC=y
+# CONFIG_IP_NF_TFTP is not set
+# CONFIG_IP_NF_AMANDA is not set
 # CONFIG_IP_NF_QUEUE is not set
 CONFIG_IP_NF_IPTABLES=y
 CONFIG_IP_NF_MATCH_LIMIT=y
-# CONFIG_IP_NF_MATCH_MAC is not set
+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_TCPMSS is not set
+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_UNCLEAN=y
+CONFIG_IP_NF_MATCH_CONNTRACK=y
 # CONFIG_IP_NF_MATCH_OWNER is not set
 CONFIG_IP_NF_FILTER=y
 CONFIG_IP_NF_TARGET_REJECT=y
-# CONFIG_IP_NF_TARGET_MIRROR is not set
 CONFIG_IP_NF_NAT=y
 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_LOCAL is not set
+# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
 CONFIG_IP_NF_NAT_IRC=y
 CONFIG_IP_NF_NAT_FTP=y
 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_TARGET_LOG=y
-# CONFIG_IP_NF_TARGET_TCPMSS is not set
-CONFIG_IPV6=y
+# CONFIG_IP_NF_TARGET_ULOG is not set
+CONFIG_IP_NF_TARGET_TCPMSS=y
+# CONFIG_IP_NF_ARPTABLES is not set
+# CONFIG_IP_NF_RAW is not set
 
 #
-#   IPv6: Netfilter Configuration
+# IPv6: Netfilter Configuration
 #
+# CONFIG_IP6_NF_QUEUE is not set
 CONFIG_IP6_NF_IPTABLES=y
 CONFIG_IP6_NF_MATCH_LIMIT=y
+CONFIG_IP6_NF_MATCH_MAC=y
+CONFIG_IP6_NF_MATCH_RT=y
+CONFIG_IP6_NF_MATCH_OPTS=y
+CONFIG_IP6_NF_MATCH_FRAG=y
+CONFIG_IP6_NF_MATCH_HL=y
+CONFIG_IP6_NF_MATCH_MULTIPORT=y
+# CONFIG_IP6_NF_MATCH_OWNER is not set
 CONFIG_IP6_NF_MATCH_MARK=y
+# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set
+CONFIG_IP6_NF_MATCH_AHESP=y
+CONFIG_IP6_NF_MATCH_LENGTH=y
+# CONFIG_IP6_NF_MATCH_EUI64 is not set
 CONFIG_IP6_NF_FILTER=y
+# CONFIG_IP6_NF_TARGET_LOG is not set
 CONFIG_IP6_NF_MANGLE=y
 CONFIG_IP6_NF_TARGET_MARK=y
-# CONFIG_KHTTPD is not set
-# CONFIG_ATM is not set
+# CONFIG_IP6_NF_RAW is not set
 
 #
-#  
+# SCTP Configuration (EXPERIMENTAL)
 #
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
-# CONFIG_LLC is not set
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
@@ -288,25 +305,30 @@
 # CONFIG_NET_SCHED is not set
 
 #
-# Network device support
+# Network testing
 #
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+# 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
-# CONFIG_ETHERTAP is not set
-# CONFIG_NET_SB1000 is not set
 
 #
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
+# CONFIG_MII is not set
 CONFIG_ARM_AM79C961A=y
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_LANCE is not set
@@ -322,40 +344,20 @@
 #
 # Ethernet (1000 Mbit)
 #
-# CONFIG_ACENIC is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PLIP is not set
-CONFIG_PPP=m
-# CONFIG_PPP_MULTILINK is not set
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-# CONFIG_PPPOE is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Ethernet (10000 Mbit)
 #
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -368,39 +370,42 @@
 # CONFIG_PCMCIA_NMCLAN is not set
 # CONFIG_PCMCIA_SMC91C92 is not set
 # CONFIG_PCMCIA_XIRC2PS is not set
-# CONFIG_ARCNET_COM20020_CS is not set
-# CONFIG_PCMCIA_IBMTR is not set
-# CONFIG_NET_PCMCIA_RADIO is not set
+# CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
+# Wan interfaces
 #
-# CONFIG_HAMRADIO is not set
+# CONFIG_WAN 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 is not set
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+# CONFIG_PPPOE is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
-# IrDA (infrared) support
+# SCSI device support
 #
-# CONFIG_IRDA is not set
+# CONFIG_SCSI is not set
 
 #
-# ATA/IDE/MFM/RLL support
+# Fusion MPT device support
 #
-# CONFIG_IDE is not set
-# CONFIG_BLK_DEV_HD is not set
 
 #
-# SCSI support
+# IEEE 1394 (FireWire) support
 #
-# CONFIG_SCSI is not set
+# CONFIG_IEEE1394 is not set
 
 #
 # I2O device support
 #
-# CONFIG_I2O is not set
-# CONFIG_I2O_BLOCK is not set
-# CONFIG_I2O_LAN is not set
-# CONFIG_I2O_SCSI is not set
-# CONFIG_I2O_PROC is not set
 
 #
 # ISDN subsystem
@@ -408,76 +413,80 @@
 # CONFIG_ISDN is not set
 
 #
-# Input core support
+# Input device support
 #
 # CONFIG_INPUT is not set
 
 #
-# Character devices
+# Userland interfaces
 #
-# CONFIG_VT is not set
-CONFIG_SERIAL=y
-CONFIG_SERIAL_CONSOLE=y
-CONFIG_SERIAL_EXTENDED=y
-# CONFIG_SERIAL_MANY_PORTS is not set
-# CONFIG_SERIAL_SHARE_IRQ is not set
-# CONFIG_SERIAL_DETECT_IRQ is not set
-# CONFIG_SERIAL_MULTIPORT is not set
-# CONFIG_HUB6 is not set
-# CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_SERIAL_21285 is not set
-# CONFIG_SERIAL_21285_OLD is not set
-# CONFIG_SERIAL_21285_CONSOLE is not set
-# CONFIG_SERIAL_SA1100 is not set
-# CONFIG_SERIAL_SA1100_CONSOLE is not set
-# CONFIG_SERIAL_AMBA is not set
-# CONFIG_SERIAL_AMBA_CONSOLE is not set
-# CONFIG_SERIAL_CLPS711X is not set
-# CONFIG_SERIAL_CLPS711X_CONSOLE is not set
-CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-CONFIG_PRINTER=m
-# CONFIG_LP_CONSOLE is not set
-# CONFIG_PPDEV is not set
 
 #
-# I2C support
+# Input I/O drivers
 #
-# CONFIG_I2C is not set
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+# CONFIG_SERIO is not set
+# CONFIG_SERIO_I8042 is not set
 
 #
-# Mice
+# Input Device Drivers
 #
-# CONFIG_BUSMOUSE is not set
-# CONFIG_MOUSE is not set
 
 #
-# Joysticks
+# Character devices
 #
-# CONFIG_JOYSTICK is not set
+# CONFIG_VT is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
 
 #
-# Input core support is needed for joysticks
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_CS=m
+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
+CONFIG_PRINTER=m
+# CONFIG_LP_CONSOLE is not set
+# CONFIG_PPDEV is not set
+# CONFIG_TIPAR is not set
 # 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=y
-# CONFIG_WDT is not set
-# CONFIG_WDTPCI is not set
+
+#
+# ISA-based Watchdog Cards
+#
 # CONFIG_PCWATCHDOG is not set
-# CONFIG_ACQUIRE_WDT is not set
-# CONFIG_ADVANTECH_WDT is not set
-# CONFIG_60XX_WDT is not set
 # CONFIG_MIXCOMWD is not set
-# CONFIG_MACHZ_WDT is not set
-# CONFIG_INTEL_RNG is not set
+# CONFIG_WDT is not set
 # CONFIG_NVRAM is not set
 # CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
@@ -492,7 +501,13 @@
 #
 # PCMCIA character devices
 #
-# CONFIG_PCMCIA_SERIAL_CS is not set
+# CONFIG_SYNCLINK_CS is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+# CONFIG_I2C is not set
 
 #
 # Multimedia devices
@@ -500,73 +515,83 @@
 # CONFIG_VIDEO_DEV is not set
 
 #
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
 # File systems
 #
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+CONFIG_MINIX_FS=y
+# CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
 # CONFIG_AUTOFS_FS is not set
 CONFIG_AUTOFS4_FS=y
-# CONFIG_REISERFS_FS is not set
-# CONFIG_REISERFS_CHECK 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_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_ADFS_FS_RW is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
-# CONFIG_FAT_FS is not set
-# CONFIG_MSDOS_FS is not set
-# CONFIG_UMSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
-# CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
-# CONFIG_TMPFS is not set
-# CONFIG_RAMFS is not set
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JOLIET is not set
-CONFIG_MINIX_FS=y
 # CONFIG_VXFS_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_NTFS_DEBUG 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=y
 # CONFIG_QNX4FS_FS is not set
-# CONFIG_QNX4FS_RW is not set
-# CONFIG_ROMFS_FS is not set
-# CONFIG_EXT2_FS is not set
 # CONFIG_SYSV_FS is not set
-# CONFIG_SYSV_FS_WRITE is not set
-# CONFIG_UDF_FS is not set
-# CONFIG_UDF_RW is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_UFS_FS_WRITE is not set
 
 #
 # Network File Systems
 #
-# CONFIG_CODA_FS is not set
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
-CONFIG_ROOT_NFS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
 # CONFIG_NFSD is not set
-# CONFIG_NFSD_V3 is not set
-CONFIG_SUNRPC=y
+CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
+# CONFIG_EXPORTFS is not set
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
-# CONFIG_NCPFS_PACKET_SIGNING is not set
-# CONFIG_NCPFS_IOCTL_LOCKING is not set
-# CONFIG_NCPFS_STRONG is not set
-# CONFIG_NCPFS_NFS_NS is not set
-# CONFIG_NCPFS_OS2_NS is not set
-# CONFIG_NCPFS_SMALLDOS is not set
-# CONFIG_NCPFS_NLS is not set
-# CONFIG_NCPFS_EXTRAS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
 
 #
 # Partition Types
@@ -578,26 +603,68 @@
 # 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_NEC98_PARTITION is not set
 # CONFIG_SGI_PARTITION is not set
 # CONFIG_ULTRIX_PARTITION is not set
 # CONFIG_SUN_PARTITION is not set
-# CONFIG_SMB_NLS is not set
+# CONFIG_EFI_PARTITION is not set
+
+#
+# Native Language Support
+#
 # CONFIG_NLS is not set
 
 #
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# Misc devices
+#
+
+#
 # USB support
 #
-# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
 
 #
 # Kernel hacking
 #
 CONFIG_FRAME_POINTER=y
-CONFIG_DEBUG_ERRORS=y
 # CONFIG_DEBUG_USER is not set
 # CONFIG_DEBUG_INFO is not set
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_NO_PGT_CACHE is not set
-# CONFIG_DEBUG_LL is not set
-# CONFIG_DEBUG_DC21285_PORT is not set
-# CONFIG_DEBUG_CLPS711X_UART2 is not set
+# CONFIG_DEBUG_KERNEL is not set
+
+#
+# Security options
+#
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
diff -Nru a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/configs/ixp4xx_defconfig	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1081 @@
+#
+# Automatically generated make config: don't edit
+#
+CONFIG_ARM=y
+CONFIG_MMU=y
+CONFIG_UID16=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+
+#
+# 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=y
+# CONFIG_POSIX_MQUEUE is not set
+CONFIG_BSD_PROCESS_ACCT=y
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_EMBEDDED=y
+CONFIG_KALLSYMS=y
+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=y
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+# CONFIG_MODULE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+CONFIG_MODVERSIONS=y
+CONFIG_KMOD=y
+
+#
+# System Type
+#
+# CONFIG_ARCH_ADIFCC is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_PXA 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=y
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_VERSATILE_PB is not set
+
+#
+# CLPS711X/EP721X Implementations
+#
+
+#
+# Epxa10db
+#
+
+#
+# Footbridge Implementations
+#
+
+#
+# IOP3xx Implementation Options
+#
+# CONFIG_ARCH_IOP310 is not set
+# CONFIG_ARCH_IOP321 is not set
+
+#
+# IOP3xx Chipset Features
+#
+CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
+
+#
+# Intel IXP4xx Implementation Options
+#
+
+#
+# IXP4xx Platforms
+#
+CONFIG_ARCH_IXDP425=y
+CONFIG_ARCH_IXCDP1100=y
+CONFIG_ARCH_PRPMC1100=y
+CONFIG_ARCH_ADI_COYOTE=y
+# CONFIG_ARCH_AVILA is not set
+CONFIG_ARCH_IXDP4XX=y
+
+#
+# IXP4xx Options
+#
+# CONFIG_IXP4XX_INDIRECT_PCI is not set
+
+#
+# Intel PXA250/210 Implementations
+#
+
+#
+# SA11x0 Implementations
+#
+
+#
+# TI OMAP Implementations
+#
+
+#
+# OMAP Core Type
+#
+
+#
+# OMAP Board Type
+#
+
+#
+# OMAP Feature Selections
+#
+
+#
+# S3C2410 Implementations
+#
+
+#
+# LH7A40X Implementations
+#
+CONFIG_DMABOUNCE=y
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_MINICACHE=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_THUMB is not set
+CONFIG_CPU_BIG_ENDIAN=y
+CONFIG_XSCALE_PMU=y
+
+#
+# General setup
+#
+CONFIG_PCI=y
+# CONFIG_ZBOOT_ROM is not set
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_PCI_LEGACY_PROC=y
+CONFIG_PCI_NAMES=y
+
+#
+# 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_DEBUG_DRIVER is not set
+CONFIG_PM=y
+# CONFIG_PREEMPT is not set
+CONFIG_APM=y
+# CONFIG_ARTHUR is not set
+CONFIG_CMDLINE="console=ttyS0,115200 ip=bootp root=/dev/nfs"
+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=y
+# 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 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_OBSOLETE_CHIPS is not set
+
+#
+# Mapping drivers for chip access
+#
+CONFIG_MTD_COMPLEX_MAPPINGS=y
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+CONFIG_MTD_IXP4XX=y
+# CONFIG_MTD_EDB7312 is not set
+# CONFIG_MTD_PCI is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+CONFIG_MTD_NAND=m
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+CONFIG_MTD_NAND_IDS=m
+
+#
+# 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_CARMEL is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_SIZE=8192
+CONFIG_BLK_DEV_INITRD=y
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=m
+CONFIG_PACKET_MMAP=y
+CONFIG_NETLINK_DEV=m
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_IP_MULTIPLE_TABLES=y
+CONFIG_IP_ROUTE_FWMARK=y
+CONFIG_IP_ROUTE_NAT=y
+CONFIG_IP_ROUTE_MULTIPATH=y
+CONFIG_IP_ROUTE_TOS=y
+CONFIG_IP_ROUTE_VERBOSE=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+# CONFIG_IP_PNP_RARP is not set
+CONFIG_NET_IPIP=m
+CONFIG_NET_IPGRE=m
+CONFIG_NET_IPGRE_BROADCAST=y
+CONFIG_IP_MROUTE=y
+CONFIG_IP_PIMSM_V1=y
+CONFIG_IP_PIMSM_V2=y
+# 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
+
+#
+# IP: Virtual Server Configuration
+#
+CONFIG_IP_VS=m
+CONFIG_IP_VS_DEBUG=y
+CONFIG_IP_VS_TAB_BITS=12
+
+#
+# IPVS transport protocol load balancing support
+#
+# CONFIG_IP_VS_PROTO_TCP is not set
+# CONFIG_IP_VS_PROTO_UDP is not set
+# CONFIG_IP_VS_PROTO_ESP is not set
+# CONFIG_IP_VS_PROTO_AH is not set
+
+#
+# IPVS scheduler
+#
+CONFIG_IP_VS_RR=m
+CONFIG_IP_VS_WRR=m
+CONFIG_IP_VS_LC=m
+CONFIG_IP_VS_WLC=m
+CONFIG_IP_VS_LBLC=m
+CONFIG_IP_VS_LBLCR=m
+CONFIG_IP_VS_DH=m
+CONFIG_IP_VS_SH=m
+# CONFIG_IP_VS_SED is not set
+# CONFIG_IP_VS_NQ is not set
+
+#
+# IPVS application helper
+#
+# CONFIG_IPV6 is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+CONFIG_BRIDGE_NETFILTER=y
+
+#
+# IP: Netfilter Configuration
+#
+CONFIG_IP_NF_CONNTRACK=m
+CONFIG_IP_NF_FTP=m
+CONFIG_IP_NF_IRC=m
+# CONFIG_IP_NF_TFTP is not set
+# CONFIG_IP_NF_AMANDA is not set
+CONFIG_IP_NF_QUEUE=m
+CONFIG_IP_NF_IPTABLES=m
+CONFIG_IP_NF_MATCH_LIMIT=m
+# CONFIG_IP_NF_MATCH_IPRANGE is not set
+CONFIG_IP_NF_MATCH_MAC=m
+# CONFIG_IP_NF_MATCH_PKTTYPE is not set
+CONFIG_IP_NF_MATCH_MARK=m
+CONFIG_IP_NF_MATCH_MULTIPORT=m
+CONFIG_IP_NF_MATCH_TOS=m
+# CONFIG_IP_NF_MATCH_RECENT is not set
+# CONFIG_IP_NF_MATCH_ECN is not set
+# CONFIG_IP_NF_MATCH_DSCP is not set
+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 is not set
+CONFIG_IP_NF_MATCH_STATE=m
+# CONFIG_IP_NF_MATCH_CONNTRACK is not set
+CONFIG_IP_NF_MATCH_OWNER=m
+# CONFIG_IP_NF_MATCH_PHYSDEV is not set
+CONFIG_IP_NF_FILTER=m
+CONFIG_IP_NF_TARGET_REJECT=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 is not set
+# CONFIG_IP_NF_TARGET_SAME is not set
+CONFIG_IP_NF_NAT_LOCAL=y
+CONFIG_IP_NF_NAT_SNMP_BASIC=m
+CONFIG_IP_NF_NAT_IRC=m
+CONFIG_IP_NF_NAT_FTP=m
+CONFIG_IP_NF_MANGLE=m
+CONFIG_IP_NF_TARGET_TOS=m
+# CONFIG_IP_NF_TARGET_ECN is not set
+# CONFIG_IP_NF_TARGET_DSCP is not set
+CONFIG_IP_NF_TARGET_MARK=m
+# CONFIG_IP_NF_TARGET_CLASSIFY is not set
+CONFIG_IP_NF_TARGET_LOG=m
+CONFIG_IP_NF_TARGET_ULOG=m
+CONFIG_IP_NF_TARGET_TCPMSS=m
+CONFIG_IP_NF_ARPTABLES=m
+CONFIG_IP_NF_ARPFILTER=m
+# CONFIG_IP_NF_ARP_MANGLE is not set
+CONFIG_IP_NF_COMPAT_IPCHAINS=m
+CONFIG_IP_NF_COMPAT_IPFWADM=m
+# CONFIG_IP_NF_RAW is not set
+
+#
+# Bridge: Netfilter Configuration
+#
+# CONFIG_BRIDGE_NF_EBTABLES is not set
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+CONFIG_ATM=y
+CONFIG_ATM_CLIP=y
+# CONFIG_ATM_CLIP_NO_ICMP is not set
+CONFIG_ATM_LANE=m
+CONFIG_ATM_MPOA=m
+CONFIG_ATM_BR2684=m
+# CONFIG_ATM_BR2684_IPFILTER is not set
+CONFIG_BRIDGE=m
+CONFIG_VLAN_8021Q=m
+# CONFIG_DECNET is not set
+CONFIG_LLC=m
+# CONFIG_LLC2 is not set
+CONFIG_IPX=m
+# CONFIG_IPX_INTERN is not set
+CONFIG_ATALK=m
+CONFIG_DEV_APPLETALK=y
+CONFIG_IPDDP=m
+CONFIG_IPDDP_ENCAP=y
+CONFIG_IPDDP_DECAP=y
+CONFIG_X25=m
+CONFIG_LAPB=m
+# CONFIG_NET_DIVERT is not set
+CONFIG_ECONET=m
+CONFIG_ECONET_AUNUDP=y
+CONFIG_ECONET_NATIVE=y
+CONFIG_WAN_ROUTER=m
+# CONFIG_NET_FASTROUTE is not set
+# CONFIG_NET_HW_FLOWCONTROL is not set
+
+#
+# QoS and/or fair queueing
+#
+CONFIG_NET_SCHED=y
+CONFIG_NET_SCH_CBQ=m
+CONFIG_NET_SCH_HTB=m
+# CONFIG_NET_SCH_HFSC is not set
+CONFIG_NET_SCH_CSZ=m
+# CONFIG_NET_SCH_ATM is not set
+CONFIG_NET_SCH_PRIO=m
+CONFIG_NET_SCH_RED=m
+CONFIG_NET_SCH_SFQ=m
+CONFIG_NET_SCH_TEQL=m
+CONFIG_NET_SCH_TBF=m
+CONFIG_NET_SCH_GRED=m
+CONFIG_NET_SCH_DSMARK=m
+# CONFIG_NET_SCH_DELAY is not set
+CONFIG_NET_SCH_INGRESS=m
+CONFIG_NET_QOS=y
+CONFIG_NET_ESTIMATOR=y
+CONFIG_NET_CLS=y
+CONFIG_NET_CLS_TCINDEX=m
+CONFIG_NET_CLS_ROUTE4=m
+CONFIG_NET_CLS_ROUTE=y
+CONFIG_NET_CLS_FW=m
+CONFIG_NET_CLS_U32=m
+CONFIG_NET_CLS_RSVP=m
+CONFIG_NET_CLS_RSVP6=m
+CONFIG_NET_CLS_POLICE=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=y
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_ETHERTAP 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 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=y
+# CONFIG_EEPRO100_PIO 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
+
+#
+# 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=y
+
+#
+# Obsolete Wireless cards support (pre-802.11)
+#
+# CONFIG_STRIP is not set
+
+#
+# Wireless 802.11b ISA/PCI cards support
+#
+# CONFIG_AIRO is not set
+CONFIG_HERMES=y
+# CONFIG_PLX_HERMES is not set
+# CONFIG_TMD_HERMES is not set
+CONFIG_PCI_HERMES=y
+# CONFIG_ATMEL is not set
+
+#
+# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
+#
+CONFIG_NET_WIRELESS=y
+
+#
+# Wan interfaces
+#
+CONFIG_WAN=y
+# CONFIG_DSCC4 is not set
+# CONFIG_LANMEDIA is not set
+# CONFIG_SYNCLINK_SYNCPPP is not set
+CONFIG_HDLC=m
+CONFIG_HDLC_RAW=y
+# CONFIG_HDLC_RAW_ETH is not set
+CONFIG_HDLC_CISCO=y
+CONFIG_HDLC_FR=y
+CONFIG_HDLC_PPP=y
+CONFIG_HDLC_X25=y
+# CONFIG_PCI200SYN is not set
+# CONFIG_WANXL is not set
+# CONFIG_PC300 is not set
+# CONFIG_FARSYNC is not set
+CONFIG_DLCI=m
+CONFIG_DLCI_COUNT=24
+CONFIG_DLCI_MAX=8
+CONFIG_WAN_ROUTER_DRIVERS=y
+# CONFIG_CYCLADES_SYNC is not set
+# CONFIG_LAPBETHER is not set
+# CONFIG_X25_ASY is not set
+
+#
+# ATM drivers
+#
+CONFIG_ATM_TCP=m
+# CONFIG_ATM_LANAI is not set
+# CONFIG_ATM_ENI is not set
+# CONFIG_ATM_FIRESTREAM is not set
+# CONFIG_ATM_ZATM is not set
+# CONFIG_ATM_NICSTAR is not set
+# CONFIG_ATM_IDT77252 is not set
+# CONFIG_ATM_AMBASSADOR is not set
+# CONFIG_ATM_HORIZON is not set
+# CONFIG_ATM_IA is not set
+# CONFIG_ATM_FORE200E_MAYBE is not set
+# CONFIG_ATM_HE is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI 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_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_BLK_DEV_IDEPCI=y
+# CONFIG_IDEPCI_SHARE_IRQ is not set
+# CONFIG_BLK_DEV_OFFBOARD is not set
+# CONFIG_BLK_DEV_GENERIC is not set
+# CONFIG_BLK_DEV_OPTI621 is not set
+# 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 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
+CONFIG_BLK_DEV_CMD64X=y
+# CONFIG_BLK_DEV_TRIFLEX is not set
+# CONFIG_BLK_DEV_CY82C693 is not set
+# CONFIG_BLK_DEV_CS5520 is not set
+# CONFIG_BLK_DEV_CS5530 is not set
+# CONFIG_BLK_DEV_HPT34X is not set
+CONFIG_BLK_DEV_HPT366=y
+# CONFIG_BLK_DEV_SC1200 is not set
+# CONFIG_BLK_DEV_PIIX is not set
+# CONFIG_BLK_DEV_NS87415 is not set
+# CONFIG_BLK_DEV_PDC202XX_OLD is not set
+CONFIG_BLK_DEV_PDC202XX_NEW=y
+# CONFIG_PDC202XX_FORCE is not set
+# CONFIG_BLK_DEV_SVWKS is not set
+# CONFIG_BLK_DEV_SIIMAGE is not set
+# CONFIG_BLK_DEV_SLC90E66 is not set
+# CONFIG_BLK_DEV_TRM290 is not set
+# CONFIG_BLK_DEV_VIA82CXXX is not set
+CONFIG_BLK_DEV_IDEDMA=y
+# CONFIG_IDEDMA_IVB 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
+#
+# CONFIG_FUSION is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# I2O device support
+#
+# CONFIG_I2O is not set
+
+#
+# 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 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=2
+# 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
+# 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_IXP4XX_WATCHDOG=y
+
+#
+# PCI-based Watchdog Cards
+#
+# 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
+# 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=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+CONFIG_I2C_ALGOBIT=y
+# CONFIG_I2C_ALGOPCF 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_I801 is not set
+# CONFIG_I2C_I810 is not set
+# CONFIG_I2C_ISA is not set
+CONFIG_I2C_IXP4XX=y
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 is not set
+
+#
+# Hardware Sensors Chip support
+#
+CONFIG_I2C_SENSOR=y
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_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=y
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 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
+
+#
+# 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=y
+CONFIG_EXT2_FS_POSIX_ACL=y
+# CONFIG_EXT2_FS_SECURITY is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+CONFIG_EXT3_FS_POSIX_ACL=y
+# 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
+CONFIG_FS_POSIX_ACL=y
+# 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_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_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_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_INTERMEZZO_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_NEC98_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# Misc devices
+#
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# Kernel hacking
+#
+CONFIG_FRAME_POINTER=y
+# CONFIG_DEBUG_USER is not set
+# CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SLAB is not set
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_WAITQ is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_ERRORS=y
+CONFIG_DEBUG_LL=y
+# CONFIG_DEBUG_ICEDCC is not set
+# CONFIG_DEBUG_BDI2000_XSCALE is not set
+
+#
+# Security options
+#
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
diff -Nru a/arch/arm/configs/lpd7a400_defconfig b/arch/arm/configs/lpd7a400_defconfig
--- a/arch/arm/configs/lpd7a400_defconfig	Tue Jun 15 22:21:05 2004
+++ b/arch/arm/configs/lpd7a400_defconfig	Tue Jun 15 22:21:05 2004
@@ -19,19 +19,23 @@
 #
 # CONFIG_SWAP is not set
 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_IKCONFIG=y
 # CONFIG_IKCONFIG_PROC is not set
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
 CONFIG_FUTEX=y
 # CONFIG_EPOLL is not set
 CONFIG_IOSCHED_NOOP=y
 # CONFIG_IOSCHED_AS is not set
 # CONFIG_IOSCHED_DEADLINE is not set
+CONFIG_IOSCHED_CFQ=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 
 #
@@ -43,21 +47,24 @@
 # System Type
 #
 # CONFIG_ARCH_ADIFCC is not set
-# CONFIG_ARCH_ANAKIN is not set
 # CONFIG_ARCH_CLPS7500 is not set
 # CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
-# CONFIG_ARCH_PXA 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_L7200 is not set
+# CONFIG_ARCH_PXA is not set
 # 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=y
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_VERSATILE_PB is not set
 
 #
 # CLPS711X/EP721X Implementations
@@ -82,7 +89,19 @@
 #
 
 #
-# Intel PXA250/210 Implementations
+# Intel IXP4xx Implementation Options
+#
+
+#
+# IXP4xx Platforms
+#
+
+#
+# IXP4xx Options
+#
+
+#
+# Intel PXA2xx Implementations
 #
 
 #
@@ -90,6 +109,26 @@
 #
 
 #
+# TI OMAP Implementations
+#
+
+#
+# OMAP Core Type
+#
+
+#
+# OMAP Board Type
+#
+
+#
+# OMAP Feature Selections
+#
+
+#
+# S3C2410 Implementations
+#
+
+#
 # LH7A40X Implementations
 #
 # CONFIG_MACH_KEV7A400 is not set
@@ -254,23 +293,21 @@
 # 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_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
@@ -291,6 +328,11 @@
 # 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
@@ -311,38 +353,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT 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
@@ -367,9 +395,9 @@
 # IDE chipset support/bugfixes
 #
 CONFIG_IDE_GENERIC=y
+CONFIG_IDE_ARM=y
 # 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
 
 #
@@ -452,11 +480,6 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -536,6 +559,7 @@
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
@@ -576,7 +600,7 @@
 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_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -665,6 +689,11 @@
 CONFIG_DUMMY_CONSOLE=y
 
 #
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
 # Misc devices
 #
 
@@ -706,5 +735,6 @@
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
diff -Nru a/arch/arm/configs/lpd7a404_defconfig b/arch/arm/configs/lpd7a404_defconfig
--- a/arch/arm/configs/lpd7a404_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/configs/lpd7a404_defconfig	Tue Jun 15 22:20:37 2004
@@ -19,19 +19,23 @@
 #
 # CONFIG_SWAP is not set
 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_IKCONFIG=y
 # CONFIG_IKCONFIG_PROC is not set
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
 CONFIG_FUTEX=y
 # CONFIG_EPOLL is not set
 CONFIG_IOSCHED_NOOP=y
 # CONFIG_IOSCHED_AS is not set
 # CONFIG_IOSCHED_DEADLINE is not set
+CONFIG_IOSCHED_CFQ=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 
 #
@@ -46,19 +50,21 @@
 # CONFIG_ARCH_CLPS7500 is not set
 # CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
-# CONFIG_ARCH_PXA 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_L7200 is not set
+# CONFIG_ARCH_PXA is not set
 # CONFIG_ARCH_RPC is not set
 # CONFIG_ARCH_SA1100 is not set
-# CONFIG_ARCH_SHARK is not set
 # CONFIG_ARCH_S3C2410 is not set
-# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_SHARK is not set
 CONFIG_ARCH_LH7A40X=y
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_VERSATILE_PB is not set
 
 #
 # CLPS711X/EP721X Implementations
@@ -83,7 +89,19 @@
 #
 
 #
-# Intel PXA250/210 Implementations
+# Intel IXP4xx Implementation Options
+#
+
+#
+# IXP4xx Platforms
+#
+
+#
+# IXP4xx Options
+#
+
+#
+# Intel PXA2xx Implementations
 #
 
 #
@@ -95,6 +113,14 @@
 #
 
 #
+# OMAP Core Type
+#
+
+#
+# OMAP Board Type
+#
+
+#
 # OMAP Feature Selections
 #
 
@@ -271,8 +297,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 
 #
@@ -280,7 +304,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -301,6 +327,11 @@
 # 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
@@ -321,41 +352,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -381,6 +395,7 @@
 # IDE chipset support/bugfixes
 #
 CONFIG_IDE_GENERIC=y
+CONFIG_IDE_ARM=y
 # CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_IDEDMA_AUTO is not set
 # CONFIG_BLK_DEV_HD is not set
@@ -404,7 +419,6 @@
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 # CONFIG_SCSI_MULTI_LUN is not set
-# CONFIG_SCSI_REPORT_LUNS is not set
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
 
@@ -418,6 +432,7 @@
 # SCSI low-level drivers
 #
 # CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_DPT_I2O is not set
 # CONFIG_SCSI_SATA is not set
 # CONFIG_SCSI_EATA_PIO is not set
 # CONFIG_SCSI_DEBUG is not set
@@ -573,6 +588,7 @@
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
@@ -618,7 +634,6 @@
 # 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
 
 #
@@ -761,6 +776,7 @@
 # CONFIG_USB_KBTAB is not set
 # CONFIG_USB_POWERMATE is not set
 # CONFIG_USB_MTOUCH is not set
+# CONFIG_USB_EGALAX is not set
 # CONFIG_USB_XPAD is not set
 # CONFIG_USB_ATI_REMOTE is not set
 
@@ -809,6 +825,8 @@
 # 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_PHIDGETSERVO is not set
 # CONFIG_USB_TEST is not set
 
 #
@@ -845,5 +863,6 @@
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
diff -Nru a/arch/arm/configs/mainstone_defconfig b/arch/arm/configs/mainstone_defconfig
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/configs/mainstone_defconfig	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,743 @@
+#
+# Automatically generated make config: don't edit
+#
+CONFIG_ARM=y
+CONFIG_MMU=y
+CONFIG_UID16=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+
+#
+# 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=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_HOTPLUG=y
+# CONFIG_IKCONFIG is not set
+# CONFIG_EMBEDDED is not set
+CONFIG_KALLSYMS=y
+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=y
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+# CONFIG_MODULE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+# CONFIG_MODVERSIONS is not set
+# CONFIG_KMOD is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_ADIFCC is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+CONFIG_ARCH_PXA=y
+# 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_L7200 is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_VERSATILE_PB is not set
+
+#
+# CLPS711X/EP721X Implementations
+#
+
+#
+# Epxa10db
+#
+
+#
+# Footbridge Implementations
+#
+
+#
+# IOP3xx Implementation Options
+#
+# CONFIG_ARCH_IOP310 is not set
+# CONFIG_ARCH_IOP321 is not set
+
+#
+# IOP3xx Chipset Features
+#
+
+#
+# Intel PXA2xx Implementations
+#
+# CONFIG_ARCH_LUBBOCK is not set
+CONFIG_MACH_MAINSTONE=y
+# CONFIG_ARCH_PXA_IDP is not set
+CONFIG_PXA27x=y
+CONFIG_IWMMXT=y
+
+#
+# SA11x0 Implementations
+#
+
+#
+# TI OMAP Implementations
+#
+
+#
+# OMAP Core Type
+#
+
+#
+# OMAP Board Type
+#
+
+#
+# OMAP Feature Selections
+#
+
+#
+# S3C2410 Implementations
+#
+
+#
+# LH7A40X Implementations
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=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 is not set
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+
+#
+# PCMCIA/CardBus support
+#
+CONFIG_PCMCIA=y
+# CONFIG_PCMCIA_DEBUG is not set
+# CONFIG_TCIC is not set
+CONFIG_PCMCIA_PXA2XX=y
+
+#
+# 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_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=bootp 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=y
+# 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_CFI_B1 is not set
+# CONFIG_MTD_CFI_B2 is not set
+CONFIG_MTD_CFI_B4=y
+# CONFIG_MTD_CFI_B8 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_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_OBSOLETE_CHIPS is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_EDB7312 is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_RAM 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 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_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_NET_FASTROUTE is not set
+# CONFIG_NET_HW_FLOWCONTROL is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+CONFIG_NETDEVICES=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
+
+#
+# PCMCIA network device support
+#
+# CONFIG_NET_PCMCIA 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_IDEDISK=y
+# CONFIG_IDEDISK_MULTI_MODE is not set
+# CONFIG_IDEDISK_STROKE is not set
+CONFIG_BLK_DEV_IDECS=y
+# 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 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
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# 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_I8042 is not set
+# CONFIG_SERIO_SERPORT is not set
+# 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_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
+# CONFIG_QIC02_TAPE is not set
+
+#
+# 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_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
+
+#
+# PCMCIA character devices
+#
+# CONFIG_SYNCLINK_CS 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
+# 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=y
+CONFIG_MSDOS_FS=y
+# CONFIG_VFAT_FS is not set
+# 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_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_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_INTERMEZZO_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED 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=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 is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+# CONFIG_MDA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# Misc devices
+#
+
+#
+# USB support
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# Kernel hacking
+#
+CONFIG_FRAME_POINTER=y
+CONFIG_DEBUG_USER=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SLAB is not set
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_WAITQ is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_ERRORS=y
+CONFIG_DEBUG_LL=y
+# CONFIG_DEBUG_ICEDCC is not set
+
+#
+# Security options
+#
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
diff -Nru a/arch/arm/configs/smdk2410_defconfig b/arch/arm/configs/smdk2410_defconfig
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/configs/smdk2410_defconfig	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,667 @@
+#
+# Automatically generated make config: don't edit
+#
+CONFIG_ARM=y
+CONFIG_MMU=y
+CONFIG_UID16=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+
+#
+# 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=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_IKCONFIG is not set
+# CONFIG_EMBEDDED is not set
+CONFIG_KALLSYMS=y
+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=y
+
+#
+# Loadable module support
+#
+# CONFIG_MODULES is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_ADIFCC is not set
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_PXA 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_L7200 is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_SHARK is not set
+CONFIG_ARCH_S3C2410=y
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_VERSATILE_PB is not set
+
+#
+# CLPS711X/EP721X Implementations
+#
+
+#
+# Epxa10db
+#
+
+#
+# Footbridge Implementations
+#
+
+#
+# IOP3xx Implementation Options
+#
+# CONFIG_ARCH_IOP310 is not set
+# CONFIG_ARCH_IOP321 is not set
+
+#
+# IOP3xx Chipset Features
+#
+
+#
+# Intel PXA250/210 Implementations
+#
+
+#
+# SA11x0 Implementations
+#
+
+#
+# TI OMAP Implementations
+#
+
+#
+# OMAP Core Type
+#
+
+#
+# OMAP Board Type
+#
+
+#
+# OMAP Feature Selections
+#
+
+#
+# S3C2410 Implementations
+#
+# CONFIG_ARCH_BAST is not set
+# CONFIG_ARCH_H1940 is not set
+CONFIG_ARCH_SMDK2410=y
+# CONFIG_MACH_VR1000 is not set
+
+#
+# LH7A40X Implementations
+#
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_ARM920T=y
+CONFIG_CPU_32v4=y
+CONFIG_CPU_ABRT_EV4T=y
+CONFIG_CPU_CACHE_V4WT=y
+CONFIG_CPU_COPY_V4WB=y
+CONFIG_CPU_TLB_V4WBI=y
+
+#
+# Processor Features
+#
+CONFIG_ARM_THUMB=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
+
+#
+# General setup
+#
+# CONFIG_ZBOOT_ROM is not set
+CONFIG_ZBOOT_ROM_TEXT=0
+CONFIG_ZBOOT_ROM_BSS=0
+
+#
+# At least one math emulation must be selected
+#
+# CONFIG_FPE_NWFPE is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_AOUT=y
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Generic Driver Options
+#
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_PM is not set
+# CONFIG_PREEMPT is not set
+# CONFIG_ARTHUR is not set
+CONFIG_CMDLINE="root=1f04 mem=32M"
+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 is not set
+# CONFIG_MTD_CONCAT 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_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_OBSOLETE_CHIPS is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_EDB7312 is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD 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_SIZE=4096
+# CONFIG_BLK_DEV_INITRD 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 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_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_NET_FASTROUTE is not set
+# CONFIG_NET_HW_FLOWCONTROL is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+CONFIG_NETDEVICES=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
+
+#
+# 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 is not set
+
+#
+# SCSI device support
+#
+# CONFIG_SCSI is not set
+
+#
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# 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 is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_CT82C710 is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=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_S3C2410=y
+CONFIG_SERIAL_S3C2410_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 is not set
+# CONFIG_NVRAM is not set
+# CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+
+#
+# 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
+
+#
+# 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
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+CONFIG_ROMFS_FS=y
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS 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_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 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_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_INTERMEZZO_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_NEC98_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Graphics support
+#
+CONFIG_FB=y
+CONFIG_FB_VIRTUAL=y
+
+#
+# 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
+
+#
+# Logo configuration
+#
+# CONFIG_LOGO is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# Misc devices
+#
+
+#
+# USB support
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# Kernel hacking
+#
+CONFIG_FRAME_POINTER=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_WAITQ is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_ERRORS is not set
+CONFIG_DEBUG_LL=y
+# CONFIG_DEBUG_ICEDCC is not set
+CONFIG_DEBUG_LL_PRINTK=y
+CONFIG_DEBUG_S3C2410_PORT=y
+CONFIG_DEBUG_S3C2410_UART=0
+
+#
+# Security options
+#
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+CONFIG_CRC32=y
+CONFIG_LIBCRC32C=y
diff -Nru a/arch/arm/kernel/arch.c b/arch/arm/kernel/arch.c
--- a/arch/arm/kernel/arch.c	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/kernel/arch.c	Tue Jun 15 22:20:37 2004
@@ -10,7 +10,6 @@
 #include <asm/elf.h>
 #include <asm/page.h>
 #include <asm/setup.h>
-#include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
 unsigned int vram_size;
diff -Nru a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
--- a/arch/arm/kernel/armksyms.c	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/kernel/armksyms.c	Tue Jun 15 22:20:39 2004
@@ -7,41 +7,16 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#include <linux/config.h>
 #include <linux/module.h>
-#include <linux/user.h>
 #include <linux/string.h>
-#include <linux/fs.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-#include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/in6.h>
-#include <linux/interrupt.h>
-#include <linux/pm.h>
-#include <linux/tty.h>
-#include <linux/vt_kern.h>
-#include <linux/smp_lock.h>
 #include <linux/syscalls.h>
 
-#include <asm/byteorder.h>
-#include <asm/elf.h>
+#include <asm/checksum.h>
 #include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/proc-fns.h>
-#include <asm/processor.h>
-#include <asm/semaphore.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
-#include <asm/checksum.h>
-#include <asm/mach-types.h>
-
-extern void dump_thread(struct pt_regs *, struct user *);
-extern int dump_fpu(struct pt_regs *, struct user_fp_struct *);
-extern void inswb(unsigned int port, void *to, int len);
-extern void outswb(unsigned int port, const void *to, int len);
-
-extern void __bad_xchg(volatile void *ptr, int size);
 
 /*
  * libgcc functions - functions that are used internally by the
@@ -61,12 +36,9 @@
 extern void __udivsi3(void);
 extern void __umodsi3(void);
 extern void __do_div64(void);
-extern void abort(void);
 
-extern void ret_from_exception(void);
 extern void fpundefinstr(void);
 extern void fp_enter(void);
-extern void fp_init(union fp_state *);
 
 /*
  * This has a special calling convention; it doesn't
@@ -88,32 +60,7 @@
 EXPORT_SYMBOL_NOVERS(__backtrace);
 
 	/* platform dependent support */
-EXPORT_SYMBOL(dump_thread);
-EXPORT_SYMBOL(dump_fpu);
 EXPORT_SYMBOL(udelay);
-EXPORT_SYMBOL(__ioremap);
-EXPORT_SYMBOL(__iounmap);
-EXPORT_SYMBOL(kernel_thread);
-EXPORT_SYMBOL(system_rev);
-EXPORT_SYMBOL(system_serial_low);
-EXPORT_SYMBOL(system_serial_high);
-#ifdef CONFIG_DEBUG_BUGVERBOSE
-EXPORT_SYMBOL(__bug);
-#endif
-EXPORT_SYMBOL(__bad_xchg);
-EXPORT_SYMBOL(__readwrite_bug);
-EXPORT_SYMBOL(enable_irq);
-EXPORT_SYMBOL(disable_irq);
-EXPORT_SYMBOL(probe_irq_mask);
-EXPORT_SYMBOL(set_irq_type);
-EXPORT_SYMBOL(enable_irq_wake);
-EXPORT_SYMBOL(disable_irq_wake);
-EXPORT_SYMBOL(pm_idle);
-EXPORT_SYMBOL(pm_power_off);
-EXPORT_SYMBOL(fp_init);
-
-	/* processor dependencies */
-EXPORT_SYMBOL(__machine_arch_type);
 
 	/* networking */
 EXPORT_SYMBOL(csum_partial);
@@ -140,20 +87,6 @@
 EXPORT_SYMBOL_NOVERS(__raw_writesl);
 #endif
 
-	/* address translation */
-#ifndef __virt_to_phys__is_a_macro
-EXPORT_SYMBOL(__virt_to_phys);
-#endif
-#ifndef __phys_to_virt__is_a_macro
-EXPORT_SYMBOL(__phys_to_virt);
-#endif
-#ifndef __virt_to_bus__is_a_macro
-EXPORT_SYMBOL(__virt_to_bus);
-#endif
-#ifndef __bus_to_virt__is_a_macro
-EXPORT_SYMBOL(__bus_to_virt);
-#endif
-
 	/* string / mem functions */
 EXPORT_SYMBOL_NOVERS(strcpy);
 EXPORT_SYMBOL_NOVERS(strncpy);
@@ -227,10 +160,6 @@
 EXPORT_SYMBOL(_find_next_zero_bit_be);
 #endif
 
-	/* elf */
-EXPORT_SYMBOL(elf_platform);
-EXPORT_SYMBOL(elf_hwcap);
-
 	/* syscalls */
 EXPORT_SYMBOL(sys_write);
 EXPORT_SYMBOL(sys_read);
@@ -238,11 +167,3 @@
 EXPORT_SYMBOL(sys_open);
 EXPORT_SYMBOL(sys_exit);
 EXPORT_SYMBOL(sys_wait4);
-
-	/* semaphores */
-EXPORT_SYMBOL_NOVERS(__down_failed);
-EXPORT_SYMBOL_NOVERS(__down_interruptible_failed);
-EXPORT_SYMBOL_NOVERS(__down_trylock_failed);
-EXPORT_SYMBOL_NOVERS(__up_wakeup);
-
-EXPORT_SYMBOL(get_wchan);
diff -Nru a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
--- a/arch/arm/kernel/bios32.c	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/kernel/bios32.c	Tue Jun 15 22:20:39 2004
@@ -156,6 +156,30 @@
 }
 
 /*
+ * Same as above. The PrPMC800 carrier board for the PrPMC1100 
+ * card maps the host-bridge @ 00:01:00 for some reason and it
+ * ends up getting scanned. Note that we only want to do this
+ * fixup when we find the IXP4xx on a PrPMC system, which is why
+ * we check the machine type. We could be running on a board
+ * with an IXP4xx target device and we don't want to kill the
+ * resources in that case.
+ */
+static void __devinit pci_fixup_prpmc1100(struct pci_dev *dev)
+{
+	int i;
+
+	if (machine_is_prpmc1100()) {
+		dev->class &= 0xff;
+		dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
+		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
+			dev->resource[i].start = 0;
+			dev->resource[i].end   = 0;
+			dev->resource[i].flags = 0;
+		}
+	}
+}
+
+/*
  * PCI IDE controllers use non-standard I/O port decoding, respect it.
  */
 static void __devinit pci_fixup_ide_bases(struct pci_dev *dev)
@@ -273,6 +297,10 @@
 		PCI_FIXUP_HEADER,
 		PCI_ANY_ID,		PCI_ANY_ID,
 		pci_fixup_ide_bases
+	}, {
+		PCI_FIXUP_HEADER,
+		PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_IXP4XX,
+		pci_fixup_prpmc1100
 	}, { 0 }
 };
 
diff -Nru a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
--- a/arch/arm/kernel/debug.S	Tue Jun 15 22:20:38 2004
+++ b/arch/arm/kernel/debug.S	Tue Jun 15 22:20:38 2004
@@ -465,13 +465,45 @@
 		beq	1001b
 		.endm
 
-#elif defined(CONFIG_ARCH_OMAP)
+#elif defined(CONFIG_ARCH_IXP4XX)
+
+                .macro  addruart,rx
+                mrc     p15, 0, \rx, c1, c0
+                tst     \rx, #1                 @ MMU enabled?
+                moveq   \rx, #0xc8000000
+                movne   \rx, #0xff000000
+                add     \rx,\rx,#3              @ Uart regs are at off set of 3 if
+						@ byte writes used - Big Endian.
+                .endm
+
+               .macro  senduart,rd,rx
+                strb    \rd, [\rx]
+                .endm
+
+                .macro  waituart,rd,rx
+1002:           ldrb    \rd, [\rx, #0x14]
+                and     \rd, \rd, #0x60		@ check THRE and TEMT bits
+                teq     \rd, #0x60
+                bne     1002b
+                .endm
 
-#include <asm/arch/serial.h>
+                .macro  busyuart,rd,rx
+                .endm
+
+#elif defined(CONFIG_ARCH_OMAP)
 
 		.macro	addruart,rx
-		mov	\rx, #0xff000000
+		mrc	p15, 0, \rx, c1, c0
+		tst	\rx, #1			@ MMU enabled?
+		moveq	\rx, #0xff000000	@ physical base address
+		movne	\rx, #0xfe000000	@ virtual base
 		orr	\rx, \rx, #0x00fb0000
+#ifdef CONFIG_OMAP_LL_DEBUG_UART3
+		orr	\rx, \rx, #0x00009000	@ UART 3
+#endif
+#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3)
+		orr	\rx, \rx, #0x00000800	@ UART 2 & 3
+#endif
 		.endm
 
 		.macro	senduart,rd,rx
@@ -479,16 +511,18 @@
 		.endm
 
 		.macro	busyuart,rd,rx
-1002:		ldrb	\rd, [\rx, #(0x5 << OMAP_SERIAL_REG_SHIFT)]
+1001:		ldrb	\rd, [\rx, #(0x5 << 2)]	@ OMAP-1510 and friends
 		and	\rd, \rd, #0x60
 		teq	\rd, #0x60
-		bne	1002b
+		beq	1002f
+		ldrb	\rd, [\rx, #(0x5 << 0)]	@ OMAP-730 only
+		and	\rd, \rd, #0x60
+		teq	\rd, #0x60
+		bne	1001b
+1002:
 		.endm
 
 		.macro	waituart,rd,rx
-1001:		ldrb	\rd, [\rx, #(0x6 << OMAP_SERIAL_REG_SHIFT)]
-		tst	\rd, #0x10
-		beq	1001b
 		.endm
 
 #elif defined(CONFIG_ARCH_S3C2410)
@@ -551,7 +585,7 @@
 		.endm
 
 #elif defined(CONFIG_ARCH_LH7A40X)
-	@ It isn't known if this will be appropriate for every 40x
+	@ It is not known if this will be appropriate for every 40x
 	@ board.
 
 		.macro  addruart,rx
diff -Nru a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
--- a/arch/arm/kernel/entry-armv.S	Tue Jun 15 22:20:38 2004
+++ b/arch/arm/kernel/entry-armv.S	Tue Jun 15 22:20:38 2004
@@ -623,10 +623,15 @@
 		.endm
 
 		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
+#ifdef CONFIG_PXA27x
+		mrc	p6, 0, \irqstat, c0, c0, 0		@ ICIP
+		mrc	p6, 0, \irqnr, c1, c0, 0		@ ICMR
+#else
 		mov	\base, #io_p2v(0x40000000)	@ IIR Ctl = 0x40d00000
 		add	\base, \base, #0x00d00000
 		ldr	\irqstat, [\base, #0]		@ ICIP
 		ldr	\irqnr, [\base, #4]		@ ICMR
+#endif
 		ands	\irqnr, \irqstat, \irqnr
 		beq	1001f
 		rsb	\irqstat, \irqnr, #0
@@ -639,6 +644,34 @@
 		.macro	irq_prio_table
 		.endm
 
+#elif defined (CONFIG_ARCH_IXP4XX)
+
+		.macro	disable_fiq
+		.endm
+		
+		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
+		ldr	\irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET)
+		ldr	\irqstat, [\irqstat]		@ get interrupts
+		cmp	\irqstat, #0
+		beq	1002f
+		clz     \irqnr, \irqstat
+		mov     \base, #31
+		subs    \irqnr, \base, \irqnr
+		
+/*
+1001:		tst	\irqstat, #1
+		addeq	\irqnr, \irqnr, #1
+		moveq	\irqstat, \irqstat, lsr #1
+		tsteq	\irqnr, #32
+		beq	1001b
+		teq	\irqnr, #32
+*/
+1002:
+		.endm
+
+                .macro  irq_prio_table
+                .endm
+
 #elif defined(CONFIG_ARCH_OMAP)
 
 		.macro	disable_fiq
@@ -646,19 +679,19 @@
 
 		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
 		ldr	\base, =IO_ADDRESS(OMAP_IH1_BASE)
-		ldr	\irqnr, [\base, #IRQ_ITR]
-		ldr	\tmp, [\base, #IRQ_MIR]
+		ldr	\irqnr, [\base, #IRQ_ITR_REG_OFFSET]
+		ldr	\tmp, [\base, #IRQ_MIR_REG_OFFSET]
 		mov	\irqstat, #0xffffffff
 		bic	\tmp, \irqstat, \tmp
 		tst	\irqnr, \tmp
 		beq	1510f
 
-		ldr	\irqnr, [\base, #IRQ_SIR_FIQ]
+		ldr	\irqnr, [\base, #IRQ_SIR_FIQ_REG_OFFSET]
 		cmp	\irqnr, #0
-		ldreq	\irqnr, [\base, #IRQ_SIR_IRQ]
+		ldreq	\irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
 		cmpeq	\irqnr, #INT_IH2_IRQ
 		ldreq	\base, =IO_ADDRESS(OMAP_IH2_BASE)
-		ldreq	\irqnr, [\base, #IRQ_SIR_IRQ]
+		ldreq	\irqnr, [\base, #IRQ_SIR_IRQ_REG_OFFSET]
 		addeqs	\irqnr, \irqnr, #32
 1510:
 		.endm
@@ -1219,7 +1252,7 @@
 
 /*
  * Register switch for ARMv3 and ARMv4 processors
- * r0 = previous thread_info, r1 = next thread_info
+ * r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info
  * previous and next are guaranteed not to be the same.
  */
 ENTRY(__switch_to)
diff -Nru a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
--- a/arch/arm/kernel/irq.c	Tue Jun 15 22:20:35 2004
+++ b/arch/arm/kernel/irq.c	Tue Jun 15 22:20:35 2004
@@ -47,7 +47,7 @@
 #define MAX_IRQ_CNT	100000
 
 static volatile unsigned long irq_err_count;
-static spinlock_t irq_controller_lock;
+static spinlock_t irq_controller_lock = SPIN_LOCK_UNLOCKED;
 static LIST_HEAD(irq_pending);
 
 struct irqdesc irq_desc[NR_IRQS];
@@ -103,6 +103,7 @@
 	list_del_init(&desc->pend);
 	spin_unlock_irqrestore(&irq_controller_lock, flags);
 }
+EXPORT_SYMBOL(disable_irq);
 
 /**
  *	enable_irq - enable interrupt handling on an irq
@@ -142,6 +143,7 @@
 	}
 	spin_unlock_irqrestore(&irq_controller_lock, flags);
 }
+EXPORT_SYMBOL(enable_irq);
 
 /*
  * Enable wake on selected irq
@@ -156,6 +158,7 @@
 		desc->chip->wake(irq, 1);
 	spin_unlock_irqrestore(&irq_controller_lock, flags);
 }
+EXPORT_SYMBOL(enable_irq_wake);
 
 void disable_irq_wake(unsigned int irq)
 {
@@ -167,6 +170,7 @@
 		desc->chip->wake(irq, 0);
 	spin_unlock_irqrestore(&irq_controller_lock, flags);
 }
+EXPORT_SYMBOL(disable_irq_wake);
 
 int show_interrupts(struct seq_file *p, void *v)
 {
@@ -443,7 +447,7 @@
  * come via this function.  Instead, they should provide their
  * own 'handler'
  */
-asmlinkage void asm_do_IRQ(int irq, struct pt_regs *regs)
+asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
 {
 	struct irqdesc *desc = irq_desc + irq;
 
@@ -541,6 +545,7 @@
 
 	return ret;
 }
+EXPORT_SYMBOL(set_irq_type);
 
 void set_irq_flags(unsigned int irq, unsigned int iflags)
 {
@@ -798,6 +803,7 @@
 
 	return mask;
 }
+EXPORT_SYMBOL(probe_irq_mask);
 
 /*
  * Possible return values:
diff -Nru a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
--- a/arch/arm/kernel/process.c	Tue Jun 15 22:20:59 2004
+++ b/arch/arm/kernel/process.c	Tue Jun 15 22:20:59 2004
@@ -73,7 +73,10 @@
  * The following aren't currently used.
  */
 void (*pm_idle)(void);
+EXPORT_SYMBOL(pm_idle);
+
 void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);
 
 /*
  * This is our default idle handler.  We need to disable
@@ -301,6 +304,7 @@
 }
 
 void (*fp_init)(union fp_state *) = default_fp_init;
+EXPORT_SYMBOL(fp_init);
 
 void flush_thread(void)
 {
@@ -350,6 +354,7 @@
 
 	return used_math != 0;
 }
+EXPORT_SYMBOL(dump_fpu);
 
 /*
  * fill in the user structure for a core dump..
@@ -378,6 +383,7 @@
 	dump->regs = *regs;
 	dump->u_fpvalid = dump_fpu (regs, &dump->u_fp);
 }
+EXPORT_SYMBOL(dump_thread);
 
 /*
  * Shuffle the argument into the correct register before calling the
@@ -385,13 +391,15 @@
  * the thread function, and r3 points to the exit function.
  */
 extern void kernel_thread_helper(void);
-asm(	".align\n"
+asm(	".section .text\n"
+"	.align\n"
 "	.type	kernel_thread_helper, #function\n"
 "kernel_thread_helper:\n"
 "	mov	r0, r1\n"
 "	mov	lr, r3\n"
 "	mov	pc, r2\n"
-"	.size	kernel_thread_helper, . - kernel_thread_helper");
+"	.size	kernel_thread_helper, . - kernel_thread_helper\n"
+"	.previous");
 
 /*
  * Create a kernel thread.
@@ -410,12 +418,7 @@
 
 	return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
 }
-
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
+EXPORT_SYMBOL(kernel_thread);
 
 unsigned long get_wchan(struct task_struct *p)
 {
@@ -431,9 +434,10 @@
 		if (fp < stack_page || fp > 4092+stack_page)
 			return 0;
 		lr = pc_pointer (((unsigned long *)fp)[-1]);
-		if (lr < first_sched || lr > last_sched)
+		if (!in_sched_functions(lr))
 			return lr;
 		fp = *(unsigned long *) (fp - 12);
 	} while (count ++ < 16);
 	return 0;
 }
+EXPORT_SYMBOL(get_wchan);
diff -Nru a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
--- a/arch/arm/kernel/ptrace.c	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/kernel/ptrace.c	Tue Jun 15 22:20:37 2004
@@ -622,7 +622,7 @@
 			ret = access_process_vm(child, addr, &tmp,
 						sizeof(unsigned long), 0);
 			if (ret == sizeof(unsigned long))
-				ret = put_user(tmp, (unsigned long *) data);
+				ret = put_user(tmp, (unsigned long __user *) data);
 			else
 				ret = -EIO;
 			break;
diff -Nru a/arch/arm/kernel/semaphore.c b/arch/arm/kernel/semaphore.c
--- a/arch/arm/kernel/semaphore.c	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/kernel/semaphore.c	Tue Jun 15 22:20:39 2004
@@ -11,6 +11,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/init.h>
@@ -213,3 +214,7 @@
 	ldmfd	sp!, {r0 - r3, pc}		\n\
 	");
 
+EXPORT_SYMBOL_NOVERS(__down_failed);
+EXPORT_SYMBOL_NOVERS(__down_interruptible_failed);
+EXPORT_SYMBOL_NOVERS(__down_trylock_failed);
+EXPORT_SYMBOL_NOVERS(__up_wakeup);
diff -Nru a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
--- a/arch/arm/kernel/setup.c	Tue Jun 15 22:20:41 2004
+++ b/arch/arm/kernel/setup.c	Tue Jun 15 22:20:41 2004
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 #include <linux/config.h>
+#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/stddef.h>
 #include <linux/ioport.h>
@@ -61,10 +62,20 @@
 
 unsigned int processor_id;
 unsigned int __machine_arch_type;
+EXPORT_SYMBOL(__machine_arch_type);
+
 unsigned int system_rev;
+EXPORT_SYMBOL(system_rev);
+
 unsigned int system_serial_low;
+EXPORT_SYMBOL(system_serial_low);
+
 unsigned int system_serial_high;
+EXPORT_SYMBOL(system_serial_high);
+
 unsigned int elf_hwcap;
+EXPORT_SYMBOL(elf_hwcap);
+
 
 #ifdef MULTI_CPU
 struct processor processor;
@@ -80,7 +91,10 @@
 #endif
 
 unsigned char aux_device_present;
+
 char elf_platform[ELF_PLATFORM_SIZE];
+EXPORT_SYMBOL(elf_platform);
+
 char saved_command_line[COMMAND_LINE_SIZE];
 unsigned long phys_initrd_start __initdata = 0;
 unsigned long phys_initrd_size __initdata = 0;
diff -Nru a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
--- a/arch/arm/kernel/signal.c	Tue Jun 15 22:20:36 2004
+++ b/arch/arm/kernel/signal.c	Tue Jun 15 22:20:36 2004
@@ -253,6 +253,9 @@
 	if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
 		goto badframe;
 
+	if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->ARM_sp) == -EFAULT)
+		goto badframe;
+
 	/* Send SIGTRAP if we're single-stepping */
 	if (current->ptrace & PT_SINGLESTEP) {
 		ptrace_cancel_bpt(current);
@@ -402,6 +405,7 @@
 	       sigset_t *set, struct pt_regs *regs)
 {
 	struct rt_sigframe __user *frame = get_sigframe(ka, regs, sizeof(*frame));
+	stack_t stack;
 	int err = 0;
 
 	if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
@@ -411,8 +415,14 @@
 	__put_user_error(&frame->uc, &frame->puc, err);
 	err |= copy_siginfo_to_user(&frame->info, info);
 
-	/* Clear all the bits of the ucontext we don't use.  */
-	err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
+	__put_user_error(0, &frame->uc.uc_flags, err);
+	__put_user_error(NULL, &frame->uc.uc_link, err);
+
+	memset(&stack, 0, sizeof(stack));
+	stack.ss_sp = (void *)current->sas_ss_sp;
+	stack.ss_flags = sas_ss_flags(regs->ARM_sp);
+	stack.ss_size = current->sas_ss_size;
+	err |= __copy_to_user(&frame->uc.uc_stack, &stack, sizeof(stack));
 
 	err |= setup_sigcontext(&frame->uc.uc_mcontext, /*&frame->fpstate,*/
 				regs, set->sig[0]);
@@ -427,8 +437,8 @@
 		 * arguments for the signal handler.
 		 *   -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06
 		 */
-		regs->ARM_r1 = (unsigned long)frame->pinfo;
-		regs->ARM_r2 = (unsigned long)frame->puc;
+		regs->ARM_r1 = (unsigned long)&frame->info;
+		regs->ARM_r2 = (unsigned long)&frame->uc;
 	}
 
 	return err;
@@ -564,10 +574,10 @@
 				regs->ARM_r7 = __NR_restart_syscall;
 				regs->ARM_pc -= 2;
 			} else {
-				u32 *usp;
+				u32 __user *usp;
 
 				regs->ARM_sp -= 12;
-				usp = (u32 *)regs->ARM_sp;
+				usp = (u32 __user *)regs->ARM_sp;
 
 				put_user(regs->ARM_pc, &usp[0]);
 				/* swi __NR_restart_syscall */
diff -Nru a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
--- a/arch/arm/kernel/sys_arm.c	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/kernel/sys_arm.c	Tue Jun 15 22:20:37 2004
@@ -12,6 +12,7 @@
  *  have a non-standard calling sequence on the Linux/arm
  *  platform.
  */
+#include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -282,3 +283,43 @@
 out:
 	return error;
 }
+
+long execve(const char *filename, char **argv, char **envp)
+{
+	struct pt_regs regs;
+	int ret;
+
+	memset(&regs, 0, sizeof(struct pt_regs));
+	ret = do_execve((char *)filename, (char __user * __user *)argv,
+			(char __user * __user *)envp, &regs);
+	if (ret < 0)
+		goto out;
+
+	/*
+	 * Save argc to the register structure for userspace.
+	 */
+	regs.ARM_r0 = ret;
+
+	/*
+	 * We were successful.  We won't be returning to our caller, but
+	 * instead to user space by manipulating the kernel stack.
+	 */
+	asm(	"add	r0, %0, %1\n\t"
+		"mov	r1, %2\n\t"
+		"mov	r2, %3\n\t"
+		"bl	memmove\n\t"	/* copy regs to top of stack */
+		"mov	r8, #0\n\t"	/* not a syscall */
+		"mov	r9, %0\n\t"	/* thread structure */
+		"mov	sp, r0\n\t"	/* reposition stack pointer */
+		"b	ret_to_user"
+		:
+		: "r" (current_thread_info()),
+		  "Ir" (THREAD_SIZE - 8 - sizeof(regs)),
+		  "r" (&regs),
+		  "Ir" (sizeof(regs))
+		: "r0", "r1", "r2", "r3", "ip", "memory");
+
+ out:
+	return ret;
+}
+EXPORT_SYMBOL(execve);
diff -Nru a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
--- a/arch/arm/kernel/traps.c	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/kernel/traps.c	Tue Jun 15 22:20:39 2004
@@ -495,6 +495,7 @@
 		__builtin_return_address(0), ptr, size);
 	BUG();
 }
+EXPORT_SYMBOL(__bad_xchg);
 
 /*
  * A data abort trap was taken, but we did not handle the instruction.
@@ -532,12 +533,14 @@
 	printk("\n");
 	*(int *)0 = 0;
 }
+EXPORT_SYMBOL(__bug);
 
 void __readwrite_bug(const char *fn)
 {
 	printk("%s called, but not implemented", fn);
 	BUG();
 }
+EXPORT_SYMBOL(__readwrite_bug);
 
 void __pte_error(const char *file, int line, unsigned long val)
 {
@@ -559,6 +562,7 @@
 	printk("Division by zero in kernel.\n");
 	dump_stack();
 }
+EXPORT_SYMBOL_NOVERS(__div0);
 
 void abort(void)
 {
@@ -567,6 +571,7 @@
 	/* if that doesn't kill us, halt */
 	panic("Oops failed to kill thread");
 }
+EXPORT_SYMBOL(abort);
 
 void __init trap_init(void)
 {
diff -Nru a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
--- a/arch/arm/lib/Makefile	Tue Jun 15 22:20:42 2004
+++ b/arch/arm/lib/Makefile	Tue Jun 15 22:20:42 2004
@@ -24,7 +24,6 @@
 lib-$(CONFIG_ARCH_CLPS7500)	+= io-acorn.o
 lib-$(CONFIG_ARCH_L7200)	+= io-acorn.o
 lib-$(CONFIG_ARCH_SHARK)	+= io-shark.o
-lib-$(CONFIG_ARCH_CLPS711X)	+= io-acorn.o
 
 $(obj)/csumpartialcopy.o:	$(obj)/csumpartialcopygeneric.S
 $(obj)/csumpartialcopyuser.o:	$(obj)/csumpartialcopygeneric.S
diff -Nru a/arch/arm/lib/io-acorn.S b/arch/arm/lib/io-acorn.S
--- a/arch/arm/lib/io-acorn.S	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/lib/io-acorn.S	Tue Jun 15 22:20:37 2004
@@ -17,31 +17,6 @@
 		.text
 		.align
 
-		.equ	diff_pcio_base, PCIO_BASE - IO_BASE
-
-		.macro	outw2	rd
-		mov	r8, \rd, lsl #16
-		orr	r8, r8, r8, lsr #16
-		str	r8, [r3, r0, lsl #2]
-		mov	r8, \rd, lsr #16
-		orr	r8, r8, r8, lsl #16
-		str	r8, [r3, r0, lsl #2]
-		.endm
-
-		.macro	inw2	rd, mask, temp
-		ldr	\rd, [r0]
-		and	\rd, \rd, \mask
-		ldr	\temp, [r0]
-		orr	\rd, \rd, \temp, lsl #16
-		.endm
-
-		.macro	addr	rd
-		tst	\rd, #0x80000000
-		mov	\rd, \rd, lsl #2
-		add	\rd, \rd, #IO_BASE
-		addeq	\rd, \rd, #diff_pcio_base
-		.endm
-
 .iosl_warning:
 		.ascii	"<4>insl/outsl not implemented, called from %08lX\0"
 		.align
diff -Nru a/arch/arm/mach-adifcc/irq.c b/arch/arm/mach-adifcc/irq.c
--- a/arch/arm/mach-adifcc/irq.c	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/mach-adifcc/irq.c	Tue Jun 15 22:20:39 2004
@@ -19,8 +19,6 @@
 #include <asm/irq.h>
 #include <asm/hardware.h>
 
-#include <asm/mach-types.h>
-
 static void xs80200_irq_mask (unsigned int irq)
 {
 	long INTCTL;
diff -Nru a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
--- a/arch/arm/mach-clps711x/Kconfig	Tue Jun 15 22:21:02 2004
+++ b/arch/arm/mach-clps711x/Kconfig	Tue Jun 15 22:21:02 2004
@@ -1,16 +1,15 @@
+if ARCH_CLPS711X
 
 menu "CLPS711X/EP721X Implementations"
 
 config ARCH_AUTCPU12
 	bool "AUTCPU12"
-	depends on ARCH_CLPS711X
 	help
 	  Say Y if you intend to run the kernel on the autronix autcpu12
 	  board. This board is based on a Cirrus Logic CS89712.
 
 config ARCH_CDB89712
 	bool "CDB89712"
-	depends on ARCH_CLPS711X
 	help
 	  This is an evaluation board from Cirrus for the CS89712 processor.
 	  The board includes 2 serial ports, Ethernet, IRDA, and expansion
@@ -18,32 +17,27 @@
 
 config ARCH_CEIVA
 	bool "CEIVA"
-	depends on ARCH_CLPS711X
 	help
 	  Say Y here if you intend to run this kernel on the Ceiva/Polaroid
 	  PhotoMax Digital Picture Frame.
 
 config ARCH_CLEP7312
 	bool "CLEP7312"
-	depends on ARCH_CLPS711X
 
 config ARCH_EDB7211
 	bool "EDB7211"
-	depends on ARCH_CLPS711X
 	help
 	  Say Y here if you intend to run this kernel on a Cirrus Logic EDB-7211
 	  evaluation board.
 
 config ARCH_P720T
 	bool "P720T"
-	depends on ARCH_CLPS711X
 	help
 	  Say Y here if you intend to run this kernel on the ARM Prospector
 	  720T.
 
 config ARCH_FORTUNET
 	bool "FORTUNET"
-	depends on ARCH_CLPS711X
 
 # XXX Maybe these should indicate register compatibility
 # instead of being mutually exclusive.
@@ -74,3 +68,4 @@
 
 endmenu
 
+endif
diff -Nru a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
--- a/arch/arm/mach-clps711x/clep7312.c	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/mach-clps711x/clep7312.c	Tue Jun 15 22:20:40 2004
@@ -31,7 +31,6 @@
 	    char **cmdline, struct meminfo *mi)
 {
 	mi->nr_banks=1;
-	mi->end = 0xc0FFFFFF;
 	mi->bank[0].start = 0xc0000000;
 	mi->bank[0].size = 0x01000000;
 	mi->bank[0].node = 0;
diff -Nru a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
--- a/arch/arm/mach-clps711x/fortunet.c	Tue Jun 15 22:20:42 2004
+++ b/arch/arm/mach-clps711x/fortunet.c	Tue Jun 15 22:20:42 2004
@@ -34,7 +34,16 @@
 extern void clps711x_map_io(void);
 extern void clps711x_init_irq(void);
 
-struct meminfo memmap = { 1, 0xC1000000, {{0xC0000000,0x01000000,0}}};
+struct meminfo memmap = {
+	.nr_banks	= 1,
+	.bank		= {
+		{
+			.start	= 0xC0000000,
+			.size	= 0x01000000,
+			.node	= 0
+		},
+	},
+};
 
 typedef struct tag_IMAGE_PARAMS
 {
@@ -53,9 +62,8 @@
 fortunet_fixup(struct machine_desc *desc, struct tag *tags,
 		 char **cmdline, struct meminfo *mi)
 {
-	IMAGE_PARAMS *ip;
-	ip = (IMAGE_PARAMS *)__phys_to_virt(IMAGE_PARAMS_PHYS);
-	*cmdline = (char *)__phys_to_virt(ip->command_line);
+	IMAGE_PARAMS *ip = phys_to_virt(IMAGE_PARAMS_PHYS);
+	*cmdline = phys_to_virt(ip->command_line);
 #ifdef CONFIG_BLK_DEV_INITRD
 	if(ip->ramdisk_ok)
 	{
@@ -64,7 +72,6 @@
 	}
 #endif
 	memmap.bank[0].size = ip->ram_size;
-	memmap.end = ip->ram_size+0xC0000000;
 	*mi = memmap;
 }
 
diff -Nru a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c
--- a/arch/arm/mach-ebsa110/io.c	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/mach-ebsa110/io.c	Tue Jun 15 22:20:39 2004
@@ -67,9 +67,9 @@
 	u32 ret, a = __isamem_convert_addr(addr);
 
 	if ((int)addr & 1)
-		ret = __raw_getl(a);
+		ret = __raw_readl(a);
 	else
-		ret = __raw_getb(a);
+		ret = __raw_readb(a);
 	return ret;
 }
 
@@ -80,7 +80,7 @@
 	if ((int)addr & 1)
 		BUG();
 
-	return __raw_getw(a);
+	return __raw_readw(a);
 }
 
 u32 __readl(void *addr)
@@ -90,8 +90,8 @@
 	if ((int)addr & 3)
 		BUG();
 
-	ret = __raw_getw(a);
-	ret |= __raw_getw(a + 4) << 16;
+	ret = __raw_readw(a);
+	ret |= __raw_readw(a + 4) << 16;
 	return ret;
 }
 
@@ -104,9 +104,9 @@
 	u32 a = __isamem_convert_addr(addr);
 
 	if ((int)addr & 1)
-		__raw_putl(val, a);
+		__raw_writel(val, a);
 	else
-		__raw_putb(val, a);
+		__raw_writeb(val, a);
 }
 
 void __writew(u16 val, void *addr)
@@ -116,7 +116,7 @@
 	if ((int)addr & 1)
 		BUG();
 
-	__raw_putw(val, a);
+	__raw_writew(val, a);
 }
 
 void __writel(u32 val, void *addr)
@@ -126,8 +126,8 @@
 	if ((int)addr & 3)
 		BUG();
 
-	__raw_putw(val, a);
-	__raw_putw(val >> 16, a + 4);
+	__raw_writew(val, a);
+	__raw_writew(val >> 16, a + 4);
 }
 
 EXPORT_SYMBOL(__writeb);
@@ -147,7 +147,7 @@
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		ret = __raw_getb(ISAIO_BASE + (port << 2));
+		ret = __raw_readb(ISAIO_BASE + (port << 2));
 	else {
 		u32 a = ISAIO_BASE + ((port & ~1) << 1);
 
@@ -155,9 +155,9 @@
 		 * Shame nothing else does
 		 */
 		if (port & 1)
-			ret = __raw_getl(a);
+			ret = __raw_readl(a);
 		else
-			ret = __raw_getb(a);
+			ret = __raw_readb(a);
 	}
 	return ret;
 }
@@ -170,7 +170,7 @@
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		ret = __raw_getw(ISAIO_BASE + (port << 2));
+		ret = __raw_readw(ISAIO_BASE + (port << 2));
 	else {
 		u32 a = ISAIO_BASE + ((port & ~1) << 1);
 
@@ -180,7 +180,7 @@
 		if (port & 1)
 			BUG();
 
-		ret = __raw_getw(a);
+		ret = __raw_readw(a);
 	}
 	return ret;
 }
@@ -201,7 +201,7 @@
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		__raw_putb(val, ISAIO_BASE + (port << 2));
+		__raw_writeb(val, ISAIO_BASE + (port << 2));
 	else {
 		u32 a = ISAIO_BASE + ((port & ~1) << 1);
 
@@ -209,9 +209,9 @@
 		 * Shame nothing else does
 		 */
 		if (port & 1)
-			__raw_putl(val, a);
+			__raw_writel(val, a);
 		else
-			__raw_putb(val, a);
+			__raw_writeb(val, a);
 	}
 }
 
@@ -230,7 +230,7 @@
 			BUG();
 
 	}
-	__raw_putw(val, ISAIO_BASE + off);
+	__raw_writew(val, ISAIO_BASE + off);
 }
 
 void __outl(u32 val, int port)
diff -Nru a/arch/arm/mach-epxa10db/Kconfig b/arch/arm/mach-epxa10db/Kconfig
--- a/arch/arm/mach-epxa10db/Kconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/arm/mach-epxa10db/Kconfig	Tue Jun 15 22:20:41 2004
@@ -1,17 +1,16 @@
+if ARCH_CAMELOT
 
 menu "Epxa10db"
 
 comment "PLD hotswap support"
-	depends on ARCH_CAMELOT
 
 config PLD
 	bool
-	depends on ARCH_CAMELOT
 	default y
 
 config PLD_HOTSWAP
 	bool "Support for PLD device hotplugging (experimental)"
-	depends on ARCH_CAMELOT && EXPERIMENTAL
+	depends on EXPERIMENTAL
 	help
 	  This enables support for the dynamic loading and configuration of
 	  compatible drivers when the contents of the PLD are changed. This
@@ -21,3 +20,4 @@
 
 endmenu
 
+endif
diff -Nru a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig
--- a/arch/arm/mach-footbridge/Kconfig	Tue Jun 15 22:21:03 2004
+++ b/arch/arm/mach-footbridge/Kconfig	Tue Jun 15 22:21:03 2004
@@ -1,9 +1,9 @@
+if ARCH_FOOTBRIDGE
 
 menu "Footbridge Implementations"
 
 config ARCH_CATS
 	bool "CATS"
-	depends on ARCH_FOOTBRIDGE
 	help
 	  Say Y here if you intend to run this kernel on the CATS.
 
@@ -11,7 +11,6 @@
 
 config ARCH_PERSONAL_SERVER
 	bool "Compaq Personal Server"
-	depends on ARCH_FOOTBRIDGE
 	---help---
 	  Say Y here if you intend to run this kernel on the Compaq
 	  Personal Server.
@@ -29,7 +28,6 @@
 
 config ARCH_EBSA285_ADDIN
 	bool "EBSA285 (addin mode)"
-	depends on ARCH_FOOTBRIDGE
 	help
 	  Say Y here if you intend to run this kernel on the EBSA285 card
 	  in addin mode.
@@ -38,7 +36,6 @@
 
 config ARCH_EBSA285_HOST
 	bool "EBSA285 (host mode)"
-	depends on ARCH_FOOTBRIDGE
 	help
 	  Say Y here if you intend to run this kernel on the EBSA285 card
 	  in host ("central function") mode.
@@ -47,7 +44,6 @@
 
 config ARCH_NETWINDER
 	bool "NetWinder"
-	depends on ARCH_FOOTBRIDGE
 	help
 	  Say Y here if you intend to run this kernel on the Rebel.COM
 	  NetWinder.  Information about this machine can be found at:
@@ -58,3 +54,4 @@
 
 endmenu
 
+endif
diff -Nru a/arch/arm/mach-footbridge/mm.c b/arch/arm/mach-footbridge/mm.c
--- a/arch/arm/mach-footbridge/mm.c	Tue Jun 15 22:20:43 2004
+++ b/arch/arm/mach-footbridge/mm.c	Tue Jun 15 22:20:43 2004
@@ -87,6 +87,7 @@
 
 	return (res - PAGE_OFFSET) + (*CSR_PCISDRAMBASE & 0xfffffff0);
 }
+EXPORT_SYMBOL(__virt_to_bus);
 
 unsigned long __bus_to_virt(unsigned long res)
 {
@@ -97,5 +98,6 @@
 
 	return res;
 }
+EXPORT_SYMBOL(__bus_to_virt);
 
 #endif
diff -Nru a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
--- a/arch/arm/mach-integrator/Kconfig	Tue Jun 15 22:20:44 2004
+++ b/arch/arm/mach-integrator/Kconfig	Tue Jun 15 22:20:44 2004
@@ -1,5 +1,6 @@
+if ARCH_INTEGRATOR
+
 menu "Integrator Options"
-	depends on ARCH_INTEGRATOR
 
 config ARCH_INTEGRATOR_AP
 	bool "Support Integrator/AP and Integrator/PP2 platforms"
@@ -28,3 +29,5 @@
 	  module will be called impd1.
 
 endmenu
+
+endif
diff -Nru a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
--- a/arch/arm/mach-integrator/core.c	Tue Jun 15 22:20:42 2004
+++ b/arch/arm/mach-integrator/core.c	Tue Jun 15 22:20:42 2004
@@ -108,7 +108,7 @@
 
 #define CM_CTRL	IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
 
-static spinlock_t cm_lock;
+static spinlock_t cm_lock = SPIN_LOCK_UNLOCKED;
 
 /**
  * cm_control - update the CM_CTRL register.
diff -Nru a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c
--- a/arch/arm/mach-integrator/cpu.c	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/mach-integrator/cpu.c	Tue Jun 15 22:20:40 2004
@@ -152,10 +152,10 @@
 	return 0;
 }
 
-static int integrator_cpufreq_init(struct cpufreq_policy *policy)
+static unsigned int integrator_get(unsigned int cpu)
 {
 	unsigned long cpus_allowed;
-	unsigned int cpu = policy->cpu;
+	unsigned int current_freq;
 	u_int cm_osc;
 	struct icst525_vco vco;
 
@@ -175,15 +175,22 @@
 	vco.v = cm_osc & 255;
 	vco.r = 22;
 
+	current_freq = icst525_khz(&cclk_params, vco); /* current freq */
+
+	set_cpus_allowed(current, cpus_allowed);
+
+	return current_freq;
+}
+
+static int integrator_cpufreq_init(struct cpufreq_policy *policy)
+{
+
 	/* set default policy and cpuinfo */
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
 	policy->cpuinfo.max_freq = 160000;
 	policy->cpuinfo.min_freq = 12000;
 	policy->cpuinfo.transition_latency = 1000000; /* 1 ms, assumed */
-	policy->cur = policy->min = policy->max =
-		icst525_khz(&cclk_params, vco); /* current freq */
-
-	set_cpus_allowed(current, cpus_allowed);
+	policy->cur = policy->min = policy->max = integrator_get(policy->cpu);
 
 	return 0;
 }
@@ -191,6 +198,7 @@
 static struct cpufreq_driver integrator_driver = {
 	.verify		= integrator_verify_policy,
 	.target		= integrator_set_target,
+	.get		= integrator_get,
 	.init		= integrator_cpufreq_init,
 	.name		= "integrator",
 };
diff -Nru a/arch/arm/mach-iop3xx/Kconfig b/arch/arm/mach-iop3xx/Kconfig
--- a/arch/arm/mach-iop3xx/Kconfig	Tue Jun 15 22:21:04 2004
+++ b/arch/arm/mach-iop3xx/Kconfig	Tue Jun 15 22:21:04 2004
@@ -1,10 +1,10 @@
+if ARCH_IOP3XX
 
 menu "IOP3xx Implementation Options"
 
 choice
 	prompt "IOP3xx System Type"
 	default ARCH_IQ80310
-	depends on ARCH_IOP3XX
 
 config ARCH_IQ80310
 	bool "IQ80310"
@@ -36,19 +36,20 @@
 
 config IOP3XX_AAU
 	bool "Support Intel IOP3xx Application Accelerator Unit (EXPERIMENTAL)"
-	depends on ARCH_IOP3XX && EXPERIMENTAL
+	depends on EXPERIMENTAL
 
 config IOP3XX_DMA
 	bool "Support Intel IOP3xx DMA (EXPERIMENTAL)"
-	depends on ARCH_IOP3XX && EXPERIMENTAL
+	depends on EXPERIMENTAL
 
 config IOP3XX_MU
 	bool "Support Intel IOP3xx Messaging Unit (EXPERIMENTAL)"
-	depends on ARCH_IOP3XX && EXPERIMENTAL
+	depends on EXPERIMENTAL
 
 config IOP3XX_PMON
 	bool "Support Intel IOP3xx Performance Monitor (EXPERIMENTAL)"
-	depends on ARCH_IOP3XX && EXPERIMENTAL
+	depends on EXPERIMENTAL
 
 endmenu
 
+endif
diff -Nru a/arch/arm/mach-iop3xx/iop310-irq.c b/arch/arm/mach-iop3xx/iop310-irq.c
--- a/arch/arm/mach-iop3xx/iop310-irq.c	Tue Jun 15 22:20:58 2004
+++ b/arch/arm/mach-iop3xx/iop310-irq.c	Tue Jun 15 22:20:58 2004
@@ -21,8 +21,6 @@
 #include <asm/irq.h>
 #include <asm/hardware.h>
 
-#include <asm/mach-types.h>
-
 extern void xs80200_irq_mask(unsigned int);
 extern void xs80200_irq_unmask(unsigned int);
 extern void xs80200_init_irq(void);
diff -Nru a/arch/arm/mach-iop3xx/iop321-time.c b/arch/arm/mach-iop3xx/iop321-time.c
--- a/arch/arm/mach-iop3xx/iop321-time.c	Tue Jun 15 22:20:44 2004
+++ b/arch/arm/mach-iop3xx/iop321-time.c	Tue Jun 15 22:20:44 2004
@@ -23,7 +23,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
-#include <asm/mach-types.h>
 #include <asm/mach/irq.h>
 
 static unsigned long iop321_gettimeoffset(void)
diff -Nru a/arch/arm/mach-iop3xx/iq80310-irq.c b/arch/arm/mach-iop3xx/iq80310-irq.c
--- a/arch/arm/mach-iop3xx/iq80310-irq.c	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/mach-iop3xx/iq80310-irq.c	Tue Jun 15 22:20:37 2004
@@ -22,8 +22,6 @@
 #include <asm/hardware.h>
 #include <asm/system.h>
 
-#include <asm/mach-types.h>
-
 extern void iop310_init_irq(void);
 extern void iop310_irq_demux(unsigned int, struct irqdesc *, struct pt_regs *);
 
diff -Nru a/arch/arm/mach-iop3xx/iq80310-time.c b/arch/arm/mach-iop3xx/iq80310-time.c
--- a/arch/arm/mach-iop3xx/iq80310-time.c	Tue Jun 15 22:20:43 2004
+++ b/arch/arm/mach-iop3xx/iq80310-time.c	Tue Jun 15 22:20:43 2004
@@ -21,7 +21,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
-#include <asm/mach-types.h>
 #include <asm/mach/irq.h>
 
 static void iq80310_write_timer (u_long val)
diff -Nru a/arch/arm/mach-iop3xx/mm-321.c b/arch/arm/mach-iop3xx/mm-321.c
--- a/arch/arm/mach-iop3xx/mm-321.c	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/mach-iop3xx/mm-321.c	Tue Jun 15 22:20:40 2004
@@ -21,7 +21,6 @@
 #include <asm/page.h>
 
 #include <asm/mach/map.h>
-#include <asm/mach-types.h>
 
 
 /*
diff -Nru a/arch/arm/mach-iop3xx/mm.c b/arch/arm/mach-iop3xx/mm.c
--- a/arch/arm/mach-iop3xx/mm.c	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/mach-iop3xx/mm.c	Tue Jun 15 22:20:37 2004
@@ -23,7 +23,6 @@
 #include <asm/page.h>
 
 #include <asm/mach/map.h>
-#include <asm/mach-types.h>
 
 #ifdef CONFIG_IOP310_MU
 #include "message.h"
diff -Nru a/arch/arm/mach-iop3xx/xs80200-irq.c b/arch/arm/mach-iop3xx/xs80200-irq.c
--- a/arch/arm/mach-iop3xx/xs80200-irq.c	Tue Jun 15 22:20:41 2004
+++ b/arch/arm/mach-iop3xx/xs80200-irq.c	Tue Jun 15 22:20:41 2004
@@ -17,8 +17,6 @@
 #include <asm/irq.h>
 #include <asm/hardware.h>
 
-#include <asm/mach-types.h>
-
 static void xs80200_irq_mask (unsigned int irq)
 {
 	unsigned long intctl;
diff -Nru a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/Kconfig	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,86 @@
+if ARCH_IXP4XX
+
+config ARCH_SUPPORTS_BIG_ENDIAN
+	bool
+	default y
+
+menu "Intel IXP4xx Implementation Options"
+
+comment "IXP4xx Platforms"
+
+config ARCH_AVILA
+	bool "Avila"
+	help
+	  Say 'Y' here if you want your kernel to support the Gateworks
+	  Avila Network Platform. For more information on this platform,
+	  see Documentation/arm/IXP4xx.
+
+config ARCH_ADI_COYOTE
+	bool "Coyote"
+	help
+	  Say 'Y' here if you want your kernel to support the ADI 
+	  Engineering Coyote Gateway Reference Platform. For more
+	  information on this platform, see Documentation/arm/IXP4xx.
+
+config ARCH_IXDP425
+	bool "IXDP425"
+	help
+	  Say 'Y' here if you want your kernel to support Intel's 
+	  IXDP425 Development Platform (Also known as Richfield).  
+	  For more information on this platform, see Documentation/arm/IXP4xx.
+
+#
+# IXCDP1100 is the exact same HW as IXDP425, but with a different machine 
+# number from the bootloader due to marketing monkeys, so we just enable it 
+# by default if IXDP425 is enabled.
+#
+config ARCH_IXCDP1100
+	bool 
+	depends on ARCH_IXDP425
+	default y
+
+config ARCH_PRPMC1100
+	bool "PrPMC1100"
+	help
+	  Say 'Y' here if you want your kernel to support the Motorola
+	  PrPCM1100 Processor Mezanine Module. For more information on
+	  this platform, see Documentation/arm/IXP4xx.
+
+#
+# Avila and IXDP share the same source for now. Will change in future
+#
+config	ARCH_IXDP4XX
+	bool
+	depends on ARCH_IXDP425 || ARCH_AVILA
+	default y
+
+comment "IXP4xx Options"
+
+config IXP4XX_INDIRECT_PCI
+	bool "Use indirect PCI memory access"
+	help
+          IXP4xx provides two methods of accessing PCI memory space:
+
+          1) A direct mapped window from 0x48000000 to 0x4bffffff (64MB).
+             To access PCI via this space, we simply ioremap() the BAR
+             into the kernel and we can use the standard read[bwl]/write[bwl]
+             macros. This is the preffered method due to speed but it
+             limits the system to just 64MB of PCI memory. This can be 
+             problamatic if using video cards and other memory-heavy devices.
+          
+          2) If > 64MB of memory space is required, the IXP4xx can be 
+	     configured to use indirect registers to access PCI This allows 
+	     for up to 128MB (0x48000000 to 0x4fffffff) of memory on the bus. 
+	     The disadvantadge of this is that every PCI access requires 
+	     three local register accesses plus a spinlock, but in some 
+	     cases the performance hit is acceptable. In addition, you cannot 
+	     mmap() PCI devices in this case due to the indirect nature
+	     of the PCI window.
+
+	  By default, the direct method is used. Choose this option if you
+	  need to use the indirect method instead. If you don't know
+	  what you need, leave this option unselected.
+
+endmenu
+
+endif
diff -Nru a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/Makefile	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,10 @@
+#
+# Makefile for the linux kernel.
+#
+
+obj-y	+= common.o common-pci.o 
+
+obj-$(CONFIG_ARCH_IXDP4XX)	+= ixdp425-pci.o ixdp425-setup.o
+obj-$(CONFIG_ARCH_ADI_COYOTE)	+= coyote-pci.o coyote-setup.o
+obj-$(CONFIG_ARCH_PRPMC1100)	+= prpmc1100-pci.o prpmc1100-setup.o
+
diff -Nru a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/common-pci.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,543 @@
+/*
+ * arch/arm/mach-ixp4xx/common-pci.c 
+ *
+ * IXP4XX PCI routines for all platforms
+ *
+ * Maintainer: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ * Copyright (C) 2003 Greg Ungerer <gerg@snapgear.com>
+ * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ *
+ * 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/sched.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/interrupt.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <asm/dma-mapping.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/sizes.h>
+#include <asm/system.h>
+#include <asm/mach/pci.h>
+#include <asm/hardware.h>
+#include <asm/sizes.h>
+
+
+/*
+ * IXP4xx PCI read function is dependent on whether we are 
+ * running A0 or B0 (AppleGate) silicon.
+ */
+int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);
+
+/*
+ * Base address for PCI regsiter region
+ */
+unsigned long ixp4xx_pci_reg_base = 0;
+
+/*
+ * PCI cfg an I/O routines are done by programming a 
+ * command/byte enable register, and then read/writing
+ * the data from a data regsiter. We need to ensure
+ * these transactions are atomic or we will end up
+ * with corrupt data on the bus or in a driver.
+ */
+static spinlock_t ixp4xx_pci_lock = SPIN_LOCK_UNLOCKED;
+
+/*
+ * Read from PCI config space
+ */
+static void crp_read(u32 ad_cbe, u32 *data)
+{
+	unsigned long flags;
+	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+	*PCI_CRP_AD_CBE = ad_cbe;
+	*data = *PCI_CRP_RDATA;
+	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+}
+
+/*
+ * Write to PCI config space
+ */
+static void crp_write(u32 ad_cbe, u32 data)
+{ 
+	unsigned long flags;
+	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+	*PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe;
+	*PCI_CRP_WDATA = data;
+	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+}
+
+static inline int check_master_abort(void)
+{
+	/* check Master Abort bit after access */
+	unsigned long isr = *PCI_ISR;
+
+	if (isr & PCI_ISR_PFE) {
+		/* make sure the Master Abort bit is reset */    
+		*PCI_ISR = PCI_ISR_PFE;
+		pr_debug("%s failed\n", __FUNCTION__);
+		return 1;
+	}
+
+	return 0;
+}
+
+int ixp4xx_pci_read_errata(u32 addr, u32 cmd, u32* data)
+{
+	unsigned long flags;
+	int retval = 0;
+	int i;
+
+	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+
+	*PCI_NP_AD = addr;
+
+	/* 
+	 * PCI workaround  - only works if NP PCI space reads have 
+	 * no side effects!!! Read 8 times. last one will be good.
+	 */
+	for (i = 0; i < 8; i++) {
+		*PCI_NP_CBE = cmd;
+		*data = *PCI_NP_RDATA;
+		*data = *PCI_NP_RDATA;
+	}
+
+	if(check_master_abort())
+		retval = 1;
+
+	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+	return retval;
+}
+
+int ixp4xx_pci_read_no_errata(u32 addr, u32 cmd, u32* data)
+{
+	unsigned long flags;
+	int retval = 0;
+
+	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+
+	*PCI_NP_AD = addr;
+
+	/* set up and execute the read */    
+	*PCI_NP_CBE = cmd;
+
+	/* the result of the read is now in NP_RDATA */
+	*data = *PCI_NP_RDATA; 
+
+	if(check_master_abort())
+		retval = 1;
+
+	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+	return retval;
+}
+
+int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data)
+{    
+	unsigned long flags;
+	int retval = 0;
+
+	spin_lock_irqsave(&ixp4xx_pci_lock, flags);
+
+	*PCI_NP_AD = addr;
+
+	/* set up the write */
+	*PCI_NP_CBE = cmd;
+
+	/* execute the write by writing to NP_WDATA */
+	*PCI_NP_WDATA = data;
+
+	if(check_master_abort())
+		retval = 1;
+
+	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
+	return retval;
+}
+
+static u32 ixp4xx_config_addr(u8 bus_num, u16 devfn, int where)
+{
+	u32 addr;
+	if (!bus_num) {
+		/* type 0 */
+		addr = BIT(32-PCI_SLOT(devfn)) | ((PCI_FUNC(devfn)) << 8) | 
+		    (where & ~3);	
+	} else {
+		/* type 1 */
+		addr = (bus_num << 16) | ((PCI_SLOT(devfn)) << 11) | 
+			((PCI_FUNC(devfn)) << 8) | (where & ~3) | 1;
+	}
+	return addr;
+}
+
+/*
+ * Mask table, bits to mask for quantity of size 1, 2 or 4 bytes.
+ * 0 and 3 are not valid indexes...
+ */
+static u32 bytemask[] = {
+	/*0*/	0,
+	/*1*/	0xff,
+	/*2*/	0xffff,
+	/*3*/	0,
+	/*4*/	0xffffffff,
+};
+
+static u32 local_byte_lane_enable_bits(u32 n, int size)
+{
+	if (size == 1)
+		return (0xf & ~BIT(n)) << CRP_AD_CBE_BESL;
+	if (size == 2)
+		return (0xf & ~(BIT(n) | BIT(n+1))) << CRP_AD_CBE_BESL;
+	if (size == 4)
+		return 0;
+	return 0xffffffff;
+}
+
+static int local_read_config(int where, int size, u32 *value)
+{ 
+	u32 n, data;
+	pr_debug("local_read_config from %d size %d\n", where, size);
+	n = where % 4;
+	crp_read(where & ~3, &data);
+	*value = (data >> (8*n)) & bytemask[size];
+	pr_debug("local_read_config read %#x\n", *value);
+	return PCIBIOS_SUCCESSFUL;
+}
+
+static int local_write_config(int where, int size, u32 value)
+{
+	u32 n, byte_enables, data;
+	pr_debug("local_write_config %#x to %d size %d\n", value, where, size);
+	n = where % 4;
+	byte_enables = local_byte_lane_enable_bits(n, size);
+	if (byte_enables == 0xffffffff)
+		return PCIBIOS_BAD_REGISTER_NUMBER;
+	data = value << (8*n);
+	crp_write((where & ~3) | byte_enables, data);
+	return PCIBIOS_SUCCESSFUL;
+}
+
+static u32 byte_lane_enable_bits(u32 n, int size)
+{
+	if (size == 1)
+		return (0xf & ~BIT(n)) << 4;
+	if (size == 2)
+		return (0xf & ~(BIT(n) | BIT(n+1))) << 4;
+	if (size == 4)
+		return 0;
+	return 0xffffffff;
+}
+
+static int read_config(u8 bus_num, u16 devfn, int where, int size, u32 *value)
+{
+	u32 n, byte_enables, addr, data;
+
+	pr_debug("read_config from %d size %d dev %d:%d:%d\n", where, size,
+		bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn));
+
+	*value = 0xffffffff;
+	n = where % 4;
+	byte_enables = byte_lane_enable_bits(n, size);
+	if (byte_enables == 0xffffffff)
+		return PCIBIOS_BAD_REGISTER_NUMBER;
+
+	addr = ixp4xx_config_addr(bus_num, devfn, where);
+	if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_CONFIGREAD, &data))
+		return PCIBIOS_DEVICE_NOT_FOUND;
+
+	*value = (data >> (8*n)) & bytemask[size];
+	pr_debug("read_config_byte read %#x\n", *value);
+	return PCIBIOS_SUCCESSFUL;
+}
+
+static int write_config(u8 bus_num, u16 devfn, int where, int size, u32 value)
+{
+	u32 n, byte_enables, addr, data;
+
+	pr_debug("write_config_byte %#x to %d size %d dev %d:%d:%d\n", value, where,
+		size, bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn));
+
+	n = where % 4;
+	byte_enables = byte_lane_enable_bits(n, size);
+	if (byte_enables == 0xffffffff)
+		return PCIBIOS_BAD_REGISTER_NUMBER;
+
+	addr = ixp4xx_config_addr(bus_num, devfn, where);
+	data = value << (8*n);
+	if (ixp4xx_pci_write(addr, byte_enables | NP_CMD_CONFIGWRITE, data))
+		return PCIBIOS_DEVICE_NOT_FOUND;
+
+	return PCIBIOS_SUCCESSFUL;
+}
+
+/*
+ *	Generalized PCI config access functions.
+ */
+static int ixp4xx_read_config(struct pci_bus *bus, unsigned int devfn,
+	int where, int size, u32 *value)
+{
+	if (bus->number && !PCI_SLOT(devfn))
+		return local_read_config(where, size, value);
+	return read_config(bus->number, devfn, where, size, value);
+}
+
+static int ixp4xx_write_config(struct pci_bus *bus, unsigned int devfn,
+	int where, int size, u32 value)
+{
+	if (bus->number && !PCI_SLOT(devfn))
+		return local_write_config(where, size, value);
+	return write_config(bus->number, devfn, where, size, value);
+}
+
+struct pci_ops ixp4xx_ops = {
+	.read =  ixp4xx_read_config,
+	.write = ixp4xx_write_config,
+};
+
+
+/*
+ * PCI abort handler
+ */
+static int abort_handler(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+{
+	u32 isr, status;
+
+	isr = *PCI_ISR;
+	local_read_config(PCI_STATUS, 2, &status);
+	pr_debug("PCI: abort_handler addr = %#lx, isr = %#x, "
+		"status = %#x\n", addr, isr, status);
+
+	/* make sure the Master Abort bit is reset */    
+	*PCI_ISR = PCI_ISR_PFE;
+	status |= PCI_STATUS_REC_MASTER_ABORT;
+	local_write_config(PCI_STATUS, 2, status);
+
+	/*
+	 * If it was an imprecise abort, then we need to correct the
+	 * return address to be _after_ the instruction.
+	 */
+	if (fsr & (1 << 10))
+		regs->ARM_pc += 4;
+
+	return 0;
+}
+
+
+/*
+ * Setup DMA mask to 64MB on PCI devices. Ignore all other devices.
+ */
+static int ixp4xx_pci_platform_notify(struct device *dev)
+{
+	if(dev->bus == &pci_bus_type) {
+		*dev->dma_mask =  SZ_64M - 1;
+		dev->coherent_dma_mask = SZ_64M - 1;
+		dmabounce_register_dev(dev, 2048, 4096);
+	}
+	return 0;
+}
+
+static int ixp4xx_pci_platform_notify_remove(struct device *dev)
+{
+	if(dev->bus == &pci_bus_type) {
+		dmabounce_unregister_dev(dev);
+	}
+	return 0;
+}
+
+int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
+{
+	return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M);
+}
+
+void __init ixp4xx_pci_preinit(void)
+{  
+	unsigned long processor_id;
+
+	asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
+
+	/*
+	 * Determine which PCI read method to use
+	 */
+	if (!(processor_id & 0xf)) {
+		printk("PCI: IXP4xx A0 silicon detected - "
+			"PCI Non-Prefetch Workaround Enabled\n");
+		ixp4xx_pci_read = ixp4xx_pci_read_errata;
+	} else
+		ixp4xx_pci_read = ixp4xx_pci_read_no_errata;
+
+
+	/* hook in our fault handler for PCI errors */
+	hook_fault_code(16+6, abort_handler, SIGBUS, "imprecise external abort");
+
+	pr_debug("setup PCI-AHB(inbound) and AHB-PCI(outbound) address mappings\n");
+
+	/* 
+	 * We use identity AHB->PCI address translation
+	 * in the 0x48000000 to 0x4bffffff address space
+	 */
+	*PCI_PCIMEMBASE = 0x48494A4B;
+
+	/* 
+	 * We also use identity PCI->AHB address translation
+	 * in 4 16MB BARs that begin at the physical memory start
+	 */
+	*PCI_AHBMEMBASE = (PHYS_OFFSET & 0xFF000000) + 
+		((PHYS_OFFSET & 0xFF000000) >> 8) +
+		((PHYS_OFFSET & 0xFF000000) >> 16) +
+		((PHYS_OFFSET & 0xFF000000) >> 24) +
+		0x00010203;
+
+	if (*PCI_CSR & PCI_CSR_HOST) {
+		printk("PCI: IXP4xx is host\n");
+
+		pr_debug("setup BARs in controller\n");
+
+		/*
+		 * We configure the PCI inbound memory windows to be 
+		 * 1:1 mapped to SDRAM
+		 */
+		local_write_config(PCI_BASE_ADDRESS_0, 4, PHYS_OFFSET + 0x00000000);
+		local_write_config(PCI_BASE_ADDRESS_1, 4, PHYS_OFFSET + 0x01000000);
+		local_write_config(PCI_BASE_ADDRESS_2, 4, PHYS_OFFSET + 0x02000000);
+		local_write_config(PCI_BASE_ADDRESS_3, 4, PHYS_OFFSET + 0x03000000);
+
+		/*
+		 * Enable CSR window at 0xff000000.
+		 */
+		local_write_config(PCI_BASE_ADDRESS_4, 4, 0xff000008);
+
+		/*
+		 * Enable the IO window to be way up high, at 0xfffffc00
+		 */
+		local_write_config(PCI_BASE_ADDRESS_5, 4, 0xfffffc01);
+	} else {
+		printk("PCI: IXP4xx is target - No bus scan performed\n");
+	}
+
+	printk("PCI: IXP4xx Using %s access for memory space\n",
+#ifndef CONFIG_IXP4XX_INDIRECT_PCI
+			"direct"
+#else
+			"indirect"
+#endif
+		);
+
+	pr_debug("clear error bits in ISR\n");
+	*PCI_ISR = PCI_ISR_PSE | PCI_ISR_PFE | PCI_ISR_PPE | PCI_ISR_AHBE;
+
+	/*
+	 * Set Initialize Complete in PCI Control Register: allow IXP4XX to
+	 * respond to PCI configuration cycles. Specify that the AHB bus is
+	 * operating in big endian mode. Set up byte lane swapping between 
+	 * little-endian PCI and the big-endian AHB bus 
+	 */
+#ifdef __ARMEB__
+	*PCI_CSR = PCI_CSR_IC | PCI_CSR_ABE | PCI_CSR_PDS | PCI_CSR_ADS;
+#else
+	*PCI_CSR = PCI_CSR_IC;
+#endif
+
+	pr_debug("DONE\n");
+}
+
+int ixp4xx_setup(int nr, struct pci_sys_data *sys)
+{
+	struct resource *res;
+
+	if (nr >= 1)
+		return 0;
+
+	res = kmalloc(sizeof(*res) * 2, GFP_KERNEL);
+	if (res == NULL) {
+		/* 
+		 * If we're out of memory this early, something is wrong,
+		 * so we might as well catch it here.
+		 */
+		panic("PCI: unable to allocate resources?\n");
+	}
+	memset(res, 0, sizeof(*res) * 2);
+
+	local_write_config(PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
+
+	res[0].name = "PCI I/O Space";
+	res[0].start = 0x00001000;
+	res[0].end = 0xffff0000;
+	res[0].flags = IORESOURCE_IO;
+
+	res[1].name = "PCI Memory Space";
+	res[1].start = 0x48000000;
+#ifndef CONFIG_IXP4XX_INDIRECT_PCI
+	res[1].end = 0x4bffffff;
+#else
+	res[1].end = 0x4fffffff;
+#endif
+	res[1].flags = IORESOURCE_MEM;
+
+	request_resource(&ioport_resource, &res[0]);
+	request_resource(&iomem_resource, &res[1]);
+
+	sys->resource[0] = &res[0];
+	sys->resource[1] = &res[1];
+	sys->resource[2] = NULL;
+
+	platform_notify = ixp4xx_pci_platform_notify;
+	platform_notify_remove = ixp4xx_pci_platform_notify_remove;
+
+	return 1;
+}
+
+struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys)
+{
+	return pci_scan_bus(sys->busnr, &ixp4xx_ops, sys);
+}
+
+/*
+ * We override these so we properly do dmabounce otherwise drivers
+ * are able to set the dma_mask to 0xffffffff and we can no longer
+ * trap bounces. :(
+ *
+ * We just return true on everyhing except for < 64MB in which case 
+ * we will fail miseralby and die since we can't handle that case.
+ */
+int
+pci_set_dma_mask(struct pci_dev *dev, u64 mask)
+{
+	if (mask >= SZ_64M - 1 )
+		return 0;
+
+	return -EIO;
+}
+    
+int
+pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask)
+{
+	if (mask >= SZ_64M - 1 )
+		return 0;
+
+	return -EIO;
+}
+
+int
+pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
+{
+	if (mask >= SZ_64M - 1 )
+		return 0;
+
+	return -EIO;
+}
+
+EXPORT_SYMBOL(pci_set_dma_mask);
+EXPORT_SYMBOL(pci_dac_set_dma_mask);
+EXPORT_SYMBOL(pci_set_consistent_dma_mask);
+
diff -Nru a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/common.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,263 @@
+/*
+ * arch/arm/mach-ixp4xx/common.c
+ *
+ * Generic code shared across all IXP4XX platforms
+ *
+ * Maintainer: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright 2002 (c) Intel Corporation
+ * Copyright 2003-2004 (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/config.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/serial.h>
+#include <linux/sched.h>
+#include <linux/tty.h>
+#include <linux/serial_core.h>
+#include <linux/bootmem.h>
+#include <linux/interrupt.h>
+#include <linux/bitops.h>
+#include <linux/time.h>
+#include <linux/timex.h>
+
+#include <asm/hardware.h>
+#include <asm/uaccess.h>
+#include <asm/io.h>
+#include <asm/pgtable.h>
+#include <asm/page.h>
+#include <asm/irq.h>
+
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+
+/*************************************************************************
+ * GPIO acces functions
+ *************************************************************************/
+
+/*
+ * Configure GPIO line for input, interrupt, or output operation
+ *
+ * TODO: Enable/disable the irq_desc based on interrupt or output mode.
+ * TODO: Should these be named ixp4xx_gpio_?
+ */
+void gpio_line_config(u8 line, u32 style)
+{
+	u32 enable;
+	volatile u32 *int_reg;
+	u32 int_style;
+
+	enable = *IXP4XX_GPIO_GPOER;
+
+	if (style & IXP4XX_GPIO_OUT) {
+		enable &= ~((1) << line);
+	} else if (style & IXP4XX_GPIO_IN) {
+		enable |= ((1) << line);
+
+		switch (style & IXP4XX_GPIO_INTSTYLE_MASK)
+		{
+		case (IXP4XX_GPIO_ACTIVE_HIGH):
+			int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH;
+			break;
+		case (IXP4XX_GPIO_ACTIVE_LOW):
+			int_style = IXP4XX_GPIO_STYLE_ACTIVE_LOW;
+			break;
+		case (IXP4XX_GPIO_RISING_EDGE):
+			int_style = IXP4XX_GPIO_STYLE_RISING_EDGE;
+			break;
+		case (IXP4XX_GPIO_FALLING_EDGE):
+			int_style = IXP4XX_GPIO_STYLE_FALLING_EDGE;
+			break;
+		case (IXP4XX_GPIO_TRANSITIONAL):
+			int_style = IXP4XX_GPIO_STYLE_TRANSITIONAL;
+			break;
+		default:
+			int_style = IXP4XX_GPIO_STYLE_ACTIVE_HIGH;
+			break;
+		}
+
+		if (line >= 8) {	/* pins 8-15 */ 
+			line -= 8;
+			int_reg = IXP4XX_GPIO_GPIT2R;
+		}
+		else {			/* pins 0-7 */
+			int_reg = IXP4XX_GPIO_GPIT1R;
+		}
+
+		/* Clear the style for the appropriate pin */
+		*int_reg &= ~(IXP4XX_GPIO_STYLE_CLEAR << 
+		    		(line * IXP4XX_GPIO_STYLE_SIZE));
+
+		/* Set the new style */
+		*int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));
+	}
+
+	*IXP4XX_GPIO_GPOER = enable;
+}
+
+EXPORT_SYMBOL(gpio_line_config);
+
+/*************************************************************************
+ * IXP4xx chipset I/O mapping
+ *************************************************************************/
+static struct map_desc ixp4xx_io_desc[] __initdata = {
+	{	/* UART, Interrupt ctrl, GPIO, timers, NPEs, MACs, USB .... */
+		.virtual	= IXP4XX_PERIPHERAL_BASE_VIRT,
+		.physical	= IXP4XX_PERIPHERAL_BASE_PHYS,
+		.length		= IXP4XX_PERIPHERAL_REGION_SIZE,
+		.type		= MT_DEVICE
+	}, {	/* Expansion Bus Config Registers */
+		.virtual	= IXP4XX_EXP_CFG_BASE_VIRT,
+		.physical	= IXP4XX_EXP_CFG_BASE_PHYS,
+		.length		= IXP4XX_EXP_CFG_REGION_SIZE,
+		.type		= MT_DEVICE
+	}, {	/* PCI Registers */
+		.virtual	= IXP4XX_PCI_CFG_BASE_VIRT,
+		.physical	= IXP4XX_PCI_CFG_BASE_PHYS,
+		.length		= IXP4XX_PCI_CFG_REGION_SIZE,
+		.type		= MT_DEVICE
+	}
+};
+
+void __init ixp4xx_map_io(void)
+{
+  	iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc));
+}
+
+
+/*************************************************************************
+ * IXP4xx chipset IRQ handling
+ *
+ * TODO: GPIO IRQs should be marked invalid until the user of the IRQ
+ *       (be it PCI or something else) configures that GPIO line
+ *       as an IRQ. Also, we should use a different chip structure for 
+ *       level-based GPIO vs edge-based GPIO. Currently nobody needs this as 
+ *       all HW that's publically available uses level IRQs, so we'll
+ *       worry about it if/when we have HW to test.
+ **************************************************************************/
+static void ixp4xx_irq_mask(unsigned int irq)
+{
+	*IXP4XX_ICMR &= ~(1 << irq);
+}
+
+static void ixp4xx_irq_mask_ack(unsigned int irq)
+{
+	ixp4xx_irq_mask(irq);
+}
+
+static void ixp4xx_irq_unmask(unsigned int irq)
+{
+	static int irq2gpio[NR_IRQS] = {
+		-1, -1, -1, -1, -1, -1,  0,  1,
+		-1, -1, -1, -1, -1, -1, -1, -1,
+		-1, -1, -1,  2,  3,  4,  5,  6,
+		 7,  8,  9, 10, 11, 12, -1, -1,
+	};
+	int line = irq2gpio[irq];
+
+	/*
+	 * This only works for LEVEL gpio IRQs as per the IXP4xx developer's
+	 * manual. If edge-triggered, need to move it to the mask_ack.
+	 * Nobody seems to be using the edge-triggered mode on the GPIOs. 
+	 */
+	if (line >= 0)
+		gpio_line_isr_clear(line);
+
+	*IXP4XX_ICMR |= (1 << irq);
+}
+
+static struct irqchip ixp4xx_irq_chip = {
+	.ack	= ixp4xx_irq_mask_ack,
+	.mask	= ixp4xx_irq_mask,
+	.unmask	= ixp4xx_irq_unmask,
+};
+
+void __init ixp4xx_init_irq(void)
+{
+	int i = 0;
+
+	/* Route all sources to IRQ instead of FIQ */
+	*IXP4XX_ICLR = 0x0;
+
+	/* Disable all interrupt */
+	*IXP4XX_ICMR = 0x0; 
+
+	for(i = 0; i < NR_IRQS; i++)
+	{
+		set_irq_chip(i, &ixp4xx_irq_chip);
+		set_irq_handler(i, do_level_IRQ);
+		set_irq_flags(i, IRQF_VALID);
+	}
+}
+
+
+/*************************************************************************
+ * IXP4xx timer tick
+ * We use OS timer1 on the CPU for the timer tick and the timestamp 
+ * counter as a source of real clock ticks to account for missed jiffies.
+ *************************************************************************/
+
+static unsigned volatile last_jiffy_time;
+
+#define CLOCK_TICKS_PER_USEC	(CLOCK_TICK_RATE / USEC_PER_SEC)
+
+/* IRQs are disabled before entering here from do_gettimeofday() */
+static unsigned long ixp4xx_gettimeoffset(void)
+{
+	u32 elapsed;
+
+	elapsed = *IXP4XX_OSTS - last_jiffy_time;
+
+	return elapsed / CLOCK_TICKS_PER_USEC;
+}
+
+static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+	/* Clear Pending Interrupt by writing '1' to it */
+	*IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
+
+	/*
+	 * Catch up with the real idea of time
+	 */
+	do {	
+		do_timer(regs);
+		last_jiffy_time += LATCH;
+	} while((*IXP4XX_OSTS - last_jiffy_time) > LATCH);
+
+	return IRQ_HANDLED;
+}
+
+extern unsigned long (*gettimeoffset)(void);
+
+static struct irqaction timer_irq = {
+	.name	= "IXP4xx Timer Tick",
+	.flags	= SA_INTERRUPT
+};
+
+void __init time_init(void)
+{
+	gettimeoffset = ixp4xx_gettimeoffset;
+	timer_irq.handler = ixp4xx_timer_interrupt;
+
+	/* Clear Pending Interrupt by writing '1' to it */
+	*IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
+
+	/* Setup the Timer counter value */
+	*IXP4XX_OSRT1 = (LATCH & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE;
+
+	/* Reset time-stamp counter */
+	*IXP4XX_OSTS = 0;
+	last_jiffy_time = 0;
+
+	/* Connect the interrupt handler and enable the interrupt */
+	setup_irq(IRQ_IXP4XX_TIMER1, &timer_irq);
+}
+
+
diff -Nru a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/coyote-pci.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,69 @@
+/*
+ * arch/arch/mach-ixp4xx/coyote-pci.c
+ *
+ * PCI setup routines for ADI Engineering Coyote platform
+ *
+ * Copyright (C) 2002 Jungo Software Technologies.
+ * Copyright (C) 2003 MontaVista Softwrae, Inc.
+ *
+ * Maintainer: Deepak Saxena <dsaxena@mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/pci.h>
+#include <linux/init.h>
+
+#include <asm/mach-types.h>
+#include <asm/hardware.h>
+#include <asm/irq.h>
+
+#include <asm/mach/pci.h>
+
+extern void ixp4xx_pci_preinit(void);
+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
+
+void __init coyote_pci_preinit(void)
+{
+	gpio_line_config(COYOTE_PCI_SLOT0_PIN,
+			IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
+
+	gpio_line_config(COYOTE_PCI_SLOT1_PIN,
+			IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
+
+	gpio_line_isr_clear(COYOTE_PCI_SLOT0_PIN);
+	gpio_line_isr_clear(COYOTE_PCI_SLOT1_PIN);
+
+	ixp4xx_pci_preinit();
+}
+
+static int __init coyote_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+{
+	if (slot == COYOTE_PCI_SLOT0_DEVID)
+		return IRQ_COYOTE_PCI_SLOT0;
+	else if (slot == COYOTE_PCI_SLOT1_DEVID)
+		return IRQ_COYOTE_PCI_SLOT1;
+	else return -1;
+}
+
+struct hw_pci coyote_pci __initdata = {
+	.nr_controllers = 1,
+	.preinit =        coyote_pci_preinit,
+	.swizzle =        pci_std_swizzle,
+	.setup =          ixp4xx_setup,
+	.scan =           ixp4xx_scan_bus,
+	.map_irq =        coyote_map_irq,
+};
+
+int __init coyote_pci_init(void)
+{
+	if (machine_is_adi_coyote())
+		pci_common_init(&coyote_pci);
+	return 0;
+}
+
+subsys_initcall(coyote_pci_init);
diff -Nru a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,90 @@
+/*
+ * arch/arm/mach-ixp4xx/coyote-setup.c
+ *
+ * ADI Engineering Coyote board-setup 
+ *
+ * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ */
+
+#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 Coyote.
+ */
+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)
+{
+	early_serial_setup(&coyote_serial_port);
+
+	ixp4xx_map_io();
+}
+
+static struct flash_platform_data coyote_flash_data = {
+	.map_name	= "cfi_probe",
+	.width		= 2,
+};
+
+static struct resource coyote_flash_resource = {
+	.start		= COYOTE_FLASH_BASE,
+	.end		= COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE,
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device coyote_flash_device = {
+	.name		= "IXP4XX-Flash",
+	.id		= 0,
+	.dev		= {
+		.platform_data = &coyote_flash_data,
+	},
+	.num_resources	= 1,
+	.resource	= &coyote_flash_resource,
+};
+
+static void __init coyote_init(void)
+{
+	platform_add_device(&coyote_flash_device);
+}
+
+MACHINE_START(ADI_COYOTE, "ADI Engineering IXP4XX Coyote Development Platform")
+        MAINTAINER("MontaVista Software, Inc.")
+        BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
+                IXP4XX_PERIPHERAL_BASE_VIRT)
+        MAPIO(coyote_map_io)
+        INITIRQ(ixp4xx_init_irq)
+        BOOT_PARAMS(0x0100)
+	INIT_MACHINE(coyote_init)
+MACHINE_END
+
diff -Nru a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,84 @@
+/*
+ * arch/arm/mach-ixp4xx/ixdp425-pci.c 
+ *
+ * IXDP425 board-level PCI initialization
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ *
+ * Maintainer: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * 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/config.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+
+#include <asm/mach/pci.h>
+#include <asm/irq.h>
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+
+void __init ixdp425_pci_preinit(void)
+{
+	gpio_line_config(IXDP425_PCI_INTA_PIN,
+				IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
+	gpio_line_config(IXDP425_PCI_INTB_PIN, 
+				IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
+	gpio_line_config(IXDP425_PCI_INTC_PIN, 
+				IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
+	gpio_line_config(IXDP425_PCI_INTD_PIN, 
+				IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
+
+	gpio_line_isr_clear(IXDP425_PCI_INTA_PIN);
+	gpio_line_isr_clear(IXDP425_PCI_INTB_PIN);
+	gpio_line_isr_clear(IXDP425_PCI_INTC_PIN);
+	gpio_line_isr_clear(IXDP425_PCI_INTD_PIN);
+
+	ixp4xx_pci_preinit();
+}
+
+static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+{
+	static int pci_irq_table[IXDP425_PCI_IRQ_LINES] = {
+		IRQ_IXDP425_PCI_INTA,
+		IRQ_IXDP425_PCI_INTB,
+		IRQ_IXDP425_PCI_INTC,
+		IRQ_IXDP425_PCI_INTD
+	};
+
+	int irq = -1;
+
+	if (slot >= 1 && slot <= IXDP425_PCI_MAX_DEV && 
+		pin >= 1 && pin <= IXDP425_PCI_IRQ_LINES) {
+		irq = pci_irq_table[(slot + pin - 2) % 4];
+	}
+
+	return irq;
+}
+
+struct hw_pci ixdp425_pci __initdata = {
+	.nr_controllers = 1,
+	.preinit	= ixdp425_pci_preinit,
+	.swizzle	= pci_std_swizzle,
+	.setup		= ixp4xx_setup,
+	.scan		= ixp4xx_scan_bus,
+	.map_irq	= ixdp425_map_irq,
+};
+
+int __init ixdp425_pci_init(void)
+{
+	if (machine_is_ixdp425() || 
+		machine_is_ixcdp1100() || 
+		machine_is_avila())
+		pci_common_init(&ixdp425_pci);
+	return 0;
+}
+
+subsys_initcall(ixdp425_pci_init);
+
diff -Nru a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,147 @@
+/*
+ * arch/arm/mach-ixp4xx/ixdp425-setup.c
+ *
+ * IXDP425/IXCDP1100 board-setup 
+ *
+ * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ */
+
+#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/mach-types.h>
+#include <asm/irq.h>
+#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();
+}
+
+static struct flash_platform_data ixdp425_flash_data = {
+	.map_name	= "cfi_probe",
+	.width		= 2,
+};
+
+static struct resource ixdp425_flash_resource = {
+	.start		= IXDP425_FLASH_BASE,
+	.end		= IXDP425_FLASH_BASE + IXDP425_FLASH_SIZE,
+	.flags		= IORESOURCE_MEM,
+};
+
+static struct platform_device ixdp425_flash_device = {
+	.name		= "IXP4XX-Flash",
+	.id		= 0,
+	.dev		= {
+		.platform_data = &ixdp425_flash_data,
+	},
+	.num_resources	= 1,
+	.resource	= &ixdp425_flash_resource,
+};
+
+static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = {
+	.sda_pin	= IXDP425_SDA_PIN,
+	.scl_pin	= IXDP425_SCL_PIN,
+};
+
+static struct platform_device ixdp425_i2c_controller = {
+	.name		= "IXP4XX-I2C",
+	.id		= 0,
+	.dev		= {
+		.platform_data = &ixdp425_i2c_gpio_pins,
+	},
+	.num_resources	= 0
+};
+
+static void __init ixdp425_init(void)
+{
+	platform_add_device(&ixdp425_flash_device);
+	platform_add_device(&ixdp425_i2c_controller);
+}
+
+MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
+	MAINTAINER("MontaVista Software, Inc.")
+	BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
+		IXP4XX_PERIPHERAL_BASE_VIRT)
+	MAPIO(ixdp425_map_io)
+	INITIRQ(ixp4xx_init_irq)
+	BOOT_PARAMS(0x0100)
+	INIT_MACHINE(ixdp425_init)
+MACHINE_END
+
+MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
+	MAINTAINER("MontaVista Software, Inc.")
+	BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
+		IXP4XX_PERIPHERAL_BASE_VIRT)
+	MAPIO(ixdp425_map_io)
+	INITIRQ(ixp4xx_init_irq)
+	BOOT_PARAMS(0x0100)
+	INIT_MACHINE(ixdp425_init)
+MACHINE_END
+
+/*
+ * Avila is functionally equivalent to IXDP425 except that it adds
+ * a CF IDE slot hanging off the expansion bus. When we have a 
+ * driver for IXP4xx CF IDE with driver model support we'll move
+ * Avila to it's own setup file.
+ */
+#ifdef CONFIG_ARCH_AVILA
+MACHINE_START(AVILA, "Gateworks Avila Network Platform")
+	MAINTAINER("Deepak Saxena <dsaxena@plexity.net>")
+	BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
+		IXP4XX_PERIPHERAL_BASE_VIRT)
+	MAPIO(ixdp425_map_io)
+	INITIRQ(ixp4xx_init_irq)
+	BOOT_PARAMS(0x0100)
+	INIT_MACHINE(ixdp425_init)
+MACHINE_END
+#endif
+
diff -Nru a/arch/arm/mach-ixp4xx/prpmc1100-pci.c b/arch/arm/mach-ixp4xx/prpmc1100-pci.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/prpmc1100-pci.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,119 @@
+/*
+ * 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/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
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-ixp4xx/prpmc1100-setup.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,90 @@
+/*
+ * 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/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_device = {
+	.name		= "IXP4XX-Flash",
+	.id		= 0,
+	.dev		= {
+		.platform_data = &prpmc1100_flash_data,
+	},
+	.num_resources	= 1,
+	.resource	= &prpmc1100_flash_resource,
+};
+
+static void __init prpmc1100_init(void)
+{
+	platform_add_device(&prpmc1100_flash_device);
+}
+
+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)
+        BOOT_PARAMS(0x0100)
+	INIT_MACHINE(prpmc1100_init)
+MACHINE_END
+
diff -Nru a/arch/arm/mach-lh7a40x/Kconfig b/arch/arm/mach-lh7a40x/Kconfig
--- a/arch/arm/mach-lh7a40x/Kconfig	Tue Jun 15 22:20:42 2004
+++ b/arch/arm/mach-lh7a40x/Kconfig	Tue Jun 15 22:20:42 2004
@@ -1,9 +1,9 @@
+if ARCH_LH7A40X
 
 menu "LH7A40X Implementations"
 
 config MACH_KEV7A400
 	bool "KEV7A400"
-	depends on ARCH_LH7A40X
 	select ARCH_LH7A400
 	help
 	  Say Y here if you are using the Sharp KEV7A400 development
@@ -12,9 +12,8 @@
 
 config MACH_LPD7A400
 	bool "LPD7A400 Card Engine"
-	depends on ARCH_LH7A40X
 	select ARCH_LH7A400
-	select IDE_POLL
+#	select IDE_POLL
 	help
 	  Say Y here if you are using Logic Product Development's
 	  LPD7A400 CardEngine.  For the time being, the LPD7A400 and
@@ -22,9 +21,8 @@
 
 config MACH_LPD7A404
 	bool "LPD7A404 Card Engine"
-	depends on ARCH_LH7A40X
 	select ARCH_LH7A404
-	select IDE_POLL
+#	select IDE_POLL
 	help
 	  Say Y here if you are using Logic Product Development's
 	  LPD7A404 CardEngine. For the time being, the LPD7A400 and
@@ -37,3 +35,5 @@
 	bool
 
 endmenu
+
+endif
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	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c	Tue Jun 15 22:20:37 2004
@@ -116,7 +116,12 @@
 
 static void __init lpd7a40x_init (void)
 {
-	CPLD_CONTROL = 0x0;	/* Enable LAN (Disable LCD) */
+	CPLD_CONTROL |=     (1<<6); /* Mask USB1 connection IRQ */
+	CPLD_CONTROL &= ~(0
+			  | (1<<1) /* Disable LCD */
+			  | (1<<0) /* Enable WLAN */
+		);
+
 	platform_add_devices (lpd7a40x_devs, ARRAY_SIZE (lpd7a40x_devs));
 }
 
@@ -191,7 +196,7 @@
 	int pinCPLD = (cpld_version == 0x28) ? 7 : 3;
 
 #if defined CONFIG_MACH_LPD7A404
-	cpld_version = 0x34;	/* Override, for now */
+	cpld_version = 0x34;	/* Coerce LPD7A404 to RevB */
 #endif
 
 		/* First, configure user controlled GPIOF interrupts  */
@@ -204,7 +209,7 @@
 
 		/* Then, configure CPLD interrupt */
 
-	CPLD_INTERRUPTS	=   0x0c; /* Disable all CPLD interrupts */
+	CPLD_INTERRUPTS	=   0x9c; /* Disable all CPLD interrupts */
 	GPIO_PFDD	&= ~(1 << pinCPLD); /* Make input */
 	GPIO_INTTYPE1	|=  (1 << pinCPLD); /* Edge triggered */
 	GPIO_INTTYPE2	&= ~(1 << pinCPLD); /* Active low */
diff -Nru a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
--- a/arch/arm/mach-omap/Kconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/mach-omap/Kconfig	Tue Jun 15 22:20:37 2004
@@ -1,27 +1,24 @@
+if ARCH_OMAP
 
 menu "TI OMAP Implementations"
 
 comment "OMAP Core Type"
 
 config ARCH_OMAP730
-	depends on ARCH_OMAP
 	bool "OMAP730 Based System"
 	select CPU_ARM926T
 
 config ARCH_OMAP1510
-	depends on ARCH_OMAP
 	default y
 	bool "OMAP1510 Based System"
 	select CPU_ARM925T
 	select CPU_DCACHE_WRITETHROUGH
 
 config ARCH_OMAP1610
-	depends on ARCH_OMAP
 	bool "OMAP1610 Based System"
 	select CPU_ARM926T
 
 config ARCH_OMAP5912
-	depends on ARCH_OMAP
 	bool "OMAP5912 Based System"
 	select CPU_ARM926T
 
@@ -87,7 +84,6 @@
 
 #config OMAP_BOOT_TAG
 #	bool "OMAP bootloader information passing"
-#        depends on ARCH_OMAP
 #        default n
 #        help
 #          Say Y, if you have a bootloader which passes information
@@ -95,7 +91,6 @@
 
 config OMAP_MUX
 	bool "OMAP multiplexing support"
-        depends on ARCH_OMAP
 	default y
         help
           Pin multiplexing support for OMAP boards. If your bootloader
@@ -113,7 +108,6 @@
 
 choice
 	prompt "Low-level debug console UART"
-	depends on ARCH_OMAP
 	default OMAP_LL_DEBUG_UART1
 
 config OMAP_LL_DEBUG_UART1
@@ -171,3 +165,5 @@
           Enable 30MHz clock for OMAP CPU. If unsure, say N.
 
 endmenu
+
+endif
diff -Nru a/arch/arm/mach-omap/board-generic.c b/arch/arm/mach-omap/board-generic.c
--- a/arch/arm/mach-omap/board-generic.c	Tue Jun 15 22:20:42 2004
+++ b/arch/arm/mach-omap/board-generic.c	Tue Jun 15 22:20:42 2004
@@ -18,6 +18,7 @@
 #include <linux/device.h>
 
 #include <asm/hardware.h>
+#include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
@@ -64,9 +65,9 @@
 	omap_map_io();
 }
 
-MACHINE_START(OMAP_GENERIC, "Generic OMAP-1510/1610")
+MACHINE_START(OMAP_GENERIC, "Generic OMAP-1510/1610/1710")
 	MAINTAINER("Tony Lindgren <tony@atomide.com>")
-	BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
+	BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
 	BOOT_PARAMS(0x10000100)
 	MAPIO(omap_generic_map_io)
 	INITIRQ(omap_generic_init_irq)
diff -Nru a/arch/arm/mach-omap/board-innovator.c b/arch/arm/mach-omap/board-innovator.c
--- a/arch/arm/mach-omap/board-innovator.c	Tue Jun 15 22:20:36 2004
+++ b/arch/arm/mach-omap/board-innovator.c	Tue Jun 15 22:20:36 2004
@@ -19,8 +19,10 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/delay.h>
 
 #include <asm/hardware.h>
+#include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
@@ -36,14 +38,14 @@
 
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
 static struct map_desc innovator1510_io_desc[] __initdata = {
-{ OMAP1510P1_FPGA_BASE, OMAP1510P1_FPGA_START, OMAP1510P1_FPGA_SIZE,
+{ OMAP1510_FPGA_BASE, OMAP1510_FPGA_START, OMAP1510_FPGA_SIZE,
 	MT_DEVICE },
 };
 
 static struct resource innovator1510_smc91x_resources[] = {
 	[0] = {
-		.start	= OMAP1510P1_FPGA_ETHR_START,	/* Physical */
-		.end	= OMAP1510P1_FPGA_ETHR_START + 16,
+		.start	= OMAP1510_FPGA_ETHR_START,	/* Physical */
+		.end	= OMAP1510_FPGA_ETHR_START + 16,
 		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
@@ -132,12 +134,13 @@
 #ifdef CONFIG_ARCH_OMAP1510
 	if (cpu_is_omap1510()) {
 		iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
+		udelay(10);	/* Delay needed for FPGA */
 
 		/* Dump the Innovator FPGA rev early - useful info for support. */
 		printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
-		       fpga_read(OMAP1510P1_FPGA_REV_HIGH),
-		       fpga_read(OMAP1510P1_FPGA_REV_LOW),
-		       fpga_read(OMAP1510P1_FPGA_BOARD_REV));
+		       fpga_read(OMAP1510_FPGA_REV_HIGH),
+		       fpga_read(OMAP1510_FPGA_REV_LOW),
+		       fpga_read(OMAP1510_FPGA_BOARD_REV));
 	}
 #endif
 #ifdef CONFIG_ARCH_OMAP1610
@@ -149,7 +152,7 @@
 
 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
 	MAINTAINER("MontaVista Software, Inc.")
-	BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
+	BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
 	BOOT_PARAMS(0x10000100)
 	MAPIO(innovator_map_io)
 	INITIRQ(innovator_init_irq)
diff -Nru a/arch/arm/mach-omap/board-osk.c b/arch/arm/mach-omap/board-osk.c
--- a/arch/arm/mach-omap/board-osk.c	Tue Jun 15 22:20:44 2004
+++ b/arch/arm/mach-omap/board-osk.c	Tue Jun 15 22:20:44 2004
@@ -31,6 +31,7 @@
 #include <linux/device.h>
 
 #include <asm/hardware.h>
+#include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
@@ -89,7 +90,7 @@
 
 MACHINE_START(OMAP_OSK, "TI-OSK")
 	MAINTAINER("Dirk Behme <dirk.behme@de.bosch.com>")
-	BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
+	BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
 	BOOT_PARAMS(0x10000100)
 	MAPIO(osk_map_io)
 	INITIRQ(osk_init_irq)
diff -Nru a/arch/arm/mach-omap/board-perseus2.c b/arch/arm/mach-omap/board-perseus2.c
--- a/arch/arm/mach-omap/board-perseus2.c	Tue Jun 15 22:20:43 2004
+++ b/arch/arm/mach-omap/board-perseus2.c	Tue Jun 15 22:20:43 2004
@@ -3,6 +3,9 @@
  *
  * Modified from board-generic.c
  *
+ * Original OMAP730 support by Jean Pihet <j-pihet@ti.com>
+ * Updated for 2.6 by Kevin Hilman <kjh@hilman.org>
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -13,6 +16,7 @@
 #include <linux/device.h>
 
 #include <asm/hardware.h>
+#include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
@@ -102,8 +106,8 @@
 }
 
 MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
-	MAINTAINER("Kevin Hilman <k-hilman@ti.com>")
-	BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
+	MAINTAINER("Kevin Hilman <kjh@hilman.org>")
+	BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
 	BOOT_PARAMS(0x10000100)
 	MAPIO(omap_perseus2_map_io)
 	INITIRQ(omap_perseus2_init_irq)
diff -Nru a/arch/arm/mach-omap/bus.c b/arch/arm/mach-omap/bus.c
--- a/arch/arm/mach-omap/bus.c	Tue Jun 15 22:21:05 2004
+++ b/arch/arm/mach-omap/bus.c	Tue Jun 15 22:21:05 2004
@@ -266,7 +266,7 @@
 	}
 }
 
-module_init(omap_bus_init);
+postcore_initcall(omap_bus_init);
 module_exit(omap_bus_exit);
 
 MODULE_DESCRIPTION("Virtual bus for OMAP");
diff -Nru a/arch/arm/mach-omap/clocks.c b/arch/arm/mach-omap/clocks.c
--- a/arch/arm/mach-omap/clocks.c	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/mach-omap/clocks.c	Tue Jun 15 22:20:40 2004
@@ -84,7 +84,7 @@
 	}, {
 		.name		= "ck_gen1",
 		.flags		= CK_RATEF | CK_IDLEF,
-		.rate_reg	= CK_DPLL1,
+		.rate_reg	= DPLL_CTL,
 		.idle_reg	= ARM_IDLECT1,
 		.idle_shift	= IDLDPLL_ARM,
 		.parent		= OMAP_CLKIN,
@@ -629,39 +629,39 @@
 	omap_writew(0x1000, ARM_SYSST);
 #if defined(CONFIG_OMAP_ARM_30MHZ)
 	omap_writew(0x1555, ARM_CKCTL);
-	omap_writew(0x2290, DPLL_CTL_REG);
+	omap_writew(0x2290, DPLL_CTL);
 #elif defined(CONFIG_OMAP_ARM_60MHZ)
 	omap_writew(0x1005, ARM_CKCTL);
-	omap_writew(0x2290, DPLL_CTL_REG);
+	omap_writew(0x2290, DPLL_CTL);
 #elif defined(CONFIG_OMAP_ARM_96MHZ)
 	omap_writew(0x1005, ARM_CKCTL);
-	omap_writew(0x2410, DPLL_CTL_REG);
+	omap_writew(0x2410, DPLL_CTL);
 #elif defined(CONFIG_OMAP_ARM_120MHZ)
 	omap_writew(0x110a, ARM_CKCTL);
-	omap_writew(0x2510, DPLL_CTL_REG);
+	omap_writew(0x2510, DPLL_CTL);
 #elif defined(CONFIG_OMAP_ARM_168MHZ)
 	omap_writew(0x110f, ARM_CKCTL);
-	omap_writew(0x2710, DPLL_CTL_REG);
+	omap_writew(0x2710, DPLL_CTL);
 #elif defined(CONFIG_OMAP_ARM_182MHZ) && defined(CONFIG_ARCH_OMAP730)
 	omap_writew(0x250E, ARM_CKCTL);
-	omap_writew(0x2710, DPLL_CTL_REG);
+	omap_writew(0x2710, DPLL_CTL);
 #elif defined(CONFIG_OMAP_ARM_192MHZ) && (defined(CONFIG_ARCH_OMAP1610) || defined(CONFIG_ARCH_OMAP5912))
 	omap_writew(0x150f, ARM_CKCTL);
 	if (crystal_type == 2) {
 		source_clock = 13;	/* MHz */
-		omap_writew(0x2510, DPLL_CTL_REG);
+		omap_writew(0x2510, DPLL_CTL);
 	} else
-		omap_writew(0x2810, DPLL_CTL_REG);
+		omap_writew(0x2810, DPLL_CTL);
 #elif defined(CONFIG_OMAP_ARM_195MHZ) && defined(CONFIG_ARCH_OMAP730)
 	omap_writew(0x250E, ARM_CKCTL);
-	omap_writew(0x2790, DPLL_CTL_REG);
+	omap_writew(0x2790, DPLL_CTL);
 #else
 #error "OMAP MHZ not set, please run make xconfig"
 #endif
 
 #ifdef CONFIG_MACH_OMAP_PERSEUS2
 	/* Select slicer output as OMAP input clock */
-	omap_writew(omap_readw(OMAP730_PCC_UPLD_CTRL_REG) & ~0x1, OMAP730_PCC_UPLD_CTRL_REG);
+	omap_writew(omap_readw(OMAP730_PCC_UPLD_CTRL) & ~0x1, OMAP730_PCC_UPLD_CTRL);
 #endif
 
 	/* Turn off some other junk the bootloader might have turned on */
diff -Nru a/arch/arm/mach-omap/common.c b/arch/arm/mach-omap/common.c
--- a/arch/arm/mach-omap/common.c	Tue Jun 15 22:21:03 2004
+++ b/arch/arm/mach-omap/common.c	Tue Jun 15 22:21:03 2004
@@ -25,6 +25,58 @@
 
 /*
  * ----------------------------------------------------------------------------
+ * OMAP revision check
+ *
+ * Since we use the cpu_is_omapnnnn() macros, there's a chance that a board
+ * switches to an updated core. We want to print out the OMAP revision early.
+ *
+ * We use the system_serial registers for the revision information so we
+ * can see it in /proc/cpuinfo.
+ *
+ * If the OMAP detection gets more complicated, we may want to expand this
+ * to store the OMAP version and replace the current cpu_is_omapnnnn() macros.
+ *
+ * ----------------------------------------------------------------------------
+ */
+static void __init omap_check_revision(void)
+{
+	system_serial_high = omap_readl(OMAP_ID_BASE);
+	system_serial_low = OMAP_ID_REG;
+	system_rev = (OMAP_ID_REG >> ID_SHIFT) & ID_MASK;
+
+	printk("OMAP revision: %d.%d (0x%08x) id: 0x%08x detected as OMAP-",
+	       (system_serial_high >> 20) & 0xf,
+	       (system_serial_high >> 16) & 0xf,
+	       system_serial_high, system_serial_low);
+
+	switch (system_rev) {
+	case OMAP_ID_730:
+		printk("730\n");
+		system_rev = 0x730;
+		break;
+	case OMAP_ID_1510:
+		printk("1510\n");
+		system_rev = 0x1510;
+		break;
+	case OMAP_ID_1610:
+		printk("1610\n");
+		system_rev = 0x1610;
+		break;
+	case OMAP_ID_1710:
+		printk("1710\n");
+		system_rev = 0x1710;
+		break;
+	case OMAP_ID_5912:
+		printk("5912/1611B\n");
+		system_rev = 0x5912;
+		break;
+	default:
+		printk("unknown, please add support!\n");
+	}
+}
+
+/*
+ * ----------------------------------------------------------------------------
  * OMAP I/O mapping
  *
  * The machine specific code may provide the extra mapping besides the
@@ -64,7 +116,13 @@
 static struct map_desc omap5912_io_desc[] __initdata = {
  { OMAP5912_DSP_BASE,    OMAP5912_DSP_START,    OMAP5912_DSP_SIZE,    MT_DEVICE },
  { OMAP5912_DSPREG_BASE, OMAP5912_DSPREG_START, OMAP5912_DSPREG_SIZE, MT_DEVICE },
- { OMAP5912_SRAM_BASE,   OMAP5912_SRAM_START,   OMAP5912_SRAM_SIZE,   MT_DEVICE }
+/*
+ * The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page
+ * size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped.
+ * Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte
+ * can be used.
+ */
+ { OMAP5912_SRAM_BASE,   OMAP5912_SRAM_START,   OMAP5912_SRAM_SIZE + 0x800,   MT_DEVICE }
 };
 #endif
 
@@ -77,6 +135,7 @@
 	/* We have to initialize the IO space mapping before we can run
 	 * cpu_is_omapxxx() macros. */
 	iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
+	omap_check_revision();
 
 #ifdef CONFIG_ARCH_OMAP730
 	if (cpu_is_omap730()) {
@@ -102,8 +161,8 @@
 	/* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
 	 * on a Posted Write in the TIPB Bridge".
 	 */
-	omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL_REG);
-	omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL_REG);
+	omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
+	omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
 
 	/* Must init clocks early to assure that timer interrupt works
 	 */
diff -Nru a/arch/arm/mach-omap/dma.c b/arch/arm/mach-omap/dma.c
--- a/arch/arm/mach-omap/dma.c	Tue Jun 15 22:21:02 2004
+++ b/arch/arm/mach-omap/dma.c	Tue Jun 15 22:21:02 2004
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2003 Nokia Corporation
  * Author: Juha Yrjölä <juha.yrjola@nokia.com>
+ * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
  *
  * Support functions for the OMAP internal DMA channels.
  *
@@ -34,6 +35,7 @@
 static int enable_1510_mode = 0;
 
 struct omap_dma_lch {
+	int next_lch;
 	int dev_id;
 	u16 saved_csr;
 	u16 enabled_irqs;
@@ -90,45 +92,124 @@
 {
 	u16 w;
 
-	w = omap_readw(OMAP_DMA_CSDP_REG(lch));
+	w = omap_readw(OMAP_DMA_CSDP(lch));
 	w &= ~0x03;
 	w |= data_type;
-	omap_writew(w, OMAP_DMA_CSDP_REG(lch));
+	omap_writew(w, OMAP_DMA_CSDP(lch));
 
-	w = omap_readw(OMAP_DMA_CCR_REG(lch));
+	w = omap_readw(OMAP_DMA_CCR(lch));
 	w &= ~(1 << 5);
 	if (sync_mode == OMAP_DMA_SYNC_FRAME)
 		w |= 1 << 5;
-	omap_writew(w, OMAP_DMA_CCR_REG(lch));
+	omap_writew(w, OMAP_DMA_CCR(lch));
 
-	w = omap_readw(OMAP_DMA_CCR2_REG(lch));
+	w = omap_readw(OMAP_DMA_CCR2(lch));
 	w &= ~(1 << 2);
 	if (sync_mode == OMAP_DMA_SYNC_BLOCK)
 		w |= 1 << 2;
-	omap_writew(w, OMAP_DMA_CCR2_REG(lch));
+	omap_writew(w, OMAP_DMA_CCR2(lch));
 
-	omap_writew(elem_count, OMAP_DMA_CEN_REG(lch));
-	omap_writew(frame_count, OMAP_DMA_CFN_REG(lch));
+	omap_writew(elem_count, OMAP_DMA_CEN(lch));
+	omap_writew(frame_count, OMAP_DMA_CFN(lch));
 
 }
+void omap_set_dma_constant_fill(int lch, u32 color)
+{
+	u16 w;
+
+#ifdef CONFIG_DEBUG_KERNEL
+	if (omap_dma_in_1510_mode) {
+		printk(KERN_ERR "OMAP DMA constant fill not available in 1510 mode.");
+		BUG();
+		return;
+	}
+#endif
+	w = omap_readw(OMAP_DMA_CCR2(lch)) & ~0x03;
+	w |= 0x01;
+	omap_writew(w, OMAP_DMA_CCR2(lch));
+
+	omap_writew((u16)color, OMAP_DMA_COLOR_L(lch));
+	omap_writew((u16)(color >> 16), OMAP_DMA_COLOR_U(lch));
+
+	w = omap_readw(OMAP_DMA_LCH_CTRL(lch)) & ~0x0f;
+	w |= 1;		/* Channel type G */
+	omap_writew(w, OMAP_DMA_LCH_CTRL(lch));
+}
+
+void omap_set_dma_transparent_copy(int lch, u32 color)
+{
+	u16 w;
+
+#ifdef CONFIG_DEBUG_KERNEL
+	if (omap_dma_in_1510_mode) {
+		printk(KERN_ERR "OMAP DMA transparent copy not available in 1510 mode.");
+		BUG();
+	}
+#endif
+	w = omap_readw(OMAP_DMA_CCR2(lch)) & ~0x03;
+	w |= 0x02;
+	omap_writew(w, OMAP_DMA_CCR2(lch));
+
+	omap_writew((u16)color, OMAP_DMA_COLOR_L(lch));
+	omap_writew((u16)(color >> 16), OMAP_DMA_COLOR_U(lch));
+
+	w = omap_readw(OMAP_DMA_LCH_CTRL(lch)) & ~0x0f;
+	w |= 1;		/* Channel type G */
+	omap_writew(w, OMAP_DMA_LCH_CTRL(lch));
+}
 
 void omap_set_dma_src_params(int lch, int src_port, int src_amode,
 			     unsigned long src_start)
 {
 	u16 w;
 
-	w = omap_readw(OMAP_DMA_CSDP_REG(lch));
+	w = omap_readw(OMAP_DMA_CSDP(lch));
 	w &= ~(0x1f << 2);
 	w |= src_port << 2;
-	omap_writew(w, OMAP_DMA_CSDP_REG(lch));
+	omap_writew(w, OMAP_DMA_CSDP(lch));
 
-	w = omap_readw(OMAP_DMA_CCR_REG(lch));
+	w = omap_readw(OMAP_DMA_CCR(lch));
 	w &= ~(0x03 << 12);
 	w |= src_amode << 12;
-	omap_writew(w, OMAP_DMA_CCR_REG(lch));
+	omap_writew(w, OMAP_DMA_CCR(lch));
+
+	omap_writew(src_start >> 16, OMAP_DMA_CSSA_U(lch));
+	omap_writew(src_start, OMAP_DMA_CSSA_L(lch));
+}
+
+void omap_set_dma_src_index(int lch, int eidx, int fidx)
+{
+	omap_writew(eidx, OMAP_DMA_CSEI(lch));
+	omap_writew(fidx, OMAP_DMA_CSFI(lch));
+}
+
+void omap_set_dma_src_data_pack(int lch, int enable)
+{
+	u16 w;
 
-	omap_writew(src_start >> 16, OMAP_DMA_CSSA_U_REG(lch));
-	omap_writew(src_start, OMAP_DMA_CSSA_L_REG(lch));
+	w = omap_readw(OMAP_DMA_CSDP(lch)) & ~(1 << 6);
+	w |= enable ? (1 << 6) : 0;
+	omap_writew(w, OMAP_DMA_CSDP(lch));
+}
+
+void omap_set_dma_src_burst_mode(int lch, int burst_mode)
+{
+	u16 w;
+
+	w = omap_readw(OMAP_DMA_CSDP(lch)) & ~(0x03 << 7);
+	switch (burst_mode) {
+	case OMAP_DMA_DATA_BURST_4:
+		w |= (0x01 << 7);
+		break;
+	case OMAP_DMA_DATA_BURST_8:
+		w |= (0x03 << 7);
+		break;
+	default:
+		printk(KERN_ERR "Invalid DMA burst mode\n");
+		BUG();
+		return;
+	}
+	omap_writew(w, OMAP_DMA_CSDP(lch));
 }
 
 void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
@@ -136,46 +217,136 @@
 {
 	u16 w;
 
-	w = omap_readw(OMAP_DMA_CSDP_REG(lch));
+	w = omap_readw(OMAP_DMA_CSDP(lch));
 	w &= ~(0x1f << 9);
 	w |= dest_port << 9;
-	omap_writew(w, OMAP_DMA_CSDP_REG(lch));
+	omap_writew(w, OMAP_DMA_CSDP(lch));
 
-	w = omap_readw(OMAP_DMA_CCR_REG(lch));
+	w = omap_readw(OMAP_DMA_CCR(lch));
 	w &= ~(0x03 << 14);
 	w |= dest_amode << 14;
-	omap_writew(w, OMAP_DMA_CCR_REG(lch));
+	omap_writew(w, OMAP_DMA_CCR(lch));
+
+	omap_writew(dest_start >> 16, OMAP_DMA_CDSA_U(lch));
+	omap_writew(dest_start, OMAP_DMA_CDSA_L(lch));
+}
+
+void omap_set_dma_dest_index(int lch, int eidx, int fidx)
+{
+	omap_writew(eidx, OMAP_DMA_CDEI(lch));
+	omap_writew(fidx, OMAP_DMA_CDFI(lch));
+}
+
+void omap_set_dma_dest_data_pack(int lch, int enable)
+{
+	u16 w;
+
+	w = omap_readw(OMAP_DMA_CSDP(lch)) & ~(1 << 13);
+	w |= enable ? (1 << 13) : 0;
+	omap_writew(w, OMAP_DMA_CSDP(lch));
+}
+
+void omap_set_dma_dest_burst_mode(int lch, int burst_mode)
+{
+	u16 w;
 
-	omap_writew(dest_start >> 16, OMAP_DMA_CDSA_U_REG(lch));
-	omap_writew(dest_start, OMAP_DMA_CDSA_L_REG(lch));
+	w = omap_readw(OMAP_DMA_CSDP(lch)) & ~(0x03 << 14);
+	switch (burst_mode) {
+	case OMAP_DMA_DATA_BURST_4:
+		w |= (0x01 << 14);
+		break;
+	case OMAP_DMA_DATA_BURST_8:
+		w |= (0x03 << 14);
+		break;
+	default:
+		printk(KERN_ERR "Invalid DMA burst mode\n");
+		BUG();
+		return;
+	}
+	omap_writew(w, OMAP_DMA_CSDP(lch));
 }
 
 void omap_start_dma(int lch)
 {
 	u16 w;
 
+	if (!omap_dma_in_1510_mode()) {
+		int next_lch;
+
+		next_lch = dma_chan[lch].next_lch;
+
+		/* Enable the queue, if needed so. */
+		if (next_lch != -1) {
+			/* Clear the STOP_LNK bits */
+			w = omap_readw(OMAP_DMA_CLNK_CTRL(lch));
+			w &= ~(1 << 14);
+			omap_writew(w, OMAP_DMA_CLNK_CTRL(lch));
+			w = omap_readw(OMAP_DMA_CLNK_CTRL(next_lch));
+			w &= ~(1 << 14);
+			omap_writew(w, OMAP_DMA_CLNK_CTRL(next_lch));
+
+			/* And set the ENABLE_LNK bits */
+			omap_writew(next_lch | (1 << 15),
+				    OMAP_DMA_CLNK_CTRL(lch));
+			/* The loop case */
+			if (dma_chan[next_lch].next_lch == lch)
+				omap_writew(lch | (1 << 15),
+					    OMAP_DMA_CLNK_CTRL(next_lch));
+
+			/* Read CSR to make sure it's cleared. */
+			w = omap_readw(OMAP_DMA_CSR(next_lch));
+			/* Enable some nice interrupts. */
+			omap_writew(dma_chan[next_lch].enabled_irqs,
+				    OMAP_DMA_CICR(next_lch));
+			dma_chan[next_lch].flags |= OMAP_DMA_ACTIVE;
+		}
+	}
+
 	/* Read CSR to make sure it's cleared. */
-	w = omap_readw(OMAP_DMA_CSR_REG(lch));
+	w = omap_readw(OMAP_DMA_CSR(lch));
 	/* Enable some nice interrupts. */
-	omap_writew(dma_chan[lch].enabled_irqs, OMAP_DMA_CICR_REG(lch));
+	omap_writew(dma_chan[lch].enabled_irqs, OMAP_DMA_CICR(lch));
 
-	w = omap_readw(OMAP_DMA_CCR_REG(lch));
+	w = omap_readw(OMAP_DMA_CCR(lch));
 	w |= OMAP_DMA_CCR_EN;
-	omap_writew(w, OMAP_DMA_CCR_REG(lch));
+	omap_writew(w, OMAP_DMA_CCR(lch));
 	dma_chan[lch].flags |= OMAP_DMA_ACTIVE;
 }
 
 void omap_stop_dma(int lch)
 {
 	u16 w;
+	int next_lch;
 
 	/* Disable all interrupts on the channel */
-	omap_writew(0, OMAP_DMA_CICR_REG(lch));
+	omap_writew(0, OMAP_DMA_CICR(lch));
+
+	if (omap_dma_in_1510_mode()) {
+		w = omap_readw(OMAP_DMA_CCR(lch));
+		w &= ~OMAP_DMA_CCR_EN;
+		omap_writew(w, OMAP_DMA_CCR(lch));
+		dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
+		return;
+	}
 
-	w = omap_readw(OMAP_DMA_CCR_REG(lch));
-	w &= ~OMAP_DMA_CCR_EN;
-	omap_writew(w, OMAP_DMA_CCR_REG(lch));
+	next_lch = dma_chan[lch].next_lch;
+
+	/*
+	 * According to thw HW spec, enabling the STOP_LNK bit
+	 * resets the CCR_EN bit at the same time.
+	 */
+	w = omap_readw(OMAP_DMA_CLNK_CTRL(lch));
+	w |= (1 << 14);
+	w = omap_writew(w, OMAP_DMA_CLNK_CTRL(lch));
 	dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE;
+
+	if (next_lch != -1) {
+		omap_writew(0, OMAP_DMA_CICR(next_lch));
+		w = omap_readw(OMAP_DMA_CLNK_CTRL(next_lch));
+		w |= (1 << 14);
+		w = omap_writew(w, OMAP_DMA_CLNK_CTRL(next_lch));
+		dma_chan[next_lch].flags &= ~OMAP_DMA_ACTIVE;
+	}
 }
 
 void omap_enable_dma_irq(int lch, u16 bits)
@@ -196,7 +367,7 @@
 		csr = dma_chan[ch].saved_csr;
 		dma_chan[ch].saved_csr = 0;
 	} else
-		csr = omap_readw(OMAP_DMA_CSR_REG(ch));
+		csr = omap_readw(OMAP_DMA_CSR(ch));
 	if (enable_1510_mode && ch <= 2 && (csr >> 7) != 0) {
 		dma_chan[ch + 6].saved_csr = csr >> 7;
 		csr &= 0x7f;
@@ -282,9 +453,9 @@
 		}
 		/* Disable the 1510 compatibility mode and set the sync device
 		 * id. */
-		omap_writew(dev_id | (1 << 10), OMAP_DMA_CCR_REG(free_ch));
+		omap_writew(dev_id | (1 << 10), OMAP_DMA_CCR(free_ch));
 	} else {
-		omap_writew(dev_id, OMAP_DMA_CCR_REG(free_ch));
+		omap_writew(dev_id, OMAP_DMA_CCR(free_ch));
 	}
 	*dma_ch_out = free_ch;
 
@@ -305,9 +476,9 @@
 	spin_unlock_irqrestore(&dma_chan_lock, flags);
 
 	/* Disable all DMA interrupts for the channel. */
-	omap_writew(0, OMAP_DMA_CICR_REG(ch));
+	omap_writew(0, OMAP_DMA_CICR(ch));
 	/* Make sure the DMA transfer is stopped. */
-	omap_writew(0, OMAP_DMA_CCR_REG(ch));
+	omap_writew(0, OMAP_DMA_CCR(ch));
 }
 
 int omap_dma_in_1510_mode(void)
@@ -315,6 +486,56 @@
 	return enable_1510_mode;
 }
 
+/*
+ * lch_queue DMA will start right after lch_head one is finished.
+ * For this DMA link to start, you still need to start (see omap_start_dma)
+ * the first one. That will fire up the entire queue.
+ */
+void omap_dma_link_lch (int lch_head, int lch_queue)
+{
+	if (omap_dma_in_1510_mode()) {
+		printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
+		BUG();
+		return;
+	}
+
+	if ((dma_chan[lch_head].dev_id == -1) ||
+	    (dma_chan[lch_queue].dev_id == -1)) {
+		printk(KERN_ERR "omap_dma: trying to link non requested channels\n");
+		dump_stack();
+	}
+
+	dma_chan[lch_head].next_lch = lch_queue;
+}
+
+/*
+ * Once the DMA queue is stopped, we can destroy it.
+ */
+void omap_dma_unlink_lch (int lch_head, int lch_queue)
+{
+	if (omap_dma_in_1510_mode()) {
+		printk(KERN_ERR "DMA linking is not supported in 1510 mode\n");
+		BUG();
+		return;
+	}
+
+	if (dma_chan[lch_head].next_lch != lch_queue ||
+	    dma_chan[lch_head].next_lch == -1) {
+		printk(KERN_ERR "omap_dma: trying to unlink non linked channels\n");
+		dump_stack();
+	}
+
+
+	if ((dma_chan[lch_head].flags & OMAP_DMA_ACTIVE) ||
+	    (dma_chan[lch_head].flags & OMAP_DMA_ACTIVE)) {
+		printk(KERN_ERR "omap_dma: You need to stop the DMA channels before unlinking\n");
+		dump_stack();
+	}
+
+	dma_chan[lch_head].next_lch = -1;
+	dma_chan[lch_queue].next_lch = -1;
+}
+
 
 static struct lcd_dma_info {
 	spinlock_t lock;
@@ -494,19 +715,19 @@
 		enable_1510_mode = 1;
 	} else if (cpu_is_omap1610() || cpu_is_omap5912()) {
 		printk(KERN_INFO "OMAP DMA hardware version %d\n",
-		       omap_readw(OMAP_DMA_HW_ID_REG));
+		       omap_readw(OMAP_DMA_HW_ID));
 		printk(KERN_INFO "DMA capabilities: %08x:%08x:%04x:%04x:%04x\n",
-		       (omap_readw(OMAP_DMA_CAPS_0_U_REG) << 16) | omap_readw(OMAP_DMA_CAPS_0_L_REG),
-		       (omap_readw(OMAP_DMA_CAPS_1_U_REG) << 16) | omap_readw(OMAP_DMA_CAPS_1_L_REG),
-		       omap_readw(OMAP_DMA_CAPS_2_REG), omap_readw(OMAP_DMA_CAPS_3_REG),
-		       omap_readw(OMAP_DMA_CAPS_4_REG));
+		       (omap_readw(OMAP_DMA_CAPS_0_U) << 16) | omap_readw(OMAP_DMA_CAPS_0_L),
+		       (omap_readw(OMAP_DMA_CAPS_1_U) << 16) | omap_readw(OMAP_DMA_CAPS_1_L),
+		       omap_readw(OMAP_DMA_CAPS_2), omap_readw(OMAP_DMA_CAPS_3),
+		       omap_readw(OMAP_DMA_CAPS_4));
 		if (!enable_1510_mode) {
 			u16 w;
 
 			/* Disable OMAP 3.0/3.1 compatibility mode. */
-			w = omap_readw(OMAP_DMA_GSCR_REG);
+			w = omap_readw(OMAP_DMA_GSCR);
 			w |= 1 << 3;
-			omap_writew(w, OMAP_DMA_GSCR_REG);
+			omap_writew(w, OMAP_DMA_GSCR);
 			dma_chan_count = OMAP_LOGICAL_DMA_CH_COUNT;
 		} else
 			dma_chan_count = 9;
@@ -522,6 +743,8 @@
 
 	for (ch = 0; ch < dma_chan_count; ch++) {
 		dma_chan[ch].dev_id = -1;
+		dma_chan[ch].next_lch = -1;
+
 		if (ch >= 6 && enable_1510_mode)
 			continue;
 
@@ -548,9 +771,23 @@
 EXPORT_SYMBOL(omap_free_dma);
 EXPORT_SYMBOL(omap_start_dma);
 EXPORT_SYMBOL(omap_stop_dma);
+
 EXPORT_SYMBOL(omap_set_dma_transfer_params);
+EXPORT_SYMBOL(omap_set_dma_constant_fill);
+EXPORT_SYMBOL(omap_set_dma_transparent_copy);
+
 EXPORT_SYMBOL(omap_set_dma_src_params);
+EXPORT_SYMBOL(omap_set_dma_src_index);
+EXPORT_SYMBOL(omap_set_dma_src_data_pack);
+EXPORT_SYMBOL(omap_set_dma_src_burst_mode);
+
 EXPORT_SYMBOL(omap_set_dma_dest_params);
+EXPORT_SYMBOL(omap_set_dma_dest_index);
+EXPORT_SYMBOL(omap_set_dma_dest_data_pack);
+EXPORT_SYMBOL(omap_set_dma_dest_burst_mode);
+
+EXPORT_SYMBOL(omap_dma_link_lch);
+EXPORT_SYMBOL(omap_dma_unlink_lch);
 
 EXPORT_SYMBOL(omap_request_lcd_dma);
 EXPORT_SYMBOL(omap_free_lcd_dma);
diff -Nru a/arch/arm/mach-omap/fpga.c b/arch/arm/mach-omap/fpga.c
--- a/arch/arm/mach-omap/fpga.c	Tue Jun 15 22:20:38 2004
+++ b/arch/arm/mach-omap/fpga.c	Tue Jun 15 22:20:38 2004
@@ -46,11 +46,11 @@
 	irq -= IH_FPGA_BASE;
 
 	if (irq < 8)
-		__raw_writeb((__raw_readb(OMAP1510P1_FPGA_IMR_LO)
-			      & ~(1 << irq)), OMAP1510P1_FPGA_IMR_LO);
+		__raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO)
+			      & ~(1 << irq)), OMAP1510_FPGA_IMR_LO);
 	else if (irq < 16)
-		__raw_writeb((__raw_readb(OMAP1510P1_FPGA_IMR_HI)
-			      & ~(1 << (irq - 8))), OMAP1510P1_FPGA_IMR_HI);
+		__raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_HI)
+			      & ~(1 << (irq - 8))), OMAP1510_FPGA_IMR_HI);
 	else
 		__raw_writeb((__raw_readb(INNOVATOR_FPGA_IMR2)
 			      & ~(1 << (irq - 16))), INNOVATOR_FPGA_IMR2);
@@ -60,10 +60,10 @@
 static inline u32 get_fpga_unmasked_irqs(void)
 {
 	return
-		((__raw_readb(OMAP1510P1_FPGA_ISR_LO) &
-		  __raw_readb(OMAP1510P1_FPGA_IMR_LO))) |
-		((__raw_readb(OMAP1510P1_FPGA_ISR_HI) &
-		  __raw_readb(OMAP1510P1_FPGA_IMR_HI)) << 8) |
+		((__raw_readb(OMAP1510_FPGA_ISR_LO) &
+		  __raw_readb(OMAP1510_FPGA_IMR_LO))) |
+		((__raw_readb(OMAP1510_FPGA_ISR_HI) &
+		  __raw_readb(OMAP1510_FPGA_IMR_HI)) << 8) |
 		((__raw_readb(INNOVATOR_FPGA_ISR2) &
 		  __raw_readb(INNOVATOR_FPGA_IMR2)) << 16);
 }
@@ -79,11 +79,11 @@
 	irq -= IH_FPGA_BASE;
 
 	if (irq < 8)
-		__raw_writeb((__raw_readb(OMAP1510P1_FPGA_IMR_LO) | (1 << irq)),
-		     OMAP1510P1_FPGA_IMR_LO);
+		__raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_LO) | (1 << irq)),
+		     OMAP1510_FPGA_IMR_LO);
 	else if (irq < 16)
-		__raw_writeb((__raw_readb(OMAP1510P1_FPGA_IMR_HI)
-			      | (1 << (irq - 8))), OMAP1510P1_FPGA_IMR_HI);
+		__raw_writeb((__raw_readb(OMAP1510_FPGA_IMR_HI)
+			      | (1 << (irq - 8))), OMAP1510_FPGA_IMR_HI);
 	else
 		__raw_writeb((__raw_readb(INNOVATOR_FPGA_IMR2)
 			      | (1 << (irq - 16))), INNOVATOR_FPGA_IMR2);
@@ -166,8 +166,8 @@
 {
 	int i;
 
-	__raw_writeb(0, OMAP1510P1_FPGA_IMR_LO);
-	__raw_writeb(0, OMAP1510P1_FPGA_IMR_HI);
+	__raw_writeb(0, OMAP1510_FPGA_IMR_LO);
+	__raw_writeb(0, OMAP1510_FPGA_IMR_HI);
 	__raw_writeb(0, INNOVATOR_FPGA_IMR2);
 
 	for (i = IH_FPGA_BASE; i < (IH_FPGA_BASE + NR_FPGA_IRQS); i++) {
diff -Nru a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c
--- a/arch/arm/mach-omap/gpio.c	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/mach-omap/gpio.c	Tue Jun 15 22:20:40 2004
@@ -22,7 +22,6 @@
 #include <asm/irq.h>
 #include <asm/arch/irqs.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/pm.h>
 #include <asm/mach/irq.h>
 
 #include <asm/io.h>
@@ -79,7 +78,7 @@
 #define OMAP730_GPIO_INT_MASK		0x10
 #define OMAP730_GPIO_INT_STATUS		0x14
 
-#define OMAP_MPUIO_MASK         (~OMAP_MAX_GPIO_LINES & 0xff)
+#define OMAP_MPUIO_MASK		(~OMAP_MAX_GPIO_LINES & 0xff)
 
 struct gpio_bank {
 	u32 base;
@@ -213,12 +212,12 @@
 		reg += OMAP730_GPIO_DIR_CONTROL;
 		break;
 	}
-	l = omap_readl(reg);
+	l = __raw_readl(reg);
 	if (is_input)
 		l |= 1 << gpio;
 	else
 		l &= ~(1 << gpio);
-	omap_writel(l, reg);
+	__raw_writel(l, reg);
 }
 
 void omap_set_gpio_direction(int gpio, int is_input)
@@ -240,8 +239,8 @@
 
 	switch (bank->method) {
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_OUTPUT_REG;
-		l = omap_readl(reg);
+		reg += OMAP_MPUIO_OUTPUT;
+		l = __raw_readl(reg);
 		if (enable)
 			l |= 1 << gpio;
 		else
@@ -249,7 +248,7 @@
 		break;
 	case METHOD_GPIO_1510:
 		reg += OMAP1510_GPIO_DATA_OUTPUT;
-		l = omap_readl(reg);
+		l = __raw_readl(reg);
 		if (enable)
 			l |= 1 << gpio;
 		else
@@ -264,7 +263,7 @@
 		break;
 	case METHOD_GPIO_730:
 		reg += OMAP730_GPIO_DATA_OUTPUT;
-		l = omap_readl(reg);
+		l = __raw_readl(reg);
 		if (enable)
 			l |= 1 << gpio;
 		else
@@ -274,7 +273,7 @@
 		BUG();
 		return;
 	}
-	omap_writel(l, reg);
+	__raw_writel(l, reg);
 }
 
 void omap_set_gpio_dataout(int gpio, int enable)
@@ -312,7 +311,7 @@
 		BUG();
 		return -1;
 	}
-	return (omap_readl(reg) & (1 << get_gpio_index(gpio))) != 0;
+	return (__raw_readl(reg) & (1 << get_gpio_index(gpio))) != 0;
 }
 
 static void _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge)
@@ -322,22 +321,22 @@
 
 	switch (bank->method) {
 	case METHOD_MPUIO:
-		reg += OMAP_MPUIO_GPIO_INT_EDGE_REG;
-		l = omap_readl(reg);
+		reg += OMAP_MPUIO_GPIO_INT_EDGE;
+		l = __raw_readl(reg);
 		if (edge == OMAP_GPIO_RISING_EDGE)
 			l |= 1 << gpio;
 		else
 			l &= ~(1 << gpio);
-		omap_writel(l, reg);
+		__raw_writel(l, reg);
 		break;
 	case METHOD_GPIO_1510:
 		reg += OMAP1510_GPIO_INT_CONTROL;
-		l = omap_readl(reg);
+		l = __raw_readl(reg);
 		if (edge == OMAP_GPIO_RISING_EDGE)
 			l |= 1 << gpio;
 		else
 			l &= ~(1 << gpio);
-		omap_writel(l, reg);
+		__raw_writel(l, reg);
 		break;
 	case METHOD_GPIO_1610:
 		edge &= 0x03;
@@ -346,19 +345,19 @@
 		else
 			reg += OMAP1610_GPIO_EDGE_CTRL1;
 		gpio &= 0x07;
-		l = omap_readl(reg);
+		l = __raw_readl(reg);
 		l &= ~(3 << (gpio << 1));
 		l |= edge << (gpio << 1);
-		omap_writel(l, reg);
+		__raw_writel(l, reg);
 		break;
 	case METHOD_GPIO_730:
 		reg += OMAP730_GPIO_INT_CONTROL;
-		l = omap_readl(reg);
+		l = __raw_readl(reg);
 		if (edge == OMAP_GPIO_RISING_EDGE)
 			l |= 1 << gpio;
 		else
 			l &= ~(1 << gpio);
-		omap_writel(l, reg);
+		__raw_writel(l, reg);
 		break;
 	default:
 		BUG();
@@ -385,11 +384,11 @@
 
 	switch (bank->method) {
 	case METHOD_MPUIO:
-		l = omap_readl(reg + OMAP_MPUIO_GPIO_INT_EDGE_REG);
+		l = __raw_readl(reg + OMAP_MPUIO_GPIO_INT_EDGE);
 		return (l & (1 << gpio)) ?
 			OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE;
 	case METHOD_GPIO_1510:
-		l = omap_readl(reg + OMAP1510_GPIO_INT_CONTROL);
+		l = __raw_readl(reg + OMAP1510_GPIO_INT_CONTROL);
 		return (l & (1 << gpio)) ?
 			OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE;
 	case METHOD_GPIO_1610:
@@ -397,9 +396,9 @@
 			reg += OMAP1610_GPIO_EDGE_CTRL2;
 		else
 			reg += OMAP1610_GPIO_EDGE_CTRL1;
-		return (omap_readl(reg) >> ((gpio & 0x07) << 1)) & 0x03;
+		return (__raw_readl(reg) >> ((gpio & 0x07) << 1)) & 0x03;
 	case METHOD_GPIO_730:
-		l = omap_readl(reg + OMAP730_GPIO_INT_CONTROL);
+		l = __raw_readl(reg + OMAP730_GPIO_INT_CONTROL);
 		return (l & (1 << gpio)) ?
 			OMAP_GPIO_RISING_EDGE : OMAP_GPIO_FALLING_EDGE;
 	default:
@@ -430,7 +429,7 @@
 		BUG();
 		return;
 	}
-	omap_writel(1 << get_gpio_index(gpio), reg);
+	__raw_writel(1 << get_gpio_index(gpio), reg);
 }
 
 static void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int enable)
@@ -441,7 +440,7 @@
 	switch (bank->method) {
 	case METHOD_MPUIO:
 		reg += OMAP_MPUIO_GPIO_MASKIT;
-		l = omap_readl(reg);
+		l = __raw_readl(reg);
 		if (enable)
 			l &= ~(1 << gpio);
 		else
@@ -449,7 +448,7 @@
 		break;
 	case METHOD_GPIO_1510:
 		reg += OMAP1510_GPIO_INT_MASK;
-		l = omap_readl(reg);
+		l = __raw_readl(reg);
 		if (enable)
 			l &= ~(1 << gpio);
 		else
@@ -465,7 +464,7 @@
 		break;
 	case METHOD_GPIO_730:
 		reg += OMAP730_GPIO_INT_MASK;
-		l = omap_readl(reg);
+		l = __raw_readl(reg);
 		if (enable)
 			l &= ~(1 << gpio);
 		else
@@ -475,7 +474,7 @@
 		BUG();
 		return;
 	}
-	omap_writel(l, reg);
+	__raw_writel(l, reg);
 }
 
 int omap_request_gpio(int gpio)
@@ -500,7 +499,7 @@
 
 		/* Claim the pin for the ARM */
 		reg = bank->base + OMAP1510_GPIO_PIN_CONTROL;
-		omap_writel(omap_readl(reg) | (1 << get_gpio_index(gpio)), reg);
+		__raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg);
 	}
 #endif
 	spin_unlock(&bank->lock);
@@ -564,7 +563,7 @@
 		isr_reg = bank->base + OMAP730_GPIO_INT_STATUS;
 #endif
 	for (;;) {
-		u32 isr = omap_readl(isr_reg);
+		u32 isr = __raw_readl(isr_reg);
 		unsigned int gpio_irq;
 
 		if (!isr)
@@ -587,15 +586,15 @@
 
 #ifdef CONFIG_ARCH_OMAP1510
 	if (bank->method == METHOD_GPIO_1510)
-		omap_writew(1 << gpio, bank->base + OMAP1510_GPIO_INT_STATUS);
+		__raw_writew(1 << (gpio & 0x0f), bank->base + OMAP1510_GPIO_INT_STATUS);
 #endif
 #if defined(CONFIG_ARCH_OMAP1610) || defined(CONFIG_ARCH_OMAP5912)
 	if (bank->method == METHOD_GPIO_1610)
-		omap_writew(1 << gpio, bank->base + OMAP1610_GPIO_IRQSTATUS1);
+		__raw_writew(1 << (gpio & 0x0f), bank->base + OMAP1610_GPIO_IRQSTATUS1);
 #endif
 #ifdef CONFIG_ARCH_OMAP730
 	if (bank->method == METHOD_GPIO_730)
-		omap_writel(1 << gpio, bank->base + OMAP730_GPIO_INT_STATUS);
+		__raw_writel(1 << (gpio & 0x1f), bank->base + OMAP730_GPIO_INT_STATUS);
 #endif
 }
 
@@ -692,26 +691,27 @@
 
 		bank = &gpio_bank[i];
 		bank->reserved_map = 0;
+		bank->base = IO_ADDRESS(bank->base);
 		spin_lock_init(&bank->lock);
 		if (bank->method == METHOD_MPUIO) {
 			omap_writew(0xFFFF, OMAP_MPUIO_BASE + OMAP_MPUIO_GPIO_MASKIT);
 		}
 #ifdef CONFIG_ARCH_OMAP1510
 		if (bank->method == METHOD_GPIO_1510) {
-			omap_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK);
-			omap_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS);
+			__raw_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK);
+			__raw_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS);
 		}
 #endif
 #if defined(CONFIG_ARCH_OMAP1610) || defined(CONFIG_ARCH_OMAP5912)
 		if (bank->method == METHOD_GPIO_1610) {
-			omap_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1);
-			omap_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1);
+			__raw_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1);
+			__raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1);
 		}
 #endif
 #ifdef CONFIG_ARCH_OMAP730
 		if (bank->method == METHOD_GPIO_730) {
-			omap_writel(0xffffffff, bank->base + OMAP730_GPIO_INT_MASK);
-			omap_writel(0x00000000, bank->base + OMAP730_GPIO_INT_STATUS);
+			__raw_writel(0xffffffff, bank->base + OMAP730_GPIO_INT_MASK);
+			__raw_writel(0x00000000, bank->base + OMAP730_GPIO_INT_STATUS);
 
 			gpio_count = 32; /* 730 has 32-bit GPIOs */
 		}
@@ -730,9 +730,9 @@
 	}
 
 	/* Enable system clock for GPIO module.
-	 * The CAM_CLK_CTRL_REG *is* really the right place. */
+	 * The CAM_CLK_CTRL *is* really the right place. */
 	if (cpu_is_omap1610())
-		omap_writel(omap_readl(ULPD_CAM_CLK_CTRL_REG) | 0x04, ULPD_CAM_CLK_CTRL_REG);
+		omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, ULPD_CAM_CLK_CTRL);
 
 	return 0;
 }
@@ -748,8 +748,11 @@
 		return 0;
 }
 
-EXPORT_SYMBOL(omap_gpio_init);
 EXPORT_SYMBOL(omap_request_gpio);
 EXPORT_SYMBOL(omap_free_gpio);
+EXPORT_SYMBOL(omap_set_gpio_direction);
+EXPORT_SYMBOL(omap_set_gpio_dataout);
+EXPORT_SYMBOL(omap_get_gpio_datain);
+EXPORT_SYMBOL(omap_set_gpio_edge_ctrl);
 
 arch_initcall(omap_gpio_init);
diff -Nru a/arch/arm/mach-omap/innovator1510.c b/arch/arm/mach-omap/innovator1510.c
--- a/arch/arm/mach-omap/innovator1510.c	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,99 +0,0 @@
-/*
- * linux/arch/arm/mach-omap/innovator1510.c
- *
- * Board specific inits for OMAP-1510 Innovator
- *
- * Copyright (C) 2001 RidgeRun, Inc.
- * Author: Greg Lonnon <glonnon@ridgerun.com>
- *
- * Copyright (C) 2002 MontaVista Software, Inc.
- *
- * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
- * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/device.h>
-
-#include <asm/hardware.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <asm/arch/clocks.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/fpga.h>
-
-#include "common.h"
-
-extern int omap_gpio_init(void);
-
-void innovator_init_irq(void)
-{
-	omap_init_irq();
-	omap_gpio_init();
-	fpga_init_irq();
-}
-
-static struct resource smc91x_resources[] = {
-	[0] = {
-		.start	= OMAP1510P1_FPGA_ETHR_START,	/* Physical */
-		.end	= OMAP1510P1_FPGA_ETHR_START + 16,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= INT_ETHER,
-		.end	= INT_ETHER,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device smc91x_device = {
-	.name		= "smc91x",
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(smc91x_resources),
-	.resource	= smc91x_resources,
-};
-
-static struct platform_device *devices[] __initdata = {
-	&smc91x_device,
-};
-
-static void __init innovator_init(void)
-{
-	if (!machine_is_innovator())
-		return;
-
-	(void) platform_add_devices(devices, ARRAY_SIZE(devices));
-}
-
-/* Only FPGA needs to be mapped here. All others are done with ioremap */
-static struct map_desc innovator_io_desc[] __initdata = {
-{ OMAP1510P1_FPGA_BASE, OMAP1510P1_FPGA_START, OMAP1510P1_FPGA_SIZE,
-	MT_DEVICE },
-};
-
-static void __init innovator_map_io(void)
-{
-	omap_map_io();
-	iotable_init(innovator_io_desc, ARRAY_SIZE(innovator_io_desc));
-
-	/* Dump the Innovator FPGA rev early - useful info for support. */
-	printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
-	       fpga_read(OMAP1510P1_FPGA_REV_HIGH),
-	       fpga_read(OMAP1510P1_FPGA_REV_LOW),
-	       fpga_read(OMAP1510P1_FPGA_BOARD_REV));
-}
-
-MACHINE_START(INNOVATOR, "TI-Innovator/OMAP1510")
-	MAINTAINER("MontaVista Software, Inc.")
-	BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
-	BOOT_PARAMS(0x10000100)
-	MAPIO(innovator_map_io)
-	INITIRQ(innovator_init_irq)
-	INIT_MACHINE(innovator_init)
-MACHINE_END
diff -Nru a/arch/arm/mach-omap/innovator1610.c b/arch/arm/mach-omap/innovator1610.c
--- a/arch/arm/mach-omap/innovator1610.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,91 +0,0 @@
-/*
- * linux/arch/arm/mach-omap/innovator1610.c
- *
- * This file contains Innovator-specific code.
- *
- * Copyright (C) 2002 MontaVista Software, Inc.
- *
- * Copyright (C) 2001 RidgeRun, Inc.
- * Author: Greg Lonnon <glonnon@ridgerun.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/major.h>
-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/errno.h>
-
-#include <asm/setup.h>
-#include <asm/page.h>
-#include <asm/hardware.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/arch/irqs.h>
-
-#include "common.h"
-
-void
-innovator_init_irq(void)
-{
-	omap_init_irq();
-}
-
-static struct resource smc91x_resources[] = {
-	[0] = {
-		.start	= OMAP1610_ETHR_START,		/* Physical */
-		.end	= OMAP1610_ETHR_START + SZ_4K,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= 0,				/* Really GPIO 0 */
-		.end	= 0,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device smc91x_device = {
-	.name		= "smc91x",
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(smc91x_resources),
-	.resource	= smc91x_resources,
-};
-
-static struct platform_device *devices[] __initdata = {
-	&smc91x_device,
-};
-
-static void __init innovator_init(void)
-{
-	if (!machine_is_innovator())
-		return;
-
-	(void) platform_add_devices(devices, ARRAY_SIZE(devices));
-}
-
-static struct map_desc innovator_io_desc[] __initdata = {
-{ OMAP1610_ETHR_BASE, OMAP1610_ETHR_START, OMAP1610_ETHR_SIZE,MT_DEVICE },
-{ OMAP1610_NOR_FLASH_BASE, OMAP1610_NOR_FLASH_START, OMAP1610_NOR_FLASH_SIZE,
-	MT_DEVICE },
-};
-
-static void __init innovator_map_io(void)
-{
-	omap_map_io();
-	iotable_init(innovator_io_desc, ARRAY_SIZE(innovator_io_desc));
-}
-
-MACHINE_START(INNOVATOR, "TI-Innovator/OMAP1610")
-	MAINTAINER("MontaVista Software, Inc.")
-	BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
-	BOOT_PARAMS(0x10000100)
-	MAPIO(innovator_map_io)
-	INITIRQ(innovator_init_irq)
-	INIT_MACHINE(innovator_init)
-MACHINE_END
-
diff -Nru a/arch/arm/mach-omap/irq.c b/arch/arm/mach-omap/irq.c
--- a/arch/arm/mach-omap/irq.c	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/mach-omap/irq.c	Tue Jun 15 22:20:37 2004
@@ -5,6 +5,7 @@
  *
  * Copyright (C) 2004 Nokia Corporation
  * Written by Tony Lindgren <tony@atomide.com>
+ * Major cleanups by Juha Yrjölä <juha.yrjola@nokia.com>
  *
  * Completely re-written to support various OMAP chips with bank specific
  * interrupt handlers.
@@ -49,10 +50,16 @@
 
 #include <asm/io.h>
 
-#include "irq.h"
+#define IRQ_BANK(irq) ((irq) >> 5)
+#define IRQ_BIT(irq)  ((irq) & 0x1f)
 
-static unsigned int banks = 0;
-static struct omap_irq_bank irq_banks[MAX_NR_IRQ_BANKS];
+struct omap_irq_bank {
+	unsigned long base_reg;
+	unsigned long trigger_map;
+};
+
+static unsigned int irq_bank_count = 0;
+static struct omap_irq_bank *irq_banks;
 
 static inline unsigned int irq_bank_readl(int bank, int offset)
 {
@@ -64,94 +71,38 @@
 	omap_writel(value, irq_banks[bank].base_reg + offset);
 }
 
-/*
- * Ack routine for chips with register offsets of 0x100
- */
-static void omap_offset_ack_irq(unsigned int irq)
+static void omap_ack_irq(unsigned int irq)
 {
 	if (irq > 31)
-		omap_writel(0x1, OMAP_IH2_BASE + IRQ_CONTROL_REG);
+		omap_writel(0x1, OMAP_IH2_BASE + IRQ_CONTROL_REG_OFFSET);
 
-	omap_writel(0x1, OMAP_IH1_BASE + IRQ_CONTROL_REG);
+	omap_writel(0x1, OMAP_IH1_BASE + IRQ_CONTROL_REG_OFFSET);
 }
 
-/*
- * Mask routine for chips with register offsets of 0x100
- */
-static void omap_offset_mask_irq(unsigned int irq)
+static void omap_mask_irq(unsigned int irq)
 {
-	int bank = IRQ_TO_BANK(irq);
+	int bank = IRQ_BANK(irq);
+	u32 l;
 
-	if (bank) {
-		omap_writel(
-			omap_readl(OMAP_IH2_BASE + BANK_OFFSET(bank) + IRQ_MIR)
-			| (1 << IRQ_BIT(irq)),
-			OMAP_IH2_BASE + BANK_OFFSET(bank) + IRQ_MIR);
-	} else {
-		omap_writel(
-			omap_readl(OMAP_IH1_BASE + IRQ_MIR)
-			| (1 << IRQ_BIT(irq)),
-			OMAP_IH1_BASE  + IRQ_MIR);
-	}
+	l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
+	l |= 1 << IRQ_BIT(irq);
+	omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
 }
 
-/*
- * Unmask routine for chips with register offsets of 0x100
- */
-static void omap_offset_unmask_irq(unsigned int irq)
+static void omap_unmask_irq(unsigned int irq)
 {
-	int bank = IRQ_TO_BANK(irq);
+	int bank = IRQ_BANK(irq);
+	u32 l;
 
-	if (bank) {
-		omap_writel(
-			omap_readl(OMAP_IH2_BASE + BANK_OFFSET(bank) + IRQ_MIR)
-			& ~(1 << IRQ_BIT(irq)),
-			OMAP_IH2_BASE + BANK_OFFSET(bank) + IRQ_MIR);
-	} else {
-		omap_writel(
-			omap_readl(OMAP_IH1_BASE + IRQ_MIR)
-			& ~(1 << IRQ_BIT(irq)),
-			OMAP_IH1_BASE  + IRQ_MIR);
-	}
+	l = omap_readl(irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
+	l &= ~(1 << IRQ_BIT(irq));
+	omap_writel(l, irq_banks[bank].base_reg + IRQ_MIR_REG_OFFSET);
 }
 
-static void omap_offset_mask_ack_irq(unsigned int irq)
+static void omap_mask_ack_irq(unsigned int irq)
 {
-	omap_offset_mask_irq(irq);
-	omap_offset_ack_irq(irq);
-}
-
-/*
- * Given the irq number returns the bank number
- */
-signed int irq_get_bank(unsigned int irq)
-{
-	int i;
-
-	for (i = 0; i < banks; i++) {
-		if (irq >= irq_banks[i].start_irq
-		    && irq <= irq_banks[i].start_irq + BANK_NR_IRQS) {
-			return i;
-		}
-	}
-
-	printk(KERN_ERR "No irq handler found for irq %i\n", irq);
-
-	return -ENODEV;
-}
-
-/*
- * Given the bank and irq number returns the irq bit at the bank register
- */
-signed int irq_bank_get_bit(int bank, unsigned int irq)
-{
-	if (irq_banks[bank].start_irq > irq) {
-		printk(KERN_ERR "Incorrect irq %i: bank %i offset %i\n",
-		       irq, bank, irq_banks[bank].start_irq);
-		return -ENODEV;
-	}
-
-	return irq - irq_banks[bank].start_irq;
+	omap_mask_irq(irq);
+	omap_ack_irq(irq);
 }
 
 /*
@@ -161,114 +112,98 @@
  *	 mailing list threads on FIQ handlers if you are planning to
  *	 add a FIQ handler for OMAP.
  */
-void omap_irq_set_cfg(int irq, int fiq, int priority, int irq_level)
+static void omap_irq_set_cfg(int irq, int fiq, int priority, int trigger)
 {
 	signed int bank;
-	unsigned int irq_bit;
 	unsigned long val, offset;
 
-
-	bank = irq_get_bank(irq);
-
-	if (bank < 0)
-		return;
-
-	irq_bit = irq_bank_get_bit(bank, irq);
-
-	if (irq_bit < 0)
-		return;
-
-	/* FIQ is only availabe on bank 0 interrupts */
+	bank = IRQ_BANK(irq);
+	/* FIQ is only available on bank 0 interrupts */
 	fiq = bank ? 0 : (fiq & 0x1);
+	val = fiq | ((priority & 0x1f) << 2) | ((trigger & 0x1) << 1);
+	offset = IRQ_ILR0_REG_OFFSET + IRQ_BIT(irq) * 0x4;
+	irq_bank_writel(val, bank, offset);
+}
 
-	val = fiq | ((priority & 0x1f) << 2) | ((irq_level & 0x1) << 1);
+#ifdef CONFIG_ARCH_OMAP730
+static struct omap_irq_bank omap730_irq_banks[] = {
+	{ .base_reg = OMAP_IH1_BASE, 		.trigger_map = 0xb3f8e22f },
+	{ .base_reg = OMAP_IH2_BASE, 		.trigger_map = 0xfdb9c1f2 },
+	{ .base_reg = OMAP_IH2_BASE + 0x100,	.trigger_map = 0x800040f3 },
+};
+#endif
 
-	offset = IRQ_ILR0 + irq_bit * 0x4;
+#ifdef CONFIG_ARCH_OMAP1510
+static struct omap_irq_bank omap1510_irq_banks[] = {
+	{ .base_reg = OMAP_IH1_BASE, 		.trigger_map = 0xb3febfff },
+	{ .base_reg = OMAP_IH2_BASE, 		.trigger_map = 0xffbfffed },
+};
+#endif
 
-	irq_bank_writel(val, bank, offset);
-}
+#if defined(CONFIG_ARCH_OMAP1610) || defined(CONFIG_ARCH_OMAP5912)
+static struct omap_irq_bank omap1610_irq_banks[] = {
+	{ .base_reg = OMAP_IH1_BASE, 		.trigger_map = 0xb3fefe8f },
+	{ .base_reg = OMAP_IH2_BASE, 		.trigger_map = 0xfffff7ff },
+	{ .base_reg = OMAP_IH2_BASE + 0x100,	.trigger_map = 0xfffff7ff },
+	{ .base_reg = OMAP_IH2_BASE + 0x200,	.trigger_map = 0xffffffff },
+};
+#endif
 
-static struct omap_irq_desc *irq_bank_desc[] __initdata = {
-	&omap730_bank0_irqs,
-	&omap730_bank1_irqs,
-	&omap730_bank2_irqs,
-	&omap1510_bank0_irqs,
-	&omap1510_bank1_irqs,
-	&omap1610_bank0_irqs,
-	&omap1610_bank1_irqs,
-	&omap1610_bank2_irqs,
-	&omap1610_bank3_irqs,
-	NULL,
+static struct irqchip omap_irq_chip = {
+	.ack    = omap_mask_ack_irq,
+	.mask   = omap_mask_irq,
+	.unmask = omap_unmask_irq,
 };
 
 void __init omap_init_irq(void)
 {
-	int i,j, board_irq_type = 0, interrupts = 0;
-	struct omap_irq_desc *entry;
+	int i, j;
 
+#ifdef CONFIG_ARCH_OMAP730
 	if (cpu_is_omap730()) {
-		board_irq_type = OMAP_IRQ_TYPE730;
-	} else if (cpu_is_omap1510()) {
-		board_irq_type = OMAP_IRQ_TYPE1510;
-	} else if (cpu_is_omap1610() || cpu_is_omap5912()) {
-		board_irq_type = OMAP_IRQ_TYPE1610;
-	}
-
-	if (board_irq_type == 0) {
-		printk("Could not detect OMAP type\n");
-		return;
-	}
-
-	/* Scan through the interrupt bank maps and copy the right data */
-	for (i = 0; (entry = irq_bank_desc[i]) != NULL; i++) {
-		if (entry->cpu_type == board_irq_type) {
-			printk("Type %i IRQs from %3i to %3i base at 0x%lx\n",
-			       board_irq_type, entry->start_irq,
-			       entry->start_irq + BANK_NR_IRQS, entry->base_reg);
-
-			irq_banks[banks].start_irq = entry->start_irq;
-			irq_banks[banks].level_map = entry->level_map;
-			irq_banks[banks].base_reg = entry->base_reg;
-			irq_banks[banks].mask_reg = entry->mask_reg;
-			irq_banks[banks].ack_reg = entry->ack_reg;
-			irq_banks[banks].handler = entry->handler;
-
-			interrupts += BANK_NR_IRQS;
-			banks++;
-		}
+		irq_banks = omap730_irq_banks;
+		irq_bank_count = ARRAY_SIZE(omap730_irq_banks);
 	}
-
-	printk("Found total of %i interrupts in %i interrupt banks\n",
-	       interrupts, banks);
+#endif
+#ifdef CONFIG_ARCH_OMAP1510
+	if (cpu_is_omap1510()) {
+		irq_banks = omap1510_irq_banks;
+		irq_bank_count = ARRAY_SIZE(omap1510_irq_banks);
+	}
+#endif
+#if defined(CONFIG_ARCH_OMAP1610) || defined(CONFIG_ARCH_OMAP5912)
+	if (cpu_is_omap1610() || cpu_is_omap5912()) {
+		irq_banks = omap1610_irq_banks;
+		irq_bank_count = ARRAY_SIZE(omap1610_irq_banks);
+	}
+#endif
+	printk("Total of %i interrupts in %i interrupt banks\n",
+	       irq_bank_count * 32, irq_bank_count);
 
 	/* Mask and clear all interrupts */
-	for (i = 0; i < banks; i++) {
-		irq_bank_writel(~0x0, i, IRQ_MIR);
-		irq_bank_writel(0x0, i, IRQ_ITR);
+	for (i = 0; i < irq_bank_count; i++) {
+		irq_bank_writel(~0x0, i, IRQ_MIR_REG_OFFSET);
+		irq_bank_writel(0x0, i, IRQ_ITR_REG_OFFSET);
 	}
 
-	/*
-	 * Clear any pending interrupts
-	 */
-	irq_bank_writel(3, 0, IRQ_CONTROL_REG);
-	irq_bank_writel(3, 1, IRQ_CONTROL_REG);
+	/* Clear any pending interrupts */
+	irq_bank_writel(0x03, 0, IRQ_CONTROL_REG_OFFSET);
+	irq_bank_writel(0x03, 1, IRQ_CONTROL_REG_OFFSET);
 
 	/* Install the interrupt handlers for each bank */
-	for (i = 0; i < banks; i++) {
-		for (j = irq_banks[i].start_irq;
-		     j <= irq_banks[i].start_irq + BANK_NR_IRQS; j++) {
-			int irq_level;
-			set_irq_chip(j, irq_banks[i].handler);
+	for (i = 0; i < irq_bank_count; i++) {
+		for (j = i * 32; j < (i + 1) * 32; j++) {
+			int irq_trigger;
+
+			irq_trigger = irq_banks[i].trigger_map >> IRQ_BIT(j);
+			omap_irq_set_cfg(j, 0, 0, irq_trigger);
+
+			set_irq_chip(j, &omap_irq_chip);
 			set_irq_handler(j, do_level_IRQ);
 			set_irq_flags(j, IRQF_VALID);
-			irq_level = irq_banks[i].level_map
-				>> (j - irq_banks[i].start_irq) & 1;
-			omap_irq_set_cfg(j, 0, 0, irq_level);
 		}
 	}
 
 	/* Unmask level 2 handler */
-	omap_writel(0, irq_banks[0].mask_reg);
+	omap_unmask_irq(INT_IH2_IRQ);
 }
-
-EXPORT_SYMBOL(omap_irq_set_cfg);
diff -Nru a/arch/arm/mach-omap/irq.h b/arch/arm/mach-omap/irq.h
--- a/arch/arm/mach-omap/irq.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,172 +0,0 @@
-/*
- * linux/arch/arm/mach-omap/irq.h
- *
- * OMAP specific interrupt bank definitions
- *
- * Copyright (C) 2004 Nokia Corporation
- * Written by Tony Lindgren <tony@atomide.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.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * 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.
- */
-
-#define OMAP_IRQ_TYPE710	1
-#define OMAP_IRQ_TYPE730	2
-#define OMAP_IRQ_TYPE1510	3
-#define OMAP_IRQ_TYPE1610	4
-#define OMAP_IRQ_TYPE1710	5
-
-#define MAX_NR_IRQ_BANKS	4
-
-#define BANK_NR_IRQS		32
-
-struct omap_irq_desc {
-	unsigned int   	cpu_type;
-	unsigned int	start_irq;
-	unsigned long	level_map;
-	unsigned long	base_reg;
-	unsigned long	mask_reg;
-	unsigned long	ack_reg;
-	struct irqchip	*handler;
-};
-
-struct omap_irq_bank {
-	unsigned int	start_irq;
-	unsigned long	level_map;
-	unsigned long	base_reg;
-	unsigned long	mask_reg;
-	unsigned long	ack_reg;
-	struct irqchip	*handler;
-};
-
-static void omap_offset_ack_irq(unsigned int irq);
-static void omap_offset_mask_irq(unsigned int irq);
-static void omap_offset_unmask_irq(unsigned int irq);
-static void omap_offset_mask_ack_irq(unsigned int irq);
-
-/* NOTE: These will not work if irq bank offset != 0x100 */
-#define IRQ_TO_BANK(irq)	(irq >> 5)
-#define IRQ_BIT(irq)		(irq & 0x1f)
-#define BANK_OFFSET(bank)	((bank - 1) * 0x100)
-
-static struct irqchip omap_offset_irq = {
-	.ack	=  omap_offset_mask_ack_irq,
-	.mask	=  omap_offset_mask_irq,
-	.unmask	=  omap_offset_unmask_irq,
-};
-
-/*
- * OMAP-730 interrupt banks
- */
-static struct omap_irq_desc omap730_bank0_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE730,
-	.start_irq	= 0,
-	.level_map	= 0xb3f8e22f,
-	.base_reg	= OMAP_IH1_BASE,
-	.mask_reg	= OMAP_IH1_BASE + IRQ_MIR,
-	.ack_reg	= OMAP_IH1_BASE + IRQ_CONTROL_REG,
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
-
-static struct omap_irq_desc omap730_bank1_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE730,
-	.start_irq	= 32,
-	.level_map	= 0xfdb9c1f2,
-	.base_reg	= OMAP_IH2_BASE,
-	.mask_reg	= OMAP_IH2_BASE + IRQ_MIR,
-	.ack_reg	= OMAP_IH2_BASE + IRQ_CONTROL_REG,
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
-
-static struct omap_irq_desc omap730_bank2_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE730,
-	.start_irq	= 64,
-	.level_map	= 0x800040f3,
-	.base_reg	= OMAP_IH2_BASE + 0x100,
-	.mask_reg	= OMAP_IH2_BASE + 0x100 + IRQ_MIR,
-	.ack_reg	= OMAP_IH2_BASE + IRQ_CONTROL_REG, /* Not replicated */
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
-
-/*
- * OMAP-1510 interrupt banks
- */
-static struct omap_irq_desc omap1510_bank0_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE1510,
-	.start_irq	= 0,
-	.level_map	= 0xb3febfff,
-	.base_reg	= OMAP_IH1_BASE,
-	.mask_reg	= OMAP_IH1_BASE + IRQ_MIR,
-	.ack_reg	= OMAP_IH1_BASE + IRQ_CONTROL_REG,
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
-
-static struct omap_irq_desc omap1510_bank1_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE1510,
-	.start_irq	= 32,
-	.level_map	= 0xffbfffed,
-	.base_reg	= OMAP_IH2_BASE,
-	.mask_reg	= OMAP_IH2_BASE + IRQ_MIR,
-	.ack_reg	= OMAP_IH2_BASE + IRQ_CONTROL_REG,
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
-
-/*
- * OMAP-1610 interrupt banks
- */
-static struct omap_irq_desc omap1610_bank0_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE1610,
-	.start_irq	= 0,
-	.level_map	= 0xb3fefe8f,
-	.base_reg	= OMAP_IH1_BASE,
-	.mask_reg	= OMAP_IH1_BASE + IRQ_MIR,
-	.ack_reg	= OMAP_IH1_BASE + IRQ_CONTROL_REG,
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
-
-static struct omap_irq_desc omap1610_bank1_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE1610,
-	.start_irq	= 32,
-	.level_map	= 0xfffff7ff,
-	.base_reg	= OMAP_IH2_BASE,
-	.mask_reg	= OMAP_IH2_BASE + IRQ_MIR,
-	.ack_reg	= OMAP_IH2_BASE + IRQ_CONTROL_REG,
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
-
-static struct omap_irq_desc omap1610_bank2_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE1610,
-	.start_irq	= 64,
-	.level_map	= 0xffffffff,
-	.base_reg	= OMAP_IH2_BASE + 0x100,
-	.mask_reg	= OMAP_IH2_BASE + 0x100 + IRQ_MIR,
-	.ack_reg	= OMAP_IH2_BASE + IRQ_CONTROL_REG, /* Not replicated */
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
-
-static struct omap_irq_desc omap1610_bank3_irqs __initdata = {
-	.cpu_type	= OMAP_IRQ_TYPE1610,
-	.start_irq	= 96,
-	.level_map	= 0xffffffff,
-	.base_reg	= OMAP_IH2_BASE + 0x200,
-	.mask_reg	= OMAP_IH2_BASE + 0x200 + IRQ_MIR,
-	.ack_reg	= OMAP_IH2_BASE + IRQ_CONTROL_REG, /* Not replicated */
-	.handler	= &omap_offset_irq,	/* IH2 regs at 0x100 offsets */
-};
diff -Nru a/arch/arm/mach-omap/leds-perseus2.c b/arch/arm/mach-omap/leds-perseus2.c
--- a/arch/arm/mach-omap/leds-perseus2.c	Tue Jun 15 22:20:43 2004
+++ b/arch/arm/mach-omap/leds-perseus2.c	Tue Jun 15 22:20:43 2004
@@ -96,7 +96,7 @@
 	/*
 	 *  Actually burn the LEDs
 	 */
-	omap_writew(~hw_led_state & 0xffff, OMAP730_FPGA_LEDS);
+	__raw_writew(~hw_led_state & 0xffff, OMAP730_FPGA_LEDS);
 
 	local_irq_restore(flags);
 }
diff -Nru a/arch/arm/mach-omap/ocpi.c b/arch/arm/mach-omap/ocpi.c
--- a/arch/arm/mach-omap/ocpi.c	Tue Jun 15 22:21:03 2004
+++ b/arch/arm/mach-omap/ocpi.c	Tue Jun 15 22:21:03 2004
@@ -85,14 +85,6 @@
 	val &= ~0xff;
 	omap_writel(val, OCPI_SEC);
 
-	val = omap_readl(OCPI_SEC);
-	val |= 0;
-	omap_writel(val, OCPI_SEC);
-
-	val = omap_readl(OCPI_SINT0);
-	val |= 0;
-	omap_writel(val, OCPI_SINT1);
-
 	return 0;
 }
 EXPORT_SYMBOL(ocpi_enable);
diff -Nru a/arch/arm/mach-omap/omap-generic.c b/arch/arm/mach-omap/omap-generic.c
--- a/arch/arm/mach-omap/omap-generic.c	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,77 +0,0 @@
-/*
- * linux/arch/arm/mach-omap/generic.c
- *
- * Modified from innovator.c
- *
- * Code for generic OMAP board. Should work on many OMAP systems where
- * the device drivers take care of all the necessary hardware initialization.
- * Do not put any board specific code to this file; create a new machine
- * type if you need custom low-level initializations.
- *
- * 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/init.h>
-#include <linux/device.h>
-
-#include <asm/hardware.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <asm/arch/clocks.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/mux.h>
-
-#include "common.h"
-
-static void __init omap_generic_init_irq(void)
-{
-	omap_init_irq();
-}
-
-/*
- * Muxes the serial ports on
- */
-static void __init omap_early_serial_init(void)
-{
-	omap_cfg_reg(UART1_TX);
-	omap_cfg_reg(UART1_RTS);
-
-	omap_cfg_reg(UART2_TX);
-	omap_cfg_reg(UART2_RTS);
-
-	omap_cfg_reg(UART3_TX);
-	omap_cfg_reg(UART3_RX);
-}
-
-static void __init omap_generic_init(void)
-{
-	if (!machine_is_omap_generic())
-		return;
-
-	/*
-	 * Make sure the serial ports are muxed on at this point.
-	 * You have to mux them off in device drivers later on
-	 * if not needed.
-	 */
-	if (cpu_is_omap1510()) {
-		omap_early_serial_init();
-	}
-}
-
-static void __init omap_generic_map_io(void)
-{
-	omap_map_io();
-}
-
-MACHINE_START(OMAP_GENERIC, "Generic OMAP-1510/1610")
-	MAINTAINER("Tony Lindgren <tony@atomide.com>")
-	BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
-	BOOT_PARAMS(0x10000100)
-	MAPIO(omap_generic_map_io)
-	INITIRQ(omap_generic_init_irq)
-	INIT_MACHINE(omap_generic_init)
-MACHINE_END
diff -Nru a/arch/arm/mach-omap/omap-perseus2.c b/arch/arm/mach-omap/omap-perseus2.c
--- a/arch/arm/mach-omap/omap-perseus2.c	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,116 +0,0 @@
-/*
- * linux/arch/arm/mach-omap/omap-perseus2.c
- *
- * Modified from omap-generic.c
- *
- * 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/init.h>
-#include <linux/device.h>
-
-#include <asm/hardware.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
-#include <asm/arch/clocks.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/mux.h>
-
-#include <asm/arch/omap-perseus2.h>
-
-#include "common.h"
-
-void omap_perseus2_init_irq(void)
-{
-	omap_init_irq();
-}
-
-static struct resource smc91x_resources[] = {
-	[0] = {
-		.start	= OMAP730_FPGA_ETHR_START,	/* Physical */
-		.end	= OMAP730_FPGA_ETHR_START + SZ_4K,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= 0,
-		.end	= 0,
-		.flags	= INT_ETHER,
-	},
-};
-
-static struct platform_device smc91x_device = {
-	.name		= "smc91x",
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(smc91x_resources),
-	.resource	= smc91x_resources,
-};
-
-static struct platform_device *devices[] __initdata = {
-	&smc91x_device,
-};
-
-static void __init omap_perseus2_init(void)
-{
-	if (!machine_is_omap_perseus2())
-		return;
-
-	(void) platform_add_devices(devices, ARRAY_SIZE(devices));
-}
-
-/* Only FPGA needs to be mapped here. All others are done with ioremap */
-static struct map_desc omap_perseus2_io_desc[] __initdata = {
-	{OMAP730_FPGA_BASE, OMAP730_FPGA_START, OMAP730_FPGA_SIZE,
-	 MT_DEVICE},
-};
-
-static void __init omap_perseus2_map_io(void)
-{
-	omap_map_io();
-	iotable_init(omap_perseus2_io_desc,
-		     ARRAY_SIZE(omap_perseus2_io_desc));
-
-	/* Early, board-dependent init */
-
-	/*
-	 * Hold GSM Reset until needed
-	 */
-	*DSP_M_CTL &= ~1;
-
-	/*
-	 * UARTs -> done automagically by 8250 driver
-	 */
-
-	/*
-	 * CSx timings, GPIO Mux ... setup
-	 */
-
-	/* Flash: CS0 timings setup */
-	*((volatile __u32 *) OMAP_FLASH_CFG_0) = 0x0000fff3;
-	*((volatile __u32 *) OMAP_FLASH_ACFG_0) = 0x00000088;
-
-	/*
-	 * Ethernet support trough the debug board
-	 * CS1 timings setup
-	 */
-	*((volatile __u32 *) OMAP_FLASH_CFG_1) = 0x0000fff3;
-	*((volatile __u32 *) OMAP_FLASH_ACFG_1) = 0x00000000;
-
-	/*
-	 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
-	 * It is used as the Ethernet controller interrupt
-	 */
-	*((volatile __u32 *) PERSEUS2_IO_CONF_9) &= 0x1FFFFFFF;
-}
-
-MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
-	MAINTAINER("Kevin Hilman <k-hilman@ti.com>")
-	BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
-	BOOT_PARAMS(0x10000100)
-	MAPIO(omap_perseus2_map_io)
-	INITIRQ(omap_perseus2_init_irq)
-	INIT_MACHINE(omap_perseus2_init)
-MACHINE_END
diff -Nru a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
--- a/arch/arm/mach-pxa/Kconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/arm/mach-pxa/Kconfig	Tue Jun 15 22:20:38 2004
@@ -1,13 +1,35 @@
+if ARCH_PXA
 
-menu "Intel PXA250/210 Implementations"
+menu "Intel PXA2xx Implementations"
+
+choice
+	prompt "Select target board"
 
 config ARCH_LUBBOCK
 	bool "Intel DBPXA250 Development Platform"
-	depends on ARCH_PXA
+	select PXA25x
+
+config MACH_MAINSTONE
+	bool "Intel HCDDBBVA0 Development Platform"
+	select PXA27x
+	#select IWMMXT
 
 config ARCH_PXA_IDP
 	bool "Accelent Xscale IDP"
-	depends on ARCH_PXA
+	select PXA25x
+
+endchoice
 
 endmenu
 
+config PXA25x
+	bool
+	help
+	  Select code specific to PXA21x/25x/26x variants
+
+config PXA27x
+	bool
+	help
+	  Select code specific to PXA27x variants
+
+endif
diff -Nru a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
--- a/arch/arm/mach-pxa/Makefile	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/mach-pxa/Makefile	Tue Jun 15 22:20:40 2004
@@ -4,14 +4,18 @@
 
 # Common support (must be linked before board specific support)
 obj-y += generic.o irq.o dma.o
+obj-$(CONFIG_PXA25x) += pxa25x.o
+obj-$(CONFIG_PXA27x) += pxa27x.o
 
 # Specific board support
 obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
+obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
 obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
 
 # Support for blinky lights
 led-y := leds.o
 led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o
+led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o
 led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o
 
 obj-$(CONFIG_LEDS) += $(led-y)
diff -Nru a/arch/arm/mach-pxa/dma.c b/arch/arm/mach-pxa/dma.c
--- a/arch/arm/mach-pxa/dma.c	Tue Jun 15 22:21:05 2004
+++ b/arch/arm/mach-pxa/dma.c	Tue Jun 15 22:21:05 2004
@@ -28,7 +28,7 @@
 	char *name;
 	void (*irq_handler)(int, void *, struct pt_regs *);
 	void *data;
-} dma_channels[16];
+} dma_channels[PXA_DMA_CHANNELS];
 
 
 int pxa_request_dma (char *name, pxa_dma_prio prio,
@@ -45,7 +45,7 @@
 	local_irq_save(flags);
 
 	/* try grabbing a DMA channel with the requested priority */
-	for (i = prio; i < prio + (prio == DMA_PRIO_LOW) ? 8 : 4; i++) {
+	for (i = prio; i < prio + PXA_DMA_NBCH(prio); i++) {
 		if (!dma_channels[i].name) {
 			found = 1;
 			break;
@@ -97,7 +97,7 @@
 {
 	int i, dint = DINT;
 
-	for (i = 0; i < 16; i++) {
+	for (i = 0; i < PXA_DMA_CHANNELS; i++) {
 		if (dint & (1 << i)) {
 			struct dma_channel *channel = &dma_channels[i];
 			if (channel->name && channel->irq_handler) {
diff -Nru a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
--- a/arch/arm/mach-pxa/generic.c	Tue Jun 15 22:20:38 2004
+++ b/arch/arm/mach-pxa/generic.c	Tue Jun 15 22:20:38 2004
@@ -31,77 +31,11 @@
 #include <asm/mach/map.h>
 
 #include <asm/arch/udc.h>
+#include <asm/arch/pxafb.h>
 
 #include "generic.h"
 
 /*
- * Various clock factors driven by the CCCR register.
- */
-
-/* Crystal Frequency to Memory Frequency Multiplier (L) */
-static unsigned char L_clk_mult[32] = { 0, 27, 32, 36, 40, 45, 0, };
-
-/* Memory Frequency to Run Mode Frequency Multiplier (M) */
-static unsigned char M_clk_mult[4] = { 0, 1, 2, 4 };
-
-/* Run Mode Frequency to Turbo Mode Frequency Multiplier (N) */
-/* Note: we store the value N * 2 here. */
-static unsigned char N2_clk_mult[8] = { 0, 0, 2, 3, 4, 0, 6, 0 };
-
-/* Crystal clock */
-#define BASE_CLK	3686400
-
-/*
- * Get the clock frequency as reflected by CCCR and the turbo flag.
- * We assume these values have been applied via a fcs.
- * If info is not 0 we also display the current settings.
- */
-unsigned int get_clk_frequency_khz(int info)
-{
-	unsigned long cccr, turbo;
-	unsigned int l, L, m, M, n2, N;
-
-	cccr = CCCR;
-	asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (turbo) );
-
-	l  =  L_clk_mult[(cccr >> 0) & 0x1f];
-	m  =  M_clk_mult[(cccr >> 5) & 0x03];
-	n2 = N2_clk_mult[(cccr >> 7) & 0x07];
-
-	L = l * BASE_CLK;
-	M = m * L;
-	N = n2 * M / 2;
-
-	if(info)
-	{
-		L += 5000;
-		printk( KERN_INFO "Memory clock: %d.%02dMHz (*%d)\n",
-			L / 1000000, (L % 1000000) / 10000, l );
-		M += 5000;
-		printk( KERN_INFO "Run Mode clock: %d.%02dMHz (*%d)\n",
-			M / 1000000, (M % 1000000) / 10000, m );
-		N += 5000;
-		printk( KERN_INFO "Turbo Mode clock: %d.%02dMHz (*%d.%d, %sactive)\n",
-			N / 1000000, (N % 1000000) / 10000, n2 / 2, (n2 % 2) * 5,
-			(turbo & 1) ? "" : "in" );
-	}
-
-	return (turbo & 1) ? (N/1000) : (M/1000);
-}
-
-EXPORT_SYMBOL(get_clk_frequency_khz);
-
-/*
- * Return the current lclk requency in units of 10kHz
- */
-unsigned int get_lclk_frequency_10khz(void)
-{
-	return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000;
-}
-
-EXPORT_SYMBOL(get_lclk_frequency_10khz);
-
-/*
  * Handy function to set GPIO alternate functions
  */
 
@@ -125,16 +59,21 @@
 EXPORT_SYMBOL(pxa_gpio_mode);
 
 /*
- * Note that 0xfffe0000-0xffffffff is reserved for the vector table and
- * cache flush area.
+ * Intel PXA2xx internal register mapping.
+ *
+ * Note 1: not all PXA2xx variants implement all those addresses.
+ *
+ * Note 2: virtual 0xfffe0000-0xffffffff is reserved for the vector table
+ *         and cache flush area.
  */
 static struct map_desc standard_io_desc[] __initdata = {
  /* virtual     physical    length      type */
-  { 0xf6000000, 0x20000000, 0x01000000, MT_DEVICE }, /* PCMCIA0 IO */
-  { 0xf7000000, 0x30000000, 0x01000000, MT_DEVICE }, /* PCMCIA1 IO */
-  { 0xf8000000, 0x40000000, 0x01400000, MT_DEVICE }, /* Devs */
-  { 0xfa000000, 0x44000000, 0x00100000, MT_DEVICE }, /* LCD */
-  { 0xfc000000, 0x48000000, 0x00100000, MT_DEVICE }, /* Mem Ctl */
+  { 0xf2000000, 0x40000000, 0x01800000, MT_DEVICE }, /* Devs */
+  { 0xf4000000, 0x44000000, 0x00100000, MT_DEVICE }, /* LCD */
+  { 0xf6000000, 0x48000000, 0x00100000, MT_DEVICE }, /* Mem Ctl */
+  { 0xf8000000, 0x4c000000, 0x00100000, MT_DEVICE }, /* USB host */
+  { 0xfa000000, 0x50000000, 0x00100000, MT_DEVICE }, /* Camera */
+  { 0xfe000000, 0x58000000, 0x00100000, MT_DEVICE }, /* IMem ctl */
   { 0xff000000, 0x00000000, 0x00100000, MT_DEVICE }  /* UNCACHED_PHYS_0 */
 };
 
@@ -165,6 +104,7 @@
 	.id		= 0,
 	.dev		= {
 		.dma_mask = &pxamci_dmamask,
+		.coherent_dma_mask = 0xffffffff,
 	},
 	.num_resources	= ARRAY_SIZE(pxamci_resources),
 	.resource	= pxamci_resources,
@@ -205,9 +145,45 @@
 	}
 };
 
+static struct pxafb_mach_info pxa_fb_info;
+
+void __init set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info)
+{
+	memcpy(&pxa_fb_info,hard_pxa_fb_info,sizeof(struct pxafb_mach_info));
+}
+EXPORT_SYMBOL(set_pxa_fb_info);
+
+static struct resource pxafb_resources[] = {
+	[0] = {
+		.start	= 0x44000000,
+		.end	= 0x4400ffff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_LCD,
+		.end	= IRQ_LCD,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static u64 fb_dma_mask = ~(u64)0;
+
+static struct platform_device pxafb_device = {
+	.name		= "pxafb",
+	.id		= 0,
+	.dev		= {
+ 		.platform_data	= &pxa_fb_info,
+		.dma_mask	= &fb_dma_mask,
+		.coherent_dma_mask = 0xffffffff,
+	},
+	.num_resources	= ARRAY_SIZE(pxafb_resources),
+	.resource	= pxafb_resources,
+};
+
 static struct platform_device *devices[] __initdata = {
 	&pxamci_device,
 	&udc_device,
+	&pxafb_device,
 };
 
 static int __init pxa_init(void)
diff -Nru a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
--- a/arch/arm/mach-pxa/idp.c	Tue Jun 15 22:20:35 2004
+++ b/arch/arm/mach-pxa/idp.c	Tue Jun 15 22:20:35 2004
@@ -27,6 +27,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+#include <asm/arch/idp.h>
+
 #include "generic.h"
 
 #ifndef PXA_IDP_REV02
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	Tue Jun 15 22:20:43 2004
+++ b/arch/arm/mach-pxa/leds-idp.c	Tue Jun 15 22:20:43 2004
@@ -19,6 +19,8 @@
 #include <asm/leds.h>
 #include <asm/system.h>
 
+#include <asm/arch/idp.h>
+
 #include "leds.h"
 
 #define LED_STATE_ENABLED	1
diff -Nru a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c
--- a/arch/arm/mach-pxa/leds-lubbock.c	Tue Jun 15 22:20:36 2004
+++ b/arch/arm/mach-pxa/leds-lubbock.c	Tue Jun 15 22:20:36 2004
@@ -17,6 +17,7 @@
 #include <asm/hardware.h>
 #include <asm/leds.h>
 #include <asm/system.h>
+#include <asm/arch/lubbock.h>
 
 #include "leds.h"
 
@@ -88,7 +89,7 @@
 		break;
 
 	case led_green_on:
-		hw_led_state |= D21;;
+		hw_led_state |= D21;
 		break;
 
 	case led_green_off:
@@ -96,7 +97,7 @@
 		break;
 
 	case led_amber_on:
-		hw_led_state |= D22;;
+		hw_led_state |= D22;
 		break;
 
 	case led_amber_off:
@@ -104,7 +105,7 @@
 		break;
 
 	case led_red_on:
-		hw_led_state |= D23;;
+		hw_led_state |= D23;
 		break;
 
 	case led_red_off:
diff -Nru a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-pxa/leds-mainstone.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,120 @@
+/*
+ * linux/arch/arm/mach-pxa/leds-mainstone.c
+ *
+ * Author:     Nicolas Pitre
+ * Created:    Nov 05, 2002
+ * Copyright:  MontaVista Software Inc.
+ *
+ * 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/config.h>
+#include <linux/init.h>
+
+#include <asm/hardware.h>
+#include <asm/leds.h>
+#include <asm/system.h>
+
+#include <asm/arch/mainstone.h>
+
+#include "leds.h"
+
+
+/* 8 discrete leds available for general use: */
+#define D28			(1 << 0)
+#define D27			(1 << 1)
+#define D26			(1 << 2)
+#define D25			(1 << 3)
+#define D24			(1 << 4)
+#define D23			(1 << 5)
+#define D22			(1 << 6)
+#define D21			(1 << 7)
+
+#define LED_STATE_ENABLED	1
+#define LED_STATE_CLAIMED	2
+
+static unsigned int led_state;
+static unsigned int hw_led_state;
+
+void mainstone_leds_event(led_event_t evt)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+
+	switch (evt) {
+	case led_start:
+		hw_led_state = 0;
+		led_state = LED_STATE_ENABLED;
+		break;
+
+	case led_stop:
+		led_state &= ~LED_STATE_ENABLED;
+		break;
+
+	case led_claim:
+		led_state |= LED_STATE_CLAIMED;
+		hw_led_state = 0;
+		break;
+
+	case led_release:
+		led_state &= ~LED_STATE_CLAIMED;
+		hw_led_state = 0;
+		break;
+
+#ifdef CONFIG_LEDS_TIMER
+	case led_timer:
+		hw_led_state ^= D26;
+		break;
+#endif
+
+#ifdef CONFIG_LEDS_CPU
+	case led_idle_start:
+		hw_led_state &= ~D27;
+		break;
+
+	case led_idle_end:
+		hw_led_state |= D27;
+		break;
+#endif
+
+	case led_halted:
+		break;
+
+	case led_green_on:
+		hw_led_state |= D21;;
+		break;
+
+	case led_green_off:
+		hw_led_state &= ~D21;
+		break;
+
+	case led_amber_on:
+		hw_led_state |= D22;;
+		break;
+
+	case led_amber_off:
+		hw_led_state &= ~D22;
+		break;
+
+	case led_red_on:
+		hw_led_state |= D23;;
+		break;
+
+	case led_red_off:
+		hw_led_state &= ~D23;
+		break;
+
+	default:
+		break;
+	}
+
+	if  (led_state & LED_STATE_ENABLED)
+		MST_LEDCTRL = (MST_LEDCTRL | 0xff) & ~hw_led_state;
+	else
+		MST_LEDCTRL |= 0xff;
+
+	local_irq_restore(flags);
+}
diff -Nru a/arch/arm/mach-pxa/leds.c b/arch/arm/mach-pxa/leds.c
--- a/arch/arm/mach-pxa/leds.c	Tue Jun 15 22:21:04 2004
+++ b/arch/arm/mach-pxa/leds.c	Tue Jun 15 22:21:04 2004
@@ -20,6 +20,8 @@
 {
 	if (machine_is_lubbock())
 		leds_event = lubbock_leds_event;
+	if (machine_is_mainstone())
+		leds_event = mainstone_leds_event;
 	if (machine_is_pxa_idp())
 		leds_event = idp_leds_event;
 
diff -Nru a/arch/arm/mach-pxa/leds.h b/arch/arm/mach-pxa/leds.h
--- a/arch/arm/mach-pxa/leds.h	Tue Jun 15 22:20:43 2004
+++ b/arch/arm/mach-pxa/leds.h	Tue Jun 15 22:20:43 2004
@@ -7,5 +7,6 @@
  *
  */
 
-extern void lubbock_leds_event(led_event_t evt);
 extern void idp_leds_event(led_event_t evt);
+extern void lubbock_leds_event(led_event_t evt);
+extern void mainstone_leds_event(led_event_t evt);
diff -Nru a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
--- a/arch/arm/mach-pxa/lubbock.c	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/mach-pxa/lubbock.c	Tue Jun 15 22:20:39 2004
@@ -11,11 +11,12 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
+#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/major.h>
-#include <linux/fs.h>
+#include <linux/fb.h>
 #include <linux/interrupt.h>
 
 #include <asm/setup.h>
@@ -28,12 +29,24 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
+#include <asm/arch/lubbock.h>
 #include <asm/arch/udc.h>
+#include <asm/arch/pxafb.h>
 #include <asm/hardware/sa1111.h>
 
 #include "generic.h"
 
 
+void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+	LUB_MISC_WR = (LUB_MISC_WR & ~mask) | (set & mask);
+	local_irq_restore(flags);
+}
+EXPORT_SYMBOL(lubbock_set_misc_wr);
+
 static unsigned long lubbock_irq_enabled;
 
 static void lubbock_mask_irq(unsigned int irq)
@@ -148,9 +161,29 @@
 	&smc91x_device,
 };
 
+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),
+};
+
 static void __init lubbock_init(void)
 {
 	pxa_set_udc_info(&udc_info);
+	set_pxa_fb_info(&sharp_lm8v31);
 	(void) platform_add_devices(devices, ARRAY_SIZE(devices));
 }
 
diff -Nru a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-pxa/mainstone.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,141 @@
+/*
+ *  linux/arch/arm/mach-pxa/mainstone.c
+ *
+ *  Support for the Intel HCDDBBVA0 Development Platform.
+ *  (go figure how they came up with such name...)
+ *
+ *  Author:	Nicolas Pitre
+ *  Created:	Nov 05, 2002
+ *  Copyright:	MontaVista Software Inc.
+ *
+ *  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/init.h>
+#include <linux/device.h>
+#include <linux/interrupt.h>
+#include <linux/sched.h>
+#include <linux/bitops.h>
+
+#include <asm/types.h>
+#include <asm/setup.h>
+#include <asm/memory.h>
+#include <asm/mach-types.h>
+#include <asm/hardware.h>
+#include <asm/irq.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/arch/mainstone.h>
+
+#include "generic.h"
+
+
+static unsigned long mainstone_irq_enabled;
+
+static void mainstone_mask_irq(unsigned int irq)
+{
+	int mainstone_irq = (irq - MAINSTONE_IRQ(0));
+	MST_INTMSKENA = (mainstone_irq_enabled &= ~(1 << mainstone_irq));
+}
+
+static void mainstone_unmask_irq(unsigned int irq)
+{
+	int mainstone_irq = (irq - MAINSTONE_IRQ(0));
+	/* the irq can be acknowledged only if deasserted, so it's done here */
+	MST_INTSETCLR &= ~(1 << mainstone_irq);
+	MST_INTMSKENA = (mainstone_irq_enabled |= (1 << mainstone_irq));
+}
+
+static struct irqchip mainstone_irq_chip = {
+	.ack		= mainstone_mask_irq,
+	.mask		= mainstone_mask_irq,
+	.unmask		= mainstone_unmask_irq,
+};
+
+
+static void mainstone_irq_handler(unsigned int irq, struct irqdesc *desc,
+				  struct pt_regs *regs)
+{
+	unsigned long pending = MST_INTSETCLR & mainstone_irq_enabled;
+	do {
+		GEDR(0) = GPIO_bit(0);  /* clear useless edge notification */
+		if (likely(pending)) {
+			irq = MAINSTONE_IRQ(0) + __ffs(pending);
+			desc = irq_desc + irq;
+			desc->handle(irq, desc, regs);
+		}
+		pending = MST_INTSETCLR & mainstone_irq_enabled;
+	} while (pending);
+}
+
+static void __init mainstone_init_irq(void)
+{
+	int irq;
+
+	pxa_init_irq();
+
+	/* setup extra Mainstone irqs */
+	for(irq = MAINSTONE_IRQ(0); irq <= MAINSTONE_IRQ(15); irq++) {
+		set_irq_chip(irq, &mainstone_irq_chip);
+		set_irq_handler(irq, do_level_IRQ);
+		set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+	}
+	set_irq_flags(MAINSTONE_IRQ(8), 0);
+	set_irq_flags(MAINSTONE_IRQ(12), 0);
+
+	MST_INTMSKENA = 0;
+	MST_INTSETCLR = 0;
+
+	set_irq_chained_handler(IRQ_GPIO(0), mainstone_irq_handler);
+	set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
+}
+
+
+static struct resource smc91x_resources[] = {
+	[0] = {
+		.start	= (MST_ETH_PHYS + 0x300),
+		.end	= (MST_ETH_PHYS + 0xfffff),
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= MAINSTONE_IRQ(3),
+		.end	= MAINSTONE_IRQ(3),
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device smc91x_device = {
+	.name		= "smc91x",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(smc91x_resources),
+	.resource	= smc91x_resources,
+};
+
+static void __init mainstone_init(void)
+{
+	platform_add_device(&smc91x_device);
+}
+
+
+static struct map_desc mainstone_io_desc[] __initdata = {
+  { MST_FPGA_VIRT, MST_FPGA_PHYS, 0x00100000, MT_DEVICE }, /* CPLD */
+};
+
+static void __init mainstone_map_io(void)
+{
+	pxa_map_io();
+	iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc));
+}
+
+MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
+	MAINTAINER("MontaVista Software Inc.")
+	BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
+	MAPIO(mainstone_map_io)
+	INITIRQ(mainstone_init_irq)
+	INIT_MACHINE(mainstone_init)
+MACHINE_END
diff -Nru a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
--- a/arch/arm/mach-pxa/pm.c	Tue Jun 15 22:20:41 2004
+++ b/arch/arm/mach-pxa/pm.c	Tue Jun 15 22:20:41 2004
@@ -19,6 +19,7 @@
 #include <asm/hardware.h>
 #include <asm/memory.h>
 #include <asm/system.h>
+#include <asm/arch/lubbock.h>
 
 
 /*
@@ -32,6 +33,11 @@
 #define SAVE(x)		sleep_save[SLEEP_SAVE_##x] = x
 #define RESTORE(x)	x = sleep_save[SLEEP_SAVE_##x]
 
+#define RESTORE_GPLEVEL(n) do { \
+	GPSR##n = sleep_save[SLEEP_SAVE_GPLR##n]; \
+	GPCR##n = ~sleep_save[SLEEP_SAVE_GPLR##n]; \
+} while (0)
+
 /*
  * List of global PXA peripheral registers to preserve.
  * More ones like CP and general purpose register values are preserved
@@ -42,16 +48,13 @@
 	SLEEP_SAVE_OSCR, SLEEP_SAVE_OIER,
 	SLEEP_SAVE_OSMR0, SLEEP_SAVE_OSMR1, SLEEP_SAVE_OSMR2, SLEEP_SAVE_OSMR3,
 
+	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_FFIER, SLEEP_SAVE_FFLCR, SLEEP_SAVE_FFMCR,
-	SLEEP_SAVE_FFSPR, SLEEP_SAVE_FFISR,
-	SLEEP_SAVE_FFDLL, SLEEP_SAVE_FFDLH,
-
 	SLEEP_SAVE_ICMR,
 	SLEEP_SAVE_CKEN,
 
@@ -74,21 +77,6 @@
 	/* preserve current time */
 	delta = xtime.tv_sec - RCNR;
 
-	/*
-	 * Temporary solution.  This won't be necessary once
-	 * we move pxa support into the serial driver
-	 * Save the FF UART
-	 */
-	SAVE(FFIER);
-	SAVE(FFLCR);
-	SAVE(FFMCR);
-	SAVE(FFSPR);
-	SAVE(FFISR);
-	FFLCR |= 0x80;
-	SAVE(FFDLL);
-	SAVE(FFDLH);
-	FFLCR &= 0xef;
-
 	/* save vital registers */
 	SAVE(OSCR);
 	SAVE(OSMR0);
@@ -97,6 +85,7 @@
 	SAVE(OSMR3);
 	SAVE(OIER);
 
+	SAVE(GPLR0); SAVE(GPLR1); SAVE(GPLR2);
 	SAVE(GPDR0); SAVE(GPDR1); SAVE(GPDR2);
 	SAVE(GRER0); SAVE(GRER1); SAVE(GRER2);
 	SAVE(GFER0); SAVE(GFER1); SAVE(GFER2);
@@ -146,14 +135,15 @@
 	PSPR = 0;
 
 	/* restore registers */
-	RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
-	RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2);
-	RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2);
 	RESTORE(GAFR0_L); RESTORE(GAFR0_U);
 	RESTORE(GAFR1_L); RESTORE(GAFR1_U);
 	RESTORE(GAFR2_L); RESTORE(GAFR2_U);
+	RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
+	RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
+	RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2);
+	RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2);
 
-	PSSR = PSSR_PH;
+	PSSR = PSSR_RDH | PSSR_PH;
 
 	RESTORE(OSMR0);
 	RESTORE(OSMR1);
@@ -167,22 +157,6 @@
 	ICLR = 0;
 	ICCR = 1;
 	RESTORE(ICMR);
-
-	/*
-	 * Temporary solution.  This won't be necessary once
-	 * we move pxa support into the serial driver.
-	 * Restore the FF UART.
-	 */
-	RESTORE(FFMCR);
-	RESTORE(FFSPR);
-	RESTORE(FFLCR);
-	FFLCR |= 0x80;
-	RESTORE(FFDLH);
-	RESTORE(FFDLL);
-	RESTORE(FFLCR);
-	RESTORE(FFISR);
-	FFFCR = 0x07;
-	RESTORE(FFIER);
 
 	/* restore current time */
 	xtime.tv_sec = RCNR + delta;
diff -Nru a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-pxa/pxa25x.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,103 @@
+/*
+ *  linux/arch/arm/mach-pxa/pxa25x.c
+ *
+ *  Author:	Nicolas Pitre
+ *  Created:	Jun 15, 2001
+ *  Copyright:	MontaVista Software Inc.
+ *
+ * Code specific to PXA21x/25x/26x variants.
+ *
+ * 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.
+ *
+ * Since this file should be linked before any other machine specific file,
+ * the __initcall() here will be executed first.  This serves as default
+ * initialization stuff for PXA machines which can be overridden later if
+ * need be.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/pm.h>
+
+#include <asm/hardware.h>
+
+#include "generic.h"
+
+/*
+ * Various clock factors driven by the CCCR register.
+ */
+
+/* Crystal Frequency to Memory Frequency Multiplier (L) */
+static unsigned char L_clk_mult[32] = { 0, 27, 32, 36, 40, 45, 0, };
+
+/* Memory Frequency to Run Mode Frequency Multiplier (M) */
+static unsigned char M_clk_mult[4] = { 0, 1, 2, 4 };
+
+/* Run Mode Frequency to Turbo Mode Frequency Multiplier (N) */
+/* Note: we store the value N * 2 here. */
+static unsigned char N2_clk_mult[8] = { 0, 0, 2, 3, 4, 0, 6, 0 };
+
+/* Crystal clock */
+#define BASE_CLK	3686400
+
+/*
+ * Get the clock frequency as reflected by CCCR and the turbo flag.
+ * We assume these values have been applied via a fcs.
+ * If info is not 0 we also display the current settings.
+ */
+unsigned int get_clk_frequency_khz(int info)
+{
+	unsigned long cccr, turbo;
+	unsigned int l, L, m, M, n2, N;
+
+	cccr = CCCR;
+	asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (turbo) );
+
+	l  =  L_clk_mult[(cccr >> 0) & 0x1f];
+	m  =  M_clk_mult[(cccr >> 5) & 0x03];
+	n2 = N2_clk_mult[(cccr >> 7) & 0x07];
+
+	L = l * BASE_CLK;
+	M = m * L;
+	N = n2 * M / 2;
+
+	if(info)
+	{
+		L += 5000;
+		printk( KERN_INFO "Memory clock: %d.%02dMHz (*%d)\n",
+			L / 1000000, (L % 1000000) / 10000, l );
+		M += 5000;
+		printk( KERN_INFO "Run Mode clock: %d.%02dMHz (*%d)\n",
+			M / 1000000, (M % 1000000) / 10000, m );
+		N += 5000;
+		printk( KERN_INFO "Turbo Mode clock: %d.%02dMHz (*%d.%d, %sactive)\n",
+			N / 1000000, (N % 1000000) / 10000, n2 / 2, (n2 % 2) * 5,
+			(turbo & 1) ? "" : "in" );
+	}
+
+	return (turbo & 1) ? (N/1000) : (M/1000);
+}
+
+EXPORT_SYMBOL(get_clk_frequency_khz);
+
+/*
+ * Return the current memory clock frequency in units of 10kHz
+ */
+unsigned int get_memclk_frequency_10khz(void)
+{
+	return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000;
+}
+
+EXPORT_SYMBOL(get_memclk_frequency_10khz);
+
+/*
+ * Return the current LCD clock frequency in units of 10kHz
+ */
+unsigned int get_lcdclk_frequency_10khz(void)
+{
+	return get_memclk_frequency_10khz();
+}
+
+EXPORT_SYMBOL(get_lcdclk_frequency_10khz);
diff -Nru a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-pxa/pxa27x.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,118 @@
+/*
+ *  linux/arch/arm/mach-pxa/pxa27x.c
+ *
+ *  Author:	Nicolas Pitre
+ *  Created:	Nov 05, 2002
+ *  Copyright:	MontaVista Software Inc.
+ *
+ * Code specific to PXA27x aka Bulverde.
+ *
+ * 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/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/pm.h>
+
+#include <asm/hardware.h>
+
+#include "generic.h"
+
+/* Crystal clock: 13MHz */
+#define BASE_CLK	13000000
+
+/*
+ * Get the clock frequency as reflected by CCSR and the turbo flag.
+ * We assume these values have been applied via a fcs.
+ * If info is not 0 we also display the current settings.
+ */
+unsigned int get_clk_frequency_khz( int info)
+{
+	unsigned long ccsr, clkcfg;
+	unsigned int l, L, m, M, n2, N, S;
+       	int cccr_a, t, ht, b;
+
+	ccsr = CCSR;
+	cccr_a = CCCR & (1 << 25);
+
+	/* Read clkcfg register: it has turbo, b, half-turbo (and f) */
+	asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg) );
+	t  = clkcfg & (1 << 1);
+	ht = clkcfg & (1 << 2);
+	b  = clkcfg & (1 << 3);
+
+	l  = ccsr & 0x1f;
+	n2 = (ccsr>>7) & 0xf;
+	m  = (l <= 10) ? 1 : (l <= 20) ? 2 : 4;
+
+	L  = l * BASE_CLK;
+	N  = (L * n2) / 2;
+	M  = (!cccr_a) ? (L/m) : ((b) ? L : (L/2));
+	S  = (b) ? L : (L/2);
+
+	if (info) {
+		printk( KERN_INFO "Run Mode clock: %d.%02dMHz (*%d)\n",
+			L / 1000000, (L % 1000000) / 10000, l );
+		printk( KERN_INFO "Turbo Mode clock: %d.%02dMHz (*%d.%d, %sactive)\n",
+			N / 1000000, (N % 1000000)/10000, n2 / 2, (n2 % 2)*5,
+			(t) ? "" : "in" );
+		printk( KERN_INFO "Memory clock: %d.%02dMHz (/%d)\n",
+			M / 1000000, (M % 1000000) / 10000, m );
+		printk( KERN_INFO "System bus clock: %d.%02dMHz \n",
+			S / 1000000, (S % 1000000) / 10000 );
+	}
+
+	return (t) ? (N/1000) : (L/1000);
+}
+
+/*
+ * Return the current mem clock frequency in units of 10kHz as
+ * reflected by CCCR[A], B, and L
+ */
+unsigned int get_memclk_frequency_10khz(void)
+{
+	unsigned long ccsr, clkcfg;
+	unsigned int l, L, m, M;
+       	int cccr_a, b;
+
+	ccsr = CCSR;
+	cccr_a = CCCR & (1 << 25);
+
+	/* Read clkcfg register: it has turbo, b, half-turbo (and f) */
+	asm( "mrc\tp14, 0, %0, c6, c0, 0" : "=r" (clkcfg) );
+	b = clkcfg & (1 << 3);
+
+	l = ccsr & 0x1f;
+	m = (l <= 10) ? 1 : (l <= 20) ? 2 : 4;
+
+	L = l * BASE_CLK;
+	M = (!cccr_a) ? (L/m) : ((b) ? L : (L/2));
+
+	return (M / 10000);
+}
+
+/*
+ * Return the current LCD clock frequency in units of 10kHz as
+ */
+unsigned int get_lcdclk_frequency_10khz(void)
+{
+	unsigned long ccsr;
+	unsigned int l, L, k, K;
+
+	ccsr = CCSR;
+
+	l = ccsr & 0x1f;
+	k = (l <= 7) ? 1 : (l <= 16) ? 2 : 4;
+
+	L = l * BASE_CLK;
+	K = L / k;
+
+	return (K / 10000);
+}
+
+EXPORT_SYMBOL(get_clk_frequency_khz);
+EXPORT_SYMBOL(get_memclk_frequency_10khz);
+EXPORT_SYMBOL(get_lcdclk_frequency_10khz);
diff -Nru a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
--- a/arch/arm/mach-s3c2410/Kconfig	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/mach-s3c2410/Kconfig	Tue Jun 15 22:20:39 2004
@@ -1,8 +1,9 @@
+if ARCH_S3C2410
+
 menu "S3C2410 Implementations"
 
 config ARCH_BAST
 	bool "Simtec Electronics BAST (EB2410ITX)"
-	depends on ARCH_S3C2410
 	help
 	  Say Y here if you are using the Simtec Electronics EB2410ITX
 	  development board (also known as BAST)
@@ -11,15 +12,21 @@
 
 config ARCH_H1940
 	bool "IPAQ H1940"
-	depends on ARCH_S3C2410
 	help
 	  Say Y here if you are using the HP IPAQ H1940
 	  <http://www.handhelds.org/projects/h1940.html>.
 
+config ARCH_SMDK2410
+	bool "SMDK2410/A9M2410"
+	help
+	   Say Y here if you are using the SMDK2410 or the derived module A9M2410
+           <http://www.fsforth.de>
+
 config MACH_VR1000
 	bool "Simtec VR1000"
-	depends on ARCH_S3C2410
 	help
 	  Say Y here if you are using the Simtec VR1000 board.
 
 endmenu
+
+endif
diff -Nru a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
--- a/arch/arm/mach-s3c2410/Makefile	Tue Jun 15 22:20:37 2004
+++ b/arch/arm/mach-s3c2410/Makefile	Tue Jun 15 22:20:37 2004
@@ -12,6 +12,7 @@
 obj-$(CONFIG_ARCH_BAST)    += mach-bast.o
 obj-$(CONFIG_MACH_H1940)   += mach-h1940.o
 obj-$(CONFIG_ARCH_H1940)   += mach-h1940.o
+obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o
 obj-$(CONFIG_MACH_VR1000)  += mach-vr1000.o
 
 #obj-$(CONFIG_PCI)	+=$(pci-y)
diff -Nru a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/arm/mach-s3c2410/mach-smdk2410.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,109 @@
+/***********************************************************************
+ *
+ * linux/arch/arm/mach-s3c2410/mach-smdk2410.c
+ *
+ * Copyright (C) 2004 by FS Forth-Systeme GmbH
+ * All rights reserved.
+ *
+ * $Id: mach-smdk2410.c,v 1.1 2004/05/11 14:15:38 mpietrek Exp $
+ * @Author: Jonas Dietsche
+ *
+ * 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
+ *
+ * @History:
+ * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
+ * Ben Dooks <ben@simtec.co.uk>
+ ***********************************************************************/
+
+#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/io.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <asm/arch/regs-serial.h>
+
+#include "s3c2410.h"
+
+
+static struct map_desc smdk2410_iodesc[] __initdata = {
+  /* nothing here yet */
+};
+
+#define UCON S3C2410_UCON_DEFAULT
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+/* base baud rate for all our UARTs */
+static unsigned long smdk2410_serial_clock = 24*1000*1000;
+
+static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
+	[0] = {
+		.hwport	     = 0,
+		.flags	     = 0,
+		.clock	     = &smdk2410_serial_clock,
+		.ucon	     = UCON,
+		.ulcon	     = ULCON,
+		.ufcon	     = UFCON,
+	},
+	[1] = {
+		.hwport	     = 1,
+		.flags	     = 0,
+		.clock	     = &smdk2410_serial_clock,
+		.ucon	     = UCON,
+		.ulcon	     = ULCON,
+		.ufcon	     = UFCON,
+	},
+	[2] = {
+		.hwport	     = 2,
+		.flags	     = 0,
+		.clock	     = &smdk2410_serial_clock,
+		.ucon	     = UCON,
+		.ulcon	     = ULCON,
+		.ufcon	     = UFCON,
+	}
+};
+
+
+void __init smdk2410_map_io(void)
+{
+	s3c2410_map_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
+	s3c2410_uartcfgs = smdk2410_uartcfgs;
+}
+
+void __init smdk2410_init_irq(void)
+{
+	s3c2410_init_irq();
+}
+
+MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
+				    * to SMDK2410 */
+     MAINTAINER("Jonas Dietsche")
+     BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, S3C2410_VA_UART)
+     BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
+     MAPIO(smdk2410_map_io)
+     INITIRQ(smdk2410_init_irq)
+MACHINE_END
diff -Nru a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
--- a/arch/arm/mach-s3c2410/s3c2410.c	Tue Jun 15 22:20:41 2004
+++ b/arch/arm/mach-s3c2410/s3c2410.c	Tue Jun 15 22:20:41 2004
@@ -31,7 +31,6 @@
 #include <asm/hardware.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-#include <asm/mach-types.h>
 
 #include <asm/arch/regs-clock.h>
 #include <asm/arch/regs-serial.h>
diff -Nru a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
--- a/arch/arm/mach-sa1100/Kconfig	Tue Jun 15 22:21:05 2004
+++ b/arch/arm/mach-sa1100/Kconfig	Tue Jun 15 22:21:05 2004
@@ -1,9 +1,9 @@
+if ARCH_SA1100
 
 menu "SA11x0 Implementations"
 
 config SA1100_ASSABET
 	bool "Assabet"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using the Intel(R) StrongARM(R) SA-1110
 	  Microprocessor Development Board (also known as the Assabet).
@@ -18,7 +18,6 @@
 
 config SA1100_ADSBITSY
 	bool "ADS Bitsy"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using Applied Data Systems Intel(R)
 	  StrongARM(R) 1110 based Bitsy, 3 x 5 inches in size, Compaq - IPAQ -
@@ -28,14 +27,12 @@
 
 config SA1100_BRUTUS
 	bool "Brutus"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using the Intel(R) StrongARM(R) SA-1100
 	  Microprocessor Development Board (also known as the Brutus).
 
 config SA1100_CERF
 	bool "CerfBoard"
-	depends on ARCH_SA1100
 	help
 	  The Intrinsyc CerfBoard is based on the StrongARM 1110 (Discontinued).
 	  More information is available at:
@@ -62,7 +59,6 @@
 
 config SA1100_H3100
 	bool "Compaq iPAQ H3100"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you intend to run this kernel on the Compaq iPAQ
 	  H3100 handheld computer.  Information about this machine and the
@@ -73,7 +69,6 @@
 
 config SA1100_H3600
 	bool "Compaq iPAQ H3600/H3700"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you intend to run this kernel on the Compaq iPAQ
 	  H3600 handheld computer.  Information about this machine and the
@@ -84,7 +79,6 @@
 
 config SA1100_H3800
 	bool "Compaq iPAQ H3800"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you intend to run this kernel on the Compaq iPAQ H3800
 	  series handheld computer.  Information about this machine and the
@@ -102,7 +96,6 @@
 #dep_bool '  Empeg' CONFIG_SA1100_EMPEG $CONFIG_ARCH_SA1100
 config SA1100_EXTENEX1
 	bool "Extenex HandHeld Theater (Squashtail)"
-	depends on ARCH_SA1100
 
 config SA1100_EXTENEX1_16MB
 	bool "Support 16 MB of DRAM (not just 8)"
@@ -110,7 +103,6 @@
 
 config SA1100_FLEXANET
 	bool "FlexaNet"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you intend to run this kernel on the FlexaNet
 	  handheld instruments. Information about this machine can be
@@ -118,14 +110,12 @@
 
 config SA1100_FREEBIRD
 	bool "FreeBird-v1.1"
-	depends on ARCH_SA1100
 	help
 	  Support the FreeBird board used in Coventive embedded products.  See
 	  Documentation/arm/SA1100/Freebird for more.
 
 config SA1100_GRAPHICSCLIENT
 	bool "GraphicsClient Plus"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using an Applied Data Systems Intel(R)
 	  StrongARM(R) SA-1100 based Graphics Client SBC.  See
@@ -133,7 +123,6 @@
 
 config SA1100_GRAPHICSMASTER
 	bool "GraphicsMaster"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using an Applied Data Systems Intel(R)
 	  StrongARM(R) SA-1100 based Graphics Master SBC with SA-1111
@@ -143,14 +132,12 @@
 
 config SA1100_BADGE4
 	bool "HP Labs BadgePAD 4"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you want to build a kernel for the HP Laboratories
 	  BadgePAD 4.
 
 config SA1100_JORNADA720
 	bool "HP Jornada 720"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you want to build a kernel for the HP Jornada 720
 	  handheld computer.  See <http://www.hp.com/jornada/products/720>
@@ -158,14 +145,12 @@
 
 config SA1100_HACKKIT
 	bool "HackKit Core CPU Board"
-	depends on ARCH_SA1100
 	help
 	  Say Y here to support the HackKit Core CPU Board
 	  <http://hackkit.eletztrick.de>;
 
 config SA1100_HUW_WEBPANEL
 	bool "HuW WebPanel"
-	depends on ARCH_SA1100
 	help
 	  Say Y here to support the HuW Webpanel produced by Hoeft & Wessel
 	  AG.  English-language website is at
@@ -174,7 +159,6 @@
 
 config SA1100_ITSY
 	bool "Itsy"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using the Compaq Itsy experimental pocket
 	  computer. See <http://research.compaq.com/wrl/projects/itsy/> for
@@ -182,7 +166,6 @@
 
 config SA1100_LART
 	bool "LART"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using the Linux Advanced Radio Terminal
 	  (also known as the LART).  See <http://www.lart.tudelft.nl/> for
@@ -190,7 +173,6 @@
 
 config SA1100_NANOENGINE
 	bool "nanoEngine"
-	depends on ARCH_SA1100
 	help
 	  The nanoEngine is a StrongARM 1110-based single board computer
 	  from Bright Star Engineering. More information is available at:
@@ -201,14 +183,12 @@
 
 config SA1100_OMNIMETER
 	bool "OmniMeter"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using the inhand electronics OmniMeter.  See
 	  <http://www.inhandelectronics.com/omnimeter.asp> for details.
 
 config SA1100_PANGOLIN
 	bool "Pangolin"
-	depends on ARCH_SA1100
 	help
 	  Pangolin is a StrongARM 1110-based evaluation platform produced
 	  by Dialogue Technology.  It has EISA slots for ease of configuration
@@ -220,7 +200,6 @@
 
 config SA1100_PLEB
 	bool "PLEB"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using a Portable Linux Embedded Board
 	  (also known as PLEB). See <http://www.cse.unsw.edu.au/~pleb/>
@@ -228,7 +207,6 @@
 
 config SA1100_PT_SYSTEM3
 	bool "PT System 3"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you intend to build a kernel suitable to run on
 	  a Pruftechnik Digital Board. For more information see
@@ -236,7 +214,6 @@
 
 config SA1100_SHANNON
 	bool "Shannon"
-	depends on ARCH_SA1100
 	help
 	  The Shannon (also known as a Tuxscreen, and also as a IS2630) was a
 	  limited edition webphone produced by Philips. The Shannon is a SA1100
@@ -245,7 +222,6 @@
 
 config SA1100_SHERMAN
 	bool "Sherman"
-	depends on ARCH_SA1100
 	help
 	  Say Y here to support the Blazie Engineering `Sherman' StrongARM
 	  1110-based SBC, used primarily in assistance products for the
@@ -255,7 +231,6 @@
 
 config SA1100_SIMPAD
 	bool "Simpad"
-	depends on ARCH_SA1100
 	help
 	  The SIEMENS webpad SIMpad is based on the StrongARM 1110. There
 	  are two different versions CL4 and SL4. CL4 has 32MB RAM and 16MB
@@ -266,7 +241,6 @@
 
 config SA1100_PFS168
 	bool "Tulsa"
-	depends on ARCH_SA1100
 	help
 	  The Radisys Corp. PFS-168 (aka Tulsa) is an Intel® StrongArm® SA-1110 based
 	  computer which includes the SA-1111 Microprocessor Companion Chip and other
@@ -276,7 +250,6 @@
 
 config SA1100_VICTOR
 	bool "Victor"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you are using a Visu Aide Intel(R) StrongARM(R)
 	  SA-1100 based Victor Digital Talking Book Reader.  See
@@ -285,14 +258,12 @@
 
 config SA1100_XP860
 	bool "XP860"
-	depends on ARCH_SA1100
 	help
 	  :: Config help missing ::
 	  :: 06 August 2002 ::
 
 config SA1100_YOPY
 	bool "Yopy"
-	depends on ARCH_SA1100
 	help
 	  Say Y here to support the Yopy PDA.  Product information at
 	  <http://www.yopy.com/>.  See Documentation/arm/SA1100/Yopy
@@ -300,14 +271,12 @@
 
 config SA1100_STORK
 	bool "Stork"
-	depends on ARCH_SA1100
 	help
 	  Say Y here if you intend to run this kernel on the Stork
 	  handheld computer.
 
 #config SA1100_TRIZEPS
 #	bool "Trizeps"
-#	depends on ARCH_SA1100
 #	help
 #	  :: write me ::
 
@@ -319,7 +288,6 @@
 
 config SA1100_SSP
 	tristate "Generic PIO SSP"
-	depends on ARCH_SA1100
 	help
 	  Say Y here to enable support for the generic PIO SSP driver.
 	  This isn't for audio support, but for attached sensors and
@@ -328,7 +296,6 @@
 
 config SA1100_USB
 	tristate "SA1100 USB function support"
-	depends on ARCH_SA1100
 
 config SA1100_USB_NETLINK
 	tristate "Support for SA11x0 USB network link function"
@@ -349,3 +316,4 @@
 
 endmenu
 
+endif
diff -Nru a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
--- a/arch/arm/mach-sa1100/cpu-sa1100.c	Tue Jun 15 22:20:36 2004
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c	Tue Jun 15 22:20:36 2004
@@ -180,7 +180,7 @@
 			 unsigned int target_freq,
 			 unsigned int relation)
 {
-	unsigned int cur = sa11x0_getspeed();
+	unsigned int cur = sa11x0_getspeed(0);
 	unsigned int new_ppcr;
 
 	struct cpufreq_freqs freqs;
@@ -221,7 +221,7 @@
 {
 	if (policy->cpu != 0)
 		return -EINVAL;
-	policy->cur = policy->min = policy->max = sa11x0_getspeed();
+	policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
 	policy->cpuinfo.min_freq = 59000;
 	policy->cpuinfo.max_freq = 287000;
@@ -230,15 +230,18 @@
 }
 
 static struct cpufreq_driver sa1100_driver = {
+	.flags		= CPUFREQ_STICKY |
+			  CPUFREQ_PANIC_OUTOFSYNC | 
+			  CPUFREQ_PANIC_RESUME_OUTOFSYNC,
 	.verify		= sa11x0_verify_speed,
 	.target		= sa1100_target,
+	.get		= sa11x0_getspeed,
 	.init		= sa1100_cpu_init,
 	.name		= "sa1100",
 };
 
 static int __init sa1100_dram_init(void)
 {
-	cpufreq_gov_userspace_init();
  	if ((processor_id & CPU_SA1100_MASK) == CPU_SA1100_ID)
 		return cpufreq_register_driver(&sa1100_driver);
 	else
diff -Nru a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c
--- a/arch/arm/mach-sa1100/cpu-sa1110.c	Tue Jun 15 22:20:36 2004
+++ b/arch/arm/mach-sa1100/cpu-sa1110.c	Tue Jun 15 22:20:36 2004
@@ -238,7 +238,7 @@
 		return -EINVAL;
 	}
 
-	freqs.old = sa11x0_getspeed();
+	freqs.old = sa11x0_getspeed(0);
 	freqs.new = sa11x0_ppcr_to_freq(ppcr);
 	freqs.cpu = 0;
 
@@ -320,7 +320,7 @@
 {
 	if (policy->cpu != 0)
 		return -EINVAL;
-	policy->cur = policy->min = policy->max = sa11x0_getspeed();
+	policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
 	policy->cpuinfo.min_freq = 59000;
 	policy->cpuinfo.max_freq = 287000;
@@ -329,8 +329,12 @@
 }
 
 static struct cpufreq_driver sa1110_driver = {
+	.flags		= CPUFREQ_STICKY |
+			  CPUFREQ_PANIC_OUTOFSYNC | 
+			  CPUFREQ_PANIC_RESUME_OUTOFSYNC,
 	.verify		= sa11x0_verify_speed,
 	.target		= sa1110_target,
+	.get		= sa11x0_getspeed,
 	.init		= sa1110_cpu_init,
 	.name		= "sa1110",
 };
@@ -354,8 +358,6 @@
 			sdram->tck, sdram->trcd, sdram->trp,
 			sdram->twr, sdram->refresh, sdram->cas_latency);
 
-		cpufreq_gov_userspace_init();
- 
 		memcpy(&sdram_params, sdram, sizeof(sdram_params));
 
 		return cpufreq_register_driver(&sa1110_driver);
diff -Nru a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
--- a/arch/arm/mach-sa1100/generic.c	Tue Jun 15 22:20:38 2004
+++ b/arch/arm/mach-sa1100/generic.c	Tue Jun 15 22:20:38 2004
@@ -96,11 +96,13 @@
 	return 0;
 }
 
-unsigned int sa11x0_getspeed(void)
+unsigned int sa11x0_getspeed(unsigned int cpu)
 {
+	if (cpu)
+		return 0;
 	return cclk_frequency_100khz[PPCR & 0xf] * 100;
 }
-EXPORT_SYMBOL(sa11x0_getspeed);
+
 #else
 /*
  * We still need to provide this so building without cpufreq works.
diff -Nru a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
--- a/arch/arm/mach-sa1100/generic.h	Tue Jun 15 22:20:42 2004
+++ b/arch/arm/mach-sa1100/generic.h	Tue Jun 15 22:20:42 2004
@@ -22,5 +22,5 @@
 
 extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
 extern int sa11x0_verify_speed(struct cpufreq_policy *policy);
-extern unsigned int sa11x0_getspeed(void);
+extern unsigned int sa11x0_getspeed(unsigned int cpu);
 extern unsigned int sa11x0_ppcr_to_freq(unsigned int idx);
diff -Nru a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
--- a/arch/arm/mach-versatile/core.c	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/mach-versatile/core.c	Tue Jun 15 22:20:40 2004
@@ -336,6 +336,7 @@
 		.end	= (VERSATILE_##base##_BASE) + SZ_4K - 1,\
 		.flags	= IORESOURCE_MEM,			\
 	},							\
+	.dma_mask	= ~0,					\
 	.irq		= base##_IRQ,				\
 	/* .dma		= base##_DMA,*/				\
 }
diff -Nru a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
--- a/arch/arm/mm/Kconfig	Tue Jun 15 22:20:39 2004
+++ b/arch/arm/mm/Kconfig	Tue Jun 15 22:20:39 2004
@@ -220,7 +220,7 @@
 # XScale
 config CPU_XSCALE
 	bool
-	depends on ARCH_IOP3XX || ARCH_ADIFCC || ARCH_PXA
+	depends on ARCH_IOP3XX || ARCH_ADIFCC || ARCH_PXA || ARCH_IXP4XX
 	default y
 	select CPU_32v5
 	select CPU_ABRT_EV5T
diff -Nru a/arch/arm/mm/blockops.c b/arch/arm/mm/blockops.c
--- a/arch/arm/mm/blockops.c	Tue Jun 15 22:21:02 2004
+++ b/arch/arm/mm/blockops.c	Tue Jun 15 22:21:02 2004
@@ -133,7 +133,7 @@
 	unsigned int cache_type;
 	int i;
 
-	asm("mcr p15, 0, %0, c0, c0, 1" : "=r" (cache_type));
+	asm("mrc p15, 0, %0, c0, c0, 1" : "=r" (cache_type));
 
 	printk("Checking V6 block cache operations:\n");
 	register_undef_hook(&blockops_hook);
diff -Nru a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
--- a/arch/arm/mm/cache-v6.S	Tue Jun 15 22:20:36 2004
+++ b/arch/arm/mm/cache-v6.S	Tue Jun 15 22:20:36 2004
@@ -151,6 +151,7 @@
 	add	r0, r0, #D_CACHE_LINE_SIZE
 	cmp	r0, r1
 	blo	1b
+	mov	r0, #0
 	mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer
 	mov	pc, lr
 
@@ -188,6 +189,7 @@
 	mcr	p15, 0, r0, c7, c15, 1		@ clean & invalidate line
 #endif
 	add	r0, r0, #D_CACHE_LINE_SIZE
+	cmp	r0, r1
 	blo	1b
 	mov	r0, #0
 	mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer
diff -Nru a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
--- a/arch/arm/mm/fault-armv.c	Tue Jun 15 22:20:38 2004
+++ b/arch/arm/mm/fault-armv.c	Tue Jun 15 22:20:38 2004
@@ -8,12 +8,14 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/bitops.h>
 #include <linux/vmalloc.h>
 #include <linux/init.h>
+#include <linux/pagemap.h>
 
 #include <asm/cacheflush.h>
 #include <asm/pgtable.h>
@@ -74,11 +76,14 @@
 	return 0;
 }
 
-void __flush_dcache_page(struct page *page)
+static void __flush_dcache_page(struct page *page)
 {
 	struct address_space *mapping = page_mapping(page);
 	struct mm_struct *mm = current->active_mm;
-	struct list_head *l;
+	struct vm_area_struct *mpnt = NULL;
+	struct prio_tree_iter iter;
+	unsigned long offset;
+	pgoff_t pgoff;
 
 	__cpuc_flush_dcache_page(page_address(page));
 
@@ -89,36 +94,44 @@
 	 * With a VIVT cache, we need to also write back
 	 * and invalidate any user data.
 	 */
-	list_for_each(l, &mapping->i_mmap_shared) {
-		struct vm_area_struct *mpnt;
-		unsigned long off;
-
-		mpnt = list_entry(l, struct vm_area_struct, shared);
+	pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
 
+	flush_dcache_mmap_lock(mapping);
+	while ((mpnt = vma_prio_tree_next(mpnt, &mapping->i_mmap,
+					&iter, pgoff, pgoff)) != NULL) {
 		/*
 		 * If this VMA is not in our MM, we can ignore it.
 		 */
 		if (mpnt->vm_mm != mm)
 			continue;
-
-		if (page->index < mpnt->vm_pgoff)
+		if (!(mpnt->vm_flags & VM_MAYSHARE))
 			continue;
+		offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
+		flush_cache_page(mpnt, mpnt->vm_start + offset);
+	}
+	flush_dcache_mmap_unlock(mapping);
+}
 
-		off = page->index - mpnt->vm_pgoff;
-		if (off >= (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT)
-			continue;
+void flush_dcache_page(struct page *page)
+{
+	struct address_space *mapping = page_mapping(page);
 
-		flush_cache_page(mpnt, mpnt->vm_start + (off << PAGE_SHIFT));
-	}
+	if (mapping && !mapping_mapped(mapping))
+		set_bit(PG_dcache_dirty, &page->flags);
+	else
+		__flush_dcache_page(page);
 }
+EXPORT_SYMBOL(flush_dcache_page);
 
 static void
 make_coherent(struct vm_area_struct *vma, unsigned long addr, struct page *page, int dirty)
 {
 	struct address_space *mapping = page_mapping(page);
-	struct list_head *l;
 	struct mm_struct *mm = vma->vm_mm;
-	unsigned long pgoff;
+	struct vm_area_struct *mpnt = NULL;
+	struct prio_tree_iter iter;
+	unsigned long offset;
+	pgoff_t pgoff;
 	int aliases = 0;
 
 	if (!mapping)
@@ -131,12 +144,9 @@
 	 * space, then we need to handle them specially to maintain
 	 * cache coherency.
 	 */
-	list_for_each(l, &mapping->i_mmap_shared) {
-		struct vm_area_struct *mpnt;
-		unsigned long off;
-
-		mpnt = list_entry(l, struct vm_area_struct, shared);
-
+	flush_dcache_mmap_lock(mapping);
+	while ((mpnt = vma_prio_tree_next(mpnt, &mapping->i_mmap,
+					&iter, pgoff, pgoff)) != NULL) {
 		/*
 		 * If this VMA is not in our MM, we can ignore it.
 		 * Note that we intentionally mask out the VMA
@@ -144,24 +154,12 @@
 		 */
 		if (mpnt->vm_mm != mm || mpnt == vma)
 			continue;
-
-		/*
-		 * If the page isn't in this VMA, we can also ignore it.
-		 */
-		if (pgoff < mpnt->vm_pgoff)
-			continue;
-
-		off = pgoff - mpnt->vm_pgoff;
-		if (off >= (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT)
+		if (!(mpnt->vm_flags & VM_MAYSHARE))
 			continue;
-
-		off = mpnt->vm_start + (off << PAGE_SHIFT);
-
-		/*
-		 * Ok, it is within mpnt.  Fix it up.
-		 */
-		aliases += adjust_pte(mpnt, off);
+		offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
+		aliases += adjust_pte(mpnt, mpnt->vm_start + offset);
 	}
+	flush_dcache_mmap_unlock(mapping);
 	if (aliases)
 		adjust_pte(vma, addr);
 	else
diff -Nru a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
--- a/arch/arm/mm/fault.c	Tue Jun 15 22:20:41 2004
+++ b/arch/arm/mm/fault.c	Tue Jun 15 22:20:41 2004
@@ -348,7 +348,7 @@
 	if (pmd_none(*pmd_k))
 		goto bad_area;
 
-	set_pmd(pmd, *pmd_k);
+	copy_pmd(pmd, pmd_k);
 	return 0;
 
 bad_area:
diff -Nru a/arch/arm/mm/init.c b/arch/arm/mm/init.c
--- a/arch/arm/mm/init.c	Tue Jun 15 22:20:36 2004
+++ b/arch/arm/mm/init.c	Tue Jun 15 22:20:36 2004
@@ -77,7 +77,7 @@
 			else if (!page_count(page))
 				free++;
 			else
-				shared += atomic_read(&page->count) - 1;
+				shared += page_count(page) - 1;
 			page++;
 		} while (page < end);
 	}
@@ -225,6 +225,8 @@
 		bootmem_pages += np[i].bootmap_pages;
 	}
 
+	high_memory = __va(memend_pfn << PAGE_SHIFT);
+
 	/*
 	 * This doesn't seem to be used by the Linux memory
 	 * manager any more.  If we can get rid of it, we
@@ -232,7 +234,6 @@
 	 */
 	max_low_pfn = memend_pfn - O_PFN_DOWN(PHYS_OFFSET);
 	max_pfn = memend_pfn - O_PFN_DOWN(PHYS_OFFSET);
-	mi->end = memend_pfn << PAGE_SHIFT;
 
 	return bootmem_pages;
 }
@@ -280,6 +281,7 @@
 static __init void reserve_node_zero(unsigned int bootmap_pfn, unsigned int bootmap_pages)
 {
 	pg_data_t *pgdat = NODE_DATA(0);
+	unsigned long res_size = 0;
 
 	/*
 	 * Register the kernel text and data with bootmem.
@@ -303,31 +305,32 @@
 			     bootmap_pages << PAGE_SHIFT);
 
 	/*
-	 * Hmm... This should go elsewhere, but we really really
-	 * need to stop things allocating the low memory; we need
-	 * a better implementation of GFP_DMA which does not assume
-	 * that DMA-able memory starts at zero.
+	 * Hmm... This should go elsewhere, but we really really need to
+	 * stop things allocating the low memory; ideally we need a better
+	 * implementation of GFP_DMA which does not assume that DMA-able
+	 * memory starts at zero.
 	 */
-	if (machine_is_integrator())
-		reserve_bootmem_node(pgdat, 0, __pa(swapper_pg_dir));
+	if (machine_is_integrator() || machine_is_cintegrator())
+		res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
+
 	/*
-	 * These should likewise go elsewhere.  They pre-reserve
-	 * the screen memory region at the start of main system
-	 * memory.
+	 * These should likewise go elsewhere.  They pre-reserve the
+	 * screen memory region at the start of main system memory.
 	 */
-	if (machine_is_archimedes() || machine_is_a5k())
-		reserve_bootmem_node(pgdat, 0x02000000, 0x00080000);
 	if (machine_is_edb7211())
-		reserve_bootmem_node(pgdat, 0xc0000000, 0x00020000);
+		res_size = 0x00020000;
 	if (machine_is_p720t())
-		reserve_bootmem_node(pgdat, PHYS_OFFSET, 0x00014000);
+		res_size = 0x00014000;
+
 #ifdef CONFIG_SA1111
 	/*
-	 * Because of the SA1111 DMA bug, we want to preserve
-	 * our precious DMA-able memory...
+	 * Because of the SA1111 DMA bug, we want to preserve our
+	 * precious DMA-able memory...
 	 */
-	reserve_bootmem_node(pgdat, PHYS_OFFSET, __pa(swapper_pg_dir)-PHYS_OFFSET);
+	res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
 #endif
+	if (res_size)
+		reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size);
 }
 
 /*
@@ -546,7 +549,6 @@
 	datapages = &_end - &_etext;
 	initpages = &__init_end - &__init_begin;
 
-	high_memory = (void *)__va(meminfo.end);
 #ifndef CONFIG_DISCONTIGMEM
 	max_mapnr   = virt_to_page(high_memory) - mem_map;
 #endif
@@ -601,7 +603,7 @@
 
 void free_initmem(void)
 {
-	if (!machine_is_integrator()) {
+	if (!machine_is_integrator() && !machine_is_cintegrator()) {
 		free_area((unsigned long)(&__init_begin),
 			  (unsigned long)(&__init_end),
 			  "init");
diff -Nru a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
--- a/arch/arm/mm/ioremap.c	Tue Jun 15 22:20:42 2004
+++ b/arch/arm/mm/ioremap.c	Tue Jun 15 22:20:42 2004
@@ -20,6 +20,7 @@
  * We use MMU protection domains to trap any attempt to access the bank
  * that is not currently mapped.  (This isn't fully implemented yet.)
  */
+#include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
@@ -162,8 +163,10 @@
 	}
 	return (void *) (offset + (char *)addr);
 }
+EXPORT_SYMBOL(__ioremap);
 
 void __iounmap(void *addr)
 {
 	vfree((void *) (PAGE_MASK & (unsigned long) addr));
 }
+EXPORT_SYMBOL(__iounmap);
diff -Nru a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
--- a/arch/arm/mm/mm-armv.c	Tue Jun 15 22:20:42 2004
+++ b/arch/arm/mm/mm-armv.c	Tue Jun 15 22:20:42 2004
@@ -18,7 +18,6 @@
 
 #include <asm/pgalloc.h>
 #include <asm/page.h>
-#include <asm/rmap.h>
 #include <asm/io.h>
 #include <asm/setup.h>
 #include <asm/tlbflush.h>
@@ -231,7 +230,7 @@
 
 	pte = pmd_page(*pmd);
 	pmd_clear(pmd);
-	pgtable_remove_rmap(pte);
+	dec_page_state(nr_page_table_pages);
 	pte_free(pte);
 	pmd_free(pmd);
 free:
@@ -305,27 +304,27 @@
 	[MT_DEVICE] = {
 		.prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
 				L_PTE_WRITE,
-		.prot_l1   = PMD_TYPE_TABLE | PMD_BIT4,
-		.prot_sect = PMD_TYPE_SECT | PMD_BIT4 | PMD_SECT_UNCACHED |
+		.prot_l1   = PMD_TYPE_TABLE,
+		.prot_sect = PMD_TYPE_SECT | PMD_SECT_UNCACHED |
 				PMD_SECT_AP_WRITE,
 		.domain    = DOMAIN_IO,
 	},
 	[MT_CACHECLEAN] = {
-		.prot_sect = PMD_TYPE_SECT | PMD_BIT4,
+		.prot_sect = PMD_TYPE_SECT,
 		.domain    = DOMAIN_KERNEL,
 	},
 	[MT_MINICLEAN] = {
-		.prot_sect = PMD_TYPE_SECT | PMD_BIT4 | PMD_SECT_MINICACHE,
+		.prot_sect = PMD_TYPE_SECT | PMD_SECT_MINICACHE,
 		.domain    = DOMAIN_KERNEL,
 	},
 	[MT_VECTORS] = {
 		.prot_pte  = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
 				L_PTE_EXEC,
-		.prot_l1   = PMD_TYPE_TABLE | PMD_BIT4,
+		.prot_l1   = PMD_TYPE_TABLE,
 		.domain    = DOMAIN_USER,
 	},
 	[MT_MEMORY] = {
-		.prot_sect = PMD_TYPE_SECT | PMD_BIT4 | PMD_SECT_AP_WRITE,
+		.prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
 		.domain    = DOMAIN_KERNEL,
 	}
 };
@@ -353,6 +352,15 @@
 		ecc_mask = 0;
 	}
 
+	if (cpu_arch <= CPU_ARCH_ARMv5) {
+		mem_types[MT_DEVICE].prot_l1       |= PMD_BIT4;
+		mem_types[MT_DEVICE].prot_sect     |= PMD_BIT4;
+		mem_types[MT_CACHECLEAN].prot_sect |= PMD_BIT4;
+		mem_types[MT_MINICLEAN].prot_sect  |= PMD_BIT4;
+		mem_types[MT_VECTORS].prot_l1      |= PMD_BIT4;
+		mem_types[MT_MEMORY].prot_sect     |= PMD_BIT4;
+	}
+
 	/*
 	 * ARMv6 and above have extended page tables.
 	 */
@@ -482,6 +490,7 @@
 	pgd_t *pgd;
 	pmd_t *pmd;
 	int i;
+	int cpu_arch = cpu_architecture();
 
 	if (current->mm && current->mm->pgd)
 		pgd = current->mm->pgd;
@@ -491,7 +500,9 @@
 	for (i = 0; i < FIRST_USER_PGD_NR + USER_PTRS_PER_PGD; i++) {
 		pmdval = (i << PGDIR_SHIFT) |
 			 PMD_SECT_AP_WRITE | PMD_SECT_AP_READ |
-			 PMD_BIT4 | PMD_TYPE_SECT;
+			 PMD_TYPE_SECT;
+		if (cpu_arch <= CPU_ARCH_ARMv5)
+			pmdval |= PMD_BIT4;
 		pmd = pmd_offset(pgd + i, i << PGDIR_SHIFT);
 		set_pmd(pmd, __pmd(pmdval));
 	}
diff -Nru a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
--- a/arch/arm/mm/mmap.c	Tue Jun 15 22:20:41 2004
+++ b/arch/arm/mm/mmap.c	Tue Jun 15 22:20:41 2004
@@ -40,7 +40,7 @@
 	 */
 	cache_type = read_cpuid(CPUID_CACHETYPE);
 	if (cache_type != read_cpuid(CPUID_ID)) {
-		aliasing = (cache_type | cache_type >> 12) & (1 << 9);
+		aliasing = (cache_type | cache_type >> 12) & (1 << 11);
 		if (aliasing)
 			do_align = filp || flags & MAP_SHARED;
 	}
diff -Nru a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c
--- a/arch/arm/mm/proc-syms.c	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/mm/proc-syms.c	Tue Jun 15 22:20:40 2004
@@ -14,8 +14,6 @@
 #include <asm/proc-fns.h>
 #include <asm/tlbflush.h>
 
-EXPORT_SYMBOL(__flush_dcache_page);
-
 #ifndef MULTI_CPU
 EXPORT_SYMBOL(cpu_dcache_clean_area);
 EXPORT_SYMBOL(cpu_set_pte);
@@ -28,7 +26,6 @@
 EXPORT_SYMBOL_NOVERS(__cpuc_flush_user_all);
 EXPORT_SYMBOL_NOVERS(__cpuc_flush_user_range);
 EXPORT_SYMBOL_NOVERS(__cpuc_coherent_kern_range);
-EXPORT_SYMBOL_NOVERS(__cpuc_flush_dcache_page);
 #else
 EXPORT_SYMBOL(cpu_cache);
 #endif
diff -Nru a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
--- a/arch/arm/mm/proc-xscale.S	Tue Jun 15 22:20:44 2004
+++ b/arch/arm/mm/proc-xscale.S	Tue Jun 15 22:20:44 2004
@@ -298,7 +298,7 @@
 	add	r0, r0, #CACHELINESIZE
 	cmp	r0, r1
 	blo	1b
-	mcr	p15, 0, r0, c7, c10, 1		@ Drain Write (& Fill) Buffer
+	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
 	mov	pc, lr
 
 /*
@@ -315,7 +315,7 @@
 	add	r0, r0, #CACHELINESIZE
 	cmp	r0, r1
 	blo	1b
-	mcr	p15, 0, r0, c7, c10, 1		@ Drain Write (& Fill) Buffer
+	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
 	mov	pc, lr
 
 /*
@@ -333,7 +333,7 @@
 	add	r0, r0, #CACHELINESIZE
 	cmp	r0, r1
 	blo	1b
-	mcr	p15, 0, r0, c7, c10, 1		@ Drain Write (& Fill) Buffer
+	mcr	p15, 0, r0, c7, c10, 4		@ Drain Write (& Fill) Buffer
 	mov	pc, lr
 
 ENTRY(xscale_cache_fns)
@@ -647,6 +647,11 @@
 	.asciz	"XScale-PXA210"
 	.size	cpu_pxa210_name, . - cpu_pxa210_name
 
+	.type	cpu_ixp42x_name, #object
+cpu_ixp42x_name:
+	.asciz	"XScale-IXP42x Family"
+	.size	cpu_ixp42x_name, . - cpu_ixp42x_name
+
 	.type	cpu_pxa255_name, #object
 cpu_pxa255_name:
 	.asciz	"XScale-PXA255"
@@ -724,6 +729,22 @@
 	.long	xscale_mc_user_fns
 	.long	xscale_cache_fns
 	.size	__pxa210_proc_info, . - __pxa210_proc_info
+
+	.type	__ixp42x_proc_info, #object
+__ixp42x_proc_info:
+	.long   0x690541c0
+	.long   0xffffffc0
+	.long   0x00000c0e
+	b       __xscale_setup
+	.long   cpu_arch_name
+	.long   cpu_elf_name
+	.long   HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
+	.long   cpu_ixp42x_name
+	.long   xscale_processor_functions
+	.long	v4wbi_tlb_fns
+	.long	xscale_mc_user_fns
+	.long	xscale_cache_fns
+	.size   __ixp42x_proc_info, . - __ixp42x_proc_info                
 
 	.type	__pxa255_proc_info,#object
 __pxa255_proc_info:
diff -Nru a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
--- a/arch/arm/tools/mach-types	Tue Jun 15 22:20:40 2004
+++ b/arch/arm/tools/mach-types	Tue Jun 15 22:20:40 2004
@@ -6,7 +6,7 @@
 # To add an entry into this database, please see Documentation/arm/README,
 # or contact rmk@arm.linux.org.uk
 #
-# Last update: Thu Apr 29 19:06:33 2004
+# Last update: Fri May 28 13:17:46 2004
 #
 # machine_is_xxx	CONFIG_xxxx		MACH_TYPE_xxx		number
 #
@@ -509,7 +509,7 @@
 smdk5500		MACH_SMDK5500		SMDK5500		499
 signalsync		MACH_SIGNALSYNC		SIGNALSYNC		500
 nbc			MACH_NBC		NBC			501
-er4525			MACH_ER4525		ER4525			502
+kodiak			MACH_KODIAK		KODIAK			502
 netbookpro		MACH_NETBOOKPRO		NETBOOKPRO		503
 hw90200			MACH_HW90200		HW90200			504
 condor			MACH_CONDOR		CONDOR			505
@@ -533,3 +533,16 @@
 tidsc25			MACH_TIDSC25		TIDSC25			523
 akcpmxl			MACH_AKCPMXL		AKCPMXL			524
 av3xx			MACH_AV3XX		AV3XX			525
+avila			MACH_AVILA		AVILA			526
+pxa_mpm10		MACH_PXA_MPM10		PXA_MPM10		527
+pxa_kyanite		MACH_PXA_KYANITE	PXA_KYANITE		528
+sgold			MACH_SGOLD		SGOLD			529
+oscar			MACH_OSCAR		OSCAR			530
+epxa4usb2		MACH_EPXA4USB2		EPXA4USB2		531
+xsengine		MACH_XSENGINE		XSENGINE		532
+ip600			MACH_IP600		IP600			533
+mcan2			MACH_MCAN2		MCAN2			534
+ddi_blueridge		MACH_DDI_BLUERIDGE	DDI_BLUERIDGE		535
+skyminder		MACH_SKYMINDER		SKYMINDER		536
+lpd79520		MACH_LPD79520		LPD79520		537
+edb9302			MACH_EDB9302		EDB9302			538
diff -Nru a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c
--- a/arch/arm26/kernel/process.c	Tue Jun 15 22:20:58 2004
+++ b/arch/arm26/kernel/process.c	Tue Jun 15 22:20:58 2004
@@ -397,12 +397,6 @@
         return __ret;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long fp, lr;
@@ -417,7 +411,7 @@
 		if (fp < stack_page || fp > 4092+stack_page)
 			return 0;
 		lr = pc_pointer (((unsigned long *)fp)[-1]);
-		if (lr < first_sched || lr > last_sched)
+		if (!in_sched_functions(lr))
 			return lr;
 		fp = *(unsigned long *) (fp - 12);
 	} while (count ++ < 16);
diff -Nru a/arch/cris/Kconfig b/arch/cris/Kconfig
--- a/arch/cris/Kconfig	Tue Jun 15 22:21:02 2004
+++ b/arch/cris/Kconfig	Tue Jun 15 22:21:02 2004
@@ -27,19 +27,11 @@
 
 source "fs/Kconfig.binfmt"
 
-config ETRAX_KGDB
-	bool "Use kernel gdb debugger"
-	---help---
-	  The CRIS version of gdb can be used to remotely debug a running
-	  Linux kernel via the serial debug port.  Provided you have gdb-cris
-	  installed, run gdb-cris vmlinux, then type
-
-	  (gdb) set remotebaud 115200           <- kgdb uses 115200 as default
-	  (gdb) target remote /dev/ttyS0        <- maybe you use another port
-
-	  This should connect you to your booted kernel (or boot it now if you
-	  didn't before).  The kernel halts when it boots, waiting for gdb if
-	  this option is turned on!
+config ETRAX_CMDLINE
+	string "Kernel command line"
+	default "root=/dev/mtdblock3"
+	help
+	  Pass additional commands to the kernel.
 
 config ETRAX_WATCHDOG
 	bool "Enable ETRAX watchdog"
@@ -99,11 +91,6 @@
 	help
 	  Support the xsim ETRAX Simulator.
 
-config ETRAX200LX
-	bool "ETRAX-200LX-V32"
-	help
-	  Support CRIS V32.
-
 endchoice
 
 config ETRAX_ARCH_V10
@@ -111,11 +98,6 @@
        default y if ETRAX100LX || ETRAX100LX_V2
        default n if !(ETRAX100LX || ETRAX100LX_V2) 
 
-config ETRAX_ARCH_V32
-       bool
-       default y if ETRAX200LX
-       default n if !(ETRAX200LX) 
-
 config ETRAX_DRAM_SIZE
 	int "DRAM size (dec, in MB)"
 	default "8"
@@ -128,35 +110,18 @@
 	help
 	  Width in bytes of the Flash bus (1, 2 or 4). Is usually 2.
 
-config ETRAX_ROOT_DEVICE
-	string "Root device name"
-	default "/dev/mtdblock3"
-	help
-	  Specifies the device that should be mounted as root file system
-	  when booting from flash. The axisflashmap driver adds an additional
-	  mtd partition for the appended root file system image, so this option
-	  should normally be the mtdblock device for the partition after the
-	  last partition in the partition table.
-
-# duplicate choice configs are not yet supported, so the followinguse 
-# doesn't work:
-
 source arch/cris/arch-v10/Kconfig
 
 endmenu
 
 # bring in ETRAX built-in drivers
 menu "Drivers for built-in interfaces"
-
 source arch/cris/arch-v10/drivers/Kconfig
 
 endmenu
 
 source "drivers/base/Kconfig"
 
-# bring in Etrax built-in drivers
-source "arch/cris/drivers/Kconfig"
-
 # standard linux drivers
 source "drivers/mtd/Kconfig"
 
@@ -211,6 +176,37 @@
 	int "Profile shift count"
 	depends on PROFILE
 	default "2"
+
+config ETRAX_KGDB
+	bool "Use kernel GDB debugger"
+	---help---
+	  The CRIS version of gdb can be used to remotely debug a running
+	  Linux kernel via the serial debug port.  Provided you have gdb-cris
+	  installed, run gdb-cris vmlinux, then type
+
+	  (gdb) set remotebaud 115200           <- kgdb uses 115200 as default
+	  (gdb) target remote /dev/ttyS0        <- maybe you use another port
+
+	  This should connect you to your booted kernel (or boot it now if you
+	  didn't before).  The kernel halts when it boots, waiting for gdb if
+	  this option is turned on!
+
+
+config DEBUG_INFO
+        bool "Compile the kernel with debug info"
+        help
+          If you say Y here the resulting kernel image will include
+          debugging info resulting in a larger kernel image.
+          Say Y here only if you plan to use gdb to debug the kernel.
+          If you don't debug the kernel, you can say N.
+
+config FRAME_POINTER
+        bool "Compile the kernel with frame pointers"
+        help
+          If you say Y here the resulting kernel image will be slightly larger
+          and slower, but it will give very useful debugging information.
+          If you don't debug the kernel, you can say N, but we may not be able
+          to solve problems without frame pointers.
 
 endmenu
 
diff -Nru a/arch/cris/Makefile b/arch/cris/Makefile
--- a/arch/cris/Makefile	Tue Jun 15 22:20:40 2004
+++ b/arch/cris/Makefile	Tue Jun 15 22:20:40 2004
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.15 2003/07/04 12:47:53 tobiasa Exp $
+# $Id: Makefile,v 1.20 2004/05/14 14:35:58 orjanf Exp $
 # cris/Makefile
 #
 # This file is included by the global makefile so that you can add your own
@@ -34,7 +34,7 @@
 
 CFLAGS := $(CFLAGS) -mlinux -march=$(arch-y) -pipe
 
-ifdef CONFIG_ETRAX_KGDB
+ifdef CONFIG_FRAME_POINTER
 CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g
 CFLAGS += -fno-omit-frame-pointer
 endif
@@ -81,7 +81,7 @@
 
 archmrproper:
 archclean:
-	$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/$(ARCH)/boot	
+	$(Q)$(MAKE) $(clean)=arch/$(ARCH)/boot
 	rm -f timage vmlinux.bin cramfs.img
 	rm -rf $(LD_SCRIPT).tmp
 
@@ -90,10 +90,14 @@
 
 # Create some links to make all tools happy
 arch/$(ARCH)/.links:
+	@rm -rf arch/$(ARCH)/drivers
 	@ln -sfn $(SARCH)/drivers arch/$(ARCH)/drivers
+	@rm -rf arch/$(ARCH)/boot
 	@ln -sfn $(SARCH)/boot arch/$(ARCH)/boot
+	@rm -rf arch/$(ARCH)/lib
 	@ln -sfn $(SARCH)/lib arch/$(ARCH)/lib
-	@ln -sfn $(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S
+	@ln -sfn $(SARCH) arch/$(ARCH)/arch
+	@ln -sfn ../$(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S
 	@touch $@
 
 # Create link to sub arch includes
diff -Nru a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
--- a/arch/cris/arch-v10/boot/compressed/misc.c	Tue Jun 15 22:20:44 2004
+++ b/arch/cris/arch-v10/boot/compressed/misc.c	Tue Jun 15 22:20:44 2004
@@ -1,7 +1,7 @@
 /*
  * misc.c
  *
- * $Id: misc.c,v 1.4 2003/04/09 05:20:45 starvik Exp $
+ * $Id: misc.c,v 1.6 2003/10/27 08:04:31 starvik Exp $
  * 
  * This is a collection of several routines from gzip-1.0.3 
  * adapted for Linux.
@@ -263,7 +263,7 @@
 	__asm__ volatile ("move vr,%0" : "=rm" (revision));
 	if (revision < 10)
 	{
-		puts("You need an ETRAX 100LX to run linux 2.4\n");
+		puts("You need an ETRAX 100LX to run linux 2.6\n");
 		while(1);
 	}
 
diff -Nru a/arch/cris/arch-v10/defconfig b/arch/cris/arch-v10/defconfig
--- a/arch/cris/arch-v10/defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/cris/arch-v10/defconfig	Tue Jun 15 22:20:38 2004
@@ -267,6 +267,7 @@
 # CONFIG_BLK_DEV_ISAPNP is not set
 # CONFIG_IDE_CHIPSETS is not set
 # CONFIG_IDEDMA_AUTO is not set
+# CONFIG_BLK_DEV_IDE_MODES is not set
 
 #
 # SCSI support
diff -Nru a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
--- a/arch/cris/arch-v10/drivers/Kconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/cris/arch-v10/drivers/Kconfig	Tue Jun 15 22:20:37 2004
@@ -11,29 +11,6 @@
 	bool
 	depends on ETRAX_ETHERNET
 	default y
-	---help---
-	  Ethernet (also called IEEE 802.3 or ISO 8802-2) is the most common
-	  type of Local Area Network (LAN) in universities and companies.
-
-	  Common varieties of Ethernet are: 10BASE-2 or Thinnet (10 Mbps over
-	  coaxial cable, linking computers in a chain), 10BASE-T or twisted
-	  pair (10 Mbps over twisted pair cable, linking computers to central
-	  hubs), 10BASE-F (10 Mbps over optical fiber links, using hubs),
-	  100BASE-TX (100 Mbps over two twisted pair cables, using hubs),
-	  100BASE-T4 (100 Mbps over 4 standard voice-grade twisted pair
-	  cables, using hubs), 100BASE-FX (100 Mbps over optical fiber links)
-	  [the 100BASE varieties are also known as Fast Ethernet], and Gigabit
-	  Ethernet (1 Gbps over optical fiber or short copper links).
-
-	  If your Linux machine will be connected to an Ethernet and you have
-	  an Ethernet network interface card (NIC) installed in your computer,
-	  say Y here and read the Ethernet-HOWTO, available from
-	  <http://www.tldp.org/docs.html#howto>. You will then also have
-	  to say Y to the driver for your particular NIC.
-
-	  Note that the answer to this question won't directly affect the
-	  kernel: saying N will just cause the configurator to skip all
-	  the questions about Ethernet network cards. If unsure, say N.
 
 choice
 	prompt "Network LED behavior"
@@ -110,6 +87,32 @@
 	  the same DMA channels.
 
 choice
+	prompt "Ser0 DMA out assignment"
+	depends on ETRAX_SERIAL_PORT0
+	default ETRAX_SERIAL_PORT0_DMA6_OUT
+
+config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT
+       bool "No DMA out"
+
+config CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
+       bool "DMA 6"
+
+endchoice
+
+choice
+	prompt "Ser0 DMA in assignment"
+	depends on ETRAX_SERIAL_PORT0
+	default ETRAX_SERIAL_PORT0_DMA7_IN
+
+config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN
+       bool "No DMA in"
+
+config CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
+       bool "DMA 7"
+
+endchoice
+
+choice
 	prompt "Ser0 DTR, RI, DSR and CD assignment"
 	depends on ETRAX_SERIAL_PORT0
 	default ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE
@@ -198,6 +201,32 @@
 	  Enables the ETRAX 100 serial driver for ser1 (ttyS1).
 
 choice
+	prompt "Ser1 DMA out assignment"
+	depends on ETRAX_SERIAL_PORT1
+	default ETRAX_SERIAL_PORT1_DMA8_OUT
+
+config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_OUT
+       bool "No DMA out"
+
+config CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
+       bool "DMA 8"
+
+endchoice
+
+choice
+	prompt "Ser1 DMA in assignment"
+	depends on ETRAX_SERIAL_PORT1
+	default ETRAX_SERIAL_PORT1_DMA9_IN
+
+config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_IN
+       bool "No DMA in"
+
+config CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
+       bool "DMA 9"
+
+endchoice
+
+choice
 	prompt "Ser1 DTR, RI, DSR and CD assignment"
 	depends on ETRAX_SERIAL_PORT1
 	default ETRAX_SER1_DTR_RI_DSR_CD_ON_NONE
@@ -289,6 +318,32 @@
 	  Enables the ETRAX 100 serial driver for ser2 (ttyS2).
 
 choice
+	prompt "Ser2 DMA out assignment"
+	depends on ETRAX_SERIAL_PORT2
+	default ETRAX_SERIAL_PORT2_DMA2_OUT
+
+config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT
+       bool "No DMA out"
+
+config CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
+       bool "DMA 2"
+
+endchoice
+
+choice
+	prompt "Ser2 DMA in assignment"
+	depends on ETRAX_SERIAL_PORT2
+	default ETRAX_SERIAL_PORT2_DMA3_IN
+
+config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN
+       bool "No DMA in"
+
+config CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
+       bool "DMA 3"
+
+endchoice
+
+choice
 	prompt "Ser2 DTR, RI, DSR and CD assignment"
 	depends on ETRAX_SERIAL_PORT2
 	default ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE
@@ -377,6 +432,32 @@
 	  Enables the ETRAX 100 serial driver for ser3 (ttyS3).
 
 choice
+	prompt "Ser3 DMA out assignment"
+	depends on ETRAX_SERIAL_PORT3
+	default ETRAX_SERIAL_PORT3_DMA4_OUT
+
+config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_OUT
+       bool "No DMA out"
+
+config CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
+       bool "DMA 4"
+
+endchoice
+
+choice
+	prompt "Ser3 DMA in assignment"
+	depends on ETRAX_SERIAL_PORT3
+	default ETRAX_SERIAL_PORT3_DMA5_IN
+
+config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_IN
+       bool "No DMA in"
+
+config CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
+       bool "DMA 5"
+
+endchoice
+
+choice
 	prompt "Ser3 DTR, RI, DSR and CD assignment"
 	depends on ETRAX_SERIAL_PORT3
 	default ETRAX_SER3_DTR_RI_DSR_CD_ON_NONE
@@ -465,6 +546,95 @@
 	  It's necessary to disable the serial receiver to avoid serial
 	  loopback.  Not all products are able to do this in software only.
 	  Axis 2400/2401 must disable receiver.
+
+config ETRAX_IDE
+	bool "ATA/IDE support"
+	help
+	  Enable this to get support for ATA/IDE.
+	  You can't use parallell ports or SCSI ports
+	  at the same time.
+
+# here we should add the CONFIG_'s necessary to enable the basic
+# general ide drivers so the common case does not need to go
+# into that config submenu. enable disk and CD support. others
+# need to go fiddle in the submenu..
+config IDE
+	tristate
+	depends on ETRAX_IDE
+	default y
+
+config BLK_DEV_IDE
+	tristate
+	depends on ETRAX_IDE
+	default y
+
+config BLK_DEV_IDEDISK
+	tristate
+	depends on ETRAX_IDE
+	default y
+
+config BLK_DEV_IDECD
+	tristate
+	depends on ETRAX_IDE
+	default y
+
+config BLK_DEV_IDEDMA
+	bool
+	depends on ETRAX_IDE
+	default y
+
+config DMA_NONPCI
+	bool
+	depends on ETRAX_IDE
+	default y
+
+config ETRAX_IDE_DELAY
+	int "Delay for drives to regain consciousness"
+	depends on ETRAX_IDE
+	default 15
+	help
+	  Number of seconds to wait for IDE drives to spin up after an IDE
+	  reset.
+choice
+	prompt "IDE reset pin"
+	depends on ETRAX_IDE
+	default ETRAX_IDE_PB7_RESET
+
+config ETRAX_IDE_PB7_RESET
+	bool "Port_PB_Bit_7"
+	help
+	  IDE reset on pin 7 on port B
+
+config ETRAX_IDE_G27_RESET
+        bool "Port_G_Bit_27"
+	help
+	  IDE reset on pin 27 on port G
+
+endchoice
+
+
+config ETRAX_USB_HOST
+	bool "USB host"
+	help
+	   This option enables the host functionality of the ETRAX 100LX
+	   built-in USB controller. In host mode the controller is designed
+	   for CTRL and BULK traffic only, INTR traffic may work as well
+	   however (depending on the requirements of timeliness).
+
+config USB
+       tristate
+       depends on ETRAX_USB_HOST
+       default y
+
+config ETRAX_USB_HOST_PORT1
+       bool "  USB port 1 enabled"
+       depends on ETRAX_USB_HOST
+       default n
+
+config ETRAX_USB_HOST_PORT2
+       bool "  USB port 2 enabled"
+       depends on ETRAX_USB_HOST
+       default n
 
 config ETRAX_AXISFLASHMAP
 	bool "Axis flash-map support"
diff -Nru a/arch/cris/arch-v10/drivers/Makefile b/arch/cris/arch-v10/drivers/Makefile
--- a/arch/cris/arch-v10/drivers/Makefile	Tue Jun 15 22:20:35 2004
+++ b/arch/cris/arch-v10/drivers/Makefile	Tue Jun 15 22:20:35 2004
@@ -10,5 +10,7 @@
 obj-$(CONFIG_ETRAX_GPIO) 	        += gpio.o
 obj-$(CONFIG_ETRAX_DS1302)              += ds1302.o
 obj-$(CONFIG_ETRAX_PCF8563)		+= pcf8563.o
+obj-$(CONFIG_ETRAX_IDE)                 += ide.o
+obj-$(CONFIG_ETRAX_USB_HOST)            += usb-host.o
 
 
diff -Nru a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c
--- a/arch/cris/arch-v10/drivers/axisflashmap.c	Tue Jun 15 22:20:43 2004
+++ b/arch/cris/arch-v10/drivers/axisflashmap.c	Tue Jun 15 22:20:43 2004
@@ -11,6 +11,9 @@
  * partition split defined below.
  *
  * $Log: axisflashmap.c,v $
+ * Revision 1.8  2004/05/14 07:58:03  starvik
+ * Merge of changes from 2.4
+ *
  * Revision 1.6  2003/07/04 08:27:37  starvik
  * Merge of Linux 2.5.74
  *
@@ -153,6 +156,9 @@
 /* From head.S */
 extern unsigned long romfs_start, romfs_length, romfs_in_flash;
 
+/* The master mtd for the entire flash. */
+struct mtd_info* axisflash_mtd = NULL;
+
 /* Map driver functions. */
 
 static __u8 flash_read8(struct map_info *map, unsigned long ofs)
@@ -314,7 +320,8 @@
 {
 	struct mtd_info *mtd_cs = NULL;
 
-	printk("%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
+	printk(KERN_INFO
+               "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
 	       map_cs->name, map_cs->size, map_cs->map_priv_1);
 
 #ifdef CONFIG_MTD_AMDSTD
@@ -398,7 +405,7 @@
 	struct mtd_info *mymtd;
 	int err = 0;
 	int pidx = 0;
-	struct partitiontable_head *ptable_head;
+	struct partitiontable_head *ptable_head = NULL;
 	struct partitiontable_entry *ptable;
 	int use_default_ptable = 1; /* Until proven otherwise. */
 	const char *pmsg = "  /dev/flash%d at 0x%08x, size 0x%08x\n";
@@ -407,19 +414,22 @@
 		/* There's no reason to use this module if no flash chip can
 		 * be identified. Make sure that's understood.
 		 */
-		panic("axisflashmap found no flash chip!\n");
+		printk(KERN_INFO "axisflashmap: Found no flash chip.\n");
+	} else {
+		printk(KERN_INFO "%s: 0x%08x bytes of flash memory.\n",
+		       mymtd->name, mymtd->size);
+		axisflash_mtd = mymtd;
 	}
 
-	printk("%s: 0x%08x bytes of flash memory.\n",
-	       mymtd->name, mymtd->size);
-
-	mymtd->owner = THIS_MODULE;
-
-	ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +
-		      CONFIG_ETRAX_PTABLE_SECTOR + PARTITION_TABLE_OFFSET);
+	if (mymtd) {
+		mymtd->owner = THIS_MODULE;
+		ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +
+			      CONFIG_ETRAX_PTABLE_SECTOR +
+			      PARTITION_TABLE_OFFSET);
+	}
 	pidx++;  /* First partition is always set to the default. */
 
-	if ((ptable_head->magic == PARTITION_TABLE_MAGIC)
+	if (ptable_head && (ptable_head->magic == PARTITION_TABLE_MAGIC)
 	    && (ptable_head->size <
 		(MAX_PARTITIONS * sizeof(struct partitiontable_entry) +
 		PARTITIONTABLE_END_MARKER_SIZE))
@@ -454,7 +464,7 @@
 		ptable_ok = (csum == ptable_head->checksum);
 
 		/* Read the entries and use/show the info.  */
-		printk(" Found a%s partition table at 0x%p-0x%p.\n",
+		printk(KERN_INFO " Found a%s partition table at 0x%p-0x%p.\n",
 		       (ptable_ok ? " valid" : "n invalid"), ptable_head,
 		       max_addr);
 
@@ -486,22 +496,25 @@
 		axis_partitions[pidx].offset = romfs_start - FLASH_CACHED_ADDR;
 		axis_partitions[pidx].mask_flags |= MTD_WRITEABLE;
 
-		printk(" Adding readonly flash partition for romfs image:\n");
+		printk(KERN_INFO
+                       " Adding readonly flash partition for romfs image:\n");
 		printk(pmsg, pidx, axis_partitions[pidx].offset,
 		       axis_partitions[pidx].size);
 		pidx++;
 	}
 
-	if (use_default_ptable) {
-		printk(" Using default partition table.\n");
-		err = add_mtd_partitions(mymtd, axis_default_partitions,
-		                         NUM_DEFAULT_PARTITIONS);
-	} else {
-		err = add_mtd_partitions(mymtd, axis_partitions, pidx);
-	}
+        if (mymtd) {
+		if (use_default_ptable) {
+			printk(KERN_INFO " Using default partition table.\n");
+			err = add_mtd_partitions(mymtd, axis_default_partitions,
+						 NUM_DEFAULT_PARTITIONS);
+		} else {
+			err = add_mtd_partitions(mymtd, axis_partitions, pidx);
+		}
 
-	if (err) {
-		panic("axisflashmap could not add MTD partitions!\n");
+		if (err) {
+			panic("axisflashmap could not add MTD partitions!\n");
+		}
 	}
 
 	if (!romfs_in_flash) {
@@ -522,7 +535,7 @@
 			      "mtd_info!\n");
 		}
 
-		printk(" Adding RAM partition for romfs image:\n");
+		printk(KERN_INFO " Adding RAM partition for romfs image:\n");
 		printk(pmsg, pidx, romfs_start, romfs_length);
 
 		err = mtdram_init_device(mtd_ram, (void*)romfs_start, 
@@ -539,3 +552,5 @@
 
 /* This adds the above to the kernels init-call chain. */
 module_init(init_axis_flash);
+
+EXPORT_SYMBOL(axisflash_mtd);
diff -Nru a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
--- a/arch/cris/arch-v10/drivers/ds1302.c	Tue Jun 15 22:20:58 2004
+++ b/arch/cris/arch-v10/drivers/ds1302.c	Tue Jun 15 22:20:58 2004
@@ -4,9 +4,18 @@
 *!
 *! DESCRIPTION: Implements an interface for the DS1302 RTC through Etrax I/O
 *!
-*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init, get_rtc_status
+*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init
 *!
 *! $Log: ds1302.c,v $
+*! Revision 1.13  2004/05/28 09:26:59  starvik
+*! Modified I2C initialization to work in 2.6.
+*!
+*! Revision 1.12  2004/05/14 07:58:03  starvik
+*! Merge of changes from 2.4
+*!
+*! Revision 1.10  2004/02/04 09:25:12  starvik
+*! Merge of Linux 2.6.2
+*!
 *! Revision 1.9  2003/07/04 08:27:37  starvik
 *! Merge of Linux 2.5.74
 *!
@@ -114,7 +123,7 @@
 *!
 *! (C) Copyright 1999, 2000, 2001  Axis Communications AB, LUND, SWEDEN
 *!
-*! $Id: ds1302.c,v 1.9 2003/07/04 08:27:37 starvik Exp $
+*! $Id: ds1302.c,v 1.13 2004/05/28 09:26:59 starvik Exp $
 *!
 *!***************************************************************************/
 
@@ -283,12 +292,23 @@
 void
 ds1302_writereg(int reg, unsigned char val) 
 {
-	ds1302_wenable();
-	start();
-	out_byte(0x80 | (reg << 1)); /* write register */
-	out_byte(val);
-	stop();
-	ds1302_wdisable();
+#ifndef CONFIG_ETRAX_RTC_READONLY
+	int do_writereg = 1;
+#else
+	int do_writereg = 0;
+
+	if (reg == RTC_TRICKLECHARGER)
+		do_writereg = 1;
+#endif
+
+	if (do_writereg) {
+		ds1302_wenable();
+		start();
+		out_byte(0x80 | (reg << 1)); /* write register */
+		out_byte(val);
+		stop();
+		ds1302_wdisable();
+	}
 }
 
 void
@@ -426,20 +446,33 @@
 			tcs_val = RTC_TCR_PATTERN | (tcs_val & 0x0F);
 			ds1302_writereg(RTC_TRICKLECHARGER, tcs_val);
 			return 0;
-		}                
+		}
+		case RTC_VLOW_RD:
+		{
+			/* TODO:
+			 * Implement voltage low detection support
+			 */
+			printk(KERN_WARNING "DS1302: RTC Voltage Low detection"
+			       " is not supported\n");
+			return 0;
+		}
+		case RTC_VLOW_SET:
+		{
+			/* TODO:
+			 * Nothing to do since Voltage Low detection is not supported
+			 */
+			return 0;
+		}
 		default:
 			return -ENOIOCTLCMD;
 	}
 }
 
-int
-get_rtc_status(char *buf) 
+static void
+print_rtc_status(void)
 {
-	char *p;
 	struct rtc_time tm;
 
-	p = buf;
-
 	get_rtc_time(&tm);
 
 	/*
@@ -447,16 +480,12 @@
 	 * time or for Universal Standard Time (GMT). Probably local though.
 	 */
 
-	p += sprintf(p,
-		"rtc_time\t: %02d:%02d:%02d\n"
-		"rtc_date\t: %04d-%02d-%02d\n",
-		tm.tm_hour, tm.tm_min, tm.tm_sec,
-		tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
-
-	return  p - buf;
+	printk(KERN_INFO "rtc_time\t: %02d:%02d:%02d\n",
+	       tm.tm_hour, tm.tm_min, tm.tm_sec);
+	printk(KERN_INFO "rtc_date\t: %04d-%02d-%02d\n",
+	       tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
 }
 
-
 /* The various file operations we support. */
 
 static struct file_operations rtc_fops = {
@@ -487,11 +516,10 @@
 	out_byte(0xc1); /* read RAM byte 0 */
 
 	if((res = in_byte()) == MAGIC_PATTERN) {
-		char buf[100];
 		stop();
 		ds1302_wdisable();
-		printk("%s: RTC found.\n", ds1302_name);
-		printk("%s: SDA, SCL, RST on PB%i, PB%i, %s%i\n",
+		printk(KERN_INFO "%s: RTC found.\n", ds1302_name);
+		printk(KERN_INFO "%s: SDA, SCL, RST on PB%i, PB%i, %s%i\n",
 		       ds1302_name,
 		       CONFIG_ETRAX_DS1302_SDABIT,
 		       CONFIG_ETRAX_DS1302_SCLBIT,
@@ -501,12 +529,10 @@
 		       "PB",
 #endif
 		       CONFIG_ETRAX_DS1302_RSTBIT);
-                get_rtc_status(buf);
-                printk(buf);
+                print_rtc_status();
 		retval = 1;
 	} else {
 		stop();
-		printk("%s: RTC not found.\n", ds1302_name);
 		retval = 0;
 	}
 
@@ -518,7 +544,9 @@
 
 int __init
 ds1302_init(void) 
-{ 
+{
+	i2c_init();
+
 	if (!ds1302_probe()) {
 #ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT
 #if CONFIG_ETRAX_DS1302_RSTBIT == 27
@@ -539,16 +567,20 @@
 				   (IO_STATE(R_GEN_CONFIG, g0dir, out)));    
     		*R_GEN_CONFIG = genconfig_shadow;
 #endif
-		if (!ds1302_probe())
+		if (!ds1302_probe()) {
+			printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
       			return -1;
+		}
 #else
+		printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
     		return -1;
 #endif
   	}
-  
 	/* Initialise trickle charger */
 	ds1302_writereg(RTC_TRICKLECHARGER,
 			RTC_TCR_PATTERN |(CONFIG_ETRAX_DS1302_TRICKLE_CHARGE & 0x0F));
+        /* Start clock by resetting CLOCK_HALT */
+	ds1302_writereg(RTC_SECONDS, (ds1302_readreg(RTC_SECONDS) & 0x7F));
 	return 0;
 }
 
diff -Nru a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c
--- a/arch/cris/arch-v10/drivers/eeprom.c	Tue Jun 15 22:20:39 2004
+++ b/arch/cris/arch-v10/drivers/eeprom.c	Tue Jun 15 22:20:39 2004
@@ -20,6 +20,9 @@
 *!                                  in the spin-lock.
 *!
 *!  $Log: eeprom.c,v $
+*!  Revision 1.10  2003/09/11 07:29:48  starvik
+*!  Merge of Linux 2.6.0-test5
+*!
 *!  Revision 1.9  2003/07/04 08:27:37  starvik
 *!  Merge of Linux 2.5.74
 *!
@@ -441,9 +444,9 @@
 static int eeprom_open(struct inode * inode, struct file * file)
 {
 
-  if(iminor(inode) != EEPROM_MINOR_NR)
+  if(MINOR(inode->i_rdev) != EEPROM_MINOR_NR)
      return -ENXIO;
-  if(imajor(inode) != EEPROM_MAJOR_NR)
+  if(MAJOR(inode->i_rdev) != EEPROM_MAJOR_NR)
      return -ENXIO;
 
   if( eeprom.size > 0 )
diff -Nru a/arch/cris/arch-v10/drivers/ethernet.c b/arch/cris/arch-v10/drivers/ethernet.c
--- a/arch/cris/arch-v10/drivers/ethernet.c	Tue Jun 15 22:20:40 2004
+++ b/arch/cris/arch-v10/drivers/ethernet.c	Tue Jun 15 22:20:40 2004
@@ -1,4 +1,4 @@
-/* $Id: ethernet.c,v 1.17 2003/07/04 08:27:37 starvik Exp $
+/* $Id: ethernet.c,v 1.22 2004/05/14 07:58:03 starvik Exp $
  *
  * e100net.c: A network driver for the ETRAX 100LX network controller.
  *
@@ -7,6 +7,15 @@
  * The outline of this driver comes from skeleton.c.
  *
  * $Log: ethernet.c,v $
+ * Revision 1.22  2004/05/14 07:58:03  starvik
+ * Merge of changes from 2.4
+ *
+ * Revision 1.20  2004/03/11 11:38:40  starvik
+ * Merge of Linux 2.6.4
+ *
+ * Revision 1.18  2003/12/03 13:45:46  starvik
+ * Use hardware pad for short packets to prevent information leakage.
+ *
  * Revision 1.17  2003/07/04 08:27:37  starvik
  * Merge of Linux 2.5.74
  *
@@ -258,6 +267,16 @@
 	struct sk_buff* skb;
 } etrax_eth_descr;
 
+/* Some transceivers requires special handling */
+struct transceiver_ops
+{
+	unsigned int oui;
+	void (*check_speed)(void);
+	void (*check_duplex)(void);
+};
+
+struct transceiver_ops* transceiver;
+
 /* Duplex settings */
 enum duplex
 {
@@ -278,10 +297,17 @@
 */
 #define MDIO_BASE_STATUS_REG                0x1
 #define MDIO_BASE_CONTROL_REG               0x0
+#define MDIO_PHY_ID_HIGH_REG                0x2
+#define MDIO_PHY_ID_LOW_REG                 0x3
 #define MDIO_BC_NEGOTIATE                0x0200
 #define MDIO_BC_FULL_DUPLEX_MASK         0x0100
 #define MDIO_BC_AUTO_NEG_MASK            0x1000
 #define MDIO_BC_SPEED_SELECT_MASK        0x2000
+#define MDIO_STATUS_100_FD               0x4000
+#define MDIO_STATUS_100_HD               0x2000
+#define MDIO_STATUS_10_FD                0x1000
+#define MDIO_STATUS_10_HD                0x0800
+#define MDIO_STATUS_SPEED_DUPLEX_MASK	 0x7800
 #define MDIO_ADVERTISMENT_REG               0x4
 #define MDIO_ADVERT_100_FD                0x100
 #define MDIO_ADVERT_100_HD                0x080
@@ -295,9 +321,13 @@
 
 /* Broadcom specific */
 #define MDIO_AUX_CTRL_STATUS_REG           0x18
-#define MDIO_FULL_DUPLEX_IND                0x1
-#define MDIO_SPEED                          0x2
-#define MDIO_PHYS_ADDR                      0x0
+#define MDIO_BC_FULL_DUPLEX_IND             0x1
+#define MDIO_BC_SPEED                       0x2
+
+/* TDK specific */
+#define MDIO_TDK_DIAGNOSTIC_REG              18
+#define MDIO_TDK_DIAGNOSTIC_RATE          0x400
+#define MDIO_TDK_DIAGNOSTIC_DPLX          0x800
 
 /* Network flash constants */
 #define NET_FLASH_TIME                  (HZ/50) /* 20 ms */
@@ -341,6 +371,9 @@
 static etrax_eth_descr TxDescList[NBR_OF_TX_DESC] __attribute__ ((aligned(32)));
 
 static unsigned int network_rec_config_shadow = 0;
+static unsigned int mdio_phy_addr; /* Transciever address */
+
+static unsigned int network_tr_ctrl_shadow = 0;
 
 /* Network speed indication. */
 static struct timer_list speed_timer = TIMER_INITIALIZER(NULL, 0, 0);
@@ -376,6 +409,7 @@
 static void e100_hardware_send_packet(char *buf, int length);
 static void update_rx_stats(struct net_device_stats *);
 static void update_tx_stats(struct net_device_stats *);
+static int e100_probe_transceiver(void);
 
 static void e100_check_speed(unsigned long dummy);
 static void e100_set_speed(unsigned long speed);
@@ -393,6 +427,21 @@
 static void e100_clear_network_leds(unsigned long dummy);
 static void e100_set_network_leds(int active);
 
+static void broadcom_check_speed(void);
+static void broadcom_check_duplex(void);
+static void tdk_check_speed(void);
+static void tdk_check_duplex(void);
+static void generic_check_speed(void);
+static void generic_check_duplex(void);
+
+struct transceiver_ops transceivers[] =
+{
+	{0x1018, broadcom_check_speed, broadcom_check_duplex},  /* Broadcom */
+	{0xC039, tdk_check_speed, tdk_check_duplex},            /* TDK 2120 */
+	{0x039C, tdk_check_speed, tdk_check_duplex},            /* TDK 2120C */
+	{0x0000, generic_check_speed, generic_check_duplex}     /* Generic, must be last */
+};
+
 #define tx_done(dev) (*R_DMA_CH0_CMD == 0)
 
 /*
@@ -409,7 +458,8 @@
 	struct net_device *dev;
 	int i, err;
 
-	printk("ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n");
+	printk(KERN_INFO
+	       "ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB\n");
 
 	dev = alloc_etherdev(sizeof(struct net_local));
 	if (!dev)
@@ -496,7 +546,6 @@
 	current_speed_selection = 0; /* Auto */
 	speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL;
 	speed_timer.function = e100_check_speed;
-	add_timer(&speed_timer);
         
 	clear_led_timer.function = e100_clear_network_leds;
         
@@ -504,7 +553,6 @@
 	current_duplex = autoneg;
 	duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL;		
 	duplex_timer.function = e100_check_duplex;
-	add_timer(&duplex_timer);
 
 	/* Initialize group address registers to make sure that no */
 	/* unwanted addresses are matched */
@@ -543,7 +591,7 @@
 
 	/* show it in the log as well */
 
-	printk("%s: changed MAC to ", dev->name);
+	printk(KERN_INFO "%s: changed MAC to ", dev->name);
 
 	for (i = 0; i < 5; i++)
 		printk("%02X:", dev->dev_addr[i]);
@@ -569,12 +617,6 @@
 {
 	unsigned long flags;
 
-	/* disable the ethernet interface while we configure it */
-
-	*R_NETWORK_GEN_CONFIG =
-		IO_STATE(R_NETWORK_GEN_CONFIG, phy,    mii_clk) |
-		IO_STATE(R_NETWORK_GEN_CONFIG, enable, off);
-
 	/* enable the MDIO output pin */
 
 	*R_NETWORK_MGM_CTRL = IO_STATE(R_NETWORK_MGM_CTRL, mdoe, enable);
@@ -645,14 +687,14 @@
 		IO_STATE(R_NETWORK_GEN_CONFIG, phy,    mii_clk) |
 		IO_STATE(R_NETWORK_GEN_CONFIG, enable, on);
 
-	*R_NETWORK_TR_CTRL = 
-		IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr) |
-		IO_STATE(R_NETWORK_TR_CTRL, delay, none) |
-		IO_STATE(R_NETWORK_TR_CTRL, cancel, dont) |
-		IO_STATE(R_NETWORK_TR_CTRL, cd, enable) |
-		IO_STATE(R_NETWORK_TR_CTRL, retry, enable) |
-		IO_STATE(R_NETWORK_TR_CTRL, pad, enable) |
-		IO_STATE(R_NETWORK_TR_CTRL, crc, enable);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, delay, none);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, cancel, dont);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, cd, enable);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, retry, enable);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, pad, enable);
+	SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, crc, enable);
+	*R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
 
 	save_flags(flags);
 	cli();
@@ -660,7 +702,8 @@
 	/* enable the irq's for ethernet DMA */
 
 	*R_IRQ_MASK2_SET =
-		IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set); 
+		IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) |
+		IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set);
 
 	*R_IRQ_MASK0_SET =
 		IO_STATE(R_IRQ_MASK0_SET, overrun,       set) |
@@ -689,6 +732,14 @@
 
 	restore_flags(flags);
 	
+	/* Probe for transceiver */
+	if (e100_probe_transceiver())
+		goto grace_exit3;
+
+	/* Start duplex/speed timers */
+	add_timer(&speed_timer);
+	add_timer(&duplex_timer);
+
 	/* We are now ready to accept transmit requeusts from
 	 * the queueing layer of the networking.
 	 */
@@ -696,6 +747,8 @@
 
 	return 0;
 
+grace_exit3:
+	free_irq(NETWORK_STATUS_IRQ_NBR, (void *)dev);
 grace_exit2:
 	free_irq(NETWORK_DMA_TX_IRQ_NBR, (void *)dev);
 grace_exit1:
@@ -706,8 +759,37 @@
 
 
 static void
+generic_check_speed(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_ADVERTISMENT_REG);
+	if ((data & MDIO_ADVERT_100_FD) ||
+	    (data & MDIO_ADVERT_100_HD))
+		current_speed = 100;
+	else
+		current_speed = 10;
+}
+
+static void
+tdk_check_speed(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_TDK_DIAGNOSTIC_REG);
+	current_speed = (data & MDIO_TDK_DIAGNOSTIC_RATE ? 100 : 10);
+}
+
+static void
+broadcom_check_speed(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG);
+	current_speed = (data & MDIO_BC_SPEED ? 100 : 10);
+}
+
+static void
 e100_check_speed(unsigned long dummy)
 {
+	static int led_initiated = 0;
 	unsigned long data;
 	int old_speed = current_speed;
 
@@ -715,12 +797,13 @@
 	if (!(data & MDIO_LINK_UP_MASK)) {
 		current_speed = 0;
 	} else {
-		data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG);
-		current_speed = (data & MDIO_SPEED ? 100 : 10);
+		transceiver->check_speed();
 	}
 	
-	if (old_speed != current_speed)
+	if ((old_speed != current_speed) || !led_initiated) {
+		led_initiated = 1;
 		e100_set_network_leds(NO_NETWORK_ACTIVITY);
+	}
 
 	/* Reinitialize the timer. */
 	speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL;
@@ -781,29 +864,21 @@
 static void
 e100_set_speed(unsigned long speed)
 {
-	current_speed_selection = speed;
-	e100_negotiate();
+	if (speed != current_speed_selection) {
+		current_speed_selection = speed;
+		e100_negotiate();
+	}
 }
 
 static void
 e100_check_duplex(unsigned long dummy)
 {
-	unsigned long data;
-
-	data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG);
-        
-	if (data & MDIO_FULL_DUPLEX_IND) {
-		if (!full_duplex) { /* Duplex changed to full? */
-			full_duplex = 1;
-			SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex);
-			*R_NETWORK_REC_CONFIG = network_rec_config_shadow;
-		}
-	} else { /* half */
-		if (full_duplex) { /* Duplex changed to half? */
-			full_duplex = 0;
-			SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex);
-			*R_NETWORK_REC_CONFIG = network_rec_config_shadow;
-		}
+	int old_duplex = full_duplex;
+	transceiver->check_duplex();
+	if (old_duplex != full_duplex) {
+		/* Duplex changed */
+		SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex);
+		*R_NETWORK_REC_CONFIG = network_rec_config_shadow;
 	}
 
 	/* Reinitialize the timer. */
@@ -811,13 +886,72 @@
 	add_timer(&duplex_timer);
 }
 
+static void
+generic_check_duplex(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_ADVERTISMENT_REG);
+	if ((data & MDIO_ADVERT_100_FD) ||
+	    (data & MDIO_ADVERT_10_FD))
+		full_duplex = 1;
+	else
+		full_duplex = 0;
+}
+
+static void
+tdk_check_duplex(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_TDK_DIAGNOSTIC_REG);
+	full_duplex = (data & MDIO_TDK_DIAGNOSTIC_DPLX) ? 1 : 0;
+}
+
+static void
+broadcom_check_duplex(void)
+{
+	unsigned long data;
+	data = e100_get_mdio_reg(MDIO_AUX_CTRL_STATUS_REG);
+	full_duplex = (data & MDIO_BC_FULL_DUPLEX_IND) ? 1 : 0;
+}
+
 static void 
 e100_set_duplex(enum duplex new_duplex)
 {
-	current_duplex = new_duplex;
-	e100_negotiate();
+	if (new_duplex != current_duplex) {
+		current_duplex = new_duplex;
+		e100_negotiate();
+	}
 }
 
+static int
+e100_probe_transceiver(void)
+{
+	unsigned int phyid_high;
+	unsigned int phyid_low;
+	unsigned int oui;
+	struct transceiver_ops* ops = NULL;
+
+	/* Probe MDIO physical address */
+	for (mdio_phy_addr = 0; mdio_phy_addr <= 31; mdio_phy_addr++) {
+		if (e100_get_mdio_reg(MDIO_BASE_STATUS_REG) != 0xffff)
+			break;
+	}
+	if (mdio_phy_addr == 32)
+		 return -ENODEV;
+
+	/* Get manufacturer */
+	phyid_high = e100_get_mdio_reg(MDIO_PHY_ID_HIGH_REG);
+	phyid_low = e100_get_mdio_reg(MDIO_PHY_ID_LOW_REG);
+	oui = (phyid_high << 6) | (phyid_low >> 10);
+
+	for (ops = &transceivers[0]; ops->oui; ops++) {
+		if (ops->oui == oui)
+			break;
+	}
+	transceiver = ops;
+
+	return 0;
+}
 
 static unsigned short
 e100_get_mdio_reg(unsigned char reg_num)
@@ -827,7 +961,7 @@
 	int bitCounter;
 	
 	/* Start of frame, OP Code, Physical Address, Register Address */
-	cmd = (MDIO_START << 14) | (MDIO_READ << 12) | (MDIO_PHYS_ADDR << 7) |
+	cmd = (MDIO_START << 14) | (MDIO_READ << 12) | (mdio_phy_addr << 7) |
 		(reg_num << 2);
 	
 	e100_send_mdio_cmd(cmd, 0);
@@ -848,7 +982,7 @@
 	int bitCounter;
 	unsigned short cmd;
 
-	cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (MDIO_PHYS_ADDR << 7) |
+	cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) |
 	      (reg << 2);
 
 	e100_send_mdio_cmd(cmd, 1);
@@ -916,7 +1050,7 @@
 
 	data = e100_get_mdio_reg(MDIO_BASE_CONTROL_REG);
 
-	cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (MDIO_PHYS_ADDR << 7) | (MDIO_BASE_CONTROL_REG << 2);
+	cmd = (MDIO_START << 14) | (MDIO_WRITE << 12) | (mdio_phy_addr << 7) | (MDIO_BASE_CONTROL_REG << 2);
 
 	e100_send_mdio_cmd(cmd, 1);
 	
@@ -984,7 +1118,6 @@
 e100_send_packet(struct sk_buff *skb, struct net_device *dev)
 {
 	struct net_local *np = (struct net_local *)dev->priv;
-	int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
 	unsigned char *buf = skb->data;
 	unsigned long flags;
 	
@@ -997,15 +1130,12 @@
 
 	dev->trans_start = jiffies;
 	
-	e100_hardware_send_packet(buf, length);
+	e100_hardware_send_packet(buf, skb->len);
 
 	myNextTxDesc = phys_to_virt(myNextTxDesc->descr.next);
 
 	/* Stop queue if full */
 	if (myNextTxDesc == myFirstTxDesc) {
-		/* Enable transmit interrupt to wake up queue */
-		*R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do);		
-		*R_IRQ_MASK2_SET = IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set);
 		netif_stop_queue(dev);
 	}
 
@@ -1026,6 +1156,11 @@
 	struct net_local *np = (struct net_local *)dev->priv;
 	unsigned long irqbits = *R_IRQ_MASK2_RD;
  
+	/* Disable RX/TX IRQs to avoid reentrancy */
+	*R_IRQ_MASK2_CLR =
+	  IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr) |
+	  IO_STATE(R_IRQ_MASK2_CLR, dma1_eop, clr);
+
 	/* Handle received packets */
 	if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma1_eop, active)) {
 		/* acknowledge the eop interrupt */
@@ -1069,9 +1204,14 @@
 	if (irqbits & IO_STATE(R_IRQ_MASK2_RD, dma0_eop, active)) {
 		/* acknowledge the eop interrupt and wake up queue */
 		*R_DMA_CH0_CLR_INTR = IO_STATE(R_DMA_CH0_CLR_INTR, clr_eop, do);
-		*R_IRQ_MASK2_CLR = IO_STATE(R_IRQ_MASK2_CLR, dma0_eop, clr);		
 		netif_wake_queue(dev);
 	}
+
+	/* Enable RX/TX IRQs again */
+	*R_IRQ_MASK2_SET =
+	  IO_STATE(R_IRQ_MASK2_SET, dma0_eop, set) |
+	  IO_STATE(R_IRQ_MASK2_SET, dma1_eop, set);
+
 	return IRQ_HANDLED;
 }
 
@@ -1084,7 +1224,9 @@
 
 	/* check for underrun irq */
 	if (irqbits & IO_STATE(R_IRQ_MASK0_RD, underrun, active)) { 
-		*R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr);
+		SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
+		*R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
+		SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop);
 		np->stats.tx_errors++;
 		D(printk("ethernet receiver underrun!\n"));
 	}
@@ -1096,6 +1238,9 @@
 	}
 	/* check for excessive collision irq */
 	if (irqbits & IO_STATE(R_IRQ_MASK0_RD, excessive_col, active)) { 
+		SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, clr);
+		*R_NETWORK_TR_CTRL = network_tr_ctrl_shadow;
+		SETS(network_tr_ctrl_shadow, R_NETWORK_TR_CTRL, clr_error, nop);
 		*R_NETWORK_TR_CTRL = IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr);
 		np->stats.tx_errors++;
 		D(printk("ethernet excessive collisions!\n"));
@@ -1210,14 +1355,10 @@
 {
 	struct net_local *np = (struct net_local *)dev->priv;
 
-	printk("Closing %s.\n", dev->name);
+	printk(KERN_INFO "Closing %s.\n", dev->name);
 
 	netif_stop_queue(dev);
 
-	*R_NETWORK_GEN_CONFIG =
-		IO_STATE(R_NETWORK_GEN_CONFIG, phy,    mii_clk) |
-		IO_STATE(R_NETWORK_GEN_CONFIG, enable, off);
-	
 	*R_IRQ_MASK0_CLR =
 		IO_STATE(R_IRQ_MASK0_CLR, overrun, clr) |
 		IO_STATE(R_IRQ_MASK0_CLR, underrun, clr) |
@@ -1245,21 +1386,25 @@
 	update_rx_stats(&np->stats);
 	update_tx_stats(&np->stats);
 
+	/* Stop speed/duplex timers */
+	del_timer(&speed_timer);
+	del_timer(&duplex_timer);
+
 	return 0;
 }
 
 static int
 e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data;
-	struct net_local *np = (struct net_local *)dev->priv;
+	struct mii_ioctl_data *data = if_mii(ifr);
+	struct net_local *np = netdev_priv(dev);
 
 	spin_lock(&np->lock); /* Preempt protection */
 	switch (cmd) {
 		case SIOCETHTOOL:
 			return e100_ethtool_ioctl(dev,ifr);
 		case SIOCGMIIPHY: /* Get PHY address */
-			data->phy_id = MDIO_PHYS_ADDR;
+			data->phy_id = mdio_phy_addr;
 			break;
 		case SIOCGMIIREG: /* Read MII register */
 			data->val_out = e100_get_mdio_reg(data->reg_num);
@@ -1278,7 +1423,7 @@
 		case SET_ETH_SPEED_AUTO:              /* Auto negotiate speed */
 			e100_set_speed(0);
 			break;
-		case SET_ETH_DUPLEX_HALF:              /* Hhalf duplex. */
+		case SET_ETH_DUPLEX_HALF:              /* Half duplex. */
 			e100_set_duplex(half);
 			break;
 		case SET_ETH_DUPLEX_FULL:              /* Full duplex. */
@@ -1312,12 +1457,12 @@
 			  SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full;
 			ecmd.port = PORT_TP;
 			ecmd.transceiver = XCVR_EXTERNAL;
-			ecmd.phy_address = MDIO_PHYS_ADDR;
+			ecmd.phy_address = mdio_phy_addr;
 			ecmd.speed = current_speed;
 			ecmd.duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
 			ecmd.advertising = ADVERTISED_TP;
 			if (current_duplex == autoneg && current_speed_selection == 0)
-				ecmd.advertising = ADVERTISED_Autoneg;
+				ecmd.advertising |= ADVERTISED_Autoneg;
 			else {
 				ecmd.advertising |= 
 				  ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
@@ -1355,7 +1500,7 @@
 			struct ethtool_drvinfo info;
 			memset((void *) &info, 0, sizeof (info));
 			strncpy(info.driver, "ETRAX 100LX", sizeof(info.driver) - 1);
-			strncpy(info.version, "$Revision: 1.17 $", sizeof(info.version) - 1);
+			strncpy(info.version, "$Revision: 1.22 $", sizeof(info.version) - 1);
 			strncpy(info.fw_version, "N/A", sizeof(info.fw_version) - 1);
 			strncpy(info.bus_info, "N/A", sizeof(info.bus_info) - 1);
 			info.regdump_len = 0;
@@ -1595,7 +1740,11 @@
 
 	if (!current_speed) {
 		/* Make LED red, link is down */
+#if defined(CONFIG_ETRAX_NETWORK_RED_ON_NO_CONNECTION)
+		LED_NETWORK_SET(LED_RED);
+#else
 		LED_NETWORK_SET(LED_OFF);
+#endif
 	}
 	else if (light_leds) {
 		if (current_speed == 10) {
@@ -1614,5 +1763,27 @@
 {
 	return etrax_ethernet_init();
 }
+
+static int __init
+e100_boot_setup(char* str)
+{
+	struct sockaddr sa = {0};
+	int i;
+
+	/* Parse the colon separated Ethernet station address */
+	for (i = 0; i <  ETH_ALEN; i++) {
+		unsigned int tmp;
+		if (sscanf(str + 3*i, "%2x", &tmp) != 1) {
+			printk(KERN_WARNING "Malformed station address");
+			return 0;
+		}
+		sa.sa_data[i] = (char)tmp;
+	}
+
+	default_mac = sa;
+	return 1;
+}
+
+__setup("etrax100_eth=", e100_boot_setup);
 
 module_init(etrax_init_module);
diff -Nru a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
--- a/arch/cris/arch-v10/drivers/gpio.c	Tue Jun 15 22:20:35 2004
+++ b/arch/cris/arch-v10/drivers/gpio.c	Tue Jun 15 22:20:35 2004
@@ -1,4 +1,4 @@
-/* $Id: gpio.c,v 1.8 2003/07/04 08:27:37 starvik Exp $
+/* $Id: gpio.c,v 1.11 2004/05/14 07:58:03 starvik Exp $
  *
  * Etrax general port I/O device
  *
@@ -9,6 +9,12 @@
  *             Johan Adolfsson  (read/set directions, write, port G)
  *
  * $Log: gpio.c,v $
+ * Revision 1.11  2004/05/14 07:58:03  starvik
+ * Merge of changes from 2.4
+ *
+ * Revision 1.9  2003/09/11 07:29:48  starvik
+ * Merge of Linux 2.6.0-test5
+ *
  * Revision 1.8  2003/07/04 08:27:37  starvik
  * Merge of Linux 2.5.74
  *
@@ -183,6 +189,7 @@
 static struct gpio_private *alarmlist = 0;
 
 static int gpio_some_alarms = 0; /* Set if someone uses alarm */
+static unsigned long gpio_pa_irq_enabled_mask = 0;
 
 /* Port A and B use 8 bit access, but Port G is 32 bit */
 #define NUM_PORTS (GPIO_MINOR_B+1)
@@ -252,13 +259,19 @@
 	unsigned long data;
 	poll_wait(file, &priv->alarm_wq, wait);
 	if (priv->minor == GPIO_MINOR_A) {
+		unsigned long flags;
 		unsigned long tmp;
 		data = *R_PORT_PA_DATA;
 		/* PA has support for high level interrupt -
 		 * lets activate for those low and with highalarm set
 		 */
 		tmp = ~data & priv->highalarm & 0xFF;
-		*R_IRQ_MASK1_SET = (tmp << R_IRQ_MASK1_SET__pa0__BITNR);
+		tmp = (tmp << R_IRQ_MASK1_SET__pa0__BITNR);
+		save_flags(flags); cli();
+		gpio_pa_irq_enabled_mask |= tmp;
+		*R_IRQ_MASK1_SET = tmp;
+		restore_flags(flags);
+
 	} else if (priv->minor == GPIO_MINOR_B)
 		data = *R_PORT_PB_DATA;
 	else if (priv->minor == GPIO_MINOR_G)
@@ -312,12 +325,15 @@
 {
 	unsigned long tmp;
 	/* Find what PA interrupts are active */
-	tmp = (*R_IRQ_READ1 >> R_IRQ_READ1__pa0__BITNR) & 0xFF;
+	tmp = (*R_IRQ_READ1);
+
+	/* Find those that we have enabled */
+	tmp &= gpio_pa_irq_enabled_mask;
+
 	/* Clear them.. */
-	/* NOTE: Maybe we need to be more careful here if some other
-	 * driver uses PA interrupt as well?
-	 */
-	*R_IRQ_MASK1_CLR = (tmp << R_IRQ_MASK1_CLR__pa0__BITNR);
+	*R_IRQ_MASK1_CLR = tmp;
+	gpio_pa_irq_enabled_mask &= ~tmp;
+
 	if (gpio_some_alarms) {
 		return IRQ_RETVAL(etrax_gpio_wake_up_check());
 	}
@@ -386,7 +402,7 @@
 gpio_open(struct inode *inode, struct file *filp)
 {
 	struct gpio_private *priv;
-	int p = iminor(inode);
+	int p = MINOR(inode->i_rdev);
 
 	if (p > GPIO_MINOR_LAST)
 		return -EINVAL;
@@ -479,6 +495,7 @@
 		return ~(*priv->dir_shadow) & 0xFF; /* Only 8 bits */
 	} else if (priv->minor == GPIO_MINOR_G) {
 		/* We must fiddle with R_GEN_CONFIG to change dir */
+		save_flags(flags); cli();
 		if (((arg & dir_g_in_bits) != arg) && 
 		    (arg & changeable_dir_g)) {
 			arg &= changeable_dir_g;
@@ -503,16 +520,17 @@
 				dir_g_in_bits |= (1<<24);
 				dir_g_out_bits &= ~(1<<24);
 			}
-			printk("gpio: SETINPUT on port G set "
-				"genconfig to 0x%08lX "
-				"in_bits: 0x%08lX "
-				"out_bits: 0x%08lX\n", 
-			       (unsigned long)genconfig_shadow, 
-			       dir_g_in_bits, dir_g_out_bits);
+			D(printk(KERN_INFO "gpio: SETINPUT on port G set "
+				 "genconfig to 0x%08lX "
+				 "in_bits: 0x%08lX "
+				 "out_bits: 0x%08lX\n",
+			         (unsigned long)genconfig_shadow,
+			         dir_g_in_bits, dir_g_out_bits));
 			*R_GEN_CONFIG = genconfig_shadow;
 			/* Must be a >120 ns delay before writing this again */
 				
 		}
+		restore_flags(flags);
 		return dir_g_in_bits;
 	}
 	return 0;
@@ -529,6 +547,7 @@
 		return *priv->dir_shadow;
 	} else if (priv->minor == GPIO_MINOR_G) {
 		/* We must fiddle with R_GEN_CONFIG to change dir */			
+		save_flags(flags); cli();
 		if (((arg & dir_g_out_bits) != arg) &&
 		    (arg & changeable_dir_g)) {
 			/* Set bits in genconfig to set to output */
@@ -552,15 +571,16 @@
 				dir_g_out_bits |= (1<<24);
 				dir_g_in_bits &= ~(1<<24);
 			}
-			printk("gpio: SETOUTPUT on port G set "
-				"genconfig to 0x%08lX "
-				"in_bits: 0x%08lX "
-				"out_bits: 0x%08lX\n", 
-			       (unsigned long)genconfig_shadow, 
-			       dir_g_in_bits, dir_g_out_bits);
+			D(printk(KERN_INFO "gpio: SETOUTPUT on port G set "
+				 "genconfig to 0x%08lX "
+				 "in_bits: 0x%08lX "
+				 "out_bits: 0x%08lX\n",
+			         (unsigned long)genconfig_shadow,
+			         dir_g_in_bits, dir_g_out_bits));
 			*R_GEN_CONFIG = genconfig_shadow;
 			/* Must be a >120 ns delay before writing this again */
 		}
+		restore_flags(flags);
 		return dir_g_out_bits & 0x7FFFFFFF;
 	}
 	return 0;
@@ -625,6 +645,20 @@
 		// clear alarm for bits with 1 in arg
 		priv->highalarm &= ~arg;
 		priv->lowalarm  &= ~arg;
+		{
+			/* Must update gpio_some_alarms */
+			struct gpio_private *p = alarmlist;
+			int some_alarms;
+			some_alarms = 0;
+			while (p) {
+				if (p->highalarm | p->lowalarm) {
+					some_alarms = 1;
+					break;
+				}
+				p = p->next;
+			}
+			gpio_some_alarms = some_alarms;
+		}
 		break;
 	case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */
 		/* Read direction 0=input 1=output */
@@ -844,9 +878,9 @@
 	dir_g_in_bits |= (~dir_g_shadow & changeable_dir_g);
 
 
-	printk("GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n",
+	printk(KERN_INFO "GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n",
 	       dir_g_in_bits, dir_g_out_bits, (unsigned long)*R_PORT_G_DATA);
-	printk("GPIO port G: dir: %08lX changeable: %08lX\n", 
+	printk(KERN_INFO "GPIO port G: dir: %08lX changeable: %08lX\n",
 	       dir_g_shadow, changeable_dir_g);
 }
 
@@ -883,7 +917,7 @@
 
 #endif
 	gpio_init_port_g();
-	printk("ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002 Axis Communications AB\n");
+	printk(KERN_INFO "ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002 Axis Communications AB\n");
 	/* We call etrax_gpio_wake_up_check() from timer interrupt and
 	 * from cpu_idle() in kernel/process.c
 	 * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms
@@ -891,11 +925,11 @@
 	 */  
 	if (request_irq(TIMER0_IRQ_NBR, gpio_poll_timer_interrupt,
 			SA_SHIRQ | SA_INTERRUPT,"gpio poll", NULL)) {
-		printk("err: timer0 irq for gpio\n");
+		printk(KERN_CRIT "err: timer0 irq for gpio\n");
 	}
 	if (request_irq(PA_IRQ_NBR, gpio_pa_interrupt,
 			SA_SHIRQ | SA_INTERRUPT,"gpio PA", NULL)) {
-		printk("err: PA irq for gpio\n");
+		printk(KERN_CRIT "err: PA irq for gpio\n");
 	}
 	
 
diff -Nru a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
--- a/arch/cris/arch-v10/drivers/i2c.c	Tue Jun 15 22:20:36 2004
+++ b/arch/cris/arch-v10/drivers/i2c.c	Tue Jun 15 22:20:36 2004
@@ -12,6 +12,12 @@
 *!                                 don't use PB_I2C if DS1302 uses same bits,
 *!                                 use PB.
 *! $Log: i2c.c,v $
+*! Revision 1.7  2004/05/28 09:26:59  starvik
+*! Modified I2C initialization to work in 2.6.
+*!
+*! Revision 1.6  2004/05/14 07:58:03  starvik
+*! Merge of changes from 2.4
+*!
 *! Revision 1.4  2002/12/11 13:13:57  starvik
 *! Added arch/ to v10 specific includes
 *! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
@@ -63,7 +69,7 @@
 *! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
 *!
 *!***************************************************************************/
-/* $Id: i2c.c,v 1.4 2002/12/11 13:13:57 starvik Exp $ */
+/* $Id: i2c.c,v 1.7 2004/05/28 09:26:59 starvik Exp $ */
 
 /****************** INCLUDE FILES SECTION ***********************************/
 
@@ -310,6 +316,12 @@
 	}
 	i2c_clk(I2C_CLOCK_HIGH);
 	i2c_delay(CLOCK_HIGH_TIME);
+
+        /*
+	 * we leave the clock low, getbyte is usually followed
+	 * by sendack/nack, they assume the clock to be low
+	 */
+        i2c_clk(I2C_CLOCK_LOW);
 	return aBitByte;
 }
 
@@ -372,6 +384,13 @@
 	}
 
 	/*
+	 * our clock is high now, make sure data is low
+	 * before we enable our output. If we keep data high
+	 * and enable output, we would generate a stop condition.
+	 */
+	i2c_data(I2C_DATA_LOW);
+
+	/*
 	 * end clock pulse
 	 */
 	i2c_enable();
@@ -428,6 +447,37 @@
 
 /*#---------------------------------------------------------------------------
 *#
+*# FUNCTION NAME: i2c_sendnack
+*#
+*# DESCRIPTION  : Sends NACK on received data
+*#
+*#--------------------------------------------------------------------------*/
+void
+i2c_sendnack(void)
+{
+	/*
+	 * enable output
+	 */
+	i2c_delay(CLOCK_LOW_TIME);
+	i2c_dir_out();
+	/*
+	 * set data high
+	 */
+	i2c_data(I2C_DATA_HIGH);
+	/*
+	 * generate clock pulse
+	 */
+	i2c_delay(CLOCK_HIGH_TIME/6);
+	i2c_clk(I2C_CLOCK_HIGH);
+	i2c_delay(CLOCK_HIGH_TIME);
+	i2c_clk(I2C_CLOCK_LOW);
+	i2c_delay(CLOCK_LOW_TIME);
+
+	i2c_dir_in();
+}
+
+/*#---------------------------------------------------------------------------
+*#
 *# FUNCTION NAME: i2c_writereg
 *#
 *# DESCRIPTION  : Writes a value to an I2C device
@@ -489,7 +539,7 @@
 	} while(error && cntr--);
 
 	i2c_delay(CLOCK_LOW_TIME);
-	
+
 	return -error;
 }
 
@@ -557,7 +607,8 @@
 		 */
 		b = i2c_inbyte();
 		/*
-		 * send Ack
+		 * last received byte needs to be nacked
+		 * instead of acked
 		 */
 		i2c_sendack();
 		/*
@@ -634,11 +685,9 @@
 	.release  = i2c_release,
 };
 
-static int __init
+int __init
 i2c_init(void)
 {
-	int res;
-
 	/* Setup and enable the Port B I2C interface */
 
 #ifndef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
@@ -656,21 +705,28 @@
 			  IO_STATE(R_PORT_PB_DIR, dir0, input)  |
 			  IO_STATE(R_PORT_PB_DIR, dir1, output));
 
-	/* register char device */
+	return 0;
+}
+
+static int __init
+i2c_register(void)
+{
+	int res;
 
-	res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
+	i2c_init();
+  	res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
 	if(res < 0) {
 		printk(KERN_ERR "i2c: couldn't get a major number.\n");
 		return res;
 	}
 
-	printk("I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n");
+	printk(KERN_INFO "I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n");
 	
 	return 0;
 }
 
-/* this makes sure that i2c_init is called during boot */
+/* this makes sure that i2c_register is called during boot */
 
-module_init(i2c_init);
+module_init(i2c_register);
 
 /****************** END OF FILE i2c.c ********************************/
diff -Nru a/arch/cris/arch-v10/drivers/i2c.h b/arch/cris/arch-v10/drivers/i2c.h
--- a/arch/cris/arch-v10/drivers/i2c.h	Tue Jun 15 22:20:44 2004
+++ b/arch/cris/arch-v10/drivers/i2c.h	Tue Jun 15 22:20:44 2004
@@ -1,4 +1,6 @@
-/* $Id: i2c.h,v 1.2 2002/11/18 13:16:06 starvik Exp $ */
+/* $Id: i2c.h,v 1.3 2004/05/28 09:26:59 starvik Exp $ */
+
+int i2c_init(void);
 
 /* High level I2C actions */
 int i2c_writereg(unsigned char theSlave, unsigned char theReg, unsigned char theValue);
diff -Nru a/arch/cris/arch-v10/drivers/ide.c b/arch/cris/arch-v10/drivers/ide.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/cris/arch-v10/drivers/ide.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,945 @@
+/* $Id: ide.c,v 1.1 2004/01/22 08:22:58 starvik Exp $
+ *
+ * Etrax specific IDE functions, like init and PIO-mode setting etc.
+ * Almost the entire ide.c is used for the rest of the Etrax ATA driver.
+ * Copyright (c) 2000-2004 Axis Communications AB
+ *
+ * Authors:    Bjorn Wesen        (initial version)
+ *             Mikael Starvik     (pio setup stuff, Linux 2.6 port)
+ */
+
+/* Regarding DMA:
+ *
+ * There are two forms of DMA - "DMA handshaking" between the interface and the drive,
+ * and DMA between the memory and the interface. We can ALWAYS use the latter, since it's
+ * something built-in in the Etrax. However only some drives support the DMA-mode handshaking
+ * on the ATA-bus. The normal PC driver and Triton interface disables memory-if DMA when the
+ * device can't do DMA handshaking for some stupid reason. We don't need to do that.
+ */
+
+#undef REALLY_SLOW_IO           /* most systems can safely undef this */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/blkdev.h>
+#include <linux/hdreg.h>
+#include <linux/ide.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/arch/svinto.h>
+#include <asm/dma.h>
+
+/* number of Etrax DMA descriptors */
+#define MAX_DMA_DESCRS 64
+
+/* number of times to retry busy-flags when reading/writing IDE-registers
+ * this can't be too high because a hung harddisk might cause the watchdog
+ * to trigger (sometimes INB and OUTB are called with irq's disabled)
+ */
+
+#define IDE_REGISTER_TIMEOUT 300
+
+#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
+/* address where the memory-mapped IDE reset bit lives, if used */
+static volatile unsigned long *reset_addr;
+#endif
+
+static int e100_read_command = 0;
+
+#define LOWDB(x)
+#define D(x)
+
+void
+etrax100_ide_outw(unsigned short data, ide_ioreg_t reg) {
+	int timeleft;
+	LOWDB(printk("ow: data 0x%x, reg 0x%x\n", data, reg));
+
+	/* note the lack of handling any timeouts. we stop waiting, but we don't
+	 * really notify anybody.
+	 */
+
+	timeleft = IDE_REGISTER_TIMEOUT;
+	/* wait for busy flag */
+	while(timeleft && (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)))
+		timeleft--;
+
+	/*
+	 * Fall through at a timeout, so the ongoing command will be
+	 * aborted by the write below, which is expected to be a dummy
+	 * command to the command register.  This happens when a faulty
+	 * drive times out on a command.  See comment on timeout in
+	 * INB.
+	 */
+	if(!timeleft)
+		printk("ATA timeout reg 0x%lx := 0x%x\n", reg, data);
+
+	*R_ATA_CTRL_DATA = reg | data; /* write data to the drive's register */
+
+	timeleft = IDE_REGISTER_TIMEOUT;
+	/* wait for transmitter ready */
+	while(timeleft && !(*R_ATA_STATUS_DATA &
+			    IO_MASK(R_ATA_STATUS_DATA, tr_rdy)))
+		timeleft--;
+}
+
+void
+etrax100_ide_outb(unsigned char data, ide_ioreg_t reg)
+{
+	etrax100_ide_outw(data, reg);
+}
+
+void
+etrax100_ide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port)
+{
+	etrax100_ide_outw(addr, port);
+}
+
+unsigned short
+etrax100_ide_inw(ide_ioreg_t reg) {
+	int status;
+	int timeleft;
+
+	timeleft = IDE_REGISTER_TIMEOUT;
+	/* wait for busy flag */
+	while(timeleft && (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)))
+		timeleft--;
+
+	if(!timeleft) {
+		/*
+		 * If we're asked to read the status register, like for
+		 * example when a command does not complete for an
+		 * extended time, but the ATA interface is stuck in a
+		 * busy state at the *ETRAX* ATA interface level (as has
+		 * happened repeatedly with at least one bad disk), then
+		 * the best thing to do is to pretend that we read
+		 * "busy" in the status register, so the IDE driver will
+		 * time-out, abort the ongoing command and perform a
+		 * reset sequence.  Note that the subsequent OUT_BYTE
+		 * call will also timeout on busy, but as long as the
+		 * write is still performed, everything will be fine.
+		 */
+		if ((reg & IO_MASK (R_ATA_CTRL_DATA, addr))
+		    == IO_FIELD (R_ATA_CTRL_DATA, addr, IDE_STATUS_OFFSET))
+			return BUSY_STAT;
+		else
+			/* For other rare cases we assume 0 is good enough.  */
+			return 0;
+	}
+
+	*R_ATA_CTRL_DATA = reg | IO_STATE(R_ATA_CTRL_DATA, rw, read); /* read data */
+
+	timeleft = IDE_REGISTER_TIMEOUT;
+	/* wait for available */
+	while(timeleft && !((status = *R_ATA_STATUS_DATA) &
+			    IO_MASK(R_ATA_STATUS_DATA, dav)))
+		timeleft--;
+
+	if(!timeleft)
+		return 0;
+
+	LOWDB(printk("inb: 0x%x from reg 0x%x\n", status & 0xff, reg));
+
+        return (unsigned short)status;
+}
+
+unsigned char
+etrax100_ide_inb(ide_ioreg_t reg)
+{
+	return (unsigned char)etrax100_ide_inw(reg);
+}
+
+/* PIO timing (in R_ATA_CONFIG)
+ *
+ *                        _____________________________
+ * ADDRESS :     ________/
+ *
+ *                            _______________
+ * DIOR    :     ____________/               \__________
+ *
+ *                               _______________
+ * DATA    :     XXXXXXXXXXXXXXXX_______________XXXXXXXX
+ *
+ *
+ * DIOR is unbuffered while address and data is buffered.
+ * This creates two problems:
+ * 1. The DIOR pulse is to early (because it is unbuffered)
+ * 2. The rise time of DIOR is long
+ *
+ * There are at least three different plausible solutions
+ * 1. Use a pad capable of larger currents in Etrax
+ * 2. Use an external buffer
+ * 3. Make the strobe pulse longer
+ *
+ * Some of the strobe timings below are modified to compensate
+ * for this. This implies a slight performance decrease.
+ *
+ * THIS SHOULD NEVER BE CHANGED!
+ *
+ * TODO: Is this true for the latest LX boards still ?
+ */
+
+#define ATA_DMA2_STROBE  4
+#define ATA_DMA2_HOLD    0
+#define ATA_DMA1_STROBE  4
+#define ATA_DMA1_HOLD    1
+#define ATA_DMA0_STROBE 12
+#define ATA_DMA0_HOLD    9
+#define ATA_PIO4_SETUP   1
+#define ATA_PIO4_STROBE  5
+#define ATA_PIO4_HOLD    0
+#define ATA_PIO3_SETUP   1
+#define ATA_PIO3_STROBE  5
+#define ATA_PIO3_HOLD    1
+#define ATA_PIO2_SETUP   1
+#define ATA_PIO2_STROBE  6
+#define ATA_PIO2_HOLD    2
+#define ATA_PIO1_SETUP   2
+#define ATA_PIO1_STROBE 11
+#define ATA_PIO1_HOLD    4
+#define ATA_PIO0_SETUP   4
+#define ATA_PIO0_STROBE 19
+#define ATA_PIO0_HOLD    4
+
+static int e100_dma_check (ide_drive_t *drive);
+static int e100_dma_begin (ide_drive_t *drive);
+static int e100_dma_end (ide_drive_t *drive);
+static int e100_dma_read (ide_drive_t *drive);
+static int e100_dma_write (ide_drive_t *drive);
+static void e100_ide_input_data (ide_drive_t *drive, void *, unsigned int);
+static void e100_ide_output_data (ide_drive_t *drive, void *, unsigned int);
+static void e100_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
+static void e100_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
+static int e100_dma_off (ide_drive_t *drive);
+static int e100_dma_verbose (ide_drive_t *drive);
+
+
+/*
+ * good_dma_drives() lists the model names (from "hdparm -i")
+ * of drives which do not support mword2 DMA but which are
+ * known to work fine with this interface under Linux.
+ */
+
+const char *good_dma_drives[] = {"Micropolis 2112A",
+				 "CONNER CTMA 4000",
+				 "CONNER CTT8000-A",
+				 NULL};
+
+static void tune_e100_ide(ide_drive_t *drive, byte pio)
+{
+	pio = 4;
+	/* pio = ide_get_best_pio_mode(drive, pio, 4, NULL); */
+
+	/* set pio mode! */
+
+	switch(pio) {
+		case 0:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO0_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO0_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO0_HOLD ) );
+			break;
+		case 1:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO1_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO1_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO1_HOLD ) );
+			break;
+		case 2:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO2_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO2_HOLD ) );
+			break;
+		case 3:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO3_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO3_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO3_HOLD ) );
+			break;
+		case 4:
+			*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO4_SETUP ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO4_STROBE ) |
+					  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO4_HOLD ) );
+			break;
+	}
+}
+
+void __init
+init_e100_ide (void)
+{
+	volatile unsigned int dummy;
+	int h;
+
+	printk("ide: ETRAX 100LX built-in ATA DMA controller\n");
+
+	/* first fill in some stuff in the ide_hwifs fields */
+
+	for(h = 0; h < MAX_HWIFS; h++) {
+		ide_hwif_t *hwif = &ide_hwifs[h];
+		hwif->mmio = 2;
+		hwif->chipset = ide_etrax100;
+		hwif->tuneproc = &tune_e100_ide;
+                hwif->ata_input_data = &e100_ide_input_data;
+                hwif->ata_output_data = &e100_ide_output_data;
+                hwif->atapi_input_bytes = &e100_atapi_input_bytes;
+                hwif->atapi_output_bytes = &e100_atapi_output_bytes;
+                hwif->ide_dma_check = &e100_dma_check;
+                hwif->ide_dma_end = &e100_dma_end;
+		hwif->ide_dma_write = &e100_dma_write;
+		hwif->ide_dma_read = &e100_dma_read;
+		hwif->ide_dma_begin = &e100_dma_begin;
+		hwif->OUTB = &etrax100_ide_outb;
+		hwif->OUTW = &etrax100_ide_outw;
+		hwif->OUTBSYNC = &etrax100_ide_outbsync;
+		hwif->INB = &etrax100_ide_inb;
+		hwif->INW = &etrax100_ide_inw;
+		hwif->ide_dma_off_quietly = &e100_dma_off;
+		hwif->ide_dma_verbose = &e100_dma_verbose;
+		hwif->sg_table =
+		  kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES, GFP_KERNEL);
+	}
+
+	/* actually reset and configure the etrax100 ide/ata interface */
+
+	*R_ATA_CTRL_DATA = 0;
+	*R_ATA_TRANSFER_CNT = 0;
+	*R_ATA_CONFIG = 0;
+
+	genconfig_shadow = (genconfig_shadow &
+			    ~IO_MASK(R_GEN_CONFIG, dma2) &
+			    ~IO_MASK(R_GEN_CONFIG, dma3) &
+			    ~IO_MASK(R_GEN_CONFIG, ata)) |
+		( IO_STATE( R_GEN_CONFIG, dma3, ata    ) |
+		  IO_STATE( R_GEN_CONFIG, dma2, ata    ) |
+		  IO_STATE( R_GEN_CONFIG, ata,  select ) );
+
+	*R_GEN_CONFIG = genconfig_shadow;
+
+        /* pull the chosen /reset-line low */
+
+#ifdef CONFIG_ETRAX_IDE_G27_RESET
+        REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, 0);
+#endif
+#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
+        REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, 0);
+#endif
+#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET
+        REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, 0);
+#endif
+#ifdef CONFIG_ETRAX_IDE_PB7_RESET
+	port_pb_dir_shadow = port_pb_dir_shadow |
+		IO_STATE(R_PORT_PB_DIR, dir7, output);
+	*R_PORT_PB_DIR = port_pb_dir_shadow;
+	REG_SHADOW_SET(R_PORT_PB_DATA, port_pb_data_shadow, 7, 1);
+#endif
+
+	/* wait some */
+
+	udelay(25);
+
+	/* de-assert bus-reset */
+
+#ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET
+	REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, 1);
+#endif
+#ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET
+	REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, 1);
+#endif
+#ifdef CONFIG_ETRAX_IDE_G27_RESET
+	REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, 1);
+#endif
+
+	/* make a dummy read to set the ata controller in a proper state */
+	dummy = *R_ATA_STATUS_DATA;
+
+	*R_ATA_CONFIG = ( IO_FIELD( R_ATA_CONFIG, enable,     1 ) |
+			  IO_FIELD( R_ATA_CONFIG, dma_strobe, ATA_DMA2_STROBE ) |
+			  IO_FIELD( R_ATA_CONFIG, dma_hold,   ATA_DMA2_HOLD ) |
+			  IO_FIELD( R_ATA_CONFIG, pio_setup,  ATA_PIO4_SETUP ) |
+			  IO_FIELD( R_ATA_CONFIG, pio_strobe, ATA_PIO4_STROBE ) |
+			  IO_FIELD( R_ATA_CONFIG, pio_hold,   ATA_PIO4_HOLD ) );
+
+	*R_ATA_CTRL_DATA = ( IO_STATE( R_ATA_CTRL_DATA, rw,   read) |
+			     IO_FIELD( R_ATA_CTRL_DATA, addr, 1   ) );
+
+	while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); /* wait for busy flag*/
+
+	*R_IRQ_MASK0_SET = ( IO_STATE( R_IRQ_MASK0_SET, ata_irq0, set ) |
+			     IO_STATE( R_IRQ_MASK0_SET, ata_irq1, set ) |
+			     IO_STATE( R_IRQ_MASK0_SET, ata_irq2, set ) |
+			     IO_STATE( R_IRQ_MASK0_SET, ata_irq3, set ) );
+
+	printk("ide: waiting %d seconds for drives to regain consciousness\n",
+	       CONFIG_ETRAX_IDE_DELAY);
+
+	h = jiffies + (CONFIG_ETRAX_IDE_DELAY * HZ);
+	while(time_before(jiffies, h)) /* nothing */ ;
+
+	/* reset the dma channels we will use */
+
+	RESET_DMA(ATA_TX_DMA_NBR);
+	RESET_DMA(ATA_RX_DMA_NBR);
+	WAIT_DMA(ATA_TX_DMA_NBR);
+	WAIT_DMA(ATA_RX_DMA_NBR);
+
+}
+
+static int e100_dma_off (ide_drive_t *drive)
+{
+	return 0;
+}
+
+static int e100_dma_verbose (ide_drive_t *drive)
+{
+	printk(", DMA(mode 2)");
+	return 0;
+}
+
+static etrax_dma_descr mydescr;
+
+/*
+ * The following routines are mainly used by the ATAPI drivers.
+ *
+ * These routines will round up any request for an odd number of bytes,
+ * so if an odd bytecount is specified, be sure that there's at least one
+ * extra byte allocated for the buffer.
+ */
+static void
+e100_atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
+{
+	ide_ioreg_t data_reg = IDE_DATA_REG;
+
+	D(printk("atapi_input_bytes, dreg 0x%x, buffer 0x%x, count %d\n",
+		 data_reg, buffer, bytecount));
+
+	if(bytecount & 1) {
+		printk("warning, odd bytecount in cdrom_in_bytes = %d.\n", bytecount);
+		bytecount++; /* to round off */
+	}
+
+	/* make sure the DMA channel is available */
+	RESET_DMA(ATA_RX_DMA_NBR);
+	WAIT_DMA(ATA_RX_DMA_NBR);
+
+	/* setup DMA descriptor */
+
+	mydescr.sw_len = bytecount;
+	mydescr.ctrl   = d_eol;
+	mydescr.buf    = virt_to_phys(buffer);
+
+	/* start the dma channel */
+
+	*R_DMA_CH3_FIRST = virt_to_phys(&mydescr);
+	*R_DMA_CH3_CMD   = IO_STATE(R_DMA_CH3_CMD, cmd, start);
+
+	/* initiate a multi word dma read using PIO handshaking */
+
+	*R_ATA_TRANSFER_CNT = IO_FIELD(R_ATA_TRANSFER_CNT, count, bytecount >> 1);
+
+	*R_ATA_CTRL_DATA = data_reg |
+		IO_STATE(R_ATA_CTRL_DATA, rw,       read) |
+		IO_STATE(R_ATA_CTRL_DATA, src_dst,  dma) |
+		IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+		IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+		IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+	/* wait for completion */
+
+	LED_DISK_READ(1);
+	WAIT_DMA(ATA_RX_DMA_NBR);
+	LED_DISK_READ(0);
+
+#if 0
+        /* old polled transfer code
+	 * this should be moved into a new function that can do polled
+	 * transfers if DMA is not available
+	 */
+
+        /* initiate a multi word read */
+
+        *R_ATA_TRANSFER_CNT = wcount << 1;
+
+        *R_ATA_CTRL_DATA = data_reg |
+                IO_STATE(R_ATA_CTRL_DATA, rw,       read) |
+                IO_STATE(R_ATA_CTRL_DATA, src_dst,  register) |
+                IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+                IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+                IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+        /* svinto has a latency until the busy bit actually is set */
+
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+
+        /* unit should be busy during multi transfer */
+        while((status = *R_ATA_STATUS_DATA) & IO_MASK(R_ATA_STATUS_DATA, busy)) {
+                while(!(status & IO_MASK(R_ATA_STATUS_DATA, dav)))
+                        status = *R_ATA_STATUS_DATA;
+                *ptr++ = (unsigned short)(status & 0xffff);
+        }
+#endif
+}
+
+static void
+e100_atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount)
+{
+	ide_ioreg_t data_reg = IDE_DATA_REG;
+
+	D(printk("atapi_output_bytes, dreg 0x%x, buffer 0x%x, count %d\n",
+		 data_reg, buffer, bytecount));
+
+	if(bytecount & 1) {
+		printk("odd bytecount %d in atapi_out_bytes!\n", bytecount);
+		bytecount++;
+	}
+
+	/* make sure the DMA channel is available */
+	RESET_DMA(ATA_TX_DMA_NBR);
+	WAIT_DMA(ATA_TX_DMA_NBR);
+
+	/* setup DMA descriptor */
+
+	mydescr.sw_len = bytecount;
+	mydescr.ctrl   = d_eol;
+	mydescr.buf    = virt_to_phys(buffer);
+
+	/* start the dma channel */
+
+	*R_DMA_CH2_FIRST = virt_to_phys(&mydescr);
+	*R_DMA_CH2_CMD   = IO_STATE(R_DMA_CH2_CMD, cmd, start);
+
+	/* initiate a multi word dma write using PIO handshaking */
+
+	*R_ATA_TRANSFER_CNT = IO_FIELD(R_ATA_TRANSFER_CNT, count, bytecount >> 1);
+
+	*R_ATA_CTRL_DATA = data_reg |
+		IO_STATE(R_ATA_CTRL_DATA, rw,       write) |
+		IO_STATE(R_ATA_CTRL_DATA, src_dst,  dma) |
+		IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+		IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+		IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+	/* wait for completion */
+
+	LED_DISK_WRITE(1);
+	WAIT_DMA(ATA_TX_DMA_NBR);
+	LED_DISK_WRITE(0);
+
+#if 0
+        /* old polled write code - see comment in input_bytes */
+
+	/* wait for busy flag */
+        while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy));
+
+        /* initiate a multi word write */
+
+        *R_ATA_TRANSFER_CNT = bytecount >> 1;
+
+        ctrl = data_reg |
+                IO_STATE(R_ATA_CTRL_DATA, rw,       write) |
+                IO_STATE(R_ATA_CTRL_DATA, src_dst,  register) |
+                IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+                IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+                IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+        LED_DISK_WRITE(1);
+
+        /* Etrax will set busy = 1 until the multi pio transfer has finished
+         * and tr_rdy = 1 after each successful word transfer.
+         * When the last byte has been transferred Etrax will first set tr_tdy = 1
+         * and then busy = 0 (not in the same cycle). If we read busy before it
+         * has been set to 0 we will think that we should transfer more bytes
+         * and then tr_rdy would be 0 forever. This is solved by checking busy
+         * in the inner loop.
+         */
+
+        do {
+                *R_ATA_CTRL_DATA = ctrl | *ptr++;
+                while(!(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, tr_rdy)) &&
+                      (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)));
+        } while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy));
+
+        LED_DISK_WRITE(0);
+#endif
+
+}
+
+/*
+ * This is used for most PIO data transfers *from* the IDE interface
+ */
+static void
+e100_ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+{
+	e100_atapi_input_bytes(drive, buffer, wcount << 2);
+}
+
+/*
+ * This is used for most PIO data transfers *to* the IDE interface
+ */
+static void
+e100_ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+{
+	e100_atapi_output_bytes(drive, buffer, wcount << 2);
+}
+
+/* we only have one DMA channel on the chip for ATA, so we can keep these statically */
+static etrax_dma_descr ata_descrs[MAX_DMA_DESCRS];
+static unsigned int ata_tot_size;
+
+/*
+ * e100_ide_build_dmatable() prepares a dma request.
+ * Returns 0 if all went okay, returns 1 otherwise.
+ */
+static int e100_ide_build_dmatable (ide_drive_t *drive)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	struct scatterlist* sg;
+	struct request *rq  = HWGROUP(drive)->rq;
+	unsigned long size, addr;
+	unsigned int count = 0;
+	int i = 0;
+
+	sg = hwif->sg_table;
+
+	ata_tot_size = 0;
+
+	if (HWGROUP(drive)->rq->flags & REQ_DRIVE_TASKFILE) {
+		u8 *virt_addr = rq->buffer;
+		int sector_count = rq->nr_sectors;
+		memset(&sg[0], 0, sizeof(*sg));
+		sg[0].page = virt_to_page(virt_addr);
+		sg[0].offset = offset_in_page(virt_addr);
+		sg[0].length =  sector_count  * SECTOR_SIZE;
+		hwif->sg_nents = i = 1;
+	}
+	else
+	{
+		hwif->sg_nents = i = blk_rq_map_sg(drive->queue, rq, hwif->sg_table);
+	}
+
+
+	while(i) {
+		/*
+		 * Determine addr and size of next buffer area.  We assume that
+		 * individual virtual buffers are always composed linearly in
+		 * physical memory.  For example, we assume that any 8kB buffer
+		 * is always composed of two adjacent physical 4kB pages rather
+		 * than two possibly non-adjacent physical 4kB pages.
+		 */
+		/* group sequential buffers into one large buffer */
+		addr = page_to_phys(sg->page) + sg->offset;
+		size = sg_dma_len(sg);
+		while (sg++, --i) {
+			if ((addr + size) != page_to_phys(sg->page) + sg->offset)
+				break;
+			size += sg_dma_len(sg);
+		}
+
+		/* did we run out of descriptors? */
+
+		if(count >= MAX_DMA_DESCRS) {
+			printk("%s: too few DMA descriptors\n", drive->name);
+			return 1;
+		}
+
+		/* however, this case is more difficult - R_ATA_TRANSFER_CNT cannot be more
+		   than 65536 words per transfer, so in that case we need to either
+		   1) use a DMA interrupt to re-trigger R_ATA_TRANSFER_CNT and continue with
+		      the descriptors, or
+		   2) simply do the request here, and get dma_intr to only ide_end_request on
+		      those blocks that were actually set-up for transfer.
+		*/
+
+		if(ata_tot_size + size > 131072) {
+			printk("too large total ATA DMA request, %d + %d!\n", ata_tot_size, (int)size);
+			return 1;
+		}
+
+		/* If size > 65536 it has to be splitted into new descriptors. Since we don't handle
+                   size > 131072 only one split is necessary */
+
+		if(size > 65536) {
+ 		        /* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
+                        ata_descrs[count].sw_len = 0;  /* 0 means 65536, this is a 16-bit field */
+                        ata_descrs[count].ctrl = 0;
+                        ata_descrs[count].buf = addr;
+                        ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]);
+                        count++;
+                        ata_tot_size += 65536;
+                        /* size and addr should refere to not handled data */
+                        size -= 65536;
+                        addr += 65536;
+                }
+		/* ok we want to do IO at addr, size bytes. set up a new descriptor entry */
+                if(size == 65536) {
+			ata_descrs[count].sw_len = 0;  /* 0 means 65536, this is a 16-bit field */
+                } else {
+			ata_descrs[count].sw_len = size;
+                }
+		ata_descrs[count].ctrl = 0;
+		ata_descrs[count].buf = addr;
+		ata_descrs[count].next = virt_to_phys(&ata_descrs[count + 1]);
+		count++;
+		ata_tot_size += size;
+	}
+
+	if (count) {
+		/* set the end-of-list flag on the last descriptor */
+		ata_descrs[count - 1].ctrl |= d_eol;
+		/* return and say all is ok */
+		return 0;
+	}
+
+	printk("%s: empty DMA table?\n", drive->name);
+	return 1;	/* let the PIO routines handle this weirdness */
+}
+
+static int config_drive_for_dma (ide_drive_t *drive)
+{
+        const char **list;
+        struct hd_driveid *id = drive->id;
+
+        if (id && (id->capability & 1)) {
+                /* Enable DMA on any drive that supports mword2 DMA */
+                if ((id->field_valid & 2) && (id->dma_mword & 0x404) == 0x404) {
+                        drive->using_dma = 1;
+                        return 0;               /* DMA enabled */
+                }
+
+                /* Consult the list of known "good" drives */
+                list = good_dma_drives;
+                while (*list) {
+                        if (!strcmp(*list++,id->model)) {
+                                drive->using_dma = 1;
+                                return 0;       /* DMA enabled */
+                        }
+                }
+        }
+        return 1;       /* DMA not enabled */
+}
+
+/*
+ * etrax_dma_intr() is the handler for disk read/write DMA interrupts
+ */
+static ide_startstop_t etrax_dma_intr (ide_drive_t *drive)
+{
+	int i, dma_stat;
+	byte stat;
+
+	LED_DISK_READ(0);
+	LED_DISK_WRITE(0);
+
+	dma_stat = HWIF(drive)->ide_dma_end(drive);
+	stat = HWIF(drive)->INB(IDE_STATUS_REG);		/* get drive status */
+	if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
+		if (!dma_stat) {
+			struct request *rq;
+			rq = HWGROUP(drive)->rq;
+			for (i = rq->nr_sectors; i > 0;) {
+				i -= rq->current_nr_sectors;
+				DRIVER(drive)->end_request(drive, 1, rq->nr_sectors);
+			}
+			return ide_stopped;
+		}
+		printk("%s: bad DMA status\n", drive->name);
+	}
+	return DRIVER(drive)->error(drive, "dma_intr", stat);
+}
+
+/*
+ * Functions below initiates/aborts DMA read/write operations on a drive.
+ *
+ * The caller is assumed to have selected the drive and programmed the drive's
+ * sector address using CHS or LBA.  All that remains is to prepare for DMA
+ * and then issue the actual read/write DMA/PIO command to the drive.
+ *
+ * For ATAPI devices, we just prepare for DMA and return. The caller should
+ * then issue the packet command to the drive and call us again with
+ * ide_dma_begin afterwards.
+ *
+ * Returns 0 if all went well.
+ * Returns 1 if DMA read/write could not be started, in which case
+ * the caller should revert to PIO for the current request.
+ */
+
+static int e100_dma_check(ide_drive_t *drive)
+{
+	return config_drive_for_dma (drive);
+}
+
+static int e100_dma_end(ide_drive_t *drive)
+{
+	/* TODO: check if something went wrong with the DMA */
+	return 0;
+}
+
+static int e100_start_dma(ide_drive_t *drive, int atapi, int reading)
+{
+	if(reading) {
+
+		RESET_DMA(ATA_RX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
+		WAIT_DMA(ATA_RX_DMA_NBR);
+
+		/* set up the Etrax DMA descriptors */
+
+		if(e100_ide_build_dmatable (drive))
+			return 1;
+
+		if(!atapi) {
+			/* set the irq handler which will finish the request when DMA is done */
+
+			ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
+
+			/* issue cmd to drive */
+                        if ((HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASKFILE) &&
+			    (drive->addressing == 1)) {
+				ide_task_t *args = HWGROUP(drive)->rq->special;
+				etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
+			} else if (drive->addressing) {
+				etrax100_ide_outb(WIN_READDMA_EXT, IDE_COMMAND_REG);
+			} else {
+				etrax100_ide_outb(WIN_READDMA, IDE_COMMAND_REG);
+			}
+		}
+
+		/* begin DMA */
+
+		/* need to do this before RX DMA due to a chip bug
+		 * it is enough to just flush the part of the cache that
+		 * corresponds to the buffers we start, but since HD transfers
+		 * usually are more than 8 kB, it is easier to optimize for the
+		 * normal case and just flush the entire cache. its the only
+		 * way to be sure! (OB movie quote)
+		 */
+		flush_etrax_cache();
+		*R_DMA_CH3_FIRST = virt_to_phys(ata_descrs);
+		*R_DMA_CH3_CMD   = IO_STATE(R_DMA_CH3_CMD, cmd, start);
+
+		/* initiate a multi word dma read using DMA handshaking */
+
+		*R_ATA_TRANSFER_CNT =
+			IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1);
+
+		*R_ATA_CTRL_DATA =
+			IO_FIELD(R_ATA_CTRL_DATA, data, IDE_DATA_REG) |
+			IO_STATE(R_ATA_CTRL_DATA, rw,       read) |
+			IO_STATE(R_ATA_CTRL_DATA, src_dst,  dma)  |
+			IO_STATE(R_ATA_CTRL_DATA, handsh,   dma)  |
+			IO_STATE(R_ATA_CTRL_DATA, multi,    on)   |
+			IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+		LED_DISK_READ(1);
+
+		D(printk("dma read of %d bytes.\n", ata_tot_size));
+
+	} else {
+		/* writing */
+
+		RESET_DMA(ATA_TX_DMA_NBR); /* sometimes the DMA channel get stuck so we need to do this */
+		WAIT_DMA(ATA_TX_DMA_NBR);
+
+		/* set up the Etrax DMA descriptors */
+
+		if(e100_ide_build_dmatable (drive))
+			return 1;
+
+		if(!atapi) {
+			/* set the irq handler which will finish the request when DMA is done */
+
+			ide_set_handler(drive, &etrax_dma_intr, WAIT_CMD, NULL);
+
+			/* issue cmd to drive */
+			if ((HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASKFILE) &&
+			    (drive->addressing == 1)) {
+				ide_task_t *args = HWGROUP(drive)->rq->special;
+				etrax100_ide_outb(args->tfRegister[IDE_COMMAND_OFFSET], IDE_COMMAND_REG);
+			} else if (drive->addressing) {
+				etrax100_ide_outb(WIN_WRITEDMA_EXT, IDE_COMMAND_REG);
+			} else {
+				etrax100_ide_outb(WIN_WRITEDMA, IDE_COMMAND_REG);
+			}
+		}
+
+		/* begin DMA */
+
+		*R_DMA_CH2_FIRST = virt_to_phys(ata_descrs);
+		*R_DMA_CH2_CMD   = IO_STATE(R_DMA_CH2_CMD, cmd, start);
+
+		/* initiate a multi word dma write using DMA handshaking */
+
+		*R_ATA_TRANSFER_CNT =
+			IO_FIELD(R_ATA_TRANSFER_CNT, count, ata_tot_size >> 1);
+
+		*R_ATA_CTRL_DATA =
+			IO_FIELD(R_ATA_CTRL_DATA, data,     IDE_DATA_REG) |
+			IO_STATE(R_ATA_CTRL_DATA, rw,       write) |
+			IO_STATE(R_ATA_CTRL_DATA, src_dst,  dma) |
+			IO_STATE(R_ATA_CTRL_DATA, handsh,   dma) |
+			IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+			IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+
+		LED_DISK_WRITE(1);
+
+		D(printk("dma write of %d bytes.\n", ata_tot_size));
+	}
+	return 0;
+}
+
+static int e100_dma_write(ide_drive_t *drive)
+{
+	e100_read_command = 0;
+	/* ATAPI-devices (not disks) first call ide_dma_read/write to set the direction
+	 * then they call ide_dma_begin after they have issued the appropriate drive command
+	 * themselves to actually start the chipset DMA. so we just return here if we're
+	 * not a diskdrive.
+	 */
+	if (drive->media != ide_disk)
+                return 0;
+	return e100_start_dma(drive, 0, 0);
+}
+
+static int e100_dma_read(ide_drive_t *drive)
+{
+	e100_read_command = 1;
+	/* ATAPI-devices (not disks) first call ide_dma_read/write to set the direction
+	 * then they call ide_dma_begin after they have issued the appropriate drive command
+	 * themselves to actually start the chipset DMA. so we just return here if we're
+	 * not a diskdrive.
+	 */
+	if (drive->media != ide_disk)
+                return 0;
+	return e100_start_dma(drive, 0, 1);
+}
+
+static int e100_dma_begin(ide_drive_t *drive)
+{
+	/* begin DMA, used by ATAPI devices which want to issue the
+	 * appropriate IDE command themselves.
+	 *
+	 * they have already called ide_dma_read/write to set the
+	 * static reading flag, now they call ide_dma_begin to do
+	 * the real stuff. we tell our code below not to issue
+	 * any IDE commands itself and jump into it.
+	 */
+	 return e100_start_dma(drive, 1, e100_read_command);
+}
diff -Nru a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
--- a/arch/cris/arch-v10/drivers/pcf8563.c	Tue Jun 15 22:20:38 2004
+++ b/arch/cris/arch-v10/drivers/pcf8563.c	Tue Jun 15 22:20:38 2004
@@ -15,7 +15,7 @@
  *
  * Author: Tobias Anderberg <tobiasa@axis.com>.
  *
- * $Id: pcf8563.c,v 1.1 2002/12/12 08:27:26 starvik Exp $
+ * $Id: pcf8563.c,v 1.4 2004/05/28 09:26:59 starvik Exp $
  */
 
 #include <linux/config.h>
@@ -28,6 +28,7 @@
 #include <linux/fs.h>
 #include <linux/ioctl.h>
 #include <linux/delay.h>
+#include <linux/bcd.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -39,7 +40,7 @@
 #define PCF8563_MAJOR 121		/* Local major number. */
 #define DEVICE_NAME "rtc"		/* Name which is registered in /proc/devices. */
 #define PCF8563_NAME "PCF8563"
-#define DRIVER_VERSION "$Revision: 1.1 $"
+#define DRIVER_VERSION "$Revision: 1.4 $"
 
 /* I2C bus slave registers. */
 #define RTC_I2C_READ		0xa3
@@ -53,14 +54,10 @@
 	{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
 
 int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
-int pcf8563_open(struct inode *, struct file *);
-int pcf8563_release(struct inode *, struct file *);
 
 static struct file_operations pcf8563_fops = {
 	.owner = THIS_MODULE,
 	.ioctl = pcf8563_ioctl,
-	.open = pcf8563_open,
-	.release = pcf8563_release,
 };
 
 unsigned char
@@ -89,7 +86,12 @@
 void
 pcf8563_writereg(int reg, unsigned char val) 
 {
-	i2c_writereg(RTC_I2C_WRITE,reg,val);
+#ifdef CONFIG_ETRAX_RTC_READONLY
+	if (reg == RTC_CONTROL1 || (reg >= RTC_SECONDS && reg <= RTC_YEAR))
+		return;
+#endif
+
+	rtc_write(reg, val);
 }
 
 void
@@ -124,6 +126,9 @@
 pcf8563_init(void)
 {
 	unsigned char ret;
+
+	i2c_init();
+
 	/*
 	 * First of all we need to reset the chip. This is done by
 	 * clearing control1, control2 and clk freq, clear the 
@@ -156,14 +161,6 @@
 	
 	if (rtc_write(RTC_WEEKDAY_ALARM, 0x00) < 0)
 		goto err;
-
-	if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) {
-		printk(KERN_INFO "%s: Unable to get major numer %d for RTC device.\n", 
-		       PCF8563_NAME, PCF8563_MAJOR);
-		return -1;
-	}
-
-	printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION);
         
 	/* Check for low voltage, and warn about it.. */
 	if (rtc_read(RTC_SECONDS) & 0x80)
@@ -214,9 +211,11 @@
 			break;
 		case RTC_SET_TIME:
 			{
+#ifdef CONFIG_ETRAX_RTC_READONLY
+				return -EPERM;
+#else
 				int leap;
 				int century;
-				unsigned long flags;
 				struct rtc_time tm;
 
 				memset(&tm, 0, sizeof (struct rtc_time));
@@ -260,8 +259,35 @@
 				rtc_write(RTC_SECONDS, tm.tm_sec);
 
 				return 0;
+#endif /* !CONFIG_ETRAX_RTC_READONLY */
 			}
-			break;
+
+		case RTC_VLOW_RD:
+		{
+			int vl_bit = 0;
+
+			if (rtc_read(RTC_SECONDS) & 0x80) {
+				vl_bit = 1;
+				printk(KERN_WARNING "%s: RTC Voltage Low - reliable "
+				       "date/time information is no longer guaranteed!\n",
+				       PCF8563_NAME);
+			}
+			if (copy_to_user((int *) arg, &vl_bit, sizeof(int)))
+				return -EFAULT;
+
+			return 0;
+		}
+
+		case RTC_VLOW_SET:
+		{
+			/* Clear the VL bit in the seconds register */
+			int ret = rtc_read(RTC_SECONDS);
+
+			rtc_write(RTC_SECONDS, (ret & 0x7F));
+
+			return 0;
+		}
+
 		default:
 				return -ENOTTY;
 	}
@@ -269,19 +295,19 @@
 	return 0;
 }
 
-int 
-pcf8563_open(struct inode *inode, struct file *filp)
+static int __init
+pcf8563_register(void)
 {
-	MOD_INC_USE_COUNT;
-	return 0;
-}
+	pcf8563_init();
+	if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) {
+		printk(KERN_INFO "%s: Unable to get major numer %d for RTC device.\n",
+		       PCF8563_NAME, PCF8563_MAJOR);
+		return -1;
+	}
 
-int
-pcf8563_release(struct inode *inode, struct file *filp)
-{
-	MOD_DEC_USE_COUNT;
-	return 0;
+	printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION);
+        return 0;
 }
 
-module_init(pcf8563_init);
+module_init(pcf8563_register);
 module_exit(pcf8563_exit);
diff -Nru a/arch/cris/arch-v10/drivers/serial.c b/arch/cris/arch-v10/drivers/serial.c
--- a/arch/cris/arch-v10/drivers/serial.c	Tue Jun 15 22:20:42 2004
+++ b/arch/cris/arch-v10/drivers/serial.c	Tue Jun 15 22:20:42 2004
@@ -1,4 +1,4 @@
-/* $Id: serial.c,v 1.17 2003/07/04 08:27:37 starvik Exp $
+/* $Id: serial.c,v 1.20 2004/05/24 12:00:20 starvik Exp $
  *
  * Serial port driver for the ETRAX 100LX chip
  *
@@ -7,6 +7,16 @@
  *    Many, many authors. Based once upon a time on serial.c for 16x50.
  *
  * $Log: serial.c,v $
+ * Revision 1.20  2004/05/24 12:00:20  starvik
+ * Big merge of stuff from Linux 2.4 (e.g. manual mode for the serial port).
+ *
+ * Revision 1.19  2004/05/17 13:12:15  starvik
+ * Kernel console hook
+ * Big merge from Linux 2.4 still pending.
+ *
+ * Revision 1.18  2003/10/28 07:18:30  starvik
+ * Compiles with debug info
+ *
  * Revision 1.17  2003/07/04 08:27:37  starvik
  * Merge of Linux 2.5.74
  *
@@ -399,7 +409,7 @@
  *
  */
 
-static char *serial_version = "$Revision: 1.17 $";
+static char *serial_version = "$Revision: 1.20 $";
 
 #include <linux/config.h>
 #include <linux/version.h>
@@ -447,6 +457,10 @@
 #error "RX_TIMEOUT_TICKS == 0 not allowed, use 1"
 #endif
 
+#if defined(CONFIG_ETRAX_RS485_ON_PA) && defined(CONFIG_ETRAX_RS485_ON_PORT_G)
+#error "Disable either CONFIG_ETRAX_RS485_ON_PA or CONFIG_ETRAX_RS485_ON_PORT_G"
+#endif
+
 /*
  * All of the compatibilty code so we can compile serial.c against
  * older kernels is hidden in serial_compat.h
@@ -473,7 +487,7 @@
 //#define SERIAL_DEBUG_DATA
 //#define SERIAL_DEBUG_THROTTLE
 //#define SERIAL_DEBUG_IO  /* Debug for Extra control and status pins */
-#define SERIAL_DEBUG_LINE 0 /* What serport we want to debug */
+//#define SERIAL_DEBUG_LINE 0 /* What serport we want to debug */
 
 /* Enable this to use serial interrupts to handle when you
    expect the first received event on the serial port to
@@ -481,14 +495,74 @@
    from eLinux */
 #define SERIAL_HANDLE_EARLY_ERRORS
 
-#define TTY_THROTTLE_LIMIT (TTY_FLIPBUF_SIZE/10)
+/* Defined and used in n_tty.c, but we need it here as well */
+#define TTY_THRESHOLD_THROTTLE 128
 
+/* Due to buffersizes and threshold values, our SERIAL_DESCR_BUF_SIZE
+ * must not be to high or flow control won't work if we leave it to the tty
+ * layer so we have our own throttling in flush_to_flip
+ * TTY_FLIPBUF_SIZE=512,
+ * TTY_THRESHOLD_THROTTLE/UNTHROTTLE=128
+ * BUF_SIZE can't be > 128
+ */
+/* Currently 16 descriptors x 128 bytes = 2048 bytes */
 #define SERIAL_DESCR_BUF_SIZE 256
 
+#define SERIAL_PRESCALE_BASE 3125000 /* 3.125MHz */
+#define DEF_BAUD_BASE SERIAL_PRESCALE_BASE
+
+/* We don't want to load the system with massive fast timer interrupt
+ * on high baudrates so limit it to 250 us (4kHz) */
+#define MIN_FLUSH_TIME_USEC 250
+
 /* Add an x here to log a lot of timer stuff */
 #define TIMERD(x)
+/* Debug details of interrupt handling */
+#define DINTR1(x)  /* irq on/off, errors */
+#define DINTR2(x)    /* tx and rx */
+/* Debug flip buffer stuff */
+#define DFLIP(x)
+/* Debug flow control and overview of data flow */
+#define DFLOW(x)
+#define DBAUD(x)
+#define DLOG_INT_TRIG(x)
 
+//#define DEBUG_LOG_INCLUDED
+#ifndef DEBUG_LOG_INCLUDED
 #define DEBUG_LOG(line, string, value)
+#else
+struct debug_log_info
+{
+	unsigned long time;
+	unsigned long timer_data;
+//  int line;
+	const char *string;
+	int value;
+};
+#define DEBUG_LOG_SIZE 4096
+
+struct debug_log_info debug_log[DEBUG_LOG_SIZE];
+int debug_log_pos = 0;
+
+#define DEBUG_LOG(_line, _string, _value) do { \
+  if ((_line) == SERIAL_DEBUG_LINE) {\
+    debug_log_func(_line, _string, _value); \
+  }\
+}while(0)
+
+void debug_log_func(int line, const char *string, int value)
+{
+	if (debug_log_pos < DEBUG_LOG_SIZE) {
+		debug_log[debug_log_pos].time = jiffies;
+		debug_log[debug_log_pos].timer_data = *R_TIMER_DATA;
+//    debug_log[debug_log_pos].line = line;
+		debug_log[debug_log_pos].string = string;
+		debug_log[debug_log_pos].value = value;
+		debug_log_pos++;
+	}
+	/*printk(string, value);*/
+}
+#endif
 
 #ifndef CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS
 /* Default number of timer ticks before flushing rx fifo 
@@ -498,11 +572,14 @@
 #define CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS 5 
 #endif
 
+unsigned long timer_data_to_ns(unsigned long timer_data);
+
 static void change_speed(struct e100_serial *info);
+static void rs_throttle(struct tty_struct * tty);
 static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
 static int rs_write(struct tty_struct * tty, int from_user,
                     const unsigned char *buf, int count);
-static inline int raw_write(struct tty_struct * tty, int from_user,
+extern _INLINE_ int rs_raw_write(struct tty_struct * tty, int from_user,
                             const unsigned char *buf, int count);
 #ifdef CONFIG_ETRAX_RS485
 static int e100_write_rs485(struct tty_struct * tty, int from_user,
@@ -511,7 +588,7 @@
 static int get_lsr_info(struct e100_serial * info, unsigned int *value);
 
 
-#define DEF_BAUD 0x99   /* 115.2 kbit/s */
+#define DEF_BAUD 115200   /* 115.2 kbit/s */
 #define STD_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
 #define DEF_RX 0x20  /* or SERIAL_CTRL_W >> 8 */
 /* Default value of tx_ctrl register: has txd(bit 7)=1 (idle) as default */
@@ -520,6 +597,7 @@
 /* offsets from R_SERIALx_CTRL */
 
 #define REG_DATA 0
+#define REG_DATA_STATUS32 0 /* this is the 32 bit register R_SERIALx_READ */
 #define REG_TR_DATA 0
 #define REG_STATUS 1
 #define REG_TR_CTRL 1
@@ -555,60 +633,162 @@
  */
 
 
+/* Mask for the irqs possibly enabled in R_IRQ_MASK1_RD etc. */
+static const unsigned long e100_ser_int_mask = 0
+#ifdef CONFIG_ETRAX_SERIAL_PORT0
+| IO_MASK(R_IRQ_MASK1_RD, ser0_data) | IO_MASK(R_IRQ_MASK1_RD, ser0_ready)
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT1
+| IO_MASK(R_IRQ_MASK1_RD, ser1_data) | IO_MASK(R_IRQ_MASK1_RD, ser1_ready)
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT2
+| IO_MASK(R_IRQ_MASK1_RD, ser2_data) | IO_MASK(R_IRQ_MASK1_RD, ser2_ready)
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT3
+| IO_MASK(R_IRQ_MASK1_RD, ser3_data) | IO_MASK(R_IRQ_MASK1_RD, ser3_ready)
+#endif
+;
+unsigned long r_alt_ser_baudrate_shadow = 0;
+
 /* this is the data for the four serial ports in the etrax100 */
 /*  DMA2(ser2), DMA4(ser3), DMA6(ser0) or DMA8(ser1) */
 /* R_DMA_CHx_CLR_INTR, R_DMA_CHx_FIRST, R_DMA_CHx_CMD */
 
 static struct e100_serial rs_table[] = {
-	{ DEF_BAUD, (unsigned char *)R_SERIAL0_CTRL, 1U << 12, /* uses DMA 6 and 7 */
-	  R_DMA_CH6_CLR_INTR, R_DMA_CH6_FIRST, R_DMA_CH6_CMD,
-	  R_DMA_CH6_STATUS, R_DMA_CH6_HWSW, R_DMA_CH6_DESCR,
-	  R_DMA_CH7_CLR_INTR, R_DMA_CH7_FIRST, R_DMA_CH7_CMD,
-	  R_DMA_CH7_STATUS, R_DMA_CH7_HWSW, R_DMA_CH7_DESCR,
-	  STD_FLAGS, DEF_RX, DEF_TX, 2,
+	{ .baud        = DEF_BAUD,
+	  .port        = (unsigned char *)R_SERIAL0_CTRL,
+	  .irq         = 1U << 12, /* uses DMA 6 and 7 */
+	  .oclrintradr = R_DMA_CH6_CLR_INTR,
+	  .ofirstadr   = R_DMA_CH6_FIRST,
+	  .ocmdadr     = R_DMA_CH6_CMD,
+	  .ostatusadr  = R_DMA_CH6_STATUS,
+	  .iclrintradr = R_DMA_CH7_CLR_INTR,
+	  .ifirstadr   = R_DMA_CH7_FIRST,
+	  .icmdadr     = R_DMA_CH7_CMD,
+	  .idescradr   = R_DMA_CH7_DESCR,
+	  .flags       = STD_FLAGS,
+	  .rx_ctrl     = DEF_RX,
+	  .tx_ctrl     = DEF_TX,
+	  .iseteop     = 2,
 #ifdef CONFIG_ETRAX_SERIAL_PORT0
-          1
+          .enabled  = 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
+	  .dma_out_enabled = 1,
+#else
+	  .dma_out_enabled = 0,
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
+	  .dma_in_enabled = 1,
+#else
+	  .dma_in_enabled = 0
+#endif
 #else
-          0
+          .enabled  = 0,
+	  .dma_out_enabled = 0,
+	  .dma_in_enabled = 0
 #endif
+
 },  /* ttyS0 */
 #ifndef CONFIG_SVINTO_SIM
-	{ DEF_BAUD, (unsigned char *)R_SERIAL1_CTRL, 1U << 16, /* uses DMA 8 and 9 */
-	  R_DMA_CH8_CLR_INTR, R_DMA_CH8_FIRST, R_DMA_CH8_CMD,
-	  R_DMA_CH8_STATUS, R_DMA_CH8_HWSW, R_DMA_CH8_DESCR,
-	  R_DMA_CH9_CLR_INTR, R_DMA_CH9_FIRST, R_DMA_CH9_CMD,
-	  R_DMA_CH9_STATUS, R_DMA_CH9_HWSW, R_DMA_CH9_DESCR,
-	  STD_FLAGS, DEF_RX, DEF_TX, 3 ,
+	{ .baud        = DEF_BAUD,
+	  .port        = (unsigned char *)R_SERIAL1_CTRL,
+	  .irq         = 1U << 16, /* uses DMA 8 and 9 */
+	  .oclrintradr = R_DMA_CH8_CLR_INTR,
+	  .ofirstadr   = R_DMA_CH8_FIRST,
+	  .ocmdadr     = R_DMA_CH8_CMD,
+	  .ostatusadr  = R_DMA_CH8_STATUS,
+	  .iclrintradr = R_DMA_CH9_CLR_INTR,
+	  .ifirstadr   = R_DMA_CH9_FIRST,
+	  .icmdadr     = R_DMA_CH9_CMD,
+	  .idescradr   = R_DMA_CH9_DESCR,
+	  .flags       = STD_FLAGS,
+	  .rx_ctrl     = DEF_RX,
+	  .tx_ctrl     = DEF_TX,
+	  .iseteop     = 3,
 #ifdef CONFIG_ETRAX_SERIAL_PORT1
-          1
+          .enabled  = 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
+	  .dma_out_enabled = 1,
+#else
+	  .dma_out_enabled = 0,
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
+	  .dma_in_enabled = 1,
+#else
+	  .dma_in_enabled = 0
+#endif
 #else
-          0
+          .enabled  = 0,
+	  .dma_out_enabled = 0,
+	  .dma_in_enabled = 0
 #endif
 },  /* ttyS1 */
 
-	{ DEF_BAUD, (unsigned char *)R_SERIAL2_CTRL, 1U << 4,  /* uses DMA 2 and 3 */
-	  R_DMA_CH2_CLR_INTR, R_DMA_CH2_FIRST, R_DMA_CH2_CMD,
-	  R_DMA_CH2_STATUS, R_DMA_CH2_HWSW, R_DMA_CH2_DESCR,
-	  R_DMA_CH3_CLR_INTR, R_DMA_CH3_FIRST, R_DMA_CH3_CMD,
-	  R_DMA_CH3_STATUS, R_DMA_CH3_HWSW, R_DMA_CH3_DESCR,
-	  STD_FLAGS, DEF_RX, DEF_TX, 0,
+	{ .baud        = DEF_BAUD,
+	  .port        = (unsigned char *)R_SERIAL2_CTRL,
+	  .irq         = 1U << 4,  /* uses DMA 2 and 3 */
+	  .oclrintradr = R_DMA_CH2_CLR_INTR,
+	  .ofirstadr   = R_DMA_CH2_FIRST,
+	  .ocmdadr     = R_DMA_CH2_CMD,
+	  .ostatusadr  = R_DMA_CH2_STATUS,
+	  .iclrintradr = R_DMA_CH3_CLR_INTR,
+	  .ifirstadr   = R_DMA_CH3_FIRST,
+	  .icmdadr     = R_DMA_CH3_CMD,
+	  .idescradr   = R_DMA_CH3_DESCR,
+	  .flags       = STD_FLAGS,
+	  .rx_ctrl     = DEF_RX,
+	  .tx_ctrl     = DEF_TX,
+	  .iseteop     = 0,
 #ifdef CONFIG_ETRAX_SERIAL_PORT2
-          1
+          .enabled  = 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
+	  .dma_out_enabled = 1,
+#else
+	  .dma_out_enabled = 0,
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
+	  .dma_in_enabled = 1,
 #else
-          0
+	  .dma_in_enabled = 0
+#endif
+#else
+          .enabled  = 0,
+	  .dma_out_enabled = 0,
+	  .dma_in_enabled = 0
 #endif
  },  /* ttyS2 */
 
-	{ DEF_BAUD, (unsigned char *)R_SERIAL3_CTRL, 1U << 8,  /* uses DMA 4 and 5 */
-	  R_DMA_CH4_CLR_INTR, R_DMA_CH4_FIRST, R_DMA_CH4_CMD,
-	  R_DMA_CH4_STATUS, R_DMA_CH4_HWSW, R_DMA_CH4_DESCR,
-	  R_DMA_CH5_CLR_INTR, R_DMA_CH5_FIRST, R_DMA_CH5_CMD,
-	  R_DMA_CH5_STATUS, R_DMA_CH5_HWSW, R_DMA_CH5_DESCR,
-	  STD_FLAGS, DEF_RX, DEF_TX, 1,
+	{ .baud        = DEF_BAUD,
+	  .port        = (unsigned char *)R_SERIAL3_CTRL,
+	  .irq         = 1U << 8,  /* uses DMA 4 and 5 */
+	  .oclrintradr = R_DMA_CH4_CLR_INTR,
+	  .ofirstadr   = R_DMA_CH4_FIRST,
+	  .ocmdadr     = R_DMA_CH4_CMD,
+	  .ostatusadr  = R_DMA_CH4_STATUS,
+	  .iclrintradr = R_DMA_CH5_CLR_INTR,
+	  .ifirstadr   = R_DMA_CH5_FIRST,
+	  .icmdadr     = R_DMA_CH5_CMD,
+	  .idescradr   = R_DMA_CH5_DESCR,
+	  .flags       = STD_FLAGS,
+	  .rx_ctrl     = DEF_RX,
+	  .tx_ctrl     = DEF_TX,
+	  .iseteop     = 1,
 #ifdef CONFIG_ETRAX_SERIAL_PORT3
-          1
+          .enabled  = 1,
+#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
+	  .dma_out_enabled = 1,
+#else
+	  .dma_out_enabled = 0,
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
+	  .dma_in_enabled = 1,
 #else
-          0
+	  .dma_in_enabled = 0
+#endif
+#else
+          .enabled  = 0,
+	  .dma_out_enabled = 0,
+	  .dma_in_enabled = 0
 #endif
  }   /* ttyS3 */
 #endif
@@ -616,6 +796,9 @@
 
 
 #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial))
+
+static struct termios *serial_termios[NR_PORTS];
+static struct termios *serial_termios_locked[NR_PORTS];
 #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
 static struct fast_timer fast_timers[NR_PORTS];
 #endif
@@ -652,6 +835,9 @@
 #if defined(CONFIG_ETRAX_RS485_ON_PA)
 static int rs485_pa_bit = CONFIG_ETRAX_RS485_ON_PA_BIT;
 #endif
+#if defined(CONFIG_ETRAX_RS485_ON_PORT_G)
+static int rs485_port_g_bit = CONFIG_ETRAX_RS485_ON_PORT_G_BIT;
+#endif
 #endif
 
 /* Info and macros needed for each ports extra control/status signals. */
@@ -761,7 +947,7 @@
 #  endif
 #endif
 
-#define SER0_PB_BITSUM (CONFIG_ETRAX_SER1_DTR_ON_PB_BIT+CONFIG_ETRAX_SER1_RI_ON_PB_BIT+CONFIG_ETRAX_SER1_DSR_ON_PB_BIT+CONFIG_ETRAX_SER1_CD_ON_PB_BIT)
+#define SER1_PB_BITSUM (CONFIG_ETRAX_SER1_DTR_ON_PB_BIT+CONFIG_ETRAX_SER1_RI_ON_PB_BIT+CONFIG_ETRAX_SER1_DSR_ON_PB_BIT+CONFIG_ETRAX_SER1_CD_ON_PB_BIT)
 
 #if SER1_PB_BITSUM != -4
 #  if CONFIG_ETRAX_SER1_DTR_ON_PB_BIT == -1
@@ -1081,15 +1267,9 @@
 };
 #endif /* !CONFIG_ETRAX_SERX_DTR_RI_DSR_CD_MIXED */
 
-#if defined(CONFIG_ETRAX_RS485) && defined(CONFIG_ETRAX_RS485_ON_PA)
-unsigned char rs485_pa_port = CONFIG_ETRAX_RS485_ON_PA_BIT;
-#endif
-
-
 #define E100_RTS_MASK 0x20
 #define E100_CTS_MASK 0x40
 
-
 /* All serial port signals are active low:
  * active   = 0 -> 3.3V to RS-232 driver -> -12V on RS-232 level
  * inactive = 1 -> 0V   to RS-232 driver -> +12V on RS-232 level
@@ -1151,6 +1331,10 @@
 
 	/* calc timeout */
 	info->char_time_usec = ((bits * 1000000) / info->baud) + 1;
+	info->flush_time_usec = 4*info->char_time_usec;
+	if (info->flush_time_usec < MIN_FLUSH_TIME_USEC)
+		info->flush_time_usec = MIN_FLUSH_TIME_USEC;
+
 }
 
 /*
@@ -1250,9 +1434,13 @@
 e100_rts(struct e100_serial *info, int set)
 {
 #ifndef CONFIG_SVINTO_SIM
+	unsigned long flags;
+	save_flags(flags);
+	cli();
 	info->rx_ctrl &= ~E100_RTS_MASK;
 	info->rx_ctrl |= (set ? 0 : E100_RTS_MASK);  /* RTS is active low */
 	info->port[REG_REC_CTRL] = info->rx_ctrl;
+	restore_flags(flags);
 #ifdef SERIAL_DEBUG_IO  
 	printk("ser%i rts %i\n", info->line, set);
 #endif
@@ -1326,6 +1514,7 @@
 #ifdef SERIAL_DEBUG_INTR
 	printk("rxdma_irq(%d): 0\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ disable_rxdma_irq %i\n", info->line));
 	*R_IRQ_MASK2_CLR = (info->irq << 2) | (info->irq << 3);
 }
 
@@ -1335,30 +1524,33 @@
 #ifdef SERIAL_DEBUG_INTR
 	printk("rxdma_irq(%d): 1\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ enable_rxdma_irq %i\n", info->line));
 	*R_IRQ_MASK2_SET = (info->irq << 2) | (info->irq << 3);
 }
 
 /* the tx DMA uses only dma_descr interrupt */
 
-static inline void
+static _INLINE_ void
 e100_disable_txdma_irq(struct e100_serial *info) 
 {
 #ifdef SERIAL_DEBUG_INTR
 	printk("txdma_irq(%d): 0\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ disable_txdma_irq %i\n", info->line));
 	*R_IRQ_MASK2_CLR = info->irq;
 }
 
-static inline void
+static _INLINE_ void
 e100_enable_txdma_irq(struct e100_serial *info) 
 {
 #ifdef SERIAL_DEBUG_INTR
 	printk("txdma_irq(%d): 1\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ enable_txdma_irq %i\n", info->line));
 	*R_IRQ_MASK2_SET = info->irq;
 }
 
-static inline void
+static _INLINE_ void
 e100_disable_txdma_channel(struct e100_serial *info)
 {
 	unsigned long flags;
@@ -1367,32 +1559,46 @@
 	 * ( set to something other then serialX)
 	 */
 	save_flags(flags);
-	cli();  
+	cli();
+	DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line));
 	if (info->line == 0) {
-		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma6);
-		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma6)) ==
+		    IO_STATE(R_GEN_CONFIG, dma6, serial0)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma6);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
+		}
 	} else if (info->line == 1) {
-		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma8);
-		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma8)) ==
+		    IO_STATE(R_GEN_CONFIG, dma8, serial1)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma8);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
+		}
 	} else if (info->line == 2) {
-		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma2);
-		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma2)) ==
+		    IO_STATE(R_GEN_CONFIG, dma2, serial2)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma2);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
+		}
 	} else if (info->line == 3) {
-		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma4);
-		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1);
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma4)) ==
+		    IO_STATE(R_GEN_CONFIG, dma4, serial3)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma4);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1);
+		}
 	}
 	*R_GEN_CONFIG = genconfig_shadow;
 	restore_flags(flags);
 }
 
 
-static inline void
+static _INLINE_ void
 e100_enable_txdma_channel(struct e100_serial *info)
 {
 	unsigned long flags;
   
 	save_flags(flags);
-	cli();  
+	cli();
+	DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line));
 	/* Enable output DMA channel for the serial port in question */
 	if (info->line == 0) {
 		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma6);
@@ -1411,6 +1617,70 @@
 	restore_flags(flags);
 }
 
+static _INLINE_ void
+e100_disable_rxdma_channel(struct e100_serial *info)
+{
+	unsigned long flags;
+
+	/* Disable input DMA channel for the serial port in question
+	 * ( set to something other then serialX)
+	 */
+	save_flags(flags);
+	cli();
+	if (info->line == 0) {
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma7)) ==
+		    IO_STATE(R_GEN_CONFIG, dma7, serial0)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma7);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma7, unused);
+		}
+	} else if (info->line == 1) {
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma9)) ==
+		    IO_STATE(R_GEN_CONFIG, dma9, serial1)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma9);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma9, usb);
+		}
+	} else if (info->line == 2) {
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma3)) ==
+		    IO_STATE(R_GEN_CONFIG, dma3, serial2)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma3);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma3, par0);
+		}
+	} else if (info->line == 3) {
+		if ((genconfig_shadow & IO_MASK(R_GEN_CONFIG, dma5)) ==
+		    IO_STATE(R_GEN_CONFIG, dma5, serial3)) {
+			genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma5);
+			genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, par1);
+		}
+	}
+	*R_GEN_CONFIG = genconfig_shadow;
+	restore_flags(flags);
+}
+
+
+static _INLINE_ void
+e100_enable_rxdma_channel(struct e100_serial *info)
+{
+	unsigned long flags;
+
+	save_flags(flags);
+	cli();
+	/* Enable input DMA channel for the serial port in question */
+	if (info->line == 0) {
+		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma7);
+		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma7, serial0);
+	} else if (info->line == 1) {
+		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma9);
+		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma9, serial1);
+	} else if (info->line == 2) {
+		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma3);
+		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma3, serial2);
+	} else if (info->line == 3) {
+		genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma5);
+		genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma5, serial3);
+	}
+	*R_GEN_CONFIG = genconfig_shadow;
+	restore_flags(flags);
+}
 
 #ifdef SERIAL_HANDLE_EARLY_ERRORS
 /* in order to detect and fix errors on the first byte
@@ -1422,6 +1692,7 @@
 #ifdef SERIAL_DEBUG_INTR
 	printk("ser_irq(%d): 0\n",info->line);
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ disable data_irq %i\n", info->line));
 	*R_IRQ_MASK1_CLR = (1U << (8+2*info->line));
 }
 
@@ -1434,10 +1705,49 @@
 	       (8+2*info->line),
 	       (1U << (8+2*info->line)));
 #endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ enable data_irq %i\n", info->line));
 	*R_IRQ_MASK1_SET = (1U << (8+2*info->line));
 }
 #endif
 
+static inline void
+e100_disable_serial_tx_ready_irq(struct e100_serial *info)
+{
+#ifdef SERIAL_DEBUG_INTR
+	printk("ser_tx_irq(%d): 0\n",info->line);
+#endif
+	DINTR1(DEBUG_LOG(info->line,"IRQ disable ready_irq %i\n", info->line));
+	*R_IRQ_MASK1_CLR = (1U << (8+1+2*info->line));
+}
+
+static inline void
+e100_enable_serial_tx_ready_irq(struct e100_serial *info)
+{
+#ifdef SERIAL_DEBUG_INTR
+	printk("ser_tx_irq(%d): 1\n",info->line);
+	printk("**** %d = %d\n",
+	       (8+1+2*info->line),
+	       (1U << (8+1+2*info->line)));
+#endif
+	DINTR2(DEBUG_LOG(info->line,"IRQ enable ready_irq %i\n", info->line));
+	*R_IRQ_MASK1_SET = (1U << (8+1+2*info->line));
+}
+
+static inline void e100_enable_rx_irq(struct e100_serial *info)
+{
+	if (info->uses_dma_in)
+		e100_enable_rxdma_irq(info);
+	else
+		e100_enable_serial_data_irq(info);
+}
+static inline void e100_disable_rx_irq(struct e100_serial *info)
+{
+	if (info->uses_dma_in)
+		e100_disable_rxdma_irq(info);
+	else
+		e100_disable_serial_data_irq(info);
+}
+
 #if defined(CONFIG_ETRAX_RS485)
 /* Enable RS-485 mode on selected port. This is UGLY. */
 static int
@@ -1448,10 +1758,23 @@
 #if defined(CONFIG_ETRAX_RS485_ON_PA)	
 	*R_PORT_PA_DATA = port_pa_data_shadow |= (1 << rs485_pa_bit);
 #endif
+#if defined(CONFIG_ETRAX_RS485_ON_PORT_G)
+	REG_SHADOW_SET(R_PORT_G_DATA,  port_g_data_shadow,
+		       rs485_port_g_bit, 1);
+#endif
+#if defined(CONFIG_ETRAX_RS485_LTC1387)
+	REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+		       CONFIG_ETRAX_RS485_LTC1387_DXEN_PORT_G_BIT, 1);
+	REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+		       CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 1);
+#endif
 
 	info->rs485.rts_on_send = 0x01 & r->rts_on_send;
 	info->rs485.rts_after_sent = 0x01 & r->rts_after_sent;
-	info->rs485.delay_rts_before_send = r->delay_rts_before_send;
+	if (r->delay_rts_before_send >= 1000)
+		info->rs485.delay_rts_before_send = 1000;
+	else
+		info->rs485.delay_rts_before_send = r->delay_rts_before_send;
 	info->rs485.enabled = r->enabled;
 /*	printk("rts: on send = %i, after = %i, enabled = %i",
 		    info->rs485.rts_on_send,
@@ -1491,7 +1814,7 @@
 	e100_rts(info, info->rs485.rts_after_sent);
 #if defined(CONFIG_ETRAX_RS485_DISABLE_RECEIVER)
 	e100_enable_rx(info);
-	e100_enable_rxdma_irq(info);
+	e100_enable_rx_irq(info);
 #endif
 }
 #endif
@@ -1513,8 +1836,12 @@
 	if (info) {
 		unsigned long flags;
 		unsigned long xoff;
-		
+
 		save_flags(flags); cli();
+		DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n",
+				CIRC_CNT(info->xmit.head,
+					 info->xmit.tail,SERIAL_XMIT_SIZE)));
+
 		xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty));
 		xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop);
 		if (tty->termios->c_iflag & IXON ) {
@@ -1535,6 +1862,9 @@
 		unsigned long xoff;
 
 		save_flags(flags); cli();
+		DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n",
+				CIRC_CNT(info->xmit.head,
+					 info->xmit.tail,SERIAL_XMIT_SIZE)));
 		xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(tty));
 		xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
 		if (tty->termios->c_iflag & IXON ) {
@@ -1542,6 +1872,9 @@
 		}
 	
 		*((unsigned long *)&info->port[REG_XOFF]) = xoff;
+		if (!info->uses_dma_out &&
+		    info->xmit.head != info->xmit.tail && info->xmit.buf)
+			e100_enable_serial_tx_ready_irq(info);
 		
 		restore_flags(flags);
 	}
@@ -1576,6 +1909,8 @@
 rs_sched_event(struct e100_serial *info,
 				    int event)
 {
+	if (info->event & (1 << event))
+		return;
 	info->event |= 1 << event;
 	schedule_work(&info->work);
 }
@@ -1592,7 +1927,7 @@
  */
 
 static void 
-transmit_chars(struct e100_serial *info)
+transmit_chars_dma(struct e100_serial *info)
 {
 	unsigned int c, sentl;
 	struct etrax_dma_descr *descr;
@@ -1600,11 +1935,11 @@
 #ifdef CONFIG_SVINTO_SIM
 	/* This will output too little if tail is not 0 always since
 	 * we don't reloop to send the other part. Anyway this SHOULD be a
-	 * no-op - transmit_chars would never really be called during sim
+	 * no-op - transmit_chars_dma would never really be called during sim
 	 * since rs_write does not write into the xmit buffer then.
 	 */
 	if (info->xmit.tail)
-		printk("Error in serial.c:transmit_chars(), tail!=0\n");
+		printk("Error in serial.c:transmit_chars-dma(), tail!=0\n");
 	if (info->xmit.head != info->xmit.tail) {
 		SIMCOUT(info->xmit.buf + info->xmit.tail,
 			CIRC_CNT(info->xmit.head,
@@ -1626,7 +1961,7 @@
 #endif
 	if (!info->tr_running) {
 		/* weirdo... we shouldn't get here! */
-		printk(KERN_WARNING "Achtung: transmit_chars with !tr_running\n");
+		printk(KERN_WARNING "Achtung: transmit_chars_dma with !tr_running\n");
 		return;
 	}
 
@@ -1642,6 +1977,8 @@
 		/* otherwise we find the amount of data sent here */
 		sentl = descr->hw_len;
 
+	DFLOW(DEBUG_LOG(info->line, "TX %i done\n", sentl));
+
 	/* update stats */
 	info->icount.tx += sentl;
 
@@ -1659,6 +1996,13 @@
 
 	c = CIRC_CNT_TO_END(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
 
+	/* Don't send all in one DMA transfer - divide it so we wake up
+	 * application before all is sent
+	 */
+
+	if (c >= 4*WAKEUP_CHARS)
+		c = c/2;
+
 	if (c <= 0) {
 		/* our job here is done, don't schedule any new DMA transfer */
 		info->tr_running = 0;
@@ -1678,17 +2022,17 @@
 
 	/* ok we can schedule a dma send of c chars starting at info->xmit.tail */
 	/* set up the descriptor correctly for output */
-
+	DFLOW(DEBUG_LOG(info->line, "TX %i\n", c));
 	descr->ctrl = d_int | d_eol | d_wait; /* Wait needed for tty_wait_until_sent() */
 	descr->sw_len = c;
 	descr->buf = virt_to_phys(info->xmit.buf + info->xmit.tail);
 	descr->status = 0;
 
 	*info->ofirstadr = virt_to_phys(descr); /* write to R_DMAx_FIRST */
-	*info->ocmdadr = 1;       /* dma command start -> R_DMAx_CMD */
+	*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, start);
 	
 	/* DMA is now running (hopefully) */
-} /* transmit_chars */
+} /* transmit_chars_dma */
 
 static void 
 start_transmit(struct e100_serial *info)
@@ -1702,15 +2046,17 @@
 	info->tr_descr.hw_len = 0;
 	info->tr_descr.status = 0;
 	info->tr_running = 1;
-
-	transmit_chars(info);
+	if (info->uses_dma_out)
+		transmit_chars_dma(info);
+	else
+		e100_enable_serial_tx_ready_irq(info);
 } /* start_transmit */
 
 #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
 static int serial_fast_timer_started = 0;
 static int serial_fast_timer_expired = 0;
 static void flush_timeout_function(unsigned long data);
-#define START_FLUSH_FAST_TIMER(info, string) {\
+#define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\
   unsigned long timer_flags; \
   save_flags(timer_flags); \
   cli(); \
@@ -1721,7 +2067,7 @@
     start_one_shot_timer(&fast_timers[info->line], \
                          flush_timeout_function, \
                          (unsigned long)info, \
-                         info->char_time_usec*4, \
+                         (usec), \
                          string); \
   } \
   else { \
@@ -1729,8 +2075,10 @@
   } \
   restore_flags(timer_flags); \
 }
+#define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec)
 
 #else
+#define START_FLUSH_FAST_TIMER_TIME(info, string, usec)
 #define START_FLUSH_FAST_TIMER(info, string)
 #endif
 
@@ -1775,17 +2123,26 @@
 add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char flag)
 {
 	struct etrax_recv_buffer *buffer;
+	if (info->uses_dma_in) {
+		if (!(buffer = alloc_recv_buffer(4)))
+			return 0;
 
-	if (!(buffer = alloc_recv_buffer(4)))
-		return 0;
-
-	buffer->length = 1;
-	buffer->error = flag;
-	buffer->buffer[0] = data;
+		buffer->length = 1;
+		buffer->error = flag;
+		buffer->buffer[0] = data;
 	
-	append_recv_buffer(info, buffer);
+		append_recv_buffer(info, buffer);
 
-	info->icount.rx++;
+		info->icount.rx++;
+	} else {
+		struct tty_struct *tty = info->tty;
+		*tty->flip.char_buf_ptr = data;
+		*tty->flip.flag_buf_ptr = flag;
+		tty->flip.flag_buf_ptr++;
+		tty->flip.char_buf_ptr++;
+		tty->flip.count++;
+		info->icount.rx++;
+	}
 
 	return 1;
 }
@@ -1847,7 +2204,14 @@
 		/* Reset the status information */
 		descr->status = 0;
 
-		DEBUG_LOG(info->line, "recvl %lu\n", recvl);
+		DFLOW(  DEBUG_LOG(info->line, "RX %lu\n", recvl);
+			if (info->tty->stopped) {
+				unsigned char *buf = phys_to_virt(descr->buf);
+				DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]);
+				DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]);
+				DEBUG_LOG(info->line, "rx 0x%02X\n", buf[2]);
+			}
+			);
 
 		/* update stats */
 		info->icount.rx += recvl;
@@ -1859,7 +2223,7 @@
 }
 
 static _INLINE_ void 
-receive_chars(struct e100_serial *info)
+receive_chars_dma(struct e100_serial *info)
 {
 	struct tty_struct *tty;
 	unsigned char rstat;
@@ -1881,7 +2245,8 @@
 		return;
 
 #ifdef SERIAL_HANDLE_EARLY_ERRORS
-	e100_enable_serial_data_irq(info);
+	if (info->uses_dma_in)
+		e100_enable_serial_data_irq(info);
 #endif	
 
 	if (info->errorcode == ERRCODE_INSERT_BREAK)
@@ -1891,6 +2256,9 @@
 
 	/* Read the status register to detect errors */
 	rstat = info->port[REG_STATUS];
+	if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) {
+		DFLOW(DEBUG_LOG(info->line, "XOFF detect stat %x\n", rstat));
+	}
 
 	if (rstat & SER_ERROR_MASK) {
 		/* If we got an error, we must reset it by reading the
@@ -1959,16 +2327,16 @@
 	 */
 	return;
 #endif
-
-	/* reset the input dma channel to be sure it works */
-
-	*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-	while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) ==
-	       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
-
 	info->tty->flip.count = 0;
+	if (info->uses_dma_in) {
+		/* reset the input dma channel to be sure it works */
 
-	start_recv_dma(info);
+		*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
+		while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) ==
+		       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+
+		start_recv_dma(info);
+	}
 }
 
 
@@ -2014,27 +2382,27 @@
 	
 	for (i = 0; i < NR_PORTS; i++) {
 		info = rs_table + i;
-		if (!info->enabled || !info->uses_dma) 
+		if (!info->enabled || !info->uses_dma_out)
 			continue; 
 		/* check for dma_descr (don't need to check for dma_eop in output dma for serial */
 		if (ireg & info->irq) {  
 			handled = 1;
 			/* we can send a new dma bunch. make it so. */
-			DEBUG_LOG(info->line, "tr_interrupt %i\n", i);
+			DINTR2(DEBUG_LOG(info->line, "tr_interrupt %i\n", i));
 			/* Read jiffies_usec first, 
 			 * we want this time to be as late as possible
 			 */
  			PROCSTAT(ser_stat[info->line].tx_dma_ints++);
 			info->last_tx_active_usec = GET_JIFFIES_USEC();
 			info->last_tx_active = jiffies;
-			transmit_chars(info);
+			transmit_chars_dma(info);
 		}
 		
 		/* FIXME: here we should really check for a change in the
 		   status lines and if so call status_handle(info) */
 	}
 	return IRQ_RETVAL(handled);
-}
+} /* tr_interrupt */
 
 /* dma input channel interrupt handler */
 
@@ -2054,7 +2422,7 @@
 		const char *s = "What? rec_interrupt in simulator??\n";
 		SIMCOUT(s,strlen(s));
 	}
-	return;
+	return IRQ_HANDLED;
 #endif
 	
 	/* find out the line that caused this irq and get it from rs_table */
@@ -2063,20 +2431,20 @@
 	
 	for (i = 0; i < NR_PORTS; i++) {
 		info = rs_table + i;
-		if (!info->enabled || !info->uses_dma) 
+		if (!info->enabled || !info->uses_dma_in)
 			continue; 
 		/* check for both dma_eop and dma_descr for the input dma channel */
 		if (ireg & ((info->irq << 2) | (info->irq << 3))) {
 			handled = 1; 
 			/* we have received something */
-			receive_chars(info);
+			receive_chars_dma(info);
 		}
 		
 		/* FIXME: here we should really check for a change in the
 		   status lines and if so call status_handle(info) */
 	}
 	return IRQ_RETVAL(handled);
-}
+} /* rec_interrupt */
 
 static _INLINE_ int
 force_eop_if_needed(struct e100_serial *info)
@@ -2116,20 +2484,21 @@
 	if (!info->forced_eop) {
 		info->forced_eop = 1;
 		PROCSTAT(ser_stat[info->line].timeout_flush_cnt++);
-		DEBUG_LOG(info->line, "timeout EOP %i\n", info->line);
+		TIMERD(DEBUG_LOG(info->line, "timeout EOP %i\n", info->line));
 		FORCE_EOP(info);
 	}
 
 	return 1;
 }
 
-static _INLINE_ void
+extern _INLINE_ void
 flush_to_flip_buffer(struct e100_serial *info)
 {
 	struct tty_struct *tty;
 	struct etrax_recv_buffer *buffer;
 	unsigned int length;
 	unsigned long flags;
+	int max_flip_size;
 
 	if (!info->first_recv_buffer)
 		return;
@@ -2143,12 +2512,46 @@
 	}
 
 	length = tty->flip.count;
+	/* Don't flip more than the ldisc has room for.
+	 * The return value from ldisc.receive_room(tty) - might not be up to
+	 * date, the previous flip of up to TTY_FLIPBUF_SIZE might be on the
+	 * processed and not accounted for yet.
+	 * Since we use DMA, 1 SERIAL_DESCR_BUF_SIZE could be on the way.
+	 * Lets buffer data here and let flow control take care of it.
+	 * Since we normally flip large chunks, the ldisc don't react
+	 * with throttle until too late if we flip to much.
+	 */
+	max_flip_size = tty->ldisc.receive_room(tty);
+	if (max_flip_size < 0)
+		max_flip_size = 0;
+	if (max_flip_size <= (TTY_FLIPBUF_SIZE +         /* Maybe not accounted for */
+			      length + info->recv_cnt +  /* We have this queued */
+			      2*SERIAL_DESCR_BUF_SIZE +    /* This could be on the way */
+			      TTY_THRESHOLD_THROTTLE)) { /* Some slack */
+		/* check TTY_THROTTLED first so it indicates our state */
+		if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) {
+			DFLOW(DEBUG_LOG(info->line,"flush_to_flip throttles room %lu\n", max_flip_size));
+			rs_throttle(tty);
+		}
+#if 0
+		else if (max_flip_size <= (TTY_FLIPBUF_SIZE +         /* Maybe not accounted for */
+					   length + info->recv_cnt +  /* We have this queued */
+					   SERIAL_DESCR_BUF_SIZE +    /* This could be on the way */
+					   TTY_THRESHOLD_THROTTLE)) { /* Some slack */
+			DFLOW(DEBUG_LOG(info->line,"flush_to_flip throttles again! %lu\n", max_flip_size));
+			rs_throttle(tty);
+		}
+#endif
+	}
+
+	if (max_flip_size > TTY_FLIPBUF_SIZE)
+		max_flip_size = TTY_FLIPBUF_SIZE;
 
-	while ((buffer = info->first_recv_buffer) && length < TTY_FLIPBUF_SIZE) {
+	while ((buffer = info->first_recv_buffer) && length < max_flip_size) {
 		unsigned int count = buffer->length;
 
-		if (length + count > TTY_FLIPBUF_SIZE)
-			count = TTY_FLIPBUF_SIZE - length;
+		if (length + count > max_flip_size)
+			count = max_flip_size - length;
 
 		memcpy(tty->flip.char_buf_ptr + length, buffer->buffer, count);
 		memset(tty->flip.flag_buf_ptr + length, TTY_NORMAL, count);
@@ -2156,6 +2559,7 @@
 
 		length += count;
 		info->recv_cnt -= count;
+		DFLIP(DEBUG_LOG(info->line,"flip: %i\n", length));
 
 		if (count == buffer->length) {
 			info->first_recv_buffer = buffer->next;
@@ -2171,9 +2575,30 @@
 		info->last_recv_buffer = NULL;
 
 	tty->flip.count = length;
-
+	DFLIP(if (tty->ldisc.chars_in_buffer(tty) > 3500) {
+		DEBUG_LOG(info->line, "ldisc %lu\n",
+			  tty->ldisc.chars_in_buffer(tty));
+		DEBUG_LOG(info->line, "flip.count %lu\n",
+			  tty->flip.count);
+	      }
+	      );
 	restore_flags(flags);
 
+	DFLIP(
+	  if (1) {
+
+		  if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
+			  DEBUG_LOG(info->line, "*** TTY_DONT_FLIP set flip.count %i ***\n", tty->flip.count);
+			  DEBUG_LOG(info->line, "*** recv_cnt %i\n", info->recv_cnt);
+		  } else {
+		  }
+		  DEBUG_LOG(info->line, "*** rxtot %i\n", info->icount.rx);
+		  DEBUG_LOG(info->line, "ldisc %lu\n", tty->ldisc.chars_in_buffer(tty));
+		  DEBUG_LOG(info->line, "room  %lu\n", tty->ldisc.receive_room(tty));
+	  }
+
+	);
+
 	/* this includes a check for low-latency */
 	tty_flip_buffer_push(tty);
 }
@@ -2181,12 +2606,19 @@
 static _INLINE_ void
 check_flush_timeout(struct e100_serial *info)
 {
-	force_eop_if_needed(info);
-
+	/* Flip what we've got (if we can) */
 	flush_to_flip_buffer(info);
 
+	/* We might need to flip later, but not to fast
+	 * since the system is busy processing input... */
 	if (info->first_recv_buffer)
-		START_FLUSH_FAST_TIMER(info, "flip");
+		START_FLUSH_FAST_TIMER_TIME(info, "flip", 2000);
+
+	/* Force eop last, since data might have come while we're processing
+	 * and if we started the slow timer above, we won't start a fast
+	 * below.
+	 */
+	force_eop_if_needed(info);
 }
 
 #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
@@ -2222,7 +2654,7 @@
 	
 	for (i = 0; i < NR_PORTS; i++) {
 		info = rs_table + i;
-		if (info->uses_dma) 
+		if (info->uses_dma_in)
 			check_flush_timeout(info);
 	}
 
@@ -2301,14 +2733,158 @@
 
 */
 
-extern irqreturn_t _INLINE_ handle_ser_interrupt(struct e100_serial *info)
+extern _INLINE_
+struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info)
 {
-	unsigned char rstat = info->port[REG_STATUS];
+	unsigned long data_read;
+	struct tty_struct *tty = info->tty;
+
+	if (!tty) {
+		printk("!NO TTY!\n");
+		return info;
+	}
+	if (tty->flip.count >= TTY_FLIPBUF_SIZE - TTY_THRESHOLD_THROTTLE) {
+		/* check TTY_THROTTLED first so it indicates our state */
+		if (!test_and_set_bit(TTY_THROTTLED, &tty->flags)) {
+			DFLOW(DEBUG_LOG(info->line, "rs_throttle flip.count: %i\n", tty->flip.count));
+			rs_throttle(tty);
+		}
+	}
+	if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
+		DEBUG_LOG(info->line, "force FLIP! %i\n", tty->flip.count);
+		tty->flip.work.func((void *) tty);
+		if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
+			DEBUG_LOG(info->line, "FLIP FULL! %i\n", tty->flip.count);
+			return info;		/* if TTY_DONT_FLIP is set */
+		}
+	}
+	/* Read data and status at the same time */
+	data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]);
+more_data:
+	if (data_read & IO_MASK(R_SERIAL0_READ, xoff_detect) ) {
+		DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0));
+	}
+	DINTR2(DEBUG_LOG(info->line, "ser_rx   %c\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read)));
+
+	if (data_read & ( IO_MASK(R_SERIAL0_READ, framing_err) |
+			  IO_MASK(R_SERIAL0_READ, par_err) |
+			  IO_MASK(R_SERIAL0_READ, overrun) )) {
+		/* An error */
+		info->last_rx_active_usec = GET_JIFFIES_USEC();
+		info->last_rx_active = jiffies;
+		DINTR1(DEBUG_LOG(info->line, "ser_rx err stat_data %04X\n", data_read));
+		DLOG_INT_TRIG(
+		if (!log_int_trig1_pos) {
+			log_int_trig1_pos = log_int_pos;
+			log_int(rdpc(), 0, 0);
+		}
+		);
+
+
+		if ( ((data_read & IO_MASK(R_SERIAL0_READ, data_in)) == 0) &&
+		     (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) ) {
+			/* Most likely a break, but we get interrupts over and
+			 * over again.
+			 */
+
+			if (!info->break_detected_cnt) {
+				DEBUG_LOG(info->line, "#BRK start\n", 0);
+			}
+			if (data_read & IO_MASK(R_SERIAL0_READ, rxd)) {
+				/* The RX pin is high now, so the break
+				 * must be over, but....
+				 * we can't really know if we will get another
+				 * last byte ending the break or not.
+				 * And we don't know if the byte (if any) will
+				 * have an error or look valid.
+				 */
+				DEBUG_LOG(info->line, "# BL BRK\n", 0);
+				info->errorcode = ERRCODE_INSERT_BREAK;
+			}
+			info->break_detected_cnt++;
+		} else {
+			/* The error does not look like a break, but could be
+			 * the end of one
+			 */
+			if (info->break_detected_cnt) {
+				DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt);
+				info->errorcode = ERRCODE_INSERT_BREAK;
+			} else {
+				if (info->errorcode == ERRCODE_INSERT_BREAK) {
+					info->icount.brk++;
+					*tty->flip.char_buf_ptr = 0;
+					*tty->flip.flag_buf_ptr = TTY_BREAK;
+					tty->flip.flag_buf_ptr++;
+					tty->flip.char_buf_ptr++;
+					tty->flip.count++;
+					info->icount.rx++;
+				}
+				*tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read);
+
+				if (data_read & IO_MASK(R_SERIAL0_READ, par_err)) {
+					info->icount.parity++;
+					*tty->flip.flag_buf_ptr = TTY_PARITY;
+				} else if (data_read & IO_MASK(R_SERIAL0_READ, overrun)) {
+					info->icount.overrun++;
+					*tty->flip.flag_buf_ptr = TTY_OVERRUN;
+				} else if (data_read & IO_MASK(R_SERIAL0_READ, framing_err)) {
+					info->icount.frame++;
+					*tty->flip.flag_buf_ptr = TTY_FRAME;
+				}
+				info->errorcode = 0;
+			}
+			info->break_detected_cnt = 0;
+		}
+	} else if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) {
+		/* No error */
+		DLOG_INT_TRIG(
+		if (!log_int_trig1_pos) {
+			if (log_int_pos >= log_int_size) {
+				log_int_pos = 0;
+			}
+			log_int_trig0_pos = log_int_pos;
+			log_int(rdpc(), 0, 0);
+		}
+		);
+		*tty->flip.char_buf_ptr = IO_EXTRACT(R_SERIAL0_READ, data_in, data_read);
+		*tty->flip.flag_buf_ptr = 0;
+	} else {
+		DEBUG_LOG(info->line, "ser_rx int but no data_avail  %08lX\n", data_read);
+	}
+
+
+	tty->flip.flag_buf_ptr++;
+	tty->flip.char_buf_ptr++;
+	tty->flip.count++;
+	info->icount.rx++;
+	data_read = *((unsigned long *)&info->port[REG_DATA_STATUS32]);
+	if (data_read & IO_MASK(R_SERIAL0_READ, data_avail)) {
+		DEBUG_LOG(info->line, "ser_rx   %c in loop\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read));
+		goto more_data;
+	}
+
+	tty_flip_buffer_push(info->tty);
+	return info;
+}
+
+extern _INLINE_
+struct e100_serial* handle_ser_rx_interrupt(struct e100_serial *info)
+{
+	unsigned char rstat;
 
 #ifdef SERIAL_DEBUG_INTR
 	printk("Interrupt from serport %d\n", i);
 #endif
 /*	DEBUG_LOG(info->line, "ser_interrupt stat %03X\n", rstat | (i << 8)); */
+	if (!info->uses_dma_in) {
+		return handle_ser_rx_interrupt_no_dma(info);
+	}
+	/* DMA is used */
+	rstat = info->port[REG_STATUS];
+	if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) {
+		DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0));
+	}
+
 	if (rstat & SER_ERROR_MASK) {
 		unsigned char data;
 
@@ -2318,7 +2894,8 @@
 		 * data_in field
 		 */
 		data = info->port[REG_DATA];
-
+		DINTR1(DEBUG_LOG(info->line, "ser_rx!  %c\n", data));
+		DINTR1(DEBUG_LOG(info->line, "ser_rx err stat %02X\n", rstat));
 		if (!data && (rstat & SER_FRAMING_ERR_MASK)) {
 			/* Most likely a break, but we get interrupts over and
 			 * over again.
@@ -2347,15 +2924,22 @@
 				DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt);
 				info->errorcode = ERRCODE_INSERT_BREAK;
 			} else {
-				if (info->errorcode == ERRCODE_INSERT_BREAK)
+				if (info->errorcode == ERRCODE_INSERT_BREAK) {
+					info->icount.brk++;
 					add_char_and_flag(info, '\0', TTY_BREAK);
+				}
 
-				if (rstat & SER_PAR_ERR_MASK)
+				if (rstat & SER_PAR_ERR_MASK) {
+					info->icount.parity++;
 					add_char_and_flag(info, data, TTY_PARITY);
-				else if (rstat & SER_OVERRUN_MASK)
+				} else if (rstat & SER_OVERRUN_MASK) {
+					info->icount.overrun++;
 					add_char_and_flag(info, data, TTY_OVERRUN);
-				else if (rstat & SER_FRAMING_ERR_MASK)
+				} else if (rstat & SER_FRAMING_ERR_MASK) {
+					info->icount.frame++;
 					add_char_and_flag(info, data, TTY_FRAME);
+				}
+
 				info->errorcode = 0;
 			}
 			info->break_detected_cnt = 0;
@@ -2379,7 +2963,7 @@
 			if (elapsed_usec < 2*info->char_time_usec) {
 				DEBUG_LOG(info->line, "FBRK %i\n", info->line);
 				/* Report as BREAK (error) and let
-				 * receive_chars() handle it
+				 * receive_chars_dma() handle it
 				 */
 				info->errorcode = ERRCODE_SET_BREAK;
 			} else {
@@ -2392,38 +2976,196 @@
 		printk("** OK, disabling ser_interrupts\n");
 #endif
 		e100_disable_serial_data_irq(info);
-
+		DINTR2(DEBUG_LOG(info->line, "ser_rx OK %d\n", info->line));
 		info->break_detected_cnt = 0;
 
 		PROCSTAT(ser_stat[info->line].ser_ints_ok_cnt++);
-		DEBUG_LOG(info->line, "ser_int OK %d\n", info->line);
 	}
-
 	/* Restarting the DMA never hurts */
 	*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, restart);
 	START_FLUSH_FAST_TIMER(info, "ser_int");
-	return IRQ_HANDLED;
-} /* handle_ser_interrupt */
+	return info;
+} /* handle_ser_rx_interrupt */
+
+extern _INLINE_ void handle_ser_tx_interrupt(struct e100_serial *info)
+{
+	unsigned long flags;
+
+	if (info->x_char) {
+		unsigned char rstat;
+		DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char));
+		save_flags(flags); cli();
+		rstat = info->port[REG_STATUS];
+		DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
+
+		info->port[REG_TR_DATA] = info->x_char;
+		info->icount.tx++;
+		info->x_char = 0;
+		/* We must enable since it is disabled in ser_interrupt */
+		e100_enable_serial_tx_ready_irq(info);
+		restore_flags(flags);
+		return;
+	}
+	if (info->uses_dma_out) {
+		unsigned char rstat;
+		int i;
+		/* We only use normal tx interrupt when sending x_char */
+		DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0));
+		save_flags(flags); cli();
+		rstat = info->port[REG_STATUS];
+		DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
+		e100_disable_serial_tx_ready_irq(info);
+		if (info->tty->stopped)
+			rs_stop(info->tty);
+		/* Enable the DMA channel and tell it to continue */
+		e100_enable_txdma_channel(info);
+		/* Wait 12 cycles before doing the DMA command */
+		for(i = 6;  i > 0; i--)
+			nop();
+
+		*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue);
+		restore_flags(flags);
+		return;
+	}
+	/* Normal char-by-char interrupt */
+	if (info->xmit.head == info->xmit.tail
+	    || info->tty->stopped
+	    || info->tty->hw_stopped) {
+		DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", info->tty->stopped));
+		e100_disable_serial_tx_ready_irq(info);
+		info->tr_running = 0;
+		return;
+	}
+	DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail]));
+	/* Send a byte, rs485 timing is critical so turn of ints */
+	save_flags(flags); cli();
+	info->port[REG_TR_DATA] = info->xmit.buf[info->xmit.tail];
+	info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1);
+	info->icount.tx++;
+	if (info->xmit.head == info->xmit.tail) {
+#if defined(CONFIG_ETRAX_RS485) && defined(CONFIG_ETRAX_FAST_TIMER)
+		if (info->rs485.enabled) {
+			/* Set a short timer to toggle RTS */
+			start_one_shot_timer(&fast_timers_rs485[info->line],
+			                     rs485_toggle_rts_timer_function,
+			                     (unsigned long)info,
+			                     info->char_time_usec*2,
+			                     "RS-485");
+		}
+#endif /* RS485 */
+		info->last_tx_active_usec = GET_JIFFIES_USEC();
+		info->last_tx_active = jiffies;
+		e100_disable_serial_tx_ready_irq(info);
+		info->tr_running = 0;
+		DFLOW(DEBUG_LOG(info->line, "tx_int: stop2\n", 0));
+	} else {
+		/* We must enable since it is disabled in ser_interrupt */
+		e100_enable_serial_tx_ready_irq(info);
+	}
+	restore_flags(flags);
+
+	if (CIRC_CNT(info->xmit.head,
+		     info->xmit.tail,
+		     SERIAL_XMIT_SIZE) < WAKEUP_CHARS)
+		rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
+
+} /* handle_ser_tx_interrupt */
 
+/* result of time measurements:
+ * RX duration 54-60 us when doing something, otherwise 6-9 us
+ * ser_int duration: just sending: 8-15 us normally, up to 73 us
+ */
 static irqreturn_t
 ser_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
+	static volatile int tx_started = 0;
 	struct e100_serial *info;
 	int i;
+	unsigned long flags;
+	unsigned long irq_mask1_rd;
+	unsigned long data_mask = (1 << (8+2*0)); /* ser0 data_avail */
 	int handled = 0;
+	static volatile unsigned long reentered_ready_mask = 0;
 
+	save_flags(flags); cli();
+	irq_mask1_rd = *R_IRQ_MASK1_RD;
+	/* First handle all rx interrupts with ints disabled */
+	info = rs_table;
+	irq_mask1_rd &= e100_ser_int_mask;
 	for (i = 0; i < NR_PORTS; i++) {
-		info = rs_table + i;
-
-		if (!info->enabled || !info->uses_dma) 
-			continue; 
-
-		/* Which line caused the irq? */
-		if (*R_IRQ_MASK1_RD & (1U << (8+2*info->line))) { 
+		/* Which line caused the data irq? */
+		if (irq_mask1_rd & data_mask) {
 			handled = 1;
-			handle_ser_interrupt(info);
+			handle_ser_rx_interrupt(info);
 		}
+		info += 1;
+		data_mask <<= 2;
 	}
+	/* Handle tx interrupts with interrupts enabled so we
+	 * can take care of new data interrupts while transmitting
+	 * We protect the tx part with the tx_started flag.
+	 * We disable the tr_ready interrupts we are about to handle and
+	 * unblock the serial interrupt so new serial interrupts may come.
+	 *
+	 * If we get a new interrupt:
+	 *  - it migth be due to synchronous serial ports.
+	 *  - serial irq will be blocked by general irq handler.
+	 *  - async data will be handled above (sync will be ignored).
+	 *  - tx_started flag will prevent us from trying to send again and
+	 *    we will exit fast - no need to unblock serial irq.
+	 *  - Next (sync) serial interrupt handler will be runned with
+	 *    disabled interrupt due to restore_flags() at end of function,
+	 *    so sync handler will not be preempted or reentered.
+	 */
+	if (!tx_started) {
+		unsigned long ready_mask;
+		unsigned long
+		tx_started = 1;
+		/* Only the tr_ready interrupts left */
+		irq_mask1_rd &= (IO_MASK(R_IRQ_MASK1_RD, ser0_ready) |
+				 IO_MASK(R_IRQ_MASK1_RD, ser1_ready) |
+				 IO_MASK(R_IRQ_MASK1_RD, ser2_ready) |
+				 IO_MASK(R_IRQ_MASK1_RD, ser3_ready));
+		while (irq_mask1_rd) {
+			/* Disable those we are about to handle */
+			*R_IRQ_MASK1_CLR = irq_mask1_rd;
+			/* Unblock the serial interrupt */
+			*R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);
+
+			sti();
+			ready_mask = (1 << (8+1+2*0)); /* ser0 tr_ready */
+			info = rs_table;
+			for (i = 0; i < NR_PORTS; i++) {
+				/* Which line caused the ready irq? */
+				if (irq_mask1_rd & ready_mask) {
+					handled = 1;
+					handle_ser_tx_interrupt(info);
+				}
+				info += 1;
+				ready_mask <<= 2;
+			}
+			/* handle_ser_tx_interrupt enables tr_ready interrupts */
+			cli();
+			/* Handle reentered TX interrupt */
+			irq_mask1_rd = reentered_ready_mask;
+		}
+		cli();
+		tx_started = 0;
+	} else {
+		unsigned long ready_mask;
+		ready_mask = irq_mask1_rd & (IO_MASK(R_IRQ_MASK1_RD, ser0_ready) |
+					     IO_MASK(R_IRQ_MASK1_RD, ser1_ready) |
+					     IO_MASK(R_IRQ_MASK1_RD, ser2_ready) |
+					     IO_MASK(R_IRQ_MASK1_RD, ser3_ready));
+		if (ready_mask) {
+			reentered_ready_mask |= ready_mask;
+			/* Disable those we are about to handle */
+			*R_IRQ_MASK1_CLR = ready_mask;
+			DFLOW(DEBUG_LOG(SERIAL_DEBUG_LINE, "ser_int reentered with TX %X\n", ready_mask));
+		}
+	}
+
+	restore_flags(flags);
 	return IRQ_RETVAL(handled);
 } /* ser_interrupt */
 #endif
@@ -2489,7 +3231,7 @@
 		info->xmit.buf = (unsigned char *) xmit_page;
 
 #ifdef SERIAL_DEBUG_OPEN
-	printk("starting up ttyS%d (xmit_buf 0x%p, recv_buf 0x%p)...\n", info->line, info->xmit.buf, info->recv.buf);
+	printk("starting up ttyS%d (xmit_buf 0x%p)...\n", info->line, info->xmit.buf);
 #endif
 
 #ifdef CONFIG_SVINTO_SIM
@@ -2520,24 +3262,39 @@
 	 * Reset the DMA channels and make sure their interrupts are cleared
 	 */
 
-	info->uses_dma = 1;
-	*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-	*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-
-	/* Wait until reset cycle is complete */
-	while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) ==
-	       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+	if (info->dma_in_enabled) {
+		info->uses_dma_in = 1;
+		e100_enable_rxdma_channel(info);
+
+		*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
+
+		/* Wait until reset cycle is complete */
+		while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) ==
+		       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+
+		/* Make sure the irqs are cleared */
+		*info->iclrintradr =
+			IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
+			IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
+	} else {
+		e100_disable_rxdma_channel(info);
+	}
 
-	while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) ==
-	       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+	if (info->dma_out_enabled) {
+		info->uses_dma_out = 1;
+		e100_enable_txdma_channel(info);
+		*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
 
-	/* Make sure the irqs are cleared */
-	*info->iclrintradr =
-		IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
-		IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
-	*info->oclrintradr =
-		IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
-		IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
+		while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) ==
+		       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
+
+		/* Make sure the irqs are cleared */
+		*info->oclrintradr =
+			IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
+			IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
+	} else {
+		e100_disable_txdma_channel(info);
+	}
 
 	if (info->tty)
 		clear_bit(TTY_IO_ERROR, &info->tty->flags);
@@ -2563,9 +3320,10 @@
 	(void)info->port[REG_DATA];
 
 	/* enable the interrupts */
+	if (info->uses_dma_out)
+		e100_enable_txdma_irq(info);
 
-	e100_enable_txdma_irq(info);
-	e100_enable_rxdma_irq(info);
+	e100_enable_rx_irq(info);
 
 	info->tr_running = 0; /* to be sure we don't lock up the transmitter */
 
@@ -2606,20 +3364,28 @@
 
 #ifndef CONFIG_SVINTO_SIM	
 	/* shut down the transmitter and receiver */
-
+	DFLOW(DEBUG_LOG(info->line, "shutdown %i\n", info->line));
 	e100_disable_rx(info);
 	info->port[REG_TR_CTRL] = (info->tx_ctrl &= ~0x40);
 
-	e100_disable_rxdma_irq(info);
-	e100_disable_txdma_irq(info);
-
-	info->tr_running = 0;
-
-	/* reset both dma channels */
+	/* disable interrupts, reset dma channels */
+	if (info->uses_dma_in) {
+		e100_disable_rxdma_irq(info);
+		*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
+		info->uses_dma_in = 0;
+	} else {
+		e100_disable_serial_data_irq(info);
+	}
 
-	*info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-	*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
-	info->uses_dma = 0;
+	if (info->uses_dma_out) {
+		e100_disable_txdma_irq(info);
+		info->tr_running = 0;
+		*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
+		info->uses_dma_out = 0;
+	} else {
+		e100_disable_serial_tx_ready_irq(info);
+		info->tr_running = 0;
+	}
 
 #endif /* CONFIG_SVINTO_SIM */
 
@@ -2667,7 +3433,7 @@
 {
 	unsigned int cflag;
 	unsigned long xoff;
-
+	unsigned long flags;
 	/* first some safety checks */
 	
 	if (!info->tty || !info->tty->termios)
@@ -2676,17 +3442,80 @@
 		return;
 	
 	cflag = info->tty->termios->c_cflag;
-	
+
 	/* possibly, the tx/rx should be disabled first to do this safely */
 	
 	/* change baud-rate and write it to the hardware */
-	
-	info->baud = cflag_to_baud(cflag);
+	if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
+		/* Special baudrate */
+		u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
+		unsigned long alt_source =
+				IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) |
+				IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal);
+		/* R_ALT_SER_BAUDRATE selects the source */
+		DBAUD(printk("Custom baudrate: baud_base/divisor %lu/%i\n",
+		       (unsigned long)info->baud_base, info->custom_divisor));
+		if (info->baud_base == SERIAL_PRESCALE_BASE) {
+			/* 0, 2-65535 (0=65536) */
+			u16 divisor = info->custom_divisor;
+			/* R_SERIAL_PRESCALE (upper 16 bits of R_CLOCK_PRESCALE) */
+			/* baudrate is 3.125MHz/custom_divisor */
+			alt_source =
+				IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, prescale) |
+				IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, prescale);
+			alt_source = 0x11;
+			DBAUD(printk("Writing SERIAL_PRESCALE: divisor %i\n", divisor));
+			*R_SERIAL_PRESCALE = divisor;
+			info->baud = SERIAL_PRESCALE_BASE/divisor;
+		}
+#ifdef CONFIG_ETRAX_EXTERN_PB6CLK_ENABLED
+		else if ((info->baud_base==CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8 &&
+			  info->custom_divisor == 1) ||
+			 (info->baud_base==CONFIG_ETRAX_EXTERN_PB6CLK_FREQ &&
+			  info->custom_divisor == 8)) {
+				/* ext_clk selected */
+				alt_source =
+					IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, extern) |
+					IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, extern);
+				DBAUD(printk("using external baudrate: %lu\n", CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8));
+				info->baud = CONFIG_ETRAX_EXTERN_PB6CLK_FREQ/8;
+			}
+		}
+#endif
+		else
+		{
+			/* Bad baudbase, we don't support using timer0
+			 * for baudrate.
+			 */
+			printk(KERN_WARNING "Bad baud_base/custom_divisor: %lu/%i\n",
+			       (unsigned long)info->baud_base, info->custom_divisor);
+		}
+		r_alt_ser_baudrate_shadow &= ~mask;
+		r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8));
+		*R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow;
+	} else {
+		/* Normal baudrate */
+		/* Make sure we use normal baudrate */
+		u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
+		unsigned long alt_source =
+			IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) |
+			IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal);
+		r_alt_ser_baudrate_shadow &= ~mask;
+		r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8));
+#ifndef CONFIG_SVINTO_SIM
+		*R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow;
+#endif /* CONFIG_SVINTO_SIM */
+
+		info->baud = cflag_to_baud(cflag);
+#ifndef CONFIG_SVINTO_SIM
+		info->port[REG_BAUD] = cflag_to_etrax_baud(cflag);
+#endif /* CONFIG_SVINTO_SIM */
+	}
 	
 #ifndef CONFIG_SVINTO_SIM
-	info->port[REG_BAUD] = cflag_to_etrax_baud(cflag);
 	/* start with default settings and then fill in changes */
-
+	save_flags(flags);
+	cli();
 	/* 8 bit, no/even parity */
 	info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) |
 			   IO_MASK(R_SERIAL0_REC_CTRL, rec_par_en) |
@@ -2717,24 +3546,19 @@
 	}
 	
 	if (cflag & CMSPAR) {
-		/* enable stick parity */
+		/* enable stick parity, PARODD mean Mark which matches ETRAX */
 		info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_stick_par, stick);
 		info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, stick);
-		if (!(cflag & PARODD)) {
-			/* set mark parity */
-			info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd);
-			info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd);
-		}
-	} else {
-		if (cflag & PARODD) {
-			/* set odd parity */
-			info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd);
-			info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd);
-		}
+	}
+	if (cflag & PARODD) {
+		/* set odd parity (or Mark if CMSPAR) */
+		info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd);
+		info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd);
 	}
 	
 	if (cflag & CRTSCTS) {
 		/* enable automatic CTS handling */
+		DFLOW(DEBUG_LOG(info->line, "FLOW auto_cts enabled\n", 0));
 		info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, active);
 	}
 	
@@ -2750,13 +3574,16 @@
 	xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty));
 	xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
 	if (info->tty->termios->c_iflag & IXON ) {
+		DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", STOP_CHAR(info->tty)));
 		xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
 	}
 	
 	*((unsigned long *)&info->port[REG_XOFF]) = xoff;
+	restore_flags(flags);
 #endif /* !CONFIG_SVINTO_SIM */
 
 	update_char_time(info);
+
 } /* change_speed */
 
 /* start transmitting chars NOW */
@@ -2786,8 +3613,8 @@
 	restore_flags(flags);
 }
 
-extern inline int 
-raw_write(struct tty_struct * tty, int from_user,
+extern _INLINE_ int
+rs_raw_write(struct tty_struct * tty, int from_user,
 	  const unsigned char *buf, int count)
 {
 	int	c, ret = 0;
@@ -2801,7 +3628,7 @@
 	
 #ifdef SERIAL_DEBUG_DATA
 	if (info->line == SERIAL_DEBUG_LINE)
-		printk("raw_write (%d), status %d\n", 
+		printk("rs_raw_write (%d), status %d\n",
 		       count, info->port[REG_STATUS]);
 #endif
 
@@ -2811,6 +3638,9 @@
 	return count;
 #endif
 	save_flags(flags);
+	DFLOW(DEBUG_LOG(info->line, "write count %i ", count));
+	DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty)));
+
 	
 	/* the cli/restore_flags pairs below are needed because the
 	 * DMA interrupt handler moves the info->xmit values. the memcpy
@@ -2878,6 +3708,7 @@
 	 * this does not need IRQ protection since if tr_running == 0
 	 * the IRQ's are not running anyway for this port.
 	 */
+	DFLOW(DEBUG_LOG(info->line, "write ret %i\n", ret));
 	
 	if (info->xmit.head != info->xmit.tail &&
 	    !tty->stopped &&
@@ -2887,7 +3718,7 @@
 	}
  	
 	return ret;
-} /* raw_write() */
+} /* raw_raw_write() */
 
 static int 
 rs_write(struct tty_struct * tty, int from_user,
@@ -2909,7 +3740,7 @@
 		e100_rts(info, info->rs485.rts_on_send);
 #if defined(CONFIG_ETRAX_RS485_DISABLE_RECEIVER)
 		e100_disable_rx(info);
-		e100_disable_rxdma_irq(info);
+		e100_enable_rx_irq(info);
 #endif
 
 		if (info->rs485.delay_rts_before_send > 0) {
@@ -2919,7 +3750,7 @@
 	}
 #endif /* CONFIG_ETRAX_RS485 */
 
-	count = raw_write(tty, from_user, buf, count);
+	count = rs_raw_write(tty, from_user, buf, count);
 
 #if defined(CONFIG_ETRAX_RS485)
 	if (info->rs485.enabled)
@@ -3003,23 +3834,33 @@
  * This function is used to send a high-priority XON/XOFF character to
  * the device
  *
- * Since we use DMA we don't check for info->x_char in transmit_chars,
- * just disable DMA channel and write the character when possible.
+ * Since we use DMA we don't check for info->x_char in transmit_chars_dma(),
+ * but we do it in handle_ser_tx_interrupt().
+ * We disable DMA channel and enable tx ready interrupt and write the
+ * character when possible.
  */
 static void rs_send_xchar(struct tty_struct *tty, char ch)
 {
 	struct e100_serial *info = (struct e100_serial *)tty->driver_data;
+	unsigned long flags;
+	save_flags(flags); cli();
+	if (info->uses_dma_out) {
+		/* Put the DMA on hold and disable the channel */
+		*info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold);
+		while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) !=
+		       IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, hold));
+		e100_disable_txdma_channel(info);
+	}
 
-	e100_disable_txdma_channel(info);
-
-	/* Wait for tr_ready */
-	while (!(info->port[REG_STATUS] & IO_MASK(R_SERIAL0_STATUS, tr_ready)))
-		/* wait */;
-
-	/* Write the XON/XOFF char */
-	info->port[REG_TR_DATA] = ch;
+	/* Must make sure transmitter is not stopped before we can transmit */
+	if (tty->stopped)
+		rs_start(tty);
 
-	e100_enable_txdma_channel(info);
+	/* Enable manual transmit interrupt and send from there */
+	DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch));
+	info->x_char = ch;
+	e100_enable_serial_tx_ready_irq(info);
+	restore_flags(flags);
 }
 
 /*
@@ -3034,21 +3875,18 @@
 rs_throttle(struct tty_struct * tty)
 {
 	struct e100_serial *info = (struct e100_serial *)tty->driver_data;
-	unsigned long flags;
 #ifdef SERIAL_DEBUG_THROTTLE
 	char	buf[64];
 
-	printk("throttle %s: %d....\n", _tty_name(tty, buf),
-	       tty->ldisc.chars_in_buffer(tty));
+	printk("throttle %s: %lu....\n", tty_name(tty, buf),
+	       (unsigned long)tty->ldisc.chars_in_buffer(tty));
 #endif
+	DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty)));
 
 	/* Do RTS before XOFF since XOFF might take some time */
 	if (tty->termios->c_cflag & CRTSCTS) {
-		/* Turn off RTS line (do this atomic) */
-		save_flags(flags); 
-		cli();
+		/* Turn off RTS line */
 		e100_rts(info, 0);
-		restore_flags(flags);
 	}
 	if (I_IXOFF(tty))
 		rs_send_xchar(tty, STOP_CHAR(tty));
@@ -3059,21 +3897,18 @@
 rs_unthrottle(struct tty_struct * tty)
 {
 	struct e100_serial *info = (struct e100_serial *)tty->driver_data;
-	unsigned long flags;
 #ifdef SERIAL_DEBUG_THROTTLE
 	char	buf[64];
 
-	printk("unthrottle %s: %d....\n", _tty_name(tty, buf),
-	       tty->ldisc.chars_in_buffer(tty));
+	printk("unthrottle %s: %lu....\n", tty_name(tty, buf),
+	       (unsigned long)tty->ldisc.chars_in_buffer(tty));
 #endif
-
+	DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty)));
+	DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count));
 	/* Do RTS before XOFF since XOFF might take some time */
 	if (tty->termios->c_cflag & CRTSCTS) {
-		/* Assert RTS line (do this atomic) */
-		save_flags(flags); 
-		cli();
+		/* Assert RTS line  */
 		e100_rts(info, 1);
-		restore_flags(flags);
 	}
 
 	if (I_IXOFF(tty)) {
@@ -3110,8 +3945,10 @@
 	tmp.port = (int)info->port;
 	tmp.irq = info->irq;
 	tmp.flags = info->flags;
+	tmp.baud_base = info->baud_base;
 	tmp.close_delay = info->close_delay;
 	tmp.closing_wait = info->closing_wait;
+	tmp.custom_divisor = info->custom_divisor;
 	if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
 		return -EFAULT;
 	return 0;
@@ -3149,8 +3986,10 @@
 	 * At this point, we start making changes.....
 	 */
 	
+	info->baud_base = new_serial.baud_base;
 	info->flags = ((info->flags & ~ASYNC_FLAGS) |
 		       (new_serial.flags & ASYNC_FLAGS));
+	info->custom_divisor = new_serial.custom_divisor;
 	info->type = new_serial.type;
 	info->close_delay = new_serial.close_delay;
 	info->closing_wait = new_serial.closing_wait;
@@ -3418,6 +4257,7 @@
 
 	change_speed(info);
 
+	/* Handle turning off CRTSCTS */
 	if ((old_termios->c_cflag & CRTSCTS) &&
 	    !(tty->termios->c_cflag & CRTSCTS)) {
 		tty->hw_stopped = 0;
@@ -3426,6 +4266,42 @@
 	
 }
 
+/* In debugport.c - register a console write function that uses the normal
+ * serial driver
+ */
+typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len);
+
+extern debugport_write_function debug_write_function;
+
+static int rs_debug_write_function(int i, const char *buf, unsigned int len)
+{
+	int cnt;
+        struct tty_struct *tty;
+        static int recurse_cnt = 0;
+
+        tty = rs_table[i].tty;
+        if (tty)  {
+		unsigned long flags;
+		if (recurse_cnt > 5) /* We skip this debug output */
+			return 1;
+
+		local_irq_save(flags);
+		recurse_cnt++;
+                do {
+                        cnt = rs_write(tty, 0, buf, len);
+                        if (cnt >= 0) {
+                                buf += cnt;
+                                len -= cnt;
+                        } else
+                                len = cnt;
+                } while(len > 0);
+		recurse_cnt--;
+		local_irq_restore(flags);
+                return 1;
+        }
+        return 0;
+}
+
 /*
  * ------------------------------------------------------------
  * rs_close()
@@ -3483,6 +4359,12 @@
 	}
 	info->flags |= ASYNC_CLOSING;
 	/*
+	 * Save the termios structure, since this port may have
+	 * separate termios for callout and dialin.
+	 */
+	if (info->flags & ASYNC_NORMAL_ACTIVE)
+		info->normal_termios = *tty->termios;
+	/*
 	 * Now we wait for the transmit buffer to clear; and we notify 
 	 * the line discipline to only process XON/XOFF characters.
 	 */
@@ -3499,7 +4381,7 @@
 
 #ifndef CONFIG_SVINTO_SIM
 	e100_disable_rx(info);
-	e100_disable_rxdma_irq(info);
+	e100_disable_rx_irq(info);
 
 	if (info->flags & ASYNC_INITIALIZED) {
 		/*
@@ -3538,6 +4420,16 @@
 #if defined(CONFIG_ETRAX_RS485_ON_PA)
 		*R_PORT_PA_DATA = port_pa_data_shadow &= ~(1 << rs485_pa_bit);
 #endif
+#if defined(CONFIG_ETRAX_RS485_ON_PORT_G)
+		REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+			       rs485_port_g_bit, 0);
+#endif
+#if defined(CONFIG_ETRAX_RS485_LTC1387)
+		REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+			       CONFIG_ETRAX_RS485_LTC1387_DXEN_PORT_G_BIT, 0);
+		REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow,
+			       CONFIG_ETRAX_RS485_LTC1387_RXEN_PORT_G_BIT, 0);
+#endif
 	}
 #endif
 }
@@ -3637,8 +4529,9 @@
 		return 0;
 	}
 	
-	if (tty->termios->c_cflag & CLOCAL)
-		do_clocal = 1;
+	if (tty->termios->c_cflag & CLOCAL) {
+			do_clocal = 1;
+	}
 	
 	/*
 	 * Block waiting for the carrier detect and the line to become
@@ -3664,7 +4557,7 @@
 	while (1) {
 		save_flags(flags);
 		cli();
-                /* assert RTS and DTR */
+		/* assert RTS and DTR */
 		e100_rts(info, 1);
 		e100_dtr(info, 1);
 		restore_flags(flags);
@@ -3681,7 +4574,7 @@
 #endif
 			break;
 		}
-                if (!(info->flags & ASYNC_CLOSING) && do_clocal)
+		if (!(info->flags & ASYNC_CLOSING) && do_clocal)
 			/* && (do_clocal || DCD_IS_ASSERTED) */
 			break;
 		if (signal_pending(current)) {
@@ -3787,10 +4680,21 @@
 #endif
 		return retval;
 	}
-  
+
+	if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
+		*tty->termios = info->normal_termios;
+		change_speed(info);
+	}
+
 #ifdef SERIAL_DEBUG_OPEN
 	printk("rs_open ttyS%d successful...\n", info->line);
 #endif
+	DLOG_INT_TRIG( log_int_pos = 0);
+
+	DFLIP(	if (info->line == SERIAL_DEBUG_LINE) {
+			info->icount.rx = 0;
+		} );
+
 	return 0;
 }
 
@@ -3798,10 +4702,11 @@
  * /proc fs routines....
  */
 
-extern inline int line_info(char *buf, struct e100_serial *info)
+extern _INLINE_ int line_info(char *buf, struct e100_serial *info)
 {
 	char	stat_buf[30];
 	int	ret;
+	unsigned long tmp;
 
 	ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d",
 		      info->line, (unsigned long)info->port, info->irq);
@@ -3831,11 +4736,39 @@
 	ret += sprintf(buf+ret, " tx:%lu rx:%lu",
 		       (unsigned long)info->icount.tx,
 		       (unsigned long)info->icount.rx);
+	tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
+	if (tmp) {
+		ret += sprintf(buf+ret, " tx_pend:%lu/%lu",
+			       (unsigned long)tmp,
+			       (unsigned long)SERIAL_XMIT_SIZE);
+	}
 
 	ret += sprintf(buf+ret, " rx_pend:%lu/%lu",
 		       (unsigned long)info->recv_cnt,
 		       (unsigned long)info->max_recv_cnt);
 
+#if 1
+	if (info->tty) {
+
+		if (info->tty->stopped)
+			ret += sprintf(buf+ret, " stopped:%i",
+				       (int)info->tty->stopped);
+		if (info->tty->hw_stopped)
+			ret += sprintf(buf+ret, " hw_stopped:%i",
+				       (int)info->tty->hw_stopped);
+	}
+
+	{
+		unsigned char rstat = info->port[REG_STATUS];
+		if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) )
+			ret += sprintf(buf+ret, " xoff_detect:1");
+	}
+
+#endif
+
+
+
+
 	if (info->icount.frame)
 		ret += sprintf(buf+ret, " fe:%lu",
 			       (unsigned long)info->icount.frame);
@@ -3879,6 +4812,22 @@
 			len = 0;
 		}
 	}
+#ifdef DEBUG_LOG_INCLUDED
+	for (i = 0; i < debug_log_pos; i++) {
+		len += sprintf(page + len, "%-4i %lu.%lu ", i, debug_log[i].time, timer_data_to_ns(debug_log[i].timer_data));
+		len += sprintf(page + len, debug_log[i].string, debug_log[i].value);
+		if (len+begin > off+count)
+			goto done;
+		if (len+begin < off) {
+			begin += len;
+			len = 0;
+		}
+	}
+	len += sprintf(page + len, "debug_log %i/%i  %li bytes\n",
+		       i, DEBUG_LOG_SIZE, begin+len);
+	debug_log_pos = 0;
+#endif
+
 	*eof = 1;
 done:
 	if (off >= len+begin)
@@ -3893,7 +4842,7 @@
 show_serial_version(void)
 {
 	printk(KERN_INFO
-	       "ETRAX 100LX serial-driver %s, (c) 2000-2003 Axis Communications AB\r\n",
+	       "ETRAX 100LX serial-driver %s, (c) 2000-2004 Axis Communications AB\r\n",
 	       &serial_version[11]); /* "$Revision: x.yy" */
 }
 
@@ -3952,20 +4901,25 @@
 	driver->init_termios.c_cflag =
 		B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
 	driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
+	driver->termios = serial_termios;
+	driver->termios_locked = serial_termios_locked;
+
 	tty_set_operations(driver, &rs_ops);
+        serial_driver = driver;
 	if (tty_register_driver(driver))
 		panic("Couldn't register serial driver\n");
-        serial_driver = driver;
-  
 	/* do some initializing for the separate ports */
   
 	for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
-		info->uses_dma = 0;   
+		info->uses_dma_in = 0;
+		info->uses_dma_out = 0;
 		info->line = i;
 		info->tty = 0;
 		info->type = PORT_ETRAX;
 		info->tr_running = 0;
 		info->forced_eop = 0;
+		info->baud_base = DEF_BAUD_BASE;
+		info->custom_divisor = 0;
 		info->flags = 0;
 		info->close_delay = 5*HZ/10;
 		info->closing_wait = 30*HZ;
@@ -3973,6 +4927,7 @@
 		info->event = 0;
 		info->count = 0;
 		info->blocked_open = 0;
+		info->normal_termios = driver->init_termios;
 		init_waitqueue_head(&info->open_wait);
 		init_waitqueue_head(&info->close_wait);
 		info->xmit.buf = NULL;
@@ -4009,39 +4964,62 @@
 #ifndef CONFIG_SVINTO_SIM
 	/* Not needed in simulator.  May only complicate stuff. */
 	/* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */
+
+	if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial ", NULL))
+		panic("irq8");
+
 #ifdef CONFIG_ETRAX_SERIAL_PORT0
+#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT
 	if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 0 dma tr", NULL))
 		panic("irq22");
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN
 	if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 0 dma rec", NULL))
 		panic("irq23");
 #endif
-#ifdef SERIAL_HANDLE_EARLY_ERRORS
-	if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial ", NULL))
-		panic("irq8");
 #endif
+
 #ifdef CONFIG_ETRAX_SERIAL_PORT1
+#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT
 	if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 1 dma tr", NULL))
 		panic("irq24");
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN
 	if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 1 dma rec", NULL))
 		panic("irq25");
 #endif
+#endif
 #ifdef CONFIG_ETRAX_SERIAL_PORT2
 	/* DMA Shared with par0 (and SCSI0 and ATA) */
-	if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ, "serial 2 dma tr", NULL))
+#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT
+	if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma tr", NULL))
 		panic("irq18");
-	if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ, "serial 2 dma rec", NULL))
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN
+	if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma rec", NULL))
 		panic("irq19");
 #endif
+#endif
 #ifdef CONFIG_ETRAX_SERIAL_PORT3
 	/* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */
-	if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ, "serial 3 dma tr", NULL))
+#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT
+	if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma tr", NULL))
 		panic("irq20");
-	if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ, "serial 3 dma rec", NULL))
+#endif
+#ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN
+	if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma rec", NULL))
 		panic("irq21");
 #endif
+#endif
 
+#ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST
+	if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, SA_SHIRQ | SA_INTERRUPT,
+		       "fast serial dma timeout", NULL)) {
+		printk(KERN_CRIT "err: timer1 irq\n");
+	}
+#endif
 #endif /* CONFIG_SVINTO_SIM */
-
+	debug_write_function = rs_debug_write_function;
 	return 0;
 }
 
diff -Nru a/arch/cris/arch-v10/drivers/serial.h b/arch/cris/arch-v10/drivers/serial.h
--- a/arch/cris/arch-v10/drivers/serial.h	Tue Jun 15 22:20:58 2004
+++ b/arch/cris/arch-v10/drivers/serial.h	Tue Jun 15 22:20:58 2004
@@ -44,15 +44,11 @@
 	volatile u32		*ofirstadr;   /* adr to R_DMA_CHx_FIRST */
 	volatile u8		*ocmdadr;     /* adr to R_DMA_CHx_CMD */
 	const volatile u8	*ostatusadr;  /* adr to R_DMA_CHx_STATUS */
-	volatile u32		*ohwswadr;    /* adr to R_DMA_CHx_HWSW */
-	volatile u32		*odescradr;   /* adr to R_DMA_CHx_DESCR */
 
 	/* Input registers */
 	volatile u8		*iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
 	volatile u32		*ifirstadr;   /* adr to R_DMA_CHx_FIRST */
 	volatile u8		*icmdadr;     /* adr to R_DMA_CHx_CMD */
-	const volatile u8	*istatusadr;  /* adr to R_DMA_CHx_STATUS */
-	volatile u32		*ihwswadr;    /* adr to R_DMA_CHx_HWSW */
 	volatile u32		*idescradr;   /* adr to R_DMA_CHx_DESCR */
 
 	int			flags;	/* defined in tty.h */
@@ -60,14 +56,17 @@
 	u8			rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
 	u8			tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
 	u8			iseteop; /* bit number for R_SET_EOP for the input dma */
-
 	int			enabled; /* Set to 1 if the port is enabled in HW config */
-  
-	/* end of fields defined in rs_table[] in .c-file */
 
-	int			uses_dma; /* Set to 1 if DMA should be used */
-	unsigned char           forced_eop; /* a fifo eop has been forced */
+	u8		dma_out_enabled:1; /* Set to 1 if DMA should be used */
+	u8		dma_in_enabled:1;  /* Set to 1 if DMA should be used */
 
+	/* end of fields defined in rs_table[] in .c-file */
+	u8		uses_dma_in;  /* Set to 1 if DMA is used */
+	u8		uses_dma_out; /* Set to 1 if DMA is used */
+	u8		forced_eop;   /* a fifo eop has been forced */
+	int			baud_base;     /* For special baudrates */
+	int			custom_divisor; /* For special baudrates */
 	struct etrax_dma_descr	tr_descr;
 	struct etrax_dma_descr	rec_descr[SERIAL_RECV_DESCRIPTORS];
 	int			cur_rec_descr;
@@ -95,6 +94,8 @@
 
 	struct work_struct	work;
 	struct async_icount	icount;   /* error-statistics etc.*/
+	struct termios		normal_termios;
+	struct termios		callout_termios;
 #ifdef DECLARE_WAITQUEUE
 	wait_queue_head_t	open_wait;
 	wait_queue_head_t	close_wait;
@@ -104,6 +105,7 @@
 #endif  
 
 	unsigned long		char_time_usec;       /* The time for 1 char, in usecs */
+	unsigned long		flush_time_usec;      /* How often we should flush */
 	unsigned long		last_tx_active_usec;  /* Last tx usec in the jiffies */
 	unsigned long		last_tx_active;       /* Last tx time in jiffies */
 	unsigned long		last_rx_active_usec;  /* Last rx usec in the jiffies */
diff -Nru a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
--- a/arch/cris/arch-v10/kernel/debugport.c	Tue Jun 15 22:20:36 2004
+++ b/arch/cris/arch-v10/kernel/debugport.c	Tue Jun 15 22:20:36 2004
@@ -12,6 +12,15 @@
  *    init_etrax_debug()
  *
  * $Log: debugport.c,v $
+ * Revision 1.14  2004/05/17 13:11:29  starvik
+ * Disable DMA until real serial driver is up
+ *
+ * Revision 1.13  2004/05/14 07:58:01  starvik
+ * Merge of changes from 2.4
+ *
+ * Revision 1.12  2003/09/11 07:29:49  starvik
+ * Merge of Linux 2.6.0-test5
+ *
  * Revision 1.11  2003/07/07 09:53:36  starvik
  * Revert all the 2.5.74 merge changes to make the console work again
  *
@@ -59,7 +68,7 @@
 #include <linux/init.h>
 #include <linux/major.h>
 #include <linux/delay.h>
-
+#include <linux/tty.h>
 #include <asm/system.h>
 #include <asm/arch/svinto.h>
 #include <asm/io.h>             /* Get SIMCOUT. */
@@ -124,22 +133,28 @@
 
 #define MIN_SIZE 32 /* Size that triggers the FIFO to flush characters to interface */
 
-/* Write a string of count length to the console (debug port) using DMA, polled
- * for completion. Interrupts are disabled during the whole process. Some
- * caution needs to be taken to not interfere with ttyS business on this port.
- */
+static struct tty_driver *serial_driver;
+
+typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len);
+
+debugport_write_function debug_write_function = NULL;
+
+static void
+console_write_direct(struct console *co, const char *buf, unsigned int len)
+{
+	int i;
+	/* Send data */
+	for (i = 0; i < len; i++) {
+		/* Wait until transmitter is ready and send.*/
+		while(!(*DEBUG_READ & IO_MASK(R_SERIAL0_READ, tr_ready)));
+                *DEBUG_WRITE = buf[i];
+	}
+}
 
 static void 
 console_write(struct console *co, const char *buf, unsigned int len)
 {
-
-	static struct etrax_dma_descr descr;
-	static struct etrax_dma_descr descr2;
-	static char tmp_buf[MIN_SIZE];
-	static int tmp_size = 0;
-
-	unsigned long flags; 
-	
+	unsigned long flags;
 #ifdef CONFIG_ETRAX_DEBUG_PORT_NULL
         /* no debug printout at all */
         return;
@@ -150,86 +165,18 @@
 	SIMCOUT(buf,len);
 	return;
 #endif
-	
-	local_save_flags(flags);
-	local_irq_disable();
 
 #ifdef CONFIG_ETRAX_KGDB
 	/* kgdb needs to output debug info using the gdb protocol */
 	putDebugString(buf, len);
-	local_irq_restore(flags);
 	return;
 #endif
 
-	/* To make this work together with the real serial port driver
-	 * we have to make sure that everything is flushed when we leave
-	 * here. The following steps are made to assure this:
-	 * 1. Wait until DMA stops, FIFO is empty and serial port pipeline empty.
-	 * 2. Write at least half the FIFO to trigger flush to serial port.
-	 * 3. Wait until DMA stops, FIFO is empty and serial port pipeline empty.
-         */
-
-	/* Do we have enough characters to make the DMA/FIFO happy? */
-	if (tmp_size + len < MIN_SIZE)
-	{
-		int size = min((int)(MIN_SIZE - tmp_size),(int)len);
-		memcpy(&tmp_buf[tmp_size], buf, size);
-		tmp_size += size;
-		len -= size;
-        
-		/* Pad with space if complete line */
-		if (tmp_buf[tmp_size-1] == '\n')
-		{
-			memset(&tmp_buf[tmp_size-1], ' ', MIN_SIZE - tmp_size);
-			tmp_buf[MIN_SIZE - 1] = '\n';
-			tmp_size = MIN_SIZE;
-			len = 0;
-		}
-		else
-		{
-                  /* Wait for more characters */
-			local_irq_restore(flags);
+	local_irq_save(flags);
+	if (debug_write_function)
+		if (debug_write_function(co->index, buf, len))
 			return;
-		}
-	}
-
-	/* make sure the transmitter is enabled. 
-	 * NOTE: this overrides any setting done in ttySx, to 8N1, no auto-CTS.
-	 * in the future, move the tr/rec_ctrl shadows from etrax100ser.c to
-	 * shadows.c and use it here as well...
-	 */
-
-	*DEBUG_TR_CTRL = 0x40;
-	while(*DEBUG_OCMD & 7); /* Until DMA is not running */
-	while(*DEBUG_STATUS & 0x7f); /* wait until output FIFO is empty as well */
-	udelay(200); /* Wait for last two characters to leave the serial transmitter */
-
-	if (tmp_size)
-	{
-		descr.ctrl = len ?  0 : d_eop | d_wait | d_eol;
-		descr.sw_len = tmp_size;
-		descr.buf = virt_to_phys(tmp_buf);
-		descr.next = virt_to_phys(&descr2);
-		descr2.ctrl = d_eop | d_wait | d_eol;
-		descr2.sw_len = len;
-		descr2.buf = virt_to_phys((char*)buf);
-	}
-	else
-	{
-		descr.ctrl = d_eop | d_wait | d_eol;
-		descr.sw_len = len;
-		descr.buf = virt_to_phys((char*)buf);
-	}
-
-	*DEBUG_FIRST = virt_to_phys(&descr); /* write to R_DMAx_FIRST */
-	*DEBUG_OCMD = 1;       /* dma command start -> R_DMAx_CMD */
-
-	/* wait until the output dma channel is ready again */
-	while(*DEBUG_OCMD & 7);
-	while(*DEBUG_STATUS & 0x7f);
-	udelay(200);
-
-	tmp_size = 0;
+	console_write_direct(co, buf, len);
 	local_irq_restore(flags);
 }
 
@@ -279,10 +226,11 @@
 	*DEBUG_REC_CTRL = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable);
 }
 
-static kdev_t 
-console_device(struct console *c)
+static struct tty_driver*
+console_device(struct console *c, int *index)
 {
-         return mk_kdev(TTY_MAJOR, 64 + c->index);
+	*index = c->index;
+	return serial_driver;
 }
 
 static int __init 
@@ -311,5 +259,33 @@
 void __init 
 init_etrax_debug(void)
 {
+#if CONFIG_ETRAX_DEBUG_PORT_NULL
+	return;
+#endif
+
+#if DEBUG_PORT_IDX == 0
+	genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma6);
+	genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
+#elif DEBUG_PORT_IDX == 1
+	genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma8);
+	genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
+#elif DEBUG_PORT_IDX == 2
+	genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma2);
+	genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
+#elif DEBUG_PORT_IDX == 3
+	genconfig_shadow &=  ~IO_MASK(R_GEN_CONFIG, dma4);
+	genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma4, par1);
+#endif
+	*R_GEN_CONFIG = genconfig_shadow;
+
 	register_console(&sercons);
+}
+
+int __init
+init_console(void)
+{
+	serial_driver = alloc_tty_driver(1);
+	if (!serial_driver)
+		return -ENOMEM;
+	return 0;
 }
diff -Nru a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
--- a/arch/cris/arch-v10/kernel/entry.S	Tue Jun 15 22:20:39 2004
+++ b/arch/cris/arch-v10/kernel/entry.S	Tue Jun 15 22:20:39 2004
@@ -1,4 +1,4 @@
-/* $Id: entry.S,v 1.16 2003/07/04 08:27:41 starvik Exp $
+/* $Id: entry.S,v 1.18 2004/05/11 12:28:25 starvik Exp $
  *
  *  linux/arch/cris/entry.S
  *
@@ -7,6 +7,12 @@
  *  Authors:	Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: entry.S,v $
+ *  Revision 1.18  2004/05/11 12:28:25  starvik
+ *  Merge of Linux 2.6.6
+ *
+ *  Revision 1.17  2003/09/11 07:29:49  starvik
+ *  Merge of Linux 2.6.0-test5
+ *
  *  Revision 1.16  2003/07/04 08:27:41  starvik
  *  Merge of Linux 2.5.74
  *
@@ -1060,6 +1066,19 @@
  	.long sys_clock_nanosleep
 	.long sys_statfs64
 	.long sys_fstatfs64	
+	.long sys_tgkill	/* 270 */
+	.long sys_utimes
+ 	.long sys_fadvise64_64
+	.long sys_ni_syscall	/* sys_vserver */
+	.long sys_ni_syscall	/* sys_mbind */
+	.long sys_ni_syscall	/* 275 sys_get_mempolicy */
+	.long sys_ni_syscall	/* sys_set_mempolicy */
+	.long sys_mq_open
+	.long sys_mq_unlink
+	.long sys_mq_timedsend
+	.long sys_mq_timedreceive	/* 280 */
+	.long sys_mq_notify
+	.long sys_mq_getsetattr
 		
         /*
          * NOTE!! This doesn't have to be exact - we just have
diff -Nru a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
--- a/arch/cris/arch-v10/kernel/fasttimer.c	Tue Jun 15 22:20:37 2004
+++ b/arch/cris/arch-v10/kernel/fasttimer.c	Tue Jun 15 22:20:37 2004
@@ -1,10 +1,16 @@
-/* $Id: fasttimer.c,v 1.4 2003/07/04 08:27:41 starvik Exp $
+/* $Id: fasttimer.c,v 1.6 2004/05/14 10:18:39 starvik Exp $
  * linux/arch/cris/kernel/fasttimer.c
  *
  * Fast timers for ETRAX100/ETRAX100LX
  * This may be useful in other OS than Linux so use 2 space indentation...
  *
  * $Log: fasttimer.c,v $
+ * Revision 1.6  2004/05/14 10:18:39  starvik
+ * Export fast_timer_list
+ *
+ * Revision 1.5  2004/05/14 07:58:01  starvik
+ * Merge of changes from 2.4
+ *
  * Revision 1.4  2003/07/04 08:27:41  starvik
  * Merge of Linux 2.5.74
  *
@@ -130,7 +136,7 @@
 static int fast_timer_is_init = 0;
 static int fast_timer_ints = 0;
 
-static struct fast_timer *fast_timer_list = NULL;
+struct fast_timer *fast_timer_list = NULL;
 
 #ifdef DEBUG_LOG_INCLUDED
 #define DEBUG_LOG_MAX 128
@@ -325,7 +331,8 @@
     {
       if (tmp == t)
       {
-        printk("timer name: %s data: 0x%08lX already in list!\n", name, data);
+        printk(KERN_WARNING
+               "timer name: %s data: 0x%08lX already in list!\n", name, data);
         sanity_failed++;
         return;
       }
@@ -784,7 +791,7 @@
       cli();
       if (t->next != nextt)
       {
-        printk("timer removed!\n");
+        printk(KERN_WARNING "timer removed!\n");
       }
       t = nextt;
     }
@@ -965,7 +972,7 @@
     int i;
 #endif
 
-    printk("fast_timer_init()\n");
+    printk(KERN_INFO "fast_timer_init()\n");
 
 #if 0 && defined(FAST_TIMER_TEST)
     for (i = 0; i <= TIMER0_DIV; i++)
diff -Nru a/arch/cris/arch-v10/kernel/head.S b/arch/cris/arch-v10/kernel/head.S
--- a/arch/cris/arch-v10/kernel/head.S	Tue Jun 15 22:21:02 2004
+++ b/arch/cris/arch-v10/kernel/head.S	Tue Jun 15 22:21:02 2004
@@ -1,4 +1,4 @@
-/* $Id: head.S,v 1.6 2003/04/28 05:31:46 starvik Exp $
+/* $Id: head.S,v 1.7 2004/05/14 07:58:01 starvik Exp $
  * 
  * Head of the kernel - alter with care
  *
@@ -7,6 +7,9 @@
  * Authors:	Bjorn Wesen (bjornw@axis.com)
  * 
  * $Log: head.S,v $
+ * Revision 1.7  2004/05/14 07:58:01  starvik
+ * Merge of changes from 2.4
+ *
  * Revision 1.6  2003/04/28 05:31:46  starvik
  * Added section attributes
  *
@@ -331,7 +334,16 @@
 	move.d START_ETHERNET_CLOCK, $r0
 	move.d $r0, [R_NETWORK_GEN_CONFIG]
 #endif
-		
+
+	;; Set up waitstates etc according to kernel configuration.
+#ifndef CONFIG_SVINTO_SIM
+	move.d   CONFIG_ETRAX_DEF_R_WAITSTATES, $r0
+	move.d   $r0, [R_WAITSTATES]
+
+	move.d   CONFIG_ETRAX_DEF_R_BUS_CONFIG, $r0
+	move.d   $r0, [R_BUS_CONFIG]
+#endif
+
 	;; We need to initialze DRAM registers before we start using the DRAM
 
 	cmp.d	RAM_INIT_MAGIC, $r8	; Already initialized?
@@ -626,8 +638,19 @@
 		| IO_STATE (R_GEN_CONFIG, dma4, extdma0),$r0
 #endif
 
-#if defined(CONFIG_BLUETOOTH) && (defined(CONFIG_BLUETOOTH_RESET_G10) || defined(CONFIG_BLUETOOTH_RESET_G11))
-	or.d	  IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0
+#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT)
+        or.d      IO_STATE (R_GEN_CONFIG, g0dir, out),$r0
+#endif
+
+#if defined(CONFIG_ETRAX_DEF_R_PORT_G8_15_DIR_OUT)
+        or.d      IO_STATE (R_GEN_CONFIG, g8_15dir, out),$r0
+#endif
+#if defined(CONFIG_ETRAX_DEF_R_PORT_G16_23_DIR_OUT)
+       or.d      IO_STATE (R_GEN_CONFIG, g16_23dir, out),$r0
+#endif
+
+#if defined(CONFIG_ETRAX_DEF_R_PORT_G24_DIR_OUT)
+       or.d      IO_STATE (R_GEN_CONFIG, g24dir, out),$r0
 #endif
 
 	move.d	$r0,[genconfig_shadow] ; init a shadow register of R_GEN_CONFIG
diff -Nru a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
--- a/arch/cris/arch-v10/kernel/process.c	Tue Jun 15 22:20:41 2004
+++ b/arch/cris/arch-v10/kernel/process.c	Tue Jun 15 22:20:41 2004
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.3 2003/07/04 08:27:41 starvik Exp $
+/* $Id: process.c,v 1.6 2004/05/11 12:28:25 starvik Exp $
  * 
  *  linux/arch/cris/kernel/process.c
  *
@@ -16,6 +16,7 @@
 #include <linux/err.h>
 #include <linux/fs.h>
 #include <linux/slab.h>
+#include <asm/arch/svinto.h>
 #include <linux/init.h>
 
 #ifdef CONFIG_ETRAX_GPIO
@@ -217,8 +218,8 @@
  * These bracket the sleeping functions..
  */
 
-#define first_sched     ((unsigned long) scheduling_functions_start_here)
-#define last_sched      ((unsigned long) scheduling_functions_end_here)
+#define first_sched	((unsigned long)__sched_text_start)
+#define last_sched	((unsigned long)__sched_text_end)
 
 unsigned long get_wchan(struct task_struct *p)
 {
@@ -249,3 +250,19 @@
 }
 #undef last_sched
 #undef first_sched
+
+void show_regs(struct pt_regs * regs)
+{
+	unsigned long usp = rdusp();
+	printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
+	       regs->irp, regs->srp, regs->dccr, usp, regs->mof );
+	printk(" r0: %08lx  r1: %08lx   r2: %08lx  r3: %08lx\n",
+	       regs->r0, regs->r1, regs->r2, regs->r3);
+	printk(" r4: %08lx  r5: %08lx   r6: %08lx  r7: %08lx\n",
+	       regs->r4, regs->r5, regs->r6, regs->r7);
+	printk(" r8: %08lx  r9: %08lx  r10: %08lx r11: %08lx\n",
+	       regs->r8, regs->r9, regs->r10, regs->r11);
+	printk("r12: %08lx r13: %08lx oR10: %08lx\n",
+	       regs->r12, regs->r13, regs->orig_r10);
+}
+
diff -Nru a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
--- a/arch/cris/arch-v10/kernel/ptrace.c	Tue Jun 15 22:21:03 2004
+++ b/arch/cris/arch-v10/kernel/ptrace.c	Tue Jun 15 22:21:03 2004
@@ -118,19 +118,13 @@
 		/* Read the word at location address in the USER area. */
 		case PTRACE_PEEKUSR: {
 			unsigned long tmp;
-			
+
 			ret = -EIO;
-			if ((addr & 3) || addr < 0 || addr >= sizeof(struct user))
+			if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
 				break;
-			
-			tmp = 0;  /* Default return condition */
-			ret = -EIO;
-			
-			if (addr < sizeof(struct pt_regs)) {
-				tmp = get_reg(child, addr >> 2);
-				ret = put_user(tmp, (unsigned long *)data);
-			}
-			
+
+			tmp = get_reg(child, addr >> 2);
+			ret = put_user(tmp, (unsigned long *)data);
 			break;
 		}
 		
@@ -148,28 +142,21 @@
  		/* Write the word at location address in the USER area. */
 		case PTRACE_POKEUSR:
 			ret = -EIO;
-			
-			if ((addr & 3) || addr < 0 || addr >= sizeof(struct user))
+			if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
 				break;
 
-			if (addr < sizeof(struct pt_regs)) {
-				addr >>= 2;
+			addr >>= 2;
 
-				if (addr == PT_DCCR) {
-					/*
-					 * Don't allow the tracing process to
-					 * change stuff like interrupt enable,
-					 * kernel/user bit, etc.
-					 */
-					data &= DCCR_MASK;
-					data |= get_reg(child, PT_DCCR) & ~DCCR_MASK;
-				}
-				
-				if (put_reg(child, addr, data))
-					break;
-				
-				ret = 0;
+			if (addr == PT_DCCR) {
+				/* don't allow the tracing process to change stuff like
+				 * interrupt enable, kernel/user bit, dma enables etc.
+				 */
+				data &= DCCR_MASK;
+				data |= get_reg(child, PT_DCCR) & ~DCCR_MASK;
 			}
+			if (put_reg(child, addr, data))
+				break;
+			ret = 0;
 			break;
 
 		case PTRACE_SYSCALL:
@@ -237,7 +224,7 @@
 				
 				if (put_user(tmp, (unsigned long *) data)) {
 					ret = -EFAULT;
-					break;
+					goto out_tsk;
 				}
 				
 				data += sizeof(long);
@@ -255,7 +242,7 @@
 			for (i = 0; i <= PT_MAX; i++) {
 				if (get_user(tmp, (unsigned long *) data)) {
 					ret = -EFAULT;
-					break;
+					goto out_tsk;
 				}
 				
 				if (i == PT_DCCR) {
@@ -290,12 +277,10 @@
 	if (!(current->ptrace & PT_PTRACED))
 		return;
 	
-	current->exit_code = SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-					? 0x80 : 0);
-	
-	current->state = TASK_STOPPED;
-	notify_parent(current, SIGCHLD);
-	schedule();
+	/* the 0x80 provides a way for the tracing parent to distinguish
+	   between a syscall stop and SIGTRAP delivery */
+	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
+				 ? 0x80 : 0));
 	
 	/*
 	 * This isn't the same as continuing with a signal, but it will do for
diff -Nru a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c
--- a/arch/cris/arch-v10/kernel/setup.c	Tue Jun 15 22:20:44 2004
+++ b/arch/cris/arch-v10/kernel/setup.c	Tue Jun 15 22:20:44 2004
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.1 2002/12/11 15:42:02 starvik Exp $
+/*
  *
  *  linux/arch/cris/arch-v10/kernel/setup.c
  *
@@ -94,3 +94,10 @@
 }
 
 #endif /* CONFIG_PROC_FS */
+
+void
+show_etrax_copyright(void)
+{
+	printk(KERN_INFO
+               "Linux/CRIS port on ETRAX 100LX (c) 2001 Axis Communications AB\n");
+}
diff -Nru a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
--- a/arch/cris/arch-v10/kernel/signal.c	Tue Jun 15 22:20:36 2004
+++ b/arch/cris/arch-v10/kernel/signal.c	Tue Jun 15 22:20:36 2004
@@ -180,6 +180,9 @@
 	unsigned int err = 0;
 	unsigned long old_usp;
 
+        /* Always make any pending restarted system calls return -EINTR */
+	current_thread_info()->restart_block.fn = do_no_restart_syscall;
+
 	/* restore the regs from &sc->regs (same as sc, since regs is first)
 	 * (sc is already checked for VERIFY_READ since the sigframe was
 	 *  checked in sys_sigreturn previously)
@@ -492,7 +495,6 @@
 		/* If so, check system call restarting.. */
 		switch (regs->r10) {
 			case -ERESTART_RESTARTBLOCK:
-				current_thread_info()->restart_block.fn = do_no_restart_syscall;
 			case -ERESTARTNOHAND:
 				/* ERESTARTNOHAND means that the syscall should only be
 				   restarted if there was no handler for the signal, and since
diff -Nru a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
--- a/arch/cris/arch-v10/kernel/time.c	Tue Jun 15 22:20:42 2004
+++ b/arch/cris/arch-v10/kernel/time.c	Tue Jun 15 22:20:42 2004
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.2 2003/07/04 08:27:41 starvik Exp $
+/* $Id: time.c,v 1.3 2004/06/01 05:38:42 starvik Exp $
  *
  *  linux/arch/cris/arch-v10/kernel/time.c
  *
@@ -276,6 +276,12 @@
 		have_rtc = 1;
 		update_xtime_from_cmos();
 	}
+
+	/*
+	 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
+	 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
+	 */
+	set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
 
 	/* Setup the etrax timers
 	 * Base frequency is 25000 hz, divider 250 -> 100 HZ
diff -Nru a/arch/cris/arch-v10/lib/dram_init.S b/arch/cris/arch-v10/lib/dram_init.S
--- a/arch/cris/arch-v10/lib/dram_init.S	Tue Jun 15 22:20:44 2004
+++ b/arch/cris/arch-v10/lib/dram_init.S	Tue Jun 15 22:20:44 2004
@@ -1,4 +1,4 @@
-/* $Id: dram_init.S,v 1.3 2003/03/31 09:38:37 starvik Exp $
+/* $Id: dram_init.S,v 1.4 2003/09/22 09:21:59 starvik Exp $
  * 
  * DRAM/SDRAM initialization - alter with care
  * This file is intended to be included from other assembler files
@@ -11,6 +11,10 @@
  * Authors:  Mikael Starvik (starvik@axis.com)	
  * 
  * $Log: dram_init.S,v $
+ * Revision 1.4  2003/09/22 09:21:59  starvik
+ * Decompresser is linked to 0x407xxxxx and sdram commands are at 0x000xxxxx
+ * so we need to mask off 12 bits.
+ *
  * Revision 1.3  2003/03/31 09:38:37  starvik
  * Corrected calculation of end of sdram init commands
  *
@@ -152,9 +156,9 @@
 	
 	; Issue initialization command sequence
 	move.d   _sdram_commands_start, $r2
-	and.d    0x00ffffff, $r2 ; Make sure commands are read from flash
+	and.d    0x000fffff, $r2 ; Make sure commands are read from flash
 	move.d   _sdram_commands_end,  $r3
-	and.d    0x00ffffff, $r3
+	and.d    0x000fffff, $r3
 1:	clear.d  $r4
 	move.b   [$r2+], $r4
 	lslq     9, $r4	; Command starts at bit 9
diff -Nru a/arch/cris/arch-v10/lib/old_checksum.c b/arch/cris/arch-v10/lib/old_checksum.c
--- a/arch/cris/arch-v10/lib/old_checksum.c	Tue Jun 15 22:20:43 2004
+++ b/arch/cris/arch-v10/lib/old_checksum.c	Tue Jun 15 22:20:43 2004
@@ -1,4 +1,4 @@
-/* $Id: old_checksum.c,v 1.2 2002/11/05 06:45:12 starvik Exp $
+/* $Id: old_checksum.c,v 1.3 2003/10/27 08:04:32 starvik Exp $
  *
  * INET		An implementation of the TCP/IP protocol suite for the LINUX
  *		operating system.  INET is implemented using the  BSD Socket
@@ -76,7 +76,7 @@
     sum += *((unsigned short *)buff)++;
   }
   if(endMarker - buff > 0) {
-    sum += *buff;                 /* add extra byte separately */
+    sum += *buff;                 /* add extra byte seperately */
   }
   BITOFF;
   return(sum);
diff -Nru a/arch/cris/arch-v10/mm/fault.c b/arch/cris/arch-v10/mm/fault.c
--- a/arch/cris/arch-v10/mm/fault.c	Tue Jun 15 22:21:03 2004
+++ b/arch/cris/arch-v10/mm/fault.c	Tue Jun 15 22:21:03 2004
@@ -30,7 +30,7 @@
 	*search_exception_tables(unsigned long addr);
 
 asmlinkage void do_page_fault(unsigned long address, struct pt_regs *regs,
-                              int error_code);
+                              int protection, int writeaccess);
 
 /* fast TLB-fill fault handler
  * this is called from entry.S with interrupts disabled
@@ -39,8 +39,9 @@
 void
 handle_mmu_bus_fault(struct pt_regs *regs)
 {
-	int cause, select;
+	int cause;
 #ifdef DEBUG
+	int select;
 	int index;
 	int page_id;
 	int acc, inv;
@@ -48,15 +49,14 @@
 	int miss, we, writeac;
 	pmd_t *pmd;
 	pte_t pte;
-	int errcode;
 	unsigned long address;
 
 	cause = *R_MMU_CAUSE;
-	select = *R_TLB_SELECT;
 
 	address = cause & PAGE_MASK; /* get faulting address */
 
 #ifdef DEBUG
+	select = *R_TLB_SELECT;
 	page_id = IO_EXTRACT(R_MMU_CAUSE,  page_id,   cause);
 	acc     = IO_EXTRACT(R_MMU_CAUSE,  acc_excp,  cause);
 	inv     = IO_EXTRACT(R_MMU_CAUSE,  inv_excp,  cause);  
@@ -82,12 +82,6 @@
 	if(writeac)
 		regs->csrinstr &= ~(1 << 5);
 	
-	/* Set errcode's R/W flag according to the mode which caused the
-	 * fault
-	 */
-
-	errcode = writeac << 1;
-
 	D(printk("bus_fault from IRP 0x%lx: addr 0x%lx, miss %d, inv %d, we %d, acc %d, dx %d pid %d\n",
 		 regs->irp, address, miss, inv, we, acc, index, page_id));
 
@@ -99,16 +93,20 @@
 		 */
 
 		pmd = (pmd_t *)(current_pgd + pgd_index(address));
-		if (pmd_none(*pmd))
-			goto dofault;
+		if (pmd_none(*pmd)) {
+			do_page_fault(address, regs, 0, writeac);
+			return;
+		}
 		if (pmd_bad(*pmd)) {
 			printk("bad pgdir entry 0x%lx at 0x%p\n", *(unsigned long*)pmd, pmd);
 			pmd_clear(pmd);
 			return;
 		}
 		pte = *pte_offset_kernel(pmd, address);
-		if (!pte_present(pte))
-			goto dofault;
+		if (!pte_present(pte)) {
+			do_page_fault(address, regs, 0, writeac);
+			return;
+		}
 
 #ifdef DEBUG
 		printk(" found pte %lx pg %p ", pte_val(pte), pte_page(pte));
@@ -143,14 +141,10 @@
 		*R_TLB_LO = pte_val(pte);
 
 		return;
-	} 
-
-	errcode = 1 | (we << 1);
+	}
 
- dofault:
-	/* leave it to the MM system fault handler below */
-	D(printk("do_page_fault %lx errcode %d\n", address, errcode));
-	do_page_fault(address, regs, errcode);
+	/* leave it to the MM system fault handler */
+	do_page_fault(address, regs, 1, we);
 }
 
 /* Called from arch/cris/mm/fault.c to find fixup code. */
diff -Nru a/arch/cris/arch-v10/mm/tlb.c b/arch/cris/arch-v10/mm/tlb.c
--- a/arch/cris/arch-v10/mm/tlb.c	Tue Jun 15 22:21:05 2004
+++ b/arch/cris/arch-v10/mm/tlb.c	Tue Jun 15 22:21:05 2004
@@ -212,7 +212,7 @@
 
 void 
 switch_mm(struct mm_struct *prev, struct mm_struct *next,
-	  struct task_struct *tsk, int cpu)
+	  struct task_struct *tsk)
 {
 	/* make sure we have a context */
 
diff -Nru a/arch/cris/defconfig b/arch/cris/defconfig
--- a/arch/cris/defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/cris/defconfig	Tue Jun 15 22:20:38 2004
@@ -1,25 +1,55 @@
 #
 # Automatically generated make config: don't edit
 #
+CONFIG_MMU=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_STANDALONE=y
+CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
-CONFIG_NET=y
-CONFIG_SYSVIPC=y
+CONFIG_SWAP=y
+# CONFIG_SYSVIPC is not set
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_SYSCTL is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_EMBEDDED=y
+# CONFIG_KALLSYMS is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+
+#
+# Loadable module support
+#
+# CONFIG_MODULES is not set
+
+#
+# General setup
+#
 CONFIG_BINFMT_ELF=y
-# CONFIG_ETRAX_KGDB is not set
-# CONFIG_ETRAX_WATCHDOG is not set
+# CONFIG_BINFMT_MISC is not set
+CONFIG_ETRAX_CMDLINE="root=/dev/mtdblock3 init=/linuxrc"
+CONFIG_ETRAX_WATCHDOG=y
+CONFIG_ETRAX_WATCHDOG_NICE_DOGGY=y
+CONFIG_ETRAX_FAST_TIMER=y
+# CONFIG_PREEMPT is not set
 
 #
 # Hardware setup
@@ -27,74 +57,170 @@
 CONFIG_ETRAX100LX=y
 # CONFIG_ETRAX100LX_V2 is not set
 # CONFIG_SVINTO_SIM is not set
-CONFIG_ETRAX_DRAM_SIZE=8
+CONFIG_ETRAX_ARCH_V10=y
+CONFIG_ETRAX_DRAM_SIZE=16
 CONFIG_ETRAX_FLASH_BUSWIDTH=2
-CONFIG_ETRAX_ROOT_DEVICE="/dev/mtdblock3"
+CONFIG_CRIS_LOW_MAP=y
+CONFIG_ETRAX_DRAM_VIRTUAL_BASE=60000000
+CONFIG_ETRAX_PA_LEDS=y
+# CONFIG_ETRAX_PB_LEDS is not set
+# CONFIG_ETRAX_CSP0_LEDS is not set
+# CONFIG_ETRAX_NO_LEDS is not set
+CONFIG_ETRAX_LED1G=2
+CONFIG_ETRAX_LED1R=2
+CONFIG_ETRAX_LED2G=3
+CONFIG_ETRAX_LED2R=3
+CONFIG_ETRAX_LED3G=2
+CONFIG_ETRAX_LED3R=2
+CONFIG_ETRAX_DEBUG_PORT0=y
+# CONFIG_ETRAX_DEBUG_PORT1 is not set
+# CONFIG_ETRAX_DEBUG_PORT2 is not set
+# CONFIG_ETRAX_DEBUG_PORT3 is not set
+# CONFIG_ETRAX_DEBUG_PORT_NULL is not set
+CONFIG_ETRAX_RESCUE_SER0=y
+# CONFIG_ETRAX_RESCUE_SER1 is not set
+# CONFIG_ETRAX_RESCUE_SER2 is not set
+# CONFIG_ETRAX_RESCUE_SER3 is not set
+CONFIG_ETRAX_DEF_R_WAITSTATES=0x95f8
+CONFIG_ETRAX_DEF_R_BUS_CONFIG=0x104
+CONFIG_ETRAX_SDRAM=y
+CONFIG_ETRAX_DEF_R_SDRAM_CONFIG=0x00e03636
+CONFIG_ETRAX_DEF_R_SDRAM_TIMING=0x80008002
+CONFIG_ETRAX_DEF_R_PORT_PA_DIR=0x1d
+CONFIG_ETRAX_DEF_R_PORT_PA_DATA=0xf0
+CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG=0x00
+CONFIG_ETRAX_DEF_R_PORT_PB_DIR=0x1e
+CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3
+# CONFIG_ETRAX_SOFT_SHUTDOWN is not set
 
 #
-# Drivers for ETRAX 100LX built-in interfaces
+# Drivers for built-in interfaces
+#
+CONFIG_ETRAX_ETHERNET=y
+CONFIG_NET_ETHERNET=y
+# CONFIG_ETRAX_NETWORK_LED_ON_WHEN_LINK is not set
+CONFIG_ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY=y
+CONFIG_ETRAX_SERIAL=y
+CONFIG_ETRAX_SERIAL_FAST_TIMER=y
+CONFIG_ETRAX_SERIAL_PORT0=y
+# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT is not set
+CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT=y
+# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN is not set
+CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN=y
+CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE=y
+# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PA is not set
+# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set
+# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_MIXED is not set
+CONFIG_ETRAX_SER0_DTR_ON_PA_BIT=-1
+CONFIG_ETRAX_SER0_RI_ON_PA_BIT=-1
+CONFIG_ETRAX_SER0_DSR_ON_PA_BIT=-1
+CONFIG_ETRAX_SER0_CD_ON_PA_BIT=-1
+CONFIG_ETRAX_SER0_DTR_ON_PB_BIT=-1
+CONFIG_ETRAX_SER0_RI_ON_PB_BIT=-1
+CONFIG_ETRAX_SER0_DSR_ON_PB_BIT=-1
+CONFIG_ETRAX_SER0_CD_ON_PB_BIT=-1
+# CONFIG_ETRAX_SERIAL_PORT1 is not set
+CONFIG_ETRAX_SERIAL_PORT2=y
+# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set
+CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y
+# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set
+CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y
+CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE=y
+# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA is not set
+# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PB is not set
+# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_MIXED is not set
+CONFIG_ETRAX_SER2_DTR_ON_PA_BIT=-1
+CONFIG_ETRAX_SER2_RI_ON_PA_BIT=-1
+CONFIG_ETRAX_SER2_DSR_ON_PA_BIT=-1
+CONFIG_ETRAX_SER2_CD_ON_PA_BIT=-1
+CONFIG_ETRAX_SER2_DTR_ON_PB_BIT=-1
+CONFIG_ETRAX_SER2_RI_ON_PB_BIT=-1
+CONFIG_ETRAX_SER2_DSR_ON_PB_BIT=-1
+CONFIG_ETRAX_SER2_CD_ON_PB_BIT=-1
+# CONFIG_ETRAX_SERIAL_PORT3 is not set
+# CONFIG_ETRAX_RS485 is not set
+# CONFIG_ETRAX_IDE is not set
+# CONFIG_IDE is not set
+# CONFIG_ETRAX_USB_HOST is not set
+CONFIG_ETRAX_AXISFLASHMAP=y
+CONFIG_ETRAX_PTABLE_SECTOR=65536
+CONFIG_MTD=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_AMDSTD=y
+CONFIG_MTD_OBSOLETE_CHIPS=y
+CONFIG_MTD_AMDSTD=y
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+CONFIG_MTD_PARTITIONS=y
+CONFIG_MTD_CONCAT=y
+# CONFIG_ETRAX_I2C is not set
+CONFIG_ETRAX_GPIO=y
+CONFIG_ETRAX_PA_BUTTON_BITMASK=0x02
+CONFIG_ETRAX_PA_CHANGEABLE_DIR=0x00
+CONFIG_ETRAX_PA_CHANGEABLE_BITS=0xFF
+CONFIG_ETRAX_PB_CHANGEABLE_DIR=0x00
+CONFIG_ETRAX_PB_CHANGEABLE_BITS=0xFF
+# CONFIG_ETRAX_RTC is not set
+
+#
+# Generic Driver Options
 #
 
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
 
 #
-# Disk-On-Chip Device Drivers
+# User Modules And Translation Layers
 #
-# CONFIG_MTD_DOC1000 is not set
-# CONFIG_MTD_DOC2000 is not set
-# CONFIG_MTD_DOC2001 is not set
-# CONFIG_MTD_DOCPROBE is not set
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
 
 #
-# RAM/ROM Device Drivers
+# RAM/ROM/Flash chip drivers
 #
-# CONFIG_MTD_PMC551 is not set
-# CONFIG_MTD_SLRAM is not set
-# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+# CONFIG_MTD_CFI_INTELEXT is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_RAM=y
 # CONFIG_MTD_ROM is not set
-# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_SHARP is not set
+# CONFIG_MTD_JEDEC is not set
 
 #
-# Linearly Mapped Flash Device Drivers
+# Mapping drivers for chip access
 #
-CONFIG_MTD_CFI=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_AMDSTD=y
-# CONFIG_MTD_SHARP is not set
+CONFIG_MTD_COMPLEX_MAPPINGS=y
 # CONFIG_MTD_PHYSMAP is not set
-# CONFIG_MTD_NORA is not set
-# CONFIG_MTD_PNC2000 is not set
-# CONFIG_MTD_RPXLITE is not set
-# CONFIG_MTD_SC520CDP is not set
-# CONFIG_MTD_SBC_MEDIAGX is not set
-# CONFIG_MTD_ELAN_104NC is not set
-# CONFIG_MTD_SA1100 is not set
-# CONFIG_MTD_DC21285 is not set
-# CONFIG_MTD_CSTM_CFI_JEDEC is not set
-# CONFIG_MTD_JEDEC is not set
-# CONFIG_MTD_MIXMEM is not set
-# CONFIG_MTD_OCTAGON is not set
-# CONFIG_MTD_VMAX is not set
 
 #
-# NAND Flash Device Drivers
+# Self-contained MTD device drivers
 #
-# CONFIG_MTD_NAND is not set
-# CONFIG_MTD_NAND_SPIA is not set
+# CONFIG_MTD_SLRAM is not set
+CONFIG_MTD_MTDRAM=y
+CONFIG_MTDRAM_TOTAL_SIZE=0
+CONFIG_MTDRAM_ERASE_SIZE=64
+CONFIG_MTDRAM_ABS_POS=0x0
+# CONFIG_MTD_BLKMTD is not set
 
 #
-# User Modules And Translation Layers
+# Disk-On-Chip Device Drivers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-# CONFIG_FTL is not set
-# CONFIG_NFTL is not set
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
 
 #
 # Parallel port support
@@ -102,51 +228,98 @@
 # CONFIG_PARPORT is not set
 
 #
-# Plug and Play configuration
+# Plug and Play support
 #
-# CONFIG_PNP is not set
-# CONFIG_ISAPNP is not set
 
 #
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_RAM is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_SIZE=4096
 # CONFIG_BLK_DEV_INITRD is not set
 
 #
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+
+#
+# SCSI device support
+#
+# CONFIG_SCSI is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# I2O device support
+#
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
 # Networking options
 #
-# CONFIG_PACKET is not set
-# CONFIG_NETLINK is not set
-# CONFIG_NETFILTER is not set
-# CONFIG_FILTER is not set
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+# CONFIG_NETLINK_DEV is not set
 CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
 # CONFIG_IP_ADVANCED_ROUTER is not set
 # CONFIG_IP_PNP is not set
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
-# CONFIG_INET_ECN is not set
+# CONFIG_ARPD is not set
 # CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+
+#
+# IP: Virtual Server Configuration
+#
+# CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_KHTTPD is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
+
+#
+# IP: Netfilter Configuration
+#
+# CONFIG_IP_NF_CONNTRACK is not set
+# CONFIG_IP_NF_QUEUE is not set
+# CONFIG_IP_NF_IPTABLES is not set
+# CONFIG_IP_NF_ARPTABLES is not set
+# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
+# CONFIG_IP_NF_COMPAT_IPFWADM is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
-# CONFIG_LLC is not set
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
@@ -159,167 +332,114 @@
 # CONFIG_NET_SCHED is not set
 
 #
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-# CONFIG_PHONE_IXJ is not set
-
-#
-# ATA/IDE/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# IDE, ATA and ATAPI Block devices
-#
-# CONFIG_BLK_DEV_IDE is not set
-# CONFIG_BLK_DEV_HD_IDE is not set
-# CONFIG_BLK_DEV_HD is not set
-# CONFIG_BLK_DEV_IDEDISK is not set
-# CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_BLK_DEV_IDECS is not set
-# CONFIG_BLK_DEV_IDECD is not set
-# CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_BLK_DEV_CMD640 is not set
-# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
-# CONFIG_BLK_DEV_ISAPNP is not set
-# CONFIG_IDE_CHIPSETS is not set
-# CONFIG_IDEDMA_AUTO is not set
-
-#
-# SCSI support
-#
-# CONFIG_SCSI is not set
-
-#
-# I2O device support
-#
-# CONFIG_I2O is not set
-# CONFIG_I2O_BLOCK is not set
-# CONFIG_I2O_LAN is not set
-# CONFIG_I2O_SCSI is not set
-# CONFIG_I2O_PROC is not set
-
-#
-# Network device support
+# Network testing
 #
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-# CONFIG_NET_SB1000 is not set
 
 #
 # Ethernet (10 or 100Mbit)
 #
-CONFIG_NET_ETHERNET=y
-# CONFIG_NET_VENDOR_3COM is not set
-# CONFIG_LANCE is not set
-# CONFIG_NET_VENDOR_SMC is not set
-# CONFIG_NET_VENDOR_RACAL is not set
-# CONFIG_AT1700 is not set
-# CONFIG_DEPCA is not set
-# CONFIG_NET_ISA is not set
-# CONFIG_NET_PCI is not set
-# CONFIG_NET_POCKET is not set
+# CONFIG_MII is not set
 
 #
 # Ethernet (1000 Mbit)
 #
-# CONFIG_ACENIC is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PLIP is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Ethernet (10000 Mbit)
 #
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
 
 #
 # Wan interfaces
 #
 # CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
-# Amateur Radio support
+# ISDN subsystem
 #
-# CONFIG_HAMRADIO is not set
+# CONFIG_ISDN is not set
 
 #
-# IrDA (infrared) support
+# Telephony Support
 #
-# CONFIG_IRDA is not set
+# CONFIG_PHONE is not set
 
 #
-# ISDN subsystem
+# Input device support
 #
-# CONFIG_ISDN is not set
+# CONFIG_INPUT is not set
 
 #
-# CD-ROM drivers (not for SCSI or IDE/ATAPI drives)
+# Userland interfaces
 #
-# CONFIG_CD_NO_IDESCSI is not set
 
 #
-# Input core support
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_SERIO_CT82C710 is not set
+
+#
+# Input Device Drivers
 #
-# CONFIG_INPUT is not set
 
 #
 # Character devices
 #
 # CONFIG_VT is not set
-# CONFIG_SERIAL is not set
-# CONFIG_SERIAL_EXTENDED is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_UNIX98_PTYS is not set
 
 #
-# I2C support
+# Serial drivers
 #
-# CONFIG_I2C is not set
+# CONFIG_SERIAL_8250 is not set
 
 #
-# Mice
+# Non-8250 serial port support
 #
-# CONFIG_BUSMOUSE is not set
-# CONFIG_MOUSE is not set
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_QIC02_TAPE is not set
 
 #
-# Joysticks
+# IPMI
 #
-# CONFIG_JOYSTICK is not set
-# CONFIG_QIC02_TAPE is not set
+# CONFIG_IPMI_HANDLER is not set
 
 #
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
-# CONFIG_INTEL_RNG is not set
-# CONFIG_NVRAM is not set
 # CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
@@ -330,6 +450,7 @@
 # CONFIG_FTAPE is not set
 # CONFIG_AGP is not set
 # CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
 # Multimedia devices
@@ -337,76 +458,98 @@
 # CONFIG_VIDEO_DEV is not set
 
 #
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
 # File systems
 #
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_FAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
 # CONFIG_ADFS_FS is not set
-# CONFIG_ADFS_FS_RW is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
-# CONFIG_FAT_FS is not set
-# CONFIG_MSDOS_FS is not set
-# CONFIG_UMSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
+CONFIG_JFFS_FS=y
+CONFIG_JFFS_FS_VERBOSE=0
+# CONFIG_JFFS2_FS is not set
 CONFIG_CRAMFS=y
-CONFIG_RAMFS=y
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JOLIET is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_NTFS_DEBUG is not set
-# CONFIG_NTFS_RW is not set
+# CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
-CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-# CONFIG_DEVPTS_FS is not set
 # CONFIG_QNX4FS_FS is not set
-# CONFIG_QNX4FS_RW is not set
-# CONFIG_ROMFS_FS is not set
-# CONFIG_EXT2_FS is not set
 # CONFIG_SYSV_FS is not set
-# CONFIG_SYSV_FS_WRITE is not set
-# CONFIG_UDF_FS is not set
-# CONFIG_UDF_RW is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_UFS_FS_WRITE is not set
 
 #
 # Network File Systems
 #
-# CONFIG_CODA_FS is not set
-# CONFIG_NFS_FS is not set
-# CONFIG_NFS_V3 is not set
-# CONFIG_ROOT_NFS is not set
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
 # CONFIG_NFSD is not set
-# CONFIG_NFSD_V3 is not set
-# CONFIG_SUNRPC is not set
-# CONFIG_LOCKD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+# CONFIG_EXPORTFS is not set
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
-# CONFIG_NCPFS_PACKET_SIGNING is not set
-# CONFIG_NCPFS_IOCTL_LOCKING is not set
-# CONFIG_NCPFS_STRONG is not set
-# CONFIG_NCPFS_NFS_NS is not set
-# CONFIG_NCPFS_OS2_NS is not set
-# CONFIG_NCPFS_SMALLDOS is not set
-# CONFIG_NCPFS_MOUNT_SUBDIR is not set
-# CONFIG_NCPFS_NDS_DOMAINS is not set
-# CONFIG_NCPFS_NLS is not set
-# CONFIG_NCPFS_EXTRAS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_INTERMEZZO_FS is not set
+# CONFIG_AFS_FS is not set
 
 #
 # Partition Types
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
 # CONFIG_NLS is not set
 
 #
@@ -417,9 +560,33 @@
 #
 # USB support
 #
-# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
 
 #
 # Kernel hacking
 #
 # CONFIG_PROFILE is not set
+# CONFIG_ETRAX_KGDB is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_FRAME_POINTER is not set
+
+#
+# Security options
+#
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Library routines
+#
+# CONFIG_CRC32 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
diff -Nru a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile
--- a/arch/cris/kernel/Makefile	Tue Jun 15 22:20:41 2004
+++ b/arch/cris/kernel/Makefile	Tue Jun 15 22:20:41 2004
@@ -1,14 +1,14 @@
-# $Id: Makefile,v 1.8 2003/04/09 05:20:47 starvik Exp $
+# $Id: Makefile,v 1.10 2004/05/14 10:18:12 starvik Exp $
 #
 # Makefile for the linux kernel.
 #
 
-extra-y := vmlinux.lds.s
+extra-y	:= vmlinux.lds.s
 
 obj-y   := process.o traps.o irq.o ptrace.o setup.o \
 	   time.o sys_cris.o semaphore.o
 
-obj-$(CONFIG_MODULES)    += ksyms.o
+obj-$(CONFIG_MODULES)    += crisksyms.o
 obj-$(CONFIG_MODULES)	 += module.o
 
 clean:
diff -Nru a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/cris/kernel/crisksyms.c	Tue Jun 15 22:20:43 2004
@@ -0,0 +1,104 @@
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/user.h>
+#include <linux/elfcore.h>
+#include <linux/sched.h>
+#include <linux/in6.h>
+#include <linux/interrupt.h>
+#include <linux/smp_lock.h>
+#include <linux/pm.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/tty.h>
+
+#include <asm/semaphore.h>
+#include <asm/processor.h>
+#include <asm/uaccess.h>
+#include <asm/checksum.h>
+#include <asm/io.h>
+#include <asm/hardirq.h>
+#include <asm/delay.h>
+#include <asm/irq.h>
+#include <asm/pgtable.h>
+#include <asm/fasttimer.h>
+
+extern void dump_thread(struct pt_regs *, struct user *);
+extern unsigned long get_cmos_time(void);
+extern void __Udiv(void);
+extern void __Umod(void);
+extern void __Div(void);
+extern void __Mod(void);
+extern void __ashrdi3(void);
+extern void iounmap(void *addr);
+
+/* Platform dependent support */
+EXPORT_SYMBOL(dump_thread);
+EXPORT_SYMBOL(enable_irq);
+EXPORT_SYMBOL(disable_irq);
+EXPORT_SYMBOL(kernel_thread);
+EXPORT_SYMBOL(get_cmos_time);
+EXPORT_SYMBOL(loops_per_usec);
+
+/* String functions */
+EXPORT_SYMBOL(memcmp);
+EXPORT_SYMBOL(memmove);
+EXPORT_SYMBOL(strpbrk);
+EXPORT_SYMBOL(strstr);
+EXPORT_SYMBOL(strcpy);
+EXPORT_SYMBOL(strchr);
+EXPORT_SYMBOL(strcmp);
+EXPORT_SYMBOL(strlen);
+EXPORT_SYMBOL(strcat);
+EXPORT_SYMBOL(strncat);
+EXPORT_SYMBOL(strncmp);
+EXPORT_SYMBOL(strncpy);
+
+/* Math functions */
+EXPORT_SYMBOL(__Udiv);
+EXPORT_SYMBOL(__Umod);
+EXPORT_SYMBOL(__Div);
+EXPORT_SYMBOL(__Mod);
+EXPORT_SYMBOL(__ashrdi3);
+
+/* Memory functions */
+EXPORT_SYMBOL(__ioremap);
+EXPORT_SYMBOL(iounmap);
+
+/* Semaphore functions */
+EXPORT_SYMBOL(__up);
+EXPORT_SYMBOL(__down);
+EXPORT_SYMBOL(__down_interruptible);
+EXPORT_SYMBOL(__down_trylock);
+
+/* Export shadow registers for the CPU I/O pins */
+EXPORT_SYMBOL(genconfig_shadow);
+EXPORT_SYMBOL(port_pa_data_shadow);
+EXPORT_SYMBOL(port_pa_dir_shadow);
+EXPORT_SYMBOL(port_pb_data_shadow);
+EXPORT_SYMBOL(port_pb_dir_shadow);
+EXPORT_SYMBOL(port_pb_config_shadow);
+EXPORT_SYMBOL(port_g_data_shadow);
+
+/* Userspace access functions */
+EXPORT_SYMBOL(__copy_user_zeroing);
+EXPORT_SYMBOL(__copy_user);
+
+/* Cache flush functions */
+EXPORT_SYMBOL(flush_etrax_cache);
+EXPORT_SYMBOL(prepare_rx_descriptor);
+
+#undef memcpy
+#undef memset
+extern void * memset(void *, int, __kernel_size_t);
+extern void * memcpy(void *, const void *, __kernel_size_t);
+EXPORT_SYMBOL_NOVERS(memcpy);
+EXPORT_SYMBOL_NOVERS(memset);
+
+#ifdef CONFIG_ETRAX_FAST_TIMER
+/* Fast timer functions */
+EXPORT_SYMBOL(fast_timer_list);
+EXPORT_SYMBOL(start_one_shot_timer);
+EXPORT_SYMBOL(del_fast_timer);
+EXPORT_SYMBOL(schedule_usleep);
+#endif
+
diff -Nru a/arch/cris/kernel/hexify.c b/arch/cris/kernel/hexify.c
--- a/arch/cris/kernel/hexify.c	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,31 +0,0 @@
-#include <stdio.h>
-
-
-void main()
-{
-	int c;
-	int comma=0;
-	int count=0;
-	while((c=getchar())!=EOF)
-	{
-		unsigned char x=c;
-		if(comma)
-			printf(",");
-		else
-			comma=1;
-		if(count==8)
-		{
-			count=0;
-			printf("\n");
-		}
-		if(count==0)
-			printf("\t");
-		printf("0x%02X",c);
-		count++;
-	}
-	if(count)
-		printf("\n");
-	exit(0);
-}
-
-		
diff -Nru a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
--- a/arch/cris/kernel/irq.c	Tue Jun 15 22:21:04 2004
+++ b/arch/cris/kernel/irq.c	Tue Jun 15 22:21:04 2004
@@ -1,4 +1,4 @@
-/* $Id: irq.c,v 1.8 2003/07/04 08:27:52 starvik Exp $
+/*
  *
  *	linux/arch/cris/kernel/irq.c
  *
@@ -99,7 +99,7 @@
 		if (!action) 
 			goto skip;
 		seq_printf(p, "%2d: %10u %c %s",
-			i, kstat_cpu(0).irqs[i],
+			i, kstat_this_cpu.irqs[i],
 			(action->flags & SA_INTERRUPT) ? '+' : ' ',
 			action->name);
 		for (action = action->next; action; action = action->next) {
@@ -129,13 +129,12 @@
 
         cpu = smp_processor_id();
         irq_enter();
-	kstat_cpu(cpu).irqs[irq]++;
+	kstat_cpu(cpu).irqs[irq - FIRST_IRQ]++;
+	action = irq_action[irq - FIRST_IRQ];
 
-	action = irq_action[irq];
         if (action) {
                 if (!(action->flags & SA_INTERRUPT))
                         local_irq_enable();
-                action = irq_action[irq];
                 do_random = 0;
                 do {
                         do_random |= action->flags;
@@ -175,7 +174,7 @@
 	struct irqaction *old, **p;
 	unsigned long flags;
 
-	p = irq_action + irq;
+	p = irq_action + irq - FIRST_IRQ;
 	if ((old = *p) != NULL) {
 		/* Can't share interrupts unless both agree to */
 		if (!(old->flags & new->flags & SA_SHIRQ))
@@ -230,12 +229,6 @@
 	int retval;
 	struct irqaction * action;
 
-	/* interrupts 0 and 1 are hardware breakpoint and NMI and we can't support
-	   these yet. interrupt 15 is the multiple irq, it's special. */
-
-	if(irq < 2 || irq == 15 || irq >= NR_IRQS)
-		return -EINVAL;
-
 	if(!handler)
 		return -EINVAL;
 
@@ -270,7 +263,7 @@
 		printk("Trying to free IRQ%d\n",irq);
 		return;
 	}
-	for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) {
+	for (p = irq - FIRST_IRQ + irq_action; (action = *p) != NULL; p = &action->next) {
 		if (action->dev_id != dev_id)
 			continue;
 
@@ -278,7 +271,7 @@
 		local_save_flags(flags);
 		local_irq_disable();
 		*p = action->next;
-		if (!irq_action[irq]) {
+		if (!irq_action[irq - FIRST_IRQ]) {
 			mask_irq(irq);
 			arch_free_irq(irq);
 		}
diff -Nru a/arch/cris/kernel/ksyms.c b/arch/cris/kernel/ksyms.c
--- a/arch/cris/kernel/ksyms.c	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,96 +0,0 @@
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/user.h>
-#include <linux/elfcore.h>
-#include <linux/sched.h>
-#include <linux/in6.h>
-#include <linux/interrupt.h>
-#include <linux/smp_lock.h>
-#include <linux/pm.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/tty.h>
- 
-#include <asm/semaphore.h>
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-#include <asm/checksum.h>
-#include <asm/io.h>
-#include <asm/hardirq.h>
-#include <asm/delay.h>
-#include <asm/irq.h>
-#include <asm/pgtable.h>
-
-extern void dump_thread(struct pt_regs *, struct user *);
-extern unsigned long get_cmos_time(void);
-extern void __Udiv(void);
-extern void __Umod(void);
-extern void __Div(void);
-extern void __Mod(void);
-extern void __ashrdi3(void);
-extern void iounmap(void *addr);
-
-/* Platform dependent support */
-EXPORT_SYMBOL(dump_thread);
-EXPORT_SYMBOL(enable_irq);
-EXPORT_SYMBOL(disable_irq);
-EXPORT_SYMBOL(kernel_thread);
-EXPORT_SYMBOL(get_cmos_time);
-EXPORT_SYMBOL(loops_per_usec);
-
-/* String functions */
-EXPORT_SYMBOL(memcmp);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(strpbrk);
-EXPORT_SYMBOL(strstr);
-EXPORT_SYMBOL(strcpy);
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strcmp);
-EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strcat);
-EXPORT_SYMBOL(strncat);
-EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(strncpy);
-
-/* Math functions */
-EXPORT_SYMBOL(__Udiv);
-EXPORT_SYMBOL(__Umod);
-EXPORT_SYMBOL(__Div);
-EXPORT_SYMBOL(__Mod);
-EXPORT_SYMBOL(__ashrdi3);
-
-/* Memory functions */
-EXPORT_SYMBOL(__ioremap);
-EXPORT_SYMBOL(iounmap);
-
-/* Semaphore functions */
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down);
-EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__down_trylock);
-
-/* Export shadow registers for the CPU I/O pins */
-EXPORT_SYMBOL(genconfig_shadow);
-EXPORT_SYMBOL(port_pa_data_shadow);
-EXPORT_SYMBOL(port_pa_dir_shadow);
-EXPORT_SYMBOL(port_pb_data_shadow);
-EXPORT_SYMBOL(port_pb_dir_shadow);
-EXPORT_SYMBOL(port_pb_config_shadow);
-EXPORT_SYMBOL(port_g_data_shadow);
-
-/* Userspace access functions */
-EXPORT_SYMBOL(__copy_user_zeroing);
-EXPORT_SYMBOL(__copy_user);
-
-/* Cache flush functions */
-EXPORT_SYMBOL(flush_etrax_cache);
-EXPORT_SYMBOL(prepare_rx_descriptor);
-
-#undef memcpy
-#undef memset
-extern void * memset(void *, int, __kernel_size_t);
-extern void * memcpy(void *, const void *, __kernel_size_t);
-EXPORT_SYMBOL_NOVERS(memcpy);
-EXPORT_SYMBOL_NOVERS(memset);
-
-
diff -Nru a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
--- a/arch/cris/kernel/module.c	Tue Jun 15 22:20:39 2004
+++ b/arch/cris/kernel/module.c	Tue Jun 15 22:20:39 2004
@@ -75,8 +75,6 @@
 		sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
 			+ ELF32_R_SYM(rel[i].r_info);
 
-                /* TODO: This is probably not correct */
-                printk("Beware: untested code in module.c!\n");
                 /* We add the value into the location given */
                 *location += sym->st_value;
 	}
@@ -89,9 +87,26 @@
 		       unsigned int relsec,
 		       struct module *me)
 {
-	printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
-	       me->name);
-	return -ENOEXEC;
+  	unsigned int i;
+	Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
+
+	DEBUGP ("Applying relocate section %u to %u\n", relsec,
+		sechdrs[relsec].sh_info);
+
+	for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) {
+		/* This is where to make the change */
+		uint32_t *loc
+			= ((void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+			   + rela[i].r_offset);
+		/* This is the symbol it is referring to.  Note that all
+		   undefined symbols have been resolved.  */
+		Elf32_Sym *sym
+			= ((Elf32_Sym *)sechdrs[symindex].sh_addr
+			   + ELF32_R_SYM (rela[i].r_info));
+		*loc = sym->st_value + rela[i].r_addend;
+	}
+
+	return 0;
 }
 
 int module_finalize(const Elf_Ehdr *hdr,
diff -Nru a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
--- a/arch/cris/kernel/process.c	Tue Jun 15 22:20:42 2004
+++ b/arch/cris/kernel/process.c	Tue Jun 15 22:20:42 2004
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.14 2003/06/10 10:21:12 johana Exp $
+/* $Id: process.c,v 1.17 2004/04/05 13:53:48 starvik Exp $
  * 
  *  linux/arch/cris/kernel/process.c
  *
@@ -8,9 +8,18 @@
  *  Authors:   Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: process.c,v $
+ *  Revision 1.17  2004/04/05 13:53:48  starvik
+ *  Merge of Linux 2.6.5
+ *
+ *  Revision 1.16  2003/10/27 08:04:33  starvik
+ *  Merge of Linux 2.6.0-test9
+ *
+ *  Revision 1.15  2003/09/11 07:29:52  starvik
+ *  Merge of Linux 2.6.0-test5
+ *
  *  Revision 1.14  2003/06/10 10:21:12  johana
  *  Moved thread_saved_pc() from arch/cris/kernel/process.c to
- *  subarch specific process.c. 
+ *  subarch specific process.c. arch-v32 has an erp, no irp.
  *
  *  Revision 1.13  2003/04/09 05:20:47  starvik
  *  Merge of Linux 2.5.67
@@ -94,6 +103,7 @@
 #include <asm/atomic.h>
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
+#include <asm/irq.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <linux/fs_struct.h>
@@ -182,13 +192,17 @@
 {
 	/* endless idle loop with no priority at all */
 	while (1) {
-		void (*idle)(void) = pm_idle;
-		if (!idle)
-			idle = default_idle;
-		while (!need_resched())
+		while (!need_resched()) {
+			void (*idle)(void) = pm_idle;
+
+			if (!idle)
+				idle = default_idle;
+
 			idle();
+		}
 		schedule();
 	}
+
 }
 
 void hard_reset_now (void);
diff -Nru a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
--- a/arch/cris/kernel/setup.c	Tue Jun 15 22:20:58 2004
+++ b/arch/cris/kernel/setup.c	Tue Jun 15 22:20:58 2004
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.7 2003/07/04 08:27:52 starvik Exp $
+/*
  *
  *  linux/arch/cris/kernel/setup.c
  *
@@ -10,6 +10,7 @@
  * This file handles the architecture-dependent parts of initialization
  */
 
+#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
@@ -38,6 +39,8 @@
 
 extern unsigned long romfs_start, romfs_length, romfs_in_flash; /* from head.S */
 
+extern void show_etrax_copyright(void);		/* arch-vX/kernel/setup.c */
+
 /* This mainly sets up the memory area, and can be really confusing.
  *
  * The physical DRAM is virtually mapped into dram_start to dram_end
@@ -153,18 +156,16 @@
 	*cmdline_p = command_line;
 
 #ifdef CONFIG_ETRAX_CMDLINE
-	strlcpy(command_line, CONFIG_ETRAX_CMDLINE, sizeof(command_line));
-#elif defined(CONFIG_ETRAX_ROOT_DEVICE)
-	strlcpy(command_line, "root=", sizeof(command_line));
-	strlcat(command_line, CONFIG_ETRAX_ROOT_DEVICE,
-		sizeof(command_line));
-#endif
+	strlcpy(command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE);
 	command_line[COMMAND_LINE_SIZE - 1] = '\0';
 
-	/* give credit for the CRIS port */
-
-	printk("Linux/CRIS port on ETRAX 100LX (c) 2001 Axis Communications AB\n");
+	/* Save command line for future references. */
+	memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
+	saved_command_line[COMMAND_LINE_SIZE - 1] = '\0';
+#endif
 
+	/* give credit for the CRIS port */
+	show_etrax_copyright();
 }
 
 static void *c_start(struct seq_file *m, loff_t *pos)
diff -Nru a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
--- a/arch/cris/kernel/sys_cris.c	Tue Jun 15 22:20:36 2004
+++ b/arch/cris/kernel/sys_cris.c	Tue Jun 15 22:20:36 2004
@@ -1,4 +1,4 @@
-/* $Id: sys_cris.c,v 1.5 2003/07/04 08:27:52 starvik Exp $
+/* $Id: sys_cris.c,v 1.6 2004/03/11 11:38:40 starvik Exp $
  *
  * linux/arch/cris/kernel/sys_cris.c
  *
diff -Nru a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
--- a/arch/cris/kernel/time.c	Tue Jun 15 22:20:41 2004
+++ b/arch/cris/kernel/time.c	Tue Jun 15 22:20:41 2004
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.9 2003/07/04 08:27:52 starvik Exp $
+/* $Id: time.c,v 1.14 2004/06/01 05:38:11 starvik Exp $
  *
  *  linux/arch/cris/kernel/time.c
  *
@@ -29,6 +29,7 @@
 #include <linux/jiffies.h>
 #include <linux/bcd.h>
 #include <linux/timex.h>
+#include <linux/init.h>
 
 u64 jiffies_64 = INITIAL_JIFFIES;
 
@@ -39,6 +40,8 @@
 #define TICK_SIZE tick
 
 extern unsigned long wall_jiffies;
+extern unsigned long loops_per_jiffy; /* init/main.c */
+unsigned long loops_per_usec;
 
 extern unsigned long do_slow_gettimeoffset(void);
 static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
@@ -62,6 +65,15 @@
 		if (lost)
 			usec += lost * (1000000 / HZ);
 	}
+
+        /*
+	 * If time_adjust is negative then NTP is slowing the clock
+	 * so make sure not to go into next possible interval.
+	 * Better to lose some accuracy than have time go backwards..
+	 */
+	if (unlikely(time_adjust < 0) && usec > tickadj)
+		usec = tickadj;
+
 	sec = xtime.tv_sec;
 	usec += xtime.tv_nsec / 1000;
 	local_irq_restore(flags);
@@ -79,35 +91,33 @@
 
 int do_settimeofday(struct timespec *tv)
 {
-	unsigned long flags;
+	time_t wtm_sec, sec = tv->tv_sec;
+	long wtm_nsec, nsec = tv->tv_nsec;
 
-        if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
+	if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
 		return -EINVAL;
 
-	local_irq_save(flags);
-	local_irq_disable();
-
-	/* This is revolting. We need to set the xtime.tv_usec
-	 * correctly. However, the value in this location is
-	 * is value at the last tick.
-	 * Discover what correction gettimeofday
-	 * would have done, and then undo it!
+	write_seqlock_irq(&xtime_lock);
+	/*
+	 * This is revolting. We need to set "xtime" correctly. However, the
+	 * value in this location is the value at the most recent update of
+	 * wall time.  Discover what correction gettimeofday() would have
+	 * made, and then undo it!
 	 */
-	tv->tv_nsec -= do_gettimeoffset() * 1000;
-        tv->tv_nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
+	nsec -= do_gettimeoffset() * NSEC_PER_USEC;
+	nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
+
+	wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
+	wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
+
+	set_normalized_timespec(&xtime, sec, nsec);
+	set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
 
-	while (tv->tv_nsec < 0) {
-		tv->tv_nsec += NSEC_PER_SEC;
-		tv->tv_sec--;
-	}
-	xtime.tv_sec = tv->tv_sec;
-	xtime.tv_nsec = tv->tv_nsec;
 	time_adjust = 0;		/* stop active adjtime() */
 	time_status |= STA_UNSYNC;
-	time_state = TIME_ERROR;	/* p. 24, (a) */
 	time_maxerror = NTP_PHASE_LIMIT;
 	time_esterror = NTP_PHASE_LIMIT;
-	local_irq_restore(flags);
+	write_sequnlock_irq(&xtime_lock);
 	clock_was_set();
 	return 0;
 }
@@ -125,7 +135,7 @@
 	int retval = 0;
 	int real_seconds, real_minutes, cmos_minutes;
 
-	printk("set_rtc_mmss(%lu)\n", nowtime);
+	printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime);
 
 	if(!have_rtc)
 		return 0;
@@ -174,7 +184,8 @@
 	mon = CMOS_READ(RTC_MONTH);
 	year = CMOS_READ(RTC_YEAR);
 
-	printk("rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n", 
+	printk(KERN_DEBUG
+	       "rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n",
 	       sec, min, hour, day, mon, year);
 
 	BCD_TO_BIN(sec);
@@ -202,3 +213,20 @@
 		xtime.tv_nsec = 0;
 	}
 }
+
+/*
+ * Scheduler clock - returns current time in nanosec units.
+ */
+unsigned long long sched_clock(void)
+{
+	return (unsigned long long)jiffies * (1000000000 / HZ);
+}
+
+static int
+__init init_udelay(void)
+{
+	loops_per_usec = (loops_per_jiffy * HZ) / 1000000;
+	return 0;
+}
+
+__initcall(init_udelay);
diff -Nru a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
--- a/arch/cris/kernel/traps.c	Tue Jun 15 22:20:44 2004
+++ b/arch/cris/kernel/traps.c	Tue Jun 15 22:20:44 2004
@@ -1,4 +1,4 @@
-/* $Id: traps.c,v 1.7 2003/07/04 08:27:52 starvik Exp $
+/* $Id: traps.c,v 1.9 2004/05/11 12:28:26 starvik Exp $
  *
  *  linux/arch/cris/traps.c
  *
@@ -14,6 +14,7 @@
  */
 
 #include <linux/init.h>
+#include <linux/module.h>
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
 
diff -Nru a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
--- a/arch/cris/mm/fault.c	Tue Jun 15 22:20:44 2004
+++ b/arch/cris/mm/fault.c	Tue Jun 15 22:20:44 2004
@@ -6,9 +6,18 @@
  *  Authors:  Bjorn Wesen 
  * 
  *  $Log: fault.c,v $
+ *  Revision 1.11  2004/05/14 07:58:05  starvik
+ *  Merge of changes from 2.4
+ *
+ *  Revision 1.10  2003/10/27 14:51:24  starvik
+ *  Removed debugcode
+ *
+ *  Revision 1.9  2003/10/27 14:50:42  starvik
+ *  Changed do_page_fault signature
+ *
  *  Revision 1.8  2003/07/04 13:02:48  tobiasa
  *  Moved code snippet from arch/cris/mm/fault.c that searches for fixup code
- *  to separate function in arch-specific files.
+ *  to seperate function in arch-specific files.
  *
  *  Revision 1.7  2003/01/22 06:48:38  starvik
  *  Fixed warnings issued by GCC 3.2.1
@@ -95,10 +104,6 @@
 extern int find_fixup_code(struct pt_regs *);
 extern void die_if_kernel(const char *, struct pt_regs *, long);
 
-asmlinkage void do_invalid_op (struct pt_regs *, unsigned long);
-asmlinkage void do_page_fault(unsigned long address, struct pt_regs *regs,
-			      int error_code);
-
 /* debug of low-level TLB reload */
 #undef DEBUG
 
@@ -134,14 +139,16 @@
 
 asmlinkage void
 do_page_fault(unsigned long address, struct pt_regs *regs,
-	      int error_code)
+	      int protection, int writeaccess)
 {
 	struct task_struct *tsk;
 	struct mm_struct *mm;
 	struct vm_area_struct * vma;
-	int writeaccess;
 	siginfo_t info;
 
+        D(printk("Page fault for %X at %X, prot %d write %d\n",
+                 address, regs->erp, protection, writeaccess));
+
 	tsk = current;
 
 	/*
@@ -164,7 +171,7 @@
 	 */
 
 	if (address >= VMALLOC_START &&
-	    !(error_code & 1) &&
+	    !protection &&
 	    !user_mode(regs))
 		goto vmalloc_fault;
 
@@ -172,7 +179,6 @@
 	sti();
 
 	mm = tsk->mm;
-	writeaccess = error_code & 2;
 	info.si_code = SEGV_MAPERR;
 
 	/*
@@ -291,7 +297,7 @@
 		printk(KERN_ALERT "Unable to handle kernel access");
 	printk(" at virtual address %08lx\n",address);
 
-	die_if_kernel("Oops", regs, error_code);
+	die_if_kernel("Oops", regs, (writeaccess << 1) | protection);
 
 	do_exit(SIGKILL);
 
diff -Nru a/arch/cris/mm/init.c b/arch/cris/mm/init.c
--- a/arch/cris/mm/init.c	Tue Jun 15 22:20:40 2004
+++ b/arch/cris/mm/init.c	Tue Jun 15 22:20:40 2004
@@ -7,6 +7,13 @@
  *  Authors:  Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: init.c,v $
+ *  Revision 1.11  2004/05/28 09:28:56  starvik
+ *  Calculation of loops_per_usec moved because initalization order has changed
+ *  in Linux 2.6.
+ *
+ *  Revision 1.10  2004/05/14 07:58:05  starvik
+ *  Merge of changes from 2.4
+ *
  *  Revision 1.9  2003/07/04 08:27:54  starvik
  *  Merge of Linux 2.5.74
  *
@@ -120,9 +127,6 @@
 
 unsigned long empty_zero_page;
 
-extern unsigned long loops_per_jiffy; /* init/main.c */
-unsigned long loops_per_usec;
-
 extern char _stext, _edata, _etext; /* From linkerscript */
 extern char __init_begin, __init_end;
 
@@ -190,7 +194,8 @@
         datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
         initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
 	
-        printk("Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, "
+        printk(KERN_INFO
+               "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, "
 	       "%dk init)\n" ,
 	       (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
 	       max_mapnr << (PAGE_SHIFT-10),
@@ -199,16 +204,6 @@
 	       datasize >> 10,
 	       initsize >> 10
                );
-
-	/* HACK alert - calculate a loops_per_usec for asm/delay.h here
-	 * since this is called just after calibrate_delay in init/main.c
-	 * but before places which use udelay. cannot be in time.c since
-	 * that is called _before_ calibrate_delay
-	 */
-
-	loops_per_usec = (loops_per_jiffy * HZ) / 1000000;
-
-	return;
 }
 
 /* free the pages occupied by initialization code */
@@ -225,6 +220,6 @@
                 free_page(addr);
                 totalram_pages++;
         }
-        printk ("Freeing unused kernel memory: %luk freed\n", 
+        printk (KERN_INFO "Freeing unused kernel memory: %luk freed\n",
 		(unsigned long)((&__init_end - &__init_begin) >> 10));
 }
diff -Nru a/arch/cris/mm/ioremap.c b/arch/cris/mm/ioremap.c
--- a/arch/cris/mm/ioremap.c	Tue Jun 15 22:20:37 2004
+++ b/arch/cris/mm/ioremap.c	Tue Jun 15 22:20:37 2004
@@ -118,31 +118,6 @@
 	if (!size || last_addr < phys_addr)
 		return NULL;
 
-#if 0
-	/* TODO: Here we can put checks for driver-writer abuse...  */
-
-	/*
-	 * Don't remap the low PCI/ISA area, it's always mapped..
-	 */
-	if (phys_addr >= 0xA0000 && last_addr < 0x100000)
-		return phys_to_virt(phys_addr);
-
-	/*
-	 * Don't allow anybody to remap normal RAM that we're using..
-	 */
-	if (phys_addr < virt_to_phys(high_memory)) {
-		char *t_addr, *t_end;
-		struct page *page;
-
-		t_addr = __va(phys_addr);
-		t_end = t_addr + (size - 1);
-	   
-		for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
-			if(!PageReserved(page))
-				return NULL;
-	}
-#endif
-
 	/*
 	 * Mappings have to be page-aligned
 	 */
diff -Nru a/arch/h8300/Kconfig b/arch/h8300/Kconfig
--- a/arch/h8300/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/h8300/Kconfig	Tue Jun 15 22:20:43 2004
@@ -43,122 +43,7 @@
 
 source "init/Kconfig"
 
-menu "Processor type and features"
-
-choice
-	prompt "H8/300 platform"
-	default H8300H_GENERIC
-
-config H8300H_GENERIC
-	bool "Generic"
-	help
-	  H8/300H CPU Generic Hardware Support
-
-config H8300H_AKI3068NET
-	bool "AE-3068/69"
-	help
-	  AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support
-	  More Information. (Japanese Only)
-	  <http://akizukidensi.com/catalog/h8.html>
-	  AE-3068/69 Evaluation Board Support
-	  More Information.
-	  <http://www.microtronique.com/ae3069lan.htm>
-
-config H8300H_H8MAX
-	bool "H8MAX"
-	help
-	  H8MAX Evaluation Board Support
-	  More Information. (Japanese Only)
-	  <http://strawberry-linux.com/h8/index.html>
-
-config H8300H_SIM
-	bool "H8/300H Simulator"
-	help
-	  GDB Simulator Support
-	  More Information.
-	  arch/h8300/Doc/simulator.txt
-
-config H8S_EDOSK2674
-	bool "EDOSK-2674"
-	help
-	  Renesas EDOSK-2674 Evaluation Board Support
-	  More Information.
-	  <http://www.azpower.com/H8-uClinux/index.html>
- 	  <http://www.eu.renesas.com/tools/edk/support/edosk2674.html>
-
-config H8S_SIM
-	bool "H8S Simulator"
-	help
-	  GDB Simulator Support
-	  More Information.
-	  arch/h8300/Doc/simulator.txt
-
-endchoice
-
-choice 
-	prompt "CPU Selection"
-
-config H83002
-	bool "H8/3001,3002,3003"
-	depends on H8300H_GENERIC
-
-config H83007
-	bool "H8/3006,3007"
-	depends on (H8300H_GENERIC || H8300H_SIM)
-
-config H83048
-	bool "H8/3044,3045,3046,3047,3048,3052"
-	depends on H8300H_GENERIC
-
-config H83068
-	bool "H8/3065,3066,3067,3068,3069"
-	depends on (H8300H_GENERIC || H8300H_AKI3068NET || H8300H_H8MAX)
-
-config H8S2678
-	bool "H8S/2670,2673,2674R,2675,2676"
-	depends on (H8S_GENERIC || H8S_EDOSK2674 || H8S_SIM)
-
-endchoice
-
-config CPU_H8300H
-	bool
-	depends on (H8300H_GENERIC || H8300H_AKI3068NET || H8300H_H8MAX || H8300H_SIM)
-	default y
-
-config CPU_H8S
-	bool
-	depends on (H8S_GENERIC || H8S_EDOSK2674 || H8S_SIM)
-	default y
-
-config CPU_CLOCK
-	int "CPU Clock Frequency (/1KHz)"	
-	default "20000" if H8300H_AKI3068NET
-	default "25000" if H8300H_H8MAX
-	default "16000" if H8300H_SIM
-	default "16000" if H8300H_GENERIC
-	default "33000" if H8S_GENERIC
-	default "33000" if H8S_SIM
-	default "33000" if H8S_EDOSK2674
-	help
-	  CPU Clock Frequency divide to 1000
-choice
-	prompt "Kernel executes from"
-	---help---
-	  Choose the memory type that the kernel will be running in.
-
-config RAMKERNEL
-	bool "RAM"
-	help
-	  The kernel will be resident in RAM when running.
-
-config ROMKERNEL
-	bool "ROM"
-	help
-	  The kernel will be resident in FLASH/ROM when running.
-
-endchoice
-
-endmenu
+source "arch/h8300/Kconfig.cpu"
 
 menu "Executable file formats"
 
diff -Nru a/arch/h8300/Kconfig.cpu b/arch/h8300/Kconfig.cpu
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/h8300/Kconfig.cpu	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,183 @@
+menu "Processor type and features"
+
+choice
+	prompt "H8/300 platform"
+	default H8300H_GENERIC
+
+config H8300H_GENERIC
+	bool "H8/300H Generic"
+	help
+	  H8/300H CPU Generic Hardware Support
+
+config H8300H_AKI3068NET
+	bool "AE-3068/69"
+	help
+	  AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support
+	  More Information. (Japanese Only)
+	  <http://akizukidensi.com/catalog/h8.html>
+	  AE-3068/69 Evaluation Board Support
+	  More Information.
+	  <http://www.microtronique.com/ae3069lan.htm>
+
+config H8300H_H8MAX
+	bool "H8MAX"
+	help
+	  H8MAX Evaluation Board Support
+	  More Information. (Japanese Only)
+	  <http://strawberry-linux.com/h8/index.html>
+
+config H8300H_SIM
+	bool "H8/300H Simulator"
+	help
+	  GDB Simulator Support
+	  More Information.
+	  arch/h8300/Doc/simulator.txt
+
+config H8S_GENERIC
+	bool "H8S Generic"
+	help
+	  H8S CPU Generic Hardware Support
+
+config H8S_EDOSK2674
+	bool "EDOSK-2674"
+	help
+	  Renesas EDOSK-2674 Evaluation Board Support
+	  More Information.
+	  <http://www.azpower.com/H8-uClinux/index.html>
+ 	  <http://www.eu.renesas.com/tools/edk/support/edosk2674.html>
+
+config H8S_SIM
+	bool "H8S Simulator"
+	help
+	  GDB Simulator Support
+	  More Information.
+	  arch/h8300/Doc/simulator.txt
+
+endchoice
+
+if (H8300H_GENERIC || H8S_GENERIC)
+menu "Detail Selection"
+if (H8300H_GENERIC)
+choice
+	prompt "CPU Selection"
+
+config H83002
+	bool "H8/3001,3002,3003"
+
+config H83007
+	bool "H8/3006,3007"
+
+config H83048
+	bool "H8/3044,3045,3046,3047,3048,3052"
+
+config H83068
+	bool "H8/3065,3066,3067,3068,3069"
+endchoice
+endif
+
+if (H8S_GENERIC)
+choice
+	prompt "CPU Selection"
+
+config H8S2678
+	bool "H8S/2670,2673,2674R,2675,2676"
+endchoice
+endif
+
+config CPU_CLOCK
+	int "CPU Clock Frequency (/1KHz)"
+	default "20000"
+	help
+	  CPU Clock Frequency divide to 1000
+endmenu
+endif
+
+if (H8300H_GENERIC || H8S_GENERIC || H8300H_SIM || H8S_SIM || H8S_EDOSK2674)
+choice
+	prompt "Kernel executes from"
+	---help---
+	  Choose the memory type that the kernel will be running in.
+
+config RAMKERNEL
+	bool "RAM"
+	help
+	  The kernel will be resident in RAM when running.
+
+config ROMKERNEL
+	bool "ROM"
+	help
+	  The kernel will be resident in FLASH/ROM when running.
+
+endchoice
+endif
+
+if (H8300H_AKI3068NET)
+config H83068
+	bool
+	default y
+
+config CPU_CLOCK
+	int
+	default "20000"
+
+config RAMKERNEL
+	bool
+	default y
+endif
+
+if (H8300H_H8MAX)
+config H83068
+	bool
+	default y
+
+config CPU_CLOCK
+	int
+	default 25000
+
+config RAMKERNEL
+	bool
+	default y
+endif
+
+if (H8300H_SIM)
+config H83007
+	bool
+	default y
+
+config CPU_CLOCK
+	int
+	default "16000"
+endif
+
+if (H8S_EDOSK2674)
+config H8S2678
+	bool
+	default y
+config CPU_CLOCK
+	int
+	default 33000
+endif
+
+if (H8S_SIM)
+config H8S2678
+	bool
+	default y
+config CPU_CLOCK
+	int
+	default 33000
+endif
+
+config CPU_H8300H
+	bool
+	depends on (H8002 || H83007 || H83048 || H83068)
+	default y
+
+config CPU_H8S
+	bool
+	depends on H8S2678
+	default y
+
+config PREEMPT
+	bool "Preemptible Kernel"
+	default n
+endmenu
diff -Nru a/arch/h8300/Kconfig.ide b/arch/h8300/Kconfig.ide
--- a/arch/h8300/Kconfig.ide	Tue Jun 15 22:20:44 2004
+++ b/arch/h8300/Kconfig.ide	Tue Jun 15 22:20:44 2004
@@ -1,23 +1,44 @@
 # uClinux H8/300 Target Board Selection Menu (IDE)
 
+if (H8300H_AKI3068NET)
 menu "IDE Extra configuration"
 
 config H8300_IDE_BASE
-	hex "IDE regitser base address"
+	hex "IDE register base address"
 	depends on IDE
+	default 0
 	help
 	  IDE registers base address
 
 config H8300_IDE_ALT
-	hex "IDE regitser alternate address"
+	hex "IDE register alternate address"
 	depends on IDE
+	default 0
 	help
 	  IDE alternate registers address
 
 config H8300_IDE_IRQ
 	int "IDE IRQ no"
 	depends on IDE
+	default 0
 	help
-	  IDE I/F using IRQ no
-
+	  IDE use IRQ no
 endmenu
+endif
+
+if (H8300H_H8MAX)
+config H8300_IDE_BASE
+	hex
+	depends on IDE
+	default 0x200000
+
+config H8300_IDE_ALT
+	hex
+	depends on IDE
+	default 0x60000c
+
+config H8300_IDE_IRQ
+	int
+	depends on IDE
+	default 5
+endif
diff -Nru a/arch/h8300/Makefile b/arch/h8300/Makefile
--- a/arch/h8300/Makefile	Tue Jun 15 22:20:37 2004
+++ b/arch/h8300/Makefile	Tue Jun 15 22:20:37 2004
@@ -62,12 +62,7 @@
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
 
-prepare: include/asm-$(ARCH)/machine-depend.h include/asm-$(ARCH)/asm-offsets.h
-
-include/asm-$(ARCH)/machine-depend.h: include/asm-$(ARCH)/$(BOARD)/machine-depend.h
-	$(Q)ln -sf $(BOARD)/machine-depend.h \
-                   include/asm-$(ARCH)/machine-depend.h
-	@echo '  Create include/asm-$(ARCH)/machine-depend.h'
+prepare: include/asm-$(ARCH)/asm-offsets.h
 
 include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \
 				   include/asm include/linux/version.h
@@ -81,4 +76,4 @@
   echo  'vmlinux.srec - Create srec binary'
 endef
 
-CLEAN_FILES += include/asm-$(ARCH)/asm-offsets.h include/asm-$(ARCH)/machine-depend.h
+CLEAN_FILES += include/asm-$(ARCH)/asm-offsets.h
diff -Nru a/arch/h8300/kernel/Makefile b/arch/h8300/kernel/Makefile
--- a/arch/h8300/kernel/Makefile	Tue Jun 15 22:20:41 2004
+++ b/arch/h8300/kernel/Makefile	Tue Jun 15 22:20:41 2004
@@ -6,5 +6,6 @@
 
 obj-y := process.o traps.o ptrace.o ints.o \
 	 sys_h8300.o time.o semaphore.o signal.o \
-         setup.o h8300_ksyms.o gpio.o init_task.o \
-         syscalls.o
+         setup.o gpio.o init_task.o syscalls.o
+
+obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o 
diff -Nru a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c
--- a/arch/h8300/kernel/h8300_ksyms.c	Tue Jun 15 22:21:02 2004
+++ b/arch/h8300/kernel/h8300_ksyms.c	Tue Jun 15 22:21:02 2004
@@ -17,6 +17,7 @@
 #include <asm/checksum.h>
 #include <asm/hardirq.h>
 #include <asm/current.h>
+#include <asm/gpio.h>
 
 //asmlinkage long long __ashrdi3 (long long, int);
 //asmlinkage long long __lshrdi3 (long long, int);
@@ -38,9 +39,9 @@
 
 EXPORT_SYMBOL(ip_fast_csum);
 
-EXPORT_SYMBOL(mach_enable_irq);
-EXPORT_SYMBOL(mach_disable_irq);
 EXPORT_SYMBOL(kernel_thread);
+EXPORT_SYMBOL(enable_irq);
+EXPORT_SYMBOL(disable_irq);
 
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy);
@@ -103,10 +104,10 @@
 EXPORT_SYMBOL_NOVERS(__umoddi3);
 EXPORT_SYMBOL_NOVERS(__umodsi3);
 
-EXPORT_SYMBOL_NOVERS(_current_task);
-
+#ifdef MAGIC_ROM_PTR
 EXPORT_SYMBOL_NOVERS(is_in_rom);
+#endif
 
-EXPORT_SYMBOL_NOVERS(h8300_reserved_gpio)
-EXPORT_SYMBOL_NOVERS(h8300_free_gpio)
-EXPORT_SYMBOL_NOVERS(h8300_set_gpio_dir)
+EXPORT_SYMBOL_NOVERS(h8300_reserved_gpio);
+EXPORT_SYMBOL_NOVERS(h8300_free_gpio);
+EXPORT_SYMBOL_NOVERS(h8300_set_gpio_dir);
diff -Nru a/arch/h8300/kernel/module.c b/arch/h8300/kernel/module.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/h8300/kernel/module.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,122 @@
+#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(Elf32_Shdr *sechdrs,
+		   const char *strtab,
+		   unsigned int symindex,
+		   unsigned int relsec,
+		   struct module *me)
+{
+	printk(KERN_ERR "module %s: RELOCATION unsupported\n",
+	       me->name);
+	return -ENOEXEC;
+}
+
+int apply_relocate_add(Elf32_Shdr *sechdrs,
+		       const char *strtab,
+		       unsigned int symindex,
+		       unsigned int relsec,
+		       struct module *me)
+{
+	unsigned int i;
+	Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
+
+	DEBUGP("Applying relocate section %u to %u\n", relsec,
+	       sechdrs[relsec].sh_info);
+	for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) {
+		/* This is where to make the change */
+		uint32_t *loc = (uint32_t *)(sechdrs[sechdrs[relsec].sh_info].sh_addr
+					     + rela[i].r_offset);
+		/* This is the symbol it is referring to.  Note that all
+		   undefined symbols have been resolved.  */
+		Elf32_Sym *sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+			+ ELF32_R_SYM(rela[i].r_info);
+		uint32_t v = sym->st_value + rela[i].r_addend;
+
+		switch (ELF32_R_TYPE(rela[i].r_info)) {
+		case R_H8_DIR24R8:
+			loc = (uint32_t *)((uint32_t)loc - 1);
+			*loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v);
+			break;
+		case R_H8_DIR24A8:
+			if (ELF32_R_SYM(rela[i].r_info))
+				*loc += v;
+			break;
+		case R_H8_DIR32:
+		case R_H8_DIR32A16:
+			*loc += v;
+			break;
+		case R_H8_PCREL16:
+			v -= (unsigned long)loc + 2;
+			if ((Elf32_Sword)v > 0x7fff || 
+			    (Elf32_Sword)v < -(Elf32_Sword)0x8000)
+				goto overflow;
+			else 
+				*(unsigned short *)loc = v;
+			break;
+		case R_H8_PCREL8:
+			v -= (unsigned long)loc + 1;
+			if ((Elf32_Sword)v > 0x7f || 
+			    (Elf32_Sword)v < -(Elf32_Sword)0x80)
+				goto overflow;
+			else 
+				*(unsigned char *)loc = v;
+			break;
+		default:
+			printk(KERN_ERR "module %s: Unknown relocation: %u\n",
+			       me->name, ELF32_R_TYPE(rela[i].r_info));
+			return -ENOEXEC;
+		}
+	}
+	return 0;
+ overflow:
+	printk(KERN_ERR "module %s: relocation offset overflow: %08x\n",
+	       me->name, rela[i].r_offset);
+	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/h8300/kernel/process.c b/arch/h8300/kernel/process.c
--- a/arch/h8300/kernel/process.c	Tue Jun 15 22:20:35 2004
+++ b/arch/h8300/kernel/process.c	Tue Jun 15 22:20:35 2004
@@ -55,9 +55,9 @@
 {
 	while(1) {
 		if (need_resched()) {
-			sti();
+			local_irq_enable();
 			__asm__("sleep");
-			cli();
+			local_irq_disable();
 		}
 		schedule();
 	}
@@ -112,14 +112,13 @@
 
 void show_regs(struct pt_regs * regs)
 {
-	printk("\n");
-	printk("PC: %08lx  Status: %02x\n",
+	printk("\nPC: %08lx  Status: %02x",
 	       regs->pc, regs->ccr);
-	printk("ORIG_ER0: %08lx ER0: %08lx ER1: %08lx\n",
+	printk("\nORIG_ER0: %08lx ER0: %08lx ER1: %08lx",
 	       regs->orig_er0, regs->er0, regs->er1);
-	printk("ER2: %08lx ER3: %08lx ER4: %08lx ER5: %08lx\n",
+	printk("\nER2: %08lx ER3: %08lx ER4: %08lx ER5: %08lx",
 	       regs->er2, regs->er3, regs->er4, regs->er5);
-	printk("ER6' %08lx ",regs->er6);
+	printk("\nER6' %08lx ",regs->er6);
 	if (user_mode(regs))
 		printk("USP: %08lx\n", rdusp());
 	else
@@ -261,12 +260,6 @@
 	return error;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 unsigned long thread_saved_pc(struct task_struct *tsk)
 {
 	return ((struct pt_regs *)tsk->thread.esp0)->pc;
@@ -287,7 +280,7 @@
 		    fp >= 8184+stack_page)
 			return 0;
 		pc = ((unsigned long *)fp)[1];
-		if (pc < first_sched || pc >= last_sched)
+		if (!in_sched_functions(pc))
 			return pc;
 		fp = *(unsigned long *) fp;
 	} while (count++ < 16);
diff -Nru a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
--- a/arch/h8300/kernel/setup.c	Tue Jun 15 22:20:37 2004
+++ b/arch/h8300/kernel/setup.c	Tue Jun 15 22:20:37 2004
@@ -40,16 +40,12 @@
 
 #if defined(__H8300H__)
 #define CPU "H8/300H"
+#include <asm/regs306x.h>
 #endif
 
 #if defined(__H8300S__)
 #define CPU "H8S"
-#endif
-
-#if defined(CONFIG_INTELFLASH)
-#define BLKOFFSET 512
-#else
-#define BLKOFFSET 0
+#include <asm/regs267x.h>
 #endif
 
 #define STUBSIZE 0xc000;
@@ -58,8 +54,6 @@
 unsigned long memory_start;
 unsigned long memory_end;
 
-struct task_struct *_current_task;
-
 char command_line[512];
 char saved_command_line[512];
 
@@ -107,12 +101,11 @@
 	memory_start = (unsigned long) &_ramstart;
 
 	/* allow for ROMFS on the end of the kernel */
-	if (memcmp((void *)(memory_start + BLKOFFSET), "-rom1fs-", 8) == 0) {
+	if (memcmp((void *)memory_start, "-rom1fs-", 8) == 0) {
 #if defined(CONFIG_BLK_DEV_INITRD)
-		initrd_start = memory_start += BLKOFFSET;
+		initrd_start = memory_start;
 		initrd_end = memory_start += be32_to_cpu(((unsigned long *) (memory_start))[2]);
 #else
-		memory_start += BLKOFFSET;
 		memory_start += be32_to_cpu(((unsigned long *) memory_start)[2]);
 #endif
 	}
@@ -190,6 +183,16 @@
 	 */
 	paging_init();
 	h8300_gpio_init();
+#if defined(CONFIG_H8300_AKI3068NET) && defined(CONFIG_IDE)
+	{
+#define AREABIT(addr) (1 << (((addr) >> 21) & 7))
+		/* setup BSC */
+		volatile unsigned char *abwcr = (volatile unsigned char *)ABWCR;
+		volatile unsigned char *cscr = (volatile unsigned char *)CSCR;
+		*abwcr &= ~(AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT));
+		*cscr  |= (AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT)) | 0x0f;
+	}
+#endif
 #ifdef DEBUG
 	printk(KERN_DEBUG "Done setup_arch\n");
 #endif
diff -Nru a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c
--- a/arch/h8300/kernel/signal.c	Tue Jun 15 22:20:40 2004
+++ b/arch/h8300/kernel/signal.c	Tue Jun 15 22:20:40 2004
@@ -192,6 +192,7 @@
 	regs->er1 = context.sc_er1;
 	regs->er2 = context.sc_er2;
 	regs->er3 = context.sc_er3;
+	regs->er5 = context.sc_er5;
 	regs->ccr = (regs->ccr & 0x10)|(context.sc_ccr & 0xef);
 	regs->pc = context.sc_pc;
 	regs->orig_er0 = -1;		/* disable syscall checks */
@@ -308,6 +309,7 @@
 	sc->sc_er1 = regs->er1;
 	sc->sc_er2 = regs->er2;
 	sc->sc_er3 = regs->er3;
+	sc->sc_er5 = regs->er5;
 	sc->sc_ccr = regs->ccr;
 	sc->sc_pc = regs->pc;
 }
@@ -384,6 +386,7 @@
 			   ? current_thread_info()->exec_domain->signal_invmap[sig]
 		          : sig);
 	regs->er1 = (unsigned long)&(frame->sc);
+	regs->er5 = current->mm->start_data;	/* GOT base */
 
 	return;
 
@@ -435,6 +438,7 @@
 		     : sig);
 	regs->er1 = (unsigned long)&(frame->info);
 	regs->er2 = (unsigned long)&frame->uc;
+	regs->er5 = current->mm->start_data;	/* GOT base */
 
 	return;
 
diff -Nru a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
--- a/arch/h8300/kernel/syscalls.S	Tue Jun 15 22:20:38 2004
+++ b/arch/h8300/kernel/syscalls.S	Tue Jun 15 22:20:38 2004
@@ -265,8 +265,8 @@
 	.long SYMBOL_NAME(sys_io_getevents)
 	.long SYMBOL_NAME(sys_io_submit)
 	.long SYMBOL_NAME(sys_io_cancel)
-	.long SYMBOL_NAME(sys_ni_syscall)	/* 250 */ /* sys_alloc_hugepages */
-	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_freec_hugepages */
+	.long SYMBOL_NAME(sys_fadvise64)	/* 250 */
+	.long SYMBOL_NAME(sys_ni_syscall)
 	.long SYMBOL_NAME(sys_exit_group)
 	.long SYMBOL_NAME(sys_lookup_dcookie)
 	.long SYMBOL_NAME(sys_epoll_create)
@@ -287,36 +287,39 @@
 	.long SYMBOL_NAME(sys_fstatfs64)	
 	.long SYMBOL_NAME(sys_tgkill)		/* 270 */
 	.long SYMBOL_NAME(sys_utimes)
+ 	.long SYMBOL_NAME(sys_fadvise64_64)
+	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_vserver */
 
 	.rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4
 		.long SYMBOL_NAME(sys_ni_syscall)
 	.endr
 
+	.macro	call_sp addr
+	mov.l	#SYMBOL_NAME(\addr),er6
+	bra	SYMBOL_NAME(syscall_trampoline):8
+	.endm
+
 SYMBOL_NAME_LABEL(sys_clone)	
-	mov.l	#SYMBOL_NAME(h8300_clone),er0
-	jmp	@SYMBOL_NAME(syscall_trampoline)
+	call_sp	h8300_clone
 	
 SYMBOL_NAME_LABEL(sys_sigsuspend)
-	mov.l	#SYMBOL_NAME(do_sigsuspend),er0
-	jmp	@SYMBOL_NAME(syscall_trampoline)
+	call_sp	do_sigsuspend
 
 SYMBOL_NAME_LABEL(sys_rt_sigsuspend)
-	mov.l	#SYMBOL_NAME(do_rt_sigsuspend),er0
-	jmp	@SYMBOL_NAME(syscall_trampoline)
+	call_sp	do_rt_sigsuspend
 
 SYMBOL_NAME_LABEL(sys_sigreturn)
-	mov.l	#SYMBOL_NAME(do_sigreturn),er0
-	jmp	@SYMBOL_NAME(syscall_trampoline)
+	call_sp	do_sigreturn
 
 SYMBOL_NAME_LABEL(sys_rt_sigreturn)
-	mov.l	#SYMBOL_NAME(do_rt_sigreturn),er0
-	jmp	@SYMBOL_NAME(syscall_trampoline)
+	call_sp	do_rt_sigreturn
 
 SYMBOL_NAME_LABEL(sys_fork)
-	mov.l	#SYMBOL_NAME(h8300_fork),er0
-	jmp	@SYMBOL_NAME(syscall_trampoline)
+	call_sp	h8300_fork
 
 SYMBOL_NAME_LABEL(sys_vfork)
-	mov.l	#SYMBOL_NAME(h8300_vfork),er0
-	jmp	@SYMBOL_NAME(syscall_trampoline)
+	call_sp	h8300_vfork
 
+SYMBOL_NAME_LABEL(syscall_trampoline)
+	mov.l	sp,er0
+	jmp	@er6
diff -Nru a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c
--- a/arch/h8300/kernel/traps.c	Tue Jun 15 22:20:36 2004
+++ b/arch/h8300/kernel/traps.c	Tue Jun 15 22:20:36 2004
@@ -156,8 +156,14 @@
 	printk("\n");
 }
 
+void show_trace_task(struct task_struct *tsk)
+{
+	show_stack(tsk,(unsigned long *)tsk->thread.esp0);
+}
+
 void dump_stack(void)
 {
 	show_stack(NULL,NULL);
 }
+
 EXPORT_SYMBOL(dump_stack);
diff -Nru a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
--- a/arch/h8300/kernel/vmlinux.lds.S	Tue Jun 15 22:20:41 2004
+++ b/arch/h8300/kernel/vmlinux.lds.S	Tue Jun 15 22:20:41 2004
@@ -1,3 +1,6 @@
+#define VMLINUX_SYMBOL(_sym_) _##_sym_
+#include <asm-generic/vmlinux.lds.h>
+#include <asm/thread_info.h>
 #include <linux/config.h>
 
 #ifdef CONFIG_H8300H_GENERIC
@@ -100,6 +103,21 @@
         ___start___ksymtab = .;  /* Kernel symbol table          */
 		 *(__ksymtab)
 	___stop___ksymtab = .;
+
+	___start___ksymtab_gpl = .;	/* Kernel symbol table: GPL-only symbols */
+
+	*(__ksymtab_gpl)
+	___stop___ksymtab_gpl = .;
+
+	___start___kcrctab = .;	/* Kernel symbol table: Normal symbols */
+	*(__kcrctab)
+	___stop___kcrctab = .;
+
+	___start___kcrctab_gpl = .;	/* Kernel symbol table: GPL-only symbols */
+	*(__kcrctab_gpl)
+	___stop___kcrctab_gpl = .;
+
+	*(__ksymtab_strings)	/* Kernel symbol table: strings */
 
 	. = ALIGN(0x4) ;
 	__etext = . ;
diff -Nru a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
--- a/arch/h8300/mm/init.c	Tue Jun 15 22:20:40 2004
+++ b/arch/h8300/mm/init.c	Tue Jun 15 22:20:40 2004
@@ -162,7 +162,7 @@
 	unsigned long end_mem   = memory_end; /* DAVIDM - this must not include kernel stack at top */
 
 #ifdef DEBUG
-	printk("Mem_init: start=%lx, end=%lx\n", start_mem, end_mem);
+	printk(KERN_DEBUG "Mem_init: start=%lx, end=%lx\n", start_mem, end_mem);
 #endif
 
 	end_mem &= PAGE_MASK;
@@ -179,7 +179,7 @@
 	initk = (&__init_begin - &__init_end) >> 10;
 
 	tmp = nr_free_pages() << PAGE_SHIFT;
-	printk("Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n",
+	printk(KERN_INFO "Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n",
 	       tmp >> 10,
 	       len >> 10,
 	       (rom_length > 0) ? ((rom_length >> 10) - codek) : 0,
@@ -223,7 +223,7 @@
 		free_page(addr);
 		totalram_pages++;
 	}
-	printk("Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n",
+	printk(KERN_INFO "Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n",
 			(addr - PAGE_ALIGN((long) &__init_begin)) >> 10,
 			(int)(PAGE_ALIGN((unsigned long)(&__init_begin))),
 			(int)(addr - PAGE_SIZE));
diff -Nru a/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S b/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S
--- a/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S	Tue Jun 15 22:20:43 2004
+++ b/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S	Tue Jun 15 22:20:43 2004
@@ -40,7 +40,7 @@
 
 	/* Peripheral Setup */
 	
-#if defined(CONFIG_BLK_DEV_BLKMEM)
+#if defined(CONFIG_MTD_UCLINUX)
 	/* move romfs image */
 	jsr	@__move_romfs	
 #endif
diff -Nru a/arch/h8300/platform/h8300h/aki3068net/timer.c b/arch/h8300/platform/h8300h/aki3068net/timer.c
--- a/arch/h8300/platform/h8300h/aki3068net/timer.c	Tue Jun 15 22:20:37 2004
+++ b/arch/h8300/platform/h8300h/aki3068net/timer.c	Tue Jun 15 22:20:37 2004
@@ -25,12 +25,19 @@
 
 #define CMFA 6
 
+#define CMIEA 0x40
+#define CCLR_CMA 0x08
+#define CLK_DIV8192 0x03
+
+#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
+
 void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
 {
-	ctrl_outb(H8300_TIMER_COUNT_DATA,TCORA2);
-	ctrl_outb(0x00,_8TCSR2);
-	request_irq(40,timer_int,0,"timer",0);
-	ctrl_outb(0x40|0x08|0x03,_8TCR2);
+	/* setup 8bit timer ch2 */
+	ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2);      /* set interval */
+	ctrl_outb(0x00, _8TCSR2);                      /* no output */
+	request_irq(40, timer_int, 0, "timer", 0);
+	ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR2); /* start count */
 }
 
 void platform_timer_eoi(void)
diff -Nru a/arch/h8300/platform/h8300h/entry.S b/arch/h8300/platform/h8300h/entry.S
--- a/arch/h8300/platform/h8300h/entry.S	Tue Jun 15 22:20:39 2004
+++ b/arch/h8300/platform/h8300h/entry.S	Tue Jun 15 22:20:39 2004
@@ -109,12 +109,10 @@
 .globl SYMBOL_NAME(system_call)
 .globl SYMBOL_NAME(ret_from_exception)
 .globl SYMBOL_NAME(ret_from_fork)
-.globl SYMBOL_NAME(ret_from_signal)
 .globl SYMBOL_NAME(ret_from_interrupt)
 .globl SYMBOL_NAME(interrupt_redirect_table)
 .globl SYMBOL_NAME(sw_ksp),SYMBOL_NAME(sw_usp)
 .globl SYMBOL_NAME(resume)
-.globl SYMBOL_NAME(syscall_trampoline)
 .globl SYMBOL_NAME(interrupt_redirect_table)
 .globl SYMBOL_NAME(interrupt_entry)
 .globl SYMBOL_NAME(system_call)
@@ -173,7 +171,7 @@
 	beq	1f
 	jsr	@SYMBOL_NAME(do_softirq)
 1:
-	jmp	@SYMBOL_NAME(ret_from_exception)
+	jmp	@SYMBOL_NAME(ret_from_interrupt)
 	
 SYMBOL_NAME_LABEL(system_call)
 	subs	#4,sp				/* dummy LVEC */
@@ -205,11 +203,11 @@
 	mov.l	@(LER2:16,sp),er1
 	mov.l	@(LER3:16,sp),er2
 	jsr	@er4
-	mov.l	er0,@(LER0,sp)			/* save the return value */
+	mov.l	er0,@(LER0:16,sp)		/* save the return value */
 #if defined(CONFIG_SYSCALL_PRINT)
 	jsr	@SYMBOL_NAME(syscall_print)
 #endif
-	jmp	@SYMBOL_NAME(ret_from_exception)
+	bra	SYMBOL_NAME(ret_from_exception):8
 1:
 	jsr	SYMBOL_NAME(syscall_trace)
 	mov.l	@(LER1:16,sp),er0
@@ -218,44 +216,66 @@
 	jsr	@er4
 	mov.l	er0,@(LER0:16,sp)		/* save the return value */
 	jsr	@SYMBOL_NAME(syscall_trace)
+	bra	SYMBOL_NAME(ret_from_exception):8
+
+SYMBOL_NAME_LABEL(ret_from_fork)
+	mov.l	er2,er0
+	jsr	@SYMBOL_NAME(schedule_tail)
+	bra	SYMBOL_NAME(ret_from_exception):8
 
-SYMBOL_NAME_LABEL(ret_from_signal)
+SYMBOL_NAME_LABEL(reschedule)
+	/* save top of frame */
+	mov.l	sp,er0
+	jsr	@SYMBOL_NAME(set_esp0)
+	jsr	@SYMBOL_NAME(schedule)
 
 SYMBOL_NAME_LABEL(ret_from_exception)
+#if defined(CONFIG_PREEMPT)
+	orc	#0x80,ccr
+#endif
+SYMBOL_NAME_LABEL(ret_from_interrupt)
 	mov.b	@(LCCR+1:16,sp),r0l
 	btst	#4,r0l			/* check if returning to kernel */
-	bne	3f			/* if so, skip resched, signals */
+	bne	done:8			/* if so, skip resched, signals */
 	andc	#0x7f,ccr
-	mov.l	sp,er2
-	and.w	#0xe000,r2
-	mov.l	@(TI_FLAGS:16,er2),er1
+	mov.l	sp,er4
+	and.w	#0xe000,r4
+	mov.l	@(TI_FLAGS:16,er4),er1
 	and.l	#_TIF_WORK_MASK,er1
-	beq	3f
+	beq	done:8
 1:
-	mov.l	@(TI_FLAGS:16,er2),er1
+	mov.l	@(TI_FLAGS:16,er4),er1
 	btst	#TIF_NEED_RESCHED,r1l
 	bne	SYMBOL_NAME(reschedule):16
 	mov.l	sp,er1
 	subs	#4,er1			/* adjust retpc */
 	mov.l	er2,er0
 	jsr	@SYMBOL_NAME(do_signal)
-3:	 
+#if defined(CONFIG_PREEMPT)
+	bra	done:8			/* userspace thoru */
+3:
+	btst	#4,r0l
+	beq	done:8			/* userspace thoru */
+4:
+	mov.l	@(TI_PRE_COUNT:16,er4),er1
+	bne	done:8
+	mov.l	@(TI_FLAGS:16,er4),er1
+	btst	#TIF_NEED_RESCHED,r1l
+	beq	done:8
+	mov.b	r0l,r0l
+	bpl	done:8			/* interrupt off (exception path?) */
+	mov.l	#PREEMPT_ACTIVE,er1
+	mov.l	er1,@(TI_PRE_COUNT:16,er4)
+	andc	#0x7f,ccr
+	jsr	@SYMBOL_NAME(schedule)
+	sub.l	er1,er1
+	mov.l	er1,@(TI_PRE_COUNT:16,er4)
+	orc	#0x80,ccr
+	bra	4b:8
+#endif
+done:
 	RESTORE_ALL			/* Does RTE */
 
-SYMBOL_NAME_LABEL(reschedule)
-	/* save top of frame */
-	mov.l	sp,er0
-	jsr	@SYMBOL_NAME(set_esp0)
-
-	mov.l	#SYMBOL_NAME(ret_from_exception),er0
-	mov.l	er0,@-sp
-	jmp	@SYMBOL_NAME(schedule)
-
-SYMBOL_NAME_LABEL(ret_from_fork)
-	mov.l	er2,er0
-	jsr	@SYMBOL_NAME(schedule_tail)
-	jmp	@SYMBOL_NAME(ret_from_exception)	
-
 SYMBOL_NAME_LABEL(resume)
 	/*
 	 * Beware - when entering resume, offset of tss is in d1,
@@ -305,11 +325,6 @@
 	mov.l	er1,er0
 	jsr	@SYMBOL_NAME(trace_trap)
 	jmp	@SYMBOL_NAME(ret_from_exception)	
-
-SYMBOL_NAME_LABEL(syscall_trampoline)
-	mov.l	er0,er6
-	mov.l	sp,er0
-	jmp	@er6
 
 	.section	.bss
 SYMBOL_NAME_LABEL(sw_ksp)
diff -Nru a/arch/h8300/platform/h8300h/generic/timer.c b/arch/h8300/platform/h8300h/generic/timer.c
--- a/arch/h8300/platform/h8300h/generic/timer.c	Tue Jun 15 22:20:39 2004
+++ b/arch/h8300/platform/h8300h/generic/timer.c	Tue Jun 15 22:20:39 2004
@@ -22,22 +22,23 @@
 
 #include <linux/timex.h>
 
-extern int request_irq_boot(unsigned int,
-		             irqreturn_t (*handler)(int, void *, struct pt_regs *),
-		             unsigned long, const char *, void *);
-
-
 #if defined(CONFIG_H83007) || defined(CONFIG_H83068)
 #include <asm/regs306x.h>
 #define CMFA 6
 
+#define CMIEA 0x40
+#define CCLR_CMA 0x08
+#define CLK_DIV8192 0x03
+
+#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
+
 int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
 {
-	ctrl_outb(H8300_TIMER_COUNT_DATA,TCORA2);
-	ctrl_outb(0x00,_8TCSR2);
-	request_irq(40,timer_int,0,"timer",0);
-	ctrl_outb(0x40|0x08|0x03,_8TCR2);
-	return 0;
+	/* setup 8bit timer ch2 */
+	ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2);      /* set interval */
+	ctrl_outb(0x00, _8TCSR2);                      /* no output */
+	request_irq(40, timer_int, 0, "timer", 0);
+	ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR2); /* start count */
 }
 
 void platform_timer_eoi(void)
@@ -46,7 +47,7 @@
 }
 #endif
 
-#if defined(H8_3002) || defined(CONFIG_H83048)
+#if defined(CONFIG_H83002) || defined(CONFIG_H83048)
 /* FIXME! */
 #define TSTR 0x00ffff60
 #define TSNC 0x00ffff61
@@ -54,6 +55,7 @@
 #define TFCR 0x00ffff63
 #define TOER 0x00ffff90
 #define TOCR 0x00ffff91
+/* ITU0 */
 #define TCR  0x00ffff64
 #define TIOR 0x00ffff65
 #define TIER 0x00ffff66
@@ -62,23 +64,28 @@
 #define GRA  0x00ffff6a
 #define GRB  0x00ffff6c
 
+#define CCLR_CMGRA 0x20
+#define CLK_DIV8 0x03
+
+#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8 /* Timer input freq. */
+
 int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
 {
-	*(unsigned short *)GRA= H8300_TIMER_COUNT_DATA;
-	*(unsigned short *)TCNT=0;
-	ctrl_outb(0x23,TCR);
-	ctrl_outb(0x00,TIOR);
-	request_timer_irq(26,timer_int,0,"timer",0);
-	ctrl_outb(inb(TIER) | 0x01,TIER);
-	ctrl_outb(inb(TSNC) & ~0x01,TSNC);
-	ctrl_outb(inb(TMDR) & ~0x01,TMDR);
-	ctrl_outb(inb(TSTR) | 0x01,TSTR);
+	*(unsigned short *)GRA= H8300_TIMER_FREQ / HZ;  /* set interval */
+	*(unsigned short *)TCNT=0;                      /* clear counter */
+	ctrl_outb(0x80|CCLR_CMGRA|CLK_DIV8, TCR);       /* set ITU0 clock */
+	ctrl_outb(0x88, TIOR);                          /* no output */
+	request_irq(26, timer_int, 0, "timer", 0);
+	ctrl_outb(0xf9, TIER);                          /* compare match GRA interrupt */
+	ctrl_outb(ctrl_inb(TSNC) & ~0x01, TSNC);        /* ITU0 async */
+	ctrl_outb(ctrl_inb(TMDR) & ~0x01, TMDR);        /* ITU0 normal mode */
+	ctrl_outb(ctrl_inb(TSTR) | 0x01, TSTR);         /* ITU0 Start */
 	return 0;
 }
 
 void platform_timer_eoi(void)
 {
-	ctrl_outb(inb(TSR) & ~0x01,TSR);
+	ctrl_outb(ctrl_inb(TSR) & ~0x01,TSR);
 }
 #endif
 
diff -Nru a/arch/h8300/platform/h8300h/h8max/crt0_ram.S b/arch/h8300/platform/h8300h/h8max/crt0_ram.S
--- a/arch/h8300/platform/h8300h/h8max/crt0_ram.S	Tue Jun 15 22:20:37 2004
+++ b/arch/h8300/platform/h8300h/h8max/crt0_ram.S	Tue Jun 15 22:20:37 2004
@@ -40,7 +40,7 @@
 
 	/* Peripheral Setup */
 	
-#if defined(CONFIG_BLK_DEV_BLKMEM)
+#if defined(CONFIG_MTD_UCLINUX)
 	/* move romfs image */
 	jsr	@__move_romfs	
 #endif
diff -Nru a/arch/h8300/platform/h8300h/h8max/timer.c b/arch/h8300/platform/h8300h/h8max/timer.c
--- a/arch/h8300/platform/h8300h/h8max/timer.c	Tue Jun 15 22:20:37 2004
+++ b/arch/h8300/platform/h8300h/h8max/timer.c	Tue Jun 15 22:20:37 2004
@@ -25,12 +25,19 @@
 
 #define CMFA 6
 
+#define CMIEA 0x40
+#define CCLR_CMA 0x08
+#define CLK_DIV8192 0x03
+
+#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
+
 void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
 {
-	ctrl_outb(H8300_TIMER_COUNT_DATA,TCORA2);
-	ctrl_outb(0x00,_8TCSR2);
-	request_irq(40,timer_int,0,"timer",0);
-	ctrl_outb(0x40|0x08|0x03,_8TCR2);
+	/* setup 8bit timer ch2 */
+	ctrl_outb(H8300_TIMER_FREQ / HZ, TCORA2);      /* set interval */
+	ctrl_outb(0x00, _8TCSR2);                      /* no output */
+	request_irq(40, timer_int, 0, "timer", 0);
+	ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR2); /* start count */
 }
 
 void platform_timer_eoi(void)
diff -Nru a/arch/h8300/platform/h8300h/ptrace_h8300h.c b/arch/h8300/platform/h8300h/ptrace_h8300h.c
--- a/arch/h8300/platform/h8300h/ptrace_h8300h.c	Tue Jun 15 22:20:38 2004
+++ b/arch/h8300/platform/h8300h/ptrace_h8300h.c	Tue Jun 15 22:20:38 2004
@@ -246,11 +246,13 @@
 					return (unsigned short *)addr;
 				case relb:
 					if ((inst = 0x55) || isbranch(child,inst & 0x0f))
-						(unsigned char *)pc += (signed char)(*fetch_p);
+						pc = (unsigned short *)((unsigned long)pc +
+								       ((signed char)(*fetch_p)));
 					return pc+1; /* skip myself */
 				case relw:
 					if ((inst = 0x5c) || isbranch(child,(*fetch_p & 0xf0) >> 4))
-						(unsigned char *)pc += (signed short)(*(pc+1));
+						pc = (unsigned short *)((unsigned long)pc +
+								       ((signed short)(*(pc+1))));
 					return pc+2; /* skip myself */
 				}
 			}
diff -Nru a/arch/h8300/platform/h8s/edosk2674/timer.c b/arch/h8300/platform/h8s/edosk2674/timer.c
--- a/arch/h8300/platform/h8s/edosk2674/timer.c	Tue Jun 15 22:20:40 2004
+++ b/arch/h8300/platform/h8s/edosk2674/timer.c	Tue Jun 15 22:20:40 2004
@@ -1,5 +1,5 @@
 /*
- *  linux/arch/h8300/platform/h8s/generic/timer.c
+ *  linux/arch/h8300/platform/h8s/edosk2674/timer.c
  *
  *  Yoshinori Sato <ysato@users.sourceforge.jp>
  *
@@ -23,25 +23,28 @@
 #include <asm/irq.h>
 #include <asm/regs267x.h>
 
-#define REGS(regs) __REGS(regs)
-#define __REGS(regs) #regs
+#define CMFA 6
 
-int __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
+#define CMIEA 0x40
+#define CCLR_CMA 0x08
+#define CLK_DIV8192 0x03
+
+#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
+
+void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
 {
-	unsigned char mstpcrl;
-	mstpcrl = ctrl_inb(MSTPCRL);                  /* Enable timer */
-	mstpcrl &= ~0x01;
-	ctrl_outb(mstpcrl,MSTPCRL);
-	ctrl_outb(H8300_TIMER_COUNT_DATA,_8TCORA1);
-	ctrl_outb(0x00,_8TCSR1);
-	request_irq(76,timer_int,0,"timer",0);
-	ctrl_outb(0x40|0x08|0x03,_8TCR1);
-	return 0;
+	/* 8bit timer module enabled */
+	ctrl_outb(ctrl_inb(MSTPCRL) & ~0x01, MSTPCRL);
+	/* setup 8bit timer ch1 */
+	ctrl_outb(H8300_TIMER_FREQ / HZ, _8TCORA1);      /* set interval */
+	ctrl_outb(0x00, _8TCSR1);                        /* no output */
+	request_irq(76, timer_int, 0, "timer" ,0);
+	ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR1);   /* start count */
 }
 
 void platform_timer_eoi(void)
 {
-        __asm__("bclr #6,@" REGS(_8TCSR1) ":8");
+	*(volatile unsigned char *)_8TCSR1 &= ~(1 << CMFA);
 }
 
 void platform_gettod(int *year, int *mon, int *day, int *hour,
diff -Nru a/arch/h8300/platform/h8s/entry.S b/arch/h8300/platform/h8s/entry.S
--- a/arch/h8300/platform/h8s/entry.S	Tue Jun 15 22:20:44 2004
+++ b/arch/h8300/platform/h8s/entry.S	Tue Jun 15 22:20:44 2004
@@ -109,12 +109,10 @@
 .globl SYMBOL_NAME(system_call)
 .globl SYMBOL_NAME(ret_from_exception)
 .globl SYMBOL_NAME(ret_from_fork)
-.globl SYMBOL_NAME(ret_from_signal)
 .globl SYMBOL_NAME(ret_from_interrupt)
 .globl SYMBOL_NAME(interrupt_redirect_table)
 .globl SYMBOL_NAME(sw_ksp),SYMBOL_NAME(sw_usp)
 .globl SYMBOL_NAME(resume)
-.globl SYMBOL_NAME(syscall_trampoline)
 .globl SYMBOL_NAME(trace_break)
 .globl SYMBOL_NAME(interrupt_entry)
 		
@@ -201,11 +199,11 @@
 	mov.l	@(LER2:16,sp),er1
 	mov.l	@(LER3:16,sp),er2
 	jsr	@er4
-	mov.l	er0,@(LER0,sp)			/* save the return value */
+	mov.l	er0,@(LER0:16,sp)			/* save the return value */
 #if defined(CONFIG_SYSCALL_PRINT)
 	jsr	@SYMBOL_NAME(syscall_print)
 #endif
-	jmp	@SYMBOL_NAME(ret_from_exception)
+	bra	SYMBOL_NAME(ret_from_exception):8
 1:
 	jsr	SYMBOL_NAME(syscall_trace)
 	mov.l	@(LER1:16,sp),er0
@@ -214,45 +212,67 @@
 	jsr	@er4
 	mov.l	er0,@(LER0:16,sp)		/* save the return value */
 	jsr	@SYMBOL_NAME(syscall_trace)
+	bra	SYMBOL_NAME(ret_from_exception):8
+
 
-SYMBOL_NAME_LABEL(ret_from_signal)
+SYMBOL_NAME_LABEL(ret_from_fork)
+	mov.l	er2,er0
+	jsr	@SYMBOL_NAME(schedule_tail)
+	bra	SYMBOL_NAME(ret_from_exception):8
+
+SYMBOL_NAME_LABEL(reschedule)
+	/* save top of frame */
+	mov.l	sp,er0
+	jsr	@SYMBOL_NAME(set_esp0)
+	jsr	@SYMBOL_NAME(schedule)
 
 SYMBOL_NAME_LABEL(ret_from_exception)
+#if defined(CONFIG_PREEMPT)
+	orc	#0x80,ccr
+#endif
+SYMBOL_NAME_LABEL(ret_from_interrupt)
 	mov.b	@(LCCR+1:16,sp),r0l
 	btst	#4,r0l			/* check if returning to kernel */
-	bne	3f			/* if so, skip resched, signals */
+	bne	done:8			/* if so, skip resched, signals */
 	andc	#0x7f,ccr
-	mov.l	sp,er2
-	and.w	#0xe000,r2
-	mov.l	@(TI_FLAGS:16,er2),er1
+	mov.l	sp,er4
+	and.w	#0xe000,r4
+	mov.l	@(TI_FLAGS:16,er4),er1
 	and.l	#_TIF_WORK_MASK,er1
-	beq	3f
+	beq	done:8
 1:
-	mov.l	@(TI_FLAGS:16,er2),er1
+	mov.l	@(TI_FLAGS:16,er4),er1
 	btst	#TIF_NEED_RESCHED,r1l
 	bne	SYMBOL_NAME(reschedule):16
 	mov.l	sp,er1
 	subs	#4,er1			/* adjust retpc */
 	mov.l	er2,er0
 	jsr	@SYMBOL_NAME(do_signal)
-3:	 
+#if defined(CONFIG_PREEMPT)
+	bra	done:8			/* userspace thoru */
+3:
+	btst	#4,r0l
+	beq	done:8			/* userspace thoru */
+4:
+	mov.l	@(TI_PRE_COUNT:16,er4),er1
+	bne	done:8
+	mov.l	@(TI_FLAGS:16,er4),er1
+	btst	#TIF_NEED_RESCHED,r1l
+	beq	done:8
+	mov.b	r0l,r0l
+	bpl	done:8			/* interrupt off (exception path?) */
+	mov.l	#PREEMPT_ACTIVE,er1
+	mov.l	er1,@(TI_PRE_COUNT:16,er4)
+	andc	#0x7f,ccr
+	jsr	@SYMBOL_NAME(schedule)
+	sub.l	er1,er1
+	mov.l	er1,@(TI_PRE_COUNT:16,er4)
+	orc	#0x80,ccr
+	bra	4b:8
+#endif
+done:
 	RESTORE_ALL			/* Does RTE */
 
-SYMBOL_NAME_LABEL(reschedule)
-	/* save top of frame */
-	mov.l	sp,er0
-	jsr	@SYMBOL_NAME(set_esp0)
-
-	mov.l	#SYMBOL_NAME(ret_from_exception),er0
-	mov.l	er0,@-sp
-	jmp	@SYMBOL_NAME(schedule)
-
-SYMBOL_NAME_LABEL(ret_from_fork)
-	mov.l	er2,er0
-	jsr	@SYMBOL_NAME(schedule_tail)
-	jmp	@SYMBOL_NAME(ret_from_exception)	
-
-
 SYMBOL_NAME_LABEL(resume)
 	/*
 	 *	er0 = prev
@@ -284,7 +304,7 @@
 
 	ldc	r3l,ccr
 	ldc	r3h,exr
-	
+
 	rts
 
 SYMBOL_NAME_LABEL(trace_break)
@@ -303,11 +323,6 @@
 	mov.l	er1,er0
 	jsr	@SYMBOL_NAME(trace_trap)
 	jmp	@SYMBOL_NAME(ret_from_exception)	
-
-SYMBOL_NAME_LABEL(syscall_trampoline)
-	mov.l	er0,er6
-	mov.l	sp,er0
-	jmp	@er6
 
 	.section	.bss
 SYMBOL_NAME_LABEL(sw_ksp)
diff -Nru a/arch/h8300/platform/h8s/generic/timer.c b/arch/h8300/platform/h8s/generic/timer.c
--- a/arch/h8300/platform/h8s/generic/timer.c	Tue Jun 15 22:20:40 2004
+++ b/arch/h8300/platform/h8s/generic/timer.c	Tue Jun 15 22:20:40 2004
@@ -23,18 +23,28 @@
 #include <asm/irq.h>
 #include <asm/regs267x.h>
 
-int platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
+#define CMFA 6
+
+#define CMIEA 0x40
+#define CCLR_CMA 0x08
+#define CLK_DIV8192 0x03
+
+#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
+
+void __init platform_timer_setup(irqreturn_t (*timer_int)(int, void *, struct pt_regs *))
 {
-	ctrl_outb(H8300_TIMER_COUNT_DATA,_8TCORA1);
-	ctrl_outb(0x00,_8TCSR1);
-	request_irq(76,timer_int,0,"timer",0);
-	ctrl_outb(0x40|0x08|0x03,_8TCR1);
-	return 0;
+	/* 8bit timer module enabled */
+	ctrl_outb(ctrl_inb(MSTPCRL) & ~0x01, MSTPCRL);
+	/* setup 8bit timer ch1 */
+	ctrl_outb(H8300_TIMER_FREQ / HZ, _8TCORA1);      /* set interval */
+	ctrl_outb(0x00, _8TCSR1);                        /* no output */
+	request_irq(76, timer_int, 0, "timer" ,0);
+	ctrl_outb(CMIEA|CCLR_CMA|CLK_DIV8192, _8TCR1);   /* start count */
 }
 
 void platform_timer_eoi(void)
 {
-        __asm__("bclr #6,@0xffffb3:8");
+	*(volatile unsigned char *)_8TCSR1 &= ~(1 << CMFA);
 }
 
 void platform_gettod(int *year, int *mon, int *day, int *hour,
diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
--- a/arch/i386/Kconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/i386/Kconfig	Tue Jun 15 22:20:37 2004
@@ -65,6 +65,8 @@
 
 config X86_NUMAQ
 	bool "NUMAQ (IBM/Sequent)"
+	select DISCONTIGMEM
+	select NUMA
 	help
 	  This option is used for getting Linux to run on a (IBM/Sequent) NUMA 
 	  multiquad box. This changes the way that processors are bootstrapped,
@@ -102,10 +104,10 @@
 	  and vice versa. See <file:Documentation/sgi-visws.txt> for details.
 
 config X86_GENERICARCH
-       bool "Generic architecture (Summit, bigsmp, default)"
+       bool "Generic architecture (Summit, bigsmp, ES7000, default)"
        depends on SMP
        help
-          This option compiles in the Summit, bigsmp, default subarchitectures.
+          This option compiles in the Summit, bigsmp, ES7000, default subarchitectures.
 	  It is intended for a generic binary kernel.
 
 config X86_ES7000
@@ -479,6 +481,16 @@
 	  This is purely to save memory - each supported CPU adds
 	  approximately eight kilobytes to the kernel image.
 
+config SCHED_SMT
+	bool "SMT (Hyperthreading) scheduler support"
+	depends on SMP
+	default off
+	help
+	  SMT scheduler support improves the CPU scheduler's decision making
+	  when dealing with Intel Pentium 4 chips with HyperThreading at a
+	  cost of slightly increased overhead in some places. If unsure say
+	  N here.
+
 config PREEMPT
 	bool "Preemptible Kernel"
 	help
@@ -538,6 +550,7 @@
 
 config X86_MCE
 	bool "Machine Check Exception"
+	depends on !X86_VOYAGER
 	---help---
 	  Machine Check Exception support allows the processor to notify the
 	  kernel if it detects a problem (e.g. overheating, component failure).
@@ -709,7 +722,7 @@
 
 # Common NUMA Features
 config NUMA
-	bool "Numa Memory Allocation Support"
+	bool "Numa Memory Allocation and Scheduler Support"
 	depends on SMP && HIGHMEM64G && (X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI))
 	default n if X86_PC
 	default y if (X86_NUMAQ || X86_SUMMIT)
@@ -813,7 +826,7 @@
 	This option is only useful on systems that have EFI firmware
 	and will result in a kernel image that is ~8k larger.  In addition,
 	you must use the latest ELILO loader available at
-	<ftp://ftp.hpl.hp.com/pub/linux-ia64/> in order to take advantage of
+	<http://elilo.sourceforge.net> in order to take advantage of
 	kernel initialization using EFI information (neither GRUB nor LILO know
 	anything about EFI).  However, even with this option, the resultant
 	kernel should continue to boot on existing non-EFI platforms.
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/Makefile	Tue Jun 15 22:20:39 2004
@@ -18,8 +18,9 @@
 LDFLAGS		:= -m elf_i386
 OBJCOPYFLAGS	:= -O binary -R .note -R .comment -S
 LDFLAGS_vmlinux :=
+CHECK		:= $(CHECK) -D__i386__=1
 
-CFLAGS += -pipe
+CFLAGS += -pipe -msoft-float
 
 # prevent gcc from keeping the stack 16 byte aligned
 CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
@@ -92,7 +93,8 @@
 
 # ES7000 subarch support
 mflags-$(CONFIG_X86_ES7000)	:= -Iinclude/asm-i386/mach-es7000
-mcore-$(CONFIG_X86_ES7000)	:= mach-es7000
+mcore-$(CONFIG_X86_ES7000)	:= mach-default
+core-$(CONFIG_X86_ES7000)	:= arch/i386/mach-es7000/
 
 # default subarch .h files
 mflags-y += -Iinclude/asm-i386/mach-default
diff -Nru a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S
--- a/arch/i386/boot/setup.S	Tue Jun 15 22:20:41 2004
+++ b/arch/i386/boot/setup.S	Tue Jun 15 22:20:41 2004
@@ -133,7 +133,7 @@
 ramdisk_size:	.long	0		# its size in bytes
 
 bootsect_kludge:
-		.word  bootsect_helper, SETUPSEG
+		.long	0		# obsolete
 
 heap_end_ptr:	.word	modelist+1024	# (Header version 0x0201 or later)
 					# space from here (exclusive) down to
@@ -156,7 +156,8 @@
 					# can be located anywhere in
 					# low memory 0x10000 or higher.
 
-ramdisk_max:	.long MAXMEM-1		# (Header version 0x0203 or later)
+ramdisk_max:	.long (MAXMEM-1) & 0x7fffffff
+					# (Header version 0x0203 or later)
 					# The highest safe address for
 					# the contents of an initrd
 
@@ -837,7 +838,7 @@
 	subw	$DELTA_INITSEG, %si
 	shll	$4, %esi			# Convert to 32-bit pointer
 
-# jump to startup_32 in arch/i386/kernel/head.S
+# jump to startup_32 in arch/i386/boot/compressed/head.S
 #	
 # NOTE: For high loaded big kernels we need a
 #	jmpi    0x100000,__BOOT_CS
@@ -871,88 +872,6 @@
 						# sequence
 	outb	%al, $0x70
 	lret
-
-# This routine only gets called, if we get loaded by the simple
-# bootsect loader _and_ have a bzImage to load.
-# Because there is no place left in the 512 bytes of the boot sector,
-# we must emigrate to code space here.
-bootsect_helper:
-	cmpw	$0, %cs:bootsect_es
-	jnz	bootsect_second
-
-	movb	$0x20, %cs:type_of_loader
-	movw	%es, %ax
-	shrw	$4, %ax
-	movb	%ah, %cs:bootsect_src_base+2
-	movw	%es, %ax
-	movw	%ax, %cs:bootsect_es
-	subw	$SYSSEG, %ax
-	lret					# nothing else to do for now
-
-bootsect_second:
-	pushw	%cx
-	pushw	%si
-	pushw	%bx
-	testw	%bx, %bx			# 64K full?
-	jne	bootsect_ex
-
-	movw	$0x8000, %cx			# full 64K, INT15 moves words
-	pushw	%cs
-	popw	%es
-	movw	$bootsect_gdt, %si
-	movw	$0x8700, %ax
-	int	$0x15
-	jc	bootsect_panic			# this, if INT15 fails
-
-	movw	%cs:bootsect_es, %es		# we reset %es to always point
-	incb	%cs:bootsect_dst_base+2		# to 0x10000
-bootsect_ex:
-	movb	%cs:bootsect_dst_base+2, %ah
-	shlb	$4, %ah				# we now have the number of
-						# moved frames in %ax
-	xorb	%al, %al
-	popw	%bx
-	popw	%si
-	popw	%cx
-	lret
-
-bootsect_gdt:
-	.word	0, 0, 0, 0
-	.word	0, 0, 0, 0
-
-bootsect_src:
-	.word	0xffff
-
-bootsect_src_base:
-	.byte	0x00, 0x00, 0x01		# base = 0x010000
-	.byte	0x93				# typbyte
-	.word	0				# limit16,base24 =0
-
-bootsect_dst:
-	.word	0xffff
-
-bootsect_dst_base:
-	.byte	0x00, 0x00, 0x10		# base = 0x100000
-	.byte	0x93				# typbyte
-	.word	0				# limit16,base24 =0
-	.word	0, 0, 0, 0			# BIOS CS
-	.word	0, 0, 0, 0			# BIOS DS
-
-bootsect_es:
-	.word	0
-
-bootsect_panic:
-	pushw	%cs
-	popw	%ds
-	cld
-	leaw	bootsect_panic_mess, %si
-	call	prtstr
-	
-bootsect_panic_loop:
-	jmp	bootsect_panic_loop
-
-bootsect_panic_mess:
-	.string	"INT15 refuses to access high mem, giving up."
 
 
 #ifndef CONFIG_X86_VOYAGER
diff -Nru a/arch/i386/boot98/setup.S b/arch/i386/boot98/setup.S
--- a/arch/i386/boot98/setup.S	Tue Jun 15 22:20:37 2004
+++ b/arch/i386/boot98/setup.S	Tue Jun 15 22:20:37 2004
@@ -146,7 +146,7 @@
 ramdisk_size:	.long	0		# its size in bytes
 
 bootsect_kludge:
-		.word  bootsect_helper, SETUPSEG
+		.long	0		# obsolete
 
 heap_end_ptr:	.word	modelist+1024	# (Header version 0x0201 or later)
 					# space from here (exclusive) down to
@@ -691,91 +691,6 @@
 						# sequence
 	lret
 
-# This routine only gets called, if we get loaded by the simple
-# bootsect loader _and_ have a bzImage to load.
-# Because there is no place left in the 512 bytes of the boot sector,
-# we must emigrate to code space here.
-bootsect_helper:
-	cmpw	$0, %cs:bootsect_es
-	jnz	bootsect_second
-
-	movb	$0x20, %cs:type_of_loader
-	movw	%es, %ax
-	shrw	$4, %ax
-	movb	%ah, %cs:bootsect_src_base+2
-	movw	%es, %ax
-	movw	%ax, %cs:bootsect_es
-	subw	$SYSSEG, %ax
-	lret					# nothing else to do for now
-
-bootsect_second:
-	pushw	%bx
-	pushw	%cx
-	pushw	%si
-	pushw	%di
-	testw	%bp, %bp			# 64K full ?
-	jne	bootsect_ex
-
-	xorw	%cx, %cx			# zero means full 64K
-	pushw	%cs
-	popw	%es
-	movw	$bootsect_gdt, %bx
-	xorw	%si, %si			# source address
-	xorw	%di, %di			# destination address
-	movb	$0x90, %ah
-	int	$0x1f
-	jc	bootsect_panic			# this, if INT1F fails
-
-	movw	%cs:bootsect_es, %es		# we reset %es to always point
-	incb	%cs:bootsect_dst_base+2		# to 0x10000
-bootsect_ex:
-	movb	%cs:bootsect_dst_base+2, %ah
-	shlb	$4, %ah				# we now have the number of
-						# moved frames in %ax
-	xorb	%al, %al
-	popw	%di
-	popw	%si
-	popw	%cx
-	popw	%bx
-	lret
-
-bootsect_gdt:
-	.word	0, 0, 0, 0
-	.word	0, 0, 0, 0
-
-bootsect_src:
-	.word	0xffff
-
-bootsect_src_base:
-	.byte	0x00, 0x00, 0x01		# base = 0x010000
-	.byte	0x93				# typbyte
-	.word	0				# limit16,base24 =0
-
-bootsect_dst:
-	.word	0xffff
-
-bootsect_dst_base:
-	.byte	0x00, 0x00, 0x10		# base = 0x100000
-	.byte	0x93				# typbyte
-	.word	0				# limit16,base24 =0
-	.word	0, 0, 0, 0			# BIOS CS
-	.word	0, 0, 0, 0			# BIOS DS
-
-bootsect_es:
-	.word	0
-
-bootsect_panic:
-	pushw	%cs
-	popw	%ds
-	cld
-	leaw	bootsect_panic_mess, %si
-	call	prtstr
-
-bootsect_panic_loop:
-	jmp	bootsect_panic_loop
-
-bootsect_panic_mess:
-	.string	"INT1F refuses to access high mem, giving up."
 
 # This routine prints one character (in %al) on console.
 # PC-9800 doesn't have BIOS-function to do it like IBM PC's INT 10h - 0Eh,
diff -Nru a/arch/i386/defconfig b/arch/i386/defconfig
--- a/arch/i386/defconfig	Tue Jun 15 22:20:42 2004
+++ b/arch/i386/defconfig	Tue Jun 15 22:20:42 2004
@@ -18,8 +18,11 @@
 #
 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=15
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -30,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -88,6 +92,7 @@
 # CONFIG_HPET_EMULATE_RTC is not set
 CONFIG_SMP=y
 CONFIG_NR_CPUS=8
+CONFIG_SCHED_SMT=y
 CONFIG_PREEMPT=y
 CONFIG_X86_LOCAL_APIC=y
 CONFIG_X86_IO_APIC=y
@@ -200,7 +205,7 @@
 #
 # Generic Driver Options
 #
-# CONFIG_FW_LOADER is not set
+CONFIG_FW_LOADER=m
 
 #
 # Memory Technology Devices (MTD)
@@ -259,7 +264,6 @@
 # CONFIG_BLK_DEV_HD_IDE is not set
 CONFIG_BLK_DEV_IDEDISK=y
 CONFIG_IDEDISK_MULTI_MODE=y
-# CONFIG_IDEDISK_STROKE is not set
 CONFIG_BLK_DEV_IDECD=y
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
@@ -307,6 +311,7 @@
 # CONFIG_BLK_DEV_SLC90E66 is not set
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
+# CONFIG_IDE_ARM is not set
 # CONFIG_IDE_CHIPSETS is not set
 CONFIG_BLK_DEV_IDEDMA=y
 # CONFIG_IDEDMA_IVB is not set
@@ -332,7 +337,6 @@
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 # CONFIG_SCSI_MULTI_LUN is not set
-CONFIG_SCSI_REPORT_LUNS=y
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
 
@@ -354,6 +358,7 @@
 # CONFIG_SCSI_AIC7XXX is not set
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
+CONFIG_SCSI_DPT_I2O=m
 # CONFIG_SCSI_ADVANSYS is not set
 # CONFIG_SCSI_IN2000 is not set
 # CONFIG_SCSI_MEGARAID is not set
@@ -361,7 +366,9 @@
 # CONFIG_SCSI_SATA_SVW is not set
 CONFIG_SCSI_ATA_PIIX=y
 # CONFIG_SCSI_SATA_PROMISE is not set
+CONFIG_SCSI_SATA_SX4=m
 # CONFIG_SCSI_SATA_SIL is not set
+CONFIG_SCSI_SATA_SIS=m
 # CONFIG_SCSI_SATA_VIA is not set
 # CONFIG_SCSI_SATA_VITESSE is not set
 # CONFIG_SCSI_BUSLOGIC is not set
@@ -380,6 +387,9 @@
 # CONFIG_SCSI_IMM is not set
 # CONFIG_SCSI_NCR53C406A is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
+CONFIG_SCSI_IPR=m
+# CONFIG_SCSI_IPR_TRACE is not set
+# CONFIG_SCSI_IPR_DUMP is not set
 # CONFIG_SCSI_PAS16 is not set
 # CONFIG_SCSI_PSI240I is not set
 # CONFIG_SCSI_QLOGIC_FAS is not set
@@ -484,8 +494,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -539,13 +547,17 @@
 CONFIG_IP_NF_ARPTABLES=y
 CONFIG_IP_NF_ARPFILTER=y
 CONFIG_IP_NF_ARP_MANGLE=y
+CONFIG_IP_NF_TARGET_NOTRACK=m
+CONFIG_IP_NF_RAW=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_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -566,12 +578,12 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
 CONFIG_DUMMY=m
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
@@ -579,6 +591,11 @@
 # CONFIG_NET_SB1000 is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -619,7 +636,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=2
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
@@ -637,7 +653,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -645,47 +660,31 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PLIP is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+CONFIG_S2IO=m
+# CONFIG_S2IO_NAPI is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PLIP 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
@@ -803,6 +802,7 @@
 # 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
@@ -978,6 +978,7 @@
 #
 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 is not set
 CONFIG_USB_UHCI_HCD=y
 
@@ -1012,6 +1013,7 @@
 # CONFIG_USB_KBTAB is not set
 # CONFIG_USB_POWERMATE is not set
 # CONFIG_USB_MTOUCH is not set
+CONFIG_USB_EGALAX=m
 # CONFIG_USB_XPAD is not set
 # CONFIG_USB_ATI_REMOTE is not set
 
@@ -1061,6 +1063,8 @@
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
 # CONFIG_USB_LED is not set
+CONFIG_USB_CYTHERM=m
+CONFIG_USB_PHIDGETSERVO=m
 # CONFIG_USB_TEST is not set
 
 #
@@ -1110,6 +1114,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
@@ -1152,7 +1157,6 @@
 # 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
 
 #
@@ -1217,6 +1221,7 @@
 CONFIG_EARLY_PRINTK=y
 CONFIG_DEBUG_SPINLOCK_SLEEP=y
 # CONFIG_FRAME_POINTER is not set
+CONFIG_4KSTACKS=y
 CONFIG_X86_FIND_SMP_CONFIG=y
 CONFIG_X86_MPPARSE=y
 
@@ -1234,8 +1239,10 @@
 # Library routines
 #
 CONFIG_CRC32=y
+CONFIG_LIBCRC32C=m
 CONFIG_X86_SMP=y
 CONFIG_X86_HT=y
 CONFIG_X86_BIOS_REBOOT=y
 CONFIG_X86_TRAMPOLINE=y
+CONFIG_X86_STD_RESOURCES=y
 CONFIG_PC=y
diff -Nru a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
--- a/arch/i386/kernel/acpi/boot.c	Tue Jun 15 22:20:44 2004
+++ b/arch/i386/kernel/acpi/boot.c	Tue Jun 15 22:20:44 2004
@@ -51,6 +51,10 @@
 
 #endif	/* X86 */
 
+#define BAD_MADT_ENTRY(entry, end) (					    \
+		(!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
+		((acpi_table_entry_header *)entry)->length != sizeof(*entry))
+
 #define PREFIX			"ACPI: "
 
 #ifdef CONFIG_ACPI_PCI
@@ -204,12 +208,13 @@
 
 static int __init
 acpi_parse_lapic (
-	acpi_table_entry_header *header)
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_lapic	*processor = NULL;
 
 	processor = (struct acpi_table_lapic*) header;
-	if (!processor)
+
+	if (BAD_MADT_ENTRY(processor, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -225,15 +230,15 @@
 	return 0;
 }
 
-
 static int __init
 acpi_parse_lapic_addr_ovr (
-	acpi_table_entry_header *header)
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
 
 	lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr*) header;
-	if (!lapic_addr_ovr)
+
+	if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
 		return -EINVAL;
 
 	acpi_lapic_addr = lapic_addr_ovr->address;
@@ -243,12 +248,13 @@
 
 static int __init
 acpi_parse_lapic_nmi (
-	acpi_table_entry_header *header)
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_lapic_nmi *lapic_nmi = NULL;
 
 	lapic_nmi = (struct acpi_table_lapic_nmi*) header;
-	if (!lapic_nmi)
+
+	if (BAD_MADT_ENTRY(lapic_nmi, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -266,12 +272,13 @@
 
 static int __init
 acpi_parse_ioapic (
-	acpi_table_entry_header *header)
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_ioapic *ioapic = NULL;
 
 	ioapic = (struct acpi_table_ioapic*) header;
-	if (!ioapic)
+
+	if (BAD_MADT_ENTRY(ioapic, end))
 		return -EINVAL;
  
 	acpi_table_print_madt_entry(header);
@@ -320,12 +327,13 @@
 
 static int __init
 acpi_parse_int_src_ovr (
-	acpi_table_entry_header *header)
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_int_src_ovr *intsrc = NULL;
 
 	intsrc = (struct acpi_table_int_src_ovr*) header;
-	if (!intsrc)
+
+	if (BAD_MADT_ENTRY(intsrc, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -354,12 +362,13 @@
 
 static int __init
 acpi_parse_nmi_src (
-	acpi_table_entry_header *header)
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_nmi_src *nmi_src = NULL;
 
 	nmi_src = (struct acpi_table_nmi_src*) header;
-	if (!nmi_src)
+
+	if (BAD_MADT_ENTRY(nmi_src, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -417,16 +426,6 @@
 
 #endif /* CONFIG_ACPI_BUS */
 
-#ifdef CONFIG_X86_IO_APIC
-/* deprecated in favor of acpi_gsi_to_irq */
-int acpi_irq_to_vector(u32 irq)
-{
-	if (use_pci_vector() && !platform_legacy_irq(irq))
- 		irq = IO_APIC_VECTOR(irq);
-	return irq;
-}
-#endif
-
 int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
 {
 #ifdef CONFIG_X86_IO_APIC
@@ -728,6 +727,13 @@
 				smp_found_config = 1;
 				clustered_apic_check();
 			}
+		}
+		if (error == -EINVAL) {
+			/*
+			 * Dell Precision Workstation 410, 610 come here.
+			 */
+			printk(KERN_ERR PREFIX "Invalid BIOS MADT, disabling ACPI\n");
+			disable_acpi();
 		}
 	}
 #endif
diff -Nru a/arch/i386/kernel/acpi/wakeup.S b/arch/i386/kernel/acpi/wakeup.S
--- a/arch/i386/kernel/acpi/wakeup.S	Tue Jun 15 22:20:37 2004
+++ b/arch/i386/kernel/acpi/wakeup.S	Tue Jun 15 22:20:37 2004
@@ -270,6 +270,7 @@
 	call	save_registers
 	pushl	$3
 	call	acpi_enter_sleep_state
+	addl	$4,%esp
 	ret
 	.p2align 4,,7
 ret_point:
diff -Nru a/arch/i386/kernel/asm-offsets.c b/arch/i386/kernel/asm-offsets.c
--- a/arch/i386/kernel/asm-offsets.c	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/kernel/asm-offsets.c	Tue Jun 15 22:20:39 2004
@@ -6,30 +6,60 @@
 
 #include <linux/sched.h>
 #include <linux/signal.h>
+#include <linux/personality.h>
 #include <asm/ucontext.h>
 #include "sigframe.h"
 #include <asm/fixmap.h>
+#include <asm/processor.h>
+#include <asm/thread_info.h>
 
 #define DEFINE(sym, val) \
         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
 
 #define BLANK() asm volatile("\n->" : : )
 
+#define OFFSET(sym, str, mem) \
+	DEFINE(sym, offsetof(struct str, mem));
+
 void foo(void)
 {
-	DEFINE(SIGCONTEXT_eax, offsetof (struct sigcontext, eax));
-	DEFINE(SIGCONTEXT_ebx, offsetof (struct sigcontext, ebx));
-	DEFINE(SIGCONTEXT_ecx, offsetof (struct sigcontext, ecx));
-	DEFINE(SIGCONTEXT_edx, offsetof (struct sigcontext, edx));
-	DEFINE(SIGCONTEXT_esi, offsetof (struct sigcontext, esi));
-	DEFINE(SIGCONTEXT_edi, offsetof (struct sigcontext, edi));
-	DEFINE(SIGCONTEXT_ebp, offsetof (struct sigcontext, ebp));
-	DEFINE(SIGCONTEXT_esp, offsetof (struct sigcontext, esp));
-	DEFINE(SIGCONTEXT_eip, offsetof (struct sigcontext, eip));
+	OFFSET(SIGCONTEXT_eax, sigcontext, eax);
+	OFFSET(SIGCONTEXT_ebx, sigcontext, ebx);
+	OFFSET(SIGCONTEXT_ecx, sigcontext, ecx);
+	OFFSET(SIGCONTEXT_edx, sigcontext, edx);
+	OFFSET(SIGCONTEXT_esi, sigcontext, esi);
+	OFFSET(SIGCONTEXT_edi, sigcontext, edi);
+	OFFSET(SIGCONTEXT_ebp, sigcontext, ebp);
+	OFFSET(SIGCONTEXT_esp, sigcontext, esp);
+	OFFSET(SIGCONTEXT_eip, sigcontext, eip);
+	BLANK();
+
+	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
+	OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
+	OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
+	OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
+	OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
+	OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
+	OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
+	OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
 	BLANK();
 
-	DEFINE(RT_SIGFRAME_sigcontext,
-	       offsetof (struct rt_sigframe, uc.uc_mcontext));
+	OFFSET(TI_task, thread_info, task);
+	OFFSET(TI_exec_domain, thread_info, exec_domain);
+	OFFSET(TI_flags, thread_info, flags);
+	OFFSET(TI_status, thread_info, status);
+	OFFSET(TI_cpu, thread_info, cpu);
+	OFFSET(TI_preempt_count, thread_info, preempt_count);
+	OFFSET(TI_addr_limit, thread_info, addr_limit);
+	OFFSET(TI_restart_block, thread_info, restart_block);
+	BLANK();
+
+	OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
+	OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
+
+	/* Offset from the sysenter stack to tss.esp0 */
+	DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, esp0) -
+		 sizeof(struct tss_struct));
 
 	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
 }
diff -Nru a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
--- a/arch/i386/kernel/cpu/common.c	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/kernel/cpu/common.c	Tue Jun 15 22:20:36 2004
@@ -138,8 +138,7 @@
 }
 
 
-
-void __init get_cpu_vendor(struct cpuinfo_x86 *c)
+void __init get_cpu_vendor(struct cpuinfo_x86 *c, int early)
 {
 	char *v = c->x86_vendor_id;
 	int i;
@@ -150,7 +149,8 @@
 			    (cpu_devs[i]->c_ident[1] && 
 			     !strcmp(v,cpu_devs[i]->c_ident[1]))) {
 				c->x86_vendor = i;
-				this_cpu = cpu_devs[i];
+				if (!early)
+					this_cpu = cpu_devs[i];
 				break;
 			}
 		}
@@ -194,6 +194,44 @@
 	return flag_is_changeable_p(X86_EFLAGS_ID);
 }
 
+/* Do minimum CPU detection early.
+   Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment.
+   The others are not touched to avoid unwanted side effects. */
+void __init early_cpu_detect(void)
+{
+	struct cpuinfo_x86 *c = &boot_cpu_data;
+
+	c->x86_cache_alignment = 32;
+
+	if (!have_cpuid_p())
+		return;
+
+	/* Get vendor name */
+	cpuid(0x00000000, &c->cpuid_level,
+	      (int *)&c->x86_vendor_id[0],
+	      (int *)&c->x86_vendor_id[8],
+	      (int *)&c->x86_vendor_id[4]);
+
+	get_cpu_vendor(c, 1);
+
+	c->x86 = 4;
+	if (c->cpuid_level >= 0x00000001) {
+		u32 junk, tfms, cap0, misc;
+		cpuid(0x00000001, &tfms, &misc, &junk, &cap0);
+		c->x86 = (tfms >> 8) & 15;
+		c->x86_model = (tfms >> 4) & 15;
+		if (c->x86 == 0xf) {
+			c->x86 += (tfms >> 20) & 0xff;
+			c->x86_model += ((tfms >> 16) & 0xF) << 4;
+		}
+		c->x86_mask = tfms & 15;
+		if (cap0 & (1<<19))
+			c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8;
+	}
+
+	early_intel_workaround(c);
+}
+
 void __init generic_identify(struct cpuinfo_x86 * c)
 {
 	u32 tfms, xlvl;
@@ -206,7 +244,7 @@
 		      (int *)&c->x86_vendor_id[8],
 		      (int *)&c->x86_vendor_id[4]);
 		
-		get_cpu_vendor(c);
+		get_cpu_vendor(c, 0);
 		/* Initialize the standard set of capabilities */
 		/* Note that the vendor-specific code below might override */
 	
@@ -384,7 +422,6 @@
  
 void __init dodgy_tsc(void)
 {
-	get_cpu_vendor(&boot_cpu_data);
 	if (( boot_cpu_data.x86_vendor == X86_VENDOR_CYRIX ) ||
 	    ( boot_cpu_data.x86_vendor == X86_VENDOR_NSC   ))
 		cpu_devs[X86_VENDOR_CYRIX]->c_init(&boot_cpu_data);
@@ -432,9 +469,11 @@
 extern int rise_init_cpu(void);
 extern int nexgen_init_cpu(void);
 extern int umc_init_cpu(void);
+void early_cpu_detect(void);
 
 void __init early_cpu_init(void)
 {
+	early_cpu_detect();
 	intel_cpu_init();
 	cyrix_init_cpu();
 	nsc_init_cpu();
diff -Nru a/arch/i386/kernel/cpu/cpu.h b/arch/i386/kernel/cpu/cpu.h
--- a/arch/i386/kernel/cpu/cpu.h	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/kernel/cpu/cpu.h	Tue Jun 15 22:20:36 2004
@@ -26,3 +26,6 @@
 
 extern void generic_identify(struct cpuinfo_x86 * c);
 extern int have_cpuid_p(void);
+
+extern void early_intel_workaround(struct cpuinfo_x86 *c);
+
diff -Nru a/arch/i386/kernel/cpu/cpufreq/Makefile b/arch/i386/kernel/cpu/cpufreq/Makefile
--- a/arch/i386/kernel/cpu/cpufreq/Makefile	Tue Jun 15 22:20:40 2004
+++ b/arch/i386/kernel/cpu/cpufreq/Makefile	Tue Jun 15 22:20:40 2004
@@ -2,15 +2,15 @@
 obj-$(CONFIG_X86_POWERNOW_K7)	+= powernow-k7.o
 obj-$(CONFIG_X86_POWERNOW_K8)	+= powernow-k8.o
 obj-$(CONFIG_X86_LONGHAUL)	+= longhaul.o
-obj-$(CONFIG_X86_P4_CLOCKMOD)	+= p4-clockmod.o
 obj-$(CONFIG_ELAN_CPUFREQ)	+= elanfreq.o
 obj-$(CONFIG_X86_LONGRUN)	+= longrun.o  
 obj-$(CONFIG_X86_GX_SUSPMOD)    += gx-suspmod.o
-obj-$(CONFIG_X86_ACPI_CPUFREQ)	+= acpi.o
 obj-$(CONFIG_X86_SPEEDSTEP_ICH)	+= speedstep-ich.o
 obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
 obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o
 obj-$(CONFIG_X86_SPEEDSTEP_SMI) += speedstep-smi.o
+obj-$(CONFIG_X86_ACPI_CPUFREQ)	+= acpi.o
+obj-$(CONFIG_X86_P4_CLOCKMOD)	+= p4-clockmod.o
 
 ifdef CONFIG_X86_ACPI_CPUFREQ
   ifdef CONFIG_ACPI_DEBUG
diff -Nru a/arch/i386/kernel/cpu/cpufreq/elanfreq.c b/arch/i386/kernel/cpu/cpufreq/elanfreq.c
--- a/arch/i386/kernel/cpu/cpufreq/elanfreq.c	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/kernel/cpu/cpufreq/elanfreq.c	Tue Jun 15 22:20:39 2004
@@ -77,7 +77,7 @@
  *	and have the rest of the chip running with 33 MHz. 
  */
 
-static unsigned int elanfreq_get_cpu_frequency(void)
+static unsigned int elanfreq_get_cpu_frequency(unsigned int cpu)
 {
         u8 clockspeed_reg;    /* Clock Speed Register */
 	
@@ -121,7 +121,7 @@
 
 	struct cpufreq_freqs    freqs;
 
-	freqs.old = elanfreq_get_cpu_frequency();
+	freqs.old = elanfreq_get_cpu_frequency(0);
 	freqs.new = elan_multiplier[state].clock;
 	freqs.cpu = 0; /* elanfreq.c is UP only driver */
 	
@@ -209,7 +209,7 @@
 
 	/* max freq */
 	if (!max_freq)
-		max_freq = elanfreq_get_cpu_frequency();
+		max_freq = elanfreq_get_cpu_frequency(0);
 
 	/* table init */
  	for (i=0; (elanfreq_table[i].frequency != CPUFREQ_TABLE_END); i++) {
@@ -220,7 +220,7 @@
 	/* cpuinfo and default policy values */
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
-	policy->cur = elanfreq_get_cpu_frequency();
+	policy->cur = elanfreq_get_cpu_frequency(0);
 
 	result = cpufreq_frequency_table_cpuinfo(policy, elanfreq_table);
 	if (result)
@@ -254,6 +254,7 @@
 static int __init elanfreq_setup(char *str)
 {
 	max_freq = simple_strtoul(str, &str, 0);
+	printk(KERN_WARNING "You're using the deprecated elanfreq command line option. Use elanfreq.max_freq instead, please!\n");
 	return 1;
 }
 __setup("elanfreq=", elanfreq_setup);
@@ -267,6 +268,7 @@
 
 
 static struct cpufreq_driver elanfreq_driver = {
+	.get	 	= elanfreq_get_cpu_frequency,
 	.verify 	= elanfreq_verify,
 	.target 	= elanfreq_target,
 	.init		= elanfreq_cpu_init,
@@ -299,7 +301,7 @@
 }
 
 
-MODULE_PARM (max_freq, "i");
+module_param (max_freq, int, 0444);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Robert Schwebel <r.schwebel@pengutronix.de>, Sven Geggus <sven@geggus.net>");
diff -Nru a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
--- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c	Tue Jun 15 22:20:40 2004
+++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c	Tue Jun 15 22:20:40 2004
@@ -75,7 +75,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h> 
-#include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/cpufreq.h>
@@ -125,7 +124,7 @@
 
 /* PCI bus clock - defaults to 30.000 if cpu_khz is not available */
 static int pci_busclk = 0;
-MODULE_PARM(pci_busclk, "i");
+module_param (pci_busclk, int, 0444);
 
 /* maximum duration for which the cpu may be suspended
  * (32us * MAX_DURATION). If no parameter is given, this defaults
@@ -134,7 +133,7 @@
  * is suspended -- processing power is just 0.39% of what it used to be,
  * though. 781.25 kHz(!) for a 200 MHz processor -- wow. */
 static int max_duration = 255;
-MODULE_PARM(max_duration, "i");
+module_param (max_duration, int, 0444);
 
 /* For the default policy, we want at least some processing power
  * - let's say 5%. (min = maxfreq / POLICY_MIN_DIV)
@@ -215,7 +214,7 @@
  *
  * Finds out at which efficient frequency the Cyrix MediaGX/NatSemi Geode CPU runs.
  */
-static int gx_get_cpuspeed(void)
+static unsigned int gx_get_cpuspeed(unsigned int cpu)
 {
 	if ((gx_params->pci_suscfg & SUSMOD) == 0) 
 		return stock_freq;
@@ -271,7 +270,7 @@
 
 
 	freqs.cpu = 0;
-	freqs.old = gx_get_cpuspeed();
+	freqs.old = gx_get_cpuspeed(0);
 
 	new_khz = gx_validate_speed(khz, &gx_params->on_duration, &gx_params->off_duration);
 
@@ -405,7 +404,7 @@
 
 static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy)
 {
-	int maxfreq, curfreq;
+	unsigned int maxfreq, curfreq;
 
 	if (!policy || policy->cpu != 0)
 		return -ENODEV;
@@ -419,7 +418,7 @@
 		maxfreq = 30000 * gx_freq_mult[getCx86(CX86_DIR1) & 0x0f];
 	}
 	stock_freq = maxfreq;
-	curfreq = gx_get_cpuspeed();
+	curfreq = gx_get_cpuspeed(0);
 
 	dprintk("cpu max frequency is %d.\n", maxfreq);
 	dprintk("cpu current frequency is %dkHz.\n",curfreq);
@@ -446,6 +445,7 @@
  *   MediaGX/Geode GX initialize cpufreq driver
  */
 static struct cpufreq_driver gx_suspmod_driver = {
+	.get		= gx_get_cpuspeed,
 	.verify		= cpufreq_gx_verify,
 	.target		= cpufreq_gx_target,
 	.init		= cpufreq_gx_cpu_init,
diff -Nru a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c	Tue Jun 15 22:20:36 2004
@@ -18,7 +18,8 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h> 
+#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
@@ -30,25 +31,33 @@
 
 #include "longhaul.h"
 
-#define DEBUG
-
-#ifdef DEBUG
-#define dprintk(msg...) printk(msg)
-#else
-#define dprintk(msg...) do { } while(0)
-#endif
-
 #define PFX "longhaul: "
 
 static unsigned int numscales=16, numvscales;
+static unsigned int fsb;
 static int minvid, maxvid;
+static unsigned int minmult, maxmult;
 static int can_scale_voltage;
 static int vrmrev;
 
-
 /* Module parameters */
 static int dont_scale_voltage;
-static unsigned int fsb;
+static int debug;
+
+static void dprintk(const char *fmt, ...)
+{
+	char s[256];
+	va_list args;
+
+	if (debug == 0)
+		return;
+
+	va_start(args, fmt);
+	vsprintf(s, fmt, args);
+	printk(s);
+	va_end(args);
+}
+
 
 #define __hlt()     __asm__ __volatile__("hlt": : :"memory")
 
@@ -61,7 +70,7 @@
 static struct cpufreq_frequency_table *longhaul_table;
 
 
-static unsigned int calc_speed (int mult, int fsb)
+static unsigned int calc_speed(int mult, int fsb)
 {
 	int khz;
 	khz = (mult/10)*fsb;
@@ -72,13 +81,13 @@
 }
 
 
-static int longhaul_get_cpu_mult (void)
+static int longhaul_get_cpu_mult(void)
 {
 	unsigned long invalue=0,lo, hi;
 
 	rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi);
 	invalue = (lo & (1<<22|1<<23|1<<24|1<<25)) >>22;
-	if (longhaul_version==2) {
+	if (longhaul_version==2 || longhaul_version==3) {
 		if (lo & (1<<27))
 			invalue+=16;
 	}
@@ -93,7 +102,7 @@
  * Sets a new clock ratio, and -if applicable- a new Front Side Bus
  */
 
-static void longhaul_setstate (unsigned int clock_ratio_index)
+static void longhaul_setstate(unsigned int clock_ratio_index)
 {
 	int speed, mult;
 	struct cpufreq_freqs freqs;
@@ -114,8 +123,7 @@
 
 	cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
 
-	dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb,
-				mult/10, mult%10);
+	dprintk (KERN_INFO PFX "FSB:%d Mult:%d.%dx\n", fsb, mult/10, mult%10);
 
 	switch (longhaul_version) {
 	case 1:
@@ -158,6 +166,22 @@
 		longhaul.bits.RevisionKey = 3;
 		wrmsrl (MSR_VIA_LONGHAUL, longhaul.val);
 		break;
+	case 3:
+		rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
+		longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf;
+		longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4;
+		longhaul.bits.EnableSoftBusRatio = 1;
+
+		longhaul.bits.RevisionKey = 0x0;
+
+		wrmsrl(MSR_VIA_LONGHAUL, longhaul.val);
+		__hlt();
+
+		rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
+		longhaul.bits.EnableSoftBusRatio = 0;
+		longhaul.bits.RevisionKey = 0xf;
+		wrmsrl (MSR_VIA_LONGHAUL, longhaul.val);
+		break;
 	}
 
 	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
@@ -174,7 +198,7 @@
 
 #define ROUNDING	0xf
 
-static int _guess (int guess, int maxmult)
+static int _guess(int guess)
 {
 	int target;
 
@@ -187,7 +211,7 @@
 }
 
 
-static int guess_fsb(int maxmult)
+static int guess_fsb(void)
 {
 	int speed = (cpu_khz/1000);
 	int i;
@@ -197,25 +221,25 @@
 	speed &= ~ROUNDING;
 
 	for (i=0; i<3; i++) {
-		if (_guess(speeds[i],maxmult) == speed)
+		if (_guess(speeds[i]) == speed)
 			return speeds[i];
 	}
 	return 0;
 }
 
 
-static int __init longhaul_get_ranges (void)
+static int __init longhaul_get_ranges(void)
 {
 	struct cpuinfo_x86 *c = cpu_data;
 	unsigned long invalue;
-	unsigned int minmult=0, maxmult=0;
 	unsigned int multipliers[32]= {
 		50,30,40,100,55,35,45,95,90,70,80,60,120,75,85,65,
 		-1,110,120,-1,135,115,125,105,130,150,160,140,-1,155,-1,145 };
 	unsigned int j, k = 0;
 	union msr_longhaul longhaul;
 	unsigned long lo, hi;
-	unsigned int eblcr_fsb_table[] = { 66, 133, 100, -1 };
+	unsigned int eblcr_fsb_table_v1[] = { 66, 133, 100, -1 };
+	unsigned int eblcr_fsb_table_v2[] = { 133, 100, -1, 66 };
 
 	switch (longhaul_version) {
 	case 1:
@@ -226,16 +250,14 @@
 		rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi);
 		invalue = (lo & (1<<18|1<<19)) >>18;
 		if (c->x86_model==6)
-			fsb = eblcr_fsb_table[invalue];
+			fsb = eblcr_fsb_table_v1[invalue];
 		else
-			fsb = guess_fsb(maxmult);
+			fsb = guess_fsb();
 		break;
 
 	case 2:
 		rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
 
-		//TODO: Nehemiah may have borken MaxMHzBR.
-		// need to extrapolate from FSB.
 		invalue = longhaul.bits.MaxMHzBR;
 		if (longhaul.bits.MaxMHzBR4)
 			invalue += 16;
@@ -247,21 +269,38 @@
 		else
 			minmult = multipliers[invalue];
 
-		switch (longhaul.bits.MaxMHzFSB) {
-		case 0x0:	fsb=133;
-				break;
-		case 0x1:	fsb=100;
-				break;
-		case 0x2:	printk (KERN_INFO PFX "Invalid (reserved) FSB!\n");
-			return -EINVAL;
-		case 0x3:	fsb=66;
-				break;
-		}
+		fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB];
+		break;
+
+	case 3:
+		rdmsrl (MSR_VIA_LONGHAUL, longhaul.val);
+
+		/*
+		 * TODO: This code works, but raises a lot of questions.
+		 * - Some Nehemiah's seem to have broken Min/MaxMHzBR's.
+		 *   We get around this by using a hardcoded multiplier of 5.0x
+		 *   for the minimimum speed, and the speed we booted up at for the max.
+		 *   This is done in longhaul_get_cpu_mult() by reading the EBLCR register.
+		 * - According to some VIA documentation EBLCR is only
+		 *   in pre-Nehemiah C3s. How this still works is a mystery.
+		 *   We're possibly using something undocumented and unsupported,
+		 *   But it works, so we don't grumble.
+		 */
+		minmult=50;
+		maxmult=longhaul_get_cpu_mult();
+
+		fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB];
 		break;
 	}
 
 	dprintk (KERN_INFO PFX "MinMult=%d.%dx MaxMult=%d.%dx\n",
 		 minmult/10, minmult%10, maxmult/10, maxmult%10);
+
+	if (fsb == -1) {
+		printk (KERN_INFO PFX "Invalid (reserved) FSB!\n");
+		return -EINVAL;
+	}
+
 	highest_speed = calc_speed (maxmult, fsb);
 	lowest_speed = calc_speed (minmult,fsb);
 	dprintk (KERN_INFO PFX "FSB: %dMHz Lowestspeed=%dMHz Highestspeed=%dMHz\n",
@@ -363,24 +402,31 @@
 }
 
 
-static int longhaul_target (struct cpufreq_policy *policy,
+static int longhaul_target(struct cpufreq_policy *policy,
 			    unsigned int target_freq,
 			    unsigned int relation)
 {
 	unsigned int table_index = 0;
- 	unsigned int new_clock_ratio = 0;
+	unsigned int new_clock_ratio = 0;
 
 	if (cpufreq_frequency_table_target(policy, longhaul_table, target_freq, relation, &table_index))
 		return -EINVAL;
 
 	new_clock_ratio = longhaul_table[table_index].index & 0xFF;
- 
+
 	longhaul_setstate(new_clock_ratio);
 
 	return 0;
 }
 
-static int __init longhaul_cpu_init (struct cpufreq_policy *policy)
+static unsigned int longhaul_get(unsigned int cpu)
+{
+	if (cpu)
+		return 0;
+	return (calc_speed (longhaul_get_cpu_mult(), fsb));
+}
+
+static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
 {
 	struct cpuinfo_x86 *c = cpu_data;
 	char *cpuname=NULL;
@@ -423,11 +469,25 @@
 		break;
 
 	case 9:
-		cpuname = "C3 'Nehemiah' [C5N]";
-		longhaul_version=2;
+		longhaul_version=3;
 		numscales=32;
-		memcpy (clock_ratio, nehemiah_clock_ratio, sizeof(nehemiah_clock_ratio));
-		memcpy (eblcr_table, nehemiah_eblcr, sizeof(nehemiah_eblcr));
+		switch (c->x86_mask) {
+		case 0 ... 1:
+			cpuname = "C3 'Nehemiah A' [C5N]";
+			memcpy (clock_ratio, nehemiah_a_clock_ratio, sizeof(nehemiah_a_clock_ratio));
+			memcpy (eblcr_table, nehemiah_a_eblcr, sizeof(nehemiah_a_eblcr));
+			break;
+		case 2 ... 4:
+			cpuname = "C3 'Nehemiah B' [C5N]";
+			memcpy (clock_ratio, nehemiah_b_clock_ratio, sizeof(nehemiah_b_clock_ratio));
+			memcpy (eblcr_table, nehemiah_b_eblcr, sizeof(nehemiah_b_eblcr));
+			break;
+		case 5 ... 15:
+			cpuname = "C3 'Nehemiah C' [C5N]";
+			memcpy (clock_ratio, nehemiah_c_clock_ratio, sizeof(nehemiah_c_clock_ratio));
+			memcpy (eblcr_table, nehemiah_c_eblcr, sizeof(nehemiah_c_eblcr));
+			break;
+		}
 		break;
 
 	default:
@@ -442,11 +502,11 @@
 	if (ret != 0)
 		return ret;
 
- 	if ((longhaul_version==2) && (dont_scale_voltage==0))
+	if ((longhaul_version==2) && (dont_scale_voltage==0))
 		longhaul_setup_voltagescaling();
 
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
- 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
+	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
 	policy->cur = calc_speed (longhaul_get_cpu_mult(), fsb);
 
 	ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table);
@@ -458,7 +518,7 @@
 	return 0;
 }
 
-static int __exit longhaul_cpu_exit(struct cpufreq_policy *policy)
+static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy)
 {
 	cpufreq_frequency_table_put_attr(policy->cpu);
 	return 0;
@@ -470,16 +530,17 @@
 };
 
 static struct cpufreq_driver longhaul_driver = {
-	.verify 	= longhaul_verify,
-	.target 	= longhaul_target,
-	.init		= longhaul_cpu_init,
-	.exit		= longhaul_cpu_exit,
-	.name		= "longhaul",
-	.owner		= THIS_MODULE,
-	.attr		= longhaul_attr,
+	.verify	= longhaul_verify,
+	.target	= longhaul_target,
+	.get	= longhaul_get,
+	.init	= longhaul_cpu_init,
+	.exit	= __devexit_p(longhaul_cpu_exit),
+	.name	= "longhaul",
+	.owner	= THIS_MODULE,
+	.attr	= longhaul_attr,
 };
 
-static int __init longhaul_init (void)
+static int __init longhaul_init(void)
 {
 	struct cpuinfo_x86 *c = cpu_data;
 
@@ -487,12 +548,8 @@
 		return -ENODEV;
 
 	switch (c->x86_model) {
-	case 6 ... 8:
+	case 6 ... 9:
 		return cpufreq_register_driver(&longhaul_driver);
-	case 9:
-		printk (KERN_INFO PFX "Nehemiah unsupported: Waiting on working silicon "
-						"from VIA before this is usable.\n");
-		break;
 	default:
 		printk (KERN_INFO PFX "Unknown VIA CPU. Contact davej@codemonkey.org.uk\n");
 	}
@@ -500,13 +557,26 @@
 	return -ENODEV;
 }
 
-static void __exit longhaul_exit (void)
+static void __exit longhaul_exit(void)
 {
+	int i=0;
+	unsigned int new_clock_ratio;
+
+	while (clock_ratio[i] != maxmult)
+		i++;
+
+	new_clock_ratio = longhaul_table[i].index & 0xFF;
+	longhaul_setstate(new_clock_ratio);
+
 	cpufreq_unregister_driver(&longhaul_driver);
 	kfree(longhaul_table);
 }
 
-MODULE_PARM (dont_scale_voltage, "i");
+module_param (dont_scale_voltage, int, 0644);
+MODULE_PARM_DESC(dont_scale_voltage, "Don't scale voltage of processor");
+
+module_param (debug, int, 0644);
+MODULE_PARM_DESC(debug, "Dump debugging information.");
 
 MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
 MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors.");
diff -Nru a/arch/i386/kernel/cpu/cpufreq/longhaul.h b/arch/i386/kernel/cpu/cpufreq/longhaul.h
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.h	Tue Jun 15 22:20:38 2004
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.h	Tue Jun 15 22:20:38 2004
@@ -234,14 +234,15 @@
 
 /*
  * VIA C3 Nehemiah */
-static int __initdata nehemiah_clock_ratio[32] = {
+ 
+static int __initdata nehemiah_a_clock_ratio[32] = {
 	100, /* 0000 -> 10.0x */
 	160, /* 0001 -> 16.0x */
-	-1,  /* 0010 -> RESERVED */
+	-1,  /* 0010 ->  RESERVED */
 	90,  /* 0011 ->  9.0x */
 	95,  /* 0100 ->  9.5x */
-	-1,  /* 0101 -> RESERVED */
-	-1,  /* 0110 -> RESERVED */
+	-1,  /* 0101 ->  RESERVED */
+	-1,  /* 0110 ->  RESERVED */
 	55,  /* 0111 ->  5.5x */
 	60,  /* 1000 ->  6.0x */
 	70,  /* 1001 ->  7.0x */
@@ -250,8 +251,77 @@
 	65,  /* 1100 ->  6.5x */
 	75,  /* 1101 ->  7.5x */
 	85,  /* 1110 ->  8.5x */
-	120, /* 1111 ->  12.0x */
+	120, /* 1111 -> 12.0x */
+	100, /* 0000 -> 10.0x */
+	-1,  /* 0001 -> RESERVED */
+	120, /* 0010 -> 12.0x */
+	90,  /* 0011 ->  9.0x */
+	105, /* 0100 -> 10.5x */
+	115, /* 0101 -> 11.5x */
+	125, /* 0110 -> 12.5x */
+	135, /* 0111 -> 13.5x */
+	140, /* 1000 -> 14.0x */
+	150, /* 1001 -> 15.0x */
+	160, /* 1010 -> 16.0x */
+	130, /* 1011 -> 13.0x */
+	145, /* 1100 -> 14.5x */
+	155, /* 1101 -> 15.5x */
+	-1,  /* 1110 -> RESERVED (13.0x) */
+	120, /* 1111 -> 12.0x */
+};
+
+static int __initdata  nehemiah_b_clock_ratio[32] = {
+	100, /* 0000 -> 10.0x */
+	160, /* 0001 -> 16.0x */
+	-1,  /* 0010 ->  RESERVED */
+	90,  /* 0011 ->  9.0x */
+	95,  /* 0100 ->  9.5x */
+	-1,  /* 0101 ->  RESERVED */
+	-1,  /* 0110 ->  RESERVED */
+	55,  /* 0111 ->  5.5x */
+	60,  /* 1000 ->  6.0x */
+	70,  /* 1001 ->  7.0x */
+	80,  /* 1010 ->  8.0x */
+	50,  /* 1011 ->  5.0x */
+	65,  /* 1100 ->  6.5x */
+	75,  /* 1101 ->  7.5x */
+	85,  /* 1110 ->  8.5x */
+	120, /* 1111 -> 12.0x */
+	100, /* 0000 -> 10.0x */
+	110, /* 0001 -> 11.0x */
+	120, /* 0010 -> 12.0x */
+	90,  /* 0011 ->  9.0x */
+	105, /* 0100 -> 10.5x */
+	115, /* 0101 -> 11.5x */
+	125, /* 0110 -> 12.5x */
+	135, /* 0111 -> 13.5x */
+	140, /* 1000 -> 14.0x */
+	150, /* 1001 -> 15.0x */
+	160, /* 1010 -> 16.0x */
+	130, /* 1011 -> 13.0x */
+	145, /* 1100 -> 14.5x */
+	155, /* 1101 -> 15.5x */
+	-1,  /* 1110 -> RESERVED (13.0x) */
+	120, /* 1111 -> 12.0x */
+};
 
+static int __initdata  nehemiah_c_clock_ratio[32] = {
+	100, /* 0000 -> 10.0x */
+	160, /* 0001 -> 16.0x */
+	40,  /* 0010 ->  RESERVED */
+	90,  /* 0011 ->  9.0x */
+	95,  /* 0100 ->  9.5x */
+	-1,  /* 0101 ->  RESERVED */
+	45,  /* 0110 ->  RESERVED */
+	55,  /* 0111 ->  5.5x */
+	60,  /* 1000 ->  6.0x */
+	70,  /* 1001 ->  7.0x */
+	80,  /* 1010 ->  8.0x */
+	50,  /* 1011 ->  5.0x */
+	65,  /* 1100 ->  6.5x */
+	75,  /* 1101 ->  7.5x */
+	85,  /* 1110 ->  8.5x */
+	120, /* 1111 -> 12.0x */
 	100, /* 0000 -> 10.0x */
 	110, /* 0001 -> 11.0x */
 	120, /* 0010 -> 12.0x */
@@ -266,18 +336,53 @@
 	130, /* 1011 -> 13.0x */
 	145, /* 1100 -> 14.5x */
 	155, /* 1101 -> 15.5x */
-	-1,  /* 1110 -> RESERVED */
+	-1,  /* 1110 -> RESERVED (13.0x) */
 	120, /* 1111 -> 12.0x */
 };
 
-static int __initdata nehemiah_eblcr[32] = {
+static int __initdata nehemiah_a_eblcr[32] = {
 	50,  /* 0000 ->  5.0x */
 	160, /* 0001 -> 16.0x */
-	-1,  /* 0010 -> RESERVED */
+	-1,  /* 0010 ->  RESERVED */
 	100, /* 0011 -> 10.0x */
 	55,  /* 0100 ->  5.5x */
-	-1,  /* 0101 -> RESERVED */
-	-1,  /* 0110 -> RESERVED */
+	-1,  /* 0101 ->  RESERVED */
+	-1,  /* 0110 ->  RESERVED */
+	95,  /* 0111 ->  9.5x */
+	90,  /* 1000 ->  9.0x */
+	70,  /* 1001 ->  7.0x */
+	80,  /* 1010 ->  8.0x */
+	60,  /* 1011 ->  6.0x */
+	120, /* 1100 -> 12.0x */
+	75,  /* 1101 ->  7.5x */
+	85,  /* 1110 ->  8.5x */
+	65,  /* 1111 ->  6.5x */
+	90,  /* 0000 ->  9.0x */
+	-1,  /* 0001 -> RESERVED */
+	120, /* 0010 -> 12.0x */
+	100, /* 0011 -> 10.0x */
+	135, /* 0100 -> 13.5x */
+	115, /* 0101 -> 11.5x */
+	125, /* 0110 -> 12.5x */
+	105, /* 0111 -> 10.5x */
+	130, /* 1000 -> 13.0x */
+	150, /* 1001 -> 15.0x */
+	160, /* 1010 -> 16.0x */
+	140, /* 1011 -> 14.0x */
+	120, /* 1100 -> 12.0x */
+	155, /* 1101 -> 15.5x */
+	-1,  /* 1110 -> RESERVED (13.0x) */
+	145 /* 1111 -> 14.5x */
+   /* end of table  */
+};
+static int __initdata nehemiah_b_eblcr[32] = {
+	50,  /* 0000 ->  5.0x */
+	160, /* 0001 -> 16.0x */
+	-1,  /* 0010 ->  RESERVED */
+	100, /* 0011 -> 10.0x */
+	55,  /* 0100 ->  5.5x */
+	-1,  /* 0101 ->  RESERVED */
+	-1,  /* 0110 ->  RESERVED */
 	95,  /* 0111 ->  9.5x */
 	90,  /* 1000 ->  9.0x */
 	70,  /* 1001 ->  7.0x */
@@ -287,7 +392,6 @@
 	75,  /* 1101 ->  7.5x */
 	85,  /* 1110 ->  8.5x */
 	65,  /* 1111 ->  6.5x */
-
 	90,  /* 0000 ->  9.0x */
 	110, /* 0001 -> 11.0x */
 	120, /* 0010 -> 12.0x */
@@ -302,9 +406,46 @@
 	140, /* 1011 -> 14.0x */
 	120, /* 1100 -> 12.0x */
 	155, /* 1101 -> 15.5x */
-	-1,  /* 1110 -> RESERVED */
-	-1,  /* 1111 -> RESERVED */
+	-1,  /* 1110 -> RESERVED (13.0x) */
+	145 /* 1111 -> 14.5x */
+	   /* end of table  */
 };
+static int __initdata nehemiah_c_eblcr[32] = {
+	50,  /* 0000 ->  5.0x */
+	160, /* 0001 -> 16.0x */
+	40,  /* 0010 ->  RESERVED */
+	100, /* 0011 -> 10.0x */
+	55,  /* 0100 ->  5.5x */
+	-1,  /* 0101 ->  RESERVED */
+	45,  /* 0110 ->  RESERVED */
+	95,  /* 0111 ->  9.5x */
+	90,  /* 1000 ->  9.0x */
+	70,  /* 1001 ->  7.0x */
+	80,  /* 1010 ->  8.0x */
+	60,  /* 1011 ->  6.0x */
+	120, /* 1100 -> 12.0x */
+	75,  /* 1101 ->  7.5x */
+	85,  /* 1110 ->  8.5x */
+	65,  /* 1111 ->  6.5x */
+	90,  /* 0000 ->  9.0x */
+	110, /* 0001 -> 11.0x */
+	120, /* 0010 -> 12.0x */
+	100, /* 0011 -> 10.0x */
+	135, /* 0100 -> 13.5x */
+	115, /* 0101 -> 11.5x */
+	125, /* 0110 -> 12.5x */
+	105, /* 0111 -> 10.5x */
+	130, /* 1000 -> 13.0x */
+	150, /* 1001 -> 15.0x */
+	160, /* 1010 -> 16.0x */
+	140, /* 1011 -> 14.0x */
+	120, /* 1100 -> 12.0x */
+	155, /* 1101 -> 15.5x */
+	-1,  /* 1110 -> RESERVED (13.0x) */
+	145 /* 1111 -> 14.5x */
+	  /* end of table  */
+};
+
 /* 
  * Voltage scales. Div/Mod by 1000 to get actual voltage.
  * Which scale to use depends on the VRM type in use.
diff -Nru a/arch/i386/kernel/cpu/cpufreq/longrun.c b/arch/i386/kernel/cpu/cpufreq/longrun.c
--- a/arch/i386/kernel/cpu/cpufreq/longrun.c	Tue Jun 15 22:20:43 2004
+++ b/arch/i386/kernel/cpu/cpufreq/longrun.c	Tue Jun 15 22:20:43 2004
@@ -46,11 +46,16 @@
 	rdmsr(MSR_TMTA_LONGRUN_CTRL, msr_lo, msr_hi);
 	msr_lo &= 0x0000007F;
 	msr_hi &= 0x0000007F;
-
-	policy->min = longrun_low_freq + msr_lo * 
-		((longrun_high_freq - longrun_low_freq) / 100);
-	policy->max = longrun_low_freq + msr_hi * 
-		((longrun_high_freq - longrun_low_freq) / 100);
+	
+	if ( longrun_high_freq <= longrun_low_freq ) {
+		/* Assume degenerate Longrun table */
+		policy->min = policy->max = longrun_high_freq;
+	} else {
+		policy->min = longrun_low_freq + msr_lo * 
+			((longrun_high_freq - longrun_low_freq) / 100);
+		policy->max = longrun_low_freq + msr_hi * 
+			((longrun_high_freq - longrun_low_freq) / 100);
+	}
 	policy->cpu = 0;
 }
 
@@ -70,10 +75,15 @@
 	if (!policy)
 		return -EINVAL;
 
-	pctg_lo = (policy->min - longrun_low_freq) / 
-		((longrun_high_freq - longrun_low_freq) / 100);
-	pctg_hi = (policy->max - longrun_low_freq) / 
-		((longrun_high_freq - longrun_low_freq) / 100);
+	if ( longrun_high_freq <= longrun_low_freq ) {
+		/* Assume degenerate Longrun table */
+		pctg_lo = pctg_hi = 100;
+	} else {
+		pctg_lo = (policy->min - longrun_low_freq) / 
+			((longrun_high_freq - longrun_low_freq) / 100);
+		pctg_hi = (policy->max - longrun_low_freq) / 
+			((longrun_high_freq - longrun_low_freq) / 100);
+	}
 
 	if (pctg_hi > 100)
 		pctg_hi = 100;
@@ -128,6 +138,17 @@
 	return 0;
 }
 
+static unsigned int longrun_get(unsigned int cpu)
+{
+	u32 eax, ebx, ecx, edx;
+
+	if (cpu)
+		return 0;
+
+	cpuid(0x80860007, &eax, &ebx, &ecx, &edx);
+
+	return (eax * 1000);
+}
 
 /**
  * longrun_determine_freqs - determines the lowest and highest possible core frequency
@@ -250,8 +271,10 @@
 
 
 static struct cpufreq_driver longrun_driver = {
+	.flags		= CPUFREQ_CONST_LOOPS,
 	.verify 	= longrun_verify_policy,
 	.setpolicy 	= longrun_set_policy,
+	.get		= longrun_get,
 	.init		= longrun_cpu_init,
 	.name		= "longrun",
 	.owner		= THIS_MODULE,
diff -Nru a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c	Tue Jun 15 22:21:00 2004
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c	Tue Jun 15 22:21:00 2004
@@ -27,7 +27,7 @@
 #include <linux/smp.h>
 #include <linux/cpufreq.h>
 #include <linux/slab.h>
-#include <linux/sched.h>
+#include <linux/cpumask.h>
 
 #include <asm/processor.h> 
 #include <asm/msr.h>
@@ -35,7 +35,7 @@
 
 #include "speedstep-lib.h"
 
-#define PFX	"cpufreq: "
+#define PFX	"p4-clockmod: "
 
 /*
  * Duty Cycle (3bits), note DC_DISABLE is not specified in
@@ -51,59 +51,16 @@
 
 static int has_N44_O17_errata[NR_CPUS];
 static unsigned int stock_freq;
+static struct cpufreq_driver p4clockmod_driver;
+static unsigned int cpufreq_p4_get(unsigned int cpu);
 
 static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
 {
 	u32 l, h;
-	cpumask_t cpus_allowed, affected_cpu_map;
-	struct cpufreq_freqs freqs;
-	int hyperthreading = 0;
-	int sibling = 0;
 
-	if (!cpu_online(cpu) || (newstate > DC_DISABLE) || 
-		(newstate == DC_RESV))
+	if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV))
 		return -EINVAL;
 
-	/* switch to physical CPU where state is to be changed*/
-	cpus_allowed = current->cpus_allowed;
-
-	/* only run on CPU to be set, or on its sibling */
-       affected_cpu_map = cpumask_of_cpu(cpu);
-#ifdef CONFIG_X86_HT
-	hyperthreading = ((cpu_has_ht) && (smp_num_siblings == 2));
-	if (hyperthreading) {
-		sibling = cpu_sibling_map[cpu];
-                cpu_set(sibling, affected_cpu_map);
-	}
-#endif
-	set_cpus_allowed(current, affected_cpu_map);
-        BUG_ON(!cpu_isset(smp_processor_id(), affected_cpu_map));
-
-	/* get current state */
-	rdmsr(MSR_IA32_THERM_CONTROL, l, h);
-	if (l & 0x10) {
-		l = l >> 1;
-		l &= 0x7;
-	} else
-		l = DC_DISABLE;
-	
-	if (l == newstate) {
-		set_cpus_allowed(current, cpus_allowed);
-		return 0;
-	} else if (l == DC_RESV) {
-		printk(KERN_ERR PFX "BIG FAT WARNING: currently in invalid setting\n");
-	}
-
-	/* notifiers */
-	freqs.old = stock_freq * l / 8;
-	freqs.new = stock_freq * newstate / 8;
-	freqs.cpu = cpu;
-	cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
-	if (hyperthreading) {
-		freqs.cpu = sibling;
-		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
-	}
-
 	rdmsr(MSR_IA32_THERM_STATUS, l, h);
 #if 0
 	if (l & 0x01)
@@ -129,15 +86,6 @@
 		wrmsr(MSR_IA32_THERM_CONTROL, l, h);
 	}
 
-	set_cpus_allowed(current, cpus_allowed);
-
-	/* notifiers */
-	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
-	if (hyperthreading) {
-		freqs.cpu = cpu;
-		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
-	}
-
 	return 0;
 }
 
@@ -161,11 +109,53 @@
 			     unsigned int relation)
 {
 	unsigned int    newstate = DC_RESV;
+	struct cpufreq_freqs freqs;
+	cpumask_t cpus_allowed, affected_cpu_map;
+	int i;
 
 	if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate))
 		return -EINVAL;
 
-	cpufreq_p4_setdc(policy->cpu, p4clockmod_table[newstate].index);
+	freqs.old = cpufreq_p4_get(policy->cpu);
+	freqs.new = stock_freq * p4clockmod_table[newstate].index / 8;
+
+	if (freqs.new == freqs.old)
+		return 0;
+
+	/* switch to physical CPU where state is to be changed*/
+	cpus_allowed = current->cpus_allowed;
+
+	/* only run on CPU to be set, or on its sibling */
+#ifdef CONFIG_SMP
+	affected_cpu_map = cpu_sibling_map[policy->cpu];
+#else
+	affected_cpu_map = cpumask_of_cpu(policy->cpu);
+#endif
+
+	/* notifiers */
+	for_each_cpu_mask(i, affected_cpu_map) {
+		freqs.cpu = i;
+		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+	}
+
+	/* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software
+	 * Developer's Manual, Volume 3 
+	 */
+	for_each_cpu_mask(i, affected_cpu_map) {
+		cpumask_t this_cpu = cpumask_of_cpu(i);
+
+		set_cpus_allowed(current, this_cpu);
+		BUG_ON(smp_processor_id() != i);
+
+		cpufreq_p4_setdc(i, p4clockmod_table[newstate].index);
+	}
+	set_cpus_allowed(current, cpus_allowed);
+
+	/* notifiers */
+	for_each_cpu_mask(i, affected_cpu_map) {
+		freqs.cpu = i;
+		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
+	}
 
 	return 0;
 }
@@ -180,11 +170,23 @@
 static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
 {
 	if ((c->x86 == 0x06) && (c->x86_model == 0x09)) {
-		/* Pentium M */
+		/* Pentium M (Banias) */
+		printk(KERN_WARNING PFX "Warning: Pentium M detected. "
+		       "The speedstep_centrino module offers voltage scaling"
+		       " in addition of frequency scaling. You should use "
+		       "that instead of p4-clockmod, if possible.\n");
+		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
+	}
+
+	if ((c->x86 == 0x06) && (c->x86_model == 0x13)) {
+		/* Pentium M (Dothan) */
 		printk(KERN_WARNING PFX "Warning: Pentium M detected. "
 		       "The speedstep_centrino module offers voltage scaling"
 		       " in addition of frequency scaling. You should use "
 		       "that instead of p4-clockmod, if possible.\n");
+		/* on P-4s, the TSC runs with constant frequency independent wether
+		 * throttling is active or not. */
+		p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
 		return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
 	}
 
@@ -193,6 +195,10 @@
 		return 0;
 	}
 
+	/* on P-4s, the TSC runs with constant frequency independent wether
+	 * throttling is active or not. */
+	p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
+
 	if (speedstep_detect_processor() == SPEEDSTEP_PROCESSOR_P4M) {
 		printk(KERN_WARNING PFX "Warning: Pentium 4-M detected. "
 		       "The speedstep-ich or acpi cpufreq modules offer "
@@ -252,6 +258,33 @@
 	return 0;
 }
 
+static unsigned int cpufreq_p4_get(unsigned int cpu)
+{
+	cpumask_t cpus_allowed, affected_cpu_map;
+	u32 l, h;
+
+	cpus_allowed = current->cpus_allowed;
+        affected_cpu_map = cpumask_of_cpu(cpu);
+
+	set_cpus_allowed(current, affected_cpu_map);
+        BUG_ON(!cpu_isset(smp_processor_id(), affected_cpu_map));
+
+	rdmsr(MSR_IA32_THERM_CONTROL, l, h);
+
+	set_cpus_allowed(current, cpus_allowed);
+
+	if (l & 0x10) {
+		l = l >> 1;
+		l &= 0x7;
+	} else
+		l = DC_DISABLE;
+
+	if (l != DC_DISABLE)
+		return (stock_freq * l / 8);
+
+	return stock_freq;
+}
+
 static struct freq_attr* p4clockmod_attr[] = {
 	&cpufreq_freq_attr_scaling_available_freqs,
 	NULL,
@@ -262,6 +295,7 @@
 	.target		= cpufreq_p4_target,
 	.init		= cpufreq_p4_cpu_init,
 	.exit		= cpufreq_p4_cpu_exit,
+	.get		= cpufreq_p4_get,
 	.name		= "p4-clockmod",
 	.owner		= THIS_MODULE,
 	.attr		= p4clockmod_attr,
diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c	Tue Jun 15 22:20:37 2004
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c	Tue Jun 15 22:20:37 2004
@@ -185,6 +185,11 @@
  	return 0;
 }
 
+static unsigned int powernow_k6_get(unsigned int cpu)
+{
+	return busfreq * powernow_k6_get_cpu_multiplier();
+}
+
 static struct freq_attr* powernow_k6_attr[] = {
 	&cpufreq_freq_attr_scaling_available_freqs,
 	NULL,
@@ -195,6 +200,7 @@
 	.target 	= powernow_k6_target,
 	.init		= powernow_k6_cpu_init,
 	.exit		= powernow_k6_cpu_exit,
+	.get		= powernow_k6_get,
 	.name		= "powernow-k6",
 	.owner		= THIS_MODULE,
 	.attr		= powernow_k6_attr,
diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c	Tue Jun 15 22:20:36 2004
@@ -16,7 +16,7 @@
 
 #include <linux/config.h>
 #include <linux/kernel.h>
-#include <linux/module.h> 
+#include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/cpufreq.h>
@@ -28,7 +28,7 @@
 #include <asm/io.h>
 #include <asm/system.h>
 
-#ifdef CONFIG_ACPI_PROCESSOR
+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
 #include <linux/acpi.h>
 #include <acpi/processor.h>
 #endif
@@ -63,7 +63,7 @@
 	u8 numpstates;
 };
 
-#ifdef CONFIG_ACPI_PROCESSOR
+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
 union powernow_acpi_control_t {
 	struct {
 		unsigned long fid:5,
@@ -86,7 +86,7 @@
 /* divide by 10 to get FID. */
 static int fid_codes[32] = {
     110, 115, 120, 125, 50, 55, 60, 65,
-    70, 75, 80, 85, 90, 95, 100, 105, 
+    70, 75, 80, 85, 90, 95, 100, 105,
     30, 190, 40, 200, 130, 135, 140, 210,
     150, 225, 160, 165, 170, 180, -1, -1,
 };
@@ -95,7 +95,7 @@
  * configuration purpose.
  */
 
-static int powernow_acpi_force;
+static int acpi_force;
 
 static struct cpufreq_frequency_table *powernow_table;
 
@@ -144,6 +144,11 @@
 	}
 
 	cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
+
+	/* Check we can actually do something before we say anything.*/
+	if (!(edx & (1 << 1 | 1 << 2)))
+		return 0;
+
 	printk (KERN_INFO PFX "PowerNOW! Technology present. Can scale: ");
 
 	if (edx & 1 << 1) {
@@ -159,11 +164,6 @@
 		can_scale_vid=1;
 	}
 
-	if (!(edx & (1 << 1 | 1 << 2))) {
-		printk ("nothing.\n");
-		return 0;
-	}
-
 	printk (".\n");
 	return 1;
 }
@@ -293,7 +293,7 @@
 }
 
 
-#ifdef CONFIG_ACPI_PROCESSOR
+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
 
 struct acpi_processor_performance *acpi_processor_perf;
 
@@ -540,6 +540,20 @@
 	return sgtc;
 }
 
+static unsigned int powernow_get(unsigned int cpu)
+{
+	union msr_fidvidstatus fidvidstatus;
+	unsigned int cfid;
+
+	if (cpu)
+		return 0;
+	rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);
+	cfid = fidvidstatus.bits.CFID;
+
+	return (fsb * fid_codes[cfid] / 10);
+}
+
+
 static int __init powernow_cpu_init (struct cpufreq_policy *policy)
 {
 	union msr_fidvidstatus fidvidstatus;
@@ -558,7 +572,7 @@
 	}
 	dprintk(KERN_INFO PFX "FSB: %3d.%03d MHz\n", fsb/1000, fsb%1000);
 
-	if ((dmi_broken & BROKEN_CPUFREQ) || powernow_acpi_force) {
+	if ((dmi_broken & BROKEN_CPUFREQ) || acpi_force) {
 		printk (KERN_INFO PFX "PSB/PST known to be broken.  Trying ACPI instead\n");
 		result = powernow_acpi_init();
 	} else {
@@ -590,7 +604,7 @@
 
 	policy->cpuinfo.transition_latency = 20 * latency / fsb;
 
-	policy->cur = maximum_speed;
+	policy->cur = powernow_get(0);
 
 	cpufreq_frequency_table_get_attr(powernow_table, policy->cpu);
 
@@ -610,6 +624,7 @@
 static struct cpufreq_driver powernow_driver = {
 	.verify 	= powernow_verify,
 	.target 	= powernow_target,
+	.get		= powernow_get,	
 	.init		= powernow_cpu_init,
 	.exit		= powernow_cpu_exit,
 	.name		= "powernow-k7",
@@ -627,7 +642,7 @@
 
 static void __exit powernow_exit (void)
 {
-#ifdef CONFIG_ACPI_PROCESSOR
+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
 	if (acpi_processor_perf) {
 		acpi_processor_unregister_performance(acpi_processor_perf, 0);
 		kfree(acpi_processor_perf);
@@ -638,8 +653,7 @@
 		kfree(powernow_table);
 }
 
-module_param(powernow_acpi_force,  int, 0444);
-
+module_param(acpi_force,  int, 0444);
 MODULE_PARM_DESC(acpi_force, "Force ACPI to be used");
 
 MODULE_AUTHOR ("Dave Jones <davej@codemonkey.org.uk>");
diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	Tue Jun 15 22:20:41 2004
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c	Tue Jun 15 22:20:41 2004
@@ -32,14 +32,14 @@
 #include <asm/io.h>
 #include <asm/delay.h>
 
-#ifdef CONFIG_ACPI_PROCESSOR
+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
 #include <linux/acpi.h>
 #include <acpi/processor.h>
 #endif
 
 #define PFX "powernow-k8: "
 #define BFX PFX "BIOS error: "
-#define VERSION "version 1.00.08b"
+#define VERSION "version 1.00.09b"
 #include "powernow-k8.h"
 
 /* serialize freq changes  */
@@ -450,13 +450,10 @@
 		goto out;
 
 	eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
-	if ((eax & CPUID_XFAM_MOD) == ATHLON64_XFAM_MOD) {
-		dprintk(KERN_DEBUG PFX "AMD Althon 64 Processor found\n");
-	} else if ((eax & CPUID_XFAM_MOD) == OPTERON_XFAM_MOD) {
-		dprintk(KERN_DEBUG PFX "AMD Opteron Processor found\n");
-	} else {
-		printk(KERN_INFO PFX
-		       "AMD Athlon 64 or AMD Opteron processor required\n");
+	if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
+	    ((eax & CPUID_XFAM) != CPUID_XFAM_K8) ||
+	    ((eax & CPUID_XMOD) > CPUID_XMOD_REV_E)) {
+		printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax);
 		goto out;
 	}
 
@@ -524,11 +521,12 @@
 {
 	int j;
 	for (j = 0; j < data->numps; j++) {
-		printk(KERN_INFO PFX "   %d : fid 0x%x (%d MHz), vid 0x%x (%d mV)\n", j,
-			data->powernow_table[j].index & 0xff,
-			data->powernow_table[j].frequency/1000,
-			data->powernow_table[j].index >> 8,
-			find_millivolts_from_vid(data, data->powernow_table[j].index >> 8));
+		if (data->powernow_table[j].frequency != CPUFREQ_ENTRY_INVALID)
+			printk(KERN_INFO PFX "   %d : fid 0x%x (%d MHz), vid 0x%x (%d mV)\n", j,
+				data->powernow_table[j].index & 0xff,
+				data->powernow_table[j].frequency/1000,
+				data->powernow_table[j].index >> 8,
+				find_millivolts_from_vid(data, data->powernow_table[j].index >> 8));
 	}
 	if (data->batps)
 		printk(KERN_INFO PFX "Only %d pstates on battery\n", data->batps);
@@ -555,7 +553,7 @@
 		printk(KERN_ERR PFX "no p states to transition\n");
 		return -ENODEV;
 	}
-                                                                                                    
+
 	if (check_pst_table(data, pst, maxvid))
 		return -EINVAL;
 
@@ -666,7 +664,7 @@
 	return -ENODEV;
 }
 
-#ifdef CONFIG_ACPI_PROCESSOR
+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
 static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index)
 {
 	if (!data->acpi_data.state_count)
@@ -723,17 +721,36 @@
 		/* verify frequency is OK */
 		if ((powernow_table[i].frequency > (MAX_FREQ * 1000)) ||
 			(powernow_table[i].frequency < (MIN_FREQ * 1000))) {
-			dprintk(KERN_INFO PFX "invalid freq %u kHz\n", powernow_table[i].frequency);
+			dprintk(KERN_INFO PFX "invalid freq %u kHz, ignoring\n", powernow_table[i].frequency);
 			powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
 			continue;
 		}
 
-		/* verify only 1 entry from the lo frequency table */
-		if ((fid < HI_FID_TABLE_BOTTOM) && (cntlofreq++)) {
-			printk(KERN_ERR PFX "Too many lo freq table entries\n");
-			goto err_out;
+		/* verify voltage is OK - BIOSs are using "off" to indicate invalid */
+		if (vid == 0x1f) {
+			dprintk(KERN_INFO PFX "invalid vid %u, ignoring\n", vid);
+			powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
+			continue;
 		}
-                                                                                                            
+
+ 		if (fid < HI_FID_TABLE_BOTTOM) {
+ 			if (cntlofreq) {
+ 				/* if both entries are the same, ignore this
+ 				 * one... 
+ 				 */
+ 				if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) ||
+ 				    (powernow_table[i].index != powernow_table[cntlofreq].index)) {
+ 					printk(KERN_ERR PFX "Too many lo freq table entries\n");
+ 					goto err_out_mem;
+ 				}
+				
+ 				dprintk(KERN_INFO PFX "double low frequency table entry, ignoring it.\n");
+ 				powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
+ 				continue;
+ 			} else
+ 				cntlofreq = i;
+		}
+
 		if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) {
 			printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n",
 				powernow_table[i].frequency,
@@ -752,12 +769,16 @@
 	print_basics(data);
 	powernow_k8_acpi_pst_values(data, 0);
 	return 0;
+
+err_out_mem:
+	kfree(powernow_table);
+
 err_out:
 	acpi_processor_unregister_performance(&data->acpi_data, data->cpu);
 
 	/* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
 	data->acpi_data.state_count = 0;
-                                                                                                            
+
 	return -ENODEV;
 }
 
@@ -848,12 +869,9 @@
 
 	if (smp_processor_id() != pol->cpu) {
 		printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu);
-		goto sched_out;
+		goto err_out;
 	}
 
-	/* from this point, do not exit without restoring preempt and cpu */
-	preempt_disable();
-
 	if (pending_bit_stuck()) {
 		printk(KERN_ERR PFX "failing targ, change pending bit set\n");
 		goto err_out;
@@ -891,8 +909,6 @@
 	ret = 0;
 
 err_out:
-	preempt_enable_no_resched();
-sched_out:
 	set_cpus_allowed(current, oldmask);
 	schedule();
 
@@ -940,7 +956,7 @@
 		if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) {
 			printk(KERN_INFO PFX "MP systems not supported by PSB BIOS structure\n");
 			kfree(data);
-			return 0;
+			return -ENODEV;
 		}
 		rc = find_psb_table(data);
 		if (rc) {
@@ -1025,6 +1041,32 @@
 	return 0;
 }
 
+static unsigned int powernowk8_get (unsigned int cpu)
+{
+	struct powernow_k8_data *data = powernow_data[cpu];
+	cpumask_t oldmask = current->cpus_allowed;
+	unsigned int khz = 0;
+
+	set_cpus_allowed(current, cpumask_of_cpu(cpu));
+	if (smp_processor_id() != cpu) {
+		printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu);
+		set_cpus_allowed(current, oldmask);
+		return 0;
+	}
+	preempt_disable();
+
+	if (query_current_values_with_pending_wait(data))
+		goto out;
+
+	khz = find_khz_freq_from_fid(data->currfid);
+
+ out:
+	preempt_enable_no_resched();
+	set_cpus_allowed(current, oldmask);
+
+	return khz;
+}
+
 static struct freq_attr* powernow_k8_attr[] = {
 	&cpufreq_freq_attr_scaling_available_freqs,
 	NULL,
@@ -1035,6 +1077,7 @@
 	.target = powernowk8_target,
 	.init = powernowk8_cpu_init,
 	.exit = powernowk8_cpu_exit,
+	.get = powernowk8_get,
 	.name = "powernow-k8",
 	.owner = THIS_MODULE,
 	.attr = powernow_k8_attr,
diff -Nru a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h	Tue Jun 15 22:20:41 2004
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h	Tue Jun 15 22:20:41 2004
@@ -29,7 +29,7 @@
 	 * frequency is in kHz */
 	struct cpufreq_frequency_table  *powernow_table;
 
-#ifdef CONFIG_ACPI_PROCESSOR
+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
 	/* the acpi table needs to be kept. it's only available if ACPI was
 	 * used to determine valid frequency/vid/fid states */
 	struct acpi_processor_performance acpi_data;
@@ -38,13 +38,15 @@
 
 
 /* processor's cpuid instruction support */
-#define CPUID_PROCESSOR_SIGNATURE             1	/* function 1 */
-#define CPUID_XFAM_MOD               0x0ff00ff0	/* extended fam, fam + model */
-#define ATHLON64_XFAM_MOD            0x00000f40	/* extended fam, fam + model */
-#define OPTERON_XFAM_MOD             0x00000f50	/* extended fam, fam + model */
-#define CPUID_GET_MAX_CAPABILITIES   0x80000000
-#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007
-#define P_STATE_TRANSITION_CAPABLE            6
+#define CPUID_PROCESSOR_SIGNATURE	1	/* function 1 */
+#define CPUID_XFAM			0x0ff00000	/* extended family */
+#define CPUID_XFAM_K8			0
+#define CPUID_XMOD			0x000f0000	/* extended model */
+#define CPUID_XMOD_REV_E		0x00020000
+#define CPUID_USE_XFAM_XMOD		0x00000f00
+#define CPUID_GET_MAX_CAPABILITIES	0x80000000
+#define CPUID_FREQ_VOLT_CAPABILITIES	0x80000007
+#define P_STATE_TRANSITION_CAPABLE	6
 
 /* Model Specific Registers for p-state transitions. MSRs are 64-bit. For     */
 /* writes (wrmsr - opcode 0f 30), the register number is placed in ecx, and   */
diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c	Tue Jun 15 22:20:39 2004
@@ -38,13 +38,37 @@
 #define dprintk(msg...) do { } while(0)
 #endif
 
+struct cpu_id
+{
+	__u8	x86;            /* CPU family */
+	__u8	x86_vendor;     /* CPU vendor */
+	__u8	x86_model;	/* model */
+	__u8	x86_mask;	/* stepping */
+};
+
+static const struct cpu_id cpu_id_banias = {
+	.x86_vendor = X86_VENDOR_INTEL,
+	.x86 = 6,
+	.x86_model = 9,
+	.x86_mask = 5,
+};
+
+static const struct cpu_id cpu_id_dothan_a1 = {
+	.x86_vendor = X86_VENDOR_INTEL,
+	.x86 = 6,
+	.x86_model = 13,
+	.x86_mask = 1,
+};
+
 struct cpu_model
 {
+	const struct cpu_id *cpu_id;
 	const char	*model_name;
 	unsigned	max_freq; /* max clock in kHz */
 
 	struct cpufreq_frequency_table *op_points; /* clock/voltage pairs */
 };
+static int centrino_verify_cpu_id(struct cpuinfo_x86 *c, const struct cpu_id *x);
 
 /* Operating points for current CPU */
 static struct cpu_model *centrino_model;
@@ -67,8 +91,8 @@
  * M.
  */
 
-/* Ultra Low Voltage Intel Pentium M processor 900MHz */
-static struct cpufreq_frequency_table op_900[] =
+/* Ultra Low Voltage Intel Pentium M processor 900MHz (Banias) */
+static struct cpufreq_frequency_table banias_900[] =
 {
 	OP(600,  844),
 	OP(800,  988),
@@ -76,8 +100,8 @@
 	{ .frequency = CPUFREQ_TABLE_END }
 };
 
-/* Ultra Low Voltage Intel Pentium M processor 1000MHz */
-static struct cpufreq_frequency_table op_1000[] =
+/* Ultra Low Voltage Intel Pentium M processor 1000MHz (Banias) */
+static struct cpufreq_frequency_table banias_1000[] =
 {
 	OP(600,  844),
 	OP(800,  972),
@@ -86,8 +110,8 @@
 	{ .frequency = CPUFREQ_TABLE_END }
 };
 
-/* Low Voltage Intel Pentium M processor 1.10GHz */
-static struct cpufreq_frequency_table op_1100[] =
+/* Low Voltage Intel Pentium M processor 1.10GHz (Banias) */
+static struct cpufreq_frequency_table banias_1100[] =
 {
 	OP( 600,  956),
 	OP( 800, 1020),
@@ -98,8 +122,8 @@
 };
 
 
-/* Low Voltage Intel Pentium M processor 1.20GHz */
-static struct cpufreq_frequency_table op_1200[] =
+/* Low Voltage Intel Pentium M processor 1.20GHz (Banias) */
+static struct cpufreq_frequency_table banias_1200[] =
 {
 	OP( 600,  956),
 	OP( 800, 1004),
@@ -110,8 +134,8 @@
 	{ .frequency = CPUFREQ_TABLE_END }
 };
 
-/* Intel Pentium M processor 1.30GHz */
-static struct cpufreq_frequency_table op_1300[] = 
+/* Intel Pentium M processor 1.30GHz (Banias) */
+static struct cpufreq_frequency_table banias_1300[] = 
 {
 	OP( 600,  956),
 	OP( 800, 1260),
@@ -121,8 +145,8 @@
 	{ .frequency = CPUFREQ_TABLE_END }
 };
 
-/* Intel Pentium M processor 1.40GHz */
-static struct cpufreq_frequency_table op_1400[] = 
+/* Intel Pentium M processor 1.40GHz (Banias) */
+static struct cpufreq_frequency_table banias_1400[] = 
 {
 	OP( 600,  956),
 	OP( 800, 1180),
@@ -132,8 +156,8 @@
 	{ .frequency = CPUFREQ_TABLE_END }
 };
 
-/* Intel Pentium M processor 1.50GHz */
-static struct cpufreq_frequency_table op_1500[] = 
+/* Intel Pentium M processor 1.50GHz (Banias) */
+static struct cpufreq_frequency_table banias_1500[] = 
 {
 	OP( 600,  956),
 	OP( 800, 1116),
@@ -144,8 +168,8 @@
 	{ .frequency = CPUFREQ_TABLE_END }
 };
 
-/* Intel Pentium M processor 1.60GHz */
-static struct cpufreq_frequency_table op_1600[] = 
+/* Intel Pentium M processor 1.60GHz (Banias) */
+static struct cpufreq_frequency_table banias_1600[] = 
 {
 	OP( 600,  956),
 	OP( 800, 1036),
@@ -156,8 +180,8 @@
 	{ .frequency = CPUFREQ_TABLE_END }
 };
 
-/* Intel Pentium M processor 1.70GHz */
-static struct cpufreq_frequency_table op_1700[] =
+/* Intel Pentium M processor 1.70GHz (Banias) */
+static struct cpufreq_frequency_table banias_1700[] =
 {
 	OP( 600,  956),
 	OP( 800, 1004),
@@ -169,26 +193,31 @@
 };
 #undef OP
 
-#define _CPU(max, name)	\
-	{ "Intel(R) Pentium(R) M processor " name "MHz", (max)*1000, op_##max }
-#define CPU(max)	_CPU(max, #max)
+#define _BANIAS(cpuid, max, name)	\
+{	.cpu_id		= cpuid,	\
+	.model_name	= "Intel(R) Pentium(R) M processor " name "MHz", \
+	.max_freq	= (max)*1000,	\
+	.op_points	= banias_##max,	\
+}
+#define BANIAS(max)	_BANIAS(&cpu_id_banias, max, #max)
 
 /* CPU models, their operating frequency range, and freq/voltage
    operating points */
 static struct cpu_model models[] = 
 {
-       _CPU( 900, " 900"),
-	CPU(1000),
-	CPU(1100),
-	CPU(1200),
-	CPU(1300),
-	CPU(1400),
-	CPU(1500),
-	CPU(1600),
-	CPU(1700),
+	_BANIAS(&cpu_id_banias, 900, " 900"),
+	BANIAS(1000),
+	BANIAS(1100),
+	BANIAS(1200),
+	BANIAS(1300),
+	BANIAS(1400),
+	BANIAS(1500),
+	BANIAS(1600),
+	BANIAS(1700),
 	{ 0, }
 };
-#undef CPU
+#undef _BANIAS
+#undef BANIAS
 
 static int centrino_cpu_init_table(struct cpufreq_policy *policy)
 {
@@ -196,7 +225,8 @@
 	struct cpu_model *model;
 
 	for(model = models; model->model_name != NULL; model++)
-		if (strcmp(cpu->x86_model_id, model->model_name) == 0)
+		if ((strcmp(cpu->x86_model_id, model->model_name) == 0) &&
+		    (!centrino_verify_cpu_id(cpu, model->cpu_id)))
 			break;
 	if (model->model_name == NULL) {
 		printk(KERN_INFO PFX "no support for CPU model \"%s\": "
@@ -217,6 +247,16 @@
 static inline int centrino_cpu_init_table(struct cpufreq_policy *policy) { return -ENODEV; }
 #endif /* CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE */
 
+static int centrino_verify_cpu_id(struct cpuinfo_x86 *c, const struct cpu_id *x)
+{
+	if ((c->x86 == x->x86) &&
+	    (c->x86_vendor == x->x86_vendor) &&
+	    (c->x86_model == x->x86_model) &&
+	    (c->x86_mask == x->x86_mask))
+		return 0;
+	return -ENODEV;
+}
+
 /* Extract clock in kHz from PERF_CTL value */
 static unsigned extract_clock(unsigned msr)
 {
@@ -225,9 +265,11 @@
 }
 
 /* Return the current CPU frequency in kHz */
-static unsigned get_cur_freq(void)
+static unsigned int get_cur_freq(unsigned int cpu)
 {
 	unsigned l, h;
+	if (cpu)
+		return 0;
 
 	rdmsr(MSR_IA32_PERF_STATUS, l, h);
 	return extract_clock(l);
@@ -322,7 +364,7 @@
                 goto err_kfree;
         }
 
-	cur_freq = get_cur_freq();
+	cur_freq = get_cur_freq(0);
 
         for (i=0; i<p.state_count; i++) {
 		centrino_model->op_points[i].index = p.states[i].control;
@@ -357,13 +399,8 @@
 	if (!cpu_has(cpu, X86_FEATURE_EST))
 		return -ENODEV;
 
-	/* Only Intel Pentium M stepping 5 for now - add new CPUs as
-	   they appear after making sure they use PERF_CTL in the same
-	   way. */
-	if (cpu->x86_vendor != X86_VENDOR_INTEL ||
-	    cpu->x86        != 6 ||
-	    cpu->x86_model  != 9 ||
-	    cpu->x86_mask   != 5) {
+	if ((centrino_verify_cpu_id(cpu, &cpu_id_banias)) &&
+	    (centrino_verify_cpu_id(cpu, &cpu_id_dothan_a1))) {
 		printk(KERN_INFO PFX "found unsupported CPU with Enhanced SpeedStep: "
 		       "send /proc/cpuinfo to " MAINTAINER "\n");
 		return -ENODEV;
@@ -391,10 +428,10 @@
 		}
 	}
 
-	freq = get_cur_freq();
+	freq = get_cur_freq(0);
 
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
-	policy->cpuinfo.transition_latency = 10; /* 10uS transition latency */
+	policy->cpuinfo.transition_latency = 10000; /* 10uS transition latency */
 	policy->cur = freq;
 
 	dprintk(KERN_INFO PFX "centrino_cpu_init: policy=%d cur=%dkHz\n",
@@ -516,6 +553,7 @@
 	.exit		= centrino_cpu_exit,
 	.verify 	= centrino_verify,
 	.target 	= centrino_target,
+	.get		= get_cur_freq,
 	.attr           = centrino_attr,
 	.owner		= THIS_MODULE,
 };
diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c	Tue Jun 15 22:20:35 2004
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c	Tue Jun 15 22:20:35 2004
@@ -67,28 +67,19 @@
 /**
  * speedstep_set_state - set the SpeedStep state
  * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
- * @notify: whether to call cpufreq_notify_transition for CPU speed changes
  *
  *   Tries to change the SpeedStep state. 
  */
-static void speedstep_set_state (unsigned int state, unsigned int notify)
+static void speedstep_set_state (unsigned int state)
 {
 	u32			pmbase;
 	u8			pm2_blk;
 	u8			value;
 	unsigned long		flags;
-	struct cpufreq_freqs	freqs;
 
 	if (!speedstep_chipset_dev || (state > 0x1))
 		return;
 
-	freqs.old = speedstep_get_processor_frequency(speedstep_processor);
-	freqs.new = speedstep_freqs[state].frequency;
-	freqs.cpu = 0; /* speedstep.c is UP only driver */
-	
-	if (notify)
-		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
-
 	/* get PMBASE */
 	pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase);
 	if (!(pmbase & 0x01))
@@ -143,9 +134,6 @@
 		printk (KERN_ERR "cpufreq: change failed - I/O error\n");
 	}
 
-	if (notify)
-		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
-
 	return;
 }
 
@@ -179,7 +167,7 @@
 /**
  * speedstep_detect_chipset - detect the Southbridge which contains SpeedStep logic
  *
- *   Detects PIIX4, ICH2-M and ICH3-M so far. The pci_dev points to 
+ *   Detects ICH2-M, ICH3-M and ICH4-M so far. The pci_dev points to 
  * the LPC bridge / PM module which contains all power-management 
  * functions. Returns the SPEEDSTEP_CHIPSET_-number for the detected
  * chipset, or zero on failure.
@@ -252,11 +240,47 @@
 			     unsigned int relation)
 {
 	unsigned int	newstate = 0;
+	struct cpufreq_freqs freqs;
+	cpumask_t cpus_allowed, affected_cpu_map;
+	int i;
 
 	if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate))
 		return -EINVAL;
 
-	speedstep_set_state(newstate, 1);
+	/* no transition necessary */
+	if (freqs.old == freqs.new)
+		return 0;
+
+	freqs.old = speedstep_get_processor_frequency(speedstep_processor);
+	freqs.new = speedstep_freqs[newstate].frequency;
+	freqs.cpu = policy->cpu;
+
+	cpus_allowed = current->cpus_allowed;
+
+	/* only run on CPU to be set, or on its sibling */
+#ifdef CONFIG_SMP
+	affected_cpu_map = cpu_sibling_map[policy->cpu];
+#else
+	affected_cpu_map = cpumask_of_cpu(policy->cpu);
+#endif
+
+	for_each_cpu_mask(i, affected_cpu_map) {
+		freqs.cpu = i;
+		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+	}
+
+	/* switch to physical CPU where state is to be changed */
+	set_cpus_allowed(current, affected_cpu_map);
+
+	speedstep_set_state(newstate);
+
+	/* allow to be run on all CPUs */
+	set_cpus_allowed(current, cpus_allowed);
+
+	for_each_cpu_mask(i, affected_cpu_map) {
+		freqs.cpu = i;
+		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
+	}
 
 	return 0;
 }
@@ -279,21 +303,35 @@
 {
 	int		result = 0;
 	unsigned int	speed;
+	cpumask_t       cpus_allowed,affected_cpu_map;
+
 
 	/* capability check */
-	if (policy->cpu != 0)
+	if (policy->cpu != 0) /* FIXME: better support for SMT in cpufreq core. Up until then, it's better to register only one CPU */
 		return -ENODEV;
 
+	/* only run on CPU to be set, or on its sibling */
+	cpus_allowed = current->cpus_allowed;
+#ifdef CONFIG_SMP
+	affected_cpu_map = cpu_sibling_map[policy->cpu];
+#else
+	affected_cpu_map = cpumask_of_cpu(policy->cpu);
+#endif
+	set_cpus_allowed(current, affected_cpu_map);
+
 	/* detect low and high frequency */
 	result = speedstep_get_freqs(speedstep_processor,
 				     &speedstep_freqs[SPEEDSTEP_LOW].frequency,
 				     &speedstep_freqs[SPEEDSTEP_HIGH].frequency,
 				     &speedstep_set_state);
-	if (result)
+	if (result) {
+		set_cpus_allowed(current, cpus_allowed);
 		return result;
+	}
 
 	/* get current speed setting */
 	speed = speedstep_get_processor_frequency(speedstep_processor);
+	set_cpus_allowed(current, cpus_allowed);
 	if (!speed)
 		return -EIO;
 
@@ -322,6 +360,10 @@
 	return 0;
 }
 
+static unsigned int speedstep_get(unsigned int cpu)
+{
+	return speedstep_get_processor_frequency(speedstep_processor);
+}
 
 static struct freq_attr* speedstep_attr[] = {
 	&cpufreq_freq_attr_scaling_available_freqs,
@@ -335,6 +377,7 @@
 	.target 	= speedstep_target,
 	.init		= speedstep_cpu_init,
 	.exit		= speedstep_cpu_exit,
+	.get		= speedstep_get,
 	.owner		= THIS_MODULE,
 	.attr		= speedstep_attr,
 };
diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c	Tue Jun 15 22:20:44 2004
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c	Tue Jun 15 22:20:44 2004
@@ -252,11 +252,10 @@
 			 * specific.
 			 * M-P4-Ms may have either ebx=0xe or 0xf [see above]
 			 * M-P4/533 have either ebx=0xe or 0xf. [25317607.pdf]
-			 * So, how to distinguish all those processors with
-			 * ebx=0xf? I don't know. Sort them out, and wait
-			 * for someone to complain.
+			 * also, M-P4M HTs have ebx=0x8, too
+			 * For now, they are distinguished by the model_id string
 			 */
-			if (ebx == 0x0e)
+		        if ((ebx == 0x0e) || (strstr(c->x86_model_id,"Mobile Intel(R) Pentium(R) 4") != NULL)) 
 				return SPEEDSTEP_PROCESSOR_P4M;
 			break;
 		default:
@@ -321,9 +320,7 @@
 unsigned int speedstep_get_freqs(unsigned int processor,
 				  unsigned int *low_speed,
 				  unsigned int *high_speed,
-				  void (*set_state) (unsigned int state,
-						     unsigned int notify)
-				 )
+				  void (*set_state) (unsigned int state))
 {
 	unsigned int prev_speed;
 	unsigned int ret = 0;
@@ -340,7 +337,7 @@
 	local_irq_save(flags);
 
 	/* switch to low state */
-	set_state(SPEEDSTEP_LOW, 0);
+	set_state(SPEEDSTEP_LOW);
 	*low_speed = speedstep_get_processor_frequency(processor);
 	if (!*low_speed) {
 		ret = -EIO;
@@ -348,7 +345,7 @@
 	}
 
 	/* switch to high state */
-	set_state(SPEEDSTEP_HIGH, 0);
+	set_state(SPEEDSTEP_HIGH);
 	*high_speed = speedstep_get_processor_frequency(processor);
 	if (!*high_speed) {
 		ret = -EIO;
@@ -362,7 +359,7 @@
 
 	/* switch to previous state, if necessary */
 	if (*high_speed != prev_speed)
-		set_state(SPEEDSTEP_LOW, 0);
+		set_state(SPEEDSTEP_LOW);
 
  out:
 	local_irq_restore(flags);
diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h	Tue Jun 15 22:20:38 2004
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h	Tue Jun 15 22:20:38 2004
@@ -44,4 +44,4 @@
 extern unsigned int speedstep_get_freqs(unsigned int processor,
 	  unsigned int *low_speed,
 	  unsigned int *high_speed,
-	  void (*set_state) (unsigned int state, unsigned int notify));
+	  void (*set_state) (unsigned int state));
diff -Nru a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c	Tue Jun 15 22:20:39 2004
@@ -36,6 +36,8 @@
 static int		smi_cmd		= 0;
 static unsigned int	smi_sig		= 0;
 
+/* info about the processor */
+static unsigned int	speedstep_processor = 0;
 
 /* 
  *   There are only two frequency states for each processor. Values
@@ -137,37 +139,24 @@
 		: "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0)
 	);
 
-	return state;
+	return (state & 1);
 }
 
 /**
  * speedstep_set_state - set the SpeedStep state
  * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
- * @notify: whether to call cpufreq_notify_transition
  *
  */
-static void speedstep_set_state (unsigned int state, unsigned int notify)
+static void speedstep_set_state (unsigned int state)
 {
-	unsigned int old_state, result = 0, command, new_state;
+	unsigned int result = 0, command, new_state;
 	unsigned long flags;
-	struct cpufreq_freqs freqs;
 	unsigned int function=SET_SPEEDSTEP_STATE;
 	unsigned int retry = 0;
 
 	if (state > 0x1)
 		return;
 
-	old_state = speedstep_get_state();
-	freqs.old = speedstep_freqs[old_state].frequency;
-	freqs.new = speedstep_freqs[state].frequency;
-	freqs.cpu = 0; /* speedstep.c is UP only driver */
-
-	if (old_state == state)
-		return;
-
-	if (notify)
-		cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
-
 	/* Disable IRQs */
 	local_irq_save(flags);
 
@@ -196,9 +185,6 @@
 		printk(KERN_ERR "cpufreq: change failed with new_state %u and result %u\n", new_state, result);
 	}
 
-	if (notify)
-		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
-
 	return;
 }
 
@@ -215,11 +201,21 @@
 			unsigned int target_freq, unsigned int relation)
 {
 	unsigned int newstate = 0;
+	struct cpufreq_freqs freqs;
 
 	if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate))
 		return -EINVAL;
 
-	speedstep_set_state(newstate, 1);
+	freqs.old = speedstep_freqs[speedstep_get_state()].frequency;
+	freqs.new = speedstep_freqs[newstate].frequency;
+	freqs.cpu = 0; /* speedstep.c is UP only driver */
+
+	if (freqs.old == freqs.new)
+		return 0;
+
+	cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+	speedstep_set_state(newstate);
+	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
 
 	return 0;
 }
@@ -258,10 +254,11 @@
 				&speedstep_freqs[SPEEDSTEP_HIGH].frequency);
 	if (result) {
 		/* fall back to speedstep_lib.c dection mechanism: try both states out */
-		unsigned int speedstep_processor = speedstep_detect_processor();
-
 		dprintk(KERN_INFO PFX "could not detect low and high frequencies by SMI call.\n");
 		if (!speedstep_processor)
+			speedstep_processor = speedstep_detect_processor();
+
+		if (!speedstep_processor)
 			return -ENODEV;
 
 		result = speedstep_get_freqs(speedstep_processor,
@@ -298,13 +295,23 @@
 	return 0;
 }
 
-
 static int speedstep_cpu_exit(struct cpufreq_policy *policy)
 {
 	cpufreq_frequency_table_put_attr(policy->cpu);
 	return 0;
 }
 
+static unsigned int speedstep_get(unsigned int cpu)
+{
+	if (cpu)
+		return -ENODEV;
+	if (!speedstep_processor)
+		speedstep_processor = speedstep_detect_processor();
+	if (!speedstep_processor)
+		return 0;
+	return speedstep_get_processor_frequency(speedstep_processor);
+}
+
 
 static int speedstep_resume(struct cpufreq_policy *policy)
 {
@@ -327,6 +334,7 @@
 	.target 	= speedstep_target,
 	.init		= speedstep_cpu_init,
 	.exit		= speedstep_cpu_exit,
+	.get		= speedstep_get,
 	.resume		= speedstep_resume,
 	.owner		= THIS_MODULE,
 	.attr		= speedstep_attr,
diff -Nru a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c
--- a/arch/i386/kernel/cpu/intel.c	Tue Jun 15 22:20:38 2004
+++ b/arch/i386/kernel/cpu/intel.c	Tue Jun 15 22:20:38 2004
@@ -28,6 +28,15 @@
 struct movsl_mask movsl_mask;
 #endif
 
+void __init early_intel_workaround(struct cpuinfo_x86 *c)
+{
+	if (c->x86_vendor != X86_VENDOR_INTEL)
+		return;
+	/* Netburst reports 64 bytes clflush size, but does IO in 128 bytes */
+	if (c->x86 == 15 && c->x86_cache_alignment == 64)
+		c->x86_cache_alignment = 128;
+}
+
 /*
  *	Early probe support logic for ppro memory erratum #50
  *
@@ -36,42 +45,14 @@
  
 int __init ppro_with_ram_bug(void)
 {
-	char vendor_id[16];
-	int ident;
-
-	/* Must have CPUID */
-	if(!have_cpuid_p())
-		return 0;
-	if(cpuid_eax(0)<1)
-		return 0;
-	
-	/* Must be Intel */
-	cpuid(0, &ident, 
-		(int *)&vendor_id[0],
-		(int *)&vendor_id[8],
-		(int *)&vendor_id[4]);
-	
-	if(memcmp(vendor_id, "IntelInside", 12))
-		return 0;
-	
-	ident = cpuid_eax(1);
-
-	/* Model 6 */
-
-	if(((ident>>8)&15)!=6)
-		return 0;
-	
-	/* Pentium Pro */
-
-	if(((ident>>4)&15)!=1)
-		return 0;
-	
-	if((ident&15) < 8)
-	{
+	/* Uses data from early_cpu_detect now */
+	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+	    boot_cpu_data.x86 == 6 &&
+	    boot_cpu_data.x86_model == 1 &&
+	    boot_cpu_data.x86_mask < 8) {
 		printk(KERN_INFO "Pentium Pro with Errata#50 detected. Taking evasive action.\n");
 		return 1;
 	}
-	printk(KERN_INFO "Your Pentium Pro seems ok.\n");
 	return 0;
 }
 	
@@ -109,6 +90,7 @@
 	{ 0x43, LVL_2,      512 },
 	{ 0x44, LVL_2,      1024 },
 	{ 0x45, LVL_2,      2048 },
+	{ 0x60, LVL_1_DATA, 16 },
 	{ 0x66, LVL_1_DATA, 8 },
 	{ 0x67, LVL_1_DATA, 16 },
 	{ 0x68, LVL_1_DATA, 32 },
diff -Nru a/arch/i386/kernel/cpu/mcheck/p4.c b/arch/i386/kernel/cpu/mcheck/p4.c
--- a/arch/i386/kernel/cpu/mcheck/p4.c	Tue Jun 15 22:20:42 2004
+++ b/arch/i386/kernel/cpu/mcheck/p4.c	Tue Jun 15 22:20:42 2004
@@ -38,7 +38,8 @@
 #ifdef CONFIG_X86_MCE_P4THERMAL
 static void unexpected_thermal_interrupt(struct pt_regs *regs)
 {	
-	printk(KERN_ERR "CPU#%d: Unexpected LVT TMR interrupt!\n", smp_processor_id());
+	printk(KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n",
+			smp_processor_id());
 }
 
 /* P4/Xeon Thermal transition interrupt handler */
@@ -46,15 +47,21 @@
 {
 	u32 l, h;
 	unsigned int cpu = smp_processor_id();
+	static unsigned long next[NR_CPUS];
 
 	ack_APIC_irq();
 
-	rdmsr (MSR_IA32_THERM_STATUS, l, h);
-	if (l & 1) {
-		printk(KERN_EMERG "CPU#%d: Temperature above threshold\n", cpu);
-		printk(KERN_EMERG "CPU#%d: Running in modulated clock mode\n", cpu);
+	if (time_after(next[cpu], jiffies))
+		return;
+
+	next[cpu] = jiffies + HZ*5;
+	rdmsr(MSR_IA32_THERM_STATUS, l, h);
+	if (l & 0x1) {
+		printk(KERN_EMERG "CPU%d: Temperature above threshold\n", cpu);
+		printk(KERN_EMERG "CPU%d: Running in modulated clock mode\n",
+				cpu);
 	} else {
-		printk(KERN_INFO "CPU#%d: Temperature/speed normal\n", cpu);
+		printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu);
 	}
 }
 
@@ -89,13 +96,15 @@
 	rdmsr (MSR_IA32_MISC_ENABLE, l, h);
 	h = apic_read(APIC_LVTTHMR);
 	if ((l & (1<<3)) && (h & APIC_DM_SMI)) {
-		printk(KERN_DEBUG "CPU#%d: Thermal monitoring handled by SMI\n", cpu);
+		printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n",
+				cpu);
 		return; /* -EBUSY */
 	}
 
 	/* check whether a vector already exists, temporarily masked? */	
 	if (h & APIC_VECTOR_MASK) {
-		printk(KERN_DEBUG "CPU#%d: Thermal LVT vector (%#x) already installed\n",
+		printk(KERN_DEBUG "CPU%d: Thermal LVT vector (%#x) already "
+				"installed\n",
 			cpu, (h & APIC_VECTOR_MASK));
 		return; /* -EBUSY */
 	}
@@ -116,7 +125,7 @@
 	
 	l = apic_read (APIC_LVTTHMR);
 	apic_write_around (APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
-	printk (KERN_INFO "CPU#%d: Thermal monitoring enabled\n", cpu);
+	printk (KERN_INFO "CPU%d: Thermal monitoring enabled\n", cpu);
 	return;
 }
 #endif /* CONFIG_X86_MCE_P4THERMAL */
@@ -247,7 +256,8 @@
 	rdmsr (MSR_IA32_MCG_CAP, l, h);
 	if (l & (1<<9))	{/* MCG_EXT_P */
 		mce_num_extended_msrs = (l >> 16) & 0xff;
-		printk (KERN_INFO "CPU#%d: Intel P4/Xeon Extended MCE MSRs (%d) available\n",
+		printk (KERN_INFO "CPU%d: Intel P4/Xeon Extended MCE MSRs (%d)"
+				" available\n",
 			smp_processor_id(), mce_num_extended_msrs);
 
 #ifdef CONFIG_X86_MCE_P4THERMAL
diff -Nru a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
--- a/arch/i386/kernel/cpuid.c	Tue Jun 15 22:20:35 2004
+++ b/arch/i386/kernel/cpuid.c	Tue Jun 15 22:20:35 2004
@@ -10,7 +10,6 @@
  *
  * ----------------------------------------------------------------------- */
 
-
 /*
  * cpuid.c
  *
@@ -46,131 +45,132 @@
 #ifdef CONFIG_SMP
 
 struct cpuid_command {
-  int cpu;
-  u32 reg;
-  u32 *data;
+	int cpu;
+	u32 reg;
+	u32 *data;
 };
 
 static void cpuid_smp_cpuid(void *cmd_block)
 {
-  struct cpuid_command *cmd = (struct cpuid_command *) cmd_block;
-  
-  if ( cmd->cpu == smp_processor_id() )
-    cpuid(cmd->reg, &cmd->data[0], &cmd->data[1], &cmd->data[2], &cmd->data[3]);
+	struct cpuid_command *cmd = (struct cpuid_command *)cmd_block;
+
+	if (cmd->cpu == smp_processor_id())
+		cpuid(cmd->reg, &cmd->data[0], &cmd->data[1], &cmd->data[2],
+		      &cmd->data[3]);
 }
 
-static inline void do_cpuid(int cpu, u32 reg, u32 *data)
+static inline void do_cpuid(int cpu, u32 reg, u32 * data)
 {
-  struct cpuid_command cmd;
-  
-  preempt_disable();
-  if ( cpu == smp_processor_id() ) {
-    cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
-  } else {
-    cmd.cpu  = cpu;
-    cmd.reg  = reg;
-    cmd.data = data;
-    
-    smp_call_function(cpuid_smp_cpuid, &cmd, 1, 1);
-  }
-  preempt_enable();
+	struct cpuid_command cmd;
+
+	preempt_disable();
+	if (cpu == smp_processor_id()) {
+		cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
+	} else {
+		cmd.cpu = cpu;
+		cmd.reg = reg;
+		cmd.data = data;
+
+		smp_call_function(cpuid_smp_cpuid, &cmd, 1, 1);
+	}
+	preempt_enable();
 }
-#else /* ! CONFIG_SMP */
+#else				/* ! CONFIG_SMP */
 
-static inline void do_cpuid(int cpu, u32 reg, u32 *data)
+static inline void do_cpuid(int cpu, u32 reg, u32 * data)
 {
-  cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
+	cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
 }
 
-#endif /* ! CONFIG_SMP */
+#endif				/* ! CONFIG_SMP */
 
 static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
 {
-  loff_t ret;
+	loff_t ret;
+
+	lock_kernel();
 
-  lock_kernel();
+	switch (orig) {
+	case 0:
+		file->f_pos = offset;
+		ret = file->f_pos;
+		break;
+	case 1:
+		file->f_pos += offset;
+		ret = file->f_pos;
+		break;
+	default:
+		ret = -EINVAL;
+	}
+
+	unlock_kernel();
+	return ret;
+}
+
+static ssize_t cpuid_read(struct file *file, char __user *buf,
+			  size_t count, loff_t * ppos)
+{
+	char __user *tmp = buf;
+	u32 data[4];
+	size_t rv;
+	u32 reg = *ppos;
+	int cpu = iminor(file->f_dentry->d_inode);
+
+	if (count % 16)
+		return -EINVAL;	/* Invalid chunk size */
+
+	for (rv = 0; count; count -= 16) {
+		do_cpuid(cpu, reg, data);
+		if (copy_to_user(tmp, &data, 16))
+			return -EFAULT;
+		tmp += 16;
+		*ppos = reg++;
+	}
 
-  switch (orig) {
-  case 0:
-    file->f_pos = offset;
-    ret = file->f_pos;
-    break;
-  case 1:
-    file->f_pos += offset;
-    ret = file->f_pos;
-    break;
-  default:
-    ret = -EINVAL;
-  }
-
-  unlock_kernel();
-  return ret;
-}
-
-static ssize_t cpuid_read(struct file * file, char * buf,
-			size_t count, loff_t *ppos)
-{
-  u32 *tmp = (u32 *)buf;
-  u32 data[4];
-  size_t rv;
-  u32 reg = *ppos;
-  int cpu = iminor(file->f_dentry->d_inode);
-  
-  if ( count % 16 )
-    return -EINVAL; /* Invalid chunk size */
-  
-  for ( rv = 0 ; count ; count -= 16 ) {
-    do_cpuid(cpu, reg, data);
-    if ( copy_to_user(tmp,&data,16) )
-      return -EFAULT;
-    tmp += 4;
-    *ppos = reg++;
-  }
-  
-  return ((char *)tmp) - buf;
+	return tmp - buf;
 }
 
 static int cpuid_open(struct inode *inode, struct file *file)
 {
-  int cpu = iminor(file->f_dentry->d_inode);
-  struct cpuinfo_x86 *c = &(cpu_data)[cpu];
+	unsigned int cpu = iminor(file->f_dentry->d_inode);
+	struct cpuinfo_x86 *c = &(cpu_data)[cpu];
+
+	if (cpu >= NR_CPUS || !cpu_online(cpu))
+		return -ENXIO;	/* No such CPU */
+	if (c->cpuid_level < 0)
+		return -EIO;	/* CPUID not supported */
 
-  if (!cpu_online(cpu))
-    return -ENXIO;		/* No such CPU */
-  if ( c->cpuid_level < 0 )
-    return -EIO;		/* CPUID not supported */
-  
-  return 0;
+	return 0;
 }
 
 /*
  * File operations we support
  */
 static struct file_operations cpuid_fops = {
-  .owner	= THIS_MODULE,
-  .llseek	= cpuid_seek,
-  .read		= cpuid_read,
-  .open		= cpuid_open,
+	.owner = THIS_MODULE,
+	.llseek = cpuid_seek,
+	.read = cpuid_read,
+	.open = cpuid_open,
 };
 
 int __init cpuid_init(void)
 {
-  if (register_chrdev(CPUID_MAJOR, "cpu/cpuid", &cpuid_fops)) {
-    printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n",
-	   CPUID_MAJOR);
-    return -EBUSY;
-  }
+	if (register_chrdev(CPUID_MAJOR, "cpu/cpuid", &cpuid_fops)) {
+		printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n",
+		       CPUID_MAJOR);
+		return -EBUSY;
+	}
 
-  return 0;
+	return 0;
 }
 
 void __exit cpuid_exit(void)
 {
-  unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
+	unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
 }
 
 module_init(cpuid_init);
-module_exit(cpuid_exit)
+module_exit(cpuid_exit);
 
 MODULE_AUTHOR("H. Peter Anvin <hpa@zytor.com>");
 MODULE_DESCRIPTION("x86 generic CPUID driver");
diff -Nru a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
--- a/arch/i386/kernel/dmi_scan.c	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/kernel/dmi_scan.c	Tue Jun 15 22:20:39 2004
@@ -783,6 +783,7 @@
 	{ exploding_pnp_bios, "ASUS P4P800", {	/* PnPBIOS GPF on boot */
 			MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
 			MATCH(DMI_BOARD_NAME, "P4P800"),
+			NO_MATCH, NO_MATCH
 			} },
 
 	/* Machines which have problems handling enabled local APICs */
diff -Nru a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S	Tue Jun 15 22:20:38 2004
+++ b/arch/i386/kernel/entry.S	Tue Jun 15 22:20:38 2004
@@ -74,12 +74,6 @@
 NT_MASK		= 0x00004000
 VM_MASK		= 0x00020000
 
-/*
- * ESP0 is at offset 4. 0x200 is the size of the TSS, and
- * also thus the top-of-stack pointer offset of SYSENTER_ESP
- */
-TSS_ESP0_OFFSET = (4 - 0x200)
-
 #ifdef CONFIG_PREEMPT
 #define preempt_stop		cli
 #else
@@ -163,8 +157,8 @@
 	movl %edx,EIP(%ebp)	# Now we move them to their "normal" places
 	movl %ecx,CS(%ebp)	#
 	GET_THREAD_INFO_WITH_ESP(%ebp)	# GET_THREAD_INFO
-	movl TI_EXEC_DOMAIN(%ebp), %edx	# Get the execution domain
-	call *4(%edx)		# Call the lcall7 handler for the domain
+	movl TI_exec_domain(%ebp), %edx	# Get the execution domain
+	call *EXEC_DOMAIN_handler(%edx)	# Call the handler for the domain
 	addl $4, %esp
 	popl %eax
 	jmp resume_userspace
@@ -208,7 +202,7 @@
  	cli				# make sure we don't miss an interrupt
 					# setting need_resched or sigpending
 					# between sampling and the iret
-	movl TI_FLAGS(%ebp), %ecx
+	movl TI_flags(%ebp), %ecx
 	andl $_TIF_WORK_MASK, %ecx	# is there any work to be done on
 					# int/exception return?
 	jne work_pending
@@ -216,18 +210,18 @@
 
 #ifdef CONFIG_PREEMPT
 ENTRY(resume_kernel)
-	cmpl $0,TI_PRE_COUNT(%ebp)	# non-zero preempt_count ?
+	cmpl $0,TI_preempt_count(%ebp)	# non-zero preempt_count ?
 	jnz restore_all
 need_resched:
-	movl TI_FLAGS(%ebp), %ecx	# need_resched set ?
+	movl TI_flags(%ebp), %ecx	# need_resched set ?
 	testb $_TIF_NEED_RESCHED, %cl
 	jz restore_all
 	testl $IF_MASK,EFLAGS(%esp)     # interrupts off (exception path) ?
 	jz restore_all
-	movl $PREEMPT_ACTIVE,TI_PRE_COUNT(%ebp)
+	movl $PREEMPT_ACTIVE,TI_preempt_count(%ebp)
 	sti
 	call schedule
-	movl $0,TI_PRE_COUNT(%ebp)
+	movl $0,TI_preempt_count(%ebp)
 	cli
 	jmp need_resched
 #endif
@@ -237,7 +231,7 @@
 
 	# sysenter call handler stub
 ENTRY(sysenter_entry)
-	movl TSS_ESP0_OFFSET(%esp),%esp
+	movl TSS_sysenter_esp0(%esp),%esp
 sysenter_past_esp:
 	sti
 	pushl $(__USER_DS)
@@ -264,12 +258,12 @@
 	cmpl $(nr_syscalls), %eax
 	jae syscall_badsys
 
-	testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_FLAGS(%ebp)
+	testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
 	jnz syscall_trace_entry
 	call *sys_call_table(,%eax,4)
 	movl %eax,EAX(%esp)
 	cli
-	movl TI_FLAGS(%ebp), %ecx
+	movl TI_flags(%ebp), %ecx
 	testw $_TIF_ALLWORK_MASK, %cx
 	jne syscall_exit_work
 /* if something modifies registers it must also disable sysexit */
@@ -287,7 +281,7 @@
 	cmpl $(nr_syscalls), %eax
 	jae syscall_badsys
 					# system call tracing in operation
-	testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_FLAGS(%ebp)
+	testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
 	jnz syscall_trace_entry
 syscall_call:
 	call *sys_call_table(,%eax,4)
@@ -296,7 +290,7 @@
 	cli				# make sure we don't miss an interrupt
 					# setting need_resched or sigpending
 					# between sampling and the iret
-	movl TI_FLAGS(%ebp), %ecx
+	movl TI_flags(%ebp), %ecx
 	testw $_TIF_ALLWORK_MASK, %cx	# current->work
 	jne syscall_exit_work
 restore_all:
@@ -312,7 +306,7 @@
 	cli				# make sure we don't miss an interrupt
 					# setting need_resched or sigpending
 					# between sampling and the iret
-	movl TI_FLAGS(%ebp), %ecx
+	movl TI_flags(%ebp), %ecx
 	andl $_TIF_WORK_MASK, %ecx	# is there any work to be done other
 					# than syscall tracing?
 	jz restore_all
@@ -473,7 +467,7 @@
  * that sets up the real kernel stack. Check here, since we can't
  * allow the wrong stack to be used.
  *
- * "TSS_ESP0_OFFSET+12" is because the NMI/debug handler will have
+ * "TSS_sysenter_esp0+12" is because the NMI/debug handler will have
  * already pushed 3 words if it hits on the sysenter instruction:
  * eflags, cs and eip.
  *
@@ -485,7 +479,7 @@
 	cmpw $__KERNEL_CS,4(%esp);		\
 	jne ok;					\
 label:						\
-	movl TSS_ESP0_OFFSET+offset(%esp),%esp;	\
+	movl TSS_sysenter_esp0+offset(%esp),%esp;	\
 	pushfl;					\
 	pushl $__KERNEL_CS;			\
 	pushl $sysenter_past_esp
@@ -882,14 +876,15 @@
 	.long sys_utimes
  	.long sys_fadvise64_64
 	.long sys_ni_syscall	/* sys_vserver */
-	.long sys_ni_syscall	/* sys_mbind */
-	.long sys_ni_syscall	/* 275 sys_get_mempolicy */
-	.long sys_ni_syscall	/* sys_set_mempolicy */
+	.long sys_mbind
+	.long sys_get_mempolicy
+	.long sys_set_mempolicy
 	.long sys_mq_open
 	.long sys_mq_unlink
 	.long sys_mq_timedsend
 	.long sys_mq_timedreceive	/* 280 */
 	.long sys_mq_notify
 	.long sys_mq_getsetattr
+	.long sys_ni_syscall		/* reserved for kexec */
 
 syscall_table_size=(.-sys_call_table)
diff -Nru a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
--- a/arch/i386/kernel/head.S	Tue Jun 15 22:20:37 2004
+++ b/arch/i386/kernel/head.S	Tue Jun 15 22:20:37 2004
@@ -24,15 +24,14 @@
  * References to members of the new_cpu_data structure.
  */
 
-#define CPU_PARAMS	new_cpu_data
-#define X86		CPU_PARAMS+0
-#define X86_VENDOR	CPU_PARAMS+1
-#define X86_MODEL	CPU_PARAMS+2
-#define X86_MASK	CPU_PARAMS+3
-#define X86_HARD_MATH	CPU_PARAMS+6
-#define X86_CPUID	CPU_PARAMS+8
-#define X86_CAPABILITY	CPU_PARAMS+12
-#define X86_VENDOR_ID	CPU_PARAMS+36	/* offset dependent on NCAPINTS */
+#define X86		new_cpu_data+CPUINFO_x86
+#define X86_VENDOR	new_cpu_data+CPUINFO_x86_vendor
+#define X86_MODEL	new_cpu_data+CPUINFO_x86_model
+#define X86_MASK	new_cpu_data+CPUINFO_x86_mask
+#define X86_HARD_MATH	new_cpu_data+CPUINFO_hard_math
+#define X86_CPUID	new_cpu_data+CPUINFO_cpuid_level
+#define X86_CAPABILITY	new_cpu_data+CPUINFO_x86_capability
+#define X86_VENDOR_ID	new_cpu_data+CPUINFO_x86_vendor_id
 
 /*
  * This is how much memory *in addition to the memory covered up to
diff -Nru a/arch/i386/kernel/i387.c b/arch/i386/kernel/i387.c
--- a/arch/i386/kernel/i387.c	Tue Jun 15 22:21:05 2004
+++ b/arch/i386/kernel/i387.c	Tue Jun 15 22:21:05 2004
@@ -246,7 +246,7 @@
 	to = &buf->_st[0];
 	from = (struct _fpxreg *) &fxsave->st_space[0];
 	for ( i = 0 ; i < 8 ; i++, to++, from++ ) {
-		unsigned long *t = (unsigned long *)to;
+		unsigned long __user *t = (unsigned long __user *)to;
 		unsigned long *f = (unsigned long *)from;
 
 		if (__put_user(*f, t) ||
@@ -281,7 +281,7 @@
 	from = &buf->_st[0];
 	for ( i = 0 ; i < 8 ; i++, to++, from++ ) {
 		unsigned long *t = (unsigned long *)to;
-		unsigned long *f = (unsigned long *)from;
+		unsigned long __user *f = (unsigned long __user *)from;
 
 		if (__get_user(*t, f) ||
 				__get_user(*(t + 1), f + 1) ||
diff -Nru a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
--- a/arch/i386/kernel/io_apic.c	Tue Jun 15 22:20:38 2004
+++ b/arch/i386/kernel/io_apic.c	Tue Jun 15 22:20:38 2004
@@ -317,8 +317,7 @@
 
 #define IRQ_ALLOWED(cpu, allowed_mask)	cpu_isset(cpu, allowed_mask)
 
-#define CPU_TO_PACKAGEINDEX(i) \
-		((physical_balance && i > cpu_sibling_map[i]) ? cpu_sibling_map[i] : i)
+#define CPU_TO_PACKAGEINDEX(i) (first_cpu(cpu_sibling_map[i]))
 
 #define MAX_BALANCED_IRQ_INTERVAL	(5*HZ)
 #define MIN_BALANCED_IRQ_INTERVAL	(HZ/2)
@@ -401,6 +400,7 @@
 	unsigned long max_cpu_irq = 0, min_cpu_irq = (~0);
 	unsigned long move_this_load = 0;
 	int max_loaded = 0, min_loaded = 0;
+	int load;
 	unsigned long useful_load_threshold = balanced_irq_interval + 10;
 	int selected_irq;
 	int tmp_loaded, first_attempt = 1;
@@ -452,7 +452,7 @@
 	for (i = 0; i < NR_CPUS; i++) {
 		if (!cpu_online(i))
 			continue;
-		if (physical_balance && i > cpu_sibling_map[i])
+		if (i != CPU_TO_PACKAGEINDEX(i))
 			continue;
 		if (min_cpu_irq > CPU_IRQ(i)) {
 			min_cpu_irq = CPU_IRQ(i);
@@ -471,7 +471,7 @@
 	for (i = 0; i < NR_CPUS; i++) {
 		if (!cpu_online(i))
 			continue;
-		if (physical_balance && i > cpu_sibling_map[i])
+		if (i != CPU_TO_PACKAGEINDEX(i))
 			continue;
 		if (max_cpu_irq <= CPU_IRQ(i)) 
 			continue;
@@ -551,9 +551,14 @@
 	 * We seek the least loaded sibling by making the comparison
 	 * (A+B)/2 vs B
 	 */
-	if (physical_balance && (CPU_IRQ(min_loaded) >> 1) >
-					CPU_IRQ(cpu_sibling_map[min_loaded]))
-		min_loaded = cpu_sibling_map[min_loaded];
+	load = CPU_IRQ(min_loaded) >> 1;
+	for_each_cpu_mask(j, cpu_sibling_map[min_loaded]) {
+		if (load > CPU_IRQ(j)) {
+			/* This won't change cpu_sibling_map[min_loaded] */
+			load = CPU_IRQ(j);
+			min_loaded = j;
+		}
+	}
 
 	cpus_and(allowed_mask, cpu_online_map, irq_affinity[selected_irq]);
 	target_cpu_mask = cpumask_of_cpu(min_loaded);
@@ -848,7 +853,7 @@
  * we need to reprogram the ioredtbls to cater for the cpus which have come online
  * so mask in all cases should simply be TARGET_CPUS
  */
-void __init setup_ioapic_dest(cpumask_t mask)
+void __init setup_ioapic_dest(void)
 {
 	int pin, ioapic, irq, irq_entry;
 
@@ -861,7 +866,7 @@
 			if (irq_entry == -1)
 				continue;
 			irq = pin_2_irq(irq_entry, ioapic, pin);
-			set_ioapic_affinity_irq(irq, mask);
+			set_ioapic_affinity_irq(irq, TARGET_CPUS);
 		}
 
 	}
diff -Nru a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
--- a/arch/i386/kernel/irq.c	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/kernel/irq.c	Tue Jun 15 22:20:36 2004
@@ -1117,8 +1117,8 @@
 
 
 #ifdef CONFIG_4KSTACKS
-static char softirq_stack[NR_CPUS * THREAD_SIZE]  __attribute__((__aligned__(THREAD_SIZE)));
-static char hardirq_stack[NR_CPUS * THREAD_SIZE]  __attribute__((__aligned__(THREAD_SIZE)));
+static char softirq_stack[NR_CPUS * THREAD_SIZE]  __attribute__((__aligned__(THREAD_SIZE), __section__(".bss.page_aligned")));
+static char hardirq_stack[NR_CPUS * THREAD_SIZE]  __attribute__((__aligned__(THREAD_SIZE), __section__(".bss.page_aligned")));
 
 /*
  * allocate per-cpu stacks for hardirq and for softirq processing
diff -Nru a/arch/i386/kernel/mca.c b/arch/i386/kernel/mca.c
--- a/arch/i386/kernel/mca.c	Tue Jun 15 22:20:43 2004
+++ b/arch/i386/kernel/mca.c	Tue Jun 15 22:20:43 2004
@@ -258,15 +258,15 @@
 
 	/* Make sure the MCA bus is present */
 
-	if(!MCA_bus)
-		return -ENODEV;
-
-	printk(KERN_INFO "Micro Channel bus detected.\n");
-
-	if(mca_system_init()) {
+	if (mca_system_init()) {
 		printk(KERN_ERR "MCA bus system initialisation failed\n");
 		return -ENODEV;
 	}
+
+	if (!MCA_bus)
+		return -ENODEV;
+
+	printk(KERN_INFO "Micro Channel bus detected.\n");
 
 	/* All MCA systems have at least a primary bus */
 	bus = mca_attach_bus(MCA_PRIMARY_BUS);
diff -Nru a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
--- a/arch/i386/kernel/microcode.c	Tue Jun 15 22:20:38 2004
+++ b/arch/i386/kernel/microcode.c	Tue Jun 15 22:20:38 2004
@@ -113,7 +113,7 @@
 /* no concurrent ->write()s are allowed on /dev/cpu/microcode */
 static DECLARE_MUTEX(microcode_sem);
 
-static void *user_buffer;		/* user area microcode data buffer */
+static void __user *user_buffer;	/* user area microcode data buffer */
 static unsigned int user_buffer_size;	/* it's size */
 
 typedef enum mc_error_code {
@@ -425,7 +425,7 @@
 	return error;
 }
 
-static ssize_t microcode_write (struct file *file, const char *buf, size_t len, loff_t *ppos)
+static ssize_t microcode_write (struct file *file, const char __user *buf, size_t len, loff_t *ppos)
 {
 	ssize_t ret;
 
@@ -441,7 +441,7 @@
 
 	down(&microcode_sem);
 
-	user_buffer = (void *) buf;
+	user_buffer = (void __user *) buf;
 	user_buffer_size = (int) len;
 
 	ret = do_microcode_update();
diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
--- a/arch/i386/kernel/mpparse.c	Tue Jun 15 22:20:38 2004
+++ b/arch/i386/kernel/mpparse.c	Tue Jun 15 22:20:38 2004
@@ -1029,6 +1029,8 @@
 
 #ifdef CONFIG_ACPI_PCI
 
+int (*platform_rename_gsi)(int ioapic, int gsi);
+
 void __init mp_parse_prt (void)
 {
 	struct list_head	*node = NULL;
@@ -1072,10 +1074,8 @@
 			continue;
 		ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base;
 
-		if (es7000_plat) {
-			if (!ioapic && (gsi < 16))
-				gsi += 16;
-		}
+		if (platform_rename_gsi)
+			gsi = platform_rename_gsi(ioapic, gsi);
 
 		/* 
 		 * Avoid pin reprogramming.  PRTs typically include entries  
diff -Nru a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
--- a/arch/i386/kernel/msr.c	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/kernel/msr.c	Tue Jun 15 22:20:39 2004
@@ -46,234 +46,229 @@
 
 static inline int wrmsr_eio(u32 reg, u32 eax, u32 edx)
 {
-  int err;
+	int err;
 
-  asm volatile(
-	       "1:	wrmsr\n"
-	       "2:\n"
-	       ".section .fixup,\"ax\"\n"
-	       "3:	movl %4,%0\n"
-	       "	jmp 2b\n"
-	       ".previous\n"
-	       ".section __ex_table,\"a\"\n"
-	       "	.align 4\n"
-	       "	.long 1b,3b\n"
-	       ".previous"
-	       : "=&bDS" (err)
-	       : "a" (eax), "d" (edx), "c" (reg), "i" (-EIO), "0" (0));
+	asm volatile ("1:	wrmsr\n"
+		      "2:\n"
+		      ".section .fixup,\"ax\"\n"
+		      "3:	movl %4,%0\n"
+		      "	jmp 2b\n"
+		      ".previous\n"
+		      ".section __ex_table,\"a\"\n"
+		      "	.align 4\n" "	.long 1b,3b\n" ".previous":"=&bDS" (err)
+		      :"a"(eax), "d"(edx), "c"(reg), "i"(-EIO), "0"(0));
 
-  return err;
+	return err;
 }
 
 static inline int rdmsr_eio(u32 reg, u32 *eax, u32 *edx)
 {
-  int err;
+	int err;
 
-  asm volatile(
-	       "1:	rdmsr\n"
-	       "2:\n"
-	       ".section .fixup,\"ax\"\n"
-	       "3:	movl %4,%0\n"
-	       "	jmp 2b\n"
-	       ".previous\n"
-	       ".section __ex_table,\"a\"\n"
-	       "	.align 4\n"
-	       "	.long 1b,3b\n"
-	       ".previous"
-	       : "=&bDS" (err), "=a" (*eax), "=d" (*edx)
-	       : "c" (reg), "i" (-EIO), "0" (0));
+	asm volatile ("1:	rdmsr\n"
+		      "2:\n"
+		      ".section .fixup,\"ax\"\n"
+		      "3:	movl %4,%0\n"
+		      "	jmp 2b\n"
+		      ".previous\n"
+		      ".section __ex_table,\"a\"\n"
+		      "	.align 4\n"
+		      "	.long 1b,3b\n"
+		      ".previous":"=&bDS" (err), "=a"(*eax), "=d"(*edx)
+		      :"c"(reg), "i"(-EIO), "0"(0));
 
-  return err;
+	return err;
 }
 
 #ifdef CONFIG_SMP
 
 struct msr_command {
-  int cpu;
-  int err;
-  u32 reg;
-  u32 data[2];
+	int cpu;
+	int err;
+	u32 reg;
+	u32 data[2];
 };
 
 static void msr_smp_wrmsr(void *cmd_block)
 {
-  struct msr_command *cmd = (struct msr_command *) cmd_block;
-  
-  if ( cmd->cpu == smp_processor_id() )
-    cmd->err = wrmsr_eio(cmd->reg, cmd->data[0], cmd->data[1]);
+	struct msr_command *cmd = (struct msr_command *)cmd_block;
+
+	if (cmd->cpu == smp_processor_id())
+		cmd->err = wrmsr_eio(cmd->reg, cmd->data[0], cmd->data[1]);
 }
 
 static void msr_smp_rdmsr(void *cmd_block)
 {
-  struct msr_command *cmd = (struct msr_command *) cmd_block;
-  
-  if ( cmd->cpu == smp_processor_id() )
-    cmd->err = rdmsr_eio(cmd->reg, &cmd->data[0], &cmd->data[1]);
+	struct msr_command *cmd = (struct msr_command *)cmd_block;
+
+	if (cmd->cpu == smp_processor_id())
+		cmd->err = rdmsr_eio(cmd->reg, &cmd->data[0], &cmd->data[1]);
 }
 
 static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
 {
-  struct msr_command cmd;
-  int ret;
+	struct msr_command cmd;
+	int ret;
+
+	preempt_disable();
+	if (cpu == smp_processor_id()) {
+		ret = wrmsr_eio(reg, eax, edx);
+	} else {
+		cmd.cpu = cpu;
+		cmd.reg = reg;
+		cmd.data[0] = eax;
+		cmd.data[1] = edx;
 
-  preempt_disable();
-  if ( cpu == smp_processor_id() ) {
-    ret = wrmsr_eio(reg, eax, edx);
-  } else {
-    cmd.cpu = cpu;
-    cmd.reg = reg;
-    cmd.data[0] = eax;
-    cmd.data[1] = edx;
-    
-    smp_call_function(msr_smp_wrmsr, &cmd, 1, 1);
-    ret = cmd.err;
-  }
-  preempt_enable();
-  return ret;
+		smp_call_function(msr_smp_wrmsr, &cmd, 1, 1);
+		ret = cmd.err;
+	}
+	preempt_enable();
+	return ret;
 }
 
-static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx)
+static inline int do_rdmsr(int cpu, u32 reg, u32 * eax, u32 * edx)
 {
-  struct msr_command cmd;
-  int ret;
+	struct msr_command cmd;
+	int ret;
+
+	preempt_disable();
+	if (cpu == smp_processor_id()) {
+		ret = rdmsr_eio(reg, eax, edx);
+	} else {
+		cmd.cpu = cpu;
+		cmd.reg = reg;
+
+		smp_call_function(msr_smp_rdmsr, &cmd, 1, 1);
 
-  preempt_disable();
-  if ( cpu == smp_processor_id() ) {
-    ret = rdmsr_eio(reg, eax, edx);
-  } else {
-    cmd.cpu = cpu;
-    cmd.reg = reg;
-
-    smp_call_function(msr_smp_rdmsr, &cmd, 1, 1);
-    
-    *eax = cmd.data[0];
-    *edx = cmd.data[1];
-
-    ret = cmd.err;
-  }
-  preempt_enable();
-  return ret;
+		*eax = cmd.data[0];
+		*edx = cmd.data[1];
+
+		ret = cmd.err;
+	}
+	preempt_enable();
+	return ret;
 }
 
-#else /* ! CONFIG_SMP */
+#else				/* ! CONFIG_SMP */
 
 static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
 {
-  return wrmsr_eio(reg, eax, edx);
+	return wrmsr_eio(reg, eax, edx);
 }
 
 static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx)
 {
-  return rdmsr_eio(reg, eax, edx);
+	return rdmsr_eio(reg, eax, edx);
 }
 
-#endif /* ! CONFIG_SMP */
+#endif				/* ! CONFIG_SMP */
 
 static loff_t msr_seek(struct file *file, loff_t offset, int orig)
 {
-  loff_t ret = -EINVAL;
-  lock_kernel();
-  switch (orig) {
-  case 0:
-    file->f_pos = offset;
-    ret = file->f_pos;
-    break;
-  case 1:
-    file->f_pos += offset;
-    ret = file->f_pos;
-  }
-  unlock_kernel();
-  return ret;
-}
-
-static ssize_t msr_read(struct file * file, char __user * buf,
-			size_t count, loff_t *ppos)
-{
-  u32 *tmp = (u32 *)buf;
-  u32 data[2];
-  size_t rv;
-  u32 reg = *ppos;
-  int cpu = iminor(file->f_dentry->d_inode);
-  int err;
-
-  if ( count % 8 )
-    return -EINVAL; /* Invalid chunk size */
-  
-  for ( rv = 0 ; count ; count -= 8 ) {
-    err = do_rdmsr(cpu, reg, &data[0], &data[1]);
-    if ( err )
-      return err;
-    if ( copy_to_user(tmp,&data,8) )
-      return -EFAULT;
-    tmp += 2;
-  }
+	loff_t ret = -EINVAL;
+
+	lock_kernel();
+	switch (orig) {
+	case 0:
+		file->f_pos = offset;
+		ret = file->f_pos;
+		break;
+	case 1:
+		file->f_pos += offset;
+		ret = file->f_pos;
+	}
+	unlock_kernel();
+	return ret;
+}
+
+static ssize_t msr_read(struct file *file, char __user * buf,
+			size_t count, loff_t * ppos)
+{
+	u32 __user *tmp = (u32 __user *) buf;
+	u32 data[2];
+	size_t rv;
+	u32 reg = *ppos;
+	int cpu = iminor(file->f_dentry->d_inode);
+	int err;
+
+	if (count % 8)
+		return -EINVAL;	/* Invalid chunk size */
+
+	for (rv = 0; count; count -= 8) {
+		err = do_rdmsr(cpu, reg, &data[0], &data[1]);
+		if (err)
+			return err;
+		if (copy_to_user(tmp, &data, 8))
+			return -EFAULT;
+		tmp += 2;
+	}
 
-  return ((char *)tmp) - buf;
+	return ((char __user *)tmp) - buf;
 }
 
-static ssize_t msr_write(struct file * file, const char __user * buf,
+static ssize_t msr_write(struct file *file, const char __user *buf,
 			 size_t count, loff_t *ppos)
 {
-  const u32 *tmp = (const u32 *)buf;
-  u32 data[2];
-  size_t rv;
-  u32 reg = *ppos;
-  int cpu = iminor(file->f_dentry->d_inode);
-  int err;
-
-  if ( count % 8 )
-    return -EINVAL; /* Invalid chunk size */
-  
-  for ( rv = 0 ; count ; count -= 8 ) {
-    if ( copy_from_user(&data,tmp,8) )
-      return -EFAULT;
-    err = do_wrmsr(cpu, reg, data[0], data[1]);
-    if ( err )
-      return err;
-    tmp += 2;
-  }
+	const u32 __user *tmp = (const u32 __user *)buf;
+	u32 data[2];
+	size_t rv;
+	u32 reg = *ppos;
+	int cpu = iminor(file->f_dentry->d_inode);
+	int err;
+
+	if (count % 8)
+		return -EINVAL;	/* Invalid chunk size */
+
+	for (rv = 0; count; count -= 8) {
+		if (copy_from_user(&data, tmp, 8))
+			return -EFAULT;
+		err = do_wrmsr(cpu, reg, data[0], data[1]);
+		if (err)
+			return err;
+		tmp += 2;
+	}
 
-  return ((char *)tmp) - buf;
+	return ((char __user *)tmp) - buf;
 }
 
 static int msr_open(struct inode *inode, struct file *file)
 {
-  int cpu = iminor(file->f_dentry->d_inode);
-  struct cpuinfo_x86 *c = &(cpu_data)[cpu];
-  
-  if (!cpu_online(cpu))
-    return -ENXIO;		/* No such CPU */
-  if ( !cpu_has(c, X86_FEATURE_MSR) )
-    return -EIO;		/* MSR not supported */
-  
-  return 0;
+	unsigned int cpu = iminor(file->f_dentry->d_inode);
+	struct cpuinfo_x86 *c = &(cpu_data)[cpu];
+
+	if (cpu >= NR_CPUS || !cpu_online(cpu))
+		return -ENXIO;	/* No such CPU */
+	if (!cpu_has(c, X86_FEATURE_MSR))
+		return -EIO;	/* MSR not supported */
+
+	return 0;
 }
 
 /*
  * File operations we support
  */
 static struct file_operations msr_fops = {
-  .owner	= THIS_MODULE,
-  .llseek	= msr_seek,
-  .read		= msr_read,
-  .write	= msr_write,
-  .open		= msr_open,
+	.owner = THIS_MODULE,
+	.llseek = msr_seek,
+	.read = msr_read,
+	.write = msr_write,
+	.open = msr_open,
 };
 
 int __init msr_init(void)
 {
-  if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) {
-    printk(KERN_ERR "msr: unable to get major %d for msr\n",
-	   MSR_MAJOR);
-    return -EBUSY;
-  }
-  
-  return 0;
+	if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) {
+		printk(KERN_ERR "msr: unable to get major %d for msr\n",
+		       MSR_MAJOR);
+		return -EBUSY;
+	}
+
+	return 0;
 }
 
 void __exit msr_exit(void)
 {
-  unregister_chrdev(MSR_MAJOR, "cpu/msr");
+	unregister_chrdev(MSR_MAJOR, "cpu/msr");
 }
 
 module_init(msr_init);
diff -Nru a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
--- a/arch/i386/kernel/nmi.c	Tue Jun 15 22:20:41 2004
+++ b/arch/i386/kernel/nmi.c	Tue Jun 15 22:20:41 2004
@@ -33,7 +33,8 @@
 
 unsigned int nmi_watchdog = NMI_NONE;
 static unsigned int nmi_hz = HZ;
-unsigned int nmi_perfctr_msr;	/* the MSR to reset in NMI handler */
+static unsigned int nmi_perfctr_msr;	/* the MSR to reset in NMI handler */
+static unsigned int nmi_p4_cccr_val;
 extern void show_registers(struct pt_regs *regs);
 
 /*
@@ -80,7 +81,8 @@
 #define P4_ESCR_EVENT_SELECT(N)	((N)<<25)
 #define P4_ESCR_OS		(1<<3)
 #define P4_ESCR_USR		(1<<2)
-#define P4_CCCR_OVF_PMI		(1<<26)
+#define P4_CCCR_OVF_PMI0	(1<<26)
+#define P4_CCCR_OVF_PMI1	(1<<27)
 #define P4_CCCR_THRESHOLD(N)	((N)<<20)
 #define P4_CCCR_COMPLEMENT	(1<<19)
 #define P4_CCCR_COMPARE		(1<<18)
@@ -93,7 +95,7 @@
 #define MSR_P4_IQ_COUNTER0	0x30C
 #define P4_NMI_CRU_ESCR0	(P4_ESCR_EVENT_SELECT(0x3F)|P4_ESCR_OS|P4_ESCR_USR)
 #define P4_NMI_IQ_CCCR0	\
-	(P4_CCCR_OVF_PMI|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT|	\
+	(P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT|	\
 	 P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE)
 
 int __init check_nmi_watchdog (void)
@@ -364,6 +366,11 @@
 		return 0;
 
 	nmi_perfctr_msr = MSR_P4_IQ_COUNTER0;
+	nmi_p4_cccr_val = P4_NMI_IQ_CCCR0;
+#ifdef CONFIG_SMP
+	if (smp_num_siblings == 2)
+		nmi_p4_cccr_val |= P4_CCCR_OVF_PMI1;
+#endif
 
 	if (!(misc_enable & MSR_P4_MISC_ENABLE_PEBS_UNAVAIL))
 		clear_msr_range(0x3F1, 2);
@@ -381,7 +388,7 @@
 	Dprintk("setting P4_IQ_COUNTER0 to 0x%08lx\n", -(cpu_khz/nmi_hz*1000));
 	wrmsr(MSR_P4_IQ_COUNTER0, -(cpu_khz/nmi_hz*1000), -1);
 	apic_write(APIC_LVTPC, APIC_DM_NMI);
-	wrmsr(MSR_P4_IQ_CCCR0, P4_NMI_IQ_CCCR0, 0);
+	wrmsr(MSR_P4_IQ_CCCR0, nmi_p4_cccr_val, 0);
 	return 1;
 }
 
@@ -498,7 +505,7 @@
 			 * - LVTPC is masked on interrupt and must be
 			 *   unmasked by the LVTPC handler.
 			 */
-			wrmsr(MSR_P4_IQ_CCCR0, P4_NMI_IQ_CCCR0, 0);
+			wrmsr(MSR_P4_IQ_CCCR0, nmi_p4_cccr_val, 0);
 			apic_write(APIC_LVTPC, APIC_DM_NMI);
 		}
 		else if (nmi_perfctr_msr == MSR_P6_PERFCTR0) {
diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c	Tue Jun 15 22:20:35 2004
+++ b/arch/i386/kernel/process.c	Tue Jun 15 22:20:35 2004
@@ -202,6 +202,10 @@
 	if (!strncmp(str, "poll", 4)) {
 		printk("using polling idle threads.\n");
 		pm_idle = poll_idle;
+#ifdef CONFIG_X86_SMP
+		if (smp_num_siblings > 1)
+			printk("WARNING: polling idle and HT enabled, performance may degrade.\n");
+#endif
 	} else if (!strncmp(str, "halt", 4)) {
 		printk("using halt in idle threads.\n");
 		pm_idle = default_idle;
@@ -633,11 +637,6 @@
 	return error;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
 #define top_esp                (THREAD_SIZE - sizeof(unsigned long))
 #define top_ebp                (THREAD_SIZE - 2*sizeof(unsigned long))
 
@@ -658,14 +657,12 @@
 		if (ebp < stack_page || ebp > top_ebp+stack_page)
 			return 0;
 		eip = *(unsigned long *) (ebp+4);
-		if (eip < first_sched || eip >= last_sched)
+		if (!in_sched_functions(eip))
 			return eip;
 		ebp = *(unsigned long *) ebp;
 	} while (count++ < 16);
 	return 0;
 }
-#undef last_sched
-#undef first_sched
 
 /*
  * sys_alloc_thread_area: get a yet unused TLS descriptor index.
@@ -744,7 +741,7 @@
 	((desc)->a & 0x0ffff) | \
 	 ((desc)->b & 0xf0000) )
 	
-#define GET_32BIT(desc)		(((desc)->b >> 23) & 1)
+#define GET_32BIT(desc)		(((desc)->b >> 22) & 1)
 #define GET_CONTENTS(desc)	(((desc)->b >> 10) & 3)
 #define GET_WRITABLE(desc)	(((desc)->b >>  9) & 1)
 #define GET_LIMIT_PAGES(desc)	(((desc)->b >> 23) & 1)
diff -Nru a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
--- a/arch/i386/kernel/ptrace.c	Tue Jun 15 22:20:38 2004
+++ b/arch/i386/kernel/ptrace.c	Tue Jun 15 22:20:38 2004
@@ -174,7 +174,7 @@
 	((desc)->a & 0x0ffff) | \
 	 ((desc)->b & 0xf0000) )
 
-#define GET_32BIT(desc)		(((desc)->b >> 23) & 1)
+#define GET_32BIT(desc)		(((desc)->b >> 22) & 1)
 #define GET_CONTENTS(desc)	(((desc)->b >> 10) & 3)
 #define GET_WRITABLE(desc)	(((desc)->b >>  9) & 1)
 #define GET_LIMIT_PAGES(desc)	(((desc)->b >> 23) & 1)
@@ -235,6 +235,7 @@
 	struct task_struct *child;
 	struct user * dummy = NULL;
 	int i, ret;
+	unsigned long __user *datap = (unsigned long __user *)data;
 
 	lock_kernel();
 	ret = -EPERM;
@@ -283,7 +284,7 @@
 		ret = -EIO;
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp, datap);
 		break;
 	}
 
@@ -305,7 +306,7 @@
 			addr = addr >> 2;
 			tmp = child->thread.debugreg[addr];
 		}
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp, datap);
 		break;
 	}
 
@@ -423,13 +424,13 @@
 		break;
 
 	case PTRACE_GETREGS: { /* Get all gp regs from the child. */
-	  	if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE*sizeof(long))) {
+	  	if (!access_ok(VERIFY_WRITE, datap, FRAME_SIZE*sizeof(long))) {
 			ret = -EIO;
 			break;
 		}
 		for ( i = 0; i < FRAME_SIZE*sizeof(long); i += sizeof(long) ) {
-			__put_user(getreg(child, i),(unsigned long *) data);
-			data += sizeof(long);
+			__put_user(getreg(child, i), datap);
+			datap++;
 		}
 		ret = 0;
 		break;
@@ -437,21 +438,21 @@
 
 	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
 		unsigned long tmp;
-	  	if (!access_ok(VERIFY_READ, (unsigned *)data, FRAME_SIZE*sizeof(long))) {
+	  	if (!access_ok(VERIFY_READ, datap, FRAME_SIZE*sizeof(long))) {
 			ret = -EIO;
 			break;
 		}
 		for ( i = 0; i < FRAME_SIZE*sizeof(long); i += sizeof(long) ) {
-			__get_user(tmp, (unsigned long *) data);
+			__get_user(tmp, datap);
 			putreg(child, i, tmp);
-			data += sizeof(long);
+			datap++;
 		}
 		ret = 0;
 		break;
 	}
 
 	case PTRACE_GETFPREGS: { /* Get the child FPU state. */
-		if (!access_ok(VERIFY_WRITE, (unsigned *)data,
+		if (!access_ok(VERIFY_WRITE, datap,
 			       sizeof(struct user_i387_struct))) {
 			ret = -EIO;
 			break;
@@ -464,7 +465,7 @@
 	}
 
 	case PTRACE_SETFPREGS: { /* Set the child FPU state. */
-		if (!access_ok(VERIFY_READ, (unsigned *)data,
+		if (!access_ok(VERIFY_READ, datap,
 			       sizeof(struct user_i387_struct))) {
 			ret = -EIO;
 			break;
@@ -476,7 +477,7 @@
 	}
 
 	case PTRACE_GETFPXREGS: { /* Get the child extended FPU state. */
-		if (!access_ok(VERIFY_WRITE, (unsigned *)data,
+		if (!access_ok(VERIFY_WRITE, datap,
 			       sizeof(struct user_fxsr_struct))) {
 			ret = -EIO;
 			break;
@@ -488,7 +489,7 @@
 	}
 
 	case PTRACE_SETFPXREGS: { /* Set the child extended FPU state. */
-		if (!access_ok(VERIFY_READ, (unsigned *)data,
+		if (!access_ok(VERIFY_READ, datap,
 			       sizeof(struct user_fxsr_struct))) {
 			ret = -EIO;
 			break;
@@ -499,13 +500,13 @@
 	}
 
 	case PTRACE_GET_THREAD_AREA:
-		ret = ptrace_get_thread_area(child,
-					     addr, (struct user_desc __user *) data);
+		ret = ptrace_get_thread_area(child, addr,
+					(struct user_desc __user *) data);
 		break;
 
 	case PTRACE_SET_THREAD_AREA:
-		ret = ptrace_set_thread_area(child,
-					     addr, (struct user_desc __user *) data);
+		ret = ptrace_set_thread_area(child, addr,
+					(struct user_desc __user *) data);
 		break;
 
 	default:
diff -Nru a/arch/i386/kernel/scx200.c b/arch/i386/kernel/scx200.c
--- a/arch/i386/kernel/scx200.c	Tue Jun 15 22:20:44 2004
+++ b/arch/i386/kernel/scx200.c	Tue Jun 15 22:20:44 2004
@@ -86,7 +86,10 @@
 
 	if ((bridge = pci_find_device(PCI_VENDOR_ID_NS, 
 				      PCI_DEVICE_ID_NS_SCx200_BRIDGE,
-				      NULL)) == NULL)
+				      NULL)) == NULL
+	    && (bridge = pci_find_device(PCI_VENDOR_ID_NS,
+					 PCI_DEVICE_ID_NS_SC1100_BRIDGE,
+					 NULL)) == NULL)
 		return -ENODEV;
 
 	base = pci_resource_start(bridge, 0);
diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c	Tue Jun 15 22:20:40 2004
+++ b/arch/i386/kernel/setup.c	Tue Jun 15 22:20:40 2004
@@ -65,6 +65,7 @@
 
 #ifdef CONFIG_EFI
 int efi_enabled = 0;
+EXPORT_SYMBOL(efi_enabled);
 #endif
 
 /* cpu data as detected by the assembly code in head.S */
diff -Nru a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
--- a/arch/i386/kernel/signal.c	Tue Jun 15 22:20:40 2004
+++ b/arch/i386/kernel/signal.c	Tue Jun 15 22:20:40 2004
@@ -231,7 +231,6 @@
 	struct pt_regs *regs = (struct pt_regs *) &__unused;
 	struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(regs->esp - 4);
 	sigset_t set;
-	stack_t st;
 	int eax;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -248,16 +247,8 @@
 	if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &eax))
 		goto badframe;
 
-	if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
+	if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->esp) == -EFAULT)
 		goto badframe;
-	/* It is more difficult to avoid calling this function than to
-	   call it and ignore errors.  */
-	/*
-	 * THIS CANNOT WORK! "&st" is a kernel address, and "do_sigaltstack()"
-	 * takes a user address (and verifies that it is a user address). End
-	 * result: it does exactly _nothing_.
-	 */
-	do_sigaltstack(&st, NULL, regs->esp);
 
 	return eax;
 
@@ -278,12 +269,12 @@
 
 	tmp = 0;
 	__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->gs);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
 	__asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->fs);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->fs);
 
-	err |= __put_user(regs->xes, (unsigned int *)&sc->es);
-	err |= __put_user(regs->xds, (unsigned int *)&sc->ds);
+	err |= __put_user(regs->xes, (unsigned int __user *)&sc->es);
+	err |= __put_user(regs->xds, (unsigned int __user *)&sc->ds);
 	err |= __put_user(regs->edi, &sc->edi);
 	err |= __put_user(regs->esi, &sc->esi);
 	err |= __put_user(regs->ebp, &sc->ebp);
@@ -295,10 +286,10 @@
 	err |= __put_user(current->thread.trap_no, &sc->trapno);
 	err |= __put_user(current->thread.error_code, &sc->err);
 	err |= __put_user(regs->eip, &sc->eip);
-	err |= __put_user(regs->xcs, (unsigned int *)&sc->cs);
+	err |= __put_user(regs->xcs, (unsigned int __user *)&sc->cs);
 	err |= __put_user(regs->eflags, &sc->eflags);
 	err |= __put_user(regs->esp, &sc->esp_at_signal);
-	err |= __put_user(regs->xss, (unsigned int *)&sc->ss);
+	err |= __put_user(regs->xss, (unsigned int __user *)&sc->ss);
 
 	tmp = save_i387(fpstate);
 	if (tmp < 0)
@@ -390,9 +381,9 @@
 	 * reasons and because gdb uses it as a signature to notice
 	 * signal handler stack frames.
 	 */
-	err |= __put_user(0xb858, (short *)(frame->retcode+0));
-	err |= __put_user(__NR_sigreturn, (int *)(frame->retcode+2));
-	err |= __put_user(0x80cd, (short *)(frame->retcode+6));
+	err |= __put_user(0xb858, (short __user *)(frame->retcode+0));
+	err |= __put_user(__NR_sigreturn, (int __user *)(frame->retcode+2));
+	err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
 
 	if (err)
 		goto give_sigsegv;
@@ -471,9 +462,9 @@
 	 * reasons and because gdb uses it as a signature to notice
 	 * signal handler stack frames.
 	 */
-	err |= __put_user(0xb8, (char *)(frame->retcode+0));
-	err |= __put_user(__NR_rt_sigreturn, (int *)(frame->retcode+1));
-	err |= __put_user(0x80cd, (short *)(frame->retcode+5));
+	err |= __put_user(0xb8, (char __user *)(frame->retcode+0));
+	err |= __put_user(__NR_rt_sigreturn, (int __user *)(frame->retcode+1));
+	err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
 
 	if (err)
 		goto give_sigsegv;
diff -Nru a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c
--- a/arch/i386/kernel/smp.c	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/kernel/smp.c	Tue Jun 15 22:20:36 2004
@@ -519,6 +519,9 @@
 	if (!cpus)
 		return 0;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data.func = func;
 	data.info = info;
 	atomic_set(&data.started, 0);
diff -Nru a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
--- a/arch/i386/kernel/smpboot.c	Tue Jun 15 22:20:40 2004
+++ b/arch/i386/kernel/smpboot.c	Tue Jun 15 22:20:40 2004
@@ -39,6 +39,7 @@
 #include <linux/kernel.h>
 
 #include <linux/mm.h>
+#include <linux/sched.h>
 #include <linux/kernel_stat.h>
 #include <linux/smp_lock.h>
 #include <linux/irq.h>
@@ -936,7 +937,7 @@
 /* Where the IO area was mapped on multiquad, always 0 otherwise */
 void *xquad_portio;
 
-int cpu_sibling_map[NR_CPUS] __cacheline_aligned;
+cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned;
 
 static void __init smp_boot_cpus(unsigned int max_cpus)
 {
@@ -955,6 +956,8 @@
 
 	current_thread_info()->cpu = 0;
 	smp_tune_scheduling();
+	cpus_clear(cpu_sibling_map[0]);
+	cpu_set(0, cpu_sibling_map[0]);
 
 	/*
 	 * If we couldn't find an SMP configuration at boot time,
@@ -1081,34 +1084,39 @@
 	Dprintk("Boot done.\n");
 
 	/*
-	 * If Hyper-Threading is avaialble, construct cpu_sibling_map[], so
-	 * that we can tell the sibling CPU efficiently.
+	 * construct cpu_sibling_map[], so that we can tell sibling CPUs
+	 * efficiently.
 	 */
-	if (cpu_has_ht && smp_num_siblings > 1) {
-		for (cpu = 0; cpu < NR_CPUS; cpu++)
-			cpu_sibling_map[cpu] = NO_PROC_ID;
-		
-		for (cpu = 0; cpu < NR_CPUS; cpu++) {
-			int 	i;
-			if (!cpu_isset(cpu, cpu_callout_map))
-				continue;
+	for (cpu = 0; cpu < NR_CPUS; cpu++)
+		cpus_clear(cpu_sibling_map[cpu]);
+
+	for (cpu = 0; cpu < NR_CPUS; cpu++) {
+		int siblings = 0;
+		int i;
+		if (!cpu_isset(cpu, cpu_callout_map))
+			continue;
 
+		if (smp_num_siblings > 1) {
 			for (i = 0; i < NR_CPUS; i++) {
-				if (i == cpu || !cpu_isset(i, cpu_callout_map))
+				if (!cpu_isset(i, cpu_callout_map))
 					continue;
 				if (phys_proc_id[cpu] == phys_proc_id[i]) {
-					cpu_sibling_map[cpu] = i;
-					printk("cpu_sibling_map[%d] = %d\n", cpu, cpu_sibling_map[cpu]);
-					break;
+					siblings++;
+					cpu_set(i, cpu_sibling_map[cpu]);
 				}
 			}
-			if (cpu_sibling_map[cpu] == NO_PROC_ID) {
-				smp_num_siblings = 1;
-				printk(KERN_WARNING "WARNING: No sibling found for CPU %d.\n", cpu);
-			}
+		} else {
+			siblings++;
+			cpu_set(cpu, cpu_sibling_map[cpu]);
 		}
+
+		if (siblings != smp_num_siblings)
+			printk(KERN_WARNING "WARNING: %d siblings found for CPU%d, should be %d\n", siblings, cpu, smp_num_siblings);
 	}
 
+	if (nmi_watchdog == NMI_LOCAL_APIC)
+		check_nmi_watchdog();
+
 	smpboot_setup_io_apic();
 
 	setup_boot_APIC_clock();
@@ -1120,6 +1128,209 @@
 		synchronize_tsc_bp();
 }
 
+#ifdef CONFIG_SCHED_SMT
+#ifdef CONFIG_NUMA
+static struct sched_group sched_group_cpus[NR_CPUS];
+static struct sched_group sched_group_phys[NR_CPUS];
+static struct sched_group sched_group_nodes[MAX_NUMNODES];
+static DEFINE_PER_CPU(struct sched_domain, cpu_domains);
+static DEFINE_PER_CPU(struct sched_domain, phys_domains);
+static DEFINE_PER_CPU(struct sched_domain, node_domains);
+__init void arch_init_sched_domains(void)
+{
+	int i;
+	struct sched_group *first = NULL, *last = NULL;
+
+	/* Set up domains */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		struct sched_domain *phys_domain = &per_cpu(phys_domains, i);
+		struct sched_domain *node_domain = &per_cpu(node_domains, i);
+		int node = cpu_to_node(i);
+		cpumask_t nodemask = node_to_cpumask(node);
+
+		*cpu_domain = SD_SIBLING_INIT;
+		cpu_domain->span = cpu_sibling_map[i];
+		cpu_domain->parent = phys_domain;
+		cpu_domain->groups = &sched_group_cpus[i];
+
+		*phys_domain = SD_CPU_INIT;
+		phys_domain->span = nodemask;
+		phys_domain->parent = node_domain;
+		phys_domain->groups = &sched_group_phys[first_cpu(cpu_domain->span)];
+
+		*node_domain = SD_NODE_INIT;
+		node_domain->span = cpu_possible_map;
+		node_domain->groups = &sched_group_nodes[cpu_to_node(i)];
+	}
+
+	/* Set up CPU (sibling) groups */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		int j;
+		first = last = NULL;
+
+		if (i != first_cpu(cpu_domain->span))
+			continue;
+
+		for_each_cpu_mask(j, cpu_domain->span) {
+			struct sched_group *cpu = &sched_group_cpus[j];
+
+			cpu->cpumask = CPU_MASK_NONE;
+			cpu_set(j, cpu->cpumask);
+			cpu->cpu_power = SCHED_LOAD_SCALE;
+
+			if (!first)
+				first = cpu;
+			if (last)
+				last->next = cpu;
+			last = cpu;
+		}
+		last->next = first;
+	}
+
+	for (i = 0; i < MAX_NUMNODES; i++) {
+		int j;
+		cpumask_t nodemask;
+		struct sched_group *node = &sched_group_nodes[i];
+		cpus_and(nodemask, node_to_cpumask(i), cpu_possible_map);
+
+		if (cpus_empty(nodemask))
+			continue;
+
+		first = last = NULL;
+		/* Set up physical groups */
+		for_each_cpu_mask(j, nodemask) {
+			struct sched_domain *cpu_domain = &per_cpu(cpu_domains, j);
+			struct sched_group *cpu = &sched_group_phys[j];
+
+			if (j != first_cpu(cpu_domain->span))
+				continue;
+
+			cpu->cpumask = cpu_domain->span;
+			/*
+			 * Make each extra sibling increase power by 10% of
+			 * the basic CPU. This is very arbitrary.
+			 */
+			cpu->cpu_power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE*(cpus_weight(cpu->cpumask)-1) / 10;
+			node->cpu_power += cpu->cpu_power;
+
+			if (!first)
+				first = cpu;
+			if (last)
+				last->next = cpu;
+			last = cpu;
+		}
+		last->next = first;
+	}
+
+	/* Set up nodes */
+	first = last = NULL;
+	for (i = 0; i < MAX_NUMNODES; i++) {
+		struct sched_group *cpu = &sched_group_nodes[i];
+		cpumask_t nodemask;
+		cpus_and(nodemask, node_to_cpumask(i), cpu_possible_map);
+
+		if (cpus_empty(nodemask))
+			continue;
+
+		cpu->cpumask = nodemask;
+		/* ->cpu_power already setup */
+
+		if (!first)
+			first = cpu;
+		if (last)
+			last->next = cpu;
+		last = cpu;
+	}
+	last->next = first;
+
+	mb();
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		cpu_attach_domain(cpu_domain, i);
+	}
+}
+#else /* !CONFIG_NUMA */
+static struct sched_group sched_group_cpus[NR_CPUS];
+static struct sched_group sched_group_phys[NR_CPUS];
+static DEFINE_PER_CPU(struct sched_domain, cpu_domains);
+static DEFINE_PER_CPU(struct sched_domain, phys_domains);
+__init void arch_init_sched_domains(void)
+{
+	int i;
+	struct sched_group *first = NULL, *last = NULL;
+
+	/* Set up domains */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		struct sched_domain *phys_domain = &per_cpu(phys_domains, i);
+
+		*cpu_domain = SD_SIBLING_INIT;
+		cpu_domain->span = cpu_sibling_map[i];
+		cpu_domain->parent = phys_domain;
+		cpu_domain->groups = &sched_group_cpus[i];
+
+		*phys_domain = SD_CPU_INIT;
+		phys_domain->span = cpu_possible_map;
+		phys_domain->groups = &sched_group_phys[first_cpu(cpu_domain->span)];
+	}
+
+	/* Set up CPU (sibling) groups */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		int j;
+		first = last = NULL;
+
+		if (i != first_cpu(cpu_domain->span))
+			continue;
+
+		for_each_cpu_mask(j, cpu_domain->span) {
+			struct sched_group *cpu = &sched_group_cpus[j];
+
+			cpus_clear(cpu->cpumask);
+			cpu_set(j, cpu->cpumask);
+			cpu->cpu_power = SCHED_LOAD_SCALE;
+
+			if (!first)
+				first = cpu;
+			if (last)
+				last->next = cpu;
+			last = cpu;
+		}
+		last->next = first;
+	}
+
+	first = last = NULL;
+	/* Set up physical groups */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		struct sched_group *cpu = &sched_group_phys[i];
+
+		if (i != first_cpu(cpu_domain->span))
+			continue;
+
+		cpu->cpumask = cpu_domain->span;
+		/* See SMT+NUMA setup for comment */
+		cpu->cpu_power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE*(cpus_weight(cpu->cpumask)-1) / 10;
+
+		if (!first)
+			first = cpu;
+		if (last)
+			last->next = cpu;
+		last = cpu;
+	}
+	last->next = first;
+
+	mb();
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		cpu_attach_domain(cpu_domain, i);
+	}
+}
+#endif /* CONFIG_NUMA */
+#endif /* CONFIG_SCHED_SMT */
+
 /* These are wrappers to interface to the new boot process.  Someone
    who understands all this stuff should rewrite it properly. --RR 15/Jul/02 */
 void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -1158,8 +1369,7 @@
 void __init smp_cpus_done(unsigned int max_cpus)
 {
 #ifdef CONFIG_X86_IO_APIC
-	cpumask_t targets = CPU_MASK_ALL;
-	setup_ioapic_dest(targets);
+	setup_ioapic_dest();
 #endif
 	zap_low_mappings();
 }
diff -Nru a/arch/i386/kernel/timers/timer_cyclone.c b/arch/i386/kernel/timers/timer_cyclone.c
--- a/arch/i386/kernel/timers/timer_cyclone.c	Tue Jun 15 22:20:42 2004
+++ b/arch/i386/kernel/timers/timer_cyclone.c	Tue Jun 15 22:20:42 2004
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/fixmap.h>
+#include "io_ports.h"
 
 extern spinlock_t i8253_lock;
 
@@ -62,6 +63,17 @@
 
 	count = inb_p(0x40);    /* read the latched count */
 	count |= inb(0x40) << 8;
+
+	/*
+	 * VIA686a test code... reset the latch if count > max + 1
+	 * from timer_pit.c - cjb
+	 */
+	if (count > LATCH) {
+		outb_p(0x34, PIT_MODE);
+		outb_p(LATCH & 0xff, PIT_CH0);
+		outb(LATCH >> 8, PIT_CH0);
+		count = LATCH - 1;
+	}
 	spin_unlock(&i8253_lock);
 
 	/* lost tick compensation */
diff -Nru a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
--- a/arch/i386/kernel/timers/timer_tsc.c	Tue Jun 15 22:20:42 2004
+++ b/arch/i386/kernel/timers/timer_tsc.c	Tue Jun 15 22:20:42 2004
@@ -27,6 +27,8 @@
 struct timer_opts timer_tsc;
 #endif
 
+static inline void cpufreq_delayed_get(void);
+
 int tsc_disable __initdata = 0;
 
 extern spinlock_t i8253_lock;
@@ -241,6 +243,9 @@
 
 			clock_fallback();
 		}
+		/* ... but give the TSC a fair chance */
+		if (lost_count > 25)
+			cpufreq_delayed_get();
 	} else
 		lost_count = 0;
 	/* update the monotonic base value */
@@ -324,15 +329,40 @@
 
 
 #ifdef CONFIG_CPU_FREQ
+#include <linux/workqueue.h>
+
+static unsigned int cpufreq_delayed_issched = 0;
+static unsigned int cpufreq_init = 0;
+static struct work_struct cpufreq_delayed_get_work;
+
+static void handle_cpufreq_delayed_get(void *v)
+{
+	unsigned int cpu;
+	for_each_online_cpu(cpu) {
+		cpufreq_get(cpu);
+	}
+	cpufreq_delayed_issched = 0;
+}
+
+/* if we notice lost ticks, schedule a call to cpufreq_get() as it tries
+ * to verify the CPU frequency the timing core thinks the CPU is running
+ * at is still correct.
+ */
+static inline void cpufreq_delayed_get(void) 
+{
+	if (cpufreq_init && !cpufreq_delayed_issched) {
+		cpufreq_delayed_issched = 1;
+		printk(KERN_DEBUG "Losing some ticks... checking if CPU frequency changed.\n");
+		schedule_work(&cpufreq_delayed_get_work);
+	}
+}
+
 /* If the CPU frequency is scaled, TSC-based delays will need a different
- * loops_per_jiffy value to function properly. An exception to this
- * are modern Intel Pentium 4 processors, where the TSC runs at a constant
- * speed independent of frequency scaling. 
+ * loops_per_jiffy value to function properly.
  */
 
 static unsigned int  ref_freq = 0;
 static unsigned long loops_per_jiffy_ref = 0;
-static unsigned int  variable_tsc = 1;
 
 #ifndef CONFIG_SMP
 static unsigned long fast_gettimeoffset_ref = 0;
@@ -356,14 +386,15 @@
 	}
 
 	if ((val == CPUFREQ_PRECHANGE  && freq->old < freq->new) ||
-	    (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
-		if (variable_tsc)
+	    (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
+	    (val == CPUFREQ_RESUMECHANGE)) {
+		if (!(freq->flags & CPUFREQ_CONST_LOOPS))
 			cpu_data[freq->cpu].loops_per_jiffy = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);
 #ifndef CONFIG_SMP
 		if (cpu_khz)
 			cpu_khz = cpufreq_scale(cpu_khz_ref, ref_freq, freq->new);
 		if (use_tsc) {
-			if (variable_tsc) {
+			if (!(freq->flags & CPUFREQ_CONST_LOOPS)) {
 				fast_gettimeoffset_quotient = cpufreq_scale(fast_gettimeoffset_ref, freq->new, ref_freq);
 				set_cyc2ns_scale(cpu_khz/1000);
 			}
@@ -382,14 +413,17 @@
 
 static int __init cpufreq_tsc(void)
 {
-	/* P4 and above CPU TSC freq doesn't change when CPU frequency changes*/
-	if ((boot_cpu_data.x86 >= 15) && (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL))
-		variable_tsc = 0;
-
-	return cpufreq_register_notifier(&time_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
+	int ret;
+	INIT_WORK(&cpufreq_delayed_get_work, handle_cpufreq_delayed_get, NULL);
+	ret = cpufreq_register_notifier(&time_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
+	if (!ret)
+		cpufreq_init = 1;
+	return ret;
 }
 core_initcall(cpufreq_tsc);
 
+#else /* CONFIG_CPU_FREQ */
+static inline void cpufreq_delayed_get(void) { return; }
 #endif 
 
 
diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
--- a/arch/i386/kernel/traps.c	Tue Jun 15 22:20:37 2004
+++ b/arch/i386/kernel/traps.c	Tue Jun 15 22:20:37 2004
@@ -94,27 +94,70 @@
 
 static int kstack_depth_to_print = 24;
 
-void show_trace(struct task_struct *task, unsigned long * stack)
+static int valid_stack_ptr(struct task_struct *task, void *p)
+{
+	if (p <= (void *)task->thread_info)
+		return 0;
+	if (kstack_end(p))
+		return 0;
+	return 1;
+}
+
+#ifdef CONFIG_FRAME_POINTER
+void print_context_stack(struct task_struct *task, unsigned long *stack,
+			 unsigned long ebp)
 {
 	unsigned long addr;
 
-	if (!stack)
-		stack = (unsigned long*)&stack;
+	while (valid_stack_ptr(task, (void *)ebp)) {
+		addr = *(unsigned long *)(ebp + 4);
+		printk(" [<%08lx>] ", addr);
+		print_symbol("%s", addr);
+		printk("\n");
+		ebp = *(unsigned long *)ebp;
+	}
+}
+#else
+void print_context_stack(struct task_struct *task, unsigned long *stack,
+			 unsigned long ebp)
+{
+	unsigned long addr;
 
-	printk("Call Trace:");
-#ifdef CONFIG_KALLSYMS
-	printk("\n");
+	while (!kstack_end(stack)) {
+		addr = *stack++;
+		if (kernel_text_address(addr)) {
+			printk(" [<%08lx>] ", addr);
+			print_symbol("%s\n", addr);
+		}
+	}
+}
 #endif
+
+void show_trace(struct task_struct *task, unsigned long * stack)
+{
+	unsigned long ebp;
+
+	if (!task)
+		task = current;
+
+	if (!valid_stack_ptr(task, stack)) {
+		printk("Stack pointer is garbage, not printing trace\n");
+		return;
+	}
+
+	if (task == current) {
+		/* Grab ebp right from our regs */
+		asm ("movl %%ebp, %0" : "=r" (ebp) : );
+	} else {
+		/* ebp is the last reg pushed by switch_to */
+		ebp = *(unsigned long *) task->thread.esp;
+	}
+
 	while (1) {
 		struct thread_info *context;
-		context = (struct thread_info*) ((unsigned long)stack & (~(THREAD_SIZE - 1)));
-		while (!kstack_end(stack)) {
-			addr = *stack++;
-			if (kernel_text_address(addr)) {
-				printk(" [<%08lx>] ", addr);
-				print_symbol("%s\n", addr);
-			}
-		}
+		context = (struct thread_info *)
+			((unsigned long)stack & (~(THREAD_SIZE - 1)));
+		print_context_stack(task, stack, ebp);
 		stack = (unsigned long*)context->previous_esp;
 		if (!stack)
 			break;
@@ -143,7 +186,7 @@
 			printk("\n       ");
 		printk("%08lx ", *stack++);
 	}
-	printk("\n");
+	printk("\nCall Trace:\n");
 	show_trace(task, esp);
 }
 
@@ -240,7 +283,7 @@
 		file = "<bad filename>";
 
 	printk("------------[ cut here ]------------\n");
-	printk("kernel BUG at %s:%d!\n", file, line);
+	printk(KERN_ALERT "kernel BUG at %s:%d!\n", file, line);
 
 no_bug:
 	return;
@@ -261,7 +304,7 @@
 	spin_lock_irq(&die_lock);
 	bust_spinlocks(1);
 	handle_BUG(regs);
-	printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
+	printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
 #ifdef CONFIG_PREEMPT
 	printk("PREEMPT ");
 	nl = 1;
diff -Nru a/arch/i386/lib/getuser.S b/arch/i386/lib/getuser.S
--- a/arch/i386/lib/getuser.S	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/lib/getuser.S	Tue Jun 15 22:20:36 2004
@@ -28,7 +28,7 @@
 .globl __get_user_1
 __get_user_1:
 	GET_THREAD_INFO(%edx)
-	cmpl TI_ADDR_LIMIT(%edx),%eax
+	cmpl TI_addr_limit(%edx),%eax
 	jae bad_get_user
 1:	movzbl (%eax),%edx
 	xorl %eax,%eax
@@ -40,7 +40,7 @@
 	addl $1,%eax
 	jc bad_get_user
 	GET_THREAD_INFO(%edx)
-	cmpl TI_ADDR_LIMIT(%edx),%eax
+	cmpl TI_addr_limit(%edx),%eax
 	jae bad_get_user
 2:	movzwl -1(%eax),%edx
 	xorl %eax,%eax
@@ -52,7 +52,7 @@
 	addl $3,%eax
 	jc bad_get_user
 	GET_THREAD_INFO(%edx)
-	cmpl TI_ADDR_LIMIT(%edx),%eax
+	cmpl TI_addr_limit(%edx),%eax
 	jae bad_get_user
 3:	movl -3(%eax),%edx
 	xorl %eax,%eax
diff -Nru a/arch/i386/mach-default/topology.c b/arch/i386/mach-default/topology.c
--- a/arch/i386/mach-default/topology.c	Tue Jun 15 22:20:44 2004
+++ b/arch/i386/mach-default/topology.c	Tue Jun 15 22:20:44 2004
@@ -41,8 +41,10 @@
 {
 	int i;
 
-	for (i = 0; i < num_online_nodes(); i++)
-		arch_register_node(i);
+	for (i = 0; i < MAX_NUMNODES; i++) {
+		if (node_online(i))
+			arch_register_node(i);
+	}
 	for (i = 0; i < NR_CPUS; i++)
 		if (cpu_possible(i)) arch_register_cpu(i);
 	return 0;
diff -Nru a/arch/i386/mach-es7000/Makefile b/arch/i386/mach-es7000/Makefile
--- a/arch/i386/mach-es7000/Makefile	Tue Jun 15 22:20:40 2004
+++ b/arch/i386/mach-es7000/Makefile	Tue Jun 15 22:20:40 2004
@@ -2,4 +2,5 @@
 # Makefile for the linux kernel.
 #
 
-obj-y		:= setup.o topology.o es7000.o
+obj-$(CONFIG_X86_ES7000)	:= es7000plat.o
+obj-$(CONFIG_X86_GENERICARCH)	:= es7000plat.o
diff -Nru a/arch/i386/mach-es7000/es7000.c b/arch/i386/mach-es7000/es7000.c
--- a/arch/i386/mach-es7000/es7000.c	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,279 +0,0 @@
-/*
- * Written by: Garry Forsgren, Unisys Corporation
- *             Natalie Protasevich, Unisys Corporation
- * This file contains the code to configure and interface 
- * with Unisys ES7000 series hardware system manager.
- *
- * Copyright (c) 2003 Unisys Corporation.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Unisys Corporation, Township Line & Union Meeting 
- * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
- *
- * http://www.unisys.com
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/smp.h>
-#include <linux/string.h>
-#include <linux/spinlock.h>
-#include <linux/errno.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
-#include <linux/init.h>
-#include <linux/acpi.h>
-#include <asm/io.h>
-#include <asm/nmi.h>
-#include <asm/smp.h>
-#include <asm/apicdef.h>
-#include "es7000.h"
-
-/*
- * ES7000 Globals
- */
-
-volatile unsigned long	*psai = NULL;
-struct mip_reg		*mip_reg;  
-struct mip_reg		*host_reg;
-int 			mip_port;
-unsigned long		mip_addr, host_addr;
-
-/*
- * Parse the OEM Table
- */
-
-void __init
-parse_unisys_oem (char *oemptr, int oem_entries)
-{
-	int                     i;
-	int 			success = 0;
-	unsigned char           type, size;
-	unsigned long           val;
-	char                    *tp = NULL;  
-	struct psai             *psaip = NULL;
-	struct mip_reg_info 	*mi;
-	struct mip_reg		*host, *mip;
-
-	tp = oemptr;
-
-	tp += 8;
-
-	for (i=0; i <= oem_entries; i++) {
-		type = *tp++;
-		size = *tp++;
-		tp -= 2;
-		switch (type) {
-		case MIP_REG:
-			mi = (struct mip_reg_info *)tp;
-			val = MIP_RD_LO(mi->host_reg);
-			host_addr = val;
-			host = (struct mip_reg *)val;
-			host_reg = __va(host);
-			val = MIP_RD_LO(mi->mip_reg);
-			mip_addr = val;
-			mip = (struct mip_reg *)val;
-			mip_reg = __va(mip);
-			Dprintk("es7000_mipcfg: host_reg = 0x%lx \n", 
-				(unsigned long)host_reg);
-			Dprintk("es7000_mipcfg: mip_reg = 0x%lx \n", 
-				(unsigned long)mip_reg);
-			success++;
-			break;
-		case MIP_PSAI_REG:
-			psaip = (struct psai *)tp;
-			if (tp != NULL) {
-				if (psaip->addr)
-					psai = __va(psaip->addr);
-				else
-					psai = NULL;
-				success++;
-			}
-			break;
-		default:
-			break;
-		}
-		if (i == 6) break;
-		tp += size;
-	}
-
-	if (success < 2) {
-		printk("\nNo ES7000 found.\n");
-		es7000_plat = 0;
-	} else {
-		printk("\nEnabling ES7000 specific features...\n");
-		es7000_plat = 1;
-	}
-	return;
-}
-
-int __init 
-find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length) 
-{
-	struct acpi_table_rsdp		*rsdp = NULL;
-	unsigned long			rsdp_phys = 0;
-	struct acpi_table_header 	*header = NULL;
-	int				i;
-	struct acpi_table_sdt		sdt;
-
-	rsdp_phys = acpi_find_rsdp();
-	rsdp = __va(rsdp_phys);
-	if (rsdp->rsdt_address) {
-		struct acpi_table_rsdt	*mapped_rsdt = NULL;
-		sdt.pa = rsdp->rsdt_address;
-
-		header = (struct acpi_table_header *)
-			__acpi_map_table(sdt.pa, sizeof(struct acpi_table_header));
-		if (!header)
-			return -ENODEV;
-
-		sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 3;
-		mapped_rsdt = (struct acpi_table_rsdt *)
-			__acpi_map_table(sdt.pa, header->length);
-		if (!mapped_rsdt)
-			return -ENODEV;
-
-		header = &mapped_rsdt->header;
-
-		for (i = 0; i < sdt.count; i++)
-			sdt.entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
-	};
-	for (i = 0; i < sdt.count; i++) {
-
-		header = (struct acpi_table_header *)
-			__acpi_map_table(sdt.entry[i].pa,
-				sizeof(struct acpi_table_header));
-		if (!header)
-			continue;
-		if (!strncmp((char *) &header->signature, "OEM1", 4)) {
-			if (!strncmp((char *) &header->oem_id, "UNISYS", 6)) {
-				void *addr;
-				struct oem_table *t;
-				acpi_table_print(header, sdt.entry[i].pa);
-				t = (struct oem_table *) __acpi_map_table(sdt.entry[i].pa, header->length);
-				addr = (void *) __acpi_map_table(t->OEMTableAddr, t->OEMTableSize);
-				*length = header->length;
-				*oem_addr = (unsigned long) addr;
-				return 0;
-			}
-		}
-	}
-	printk("ES7000: did not find Unisys ACPI OEM table!\n");
-	return -1;
-}
-
-static void
-es7000_spin(int n)
-{
-	int i = 0;
-
-	while (i++ < n) 
-		rep_nop();
-}
-
-static int __init
-es7000_mip_write(struct mip_reg *mip_reg)
-{
-	int			status = 0;
-	int			spin;
-
-	spin = MIP_SPIN;
-	while (((unsigned long long)host_reg->off_38 &
-		(unsigned long long)MIP_VALID) != 0) {
-			if (--spin <= 0) {
-				printk("es7000_mip_write: Timeout waiting for Host Valid Flag");
-				return -1;
-			}
-		es7000_spin(MIP_SPIN);
-	}
-
-	memcpy(host_reg, mip_reg, sizeof(struct mip_reg));
-	outb(1, mip_port);
-
-	spin = MIP_SPIN;
-
-	while (((unsigned long long)mip_reg->off_38 &
-		(unsigned long long)MIP_VALID) == 0) {
-		if (--spin <= 0) {
-			printk("es7000_mip_write: Timeout waiting for MIP Valid Flag");
-			return -1;
-		}
-		es7000_spin(MIP_SPIN);
-	}
-
-	status = ((unsigned long long)mip_reg->off_0 &
-		(unsigned long long)0xffff0000000000) >> 48;
-	mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 &
-		(unsigned long long)~MIP_VALID);
-	return status;
-}
-
-int 
-es7000_start_cpu(int cpu, unsigned long eip)
-{
-	unsigned long vect = 0, psaival = 0;
-
-	if (psai == NULL)
-		return -1;
-
-	vect = ((unsigned long)__pa(eip)/0x1000) << 16;
-	psaival = (0x1000000 | vect | cpu);
-
-	while (*psai & 0x1000000)
-                ;
-
-	*psai = psaival;
-
-	return 0;
-
-}
-
-int 
-es7000_stop_cpu(int cpu)
-{
-	int startup;
-
-	if (psai == NULL)
-		return -1;
-
-	startup= (0x1000000 | cpu);
-
-	while ((*psai & 0xff00ffff) != startup)
-		;
-
-	startup = (*psai & 0xff0000) >> 16;
-	*psai &= 0xffffff;
-
-	return 0;
-
-}
-
-void __init
-es7000_sw_apic()
-{
-	if (es7000_plat) {
-		int mip_status;
-		struct mip_reg es7000_mip_reg;
-
-		printk("ES7000: Enabling APIC mode.\n");
-        	memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
-        	es7000_mip_reg.off_0 = MIP_SW_APIC;
-        	es7000_mip_reg.off_38 = (MIP_VALID);
-        	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
-              		printk("es7000_sw_apic: command failed, status = %x\n", 
-				mip_status);
-		return;
-	}
-}
diff -Nru a/arch/i386/mach-es7000/es7000.h b/arch/i386/mach-es7000/es7000.h
--- a/arch/i386/mach-es7000/es7000.h	Tue Jun 15 22:20:37 2004
+++ b/arch/i386/mach-es7000/es7000.h	Tue Jun 15 22:20:37 2004
@@ -30,6 +30,7 @@
 #define	MIP_BUSY		1
 #define	MIP_SPIN		0xf0000
 #define	MIP_VALID		0x0100000000000000
+#define	MIP_PORT(VALUE)	((VALUE >> 32) & 0xffff)
 
 #define	MIP_RD_LO(VALUE)	(VALUE & 0xffffffff)   
 
@@ -103,7 +104,7 @@
 #define	MIP_SW_APIC		0x1020b
 #define	MIP_FUNC(VALUE) 	(VALUE & 0xff)
 
-extern void parse_unisys_oem (char *oemptr, int oem_entries);
+extern int parse_unisys_oem (char *oemptr, int oem_entries);
 extern int find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length);
 extern int es7000_start_cpu(int cpu, unsigned long eip);
 extern void es7000_sw_apic(void);
diff -Nru a/arch/i386/mach-es7000/es7000plat.c b/arch/i386/mach-es7000/es7000plat.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/i386/mach-es7000/es7000plat.c	Tue Jun 15 22:21:02 2004
@@ -0,0 +1,302 @@
+/*
+ * Written by: Garry Forsgren, Unisys Corporation
+ *             Natalie Protasevich, Unisys Corporation
+ * This file contains the code to configure and interface
+ * with Unisys ES7000 series hardware system manager.
+ *
+ * Copyright (c) 2003 Unisys Corporation.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Unisys Corporation, Township Line & Union Meeting
+ * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or:
+ *
+ * http://www.unisys.com
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/smp.h>
+#include <linux/string.h>
+#include <linux/spinlock.h>
+#include <linux/errno.h>
+#include <linux/notifier.h>
+#include <linux/reboot.h>
+#include <linux/init.h>
+#include <linux/acpi.h>
+#include <asm/io.h>
+#include <asm/nmi.h>
+#include <asm/smp.h>
+#include <asm/apicdef.h>
+#include "es7000.h"
+
+/*
+ * ES7000 Globals
+ */
+
+volatile unsigned long	*psai = NULL;
+struct mip_reg		*mip_reg;
+struct mip_reg		*host_reg;
+int 			mip_port;
+unsigned long		mip_addr, host_addr;
+
+static int __init
+es7000_rename_gsi(int ioapic, int gsi)
+{
+	if (ioapic)
+		return gsi;
+	else {
+		if (gsi == 0)
+			return 13;
+		if (gsi == 1)
+			return 16;
+		if (gsi == 4)
+			return 17;
+		if (gsi == 6)
+			return 18;
+		if (gsi == 7)
+			return 19;
+		if (gsi == 8)
+			return 20;
+		return gsi;
+        }
+}
+
+/*
+ * Parse the OEM Table
+ */
+
+int __init
+parse_unisys_oem (char *oemptr, int oem_entries)
+{
+	int                     i;
+	int 			success = 0;
+	unsigned char           type, size;
+	unsigned long           val;
+	char                    *tp = NULL;
+	struct psai             *psaip = NULL;
+	struct mip_reg_info 	*mi;
+	struct mip_reg		*host, *mip;
+
+	tp = oemptr;
+
+	tp += 8;
+
+	for (i=0; i <= oem_entries; i++) {
+		type = *tp++;
+		size = *tp++;
+		tp -= 2;
+		switch (type) {
+		case MIP_REG:
+			mi = (struct mip_reg_info *)tp;
+			val = MIP_RD_LO(mi->host_reg);
+			host_addr = val;
+			host = (struct mip_reg *)val;
+			host_reg = __va(host);
+			val = MIP_RD_LO(mi->mip_reg);
+			mip_port = MIP_PORT(mi->mip_info);
+			mip_addr = val;
+			mip = (struct mip_reg *)val;
+			mip_reg = __va(mip);
+			Dprintk("es7000_mipcfg: host_reg = 0x%lx \n",
+				(unsigned long)host_reg);
+			Dprintk("es7000_mipcfg: mip_reg = 0x%lx \n",
+				(unsigned long)mip_reg);
+			success++;
+			break;
+		case MIP_PSAI_REG:
+			psaip = (struct psai *)tp;
+			if (tp != NULL) {
+				if (psaip->addr)
+					psai = __va(psaip->addr);
+				else
+					psai = NULL;
+				success++;
+			}
+			break;
+		default:
+			break;
+		}
+		if (i == 6) break;
+		tp += size;
+	}
+
+	if (success < 2) {
+		es7000_plat = 0;
+	} else {
+		printk("\nEnabling ES7000 specific features...\n");
+		es7000_plat = 1;
+		platform_rename_gsi = es7000_rename_gsi;
+	}
+	return es7000_plat;
+}
+
+int __init
+find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length)
+{
+	struct acpi_table_rsdp		*rsdp = NULL;
+	unsigned long			rsdp_phys = 0;
+	struct acpi_table_header 	*header = NULL;
+	int				i;
+	struct acpi_table_sdt		sdt;
+
+	rsdp_phys = acpi_find_rsdp();
+	rsdp = __va(rsdp_phys);
+	if (rsdp->rsdt_address) {
+		struct acpi_table_rsdt	*mapped_rsdt = NULL;
+		sdt.pa = rsdp->rsdt_address;
+
+		header = (struct acpi_table_header *)
+			__acpi_map_table(sdt.pa, sizeof(struct acpi_table_header));
+		if (!header)
+			return -ENODEV;
+
+		sdt.count = (header->length - sizeof(struct acpi_table_header)) >> 3;
+		mapped_rsdt = (struct acpi_table_rsdt *)
+			__acpi_map_table(sdt.pa, header->length);
+		if (!mapped_rsdt)
+			return -ENODEV;
+
+		header = &mapped_rsdt->header;
+
+		for (i = 0; i < sdt.count; i++)
+			sdt.entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
+	};
+	for (i = 0; i < sdt.count; i++) {
+
+		header = (struct acpi_table_header *)
+			__acpi_map_table(sdt.entry[i].pa,
+				sizeof(struct acpi_table_header));
+		if (!header)
+			continue;
+		if (!strncmp((char *) &header->signature, "OEM1", 4)) {
+			if (!strncmp((char *) &header->oem_id, "UNISYS", 6)) {
+				void *addr;
+				struct oem_table *t;
+				acpi_table_print(header, sdt.entry[i].pa);
+				t = (struct oem_table *) __acpi_map_table(sdt.entry[i].pa, header->length);
+				addr = (void *) __acpi_map_table(t->OEMTableAddr, t->OEMTableSize);
+				*length = header->length;
+				*oem_addr = (unsigned long) addr;
+				return 0;
+			}
+		}
+	}
+	printk("ES7000: did not find Unisys ACPI OEM table!\n");
+	return -1;
+}
+
+static void
+es7000_spin(int n)
+{
+	int i = 0;
+
+	while (i++ < n)
+		rep_nop();
+}
+
+static int __init
+es7000_mip_write(struct mip_reg *mip_reg)
+{
+	int			status = 0;
+	int			spin;
+
+	spin = MIP_SPIN;
+	while (((unsigned long long)host_reg->off_38 &
+		(unsigned long long)MIP_VALID) != 0) {
+			if (--spin <= 0) {
+				printk("es7000_mip_write: Timeout waiting for Host Valid Flag");
+				return -1;
+			}
+		es7000_spin(MIP_SPIN);
+	}
+
+	memcpy(host_reg, mip_reg, sizeof(struct mip_reg));
+	outb(1, mip_port);
+
+	spin = MIP_SPIN;
+
+	while (((unsigned long long)mip_reg->off_38 &
+		(unsigned long long)MIP_VALID) == 0) {
+		if (--spin <= 0) {
+			printk("es7000_mip_write: Timeout waiting for MIP Valid Flag");
+			return -1;
+		}
+		es7000_spin(MIP_SPIN);
+	}
+
+	status = ((unsigned long long)mip_reg->off_0 &
+		(unsigned long long)0xffff0000000000) >> 48;
+	mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 &
+		(unsigned long long)~MIP_VALID);
+	return status;
+}
+
+int
+es7000_start_cpu(int cpu, unsigned long eip)
+{
+	unsigned long vect = 0, psaival = 0;
+
+	if (psai == NULL)
+		return -1;
+
+	vect = ((unsigned long)__pa(eip)/0x1000) << 16;
+	psaival = (0x1000000 | vect | cpu);
+
+	while (*psai & 0x1000000)
+                ;
+
+	*psai = psaival;
+
+	return 0;
+
+}
+
+int
+es7000_stop_cpu(int cpu)
+{
+	int startup;
+
+	if (psai == NULL)
+		return -1;
+
+	startup= (0x1000000 | cpu);
+
+	while ((*psai & 0xff00ffff) != startup)
+		;
+
+	startup = (*psai & 0xff0000) >> 16;
+	*psai &= 0xffffff;
+
+	return 0;
+
+}
+
+void __init
+es7000_sw_apic()
+{
+	if (es7000_plat) {
+		int mip_status;
+		struct mip_reg es7000_mip_reg;
+
+		printk("ES7000: Enabling APIC mode.\n");
+        	memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
+        	es7000_mip_reg.off_0 = MIP_SW_APIC;
+        	es7000_mip_reg.off_38 = (MIP_VALID);
+        	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
+              		printk("es7000_sw_apic: command failed, status = %x\n",
+				mip_status);
+		return;
+	}
+}
diff -Nru a/arch/i386/mach-es7000/setup.c b/arch/i386/mach-es7000/setup.c
--- a/arch/i386/mach-es7000/setup.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,106 +0,0 @@
-/*
- *	Machine specific setup for es7000
- */
-
-#include <linux/config.h>
-#include <linux/smp.h>
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <linux/interrupt.h>
-#include <asm/acpi.h>
-#include <asm/arch_hooks.h>
-
-/**
- * pre_intr_init_hook - initialisation prior to setting up interrupt vectors
- *
- * Description:
- *	Perform any necessary interrupt initialisation prior to setting up
- *	the "ordinary" interrupt call gates.  For legacy reasons, the ISA
- *	interrupts should be initialised here if the machine emulates a PC
- *	in any way.
- **/void __init pre_intr_init_hook(void)
-{
-	init_ISA_irqs();
-}
-
-/*
- * IRQ2 is cascade interrupt to second interrupt controller
- */
-static struct irqaction irq2 = { no_action, 0, 0, "cascade", NULL, NULL};
-
-/**
- * intr_init_hook - post gate setup interrupt initialisation
- *
- * Description:
- *	Fill in any interrupts that may have been left out by the general
- *	init_IRQ() routine.  interrupts having to do with the machine rather
- *	than the devices on the I/O bus (like APIC interrupts in intel MP
- *	systems) are started here.
- **/
-void __init intr_init_hook(void)
-{
-#ifdef CONFIG_X86_LOCAL_APIC
-	apic_intr_init();
-#endif
-
-	if (!acpi_ioapic)
-		setup_irq(2, &irq2);
-}
-
-/**
- * pre_setup_arch_hook - hook called prior to any setup_arch() execution
- *
- * Description:
- *	generally used to activate any machine specific identification
- *	routines that may be needed before setup_arch() runs.  On VISWS
- *	this is used to get the board revision and type.
- **/
-void __init pre_setup_arch_hook(void)
-{
-}
-
-/**
- * trap_init_hook - initialise system specific traps
- *
- * Description:
- *	Called as the final act of trap_init().  Used in VISWS to initialise
- *	the various board specific APIC traps.
- **/
-void __init trap_init_hook(void)
-{
-}
-
-static struct irqaction irq0  = { timer_interrupt, SA_INTERRUPT, 0, "timer", NULL, NULL};
-
-/**
- * time_init_hook - do any specific initialisations for the system timer.
- *
- * Description:
- *	Must plug the system timer interrupt source at HZ into the IRQ listed
- *	in irq_vectors.h:TIMER_IRQ
- **/
-void __init time_init_hook(void)
-{
-	setup_irq(0, &irq0);
-}
-
-#ifdef CONFIG_MCA
-/**
- * mca_nmi_hook - hook into MCA specific NMI chain
- *
- * Description:
- *	The MCA (Microchannel Arcitecture) has an NMI chain for NMI sources
- *	along the MCA bus.  Use this to hook into that chain if you will need
- *	it.
- **/
-void __init mca_nmi_hook(void)
-{
-	/* If I recall correctly, there's a whole bunch of other things that
-	 * we can do to check for NMI problems, but that's all I know about
-	 * at the moment.
-	 */
-
-	printk("NMI generated from unknown source!\n");
-}
-
-#endif
diff -Nru a/arch/i386/mach-es7000/topology.c b/arch/i386/mach-es7000/topology.c
--- a/arch/i386/mach-es7000/topology.c	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,64 +0,0 @@
-/*
- * arch/i386/mach-generic/topology.c - Populate driverfs with topology information
- *
- * Written by: Matthew Dobson, IBM Corporation
- * Original Code: Paul Dorwin, IBM Corporation, Patrick Mochel, OSDL
- *
- * Copyright (C) 2002, IBM Corp.
- *
- * All rights reserved.          
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Send feedback to <colpatch@us.ibm.com>
- */
-#include <linux/init.h>
-#include <linux/smp.h>
-#include <asm/cpu.h>
-
-struct i386_cpu cpu_devices[NR_CPUS];
-
-#ifdef CONFIG_NUMA
-#include <linux/mmzone.h>
-#include <asm/node.h>
-
-struct i386_node node_devices[MAX_NUMNODES];
-
-static int __init topology_init(void)
-{
-	int i;
-
-	for (i = 0; i < num_online_nodes(); i++)
-		arch_register_node(i);
-	for (i = 0; i < NR_CPUS; i++)
-		if (cpu_possible(i)) arch_register_cpu(i);
-	return 0;
-}
-
-#else /* !CONFIG_NUMA */
-
-static int __init topology_init(void)
-{
-	int i;
-
-	for (i = 0; i < NR_CPUS; i++)
-		if (cpu_possible(i)) arch_register_cpu(i);
-	return 0;
-}
-
-#endif /* CONFIG_NUMA */
-
-subsys_initcall(topology_init);
diff -Nru a/arch/i386/mach-generic/Makefile b/arch/i386/mach-generic/Makefile
--- a/arch/i386/mach-generic/Makefile	Tue Jun 15 22:20:41 2004
+++ b/arch/i386/mach-generic/Makefile	Tue Jun 15 22:20:41 2004
@@ -4,15 +4,4 @@
 
 EXTRA_CFLAGS	+= -I../kernel
 
-obj-y				:= probe.o summit.o bigsmp.o default.o
-
-
-#
-# Makefile for the generic architecture
-#
-
-EXTRA_CFLAGS	+= -I../kernel
-
-obj-y				:= probe.o summit.o bigsmp.o default.o
-
-
+obj-y				:= probe.o summit.o bigsmp.o es7000.o default.o ../mach-es7000/
diff -Nru a/arch/i386/mach-generic/es7000.c b/arch/i386/mach-generic/es7000.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/i386/mach-generic/es7000.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,28 @@
+/*
+ * APIC driver for the Unisys ES7000 chipset.
+ */
+#define APIC_DEFINITION 1
+#include <linux/config.h>
+#include <linux/threads.h>
+#include <linux/cpumask.h>
+#include <asm/mpspec.h>
+#include <asm/genapic.h>
+#include <asm/fixmap.h>
+#include <asm/apicdef.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/smp.h>
+#include <linux/init.h>
+#include <asm/mach-es7000/mach_apicdef.h>
+#include <asm/mach-es7000/mach_apic.h>
+#include <asm/mach-es7000/mach_ipi.h>
+#include <asm/mach-es7000/mach_mpparse.h>
+#include <asm/mach-es7000/mach_wakecpu.h>
+
+static __init int probe_es7000(void)
+{
+	/* probed later in mptable/ACPI hooks */
+	return 0;
+}
+
+struct genapic apic_es7000 = APIC_INIT("es7000", probe_es7000);
diff -Nru a/arch/i386/mach-generic/probe.c b/arch/i386/mach-generic/probe.c
--- a/arch/i386/mach-generic/probe.c	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/mach-generic/probe.c	Tue Jun 15 22:20:36 2004
@@ -17,6 +17,7 @@
 
 extern struct genapic apic_summit;
 extern struct genapic apic_bigsmp;
+extern struct genapic apic_es7000;
 extern struct genapic apic_default;
 
 struct genapic *genapic = &apic_default;
@@ -24,6 +25,7 @@
 struct genapic *apic_probe[] __initdata = { 
 	&apic_summit,
 	&apic_bigsmp, 
+	&apic_es7000,
 	&apic_default,	/* must be last */
 	NULL,
 };
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	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/mach-voyager/voyager_smp.c	Tue Jun 15 22:20:39 2004
@@ -1106,6 +1106,9 @@
 	if (!mask)
 		return 0;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data.func = func;
 	data.info = info;
 	data.started = mask;
diff -Nru a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
--- a/arch/i386/mm/fault.c	Tue Jun 15 22:20:35 2004
+++ b/arch/i386/mm/fault.c	Tue Jun 15 22:20:35 2004
@@ -411,7 +411,7 @@
 	else
 		printk(KERN_ALERT "Unable to handle kernel paging request");
 	printk(" at virtual address %08lx\n",address);
-	printk(" printing eip:\n");
+	printk(KERN_ALERT " printing eip:\n");
 	printk("%08lx\n", regs->eip);
 	asm("movl %%cr3,%0":"=r" (page));
 	page = ((unsigned long *) __va(page))[address >> 22];
diff -Nru a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c
--- a/arch/i386/mm/hugetlbpage.c	Tue Jun 15 22:21:02 2004
+++ b/arch/i386/mm/hugetlbpage.c	Tue Jun 15 22:21:02 2004
@@ -264,8 +264,9 @@
 				goto out;
 			}
 			ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
-			unlock_page(page);
-			if (ret) {
+			if (! ret) {
+				unlock_page(page);
+			} else {
 				hugetlb_put_quota(mapping);
 				free_huge_page(page);
 				goto out;
diff -Nru a/arch/i386/mm/init.c b/arch/i386/mm/init.c
--- a/arch/i386/mm/init.c	Tue Jun 15 22:20:43 2004
+++ b/arch/i386/mm/init.c	Tue Jun 15 22:20:43 2004
@@ -328,9 +328,30 @@
 #endif
 }
 
+#if defined(CONFIG_PM_DISK) || defined(CONFIG_SOFTWARE_SUSPEND)
+/*
+ * Swap suspend & friends need this for resume because things like the intel-agp
+ * driver might have split up a kernel 4MB mapping.
+ */
+char __nosavedata swsusp_pg_dir[PAGE_SIZE]
+	__attribute__ ((aligned (PAGE_SIZE)));
+
+static inline void save_pg_dir(void)
+{
+	memcpy(swsusp_pg_dir, swapper_pg_dir, PAGE_SIZE);
+}
+#else
+static inline void save_pg_dir(void)
+{
+}
+#endif
+
 void zap_low_mappings (void)
 {
 	int i;
+
+	save_pg_dir();
+
 	/*
 	 * Zap initial low-memory mappings.
 	 *
diff -Nru a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
--- a/arch/i386/mm/pageattr.c	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/mm/pageattr.c	Tue Jun 15 22:20:39 2004
@@ -121,20 +121,20 @@
 			pte_t standard = mk_pte(page, PAGE_KERNEL); 
 			set_pte_atomic(kpte, mk_pte(page, prot)); 
 			if (pte_same(old,standard))
-				atomic_inc(&kpte_page->count);
+				get_page(kpte_page);
 		} else {
 			struct page *split = split_large_page(address, prot); 
 			if (!split)
 				return -ENOMEM;
-			atomic_inc(&kpte_page->count);
+			get_page(kpte_page);
 			set_pmd_pte(kpte,address,mk_pte(split, PAGE_KERNEL));
 		}	
 	} else if ((pte_val(*kpte) & _PAGE_PSE) == 0) { 
 		set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL));
-		atomic_dec(&kpte_page->count); 
+		__put_page(kpte_page);
 	}
 
-	if (cpu_has_pse && (atomic_read(&kpte_page->count) == 1)) { 
+	if (cpu_has_pse && (page_count(kpte_page) == 1)) {
 		list_add(&kpte_page->lru, &df_list);
 		revert_page(kpte_page, address);
 	} 
diff -Nru a/arch/i386/oprofile/op_model_p4.c b/arch/i386/oprofile/op_model_p4.c
--- a/arch/i386/oprofile/op_model_p4.c	Tue Jun 15 22:20:36 2004
+++ b/arch/i386/oprofile/op_model_p4.c	Tue Jun 15 22:20:36 2004
@@ -382,11 +382,8 @@
 static unsigned int get_stagger(void)
 {
 #ifdef CONFIG_SMP
-	int cpu;
-	if (smp_num_siblings > 1) {
-		cpu = smp_processor_id();
-		return (cpu_sibling_map[cpu] > cpu) ? 0 : 1;
-	}
+	int cpu = smp_processor_id();
+	return (cpu != first_cpu(cpu_sibling_map[cpu]));
 #endif	
 	return 0;
 }
diff -Nru a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
--- a/arch/i386/pci/fixup.c	Tue Jun 15 22:20:42 2004
+++ b/arch/i386/pci/fixup.c	Tue Jun 15 22:20:42 2004
@@ -92,6 +92,15 @@
 	int i;
 
 	/*
+	 * Runs the fixup only for the first IDE controller
+	 * (Shai Fultheim - shai@ftcon.com)
+	 */
+	static int called = 0;
+	if (called)
+		return;
+	called = 1;
+
+	/*
 	 * There exist PCI IDE controllers which have utter garbage
 	 * in first four base registers. Ignore that.
 	 */
@@ -217,7 +226,12 @@
 	fixed_val = rev < 0xC1 ? 0x1F01FF01 : 0x9F01FF01;
 
 	pci_read_config_dword(dev, 0x6c, &val);
-	if (val != fixed_val) {
+
+	/*
+	 * Apply fixup only if C1 Halt Disconnect is enabled
+	 * (bit28) because it is not supported on some boards.
+	 */
+	if ((val & (1 << 28)) && val != fixed_val) {
 		printk(KERN_WARNING "PCI: nForce2 C1 Halt Disconnect fixup\n");
 		pci_write_config_dword(dev, 0x6c, fixed_val);
 	}
diff -Nru a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
--- a/arch/i386/pci/irq.c	Tue Jun 15 22:21:05 2004
+++ b/arch/i386/pci/irq.c	Tue Jun 15 22:21:05 2004
@@ -476,8 +476,9 @@
 		case PCI_DEVICE_ID_INTEL_82801DB_0:
 		case PCI_DEVICE_ID_INTEL_82801E_0:
 		case PCI_DEVICE_ID_INTEL_82801EB_0:
-		case PCI_DEVICE_ID_INTEL_ESB_0:
+		case PCI_DEVICE_ID_INTEL_ESB_1:
 		case PCI_DEVICE_ID_INTEL_ICH6_0:
+		case PCI_DEVICE_ID_INTEL_ICH6_1:
 			r->name = "PIIX/ICH";
 			r->get = pirq_piix_get;
 			r->set = pirq_piix_set;
@@ -540,8 +541,6 @@
 	r->name = "SIS";
 	r->get = pirq_sis_get;
 	r->set = pirq_sis_set;
-	DBG("PCI: Detecting SiS router at %02x:%02x\n",
-	    rt->rtr_bus, rt->rtr_devfn);
 	return 1;
 }
 
@@ -898,7 +897,7 @@
 {
 	DBG("PCI: IRQ init\n");
 
-	if (pcibios_enable_irq)
+	if (pcibios_enable_irq || raw_pci_ops == NULL)
 		return 0;
 
 	pirq_table = pirq_find_routing_table();
diff -Nru a/arch/i386/power/pmdisk.S b/arch/i386/power/pmdisk.S
--- a/arch/i386/power/pmdisk.S	Tue Jun 15 22:20:41 2004
+++ b/arch/i386/power/pmdisk.S	Tue Jun 15 22:20:41 2004
@@ -21,7 +21,7 @@
 	jmp .L1449
 	.p2align 4,,7
 .L1450:
-	movl $swapper_pg_dir-__PAGE_OFFSET,%ecx
+	movl $swsusp_pg_dir-__PAGE_OFFSET,%ecx
 	movl %ecx,%cr3
 
 	movl	pm_pagedir_nosave,%ebx
diff -Nru a/arch/i386/power/swsusp.S b/arch/i386/power/swsusp.S
--- a/arch/i386/power/swsusp.S	Tue Jun 15 22:20:39 2004
+++ b/arch/i386/power/swsusp.S	Tue Jun 15 22:20:39 2004
@@ -36,7 +36,7 @@
 	jmp .L1449
 	.p2align 4,,7
 .L1450:
-	movl $swapper_pg_dir-__PAGE_OFFSET,%ecx
+	movl $swsusp_pg_dir-__PAGE_OFFSET,%ecx
 	movl %ecx,%cr3
 
 	call do_magic_resume_1
diff -Nru a/arch/ia64/Kconfig b/arch/ia64/Kconfig
--- a/arch/ia64/Kconfig	Tue Jun 15 22:21:03 2004
+++ b/arch/ia64/Kconfig	Tue Jun 15 22:21:03 2004
@@ -244,6 +244,15 @@
 	  than 64 will cause the use of a CPU mask array, causing a small
 	  performance hit.
 
+config HOTPLUG_CPU
+    bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
+    depends on SMP && HOTPLUG && EXPERIMENTAL
+	default n
+    ---help---
+      Say Y here to experiment with turning CPUs off and on.  CPUs
+      can be controlled through /sys/devices/system/cpu/cpu#.
+      Say N if you want to disable CPU hotplug.
+
 config PREEMPT
 	bool "Preemptible Kernel"
         help
diff -Nru a/arch/ia64/configs/sim_defconfig b/arch/ia64/configs/sim_defconfig
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ia64/configs/sim_defconfig	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,535 @@
+#
+# Automatically generated make config: don't edit
+#
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+# CONFIG_CLEAN_COMPILE is not set
+# CONFIG_STANDALONE is not set
+CONFIG_BROKEN=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=16
+# CONFIG_HOTPLUG is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+# CONFIG_EMBEDDED is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_OBSOLETE_MODPARM=y
+CONFIG_MODVERSIONS=y
+CONFIG_KMOD=y
+CONFIG_STOP_MACHINE=y
+
+#
+# Processor type and features
+#
+CONFIG_IA64=y
+CONFIG_64BIT=y
+CONFIG_MMU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_TIME_INTERPOLATION=y
+CONFIG_EFI=y
+# CONFIG_IA64_GENERIC is not set
+# CONFIG_IA64_DIG is not set
+# CONFIG_IA64_HP_ZX1 is not set
+# CONFIG_IA64_SGI_SN2 is not set
+CONFIG_IA64_HP_SIM=y
+# CONFIG_ITANIUM is not set
+CONFIG_MCKINLEY=y
+# CONFIG_IA64_PAGE_SIZE_4KB is not set
+# CONFIG_IA64_PAGE_SIZE_8KB is not set
+# CONFIG_IA64_PAGE_SIZE_16KB is not set
+CONFIG_IA64_PAGE_SIZE_64KB=y
+CONFIG_IA64_L1_CACHE_SHIFT=7
+# CONFIG_MCKINLEY_ASTEP_SPECIFIC is not set
+# CONFIG_VIRTUAL_MEM_MAP is not set
+# CONFIG_IA64_CYCLONE is not set
+CONFIG_FORCE_MAX_ZONEORDER=18
+CONFIG_SMP=y
+CONFIG_NR_CPUS=64
+CONFIG_PREEMPT=y
+CONFIG_HAVE_DEC_LOCK=y
+CONFIG_IA32_SUPPORT=y
+CONFIG_COMPAT=y
+# CONFIG_PERFMON is not set
+CONFIG_IA64_PALINFO=m
+
+#
+# Firmware Drivers
+#
+CONFIG_EFI_VARS=y
+# CONFIG_SMBIOS is not set
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_MISC=y
+
+#
+# Power management and ACPI
+#
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+# CONFIG_DEBUG_DRIVER is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+# CONFIG_MTD is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+CONFIG_BLK_DEV_LOOP=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_INITRD is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI=y
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+# CONFIG_CHR_DEV_SG is not set
+
+#
+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
+#
+CONFIG_SCSI_MULTI_LUN=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_LOGGING=y
+
+#
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
+# SCSI low-level drivers
+#
+# CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_SATA is not set
+# CONFIG_SCSI_EATA_PIO is not set
+# CONFIG_SCSI_DEBUG is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# I2O device support
+#
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+# CONFIG_NETLINK_DEV is not set
+# CONFIG_UNIX is not set
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+# CONFIG_IP_PNP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_NET_FASTROUTE is not set
+# CONFIG_NET_HW_FLOWCONTROL is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_NETDEVICES is not set
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_CT82C710 is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_UNIX98_PTYS=y
+# CONFIG_LEGACY_PTYS is not set
+# CONFIG_QIC02_TAPE is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+CONFIG_EFI_RTC=y
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_FTAPE is not set
+# CONFIG_AGP is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+# CONFIG_MDA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_FS_XATTR is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_FAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+# CONFIG_TMPFS is not set
+CONFIG_HUGETLBFS=y
+CONFIG_HUGETLB_PAGE=y
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=y
+# CONFIG_NFS_V3 is not set
+# CONFIG_NFS_V4 is not set
+CONFIG_NFS_DIRECTIO=y
+CONFIG_NFSD=y
+CONFIG_NFSD_V3=y
+# CONFIG_NFSD_V4 is not set
+# CONFIG_NFSD_TCP is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_NEC98_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+CONFIG_EFI_PARTITION=y
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# Library routines
+#
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+
+#
+# HP Simulator drivers
+#
+CONFIG_HP_SIMETH=y
+CONFIG_HP_SIMSERIAL=y
+CONFIG_HP_SIMSERIAL_CONSOLE=y
+CONFIG_HP_SIMSCSI=y
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_IA64_GRANULE_16MB is not set
+CONFIG_IA64_GRANULE_64MB=y
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_IA64_PRINT_HAZARDS is not set
+# CONFIG_DISABLE_VHPT is not set
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_IA64_DEBUG_CMPXCHG is not set
+# CONFIG_IA64_DEBUG_IRQ is not set
+CONFIG_DEBUG_INFO=y
+CONFIG_SYSVIPC_COMPAT=y
+
+#
+# Security options
+#
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
diff -Nru a/arch/ia64/defconfig b/arch/ia64/defconfig
--- a/arch/ia64/defconfig	Tue Jun 15 22:20:36 2004
+++ b/arch/ia64/defconfig	Tue Jun 15 22:20:36 2004
@@ -16,8 +16,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=16
 CONFIG_HOTPLUG=y
 CONFIG_IKCONFIG=y
@@ -29,6 +31,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -69,7 +72,6 @@
 # CONFIG_IA64_CYCLONE is not set
 CONFIG_IOSAPIC=y
 CONFIG_FORCE_MAX_ZONEORDER=18
-# CONFIG_IA64_PAL_IDLE is not set
 CONFIG_SMP=y
 CONFIG_NR_CPUS=16
 # CONFIG_PREEMPT is not set
@@ -78,6 +80,10 @@
 CONFIG_COMPAT=y
 CONFIG_PERFMON=y
 CONFIG_IA64_PALINFO=y
+
+#
+# Firmware Drivers
+#
 CONFIG_EFI_VARS=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=y
@@ -87,13 +93,12 @@
 #
 CONFIG_PM=y
 CONFIG_ACPI=y
-CONFIG_ACPI_INTERPRETER=y
-CONFIG_ACPI_KERNEL_CONFIG=y
 
 #
 # ACPI (Advanced Configuration and Power Interface) Support
 #
 CONFIG_ACPI_BOOT=y
+CONFIG_ACPI_INTERPRETER=y
 CONFIG_ACPI_BUTTON=y
 CONFIG_ACPI_FAN=y
 CONFIG_ACPI_PROCESSOR=y
@@ -109,6 +114,7 @@
 #
 CONFIG_PCI=y
 CONFIG_PCI_DOMAINS=y
+# CONFIG_PCI_USE_VECTOR is not set
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
 
@@ -149,7 +155,6 @@
 #
 # 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
@@ -345,7 +350,6 @@
 # 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
@@ -356,8 +360,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -376,10 +378,11 @@
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -400,16 +403,21 @@
 # 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=y
+CONFIG_BONDING=y
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-CONFIG_DUMMY=y
-CONFIG_BONDING=y
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
 
 #
 # Ethernet (10 or 100Mbit)
@@ -456,7 +464,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 CONFIG_TIGON3=y
 
@@ -464,45 +471,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -577,11 +568,6 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -594,7 +580,6 @@
 #
 # CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_GEN_RTC is not set
 CONFIG_EFI_RTC=y
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
@@ -631,6 +616,7 @@
 # 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
@@ -674,6 +660,8 @@
 # Other I2C Chip support
 #
 # CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
@@ -704,7 +692,7 @@
 CONFIG_FB_RIVA=m
 # CONFIG_FB_MATROX is not set
 # CONFIG_FB_RADEON_OLD is not set
-CONFIG_FB_RADEON=y
+CONFIG_FB_RADEON=m
 CONFIG_FB_RADEON_I2C=y
 # CONFIG_FB_RADEON_DEBUG is not set
 # CONFIG_FB_ATY128 is not set
@@ -837,6 +825,8 @@
 # USB Host Controller Drivers
 #
 CONFIG_USB_EHCI_HCD=y
+# CONFIG_USB_EHCI_SPLIT_ISO is not set
+CONFIG_USB_EHCI_ROOT_HUB_TT=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_UHCI_HCD=y
 
@@ -861,7 +851,9 @@
 # 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_XPAD is not set
+# CONFIG_USB_ATI_REMOTE is not set
 
 #
 # USB Imaging devices
@@ -908,6 +900,7 @@
 # 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_TEST is not set
 
 #
@@ -959,6 +952,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
@@ -1075,6 +1069,7 @@
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 
 #
 # Profiling support
@@ -1090,6 +1085,7 @@
 CONFIG_IA64_PRINT_HAZARDS=y
 CONFIG_DISABLE_VHPT=y
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_IA64_EARLY_PRINTK_VGA is not set
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
@@ -1123,4 +1119,6 @@
 # CONFIG_CRYPTO_CAST6 is not set
 # CONFIG_CRYPTO_ARC4 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
diff -Nru a/arch/ia64/dig/Makefile b/arch/ia64/dig/Makefile
--- a/arch/ia64/dig/Makefile	Tue Jun 15 22:20:43 2004
+++ b/arch/ia64/dig/Makefile	Tue Jun 15 22:20:43 2004
@@ -6,4 +6,9 @@
 #
 
 obj-y := setup.o
+
+ifndef CONFIG_NUMA
+obj-$(CONFIG_IA64_DIG) += topology.o
+endif
+
 obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff -Nru a/arch/ia64/dig/topology.c b/arch/ia64/dig/topology.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ia64/dig/topology.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,43 @@
+/*
+ * arch/ia64/dig/topology.c
+ *	Popuate driverfs with topology information.
+ *	Derived entirely from i386/mach-default.c
+ *  Intel Corporation - Ashok Raj
+ */
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/cpumask.h>
+#include <linux/percpu.h>
+#include <linux/notifier.h>
+#include <linux/cpu.h>
+#include <asm/cpu.h>
+
+static DEFINE_PER_CPU(struct ia64_cpu, cpu_devices);
+
+/*
+ * First Pass: simply borrowed code for now. Later should hook into
+ * hotplug notification for node/cpu/memory as applicable
+ */
+
+static int arch_register_cpu(int num)
+{
+	struct node *parent = NULL;
+
+#ifdef CONFIG_NUMA
+	//parent = &node_devices[cpu_to_node(num)].node;
+#endif
+
+	return register_cpu(&per_cpu(cpu_devices,num).cpu, num, parent);
+}
+
+static int __init topology_init(void)
+{
+    int i;
+
+    for_each_cpu(i) {
+        arch_register_cpu(i);
+	}
+    return 0;
+}
+
+subsys_initcall(topology_init);
diff -Nru a/arch/ia64/hp/sim/boot/boot_head.S b/arch/ia64/hp/sim/boot/boot_head.S
--- a/arch/ia64/hp/sim/boot/boot_head.S	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/hp/sim/boot/boot_head.S	Tue Jun 15 22:20:40 2004
@@ -105,37 +105,37 @@
 1:	cmp.eq p6,p7=15,r28		/* PAL_PERF_MON_INFO */
 (p7)	br.cond.sptk.few 1f
 	mov r8=0			/* status = 0 */
-	movl r9 =0x12082004		/* generic=4 width=32 retired=8 cycles=18 */
+	movl r9 =0x08122f04		/* generic=4 width=47 retired=8 cycles=18 */
 	mov r10=0			/* reserved */
 	mov r11=0			/* reserved */
 	mov r16=0xffff			/* implemented PMC */
-	mov r17=0xffff			/* implemented PMD */
+	mov r17=0x3ffff			/* implemented PMD */
 	add r18=8,r29			/* second index */
 	;;
 	st8 [r29]=r16,16		/* store implemented PMC */
 	st8 [r18]=r0,16			/* clear remaining bits  */
 	;;
-	st8 [r29]=r0,16			/* store implemented PMC */
+	st8 [r29]=r0,16			/* clear remaining bits  */
 	st8 [r18]=r0,16			/* clear remaining bits  */
 	;;
 	st8 [r29]=r17,16		/* store implemented PMD */
 	st8 [r18]=r0,16			/* clear remaining bits  */
 	mov r16=0xf0			/* cycles count capable PMC */
 	;;
-	st8 [r29]=r0,16			/* store implemented PMC */
+	st8 [r29]=r0,16			/* clear remaining bits  */
 	st8 [r18]=r0,16			/* clear remaining bits  */
-	mov r17=0x10			/* retired bundles capable PMC */
+	mov r17=0xf0			/* retired bundles capable PMC */
 	;;
 	st8 [r29]=r16,16		/* store cycles capable */
 	st8 [r18]=r0,16			/* clear remaining bits  */
 	;;
-	st8 [r29]=r0,16			/* store implemented PMC */
+	st8 [r29]=r0,16			/* clear remaining bits  */
 	st8 [r18]=r0,16			/* clear remaining bits  */
 	;;
 	st8 [r29]=r17,16		/* store retired bundle capable */
 	st8 [r18]=r0,16			/* clear remaining bits  */
 	;;
-	st8 [r29]=r0,16			/* store implemented PMC */
+	st8 [r29]=r0,16			/* clear remaining bits  */
 	st8 [r18]=r0,16			/* clear remaining bits  */
 	;;
 1:	br.cond.sptk.few rp
diff -Nru a/arch/ia64/ia32/Makefile b/arch/ia64/ia32/Makefile
--- a/arch/ia64/ia32/Makefile	Tue Jun 15 22:20:42 2004
+++ b/arch/ia64/ia32/Makefile	Tue Jun 15 22:20:42 2004
@@ -6,3 +6,7 @@
 	 ia32_support.o ia32_traps.o binfmt_elf32.o ia32_ldt.o
 
 CFLAGS_ia32_ioctl.o += -Ifs/
+
+# Don't let GCC uses f16-f31 so that save_ia32_fpstate_live() and
+# restore_ia32_fpstate_live() can be sure the live register contain user-level state.
+CFLAGS_ia32_signal.o += -mfixed-range=f16-f31
diff -Nru a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
--- a/arch/ia64/ia32/binfmt_elf32.c	Tue Jun 15 22:21:02 2004
+++ b/arch/ia64/ia32/binfmt_elf32.c	Tue Jun 15 22:21:02 2004
@@ -73,15 +73,13 @@
 	 */
 	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 	if (vma) {
+		memset(vma, 0, sizeof(*vma));
 		vma->vm_mm = current->mm;
 		vma->vm_start = IA32_GDT_OFFSET;
 		vma->vm_end = vma->vm_start + PAGE_SIZE;
 		vma->vm_page_prot = PAGE_SHARED;
-		vma->vm_flags = VM_READ|VM_MAYREAD;
+		vma->vm_flags = VM_READ|VM_MAYREAD|VM_RESERVED;
 		vma->vm_ops = &ia32_shared_page_vm_ops;
-		vma->vm_pgoff = 0;
-		vma->vm_file = NULL;
-		vma->vm_private_data = NULL;
 		down_write(&current->mm->mmap_sem);
 		{
 			insert_vm_struct(current->mm, vma);
@@ -95,15 +93,12 @@
 	 */
 	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 	if (vma) {
+		memset(vma, 0, sizeof(*vma));
 		vma->vm_mm = current->mm;
 		vma->vm_start = IA32_LDT_OFFSET;
 		vma->vm_end = vma->vm_start + PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE);
 		vma->vm_page_prot = PAGE_SHARED;
 		vma->vm_flags = VM_READ|VM_WRITE|VM_MAYREAD|VM_MAYWRITE;
-		vma->vm_ops = NULL;
-		vma->vm_pgoff = 0;
-		vma->vm_file = NULL;
-		vma->vm_private_data = NULL;
 		down_write(&current->mm->mmap_sem);
 		{
 			insert_vm_struct(current->mm, vma);
@@ -173,6 +168,8 @@
 		return -ENOMEM;
 	}
 
+	memset(mpnt, 0, sizeof(*mpnt));
+
 	down_write(&current->mm->mmap_sem);
 	{
 		mpnt->vm_mm = current->mm;
@@ -186,10 +183,6 @@
 			mpnt->vm_flags = VM_STACK_FLAGS;
 		mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC)?
 					PAGE_COPY_EXEC: PAGE_COPY;
-		mpnt->vm_ops = NULL;
-		mpnt->vm_pgoff = 0;
-		mpnt->vm_file = NULL;
-		mpnt->vm_private_data = 0;
 		insert_vm_struct(current->mm, mpnt);
 		current->mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
 	}
@@ -198,7 +191,7 @@
 		struct page *page = bprm->page[i];
 		if (page) {
 			bprm->page[i] = NULL;
-			put_dirty_page(current, page, stack_base, mpnt->vm_page_prot);
+			install_arg_page(mpnt, page, stack_base);
 		}
 		stack_base += PAGE_SIZE;
 	}
@@ -225,3 +218,16 @@
 	return ia32_do_mmap(filep, (addr & IA32_PAGE_MASK), eppnt->p_filesz + pgoff, prot, type,
 			    eppnt->p_offset - pgoff);
 }
+
+#define cpu_uses_ia32el()	(local_cpu_data->family > 0x1f)
+
+static int __init check_elf32_binfmt(void)
+{
+	if (cpu_uses_ia32el()) {
+		printk("Please use IA-32 EL for executing IA-32 binaries\n");
+		return unregister_binfmt(&elf_format);
+	}
+	return 0;
+}
+
+module_init(check_elf32_binfmt)
diff -Nru a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
--- a/arch/ia64/ia32/ia32_entry.S	Tue Jun 15 22:20:41 2004
+++ b/arch/ia64/ia32/ia32_entry.S	Tue Jun 15 22:20:41 2004
@@ -350,11 +350,11 @@
 	data8 sys_setfsgid	/* 16-bit version */
 	data8 sys_llseek	  /* 140 */
 	data8 sys32_getdents
-	data8 sys32_select
+	data8 compat_sys_select
 	data8 sys_flock
 	data8 sys32_msync
-	data8 sys32_readv	  /* 145 */
-	data8 sys32_writev
+	data8 compat_sys_readv	  /* 145 */
+	data8 compat_sys_writev
 	data8 sys_getsid
 	data8 sys_fdatasync
 	data8 sys32_sysctl
diff -Nru a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c
--- a/arch/ia64/ia32/ia32_signal.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ia64/ia32/ia32_signal.c	Tue Jun 15 22:20:36 2004
@@ -43,22 +43,6 @@
 #define __IA32_NR_sigreturn            119
 #define __IA32_NR_rt_sigreturn         173
 
-#ifdef ASM_SUPPORTED
-/*
- * Don't let GCC uses f16-f31 so that save_ia32_fpstate_live() and
- * restore_ia32_fpstate_live() can be sure the live register contain user-level state.
- */
-register double f16 asm ("f16"); register double f17 asm ("f17");
-register double f18 asm ("f18"); register double f19 asm ("f19");
-register double f20 asm ("f20"); register double f21 asm ("f21");
-register double f22 asm ("f22"); register double f23 asm ("f23");
-
-register double f24 asm ("f24"); register double f25 asm ("f25");
-register double f26 asm ("f26"); register double f27 asm ("f27");
-register double f28 asm ("f28"); register double f29 asm ("f29");
-register double f30 asm ("f30"); register double f31 asm ("f31");
-#endif
-
 struct sigframe_ia32
 {
        int pretcode;
@@ -173,7 +157,8 @@
 		case __SI_MESGQ >> 16:
 			err |= __put_user(from->si_uid, &to->si_uid);
 			err |= __put_user(from->si_pid, &to->si_pid);
-			err |= __put_user(from->si_ptr, &to->si_ptr);
+			addr = (unsigned long) from->si_ptr;
+			err |= __put_user(addr, &to->si_ptr);
 			break;
 		}
 	}
diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
--- a/arch/ia64/ia32/sys_ia32.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ia64/ia32/sys_ia32.c	Tue Jun 15 22:20:41 2004
@@ -90,58 +90,17 @@
 /* XXX make per-mm: */
 static DECLARE_MUTEX(ia32_mmap_sem);
 
-static int
-nargs (unsigned int arg, char **ap)
-{
-	unsigned int addr;
-	int n, err;
-
-	if (!arg)
-		return 0;
-
-	n = 0;
-	do {
-		err = get_user(addr, (unsigned int *)A(arg));
-		if (err)
-			return err;
-		if (ap)
-			*ap++ = (char *) A(addr);
-		arg += sizeof(unsigned int);
-		n++;
-	} while (addr);
-	return n - 1;
-}
-
 asmlinkage long
-sys32_execve (char *filename, unsigned int argv, unsigned int envp,
-	      struct pt_regs *regs)
+sys32_execve (char *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp, struct pt_regs *regs)
 {
+	long error;
+	char *filename;
 	unsigned long old_map_base, old_task_size, tssd;
-	char **av, **ae;
-	int na, ne, len;
-	long r;
-
-	na = nargs(argv, NULL);
-	if (na < 0)
-		return na;
-	ne = nargs(envp, NULL);
-	if (ne < 0)
-		return ne;
-	len = (na + ne + 2) * sizeof(*av);
-	av = kmalloc(len, GFP_KERNEL);
-	if (!av)
-		return -ENOMEM;
 
-	ae = av + na + 1;
-	av[na] = NULL;
-	ae[ne] = NULL;
-
-	r = nargs(argv, av);
-	if (r < 0)
-		goto out;
-	r = nargs(envp, ae);
-	if (r < 0)
-		goto out;
+	filename = getname(name);
+	error = PTR_ERR(filename);
+	if (IS_ERR(filename))
+		return error;
 
 	old_map_base  = current->thread.map_base;
 	old_task_size = current->thread.task_size;
@@ -153,19 +112,18 @@
 	ia64_set_kr(IA64_KR_IO_BASE, current->thread.old_iob);
 	ia64_set_kr(IA64_KR_TSSD, current->thread.old_k1);
 
-	set_fs(KERNEL_DS);
-	r = sys_execve(filename, av, ae, regs);
-	if (r < 0) {
+	error = compat_do_execve(filename, argv, envp, regs);
+	putname(filename);
+
+	if (error < 0) {
 		/* oops, execve failed, switch back to old values... */
 		ia64_set_kr(IA64_KR_IO_BASE, IA32_IOBASE);
 		ia64_set_kr(IA64_KR_TSSD, tssd);
 		current->thread.map_base  = old_map_base;
 		current->thread.task_size = old_task_size;
-		set_fs(USER_DS);	/* establish new task-size as the address-limit */
 	}
-  out:
-	kfree(av);
-	return r;
+
+	return error;
 }
 
 int cp_compat_stat(struct kstat *stat, struct compat_stat *ubuf)
@@ -818,110 +776,6 @@
 	return error;
 }
 
-/*
- * We can actually return ERESTARTSYS instead of EINTR, but I'd
- * like to be certain this leads to no problems. So I return
- * EINTR just for safety.
- *
- * Update: ERESTARTSYS breaks at least the xview clock binary, so
- * I'm trying ERESTARTNOHAND which restart only when you want to.
- */
-#define MAX_SELECT_SECONDS \
-	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-#define ROUND_UP_TIME(x,y) (((x)+(y)-1)/(y))
-
-asmlinkage long
-sys32_select (int n, fd_set *inp, fd_set *outp, fd_set *exp, struct compat_timeval *tvp32)
-{
-	fd_set_bits fds;
-	char *bits;
-	long timeout;
-	int ret, size;
-
-	timeout = MAX_SCHEDULE_TIMEOUT;
-	if (tvp32) {
-		time_t sec, usec;
-
-		ret = -EFAULT;
-		if (get_user(sec, &tvp32->tv_sec) || get_user(usec, &tvp32->tv_usec))
-			goto out_nofds;
-
-		ret = -EINVAL;
-		if (sec < 0 || usec < 0)
-			goto out_nofds;
-
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
-			timeout = ROUND_UP_TIME(usec, 1000000/HZ);
-			timeout += sec * (unsigned long) HZ;
-		}
-	}
-
-	ret = -EINVAL;
-	if (n < 0)
-		goto out_nofds;
-
-	if (n > current->files->max_fdset)
-		n = current->files->max_fdset;
-
-	/*
-	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
-	 * since we used fdset we need to allocate memory in units of
-	 * long-words.
-	 */
-	ret = -ENOMEM;
-	size = FDS_BYTES(n);
-	bits = kmalloc(6 * size, GFP_KERNEL);
-	if (!bits)
-		goto out_nofds;
-	fds.in      = (unsigned long *)  bits;
-	fds.out     = (unsigned long *) (bits +   size);
-	fds.ex      = (unsigned long *) (bits + 2*size);
-	fds.res_in  = (unsigned long *) (bits + 3*size);
-	fds.res_out = (unsigned long *) (bits + 4*size);
-	fds.res_ex  = (unsigned long *) (bits + 5*size);
-
-	if ((ret = get_fd_set(n, inp, fds.in)) ||
-	    (ret = get_fd_set(n, outp, fds.out)) ||
-	    (ret = get_fd_set(n, exp, fds.ex)))
-		goto out;
-	zero_fd_set(n, fds.res_in);
-	zero_fd_set(n, fds.res_out);
-	zero_fd_set(n, fds.res_ex);
-
-	ret = do_select(n, &fds, &timeout);
-
-	if (tvp32 && !(current->personality & STICKY_TIMEOUTS)) {
-		time_t sec = 0, usec = 0;
-		if (timeout) {
-			sec = timeout / HZ;
-			usec = timeout % HZ;
-			usec *= (1000000/HZ);
-		}
-		if (put_user(sec, &tvp32->tv_sec) || put_user(usec, &tvp32->tv_usec)) {
-			ret = -EFAULT;
-			goto out;
-		}
-	}
-
-	if (ret < 0)
-		goto out;
-	if (!ret) {
-		ret = -ERESTARTNOHAND;
-		if (signal_pending(current))
-			goto out;
-		ret = 0;
-	}
-
-	set_fd_set(n, inp, fds.res_in);
-	set_fd_set(n, outp, fds.res_out);
-	set_fd_set(n, exp, fds.res_ex);
-
-out:
-	kfree(bits);
-out_nofds:
-	return ret;
-}
-
 struct sel_arg_struct {
 	unsigned int n;
 	unsigned int inp;
@@ -937,87 +791,8 @@
 
 	if (copy_from_user(&a, arg, sizeof(a)))
 		return -EFAULT;
-	return sys32_select(a.n, (fd_set *) A(a.inp), (fd_set *) A(a.outp), (fd_set *) A(a.exp),
-			    (struct compat_timeval *) A(a.tvp));
-}
-
-static struct iovec *
-get_compat_iovec (struct compat_iovec *iov32, struct iovec *iov_buf, u32 count, int type)
-{
-	u32 i, buf, len;
-	struct iovec *ivp, *iov;
-
-	/* Get the "struct iovec" from user memory */
-
-	if (!count)
-		return 0;
-	if (verify_area(VERIFY_READ, iov32, sizeof(struct compat_iovec)*count))
-		return NULL;
-	if (count > UIO_MAXIOV)
-		return NULL;
-	if (count > UIO_FASTIOV) {
-		iov = kmalloc(count*sizeof(struct iovec), GFP_KERNEL);
-		if (!iov)
-			return NULL;
-	} else
-		iov = iov_buf;
-
-	ivp = iov;
-	for (i = 0; i < count; i++) {
-		if (__get_user(len, &iov32->iov_len) || __get_user(buf, &iov32->iov_base)) {
-			if (iov != iov_buf)
-				kfree(iov);
-			return NULL;
-		}
-		if (verify_area(type, (void *)A(buf), len)) {
-			if (iov != iov_buf)
-				kfree(iov);
-			return((struct iovec *)0);
-		}
-		ivp->iov_base = (void *)A(buf);
-		ivp->iov_len = (__kernel_size_t) len;
-		iov32++;
-		ivp++;
-	}
-	return iov;
-}
-
-asmlinkage long
-sys32_readv (int fd, struct compat_iovec *vector, u32 count)
-{
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov;
-	long ret;
-	mm_segment_t old_fs = get_fs();
-
-	iov = get_compat_iovec(vector, iovstack, count, VERIFY_WRITE);
-	if (!iov)
-		return -EFAULT;
-	set_fs(KERNEL_DS);
-	ret = sys_readv(fd, iov, count);
-	set_fs(old_fs);
-	if (iov != iovstack)
-		kfree(iov);
-	return ret;
-}
-
-asmlinkage long
-sys32_writev (int fd, struct compat_iovec *vector, u32 count)
-{
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov;
-	long ret;
-	mm_segment_t old_fs = get_fs();
-
-	iov = get_compat_iovec(vector, iovstack, count, VERIFY_READ);
-	if (!iov)
-		return -EFAULT;
-	set_fs(KERNEL_DS);
-	ret = sys_writev(fd, iov, count);
-	set_fs(old_fs);
-	if (iov != iovstack)
-		kfree(iov);
-	return ret;
+	return compat_sys_select(a.n, compat_ptr(a.inp), compat_ptr(a.outp),
+				 compat_ptr(a.exp), compat_ptr(a.tvp));
 }
 
 #define SEMOP		 1
@@ -2298,7 +2073,7 @@
 	((desc)->a & 0x0ffff) |			\
 	 ((desc)->b & 0xf0000) )
 
-#define GET_32BIT(desc)		(((desc)->b >> 23) & 1)
+#define GET_32BIT(desc)		(((desc)->b >> 22) & 1)
 #define GET_CONTENTS(desc)	(((desc)->b >> 10) & 3)
 #define GET_WRITABLE(desc)	(((desc)->b >>  9) & 1)
 #define GET_LIMIT_PAGES(desc)	(((desc)->b >> 23) & 1)
@@ -2423,176 +2198,6 @@
 	segid = (egid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)egid);
 	ssgid = (sgid == (compat_gid_t)-1) ? ((gid_t)-1) : ((gid_t)sgid);
 	return sys_setresgid(srgid, segid, ssgid);
-}
-
-/* Stuff for NFS server syscalls... */
-struct nfsctl_svc32 {
-	u16			svc32_port;
-	s32			svc32_nthreads;
-};
-
-struct nfsctl_client32 {
-	s8			cl32_ident[NFSCLNT_IDMAX+1];
-	s32			cl32_naddr;
-	struct in_addr		cl32_addrlist[NFSCLNT_ADDRMAX];
-	s32			cl32_fhkeytype;
-	s32			cl32_fhkeylen;
-	u8			cl32_fhkey[NFSCLNT_KEYMAX];
-};
-
-struct nfsctl_export32 {
-	s8			ex32_client[NFSCLNT_IDMAX+1];
-	s8			ex32_path[NFS_MAXPATHLEN+1];
-	compat_dev_t	ex32_dev;
-	compat_ino_t	ex32_ino;
-	s32			ex32_flags;
-	compat_uid_t	ex32_anon_uid;
-	compat_gid_t	ex32_anon_gid;
-};
-
-struct nfsctl_arg32 {
-	s32			ca32_version;	/* safeguard */
-	union {
-		struct nfsctl_svc32	u32_svc;
-		struct nfsctl_client32	u32_client;
-		struct nfsctl_export32	u32_export;
-		u32			u32_debug;
-	} u;
-#define ca32_svc	u.u32_svc
-#define ca32_client	u.u32_client
-#define ca32_export	u.u32_export
-#define ca32_debug	u.u32_debug
-};
-
-union nfsctl_res32 {
-	struct knfs_fh		cr32_getfh;
-	u32			cr32_debug;
-};
-
-static int
-nfs_svc32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= __get_user(karg->ca_svc.svc_port, &arg32->ca32_svc.svc32_port);
-	err |= __get_user(karg->ca_svc.svc_nthreads,
-			  &arg32->ca32_svc.svc32_nthreads);
-	return err;
-}
-
-static int
-nfs_clnt32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_client.cl_ident[0],
-			  &arg32->ca32_client.cl32_ident[0],
-			  NFSCLNT_IDMAX);
-	err |= __get_user(karg->ca_client.cl_naddr,
-			  &arg32->ca32_client.cl32_naddr);
-	err |= copy_from_user(&karg->ca_client.cl_addrlist[0],
-			  &arg32->ca32_client.cl32_addrlist[0],
-			  (sizeof(struct in_addr) * NFSCLNT_ADDRMAX));
-	err |= __get_user(karg->ca_client.cl_fhkeytype,
-		      &arg32->ca32_client.cl32_fhkeytype);
-	err |= __get_user(karg->ca_client.cl_fhkeylen,
-		      &arg32->ca32_client.cl32_fhkeylen);
-	err |= copy_from_user(&karg->ca_client.cl_fhkey[0],
-			  &arg32->ca32_client.cl32_fhkey[0],
-			  NFSCLNT_KEYMAX);
-	return err;
-}
-
-static int
-nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_export.ex_client[0],
-			  &arg32->ca32_export.ex32_client[0],
-			  NFSCLNT_IDMAX);
-	err |= copy_from_user(&karg->ca_export.ex_path[0],
-			  &arg32->ca32_export.ex32_path[0],
-			  NFS_MAXPATHLEN);
-	err |= __get_user(karg->ca_export.ex_dev,
-		      &arg32->ca32_export.ex32_dev);
-	err |= __get_user(karg->ca_export.ex_ino,
-		      &arg32->ca32_export.ex32_ino);
-	err |= __get_user(karg->ca_export.ex_flags,
-		      &arg32->ca32_export.ex32_flags);
-	err |= __get_user(karg->ca_export.ex_anon_uid,
-		      &arg32->ca32_export.ex32_anon_uid);
-	err |= __get_user(karg->ca_export.ex_anon_gid,
-		      &arg32->ca32_export.ex32_anon_gid);
-	return err;
-}
-
-static int
-nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32)
-{
-	int err;
-
-	err = copy_to_user(&res32->cr32_getfh,
-			&kres->cr_getfh,
-			sizeof(res32->cr32_getfh));
-	err |= __put_user(kres->cr_debug, &res32->cr32_debug);
-	return err;
-}
-
-int asmlinkage
-sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
-{
-	struct nfsctl_arg *karg = NULL;
-	union nfsctl_res *kres = NULL;
-	mm_segment_t oldfs;
-	int err;
-
-	karg = kmalloc(sizeof(*karg), GFP_USER);
-	if(!karg)
-		return -ENOMEM;
-	if(res32) {
-		kres = kmalloc(sizeof(*kres), GFP_USER);
-		if(!kres) {
-			kfree(karg);
-			return -ENOMEM;
-		}
-	}
-	switch(cmd) {
-	case NFSCTL_SVC:
-		err = nfs_svc32_trans(karg, arg32);
-		break;
-	case NFSCTL_ADDCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_DELCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_EXPORT:
-		err = nfs_exp32_trans(karg, arg32);
-		break;
-	default:
-		err = -EINVAL;
-		break;
-	}
-	if(err)
-		goto done;
-	oldfs = get_fs();
-	set_fs(KERNEL_DS);
-	err = sys_nfsservctl(cmd, karg, kres);
-	set_fs(oldfs);
-
-	if(!err && cmd == NFSCTL_GETFS)
-		err = nfs_getfh32_res_trans(kres, res32);
-
-done:
-	if(karg)
-		kfree(karg);
-	if(kres)
-		kfree(kres);
-	return err;
 }
 
 /* Handle adjtimex compatibility. */
diff -Nru a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
--- a/arch/ia64/kernel/Makefile	Tue Jun 15 22:21:05 2004
+++ b/arch/ia64/kernel/Makefile	Tue Jun 15 22:21:05 2004
@@ -23,6 +23,9 @@
 
 extra-y += gate.so gate-syms.o gate.lds.s gate.o
 
+# fp_emulate() expects f2-f5,f16-f31 to contain the user-level state.
+CFLAGS_traps.o  += -mfixed-range=f2-f5,f16-f31
+
 AFLAGS_gate.lds.o += -P -C -U$(ARCH)
 
 quiet_cmd_gate = GATE $@
diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
--- a/arch/ia64/kernel/acpi.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/kernel/acpi.c	Tue Jun 15 22:20:40 2004
@@ -52,6 +52,9 @@
 #include <asm/sal.h>
 #include <asm/cyclone.h>
 
+#define BAD_MADT_ENTRY(entry, end) (                                        \
+		(!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
+		((acpi_table_entry_header *)entry)->length != sizeof(*entry))
 
 #define PREFIX			"ACPI: "
 
@@ -158,12 +161,14 @@
 
 
 static int __init
-acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header)
+acpi_parse_lapic_addr_ovr (
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_lapic_addr_ovr *lapic;
 
 	lapic = (struct acpi_table_lapic_addr_ovr *) header;
-	if (!lapic)
+
+	if (BAD_MADT_ENTRY(lapic, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -177,12 +182,13 @@
 
 
 static int __init
-acpi_parse_lsapic (acpi_table_entry_header *header)
+acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_lsapic *lsapic;
 
 	lsapic = (struct acpi_table_lsapic *) header;
-	if (!lsapic)
+
+	if (BAD_MADT_ENTRY(lsapic, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -210,12 +216,13 @@
 
 
 static int __init
-acpi_parse_lapic_nmi (acpi_table_entry_header *header)
+acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_lapic_nmi *lacpi_nmi;
 
 	lacpi_nmi = (struct acpi_table_lapic_nmi*) header;
-	if (!lacpi_nmi)
+
+	if (BAD_MADT_ENTRY(lacpi_nmi, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -226,12 +233,13 @@
 
 
 static int __init
-acpi_parse_iosapic (acpi_table_entry_header *header)
+acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_iosapic *iosapic;
 
 	iosapic = (struct acpi_table_iosapic *) header;
-	if (!iosapic)
+
+	if (BAD_MADT_ENTRY(iosapic, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -243,13 +251,15 @@
 
 
 static int __init
-acpi_parse_plat_int_src (acpi_table_entry_header *header)
+acpi_parse_plat_int_src (
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_plat_int_src *plintsrc;
 	int vector;
 
 	plintsrc = (struct acpi_table_plat_int_src *) header;
-	if (!plintsrc)
+
+	if (BAD_MADT_ENTRY(plintsrc, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -272,12 +282,14 @@
 
 
 static int __init
-acpi_parse_int_src_ovr (acpi_table_entry_header *header)
+acpi_parse_int_src_ovr (
+	acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_int_src_ovr *p;
 
 	p = (struct acpi_table_int_src_ovr *) header;
-	if (!p)
+
+	if (BAD_MADT_ENTRY(p, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -290,12 +302,13 @@
 
 
 static int __init
-acpi_parse_nmi_src (acpi_table_entry_header *header)
+acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
 {
 	struct acpi_table_nmi_src *nmi_src;
 
 	nmi_src = (struct acpi_table_nmi_src*) header;
-	if (!nmi_src)
+
+	if (BAD_MADT_ENTRY(nmi_src, end))
 		return -EINVAL;
 
 	acpi_table_print_madt_entry(header);
@@ -630,16 +643,6 @@
 	/* Make boot-up look pretty */
 	printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
 	return 0;
-}
-
-/* deprecated in favor of acpi_gsi_to_irq */
-int
-acpi_irq_to_vector (u32 gsi)
-{
-	if (has_8259 && gsi < 16)
-		return isa_irq_to_vector(gsi);
-
-	return gsi_to_vector(gsi);
 }
 
 int
diff -Nru a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
--- a/arch/ia64/kernel/efi.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ia64/kernel/efi.c	Tue Jun 15 22:20:36 2004
@@ -39,7 +39,7 @@
 struct efi efi;
 EXPORT_SYMBOL(efi);
 static efi_runtime_services_t *runtime;
-static unsigned long mem_limit = ~0UL;
+static unsigned long mem_limit = ~0UL, max_addr = ~0UL;
 
 #define efi_call_virt(f, args...)	(*(f))(args)
 
@@ -290,6 +290,7 @@
 	void *efi_map_start, *efi_map_end, *p, *q;
 	efi_memory_desc_t *md, *check_md;
 	u64 efi_desc_size, start, end, granule_addr, last_granule_addr, first_non_wb_addr = 0;
+	unsigned long total_mem = 0;
 
 	efi_map_start = __va(ia64_boot_param->efi_memmap);
 	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -331,12 +332,18 @@
 			trim_top(md, last_granule_addr);
 
 		if (is_available_memory(md)) {
-			if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) > mem_limit) {
-				if (md->phys_addr > mem_limit)
+			if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) > max_addr) {
+				if (md->phys_addr > max_addr)
 					continue;
-				md->num_pages = (mem_limit - md->phys_addr) >> EFI_PAGE_SHIFT;
+				md->num_pages = (max_addr - md->phys_addr) >> EFI_PAGE_SHIFT;
 			}
 
+			if (total_mem >= mem_limit)
+				continue;
+			total_mem += (md->num_pages << EFI_PAGE_SHIFT);
+			if (total_mem > mem_limit)
+				md->num_pages -= ((total_mem - mem_limit) >> EFI_PAGE_SHIFT);
+
 			if (md->num_pages == 0)
 				continue;
 
@@ -470,7 +477,13 @@
 	for (cp = saved_command_line; *cp; ) {
 		if (memcmp(cp, "mem=", 4) == 0) {
 			cp += 4;
-			mem_limit = memparse(cp, &end) - 1;
+			mem_limit = memparse(cp, &end) - 2;
+			if (end != cp)
+				break;
+			cp = end;
+		} else if (memcmp(cp, "max_addr=", 9) == 0) {
+			cp += 9;
+			max_addr = memparse(cp, &end) - 1;
 			if (end != cp)
 				break;
 			cp = end;
@@ -481,8 +494,8 @@
 				++cp;
 		}
 	}
-	if (mem_limit != ~0UL)
-		printk(KERN_INFO "Ignoring memory above %luMB\n", mem_limit >> 20);
+	if (max_addr != ~0UL)
+		printk(KERN_INFO "Ignoring memory above %luMB\n", max_addr >> 20);
 
 	efi.systab = __va(ia64_boot_param->efi_systab);
 
diff -Nru a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
--- a/arch/ia64/kernel/entry.S	Tue Jun 15 22:20:38 2004
+++ b/arch/ia64/kernel/entry.S	Tue Jun 15 22:20:38 2004
@@ -21,7 +21,7 @@
  * Jonathan Nicklin	<nicklin@missioncriticallinux.com>
  * Patrick O'Rourke	<orourke@missioncriticallinux.com>
  * 11/07/2000
- /
+ */
 /*
  * Global (preserved) predicate usage on syscall entry/exit path:
  *
@@ -1429,7 +1429,7 @@
 	data8 sys_getcwd
 	data8 sys_capget			// 1185
 	data8 sys_capset
-	data8 sys_sendfile
+	data8 sys_sendfile64
 	data8 sys_ni_syscall		// sys_getpmsg (STREAMS)
 	data8 sys_ni_syscall		// sys_putpmsg (STREAMS)
 	data8 sys_socket			// 1190
@@ -1501,16 +1501,16 @@
 	data8 sys_clock_nanosleep
 	data8 sys_fstatfs64
 	data8 sys_statfs64
-	data8 sys_ni_syscall
-	data8 sys_ni_syscall			// 1260
-	data8 sys_ni_syscall
+	data8 sys_mbind
+	data8 sys_get_mempolicy			// 1260
+	data8 sys_set_mempolicy
 	data8 sys_mq_open
 	data8 sys_mq_unlink
 	data8 sys_mq_timedsend
 	data8 sys_mq_timedreceive		// 1265
 	data8 sys_mq_notify
 	data8 sys_mq_getsetattr
-	data8 sys_ni_syscall
+	data8 sys_ni_syscall			// reserved for kexec_load
 	data8 sys_ni_syscall
 	data8 sys_ni_syscall			// 1270
 	data8 sys_ni_syscall
diff -Nru a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
--- a/arch/ia64/kernel/fsys.S	Tue Jun 15 22:21:05 2004
+++ b/arch/ia64/kernel/fsys.S	Tue Jun 15 22:21:05 2004
@@ -345,40 +345,33 @@
 	.altrp b6
 	.body
 
-	mf					// ensure reading of current->blocked is ordered
 	add r2=IA64_TASK_BLOCKED_OFFSET,r16
 	add r9=TI_FLAGS+IA64_TASK_SIZE,r16
+	cmp4.ltu p6,p0=SIG_SETMASK,r32
+
+	cmp.ne p15,p0=r0,r34			// oset != NULL?
+	tnat.nz p8,p0=r34
+	add r31=IA64_TASK_SIGHAND_OFFSET,r16
 	;;
-	/*
-	 * Since we're only reading a single word, we can do it
-	 * atomically without acquiring current->sighand->siglock.  To
-	 * be on the safe side, we need a fully-ordered load, though:
-	 */
-	ld8.acq r3=[r2]				// read/prefetch current->blocked
+	ld8 r3=[r2]				// read/prefetch current->blocked
 	ld4 r9=[r9]
-	add r31=IA64_TASK_SIGHAND_OFFSET,r16
+	tnat.nz.or p6,p0=r35
+
+	cmp.ne.or p6,p0=_NSIG_WORDS*8,r35
+	tnat.nz.or p6,p0=r32
+(p6)	br.spnt.few .fail_einval		// fail with EINVAL
 	;;
 #ifdef CONFIG_SMP
 	ld8 r31=[r31]				// r31 <- current->sighand
 #endif
 	and r9=TIF_ALLWORK_MASK,r9
-	tnat.nz p6,p0=r32
-	;;
-	cmp.ne p7,p0=0,r9
-	tnat.nz.or p6,p0=r35
-	tnat.nz p8,p0=r34
-	;;
-	cmp.ne p15,p0=r0,r34			// oset != NULL?
-	cmp.ne.or p6,p0=_NSIG_WORDS*8,r35
 	tnat.nz.or p8,p0=r33
-
-(p6)	br.spnt.few .fail_einval		// fail with EINVAL
-(p7)	br.spnt.many fsys_fallback_syscall	// got pending kernel work...
-(p8)	br.spnt.few .fail_efault		// fail with EFAULT
 	;;
-
-	cmp.eq p6,p7=r0,r33			// set == NULL?
+	cmp.ne p7,p0=0,r9
+	cmp.eq p6,p0=r0,r33			// set == NULL?
 	add r31=IA64_SIGHAND_SIGLOCK_OFFSET,r31	// r31 <- current->sighand->siglock
+(p8)	br.spnt.few .fail_efault		// fail with EFAULT
+(p7)	br.spnt.many fsys_fallback_syscall	// got pending kernel work...
 (p6)	br.dpnt.many .store_mask		// -> short-circuit to just reading the signal mask
 
 	/* Argh, we actually have to do some work and _update_ the signal mask: */
@@ -462,12 +455,10 @@
 	st4.rel [r31]=r0			// release the lock
 #endif
 	ssm psr.i
-	cmp.ne p9,p0=r8,r0			// check for bad HOW value
 	;;
 
 	srlz.d					// ensure psr.i is set again
 	mov r18=0					// i must not leak kernel bits...
-(p9)	br.spnt.few .fail_einval		// bail out for bad HOW value
 
 .store_mask:
 EX(.fail_efault, (p15) probe.w.fault r34, 3)	// verify user has write-access to *oset
@@ -511,6 +502,7 @@
 	adds r17=-1024,r15
 	movl r14=sys_call_table
 	;;
+	rsm psr.i
 	shladd r18=r17,3,r14
 	;;
 	ld8 r18=[r18]				// load normal (heavy-weight) syscall entry-point
@@ -551,7 +543,7 @@
 	 * to synthesize.
 	 */
 #	define PSR_ONE_BITS		((3 << IA64_PSR_CPL0_BIT) | (0x1 << IA64_PSR_RI_BIT) \
-					 | IA64_PSR_BN)
+					 | IA64_PSR_BN | IA64_PSR_I)
 
 	invala
 	movl r8=PSR_ONE_BITS
@@ -574,6 +566,10 @@
 	or r29=r8,r29			// construct cr.ipsr value to save
 	addl r22=IA64_RBS_OFFSET,r2	// compute base of RBS
 	;;
+	// GAS reports a spurious RAW hazard on the read of ar.rnat because it thinks
+	// we may be reading ar.itc after writing to psr.l.  Avoid that message with
+	// this directive:
+	dv_serialize_data
 	mov.m r24=ar.rnat		// read ar.rnat (5 cyc lat)
 	lfetch.fault.excl.nt1 [r22]
 	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r2
@@ -857,7 +853,7 @@
 	data8 0				// mq_timedreceive	// 1265
 	data8 0				// mq_notify
 	data8 0				// mq_getsetattr
-	data8 0
+	data8 0				// kexec_load
 	data8 0
 	data8 0							// 1270
 	data8 0
diff -Nru a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S
--- a/arch/ia64/kernel/gate.S	Tue Jun 15 22:20:43 2004
+++ b/arch/ia64/kernel/gate.S	Tue Jun 15 22:20:43 2004
@@ -91,16 +91,18 @@
 	cmp.geu p6,p7=r19,r17			// (syscall > 0 && syscall < 1024+NR_syscalls)?
 	;;
 (p6)	ld8 r18=[r18]
-	mov r29=psr				// read psr (12 cyc load latency)
+	mov r21=ar.fpsr
 	add r14=-8,r14				// r14 <- addr of fsys_bubble_down entry
 	;;
 (p6)	mov b7=r18
 (p6)	tbit.z p8,p0=r18,0
 (p8)	br.dptk.many b7
 
+(p6)	rsm psr.i
 	mov r27=ar.rsc
-	mov r21=ar.fpsr
 	mov r26=ar.pfs
+	;;
+	mov r29=psr				// read psr (12 cyc load latency)
 /*
  * brl.cond doesn't work as intended because the linker would convert this branch
  * into a branch to a PLT.  Perhaps there will be a way to avoid this with some
diff -Nru a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
--- a/arch/ia64/kernel/head.S	Tue Jun 15 22:20:42 2004
+++ b/arch/ia64/kernel/head.S	Tue Jun 15 22:20:42 2004
@@ -56,8 +56,7 @@
 GLOBAL_ENTRY(_start)
 start_ap:
 	.prologue
-	.save rp, r4		// terminate unwind chain with a NULL rp
-	mov r4=r0
+	.save rp, r0		// terminate unwind chain with a NULL rp
 	.body
 
 	rsm psr.i | psr.ic
@@ -816,6 +815,42 @@
 	br.ret.sptk.many rp
 END(ia64_delay_loop)
 
+/*
+ * Return a CPU-local timestamp in nano-seconds.  This timestamp is
+ * NOT synchronized across CPUs its return value must never be
+ * compared against the values returned on another CPU.  The usage in
+ * kernel/sched.c ensures that.
+ *
+ * The return-value of sched_clock() is NOT supposed to wrap-around.
+ * If it did, it would cause some scheduling hiccups (at the worst).
+ * Fortunately, with a 64-bit cycle-counter ticking at 100GHz, even
+ * that would happen only once every 5+ years.
+ *
+ * The code below basically calculates:
+ *
+ *   (ia64_get_itc() * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT
+ *
+ * except that the multiplication and the shift are done with 128-bit
+ * intermediate precision so that we can produce a full 64-bit result.
+ */
+GLOBAL_ENTRY(sched_clock)
+	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
+	mov.m r9=ar.itc		// fetch cycle-counter				(35 cyc)
+	;;
+	ldf8 f8=[r8]
+	;;
+	setf.sig f9=r9		// certain to stall, so issue it _after_ ldf8...
+	;;
+	xmpy.lu f10=f9,f8	// calculate low 64 bits of 128-bit product	(4 cyc)
+	xmpy.hu f11=f9,f8	// calculate high 64 bits of 128-bit product
+	;;
+	getf.sig r8=f10		//						(5 cyc)
+	getf.sig r9=f11
+	;;
+	shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
+	br.ret.sptk.many rp
+END(sched_clock)
+
 GLOBAL_ENTRY(start_kernel_thread)
 	.prologue
 	.save rp, r0				// this is the end of the call-chain
@@ -866,12 +901,14 @@
 	 * Inputs:
 	 *   ar.pfs - saved CFM of caller
 	 *   ar.ccv - 0 (and available for use)
+	 *   r27    - flags from spin_lock_irqsave or 0.  Must be preserved.
 	 *   r28    - available for use.
 	 *   r29    - available for use.
 	 *   r30    - available for use.
 	 *   r31    - address of lock, available for use.
 	 *   b6     - return address
 	 *   p14    - available for use.
+	 *   p15    - used to track flag status.
 	 *
 	 * If you patch this code to use more registers, do not forget to update
 	 * the clobber lists for spin_lock() in include/asm-ia64/spinlock.h.
@@ -885,22 +922,26 @@
 	.save rp, r28
 	.body
 	nop 0
-	nop 0
+	tbit.nz p15,p0=r27,IA64_PSR_I_BIT
 	.restore sp		// pop existing prologue after next insn
 	mov b6 = r28
 	.prologue
 	.save ar.pfs, r0
 	.altrp b6
 	.body
+	;;
+(p15)	ssm psr.i		// reenable interrupts if they were on
+				// DavidM says that srlz.d is slow and is not required in this case
 .wait:
 	// exponential backoff, kdb, lockmeter etc. go in here
 	hint @pause
 	ld4 r30=[r31]		// don't use ld4.bias; if it's contended, we won't write the word
 	nop 0
 	;;
-	cmp4.eq p14,p0=r30,r0
-(p14)	br.cond.sptk.few b6	// lock is now free, try to acquire
-	br.cond.sptk.few .wait
+	cmp4.ne p14,p0=r30,r0
+(p14)	br.cond.sptk.few .wait
+(p15)	rsm psr.i		// disable interrupts if we reenabled them
+	br.cond.sptk.few b6	// lock is now free, try to acquire
 END(ia64_spinlock_contention_pre3_4)
 
 #else
@@ -909,14 +950,20 @@
 	.prologue
 	.altrp b6
 	.body
+	tbit.nz p15,p0=r27,IA64_PSR_I_BIT
+	;;
 .wait:
+(p15)	ssm psr.i		// reenable interrupts if they were on
+				// DavidM says that srlz.d is slow and is not required in this case
+.wait2:
 	// exponential backoff, kdb, lockmeter etc. go in here
 	hint @pause
 	ld4 r30=[r31]		// don't use ld4.bias; if it's contended, we won't write the word
 	;;
 	cmp4.ne p14,p0=r30,r0
 	mov r30 = 1
-(p14)	br.cond.sptk.few .wait
+(p14)	br.cond.sptk.few .wait2
+(p15)	rsm psr.i		// disable interrupts if we reenabled them
 	;;
 	cmpxchg4.acq r30=[r31], r30, ar.ccv
 	;;
diff -Nru a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
--- a/arch/ia64/kernel/iosapic.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/kernel/iosapic.c	Tue Jun 15 22:20:40 2004
@@ -32,6 +32,8 @@
  * 03/02/19	B. Helgaas	Make pcat_compat system-wide, not per-IOSAPIC.
  *				Remove iosapic_address & gsi_base from external interfaces.
  *				Rationalize __init/__devinit attributes.
+ * 04/12/04 Ashok Raj	<ashok.raj@intel.com> Intel Corporation 2004
+ *				Updated to work with irq migration necessary for CPU Hotplug
  */
 /*
  * Here is what the interrupt logic between a PCI device and the kernel looks like:
@@ -98,6 +100,7 @@
 #endif
 
 static spinlock_t iosapic_lock = SPIN_LOCK_UNLOCKED;
+extern cpumask_t	__cacheline_aligned pending_irq_cpumask[NR_IRQS];
 
 /* These tables map IA-64 vectors to the IOSAPIC pin that generates this vector. */
 
@@ -188,8 +191,10 @@
 	pol     = iosapic_intr_info[vector].polarity;
 	trigger = iosapic_intr_info[vector].trigger;
 	dmode   = iosapic_intr_info[vector].dmode;
+	vector &= (~IA64_IRQ_REDIRECTED);
 
 	redir = (dmode == IOSAPIC_LOWEST_PRIORITY) ? 1 : 0;
+
 #ifdef CONFIG_SMP
 	{
 		unsigned int irq;
@@ -311,9 +316,8 @@
 
 	spin_lock_irqsave(&iosapic_lock, flags);
 	{
-		/* get current delivery mode by reading the low32 */
-		writel(IOSAPIC_RTE_LOW(rte_index), addr + IOSAPIC_REG_SELECT);
 		low32 = iosapic_intr_info[vec].low32 & ~(7 << IOSAPIC_DELIVERY_SHIFT);
+
 		if (redir)
 		        /* change delivery mode to lowest priority */
 			low32 |= (IOSAPIC_LOWEST_PRIORITY << IOSAPIC_DELIVERY_SHIFT);
@@ -331,6 +335,21 @@
 #endif
 }
 
+static inline void move_irq(int irq)
+{
+	/* note - we hold desc->lock */
+	cpumask_t tmp;
+	irq_desc_t *desc = irq_descp(irq);
+
+	if (!cpus_empty(pending_irq_cpumask[irq])) {
+		cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
+		if (unlikely(!cpus_empty(tmp))) {
+			desc->handler->set_affinity(irq, pending_irq_cpumask[irq]);
+		}
+		cpus_clear(pending_irq_cpumask[irq]);
+	}
+}
+
 /*
  * Handlers for level-triggered interrupts.
  */
@@ -347,6 +366,7 @@
 {
 	ia64_vector vec = irq_to_vector(irq);
 
+	move_irq(irq);
 	writel(vec, iosapic_intr_info[vec].addr + IOSAPIC_EOI);
 }
 
@@ -386,6 +406,8 @@
 iosapic_ack_edge_irq (unsigned int irq)
 {
 	irq_desc_t *idesc = irq_descp(irq);
+
+	move_irq(irq);
 	/*
 	 * Once we have recorded IRQ_PENDING already, we can mask the
 	 * interrupt for real. This prevents IRQ storms from unhandled
diff -Nru a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
--- a/arch/ia64/kernel/irq.c	Tue Jun 15 22:20:44 2004
+++ b/arch/ia64/kernel/irq.c	Tue Jun 15 22:20:44 2004
@@ -8,6 +8,12 @@
  * instead of just grabbing them. Thus setups with different IRQ numbers
  * shouldn't result in any weird surprises, and installing new handlers
  * should be easier.
+ *
+ * Copyright (C) Ashok Raj<ashok.raj@intel.com>, Intel Corporation 2004
+ *
+ * 4/14/2004: Added code to handle cpu migration and do safe irq
+ *			migration without lossing interrupts for iosapic
+ *			architecture.
  */
 
 /*
@@ -27,6 +33,7 @@
 #include <linux/timex.h>
 #include <linux/slab.h>
 #include <linux/random.h>
+#include <linux/cpu.h>
 #include <linux/ctype.h>
 #include <linux/smp_lock.h>
 #include <linux/init.h>
@@ -35,19 +42,21 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/kallsyms.h>
+#include <linux/notifier.h>
 
 #include <asm/atomic.h>
+#include <asm/cpu.h>
 #include <asm/io.h>
 #include <asm/smp.h>
 #include <asm/system.h>
 #include <asm/bitops.h>
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
+#include <asm/tlbflush.h>
 #include <asm/delay.h>
 #include <asm/irq.h>
 
 
-
 /*
  * Linux has a controller-independent x86 interrupt architecture.
  * every controller has a 'controller-template', that is used
@@ -75,6 +84,11 @@
 	}
 };
 
+/*
+ * This is updated when the user sets irq affinity via /proc
+ */
+cpumask_t    __cacheline_aligned pending_irq_cpumask[NR_IRQS];
+
 #ifdef CONFIG_IA64_GENERIC
 irq_desc_t * __ia64_irq_desc (unsigned int irq)
 {
@@ -938,7 +952,9 @@
 static int irq_affinity_read_proc (char *page, char **start, off_t off,
 			int count, int *eof, void *data)
 {
-	int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]);
+	int len = sprintf(page, "%s", irq_redir[(long)data] ? "r " : "");
+
+	len += cpumask_scnprintf(page+len, count, irq_affinity[(long)data]);
 	if (count - len < 2)
 		return -EINVAL;
 	len += sprintf(page + len, "\n");
@@ -956,6 +972,7 @@
 	int rlen;
 	int prelen;
 	irq_desc_t *desc = irq_descp(irq);
+	unsigned long flags;
 
 	if (!desc->handler->set_affinity)
 		return -EIO;
@@ -994,11 +1011,107 @@
 	if (cpus_empty(tmp))
 		return -EINVAL;
 
-	desc->handler->set_affinity(irq, new_value);
+	spin_lock_irqsave(&desc->lock, flags);
+	pending_irq_cpumask[irq] = new_value;
+	spin_unlock_irqrestore(&desc->lock, flags);
+
 	return full_count;
 }
 
 #endif /* CONFIG_SMP */
+
+#ifdef CONFIG_HOTPLUG_CPU
+unsigned int vectors_in_migration[NR_IRQS];
+
+/*
+ * Since cpu_online_map is already updated, we just need to check for
+ * affinity that has zeros
+ */
+static void migrate_irqs(void)
+{
+	cpumask_t	mask;
+	irq_desc_t *desc;
+	int 		irq, new_cpu;
+
+	for (irq=0; irq < NR_IRQS; irq++) {
+		desc = irq_descp(irq);
+
+		/*
+		 * No handling for now.
+		 * TBD: Implement a disable function so we can now
+		 * tell CPU not to respond to these local intr sources.
+		 * such as ITV,CPEI,MCA etc.
+		 */
+		if (desc->status == IRQ_PER_CPU)
+			continue;
+
+		cpus_and(mask, irq_affinity[irq], cpu_online_map);
+		if (any_online_cpu(mask) == NR_CPUS) {
+			/*
+			 * Save it for phase 2 processing
+			 */
+			vectors_in_migration[irq] = irq;
+
+			new_cpu = any_online_cpu(cpu_online_map);
+			mask = cpumask_of_cpu(new_cpu);
+
+			/*
+			 * Al three are essential, currently WARN_ON.. maybe panic?
+			 */
+			if (desc->handler && desc->handler->disable &&
+				desc->handler->enable && desc->handler->set_affinity) {
+				desc->handler->disable(irq);
+				desc->handler->set_affinity(irq, mask);
+				desc->handler->enable(irq);
+			} else {
+				WARN_ON((!(desc->handler) || !(desc->handler->disable) ||
+						!(desc->handler->enable) ||
+						!(desc->handler->set_affinity)));
+			}
+		}
+	}
+}
+
+void fixup_irqs(void)
+{
+	unsigned int irq;
+	extern void ia64_process_pending_intr(void);
+
+	ia64_set_itv(1<<16);
+	/*
+	 * Phase 1: Locate irq's bound to this cpu and
+	 * relocate them for cpu removal.
+	 */
+	migrate_irqs();
+
+	/*
+	 * Phase 2: Perform interrupt processing for all entries reported in
+	 * local APIC.
+	 */
+	ia64_process_pending_intr();
+
+	/*
+	 * Phase 3: Now handle any interrupts not captured in local APIC.
+	 * This is to account for cases that device interrupted during the time the
+	 * rte was being disabled and re-programmed.
+	 */
+	for (irq=0; irq < NR_IRQS; irq++) {
+		if (vectors_in_migration[irq]) {
+			vectors_in_migration[irq]=0;
+			do_IRQ(irq, NULL);
+		}
+	}
+
+	/*
+	 * Now let processor die. We do irq disable and max_xtp() to
+	 * ensure there is no more interrupts routed to this processor.
+	 * But the local timer interrupt can have 1 pending which we
+	 * take care in timer_interrupt().
+	 */
+	max_xtp();
+	local_irq_disable();
+}
+#endif
 
 static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
 			int count, int *eof, void *data)
diff -Nru a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
--- a/arch/ia64/kernel/irq_ia64.c	Tue Jun 15 22:20:39 2004
+++ b/arch/ia64/kernel/irq_ia64.c	Tue Jun 15 22:20:39 2004
@@ -10,6 +10,8 @@
  *
  * 09/15/00 Goutham Rao <goutham.rao@intel.com> Implemented pci_irq_to_vector
  *                      PCI to vector allocation routine.
+ * 04/14/2004 Ashok Raj <ashok.raj@intel.com>
+ *						Added CPU Hotplug handling for IPF.
  */
 
 #include <linux/config.h>
@@ -85,6 +87,11 @@
 
 extern unsigned int do_IRQ(unsigned long irq, struct pt_regs *regs);
 
+#ifdef CONFIG_SMP
+#	define IS_RESCHEDULE(vec)	(vec == IA64_IPI_RESCHEDULE)
+#else
+#	define IS_RESCHEDULE(vec)	(0)
+#endif
 /*
  * That's where the IVT branches when we get an external
  * interrupt. This branches to the correct hardware IRQ handler via
@@ -94,11 +101,6 @@
 ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
 {
 	unsigned long saved_tpr;
-#ifdef CONFIG_SMP
-#	define IS_RESCHEDULE(vec)	(vec == IA64_IPI_RESCHEDULE)
-#else
-#	define IS_RESCHEDULE(vec)	(0)
-#endif
 
 #if IRQ_DEBUG
 	{
@@ -161,6 +163,54 @@
 	 */
 	irq_exit();
 }
+
+#ifdef CONFIG_HOTPLUG_CPU
+/*
+ * This function emulates a interrupt processing when a cpu is about to be
+ * brought down.
+ */
+void ia64_process_pending_intr(void)
+{
+	ia64_vector vector;
+	unsigned long saved_tpr;
+	extern unsigned int vectors_in_migration[NR_IRQS];
+
+	vector = ia64_get_ivr();
+
+	 irq_enter();
+	 saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
+	 ia64_srlz_d();
+
+	 /*
+	  * Perform normal interrupt style processing
+	  */
+	while (vector != IA64_SPURIOUS_INT_VECTOR) {
+		if (!IS_RESCHEDULE(vector)) {
+			ia64_setreg(_IA64_REG_CR_TPR, vector);
+			ia64_srlz_d();
+
+			/*
+			 * Now try calling normal ia64_handle_irq as it would have got called
+			 * from a real intr handler. Try passing null for pt_regs, hopefully
+			 * it will work. I hope it works!.
+			 * Probably could shared code.
+			 */
+			vectors_in_migration[local_vector_to_irq(vector)]=0;
+			do_IRQ(local_vector_to_irq(vector), NULL);
+
+			/*
+			 * Disable interrupts and send EOI
+			 */
+			local_irq_disable();
+			ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
+		}
+		ia64_eoi();
+		vector = ia64_get_ivr();
+	}
+	irq_exit();
+}
+#endif
+
 
 #ifdef CONFIG_SMP
 extern irqreturn_t handle_IPI (int irq, void *dev_id, struct pt_regs *regs);
diff -Nru a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
--- a/arch/ia64/kernel/ivt.S	Tue Jun 15 22:20:37 2004
+++ b/arch/ia64/kernel/ivt.S	Tue Jun 15 22:20:37 2004
@@ -182,6 +182,12 @@
 	;;
 #ifdef CONFIG_SMP
 	/*
+	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
+	 * cannot possibly affect the following loads:
+	 */
+	dv_serialize_data
+
+	/*
 	 * Re-check L2 and L3 pagetable.  If they changed, we may have received a ptc.g
 	 * between reading the pagetable and the "itc".  If so, flush the entry we
 	 * inserted and retry.
@@ -229,6 +235,12 @@
 	itc.i r18
 	;;
 #ifdef CONFIG_SMP
+	/*
+	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
+	 * cannot possibly affect the following loads:
+	 */
+	dv_serialize_data
+
 	ld8 r19=[r17]				// read L3 PTE again and see if same
 	mov r20=PAGE_SHIFT<<2			// setup page size for purge
 	;;
@@ -267,6 +279,12 @@
 	itc.d r18
 	;;
 #ifdef CONFIG_SMP
+	/*
+	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
+	 * cannot possibly affect the following loads:
+	 */
+	dv_serialize_data
+
 	ld8 r19=[r17]				// read L3 PTE again and see if same
 	mov r20=PAGE_SHIFT<<2			// setup page size for purge
 	;;
@@ -504,6 +522,12 @@
 	;;
 (p6)	itc.d r25				// install updated PTE
 	;;
+	/*
+	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
+	 * cannot possibly affect the following loads:
+	 */
+	dv_serialize_data
+
 	ld8 r18=[r17]				// read PTE again
 	;;
 	cmp.eq p6,p7=r18,r25			// is it same as the newly installed
@@ -563,6 +587,12 @@
 	;;
 (p6)	itc.i r25				// install updated PTE
 	;;
+	/*
+	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
+	 * cannot possibly affect the following loads:
+	 */
+	dv_serialize_data
+
 	ld8 r18=[r17]				// read PTE again
 	;;
 	cmp.eq p6,p7=r18,r25			// is it same as the newly installed
@@ -610,6 +640,11 @@
 	cmp.eq p6,p7=r26,r18
 	;;
 (p6)	itc.d r25				// install updated PTE
+	/*
+	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
+	 * cannot possibly affect the following loads:
+	 */
+	dv_serialize_data
 	;;
 	ld8 r18=[r17]				// read PTE again
 	;;
diff -Nru a/arch/ia64/kernel/machvec.c b/arch/ia64/kernel/machvec.c
--- a/arch/ia64/kernel/machvec.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/kernel/machvec.c	Tue Jun 15 22:20:40 2004
@@ -1,6 +1,7 @@
 #include <linux/config.h>
 #include <linux/module.h>
 
+#include <asm/machvec.h>
 #include <asm/system.h>
 
 #ifdef CONFIG_IA64_GENERIC
@@ -8,7 +9,6 @@
 #include <linux/kernel.h>
 #include <linux/string.h>
 
-#include <asm/machvec.h>
 #include <asm/page.h>
 
 struct ia64_machine_vector ia64_mv;
diff -Nru a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
--- a/arch/ia64/kernel/palinfo.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ia64/kernel/palinfo.c	Tue Jun 15 22:20:36 2004
@@ -8,11 +8,14 @@
  *
  * Copyright (C) 2000-2001, 2003 Hewlett-Packard Co
  *	Stephane Eranian <eranian@hpl.hp.com>
+ * Copyright (C) 2004 Intel Corporation
+ *  Ashok Raj <ashok.raj@intel.com>
  *
  * 05/26/2000	S.Eranian	initial release
  * 08/21/2000	S.Eranian	updated to July 2000 PAL specs
  * 02/05/2001   S.Eranian	fixed module support
  * 10/23/2001	S.Eranian	updated pal_perf_mon_info bug fixes
+ * 03/24/2004	Ashok Raj	updated to work with CPU Hotplug
  */
 #include <linux/config.h>
 #include <linux/types.h>
@@ -22,6 +25,9 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/efi.h>
+#include <linux/notifier.h>
+#include <linux/cpu.h>
+#include <linux/cpumask.h>
 
 #include <asm/pal.h>
 #include <asm/sal.h>
@@ -768,13 +774,12 @@
  * does not do recursion of deletion
  *
  * Notes:
- *	- first +1 accounts for the cpuN entry
- *	- second +1 account for toplevel palinfo
- *
+ *	- +1 accounts for the cpuN directory entry in /proc/pal
  */
-#define NR_PALINFO_PROC_ENTRIES	(NR_CPUS*(NR_PALINFO_ENTRIES+1)+1)
+#define NR_PALINFO_PROC_ENTRIES	(NR_CPUS*(NR_PALINFO_ENTRIES+1))
 
 static struct proc_dir_entry *palinfo_proc_entries[NR_PALINFO_PROC_ENTRIES];
+static struct proc_dir_entry *palinfo_dir;
 
 /*
  * This data structure is used to pass which cpu,function is being requested
@@ -888,47 +893,107 @@
 	return len;
 }
 
-static int __init
-palinfo_init(void)
+static void
+create_palinfo_proc_entries(unsigned int cpu)
 {
 #	define CPUSTR	"cpu%d"
 
 	pal_func_cpu_u_t f;
-	struct proc_dir_entry **pdir = palinfo_proc_entries;
-	struct proc_dir_entry *palinfo_dir, *cpu_dir;
-	int i, j;
+	struct proc_dir_entry **pdir;
+	struct proc_dir_entry *cpu_dir;
+	int j;
 	char cpustr[sizeof(CPUSTR)];
 
-	printk(KERN_INFO "PAL Information Facility v%s\n", PALINFO_VERSION);
-
-	palinfo_dir = proc_mkdir("pal", NULL);
 
 	/*
 	 * we keep track of created entries in a depth-first order for
 	 * cleanup purposes. Each entry is stored into palinfo_proc_entries
 	 */
-	for (i=0; i < NR_CPUS; i++) {
+	sprintf(cpustr,CPUSTR, cpu);
 
-		if (!cpu_online(i)) continue;
+	cpu_dir = proc_mkdir(cpustr, palinfo_dir);
 
-		sprintf(cpustr,CPUSTR, i);
+	f.req_cpu = cpu;
 
-		cpu_dir = proc_mkdir(cpustr, palinfo_dir);
+	/*
+	 * Compute the location to store per cpu entries
+	 * We dont store the top level entry in this list, but
+	 * remove it finally after removing all cpu entries.
+	 */
+	pdir = &palinfo_proc_entries[cpu*(NR_PALINFO_ENTRIES+1)];
+	*pdir++ = cpu_dir;
+	for (j=0; j < NR_PALINFO_ENTRIES; j++) {
+		f.func_id = j;
+		*pdir = create_proc_read_entry(
+				palinfo_entries[j].name, 0, cpu_dir,
+				palinfo_read_entry, (void *)f.value);
+		if (*pdir)
+			(*pdir)->owner = THIS_MODULE;
+		pdir++;
+	}
+}
 
-		f.req_cpu = i;
+static void
+remove_palinfo_proc_entries(unsigned int hcpu)
+{
+	int j;
+	struct proc_dir_entry *cpu_dir, **pdir;
 
-		for (j=0; j < NR_PALINFO_ENTRIES; j++) {
-			f.func_id = j;
-			*pdir = create_proc_read_entry(
-					palinfo_entries[j].name, 0, cpu_dir,
-					palinfo_read_entry, (void *)f.value);
-			if (*pdir)
-				(*pdir)->owner = THIS_MODULE;
-			pdir++;
+	pdir = &palinfo_proc_entries[hcpu*(NR_PALINFO_ENTRIES+1)];
+	cpu_dir = *pdir;
+	*pdir++=NULL;
+	for (j=0; j < (NR_PALINFO_ENTRIES); j++) {
+		if ((*pdir)) {
+			remove_proc_entry ((*pdir)->name, cpu_dir);
+			*pdir ++= NULL;
 		}
-		*pdir++ = cpu_dir;
 	}
-	*pdir = palinfo_dir;
+
+	if (cpu_dir) {
+		remove_proc_entry(cpu_dir->name, palinfo_dir);
+	}
+}
+
+static int __devinit palinfo_cpu_callback(struct notifier_block *nfb,
+								unsigned long action,
+								void *hcpu)
+{
+	unsigned int hotcpu = (unsigned long)hcpu;
+
+	switch (action) {
+	case CPU_ONLINE:
+		create_palinfo_proc_entries(hotcpu);
+		break;
+#ifdef CONFIG_HOTPLUG_CPU
+	case CPU_DEAD:
+		remove_palinfo_proc_entries(hotcpu);
+		break;
+#endif
+	}
+	return NOTIFY_OK;
+}
+
+static struct notifier_block palinfo_cpu_notifier =
+{
+	.notifier_call = palinfo_cpu_callback,
+	.priority = 0,
+};
+
+static int __init
+palinfo_init(void)
+{
+	int i = 0;
+
+	printk(KERN_INFO "PAL Information Facility v%s\n", PALINFO_VERSION);
+	palinfo_dir = proc_mkdir("pal", NULL);
+
+	/* Create palinfo dirs in /proc for all online cpus */
+	for_each_online_cpu(i) {
+		create_palinfo_proc_entries(i);
+	}
+
+	/* Register for future delivery via notify registration */
+	register_cpu_notifier(&palinfo_cpu_notifier);
 
 	return 0;
 }
@@ -939,10 +1004,19 @@
 	int i = 0;
 
 	/* remove all nodes: depth first pass. Could optimize this  */
-	for (i=0; i< NR_PALINFO_PROC_ENTRIES ; i++) {
-		if (palinfo_proc_entries[i])
-			remove_proc_entry (palinfo_proc_entries[i]->name, NULL);
+	for_each_online_cpu(i) {
+		remove_palinfo_proc_entries(i);
 	}
+
+	/*
+	 * Remove the top level entry finally
+	 */
+	remove_proc_entry(palinfo_dir->name, NULL);
+
+	/*
+	 * Unregister from cpu notifier callbacks
+	 */
+	unregister_cpu_notifier(&palinfo_cpu_notifier);
 }
 
 module_init(palinfo_init);
diff -Nru a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
--- a/arch/ia64/kernel/perfmon.c	Tue Jun 15 22:21:02 2004
+++ b/arch/ia64/kernel/perfmon.c	Tue Jun 15 22:21:03 2004
@@ -26,6 +26,7 @@
 #include <linux/interrupt.h>
 #include <linux/smp_lock.h>
 #include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <linux/init.h>
 #include <linux/vmalloc.h>
 #include <linux/mm.h>
@@ -86,27 +87,25 @@
 #define	PFM_REG_CONFIG		(0x8<<4|PFM_REG_IMPL) /* configuration register */
 #define PFM_REG_BUFFER	 	(0xc<<4|PFM_REG_IMPL) /* PMD used as buffer */
 
-#define PMC_IS_LAST(i)	(pmu_conf.pmc_desc[i].type & PFM_REG_END)
-#define PMD_IS_LAST(i)	(pmu_conf.pmd_desc[i].type & PFM_REG_END)
-
-#define PFM_IS_DISABLED() (pmu_conf.enabled == 0)
+#define PMC_IS_LAST(i)	(pmu_conf->pmc_desc[i].type & PFM_REG_END)
+#define PMD_IS_LAST(i)	(pmu_conf->pmd_desc[i].type & PFM_REG_END)
 
 #define PMC_OVFL_NOTIFY(ctx, i)	((ctx)->ctx_pmds[i].flags &  PFM_REGFL_OVFL_NOTIFY)
 
 /* i assumed unsigned */
-#define PMC_IS_IMPL(i)	  (i< PMU_MAX_PMCS && (pmu_conf.pmc_desc[i].type & PFM_REG_IMPL))
-#define PMD_IS_IMPL(i)	  (i< PMU_MAX_PMDS && (pmu_conf.pmd_desc[i].type & PFM_REG_IMPL))
+#define PMC_IS_IMPL(i)	  (i< PMU_MAX_PMCS && (pmu_conf->pmc_desc[i].type & PFM_REG_IMPL))
+#define PMD_IS_IMPL(i)	  (i< PMU_MAX_PMDS && (pmu_conf->pmd_desc[i].type & PFM_REG_IMPL))
 
 /* XXX: these assume that register i is implemented */
-#define PMD_IS_COUNTING(i) ((pmu_conf.pmd_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
-#define PMC_IS_COUNTING(i) ((pmu_conf.pmc_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
-#define PMC_IS_MONITOR(i)  ((pmu_conf.pmc_desc[i].type & PFM_REG_MONITOR)  == PFM_REG_MONITOR)
-#define PMC_IS_CONTROL(i)  ((pmu_conf.pmc_desc[i].type & PFM_REG_CONTROL)  == PFM_REG_CONTROL)
-
-#define PMC_DFL_VAL(i)     pmu_conf.pmc_desc[i].default_value
-#define PMC_RSVD_MASK(i)   pmu_conf.pmc_desc[i].reserved_mask
-#define PMD_PMD_DEP(i)	   pmu_conf.pmd_desc[i].dep_pmd[0]
-#define PMC_PMD_DEP(i)	   pmu_conf.pmc_desc[i].dep_pmd[0]
+#define PMD_IS_COUNTING(i) ((pmu_conf->pmd_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
+#define PMC_IS_COUNTING(i) ((pmu_conf->pmc_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
+#define PMC_IS_MONITOR(i)  ((pmu_conf->pmc_desc[i].type & PFM_REG_MONITOR)  == PFM_REG_MONITOR)
+#define PMC_IS_CONTROL(i)  ((pmu_conf->pmc_desc[i].type & PFM_REG_CONTROL)  == PFM_REG_CONTROL)
+
+#define PMC_DFL_VAL(i)     pmu_conf->pmc_desc[i].default_value
+#define PMC_RSVD_MASK(i)   pmu_conf->pmc_desc[i].reserved_mask
+#define PMD_PMD_DEP(i)	   pmu_conf->pmd_desc[i].dep_pmd[0]
+#define PMC_PMD_DEP(i)	   pmu_conf->pmc_desc[i].dep_pmd[0]
 
 #define PFM_NUM_IBRS	  IA64_NUM_DBG_REGS
 #define PFM_NUM_DBRS	  IA64_NUM_DBG_REGS
@@ -133,6 +132,8 @@
 #define PFM_CPUINFO_SET(v)	pfm_get_cpu_var(pfm_syst_info) |= (v)
 #define PFM_CPUINFO_GET()	pfm_get_cpu_var(pfm_syst_info)
 
+#define RDEP(x)	(1UL<<(x))
+
 /*
  * context protection macros
  * in SMP:
@@ -374,26 +375,32 @@
  * dep_pmd[]: a bitmask of dependent PMD registers
  * dep_pmc[]: a bitmask of dependent PMC registers
  */
+typedef int (*pfm_reg_check_t)(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs);
 typedef struct {
 	unsigned int		type;
 	int			pm_pos;
 	unsigned long		default_value;	/* power-on default value */
 	unsigned long		reserved_mask;	/* bitmask of reserved bits */
-	int			(*read_check)(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs);
-	int			(*write_check)(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs);
+	pfm_reg_check_t		read_check;
+	pfm_reg_check_t		write_check;
 	unsigned long		dep_pmd[4];
 	unsigned long		dep_pmc[4];
 } pfm_reg_desc_t;
 
 /* assume cnum is a valid monitor */
-#define PMC_PM(cnum, val)	(((val) >> (pmu_conf.pmc_desc[cnum].pm_pos)) & 0x1)
-#define PMC_WR_FUNC(cnum)	(pmu_conf.pmc_desc[cnum].write_check)
-#define PMD_WR_FUNC(cnum)	(pmu_conf.pmd_desc[cnum].write_check)
-#define PMD_RD_FUNC(cnum)	(pmu_conf.pmd_desc[cnum].read_check)
+#define PMC_PM(cnum, val)	(((val) >> (pmu_conf->pmc_desc[cnum].pm_pos)) & 0x1)
 
 /*
  * This structure is initialized at boot time and contains
  * a description of the PMU main characteristics.
+ *
+ * If the probe function is defined, detection is based
+ * on its return value: 
+ * 	- 0 means recognized PMU
+ * 	- anything else means not supported
+ * When the probe function is not defined, then the pmu_family field
+ * is used and it must match the host CPU family such that:
+ * 	- cpu->family & config->pmu_family != 0
  */
 typedef struct {
 	unsigned long  ovfl_val;	/* overflow value for counters */
@@ -407,15 +414,18 @@
 	unsigned long  impl_pmds[4];	/* bitmask of implemented PMDS */
 
 	char	      *pmu_name;	/* PMU family name */
-	unsigned int  enabled;		/* indicates if perfmon initialized properly */
 	unsigned int  pmu_family;	/* cpuid family pattern used to identify pmu */
-
+	unsigned int  flags;		/* pmu specific flags */
 	unsigned int  num_ibrs;		/* number of IBRS: computed at init time */
 	unsigned int  num_dbrs;		/* number of DBRS: computed at init time */
 	unsigned int  num_counters;	/* PMC/PMD counting pairs : computed at init time */
-
+	int           (*probe)(void);   /* customized probe routine */
 	unsigned int  use_rr_dbregs:1;	/* set if debug registers used for range restriction */
 } pmu_config_t;
+/*
+ * PMU specific flags
+ */
+#define PFM_PMU_IRQ_RESEND	1	/* PMU needs explicit IRQ resend */
 
 /*
  * debug register related type definitions
@@ -500,6 +510,8 @@
 static spinlock_t		pfm_buffer_fmt_lock;
 static LIST_HEAD(pfm_buffer_fmt_list);
 
+static pmu_config_t		*pmu_conf;
+
 /* sysctl() controls */
 static pfm_sysctl_t pfm_sysctl;
 int pfm_debug_var;
@@ -620,20 +632,19 @@
 #endif
 
 void dump_pmu_state(const char *);
+static int pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
 
-/*
- * the HP simulator must be first because
- * CONFIG_IA64_HP_SIM is independent of CONFIG_MCKINLEY or CONFIG_ITANIUM
- */
-#if defined(CONFIG_IA64_HP_SIM)
-#include "perfmon_hpsim.h"
-#elif   defined(CONFIG_ITANIUM)
 #include "perfmon_itanium.h"
-#elif defined(CONFIG_MCKINLEY)
 #include "perfmon_mckinley.h"
-#else
 #include "perfmon_generic.h"
-#endif
+
+static pmu_config_t *pmu_confs[]={
+	&pmu_conf_mck,
+	&pmu_conf_ita,
+	&pmu_conf_gen, /* must be last */
+	NULL
+};
+
 
 static int pfm_end_notify_user(pfm_context_t *ctx);
 
@@ -702,6 +713,7 @@
 
 	for (i=0; i < nibrs; i++) {
 		ia64_set_ibr(i, ibrs[i]);
+		ia64_dv_serialize_instruction();
 	}
 	ia64_srlz_i();
 }
@@ -713,6 +725,7 @@
 
 	for (i=0; i < ndbrs; i++) {
 		ia64_set_dbr(i, dbrs[i]);
+		ia64_dv_serialize_data();
 	}
 	ia64_srlz_d();
 }
@@ -723,7 +736,7 @@
 static inline unsigned long
 pfm_read_soft_counter(pfm_context_t *ctx, int i)
 {
-	return ctx->ctx_pmds[i].val + (ia64_get_pmd(i) & pmu_conf.ovfl_val);
+	return ctx->ctx_pmds[i].val + (ia64_get_pmd(i) & pmu_conf->ovfl_val);
 }
 
 /*
@@ -732,7 +745,7 @@
 static inline void
 pfm_write_soft_counter(pfm_context_t *ctx, int i, unsigned long val)
 {
-	unsigned long ovfl_val = pmu_conf.ovfl_val;
+	unsigned long ovfl_val = pmu_conf->ovfl_val;
 
 	ctx->ctx_pmds[i].val = val  & ~ovfl_val;
 	/*
@@ -878,7 +891,7 @@
 
 	DPRINT_ovfl(("masking monitoring for [%d]\n", task->pid));
 
-	ovfl_mask = pmu_conf.ovfl_val;
+	ovfl_mask = pmu_conf->ovfl_val;
 	/*
 	 * monitoring can only be masked as a result of a valid
 	 * counter overflow. In UP, it means that the PMU still
@@ -953,7 +966,7 @@
 	int i, is_system;
 
 	is_system = ctx->ctx_fl_system;
-	ovfl_mask = pmu_conf.ovfl_val;
+	ovfl_mask = pmu_conf->ovfl_val;
 
 	if (task != current) {
 		printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task->pid, current->pid);
@@ -1024,8 +1037,8 @@
 	 * XXX: need to optimize 
 	 */
 	if (ctx->ctx_fl_using_dbreg) {
-		pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf.num_ibrs);
-		pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf.num_dbrs);
+		pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
+		pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
 	}
 
 	/*
@@ -1058,7 +1071,7 @@
 pfm_restore_pmds(unsigned long *pmds, unsigned long mask)
 {
 	int i;
-	unsigned long val, ovfl_val = pmu_conf.ovfl_val;
+	unsigned long val, ovfl_val = pmu_conf->ovfl_val;
 
 	for (i=0; mask; i++, mask>>=1) {
 		if ((mask & 0x1) == 0) continue;
@@ -1075,7 +1088,7 @@
 pfm_copy_pmds(struct task_struct *task, pfm_context_t *ctx)
 {
 	struct thread_struct *thread = &task->thread;
-	unsigned long ovfl_val = pmu_conf.ovfl_val;
+	unsigned long ovfl_val = pmu_conf->ovfl_val;
 	unsigned long mask = ctx->ctx_all_pmds[0];
 	unsigned long val;
 	int i;
@@ -2295,6 +2308,8 @@
 		DPRINT(("Cannot allocate vma\n"));
 		goto error_kmem;
 	}
+	memset(vma, 0, sizeof(*vma));
+
 	/*
 	 * partially initialize the vma for the sampling buffer
 	 *
@@ -2305,10 +2320,6 @@
 	vma->vm_mm	     = mm;
 	vma->vm_flags	     = VM_READ| VM_MAYREAD |VM_RESERVED;
 	vma->vm_page_prot    = PAGE_READONLY; /* XXX may need to change */
-	vma->vm_ops	     = NULL;
-	vma->vm_pgoff	     = 0;
-	vma->vm_file	     = NULL;
-	vma->vm_private_data = NULL; 
 
 	/*
 	 * Now we have everything we need and we can initialize
@@ -2513,12 +2524,12 @@
 	  *
 	  * PMC0 is treated differently.
 	  */
-	ctx->ctx_all_pmcs[0] = pmu_conf.impl_pmcs[0] & ~0x1;
+	ctx->ctx_all_pmcs[0] = pmu_conf->impl_pmcs[0] & ~0x1;
 
 	/*
 	 * bitmask of all PMDs that are accesible to this context
 	 */
-	ctx->ctx_all_pmds[0] = pmu_conf.impl_pmds[0];
+	ctx->ctx_all_pmds[0] = pmu_conf->impl_pmds[0];
 
 	DPRINT(("<%d> all_pmcs=0x%lx all_pmds=0x%lx\n", ctx->ctx_fd, ctx->ctx_all_pmcs[0],ctx->ctx_all_pmds[0]));
 
@@ -2858,16 +2869,17 @@
 	unsigned long value, pmc_pm;
 	unsigned long smpl_pmds, reset_pmds, impl_pmds;
 	unsigned int cnum, reg_flags, flags, pmc_type;
-	int i, can_access_pmu = 0, is_loaded, is_system;
+	int i, can_access_pmu = 0, is_loaded, is_system, expert_mode;
 	int is_monitor, is_counting, state;
 	int ret = -EINVAL;
+	pfm_reg_check_t	wr_func;
 #define PFM_CHECK_PMC_PM(x, y, z) ((x)->ctx_fl_system ^ PMC_PM(y, z))
 
 	state     = ctx->ctx_state;
 	is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
 	is_system = ctx->ctx_fl_system;
 	task      = ctx->ctx_task;
-	impl_pmds = pmu_conf.impl_pmds[0];
+	impl_pmds = pmu_conf->impl_pmds[0];
 
 	if (state == PFM_CTX_ZOMBIE) return -EINVAL;
 
@@ -2884,6 +2896,7 @@
 		}
 		can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
 	}
+	expert_mode = pfm_sysctl.expert_mode; 
 
 	for (i = 0; i < count; i++, req++) {
 
@@ -2900,8 +2913,8 @@
 			goto error;
 		}
 
-		pmc_type   = pmu_conf.pmc_desc[cnum].type;
-		pmc_pm     = (value >> pmu_conf.pmc_desc[cnum].pm_pos) & 0x1;
+		pmc_type   = pmu_conf->pmc_desc[cnum].type;
+		pmc_pm     = (value >> pmu_conf->pmc_desc[cnum].pm_pos) & 0x1;
 		is_counting = (pmc_type & PFM_REG_COUNTING) == PFM_REG_COUNTING ? 1 : 0;
 		is_monitor  = (pmc_type & PFM_REG_MONITOR) == PFM_REG_MONITOR ? 1 : 0;
 
@@ -2914,6 +2927,7 @@
 			DPRINT(("pmc%u is unimplemented or no-access pmc_type=%x\n", cnum, pmc_type));
 			goto error;
 		}
+		wr_func = pmu_conf->pmc_desc[cnum].write_check;
 		/*
 		 * If the PMC is a monitor, then if the value is not the default:
 		 * 	- system-wide session: PMCx.pm=1 (privileged monitor)
@@ -2962,8 +2976,8 @@
 		/*
 		 * execute write checker, if any
 		 */
-		if (pfm_sysctl.expert_mode == 0 && PMC_WR_FUNC(cnum)) {
-			ret = PMC_WR_FUNC(cnum)(task, ctx, cnum, &value, regs);
+		if (likely(expert_mode == 0 && wr_func)) {
+			ret = (*wr_func)(task, ctx, cnum, &value, regs);
 			if (ret) goto error;
 			ret = -EINVAL;
 		}
@@ -3014,7 +3028,7 @@
 		 * PMD. Clearing is done indirectly via pfm_reset_pmu_state() so there is no
 		 * possible leak here.
 		 */
-		CTX_USED_PMD(ctx, pmu_conf.pmc_desc[cnum].dep_pmd[0]);
+		CTX_USED_PMD(ctx, pmu_conf->pmc_desc[cnum].dep_pmd[0]);
 
 		/*
 		 * keep track of the monitor PMC that we are using.
@@ -3096,14 +3110,15 @@
 	unsigned long value, hw_value, ovfl_mask;
 	unsigned int cnum;
 	int i, can_access_pmu = 0, state;
-	int is_counting, is_loaded, is_system;
+	int is_counting, is_loaded, is_system, expert_mode;
 	int ret = -EINVAL;
+	pfm_reg_check_t wr_func;
 
 
 	state     = ctx->ctx_state;
 	is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
 	is_system = ctx->ctx_fl_system;
-	ovfl_mask = pmu_conf.ovfl_val;
+	ovfl_mask = pmu_conf->ovfl_val;
 	task      = ctx->ctx_task;
 
 	if (unlikely(state == PFM_CTX_ZOMBIE)) return -EINVAL;
@@ -3125,6 +3140,7 @@
 		}
 		can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
 	}
+	expert_mode = pfm_sysctl.expert_mode; 
 
 	for (i = 0; i < count; i++, req++) {
 
@@ -3136,14 +3152,15 @@
 			goto abort_mission;
 		}
 		is_counting = PMD_IS_COUNTING(cnum);
+		wr_func     = pmu_conf->pmd_desc[cnum].write_check;
 
 		/*
 		 * execute write checker, if any
 		 */
-		if (pfm_sysctl.expert_mode == 0 && PMD_WR_FUNC(cnum)) {
+		if (unlikely(expert_mode == 0 && wr_func)) {
 			unsigned long v = value;
 
-			ret = PMD_WR_FUNC(cnum)(task, ctx, cnum, &v, regs);
+			ret = (*wr_func)(task, ctx, cnum, &v, regs);
 			if (ret) goto abort_mission;
 
 			value = v;
@@ -3289,8 +3306,9 @@
 	pfarg_reg_t *req = (pfarg_reg_t *)arg;
 	unsigned int cnum, reg_flags = 0;
 	int i, can_access_pmu = 0, state;
-	int is_loaded, is_system, is_counting;
+	int is_loaded, is_system, is_counting, expert_mode;
 	int ret = -EINVAL;
+	pfm_reg_check_t rd_func;
 
 	/*
 	 * access is possible when loaded only for
@@ -3300,7 +3318,7 @@
 	state     = ctx->ctx_state;
 	is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
 	is_system = ctx->ctx_fl_system;
-	ovfl_mask = pmu_conf.ovfl_val;
+	ovfl_mask = pmu_conf->ovfl_val;
 	task      = ctx->ctx_task;
 
 	if (state == PFM_CTX_ZOMBIE) return -EINVAL;
@@ -3323,6 +3341,7 @@
 
 		if (can_access_pmu) ia64_srlz_d();
 	}
+	expert_mode = pfm_sysctl.expert_mode; 
 
 	DPRINT(("loaded=%d access_pmu=%d ctx_state=%d\n",
 		is_loaded,
@@ -3369,6 +3388,7 @@
 			 */
 			val = is_loaded ? thread->pmds[cnum] : 0UL;
 		}
+		rd_func = pmu_conf->pmd_desc[cnum].read_check;
 
 		if (is_counting) {
 			/*
@@ -3381,9 +3401,9 @@
 		/*
 		 * execute read checker, if any
 		 */
-		if (unlikely(pfm_sysctl.expert_mode == 0 && PMD_RD_FUNC(cnum))) {
+		if (unlikely(expert_mode == 0 && rd_func)) {
 			unsigned long v = val;
-			ret = PMD_RD_FUNC(cnum)(ctx->ctx_task, ctx, cnum, &v, regs);
+			ret = (*rd_func)(ctx->ctx_task, ctx, cnum, &v, regs);
 			if (ret) goto error;
 			val = v;
 			ret = -EINVAL;
@@ -3463,7 +3483,7 @@
 	unsigned long flags;
 	int ret = 0;
 
-	if (pmu_conf.use_rr_dbregs == 0) return 0;
+	if (pmu_conf->use_rr_dbregs == 0) return 0;
 
 	DPRINT(("called for [%d]\n", task->pid));
 
@@ -3517,7 +3537,7 @@
 	unsigned long flags;
 	int ret;
 
-	if (pmu_conf.use_rr_dbregs == 0) return 0;
+	if (pmu_conf->use_rr_dbregs == 0) return 0;
 
 	LOCK_PFS(flags);
 	if (pfm_sessions.pfs_ptrace_use_dbregs == 0) {
@@ -3720,7 +3740,7 @@
 	int i, can_access_pmu = 0;
 	int is_system, is_loaded;
 
-	if (pmu_conf.use_rr_dbregs == 0) return -EINVAL;
+	if (pmu_conf->use_rr_dbregs == 0) return -EINVAL;
 
 	state     = ctx->ctx_state;
 	is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
@@ -3802,14 +3822,14 @@
  	 */
 	if (first_time && can_access_pmu) {
 		DPRINT(("[%d] clearing ibrs, dbrs\n", task->pid));
-		for (i=0; i < pmu_conf.num_ibrs; i++) {
+		for (i=0; i < pmu_conf->num_ibrs; i++) {
 			ia64_set_ibr(i, 0UL);
-			ia64_srlz_i();
+			ia64_dv_serialize_instruction();
 		}
 		ia64_srlz_i();
-		for (i=0; i < pmu_conf.num_dbrs; i++) {
+		for (i=0; i < pmu_conf->num_dbrs; i++) {
 			ia64_set_dbr(i, 0UL);
-			ia64_srlz_d();
+			ia64_dv_serialize_data();
 		}
 		ia64_srlz_d();
 	}
@@ -3856,7 +3876,10 @@
 		if (mode == PFM_CODE_RR) {
 			CTX_USED_IBR(ctx, rnum);
 
-			if (can_access_pmu) ia64_set_ibr(rnum, dbreg.val);
+			if (can_access_pmu) {
+				ia64_set_ibr(rnum, dbreg.val);
+				ia64_dv_serialize_instruction();
+			}
 
 			ctx->ctx_ibrs[rnum] = dbreg.val;
 
@@ -3865,8 +3888,10 @@
 		} else {
 			CTX_USED_DBR(ctx, rnum);
 
-			if (can_access_pmu) ia64_set_dbr(rnum, dbreg.val);
-
+			if (can_access_pmu) {
+				ia64_set_dbr(rnum, dbreg.val);
+				ia64_dv_serialize_data();
+			}
 			ctx->ctx_dbrs[rnum] = dbreg.val;
 
 			DPRINT(("write dbr%u=0x%lx used_dbrs=0x%x is_loaded=%d access_pmu=%d\n",
@@ -4367,8 +4392,8 @@
 		 * guaranteed safe by earlier check against DBG_VALID
 		 */
 		if (ctx->ctx_fl_using_dbreg) {
-			pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf.num_ibrs);
-			pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf.num_dbrs);
+			pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
+			pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
 		}
 		/*
 		 * set new ownership
@@ -4777,7 +4802,7 @@
 	/*
 	 * reject any call if perfmon was disabled at initialization
 	 */
-	if (unlikely(PFM_IS_DISABLED())) return -ENOSYS;
+	if (unlikely(pmu_conf == NULL)) return -ENOSYS;
 
 	if (unlikely(cmd < 0 || cmd >= PFM_CMD_COUNT)) {
 		DPRINT(("invalid cmd=%d\n", cmd));
@@ -5178,7 +5203,7 @@
 
 	tstamp   = ia64_get_itc();
 	mask     = pmc0 >> PMU_FIRST_COUNTER;
-	ovfl_val = pmu_conf.ovfl_val;
+	ovfl_val = pmu_conf->ovfl_val;
 	has_smpl = CTX_HAS_SMPL(ctx);
 
 	DPRINT_ovfl(("pmc0=0x%lx pid=%d iip=0x%lx, %s "
@@ -5536,111 +5561,185 @@
 	return IRQ_HANDLED;
 }
 
+/*
+ * /proc/perfmon interface, for debug only
+ */
 
-/* for debug only */
-static int
-pfm_proc_info(char *page)
-{
-	char *p = page;
-	struct list_head * pos;
-	pfm_buffer_fmt_t * entry;
-	unsigned long psr, flags;
-	int online_cpus = 0;
-	int i;
+#define PFM_PROC_SHOW_HEADER	((void *)NR_CPUS+1)
 
-		p += sprintf(p, "perfmon version           : %u.%u\n", PFM_VERSION_MAJ, PFM_VERSION_MIN);
-		p += sprintf(p, "model                     : %s\n", pmu_conf.pmu_name);
-		p += sprintf(p, "fastctxsw                 : %s\n", pfm_sysctl.fastctxsw > 0 ? "Yes": "No");
-		p += sprintf(p, "expert mode               : %s\n", pfm_sysctl.expert_mode > 0 ? "Yes": "No");
-		p += sprintf(p, "ovfl_mask                 : 0x%lx\n", pmu_conf.ovfl_val);
-
-	for(i=0; i < NR_CPUS; i++) {
-		if (cpu_online(i) == 0) continue;
-		p += sprintf(p, "CPU%-2d overflow intrs      : %lu\n", i, pfm_stats[i].pfm_ovfl_intr_count);
-		p += sprintf(p, "CPU%-2d overflow cycles     : %lu\n", i, pfm_stats[i].pfm_ovfl_intr_cycles);
-		p += sprintf(p, "CPU%-2d overflow min        : %lu\n", i, pfm_stats[i].pfm_ovfl_intr_cycles_min);
-		p += sprintf(p, "CPU%-2d overflow max        : %lu\n", i, pfm_stats[i].pfm_ovfl_intr_cycles_max);
-		p += sprintf(p, "CPU%-2d smpl handler calls  : %lu\n", i, pfm_stats[i].pfm_smpl_handler_calls);
-		p += sprintf(p, "CPU%-2d smpl handler cycles : %lu\n", i, pfm_stats[i].pfm_smpl_handler_cycles);
-		p += sprintf(p, "CPU%-2d spurious intrs      : %lu\n", i, pfm_stats[i].pfm_spurious_ovfl_intr_count);
-		p += sprintf(p, "CPU%-2d replay   intrs      : %lu\n", i, pfm_stats[i].pfm_replay_ovfl_intr_count);
-		p += sprintf(p, "CPU%-2d syst_wide           : %d\n" , i, pfm_get_cpu_data(pfm_syst_info, i) & PFM_CPUINFO_SYST_WIDE ? 1 : 0);
-		p += sprintf(p, "CPU%-2d dcr_pp              : %d\n" , i, pfm_get_cpu_data(pfm_syst_info, i) & PFM_CPUINFO_DCR_PP ? 1 : 0);
-		p += sprintf(p, "CPU%-2d exclude idle        : %d\n" , i, pfm_get_cpu_data(pfm_syst_info, i) & PFM_CPUINFO_EXCL_IDLE ? 1 : 0);
-		p += sprintf(p, "CPU%-2d owner               : %d\n" , i, pfm_get_cpu_data(pmu_owner, i) ? pfm_get_cpu_data(pmu_owner, i)->pid: -1);
-		p += sprintf(p, "CPU%-2d context             : %p\n" , i, pfm_get_cpu_data(pmu_ctx, i));
-		p += sprintf(p, "CPU%-2d activations         : %lu\n", i, pfm_get_cpu_data(pmu_activation_number,i));
-		online_cpus++;
+static void *
+pfm_proc_start(struct seq_file *m, loff_t *pos)
+{
+	if (*pos == 0) {
+		return PFM_PROC_SHOW_HEADER;
 	}
 
-	if (online_cpus == 1)
-	{
-		psr = pfm_get_psr();
-		ia64_srlz_d();
-		p += sprintf(p, "CPU%-2d psr                 : 0x%lx\n", smp_processor_id(), psr);
-		p += sprintf(p, "CPU%-2d pmc0                : 0x%lx\n", smp_processor_id(), ia64_get_pmc(0));
-		for(i=4; i < 8; i++) {
-   			p += sprintf(p, "CPU%-2d pmc%u                : 0x%lx\n", smp_processor_id(), i, ia64_get_pmc(i));
-   			p += sprintf(p, "CPU%-2d pmd%u                : 0x%lx\n", smp_processor_id(), i, ia64_get_pmd(i));
-  		}
+	while (*pos <= NR_CPUS) {
+		if (cpu_online(*pos - 1)) {
+			return (void *)*pos;
+		}
+		++*pos;
 	}
+	return NULL;
+}
 
-	LOCK_PFS(flags);
-	p += sprintf(p, "proc_sessions             : %u\n"
-			"sys_sessions              : %u\n"
-			"sys_use_dbregs            : %u\n"
-			"ptrace_use_dbregs         : %u\n",
-			pfm_sessions.pfs_task_sessions,
-			pfm_sessions.pfs_sys_sessions,
-			pfm_sessions.pfs_sys_use_dbregs,
-			pfm_sessions.pfs_ptrace_use_dbregs);
-	UNLOCK_PFS(flags);
+static void *
+pfm_proc_next(struct seq_file *m, void *v, loff_t *pos)
+{
+	++*pos;
+	return pfm_proc_start(m, pos);
+}
+
+static void
+pfm_proc_stop(struct seq_file *m, void *v)
+{
+}
+
+static void
+pfm_proc_show_header(struct seq_file *m)
+{
+	struct list_head * pos;
+	pfm_buffer_fmt_t * entry;
+	unsigned long flags;
+
+ 	seq_printf(m,
+		"perfmon version           : %u.%u\n"
+		"model                     : %s\n"
+		"fastctxsw                 : %s\n"
+		"expert mode               : %s\n"
+		"ovfl_mask                 : 0x%lx\n"
+		"PMU flags                 : 0x%x\n",
+		PFM_VERSION_MAJ, PFM_VERSION_MIN,
+		pmu_conf->pmu_name,
+		pfm_sysctl.fastctxsw > 0 ? "Yes": "No",
+		pfm_sysctl.expert_mode > 0 ? "Yes": "No",
+		pmu_conf->ovfl_val,
+		pmu_conf->flags);
+
+  	LOCK_PFS(flags);
+
+ 	seq_printf(m,
+ 		"proc_sessions             : %u\n"
+ 		"sys_sessions              : %u\n"
+ 		"sys_use_dbregs            : %u\n"
+ 		"ptrace_use_dbregs         : %u\n",
+ 		pfm_sessions.pfs_task_sessions,
+ 		pfm_sessions.pfs_sys_sessions,
+ 		pfm_sessions.pfs_sys_use_dbregs,
+ 		pfm_sessions.pfs_ptrace_use_dbregs);
+
+  	UNLOCK_PFS(flags);
 
 	spin_lock(&pfm_buffer_fmt_lock);
 
 	list_for_each(pos, &pfm_buffer_fmt_list) {
 		entry = list_entry(pos, pfm_buffer_fmt_t, fmt_list);
-		p += sprintf(p, "format                    : %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x %s\n",
-				entry->fmt_uuid[0],
-				entry->fmt_uuid[1],
-				entry->fmt_uuid[2],
-				entry->fmt_uuid[3],
-				entry->fmt_uuid[4],
-				entry->fmt_uuid[5],
-				entry->fmt_uuid[6],
-				entry->fmt_uuid[7],
-				entry->fmt_uuid[8],
-				entry->fmt_uuid[9],
-				entry->fmt_uuid[10],
-				entry->fmt_uuid[11],
-				entry->fmt_uuid[12],
-				entry->fmt_uuid[13],
-				entry->fmt_uuid[14],
-				entry->fmt_uuid[15],
-				entry->fmt_name);
+		seq_printf(m, "format                    : %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x %s\n",
+			entry->fmt_uuid[0],
+			entry->fmt_uuid[1],
+			entry->fmt_uuid[2],
+			entry->fmt_uuid[3],
+			entry->fmt_uuid[4],
+			entry->fmt_uuid[5],
+			entry->fmt_uuid[6],
+			entry->fmt_uuid[7],
+			entry->fmt_uuid[8],
+			entry->fmt_uuid[9],
+			entry->fmt_uuid[10],
+			entry->fmt_uuid[11],
+			entry->fmt_uuid[12],
+			entry->fmt_uuid[13],
+			entry->fmt_uuid[14],
+			entry->fmt_uuid[15],
+			entry->fmt_name);
 	}
 	spin_unlock(&pfm_buffer_fmt_lock);
 
-	return p - page;
 }
 
-/* /proc interface, for debug only */
 static int
-perfmon_read_entry(char *page, char **start, off_t off, int count, int *eof, void *data)
+pfm_proc_show(struct seq_file *m, void *v)
 {
-	int len = pfm_proc_info(page);
+	unsigned long psr;
+	unsigned int i;
+	int cpu;
 
-	if (len <= off+count) *eof = 1;
+	if (v == PFM_PROC_SHOW_HEADER) {
+		pfm_proc_show_header(m);
+		return 0;
+	}
+
+	/* show info for CPU (v - 1) */
+
+	cpu = (long)v - 1;
+	seq_printf(m,
+		"CPU%-2d overflow intrs      : %lu\n"
+		"CPU%-2d overflow cycles     : %lu\n"
+		"CPU%-2d overflow min        : %lu\n"
+		"CPU%-2d overflow max        : %lu\n"
+		"CPU%-2d smpl handler calls  : %lu\n"
+		"CPU%-2d smpl handler cycles : %lu\n"
+		"CPU%-2d spurious intrs      : %lu\n"
+		"CPU%-2d replay   intrs      : %lu\n"
+		"CPU%-2d syst_wide           : %d\n"
+		"CPU%-2d dcr_pp              : %d\n"
+		"CPU%-2d exclude idle        : %d\n"
+		"CPU%-2d owner               : %d\n"
+		"CPU%-2d context             : %p\n"
+		"CPU%-2d activations         : %lu\n",
+		cpu, pfm_stats[cpu].pfm_ovfl_intr_count,
+		cpu, pfm_stats[cpu].pfm_ovfl_intr_cycles,
+		cpu, pfm_stats[cpu].pfm_ovfl_intr_cycles_min,
+		cpu, pfm_stats[cpu].pfm_ovfl_intr_cycles_max,
+		cpu, pfm_stats[cpu].pfm_smpl_handler_calls,
+		cpu, pfm_stats[cpu].pfm_smpl_handler_cycles,
+		cpu, pfm_stats[cpu].pfm_spurious_ovfl_intr_count,
+		cpu, pfm_stats[cpu].pfm_replay_ovfl_intr_count,
+		cpu, pfm_get_cpu_data(pfm_syst_info, cpu) & PFM_CPUINFO_SYST_WIDE ? 1 : 0,
+		cpu, pfm_get_cpu_data(pfm_syst_info, cpu) & PFM_CPUINFO_DCR_PP ? 1 : 0,
+		cpu, pfm_get_cpu_data(pfm_syst_info, cpu) & PFM_CPUINFO_EXCL_IDLE ? 1 : 0,
+		cpu, pfm_get_cpu_data(pmu_owner, cpu) ? pfm_get_cpu_data(pmu_owner, cpu)->pid: -1,
+		cpu, pfm_get_cpu_data(pmu_ctx, cpu),
+		cpu, pfm_get_cpu_data(pmu_activation_number, cpu));
 
-	*start = page + off;
-	len   -= off;
+	if (num_online_cpus() == 1 && pfm_sysctl.debug > 0) {
 
-	if (len>count) len = count;
-	if (len<0) len = 0;
+		psr = pfm_get_psr();
+
+		ia64_srlz_d();
 
-	return len;
+		seq_printf(m, 
+			"CPU%-2d psr                 : 0x%lx\n"
+			"CPU%-2d pmc0                : 0x%lx\n", 
+			cpu, psr,
+			cpu, ia64_get_pmc(0));
+
+		for (i=0; PMC_IS_LAST(i) == 0;  i++) {
+			if (PMC_IS_COUNTING(i) == 0) continue;
+   			seq_printf(m, 
+				"CPU%-2d pmc%u                : 0x%lx\n"
+   				"CPU%-2d pmd%u                : 0x%lx\n", 
+				cpu, i, ia64_get_pmc(i),
+				cpu, i, ia64_get_pmd(i));
+  		}
+	}
+	return 0;
 }
 
+struct seq_operations pfm_seq_ops = {
+	.start =	pfm_proc_start,
+ 	.next =		pfm_proc_next,
+ 	.stop =		pfm_proc_stop,
+ 	.show =		pfm_proc_show
+};
+
+static int
+pfm_proc_open(struct inode *inode, struct file *file)
+{
+	return seq_open(file, &pfm_seq_ops);
+}
+
+
 /*
  * we come here as soon as local_cpu_data->pfm_syst_wide is set. this happens
  * during pfm_enable() hence before pfm_start(). We cannot assume monitoring
@@ -5899,6 +5998,7 @@
 	unsigned long pmc_mask = 0UL, pmd_mask = 0UL;
 	unsigned long flags;
 	u64 psr, psr_up;
+	int need_irq_resend;
 
 	ctx = PFM_GET_CTX(task);
 	if (unlikely(ctx == NULL)) return;
@@ -5919,6 +6019,8 @@
 	flags = pfm_protect_ctx_ctxsw(ctx);
 	psr   = pfm_get_psr();
 
+	need_irq_resend = pmu_conf->flags & PFM_PMU_IRQ_RESEND;
+
 	BUG_ON(psr & (IA64_PSR_UP|IA64_PSR_PP));
 	BUG_ON(psr & IA64_PSR_I);
 
@@ -5944,8 +6046,8 @@
 	 * stale state.
 	 */
 	if (ctx->ctx_fl_using_dbreg) {
-		pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf.num_ibrs);
-		pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf.num_dbrs);
+		pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
+		pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
 	}
 	/*
 	 * retrieve saved psr.up
@@ -6004,12 +6106,12 @@
 		ia64_set_pmc(0, t->pmcs[0]);
 		ia64_srlz_d();
 		t->pmcs[0] = 0UL;
-#ifndef CONFIG_MCKINLEY
+
 		/*
 		 * will replay the PMU interrupt
 		 */
-		hw_resend_irq(NULL, IA64_PERFMON_VECTOR);
-#endif
+		if (need_irq_resend) hw_resend_irq(NULL, IA64_PERFMON_VECTOR);
+
 		pfm_stats[smp_processor_id()].pfm_replay_ovfl_intr_count++;
 	}
 
@@ -6061,6 +6163,7 @@
 	struct task_struct *owner;
 	unsigned long pmd_mask, pmc_mask;
 	u64 psr, psr_up;
+	int need_irq_resend;
 
 	owner = GET_PMU_OWNER();
 	ctx   = PFM_GET_CTX(task);
@@ -6079,14 +6182,15 @@
 	 * (not perfmon) by the previous task.
 	 */
 	if (ctx->ctx_fl_using_dbreg) {
-		pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf.num_ibrs);
-		pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf.num_dbrs);
+		pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
+		pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
 	}
 
 	/*
 	 * retrieved saved psr.up
 	 */
 	psr_up = ctx->ctx_saved_psr_up;
+	need_irq_resend = pmu_conf->flags & PFM_PMU_IRQ_RESEND;
 
 	/*
 	 * short path, our state is still there, just
@@ -6143,12 +6247,11 @@
 
 		t->pmcs[0] = 0UL;
 
-#ifndef CONFIG_MCKINLEY
 		/*
 		 * will replay the PMU interrupt
 		 */
-		hw_resend_irq(NULL, IA64_PERFMON_VECTOR);
-#endif
+		if (need_irq_resend) hw_resend_irq(NULL, IA64_PERFMON_VECTOR);
+
 		pfm_stats[smp_processor_id()].pfm_replay_ovfl_intr_count++;
 	}
 
@@ -6222,7 +6325,7 @@
 		 */
 		task->thread.pmcs[0] = 0;
 	}
-	ovfl_val = pmu_conf.ovfl_val;
+	ovfl_val = pmu_conf->ovfl_val;
 	/*
 	 * we save all the used pmds
 	 * we take care of overflows for counting PMDs
@@ -6287,6 +6390,36 @@
  */
 static int init_pfm_fs(void);
 
+static int __init
+pfm_probe_pmu(void)
+{
+	pmu_config_t **p;
+	int family;
+
+	family = local_cpu_data->family;
+	p      = pmu_confs;
+
+	while(*p) {
+		if ((*p)->probe) {
+			if ((*p)->probe() == 0) goto found;
+		} else if ((*p)->pmu_family == family || (*p)->pmu_family == 0xff) {
+			goto found;
+		}
+		p++;
+	}
+	return -1;
+found:
+	pmu_conf = *p;
+	return 0;
+}
+
+static struct file_operations pfm_proc_fops = {
+	.open		= pfm_proc_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
+};
+
 int __init
 pfm_init(void)
 {
@@ -6297,12 +6430,9 @@
 		PFM_VERSION_MIN,
 		IA64_PERFMON_VECTOR);
 
-	/*
-	 * PMU type sanity check
-	 * XXX: maybe better to implement autodetection (but then we have a larger kernel)
-	 */
-	if (local_cpu_data->family != pmu_conf.pmu_family) {
-		printk(KERN_INFO "perfmon: disabled, kernel only supports %s PMU family\n", pmu_conf.pmu_name);
+	if (pfm_probe_pmu()) {
+		printk(KERN_INFO "perfmon: disabled, there is no support for processor family %d\n", 
+				local_cpu_data->family);
 		return -ENODEV;
 	}
 
@@ -6313,56 +6443,64 @@
 	n = 0;
 	for (i=0; PMC_IS_LAST(i) == 0;  i++) {
 		if (PMC_IS_IMPL(i) == 0) continue;
-		pmu_conf.impl_pmcs[i>>6] |= 1UL << (i&63);
+		pmu_conf->impl_pmcs[i>>6] |= 1UL << (i&63);
 		n++;
 	}
-	pmu_conf.num_pmcs = n;
+	pmu_conf->num_pmcs = n;
 
 	n = 0; n_counters = 0;
 	for (i=0; PMD_IS_LAST(i) == 0;  i++) {
 		if (PMD_IS_IMPL(i) == 0) continue;
-		pmu_conf.impl_pmds[i>>6] |= 1UL << (i&63);
+		pmu_conf->impl_pmds[i>>6] |= 1UL << (i&63);
 		n++;
 		if (PMD_IS_COUNTING(i)) n_counters++;
 	}
-	pmu_conf.num_pmds      = n;
-	pmu_conf.num_counters  = n_counters;
+	pmu_conf->num_pmds      = n;
+	pmu_conf->num_counters  = n_counters;
 
 	/*
 	 * sanity checks on the number of debug registers
 	 */
-	if (pmu_conf.use_rr_dbregs) {
-		if (pmu_conf.num_ibrs > IA64_NUM_DBG_REGS) {
-			printk(KERN_INFO "perfmon: unsupported number of code debug registers (%u)\n", pmu_conf.num_ibrs);
+	if (pmu_conf->use_rr_dbregs) {
+		if (pmu_conf->num_ibrs > IA64_NUM_DBG_REGS) {
+			printk(KERN_INFO "perfmon: unsupported number of code debug registers (%u)\n", pmu_conf->num_ibrs);
+			pmu_conf = NULL;
 			return -1;
 		}
-		if (pmu_conf.num_dbrs > IA64_NUM_DBG_REGS) {
-			printk(KERN_INFO "perfmon: unsupported number of data debug registers (%u)\n", pmu_conf.num_ibrs);
+		if (pmu_conf->num_dbrs > IA64_NUM_DBG_REGS) {
+			printk(KERN_INFO "perfmon: unsupported number of data debug registers (%u)\n", pmu_conf->num_ibrs);
+			pmu_conf = NULL;
 			return -1;
 		}
 	}
 
 	printk("perfmon: %s PMU detected, %u PMCs, %u PMDs, %u counters (%lu bits)\n",
-	       pmu_conf.pmu_name,
-	       pmu_conf.num_pmcs,
-	       pmu_conf.num_pmds,
-	       pmu_conf.num_counters,
-	       ffz(pmu_conf.ovfl_val));
+	       pmu_conf->pmu_name,
+	       pmu_conf->num_pmcs,
+	       pmu_conf->num_pmds,
+	       pmu_conf->num_counters,
+	       ffz(pmu_conf->ovfl_val));
 
 	/* sanity check */
-	if (pmu_conf.num_pmds >= IA64_NUM_PMD_REGS || pmu_conf.num_pmcs >= IA64_NUM_PMC_REGS) {
+	if (pmu_conf->num_pmds >= IA64_NUM_PMD_REGS || pmu_conf->num_pmcs >= IA64_NUM_PMC_REGS) {
 		printk(KERN_ERR "perfmon: not enough pmc/pmd, perfmon disabled\n");
+		pmu_conf = NULL;
 		return -1;
 	}
 
 	/*
 	 * create /proc/perfmon (mostly for debugging purposes)
 	 */
-	perfmon_dir = create_proc_read_entry ("perfmon", 0, 0, perfmon_read_entry, NULL);
+ 	perfmon_dir = create_proc_entry("perfmon", S_IRUGO, NULL);
 	if (perfmon_dir == NULL) {
 		printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n");
+		pmu_conf = NULL;
 		return -1;
 	}
+  	/*
+ 	 * install customized file operations for /proc/perfmon entry
+ 	 */
+ 	perfmon_dir->proc_fops = &pfm_proc_fops;
 
 	/*
 	 * create /proc/sys/kernel/perfmon (for debugging purposes)
@@ -6379,9 +6517,6 @@
 
 	for(i=0; i < NR_CPUS; i++) pfm_stats[i].pfm_ovfl_intr_cycles_min = ~0UL;
 
-	/* we are all set */
-	pmu_conf.enabled = 1;
-
 	return 0;
 }
 
@@ -6393,8 +6528,6 @@
 void
 pfm_init_percpu (void)
 {
-	int i;
-
 	/*
 	 * make sure no measurement is active
 	 * (may inherit programmed PMCs from EFI).
@@ -6412,28 +6545,6 @@
 
 	ia64_setreg(_IA64_REG_CR_PMV, IA64_PERFMON_VECTOR);
 	ia64_srlz_d();
-
-	/*
-	 * we first initialize the PMU to a stable state.
-	 * the values may have been changed from their power-up
-	 * values by software executed before the kernel took over.
-	 *
-	 * At this point, pmu_conf has not yet been initialized
-	 *
-	 * On McKinley, this code is ineffective until PMC4 is initialized
-	 * but that's all right because we take care of pmc0 later.
-	 *
-	 * XXX: potential problems with pmc1.
-	 */
-	for (i=1; PMC_IS_LAST(i) == 0;  i++) {
-		if (PMC_IS_IMPL(i) == 0) continue;
-		ia64_set_pmc(i, PMC_DFL_VAL(i));
-	}
-
-	for (i=0; PMD_IS_LAST(i) == 0; i++) {
-		if (PMD_IS_IMPL(i) == 0) continue;
-		ia64_set_pmd(i, 0UL);
-	}
 }
 
 /*
diff -Nru a/arch/ia64/kernel/perfmon_generic.h b/arch/ia64/kernel/perfmon_generic.h
--- a/arch/ia64/kernel/perfmon_generic.h	Tue Jun 15 22:20:39 2004
+++ b/arch/ia64/kernel/perfmon_generic.h	Tue Jun 15 22:20:39 2004
@@ -6,13 +6,6 @@
  *               Stephane Eranian <eranian@hpl.hp.com>
  */
 
-
-#define RDEP(x)	(1UL<<(x))
-
-#if defined(CONFIG_ITANIUM) || defined (CONFIG_MCKINLEY)
-#error "This file should not be used when CONFIG_ITANIUM or CONFIG_MCKINLEY is defined"
-#endif
-
 static pfm_reg_desc_t pfm_gen_pmc_desc[PMU_MAX_PMCS]={
 /* pmc0  */ { PFM_REG_CONTROL , 0, 0x1UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
 /* pmc1  */ { PFM_REG_CONTROL , 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
@@ -40,10 +33,9 @@
 /*
  * impl_pmcs, impl_pmds are computed at runtime to minimize errors!
  */
-static pmu_config_t pmu_conf={
+static pmu_config_t pmu_conf_gen={
 	.pmu_name   = "Generic",
 	.pmu_family = 0xff, /* any */
-	.enabled    = 0,
 	.ovfl_val   = (1UL << 32) - 1,
 	.num_ibrs   = 0, /* does not use */
 	.num_dbrs   = 0, /* does not use */
diff -Nru a/arch/ia64/kernel/perfmon_hpsim.h b/arch/ia64/kernel/perfmon_hpsim.h
--- a/arch/ia64/kernel/perfmon_hpsim.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,75 +0,0 @@
-/*
- * This file contains the HP SKI Simulator PMU register description tables
- * and pmc checkers used by perfmon.c.
- *
- * Copyright (C) 2002-2003  Hewlett Packard Co
- *               Stephane Eranian <eranian@hpl.hp.com>
- *
- * File mostly contributed by Ian Wienand <ianw@gelato.unsw.edu.au>
- *
- * This file is included as a dummy template so the kernel does not
- * try to initalize registers the simulator can't handle.
- *
- * Note the simulator does not (currently) implement these registers, i.e.,
- * they do not count anything. But you can read/write them.
- */
-
-#define RDEP(x)	(1UL<<(x))
-
-#ifndef CONFIG_IA64_HP_SIM
-#error "This file should only be included for the HP Simulator"
-#endif
-
-static pfm_reg_desc_t pfm_hpsim_pmc_desc[PMU_MAX_PMCS]={
-/* pmc0  */ { PFM_REG_CONTROL , 0, 0x1UL, -1UL, NULL, NULL, {0UL, 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc1  */ { PFM_REG_CONTROL , 0, 0x0UL, -1UL, NULL, NULL, {0UL, 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc2  */ { PFM_REG_CONTROL , 0, 0x0UL, -1UL, NULL, NULL, {0UL, 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc3  */ { PFM_REG_CONTROL , 0, 0x0UL, -1UL, NULL, NULL, {0UL, 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc4  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(4), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc5  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(5), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc6  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(6), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc7  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(7), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc8  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(8), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc9  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(9), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc10 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(10), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc11 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(11), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc12 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(12), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc13 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(13), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc14 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(14), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmc15 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {RDEP(15), 0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-	    { PFM_REG_END     , 0, 0x0UL, -1UL, NULL, NULL, {0,}, {0,}}, /* end marker */
-};
-
-static pfm_reg_desc_t pfm_hpsim_pmd_desc[PMU_MAX_PMDS]={
-/* pmd0  */ { PFM_REG_BUFFER, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmd1  */ { PFM_REG_BUFFER, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmd2  */ { PFM_REG_BUFFER, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmd3  */ { PFM_REG_BUFFER, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
-/* pmd4  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(4),0UL, 0UL, 0UL}},
-/* pmd5  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(5),0UL, 0UL, 0UL}},
-/* pmd6  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(6),0UL, 0UL, 0UL}},
-/* pmd7  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(7),0UL, 0UL, 0UL}},
-/* pmd8  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(8),0UL, 0UL, 0UL}},
-/* pmd9  */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(9),0UL, 0UL, 0UL}},
-/* pmd10 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(10),0UL, 0UL, 0UL}},
-/* pmd11 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(11),0UL, 0UL, 0UL}},
-/* pmd12 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(12),0UL, 0UL, 0UL}},
-/* pmd13 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(13),0UL, 0UL, 0UL}},
-/* pmd14 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(14),0UL, 0UL, 0UL}},
-/* pmd15 */ { PFM_REG_COUNTING, 0, 0x0UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {RDEP(15),0UL, 0UL, 0UL}},
-	    { PFM_REG_END     , 0, 0x0UL, -1UL, NULL, NULL, {0,}, {0,}}, /* end marker */
-};
-
-/*
- * impl_pmcs, impl_pmds are computed at runtime to minimize errors!
- */
-static pmu_config_t pmu_conf={
-	.pmu_name   = "hpsim",
-	.pmu_family = 0x7, /* ski emulator reports as Itanium */
-	.enabled    = 0,
-	.ovfl_val   = (1UL << 32) - 1,
-	.num_ibrs   = 0, /* does not use */
-	.num_dbrs   = 0, /* does not use */
-	.pmd_desc   = pfm_hpsim_pmd_desc,
-	.pmc_desc   = pfm_hpsim_pmc_desc
-};
diff -Nru a/arch/ia64/kernel/perfmon_itanium.h b/arch/ia64/kernel/perfmon_itanium.h
--- a/arch/ia64/kernel/perfmon_itanium.h	Tue Jun 15 22:21:05 2004
+++ b/arch/ia64/kernel/perfmon_itanium.h	Tue Jun 15 22:21:05 2004
@@ -5,15 +5,7 @@
  * Copyright (C) 2002-2003  Hewlett Packard Co
  *               Stephane Eranian <eranian@hpl.hp.com>
  */
-
-#define RDEP(x)	(1UL<<(x))
-
-#ifndef CONFIG_ITANIUM
-#error "This file is only valid when CONFIG_ITANIUM is defined"
-#endif
-
 static int pfm_ita_pmc_check(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs);
-static int pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
 
 static pfm_reg_desc_t pfm_ita_pmc_desc[PMU_MAX_PMCS]={
 /* pmc0  */ { PFM_REG_CONTROL , 0, 0x1UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
@@ -55,31 +47,22 @@
 	    { PFM_REG_END     , 0, 0UL, -1UL, NULL, NULL, {0,}, {0,}}, /* end marker */
 };
 
-/*
- * impl_pmcs, impl_pmds are computed at runtime to minimize errors!
- */
-static pmu_config_t pmu_conf={
-	.pmu_name      = "Itanium",
-	.pmu_family    = 0x7,
-	.enabled       = 0,
-	.ovfl_val      = (1UL << 32) - 1,
-	.pmd_desc      = pfm_ita_pmd_desc,
-	.pmc_desc      = pfm_ita_pmc_desc,
-	.num_ibrs      = 8,
-	.num_dbrs      = 8,
-	.use_rr_dbregs = 1 /* debug register are use for range retrictions */
-};
-
 static int
 pfm_ita_pmc_check(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs)
 {
 	int ret;
+	int is_loaded;
+
+	/* sanitfy check */
+	if (ctx == NULL) return -EINVAL;
+
+	is_loaded = ctx->ctx_state == PFM_CTX_LOADED || ctx->ctx_state == PFM_CTX_MASKED;
 
 	/*
 	 * we must clear the (instruction) debug registers if pmc13.ta bit is cleared
 	 * before they are written (fl_using_dbreg==0) to avoid picking up stale information.
 	 */
-	if (cnum == 13 && ((*val & 0x1) == 0UL) && ctx->ctx_fl_using_dbreg == 0) {
+	if (cnum == 13 && is_loaded && ((*val & 0x1) == 0UL) && ctx->ctx_fl_using_dbreg == 0) {
 
 		DPRINT(("pmc[%d]=0x%lx has active pmc13.ta cleared, clearing ibr\n", cnum, *val));
 
@@ -98,7 +81,7 @@
 	 * we must clear the (data) debug registers if pmc11.pt bit is cleared
 	 * before they are written (fl_using_dbreg==0) to avoid picking up stale information.
 	 */
-	if (cnum == 11 && ((*val >> 28)& 0x1) == 0 && ctx->ctx_fl_using_dbreg == 0) {
+	if (cnum == 11 && is_loaded && ((*val >> 28)& 0x1) == 0 && ctx->ctx_fl_using_dbreg == 0) {
 
 		DPRINT(("pmc[%d]=0x%lx has active pmc11.pt cleared, clearing dbr\n", cnum, *val));
 
@@ -114,4 +97,19 @@
 	}
 	return 0;
 }
+
+/*
+ * impl_pmcs, impl_pmds are computed at runtime to minimize errors!
+ */
+static pmu_config_t pmu_conf_ita={
+	.pmu_name      = "Itanium",
+	.pmu_family    = 0x7,
+	.ovfl_val      = (1UL << 32) - 1,
+	.pmd_desc      = pfm_ita_pmd_desc,
+	.pmc_desc      = pfm_ita_pmc_desc,
+	.num_ibrs      = 8,
+	.num_dbrs      = 8,
+	.use_rr_dbregs = 1, /* debug register are use for range retrictions */
+};
+
 
diff -Nru a/arch/ia64/kernel/perfmon_mckinley.h b/arch/ia64/kernel/perfmon_mckinley.h
--- a/arch/ia64/kernel/perfmon_mckinley.h	Tue Jun 15 22:20:43 2004
+++ b/arch/ia64/kernel/perfmon_mckinley.h	Tue Jun 15 22:20:43 2004
@@ -5,15 +5,7 @@
  * Copyright (C) 2002-2003  Hewlett Packard Co
  *               Stephane Eranian <eranian@hpl.hp.com>
  */
-
-#define RDEP(x)	(1UL<<(x))
-
-#ifndef CONFIG_MCKINLEY
-#error "This file is only valid when CONFIG_MCKINLEY is defined"
-#endif
-
 static int pfm_mck_pmc_check(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs);
-static int pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
 
 static pfm_reg_desc_t pfm_mck_pmc_desc[PMU_MAX_PMCS]={
 /* pmc0  */ { PFM_REG_CONTROL , 0, 0x1UL, -1UL, NULL, NULL, {0UL,0UL, 0UL, 0UL}, {0UL,0UL, 0UL, 0UL}},
@@ -58,21 +50,6 @@
 };
 
 /*
- * impl_pmcs, impl_pmds are computed at runtime to minimize errors!
- */
-static pmu_config_t pmu_conf={
-	.pmu_name      = "Itanium 2",
-	.pmu_family    = 0x1f,
-	.enabled       = 0,
-	.ovfl_val      = (1UL << 47) - 1,
-	.pmd_desc      = pfm_mck_pmd_desc,
-	.pmc_desc      = pfm_mck_pmc_desc,
-	.num_ibrs       = 8,
-	.num_dbrs       = 8,
-	.use_rr_dbregs = 1 /* debug register are use for range retrictions */
-};
-
-/*
  * PMC reserved fields must have their power-up values preserved
  */
 static int
@@ -120,12 +97,11 @@
 	 * 	one of the pmc13.cfg_dbrpXX field is different from 0x3
 	 * AND
 	 * 	at the corresponding pmc13.ena_dbrpXX is set.
-	 *
-	 * For now, we just check on cfg_dbrXX != 0x3.
 	 */
 	DPRINT(("cnum=%u val=0x%lx, using_dbreg=%d loaded=%d\n", cnum, *val, ctx->ctx_fl_using_dbreg, is_loaded));
 
-	if (cnum == 13 && is_loaded && ((*val & 0x18181818UL) != 0x18181818UL) && ctx->ctx_fl_using_dbreg == 0) {
+	if (cnum == 13 && is_loaded
+	    && (*val & 0x1e00000000000UL) && (*val & 0x18181818UL) != 0x18181818UL && ctx->ctx_fl_using_dbreg == 0) {
 
 		DPRINT(("pmc[%d]=0x%lx has active pmc13 settings, clearing dbr\n", cnum, *val));
 
@@ -192,3 +168,20 @@
 
 	return ret ? -EINVAL : 0;
 }
+
+/*
+ * impl_pmcs, impl_pmds are computed at runtime to minimize errors!
+ */
+static pmu_config_t pmu_conf_mck={
+	.pmu_name      = "Itanium 2",
+	.pmu_family    = 0x1f,
+	.flags	       = PFM_PMU_IRQ_RESEND,
+	.ovfl_val      = (1UL << 47) - 1,
+	.pmd_desc      = pfm_mck_pmd_desc,
+	.pmc_desc      = pfm_mck_pmc_desc,
+	.num_ibrs       = 8,
+	.num_dbrs       = 8,
+	.use_rr_dbregs = 1 /* debug register are use for range retrictions */
+};
+
+
diff -Nru a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
--- a/arch/ia64/kernel/process.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/kernel/process.c	Tue Jun 15 22:20:40 2004
@@ -7,6 +7,7 @@
 #define __KERNEL_SYSCALLS__	/* see <asm/unistd.h> */
 #include <linux/config.h>
 
+#include <linux/cpu.h>
 #include <linux/pm.h>
 #include <linux/elf.h>
 #include <linux/errno.h>
@@ -14,6 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/personality.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -22,13 +24,17 @@
 #include <linux/thread_info.h>
 #include <linux/unistd.h>
 #include <linux/efi.h>
+#include <linux/interrupt.h>
 
+#include <asm/cpu.h>
 #include <asm/delay.h>
 #include <asm/elf.h>
 #include <asm/ia32.h>
+#include <asm/irq.h>
 #include <asm/pgalloc.h>
 #include <asm/processor.h>
 #include <asm/sal.h>
+#include <asm/tlbflush.h>
 #include <asm/uaccess.h>
 #include <asm/unwind.h>
 #include <asm/user.h>
@@ -90,6 +96,7 @@
 {
 	unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
 
+	print_modules();
 	printk("\nPid: %d, CPU %d, comm: %20s\n", current->pid, smp_processor_id(), current->comm);
 	printk("psr : %016lx ifs : %016lx ip  : [<%016lx>]    %s\n",
 	       regs->cr_ipsr, regs->cr_ifs, ip, print_tainted());
@@ -180,6 +187,40 @@
 			safe_halt();
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+/* We don't actually take CPU down, just spin without interrupts. */
+static inline void play_dead(void)
+{
+	extern void ia64_cpu_local_tick (void);
+	/* Ack it */
+	__get_cpu_var(cpu_state) = CPU_DEAD;
+
+	/* We shouldn't have to disable interrupts while dead, but
+	 * some interrupts just don't seem to go away, and this makes
+	 * it "work" for testing purposes. */
+	max_xtp();
+	local_irq_disable();
+	/* Death loop */
+	while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
+		cpu_relax();
+
+	/*
+	 * Enable timer interrupts from now on
+	 * Not required if we put processor in SAL_BOOT_RENDEZ mode.
+	 */
+	local_flush_tlb_all();
+	cpu_set(smp_processor_id(), cpu_online_map);
+	wmb();
+	ia64_cpu_local_tick ();
+	local_irq_enable();
+}
+#else
+static inline void play_dead(void)
+{
+	BUG();
+}
+#endif /* CONFIG_HOTPLUG_CPU */
+
 void __attribute__((noreturn))
 cpu_idle (void *unused)
 {
@@ -195,7 +236,6 @@
 		if (!need_resched())
 			min_xtp();
 #endif
-
 		while (!need_resched()) {
 			if (mark_idle)
 				(*mark_idle)(1);
@@ -210,6 +250,8 @@
 #endif
 		schedule();
 		check_pgt_cache();
+		if (cpu_is_offline(smp_processor_id()))
+			play_dead();
 	}
 }
 
@@ -657,11 +699,6 @@
 	struct unw_frame_info info;
 	unsigned long ip;
 	int count = 0;
-	/*
-	 * These bracket the sleeping functions..
-	 */
-#	define first_sched	((unsigned long) scheduling_functions_start_here)
-#	define last_sched	((unsigned long) scheduling_functions_end_here)
 
 	/*
 	 * Note: p may not be a blocked task (it could be current or
@@ -676,12 +713,10 @@
 		if (unw_unwind(&info) < 0)
 			return 0;
 		unw_get_ip(&info, &ip);
-		if (ip < first_sched || ip >= last_sched)
+		if (!in_sched_functions(ip))
 			return ip;
 	} while (count++ < 16);
 	return 0;
-#	undef first_sched
-#	undef last_sched
 }
 
 void
diff -Nru a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c
--- a/arch/ia64/kernel/sal.c	Tue Jun 15 22:21:03 2004
+++ b/arch/ia64/kernel/sal.c	Tue Jun 15 22:21:03 2004
@@ -122,10 +122,23 @@
 static void __init
 set_smp_redirect (int flag)
 {
+#ifndef CONFIG_HOTPLUG_CPU
 	if (no_int_routing)
 		smp_int_redirect &= ~flag;
 	else
 		smp_int_redirect |= flag;
+#else
+	/*
+	 * For CPU Hotplug we dont want to do any chipset supported
+	 * interrupt redirection. The reason is this would require that
+	 * All interrupts be stopped and hard bind the irq to a cpu.
+	 * Later when the interrupt is fired we need to set the redir hint
+	 * on again in the vector. This is combersome for something that the
+	 * user mode irq balancer will solve anyways.
+	 */
+	no_int_routing=1;
+	smp_int_redirect &= ~flag;
+#endif
 }
 #else
 #define set_smp_redirect(flag)	do { } while (0)
diff -Nru a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ia64/kernel/setup.c	Tue Jun 15 22:20:37 2004
@@ -330,18 +330,8 @@
 		setup_serial_hcdp(efi.hcdp);
 	}
 #endif
-	/*
-	 * Without HCDP, we won't discover any serial ports until the serial driver looks
-	 * in the ACPI namespace.  If ACPI claims there are some legacy devices, register
-	 * the legacy COM ports so serial console works earlier.  This is slightly dangerous
-	 * because we don't *really* know whether there's anything there, but we hope that
-	 * all new boxes will implement HCDP.
-	 */
-	{
-		extern unsigned char acpi_legacy_devices;
-		if (!efi.hcdp && acpi_legacy_devices)
-			setup_serial_legacy();
-	}
+	if (!efi.hcdp)
+		setup_serial_legacy();
 #endif
 
 #ifdef CONFIG_VT
@@ -575,7 +565,7 @@
 void
 cpu_init (void)
 {
-	extern void __init ia64_mmu_init (void *);
+	extern void __devinit ia64_mmu_init (void *);
 	unsigned long num_phys_stacked;
 	pal_vm_info_2_u_t vmi;
 	unsigned int max_ctx;
@@ -634,6 +624,9 @@
 #ifdef CONFIG_IA32_SUPPORT
 	ia32_cpu_init();
 #endif
+
+	/* Clear ITC to eliminiate sched_clock() overflows in human time.  */
+	ia64_set_itc(0);
 
 	/* disable all local interrupt sources: */
 	ia64_set_itv(1 << 16);
diff -Nru a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
--- a/arch/ia64/kernel/signal.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ia64/kernel/signal.c	Tue Jun 15 22:20:41 2004
@@ -42,23 +42,6 @@
 # define GET_SIGSET(k,u)	__get_user((k)->sig[0], &(u)->sig[0])
 #endif
 
-#ifdef ASM_SUPPORTED
-/*
- * Don't let GCC uses f16-f31 so that when we setup/restore the registers in the signal
- * context in __kernel_sigtramp(), we can be sure that registers f16-f31 contain user-level
- * values.
- */
-register double f16 asm ("f16"); register double f17 asm ("f17");
-register double f18 asm ("f18"); register double f19 asm ("f19");
-register double f20 asm ("f20"); register double f21 asm ("f21");
-register double f22 asm ("f22"); register double f23 asm ("f23");
-
-register double f24 asm ("f24"); register double f25 asm ("f25");
-register double f26 asm ("f26"); register double f27 asm ("f27");
-register double f28 asm ("f28"); register double f29 asm ("f29");
-register double f30 asm ("f30"); register double f31 asm ("f31");
-#endif
-
 long
 ia64_rt_sigsuspend (sigset_t *uset, size_t sigsetsize, struct sigscratch *scr)
 {
diff -Nru a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
--- a/arch/ia64/kernel/smp.c	Tue Jun 15 22:21:04 2004
+++ b/arch/ia64/kernel/smp.c	Tue Jun 15 22:21:04 2004
@@ -28,7 +28,6 @@
 #include <linux/mm.h>
 #include <linux/cache.h>
 #include <linux/delay.h>
-#include <linux/cache.h>
 #include <linux/efi.h>
 
 #include <asm/atomic.h>
@@ -71,10 +70,23 @@
 /* This needs to be cacheline aligned because it is written to by *other* CPUs.  */
 static DEFINE_PER_CPU(u64, ipi_operation) ____cacheline_aligned;
 
+extern void cpu_halt (void);
+
+void
+lock_ipi_calllock(void)
+{
+	spin_lock_irq(&call_lock);
+}
+
+void
+unlock_ipi_calllock(void)
+{
+	spin_unlock_irq(&call_lock);
+}
+
 static void
 stop_this_cpu (void)
 {
-	extern void cpu_halt (void);
 	/*
 	 * Remove this CPU:
 	 */
@@ -84,6 +96,17 @@
 	cpu_halt();
 }
 
+void
+cpu_die(void)
+{
+	max_xtp();
+	local_irq_disable();
+	cpu_halt();
+	/* Should never be here */
+	BUG();
+	for (;;);
+}
+
 irqreturn_t
 handle_IPI (int irq, void *dev_id, struct pt_regs *regs)
 {
@@ -307,6 +330,9 @@
 
 	if (!cpus)
 		return 0;
+
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
 
 	data.func = func;
 	data.info = info;
diff -Nru a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
--- a/arch/ia64/kernel/smpboot.c	Tue Jun 15 22:20:38 2004
+++ b/arch/ia64/kernel/smpboot.c	Tue Jun 15 22:20:38 2004
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/acpi.h>
 #include <linux/bootmem.h>
+#include <linux/cpu.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -22,10 +23,12 @@
 #include <linux/kernel.h>
 #include <linux/kernel_stat.h>
 #include <linux/mm.h>
+#include <linux/notifier.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/spinlock.h>
 #include <linux/efi.h>
+#include <linux/percpu.h>
 
 #include <asm/atomic.h>
 #include <asm/bitops.h>
@@ -44,6 +47,7 @@
 #include <asm/ptrace.h>
 #include <asm/sal.h>
 #include <asm/system.h>
+#include <asm/tlbflush.h>
 #include <asm/unistd.h>
 
 #define SMP_DEBUG 0
@@ -69,17 +73,22 @@
 
 #define DEBUG_ITC_SYNC	0
 
-extern void __init calibrate_delay (void);
+extern void __devinit calibrate_delay (void);
 extern void start_ap (void);
 extern unsigned long ia64_iobase;
 
 task_t *task_for_booting_cpu;
 
-/* Bitmask of currently online CPUs */
+/*
+ * State for each CPU
+ */
+DEFINE_PER_CPU(int, cpu_state);
+
+/* Bitmasks of currently online, and possible CPUs */
 cpumask_t cpu_online_map;
 EXPORT_SYMBOL(cpu_online_map);
-cpumask_t phys_cpu_present_map;
-EXPORT_SYMBOL(phys_cpu_present_map);
+cpumask_t cpu_possible_map;
+EXPORT_SYMBOL(cpu_possible_map);
 
 /* which logical CPU number maps to which CPU (physical APIC ID) */
 volatile int ia64_cpu_to_sapicid[NR_CPUS];
@@ -99,6 +108,7 @@
 nointroute (char *str)
 {
 	no_int_routing = 1;
+	printk ("no_int_routing on\n");
 	return 1;
 }
 
@@ -192,7 +202,6 @@
 {
 	long i, delta, adj, adjust_latency = 0, done = 0;
 	unsigned long flags, rt, master_time_stamp, bound;
-	extern void ia64_cpu_local_tick (void);
 #if DEBUG_ITC_SYNC
 	struct {
 		long rt;	/* roundtrip time */
@@ -202,6 +211,14 @@
 	} t[NUM_ROUNDS];
 #endif
 
+	/*
+	 * Make sure local timer ticks are disabled while we sync.  If
+	 * they were enabled, we'd have to worry about nasty issues
+	 * like setting the ITC ahead of (or a long time before) the
+	 * next scheduled tick.
+	 */
+	BUG_ON((ia64_get_itv() & (1 << 16)) == 0);
+
 	go[MASTER] = 1;
 
 	if (smp_call_function_single(master, sync_master, NULL, 1, 0) < 0) {
@@ -247,27 +264,17 @@
 
 	printk(KERN_INFO "CPU %d: synchronized ITC with CPU %u (last diff %ld cycles, "
 	       "maxerr %lu cycles)\n", smp_processor_id(), master, delta, rt);
-
-	/*
-	 * Check whether we sync'd the itc ahead of the next timer interrupt.  If so, just
-	 * reset it.
-	 */
-	if (time_after(ia64_get_itc(), local_cpu_data->itm_next)) {
-		Dprintk("CPU %d: oops, jumped a timer tick; resetting timer.\n",
-			smp_processor_id());
-		ia64_cpu_local_tick();
-	}
 }
 
 /*
  * Ideally sets up per-cpu profiling hooks.  Doesn't do much now...
  */
-static inline void __init
+static inline void __devinit
 smp_setup_percpu_timer (void)
 {
 }
 
-static void __init
+static void __devinit
 smp_callin (void)
 {
 	int cpuid, phys_id;
@@ -280,23 +287,17 @@
 	cpuid = smp_processor_id();
 	phys_id = hard_smp_processor_id();
 
-	if (cpu_test_and_set(cpuid, cpu_online_map)) {
+	if (cpu_online(cpuid)) {
 		printk(KERN_ERR "huh, phys CPU#0x%x, CPU#0x%x already present??\n",
 		       phys_id, cpuid);
 		BUG();
 	}
 
-	smp_setup_percpu_timer();
-
-	/*
-	 * Get our bogomips.
-	 */
-	ia64_init_itm();
+	lock_ipi_calllock();
+	cpu_set(cpuid, cpu_online_map);
+	unlock_ipi_calllock();
 
-	/*
-	 * Set I/O port base per CPU
-	 */
-	ia64_set_kr(IA64_KR_IO_BASE, __pa(ia64_iobase));
+	smp_setup_percpu_timer();
 
 	ia64_mca_cmc_vector_setup();	/* Setup vector on AP & enable */
 
@@ -305,11 +306,6 @@
 #endif
 
 	local_irq_enable();
-	calibrate_delay();
-	local_cpu_data->loops_per_jiffy = loops_per_jiffy;
-#ifdef CONFIG_IA32_SUPPORT
-	ia32_gdt_init();
-#endif
 
 	if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) {
 		/*
@@ -323,6 +319,17 @@
 	}
 
 	/*
+	 * Get our bogomips.
+	 */
+	ia64_init_itm();
+	calibrate_delay();
+	local_cpu_data->loops_per_jiffy = loops_per_jiffy;
+
+#ifdef CONFIG_IA32_SUPPORT
+	ia32_gdt_init();
+#endif
+
+	/*
 	 * Allow the master to continue.
 	 */
 	cpu_set(cpuid, cpu_callin_map);
@@ -333,11 +340,14 @@
 /*
  * Activate a secondary processor.  head.S calls this.
  */
-int __init
+int __devinit
 start_secondary (void *unused)
 {
 	extern int cpu_idle (void);
 
+	/* Early console may use I/O ports */
+	ia64_set_kr(IA64_KR_IO_BASE, __pa(ia64_iobase));
+
 	Dprintk("start_secondary: starting CPU 0x%x\n", hard_smp_processor_id());
 	efi_map_pal_code();
 	cpu_init();
@@ -346,7 +356,7 @@
 	return cpu_idle();
 }
 
-static struct task_struct * __init
+static struct task_struct * __devinit
 fork_by_hand (void)
 {
 	/*
@@ -356,29 +366,51 @@
 	return copy_process(CLONE_VM|CLONE_IDLETASK, 0, 0, 0, NULL, NULL);
 }
 
-static int __init
+struct create_idle {
+	struct task_struct *idle;
+	struct completion done;
+};
+
+void
+do_fork_idle(void *_c_idle)
+{
+	struct create_idle *c_idle = _c_idle;
+
+	c_idle->idle = fork_by_hand();
+	complete(&c_idle->done);
+}
+
+static int __devinit
 do_boot_cpu (int sapicid, int cpu)
 {
-	struct task_struct *idle;
 	int timeout;
+	struct create_idle c_idle;
+	DECLARE_WORK(work, do_fork_idle, &c_idle);
 
+	init_completion(&c_idle.done);
 	/*
 	 * We can't use kernel_thread since we must avoid to reschedule the child.
 	 */
-	idle = fork_by_hand();
-	if (IS_ERR(idle))
+	if (!keventd_up() || current_is_keventd())
+		work.func(work.data);
+	else {
+		schedule_work(&work);
+		wait_for_completion(&c_idle.done);
+	}
+
+	if (IS_ERR(c_idle.idle))
 		panic("failed fork for CPU %d", cpu);
-	wake_up_forked_process(idle);
+	wake_up_forked_process(c_idle.idle);
 
 	/*
 	 * We remove it from the pidhash and the runqueue
 	 * once we got the process:
 	 */
-	init_idle(idle, cpu);
+	init_idle(c_idle.idle, cpu);
 
-	unhash_process(idle);
+	unhash_process(c_idle.idle);
 
-	task_for_booting_cpu = idle;
+	task_for_booting_cpu = c_idle.idle;
 
 	Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);
 
@@ -437,18 +469,23 @@
 	int sapicid, cpu, i;
 	int boot_cpu_id = hard_smp_processor_id();
 
-	for (cpu = 0; cpu < NR_CPUS; cpu++)
+	for (cpu = 0; cpu < NR_CPUS; cpu++) {
 		ia64_cpu_to_sapicid[cpu] = -1;
+#ifdef CONFIG_HOTPLUG_CPU
+		cpu_set(cpu, cpu_possible_map);
+#endif
+	}
 
 	ia64_cpu_to_sapicid[0] = boot_cpu_id;
-	cpus_clear(phys_cpu_present_map);
-	cpu_set(0, phys_cpu_present_map);
-
+	cpus_clear(cpu_present_map);
+	cpu_set(0, cpu_present_map);
+	cpu_set(0, cpu_possible_map);
 	for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) {
 		sapicid = smp_boot_data.cpu_phys_id[i];
 		if (sapicid == boot_cpu_id)
 			continue;
-		cpu_set(cpu, phys_cpu_present_map);
+		cpu_set(cpu, cpu_present_map);
+		cpu_set(cpu, cpu_possible_map);
 		ia64_cpu_to_sapicid[cpu] = sapicid;
 		cpu++;
 	}
@@ -487,7 +524,7 @@
 #else
 #		error Fixme: Dunno how to build CPU-to-node map.
 #endif
-		cpu_to_node_map[cpu] = node;
+		cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
 		if (node >= 0)
 			cpu_set(cpu, node_to_cpu_mask[node]);
 	}
@@ -529,9 +566,11 @@
 	if (!max_cpus) {
 		printk(KERN_INFO "SMP mode deactivated.\n");
 		cpus_clear(cpu_online_map);
-		cpus_clear(phys_cpu_present_map);
+		cpus_clear(cpu_present_map);
+		cpus_clear(cpu_possible_map);
 		cpu_set(0, cpu_online_map);
-		cpu_set(0, phys_cpu_present_map);
+		cpu_set(0, cpu_present_map);
+		cpu_set(0, cpu_possible_map);
 		return;
 	}
 }
@@ -542,6 +581,74 @@
 	cpu_set(smp_processor_id(), cpu_callin_map);
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+extern void fixup_irqs(void);
+/* must be called with cpucontrol mutex held */
+static int __devinit cpu_enable(unsigned int cpu)
+{
+	per_cpu(cpu_state,cpu) = CPU_UP_PREPARE;
+	wmb();
+
+	while (!cpu_online(cpu))
+		cpu_relax();
+	return 0;
+}
+
+int __cpu_disable(void)
+{
+	int cpu = smp_processor_id();
+
+	/*
+	 * dont permit boot processor for now
+	 */
+	if (cpu == 0)
+		return -EBUSY;
+
+	fixup_irqs();
+	local_flush_tlb_all();
+	printk ("Disabled cpu %u\n", smp_processor_id());
+	return 0;
+}
+
+void __cpu_die(unsigned int cpu)
+{
+	unsigned int i;
+
+	for (i = 0; i < 100; i++) {
+		/* They ack this in play_dead by setting CPU_DEAD */
+		if (per_cpu(cpu_state, cpu) == CPU_DEAD)
+		{
+			/*
+			 * TBD: Enable this when physical removal
+			 * or when we put the processor is put in
+			 * SAL_BOOT_RENDEZ mode
+			 * cpu_clear(cpu, cpu_callin_map);
+			 */
+			return;
+		}
+		current->state = TASK_UNINTERRUPTIBLE;
+		schedule_timeout(HZ/10);
+	}
+ 	printk(KERN_ERR "CPU %u didn't die...\n", cpu);
+}
+#else /* !CONFIG_HOTPLUG_CPU */
+static int __devinit cpu_enable(unsigned int cpu)
+{
+	return 0;
+}
+
+int __cpu_disable(void)
+{
+	return -ENOSYS;
+}
+
+void __cpu_die(unsigned int cpu)
+{
+	/* We said "no" in __cpu_disable */
+	BUG();
+}
+#endif /* CONFIG_HOTPLUG_CPU */
+
 void
 smp_cpus_done (unsigned int dummy)
 {
@@ -570,6 +677,17 @@
 	if (sapicid == -1)
 		return -EINVAL;
 
+	/*
+	 * Already booted.. just enable and get outa idle lool
+	 */
+	if (cpu_isset(cpu, cpu_callin_map))
+	{
+		cpu_enable(cpu);
+		local_irq_enable();
+		while (!cpu_isset(cpu, cpu_online_map))
+			mb();
+		return 0;
+	}
 	/* Processor goes to start_secondary(), sets online flag */
 	ret = do_boot_cpu(sapicid, cpu);
 	if (ret < 0)
diff -Nru a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
--- a/arch/ia64/kernel/time.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ia64/kernel/time.c	Tue Jun 15 22:20:37 2004
@@ -10,6 +10,7 @@
  */
 #include <linux/config.h>
 
+#include <linux/cpu.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -44,14 +45,6 @@
 
 #endif
 
-unsigned long long
-sched_clock (void)
-{
-	unsigned long offset = ia64_get_itc();
-
-	return (offset * local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT;
-}
-
 static void
 itc_reset (void)
 {
@@ -244,6 +237,10 @@
 {
 	unsigned long new_itm;
 
+	if (unlikely(cpu_is_offline(smp_processor_id()))) {
+		return IRQ_HANDLED;
+	}
+
 	platform_timer_interrupt(irq, dev_id, regs);
 
 	new_itm = local_cpu_data->itm_next;
@@ -326,7 +323,7 @@
 	ia64_set_itm(local_cpu_data->itm_next);
 }
 
-void __init
+void __devinit
 ia64_init_itm (void)
 {
 	unsigned long platform_base_freq, itc_freq;
diff -Nru a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
--- a/arch/ia64/kernel/traps.c	Tue Jun 15 22:21:03 2004
+++ b/arch/ia64/kernel/traps.c	Tue Jun 15 22:21:03 2004
@@ -22,29 +22,6 @@
 #include <asm/processor.h>
 #include <asm/uaccess.h>
 
-/*
- * fp_emulate() needs to be able to access and update all floating point registers.  Those
- * saved in pt_regs can be accessed through that structure, but those not saved, will be
- * accessed directly.  To make this work, we need to ensure that the compiler does not end
- * up using a preserved floating point register on its own.  The following achieves this
- * by declaring preserved registers that are not marked as "fixed" as global register
- * variables.
- */
-#ifdef ASM_SUPPORTED
-register double f2 asm ("f2"); register double f3 asm ("f3");
-register double f4 asm ("f4"); register double f5 asm ("f5");
-
-register long f16 asm ("f16"); register long f17 asm ("f17");
-register long f18 asm ("f18"); register long f19 asm ("f19");
-register long f20 asm ("f20"); register long f21 asm ("f21");
-register long f22 asm ("f22"); register long f23 asm ("f23");
-
-register double f24 asm ("f24"); register double f25 asm ("f25");
-register double f26 asm ("f26"); register double f27 asm ("f27");
-register double f28 asm ("f28"); register double f29 asm ("f29");
-register double f30 asm ("f30"); register double f31 asm ("f31");
-#endif
-
 extern spinlock_t timerlist_lock;
 
 fpswa_interface_t *fpswa_interface;
diff -Nru a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
--- a/arch/ia64/kernel/unwind.c	Tue Jun 15 22:21:05 2004
+++ b/arch/ia64/kernel/unwind.c	Tue Jun 15 22:21:05 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1999-2003 Hewlett-Packard Co
+ * Copyright (C) 1999-2004 Hewlett-Packard Co
  *	David Mosberger-Tang <davidm@hpl.hp.com>
  * Copyright (C) 2003 Fenghua Yu <fenghua.yu@intel.com>
  * 	- Change pt_regs_off() to make it less dependant on pt_regs structure.
@@ -89,6 +89,8 @@
 	/* list of unwind tables (one per load-module) */
 	struct unw_table *tables;
 
+	unsigned long r0;			/* constant 0 for r0 */
+
 	/* table of registers that prologues can save (and order in which they're saved): */
 	const unsigned char save_order[8];
 
@@ -239,7 +241,11 @@
 #endif
 };
 
-/* Unwind accessors.  */
+static inline int
+read_only (void *addr)
+{
+	return (unsigned long) ((char *) addr - (char *) &unw.r0) < sizeof(unw.r0);
+}
 
 /*
  * Returns offset of rREG in struct pt_regs.
@@ -274,6 +280,8 @@
 	return (struct pt_regs *) info->pt;
 }
 
+/* Unwind accessors.  */
+
 int
 unw_access_gr (struct unw_frame_info *info, int regnum, unsigned long *val, char *nat, int write)
 {
@@ -377,11 +385,15 @@
 	}
 
 	if (write) {
-		*addr = *val;
-		if (*nat)
-			*nat_addr |= nat_mask;
-		else
-			*nat_addr &= ~nat_mask;
+		if (read_only(addr))
+			UNW_DPRINT(0, "unwind.%s: ignoring attempt to write read-only location\n");
+		else {
+			*addr = *val;
+			if (*nat)
+				*nat_addr |= nat_mask;
+			else
+				*nat_addr &= ~nat_mask;
+		}
 	} else {
 		if ((*nat_addr & nat_mask) == 0) {
 			*val = *addr;
@@ -420,7 +432,10 @@
 		return -1;
 	}
 	if (write)
-		*addr = *val;
+		if (read_only(addr))
+			UNW_DPRINT(0, "unwind.%s: ignoring attempt to write read-only location\n");
+		else
+			*addr = *val;
 	else
 		*val = *addr;
 	return 0;
@@ -465,7 +480,10 @@
 	}
 
 	if (write)
-		*addr = *val;
+		if (read_only(addr))
+			UNW_DPRINT(0, "unwind.%s: ignoring attempt to write read-only location\n");
+		else
+			*addr = *val;
 	else
 		*val = *addr;
 	return 0;
@@ -557,9 +575,12 @@
 		return -1;
 	}
 
-	if (write)
-		*addr = *val;
-	else
+	if (write) {
+		if (read_only(addr))
+			UNW_DPRINT(0, "unwind.%s: ignoring attempt to write read-only location\n");
+		else
+			*addr = *val;
+	} else
 		*val = *addr;
 	return 0;
 }
@@ -574,9 +595,12 @@
 	if (!addr)
 		addr = &info->sw->pr;
 
-	if (write)
-		*addr = *val;
-	else
+	if (write) {
+		if (read_only(addr))
+			UNW_DPRINT(0, "unwind.%s: ignoring attempt to write read-only location\n");
+		else
+			*addr = *val;
+	} else
 		*val = *addr;
 	return 0;
 }
@@ -1407,6 +1431,9 @@
 				need_nat_info = 0;
 			}
 			val = unw.preg_index[UNW_REG_R4 + (rval - 4)];
+		} else if (rval == 0) {
+			opc = UNW_INSN_MOVE_CONST;
+			val = 0;
 		} else {
 			/* register got spilled to a scratch register */
 			opc = UNW_INSN_MOVE_SCRATCH;
@@ -1728,6 +1755,17 @@
 					   __FUNCTION__, dst, val);
 			}
 			break;
+
+		      case UNW_INSN_MOVE_CONST:
+			if (val == 0)
+				s[dst] = (unsigned long) &unw.r0;
+			else {
+				s[dst] = 0;
+				UNW_DPRINT(0, "unwind.%s: UNW_INSN_MOVE_CONST bad val=%ld\n",
+					   __FUNCTION__, val);
+			}
+			break;
+
 
 		      case UNW_INSN_MOVE_STACKED:
 			s[dst] = (unsigned long) ia64_rse_skip_regs((unsigned long *)state->bsp,
diff -Nru a/arch/ia64/kernel/unwind_i.h b/arch/ia64/kernel/unwind_i.h
--- a/arch/ia64/kernel/unwind_i.h	Tue Jun 15 22:20:39 2004
+++ b/arch/ia64/kernel/unwind_i.h	Tue Jun 15 22:20:39 2004
@@ -133,6 +133,7 @@
 	UNW_INSN_SETNAT_TYPE,		/* s[dst+1].nat.type = val */
 	UNW_INSN_LOAD,			/* s[dst] = *s[val] */
 	UNW_INSN_MOVE_SCRATCH,		/* s[dst] = scratch reg "val" */
+	UNW_INSN_MOVE_CONST,            /* s[dst] = constant reg "val" */
 };
 
 struct unw_insn {
diff -Nru a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
--- a/arch/ia64/kernel/vmlinux.lds.S	Tue Jun 15 22:20:44 2004
+++ b/arch/ia64/kernel/vmlinux.lds.S	Tue Jun 15 22:20:44 2004
@@ -195,11 +195,10 @@
   .data : AT(ADDR(.data) - LOAD_OFFSET)
 	{ *(.data) *(.data1) *(.gnu.linkonce.d*) CONSTRUCTORS }
 
-  . = ALIGN(16);
-  __gp = . + 0x200000;	/* gp must be 16-byte aligned for exc. table */
-
+  . = ALIGN(16);	/* gp must be 16-byte aligned for exc. table */
   .got : AT(ADDR(.got) - LOAD_OFFSET)
 	{ *(.got.plt) *(.got) }
+  __gp = ADDR(.got) + 0x200000;
   /* We want the small data sections together, so single-instruction offsets
      can access them all, and initialized data all before uninitialized, so
      we can shorten the on-disk segment size.  */
diff -Nru a/arch/ia64/lib/Makefile b/arch/ia64/lib/Makefile
--- a/arch/ia64/lib/Makefile	Tue Jun 15 22:21:03 2004
+++ b/arch/ia64/lib/Makefile	Tue Jun 15 22:21:03 2004
@@ -6,7 +6,7 @@
 
 lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o			\
 	__divdi3.o __udivdi3.o __moddi3.o __umoddi3.o			\
-	checksum.o clear_page.o csum_partial_copy.o copy_page.o		\
+	bitop.o checksum.o clear_page.o csum_partial_copy.o copy_page.o	\
 	clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o	\
 	flush.o ip_fast_csum.o do_csum.o				\
 	memset.o strlen.o swiotlb.o
diff -Nru a/arch/ia64/lib/bitop.c b/arch/ia64/lib/bitop.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ia64/lib/bitop.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,88 @@
+#include <linux/compiler.h>
+#include <linux/types.h>
+#include <asm/intrinsics.h>
+#include <linux/module.h>
+#include <asm/bitops.h>
+
+/*
+ * Find next zero bit in a bitmap reasonably efficiently..
+ */
+
+int __find_next_zero_bit (void *addr, unsigned long size, unsigned long offset)
+{
+	unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
+	unsigned long result = offset & ~63UL;
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= 63UL;
+	if (offset) {
+		tmp = *(p++);
+		tmp |= ~0UL >> (64-offset);
+		if (size < 64)
+			goto found_first;
+		if (~tmp)
+			goto found_middle;
+		size -= 64;
+		result += 64;
+	}
+	while (size & ~63UL) {
+		if (~(tmp = *(p++)))
+			goto found_middle;
+		result += 64;
+		size -= 64;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
+found_first:
+	tmp |= ~0UL << size;
+	if (tmp == ~0UL)		/* any bits zero? */
+		return result + size;	/* nope */
+found_middle:
+	return result + ffz(tmp);
+}
+EXPORT_SYMBOL(__find_next_zero_bit);
+
+/*
+ * Find next bit in a bitmap reasonably efficiently..
+ */
+int __find_next_bit(const void *addr, unsigned long size, unsigned long offset)
+{
+	unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
+	unsigned long result = offset & ~63UL;
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= 63UL;
+	if (offset) {
+		tmp = *(p++);
+		tmp &= ~0UL << offset;
+		if (size < 64)
+			goto found_first;
+		if (tmp)
+			goto found_middle;
+		size -= 64;
+		result += 64;
+	}
+	while (size & ~63UL) {
+		if ((tmp = *(p++)))
+			goto found_middle;
+		result += 64;
+		size -= 64;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
+  found_first:
+	tmp &= ~0UL >> (64-size);
+	if (tmp == 0UL)		/* Are any bits set? */
+		return result + size; /* Nope. */
+  found_middle:
+	return result + __ffs(tmp);
+}
+EXPORT_SYMBOL(__find_next_bit);
diff -Nru a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
--- a/arch/ia64/mm/hugetlbpage.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/mm/hugetlbpage.c	Tue Jun 15 22:20:40 2004
@@ -293,8 +293,9 @@
 				goto out;
 			}
 			ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
-			unlock_page(page);
-			if (ret) {
+			if (! ret) {
+				unlock_page(page);
+			} else {
 				hugetlb_put_quota(mapping);
 				free_huge_page(page);
 				goto out;
diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
--- a/arch/ia64/mm/init.c	Tue Jun 15 22:20:39 2004
+++ b/arch/ia64/mm/init.c	Tue Jun 15 22:20:39 2004
@@ -123,15 +123,12 @@
 	 */
 	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 	if (vma) {
+		memset(vma, 0, sizeof(*vma));
 		vma->vm_mm = current->mm;
 		vma->vm_start = current->thread.rbs_bot & PAGE_MASK;
 		vma->vm_end = vma->vm_start + PAGE_SIZE;
 		vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS & 0x7];
 		vma->vm_flags = VM_READ|VM_WRITE|VM_MAYREAD|VM_MAYWRITE|VM_GROWSUP;
-		vma->vm_ops = NULL;
-		vma->vm_pgoff = 0;
-		vma->vm_file = NULL;
-		vma->vm_private_data = NULL;
 		insert_vm_struct(current->mm, vma);
 	}
 
@@ -220,7 +217,7 @@
 }
 
 /*
- * This is like put_dirty_page() but installs a clean page in the kernel's page table.
+ * This installs a clean page in the kernel's page table.
  */
 struct page *
 put_kernel_page (struct page *page, unsigned long address, pgprot_t pgprot)
@@ -275,11 +272,11 @@
 	ia64_patch_gate();
 }
 
-void __init
+void __devinit
 ia64_mmu_init (void *my_cpu_data)
 {
 	unsigned long psr, pta, impl_va_bits;
-	extern void __init tlb_init (void);
+	extern void __devinit tlb_init (void);
 	int cpu;
 
 #ifdef CONFIG_DISABLE_VHPT
@@ -343,6 +340,7 @@
 
 #ifdef	CONFIG_HUGETLB_PAGE
 	ia64_set_rr(HPAGE_REGION_BASE, HPAGE_SHIFT << 2);
+	ia64_srlz_d();
 #endif
 
 	cpu = smp_processor_id();
diff -Nru a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
--- a/arch/ia64/mm/tlb.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ia64/mm/tlb.c	Tue Jun 15 22:20:42 2004
@@ -166,7 +166,7 @@
 }
 EXPORT_SYMBOL(flush_tlb_range);
 
-void __init
+void __devinit
 ia64_tlb_init (void)
 {
 	ia64_ptce_info_t ptce_info;
diff -Nru a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
--- a/arch/ia64/pci/pci.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/pci/pci.c	Tue Jun 15 22:20:40 2004
@@ -323,8 +323,10 @@
 	struct pci_controller *controller = PCI_CONTROLLER(dev);
 	struct pci_window *window;
 	int i, j;
+	int limit = (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) ? \
+		PCI_ROM_RESOURCE : PCI_NUM_RESOURCES;
 
-	for (i = 0; i < PCI_NUM_RESOURCES; i++) {
+	for (i = 0; i < limit; i++) {
 		if (!dev->resource[i].start)
 			continue;
 
diff -Nru a/arch/ia64/scripts/check-serialize.S b/arch/ia64/scripts/check-serialize.S
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ia64/scripts/check-serialize.S	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,2 @@
+	.serialize.data
+	.serialize.instruction
diff -Nru a/arch/ia64/scripts/toolchain-flags b/arch/ia64/scripts/toolchain-flags
--- a/arch/ia64/scripts/toolchain-flags	Tue Jun 15 22:21:03 2004
+++ b/arch/ia64/scripts/toolchain-flags	Tue Jun 15 22:21:03 2004
@@ -40,4 +40,14 @@
     CPPFLAGS="$CPPFLAGS -DHAVE_MODEL_SMALL_ATTRIBUTE"
 fi
 rm -f $out
+
+# Check whether assembler supports .serialize.{data,instruction} directive.
+
+$CC -c $dir/check-serialize.S -o $out 2>/dev/null
+res=$?
+rm -f $out
+if [ $res -eq 0 ]; then
+    CPPFLAGS="$CPPFLAGS -DHAVE_SERIALIZE_DIRECTIVE"
+fi
+
 echo $CPPFLAGS
diff -Nru a/arch/ia64/sn/io/hwgfs/interface.c b/arch/ia64/sn/io/hwgfs/interface.c
--- a/arch/ia64/sn/io/hwgfs/interface.c	Tue Jun 15 22:21:05 2004
+++ b/arch/ia64/sn/io/hwgfs/interface.c	Tue Jun 15 22:21:05 2004
@@ -204,7 +204,7 @@
 
 	error = hwgfs_decode(dir, name, 0, &parent_inode, &dentry);
 	if (likely(!error)) {
-		error = vfs_symlink(parent_inode, dentry, link);
+		error = vfs_symlink(parent_inode, dentry, link, S_IALLUGO);
 		dentry->d_fsdata = info;
 		if (handle)
 			*handle = dentry;
diff -Nru a/arch/ia64/sn/io/io.c b/arch/ia64/sn/io/io.c
--- a/arch/ia64/sn/io/io.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/sn/io/io.c	Tue Jun 15 22:20:40 2004
@@ -651,7 +651,7 @@
 	hubii_wcr_t ii_wcr;
 	int prbnum;
 
-	ASSERT(NASID_TO_COMPACT_NODEID(nasid) != INVALID_CNODEID);
+	ASSERT(nasid_to_cnodeid(nasid) != INVALID_CNODEID);
 
 	ii_iowa = REMOTE_HUB_L(nasid, IIO_OUTWIDGET_ACCESS);
 	REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, 0);
diff -Nru a/arch/ia64/sn/io/machvec/iomv.c b/arch/ia64/sn/io/machvec/iomv.c
--- a/arch/ia64/sn/io/machvec/iomv.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/sn/io/machvec/iomv.c	Tue Jun 15 22:20:40 2004
@@ -71,6 +71,6 @@
 {
 	while ((((volatile unsigned long) (*pda->pio_write_status_addr)) & SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK) != 
 				SH_PIO_WRITE_STATUS_0_PENDING_WRITE_COUNT_MASK)
-		udelay(1);
+		cpu_relax();
 }
 EXPORT_SYMBOL(sn_mmiob);
diff -Nru a/arch/ia64/sn/io/machvec/pci_bus_cvlink.c b/arch/ia64/sn/io/machvec/pci_bus_cvlink.c
--- a/arch/ia64/sn/io/machvec/pci_bus_cvlink.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ia64/sn/io/machvec/pci_bus_cvlink.c	Tue Jun 15 22:20:43 2004
@@ -328,6 +328,34 @@
 			cmd |= PCI_COMMAND_MEMORY;
 	}
 
+        /*
+	 * Assign addresses to the ROMs, but don't enable them yet
+	 * Also note that we only map display card ROMs due to PIO mapping
+	 * space scarcity.
+	 */
+        if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
+                unsigned long addr;
+                size = dev->resource[PCI_ROM_RESOURCE].end -
+                        dev->resource[PCI_ROM_RESOURCE].start;
+
+                if (size) {
+                        addr = (unsigned long) pciio_pio_addr(vhdl, 0,
+					      PCIIO_SPACE_ROM,
+					      0, size, 0, PIOMAP_FIXED);
+                        if (!addr) {
+                                dev->resource[PCI_ROM_RESOURCE].start = 0;
+                                dev->resource[PCI_ROM_RESOURCE].end = 0;
+                                printk("sn_pci_fixup(): ROM pio map failure "
+				       "for %s\n", dev->slot_name);
+                        }
+                        addr |= __IA64_UNCACHED_OFFSET;
+                        dev->resource[PCI_ROM_RESOURCE].start = addr;
+                        dev->resource[PCI_ROM_RESOURCE].end = addr + size;
+                        if (dev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_MEM)
+                                cmd |= PCI_COMMAND_MEMORY;
+                }
+        }
+
 	/*
 	 * Update the Command Word on the Card.
 	 */
@@ -712,7 +740,7 @@
 			
 			/* Is this PCI bus associated with this moduleid? */
 			moduleid = NODE_MODULEID(
-				NASID_TO_COMPACT_NODEID(pcibr_soft->bs_nasid));
+				nasid_to_cnodeid(pcibr_soft->bs_nasid));
 			if (modules[i]->id == moduleid) {
 				struct pcibr_list_s *new_element;
 
@@ -791,8 +819,7 @@
 	struct list_head *ln;
 	struct pci_bus *pci_bus = NULL;
 	struct pci_dev *pci_dev = NULL;
-	extern int numnodes;
-	int cnode, ret;
+	int ret;
 #ifdef CONFIG_PROC_FS
 	extern void register_sn_procfs(void);
 #endif
diff -Nru a/arch/ia64/sn/io/platform_init/sgi_io_init.c b/arch/ia64/sn/io/platform_init/sgi_io_init.c
--- a/arch/ia64/sn/io/platform_init/sgi_io_init.c	Tue Jun 15 22:20:35 2004
+++ b/arch/ia64/sn/io/platform_init/sgi_io_init.c	Tue Jun 15 22:20:35 2004
@@ -26,7 +26,6 @@
 extern void io_module_init(void);
 extern int pci_bus_to_hcl_cvlink(void);
 
-cpuid_t master_procid;
 nasid_t console_nasid = (nasid_t) - 1;
 char master_baseio_wid;
 
@@ -47,10 +46,10 @@
 	ii_ibcr_u_t ii_ibcr;
 	ii_ilcsr_u_t ii_ilcsr;
 
-	nasid = COMPACT_TO_NASID_NODEID(cnode);
+	nasid = cnodeid_to_nasid(cnode);
 
 	ASSERT(nasid != INVALID_NASID);
-	ASSERT(NASID_TO_COMPACT_NODEID(nasid) == cnode);
+	ASSERT(nasid_to_cnodeid(nasid) == cnode);
 
 	npdap = NODEPDA(cnode);
 
@@ -150,7 +149,7 @@
 check_nasid_equiv(nasid_t nasida, nasid_t nasidb)
 {
 	if ((nasida == nasidb)
-	    || (nasida == NODEPDA(NASID_TO_COMPACT_NODEID(nasidb))->xbow_peer))
+	    || (nasida == NODEPDA(nasid_to_cnodeid(nasidb))->xbow_peer))
 		return 1;
 	else
 		return 0;
diff -Nru a/arch/ia64/sn/io/sn2/klgraph.c b/arch/ia64/sn/io/sn2/klgraph.c
--- a/arch/ia64/sn/io/sn2/klgraph.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ia64/sn/io/sn2/klgraph.c	Tue Jun 15 22:20:42 2004
@@ -65,7 +65,7 @@
         cpuid_t cpu_id;
 	nasid_t nasid;
 
-	nasid = COMPACT_TO_NASID_NODEID(cnode);
+	nasid = cnodeid_to_nasid(cnode);
         cpu_id = nasid_slice_to_cpuid(nasid, cpu->cpu_info.physid);
         if(cpu_id != -1){
 		snprintf(name, 120, "%s/%s/%c", EDGE_LBL_DISABLED, EDGE_LBL_CPU, 'a' + cpu->cpu_info.physid);
@@ -88,7 +88,7 @@
         cpuid_t cpu_id;
 	nasid_t nasid;
 
-	nasid = COMPACT_TO_NASID_NODEID(cnode);
+	nasid = cnodeid_to_nasid(cnode);
         cpu_id = nasid_slice_to_cpuid(nasid, cpu->cpu_info.physid);
 
         snprintf(name, 120, "%s/%d/%c",
@@ -145,7 +145,7 @@
 			continue;
 		}
 
-		hub_cnode = NASID_TO_COMPACT_NODEID(hub_nasid);
+		hub_cnode = nasid_to_cnodeid(hub_nasid);
 
 		if (hub_cnode == INVALID_CNODEID) {
 			continue;
@@ -178,7 +178,7 @@
 		 */
 		if (hub_nasid != nasid) {
 			NODEPDA(hub_cnode)->xbow_peer = nasid;
-			NODEPDA(NASID_TO_COMPACT_NODEID(nasid))->xbow_peer =
+			NODEPDA(nasid_to_cnodeid(nasid))->xbow_peer =
 				hub_nasid;
 		}
 	}
@@ -200,7 +200,7 @@
 	klcpu_t *cpu;
 	vertex_hdl_t cpu_dir;
 
-	nasid = COMPACT_TO_NASID_NODEID(cnode);
+	nasid = cnodeid_to_nasid(cnode);
 	brd = find_lboard_any((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA);
 	ASSERT(brd);
 
@@ -280,7 +280,7 @@
 	int rv;
 
 	for (cnode = 0; cnode < numnodes; cnode++) {
-		nasid = COMPACT_TO_NASID_NODEID(cnode);
+		nasid = cnodeid_to_nasid(cnode);
 		brd = find_lboard_class_any((lboard_t *)KL_CONFIG_INFO(nasid),
 				KLTYPE_ROUTER);
 
@@ -363,7 +363,7 @@
 				 port));
 			continue;
 		}
-		if (NASID_TO_COMPACT_NODEID(router->rou_port[port].port_nasid) 
+		if (nasid_to_cnodeid(router->rou_port[port].port_nasid) 
 		    == INVALID_CNODEID) {
 			continue;
 		}
@@ -414,7 +414,7 @@
 	lboard_t *brd;
 
 	for (cnode = 0; cnode < numnodes; cnode++) {
-		nasid = COMPACT_TO_NASID_NODEID(cnode);
+		nasid = cnodeid_to_nasid(cnode);
 		brd = find_lboard_class_any((lboard_t *)KL_CONFIG_INFO(nasid),
 				KLTYPE_ROUTER);
 
@@ -423,7 +423,7 @@
 
 		do {
 
-			nasid = COMPACT_TO_NASID_NODEID(cnode);
+			nasid = cnodeid_to_nasid(cnode);
 
 			klhwg_connect_one_router(hwgraph_root, brd,
 						 cnode, nasid);
@@ -451,7 +451,7 @@
 	int port;
 
 	for (cnode = 0; cnode < numionodes; cnode++) {
-		nasid = COMPACT_TO_NASID_NODEID(cnode);
+		nasid = cnodeid_to_nasid(cnode);
 
 		brd = find_lboard_any((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_SNIA);
 
@@ -463,7 +463,7 @@
 				continue; /* Port not active */
 			}
 
-			if (NASID_TO_COMPACT_NODEID(hub->hub_port[port].port_nasid) == INVALID_CNODEID)
+			if (nasid_to_cnodeid(hub->hub_port[port].port_nasid) == INVALID_CNODEID)
 				continue;
 
 			/* Generate a hardware graph path for this board. */
diff -Nru a/arch/ia64/sn/io/sn2/ml_SN_init.c b/arch/ia64/sn/io/sn2/ml_SN_init.c
--- a/arch/ia64/sn/io/sn2/ml_SN_init.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ia64/sn/io/sn2/ml_SN_init.c	Tue Jun 15 22:20:36 2004
@@ -31,13 +31,9 @@
 	hubinfo_t hubinfo;
 	nasid_t nasid;
 
-	extern void router_map_init(nodepda_t *);
-	extern void router_queue_init(nodepda_t *,cnodeid_t);
-	extern void intr_init_vecblk(nodepda_t *, cnodeid_t, int);
-
 	/* Allocate per-node platform-dependent data */
 	
-	nasid = COMPACT_TO_NASID_NODEID(node);
+	nasid = cnodeid_to_nasid(node);
 	if (node >= numnodes) /* Headless/memless IO nodes */
 		hubinfo = (hubinfo_t)alloc_bootmem_node(NODE_DATA(0), sizeof(struct hubinfo_s));
 	else
@@ -81,7 +77,7 @@
 	for (cnode = 0; cnode < numionodes; cnode++) {
 		npda = nodepdaindr[cnode];
 		hubinfo = (hubinfo_t)npda->pdinfo;
-		hubinfo->h_nasid = COMPACT_TO_NASID_NODEID(cnode);
+		hubinfo->h_nasid = cnodeid_to_nasid(cnode);
 		hubinfo->h_widgetid = hub_widget_id(hubinfo->h_nasid);
 	}
 }
diff -Nru a/arch/ia64/sn/io/sn2/ml_SN_intr.c b/arch/ia64/sn/io/sn2/ml_SN_intr.c
--- a/arch/ia64/sn/io/sn2/ml_SN_intr.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ia64/sn/io/sn2/ml_SN_intr.c	Tue Jun 15 22:20:43 2004
@@ -12,6 +12,7 @@
 #include <asm/smp.h>
 #include <asm/irq.h>
 #include <asm/hw_irq.h>
+#include <asm/topology.h>
 #include <asm/sn/sgi.h>
 #include <asm/sn/iograph.h>
 #include <asm/sn/hcl.h>
@@ -43,7 +44,6 @@
 	sh_ii_int0_config_u_t		ii_int_config;
 	cpuid_t				cpu;
 	cpuid_t				cpu0, cpu1;
-	nodepda_t			*lnodepda;
 	sh_ii_int0_enable_u_t		ii_int_enable;
 	sh_int_node_id_config_u_t	node_id_config;
 	sh_local_int5_config_u_t	local5_config;
@@ -60,15 +60,13 @@
 		HUB_S((unsigned long *)GLOBAL_MMR_ADDR(nasid, SH_INT_NODE_ID_CONFIG),
 			node_id_config.sh_int_node_id_config_regval);
 		cnode = nasid_to_cnodeid(master_nasid);
-		lnodepda = NODEPDA(cnode);
-		cpu = lnodepda->node_first_cpu;
+		cpu = first_cpu(node_to_cpumask(cnode));
 		cpu = cpu_physical_id(cpu);
 		SAL_CALL(ret_stuff, SN_SAL_REGISTER_CE, nasid, cpu, master_nasid,0,0,0,0);
 		if (ret_stuff.status < 0)
 			printk("%s: SN_SAL_REGISTER_CE SAL_CALL failed\n",__FUNCTION__);
 	} else {
-		lnodepda = NODEPDA(node);
-		cpu = lnodepda->node_first_cpu;
+		cpu = first_cpu(node_to_cpumask(node));
 		cpu = cpu_physical_id(cpu);
 	}
 
diff -Nru a/arch/ia64/sn/io/sn2/ml_iograph.c b/arch/ia64/sn/io/sn2/ml_iograph.c
--- a/arch/ia64/sn/io/sn2/ml_iograph.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ia64/sn/io/sn2/ml_iograph.c	Tue Jun 15 22:20:36 2004
@@ -313,7 +313,7 @@
 
 	hubinfo_get(hubv, &hubinfo);
 	nasid = hubinfo->h_nasid;
-	cnode = NASID_TO_COMPACT_NODEID(nasid);
+	cnode = nasid_to_cnodeid(nasid);
 	hub_widgetid = hubinfo->h_widgetid;
 
 	/*
@@ -567,7 +567,7 @@
 	 * and hence widget id is Not 0.
 	 */
 	widget_partnum = (((*(volatile int32_t *)(NODE_SWIN_BASE
-			(COMPACT_TO_NASID_NODEID(cnodeid), 0) + 
+			(cnodeid_to_nasid(cnodeid), 0) + 
 			WIDGET_ID))) & WIDGET_PART_NUM) 
 			>> WIDGET_PART_NUM_SHFT;
 
@@ -584,7 +584,7 @@
 	} else {
 		void	*bridge;
 
-		bridge = (void *)NODE_SWIN_BASE(COMPACT_TO_NASID_NODEID(cnodeid), 0);
+		bridge = (void *)NODE_SWIN_BASE(cnodeid_to_nasid(cnodeid), 0);
 		npdap->basew_id = pcireg_bridge_control_get(bridge) & WIDGET_WIDGET_ID;
 
 		printk(" ****io_init_node: Unknown Widget Part Number 0x%x Widget ID 0x%x attached to Hubv 0x%p ****\n", widget_partnum, npdap->basew_id, (void *)hubv);
@@ -637,7 +637,7 @@
 
 		/* If there's someone else on this crossbow, recognize him */
 		if (npdap->xbow_peer != INVALID_NASID) {
-			nodepda_t *peer_npdap = NODEPDA(NASID_TO_COMPACT_NODEID(npdap->xbow_peer));
+			nodepda_t *peer_npdap = NODEPDA(nasid_to_cnodeid(npdap->xbow_peer));
 			peer_sema = &peer_npdap->xbow_sema;
 			volunteer_for_widgets(switchv, peer_npdap->node_vertex);
 		}
diff -Nru a/arch/ia64/sn/io/sn2/module.c b/arch/ia64/sn/io/sn2/module.c
--- a/arch/ia64/sn/io/sn2/module.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ia64/sn/io/sn2/module.c	Tue Jun 15 22:20:36 2004
@@ -196,7 +196,7 @@
      * We do not support memoryless compute nodes.
      */
     for (node = 0; node < numnodes; node++) {
-	nasid = COMPACT_TO_NASID_NODEID(node);
+	nasid = cnodeid_to_nasid(node);
 	board = find_lboard_nasid((lboard_t *) KL_CONFIG_INFO(nasid), nasid, KLTYPE_SNIA);
 	ASSERT(board);
 
@@ -214,7 +214,7 @@
 	nasid_t		nasid;
 	char		serial_number[16];
 
-        nasid = COMPACT_TO_NASID_NODEID(node);
+        nasid = cnodeid_to_nasid(node);
 	board = find_lboard_nasid((lboard_t *) KL_CONFIG_INFO(nasid), 
 				nasid, KLTYPE_SNIA);
 	ASSERT(board);
diff -Nru a/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c b/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c
--- a/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	Tue Jun 15 22:21:05 2004
+++ b/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	Tue Jun 15 22:21:05 2004
@@ -758,7 +758,7 @@
     cnodeid_t		cnodeid = 0;	/* We need api for diroff api */
     nasid_t		nasid;
 
-    nasid = COMPACT_TO_NASID_NODEID(cnodeid);
+    nasid = cnodeid_to_nasid(cnodeid);
     paddr = NODE_OFFSET(nasid) + 0;
 
     /* Assume that if we ask for a DMA mapping to zero the XIO host will
@@ -2092,7 +2092,7 @@
 	pciio_info_t	pciio_info = pciio_info_get(pconn_vhdl);
 	pcibr_soft_t	pcibr_soft = (pcibr_soft_t) pciio_info_mfast_get(pciio_info);
 
-	return NASID_TO_COMPACT_NODEID(NASID_GET(pcibr_soft->bs_dir_xbase));
+	return nasid_to_cnodeid(NASID_GET(pcibr_soft->bs_dir_xbase));
 }
 
 /*ARGSUSED */
@@ -2645,7 +2645,7 @@
                         brd = KLCF_NEXT(brd);
 	}
 	/* if it's dual ported, check the peer also */
-	nasid = NODEPDA(NASID_TO_COMPACT_NODEID(nasid))->xbow_peer;
+	nasid = NODEPDA(nasid_to_cnodeid(nasid))->xbow_peer;
 	if (nasid < 0) return 0;
 	brd = (lboard_t *)KL_CONFIG_INFO(nasid);
 	while (brd) {
diff -Nru a/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c b/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c
--- a/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c	Tue Jun 15 22:20:40 2004
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001-2003 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2001-2004 Silicon Graphics, Inc. All rights reserved.
  */
 
 #include <linux/types.h>
@@ -1615,6 +1615,46 @@
 				piomap->bp_kvaddr + offset, len, valp);
 }
 
+static uint64_t
+pcibr_disable_mst_timeout(pcibr_soft_t pcibr_soft)
+{
+    uint64_t		old_enable;
+    uint64_t		new_enable;
+    uint64_t		intr_bits;
+
+    intr_bits = PIC_ISR_PCI_MST_TIMEOUT
+		| PIC_ISR_PCIX_MTOUT | PIC_ISR_PCIX_SPLIT_EMSG;
+    old_enable = pcireg_intr_enable_get(pcibr_soft);
+    pcireg_intr_enable_bit_clr(pcibr_soft, intr_bits);
+    new_enable = pcireg_intr_enable_get(pcibr_soft);
+
+    if (old_enable == new_enable) {
+	return 0;		/* was already disabled */
+    } else {
+	return 1;
+    }
+}
+
+static int
+pcibr_enable_mst_timeout(pcibr_soft_t pcibr_soft)
+{
+    uint64_t		old_enable;
+    uint64_t		new_enable;
+    uint64_t		intr_bits;
+    
+    intr_bits = PIC_ISR_PCI_MST_TIMEOUT
+		| PIC_ISR_PCIX_MTOUT | PIC_ISR_PCIX_SPLIT_EMSG;
+    old_enable = pcireg_intr_enable_get(pcibr_soft);
+    pcireg_intr_enable_bit_set(pcibr_soft, intr_bits);
+    new_enable = pcireg_intr_enable_get(pcibr_soft);
+
+    if (old_enable == new_enable) {
+	return 0;		/* was alread enabled */
+    } else {
+	return 1;
+    }
+}
+
 /*
  * pcibr_probe_slot: read a config space word
  * while trapping any errors; return zero if
@@ -1628,7 +1668,7 @@
 		 int len,
 		 void *valp)
 {
-    int			rv;
+    int			rv, changed;
 
     /*
      * Sanity checks ...
@@ -1642,14 +1682,18 @@
 	return -1;				/* invalid alignment */
     }
 
+    changed = pcibr_disable_mst_timeout(pcibr_soft);
+
     rv = snia_badaddr_val((void *)addr, len, valp);
 
     /* Clear the int_view register incase it was set */
     pcireg_intr_reset_set(pcibr_soft, BRIDGE_IRR_MULTI_CLR);
 
+    if (changed) {
+	pcibr_enable_mst_timeout(pcibr_soft);
+    }
     return (rv ? 1 : 0);	/* return 1 for snia_badaddr_val error, 0 if ok */
 }
-
 
 void
 pcibr_device_info_free(vertex_hdl_t pcibr_vhdl, pciio_slot_t slot)
diff -Nru a/arch/ia64/sn/io/sn2/pic.c b/arch/ia64/sn/io/sn2/pic.c
--- a/arch/ia64/sn/io/sn2/pic.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ia64/sn/io/sn2/pic.c	Tue Jun 15 22:20:41 2004
@@ -124,7 +124,7 @@
 static vertex_hdl_t
 pic_bus1_redist(nasid_t nasid, vertex_hdl_t conn_v)
 {
-	cnodeid_t cnode = NASID_TO_COMPACT_NODEID(nasid);
+	cnodeid_t cnode = nasid_to_cnodeid(nasid);
 	cnodeid_t xbow_peer = -1;
 	char pathname[256], peer_path[256], tmpbuf[256];
 	char *p;
@@ -137,7 +137,7 @@
 		/* create a path for this widget on the peer Cbrick */
 		/* pcibr widget hw/module/001c11/slab/0/Pbrick/xtalk/12 */
 		/* sprintf(pathname, "%v", conn_v); */
-		xbow_peer = NASID_TO_COMPACT_NODEID(NODEPDA(cnode)->xbow_peer);
+		xbow_peer = nasid_to_cnodeid(NODEPDA(cnode)->xbow_peer);
 		pos = hwgfs_generate_path(conn_v, tmpbuf, 256);
 		strcpy(pathname, &tmpbuf[pos]);
 		p = pathname + strlen("hw/module/001c01/slab/0/");
diff -Nru a/arch/ia64/sn/io/sn2/shuberror.c b/arch/ia64/sn/io/sn2/shuberror.c
--- a/arch/ia64/sn/io/sn2/shuberror.c	Tue Jun 15 22:21:03 2004
+++ b/arch/ia64/sn/io/sn2/shuberror.c	Tue Jun 15 22:21:03 2004
@@ -157,7 +157,7 @@
     hubio_eint.ii_iidsr_regval = 0;
     hubio_eint.ii_iidsr_fld_s.i_enable = 1;
     hubio_eint.ii_iidsr_fld_s.i_level = bit;/* Take the least significant bits*/
-    hubio_eint.ii_iidsr_fld_s.i_node = COMPACT_TO_NASID_NODEID(cnode);
+    hubio_eint.ii_iidsr_fld_s.i_node = cnodeid_to_nasid(cnode);
     hubio_eint.ii_iidsr_fld_s.i_pi_id = cpuid_to_subnode(intr_cpu);
     REMOTE_HUB_S(hinfo->h_nasid, IIO_IIDSR, hubio_eint.ii_iidsr_regval);
 
@@ -450,7 +450,7 @@
 	int		rc;
 
 	nasid = hinfo->h_nasid;
-	cnode = NASID_TO_COMPACT_NODEID(nasid);
+	cnode = nasid_to_cnodeid(nasid);
 
 	/*
 	 * XXX - Add locking for any recovery actions
diff -Nru a/arch/ia64/sn/io/sn2/shubio.c b/arch/ia64/sn/io/sn2/shubio.c
--- a/arch/ia64/sn/io/sn2/shubio.c	Tue Jun 15 22:20:44 2004
+++ b/arch/ia64/sn/io/sn2/shubio.c	Tue Jun 15 22:20:44 2004
@@ -76,7 +76,7 @@
 	/* Get the error state of the hub */
 	e_state = error_state_get(hub_v);
 
-	cnode = NASID_TO_COMPACT_NODEID(nasid);
+	cnode = nasid_to_cnodeid(nasid);
 
 	xswitch = NODEPDA(cnode)->basew_xc;
 
@@ -119,7 +119,7 @@
 		return(0);
 
 	/* Get the nasid for the cnode */
-	src_nasid = COMPACT_TO_NASID_NODEID(src_node);
+	src_nasid = cnodeid_to_nasid(src_node);
 	if (src_nasid == INVALID_NASID)
 		return(0);
 
diff -Nru a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
--- a/arch/ia64/sn/kernel/setup.c	Tue Jun 15 22:20:38 2004
+++ b/arch/ia64/sn/kernel/setup.c	Tue Jun 15 22:20:38 2004
@@ -451,10 +451,6 @@
 	}
 	pda->shub_1_1_found = shub_1_1_found;
 	
-	if (local_node_data->active_cpu_count == 1)
-		nodepda->node_first_cpu = cpuid;
-
-
 
 	/*
 	 * We must use different memory allocators for first cpu (bootmem 
@@ -474,7 +470,7 @@
 	pda->mem_write_status_addr = (volatile u64 *)
 			LOCAL_MMR_ADDR((slice < 2 ? SH_MEMORY_WRITE_STATUS_0 : SH_MEMORY_WRITE_STATUS_1 ) );
 
-	if (nodepda->node_first_cpu == cpuid) {
+	if (local_node_data->active_cpu_count++ == 0) {
 		int	buddy_nasid;
 		buddy_nasid = cnodeid_to_nasid(numa_node_id() == numnodes-1 ? 0 : numa_node_id()+ 1);
 		pda->pio_shub_war_cam_addr = (volatile unsigned long*)GLOBAL_MMR_ADDR(nasid, SH_PI_CAM_CONTROL);
diff -Nru a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
--- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c	Tue Jun 15 22:20:37 2004
@@ -228,11 +228,9 @@
 {
 	int len = 0;
 
-	MOD_INC_USE_COUNT;
 	/* data holds the pointer to this node's FIT */
 	len = dump_version(page, (unsigned long *)data);
 	len = proc_calc_metrics(page, start, off, count, eof, len);
-	MOD_DEC_USE_COUNT;
 	return len;
 }
 
@@ -242,11 +240,9 @@
 {
 	int len = 0;
 
-	MOD_INC_USE_COUNT;
 	/* data holds the pointer to this node's FIT */
 	len = dump_fit(page, (unsigned long *)data);
 	len = proc_calc_metrics(page, start, off, count, eof, len);
-	MOD_DEC_USE_COUNT;
 
 	return len;
 }
@@ -310,6 +306,7 @@
 prominfo_init(void)
 {
 	struct proc_dir_entry **entp;
+	struct proc_dir_entry *p;
 	cnodeid_t cnodeid;
 	nasid_t nasid;
 	char name[NODE_NAME_LEN];
@@ -333,12 +330,16 @@
 		sprintf(name, "node%d", cnodeid);
 		*entp = proc_mkdir(name, sgi_prominfo_entry);
 		nasid = cnodeid_to_nasid(cnodeid);
-		create_proc_read_entry(
+		p = create_proc_read_entry(
 			"fit", 0, *entp, read_fit_entry,
 			lookup_fit(nasid));
-		create_proc_read_entry(
+		if (p)
+			p->owner = THIS_MODULE;
+		p = create_proc_read_entry(
 			"version", 0, *entp, read_version_entry,
 			lookup_fit(nasid));
+		if (p)
+			p->owner = THIS_MODULE;
 	}
 
 	return 0;
diff -Nru a/arch/m68k/Kconfig b/arch/m68k/Kconfig
--- a/arch/m68k/Kconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/Kconfig	Tue Jun 15 22:20:41 2004
@@ -76,9 +76,9 @@
 	select MMU_SUN3 if MMU
 	help
 	  This option enables support for the Sun 3 series of workstations
-	  (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires 
-	  that all other hardware types must be disabled, as Sun 3 kernels 
-	  are incompatible with all other m68k targets (including Sun 3x!).  
+	  (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires
+	  that all other hardware types must be disabled, as Sun 3 kernels
+	  are incompatible with all other m68k targets (including Sun 3x!).
 
 	  If you don't want to compile a kernel exclusively for a Sun 3, say N.
 
@@ -687,7 +687,7 @@
 	  debugging info resulting in a larger kernel image.
 	  Say Y here only if you plan to use gdb to debug the kernel.
 	  If you don't debug the kernel, you can say N.
-	  
+
 endmenu
 
 source "security/Kconfig"
diff -Nru a/arch/m68k/Makefile b/arch/m68k/Makefile
--- a/arch/m68k/Makefile	Tue Jun 15 22:21:02 2004
+++ b/arch/m68k/Makefile	Tue Jun 15 22:21:02 2004
@@ -56,7 +56,7 @@
 head-y := arch/m68k/kernel/head.o
 else
 head-y := arch/m68k/kernel/sun3-head.o
-endif 
+endif
 
 core-y				+= arch/m68k/kernel/	arch/m68k/mm/
 libs-y				+= arch/m68k/lib/
diff -Nru a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
--- a/arch/m68k/amiga/amisound.c	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/amiga/amisound.c	Tue Jun 15 22:21:05 2004
@@ -88,7 +88,7 @@
 		custom.aud[2].audlen = sizeof(sine_data)/2;
 		custom.aud[2].audper = (unsigned short)period;
 		custom.aud[2].audvol = 32; /* 50% of maxvol */
-	
+
 		if (ticks) {
 			sound_timer.expires = jiffies + ticks;
 			add_timer( &sound_timer );
diff -Nru a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c
--- a/arch/m68k/amiga/chipram.c	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/amiga/chipram.c	Tue Jun 15 22:20:41 2004
@@ -42,7 +42,7 @@
     chipavail = amiga_chip_size;
 }
 
-    
+
 void *amiga_chip_alloc(unsigned long size, const char *name)
 {
     struct resource *res;
diff -Nru a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
--- a/arch/m68k/amiga/config.c	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/amiga/config.c	Tue Jun 15 22:20:36 2004
@@ -332,7 +332,7 @@
 
   case AMI_DRACO:
     panic("No support for Draco yet");
- 
+
   default:
     panic("Unknown Amiga Model");
   }
@@ -426,7 +426,7 @@
 				      */
 
   mach_set_clock_mmss  = amiga_set_clock_mmss;
-  mach_get_ss          = amiga_get_ss; 
+  mach_get_ss          = amiga_get_ss;
 #ifdef CONFIG_AMIGA_FLOPPY
   mach_floppy_setup    = amiga_floppy_setup;
 #endif
@@ -679,13 +679,13 @@
 		tod_3000.second2 = real_seconds % 10;
 		tod_3000.minute1 = real_minutes / 10;
 		tod_3000.minute2 = real_minutes % 10;
-		
+
 		tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
 	} else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
 		int cnt = 5;
 
 		tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
-		
+
 		while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--)
 		{
 			tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
@@ -715,7 +715,7 @@
 		tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
 		s = tod_3000.second1 * 10 + tod_3000.second2;
 		tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
-	} else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ { 
+	} else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
 		s = tod_2000.second1 * 10 + tod_2000.second2;
 	}
 	return s;
@@ -758,7 +758,7 @@
        : "a" (jmp_addr));
  jmp_addr_label040:
   /* disable translation on '040 now */
-  __asm__ __volatile__    
+  __asm__ __volatile__
     ("moveq #0,%/d0\n\t"
      ".chip 68040\n\t"
      "movec %%d0,%%tc\n\t"	/* disable MMU */
@@ -783,7 +783,7 @@
      "1:\n\t"
      "reset\n\t"
      "jmp   %/a0@" : /* Just that gcc scans it for % escapes */ );
-  
+
   for (;;);
 
 }
diff -Nru a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
--- a/arch/m68k/apollo/config.c	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/apollo/config.c	Tue Jun 15 22:20:44 2004
@@ -62,19 +62,19 @@
 	const unsigned long *data = record->data;
 
 	switch(record->tag) {
-		case BI_APOLLO_MODEL: 
-			apollo_model=*data;	
+		case BI_APOLLO_MODEL:
+			apollo_model=*data;
 			break;
 
 		default:
 			 unknown=1;
 	}
-	
+
 	return unknown;
 }
 
 void dn_setup_model(void) {
-	
+
 
 	printk("Apollo hardware found: ");
 	printk("[%s]\n", apollo_models[apollo_model - APOLLO_DN3000]);
@@ -85,19 +85,19 @@
 			break;
 		case APOLLO_DN3000:
 		case APOLLO_DN3010:
-			sio01_physaddr=SAU8_SIO01_PHYSADDR;	
-			rtc_physaddr=SAU8_RTC_PHYSADDR;	
-			pica_physaddr=SAU8_PICA;	
-			picb_physaddr=SAU8_PICB;	
+			sio01_physaddr=SAU8_SIO01_PHYSADDR;
+			rtc_physaddr=SAU8_RTC_PHYSADDR;
+			pica_physaddr=SAU8_PICA;
+			picb_physaddr=SAU8_PICB;
 			cpuctrl_physaddr=SAU8_CPUCTRL;
 			timer_physaddr=SAU8_TIMER;
 			break;
 		case APOLLO_DN4000:
-			sio01_physaddr=SAU7_SIO01_PHYSADDR;	
-			sio23_physaddr=SAU7_SIO23_PHYSADDR;	
-			rtc_physaddr=SAU7_RTC_PHYSADDR;	
-			pica_physaddr=SAU7_PICA;	
-			picb_physaddr=SAU7_PICB;	
+			sio01_physaddr=SAU7_SIO01_PHYSADDR;
+			sio23_physaddr=SAU7_SIO23_PHYSADDR;
+			rtc_physaddr=SAU7_RTC_PHYSADDR;
+			pica_physaddr=SAU7_PICA;
+			picb_physaddr=SAU7_PICB;
 			cpuctrl_physaddr=SAU7_CPUCTRL;
 			timer_physaddr=SAU7_TIMER;
 			break;
@@ -105,11 +105,11 @@
 			panic("Apollo model not yet supported");
 			break;
 		case APOLLO_DN3500:
-			sio01_physaddr=SAU7_SIO01_PHYSADDR;	
-			sio23_physaddr=SAU7_SIO23_PHYSADDR;	
-			rtc_physaddr=SAU7_RTC_PHYSADDR;	
-			pica_physaddr=SAU7_PICA;	
-			picb_physaddr=SAU7_PICB;	
+			sio01_physaddr=SAU7_SIO01_PHYSADDR;
+			sio23_physaddr=SAU7_SIO23_PHYSADDR;
+			rtc_physaddr=SAU7_RTC_PHYSADDR;
+			pica_physaddr=SAU7_PICA;
+			picb_physaddr=SAU7_PICB;
 			cpuctrl_physaddr=SAU7_CPUCTRL;
 			timer_physaddr=SAU7_TIMER;
 			break;
@@ -131,17 +131,17 @@
 void dn_serial_console_write (struct console *co, const char *str,unsigned int count)
 {
    while(count--) {
-	if (*str == '\n') { 
-    	sio01.rhrb_thrb = (unsigned char)'\r';
-       	while (!(sio01.srb_csrb & 0x4))
+	if (*str == '\n') {
+	sio01.rhrb_thrb = (unsigned char)'\r';
+	while (!(sio01.srb_csrb & 0x4))
                 ;
- 	}
+	}
     sio01.rhrb_thrb = (unsigned char)*str++;
     while (!(sio01.srb_csrb & 0x4))
             ;
-  }	
+  }
 }
- 
+
 void dn_serial_print (const char *str)
 {
     while (*str) {
@@ -160,7 +160,7 @@
 
 	int i;
 
-	dn_setup_model();	
+	dn_setup_model();
 
 	mach_sched_init=dn_sched_init; /* */
 	mach_init_IRQ=dn_init_IRQ;
@@ -180,24 +180,24 @@
         conswitchp           = &dummy_con;
 #endif
 #ifdef CONFIG_HEARTBEAT
-  	mach_heartbeat = dn_heartbeat;
+	mach_heartbeat = dn_heartbeat;
 #endif
 	mach_get_model       = dn_get_model;
 
 	cpuctrl=0xaa00;
 
 	/* clear DMA translation table */
-	for(i=0;i<0x400;i++) 
+	for(i=0;i<0x400;i++)
 		addr_xlat_map[i]=0;
 
-}		
+}
 
 irqreturn_t dn_timer_int(int irq, void *dev_id, struct pt_regs *fp) {
 
 	volatile unsigned char x;
 
 	sched_timer_handler(irq,dev_id,fp);
-	
+
 	x=*(volatile unsigned char *)(timer+3);
 	x=*(volatile unsigned char *)(timer+5);
 
@@ -206,7 +206,7 @@
 
 void dn_sched_init(irqreturn_t (*timer_routine)(int, void *, struct pt_regs *)) {
 
-	/* program timer 1 */       	
+	/* program timer 1 */
 	*(volatile unsigned char *)(timer+3)=0x01;
 	*(volatile unsigned char *)(timer+1)=0x40;
 	*(volatile unsigned char *)(timer+5)=0x09;
@@ -272,7 +272,7 @@
   for(;;);
 
 }
-	
+
 void dn_dummy_waitbut(void) {
 
   dn_serial_print("waitbut\n");
@@ -291,7 +291,7 @@
 
 static void dn_heartbeat(int on) {
 
-	if(on) { 
+	if(on) {
 		dn_cpuctrl&=~0x100;
 		cpuctrl=dn_cpuctrl;
 	}
diff -Nru a/arch/m68k/apollo/dma.c b/arch/m68k/apollo/dma.c
--- a/arch/m68k/apollo/dma.c	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/apollo/dma.c	Tue Jun 15 22:20:44 2004
@@ -34,7 +34,7 @@
 	next_free_xlat_entry+=2;
 	if(next_free_xlat_entry>125)
 		next_free_xlat_entry=0;
-	
+
 #if 0
 	printk("next_free_xlat_entry: %d\n",next_free_xlat_entry);
 #endif
diff -Nru a/arch/m68k/apollo/dn_debug.c b/arch/m68k/apollo/dn_debug.c
--- a/arch/m68k/apollo/dn_debug.c	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/apollo/dn_debug.c	Tue Jun 15 22:20:36 2004
@@ -14,9 +14,9 @@
 		i=vsprintf(current_dbg_ptr,fmt,args);
 		va_end(args);
 		current_dbg_ptr+=i;
-	
+
 		return i;
 	}
-	else 
+	else
 		return 0;
 }
diff -Nru a/arch/m68k/apollo/dn_ints.c b/arch/m68k/apollo/dn_ints.c
--- a/arch/m68k/apollo/dn_ints.c	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/apollo/dn_ints.c	Tue Jun 15 22:20:42 2004
@@ -40,7 +40,7 @@
     dn_irqs[i].dev_id=NULL;
     dn_irqs[i].devname=NULL;
   }
-  
+
 }
 
 int dn_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) {
@@ -79,7 +79,7 @@
   if(irq<8)
     *(volatile unsigned char *)(pica+1)|=(1<<irq);
   else
-    *(volatile unsigned char *)(picb+1)|=(1<<(irq-8));  
+    *(volatile unsigned char *)(picb+1)|=(1<<(irq-8));
 
   dn_irqs[irq].handler=NULL;
   dn_irqs[irq].flags=IRQ_FLG_STD;
diff -Nru a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
--- a/arch/m68k/atari/ataints.c	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/atari/ataints.c	Tue Jun 15 22:20:37 2004
@@ -54,14 +54,14 @@
 /*
  * Atari interrupt handling scheme:
  * --------------------------------
- * 
+ *
  * All interrupt source have an internal number (defined in
  * <asm/atariints.h>): Autovector interrupts are 1..7, then follow ST-MFP,
  * TT-MFP, SCC, and finally VME interrupts. Vector numbers for the latter can
  * be allocated by atari_register_vme_int().
  *
  * Each interrupt can be of three types:
- * 
+ *
  *  - SLOW: The handler runs with all interrupts enabled, except the one it
  *    was called by (to avoid reentering). This should be the usual method.
  *    But it is currently possible only for MFP ints, since only the MFP
@@ -179,16 +179,16 @@
 "	movew	%%d1,%%sr\n"		/* set IPL = previous value */	   \
 "	addql	#1,%a0\n"						   \
 "	lea	%a1,%%a0\n"						   \
-"	pea 	%%sp@\n"		/* push addr of frame */	   \
+"	pea	%%sp@\n"		/* push addr of frame */	   \
 "	movel	%%a0@(4),%%sp@-\n"	/* push handler data */		   \
-"	pea 	(%c3+8)\n"		/* push int number */		   \
+"	pea	(%c3+8)\n"		/* push int number */		   \
 "	movel	%%a0@,%%a0\n"						   \
 "	jbsr	%%a0@\n"		/* call the handler */		   \
 "	addql	#8,%%sp\n"						   \
 "	addql	#4,%%sp\n"						   \
 "	orw	#0x0600,%%sr\n"						   \
 "	andw	#0xfeff,%%sr\n"		/* set IPL = 6 again */		   \
-"	orb 	#(1<<(%c3&7)),%a4:w\n"	/* now unmask the int again */	   \
+"	orb	#(1<<(%c3&7)),%a4:w\n"	/* now unmask the int again */	   \
 "	jbra	ret_from_interrupt\n"					   \
 	 : : "i" (&kstat_cpu(0).irqs[n+8]), "i" (&irq_handler[n+8]),	   \
 	     "n" (PT_OFF_SR), "n" (n),					   \
@@ -274,7 +274,7 @@
 void atari_fast_prio_irq_dummy (void) {
 __asm__ (__ALIGN_STR "\n"
 "atari_fast_irq_handler:\n\t"
-	"orw 	#0x700,%%sr\n"		/* disable all interrupts */
+	"orw	#0x700,%%sr\n"		/* disable all interrupts */
 "atari_prio_irq_handler:\n\t"
 	"addl	%3,%2\n\t"		/* preempt_count() += HARDIRQ_OFFSET */
 	SAVE_ALL_INT "\n\t"
@@ -282,13 +282,13 @@
 	/* get vector number from stack frame and convert to source */
 	"bfextu	%%sp@(%c1){#4,#10},%%d0\n\t"
 	"subw	#(0x40-8),%%d0\n\t"
-	"jpl 	1f\n\t"
+	"jpl	1f\n\t"
 	"addw	#(0x40-8-0x18),%%d0\n"
     "1:\tlea	%a0,%%a0\n\t"
 	"addql	#1,%%a0@(%%d0:l:4)\n\t"
 	"lea	irq_handler,%%a0\n\t"
 	"lea	%%a0@(%%d0:l:8),%%a0\n\t"
-	"pea 	%%sp@\n\t"		/* push frame address */
+	"pea	%%sp@\n\t"		/* push frame address */
 	"movel	%%a0@(4),%%sp@-\n\t"	/* push handler data */
 	"movel	%%d0,%%sp@-\n\t"	/* push int number */
 	"movel	%%a0@,%%a0\n\t"
@@ -395,7 +395,7 @@
 		   be in an atasound_init(), that doesn't exist yet. */
 		atari_microwire_cmd(MW_LM1992_PSG_HIGH);
 	}
-	
+
 	stdma_init();
 
 	/* Initialize the PSG: all sounds off, both ports output */
@@ -460,7 +460,7 @@
 		        __FUNCTION__, irq, devname);
 		return -EINVAL;
 	}
-		
+
 	if (vectors[vector] == bad_interrupt) {
 		/* int has no handler yet */
 		irq_handler[irq].handler = handler;
@@ -594,7 +594,7 @@
 	for(i = 0; i < 32; i++)
 		if((free_vme_vec_bitmap & (1 << i)) == 0)
 			break;
-	
+
 	if(i == 16)
 		return 0;
 
@@ -641,7 +641,7 @@
 	}
 	if (num_spurious)
 		seq_printf(p, "spurio.: %10u\n", num_spurious);
-	
+
 	return 0;
 }
 
diff -Nru a/arch/m68k/atari/atasound.c b/arch/m68k/atari/atasound.c
--- a/arch/m68k/atari/atasound.c	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/atari/atasound.c	Tue Jun 15 22:20:36 2004
@@ -70,7 +70,7 @@
 	if (hz) {
 	    /* Convert from frequency value to PSG period value (base
 	       frequency 125 kHz).  */
-		
+
 	    period = PSG_FREQ / hz;
 
 	    if (period > 0xfff) period = 0xfff;
diff -Nru a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
--- a/arch/m68k/atari/config.c	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/atari/config.c	Tue Jun 15 22:20:42 2004
@@ -7,7 +7,7 @@
  *    Added setting of time_adj to get a better clock.
  *
  *  5/14/94 Roman Hodek:
- *    gettod() for TT 
+ *    gettod() for TT
  *
  *  5/15/94 Roman Hodek:
  *    hard_reset_now() for Atari (and others?)
@@ -92,7 +92,7 @@
  * for posterity.
  *   -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 05/1998
  */
-  
+
 #if 0
 static int __init
 hwreg_present_bywrite(volatile void *regp, unsigned char val)
@@ -100,7 +100,7 @@
     int		ret;
     long	save_sp, save_vbr;
     static long tmp_vectors[3] = { [2] = (long)&&after_test };
-	
+
     __asm__ __volatile__
 	(	"movec	%/vbr,%2\n\t"	/* save vbr value            */
                 "movec	%4,%/vbr\n\t"	/* set up temporary vectors  */
@@ -141,14 +141,14 @@
 
 	*ctla = 2; MFPDELAY();
 	*ctla = 0x40; MFPDELAY();
-	
+
 	*ctla = 2; MFPDELAY();
 	if (*ctla != 0x40) return( 0 );
 	MFPDELAY();
 
 	*ctla = 2; MFPDELAY();
 	*ctla = 0x60; MFPDELAY();
-	
+
 	*ctla = 2; MFPDELAY();
 	if (*ctla != 0x60) return( 0 );
 
@@ -199,7 +199,7 @@
 	    p += 3;
 	    ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;
 	}
-	
+
 	if (strcmp( p, "ikbd" ) == 0) {
 	    /* RTS line of IKBD ACIA */
 	    atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;
@@ -269,8 +269,8 @@
 			   ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |
 			   ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);
     }
-	
-    /* ++bjoern: 
+
+    /* ++bjoern:
      * Determine hardware present
      */
 
@@ -446,7 +446,7 @@
 						  : /* no outputs */
 						  : /* no inputs */
 						  : "d0");
-	
+
     /* allocator for memory that must reside in st-ram */
     atari_stram_init ();
 
@@ -507,7 +507,7 @@
 
     if (atari_dont_touch_floppy_select)
 	return;
-    
+
     local_irq_save(flags);
     sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
     tmp = sound_ym.rd_data_reg_sel;
@@ -544,7 +544,7 @@
  * address of a C label. No hope to compile this with another compiler
  * than GCC!
  */
-  
+
 /* ++andreas: no need for complicated code, just depend on prefetch */
 
 static void atari_reset (void)
@@ -563,7 +563,7 @@
 	acia.key_ctrl = ACIA_RESET;
     if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
 	acia.mid_ctrl = ACIA_RESET;
-    
+
     /* processor independent: turn off interrupts and reset the VBR;
      * the caches must be left enabled, else prefetching the final jump
      * instruction doesn't work. */
@@ -572,7 +572,7 @@
 	("moveq	#0,%/d0\n\t"
 	 "movec	%/d0,%/vbr"
 	 : : : "d0" );
-    
+
     if (CPU_IS_040_OR_060) {
         unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
 	if (CPU_IS_060) {
@@ -584,7 +584,7 @@
 		 ".chip 68k"
 		 : : : "d0" );
 	}
-	    
+
         __asm__ __volatile__
             ("movel    %0,%/d0\n\t"
              "andl     #0xff000000,%/d0\n\t"
diff -Nru a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c
--- a/arch/m68k/atari/debug.c	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/atari/debug.c	Tue Jun 15 22:20:38 2004
@@ -4,7 +4,7 @@
  * Atari debugging and serial console stuff
  *
  * Assembled of parts of former atari/config.c 97-12-18 by Roman Hodek
- *  
+ *
  * 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.
@@ -99,7 +99,7 @@
     while( (mfp.par_dt_reg & 1) && --i ) /* wait for BUSY == L */
 	;
     if (!i) return( 0 );
-    
+
     sound_ym.rd_data_reg_sel = 15;  /* select port B */
     sound_ym.wd_data = c;           /* put char onto port */
     sound_ym.rd_data_reg_sel = 14;  /* select port A */
@@ -177,7 +177,7 @@
     if (baud < B1200 || baud > B38400+2)
 	baud = B9600; /* use default 9600bps for non-implemented rates */
     baud -= B1200; /* baud_table[] starts at 1200bps */
-	
+
     mfp.trn_stat &= ~0x01; /* disable TX */
     mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
     mfp.tim_ct_cd &= 0x70;  /* stop timer D */
@@ -204,7 +204,7 @@
 	for( i = 100; i > 0; --i )		\
 	    MFPDELAY();				\
     } while(0)
-    
+
 #ifndef CONFIG_SERIAL_CONSOLE
 static void __init atari_init_scc_port( int cflag )
 #else
@@ -214,20 +214,20 @@
     extern int atari_SCC_reset_done;
     static int clksrc_table[9] =
 	/* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */
-    	{ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
+	{ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
     static int brgsrc_table[9] =
 	/* reg 14: 0 = RTxC, 2 = PCLK */
-    	{ 2, 2, 2, 2, 2, 2, 0, 2, 2 };
+	{ 2, 2, 2, 2, 2, 2, 0, 2, 2 };
     static int clkmode_table[9] =
 	/* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */
-    	{ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 };
+	{ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 };
     static int div_table[9] =
 	/* reg12 (BRG low) */
-    	{ 208, 138, 103, 50, 24, 11, 1, 0, 0 };
+	{ 208, 138, 103, 50, 24, 11, 1, 0, 0 };
 
     int baud = cflag & CBAUD;
     int clksrc, clkmode, div, reg3, reg5;
-    
+
     if (cflag & CBAUDEX)
 	baud += B38400;
     if (baud < B1200 || baud > B38400+2)
@@ -248,7 +248,7 @@
 
     reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40;
     reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */;
-    
+
     (void)scc.cha_b_ctrl;	/* reset reg pointer */
     SCC_WRITE( 9, 0xc0 );	/* reset */
     LONG_DELAY();		/* extra delay after WR9 access */
@@ -267,12 +267,12 @@
     SCC_WRITE( 14, brgsrc_table[baud] | (div ? 1 : 0) );
     SCC_WRITE( 3, reg3 | 1 );
     SCC_WRITE( 5, reg5 | 8 );
-    
+
     atari_SCC_reset_done = 1;
     atari_SCC_init_done = 1;
 }
 
-#ifndef CONFIG_SERIAL_CONSOLE 
+#ifndef CONFIG_SERIAL_CONSOLE
 static void __init atari_init_midi_port( int cflag )
 #else
 void atari_init_midi_port( int cflag )
diff -Nru a/arch/m68k/atari/stdma.c b/arch/m68k/atari/stdma.c
--- a/arch/m68k/atari/stdma.c	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/atari/stdma.c	Tue Jun 15 22:20:38 2004
@@ -97,7 +97,7 @@
 /*
  * Function: void stdma_release( void )
  *
- * Purpose: Releases the lock on the ST-DMA chip. 
+ * Purpose: Releases the lock on the ST-DMA chip.
  *
  * Inputs: none
  *
diff -Nru a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
--- a/arch/m68k/atari/stram.c	Tue Jun 15 22:20:43 2004
+++ b/arch/m68k/atari/stram.c	Tue Jun 15 22:20:43 2004
@@ -52,7 +52,7 @@
 /* Pre-swapping comments:
  *
  * ++roman:
- * 
+ *
  * New version of ST-Ram buffer allocation. Instead of using the
  * 1 MB - 4 KB that remain when the ST-Ram chunk starts at $1000
  * (1 MB granularity!), such buffers are reserved like this:
@@ -60,14 +60,14 @@
  *  - If the kernel resides in ST-Ram anyway, we can take the buffer
  *    from behind the current kernel data space the normal way
  *    (incrementing start_mem).
- *    
+ *
  *  - If the kernel is in TT-Ram, stram_init() initializes start and
  *    end of the available region. Buffers are allocated from there
  *    and mem_init() later marks the such used pages as reserved.
  *    Since each TT-Ram chunk is at least 4 MB in size, I hope there
  *    won't be an overrun of the ST-Ram region by normal kernel data
  *    space.
- *    
+ *
  * For that, ST-Ram may only be allocated while kernel initialization
  * is going on, or exactly: before mem_init() is called. There is also
  * no provision now for freeing ST-Ram buffers. It seems that isn't
@@ -105,7 +105,7 @@
  * visible on a TT, where the speed difference between ST- and TT-RAM isn't
  * that dramatic, but it should on machines where TT-RAM is really much faster
  * (e.g. Afterburner).
- * 
+ *
  *   [1]: __get_free_pages() does a fine job if you only want one page, but if
  * you want more (contiguous) pages, it can give you such a block only if
  * there's already a free one. The algorithm can't try to free buffers or swap
@@ -318,7 +318,7 @@
 			swap_end =  swap_start + max_swap_size;
 		DPRINTK( "atari_stram_reserve_pages: swapping enabled; "
 				 "swap=%p-%p\n", swap_start, swap_end);
-		
+
 		/* reserve some amount of memory for maintainance of
 		 * swapping itself: one page for each 2048 (PAGE_SIZE/2)
 		 * swap pages. (2 bytes for each page) */
@@ -328,7 +328,7 @@
 		/* correct swap_start if necessary */
 		if (swap_start + PAGE_SIZE == swap_data)
 			swap_start = start_mem - PAGE_SIZE;
-		
+
 		if (!swap_init( start_mem, swap_data )) {
 			printk( KERN_ERR "ST-RAM swap space initialization failed\n" );
 			max_swap_size = 0;
@@ -368,13 +368,13 @@
 /*
  * This is main public interface: somehow allocate a ST-RAM block
  * There are three strategies:
- * 
+ *
  *  - If we're before mem_init(), we have to make a static allocation. The
  *    region is taken in the kernel data area (if the kernel is in ST-RAM) or
  *    from the start of ST-RAM (if the kernel is in TT-RAM) and added to the
  *    rsvd_stram_* region. The ST-RAM is somewhere in the middle of kernel
  *    address space in the latter case.
- * 
+ *
  *  - If mem_init() already has been called and ST-RAM swapping is enabled,
  *    try to get the memory from the (pseudo) swap-space, either free already
  *    or by moving some other pages out of the swap.
@@ -383,7 +383,7 @@
  *    enabled, the only possibility is to try with __get_dma_pages(). This has
  *    the disadvantage that it's very hard to get more than 1 page, and it is
  *    likely to fail :-(
- * 
+ *
  */
 void *atari_stram_alloc(long size, const char *owner)
 {
@@ -450,7 +450,7 @@
 	}
 	DPRINTK( "atari_stram_free: found block (%p): size=%08lx, owner=%s, "
 			 "flags=%02x\n", block, block->size, block->owner, block->flags );
-	
+
 #ifdef CONFIG_STRAM_SWAP
 	if (!max_swap_size) {
 #endif
@@ -503,14 +503,14 @@
 
 	DPRINTK("swap_init(start_mem=%p, swap_data=%p)\n",
 		start_mem, swap_data);
-	
+
 	/* need at least one page for swapping to (and this also isn't very
 	 * much... :-) */
 	if (swap_end - swap_start < 2*PAGE_SIZE) {
 		printk( KERN_WARNING "stram_swap_init: swap space too small\n" );
 		return( 0 );
 	}
-	
+
 	/* find free slot in swap_info */
 	for( p = swap_info, type = 0; type < nr_swapfiles; type++, p++ )
 		if (!(p->flags & SWP_USED))
@@ -531,7 +531,7 @@
 	fake_dentry.d_name.name = "stram (internal)";
 	fake_dentry.d_name.len = 16;
 	fake_vfsmnt.mnt_parent = &fake_vfsmnt;
-	
+
 	p->flags        = SWP_USED;
 	p->swap_file    = &fake_dentry;
 	p->swap_vfsmnt  = &fake_vfsmnt;
@@ -706,7 +706,7 @@
 	} while (start < end);
 }
 
-static void unswap_process(struct mm_struct * mm, swp_entry_t entry, 
+static void unswap_process(struct mm_struct * mm, swp_entry_t entry,
 			   struct page *page)
 {
 	struct vm_area_struct* vma;
@@ -752,7 +752,7 @@
 			/* Get a page for the entry, using the existing
 			   swap cache page if there is one.  Otherwise,
 			   get a clean page and read the swap into it. */
-			page = read_swap_cache_async(entry);
+			page = read_swap_cache_async(entry, NULL, 0);
 			if (!page) {
 				swap_free(entry);
 				return -ENOMEM;
@@ -799,7 +799,7 @@
 	unsigned long start, total_free, region_free;
 	int err;
 	void *ret = NULL;
-	
+
 	DPRINTK( "get_stram_region(n_pages=%lu)\n", n_pages );
 
 	down(&stram_swap_sem);
@@ -874,7 +874,7 @@
 static int in_some_region(void *addr)
 {
 	BLOCK *p;
-	
+
 	for( p = alloc_list; p; p = p->next ) {
 		if (p->start <= addr && addr < p->start + p->size)
 			return( 1 );
@@ -920,7 +920,7 @@
 			/* don't need more free pages... :-) */
 			goto out;
 	}
-	
+
 	/* now shift the window and look for the area where as much pages as
 	 * possible are free */
 	while( tail < max ) {
@@ -1130,7 +1130,7 @@
 static BLOCK *find_region( void *addr )
 {
 	BLOCK *p;
-	
+
 	for( p = alloc_list; p; p = p->next ) {
 		if (p->start == addr)
 			return( p );
@@ -1145,7 +1145,7 @@
 static int remove_region( BLOCK *block )
 {
 	BLOCK **p;
-	
+
 	for( p = &alloc_list; *p; p = &((*p)->next) )
 		if (*p == block) break;
 	if (!*p)
diff -Nru a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
--- a/arch/m68k/atari/time.c	Tue Jun 15 22:20:43 2004
+++ b/arch/m68k/atari/time.c	Tue Jun 15 22:20:43 2004
@@ -4,7 +4,7 @@
  * Atari time and real time clock stuff
  *
  * Assembled of parts of former atari/config.c 97-12-18 by Roman Hodek
- *  
+ *
  * 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.
@@ -25,7 +25,7 @@
     /* set Timer C data Register */
     mfp.tim_dt_c = INT_TICKS;
     /* start timer C, div = 1:100 */
-    mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x60; 
+    mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x60;
     /* install interrupt service routine for MFP Timer C */
     request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW,
                 "timer", timer_routine);
@@ -34,7 +34,7 @@
 /* ++andreas: gettimeoffset fixed to check for pending interrupt */
 
 #define TICK_SIZE 10000
-  
+
 /* This is always executed with interrupts disabled.  */
 unsigned long atari_gettimeoffset (void)
 {
@@ -59,9 +59,9 @@
 {
 #define COPY(v) val->v=(mste_rtc.v & 0xf)
 	do {
-		COPY(sec_ones) ; COPY(sec_tens) ; COPY(min_ones) ; 
-		COPY(min_tens) ; COPY(hr_ones) ; COPY(hr_tens) ; 
-		COPY(weekday) ; COPY(day_ones) ; COPY(day_tens) ; 
+		COPY(sec_ones) ; COPY(sec_tens) ; COPY(min_ones) ;
+		COPY(min_tens) ; COPY(hr_ones) ; COPY(hr_tens) ;
+		COPY(weekday) ; COPY(day_ones) ; COPY(day_tens) ;
 		COPY(mon_ones) ; COPY(mon_tens) ; COPY(year_ones) ;
 		COPY(year_tens) ;
 	/* prevent from reading the clock while it changed */
@@ -73,9 +73,9 @@
 {
 #define COPY(v) mste_rtc.v=val->v
 	do {
-		COPY(sec_ones) ; COPY(sec_tens) ; COPY(min_ones) ; 
-		COPY(min_tens) ; COPY(hr_ones) ; COPY(hr_tens) ; 
-		COPY(weekday) ; COPY(day_ones) ; COPY(day_tens) ; 
+		COPY(sec_ones) ; COPY(sec_tens) ; COPY(min_ones) ;
+		COPY(min_tens) ; COPY(hr_ones) ; COPY(hr_tens) ;
+		COPY(weekday) ; COPY(day_ones) ; COPY(day_tens) ;
 		COPY(mon_ones) ; COPY(mon_tens) ; COPY(year_ones) ;
 		COPY(year_tens) ;
 	/* prevent from writing the clock while it changed */
@@ -104,14 +104,14 @@
     int hour, year;
     int hr24=0;
     struct MSTE_RTC val;
-    
+
     mste_rtc.mode=(mste_rtc.mode | 1);
     hr24=mste_rtc.mon_tens & 1;
     mste_rtc.mode=(mste_rtc.mode & ~1);
 
     if (op) {
         /* write: prepare values */
-        
+
         val.sec_ones = t->tm_sec % 10;
         val.sec_tens = t->tm_sec / 10;
         val.min_ones = t->tm_min % 10;
@@ -160,8 +160,8 @@
 
 int atari_tt_hwclk( int op, struct rtc_time *t )
 {
-    int sec=0, min=0, hour=0, day=0, mon=0, year=0, wday=0; 
-    unsigned long 	flags;
+    int sec=0, min=0, hour=0, day=0, mon=0, year=0, wday=0;
+    unsigned long	flags;
     unsigned char	ctrl;
     int pm = 0;
 
@@ -170,7 +170,7 @@
 
     if (op) {
         /* write: prepare values */
-        
+
         sec  = t->tm_sec;
         min  = t->tm_min;
         hour = t->tm_hour;
@@ -178,7 +178,7 @@
         mon  = t->tm_mon + 1;
         year = t->tm_year - atari_rtc_year_offset;
         wday = t->tm_wday + (t->tm_wday >= 0);
-        
+
         if (!(ctrl & RTC_24H)) {
 	    if (hour > 11) {
 		pm = 0x80;
@@ -188,7 +188,7 @@
 	    else if (hour == 0)
 		hour = 12;
         }
-        
+
         if (!(ctrl & RTC_DM_BINARY)) {
             BIN_TO_BCD(sec);
             BIN_TO_BCD(min);
@@ -199,7 +199,7 @@
             if (wday >= 0) BIN_TO_BCD(wday);
         }
     }
-    
+
     /* Reading/writing the clock registers is a bit critical due to
      * the regular update cycle of the RTC. While an update is in
      * progress, registers 0..9 shouldn't be touched.
@@ -242,7 +242,7 @@
 
     if (!op) {
         /* read: adjust values */
-        
+
         if (hour & 0x80) {
 	    hour &= ~0x80;
 	    pm = 1;
@@ -284,7 +284,7 @@
     struct MSTE_RTC val;
     unsigned char rtc_minutes;
 
-    mste_read(&val);  
+    mste_read(&val);
     rtc_minutes= val.min_ones + val.min_tens * 10;
     if ((rtc_minutes < real_minutes
          ? real_minutes - rtc_minutes
diff -Nru a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c
--- a/arch/m68k/bvme6000/rtc.c	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/bvme6000/rtc.c	Tue Jun 15 22:20:41 2004
@@ -44,7 +44,7 @@
 	volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE;
 	unsigned char msr;
 	unsigned long flags;
-	struct rtc_time wtime; 
+	struct rtc_time wtime;
 
 	switch (cmd) {
 	case RTC_RD_TIME:	/* Read the time/date from RTC	*/
@@ -105,7 +105,7 @@
 
 		if (yrs >= 2070)
 			return -EINVAL;
-		
+
 		local_irq_save(flags);
 		/* Ensure clock and real-time-mode-register are accessible */
 		msr = rtc->msr & 0xc0;
diff -Nru a/arch/m68k/defconfig b/arch/m68k/defconfig
--- a/arch/m68k/defconfig	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/defconfig	Tue Jun 15 22:20:36 2004
@@ -101,7 +101,7 @@
 # CONFIG_ATM is not set
 
 #
-#  
+#
 #
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
diff -Nru a/arch/m68k/fpsp040/README b/arch/m68k/fpsp040/README
--- a/arch/m68k/fpsp040/README	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/fpsp040/README	Tue Jun 15 22:20:38 2004
@@ -12,7 +12,7 @@
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
 PARTICULAR PURPOSE and any warranty against infringement with
 regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-and any accompanying written materials. 
+and any accompanying written materials.
 
 To the maximum extent permitted by applicable law,
 IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
@@ -20,7 +20,7 @@
 PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
 OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
 SOFTWARE.  Motorola assumes no responsibility for the maintenance
-and support of the SOFTWARE.  
+and support of the SOFTWARE.
 
 You are hereby granted a copyright license to use, modify, and
 distribute the SOFTWARE so long as this entire notice is retained
diff -Nru a/arch/m68k/fpsp040/bindec.S b/arch/m68k/fpsp040/bindec.S
--- a/arch/m68k/fpsp040/bindec.S	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/fpsp040/bindec.S	Tue Jun 15 22:20:38 2004
@@ -19,7 +19,7 @@
 |
 |	Algorithm:
 |
-|	A1.	Set RM and size ext;  Set SIGMA = sign of input.  
+|	A1.	Set RM and size ext;  Set SIGMA = sign of input.
 |		The k-factor is saved for use in d7. Clear the
 |		BINDEC_FLG for separating normalized/denormalized
 |		input.  If input is unnormalized or denormalized,
@@ -29,15 +29,15 @@
 |
 |	A3.	Compute ILOG.
 |		ILOG is the log base 10 of the input value.  It is
-|		approximated by adding e + 0.f when the original 
-|		value is viewed as 2^^e * 1.f in extended precision.  
+|		approximated by adding e + 0.f when the original
+|		value is viewed as 2^^e * 1.f in extended precision.
 |		This value is stored in d6.
 |
 |	A4.	Clr INEX bit.
-|		The operation in A3 above may have set INEX2.  
+|		The operation in A3 above may have set INEX2.
 |
 |	A5.	Set ICTR = 0;
-|		ICTR is a flag used in A13.  It must be set before the 
+|		ICTR is a flag used in A13.  It must be set before the
 |		loop entry A6.
 |
 |	A6.	Calculate LEN.
@@ -59,9 +59,9 @@
 |		of ISCALE and X.  A table is given in the code.
 |
 |	A8.	Clr INEX; Force RZ.
-|		The operation in A3 above may have set INEX2.  
+|		The operation in A3 above may have set INEX2.
 |		RZ mode is forced for the scaling operation to insure
-|		only one rounding error.  The grs bits are collected in 
+|		only one rounding error.  The grs bits are collected in
 |		the INEX flag for use in A10.
 |
 |	A9.	Scale X -> Y.
@@ -90,11 +90,11 @@
 |		the mantissa by 10.
 |
 |	A14.	Convert the mantissa to bcd.
-|		The binstr routine is used to convert the LEN digit 
+|		The binstr routine is used to convert the LEN digit
 |		mantissa to bcd in memory.  The input to binstr is
 |		to be a fraction; i.e. (mantissa)/10^LEN and adjusted
 |		such that the decimal point is to the left of bit 63.
-|		The bcd digits are stored in the correct position in 
+|		The bcd digits are stored in the correct position in
 |		the final string area in memory.
 |
 |	A15.	Convert the exponent to bcd.
@@ -114,7 +114,7 @@
 |		d2: upper 32-bits of mantissa for binstr
 |		d3: scratch;lower 32-bits of mantissa for binstr
 |		d4: LEN
-|      		d5: LAMBDA/ICTR
+|		d5: LAMBDA/ICTR
 |		d6: ILOG
 |		d7: k-factor
 |		a0: ptr for original operand/final result
@@ -131,8 +131,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |BINDEC    idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -142,16 +142,16 @@
 	|section	8
 
 | Constants in extended precision
-LOG2: 	.long	0x3FFD0000,0x9A209A84,0xFBCFF798,0x00000000
+LOG2:	.long	0x3FFD0000,0x9A209A84,0xFBCFF798,0x00000000
 LOG2UP1:	.long	0x3FFD0000,0x9A209A84,0xFBCFF799,0x00000000
 
 | Constants in single precision
-FONE: 	.long	0x3F800000,0x00000000,0x00000000,0x00000000
+FONE:	.long	0x3F800000,0x00000000,0x00000000,0x00000000
 FTWO:	.long	0x40000000,0x00000000,0x00000000,0x00000000
-FTEN: 	.long	0x41200000,0x00000000,0x00000000,0x00000000
+FTEN:	.long	0x41200000,0x00000000,0x00000000,0x00000000
 F4933:	.long	0x459A2800,0x00000000,0x00000000,0x00000000
 
-RBDTBL: 	.byte	0,0,0,0
+RBDTBL:	.byte	0,0,0,0
 	.byte	3,3,2,2
 	.byte	3,2,2,3
 	.byte	2,3,3,2
@@ -171,7 +171,7 @@
 |     separating  normalized/denormalized input.  If the input
 |     is a denormalized number, set the BINDEC_FLG memory word
 |     to signal denorm.  If the input is unnormalized, normalize
-|     the input and test for denormalized result.  
+|     the input and test for denormalized result.
 |
 	fmovel	#rm_mode,%FPCR	|set RM and ext
 	movel	(%a0),L_SCR2(%a6)	|save exponent for sign check
@@ -251,7 +251,7 @@
 	subw	#0x3fff,%d0	|strip off bias
 	faddw	%d0,%fp0		|add in exp
 	fsubs	FONE,%fp0	|subtract off 1.0
-	fbge	pos_res		|if pos, branch 
+	fbge	pos_res		|if pos, branch
 	fmulx	LOG2UP1,%fp0	|if neg, mul by LOG2UP1
 	fmovel	%fp0,%d6		|put ILOG in d6 as a lword
 	bras	A4_str		|go move out ILOG
@@ -261,14 +261,14 @@
 
 
 | A4. Clr INEX bit.
-|     The operation in A3 above may have set INEX2.  
+|     The operation in A3 above may have set INEX2.
 
-A4_str:	
+A4_str:
 	fmovel	#0,%FPSR		|zero all of fpsr - nothing needed
 
 
 | A5. Set ICTR = 0;
-|     ICTR is a flag used in A13.  It must be set before the 
+|     ICTR is a flag used in A13.  It must be set before the
 |     loop entry A6. The lower word of d5 is used for ICTR.
 
 	clrw	%d5		|clear ICTR
@@ -303,7 +303,7 @@
 |	L_SCR1:x/x
 |	L_SCR2:first word of X packed/Unchanged
 
-A6_str:	
+A6_str:
 	tstl	%d7		|branch on sign of k
 	bles	k_neg		|if k <= 0, LEN = ILOG + 1 - k
 	movel	%d7,%d4		|if k > 0, LEN = k
@@ -375,13 +375,13 @@
 |	L_SCR1:x/x
 |	L_SCR2:first word of X packed/Unchanged
 
-A7_str:	
+A7_str:
 	tstl	%d7		|test sign of k
 	bgts	k_pos		|if pos and > 0, skip this
 	cmpl	%d6,%d7		|test k - ILOG
 	blts	k_pos		|if ILOG >= k, skip this
 	movel	%d7,%d6		|if ((k<0) & (ILOG < k)) ILOG = k
-k_pos:	
+k_pos:
 	movel	%d6,%d0		|calc ILOG + 1 - LEN in d0
 	addql	#1,%d0		|add the 1
 	subl	%d4,%d0		|sub off LEN
@@ -395,9 +395,9 @@
 	bgts	no_inf		|if false, skip rest
 	addil	#24,%d0		|add in 24 to iscale
 	movel	#24,%d2		|put 24 in d2 for A9
-no_inf:	
+no_inf:
 	negl	%d0		|and take abs of ISCALE
-iscale:	
+iscale:
 	fmoves	FONE,%fp1	|init fp1 to 1
 	bfextu	USER_FPCR(%a6){#26:#2},%d1 |get initial rmode bits
 	lslw	#1,%d1		|put them in bits 2:1
@@ -425,33 +425,33 @@
 	leal	PTENRM,%a1	|load a1 with RM table base
 rmode:
 	clrl	%d3		|clr table index
-e_loop:	
+e_loop:
 	lsrl	#1,%d0		|shift next bit into carry
 	bccs	e_next		|if zero, skip the mul
 	fmulx	(%a1,%d3),%fp1	|mul by 10**(d3_bit_no)
-e_next:	
+e_next:
 	addl	#12,%d3		|inc d3 to next pwrten table entry
 	tstl	%d0		|test if ISCALE is zero
 	bnes	e_loop		|if not, loop
 
 
 | A8. Clr INEX; Force RZ.
-|     The operation in A3 above may have set INEX2.  
+|     The operation in A3 above may have set INEX2.
 |     RZ mode is forced for the scaling operation to insure
-|     only one rounding error.  The grs bits are collected in 
+|     only one rounding error.  The grs bits are collected in
 |     the INEX flag for use in A10.
 |
 | Register usage:
 |	Input/Output
 
-	fmovel	#0,%FPSR		|clr INEX 
+	fmovel	#0,%FPSR		|clr INEX
 	fmovel	#rz_mode,%FPCR	|set RZ rounding mode
 
 
 | A9. Scale X -> Y.
 |     The mantissa is scaled to the desired number of significant
 |     digits.  The excess digits are collected in INEX2. If mul,
-|     Check d2 for excess 10 exponential value.  If not zero, 
+|     Check d2 for excess 10 exponential value.  If not zero,
 |     the iscale value would have caused the pwrten calculation
 |     to overflow.  Only a negative iscale can cause this, so
 |     multiply by 10^(d2), which is now only allowed to be 24,
@@ -480,7 +480,7 @@
 |	L_SCR1:x/x
 |	L_SCR2:first word of X packed/Unchanged
 
-A9_str:	
+A9_str:
 	fmovex	(%a0),%fp0	|load X from memory
 	fabsx	%fp0		|use abs(X)
 	tstw	%d5		|LAMBDA is in lower word of d5
@@ -498,9 +498,9 @@
 	movel	#18,%d3		|load count for busy stack
 A9_loop:
 	clrl	-(%a7)		|clear lword on stack
-	dbf	%d3,A9_loop	
+	dbf	%d3,A9_loop
 	moveb	VER_TMP(%a6),(%a7) |write current version number
-	moveb	#BUSY_SIZE-4,1(%a7) |write current busy size 
+	moveb	#BUSY_SIZE-4,1(%a7) |write current busy size
 	moveb	#0x10,0x44(%a7)	|set fcefpte[15] bit
 	movew	#0x0023,0x40(%a7)	|load cmdreg1b with mul command
 	moveb	#0xfe,0x8(%a7)	|load all 1s to cu savepc
@@ -537,7 +537,7 @@
 |	fp1: 10^ISCALE/Unchanged
 |	fp2: x/x
 
-A10_st:	
+A10_st:
 	fmovel	%FPSR,%d0		|get FPSR
 	fmovex	%fp0,FP_SCR2(%a6)	|move Y to memory
 	leal	FP_SCR2(%a6),%a2	|load a2 with ptr to FP_SCR2
@@ -553,9 +553,9 @@
 |      routine expects the FPCR value to be in USER_FPCR for
 |      mode and precision.  The original FPCR is saved in L_SCR1.
 
-A11_st:	
+A11_st:
 	movel	USER_FPCR(%a6),L_SCR1(%a6) |save it for later
-	andil	#0x00000030,USER_FPCR(%a6) |set size to ext, 
+	andil	#0x00000030,USER_FPCR(%a6) |set size to ext,
 |					;block exceptions
 
 
@@ -584,13 +584,13 @@
 |	L_SCR2:first word of X packed/Unchanged
 
 A12_st:
-	moveml	%d0-%d1/%a0-%a1,-(%a7)	|save regs used by sintd0	
+	moveml	%d0-%d1/%a0-%a1,-(%a7)	|save regs used by sintd0
 	movel	L_SCR1(%a6),-(%a7)
 	movel	L_SCR2(%a6),-(%a7)
 	leal	FP_SCR2(%a6),%a0		|a0 is ptr to F_SCR2(a6)
 	fmovex	%fp0,(%a0)		|move Y to memory at FP_SCR2(a6)
 	tstl	L_SCR2(%a6)		|test sign of original operand
-	bges	do_fint			|if pos, use Y 
+	bges	do_fint			|if pos, use Y
 	orl	#0x80000000,(%a0)		|if neg, use -Y
 do_fint:
 	movel	USER_FPSR(%a6),-(%a7)
@@ -599,7 +599,7 @@
 	addl	#4,%a7
 	movel	(%a7)+,L_SCR2(%a6)
 	movel	(%a7)+,L_SCR1(%a6)
-	moveml	(%a7)+,%d0-%d1/%a0-%a1	|restore regs used by sint	
+	moveml	(%a7)+,%d0-%d1/%a0-%a1	|restore regs used by sint
 	movel	L_SCR2(%a6),FP_SCR2(%a6)	|restore original exponent
 	movel	L_SCR1(%a6),USER_FPCR(%a6) |restore user's FPCR
 
@@ -635,7 +635,7 @@
 |	L_SCR1:original USER_FPCR/Unchanged
 |	L_SCR2:first word of X packed/Unchanged
 
-A13_st:	
+A13_st:
 	swap	%d5		|put ICTR in lower word of d5
 	tstw	%d5		|check if ICTR = 0
 	bne	not_zr		|if non-zero, go to second test
@@ -646,7 +646,7 @@
 	movel	%d4,%d0		|put LEN in d0
 	subql	#1,%d0		|d0 = LEN -1
 	clrl	%d3		|clr table index
-l_loop:	
+l_loop:
 	lsrl	#1,%d0		|shift next bit into carry
 	bccs	l_next		|if zero, skip the mul
 	fmulx	(%a1,%d3),%fp2	|mul by 10**(d3_bit_no)
@@ -672,7 +672,7 @@
 	subql	#1,%d6		|subtract 1 from ILOG
 	movew	#1,%d5		|set ICTR
 	fmovel	#rm_mode,%FPCR	|set rmode to RM
-	fmuls	FTEN,%fp2	|compute 10^LEN 
+	fmuls	FTEN,%fp2	|compute 10^LEN
 	bra	A6_str		|return to A6 and recompute YINT
 test_2:
 	fmuls	FTEN,%fp2	|compute 10^LEN
@@ -688,7 +688,7 @@
 	fmovel	#rm_mode,%FPCR	|set rmode to RM
 	bra	A6_str		|return to A6 and recompute YINT
 |
-| Since ICTR <> 0, we have already been through one adjustment, 
+| Since ICTR <> 0, we have already been through one adjustment,
 | and shouldn't have another; this is to check if abs(YINT) = 10^LEN
 | 10^LEN is again computed using whatever table is in a1 since the
 | value calculated cannot be inexact.
@@ -715,11 +715,11 @@
 
 
 | A14. Convert the mantissa to bcd.
-|      The binstr routine is used to convert the LEN digit 
+|      The binstr routine is used to convert the LEN digit
 |      mantissa to bcd in memory.  The input to binstr is
 |      to be a fraction; i.e. (mantissa)/10^LEN and adjusted
 |      such that the decimal point is to the left of bit 63.
-|      The bcd digits are stored in the correct position in 
+|      The bcd digits are stored in the correct position in
 |      the final string area in memory.
 |
 |
@@ -745,7 +745,7 @@
 |	L_SCR1:original USER_FPCR/Unchanged
 |	L_SCR2:first word of X packed/Unchanged
 
-A14_st:	
+A14_st:
 	fmovel	#rz_mode,%FPCR	|force rz for conversion
 	fdivx	%fp2,%fp0		|divide abs(YINT) by 10^LEN
 	leal	FP_SCR1(%a6),%a0
@@ -762,7 +762,7 @@
 	bgts	no_sft		|if so, don't shift
 	negl	%d0		|make exp positive
 m_loop:
-	lsrl	#1,%d2		|shift d2:d3 right, add 0s 
+	lsrl	#1,%d2		|shift d2:d3 right, add 0s
 	roxrl	#1,%d3		|the number of places
 	dbf	%d0,m_loop	|given in d0
 no_sft:
@@ -787,9 +787,9 @@
 |
 |      Digits are stored in L_SCR1(a6) on return from BINDEC as:
 |
-|  	 32               16 15                0
+|	 32               16 15                0
 |	-----------------------------------------
-|  	|  0 | e3 | e2 | e1 | e4 |  X |  X |  X |
+|	|  0 | e3 | e2 | e1 | e4 |  X |  X |  X |
 |	-----------------------------------------
 |
 | And are moved into their proper places in FP_SCR1.  If digit e4
@@ -817,7 +817,7 @@
 |	L_SCR1:original USER_FPCR/Exponent digits on return from binstr
 |	L_SCR2:first word of X packed/Unchanged
 
-A15_st:	
+A15_st:
 	tstb	BINDEC_FLG(%a6)	|check for denorm
 	beqs	not_denorm
 	ftstx	%fp0		|test for zero
@@ -839,7 +839,7 @@
 	fbne	not_zero	|if zero, force exponent
 	fmoves	FONE,%fp0	|force exponent to 1
 	bras	convrt		|do it
-not_zero:	
+not_zero:
 	fmovel	%d6,%fp0		|float ILOG
 	fabsx	%fp0		|get abs of ILOG
 convrt:
@@ -852,7 +852,7 @@
 	subiw	#0x3ffd,%d0	|subtract off bias
 	negw	%d0		|make exp positive
 x_loop:
-	lsrl	#1,%d2		|shift d2:d3 right 
+	lsrl	#1,%d2		|shift d2:d3 right
 	roxrl	#1,%d3		|the number of places
 	dbf	%d0,x_loop	|given in d0
 x_loop_fin:
@@ -863,12 +863,12 @@
 	movel	#4,%d0		|put 4 in d0 for binstr call
 	leal	L_SCR1(%a6),%a0	|a0 is ptr to L_SCR1 for exp digits
 	bsr	binstr		|call binstr to convert exp
-	movel	L_SCR1(%a6),%d0	|load L_SCR1 lword to d0 
+	movel	L_SCR1(%a6),%d0	|load L_SCR1 lword to d0
 	movel	#12,%d1		|use d1 for shift count
 	lsrl	%d1,%d0		|shift d0 right by 12
 	bfins	%d0,FP_SCR1(%a6){#4:#12} |put e3:e2:e1 in FP_SCR1
 	lsrl	%d1,%d0		|shift d0 right by 12
-	bfins	%d0,FP_SCR1(%a6){#16:#4} |put e4 in FP_SCR1 
+	bfins	%d0,FP_SCR1(%a6){#16:#4} |put e4 in FP_SCR1
 	tstb	%d0		|check if e4 is zero
 	beqs	A16_st		|if zero, skip rest
 	orl	#opaop_mask,USER_FPSR(%a6) |set OPERR & AIOP in USER_FPSR
@@ -899,14 +899,14 @@
 
 A16_st:
 	clrl	%d0		|clr d0 for collection of signs
-	andib	#0x0f,FP_SCR1(%a6) |clear first nibble of FP_SCR1 
+	andib	#0x0f,FP_SCR1(%a6) |clear first nibble of FP_SCR1
 	tstl	L_SCR2(%a6)	|check sign of original mantissa
 	bges	mant_p		|if pos, don't set SM
 	moveql	#2,%d0		|move 2 in to d0 for SM
 mant_p:
 	tstl	%d6		|check sign of ILOG
 	bges	wr_sgn		|if pos, don't set SE
-	addql	#1,%d0		|set bit 0 in d0 for SE 
+	addql	#1,%d0		|set bit 0 in d0 for SE
 wr_sgn:
 	bfins	%d0,FP_SCR1(%a6){#0:#2} |insert SM and SE into FP_SCR1
 
diff -Nru a/arch/m68k/fpsp040/binstr.S b/arch/m68k/fpsp040/binstr.S
--- a/arch/m68k/fpsp040/binstr.S	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/fpsp040/binstr.S	Tue Jun 15 22:20:39 2004
@@ -60,8 +60,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |BINSTR    idnt    2,1 | Motorola 040 Floating Point Software Package
diff -Nru a/arch/m68k/fpsp040/bugfix.S b/arch/m68k/fpsp040/bugfix.S
--- a/arch/m68k/fpsp040/bugfix.S	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/fpsp040/bugfix.S	Tue Jun 15 22:20:40 2004
@@ -7,7 +7,7 @@
 |
 |	Fixes for bugs: 1238
 |
-|	Bug: 1238 
+|	Bug: 1238
 |
 |
 |    /* The following dirty_bit clear should be left in
@@ -152,8 +152,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |BUGFIX    idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -167,8 +167,8 @@
 	.global	b1238_fix
 b1238_fix:
 |
-| This code is entered only on completion of the handling of an 
-| nu-generated ovfl, unfl, or inex exception.  If the version 
+| This code is entered only on completion of the handling of an
+| nu-generated ovfl, unfl, or inex exception.  If the version
 | number of the fsave is not $40, this handler is not necessary.
 | Simply branch to fix_done and exit normally.
 |
@@ -180,11 +180,11 @@
 |
 	moveb	CU_SAVEPC(%a6),%d0
 	andib	#0xFE,%d0
-	beq 	fix_done	|if zero, this is not bug #1238
+	beq	fix_done	|if zero, this is not bug #1238
 
 |
 | Test the register conflict aspect.  If opclass0, check for
-| cu src equal to xu dest or equal to nu dest.  If so, go to 
+| cu src equal to xu dest or equal to nu dest.  If so, go to
 | op0.  Else, or if opclass2, check for cu dest equal to
 | xu dest or equal to nu dest.  If so, go to tst_opcl.  Else,
 | exit, it is not the bug case.
@@ -196,17 +196,17 @@
 	bne	op2sgl			|not opclass 0, check op2
 |
 | Check for cu and nu register conflict.  If one exists, this takes
-| priority over a cu and xu conflict. 
+| priority over a cu and xu conflict.
 |
-	bfextu	CMDREG1B(%a6){#3:#3},%d0	|get 1st src 
+	bfextu	CMDREG1B(%a6){#3:#3},%d0	|get 1st src
 	bfextu	CMDREG3B(%a6){#6:#3},%d1	|get 3rd dest
 	cmpb	%d0,%d1
 	beqs	op0			|if equal, continue bugfix
 |
-| Check for cu dest equal to nu dest.  If so, go and fix the 
+| Check for cu dest equal to nu dest.  If so, go and fix the
 | bug condition.  Otherwise, exit.
 |
-	bfextu	CMDREG1B(%a6){#6:#3},%d0	|get 1st dest 
+	bfextu	CMDREG1B(%a6){#6:#3},%d0	|get 1st dest
 	cmpb	%d0,%d1			|cmp 1st dest with 3rd dest
 	beqs	op0			|if equal, continue bugfix
 |
@@ -215,7 +215,7 @@
 	bfextu	CMDREG2B(%a6){#6:#3},%d1	|get 2nd dest
 	cmpb	%d0,%d1			|cmp 1st dest with 2nd dest
 	beqs	op0_xu			|if equal, continue bugfix
-	bfextu	CMDREG1B(%a6){#3:#3},%d0	|get 1st src 
+	bfextu	CMDREG1B(%a6){#3:#3},%d0	|get 1st src
 	cmpb	%d0,%d1			|cmp 1st src with 2nd dest
 	beq	op0_xu
 	bne	fix_done		|if the reg checks fail, exit
@@ -245,7 +245,7 @@
 
 |
 | We have the case in which a conflict exists between the cu src or
-| dest and the dest of the xu.  We must clear the instruction in 
+| dest and the dest of the xu.  We must clear the instruction in
 | the cu and restore the state, allowing the instruction in the
 | xu to complete.  Remember, the instruction in the nu
 | was exceptional, and was completed by the appropriate handler.
@@ -255,7 +255,7 @@
 | exceptional, we choose to kill the process.
 |
 |	Items saved from the stack:
-|	
+|
 |		$3c stag     - L_SCR1
 |		$40 cmdreg1b - L_SCR2
 |		$44 dtag     - L_SCR3
@@ -264,8 +264,8 @@
 | fpu.
 |
 op0_xu:
-	movel	STAG(%a6),L_SCR1(%a6)	
-	movel	CMDREG1B(%a6),L_SCR2(%a6)	
+	movel	STAG(%a6),L_SCR1(%a6)
+	movel	CMDREG1B(%a6),L_SCR2(%a6)
 	movel	DTAG(%a6),L_SCR3(%a6)
 	andil	#0xe0000000,L_SCR3(%a6)
 	moveb	#0,CU_SAVEPC(%a6)
@@ -274,13 +274,13 @@
 	fsave	-(%a7)
 |
 | Check if the instruction which just completed was exceptional.
-| 
+|
 	cmpw	#0x4060,(%a7)
 	beq	op0_xb
-| 
+|
 | It is necessary to isolate the result of the instruction in the
 | xu if it is to fp0 - fp3 and write that value to the USER_FPn
-| locations on the stack.  The correct destination register is in 
+| locations on the stack.  The correct destination register is in
 | cmdreg2b.
 |
 	bfextu	CMDREG2B(%a6){#6:#3},%d0	|get dest register no
@@ -339,7 +339,7 @@
 
 |
 | The frame returned is busy.  It is not possible to reconstruct
-| the code sequence to allow completion.  We will jump to 
+| the code sequence to allow completion.  We will jump to
 | fpsp_fmt_error and allow the kernel to kill the process.
 |
 op0_xb:
@@ -354,20 +354,20 @@
 	cmpiw	#0x4400,%d0		|test for opclass 2 and size=sgl
 	bne	fix_done		|if not, it is not bug 1238
 |
-| Check for cu dest equal to nu dest or equal to xu dest, with 
+| Check for cu dest equal to nu dest or equal to xu dest, with
 | a cu and nu conflict taking priority an nu conflict.  If either,
 | go and fix the bug condition.  Otherwise, exit.
 |
-	bfextu	CMDREG1B(%a6){#6:#3},%d0	|get 1st dest 
+	bfextu	CMDREG1B(%a6){#6:#3},%d0	|get 1st dest
 	bfextu	CMDREG3B(%a6){#6:#3},%d1	|get 3rd dest
 	cmpb	%d0,%d1			|cmp 1st dest with 3rd dest
 	beq	op2_com			|if equal, continue bugfix
-	bfextu	CMDREG2B(%a6){#6:#3},%d1	|get 2nd dest 
+	bfextu	CMDREG2B(%a6){#6:#3},%d1	|get 2nd dest
 	cmpb	%d0,%d1			|cmp 1st dest with 2nd dest
 	bne	fix_done		|if the reg checks fail, exit
 |
 | We have the case in which a conflict exists between the cu src or
-| dest and the dest of the xu.  We must clear the instruction in 
+| dest and the dest of the xu.  We must clear the instruction in
 | the cu and restore the state, allowing the instruction in the
 | xu to complete.  Remember, the instruction in the nu
 | was exceptional, and was completed by the appropriate handler.
@@ -377,7 +377,7 @@
 | exceptional, we choose to kill the process.
 |
 |	Items saved from the stack:
-|	
+|
 |		$3c stag     - L_SCR1
 |		$40 cmdreg1b - L_SCR2
 |		$44 dtag     - L_SCR3
@@ -387,9 +387,9 @@
 | fpu.
 |
 op2_xu:
-	movel	STAG(%a6),L_SCR1(%a6)	
-	movel	CMDREG1B(%a6),L_SCR2(%a6)	
-	movel	DTAG(%a6),L_SCR3(%a6)	
+	movel	STAG(%a6),L_SCR1(%a6)
+	movel	CMDREG1B(%a6),L_SCR2(%a6)
+	movel	DTAG(%a6),L_SCR3(%a6)
 	andil	#0xe0000000,L_SCR3(%a6)
 	moveb	#0,CU_SAVEPC(%a6)
 	movel	ETEMP(%a6),FP_SCR2(%a6)
@@ -400,13 +400,13 @@
 	fsave	-(%a7)
 |
 | Check if the instruction which just completed was exceptional.
-| 
+|
 	cmpw	#0x4060,(%a7)
 	beq	op2_xb
-| 
+|
 | It is necessary to isolate the result of the instruction in the
 | xu if it is to fp0 - fp3 and write that value to the USER_FPn
-| locations on the stack.  The correct destination register is in 
+| locations on the stack.  The correct destination register is in
 | cmdreg2b.
 |
 	bfextu	CMDREG2B(%a6){#6:#3},%d0	|get dest register no
@@ -459,12 +459,12 @@
 	bnes	case2
 	movew	#0x43FF,ETEMP_EX(%a6)	|to double +max
 	bra	finish
-case2:	
+case2:
 	cmpw	#0xC07F,ETEMP_EX(%a6)	|single -max
 	bnes	case3
 	movew	#0xC3FF,ETEMP_EX(%a6)	|to double -max
 	bra	finish
-case3:	
+case3:
 	cmpw	#0x3F80,ETEMP_EX(%a6)	|single +min
 	bnes	case4
 	movew	#0x3C00,ETEMP_EX(%a6)	|to double +min
@@ -480,7 +480,7 @@
 | an fline illegal instruction to be executed.
 |
 | You should replace the jump to fpsp_fmt_error with a jump
-| to the entry point used to kill a process. 
+| to the entry point used to kill a process.
 |
 op2_xb:
 	jmp	fpsp_fmt_error
diff -Nru a/arch/m68k/fpsp040/decbin.S b/arch/m68k/fpsp040/decbin.S
--- a/arch/m68k/fpsp040/decbin.S	Tue Jun 15 22:20:43 2004
+++ b/arch/m68k/fpsp040/decbin.S	Tue Jun 15 22:20:43 2004
@@ -60,17 +60,17 @@
 |	it is negative.
 |
 |	Clean up and return.  Check if the final mul or div resulted
-|	in an inex2 exception.  If so, set inex1 in the fpsr and 
+|	in an inex2 exception.  If so, set inex1 in the fpsr and
 |	check if the inex1 exception is enabled.  If so, set d7 upper
 |	word to $0100.  This will signal unimp.sa that an enabled inex1
 |	exception occurred.  Unimp will fix the stack.
-|	
+|
 
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |DECBIN    idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -107,12 +107,12 @@
 	.set	FSTRT,0
 |
 	.set	ESTRT,4
-	.set	EDIGITS,2	| 
+	.set	EDIGITS,2	|
 |
 | Constants in single precision
-FZERO: 	.long	0x00000000
-FONE: 	.long	0x3F800000
-FTEN: 	.long	0x41200000
+FZERO:	.long	0x00000000
+FONE:	.long	0x3F800000
+FTEN:	.long	0x41200000
 
 	.set	TEN,10
 
@@ -224,7 +224,7 @@
 	addql	#1,%d1		|inc lw pointer in mantissa
 	cmpl	#2,%d1		|test for last lw
 	ble	loadlw		|if not, get last one
-	
+
 |
 |  Check the sign of the mant and make the value in fp0 the same sign.
 |
@@ -232,7 +232,7 @@
 	btst	#31,(%a0)	|test sign of the mantissa
 	beq	ap_st_z		|if clear, go to append/strip zeros
 	fnegx	%fp0		|if set, negate fp0
-	
+
 |
 | Append/strip zeros:
 |
@@ -407,7 +407,7 @@
 |
 | Pwrten calculates the exponent factor in the selected rounding mode
 | according to the following table:
-|	
+|
 |	Sign of Mant  Sign of Exp  Rounding Mode  PWRTEN Rounding Mode
 |
 |	ANY	  ANY	RN	RN
@@ -495,7 +495,7 @@
 | it will be inex2, but will be reported as inex1 by get_op.
 |
 end_dec:
-	fmovel	%FPSR,%d0		|get status register	
+	fmovel	%FPSR,%d0		|get status register
 	bclrl	#inex2_bit+8,%d0	|test for inex2 and clear it
 	fmovel	%d0,%FPSR		|return status reg w/o inex2
 	beqs	no_exc		|skip this if no exc
diff -Nru a/arch/m68k/fpsp040/do_func.S b/arch/m68k/fpsp040/do_func.S
--- a/arch/m68k/fpsp040/do_func.S	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/fpsp040/do_func.S	Tue Jun 15 22:20:41 2004
@@ -4,11 +4,11 @@
 | Do_func performs the unimplemented operation.  The operation
 | to be performed is determined from the lower 7 bits of the
 | extension word (except in the case of fmovecr and fsincos).
-| The opcode and tag bits form an index into a jump table in 
-| tbldo.sa.  Cases of zero, infinity and NaN are handled in 
+| The opcode and tag bits form an index into a jump table in
+| tbldo.sa.  Cases of zero, infinity and NaN are handled in
 | do_func by forcing the default result.  Normalized and
 | denormalized (there are no unnormalized numbers at this
-| point) are passed onto the emulation code.  
+| point) are passed onto the emulation code.
 |
 | CMDREG1B and STAG are extracted from the fsave frame
 | and combined to form the table index.  The function called
@@ -22,8 +22,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 DO_FUNC:	|idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -35,7 +35,7 @@
 	|xref	t_dz2
 	|xref	t_operr
 	|xref	t_inx2
-	|xref 	t_resdnrm
+	|xref	t_resdnrm
 	|xref	dst_nan
 	|xref	src_nan
 	|xref	nrm_set
@@ -68,7 +68,7 @@
 | directly.
 |
 	bfextu	CMDREG1B(%a6){#0:#6},%d0 |get opclass and src fields
-	cmpil	#0x17,%d0		|if op class and size fields are $17, 
+	cmpil	#0x17,%d0		|if op class and size fields are $17,
 |				;it is FMOVECR; if not, continue
 	bnes	not_fmovecr
 	jmp	smovcr		|fmovecr; jmp directly to emulation
@@ -76,7 +76,7 @@
 not_fmovecr:
 	movew	CMDREG1B(%a6),%d0
 	andl	#0x7F,%d0
-	cmpil	#0x38,%d0		|if the extension is >= $38, 
+	cmpil	#0x38,%d0		|if the extension is >= $38,
 	bge	serror		|it is illegal
 	bfextu	STAG(%a6){#0:#3},%d1
 	lsll	#3,%d0		|make room for STAG
@@ -111,7 +111,7 @@
 	bsr	ld_mzero	|if neg, load neg zero, return here
 	bra	t_inx2		|now, set the inx for the next inst
 |
-| Load a signed zero to fp0; do not set inex2/ainex 
+| Load a signed zero to fp0; do not set inex2/ainex
 |
 	.global	szero
 szero:
@@ -119,7 +119,7 @@
 	bne	ld_mzero	|if neg, load neg zero
 	bra	ld_pzero	|load positive zero
 |
-| Load a signed infinity to fp0; do not set inex2/ainex 
+| Load a signed infinity to fp0; do not set inex2/ainex
 |
 	.global	sinf
 sinf:
@@ -127,7 +127,7 @@
 	bne	ld_minf			|if negative branch
 	bra	ld_pinf
 |
-| Load a signed one to fp0; do not set inex2/ainex 
+| Load a signed one to fp0; do not set inex2/ainex
 |
 	.global	sone
 sone:
@@ -135,7 +135,7 @@
 	bne	ld_mone
 	bra	ld_pone
 |
-| Load a signed pi/2 to fp0; do not set inex2/ainex 
+| Load a signed pi/2 to fp0; do not set inex2/ainex
 |
 	.global	spi_2
 spi_2:
@@ -160,13 +160,13 @@
 	bne	t_operr
 	bra	ld_pinf
 |
-|	FLOGNP1 
+|	FLOGNP1
 |
 	.global	sslognp1
 sslognp1:
 	fmovemx (%a0),%fp0-%fp0
 	fcmpb	#-1,%fp0
-	fbgt	slognp1		
+	fbgt	slognp1
 	fbeq	t_dz2		|if = -1, divide by zero exception
 	fmovel	#0,%FPSR		|clr N flag
 	bra	t_operr		|take care of operands < -1
@@ -186,7 +186,7 @@
 |
 	.global	sslogn
 sslogn:
-	btstb	#sign_bit,LOCAL_EX(%a0) 
+	btstb	#sign_bit,LOCAL_EX(%a0)
 	bne	t_operr		|take care of operands < 0
 	cmpiw	#0x3fff,LOCAL_EX(%a0) |test for 1.0 input
 	bne	slogn
@@ -199,7 +199,7 @@
 
 	.global	sslognd
 sslognd:
-	btstb	#sign_bit,LOCAL_EX(%a0) 
+	btstb	#sign_bit,LOCAL_EX(%a0)
 	beq	slognd
 	bra	t_operr		|take care of operands < 0
 
@@ -221,7 +221,7 @@
 
 	.global	sslog10d
 sslog10d:
-	btstb	#sign_bit,LOCAL_EX(%a0) 
+	btstb	#sign_bit,LOCAL_EX(%a0)
 	beq	slog10d
 	bra	t_operr		|take care of operands < 0
 
@@ -243,7 +243,7 @@
 
 	.global	sslog2d
 sslog2d:
-	btstb	#sign_bit,LOCAL_EX(%a0) 
+	btstb	#sign_bit,LOCAL_EX(%a0)
 	beq	slog2d
 	bra	t_operr		|take care of operands < 0
 
@@ -310,7 +310,7 @@
 	btstl	#7,%d0		|test if + or -
 	beq	ld_pzero	|if pos then load +0
 	bra	ld_mzero	|else neg load -0
-	
+
 smod_fpn:
 	moveb	ETEMP(%a6),%d1	|get sign of src op
 	moveb	FPTEMP(%a6),%d0	|get sign of dst op
@@ -327,7 +327,7 @@
 	fmovel USER_FPCR(%a6),%fpcr |use user's rmode and precision
 	fmovex FPTEMP(%a6),%fp0	|return dest to fp0
 	rts
-		
+
 |
 |	FREM
 |
@@ -372,7 +372,7 @@
 	lea	premt,%a1
 	movel	(%a1,%d1.w*4),%a1
 	jmp	(%a1)
-	
+
 srem_snan:
 	bra	src_nan
 srem_dnan:
@@ -390,7 +390,7 @@
 	btstl	#7,%d0		|test if + or -
 	beq	ld_pzero	|if pos then load +0
 	bra	ld_mzero	|else neg load -0
-	
+
 srem_fpn:
 	moveb	ETEMP(%a6),%d1	|get sign of src op
 	moveb	FPTEMP(%a6),%d0	|get sign of dst op
@@ -424,10 +424,10 @@
 	.long	scl_inf		|  10,00  inf,norm  = +-inf
 	.long	scl_inf		|  10,01  inf,zero  = +-inf
 	.long	scl_opr		|  10,10  inf,inf   = nan with operr
- 	.long	scl_snan	|  10,11  inf,nan   = nan
- 	.long	scl_dnan	|  11,00  nan,norm  = nan
- 	.long	scl_dnan	|  11,01  nan,zero  = nan
- 	.long	scl_dnan	|  11,10  nan,inf   = nan
+	.long	scl_snan	|  10,11  inf,nan   = nan
+	.long	scl_dnan	|  11,00  nan,norm  = nan
+	.long	scl_dnan	|  11,01  nan,zero  = nan
+	.long	scl_dnan	|  11,10  nan,inf   = nan
 	.long	scl_dnan	|  11,11  nan,nan   = nan
 
 	.global	pscale
@@ -478,7 +478,7 @@
 sincosp:
 	fmovex PZERO,%fp0
 sincoscom:
-  	fmovemx PONE,%fp1-%fp1	|do not allow FPSR to be affected
+	fmovemx PONE,%fp1-%fp1	|do not allow FPSR to be affected
 	bra	sto_cos		|store cosine result
 
 	.global	ssincosi
@@ -498,7 +498,7 @@
 	bsr	sto_cos
 	bra	src_nan
 |
-| This code forces default values for the zero, inf, and nan cases 
+| This code forces default values for the zero, inf, and nan cases
 | in the transcendentals code.  The CC bits must be set in the
 | stacked FPSR to be correctly reported.
 |
diff -Nru a/arch/m68k/fpsp040/fpsp.h b/arch/m68k/fpsp040/fpsp.h
--- a/arch/m68k/fpsp040/fpsp.h	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/fpsp040/fpsp.h	Tue Jun 15 22:20:41 2004
@@ -5,15 +5,15 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |	fpsp.h --- stack frame offsets during FPSP exception handling
 |
 |	These equates are used to access the exception frame, the fsave
 |	frame and any local variables needed by the FPSP package.
-|	
+|
 |	All FPSP handlers begin by executing:
 |
 |		link	a6,#-LOCAL_SIZE
@@ -90,13 +90,13 @@
 	.set	USER_FP2,LV+40		| saved user FP2
 	.set	USER_FP3,LV+52		| saved user FP3
 	.set	USER_FPCR,LV+64		| saved user FPCR
-	.set	FPCR_ENABLE,USER_FPCR+2	| 	FPCR exception enable 
-	.set	FPCR_MODE,USER_FPCR+3	| 	FPCR rounding mode control
+	.set	FPCR_ENABLE,USER_FPCR+2	|	FPCR exception enable
+	.set	FPCR_MODE,USER_FPCR+3	|	FPCR rounding mode control
 	.set	USER_FPSR,LV+68		| saved user FPSR
-	.set	FPSR_CC,USER_FPSR+0	| 	FPSR condition code
-	.set	FPSR_QBYTE,USER_FPSR+1	| 	FPSR quotient
-	.set	FPSR_EXCEPT,USER_FPSR+2	| 	FPSR exception
-	.set	FPSR_AEXCEPT,USER_FPSR+3	| 	FPSR accrued exception
+	.set	FPSR_CC,USER_FPSR+0	|	FPSR condition code
+	.set	FPSR_QBYTE,USER_FPSR+1	|	FPSR quotient
+	.set	FPSR_EXCEPT,USER_FPSR+2	|	FPSR exception
+	.set	FPSR_AEXCEPT,USER_FPSR+3	|	FPSR accrued exception
 	.set	USER_FPIAR,LV+72		| saved user FPIAR
 	.set	FP_SCR1,LV+76		| room for a temporary float value
 	.set	FP_SCR2,LV+92		| room for a temporary float value
@@ -143,8 +143,8 @@
 	.set	CMDREG3B,LV-48		| cmd reg for E3 exceptions (2 bytes)
 |
 	.set	NMNEXC,LV-44		| NMNEXC (unsup,snan bits only)
-	.set	nmn_unsup_bit,1	| 
-	.set	nmn_snan_bit,0	| 
+	.set	nmn_unsup_bit,1	|
+	.set	nmn_snan_bit,0	|
 |
 	.set	NMCEXC,LV-43		| NMNEXC & NMCEXC
 	.set	nmn_operr_bit,7
@@ -249,7 +249,7 @@
 	.set	inf_mask,0x02000000
 	.set	nan_mask,0x01000000
 |
-	.set	bsun_mask,0x00008000	| 
+	.set	bsun_mask,0x00008000	|
 	.set	snan_mask,0x00004000
 	.set	operr_mask,0x00002000
 	.set	ovfl_mask,0x00001000
@@ -268,7 +268,7 @@
 |
 	.set	dzinf_mask,inf_mask+dz_mask+adz_mask
 	.set	opnan_mask,nan_mask+operr_mask+aiop_mask
-	.set	nzi_mask,0x01ffffff 	|  clears N, Z, and I
+	.set	nzi_mask,0x01ffffff	|  clears N, Z, and I
 	.set	unfinx_mask,unfl_mask+inex2_mask+aunfl_mask+ainex_mask
 	.set	unf2inx_mask,unfl_mask+inex2_mask+ainex_mask
 	.set	ovfinx_mask,ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
diff -Nru a/arch/m68k/fpsp040/gen_except.S b/arch/m68k/fpsp040/gen_except.S
--- a/arch/m68k/fpsp040/gen_except.S	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/fpsp040/gen_except.S	Tue Jun 15 22:20:38 2004
@@ -2,10 +2,10 @@
 |	gen_except.sa 3.7 1/16/92
 |
 |	gen_except --- FPSP routine to detect reportable exceptions
-|	
+|
 |	This routine compares the exception enable byte of the
 |	user_fpcr on the stack with the exception status byte
-|	of the user_fpsr. 
+|	of the user_fpsr.
 |
 |	Any routine which may report an exceptions must load
 |	the stack frame in memory with the exceptional operand(s).
@@ -23,14 +23,14 @@
 |
 |	Note: The IEEE standard specifies that inex2 is to be
 |	reported if ovfl occurs and the ovfl enable bit is not
-|	set but the inex2 enable bit is.  
+|	set but the inex2 enable bit is.
 |
 |
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 GEN_EXCEPT:    |idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -70,12 +70,12 @@
 |
 	movel	ETEMP_EX(%a6),ETEMP_EX(%a1) |copy etemp from unimp
 	movel	ETEMP_HI(%a6),ETEMP_HI(%a1) |frame to busy frame
-	movel	ETEMP_LO(%a6),ETEMP_LO(%a1) 
+	movel	ETEMP_LO(%a6),ETEMP_LO(%a1)
 	movel	CMDREG1B(%a6),CMDREG1B(%a1) |set inst in frame to unimp
 	movel	CMDREG1B(%a6),%d0		|fix cmd1b to make it
 	andl	#0x03c30000,%d0		|work for cmd3b
 	bfextu	CMDREG1B(%a6){#13:#1},%d1	|extract bit 2
-	lsll	#5,%d1			
+	lsll	#5,%d1
 	swap	%d1
 	orl	%d1,%d0			|put it in the right place
 	bfextu	CMDREG1B(%a6){#10:#3},%d1	|extract bit 3,4,5
@@ -86,7 +86,7 @@
 |
 | Or in the FPSR from the emulation with the USER_FPSR on the stack.
 |
-	fmovel	%FPSR,%d0		
+	fmovel	%FPSR,%d0
 	orl	%d0,USER_FPSR(%a6)
 	movel	USER_FPSR(%a6),FPSR_SHADOW(%a1) |set exc bits
 	orl	#sx_mask,E_BYTE(%a1)
@@ -108,7 +108,7 @@
 	cmpib	#UNIMP_41_SIZE-4,1(%a7)	|test for rev unimp frame
 	bnel	fpsp_fmt_error		|if not $28 or $30
 	leal	UNIMP_41_SIZE+LOCAL_SIZE(%a7),%a1
-	
+
 unimp_con:
 |
 | Fix up the new unimp frame with entries from the old unimp frame
@@ -117,23 +117,23 @@
 |
 | Or in the FPSR from the emulation with the USER_FPSR on the stack.
 |
-	fmovel	%FPSR,%d0		
+	fmovel	%FPSR,%d0
 	orl	%d0,USER_FPSR(%a6)
 	bra	do_clean
 
 |
 | Frame is idle, so check for exceptions reported through
-| USER_FPSR and set the unimp frame accordingly.  
+| USER_FPSR and set the unimp frame accordingly.
 | A7 must be incremented to the point before the
 | idle fsave vector to the unimp vector.
 |
-	
+
 do_check:
 	addl	#4,%a7			|point A7 back to unimp frame
 |
 | Or in the FPSR from the emulation with the USER_FPSR on the stack.
 |
-	fmovel	%FPSR,%d0		
+	fmovel	%FPSR,%d0
 	orl	%d0,USER_FPSR(%a6)
 |
 | On a busy frame, we must clear the nmnexc bits.
@@ -165,10 +165,10 @@
 bsun_exc:
 	bra	do_clean
 |
-| The typical work to be done to the unimp frame to report an 
+| The typical work to be done to the unimp frame to report an
 | exception is to set the E1/E3 byte and clr the U flag.
-| commonE1 does this for E1 exceptions, which are snan, 
-| operr, and dz.  commonE3 does this for E3 exceptions, which 
+| commonE1 does this for E1 exceptions, which are snan,
+| operr, and dz.  commonE3 does this for E3 exceptions, which
 | are inex2 and inex1, and also clears the E1 exception bit
 | left over from the unimp exception.
 |
@@ -186,7 +186,7 @@
 
 unsE3:
 	tstb	RES_FLG(%a6)
-	bnes	unsE3_0	
+	bnes	unsE3_0
 unsE3_1:
 	bsetb	#E3,E_BYTE(%a6)		|set E3 flag
 unsE3_0:
@@ -194,7 +194,7 @@
 	movel	CMDREG1B(%a6),%d0
 	andl	#0x03c30000,%d0		|work for cmd3b
 	bfextu	CMDREG1B(%a6){#13:#1},%d1	|extract bit 2
-	lsll	#5,%d1			
+	lsll	#5,%d1
 	swap	%d1
 	orl	%d1,%d0			|put it in the right place
 	bfextu	CMDREG1B(%a6){#10:#3},%d1	|extract bit 3,4,5
@@ -218,8 +218,8 @@
 	beqs	no_exc			|if clear, exit
 	bras	ovfl_unfl		|go to unfl_ovfl to determine if
 |					;it is an unsupp or unimp exc
-	
-| No exceptions are to be reported.  If the instruction was 
+
+| No exceptions are to be reported.  If the instruction was
 | unimplemented, no FPU restore is necessary.  If it was
 | unsupported, we must perform the restore.
 no_exc:
@@ -227,7 +227,7 @@
 	beqs	uni_no_exc
 uns_no_exc:
 	tstb	RES_FLG(%a6)	|check if frestore is needed
-	bne	do_clean 	|if clear, no frestore needed
+	bne	do_clean	|if clear, no frestore needed
 uni_no_exc:
 	moveml	USER_DA(%a6),%d0-%d1/%a0-%a1
 	fmovemx USER_FP0(%a6),%fp0-%fp3
@@ -243,13 +243,13 @@
 |
 | Unimplemented Instruction Handler:
 | Ovfl:
-|   Only scosh, setox, ssinh, stwotox, and scale can set overflow in 
+|   Only scosh, setox, ssinh, stwotox, and scale can set overflow in
 |   this manner.
 | Unfl:
 |   Stwotox, setox, and scale can set underflow in this manner.
 |   Any of the other Library Routines such that f(x)=x in which
-|   x is an extended denorm can report an underflow exception. 
-|   It is the responsibility of the exception-causing exception 
+|   x is an extended denorm can report an underflow exception.
+|   It is the responsibility of the exception-causing exception
 |   to make sure that WBTEMP is correct.
 |
 |   The exceptional operand is in FP_SCR1.
@@ -306,7 +306,7 @@
 	movel	CMDREG1B(%a6),%d0		|fix cmd1b to make it
 	andl	#0x03c30000,%d0		|work for cmd3b
 	bfextu	CMDREG1B(%a6){#13:#1},%d1	|extract bit 2
-	lsll	#5,%d1			
+	lsll	#5,%d1
 	swap	%d1
 	orl	%d1,%d0			|put it in the right place
 	bfextu	CMDREG1B(%a6){#10:#3},%d1	|extract bit 3,4,5
@@ -318,10 +318,10 @@
 |
 | Check if the frame to be restored is busy or unimp.
 |** NOTE *** Bug fix for errata (0d43b #3)
-| If the frame is unimp, we must create a busy frame to 
+| If the frame is unimp, we must create a busy frame to
 | fix the bug with the nmnexc bits in cases in which they
 | are set by a previous instruction and not cleared by
-| the save. The frame will be unimp only if the final 
+| the save. The frame will be unimp only if the final
 | instruction in an emulation routine caused the exception
 | by doing an fmove <ea>,fp0.  The exception operand, in
 | internal format, is in fptemp.
@@ -353,7 +353,7 @@
 	leal	BUSY_SIZE+LOCAL_SIZE(%a7),%a1	|init a1 for new frame
 	moveb	VER_TMP(%a6),(%a7)	|write busy fmt word
 	moveb	#BUSY_SIZE-4,1(%a7)
-	movel	FP_SCR1(%a6),WBTEMP_EX(%a1) 	|write
+	movel	FP_SCR1(%a6),WBTEMP_EX(%a1)	|write
 	movel	FP_SCR1+4(%a6),WBTEMP_HI(%a1)	|exceptional op to
 	movel	FP_SCR1+8(%a6),WBTEMP_LO(%a1)	|wbtemp
 |	btst.b	#E1,E_BYTE(%a1)
@@ -362,7 +362,7 @@
 	bfins	%d0,NMCEXC(%a1){#4:#4}	|and insert them in nmcexc
 	movel	USER_FPSR(%a6),FPSR_SHADOW(%a1) |set exc bits
 	orl	#sx_mask,E_BYTE(%a1)
-	
+
 do_restore:
 	moveml	USER_DA(%a6),%d0-%d1/%a0-%a1
 	fmovemx USER_FP0(%a6),%fp0-%fp3
@@ -374,10 +374,10 @@
 cont:
 	unlk	%a6
 |
-| If trace mode enabled, then go to trace handler.  This handler 
-| cannot have any fp instructions.  If there are fp inst's and an 
-| exception has been restored into the machine then the exception 
-| will occur upon execution of the fp inst.  This is not desirable 
+| If trace mode enabled, then go to trace handler.  This handler
+| cannot have any fp instructions.  If there are fp inst's and an
+| exception has been restored into the machine then the exception
+| will occur upon execution of the fp inst.  This is not desirable
 | in the kernel (supervisor mode).  See MC68040 manual Section 9.3.8.
 |
 finish_up:
@@ -436,12 +436,12 @@
         movel  USER_D1(%a6),%d1  | restore d1
 	movel	#0x40280000,-(%sp)
 	frestore (%sp)+
-	unlk  	%a5	
+	unlk	%a5
 	rts
 
 frame_41:
 	tstb	1(%sp)		| check to see if idle
-	bne	notidle	
+	bne	notidle
 idle41:
 	clrl	(%sp)		| get rid of old fsave frame
         movel  %d1,USER_D1(%a6)  | save d1
@@ -451,18 +451,18 @@
         movel  USER_D1(%a6),%d1  | restore d1
 	movel	#0x41300000,-(%sp)
 	frestore (%sp)+
-	unlk	%a5	
+	unlk	%a5
 	rts
 
 notidle:
-	bclrb	#etemp15_bit,-40(%a5) 
+	bclrb	#etemp15_bit,-40(%a5)
 	frestore (%sp)+
-	unlk	%a5	
+	unlk	%a5
 	rts
 
 nofix:
 	frestore (%sp)+
-	unlk	%a5	
+	unlk	%a5
 	rts
 
 	|end
diff -Nru a/arch/m68k/fpsp040/get_op.S b/arch/m68k/fpsp040/get_op.S
--- a/arch/m68k/fpsp040/get_op.S	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/fpsp040/get_op.S	Tue Jun 15 22:20:38 2004
@@ -16,7 +16,7 @@
 |
 | - For unnormalized numbers (opclass 0, 2, or 3) the
 | number(s) is normalized and the operand type tag is updated.
-|		
+|
 | - For a packed number (opclass 2) the number is unpacked and the
 | operand type tag is updated.
 |
@@ -41,7 +41,7 @@
 | the '040.  The '040 then re-executes the fadd.x fpm,fpn with
 | a normalized number in the source and the instruction is
 | successful.
-|		
+|
 | Next consider if in the process of normalizing the un-
 | normalized number it becomes a denormalized number.  The
 | routine which converts the unnorm to a norm (called mk_norm)
@@ -54,8 +54,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 GET_OP:    |idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -194,7 +194,7 @@
 
 uni_getop:
 	bfextu	CMDREG1B(%a6){#0:#6},%d0 |get opclass and src fields
-	cmpil	#0x17,%d0		|if op class and size fields are $17, 
+	cmpil	#0x17,%d0		|if op class and size fields are $17,
 |				;it is FMOVECR; if not, continue
 |
 | If the instruction is fmovecr, exit get_op.  It is handled
@@ -226,21 +226,21 @@
 	movew	FPTEMP_EX(%a6),%d0 |get destination exponent
 	andiw	#0x7fff,%d0	|mask sign, check if exp = 0000
 	beqs	src_op_ck	|if denorm then check source op.
-|				;denorms are taken care of in res_func 
+|				;denorms are taken care of in res_func
 |				;(unsupp) or do_func (unimp)
 |				;else unnorm fall through
 	leal	FPTEMP(%a6),%a0	|point a0 to dop - used in mk_norm
 	bsr	mk_norm		|go normalize - mk_norm returns:
-|				;L_SCR1{7:5} = operand tag 
+|				;L_SCR1{7:5} = operand tag
 |				;	(000 = norm, 100 = denorm)
-|				;L_SCR1{4} = fpte15 or ete15 
+|				;L_SCR1{4} = fpte15 or ete15
 |				;	0 = exp >  $3fff
 |				;	1 = exp <= $3fff
-|				;and puts the normalized num back 
+|				;and puts the normalized num back
 |				;on the fsave stack
 |
-	moveb L_SCR1(%a6),DTAG(%a6) |write the new tag & fpte15 
-|				;to the fsave stack and fall 
+	moveb L_SCR1(%a6),DTAG(%a6) |write the new tag & fpte15
+|				;to the fsave stack and fall
 |				;through to check source operand
 |
 src_op_ck:
@@ -255,19 +255,19 @@
 src_ex_dnrm:
 	movew	ETEMP_EX(%a6),%d0 |get source exponent
 	andiw	#0x7fff,%d0	|mask sign, check if exp = 0000
-	beq	end_getop	|if denorm then exit, denorms are 
+	beq	end_getop	|if denorm then exit, denorms are
 |				;handled in do_func
 	leal	ETEMP(%a6),%a0	|point a0 to sop - used in mk_norm
 	bsr	mk_norm		|go normalize - mk_norm returns:
-|				;L_SCR1{7:5} = operand tag 
+|				;L_SCR1{7:5} = operand tag
 |				;	(000 = norm, 100 = denorm)
-|				;L_SCR1{4} = fpte15 or ete15 
+|				;L_SCR1{4} = fpte15 or ete15
 |				;	0 = exp >  $3fff
 |				;	1 = exp <= $3fff
-|				;and puts the normalized num back 
+|				;and puts the normalized num back
 |				;on the fsave stack
 |
-	moveb	L_SCR1(%a6),STAG(%a6) |write the new tag & ete15 
+	moveb	L_SCR1(%a6),STAG(%a6) |write the new tag & ete15
 	rts			|end_getop
 
 |
@@ -285,7 +285,7 @@
 	movew	#0x3c01,%d1	|write the bias for a dbl denorm
 common:
 	btstb	#sign_bit,ETEMP_EX(%a6) |grab sign bit of mantissa
-	beqs	pos	
+	beqs	pos
 	bset	#15,%d1		|set sign bit because it is negative
 pos:
 	movew	%d1,ETEMP_EX(%a6)
@@ -297,7 +297,7 @@
 	movew	%d1,CMDREG1B(%a6)	|write back to the command word in stack
 |				;this is needed to fix unsupp data stack
 	leal	ETEMP(%a6),%a0	|point a0 to sop
-	
+
 	bsr	mk_norm		|convert sgl/dbl denorm to norm
 	moveb	L_SCR1(%a6),STAG(%a6) |put tag into source tag reg - d0
 	rts			|end_getop
@@ -306,7 +306,7 @@
 | instruction is dyadic or monadic is still unknown
 |
 pack_source:
-	movel	FPTEMP_LO(%a6),ETEMP(%a6)	|write ms part of packed 
+	movel	FPTEMP_LO(%a6),ETEMP(%a6)	|write ms part of packed
 |				;number to etemp slot
 	bsr	chk_dy_mo	|set dyadic/monadic flag
 	bsr	unpack
@@ -325,7 +325,7 @@
 	btstb	#7,DTAG(%a6)	|check dest tag for unnorm or denorm
 	bne	dst_ex_dnrm	|else, handle the unnorm or ext denorm
 |
-| Dest is not denormalized.  Check for norm, and set fpte15 
+| Dest is not denormalized.  Check for norm, and set fpte15
 | accordingly.
 |
 	moveb	DTAG(%a6),%d0
@@ -357,13 +357,13 @@
 | unsupported data type exception.  Set if dyadic.
 |
 chk_dy_mo:
-	movew	CMDREG1B(%a6),%d0	
+	movew	CMDREG1B(%a6),%d0
 	btstl	#5,%d0		|testing extension command word
 	beqs	set_mon		|if bit 5 = 0 then monadic
 	btstl	#4,%d0		|know that bit 5 = 1
 	beqs	set_dya		|if bit 4 = 0 then dyadic
 	andiw	#0x007f,%d0	|get rid of all but extension bits {6:0}
-	cmpiw 	#0x0038,%d0	|if extension = $38 then fcmp (dyadic)
+	cmpiw	#0x0038,%d0	|if extension = $38 then fcmp (dyadic)
 	bnes	set_mon
 set_dya:
 	st	DY_MO_FLG(%a6)	|set the inst flag type to dyadic
@@ -406,7 +406,7 @@
 |	L_SCR1{7:5} = operand tag (000 = norm, 100 = denorm)
 |	L_SCR1{4}   = fpte15 or ete15 (0 = exp > $3fff, 1 = exp <=$3fff)
 |	the normalized operand is placed back on the fsave stack
-mk_norm:	
+mk_norm:
 	clrl	L_SCR1(%a6)
 	bclrb	#sign_bit,LOCAL_EX(%a0)
 	sne	LOCAL_SGN(%a0)	|transform into internal extended format
@@ -426,11 +426,11 @@
 	cmpw	#0x3fff,LOCAL_EX(%a0) |if exp > $3fff
 	bgts	end_mk		|   fpte15/ete15 already set to 0
 	bsetb	#4,L_SCR1(%a6)	|else set fpte15/ete15 to 1
-|				;calling routine actually sets the 
-|				;value on the stack (along with the 
-|				;tag), since this routine doesn't 
+|				;calling routine actually sets the
+|				;value on the stack (along with the
+|				;tag), since this routine doesn't
 |				;know if it should set ete15 or fpte15
-|				;ie, it doesn't know if this is the 
+|				;ie, it doesn't know if this is the
 |				;src op or dest op.
 end_mk:
 	bfclr	LOCAL_SGN(%a0){#0:#8}
@@ -455,7 +455,7 @@
 |
 uns_opx:
 	bsr	nrm_zero	|normalize the number
-	btstb	#7,LOCAL_HI(%a0)	|check if integer bit (j-bit) is set 
+	btstb	#7,LOCAL_HI(%a0)	|check if integer bit (j-bit) is set
 	beqs	uns_den		|if clear then now have a denorm
 uns_nrm:
 	orb	#norm_tag,L_SCR1(%a6) |set tag to norm
@@ -468,7 +468,7 @@
 |
 uni_inst:
 	bsr	nrm_zero
-	btstb	#7,LOCAL_HI(%a0)	|check if integer bit (j-bit) is set 
+	btstb	#7,LOCAL_HI(%a0)	|check if integer bit (j-bit) is set
 	beqs	uni_den		|if clear then now have a denorm
 uni_nrm:
 	orb	#norm_tag,L_SCR1(%a6) |set tag to norm
@@ -480,9 +480,9 @@
 |
 |	Decimal to binary conversion
 |
-| Special cases of inf and NaNs are completed outside of decbin.  
+| Special cases of inf and NaNs are completed outside of decbin.
 | If the input is an snan, the snan bit is not set.
-| 
+|
 | input:
 |	ETEMP(a6)	- points to packed decimal string in memory
 | output:
@@ -610,16 +610,16 @@
 
 finish:
 	movew	CMDREG1B(%a6),%d0	|get the command word
-	andw	#0xfbff,%d0	|change the source specifier field to 
+	andw	#0xfbff,%d0	|change the source specifier field to
 |				;extended (was packed).
 	movew	%d0,CMDREG1B(%a6)	|write command word back to fsave stack
-|				;we need to do this so the 040 will 
-|				;re-execute the inst. without taking 
+|				;we need to do this so the 040 will
+|				;re-execute the inst. without taking
 |				;another packed trap.
 
 fix_stag:
-|Converted result is now in etemp on fsave stack, now set the source 
-|tag (stag) 
+|Converted result is now in etemp on fsave stack, now set the source
+|tag (stag)
 |	if (ete =$7fff) then INF or NAN
 |		if (etemp = $x.0----0) then
 |			stag = INF
@@ -632,12 +632,12 @@
 |			stag = NORM
 |
 | Note also that the etemp_15 bit (just right of the stag) must
-| be set accordingly.  
+| be set accordingly.
 |
 	movew		ETEMP_EX(%a6),%d1
 	andiw		#0x7fff,%d1   |strip sign
-	cmpw  		#0x7fff,%d1
-	bnes  		z_or_nrm
+	cmpw		#0x7fff,%d1
+	bnes		z_or_nrm
 	movel		ETEMP_HI(%a6),%d1
 	bnes		is_nan
 	movel		ETEMP_LO(%a6),%d1
@@ -651,7 +651,7 @@
 	movel		#0x60,%d0
 	rts
 z_or_nrm:
-	tstw		%d1  
+	tstw		%d1
 	bnes		is_nrm
 is_zro:
 | For a zero, set etemp_15
@@ -670,7 +670,7 @@
 	movel		#0,%d0
 end_fix:
 	rts
- 
+
 end_get:
 	rts
 	|end
diff -Nru a/arch/m68k/fpsp040/kernel_ex.S b/arch/m68k/fpsp040/kernel_ex.S
--- a/arch/m68k/fpsp040/kernel_ex.S	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/fpsp040/kernel_ex.S	Tue Jun 15 22:20:44 2004
@@ -1,19 +1,19 @@
 |
-|	kernel_ex.sa 3.3 12/19/90 
+|	kernel_ex.sa 3.3 12/19/90
 |
-| This file contains routines to force exception status in the 
+| This file contains routines to force exception status in the
 | fpu for exceptional cases detected or reported within the
 | transcendental functions.  Typically, the t_xx routine will
 | set the appropriate bits in the USER_FPSR word on the stack.
 | The bits are tested in gen_except.sa to determine if an exceptional
-| situation needs to be created on return from the FPSP. 
+| situation needs to be created on return from the FPSP.
 |
 
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 KERNEL_EX:    |idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -31,7 +31,7 @@
 	|xref	  unf_sub
 	|xref	  nrm_set
 
-	.global   	  t_dz
+	.global	  t_dz
 	.global      t_dz2
 	.global      t_operr
 	.global      t_unfl
@@ -49,7 +49,7 @@
 |
 |	if dz trap disabled
 |		store properly signed inf (use sign of etemp) into fp0
-|		set FPSR exception status dz bit, condition code 
+|		set FPSR exception status dz bit, condition code
 |		inf bit, and accrued dz bit
 |		return
 |		frestore the frame into the machine (done by unimp_hd)
@@ -61,7 +61,7 @@
 |		frestore the frame into the machine (done by unimp_hd)
 |
 | t_dz2 is used by monadic functions such as flogn (from do_func).
-| t_dz is used by monadic functions such as satanh (from the 
+| t_dz is used by monadic functions such as satanh (from the
 | transcendental function).
 |
 t_dz2:
@@ -104,10 +104,10 @@
 |	OPERR exception
 |
 |	if (operr trap disabled)
-|		set FPSR exception status operr bit, condition code 
+|		set FPSR exception status operr bit, condition code
 |		nan bit; Store default NAN into fp0
 |		frestore the frame into the machine (done by unimp_hd)
-|	
+|
 |	else (operr trap enabled)
 |		set FPSR exception status operr bit, accrued operr bit
 |		set flag to disable sto_res from corrupting fp register
@@ -159,13 +159,13 @@
 
 unfl_dis:
 	bfextu	FPCR_MODE(%a6){#0:#2},%d0	|get round precision
-	
+
 	bclrb	#sign_bit,LOCAL_EX(%a0)
 	sne	LOCAL_SGN(%a0)		|convert to internal ext format
 
 	bsr	unf_sub			|returns IEEE result at a0
 |					;and sets FPSR_CC accordingly
-	
+
 	bfclr	LOCAL_SGN(%a0){#0:#8}	|convert back to IEEE ext format
 	beqs	unfl_fin
 
@@ -175,7 +175,7 @@
 unfl_fin:
 	fmovemx (%a0),%fp0-%fp0		|store result in fp0
 	rts
-	
+
 
 |
 |	t_ovfl2 --- OVFL exception (without inex2 returned)
@@ -280,7 +280,7 @@
 |	DST_NAN
 |
 | Determine if the destination nan is signalling or non-signalling,
-| and set the FPSR bits accordingly.  See the MC68040 User's Manual 
+| and set the FPSR bits accordingly.  See the MC68040 User's Manual
 | section 3.2.2.5 NOT-A-NUMBERS.
 |
 dst_nan:
@@ -288,7 +288,7 @@
 	beqs	dst_pos			|if clr, it was positive
 	bsetb	#neg_bit,FPSR_CC(%a6)	|set N bit
 dst_pos:
-	btstb	#signan_bit,FPTEMP_HI(%a6) |check if signalling 
+	btstb	#signan_bit,FPTEMP_HI(%a6) |check if signalling
 	beqs	dst_snan		|branch if signalling
 
 	fmovel	%d1,%fpcr			|restore user's rmode/prec
@@ -300,14 +300,14 @@
 	andib	#0xe0,%d0
 	cmpib	#0x60,%d0
 	bnes	no_snan
-	btstb	#signan_bit,ETEMP_HI(%a6) |check if signalling 
+	btstb	#signan_bit,ETEMP_HI(%a6) |check if signalling
 	bnes	no_snan
 	orl	#snaniop_mask,USER_FPSR(%a6) |set NAN, SNAN, AIOP
 no_snan:
-	rts	
+	rts
 
 dst_snan:
-	btstb	#snan_bit,FPCR_ENABLE(%a6) |check if trap enabled 
+	btstb	#snan_bit,FPCR_ENABLE(%a6) |check if trap enabled
 	beqs	dst_dis			|branch if disabled
 
 	orb	#nan_tag,DTAG(%a6)	|set up dtag for nan
@@ -316,9 +316,9 @@
 	rts
 
 dst_dis:
-	bsetb	#signan_bit,FPTEMP_HI(%a6) |set SNAN bit in sop 
+	bsetb	#signan_bit,FPTEMP_HI(%a6) |set SNAN bit in sop
 	fmovel	%d1,%fpcr			|restore user's rmode/prec
-	fmovex FPTEMP(%a6),%fp0		|load non-sign. nan 
+	fmovex FPTEMP(%a6),%fp0		|load non-sign. nan
 	orl	#snaniop_mask,USER_FPSR(%a6) |set NAN, SNAN, AIOP
 	rts
 
@@ -326,7 +326,7 @@
 |	SRC_NAN
 |
 | Determine if the source nan is signalling or non-signalling,
-| and set the FPSR bits accordingly.  See the MC68040 User's Manual 
+| and set the FPSR bits accordingly.  See the MC68040 User's Manual
 | section 3.2.2.5 NOT-A-NUMBERS.
 |
 src_nan:
@@ -334,16 +334,16 @@
 	beqs	src_pos			|if clr, it was positive
 	bsetb	#neg_bit,FPSR_CC(%a6)	|set N bit
 src_pos:
-	btstb	#signan_bit,ETEMP_HI(%a6) |check if signalling 
+	btstb	#signan_bit,ETEMP_HI(%a6) |check if signalling
 	beqs	src_snan		|branch if signalling
 	fmovel	%d1,%fpcr			|restore user's rmode/prec
 	fmovex ETEMP(%a6),%fp0		|return the non-signalling nan
-	rts	
+	rts
 
 src_snan:
-	btstb	#snan_bit,FPCR_ENABLE(%a6) |check if trap enabled 
+	btstb	#snan_bit,FPCR_ENABLE(%a6) |check if trap enabled
 	beqs	src_dis			|branch if disabled
-	bsetb	#signan_bit,ETEMP_HI(%a6) |set SNAN bit in sop 
+	bsetb	#signan_bit,ETEMP_HI(%a6) |set SNAN bit in sop
 	orb	#norm_tag,DTAG(%a6)	|set up dtag for norm
 	orb	#nan_tag,STAG(%a6)	|set up stag for nan
 	st	STORE_FLG(%a6)		|do not store a result
@@ -351,9 +351,9 @@
 	rts
 
 src_dis:
-	bsetb	#signan_bit,ETEMP_HI(%a6) |set SNAN bit in sop 
+	bsetb	#signan_bit,ETEMP_HI(%a6) |set SNAN bit in sop
 	fmovel	%d1,%fpcr			|restore user's rmode/prec
-	fmovex ETEMP(%a6),%fp0		|load non-sign. nan 
+	fmovex ETEMP(%a6),%fp0		|load non-sign. nan
 	orl	#snaniop_mask,USER_FPSR(%a6) |set NAN, SNAN, AIOP
 	rts
 
@@ -367,7 +367,7 @@
 	bras	xdnrm_con
 |
 | Entry point for scale with extended denorm.  The function does
-| not set inex2, aunfl, or ainex.  
+| not set inex2, aunfl, or ainex.
 |
 t_resdnrm:
 	orl	#unfl_mask,USER_FPSR(%a6)
@@ -402,7 +402,7 @@
 	bfclr	LOCAL_SGN(%a0){#0:#8}	|change back to IEEE ext format
 	beqs	xdep
 	bsetb	#sign_bit,LOCAL_EX(%a0)
-xdep:	
+xdep:
 	bfclr	STAG(%a6){#5:#3}		|clear wbtm66,wbtm1,wbtm0
 	bsetb	#wbtemp15_bit,WB_BYTE(%a6) |set wbtemp15
 	bclrb	#sticky_bit,STICKY(%a6)	|clear sticky bit
@@ -439,7 +439,7 @@
 |
 	.global	t_avoid_unsupp
 t_avoid_unsupp:
-	link	%a2,#-LOCAL_SIZE		|so that a2 fpsp.h negative 
+	link	%a2,#-LOCAL_SIZE		|so that a2 fpsp.h negative
 |					;offsets may be used
 	fsave	-(%a7)
 	tstb	1(%a7)			|check if idle, exit if so
diff -Nru a/arch/m68k/fpsp040/res_func.S b/arch/m68k/fpsp040/res_func.S
--- a/arch/m68k/fpsp040/res_func.S	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/fpsp040/res_func.S	Tue Jun 15 22:20:36 2004
@@ -8,7 +8,7 @@
 | (Exception vector 55).
 |
 | For packed move out (fmove.p fpm,<ea>) the operation is
-| completed here; data is packed and moved to user memory. 
+| completed here; data is packed and moved to user memory.
 | The stack is restored to the 040 only in the case of a
 | reportable exception in the conversion.
 |
@@ -16,8 +16,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 RES_FUNC:    |idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -48,7 +48,7 @@
 	|xref	t_unfl
 
 	.global	res_func
-	.global 	p_move
+	.global	p_move
 
 res_func:
 	clrb	DNRM_FLG(%a6)
@@ -100,7 +100,7 @@
 	movew	CMDREG1B(%a6),%d0	|get command register
 	andil	#0x7f,%d0			|strip to only command word
 |
-| At this point, fabs, fneg, fsmove, fdmove, ftst, fsqrt, fssqrt, and 
+| At this point, fabs, fneg, fsmove, fdmove, ftst, fsqrt, fssqrt, and
 | fdsqrt are possible.
 | For cases fabs, fneg, fsmove, and fdmove goto spos (do not normalize)
 | For cases fsqrt, fssqrt, and fdsqrt goto nrm_src (do normalize)
@@ -143,7 +143,7 @@
 	rts
 cu_ntn:
 	orl	#nan_mask,USER_FPSR(%a6)
-	movel	ETEMP_EX(%a6),FPTEMP_EX(%a6)	|set up fptemp sign for 
+	movel	ETEMP_EX(%a6),FPTEMP_EX(%a6)	|set up fptemp sign for
 |						;snan handler
 
 	rts
@@ -206,7 +206,7 @@
 cu_nmrd:
 	movel	#2,%d0			|set up the size for denorm
 	movew	LOCAL_EX(%a0),%d1		|compare exponent to double threshold
-	andw	#0x7fff,%d1	
+	andw	#0x7fff,%d1
 	cmpw	#0x3c01,%d1
 	bls	cu_nunfl
 	bfextu	FPCR_MODE(%a6){#2:#2},%d1	|get rmode
@@ -359,7 +359,7 @@
 |				;write the new tag & ete15 to the fstack
 mon_dnrm:
 |
-| At this point, check for the cases in which normalizing the 
+| At this point, check for the cases in which normalizing the
 | denorm produces incorrect results.
 |
 	tstb	DY_MO_FLG(%a6)	|all cases of dyadic instructions would
@@ -374,7 +374,7 @@
 	movew	CMDREG1B(%a6),%d0	|get command register
 	andil	#0x7f,%d0			|strip to only command word
 |
-| At this point, fabs, fneg, fsmove, fdmove, ftst, fsqrt, fssqrt, and 
+| At this point, fabs, fneg, fsmove, fdmove, ftst, fsqrt, fssqrt, and
 | fdsqrt are possible.
 | For cases fabs, fneg, fsmove, and fdmove goto spos (do not normalize)
 | For cases fsqrt, fssqrt, and fdsqrt goto nrm_src (do normalize)
@@ -382,12 +382,12 @@
 	btstl	#0,%d0
 	bnes	nrm_src		|weed out fsqrt instructions
 	st	CU_ONLY(%a6)	|set cu-only inst flag
-	bra	cu_dnrm		|fmove, fabs, fneg, ftst 
+	bra	cu_dnrm		|fmove, fabs, fneg, ftst
 |				;cases go to cu_dnrm
 nrm_src:
 	bclrb	#sign_bit,LOCAL_EX(%a0)
 	sne	LOCAL_SGN(%a0)
-	bsr	nrm_set		|normalize number (exponent will go 
+	bsr	nrm_set		|normalize number (exponent will go
 |				; negative)
 	bclrb	#sign_bit,LOCAL_EX(%a0) |get rid of false sign
 
@@ -413,7 +413,7 @@
 
 |
 | cu_dnrm handles all cu-only instructions (fmove, fabs, fneg, and
-| ftst) completely in software without an frestore to the 040. 
+| ftst) completely in software without an frestore to the 040.
 |
 cu_dnrm:
 	st	CU_ONLY(%a6)
@@ -446,7 +446,7 @@
 	rts
 cu_dtn:
 	orl	#nan_mask,USER_FPSR(%a6)
-	movel	ETEMP_EX(%a6),FPTEMP_EX(%a6)	|set up fptemp sign for 
+	movel	ETEMP_EX(%a6),FPTEMP_EX(%a6)	|set up fptemp sign for
 |						;snan handler
 	rts
 cu_dtcz:
@@ -525,7 +525,7 @@
 	bra	cu_sndr			|load single neg zero w/lsb
 |
 | The precision is extended, so the result in etemp is correct.
-| Simply set unfl (not inex2 or aunfl) and write the result to 
+| Simply set unfl (not inex2 or aunfl) and write the result to
 | the correct fp register.
 cu_wrexd:
 	orl	#unfl_mask,USER_FPSR(%a6)
@@ -597,7 +597,7 @@
 	orl	#neg_mask,USER_FPSR(%a6)
 	orl	#unfinx_mask,USER_FPSR(%a6)
 	bra	wr_etemp
-	
+
 |
 | This code checks for 16-bit overflow conditions on dyadic
 | operations which are not restorable into the floating-point
@@ -613,7 +613,7 @@
 |	                  $ff for both ops denormalized
 |
 | The wrap-around condition occurs for add, sub, div, and cmp
-| when 
+| when
 |
 |	abs(dest_exp - src_exp) >= $8000
 |
@@ -627,7 +627,7 @@
 | for this condition.  The restore flag (RES_FLG) is left clear.
 | No frestore is done unless an exception is to be reported.
 |
-| For fadd: 
+| For fadd:
 |	if(sign_of(dest) != sign_of(src))
 |		replace exponent of src with $3fff (keep sign)
 |		use fpu to perform dest+new_src (user's rmode and X)
@@ -689,10 +689,10 @@
 	cmpiw	#cmpcode,%d0
 	beq	wrap_cmp
 |
-| Inst is fdiv.  
+| Inst is fdiv.
 |
 wrap_div:
-	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm, 
+	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm,
 	beq	fix_stk		 |restore to fpu
 |
 | One of the ops is denormalized.  Test for wrap condition
@@ -722,7 +722,7 @@
 	bra	ck_in_com
 ckinf_nd:
 	moveb	DTAG(%a6),%d0		|check destination tag for inf or nan
-ck_in_com:	
+ck_in_com:
 	andib	#0x60,%d0			|isolate tag bits
 	cmpb	#0x40,%d0			|is it inf?
 	beq	nan_or_inf		|not wrap case
@@ -755,7 +755,7 @@
 	beqs	force_ovf
 	st	WBTEMP_SGN(%a6)
 |
-| This code handles the case of the instruction resulting in 
+| This code handles the case of the instruction resulting in
 | an overflow condition.
 |
 force_ovf:
@@ -777,7 +777,7 @@
 	bfextu	FPCR_MODE(%a6){#0:#2},%d0	|inst not forced - use fpcr prec
 frcovf_rnd:
 
-| The 881/882 does not set inex2 for the following case, so the 
+| The 881/882 does not set inex2 for the following case, so the
 | line is commented out to be compatible with 881/882
 |	tst.b	%d0
 |	beq.b	frcovf_x
@@ -785,7 +785,7 @@
 
 |frcovf_x:
 	bsrl	ovf_res			|get correct result based on
-|					;round precision/mode.  This 
+|					;round precision/mode.  This
 |					;sets FPSR_CC correctly
 |					;returns in external format
 	bfclr	WBTEMP_SGN(%a6){#0:#8}
@@ -796,7 +796,7 @@
 | Inst is fadd.
 |
 wrap_add:
-	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm, 
+	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm,
 	beq	fix_stk		 |restore to fpu
 |
 | One of the ops is denormalized.  Test for wrap condition
@@ -964,14 +964,14 @@
 | and aovfl, and clr the mantissa (incorrectly set by the
 | round routine.)
 |
-	orl	#inf_mask+ovfl_inx_mask,USER_FPSR(%a6)	
+	orl	#inf_mask+ovfl_inx_mask,USER_FPSR(%a6)
 	clrl	4(%a0)
 	bra	frcfpnr
 |
 | Inst is fsub.
 |
 wrap_sub:
-	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm, 
+	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm,
 	beq	fix_stk		 |restore to fpu
 |
 | One of the ops is denormalized.  Test for wrap condition
@@ -1145,14 +1145,14 @@
 | and aovfl, and clr the mantissa (incorrectly set by the
 | round routine.)
 |
-	orl	#inf_mask+ovfl_inx_mask,USER_FPSR(%a6)	
+	orl	#inf_mask+ovfl_inx_mask,USER_FPSR(%a6)
 	clrl	4(%a0)
 	bra	frcfpnr
 |
 | Inst is fcmp.
 |
 wrap_cmp:
-	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm, 
+	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm,
 	beq	fix_stk		 |restore to fpu
 |
 | One of the ops is denormalized.  Test for wrap condition
@@ -1190,7 +1190,7 @@
 | Inst is fmul.
 |
 wrap_mul:
-	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm, 
+	cmpb	#0xff,DNRM_FLG(%a6) |if both ops denorm,
 	beq	force_unf	|force an underflow (really!)
 |
 | One of the ops is denormalized.  Test for wrap condition
@@ -1213,9 +1213,9 @@
 	bfexts	ETEMP_EX(%a6){#1:#15},%d1	|get src exp (always neg)
 	addl	%d1,%d0			|subtract src from dest
 	bgt	fix_stk
-	
+
 |
-| This code handles the case of the instruction resulting in 
+| This code handles the case of the instruction resulting in
 | an underflow condition.
 |
 force_unf:
@@ -1245,7 +1245,7 @@
 	bfextu	FPCR_MODE(%a6){#0:#2},%d0	|inst not forced - use fpcr prec
 frcunf_rnd:
 	bsrl	unf_sub			|get correct result based on
-|					;round precision/mode.  This 
+|					;round precision/mode.  This
 |					;sets FPSR_CC correctly
 	bfclr	WBTEMP_SGN(%a6){#0:#8}	|convert back to IEEE ext format
 	beqs	frcfpn
@@ -1277,14 +1277,14 @@
 	bclrb	#sign_bit,WBTEMP_EX(%a6)
 	sne	WBTEMP_SGN(%a6)
 	bsrl	ovf_res			|get correct result based on
-|					;round precision/mode.  This 
+|					;round precision/mode.  This
 |					;sets FPSR_CC correctly
 	bfclr	WBTEMP_SGN(%a6){#0:#8}	|convert back to IEEE ext format
 	beqs	frcfpn_clr
 	bsetb	#sign_bit,WBTEMP_EX(%a6)
 frcfpn_clr:
 	orl	#ovfinx_mask,USER_FPSR(%a6)
-| 
+|
 | Perform the write.
 |
 frcfpn:
@@ -1301,9 +1301,9 @@
 	cmpib	#0,%d0
 	beqs	frc0_dst
 	cmpib	#1,%d0
-	beqs	frc1_dst 
+	beqs	frc1_dst
 	cmpib	#2,%d0
-	beqs	frc2_dst 
+	beqs	frc2_dst
 frc3_dst:
 	movel	WBTEMP_EX(%a6),USER_FP3(%a6)
 	movel	WBTEMP_HI(%a6),USER_FP3+4(%a6)
@@ -1337,7 +1337,7 @@
 	beqs	fmoveinc		|enabled, force restore
 	btstb	#snan_bit,FPCR_ENABLE(%a6) |and don't overwrite
 	beqs	fmoveinc		|the dest
-	movel	ETEMP_EX(%a6),FPTEMP_EX(%a6)	|set up fptemp sign for 
+	movel	ETEMP_EX(%a6),FPTEMP_EX(%a6)	|set up fptemp sign for
 |						;snan handler
 	tstb	ETEMP(%a6)		|check for negative
 	blts	snan_neg
@@ -1361,7 +1361,7 @@
 	cmpib	#0x60,%d0			|check if stag is NaN
 	bnes	fminc_czero
 	orl	#nan_mask,USER_FPSR(%a6) |if nan, nothing yet has set NaN
-	movel	ETEMP_EX(%a6),FPTEMP_EX(%a6)	|set up fptemp sign for 
+	movel	ETEMP_EX(%a6),FPTEMP_EX(%a6)	|set up fptemp sign for
 |						;snan handler
 	tstw	LOCAL_EX(%a0)		|check sign
 	bges	fminc_con
@@ -1389,9 +1389,9 @@
 	cmpib	#0,%d0
 	beqs	fp0_dst
 	cmpib	#1,%d0
-	beqs	fp1_dst 
+	beqs	fp1_dst
 	cmpib	#2,%d0
-	beqs	fp2_dst 
+	beqs	fp2_dst
 fp3_dst:
 	movel	ETEMP_EX(%a6),USER_FP3(%a6)
 	movel	ETEMP_HI(%a6),USER_FP3+4(%a6)
@@ -1421,20 +1421,20 @@
 	beq	pack_out	|else it is norm or denorm
 	bra	mv_out
 
-	
+
 |
 |	MOVE OUT
 |
 
 mv_tbl:
 	.long	li
-	.long 	sgp
-	.long 	xp
-	.long 	mvout_end	|should never be taken
-	.long 	wi
-	.long 	dp
-	.long 	bi
-	.long 	mvout_end	|should never be taken
+	.long	sgp
+	.long	xp
+	.long	mvout_end	|should never be taken
+	.long	wi
+	.long	dp
+	.long	bi
+	.long	mvout_end	|should never be taken
 mv_out:
 	bfextu	CMDREG1B(%a6){#3:#3},%d1	|put source specifier in d1
 	leal	mv_tbl,%a0
@@ -1442,7 +1442,7 @@
 	jmp	(%a0)
 
 |
-| This exit is for move-out to memory.  The aunfl bit is 
+| This exit is for move-out to memory.  The aunfl bit is
 | set if the result is inex and unfl is signalled.
 |
 mvout_end:
@@ -1466,7 +1466,7 @@
 mvout_con:
 	rts
 |
-| This exit is for move-out to int register.  The aunfl bit is 
+| This exit is for move-out to int register.  The aunfl bit is
 | not set in any case for this move.
 |
 mvouti_end:
@@ -1496,7 +1496,7 @@
 	fmovemx ETEMP(%a6),%fp0-%fp0
 	fcmpd	#0x41dfffffffc00000,%fp0
 | 41dfffffffc00000 in dbl prec = 401d0000fffffffe00000000 in ext prec
-	fbge	lo_plrg	
+	fbge	lo_plrg
 	fcmpd	#0xc1e0000000000000,%fp0
 | c1e0000000000000 in dbl prec = c01e00008000000000000000 in ext prec
 	fble	lo_nlrg
@@ -1541,7 +1541,7 @@
 	fmovemx ETEMP(%a6),%fp0-%fp0
 	fcmps	#0x46fffe00,%fp0
 | 46fffe00 in sgl prec = 400d0000fffe000000000000 in ext prec
-	fbge	wo_plrg	
+	fbge	wo_plrg
 	fcmps	#0xc7000000,%fp0
 | c7000000 in sgl prec = c00e00008000000000000000 in ext prec
 	fble	wo_nlrg
@@ -1586,7 +1586,7 @@
 	fmovemx ETEMP(%a6),%fp0-%fp0
 	fcmps	#0x42fe0000,%fp0
 | 42fe0000 in sgl prec = 40050000fe00000000000000 in ext prec
-	fbge	by_plrg	
+	fbge	by_plrg
 	fcmps	#0xc3000000,%fp0
 | c3000000 in sgl prec = c00600008000000000000000 in ext prec
 	fble	by_nlrg
@@ -1629,7 +1629,7 @@
 int_dnrm:
 	movel	#0,L_SCR1(%a6)	| initialize result to 0
 	bfextu	FPCR_MODE(%a6){#2:#2},%d1	| d1 is the rounding mode
-	cmpb	#2,%d1		
+	cmpb	#2,%d1
 	bmis	int_inx		| if RN or RZ, done
 	bnes	int_rp		| if RP, continue below
 	tstw	ETEMP(%a6)	| RM: store -1 in L_SCR1 if src is negative
@@ -1642,7 +1642,7 @@
 	bmis	int_inx		| otherwise, result is 0
 	lea	L_SCR1(%a6),%a1	| a1 is address of L_SCR1
 	addal	%d0,%a1		| offset by destination width -1
-	subal	#1,%a1		
+	subal	#1,%a1
 	bsetb	#0,(%a1)		| set low bit at a1 address
 int_inx:
 	oril	#inx2a_mask,USER_FPSR(%a6)
@@ -1656,10 +1656,10 @@
 
 	oril	#opaop_mask,USER_FPSR(%a6)
 |				;fall through to perform int_wrt
-int_wrt: 
+int_wrt:
 	movel	EXC_EA(%a6),%a1	|load destination address
 	tstl	%a1		|check to see if it is a dest register
-	beqs	wrt_dn		|write data register 
+	beqs	wrt_dn		|write data register
 	lea	L_SCR1(%a6),%a0	|point to supervisor source address
 	bsrl	mem_write
 	bra	mvouti_end
@@ -1680,7 +1680,7 @@
 sz_con:
 	movel	%d0,%d1		|reg_dest expects size:reg in d1
 	bsrl	reg_dest	|load proper data register
-	bra	mvouti_end 
+	bra	mvouti_end
 xp:
 	lea	ETEMP(%a6),%a0
 	bclrb	#sign_bit,LOCAL_EX(%a0)
@@ -1718,7 +1718,7 @@
 	blt	dp_under
 	cmpw	2(%a1),%d0
 	bgt	dp_over
-	
+
 	movel	#2,%d0		|set destination format to double
 |				;fall through to do_fp
 |
@@ -1726,10 +1726,10 @@
 	bfextu	FPCR_MODE(%a6){#2:#2},%d1	|rnd mode in d1
 	swap	%d0			|rnd prec in upper word
 	addl	%d0,%d1			|d1 has PREC/MODE info
-	
-	clrl	%d0			|clear g,r,s 
 
-	bsrl	round			|round 
+	clrl	%d0			|clear g,r,s
+
+	bsrl	round			|round
 
 	movel	%a0,%a1
 	movel	EXC_EA(%a6),%a0
@@ -1764,12 +1764,12 @@
 	bsrl	dest_ext	|store to memory
 	bsetb	#unfl_bit,FPSR_EXCEPT(%a6)
 	bra	mvout_end
-	
+
 sp_under:
 	bsetb	#etemp15_bit,STAG(%a6)
 
 	cmpw	4(%a1),%d0
-	blts	sp_catas	|catastrophic underflow case	
+	blts	sp_catas	|catastrophic underflow case
 
 	movel	#1,%d0		|load in round precision
 	movel	#sgl_thresh,%d1	|load in single denorm threshold
@@ -1784,9 +1784,9 @@
 
 	cmpw	4(%a1),%d0
 	blts	dp_catas	|catastrophic underflow case
-		
+
 	movel	#dbl_thresh,%d1	|load in double precision threshold
-	movel	#2,%d0		
+	movel	#2,%d0
 	bsrl	dpspdnrm	|expects d1 to have proper
 |				;denorm threshold
 |				;expects d0 to have round precision
@@ -1813,11 +1813,11 @@
 
 	movel	%a0,%a1		|a1 has the operand input
 	movel	EXC_EA(%a6),%a0	|a0 has the destination pointer
-	
+
 	bsrl	dest_sgl	|store the result
 	oril	#unfinx_mask,USER_FPSR(%a6)
 	bra	mvout_end
-	
+
 dp_catas:
 | Temp fix for z bit set in unf_sub
 	movel	USER_FPSR(%a6),-(%a7)
@@ -1828,12 +1828,12 @@
 	movel	(%a7)+,USER_FPSR(%a6)
 
 	movel	#1,%d0
-	subw	%d0,LOCAL_EX(%a0) |account for difference between 
+	subw	%d0,LOCAL_EX(%a0) |account for difference between
 |				;denorm/norm bias
 
 	movel	%a0,%a1		|a1 has the operand input
 	movel	EXC_EA(%a6),%a0	|a0 has the destination pointer
-	
+
 	bsrl	dest_dbl	|store the result
 	oril	#unfinx_mask,USER_FPSR(%a6)
 	bra	mvout_end
@@ -1880,7 +1880,7 @@
 	bra	mvout_end
 
 |
-| 	DPSPDNRM
+|	DPSPDNRM
 |
 | This subroutine takes an extended normalized number and denormalizes
 | it to the given round precision. This subroutine also decrements
@@ -1894,7 +1894,7 @@
 |
 | Output: (In the format for dest_sgl or dest_dbl)
 |	 a0   points to the destination
-|   	 a1   points to the operand
+|	 a1   points to the operand
 |
 | Exceptions: Reports inexact 2 exception by setting USER_FPSR bits
 |
@@ -1905,7 +1905,7 @@
 
 	bfextu	FPCR_MODE(%a6){#2:#2},%d1 |get rounding mode
 	swap	%d1
-	movew	2(%a7),%d1	|set rounding precision 
+	movew	2(%a7),%d1	|set rounding precision
 	swap	%d1		|at this point d1 has PREC/MODE info
 	bsrl	round		|round result, sets the inex bit in
 |				;USER_FPSR if needed
@@ -1952,20 +1952,20 @@
 	.long	p_dyd7
 
 pack_out:
- 	leal	p_movet,%a0	|load jmp table address
+	leal	p_movet,%a0	|load jmp table address
 	movew	STAG(%a6),%d0	|get source tag
 	bfextu	%d0{#16:#3},%d0	|isolate source bits
 	movel	(%a0,%d0.w*4),%a0	|load a0 with routine label for tag
 	jmp	(%a0)		|go to the routine
 
 p_write:
-	movel	#0x0c,%d0 	|get byte count
+	movel	#0x0c,%d0	|get byte count
 	movel	EXC_EA(%a6),%a1	|get the destination address
-	bsr 	mem_write	|write the user's destination
+	bsr	mem_write	|write the user's destination
 	moveb	#0,CU_SAVEPC(%a6) |set the cu save pc to all 0's
 
 |
-| Also note that the dtag must be set to norm here - this is because 
+| Also note that the dtag must be set to norm here - this is because
 | the 040 uses the dtag to execute the correct microcode.
 |
         bfclr    DTAG(%a6){#0:#3}  |set dtag to norm
diff -Nru a/arch/m68k/fpsp040/round.S b/arch/m68k/fpsp040/round.S
--- a/arch/m68k/fpsp040/round.S	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/fpsp040/round.S	Tue Jun 15 22:20:41 2004
@@ -8,8 +8,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |ROUND	idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -21,7 +21,7 @@
 |
 |	round --- round result according to precision/mode
 |
-|	a0 points to the input operand in the internal extended format 
+|	a0 points to the input operand in the internal extended format
 |	d1(high word) contains rounding precision:
 |		ext = $0000xxxx
 |		sgl = $0001xxxx
@@ -44,15 +44,15 @@
 
 	.global	round
 round:
-| If g=r=s=0 then result is exact and round is done, else set 
-| the inex flag in status reg and continue.  
+| If g=r=s=0 then result is exact and round is done, else set
+| the inex flag in status reg and continue.
 |
-	bsrs	ext_grs			|this subroutine looks at the 
-|					:rounding precision and sets 
+	bsrs	ext_grs			|this subroutine looks at the
+|					:rounding precision and sets
 |					;the appropriate g-r-s bits.
 	tstl	%d0			|if grs are zero, go force
 	bne	rnd_cont		|lower bits to zero for size
-	
+
 	swap	%d1			|set up d1.w for round prec.
 	bra	truncate
 
@@ -79,7 +79,7 @@
 |	If sign of fp number = 0 (positive), then add 1 to l.
 |
 rnd_plus:
-	swap 	%d1			|set up d1 for round prec.
+	swap	%d1			|set up d1 for round prec.
 	tstb	LOCAL_SGN(%a0)		|check for sign
 	bmi	truncate		|if positive then truncate
 	movel	#0xffffffff,%d0		|force g,r,s to be all f's
@@ -92,8 +92,8 @@
 |	If sign of fp number = 1 (negative), then add 1 to l.
 |
 rnd_mnus:
-	swap 	%d1			|set up d1 for round prec.
-	tstb	LOCAL_SGN(%a0)		|check for sign	
+	swap	%d1			|set up d1 for round prec.
+	tstb	LOCAL_SGN(%a0)		|check for sign
 	bpl	truncate		|if negative then truncate
 	movel	#0xffffffff,%d0		|force g,r,s to be all f's
 	lea	add_to_l,%a1
@@ -104,7 +104,7 @@
 |
 |	Always truncate.
 rnd_zero:
-	swap 	%d1			|set up d1 for round prec.
+	swap	%d1			|set up d1 for round prec.
 	bra	truncate
 |
 |
@@ -114,7 +114,7 @@
 |	Note that this will round to even in case of a tie.
 |
 rnd_near:
-	swap 	%d1			|set up d1 for round prec.
+	swap	%d1			|set up d1 for round prec.
 	asll	#1,%d0			|shift g-bit to c-bit
 	bcc	truncate		|if (g=1) then
 	lea	add_to_l,%a1
@@ -125,11 +125,11 @@
 |	ext_grs --- extract guard, round and sticky bits
 |
 | Input:	d1 =		PREC:ROUND
-| Output:  	d0{31:29}=	guard, round, sticky
+| Output:	d0{31:29}=	guard, round, sticky
 |
 | The ext_grs extract the guard/round/sticky bits according to the
 | selected rounding precision. It is called by the round subroutine
-| only.  All registers except d0 are kept intact. d0 becomes an 
+| only.  All registers except d0 are kept intact. d0 becomes an
 | updated guard,round,sticky in d0{31:29}
 |
 | Notes: the ext_grs uses the round PREC, and therefore has to swap d1
@@ -140,7 +140,7 @@
 	cmpiw	#0,%d1
 	bnes	sgl_or_dbl
 	bras	end_ext_grs
- 
+
 sgl_or_dbl:
 	moveml	%d2/%d3,-(%a7)		|make some temp registers
 	cmpiw	#1,%d1
@@ -150,19 +150,19 @@
 	movel	#30,%d2			|of the sgl prec. limits
 	lsll	%d2,%d3			|shift g-r bits to MSB of d3
 	movel	LOCAL_HI(%a0),%d2		|get word 2 for s-bit test
-	andil	#0x0000003f,%d2		|s bit is the or of all other 
+	andil	#0x0000003f,%d2		|s bit is the or of all other
 	bnes	st_stky			|bits to the right of g-r
 	tstl	LOCAL_LO(%a0)		|test lower mantissa
 	bnes	st_stky			|if any are set, set sticky
 	tstl	%d0			|test original g,r,s
 	bnes	st_stky			|if any are set, set sticky
 	bras	end_sd			|if words 3 and 4 are clr, exit
-grs_dbl:    
+grs_dbl:
 	bfextu	LOCAL_LO(%a0){#21:#2},%d3	|dbl-prec. g-r are 2 bits right
 	movel	#30,%d2			|of the dbl prec. limits
 	lsll	%d2,%d3			|shift g-r bits to the MSB of d3
 	movel	LOCAL_LO(%a0),%d2		|get lower mantissa  for s-bit test
-	andil	#0x000001ff,%d2		|s bit is the or-ing of all 
+	andil	#0x000001ff,%d2		|s bit is the or-ing of all
 	bnes	st_stky			|other bits to the right of g-r
 	tstl	%d0			|test word original g,r,s
 	bnes	st_stky			|if any are set, set sticky
@@ -269,20 +269,20 @@
 |
 |	NORMALIZE
 |
-| These routines (nrm_zero & nrm_set) normalize the unnorm.  This 
-| is done by shifting the mantissa left while decrementing the 
+| These routines (nrm_zero & nrm_set) normalize the unnorm.  This
+| is done by shifting the mantissa left while decrementing the
 | exponent.
 |
-| NRM_SET shifts and decrements until there is a 1 set in the integer 
+| NRM_SET shifts and decrements until there is a 1 set in the integer
 | bit of the mantissa (msb in d1).
 |
-| NRM_ZERO shifts and decrements until there is a 1 set in the integer 
-| bit of the mantissa (msb in d1) unless this would mean the exponent 
-| would go less than 0.  In that case the number becomes a denorm - the 
-| exponent (d0) is set to 0 and the mantissa (d1 & d2) is not 
+| NRM_ZERO shifts and decrements until there is a 1 set in the integer
+| bit of the mantissa (msb in d1) unless this would mean the exponent
+| would go less than 0.  In that case the number becomes a denorm - the
+| exponent (d0) is set to 0 and the mantissa (d1 & d2) is not
 | normalized.
 |
-| Note that both routines have been optimized (for the worst case) and 
+| Note that both routines have been optimized (for the worst case) and
 | therefore do not have the easy to follow decrement/shift loop.
 |
 |	NRM_ZERO
@@ -304,34 +304,34 @@
 	.global	nrm_zero
 nrm_zero:
 	movew	LOCAL_EX(%a0),%d0
-	cmpw   #64,%d0          |see if exp > 64 
+	cmpw   #64,%d0          |see if exp > 64
 	bmis	d0_less
-	bsr	nrm_set		|exp > 64 so exp won't exceed 0 
+	bsr	nrm_set		|exp > 64 so exp won't exceed 0
 	rts
 d0_less:
 	moveml	%d2/%d3/%d5/%d6,-(%a7)
 	movel	LOCAL_HI(%a0),%d1
 	movel	LOCAL_LO(%a0),%d2
 
-	bfffo	%d1{#0:#32},%d3	|get the distance to the first 1 
+	bfffo	%d1{#0:#32},%d3	|get the distance to the first 1
 |				;in ms mant
 	beqs	ms_clr		|branch if no bits were set
 	cmpw	%d3,%d0		|of X>Y
-	bmis	greater		|then exp will go past 0 (neg) if 
+	bmis	greater		|then exp will go past 0 (neg) if
 |				;it is just shifted
 	bsr	nrm_set		|else exp won't go past 0
 	moveml	(%a7)+,%d2/%d3/%d5/%d6
-	rts	
+	rts
 greater:
 	movel	%d2,%d6		|save ls mant in d6
 	lsll	%d0,%d2		|shift ls mant by count
 	lsll	%d0,%d1		|shift ms mant by count
 	movel	#32,%d5
-	subl	%d0,%d5		|make op a denorm by shifting bits 
-	lsrl	%d5,%d6		|by the number in the exp, then 
+	subl	%d0,%d5		|make op a denorm by shifting bits
+	lsrl	%d5,%d6		|by the number in the exp, then
 |				;set exp = 0.
 	orl	%d6,%d1		|shift the ls mant bits into the ms mant
-	movel	#0,%d0		|same as if decremented exp to 0 
+	movel	#0,%d0		|same as if decremented exp to 0
 |				;while shifting
 	movew	%d0,LOCAL_EX(%a0)
 	movel	%d1,LOCAL_HI(%a0)
@@ -380,7 +380,7 @@
 	rts
 
 |
-| We get here if ms mant was = 0, and we assume ls mant has bits 
+| We get here if ms mant was = 0, and we assume ls mant has bits
 | set (otherwise this would have been tagged a zero not a denorm).
 |
 lower:
@@ -400,26 +400,26 @@
 |
 |	Used by underflow.
 |
-| Input: 
+| Input:
 |	a0	 points to the operand to be denormalized
 |		 (in the internal extended format)
-|		 
-|	d0: 	 rounding precision
+|
+|	d0:	 rounding precision
 | Output:
 |	a0	 points to the denormalized result
 |		 (in the internal extended format)
 |
-|	d0 	is guard,round,sticky
+|	d0	is guard,round,sticky
 |
-| d0 comes into this routine with the rounding precision. It 
-| is then loaded with the denormalized exponent threshold for the 
+| d0 comes into this routine with the rounding precision. It
+| is then loaded with the denormalized exponent threshold for the
 | rounding precision.
 |
 
 	.global	denorm
 denorm:
 	btstb	#6,LOCAL_EX(%a0)	|check for exponents between $7fff-$4000
-	beqs	no_sgn_ext	
+	beqs	no_sgn_ext
 	bsetb	#7,LOCAL_EX(%a0)	|sign extend if it is so
 no_sgn_ext:
 
@@ -442,7 +442,7 @@
 	movel	%d1,%d0		|copy d1 into d0
 	subw	LOCAL_EX(%a0),%d0	|diff = threshold - exp
 	cmpw	#67,%d0		|if diff > 67 (mant + grs bits)
-	bpls	chk_stky	|then branch (all bits would be 
+	bpls	chk_stky	|then branch (all bits would be
 |				; shifted off in denorm routine)
 	clrl	%d0		|else clear the sticky flag
 	bsr	dnrm_lp		|denormalize the number
@@ -455,7 +455,7 @@
 	movel	%d1,%d0		|copy d1 into d0
 	subw	LOCAL_EX(%a0),%d0	|diff = threshold - exp
 	cmpw	#67,%d0		|if diff > 67 (mant + grs bits)
-	bpls	chk_stky	|then branch (all bits would be 
+	bpls	chk_stky	|then branch (all bits would be
 |				; shifted off in denorm routine)
 	clrl	%d0		|else clear the sticky flag
 	bsr	dnrm_lp		|denormalize the number
@@ -474,7 +474,7 @@
 	movel	#0x20000000,%d0	|set sticky bit in return value
 clr_mant:
 	movew	%d1,LOCAL_EX(%a0)		|load exp with threshold
-	movel	#0,LOCAL_HI(%a0) 	|set d1 = 0 (ms mantissa)
+	movel	#0,LOCAL_HI(%a0)	|set d1 = 0 (ms mantissa)
 	movel	#0,LOCAL_LO(%a0)		|set d2 = 0 (ms mantissa)
 	rts
 dnrm_inex:
@@ -487,7 +487,7 @@
 |
 | Input:
 |	a0		points to the operand to be denormalized
-|	d0{31:29} 	initial guard,round,sticky
+|	d0{31:29}	initial guard,round,sticky
 |	d1{15:0}	denormalization threshold
 | Output:
 |	a0		points to the denormalized operand
@@ -496,7 +496,7 @@
 |
 | The LOCAL_LO and LOCAL_GRS parts of the value are copied to FP_SCR2
 | so that bfext can be used to extract the new low part of the mantissa.
-| Dnrm_lp can be called with a0 pointing to ETEMP or WBTEMP and there 
+| Dnrm_lp can be called with a0 pointing to ETEMP or WBTEMP and there
 | is no LOCAL_GRS scratch word following it on the fsave frame.
 |
 	.global	dnrm_lp
@@ -515,8 +515,8 @@
 	movel	%d1,%d0			|copy the denorm threshold
 	subw	LOCAL_EX(%a0),%d1		|d1 = threshold - uns exponent
 	bles	no_lp			|d1 <= 0
-	cmpw	#32,%d1			
-	blts	case_1			|0 = d1 < 32 
+	cmpw	#32,%d1
+	blts	case_1			|0 = d1 < 32
 	cmpw	#64,%d1
 	blts	case_2			|32 <= d1 < 64
 	bra	case_3			|d1 >= 64
@@ -542,7 +542,7 @@
 	movel	%d2,LOCAL_HI(%a0)		|store new LOCAL_HI
 	movel	%d1,LOCAL_LO(%a0)		|store new LOCAL_LO
 	clrb	%d1
-	bftst	%d0{#2:#30}	
+	bftst	%d0{#2:#30}
 	beqs	c1nstky
 	bsetl	#rnd_stky_bit,%d0
 	st	%d1
@@ -585,7 +585,7 @@
 	movel	FP_SCR2+LOCAL_GRS(%a6),%d2	|restore original g,r,s
 	andil	#0xe0000000,%d2		|clear all but G,R,S
 	tstl	%d2			|test if original G,R,S are clear
-	beqs	clear_grs		
+	beqs	clear_grs
 	orl	#0x20000000,%d0		|set sticky bit in d0
 clear_grs:
 	andil	#0xe0000000,%d0		|get rid of all but G,R,S
@@ -621,7 +621,7 @@
 	bfextu	%d0{#2:#30},%d1
 	andil	#0xc0000000,%d0
 	bras	c3com
-	
+
 sixty_five:
 	movel	LOCAL_HI(%a0),%d0
 	bfextu	%d0{#1:#31},%d1
diff -Nru a/arch/m68k/fpsp040/sacos.S b/arch/m68k/fpsp040/sacos.S
--- a/arch/m68k/fpsp040/sacos.S	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/fpsp040/sacos.S	Tue Jun 15 22:20:40 2004
@@ -12,7 +12,7 @@
 |
 |	Accuracy and Monotonicity: The returned result is within 3 ulps in
 |		64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-|		result is subsequently rounded to double precision. The 
+|		result is subsequently rounded to double precision. The
 |		result is provably monotonic in double precision.
 |
 |	Speed: The program sCOS takes approximately 310 cycles.
@@ -38,8 +38,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SACOS	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -74,17 +74,17 @@
 |--ACOS(X) = 2 * ATAN(	SQRT( (1-X)/(1+X) )	)
 
 	fmoves		#0x3F800000,%fp1
-	faddx		%fp0,%fp1	 	| ...1+X
-	fnegx		%fp0	 	| ... -X
+	faddx		%fp0,%fp1		| ...1+X
+	fnegx		%fp0		| ... -X
 	fadds		#0x3F800000,%fp0	| ...1-X
-	fdivx		%fp1,%fp0	 	| ...(1-X)/(1+X)
+	fdivx		%fp1,%fp0		| ...(1-X)/(1+X)
 	fsqrtx		%fp0		| ...SQRT((1-X)/(1+X))
 	fmovemx	%fp0-%fp0,(%a0)	| ...overwrite input
 	movel		%d1,-(%sp)	|save original users fpcr
 	clrl		%d1
 	bsr		satan		| ...ATAN(SQRT([1-X]/[1+X]))
 	fmovel		(%sp)+,%fpcr	|restore users exceptions
-	faddx		%fp0,%fp0	 	| ...2 * ATAN( STUFF )
+	faddx		%fp0,%fp0		| ...2 * ATAN( STUFF )
 	bra		t_frcinx
 
 ACOSBIG:
@@ -110,6 +110,6 @@
 ACOSP1:
 	fmovel		%d1,%FPCR
 	fmoves		#0x00000000,%fp0
-	rts				|Facos ; of +1 is exact	
+	rts				|Facos ; of +1 is exact
 
 	|end
diff -Nru a/arch/m68k/fpsp040/sasin.S b/arch/m68k/fpsp040/sasin.S
--- a/arch/m68k/fpsp040/sasin.S	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/fpsp040/sasin.S	Tue Jun 15 22:20:40 2004
@@ -12,7 +12,7 @@
 |
 |	Accuracy and Monotonicity: The returned result is within 3 ulps in
 |		64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-|		result is subsequently rounded to double precision. The 
+|		result is subsequently rounded to double precision. The
 |		result is provably monotonic in double precision.
 |
 |	Speed: The program sASIN takes approximately 310 cycles.
@@ -38,8 +38,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SASIN	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -80,7 +80,7 @@
 	fmulx		%fp2,%fp1		| ...(1+X)(1-X)
 	fmovemx	(%a7)+,%fp2-%fp2
 	fsqrtx		%fp1		| ...SQRT([1-X][1+X])
-	fdivx		%fp1,%fp0	 	| ...X/SQRT([1-X][1+X])
+	fdivx		%fp1,%fp0		| ...X/SQRT([1-X][1+X])
 	fmovemx	%fp0-%fp0,(%a0)
 	bsr		satan
 	bra		t_frcinx
@@ -97,7 +97,7 @@
 	andil		#0x80000000,%d0	| ...SIGN BIT OF X
 	oril		#0x3F800000,%d0	| ...+-1 IN SGL FORMAT
 	movel		%d0,-(%sp)	| ...push SIGN(X) IN SGL-FMT
-	fmovel		%d1,%FPCR		
+	fmovel		%d1,%FPCR
 	fmuls		(%sp)+,%fp0
 	bra		t_frcinx
 
diff -Nru a/arch/m68k/fpsp040/satan.S b/arch/m68k/fpsp040/satan.S
--- a/arch/m68k/fpsp040/satan.S	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/fpsp040/satan.S	Tue Jun 15 22:20:41 2004
@@ -43,8 +43,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |satan	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -52,7 +52,7 @@
 	|section	8
 
 #include "fpsp.h"
-	
+
 BOUNDS1:	.long 0x3FFB8000,0x4002FFFF
 
 ONE:	.long 0x3F800000
@@ -322,7 +322,7 @@
 |--THE REASON FOR THIS REARRANGEMENT IS TO MAKE THE INDEPENDENT
 |--PARTS A1*U*V AND (A2 + ... STUFF) MORE LOAD-BALANCED
 
-	
+
 	fmovex		%fp0,%fp1
 	fmulx		%fp1,%fp1
 	fmoved		ATANA3,%fp2
@@ -332,7 +332,7 @@
 	faddd		ATANA2,%fp2	| ...A2+V*(A3+V)
 	fmuld		ATANA1,%fp1	| ...A1*U*V
 	fmulx		%fp2,%fp1		| ...A1*U*V*(A2+V*(A3+V))
-	
+
 	faddx		%fp1,%fp0		| ...ATAN(U), FP1 RELEASED
 	fmovel		%d1,%FPCR		|restore users exceptions
 	faddx		ATANF(%a6),%fp0	| ...ATAN(X)
@@ -356,7 +356,7 @@
 |--COMPUTE POLYNOMIAL
 	fmulx		%fp0,%fp0	| ...FP0 IS Y = X*X
 
-	
+
 	movew		#0x0000,XDCARE(%a6)
 
 	fmovex		%fp0,%fp1
@@ -381,7 +381,7 @@
 	fmulx		X(%a6),%fp0		| ...X*Y
 
 	faddx		%fp2,%fp1		| ...[B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))]
-	
+
 
 	fmulx		%fp1,%fp0	| ...X*Y*([B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))])
 
@@ -413,7 +413,7 @@
 	fmoves		#0xBF800000,%fp1	| ...LOAD -1
 	fdivx		%fp0,%fp1		| ...FP1 IS -1/X
 
-	
+
 |--DIVIDE IS STILL CRANKING
 
 	fmovex		%fp1,%fp0		| ...FP0 IS X'
@@ -439,14 +439,14 @@
 	fmulx		X(%a6),%fp0		| ...X'*Y
 
 	faddx		%fp2,%fp1		| ...[Y*(C2+Z*C4)]+[C1+Z*(C3+Z*C5)]
-	
+
 
 	fmulx		%fp1,%fp0		| ...X'*Y*([B1+Z*(B3+Z*B5)]
 |					...	+[Y*(B2+Z*(B4+Z*B6))])
 	faddx		X(%a6),%fp0
 
 	fmovel		%d1,%FPCR		|restore users exceptions
-	
+
 	btstb		#7,(%a0)
 	beqs		pos_big
 
@@ -474,5 +474,5 @@
 	fmovel		%d1,%fpcr
 	fsubx		PTINY,%fp0
 	bra		t_frcinx
-	
+
 	|end
diff -Nru a/arch/m68k/fpsp040/satanh.S b/arch/m68k/fpsp040/satanh.S
--- a/arch/m68k/fpsp040/satanh.S	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/fpsp040/satanh.S	Tue Jun 15 22:20:37 2004
@@ -13,7 +13,7 @@
 |
 |	Accuracy and Monotonicity: The returned result is within 3 ulps in
 |		64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-|		result is subsequently rounded to double precision. The 
+|		result is subsequently rounded to double precision. The
 |		result is provably monotonic in double precision.
 |
 |	Speed: The program satanh takes approximately 270 cycles.
@@ -33,7 +33,7 @@
 |	3. If |X| > 1, go to 5.
 |
 |	4. (|X| = 1) Generate infinity with an appropriate sign and
-|		divide-by-zero by	
+|		divide-by-zero by
 |		sgn := sign(X)
 |		atan(X) := sgn / (+0).
 |		Exit.
@@ -45,8 +45,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |satanh	idnt	2,1 | Motorola 040 Floating Point Software Package
diff -Nru a/arch/m68k/fpsp040/scale.S b/arch/m68k/fpsp040/scale.S
--- a/arch/m68k/fpsp040/scale.S	Tue Jun 15 22:21:03 2004
+++ b/arch/m68k/fpsp040/scale.S	Tue Jun 15 22:21:03 2004
@@ -9,7 +9,7 @@
 |	The entry point sscale is called from do_func to emulate
 |	the fscale unimplemented instruction.
 |
-|	Input: Double-extended destination operand in FPTEMP, 
+|	Input: Double-extended destination operand in FPTEMP,
 |		double-extended source operand in ETEMP.
 |
 |	Output: The function returns scale(X,Y) to fp0.
@@ -17,12 +17,12 @@
 |	Modifies: fp0.
 |
 |	Algorithm:
-|		
+|
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SCALE    idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -147,7 +147,7 @@
 src_neg:
 	addl		%d0,%d1		|add src to dest
 	beqs		denorm		|if zero, result is denorm
-	blts		fix_dnrm	|if negative, result is 
+	blts		fix_dnrm	|if negative, result is
 |					;needing denormalization
 	tstb		L_SCR1(%a6)
 	beqs		sneg_pos
@@ -161,7 +161,7 @@
 
 |
 | The result exponent is below denorm value.  Test for catastrophic
-| underflow and force zero if true.  If not, try to shift the 
+| underflow and force zero if true.  If not, try to shift the
 | mantissa right until a zero exponent exists.
 |
 fix_dnrm:
@@ -229,7 +229,7 @@
 	rts
 
 |
-| The rounding mode changed the zero to a smallest denorm. Call 
+| The rounding mode changed the zero to a smallest denorm. Call
 | t_resdnrm with exceptional operand in ETEMP.
 |
 sm_dnrm:
@@ -250,7 +250,7 @@
 fix_exit:
 	bras		sm_dnrm
 
-	
+
 |
 | The result has underflowed to zero. Return zero and set
 | unfl, aunfl, and ainex.
@@ -284,7 +284,7 @@
 	clrl		FP_SCR1(%a6)	|clear the exceptional operand
 	clrl		FP_SCR1+4(%a6)	|for gen_except.
 	clrl		FP_SCR1+8(%a6)
-	fmoves		#0x80000000,%fp0	
+	fmoves		#0x80000000,%fp0
 	rts
 pos_zero:
 	clrl		FP_SCR1(%a6)	|clear the exceptional operand
@@ -299,7 +299,7 @@
 | then adding the remainder of the source to the exponent.
 |
 dst_dnrm:
-	moveml		%d2/%d3,-(%a7)	
+	moveml		%d2/%d3,-(%a7)
 	movew		FPTEMP_EX(%a6),%d1
 	movel		FPTEMP_HI(%a6),%d2
 	movel		FPTEMP_LO(%a6),%d3
@@ -313,7 +313,7 @@
 	roxll		#1,%d2
 	bras		dst_loop
 |
-| Destination became normalized.  Simply add the remaining 
+| Destination became normalized.  Simply add the remaining
 | portion of the src to the exponent.
 |
 dst_norm:
diff -Nru a/arch/m68k/fpsp040/scosh.S b/arch/m68k/fpsp040/scosh.S
--- a/arch/m68k/fpsp040/scosh.S	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/fpsp040/scosh.S	Tue Jun 15 22:20:36 2004
@@ -49,8 +49,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SCOSH	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -99,7 +99,7 @@
 	movel		(%sp)+,%d1
 
 	fmoves		#0x3E800000,%fp1	| ...(1/4)
-	fdivx		%fp0,%fp1	 	| ...1/(2 EXP(|X|))
+	fdivx		%fp0,%fp1		| ...1/(2 EXP(|X|))
 
 	fmovel		%d1,%FPCR
 	faddx		%fp1,%fp0
diff -Nru a/arch/m68k/fpsp040/setox.S b/arch/m68k/fpsp040/setox.S
--- a/arch/m68k/fpsp040/setox.S	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/fpsp040/setox.S	Tue Jun 15 22:20:39 2004
@@ -331,8 +331,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |setox	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -505,7 +505,7 @@
 	fmovex		%fp0,%fp2
 	fmuls		#0xBC317218,%fp0	| ...N * L1, L1 = lead(-log2/64)
 	fmulx		L2,%fp2		| ...N * L2, L1+L2 = -log2/64
-	faddx		%fp1,%fp0	 	| ...X + N*L1
+	faddx		%fp1,%fp0		| ...X + N*L1
 	faddx		%fp2,%fp0		| ...fp0 is R, reduced arg.
 |	MOVE.W		#$3FA5,EXPA3	...load EXPA3 in cache
 
@@ -516,46 +516,46 @@
 |--[R+R*S*(A2+S*A4)] + [S*(A1+S*(A3+S*A5))]
 
 	fmovex		%fp0,%fp1
-	fmulx		%fp1,%fp1	 	| ...fp1 IS S = R*R
+	fmulx		%fp1,%fp1		| ...fp1 IS S = R*R
 
 	fmoves		#0x3AB60B70,%fp2	| ...fp2 IS A5
 |	MOVE.W		#0,2(%a1)	...load 2^(J/64) in cache
 
-	fmulx		%fp1,%fp2	 	| ...fp2 IS S*A5
+	fmulx		%fp1,%fp2		| ...fp2 IS S*A5
 	fmovex		%fp1,%fp3
 	fmuls		#0x3C088895,%fp3	| ...fp3 IS S*A4
 
 	faddd		EXPA3,%fp2	| ...fp2 IS A3+S*A5
 	faddd		EXPA2,%fp3	| ...fp3 IS A2+S*A4
 
-	fmulx		%fp1,%fp2	 	| ...fp2 IS S*(A3+S*A5)
+	fmulx		%fp1,%fp2		| ...fp2 IS S*(A3+S*A5)
 	movew		%d0,SCALE(%a6)	| ...SCALE is 2^(M) in extended
 	clrw		SCALE+2(%a6)
 	movel		#0x80000000,SCALE+4(%a6)
 	clrl		SCALE+8(%a6)
 
-	fmulx		%fp1,%fp3	 	| ...fp3 IS S*(A2+S*A4)
+	fmulx		%fp1,%fp3		| ...fp3 IS S*(A2+S*A4)
 
 	fadds		#0x3F000000,%fp2	| ...fp2 IS A1+S*(A3+S*A5)
-	fmulx		%fp0,%fp3	 	| ...fp3 IS R*S*(A2+S*A4)
+	fmulx		%fp0,%fp3		| ...fp3 IS R*S*(A2+S*A4)
 
-	fmulx		%fp1,%fp2	 	| ...fp2 IS S*(A1+S*(A3+S*A5))
-	faddx		%fp3,%fp0	 	| ...fp0 IS R+R*S*(A2+S*A4),
+	fmulx		%fp1,%fp2		| ...fp2 IS S*(A1+S*(A3+S*A5))
+	faddx		%fp3,%fp0		| ...fp0 IS R+R*S*(A2+S*A4),
 |					...fp3 released
 
 	fmovex		(%a1)+,%fp1	| ...fp1 is lead. pt. of 2^(J/64)
-	faddx		%fp2,%fp0	 	| ...fp0 is EXP(R) - 1
+	faddx		%fp2,%fp0		| ...fp0 is EXP(R) - 1
 |					...fp2 released
 
 |--Step 5
 |--final reconstruction process
 |--EXP(X) = 2^M * ( 2^(J/64) + 2^(J/64)*(EXP(R)-1) )
 
-	fmulx		%fp1,%fp0	 	| ...2^(J/64)*(Exp(R)-1)
+	fmulx		%fp1,%fp0		| ...2^(J/64)*(Exp(R)-1)
 	fmovemx	(%a7)+,%fp2-%fp2/%fp3	| ...fp2 restored
 	fadds		(%a1),%fp0	| ...accurate 2^(J/64)
 
-	faddx		%fp1,%fp0	 	| ...2^(J/64) + 2^(J/64)*...
+	faddx		%fp1,%fp0		| ...2^(J/64) + 2^(J/64)*...
 	movel		ADJFLAG(%a6),%d0
 
 |--Step 6
@@ -564,7 +564,7 @@
 ADJUST:
 	fmulx		ADJSCALE(%a6),%fp0
 NORMAL:
-	fmovel		%d1,%FPCR	 	| ...restore user FPCR
+	fmovel		%d1,%FPCR		| ...restore user FPCR
 	fmulx		SCALE(%a6),%fp0	| ...multiply 2^(M)
 	bra		t_frcinx
 
diff -Nru a/arch/m68k/fpsp040/sgetem.S b/arch/m68k/fpsp040/sgetem.S
--- a/arch/m68k/fpsp040/sgetem.S	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/fpsp040/sgetem.S	Tue Jun 15 22:20:40 2004
@@ -1,14 +1,14 @@
 |
 |	sgetem.sa 3.1 12/10/90
 |
-|	The entry point sGETEXP returns the exponent portion 
+|	The entry point sGETEXP returns the exponent portion
 |	of the input argument.  The exponent bias is removed
-|	and the exponent value is returned as an extended 
+|	and the exponent value is returned as an extended
 |	precision number in fp0.  sGETEXPD handles denormalized
 |	numbers.
 |
-|	The entry point sGETMAN extracts the mantissa of the 
-|	input argument.  The mantissa is converted to an 
+|	The entry point sGETMAN extracts the mantissa of the
+|	input argument.  The mantissa is converted to an
 |	extended precision number and returned in fp0.  The
 |	range of the result is [1.0 - 2.0).
 |
@@ -24,8 +24,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SGETEM	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -81,7 +81,7 @@
 	fmovel	%d0,%fpcr		|this fpcr setting is used by the 882
 	movew	LOCAL_EX(%a0),%d0	|get the exp (really just want sign bit)
 	orw	#0x7fff,%d0	|clear old exp
-	bclrl	#14,%d0	 	|make it the new exp +-3fff
+	bclrl	#14,%d0		|make it the new exp +-3fff
 	movew	%d0,LOCAL_EX(%a0)	|move the sign & exp back to fsave stack
 	fmovex	(%a0),%fp0	|put new value back in fp0
 	rts
diff -Nru a/arch/m68k/fpsp040/sint.S b/arch/m68k/fpsp040/sint.S
--- a/arch/m68k/fpsp040/sint.S	Tue Jun 15 22:21:04 2004
+++ b/arch/m68k/fpsp040/sint.S	Tue Jun 15 22:21:04 2004
@@ -1,8 +1,8 @@
 |
 |	sint.sa 3.1 12/10/90
 |
-|	The entry point sINT computes the rounded integer 
-|	equivalent of the input argument, sINTRZ computes 
+|	The entry point sINT computes the rounded integer
+|	equivalent of the input argument, sINTRZ computes
 |	the integer rounded to zero of the input argument.
 |
 |	Entry points sint and sintrz are called from do_func
@@ -24,10 +24,10 @@
 |
 |	Algorithm: (sint and sintrz)
 |
-|	1. If exp(X) >= 63, return X. 
+|	1. If exp(X) >= 63, return X.
 |	   If exp(X) < 0, return +/- 0 or +/- 1, according to
 |	   the rounding mode.
-|	
+|
 |	2. (X is in range) set rsc = 63 - exp(X). Unnormalize the
 |	   result to the exponent $403e.
 |
@@ -51,8 +51,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SINT    idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -78,9 +78,9 @@
 sint:
 	bfextu	FPCR_MODE(%a6){#2:#2},%d1	|use user's mode for rounding
 |					;implicitly has extend precision
-|					;in upper word. 
+|					;in upper word.
 	movel	%d1,L_SCR1(%a6)		|save mode bits
-	bras	sintexc			
+	bras	sintexc
 
 |
 |	FINT with extended denorm inputs.
@@ -115,13 +115,13 @@
 sintrz:
 	movel	#1,L_SCR1(%a6)		|use rz mode for rounding
 |					;implicitly has extend precision
-|					;in upper word. 
-	bras	sintexc			
+|					;in upper word.
+	bras	sintexc
 |
 |	SINTDO
 |
 |	Input:	a0 points to an IEEE extended format operand
-| 	Output:	fp0 has the result 
+|	Output:	fp0 has the result
 |
 | Exceptions:
 |
@@ -133,7 +133,7 @@
 sintdo:
 	bfextu	FPCR_MODE(%a6){#2:#2},%d1	|use user's mode for rounding
 |					;implicitly has ext precision
-|					;in upper word. 
+|					;in upper word.
 	movel	%d1,L_SCR1(%a6)		|save mode bits
 |
 | Real work of sint is in sintexc
@@ -141,7 +141,7 @@
 sintexc:
 	bclrb	#sign_bit,LOCAL_EX(%a0)	|convert to internal extended
 |					;format
-	sne	LOCAL_SGN(%a0)		
+	sne	LOCAL_SGN(%a0)
 	cmpw	#0x403e,LOCAL_EX(%a0)	|check if (unbiased) exp > 63
 	bgts	out_rnge			|branch if exp < 63
 	cmpw	#0x3ffd,LOCAL_EX(%a0)	|check if (unbiased) exp < 0
@@ -187,7 +187,7 @@
 un_rnrz_neg:
 	bsr	ld_mzero
 	bra	t_inx2
-	
+
 |
 | Input is greater than 2^63.  All bits are significant.  Return
 | the input.
@@ -206,7 +206,7 @@
 	rts
 
 in_rnge:
-| 					;shift off fraction bits
+|					;shift off fraction bits
 	clrl	%d0			|clear d0 - initial g,r,s for
 |					;dnrm_lp
 	movel	#0x403e,%d1		|set threshold for dnrm_lp
diff -Nru a/arch/m68k/fpsp040/skeleton.S b/arch/m68k/fpsp040/skeleton.S
--- a/arch/m68k/fpsp040/skeleton.S	Tue Jun 15 22:20:43 2004
+++ b/arch/m68k/fpsp040/skeleton.S	Tue Jun 15 22:20:43 2004
@@ -18,20 +18,20 @@
 |	to handle the exception.
 |
 |	If the exception was completely handled by the package, then
-|	the return will be via a 'jmp fpsp_done'.  Unless there is 
+|	the return will be via a 'jmp fpsp_done'.  Unless there is
 |	OS specific work to be done (such as handling a context switch or
 |	interrupt) the user program can be resumed via 'rte'.
 |
 |	In the following skeleton code, some typical 'real_xxxx' handling
 |	code is shown.  This code may need to be moved to an appropriate
 |	place in the target system, or rewritten.
-|	
+|
 
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |
@@ -50,7 +50,7 @@
 |
 
 	|section 8
- 
+
 #include "fpsp.h"
 
 	|xref	b1238_fix
@@ -72,7 +72,7 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
@@ -82,7 +82,7 @@
 |
 |	All inexact exceptions are real, but the 'real' handler
 |	will probably want to clear the pending exception.
-|	The provided code will clear the E3 exception (if pending), 
+|	The provided code will clear the E3 exception (if pending),
 |	otherwise clear the E1 exception.  The frestore is not really
 |	necessary for E1 exceptions.
 |
@@ -96,7 +96,7 @@
 | to the appropriate  handler for the exception in the fpsr.  Note
 | that this fix is only for d43b parts, and is skipped if the
 | version number is not $40.
-| 
+|
 |
 	.global	real_inex
 	.global	inex
@@ -116,7 +116,7 @@
 	bra		snan
 inex_ckofl:
 	btstb		#ovfl_bit,2(%sp) |test for ovfl
-	beq		inex_ckufl 
+	beq		inex_ckufl
 	addl		#4,%sp
 	frestore	(%sp)+
 	unlk		%a6
@@ -163,11 +163,11 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
-	
+
 |
 |	Overflow exception
 |
@@ -189,11 +189,11 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
-	
+
 |
 |	Underflow exception
 |
@@ -215,11 +215,11 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
-	
+
 |
 |	Signalling NAN exception
 |
@@ -237,11 +237,11 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
-	
+
 |
 |	Operand Error exception
 |
@@ -259,12 +259,12 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
 
-	
+
 |
 |	BSUN exception
 |
@@ -287,7 +287,7 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
@@ -295,7 +295,7 @@
 |
 |	F-line exception
 |
-|	A 'real' F-line exception is one that the FPSP isn't supposed to 
+|	A 'real' F-line exception is one that the FPSP isn't supposed to
 |	handle. E.g. an instruction with a co-processor ID that is not 1.
 |
 |
@@ -308,7 +308,7 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
@@ -330,7 +330,7 @@
 
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	bral	ret_from_exception
@@ -355,14 +355,14 @@
 |	{4028, 4130} - unimp frame
 |	{4000, 4100} - idle frame
 |
-|	This entry point simply holds an f-line illegal value.  
+|	This entry point simply holds an f-line illegal value.
 |	Replace this with a call to your kernel panic code or
 |	code to handle future revisions of the fpu.
 |
 	.global	fpsp_fmt_error
 fpsp_fmt_error:
 
-	.long	0xf27f0000	|f-line illegal 
+	.long	0xf27f0000	|f-line illegal
 
 |
 |	fpsp_done --- FPSP exit point
@@ -442,7 +442,7 @@
 |	a1 - supervisor destination address
 |	d0 - number of bytes to read (maximum count is 12)
 |
-| Like mem_write, mem_read always reads with a supervisor 
+| Like mem_write, mem_read always reads with a supervisor
 | destination address on the supervisor stack.  Also like mem_write,
 | the EXC_SR is checked and a simple memory copy is done if reading
 | from supervisor space is indicated.
diff -Nru a/arch/m68k/fpsp040/slog2.S b/arch/m68k/fpsp040/slog2.S
--- a/arch/m68k/fpsp040/slog2.S	Tue Jun 15 22:21:02 2004
+++ b/arch/m68k/fpsp040/slog2.S	Tue Jun 15 22:21:02 2004
@@ -1,28 +1,28 @@
 |
 |	slog2.sa 3.1 12/10/90
 |
-|       The entry point slog10 computes the base-10 
+|       The entry point slog10 computes the base-10
 |	logarithm of an input argument X.
-|	slog10d does the same except the input value is a 
-|	denormalized number.  
+|	slog10d does the same except the input value is a
+|	denormalized number.
 |	sLog2 and sLog2d are the base-2 analogues.
 |
-|       INPUT:	Double-extended value in memory location pointed to 
+|       INPUT:	Double-extended value in memory location pointed to
 |		by address register a0.
 |
-|       OUTPUT: log_10(X) or log_2(X) returned in floating-point 
+|       OUTPUT: log_10(X) or log_2(X) returned in floating-point
 |		register fp0.
 |
-|       ACCURACY and MONOTONICITY: The returned result is within 1.7 
-|		ulps in 64 significant bit, i.e. within 0.5003 ulp 
-|		to 53 bits if the result is subsequently rounded 
-|		to double precision. The result is provably monotonic 
+|       ACCURACY and MONOTONICITY: The returned result is within 1.7
+|		ulps in 64 significant bit, i.e. within 0.5003 ulp
+|		to 53 bits if the result is subsequently rounded
+|		to double precision. The result is provably monotonic
 |		in double precision.
 |
-|       SPEED:	Two timings are measured, both in the copy-back mode. 
-|		The first one is measured when the function is invoked 
-|		the first time (so the instructions and data are not 
-|		in cache), and the second one is measured when the 
+|       SPEED:	Two timings are measured, both in the copy-back mode.
+|		The first one is measured when the function is invoked
+|		the first time (so the instructions and data are not
+|		in cache), and the second one is measured when the
 |		function is reinvoked at the same input argument.
 |
 |       ALGORITHM and IMPLEMENTATION NOTES:
@@ -42,7 +42,7 @@
 |            2.2  Return ans := Y * INV_L10.
 |
 |
-|       slog10: 
+|       slog10:
 |
 |       Step 0.   If X < 0, create a NaN and raise the invalid operation
 |                 flag. Otherwise, save FPCR in D1; set FpCR to default.
@@ -96,15 +96,15 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SLOG2    idnt    2,1 | Motorola 040 Floating Point Software Package
 
 	|section	8
 
-	|xref	t_frcinx	
+	|xref	t_frcinx
 	|xref	t_operr
 	|xref	slogn
 	|xref	slognd
diff -Nru a/arch/m68k/fpsp040/slogn.S b/arch/m68k/fpsp040/slogn.S
--- a/arch/m68k/fpsp040/slogn.S	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/fpsp040/slogn.S	Tue Jun 15 22:20:41 2004
@@ -13,11 +13,11 @@
 |
 |	Accuracy and Monotonicity: The returned result is within 2 ulps in
 |		64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-|		result is subsequently rounded to double precision. The 
+|		result is subsequently rounded to double precision. The
 |		result is provably monotonic in double precision.
 |
-|	Speed: The program slogn takes approximately 190 cycles for input 
-|		argument X such that |X-1| >= 1/16, which is the usual 
+|	Speed: The program slogn takes approximately 190 cycles for input
+|		argument X such that |X-1| >= 1/16, which is the usual
 |		situation. For those arguments, slognp1 takes approximately
 |		 210 cycles. For the less common arguments, the program will
 |		 run no worse than 10% slower.
@@ -45,26 +45,26 @@
 |	Step 2: Let 1+X = 2**k * Y, where 1 <= Y < 2. Define F as done in Step 2
 |		of the algorithm for LOGN and compute log(1+X) as
 |		k*log(2) + log(F) + poly where poly approximates log(1+u),
-|		u = (Y-F)/F. 
+|		u = (Y-F)/F.
 |
 |	Implementation Notes:
 |	Note 1. There are 64 different possible values for F, thus 64 log(F)'s
-|		need to be tabulated. Moreover, the values of 1/F are also 
+|		need to be tabulated. Moreover, the values of 1/F are also
 |		tabulated so that the division in (Y-F)/F can be performed by a
 |		multiplication.
 |
 |	Note 2. In Step 2 of lognp1, in order to preserved accuracy, the value
-|		Y-F has to be calculated carefully when 1/2 <= X < 3/2. 
+|		Y-F has to be calculated carefully when 1/2 <= X < 3/2.
 |
 |	Note 3. To fully exploit the pipeline, polynomials are usually separated
 |		into two parts evaluated independently before being added up.
-|	
+|
 
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |slogn	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -262,7 +262,7 @@
 |----the value TWOTO100 is no longer needed.
 |----Note that this code assumes the denormalized input is NON-ZERO.
 
-     moveml	%d2-%d7,-(%a7)		| ...save some registers 
+     moveml	%d2-%d7,-(%a7)		| ...save some registers
      movel	#0x00000000,%d3		| ...D3 is exponent of smallest norm. #
      movel	4(%a0),%d4
      movel	8(%a0),%d5		| ...(D4,D5) is (Hi_X,Lo_X)
@@ -347,14 +347,14 @@
 |--NOTE THAT U = (Y-F)/F IS VERY SMALL AND THUS APPROXIMATING
 |--LOG(1+U) CAN BE VERY EFFICIENT.
 |--ALSO NOTE THAT THE VALUE 1/F IS STORED IN A TABLE SO THAT NO
-|--DIVISION IS NEEDED TO CALCULATE (Y-F)/F. 
+|--DIVISION IS NEEDED TO CALCULATE (Y-F)/F.
 
 |--GET K, Y, F, AND ADDRESS OF 1/F.
 	asrl	#8,%d0
 	asrl	#8,%d0		| ...SHIFTED 16 BITS, BIASED EXPO. OF X
-	subil	#0x3FFF,%d0 	| ...THIS IS K
+	subil	#0x3FFF,%d0	| ...THIS IS K
 	addl	ADJK(%a6),%d0	| ...ADJUST K, ORIGINAL INPUT MAY BE  DENORM.
-	lea	LOGTBL,%a0 	| ...BASE ADDRESS OF 1/F AND LOG(F)
+	lea	LOGTBL,%a0	| ...BASE ADDRESS OF 1/F AND LOG(F)
 	fmovel	%d0,%fp1		| ...CONVERT K TO FLOATING-POINT FORMAT
 
 |--WHILE THE CONVERSION IS GOING ON, WE GET F AND ADDRESS OF 1/F
@@ -363,7 +363,7 @@
 	andil	#0xFE000000,FFRAC(%a6) | ...FIRST 7 BITS OF Y
 	oril	#0x01000000,FFRAC(%a6) | ...GET F: ATTACH A 1 AT THE EIGHTH BIT
 	movel	FFRAC(%a6),%d0	| ...READY TO GET ADDRESS OF 1/F
-	andil	#0x7E000000,%d0	
+	andil	#0x7E000000,%d0
 	asrl	#8,%d0
 	asrl	#8,%d0
 	asrl	#4,%d0		| ...SHIFTED 20, D0 IS THE DISPLACEMENT
@@ -390,7 +390,7 @@
 |--[U + V*(A1+V*(A3+V*A5))]  +  [U*V*(A2+V*(A4+V*A6))]
 
 	fmovex	%fp2,%fp3
-	fmovex	%fp2,%fp1	
+	fmovex	%fp2,%fp1
 
 	fmuld	LOGA6,%fp1	| ...V*A6
 	fmuld	LOGA5,%fp2	| ...V*A5
@@ -440,7 +440,7 @@
 	fmovex	%fp1,%fp0
 	fmulx	%fp0,%fp0	| ...FP0 IS V
 	fmovex	%fp1,SAVEU(%a6) | ...STORE U IN MEMORY, FREE FP1
-	fmovex	%fp0,%fp1	
+	fmovex	%fp0,%fp1
 	fmulx	%fp1,%fp1	| ...FP1 IS W
 
 	fmoved	LOGB5,%fp3
@@ -465,7 +465,7 @@
 	fmulx	%fp1,%fp0	| ...U*V*( [B1+W*(B3+W*B5)] + [V*(B2+W*B4)] )
 
 	fmovel	%d1,%fpcr
-	faddx	SAVEU(%a6),%fp0		
+	faddx	SAVEU(%a6),%fp0
 	bra	t_frcinx
 	rts
 
@@ -549,7 +549,7 @@
 	asrl	#8,%d0
 	asrl	#4,%d0		| ...D0 CONTAINS DISPLACEMENT FOR 1/F
 	faddx	%fp1,%fp1		| ...GET 2Z
-	fmovemx %fp2-%fp2/%fp3,-(%sp)	| ...SAVE FP2 
+	fmovemx %fp2-%fp2/%fp3,-(%sp)	| ...SAVE FP2
 	faddx	%fp1,%fp0		| ...FP0 IS Y-F = (2-F)+2Z
 	lea	LOGTBL,%a0	| ...A0 IS ADDRESS OF 1/F
 	addal	%d0,%a0
@@ -569,7 +569,7 @@
 	faddx	%fp1,%fp0		| ...FP0 IS Y-F
 	fmovemx %fp2-%fp2/%fp3,-(%sp)	| ...FP2 SAVED
 	lea	LOGTBL,%a0
-	addal	%d0,%a0	 	| ...A0 IS ADDRESS OF 1/F
+	addal	%d0,%a0		| ...A0 IS ADDRESS OF 1/F
 	fmoves	zero,%fp1	| ...FP1 IS K = 0
 	bra	LP1CONT1
 
diff -Nru a/arch/m68k/fpsp040/smovecr.S b/arch/m68k/fpsp040/smovecr.S
--- a/arch/m68k/fpsp040/smovecr.S	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/fpsp040/smovecr.S	Tue Jun 15 22:20:44 2004
@@ -15,8 +15,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SMOVECR	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -39,7 +39,7 @@
 
 FZERO:	.long	00000000
 |
-|	FMOVECR 
+|	FMOVECR
 |
 	.global	smovcr
 smovcr:
@@ -55,9 +55,9 @@
 	cmpib	#0x0e,%d0		|check range $0b - $0e
 	bles	SM_TBL		|valid constants in this range
 	cmpib	#0x2f,%d0		|check range $10 - $2f
-	bles	Z_VAL		|if in this range, return zero 
+	bles	Z_VAL		|if in this range, return zero
 	cmpib	#0x3f,%d0		|check range $30 - $3f
-	ble  	BG_TBL		|valid constants in this range
+	ble	BG_TBL		|valid constants in this range
 Z_VAL:
 	fmoves	FZERO,%fp0
 	rts
@@ -149,7 +149,7 @@
 	lea	FP_SCR1(%a6),%a0
 	btstb	#sign_bit,LOCAL_EX(%a0)
 	sne	LOCAL_SGN(%a0)		|convert to internal ext. format
-	
+
 	bsr	round			|go round the mantissa
 
 	bfclr	LOCAL_SGN(%a0){#0:#8}	|convert back to IEEE ext format
diff -Nru a/arch/m68k/fpsp040/srem_mod.S b/arch/m68k/fpsp040/srem_mod.S
--- a/arch/m68k/fpsp040/srem_mod.S	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/fpsp040/srem_mod.S	Tue Jun 15 22:20:36 2004
@@ -21,7 +21,7 @@
 |       ---------
 |
 |       Step 1.  Save and strip signs of X and Y: signX := sign(X),
-|                signY := sign(Y), X := |X|, Y := |Y|, 
+|                signY := sign(Y), X := |X|, Y := |Y|,
 |                signQ := signX EOR signY. Record whether MOD or REM
 |                is requested.
 |
@@ -41,7 +41,7 @@
 |
 |       Step 4.  At this point, R = X - QY = MOD(X,Y). Set
 |                Last_Subtract := false (used in Step 7 below). If
-|                MOD is requested, go to Step 6. 
+|                MOD is requested, go to Step 6.
 |
 |       Step 5.  R = MOD(X,Y), but REM(X,Y) is requested.
 |            5.1 If R < Y/2, then R = MOD(X,Y) = REM(X,Y). Go to
@@ -61,13 +61,13 @@
 |                X = 2^(j)*(Q+1)Y. set Q := 2^(j)*(Q+1),
 |                R := 0. Return signQ, last 7 bits of Q, and R.
 |
-|                
-             
+|
+
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 SREM_MOD:    |idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -362,10 +362,10 @@
 |..Get Q
 |
 Get_Q:
-   clrl		%d6		
+   clrl		%d6
    movew               SignQ(%a6),%d6        | ...D6 is sign(Q)
    movel               #8,%d7
-   lsrl                %d7,%d6           
+   lsrl                %d7,%d6
    andil               #0x0000007F,%d3   | ...7 bits of Q
    orl                 %d6,%d3           | ...sign and bits of Q
    swap                 %d3
@@ -391,7 +391,7 @@
 Rem_is_0:
 |..R = 2^(-j)X - Q Y = Y, thus R = 0 and quotient = 2^j (Q+1)
    addql               #1,%d3
-   cmpil               #8,%d0           | ...D0 is j 
+   cmpil               #8,%d0           | ...D0 is j
    bges                Q_Big
 
    lsll                %d0,%d3
diff -Nru a/arch/m68k/fpsp040/ssin.S b/arch/m68k/fpsp040/ssin.S
--- a/arch/m68k/fpsp040/ssin.S	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/fpsp040/ssin.S	Tue Jun 15 22:20:39 2004
@@ -83,8 +83,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SSIN	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -204,7 +204,7 @@
 
 |--HIDE THE NEXT THREE INSTRUCTIONS
 	lea		PITBL+0x200,%a1 | ...TABLE OF N*PI/2, N = -32,...,32
-	
+
 
 |--FP1 IS NOW READY
 	fmovel		%fp1,N(%a6)		| ...CONVERT TO INTEGER
@@ -273,7 +273,7 @@
 	faddx		%fp2,%fp1	| ...[A1+T(A3+T(A5+TA7))]+[S(A2+T(A4+TA6))]
 |--FP3 RELEASED, RESTORE NOW AND TAKE SOME ADVANTAGE OF HIDING
 |--FP2 RELEASED, RESTORE NOW AND TAKE FULL ADVANTAGE OF HIDING
-	
+
 
 	fmulx		%fp1,%fp0		| ...SIN(R')-R'
 |--FP1 RELEASED.
@@ -335,7 +335,7 @@
 	fmulx		%fp2,%fp0	| ...S(B2+T(B4+T(B6+TB8)))
 |--FP3 RELEASED, RESTORE NOW AND TAKE SOME ADVANTAGE OF HIDING
 |--FP2 RELEASED.
-	
+
 
 	faddx		%fp1,%fp0
 |--FP1 RELEASED
@@ -352,7 +352,7 @@
 |--IF |X| < 2**(-40), RETURN X OR 1.
 	cmpil		#0x3FFF8000,%d0
 	bgts		REDUCEX
-        
+
 
 SINSM:
 	movel		ADJN(%a6),%d0
@@ -466,7 +466,7 @@
         movew		%d2,FP_SCR2(%a6)
 	clrw           FP_SCR2+2(%a6)
 	movel		#0xC90FDAA2,FP_SCR2+4(%a6)
-	clrl		FP_SCR2+8(%a6)		| ...FP_SCR2 is  2**(L) * Piby2_1	
+	clrl		FP_SCR2+8(%a6)		| ...FP_SCR2 is  2**(L) * Piby2_1
 
 |--FP2 IS READY
 	fsubs		TWOTO63(%a6),%fp2		| ...FP2 is N
@@ -514,7 +514,7 @@
 	movel		(%a7)+,%d2
 	fmovemx	(%a7)+,%fp2-%fp5
 
-	
+
 	movel		ADJN(%a6),%d0
 	cmpil		#4,%d0
 
@@ -559,7 +559,7 @@
 
 |--HIDE THE NEXT THREE INSTRUCTIONS
 	lea		PITBL+0x200,%a1 | ...TABLE OF N*PI/2, N = -32,...,32
-	
+
 
 |--FP1 IS NOW READY
 	fmovel		%fp1,N(%a6)		| ...CONVERT TO INTEGER
@@ -577,7 +577,7 @@
 |--HIDE THE NEXT TWO
 	movel		N(%a6),%d0
 	rorl		#1,%d0
-	
+
 	cmpil		#0,%d0		| ...D0 < 0 IFF N IS ODD
 	bge		NEVEN
 
@@ -641,7 +641,7 @@
 	fmulx		%fp0,%fp1	 | ...S(A1+...)
 	fmulx		%fp2,%fp0	 | ...S(B2+...)
 
-	
+
 
 	fmulx		RPRIME(%a6),%fp1	| ...R'S(A1+...)
 	fadds		COSB1,%fp0	| ...B1+S(B2...)
@@ -709,7 +709,7 @@
 	fmulx		%fp0,%fp1	 | ...S(B2+...)
 	fmulx		%fp2,%fp0	 | ...s(a1+...)
 
-	
+
 
 	fadds		COSB1,%fp1	| ...B1+S(B2...)
 	fmulx		RPRIME(%a6),%fp0	| ...R'S(A1+...)
@@ -728,7 +728,7 @@
 SCBORS:
 	cmpil		#0x3FFF8000,%d0
 	bgt		REDUCEX
-        
+
 
 SCSM:
 	movew		#0x0000,XDCARE(%a6)
diff -Nru a/arch/m68k/fpsp040/ssinh.S b/arch/m68k/fpsp040/ssinh.S
--- a/arch/m68k/fpsp040/ssinh.S	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/fpsp040/ssinh.S	Tue Jun 15 22:20:42 2004
@@ -5,7 +5,7 @@
 |       an input argument; sSinhd does the same except for denormalized
 |       input.
 |
-|       Input: Double-extended number X in location pointed to 
+|       Input: Double-extended number X in location pointed to
 |		by address register a0.
 |
 |       Output: The value sinh(X) returned in floating-point register Fp0.
@@ -49,8 +49,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |SSINH	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -91,7 +91,7 @@
 	moveml	%a1/%d1,-(%sp)
 	fmovemx %fp0-%fp0,(%a0)
 	clrl	%d1
-	bsr	setoxm1	 	| ...FP0 IS Z = EXPM1(Y)
+	bsr	setoxm1		| ...FP0 IS Z = EXPM1(Y)
 	fmovel	#0,%fpcr
 	moveml	(%sp)+,%a1/%d1
 
diff -Nru a/arch/m68k/fpsp040/stan.S b/arch/m68k/fpsp040/stan.S
--- a/arch/m68k/fpsp040/stan.S	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/fpsp040/stan.S	Tue Jun 15 22:20:37 2004
@@ -50,8 +50,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |STAN	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -213,34 +213,34 @@
 	blt		NODD
 
 	fmovex		%fp0,%fp1
-	fmulx		%fp1,%fp1	 	| ...S = R*R
+	fmulx		%fp1,%fp1		| ...S = R*R
 
 	fmoved		TANQ4,%fp3
 	fmoved		TANP3,%fp2
 
-	fmulx		%fp1,%fp3	 	| ...SQ4
-	fmulx		%fp1,%fp2	 	| ...SP3
+	fmulx		%fp1,%fp3		| ...SQ4
+	fmulx		%fp1,%fp2		| ...SP3
 
 	faddd		TANQ3,%fp3	| ...Q3+SQ4
 	faddx		TANP2,%fp2	| ...P2+SP3
 
-	fmulx		%fp1,%fp3	 	| ...S(Q3+SQ4)
-	fmulx		%fp1,%fp2	 	| ...S(P2+SP3)
+	fmulx		%fp1,%fp3		| ...S(Q3+SQ4)
+	fmulx		%fp1,%fp2		| ...S(P2+SP3)
 
 	faddx		TANQ2,%fp3	| ...Q2+S(Q3+SQ4)
 	faddx		TANP1,%fp2	| ...P1+S(P2+SP3)
 
-	fmulx		%fp1,%fp3	 	| ...S(Q2+S(Q3+SQ4))
-	fmulx		%fp1,%fp2	 	| ...S(P1+S(P2+SP3))
+	fmulx		%fp1,%fp3		| ...S(Q2+S(Q3+SQ4))
+	fmulx		%fp1,%fp2		| ...S(P1+S(P2+SP3))
 
 	faddx		TANQ1,%fp3	| ...Q1+S(Q2+S(Q3+SQ4))
-	fmulx		%fp0,%fp2	 	| ...RS(P1+S(P2+SP3))
+	fmulx		%fp0,%fp2		| ...RS(P1+S(P2+SP3))
 
-	fmulx		%fp3,%fp1	 	| ...S(Q1+S(Q2+S(Q3+SQ4)))
-	
+	fmulx		%fp3,%fp1		| ...S(Q1+S(Q2+S(Q3+SQ4)))
+
+
+	faddx		%fp2,%fp0		| ...R+RS(P1+S(P2+SP3))
 
-	faddx		%fp2,%fp0	 	| ...R+RS(P1+S(P2+SP3))
-	
 
 	fadds		#0x3F800000,%fp1	| ...1+S(Q1+...)
 
@@ -251,40 +251,40 @@
 
 NODD:
 	fmovex		%fp0,%fp1
-	fmulx		%fp0,%fp0	 	| ...S = R*R
+	fmulx		%fp0,%fp0		| ...S = R*R
 
 	fmoved		TANQ4,%fp3
 	fmoved		TANP3,%fp2
 
-	fmulx		%fp0,%fp3	 	| ...SQ4
-	fmulx		%fp0,%fp2	 	| ...SP3
+	fmulx		%fp0,%fp3		| ...SQ4
+	fmulx		%fp0,%fp2		| ...SP3
 
 	faddd		TANQ3,%fp3	| ...Q3+SQ4
 	faddx		TANP2,%fp2	| ...P2+SP3
 
-	fmulx		%fp0,%fp3	 	| ...S(Q3+SQ4)
-	fmulx		%fp0,%fp2	 	| ...S(P2+SP3)
+	fmulx		%fp0,%fp3		| ...S(Q3+SQ4)
+	fmulx		%fp0,%fp2		| ...S(P2+SP3)
 
 	faddx		TANQ2,%fp3	| ...Q2+S(Q3+SQ4)
 	faddx		TANP1,%fp2	| ...P1+S(P2+SP3)
 
-	fmulx		%fp0,%fp3	 	| ...S(Q2+S(Q3+SQ4))
-	fmulx		%fp0,%fp2	 	| ...S(P1+S(P2+SP3))
+	fmulx		%fp0,%fp3		| ...S(Q2+S(Q3+SQ4))
+	fmulx		%fp0,%fp2		| ...S(P1+S(P2+SP3))
 
 	faddx		TANQ1,%fp3	| ...Q1+S(Q2+S(Q3+SQ4))
-	fmulx		%fp1,%fp2	 	| ...RS(P1+S(P2+SP3))
+	fmulx		%fp1,%fp2		| ...RS(P1+S(P2+SP3))
+
+	fmulx		%fp3,%fp0		| ...S(Q1+S(Q2+S(Q3+SQ4)))
 
-	fmulx		%fp3,%fp0	 	| ...S(Q1+S(Q2+S(Q3+SQ4)))
-	
 
-	faddx		%fp2,%fp1	 	| ...R+RS(P1+S(P2+SP3))
+	faddx		%fp2,%fp1		| ...R+RS(P1+S(P2+SP3))
 	fadds		#0x3F800000,%fp0	| ...1+S(Q1+...)
-	
+
 
 	fmovex		%fp1,-(%sp)
 	eoril		#0x80000000,(%sp)
 
-	fmovel		%d1,%fpcr	 	|restore users exceptions
+	fmovel		%d1,%fpcr		|restore users exceptions
 	fdivx		(%sp)+,%fp0	|last inst - possible exception set
 
 	bra		t_frcinx
@@ -397,7 +397,7 @@
         movew		%d2,FP_SCR2(%a6)
 	clrw           FP_SCR2+2(%a6)
 	movel		#0xC90FDAA2,FP_SCR2+4(%a6)
-	clrl		FP_SCR2+8(%a6)		| ...FP_SCR2 is  2**(L) * Piby2_1	
+	clrl		FP_SCR2+8(%a6)		| ...FP_SCR2 is  2**(L) * Piby2_1
 
 |--FP2 IS READY
 	fsubs		TWOTO63(%a6),%fp2		| ...FP2 is N
@@ -445,7 +445,7 @@
 	movel		(%a7)+,%d2
 	fmovemx	(%a7)+,%fp2-%fp5
 
-	
+
 	movel		N(%a6),%d0
         rorl		#1,%d0
 
diff -Nru a/arch/m68k/fpsp040/stanh.S b/arch/m68k/fpsp040/stanh.S
--- a/arch/m68k/fpsp040/stanh.S	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/fpsp040/stanh.S	Tue Jun 15 22:20:37 2004
@@ -49,14 +49,14 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |STANH	idnt	2,1 | Motorola 040 Floating Point Software Package
 
 	|section	8
-	
+
 #include "fpsp.h"
 
 	.set	X,FP_SCR5
@@ -106,7 +106,7 @@
 	movel		%d1,-(%a7)
 	clrl		%d1
 	fmovemx	%fp0-%fp0,(%a0)
-	bsr		setoxm1	 	| ...FP0 IS Z = EXPM1(Y)
+	bsr		setoxm1		| ...FP0 IS Z = EXPM1(Y)
 	movel		(%a7)+,%d1
 
 	fmovex		%fp0,%fp1
@@ -149,7 +149,7 @@
 
 	eorl		#0xC0000000,%d0	| ...-SIGN(X)*2
 	fmoves		%d0,%fp1		| ...-SIGN(X)*2 IN SGL FMT
-	fdivx		%fp0,%fp1	 	| ...-SIGN(X)2 / [EXP(Y)+1 ]
+	fdivx		%fp0,%fp1		| ...-SIGN(X)2 / [EXP(Y)+1 ]
 
 	movel		SGN(%a6),%d0
 	orl		#0x3F800000,%d0	| ...SGN
diff -Nru a/arch/m68k/fpsp040/sto_res.S b/arch/m68k/fpsp040/sto_res.S
--- a/arch/m68k/fpsp040/sto_res.S	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/fpsp040/sto_res.S	Tue Jun 15 22:20:44 2004
@@ -5,9 +5,9 @@
 |	Library functions return result in fp0.	If fp0 is not the
 |	users destination register then fp0 is moved to the
 |	correct floating-point destination register.  fp0 and fp1
-|	are then restored to the original contents. 
+|	are then restored to the original contents.
 |
-|	Input:	result in fp0,fp1 
+|	Input:	result in fp0,fp1
 |
 |		d2 & a0 should be kept unmodified
 |
@@ -19,8 +19,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 STO_RES:	|idnt	2,1 | Motorola 040 Floating Point Software Package
diff -Nru a/arch/m68k/fpsp040/stwotox.S b/arch/m68k/fpsp040/stwotox.S
--- a/arch/m68k/fpsp040/stwotox.S	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/fpsp040/stwotox.S	Tue Jun 15 22:20:39 2004
@@ -76,8 +76,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |STWOTOX	idnt	2,1 | Motorola 040 Floating Point Software Package
@@ -222,17 +222,17 @@
 	cmpil		#0x400D80C0,%d0		| ...|X| > 16480?
 	bles		TWOMAIN
 	bra		EXPBORS
-	
+
 
 TWOMAIN:
 |--USUAL CASE, 2^(-70) <= |X| <= 16480
 
 	fmovex		%fp0,%fp1
 	fmuls		#0x42800000,%fp1  | ...64 * X
-	
+
 	fmovel		%fp1,N(%a6)		| ...N = ROUND-TO-INT(64 X)
 	movel		%d2,-(%sp)
-	lea		EXPTBL,%a1 	| ...LOAD ADDRESS OF TABLE OF 2^(J/64)
+	lea		EXPTBL,%a1	| ...LOAD ADDRESS OF TABLE OF 2^(J/64)
 	fmovel		N(%a6),%fp1		| ...N --> FLOATING FMT
 	movel		N(%a6),%d0
 	movel		%d0,%d2
@@ -244,7 +244,7 @@
 	asrl		#1,%d0		| ...D0 IS M
 	subl		%d0,%d2		| ...d2 IS M', N = 64(M+M') + J
 	addil		#0x3FFF,%d2
-	movew		%d2,ADJFACT(%a6) 	| ...ADJFACT IS 2^(M')
+	movew		%d2,ADJFACT(%a6)	| ...ADJFACT IS 2^(M')
 	movel		(%sp)+,%d2
 |--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORTION OF 2^(J/64),
 |--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |M| <= 16140 BY DESIGN.
@@ -258,13 +258,13 @@
 	movew		(%a1)+,FACT2(%a6)
 	clrw		FACT2+2(%a6)
 
-	fsubx		%fp1,%fp0	 	| ...X - (1/64)*INT(64 X)
+	fsubx		%fp1,%fp0		| ...X - (1/64)*INT(64 X)
 
 	movew		(%a1)+,FACT2HI(%a6)
 	clrw		FACT2HI+2(%a6)
 	clrl		FACT2LOW(%a6)
 	addw		%d0,FACT1(%a6)
-	
+
 	fmulx		LOG2,%fp0	| ...FP0 IS R
 	addw		%d0,FACT2(%a6)
 
@@ -332,10 +332,10 @@
 
 	fmovex		%fp0,%fp1
 	fmuld		L2TEN64,%fp1	| ...X*64*LOG10/LOG2
-	
+
 	fmovel		%fp1,N(%a6)		| ...N=INT(X*64*LOG10/LOG2)
 	movel		%d2,-(%sp)
-	lea		EXPTBL,%a1 	| ...LOAD ADDRESS OF TABLE OF 2^(J/64)
+	lea		EXPTBL,%a1	| ...LOAD ADDRESS OF TABLE OF 2^(J/64)
 	fmovel		N(%a6),%fp1		| ...N --> FLOATING FMT
 	movel		N(%a6),%d0
 	movel		%d0,%d2
@@ -347,7 +347,7 @@
 	asrl		#1,%d0		| ...D0 IS M
 	subl		%d0,%d2		| ...d2 IS M', N = 64(M+M') + J
 	addil		#0x3FFF,%d2
-	movew		%d2,ADJFACT(%a6) 	| ...ADJFACT IS 2^(M')
+	movew		%d2,ADJFACT(%a6)	| ...ADJFACT IS 2^(M')
 	movel		(%sp)+,%d2
 
 |--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORTION OF 2^(J/64),
@@ -375,7 +375,7 @@
 	clrl		FACT2LOW(%a6)
 
 	fmulx		LOG10,%fp0	| ...FP0 IS R
-	
+
 	addw		%d0,FACT1(%a6)
 	addw		%d0,FACT2(%a6)
 
@@ -405,9 +405,9 @@
 
 	fmulx		%fp1,%fp2		| ...FP2 IS S*(A1+S*(A3+S*A5))
 	faddx		%fp3,%fp0		| ...FP0 IS R+R*S*(A2+S*A4)
-	
+
 	faddx		%fp2,%fp0		| ...FP0 IS EXP(R) - 1
-	
+
 
 |--FINAL RECONSTRUCTION PROCESS
 |--EXP(X) = 2^M*2^(J/64) + 2^M*2^(J/64)*(EXP(R)-1)  -  (1 OR 0)
diff -Nru a/arch/m68k/fpsp040/tbldo.S b/arch/m68k/fpsp040/tbldo.S
--- a/arch/m68k/fpsp040/tbldo.S	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/fpsp040/tbldo.S	Tue Jun 15 22:20:42 2004
@@ -6,19 +6,19 @@
 |			of indirection in do_func for monadic
 |			functions.  Dyadic functions require two
 |			levels, and the tables are still contained
-|			in do_func.  The table is arranged for 
+|			in do_func.  The table is arranged for
 |			index with a 10-bit index, with the first
 |			7 bits the opcode, and the remaining 3
 |			the stag.  For dyadic functions, all
 |			valid addresses are to the generic entry
-|			point. 
+|			point.
 |
 
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |TBLDO	idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -57,7 +57,7 @@
 	.long	smovcr		|$00-7 fmovecr all
 
 	.long	sint		|$01-0 fint norm
-	.long	szero		|$01-1 fint zero 
+	.long	szero		|$01-1 fint zero
 	.long	sinf		|$01-2 fint inf
 	.long	src_nan		|$01-3 fint nan
 	.long	sintd		|$01-4 fint denorm inx
diff -Nru a/arch/m68k/fpsp040/util.S b/arch/m68k/fpsp040/util.S
--- a/arch/m68k/fpsp040/util.S	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/fpsp040/util.S	Tue Jun 15 22:20:42 2004
@@ -4,20 +4,20 @@
 |	This file contains routines used by other programs.
 |
 |	ovf_res: used by overflow to force the correct
-|		 result. ovf_r_k, ovf_r_x2, ovf_r_x3 are 
+|		 result. ovf_r_k, ovf_r_x2, ovf_r_x3 are
 |		 derivatives of this routine.
 |	get_fline: get user's opcode word
 |	g_dfmtou: returns the destination format.
 |	g_opcls: returns the opclass of the float instruction.
-|	g_rndpr: returns the rounding precision. 
+|	g_rndpr: returns the rounding precision.
 |	reg_dest: write byte, word, or long data to Dn
 |
 |
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 |UTIL	idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -39,13 +39,13 @@
 | are unnecessary as ovf_res always returns the sign separately from
 | the exponent.
 |					;+inf
-EXT_PINF:	.long	0x7fff0000,0x00000000,0x00000000,0x00000000	
+EXT_PINF:	.long	0x7fff0000,0x00000000,0x00000000,0x00000000
 |					;largest +ext
-EXT_PLRG:	.long	0x7ffe0000,0xffffffff,0xffffffff,0x00000000	
+EXT_PLRG:	.long	0x7ffe0000,0xffffffff,0xffffffff,0x00000000
 |					;largest magnitude +sgl in ext
-SGL_PLRG:	.long	0x407e0000,0xffffff00,0x00000000,0x00000000	
+SGL_PLRG:	.long	0x407e0000,0xffffff00,0x00000000,0x00000000
 |					;largest magnitude +dbl in ext
-DBL_PLRG:	.long	0x43fe0000,0xffffffff,0xfffff800,0x00000000	
+DBL_PLRG:	.long	0x43fe0000,0xffffffff,0xfffff800,0x00000000
 |					;largest -ext
 
 tblovfl:
@@ -70,7 +70,7 @@
 |
 |	ovf_r_k --- overflow result calculation
 |
-| This entry point is used by kernel_ex.  
+| This entry point is used by kernel_ex.
 |
 | This forces the destination precision to be extended
 |
@@ -79,7 +79,7 @@
 |
 	.global	ovf_r_k
 ovf_r_k:
-	lea	ETEMP(%a6),%a0	|a0 points to source operand	
+	lea	ETEMP(%a6),%a0	|a0 points to source operand
 	bclrb	#sign_bit,ETEMP_EX(%a6)
 	sne	ETEMP_SGN(%a6)	|convert to internal IEEE format
 
@@ -112,10 +112,10 @@
 	beql	ovff_dbl		|force precision is double
 	movew	CMDREG3B(%a6),%d0		|get the command word again
 	andil	#0x7f,%d0			|clear all except operation
-	cmpil	#0x33,%d0			
+	cmpil	#0x33,%d0
 	beql	ovf_fsgl		|fsglmul or fsgldiv
 	cmpil	#0x30,%d0
-	beql	ovf_fsgl		
+	beql	ovf_fsgl
 	bra	ovf_fpcr		|instruction is none of the above
 |					;use FPCR
 ovf_e1_exc:
@@ -129,10 +129,10 @@
 	andil	#0x0000007f,%d0		|clear all except the op code
 	cmpil	#0x00000027,%d0
 	beql	ovf_fsgl		|fsglmul
-	cmpil 	#0x00000024,%d0
+	cmpil	#0x00000024,%d0
 	beql	ovf_fsgl		|fsgldiv
 	bra	ovf_fpcr		|none of the above, use FPCR
-| 
+|
 |
 | Inst is either fsgldiv or fsglmul.  Force extended precision.
 |
@@ -152,7 +152,7 @@
 ovf_fpcr:
 	bfextu	FPCR_MODE(%a6){#0:#2},%d0 |set round precision
 	bra	ovf_res
-	
+
 |
 |
 |	ovf_r_x3 --- overflow result calculation
@@ -174,9 +174,9 @@
 |	ovf_res --- overflow result calculation
 |
 | Input:
-|	a0 	points to operand in internal extended format
+|	a0	points to operand in internal extended format
 | Output:
-|	a0 	points to result in internal extended format
+|	a0	points to result in internal extended format
 |
 	.global	ovf_res
 ovf_res:
@@ -192,7 +192,7 @@
 EXT_RN:
 	leal	EXT_PINF,%a1	|answer is +/- infinity
 	bsetb	#inf_bit,FPSR_CC(%a6)
-	bra	set_sign	|now go set the sign	
+	bra	set_sign	|now go set the sign
 EXT_RZ:
 	leal	EXT_PLRG,%a1	|answer is +/- large number
 	bra	set_sign	|now go set the sign
@@ -312,10 +312,10 @@
 	movel	(%a7)+,%d0
 	rts
 |
-| 	g_rndpr --- put rounding precision in d0{1:0}
-|	
+|	g_rndpr --- put rounding precision in d0{1:0}
+|
 |	valid return codes are:
-|		00 - extended 
+|		00 - extended
 |		01 - single
 |		10 - double
 |
@@ -350,7 +350,7 @@
 | For move out instructions (opclass 011) the destination format
 | is the same as the rounding precision.  Pass results from g_dfmtou.
 |
-	bsr 	g_dfmtou	
+	bsr	g_dfmtou
 	rts
 op_0x0:
 	btstb	#E3,E_BYTE(%a6)
@@ -364,7 +364,7 @@
 	beql	unff_dbl
 	movew	CMDREG3B(%a6),%d0	|get the command word again
 	andil	#0x7f,%d0		|clear all except operation
-	cmpil	#0x33,%d0			
+	cmpil	#0x33,%d0
 	beql	unf_fsgl	|fsglmul or fsgldiv
 	cmpil	#0x30,%d0
 	beql	unf_fsgl	|fsgldiv or fsglmul
@@ -408,7 +408,7 @@
 | Force extended
 |
 unf_fsgl:
-	movel	#0,%d0		
+	movel	#0,%d0
 	rts
 |
 | Get rounding precision set in FPCR{7:6}.
@@ -436,7 +436,7 @@
 |	If E1, the format is from cmdreg1b{12:10}
 |	If E3, the format is extended.
 |
-|	Dest. Fmt.	
+|	Dest. Fmt.
 |		extended  010 -> 00
 |		single    001 -> 01
 |		double    101 -> 10
@@ -468,26 +468,26 @@
 | are unnecessary as unf_sub always returns the sign separately from
 | the exponent.
 |					;+zero
-EXT_PZRO:	.long	0x00000000,0x00000000,0x00000000,0x00000000	
+EXT_PZRO:	.long	0x00000000,0x00000000,0x00000000,0x00000000
 |					;+zero
-SGL_PZRO:	.long	0x3f810000,0x00000000,0x00000000,0x00000000	
+SGL_PZRO:	.long	0x3f810000,0x00000000,0x00000000,0x00000000
 |					;+zero
-DBL_PZRO:	.long	0x3c010000,0x00000000,0x00000000,0x00000000	
+DBL_PZRO:	.long	0x3c010000,0x00000000,0x00000000,0x00000000
 |					;smallest +ext denorm
-EXT_PSML:	.long	0x00000000,0x00000000,0x00000001,0x00000000	
+EXT_PSML:	.long	0x00000000,0x00000000,0x00000001,0x00000000
 |					;smallest +sgl denorm
-SGL_PSML:	.long	0x3f810000,0x00000100,0x00000000,0x00000000	
+SGL_PSML:	.long	0x3f810000,0x00000100,0x00000000,0x00000000
 |					;smallest +dbl denorm
-DBL_PSML:	.long	0x3c010000,0x00000000,0x00000800,0x00000000	
+DBL_PSML:	.long	0x3c010000,0x00000000,0x00000800,0x00000000
 |
 |	UNF_SUB --- underflow result calculation
 |
 | Input:
-|	d0 	contains round precision
+|	d0	contains round precision
 |	a0	points to input operand in the internal extended format
 |
 | Output:
-|	a0 	points to correct internal extended precision result.
+|	a0	points to correct internal extended precision result.
 |
 
 tblunf:
@@ -522,7 +522,7 @@
 uEXT_RN:
 	leal	EXT_PZRO,%a1	|answer is +/- zero
 	bsetb	#z_bit,FPSR_CC(%a6)
-	bra	uset_sign	|now go set the sign	
+	bra	uset_sign	|now go set the sign
 uEXT_RZ:
 	leal	EXT_PZRO,%a1	|answer is +/- zero
 	bsetb	#z_bit,FPSR_CC(%a6)
@@ -629,7 +629,7 @@
 |
 |
 | Input:
-|	L_SCR1: Data 
+|	L_SCR1: Data
 |	d1:     data size and dest register number formatted as:
 |
 |	32		5    4     3     2     1     0
diff -Nru a/arch/m68k/fpsp040/x_bsun.S b/arch/m68k/fpsp040/x_bsun.S
--- a/arch/m68k/fpsp040/x_bsun.S	Tue Jun 15 22:20:43 2004
+++ b/arch/m68k/fpsp040/x_bsun.S	Tue Jun 15 22:20:43 2004
@@ -13,8 +13,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_BSUN:	|idnt    2,1 | Motorola 040 Floating Point Software Package
diff -Nru a/arch/m68k/fpsp040/x_fline.S b/arch/m68k/fpsp040/x_fline.S
--- a/arch/m68k/fpsp040/x_fline.S	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/fpsp040/x_fline.S	Tue Jun 15 22:20:37 2004
@@ -13,8 +13,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_FLINE:	|idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -52,7 +52,7 @@
 	leal	L_SCR1(%a6),%a1	|use L_SCR1 as scratch
 	movel	#4,%d0
 	addl	#4,%a6		|to offset the sub.l #4,a7 above so that
-|				;a6 can point correctly to the stack frame 
+|				;a6 can point correctly to the stack frame
 |				;before branching to mem_read
 	bsrl	mem_read
 	subl	#4,%a6
@@ -62,7 +62,7 @@
 	bne	not_mvcr	|exit if not
 	bfextu	%d0{#16:#6},%d1
 	cmpib	#0x17,%d1		|check if it is an FMOVECR encoding
-	bne	not_mvcr	
+	bne	not_mvcr
 |				;if an FMOVECR instruction, fix stack
 |				;and go to FPSP_UNIMP
 fix_stack:
diff -Nru a/arch/m68k/fpsp040/x_operr.S b/arch/m68k/fpsp040/x_operr.S
--- a/arch/m68k/fpsp040/x_operr.S	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/fpsp040/x_operr.S	Tue Jun 15 22:20:41 2004
@@ -13,8 +13,8 @@
 | the dest format is integer (b, w, l) and the operr is caused by
 | integer overflow, or the source op is inf, then the result stored is
 | garbage.
-| There are three cases in which operr is incorrectly signaled on the 
-| 040.  This occurs for move_out of format b, w, or l for the largest 
+| There are three cases in which operr is incorrectly signaled on the
+| 040.  This occurs for move_out of format b, w, or l for the largest
 | negative integer (-2^7 for b, -2^15 for w, -2^31 for l).
 |
 |	  On opclass = 011 fmove.(b,w,l) that causes a conversion
@@ -36,15 +36,15 @@
 | Note 2: For trap enabled 040 does the following:
 | If the inst is move_out, then same as Note 1.
 | If the inst is not move_out, the dest is not modified.
-| The exceptional operand is not defined for integer overflow 
+| The exceptional operand is not defined for integer overflow
 | during a move_out.
 |
 
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_OPERR:	|idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -77,7 +77,7 @@
 	beqs	operr_end
 
 |
-| If the destination size is B,W,or L, the operr must be 
+| If the destination size is B,W,or L, the operr must be
 | handled here.
 |
 	movel	CMDREG1B(%a6),%d0
@@ -90,9 +90,9 @@
 	beq	operr_byte
 
 |
-| The size is not B,W,or L, so the operr is handled by the 
+| The size is not B,W,or L, so the operr is handled by the
 | kernel handler.  Set the operr bits and clean up, leaving
-| only the integer exception frame on the stack, and the 
+| only the integer exception frame on the stack, and the
 | fpu in the original exceptional state.
 |
 operr_end:
@@ -111,7 +111,7 @@
 	moveb	STAG(%a6),%d0	|test stag for nan
 	andib	#0xe0,%d0		|clr all but tag
 	cmpib	#0x60,%d0		|check for nan
-	beq	operr_nan	
+	beq	operr_nan
 	cmpil	#0x80000000,FPTEMP_LO(%a6) |test if ls lword is special
 	bnes	chklerr		|if not equal, check for incorrect operr
 	bsr	check_upper	|check if exp and ms mant are special
@@ -158,7 +158,7 @@
 	moveb	STAG(%a6),%d0	|test stag for nan
 	andib	#0xe0,%d0		|clr all but tag
 	cmpib	#0x60,%d0		|check for nan
-	beq	operr_nan	
+	beq	operr_nan
 	cmpil	#0xffff8000,FPTEMP_LO(%a6) |test if ls lword is special
 	bnes	chkwerr		|if not equal, check for incorrect operr
 	bsr	check_upper	|check if exp and ms mant are special
@@ -185,7 +185,7 @@
 	moveb	STAG(%a6),%d0	|test stag for nan
 	andib	#0xe0,%d0		|clr all but tag
 	cmpib	#0x60,%d0		|check for nan
-	beqs	operr_nan	
+	beqs	operr_nan
 	cmpil	#0xffffff80,FPTEMP_LO(%a6) |test if ls lword is special
 	bnes	chkberr		|if not equal, check for incorrect operr
 	bsr	check_upper	|check if exp and ms mant are special
@@ -229,7 +229,7 @@
 	bclrb	#inex2_bit,FPSR_EXCEPT(%a6)
 	bclrb	#ainex_bit,FPSR_AEXCEPT(%a6)
 	fmovel	#0,%FPSR
-	
+
 	tstw	FPTEMP_EX(%a6)	|check sign
 	blts	load_neg
 	movel	#0x7fffffff,%d0
@@ -280,7 +280,7 @@
 	bsrl	mem_write
 	rts
 |
-| Check the exponent for $c000 and the upper 32 bits of the 
+| Check the exponent for $c000 and the upper 32 bits of the
 | mantissa for $ffffffff.  If both are true, return d0 clr
 | and store the lower n bits of the least lword of FPTEMP
 | to d0 for write out.  If not, it is a real operr, and set d0.
diff -Nru a/arch/m68k/fpsp040/x_ovfl.S b/arch/m68k/fpsp040/x_ovfl.S
--- a/arch/m68k/fpsp040/x_ovfl.S	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/fpsp040/x_ovfl.S	Tue Jun 15 22:20:39 2004
@@ -8,7 +8,7 @@
 |	or when storing to memory, the contents of a floating-point
 |	data register are too large to be represented in the
 |	destination format.
-|		
+|
 | Trap disabled results
 |
 | If the instruction is move_out, then garbage is stored in the
@@ -35,8 +35,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_OVFL:	|idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -73,7 +73,7 @@
 |	if overflow traps not enabled check for inexact exception
 |
 	btstb	#ovfl_bit,FPCR_ENABLE(%a6)
-	beqs	ck_inex	
+	beqs	ck_inex
 |
 	btstb		#E3,E_BYTE(%a6)
 	beqs		no_e3_1
@@ -120,7 +120,7 @@
 	frestore	(%a7)+
 	unlk		%a6
 	bral		real_inex
-	
+
 ovfl_exit:
 	bclrb	#E3,E_BYTE(%a6)	|test and clear E3 bit
 	beqs	e1_set
@@ -152,7 +152,7 @@
 |
 ovf_adj:
 |
-| Have a0 point to the correct operand. 
+| Have a0 point to the correct operand.
 |
 	btstb	#E3,E_BYTE(%a6)	|test E3 bit
 	beqs	ovf_e1
@@ -175,10 +175,10 @@
 | CCs are defined to be 'not affected' for the opclass3 instruction.
 |
 	moveb	FPSR_CC(%a6),L_SCR1(%a6)
- 	bsrl	ovf_r_x3	|returns a0 pointing to result
+	bsrl	ovf_r_x3	|returns a0 pointing to result
 	moveb	L_SCR1(%a6),FPSR_CC(%a6)
 	bral	store		|stores to memory or register
-	
+
 not_opc011:
 	bsrl	ovf_r_x2	|returns a0 pointing to result
 	bral	store		|stores to memory or register
diff -Nru a/arch/m68k/fpsp040/x_snan.S b/arch/m68k/fpsp040/x_snan.S
--- a/arch/m68k/fpsp040/x_snan.S	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/fpsp040/x_snan.S	Tue Jun 15 22:21:05 2004
@@ -14,7 +14,7 @@
 | of the mantissa are sent to the integer unit).
 |
 | For trap enabled the 040 does the following:
-| If the inst is move_out, then the results are the same as for trap 
+| If the inst is move_out, then the results are the same as for trap
 | disabled with the exception posted.  If the instruction is not move_
 | out, the dest. is not modified, and the exception is posted.
 |
@@ -22,8 +22,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_SNAN:	|idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -139,7 +139,7 @@
 	bral		fpsp_done
 
 |
-| Move_out 
+| Move_out
 |
 move_out:
 	movel		EXC_EA(%a6),%a0	|get <ea> from exc frame
@@ -147,18 +147,18 @@
 	bfextu		CMDREG1B(%a6){#3:#3},%d0 |move rx field to d0{2:0}
 	cmpil		#0,%d0		|check for long
 	beqs		sto_long	|branch if move_out long
-	
+
 	cmpil		#4,%d0		|check for word
 	beqs		sto_word	|branch if move_out word
-	
+
 	cmpil		#6,%d0		|check for byte
 	beqs		sto_byte	|branch if move_out byte
-	
+
 |
 | Not byte, word or long
 |
 	rts
-|	
+|
 | Get the 32 most significant bits of etemp mantissa
 |
 sto_long:
@@ -167,13 +167,13 @@
 |
 | Set signalling nan bit
 |
-	bsetl		#30,%d1			
+	bsetl		#30,%d1
 |
 | Store to the users destination address
 |
 	tstl		%a0		|check if <ea> is 0
 	beqs		wrt_dn		|destination is a data register
-	
+
 	movel		%d1,-(%a7)	|move the snan onto the stack
 	movel		%a0,%a1		|load dest addr into a1
 	movel		%a7,%a0		|load src addr of snan into a0
@@ -189,7 +189,7 @@
 |
 | Set signalling nan bit
 |
-	bsetl		#30,%d1			
+	bsetl		#30,%d1
 |
 | Store to the users destination address
 |
@@ -211,7 +211,7 @@
 |
 | Set signalling nan bit
 |
-	bsetl		#30,%d1			
+	bsetl		#30,%d1
 |
 | Store to the users destination address
 |
@@ -253,7 +253,7 @@
 | Check if it is a src nan or dst nan
 |
 not_out:
-	movel		DTAG(%a6),%d0	
+	movel		DTAG(%a6),%d0
 	bfextu		%d0{#0:#3},%d0	|isolate dtag in lsbs
 
 	cmpib		#3,%d0		|check for nan in destination
diff -Nru a/arch/m68k/fpsp040/x_store.S b/arch/m68k/fpsp040/x_store.S
--- a/arch/m68k/fpsp040/x_store.S	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/fpsp040/x_store.S	Tue Jun 15 22:21:05 2004
@@ -11,8 +11,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_STORE:	|idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -54,7 +54,7 @@
 |	in the USER_FPn variable on the stack because all exception
 |	handlers restore fp0-fp3 from there.
 |
-	cmpb	#0x80,%d0		
+	cmpb	#0x80,%d0
 	bnes	not_fp0
 	fmovemx %fp0-%fp0,USER_FP0(%a6)
 	rts
@@ -115,18 +115,18 @@
 |	get rid of ext integer bit
 |	dbl_mant = ext_mant{62:12}
 |
-|	    	---------------   ---------------    ---------------
+|		---------------   ---------------    ---------------
 |  extended ->  |s|    exp    |   |1| ms mant   |    | ls mant     |
-|	    	---------------   ---------------    ---------------
-|	   	 95	    64    63 62	      32      31     11	  0
+|		---------------   ---------------    ---------------
+|		 95	    64    63 62	      32      31     11	  0
 |				     |			     |
 |				     |			     |
 |				     |			     |
-|		 	             v   		     v
-|	    		      ---------------   ---------------
-|  double   ->  	      |s|exp| mant  |   |  mant       |
-|	    		      ---------------   ---------------
-|	   	 	      63     51   32   31	       0
+|			             v			     v
+|			      ---------------   ---------------
+|  double   ->		      |s|exp| mant  |   |  mant       |
+|			      ---------------   ---------------
+|			      63     51   32   31	       0
 |
 dest_dbl:
 	clrl	%d0		|clear d0
@@ -137,7 +137,7 @@
 	addw	#0x3ff,%d0	|add double precision bias
 	swap	%d0		|d0 now in upper word
 	lsll	#4,%d0		|d0 now in proper place for dbl prec exp
-	tstb	LOCAL_SGN(%a1)	
+	tstb	LOCAL_SGN(%a1)
 	beqs	get_mant	|if positive, go process mantissa
 	bsetl	#31,%d0		|if negative, put in sign information
 |				; before continuing
@@ -186,18 +186,18 @@
 |	get rid of ext integer bit
 |	sgl_mant = ext_mant{62:12}
 |
-|	    	---------------   ---------------    ---------------
+|		---------------   ---------------    ---------------
 |  extended ->  |s|    exp    |   |1| ms mant   |    | ls mant     |
-|	    	---------------   ---------------    ---------------
-|	   	 95	    64    63 62	   40 32      31     12	  0
+|		---------------   ---------------    ---------------
+|		 95	    64    63 62	   40 32      31     12	  0
 |				     |	   |
 |				     |	   |
 |				     |	   |
-|		 	             v     v
-|	    		      ---------------
-|  single   ->  	      |s|exp| mant  |
-|	    		      ---------------
-|	   	 	      31     22     0
+|			             v     v
+|			      ---------------
+|  single   ->		      |s|exp| mant  |
+|			      ---------------
+|			      31     22     0
 |
 dest_sgl:
 	clrl	%d0
@@ -208,7 +208,7 @@
 	addw	#0x7f,%d0		|add single precision bias
 	swap	%d0		|put exp in upper word of d0
 	lsll	#7,%d0		|shift it into single exp bits
-	tstb	LOCAL_SGN(%a1)	
+	tstb	LOCAL_SGN(%a1)
 	beqs	get_sman	|if positive, continue
 	bsetl	#31,%d0		|if negative, put in sign first
 	bras	get_sman	|get mantissa
@@ -240,7 +240,7 @@
 	orl	#0x10,%d1		|reg_dest wants size added to reg#
 	bral	reg_dest	|size is X, rts in reg_dest will
 |				;return to caller of dest_sgl
-	
+
 dest_ext:
 	tstb	LOCAL_SGN(%a1)	|put back sign into exponent word
 	beqs	dstx_cont
diff -Nru a/arch/m68k/fpsp040/x_unfl.S b/arch/m68k/fpsp040/x_unfl.S
--- a/arch/m68k/fpsp040/x_unfl.S	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/fpsp040/x_unfl.S	Tue Jun 15 22:20:37 2004
@@ -4,25 +4,25 @@
 |	fpsp_unfl --- FPSP handler for underflow exception
 |
 | Trap disabled results
-|	For 881/2 compatibility, sw must denormalize the intermediate 
-| result, then store the result.  Denormalization is accomplished 
-| by taking the intermediate result (which is always normalized) and 
-| shifting the mantissa right while incrementing the exponent until 
-| it is equal to the denormalized exponent for the destination 
-| format.  After denormalization, the result is rounded to the 
+|	For 881/2 compatibility, sw must denormalize the intermediate
+| result, then store the result.  Denormalization is accomplished
+| by taking the intermediate result (which is always normalized) and
+| shifting the mantissa right while incrementing the exponent until
+| it is equal to the denormalized exponent for the destination
+| format.  After denormalization, the result is rounded to the
 | destination format.
-|		
+|
 | Trap enabled results
-| 	All trap disabled code applies.	In addition the exceptional 
-| operand needs to made available to the user with a bias of $6000 
+|	All trap disabled code applies.	In addition the exceptional
+| operand needs to made available to the user with a bias of $6000
 | added to the exponent.
 |
 
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_UNFL:	|idnt    2,1 | Motorola 040 Floating Point Software Package
@@ -91,7 +91,7 @@
 
 |
 | Inexact enabled and reported, and we must take an inexact exception
-|	
+|
 take_inex:
 	btstb		#E3,E_BYTE(%a6)
 	beqs		no_e3_2
@@ -145,7 +145,7 @@
 |					;1=sgl, 2=dbl
 |					;we need the RND_PREC in the
 |					;upper word for round
-	movew		#0,-(%a7)	
+	movew		#0,-(%a7)
 	movew		%d0,-(%a7)	|copy RND_PREC to stack
 |
 |
@@ -199,7 +199,7 @@
 | must not corrupt a0 and d0.
 |
 |
-| Perform Round	
+| Perform Round
 |	Input:		a0 points to input operand
 |			d0{31:29} has guard, round, sticky
 |			d1{01:00} has rounding mode
@@ -222,7 +222,7 @@
 	bsrl		g_dfmtou
 	tstb		%d0
 	beqs		ext_opc011	|If extended, do not subtract
-| 				;If destination format is sgl/dbl, 
+|				;If destination format is sgl/dbl,
 	tstb		LOCAL_HI(%a0)	|If rounded result is normal,don't
 |					;subtract
 	bmis		ext_opc011
@@ -252,12 +252,12 @@
 	bnes		ck_sgn
 	bsetb		#z_bit,FPSR_CC(%a6) |set condition codes if zero
 ck_sgn:
-	btstb 		#sign_bit,LOCAL_EX(%a0)	|check the sign bit
+	btstb		#sign_bit,LOCAL_EX(%a0)	|check the sign bit
 	beqs		unf_done
 	bsetb		#neg_bit,FPSR_CC(%a6)
 
 |
-| Finish.  
+| Finish.
 |
 unf_done:
 	btstb		#inex2_bit,FPSR_EXCEPT(%a6)
diff -Nru a/arch/m68k/fpsp040/x_unimp.S b/arch/m68k/fpsp040/x_unimp.S
--- a/arch/m68k/fpsp040/x_unimp.S	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/fpsp040/x_unimp.S	Tue Jun 15 22:20:44 2004
@@ -1,14 +1,14 @@
 |
 |	x_unimp.sa 3.3 7/1/91
 |
-|	fpsp_unimp --- FPSP handler for unimplemented instruction	
+|	fpsp_unimp --- FPSP handler for unimplemented instruction
 |	exception.
 |
 | Invoked when the user program encounters a floating-point
 | op-code that hardware does not support.  Trap vector# 11
 | (See table 8-1 MC68030 User's Manual).
 |
-| 
+|
 | Note: An fsave for an unimplemented inst. will create a short
 | fsave stack.
 |
@@ -22,8 +22,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_UNIMP:	|idnt    2,1 | Motorola 040 Floating Point Software Package
diff -Nru a/arch/m68k/fpsp040/x_unsupp.S b/arch/m68k/fpsp040/x_unsupp.S
--- a/arch/m68k/fpsp040/x_unsupp.S	Tue Jun 15 22:21:02 2004
+++ b/arch/m68k/fpsp040/x_unsupp.S	Tue Jun 15 22:21:02 2004
@@ -3,18 +3,18 @@
 |
 |	fpsp_unsupp --- FPSP handler for unsupported data type exception
 |
-| Trap vector #55	(See table 8-1 Mc68030 User's manual).	
+| Trap vector #55	(See table 8-1 Mc68030 User's manual).
 | Invoked when the user program encounters a data format (packed) that
 | hardware does not support or a data type (denormalized numbers or un-
 | normalized numbers).
-| Normalizes denorms and unnorms, unpacks packed numbers then stores 
-| them back into the machine to let the 040 finish the operation.  
+| Normalizes denorms and unnorms, unpacks packed numbers then stores
+| them back into the machine to let the 040 finish the operation.
 |
 | Unsupp calls two routines:
-| 	1. get_op -  gets the operand(s)
-| 	2. res_func - restore the function back into the 040 or
-| 			if fmove.p fpm,<ea> then pack source (fpm)
-| 			and store in users memory <ea>.
+|	1. get_op -  gets the operand(s)
+|	2. res_func - restore the function back into the 040 or
+|			if fmove.p fpm,<ea> then pack source (fpm)
+|			and store in users memory <ea>.
 |
 |  Input: Long fsave stack frame
 |
@@ -23,8 +23,8 @@
 |		Copyright (C) Motorola, Inc. 1990
 |			All Rights Reserved
 |
-|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
-|	The copyright notice above does not evidence any  
+|	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
+|	The copyright notice above does not evidence any
 |	actual or intended publication of such source code.
 
 X_UNSUPP:	|idnt    2,1 | Motorola 040 Floating Point Software Package
diff -Nru a/arch/m68k/hp300/hp300map.map b/arch/m68k/hp300/hp300map.map
--- a/arch/m68k/hp300/hp300map.map	Tue Jun 15 22:20:58 2004
+++ b/arch/m68k/hp300/hp300map.map	Tue Jun 15 22:20:58 2004
@@ -3,29 +3,29 @@
 # Change the above line into
 #	keymaps 0-2,4-6,8,12
 # in case you want the entries
-#	altgr   control keycode  83 = Boot            
-#	altgr   control keycode 111 = Boot            
+#	altgr   control keycode  83 = Boot
+#	altgr   control keycode 111 = Boot
 # below.
 #
 # In fact AltGr is used very little, and one more keymap can
 # be saved by mapping AltGr to Alt (and adapting a few entries):
 # keycode 100 = Alt
 #
-keycode   1 = 
+keycode   1 =
 keycode   2 = Alt
 keycode   3 = Alt
 keycode   4 = Shift
 keycode   5 = Shift
 keycode   6 = Control
-keycode   7 = 
-keycode   8 = 
-keycode   9 = 
-keycode  10 = 
-keycode  11 = 
-keycode  12 = 
-keycode  13 = 
+keycode   7 =
+keycode   8 =
+keycode   9 =
+keycode  10 =
+keycode  11 =
+keycode  12 =
+keycode  13 =
 keycode  14 =
-keycode  15 = 
+keycode  15 =
 keycode  16 =
 keycode  17 =
 keycode  18 =
@@ -34,12 +34,12 @@
 keycode  21 =
 keycode  22 =
 keycode  23 =
-keycode  24 = b               
-keycode  25 = v               
+keycode  24 = b
+keycode  25 = v
 keycode  26 = c
 keycode  27 = x
 keycode  28 = z
-keycode  29 = 
+keycode  29 =
 keycode  30 =
 keycode  31 = Escape		Delete
 keycode  32 =
@@ -55,7 +55,7 @@
 keycode  42 = f
 keycode  43 = d
 keycode  44 = s
-keycode  45 = a               
+keycode  45 = a
 keycode  46 =
 keycode  47 = Caps_Lock
 keycode  48 = u
@@ -65,8 +65,8 @@
 keycode  52 = e
 keycode  53 = w
 keycode  54 = q
-keycode  55 = Tab		Tab             
-	alt     keycode    55 = Meta_Tab        
+keycode  55 = Tab		Tab
+	alt     keycode    55 = Meta_Tab
 keycode  56 = seven		ampersand
 keycode  57 = six		asciicircum
 keycode  58 = five		percent
@@ -74,19 +74,19 @@
 keycode  60 = three		numbersign
 keycode  61 = two		at		at
 keycode  62 = one		exclam		exclam
-keycode  63 = grave		asciitilde      
-	control keycode    63 = nul             
-	alt     keycode    63 = Meta_grave      
-keycode  64 =        
-keycode  65 = 
-keycode  66 = 
-keycode  67 = 
-keycode  68 = 
-keycode  69 = 
-keycode  70 = 
-keycode  71 = 
+keycode  63 = grave		asciitilde
+	control keycode    63 = nul
+	alt     keycode    63 = Meta_grave
+keycode  64 =
+keycode  65 =
+keycode  66 =
+keycode  67 =
+keycode  68 =
+keycode  69 =
+keycode  70 =
+keycode  71 =
 keycode  72 =
-keycode  73 = F4       
+keycode  73 = F4
 	control keycode	   73 = Console_4
 keycode  74 = F3
 	control keycode	   74 = Console_3
@@ -107,8 +107,8 @@
 keycode  84 = F8
 	control keycode	   84 = Console_8
 keycode  85 =
-keycode  86 = 
-keycode  87 = 
+keycode  86 =
+keycode  87 =
 keycode  88 = eight		asterisk	asterisk
 keycode  89 = nine		parenleft	bracketleft
 keycode  90 = zero		parenright	bracketright
@@ -122,30 +122,30 @@
 keycode  98 = p
 keycode  99 = bracketleft	braceleft
 keycode 100 = bracketright	braceright
-keycode 101 = backslash		bar             
+keycode 101 = backslash		bar
 	control keycode   101 = Control_backslash
-	alt     keycode   101 = Meta_backslash  
-keycode 102 = 
-keycode 103 = 
+	alt     keycode   101 = Meta_backslash
+keycode 102 =
+keycode 103 =
 keycode 104 = j
 keycode 105 = k
 keycode 106 = l
 keycode 107 = semicolon		colon
-	alt     keycode   107 = Meta_semicolon  
-keycode 108 = apostrophe	quotedbl        
-	control keycode   108 = Control_g       
-	alt     keycode   108 = Meta_apostrophe 
+	alt     keycode   107 = Meta_semicolon
+keycode 108 = apostrophe	quotedbl
+	control keycode   108 = Control_g
+	alt     keycode   108 = Meta_apostrophe
 keycode 109 = Return
-keycode 110 = 
-keycode 111 = 
+keycode 110 =
+keycode 111 =
 keycode 112 = m
 keycode 113 = comma		less
 keycode 114 = period		greater
 keycode 115 = slash		question
-keycode 116 = 
-keycode 117 = 
-keycode 118 = 
-keycode 119 = 
+keycode 116 =
+keycode 117 =
+keycode 118 =
+keycode 119 =
 keycode 120 = n
 keycode 121 = space		space
 keycode 122 =
diff -Nru a/arch/m68k/hp300/ints.c b/arch/m68k/hp300/ints.c
--- a/arch/m68k/hp300/ints.c	Tue Jun 15 22:20:43 2004
+++ b/arch/m68k/hp300/ints.c	Tue Jun 15 22:20:43 2004
@@ -29,7 +29,7 @@
  * Service routines are added via hp300_request_irq() and removed
  * via hp300_free_irq(). The device driver should set IRQ_FLG_FAST
  * if it needs to be serviced early (eg FIFOless UARTs); this will
- * cause it to be added at the front of the queue rather than 
+ * cause it to be added at the front of the queue rather than
  * the back.
  * Currently IRQ_FLG_SLOW and flags=0 are treated identically; if
  * we needed three levels of priority we could distinguish them
@@ -52,7 +52,7 @@
                 t->handler(irq, t->dev_id, fp);
         /* We could put in some accounting routines, checks for stray interrupts,
          * etc, in here. Note that currently we can't tell whether or not
-         * a handler handles the interrupt, though. 
+         * a handler handles the interrupt, though.
          */
 	return IRQ_HANDLED;
 }
@@ -80,7 +80,7 @@
                       unsigned long flags, const char *devname, void *dev_id)
 {
         irq_node_t *t, *n = new_irq_node();
-        
+
         if (!n)                                   /* oops, no free nodes */
                 return -ENOMEM;
 
@@ -117,7 +117,7 @@
         unsigned long flags;
 
         spin_lock_irqsave(&irqlist_lock, flags);
-        
+
         t = hp300_irq_list[irq];
         if (!t)                                   /* no handlers at all for that IRQ */
         {
@@ -125,7 +125,7 @@
                 spin_unlock_irqrestore(&irqlist_lock, flags);
 		return;
         }
-        
+
         if (t->dev_id == dev_id)
         {                                         /* removing first handler on chain */
                 t->flags = IRQ_FLG_STD;           /* we probably don't really need these */
@@ -136,9 +136,9 @@
 		spin_unlock_irqrestore(&irqlist_lock, flags);
 		return;
         }
-        
+
         /* OK, must be removing from middle of the chain */
-        
+
         for (t = hp300_irq_list[irq]; t->next && t->next->dev_id != dev_id; t = t->next)
                 /* do nothing */;
         if (!t->next)
@@ -153,7 +153,7 @@
 	t->next->devname = NULL;
 	t->next->handler = NULL;
         t->next = t->next->next;
-        
+
 	spin_unlock_irqrestore(&irqlist_lock, flags);
 }
 
diff -Nru a/arch/m68k/ifpsp060/CHANGES b/arch/m68k/ifpsp060/CHANGES
--- a/arch/m68k/ifpsp060/CHANGES	Tue Jun 15 22:21:03 2004
+++ b/arch/m68k/ifpsp060/CHANGES	Tue Jun 15 22:21:03 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -31,7 +31,7 @@
 ---------------------------
 
 1) "movep" emulation where data was being read from memory
-was reading the intermediate bytes. Emulation now only 
+was reading the intermediate bytes. Emulation now only
 reads the required bytes.
 
 2) "flogn", "flog2", and "flog10" of "1" was setting the
@@ -57,7 +57,7 @@
 	For example, if a user executed "fsin.x ADDR,fp0" where
 	ADDR should cause a "segmentation violation", the memory read
 	requested by the package should return a failing value
-	to the package. Since the package currently ignores this 
+	to the package. Since the package currently ignores this
 	return value, the user program will continue to the
 	next instruction, and the result created in fp0 will be
 	undefined.
@@ -76,16 +76,16 @@
 	as described in the MC68060 User's Manual.
 
 	For instruction read access errors, the info stacked is:
-		SR 	= SR at time of exception
-		PC 	= PC of instruction being emulated
+		SR	= SR at time of exception
+		PC	= PC of instruction being emulated
 		VOFF	= $4008 (stack frame format type)
 		ADDRESS	= PC of instruction being emulated
 		FSLW	= FAULT STATUS LONGWORD
 
 	The valid FSLW bits are:
-		bit 27 		= 1	(misaligned bit)
-		bit 24 		= 1	(read)
-		bit 23 		= 0	(write)
+		bit 27		= 1	(misaligned bit)
+		bit 24		= 1	(read)
+		bit 23		= 0	(write)
 		bit 22:21	= 10	(SIZE = word)
 		bit 20:19	= 00	(TT)
 		bit 18:16	= x10	(TM; x = 1 for supervisor mode)
@@ -98,15 +98,15 @@
 	other bits.
 
 	For data read/write access errors, the info stacked is:
-		SR 	= SR at time of exception
-		PC 	= PC of instruction being emulated
+		SR	= SR at time of exception
+		PC	= PC of instruction being emulated
 		VOFF	= $4008 (stack frame format type)
 		ADDRESS	= Address of source or destination operand
 		FSLW	= FAULT STATUS LONGWORD
 
 	The valid FSLW bits are:
-		bit 27 		= 0	(misaligned bit)
-		bit 24 		= x	(read; 1 if read, 0 if write)
+		bit 27		= 0	(misaligned bit)
+		bit 24		= x	(read; 1 if read, 0 if write)
 		bit 23		= x	(write; 1 if write, 0 if read)
 		bit 22:21	= xx	(SIZE; see MC68060 User's Manual)
 		bit 20:19	= 00	(TT)
diff -Nru a/arch/m68k/ifpsp060/MISC b/arch/m68k/ifpsp060/MISC
--- a/arch/m68k/ifpsp060/MISC	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/ifpsp060/MISC	Tue Jun 15 22:20:38 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -176,7 +176,7 @@
 imovep.s    : 2.8
 ichk2cmp2.s : 2.6
 idiv64.s    : 2.10
-imul64.s    : 
+imul64.s    :
 icas2.s     : 2.11
 icas.s      : 2.12
 icas2_core.s: 2.6
diff -Nru a/arch/m68k/ifpsp060/README b/arch/m68k/ifpsp060/README
--- a/arch/m68k/ifpsp060/README	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/ifpsp060/README	Tue Jun 15 22:20:41 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
diff -Nru a/arch/m68k/ifpsp060/TEST.DOC b/arch/m68k/ifpsp060/TEST.DOC
--- a/arch/m68k/ifpsp060/TEST.DOC	Tue Jun 15 22:21:02 2004
+++ b/arch/m68k/ifpsp060/TEST.DOC	Tue Jun 15 22:21:02 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -56,7 +56,7 @@
 -----------------------
 
 (top of module)
-	----------------- 
+	-----------------
 	|		| - 128 byte-sized section
    (1)  |   Call-Out	| - 4 bytes per entry (user fills these in)
 	|		|
@@ -74,8 +74,8 @@
 The first section of this module is the "Call-out" section. This section
 is NOT INCLUDED in {i,f}test.sa (an example "Call-out" section is provided at
 the end of this file). The purpose of this section is to allow the test
-routines to reference external printing functions that must be provided 
-by the host operating system. This section MUST be exactly 128 bytes in 
+routines to reference external printing functions that must be provided
+by the host operating system. This section MUST be exactly 128 bytes in
 size. There are 32 fields, each 4 bytes in size. Each field corresponds
 to a function required by the test packages (these functions and their
 location are listed in "68060{ISP,FPSP}-TEST call-outs" below). Each field
@@ -152,7 +152,7 @@
 		    (2) unsupported data type exceptions
 		    (3) non-maskable overflow/underflow exceptions
 
-FP unimplemented: tests FP unimplemented exception. this one is 
+FP unimplemented: tests FP unimplemented exception. this one is
 		  separate from the previous tests for systems that don't
 		  want FP unimplemented instructions.
 
@@ -194,7 +194,7 @@
 # beginning of "Call-out" section; provided by integrator.
 # MUST be 128 bytes long.
 _060FPSP_TEST:
-	long	_print_str - _060FPSP_TEST	
+	long	_print_str - _060FPSP_TEST
 	long	_print_num - _060FPSP_TEST
 	space	120
 
diff -Nru a/arch/m68k/ifpsp060/fplsp.doc b/arch/m68k/ifpsp060/fplsp.doc
--- a/arch/m68k/ifpsp060/fplsp.doc	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/ifpsp060/fplsp.doc	Tue Jun 15 22:20:36 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -34,7 +34,7 @@
 68060SP Floating-Point Software Package. The routines
 included in this module can be used to emulate the
 FP instructions not implemented in 68060 hardware. These
-instructions normally take exception vector #11 
+instructions normally take exception vector #11
 "FP Unimplemented Instruction".
 
 By re-compiling a program that uses these instructions, and
diff -Nru a/arch/m68k/ifpsp060/fpsp.doc b/arch/m68k/ifpsp060/fpsp.doc
--- a/arch/m68k/ifpsp060/fpsp.doc	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/ifpsp060/fpsp.doc	Tue Jun 15 22:20:37 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -31,7 +31,7 @@
 
 The file fpsp.sa contains the 68060 Floating-Point Software
 Package. This package is essentially a set of exception handlers
-that can be integrated into an operating system. 
+that can be integrated into an operating system.
 These exception handlers emulate Unimplemented FP instructions,
 instructions using unimplemented data types, and instructions
 using unimplemented addressing modes. In addition, this package
@@ -62,14 +62,14 @@
 -----------------------
 
 (top of module)
-	----------------- 
+	-----------------
 	|		| - 128 byte-sized section
    (1)  |   Call-Out	| - 4 bytes per entry (user fills these in)
 	|		| - example routines in fskeleton.s
 	-----------------
 	|		| - 8 bytes per entry
    (2)  | Entry Point	| - user does "bra" or "jmp" to this address
-	|		| 
+	|		|
 	-----------------
 	|		| - code section
    (3)  ~		~
@@ -79,14 +79,14 @@
 
 The first section of this module is the "Call-out" section. This section
 is NOT INCLUDED in fpsp.sa (an example "Call-out" section is provided at
-the end of the file fskeleton.s). The purpose of this section is to allow 
-the FPSP routines to reference external functions that must be provided 
-by the host operating system. This section MUST be exactly 128 bytes in 
+the end of the file fskeleton.s). The purpose of this section is to allow
+the FPSP routines to reference external functions that must be provided
+by the host operating system. This section MUST be exactly 128 bytes in
 size. There are 32 fields, each 4 bytes in size. Each field corresponds
 to a function required by the FPSP (these functions and their location are
 listed in "68060FPSP call-outs" below). Each field entry should contain
 the address of the corresponding function RELATIVE to the starting address
-of the "call-out" section. The "Call-out" section must sit adjacent to the 
+of the "call-out" section. The "Call-out" section must sit adjacent to the
 fpsp.sa image in memory.
 
 The second section, the "Entry-point" section, is used by external routines
@@ -97,7 +97,7 @@
 would simply execute a "bra" or "jmp" that jumped to the selected function
 entry-point.
 
-For example, if the 68060 hardware took a "Line-F Emulator" exception 
+For example, if the 68060 hardware took a "Line-F Emulator" exception
 (vector #11), the operating system should execute something similar to:
 
 	bra	_060FPSP_TOP+128+48
diff -Nru a/arch/m68k/ifpsp060/fskeleton.S b/arch/m68k/ifpsp060/fskeleton.S
--- a/arch/m68k/ifpsp060/fskeleton.S	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/ifpsp060/fskeleton.S	Tue Jun 15 22:20:39 2004
@@ -5,10 +5,10 @@
 |Production Release P1.00 -- October 10, 1994
 |
 |M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
-| 
+|
 |THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 |To the maximum extent permitted by applicable law,
-|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 |INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 |and any warranty against infringement with regard to the SOFTWARE
 |(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -68,7 +68,7 @@
 | _060_real_ovfl():
 |
 | This is the exit point for the 060FPSP when an enabled overflow exception
-| is present. The routine below should point to the operating system handler 
+| is present. The routine below should point to the operating system handler
 | for enabled overflow conditions. The exception stack frame is an overflow
 | stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
 |
@@ -87,7 +87,7 @@
 | _060_real_unfl():
 |
 | This is the exit point for the 060FPSP when an enabled underflow exception
-| is present. The routine below should point to the operating system handler 
+| is present. The routine below should point to the operating system handler
 | for enabled underflow conditions. The exception stack frame is an underflow
 | stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
 |
@@ -105,7 +105,7 @@
 | _060_real_operr():
 |
 | This is the exit point for the 060FPSP when an enabled operand error exception
-| is present. The routine below should point to the operating system handler 
+| is present. The routine below should point to the operating system handler
 | for enabled operand error exceptions. The exception stack frame is an operand error
 | stack frame. The FP state frame holds the source operand of the faulting
 | instruction.
@@ -124,7 +124,7 @@
 | _060_real_snan():
 |
 | This is the exit point for the 060FPSP when an enabled signalling NaN exception
-| is present. The routine below should point to the operating system handler 
+| is present. The routine below should point to the operating system handler
 | for enabled signalling NaN exceptions. The exception stack frame is a signalling NaN
 | stack frame. The FP state frame holds the source operand of the faulting
 | instruction.
@@ -143,7 +143,7 @@
 | _060_real_dz():
 |
 | This is the exit point for the 060FPSP when an enabled divide-by-zero exception
-| is present. The routine below should point to the operating system handler 
+| is present. The routine below should point to the operating system handler
 | for enabled divide-by-zero exceptions. The exception stack frame is a divide-by-zero
 | stack frame. The FP state frame holds the source operand of the faulting
 | instruction.
@@ -162,7 +162,7 @@
 | _060_real_inex():
 |
 | This is the exit point for the 060FPSP when an enabled inexact exception
-| is present. The routine below should point to the operating system handler 
+| is present. The routine below should point to the operating system handler
 | for enabled inexact exceptions. The exception stack frame is an inexact
 | stack frame. The FP state frame holds the source operand of the faulting
 | instruction.
@@ -181,12 +181,12 @@
 | _060_real_bsun():
 |
 | This is the exit point for the 060FPSP when an enabled bsun exception
-| is present. The routine below should point to the operating system handler 
+| is present. The routine below should point to the operating system handler
 | for enabled bsun exceptions. The exception stack frame is a bsun
 | stack frame.
 |
 | The sample routine below clears the exception status bit, clears the NaN
-| bit in the FPSR, and does an "rte". The instruction that caused the 
+| bit in the FPSR, and does an "rte". The instruction that caused the
 | bsun will now be re-executed but with the NaN FPSR bit cleared.
 |
 	.global		_060_real_bsun
@@ -202,13 +202,13 @@
 |
 | _060_real_fline():
 |
-| This is the exit point for the 060FPSP when an F-Line Illegal exception is 
+| This is the exit point for the 060FPSP when an F-Line Illegal exception is
 | encountered. Three different types of exceptions can enter the F-Line exception
 | vector number 11: FP Unimplemented Instructions, FP implemented instructions when
 | the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
 | _fpsp_fline() distinguishes between the three and acts appropriately. F-Line
 | Illegals branch here.
-| 
+|
 	.global		_060_real_fline
 _060_real_fline:
 	bral		trap	| jump to trap handler
@@ -216,7 +216,7 @@
 |
 | _060_real_fpu_disabled():
 |
-| This is the exit point for the 060FPSP when an FPU disabled exception is 
+| This is the exit point for the 060FPSP when an FPU disabled exception is
 | encountered. Three different types of exceptions can enter the F-Line exception
 | vector number 11: FP Unimplemented Instructions, FP implemented instructions when
 | the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
diff -Nru a/arch/m68k/ifpsp060/ilsp.doc b/arch/m68k/ifpsp060/ilsp.doc
--- a/arch/m68k/ifpsp060/ilsp.doc	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/ifpsp060/ilsp.doc	Tue Jun 15 22:20:37 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -32,11 +32,11 @@
 The file ilsp.s contains the "Library version" of the
 68060 Integer Software Package. Routines included in this
 module can be used to emulate 64-bit divide and multiply,
-and the "cmp2" instruction. These instructions are not 
-implemented in hardware on the 68060 and normally take 
+and the "cmp2" instruction. These instructions are not
+implemented in hardware on the 68060 and normally take
 exception vector #61 "Unimplemented Integer Instruction".
 
-By re-compiling a program that uses these instructions, and 
+By re-compiling a program that uses these instructions, and
 making subroutine calls in place of the unimplemented
 instructions, a program can avoid the overhead associated with
 taking the exception.
@@ -63,7 +63,7 @@
 
 Release file structure:
 -----------------------
-The file ilsp.sa contains an "Entry-Point" section and a 
+The file ilsp.sa contains an "Entry-Point" section and a
 code section. The ILSP has no "Call-Out" section. The first section
 is the "Entry-Point" section. In order to access a function in the
 package, a program must "bsr" or "jsr" to the location listed
@@ -77,7 +77,7 @@
 
 For example, to use a 64-bit multiply instruction,
 do a "bsr" or "jsr" to the entry point defined by
-the 060ILSP entry table. A compiler generated code sequence 
+the 060ILSP entry table. A compiler generated code sequence
 for unsigned multiply could look like:
 
 # mulu.l <ea>,Dh:Dl
@@ -107,7 +107,7 @@
 	mov.l	(%sp)+,%d1	# load remainder
 	mov.l	(%sp)+,%d0	# load quotient
 
-The library routines also return the correct condition code 
+The library routines also return the correct condition code
 register value. If this is important, then the caller of the library
 routine must make sure that the value isn't lost while popping
 other items off of the stack.
diff -Nru a/arch/m68k/ifpsp060/iskeleton.S b/arch/m68k/ifpsp060/iskeleton.S
--- a/arch/m68k/ifpsp060/iskeleton.S	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/ifpsp060/iskeleton.S	Tue Jun 15 22:20:36 2004
@@ -5,10 +5,10 @@
 |Production Release P1.00 -- October 10, 1994
 |
 |M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
-| 
+|
 |THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 |To the maximum extent permitted by applicable law,
-|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 |INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 |and any warranty against infringement with regard to the SOFTWARE
 |(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -40,7 +40,7 @@
 
 
 |################################
-| (1) EXAMPLE CALL-OUTS 	#
+| (1) EXAMPLE CALL-OUTS		#
 |				#
 | _060_isp_done()		#
 | _060_real_chk()		#
@@ -56,7 +56,7 @@
 | _060_isp_done():
 |
 | This is and example main exit point for the Unimplemented Integer
-| Instruction exception handler. For a normal exit, the 
+| Instruction exception handler. For a normal exit, the
 | _isp_unimp() branches to here so that the operating system
 | can do any clean-up desired. The stack frame is the
 | Unimplemented Integer Instruction stack frame with
@@ -118,9 +118,9 @@
 |
 | _060_real_divbyzero:
 |
-| This is an alternate exit point for the Unimplemented Integer 
+| This is an alternate exit point for the Unimplemented Integer
 | Instruction exception handler isp_unimp(). If the instruction is a 64-bit
-| integer divide where the source operand is a zero, then the _isp_unimp() 
+| integer divide where the source operand is a zero, then the _isp_unimp()
 | creates a Divide-by-zero exception stack frame from the Unimplemented
 | Integer Instruction stack frame and branches to this routine.
 |
@@ -128,7 +128,7 @@
 | no action associated with the "chk" exception. If tracing is enabled,
 | then it create a Trace exception stack frame from the "chk" exception
 | stack frame and branches to the _real_trace() entry point.
-| 
+|
 | Linux/68k: commented out test for tracing
 
 	.global		_060_real_divbyzero
@@ -185,7 +185,7 @@
 | Entry point for the operating system`s routine to "lock" a page
 | from being paged out. This routine is needed by the cas/cas2
 | algorithms so that no page faults occur within the "core" code
-| region. Note: the routine must lock two pages if the operand 
+| region. Note: the routine must lock two pages if the operand
 | spans two pages.
 | NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
 | SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
@@ -212,7 +212,7 @@
 | Note: the routine must unlock two pages if the operand spans
 | two pages.
 | Arguments:
-| 	a0 = operand address
+|	a0 = operand address
 |	d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
 |	d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
 |
diff -Nru a/arch/m68k/ifpsp060/isp.doc b/arch/m68k/ifpsp060/isp.doc
--- a/arch/m68k/ifpsp060/isp.doc	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/ifpsp060/isp.doc	Tue Jun 15 22:20:41 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -77,7 +77,7 @@
 	-----------------
 	|		| - 8 bytes per entry
    (2)  | Entry Point   | - user does a "bra" or "jmp" to this address
-	|               | 
+	|               |
 	-----------------
 	|		| - code section
    (3)  ~		~
@@ -87,14 +87,14 @@
 
 The first section of this module is the "Call-out" section. This section
 is NOT INCLUDED in isp.sa (an example "Call-out" section is provided at
-the end of the file iskeleton.s). The purpose of this section is to allow 
-the ISP routines to reference external functions that must be provided 
-by the host operating system. This section MUST be exactly 128 bytes in 
+the end of the file iskeleton.s). The purpose of this section is to allow
+the ISP routines to reference external functions that must be provided
+by the host operating system. This section MUST be exactly 128 bytes in
 size. There are 32 fields, each 4 bytes in size. Each field corresponds
 to a function required by the ISP (these functions and their location are
 listed in "68060ISP call-outs" below). Each field entry should contain
 the address of the corresponding function RELATIVE to the starting address
-of the "call-out" section. The "Call-out" section must sit adjacent to the 
+of the "call-out" section. The "Call-out" section must sit adjacent to the
 isp.sa image in memory.
 
 The second section, the "Entry-point" section, is used by external routines
@@ -112,7 +112,7 @@
 	bra	_060ISP_TOP+128+0
 
 (_060ISP_TOP is the starting address of the "Call-out" section; the "Call-out"
-section is 128 bytes long; and the Unimplemented Integer ISP handler entry 
+section is 128 bytes long; and the Unimplemented Integer ISP handler entry
 point is located 0 bytes from the top of the "Entry-point" section.)
 
 The third section is the code section. After entering through an "Entry-point",
@@ -177,7 +177,7 @@
 _060_isp_unimp() entry point of the ISP.
 
 After the 060ISP decodes the instruction type and fetches the appropriate
-data registers, and BEFORE the actual emulated transfers occur, the 
+data registers, and BEFORE the actual emulated transfers occur, the
 package calls either the "Call-out" _060_real_cas() or _060_real_cas2().
 If the emulation code provided by the 060ISP is sufficient for the
 host system (see isp.s source code), then these "Call-out"s should be
diff -Nru a/arch/m68k/ifpsp060/os.S b/arch/m68k/ifpsp060/os.S
--- a/arch/m68k/ifpsp060/os.S	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/ifpsp060/os.S	Tue Jun 15 22:20:41 2004
@@ -5,10 +5,10 @@
 |Production Release P1.00 -- October 10, 1994
 |
 |M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
-| 
+|
 |THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 |To the maximum extent permitted by applicable law,
-|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 |INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 |and any warranty against infringement with regard to the SOFTWARE
 |(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -35,8 +35,8 @@
 #include <linux/linkage.h>
 
 |################################
-| EXAMPLE CALL-OUTS 		#
-| 				#
+| EXAMPLE CALL-OUTS		#
+|				#
 | _060_dmem_write()		#
 | _060_dmem_read()		#
 | _060_imem_read()		#
@@ -53,12 +53,12 @@
 | _060_real_access()		#
 |################################
 
-| 
+|
 | Each IO routine checks to see if the memory write/read is to/from user
 | or supervisor application space. The examples below use simple "move"
 | instructions for supervisor mode applications and call _copyin()/_copyout()
 | for user mode applications.
-| When installing the 060SP, the _copyin()/_copyout() equivalents for a 
+| When installing the 060SP, the _copyin()/_copyout() equivalents for a
 | given operating system should be substituted.
 |
 | The addresses within the 060SP are guaranteed to be on the stack.
@@ -76,10 +76,10 @@
 | Writes to data memory while in supervisor mode.
 |
 | INPUTS:
-|	a0 - supervisor source address	
+|	a0 - supervisor source address
 |	a1 - user destination address
-|	d0 - number of bytes to write	
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	d0 - number of bytes to write
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d1 - 0 = success, !0 = failure
 |
@@ -110,11 +110,11 @@
 |	a0 - user source address
 |	a1 - supervisor destination address
 |	d0 - number of bytes to read
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d1 - 0 = success, !0 = failure
 |
-	.global 		_060_imem_read
+	.global		_060_imem_read
 	.global		_060_dmem_read
 _060_imem_read:
 _060_dmem_read:
@@ -136,17 +136,17 @@
 
 |
 | _060_dmem_read_byte():
-| 
+|
 | Read a data byte from user memory.
 |
 | INPUTS:
 |	a0 - user source address
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d0 - data byte in d0
 |	d1 - 0 = success, !0 = failure
 |
-	.global 		_060_dmem_read_byte
+	.global		_060_dmem_read_byte
 _060_dmem_read_byte:
 	clr.l		%d0			| clear whole longword
 	clr.l		%d1			| assume success
@@ -159,29 +159,29 @@
 
 |
 | _060_dmem_read_word():
-| 
+|
 | Read a data word from user memory.
 |
 | INPUTS:
 |	a0 - user source address
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d0 - data word in d0
 |	d1 - 0 = success, !0 = failure
 |
 | _060_imem_read_word():
-| 
+|
 | Read an instruction word from user memory.
 |
 | INPUTS:
 |	a0 - user source address
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d0 - instruction word in d0
 |	d1 - 0 = success, !0 = failure
 |
-	.global 		_060_dmem_read_word
-	.global 		_060_imem_read_word
+	.global		_060_dmem_read_word
+	.global		_060_imem_read_word
 _060_dmem_read_word:
 _060_imem_read_word:
 	clr.l		%d1			| assume success
@@ -195,29 +195,29 @@
 
 |
 | _060_dmem_read_long():
-| 
+|
 
 |
 | INPUTS:
 |	a0 - user source address
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d0 - data longword in d0
 |	d1 - 0 = success, !0 = failure
 |
 | _060_imem_read_long():
-| 
+|
 | Read an instruction longword from user memory.
 |
 | INPUTS:
 |	a0 - user source address
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d0 - instruction longword in d0
 |	d1 - 0 = success, !0 = failure
 |
-	.global 		_060_dmem_read_long
-	.global 		_060_imem_read_long
+	.global		_060_dmem_read_long
+	.global		_060_imem_read_long
 _060_dmem_read_long:
 _060_imem_read_long:
 	clr.l		%d1			| assume success
@@ -235,12 +235,12 @@
 |
 | INPUTS:
 |	a0 - user destination address
-| 	d0 - data byte in d0
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	d0 - data byte in d0
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d1 - 0 = success, !0 = failure
 |
-	.global 		_060_dmem_write_byte
+	.global		_060_dmem_write_byte
 _060_dmem_write_byte:
 	clr.l		%d1			| assume success
 	btst		#0x5,0x4(%a6)		| check for supervisor state
@@ -257,12 +257,12 @@
 |
 | INPUTS:
 |	a0 - user destination address
-| 	d0 - data word in d0
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	d0 - data word in d0
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d1 - 0 = success, !0 = failure
 |
-	.global 		_060_dmem_write_word
+	.global		_060_dmem_write_word
 _060_dmem_write_word:
 	clr.l		%d1			| assume success
 	btst		#0x5,0x4(%a6)		| check for supervisor state
@@ -281,12 +281,12 @@
 |
 | INPUTS:
 |	a0 - user destination address
-| 	d0 - data longword in d0
-| 	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
+|	d0 - data longword in d0
+|	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
 | OUTPUTS:
 |	d1 - 0 = success, !0 = failure
 |
-	.global 		_060_dmem_write_long
+	.global		_060_dmem_write_long
 _060_dmem_write_long:
 	clr.l		%d1			| assume success
 	btst		#0x5,0x4(%a6)		| check for supervisor state
@@ -313,7 +313,7 @@
 |
 | int _copyout(supervisor_addr, user_addr, nbytes)
 |
-	.global 		_copyout
+	.global		_copyout
 _copyout:
 	move.l		4(%sp),%a0		| source
 	move.l		8(%sp),%a1		| destination
@@ -330,14 +330,14 @@
 |
 | int _copyin(user_addr, supervisor_addr, nbytes)
 |
-	.global 		_copyin
+	.global		_copyin
 _copyin:
 	move.l		4(%sp),%a0		| source
 	move.l		8(%sp),%a1		| destination
 	move.l		12(%sp),%d0		| count
     subq.l      #1,%d0
 morein:
-copyinae:	
+copyinae:
 	movs.b		(%a0)+,%d1		| fetch user byte
 	move.b		%d1,(%a1)+		| write supervisor byte
 	dbra		%d0,morein		| are we through yet?
@@ -378,7 +378,7 @@
 
 
 
-| Execption handling for movs access to illegal memory	
+| Execption handling for movs access to illegal memory
 	.section .fixup,#alloc,#execinstr
 	.even
 1:	moveq		#-1,%d1
diff -Nru a/arch/m68k/ifpsp060/src/fplsp.S b/arch/m68k/ifpsp060/src/fplsp.S
--- a/arch/m68k/ifpsp060/src/fplsp.S	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/ifpsp060/src/fplsp.S	Tue Jun 15 22:20:44 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -304,33 +304,33 @@
 set EXC_D1,		EXC_DREGS+(1*4)
 set EXC_D0,		EXC_DREGS+(0*4)
 
-set EXC_FP0, 		EXC_FPREGS+(0*12)	# offset of saved fp0
-set EXC_FP1, 		EXC_FPREGS+(1*12)	# offset of saved fp1
-set EXC_FP2, 		EXC_FPREGS+(2*12)	# offset of saved fp2 (not used)
+set EXC_FP0,		EXC_FPREGS+(0*12)	# offset of saved fp0
+set EXC_FP1,		EXC_FPREGS+(1*12)	# offset of saved fp1
+set EXC_FP2,		EXC_FPREGS+(2*12)	# offset of saved fp2 (not used)
 
-set FP_SCR1, 		LV+80			# fp scratch 1
-set FP_SCR1_EX, 	FP_SCR1+0
+set FP_SCR1,		LV+80			# fp scratch 1
+set FP_SCR1_EX,		FP_SCR1+0
 set FP_SCR1_SGN,	FP_SCR1+2
-set FP_SCR1_HI, 	FP_SCR1+4
-set FP_SCR1_LO, 	FP_SCR1+8
+set FP_SCR1_HI,		FP_SCR1+4
+set FP_SCR1_LO,		FP_SCR1+8
 
-set FP_SCR0, 		LV+68			# fp scratch 0
-set FP_SCR0_EX, 	FP_SCR0+0
+set FP_SCR0,		LV+68			# fp scratch 0
+set FP_SCR0_EX,		FP_SCR0+0
 set FP_SCR0_SGN,	FP_SCR0+2
-set FP_SCR0_HI, 	FP_SCR0+4
-set FP_SCR0_LO, 	FP_SCR0+8
+set FP_SCR0_HI,		FP_SCR0+4
+set FP_SCR0_LO,		FP_SCR0+8
 
-set FP_DST, 		LV+56			# fp destination operand
-set FP_DST_EX, 		FP_DST+0
+set FP_DST,		LV+56			# fp destination operand
+set FP_DST_EX,		FP_DST+0
 set FP_DST_SGN,		FP_DST+2
-set FP_DST_HI, 		FP_DST+4
-set FP_DST_LO, 		FP_DST+8
+set FP_DST_HI,		FP_DST+4
+set FP_DST_LO,		FP_DST+8
 
-set FP_SRC, 		LV+44			# fp source operand
-set FP_SRC_EX, 		FP_SRC+0
+set FP_SRC,		LV+44			# fp source operand
+set FP_SRC_EX,		FP_SRC+0
 set FP_SRC_SGN,		FP_SRC+2
-set FP_SRC_HI, 		FP_SRC+4
-set FP_SRC_LO, 		FP_SRC+8
+set FP_SRC_HI,		FP_SRC+4
+set FP_SRC_LO,		FP_SRC+8
 
 set USER_FPIAR,		LV+40			# FP instr address register
 
@@ -354,7 +354,7 @@
 set EXC_TEMP,		LV+16			# temporary space
 
 set DTAG,		LV+15			# destination operand type
-set STAG, 		LV+14			# source operand type
+set STAG,		LV+14			# source operand type
 
 set SPCOND_FLG,		LV+10			# flag: special case (see below)
 
@@ -369,17 +369,17 @@
 # Helpful macros
 
 set FTEMP,		0			# offsets within an
-set FTEMP_EX, 		0			# extended precision
+set FTEMP_EX,		0			# extended precision
 set FTEMP_SGN,		2			# value saved in memory.
-set FTEMP_HI, 		4
-set FTEMP_LO, 		8
+set FTEMP_HI,		4
+set FTEMP_LO,		8
 set FTEMP_GRS,		12
 
 set LOCAL,		0			# offsets within an
-set LOCAL_EX, 		0			# extended precision 
+set LOCAL_EX,		0			# extended precision
 set LOCAL_SGN,		2			# value saved in memory.
-set LOCAL_HI, 		4
-set LOCAL_LO, 		8
+set LOCAL_HI,		4
+set LOCAL_LO,		8
 set LOCAL_GRS,		12
 
 set DST,		0			# offsets within an
@@ -469,17 +469,17 @@
 ######################################
 set dzinf_mask,		inf_mask+dz_mask+adz_mask
 set opnan_mask,		nan_mask+operr_mask+aiop_mask
-set nzi_mask,		0x01ffffff 		#clears N, Z, and I
+set nzi_mask,		0x01ffffff		#clears N, Z, and I
 set unfinx_mask,	unfl_mask+inex2_mask+aunfl_mask+ainex_mask
 set unf2inx_mask,	unfl_mask+inex2_mask+ainex_mask
 set ovfinx_mask,	ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
 set inx1a_mask,		inex1_mask+ainex_mask
 set inx2a_mask,		inex2_mask+ainex_mask
-set snaniop_mask, 	nan_mask+snan_mask+aiop_mask
+set snaniop_mask,	nan_mask+snan_mask+aiop_mask
 set snaniop2_mask,	snan_mask+aiop_mask
 set naniop_mask,	nan_mask+aiop_mask
 set neginf_mask,	neg_mask+inf_mask
-set infaiop_mask, 	inf_mask+aiop_mask
+set infaiop_mask,	inf_mask+aiop_mask
 set negz_mask,		neg_mask+z_mask
 set opaop_mask,		operr_mask+aiop_mask
 set unfl_inx_mask,	unfl_mask+aunfl_mask+ainex_mask
@@ -508,8 +508,8 @@
 set mantissalen,	64			# length of mantissa in bits
 
 set BYTE,		1			# len(byte) == 1 byte
-set WORD, 		2			# len(word) == 2 bytes
-set LONG, 		4			# len(longword) == 2 bytes
+set WORD,		2			# len(word) == 2 bytes
+set LONG,		4			# len(longword) == 2 bytes
 
 set BSUN_VEC,		0xc0			# bsun    vector offset
 set INEX_VEC,		0xc4			# inexact vector offset
@@ -4903,7 +4903,7 @@
 #	d0 = round precision,mode					#
 #									#
 # OUTPUT ************************************************************** #
-#	fp0 = sin(X) or cos(X) 						#
+#	fp0 = sin(X) or cos(X)						#
 #									#
 #    For ssincos(X):							#
 #	fp0 = sin(X)							#
@@ -4911,7 +4911,7 @@
 #									#
 # ACCURACY and MONOTONICITY ******************************************* #
 #	The returned result is within 1 ulp in 64 significant bit, i.e.	#
-#	within 0.5001 ulp to 53 bits if the result is subsequently 	#
+#	within 0.5001 ulp to 53 bits if the result is subsequently	#
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
 #									#
@@ -4928,8 +4928,8 @@
 #									#
 #	4. If k is even, go to 6.					#
 #									#
-#	5. (k is odd) Set j := (k-1)/2, sgn := (-1)**j. 		#
-#		Return sgn*cos(r) where cos(r) is approximated by an 	#
+#	5. (k is odd) Set j := (k-1)/2, sgn := (-1)**j.			#
+#		Return sgn*cos(r) where cos(r) is approximated by an	#
 #		even polynomial in r, 1 + r*r*(B1+s*(B2+ ... + s*B8)),	#
 #		s = r*r.						#
 #		Exit.							#
@@ -4941,10 +4941,10 @@
 #									#
 #	7. If |X| > 1, go to 9.						#
 #									#
-#	8. (|X|<2**(-40)) If SIN is invoked, return X; 			#
+#	8. (|X|<2**(-40)) If SIN is invoked, return X;			#
 #		otherwise return 1.					#
 #									#
-#	9. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, 		#
+#	9. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi,		#
 #		go back to 3.						#
 #									#
 #	SINCOS:								#
@@ -4959,19 +4959,19 @@
 #		j1 exclusive or with the l.s.b. of k.			#
 #		sgn1 := (-1)**j1, sgn2 := (-1)**j2.			#
 #		SIN(X) = sgn1 * cos(r) and COS(X) = sgn2*sin(r) where	#
-#		sin(r) and cos(r) are computed as odd and even 		#
+#		sin(r) and cos(r) are computed as odd and even		#
 #		polynomials in r, respectively. Exit			#
 #									#
 #	5. (k is even) Set j1 := k/2, sgn1 := (-1)**j1.			#
 #		SIN(X) = sgn1 * sin(r) and COS(X) = sgn1*cos(r) where	#
-#		sin(r) and cos(r) are computed as odd and even 		#
+#		sin(r) and cos(r) are computed as odd and even		#
 #		polynomials in r, respectively. Exit			#
 #									#
 #	6. If |X| > 1, go to 8.						#
 #									#
 #	7. (|X|<2**(-40)) SIN(X) = X and COS(X) = 1. Exit.		#
 #									#
-#	8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, 		#
+#	8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi,		#
 #		go back to 2.						#
 #									#
 #########################################################################
@@ -5046,9 +5046,9 @@
 #--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
 SINMAIN:
 	fmov.x		%fp0,%fp1
-	fmul.d		TWOBYPI(%pc),%fp1 	# X*2/PI
+	fmul.d		TWOBYPI(%pc),%fp1	# X*2/PI
 
-	lea		PITBL+0x200(%pc),%a1 	# TABLE OF N*PI/2, N = -32,...,32
+	lea		PITBL+0x200(%pc),%a1	# TABLE OF N*PI/2, N = -32,...,32
 
 	fmov.l		%fp1,INT(%a6)		# CONVERT TO INTEGER
 
@@ -5058,8 +5058,8 @@
 
 # A1 IS THE ADDRESS OF N*PIBY2
 # ...WHICH IS IN TWO PIECES Y1 & Y2
-	fsub.x		(%a1)+,%fp0 		# X-Y1
-	fsub.s		(%a1),%fp0 		# fp0 = R = (X-Y1)-Y2
+	fsub.x		(%a1)+,%fp0		# X-Y1
+	fsub.s		(%a1),%fp0		# fp0 = R = (X-Y1)-Y2
 
 SINCONT:
 #--continuation from REDUCEX
@@ -5213,7 +5213,7 @@
 COSTINY:
 	fmov.s		&0x3F800000,%fp0	# fp0 = 1.0
 	fmov.l		%d0,%fpcr		# restore users round mode,prec
-	fadd.s 		&0x80800000,%fp0	# last inst - possible exception set
+	fadd.s		&0x80800000,%fp0	# last inst - possible exception set
 	bra		t_pinx2
 
 ################################################
@@ -5645,7 +5645,7 @@
 #									#
 #	7. (|X|<2**(-40)) Tan(X) = X. Exit.				#
 #									#
-#	8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back 	#
+#	8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back	#
 #		to 2.							#
 #									#
 #########################################################################
@@ -6048,27 +6048,27 @@
 #	The returned result is within 2 ulps in	64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently	#
 #	rounded to double precision. The result is provably monotonic	#
-#	in double precision. 						#
+#	in double precision.						#
 #									#
 # ALGORITHM *********************************************************** #
 #	Step 1. If |X| >= 16 or |X| < 1/16, go to Step 5.		#
 #									#
-#	Step 2. Let X = sgn * 2**k * 1.xxxxxxxx...x. 			#
+#	Step 2. Let X = sgn * 2**k * 1.xxxxxxxx...x.			#
 #		Note that k = -4, -3,..., or 3.				#
-#		Define F = sgn * 2**k * 1.xxxx1, i.e. the first 5 	#
+#		Define F = sgn * 2**k * 1.xxxx1, i.e. the first 5	#
 #		significant bits of X with a bit-1 attached at the 6-th	#
 #		bit position. Define u to be u = (X-F) / (1 + X*F).	#
 #									#
 #	Step 3. Approximate arctan(u) by a polynomial poly.		#
 #									#
-#	Step 4. Return arctan(F) + poly, arctan(F) is fetched from a 	#
+#	Step 4. Return arctan(F) + poly, arctan(F) is fetched from a	#
 #		table of values calculated beforehand. Exit.		#
 #									#
 #	Step 5. If |X| >= 16, go to Step 7.				#
 #									#
 #	Step 6. Approximate arctan(X) by an odd polynomial in X. Exit.	#
 #									#
-#	Step 7. Define X' = -1/X. Approximate arctan(X') by an odd 	#
+#	Step 7. Define X' = -1/X. Approximate arctan(X') by an odd	#
 #		polynomial in X'.					#
 #		Arctan(X) = sign(X)*Pi/2 + arctan(X'). Exit.		#
 #									#
@@ -6334,7 +6334,7 @@
 	fmul.x		%fp2,%fp1		# A1*U*V*(A2+V*(A3+V))
 	fadd.x		%fp1,%fp0		# ATAN(U), FP1 RELEASED
 
-	fmovm.x 	(%sp)+,&0x20		# restore fp2
+	fmovm.x		(%sp)+,&0x20		# restore fp2
 
 	fmov.l		%d0,%fpcr		# restore users rnd mode,prec
 	fadd.x		ATANF(%a6),%fp0		# ATAN(X)
@@ -6491,7 +6491,7 @@
 #	a0 = pointer to extended precision input			#
 #	d0 = round precision,mode					#
 #									#
-# OUTPUT **************************************************************	# 
+# OUTPUT **************************************************************	#
 #	fp0 = arcsin(X)							#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
@@ -6531,7 +6531,7 @@
 
 # This catch is added here for the '060 QSP. Originally, the call to
 # satan() would handle this case by causing the exception which would
-# not be caught until gen_except(). Now, with the exceptions being 
+# not be caught until gen_except(). Now, with the exceptions being
 # detected inside of satan(), the exception would have been handled there
 # instead of inside sasin() as expected.
 	cmp.l		%d1,&0x3FD78000
@@ -6680,7 +6680,7 @@
 
 #########################################################################
 # setox():    computes the exponential for a normalized input		#
-# setoxd():   computes the exponential for a denormalized input		# 
+# setoxd():   computes the exponential for a denormalized input		#
 # setoxm1():  computes the exponential minus 1 for a normalized input	#
 # setoxm1d(): computes the exponential minus 1 for a denormalized input	#
 #									#
@@ -6692,9 +6692,9 @@
 #	fp0 = exp(X) or exp(X)-1					#
 #									#
 # ACCURACY and MONOTONICITY ******************************************* #
-#	The returned result is within 0.85 ulps in 64 significant bit, 	#
+#	The returned result is within 0.85 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-#	rounded to double precision. The result is provably monotonic 	#
+#	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
 #									#
 # ALGORITHM and IMPLEMENTATION **************************************** #
@@ -6718,14 +6718,14 @@
 #	Notes:	The usual case should take the branches 1.1 -> 1.3 -> 2.#
 #		To avoid the use of floating-point comparisons, a	#
 #		compact representation of |X| is used. This format is a	#
-#		32-bit integer, the upper (more significant) 16 bits 	#
-#		are the sign and biased exponent field of |X|; the 	#
+#		32-bit integer, the upper (more significant) 16 bits	#
+#		are the sign and biased exponent field of |X|; the	#
 #		lower 16 bits are the 16 most significant fraction	#
 #		(including the explicit bit) bits of |X|. Consequently,	#
 #		the comparisons in Steps 1.1 and 1.3 can be performed	#
 #		by integer comparison. Note also that the constant	#
 #		16380 log(2) used in Step 1.3 is also in the compact	#
-#		form. Thus taking the branch to Step 2 guarantees 	#
+#		form. Thus taking the branch to Step 2 guarantees	#
 #		|X| < 16380 log(2). There is no harm to have a small	#
 #		number of cases where |X| is less than,	but close to,	#
 #		16380 log(2) and the branch to Step 9 is taken.		#
@@ -6737,7 +6737,7 @@
 #		2.3	Calculate	J = N mod 64; so J = 0,1,2,..., #
 #			or 63.						#
 #		2.4	Calculate	M = (N - J)/64; so N = 64M + J.	#
-#		2.5	Calculate the address of the stored value of 	#
+#		2.5	Calculate the address of the stored value of	#
 #			2^(J/64).					#
 #		2.6	Create the value Scale = 2^M.			#
 #	Notes:	The calculation in 2.2 is really performed by		#
@@ -6746,26 +6746,26 @@
 #		where							#
 #			constant := single-precision( 64/log 2 ).	#
 #									#
-#		Using a single-precision constant avoids memory 	#
+#		Using a single-precision constant avoids memory		#
 #		access. Another effect of using a single-precision	#
-#		"constant" is that the calculated value Z is 		#
+#		"constant" is that the calculated value Z is		#
 #									#
 #			Z = X*(64/log2)*(1+eps), |eps| <= 2^(-24).	#
 #									#
 #		This error has to be considered later in Steps 3 and 4.	#
 #									#
 #	Step 3.	Calculate X - N*log2/64.				#
-#		3.1	R := X + N*L1, 					#
+#		3.1	R := X + N*L1,					#
 #				where L1 := single-precision(-log2/64).	#
-#		3.2	R := R + N*L2, 					#
+#		3.2	R := R + N*L2,					#
 #				L2 := extended-precision(-log2/64 - L1).#
-#	Notes:	a) The way L1 and L2 are chosen ensures L1+L2 		#
+#	Notes:	a) The way L1 and L2 are chosen ensures L1+L2		#
 #		approximate the value -log2/64 to 88 bits of accuracy.	#
 #		b) N*L1 is exact because N is no longer than 22 bits	#
 #		and L1 is no longer than 24 bits.			#
-#		c) The calculation X+N*L1 is also exact due to 		#
+#		c) The calculation X+N*L1 is also exact due to		#
 #		cancellation. Thus, R is practically X+N(L1+L2) to full	#
-#		64 bits. 						#
+#		64 bits.						#
 #		d) It is important to estimate how large can |R| be	#
 #		after Step 3.2.						#
 #									#
@@ -6783,11 +6783,11 @@
 #									#
 #	Step 4.	Approximate exp(R)-1 by a polynomial			#
 #		p = R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*A5))))	#
-#	Notes:	a) In order to reduce memory access, the coefficients 	#
+#	Notes:	a) In order to reduce memory access, the coefficients	#
 #		are made as "short" as possible: A1 (which is 1/2), A4	#
 #		and A5 are single precision; A2 and A3 are double	#
-#		precision. 						#
-#		b) Even with the restrictions above, 			#
+#		precision.						#
+#		b) Even with the restrictions above,			#
 #		   |p - (exp(R)-1)| < 2^(-68.8) for all |R| <= 0.0062.	#
 #		Note that 0.0062 is slightly bigger than 0.57 log2/64.	#
 #		c) To fully utilize the pipeline, p is separated into	#
@@ -6801,11 +6801,11 @@
 #		where T and t are the stored values for 2^(J/64).	#
 #	Notes:	2^(J/64) is stored as T and t where T+t approximates	#
 #		2^(J/64) to roughly 85 bits; T is in extended precision	#
-#		and t is in single precision. Note also that T is 	#
-#		rounded to 62 bits so that the last two bits of T are 	#
-#		zero. The reason for such a special form is that T-1, 	#
+#		and t is in single precision. Note also that T is	#
+#		rounded to 62 bits so that the last two bits of T are	#
+#		zero. The reason for such a special form is that T-1,	#
 #		T-2, and T-8 will all be exact --- a property that will	#
-#		give much more accurate computation of the function 	#
+#		give much more accurate computation of the function	#
 #		EXPM1.							#
 #									#
 #	Step 6.	Reconstruction of exp(X)				#
@@ -6821,11 +6821,11 @@
 #			X = (M1+M)log2 + Jlog2/64 + R, |M1+M| >= 16380.	#
 #		Hence, exp(X) may overflow or underflow or neither.	#
 #		When that is the case, AdjScale = 2^(M1) where M1 is	#
-#		approximately M. Thus 6.2 will never cause 		#
+#		approximately M. Thus 6.2 will never cause		#
 #		over/underflow. Possible exception in 6.4 is overflow	#
 #		or underflow. The inexact exception is not generated in	#
 #		6.4. Although one can argue that the inexact flag	#
-#		should always be raised, to simulate that exception 	#
+#		should always be raised, to simulate that exception	#
 #		cost to much than the flag is worth in practical uses.	#
 #									#
 #	Step 7.	Return 1 + X.						#
@@ -6838,7 +6838,7 @@
 #		in Step 7.1 to avoid unnecessary trapping. (Although	#
 #		the FMOVEM may not seem relevant since X is normalized,	#
 #		the precaution will be useful in the library version of	#
-#		this code where the separate entry for denormalized 	#
+#		this code where the separate entry for denormalized	#
 #		inputs will be done away with.)				#
 #									#
 #	Step 8.	Handle exp(X) where |X| >= 16380log2.			#
@@ -6846,9 +6846,9 @@
 #		(mimic 2.2 - 2.6)					#
 #		8.2	N := round-to-integer( X * 64/log2 )		#
 #		8.3	Calculate J = N mod 64, J = 0,1,...,63		#
-#		8.4	K := (N-J)/64, M1 := truncate(K/2), M = K-M1, 	#
+#		8.4	K := (N-J)/64, M1 := truncate(K/2), M = K-M1,	#
 #			AdjFlag := 1.					#
-#		8.5	Calculate the address of the stored value 	#
+#		8.5	Calculate the address of the stored value	#
 #			2^(J/64).					#
 #		8.6	Create the values Scale = 2^M, AdjScale = 2^M1.	#
 #		8.7	Go to Step 3.					#
@@ -6885,8 +6885,8 @@
 #		1.4	Go to Step 10.					#
 #	Notes:	The usual case should take the branches 1.1 -> 1.3 -> 2.#
 #		However, it is conceivable |X| can be small very often	#
-#		because EXPM1 is intended to evaluate exp(X)-1 		#
-#		accurately when |X| is small. For further details on 	#
+#		because EXPM1 is intended to evaluate exp(X)-1		#
+#		accurately when |X| is small. For further details on	#
 #		the comparisons, see the notes on Step 1 of setox.	#
 #									#
 #	Step 2.	Calculate N = round-to-nearest-int( X * 64/log2 ).	#
@@ -6894,16 +6894,16 @@
 #		2.2	Calculate	J = N mod 64; so J = 0,1,2,..., #
 #			or 63.						#
 #		2.3	Calculate	M = (N - J)/64; so N = 64M + J.	#
-#		2.4	Calculate the address of the stored value of 	#
+#		2.4	Calculate the address of the stored value of	#
 #			2^(J/64).					#
-#		2.5	Create the values Sc = 2^M and 			#
+#		2.5	Create the values Sc = 2^M and			#
 #			OnebySc := -2^(-M).				#
 #	Notes:	See the notes on Step 2 of setox.			#
 #									#
 #	Step 3.	Calculate X - N*log2/64.				#
-#		3.1	R := X + N*L1, 					#
+#		3.1	R := X + N*L1,					#
 #				where L1 := single-precision(-log2/64).	#
-#		3.2	R := R + N*L2, 					#
+#		3.2	R := R + N*L2,					#
 #				L2 := extended-precision(-log2/64 - L1).#
 #	Notes:	Applying the analysis of Step 3 of setox in this case	#
 #		shows that |R| <= 0.0055 (note that |X| <= 70 log2 in	#
@@ -6911,10 +6911,10 @@
 #									#
 #	Step 4.	Approximate exp(R)-1 by a polynomial			#
 #			p = R+R*R*(A1+R*(A2+R*(A3+R*(A4+R*(A5+R*A6)))))	#
-#	Notes:	a) In order to reduce memory access, the coefficients 	#
-#		are made as "short" as possible: A1 (which is 1/2), A5 	#
-#		and A6 are single precision; A2, A3 and A4 are double 	#
-#		precision. 						#
+#	Notes:	a) In order to reduce memory access, the coefficients	#
+#		are made as "short" as possible: A1 (which is 1/2), A5	#
+#		and A6 are single precision; A2, A3 and A4 are double	#
+#		precision.						#
 #		b) Even with the restriction above,			#
 #			|p - (exp(R)-1)| <	|R| * 2^(-72.7)		#
 #		for all |R| <= 0.0055.					#
@@ -6929,9 +6929,9 @@
 #		where T and t are the stored values for 2^(J/64).	#
 #	Notes:	2^(J/64) is stored as T and t where T+t approximates	#
 #		2^(J/64) to roughly 85 bits; T is in extended precision	#
-#		and t is in single precision. Note also that T is 	#
-#		rounded to 62 bits so that the last two bits of T are 	#
-#		zero. The reason for such a special form is that T-1, 	#
+#		and t is in single precision. Note also that T is	#
+#		rounded to 62 bits so that the last two bits of T are	#
+#		zero. The reason for such a special form is that T-1,	#
 #		T-2, and T-8 will all be exact --- a property that will	#
 #		be exploited in Step 6 below. The total relative error	#
 #		in p is no bigger than 2^(-67.7) compared to the final	#
@@ -6946,7 +6946,7 @@
 #		6.5	ans := (T + OnebySc) + (p + t).			#
 #		6.6	Restore user FPCR.				#
 #		6.7	Return ans := Sc * ans. Exit.			#
-#	Notes:	The various arrangements of the expressions give 	#
+#	Notes:	The various arrangements of the expressions give	#
 #		accurate evaluations.					#
 #									#
 #	Step 7.	exp(X)-1 for |X| < 1/4.					#
@@ -6962,8 +6962,8 @@
 #		 Return ans := ans*2^(140). Exit			#
 #	Notes:	The idea is to return "X - tiny" under the user		#
 #		precision and rounding modes. To avoid unnecessary	#
-#		inefficiency, we stay away from denormalized numbers 	#
-#		the best we can. For |X| >= 2^(-16312), the 		#
+#		inefficiency, we stay away from denormalized numbers	#
+#		the best we can. For |X| >= 2^(-16312), the		#
 #		straightforward 8.2 generates the inexact exception as	#
 #		the case warrants.					#
 #									#
@@ -6971,13 +6971,13 @@
 #			p = X + X*X*(B1 + X*(B2 + ... + X*B12))		#
 #	Notes:	a) In order to reduce memory access, the coefficients	#
 #		are made as "short" as possible: B1 (which is 1/2), B9	#
-#		to B12 are single precision; B3 to B8 are double 	#
+#		to B12 are single precision; B3 to B8 are double	#
 #		precision; and B2 is double extended.			#
 #		b) Even with the restriction above,			#
 #			|p - (exp(X)-1)| < |X| 2^(-70.6)		#
 #		for all |X| <= 0.251.					#
 #		Note that 0.251 is slightly bigger than 1/4.		#
-#		c) To fully preserve accuracy, the polynomial is 	#
+#		c) To fully preserve accuracy, the polynomial is	#
 #		computed as						#
 #			X + ( S*B1 +	Q ) where S = X*X and		#
 #			Q	=	X*S*(B2 + X*(B3 + ... + X*B12))	#
@@ -6987,11 +6987,11 @@
 #				[ S*S*(B3 + S*(B5 + ... + S*B11)) ]	#
 #									#
 #	Step 10. Calculate exp(X)-1 for |X| >= 70 log 2.		#
-#		10.1 If X >= 70log2 , exp(X) - 1 = exp(X) for all 	#
+#		10.1 If X >= 70log2 , exp(X) - 1 = exp(X) for all	#
 #		practical purposes. Therefore, go to Step 1 of setox.	#
 #		10.2 If X <= -70log2, exp(X) - 1 = -1 for all practical	#
-#		purposes. 						#
-#		ans := -1 						#
+#		purposes.						#
+#		ans := -1						#
 #		Restore user FPCR					#
 #		Return ans := ans + 2^(-126). Exit.			#
 #	Notes:	10.2 will always create an inexact and return -1 + tiny	#
@@ -7496,10 +7496,10 @@
 # sgetexp():  returns the exponent portion of the input argument.	#
 #	      The exponent bias is removed and the exponent value is	#
 #	      returned as an extended precision number in fp0.		#
-# sgetexpd(): handles denormalized numbers. 				#
+# sgetexpd(): handles denormalized numbers.				#
 #									#
-# sgetman():  extracts the mantissa of the input argument. The 		#
-#	      mantissa is converted to an extended precision number w/ 	#
+# sgetman():  extracts the mantissa of the input argument. The		#
+#	      mantissa is converted to an extended precision number w/	#
 #	      an exponent of $3fff and is returned in fp0. The range of #
 #	      the result is [1.0 - 2.0).				#
 # sgetmand(): handles denormalized numbers.				#
@@ -7573,9 +7573,9 @@
 #	fp0 = cosh(X)							#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 3 ulps in 64 significant bit, 	#
+#	The returned result is within 3 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently	#
-#	rounded to double precision. The result is provably monotonic 	#
+#	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
 #									#
 # ALGORITHM ***********************************************************	#
@@ -7592,7 +7592,7 @@
 #									#
 #	4. (16380 log2 < |X| <= 16480 log2)				#
 #		cosh(X) = sign(X) * exp(|X|)/2.				#
-#		However, invoking exp(|X|) may cause premature 		#
+#		However, invoking exp(|X|) may cause premature		#
 #		overflow. Thus, we calculate sinh(X) as follows:	#
 #		Y	:= |X|						#
 #		Fact	:=	2**(16380)				#
@@ -7687,7 +7687,7 @@
 #	fp0 = sinh(X)							#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 3 ulps in 64 significant bit, 	#
+#	The returned result is within 3 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
@@ -7805,7 +7805,7 @@
 #	fp0 = tanh(X)							#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 3 ulps in 64 significant bit, 	#
+#	The returned result is within 3 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
@@ -7971,51 +7971,51 @@
 #	fp0 = log(X) or log(1+X)					#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 2 ulps in 64 significant bit, 	#
+#	The returned result is within 2 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently	#
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
 #									#
 # ALGORITHM ***********************************************************	#
 #	LOGN:								#
-#	Step 1. If |X-1| < 1/16, approximate log(X) by an odd 		#
-#		polynomial in u, where u = 2(X-1)/(X+1). Otherwise, 	#
+#	Step 1. If |X-1| < 1/16, approximate log(X) by an odd		#
+#		polynomial in u, where u = 2(X-1)/(X+1). Otherwise,	#
 #		move on to Step 2.					#
 #									#
 #	Step 2. X = 2**k * Y where 1 <= Y < 2. Define F to be the first	#
-#		seven significant bits of Y plus 2**(-7), i.e. 		#
-#		F = 1.xxxxxx1 in base 2 where the six "x" match those 	#
+#		seven significant bits of Y plus 2**(-7), i.e.		#
+#		F = 1.xxxxxx1 in base 2 where the six "x" match those	#
 #		of Y. Note that |Y-F| <= 2**(-7).			#
 #									#
-#	Step 3. Define u = (Y-F)/F. Approximate log(1+u) by a 		#
+#	Step 3. Define u = (Y-F)/F. Approximate log(1+u) by a		#
 #		polynomial in u, log(1+u) = poly.			#
 #									#
-#	Step 4. Reconstruct 						#
+#	Step 4. Reconstruct						#
 #		log(X) = log( 2**k * Y ) = k*log(2) + log(F) + log(1+u)	#
 #		by k*log(2) + (log(F) + poly). The values of log(F) are	#
 #		calculated beforehand and stored in the program.	#
 #									#
 #	lognp1:								#
-#	Step 1: If |X| < 1/16, approximate log(1+X) by an odd 		#
+#	Step 1: If |X| < 1/16, approximate log(1+X) by an odd		#
 #		polynomial in u where u = 2X/(2+X). Otherwise, move on	#
 #		to Step 2.						#
 #									#
 #	Step 2: Let 1+X = 2**k * Y, where 1 <= Y < 2. Define F as done	#
-#		in Step 2 of the algorithm for LOGN and compute 	#
-#		log(1+X) as k*log(2) + log(F) + poly where poly 	#
-#		approximates log(1+u), u = (Y-F)/F. 			#
+#		in Step 2 of the algorithm for LOGN and compute		#
+#		log(1+X) as k*log(2) + log(F) + poly where poly		#
+#		approximates log(1+u), u = (Y-F)/F.			#
 #									#
 #	Implementation Notes:						#
-#	Note 1. There are 64 different possible values for F, thus 64 	#
+#	Note 1. There are 64 different possible values for F, thus 64	#
 #		log(F)'s need to be tabulated. Moreover, the values of	#
 #		1/F are also tabulated so that the division in (Y-F)/F	#
 #		can be performed by a multiplication.			#
 #									#
-#	Note 2. In Step 2 of lognp1, in order to preserved accuracy, 	#
-#		the value Y-F has to be calculated carefully when 	#
-#		1/2 <= X < 3/2. 					#
+#	Note 2. In Step 2 of lognp1, in order to preserved accuracy,	#
+#		the value Y-F has to be calculated carefully when	#
+#		1/2 <= X < 3/2.						#
 #									#
-#	Note 3. To fully exploit the pipeline, polynomials are usually 	#
+#	Note 3. To fully exploit the pipeline, polynomials are usually	#
 #		separated into two parts evaluated independently before	#
 #		being added up.						#
 #									#
@@ -8228,9 +8228,9 @@
 	cmp.l		%d1,&0			# CHECK IF X IS NEGATIVE
 	blt.w		LOGNEG			# LOG OF NEGATIVE ARGUMENT IS INVALID
 # X IS POSITIVE, CHECK IF X IS NEAR 1
-	cmp.l		%d1,&0x3ffef07d 	# IS X < 15/16?
+	cmp.l		%d1,&0x3ffef07d		# IS X < 15/16?
 	blt.b		LOGMAIN			# YES
-	cmp.l		%d1,&0x3fff8841 	# IS X > 17/16?
+	cmp.l		%d1,&0x3fff8841		# IS X > 17/16?
 	ble.w		LOGNEAR1		# NO
 
 LOGMAIN:
@@ -8243,7 +8243,7 @@
 #--NOTE THAT U = (Y-F)/F IS VERY SMALL AND THUS APPROXIMATING
 #--LOG(1+U) CAN BE VERY EFFICIENT.
 #--ALSO NOTE THAT THE VALUE 1/F IS STORED IN A TABLE SO THAT NO
-#--DIVISION IS NEEDED TO CALCULATE (Y-F)/F. 
+#--DIVISION IS NEEDED TO CALCULATE (Y-F)/F.
 
 #--GET K, Y, F, AND ADDRESS OF 1/F.
 	asr.l		&8,%d1
@@ -8458,10 +8458,10 @@
 	mov.l		X(%a6),%d1
 	cmp.l		%d1,&0
 	ble.w		LP1NEG0			# LOG OF ZERO OR -VE
-	cmp.l		%d1,&0x3ffe8000 	# IS BOUNDS [1/2,3/2]?
+	cmp.l		%d1,&0x3ffe8000		# IS BOUNDS [1/2,3/2]?
 	blt.w		LOGMAIN
 	cmp.l		%d1,&0x3fffc000
-	bgt.w		LOGMAIN 
+	bgt.w		LOGMAIN
 #--IF 1+Z > 3/2 OR 1+Z < 1/2, THEN X, WHICH IS ROUNDING 1+Z,
 #--CONTAINS AT LEAST 63 BITS OF INFORMATION OF Z. IN THAT CASE,
 #--SIMPLY INVOKE LOG(X) FOR LOG(1+Z).
@@ -8562,7 +8562,7 @@
 #	a0 = pointer to extended precision input			#
 #	d0 = round precision,mode					#
 #									#
-# OUTPUT **************************************************************	# 
+# OUTPUT **************************************************************	#
 #	fp0 = arctanh(X)						#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
@@ -8677,7 +8677,7 @@
 #            2.1 Restore the user FPCR					#
 #            2.2 Return ans := Y * INV_L10.				#
 #									#
-#       slog10: 							#
+#       slog10:								#
 #									#
 #       Step 0. If X < 0, create a NaN and raise the invalid operation	#
 #               flag. Otherwise, save FPCR in D1; set FpCR to default.	#
@@ -8820,7 +8820,7 @@
 #	fp0 = 2**X or 10**X						#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 2 ulps in 64 significant bit, 	#
+#	The returned result is within 2 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently	#
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
@@ -8851,7 +8851,7 @@
 #									#
 #	4. Define r as							#
 #		r := ((X - N*L1)-N*L2) * L10				#
-#		where L1, L2 are the leading and trailing parts of 	#
+#		where L1, L2 are the leading and trailing parts of	#
 #		log_10(2)/64 and L10 is the natural log of 10. Then	#
 #		10**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r).		#
 #		Go to expr to compute that expression.			#
@@ -8872,7 +8872,7 @@
 #		Exit.							#
 #									#
 #	ExpBig								#
-#	1. Generate overflow by Huge * Huge if X > 0; otherwise, 	#
+#	1. Generate overflow by Huge * Huge if X > 0; otherwise,	#
 #	        generate underflow by Tiny * Tiny.			#
 #									#
 #	ExpSm								#
@@ -9203,7 +9203,7 @@
 
 #########################################################################
 # sscale(): computes the destination operand scaled by the source	#
-#	    operand. If the absoulute value of the source operand is 	#
+#	    operand. If the absoulute value of the source operand is	#
 #	    >= 2^14, an overflow or underflow is returned.		#
 #									#
 # INPUT *************************************************************** #
@@ -9265,7 +9265,7 @@
 	bge.b		sok_norm2		# thank goodness no
 
 # the multiply factor that we're trying to create should be a denorm
-# for the multiply to work. therefore, we're going to actually do a 
+# for the multiply to work. therefore, we're going to actually do a
 # multiply with a denorm which will cause an unimplemented data type
 # exception to be put into the machine which will be caught and corrected
 # later. we don't do this with the DENORMs above because this method
@@ -9280,7 +9280,7 @@
 	clr.l		-(%sp)			# insert zero low mantissa
 	mov.l		%d1,-(%sp)		# insert new high mantissa
 	clr.l		-(%sp)			# make zero exponent
-	bra.b		sok_norm_cont	
+	bra.b		sok_norm_cont
 sok_dnrm_32:
 	subi.b		&0x20,%d0		# get shift count
 	lsr.l		%d0,%d1			# make low mantissa longword
@@ -9288,7 +9288,7 @@
 	clr.l		-(%sp)			# insert zero high mantissa
 	clr.l		-(%sp)			# make zero exponent
 	bra.b		sok_norm_cont
-	
+
 # the src will force the dst to a DENORM value or worse. so, let's
 # create an fp multiply that will create the result.
 sok_norm:
@@ -9346,7 +9346,7 @@
 #	a1 = pointer to extended precision input Y			#
 #	d0 = round precision,mode					#
 #									#
-# 	The input operands X and Y can be either normalized or 		#
+#	The input operands X and Y can be either normalized or		#
 #	denormalized.							#
 #									#
 # OUTPUT ************************************************************** #
@@ -9355,7 +9355,7 @@
 # ALGORITHM *********************************************************** #
 #									#
 #       Step 1.  Save and strip signs of X and Y: signX := sign(X),	#
-#                signY := sign(Y), X := |X|, Y := |Y|, 			#
+#                signY := sign(Y), X := |X|, Y := |Y|,			#
 #                signQ := signX EOR signY. Record whether MOD or REM	#
 #                is requested.						#
 #									#
@@ -9375,7 +9375,7 @@
 #									#
 #       Step 4.  At this point, R = X - QY = MOD(X,Y). Set		#
 #                Last_Subtract := false (used in Step 7 below). If	#
-#                MOD is requested, go to Step 6. 			#
+#                MOD is requested, go to Step 6.			#
 #									#
 #       Step 5.  R = MOD(X,Y), but REM(X,Y) is requested.		#
 #            5.1 If R < Y/2, then R = MOD(X,Y) = REM(X,Y). Go to	#
@@ -9701,8 +9701,8 @@
 	mov.b		&FMUL_OP,%d1		# last inst is MUL
 	fmul.x		Scale(%pc),%fp0		# may cause underflow
 	bra		t_catch2
-# the '040 package did this apparently to see if the dst operand for the 
-# preceding fmul was a denorm. but, it better not have been since the 
+# the '040 package did this apparently to see if the dst operand for the
+# preceding fmul was a denorm. but, it better not have been since the
 # algorithm just got done playing with fp0 and expected no exceptions
 # as a result. trust me...
 #	bra		t_avoid_unsupp		# check for denorm as a
@@ -9716,7 +9716,7 @@
 Rem_is_0:
 #..R = 2^(-j)X - Q Y = Y, thus R = 0 and quotient = 2^j (Q+1)
 	addq.l		&1,%d3
-	cmp.l		%d0,&8			# D0 is j 
+	cmp.l		%d0,&8			# D0 is j
 	bge.b		Q_Big
 
 	lsl.l		%d0,%d3
@@ -9746,7 +9746,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	tag(): return the optype of the input ext fp number		#
+#	tag(): return the optype of the input ext fp number		#
 #									#
 #	This routine is used by the 060FPLSP.				#
 #									#
@@ -9755,13 +9755,13 @@
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of type tag						#
-# 		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
+#		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Simply test the exponent, j-bit, and mantissa values to 	#
+#	Simply test the exponent, j-bit, and mantissa values to		#
 # determine the type of operand.					#
 #	If it's an unnormalized zero, alter the operand and force it	#
 # to be a normal zero.							#
@@ -9829,15 +9829,15 @@
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand.		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default DZ result.					#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Transcendental emulation for the 060FPLSP has detected that 	#
+#	Transcendental emulation for the 060FPLSP has detected that	#
 # a DZ exception should occur for the instruction. If DZ is disabled,	#
 # return the default result.						#
-# 	If DZ is enabled, the dst operand should be returned unscathed	#
+#	If DZ is enabled, the dst operand should be returned unscathed	#
 # in fp0 while fp1 is used to create a DZ exception so that the		#
 # operating system can log that such an event occurred.			#
 #									#
@@ -9898,7 +9898,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	fp1 = source operand						#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default result						#
 #	fp1 = unchanged							#
@@ -9927,7 +9927,7 @@
 # but use fp2 instead. return the dst operand unscathed in fp0.
 operr_ena:
 	fmovm.x		EXC_FP0(%a6),&0x80	# return fp0 unscathed
-	fmov.l		USER_FPCR(%a6),%fpcr	
+	fmov.l		USER_FPCR(%a6),%fpcr
 	fmovm.x		&0x04,-(%sp)		# save fp2
 	fmov.s		&0x7f800000,%fp2	# load +INF
 	fmul.s		&0x00000000,%fp2	# +INF x 0
@@ -9956,7 +9956,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default underflow result					#
 #									#
@@ -10003,8 +10003,8 @@
 #		  (monadic)						#
 #	t_ovfl2(): Handle 060FPLSP overflow exception during		#
 #	           emulation. result always positive. (dyadic)		#
-#	t_ovfl_sc(): Handle 060FPLSP overflow exception during 		#
-#	             emulation for "fscale". 				#
+#	t_ovfl_sc(): Handle 060FPLSP overflow exception during		#
+#	             emulation for "fscale".				#
 #									#
 #	This routine is used by the 060FPLSP package.			#
 #									#
@@ -10013,7 +10013,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default underflow result					#
 #									#
@@ -10113,12 +10113,12 @@
 #									#
 # INPUT ***************************************************************	#
 #	fp0 = default underflow or overflow result			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default result						#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	If an overflow or underflow occurred during the last 		#
+#	If an overflow or underflow occurred during the last		#
 # instruction of transcendental 060FPLSP emulation, then it has already	#
 # occurred and has been logged. Now we need to see if an inexact	#
 # exception should occur.						#
@@ -10147,16 +10147,16 @@
 #									#
 # INPUT ***************************************************************	#
 #	fp0 = default result						#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default result						#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	The last instruction of transcendental emulation for the 	#
+#	The last instruction of transcendental emulation for the	#
 # 060FPLSP should be inexact. So, if inexact is enabled, then we create	#
 # the event here by adding a large and very small number together	#
 # so that the operating system can log the event.			#
-# 	Must check, too, if the result was zero, in which case we just	#
+#	Must check, too, if the result was zero, in which case we just	#
 # set the FPSR bits and return.						#
 #									#
 #########################################################################
@@ -10178,7 +10178,7 @@
 inx2_work:
 	btst		&inex2_bit,FPCR_ENABLE(%a6) # is inexact enabled?
 	bne.b		inx2_work_ena		# yes
-	rts	
+	rts
 inx2_work_ena:
 	fmov.l		USER_FPCR(%a6),%fpcr	# insert user's exceptions
 	fmov.s		&0x3f800000,%fp1	# load +1
@@ -10202,7 +10202,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision input operand		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default result						#
 #									#
@@ -10235,7 +10235,7 @@
 
 #
 # sto_cos:
-# 	This is used by fsincos library emulation. The correct
+#	This is used by fsincos library emulation. The correct
 # values are already in fp0 and fp1 so we do nothing here.
 #
 	global		sto_cos
@@ -10485,7 +10485,7 @@
 #########################################################################
 	global		dst_zero
 dst_zero:
-	tst.b		DST_EX(%a1) 		# get sign of dst operand
+	tst.b		DST_EX(%a1)		# get sign of dst operand
 	bmi.b		ld_mzero		# if neg, load neg zero
 	bra.b		ld_pzero		# load positive zero
 
@@ -10494,7 +10494,7 @@
 #########################################################################
 	global		src_inf
 src_inf:
-	tst.b		SRC_EX(%a0) 		# get sign of src operand
+	tst.b		SRC_EX(%a0)		# get sign of src operand
 	bmi.b		ld_minf			# if negative branch
 
 #
@@ -10520,7 +10520,7 @@
 #########################################################################
 	global		dst_inf
 dst_inf:
-	tst.b		DST_EX(%a1) 		# get sign of dst operand
+	tst.b		DST_EX(%a1)		# get sign of dst operand
 	bmi.b		ld_minf			# if negative branch
 	bra.b		ld_pinf
 
@@ -10562,7 +10562,7 @@
 #########################################################################
 	global		src_one
 src_one:
-	tst.b		SRC_EX(%a0) 		# check sign of source
+	tst.b		SRC_EX(%a0)		# check sign of source
 	bmi.b		ld_mone
 
 #
@@ -10591,7 +10591,7 @@
 #################################################################
 	global		spi_2
 spi_2:
-	tst.b		SRC_EX(%a0) 		# check sign of source
+	tst.b		SRC_EX(%a0)		# check sign of source
 	bmi.b		ld_mpi2
 
 #
@@ -10618,7 +10618,7 @@
 
 #
 # ssincosz(): When the src operand is ZERO, store a one in the
-# 	      cosine register and return a ZERO in fp0 w/ the same sign
+#	      cosine register and return a ZERO in fp0 w/ the same sign
 #	      as the src operand.
 #
 	global		ssincosz
@@ -10646,7 +10646,7 @@
 
 #
 # ssincosqnan(): When the src operand is a QNAN, store the QNAN in the cosine
-# 		 register and branch to the src QNAN routine.
+#		 register and branch to the src QNAN routine.
 #
 	global		ssincosqnan
 ssincosqnan:
@@ -10827,7 +10827,7 @@
 #	a0 = pointer fp extended precision operand to normalize		#
 #									#
 # OUTPUT ************************************************************** #
-# 	d0 = number of bit positions the mantissa was shifted		#
+#	d0 = number of bit positions the mantissa was shifted		#
 #	a0 = the input operand's mantissa is normalized; the exponent	#
 #	     is unchanged.						#
 #									#
@@ -10854,7 +10854,7 @@
 	mov.l		%d1, FTEMP_LO(%a0)	# store new lo(man)
 
 	mov.l		%d2, %d0		# return shift amount
-	
+
 	mov.l		(%sp)+, %d3		# restore temp regs
 	mov.l		(%sp)+, %d2
 
@@ -10869,7 +10869,7 @@
 	clr.l		FTEMP_LO(%a0)		# lo(man) is now zero
 
 	mov.l		%d2, %d0		# return shift amount
-	
+
 	mov.l		(%sp)+, %d3		# restore temp regs
 	mov.l		(%sp)+, %d2
 
@@ -10974,7 +10974,7 @@
 # whole mantissa is zero so this UNNORM is actually a zero
 #
 unnorm_zero:
-	and.w		&0x8000, FTEMP_EX(%a0) 	# force exponent to zero
+	and.w		&0x8000, FTEMP_EX(%a0)	# force exponent to zero
 
 	mov.b		&ZERO, %d0		# fix optype tag
 	rts
diff -Nru a/arch/m68k/ifpsp060/src/fpsp.S b/arch/m68k/ifpsp060/src/fpsp.S
--- a/arch/m68k/ifpsp060/src/fpsp.S	Tue Jun 15 22:21:04 2004
+++ b/arch/m68k/ifpsp060/src/fpsp.S	Tue Jun 15 22:21:04 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -90,7 +90,7 @@
 	bra.l		_fpsp_effadd
 	short		0x0000
 
-	space 		56
+	space		56
 
 ###############################################################
 	global		_fpsp_done
@@ -324,33 +324,33 @@
 set EXC_D1,		EXC_DREGS+(1*4)
 set EXC_D0,		EXC_DREGS+(0*4)
 
-set EXC_FP0, 		EXC_FPREGS+(0*12)	# offset of saved fp0
-set EXC_FP1, 		EXC_FPREGS+(1*12)	# offset of saved fp1
-set EXC_FP2, 		EXC_FPREGS+(2*12)	# offset of saved fp2 (not used)
+set EXC_FP0,		EXC_FPREGS+(0*12)	# offset of saved fp0
+set EXC_FP1,		EXC_FPREGS+(1*12)	# offset of saved fp1
+set EXC_FP2,		EXC_FPREGS+(2*12)	# offset of saved fp2 (not used)
 
-set FP_SCR1, 		LV+80			# fp scratch 1
-set FP_SCR1_EX, 	FP_SCR1+0
+set FP_SCR1,		LV+80			# fp scratch 1
+set FP_SCR1_EX,		FP_SCR1+0
 set FP_SCR1_SGN,	FP_SCR1+2
-set FP_SCR1_HI, 	FP_SCR1+4
-set FP_SCR1_LO, 	FP_SCR1+8
+set FP_SCR1_HI,		FP_SCR1+4
+set FP_SCR1_LO,		FP_SCR1+8
 
-set FP_SCR0, 		LV+68			# fp scratch 0
-set FP_SCR0_EX, 	FP_SCR0+0
+set FP_SCR0,		LV+68			# fp scratch 0
+set FP_SCR0_EX,		FP_SCR0+0
 set FP_SCR0_SGN,	FP_SCR0+2
-set FP_SCR0_HI, 	FP_SCR0+4
-set FP_SCR0_LO, 	FP_SCR0+8
+set FP_SCR0_HI,		FP_SCR0+4
+set FP_SCR0_LO,		FP_SCR0+8
 
-set FP_DST, 		LV+56			# fp destination operand
-set FP_DST_EX, 		FP_DST+0
+set FP_DST,		LV+56			# fp destination operand
+set FP_DST_EX,		FP_DST+0
 set FP_DST_SGN,		FP_DST+2
-set FP_DST_HI, 		FP_DST+4
-set FP_DST_LO, 		FP_DST+8
+set FP_DST_HI,		FP_DST+4
+set FP_DST_LO,		FP_DST+8
 
-set FP_SRC, 		LV+44			# fp source operand
-set FP_SRC_EX, 		FP_SRC+0
+set FP_SRC,		LV+44			# fp source operand
+set FP_SRC_EX,		FP_SRC+0
 set FP_SRC_SGN,		FP_SRC+2
-set FP_SRC_HI, 		FP_SRC+4
-set FP_SRC_LO, 		FP_SRC+8
+set FP_SRC_HI,		FP_SRC+4
+set FP_SRC_LO,		FP_SRC+8
 
 set USER_FPIAR,		LV+40			# FP instr address register
 
@@ -374,7 +374,7 @@
 set EXC_TEMP,		LV+16			# temporary space
 
 set DTAG,		LV+15			# destination operand type
-set STAG, 		LV+14			# source operand type
+set STAG,		LV+14			# source operand type
 
 set SPCOND_FLG,		LV+10			# flag: special case (see below)
 
@@ -389,17 +389,17 @@
 # Helpful macros
 
 set FTEMP,		0			# offsets within an
-set FTEMP_EX, 		0			# extended precision
+set FTEMP_EX,		0			# extended precision
 set FTEMP_SGN,		2			# value saved in memory.
-set FTEMP_HI, 		4
-set FTEMP_LO, 		8
+set FTEMP_HI,		4
+set FTEMP_LO,		8
 set FTEMP_GRS,		12
 
 set LOCAL,		0			# offsets within an
-set LOCAL_EX, 		0			# extended precision 
+set LOCAL_EX,		0			# extended precision
 set LOCAL_SGN,		2			# value saved in memory.
-set LOCAL_HI, 		4
-set LOCAL_LO, 		8
+set LOCAL_HI,		4
+set LOCAL_LO,		8
 set LOCAL_GRS,		12
 
 set DST,		0			# offsets within an
@@ -489,17 +489,17 @@
 ######################################
 set dzinf_mask,		inf_mask+dz_mask+adz_mask
 set opnan_mask,		nan_mask+operr_mask+aiop_mask
-set nzi_mask,		0x01ffffff 		#clears N, Z, and I
+set nzi_mask,		0x01ffffff		#clears N, Z, and I
 set unfinx_mask,	unfl_mask+inex2_mask+aunfl_mask+ainex_mask
 set unf2inx_mask,	unfl_mask+inex2_mask+ainex_mask
 set ovfinx_mask,	ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
 set inx1a_mask,		inex1_mask+ainex_mask
 set inx2a_mask,		inex2_mask+ainex_mask
-set snaniop_mask, 	nan_mask+snan_mask+aiop_mask
+set snaniop_mask,	nan_mask+snan_mask+aiop_mask
 set snaniop2_mask,	snan_mask+aiop_mask
 set naniop_mask,	nan_mask+aiop_mask
 set neginf_mask,	neg_mask+inf_mask
-set infaiop_mask, 	inf_mask+aiop_mask
+set infaiop_mask,	inf_mask+aiop_mask
 set negz_mask,		neg_mask+z_mask
 set opaop_mask,		operr_mask+aiop_mask
 set unfl_inx_mask,	unfl_mask+aunfl_mask+ainex_mask
@@ -528,8 +528,8 @@
 set mantissalen,	64			# length of mantissa in bits
 
 set BYTE,		1			# len(byte) == 1 byte
-set WORD, 		2			# len(word) == 2 bytes
-set LONG, 		4			# len(longword) == 2 bytes
+set WORD,		2			# len(word) == 2 bytes
+set LONG,		4			# len(longword) == 2 bytes
 
 set BSUN_VEC,		0xc0			# bsun    vector offset
 set INEX_VEC,		0xc4			# inexact vector offset
@@ -599,7 +599,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP Ovfl exception stack frame	#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	Overflow Exception enabled:					#
 #	- The system stack is unchanged					#
@@ -610,24 +610,24 @@
 #									#
 # ALGORITHM ***********************************************************	#
 #	On the 060, if an FP overflow is present as the result of any	#
-# instruction, the 060 will take an overflow exception whether the 	#
-# exception is enabled or disabled in the FPCR. For the disabled case, 	#
+# instruction, the 060 will take an overflow exception whether the	#
+# exception is enabled or disabled in the FPCR. For the disabled case,	#
 # This handler emulates the instruction to determine what the correct	#
 # default result should be for the operation. This default result is	#
-# then stored in either the FP regfile, data regfile, or memory. 	#
-# Finally, the handler exits through the "callout" _fpsp_done() 	#
+# then stored in either the FP regfile, data regfile, or memory.	#
+# Finally, the handler exits through the "callout" _fpsp_done()		#
 # denoting that no exceptional conditions exist within the machine.	#
-# 	If the exception is enabled, then this handler must create the	#
+#	If the exception is enabled, then this handler must create the	#
 # exceptional operand and plave it in the fsave state frame, and store	#
-# the default result (only if the instruction is opclass 3). For 	#
-# exceptions enabled, this handler must exit through the "callout" 	#
+# the default result (only if the instruction is opclass 3). For	#
+# exceptions enabled, this handler must exit through the "callout"	#
 # _real_ovfl() so that the operating system enabled overflow handler	#
 # can handle this case.							#
-#	Two other conditions exist. First, if overflow was disabled 	#
-# but the inexact exception was enabled, this handler must exit 	#
+#	Two other conditions exist. First, if overflow was disabled	#
+# but the inexact exception was enabled, this handler must exit		#
 # through the "callout" _real_inex() regardless of whether the result	#
 # was inexact.								#
-#	Also, in the case of an opclass three instruction where 	#
+#	Also, in the case of an opclass three instruction where		#
 # overflow was disabled and the trace exception was enabled, this	#
 # handler must exit through the "callout" _real_trace().		#
 #									#
@@ -642,9 +642,9 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
@@ -668,7 +668,7 @@
 	bsr.l		set_tag_x		# tag the operand type
 	mov.b		%d0,STAG(%a6)		# maybe NORM,DENORM
 
-# bit five of the fp extension word separates the monadic and dyadic operations 
+# bit five of the fp extension word separates the monadic and dyadic operations
 # that can pass through fpsp_ovfl(). remember that fcmp, ftst, and fsincos
 # will never take this exception.
 	btst		&0x5,1+EXC_CMDREG(%a6)	# is operation monadic or dyadic?
@@ -741,7 +741,7 @@
 fovfl_ovfl_on:
 	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP (fp1) to stack
 
-	mov.w		&0xe005,2+FP_SRC(%a6) 	# save exc status
+	mov.w		&0xe005,2+FP_SRC(%a6)	# save exc status
 
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
@@ -757,10 +757,10 @@
 # we must jump to real_inex().
 fovfl_inex_on:
 
-	fmovm.x		&0x40,FP_SRC(%a6) 	# save EXOP (fp1) to stack
+	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP (fp1) to stack
 
 	mov.b		&0xc4,1+EXC_VOFF(%a6)	# vector offset = 0xc4
-	mov.w		&0xe001,2+FP_SRC(%a6) 	# save exc status
+	mov.w		&0xe001,2+FP_SRC(%a6)	# save exc status
 
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
@@ -811,7 +811,7 @@
 	btst		&0x7,(%sp)		# is trace on?
 	beq.l		_fpsp_done		# no
 
-	fmov.l		%fpiar,0x8(%sp)		# "Current PC" is in FPIAR	
+	fmov.l		%fpiar,0x8(%sp)		# "Current PC" is in FPIAR
 	mov.w		&0x2024,0x6(%sp)	# stk fmt = 0x2; voff = 0x024
 	bra.l		_real_trace
 
@@ -839,7 +839,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP Unfl exception stack frame	#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	Underflow Exception enabled:					#
 #	- The system stack is unchanged					#
@@ -850,24 +850,24 @@
 #									#
 # ALGORITHM ***********************************************************	#
 #	On the 060, if an FP underflow is present as the result of any	#
-# instruction, the 060 will take an underflow exception whether the 	#
-# exception is enabled or disabled in the FPCR. For the disabled case, 	#
+# instruction, the 060 will take an underflow exception whether the	#
+# exception is enabled or disabled in the FPCR. For the disabled case,	#
 # This handler emulates the instruction to determine what the correct	#
 # default result should be for the operation. This default result is	#
-# then stored in either the FP regfile, data regfile, or memory. 	#
-# Finally, the handler exits through the "callout" _fpsp_done() 	#
+# then stored in either the FP regfile, data regfile, or memory.	#
+# Finally, the handler exits through the "callout" _fpsp_done()		#
 # denoting that no exceptional conditions exist within the machine.	#
-# 	If the exception is enabled, then this handler must create the	#
+#	If the exception is enabled, then this handler must create the	#
 # exceptional operand and plave it in the fsave state frame, and store	#
-# the default result (only if the instruction is opclass 3). For 	#
-# exceptions enabled, this handler must exit through the "callout" 	#
+# the default result (only if the instruction is opclass 3). For	#
+# exceptions enabled, this handler must exit through the "callout"	#
 # _real_unfl() so that the operating system enabled overflow handler	#
 # can handle this case.							#
-#	Two other conditions exist. First, if underflow was disabled 	#
-# but the inexact exception was enabled and the result was inexact, 	#
+#	Two other conditions exist. First, if underflow was disabled	#
+# but the inexact exception was enabled and the result was inexact,	#
 # this handler must exit through the "callout" _real_inex().		#
 # was inexact.								#
-#	Also, in the case of an opclass three instruction where 	#
+#	Also, in the case of an opclass three instruction where		#
 # underflow was disabled and the trace exception was enabled, this	#
 # handler must exit through the "callout" _real_trace().		#
 #									#
@@ -882,12 +882,12 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
-	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)	
+	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -906,13 +906,13 @@
 	bsr.l		set_tag_x		# tag the operand type
 	mov.b		%d0,STAG(%a6)		# maybe NORM,DENORM
 
-# bit five of the fp ext word separates the monadic and dyadic operations 
+# bit five of the fp ext word separates the monadic and dyadic operations
 # that can pass through fpsp_unfl(). remember that fcmp, and ftst
 # will never take this exception.
 	btst		&0x5,1+EXC_CMDREG(%a6)	# is op monadic or dyadic?
 	beq.b		funfl_extract		# monadic
 
-# now, what's left that's not dyadic is fsincos. we can distinguish it 
+# now, what's left that's not dyadic is fsincos. we can distinguish it
 # from all dyadics by the '0110xxx pattern
 	btst		&0x4,1+EXC_CMDREG(%a6)	# is op an fsincos?
 	bne.b		funfl_extract		# yes
@@ -963,7 +963,7 @@
 # (0x00000000_80000000_00000000), then the machine will take an
 # underflow exception. Since this is incorrect, we need to check
 # if our emulation, after re-doing the operation, decided that
-# no underflow was called for. We do these checks only in 
+# no underflow was called for. We do these checks only in
 # funfl_{unfl,inex}_on() because w/ both exceptions disabled, this
 # special case will simply exit gracefully with the correct result.
 
@@ -1003,7 +1003,7 @@
 funfl_unfl_on2:
 	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP (fp1) to stack
 
-	mov.w		&0xe003,2+FP_SRC(%a6) 	# save exc status
+	mov.w		&0xe003,2+FP_SRC(%a6)	# save exc status
 
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
@@ -1022,7 +1022,7 @@
 # The `060 FPU multiplier hardware is such that if the result of a
 # multiply operation is the smallest possible normalized number
 # (0x00000000_80000000_00000000), then the machine will take an
-# underflow exception. 
+# underflow exception.
 # But, whether bogus or not, if inexact is enabled AND it occurred,
 # then we have to branch to real_inex.
 
@@ -1031,10 +1031,10 @@
 
 funfl_inex_on2:
 
-	fmovm.x		&0x40,FP_SRC(%a6) 	# save EXOP to stack
+	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP to stack
 
 	mov.b		&0xc4,1+EXC_VOFF(%a6)	# vector offset = 0xc4
-	mov.w		&0xe001,2+FP_SRC(%a6) 	# save exc status
+	mov.w		&0xe001,2+FP_SRC(%a6)	# save exc status
 
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
@@ -1120,7 +1120,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the "Unimp Data Type" stk frame	#
 #	- The fsave frame contains the ssrc op (for UNNORM/DENORM)	#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If Inexact exception (opclass 3):				#
 #	- The system stack is changed to an Inexact exception stk frame	#
@@ -1139,12 +1139,12 @@
 #									#
 # ALGORITHM ***********************************************************	#
 #	Two main instruction types can enter here: (1) DENORM or UNNORM	#
-# unimplemented data types. These can be either opclass 0,2 or 3 	#
+# unimplemented data types. These can be either opclass 0,2 or 3	#
 # instructions, and (2) PACKED unimplemented data format instructions	#
 # also of opclasses 0,2, or 3.						#
 #	For UNNORM/DENORM opclass 0 and 2, the handler fetches the src	#
 # operand from the fsave state frame and the dst operand (if dyadic)	#
-# from the FP register file. The instruction is then emulated by 	#
+# from the FP register file. The instruction is then emulated by	#
 # choosing an emulation routine from a table of routines indexed by	#
 # instruction type. Once the instruction has been emulated and result	#
 # saved, then we check to see if any enabled exceptions resulted from	#
@@ -1166,7 +1166,7 @@
 # (a Trace stack frame must be created here, too). If an FP exception	#
 # should occur, then we must create an exception stack frame of that	#
 # type and jump to either _real_snan(), _real_operr(), _real_inex(),	#
-# _real_unfl(), or _real_ovfl() as appropriate. PACKED opclass 3 	#
+# _real_unfl(), or _real_ovfl() as appropriate. PACKED opclass 3	#
 # emulation is performed in a similar manner.				#
 #									#
 #########################################################################
@@ -1178,7 +1178,7 @@
 #				*****************
 #				*      EA	*
 #	 pre-instruction	*		*
-# 	*****************	*****************
+#	*****************	*****************
 #	* 0x0 *  0x0dc  *	* 0x3 *  0x0dc  *
 #	*****************	*****************
 #	*     Next	*	*     Next	*
@@ -1207,9 +1207,9 @@
 
 	fsave		FP_SRC(%a6)		# save fp state
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 	btst		&0x5,EXC_SR(%a6)	# user or supervisor mode?
 	bne.b		fu_s
@@ -1258,7 +1258,7 @@
 	fmov.l		&0x0,%fpsr
 
 # Opclass two w/ memory-to-fpn operation will have an incorrect extended
-# precision format if the src format was single or double and the 
+# precision format if the src format was single or double and the
 # source data type was an INF, NAN, DENORM, or UNNORM
 	lea		FP_SRC(%a6),%a0		# pass ptr to input
 	bsr.l		fix_skewed_ops
@@ -1277,7 +1277,7 @@
 
 	bfextu		EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
 
-# bit five of the fp extension word separates the monadic and dyadic operations 
+# bit five of the fp extension word separates the monadic and dyadic operations
 # at this point
 	btst		&0x5,1+EXC_CMDREG(%a6)	# is operation monadic or dyadic?
 	beq.b		fu_extract		# monadic
@@ -1308,13 +1308,13 @@
 
 #
 # Exceptions in order of precedence:
-# 	BSUN	: none
+#	BSUN	: none
 #	SNAN	: all dyadic ops
 #	OPERR	: fsqrt(-NORM)
 #	OVFL	: all except ftst,fcmp
 #	UNFL	: all except ftst,fcmp
 #	DZ	: fdiv
-# 	INEX2	: all except ftst,fcmp
+#	INEX2	: all except ftst,fcmp
 #	INEX1	: none (packed doesn't go through here)
 #
 
@@ -1351,16 +1351,16 @@
 #
 # No exceptions occurred that were also enabled. Now:
 #
-#   	if (OVFL && ovfl_disabled && inexact_enabled) {
+#	if (OVFL && ovfl_disabled && inexact_enabled) {
 #	    branch to _real_inex() (even if the result was exact!);
-#     	} else {
+#	} else {
 #	    save the result in the proper fp reg (unless the op is fcmp or ftst);
 #	    return;
-#     	}
+#	}
 #
 	btst		&ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
 	beq.b		fu_in_cont		# no
-	
+
 fu_in_ovflchk:
 	btst		&inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
 	beq.b		fu_in_cont		# no
@@ -1380,7 +1380,7 @@
 #	} else {
 #		restore exc state (SNAN||OPERR||OVFL||UNFL||DZ||INEX) into the FPU;
 #	}
-#	    		
+#
 fu_in_exc:
 	subi.l		&24,%d0			# fix offset to be 0-8
 	cmpi.b		%d0,&0x6		# is exception INEX? (6)
@@ -1393,7 +1393,7 @@
 	bne.w		fu_in_exc_ovfl		# yes
 
 # here, we insert the correct fsave status value into the fsave frame for the
-# corresponding exception. the operand in the fsave frame should be the original 
+# corresponding exception. the operand in the fsave frame should be the original
 # src operand.
 fu_in_exc_exit:
 	mov.l		%d0,-(%sp)		# save d0
@@ -1424,8 +1424,8 @@
 	bra.b		fu_in_exc_exit
 
 # If the input operand to this operation was opclass two and a single
-# or double precision denorm, inf, or nan, the operand needs to be 
-# "corrected" in order to have the proper equivalent extended precision 
+# or double precision denorm, inf, or nan, the operand needs to be
+# "corrected" in order to have the proper equivalent extended precision
 # number.
 	global		fix_skewed_ops
 fix_skewed_ops:
@@ -1453,7 +1453,7 @@
 	bsr.l		norm			# normalize mantissa
 	neg.w		%d0			# -shft amt
 	addi.w		&0x3f81,%d0		# adjust new exponent
-	andi.w		&0x8000,LOCAL_EX(%a0) 	# clear old exponent
+	andi.w		&0x8000,LOCAL_EX(%a0)	# clear old exponent
 	or.w		%d0,LOCAL_EX(%a0)	# insert new exponent
 	rts
 
@@ -1462,7 +1462,7 @@
 	rts
 
 fso_infnan:
-	andi.b		&0x7f,LOCAL_HI(%a0) 	# clear j-bit
+	andi.b		&0x7f,LOCAL_HI(%a0)	# clear j-bit
 	ori.w		&0x7fff,LOCAL_EX(%a0)	# make exponent = $7fff
 	rts
 
@@ -1485,7 +1485,7 @@
 	bsr.l		norm			# normalize mantissa
 	neg.w		%d0			# -shft amt
 	addi.w		&0x3c01,%d0		# adjust new exponent
-	andi.w		&0x8000,LOCAL_EX(%a0) 	# clear old exponent
+	andi.w		&0x8000,LOCAL_EX(%a0)	# clear old exponent
 	or.w		%d0,LOCAL_EX(%a0)	# insert new exponent
 	rts
 
@@ -1537,13 +1537,13 @@
 	bsr.l		fout			# call fmove out routine
 
 # Exceptions in order of precedence:
-# 	BSUN	: none
+#	BSUN	: none
 #	SNAN	: none
 #	OPERR	: fmove.{b,w,l} out of large UNNORM
 #	OVFL	: fmove.{s,d}
 #	UNFL	: fmove.{s,d,x}
 #	DZ	: none
-# 	INEX2	: all
+#	INEX2	: all
 #	INEX1	: none (packed doesn't travel through here)
 
 # determine the highest priority exception(if any) set by the
@@ -1555,7 +1555,7 @@
 
 	mov.l		EXC_A6(%a6),(%a6)	# in case a6 changed
 
-# on extended precision opclass three instructions using pre-decrement or 
+# on extended precision opclass three instructions using pre-decrement or
 # post-increment addressing mode, the address register is not updated. is the
 # address register was the stack pointer used from user mode, then let's update
 # it here. if it was used from supervisor mode, then we have to handle this
@@ -1579,7 +1579,7 @@
 	bra.l		_fpsp_done
 
 # is the ea mode pre-decrement of the stack pointer from supervisor mode?
-# ("fmov.x fpm,-(a7)") if so, 
+# ("fmov.x fpm,-(a7)") if so,
 fu_out_done_s:
 	cmpi.b		SPCOND_FLG(%a6),&mda7_flg
 	bne.b		fu_out_done_cont
@@ -1617,7 +1617,7 @@
 	bfffo		%d0{&24:&8},%d0		# find highest priority exception
 	bne.b		fu_out_exc		# there is at least one set
 
-# no exceptions were set. 
+# no exceptions were set.
 # if a disabled overflow occurred and inexact was enabled but the result
 # was exact, then a branch to _real_inex() is made.
 	btst		&ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
@@ -1634,7 +1634,7 @@
 # from FPIAR and put it in the trace stack frame then jump to _real_trace().
 #
 #		  UNSUPP FRAME		   TRACE FRAME
-# 		*****************	*****************
+#		*****************	*****************
 #		*      EA	*	*    Current	*
 #		*		*	*      PC	*
 #		*****************	*****************
@@ -1651,7 +1651,7 @@
 	fmov.l		%fpiar,0x8(%sp)
 	bra.l		_real_trace
 
-# an exception occurred and that exception was enabled. 	
+# an exception occurred and that exception was enabled.
 fu_out_exc:
 	subi.l		&24,%d0			# fix offset to be 0-8
 
@@ -1663,15 +1663,15 @@
 	swbeg		&0x8
 tbl_fu_out:
 	short		tbl_fu_out	- tbl_fu_out	# BSUN can't happen
-	short		tbl_fu_out 	- tbl_fu_out	# SNAN can't happen
+	short		tbl_fu_out	- tbl_fu_out	# SNAN can't happen
 	short		fu_operr	- tbl_fu_out	# OPERR
-	short		fu_ovfl 	- tbl_fu_out	# OVFL
-	short		fu_unfl 	- tbl_fu_out	# UNFL
+	short		fu_ovfl		- tbl_fu_out	# OVFL
+	short		fu_unfl		- tbl_fu_out	# UNFL
 	short		tbl_fu_out	- tbl_fu_out	# DZ can't happen
-	short		fu_inex 	- tbl_fu_out	# INEX2
+	short		fu_inex		- tbl_fu_out	# INEX2
 	short		tbl_fu_out	- tbl_fu_out	# INEX1 won't make it here
 
-# for snan,operr,ovfl,unfl, src op is still in FP_SRC so just 
+# for snan,operr,ovfl,unfl, src op is still in FP_SRC so just
 # frestore it.
 fu_snan:
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0/fp1
@@ -1722,7 +1722,7 @@
 # underflow can happen for extended precision. extended precision opclass
 # three instruction exceptions don't update the stack pointer. so, if the
 # exception occurred from user mode, then simply update a7 and exit normally.
-# if the exception occurred from supervisor mode, check if 
+# if the exception occurred from supervisor mode, check if
 fu_unfl:
 	mov.l		EXC_A6(%a6),(%a6)	# restore a6
 
@@ -1731,7 +1731,7 @@
 
 	mov.l		EXC_A7(%a6),%a0		# restore a7 whether we need
 	mov.l		%a0,%usp		# to or not...
-	
+
 fu_unfl_cont:
 	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP to the stack
 
@@ -1822,7 +1822,7 @@
 
 	bfextu		EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
 
-# bit five of the fp extension word separates the monadic and dyadic operations 
+# bit five of the fp extension word separates the monadic and dyadic operations
 # at this point
 	btst		&0x5,1+EXC_CMDREG(%a6)	# is operation monadic or dyadic?
 	beq.b		fu_extract_p		# monadic
@@ -1853,13 +1853,13 @@
 
 #
 # Exceptions in order of precedence:
-# 	BSUN	: none
+#	BSUN	: none
 #	SNAN	: all dyadic ops
 #	OPERR	: fsqrt(-NORM)
 #	OVFL	: all except ftst,fcmp
 #	UNFL	: all except ftst,fcmp
 #	DZ	: fdiv
-# 	INEX2	: all except ftst,fcmp
+#	INEX2	: all except ftst,fcmp
 #	INEX1	: all
 #
 
@@ -1929,16 +1929,16 @@
 #
 # No exceptions occurred that were also enabled. Now:
 #
-#   	if (OVFL && ovfl_disabled && inexact_enabled) {
+#	if (OVFL && ovfl_disabled && inexact_enabled) {
 #	    branch to _real_inex() (even if the result was exact!);
-#     	} else {
+#	} else {
 #	    save the result in the proper fp reg (unless the op is fcmp or ftst);
 #	    return;
-#     	}
+#	}
 #
 	btst		&ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
 	beq.w		fu_in_cont_p		# no
-	
+
 fu_in_ovflchk_p:
 	btst		&inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
 	beq.w		fu_in_cont_p		# no
@@ -1958,7 +1958,7 @@
 #	} else {
 #		restore exc state (SNAN||OPERR||OVFL||UNFL||DZ||INEX) into the FPU;
 #	}
-#	    		
+#
 fu_in_exc_p:
 	subi.l		&24,%d0			# fix offset to be 0-8
 	cmpi.b		%d0,&0x6		# is exception INEX? (6 or 7)
@@ -1971,7 +1971,7 @@
 	bne.w		fu_in_exc_ovfl_p	# yes
 
 # here, we insert the correct fsave status value into the fsave frame for the
-# corresponding exception. the operand in the fsave frame should be the original 
+# corresponding exception. the operand in the fsave frame should be the original
 # src operand.
 # as a reminder for future predicted pain and agony, we are passing in fsave the
 # "non-skewed" operand for cases of sgl and dbl src INFs,NANs, and DENORMs.
@@ -2034,21 +2034,21 @@
 	bne.b		fu_trace_p		# yes
 
 	bra.l		_fpsp_done		# exit to os
-	
+
 #
-# The opclass two PACKED instruction that took an "Unimplemented Data Type" 
-# exception was being traced. Make the "current" PC the FPIAR and put it in the 
+# The opclass two PACKED instruction that took an "Unimplemented Data Type"
+# exception was being traced. Make the "current" PC the FPIAR and put it in the
 # trace stack frame then jump to _real_trace().
-#					
+#
 #		  UNSUPP FRAME		   TRACE FRAME
 #		*****************	*****************
 #		*      EA	*	*    Current	*
 #		*		*	*      PC	*
 #		*****************	*****************
-#		* 0x2 *	0x0dc	* 	* 0x2 *  0x024	*
+#		* 0x2 *	0x0dc	*	* 0x2 *  0x024	*
 #		*****************	*****************
 #		*     Next	*	*     Next	*
-#		*      PC	*      	*      PC	*
+#		*      PC	*	*      PC	*
 #		*****************	*****************
 #		*      SR	*	*      SR	*
 #		*****************	*****************
@@ -2094,13 +2094,13 @@
 	bsr.l		fout			# call fmove out routine
 
 # Exceptions in order of precedence:
-# 	BSUN	: no
+#	BSUN	: no
 #	SNAN	: yes
 #	OPERR	: if ((k_factor > +17) || (dec. exp exceeds 3 digits))
 #	OVFL	: no
 #	UNFL	: no
 #	DZ	: no
-# 	INEX2	: yes
+#	INEX2	: yes
 #	INEX1	: no
 
 # determine the highest priority exception(if any) set by the
@@ -2164,7 +2164,7 @@
 
 	mov.l		EXC_A6(%a6),(%a6)	# restore a6
 
-# an exception occurred and that exception was enabled. 	
+# an exception occurred and that exception was enabled.
 # the only exception possible on packed move out are INEX, OPERR, and SNAN.
 fu_out_exc_p:
 	cmpi.b		%d0,&0x1a
@@ -2191,7 +2191,7 @@
 	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	mov.w		&0x30d8,EXC_VOFF(%a6)	# vector offset = 0xd0
-	mov.w		&0xe006,2+FP_SRC(%a6) 	# set fsave status
+	mov.w		&0xe006,2+FP_SRC(%a6)	# set fsave status
 
 	frestore	FP_SRC(%a6)		# restore src operand
 
@@ -2231,7 +2231,7 @@
 	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	mov.w		&0x30d0,EXC_VOFF(%a6)	# vector offset = 0xd0
-	mov.w		&0xe004,2+FP_SRC(%a6) 	# set fsave status
+	mov.w		&0xe004,2+FP_SRC(%a6)	# set fsave status
 
 	frestore	FP_SRC(%a6)		# restore src operand
 
@@ -2270,8 +2270,8 @@
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
 	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
-	mov.w		&0x30c4,EXC_VOFF(%a6) 	# vector offset = 0xc4
-	mov.w		&0xe001,2+FP_SRC(%a6) 	# set fsave status
+	mov.w		&0x30c4,EXC_VOFF(%a6)	# vector offset = 0xc4
+	mov.w		&0xe001,2+FP_SRC(%a6)	# set fsave status
 
 	frestore	FP_SRC(%a6)		# restore src operand
 
@@ -2312,7 +2312,7 @@
 	andi.w		&0x7fff,%d0		# strip sign
 	beq.b		funimp_skew_sgl_not
 	cmpi.w		%d0,&0x3f80
-	bgt.b		funimp_skew_sgl_not		
+	bgt.b		funimp_skew_sgl_not
 	neg.w		%d0			# make exponent negative
 	addi.w		&0x3f81,%d0		# find amt to shift
 	mov.l		FP_SRC_HI(%a6),%d1	# fetch DENORM hi(man)
@@ -2329,7 +2329,7 @@
 	andi.w		&0x7fff,%d0		# strip sign
 	beq.b		funimp_skew_dbl_not
 	cmpi.w		%d0,&0x3c00
-	bgt.b		funimp_skew_dbl_not		
+	bgt.b		funimp_skew_dbl_not
 
 	tst.b		FP_SRC_EX(%a6)		# make "internal format"
 	smi.b		0x2+FP_SRC(%a6)
@@ -2362,7 +2362,7 @@
 #########################################################################
 # XDEF ****************************************************************	#
 #	_fpsp_effadd(): 060FPSP entry point for FP "Unimplemented	#
-#		     	effective address" exception.			#
+#			effective address" exception.			#
 #									#
 #	This handler should be the first code executed upon taking the	#
 #	FP Unimplemented Effective Address exception in an operating	#
@@ -2387,7 +2387,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	- The system stack contains the "Unimplemented <ea>" stk frame	#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If access error:						#
 #	- The system stack is changed to an access error stack frame	#
@@ -2408,17 +2408,17 @@
 #	For immediate data operations, the data is read in w/ a		#
 # _mem_read() "callout", converted to FP binary (if packed), and used	#
 # as the source operand to the instruction specified by the instruction	#
-# word. If no FP exception should be reported ads a result of the 	#
+# word. If no FP exception should be reported ads a result of the	#
 # emulation, then the result is stored to the destination register and	#
 # the handler exits through _fpsp_done(). If an enabled exc has been	#
 # signalled as a result of emulation, then an fsave state frame		#
 # corresponding to the FP exception type must be entered into the 060	#
-# FPU before exiting. In either the enabled or disabled cases, we 	#
+# FPU before exiting. In either the enabled or disabled cases, we	#
 # must also check if a Trace exception is pending, in which case, we	#
 # must create a Trace exception stack frame from the current exception	#
 # stack frame. If no Trace is pending, we simply exit through		#
 # _fpsp_done().								#
-#	For "fmovm.x", call the routine fmovm_dynamic() which will 	#
+#	For "fmovm.x", call the routine fmovm_dynamic() which will	#
 # decode and emulate the instruction. No FP exceptions can be pending	#
 # as a result of this operation emulation. A Trace exception can be	#
 # pending, though, which means the current stack frame must be changed	#
@@ -2437,11 +2437,11 @@
 # before the "FPU disabled" exception, but the "FPU disabled" exception	#
 # has higher priority, we check the disabled bit in the PCR. If set,	#
 # then we must create an 8 word "FPU disabled" exception stack frame	#
-# from the current 4 word exception stack frame. This includes 		#
-# reproducing the effective address of the instruction to put on the 	#
+# from the current 4 word exception stack frame. This includes		#
+# reproducing the effective address of the instruction to put on the	#
 # new stack frame.							#
 #									#
-# 	In the process of all emulation work, if a _mem_read()		#
+#	In the process of all emulation work, if a _mem_read()		#
 # "callout" returns a failing result indicating an access error, then	#
 # we must create an access error stack frame from the current stack	#
 # frame. This information includes a faulting address and a fault-	#
@@ -2482,18 +2482,18 @@
 
 #
 # here, we will have:
-# 	fabs	fdabs	fsabs		facos		fmod
+#	fabs	fdabs	fsabs		facos		fmod
 #	fadd	fdadd	fsadd		fasin		frem
-# 	fcmp				fatan		fscale
+#	fcmp				fatan		fscale
 #	fdiv	fddiv	fsdiv		fatanh		fsin
 #	fint				fcos		fsincos
 #	fintrz				fcosh		fsinh
 #	fmove	fdmove	fsmove		fetox		ftan
-# 	fmul	fdmul	fsmul		fetoxm1		ftanh
+#	fmul	fdmul	fsmul		fetoxm1		ftanh
 #	fneg	fdneg	fsneg		fgetexp		ftentox
 #	fsgldiv				fgetman		ftwotox
-# 	fsglmul				flog10
-# 	fsqrt				flog2
+#	fsglmul				flog10
+#	fsqrt				flog2
 #	fsub	fdsub	fssub		flogn
 #	ftst				flognp1
 # which can all use f<op>.{x,p}
@@ -2585,8 +2585,8 @@
 # store a result. then, only fcmp will branch back and pick up a dst operand.
 	st		STORE_FLG(%a6)		# don't store a final result
 	btst		&0x1,1+EXC_CMDREG(%a6)	# is operation fcmp?
-	beq.b		iea_op_loaddst		# yes	
-	
+	beq.b		iea_op_loaddst		# yes
+
 iea_op_extract:
 	clr.l		%d0
 	mov.b		FPCR_MODE(%a6),%d0	# pass: rnd mode,prec
@@ -2659,7 +2659,7 @@
 	btst		&inex2_bit,FPCR_ENABLE(%a6) # is inexact enabled?
 	beq.b		iea_op_store		# no
 	bra.b		iea_op_exc_ovfl		# yes
-	
+
 # an enabled exception occurred. we have to insert the exception type back into
 # the machine.
 iea_op_exc:
@@ -2698,7 +2698,7 @@
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
 	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
-	frestore 	FP_SRC(%a6)		# restore exceptional state
+	frestore	FP_SRC(%a6)		# restore exceptional state
 
 	unlk		%a6			# unravel the frame
 
@@ -2706,12 +2706,12 @@
 	bne.b		iea_op_trace		# yes
 
 	bra.l		_fpsp_done		# exit to os
-	
+
 #
 # The opclass two instruction that took an "Unimplemented Effective Address"
 # exception was being traced. Make the "current" PC the FPIAR and put it in
 # the trace stack frame then jump to _real_trace().
-#					
+#
 #		 UNIMP EA FRAME		   TRACE FRAME
 #		*****************	*****************
 #		* 0x0 *  0x0f0	*	*    Current	*
@@ -2744,7 +2744,7 @@
 
 iea_fmovm_data_u:
 	mov.l		%usp,%a0
-	mov.l		%a0,EXC_A7(%a6)		# store current a7	
+	mov.l		%a0,EXC_A7(%a6)		# store current a7
 	bsr.l		fmovm_dynamic		# do dynamic fmovm
 	mov.l		EXC_A7(%a6),%a0		# load possibly new a7
 	mov.l		%a0,%usp		# update usp
@@ -2775,10 +2775,10 @@
 
 	lea		(EXC_SR,%a6,%d0),%a0
 	mov.l		%a0,EXC_SR(%a6)
-	
+
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	unlk		%a6
 	mov.l		(%sp)+,%sp
@@ -2792,15 +2792,15 @@
 
 	lea		(EXC_SR-0x4,%a6,%d0),%a0
 	mov.l		%a0,EXC_SR(%a6)
-	
+
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	unlk		%a6
 	mov.l		(%sp)+,%sp
 	bra.l		_real_trace
-	
+
 # right now, d1 = size and d0 = the strg.
 iea_fmovm_data_predec:
 	mov.b		%d1,EXC_VOFF(%a6)	# store strg
@@ -2808,7 +2808,7 @@
 
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	mov.l		(%a6),-(%sp)		# make a copy of a6
 	mov.l		%d0,-(%sp)		# save d0
@@ -2910,10 +2910,10 @@
 
 #
 # The control reg instruction that took an "Unimplemented Effective Address"
-# exception was being traced. The "Current PC" for the trace frame is the 
+# exception was being traced. The "Current PC" for the trace frame is the
 # PC stacked for Unimp EA. The "Next PC" is in EXC_EXTWPTR.
 # After fixing the stack frame, jump to _real_trace().
-#					
+#
 #		 UNIMP EA FRAME		   TRACE FRAME
 #		*****************	*****************
 #		* 0x0 *  0x0f0	*	*    Current	*
@@ -3066,7 +3066,7 @@
 #	_fpsp_operr(): 060FPSP entry point for FP Operr exception.	#
 #									#
 #	This handler should be the first code executed upon taking the	#
-# 	FP Operand Error exception in an operating system.		#
+#	FP Operand Error exception in an operating system.		#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_long() - read instruction longword			#
@@ -3079,7 +3079,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP Operr exception frame	#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	No access error:						#
 #	- The system stack is unchanged					#
@@ -3088,16 +3088,16 @@
 # ALGORITHM ***********************************************************	#
 #	In a system where the FP Operr exception is enabled, the goal	#
 # is to get to the handler specified at _real_operr(). But, on the 060,	#
-# for opclass zero and two instruction taking this exception, the 	#
+# for opclass zero and two instruction taking this exception, the	#
 # input operand in the fsave frame may be incorrect for some cases	#
 # and needs to be corrected. This handler calls fix_skewed_ops() to	#
 # do just this and then exits through _real_operr().			#
 #	For opclass 3 instructions, the 060 doesn't store the default	#
 # operr result out to memory or data register file as it should.	#
 # This code must emulate the move out before finally exiting through	#
-# _real_inex(). The move out, if to memory, is performed using 		#
+# _real_inex(). The move out, if to memory, is performed using		#
 # _mem_write() "callout" routines that may return a failing result.	#
-# In this special case, the handler must exit through facc_out() 	#
+# In this special case, the handler must exit through facc_out()	#
 # which creates an access error stack frame from the current operr	#
 # stack frame.								#
 #									#
@@ -3110,13 +3110,13 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -3130,7 +3130,7 @@
 
 # here, we simply see if the operand in the fsave frame needs to be "unskewed".
 # this would be the case for opclass two operations with a source infinity or
-# denorm operand in the sgl or dbl format. NANs also become skewed, but can't 
+# denorm operand in the sgl or dbl format. NANs also become skewed, but can't
 # cause an operr so we don't need to check for them here.
 	lea		FP_SRC(%a6),%a0		# pass: ptr to src op
 	bsr.l		fix_skewed_ops		# fix src op
@@ -3201,7 +3201,7 @@
 	short		tbl_operr    - tbl_operr # dbl prec shouldn't happen
 	short		foperr_out_b - tbl_operr # byte integer
 	short		tbl_operr    - tbl_operr # packed won't enter here
-	
+
 foperr_out_b:
 	mov.b		L_SCR1(%a6),%d0		# load positive default result
 	cmpi.b		%d1,&0x7		# is <ea> mode a data reg?
@@ -3255,7 +3255,7 @@
 #	_fpsp_snan(): 060FPSP entry point for FP SNAN exception.	#
 #									#
 #	This handler should be the first code executed upon taking the	#
-# 	FP Signalling NAN exception in an operating system.		#
+#	FP Signalling NAN exception in an operating system.		#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_long() - read instruction longword			#
@@ -3269,7 +3269,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP SNAN exception frame		#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	No access error:						#
 #	- The system stack is unchanged					#
@@ -3278,16 +3278,16 @@
 # ALGORITHM ***********************************************************	#
 #	In a system where the FP SNAN exception is enabled, the goal	#
 # is to get to the handler specified at _real_snan(). But, on the 060,	#
-# for opclass zero and two instructions taking this exception, the 	#
+# for opclass zero and two instructions taking this exception, the	#
 # input operand in the fsave frame may be incorrect for some cases	#
 # and needs to be corrected. This handler calls fix_skewed_ops() to	#
 # do just this and then exits through _real_snan().			#
 #	For opclass 3 instructions, the 060 doesn't store the default	#
 # SNAN result out to memory or data register file as it should.		#
 # This code must emulate the move out before finally exiting through	#
-# _real_snan(). The move out, if to memory, is performed using 		#
+# _real_snan(). The move out, if to memory, is performed using		#
 # _mem_write() "callout" routines that may return a failing result.	#
-# In this special case, the handler must exit through facc_out() 	#
+# In this special case, the handler must exit through facc_out()	#
 # which creates an access error stack frame from the current SNAN	#
 # stack frame.								#
 #	For the case of an extended precision opclass 3 instruction,	#
@@ -3306,13 +3306,13 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -3340,7 +3340,7 @@
 
 	unlk		%a6
 	bra.l		_real_snan
-		
+
 ########################################################################
 
 #
@@ -3350,7 +3350,7 @@
 #
 # byte, word, long, and packed destination format operations can pass
 # through here. since packed format operations already were handled by
-# fpsp_unsupp(), then we need to do nothing else for them here. 
+# fpsp_unsupp(), then we need to do nothing else for them here.
 # for byte, word, and long, we simply need to test the sign of the src
 # operand and save the appropriate minimum or maximum integer value
 # to the effective address as pointed to by the stacked effective address.
@@ -3371,7 +3371,7 @@
 	short		fsnan_out_d - tbl_snan # dbl prec shouldn't happen
 	short		fsnan_out_b - tbl_snan # byte integer
 	short		tbl_snan    - tbl_snan # packed needs no help
-	
+
 fsnan_out_b:
 	mov.b		FP_SRC_HI(%a6),%d0	# load upper byte of SNAN
 	bset		&6,%d0			# set SNAN bit
@@ -3497,7 +3497,7 @@
 	mov.l		%usp,%a0		# fetch user stack pointer
 	mov.l		%a0,EXC_A7(%a6)		# save on stack for calc_ea()
 	mov.l		(%a6),EXC_A6(%a6)
-	
+
 	bsr.l		_calc_ea_fout		# find the correct ea,update An
 	mov.l		%a0,%a1
 	mov.l		%a0,EXC_EA(%a6)		# stack correct <ea>
@@ -3546,7 +3546,7 @@
 	mov.l		LOCAL_SIZE+FP_SCR0_LO(%sp),LOCAL_SIZE+EXC_EA(%sp)
 
 	add.l		&LOCAL_SIZE-0x8,%sp
-	
+
 	bra.l		_real_snan
 
 #########################################################################
@@ -3554,7 +3554,7 @@
 #	_fpsp_inex(): 060FPSP entry point for FP Inexact exception.	#
 #									#
 #	This handler should be the first code executed upon taking the	#
-# 	FP Inexact exception in an operating system.			#
+#	FP Inexact exception in an operating system.			#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_long() - read instruction longword			#
@@ -3571,7 +3571,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP Inexact exception frame	#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	- The system stack is unchanged					#
 #	- The fsave frame contains the adjusted src op for opclass 0,2	#
@@ -3579,10 +3579,10 @@
 # ALGORITHM ***********************************************************	#
 #	In a system where the FP Inexact exception is enabled, the goal	#
 # is to get to the handler specified at _real_inex(). But, on the 060,	#
-# for opclass zero and two instruction taking this exception, the 	#
+# for opclass zero and two instruction taking this exception, the	#
 # hardware doesn't store the correct result to the destination FP	#
-# register as did the '040 and '881/2. This handler must emulate the 	#
-# instruction in order to get this value and then store it to the 	#
+# register as did the '040 and '881/2. This handler must emulate the	#
+# instruction in order to get this value and then store it to the	#
 # correct register before calling _real_inex().				#
 #	For opclass 3 instructions, the 060 doesn't store the default	#
 # inexact result out to memory or data register file as it should.	#
@@ -3598,13 +3598,13 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -3616,7 +3616,7 @@
 	bne.w		finex_out		# fmove out
 
 
-# the hardware, for "fabs" and "fneg" w/ a long source format, puts the 
+# the hardware, for "fabs" and "fneg" w/ a long source format, puts the
 # longword integer directly into the upper longword of the mantissa along
 # w/ an exponent value of 0x401e. we convert this to extended precision here.
 	bfextu		%d0{&19:&3},%d0		# fetch instr size
@@ -3750,7 +3750,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP DZ exception stack.		#
 #	- The fsave frame contains the source operand.			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	- The system stack contains the FP DZ exception stack.		#
 #	- The fsave frame contains the adjusted source operand.		#
@@ -3761,7 +3761,7 @@
 # exception is taken, the input operand in the fsave state frame may	#
 # be incorrect for some cases and need to be adjusted. So, this package	#
 # adjusts the operand using fix_skewed_ops() and then branches to	#
-# _real_dz(). 								#
+# _real_dz().								#
 #									#
 #########################################################################
 
@@ -3772,13 +3772,13 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -3819,7 +3819,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains a "Line F Emulator" exception	#
 #	  stack frame.							#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	- The system stack is unchanged					#
 #									#
@@ -3830,7 +3830,7 @@
 #	(2) FPU disabled (8 word stack frame)				#
 #	(3) Line F (4 word stack frame)					#
 #									#
-#	This module determines which and forks the flow off to the 	#
+#	This module determines which and forks the flow off to the	#
 # appropriate "callout" (for "disabled" and "Line F") or to the		#
 # correct emulation code (for "FPU unimplemented").			#
 #	This code also must check for "fmovecr" instructions w/ a	#
@@ -3943,11 +3943,11 @@
 #	_fdbcc() - emulate an "fdbcc" instruction			#
 #	_fscc() - emulate an "fscc" instruction				#
 #	_real_trap() - "callout" for Trap exception			#
-# 	_real_bsun() - "callout" for enabled Bsun exception		#
+#	_real_bsun() - "callout" for enabled Bsun exception		#
 #									#
 # INPUT ***************************************************************	#
 #	- The system stack contains the "Unimplemented Instr" stk frame	#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If access error:						#
 #	- The system stack is changed to an access error stack frame	#
@@ -3962,21 +3962,21 @@
 # unimplemented on the 040, and (2) "ftrapcc", "fscc", and "fdbcc".	#
 #	For the first set, this handler calls the routine load_fop()	#
 # to load the source and destination (for dyadic) operands to be used	#
-# for instruction emulation. The correct emulation routine is then 	#
-# chosen by decoding the instruction type and indexing into an 		#
-# emulation subroutine index table. After emulation returns, this 	#
+# for instruction emulation. The correct emulation routine is then	#
+# chosen by decoding the instruction type and indexing into an		#
+# emulation subroutine index table. After emulation returns, this	#
 # handler checks to see if an exception should occur as a result of the #
 # FP instruction emulation. If so, then an FP exception of the correct	#
 # type is inserted into the FPU state frame using the "frestore"	#
-# instruction before exiting through _fpsp_done(). In either the 	#
+# instruction before exiting through _fpsp_done(). In either the	#
 # exceptional or non-exceptional cases, we must check to see if the	#
 # Trace exception is enabled. If so, then we must create a Trace	#
 # exception frame from the current exception frame and exit through	#
 # _real_trace().							#
-# 	For "fdbcc", "ftrapcc", and "fscc", the emulation subroutines	#
+#	For "fdbcc", "ftrapcc", and "fscc", the emulation subroutines	#
 # _fdbcc(), _ftrapcc(), and _fscc() respectively are used. All three	#
-# may flag that a BSUN exception should be taken. If so, then the 	#
-# current exception stack frame is converted into a BSUN exception 	#
+# may flag that a BSUN exception should be taken. If so, then the	#
+# current exception stack frame is converted into a BSUN exception	#
 # stack frame and an exit is made through _real_bsun(). If the		#
 # instruction was "ftrapcc" and a Trap exception should result, a Trap	#
 # exception stack frame is created from the current frame and an exit	#
@@ -3985,7 +3985,7 @@
 # is made to _real_trace(). Finally, if none of these conditions exist,	#
 # then the handler exits though the callout _fpsp_done().		#
 #									#
-# 	In any of the above scenarios, if a _mem_read() or _mem_write()	#
+#	In any of the above scenarios, if a _mem_read() or _mem_write()	#
 # "callout" returns a failing value, then an access error stack frame	#
 # is created from the current stack frame and an exit is made through	#
 # _real_access().							#
@@ -4077,7 +4077,7 @@
 	beq.w		funimp_fmovcr		# yes
 
 funimp_gen_op:
-	bsr.l		_load_fop		# load 
+	bsr.l		_load_fop		# load
 
 	clr.l		%d0
 	mov.b		FPCR_MODE(%a6),%d0	# fetch rnd mode
@@ -4104,7 +4104,7 @@
 funimp_gen_exit:
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 funimp_gen_exit_cmp:
 	cmpi.b		SPCOND_FLG(%a6),&mia7_flg # was the ea mode (sp)+ ?
@@ -4129,7 +4129,7 @@
 	frestore	(%sp)+
 	mov.w		&0x2024,0x6(%sp)	# stk fmt = 0x2; voff = 0x24
 	bra.l		_real_trace
-	
+
 funimp_gen_exit_a7:
 	btst		&0x5,EXC_SR(%a6)	# supervisor or user mode?
 	bne.b		funimp_gen_exit_a7_s	# supervisor
@@ -4156,7 +4156,7 @@
 	unlk		%a6
 
 	add.w		(%sp),%sp		# stack frame shifted
-	bra.b		funimp_gen_exit_cont2		
+	bra.b		funimp_gen_exit_cont2
 
 ######################
 # fmovecr.x #ccc,fpn #
@@ -4212,7 +4212,7 @@
 	btst		&unfl_bit,FPSR_EXCEPT(%a6) # did underflow occur?
 	bne.b		funimp_exc_unfl		# yes
 
-# force the fsave exception status bits to signal an exception of the 
+# force the fsave exception status bits to signal an exception of the
 # appropriate type. don't forget to "skew" the source operand in case we
 # "unskewed" the one the hardware initially gave us.
 funimp_exc_force:
@@ -4242,7 +4242,7 @@
 funimp_gen_exit2:
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	frestore	FP_SRC(%a6)		# insert exceptional status
 
@@ -4262,7 +4262,7 @@
 	beq.w		funimp_fdbcc		# yes
 	cmpi.b		%d1,&0x7		# is it an fs<cc>?
 	bne.w		funimp_fscc		# yes
-	bfextu		%d0{&13:&3},%d1	
+	bfextu		%d0{&13:&3},%d1
 	cmpi.b		%d1,&0x2		# is it an fs<cc>?
 	blt.w		funimp_fscc		# yes
 
@@ -4302,7 +4302,7 @@
 
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	unlk		%a6
 	bra.l		_real_trap
@@ -4346,7 +4346,7 @@
 funimp_fscc_u:
 	mov.l		EXC_A7(%a6),%a0		# yes; set new USP
 	mov.l		%a0,%usp
-	bra.w		funimp_done		# branch to finish	
+	bra.w		funimp_done		# branch to finish
 
 # remember, I'm assuming that post-increment is bogus...(it IS!!!)
 # so, the least significant WORD of the stacked effective address got
@@ -4361,7 +4361,7 @@
 
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	unlk		%a6
 
@@ -4381,7 +4381,7 @@
 	fmov.l		%fpiar,0x8(%sp)		# insert "current PC"
 
 	bra.l		_real_trace
-		
+
 #
 # The ftrap<cc>, fs<cc>, or fdb<cc> is to take an enabled bsun. we must convert
 # the fp unimplemented instruction exception stack frame into a bsun stack frame,
@@ -4409,7 +4409,7 @@
 
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	frestore	FP_SRC(%a6)		# restore bsun exception
 
@@ -4424,13 +4424,13 @@
 # and return.
 #
 # as usual, we have to check for trace mode being on here. since instructions
-# modifying the supervisor stack frame don't pass through here, this is a 
+# modifying the supervisor stack frame don't pass through here, this is a
 # relatively easy task.
 #
 funimp_done:
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	unlk		%a6
 
@@ -4465,16 +4465,16 @@
 	global		tbl_trans
 	swbeg		&0x1c0
 tbl_trans:
-	short 		tbl_trans - tbl_trans	# $00-0 fmovecr all
-	short 		tbl_trans - tbl_trans	# $00-1 fmovecr all
-	short 		tbl_trans - tbl_trans	# $00-2 fmovecr all
-	short 		tbl_trans - tbl_trans	# $00-3 fmovecr all
-	short 		tbl_trans - tbl_trans	# $00-4 fmovecr all
-	short 		tbl_trans - tbl_trans	# $00-5 fmovecr all
-	short 		tbl_trans - tbl_trans	# $00-6 fmovecr all
-	short 		tbl_trans - tbl_trans	# $00-7 fmovecr all
+	short		tbl_trans - tbl_trans	# $00-0 fmovecr all
+	short		tbl_trans - tbl_trans	# $00-1 fmovecr all
+	short		tbl_trans - tbl_trans	# $00-2 fmovecr all
+	short		tbl_trans - tbl_trans	# $00-3 fmovecr all
+	short		tbl_trans - tbl_trans	# $00-4 fmovecr all
+	short		tbl_trans - tbl_trans	# $00-5 fmovecr all
+	short		tbl_trans - tbl_trans	# $00-6 fmovecr all
+	short		tbl_trans - tbl_trans	# $00-7 fmovecr all
 
-	short 		tbl_trans - tbl_trans	# $01-0 fint norm
+	short		tbl_trans - tbl_trans	# $01-0 fint norm
 	short		tbl_trans - tbl_trans	# $01-1 fint zero
 	short		tbl_trans - tbl_trans	# $01-2 fint inf
 	short		tbl_trans - tbl_trans	# $01-3 fint qnan
@@ -4599,7 +4599,7 @@
 	short		src_snan - tbl_trans	# $0e-4 fsin snan
 	short		tbl_trans - tbl_trans	# $0e-6 fsin unnorm
 	short		tbl_trans - tbl_trans	# $0e-7 ERROR
-	
+
 	short		stan	 - tbl_trans	# $0f-0 ftan norm
 	short		src_zero - tbl_trans	# $0f-1 ftan zero
 	short		t_operr	 - tbl_trans	# $0f-2 ftan inf
@@ -5009,7 +5009,7 @@
 #	d0 = round precision,mode					#
 #									#
 # OUTPUT ************************************************************** #
-#	fp0 = sin(X) or cos(X) 						#
+#	fp0 = sin(X) or cos(X)						#
 #									#
 #    For ssincos(X):							#
 #	fp0 = sin(X)							#
@@ -5017,7 +5017,7 @@
 #									#
 # ACCURACY and MONOTONICITY ******************************************* #
 #	The returned result is within 1 ulp in 64 significant bit, i.e.	#
-#	within 0.5001 ulp to 53 bits if the result is subsequently 	#
+#	within 0.5001 ulp to 53 bits if the result is subsequently	#
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
 #									#
@@ -5034,8 +5034,8 @@
 #									#
 #	4. If k is even, go to 6.					#
 #									#
-#	5. (k is odd) Set j := (k-1)/2, sgn := (-1)**j. 		#
-#		Return sgn*cos(r) where cos(r) is approximated by an 	#
+#	5. (k is odd) Set j := (k-1)/2, sgn := (-1)**j.			#
+#		Return sgn*cos(r) where cos(r) is approximated by an	#
 #		even polynomial in r, 1 + r*r*(B1+s*(B2+ ... + s*B8)),	#
 #		s = r*r.						#
 #		Exit.							#
@@ -5047,10 +5047,10 @@
 #									#
 #	7. If |X| > 1, go to 9.						#
 #									#
-#	8. (|X|<2**(-40)) If SIN is invoked, return X; 			#
+#	8. (|X|<2**(-40)) If SIN is invoked, return X;			#
 #		otherwise return 1.					#
 #									#
-#	9. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, 		#
+#	9. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi,		#
 #		go back to 3.						#
 #									#
 #	SINCOS:								#
@@ -5065,19 +5065,19 @@
 #		j1 exclusive or with the l.s.b. of k.			#
 #		sgn1 := (-1)**j1, sgn2 := (-1)**j2.			#
 #		SIN(X) = sgn1 * cos(r) and COS(X) = sgn2*sin(r) where	#
-#		sin(r) and cos(r) are computed as odd and even 		#
+#		sin(r) and cos(r) are computed as odd and even		#
 #		polynomials in r, respectively. Exit			#
 #									#
 #	5. (k is even) Set j1 := k/2, sgn1 := (-1)**j1.			#
 #		SIN(X) = sgn1 * sin(r) and COS(X) = sgn1*cos(r) where	#
-#		sin(r) and cos(r) are computed as odd and even 		#
+#		sin(r) and cos(r) are computed as odd and even		#
 #		polynomials in r, respectively. Exit			#
 #									#
 #	6. If |X| > 1, go to 8.						#
 #									#
 #	7. (|X|<2**(-40)) SIN(X) = X and COS(X) = 1. Exit.		#
 #									#
-#	8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, 		#
+#	8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi,		#
 #		go back to 2.						#
 #									#
 #########################################################################
@@ -5152,9 +5152,9 @@
 #--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
 SINMAIN:
 	fmov.x		%fp0,%fp1
-	fmul.d		TWOBYPI(%pc),%fp1 	# X*2/PI
+	fmul.d		TWOBYPI(%pc),%fp1	# X*2/PI
 
-	lea		PITBL+0x200(%pc),%a1 	# TABLE OF N*PI/2, N = -32,...,32
+	lea		PITBL+0x200(%pc),%a1	# TABLE OF N*PI/2, N = -32,...,32
 
 	fmov.l		%fp1,INT(%a6)		# CONVERT TO INTEGER
 
@@ -5164,8 +5164,8 @@
 
 # A1 IS THE ADDRESS OF N*PIBY2
 # ...WHICH IS IN TWO PIECES Y1 & Y2
-	fsub.x		(%a1)+,%fp0 		# X-Y1
-	fsub.s		(%a1),%fp0 		# fp0 = R = (X-Y1)-Y2
+	fsub.x		(%a1)+,%fp0		# X-Y1
+	fsub.s		(%a1),%fp0		# fp0 = R = (X-Y1)-Y2
 
 SINCONT:
 #--continuation from REDUCEX
@@ -5319,7 +5319,7 @@
 COSTINY:
 	fmov.s		&0x3F800000,%fp0	# fp0 = 1.0
 	fmov.l		%d0,%fpcr		# restore users round mode,prec
-	fadd.s 		&0x80800000,%fp0	# last inst - possible exception set
+	fadd.s		&0x80800000,%fp0	# last inst - possible exception set
 	bra		t_pinx2
 
 ################################################
@@ -5751,7 +5751,7 @@
 #									#
 #	7. (|X|<2**(-40)) Tan(X) = X. Exit.				#
 #									#
-#	8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back 	#
+#	8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back	#
 #		to 2.							#
 #									#
 #########################################################################
@@ -6154,27 +6154,27 @@
 #	The returned result is within 2 ulps in	64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently	#
 #	rounded to double precision. The result is provably monotonic	#
-#	in double precision. 						#
+#	in double precision.						#
 #									#
 # ALGORITHM *********************************************************** #
 #	Step 1. If |X| >= 16 or |X| < 1/16, go to Step 5.		#
 #									#
-#	Step 2. Let X = sgn * 2**k * 1.xxxxxxxx...x. 			#
+#	Step 2. Let X = sgn * 2**k * 1.xxxxxxxx...x.			#
 #		Note that k = -4, -3,..., or 3.				#
-#		Define F = sgn * 2**k * 1.xxxx1, i.e. the first 5 	#
+#		Define F = sgn * 2**k * 1.xxxx1, i.e. the first 5	#
 #		significant bits of X with a bit-1 attached at the 6-th	#
 #		bit position. Define u to be u = (X-F) / (1 + X*F).	#
 #									#
 #	Step 3. Approximate arctan(u) by a polynomial poly.		#
 #									#
-#	Step 4. Return arctan(F) + poly, arctan(F) is fetched from a 	#
+#	Step 4. Return arctan(F) + poly, arctan(F) is fetched from a	#
 #		table of values calculated beforehand. Exit.		#
 #									#
 #	Step 5. If |X| >= 16, go to Step 7.				#
 #									#
 #	Step 6. Approximate arctan(X) by an odd polynomial in X. Exit.	#
 #									#
-#	Step 7. Define X' = -1/X. Approximate arctan(X') by an odd 	#
+#	Step 7. Define X' = -1/X. Approximate arctan(X') by an odd	#
 #		polynomial in X'.					#
 #		Arctan(X) = sign(X)*Pi/2 + arctan(X'). Exit.		#
 #									#
@@ -6440,7 +6440,7 @@
 	fmul.x		%fp2,%fp1		# A1*U*V*(A2+V*(A3+V))
 	fadd.x		%fp1,%fp0		# ATAN(U), FP1 RELEASED
 
-	fmovm.x 	(%sp)+,&0x20		# restore fp2
+	fmovm.x		(%sp)+,&0x20		# restore fp2
 
 	fmov.l		%d0,%fpcr		# restore users rnd mode,prec
 	fadd.x		ATANF(%a6),%fp0		# ATAN(X)
@@ -6597,7 +6597,7 @@
 #	a0 = pointer to extended precision input			#
 #	d0 = round precision,mode					#
 #									#
-# OUTPUT **************************************************************	# 
+# OUTPUT **************************************************************	#
 #	fp0 = arcsin(X)							#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
@@ -6637,7 +6637,7 @@
 
 # This catch is added here for the '060 QSP. Originally, the call to
 # satan() would handle this case by causing the exception which would
-# not be caught until gen_except(). Now, with the exceptions being 
+# not be caught until gen_except(). Now, with the exceptions being
 # detected inside of satan(), the exception would have been handled there
 # instead of inside sasin() as expected.
 	cmp.l		%d1,&0x3FD78000
@@ -6786,7 +6786,7 @@
 
 #########################################################################
 # setox():    computes the exponential for a normalized input		#
-# setoxd():   computes the exponential for a denormalized input		# 
+# setoxd():   computes the exponential for a denormalized input		#
 # setoxm1():  computes the exponential minus 1 for a normalized input	#
 # setoxm1d(): computes the exponential minus 1 for a denormalized input	#
 #									#
@@ -6798,9 +6798,9 @@
 #	fp0 = exp(X) or exp(X)-1					#
 #									#
 # ACCURACY and MONOTONICITY ******************************************* #
-#	The returned result is within 0.85 ulps in 64 significant bit, 	#
+#	The returned result is within 0.85 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-#	rounded to double precision. The result is provably monotonic 	#
+#	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
 #									#
 # ALGORITHM and IMPLEMENTATION **************************************** #
@@ -6824,14 +6824,14 @@
 #	Notes:	The usual case should take the branches 1.1 -> 1.3 -> 2.#
 #		To avoid the use of floating-point comparisons, a	#
 #		compact representation of |X| is used. This format is a	#
-#		32-bit integer, the upper (more significant) 16 bits 	#
-#		are the sign and biased exponent field of |X|; the 	#
+#		32-bit integer, the upper (more significant) 16 bits	#
+#		are the sign and biased exponent field of |X|; the	#
 #		lower 16 bits are the 16 most significant fraction	#
 #		(including the explicit bit) bits of |X|. Consequently,	#
 #		the comparisons in Steps 1.1 and 1.3 can be performed	#
 #		by integer comparison. Note also that the constant	#
 #		16380 log(2) used in Step 1.3 is also in the compact	#
-#		form. Thus taking the branch to Step 2 guarantees 	#
+#		form. Thus taking the branch to Step 2 guarantees	#
 #		|X| < 16380 log(2). There is no harm to have a small	#
 #		number of cases where |X| is less than,	but close to,	#
 #		16380 log(2) and the branch to Step 9 is taken.		#
@@ -6843,7 +6843,7 @@
 #		2.3	Calculate	J = N mod 64; so J = 0,1,2,..., #
 #			or 63.						#
 #		2.4	Calculate	M = (N - J)/64; so N = 64M + J.	#
-#		2.5	Calculate the address of the stored value of 	#
+#		2.5	Calculate the address of the stored value of	#
 #			2^(J/64).					#
 #		2.6	Create the value Scale = 2^M.			#
 #	Notes:	The calculation in 2.2 is really performed by		#
@@ -6852,26 +6852,26 @@
 #		where							#
 #			constant := single-precision( 64/log 2 ).	#
 #									#
-#		Using a single-precision constant avoids memory 	#
+#		Using a single-precision constant avoids memory		#
 #		access. Another effect of using a single-precision	#
-#		"constant" is that the calculated value Z is 		#
+#		"constant" is that the calculated value Z is		#
 #									#
 #			Z = X*(64/log2)*(1+eps), |eps| <= 2^(-24).	#
 #									#
 #		This error has to be considered later in Steps 3 and 4.	#
 #									#
 #	Step 3.	Calculate X - N*log2/64.				#
-#		3.1	R := X + N*L1, 					#
+#		3.1	R := X + N*L1,					#
 #				where L1 := single-precision(-log2/64).	#
-#		3.2	R := R + N*L2, 					#
+#		3.2	R := R + N*L2,					#
 #				L2 := extended-precision(-log2/64 - L1).#
-#	Notes:	a) The way L1 and L2 are chosen ensures L1+L2 		#
+#	Notes:	a) The way L1 and L2 are chosen ensures L1+L2		#
 #		approximate the value -log2/64 to 88 bits of accuracy.	#
 #		b) N*L1 is exact because N is no longer than 22 bits	#
 #		and L1 is no longer than 24 bits.			#
-#		c) The calculation X+N*L1 is also exact due to 		#
+#		c) The calculation X+N*L1 is also exact due to		#
 #		cancellation. Thus, R is practically X+N(L1+L2) to full	#
-#		64 bits. 						#
+#		64 bits.						#
 #		d) It is important to estimate how large can |R| be	#
 #		after Step 3.2.						#
 #									#
@@ -6889,11 +6889,11 @@
 #									#
 #	Step 4.	Approximate exp(R)-1 by a polynomial			#
 #		p = R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*A5))))	#
-#	Notes:	a) In order to reduce memory access, the coefficients 	#
+#	Notes:	a) In order to reduce memory access, the coefficients	#
 #		are made as "short" as possible: A1 (which is 1/2), A4	#
 #		and A5 are single precision; A2 and A3 are double	#
-#		precision. 						#
-#		b) Even with the restrictions above, 			#
+#		precision.						#
+#		b) Even with the restrictions above,			#
 #		   |p - (exp(R)-1)| < 2^(-68.8) for all |R| <= 0.0062.	#
 #		Note that 0.0062 is slightly bigger than 0.57 log2/64.	#
 #		c) To fully utilize the pipeline, p is separated into	#
@@ -6907,11 +6907,11 @@
 #		where T and t are the stored values for 2^(J/64).	#
 #	Notes:	2^(J/64) is stored as T and t where T+t approximates	#
 #		2^(J/64) to roughly 85 bits; T is in extended precision	#
-#		and t is in single precision. Note also that T is 	#
-#		rounded to 62 bits so that the last two bits of T are 	#
-#		zero. The reason for such a special form is that T-1, 	#
+#		and t is in single precision. Note also that T is	#
+#		rounded to 62 bits so that the last two bits of T are	#
+#		zero. The reason for such a special form is that T-1,	#
 #		T-2, and T-8 will all be exact --- a property that will	#
-#		give much more accurate computation of the function 	#
+#		give much more accurate computation of the function	#
 #		EXPM1.							#
 #									#
 #	Step 6.	Reconstruction of exp(X)				#
@@ -6927,11 +6927,11 @@
 #			X = (M1+M)log2 + Jlog2/64 + R, |M1+M| >= 16380.	#
 #		Hence, exp(X) may overflow or underflow or neither.	#
 #		When that is the case, AdjScale = 2^(M1) where M1 is	#
-#		approximately M. Thus 6.2 will never cause 		#
+#		approximately M. Thus 6.2 will never cause		#
 #		over/underflow. Possible exception in 6.4 is overflow	#
 #		or underflow. The inexact exception is not generated in	#
 #		6.4. Although one can argue that the inexact flag	#
-#		should always be raised, to simulate that exception 	#
+#		should always be raised, to simulate that exception	#
 #		cost to much than the flag is worth in practical uses.	#
 #									#
 #	Step 7.	Return 1 + X.						#
@@ -6944,7 +6944,7 @@
 #		in Step 7.1 to avoid unnecessary trapping. (Although	#
 #		the FMOVEM may not seem relevant since X is normalized,	#
 #		the precaution will be useful in the library version of	#
-#		this code where the separate entry for denormalized 	#
+#		this code where the separate entry for denormalized	#
 #		inputs will be done away with.)				#
 #									#
 #	Step 8.	Handle exp(X) where |X| >= 16380log2.			#
@@ -6952,9 +6952,9 @@
 #		(mimic 2.2 - 2.6)					#
 #		8.2	N := round-to-integer( X * 64/log2 )		#
 #		8.3	Calculate J = N mod 64, J = 0,1,...,63		#
-#		8.4	K := (N-J)/64, M1 := truncate(K/2), M = K-M1, 	#
+#		8.4	K := (N-J)/64, M1 := truncate(K/2), M = K-M1,	#
 #			AdjFlag := 1.					#
-#		8.5	Calculate the address of the stored value 	#
+#		8.5	Calculate the address of the stored value	#
 #			2^(J/64).					#
 #		8.6	Create the values Scale = 2^M, AdjScale = 2^M1.	#
 #		8.7	Go to Step 3.					#
@@ -6991,8 +6991,8 @@
 #		1.4	Go to Step 10.					#
 #	Notes:	The usual case should take the branches 1.1 -> 1.3 -> 2.#
 #		However, it is conceivable |X| can be small very often	#
-#		because EXPM1 is intended to evaluate exp(X)-1 		#
-#		accurately when |X| is small. For further details on 	#
+#		because EXPM1 is intended to evaluate exp(X)-1		#
+#		accurately when |X| is small. For further details on	#
 #		the comparisons, see the notes on Step 1 of setox.	#
 #									#
 #	Step 2.	Calculate N = round-to-nearest-int( X * 64/log2 ).	#
@@ -7000,16 +7000,16 @@
 #		2.2	Calculate	J = N mod 64; so J = 0,1,2,..., #
 #			or 63.						#
 #		2.3	Calculate	M = (N - J)/64; so N = 64M + J.	#
-#		2.4	Calculate the address of the stored value of 	#
+#		2.4	Calculate the address of the stored value of	#
 #			2^(J/64).					#
-#		2.5	Create the values Sc = 2^M and 			#
+#		2.5	Create the values Sc = 2^M and			#
 #			OnebySc := -2^(-M).				#
 #	Notes:	See the notes on Step 2 of setox.			#
 #									#
 #	Step 3.	Calculate X - N*log2/64.				#
-#		3.1	R := X + N*L1, 					#
+#		3.1	R := X + N*L1,					#
 #				where L1 := single-precision(-log2/64).	#
-#		3.2	R := R + N*L2, 					#
+#		3.2	R := R + N*L2,					#
 #				L2 := extended-precision(-log2/64 - L1).#
 #	Notes:	Applying the analysis of Step 3 of setox in this case	#
 #		shows that |R| <= 0.0055 (note that |X| <= 70 log2 in	#
@@ -7017,10 +7017,10 @@
 #									#
 #	Step 4.	Approximate exp(R)-1 by a polynomial			#
 #			p = R+R*R*(A1+R*(A2+R*(A3+R*(A4+R*(A5+R*A6)))))	#
-#	Notes:	a) In order to reduce memory access, the coefficients 	#
-#		are made as "short" as possible: A1 (which is 1/2), A5 	#
-#		and A6 are single precision; A2, A3 and A4 are double 	#
-#		precision. 						#
+#	Notes:	a) In order to reduce memory access, the coefficients	#
+#		are made as "short" as possible: A1 (which is 1/2), A5	#
+#		and A6 are single precision; A2, A3 and A4 are double	#
+#		precision.						#
 #		b) Even with the restriction above,			#
 #			|p - (exp(R)-1)| <	|R| * 2^(-72.7)		#
 #		for all |R| <= 0.0055.					#
@@ -7035,9 +7035,9 @@
 #		where T and t are the stored values for 2^(J/64).	#
 #	Notes:	2^(J/64) is stored as T and t where T+t approximates	#
 #		2^(J/64) to roughly 85 bits; T is in extended precision	#
-#		and t is in single precision. Note also that T is 	#
-#		rounded to 62 bits so that the last two bits of T are 	#
-#		zero. The reason for such a special form is that T-1, 	#
+#		and t is in single precision. Note also that T is	#
+#		rounded to 62 bits so that the last two bits of T are	#
+#		zero. The reason for such a special form is that T-1,	#
 #		T-2, and T-8 will all be exact --- a property that will	#
 #		be exploited in Step 6 below. The total relative error	#
 #		in p is no bigger than 2^(-67.7) compared to the final	#
@@ -7052,7 +7052,7 @@
 #		6.5	ans := (T + OnebySc) + (p + t).			#
 #		6.6	Restore user FPCR.				#
 #		6.7	Return ans := Sc * ans. Exit.			#
-#	Notes:	The various arrangements of the expressions give 	#
+#	Notes:	The various arrangements of the expressions give	#
 #		accurate evaluations.					#
 #									#
 #	Step 7.	exp(X)-1 for |X| < 1/4.					#
@@ -7068,8 +7068,8 @@
 #		 Return ans := ans*2^(140). Exit			#
 #	Notes:	The idea is to return "X - tiny" under the user		#
 #		precision and rounding modes. To avoid unnecessary	#
-#		inefficiency, we stay away from denormalized numbers 	#
-#		the best we can. For |X| >= 2^(-16312), the 		#
+#		inefficiency, we stay away from denormalized numbers	#
+#		the best we can. For |X| >= 2^(-16312), the		#
 #		straightforward 8.2 generates the inexact exception as	#
 #		the case warrants.					#
 #									#
@@ -7077,13 +7077,13 @@
 #			p = X + X*X*(B1 + X*(B2 + ... + X*B12))		#
 #	Notes:	a) In order to reduce memory access, the coefficients	#
 #		are made as "short" as possible: B1 (which is 1/2), B9	#
-#		to B12 are single precision; B3 to B8 are double 	#
+#		to B12 are single precision; B3 to B8 are double	#
 #		precision; and B2 is double extended.			#
 #		b) Even with the restriction above,			#
 #			|p - (exp(X)-1)| < |X| 2^(-70.6)		#
 #		for all |X| <= 0.251.					#
 #		Note that 0.251 is slightly bigger than 1/4.		#
-#		c) To fully preserve accuracy, the polynomial is 	#
+#		c) To fully preserve accuracy, the polynomial is	#
 #		computed as						#
 #			X + ( S*B1 +	Q ) where S = X*X and		#
 #			Q	=	X*S*(B2 + X*(B3 + ... + X*B12))	#
@@ -7093,11 +7093,11 @@
 #				[ S*S*(B3 + S*(B5 + ... + S*B11)) ]	#
 #									#
 #	Step 10. Calculate exp(X)-1 for |X| >= 70 log 2.		#
-#		10.1 If X >= 70log2 , exp(X) - 1 = exp(X) for all 	#
+#		10.1 If X >= 70log2 , exp(X) - 1 = exp(X) for all	#
 #		practical purposes. Therefore, go to Step 1 of setox.	#
 #		10.2 If X <= -70log2, exp(X) - 1 = -1 for all practical	#
-#		purposes. 						#
-#		ans := -1 						#
+#		purposes.						#
+#		ans := -1						#
 #		Restore user FPCR					#
 #		Return ans := ans + 2^(-126). Exit.			#
 #	Notes:	10.2 will always create an inexact and return -1 + tiny	#
@@ -7602,10 +7602,10 @@
 # sgetexp():  returns the exponent portion of the input argument.	#
 #	      The exponent bias is removed and the exponent value is	#
 #	      returned as an extended precision number in fp0.		#
-# sgetexpd(): handles denormalized numbers. 				#
+# sgetexpd(): handles denormalized numbers.				#
 #									#
-# sgetman():  extracts the mantissa of the input argument. The 		#
-#	      mantissa is converted to an extended precision number w/ 	#
+# sgetman():  extracts the mantissa of the input argument. The		#
+#	      mantissa is converted to an extended precision number w/	#
 #	      an exponent of $3fff and is returned in fp0. The range of #
 #	      the result is [1.0 - 2.0).				#
 # sgetmand(): handles denormalized numbers.				#
@@ -7679,9 +7679,9 @@
 #	fp0 = cosh(X)							#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 3 ulps in 64 significant bit, 	#
+#	The returned result is within 3 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently	#
-#	rounded to double precision. The result is provably monotonic 	#
+#	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
 #									#
 # ALGORITHM ***********************************************************	#
@@ -7698,7 +7698,7 @@
 #									#
 #	4. (16380 log2 < |X| <= 16480 log2)				#
 #		cosh(X) = sign(X) * exp(|X|)/2.				#
-#		However, invoking exp(|X|) may cause premature 		#
+#		However, invoking exp(|X|) may cause premature		#
 #		overflow. Thus, we calculate sinh(X) as follows:	#
 #		Y	:= |X|						#
 #		Fact	:=	2**(16380)				#
@@ -7793,7 +7793,7 @@
 #	fp0 = sinh(X)							#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 3 ulps in 64 significant bit, 	#
+#	The returned result is within 3 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
@@ -7911,7 +7911,7 @@
 #	fp0 = tanh(X)							#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 3 ulps in 64 significant bit, 	#
+#	The returned result is within 3 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
@@ -8077,51 +8077,51 @@
 #	fp0 = log(X) or log(1+X)					#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 2 ulps in 64 significant bit, 	#
+#	The returned result is within 2 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently	#
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
 #									#
 # ALGORITHM ***********************************************************	#
 #	LOGN:								#
-#	Step 1. If |X-1| < 1/16, approximate log(X) by an odd 		#
-#		polynomial in u, where u = 2(X-1)/(X+1). Otherwise, 	#
+#	Step 1. If |X-1| < 1/16, approximate log(X) by an odd		#
+#		polynomial in u, where u = 2(X-1)/(X+1). Otherwise,	#
 #		move on to Step 2.					#
 #									#
 #	Step 2. X = 2**k * Y where 1 <= Y < 2. Define F to be the first	#
-#		seven significant bits of Y plus 2**(-7), i.e. 		#
-#		F = 1.xxxxxx1 in base 2 where the six "x" match those 	#
+#		seven significant bits of Y plus 2**(-7), i.e.		#
+#		F = 1.xxxxxx1 in base 2 where the six "x" match those	#
 #		of Y. Note that |Y-F| <= 2**(-7).			#
 #									#
-#	Step 3. Define u = (Y-F)/F. Approximate log(1+u) by a 		#
+#	Step 3. Define u = (Y-F)/F. Approximate log(1+u) by a		#
 #		polynomial in u, log(1+u) = poly.			#
 #									#
-#	Step 4. Reconstruct 						#
+#	Step 4. Reconstruct						#
 #		log(X) = log( 2**k * Y ) = k*log(2) + log(F) + log(1+u)	#
 #		by k*log(2) + (log(F) + poly). The values of log(F) are	#
 #		calculated beforehand and stored in the program.	#
 #									#
 #	lognp1:								#
-#	Step 1: If |X| < 1/16, approximate log(1+X) by an odd 		#
+#	Step 1: If |X| < 1/16, approximate log(1+X) by an odd		#
 #		polynomial in u where u = 2X/(2+X). Otherwise, move on	#
 #		to Step 2.						#
 #									#
 #	Step 2: Let 1+X = 2**k * Y, where 1 <= Y < 2. Define F as done	#
-#		in Step 2 of the algorithm for LOGN and compute 	#
-#		log(1+X) as k*log(2) + log(F) + poly where poly 	#
-#		approximates log(1+u), u = (Y-F)/F. 			#
+#		in Step 2 of the algorithm for LOGN and compute		#
+#		log(1+X) as k*log(2) + log(F) + poly where poly		#
+#		approximates log(1+u), u = (Y-F)/F.			#
 #									#
 #	Implementation Notes:						#
-#	Note 1. There are 64 different possible values for F, thus 64 	#
+#	Note 1. There are 64 different possible values for F, thus 64	#
 #		log(F)'s need to be tabulated. Moreover, the values of	#
 #		1/F are also tabulated so that the division in (Y-F)/F	#
 #		can be performed by a multiplication.			#
 #									#
-#	Note 2. In Step 2 of lognp1, in order to preserved accuracy, 	#
-#		the value Y-F has to be calculated carefully when 	#
-#		1/2 <= X < 3/2. 					#
+#	Note 2. In Step 2 of lognp1, in order to preserved accuracy,	#
+#		the value Y-F has to be calculated carefully when	#
+#		1/2 <= X < 3/2.						#
 #									#
-#	Note 3. To fully exploit the pipeline, polynomials are usually 	#
+#	Note 3. To fully exploit the pipeline, polynomials are usually	#
 #		separated into two parts evaluated independently before	#
 #		being added up.						#
 #									#
@@ -8334,9 +8334,9 @@
 	cmp.l		%d1,&0			# CHECK IF X IS NEGATIVE
 	blt.w		LOGNEG			# LOG OF NEGATIVE ARGUMENT IS INVALID
 # X IS POSITIVE, CHECK IF X IS NEAR 1
-	cmp.l		%d1,&0x3ffef07d 	# IS X < 15/16?
+	cmp.l		%d1,&0x3ffef07d		# IS X < 15/16?
 	blt.b		LOGMAIN			# YES
-	cmp.l		%d1,&0x3fff8841 	# IS X > 17/16?
+	cmp.l		%d1,&0x3fff8841		# IS X > 17/16?
 	ble.w		LOGNEAR1		# NO
 
 LOGMAIN:
@@ -8349,7 +8349,7 @@
 #--NOTE THAT U = (Y-F)/F IS VERY SMALL AND THUS APPROXIMATING
 #--LOG(1+U) CAN BE VERY EFFICIENT.
 #--ALSO NOTE THAT THE VALUE 1/F IS STORED IN A TABLE SO THAT NO
-#--DIVISION IS NEEDED TO CALCULATE (Y-F)/F. 
+#--DIVISION IS NEEDED TO CALCULATE (Y-F)/F.
 
 #--GET K, Y, F, AND ADDRESS OF 1/F.
 	asr.l		&8,%d1
@@ -8564,10 +8564,10 @@
 	mov.l		X(%a6),%d1
 	cmp.l		%d1,&0
 	ble.w		LP1NEG0			# LOG OF ZERO OR -VE
-	cmp.l		%d1,&0x3ffe8000 	# IS BOUNDS [1/2,3/2]?
+	cmp.l		%d1,&0x3ffe8000		# IS BOUNDS [1/2,3/2]?
 	blt.w		LOGMAIN
 	cmp.l		%d1,&0x3fffc000
-	bgt.w		LOGMAIN 
+	bgt.w		LOGMAIN
 #--IF 1+Z > 3/2 OR 1+Z < 1/2, THEN X, WHICH IS ROUNDING 1+Z,
 #--CONTAINS AT LEAST 63 BITS OF INFORMATION OF Z. IN THAT CASE,
 #--SIMPLY INVOKE LOG(X) FOR LOG(1+Z).
@@ -8668,7 +8668,7 @@
 #	a0 = pointer to extended precision input			#
 #	d0 = round precision,mode					#
 #									#
-# OUTPUT **************************************************************	# 
+# OUTPUT **************************************************************	#
 #	fp0 = arctanh(X)						#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
@@ -8783,7 +8783,7 @@
 #            2.1 Restore the user FPCR					#
 #            2.2 Return ans := Y * INV_L10.				#
 #									#
-#       slog10: 							#
+#       slog10:								#
 #									#
 #       Step 0. If X < 0, create a NaN and raise the invalid operation	#
 #               flag. Otherwise, save FPCR in D1; set FpCR to default.	#
@@ -8926,7 +8926,7 @@
 #	fp0 = 2**X or 10**X						#
 #									#
 # ACCURACY and MONOTONICITY *******************************************	#
-#	The returned result is within 2 ulps in 64 significant bit, 	#
+#	The returned result is within 2 ulps in 64 significant bit,	#
 #	i.e. within 0.5001 ulp to 53 bits if the result is subsequently	#
 #	rounded to double precision. The result is provably monotonic	#
 #	in double precision.						#
@@ -8957,7 +8957,7 @@
 #									#
 #	4. Define r as							#
 #		r := ((X - N*L1)-N*L2) * L10				#
-#		where L1, L2 are the leading and trailing parts of 	#
+#		where L1, L2 are the leading and trailing parts of	#
 #		log_10(2)/64 and L10 is the natural log of 10. Then	#
 #		10**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r).		#
 #		Go to expr to compute that expression.			#
@@ -8978,7 +8978,7 @@
 #		Exit.							#
 #									#
 #	ExpBig								#
-#	1. Generate overflow by Huge * Huge if X > 0; otherwise, 	#
+#	1. Generate overflow by Huge * Huge if X > 0; otherwise,	#
 #	        generate underflow by Tiny * Tiny.			#
 #									#
 #	ExpSm								#
@@ -9309,10 +9309,10 @@
 
 #########################################################################
 # smovcr(): returns the ROM constant at the offset specified in d1	#
-#	    rounded to the mode and precision specified in d0. 		#
+#	    rounded to the mode and precision specified in d0.		#
 #									#
 # INPUT	***************************************************************	#
-# 	d0 = rnd prec,mode						#
+#	d0 = rnd prec,mode						#
 #	d1 = ROM offset							#
 #									#
 # OUTPUT **************************************************************	#
@@ -9325,7 +9325,7 @@
 	mov.l		%d1,-(%sp)		# save rom offset for a sec
 
 	lsr.b		&0x4,%d0		# shift ctrl bits to lo
-	mov.l		%d0,%d1			# make a copy 
+	mov.l		%d0,%d1			# make a copy
 	andi.w		&0x3,%d1		# extract rnd mode
 	andi.w		&0xc,%d0		# extract rnd prec
 	swap		%d0			# put rnd prec in hi
@@ -9343,7 +9343,7 @@
 	cmpi.b		%d1,&0x0e		# check range $0b - $0e
 	ble.b		sm_tbl			# valid constants in this range
 	cmpi.b		%d1,&0x2f		# check range $10 - $2f
-	ble.b		z_val			# if in this range, return zero 
+	ble.b		z_val			# if in this range, return zero
 	cmpi.b		%d1,&0x3f		# check range $30 - $3f
 	ble.b		bg_tbl			# valid constants in this range
 
@@ -9378,7 +9378,7 @@
 #	$0C	e		(inexact)
 #	$0D	log2(e)		(inexact)
 #	$0E	log10(e)	(exact)
-# 
+#
 # fetch a pointer to the answer table relating to the proper rounding
 # precision.
 #
@@ -9465,7 +9465,7 @@
 	swap		%d0			# rnd prec in upper word
 
 # call round() to round the answer to the proper precision.
-# exponents out of range for single or double DO NOT cause underflow 
+# exponents out of range for single or double DO NOT cause underflow
 # or overflow.
 	mov.w		0x0(%a0,%d1.w),FP_SCR1_EX(%a6) # load first word
 	mov.l		0x4(%a0,%d1.w),FP_SCR1_HI(%a6) # load second word
@@ -9562,7 +9562,7 @@
 
 #########################################################################
 # sscale(): computes the destination operand scaled by the source	#
-#	    operand. If the absoulute value of the source operand is 	#
+#	    operand. If the absoulute value of the source operand is	#
 #	    >= 2^14, an overflow or underflow is returned.		#
 #									#
 # INPUT *************************************************************** #
@@ -9624,7 +9624,7 @@
 	bge.b		sok_norm2		# thank goodness no
 
 # the multiply factor that we're trying to create should be a denorm
-# for the multiply to work. therefore, we're going to actually do a 
+# for the multiply to work. therefore, we're going to actually do a
 # multiply with a denorm which will cause an unimplemented data type
 # exception to be put into the machine which will be caught and corrected
 # later. we don't do this with the DENORMs above because this method
@@ -9639,7 +9639,7 @@
 	clr.l		-(%sp)			# insert zero low mantissa
 	mov.l		%d1,-(%sp)		# insert new high mantissa
 	clr.l		-(%sp)			# make zero exponent
-	bra.b		sok_norm_cont	
+	bra.b		sok_norm_cont
 sok_dnrm_32:
 	subi.b		&0x20,%d0		# get shift count
 	lsr.l		%d0,%d1			# make low mantissa longword
@@ -9647,7 +9647,7 @@
 	clr.l		-(%sp)			# insert zero high mantissa
 	clr.l		-(%sp)			# make zero exponent
 	bra.b		sok_norm_cont
-	
+
 # the src will force the dst to a DENORM value or worse. so, let's
 # create an fp multiply that will create the result.
 sok_norm:
@@ -9705,7 +9705,7 @@
 #	a1 = pointer to extended precision input Y			#
 #	d0 = round precision,mode					#
 #									#
-# 	The input operands X and Y can be either normalized or 		#
+#	The input operands X and Y can be either normalized or		#
 #	denormalized.							#
 #									#
 # OUTPUT ************************************************************** #
@@ -9714,7 +9714,7 @@
 # ALGORITHM *********************************************************** #
 #									#
 #       Step 1.  Save and strip signs of X and Y: signX := sign(X),	#
-#                signY := sign(Y), X := |X|, Y := |Y|, 			#
+#                signY := sign(Y), X := |X|, Y := |Y|,			#
 #                signQ := signX EOR signY. Record whether MOD or REM	#
 #                is requested.						#
 #									#
@@ -9734,7 +9734,7 @@
 #									#
 #       Step 4.  At this point, R = X - QY = MOD(X,Y). Set		#
 #                Last_Subtract := false (used in Step 7 below). If	#
-#                MOD is requested, go to Step 6. 			#
+#                MOD is requested, go to Step 6.			#
 #									#
 #       Step 5.  R = MOD(X,Y), but REM(X,Y) is requested.		#
 #            5.1 If R < Y/2, then R = MOD(X,Y) = REM(X,Y). Go to	#
@@ -10060,8 +10060,8 @@
 	mov.b		&FMUL_OP,%d1		# last inst is MUL
 	fmul.x		Scale(%pc),%fp0		# may cause underflow
 	bra		t_catch2
-# the '040 package did this apparently to see if the dst operand for the 
-# preceding fmul was a denorm. but, it better not have been since the 
+# the '040 package did this apparently to see if the dst operand for the
+# preceding fmul was a denorm. but, it better not have been since the
 # algorithm just got done playing with fp0 and expected no exceptions
 # as a result. trust me...
 #	bra		t_avoid_unsupp		# check for denorm as a
@@ -10075,7 +10075,7 @@
 Rem_is_0:
 #..R = 2^(-j)X - Q Y = Y, thus R = 0 and quotient = 2^j (Q+1)
 	addq.l		&1,%d3
-	cmp.l		%d0,&8			# D0 is j 
+	cmp.l		%d0,&8			# D0 is j
 	bge.b		Q_Big
 
 	lsl.l		%d0,%d3
@@ -10117,20 +10117,20 @@
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to source operand					#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default result						#
 #									#
 # ALGORITHM ***********************************************************	#
 #	- Store properly signed INF into fp0.				#
-#	- Set FPSR exception status dz bit, ccode inf bit, and 		#
+#	- Set FPSR exception status dz bit, ccode inf bit, and		#
 #	  accrued dz bit.						#
 #									#
 #########################################################################
 
 	global		t_dz
 t_dz:
-	tst.b		SRC_EX(%a0) 		# no; is src negative?
+	tst.b		SRC_EX(%a0)		# no; is src negative?
 	bmi.b		t_dz2			# yes
 
 dz_pinf:
@@ -10146,7 +10146,7 @@
 
 #################################################################
 # OPERR exception:						#
-#	- set FPSR exception status operr bit, condition code 	#
+#	- set FPSR exception status operr bit, condition code	#
 #	  nan bit; Store default NAN into fp0			#
 #################################################################
 	global		t_operr
@@ -10157,7 +10157,7 @@
 
 #################################################################
 # Extended DENORM:						#
-# 	- For all functions that have a denormalized input and	#
+#	- For all functions that have a denormalized input and	#
 #	  that f(x)=x, this is the entry point.			#
 #	- we only return the EXOP here if either underflow or	#
 #	  inexact is enabled.					#
@@ -10224,13 +10224,13 @@
 
 #################################################################
 # UNFL exception:						#
-# 	- This routine is for cases where even an EXOP isn't	#
-#  	  large enough to hold the range of this result.	#
+#	- This routine is for cases where even an EXOP isn't	#
+#	  large enough to hold the range of this result.	#
 #	  In such a case, the EXOP equals zero.			#
-#  	- Return the default result to the proper precision 	#
+#	- Return the default result to the proper precision	#
 #	  with the sign of this result being the same as that	#
 #	  of the src operand.					#
-# 	- t_unfl2() is provided to force the result sign to 	#
+#	- t_unfl2() is provided to force the result sign to	#
 #	  positive which is the desired result for fetox().	#
 #################################################################
 	global		t_unfl
@@ -10259,15 +10259,15 @@
 
 #################################################################
 # OVFL exception:						#
-# 	- This routine is for cases where even an EXOP isn't	#
-#  	  large enough to hold the range of this result.	#
-# 	- Return the default result to the proper precision 	#
-#	  with the sign of this result being the same as that 	#
+#	- This routine is for cases where even an EXOP isn't	#
+#	  large enough to hold the range of this result.	#
+#	- Return the default result to the proper precision	#
+#	  with the sign of this result being the same as that	#
 #	  of the src operand.					#
-# 	- t_ovfl2() is provided to force the result sign to 	#
+#	- t_ovfl2() is provided to force the result sign to	#
 #	  positive which is the desired result for fcosh().	#
-# 	- t_ovfl_sc() is provided for scale() which only sets 	#
-#	  the inexact bits if the number is inexact for the 	#
+#	- t_ovfl_sc() is provided for scale() which only sets	#
+#	  the inexact bits if the number is inexact for the	#
 #	  precision indicated.					#
 #################################################################
 
@@ -10338,10 +10338,10 @@
 	rts
 
 #################################################################
-# t_catch(): 							#
+# t_catch():							#
 #	- the last operation of a transcendental emulation	#
-# 	  routine may have caused an underflow or overflow. 	#
-# 	  we find out if this occurred by doing an fsave and 	#
+#	  routine may have caused an underflow or overflow.	#
+#	  we find out if this occurred by doing an fsave and	#
 #	  checking the exception bit. if one did occur, then we	#
 #	  jump to fgen_except() which creates the default	#
 #	  result and EXOP for us.				#
@@ -10407,8 +10407,8 @@
 # unf_res(): underflow default result calculation for transcendentals	#
 #									#
 # INPUT:								#
-# 	d0   : rnd mode,precision					#
-# 	d1.b : sign bit of result ('11111111 = (-) ; '00000000 = (+))	#
+#	d0   : rnd mode,precision					#
+#	d1.b : sign bit of result ('11111111 = (-) ; '00000000 = (+))	#
 # OUTPUT:								#
 #	a0   : points to result (in instruction memory)			#
 #########################################################################
@@ -10457,7 +10457,7 @@
 	long		0x0,0x0,0x0,0x0
 	long		0x0,0x0,0x0,0x0
 	long		0x0,0x0,0x0,0x0
-	
+
 	long		0x80000000, 0x00000000, 0x00000000, 0x0 # ZERO;ext
 	long		0x80000000, 0x00000000, 0x00000000, 0x0 # ZERO;ext
 	long		0x80000000, 0x00000000, 0x00000001, 0x0 # MIN; ext
@@ -10504,7 +10504,7 @@
 #########################################################################
 	global		dst_zero
 dst_zero:
-	tst.b		DST_EX(%a1) 		# get sign of dst operand
+	tst.b		DST_EX(%a1)		# get sign of dst operand
 	bmi.b		ld_mzero		# if neg, load neg zero
 	bra.b		ld_pzero		# load positive zero
 
@@ -10513,7 +10513,7 @@
 #########################################################################
 	global		src_inf
 src_inf:
-	tst.b		SRC_EX(%a0) 		# get sign of src operand
+	tst.b		SRC_EX(%a0)		# get sign of src operand
 	bmi.b		ld_minf			# if negative branch
 
 #
@@ -10539,7 +10539,7 @@
 #########################################################################
 	global		dst_inf
 dst_inf:
-	tst.b		DST_EX(%a1) 		# get sign of dst operand
+	tst.b		DST_EX(%a1)		# get sign of dst operand
 	bmi.b		ld_minf			# if negative branch
 	bra.b		ld_pinf
 
@@ -10581,7 +10581,7 @@
 #########################################################################
 	global		src_one
 src_one:
-	tst.b		SRC_EX(%a0) 		# check sign of source
+	tst.b		SRC_EX(%a0)		# check sign of source
 	bmi.b		ld_mone
 
 #
@@ -10610,7 +10610,7 @@
 #################################################################
 	global		spi_2
 spi_2:
-	tst.b		SRC_EX(%a0) 		# check sign of source
+	tst.b		SRC_EX(%a0)		# check sign of source
 	bmi.b		ld_mpi2
 
 #
@@ -10637,7 +10637,7 @@
 
 #
 # ssincosz(): When the src operand is ZERO, store a one in the
-# 	      cosine register and return a ZERO in fp0 w/ the same sign
+#	      cosine register and return a ZERO in fp0 w/ the same sign
 #	      as the src operand.
 #
 	global		ssincosz
@@ -10666,7 +10666,7 @@
 
 #
 # ssincosqnan(): When the src operand is a QNAN, store the QNAN in the cosine
-# 		 register and branch to the src QNAN routine.
+#		 register and branch to the src QNAN routine.
 #
 	global		ssincosqnan
 ssincosqnan:
@@ -10719,7 +10719,7 @@
 	fmovm.x		&0x40,EXC_FP1(%a6)
 	rts
 sto_cos_2:
-	fmov.x 		%fp1,%fp2
+	fmov.x		%fp1,%fp2
 	rts
 sto_cos_3:
 	fmov.x		%fp1,%fp3
@@ -10988,8 +10988,8 @@
 # fkern2.s:
 #	These entry points are used by the exception handler
 # routines where an instruction is selected by an index into
-# a large jump table corresponding to a given instruction which 
-# has been decoded. Flow continues here where we now decode 
+# a large jump table corresponding to a given instruction which
+# has been decoded. Flow continues here where we now decode
 # further accoding to the source operand type.
 #
 
@@ -11331,11 +11331,11 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fgen_except(): catch an exception during transcendental 	#
+#	fgen_except(): catch an exception during transcendental		#
 #		       emulation					#
 #									#
 # XREF ****************************************************************	#
-#	fmul() - emulate a multiply instruction				# 
+#	fmul() - emulate a multiply instruction				#
 #	fadd() - emulate an add instruction				#
 #	fin() - emulate an fmove instruction				#
 #									#
@@ -11343,16 +11343,16 @@
 #	fp0 = destination operand					#
 #	d0  = type of instruction that took exception			#
 #	fsave frame = source operand					#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = result							#
 #	fp1 = EXOP							#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	An exception occurred on the last instruction of the 		#
-# transcendental emulation. hopefully, this won't be happening much 	#
+#	An exception occurred on the last instruction of the		#
+# transcendental emulation. hopefully, this won't be happening much	#
 # because it will be VERY slow.						#
-# 	The only exceptions capable of passing through here are		#
+#	The only exceptions capable of passing through here are		#
 # Overflow, Underflow, and Unsupported Data Type.			#
 #									#
 #########################################################################
@@ -11408,11 +11408,11 @@
 
 	swbeg		&109
 tbl_unsupp:
-	long		fin	 	- tbl_unsupp	# 00: fmove
-	long		fint	 	- tbl_unsupp	# 01: fint
-	long		fsinh	 	- tbl_unsupp	# 02: fsinh
-	long		fintrz	 	- tbl_unsupp	# 03: fintrz
-	long		fsqrt	 	- tbl_unsupp	# 04: fsqrt
+	long		fin		- tbl_unsupp	# 00: fmove
+	long		fint		- tbl_unsupp	# 01: fint
+	long		fsinh		- tbl_unsupp	# 02: fsinh
+	long		fintrz		- tbl_unsupp	# 03: fintrz
+	long		fsqrt		- tbl_unsupp	# 04: fsqrt
 	long		tbl_unsupp	- tbl_unsupp
 	long		flognp1		- tbl_unsupp	# 06: flognp1
 	long		tbl_unsupp	- tbl_unsupp
@@ -11432,23 +11432,23 @@
 	long		flog10		- tbl_unsupp	# 15: flog10
 	long		flog2		- tbl_unsupp	# 16: flog2
 	long		tbl_unsupp	- tbl_unsupp
-	long		fabs		- tbl_unsupp 	# 18: fabs
+	long		fabs		- tbl_unsupp	# 18: fabs
 	long		fcosh		- tbl_unsupp	# 19: fcosh
-	long		fneg		- tbl_unsupp 	# 1a: fneg
+	long		fneg		- tbl_unsupp	# 1a: fneg
 	long		tbl_unsupp	- tbl_unsupp
 	long		facos		- tbl_unsupp	# 1c: facos
 	long		fcos		- tbl_unsupp	# 1d: fcos
 	long		fgetexp		- tbl_unsupp	# 1e: fgetexp
 	long		fgetman		- tbl_unsupp	# 1f: fgetman
-	long		fdiv		- tbl_unsupp 	# 20: fdiv
+	long		fdiv		- tbl_unsupp	# 20: fdiv
 	long		fmod		- tbl_unsupp	# 21: fmod
-	long		fadd		- tbl_unsupp 	# 22: fadd
-	long		fmul		- tbl_unsupp 	# 23: fmul
-	long		fsgldiv		- tbl_unsupp 	# 24: fsgldiv
+	long		fadd		- tbl_unsupp	# 22: fadd
+	long		fmul		- tbl_unsupp	# 23: fmul
+	long		fsgldiv		- tbl_unsupp	# 24: fsgldiv
 	long		frem		- tbl_unsupp	# 25: frem
 	long		fscale		- tbl_unsupp	# 26: fscale
-	long		fsglmul		- tbl_unsupp 	# 27: fsglmul
-	long		fsub		- tbl_unsupp 	# 28: fsub
+	long		fsglmul		- tbl_unsupp	# 27: fsglmul
+	long		fsub		- tbl_unsupp	# 28: fsub
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
@@ -11464,20 +11464,20 @@
 	long		fsincos		- tbl_unsupp	# 35: fsincos
 	long		fsincos		- tbl_unsupp	# 36: fsincos
 	long		fsincos		- tbl_unsupp	# 37: fsincos
-	long		fcmp		- tbl_unsupp 	# 38: fcmp
+	long		fcmp		- tbl_unsupp	# 38: fcmp
 	long		tbl_unsupp	- tbl_unsupp
-	long		ftst		- tbl_unsupp 	# 3a: ftst
+	long		ftst		- tbl_unsupp	# 3a: ftst
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
-	long		fsin		- tbl_unsupp 	# 40: fsmove
-	long		fssqrt		- tbl_unsupp 	# 41: fssqrt
+	long		fsin		- tbl_unsupp	# 40: fsmove
+	long		fssqrt		- tbl_unsupp	# 41: fssqrt
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		fdin		- tbl_unsupp	# 44: fdmove
-	long		fdsqrt		- tbl_unsupp 	# 45: fdsqrt
+	long		fdsqrt		- tbl_unsupp	# 45: fdsqrt
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
@@ -11496,31 +11496,31 @@
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
-	long		fsabs		- tbl_unsupp 	# 58: fsabs
+	long		fsabs		- tbl_unsupp	# 58: fsabs
 	long		tbl_unsupp	- tbl_unsupp
-	long		fsneg		- tbl_unsupp 	# 5a: fsneg
+	long		fsneg		- tbl_unsupp	# 5a: fsneg
 	long		tbl_unsupp	- tbl_unsupp
 	long		fdabs		- tbl_unsupp	# 5c: fdabs
 	long		tbl_unsupp	- tbl_unsupp
-	long		fdneg		- tbl_unsupp 	# 5e: fdneg
+	long		fdneg		- tbl_unsupp	# 5e: fdneg
 	long		tbl_unsupp	- tbl_unsupp
 	long		fsdiv		- tbl_unsupp	# 60: fsdiv
 	long		tbl_unsupp	- tbl_unsupp
 	long		fsadd		- tbl_unsupp	# 62: fsadd
 	long		fsmul		- tbl_unsupp	# 63: fsmul
-	long		fddiv		- tbl_unsupp 	# 64: fddiv
+	long		fddiv		- tbl_unsupp	# 64: fddiv
 	long		tbl_unsupp	- tbl_unsupp
 	long		fdadd		- tbl_unsupp	# 66: fdadd
-	long		fdmul		- tbl_unsupp 	# 67: fdmul
+	long		fdmul		- tbl_unsupp	# 67: fdmul
 	long		fssub		- tbl_unsupp	# 68: fssub
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
-	long		fdsub		- tbl_unsupp 	# 6c: fdsub
+	long		fdsub		- tbl_unsupp	# 6c: fdsub
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fmul(): emulates the fmul instruction				#
+#	fmul(): emulates the fmul instruction				#
 #	fsmul(): emulates the fsmul instruction				#
 #	fdmul(): emulates the fdmul instruction				#
 #									#
@@ -11529,8 +11529,8 @@
 #	scale_to_zero_dst() - scale dst exponent to zero		#
 #	unf_res() - return default underflow result			#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan() - return QNAN result					#
-# 	res_snan() - return SNAN result					#
+#	res_qnan() - return QNAN result					#
+#	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -11548,12 +11548,12 @@
 # instruction won't cause an exception. Use the regular fmul to		#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
 
-	align 		0x10
+	align		0x10
 tbl_fmul_ovfl:
 	long		0x3fff - 0x7ffe		# ext_max
 	long		0x3fff - 0x407e		# sgl_max
@@ -11614,7 +11614,7 @@
 #
 # NORMAL:
 # - the result of the multiply operation will neither overflow nor underflow.
-# - do the multiply to the proper precision and rounding mode. 
+# - do the multiply to the proper precision and rounding mode.
 # - scale the result exponent using the scale factor. if both operands were
 # normalized then we really don't need to go through this scaling. but for now,
 # this will do.
@@ -11625,7 +11625,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -11665,7 +11665,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -11744,7 +11744,7 @@
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
 	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply
-	
+
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
 
@@ -11753,7 +11753,7 @@
 	fabs.x		%fp0,%fp1		# make a copy of result
 	fcmp.b		%fp1,&0x2		# is |result| >= 2.b?
 	fbge.w		fmul_ovfl_tst		# yes; overflow has occurred
-	
+
 # no, it didn't overflow; we have correct result
 	bra.w		fmul_normal_exit
 
@@ -11770,7 +11770,7 @@
 # of this operation then has its exponent scaled by -0x6000 to create the
 # exceptional operand.
 #
-fmul_unfl:	
+fmul_unfl:
 	bset		&unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
 
 # for fun, let's use only extended precision, round to zero. then, let
@@ -11803,7 +11803,7 @@
 	rts
 
 #
-# UNFL is enabled. 
+# UNFL is enabled.
 #
 fmul_unfl_ena:
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op
@@ -11819,7 +11819,7 @@
 fmul_unfl_ena_cont:
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp1	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp1	# execute multiply
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 
@@ -11854,7 +11854,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -11878,11 +11878,11 @@
 	mov.l		L_SCR3(%a6),%d1
 	andi.b		&0xc0,%d1		# keep rnd prec
 	ori.b		&rz_mode*0x10,%d1	# insert RZ
-	
+
 	fmov.l		%d1,%fpcr		# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp1	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp1	# execute multiply
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fabs.x		%fp1			# make absolute value
@@ -12024,22 +12024,22 @@
 #	norm() - normalize mantissa for EXOP on denorm			#
 #	scale_to_zero_src() - scale src exponent to zero		#
 #	ovf_res() - return default overflow result			#
-# 	unf_res() - return default underflow result			#
+#	unf_res() - return default underflow result			#
 #	res_qnan_1op() - return QNAN result				#
 #	res_snan_1op() - return SNAN result				#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
 #	d0 = round prec/mode						#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = result							#
 #	fp1 = EXOP (if exception occurred)				#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Handle NANs, infinities, and zeroes as special cases. Divide	#
+#	Handle NANs, infinities, and zeroes as special cases. Divide	#
 # norms into extended, single, and double precision.			#
-# 	Norms can be emulated w/ a regular fmove instruction. For	#
+#	Norms can be emulated w/ a regular fmove instruction. For	#
 # sgl/dbl, must scale exponent and perform an "fmove". Check to see	#
 # if the result would have overflowed/underflowed. If so, use unf_res()	#
 # or ovf_res() to return the default result. Also return EXOP if	#
@@ -12065,7 +12065,7 @@
 
 	mov.b		STAG(%a6),%d1		# fetch src optype tag
 	bne.w		fin_not_norm		# optimize on non-norm input
-		
+
 #
 # FP MOVE IN: NORMs and DENORMs ONLY!
 #
@@ -12126,9 +12126,9 @@
 
 #
 # operand is to be rounded to single or double precision
-#	
+#
 fin_not_ext:
-	cmpi.b		%d0,&s_mode*0x10 	# separate sgl/dbl prec
+	cmpi.b		%d0,&s_mode*0x10	# separate sgl/dbl prec
 	bne.b		fin_dbl
 
 #
@@ -12212,10 +12212,10 @@
 	bsr.l		unf_res			# calculate default result
 	or.b		%d0,FPSR_CC(%a6)	# unf_res may have set 'Z'
 	fmovm.x		FP_SCR0(%a6),&0x80	# return default result in fp0
-	rts	
+	rts
 
 #
-# operand will underflow AND underflow or inexact is enabled. 
+# operand will underflow AND underflow or inexact is enabled.
 # therefore, we must return the result rounded to extended precision.
 #
 fin_sd_unfl_ena:
@@ -12337,7 +12337,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fdiv(): emulates the fdiv instruction				#
+#	fdiv(): emulates the fdiv instruction				#
 #	fsdiv(): emulates the fsdiv instruction				#
 #	fddiv(): emulates the fddiv instruction				#
 #									#
@@ -12346,8 +12346,8 @@
 #	scale_to_zero_dst() - scale dst exponent to zero		#
 #	unf_res() - return default underflow result			#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan() - return QNAN result					#
-# 	res_snan() - return SNAN result					#
+#	res_qnan() - return QNAN result					#
+#	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -12365,7 +12365,7 @@
 # instruction won't cause an exception. Use the regular fdiv to		#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
@@ -12402,7 +12402,7 @@
 	or.b		STAG(%a6),%d1		# combine src tags
 
 	bne.w		fdiv_not_norm		# optimize on non-norm input
-		
+
 #
 # DIVIDE: NORMs and DENORMs ONLY!
 #
@@ -12468,7 +12468,7 @@
 fdiv_no_ovfl:
 	mov.l		(%sp)+,%d0		# restore scale factor
 	bra.b		fdiv_normal_exit
-	
+
 fdiv_may_ovfl:
 	mov.l		%d0,-(%sp)		# save scale factor
 
@@ -12501,7 +12501,7 @@
 	bne.b		fdiv_ovfl_ena		# yes
 
 fdiv_ovfl_dis:
-	btst		&neg_bit,FPSR_CC(%a6) 	# is result negative?
+	btst		&neg_bit,FPSR_CC(%a6)	# is result negative?
 	sne		%d1			# set sign param accordingly
 	mov.l		L_SCR3(%a6),%d0		# pass prec:rnd
 	bsr.l		ovf_res			# calculate default result
@@ -12573,7 +12573,7 @@
 	rts
 
 #
-# UNFL is enabled. 
+# UNFL is enabled.
 #
 fdiv_unfl_ena:
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op
@@ -12637,8 +12637,8 @@
 #
 # we still don't know if underflow occurred. result is ~ equal to 1. but,
 # we don't know if the result was an underflow that rounded up to a 1
-# or a normalized number that rounded down to a 1. so, redo the entire 
-# operation using RZ as the rounding mode to see what the pre-rounded 
+# or a normalized number that rounded down to a 1. so, redo the entire
+# operation using RZ as the rounding mode to see what the pre-rounded
 # result is. this case should be relatively rare.
 #
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op into fp1
@@ -12765,8 +12765,8 @@
 	rts
 
 #
-# The destination was an INF w/ an In Range or ZERO source, the result is 
-# an INF w/ the proper sign. 
+# The destination was an INF w/ an In Range or ZERO source, the result is
+# an INF w/ the proper sign.
 # The 68881/882 returns the destination INF w/ the new sign(if the j-bit of the
 # dst INF is set, then then j-bit of the result INF is also set).
 #
@@ -12796,11 +12796,11 @@
 #	fdneg(): emulates the fdneg instruction				#
 #									#
 # XREF ****************************************************************	#
-# 	norm() - normalize a denorm to provide EXOP			#
+#	norm() - normalize a denorm to provide EXOP			#
 #	scale_to_zero_src() - scale sgl/dbl source exponent		#
 #	ovf_res() - return default overflow result			#
 #	unf_res() - return default underflow result			#
-# 	res_qnan_1op() - return QNAN result				#
+#	res_qnan_1op() - return QNAN result				#
 #	res_snan_1op() - return SNAN result				#
 #									#
 # INPUT ***************************************************************	#
@@ -12838,7 +12838,7 @@
 	mov.l		%d0,L_SCR3(%a6)		# store rnd info
 	mov.b		STAG(%a6),%d1
 	bne.w		fneg_not_norm		# optimize on non-norm input
-		
+
 #
 # NEGATE SIGN : norms and denorms ONLY!
 #
@@ -12897,7 +12897,7 @@
 	neg.w		%d0			# new exponent = -(shft val)
 	addi.w		&0x6000,%d0		# add new bias to exponent
 	mov.w		FP_SCR0_EX(%a6),%d1	# fetch old sign,exp
-	andi.w		&0x8000,%d1	 	# keep old sign
+	andi.w		&0x8000,%d1		# keep old sign
 	andi.w		&0x7fff,%d0		# clear sign position
 	or.w		%d1,%d0			# concat old sign, new exponent
 	mov.w		%d0,FP_SCR0_EX(%a6)	# insert new exponent
@@ -12976,7 +12976,7 @@
 fneg_sd_unfl:
 	bset		&unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
 
-	eori.b		&0x80,FP_SCR0_EX(%a6)	# negate sign	
+	eori.b		&0x80,FP_SCR0_EX(%a6)	# negate sign
 	bpl.b		fneg_sd_unfl_tst
 	bset		&neg_bit,FPSR_CC(%a6)	# set 'N' ccode bit
 
@@ -12992,10 +12992,10 @@
 	bsr.l		unf_res			# calculate default result
 	or.b		%d0,FPSR_CC(%a6)	# unf_res may have set 'Z'
 	fmovm.x		FP_SCR0(%a6),&0x80	# return default result in fp0
-	rts	
+	rts
 
 #
-# operand will underflow AND underflow is enabled. 
+# operand will underflow AND underflow is enabled.
 # therefore, we must return the result rounded to extended precision.
 #
 fneg_sd_unfl_ena:
@@ -13117,19 +13117,19 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	ftst(): emulates the ftest instruction				#
+#	ftst(): emulates the ftest instruction				#
 #									#
 # XREF ****************************************************************	#
-# 	res{s,q}nan_1op() - set NAN result for monadic instruction	#
+#	res{s,q}nan_1op() - set NAN result for monadic instruction	#
 #									#
 # INPUT ***************************************************************	#
-# 	a0 = pointer to extended precision source operand		#
+#	a0 = pointer to extended precision source operand		#
 #									#
 # OUTPUT **************************************************************	#
 #	none								#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Check the source operand tag (STAG) and set the FPCR according	#
+#	Check the source operand tag (STAG) and set the FPCR according	#
 # to the operand type and sign.						#
 #									#
 #########################################################################
@@ -13138,7 +13138,7 @@
 ftst:
 	mov.b		STAG(%a6),%d1
 	bne.b		ftst_not_norm		# optimize on non-norm input
-		
+
 #
 # Norm:
 #
@@ -13186,7 +13186,7 @@
 ftst_inf_m:
 	mov.b		&inf_bmask+neg_bmask,FPSR_CC(%a6) # set 'I','N' ccode bits
 	rts
-	
+
 #
 # Zero:
 #
@@ -13215,13 +13215,13 @@
 #	fp0 = result							#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Separate according to operand type. Unnorms don't pass through 	#
-# here. For norms, load the rounding mode/prec, execute a "fint", then 	#
+#	Separate according to operand type. Unnorms don't pass through	#
+# here. For norms, load the rounding mode/prec, execute a "fint", then	#
 # store the resulting FPSR bits.					#
-# 	For denorms, force the j-bit to a one and do the same as for	#
-# norms. Denorms are so low that the answer will either be a zero or a 	#
+#	For denorms, force the j-bit to a one and do the same as for	#
+# norms. Denorms are so low that the answer will either be a zero or a	#
 # one.									#
-# 	For zeroes/infs/NANs, return the same while setting the FPSR	#
+#	For zeroes/infs/NANs, return the same while setting the FPSR	#
 # as appropriate.							#
 #									#
 #########################################################################
@@ -13230,7 +13230,7 @@
 fint:
 	mov.b		STAG(%a6),%d1
 	bne.b		fint_not_norm		# optimize on non-norm input
-		
+
 #
 # Norm:
 #
@@ -13240,7 +13240,7 @@
 	fmov.l		%d0,%fpcr		# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fint.x 		SRC(%a0),%fp0		# execute fint
+	fint.x		SRC(%a0),%fp0		# execute fint
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fmov.l		%fpsr,%d0		# save FPSR
@@ -13318,16 +13318,16 @@
 #	d0 = round precision/mode					#
 #									#
 # OUTPUT **************************************************************	#
-# 	fp0 = result							#
+#	fp0 = result							#
 #									#
 # ALGORITHM ***********************************************************	#
 #	Separate according to operand type. Unnorms don't pass through	#
-# here. For norms, load the rounding mode/prec, execute a "fintrz", 	#
+# here. For norms, load the rounding mode/prec, execute a "fintrz",	#
 # then store the resulting FPSR bits.					#
-# 	For denorms, force the j-bit to a one and do the same as for	#
+#	For denorms, force the j-bit to a one and do the same as for	#
 # norms. Denorms are so low that the answer will either be a zero or a	#
 # one.									#
-# 	For zeroes/infs/NANs, return the same while setting the FPSR	#
+#	For zeroes/infs/NANs, return the same while setting the FPSR	#
 # as appropriate.							#
 #									#
 #########################################################################
@@ -13336,7 +13336,7 @@
 fintrz:
 	mov.b		STAG(%a6),%d1
 	bne.b		fintrz_not_norm		# optimize on non-norm input
-		
+
 #
 # Norm:
 #
@@ -13431,17 +13431,17 @@
 #									#
 # ALGORITHM ***********************************************************	#
 #	Handle NANs, infinities, and zeroes as special cases. Divide	#
-# norms into extended, single, and double precision. 			#
-# 	Simply clear sign for extended precision norm. Ext prec denorm	#
+# norms into extended, single, and double precision.			#
+#	Simply clear sign for extended precision norm. Ext prec denorm	#
 # gets an EXOP created for it since it's an underflow.			#
 #	Double and single precision can overflow and underflow. First,	#
 # scale the operand such that the exponent is zero. Perform an "fabs"	#
-# using the correct rnd mode/prec. Check to see if the original 	#
+# using the correct rnd mode/prec. Check to see if the original		#
 # exponent would take an exception. If so, use unf_res() or ovf_res()	#
 # to calculate the default result. Also, create the EXOP for the	#
-# exceptional case. If no exception should occur, insert the correct 	#
+# exceptional case. If no exception should occur, insert the correct	#
 # result exponent and return.						#
-# 	Unnorms don't pass through here.				#
+#	Unnorms don't pass through here.				#
 #									#
 #########################################################################
 
@@ -13461,7 +13461,7 @@
 	mov.l		%d0,L_SCR3(%a6)		# store rnd info
 	mov.b		STAG(%a6),%d1
 	bne.w		fabs_not_norm		# optimize on non-norm input
-		
+
 #
 # ABSOLUTE VALUE: norms and denorms ONLY!
 #
@@ -13607,10 +13607,10 @@
 	bsr.l		unf_res			# calculate default result
 	or.b		%d0,FPSR_CC(%a6)	# set possible 'Z' ccode
 	fmovm.x		FP_SCR0(%a6),&0x80	# return default result in fp0
-	rts	
+	rts
 
 #
-# operand will underflow AND underflow is enabled. 
+# operand will underflow AND underflow is enabled.
 # therefore, we must return the result rounded to extended precision.
 #
 fabs_sd_unfl_ena:
@@ -13732,10 +13732,10 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fcmp(): fp compare op routine					#
+#	fcmp(): fp compare op routine					#
 #									#
 # XREF ****************************************************************	#
-# 	res_qnan() - return QNAN result					#
+#	res_qnan() - return QNAN result					#
 #	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
@@ -13747,7 +13747,7 @@
 #	None								#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Handle NANs and denorms as special cases. For everything else,	#
+#	Handle NANs and denorms as special cases. For everything else,	#
 # just use the actual fcmp instruction to produce the correct condition	#
 # codes.								#
 #									#
@@ -13760,14 +13760,14 @@
 	lsl.b		&0x3,%d1
 	or.b		STAG(%a6),%d1
 	bne.b		fcmp_not_norm		# optimize on non-norm input
-		
+
 #
 # COMPARE FP OPs : NORMs, ZEROs, INFs, and "corrected" DENORMs
 #
 fcmp_norm:
 	fmovm.x		DST(%a1),&0x80		# load dst op
 
-	fcmp.x 		%fp0,SRC(%a0)		# do compare
+	fcmp.x		%fp0,SRC(%a0)		# do compare
 
 	fmov.l		%fpsr,%d0		# save FPSR
 	rol.l		&0x8,%d0		# extract ccode bits
@@ -13788,7 +13788,7 @@
 	short		fcmp_norm	- tbl_fcmp_op # NORM - ZERO
 	short		fcmp_norm	- tbl_fcmp_op # NORM - INF
 	short		fcmp_res_qnan	- tbl_fcmp_op # NORM - QNAN
-	short		fcmp_nrm_dnrm 	- tbl_fcmp_op # NORM - DENORM
+	short		fcmp_nrm_dnrm	- tbl_fcmp_op # NORM - DENORM
 	short		fcmp_res_snan	- tbl_fcmp_op # NORM - SNAN
 	short		tbl_fcmp_op	- tbl_fcmp_op #
 	short		tbl_fcmp_op	- tbl_fcmp_op #
@@ -13850,8 +13850,8 @@
 	rts
 
 #
-# DENORMs are a little more difficult. 
-# If you have a 2 DENORMs, then you can just force the j-bit to a one 
+# DENORMs are a little more difficult.
+# If you have a 2 DENORMs, then you can just force the j-bit to a one
 # and use the fcmp_norm routine.
 # If you have a DENORM and an INF or ZERO, just force the DENORM's j-bit to a one
 # and use the fcmp_norm routine.
@@ -13892,7 +13892,7 @@
 	mov.l		SRC_LO(%a0),FP_SCR0_LO(%a6)
 	lea		FP_SCR1(%a6),%a1
 	lea		FP_SCR0(%a6),%a0
-	bra.w		fcmp_norm	
+	bra.w		fcmp_norm
 
 fcmp_nrm_dnrm:
 	mov.b		SRC_EX(%a0),%d0		# determine if like signs
@@ -13924,15 +13924,15 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fsglmul(): emulates the fsglmul instruction			#
+#	fsglmul(): emulates the fsglmul instruction			#
 #									#
 # XREF ****************************************************************	#
 #	scale_to_zero_src() - scale src exponent to zero		#
 #	scale_to_zero_dst() - scale dst exponent to zero		#
 #	unf_res4() - return default underflow result for sglop		#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan() - return QNAN result					#
-# 	res_snan() - return SNAN result					#
+#	res_qnan() - return QNAN result					#
+#	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -13950,7 +13950,7 @@
 # instruction won't cause an exception. Use the regular fsglmul to	#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
@@ -13982,11 +13982,11 @@
 
 	add.l		(%sp)+,%d0		# SCALE_FACTOR = scale1 + scale2
 
-	cmpi.l		%d0,&0x3fff-0x7ffe 	# would result ovfl?
+	cmpi.l		%d0,&0x3fff-0x7ffe	# would result ovfl?
 	beq.w		fsglmul_may_ovfl	# result may rnd to overflow
 	blt.w		fsglmul_ovfl		# result will overflow
 
-	cmpi.l		%d0,&0x3fff+0x0001 	# would result unfl?
+	cmpi.l		%d0,&0x3fff+0x0001	# would result unfl?
 	beq.w		fsglmul_may_unfl	# result may rnd to no unfl
 	bgt.w		fsglmul_unfl		# result will underflow
 
@@ -14073,7 +14073,7 @@
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
 	fsglmul.x	FP_SCR0(%a6),%fp0	# execute sgl multiply
-	
+
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
 
@@ -14082,7 +14082,7 @@
 	fabs.x		%fp0,%fp1		# make a copy of result
 	fcmp.b		%fp1,&0x2		# is |result| >= 2.b?
 	fbge.w		fsglmul_ovfl_tst	# yes; overflow has occurred
-	
+
 # no, it didn't overflow; we have correct result
 	bra.w		fsglmul_normal_exit
 
@@ -14116,7 +14116,7 @@
 	rts
 
 #
-# UNFL is enabled. 
+# UNFL is enabled.
 #
 fsglmul_unfl_ena:
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op
@@ -14124,7 +14124,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fsglmul.x	FP_SCR0(%a6),%fp1	# execute sgl multiply	
+	fsglmul.x	FP_SCR0(%a6),%fp1	# execute sgl multiply
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 
@@ -14149,7 +14149,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fsglmul.x	FP_SCR0(%a6),%fp0	# execute sgl multiply	
+	fsglmul.x	FP_SCR0(%a6),%fp0	# execute sgl multiply
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -14173,11 +14173,11 @@
 	mov.l		L_SCR3(%a6),%d1
 	andi.b		&0xc0,%d1		# keep rnd prec
 	ori.b		&rz_mode*0x10,%d1	# insert RZ
-	
+
 	fmov.l		%d1,%fpcr		# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fsglmul.x	FP_SCR0(%a6),%fp1	# execute sgl multiply	
+	fsglmul.x	FP_SCR0(%a6),%fp1	# execute sgl multiply
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fabs.x		%fp1			# make absolute value
@@ -14265,15 +14265,15 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fsgldiv(): emulates the fsgldiv instruction			#
+#	fsgldiv(): emulates the fsgldiv instruction			#
 #									#
 # XREF ****************************************************************	#
 #	scale_to_zero_src() - scale src exponent to zero		#
 #	scale_to_zero_dst() - scale dst exponent to zero		#
 #	unf_res4() - return default underflow result for sglop		#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan() - return QNAN result					#
-# 	res_snan() - return SNAN result					#
+#	res_qnan() - return QNAN result					#
+#	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -14291,7 +14291,7 @@
 # instruction won't cause an exception. Use the regular fsgldiv to	#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
@@ -14306,7 +14306,7 @@
 	or.b		STAG(%a6),%d1		# combine src tags
 
 	bne.w		fsgldiv_not_norm	# optimize on non-norm input
-		
+
 #
 # DIVIDE: NORMs and DENORMs ONLY!
 #
@@ -14333,7 +14333,7 @@
 	cmpi.l		%d0,&0x3fff-0x7ffe
 	ble.w		fsgldiv_may_ovfl
 
-	cmpi.l		%d0,&0x3fff-0x0000 	# will result underflow?
+	cmpi.l		%d0,&0x3fff-0x0000	# will result underflow?
 	beq.w		fsgldiv_may_unfl	# maybe
 	bgt.w		fsgldiv_unfl		# yes; go handle underflow
 
@@ -14393,7 +14393,7 @@
 	bne.b		fsgldiv_ovfl_ena	# yes
 
 fsgldiv_ovfl_dis:
-	btst		&neg_bit,FPSR_CC(%a6) 	# is result negative
+	btst		&neg_bit,FPSR_CC(%a6)	# is result negative
 	sne		%d1			# set sign param accordingly
 	mov.l		L_SCR3(%a6),%d0		# pass prec:rnd
 	andi.b		&0x30,%d0		# kill precision
@@ -14449,7 +14449,7 @@
 	rts
 
 #
-# UNFL is enabled. 
+# UNFL is enabled.
 #
 fsgldiv_unfl_ena:
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op
@@ -14500,8 +14500,8 @@
 #
 # we still don't know if underflow occurred. result is ~ equal to 1. but,
 # we don't know if the result was an underflow that rounded up to a 1
-# or a normalized number that rounded down to a 1. so, redo the entire 
-# operation using RZ as the rounding mode to see what the pre-rounded 
+# or a normalized number that rounded down to a 1. so, redo the entire
+# operation using RZ as the rounding mode to see what the pre-rounded
 # result is. this case should be relatively rare.
 #
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op into %fp1
@@ -14605,25 +14605,25 @@
 #	fdadd(): emulates the fdadd instruction				#
 #									#
 # XREF ****************************************************************	#
-# 	addsub_scaler2() - scale the operands so they won't take exc	#
+#	addsub_scaler2() - scale the operands so they won't take exc	#
 #	ovf_res() - return default overflow result			#
 #	unf_res() - return default underflow result			#
 #	res_qnan() - set QNAN result					#
-# 	res_snan() - set SNAN result					#
+#	res_snan() - set SNAN result					#
 #	res_operr() - set OPERR result					#
 #	scale_to_zero_src() - set src operand exponent equal to zero	#
 #	scale_to_zero_dst() - set dst operand exponent equal to zero	#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
-# 	a1 = pointer to extended precision destination operand		#
+#	a1 = pointer to extended precision destination operand		#
 #									#
 # OUTPUT **************************************************************	#
 #	fp0 = result							#
 #	fp1 = EXOP (if exception occurred)				#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Handle NANs, infinities, and zeroes as special cases. Divide	#
+#	Handle NANs, infinities, and zeroes as special cases. Divide	#
 # norms into extended, single, and double precision.			#
 #	Do addition after scaling exponents such that exception won't	#
 # occur. Then, check result exponent to see if exception would have	#
@@ -14837,7 +14837,7 @@
 
 #
 # result is equal to the smallest normalized number in the selected precision
-# if the precision is extended, this result could not have come from an 
+# if the precision is extended, this result could not have come from an
 # underflow that rounded up.
 #
 fadd_may_unfl:
@@ -14859,7 +14859,7 @@
 # ok, so now the result has a exponent equal to the smallest normalized
 # exponent for the selected precision. also, the mantissa is equal to
 # 0x8000000000000000 and this mantissa is the result of rounding non-zero
-# g,r,s. 
+# g,r,s.
 # now, we must determine whether the pre-rounded result was an underflow
 # rounded "up" or a normalized number rounded "down".
 # so, we do this be re-executing the add using RZ as the rounding mode and
@@ -14970,7 +14970,7 @@
 	fmov.s		&0x00000000,%fp0	# return +ZERO
 	mov.b		&z_bmask,FPSR_CC(%a6)	# set Z
 	rts
-	
+
 #
 # the ZEROes have opposite signs:
 # - therefore, we return +ZERO if the rounding modes are RN,RZ, or RP.
@@ -15024,7 +15024,7 @@
 	eor.b		%d1,%d0
 	bmi.l		res_operr		# weed out (-INF)+(+INF)
 
-# ok, so it's not an OPERR. but, we do have to remember to return the 
+# ok, so it's not an OPERR. but, we do have to remember to return the
 # src INF since that's where the 881/882 gets the j-bit from...
 
 #
@@ -15058,25 +15058,25 @@
 #	fdsub(): emulates the fdsub instruction				#
 #									#
 # XREF ****************************************************************	#
-# 	addsub_scaler2() - scale the operands so they won't take exc	#
+#	addsub_scaler2() - scale the operands so they won't take exc	#
 #	ovf_res() - return default overflow result			#
 #	unf_res() - return default underflow result			#
 #	res_qnan() - set QNAN result					#
-# 	res_snan() - set SNAN result					#
+#	res_snan() - set SNAN result					#
 #	res_operr() - set OPERR result					#
 #	scale_to_zero_src() - set src operand exponent equal to zero	#
 #	scale_to_zero_dst() - set dst operand exponent equal to zero	#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
-# 	a1 = pointer to extended precision destination operand		#
+#	a1 = pointer to extended precision destination operand		#
 #									#
 # OUTPUT **************************************************************	#
 #	fp0 = result							#
 #	fp1 = EXOP (if exception occurred)				#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Handle NANs, infinities, and zeroes as special cases. Divide	#
+#	Handle NANs, infinities, and zeroes as special cases. Divide	#
 # norms into extended, single, and double precision.			#
 #	Do subtraction after scaling exponents such that exception won't#
 # occur. Then, check result exponent to see if exception would have	#
@@ -15226,7 +15226,7 @@
 	add.l		&0xc,%sp
 
 	fmovm.x		FP_SCR1(%a6),&0x80	# load dst op
-	
+
 	fmov.l		&rz_mode*0x10,%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
@@ -15290,7 +15290,7 @@
 
 #
 # result is equal to the smallest normalized number in the selected precision
-# if the precision is extended, this result could not have come from an 
+# if the precision is extended, this result could not have come from an
 # underflow that rounded up.
 #
 fsub_may_unfl:
@@ -15312,7 +15312,7 @@
 # ok, so now the result has a exponent equal to the smallest normalized
 # exponent for the selected precision. also, the mantissa is equal to
 # 0x8000000000000000 and this mantissa is the result of rounding non-zero
-# g,r,s. 
+# g,r,s.
 # now, we must determine whether the pre-rounded result was an underflow
 # rounded "up" or a normalized number rounded "down".
 # so, we do this be re-executing the add using RZ as the rounding mode and
@@ -15468,7 +15468,7 @@
 
 #
 # both operands are INFs. an OPERR will result if the INFs have the
-# same signs. else, 
+# same signs. else,
 #
 fsub_inf_2:
 	mov.b		SRC_EX(%a0),%d0		# exclusive or the signs
@@ -15483,7 +15483,7 @@
 	fmovm.x		SRC(%a0),&0x80		# return src INF
 	fneg.x		%fp0			# invert sign
 	fbge.w		fsub_inf_done		# sign is now positive
-	mov.b		&neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG	
+	mov.b		&neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
 	rts
 
 fsub_inf_dst:
@@ -15499,7 +15499,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fsqrt(): emulates the fsqrt instruction				#
+#	fsqrt(): emulates the fsqrt instruction				#
 #	fssqrt(): emulates the fssqrt instruction			#
 #	fdsqrt(): emulates the fdsqrt instruction			#
 #									#
@@ -15507,8 +15507,8 @@
 #	scale_sqrt() - scale the source operand				#
 #	unf_res() - return default underflow result			#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan_1op() - return QNAN result				#
-# 	res_snan_1op() - return SNAN result				#
+#	res_qnan_1op() - return QNAN result				#
+#	res_snan_1op() - return SNAN result				#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -15525,7 +15525,7 @@
 # instruction won't cause an exception. Use the regular fsqrt to	#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
@@ -15547,7 +15547,7 @@
 	clr.w		%d1
 	mov.b		STAG(%a6),%d1
 	bne.w		fsqrt_not_norm		# optimize on non-norm input
-		
+
 #
 # SQUARE ROOT: norms and denorms ONLY!
 #
@@ -15669,7 +15669,7 @@
 	fmov.l		&rz_mode*0x10,%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fsqrt.x 	FP_SCR0(%a6),%fp0	# execute square root
+	fsqrt.x		FP_SCR0(%a6),%fp0	# execute square root
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -15689,10 +15689,10 @@
 	bsr.l		unf_res			# calculate default result
 	or.b		%d0,FPSR_CC(%a6)	# set possible 'Z' ccode
 	fmovm.x		FP_SCR0(%a6),&0x80	# return default result in fp0
-	rts	
+	rts
 
 #
-# operand will underflow AND underflow is enabled. 
+# operand will underflow AND underflow is enabled.
 # therefore, we must return the result rounded to extended precision.
 #
 fsqrt_sd_unfl_ena:
@@ -15808,15 +15808,15 @@
 	bra.l		res_qnan_1op
 
 #
-# 	fsqrt(+0) = +0
-# 	fsqrt(-0) = -0
+#	fsqrt(+0) = +0
+#	fsqrt(-0) = -0
 #	fsqrt(+INF) = +INF
-# 	fsqrt(-INF) = OPERR
+#	fsqrt(-INF) = OPERR
 #
 fsqrt_zero:
 	tst.b		SRC_EX(%a0)		# is ZERO positive or negative?
 	bmi.b		fsqrt_zero_m		# negative
-fsqrt_zero_p:	
+fsqrt_zero_p:
 	fmov.s		&0x00000000,%fp0	# return +ZERO
 	mov.b		&z_bmask,FPSR_CC(%a6)	# set 'Z' ccode bit
 	rts
@@ -15846,14 +15846,14 @@
 # INPUT ***************************************************************	#
 #	FP_SRC(a6) = fp op1(src)					#
 #	FP_DST(a6) = fp op2(dst)					#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SRC(a6) = fp op1 scaled(src)					#
 #	FP_DST(a6) = fp op2 scaled(dst)					#
 #	d0         = scale amount					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	If the DST exponent is > the SRC exponent, set the DST exponent	#
+#	If the DST exponent is > the SRC exponent, set the DST exponent	#
 # equal to 0x3fff and scale the SRC exponent by the value that the	#
 # DST exponent was scaled by. If the SRC exponent is greater or equal,	#
 # do the opposite. Return this scale factor in d0.			#
@@ -15916,7 +15916,7 @@
 	andi.w		&0x8000,FP_SCR0_EX(%a6)	# zero src exponent
 	bset		&0x0,1+FP_SCR0_EX(%a6)	# set exp = 1
 
-	mov.l		(%sp)+,%d0		# return SCALE factor	
+	mov.l		(%sp)+,%d0		# return SCALE factor
 	rts
 
 # src exp is >= dst exp; scale src to exp = 0x3fff
@@ -15952,7 +15952,7 @@
 	andi.w		&0x8000,FP_SCR1_EX(%a6)	# zero dst exponent
 	bset		&0x0,1+FP_SCR1_EX(%a6)	# set exp = 1
 
-	mov.l		(%sp)+,%d0		# return SCALE factor	
+	mov.l		(%sp)+,%d0		# return SCALE factor
 	rts
 
 ##########################################################################
@@ -15967,14 +15967,14 @@
 #									#
 # INPUT ***************************************************************	#
 #	FP_SCR0(a6) = extended precision operand to be scaled		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SCR0(a6) = scaled extended precision operand			#
 #	d0	    = scale value					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Set the exponent of the input operand to 0x3fff. Save the value	#
-# of the difference between the original and new exponent. Then, 	#
+#	Set the exponent of the input operand to 0x3fff. Save the value	#
+# of the difference between the original and new exponent. Then,	#
 # normalize the operand if it was a DENORM. Add this normalization	#
 # value to the previous value. Return the result.			#
 #									#
@@ -16020,17 +16020,17 @@
 #									#
 # INPUT ***************************************************************	#
 #	FP_SCR0(a6) = extended precision operand to be scaled		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SCR0(a6) = scaled extended precision operand			#
 #	d0	    = scale value					#
 #									#
 # ALGORITHM ***********************************************************	#
 #	If the input operand is a DENORM, normalize it.			#
-# 	If the exponent of the input operand is even, set the exponent	#
-# to 0x3ffe and return a scale factor of "(exp-0x3ffe)/2". If the 	#
+#	If the exponent of the input operand is even, set the exponent	#
+# to 0x3ffe and return a scale factor of "(exp-0x3ffe)/2". If the	#
 # exponent of the input operand is off, set the exponent to ox3fff and	#
-# return a scale factor of "(exp-0x3fff)/2". 				#
+# return a scale factor of "(exp-0x3fff)/2".				#
 #									#
 #########################################################################
 
@@ -16094,14 +16094,14 @@
 #									#
 # INPUT ***************************************************************	#
 #	FP_SCR1(a6) = extended precision operand to be scaled		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SCR1(a6) = scaled extended precision operand			#
 #	d0	    = scale value					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Set the exponent of the input operand to 0x3fff. Save the value	#
-# of the difference between the original and new exponent. Then, 	#
+#	Set the exponent of the input operand to 0x3fff. Save the value	#
+# of the difference between the original and new exponent. Then,	#
 # normalize the operand if it was a DENORM. Add this normalization	#
 # value to the previous value. Return the result.			#
 #									#
@@ -16149,21 +16149,21 @@
 # INPUT ***************************************************************	#
 #	FP_SRC(a6) = pointer to extended precision src operand		#
 #	FP_DST(a6) = pointer to extended precision dst operand		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default result						#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	If either operand (but not both operands) of an operation is a	#
+#	If either operand (but not both operands) of an operation is a	#
 # nonsignalling NAN, then that NAN is returned as the result. If both	#
-# operands are nonsignalling NANs, then the destination operand 	#
+# operands are nonsignalling NANs, then the destination operand		#
 # nonsignalling NAN is returned as the result.				#
-# 	If either operand to an operation is a signalling NAN (SNAN),	#
+#	If either operand to an operation is a signalling NAN (SNAN),	#
 # then, the SNAN bit is set in the FPSR EXC byte. If the SNAN trap	#
-# enable bit is set in the FPCR, then the trap is taken and the 	#
+# enable bit is set in the FPCR, then the trap is taken and the		#
 # destination is not modified. If the SNAN trap enable bit is not set,	#
-# then the SNAN is converted to a nonsignalling NAN (by setting the 	#
-# SNAN bit in the operand to one), and the operation continues as 	#
+# then the SNAN is converted to a nonsignalling NAN (by setting the	#
+# SNAN bit in the operand to one), and the operation continues as	#
 # described in the preceding paragraph, for nonsignalling NANs.		#
 #	Make sure the appropriate FPSR bits are set before exiting.	#
 #									#
@@ -16202,7 +16202,7 @@
 	lea		FP_DST(%a6), %a0
 	cmp.b		STAG(%a6), &SNAN
 	bne		nan_done
-	or.l		&aiop_mask+snan_mask, USER_FPSR(%a6)	
+	or.l		&aiop_mask+snan_mask, USER_FPSR(%a6)
 nan_done:
 	or.l		&nan_mask, USER_FPSR(%a6)
 nan_comp:
@@ -16215,14 +16215,14 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	res_operr(): return default result during operand error		#
+#	res_operr(): return default result during operand error		#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default operand error result				#
 #									#
@@ -16230,8 +16230,8 @@
 #	An nonsignalling NAN is returned as the default result when	#
 # an operand error occurs for the following cases:			#
 #									#
-# 	Multiply: (Infinity x Zero)					#
-# 	Divide  : (Zero / Zero) || (Infinity / Infinity)		#
+#	Multiply: (Infinity x Zero)					#
+#	Divide  : (Zero / Zero) || (Infinity / Infinity)		#
 #									#
 #########################################################################
 
@@ -16241,7 +16241,7 @@
 	fmovm.x		nan_return(%pc), &0x80
 	rts
 
-nan_return:	
+nan_return:
 	long		0x7fff0000, 0xffffffff, 0xffffffff
 
 #########################################################################
@@ -16268,7 +16268,7 @@
 # or false.								#
 #	If a BSUN exception should be indicated, the BSUN and ABSUN	#
 # bits are set in the stacked FPSR. If the BSUN exception is enabled,	#
-# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an 	#
+# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an	#
 # enabled BSUN should not be flagged and the predicate is true, then	#
 # Dn is fetched and decremented by one. If Dn is not equal to -1, add	#
 # the displacement value to the stacked PC so that when an "rte" is	#
@@ -16286,7 +16286,7 @@
 	ror.l		&0x8,%d1		# rotate to top byte
 	fmov.l		%d1,%fpsr		# insert into FPSR
 
-	mov.w		(tbl_fdbcc.b,%pc,%d0.w*2),%d1 # load table 
+	mov.w		(tbl_fdbcc.b,%pc,%d0.w*2),%d1 # load table
 	jmp		(tbl_fdbcc.b,%pc,%d1.w) # jump to fdbcc routine
 
 tbl_fdbcc:
@@ -16327,7 +16327,7 @@
 #									#
 # IEEE Nonaware tests							#
 #									#
-# For the IEEE nonaware tests, only the false branch changes the 	#
+# For the IEEE nonaware tests, only the false branch changes the	#
 # counter. However, the true branch may set bsun so we check to see	#
 # if the NAN bit is set, in which case BSUN and AIOP will be set.	#
 #									#
@@ -16376,7 +16376,7 @@
 	beq.w		fdbcc_false		# no;go handle counter
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 	bra.w		fdbcc_false		# no; go handle counter
 fdbcc_gt_yes:
 	rts					# do nothing
@@ -16384,7 +16384,7 @@
 #
 # not greater than:
 #
-#	NANvZvN	
+#	NANvZvN
 #
 fdbcc_ngt:
 	fbngt.w		fdbcc_ngt_yes		# not greater than?
@@ -16395,7 +16395,7 @@
 	beq.b		fdbcc_ngt_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 fdbcc_ngt_done:
 	rts					# no; do nothing
 
@@ -16411,14 +16411,14 @@
 	beq.w		fdbcc_false		# no;go handle counter
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 	bra.w		fdbcc_false		# no; go handle counter
 fdbcc_ge_yes:
 	btst		&nan_bit, FPSR_CC(%a6)	# is NAN set in cc?
 	beq.b		fdbcc_ge_yes_done	# no;go do nothing
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 fdbcc_ge_yes_done:
 	rts					# do nothing
 
@@ -16436,7 +16436,7 @@
 	beq.b		fdbcc_nge_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 fdbcc_nge_done:
 	rts					# no; do nothing
 
@@ -16452,7 +16452,7 @@
 	beq.w		fdbcc_false		# no; go handle counter
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 	bra.w		fdbcc_false		# no; go handle counter
 fdbcc_lt_yes:
 	rts					# do nothing
@@ -16471,7 +16471,7 @@
 	beq.b		fdbcc_nlt_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 fdbcc_nlt_done:
 	rts					# no; do nothing
 
@@ -16487,14 +16487,14 @@
 	beq.w		fdbcc_false		# no; go handle counter
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 	bra.w		fdbcc_false		# no; go handle counter
 fdbcc_le_yes:
 	btst		&nan_bit, FPSR_CC(%a6)	# is NAN set in cc?
 	beq.b		fdbcc_le_yes_done	# no; go do nothing
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
-	bne.w		fdbcc_bsun		# yes; we have an exception	
+	bne.w		fdbcc_bsun		# yes; we have an exception
 fdbcc_le_yes_done:
 	rts					# do nothing
 
@@ -16611,7 +16611,7 @@
 #	False
 #
 fdbcc_sf:
-	btst		&nan_bit, FPSR_CC(%a6) 	# is NAN set?
+	btst		&nan_bit, FPSR_CC(%a6)	# is NAN set?
 	beq.w		fdbcc_false		# no;go handle counter
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
@@ -16624,7 +16624,7 @@
 #	True
 #
 fdbcc_st:
-	btst		&nan_bit, FPSR_CC(%a6) 	# is NAN set?
+	btst		&nan_bit, FPSR_CC(%a6)	# is NAN set?
 	beq.b		fdbcc_st_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
@@ -16640,14 +16640,14 @@
 fdbcc_seq:
 	fbseq.w		fdbcc_seq_yes		# signalling equal?
 fdbcc_seq_no:
-	btst		&nan_bit, FPSR_CC(%a6) 	# is NAN set?
+	btst		&nan_bit, FPSR_CC(%a6)	# is NAN set?
 	beq.w		fdbcc_false		# no;go handle counter
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
 	bne.w		fdbcc_bsun		# yes; we have an exception
 	bra.w		fdbcc_false		# go handle counter
 fdbcc_seq_yes:
-	btst		&nan_bit, FPSR_CC(%a6) 	# is NAN set?
+	btst		&nan_bit, FPSR_CC(%a6)	# is NAN set?
 	beq.b		fdbcc_seq_yes_done	# no;go do nothing
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
@@ -16663,14 +16663,14 @@
 fdbcc_sneq:
 	fbsneq.w	fdbcc_sneq_yes		# signalling not equal?
 fdbcc_sneq_no:
-	btst		&nan_bit, FPSR_CC(%a6) 	# is NAN set?
+	btst		&nan_bit, FPSR_CC(%a6)	# is NAN set?
 	beq.w		fdbcc_false		# no;go handle counter
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
 	bne.w		fdbcc_bsun		# yes; we have an exception
 	bra.w		fdbcc_false		# go handle counter
 fdbcc_sneq_yes:
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		fdbcc_sneq_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
@@ -16684,7 +16684,7 @@
 #									#
 # For the IEEE aware tests, action is only taken if the result is false.#
 # Therefore, the opposite branch type is used to jump to the decrement	#
-# routine. 								#
+# routine.								#
 # The BSUN exception will not be set for any of these tests.		#
 #									#
 #########################################################################
@@ -16845,7 +16845,7 @@
 #	pc += sign_ext(16-bit displacement)
 #
 fdbcc_false:
-	mov.b		1+EXC_OPWORD(%a6), %d1	# fetch lo opword 
+	mov.b		1+EXC_OPWORD(%a6), %d1	# fetch lo opword
 	andi.w		&0x7, %d1		# extract count register
 
 	bsr.l		fetch_dreg		# fetch count value
@@ -16856,7 +16856,7 @@
 	bsr.l		store_dreg_l		# store new count value
 
 	cmpi.w		%d0, &-0x1		# is (Dn == -1)?
-	bne.b		fdbcc_false_cont	# no; 
+	bne.b		fdbcc_false_cont	# no;
 	rts
 
 fdbcc_false_cont:
@@ -16897,7 +16897,7 @@
 # or false.								#
 #	If a BSUN exception should be indicated, the BSUN and ABSUN	#
 # bits are set in the stacked FPSR. If the BSUN exception is enabled,	#
-# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an 	#
+# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an	#
 # enabled BSUN should not be flagged and the predicate is true, then	#
 # the ftrapcc_flg is set in the SPCOND_FLG location. These special	#
 # flags indicate to the calling routine to emulate the exceptional	#
@@ -16914,7 +16914,7 @@
 	ror.l		&0x8,%d1		# rotate to top byte
 	fmov.l		%d1,%fpsr		# insert into FPSR
 
-	mov.w		(tbl_ftrapcc.b,%pc,%d0.w*2), %d1 # load table 
+	mov.w		(tbl_ftrapcc.b,%pc,%d0.w*2), %d1 # load table
 	jmp		(tbl_ftrapcc.b,%pc,%d1.w) # jump to ftrapcc routine
 
 tbl_ftrapcc:
@@ -17006,7 +17006,7 @@
 #
 # not greater than:
 #
-#	NANvZvN	
+#	NANvZvN
 #
 ftrapcc_ngt:
 	fbngt.w		ftrapcc_ngt_yes		# not greater than?
@@ -17226,7 +17226,7 @@
 #	False
 #
 ftrapcc_sf:
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.b		ftrapcc_sf_done		# no; go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
@@ -17240,7 +17240,7 @@
 #	True
 #
 ftrapcc_st:
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		ftrapcc_trap		# no; go take trap
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
@@ -17255,7 +17255,7 @@
 ftrapcc_seq:
 	fbseq.w		ftrapcc_seq_yes		# signalling equal?
 ftrapcc_seq_no:
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		ftrapcc_seq_done	# no; go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
@@ -17263,7 +17263,7 @@
 ftrapcc_seq_done:
 	rts					# no; do nothing
 ftrapcc_seq_yes:
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		ftrapcc_trap		# no; go take trap
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
@@ -17278,7 +17278,7 @@
 ftrapcc_sneq:
 	fbsneq.w	ftrapcc_sneq_yes	# signalling equal?
 ftrapcc_sneq_no:
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		ftrapcc_sneq_no_done	# no; go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
@@ -17286,7 +17286,7 @@
 ftrapcc_sneq_no_done:
 	rts					# do nothing
 ftrapcc_sneq_yes:
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		ftrapcc_trap		# no; go take trap
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	btst		&bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
@@ -17469,7 +17469,7 @@
 # or false.								#
 #	If a BSUN exception should be indicated, the BSUN and ABSUN	#
 # bits are set in the stacked FPSR. If the BSUN exception is enabled,	#
-# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an 	#
+# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an	#
 # enabled BSUN should not be flagged and the predicate is true, then	#
 # the result is stored to the data register file or memory		#
 #									#
@@ -17484,8 +17484,8 @@
 	ror.l		&0x8,%d1		# rotate to top byte
 	fmov.l		%d1,%fpsr		# insert into FPSR
 
-	mov.w		(tbl_fscc.b,%pc,%d0.w*2),%d1 # load table 
-	jmp		(tbl_fscc.b,%pc,%d1.w) 	# jump to fscc routine
+	mov.w		(tbl_fscc.b,%pc,%d0.w*2),%d1 # load table
+	jmp		(tbl_fscc.b,%pc,%d1.w)	# jump to fscc routine
 
 tbl_fscc:
 	short		fscc_f		-	tbl_fscc	# 00
@@ -17585,7 +17585,7 @@
 #
 # not greater than:
 #
-#	NANvZvN	
+#	NANvZvN
 #
 fscc_ngt:
 	fbngt.w		fscc_ngt_yes		# not greater than?
@@ -17613,7 +17613,7 @@
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	bra.w		fscc_chk_bsun		# go finish
 fscc_ge_yes:
-	st		%d0			# set true	
+	st		%d0			# set true
 	btst		&nan_bit, FPSR_CC(%a6)	# is NAN set in cc?
 	beq.w		fscc_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
@@ -17806,7 +17806,7 @@
 #
 fscc_sf:
 	clr.b		%d0			# set false
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		fscc_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	bra.w		fscc_chk_bsun		# go finish
@@ -17818,7 +17818,7 @@
 #
 fscc_st:
 	st		%d0			# set false
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		fscc_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	bra.w		fscc_chk_bsun		# go finish
@@ -17832,13 +17832,13 @@
 	fbseq.w		fscc_seq_yes		# signalling equal?
 fscc_seq_no:
 	clr.b		%d0			# set false
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		fscc_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	bra.w		fscc_chk_bsun		# go finish
 fscc_seq_yes:
 	st		%d0			# set true
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		fscc_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	bra.w		fscc_chk_bsun		# go finish
@@ -17852,13 +17852,13 @@
 	fbsneq.w	fscc_sneq_yes		# signalling equal?
 fscc_sneq_no:
 	clr.b		%d0			# set false
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		fscc_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	bra.w		fscc_chk_bsun		# go finish
 fscc_sneq_yes:
 	st		%d0			# set true
-	btst		&nan_bit, FPSR_CC(%a6) 	# set BSUN exc bit
+	btst		&nan_bit, FPSR_CC(%a6)	# set BSUN exc bit
 	beq.w		fscc_done		# no;go finish
 	ori.l		&bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
 	bra.w		fscc_chk_bsun		# go finish
@@ -18044,7 +18044,7 @@
 #######################################################################
 
 #
-# the bsun exception bit was set. now, check to see is BSUN 
+# the bsun exception bit was set. now, check to see is BSUN
 # is enabled. if so, don't store result and correct stack frame
 # for a bsun exception.
 #
@@ -18061,7 +18061,7 @@
 fscc_done:
 	mov.l		%d0,%a0			# save result for a moment
 
-	mov.b		1+EXC_OPWORD(%a6),%d1	# fetch lo opword 
+	mov.b		1+EXC_OPWORD(%a6),%d1	# fetch lo opword
 	mov.l		%d1,%d0			# make a copy
 	andi.b		&0x38,%d1		# extract src mode
 
@@ -18075,7 +18075,7 @@
 
 #
 # the stacked <ea> is correct with the exception of:
-# 	-> Dn : <ea> is garbage
+#	-> Dn : <ea> is garbage
 #
 # if the addressing mode is post-increment or pre-decrement,
 # then the address registers have not been updated.
@@ -18088,7 +18088,7 @@
 
 	mov.l		%a0,%d0			# pass result in d0
 	mov.l		EXC_EA(%a6),%a0		# fetch <ea>
-	bsr.l		_dmem_write_byte	# write result byte	
+	bsr.l		_dmem_write_byte	# write result byte
 
 	tst.l		%d1			# did dstore fail?
 	bne.w		fscc_err		# yes
@@ -18159,7 +18159,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If instr is "fmovm Dn,-(A7)" from supervisor mode,		#
 #		d0 = size of dump					#
@@ -18181,25 +18181,25 @@
 #	The data register is determined and its value loaded to get the	#
 # string of FP registers affected. This value is used as an index into	#
 # a lookup table such that we can determine the number of bytes		#
-# involved. 								#
+# involved.								#
 #	If the instruction is "fmovm.x <ea>,Dn", a _mem_read() is used	#
 # to read in all FP values. Again, _mem_read() may fail and require a	#
-# special exit. 							#
+# special exit.								#
 #	If the instruction is "fmovm.x DN,<ea>", a _mem_write() is used	#
 # to write all FP values. _mem_write() may also fail.			#
-# 	If the instruction is "fmovm.x DN,-(a7)" from supervisor mode,	#
+#	If the instruction is "fmovm.x DN,-(a7)" from supervisor mode,	#
 # then we return the size of the dump and the string to the caller	#
 # so that the move can occur outside of this routine. This special	#
 # case is required so that moves to the system stack are handled	#
 # correctly.								#
 #									#
 # DYNAMIC:								#
-# 	fmovm.x	dn, <ea>						#
-# 	fmovm.x	<ea>, dn						#
+#	fmovm.x	dn, <ea>						#
+#	fmovm.x	<ea>, dn						#
 #									#
 #	      <WORD 1>		      <WORD2>				#
 #	1111 0010 00 |<ea>|	11@& 1000 0$$$ 0000			#
-#					  				#
+#									#
 #	& = (0): predecrement addressing mode				#
 #	    (1): postincrement or control addressing mode		#
 #	@ = (0): move listed regs from memory to the FPU		#
@@ -18468,12 +18468,12 @@
 	byte	0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
 	byte	0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
 	byte	0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
-	byte	0x3c,0x48,0x48,0x54,0x48,0x54,0x54,0x60	
+	byte	0x3c,0x48,0x48,0x54,0x48,0x54,0x54,0x60
 
 #
 # table to convert a pre-decrement bit string into a post-increment
 # or control bit string.
-# ex: 	0x00	==>	0x00
+# ex:	0x00	==>	0x00
 #	0x01	==>	0x80
 #	0x02	==>	0x40
 #		.
@@ -18555,59 +18555,59 @@
 	short		tbl_fea_mode	-	tbl_fea_mode
 	short		tbl_fea_mode	-	tbl_fea_mode
 
-	short		faddr_ind_a0	- 	tbl_fea_mode
-	short		faddr_ind_a1	- 	tbl_fea_mode
-	short		faddr_ind_a2	- 	tbl_fea_mode
-	short		faddr_ind_a3 	- 	tbl_fea_mode
-	short		faddr_ind_a4 	- 	tbl_fea_mode
-	short		faddr_ind_a5 	- 	tbl_fea_mode
-	short		faddr_ind_a6 	- 	tbl_fea_mode
-	short		faddr_ind_a7 	- 	tbl_fea_mode
-
-	short		faddr_ind_p_a0	- 	tbl_fea_mode
-	short		faddr_ind_p_a1 	- 	tbl_fea_mode
-	short		faddr_ind_p_a2 	- 	tbl_fea_mode
-	short		faddr_ind_p_a3 	- 	tbl_fea_mode
-	short		faddr_ind_p_a4 	- 	tbl_fea_mode
-	short		faddr_ind_p_a5 	- 	tbl_fea_mode
-	short		faddr_ind_p_a6 	- 	tbl_fea_mode
-	short		faddr_ind_p_a7 	- 	tbl_fea_mode
-
-	short		faddr_ind_m_a0 	- 	tbl_fea_mode
-	short		faddr_ind_m_a1 	- 	tbl_fea_mode
-	short		faddr_ind_m_a2 	- 	tbl_fea_mode
-	short		faddr_ind_m_a3 	- 	tbl_fea_mode
-	short		faddr_ind_m_a4 	- 	tbl_fea_mode
-	short		faddr_ind_m_a5 	- 	tbl_fea_mode
-	short		faddr_ind_m_a6 	- 	tbl_fea_mode
-	short		faddr_ind_m_a7 	- 	tbl_fea_mode
-
-	short		faddr_ind_disp_a0	- 	tbl_fea_mode
-	short		faddr_ind_disp_a1 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a2 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a3 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a4 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a5 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a6 	- 	tbl_fea_mode
+	short		faddr_ind_a0	-	tbl_fea_mode
+	short		faddr_ind_a1	-	tbl_fea_mode
+	short		faddr_ind_a2	-	tbl_fea_mode
+	short		faddr_ind_a3	-	tbl_fea_mode
+	short		faddr_ind_a4	-	tbl_fea_mode
+	short		faddr_ind_a5	-	tbl_fea_mode
+	short		faddr_ind_a6	-	tbl_fea_mode
+	short		faddr_ind_a7	-	tbl_fea_mode
+
+	short		faddr_ind_p_a0	-	tbl_fea_mode
+	short		faddr_ind_p_a1	-	tbl_fea_mode
+	short		faddr_ind_p_a2	-	tbl_fea_mode
+	short		faddr_ind_p_a3	-	tbl_fea_mode
+	short		faddr_ind_p_a4	-	tbl_fea_mode
+	short		faddr_ind_p_a5	-	tbl_fea_mode
+	short		faddr_ind_p_a6	-	tbl_fea_mode
+	short		faddr_ind_p_a7	-	tbl_fea_mode
+
+	short		faddr_ind_m_a0	-	tbl_fea_mode
+	short		faddr_ind_m_a1	-	tbl_fea_mode
+	short		faddr_ind_m_a2	-	tbl_fea_mode
+	short		faddr_ind_m_a3	-	tbl_fea_mode
+	short		faddr_ind_m_a4	-	tbl_fea_mode
+	short		faddr_ind_m_a5	-	tbl_fea_mode
+	short		faddr_ind_m_a6	-	tbl_fea_mode
+	short		faddr_ind_m_a7	-	tbl_fea_mode
+
+	short		faddr_ind_disp_a0	-	tbl_fea_mode
+	short		faddr_ind_disp_a1	-	tbl_fea_mode
+	short		faddr_ind_disp_a2	-	tbl_fea_mode
+	short		faddr_ind_disp_a3	-	tbl_fea_mode
+	short		faddr_ind_disp_a4	-	tbl_fea_mode
+	short		faddr_ind_disp_a5	-	tbl_fea_mode
+	short		faddr_ind_disp_a6	-	tbl_fea_mode
 	short		faddr_ind_disp_a7	-	tbl_fea_mode
 
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-
-	short		fabs_short	- 	tbl_fea_mode
-	short		fabs_long	- 	tbl_fea_mode
-	short		fpc_ind		- 	tbl_fea_mode
-	short		fpc_ind_ext	- 	tbl_fea_mode
-	short		tbl_fea_mode	- 	tbl_fea_mode
-	short		tbl_fea_mode	- 	tbl_fea_mode
-	short		tbl_fea_mode	- 	tbl_fea_mode
-	short		tbl_fea_mode	- 	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+
+	short		fabs_short	-	tbl_fea_mode
+	short		fabs_long	-	tbl_fea_mode
+	short		fpc_ind		-	tbl_fea_mode
+	short		fpc_ind_ext	-	tbl_fea_mode
+	short		tbl_fea_mode	-	tbl_fea_mode
+	short		tbl_fea_mode	-	tbl_fea_mode
+	short		tbl_fea_mode	-	tbl_fea_mode
+	short		tbl_fea_mode	-	tbl_fea_mode
 
 ###################################
 # Address register indirect: (An) #
@@ -18903,7 +18903,7 @@
 
 	btst		&0x8,%d0
 	bne.w		fcalc_mem_ind
-	
+
 	mov.l		%d0,L_SCR1(%a6)		# hold opword
 
 	mov.l		%d0,%d1
@@ -18999,7 +18999,7 @@
 
 	btst		&0x8,%d0		# is disp only 8 bits?
 	bne.w		fcalc_mem_ind		# calc memory indirect
-	
+
 	mov.l		%d0,L_SCR1(%a6)		# store opword
 
 	mov.l		%d0,%d1			# make extword copy
@@ -19076,7 +19076,7 @@
 	bfextu		%d5{&26:&2},%d0		# get bd size
 #	beq.l		fmovm_error		# if (size == 0) it's reserved
 
-	cmpi.b	 	%d0,&0x2
+	cmpi.b		%d0,&0x2
 	blt.b		fno_bd
 	beq.b		fget_word_bd
 
@@ -19098,7 +19098,7 @@
 	bne.l		fcea_iacc		# yes
 
 	ext.l		%d0			# sign extend bd
-	
+
 fchk_ind:
 	add.l		%d0,%d3			# base += bd
 
@@ -19107,10 +19107,10 @@
 	bfextu		%d5{&30:&2},%d0		# is od suppressed?
 	beq.w		faii_bd
 
-	cmpi.b	 	%d0,&0x2
+	cmpi.b		%d0,&0x2
 	blt.b		fnull_od
 	beq.b		fword_od
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long
@@ -19118,7 +19118,7 @@
 	tst.l		%d1			# did ifetch fail?
 	bne.l		fcea_iacc		# yes
 
-	bra.b 		fadd_them
+	bra.b		fadd_them
 
 fword_od:
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
@@ -19171,7 +19171,7 @@
 	rts
 
 #########################################################
-fcea_err:	
+fcea_err:
 	mov.l		%d3,%a0
 
 	movm.l		(%sp)+,&0x003c		# restore d2-d5
@@ -19181,7 +19181,7 @@
 fcea_iacc:
 	movm.l		(%sp)+,&0x003c		# restore d2-d5
 	bra.l		iea_iacc
-	
+
 fmovm_out_err:
 	bsr.l		restore
 	mov.w		&0x00e1,%d0
@@ -19197,7 +19197,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fmovm_ctrl(): emulate fmovm.l of control registers instr	#
+#	fmovm_ctrl(): emulate fmovm.l of control registers instr	#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_long() - read longword from memory			#
@@ -19205,7 +19205,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If _imem_read_long() doesn't fail:				#
 #		USER_FPCR(a6)  = new FPCR value				#
@@ -19213,14 +19213,14 @@
 #		USER_FPIAR(a6) = new FPIAR value			#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Decode the instruction type by looking at the extension word 	#
+#	Decode the instruction type by looking at the extension word	#
 # in order to see how many control registers to fetch from memory.	#
 # Fetch them using _imem_read_long(). If this fetch fails, exit through	#
 # the special access error exit handler iea_iacc().			#
 #									#
 # Instruction word decoding:						#
 #									#
-# 	fmovem.l #<data>, {FPIAR&|FPCR&|FPSR}				#
+#	fmovem.l #<data>, {FPIAR&|FPCR&|FPSR}				#
 #									#
 #		WORD1			WORD2				#
 #	1111 0010 00 111100	100$ $$00 0000 0000			#
@@ -19241,7 +19241,7 @@
 	beq.w		fctrl_in_6		# yes
 	cmpi.b		%d0,&0x94		# fpcr & fpiar ?
 	beq.b		fctrl_in_5		# yes
-	
+
 # fmovem.l #<data>, fpsr/fpiar
 fctrl_in_3:
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
@@ -19340,21 +19340,21 @@
 #									#
 # INPUT ***************************************************************	#
 #	d0 = number of bytes to adjust <ea> by				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	None								#
 #									#
 # ALGORITHM ***********************************************************	#
 # "Dummy" CALCulate Effective Address:					#
-# 	The stacked <ea> for FP unimplemented instructions and opclass	#
+#	The stacked <ea> for FP unimplemented instructions and opclass	#
 #	two packed instructions is correct with the exception of...	#
 #									#
 #	1) -(An)   : The register is not updated regardless of size.	#
-#		     Also, for extended precision and packed, the 	#
+#		     Also, for extended precision and packed, the	#
 #		     stacked <ea> value is 8 bytes too big		#
 #	2) (An)+   : The register is not updated.			#
-#	3) #<data> : The upper longword of the immediate operand is 	#
-#		     stacked b,w,l and s sizes are completely stacked. 	#
+#	3) #<data> : The upper longword of the immediate operand is	#
+#		     stacked b,w,l and s sizes are completely stacked.	#
 #		     d,x, and p are not.				#
 #									#
 #########################################################################
@@ -19390,8 +19390,8 @@
 	lea		([USER_FPIAR,%a6],0x4),%a0 # no; return <ea>
 	rts
 
-# here, the <ea> is stacked correctly. however, we must update the 
-# address register...	
+# here, the <ea> is stacked correctly. however, we must update the
+# address register...
 dcea_pi:
 	mov.l		%a0,%d0			# pass amt to inc by
 	bsr.l		inc_areg		# inc addr register
@@ -19399,7 +19399,7 @@
 	mov.l		EXC_EA(%a6),%a0		# stacked <ea> is correct
 	rts
 
-# the <ea> is stacked correctly for all but extended and packed which 
+# the <ea> is stacked correctly for all but extended and packed which
 # the <ea>s are 8 bytes too large.
 # it would make no sense to have a pre-decrement to a7 in supervisor
 # mode so we don't even worry about this tricky case here : )
@@ -19419,7 +19419,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	_calc_ea_fout(): calculate correct stacked <ea> for extended	#
+#	_calc_ea_fout(): calculate correct stacked <ea> for extended	#
 #			 and packed data opclass 3 operations.		#
 #									#
 # XREF ****************************************************************	#
@@ -19427,22 +19427,22 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	a0 = return correct effective address				#
 #									#
 # ALGORITHM ***********************************************************	#
 #	For opclass 3 extended and packed data operations, the <ea>	#
 # stacked for the exception is incorrect for -(an) and (an)+ addressing	#
-# modes. Also, while we're at it, the index register itself must get 	#
+# modes. Also, while we're at it, the index register itself must get	#
 # updated.								#
-# 	So, for -(an), we must subtract 8 off of the stacked <ea> value	#
+#	So, for -(an), we must subtract 8 off of the stacked <ea> value	#
 # and return that value as the correct <ea> and store that value in An.	#
 # For (an)+, the stacked <ea> is correct but we must adjust An by +12.	#
 #									#
 #########################################################################
 
-# This calc_ea is currently used to retrieve the correct <ea> 
+# This calc_ea is currently used to retrieve the correct <ea>
 # for fmove outs of type extended and packed.
 	global		_calc_ea_fout
 _calc_ea_fout:
@@ -19463,7 +19463,7 @@
 
 # (An)+ : extended and packed fmove out
 #	: stacked <ea> is correct
-#	: "An" not updated 
+#	: "An" not updated
 ceaf_pi:
 	mov.w		(tbl_ceaf_pi.b,%pc,%d1.w*2),%d1
 	mov.l		EXC_EA(%a6),%a0
@@ -19574,31 +19574,31 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If memory access doesn't fail:					#
 #		FP_SRC(a6) = source operand in extended precision	#
-# 		FP_DST(a6) = destination operand in extended precision	#
+#		FP_DST(a6) = destination operand in extended precision	#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	This is called from the Unimplemented FP exception handler in	#
+#	This is called from the Unimplemented FP exception handler in	#
 # order to load the source and maybe destination operand into		#
 # FP_SRC(a6) and FP_DST(a6). If the instruction was opclass zero, load	#
 # the source and destination from the FP register file. Set the optype	#
 # tags for both if dyadic, one for monadic. If a number is an UNNORM,	#
 # convert it to a DENORM or a ZERO.					#
-# 	If the instruction is opclass two (memory->reg), then fetch	#
-# the destination from the register file and the source operand from 	#
+#	If the instruction is opclass two (memory->reg), then fetch	#
+# the destination from the register file and the source operand from	#
 # memory. Tag and fix both as above w/ opclass zero instructions.	#
-# 	If the source operand is byte,word,long, or single, it may be	#
+#	If the source operand is byte,word,long, or single, it may be	#
 # in the data register file. If it's actually out in memory, use one of	#
 # the mem_read() routines to fetch it. If the mem_read() access returns	#
 # a failing value, exit through the special facc_in() routine which	#
 # will create an access error exception frame from the current exception #
 # frame.								#
-# 	Immediate data and regular data accesses are separated because 	#
+#	Immediate data and regular data accesses are separated because	#
 # if an immediate data access fails, the resulting fault status		#
-# longword stacked for the access error exception must have the 	#
+# longword stacked for the access error exception must have the		#
 # instruction bit set.							#
 #									#
 #########################################################################
@@ -19644,7 +19644,7 @@
 	cmpi.b		%d0, &UNNORM		# is dst fpreg an UNNORM?
 	beq.b		op000_dst_unnorm	# yes
 op000_dst_cont:
-	mov.b 		%d0, DTAG(%a6)		# store the dst optype tag
+	mov.b		%d0, DTAG(%a6)		# store the dst optype tag
 
 op000_src:
 	bfextu		EXC_CMDREG(%a6){&3:&3}, %d0 # extract src field
@@ -19709,7 +19709,7 @@
 	swbeg		&0x8
 tbl_op010_dreg:
 	short		opd_long	- tbl_op010_dreg
-	short		opd_sgl 	- tbl_op010_dreg
+	short		opd_sgl		- tbl_op010_dreg
 	short		tbl_op010_dreg	- tbl_op010_dreg
 	short		tbl_op010_dreg	- tbl_op010_dreg
 	short		opd_word	- tbl_op010_dreg
@@ -19722,7 +19722,7 @@
 #
 opd_long:
 	bsr.l		fetch_dreg		# fetch long in d0
-	fmov.l		%d0, %fp0 		# load a long
+	fmov.l		%d0, %fp0		# load a long
 	fmovm.x		&0x80, FP_SRC(%a6)	# return src op in FP_SRC
 	fbeq.w		opd_long_zero		# long is a ZERO
 	rts
@@ -19735,7 +19735,7 @@
 #
 opd_word:
 	bsr.l		fetch_dreg		# fetch word in d0
-	fmov.w		%d0, %fp0 		# load a word
+	fmov.w		%d0, %fp0		# load a word
 	fmovm.x		&0x80, FP_SRC(%a6)	# return src op in FP_SRC
 	fbeq.w		opd_word_zero		# WORD is a ZERO
 	rts
@@ -19748,7 +19748,7 @@
 #
 opd_byte:
 	bsr.l		fetch_dreg		# fetch word in d0
-	fmov.b		%d0, %fp0 		# load a byte
+	fmov.b		%d0, %fp0		# load a byte
 	fmovm.x		&0x80, FP_SRC(%a6)	# return src op in FP_SRC
 	fbeq.w		opd_byte_zero		# byte is a ZERO
 	rts
@@ -19766,7 +19766,7 @@
 	bsr.l		fetch_dreg		# fetch sgl in d0
 	mov.l		%d0,L_SCR1(%a6)
 
-	lea		L_SCR1(%a6), %a0 	# pass: ptr to the sgl
+	lea		L_SCR1(%a6), %a0	# pass: ptr to the sgl
 	bsr.l		set_tag_s		# determine sgl type
 	mov.b		%d0, STAG(%a6)		# save the src tag
 
@@ -19813,7 +19813,7 @@
 
 #########################################
 # load a LONG into %fp0:		#
-# 	-number can't fault		#
+#	-number can't fault		#
 #	(1) calc ea			#
 #	(2) read 4 bytes into L_SCR1	#
 #	(3) fmov.l into %fp0		#
@@ -19849,7 +19849,7 @@
 
 #########################################
 # load a WORD into %fp0:		#
-# 	-number can't fault		#
+#	-number can't fault		#
 #	(1) calc ea			#
 #	(2) read 2 bytes into L_SCR1	#
 #	(3) fmov.w into %fp0		#
@@ -19885,7 +19885,7 @@
 
 #########################################
 # load a BYTE into %fp0:		#
-# 	-number can't fault		#
+#	-number can't fault		#
 #	(1) calc ea			#
 #	(2) read 1 byte into L_SCR1	#
 #	(3) fmov.b into %fp0		#
@@ -19921,7 +19921,7 @@
 
 #########################################
 # load a SGL into %fp0:			#
-# 	-number can't fault		#
+#	-number can't fault		#
 #	(1) calc ea			#
 #	(2) read 4 bytes into L_SCR1	#
 #	(3) fmov.s into %fp0		#
@@ -19961,7 +19961,7 @@
 	bne.l		funimp_iacc		# yes
 	bra.b		load_sgl_cont
 
-# must convert sgl denorm format to an Xprec denorm fmt suitable for 
+# must convert sgl denorm format to an Xprec denorm fmt suitable for
 # normalization...
 # %a0 : points to sgl denorm
 get_sgl_denorm:
@@ -20003,7 +20003,7 @@
 
 #########################################
 # load a DBL into %fp0:			#
-# 	-number can't fault		#
+#	-number can't fault		#
 #	(1) calc ea			#
 #	(2) read 8 bytes into L_SCR(1,2)#
 #	(3) fmov.d into %fp0		#
@@ -20046,7 +20046,7 @@
 	bne.l		funimp_iacc		# yes
 	bra.b		load_dbl_cont
 
-# must convert dbl denorm format to an Xprec denorm fmt suitable for 
+# must convert dbl denorm format to an Xprec denorm fmt suitable for
 # normalization...
 # %a0 : loc. of dbl denorm
 get_dbl_denorm:
@@ -20092,7 +20092,7 @@
 
 #################################################
 # load a Xprec into %fp0:			#
-# 	-number can't fault			#
+#	-number can't fault			#
 #	(1) calc ea				#
 #	(2) read 12 bytes into L_SCR(1,2)	#
 #	(3) fmov.x into %fp0			#
@@ -20124,7 +20124,7 @@
 
 #################################################
 # load a packed into %fp0:			#
-# 	-number can't fault			#
+#	-number can't fault			#
 #	(1) calc ea				#
 #	(2) read 12 bytes into L_SCR(1,2,3)	#
 #	(3) fmov.x into %fp0			#
@@ -20143,11 +20143,11 @@
 load_packed_unnorm:
 	bsr.l		unnorm_fix		# fix the UNNORM ZERO
 	mov.b		%d0,STAG(%a6)		# store the src optype tag
-	rts	
+	rts
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fout(): move from fp register to memory or data register	#
+#	fout(): move from fp register to memory or data register	#
 #									#
 # XREF ****************************************************************	#
 #	_round() - needed to create EXOP for sgl/dbl precision		#
@@ -20167,7 +20167,7 @@
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
 #	d0 = round prec,mode						#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 : intermediate underflow or overflow result if		#
 #	      OVFL/UNFL occurred for a sgl or dbl operand		#
@@ -20186,9 +20186,9 @@
 # w/ the address index register as appropriate w/ _calc_ea_fout(). If	#
 # the source is a denorm and if underflow is enabled, an EXOP must be	#
 # created.								#
-# 	For packed, the k-factor must be fetched from the instruction	#
-# word or a data register. The <ea> must be fixed as w/ extended 	#
-# precision. Then, bindec() is called to create the appropriate 	#
+#	For packed, the k-factor must be fetched from the instruction	#
+# word or a data register. The <ea> must be fixed as w/ extended	#
+# precision. Then, bindec() is called to create the appropriate		#
 # packed result.							#
 #	If at any time an access error is flagged by one of the move-	#
 # to-memory routines, then a special exit must be made so that the	#
@@ -20304,7 +20304,7 @@
 	ori.l		&0x00800000,%d1		# make smallest sgl
 	fmov.s		%d1,%fp0
 	bra.b		fout_word_norm
-	
+
 #################################################################
 # fmove.l out ###################################################
 #################################################################
@@ -20378,7 +20378,7 @@
 	mov.l		&0xc,%d0		# pass: opsize is 12 bytes
 
 # we must not yet write the extended precision data to the stack
-# in the pre-decrement case from supervisor mode or else we'll corrupt 
+# in the pre-decrement case from supervisor mode or else we'll corrupt
 # the stack frame. so, leave it in FP_SRC for now and deal with it later...
 	cmpi.b		SPCOND_FLG(%a6),&mda7_flg
 	beq.b		fout_ext_a7
@@ -20465,7 +20465,7 @@
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fmov.l		%fpsr,%d1		# save FPSR
 
-	or.w		%d1,2+USER_FPSR(%a6) 	# set possible inex2/ainex
+	or.w		%d1,2+USER_FPSR(%a6)	# set possible inex2/ainex
 
 fout_sgl_exg_write:
 	mov.b		1+EXC_OPWORD(%a6),%d1	# extract dst mode
@@ -20506,7 +20506,7 @@
 
 	lea		FP_SCR0(%a6),%a0
 	bsr.l		norm			# normalize the DENORM
-	
+
 fout_sgl_unfl_cont:
 	lea		FP_SCR0(%a6),%a0	# pass: ptr to operand
 	mov.l		L_SCR3(%a6),%d1		# pass: rnd prec,mode
@@ -20557,7 +20557,7 @@
 
 # call ovf_res() w/ sgl prec and the correct rnd mode to create the default
 # overflow result. DON'T save the returned ccodes from ovf_res() since
-# fmove out doesn't alter them. 
+# fmove out doesn't alter them.
 	tst.b		SRC_EX(%a0)		# is operand negative?
 	smi		%d1			# set if so
 	mov.l		L_SCR3(%a6),%d0		# pass: sgl prec,rnd mode
@@ -20612,7 +20612,7 @@
 
 	fabs.x		%fp0			# need absolute value
 	fcmp.b		%fp0,&0x2		# did exponent increase?
-	fblt.w		fout_sgl_exg		# no; go finish NORM	
+	fblt.w		fout_sgl_exg		# no; go finish NORM
 	bra.w		fout_sgl_ovfl		# yes; go handle overflow
 
 ################
@@ -20703,7 +20703,7 @@
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fmov.l		%fpsr,%d0		# save FPSR
 
-	or.w		%d0,2+USER_FPSR(%a6) 	# set possible inex2/ainex
+	or.w		%d0,2+USER_FPSR(%a6)	# set possible inex2/ainex
 
 	mov.l		EXC_EA(%a6),%a1		# pass: dst addr
 	lea		L_SCR1(%a6),%a0		# pass: src addr
@@ -20713,7 +20713,7 @@
 	tst.l		%d1			# did dstore fail?
 	bne.l		facc_out_d		# yes
 
-	rts					# no; so we're finished	
+	rts					# no; so we're finished
 
 #
 # here, we know that the operand would UNFL if moved out to double prec,
@@ -20735,7 +20735,7 @@
 
 	lea		FP_SCR0(%a6),%a0
 	bsr.l		norm			# normalize the DENORM
-	
+
 fout_dbl_unfl_cont:
 	lea		FP_SCR0(%a6),%a0	# pass: ptr to operand
 	mov.l		L_SCR3(%a6),%d1		# pass: rnd prec,mode
@@ -20778,7 +20778,7 @@
 
 # call ovf_res() w/ dbl prec and the correct rnd mode to create the default
 # overflow result. DON'T save the returned ccodes from ovf_res() since
-# fmove out doesn't alter them. 
+# fmove out doesn't alter them.
 	tst.b		SRC_EX(%a0)		# is operand negative?
 	smi		%d1			# set if so
 	mov.l		L_SCR3(%a6),%d0		# pass: dbl prec,rnd mode
@@ -20823,19 +20823,19 @@
 
 	fabs.x		%fp0			# need absolute value
 	fcmp.b		%fp0,&0x2		# did exponent increase?
-	fblt.w		fout_dbl_exg		# no; go finish NORM	
+	fblt.w		fout_dbl_exg		# no; go finish NORM
 	bra.w		fout_dbl_ovfl		# yes; go handle overflow
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	dst_dbl(): create double precision value from extended prec.	#
+#	dst_dbl(): create double precision value from extended prec.	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to source operand in extended precision		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = hi(double precision result)				#
 #	d1 = lo(double precision result)				#
@@ -20849,18 +20849,18 @@
 #	get rid of ext integer bit					#
 #	dbl_mant = ext_mant{62:12}					#
 #									#
-#	    	---------------   ---------------    ---------------	#
+#		---------------   ---------------    ---------------	#
 #  extended ->  |s|    exp    |   |1| ms mant   |    | ls mant     |	#
-#	    	---------------   ---------------    ---------------	#
-#	   	 95	    64    63 62	      32      31     11	  0	#
+#		---------------   ---------------    ---------------	#
+#		 95	    64    63 62	      32      31     11	  0	#
 #				     |			     |		#
 #				     |			     |		#
 #				     |			     |		#
-#		 	             v   		     v		#
-#	    		      ---------------   ---------------		#
-#  double   ->  	      |s|exp| mant  |   |  mant       |		#
-#	    		      ---------------   ---------------		#
-#	   	 	      63     51   32   31	       0	#
+#			             v			     v		#
+#			      ---------------   ---------------		#
+#  double   ->		      |s|exp| mant  |   |  mant       |		#
+#			      ---------------   ---------------		#
+#			      63     51   32   31	       0	#
 #									#
 #########################################################################
 
@@ -20896,13 +20896,13 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	dst_sgl(): create single precision value from extended prec	#
+#	dst_sgl(): create single precision value from extended prec	#
 #									#
 # XREF ****************************************************************	#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to source operand in extended precision		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = single precision result					#
 #									#
@@ -20914,18 +20914,18 @@
 #	get rid of ext integer bit					#
 #	sgl_mant = ext_mant{62:12}					#
 #									#
-#	    	---------------   ---------------    ---------------	#
+#		---------------   ---------------    ---------------	#
 #  extended ->  |s|    exp    |   |1| ms mant   |    | ls mant     |	#
-#	    	---------------   ---------------    ---------------	#
-#	   	 95	    64    63 62	   40 32      31     12	  0	#
+#		---------------   ---------------    ---------------	#
+#		 95	    64    63 62	   40 32      31     12	  0	#
 #				     |	   |				#
 #				     |	   |				#
 #				     |	   |				#
-#		 	             v     v				#
-#	    		      ---------------				#
-#  single   ->  	      |s|exp| mant  |				#
-#	    		      ---------------				#
-#	   	 	      31     22     0				#
+#			             v     v				#
+#			      ---------------				#
+#  single   ->		      |s|exp| mant  |				#
+#			      ---------------				#
+#			      31     22     0				#
 #									#
 #########################################################################
 
@@ -20998,7 +20998,7 @@
 # add the extra condition that only if the k-factor was zero, too, should
 # we zero the exponent
 	tst.l		%d0
-	bne.b		fout_pack_set	
+	bne.b		fout_pack_set
 # "mantissa" is all zero which means that the answer is zero. but, the '040
 # algorithm allows the exponent to be non-zero. the 881/2 do not. therefore,
 # if the mantissa is zero, I will zero the exponent, too.
@@ -21057,13 +21057,13 @@
 #									#
 # INPUT ***************************************************************	#
 #	d1 = index of register to fetch from				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of register fetched					#
 #									#
 # ALGORITHM ***********************************************************	#
-#	According to the index value in d1 which can range from zero 	#
-# to fifteen, load the corresponding register file value (where 	#
+#	According to the index value in d1 which can range from zero	#
+# to fifteen, load the corresponding register file value (where		#
 # address register indexes start at 8). D0/D1/A0/A1/A6/A7 are on the	#
 # stack. The rest should still be in their original places.		#
 #									#
@@ -21152,7 +21152,7 @@
 # INPUT ***************************************************************	#
 #	d0 = longowrd value to store					#
 #	d1 = index of register to fetch from				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(data register is updated)					#
 #									#
@@ -21213,7 +21213,7 @@
 # INPUT ***************************************************************	#
 #	d0 = word value to store					#
 #	d1 = index of register to fetch from				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(data register is updated)					#
 #									#
@@ -21274,7 +21274,7 @@
 # INPUT ***************************************************************	#
 #	d0 = byte value to store					#
 #	d1 = index of register to fetch from				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(data register is updated)					#
 #									#
@@ -21335,16 +21335,16 @@
 # INPUT ***************************************************************	#
 #	d0 = amount to increment by					#
 #	d1 = index of address register to increment			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(address register is updated)					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Typically used for an instruction w/ a post-increment <ea>, 	#
+#	Typically used for an instruction w/ a post-increment <ea>,	#
 # this routine adds the increment value in d0 to the address register	#
 # specified by d1. A0/A1/A6/A7 reside on the stack. The rest reside	#
 # in their original places.						#
-# 	For a7, if the increment amount is one, then we have to 	#
+#	For a7, if the increment amount is one, then we have to		#
 # increment by two. For any a7 update, set the mia7_flag so that if	#
 # an access error exception occurs later in emulation, this address	#
 # register update can be undone.					#
@@ -21399,16 +21399,16 @@
 # INPUT ***************************************************************	#
 #	d0 = amount to decrement by					#
 #	d1 = index of address register to decrement			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(address register is updated)					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Typically used for an instruction w/ a pre-decrement <ea>, 	#
+#	Typically used for an instruction w/ a pre-decrement <ea>,	#
 # this routine adds the decrement value in d0 to the address register	#
 # specified by d1. A0/A1/A6/A7 reside on the stack. The rest reside	#
 # in their original places.						#
-# 	For a7, if the decrement amount is one, then we have to 	#
+#	For a7, if the decrement amount is one, then we have to		#
 # decrement by two. For any a7 update, set the mda7_flag so that if	#
 # an access error exception occurs later in emulation, this address	#
 # register update can be undone.					#
@@ -21464,17 +21464,17 @@
 #									#
 # INPUT ***************************************************************	#
 #	d0 = index of FP register to load				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SRC(a6) = value loaded from FP register file			#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Using the index in d0, load FP_SRC(a6) with a number from the 	#
+#	Using the index in d0, load FP_SRC(a6) with a number from the	#
 # FP register file.							#
 #									#
 #########################################################################
 
-	global 		load_fpn1
+	global		load_fpn1
 load_fpn1:
 	mov.w		(tbl_load_fpn1.b,%pc,%d0.w*2), %d0
 	jmp		(tbl_load_fpn1.b,%pc,%d0.w*1)
@@ -21537,12 +21537,12 @@
 #									#
 # INPUT ***************************************************************	#
 #	d0 = index of FP register to load				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_DST(a6) = value loaded from FP register file			#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Using the index in d0, load FP_DST(a6) with a number from the 	#
+#	Using the index in d0, load FP_DST(a6) with a number from the	#
 # FP register file.							#
 #									#
 #########################################################################
@@ -21603,7 +21603,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	store_fpreg(): store an fp value to the fpreg designated d0.	#
+#	store_fpreg(): store an fp value to the fpreg designated d0.	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
@@ -21611,7 +21611,7 @@
 # INPUT ***************************************************************	#
 #	fp0 = extended precision value to store				#
 #	d0  = index of floating-point register				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	None								#
 #									#
@@ -21644,33 +21644,33 @@
 	fmovm.x		&0x80, EXC_FP1(%a6)
 	rts
 store_fpreg_2:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x20
 	rts
 store_fpreg_3:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x10
 	rts
 store_fpreg_4:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x08
 	rts
 store_fpreg_5:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x04
 	rts
 store_fpreg_6:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x02
 	rts
 store_fpreg_7:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x01
 	rts
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	_denorm(): denormalize an intermediate result			#
+#	_denorm(): denormalize an intermediate result			#
 #									#
 # XREF ****************************************************************	#
 #	None								#
@@ -21678,7 +21678,7 @@
 # INPUT *************************************************************** #
 #	a0 = points to the operand to be denormalized			#
 #		(in the internal extended format)			#
-#		 							#
+#									#
 #	d0 = rounding precision						#
 #									#
 # OUTPUT **************************************************************	#
@@ -21688,10 +21688,10 @@
 #	d0 = guard,round,sticky						#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	According to the exponent underflow threshold for the given	#
+#	According to the exponent underflow threshold for the given	#
 # precision, shift the mantissa bits to the right in order raise the	#
-# exponent of the operand to the threshold value. While shifting the 	#
-# mantissa bits right, maintain the value of the guard, round, and 	#
+# exponent of the operand to the threshold value. While shifting the	#
+# mantissa bits right, maintain the value of the guard, round, and	#
 # sticky bits.								#
 # other notes:								#
 #	(1) _denorm() is called by the underflow routines		#
@@ -21711,7 +21711,7 @@
 _denorm:
 #
 # Load the exponent threshold for the precision selected and check
-# to see if (threshold - exponent) is > 65 in which case we can 
+# to see if (threshold - exponent) is > 65 in which case we can
 # simply calculate the sticky bit and zero the mantissa. otherwise
 # we have to call the denormalization routine.
 #
@@ -21750,7 +21750,7 @@
 #	%d0{31:29} : initial guard,round,sticky				#
 #	%d1{15:0}  : denormalization threshold				#
 # OUTPUT:								#
-#	%a0	   : points to the denormalized operand		 	#
+#	%a0	   : points to the denormalized operand			#
 #	%d0{31:29} : final guard,round,sticky				#
 #									#
 
@@ -21770,7 +21770,7 @@
 
 #
 # check to see how much less than the underflow threshold the operand
-# exponent is. 
+# exponent is.
 #
 	mov.l		%d1, %d0		# copy the denorm threshold
 	sub.w		FTEMP_EX(%a0), %d1	# d1 = threshold - uns exponent
@@ -21785,7 +21785,7 @@
 # No normalization necessary
 #
 dnrm_no_lp:
-	mov.l		GRS(%a6), %d0 		# restore original g,r,s
+	mov.l		GRS(%a6), %d0		# restore original g,r,s
 	rts
 
 #
@@ -21795,7 +21795,7 @@
 # %d1 = "n" = amt to shift
 #
 #	---------------------------------------------------------
-#	|     FTEMP_HI	  |    	FTEMP_LO     |grs000.........000|
+#	|     FTEMP_HI	  |	FTEMP_LO     |grs000.........000|
 #	---------------------------------------------------------
 #	<-(32 - n)-><-(n)-><-(32 - n)-><-(n)-><-(32 - n)-><-(n)->
 #	\	   \		      \			 \
@@ -21806,7 +21806,7 @@
 #	     \		\		   \		      \
 #	      \		 \		    \		       \
 #	       \	  \		     \			\
-#	<-(n)-><-(32 - n)-><------(32)-------><------(32)------->	
+#	<-(n)-><-(32 - n)-><------(32)-------><------(32)------->
 #	---------------------------------------------------------
 #	|0.....0| NEW_HI  |  NEW_FTEMP_LO     |grs		|
 #	---------------------------------------------------------
@@ -21847,17 +21847,17 @@
 # %d1 = "n" = amt to shift
 #
 #	---------------------------------------------------------
-#	|     FTEMP_HI	  |    	FTEMP_LO     |grs000.........000|
+#	|     FTEMP_HI	  |	FTEMP_LO     |grs000.........000|
 #	---------------------------------------------------------
 #	<-(32 - n)-><-(n)-><-(32 - n)-><-(n)-><-(32 - n)-><-(n)->
 #	\	   \		      \
 #	 \	    \		       \
 #	  \	     \			-------------------
 #	   \	      --------------------		   \
-#	    -------------------	  	  \		    \
-#	     		       \	   \		     \
-#	      		 	\     	    \		      \
-#	       		  	 \	     \		       \
+#	    -------------------		  \		    \
+#			       \	   \		     \
+#				\	    \		      \
+#				 \	     \		       \
 #	<-------(32)------><-(n)-><-(32 - n)-><------(32)------->
 #	---------------------------------------------------------
 #	|0...............0|0....0| NEW_LO     |grs		|
@@ -21928,17 +21928,17 @@
 # case (d1 == 64)
 #
 #	---------------------------------------------------------
-#	|     FTEMP_HI	  |    	FTEMP_LO     |grs000.........000|
+#	|     FTEMP_HI	  |	FTEMP_LO     |grs000.........000|
 #	---------------------------------------------------------
 #	<-------(32)------>
-#	\	   	   \
-#	 \	    	    \
-#	  \	     	     \
-#	   \	      	      ------------------------------
+#	\		   \
+#	 \		    \
+#	  \		     \
+#	   \		      ------------------------------
 #	    -------------------------------		    \
-#	     		       		   \		     \
-#	      		 	     	    \		      \
-#	       		  	 	     \		       \
+#					   \		     \
+#					    \		      \
+#					     \		       \
 #					      <-------(32)------>
 #	---------------------------------------------------------
 #	|0...............0|0................0|grs		|
@@ -21956,17 +21956,17 @@
 # case (d1 == 65)
 #
 #	---------------------------------------------------------
-#	|     FTEMP_HI	  |    	FTEMP_LO     |grs000.........000|
+#	|     FTEMP_HI	  |	FTEMP_LO     |grs000.........000|
 #	---------------------------------------------------------
 #	<-------(32)------>
-#	\	   	   \
-#	 \	    	    \
-#	  \	     	     \
-#	   \	      	      ------------------------------
+#	\		   \
+#	 \		    \
+#	  \		     \
+#	   \		      ------------------------------
 #	    --------------------------------		    \
-#	     		       		    \		     \
-#	      		 	     	     \		      \
-#	       		  	 	      \		       \
+#					    \		     \
+#					     \		      \
+#					      \		       \
 #					       <-------(31)----->
 #	---------------------------------------------------------
 #	|0...............0|0................0|0rs		|
@@ -22014,7 +22014,7 @@
 #	None								#
 #									#
 # INPUT ***************************************************************	#
-#	a0	  = ptr to input operand in internal extended format 	#
+#	a0	  = ptr to input operand in internal extended format	#
 #	d1(hi)    = contains rounding precision:			#
 #			ext = $0000xxxx					#
 #			sgl = $0004xxxx					#
@@ -22045,7 +22045,7 @@
 #
 # ext_grs() looks at the rounding precision and sets the appropriate
 # G,R,S bits.
-# If (G,R,S == 0) then result is exact and round is done, else set 
+# If (G,R,S == 0) then result is exact and round is done, else set
 # the inex flag in status reg and continue.
 #
 	bsr.l		ext_grs			# extract G,R,S
@@ -22091,7 +22091,7 @@
 #	If sign of fp number = 1 (negative), then add 1 to l.	#
 #################################################################
 rnd_mnus:
-	tst.b		FTEMP_SGN(%a0)		# check for sign	
+	tst.b		FTEMP_SGN(%a0)		# check for sign
 	bpl.w		truncate		# if negative then truncate
 
 	mov.l		&0xffffffff, %d0	# force g,r,s to be all f's
@@ -22202,7 +22202,7 @@
 #
 # INPUT
 #	d0	   = extended precision g,r,s (in d0{31:29})
-#	d1 	   = {PREC,ROUND}
+#	d1	   = {PREC,ROUND}
 # OUTPUT
 #	d0{31:29}  = guard, round, sticky
 #
@@ -22253,7 +22253,7 @@
 	mov.l		&30, %d2		# of the sgl prec. limits
 	lsl.l		%d2, %d3		# shift g-r bits to MSB of d3
 	mov.l		FTEMP_HI(%a0), %d2	# get word 2 for s-bit test
-	and.l		&0x0000003f, %d2	# s bit is the or of all other 
+	and.l		&0x0000003f, %d2	# s bit is the or of all other
 	bne.b		ext_grs_st_stky		# bits to the right of g-r
 	tst.l		FTEMP_LO(%a0)		# test lower mantissa
 	bne.b		ext_grs_st_stky		# if any are set, set sticky
@@ -22263,9 +22263,9 @@
 
 #
 # dbl:
-#	96		64	  	32	 11	0
+#	96		64		32	 11	0
 #	-----------------------------------------------------
-#	| EXP	|XXXXXXX|	  	|	 |xx	|grs|
+#	| EXP	|XXXXXXX|		|	 |xx	|grs|
 #	-----------------------------------------------------
 #						  nn\	    /
 #						  ee -------
@@ -22278,7 +22278,7 @@
 	mov.l		&30, %d2		# of the dbl prec. limits
 	lsl.l		%d2, %d3		# shift g-r bits to the MSB of d3
 	mov.l		FTEMP_LO(%a0), %d2	# get lower mantissa  for s-bit test
-	and.l		&0x000001ff, %d2	# s bit is the or-ing of all 
+	and.l		&0x000001ff, %d2	# s bit is the or-ing of all
 	bne.b		ext_grs_st_stky		# other bits to the right of g-r
 	tst.l		%d0			# test word original g,r,s
 	bne.b		ext_grs_st_stky		# if any are set, set sticky
@@ -22308,7 +22308,7 @@
 #	a0 = pointer fp extended precision operand to normalize		#
 #									#
 # OUTPUT ************************************************************** #
-# 	d0 = number of bit positions the mantissa was shifted		#
+#	d0 = number of bit positions the mantissa was shifted		#
 #	a0 = the input operand's mantissa is normalized; the exponent	#
 #	     is unchanged.						#
 #									#
@@ -22335,7 +22335,7 @@
 	mov.l		%d1, FTEMP_LO(%a0)	# store new lo(man)
 
 	mov.l		%d2, %d0		# return shift amount
-	
+
 	mov.l		(%sp)+, %d3		# restore temp regs
 	mov.l		(%sp)+, %d2
 
@@ -22350,7 +22350,7 @@
 	clr.l		FTEMP_LO(%a0)		# lo(man) is now zero
 
 	mov.l		%d2, %d0		# return shift amount
-	
+
 	mov.l		(%sp)+, %d3		# restore temp regs
 	mov.l		(%sp)+, %d2
 
@@ -22455,27 +22455,27 @@
 # whole mantissa is zero so this UNNORM is actually a zero
 #
 unnorm_zero:
-	and.w		&0x8000, FTEMP_EX(%a0) 	# force exponent to zero
+	and.w		&0x8000, FTEMP_EX(%a0)	# force exponent to zero
 
 	mov.b		&ZERO, %d0		# fix optype tag
 	rts
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	set_tag_x(): return the optype of the input ext fp number	#
+#	set_tag_x(): return the optype of the input ext fp number	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of type tag						#
-# 		one of: NORM, INF, QNAN, SNAN, DENORM, UNNORM, ZERO	#
+#		one of: NORM, INF, QNAN, SNAN, DENORM, UNNORM, ZERO	#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Simply test the exponent, j-bit, and mantissa values to 	#
+#	Simply test the exponent, j-bit, and mantissa values to		#
 # determine the type of operand.					#
 #	If it's an unnormalized zero, alter the operand and force it	#
 # to be a normal zero.							#
@@ -22542,20 +22542,20 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	set_tag_d(): return the optype of the input dbl fp number	#
+#	set_tag_d(): return the optype of the input dbl fp number	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = points to double precision operand				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of type tag						#
-# 		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
+#		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Simply test the exponent, j-bit, and mantissa values to 	#
+#	Simply test the exponent, j-bit, and mantissa values to		#
 # determine the type of operand.					#
 #									#
 #########################################################################
@@ -22605,20 +22605,20 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	set_tag_s(): return the optype of the input sgl fp number	#
+#	set_tag_s(): return the optype of the input sgl fp number	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to single precision operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of type tag						#
-# 		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
+#		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Simply test the exponent, j-bit, and mantissa values to 	#
+#	Simply test the exponent, j-bit, and mantissa values to		#
 # determine the type of operand.					#
 #									#
 #########################################################################
@@ -22664,15 +22664,15 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	unf_res(): routine to produce default underflow result of a 	#
-#	 	   scaled extended precision number; this is used by 	#
+#	unf_res(): routine to produce default underflow result of a	#
+#		   scaled extended precision number; this is used by	#
 #		   fadd/fdiv/fmul/etc. emulation routines.		#
-# 	unf_res4(): same as above but for fsglmul/fsgldiv which use	#
+#	unf_res4(): same as above but for fsglmul/fsgldiv which use	#
 #		    single round prec and extended prec mode.		#
 #									#
 # XREF ****************************************************************	#
 #	_denorm() - denormalize according to scale factor		#
-# 	_round() - round denormalized number according to rnd prec	#
+#	_round() - round denormalized number according to rnd prec	#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precison operand			#
@@ -22684,15 +22684,15 @@
 #	d0.b = result FPSR_cc which caller may or may not want to save	#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Convert the input operand to "internal format" which means the	#
+#	Convert the input operand to "internal format" which means the	#
 # exponent is extended to 16 bits and the sign is stored in the unused	#
 # portion of the extended precison operand. Denormalize the number	#
-# according to the scale factor passed in d0. Then, round the 		#
+# according to the scale factor passed in d0. Then, round the		#
 # denormalized result.							#
-# 	Set the FPSR_exc bits as appropriate but return the cc bits in	#
+#	Set the FPSR_exc bits as appropriate but return the cc bits in	#
 # d0 in case the caller doesn't want to save them (as is the case for	#
 # fmove out).								#
-# 	unf_res4() for fsglmul/fsgldiv forces the denorm to extended	#
+#	unf_res4() for fsglmul/fsgldiv forces the denorm to extended	#
 # precision and the rounding mode to single.				#
 #									#
 #########################################################################
@@ -22830,23 +22830,23 @@
 #	none								#
 #									#
 # INPUT ***************************************************************	#
-#	d1.b 	= '-1' => (-); '0' => (+)				#
+#	d1.b	= '-1' => (-); '0' => (+)				#
 #   ovf_res():								#
-#	d0 	= rnd mode/prec						#
+#	d0	= rnd mode/prec						#
 #   ovf_res2():								#
-#	hi(d0) 	= rnd prec						#
+#	hi(d0)	= rnd prec						#
 #	lo(d0)	= rnd mode						#
 #									#
 # OUTPUT **************************************************************	#
-#	a0   	= points to extended precision result			#
-#	d0.b 	= condition code bits					#
+#	a0	= points to extended precision result			#
+#	d0.b	= condition code bits					#
 #									#
 # ALGORITHM ***********************************************************	#
 #	The default overflow result can be determined by the sign of	#
 # the result and the rounding mode/prec in effect. These bits are	#
-# concatenated together to create an index into the default result 	#
+# concatenated together to create an index into the default result	#
 # table. A pointer to the correct result is returned in a0. The		#
-# resulting condition codes are returned in d0 in case the caller 	#
+# resulting condition codes are returned in d0 in case the caller	#
 # doesn't want FPSR_cc altered (as is the case for fmove out).		#
 #									#
 #########################################################################
@@ -22876,7 +22876,7 @@
 ovf_res_load:
 	mov.b		(tbl_ovfl_cc.b,%pc,%d0.w*1), %d0 # fetch result ccodes
 	lea		(tbl_ovfl_result.b,%pc,%d1.w*8), %a0 # return result ptr
-	
+
 	rts
 
 tbl_ovfl_cc:
@@ -22937,18 +22937,18 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If no failure on _mem_read():					#
-# 	FP_SRC(a6) = packed operand now as a binary FP number		#
+#	FP_SRC(a6) = packed operand now as a binary FP number		#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Get the correct <ea> whihc is the value on the exception stack 	#
+#	Get the correct <ea> whihc is the value on the exception stack	#
 # frame w/ maybe a correction factor if the <ea> is -(an) or (an)+.	#
 # Then, fetch the operand from memory. If the fetch fails, exit		#
 # through facc_in_x().							#
 #	If the packed operand is a ZERO,NAN, or INF, convert it to	#
-# its binary representation here. Else, call decbin() which will 	#
+# its binary representation here. Else, call decbin() which will	#
 # convert the packed value to an extended precision binary value.	#
 #									#
 #########################################################################
@@ -23005,7 +23005,7 @@
 #	and NaN operands are dispatched without entering this routine)	#
 #	value in 68881/882 format at location (a0).			#
 #									#
-#	A1. Convert the bcd exponent to binary by successive adds and 	#
+#	A1. Convert the bcd exponent to binary by successive adds and	#
 #	muls. Set the sign according to SE. Subtract 16 to compensate	#
 #	for the mantissa which is to be interpreted as 17 integer	#
 #	digits, rather than 1 integer and 16 fraction digits.		#
@@ -23069,7 +23069,7 @@
 
 	global		decbin
 decbin:
-	mov.l		0x0(%a0),FP_SCR0_EX(%a6) # make a copy of input 
+	mov.l		0x0(%a0),FP_SCR0_EX(%a6) # make a copy of input
 	mov.l		0x4(%a0),FP_SCR0_HI(%a6) # so we don't alter it
 	mov.l		0x8(%a0),FP_SCR0_LO(%a6)
 
@@ -23358,7 +23358,7 @@
 #
 # Pwrten calculates the exponent factor in the selected rounding mode
 # according to the following table:
-#	
+#
 #	Sign of Mant  Sign of Exp  Rounding Mode  PWRTEN Rounding Mode
 #
 #	ANY	  ANY	RN	RN
@@ -23446,7 +23446,7 @@
 # it will be inex2, but will be reported as inex1 by get_op.
 #
 end_dec:
-	fmov.l		%fpsr,%d0		# get status register	
+	fmov.l		%fpsr,%d0		# get status register
 	bclr		&inex2_bit+8,%d0	# test for inex2 and clear it
 	beq.b		no_exc			# skip this if no exc
 	ori.w		&inx1a_mask,2+USER_FPSR(%a6) # set INEX1/AINEX
@@ -23463,16 +23463,16 @@
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to the input extended precision value in memory.	#
-#	     the input may be either normalized, unnormalized, or 	#
+#	     the input may be either normalized, unnormalized, or	#
 #	     denormalized.						#
-#	d0 = contains the k-factor sign-extended to 32-bits. 		#
+#	d0 = contains the k-factor sign-extended to 32-bits.		#
 #									#
 # OUTPUT **************************************************************	#
 #	FP_SCR0(a6) = bcd format result on the stack.			#
 #									#
 # ALGORITHM ***********************************************************	#
 #									#
-#	A1.	Set RM and size ext;  Set SIGMA = sign of input.  	#
+#	A1.	Set RM and size ext;  Set SIGMA = sign of input.	#
 #		The k-factor is saved for use in d7. Clear the		#
 #		BINDEC_FLG for separating normalized/denormalized	#
 #		input.  If input is unnormalized or denormalized,	#
@@ -23482,15 +23482,15 @@
 #									#
 #	A3.	Compute ILOG.						#
 #		ILOG is the log base 10 of the input value.  It is	#
-#		approximated by adding e + 0.f when the original 	#
-#		value is viewed as 2^^e * 1.f in extended precision.  	#
+#		approximated by adding e + 0.f when the original	#
+#		value is viewed as 2^^e * 1.f in extended precision.	#
 #		This value is stored in d6.				#
 #									#
 #	A4.	Clr INEX bit.						#
-#		The operation in A3 above may have set INEX2.  		#
+#		The operation in A3 above may have set INEX2.		#
 #									#
 #	A5.	Set ICTR = 0;						#
-#		ICTR is a flag used in A13.  It must be set before the 	#
+#		ICTR is a flag used in A13.  It must be set before the	#
 #		loop entry A6.						#
 #									#
 #	A6.	Calculate LEN.						#
@@ -23512,7 +23512,7 @@
 #		of ISCALE and X.  A table is given in the code.		#
 #									#
 #	A8.	Clr INEX; Force RZ.					#
-#		The operation in A3 above may have set INEX2.  		#
+#		The operation in A3 above may have set INEX2.		#
 #		RZ mode is forced for the scaling operation to insure	#
 #		only one rounding error.  The grs bits are collected in #
 #		the INEX flag for use in A10.				#
@@ -23543,11 +23543,11 @@
 #		the mantissa by 10.					#
 #									#
 #	A14.	Convert the mantissa to bcd.				#
-#		The binstr routine is used to convert the LEN digit 	#
+#		The binstr routine is used to convert the LEN digit	#
 #		mantissa to bcd in memory.  The input to binstr is	#
 #		to be a fraction; i.e. (mantissa)/10^LEN and adjusted	#
 #		such that the decimal point is to the left of bit 63.	#
-#		The bcd digits are stored in the correct position in 	#
+#		The bcd digits are stored in the correct position in	#
 #		the final string area in memory.			#
 #									#
 #	A15.	Convert the exponent to bcd.				#
@@ -23593,7 +23593,7 @@
 #		d2: upper 32-bits of mantissa for binstr
 #		d3: scratch;lower 32-bits of mantissa for binstr
 #		d4: LEN
-#      		d5: LAMBDA/ICTR
+#		d5: LAMBDA/ICTR
 #		d6: ILOG
 #		d7: k-factor
 #		a0: ptr for original operand/final result
@@ -23617,7 +23617,7 @@
 #     separating  normalized/denormalized input.  If the input
 #     is a denormalized number, set the BINDEC_FLG memory word
 #     to signal denorm.  If the input is unnormalized, normalize
-#     the input and test for denormalized result.  
+#     the input and test for denormalized result.
 #
 	fmov.l		&rm_mode*0x10,%fpcr	# set RM and ext
 	mov.l		(%a0),L_SCR2(%a6)	# save exponent for sign check
@@ -23698,7 +23698,7 @@
 	sub.w		&0x3fff,%d0	# strip off bias
 	fadd.w		%d0,%fp0	# add in exp
 	fsub.s		FONE(%pc),%fp0	# subtract off 1.0
-	fbge.w		pos_res		# if pos, branch 
+	fbge.w		pos_res		# if pos, branch
 	fmul.x		PLOG2UP1(%pc),%fp0	# if neg, mul by LOG2UP1
 	fmov.l		%fp0,%d6	# put ILOG in d6 as a lword
 	bra.b		A4_str		# go move out ILOG
@@ -23708,14 +23708,14 @@
 
 
 # A4. Clr INEX bit.
-#     The operation in A3 above may have set INEX2.  
+#     The operation in A3 above may have set INEX2.
 
 A4_str:
 	fmov.l		&0,%fpsr	# zero all of fpsr - nothing needed
 
 
 # A5. Set ICTR = 0;
-#     ICTR is a flag used in A13.  It must be set before the 
+#     ICTR is a flag used in A13.  It must be set before the
 #     loop entry A6. The lower word of d5 is used for ICTR.
 
 	clr.w		%d5		# clear ICTR
@@ -23881,21 +23881,21 @@
 	bne.b		e_loop2		# if not, loop
 
 # A8. Clr INEX; Force RZ.
-#     The operation in A3 above may have set INEX2.  
+#     The operation in A3 above may have set INEX2.
 #     RZ mode is forced for the scaling operation to insure
-#     only one rounding error.  The grs bits are collected in 
+#     only one rounding error.  The grs bits are collected in
 #     the INEX flag for use in A10.
 #
 # Register usage:
 #	Input/Output
 
-	fmov.l		&0,%fpsr	# clr INEX 
+	fmov.l		&0,%fpsr	# clr INEX
 	fmov.l		&rz_mode*0x10,%fpcr	# set RZ rounding mode
 
 # A9. Scale X -> Y.
 #     The mantissa is scaled to the desired number of significant
 #     digits.  The excess digits are collected in INEX2. If mul,
-#     Check d2 for excess 10 exponential value.  If not zero, 
+#     Check d2 for excess 10 exponential value.  If not zero,
 #     the iscale value would have caused the pwrten calculation
 #     to overflow.  Only a negative iscale can cause this, so
 #     multiply by 10^(d2), which is now only allowed to be 24,
@@ -24026,7 +24026,7 @@
 
 A11_st:
 	mov.l		USER_FPCR(%a6),L_SCR1(%a6)	# save it for later
-	and.l		&0x00000030,USER_FPCR(%a6)	# set size to ext, 
+	and.l		&0x00000030,USER_FPCR(%a6)	# set size to ext,
 #					;block exceptions
 
 
@@ -24062,7 +24062,7 @@
 	lea.l		FP_SCR1(%a6),%a0	# a0 is ptr to FP_SCR1(a6)
 	fmov.x		%fp0,(%a0)	# move Y to memory at FP_SCR1(a6)
 	tst.l		L_SCR2(%a6)	# test sign of original operand
-	bge.b		do_fint12		# if pos, use Y 
+	bge.b		do_fint12		# if pos, use Y
 	or.l		&0x80000000,(%a0)	# if neg, use -Y
 do_fint12:
 	mov.l	USER_FPSR(%a6),-(%sp)
@@ -24158,7 +24158,7 @@
 	subq.l		&1,%d6		# subtract 1 from ILOG
 	mov.w		&1,%d5		# set ICTR
 	fmov.l		&rm_mode*0x10,%fpcr	# set rmode to RM
-	fmul.s		FTEN(%pc),%fp2	# compute 10^LEN 
+	fmul.s		FTEN(%pc),%fp2	# compute 10^LEN
 	bra.w		A6_str		# return to A6 and recompute YINT
 test_2:
 	fmul.s		FTEN(%pc),%fp2	# compute 10^LEN
@@ -24174,7 +24174,7 @@
 	fmov.l		&rm_mode*0x10,%fpcr	# set rmode to RM
 	bra.w		A6_str		# return to A6 and recompute YINT
 #
-# Since ICTR <> 0, we have already been through one adjustment, 
+# Since ICTR <> 0, we have already been through one adjustment,
 # and shouldn't have another; this is to check if abs(YINT) = 10^LEN
 # 10^LEN is again computed using whatever table is in a1 since the
 # value calculated cannot be inexact.
@@ -24200,11 +24200,11 @@
 	fmul.s		FTEN(%pc),%fp2	# if LEN++, the get 10^^LEN
 
 # A14. Convert the mantissa to bcd.
-#      The binstr routine is used to convert the LEN digit 
+#      The binstr routine is used to convert the LEN digit
 #      mantissa to bcd in memory.  The input to binstr is
 #      to be a fraction; i.e. (mantissa)/10^LEN and adjusted
 #      such that the decimal point is to the left of bit 63.
-#      The bcd digits are stored in the correct position in 
+#      The bcd digits are stored in the correct position in
 #      the final string area in memory.
 #
 #
@@ -24247,7 +24247,7 @@
 	bgt.b		no_sft		# if so, don't shift
 	neg.l		%d0		# make exp positive
 m_loop:
-	lsr.l		&1,%d2		# shift d2:d3 right, add 0s 
+	lsr.l		&1,%d2		# shift d2:d3 right, add 0s
 	roxr.l		&1,%d3		# the number of places
 	dbf.w		%d0,m_loop	# given in d0
 no_sft:
@@ -24272,9 +24272,9 @@
 #
 #      Digits are stored in L_SCR1(a6) on return from BINDEC as:
 #
-#  	 32               16 15                0
+#	 32               16 15                0
 #	-----------------------------------------
-#  	|  0 | e3 | e2 | e1 | e4 |  X |  X |  X |
+#	|  0 | e3 | e2 | e1 | e4 |  X |  X |  X |
 #	-----------------------------------------
 #
 # And are moved into their proper places in FP_SCR0.  If digit e4
@@ -24337,7 +24337,7 @@
 	sub.w		&0x3ffd,%d0	# subtract off bias
 	neg.w		%d0		# make exp positive
 x_loop:
-	lsr.l		&1,%d2		# shift d2:d3 right 
+	lsr.l		&1,%d2		# shift d2:d3 right
 	roxr.l		&1,%d3		# the number of places
 	dbf.w		%d0,x_loop	# given in d0
 x_loop_fin:
@@ -24348,12 +24348,12 @@
 	mov.l		&4,%d0		# put 4 in d0 for binstr call
 	lea.l		L_SCR1(%a6),%a0	# a0 is ptr to L_SCR1 for exp digits
 	bsr		binstr		# call binstr to convert exp
-	mov.l		L_SCR1(%a6),%d0	# load L_SCR1 lword to d0 
+	mov.l		L_SCR1(%a6),%d0	# load L_SCR1 lword to d0
 	mov.l		&12,%d1		# use d1 for shift count
 	lsr.l		%d1,%d0		# shift d0 right by 12
 	bfins		%d0,FP_SCR0(%a6){&4:&12}	# put e3:e2:e1 in FP_SCR0
 	lsr.l		%d1,%d0		# shift d0 right by 12
-	bfins		%d0,FP_SCR0(%a6){&16:&4}	# put e4 in FP_SCR0 
+	bfins		%d0,FP_SCR0(%a6){&16:&4}	# put e4 in FP_SCR0
 	tst.b		%d0		# check if e4 is zero
 	beq.b		A16_st		# if zero, skip rest
 	or.l		&opaop_mask,USER_FPSR(%a6)	# set OPERR & AIOP in USER_FPSR
@@ -24384,14 +24384,14 @@
 
 A16_st:
 	clr.l		%d0		# clr d0 for collection of signs
-	and.b		&0x0f,FP_SCR0(%a6)	# clear first nibble of FP_SCR0 
+	and.b		&0x0f,FP_SCR0(%a6)	# clear first nibble of FP_SCR0
 	tst.l		L_SCR2(%a6)	# check sign of original mantissa
 	bge.b		mant_p		# if pos, don't set SM
 	mov.l		&2,%d0		# move 2 in to d0 for SM
 mant_p:
 	tst.l		%d6		# check sign of ILOG
 	bge.b		wr_sgn		# if pos, don't set SE
-	addq.l		&1,%d0		# set bit 0 in d0 for SE 
+	addq.l		&1,%d0		# set bit 0 in d0 for SE
 wr_sgn:
 	bfins		%d0,FP_SCR0(%a6){&0:&2}	# insert SM and SE into FP_SCR0
 
@@ -24457,8 +24457,8 @@
 #	d2:d3 = 64-bit binary integer					#
 #	d0    = desired length (LEN)					#
 #	a0    = pointer to start in memory for bcd characters		#
-#          	(This pointer must point to byte 4 of the first		#
-#          	 lword of the packed decimal memory string.)		#
+#		(This pointer must point to byte 4 of the first		#
+#		 lword of the packed decimal memory string.)		#
 #									#
 # OUTPUT ************************************************************** #
 #	a0 = pointer to LEN bcd digits representing the 64-bit integer.	#
@@ -24598,14 +24598,14 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	None								#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Flow jumps here when an FP data fetch call gets an error 	#
+#	Flow jumps here when an FP data fetch call gets an error	#
 # result. This means the operating system wants an access error frame	#
-# made out of the current exception stack frame. 			#
+# made out of the current exception stack frame.			#
 #	So, we first call restore() which makes sure that any updated	#
 # -(an)+ register gets returned to its pre-exception value and then	#
 # we change the stack to an access error stack frame.			#
@@ -24775,7 +24775,7 @@
 	bne.b		ri_a7_done		# supervisor
 	movc		%usp,%a0		# restore USP
 	sub.l		%d0,%a0
-	movc		%a0,%usp	
+	movc		%a0,%usp
 ri_a7_done:
 	rts
 
diff -Nru a/arch/m68k/ifpsp060/src/ftest.S b/arch/m68k/ifpsp060/src/ftest.S
--- a/arch/m68k/ifpsp060/src/ftest.S	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/ifpsp060/src/ftest.S	Tue Jun 15 22:20:39 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -86,7 +86,7 @@
 #############################################
 _060TESTS_:
 	link		%a6,&-384
-	
+
 	movm.l		&0x3f3c,-(%sp)
 	fmovm.x		&0xff,-(%sp)
 
@@ -138,7 +138,7 @@
 
 _060TESTS_unimp:
 	link		%a6,&-384
-	
+
 	movm.l		&0x3f3c,-(%sp)
 	fmovm.x		&0xff,-(%sp)
 
@@ -164,7 +164,7 @@
 
 _060TESTS_enable:
 	link		%a6,&-384
-	
+
 	movm.l		&0x3f3c,-(%sp)
 	fmovm.x		&0xff,-(%sp)
 
@@ -687,7 +687,7 @@
 
 	fmovm.l		%fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
 	fmovm.x		&0xff,IFPREGS(%a6)
-	
+
 	mov.w		&0x0000,%cc
 
 	fmovm.x		%d0,-(%sp)
@@ -753,7 +753,7 @@
 	movm.l		&0xffff,IREGS(%a6)
 
 	fmovm.l		%fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-	
+
 	mov.w		&0x0000,%cc
 
 	fmovm.x		(%sp)+,%d0
@@ -797,7 +797,7 @@
 
 	fmovm.l		%fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
 	fmovm.x		&0xff,IFPREGS(%a6)
-	
+
 	mov.w		&0x0000,%cc
 
 	fmovm.x		%d0,-(%sp)
diff -Nru a/arch/m68k/ifpsp060/src/ilsp.S b/arch/m68k/ifpsp060/src/ilsp.S
--- a/arch/m68k/ifpsp060/src/ilsp.S	Tue Jun 15 22:20:35 2004
+++ b/arch/m68k/ifpsp060/src/ilsp.S	Tue Jun 15 22:20:35 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -27,7 +27,7 @@
 or trademarks of Motorola, Inc.
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # litop.s:
-# 	This file is appended to the top of the 060FPLSP package
+#	This file is appended to the top of the 060FPLSP package
 # and contains the entry points into the package. The user, in
 # effect, branches to one of the branch table entries located here.
 #
@@ -64,7 +64,7 @@
 #	_060LSP__idivs64_(): Emulate 64-bit signed div instruction.	#
 #									#
 #	This is the library version which is accessed as a subroutine	#
-# 	and therefore does not work exactly like the 680X0 div{s,u}.l	#
+#	and therefore does not work exactly like the 680X0 div{s,u}.l	#
 #	64-bit divide instruction.					#
 #									#
 # XREF ****************************************************************	#
@@ -75,17 +75,17 @@
 #	0x8(sp)  = hi(dividend)						#
 #	0xc(sp)  = lo(dividend)						#
 #	0x10(sp) = pointer to location to place quotient/remainder	#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	0x10(sp) = points to location of remainder/quotient.		#
 #		   remainder is in first longword, quotient is in 2nd.	#
 #									#
 # ALGORITHM ***********************************************************	#
-#	If the operands are signed, make them unsigned and save the 	#
+#	If the operands are signed, make them unsigned and save the	#
 # sign info for later. Separate out special cases like divide-by-zero	#
 # or 32-bit divides if possible. Else, use a special math algorithm	#
 # to calculate the result.						#
-#	Restore sign info if signed instruction. Set the condition 	#
+#	Restore sign info if signed instruction. Set the condition	#
 # codes before performing the final "rts". If the divisor was equal to	#
 # zero, then perform a divide-by-zero using a 16-bit implemented	#
 # divide instruction. This way, the operating system can record that	#
@@ -135,8 +135,8 @@
 
 	beq.w		ldiv64eq0		# divisor is = 0!!!
 
-	mov.l		0xc(%a6), %d5 		# get dividend hi
-	mov.l		0x10(%a6), %d6 		# get dividend lo
+	mov.l		0xc(%a6), %d5		# get dividend hi
+	mov.l		0x10(%a6), %d6		# get dividend lo
 
 # separate signed and unsigned divide
 	tst.b		POSNEG(%a6)		# signed or unsigned?
@@ -161,7 +161,7 @@
 	negx.l		%d5
 
 # extract some special cases:
-# 	- is (dividend == 0) ?
+#	- is (dividend == 0) ?
 #	- is (hi(dividend) == 0 && (divisor <= lo(dividend))) ? (32-bit div)
 ldspecialcases:
 	tst.l		%d5			# is (hi(dividend) == 0)
@@ -170,7 +170,7 @@
 	tst.l		%d6			# is (lo(dividend) == 0), too
 	beq.w		lddone			# yes, so (dividend == 0)
 
-	cmp.l	 	%d7,%d6			# is (divisor <= lo(dividend))
+	cmp.l		%d7,%d6			# is (divisor <= lo(dividend))
 	bls.b		ld32bitdivide		# yes, so use 32 bit divide
 
 	exg		%d5,%d6			# q = 0, r = dividend
@@ -183,7 +183,7 @@
 
 ldnormaldivide:
 # last special case:
-# 	- is hi(dividend) >= divisor ? if yes, then overflow
+#	- is hi(dividend) >= divisor ? if yes, then overflow
 	cmp.l		%d7,%d5
 	bls.b		lddovf			# answer won't fit in 32 bits
 
@@ -196,7 +196,7 @@
 	beq.b		lddone			# divu has no processing!!!
 
 # it was a divs.l, so ccode setting is a little more complicated...
-	tst.b		NDIVIDEND(%a6)		# remainder has same sign 
+	tst.b		NDIVIDEND(%a6)		# remainder has same sign
 	beq.b		ldcc			# as dividend.
 	neg.l		%d5			# sgn(rem) = sgn(dividend)
 ldcc:
@@ -240,8 +240,8 @@
 
 # the result should be the unchanged dividend
 lddovf:
-	mov.l		0xc(%a6), %d5 		# get dividend hi
-	mov.l		0x10(%a6), %d6 		# get dividend lo
+	mov.l		0xc(%a6), %d5		# get dividend hi
+	mov.l		0x10(%a6), %d6		# get dividend lo
 
 	andi.w		&0x1c,DIV64_CC(%a6)
 	ori.w		&0x02,DIV64_CC(%a6)	# set 'V' ccode bit
@@ -271,8 +271,8 @@
 # For this implementation b=2**16, and the target is U1U2U3U4/V1V2,	#
 # where U,V are words of the quadword dividend and longword divisor,	#
 # and U1, V1 are the most significant words.				#
-# 									#
-# The most sig. longword of the 64 bit dividend must be in %d5, least 	#
+#									#
+# The most sig. longword of the 64 bit dividend must be in %d5, least	#
 # in %d6. The divisor must be in the variable ddivisor, and the		#
 # signed/unsigned flag ddusign must be set (0=unsigned,1=signed).	#
 # The quotient is returned in %d6, remainder in %d5, unless the		#
@@ -292,7 +292,7 @@
 # dividing the divisor word into each dividend word. In this case,
 # the first two quotient words must be zero, or overflow would occur.
 # Since we already checked this case above, we can treat the most significant
-# longword of the dividend as (0) remainder (see Knuth) and merely complete 
+# longword of the dividend as (0) remainder (see Knuth) and merely complete
 # the last two divisions to get a quotient longword and word remainder:
 
 	clr.l		%d1
@@ -328,12 +328,12 @@
 	clr.b		DDSECOND(%a6)		# clear flag for quotient digits
 	clr.l		%d1			# %d1 will hold trial quotient
 lddnchk:
-	btst		&31, %d7		# must we normalize? first word of 
+	btst		&31, %d7		# must we normalize? first word of
 	bne.b		lddnormalized		# divisor (V1) must be >= 65536/2
 	addq.l		&0x1, DDNORMAL(%a6)	# count normalization shifts
 	lsl.l		&0x1, %d7		# shift the divisor
 	lsl.l		&0x1, %d6		# shift u4,u3 with overflow to u2
-	roxl.l		&0x1, %d5		# shift u1,u2 
+	roxl.l		&0x1, %d5		# shift u1,u2
 	bra.w		lddnchk
 lddnormalized:
 
@@ -343,12 +343,12 @@
 	mov.l		%d5, %d2		# dividend mslw
 	swap		%d2
 	swap		%d3
-	cmp.w	 	%d2, %d3		# V1 = U1 ?
+	cmp.w		%d2, %d3		# V1 = U1 ?
 	bne.b		lddqcalc1
 	mov.w		&0xffff, %d1		# use max trial quotient word
 	bra.b		lddadj0
 lddqcalc1:
-	mov.l		%d5, %d1		
+	mov.l		%d5, %d1
 
 	divu.w		%d3, %d1		# use quotient of mslw/msw
 
@@ -379,7 +379,7 @@
 
 #	add.l		%d6, %d4		# (U1U2 - V1q) + U3
 
-	cmp.l	 	%d2, %d4
+	cmp.l		%d2, %d4
 	bls.b		lddadjd1		# is V2q > (U1U2-V1q) + U3 ?
 	subq.l		&0x1, %d1		# yes, decrement and recheck
 	bra.b		lddadj1
@@ -416,7 +416,7 @@
 	tst.b		DDSECOND(%a6)	# both q words done?
 	bne.b		lddremain
 # first quotient digit now correct. store digit and shift the
-# (subtracted) dividend 
+# (subtracted) dividend
 	mov.w		%d1, DDQUOTIENT(%a6)
 	clr.l		%d1
 	swap		%d5
@@ -427,7 +427,7 @@
 	bra.w		lddnormalized
 lddremain:
 # add 2nd word to quotient, get the remainder.
-	mov.w 		%d1, DDQUOTIENT+2(%a6)
+	mov.w		%d1, DDQUOTIENT+2(%a6)
 # shift down one word/digit to renormalize remainder.
 	mov.w		%d5, %d6
 	swap		%d6
@@ -441,7 +441,7 @@
 	dbf		%d7, lddnlp
 lddrn:
 	mov.l		%d6, %d5		# remainder
-	mov.l		DDQUOTIENT(%a6), %d6 	# quotient
+	mov.l		DDQUOTIENT(%a6), %d6	# quotient
 
 	rts
 ldmm2:
@@ -471,7 +471,7 @@
 	clr.w		%d2			# lsw of two mixed products used,
 	swap		%d5			# now use msws of longwords
 	swap		%d2
-	add.l		%d2, %d5				
+	add.l		%d2, %d5
 	add.l		%d3, %d5	# %d5 now ms 32 bits of final product
 	rts
 
@@ -491,7 +491,7 @@
 #	0x4(sp) = multiplier						#
 #	0x8(sp) = multiplicand						#
 #	0xc(sp) = pointer to location to place 64-bit result		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	0xc(sp) = points to location of 64-bit result			#
 #									#
@@ -524,9 +524,9 @@
 
 #########################################################################
 #	63			   32				0	#
-# 	----------------------------					#
-# 	| hi(mplier) * hi(mplicand)|					#
-# 	----------------------------					#
+#	----------------------------					#
+#	| hi(mplier) * hi(mplicand)|					#
+#	----------------------------					#
 #		     -----------------------------			#
 #		     | hi(mplier) * lo(mplicand) |			#
 #		     -----------------------------			#
@@ -589,7 +589,7 @@
 # the values at the location pointed to by a0.
 # use movm here to not disturb the condition codes.
 mulu64_end:
-	exg		%d1,%d0		
+	exg		%d1,%d0
 	movm.l		&0x0003,([0x10,%a6])		# save result
 
 # EPILOGUE BEGIN ########################################################
@@ -643,16 +643,16 @@
 # the result sign is the exclusive or of the operand sign bits.
 muls64_chk_md_sgn:
 	tst.l		%d1			# is multiplicand negative?
-	bge.b		muls64_alg		# no	
+	bge.b		muls64_alg		# no
 	neg.l		%d1			# make multiplicand positive
 
 	eori.b		&0x1,%d5		# calculate correct sign
 
 #########################################################################
 #	63			   32				0	#
-# 	----------------------------					#
-# 	| hi(mplier) * hi(mplicand)|					#
-# 	----------------------------					#
+#	----------------------------					#
+#	| hi(mplier) * hi(mplicand)|					#
+#	----------------------------					#
 #		     -----------------------------			#
 #		     | hi(mplier) * lo(mplicand) |			#
 #		     -----------------------------			#
@@ -726,7 +726,7 @@
 # the values at the location pointed to by a0.
 # use movm here to not disturb the condition codes.
 muls64_end:
-	exg		%d1,%d0		
+	exg		%d1,%d0
 	movm.l		&0x0003,([0x10,%a6])	# save result at (a0)
 
 # EPILOGUE BEGIN ########################################################
@@ -769,12 +769,12 @@
 # INPUT ***************************************************************	#
 #	0x4(sp) = Rn							#
 #	0x8(sp) = pointer to boundary pair				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	cc = condition codes are set correctly				#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	In the interest of simplicity, all operands are converted to	#
+#	In the interest of simplicity, all operands are converted to	#
 # longword size whether the operation is byte, word, or long. The	#
 # bounds are sign extended accordingly. If Rn is a data regsiter, Rn is #
 # also sign extended. If Rn is an address register, it need not be sign #
@@ -785,7 +785,7 @@
 
 set	CMP2_CC,	-4
 
-	global 		_060LSP__cmp2_Ab_
+	global		_060LSP__cmp2_Ab_
 _060LSP__cmp2_Ab_:
 
 # PROLOGUE BEGIN ########################################################
@@ -795,7 +795,7 @@
 # PROLOGUE END ##########################################################
 
 	mov.w		%cc,CMP2_CC(%a6)
-	mov.l		0x8(%a6), %d2 		# get regval
+	mov.l		0x8(%a6), %d2		# get regval
 
 	mov.b		([0xc,%a6],0x0),%d0
 	mov.b		([0xc,%a6],0x1),%d1
@@ -804,7 +804,7 @@
 	extb.l		%d1			# sign extend hi bnd
 	bra.w		l_cmp2_cmp		# go do the compare emulation
 
-	global 		_060LSP__cmp2_Aw_
+	global		_060LSP__cmp2_Aw_
 _060LSP__cmp2_Aw_:
 
 # PROLOGUE BEGIN ########################################################
@@ -814,7 +814,7 @@
 # PROLOGUE END ##########################################################
 
 	mov.w		%cc,CMP2_CC(%a6)
-	mov.l		0x8(%a6), %d2 		# get regval
+	mov.l		0x8(%a6), %d2		# get regval
 
 	mov.w		([0xc,%a6],0x0),%d0
 	mov.w		([0xc,%a6],0x2),%d1
@@ -823,7 +823,7 @@
 	ext.l		%d1			# sign extend hi bnd
 	bra.w		l_cmp2_cmp		# go do the compare emulation
 
-	global 		_060LSP__cmp2_Al_
+	global		_060LSP__cmp2_Al_
 _060LSP__cmp2_Al_:
 
 # PROLOGUE BEGIN ########################################################
@@ -833,13 +833,13 @@
 # PROLOGUE END ##########################################################
 
 	mov.w		%cc,CMP2_CC(%a6)
-	mov.l		0x8(%a6), %d2 		# get regval
+	mov.l		0x8(%a6), %d2		# get regval
 
 	mov.l		([0xc,%a6],0x0),%d0
 	mov.l		([0xc,%a6],0x4),%d1
 	bra.w		l_cmp2_cmp		# go do the compare emulation
 
-	global 		_060LSP__cmp2_Db_
+	global		_060LSP__cmp2_Db_
 _060LSP__cmp2_Db_:
 
 # PROLOGUE BEGIN ########################################################
@@ -849,7 +849,7 @@
 # PROLOGUE END ##########################################################
 
 	mov.w		%cc,CMP2_CC(%a6)
-	mov.l		0x8(%a6), %d2 		# get regval
+	mov.l		0x8(%a6), %d2		# get regval
 
 	mov.b		([0xc,%a6],0x0),%d0
 	mov.b		([0xc,%a6],0x1),%d1
@@ -862,7 +862,7 @@
 	extb.l		%d2			# sign extend data byte
 	bra.w		l_cmp2_cmp		# go do the compare emulation
 
-	global 		_060LSP__cmp2_Dw_
+	global		_060LSP__cmp2_Dw_
 _060LSP__cmp2_Dw_:
 
 # PROLOGUE BEGIN ########################################################
@@ -872,7 +872,7 @@
 # PROLOGUE END ##########################################################
 
 	mov.w		%cc,CMP2_CC(%a6)
-	mov.l		0x8(%a6), %d2 		# get regval
+	mov.l		0x8(%a6), %d2		# get regval
 
 	mov.w		([0xc,%a6],0x0),%d0
 	mov.w		([0xc,%a6],0x2),%d1
@@ -885,7 +885,7 @@
 	ext.l		%d2			# sign extend data word
 	bra.w		l_cmp2_cmp		# go emulate compare
 
-	global 		_060LSP__cmp2_Dl_
+	global		_060LSP__cmp2_Dl_
 _060LSP__cmp2_Dl_:
 
 # PROLOGUE BEGIN ########################################################
@@ -895,14 +895,14 @@
 # PROLOGUE END ##########################################################
 
 	mov.w		%cc,CMP2_CC(%a6)
-	mov.l		0x8(%a6), %d2 		# get regval
+	mov.l		0x8(%a6), %d2		# get regval
 
 	mov.l		([0xc,%a6],0x0),%d0
 	mov.l		([0xc,%a6],0x4),%d1
 
 #
 # To set the ccodes correctly:
-# 	(1) save 'Z' bit from (Rn - lo)
+#	(1) save 'Z' bit from (Rn - lo)
 #	(2) save 'Z' and 'N' bits from ((hi - lo) - (Rn - hi))
 #	(3) keep 'X', 'N', and 'V' from before instruction
 #	(4) combine ccodes
@@ -912,7 +912,7 @@
 	mov.w		%cc, %d3		# fetch resulting ccodes
 	andi.b		&0x4, %d3		# keep 'Z' bit
 	sub.l		%d0, %d1		# (hi - lo)
-	cmp.l	 	%d1,%d2			# ((hi - lo) - (Rn - hi))
+	cmp.l		%d1,%d2			# ((hi - lo) - (Rn - hi))
 
 	mov.w		%cc, %d4		# fetch resulting ccodes
 	or.b		%d4, %d3		# combine w/ earlier ccodes
diff -Nru a/arch/m68k/ifpsp060/src/isp.S b/arch/m68k/ifpsp060/src/isp.S
--- a/arch/m68k/ifpsp060/src/isp.S	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/ifpsp060/src/isp.S	Tue Jun 15 22:20:38 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -322,21 +322,21 @@
 # Misc. #
 #########
 set BYTE,		1			# len(byte) == 1 byte
-set WORD, 		2			# len(word) == 2 bytes
-set LONG, 		4			# len(longword) == 4 bytes
+set WORD,		2			# len(word) == 2 bytes
+set LONG,		4			# len(longword) == 4 bytes
 
 #########################################################################
 # XDEF ****************************************************************	#
 #	_isp_unimp(): 060ISP entry point for Unimplemented Instruction	#
 #									#
-#	This handler should be the first code executed upon taking the 	#
-# 	"Unimplemented Integer Instruction" exception in an operating	#
+#	This handler should be the first code executed upon taking the	#
+#	"Unimplemented Integer Instruction" exception in an operating	#
 #	system.								#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_{word,long}() - read instruction word/longword	#
 #	_mul64() - emulate 64-bit multiply				#
-# 	_div64() - emulate 64-bit divide				#
+#	_div64() - emulate 64-bit divide				#
 #	_moveperipheral() - emulate "movep"				#
 #	_compandset() - emulate misaligned "cas"			#
 #	_compandset2() - emulate "cas2"					#
@@ -349,7 +349,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	- The system stack contains the Unimp Int Instr stack frame	#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If Trace exception:						#
 #	- The system stack changed to contain Trace exc stack frame	#
@@ -366,8 +366,8 @@
 #	This handler fetches the first instruction longword from	#
 # memory and decodes it to determine which of the unimplemented		#
 # integer instructions caused this exception. This handler then calls	#
-# one of _mul64(), _div64(), _moveperipheral(), _compandset(), 		#
-# _compandset2(), or _chk2_cmp2() as appropriate. 			#
+# one of _mul64(), _div64(), _moveperipheral(), _compandset(),		#
+# _compandset2(), or _chk2_cmp2() as appropriate.			#
 #	Some of these instructions, by their nature, may produce other	#
 # types of exceptions. "div" can produce a divide-by-zero exception,	#
 # and "chk2" can cause a "Chk" exception. In both cases, the current	#
@@ -375,7 +375,7 @@
 # of the correct exception type and an exit must be made through	#
 # _real_divbyzero() or _real_chk() as appropriate. In addition, all	#
 # instructions may be executing while Trace is enabled. If so, then	#
-# a Trace exception stack frame must be created and an exit made 	#
+# a Trace exception stack frame must be created and an exit made	#
 # through _real_trace().						#
 #	Meanwhile, if any read or write to memory using the		#
 # _mem_{read,write}() "callout"s returns a failing value, then an	#
@@ -384,19 +384,19 @@
 #	If none of these occur, then a normal exit is made through	#
 # _isp_done().								#
 #									#
-#	This handler, upon entry, saves almost all user-visible 	#
+#	This handler, upon entry, saves almost all user-visible		#
 # address and data registers to the stack. Although this may seem to	#
 # cause excess memory traffic, it was found that due to having to	#
 # access these register files for things like data retrieval and <ea>	#
 # calculations, it was more efficient to have them on the stack where	#
-# they could be accessed by indexing rather than to make subroutine 	#
-# calls to retrieve a register of a particular index. 			#
+# they could be accessed by indexing rather than to make subroutine	#
+# calls to retrieve a register of a particular index.			#
 #									#
 #########################################################################
 
 	global		_isp_unimp
 _isp_unimp:
-	link.w 		%a6,&-LOCAL_SIZE	# create room for stack frame
+	link.w		%a6,&-LOCAL_SIZE	# create room for stack frame
 
 	movm.l		&0x3fff,EXC_DREGS(%a6)	# store d0-d7/a0-a5
 	mov.l		(%a6),EXC_A6(%a6)	# store a6
@@ -428,9 +428,9 @@
 	bsr.l		_imem_read_long		# fetch opword & extword
 	mov.l		%d0,EXC_OPWORD(%a6)	# store extword on stack
 
-	
+
 #########################################################################
-# muls.l	0100 1100 00 |<ea>|	0*** 1100 0000 0*** 		#
+# muls.l	0100 1100 00 |<ea>|	0*** 1100 0000 0***		#
 # mulu.l	0100 1100 00 |<ea>|	0*** 0100 0000 0***		#
 #									#
 # divs.l	0100 1100 01 |<ea>|	0*** 1100 0000 0***		#
@@ -514,7 +514,7 @@
 	tst.b		EXC_ISR(%a6)		# no; is trace enabled?
 	bmi.w		uieh_trace_a7		# yes
 	bra.w		uieh_a7			# no
-	
+
 #
 # now, w/ group2, make movep's decode the fastest since it will
 # most likely be used the most.
@@ -532,7 +532,7 @@
 	beq.b		uieh_chk2cmp2		# go handle chk2,cmp2
 
 	swap		%d0			# put opword in lo word
-	cmpi.b	 	%d0,&0xfc		# test for cas2
+	cmpi.b		%d0,&0xfc		# test for cas2
 	beq.b		uieh_cas2		# go handle cas2
 
 uieh_cas:
@@ -585,7 +585,7 @@
 	mov.l		%a0,%usp		# restore it
 
 uieh_finish:
-	movm.l		EXC_DREGS(%a6),&0x3fff 	# restore d0-d7/a0-a5
+	movm.l		EXC_DREGS(%a6),&0x3fff	# restore d0-d7/a0-a5
 
 	btst		&0x7,EXC_ISR(%a6)	# is trace mode on?
 	bne.b		uieh_trace		# yes;go handle trace mode
@@ -596,7 +596,7 @@
 	bra.l		_isp_done
 
 #
-# The instruction that was just emulated was also being traced. The trace 
+# The instruction that was just emulated was also being traced. The trace
 # trap for this instruction will be lost unless we jump to the trace handler.
 # So, here we create a Trace Exception format number two exception stack
 # frame from the Unimplemented Integer Intruction Exception stack frame
@@ -607,11 +607,11 @@
 #		* 0x0 *  0x0f4	*	*    Current	*
 #		*****************	*      PC	*
 #		*    Current	*	*****************
-#		*      PC 	*	* 0x2 *  0x024	*
+#		*      PC	*	* 0x2 *  0x024	*
 #		*****************	*****************
 #		*      SR	*	*     Next	*
 #		*****************	*      PC	*
-#	      ->*     Old   	*	*****************
+#	      ->*     Old	*	*****************
 #  from link -->*      A6	*	*      SR	*
 #	        *****************	*****************
 #	       /*      A7	*	*      New	* <-- for final unlink
@@ -651,7 +651,7 @@
 #
 uieh_chk_trap:
 	mov.b		EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
-	movm.l		EXC_DREGS(%a6),&0x3fff 	# restore d0-d7/a0-a5
+	movm.l		EXC_DREGS(%a6),&0x3fff	# restore d0-d7/a0-a5
 
 	mov.w		EXC_ISR(%a6),(%a6)	# put new SR on stack
 	mov.l		EXC_IPC(%a6),0x8(%a6)	# put "Current PC" on stack
@@ -678,14 +678,14 @@
 #				*****************
 #				    (6 words)
 #
-# the divide instruction should take an integer divide by zero trap. so, here 
-# we must create a divbyzero stack frame from an unimplemented integer 
-# instruction exception frame and jump to the user supplied entry point 
+# the divide instruction should take an integer divide by zero trap. so, here
+# we must create a divbyzero stack frame from an unimplemented integer
+# instruction exception frame and jump to the user supplied entry point
 # "_real_divbyzero()".
 #
 uieh_divbyzero:
 	mov.b		EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
-	movm.l		EXC_DREGS(%a6),&0x3fff 	# restore d0-d7/a0-a5
+	movm.l		EXC_DREGS(%a6),&0x3fff	# restore d0-d7/a0-a5
 
 	mov.w		EXC_ISR(%a6),(%a6)	# put new SR on stack
 	mov.l		EXC_IPC(%a6),0x8(%a6)	# put "Current PC" on stack
@@ -712,9 +712,9 @@
 #	*****************	*****************
 #	    (4 words)		    (6 words)
 #
-# the divide instruction should take an integer divide by zero trap. so, here 
-# we must create a divbyzero stack frame from an unimplemented integer 
-# instruction exception frame and jump to the user supplied entry point 
+# the divide instruction should take an integer divide by zero trap. so, here
+# we must create a divbyzero stack frame from an unimplemented integer
+# instruction exception frame and jump to the user supplied entry point
 # "_real_divbyzero()".
 #
 # However, we must also deal with the fact that (a7)+ was used from supervisor
@@ -722,7 +722,7 @@
 #
 uieh_divbyzero_a7:
 	mov.b		EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
-	movm.l		EXC_DREGS(%a6),&0x3fff 	# restore d0-d7/a0-a5
+	movm.l		EXC_DREGS(%a6),&0x3fff	# restore d0-d7/a0-a5
 
 	mov.l		EXC_IPC(%a6),0xc(%a6)	# put "Current PC" on stack
 	mov.w		&0x2014,0xa(%a6)	# put Vector Offset on stack
@@ -748,8 +748,8 @@
 #	*****************	*****************
 #	    (4 words)		    (6 words)
 #
-# 
-# The instruction that was just emulated was also being traced. The trace 
+#
+# The instruction that was just emulated was also being traced. The trace
 # trap for this instruction will be lost unless we jump to the trace handler.
 # So, here we create a Trace Exception format number two exception stack
 # frame from the Unimplemented Integer Intruction Exception stack frame
@@ -760,7 +760,7 @@
 #
 uieh_trace_a7:
 	mov.b		EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
-	movm.l		EXC_DREGS(%a6),&0x3fff 	# restore d0-d7/a0-a5
+	movm.l		EXC_DREGS(%a6),&0x3fff	# restore d0-d7/a0-a5
 
 	mov.l		EXC_IPC(%a6),0xc(%a6)	# put "Current PC" on stack
 	mov.w		&0x2024,0xa(%a6)	# put Vector Offset on stack
@@ -772,12 +772,12 @@
 	bra.l		_real_trace
 
 #
-#				   UIEH FRAME	
+#				   UIEH FRAME
 #				*****************
 #				* 0x0 * 0x0f4	*
 #	   UIEH FRAME		*****************
 #	*****************	*     Next	*
-#	* 0x0 *  0x0f4	*	*      PC	*	
+#	* 0x0 *  0x0f4	*	*      PC	*
 #	*****************	*****************
 #	*    Current	*	*      SR	*
 #	*      PC	*	*****************
@@ -787,7 +787,7 @@
 #	    (4 words)
 uieh_a7:
 	mov.b		EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
-	movm.l		EXC_DREGS(%a6),&0x3fff 	# restore d0-d7/a0-a5
+	movm.l		EXC_DREGS(%a6),&0x3fff	# restore d0-d7/a0-a5
 
 	mov.w		&0x00f4,0xe(%a6)	# put Vector Offset on stack
 	mov.l		EXC_EXTWPTR(%a6),0xa(%a6) # put "Next PC" on stack
@@ -803,11 +803,11 @@
 # a0 = failing address
 # d0 = fslw
 isp_dacc:
-	mov.l		%a0,(%a6)		# save address	
+	mov.l		%a0,(%a6)		# save address
 	mov.l		%d0,-0x4(%a6)		# save partial fslw
 
 	lea		-64(%a6),%sp
-	movm.l		(%sp)+,&0x7fff 		# restore d0-d7/a0-a6
+	movm.l		(%sp)+,&0x7fff		# restore d0-d7/a0-a6
 
 	mov.l		0xc(%sp),-(%sp)		# move voff,hi(pc)
 	mov.l		0x4(%sp),0x10(%sp)	# store fslw
@@ -822,11 +822,11 @@
 # FSLW:
 #	misaligned = true
 #	read = true
-# 	size = word
-# 	instruction = true
-# 	software emulation error = true
+#	size = word
+#	instruction = true
+#	software emulation error = true
 isp_iacc:
-	movm.l		EXC_DREGS(%a6),&0x3fff 	# restore d0-d7/a0-a5
+	movm.l		EXC_DREGS(%a6),&0x3fff	# restore d0-d7/a0-a5
 	unlk		%a6			# unlink frame
 	sub.w		&0x8,%sp		# make room for acc frame
 	mov.l		0x8(%sp),(%sp)		# store sr,lo(pc)
@@ -840,7 +840,7 @@
 	beq.b		isp_acc_exit2		# user
 	bset		&0x2,0xd(%sp)		# set supervisor TM bit
 isp_acc_exit2:
-	bra.l		_real_access		
+	bra.l		_real_access
 
 # if the addressing mode was (an)+ or -(an), the address register must
 # be restored to its pre-exception value before entering _real_access.
@@ -858,14 +858,14 @@
 #	_calc_ea(): routine to calculate effective address		#
 #									#
 # XREF ****************************************************************	#
-# 	_imem_read_word() - read instruction word			#
-# 	_imem_read_long() - read instruction longword			#
-# 	_dmem_read_long() - read data longword (for memory indirect)	#
-# 	isp_iacc() - handle instruction access error exception		#
+#	_imem_read_word() - read instruction word			#
+#	_imem_read_long() - read instruction longword			#
+#	_dmem_read_long() - read data longword (for memory indirect)	#
+#	isp_iacc() - handle instruction access error exception		#
 #	isp_dacc() - handle data access error exception			#
 #									#
 # INPUT ***************************************************************	#
-# 	d0 = number of bytes related to effective address (w,l)		#
+#	d0 = number of bytes related to effective address (w,l)		#
 #									#
 # OUTPUT **************************************************************	#
 #	If exiting through isp_dacc...					#
@@ -877,22 +877,22 @@
 #		a0 = effective address					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	The effective address type is decoded from the opword residing	#
-# on the stack. A jump table is used to vector to a routine for the 	#
+#	The effective address type is decoded from the opword residing	#
+# on the stack. A jump table is used to vector to a routine for the	#
 # appropriate mode. Since none of the emulated integer instructions	#
 # uses byte-sized operands, only handle word and long operations.	#
 #									#
-# 	Dn,An	- shouldn't enter here					#
+#	Dn,An	- shouldn't enter here					#
 #	(An)	- fetch An value from stack				#
-# 	-(An)	- fetch An value from stack; return decr value;		#
+#	-(An)	- fetch An value from stack; return decr value;		#
 #		  place decr value on stack; store old value in case of	#
-#		  future access error; if -(a7), set mda7_flg in 	#
+#		  future access error; if -(a7), set mda7_flg in	#
 #		  SPCOND_FLG						#
 #	(An)+	- fetch An value from stack; return value;		#
 #		  place incr value on stack; store old value in case of	#
 #		  future access error; if (a7)+, set mia7_flg in	#
 #		  SPCOND_FLG						#
-#	(d16,An) - fetch An value from stack; read d16 using 		#
+#	(d16,An) - fetch An value from stack; read d16 using		#
 #		  _imem_read_word(); fetch may fail -> branch to	#
 #		  isp_iacc()						#
 #	(xxx).w,(xxx).l - use _imem_read_{word,long}() to fetch		#
@@ -904,7 +904,7 @@
 #		  isp_iacc()						#
 #	everything else - read needed displacements as appropriate w/	#
 #		  _imem_read_{word,long}(); read may fail; if memory	#
-# 		  indirect, read indirect address using			#
+#		  indirect, read indirect address using			#
 #		  _dmem_read_long() which may also fail			#
 #									#
 #########################################################################
@@ -944,59 +944,59 @@
 	short		tbl_ea_mode	-	tbl_ea_mode
 	short		tbl_ea_mode	-	tbl_ea_mode
 
-	short		addr_ind_a0	- 	tbl_ea_mode
-	short		addr_ind_a1	- 	tbl_ea_mode
-	short		addr_ind_a2	- 	tbl_ea_mode
-	short		addr_ind_a3 	- 	tbl_ea_mode
-	short		addr_ind_a4 	- 	tbl_ea_mode
-	short		addr_ind_a5 	- 	tbl_ea_mode
-	short		addr_ind_a6 	- 	tbl_ea_mode
-	short		addr_ind_a7 	- 	tbl_ea_mode
-
-	short		addr_ind_p_a0	- 	tbl_ea_mode
-	short		addr_ind_p_a1 	- 	tbl_ea_mode
-	short		addr_ind_p_a2 	- 	tbl_ea_mode
-	short		addr_ind_p_a3 	- 	tbl_ea_mode
-	short		addr_ind_p_a4 	- 	tbl_ea_mode
-	short		addr_ind_p_a5 	- 	tbl_ea_mode
-	short		addr_ind_p_a6 	- 	tbl_ea_mode
-	short		addr_ind_p_a7 	- 	tbl_ea_mode
-
-	short		addr_ind_m_a0 		- 	tbl_ea_mode
-	short		addr_ind_m_a1 		- 	tbl_ea_mode
-	short		addr_ind_m_a2 		- 	tbl_ea_mode
-	short		addr_ind_m_a3 		- 	tbl_ea_mode
-	short		addr_ind_m_a4 		- 	tbl_ea_mode
-	short		addr_ind_m_a5 		- 	tbl_ea_mode
-	short		addr_ind_m_a6 		- 	tbl_ea_mode
-	short		addr_ind_m_a7 		- 	tbl_ea_mode
-
-	short		addr_ind_disp_a0	- 	tbl_ea_mode
-	short		addr_ind_disp_a1 	- 	tbl_ea_mode
-	short		addr_ind_disp_a2 	- 	tbl_ea_mode
-	short		addr_ind_disp_a3 	- 	tbl_ea_mode
-	short		addr_ind_disp_a4 	- 	tbl_ea_mode
-	short		addr_ind_disp_a5 	- 	tbl_ea_mode
-	short		addr_ind_disp_a6 	- 	tbl_ea_mode
+	short		addr_ind_a0	-	tbl_ea_mode
+	short		addr_ind_a1	-	tbl_ea_mode
+	short		addr_ind_a2	-	tbl_ea_mode
+	short		addr_ind_a3	-	tbl_ea_mode
+	short		addr_ind_a4	-	tbl_ea_mode
+	short		addr_ind_a5	-	tbl_ea_mode
+	short		addr_ind_a6	-	tbl_ea_mode
+	short		addr_ind_a7	-	tbl_ea_mode
+
+	short		addr_ind_p_a0	-	tbl_ea_mode
+	short		addr_ind_p_a1	-	tbl_ea_mode
+	short		addr_ind_p_a2	-	tbl_ea_mode
+	short		addr_ind_p_a3	-	tbl_ea_mode
+	short		addr_ind_p_a4	-	tbl_ea_mode
+	short		addr_ind_p_a5	-	tbl_ea_mode
+	short		addr_ind_p_a6	-	tbl_ea_mode
+	short		addr_ind_p_a7	-	tbl_ea_mode
+
+	short		addr_ind_m_a0		-	tbl_ea_mode
+	short		addr_ind_m_a1		-	tbl_ea_mode
+	short		addr_ind_m_a2		-	tbl_ea_mode
+	short		addr_ind_m_a3		-	tbl_ea_mode
+	short		addr_ind_m_a4		-	tbl_ea_mode
+	short		addr_ind_m_a5		-	tbl_ea_mode
+	short		addr_ind_m_a6		-	tbl_ea_mode
+	short		addr_ind_m_a7		-	tbl_ea_mode
+
+	short		addr_ind_disp_a0	-	tbl_ea_mode
+	short		addr_ind_disp_a1	-	tbl_ea_mode
+	short		addr_ind_disp_a2	-	tbl_ea_mode
+	short		addr_ind_disp_a3	-	tbl_ea_mode
+	short		addr_ind_disp_a4	-	tbl_ea_mode
+	short		addr_ind_disp_a5	-	tbl_ea_mode
+	short		addr_ind_disp_a6	-	tbl_ea_mode
 	short		addr_ind_disp_a7	-	tbl_ea_mode
 
-	short		_addr_ind_ext 		- 	tbl_ea_mode
-	short		_addr_ind_ext 		- 	tbl_ea_mode
-	short		_addr_ind_ext 		- 	tbl_ea_mode
-	short		_addr_ind_ext 		- 	tbl_ea_mode
-	short		_addr_ind_ext 		- 	tbl_ea_mode
-	short		_addr_ind_ext 		- 	tbl_ea_mode
-	short		_addr_ind_ext 		- 	tbl_ea_mode
-	short		_addr_ind_ext 		- 	tbl_ea_mode
-
-	short		abs_short		- 	tbl_ea_mode
-	short		abs_long		- 	tbl_ea_mode
-	short		pc_ind			- 	tbl_ea_mode
-	short		pc_ind_ext		- 	tbl_ea_mode
-	short		immediate		- 	tbl_ea_mode
-	short		tbl_ea_mode		- 	tbl_ea_mode
-	short		tbl_ea_mode		- 	tbl_ea_mode
-	short		tbl_ea_mode		- 	tbl_ea_mode
+	short		_addr_ind_ext		-	tbl_ea_mode
+	short		_addr_ind_ext		-	tbl_ea_mode
+	short		_addr_ind_ext		-	tbl_ea_mode
+	short		_addr_ind_ext		-	tbl_ea_mode
+	short		_addr_ind_ext		-	tbl_ea_mode
+	short		_addr_ind_ext		-	tbl_ea_mode
+	short		_addr_ind_ext		-	tbl_ea_mode
+	short		_addr_ind_ext		-	tbl_ea_mode
+
+	short		abs_short		-	tbl_ea_mode
+	short		abs_long		-	tbl_ea_mode
+	short		pc_ind			-	tbl_ea_mode
+	short		pc_ind_ext		-	tbl_ea_mode
+	short		immediate		-	tbl_ea_mode
+	short		tbl_ea_mode		-	tbl_ea_mode
+	short		tbl_ea_mode		-	tbl_ea_mode
+	short		tbl_ea_mode		-	tbl_ea_mode
 
 ###################################
 # Address register indirect: (An) #
@@ -1041,7 +1041,7 @@
 	mov.l		EXC_A0(%a6),%a0		# load current value
 	add.l		%a0,%d0			# increment
 	mov.l		%d0,EXC_A0(%a6)		# save incremented value
-	
+
 	mov.l		%a0,EXC_SAVVAL(%a6)	# save in case of access error
 	mov.b		&0x0,EXC_SAVREG(%a6)	# save regno, too
 	mov.b		&restore_flg,SPCOND_FLG(%a6) # set flag
@@ -1339,7 +1339,7 @@
 	mov.l		%a0,%d3			# put base in d3
 
 	bra.l		calc_mem_ind		# calc memory indirect
-	
+
 addr_ind_index_8bit:
 	mov.l		%d2,-(%sp)		# save old d2
 
@@ -1370,8 +1370,8 @@
 # Immediate: #<data> #
 #########################################################################
 # word, long: <ea> of the data is the current extension word		#
-# 	pointer value. new extension word pointer is simply the old	#
-# 	plus the number of bytes in the data type(2 or 4).		#
+#	pointer value. new extension word pointer is simply the old	#
+#	plus the number of bytes in the data type(2 or 4).		#
 #########################################################################
 immediate:
 	mov.b		&immed_flg,SPCOND_FLG(%a6) # set immediate flag
@@ -1455,9 +1455,9 @@
 	mov.l		%a0,%d3			# put base in d3
 
 	bra.l		calc_mem_ind		# calc memory indirect
-	
+
 pc_ind_index_8bit:
- 	mov.l		%d2,-(%sp)		# create a temp register
+	mov.l		%d2,-(%sp)		# create a temp register
 
 	mov.l		%d0,%d1			# make extword copy
 	rol.w		&0x4,%d1		# rotate reg num into place
@@ -1512,14 +1512,14 @@
 no_base_sup:
 	bfextu		%d5{&26:&2},%d0	# get bd size
 #	beq.l		_error			# if (size == 0) it's reserved
-	cmpi.b	 	%d0,&2
+	cmpi.b		%d0,&2
 	blt.b		no_bd
 	beq.b		get_word_bd
 
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long
-	
+
 	tst.l		%d1			# ifetch error?
 	bne.l		isp_iacc		# yes
 
@@ -1533,16 +1533,16 @@
 	bne.l		isp_iacc		# yes
 
 	ext.l		%d0			# sign extend bd
-	
+
 chk_ind:
 	add.l		%d0,%d3			# base += bd
 no_bd:
 	bfextu		%d5{&30:&2},%d0		# is od suppressed?
 	beq.w		aii_bd
-	cmpi.b	 	%d0,&0x2
+	cmpi.b		%d0,&0x2
 	blt.b		null_od
 	beq.b		word_od
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long
@@ -1550,7 +1550,7 @@
 	tst.l		%d1			# ifetch error?
 	bne.l		isp_iacc		# yes
 
-	bra.b 		add_them
+	bra.b		add_them
 
 word_od:
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
@@ -1604,10 +1604,10 @@
 # must create an access error frame. here, we pass a skeleton fslw
 # and the failing address to the routine that creates the new frame.
 # FSLW:
-# 	read = true
-# 	size = longword
+#	read = true
+#	size = longword
 #	TM = data
-# 	software emulation error = true
+#	software emulation error = true
 calc_ea_err:
 	mov.l		%d3,%a0			# pass failing address
 	mov.l		&0x01010001,%d0		# pass fslw
@@ -1615,7 +1615,7 @@
 
 #########################################################################
 # XDEF **************************************************************** #
-# 	_moveperipheral(): routine to emulate movep instruction		#
+#	_moveperipheral(): routine to emulate movep instruction		#
 #									#
 # XREF **************************************************************** #
 #	_dmem_read_byte() - read byte from memory			#
@@ -1647,7 +1647,7 @@
 # movep.(w,l)	Dx,(d,Ay) #
 # movep.(w,l)	(d,Ay),Dx #
 ###########################
-	global 		_moveperipheral
+	global		_moveperipheral
 _moveperipheral:
 	mov.w		EXC_OPWORD(%a6),%d1	# fetch the opcode word
 
@@ -1793,11 +1793,11 @@
 	mov.b		EXC_OPWORD(%a6),%d1
 	lsr.b		&0x1,%d1
 	and.w		&0x7,%d1		# extract Dx from opcode word
-	
+
 	mov.l		%d2,(EXC_DREGS,%a6,%d1.w*4) # store dx
 
 	rts
-	
+
 # a0 = dst addr
 m2rwtrans:
 	mov.l		%a0,%a2			# store addr
@@ -1823,7 +1823,7 @@
 	mov.b		EXC_OPWORD(%a6),%d1
 	lsr.b		&0x1,%d1
 	and.w		&0x7,%d1		# extract Dx from opcode word
-	
+
 	mov.w		%d2,(EXC_DREGS+2,%a6,%d1.w*4) # store dx
 
 	rts
@@ -1832,7 +1832,7 @@
 # must create an access error frame. here, we pass a skeleton fslw
 # and the failing address to the routine that creates the new frame.
 # FSLW:
-# 	write = true
+#	write = true
 #	size = byte
 #	TM = data
 #	software emulation error = true
@@ -1842,7 +1842,7 @@
 	bra.l		isp_dacc
 
 # FSLW:
-# 	read = true
+#	read = true
 #	size = byte
 #	TM = data
 #	software emulation error = true
@@ -1853,12 +1853,12 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	_chk2_cmp2(): routine to emulate chk2/cmp2 instructions		#
+#	_chk2_cmp2(): routine to emulate chk2/cmp2 instructions		#
 #									#
 # XREF ****************************************************************	#
 #	_calc_ea(): calculate effective address				#
 #	_dmem_read_long(): read operands				#
-# 	_dmem_read_word(): read operands				#
+#	_dmem_read_word(): read operands				#
 #	isp_dacc(): handle data access error exception			#
 #									#
 # INPUT ***************************************************************	#
@@ -1869,25 +1869,25 @@
 #		a0 = failing address					#
 #		d0 = FSLW						#
 #	else								#
-# 		none							#
+#		none							#
 #									#
 # ALGORITHM ***********************************************************	#
 #	First, calculate the effective address, then fetch the byte,	#
-# word, or longword sized operands. Then, in the interest of 		#
-# simplicity, all operands are converted to longword size whether the 	#
-# operation is byte, word, or long. The bounds are sign extended 	#
-# accordingly. If Rn is a data regsiter, Rn is also sign extended. If 	#
-# Rn is an address register, it need not be sign extended since the 	#
+# word, or longword sized operands. Then, in the interest of		#
+# simplicity, all operands are converted to longword size whether the	#
+# operation is byte, word, or long. The bounds are sign extended	#
+# accordingly. If Rn is a data regsiter, Rn is also sign extended. If	#
+# Rn is an address register, it need not be sign extended since the	#
 # full register is always used.						#
 #	The comparisons are made and the condition codes calculated.	#
 # If the instruction is chk2 and the Rn value is out-of-bounds, set	#
 # the ichk_flg in SPCOND_FLG.						#
-#	If the memory fetch returns a failing value, pass the failing 	#
+#	If the memory fetch returns a failing value, pass the failing	#
 # address and FSLW to the isp_dacc() routine.				#
 #									#
 #########################################################################
 
-	global 		_chk2_cmp2
+	global		_chk2_cmp2
 _chk2_cmp2:
 
 # passing size parameter doesn't matter since chk2 & cmp2 can't do
@@ -1974,7 +1974,7 @@
 
 #
 # To set the ccodes correctly:
-# 	(1) save 'Z' bit from (Rn - lo)
+#	(1) save 'Z' bit from (Rn - lo)
 #	(2) save 'Z' and 'N' bits from ((hi - lo) - (Rn - hi))
 #	(3) keep 'X', 'N', and 'V' from before instruction
 #	(4) combine ccodes
@@ -1984,7 +1984,7 @@
 	mov.w		%cc, %d3		# fetch resulting ccodes
 	andi.b		&0x4, %d3		# keep 'Z' bit
 	sub.l		%d0, %d1		# (hi - lo)
-	cmp.l	 	%d1,%d2			# ((hi - lo) - (Rn - hi))
+	cmp.l		%d1,%d2			# ((hi - lo) - (Rn - hi))
 
 	mov.w		%cc, %d4		# fetch resulting ccodes
 	or.b		%d4, %d3		# combine w/ earlier ccodes
@@ -2003,7 +2003,7 @@
 # this code handles the only difference between chk2 and cmp2. chk2 would
 # have trapped out if the value was out of bounds. we check this by seeing
 # if the 'N' bit was set by the operation.
-chk2_finish:	
+chk2_finish:
 	btst		&0x0, %d4		# is 'N' bit set?
 	bne.b		chk2_trap		# yes;chk2 should trap
 	rts
@@ -2018,7 +2018,7 @@
 #	read = true
 #	size = longword
 #	TM = data
-# 	software emulation error = true
+#	software emulation error = true
 chk2_cmp2_err_l:
 	mov.l		%a2,%a0			# pass failing address
 	mov.l		&0x01010001,%d0		# pass fslw
@@ -2028,7 +2028,7 @@
 #	read = true
 #	size = word
 #	TM = data
-# 	software emulation error = true
+#	software emulation error = true
 chk2_cmp2_err_w:
 	mov.l		%a2,%a0			# pass failing address
 	mov.l		&0x01410001,%d0		# pass fslw
@@ -2036,12 +2036,12 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	_div64(): routine to emulate div{u,s}.l <ea>,Dr:Dq		#
+#	_div64(): routine to emulate div{u,s}.l <ea>,Dr:Dq		#
 #							64/32->32r:32q	#
 #									#
 # XREF ****************************************************************	#
 #	_calc_ea() - calculate effective address			#
-# 	isp_iacc() - handle instruction access error exception		#
+#	isp_iacc() - handle instruction access error exception		#
 #	isp_dacc() - handle data access error exception			#
 #	isp_restore() - restore An on access error w/ -() or ()+	#
 #									#
@@ -2049,24 +2049,24 @@
 #	none								#
 #									#
 # OUTPUT **************************************************************	#
-# 	If exiting through isp_dacc...					#
+#	If exiting through isp_dacc...					#
 #		a0 = failing address					#
-# 		d0 = FSLW						#
+#		d0 = FSLW						#
 #	else								#
 #		none							#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	First, decode the operand location. If it's in Dn, fetch from	#
-# the stack. If it's in memory, use _calc_ea() to calculate the 	#
+#	First, decode the operand location. If it's in Dn, fetch from	#
+# the stack. If it's in memory, use _calc_ea() to calculate the		#
 # effective address. Use _dmem_read_long() to fetch at that address.	#
 # Unless the operand is immediate data. Then use _imem_read_long().	#
 # Send failures to isp_dacc() or isp_iacc() as appropriate.		#
-#	If the operands are signed, make them unsigned and save	the 	#
+#	If the operands are signed, make them unsigned and save	the	#
 # sign info for later. Separate out special cases like divide-by-zero	#
 # or 32-bit divides if possible. Else, use a special math algorithm	#
-# to calculate the result. 						#
-#	Restore sign info if signed instruction. Set the condition 	#
-# codes. Set idbyz_flg in SPCOND_FLG if divisor was zero. Store the 	#
+# to calculate the result.						#
+#	Restore sign info if signed instruction. Set the condition	#
+# codes. Set idbyz_flg in SPCOND_FLG if divisor was zero. Store the	#
 # quotient and remainder in the appropriate data registers on the stack.#
 #									#
 #########################################################################
@@ -2131,7 +2131,7 @@
 	negx.l		%d5
 
 # extract some special cases:
-# 	- is (dividend == 0) ?
+#	- is (dividend == 0) ?
 #	- is (hi(dividend) == 0 && (divisor <= lo(dividend))) ? (32-bit div)
 dspecialcases:
 	tst.l		%d5			# is (hi(dividend) == 0)
@@ -2140,7 +2140,7 @@
 	tst.l		%d6			# is (lo(dividend) == 0), too
 	beq.w		ddone			# yes, so (dividend == 0)
 
-	cmp.l	 	%d7,%d6			# is (divisor <= lo(dividend))
+	cmp.l		%d7,%d6			# is (divisor <= lo(dividend))
 	bls.b		d32bitdivide		# yes, so use 32 bit divide
 
 	exg		%d5,%d6			# q = 0, r = dividend
@@ -2153,7 +2153,7 @@
 
 dnormaldivide:
 # last special case:
-# 	- is hi(dividend) >= divisor ? if yes, then overflow
+#	- is hi(dividend) >= divisor ? if yes, then overflow
 	cmp.l		%d7,%d5
 	bls.b		ddovf			# answer won't fit in 32 bits
 
@@ -2166,7 +2166,7 @@
 	beq.b		ddone			# divu has no processing!!!
 
 # it was a divs.l, so ccode setting is a little more complicated...
-	tst.b		NDIVIDEND(%a6)		# remainder has same sign 
+	tst.b		NDIVIDEND(%a6)		# remainder has same sign
 	beq.b		dcc			# as dividend.
 	neg.l		%d5			# sgn(rem) = sgn(dividend)
 dcc:
@@ -2194,7 +2194,7 @@
 	mov.w		%cc, EXC_CC(%a6)
 
 	mov.w		NDRSAVE(%a6), %d0	# get Dr off stack
-	mov.w		NDQSAVE(%a6), %d1	# get Dq off stack	
+	mov.w		NDQSAVE(%a6), %d1	# get Dq off stack
 
 # if the register numbers are the same, only the quotient gets saved.
 # so, if we always save the quotient second, we save ourselves a cmp&beq
@@ -2221,8 +2221,8 @@
 # For this implementation b=2**16, and the target is U1U2U3U4/V1V2,	#
 # where U,V are words of the quadword dividend and longword divisor,	#
 # and U1, V1 are the most significant words.				#
-# 									#
-# The most sig. longword of the 64 bit dividend must be in %d5, least 	#
+#									#
+# The most sig. longword of the 64 bit dividend must be in %d5, least	#
 # in %d6. The divisor must be in the variable ddivisor, and the		#
 # signed/unsigned flag ddusign must be set (0=unsigned,1=signed).	#
 # The quotient is returned in %d6, remainder in %d5, unless the		#
@@ -2242,7 +2242,7 @@
 # dividing the divisor word into each dividend word. In this case,
 # the first two quotient words must be zero, or overflow would occur.
 # Since we already checked this case above, we can treat the most significant
-# longword of the dividend as (0) remainder (see Knuth) and merely complete 
+# longword of the dividend as (0) remainder (see Knuth) and merely complete
 # the last two divisions to get a quotient longword and word remainder:
 
 	clr.l		%d1
@@ -2278,12 +2278,12 @@
 	clr.b		DDSECOND(%a6)		# clear flag for quotient digits
 	clr.l		%d1			# %d1 will hold trial quotient
 ddnchk:
-	btst		&31, %d7		# must we normalize? first word of 
+	btst		&31, %d7		# must we normalize? first word of
 	bne.b		ddnormalized		# divisor (V1) must be >= 65536/2
 	addq.l		&0x1, DDNORMAL(%a6)	# count normalization shifts
 	lsl.l		&0x1, %d7		# shift the divisor
 	lsl.l		&0x1, %d6		# shift u4,u3 with overflow to u2
-	roxl.l		&0x1, %d5		# shift u1,u2 
+	roxl.l		&0x1, %d5		# shift u1,u2
 	bra.w		ddnchk
 ddnormalized:
 
@@ -2293,12 +2293,12 @@
 	mov.l		%d5, %d2		# dividend mslw
 	swap		%d2
 	swap		%d3
-	cmp.w	 	%d2, %d3		# V1 = U1 ?
+	cmp.w		%d2, %d3		# V1 = U1 ?
 	bne.b		ddqcalc1
 	mov.w		&0xffff, %d1		# use max trial quotient word
 	bra.b		ddadj0
 ddqcalc1:
-	mov.l		%d5, %d1		
+	mov.l		%d5, %d1
 
 	divu.w		%d3, %d1		# use quotient of mslw/msw
 
@@ -2329,7 +2329,7 @@
 
 #	add.l		%d6, %d4		# (U1U2 - V1q) + U3
 
-	cmp.l	 	%d2, %d4
+	cmp.l		%d2, %d4
 	bls.b		ddadjd1			# is V2q > (U1U2-V1q) + U3 ?
 	subq.l		&0x1, %d1		# yes, decrement and recheck
 	bra.b		ddadj1
@@ -2366,7 +2366,7 @@
 	tst.b		DDSECOND(%a6)		# both q words done?
 	bne.b		ddremain
 # first quotient digit now correct. store digit and shift the
-# (subtracted) dividend 
+# (subtracted) dividend
 	mov.w		%d1, DDQUOTIENT(%a6)
 	clr.l		%d1
 	swap		%d5
@@ -2377,7 +2377,7 @@
 	bra.w		ddnormalized
 ddremain:
 # add 2nd word to quotient, get the remainder.
-	mov.w 		%d1, DDQUOTIENT+2(%a6)
+	mov.w		%d1, DDQUOTIENT+2(%a6)
 # shift down one word/digit to renormalize remainder.
 	mov.w		%d5, %d6
 	swap		%d6
@@ -2391,7 +2391,7 @@
 	dbf		%d7, ddnlp
 ddrn:
 	mov.l		%d6, %d5		# remainder
-	mov.l		DDQUOTIENT(%a6), %d6 	# quotient
+	mov.l		DDQUOTIENT(%a6), %d6	# quotient
 
 	rts
 dmm2:
@@ -2421,7 +2421,7 @@
 	clr.w		%d2			# lsw of two mixed products used,
 	swap		%d5			# now use msws of longwords
 	swap		%d2
-	add.l		%d2, %d5				
+	add.l		%d2, %d5
 	add.l		%d3, %d5		# %d5 now ms 32 bits of final product
 	rts
 
@@ -2463,10 +2463,10 @@
 # also, we call isp_restore in case the effective addressing mode was
 # (an)+ or -(an) in which case the previous "an" value must be restored.
 # FSLW:
-# 	read = true
-# 	size = longword
+#	read = true
+#	size = longword
 #	TM = data
-# 	software emulation error = true
+#	software emulation error = true
 div64_err:
 	bsr.l		isp_restore		# restore addr reg
 	mov.l		%a2,%a0			# pass failing address
@@ -2480,17 +2480,17 @@
 # XREF ****************************************************************	#
 #	_calc_ea() - calculate effective address			#
 #	isp_iacc() - handle instruction access error exception		#
-# 	isp_dacc() - handle data access error exception			#
+#	isp_dacc() - handle data access error exception			#
 #	isp_restore() - restore An on access error w/ -() or ()+	#
 #									#
 # INPUT ***************************************************************	#
 #	none								#
 #									#
 # OUTPUT **************************************************************	#
-# 	If exiting through isp_dacc...					#
+#	If exiting through isp_dacc...					#
 #		a0 = failing address					#
 #		d0 = FSLW						#
-# 	else								#
+#	else								#
 #		none							#
 #									#
 # ALGORITHM ***********************************************************	#
@@ -2499,9 +2499,9 @@
 # effective address. Use _dmem_read_long() to fetch at that address.	#
 # Unless the operand is immediate data. Then use _imem_read_long().	#
 # Send failures to isp_dacc() or isp_iacc() as appropriate.		#
-#	If the operands are signed, make them unsigned and save the 	#
+#	If the operands are signed, make them unsigned and save the	#
 # sign info for later. Perform the multiplication using 16x16->32	#
-# unsigned multiplies and "add" instructions. Store the high and low 	#
+# unsigned multiplies and "add" instructions. Store the high and low	#
 # portions of the result in the appropriate data registers on the	#
 # stack. Calculate the condition codes, also.				#
 #									#
@@ -2554,15 +2554,15 @@
 # the result sign is the exclusive or of the operand sign bits.
 mul64_chk_md_sgn:
 	tst.l		%d4			# is multiplicand negative?
-	bge.b		mul64_alg		# no	
+	bge.b		mul64_alg		# no
 	neg.l		%d4			# make multiplicand positive
 	eori.b		&0x1, EXC_TEMP(%a6)	# calculate correct sign
 
 #########################################################################
 #	63			   32				0	#
-# 	----------------------------					#
-# 	| hi(mplier) * hi(mplicand)|					#
-# 	----------------------------					#
+#	----------------------------					#
+#	| hi(mplier) * hi(mplicand)|					#
+#	----------------------------					#
 #		     -----------------------------			#
 #		     | hi(mplier) * lo(mplicand) |			#
 #		     -----------------------------			#
@@ -2639,7 +2639,7 @@
 	andi.b		&0x8, %d7		# extract 'N' bit
 
 mul64_ccode_set:
-	mov.b		EXC_CC+1(%a6), %d6 	# fetch previous %ccr
+	mov.b		EXC_CC+1(%a6), %d6	# fetch previous %ccr
 	andi.b		&0x10, %d6		# all but 'X' bit changes
 
 	or.b		%d7, %d6		# group 'X' and 'N'
@@ -2698,10 +2698,10 @@
 # also, we call isp_restore in case the effective addressing mode was
 # (an)+ or -(an) in which case the previous "an" value must be restored.
 # FSLW:
-# 	read = true
-# 	size = longword
+#	read = true
+#	size = longword
 #	TM = data
-# 	software emulation error = true
+#	software emulation error = true
 mul64_err:
 	bsr.l		isp_restore		# restore addr reg
 	mov.l		%a2,%a0			# pass failing address
@@ -2728,7 +2728,7 @@
 #									#
 # _isp_cas2_finish():							#
 #	see cas2 core emulation code					#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 # _compandset2():							#
 #	see cas2 core emulation code					#
@@ -2744,7 +2744,7 @@
 # pages from being paged out. If either _real_lock_page() fails, exit	#
 # through _cas_terminate2(). Don't forget to unlock the 1st locked page	#
 # using _real_unlock_paged() if the 2nd lock-page fails.		#
-# Finally, branch to the core cas2 emulation code by calling the 	#
+# Finally, branch to the core cas2 emulation code by calling the	#
 # "callout" _real_cas2().						#
 #									#
 # _isp_cas2_finish():							#
@@ -2793,7 +2793,7 @@
 	lsr.w		&0x6,%d1
 	andi.w		&0x7,%d1		# extract Du1
 	mov.l		(EXC_DREGS,%a6,%d1.w*4),%d4 # fetch Update1 Op
-	
+
 	andi.w		&0x7,%d0		# extract Dc1
 	mov.l		(EXC_DREGS,%a6,%d0.w*4),%d2 # fetch Compare1 Op
 	mov.w		%d0,DC1(%a6)
@@ -2827,7 +2827,7 @@
 
 	bra.l		_real_cas2
 
-# if the 2nd lock attempt fails, then we must still unlock the 
+# if the 2nd lock attempt fails, then we must still unlock the
 # first page(s).
 cas_preterm:
 	mov.l		%d0,-(%sp)		# save FSLW
@@ -2869,7 +2869,7 @@
 	sf		%d1			# pass size
 	mov.l		ADDR1(%a6),%a0		# pass ADDR1
 	bsr.l		_real_unlock_page	# unlock page
-	
+
 	mov.l		%d2,%d0			# pass mode
 	sf		%d1			# pass size
 	mov.l		ADDR2(%a6),%a0		# pass ADDR2
@@ -2900,7 +2900,7 @@
 	st		%d1			# pass size
 	mov.l		ADDR1(%a6),%a0		# pass ADDR1
 	bsr.l		_real_unlock_page	# unlock page
-	
+
 	mov.l		%d2,%d0			# pass mode
 	st		%d1			# pass size
 	mov.l		ADDR2(%a6),%a0		# pass ADDR2
@@ -2928,11 +2928,11 @@
 #			    (external to package)			#
 #									#
 # XREF ****************************************************************	#
-# 	_calc_ea(): calculate effective address				#
+#	_calc_ea(): calculate effective address				#
 #									#
 # INPUT ***************************************************************	#
 # compandset():								#
-# 	none								#
+#	none								#
 # _isp_cas_restart():							#
 #	d6 = previous sfc/dfc						#
 # _isp_cas_finish():							#
@@ -2959,10 +2959,10 @@
 # ALGORITHM ***********************************************************	#
 #									#
 # compandset():								#
-#	First, calculate the effective address. Then, decode the 	#
+#	First, calculate the effective address. Then, decode the	#
 # instruction word and fetch the "compare" (DC) and "update" (Du)	#
 # operands.								#
-# 	Next, call the external routine _real_lock_page() so that the	#
+#	Next, call the external routine _real_lock_page() so that the	#
 # operating system can keep this page from being paged out while we're	#
 # in this routine. If this call fails, jump to _cas_terminate2().	#
 #	The routine then branches to _real_cas(). This external routine	#
@@ -2971,7 +2971,7 @@
 # this purpose.								#
 #									#
 # _isp_cas_finish():							#
-# 	Either way, after emulation, the package is re-entered at	#
+#	Either way, after emulation, the package is re-entered at	#
 # _isp_cas_finish(). This routine re-compares the operands in order to	#
 # set the condition codes. Finally, these routines will call		#
 # _real_unlock_page() in order to unlock the pages that were previously	#
@@ -2984,13 +2984,13 @@
 # _isp_cas_terminate():							#
 #	This routine can be entered from an access error handler where	#
 # an emulation operand access failed and the operating system would	#
-# like an access error stack frame created instead of the current 	#
+# like an access error stack frame created instead of the current	#
 # unimplemented integer instruction frame.				#
-# 	Also, the package enters here if a call to _real_lock_page()	#
+#	Also, the package enters here if a call to _real_lock_page()	#
 # fails.								#
 #									#
 # _isp_cas_inrange():							#
-# 	Checks to see whether the instruction address passed to it in	#
+#	Checks to see whether the instruction address passed to it in	#
 # a0 is within the software package cas/cas2 emulation routines. This	#
 # can be helpful for an operating system to determine whether an access	#
 # error during emulation was due to a cas/cas2 emulation access.	#
@@ -3003,18 +3003,18 @@
 	global		_compandset
 _compandset:
 	btst		&0x1,EXC_OPWORD(%a6)	# word or long operation?
-	bne.b		compandsetl		# long	
+	bne.b		compandsetl		# long
 
 compandsetw:
 	movq.l		&0x2,%d0		# size = 2 bytes
-	bsr.l		_calc_ea		# a0 = calculated <ea>	
+	bsr.l		_calc_ea		# a0 = calculated <ea>
 	mov.l		%a0,ADDR(%a6)		# save <ea> for possible restart
 	sf		%d7			# clear d7 for word size
 	bra.b		compandsetfetch
 
 compandsetl:
 	movq.l		&0x4,%d0		# size = 4 bytes
-	bsr.l		_calc_ea		# a0 = calculated <ea>	
+	bsr.l		_calc_ea		# a0 = calculated <ea>
 	mov.l		%a0,ADDR(%a6)		# save <ea> for possible restart
 	st		%d7			# set d7 for longword size
 
@@ -3040,7 +3040,7 @@
 	tst.l		%d0			# did error occur?
 	bne.w		_cas_terminate2		# yes, clean up the mess
 	mov.l		%a2,%a0			# pass addr in a0
-	
+
 	bra.l		_real_cas
 
 ########
@@ -3053,7 +3053,7 @@
 # from the locked routine...
 cas_finish_w:
 	mov.w		EXC_CC(%a6),%cc		# restore cc
-	cmp.w	 	%d0,%d4			# do word compare
+	cmp.w		%d0,%d4			# do word compare
 	mov.w		%cc,EXC_CC(%a6)		# save cc
 
 	tst.b		%d1			# update compare reg?
@@ -3074,7 +3074,7 @@
 # from the locked routine...
 cas_finish_l:
 	mov.w		EXC_CC(%a6),%cc		# restore cc
-	cmp.l	 	%d0,%d4			# do longword compare
+	cmp.l		%d0,%d4			# do longword compare
 	mov.w		%cc,EXC_CC(%a6)		# save cc
 
 	tst.b		%d1			# update compare reg?
@@ -3092,7 +3092,7 @@
 	rts
 
 ########
-	
+
 	global		_isp_cas_restart
 _isp_cas_restart:
 	mov.l		%d6,%sfc		# restore previous sfc
@@ -3104,7 +3104,7 @@
 	mov.l		ADDR(%a6),%a0		# load <ea>
 	btst		&0x1,EXC_OPWORD(%a6)	# word or long operation?
 	sne		%d7			# set d7 accordingly
-	bra.w		compandsetfetch	
+	bra.w		compandsetfetch
 
 ########
 
@@ -3151,7 +3151,7 @@
 	cmp.l		%a0,%a1			# is PC in range?
 	blt.b		cin_no			# no
 	rts					# yes; return d0 = 0
-cin_no:	
+cin_no:
 	mov.l		&-0x1,%d0		# out of range; return d0 = -1
 	rts
 
@@ -3179,28 +3179,28 @@
 #									#
 # XREF ****************************************************************	#
 #	_isp_cas2_finish() - only exit point for this emulation code;	#
-#			     do clean-up; calculate ccodes; store 	#
+#			     do clean-up; calculate ccodes; store	#
 #			     Compare Ops if appropriate.		#
 #									#
 # INPUT ***************************************************************	#
 #	*see chart below*						#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	*see chart below*						#
 #									#
 # ALGORITHM ***********************************************************	#
 #	(1) Make several copies of the effective address.		#
 #	(2) Save current SR; Then mask off all maskable interrupts.	#
-#	(3) Save current SFC/DFC (ASSUMED TO BE EQUAL!!!); Then set 	#
-#	    according to whether exception occurred in user or 		#
+#	(3) Save current SFC/DFC (ASSUMED TO BE EQUAL!!!); Then set	#
+#	    according to whether exception occurred in user or		#
 #	    supervisor mode.						#
 #	(4) Use "plpaw" instruction to pre-load ATC with effective	#
 #	    address pages(s). THIS SHOULD NOT FAULT!!! The relevant	#
 #	    page(s) should have already been made resident prior to	#
-# 	    entering this routine.					#
-#	(5) Push the operand lines from the cache w/ "cpushl". 		#
+#	    entering this routine.					#
+#	(5) Push the operand lines from the cache w/ "cpushl".		#
 #	    In the 68040, this was done within the locked region. In	#
-# 	    the 68060, it is done outside of the locked region.		#
+#	    the 68060, it is done outside of the locked region.		#
 #	(6) Use "plpar" instruction to do a re-load of ATC entries for	#
 #	    ADDR1 since ADDR2 entries may have pushed ADDR1 out of the	#
 #	    ATC.							#
@@ -3214,19 +3214,19 @@
 #	    back to itself (as w/ the '040) so we can gracefully unlock	#
 #	    the bus (and assert LOCKE*) using BUSCR and the final move.	#
 #	(12)Exit.							#
-#	(13)Write update operand to the DST locations. Use BUSCR to 	#
+#	(13)Write update operand to the DST locations. Use BUSCR to	#
 #	    assert LOCKE* for the final write operation.		#
 #	(14)Exit.							#
 #									#
-# 	The algorithm is actually implemented slightly differently	#
-# depending on the size of the operation and the misalignment of the 	#
+#	The algorithm is actually implemented slightly differently	#
+# depending on the size of the operation and the misalignment of the	#
 # operands. A misaligned operand must be written in aligned chunks or	#
 # else the BUSCR register control gets confused.			#
 #									#
 #########################################################################
 
 #################################################################
-# THIS IS THE STATE OF THE INTEGER REGISTER FILE UPON		# 
+# THIS IS THE STATE OF THE INTEGER REGISTER FILE UPON		#
 # ENTERING _isp_cas2().						#
 #								#
 # D0 = xxxxxxxx							#
@@ -3236,7 +3236,7 @@
 # D4 = update oper 1						#
 # D5 = update oper 2						#
 # D6 = 'xxxxxxff if supervisor mode; 'xxxxxx00 if user mode	#
-# D7 = 'xxxxxxff if longword operation; 'xxxxxx00 if word 	#
+# D7 = 'xxxxxxff if longword operation; 'xxxxxx00 if word	#
 # A0 = ADDR1							#
 # A1 = ADDR2							#
 # A2 = xxxxxxxx							#
@@ -3339,22 +3339,22 @@
 # A4 = bus unlock value
 # A5 = xxxxxxxx
 #
-	align 		0x10
+	align		0x10
 CAS2L_START:
 	movc		%a2,%buscr		# assert LOCK*
 	movs.l		(%a1),%d1		# fetch Dest2[31:0]
 	movs.l		(%a0),%d0		# fetch Dest1[31:0]
-	bra.b 		CAS2L_CONT
+	bra.b		CAS2L_CONT
 CAS2L_ENTER:
 	bra.b		~+16
 
 CAS2L_CONT:
-	cmp.l	 	%d0,%d2			# Dest1 - Compare1
+	cmp.l		%d0,%d2			# Dest1 - Compare1
 	bne.b		CAS2L_NOUPDATE
-	cmp.l	 	%d1,%d3			# Dest2 - Compare2
+	cmp.l		%d1,%d3			# Dest2 - Compare2
 	bne.b		CAS2L_NOUPDATE
 	movs.l		%d5,(%a1)		# Update2[31:0] -> DEST2
-	bra.b 		CAS2L_UPDATE
+	bra.b		CAS2L_UPDATE
 	bra.b		~+16
 
 CAS2L_UPDATE:
@@ -3384,7 +3384,7 @@
 ####
 
 #################################################################
-# THIS MUST BE THE STATE OF THE INTEGER REGISTER FILE UPON	# 
+# THIS MUST BE THE STATE OF THE INTEGER REGISTER FILE UPON	#
 # ENTERING _isp_cas2().						#
 #								#
 # D0 = destination[31:0] operand 1				#
@@ -3430,22 +3430,22 @@
 	bra.l		_isp_cas2_finish
 ####
 
-	align 		0x10
+	align		0x10
 CAS2L2_START:
 	movc		%a2,%buscr		# assert LOCK*
 	movs.l		(%a1),%d1		# fetch Dest2[31:0]
 	movs.l		(%a0),%d0		# fetch Dest1[31:0]
-	bra.b 		CAS2L2_CONT
+	bra.b		CAS2L2_CONT
 CAS2L2_ENTER:
 	bra.b		~+16
 
 CAS2L2_CONT:
-	cmp.l	 	%d0,%d2			# Dest1 - Compare1
+	cmp.l		%d0,%d2			# Dest1 - Compare1
 	bne.b		CAS2L2_NOUPDATE
-	cmp.l	 	%d1,%d3			# Dest2 - Compare2
+	cmp.l		%d1,%d3			# Dest2 - Compare2
 	bne.b		CAS2L2_NOUPDATE
 	movs.l		%d5,(%a1)		# Update2[31:0] -> Dest2
-	bra.b 		CAS2L2_UPDATE
+	bra.b		CAS2L2_UPDATE
 	bra.b		~+16
 
 CAS2L2_UPDATE:
@@ -3490,22 +3490,22 @@
 
 #################################
 
-	align 		0x10
+	align		0x10
 CAS2L3_START:
 	movc		%a2,%buscr		# assert LOCK*
 	movs.l		(%a1),%d1		# fetch Dest2[31:0]
 	movs.l		(%a0),%d0		# fetch Dest1[31:0]
-	bra.b 		CAS2L3_CONT
+	bra.b		CAS2L3_CONT
 CAS2L3_ENTER:
 	bra.b		~+16
 
 CAS2L3_CONT:
-	cmp.l	 	%d0,%d2			# Dest1 - Compare1
+	cmp.l		%d0,%d2			# Dest1 - Compare1
 	bne.b		CAS2L3_NOUPDATE
-	cmp.l	 	%d1,%d3			# Dest2 - Compare2
+	cmp.l		%d1,%d3			# Dest2 - Compare2
 	bne.b		CAS2L3_NOUPDATE
 	movs.l		%d5,(%a1)		# Update2[31:0] -> DEST2
-	bra.b 		CAS2L3_UPDATE
+	bra.b		CAS2L3_UPDATE
 	bra.b		~+16
 
 CAS2L3_UPDATE:
@@ -3531,7 +3531,7 @@
 	nop
 	nop
 	bra.b		~+16
-	
+
 CAS2L3_NOUPDATE:
 	rol.l		&0x8,%d0		# get Dest1[31:24]
 	movs.b		%d0,(%a0)+		# Dest1[31:24] -> DEST1
@@ -3639,22 +3639,22 @@
 # A4 = bus unlock value
 # A5 = xxxxxxxx
 #
-	align 		0x10
+	align		0x10
 CAS2W_START:
 	movc		%a2,%buscr		# assert LOCK*
 	movs.w		(%a1),%d1		# fetch Dest2[15:0]
 	movs.w		(%a0),%d0		# fetch Dest1[15:0]
-	bra.b 		CAS2W_CONT2
+	bra.b		CAS2W_CONT2
 CAS2W_ENTER:
 	bra.b		~+16
 
 CAS2W_CONT2:
-	cmp.w	 	%d0,%d2			# Dest1 - Compare1
+	cmp.w		%d0,%d2			# Dest1 - Compare1
 	bne.b		CAS2W_NOUPDATE
-	cmp.w	 	%d1,%d3			# Dest2 - Compare2
+	cmp.w		%d1,%d3			# Dest2 - Compare2
 	bne.b		CAS2W_NOUPDATE
 	movs.w		%d5,(%a1)		# Update2[15:0] -> DEST2
-	bra.b 		CAS2W_UPDATE
+	bra.b		CAS2W_UPDATE
 	bra.b		~+16
 
 CAS2W_UPDATE:
@@ -3684,7 +3684,7 @@
 ####
 
 #################################################################
-# THIS MUST BE THE STATE OF THE INTEGER REGISTER FILE UPON	# 
+# THIS MUST BE THE STATE OF THE INTEGER REGISTER FILE UPON	#
 # ENTERING _isp_cas2().						#
 #								#
 # D0 = destination[15:0] operand 1				#
@@ -3730,22 +3730,22 @@
 	bra.l		_isp_cas2_finish
 ####
 
-	align 		0x10
+	align		0x10
 CAS2W2_START:
 	movc		%a2,%buscr		# assert LOCK*
 	movs.w		(%a1),%d1		# fetch Dest2[15:0]
 	movs.w		(%a0),%d0		# fetch Dest1[15:0]
-	bra.b 		CAS2W2_CONT2
+	bra.b		CAS2W2_CONT2
 CAS2W2_ENTER:
 	bra.b		~+16
 
 CAS2W2_CONT2:
-	cmp.w	 	%d0,%d2			# Dest1 - Compare1
+	cmp.w		%d0,%d2			# Dest1 - Compare1
 	bne.b		CAS2W2_NOUPDATE
-	cmp.w	 	%d1,%d3			# Dest2 - Compare2
+	cmp.w		%d1,%d3			# Dest2 - Compare2
 	bne.b		CAS2W2_NOUPDATE
 	movs.w		%d5,(%a1)		# Update2[15:0] -> DEST2
-	bra.b 		CAS2W2_UPDATE
+	bra.b		CAS2W2_UPDATE
 	bra.b		~+16
 
 CAS2W2_UPDATE:
@@ -3789,34 +3789,34 @@
 	bra.b		CAS2W2_START
 
 #       ######      ##      ######
-#       #	   #  #     #     
+#       #	   #  #     #
 #	#	  ######    ######
 #	#	  #    #         #
 #       ######    #    #    ######
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	_isp_cas(): "core" emulation code for the cas instruction	#
+#	_isp_cas(): "core" emulation code for the cas instruction	#
 #									#
 # XREF ****************************************************************	#
 #	_isp_cas_finish() - only exit point for this emulation code;	#
 #			    do clean-up					#
 #									#
 # INPUT ***************************************************************	#
-# 	*see entry chart below*						#
+#	*see entry chart below*						#
 #									#
 # OUTPUT **************************************************************	#
 #	*see exit chart below*						#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	(1) Make several copies of the effective address. 		#
-# 	(2) Save current SR; Then mask off all maskable interrupts.	#
+#	(1) Make several copies of the effective address.		#
+#	(2) Save current SR; Then mask off all maskable interrupts.	#
 #	(3) Save current DFC/SFC (ASSUMED TO BE EQUAL!!!); Then set	#
 #	    SFC/DFC according to whether exception occurred in user or	#
 #	    supervisor mode.						#
 #	(4) Use "plpaw" instruction to pre-load ATC with efective	#
 #	    address page(s). THIS SHOULD NOT FAULT!!! The relevant	#
-# 	    page(s) should have been made resident prior to entering 	#
+#	    page(s) should have been made resident prior to entering	#
 #	    this routine.						#
 #	(5) Push the operand lines from the cache w/ "cpushl".		#
 #	    In the 68040, this was done within the locked region. In	#
@@ -3834,8 +3834,8 @@
 #	(12)Write update operand to the DST location. Use BUSCR to	#
 #	    assert LOCKE* for the final write operation.		#
 #	(13)Exit.							#
-# 									#
-# 	The algorithm is actually implemented slightly differently	#
+#									#
+#	The algorithm is actually implemented slightly differently	#
 # depending on the size of the operation and the misalignment of the	#
 # operand. A misaligned operand must be written in aligned chunks or	#
 # else the BUSCR register control gets confused.			#
@@ -3934,9 +3934,9 @@
 CASW_START:
 	movc		%a1,%buscr		# assert LOCK*
 	movs.w		(%a0),%d0		# fetch Dest[15:0]
-	cmp.w	 	%d0,%d4			# Dest - Compare
+	cmp.w		%d0,%d4			# Dest - Compare
 	bne.b		CASW_NOUPDATE
-	bra.b 		CASW_UPDATE
+	bra.b		CASW_UPDATE
 CASW_ENTER:
 	bra.b		~+16
 
@@ -3961,7 +3961,7 @@
 	movs.b		%d0,(%a0)+		# Dest[15:8] -> DEST
 	movc		%a2,%buscr		# assert LOCKE*
 	rol.l		&0x8,%d0		# get Dest[7:0]
-	bra.b 		CASW_NOUPDATE2
+	bra.b		CASW_NOUPDATE2
 	bra.b		~+16
 
 CASW_NOUPDATE2:
@@ -4090,9 +4090,9 @@
 CASL_START:
 	movc		%a1,%buscr		# assert LOCK*
 	movs.l		(%a0),%d0		# fetch Dest[31:0]
-	cmp.l	 	%d0,%d4			# Dest - Compare
+	cmp.l		%d0,%d4			# Dest - Compare
 	bne.b		CASL_NOUPDATE
-	bra.b 		CASL_UPDATE
+	bra.b		CASL_UPDATE
 CASL_ENTER:
 	bra.b		~+16
 
@@ -4117,7 +4117,7 @@
 	movs.w		%d0,(%a0)+		# Dest[31:16] -> DEST
 	swap		%d0			# get Dest[15:0]
 	movc		%a2,%buscr		# assert LOCKE*
-	bra.b 		CASL_NOUPDATE2
+	bra.b		CASL_NOUPDATE2
 	bra.b		~+16
 
 CASL_NOUPDATE2:
@@ -4214,7 +4214,7 @@
 	mov.l		&0xa0000000,%a2		# assert LOCKE* buscr value
 	mov.l		&0x00000000,%a3		# buscr unlock value
 
-# pre-load the instruction cache for the following algorithm. 
+# pre-load the instruction cache for the following algorithm.
 # this will minimize the number of cycles that LOCK* will be asserted.
 	bra.b		CASL2_ENTER		# start pre-loading icache
 
@@ -4238,9 +4238,9 @@
 CASL2_START:
 	movc		%a1,%buscr		# assert LOCK*
 	movs.l		(%a0),%d0		# fetch Dest[31:0]
-	cmp.l	 	%d0,%d4			# Dest - Compare
+	cmp.l		%d0,%d4			# Dest - Compare
 	bne.b		CASL2_NOUPDATE
-	bra.b 		CASL2_UPDATE
+	bra.b		CASL2_UPDATE
 CASL2_ENTER:
 	bra.b		~+16
 
@@ -4263,14 +4263,14 @@
 	movs.b		%d0,(%a0)+		# Dest[31:24] -> DEST
 	swap		%d0			# get Dest[23:8]
 	movs.w		%d0,(%a0)+		# Dest[23:8] -> DEST+0x1
-	bra.b 		CASL2_NOUPDATE2
+	bra.b		CASL2_NOUPDATE2
 	bra.b		~+16
 
 CASL2_NOUPDATE2:
 	rol.l		&0x8,%d0		# get Dest[7:0]
 	movc		%a2,%buscr		# assert LOCKE*
 	movs.b		%d0,(%a0)		# Dest[7:0] -> DEST+0x3
-	bra.b 		CASL2_NOUPDATE3
+	bra.b		CASL2_NOUPDATE3
 	nop
 	bra.b		~+16
 
diff -Nru a/arch/m68k/ifpsp060/src/itest.S b/arch/m68k/ifpsp060/src/itest.S
--- a/arch/m68k/ifpsp060/src/itest.S	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/ifpsp060/src/itest.S	Tue Jun 15 22:20:37 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -453,8 +453,8 @@
 	bne.l	error
 
 #####################################################
-# movep.w	%d0,(0x0,%a0) 			    #
-# 	- this test has %cc initially equal to zero #
+# movep.w	%d0,(0x0,%a0)			    #
+#	- this test has %cc initially equal to zero #
 #####################################################
 movp_2:
 	addq.l	&0x1,TESTCTR(%a6)
diff -Nru a/arch/m68k/ifpsp060/src/pfpsp.S b/arch/m68k/ifpsp060/src/pfpsp.S
--- a/arch/m68k/ifpsp060/src/pfpsp.S	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/ifpsp060/src/pfpsp.S	Tue Jun 15 22:20:37 2004
@@ -5,10 +5,10 @@
 Production Release P1.00 -- October 10, 1994
 
 M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
- 
+
 THE SOFTWARE is provided on an "AS IS" basis and without warranty.
 To the maximum extent permitted by applicable law,
-MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 
+MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
 INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
 and any warranty against infringement with regard to the SOFTWARE
 (INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
@@ -89,7 +89,7 @@
 	bra.l		_fpsp_effadd
 	short		0x0000
 
-	space 		56
+	space		56
 
 ###############################################################
 	global		_fpsp_done
@@ -323,33 +323,33 @@
 set EXC_D1,		EXC_DREGS+(1*4)
 set EXC_D0,		EXC_DREGS+(0*4)
 
-set EXC_FP0, 		EXC_FPREGS+(0*12)	# offset of saved fp0
-set EXC_FP1, 		EXC_FPREGS+(1*12)	# offset of saved fp1
-set EXC_FP2, 		EXC_FPREGS+(2*12)	# offset of saved fp2 (not used)
+set EXC_FP0,		EXC_FPREGS+(0*12)	# offset of saved fp0
+set EXC_FP1,		EXC_FPREGS+(1*12)	# offset of saved fp1
+set EXC_FP2,		EXC_FPREGS+(2*12)	# offset of saved fp2 (not used)
 
-set FP_SCR1, 		LV+80			# fp scratch 1
-set FP_SCR1_EX, 	FP_SCR1+0
+set FP_SCR1,		LV+80			# fp scratch 1
+set FP_SCR1_EX,		FP_SCR1+0
 set FP_SCR1_SGN,	FP_SCR1+2
-set FP_SCR1_HI, 	FP_SCR1+4
-set FP_SCR1_LO, 	FP_SCR1+8
+set FP_SCR1_HI,		FP_SCR1+4
+set FP_SCR1_LO,		FP_SCR1+8
 
-set FP_SCR0, 		LV+68			# fp scratch 0
-set FP_SCR0_EX, 	FP_SCR0+0
+set FP_SCR0,		LV+68			# fp scratch 0
+set FP_SCR0_EX,		FP_SCR0+0
 set FP_SCR0_SGN,	FP_SCR0+2
-set FP_SCR0_HI, 	FP_SCR0+4
-set FP_SCR0_LO, 	FP_SCR0+8
+set FP_SCR0_HI,		FP_SCR0+4
+set FP_SCR0_LO,		FP_SCR0+8
 
-set FP_DST, 		LV+56			# fp destination operand
-set FP_DST_EX, 		FP_DST+0
+set FP_DST,		LV+56			# fp destination operand
+set FP_DST_EX,		FP_DST+0
 set FP_DST_SGN,		FP_DST+2
-set FP_DST_HI, 		FP_DST+4
-set FP_DST_LO, 		FP_DST+8
+set FP_DST_HI,		FP_DST+4
+set FP_DST_LO,		FP_DST+8
 
-set FP_SRC, 		LV+44			# fp source operand
-set FP_SRC_EX, 		FP_SRC+0
+set FP_SRC,		LV+44			# fp source operand
+set FP_SRC_EX,		FP_SRC+0
 set FP_SRC_SGN,		FP_SRC+2
-set FP_SRC_HI, 		FP_SRC+4
-set FP_SRC_LO, 		FP_SRC+8
+set FP_SRC_HI,		FP_SRC+4
+set FP_SRC_LO,		FP_SRC+8
 
 set USER_FPIAR,		LV+40			# FP instr address register
 
@@ -373,7 +373,7 @@
 set EXC_TEMP,		LV+16			# temporary space
 
 set DTAG,		LV+15			# destination operand type
-set STAG, 		LV+14			# source operand type
+set STAG,		LV+14			# source operand type
 
 set SPCOND_FLG,		LV+10			# flag: special case (see below)
 
@@ -388,17 +388,17 @@
 # Helpful macros
 
 set FTEMP,		0			# offsets within an
-set FTEMP_EX, 		0			# extended precision
+set FTEMP_EX,		0			# extended precision
 set FTEMP_SGN,		2			# value saved in memory.
-set FTEMP_HI, 		4
-set FTEMP_LO, 		8
+set FTEMP_HI,		4
+set FTEMP_LO,		8
 set FTEMP_GRS,		12
 
 set LOCAL,		0			# offsets within an
-set LOCAL_EX, 		0			# extended precision 
+set LOCAL_EX,		0			# extended precision
 set LOCAL_SGN,		2			# value saved in memory.
-set LOCAL_HI, 		4
-set LOCAL_LO, 		8
+set LOCAL_HI,		4
+set LOCAL_LO,		8
 set LOCAL_GRS,		12
 
 set DST,		0			# offsets within an
@@ -488,17 +488,17 @@
 ######################################
 set dzinf_mask,		inf_mask+dz_mask+adz_mask
 set opnan_mask,		nan_mask+operr_mask+aiop_mask
-set nzi_mask,		0x01ffffff 		#clears N, Z, and I
+set nzi_mask,		0x01ffffff		#clears N, Z, and I
 set unfinx_mask,	unfl_mask+inex2_mask+aunfl_mask+ainex_mask
 set unf2inx_mask,	unfl_mask+inex2_mask+ainex_mask
 set ovfinx_mask,	ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
 set inx1a_mask,		inex1_mask+ainex_mask
 set inx2a_mask,		inex2_mask+ainex_mask
-set snaniop_mask, 	nan_mask+snan_mask+aiop_mask
+set snaniop_mask,	nan_mask+snan_mask+aiop_mask
 set snaniop2_mask,	snan_mask+aiop_mask
 set naniop_mask,	nan_mask+aiop_mask
 set neginf_mask,	neg_mask+inf_mask
-set infaiop_mask, 	inf_mask+aiop_mask
+set infaiop_mask,	inf_mask+aiop_mask
 set negz_mask,		neg_mask+z_mask
 set opaop_mask,		operr_mask+aiop_mask
 set unfl_inx_mask,	unfl_mask+aunfl_mask+ainex_mask
@@ -527,8 +527,8 @@
 set mantissalen,	64			# length of mantissa in bits
 
 set BYTE,		1			# len(byte) == 1 byte
-set WORD, 		2			# len(word) == 2 bytes
-set LONG, 		4			# len(longword) == 2 bytes
+set WORD,		2			# len(word) == 2 bytes
+set LONG,		4			# len(longword) == 2 bytes
 
 set BSUN_VEC,		0xc0			# bsun    vector offset
 set INEX_VEC,		0xc4			# inexact vector offset
@@ -598,7 +598,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP Ovfl exception stack frame	#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	Overflow Exception enabled:					#
 #	- The system stack is unchanged					#
@@ -609,24 +609,24 @@
 #									#
 # ALGORITHM ***********************************************************	#
 #	On the 060, if an FP overflow is present as the result of any	#
-# instruction, the 060 will take an overflow exception whether the 	#
-# exception is enabled or disabled in the FPCR. For the disabled case, 	#
+# instruction, the 060 will take an overflow exception whether the	#
+# exception is enabled or disabled in the FPCR. For the disabled case,	#
 # This handler emulates the instruction to determine what the correct	#
 # default result should be for the operation. This default result is	#
-# then stored in either the FP regfile, data regfile, or memory. 	#
-# Finally, the handler exits through the "callout" _fpsp_done() 	#
+# then stored in either the FP regfile, data regfile, or memory.	#
+# Finally, the handler exits through the "callout" _fpsp_done()		#
 # denoting that no exceptional conditions exist within the machine.	#
-# 	If the exception is enabled, then this handler must create the	#
+#	If the exception is enabled, then this handler must create the	#
 # exceptional operand and plave it in the fsave state frame, and store	#
-# the default result (only if the instruction is opclass 3). For 	#
-# exceptions enabled, this handler must exit through the "callout" 	#
+# the default result (only if the instruction is opclass 3). For	#
+# exceptions enabled, this handler must exit through the "callout"	#
 # _real_ovfl() so that the operating system enabled overflow handler	#
 # can handle this case.							#
-#	Two other conditions exist. First, if overflow was disabled 	#
-# but the inexact exception was enabled, this handler must exit 	#
+#	Two other conditions exist. First, if overflow was disabled	#
+# but the inexact exception was enabled, this handler must exit		#
 # through the "callout" _real_inex() regardless of whether the result	#
 # was inexact.								#
-#	Also, in the case of an opclass three instruction where 	#
+#	Also, in the case of an opclass three instruction where		#
 # overflow was disabled and the trace exception was enabled, this	#
 # handler must exit through the "callout" _real_trace().		#
 #									#
@@ -641,9 +641,9 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
@@ -667,7 +667,7 @@
 	bsr.l		set_tag_x		# tag the operand type
 	mov.b		%d0,STAG(%a6)		# maybe NORM,DENORM
 
-# bit five of the fp extension word separates the monadic and dyadic operations 
+# bit five of the fp extension word separates the monadic and dyadic operations
 # that can pass through fpsp_ovfl(). remember that fcmp, ftst, and fsincos
 # will never take this exception.
 	btst		&0x5,1+EXC_CMDREG(%a6)	# is operation monadic or dyadic?
@@ -740,7 +740,7 @@
 fovfl_ovfl_on:
 	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP (fp1) to stack
 
-	mov.w		&0xe005,2+FP_SRC(%a6) 	# save exc status
+	mov.w		&0xe005,2+FP_SRC(%a6)	# save exc status
 
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
@@ -756,10 +756,10 @@
 # we must jump to real_inex().
 fovfl_inex_on:
 
-	fmovm.x		&0x40,FP_SRC(%a6) 	# save EXOP (fp1) to stack
+	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP (fp1) to stack
 
 	mov.b		&0xc4,1+EXC_VOFF(%a6)	# vector offset = 0xc4
-	mov.w		&0xe001,2+FP_SRC(%a6) 	# save exc status
+	mov.w		&0xe001,2+FP_SRC(%a6)	# save exc status
 
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
@@ -810,7 +810,7 @@
 	btst		&0x7,(%sp)		# is trace on?
 	beq.l		_fpsp_done		# no
 
-	fmov.l		%fpiar,0x8(%sp)		# "Current PC" is in FPIAR	
+	fmov.l		%fpiar,0x8(%sp)		# "Current PC" is in FPIAR
 	mov.w		&0x2024,0x6(%sp)	# stk fmt = 0x2; voff = 0x024
 	bra.l		_real_trace
 
@@ -838,7 +838,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP Unfl exception stack frame	#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	Underflow Exception enabled:					#
 #	- The system stack is unchanged					#
@@ -849,24 +849,24 @@
 #									#
 # ALGORITHM ***********************************************************	#
 #	On the 060, if an FP underflow is present as the result of any	#
-# instruction, the 060 will take an underflow exception whether the 	#
-# exception is enabled or disabled in the FPCR. For the disabled case, 	#
+# instruction, the 060 will take an underflow exception whether the	#
+# exception is enabled or disabled in the FPCR. For the disabled case,	#
 # This handler emulates the instruction to determine what the correct	#
 # default result should be for the operation. This default result is	#
-# then stored in either the FP regfile, data regfile, or memory. 	#
-# Finally, the handler exits through the "callout" _fpsp_done() 	#
+# then stored in either the FP regfile, data regfile, or memory.	#
+# Finally, the handler exits through the "callout" _fpsp_done()		#
 # denoting that no exceptional conditions exist within the machine.	#
-# 	If the exception is enabled, then this handler must create the	#
+#	If the exception is enabled, then this handler must create the	#
 # exceptional operand and plave it in the fsave state frame, and store	#
-# the default result (only if the instruction is opclass 3). For 	#
-# exceptions enabled, this handler must exit through the "callout" 	#
+# the default result (only if the instruction is opclass 3). For	#
+# exceptions enabled, this handler must exit through the "callout"	#
 # _real_unfl() so that the operating system enabled overflow handler	#
 # can handle this case.							#
-#	Two other conditions exist. First, if underflow was disabled 	#
-# but the inexact exception was enabled and the result was inexact, 	#
+#	Two other conditions exist. First, if underflow was disabled	#
+# but the inexact exception was enabled and the result was inexact,	#
 # this handler must exit through the "callout" _real_inex().		#
 # was inexact.								#
-#	Also, in the case of an opclass three instruction where 	#
+#	Also, in the case of an opclass three instruction where		#
 # underflow was disabled and the trace exception was enabled, this	#
 # handler must exit through the "callout" _real_trace().		#
 #									#
@@ -881,12 +881,12 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
-	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)	
+	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -905,13 +905,13 @@
 	bsr.l		set_tag_x		# tag the operand type
 	mov.b		%d0,STAG(%a6)		# maybe NORM,DENORM
 
-# bit five of the fp ext word separates the monadic and dyadic operations 
+# bit five of the fp ext word separates the monadic and dyadic operations
 # that can pass through fpsp_unfl(). remember that fcmp, and ftst
 # will never take this exception.
 	btst		&0x5,1+EXC_CMDREG(%a6)	# is op monadic or dyadic?
 	beq.b		funfl_extract		# monadic
 
-# now, what's left that's not dyadic is fsincos. we can distinguish it 
+# now, what's left that's not dyadic is fsincos. we can distinguish it
 # from all dyadics by the '0110xxx pattern
 	btst		&0x4,1+EXC_CMDREG(%a6)	# is op an fsincos?
 	bne.b		funfl_extract		# yes
@@ -962,7 +962,7 @@
 # (0x00000000_80000000_00000000), then the machine will take an
 # underflow exception. Since this is incorrect, we need to check
 # if our emulation, after re-doing the operation, decided that
-# no underflow was called for. We do these checks only in 
+# no underflow was called for. We do these checks only in
 # funfl_{unfl,inex}_on() because w/ both exceptions disabled, this
 # special case will simply exit gracefully with the correct result.
 
@@ -1002,7 +1002,7 @@
 funfl_unfl_on2:
 	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP (fp1) to stack
 
-	mov.w		&0xe003,2+FP_SRC(%a6) 	# save exc status
+	mov.w		&0xe003,2+FP_SRC(%a6)	# save exc status
 
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
@@ -1021,7 +1021,7 @@
 # The `060 FPU multiplier hardware is such that if the result of a
 # multiply operation is the smallest possible normalized number
 # (0x00000000_80000000_00000000), then the machine will take an
-# underflow exception. 
+# underflow exception.
 # But, whether bogus or not, if inexact is enabled AND it occurred,
 # then we have to branch to real_inex.
 
@@ -1030,10 +1030,10 @@
 
 funfl_inex_on2:
 
-	fmovm.x		&0x40,FP_SRC(%a6) 	# save EXOP to stack
+	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP to stack
 
 	mov.b		&0xc4,1+EXC_VOFF(%a6)	# vector offset = 0xc4
-	mov.w		&0xe001,2+FP_SRC(%a6) 	# save exc status
+	mov.w		&0xe001,2+FP_SRC(%a6)	# save exc status
 
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
@@ -1119,7 +1119,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the "Unimp Data Type" stk frame	#
 #	- The fsave frame contains the ssrc op (for UNNORM/DENORM)	#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If Inexact exception (opclass 3):				#
 #	- The system stack is changed to an Inexact exception stk frame	#
@@ -1138,12 +1138,12 @@
 #									#
 # ALGORITHM ***********************************************************	#
 #	Two main instruction types can enter here: (1) DENORM or UNNORM	#
-# unimplemented data types. These can be either opclass 0,2 or 3 	#
+# unimplemented data types. These can be either opclass 0,2 or 3	#
 # instructions, and (2) PACKED unimplemented data format instructions	#
 # also of opclasses 0,2, or 3.						#
 #	For UNNORM/DENORM opclass 0 and 2, the handler fetches the src	#
 # operand from the fsave state frame and the dst operand (if dyadic)	#
-# from the FP register file. The instruction is then emulated by 	#
+# from the FP register file. The instruction is then emulated by	#
 # choosing an emulation routine from a table of routines indexed by	#
 # instruction type. Once the instruction has been emulated and result	#
 # saved, then we check to see if any enabled exceptions resulted from	#
@@ -1165,7 +1165,7 @@
 # (a Trace stack frame must be created here, too). If an FP exception	#
 # should occur, then we must create an exception stack frame of that	#
 # type and jump to either _real_snan(), _real_operr(), _real_inex(),	#
-# _real_unfl(), or _real_ovfl() as appropriate. PACKED opclass 3 	#
+# _real_unfl(), or _real_ovfl() as appropriate. PACKED opclass 3	#
 # emulation is performed in a similar manner.				#
 #									#
 #########################################################################
@@ -1177,7 +1177,7 @@
 #				*****************
 #				*      EA	*
 #	 pre-instruction	*		*
-# 	*****************	*****************
+#	*****************	*****************
 #	* 0x0 *  0x0dc  *	* 0x3 *  0x0dc  *
 #	*****************	*****************
 #	*     Next	*	*     Next	*
@@ -1206,9 +1206,9 @@
 
 	fsave		FP_SRC(%a6)		# save fp state
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 	btst		&0x5,EXC_SR(%a6)	# user or supervisor mode?
 	bne.b		fu_s
@@ -1257,7 +1257,7 @@
 	fmov.l		&0x0,%fpsr
 
 # Opclass two w/ memory-to-fpn operation will have an incorrect extended
-# precision format if the src format was single or double and the 
+# precision format if the src format was single or double and the
 # source data type was an INF, NAN, DENORM, or UNNORM
 	lea		FP_SRC(%a6),%a0		# pass ptr to input
 	bsr.l		fix_skewed_ops
@@ -1276,7 +1276,7 @@
 
 	bfextu		EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
 
-# bit five of the fp extension word separates the monadic and dyadic operations 
+# bit five of the fp extension word separates the monadic and dyadic operations
 # at this point
 	btst		&0x5,1+EXC_CMDREG(%a6)	# is operation monadic or dyadic?
 	beq.b		fu_extract		# monadic
@@ -1307,13 +1307,13 @@
 
 #
 # Exceptions in order of precedence:
-# 	BSUN	: none
+#	BSUN	: none
 #	SNAN	: all dyadic ops
 #	OPERR	: fsqrt(-NORM)
 #	OVFL	: all except ftst,fcmp
 #	UNFL	: all except ftst,fcmp
 #	DZ	: fdiv
-# 	INEX2	: all except ftst,fcmp
+#	INEX2	: all except ftst,fcmp
 #	INEX1	: none (packed doesn't go through here)
 #
 
@@ -1350,16 +1350,16 @@
 #
 # No exceptions occurred that were also enabled. Now:
 #
-#   	if (OVFL && ovfl_disabled && inexact_enabled) {
+#	if (OVFL && ovfl_disabled && inexact_enabled) {
 #	    branch to _real_inex() (even if the result was exact!);
-#     	} else {
+#	} else {
 #	    save the result in the proper fp reg (unless the op is fcmp or ftst);
 #	    return;
-#     	}
+#	}
 #
 	btst		&ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
 	beq.b		fu_in_cont		# no
-	
+
 fu_in_ovflchk:
 	btst		&inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
 	beq.b		fu_in_cont		# no
@@ -1379,7 +1379,7 @@
 #	} else {
 #		restore exc state (SNAN||OPERR||OVFL||UNFL||DZ||INEX) into the FPU;
 #	}
-#	    		
+#
 fu_in_exc:
 	subi.l		&24,%d0			# fix offset to be 0-8
 	cmpi.b		%d0,&0x6		# is exception INEX? (6)
@@ -1392,7 +1392,7 @@
 	bne.w		fu_in_exc_ovfl		# yes
 
 # here, we insert the correct fsave status value into the fsave frame for the
-# corresponding exception. the operand in the fsave frame should be the original 
+# corresponding exception. the operand in the fsave frame should be the original
 # src operand.
 fu_in_exc_exit:
 	mov.l		%d0,-(%sp)		# save d0
@@ -1423,8 +1423,8 @@
 	bra.b		fu_in_exc_exit
 
 # If the input operand to this operation was opclass two and a single
-# or double precision denorm, inf, or nan, the operand needs to be 
-# "corrected" in order to have the proper equivalent extended precision 
+# or double precision denorm, inf, or nan, the operand needs to be
+# "corrected" in order to have the proper equivalent extended precision
 # number.
 	global		fix_skewed_ops
 fix_skewed_ops:
@@ -1452,7 +1452,7 @@
 	bsr.l		norm			# normalize mantissa
 	neg.w		%d0			# -shft amt
 	addi.w		&0x3f81,%d0		# adjust new exponent
-	andi.w		&0x8000,LOCAL_EX(%a0) 	# clear old exponent
+	andi.w		&0x8000,LOCAL_EX(%a0)	# clear old exponent
 	or.w		%d0,LOCAL_EX(%a0)	# insert new exponent
 	rts
 
@@ -1461,7 +1461,7 @@
 	rts
 
 fso_infnan:
-	andi.b		&0x7f,LOCAL_HI(%a0) 	# clear j-bit
+	andi.b		&0x7f,LOCAL_HI(%a0)	# clear j-bit
 	ori.w		&0x7fff,LOCAL_EX(%a0)	# make exponent = $7fff
 	rts
 
@@ -1484,7 +1484,7 @@
 	bsr.l		norm			# normalize mantissa
 	neg.w		%d0			# -shft amt
 	addi.w		&0x3c01,%d0		# adjust new exponent
-	andi.w		&0x8000,LOCAL_EX(%a0) 	# clear old exponent
+	andi.w		&0x8000,LOCAL_EX(%a0)	# clear old exponent
 	or.w		%d0,LOCAL_EX(%a0)	# insert new exponent
 	rts
 
@@ -1536,13 +1536,13 @@
 	bsr.l		fout			# call fmove out routine
 
 # Exceptions in order of precedence:
-# 	BSUN	: none
+#	BSUN	: none
 #	SNAN	: none
 #	OPERR	: fmove.{b,w,l} out of large UNNORM
 #	OVFL	: fmove.{s,d}
 #	UNFL	: fmove.{s,d,x}
 #	DZ	: none
-# 	INEX2	: all
+#	INEX2	: all
 #	INEX1	: none (packed doesn't travel through here)
 
 # determine the highest priority exception(if any) set by the
@@ -1554,7 +1554,7 @@
 
 	mov.l		EXC_A6(%a6),(%a6)	# in case a6 changed
 
-# on extended precision opclass three instructions using pre-decrement or 
+# on extended precision opclass three instructions using pre-decrement or
 # post-increment addressing mode, the address register is not updated. is the
 # address register was the stack pointer used from user mode, then let's update
 # it here. if it was used from supervisor mode, then we have to handle this
@@ -1578,7 +1578,7 @@
 	bra.l		_fpsp_done
 
 # is the ea mode pre-decrement of the stack pointer from supervisor mode?
-# ("fmov.x fpm,-(a7)") if so, 
+# ("fmov.x fpm,-(a7)") if so,
 fu_out_done_s:
 	cmpi.b		SPCOND_FLG(%a6),&mda7_flg
 	bne.b		fu_out_done_cont
@@ -1616,7 +1616,7 @@
 	bfffo		%d0{&24:&8},%d0		# find highest priority exception
 	bne.b		fu_out_exc		# there is at least one set
 
-# no exceptions were set. 
+# no exceptions were set.
 # if a disabled overflow occurred and inexact was enabled but the result
 # was exact, then a branch to _real_inex() is made.
 	btst		&ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
@@ -1633,7 +1633,7 @@
 # from FPIAR and put it in the trace stack frame then jump to _real_trace().
 #
 #		  UNSUPP FRAME		   TRACE FRAME
-# 		*****************	*****************
+#		*****************	*****************
 #		*      EA	*	*    Current	*
 #		*		*	*      PC	*
 #		*****************	*****************
@@ -1650,7 +1650,7 @@
 	fmov.l		%fpiar,0x8(%sp)
 	bra.l		_real_trace
 
-# an exception occurred and that exception was enabled. 	
+# an exception occurred and that exception was enabled.
 fu_out_exc:
 	subi.l		&24,%d0			# fix offset to be 0-8
 
@@ -1662,15 +1662,15 @@
 	swbeg		&0x8
 tbl_fu_out:
 	short		tbl_fu_out	- tbl_fu_out	# BSUN can't happen
-	short		tbl_fu_out 	- tbl_fu_out	# SNAN can't happen
+	short		tbl_fu_out	- tbl_fu_out	# SNAN can't happen
 	short		fu_operr	- tbl_fu_out	# OPERR
-	short		fu_ovfl 	- tbl_fu_out	# OVFL
-	short		fu_unfl 	- tbl_fu_out	# UNFL
+	short		fu_ovfl		- tbl_fu_out	# OVFL
+	short		fu_unfl		- tbl_fu_out	# UNFL
 	short		tbl_fu_out	- tbl_fu_out	# DZ can't happen
-	short		fu_inex 	- tbl_fu_out	# INEX2
+	short		fu_inex		- tbl_fu_out	# INEX2
 	short		tbl_fu_out	- tbl_fu_out	# INEX1 won't make it here
 
-# for snan,operr,ovfl,unfl, src op is still in FP_SRC so just 
+# for snan,operr,ovfl,unfl, src op is still in FP_SRC so just
 # frestore it.
 fu_snan:
 	fmovm.x		EXC_FPREGS(%a6),&0xc0	# restore fp0/fp1
@@ -1721,7 +1721,7 @@
 # underflow can happen for extended precision. extended precision opclass
 # three instruction exceptions don't update the stack pointer. so, if the
 # exception occurred from user mode, then simply update a7 and exit normally.
-# if the exception occurred from supervisor mode, check if 
+# if the exception occurred from supervisor mode, check if
 fu_unfl:
 	mov.l		EXC_A6(%a6),(%a6)	# restore a6
 
@@ -1730,7 +1730,7 @@
 
 	mov.l		EXC_A7(%a6),%a0		# restore a7 whether we need
 	mov.l		%a0,%usp		# to or not...
-	
+
 fu_unfl_cont:
 	fmovm.x		&0x40,FP_SRC(%a6)	# save EXOP to the stack
 
@@ -1821,7 +1821,7 @@
 
 	bfextu		EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
 
-# bit five of the fp extension word separates the monadic and dyadic operations 
+# bit five of the fp extension word separates the monadic and dyadic operations
 # at this point
 	btst		&0x5,1+EXC_CMDREG(%a6)	# is operation monadic or dyadic?
 	beq.b		fu_extract_p		# monadic
@@ -1852,13 +1852,13 @@
 
 #
 # Exceptions in order of precedence:
-# 	BSUN	: none
+#	BSUN	: none
 #	SNAN	: all dyadic ops
 #	OPERR	: fsqrt(-NORM)
 #	OVFL	: all except ftst,fcmp
 #	UNFL	: all except ftst,fcmp
 #	DZ	: fdiv
-# 	INEX2	: all except ftst,fcmp
+#	INEX2	: all except ftst,fcmp
 #	INEX1	: all
 #
 
@@ -1928,16 +1928,16 @@
 #
 # No exceptions occurred that were also enabled. Now:
 #
-#   	if (OVFL && ovfl_disabled && inexact_enabled) {
+#	if (OVFL && ovfl_disabled && inexact_enabled) {
 #	    branch to _real_inex() (even if the result was exact!);
-#     	} else {
+#	} else {
 #	    save the result in the proper fp reg (unless the op is fcmp or ftst);
 #	    return;
-#     	}
+#	}
 #
 	btst		&ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
 	beq.w		fu_in_cont_p		# no
-	
+
 fu_in_ovflchk_p:
 	btst		&inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
 	beq.w		fu_in_cont_p		# no
@@ -1957,7 +1957,7 @@
 #	} else {
 #		restore exc state (SNAN||OPERR||OVFL||UNFL||DZ||INEX) into the FPU;
 #	}
-#	    		
+#
 fu_in_exc_p:
 	subi.l		&24,%d0			# fix offset to be 0-8
 	cmpi.b		%d0,&0x6		# is exception INEX? (6 or 7)
@@ -1970,7 +1970,7 @@
 	bne.w		fu_in_exc_ovfl_p	# yes
 
 # here, we insert the correct fsave status value into the fsave frame for the
-# corresponding exception. the operand in the fsave frame should be the original 
+# corresponding exception. the operand in the fsave frame should be the original
 # src operand.
 # as a reminder for future predicted pain and agony, we are passing in fsave the
 # "non-skewed" operand for cases of sgl and dbl src INFs,NANs, and DENORMs.
@@ -2033,21 +2033,21 @@
 	bne.b		fu_trace_p		# yes
 
 	bra.l		_fpsp_done		# exit to os
-	
+
 #
-# The opclass two PACKED instruction that took an "Unimplemented Data Type" 
-# exception was being traced. Make the "current" PC the FPIAR and put it in the 
+# The opclass two PACKED instruction that took an "Unimplemented Data Type"
+# exception was being traced. Make the "current" PC the FPIAR and put it in the
 # trace stack frame then jump to _real_trace().
-#					
+#
 #		  UNSUPP FRAME		   TRACE FRAME
 #		*****************	*****************
 #		*      EA	*	*    Current	*
 #		*		*	*      PC	*
 #		*****************	*****************
-#		* 0x2 *	0x0dc	* 	* 0x2 *  0x024	*
+#		* 0x2 *	0x0dc	*	* 0x2 *  0x024	*
 #		*****************	*****************
 #		*     Next	*	*     Next	*
-#		*      PC	*      	*      PC	*
+#		*      PC	*	*      PC	*
 #		*****************	*****************
 #		*      SR	*	*      SR	*
 #		*****************	*****************
@@ -2093,13 +2093,13 @@
 	bsr.l		fout			# call fmove out routine
 
 # Exceptions in order of precedence:
-# 	BSUN	: no
+#	BSUN	: no
 #	SNAN	: yes
 #	OPERR	: if ((k_factor > +17) || (dec. exp exceeds 3 digits))
 #	OVFL	: no
 #	UNFL	: no
 #	DZ	: no
-# 	INEX2	: yes
+#	INEX2	: yes
 #	INEX1	: no
 
 # determine the highest priority exception(if any) set by the
@@ -2163,7 +2163,7 @@
 
 	mov.l		EXC_A6(%a6),(%a6)	# restore a6
 
-# an exception occurred and that exception was enabled. 	
+# an exception occurred and that exception was enabled.
 # the only exception possible on packed move out are INEX, OPERR, and SNAN.
 fu_out_exc_p:
 	cmpi.b		%d0,&0x1a
@@ -2190,7 +2190,7 @@
 	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	mov.w		&0x30d8,EXC_VOFF(%a6)	# vector offset = 0xd0
-	mov.w		&0xe006,2+FP_SRC(%a6) 	# set fsave status
+	mov.w		&0xe006,2+FP_SRC(%a6)	# set fsave status
 
 	frestore	FP_SRC(%a6)		# restore src operand
 
@@ -2230,7 +2230,7 @@
 	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	mov.w		&0x30d0,EXC_VOFF(%a6)	# vector offset = 0xd0
-	mov.w		&0xe004,2+FP_SRC(%a6) 	# set fsave status
+	mov.w		&0xe004,2+FP_SRC(%a6)	# set fsave status
 
 	frestore	FP_SRC(%a6)		# restore src operand
 
@@ -2269,8 +2269,8 @@
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
 	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
-	mov.w		&0x30c4,EXC_VOFF(%a6) 	# vector offset = 0xc4
-	mov.w		&0xe001,2+FP_SRC(%a6) 	# set fsave status
+	mov.w		&0x30c4,EXC_VOFF(%a6)	# vector offset = 0xc4
+	mov.w		&0xe001,2+FP_SRC(%a6)	# set fsave status
 
 	frestore	FP_SRC(%a6)		# restore src operand
 
@@ -2311,7 +2311,7 @@
 	andi.w		&0x7fff,%d0		# strip sign
 	beq.b		funimp_skew_sgl_not
 	cmpi.w		%d0,&0x3f80
-	bgt.b		funimp_skew_sgl_not		
+	bgt.b		funimp_skew_sgl_not
 	neg.w		%d0			# make exponent negative
 	addi.w		&0x3f81,%d0		# find amt to shift
 	mov.l		FP_SRC_HI(%a6),%d1	# fetch DENORM hi(man)
@@ -2328,7 +2328,7 @@
 	andi.w		&0x7fff,%d0		# strip sign
 	beq.b		funimp_skew_dbl_not
 	cmpi.w		%d0,&0x3c00
-	bgt.b		funimp_skew_dbl_not		
+	bgt.b		funimp_skew_dbl_not
 
 	tst.b		FP_SRC_EX(%a6)		# make "internal format"
 	smi.b		0x2+FP_SRC(%a6)
@@ -2361,7 +2361,7 @@
 #########################################################################
 # XDEF ****************************************************************	#
 #	_fpsp_effadd(): 060FPSP entry point for FP "Unimplemented	#
-#		     	effective address" exception.			#
+#			effective address" exception.			#
 #									#
 #	This handler should be the first code executed upon taking the	#
 #	FP Unimplemented Effective Address exception in an operating	#
@@ -2386,7 +2386,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	- The system stack contains the "Unimplemented <ea>" stk frame	#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If access error:						#
 #	- The system stack is changed to an access error stack frame	#
@@ -2407,17 +2407,17 @@
 #	For immediate data operations, the data is read in w/ a		#
 # _mem_read() "callout", converted to FP binary (if packed), and used	#
 # as the source operand to the instruction specified by the instruction	#
-# word. If no FP exception should be reported ads a result of the 	#
+# word. If no FP exception should be reported ads a result of the	#
 # emulation, then the result is stored to the destination register and	#
 # the handler exits through _fpsp_done(). If an enabled exc has been	#
 # signalled as a result of emulation, then an fsave state frame		#
 # corresponding to the FP exception type must be entered into the 060	#
-# FPU before exiting. In either the enabled or disabled cases, we 	#
+# FPU before exiting. In either the enabled or disabled cases, we	#
 # must also check if a Trace exception is pending, in which case, we	#
 # must create a Trace exception stack frame from the current exception	#
 # stack frame. If no Trace is pending, we simply exit through		#
 # _fpsp_done().								#
-#	For "fmovm.x", call the routine fmovm_dynamic() which will 	#
+#	For "fmovm.x", call the routine fmovm_dynamic() which will	#
 # decode and emulate the instruction. No FP exceptions can be pending	#
 # as a result of this operation emulation. A Trace exception can be	#
 # pending, though, which means the current stack frame must be changed	#
@@ -2436,11 +2436,11 @@
 # before the "FPU disabled" exception, but the "FPU disabled" exception	#
 # has higher priority, we check the disabled bit in the PCR. If set,	#
 # then we must create an 8 word "FPU disabled" exception stack frame	#
-# from the current 4 word exception stack frame. This includes 		#
-# reproducing the effective address of the instruction to put on the 	#
+# from the current 4 word exception stack frame. This includes		#
+# reproducing the effective address of the instruction to put on the	#
 # new stack frame.							#
 #									#
-# 	In the process of all emulation work, if a _mem_read()		#
+#	In the process of all emulation work, if a _mem_read()		#
 # "callout" returns a failing result indicating an access error, then	#
 # we must create an access error stack frame from the current stack	#
 # frame. This information includes a faulting address and a fault-	#
@@ -2481,18 +2481,18 @@
 
 #
 # here, we will have:
-# 	fabs	fdabs	fsabs		facos		fmod
+#	fabs	fdabs	fsabs		facos		fmod
 #	fadd	fdadd	fsadd		fasin		frem
-# 	fcmp				fatan		fscale
+#	fcmp				fatan		fscale
 #	fdiv	fddiv	fsdiv		fatanh		fsin
 #	fint				fcos		fsincos
 #	fintrz				fcosh		fsinh
 #	fmove	fdmove	fsmove		fetox		ftan
-# 	fmul	fdmul	fsmul		fetoxm1		ftanh
+#	fmul	fdmul	fsmul		fetoxm1		ftanh
 #	fneg	fdneg	fsneg		fgetexp		ftentox
 #	fsgldiv				fgetman		ftwotox
-# 	fsglmul				flog10
-# 	fsqrt				flog2
+#	fsglmul				flog10
+#	fsqrt				flog2
 #	fsub	fdsub	fssub		flogn
 #	ftst				flognp1
 # which can all use f<op>.{x,p}
@@ -2584,8 +2584,8 @@
 # store a result. then, only fcmp will branch back and pick up a dst operand.
 	st		STORE_FLG(%a6)		# don't store a final result
 	btst		&0x1,1+EXC_CMDREG(%a6)	# is operation fcmp?
-	beq.b		iea_op_loaddst		# yes	
-	
+	beq.b		iea_op_loaddst		# yes
+
 iea_op_extract:
 	clr.l		%d0
 	mov.b		FPCR_MODE(%a6),%d0	# pass: rnd mode,prec
@@ -2658,7 +2658,7 @@
 	btst		&inex2_bit,FPCR_ENABLE(%a6) # is inexact enabled?
 	beq.b		iea_op_store		# no
 	bra.b		iea_op_exc_ovfl		# yes
-	
+
 # an enabled exception occurred. we have to insert the exception type back into
 # the machine.
 iea_op_exc:
@@ -2697,7 +2697,7 @@
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
 	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
-	frestore 	FP_SRC(%a6)		# restore exceptional state
+	frestore	FP_SRC(%a6)		# restore exceptional state
 
 	unlk		%a6			# unravel the frame
 
@@ -2705,12 +2705,12 @@
 	bne.b		iea_op_trace		# yes
 
 	bra.l		_fpsp_done		# exit to os
-	
+
 #
 # The opclass two instruction that took an "Unimplemented Effective Address"
 # exception was being traced. Make the "current" PC the FPIAR and put it in
 # the trace stack frame then jump to _real_trace().
-#					
+#
 #		 UNIMP EA FRAME		   TRACE FRAME
 #		*****************	*****************
 #		* 0x0 *  0x0f0	*	*    Current	*
@@ -2743,7 +2743,7 @@
 
 iea_fmovm_data_u:
 	mov.l		%usp,%a0
-	mov.l		%a0,EXC_A7(%a6)		# store current a7	
+	mov.l		%a0,EXC_A7(%a6)		# store current a7
 	bsr.l		fmovm_dynamic		# do dynamic fmovm
 	mov.l		EXC_A7(%a6),%a0		# load possibly new a7
 	mov.l		%a0,%usp		# update usp
@@ -2774,10 +2774,10 @@
 
 	lea		(EXC_SR,%a6,%d0),%a0
 	mov.l		%a0,EXC_SR(%a6)
-	
+
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	unlk		%a6
 	mov.l		(%sp)+,%sp
@@ -2791,15 +2791,15 @@
 
 	lea		(EXC_SR-0x4,%a6,%d0),%a0
 	mov.l		%a0,EXC_SR(%a6)
-	
+
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	unlk		%a6
 	mov.l		(%sp)+,%sp
 	bra.l		_real_trace
-	
+
 # right now, d1 = size and d0 = the strg.
 iea_fmovm_data_predec:
 	mov.b		%d1,EXC_VOFF(%a6)	# store strg
@@ -2807,7 +2807,7 @@
 
 	fmovm.x		EXC_FP0(%a6),&0xc0	# restore fp0-fp1
 	fmovm.l		USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- 	movm.l		EXC_DREGS(%a6),&0x0303 	# restore d0-d1/a0-a1
+	movm.l		EXC_DREGS(%a6),&0x0303	# restore d0-d1/a0-a1
 
 	mov.l		(%a6),-(%sp)		# make a copy of a6
 	mov.l		%d0,-(%sp)		# save d0
@@ -2909,10 +2909,10 @@
 
 #
 # The control reg instruction that took an "Unimplemented Effective Address"
-# exception was being traced. The "Current PC" for the trace frame is the 
+# exception was being traced. The "Current PC" for the trace frame is the
 # PC stacked for Unimp EA. The "Next PC" is in EXC_EXTWPTR.
 # After fixing the stack frame, jump to _real_trace().
-#					
+#
 #		 UNIMP EA FRAME		   TRACE FRAME
 #		*****************	*****************
 #		* 0x0 *  0x0f0	*	*    Current	*
@@ -3065,7 +3065,7 @@
 #	_fpsp_operr(): 060FPSP entry point for FP Operr exception.	#
 #									#
 #	This handler should be the first code executed upon taking the	#
-# 	FP Operand Error exception in an operating system.		#
+#	FP Operand Error exception in an operating system.		#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_long() - read instruction longword			#
@@ -3078,7 +3078,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP Operr exception frame	#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	No access error:						#
 #	- The system stack is unchanged					#
@@ -3087,16 +3087,16 @@
 # ALGORITHM ***********************************************************	#
 #	In a system where the FP Operr exception is enabled, the goal	#
 # is to get to the handler specified at _real_operr(). But, on the 060,	#
-# for opclass zero and two instruction taking this exception, the 	#
+# for opclass zero and two instruction taking this exception, the	#
 # input operand in the fsave frame may be incorrect for some cases	#
 # and needs to be corrected. This handler calls fix_skewed_ops() to	#
 # do just this and then exits through _real_operr().			#
 #	For opclass 3 instructions, the 060 doesn't store the default	#
 # operr result out to memory or data register file as it should.	#
 # This code must emulate the move out before finally exiting through	#
-# _real_inex(). The move out, if to memory, is performed using 		#
+# _real_inex(). The move out, if to memory, is performed using		#
 # _mem_write() "callout" routines that may return a failing result.	#
-# In this special case, the handler must exit through facc_out() 	#
+# In this special case, the handler must exit through facc_out()	#
 # which creates an access error stack frame from the current operr	#
 # stack frame.								#
 #									#
@@ -3109,13 +3109,13 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -3129,7 +3129,7 @@
 
 # here, we simply see if the operand in the fsave frame needs to be "unskewed".
 # this would be the case for opclass two operations with a source infinity or
-# denorm operand in the sgl or dbl format. NANs also become skewed, but can't 
+# denorm operand in the sgl or dbl format. NANs also become skewed, but can't
 # cause an operr so we don't need to check for them here.
 	lea		FP_SRC(%a6),%a0		# pass: ptr to src op
 	bsr.l		fix_skewed_ops		# fix src op
@@ -3200,7 +3200,7 @@
 	short		tbl_operr    - tbl_operr # dbl prec shouldn't happen
 	short		foperr_out_b - tbl_operr # byte integer
 	short		tbl_operr    - tbl_operr # packed won't enter here
-	
+
 foperr_out_b:
 	mov.b		L_SCR1(%a6),%d0		# load positive default result
 	cmpi.b		%d1,&0x7		# is <ea> mode a data reg?
@@ -3254,7 +3254,7 @@
 #	_fpsp_snan(): 060FPSP entry point for FP SNAN exception.	#
 #									#
 #	This handler should be the first code executed upon taking the	#
-# 	FP Signalling NAN exception in an operating system.		#
+#	FP Signalling NAN exception in an operating system.		#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_long() - read instruction longword			#
@@ -3268,7 +3268,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP SNAN exception frame		#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	No access error:						#
 #	- The system stack is unchanged					#
@@ -3277,16 +3277,16 @@
 # ALGORITHM ***********************************************************	#
 #	In a system where the FP SNAN exception is enabled, the goal	#
 # is to get to the handler specified at _real_snan(). But, on the 060,	#
-# for opclass zero and two instructions taking this exception, the 	#
+# for opclass zero and two instructions taking this exception, the	#
 # input operand in the fsave frame may be incorrect for some cases	#
 # and needs to be corrected. This handler calls fix_skewed_ops() to	#
 # do just this and then exits through _real_snan().			#
 #	For opclass 3 instructions, the 060 doesn't store the default	#
 # SNAN result out to memory or data register file as it should.		#
 # This code must emulate the move out before finally exiting through	#
-# _real_snan(). The move out, if to memory, is performed using 		#
+# _real_snan(). The move out, if to memory, is performed using		#
 # _mem_write() "callout" routines that may return a failing result.	#
-# In this special case, the handler must exit through facc_out() 	#
+# In this special case, the handler must exit through facc_out()	#
 # which creates an access error stack frame from the current SNAN	#
 # stack frame.								#
 #	For the case of an extended precision opclass 3 instruction,	#
@@ -3305,13 +3305,13 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -3339,7 +3339,7 @@
 
 	unlk		%a6
 	bra.l		_real_snan
-		
+
 ########################################################################
 
 #
@@ -3349,7 +3349,7 @@
 #
 # byte, word, long, and packed destination format operations can pass
 # through here. since packed format operations already were handled by
-# fpsp_unsupp(), then we need to do nothing else for them here. 
+# fpsp_unsupp(), then we need to do nothing else for them here.
 # for byte, word, and long, we simply need to test the sign of the src
 # operand and save the appropriate minimum or maximum integer value
 # to the effective address as pointed to by the stacked effective address.
@@ -3370,7 +3370,7 @@
 	short		fsnan_out_d - tbl_snan # dbl prec shouldn't happen
 	short		fsnan_out_b - tbl_snan # byte integer
 	short		tbl_snan    - tbl_snan # packed needs no help
-	
+
 fsnan_out_b:
 	mov.b		FP_SRC_HI(%a6),%d0	# load upper byte of SNAN
 	bset		&6,%d0			# set SNAN bit
@@ -3496,7 +3496,7 @@
 	mov.l		%usp,%a0		# fetch user stack pointer
 	mov.l		%a0,EXC_A7(%a6)		# save on stack for calc_ea()
 	mov.l		(%a6),EXC_A6(%a6)
-	
+
 	bsr.l		_calc_ea_fout		# find the correct ea,update An
 	mov.l		%a0,%a1
 	mov.l		%a0,EXC_EA(%a6)		# stack correct <ea>
@@ -3545,7 +3545,7 @@
 	mov.l		LOCAL_SIZE+FP_SCR0_LO(%sp),LOCAL_SIZE+EXC_EA(%sp)
 
 	add.l		&LOCAL_SIZE-0x8,%sp
-	
+
 	bra.l		_real_snan
 
 #########################################################################
@@ -3553,7 +3553,7 @@
 #	_fpsp_inex(): 060FPSP entry point for FP Inexact exception.	#
 #									#
 #	This handler should be the first code executed upon taking the	#
-# 	FP Inexact exception in an operating system.			#
+#	FP Inexact exception in an operating system.			#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_long() - read instruction longword			#
@@ -3570,7 +3570,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP Inexact exception frame	#
 #	- The fsave frame contains the source operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	- The system stack is unchanged					#
 #	- The fsave frame contains the adjusted src op for opclass 0,2	#
@@ -3578,10 +3578,10 @@
 # ALGORITHM ***********************************************************	#
 #	In a system where the FP Inexact exception is enabled, the goal	#
 # is to get to the handler specified at _real_inex(). But, on the 060,	#
-# for opclass zero and two instruction taking this exception, the 	#
+# for opclass zero and two instruction taking this exception, the	#
 # hardware doesn't store the correct result to the destination FP	#
-# register as did the '040 and '881/2. This handler must emulate the 	#
-# instruction in order to get this value and then store it to the 	#
+# register as did the '040 and '881/2. This handler must emulate the	#
+# instruction in order to get this value and then store it to the	#
 # correct register before calling _real_inex().				#
 #	For opclass 3 instructions, the 060 doesn't store the default	#
 # inexact result out to memory or data register file as it should.	#
@@ -3597,13 +3597,13 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -3615,7 +3615,7 @@
 	bne.w		finex_out		# fmove out
 
 
-# the hardware, for "fabs" and "fneg" w/ a long source format, puts the 
+# the hardware, for "fabs" and "fneg" w/ a long source format, puts the
 # longword integer directly into the upper longword of the mantissa along
 # w/ an exponent value of 0x401e. we convert this to extended precision here.
 	bfextu		%d0{&19:&3},%d0		# fetch instr size
@@ -3749,7 +3749,7 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains the FP DZ exception stack.		#
 #	- The fsave frame contains the source operand.			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	- The system stack contains the FP DZ exception stack.		#
 #	- The fsave frame contains the adjusted source operand.		#
@@ -3760,7 +3760,7 @@
 # exception is taken, the input operand in the fsave state frame may	#
 # be incorrect for some cases and need to be adjusted. So, this package	#
 # adjusts the operand using fix_skewed_ops() and then branches to	#
-# _real_dz(). 								#
+# _real_dz().								#
 #									#
 #########################################################################
 
@@ -3771,13 +3771,13 @@
 
 	fsave		FP_SRC(%a6)		# grab the "busy" frame
 
- 	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
+	movm.l		&0x0303,EXC_DREGS(%a6)	# save d0-d1/a0-a1
 	fmovm.l		%fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- 	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
+	fmovm.x		&0xc0,EXC_FPREGS(%a6)	# save fp0-fp1 on stack
 
 # the FPIAR holds the "current PC" of the faulting instruction
 	mov.l		USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long		# fetch the instruction words
@@ -3805,7 +3805,7 @@
 #########################################################################
 # XDEF ****************************************************************	#
 #	_fpsp_fline(): 060FPSP entry point for "Line F emulator"	#
-#		       exception when the "reduced" version of the 	#
+#		       exception when the "reduced" version of the	#
 #		       FPSP is implemented that does not emulate	#
 #		       FP unimplemented instructions.			#
 #									#
@@ -3820,12 +3820,12 @@
 # INPUT ***************************************************************	#
 #	- The system stack contains a "Line F Emulator" exception	#
 #	  stack frame.							#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	- The system stack is unchanged.				#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	When a "Line F Emulator" exception occurs in a system where	#
+#	When a "Line F Emulator" exception occurs in a system where	#
 # "FPU Unimplemented" instructions will not be emulated, the exception	#
 # can occur because then FPU is disabled or the instruction is to be	#
 # classifed as "Line F". This module determines which case exists and	#
@@ -3853,21 +3853,21 @@
 #									#
 # INPUT ***************************************************************	#
 #	d0 = number of bytes to adjust <ea> by				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	None								#
 #									#
 # ALGORITHM ***********************************************************	#
 # "Dummy" CALCulate Effective Address:					#
-# 	The stacked <ea> for FP unimplemented instructions and opclass	#
+#	The stacked <ea> for FP unimplemented instructions and opclass	#
 #	two packed instructions is correct with the exception of...	#
 #									#
 #	1) -(An)   : The register is not updated regardless of size.	#
-#		     Also, for extended precision and packed, the 	#
+#		     Also, for extended precision and packed, the	#
 #		     stacked <ea> value is 8 bytes too big		#
 #	2) (An)+   : The register is not updated.			#
-#	3) #<data> : The upper longword of the immediate operand is 	#
-#		     stacked b,w,l and s sizes are completely stacked. 	#
+#	3) #<data> : The upper longword of the immediate operand is	#
+#		     stacked b,w,l and s sizes are completely stacked.	#
 #		     d,x, and p are not.				#
 #									#
 #########################################################################
@@ -3903,8 +3903,8 @@
 	lea		([USER_FPIAR,%a6],0x4),%a0 # no; return <ea>
 	rts
 
-# here, the <ea> is stacked correctly. however, we must update the 
-# address register...	
+# here, the <ea> is stacked correctly. however, we must update the
+# address register...
 dcea_pi:
 	mov.l		%a0,%d0			# pass amt to inc by
 	bsr.l		inc_areg		# inc addr register
@@ -3912,7 +3912,7 @@
 	mov.l		EXC_EA(%a6),%a0		# stacked <ea> is correct
 	rts
 
-# the <ea> is stacked correctly for all but extended and packed which 
+# the <ea> is stacked correctly for all but extended and packed which
 # the <ea>s are 8 bytes too large.
 # it would make no sense to have a pre-decrement to a7 in supervisor
 # mode so we don't even worry about this tricky case here : )
@@ -3932,7 +3932,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	_calc_ea_fout(): calculate correct stacked <ea> for extended	#
+#	_calc_ea_fout(): calculate correct stacked <ea> for extended	#
 #			 and packed data opclass 3 operations.		#
 #									#
 # XREF ****************************************************************	#
@@ -3940,22 +3940,22 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	a0 = return correct effective address				#
 #									#
 # ALGORITHM ***********************************************************	#
 #	For opclass 3 extended and packed data operations, the <ea>	#
 # stacked for the exception is incorrect for -(an) and (an)+ addressing	#
-# modes. Also, while we're at it, the index register itself must get 	#
+# modes. Also, while we're at it, the index register itself must get	#
 # updated.								#
-# 	So, for -(an), we must subtract 8 off of the stacked <ea> value	#
+#	So, for -(an), we must subtract 8 off of the stacked <ea> value	#
 # and return that value as the correct <ea> and store that value in An.	#
 # For (an)+, the stacked <ea> is correct but we must adjust An by +12.	#
 #									#
 #########################################################################
 
-# This calc_ea is currently used to retrieve the correct <ea> 
+# This calc_ea is currently used to retrieve the correct <ea>
 # for fmove outs of type extended and packed.
 	global		_calc_ea_fout
 _calc_ea_fout:
@@ -3976,7 +3976,7 @@
 
 # (An)+ : extended and packed fmove out
 #	: stacked <ea> is correct
-#	: "An" not updated 
+#	: "An" not updated
 ceaf_pi:
 	mov.w		(tbl_ceaf_pi.b,%pc,%d1.w*2),%d1
 	mov.l		EXC_EA(%a6),%a0
@@ -4077,11 +4077,11 @@
 
 	swbeg		&109
 tbl_unsupp:
-	long		fin	 	- tbl_unsupp	# 00: fmove
-	long		fint	 	- tbl_unsupp	# 01: fint
-	long		tbl_unsupp 	- tbl_unsupp	# 02: fsinh
-	long		fintrz	 	- tbl_unsupp	# 03: fintrz
-	long		fsqrt	 	- tbl_unsupp	# 04: fsqrt
+	long		fin		- tbl_unsupp	# 00: fmove
+	long		fint		- tbl_unsupp	# 01: fint
+	long		tbl_unsupp	- tbl_unsupp	# 02: fsinh
+	long		fintrz		- tbl_unsupp	# 03: fintrz
+	long		fsqrt		- tbl_unsupp	# 04: fsqrt
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp	# 06: flognp1
 	long		tbl_unsupp	- tbl_unsupp
@@ -4101,23 +4101,23 @@
 	long		tbl_unsupp	- tbl_unsupp	# 15: flog10
 	long		tbl_unsupp	- tbl_unsupp	# 16: flog2
 	long		tbl_unsupp	- tbl_unsupp
-	long		fabs		- tbl_unsupp 	# 18: fabs
+	long		fabs		- tbl_unsupp	# 18: fabs
 	long		tbl_unsupp	- tbl_unsupp	# 19: fcosh
-	long		fneg		- tbl_unsupp 	# 1a: fneg
+	long		fneg		- tbl_unsupp	# 1a: fneg
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp	# 1c: facos
 	long		tbl_unsupp	- tbl_unsupp	# 1d: fcos
 	long		tbl_unsupp	- tbl_unsupp	# 1e: fgetexp
 	long		tbl_unsupp	- tbl_unsupp	# 1f: fgetman
-	long		fdiv		- tbl_unsupp 	# 20: fdiv
+	long		fdiv		- tbl_unsupp	# 20: fdiv
 	long		tbl_unsupp	- tbl_unsupp	# 21: fmod
-	long		fadd		- tbl_unsupp 	# 22: fadd
-	long		fmul		- tbl_unsupp 	# 23: fmul
-	long		fsgldiv		- tbl_unsupp 	# 24: fsgldiv
+	long		fadd		- tbl_unsupp	# 22: fadd
+	long		fmul		- tbl_unsupp	# 23: fmul
+	long		fsgldiv		- tbl_unsupp	# 24: fsgldiv
 	long		tbl_unsupp	- tbl_unsupp	# 25: frem
 	long		tbl_unsupp	- tbl_unsupp	# 26: fscale
-	long		fsglmul		- tbl_unsupp 	# 27: fsglmul
-	long		fsub		- tbl_unsupp 	# 28: fsub
+	long		fsglmul		- tbl_unsupp	# 27: fsglmul
+	long		fsub		- tbl_unsupp	# 28: fsub
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
@@ -4133,20 +4133,20 @@
 	long		tbl_unsupp	- tbl_unsupp	# 35: fsincos
 	long		tbl_unsupp	- tbl_unsupp	# 36: fsincos
 	long		tbl_unsupp	- tbl_unsupp	# 37: fsincos
-	long		fcmp		- tbl_unsupp 	# 38: fcmp
+	long		fcmp		- tbl_unsupp	# 38: fcmp
 	long		tbl_unsupp	- tbl_unsupp
-	long		ftst		- tbl_unsupp 	# 3a: ftst
+	long		ftst		- tbl_unsupp	# 3a: ftst
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
-	long		fsin		- tbl_unsupp 	# 40: fsmove
-	long		fssqrt		- tbl_unsupp 	# 41: fssqrt
+	long		fsin		- tbl_unsupp	# 40: fsmove
+	long		fssqrt		- tbl_unsupp	# 41: fssqrt
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		fdin		- tbl_unsupp	# 44: fdmove
-	long		fdsqrt		- tbl_unsupp 	# 45: fdsqrt
+	long		fdsqrt		- tbl_unsupp	# 45: fdsqrt
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
@@ -4165,27 +4165,27 @@
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
-	long		fsabs		- tbl_unsupp 	# 58: fsabs
+	long		fsabs		- tbl_unsupp	# 58: fsabs
 	long		tbl_unsupp	- tbl_unsupp
-	long		fsneg		- tbl_unsupp 	# 5a: fsneg
+	long		fsneg		- tbl_unsupp	# 5a: fsneg
 	long		tbl_unsupp	- tbl_unsupp
 	long		fdabs		- tbl_unsupp	# 5c: fdabs
 	long		tbl_unsupp	- tbl_unsupp
-	long		fdneg		- tbl_unsupp 	# 5e: fdneg
+	long		fdneg		- tbl_unsupp	# 5e: fdneg
 	long		tbl_unsupp	- tbl_unsupp
 	long		fsdiv		- tbl_unsupp	# 60: fsdiv
 	long		tbl_unsupp	- tbl_unsupp
 	long		fsadd		- tbl_unsupp	# 62: fsadd
 	long		fsmul		- tbl_unsupp	# 63: fsmul
-	long		fddiv		- tbl_unsupp 	# 64: fddiv
+	long		fddiv		- tbl_unsupp	# 64: fddiv
 	long		tbl_unsupp	- tbl_unsupp
 	long		fdadd		- tbl_unsupp	# 66: fdadd
-	long		fdmul		- tbl_unsupp 	# 67: fdmul
+	long		fdmul		- tbl_unsupp	# 67: fdmul
 	long		fssub		- tbl_unsupp	# 68: fssub
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
 	long		tbl_unsupp	- tbl_unsupp
-	long		fdsub		- tbl_unsupp 	# 6c: fdsub
+	long		fdsub		- tbl_unsupp	# 6c: fdsub
 
 #################################################
 # Add this here so non-fp modules can compile.
@@ -4208,7 +4208,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If instr is "fmovm Dn,-(A7)" from supervisor mode,		#
 #		d0 = size of dump					#
@@ -4230,25 +4230,25 @@
 #	The data register is determined and its value loaded to get the	#
 # string of FP registers affected. This value is used as an index into	#
 # a lookup table such that we can determine the number of bytes		#
-# involved. 								#
+# involved.								#
 #	If the instruction is "fmovm.x <ea>,Dn", a _mem_read() is used	#
 # to read in all FP values. Again, _mem_read() may fail and require a	#
-# special exit. 							#
+# special exit.								#
 #	If the instruction is "fmovm.x DN,<ea>", a _mem_write() is used	#
 # to write all FP values. _mem_write() may also fail.			#
-# 	If the instruction is "fmovm.x DN,-(a7)" from supervisor mode,	#
+#	If the instruction is "fmovm.x DN,-(a7)" from supervisor mode,	#
 # then we return the size of the dump and the string to the caller	#
 # so that the move can occur outside of this routine. This special	#
 # case is required so that moves to the system stack are handled	#
 # correctly.								#
 #									#
 # DYNAMIC:								#
-# 	fmovm.x	dn, <ea>						#
-# 	fmovm.x	<ea>, dn						#
+#	fmovm.x	dn, <ea>						#
+#	fmovm.x	<ea>, dn						#
 #									#
 #	      <WORD 1>		      <WORD2>				#
 #	1111 0010 00 |<ea>|	11@& 1000 0$$$ 0000			#
-#					  				#
+#									#
 #	& = (0): predecrement addressing mode				#
 #	    (1): postincrement or control addressing mode		#
 #	@ = (0): move listed regs from memory to the FPU		#
@@ -4517,12 +4517,12 @@
 	byte	0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
 	byte	0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
 	byte	0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
-	byte	0x3c,0x48,0x48,0x54,0x48,0x54,0x54,0x60	
+	byte	0x3c,0x48,0x48,0x54,0x48,0x54,0x54,0x60
 
 #
 # table to convert a pre-decrement bit string into a post-increment
 # or control bit string.
-# ex: 	0x00	==>	0x00
+# ex:	0x00	==>	0x00
 #	0x01	==>	0x80
 #	0x02	==>	0x40
 #		.
@@ -4604,59 +4604,59 @@
 	short		tbl_fea_mode	-	tbl_fea_mode
 	short		tbl_fea_mode	-	tbl_fea_mode
 
-	short		faddr_ind_a0	- 	tbl_fea_mode
-	short		faddr_ind_a1	- 	tbl_fea_mode
-	short		faddr_ind_a2	- 	tbl_fea_mode
-	short		faddr_ind_a3 	- 	tbl_fea_mode
-	short		faddr_ind_a4 	- 	tbl_fea_mode
-	short		faddr_ind_a5 	- 	tbl_fea_mode
-	short		faddr_ind_a6 	- 	tbl_fea_mode
-	short		faddr_ind_a7 	- 	tbl_fea_mode
-
-	short		faddr_ind_p_a0	- 	tbl_fea_mode
-	short		faddr_ind_p_a1 	- 	tbl_fea_mode
-	short		faddr_ind_p_a2 	- 	tbl_fea_mode
-	short		faddr_ind_p_a3 	- 	tbl_fea_mode
-	short		faddr_ind_p_a4 	- 	tbl_fea_mode
-	short		faddr_ind_p_a5 	- 	tbl_fea_mode
-	short		faddr_ind_p_a6 	- 	tbl_fea_mode
-	short		faddr_ind_p_a7 	- 	tbl_fea_mode
-
-	short		faddr_ind_m_a0 	- 	tbl_fea_mode
-	short		faddr_ind_m_a1 	- 	tbl_fea_mode
-	short		faddr_ind_m_a2 	- 	tbl_fea_mode
-	short		faddr_ind_m_a3 	- 	tbl_fea_mode
-	short		faddr_ind_m_a4 	- 	tbl_fea_mode
-	short		faddr_ind_m_a5 	- 	tbl_fea_mode
-	short		faddr_ind_m_a6 	- 	tbl_fea_mode
-	short		faddr_ind_m_a7 	- 	tbl_fea_mode
-
-	short		faddr_ind_disp_a0	- 	tbl_fea_mode
-	short		faddr_ind_disp_a1 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a2 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a3 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a4 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a5 	- 	tbl_fea_mode
-	short		faddr_ind_disp_a6 	- 	tbl_fea_mode
+	short		faddr_ind_a0	-	tbl_fea_mode
+	short		faddr_ind_a1	-	tbl_fea_mode
+	short		faddr_ind_a2	-	tbl_fea_mode
+	short		faddr_ind_a3	-	tbl_fea_mode
+	short		faddr_ind_a4	-	tbl_fea_mode
+	short		faddr_ind_a5	-	tbl_fea_mode
+	short		faddr_ind_a6	-	tbl_fea_mode
+	short		faddr_ind_a7	-	tbl_fea_mode
+
+	short		faddr_ind_p_a0	-	tbl_fea_mode
+	short		faddr_ind_p_a1	-	tbl_fea_mode
+	short		faddr_ind_p_a2	-	tbl_fea_mode
+	short		faddr_ind_p_a3	-	tbl_fea_mode
+	short		faddr_ind_p_a4	-	tbl_fea_mode
+	short		faddr_ind_p_a5	-	tbl_fea_mode
+	short		faddr_ind_p_a6	-	tbl_fea_mode
+	short		faddr_ind_p_a7	-	tbl_fea_mode
+
+	short		faddr_ind_m_a0	-	tbl_fea_mode
+	short		faddr_ind_m_a1	-	tbl_fea_mode
+	short		faddr_ind_m_a2	-	tbl_fea_mode
+	short		faddr_ind_m_a3	-	tbl_fea_mode
+	short		faddr_ind_m_a4	-	tbl_fea_mode
+	short		faddr_ind_m_a5	-	tbl_fea_mode
+	short		faddr_ind_m_a6	-	tbl_fea_mode
+	short		faddr_ind_m_a7	-	tbl_fea_mode
+
+	short		faddr_ind_disp_a0	-	tbl_fea_mode
+	short		faddr_ind_disp_a1	-	tbl_fea_mode
+	short		faddr_ind_disp_a2	-	tbl_fea_mode
+	short		faddr_ind_disp_a3	-	tbl_fea_mode
+	short		faddr_ind_disp_a4	-	tbl_fea_mode
+	short		faddr_ind_disp_a5	-	tbl_fea_mode
+	short		faddr_ind_disp_a6	-	tbl_fea_mode
 	short		faddr_ind_disp_a7	-	tbl_fea_mode
 
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-	short		faddr_ind_ext 	- 	tbl_fea_mode
-
-	short		fabs_short	- 	tbl_fea_mode
-	short		fabs_long	- 	tbl_fea_mode
-	short		fpc_ind		- 	tbl_fea_mode
-	short		fpc_ind_ext	- 	tbl_fea_mode
-	short		tbl_fea_mode	- 	tbl_fea_mode
-	short		tbl_fea_mode	- 	tbl_fea_mode
-	short		tbl_fea_mode	- 	tbl_fea_mode
-	short		tbl_fea_mode	- 	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+	short		faddr_ind_ext	-	tbl_fea_mode
+
+	short		fabs_short	-	tbl_fea_mode
+	short		fabs_long	-	tbl_fea_mode
+	short		fpc_ind		-	tbl_fea_mode
+	short		fpc_ind_ext	-	tbl_fea_mode
+	short		tbl_fea_mode	-	tbl_fea_mode
+	short		tbl_fea_mode	-	tbl_fea_mode
+	short		tbl_fea_mode	-	tbl_fea_mode
+	short		tbl_fea_mode	-	tbl_fea_mode
 
 ###################################
 # Address register indirect: (An) #
@@ -4952,7 +4952,7 @@
 
 	btst		&0x8,%d0
 	bne.w		fcalc_mem_ind
-	
+
 	mov.l		%d0,L_SCR1(%a6)		# hold opword
 
 	mov.l		%d0,%d1
@@ -5048,7 +5048,7 @@
 
 	btst		&0x8,%d0		# is disp only 8 bits?
 	bne.w		fcalc_mem_ind		# calc memory indirect
-	
+
 	mov.l		%d0,L_SCR1(%a6)		# store opword
 
 	mov.l		%d0,%d1			# make extword copy
@@ -5125,7 +5125,7 @@
 	bfextu		%d5{&26:&2},%d0		# get bd size
 #	beq.l		fmovm_error		# if (size == 0) it's reserved
 
-	cmpi.b	 	%d0,&0x2
+	cmpi.b		%d0,&0x2
 	blt.b		fno_bd
 	beq.b		fget_word_bd
 
@@ -5147,7 +5147,7 @@
 	bne.l		fcea_iacc		# yes
 
 	ext.l		%d0			# sign extend bd
-	
+
 fchk_ind:
 	add.l		%d0,%d3			# base += bd
 
@@ -5156,10 +5156,10 @@
 	bfextu		%d5{&30:&2},%d0		# is od suppressed?
 	beq.w		faii_bd
 
-	cmpi.b	 	%d0,&0x2
+	cmpi.b		%d0,&0x2
 	blt.b		fnull_od
 	beq.b		fword_od
-	
+
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
 	addq.l		&0x4,EXC_EXTWPTR(%a6)	# incr instruction ptr
 	bsr.l		_imem_read_long
@@ -5167,7 +5167,7 @@
 	tst.l		%d1			# did ifetch fail?
 	bne.l		fcea_iacc		# yes
 
-	bra.b 		fadd_them
+	bra.b		fadd_them
 
 fword_od:
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
@@ -5220,7 +5220,7 @@
 	rts
 
 #########################################################
-fcea_err:	
+fcea_err:
 	mov.l		%d3,%a0
 
 	movm.l		(%sp)+,&0x003c		# restore d2-d5
@@ -5230,7 +5230,7 @@
 fcea_iacc:
 	movm.l		(%sp)+,&0x003c		# restore d2-d5
 	bra.l		iea_iacc
-	
+
 fmovm_out_err:
 	bsr.l		restore
 	mov.w		&0x00e1,%d0
@@ -5246,7 +5246,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fmovm_ctrl(): emulate fmovm.l of control registers instr	#
+#	fmovm_ctrl(): emulate fmovm.l of control registers instr	#
 #									#
 # XREF ****************************************************************	#
 #	_imem_read_long() - read longword from memory			#
@@ -5254,7 +5254,7 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If _imem_read_long() doesn't fail:				#
 #		USER_FPCR(a6)  = new FPCR value				#
@@ -5262,14 +5262,14 @@
 #		USER_FPIAR(a6) = new FPIAR value			#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Decode the instruction type by looking at the extension word 	#
+#	Decode the instruction type by looking at the extension word	#
 # in order to see how many control registers to fetch from memory.	#
 # Fetch them using _imem_read_long(). If this fetch fails, exit through	#
 # the special access error exit handler iea_iacc().			#
 #									#
 # Instruction word decoding:						#
 #									#
-# 	fmovem.l #<data>, {FPIAR&|FPCR&|FPSR}				#
+#	fmovem.l #<data>, {FPIAR&|FPCR&|FPSR}				#
 #									#
 #		WORD1			WORD2				#
 #	1111 0010 00 111100	100$ $$00 0000 0000			#
@@ -5290,7 +5290,7 @@
 	beq.w		fctrl_in_6		# yes
 	cmpi.b		%d0,&0x94		# fpcr & fpiar ?
 	beq.b		fctrl_in_5		# yes
-	
+
 # fmovem.l #<data>, fpsr/fpiar
 fctrl_in_3:
 	mov.l		EXC_EXTWPTR(%a6),%a0	# fetch instruction addr
@@ -5392,14 +5392,14 @@
 # INPUT ***************************************************************	#
 #	FP_SRC(a6) = fp op1(src)					#
 #	FP_DST(a6) = fp op2(dst)					#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SRC(a6) = fp op1 scaled(src)					#
 #	FP_DST(a6) = fp op2 scaled(dst)					#
 #	d0         = scale amount					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	If the DST exponent is > the SRC exponent, set the DST exponent	#
+#	If the DST exponent is > the SRC exponent, set the DST exponent	#
 # equal to 0x3fff and scale the SRC exponent by the value that the	#
 # DST exponent was scaled by. If the SRC exponent is greater or equal,	#
 # do the opposite. Return this scale factor in d0.			#
@@ -5462,7 +5462,7 @@
 	andi.w		&0x8000,FP_SCR0_EX(%a6)	# zero src exponent
 	bset		&0x0,1+FP_SCR0_EX(%a6)	# set exp = 1
 
-	mov.l		(%sp)+,%d0		# return SCALE factor	
+	mov.l		(%sp)+,%d0		# return SCALE factor
 	rts
 
 # src exp is >= dst exp; scale src to exp = 0x3fff
@@ -5498,7 +5498,7 @@
 	andi.w		&0x8000,FP_SCR1_EX(%a6)	# zero dst exponent
 	bset		&0x0,1+FP_SCR1_EX(%a6)	# set exp = 1
 
-	mov.l		(%sp)+,%d0		# return SCALE factor	
+	mov.l		(%sp)+,%d0		# return SCALE factor
 	rts
 
 ##########################################################################
@@ -5513,14 +5513,14 @@
 #									#
 # INPUT ***************************************************************	#
 #	FP_SCR0(a6) = extended precision operand to be scaled		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SCR0(a6) = scaled extended precision operand			#
 #	d0	    = scale value					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Set the exponent of the input operand to 0x3fff. Save the value	#
-# of the difference between the original and new exponent. Then, 	#
+#	Set the exponent of the input operand to 0x3fff. Save the value	#
+# of the difference between the original and new exponent. Then,	#
 # normalize the operand if it was a DENORM. Add this normalization	#
 # value to the previous value. Return the result.			#
 #									#
@@ -5566,17 +5566,17 @@
 #									#
 # INPUT ***************************************************************	#
 #	FP_SCR0(a6) = extended precision operand to be scaled		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SCR0(a6) = scaled extended precision operand			#
 #	d0	    = scale value					#
 #									#
 # ALGORITHM ***********************************************************	#
 #	If the input operand is a DENORM, normalize it.			#
-# 	If the exponent of the input operand is even, set the exponent	#
-# to 0x3ffe and return a scale factor of "(exp-0x3ffe)/2". If the 	#
+#	If the exponent of the input operand is even, set the exponent	#
+# to 0x3ffe and return a scale factor of "(exp-0x3ffe)/2". If the	#
 # exponent of the input operand is off, set the exponent to ox3fff and	#
-# return a scale factor of "(exp-0x3fff)/2". 				#
+# return a scale factor of "(exp-0x3fff)/2".				#
 #									#
 #########################################################################
 
@@ -5640,14 +5640,14 @@
 #									#
 # INPUT ***************************************************************	#
 #	FP_SCR1(a6) = extended precision operand to be scaled		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SCR1(a6) = scaled extended precision operand			#
 #	d0	    = scale value					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Set the exponent of the input operand to 0x3fff. Save the value	#
-# of the difference between the original and new exponent. Then, 	#
+#	Set the exponent of the input operand to 0x3fff. Save the value	#
+# of the difference between the original and new exponent. Then,	#
 # normalize the operand if it was a DENORM. Add this normalization	#
 # value to the previous value. Return the result.			#
 #									#
@@ -5695,21 +5695,21 @@
 # INPUT ***************************************************************	#
 #	FP_SRC(a6) = pointer to extended precision src operand		#
 #	FP_DST(a6) = pointer to extended precision dst operand		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default result						#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	If either operand (but not both operands) of an operation is a	#
+#	If either operand (but not both operands) of an operation is a	#
 # nonsignalling NAN, then that NAN is returned as the result. If both	#
-# operands are nonsignalling NANs, then the destination operand 	#
+# operands are nonsignalling NANs, then the destination operand		#
 # nonsignalling NAN is returned as the result.				#
-# 	If either operand to an operation is a signalling NAN (SNAN),	#
+#	If either operand to an operation is a signalling NAN (SNAN),	#
 # then, the SNAN bit is set in the FPSR EXC byte. If the SNAN trap	#
-# enable bit is set in the FPCR, then the trap is taken and the 	#
+# enable bit is set in the FPCR, then the trap is taken and the		#
 # destination is not modified. If the SNAN trap enable bit is not set,	#
-# then the SNAN is converted to a nonsignalling NAN (by setting the 	#
-# SNAN bit in the operand to one), and the operation continues as 	#
+# then the SNAN is converted to a nonsignalling NAN (by setting the	#
+# SNAN bit in the operand to one), and the operation continues as	#
 # described in the preceding paragraph, for nonsignalling NANs.		#
 #	Make sure the appropriate FPSR bits are set before exiting.	#
 #									#
@@ -5748,7 +5748,7 @@
 	lea		FP_DST(%a6), %a0
 	cmp.b		STAG(%a6), &SNAN
 	bne		nan_done
-	or.l		&aiop_mask+snan_mask, USER_FPSR(%a6)	
+	or.l		&aiop_mask+snan_mask, USER_FPSR(%a6)
 nan_done:
 	or.l		&nan_mask, USER_FPSR(%a6)
 nan_comp:
@@ -5761,14 +5761,14 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	res_operr(): return default result during operand error		#
+#	res_operr(): return default result during operand error		#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = default operand error result				#
 #									#
@@ -5776,8 +5776,8 @@
 #	An nonsignalling NAN is returned as the default result when	#
 # an operand error occurs for the following cases:			#
 #									#
-# 	Multiply: (Infinity x Zero)					#
-# 	Divide  : (Zero / Zero) || (Infinity / Infinity)		#
+#	Multiply: (Infinity x Zero)					#
+#	Divide  : (Zero / Zero) || (Infinity / Infinity)		#
 #									#
 #########################################################################
 
@@ -5787,12 +5787,12 @@
 	fmovm.x		nan_return(%pc), &0x80
 	rts
 
-nan_return:	
+nan_return:
 	long		0x7fff0000, 0xffffffff, 0xffffffff
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	_denorm(): denormalize an intermediate result			#
+#	_denorm(): denormalize an intermediate result			#
 #									#
 # XREF ****************************************************************	#
 #	None								#
@@ -5800,7 +5800,7 @@
 # INPUT *************************************************************** #
 #	a0 = points to the operand to be denormalized			#
 #		(in the internal extended format)			#
-#		 							#
+#									#
 #	d0 = rounding precision						#
 #									#
 # OUTPUT **************************************************************	#
@@ -5810,10 +5810,10 @@
 #	d0 = guard,round,sticky						#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	According to the exponent underflow threshold for the given	#
+#	According to the exponent underflow threshold for the given	#
 # precision, shift the mantissa bits to the right in order raise the	#
-# exponent of the operand to the threshold value. While shifting the 	#
-# mantissa bits right, maintain the value of the guard, round, and 	#
+# exponent of the operand to the threshold value. While shifting the	#
+# mantissa bits right, maintain the value of the guard, round, and	#
 # sticky bits.								#
 # other notes:								#
 #	(1) _denorm() is called by the underflow routines		#
@@ -5833,7 +5833,7 @@
 _denorm:
 #
 # Load the exponent threshold for the precision selected and check
-# to see if (threshold - exponent) is > 65 in which case we can 
+# to see if (threshold - exponent) is > 65 in which case we can
 # simply calculate the sticky bit and zero the mantissa. otherwise
 # we have to call the denormalization routine.
 #
@@ -5872,7 +5872,7 @@
 #	%d0{31:29} : initial guard,round,sticky				#
 #	%d1{15:0}  : denormalization threshold				#
 # OUTPUT:								#
-#	%a0	   : points to the denormalized operand		 	#
+#	%a0	   : points to the denormalized operand			#
 #	%d0{31:29} : final guard,round,sticky				#
 #									#
 
@@ -5892,7 +5892,7 @@
 
 #
 # check to see how much less than the underflow threshold the operand
-# exponent is. 
+# exponent is.
 #
 	mov.l		%d1, %d0		# copy the denorm threshold
 	sub.w		FTEMP_EX(%a0), %d1	# d1 = threshold - uns exponent
@@ -5907,7 +5907,7 @@
 # No normalization necessary
 #
 dnrm_no_lp:
-	mov.l		GRS(%a6), %d0 		# restore original g,r,s
+	mov.l		GRS(%a6), %d0		# restore original g,r,s
 	rts
 
 #
@@ -5917,7 +5917,7 @@
 # %d1 = "n" = amt to shift
 #
 #	---------------------------------------------------------
-#	|     FTEMP_HI	  |    	FTEMP_LO     |grs000.........000|
+#	|     FTEMP_HI	  |	FTEMP_LO     |grs000.........000|
 #	---------------------------------------------------------
 #	<-(32 - n)-><-(n)-><-(32 - n)-><-(n)-><-(32 - n)-><-(n)->
 #	\	   \		      \			 \
@@ -5928,7 +5928,7 @@
 #	     \		\		   \		      \
 #	      \		 \		    \		       \
 #	       \	  \		     \			\
-#	<-(n)-><-(32 - n)-><------(32)-------><------(32)------->	
+#	<-(n)-><-(32 - n)-><------(32)-------><------(32)------->
 #	---------------------------------------------------------
 #	|0.....0| NEW_HI  |  NEW_FTEMP_LO     |grs		|
 #	---------------------------------------------------------
@@ -5969,17 +5969,17 @@
 # %d1 = "n" = amt to shift
 #
 #	---------------------------------------------------------
-#	|     FTEMP_HI	  |    	FTEMP_LO     |grs000.........000|
+#	|     FTEMP_HI	  |	FTEMP_LO     |grs000.........000|
 #	---------------------------------------------------------
 #	<-(32 - n)-><-(n)-><-(32 - n)-><-(n)-><-(32 - n)-><-(n)->
 #	\	   \		      \
 #	 \	    \		       \
 #	  \	     \			-------------------
 #	   \	      --------------------		   \
-#	    -------------------	  	  \		    \
-#	     		       \	   \		     \
-#	      		 	\     	    \		      \
-#	       		  	 \	     \		       \
+#	    -------------------		  \		    \
+#			       \	   \		     \
+#				\	    \		      \
+#				 \	     \		       \
 #	<-------(32)------><-(n)-><-(32 - n)-><------(32)------->
 #	---------------------------------------------------------
 #	|0...............0|0....0| NEW_LO     |grs		|
@@ -6050,17 +6050,17 @@
 # case (d1 == 64)
 #
 #	---------------------------------------------------------
-#	|     FTEMP_HI	  |    	FTEMP_LO     |grs000.........000|
+#	|     FTEMP_HI	  |	FTEMP_LO     |grs000.........000|
 #	---------------------------------------------------------
 #	<-------(32)------>
-#	\	   	   \
-#	 \	    	    \
-#	  \	     	     \
-#	   \	      	      ------------------------------
+#	\		   \
+#	 \		    \
+#	  \		     \
+#	   \		      ------------------------------
 #	    -------------------------------		    \
-#	     		       		   \		     \
-#	      		 	     	    \		      \
-#	       		  	 	     \		       \
+#					   \		     \
+#					    \		      \
+#					     \		       \
 #					      <-------(32)------>
 #	---------------------------------------------------------
 #	|0...............0|0................0|grs		|
@@ -6078,17 +6078,17 @@
 # case (d1 == 65)
 #
 #	---------------------------------------------------------
-#	|     FTEMP_HI	  |    	FTEMP_LO     |grs000.........000|
+#	|     FTEMP_HI	  |	FTEMP_LO     |grs000.........000|
 #	---------------------------------------------------------
 #	<-------(32)------>
-#	\	   	   \
-#	 \	    	    \
-#	  \	     	     \
-#	   \	      	      ------------------------------
+#	\		   \
+#	 \		    \
+#	  \		     \
+#	   \		      ------------------------------
 #	    --------------------------------		    \
-#	     		       		    \		     \
-#	      		 	     	     \		      \
-#	       		  	 	      \		       \
+#					    \		     \
+#					     \		      \
+#					      \		       \
 #					       <-------(31)----->
 #	---------------------------------------------------------
 #	|0...............0|0................0|0rs		|
@@ -6136,7 +6136,7 @@
 #	None								#
 #									#
 # INPUT ***************************************************************	#
-#	a0	  = ptr to input operand in internal extended format 	#
+#	a0	  = ptr to input operand in internal extended format	#
 #	d1(hi)    = contains rounding precision:			#
 #			ext = $0000xxxx					#
 #			sgl = $0004xxxx					#
@@ -6167,7 +6167,7 @@
 #
 # ext_grs() looks at the rounding precision and sets the appropriate
 # G,R,S bits.
-# If (G,R,S == 0) then result is exact and round is done, else set 
+# If (G,R,S == 0) then result is exact and round is done, else set
 # the inex flag in status reg and continue.
 #
 	bsr.l		ext_grs			# extract G,R,S
@@ -6213,7 +6213,7 @@
 #	If sign of fp number = 1 (negative), then add 1 to l.	#
 #################################################################
 rnd_mnus:
-	tst.b		FTEMP_SGN(%a0)		# check for sign	
+	tst.b		FTEMP_SGN(%a0)		# check for sign
 	bpl.w		truncate		# if negative then truncate
 
 	mov.l		&0xffffffff, %d0	# force g,r,s to be all f's
@@ -6324,7 +6324,7 @@
 #
 # INPUT
 #	d0	   = extended precision g,r,s (in d0{31:29})
-#	d1 	   = {PREC,ROUND}
+#	d1	   = {PREC,ROUND}
 # OUTPUT
 #	d0{31:29}  = guard, round, sticky
 #
@@ -6375,7 +6375,7 @@
 	mov.l		&30, %d2		# of the sgl prec. limits
 	lsl.l		%d2, %d3		# shift g-r bits to MSB of d3
 	mov.l		FTEMP_HI(%a0), %d2	# get word 2 for s-bit test
-	and.l		&0x0000003f, %d2	# s bit is the or of all other 
+	and.l		&0x0000003f, %d2	# s bit is the or of all other
 	bne.b		ext_grs_st_stky		# bits to the right of g-r
 	tst.l		FTEMP_LO(%a0)		# test lower mantissa
 	bne.b		ext_grs_st_stky		# if any are set, set sticky
@@ -6385,9 +6385,9 @@
 
 #
 # dbl:
-#	96		64	  	32	 11	0
+#	96		64		32	 11	0
 #	-----------------------------------------------------
-#	| EXP	|XXXXXXX|	  	|	 |xx	|grs|
+#	| EXP	|XXXXXXX|		|	 |xx	|grs|
 #	-----------------------------------------------------
 #						  nn\	    /
 #						  ee -------
@@ -6400,7 +6400,7 @@
 	mov.l		&30, %d2		# of the dbl prec. limits
 	lsl.l		%d2, %d3		# shift g-r bits to the MSB of d3
 	mov.l		FTEMP_LO(%a0), %d2	# get lower mantissa  for s-bit test
-	and.l		&0x000001ff, %d2	# s bit is the or-ing of all 
+	and.l		&0x000001ff, %d2	# s bit is the or-ing of all
 	bne.b		ext_grs_st_stky		# other bits to the right of g-r
 	tst.l		%d0			# test word original g,r,s
 	bne.b		ext_grs_st_stky		# if any are set, set sticky
@@ -6430,7 +6430,7 @@
 #	a0 = pointer fp extended precision operand to normalize		#
 #									#
 # OUTPUT ************************************************************** #
-# 	d0 = number of bit positions the mantissa was shifted		#
+#	d0 = number of bit positions the mantissa was shifted		#
 #	a0 = the input operand's mantissa is normalized; the exponent	#
 #	     is unchanged.						#
 #									#
@@ -6457,7 +6457,7 @@
 	mov.l		%d1, FTEMP_LO(%a0)	# store new lo(man)
 
 	mov.l		%d2, %d0		# return shift amount
-	
+
 	mov.l		(%sp)+, %d3		# restore temp regs
 	mov.l		(%sp)+, %d2
 
@@ -6472,7 +6472,7 @@
 	clr.l		FTEMP_LO(%a0)		# lo(man) is now zero
 
 	mov.l		%d2, %d0		# return shift amount
-	
+
 	mov.l		(%sp)+, %d3		# restore temp regs
 	mov.l		(%sp)+, %d2
 
@@ -6577,27 +6577,27 @@
 # whole mantissa is zero so this UNNORM is actually a zero
 #
 unnorm_zero:
-	and.w		&0x8000, FTEMP_EX(%a0) 	# force exponent to zero
+	and.w		&0x8000, FTEMP_EX(%a0)	# force exponent to zero
 
 	mov.b		&ZERO, %d0		# fix optype tag
 	rts
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	set_tag_x(): return the optype of the input ext fp number	#
+#	set_tag_x(): return the optype of the input ext fp number	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of type tag						#
-# 		one of: NORM, INF, QNAN, SNAN, DENORM, UNNORM, ZERO	#
+#		one of: NORM, INF, QNAN, SNAN, DENORM, UNNORM, ZERO	#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Simply test the exponent, j-bit, and mantissa values to 	#
+#	Simply test the exponent, j-bit, and mantissa values to		#
 # determine the type of operand.					#
 #	If it's an unnormalized zero, alter the operand and force it	#
 # to be a normal zero.							#
@@ -6664,20 +6664,20 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	set_tag_d(): return the optype of the input dbl fp number	#
+#	set_tag_d(): return the optype of the input dbl fp number	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = points to double precision operand				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of type tag						#
-# 		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
+#		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Simply test the exponent, j-bit, and mantissa values to 	#
+#	Simply test the exponent, j-bit, and mantissa values to		#
 # determine the type of operand.					#
 #									#
 #########################################################################
@@ -6727,20 +6727,20 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	set_tag_s(): return the optype of the input sgl fp number	#
+#	set_tag_s(): return the optype of the input sgl fp number	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to single precision operand			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of type tag						#
-# 		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
+#		one of: NORM, INF, QNAN, SNAN, DENORM, ZERO		#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Simply test the exponent, j-bit, and mantissa values to 	#
+#	Simply test the exponent, j-bit, and mantissa values to		#
 # determine the type of operand.					#
 #									#
 #########################################################################
@@ -6786,15 +6786,15 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	unf_res(): routine to produce default underflow result of a 	#
-#	 	   scaled extended precision number; this is used by 	#
+#	unf_res(): routine to produce default underflow result of a	#
+#		   scaled extended precision number; this is used by	#
 #		   fadd/fdiv/fmul/etc. emulation routines.		#
-# 	unf_res4(): same as above but for fsglmul/fsgldiv which use	#
+#	unf_res4(): same as above but for fsglmul/fsgldiv which use	#
 #		    single round prec and extended prec mode.		#
 #									#
 # XREF ****************************************************************	#
 #	_denorm() - denormalize according to scale factor		#
-# 	_round() - round denormalized number according to rnd prec	#
+#	_round() - round denormalized number according to rnd prec	#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precison operand			#
@@ -6806,15 +6806,15 @@
 #	d0.b = result FPSR_cc which caller may or may not want to save	#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Convert the input operand to "internal format" which means the	#
+#	Convert the input operand to "internal format" which means the	#
 # exponent is extended to 16 bits and the sign is stored in the unused	#
 # portion of the extended precison operand. Denormalize the number	#
-# according to the scale factor passed in d0. Then, round the 		#
+# according to the scale factor passed in d0. Then, round the		#
 # denormalized result.							#
-# 	Set the FPSR_exc bits as appropriate but return the cc bits in	#
+#	Set the FPSR_exc bits as appropriate but return the cc bits in	#
 # d0 in case the caller doesn't want to save them (as is the case for	#
 # fmove out).								#
-# 	unf_res4() for fsglmul/fsgldiv forces the denorm to extended	#
+#	unf_res4() for fsglmul/fsgldiv forces the denorm to extended	#
 # precision and the rounding mode to single.				#
 #									#
 #########################################################################
@@ -6952,23 +6952,23 @@
 #	none								#
 #									#
 # INPUT ***************************************************************	#
-#	d1.b 	= '-1' => (-); '0' => (+)				#
+#	d1.b	= '-1' => (-); '0' => (+)				#
 #   ovf_res():								#
-#	d0 	= rnd mode/prec						#
+#	d0	= rnd mode/prec						#
 #   ovf_res2():								#
-#	hi(d0) 	= rnd prec						#
+#	hi(d0)	= rnd prec						#
 #	lo(d0)	= rnd mode						#
 #									#
 # OUTPUT **************************************************************	#
-#	a0   	= points to extended precision result			#
-#	d0.b 	= condition code bits					#
+#	a0	= points to extended precision result			#
+#	d0.b	= condition code bits					#
 #									#
 # ALGORITHM ***********************************************************	#
 #	The default overflow result can be determined by the sign of	#
 # the result and the rounding mode/prec in effect. These bits are	#
-# concatenated together to create an index into the default result 	#
+# concatenated together to create an index into the default result	#
 # table. A pointer to the correct result is returned in a0. The		#
-# resulting condition codes are returned in d0 in case the caller 	#
+# resulting condition codes are returned in d0 in case the caller	#
 # doesn't want FPSR_cc altered (as is the case for fmove out).		#
 #									#
 #########################################################################
@@ -6998,7 +6998,7 @@
 ovf_res_load:
 	mov.b		(tbl_ovfl_cc.b,%pc,%d0.w*1), %d0 # fetch result ccodes
 	lea		(tbl_ovfl_result.b,%pc,%d1.w*8), %a0 # return result ptr
-	
+
 	rts
 
 tbl_ovfl_cc:
@@ -7048,7 +7048,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fout(): move from fp register to memory or data register	#
+#	fout(): move from fp register to memory or data register	#
 #									#
 # XREF ****************************************************************	#
 #	_round() - needed to create EXOP for sgl/dbl precision		#
@@ -7068,7 +7068,7 @@
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
 #	d0 = round prec,mode						#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 : intermediate underflow or overflow result if		#
 #	      OVFL/UNFL occurred for a sgl or dbl operand		#
@@ -7087,9 +7087,9 @@
 # w/ the address index register as appropriate w/ _calc_ea_fout(). If	#
 # the source is a denorm and if underflow is enabled, an EXOP must be	#
 # created.								#
-# 	For packed, the k-factor must be fetched from the instruction	#
-# word or a data register. The <ea> must be fixed as w/ extended 	#
-# precision. Then, bindec() is called to create the appropriate 	#
+#	For packed, the k-factor must be fetched from the instruction	#
+# word or a data register. The <ea> must be fixed as w/ extended	#
+# precision. Then, bindec() is called to create the appropriate		#
 # packed result.							#
 #	If at any time an access error is flagged by one of the move-	#
 # to-memory routines, then a special exit must be made so that the	#
@@ -7205,7 +7205,7 @@
 	ori.l		&0x00800000,%d1		# make smallest sgl
 	fmov.s		%d1,%fp0
 	bra.b		fout_word_norm
-	
+
 #################################################################
 # fmove.l out ###################################################
 #################################################################
@@ -7279,7 +7279,7 @@
 	mov.l		&0xc,%d0		# pass: opsize is 12 bytes
 
 # we must not yet write the extended precision data to the stack
-# in the pre-decrement case from supervisor mode or else we'll corrupt 
+# in the pre-decrement case from supervisor mode or else we'll corrupt
 # the stack frame. so, leave it in FP_SRC for now and deal with it later...
 	cmpi.b		SPCOND_FLG(%a6),&mda7_flg
 	beq.b		fout_ext_a7
@@ -7366,7 +7366,7 @@
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fmov.l		%fpsr,%d1		# save FPSR
 
-	or.w		%d1,2+USER_FPSR(%a6) 	# set possible inex2/ainex
+	or.w		%d1,2+USER_FPSR(%a6)	# set possible inex2/ainex
 
 fout_sgl_exg_write:
 	mov.b		1+EXC_OPWORD(%a6),%d1	# extract dst mode
@@ -7407,7 +7407,7 @@
 
 	lea		FP_SCR0(%a6),%a0
 	bsr.l		norm			# normalize the DENORM
-	
+
 fout_sgl_unfl_cont:
 	lea		FP_SCR0(%a6),%a0	# pass: ptr to operand
 	mov.l		L_SCR3(%a6),%d1		# pass: rnd prec,mode
@@ -7458,7 +7458,7 @@
 
 # call ovf_res() w/ sgl prec and the correct rnd mode to create the default
 # overflow result. DON'T save the returned ccodes from ovf_res() since
-# fmove out doesn't alter them. 
+# fmove out doesn't alter them.
 	tst.b		SRC_EX(%a0)		# is operand negative?
 	smi		%d1			# set if so
 	mov.l		L_SCR3(%a6),%d0		# pass: sgl prec,rnd mode
@@ -7513,7 +7513,7 @@
 
 	fabs.x		%fp0			# need absolute value
 	fcmp.b		%fp0,&0x2		# did exponent increase?
-	fblt.w		fout_sgl_exg		# no; go finish NORM	
+	fblt.w		fout_sgl_exg		# no; go finish NORM
 	bra.w		fout_sgl_ovfl		# yes; go handle overflow
 
 ################
@@ -7604,7 +7604,7 @@
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fmov.l		%fpsr,%d0		# save FPSR
 
-	or.w		%d0,2+USER_FPSR(%a6) 	# set possible inex2/ainex
+	or.w		%d0,2+USER_FPSR(%a6)	# set possible inex2/ainex
 
 	mov.l		EXC_EA(%a6),%a1		# pass: dst addr
 	lea		L_SCR1(%a6),%a0		# pass: src addr
@@ -7614,7 +7614,7 @@
 	tst.l		%d1			# did dstore fail?
 	bne.l		facc_out_d		# yes
 
-	rts					# no; so we're finished	
+	rts					# no; so we're finished
 
 #
 # here, we know that the operand would UNFL if moved out to double prec,
@@ -7636,7 +7636,7 @@
 
 	lea		FP_SCR0(%a6),%a0
 	bsr.l		norm			# normalize the DENORM
-	
+
 fout_dbl_unfl_cont:
 	lea		FP_SCR0(%a6),%a0	# pass: ptr to operand
 	mov.l		L_SCR3(%a6),%d1		# pass: rnd prec,mode
@@ -7679,7 +7679,7 @@
 
 # call ovf_res() w/ dbl prec and the correct rnd mode to create the default
 # overflow result. DON'T save the returned ccodes from ovf_res() since
-# fmove out doesn't alter them. 
+# fmove out doesn't alter them.
 	tst.b		SRC_EX(%a0)		# is operand negative?
 	smi		%d1			# set if so
 	mov.l		L_SCR3(%a6),%d0		# pass: dbl prec,rnd mode
@@ -7724,19 +7724,19 @@
 
 	fabs.x		%fp0			# need absolute value
 	fcmp.b		%fp0,&0x2		# did exponent increase?
-	fblt.w		fout_dbl_exg		# no; go finish NORM	
+	fblt.w		fout_dbl_exg		# no; go finish NORM
 	bra.w		fout_dbl_ovfl		# yes; go handle overflow
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	dst_dbl(): create double precision value from extended prec.	#
+#	dst_dbl(): create double precision value from extended prec.	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to source operand in extended precision		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = hi(double precision result)				#
 #	d1 = lo(double precision result)				#
@@ -7750,18 +7750,18 @@
 #	get rid of ext integer bit					#
 #	dbl_mant = ext_mant{62:12}					#
 #									#
-#	    	---------------   ---------------    ---------------	#
+#		---------------   ---------------    ---------------	#
 #  extended ->  |s|    exp    |   |1| ms mant   |    | ls mant     |	#
-#	    	---------------   ---------------    ---------------	#
-#	   	 95	    64    63 62	      32      31     11	  0	#
+#		---------------   ---------------    ---------------	#
+#		 95	    64    63 62	      32      31     11	  0	#
 #				     |			     |		#
 #				     |			     |		#
 #				     |			     |		#
-#		 	             v   		     v		#
-#	    		      ---------------   ---------------		#
-#  double   ->  	      |s|exp| mant  |   |  mant       |		#
-#	    		      ---------------   ---------------		#
-#	   	 	      63     51   32   31	       0	#
+#			             v			     v		#
+#			      ---------------   ---------------		#
+#  double   ->		      |s|exp| mant  |   |  mant       |		#
+#			      ---------------   ---------------		#
+#			      63     51   32   31	       0	#
 #									#
 #########################################################################
 
@@ -7797,13 +7797,13 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	dst_sgl(): create single precision value from extended prec	#
+#	dst_sgl(): create single precision value from extended prec	#
 #									#
 # XREF ****************************************************************	#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to source operand in extended precision		#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = single precision result					#
 #									#
@@ -7815,18 +7815,18 @@
 #	get rid of ext integer bit					#
 #	sgl_mant = ext_mant{62:12}					#
 #									#
-#	    	---------------   ---------------    ---------------	#
+#		---------------   ---------------    ---------------	#
 #  extended ->  |s|    exp    |   |1| ms mant   |    | ls mant     |	#
-#	    	---------------   ---------------    ---------------	#
-#	   	 95	    64    63 62	   40 32      31     12	  0	#
+#		---------------   ---------------    ---------------	#
+#		 95	    64    63 62	   40 32      31     12	  0	#
 #				     |	   |				#
 #				     |	   |				#
 #				     |	   |				#
-#		 	             v     v				#
-#	    		      ---------------				#
-#  single   ->  	      |s|exp| mant  |				#
-#	    		      ---------------				#
-#	   	 	      31     22     0				#
+#			             v     v				#
+#			      ---------------				#
+#  single   ->		      |s|exp| mant  |				#
+#			      ---------------				#
+#			      31     22     0				#
 #									#
 #########################################################################
 
@@ -7899,7 +7899,7 @@
 # add the extra condition that only if the k-factor was zero, too, should
 # we zero the exponent
 	tst.l		%d0
-	bne.b		fout_pack_set	
+	bne.b		fout_pack_set
 # "mantissa" is all zero which means that the answer is zero. but, the '040
 # algorithm allows the exponent to be non-zero. the 881/2 do not. therefore,
 # if the mantissa is zero, I will zero the exponent, too.
@@ -7951,7 +7951,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fmul(): emulates the fmul instruction				#
+#	fmul(): emulates the fmul instruction				#
 #	fsmul(): emulates the fsmul instruction				#
 #	fdmul(): emulates the fdmul instruction				#
 #									#
@@ -7960,8 +7960,8 @@
 #	scale_to_zero_dst() - scale dst exponent to zero		#
 #	unf_res() - return default underflow result			#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan() - return QNAN result					#
-# 	res_snan() - return SNAN result					#
+#	res_qnan() - return QNAN result					#
+#	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -7979,12 +7979,12 @@
 # instruction won't cause an exception. Use the regular fmul to		#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
 
-	align 		0x10
+	align		0x10
 tbl_fmul_ovfl:
 	long		0x3fff - 0x7ffe		# ext_max
 	long		0x3fff - 0x407e		# sgl_max
@@ -8045,7 +8045,7 @@
 #
 # NORMAL:
 # - the result of the multiply operation will neither overflow nor underflow.
-# - do the multiply to the proper precision and rounding mode. 
+# - do the multiply to the proper precision and rounding mode.
 # - scale the result exponent using the scale factor. if both operands were
 # normalized then we really don't need to go through this scaling. but for now,
 # this will do.
@@ -8056,7 +8056,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -8096,7 +8096,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -8175,7 +8175,7 @@
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
 	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply
-	
+
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
 
@@ -8184,7 +8184,7 @@
 	fabs.x		%fp0,%fp1		# make a copy of result
 	fcmp.b		%fp1,&0x2		# is |result| >= 2.b?
 	fbge.w		fmul_ovfl_tst		# yes; overflow has occurred
-	
+
 # no, it didn't overflow; we have correct result
 	bra.w		fmul_normal_exit
 
@@ -8201,7 +8201,7 @@
 # of this operation then has its exponent scaled by -0x6000 to create the
 # exceptional operand.
 #
-fmul_unfl:	
+fmul_unfl:
 	bset		&unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
 
 # for fun, let's use only extended precision, round to zero. then, let
@@ -8234,7 +8234,7 @@
 	rts
 
 #
-# UNFL is enabled. 
+# UNFL is enabled.
 #
 fmul_unfl_ena:
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op
@@ -8250,7 +8250,7 @@
 fmul_unfl_ena_cont:
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp1	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp1	# execute multiply
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 
@@ -8285,7 +8285,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp0	# execute multiply
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -8309,11 +8309,11 @@
 	mov.l		L_SCR3(%a6),%d1
 	andi.b		&0xc0,%d1		# keep rnd prec
 	ori.b		&rz_mode*0x10,%d1	# insert RZ
-	
+
 	fmov.l		%d1,%fpcr		# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fmul.x		FP_SCR0(%a6),%fp1	# execute multiply	
+	fmul.x		FP_SCR0(%a6),%fp1	# execute multiply
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fabs.x		%fp1			# make absolute value
@@ -8455,22 +8455,22 @@
 #	norm() - normalize mantissa for EXOP on denorm			#
 #	scale_to_zero_src() - scale src exponent to zero		#
 #	ovf_res() - return default overflow result			#
-# 	unf_res() - return default underflow result			#
+#	unf_res() - return default underflow result			#
 #	res_qnan_1op() - return QNAN result				#
 #	res_snan_1op() - return SNAN result				#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
 #	d0 = round prec/mode						#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	fp0 = result							#
 #	fp1 = EXOP (if exception occurred)				#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Handle NANs, infinities, and zeroes as special cases. Divide	#
+#	Handle NANs, infinities, and zeroes as special cases. Divide	#
 # norms into extended, single, and double precision.			#
-# 	Norms can be emulated w/ a regular fmove instruction. For	#
+#	Norms can be emulated w/ a regular fmove instruction. For	#
 # sgl/dbl, must scale exponent and perform an "fmove". Check to see	#
 # if the result would have overflowed/underflowed. If so, use unf_res()	#
 # or ovf_res() to return the default result. Also return EXOP if	#
@@ -8496,7 +8496,7 @@
 
 	mov.b		STAG(%a6),%d1		# fetch src optype tag
 	bne.w		fin_not_norm		# optimize on non-norm input
-		
+
 #
 # FP MOVE IN: NORMs and DENORMs ONLY!
 #
@@ -8557,9 +8557,9 @@
 
 #
 # operand is to be rounded to single or double precision
-#	
+#
 fin_not_ext:
-	cmpi.b		%d0,&s_mode*0x10 	# separate sgl/dbl prec
+	cmpi.b		%d0,&s_mode*0x10	# separate sgl/dbl prec
 	bne.b		fin_dbl
 
 #
@@ -8643,10 +8643,10 @@
 	bsr.l		unf_res			# calculate default result
 	or.b		%d0,FPSR_CC(%a6)	# unf_res may have set 'Z'
 	fmovm.x		FP_SCR0(%a6),&0x80	# return default result in fp0
-	rts	
+	rts
 
 #
-# operand will underflow AND underflow or inexact is enabled. 
+# operand will underflow AND underflow or inexact is enabled.
 # therefore, we must return the result rounded to extended precision.
 #
 fin_sd_unfl_ena:
@@ -8768,7 +8768,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fdiv(): emulates the fdiv instruction				#
+#	fdiv(): emulates the fdiv instruction				#
 #	fsdiv(): emulates the fsdiv instruction				#
 #	fddiv(): emulates the fddiv instruction				#
 #									#
@@ -8777,8 +8777,8 @@
 #	scale_to_zero_dst() - scale dst exponent to zero		#
 #	unf_res() - return default underflow result			#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan() - return QNAN result					#
-# 	res_snan() - return SNAN result					#
+#	res_qnan() - return QNAN result					#
+#	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -8796,7 +8796,7 @@
 # instruction won't cause an exception. Use the regular fdiv to		#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
@@ -8833,7 +8833,7 @@
 	or.b		STAG(%a6),%d1		# combine src tags
 
 	bne.w		fdiv_not_norm		# optimize on non-norm input
-		
+
 #
 # DIVIDE: NORMs and DENORMs ONLY!
 #
@@ -8899,7 +8899,7 @@
 fdiv_no_ovfl:
 	mov.l		(%sp)+,%d0		# restore scale factor
 	bra.b		fdiv_normal_exit
-	
+
 fdiv_may_ovfl:
 	mov.l		%d0,-(%sp)		# save scale factor
 
@@ -8932,7 +8932,7 @@
 	bne.b		fdiv_ovfl_ena		# yes
 
 fdiv_ovfl_dis:
-	btst		&neg_bit,FPSR_CC(%a6) 	# is result negative?
+	btst		&neg_bit,FPSR_CC(%a6)	# is result negative?
 	sne		%d1			# set sign param accordingly
 	mov.l		L_SCR3(%a6),%d0		# pass prec:rnd
 	bsr.l		ovf_res			# calculate default result
@@ -9004,7 +9004,7 @@
 	rts
 
 #
-# UNFL is enabled. 
+# UNFL is enabled.
 #
 fdiv_unfl_ena:
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op
@@ -9068,8 +9068,8 @@
 #
 # we still don't know if underflow occurred. result is ~ equal to 1. but,
 # we don't know if the result was an underflow that rounded up to a 1
-# or a normalized number that rounded down to a 1. so, redo the entire 
-# operation using RZ as the rounding mode to see what the pre-rounded 
+# or a normalized number that rounded down to a 1. so, redo the entire
+# operation using RZ as the rounding mode to see what the pre-rounded
 # result is. this case should be relatively rare.
 #
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op into fp1
@@ -9196,8 +9196,8 @@
 	rts
 
 #
-# The destination was an INF w/ an In Range or ZERO source, the result is 
-# an INF w/ the proper sign. 
+# The destination was an INF w/ an In Range or ZERO source, the result is
+# an INF w/ the proper sign.
 # The 68881/882 returns the destination INF w/ the new sign(if the j-bit of the
 # dst INF is set, then then j-bit of the result INF is also set).
 #
@@ -9227,11 +9227,11 @@
 #	fdneg(): emulates the fdneg instruction				#
 #									#
 # XREF ****************************************************************	#
-# 	norm() - normalize a denorm to provide EXOP			#
+#	norm() - normalize a denorm to provide EXOP			#
 #	scale_to_zero_src() - scale sgl/dbl source exponent		#
 #	ovf_res() - return default overflow result			#
 #	unf_res() - return default underflow result			#
-# 	res_qnan_1op() - return QNAN result				#
+#	res_qnan_1op() - return QNAN result				#
 #	res_snan_1op() - return SNAN result				#
 #									#
 # INPUT ***************************************************************	#
@@ -9269,7 +9269,7 @@
 	mov.l		%d0,L_SCR3(%a6)		# store rnd info
 	mov.b		STAG(%a6),%d1
 	bne.w		fneg_not_norm		# optimize on non-norm input
-		
+
 #
 # NEGATE SIGN : norms and denorms ONLY!
 #
@@ -9328,7 +9328,7 @@
 	neg.w		%d0			# new exponent = -(shft val)
 	addi.w		&0x6000,%d0		# add new bias to exponent
 	mov.w		FP_SCR0_EX(%a6),%d1	# fetch old sign,exp
-	andi.w		&0x8000,%d1	 	# keep old sign
+	andi.w		&0x8000,%d1		# keep old sign
 	andi.w		&0x7fff,%d0		# clear sign position
 	or.w		%d1,%d0			# concat old sign, new exponent
 	mov.w		%d0,FP_SCR0_EX(%a6)	# insert new exponent
@@ -9407,7 +9407,7 @@
 fneg_sd_unfl:
 	bset		&unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
 
-	eori.b		&0x80,FP_SCR0_EX(%a6)	# negate sign	
+	eori.b		&0x80,FP_SCR0_EX(%a6)	# negate sign
 	bpl.b		fneg_sd_unfl_tst
 	bset		&neg_bit,FPSR_CC(%a6)	# set 'N' ccode bit
 
@@ -9423,10 +9423,10 @@
 	bsr.l		unf_res			# calculate default result
 	or.b		%d0,FPSR_CC(%a6)	# unf_res may have set 'Z'
 	fmovm.x		FP_SCR0(%a6),&0x80	# return default result in fp0
-	rts	
+	rts
 
 #
-# operand will underflow AND underflow is enabled. 
+# operand will underflow AND underflow is enabled.
 # therefore, we must return the result rounded to extended precision.
 #
 fneg_sd_unfl_ena:
@@ -9548,19 +9548,19 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	ftst(): emulates the ftest instruction				#
+#	ftst(): emulates the ftest instruction				#
 #									#
 # XREF ****************************************************************	#
-# 	res{s,q}nan_1op() - set NAN result for monadic instruction	#
+#	res{s,q}nan_1op() - set NAN result for monadic instruction	#
 #									#
 # INPUT ***************************************************************	#
-# 	a0 = pointer to extended precision source operand		#
+#	a0 = pointer to extended precision source operand		#
 #									#
 # OUTPUT **************************************************************	#
 #	none								#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Check the source operand tag (STAG) and set the FPCR according	#
+#	Check the source operand tag (STAG) and set the FPCR according	#
 # to the operand type and sign.						#
 #									#
 #########################################################################
@@ -9569,7 +9569,7 @@
 ftst:
 	mov.b		STAG(%a6),%d1
 	bne.b		ftst_not_norm		# optimize on non-norm input
-		
+
 #
 # Norm:
 #
@@ -9617,7 +9617,7 @@
 ftst_inf_m:
 	mov.b		&inf_bmask+neg_bmask,FPSR_CC(%a6) # set 'I','N' ccode bits
 	rts
-	
+
 #
 # Zero:
 #
@@ -9646,13 +9646,13 @@
 #	fp0 = result							#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Separate according to operand type. Unnorms don't pass through 	#
-# here. For norms, load the rounding mode/prec, execute a "fint", then 	#
+#	Separate according to operand type. Unnorms don't pass through	#
+# here. For norms, load the rounding mode/prec, execute a "fint", then	#
 # store the resulting FPSR bits.					#
-# 	For denorms, force the j-bit to a one and do the same as for	#
-# norms. Denorms are so low that the answer will either be a zero or a 	#
+#	For denorms, force the j-bit to a one and do the same as for	#
+# norms. Denorms are so low that the answer will either be a zero or a	#
 # one.									#
-# 	For zeroes/infs/NANs, return the same while setting the FPSR	#
+#	For zeroes/infs/NANs, return the same while setting the FPSR	#
 # as appropriate.							#
 #									#
 #########################################################################
@@ -9661,7 +9661,7 @@
 fint:
 	mov.b		STAG(%a6),%d1
 	bne.b		fint_not_norm		# optimize on non-norm input
-		
+
 #
 # Norm:
 #
@@ -9671,7 +9671,7 @@
 	fmov.l		%d0,%fpcr		# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fint.x 		SRC(%a0),%fp0		# execute fint
+	fint.x		SRC(%a0),%fp0		# execute fint
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fmov.l		%fpsr,%d0		# save FPSR
@@ -9749,16 +9749,16 @@
 #	d0 = round precision/mode					#
 #									#
 # OUTPUT **************************************************************	#
-# 	fp0 = result							#
+#	fp0 = result							#
 #									#
 # ALGORITHM ***********************************************************	#
 #	Separate according to operand type. Unnorms don't pass through	#
-# here. For norms, load the rounding mode/prec, execute a "fintrz", 	#
+# here. For norms, load the rounding mode/prec, execute a "fintrz",	#
 # then store the resulting FPSR bits.					#
-# 	For denorms, force the j-bit to a one and do the same as for	#
+#	For denorms, force the j-bit to a one and do the same as for	#
 # norms. Denorms are so low that the answer will either be a zero or a	#
 # one.									#
-# 	For zeroes/infs/NANs, return the same while setting the FPSR	#
+#	For zeroes/infs/NANs, return the same while setting the FPSR	#
 # as appropriate.							#
 #									#
 #########################################################################
@@ -9767,7 +9767,7 @@
 fintrz:
 	mov.b		STAG(%a6),%d1
 	bne.b		fintrz_not_norm		# optimize on non-norm input
-		
+
 #
 # Norm:
 #
@@ -9862,17 +9862,17 @@
 #									#
 # ALGORITHM ***********************************************************	#
 #	Handle NANs, infinities, and zeroes as special cases. Divide	#
-# norms into extended, single, and double precision. 			#
-# 	Simply clear sign for extended precision norm. Ext prec denorm	#
+# norms into extended, single, and double precision.			#
+#	Simply clear sign for extended precision norm. Ext prec denorm	#
 # gets an EXOP created for it since it's an underflow.			#
 #	Double and single precision can overflow and underflow. First,	#
 # scale the operand such that the exponent is zero. Perform an "fabs"	#
-# using the correct rnd mode/prec. Check to see if the original 	#
+# using the correct rnd mode/prec. Check to see if the original		#
 # exponent would take an exception. If so, use unf_res() or ovf_res()	#
 # to calculate the default result. Also, create the EXOP for the	#
-# exceptional case. If no exception should occur, insert the correct 	#
+# exceptional case. If no exception should occur, insert the correct	#
 # result exponent and return.						#
-# 	Unnorms don't pass through here.				#
+#	Unnorms don't pass through here.				#
 #									#
 #########################################################################
 
@@ -9892,7 +9892,7 @@
 	mov.l		%d0,L_SCR3(%a6)		# store rnd info
 	mov.b		STAG(%a6),%d1
 	bne.w		fabs_not_norm		# optimize on non-norm input
-		
+
 #
 # ABSOLUTE VALUE: norms and denorms ONLY!
 #
@@ -10038,10 +10038,10 @@
 	bsr.l		unf_res			# calculate default result
 	or.b		%d0,FPSR_CC(%a6)	# set possible 'Z' ccode
 	fmovm.x		FP_SCR0(%a6),&0x80	# return default result in fp0
-	rts	
+	rts
 
 #
-# operand will underflow AND underflow is enabled. 
+# operand will underflow AND underflow is enabled.
 # therefore, we must return the result rounded to extended precision.
 #
 fabs_sd_unfl_ena:
@@ -10163,10 +10163,10 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fcmp(): fp compare op routine					#
+#	fcmp(): fp compare op routine					#
 #									#
 # XREF ****************************************************************	#
-# 	res_qnan() - return QNAN result					#
+#	res_qnan() - return QNAN result					#
 #	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
@@ -10178,7 +10178,7 @@
 #	None								#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Handle NANs and denorms as special cases. For everything else,	#
+#	Handle NANs and denorms as special cases. For everything else,	#
 # just use the actual fcmp instruction to produce the correct condition	#
 # codes.								#
 #									#
@@ -10191,14 +10191,14 @@
 	lsl.b		&0x3,%d1
 	or.b		STAG(%a6),%d1
 	bne.b		fcmp_not_norm		# optimize on non-norm input
-		
+
 #
 # COMPARE FP OPs : NORMs, ZEROs, INFs, and "corrected" DENORMs
 #
 fcmp_norm:
 	fmovm.x		DST(%a1),&0x80		# load dst op
 
-	fcmp.x 		%fp0,SRC(%a0)		# do compare
+	fcmp.x		%fp0,SRC(%a0)		# do compare
 
 	fmov.l		%fpsr,%d0		# save FPSR
 	rol.l		&0x8,%d0		# extract ccode bits
@@ -10219,7 +10219,7 @@
 	short		fcmp_norm	- tbl_fcmp_op # NORM - ZERO
 	short		fcmp_norm	- tbl_fcmp_op # NORM - INF
 	short		fcmp_res_qnan	- tbl_fcmp_op # NORM - QNAN
-	short		fcmp_nrm_dnrm 	- tbl_fcmp_op # NORM - DENORM
+	short		fcmp_nrm_dnrm	- tbl_fcmp_op # NORM - DENORM
 	short		fcmp_res_snan	- tbl_fcmp_op # NORM - SNAN
 	short		tbl_fcmp_op	- tbl_fcmp_op #
 	short		tbl_fcmp_op	- tbl_fcmp_op #
@@ -10281,8 +10281,8 @@
 	rts
 
 #
-# DENORMs are a little more difficult. 
-# If you have a 2 DENORMs, then you can just force the j-bit to a one 
+# DENORMs are a little more difficult.
+# If you have a 2 DENORMs, then you can just force the j-bit to a one
 # and use the fcmp_norm routine.
 # If you have a DENORM and an INF or ZERO, just force the DENORM's j-bit to a one
 # and use the fcmp_norm routine.
@@ -10323,7 +10323,7 @@
 	mov.l		SRC_LO(%a0),FP_SCR0_LO(%a6)
 	lea		FP_SCR1(%a6),%a1
 	lea		FP_SCR0(%a6),%a0
-	bra.w		fcmp_norm	
+	bra.w		fcmp_norm
 
 fcmp_nrm_dnrm:
 	mov.b		SRC_EX(%a0),%d0		# determine if like signs
@@ -10355,15 +10355,15 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fsglmul(): emulates the fsglmul instruction			#
+#	fsglmul(): emulates the fsglmul instruction			#
 #									#
 # XREF ****************************************************************	#
 #	scale_to_zero_src() - scale src exponent to zero		#
 #	scale_to_zero_dst() - scale dst exponent to zero		#
 #	unf_res4() - return default underflow result for sglop		#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan() - return QNAN result					#
-# 	res_snan() - return SNAN result					#
+#	res_qnan() - return QNAN result					#
+#	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -10381,7 +10381,7 @@
 # instruction won't cause an exception. Use the regular fsglmul to	#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
@@ -10413,11 +10413,11 @@
 
 	add.l		(%sp)+,%d0		# SCALE_FACTOR = scale1 + scale2
 
-	cmpi.l		%d0,&0x3fff-0x7ffe 	# would result ovfl?
+	cmpi.l		%d0,&0x3fff-0x7ffe	# would result ovfl?
 	beq.w		fsglmul_may_ovfl	# result may rnd to overflow
 	blt.w		fsglmul_ovfl		# result will overflow
 
-	cmpi.l		%d0,&0x3fff+0x0001 	# would result unfl?
+	cmpi.l		%d0,&0x3fff+0x0001	# would result unfl?
 	beq.w		fsglmul_may_unfl	# result may rnd to no unfl
 	bgt.w		fsglmul_unfl		# result will underflow
 
@@ -10504,7 +10504,7 @@
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
 	fsglmul.x	FP_SCR0(%a6),%fp0	# execute sgl multiply
-	
+
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
 
@@ -10513,7 +10513,7 @@
 	fabs.x		%fp0,%fp1		# make a copy of result
 	fcmp.b		%fp1,&0x2		# is |result| >= 2.b?
 	fbge.w		fsglmul_ovfl_tst	# yes; overflow has occurred
-	
+
 # no, it didn't overflow; we have correct result
 	bra.w		fsglmul_normal_exit
 
@@ -10547,7 +10547,7 @@
 	rts
 
 #
-# UNFL is enabled. 
+# UNFL is enabled.
 #
 fsglmul_unfl_ena:
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op
@@ -10555,7 +10555,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fsglmul.x	FP_SCR0(%a6),%fp1	# execute sgl multiply	
+	fsglmul.x	FP_SCR0(%a6),%fp1	# execute sgl multiply
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 
@@ -10580,7 +10580,7 @@
 	fmov.l		L_SCR3(%a6),%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fsglmul.x	FP_SCR0(%a6),%fp0	# execute sgl multiply	
+	fsglmul.x	FP_SCR0(%a6),%fp0	# execute sgl multiply
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -10604,11 +10604,11 @@
 	mov.l		L_SCR3(%a6),%d1
 	andi.b		&0xc0,%d1		# keep rnd prec
 	ori.b		&rz_mode*0x10,%d1	# insert RZ
-	
+
 	fmov.l		%d1,%fpcr		# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fsglmul.x	FP_SCR0(%a6),%fp1	# execute sgl multiply	
+	fsglmul.x	FP_SCR0(%a6),%fp1	# execute sgl multiply
 
 	fmov.l		&0x0,%fpcr		# clear FPCR
 	fabs.x		%fp1			# make absolute value
@@ -10696,15 +10696,15 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fsgldiv(): emulates the fsgldiv instruction			#
+#	fsgldiv(): emulates the fsgldiv instruction			#
 #									#
 # XREF ****************************************************************	#
 #	scale_to_zero_src() - scale src exponent to zero		#
 #	scale_to_zero_dst() - scale dst exponent to zero		#
 #	unf_res4() - return default underflow result for sglop		#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan() - return QNAN result					#
-# 	res_snan() - return SNAN result					#
+#	res_qnan() - return QNAN result					#
+#	res_snan() - return SNAN result					#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -10722,7 +10722,7 @@
 # instruction won't cause an exception. Use the regular fsgldiv to	#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
@@ -10737,7 +10737,7 @@
 	or.b		STAG(%a6),%d1		# combine src tags
 
 	bne.w		fsgldiv_not_norm	# optimize on non-norm input
-		
+
 #
 # DIVIDE: NORMs and DENORMs ONLY!
 #
@@ -10764,7 +10764,7 @@
 	cmpi.l		%d0,&0x3fff-0x7ffe
 	ble.w		fsgldiv_may_ovfl
 
-	cmpi.l		%d0,&0x3fff-0x0000 	# will result underflow?
+	cmpi.l		%d0,&0x3fff-0x0000	# will result underflow?
 	beq.w		fsgldiv_may_unfl	# maybe
 	bgt.w		fsgldiv_unfl		# yes; go handle underflow
 
@@ -10824,7 +10824,7 @@
 	bne.b		fsgldiv_ovfl_ena	# yes
 
 fsgldiv_ovfl_dis:
-	btst		&neg_bit,FPSR_CC(%a6) 	# is result negative
+	btst		&neg_bit,FPSR_CC(%a6)	# is result negative
 	sne		%d1			# set sign param accordingly
 	mov.l		L_SCR3(%a6),%d0		# pass prec:rnd
 	andi.b		&0x30,%d0		# kill precision
@@ -10880,7 +10880,7 @@
 	rts
 
 #
-# UNFL is enabled. 
+# UNFL is enabled.
 #
 fsgldiv_unfl_ena:
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op
@@ -10931,8 +10931,8 @@
 #
 # we still don't know if underflow occurred. result is ~ equal to 1. but,
 # we don't know if the result was an underflow that rounded up to a 1
-# or a normalized number that rounded down to a 1. so, redo the entire 
-# operation using RZ as the rounding mode to see what the pre-rounded 
+# or a normalized number that rounded down to a 1. so, redo the entire
+# operation using RZ as the rounding mode to see what the pre-rounded
 # result is. this case should be relatively rare.
 #
 	fmovm.x		FP_SCR1(%a6),&0x40	# load dst op into %fp1
@@ -11036,25 +11036,25 @@
 #	fdadd(): emulates the fdadd instruction				#
 #									#
 # XREF ****************************************************************	#
-# 	addsub_scaler2() - scale the operands so they won't take exc	#
+#	addsub_scaler2() - scale the operands so they won't take exc	#
 #	ovf_res() - return default overflow result			#
 #	unf_res() - return default underflow result			#
 #	res_qnan() - set QNAN result					#
-# 	res_snan() - set SNAN result					#
+#	res_snan() - set SNAN result					#
 #	res_operr() - set OPERR result					#
 #	scale_to_zero_src() - set src operand exponent equal to zero	#
 #	scale_to_zero_dst() - set dst operand exponent equal to zero	#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
-# 	a1 = pointer to extended precision destination operand		#
+#	a1 = pointer to extended precision destination operand		#
 #									#
 # OUTPUT **************************************************************	#
 #	fp0 = result							#
 #	fp1 = EXOP (if exception occurred)				#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Handle NANs, infinities, and zeroes as special cases. Divide	#
+#	Handle NANs, infinities, and zeroes as special cases. Divide	#
 # norms into extended, single, and double precision.			#
 #	Do addition after scaling exponents such that exception won't	#
 # occur. Then, check result exponent to see if exception would have	#
@@ -11268,7 +11268,7 @@
 
 #
 # result is equal to the smallest normalized number in the selected precision
-# if the precision is extended, this result could not have come from an 
+# if the precision is extended, this result could not have come from an
 # underflow that rounded up.
 #
 fadd_may_unfl:
@@ -11290,7 +11290,7 @@
 # ok, so now the result has a exponent equal to the smallest normalized
 # exponent for the selected precision. also, the mantissa is equal to
 # 0x8000000000000000 and this mantissa is the result of rounding non-zero
-# g,r,s. 
+# g,r,s.
 # now, we must determine whether the pre-rounded result was an underflow
 # rounded "up" or a normalized number rounded "down".
 # so, we do this be re-executing the add using RZ as the rounding mode and
@@ -11401,7 +11401,7 @@
 	fmov.s		&0x00000000,%fp0	# return +ZERO
 	mov.b		&z_bmask,FPSR_CC(%a6)	# set Z
 	rts
-	
+
 #
 # the ZEROes have opposite signs:
 # - therefore, we return +ZERO if the rounding modes are RN,RZ, or RP.
@@ -11455,7 +11455,7 @@
 	eor.b		%d1,%d0
 	bmi.l		res_operr		# weed out (-INF)+(+INF)
 
-# ok, so it's not an OPERR. but, we do have to remember to return the 
+# ok, so it's not an OPERR. but, we do have to remember to return the
 # src INF since that's where the 881/882 gets the j-bit from...
 
 #
@@ -11489,25 +11489,25 @@
 #	fdsub(): emulates the fdsub instruction				#
 #									#
 # XREF ****************************************************************	#
-# 	addsub_scaler2() - scale the operands so they won't take exc	#
+#	addsub_scaler2() - scale the operands so they won't take exc	#
 #	ovf_res() - return default overflow result			#
 #	unf_res() - return default underflow result			#
 #	res_qnan() - set QNAN result					#
-# 	res_snan() - set SNAN result					#
+#	res_snan() - set SNAN result					#
 #	res_operr() - set OPERR result					#
 #	scale_to_zero_src() - set src operand exponent equal to zero	#
 #	scale_to_zero_dst() - set dst operand exponent equal to zero	#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
-# 	a1 = pointer to extended precision destination operand		#
+#	a1 = pointer to extended precision destination operand		#
 #									#
 # OUTPUT **************************************************************	#
 #	fp0 = result							#
 #	fp1 = EXOP (if exception occurred)				#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Handle NANs, infinities, and zeroes as special cases. Divide	#
+#	Handle NANs, infinities, and zeroes as special cases. Divide	#
 # norms into extended, single, and double precision.			#
 #	Do subtraction after scaling exponents such that exception won't#
 # occur. Then, check result exponent to see if exception would have	#
@@ -11657,7 +11657,7 @@
 	add.l		&0xc,%sp
 
 	fmovm.x		FP_SCR1(%a6),&0x80	# load dst op
-	
+
 	fmov.l		&rz_mode*0x10,%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
@@ -11721,7 +11721,7 @@
 
 #
 # result is equal to the smallest normalized number in the selected precision
-# if the precision is extended, this result could not have come from an 
+# if the precision is extended, this result could not have come from an
 # underflow that rounded up.
 #
 fsub_may_unfl:
@@ -11743,7 +11743,7 @@
 # ok, so now the result has a exponent equal to the smallest normalized
 # exponent for the selected precision. also, the mantissa is equal to
 # 0x8000000000000000 and this mantissa is the result of rounding non-zero
-# g,r,s. 
+# g,r,s.
 # now, we must determine whether the pre-rounded result was an underflow
 # rounded "up" or a normalized number rounded "down".
 # so, we do this be re-executing the add using RZ as the rounding mode and
@@ -11899,7 +11899,7 @@
 
 #
 # both operands are INFs. an OPERR will result if the INFs have the
-# same signs. else, 
+# same signs. else,
 #
 fsub_inf_2:
 	mov.b		SRC_EX(%a0),%d0		# exclusive or the signs
@@ -11914,7 +11914,7 @@
 	fmovm.x		SRC(%a0),&0x80		# return src INF
 	fneg.x		%fp0			# invert sign
 	fbge.w		fsub_inf_done		# sign is now positive
-	mov.b		&neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG	
+	mov.b		&neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
 	rts
 
 fsub_inf_dst:
@@ -11930,7 +11930,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	fsqrt(): emulates the fsqrt instruction				#
+#	fsqrt(): emulates the fsqrt instruction				#
 #	fssqrt(): emulates the fssqrt instruction			#
 #	fdsqrt(): emulates the fdsqrt instruction			#
 #									#
@@ -11938,8 +11938,8 @@
 #	scale_sqrt() - scale the source operand				#
 #	unf_res() - return default underflow result			#
 #	ovf_res() - return default overflow result			#
-# 	res_qnan_1op() - return QNAN result				#
-# 	res_snan_1op() - return SNAN result				#
+#	res_qnan_1op() - return QNAN result				#
+#	res_snan_1op() - return SNAN result				#
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to extended precision source operand		#
@@ -11956,7 +11956,7 @@
 # instruction won't cause an exception. Use the regular fsqrt to	#
 # compute a result. Check if the regular operands would have taken	#
 # an exception. If so, return the default overflow/underflow result	#
-# and return the EXOP if exceptions are enabled. Else, scale the 	#
+# and return the EXOP if exceptions are enabled. Else, scale the	#
 # result operand to the proper exponent.				#
 #									#
 #########################################################################
@@ -11978,7 +11978,7 @@
 	clr.w		%d1
 	mov.b		STAG(%a6),%d1
 	bne.w		fsqrt_not_norm		# optimize on non-norm input
-		
+
 #
 # SQUARE ROOT: norms and denorms ONLY!
 #
@@ -12100,7 +12100,7 @@
 	fmov.l		&rz_mode*0x10,%fpcr	# set FPCR
 	fmov.l		&0x0,%fpsr		# clear FPSR
 
-	fsqrt.x 	FP_SCR0(%a6),%fp0	# execute square root
+	fsqrt.x		FP_SCR0(%a6),%fp0	# execute square root
 
 	fmov.l		%fpsr,%d1		# save status
 	fmov.l		&0x0,%fpcr		# clear FPCR
@@ -12120,10 +12120,10 @@
 	bsr.l		unf_res			# calculate default result
 	or.b		%d0,FPSR_CC(%a6)	# set possible 'Z' ccode
 	fmovm.x		FP_SCR0(%a6),&0x80	# return default result in fp0
-	rts	
+	rts
 
 #
-# operand will underflow AND underflow is enabled. 
+# operand will underflow AND underflow is enabled.
 # therefore, we must return the result rounded to extended precision.
 #
 fsqrt_sd_unfl_ena:
@@ -12239,15 +12239,15 @@
 	bra.l		res_qnan_1op
 
 #
-# 	fsqrt(+0) = +0
-# 	fsqrt(-0) = -0
+#	fsqrt(+0) = +0
+#	fsqrt(-0) = -0
 #	fsqrt(+INF) = +INF
-# 	fsqrt(-INF) = OPERR
+#	fsqrt(-INF) = OPERR
 #
 fsqrt_zero:
 	tst.b		SRC_EX(%a0)		# is ZERO positive or negative?
 	bmi.b		fsqrt_zero_m		# negative
-fsqrt_zero_p:	
+fsqrt_zero_p:
 	fmov.s		&0x00000000,%fp0	# return +ZERO
 	mov.b		&z_bmask,FPSR_CC(%a6)	# set 'Z' ccode bit
 	rts
@@ -12273,13 +12273,13 @@
 #									#
 # INPUT ***************************************************************	#
 #	d1 = index of register to fetch from				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	d0 = value of register fetched					#
 #									#
 # ALGORITHM ***********************************************************	#
-#	According to the index value in d1 which can range from zero 	#
-# to fifteen, load the corresponding register file value (where 	#
+#	According to the index value in d1 which can range from zero	#
+# to fifteen, load the corresponding register file value (where		#
 # address register indexes start at 8). D0/D1/A0/A1/A6/A7 are on the	#
 # stack. The rest should still be in their original places.		#
 #									#
@@ -12368,7 +12368,7 @@
 # INPUT ***************************************************************	#
 #	d0 = longowrd value to store					#
 #	d1 = index of register to fetch from				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(data register is updated)					#
 #									#
@@ -12429,7 +12429,7 @@
 # INPUT ***************************************************************	#
 #	d0 = word value to store					#
 #	d1 = index of register to fetch from				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(data register is updated)					#
 #									#
@@ -12490,7 +12490,7 @@
 # INPUT ***************************************************************	#
 #	d0 = byte value to store					#
 #	d1 = index of register to fetch from				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(data register is updated)					#
 #									#
@@ -12551,16 +12551,16 @@
 # INPUT ***************************************************************	#
 #	d0 = amount to increment by					#
 #	d1 = index of address register to increment			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(address register is updated)					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Typically used for an instruction w/ a post-increment <ea>, 	#
+#	Typically used for an instruction w/ a post-increment <ea>,	#
 # this routine adds the increment value in d0 to the address register	#
 # specified by d1. A0/A1/A6/A7 reside on the stack. The rest reside	#
 # in their original places.						#
-# 	For a7, if the increment amount is one, then we have to 	#
+#	For a7, if the increment amount is one, then we have to		#
 # increment by two. For any a7 update, set the mia7_flag so that if	#
 # an access error exception occurs later in emulation, this address	#
 # register update can be undone.					#
@@ -12615,16 +12615,16 @@
 # INPUT ***************************************************************	#
 #	d0 = amount to decrement by					#
 #	d1 = index of address register to decrement			#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	(address register is updated)					#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Typically used for an instruction w/ a pre-decrement <ea>, 	#
+#	Typically used for an instruction w/ a pre-decrement <ea>,	#
 # this routine adds the decrement value in d0 to the address register	#
 # specified by d1. A0/A1/A6/A7 reside on the stack. The rest reside	#
 # in their original places.						#
-# 	For a7, if the decrement amount is one, then we have to 	#
+#	For a7, if the decrement amount is one, then we have to		#
 # decrement by two. For any a7 update, set the mda7_flag so that if	#
 # an access error exception occurs later in emulation, this address	#
 # register update can be undone.					#
@@ -12680,17 +12680,17 @@
 #									#
 # INPUT ***************************************************************	#
 #	d0 = index of FP register to load				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_SRC(a6) = value loaded from FP register file			#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Using the index in d0, load FP_SRC(a6) with a number from the 	#
+#	Using the index in d0, load FP_SRC(a6) with a number from the	#
 # FP register file.							#
 #									#
 #########################################################################
 
-	global 		load_fpn1
+	global		load_fpn1
 load_fpn1:
 	mov.w		(tbl_load_fpn1.b,%pc,%d0.w*2), %d0
 	jmp		(tbl_load_fpn1.b,%pc,%d0.w*1)
@@ -12753,12 +12753,12 @@
 #									#
 # INPUT ***************************************************************	#
 #	d0 = index of FP register to load				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	FP_DST(a6) = value loaded from FP register file			#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Using the index in d0, load FP_DST(a6) with a number from the 	#
+#	Using the index in d0, load FP_DST(a6) with a number from the	#
 # FP register file.							#
 #									#
 #########################################################################
@@ -12819,7 +12819,7 @@
 
 #########################################################################
 # XDEF ****************************************************************	#
-# 	store_fpreg(): store an fp value to the fpreg designated d0.	#
+#	store_fpreg(): store an fp value to the fpreg designated d0.	#
 #									#
 # XREF ****************************************************************	#
 #	None								#
@@ -12827,7 +12827,7 @@
 # INPUT ***************************************************************	#
 #	fp0 = extended precision value to store				#
 #	d0  = index of floating-point register				#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	None								#
 #									#
@@ -12860,27 +12860,27 @@
 	fmovm.x		&0x80, EXC_FP1(%a6)
 	rts
 store_fpreg_2:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x20
 	rts
 store_fpreg_3:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x10
 	rts
 store_fpreg_4:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x08
 	rts
 store_fpreg_5:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x04
 	rts
 store_fpreg_6:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x02
 	rts
 store_fpreg_7:
-	fmovm.x 	&0x01, -(%sp)
+	fmovm.x		&0x01, -(%sp)
 	fmovm.x		(%sp)+, &0x01
 	rts
 
@@ -12897,18 +12897,18 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	If no failure on _mem_read():					#
-# 	FP_SRC(a6) = packed operand now as a binary FP number		#
+#	FP_SRC(a6) = packed operand now as a binary FP number		#
 #									#
 # ALGORITHM ***********************************************************	#
-#	Get the correct <ea> whihc is the value on the exception stack 	#
+#	Get the correct <ea> whihc is the value on the exception stack	#
 # frame w/ maybe a correction factor if the <ea> is -(an) or (an)+.	#
 # Then, fetch the operand from memory. If the fetch fails, exit		#
 # through facc_in_x().							#
 #	If the packed operand is a ZERO,NAN, or INF, convert it to	#
-# its binary representation here. Else, call decbin() which will 	#
+# its binary representation here. Else, call decbin() which will	#
 # convert the packed value to an extended precision binary value.	#
 #									#
 #########################################################################
@@ -12965,7 +12965,7 @@
 #	and NaN operands are dispatched without entering this routine)	#
 #	value in 68881/882 format at location (a0).			#
 #									#
-#	A1. Convert the bcd exponent to binary by successive adds and 	#
+#	A1. Convert the bcd exponent to binary by successive adds and	#
 #	muls. Set the sign according to SE. Subtract 16 to compensate	#
 #	for the mantissa which is to be interpreted as 17 integer	#
 #	digits, rather than 1 integer and 16 fraction digits.		#
@@ -13029,7 +13029,7 @@
 
 	global		decbin
 decbin:
-	mov.l		0x0(%a0),FP_SCR0_EX(%a6) # make a copy of input 
+	mov.l		0x0(%a0),FP_SCR0_EX(%a6) # make a copy of input
 	mov.l		0x4(%a0),FP_SCR0_HI(%a6) # so we don't alter it
 	mov.l		0x8(%a0),FP_SCR0_LO(%a6)
 
@@ -13318,7 +13318,7 @@
 #
 # Pwrten calculates the exponent factor in the selected rounding mode
 # according to the following table:
-#	
+#
 #	Sign of Mant  Sign of Exp  Rounding Mode  PWRTEN Rounding Mode
 #
 #	ANY	  ANY	RN	RN
@@ -13406,7 +13406,7 @@
 # it will be inex2, but will be reported as inex1 by get_op.
 #
 end_dec:
-	fmov.l		%fpsr,%d0		# get status register	
+	fmov.l		%fpsr,%d0		# get status register
 	bclr		&inex2_bit+8,%d0	# test for inex2 and clear it
 	beq.b		no_exc			# skip this if no exc
 	ori.w		&inx1a_mask,2+USER_FPSR(%a6) # set INEX1/AINEX
@@ -13423,16 +13423,16 @@
 #									#
 # INPUT ***************************************************************	#
 #	a0 = pointer to the input extended precision value in memory.	#
-#	     the input may be either normalized, unnormalized, or 	#
+#	     the input may be either normalized, unnormalized, or	#
 #	     denormalized.						#
-#	d0 = contains the k-factor sign-extended to 32-bits. 		#
+#	d0 = contains the k-factor sign-extended to 32-bits.		#
 #									#
 # OUTPUT **************************************************************	#
 #	FP_SCR0(a6) = bcd format result on the stack.			#
 #									#
 # ALGORITHM ***********************************************************	#
 #									#
-#	A1.	Set RM and size ext;  Set SIGMA = sign of input.  	#
+#	A1.	Set RM and size ext;  Set SIGMA = sign of input.	#
 #		The k-factor is saved for use in d7. Clear the		#
 #		BINDEC_FLG for separating normalized/denormalized	#
 #		input.  If input is unnormalized or denormalized,	#
@@ -13442,15 +13442,15 @@
 #									#
 #	A3.	Compute ILOG.						#
 #		ILOG is the log base 10 of the input value.  It is	#
-#		approximated by adding e + 0.f when the original 	#
-#		value is viewed as 2^^e * 1.f in extended precision.  	#
+#		approximated by adding e + 0.f when the original	#
+#		value is viewed as 2^^e * 1.f in extended precision.	#
 #		This value is stored in d6.				#
 #									#
 #	A4.	Clr INEX bit.						#
-#		The operation in A3 above may have set INEX2.  		#
+#		The operation in A3 above may have set INEX2.		#
 #									#
 #	A5.	Set ICTR = 0;						#
-#		ICTR is a flag used in A13.  It must be set before the 	#
+#		ICTR is a flag used in A13.  It must be set before the	#
 #		loop entry A6.						#
 #									#
 #	A6.	Calculate LEN.						#
@@ -13472,7 +13472,7 @@
 #		of ISCALE and X.  A table is given in the code.		#
 #									#
 #	A8.	Clr INEX; Force RZ.					#
-#		The operation in A3 above may have set INEX2.  		#
+#		The operation in A3 above may have set INEX2.		#
 #		RZ mode is forced for the scaling operation to insure	#
 #		only one rounding error.  The grs bits are collected in #
 #		the INEX flag for use in A10.				#
@@ -13503,11 +13503,11 @@
 #		the mantissa by 10.					#
 #									#
 #	A14.	Convert the mantissa to bcd.				#
-#		The binstr routine is used to convert the LEN digit 	#
+#		The binstr routine is used to convert the LEN digit	#
 #		mantissa to bcd in memory.  The input to binstr is	#
 #		to be a fraction; i.e. (mantissa)/10^LEN and adjusted	#
 #		such that the decimal point is to the left of bit 63.	#
-#		The bcd digits are stored in the correct position in 	#
+#		The bcd digits are stored in the correct position in	#
 #		the final string area in memory.			#
 #									#
 #	A15.	Convert the exponent to bcd.				#
@@ -13553,7 +13553,7 @@
 #		d2: upper 32-bits of mantissa for binstr
 #		d3: scratch;lower 32-bits of mantissa for binstr
 #		d4: LEN
-#      		d5: LAMBDA/ICTR
+#		d5: LAMBDA/ICTR
 #		d6: ILOG
 #		d7: k-factor
 #		a0: ptr for original operand/final result
@@ -13577,7 +13577,7 @@
 #     separating  normalized/denormalized input.  If the input
 #     is a denormalized number, set the BINDEC_FLG memory word
 #     to signal denorm.  If the input is unnormalized, normalize
-#     the input and test for denormalized result.  
+#     the input and test for denormalized result.
 #
 	fmov.l		&rm_mode*0x10,%fpcr	# set RM and ext
 	mov.l		(%a0),L_SCR2(%a6)	# save exponent for sign check
@@ -13658,7 +13658,7 @@
 	sub.w		&0x3fff,%d0	# strip off bias
 	fadd.w		%d0,%fp0	# add in exp
 	fsub.s		FONE(%pc),%fp0	# subtract off 1.0
-	fbge.w		pos_res		# if pos, branch 
+	fbge.w		pos_res		# if pos, branch
 	fmul.x		PLOG2UP1(%pc),%fp0	# if neg, mul by LOG2UP1
 	fmov.l		%fp0,%d6	# put ILOG in d6 as a lword
 	bra.b		A4_str		# go move out ILOG
@@ -13668,14 +13668,14 @@
 
 
 # A4. Clr INEX bit.
-#     The operation in A3 above may have set INEX2.  
+#     The operation in A3 above may have set INEX2.
 
 A4_str:
 	fmov.l		&0,%fpsr	# zero all of fpsr - nothing needed
 
 
 # A5. Set ICTR = 0;
-#     ICTR is a flag used in A13.  It must be set before the 
+#     ICTR is a flag used in A13.  It must be set before the
 #     loop entry A6. The lower word of d5 is used for ICTR.
 
 	clr.w		%d5		# clear ICTR
@@ -13841,21 +13841,21 @@
 	bne.b		e_loop2		# if not, loop
 
 # A8. Clr INEX; Force RZ.
-#     The operation in A3 above may have set INEX2.  
+#     The operation in A3 above may have set INEX2.
 #     RZ mode is forced for the scaling operation to insure
-#     only one rounding error.  The grs bits are collected in 
+#     only one rounding error.  The grs bits are collected in
 #     the INEX flag for use in A10.
 #
 # Register usage:
 #	Input/Output
 
-	fmov.l		&0,%fpsr	# clr INEX 
+	fmov.l		&0,%fpsr	# clr INEX
 	fmov.l		&rz_mode*0x10,%fpcr	# set RZ rounding mode
 
 # A9. Scale X -> Y.
 #     The mantissa is scaled to the desired number of significant
 #     digits.  The excess digits are collected in INEX2. If mul,
-#     Check d2 for excess 10 exponential value.  If not zero, 
+#     Check d2 for excess 10 exponential value.  If not zero,
 #     the iscale value would have caused the pwrten calculation
 #     to overflow.  Only a negative iscale can cause this, so
 #     multiply by 10^(d2), which is now only allowed to be 24,
@@ -13986,7 +13986,7 @@
 
 A11_st:
 	mov.l		USER_FPCR(%a6),L_SCR1(%a6)	# save it for later
-	and.l		&0x00000030,USER_FPCR(%a6)	# set size to ext, 
+	and.l		&0x00000030,USER_FPCR(%a6)	# set size to ext,
 #					;block exceptions
 
 
@@ -14022,7 +14022,7 @@
 	lea.l		FP_SCR1(%a6),%a0	# a0 is ptr to FP_SCR1(a6)
 	fmov.x		%fp0,(%a0)	# move Y to memory at FP_SCR1(a6)
 	tst.l		L_SCR2(%a6)	# test sign of original operand
-	bge.b		do_fint12		# if pos, use Y 
+	bge.b		do_fint12		# if pos, use Y
 	or.l		&0x80000000,(%a0)	# if neg, use -Y
 do_fint12:
 	mov.l	USER_FPSR(%a6),-(%sp)
@@ -14118,7 +14118,7 @@
 	subq.l		&1,%d6		# subtract 1 from ILOG
 	mov.w		&1,%d5		# set ICTR
 	fmov.l		&rm_mode*0x10,%fpcr	# set rmode to RM
-	fmul.s		FTEN(%pc),%fp2	# compute 10^LEN 
+	fmul.s		FTEN(%pc),%fp2	# compute 10^LEN
 	bra.w		A6_str		# return to A6 and recompute YINT
 test_2:
 	fmul.s		FTEN(%pc),%fp2	# compute 10^LEN
@@ -14134,7 +14134,7 @@
 	fmov.l		&rm_mode*0x10,%fpcr	# set rmode to RM
 	bra.w		A6_str		# return to A6 and recompute YINT
 #
-# Since ICTR <> 0, we have already been through one adjustment, 
+# Since ICTR <> 0, we have already been through one adjustment,
 # and shouldn't have another; this is to check if abs(YINT) = 10^LEN
 # 10^LEN is again computed using whatever table is in a1 since the
 # value calculated cannot be inexact.
@@ -14160,11 +14160,11 @@
 	fmul.s		FTEN(%pc),%fp2	# if LEN++, the get 10^^LEN
 
 # A14. Convert the mantissa to bcd.
-#      The binstr routine is used to convert the LEN digit 
+#      The binstr routine is used to convert the LEN digit
 #      mantissa to bcd in memory.  The input to binstr is
 #      to be a fraction; i.e. (mantissa)/10^LEN and adjusted
 #      such that the decimal point is to the left of bit 63.
-#      The bcd digits are stored in the correct position in 
+#      The bcd digits are stored in the correct position in
 #      the final string area in memory.
 #
 #
@@ -14207,7 +14207,7 @@
 	bgt.b		no_sft		# if so, don't shift
 	neg.l		%d0		# make exp positive
 m_loop:
-	lsr.l		&1,%d2		# shift d2:d3 right, add 0s 
+	lsr.l		&1,%d2		# shift d2:d3 right, add 0s
 	roxr.l		&1,%d3		# the number of places
 	dbf.w		%d0,m_loop	# given in d0
 no_sft:
@@ -14232,9 +14232,9 @@
 #
 #      Digits are stored in L_SCR1(a6) on return from BINDEC as:
 #
-#  	 32               16 15                0
+#	 32               16 15                0
 #	-----------------------------------------
-#  	|  0 | e3 | e2 | e1 | e4 |  X |  X |  X |
+#	|  0 | e3 | e2 | e1 | e4 |  X |  X |  X |
 #	-----------------------------------------
 #
 # And are moved into their proper places in FP_SCR0.  If digit e4
@@ -14297,7 +14297,7 @@
 	sub.w		&0x3ffd,%d0	# subtract off bias
 	neg.w		%d0		# make exp positive
 x_loop:
-	lsr.l		&1,%d2		# shift d2:d3 right 
+	lsr.l		&1,%d2		# shift d2:d3 right
 	roxr.l		&1,%d3		# the number of places
 	dbf.w		%d0,x_loop	# given in d0
 x_loop_fin:
@@ -14308,12 +14308,12 @@
 	mov.l		&4,%d0		# put 4 in d0 for binstr call
 	lea.l		L_SCR1(%a6),%a0	# a0 is ptr to L_SCR1 for exp digits
 	bsr		binstr		# call binstr to convert exp
-	mov.l		L_SCR1(%a6),%d0	# load L_SCR1 lword to d0 
+	mov.l		L_SCR1(%a6),%d0	# load L_SCR1 lword to d0
 	mov.l		&12,%d1		# use d1 for shift count
 	lsr.l		%d1,%d0		# shift d0 right by 12
 	bfins		%d0,FP_SCR0(%a6){&4:&12}	# put e3:e2:e1 in FP_SCR0
 	lsr.l		%d1,%d0		# shift d0 right by 12
-	bfins		%d0,FP_SCR0(%a6){&16:&4}	# put e4 in FP_SCR0 
+	bfins		%d0,FP_SCR0(%a6){&16:&4}	# put e4 in FP_SCR0
 	tst.b		%d0		# check if e4 is zero
 	beq.b		A16_st		# if zero, skip rest
 	or.l		&opaop_mask,USER_FPSR(%a6)	# set OPERR & AIOP in USER_FPSR
@@ -14344,14 +14344,14 @@
 
 A16_st:
 	clr.l		%d0		# clr d0 for collection of signs
-	and.b		&0x0f,FP_SCR0(%a6)	# clear first nibble of FP_SCR0 
+	and.b		&0x0f,FP_SCR0(%a6)	# clear first nibble of FP_SCR0
 	tst.l		L_SCR2(%a6)	# check sign of original mantissa
 	bge.b		mant_p		# if pos, don't set SM
 	mov.l		&2,%d0		# move 2 in to d0 for SM
 mant_p:
 	tst.l		%d6		# check sign of ILOG
 	bge.b		wr_sgn		# if pos, don't set SE
-	addq.l		&1,%d0		# set bit 0 in d0 for SE 
+	addq.l		&1,%d0		# set bit 0 in d0 for SE
 wr_sgn:
 	bfins		%d0,FP_SCR0(%a6){&0:&2}	# insert SM and SE into FP_SCR0
 
@@ -14417,8 +14417,8 @@
 #	d2:d3 = 64-bit binary integer					#
 #	d0    = desired length (LEN)					#
 #	a0    = pointer to start in memory for bcd characters		#
-#          	(This pointer must point to byte 4 of the first		#
-#          	 lword of the packed decimal memory string.)		#
+#		(This pointer must point to byte 4 of the first		#
+#		 lword of the packed decimal memory string.)		#
 #									#
 # OUTPUT ************************************************************** #
 #	a0 = pointer to LEN bcd digits representing the 64-bit integer.	#
@@ -14558,14 +14558,14 @@
 #									#
 # INPUT ***************************************************************	#
 #	None								#
-# 									#
+#									#
 # OUTPUT **************************************************************	#
 #	None								#
 #									#
 # ALGORITHM ***********************************************************	#
-# 	Flow jumps here when an FP data fetch call gets an error 	#
+#	Flow jumps here when an FP data fetch call gets an error	#
 # result. This means the operating system wants an access error frame	#
-# made out of the current exception stack frame. 			#
+# made out of the current exception stack frame.			#
 #	So, we first call restore() which makes sure that any updated	#
 # -(an)+ register gets returned to its pre-exception value and then	#
 # we change the stack to an access error stack frame.			#
@@ -14735,7 +14735,7 @@
 	bne.b		ri_a7_done		# supervisor
 	movc		%usp,%a0		# restore USP
 	sub.l		%d0,%a0
-	movc		%a0,%usp	
+	movc		%a0,%usp
 ri_a7_done:
 	rts
 
diff -Nru a/arch/m68k/kernel/bios32.c b/arch/m68k/kernel/bios32.c
--- a/arch/m68k/kernel/bios32.c	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/kernel/bios32.c	Tue Jun 15 22:20:41 2004
@@ -46,7 +46,7 @@
 
 #define ALIGN(val,align)	(((val) + ((align) - 1)) & ~((align) - 1))
 
-#define MAX(val1, val2) 	(((val1) > (val2)) ? val1 : val2)
+#define MAX(val1, val2)		(((val1) > (val2)) ? val1 : val2)
 
 /*
  * Offsets relative to the I/O and memory base addresses from where resources
diff -Nru a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
--- a/arch/m68k/kernel/entry.S	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/kernel/entry.S	Tue Jun 15 22:20:36 2004
@@ -55,7 +55,7 @@
 ENTRY(buserr)
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	buserr_c
 	addql	#4,%sp
 	jra	ret_from_exception
@@ -63,7 +63,7 @@
 ENTRY(trap)
 	SAVE_ALL_INT
 	GET_CURRENT(%d0)
-	movel	%sp,%sp@- 		| stack frame pointer argument
+	movel	%sp,%sp@-		| stack frame pointer argument
 	bsrl	trap_c
 	addql	#4,%sp
 	jra	ret_from_exception
@@ -99,18 +99,18 @@
 	jbsr	syscall_trace
 
 ret_from_signal:
-	RESTORE_SWITCH_STACK 
+	RESTORE_SWITCH_STACK
 	addql	#4,%sp
-/* on 68040 complete pending writebacks if any */	
+/* on 68040 complete pending writebacks if any */
 #ifdef CONFIG_M68040
-	bfextu	%sp@(PT_VECTOR){#0,#4},%d0  
+	bfextu	%sp@(PT_VECTOR){#0,#4},%d0
 	subql	#7,%d0				| bus error frame ?
 	jbne	1f
 	movel	%sp,%sp@-
 	jbsr	berr_040cleanup
 	addql	#4,%sp
-1:	
-#endif	
+1:
+#endif
 	jra	ret_from_exception
 
 ENTRY(system_call)
@@ -229,18 +229,18 @@
 	bfextu %sp@(PT_VECTOR){#4,#10},%d0
 
 	movel	%sp,%sp@-
-	movel	%d0,%sp@- 		|  put vector # on stack
+	movel	%d0,%sp@-		|  put vector # on stack
 #if defined(MACH_Q40_ONLY) && defined(CONFIG_BLK_DEV_FD)
 	btstb	#4,0xff000000		| Q40 floppy needs very special treatment ...
 	jbeq	1f
-	btstb	#3,0xff000004		
+	btstb	#3,0xff000004
 	jbeq	1f
 	jbsr	floppy_hardint
 	jbra	3f
 1:
-#endif		
+#endif
 	jbsr	process_int		|  process the IRQ
-3:     	addql	#8,%sp			|  pop parameters off stack
+3:	addql	#8,%sp			|  pop parameters off stack
 
 ret_from_interrupt:
 	subqb	#1,%curptr@(TASK_INFO+TINFO_PREEMPT+2)
@@ -266,7 +266,7 @@
 	rte
 
 ENTRY(sys_fork)
-	SAVE_SWITCH_STACK	
+	SAVE_SWITCH_STACK
 	pea	%sp@(SWITCH_STACK_SIZE)
 	jbsr	m68k_fork
 	addql	#4,%sp
@@ -282,7 +282,7 @@
 	rts
 
 ENTRY(sys_vfork)
-	SAVE_SWITCH_STACK	
+	SAVE_SWITCH_STACK
 	pea	%sp@(SWITCH_STACK_SIZE)
 	jbsr	m68k_vfork
 	addql	#4,%sp
@@ -397,7 +397,7 @@
 #if !defined(CPU_M68060_ONLY)
 1:	tstb	%a1@(TASK_THREAD+THREAD_FPSTATE)
 	jeq	3f
-#endif	
+#endif
 2:	fmovemx	%a1@(TASK_THREAD+THREAD_FPREG),%fp0-%fp7
 	fmoveml	%a1@(TASK_THREAD+THREAD_FPCNTL),%fpcr/%fpsr/%fpiar
 3:	frestore %a1@(TASK_THREAD+THREAD_FPSTATE)
@@ -554,7 +554,7 @@
 	.long sys_adjtimex
 	.long sys_mprotect	/* 125 */
 	.long sys_sigprocmask
-	.long sys_ni_syscall		/* old "create_module" */ 
+	.long sys_ni_syscall		/* old "create_module" */
 	.long sys_init_module
 	.long sys_delete_module
 	.long sys_ni_syscall	/* 130 - old "get_kernel_syms" */
diff -Nru a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
--- a/arch/m68k/kernel/head.S	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/kernel/head.S	Tue Jun 15 22:21:05 2004
@@ -19,7 +19,7 @@
 ** ++ Bjoern & Roman: ATARI-68040 support for the Medusa
 ** 95/11/18 Richard Hirst: Added MVME166 support
 ** 96/04/26 Guenther Kelleter: fixed identity mapping for Falcon with
-** 			      Magnum- and FX-alternate ram
+**			      Magnum- and FX-alternate ram
 ** 98/04/25 Phil Blundell: added HP300 support
 ** 1998/08/30 David Kilzer: Added support for font_desc structures
 **            for linux-2.1.115
@@ -67,7 +67,7 @@
  * for the kernel.
  *	There are new subroutines and data structures to make MMU
  * support cleaner and easier to understand.
- * 	First, you will find a routine call "mmu_map" which maps
+ *	First, you will find a routine call "mmu_map" which maps
  * a logical to a physical region for some length given a cache
  * type on behalf of the caller.  This routine makes writing the
  * actual per-machine specific code very simple.
@@ -299,7 +299,7 @@
  * For the head.S console, there are three supported fonts, 6x11, 8x16 and 8x8.
  * The 8x8 font is harder to read but fits more on the screen.
  */
-#define FONT_8x8 	/* default */
+#define FONT_8x8	/* default */
 /* #define FONT_8x16 */	/* 2nd choice */
 /* #define FONT_6x11 */	/* 3rd choice */
 
diff -Nru a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
--- a/arch/m68k/kernel/process.c	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/kernel/process.c	Tue Jun 15 22:21:05 2004
@@ -67,8 +67,7 @@
 {
 	struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
 	/* Check whether the thread is blocked in resume() */
-	if (sw->retpc > (unsigned long)scheduling_functions_start_here &&
-	    sw->retpc < (unsigned long)scheduling_functions_end_here)
+	if (in_sched_functions(sw->retpc))
 		return ((unsigned long *)sw->a6)[1];
 	else
 		return sw->retpc;
@@ -382,12 +381,6 @@
 	return error;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long fp, pc;
@@ -403,7 +396,7 @@
 		    fp >= 8184+stack_page)
 			return 0;
 		pc = ((unsigned long *)fp)[1];
-		if (pc < first_sched || pc >= last_sched)
+		if (!in_sched_functions(pc))
 			return pc;
 		fp = *(unsigned long *) fp;
 	} while (count++ < 16);
diff -Nru a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
--- a/arch/m68k/kernel/ptrace.c	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/kernel/ptrace.c	Tue Jun 15 22:20:38 2004
@@ -156,7 +156,7 @@
 
 	switch (request) {
 	/* when I and D space are separate, these will need to be fixed. */
-		case PTRACE_PEEKTEXT: /* read word at location addr. */ 
+		case PTRACE_PEEKTEXT: /* read word at location addr. */
 		case PTRACE_PEEKDATA: {
 			unsigned long tmp;
 			int copied;
@@ -172,12 +172,12 @@
 	/* read the word at location addr in the USER area. */
 		case PTRACE_PEEKUSR: {
 			unsigned long tmp;
-			
+
 			ret = -EIO;
 			if ((addr & 3) || addr < 0 ||
 			    addr > sizeof(struct user) - 3)
 				break;
-			
+
 			tmp = 0;  /* Default return condition */
 			addr = addr >> 2; /* temporary hack. */
 			ret = -EIO;
@@ -217,7 +217,7 @@
 				break;
 
 			addr = addr >> 2; /* temporary hack. */
-			    
+
 			if (addr == PT_SR) {
 				data &= SR_MASK;
 				data <<= 16;
@@ -269,8 +269,8 @@
 		}
 
 /*
- * make the child exit.  Best I can do is send it a sigkill. 
- * perhaps it should be put in the status that it wants to 
+ * make the child exit.  Best I can do is send it a sigkill.
+ * perhaps it should be put in the status that it wants to
  * exit.
  */
 		case PTRACE_KILL: {
@@ -311,7 +311,7 @@
 			break;
 
 		case PTRACE_GETREGS: { /* Get all gp regs from the child. */
-		  	int i;
+			int i;
 			unsigned long tmp;
 			for (i = 0; i < 19; i++) {
 			    tmp = get_reg(child, i);
diff -Nru a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
--- a/arch/m68k/kernel/setup.c	Tue Jun 15 22:21:03 2004
+++ b/arch/m68k/kernel/setup.c	Tue Jun 15 22:21:03 2004
@@ -85,7 +85,7 @@
 void (*mach_halt)( void );
 void (*mach_power_off)( void );
 long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
-#if defined(CONFIG_AMIGA_FLOPPY) || defined(CONFIG_ATARI_FLOPPY) 
+#if defined(CONFIG_AMIGA_FLOPPY) || defined(CONFIG_ATARI_FLOPPY)
 void (*mach_floppy_setup) (char *, int *) __initdata = NULL;
 #endif
 #ifdef CONFIG_HEARTBEAT
@@ -143,7 +143,7 @@
 		/* Already set up by head.S */
 		break;
 
- 	    case BI_MEMCHUNK:
+	    case BI_MEMCHUNK:
 		if (m68k_num_memory < NUM_MEMINFO) {
 		    m68k_memory[m68k_num_memory].addr = data[0];
 		    m68k_memory[m68k_num_memory].size = data[1];
@@ -236,7 +236,7 @@
 		volatile int zero = 0;
 		asm __volatile__ ("frestore %0" : : "m" (zero));
 	}
-#endif	
+#endif
 
 	init_mm.start_code = PAGE_OFFSET;
 	init_mm.end_code = (unsigned long) &_etext;
@@ -296,28 +296,28 @@
 #endif
 #ifdef CONFIG_SUN3
 	    case MACH_SUN3:
-	    	config_sun3();
-	    	break;
+		config_sun3();
+		break;
 #endif
 #ifdef CONFIG_APOLLO
 	    case MACH_APOLLO:
-	    	config_apollo();
-	    	break;
+		config_apollo();
+		break;
 #endif
 #ifdef CONFIG_MVME147
 	    case MACH_MVME147:
-	    	config_mvme147();
-	    	break;
+		config_mvme147();
+		break;
 #endif
 #ifdef CONFIG_MVME16x
 	    case MACH_MVME16x:
-	    	config_mvme16x();
-	    	break;
+		config_mvme16x();
+		break;
 #endif
 #ifdef CONFIG_BVME6000
 	    case MACH_BVME6000:
-	    	config_bvme6000();
-	    	break;
+		config_bvme6000();
+		break;
 #endif
 #ifdef CONFIG_HP300
 	    case MACH_HP300:
@@ -384,11 +384,11 @@
 
 /* set ISA defs early as possible */
 #if defined(CONFIG_ISA) && defined(MULTI_ISA)
-#if defined(CONFIG_Q40) 
+#if defined(CONFIG_Q40)
 	if (MACH_IS_Q40) {
 	    isa_type = Q40_ISA;
 	    isa_sex = 0;
-	} 
+	}
 #elif defined(CONFIG_GG2)
 	if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)){
 	    isa_type = GG2_ISA;
diff -Nru a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
--- a/arch/m68k/kernel/signal.c	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/kernel/signal.c	Tue Jun 15 22:20:42 2004
@@ -121,7 +121,7 @@
 	}
 }
 
-asmlinkage int 
+asmlinkage int
 sys_sigaction(int sig, const struct old_sigaction *act,
 	      struct old_sigaction *oact)
 {
@@ -329,7 +329,7 @@
 	/* get previous context */
 	if (copy_from_user(&context, usc, sizeof(context)))
 		goto badframe;
-	
+
 	/* restore passed registers */
 	regs->d1 = context.sc_d1;
 	regs->a0 = context.sc_a0;
@@ -521,7 +521,7 @@
 	sigdelsetmask(&set, ~_BLOCKABLE);
 	current->blocked = set;
 	recalc_sigpending();
-	
+
 	if (restore_sigcontext(regs, &frame->sc, frame + 1, &d0))
 		goto badframe;
 	return d0;
@@ -548,7 +548,7 @@
 	sigdelsetmask(&set, ~_BLOCKABLE);
 	current->blocked = set;
 	recalc_sigpending();
-	
+
 	if (rt_restore_ucontext(regs, sw, &frame->uc, &d0))
 		goto badframe;
 	return d0;
@@ -1091,7 +1091,7 @@
 				current->state = TASK_STOPPED;
 				current->exit_code = signr;
 				sighand = current->parent->sighand;
-				if (sighand && !(sighand->action[SIGCHLD-1].sa.sa_flags 
+				if (sighand && !(sighand->action[SIGCHLD-1].sa.sa_flags
 					     & SA_NOCLDSTOP))
 					notify_parent(current, SIGCHLD);
 				schedule();
diff -Nru a/arch/m68k/kernel/sun3-head.S b/arch/m68k/kernel/sun3-head.S
--- a/arch/m68k/kernel/sun3-head.S	Tue Jun 15 22:20:35 2004
+++ b/arch/m68k/kernel/sun3-head.S	Tue Jun 15 22:20:35 2004
@@ -9,7 +9,7 @@
 NBSG            = 0x20000
 ICACHE_ONLY	= 0x00000009
 CACHES_OFF	= 0x00000008	| actually a clear and disable --m
-#define MAS_STACK INT_STACK 
+#define MAS_STACK INT_STACK
 ROOT_TABLE_SIZE = 128
 PAGESIZE	= 8192
 SUN3_INVALID_PMEG = 255
@@ -35,9 +35,9 @@
 
 /* Firstly, disable interrupts and set up function codes. */
 	movew	#PSL_HIGHIPL, %sr
-	moveq	#FC_CONTROL, %d0	
-	movec	%d0, %sfc	
-	movec	%d0, %dfc	
+	moveq	#FC_CONTROL, %d0
+	movec	%d0, %sfc
+	movec	%d0, %dfc
 
 /* Make sure we're in context zero. */
 	moveq	#0, %d0
@@ -45,9 +45,9 @@
 
 /* map everything the bootloader left us into high memory, clean up the
    excess later */
-	lea	(AC_SEGMAP+0),%a0 
-	lea	(AC_SEGMAP+KERNBASE),%a1	
-1:	
+	lea	(AC_SEGMAP+0),%a0
+	lea	(AC_SEGMAP+KERNBASE),%a1
+1:
 	movsb	%a0@, %d1
 	movsb	%d1, %a1@
 	cmpib	#SUN3_INVALID_PMEG, %d1
@@ -55,13 +55,13 @@
 	addl	#NBSG,%a0
 	addl	#NBSG,%a1
 	jmp	1b
-	
-2:				
-	
+
+2:
+
 /* Disable caches and jump to high code. */
 	moveq	#ICACHE_ONLY,%d0	| Cache disabled until we're ready to enable it
 	movc	%d0, %cacr	|   is this the right value? (yes --m)
-	jmp	1f:l		
+	jmp	1f:l
 
 /* Following code executes at high addresses (0xE000xxx). */
 1:	lea	init_task,%curptr			| get initial thread...
@@ -76,7 +76,7 @@
 	movel   %a0@, %a1@
 	addl	#4, %a1
 	dbf	%d0, 1b
-	
+
 /* Point MSP at an invalid page to trap if it's used. --m */
 	movl	#(PAGESIZE),%d0
 	movc	%d0,%msp
@@ -86,9 +86,9 @@
 	jbsr	sun3_init
 
 	jbsr	base_trap_init
-			
+
         jbsr    start_kernel
-	trap	#15			
+	trap	#15
 
         .data
         .even
diff -Nru a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
--- a/arch/m68k/kernel/sys_m68k.c	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/kernel/sys_m68k.c	Tue Jun 15 22:20:37 2004
@@ -203,10 +203,10 @@
 		default:
 			return -ENOSYS;
 		}
-	if (call <= MSGCTL) 
+	if (call <= MSGCTL)
 		switch (call) {
 		case MSGSND:
-			return sys_msgsnd (first, (struct msgbuf *) ptr, 
+			return sys_msgsnd (first, (struct msgbuf *) ptr,
 					  second, third);
 		case MSGRCV:
 			switch (version) {
@@ -234,7 +234,7 @@
 		default:
 			return -ENOSYS;
 		}
-	if (call <= SHMCTL) 
+	if (call <= SHMCTL)
 		switch (call) {
 		case SHMAT:
 			switch (version) {
@@ -247,7 +247,7 @@
 				return put_user (raddr, (ulong *) third);
 			}
 			}
-		case SHMDT: 
+		case SHMDT:
 			return sys_shmdt ((char *)ptr);
 		case SHMGET:
 			return sys_shmget (first, second, third);
@@ -442,7 +442,7 @@
   unsigned long paddr, i;
 
   /*
-   * 68060 manual says: 
+   * 68060 manual says:
    *  cpush %dc : flush DC, remains valid (with our %cacr setup)
    *  cpush %ic : invalidate IC
    *  cpush %bc : flush DC + invalidate IC
diff -Nru a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
--- a/arch/m68k/kernel/traps.c	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/kernel/traps.c	Tue Jun 15 22:21:05 2004
@@ -116,7 +116,7 @@
 
 		__asm__ volatile ("movec %%vbr, %0" : "=r" ((void*)sun3x_prom_vbr));
 	}
-	
+
 	/* setup the exception vector table */
 	__asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
 
@@ -352,7 +352,7 @@
 
 	asm volatile (".chip 68040; movec %%mmusr,%0; .chip 68k" : "=r" (mmusr));
 
-	set_fs(old_fs); 
+	set_fs(old_fs);
 
 	return mmusr;
 }
@@ -379,8 +379,8 @@
 	}
 
 	/* set_fs can not be moved, otherwise put_user() may oops */
-	set_fs(old_fs); 
-	
+	set_fs(old_fs);
+
 
 #ifdef DEBUG
 	printk("do_040writeback1, res=%d\n",res);
@@ -390,7 +390,7 @@
 }
 
 /* after an exception in a writeback the stack frame corresponding
- * to that exception is discarded, set a few bits in the old frame 
+ * to that exception is discarded, set a few bits in the old frame
  * to simulate what it should look like
  */
 static inline void fix_xframe040(struct frame *fp, unsigned long wba, unsigned short wbs)
@@ -415,7 +415,7 @@
 				       fp->un.fmt7.wb2d);
 		if (res)
 			fix_xframe040(fp, fp->un.fmt7.wb2a, fp->un.fmt7.wb2s);
-		else 
+		else
 			fp->un.fmt7.wb2s = 0;
 	}
 
@@ -461,9 +461,9 @@
 
 #ifdef DEBUG
 	printk("ssw=%#x, fa=%#lx\n", ssw, fp->un.fmt7.faddr);
-        printk("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,  
+        printk("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,
 		fp->un.fmt7.wb2s, fp->un.fmt7.wb3s);
-	printk ("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n", 
+	printk ("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n",
 		fp->un.fmt7.wb2a, fp->un.fmt7.wb3a,
 		fp->un.fmt7.wb2d, fp->un.fmt7.wb3d);
 #endif
@@ -491,7 +491,7 @@
 			errorcode = 0;
 		}
 
-		/* despite what documentation seems to say, RMW 
+		/* despite what documentation seems to say, RMW
 		 * accesses have always both the LK and RW bits set */
 		if (!(ssw & RW_040) || (ssw & LK_040))
 			errorcode |= 2;
@@ -547,7 +547,7 @@
 			fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
 			:
 			fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
-	if (ssw & DF) 
+	if (ssw & DF)
 		printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
 			ssw & RW ? "read" : "write",
 			fp->un.fmtb.daddr,
@@ -559,7 +559,7 @@
 	 * the testing for a bad kernel-space access (demand-mapping applies
 	 * to kernel accesses too).
 	 */
-	
+
 	if ((ssw & DF)
 	    && (buserr_type & (SUN3_BUSERR_PROTERR | SUN3_BUSERR_INVALID))) {
 		if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 0))
@@ -659,7 +659,7 @@
 		printk ("protection fault on insn access (segv).\n");
 #endif
 		force_sig (SIGSEGV, current);
-       }	
+       }
 }
 #else
 #if defined(CPU_M68020_OR_M68030)
@@ -1035,7 +1035,7 @@
 			fp->ptregs.format);
 	else
 		printk ("*** Exception %d ***   FORMAT=%X\n",
-			(fp->ptregs.vector) >> 2, 
+			(fp->ptregs.vector) >> 2,
 			fp->ptregs.format);
 	if (fp->ptregs.vector >> 2 == VEC_ADDRERR && CPU_IS_020_OR_030) {
 		unsigned short ssw = fp->un.fmtb.ssw;
@@ -1187,6 +1187,7 @@
 
 	console_verbose();
 	printk("%s: %08x\n",str,nr);
+	print_modules();
 	printk("PC: [<%08lx>]",fp->pc);
 	print_symbol(" %s\n", fp->pc);
 	printk("\nSR: %04x  SP: %p  a2: %08lx\n",
diff -Nru a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
--- a/arch/m68k/kernel/vmlinux-std.lds	Tue Jun 15 22:20:58 2004
+++ b/arch/m68k/kernel/vmlinux-std.lds	Tue Jun 15 22:20:58 2004
@@ -41,7 +41,7 @@
   /* will be freed after init */
   . = ALIGN(4096);		/* Init code and data */
   __init_begin = .;
-  .init.text : { 
+  .init.text : {
 	_sinittext = .;
 	*(.init.text)
 	_einittext = .;
@@ -56,12 +56,12 @@
   __stop___param = .;
   __initcall_start = .;
   .initcall.init : {
-	*(.initcall1.init) 
-	*(.initcall2.init) 
-	*(.initcall3.init) 
-	*(.initcall4.init) 
-	*(.initcall5.init) 
-	*(.initcall6.init) 
+	*(.initcall1.init)
+	*(.initcall2.init)
+	*(.initcall3.init)
+	*(.initcall4.init)
+	*(.initcall5.init)
+	*(.initcall6.init)
 	*(.initcall7.init)
   }
   __initcall_end = .;
diff -Nru a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
--- a/arch/m68k/kernel/vmlinux-sun3.lds	Tue Jun 15 22:20:35 2004
+++ b/arch/m68k/kernel/vmlinux-sun3.lds	Tue Jun 15 22:20:35 2004
@@ -24,10 +24,10 @@
   .data : {			/* Data */
 	*(.data)
 	CONSTRUCTORS
-  	. = ALIGN(16);		/* Exception table */
-  	__start___ex_table = .;
-  	*(__ex_table) 
-  	__stop___ex_table = .;
+	. = ALIGN(16);		/* Exception table */
+	__start___ex_table = .;
+	*(__ex_table)
+	__stop___ex_table = .;
 	}
   /* End of data goes *here* so that freeing init code works properly. */
   _edata = .;
@@ -35,12 +35,12 @@
   /* will be freed after init */
   . = ALIGN(8192);	/* Init code and data */
 __init_begin = .;
-	.init.text : { 
+	.init.text : {
 		_sinittext = .;
 		*(.init.text)
 		_einittext = .;
 	}
-  	.init.data : { *(.init.data) }
+	.init.data : { *(.init.data) }
 	. = ALIGN(16);
 	__setup_start = .;
 	.init.setup : { *(.init.setup) }
@@ -50,12 +50,12 @@
 	__stop___param = .;
 	__initcall_start = .;
 	.initcall.init : {
-		*(.initcall1.init) 
-		*(.initcall2.init) 
-		*(.initcall3.init) 
-		*(.initcall4.init) 
-		*(.initcall5.init) 
-		*(.initcall6.init) 
+		*(.initcall1.init)
+		*(.initcall2.init)
+		*(.initcall3.init)
+		*(.initcall4.init)
+		*(.initcall5.init)
+		*(.initcall6.init)
 		*(.initcall7.init)
 	}
 	__initcall_end = .;
@@ -70,7 +70,7 @@
 	. = ALIGN(8192);
 	__init_end = .;
 	.init.task : { *(init_task) }
-	
+
 
   .bss : { *(.bss) }		/* BSS */
 
@@ -84,7 +84,7 @@
 	}
 
   .crap : {
-  	/* Stabs debugging sections.  */
+	/* Stabs debugging sections.  */
 	*(.stab)
 	*(.stabstr)
 	*(.stab.excl)
diff -Nru a/arch/m68k/lib/ashldi3.c b/arch/m68k/lib/ashldi3.c
--- a/arch/m68k/lib/ashldi3.c	Tue Jun 15 22:20:35 2004
+++ b/arch/m68k/lib/ashldi3.c	Tue Jun 15 22:20:35 2004
@@ -20,7 +20,7 @@
 
 #define BITS_PER_UNIT 8
 
-typedef 	 int SItype	__attribute__ ((mode (SI)));
+typedef		 int SItype	__attribute__ ((mode (SI)));
 typedef unsigned int USItype	__attribute__ ((mode (SI)));
 typedef		 int DItype	__attribute__ ((mode (DI)));
 typedef int word_type __attribute__ ((mode (__word__)));
diff -Nru a/arch/m68k/lib/ashrdi3.c b/arch/m68k/lib/ashrdi3.c
--- a/arch/m68k/lib/ashrdi3.c	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/lib/ashrdi3.c	Tue Jun 15 22:20:38 2004
@@ -20,7 +20,7 @@
 
 #define BITS_PER_UNIT 8
 
-typedef 	 int SItype	__attribute__ ((mode (SI)));
+typedef		 int SItype	__attribute__ ((mode (SI)));
 typedef unsigned int USItype	__attribute__ ((mode (SI)));
 typedef		 int DItype	__attribute__ ((mode (DI)));
 typedef int word_type __attribute__ ((mode (__word__)));
diff -Nru a/arch/m68k/lib/lshrdi3.c b/arch/m68k/lib/lshrdi3.c
--- a/arch/m68k/lib/lshrdi3.c	Tue Jun 15 22:20:58 2004
+++ b/arch/m68k/lib/lshrdi3.c	Tue Jun 15 22:20:58 2004
@@ -20,7 +20,7 @@
 
 #define BITS_PER_UNIT 8
 
-typedef 	 int SItype	__attribute__ ((mode (SI)));
+typedef		 int SItype	__attribute__ ((mode (SI)));
 typedef unsigned int USItype	__attribute__ ((mode (SI)));
 typedef		 int DItype	__attribute__ ((mode (DI)));
 typedef int word_type __attribute__ ((mode (__word__)));
diff -Nru a/arch/m68k/lib/muldi3.c b/arch/m68k/lib/muldi3.c
--- a/arch/m68k/lib/muldi3.c	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/lib/muldi3.c	Tue Jun 15 22:20:39 2004
@@ -1,4 +1,4 @@
-/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and 
+/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and
 			   gcc-2.7.2.3/longlong.h which is: */
 /* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
 
@@ -33,7 +33,7 @@
     umul_ppmm (__w.s.high, __w.s.low, u, v);				\
     __w.ll; })
 
-typedef 	 int SItype	__attribute__ ((mode (SI)));
+typedef		 int SItype	__attribute__ ((mode (SI)));
 typedef unsigned int USItype	__attribute__ ((mode (SI)));
 typedef		 int DItype	__attribute__ ((mode (DI)));
 typedef int word_type __attribute__ ((mode (__word__)));
diff -Nru a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
--- a/arch/m68k/mac/baboon.c	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/mac/baboon.c	Tue Jun 15 22:20:42 2004
@@ -14,9 +14,9 @@
 #include <linux/ide.h>
 
 #include <asm/traps.h>
-#include <asm/bootinfo.h> 
-#include <asm/macintosh.h> 
-#include <asm/macints.h> 
+#include <asm/bootinfo.h>
+#include <asm/macintosh.h>
+#include <asm/macints.h>
 #include <asm/mac_baboon.h>
 
 /* #define DEBUG_BABOON */
diff -Nru a/arch/m68k/mac/bootparse.c b/arch/m68k/mac/bootparse.c
--- a/arch/m68k/mac/bootparse.c	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/mac/bootparse.c	Tue Jun 15 22:20:40 2004
@@ -9,114 +9,114 @@
 /*
  *	Booter vars
  */
- 
+
 int boothowto;
 int _boothowto;
- 
+
 /*
  *	Called early to parse the environment (passed to us from the booter)
  *	into a bootinfo struct. Will die as soon as we have our own booter
  */
 
 #define atol(x)	simple_strtoul(x,NULL,0)
- 
+
 void parse_booter(char *env)
 {
- 	char *name;
- 	char *value;
+	char *name;
+	char *value;
 #if 0
- 	while(0 && *env)
+	while(0 && *env)
 #else
- 	while(*env)
+	while(*env)
 #endif
- 	{
- 		name=env;
- 		value=name;
- 		while(*value!='='&&*value)
- 			value++;
- 		if(*value=='=')
- 			*value++=0;
- 		env=value;
- 		while(*env)
- 			env++;
- 		env++;
-#if 0 			
- 		if(strcmp(name,"VIDEO_ADDR")==0)
- 			mac_mch.videoaddr=atol(value);
- 		if(strcmp(name,"ROW_BYTES")==0)
- 			mac_mch.videorow=atol(value); 			
- 		if(strcmp(name,"SCREEN_DEPTH")==0)
- 			mac_mch.videodepth=atol(value);
- 		if(strcmp(name,"DIMENSIONS")==0)
- 			mac_mch.dimensions=atol(value);
-#endif 			
- 		if(strcmp(name,"BOOTTIME")==0)
- 			mac_bi_data.boottime=atol(value);
- 		if(strcmp(name,"GMTBIAS")==0)
- 			mac_bi_data.gmtbias=atol(value);
- 		if(strcmp(name,"BOOTERVER")==0)
- 			mac_bi_data.bootver=atol(value);
- 		if(strcmp(name,"MACOS_VIDEO")==0)
- 			mac_bi_data.videological=atol(value);
- 		if(strcmp(name,"MACOS_SCC")==0)
- 			mac_bi_data.sccbase=atol(value);
- 		if(strcmp(name,"MACHINEID")==0)
- 			mac_bi_data.id=atol(value);
- 		if(strcmp(name,"MEMSIZE")==0)
- 			mac_bi_data.memsize=atol(value);
- 		if(strcmp(name,"SERIAL_MODEM_FLAGS")==0)
- 			mac_bi_data.serialmf=atol(value);
- 		if(strcmp(name,"SERIAL_MODEM_HSKICLK")==0)
- 			mac_bi_data.serialhsk=atol(value);
- 		if(strcmp(name,"SERIAL_MODEM_GPICLK")==0)
- 			mac_bi_data.serialgpi=atol(value);
- 		if(strcmp(name,"SERIAL_PRINT_FLAGS")==0)
- 			mac_bi_data.printmf=atol(value);
- 		if(strcmp(name,"SERIAL_PRINT_HSKICLK")==0)
- 			mac_bi_data.printhsk=atol(value);
- 		if(strcmp(name,"SERIAL_PRINT_GPICLK")==0)
- 			mac_bi_data.printgpi=atol(value);
- 		if(strcmp(name,"PROCESSOR")==0)
- 			mac_bi_data.cpuid=atol(value);
- 		if(strcmp(name,"ROMBASE")==0)
- 			mac_bi_data.rombase=atol(value);
- 		if(strcmp(name,"TIMEDBRA")==0)
- 			mac_bi_data.timedbra=atol(value);
- 		if(strcmp(name,"ADBDELAY")==0)
- 			mac_bi_data.adbdelay=atol(value);
- 	}
+	{
+		name=env;
+		value=name;
+		while(*value!='='&&*value)
+			value++;
+		if(*value=='=')
+			*value++=0;
+		env=value;
+		while(*env)
+			env++;
+		env++;
+#if 0
+		if(strcmp(name,"VIDEO_ADDR")==0)
+			mac_mch.videoaddr=atol(value);
+		if(strcmp(name,"ROW_BYTES")==0)
+			mac_mch.videorow=atol(value);
+		if(strcmp(name,"SCREEN_DEPTH")==0)
+			mac_mch.videodepth=atol(value);
+		if(strcmp(name,"DIMENSIONS")==0)
+			mac_mch.dimensions=atol(value);
+#endif
+		if(strcmp(name,"BOOTTIME")==0)
+			mac_bi_data.boottime=atol(value);
+		if(strcmp(name,"GMTBIAS")==0)
+			mac_bi_data.gmtbias=atol(value);
+		if(strcmp(name,"BOOTERVER")==0)
+			mac_bi_data.bootver=atol(value);
+		if(strcmp(name,"MACOS_VIDEO")==0)
+			mac_bi_data.videological=atol(value);
+		if(strcmp(name,"MACOS_SCC")==0)
+			mac_bi_data.sccbase=atol(value);
+		if(strcmp(name,"MACHINEID")==0)
+			mac_bi_data.id=atol(value);
+		if(strcmp(name,"MEMSIZE")==0)
+			mac_bi_data.memsize=atol(value);
+		if(strcmp(name,"SERIAL_MODEM_FLAGS")==0)
+			mac_bi_data.serialmf=atol(value);
+		if(strcmp(name,"SERIAL_MODEM_HSKICLK")==0)
+			mac_bi_data.serialhsk=atol(value);
+		if(strcmp(name,"SERIAL_MODEM_GPICLK")==0)
+			mac_bi_data.serialgpi=atol(value);
+		if(strcmp(name,"SERIAL_PRINT_FLAGS")==0)
+			mac_bi_data.printmf=atol(value);
+		if(strcmp(name,"SERIAL_PRINT_HSKICLK")==0)
+			mac_bi_data.printhsk=atol(value);
+		if(strcmp(name,"SERIAL_PRINT_GPICLK")==0)
+			mac_bi_data.printgpi=atol(value);
+		if(strcmp(name,"PROCESSOR")==0)
+			mac_bi_data.cpuid=atol(value);
+		if(strcmp(name,"ROMBASE")==0)
+			mac_bi_data.rombase=atol(value);
+		if(strcmp(name,"TIMEDBRA")==0)
+			mac_bi_data.timedbra=atol(value);
+		if(strcmp(name,"ADBDELAY")==0)
+			mac_bi_data.adbdelay=atol(value);
+	}
 #if 0	/* XXX: TODO with m68k_mach_* */
- 	/* Fill in the base stuff */
- 	boot_info.machtype=MACH_MAC;
- 	/* Read this from the macinfo we got ! */
+	/* Fill in the base stuff */
+	boot_info.machtype=MACH_MAC;
+	/* Read this from the macinfo we got ! */
 /*	boot_info.cputype=CPU_68020|FPUB_68881;*/
-/* 	boot_info.memory[0].addr=0;*/
-/* 	boot_info.memory[0].size=((mac_bi_data.id>>7)&31)<<20;*/
- 	boot_info.num_memory=1;		/* On a MacII */
- 	boot_info.ramdisk_size=0;	/* For now */
- 	*boot_info.command_line=0;
+/*	boot_info.memory[0].addr=0;*/
+/*	boot_info.memory[0].size=((mac_bi_data.id>>7)&31)<<20;*/
+	boot_info.num_memory=1;		/* On a MacII */
+	boot_info.ramdisk_size=0;	/* For now */
+	*boot_info.command_line=0;
 #endif
  }
- 
+
 
 void print_booter(char *env)
 {
- 	char *name;
- 	char *value;
- 	while(*env)
- 	{
- 		name=env;
- 		value=name;
- 		while(*value!='='&&*value)
- 			value++;
- 		if(*value=='=')
- 			*value++=0;
- 		env=value;
- 		while(*env)
- 			env++;
- 		env++;
- 		printk("%s=%s\n", name,value);
- 	}
+	char *name;
+	char *value;
+	while(*env)
+	{
+		name=env;
+		value=name;
+		while(*value!='='&&*value)
+			value++;
+		if(*value=='=')
+			*value++=0;
+		env=value;
+		while(*env)
+			env++;
+		env++;
+		printk("%s=%s\n", name,value);
+	}
  }
- 
+
 
diff -Nru a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
--- a/arch/m68k/mac/config.c	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/mac/config.c	Tue Jun 15 22:20:39 2004
@@ -176,7 +176,7 @@
 
 /*
  * Flip into 24bit mode for an instant - flushes the L2 cache card. We
- * have to disable interrupts for this. Our IRQ handlers will crap 
+ * have to disable interrupts for this. Our IRQ handlers will crap
  * themselves if they take an IRQ in 24bit mode!
  */
 
@@ -232,10 +232,10 @@
 	/*
 	 * Determine hardware present
 	 */
-     
+
 	mac_identify();
 	mac_report_hardware();
-    
+
 	/* AFAIK only the IIci takes a cache card.  The IIfx has onboard
 	   cache ... someone needs to figure out how to tell if it's on or
 	   not. */
@@ -252,21 +252,21 @@
 #ifdef OLD_NUBUS_CODE
 	 nubus_sweep_video();
 #endif
-}	
+}
 
 
 /*
- *	Macintosh Table: hardcoded model configuration data. 
+ *	Macintosh Table: hardcoded model configuration data.
  *
- *	Much of this was defined by Alan, based on who knows what docs. 
- *	I've added a lot more, and some of that was pure guesswork based 
- *	on hardware pages present on the Mac web site. Possibly wildly 
+ *	Much of this was defined by Alan, based on who knows what docs.
+ *	I've added a lot more, and some of that was pure guesswork based
+ *	on hardware pages present on the Mac web site. Possibly wildly
  *	inaccurate, so look here if a new Mac model won't run. Example: if
  *	a Mac crashes immediately after the VIA1 registers have been dumped
- *	to the screen, it probably died attempting to read DirB on a RBV. 
+ *	to the screen, it probably died attempting to read DirB on a RBV.
  *	Meaning it should have MAC_VIA_IIci here :-)
  */
- 
+
 struct mac_model *macintosh_config;
 EXPORT_SYMBOL(macintosh_config);
 
@@ -288,9 +288,9 @@
 
 	/*
 	 *	Original MacII hardware
-	 *	
+	 *
 	 */
-	 
+
 	{
 		.ident		= MAC_MODEL_II,
 		.name		= "II",
@@ -324,7 +324,7 @@
 		.scc_type	= MAC_SCC_II,
 		.nubus_type	= MAC_NUBUS
 	},
-	
+
 	/*
 	 *	Weirdified MacII hardware - all subtley different. Gee thanks
 	 *	Apple. All these boxes seem to have VIA2 in a different place to
@@ -373,7 +373,7 @@
 		.scc_type	= MAC_SCC_II,
 		.nubus_type	= MAC_NUBUS
 	},
-	
+
 	/*
 	 *	Classic models (guessing: similar to SE/30 ?? Nope, similar to LC ...)
 	 */
@@ -398,7 +398,7 @@
 	/*
 	 *	Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
 	 */
-	
+
 	{
 		.ident		= MAC_MODEL_LC,
 		.name		= "LC",
@@ -426,15 +426,15 @@
 	},
 
 	/*
-	 *	Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently 
-	 *	as some of the stuff connected to VIA2 seems different. Better SCSI chip and 
-	 *	onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an 
+	 *	Quadra. Video is at 0xF9000000, via is like a MacII. We label it differently
+	 *	as some of the stuff connected to VIA2 seems different. Better SCSI chip and
+	 *	onboard ethernet using a NatSemi SONIC except the 660AV and 840AV which use an
 	 *	AMD 79C940 (MACE).
 	 *	The 700, 900 and 950 have some I/O chips in the wrong place to
 	 *	confuse us. The 840AV has a SCSI location of its own (same as
 	 *	the 660AV).
-	 */	 
-	 
+	 */
+
 	{
 		.ident		= MAC_MODEL_Q605,
 		.name		= "Quadra 605",
@@ -528,7 +528,7 @@
 		.nubus_type	= MAC_NUBUS
 	},
 
-	/* 
+	/*
 	 *	Performa - more LC type machines
 	 */
 
@@ -816,7 +816,7 @@
 {
 	struct mac_model *m;
 
-	/* Penguin data useful? */	
+	/* Penguin data useful? */
 	int model = mac_bi_data.id;
 	if (!model) {
 		/* no bootinfo model id -> NetBSD booter was used! */
@@ -825,7 +825,7 @@
 		printk (KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
 	}
 
-	macintosh_config = mac_data_table; 
+	macintosh_config = mac_data_table;
 	for (m = macintosh_config ; m->ident != -1 ; m++) {
 		if (m->ident == model) {
 			macintosh_config = m;
@@ -846,19 +846,19 @@
 	 * Report booter data:
 	 */
 	printk (KERN_DEBUG " Penguin bootinfo data:\n");
-	printk (KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n", 
-		mac_bi_data.videoaddr, mac_bi_data.videorow, 
-		mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, 
-		mac_bi_data.dimensions >> 16); 
+	printk (KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
+		mac_bi_data.videoaddr, mac_bi_data.videorow,
+		mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
+		mac_bi_data.dimensions >> 16);
 	printk (KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
-		mac_bi_data.videological, mac_orig_videoaddr, 
-		mac_bi_data.sccbase); 
+		mac_bi_data.videological, mac_orig_videoaddr,
+		mac_bi_data.sccbase);
 	printk (KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
-		mac_bi_data.boottime, mac_bi_data.gmtbias); 
+		mac_bi_data.boottime, mac_bi_data.gmtbias);
 	printk (KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
-		mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); 
+		mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
 #if 0
-	printk ("Ramdisk: addr 0x%lx size 0x%lx\n", 
+	printk ("Ramdisk: addr 0x%lx size 0x%lx\n",
 		m68k_ramdisk.addr, m68k_ramdisk.size);
 #endif
 
diff -Nru a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
--- a/arch/m68k/mac/debug.c	Tue Jun 15 22:21:03 2004
+++ b/arch/m68k/mac/debug.c	Tue Jun 15 22:21:03 2004
@@ -8,7 +8,7 @@
  * Atari debugging and serial console stuff
  *
  * Assembled of parts of former atari/config.c 97-12-18 by Roman Hodek
- *  
+ *
  * 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.
@@ -43,7 +43,7 @@
 #define DEBUG_SERIAL
 
 /*
- * These two auxiliary debug functions should go away ASAP. Only usage: 
+ * These two auxiliary debug functions should go away ASAP. Only usage:
  * before the console output is up (after head.S come some other crucial
  * setup routines :-) it permits writing 'data' to the screen as bit patterns
  * (good luck reading those). Helped to figure that the bootinfo contained
@@ -77,9 +77,9 @@
 	/* calculate current offset */
 	pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
 		    +80*peng;
-	
+
 	pptr=pengoffset;
-	
+
 	for(i=0;i<8*sizeof(short);i++) /* # of bits */
 	{
 		/*        value        mask for bit i, reverse order */
@@ -112,12 +112,12 @@
 		/* printk("debug: #%ld !\n", addr); */
 		return;
 	}
-	
+
 	pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
 		    +80*peng;
-	
+
 	pptr=pengoffset;
-	
+
 	for(i=0;i<8*sizeof(long);i++) /* # of bits */
 	{
 		*pptr++ = (addr & ( 1 << (8*sizeof(long)-i-1) ) ? 0xFF : 0x00);
@@ -270,7 +270,7 @@
 	for( i = 60*uSEC; i > 0; --i )		\
 	    barrier();				\
     } while(0)
-    
+
 #ifndef CONFIG_SERIAL_CONSOLE
 static void __init mac_init_scc_port( int cflag, int port )
 #else
@@ -285,17 +285,17 @@
 
 	static int clksrc_table[9] =
 		/* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */
-    		{ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
+		{ 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
 	static int clkmode_table[9] =
 		/* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */
-    		{ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 };
+		{ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 };
 	static int div_table[9] =
 		/* reg12 (BRG low) */
-    		{ 94, 62, 46, 22, 10, 4, 1, 0, 0 };
+		{ 94, 62, 46, 22, 10, 4, 1, 0, 0 };
 
     int baud = cflag & CBAUD;
     int clksrc, clkmode, div, reg3, reg5;
-    
+
     if (cflag & CBAUDEX)
 	baud += B38400;
     if (baud < B1200 || baud > B38400+2)
diff -Nru a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
--- a/arch/m68k/mac/iop.c	Tue Jun 15 22:21:03 2004
+++ b/arch/m68k/mac/iop.c	Tue Jun 15 22:21:03 2004
@@ -113,9 +113,9 @@
 #include <linux/proc_fs.h>
 #include <linux/interrupt.h>
 
-#include <asm/bootinfo.h> 
-#include <asm/macintosh.h> 
-#include <asm/macints.h> 
+#include <asm/bootinfo.h>
+#include <asm/macintosh.h>
+#include <asm/macints.h>
 #include <asm/mac_iop.h>
 #include <asm/mac_oss.h>
 
@@ -485,7 +485,7 @@
 
 /*
  * Send a message
- * 
+ *
  * The message is placed at the end of the send queue. Afterwards if the
  * channel is idle we force an immediate send of the next message in the
  * queue.
@@ -537,7 +537,7 @@
 	if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return;
 
 	iop_loadaddr(iop_base[iop_num], shared_ram_start);
-	
+
 	while (code_len--) {
 		iop_base[iop_num]->ram_data = *code_start++;
 	}
@@ -553,7 +553,7 @@
 	if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return;
 
 	iop_loadaddr(iop_base[iop_num], shared_ram_start);
-	
+
 	while (code_len--) {
 		*code_start++ = iop_base[iop_num]->ram_data;
 	}
@@ -571,7 +571,7 @@
 	if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return code_start;
 
 	iop_loadaddr(iop_base[iop_num], shared_ram_start);
-	
+
 	while (code_len--) {
 		if (*code_start != iop_base[iop_num]->ram_data) {
 			return code_start;
@@ -666,12 +666,12 @@
 			iop_chan_state(iop_readb(iop, IOP_ADDR_RECV_STATE+i)),
 			iop_listeners[iop_num][i].handler?
 				      iop_listeners[iop_num][i].devname : "");
-			
+
 	}
 	len += sprintf(buf+len, "\n");
 	return len;
 }
- 
+
 static int iop_get_proc_info(char *buf, char **start, off_t pos, int count)
 {
 	int len, cnt;
diff -Nru a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
--- a/arch/m68k/mac/macboing.c	Tue Jun 15 22:21:02 2004
+++ b/arch/m68k/mac/macboing.c	Tue Jun 15 22:21:02 2004
@@ -1,7 +1,7 @@
 /*
  *	Mac bong noise generator. Note - we ought to put a boingy noise
  *	here 8)
- *	 
+ *
  *	----------------------------------------------------------------------
  *	16.11.98:
  *	rewrote some functions, added support for Enhanced ASC (Quadras)
@@ -22,8 +22,8 @@
 static __u8 mac_asc_wave_tab[ 0x800 ];
 
 /*
- * Alan's original sine table; needs interpolating to 0x800 
- * (hint: interpolate or hardwire [0 -> Pi/2[, it's symmetric) 
+ * Alan's original sine table; needs interpolating to 0x800
+ * (hint: interpolate or hardwire [0 -> Pi/2[, it's symmetric)
  */
 static const signed char sine_data[] = {
 	0,  39,  75,  103,  121,  127,  121,  103,  75,  39,
@@ -35,16 +35,16 @@
  */
 static volatile __u8* mac_asc_regs = ( void* )0x50F14000;
 
-/* 
- * sample rate; is this a good default value? 
+/*
+ * sample rate; is this a good default value?
  */
-static unsigned long mac_asc_samplespersec = 11050;  
+static unsigned long mac_asc_samplespersec = 11050;
 static int mac_bell_duration;
 static unsigned long mac_bell_phase; /* 0..2*Pi -> 0..0x800 (wavetable size) */
 static unsigned long mac_bell_phasepersample;
 
 /*
- * some function protos 
+ * some function protos
  */
 static void mac_init_asc( void );
 static void mac_nosound( unsigned long );
@@ -67,11 +67,11 @@
 {
 	int i;
 
-	/* 
-	 * do some machine specific initialization 
+	/*
+	 * do some machine specific initialization
 	 * BTW:
 	 * the NetBSD Quadra patch identifies the Enhanced Apple Sound Chip via
-	 * 	mac_asc_regs[ 0x800 ] & 0xF0 != 0
+	 *	mac_asc_regs[ 0x800 ] & 0xF0 != 0
 	 * this makes no sense here, because we have to set the default sample
 	 * rate anyway if we want correct frequencies
 	 */
@@ -83,27 +83,27 @@
 			 */
 			mac_asc_regs = ( void* )0x50010000;
 			break;
-			/* 
-			 * not sure about how correct this list is 
-			 * machines with the EASC enhanced apple sound chip 
+			/*
+			 * not sure about how correct this list is
+			 * machines with the EASC enhanced apple sound chip
 			 */
 		case MAC_MODEL_Q630:
 		case MAC_MODEL_P475:
 			mac_special_bell = mac_quadra_start_bell;
 			mac_asc_samplespersec = 22150;
-			break;	
+			break;
 		case MAC_MODEL_C660:
 		case MAC_MODEL_Q840:
 			/*
 			 * The Quadra 660AV and 840AV use the "Singer" custom ASIC for sound I/O.
-			 * It appears to be similar to the "AWACS" custom ASIC in the Power Mac 
-			 * [678]100.  Because Singer and AWACS may have a similar hardware 
-			 * interface, this would imply that the code in drivers/sound/dmasound.c 
+			 * It appears to be similar to the "AWACS" custom ASIC in the Power Mac
+			 * [678]100.  Because Singer and AWACS may have a similar hardware
+			 * interface, this would imply that the code in drivers/sound/dmasound.c
 			 * for AWACS could be used as a basis for Singer support.  All we have to
-			 * do is figure out how to do DMA on the 660AV/840AV through the PSC and 
+			 * do is figure out how to do DMA on the 660AV/840AV through the PSC and
 			 * figure out where the Singer hardware sits in memory. (I'd look in the
-			 * vicinity of the AWACS location in a Power Mac [678]100 first, or the 
-			 * current location of the Apple Sound Chip--ASC--in other Macs.)  The 
+			 * vicinity of the AWACS location in a Power Mac [678]100 first, or the
+			 * current location of the Apple Sound Chip--ASC--in other Macs.)  The
 			 * Power Mac [678]100 info can be found in MkLinux Mach kernel sources.
 			 *
 			 * Quoted from Apple's Tech Info Library, article number 16405:
@@ -111,7 +111,7 @@
 			 *   Macintosh models have 16-bit audio input and output capability
 			 *   because of the AT&T DSP3210 hardware circuitry and the 16-bit Singer
 			 *   codec circuitry in the AVs.  The Audio Waveform Amplifier and
-			 *   Converter (AWAC) chip in the Power Macintosh performs the same 
+			 *   Converter (AWAC) chip in the Power Macintosh performs the same
 			 *   16-bit I/O functionality.  The PowerBook 500 series computers
 			 *   support 16-bit stereo output, but only mono input."
 			 *
@@ -139,8 +139,8 @@
 			break;
 	}
 
-	/* 
-	 * init the wave table with a simple triangular wave 
+	/*
+	 * init the wave table with a simple triangular wave
 	 * A sine wave would sure be nicer here ...
 	 */
 	for ( i = 0; i < 0x400; i++ )
@@ -149,15 +149,15 @@
 		mac_asc_wave_tab[ i + 0x400 ] = 0xFF - i / 4;
 	}
 	mac_asc_inited = 1;
-}	
+}
 
 /*
- * Called to make noise; current single entry to the boing driver. 
+ * Called to make noise; current single entry to the boing driver.
  * Does the job for simple ASC, calls other routines else.
  * XXX Fixme:
- * Should be split into asc_mksound, easc_mksound, av_mksound and 
- * function pointer set in mac_init_asc which would be called at 
- * init time. 
+ * Should be split into asc_mksound, easc_mksound, av_mksound and
+ * function pointer set in mac_init_asc which would be called at
+ * init time.
  * _This_ is rather ugly ...
  */
 void mac_mksound( unsigned int freq, unsigned int length )
@@ -192,7 +192,7 @@
 	del_timer( &mac_sound_timer );
 
 	for ( i = 0; i < 0x800; i++ )
-		mac_asc_regs[ i ] = 0;	
+		mac_asc_regs[ i ] = 0;
 	for ( i = 0; i < 0x800; i++ )
 		mac_asc_regs[ i ] = mac_asc_wave_tab[ i ];
 
@@ -218,7 +218,7 @@
 static void mac_nosound( unsigned long ignored )
 {
 	mac_asc_regs[ ASC_ENABLE ] = 0;
-}	
+}
 
 /*
  * EASC entry; init EASC, don't load wavetable, schedule 'start whining'.
@@ -237,7 +237,7 @@
 	mac_bell_duration = length;
 	mac_bell_phase = 0;
 	mac_bell_phasepersample = ( freq * sizeof( mac_asc_wave_tab ) ) / mac_asc_samplespersec;
-	/* this is reasonably big for small frequencies */ 
+	/* this is reasonably big for small frequencies */
 
 	local_irq_save(flags);
 
@@ -247,11 +247,11 @@
 	/* set up the ASC registers */
 	if ( mac_asc_regs[ 0x801 ] != 1 )
 	{
-		/* select mono mode */	
+		/* select mono mode */
 		mac_asc_regs[ 0x807 ] = 0;
 		/* select sampled sound mode */
 		mac_asc_regs[ 0x802 ] = 0;
-	 	/* ??? */	
+		/* ??? */
 		mac_asc_regs[ 0x801 ] = 1;
 		mac_asc_regs[ 0x803 ] |= 0x80;
 		mac_asc_regs[ 0x803 ] &= 0x7F;
@@ -266,12 +266,12 @@
 
 /*
  * EASC 'start/continue whining'; I'm not sure why the above function didn't
- * already load the wave table, or at least call this one... 
+ * already load the wave table, or at least call this one...
  * This piece keeps reloading the wave table until done.
  */
 static void mac_quadra_ring_bell( unsigned long ignored )
 {
-	int 	i, count = mac_asc_samplespersec / HZ;
+	int	i, count = mac_asc_samplespersec / HZ;
 	__u32 flags;
 
 	/*
@@ -282,7 +282,7 @@
 	 */
 
 	local_irq_save(flags);
-	
+
 	del_timer( &mac_sound_timer );
 
 	if ( mac_bell_duration-- > 0 )
@@ -297,7 +297,7 @@
 	}
 	else
 		mac_asc_regs[ 0x801 ] = 0;
-	
+
 	local_irq_restore(flags);
 }
 
@@ -306,4 +306,4 @@
  */
 static void mac_av_start_bell( unsigned int freq, unsigned int length, unsigned int volume )
 {
-} 
+}
diff -Nru a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
--- a/arch/m68k/mac/macints.c	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/mac/macints.c	Tue Jun 15 22:20:44 2004
@@ -2,8 +2,8 @@
  *	Macintosh interrupts
  *
  * General design:
- * In contrary to the Amiga and Atari platforms, the Mac hardware seems to 
- * exclusively use the autovector interrupts (the 'generic level0-level7' 
+ * In contrary to the Amiga and Atari platforms, the Mac hardware seems to
+ * exclusively use the autovector interrupts (the 'generic level0-level7'
  * interrupts with exception vectors 0x19-0x1f). The following interrupt levels
  * are used:
  *	1	- VIA1
@@ -248,7 +248,7 @@
 	printk("Done.\n");
 #endif /* SHUTUP_SONIC */
 
-	/* 
+	/*
 	 * Now register the handlers for the master IRQ handlers
 	 * at levels 1-7. Most of the work is done elsewhere.
 	 */
@@ -496,7 +496,7 @@
  * FIXME: You can register interrupts on nonexistent source (ie PSC4 on a
  *        non-PSC machine). We should return -EINVAL in those cases.
  */
- 
+
 int mac_request_irq(unsigned int irq,
 		    irqreturn_t (*handler)(int, void *, struct pt_regs *),
 		    unsigned long flags, const char *devname, void *dev_id)
@@ -533,7 +533,7 @@
 
 	return 0;
 }
-                            
+
 /*
  * Removes an interrupt service routine from an interrupt source.
  */
@@ -661,7 +661,7 @@
 irqreturn_t mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp)
 {
 	int i;
-	/* 
+	/*
 	 * generate debug output on NMI switch if 'debug' kernel option given
 	 * (only works with Penguin!)
 	 */
@@ -691,7 +691,7 @@
 		       fp->d0, fp->d1, fp->d2, fp->d3);
 		printk("d4: %08lx    d5: %08lx    a0: %08lx    a1: %08lx\n",
 		       fp->d4, fp->d5, fp->a0, fp->a1);
-	
+
 		if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
 			printk("Corrupted stack page\n");
 		printk("Process %s (pid: %d, stackpage=%08lx)\n",
diff -Nru a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
--- a/arch/m68k/mac/misc.c	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/mac/misc.c	Tue Jun 15 22:20:40 2004
@@ -1,5 +1,5 @@
 /*
- * Miscellaneous Mac68K-specific stuff 
+ * Miscellaneous Mac68K-specific stuff
  */
 
 #include <linux/config.h>
@@ -67,7 +67,7 @@
 	volatile struct adb_request req;
 
 	data += RTC_OFFSET;
-	
+
 	adb_request((struct adb_request *) &req, NULL,
 			ADBREQ_RAW|ADBREQ_SYNC,
 			6, CUDA_PACKET, CUDA_SET_TIME,
@@ -324,7 +324,7 @@
 	adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC,
 			3, PMU_PACKET, PMU_SET_INTR_MASK,
 			PMU_INT_ADB|PMU_INT_TICK);
-	
+
 	adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC,
 			2, PMU_PACKET, PMU_RESET);
 }
@@ -477,7 +477,7 @@
                     ".chip 68030\n\t"
 		    "lea %/pc@(1f),%/a0\n\t"
 		    "addl %0,%/a0\n\t"/* fixup target address and stack ptr */
-		    "addl %0,%/sp\n\t" 
+		    "addl %0,%/sp\n\t"
 		    "pflusha\n\t"
 		    "jmp %/a0@\n\t" /* jump into physical memory */
 		    "0:.long 0\n\t" /* a constant zero. */
@@ -494,7 +494,7 @@
 		    "movec %/a0, %/cacr\n\t" /* flush i&d caches */
 		    "movew #0x2700,%/sr\n\t" /* set up status register */
 		    "movel %1@(0x0),%/a0\n\t"/* load interrupt stack pointer */
-		    "movec %/a0, %/isp\n\t" 
+		    "movec %/a0, %/isp\n\t"
 		    "movel %1@(0x4),%/a0\n\t" /* load reset vector */
 		    "reset\n\t" /* reset external devices */
 		    "jmp %/a0@\n\t" /* jump to the reset vector */
@@ -579,7 +579,7 @@
 	return;
 }
 
-/* 
+/*
  * Read/write the hardware clock.
  */
 
diff -Nru a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
--- a/arch/m68k/mac/oss.c	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/mac/oss.c	Tue Jun 15 22:20:40 2004
@@ -20,9 +20,9 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 
-#include <asm/bootinfo.h> 
-#include <asm/machw.h> 
-#include <asm/macintosh.h> 
+#include <asm/bootinfo.h>
+#include <asm/machw.h>
+#include <asm/macintosh.h>
 #include <asm/macints.h>
 #include <asm/mac_via.h>
 #include <asm/mac_oss.h>
@@ -91,7 +91,7 @@
  * Handle miscellaneous OSS interrupts. Right now that's just sound
  * and SCSI; everything else is routed to its own autovector IRQ.
  */
- 
+
 irqreturn_t oss_irq(int irq, void *dev_id, struct pt_regs *regs)
 {
 	int events;
@@ -100,7 +100,7 @@
 	if (!events)
 		return IRQ_NONE;
 
-#ifdef DEBUG_IRQS	
+#ifdef DEBUG_IRQS
 	if ((console_loglevel == 10) && !(events & OSS_IP_SCSI)) {
 		printk("oss_irq: irq %d events = 0x%04X\n", irq,
 			(int) oss->irq_pending);
diff -Nru a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c
--- a/arch/m68k/mac/psc.c	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/mac/psc.c	Tue Jun 15 22:20:41 2004
@@ -20,9 +20,9 @@
 #include <linux/init.h>
 
 #include <asm/traps.h>
-#include <asm/bootinfo.h> 
-#include <asm/macintosh.h> 
-#include <asm/macints.h> 
+#include <asm/bootinfo.h>
+#include <asm/macintosh.h>
+#include <asm/macints.h>
 #include <asm/mac_psc.h>
 
 #define DEBUG_PSC
diff -Nru a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
--- a/arch/m68k/mac/via.c	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/mac/via.c	Tue Jun 15 22:20:39 2004
@@ -26,10 +26,10 @@
 #include <linux/ide.h>
 
 #include <asm/traps.h>
-#include <asm/bootinfo.h> 
-#include <asm/macintosh.h> 
+#include <asm/bootinfo.h>
+#include <asm/macintosh.h>
 #include <asm/macints.h>
-#include <asm/machw.h> 
+#include <asm/machw.h>
 #include <asm/mac_via.h>
 #include <asm/mac_psc.h>
 
@@ -93,7 +93,7 @@
 
 		/* IIci, IIsi, IIvx, IIvi (P6xx), LC series */
 
-		case MAC_VIA_IIci:	
+		case MAC_VIA_IIci:
 			via1 = (void *) VIA1_BASE;
 			if (macintosh_config->ident == MAC_MODEL_IIFX) {
 				via2 = NULL;
@@ -166,7 +166,7 @@
 	via1[vT2CH] = 0;
 	via1[vACR] &= 0x3F;
 
-	/* 
+	/*
 	 * SE/30: disable video IRQ
 	 * XXX: testing for SE/30 VBL
 	 */
@@ -174,8 +174,8 @@
 	if (macintosh_config->ident == MAC_MODEL_SE30) {
 		via1[vDirB] |= 0x40;
 		via1[vBufB] |= 0x40;
-	} 
-	
+	}
+
 	/*
 	 * Set the RTC bits to a known state: all lines to outputs and
 	 * RTC disabled (yes that's 0 to enable and 1 to disable).
@@ -243,7 +243,7 @@
  */
 
 void __init via_init_clock(irqreturn_t (*func)(int, void *, struct pt_regs *))
-{	
+{
 	via1[vACR] |= 0x40;
 	via1[vT1LL] = MAC_CLOCK_LOW;
 	via1[vT1LH] = MAC_CLOCK_HIGH;
@@ -537,7 +537,7 @@
 			/* But not on PowerBooks, that's ADB... */
 			if ((macintosh_config->adb_type != MAC_ADB_PB1) &&
 			   (macintosh_config->adb_type != MAC_ADB_PB2)) {
-			   	switch(macintosh_config->ident)
+				switch(macintosh_config->ident)
 				{
 					case MAC_MODEL_II:
 					case MAC_MODEL_IIX:
diff -Nru a/arch/m68k/math-emu/fp_arith.c b/arch/m68k/math-emu/fp_arith.c
--- a/arch/m68k/math-emu/fp_arith.c	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/math-emu/fp_arith.c	Tue Jun 15 22:20:38 2004
@@ -458,7 +458,7 @@
 		return;
 
 	/* infinities and zeroes */
-	if (IS_INF(dest) || IS_ZERO(dest)) 
+	if (IS_INF(dest) || IS_ZERO(dest))
 		return;
 
 	/* first truncate the lower bits */
diff -Nru a/arch/m68k/math-emu/fp_cond.S b/arch/m68k/math-emu/fp_cond.S
--- a/arch/m68k/math-emu/fp_cond.S	Tue Jun 15 22:21:03 2004
+++ b/arch/m68k/math-emu/fp_cond.S	Tue Jun 15 22:21:03 2004
@@ -105,10 +105,10 @@
 	| decode addressing mode
 	fp_decode_addr_mode
 
-	.long 	fp_data, fp_fdbcc
-	.long 	fp_indirect, fp_postinc
-	.long 	fp_predecr, fp_disp16
-	.long 	fp_extmode0, fp_extmode1
+	.long	fp_data, fp_fdbcc
+	.long	fp_indirect, fp_postinc
+	.long	fp_predecr, fp_disp16
+	.long	fp_extmode0, fp_extmode1
 
 	| addressing mode: data register direct
 fp_data:
diff -Nru a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
--- a/arch/m68k/math-emu/fp_log.c	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/math-emu/fp_log.c	Tue Jun 15 22:21:05 2004
@@ -48,7 +48,7 @@
 
 	/*
 	 *		 sqrt(m) * 2^(p)	, if e = 2*p
-	 * sqrt(m*2^e) = 
+	 * sqrt(m*2^e) =
 	 *		 sqrt(2*m) * 2^(p)	, if e = 2*p + 1
 	 *
 	 * So we use the last bit of the exponent to decide wether to
@@ -80,7 +80,7 @@
 	 * which has a null point on x = sqrt(r).
 	 *
 	 * It gives:
-	 * 	x' := x - f(x)/f'(x)
+	 *	x' := x - f(x)/f'(x)
 	 *	    = x - (x^2 -r)/(2*x)
 	 *	    = x - (x - r/x)/2
 	 *          = (2*x - x + r/x)/2
diff -Nru a/arch/m68k/math-emu/fp_scan.S b/arch/m68k/math-emu/fp_scan.S
--- a/arch/m68k/math-emu/fp_scan.S	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/math-emu/fp_scan.S	Tue Jun 15 22:20:41 2004
@@ -133,10 +133,10 @@
 	| decode addressing mode for source
 	fp_decode_addr_mode
 
-	.long 	fp_data, fp_ill
-	.long 	fp_indirect, fp_postinc
-	.long 	fp_predecr, fp_disp16
-	.long 	fp_extmode0, fp_extmode1
+	.long	fp_data, fp_ill
+	.long	fp_indirect, fp_postinc
+	.long	fp_predecr, fp_disp16
+	.long	fp_extmode0, fp_extmode1
 
 	| addressing mode: data register direct
 fp_data:
diff -Nru a/arch/m68k/math-emu/fp_util.S b/arch/m68k/math-emu/fp_util.S
--- a/arch/m68k/math-emu/fp_util.S	Tue Jun 15 22:21:04 2004
+++ b/arch/m68k/math-emu/fp_util.S	Tue Jun 15 22:21:04 2004
@@ -1337,7 +1337,7 @@
 	jra	fp_finaltest
 
 fp_finalrounding_single_fast:
-	addq.l	#8,%sp 
+	addq.l	#8,%sp
 	jsr	fp_normalize_ext
 	jsr	fp_normalize_single_fast
 	jra	fp_finaltest
diff -Nru a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
--- a/arch/m68k/mm/fault.c	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/mm/fault.c	Tue Jun 15 22:20:40 2004
@@ -157,7 +157,7 @@
  survive:
 	fault = handle_mm_fault(mm, vma, address, write);
 #ifdef DEBUG
- 	printk("handle_mm_fault returns %d\n",fault);
+	printk("handle_mm_fault returns %d\n",fault);
 #endif
 	switch (fault) {
 	case 1:
@@ -186,7 +186,7 @@
 		down_read(&mm->mmap_sem);
 		goto survive;
 	}
-	
+
 	printk("VM: killing process %s\n", current->comm);
 	if (user_mode(regs))
 		do_exit(SIGKILL);
diff -Nru a/arch/m68k/mm/hwtest.c b/arch/m68k/mm/hwtest.c
--- a/arch/m68k/mm/hwtest.c	Tue Jun 15 22:21:03 2004
+++ b/arch/m68k/mm/hwtest.c	Tue Jun 15 22:21:03 2004
@@ -3,9 +3,9 @@
  * that it was also in drivers/nubus/nubus.c and I wanted to
  * use it in hp300/config.c, so it seemed sensible to pull it
  * out into its own file.
- * 
+ *
  * The test is for use when trying to read a hardware register
- * that isn't present would cause a bus error. We set up a 
+ * that isn't present would cause a bus error. We set up a
  * temporary handler so that this doesn't kill the kernel.
  *
  * There is a test-by-reading and a test-by-writing; I present
@@ -37,7 +37,7 @@
                 "movec	%4,%/vbr\n\t"
 		"movel	%/sp,%1\n\t"
 		"moveq	#0,%0\n\t"
-		"tstb	%3@\n\t"  
+		"tstb	%3@\n\t"
 		"nop\n\t"
 		"moveq	#1,%0\n"
                 "Lberr1:\n\t"
@@ -50,7 +50,7 @@
     return( ret );
 }
 EXPORT_SYMBOL(hwreg_present);
-  
+
 /* Basically the same, but writes a value into a word register, protected
  * by a bus error handler. Returns 1 if successful, 0 otherwise.
  */
@@ -67,7 +67,7 @@
 		"movec	%4,%/vbr\n\t"
 		"movel	%/sp,%1\n\t"
 		"moveq	#0,%0\n\t"
-		"movew	%5,%3@\n\t"  
+		"movew	%5,%3@\n\t"
 		"nop	\n\t"	/* If this nop isn't present, 'ret' may already be
 				 * loaded with 1 at the time the bus error
 				 * happens! */
diff -Nru a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
--- a/arch/m68k/mm/init.c	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/mm/init.c	Tue Jun 15 22:20:44 2004
@@ -109,7 +109,7 @@
 			continue;
 		}
 	}
-	
+
 #ifndef CONFIG_SUN3
 	/* insert pointer tables allocated so far into the tablelist */
 	init_pointer_table((unsigned long)kernel_pg_dir);
diff -Nru a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
--- a/arch/m68k/mm/memory.c	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/mm/memory.c	Tue Jun 15 22:20:42 2004
@@ -298,7 +298,7 @@
 		      : "d0");
 #ifdef CONFIG_M68K_L2_CACHE
     if(mach_l2_flush)
-    	mach_l2_flush(0);
+	mach_l2_flush(0);
 #endif
 }
 
@@ -350,7 +350,7 @@
 		      : "d0");
 #ifdef CONFIG_M68K_L2_CACHE
     if(mach_l2_flush)
-    	mach_l2_flush(1);
+	mach_l2_flush(1);
 #endif
 }
 
@@ -387,7 +387,7 @@
 		unsigned long mmusr;
 
 		set_fs(get_ds());
-		
+
 		asm volatile (".chip 68040\n\t"
 			      "ptestr (%1)\n\t"
 			      "movec %%mmusr, %0\n\t"
diff -Nru a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
--- a/arch/m68k/mm/motorola.c	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/mm/motorola.c	Tue Jun 15 22:20:41 2004
@@ -2,9 +2,9 @@
  * linux/arch/m68k/motorola.c
  *
  * Routines specific to the Motorola MMU, originally from:
- * linux/arch/m68k/init.c 
+ * linux/arch/m68k/init.c
  * which are Copyright (C) 1995 Hamish Macdonald
- * 
+ *
  * Moved 8/20/1999 Sam Creasey
  */
 
@@ -99,7 +99,7 @@
 	return last_pgtable;
 }
 
-static unsigned long __init 
+static unsigned long __init
 map_chunk (unsigned long addr, long size)
 {
 #define PTRTREESIZE (256*1024)
diff -Nru a/arch/m68k/mm/sun3kmap.c b/arch/m68k/mm/sun3kmap.c
--- a/arch/m68k/mm/sun3kmap.c	Tue Jun 15 22:21:04 2004
+++ b/arch/m68k/mm/sun3kmap.c	Tue Jun 15 22:21:04 2004
@@ -26,7 +26,7 @@
 
 extern void mmu_emu_map_pmeg (int context, int vaddr);
 
-static inline void do_page_mapin(unsigned long phys, unsigned long virt, 
+static inline void do_page_mapin(unsigned long phys, unsigned long virt,
 				 unsigned long type)
 {
 	unsigned long pte;
@@ -44,11 +44,11 @@
 
 }
 
-static inline void do_pmeg_mapin(unsigned long phys, unsigned long virt, 
+static inline void do_pmeg_mapin(unsigned long phys, unsigned long virt,
 				 unsigned long type, int pages)
 {
 
-	if(sun3_get_segmap(virt & ~SUN3_PMEG_MASK) == SUN3_INVALID_PMEG) 
+	if(sun3_get_segmap(virt & ~SUN3_PMEG_MASK) == SUN3_INVALID_PMEG)
 		mmu_emu_map_pmeg(sun3_get_context(), virt);
 
 	while(pages) {
@@ -59,7 +59,7 @@
 	}
 }
 
-void *sun3_ioremap(unsigned long phys, unsigned long size, 
+void *sun3_ioremap(unsigned long phys, unsigned long size,
 		   unsigned long type)
 {
 	struct vm_struct *area;
@@ -79,7 +79,7 @@
 		return NULL;
 
 #ifdef SUN3_KMAP_DEBUG
-	printk("ioremap: got virt %p size %lx(%lx)\n", 
+	printk("ioremap: got virt %p size %lx(%lx)\n",
 	       area->addr, size, area->size);
 #endif
 
@@ -93,39 +93,39 @@
 		seg_pages = (SUN3_PMEG_SIZE - (virt & SUN3_PMEG_MASK)) / PAGE_SIZE;
 		if(seg_pages > pages)
 			seg_pages = pages;
-		
+
 		do_pmeg_mapin(phys, virt, type, seg_pages);
 
 		pages -= seg_pages;
 		phys += seg_pages * PAGE_SIZE;
 		virt += seg_pages * PAGE_SIZE;
 	}
-		
+
 	return (void *)ret;
 
 }
- 
- 
+
+
 void *__ioremap(unsigned long phys, unsigned long size, int cache)
 {
-	
+
 	return sun3_ioremap(phys, size, SUN3_PAGE_TYPE_IO);
-	
+
 }
 
 void iounmap(void *addr)
 {
-	vfree((void *)(PAGE_MASK & (unsigned long)addr));	
+	vfree((void *)(PAGE_MASK & (unsigned long)addr));
 }
 
 /* sun3_map_test(addr, val) -- Reads a byte from addr, storing to val,
  * trapping the potential read fault.  Returns 0 if the access faulted,
  * 1 on success.
- *  
+ *
  * This function is primarily used to check addresses on the VME bus.
  *
  * Mucking with the page fault handler seems a little hackish to me, but
- * SunOS, NetBSD, and Mach all implemented this check in such a manner, 
+ * SunOS, NetBSD, and Mach all implemented this check in such a manner,
  * so I figure we're allowed.
  */
 int sun3_map_test(unsigned long addr, char *val)
@@ -151,6 +151,6 @@
 		 "_sun3_map_test_end:\n"
 		 : "=a"(val), "=r"(ret)
 		 : "a"(addr));
-	
+
 	return ret;
 }
diff -Nru a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
--- a/arch/m68k/mm/sun3mmu.c	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/mm/sun3mmu.c	Tue Jun 15 22:20:38 2004
@@ -1,4 +1,4 @@
-/* 
+/*
  * linux/arch/m68k/mm/sun3mmu.c
  *
  * Implementations of mm routines specific to the sun3 MMU.
@@ -64,12 +64,12 @@
 
 	size = num_pages * sizeof(pte_t);
 	size = (size + PAGE_SIZE) & ~(PAGE_SIZE-1);
-	
+
 	next_pgtable = (unsigned long)alloc_bootmem_pages(size);
 	bootmem_end = (next_pgtable + size + PAGE_SIZE) & PAGE_MASK;
 
 	/* Map whole memory from PAGE_OFFSET (0x0E000000) */
-	pg_dir += PAGE_OFFSET >> PGDIR_SHIFT; 
+	pg_dir += PAGE_OFFSET >> PGDIR_SHIFT;
 
 	while (address < (unsigned long)high_memory) {
 		pg_table = (pte_t *) __pa (next_pgtable);
@@ -95,7 +95,7 @@
 	/* memory sizing is a hack stolen from motorola.c..  hope it works for us */
 	zones_size[0] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
 	zones_size[1] = 0;
-	
+
 	free_area_init(zones_size);
 
 }
diff -Nru a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
--- a/arch/m68k/mvme147/config.c	Tue Jun 15 22:20:38 2004
+++ b/arch/m68k/mvme147/config.c	Tue Jun 15 22:20:38 2004
@@ -120,8 +120,8 @@
 
 static irqreturn_t mvme147_timer_int (int irq, void *dev_id, struct pt_regs *fp)
 {
-	m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR;  
-	m147_pcc->t1_int_cntrl = PCC_INT_ENAB|PCC_LEVEL_TIMER1;   
+	m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR;
+	m147_pcc->t1_int_cntrl = PCC_INT_ENAB|PCC_LEVEL_TIMER1;
 	return tick_handler(irq, dev_id, fp);
 }
 
@@ -129,16 +129,16 @@
 void mvme147_sched_init (irqreturn_t (*timer_routine)(int, void *, struct pt_regs *))
 {
 	tick_handler = timer_routine;
-	request_irq (PCC_IRQ_TIMER1, mvme147_timer_int, 
+	request_irq (PCC_IRQ_TIMER1, mvme147_timer_int,
 		IRQ_FLG_REPLACE, "timer 1", NULL);
-	
+
 	/* Init the clock with a value */
 	/* our clock goes off every 6.25us */
 	m147_pcc->t1_preload = PCC_TIMER_PRELOAD;
-	m147_pcc->t1_cntrl = 0x0;   	/* clear timer */
-	m147_pcc->t1_cntrl = 0x3; 	/* start timer */
+	m147_pcc->t1_cntrl = 0x0;	/* clear timer */
+	m147_pcc->t1_cntrl = 0x3;	/* start timer */
 	m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR;  /* clear pending ints */
-	m147_pcc->t1_int_cntrl = PCC_INT_ENAB|PCC_LEVEL_TIMER1;   
+	m147_pcc->t1_int_cntrl = PCC_INT_ENAB|PCC_LEVEL_TIMER1;
 }
 
 /* This is always executed with interrupts disabled.  */
diff -Nru a/arch/m68k/mvme16x/mvme16x_ksyms.c b/arch/m68k/mvme16x/mvme16x_ksyms.c
--- a/arch/m68k/mvme16x/mvme16x_ksyms.c	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/mvme16x/mvme16x_ksyms.c	Tue Jun 15 22:20:41 2004
@@ -2,5 +2,5 @@
 #include <linux/types.h>
 #include <asm/ptrace.h>
 #include <asm/mvme16xhw.h>
- 
+
 EXPORT_SYMBOL(mvme16x_config);
diff -Nru a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
--- a/arch/m68k/mvme16x/rtc.c	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/mvme16x/rtc.c	Tue Jun 15 22:21:05 2004
@@ -43,7 +43,7 @@
 {
 	volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE;
 	unsigned long flags;
-	struct rtc_time wtime; 
+	struct rtc_time wtime;
 
 	switch (cmd) {
 	case RTC_RD_TIME:	/* Read the time/date from RTC	*/
@@ -101,7 +101,7 @@
 
 		if (yrs >= 2070)
 			return -EINVAL;
-		
+
 		local_irq_save(flags);
 		rtc->ctrl     = RTC_WRITE;
 
diff -Nru a/arch/m68k/q40/Makefile b/arch/m68k/q40/Makefile
--- a/arch/m68k/q40/Makefile	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/q40/Makefile	Tue Jun 15 22:20:41 2004
@@ -2,4 +2,4 @@
 # Makefile for Linux arch/m68k/q40 source directory
 #
 
-obj-y		:= config.o q40ints.o 
+obj-y		:= config.o q40ints.o
diff -Nru a/arch/m68k/q40/README b/arch/m68k/q40/README
--- a/arch/m68k/q40/README	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/q40/README	Tue Jun 15 22:20:36 2004
@@ -9,18 +9,18 @@
 Hints to documentation usually refer to the linux source tree in
 /usr/src/linux/Documentation unless URL given.
 
-It seems IRQ unmasking can't be safely done on a Q40. IRQ probing 
+It seems IRQ unmasking can't be safely done on a Q40. IRQ probing
 is not implemented - do not try it! (See below)
 
 For a list of kernel command-line options read the documentation for the
 particular device drivers.
 
 The floppy imposes a very high interrupt load on the CPU, approx 30K/s.
-When something blocks interrupts (HD) it will lose some of them, so far 
+When something blocks interrupts (HD) it will lose some of them, so far
 this is not known to have caused any data loss. On highly loaded systems
-it can make the floppy very slow or practically stop. Other Q40 OS' simply 
+it can make the floppy very slow or practically stop. Other Q40 OS' simply
 poll the floppy for this reason - something that can't be done in Linux.
-Only possible cure is getting a 82072 controller with fifo instead of 
+Only possible cure is getting a 82072 controller with fifo instead of
 the 8272A.
 
 drivers used by the Q40, apart from the very obvious (console etc.):
@@ -28,7 +28,7 @@
 		     serial.c		# normal PC driver - any speed
 	             lp.c		# printer driver
 		     genrtc.c		# RTC
-		char/joystick/*		# most of this should work, not 
+		char/joystick/*		# most of this should work, not
 				        # in default config.in
 	        block/q40ide.c		# startup for ide
 		      ide*		# see Documentation/ide.txt
@@ -41,30 +41,30 @@
 		sound/dmasound_core.c
 		      dmasound_q40.c
 
-Various other PC drivers can be enabled simply by adding them to 
+Various other PC drivers can be enabled simply by adding them to
 arch/m68k/config.in, especially 8 bit devices should be without any
-problems. For cards using 16bit io/mem more care is required, like 
+problems. For cards using 16bit io/mem more care is required, like
 checking byte order issues, hacking memcpy_*_io etc.
 
 
 Debugging
 =========
 
-Upon startup the kernel will usually output "ABCQGHIJ" into the SRAM, 
-preceded by the booter signature. This is a trace just in case something 
-went wrong during earliest setup stages of head.S. 
-**Changed** to preserve SRAM contents by default, this is only done when 
-requested - SRAM must start with '%LX$' signature to do this. '-d' option 
+Upon startup the kernel will usually output "ABCQGHIJ" into the SRAM,
+preceded by the booter signature. This is a trace just in case something
+went wrong during earliest setup stages of head.S.
+**Changed** to preserve SRAM contents by default, this is only done when
+requested - SRAM must start with '%LX$' signature to do this. '-d' option
 to 'lxx' loader enables this.
 
 SRAM can also be used as additional console device, use debug=mem.
-This will save kernel startup msgs into SRAM, the screen will display 
+This will save kernel startup msgs into SRAM, the screen will display
 only the penguin - and shell prompt if it gets that far..
 Unfortunately only 2000 bytes are available.
 
 Serial console works and can also be used for debugging, see loader_txt
 
-Most problems seem to be caused by fawlty or badly configured io-cards or 
+Most problems seem to be caused by fawlty or badly configured io-cards or
 hard drives anyway.
 Make sure to configure the parallel port as SPP and remove IRQ/DMA jumpers
 for first testing. The Q40 does not support DMA and may have trouble with
@@ -74,7 +74,7 @@
 Q40 Hardware Description
 ========================
 
-This is just an overview, see asm-m68k/* for details ask if you have any 
+This is just an overview, see asm-m68k/* for details ask if you have any
 questions.
 
 The Q40 consists of a 68040@40 MHz, 1MB video RAM, up to 32MB RAM, AT-style
@@ -82,16 +82,16 @@
 shadow ROM.
 The Q60 has any of 68060 or 68LC060 and up to 128 MB RAM.
 
-Most interfacing like floppy, IDE, serial and parallel ports is done via ISA 
-slots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate 
+Most interfacing like floppy, IDE, serial and parallel ports is done via ISA
+slots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate
 regions of the memory.
-The main interrupt register IIRQ_REG will indicate whether an IRQ was internal 
+The main interrupt register IIRQ_REG will indicate whether an IRQ was internal
 or from some ISA devices, EIRQ_REG can distinguish up to 8 ISA IRQs.
 
 The Q40 custom chip is programmable to provide 2 periodic timers:
 	- 50 or 200 Hz - level 2, !!THIS CANT BE DISABLED!!
-	- 10 or 20 KHz - level 4, used for dma-sound 
-  
+	- 10 or 20 KHz - level 4, used for dma-sound
+
 Linux uses the 200 Hz interrupt for timer and beep by default.
 
 
@@ -112,7 +112,7 @@
 because only irq's 4-15 can be disabled - and only all of them at once.
 Thus disable_irq() can effectively block the machine if the driver goes
 asleep.
-One thing to keep in mind when hacking around the interrupt code is 
+One thing to keep in mind when hacking around the interrupt code is
 that there is no way to find out which IRQ caused a request, [EI]IRQ_REG
 displays current state of the various IRQ lines.
 
@@ -123,11 +123,11 @@
 the PC scancodes x86 Linux uses. So by theory every national keyboard should
 work just by loading the appropriate x86 keytable - see any national-HOWTO.
 
-Unfortunately the AT->PC translation isn't quite trivial and even worse, my 
-documentation of it is absolutely minimal - thus some exotic keys may not 
+Unfortunately the AT->PC translation isn't quite trivial and even worse, my
+documentation of it is absolutely minimal - thus some exotic keys may not
 behave exactly as expected.
 
-There is still hope that it can be fixed completely though. If you encounter 
+There is still hope that it can be fixed completely though. If you encounter
 problems, email me ideally this:
 	- exact keypress/release sequence
 	- 'showkey -s' run on q40, non-X session
diff -Nru a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
--- a/arch/m68k/q40/config.c	Tue Jun 15 22:20:40 2004
+++ b/arch/m68k/q40/config.c	Tue Jun 15 22:20:40 2004
@@ -159,7 +159,7 @@
 void q40_disable_irqs(void)
 {
   unsigned i,j;
-  
+
   j=0;
   while((i=serports[j++])) outb(0,i+UART_IER);
   master_outb(0,EXT_ENABLE_REG);
@@ -170,16 +170,16 @@
 {
     mach_sched_init      = q40_sched_init;
 
-    mach_init_IRQ        = q40_init_IRQ;   
-    mach_gettimeoffset   = q40_gettimeoffset; 
-    mach_hwclk           = q40_hwclk; 
+    mach_init_IRQ        = q40_init_IRQ;
+    mach_gettimeoffset   = q40_gettimeoffset;
+    mach_hwclk           = q40_hwclk;
     mach_get_ss          = q40_get_ss;
     mach_get_rtc_pll     = q40_get_rtc_pll;
     mach_set_rtc_pll     = q40_set_rtc_pll;
     mach_set_clock_mmss	 = q40_set_clock_mmss;
 
     mach_reset		 = q40_reset;
-    mach_free_irq	 = q40_free_irq; 
+    mach_free_irq	 = q40_free_irq;
     mach_process_int	 = q40_process_int;
     mach_get_irq_list	 = show_q40_interrupts;
     mach_request_irq	 = q40_request_irq;
@@ -204,9 +204,9 @@
     q40_disable_irqs();
 
     /* no DMA at all, but ide-scsi requires it.. make sure
-     * all physical RAM fits into the boundary - otherwise 
+     * all physical RAM fits into the boundary - otherwise
      * allocator may play costly and useless tricks */
-    mach_max_dma_address = 1024*1024*1024;   
+    mach_max_dma_address = 1024*1024*1024;
 
     /* useful for early debugging stages - writes kernel messages into SRAM */
     if (!strncmp( m68k_debug_device,"mem",3 ))
@@ -286,7 +286,7 @@
 	  t->tm_sec  = bcd2bin (Q40_RTC_SECS);
 
 	  Q40_RTC_CTRL &= ~(Q40_RTC_READ);
-	  
+
 	  if (t->tm_year < 70)
 	    t->tm_year += 100;
 	  t->tm_wday = bcd2bin(Q40_RTC_DOW)-1;
@@ -319,7 +319,7 @@
 	if ((rtc_minutes < real_minutes
 		? real_minutes - rtc_minutes
 			: rtc_minutes - real_minutes) < 30)
-	{	   
+	{
 	        Q40_RTC_CTRL |= Q40_RTC_WRITE;
 		Q40_RTC_MINS = bin2bcd(real_minutes);
 		Q40_RTC_SECS = bin2bcd(real_seconds);
diff -Nru a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
--- a/arch/m68k/q40/q40ints.c	Tue Jun 15 22:20:44 2004
+++ b/arch/m68k/q40/q40ints.c	Tue Jun 15 22:20:44 2004
@@ -30,14 +30,14 @@
 #include <asm/q40_master.h>
 #include <asm/q40ints.h>
 
-/* 
- * Q40 IRQs are defined as follows: 
+/*
+ * Q40 IRQs are defined as follows:
  *            3,4,5,6,7,10,11,14,15 : ISA dev IRQs
  *            16-31: reserved
  *            32   : keyboard int
  *            33   : frame int (50/200 Hz periodic timer)
  *            34   : sample int (10/20 KHz periodic timer)
- *          
+ *
 */
 
 extern int ints_inited;
@@ -122,7 +122,7 @@
 	  case 12: case 13:
 	    printk("%s: ISA IRQ %d from %s not implemented by HW\n", __FUNCTION__, irq, devname);
 	    return -ENXIO;
-	  case 11: 	      
+	  case 11:
 	    printk("warning IRQ 10 and 11 not distinguishable\n");
 	    irq=10;
 	  default:
@@ -131,7 +131,7 @@
 
 	if (irq<Q40_IRQ_SAMPLE)
 	  {
-	    if (irq_tab[irq].dev_id != NULL) 
+	    if (irq_tab[irq].dev_id != NULL)
 		  {
 		    printk("%s: IRQ %d from %s is not replaceable\n",
 			   __FUNCTION__, irq, irq_tab[irq].devname);
@@ -176,13 +176,13 @@
 	  default:
 	    ;
 	  }
-	
+
 	if (irq<Q40_IRQ_SAMPLE)
 	  {
 	    if (irq_tab[irq].dev_id != dev_id)
 	      printk("%s: Removing probably wrong IRQ %d from %s\n",
 		     __FUNCTION__, irq, irq_tab[irq].devname);
-	    
+
 	    irq_tab[irq].handler = q40_defhand;
 	    irq_tab[irq].flags   = 0;
 	    irq_tab[irq].dev_id  = NULL;
@@ -205,7 +205,7 @@
   return IRQ_HANDLED;
 }
 
-/* 
+/*
  * this stuff doesn't really belong here..
 */
 
@@ -267,10 +267,10 @@
 }
 
 
-/* 
- * tables to translate bits into IRQ numbers 
+/*
+ * tables to translate bits into IRQ numbers
  * it is a good idea to order the entries by priority
- * 
+ *
 */
 
 struct IRQ_TABLE{ unsigned mask; int irq ;};
@@ -319,7 +319,7 @@
   mir=master_inb(IIRQ_REG);
   if (mir&Q40_IRQ_FRAME_MASK) {
 	  irq_tab[Q40_IRQ_FRAME].count++;
-	  irq_tab[Q40_IRQ_FRAME].handler(Q40_IRQ_FRAME,irq_tab[Q40_IRQ_FRAME].dev_id,fp);   
+	  irq_tab[Q40_IRQ_FRAME].handler(Q40_IRQ_FRAME,irq_tab[Q40_IRQ_FRAME].dev_id,fp);
 	  master_outb(-1,FRAME_CLEAR_REG);
   }
   if ((mir&Q40_IRQ_SER_MASK) || (mir&Q40_IRQ_EXT_MASK)) {
@@ -356,15 +356,15 @@
 #endif
 				  goto iirq;
 			  }
-			  irq_tab[irq].count++; 
+			  irq_tab[irq].count++;
 			  irq_tab[irq].state |= IRQ_INPROGRESS;
 			  irq_tab[irq].handler(irq,irq_tab[irq].dev_id,fp);
 			  irq_tab[irq].state &= ~IRQ_INPROGRESS;
-			  
+
 			  /* naively enable everything, if that fails than    */
 			  /* this function will be reentered immediately thus */
 			  /* getting another chance to disable the IRQ        */
-			  
+
 			  if ( disabled ) {
 #ifdef IP_USE_DISABLE
 				  if (irq>4){
@@ -379,9 +379,9 @@
 			  return IRQ_HANDLED;
 		  }
 	  }
-	  if (mer && ccleirq>0 && !aliased_irq) 
+	  if (mer && ccleirq>0 && !aliased_irq)
 		  printk("ISA interrupt from unknown source? EIRQ_REG = %x\n",mer),ccleirq--;
-  } 
+  }
  iirq:
   mir=master_inb(IIRQ_REG);
   /* should test whether keyboard irq is really enabled, doing it in defhand */
@@ -399,10 +399,10 @@
 	for (i = 0; i <= Q40_IRQ_MAX; i++) {
 		if (irq_tab[i].count)
 		      seq_printf(p, "%sIRQ %02d: %8d  %s%s\n",
-			      (i<=15) ? "ISA-" : "    " ,		
+			      (i<=15) ? "ISA-" : "    " ,
 			    i, irq_tab[i].count,
 			    irq_tab[i].devname[0] ? irq_tab[i].devname : "?",
-			    irq_tab[i].handler == q40_defhand ? 
+			    irq_tab[i].handler == q40_defhand ?
 					" (now unassigned)" : "");
 	}
 	return 0;
@@ -440,7 +440,7 @@
   {
     mext_disabled--;
     if (mext_disabled>0)
-	  printk("q40_enable_irq : nested disable/enable\n"); 
+	  printk("q40_enable_irq : nested disable/enable\n");
     if (mext_disabled==0)
     master_outb(1,EXT_ENABLE_REG);
     }
diff -Nru a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
--- a/arch/m68k/sun3/config.c	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/sun3/config.c	Tue Jun 15 22:20:42 2004
@@ -42,19 +42,19 @@
 extern void idprom_init (void);
 extern int sun3_hwclk(int set, struct rtc_time *t);
 
-volatile char* clock_va; 
+volatile char* clock_va;
 extern volatile unsigned char* sun3_intreg;
 extern unsigned long availmem;
 unsigned long num_pages;
 
 static int sun3_get_hardware_list(char *buffer)
 {
-	
+
 	int len = 0;
 
 	len += sprintf(buffer + len, "PROM Revision:\t%s\n",
 		       romvec->pv_monid);
-	
+
 	return len;
 
 }
@@ -71,14 +71,14 @@
 	clock_va    =          (char *) 0xfe06000;	/* dark  */
 	sun3_intreg = (unsigned char *) 0xfe0a000;	/* magic */
 	sun3_disable_interrupts();
-	
+
 	prom_init((void *)LINUX_OPPROM_BEGVM);
-		
+
 	GET_CONTROL_BYTE(AC_SENABLE,enable_register);
-	enable_register |= 0x50; /* Enable FPU */	
+	enable_register |= 0x50; /* Enable FPU */
 	SET_CONTROL_BYTE(AC_SENABLE,enable_register);
 	GET_CONTROL_BYTE(AC_SENABLE,enable_register);
-	
+
 	/* This code looks suspicious, because it doesn't subtract
            memory belonging to the kernel from the available space */
 
@@ -122,7 +122,7 @@
 	/* align start/end to page boundaries */
 	memory_start = ((memory_start + (PAGE_SIZE-1)) & PAGE_MASK);
 	memory_end = memory_end & PAGE_MASK;
-		
+
 	start_page = __pa(memory_start) >> PAGE_SHIFT;
 	num_pages = __pa(memory_end) >> PAGE_SHIFT;
 
@@ -134,7 +134,7 @@
 
 	free_bootmem(__pa(availmem), memory_end - (availmem));
 }
-	
+
 
 void __init config_sun3(void)
 {
@@ -145,13 +145,13 @@
 
 	/* Subtract kernel memory from available memory */
 
-        mach_sched_init      =  sun3_sched_init; 
+        mach_sched_init      =  sun3_sched_init;
         mach_init_IRQ        =  sun3_init_IRQ;
         mach_default_handler = &sun3_default_handler;
         mach_request_irq     =  sun3_request_irq;
         mach_free_irq        =  sun3_free_irq;
-	enable_irq     	     =  sun3_enable_irq;
-        disable_irq  	     =  sun3_disable_irq;
+	enable_irq	     =  sun3_enable_irq;
+        disable_irq	     =  sun3_disable_irq;
 	mach_process_int     =  sun3_process_int;
         mach_get_irq_list    =  show_sun3_interrupts;
         mach_reset           =  sun3_reboot;
@@ -161,7 +161,7 @@
 	mach_halt	     =  sun3_halt;
 	mach_get_hardware_list = sun3_get_hardware_list;
 #if defined(CONFIG_DUMMY_CONSOLE)
-	conswitchp 	     = &dummy_con;
+	conswitchp	     = &dummy_con;
 #endif
 
 	memory_start = ((((int)&_end) + 0x2000) & ~0x1fff);
@@ -170,7 +170,7 @@
 
 	m68k_num_memory=1;
         m68k_memory[0].size=*(romvec->pv_sun3mem);
-	
+
 	sun3_bootmem_alloc(memory_start, memory_end);
 }
 
@@ -179,7 +179,7 @@
 	sun3_disable_interrupts();
         intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE);
         intersil_clock->int_reg=INTERSIL_HZ_100_MASK;
- 	intersil_clear();
+	intersil_clear();
         sun3_enable_irq(5);
         intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_ENABLE|INTERSIL_24H_MODE);
         sun3_enable_interrupts();
diff -Nru a/arch/m68k/sun3/dvma.c b/arch/m68k/sun3/dvma.c
--- a/arch/m68k/sun3/dvma.c	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/sun3/dvma.c	Tue Jun 15 22:20:39 2004
@@ -24,13 +24,13 @@
 	unsigned long pte;
 	unsigned long j;
 	pte_t ptep;
-	
+
 	j = *(volatile unsigned long *)kaddr;
 	*(volatile unsigned long *)kaddr = j;
 
 	ptep = pfn_pte(virt_to_pfn(kaddr), PAGE_KERNEL);
 	pte = pte_val(ptep);
-//		printk("dvma_remap: addr %lx -> %lx pte %08lx len %x\n", 
+//		printk("dvma_remap: addr %lx -> %lx pte %08lx len %x\n",
 //		       kaddr, vaddr, pte, len);
 	if(ptelist[(vaddr & 0xff000) >> PAGE_SHIFT] != pte) {
 		sun3_put_pte(vaddr, pte);
@@ -41,7 +41,7 @@
 
 }
 
-int dvma_map_iommu(unsigned long kaddr, unsigned long baddr, 
+int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
 			      int len)
 {
 
@@ -51,7 +51,7 @@
 	vaddr = dvma_btov(baddr);
 
 	end = vaddr + len;
-	
+
 	while(vaddr < end) {
 		dvma_page(kaddr, vaddr);
 		kaddr += PAGE_SIZE;
diff -Nru a/arch/m68k/sun3/idprom.c b/arch/m68k/sun3/idprom.c
--- a/arch/m68k/sun3/idprom.c	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/sun3/idprom.c	Tue Jun 15 22:20:39 2004
@@ -67,7 +67,7 @@
 				prom_getproperty(prom_root_node, "banner-name",
 						 sysname, sizeof(sysname));
 				printk("TYPE: %s\n", sysname);
-#endif				
+#endif
 			}
 			return;
 		}
@@ -83,7 +83,7 @@
 
 	for (i = 0; i < NUM_SUN_MACHINES; i++) {
 		if(Sun_Machines[i].id_machtype == idprom->id_machtype) {
-       		        strcpy(model, Sun_Machines[i].name);
+		        strcpy(model, Sun_Machines[i].name);
 			return;
 		}
 	}
diff -Nru a/arch/m68k/sun3/intersil.c b/arch/m68k/sun3/intersil.c
--- a/arch/m68k/sun3/intersil.c	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/sun3/intersil.c	Tue Jun 15 22:20:36 2004
@@ -26,7 +26,7 @@
 
 /* does this need to be implemented? */
 unsigned long sun3_gettimeoffset(void)
-{ 
+{
   return 1;
 }
 
diff -Nru a/arch/m68k/sun3/leds.c b/arch/m68k/sun3/leds.c
--- a/arch/m68k/sun3/leds.c	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/sun3/leds.c	Tue Jun 15 22:20:36 2004
@@ -5,9 +5,9 @@
 void sun3_leds(unsigned char byte)
 {
 	unsigned char dfc;
-	
+
 	GET_DFC(dfc);
         SET_DFC(FC_CONTROL);
-       	SET_CONTROL_BYTE(AC_LEDS,byte);
+	SET_CONTROL_BYTE(AC_LEDS,byte);
 	SET_DFC(dfc);
 }
diff -Nru a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
--- a/arch/m68k/sun3/mmu_emu.c	Tue Jun 15 22:20:42 2004
+++ b/arch/m68k/sun3/mmu_emu.c	Tue Jun 15 22:20:42 2004
@@ -125,12 +125,12 @@
 {
 	unsigned long seg, num;
 	int i,j;
-	
+
 	memset(rom_pages, 0, sizeof(rom_pages));
 	memset(pmeg_vaddr, 0, sizeof(pmeg_vaddr));
 	memset(pmeg_alloc, 0, sizeof(pmeg_alloc));
 	memset(pmeg_ctx, 0, sizeof(pmeg_ctx));
-	
+
 	/* pmeg align the end of bootmem, adding another pmeg,
 	 * later bootmem allocations will likely need it */
 	bootmem_end = (bootmem_end + (2 * SUN3_PMEG_SIZE)) & ~SUN3_PMEG_MASK;
@@ -148,7 +148,7 @@
 	/* liberate all existing mappings in the rest of kernel space */
 	for(seg = bootmem_end; seg < 0x0f800000; seg += SUN3_PMEG_SIZE) {
 		i = sun3_get_segmap(seg);
-		
+
 		if(!pmeg_alloc[i]) {
 #ifdef DEBUG_MMU_EMU
 			printk("freed: ");
@@ -179,13 +179,13 @@
 			pmeg_alloc[sun3_get_segmap(seg)] = 2;
 		}
 	}
-	
+
 	dvma_init();
-	
-	
+
+
 	/* blank everything below the kernel, and we've got the base
 	   mapping to start all the contexts off with... */
-	for(seg = 0; seg < PAGE_OFFSET; seg += SUN3_PMEG_SIZE) 
+	for(seg = 0; seg < PAGE_OFFSET; seg += SUN3_PMEG_SIZE)
 		sun3_put_segmap(seg, SUN3_INVALID_PMEG);
 
 	set_fs(MAKE_MM_SEG(3));
@@ -195,7 +195,7 @@
 			(*(romvec->pv_setctxt))(j, (void *)seg, i);
 	}
 	set_fs(KERNEL_DS);
-	
+
 }
 
 /* erase the mappings for a dead context.  Uses the pg_dir for hints
@@ -207,9 +207,9 @@
 {
      unsigned char oldctx;
      unsigned long i;
-    
+
      if(context) {
-	     if(!ctx_alloc[context]) 
+	     if(!ctx_alloc[context])
 		     panic("clear_context: context not allocated\n");
 
 	     ctx_alloc[context]->context = SUN3_INVALID_CONTEXT;
@@ -229,7 +229,7 @@
 		     pmeg_vaddr[i] = 0;
 	     }
      }
-     
+
      sun3_put_context(oldctx);
 }
 
@@ -239,7 +239,7 @@
    sure it could be much more intellegent...  but it gets the job done
    for now without much overhead in making it's decision. */
 /* todo: come up with optimized scheme for flushing contexts */
-unsigned long get_free_context(struct mm_struct *mm) 
+unsigned long get_free_context(struct mm_struct *mm)
 {
 	unsigned long new = 1;
 	static unsigned char next_to_die = 1;
@@ -259,7 +259,7 @@
 				break;
 		}
 		// check to make sure one was really free...
-		if(new == CONTEXTS_NUM) 
+		if(new == CONTEXTS_NUM)
 			panic("get_free_context: failed to find free context");
 	}
 
@@ -307,7 +307,7 @@
 	if(vaddr >= PAGE_OFFSET) {
 		/* map kernel pmegs into all contexts */
 		unsigned char i;
-		
+
 		for(i = 0; i < CONTEXTS_NUM; i++) {
 			sun3_put_context(i);
 			sun3_put_segmap (vaddr, curr_pmeg);
@@ -315,7 +315,7 @@
 		sun3_put_context(context);
 		pmeg_alloc[curr_pmeg] = 2;
 		pmeg_ctx[curr_pmeg] = 0;
-		
+
 	}
 	else {
 		pmeg_alloc[curr_pmeg] = 1;
@@ -326,7 +326,7 @@
 	pmeg_vaddr[curr_pmeg] = vaddr;
 
 	/* Set hardware mapping and clear the old PTE entries. */
-	for (i=0; i<SUN3_PMEG_SIZE; i+=SUN3_PTE_SIZE) 
+	for (i=0; i<SUN3_PMEG_SIZE; i+=SUN3_PTE_SIZE)
 		sun3_put_pte (vaddr + i, SUN3_PAGE_SYSTEM);
 
 	/* Consider a different one next time. */
@@ -361,7 +361,7 @@
 		context = 0;
 	} else {
 		context = current->mm->context;
-		if(kernel_fault) 
+		if(kernel_fault)
 			crp = swapper_pg_dir;
 		else
 			crp = current->mm->pgd;
@@ -390,11 +390,11 @@
 	pte = (pte_t *) __va ((unsigned long)(pte + offset));
 
 	/* Make sure this is a valid page */
-	if (!(pte_val (*pte) & SUN3_PAGE_VALID)) 
+	if (!(pte_val (*pte) & SUN3_PAGE_VALID))
 		return 0;
 
 	/* Make sure there's a pmeg allocated for the page */
-	if (sun3_get_segmap (vaddr&~SUN3_PMEG_MASK) == SUN3_INVALID_PMEG) 
+	if (sun3_get_segmap (vaddr&~SUN3_PMEG_MASK) == SUN3_INVALID_PMEG)
 		mmu_emu_map_pmeg (context, vaddr);
 
 	/* Write the pte value to hardware MMU */
@@ -409,7 +409,7 @@
 		if (pte_val (*pte) & SUN3_PAGE_WRITEABLE)
 			pte_val (*pte) |= (SUN3_PAGE_ACCESSED
 					   | SUN3_PAGE_MODIFIED);
-		else 
+		else
 			return 0;	/* Write-protect error. */
 	} else
 		pte_val (*pte) |= SUN3_PAGE_ACCESSED;
diff -Nru a/arch/m68k/sun3/prom/init.c b/arch/m68k/sun3/prom/init.c
--- a/arch/m68k/sun3/prom/init.c	Tue Jun 15 22:20:58 2004
+++ b/arch/m68k/sun3/prom/init.c	Tue Jun 15 22:20:58 2004
@@ -73,7 +73,7 @@
 	if((prom_root_node == 0) || (prom_root_node == -1))
 		prom_halt();
 
-	if((((unsigned long) prom_nodeops) == 0) || 
+	if((((unsigned long) prom_nodeops) == 0) ||
 	   (((unsigned long) prom_nodeops) == -1))
 		prom_halt();
 
diff -Nru a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c
--- a/arch/m68k/sun3/sun3dvma.c	Tue Jun 15 22:20:43 2004
+++ b/arch/m68k/sun3/sun3dvma.c	Tue Jun 15 22:20:43 2004
@@ -52,21 +52,21 @@
 static unsigned long long dvma_alloc_bytes;
 static unsigned long long dvma_free_bytes;
 
-static void print_use(void) 
+static void print_use(void)
 {
-	
+
 	int i;
 	int j = 0;
 
 	printk("dvma entry usage:\n");
-	
+
 	for(i = 0; i < IOMMU_TOTAL_ENTRIES; i++) {
 		if(!iommu_use[i])
 			continue;
-		
+
 		j++;
 
-		printk("dvma entry: %08lx len %08lx\n", 
+		printk("dvma entry: %08lx len %08lx\n",
 		       ( i << DVMA_PAGE_SHIFT) + DVMA_START,
 		       iommu_use[i]);
 	}
@@ -74,28 +74,28 @@
 	printk("%d entries in use total\n", j);
 
 	printk("allocation/free calls: %lu/%lu\n", dvma_allocs, dvma_frees);
-	printk("allocation/free bytes: %Lx/%Lx\n", dvma_alloc_bytes, 
+	printk("allocation/free bytes: %Lx/%Lx\n", dvma_alloc_bytes,
 	       dvma_free_bytes);
 }
 
 static void print_holes(struct list_head *holes)
 {
-	
+
 	struct list_head *cur;
 	struct hole *hole;
 
 	printk("listing dvma holes\n");
 	list_for_each(cur, holes) {
 		hole = list_entry(cur, struct hole, list);
-		
+
 		if((hole->start == 0) && (hole->end == 0) && (hole->size == 0))
 			continue;
-		
+
 		printk("hole: start %08lx end %08lx size %08lx\n", hole->start, hole->end, hole->size);
 	}
-	
+
 	printk("end of hole listing...\n");
-	
+
 }
 #endif /* DVMA_DEBUG */
 
@@ -106,7 +106,7 @@
 	struct hole *prev = NULL;
 	struct list_head *cur;
 	int ret = 0;
-	
+
 	list_for_each(cur, &hole_list) {
 		hole = list_entry(cur, struct hole, list);
 
@@ -114,7 +114,7 @@
 			prev = hole;
 			continue;
 		}
-		
+
 		if(hole->end == prev->start) {
 			hole->size += prev->size;
 			hole->end = prev->end;
@@ -122,12 +122,12 @@
 			list_add(&(prev->list), &hole_cache);
 			ret++;
 		}
-		
+
 	}
 
 	return ret;
 }
-	
+
 static inline struct hole *rmcache(void)
 {
 	struct hole *ret;
@@ -148,7 +148,7 @@
 
 static inline unsigned long get_baddr(int len, unsigned long align)
 {
-	
+
 	struct list_head *cur;
 	struct hole *hole;
 
@@ -166,11 +166,11 @@
 
 		hole = list_entry(cur, struct hole, list);
 
-		if(align > DVMA_PAGE_SIZE) 
+		if(align > DVMA_PAGE_SIZE)
 			newlen = len + ((hole->end - len) & (align-1));
 		else
 			newlen = len;
-		
+
 		if(hole->size > newlen) {
 			hole->end -= newlen;
 			hole->size -= newlen;
@@ -200,7 +200,7 @@
 
 static inline int free_baddr(unsigned long baddr)
 {
-	
+
 	unsigned long len;
 	struct hole *hole;
 	struct list_head *cur;
@@ -219,7 +219,7 @@
 
 	list_for_each(cur, &hole_list) {
 		hole = list_entry(cur, struct hole, list);
-		
+
 		if(hole->end == baddr) {
 			hole->end += len;
 			hole->size += len;
@@ -233,21 +233,21 @@
 	}
 
 	hole = rmcache();
-	
+
 	hole->start = baddr;
 	hole->end = baddr + len;
 	hole->size = len;
-	
+
 //	list_add_tail(&(hole->list), cur);
 	list_add(&(hole->list), cur);
-	
+
 	return 0;
-	
+
 }
 
 void dvma_init(void)
 {
-	
+
 	struct hole *hole;
 	int i;
 
@@ -255,14 +255,14 @@
 	INIT_LIST_HEAD(&hole_cache);
 
 	/* prepare the hole cache */
-	for(i = 0; i < 64; i++) 
+	for(i = 0; i < 64; i++)
 		list_add(&(initholes[i].list), &hole_cache);
-		
+
 	hole = rmcache();
 	hole->start = DVMA_START;
 	hole->end = DVMA_END;
 	hole->size = DVMA_SIZE;
-	
+
 	list_add(&(hole->list), &hole_list);
 
 	memset(iommu_use, 0, sizeof(iommu_use));
@@ -291,7 +291,7 @@
 	}
 
 #ifdef DEBUG
-	printk("dvma_map request %08lx bytes from %08lx\n", 
+	printk("dvma_map request %08lx bytes from %08lx\n",
 	       len, kaddr);
 #endif
 	off = kaddr & ~DVMA_PAGE_MASK;
@@ -309,7 +309,7 @@
 
 	if(!dvma_map_iommu(kaddr, baddr, len))
 		return (baddr + off);
-	
+
 	printk("dvma_map failed kaddr %lx baddr %lx len %x\n", kaddr, baddr, len);
 	BUG();
 	return 0;
@@ -318,14 +318,14 @@
 void dvma_unmap(void *baddr)
 {
 	unsigned long addr;
-	
+
 	addr = (unsigned long)baddr;
 	/* check if this is a vme mapping */
 	if(!(addr & 0x00f00000))
 		addr |= 0xf00000;
-	
+
 	free_baddr(addr);
-	
+
 	return;
 
 }
diff -Nru a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
--- a/arch/m68k/sun3/sun3ints.c	Tue Jun 15 22:21:05 2004
+++ b/arch/m68k/sun3/sun3ints.c	Tue Jun 15 22:21:05 2004
@@ -28,7 +28,7 @@
 void sun3_enable_interrupts(void)
 {
 	sun3_enable_irq(0);
-}	
+}
 
 int led_pattern[8] = {
        ~(0x80), ~(0x01),
@@ -67,7 +67,7 @@
 static irqreturn_t sun3_int7(int irq, void *dev_id, struct pt_regs *fp)
 {
 	sun3_do_irq(irq,fp);
-	if(!(kstat_cpu(0).irqs[SYS_IRQS + irq] % 2000)) 
+	if(!(kstat_cpu(0).irqs[SYS_IRQS + irq] % 2000))
 		sun3_leds(led_pattern[(kstat_cpu(0).irqs[SYS_IRQS+irq]%16000)
 			  /2000]);
 	return IRQ_HANDLED;
@@ -125,7 +125,7 @@
 
 	for(i = 0; i < (SUN3_INT_VECS-1); i++) {
 		if(sun3_vechandler[i] != NULL) {
-			seq_printf(p, "vec %3d: %10u %s\n", i+64, 
+			seq_printf(p, "vec %3d: %10u %s\n", i+64,
 				   vec_ints[i],
 				   (vec_names[i]) ? vec_names[i] :
 				   "sun3_vechandler");
@@ -166,12 +166,12 @@
 					dev_names[i], NULL);
 	}
 
-	for(i = 0; i < 192; i++) 
+	for(i = 0; i < 192; i++)
 		sun3_vechandler[i] = NULL;
-	
+
 	sun3_vechandler[191] = sun3_vec255;
 }
-                                
+
 int sun3_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
                       unsigned long flags, const char *devname, void *dev_id)
 {
@@ -181,11 +181,11 @@
 			printk("sun3_request_irq: request for irq %d -- already taken!\n", irq);
 			return 1;
 		}
-		
+
 		sun3_inthandler[irq] = handler;
 		dev_ids[irq] = dev_id;
 		dev_names[irq] = devname;
-		
+
 		/* setting devname would be nice */
 		cpu_request_irq(irq, sun3_default_handler[irq], 0, devname,
 				NULL);
@@ -205,7 +205,7 @@
 			vec_ids[vec] = dev_id;
 			vec_names[vec] = devname;
 			vec_ints[vec] = 0;
-			
+
 			return 0;
 		}
 	}
@@ -214,16 +214,16 @@
 	return 1;
 
 }
-                        
+
 void sun3_free_irq(unsigned int irq, void *dev_id)
 {
 
 	if(irq < SYS_IRQS) {
-		if(sun3_inthandler[irq] == NULL) 
+		if(sun3_inthandler[irq] == NULL)
 			panic("sun3_free_int: attempt to free unused irq %d\n", irq);
 		if(dev_ids[irq] != dev_id)
 			panic("sun3_free_int: incorrect dev_id for irq %d\n", irq);
-		
+
 		sun3_inthandler[irq] = NULL;
 		return;
 	} else if((irq >= 64) && (irq <= 255)) {
@@ -234,12 +234,12 @@
 			panic("sun3_free_int: attempt to free unused vector %d\n", irq);
 		if(vec_ids[irq] != dev_id)
 			panic("sun3_free_int: incorrect dev_id for vec %d\n", irq);
-		
+
 		sun3_vechandler[vec] = NULL;
 		return;
 	} else {
 		panic("sun3_free_irq: invalid irq %d\n", irq);
-	}		
+	}
 }
 
 irqreturn_t sun3_process_int(int irq, struct pt_regs *regs)
@@ -249,7 +249,7 @@
 		int vec;
 
 		vec = irq - 64;
-		if(sun3_vechandler[vec] == NULL) 
+		if(sun3_vechandler[vec] == NULL)
 			panic ("bad interrupt vector %d received\n",irq);
 
 		vec_ints[vec]++;
diff -Nru a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c
--- a/arch/m68k/sun3x/config.c	Tue Jun 15 22:20:36 2004
+++ b/arch/m68k/sun3x/config.c	Tue Jun 15 22:20:36 2004
@@ -33,12 +33,12 @@
 
 static int sun3x_get_hardware_list(char *buffer)
 {
-	
+
 	int len = 0;
 
 	len += sprintf(buffer + len, "PROM Revision:\t%s\n",
 		       romvec->pv_monid);
-	
+
 	return len;
 
 }
@@ -62,7 +62,7 @@
 	mach_request_irq     = sun3_request_irq;
 	mach_free_irq        = sun3_free_irq;
 	mach_process_int     = sun3_process_int;
-    
+
 	mach_gettimeoffset   = sun3x_gettimeoffset;
 	mach_reset           = sun3x_reboot;
 
@@ -70,10 +70,14 @@
 	mach_get_model       = sun3_get_model;
 	mach_get_hardware_list = sun3x_get_hardware_list;
 
+#if defined(CONFIG_DUMMY_CONSOLE)
+	conswitchp	     = &dummy_con;
+#endif
+
 	sun3_intreg = (unsigned char *)SUN3X_INTREG;
 
 	/* only the serial console is known to work anyway... */
-#if 0    
+#if 0
 	switch (*(unsigned char *)SUN3X_EEPROM_CONS) {
 	case 0x10:
 		serial_console = 1;
diff -Nru a/arch/m68k/sun3x/dvma.c b/arch/m68k/sun3x/dvma.c
--- a/arch/m68k/sun3x/dvma.c	Tue Jun 15 22:20:37 2004
+++ b/arch/m68k/sun3x/dvma.c	Tue Jun 15 22:20:37 2004
@@ -1,11 +1,11 @@
 /*
  * Virtual DMA allocation
  *
- * (C) 1999 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 
+ * (C) 1999 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
  *
- * 11/26/2000 -- disabled the existing code because it didn't work for 
- * me in 2.4.  Replaced with a significantly more primitive version 
- * similar to the sun3 code.  the old functionality was probably more 
+ * 11/26/2000 -- disabled the existing code because it didn't work for
+ * me in 2.4.  Replaced with a significantly more primitive version
+ * similar to the sun3 code.  the old functionality was probably more
  * desirable, but....   -- Sam Creasey (sammy@oh.verio.com)
  *
  */
@@ -42,8 +42,8 @@
 static volatile unsigned long *iommu_pte = (unsigned long *)SUN3X_IOMMU;
 
 
-#define dvma_entry_paddr(index) 	(iommu_pte[index] & IOMMU_ADDR_MASK)
-#define dvma_entry_vaddr(index,paddr) 	((index << DVMA_PAGE_SHIFT) |  \
+#define dvma_entry_paddr(index)		(iommu_pte[index] & IOMMU_ADDR_MASK)
+#define dvma_entry_vaddr(index,paddr)	((index << DVMA_PAGE_SHIFT) |  \
 					 (paddr & (DVMA_PAGE_SIZE-1)))
 #if 0
 #define dvma_entry_set(index,addr)	(iommu_pte[index] =            \
@@ -80,7 +80,7 @@
 
 /* create a virtual mapping for a page assigned within the IOMMU
    so that the cpu can reach it easily */
-inline int dvma_map_cpu(unsigned long kaddr, 
+inline int dvma_map_cpu(unsigned long kaddr,
 			       unsigned long vaddr, int len)
 {
 	pgd_t *pgd;
@@ -97,7 +97,7 @@
 	       kaddr, vaddr);
 #endif
 	pgd = pgd_offset_k(vaddr);
-	
+
 	do {
 		pmd_t *pmd;
 		unsigned long end2;
@@ -107,7 +107,7 @@
 			goto out;
 		}
 
-		if((end & PGDIR_MASK) > (vaddr & PGDIR_MASK)) 
+		if((end & PGDIR_MASK) > (vaddr & PGDIR_MASK))
 			end2 = (vaddr + (PGDIR_SIZE-1)) & PGDIR_MASK;
 		else
 			end2 = end;
@@ -121,7 +121,7 @@
 				goto out;
 			}
 
-			if((end2 & PMD_MASK) > (vaddr & PMD_MASK)) 
+			if((end2 & PMD_MASK) > (vaddr & PMD_MASK))
 				end3 = (vaddr + (PMD_SIZE-1)) & PMD_MASK;
 			else
 				end3 = end2;
@@ -131,17 +131,17 @@
 				printk("mapping %08lx phys to %08lx\n",
 				       __pa(kaddr), vaddr);
 #endif
-				set_pte(pte, pfn_pte(virt_to_pfn(kaddr), 
+				set_pte(pte, pfn_pte(virt_to_pfn(kaddr),
 						     PAGE_KERNEL));
 				pte++;
 				kaddr += PAGE_SIZE;
 				vaddr += PAGE_SIZE;
 			} while(vaddr < end3);
-			
+
 		} while(vaddr < end2);
 
 	} while(vaddr < end);
-	
+
 	flush_tlb_all();
 
  out:
@@ -150,13 +150,13 @@
 
 
 inline int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
-				 int len) 
+				 int len)
 {
 	unsigned long end, index;
 
 	index = baddr >> DVMA_PAGE_SHIFT;
 	end = ((baddr+len) >> DVMA_PAGE_SHIFT);
-	
+
 	if(len & ~DVMA_PAGE_MASK)
 		end++;
 
@@ -169,12 +169,12 @@
 
 		iommu_pte[index] |= IOMMU_FULL_BLOCK;
 //		dvma_entry_inc(index);
-		
+
 		kaddr += DVMA_PAGE_SIZE;
 	}
 
-#ifdef DEBUG	
-	for(index = (baddr >> DVMA_PAGE_SHIFT); index < end; index++) 
+#ifdef DEBUG
+	for(index = (baddr >> DVMA_PAGE_SHIFT); index < end; index++)
 		dvma_print(index << DVMA_PAGE_SHIFT);
 #endif
 	return 0;
@@ -185,17 +185,17 @@
 {
 
 	int index, end;
-	
-	
+
+
 	index = baddr >> DVMA_PAGE_SHIFT;
 	end = (DVMA_PAGE_ALIGN(baddr+len) >> DVMA_PAGE_SHIFT);
-	
+
 	for(; index < end ; index++) {
 #ifdef DEBUG
 		printk("freeing bus mapping %08x\n", index << DVMA_PAGE_SHIFT);
 #endif
 #if 0
-		if(!dvma_entry_use(index)) 
+		if(!dvma_entry_use(index))
 			printk("dvma_unmap freeing unused entry %04x\n",
 			       index);
 		else
diff -Nru a/arch/m68k/sun3x/prom.c b/arch/m68k/sun3x/prom.c
--- a/arch/m68k/sun3x/prom.c	Tue Jun 15 22:20:39 2004
+++ b/arch/m68k/sun3x/prom.c	Tue Jun 15 22:20:39 2004
@@ -119,13 +119,13 @@
      * XXX this is futile since we restore the vbr first - oops
      */
     vectors[VEC_TRAP14] = sun3x_prom_abort;
-    
+
     /* If debug=prom was specified, start the debug console */
 
     if (!strcmp(m68k_debug_device, "prom"))
         register_console(&sun3x_debug);
 
-    
+
 }
 
 /* some prom functions to export */
@@ -159,7 +159,7 @@
         int i;
 
 	/* make a copy of the idprom structure */
-	for(i = 0; i < num_bytes; i++) 
+	for(i = 0; i < num_bytes; i++)
 		idbuf[i] = ((char *)SUN3X_IDPROM)[i];
 
         return idbuf[0];
diff -Nru a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c
--- a/arch/m68k/sun3x/time.c	Tue Jun 15 22:20:41 2004
+++ b/arch/m68k/sun3x/time.c	Tue Jun 15 22:20:41 2004
@@ -39,12 +39,12 @@
 
 int sun3x_hwclk(int set, struct rtc_time *t)
 {
-	volatile struct mostek_dt *h = 
+	volatile struct mostek_dt *h =
 		(struct mostek_dt *)(SUN3X_EEPROM+M_CONTROL);
 	unsigned long flags;
 
 	local_irq_save(flags);
-	
+
 	if(set) {
 		h->csr |= C_WRITE;
 		h->sec = BIN2BCD(t->tm_sec);
@@ -85,16 +85,16 @@
     /* Clear the pending interrupt - pulse the enable line low */
     disable_irq(5);
     enable_irq(5);
-    
+
     vector(irq, NULL, regs);
 }
 #endif
 
 void __init sun3x_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs *))
 {
-	
+
 	sun3_disable_interrupts();
-	
+
 
     /* Pulse enable low to get the clock started */
 	sun3_disable_irq(5);
diff -Nru a/arch/m68knommu/kernel/comempci.c b/arch/m68knommu/kernel/comempci.c
--- a/arch/m68knommu/kernel/comempci.c	Tue Jun 15 22:20:40 2004
+++ b/arch/m68knommu/kernel/comempci.c	Tue Jun 15 22:20:40 2004
@@ -419,7 +419,7 @@
 	volatile unsigned short	*sp;
 
 #ifdef DEBUGIO
-	printk(KERN_DEBUG "pci_outw(val=%04x,addr=%x)", val, addr);
+	printk(KERN_DEBUG "pci_outw(val=%04x,addr=%x)\n", val, addr);
 #endif
 
 	rp = (volatile unsigned long *) COMEM_BASE;
@@ -470,7 +470,7 @@
 	unsigned char		val;
 
 #ifdef DEBUGIO
-	printk(KERN_DEBUG "pci_inb(addr=%x)", addr);
+	printk(KERN_DEBUG "pci_inb(addr=%x)\n", addr);
 #endif
 
 	rp = (volatile unsigned long *) COMEM_BASE;
diff -Nru a/arch/m68knommu/kernel/m68k_ksyms.c b/arch/m68knommu/kernel/m68k_ksyms.c
--- a/arch/m68knommu/kernel/m68k_ksyms.c	Tue Jun 15 22:20:58 2004
+++ b/arch/m68knommu/kernel/m68k_ksyms.c	Tue Jun 15 22:20:58 2004
@@ -68,43 +68,25 @@
  * compiler...  (prototypes are not correct though, but that
  * doesn't really matter since they're not versioned).
  */
-extern void __gcc_bcmp(void);
 extern void __ashldi3(void);
 extern void __ashrdi3(void);
-extern void __cmpdi2(void);
-extern void __divdi3(void);
 extern void __divsi3(void);
 extern void __lshrdi3(void);
-extern void __moddi3(void);
 extern void __modsi3(void);
 extern void __muldi3(void);
 extern void __mulsi3(void);
-extern void __negdi2(void);
-extern void __ucmpdi2(void);
-extern void __udivdi3(void);
-extern void __udivmoddi4(void);
 extern void __udivsi3(void);
-extern void __umoddi3(void);
 extern void __umodsi3(void);
 
         /* gcc lib functions */
-EXPORT_SYMBOL_NOVERS(__gcc_bcmp);
 EXPORT_SYMBOL_NOVERS(__ashldi3);
 EXPORT_SYMBOL_NOVERS(__ashrdi3);
-EXPORT_SYMBOL_NOVERS(__cmpdi2);
-EXPORT_SYMBOL_NOVERS(__divdi3);
 EXPORT_SYMBOL_NOVERS(__divsi3);
 EXPORT_SYMBOL_NOVERS(__lshrdi3);
-EXPORT_SYMBOL_NOVERS(__moddi3);
 EXPORT_SYMBOL_NOVERS(__modsi3);
 EXPORT_SYMBOL_NOVERS(__muldi3);
 EXPORT_SYMBOL_NOVERS(__mulsi3);
-EXPORT_SYMBOL_NOVERS(__negdi2);
-EXPORT_SYMBOL_NOVERS(__ucmpdi2);
-EXPORT_SYMBOL_NOVERS(__udivdi3);
-EXPORT_SYMBOL_NOVERS(__udivmoddi4);
 EXPORT_SYMBOL_NOVERS(__udivsi3);
-EXPORT_SYMBOL_NOVERS(__umoddi3);
 EXPORT_SYMBOL_NOVERS(__umodsi3);
 
 EXPORT_SYMBOL_NOVERS(is_in_rom);
diff -Nru a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
--- a/arch/m68knommu/kernel/process.c	Tue Jun 15 22:20:37 2004
+++ b/arch/m68knommu/kernel/process.c	Tue Jun 15 22:20:37 2004
@@ -404,12 +404,6 @@
 	return error;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long fp, pc;
@@ -425,7 +419,7 @@
 		    fp >= 8184+stack_page)
 			return 0;
 		pc = ((unsigned long *)fp)[1];
-		if (pc < first_sched || pc >= last_sched)
+		if (!in_sched_functions(pc))
 			return pc;
 		fp = *(unsigned long *) fp;
 	} while (count++ < 16);
@@ -440,8 +434,7 @@
 	struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
 
 	/* Check whether the thread is blocked in resume() */
-	if (sw->retpc > (unsigned long)scheduling_functions_start_here &&
-	    sw->retpc < (unsigned long)scheduling_functions_end_here)
+	if (in_sched_functions(sw->retpc))
 		return ((unsigned long *)sw->a6)[1];
 	else
 		return sw->retpc;
diff -Nru a/arch/mips/Kconfig b/arch/mips/Kconfig
--- a/arch/mips/Kconfig	Tue Jun 15 22:20:40 2004
+++ b/arch/mips/Kconfig	Tue Jun 15 22:20:40 2004
@@ -39,6 +39,7 @@
 config ACER_PICA_61
 	bool "Support for Acer PICA 1 chipset (EXPERIMENTAL)"
 	depends on MACH_JAZZ && EXPERIMENTAL
+	select DMA_NONCOHERENT
 	help
 	  This is a machine with a R4400 133/150 MHz CPU. To compile a Linux
 	  kernel that runs on these, say Y here. For details about Linux on
@@ -48,6 +49,7 @@
 config MIPS_MAGNUM_4000
 	bool "Support for MIPS Magnum 4000"
 	depends on MACH_JAZZ
+	select DMA_NONCOHERENT
 	help
 	  This is a machine with a R4000 100 MHz CPU. To compile a Linux
 	  kernel that runs on these, say Y here. For details about Linux on
@@ -57,6 +59,7 @@
 config OLIVETTI_M700
 	bool "Support for Olivetti M700-10"
 	depends on MACH_JAZZ
+	select DMA_NONCOHERENT
 	help
 	  This is a machine with a R4000 100 MHz CPU. To compile a Linux
 	  kernel that runs on these, say Y here. For details about Linux on
@@ -77,23 +80,27 @@
 config CASIO_E55
 	bool "Support for CASIO CASSIOPEIA E-10/15/55/65"
 	depends on MACH_VR41XX
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	select ISA
 
 config IBM_WORKPAD
 	bool "Support for IBM WorkPad z50"
 	depends on MACH_VR41XX
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	select ISA
 
 config NEC_EAGLE
 	bool "Support for NEC Eagle/Hawk board"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	depends on MACH_VR41XX
 
 config TANBAC_TB0226
 	bool "Support for TANBAC TB0226 (Mbase)"
 	depends on MACH_VR41XX
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	help
 	  The TANBAC TB0226 (Mbase) is a MIPS-based platform manufactured by TANBAC.
@@ -102,6 +109,7 @@
 config TANBAC_TB0229
 	bool "Support for TANBAC TB0229 (VR4131DIMM)"
 	depends on MACH_VR41XX
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	help
 	  The TANBAC TB0229 (VR4131DIMM) is a MIPS-based platform manufactured by TANBAC.
@@ -109,25 +117,42 @@
 
 config VICTOR_MPC30X
 	bool "Support for Victor MP-C303/304"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	depends on MACH_VR41XX
 
 config ZAO_CAPCELLA
 	bool "Support for ZAO Networks Capcella"
 	depends on MACH_VR41XX
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 
+config VRC4171
+	tristate "add NEC VRC4171 companion chip support"
+	depends on MACH_VR41XX && ISA
+	---help---
+	  The NEC VRC4171/4171A is a companion chip for NEC VR4111/VR4121.
+
+config VRC4173
+	tristate "add NEC VRC4173 companion chip support"
+	depends on MACH_VR41XX && PCI
+	---help---
+	  The NEC VRC4173 is a companion chip for NEC VR4122/VR4131.
+
 config TOSHIBA_JMR3927
 	bool "Support for Toshiba JMR-TX3927 board"
 	depends on MIPS32
+	select DMA_NONCOHERENT
 
 config MIPS_COBALT
 	bool "Support for Cobalt Server (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 
 config MACH_DECSTATION
 	bool "Support for DECstations"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	depends on MIPS32 || EXPERIMENTAL
 	---help---
@@ -148,6 +173,7 @@
 config MIPS_EV64120
 	bool "Support for Galileo EV64120 Evaluation board (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
+	select DMA_NONCOHERENT
 	help
 	  This is an evaluation board based on the Galileo GT-64120
 	  single-chip system controller that contains a MIPS R5000 compatible
@@ -162,6 +188,7 @@
 config MIPS_EV96100
 	bool "Support for Galileo EV96100 Evaluation board (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	select MIPS_GT96100
 	select RM7000_CPU_SCACHE
@@ -173,6 +200,7 @@
 
 config MIPS_IVR
 	bool "Support for Globespan IVR board"
+	select DMA_NONCOHERENT
 	help
 	  This is an evaluation board built by Globespan to showcase thir
 	  iVR (Internet Video Recorder) design. It utilizes a QED RM5231
@@ -182,6 +210,7 @@
 
 config LASAT
 	bool "Support for LASAT Networks platforms"
+	select DMA_NONCOHERENT
 	select R5000_CPU_SCACHE
 
 config PICVUE
@@ -203,10 +232,12 @@
 config HP_LASERJET
 	bool "Support for Hewlett Packard LaserJet board"
 	depends on BROKEN
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 
 config MIPS_ITE8172
 	bool "Support for ITE 8172G board"
+	select DMA_NONCOHERENT
 	help
 	  Ths is an evaluation board made by ITE <http://www.ite.com.tw/>
 	  with ATX form factor that utilizes a MIPS R5000 to work with its
@@ -225,6 +256,7 @@
 
 config MIPS_ATLAS
 	bool "Support for MIPS Atlas board"
+	select DMA_NONCOHERENT
 	help
 	  This enables support for the QED R5231-based MIPS Atlas evaluation
 	  board.
@@ -232,17 +264,20 @@
 config MIPS_MALTA
 	bool "Support for MIPS Malta board"
 	select HAVE_STD_PC_SERIAL_PORT
+	select DMA_NONCOHERENT
 	help
 	  This enables support for the VR5000-based MIPS Malta evaluation
 	  board.
 
 config MIPS_SEAD
 	bool "Support for MIPS SEAD board (EXPERIMENTAL)"
-	select IRQ_CPU
 	depends on EXPERIMENTAL
+	select IRQ_CPU
+	select DMA_NONCOHERENT
 
 config MOMENCO_OCELOT
 	bool "Support for Momentum Ocelot board"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	select IRQ_CPU_RM7K
 	select RM7000_CPU_SCACHE
@@ -252,6 +287,7 @@
 
 config MOMENCO_OCELOT_G
 	bool "Support for Momentum Ocelot-G board"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	select IRQ_CPU_RM7K
 	select RM7000_CPU_SCACHE
@@ -261,6 +297,7 @@
 
 config MOMENCO_OCELOT_C
 	bool "Support for Momentum Ocelot-C board"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	select RM7000_CPU_SCACHE
 	help
@@ -269,6 +306,7 @@
 
 config MOMENCO_JAGUAR_ATX
 	bool "Support for Momentum Jaguar board"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	select IRQ_CPU_RM7K
 	select LIMITED_DMA
@@ -286,6 +324,7 @@
 
 config PMC_YOSEMITE
 	bool "Support for PMC-Sierra Yosemite eval board"
+	select DMA_NONCOHERENT
 	help
 	  Yosemite is an evaluation board for the RM9000x2 processor
 	  manufactured by PMC-Sierra
@@ -297,6 +336,7 @@
 config DDB5074
 	bool "Support for NEC DDB Vrc-5074 (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
+	select DMA_NONCOHERENT
 	select HAVE_STD_PC_SERIAL_PORT
 	select IRQ_CPU
 	select ISA
@@ -306,6 +346,7 @@
 
 config DDB5476
 	bool "Support for NEC DDB Vrc-5476"
+	select DMA_NONCOHERENT
 	select HAVE_STD_PC_SERIAL_PORT
 	select IRQ_CPU
 	select ISA
@@ -319,6 +360,7 @@
 
 config DDB5477
 	bool "Support for NEC DDB Vrc-5477"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 	help
 	  This enables support for the R5432-based NEC DDB Vrc-5477,
@@ -334,10 +376,12 @@
 	
 config NEC_OSPREY
 	bool "Support for NEC Osprey board"
+	select DMA_NONCOHERENT
 	select IRQ_CPU
 
 config SGI_IP22
 	bool "Support for SGI IP22 (Indy/Indigo2)"
+	select DMA_NONCOHERENT
 	select IP22_CPU_SCACHE
 	select IRQ_CPU
 	help
@@ -348,6 +392,7 @@
 config SGI_IP27
 	bool "Support for SGI IP27 (Origin200/2000)"
 	depends on MIPS64
+	select DMA_IP27
 	help
 	  This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics
 	  workstations.  To compile a Linux kernel that runs on these, say Y
@@ -411,6 +456,7 @@
 config SGI_IP32
 	bool "Support for SGI IP32 (O2) (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
+	select DMA_NONCOHERENT
 	select R5000_CPU_SCACHE
 	select RM7000_CPU_SCACHE
 	help
@@ -452,30 +498,37 @@
 config MIPS_PB1000
 	bool "PB1000 board"
 	depends on SOC_AU1000
+	select DMA_NONCOHERENT
 
 config MIPS_PB1100
 	bool "PB1100 board"
 	depends on SOC_AU1100
+	select DMA_NONCOHERENT
 
 config MIPS_PB1500
 	bool "PB1500 board"
 	depends on SOC_AU1500
+	select DMA_NONCOHERENT
 
 config MIPS_PB1550
 	bool "PB1550 board"
 	depends on SOC_AU1550
+	select DMA_NONCOHERENT
 
 config MIPS_DB1000
 	bool "DB1000 board"
 	depends on SOC_AU1000
+	select DMA_NONCOHERENT
 
 config MIPS_DB1100
 	bool "DB1100 board"
 	depends on SOC_AU1100
+	select DMA_NONCOHERENT
 
 config MIPS_DB1500
 	bool "DB1500 board"
 	depends on SOC_AU1500
+	select DMA_NONCOHERENT
 
 config MIPS_DB1550
 	bool "DB1550 board"
@@ -484,24 +537,29 @@
 config MIPS_BOSPORUS
 	bool "Bosporus board"
 	depends on SOC_AU1500
+	select DMA_NONCOHERENT
 
 config MIPS_MIRAGE
 	bool "Mirage board"
 	depends on SOC_AU1500
+	select DMA_NONCOHERENT
 
 config MIPS_XXS1500
 	bool "MyCable XXS1500 board"
 	depends on SOC_AU1500
+	select DMA_NONCOHERENT
 
 config MIPS_MTX1
 	bool "4G Systems MTX-1 board"
 	depends on SOC_AU1500
+	select DMA_NONCOHERENT
 
 endchoice
 
 config SIBYTE_SB1xxx_SOC
 	bool "Support for Broadcom BCM1xxx SOCs (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
+	select DMA_COHERENT
 
 choice
 	prompt "BCM1xxx SOC-based board"
@@ -710,6 +768,7 @@
 
 config SNI_RM200_PCI
 	bool "Support for SNI RM200 PCI"
+	select DMA_NONCOHERENT
 	select HAVE_STD_PC_SERIAL_PORT
 	select ISA
 	help
@@ -720,8 +779,9 @@
 
 config TOSHIBA_RBTX4927
 	bool "Support for Toshiba TBTX49[23]7 board"
-	select ISA
 	depends on MIPS32
+	select DMA_NONCOHERENT
+	select ISA
 
 config RWSEM_GENERIC_SPINLOCK
 	bool
@@ -744,18 +804,12 @@
 
 config	DMA_COHERENT
 	bool
-	depends on SIBYTE_SB1xxx_SOC
-	default y
 
 config	DMA_IP27
 	bool
-	depends on SGI_IP27
-	default y
 
 config	DMA_NONCOHERENT
 	bool
-	depends on ZAO_CAPCELLA || VICTOR_MPC30X || TOSHIBA_JMR3927 || TOSHIBA_RBTX4927 || SNI_RM200_PCI || SGI_IP32 || SGI_IP22 || NEC_EAGLE || NEC_OSPREY || DDB5477 || DDB5476 || DDB5074 || MOMENCO_OCELOT || MOMENCO_OCELOT_C || MOMENCO_OCELOT_G || MOMENCO_JAGUAR_ATX || MIPS_BOSPORUS || MIPS_DB1000 || MIPS_DB1100 || MIPS_DB1500 || MIPS_SEAD || MIPS_MALTA || MIPS_MAGNUM_4000 || MIPS_MIRAGE || MIPS_MTX1 || MIPS_XXS1500 || OLIVETTI_M700 || MIPS_ATLAS || LASAT || MIPS_ITE8172 || IBM_WORKPAD || HP_LASERJET || MIPS_IVR || MIPS_EV96100 || MIPS_EV64120 || MACH_DECSTATION || MIPS_COBALT || MIPS_PB1500 || MIPS_PB1100 || MIPS_PB1000 || MIPS_PB1550 || CASIO_E55 || ACER_PICA_61 || TANBAC_TB0226 || TANBAC_TB0229
-	default y
 
 config EARLY_PRINTK
 	bool
@@ -811,14 +865,6 @@
 	depends on ZAO_CAPCELLA || VICTOR_MPC30X || SIBYTE_SB1xxx_SOC || NEC_EAGLE || NEC_OSPREY || DDB5477 || CASIO_E55 || TANBAC_TB0226 || TANBAC_TB0229
 	default y
 
-config VRC4171
-	tristate "NEC VRC4171 Support"
-	depends on IBM_WORKPAD
-
-config VRC4173
-	tristate "NEC VRC4173 Support"
-	depends on NEC_EAGLE || VICTOR_MPC30X
-
 config DDB5XXX_COMMON
 	bool
 	depends on DDB5074 || DDB5476 || DDB5477
@@ -1170,7 +1216,7 @@
 
 config CPU_HAS_PREFETCH
 	bool "Enable prefetches" if CPU_SB1 && !CPU_SB1_PASS_2
-	default y if CPU_MIPS32 || CPU_MIPS64 || CPU_RM7000 || CPU_RM9000
+	default y if CPU_MIPS32 || CPU_MIPS64 || CPU_RM7000 || CPU_RM9000 || CPU_R10000
 
 config VTAG_ICACHE
 	bool "Support for Virtual Tagged I-cache" if CPU_MIPS64 || CPU_MIPS32
diff -Nru a/arch/mips/Makefile b/arch/mips/Makefile
--- a/arch/mips/Makefile	Tue Jun 15 22:20:36 2004
+++ b/arch/mips/Makefile	Tue Jun 15 22:20:36 2004
@@ -686,7 +686,7 @@
 		--change-addresses=0xa800000080000000 $< $@
 endif
 
-makeboot =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/mips/boot $(1)
+makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot $(1)
 
 ifdef CONFIG_SGI_IP27
 all:	vmlinux.64
@@ -708,9 +708,9 @@
 	       vmlinux.rm200
 
 archclean:
-	@$(MAKE) -f scripts/Makefile.clean obj=arch/mips/boot
-	@$(MAKE) -f scripts/Makefile.clean obj=arch/mips/baget
-	@$(MAKE) -f scripts/Makefile.clean obj=arch/mips/lasat
+	@$(MAKE) $(clean)=arch/mips/boot
+	@$(MAKE) $(clean)=arch/mips/baget
+	@$(MAKE) $(clean)=arch/mips/lasat
 
 # Generate <asm/offset.h 
 #
diff -Nru a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile
--- a/arch/mips/au1000/common/Makefile	Tue Jun 15 22:21:03 2004
+++ b/arch/mips/au1000/common/Makefile	Tue Jun 15 22:21:03 2004
@@ -7,7 +7,7 @@
 #
 
 obj-y += prom.o int-handler.o irq.o puts.o time.o reset.o \
-	au1xxx_irqmap.o clocks.o power.o setup.o sleeper.o
+	au1xxx_irqmap.o clocks.o power.o setup.o sleeper.o cputable.o
 
 obj-$(CONFIG_AU1X00_USB_DEVICE)	+= usbdev.o
 obj-$(CONFIG_KGDB)		+= dbg_io.o
diff -Nru a/arch/mips/au1000/common/cputable.c b/arch/mips/au1000/common/cputable.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/mips/au1000/common/cputable.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,56 @@
+/*
+ *  arch/mips/au1000/common/cputable.c
+ *
+ *  Copyright (C) 2004 Dan Malek (dan@embeddededge.com)
+ *	Copied from PowerPC and updated for Alchemy Au1xxx processors.
+ *
+ *  Copyright (C) 2001 Ben. Herrenschmidt (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/string.h>
+#include <linux/sched.h>
+#include <linux/threads.h>
+#include <linux/init.h>
+#include <asm/mach-au1x00/au1000.h>
+
+struct cpu_spec* cur_cpu_spec[NR_CPUS];
+
+/* With some thought, we can probably use the mask to reduce the
+ * size of the table.
+ */
+struct cpu_spec	cpu_specs[] = {
+    { 0xffffffff, 0x00030100, "Au1000 DA", 1, 0 },
+    { 0xffffffff, 0x00030201, "Au1000 HA", 1, 0 },
+    { 0xffffffff, 0x00030202, "Au1000 HB", 1, 0 },
+    { 0xffffffff, 0x00030203, "Au1000 HC", 1, 1 },
+    { 0xffffffff, 0x00030204, "Au1000 HD", 1, 1 },
+    { 0xffffffff, 0x01030200, "Au1500 AB", 1, 1 },
+    { 0xffffffff, 0x01030201, "Au1500 AC", 0, 1 },
+    { 0xffffffff, 0x01030202, "Au1500 AD", 0, 1 },
+    { 0xffffffff, 0x02030200, "Au1100 AB", 1, 1 },
+    { 0xffffffff, 0x02030201, "Au1100 BA", 1, 1 },
+    { 0xffffffff, 0x02030202, "Au1100 BC", 1, 1 },
+    { 0xffffffff, 0x02030203, "Au1100 BD", 0, 1 },
+    { 0xffffffff, 0x02030204, "Au1100 BE", 0, 1 },
+    { 0xffffffff, 0x03030200, "Au1550 AA", 0, 1 },
+    { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0 },
+};
+
+void
+set_cpuspec(void)
+{
+	struct	cpu_spec *sp;
+	u32	prid;
+
+	prid = read_c0_prid();
+	sp = cpu_specs;
+	while ((prid & sp->prid_mask) != sp->prid_value)
+		sp++;
+	cur_cpu_spec[0] = sp;
+}
diff -Nru a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
--- a/arch/mips/au1000/common/power.c	Tue Jun 15 22:21:02 2004
+++ b/arch/mips/au1000/common/power.c	Tue Jun 15 22:21:02 2004
@@ -320,7 +320,7 @@
 	unsigned long val, pll;
 #define TMPBUFLEN 64
 #define MAX_CPU_FREQ 396
-	char buf[8], *p;
+	char buf[TMPBUFLEN], *p;
 	unsigned long flags, intc0_mask, intc1_mask;
 	unsigned long old_baud_base, old_cpu_freq, baud_rate, old_clk,
 	    old_refresh;
diff -Nru a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
--- a/arch/mips/au1000/common/setup.c	Tue Jun 15 22:21:02 2004
+++ b/arch/mips/au1000/common/setup.c	Tue Jun 15 22:21:02 2004
@@ -65,40 +65,20 @@
 
 static int __init au1x00_setup(void)
 {
+	struct	cpu_spec *sp;
 	char *argptr;
 	unsigned long prid, cpupll, bclk = 1;
 
-	/* Various early Au1000 Errata corrected by this */
-	set_c0_config(1<<19); /* Config[OD] */
+	set_cpuspec();
+	sp = cur_cpu_spec[0];
 
 	board_setup();  /* board specific setup */
 
 	prid = read_c0_prid();
-	switch (prid)
-	{
-		case 0x00030100: printk("Au1000 DA "); bclk = 0; break;
-	 	case 0x00030201: printk("Au1000 HA "); bclk = 0; break;
-		case 0x00030202: printk("Au1000 HB "); bclk = 0; break;
-		case 0x00030203: printk("Au1000 HC "); break;
-		case 0x00030204: printk("Au1000 HD "); break;
-
-		case 0x01030200: printk("Au1500 AB "); break;
-		case 0x01030201: printk("Au1500 AC "); break;
-		case 0x01030202: printk("Au1500 AD "); break;
-
-		case 0x02030200: printk("Au1100 AB "); break;
-		case 0x02030201: printk("Au1100 BA "); break;
-		case 0x02030202: printk("Au1100 BC "); break;
-		case 0x02030203: printk("Au1100 BD "); break;
-		case 0x02030204: printk("Au1100 BE "); break;
-
-		case 0x03030200: printk("Au1550 AA "); break;
-
-		default: printk("Unknown Au1x00! "); bclk = 0; break;
-	}
 	cpupll = (au_readl(0xB1900060) & 0x3F) * 12;
 	printk("(PRId %08X) @ %dMHZ\n", prid, cpupll);
 
+	bclk = sp->cpu_bclk;
 	if (bclk)
 	{
 		/* Enable BCLK switching */
@@ -106,6 +86,15 @@
 		au_writel(bclk | 0x60, 0xB190003C);
 		printk("BCLK switching enabled!\n");
 	}
+
+	if (sp->cpu_od) {
+		/* Various early Au1000 Errata corrected by this */
+		set_c0_config(1<<19); /* Set Config[OD] */
+	}
+	else {
+		/* Clear to obtain best system bus performance */
+		clear_c0_config(1<<19); /* Clear Config[OD] */
+ 	}
 
 	argptr = prom_getcmdline();
 
diff -Nru a/arch/mips/configs/atlas_defconfig b/arch/mips/configs/atlas_defconfig
--- a/arch/mips/configs/atlas_defconfig	Tue Jun 15 22:20:58 2004
+++ b/arch/mips/configs/atlas_defconfig	Tue Jun 15 22:20:58 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -289,8 +292,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -300,7 +301,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -321,12 +324,12 @@
 # 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
@@ -334,6 +337,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -359,7 +367,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -367,10 +374,12 @@
 # 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
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
 
 #
 # Wireless LAN (non-hamradio)
@@ -378,37 +387,19 @@
 # CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wan interfaces
 #
-# CONFIG_TR is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
 # CONFIG_NET_FC is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-
-#
 # ISDN subsystem
 #
 # CONFIG_ISDN is not set
@@ -582,6 +573,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/bosporus_defconfig b/arch/mips/configs/bosporus_defconfig
--- a/arch/mips/configs/bosporus_defconfig	Tue Jun 15 22:20:44 2004
+++ b/arch/mips/configs/bosporus_defconfig	Tue Jun 15 22:20:44 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -231,8 +234,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -253,7 +254,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -274,6 +277,11 @@
 # 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
@@ -294,31 +302,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -334,21 +326,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -531,6 +522,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
--- a/arch/mips/configs/capcella_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/configs/capcella_defconfig	Tue Jun 15 22:20:37 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -56,6 +59,7 @@
 # CONFIG_TANBAC_TB0229 is not set
 # CONFIG_VICTOR_MPC30X is not set
 CONFIG_ZAO_CAPCELLA=y
+# CONFIG_VRC4173 is not set
 # CONFIG_TOSHIBA_JMR3927 is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
@@ -251,8 +255,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -262,7 +264,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -283,12 +287,12 @@
 # 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
@@ -296,6 +300,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -321,7 +330,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -329,45 +337,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -555,6 +547,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
--- a/arch/mips/configs/cobalt_defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/mips/configs/cobalt_defconfig	Tue Jun 15 22:20:38 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -240,8 +243,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -251,7 +252,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -272,12 +275,12 @@
 # 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
@@ -285,6 +288,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -310,7 +318,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -318,45 +325,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -535,6 +526,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
--- a/arch/mips/configs/db1000_defconfig	Tue Jun 15 22:20:40 2004
+++ b/arch/mips/configs/db1000_defconfig	Tue Jun 15 22:20:40 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -250,8 +253,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -272,7 +273,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -293,6 +296,11 @@
 # 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
@@ -314,31 +322,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -354,21 +346,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -557,6 +548,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
--- a/arch/mips/configs/db1100_defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/mips/configs/db1100_defconfig	Tue Jun 15 22:20:38 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -249,8 +252,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -271,7 +272,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -292,6 +295,11 @@
 # 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
@@ -313,31 +321,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -353,21 +345,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -553,6 +544,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
--- a/arch/mips/configs/db1500_defconfig	Tue Jun 15 22:20:39 2004
+++ b/arch/mips/configs/db1500_defconfig	Tue Jun 15 22:20:39 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -329,8 +332,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -351,7 +352,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -372,6 +375,11 @@
 # 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
@@ -393,31 +401,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -433,21 +425,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -627,6 +618,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ddb5476_defconfig b/arch/mips/configs/ddb5476_defconfig
--- a/arch/mips/configs/ddb5476_defconfig	Tue Jun 15 22:20:39 2004
+++ b/arch/mips/configs/ddb5476_defconfig	Tue Jun 15 22:20:39 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -251,8 +254,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -262,7 +263,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -283,12 +286,12 @@
 # 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
@@ -296,6 +299,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -328,7 +336,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -336,45 +343,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -573,6 +564,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
--- a/arch/mips/configs/ddb5477_defconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/mips/configs/ddb5477_defconfig	Tue Jun 15 22:20:43 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -221,8 +224,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -232,7 +233,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -253,12 +256,12 @@
 # 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
@@ -266,6 +269,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -310,7 +318,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -318,45 +325,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -532,6 +523,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
--- a/arch/mips/configs/decstation_defconfig	Tue Jun 15 22:20:42 2004
+++ b/arch/mips/configs/decstation_defconfig	Tue Jun 15 22:20:42 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -247,8 +250,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -258,7 +259,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -279,6 +282,11 @@
 # 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
@@ -300,41 +308,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -511,6 +502,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
--- a/arch/mips/configs/e55_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/configs/e55_defconfig	Tue Jun 15 22:20:37 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -56,6 +59,7 @@
 # CONFIG_TANBAC_TB0229 is not set
 # CONFIG_VICTOR_MPC30X is not set
 # CONFIG_ZAO_CAPCELLA is not set
+# CONFIG_VRC4171 is not set
 # CONFIG_TOSHIBA_JMR3927 is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
@@ -246,8 +250,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -257,7 +259,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -278,12 +282,12 @@
 # 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
@@ -291,6 +295,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -313,42 +322,25 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
 
 #
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -535,6 +527,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/eagle_defconfig b/arch/mips/configs/eagle_defconfig
--- a/arch/mips/configs/eagle_defconfig	Tue Jun 15 22:20:36 2004
+++ b/arch/mips/configs/eagle_defconfig	Tue Jun 15 22:20:36 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -56,6 +59,7 @@
 # CONFIG_TANBAC_TB0229 is not set
 # CONFIG_VICTOR_MPC30X is not set
 # CONFIG_ZAO_CAPCELLA is not set
+CONFIG_VRC4173=y
 # CONFIG_TOSHIBA_JMR3927 is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
@@ -88,7 +92,6 @@
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_IRQ_CPU=y
 CONFIG_DUMMY_KEYB=y
-CONFIG_VRC4173=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_FB is not set
 
@@ -329,8 +332,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -340,7 +341,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -361,12 +364,12 @@
 # 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
@@ -374,6 +377,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -399,7 +407,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -407,28 +414,17 @@
 # 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
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -444,21 +440,16 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -652,6 +643,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ev64120_defconfig b/arch/mips/configs/ev64120_defconfig
--- a/arch/mips/configs/ev64120_defconfig	Tue Jun 15 22:20:39 2004
+++ b/arch/mips/configs/ev64120_defconfig	Tue Jun 15 22:20:39 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -227,8 +230,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -238,7 +239,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -259,12 +262,12 @@
 # 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
@@ -272,6 +275,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -297,7 +305,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -305,6 +312,22 @@
 # 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=y
@@ -316,43 +339,11 @@
 # CONFIG_PPP_BSDCOMP is not set
 # CONFIG_PPPOE is not set
 # CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-
-#
 # ISDN subsystem
 #
 # CONFIG_ISDN is not set
@@ -526,6 +517,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ev96100_defconfig b/arch/mips/configs/ev96100_defconfig
--- a/arch/mips/configs/ev96100_defconfig	Tue Jun 15 22:20:42 2004
+++ b/arch/mips/configs/ev96100_defconfig	Tue Jun 15 22:20:42 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -220,8 +223,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -231,7 +232,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -252,6 +255,11 @@
 # 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
@@ -273,41 +281,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -481,6 +472,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
--- a/arch/mips/configs/ip22_defconfig	Tue Jun 15 22:20:39 2004
+++ b/arch/mips/configs/ip22_defconfig	Tue Jun 15 22:20:39 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG=y
@@ -32,6 +34,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -298,8 +301,6 @@
 CONFIG_INET6_ESP=m
 CONFIG_INET6_IPCOMP=m
 CONFIG_IPV6_TUNNEL=m
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -359,6 +360,8 @@
 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
 
 #
 # IPv6: Netfilter Configuration
@@ -382,6 +385,7 @@
 CONFIG_IP6_NF_TARGET_LOG=m
 CONFIG_IP6_NF_MANGLE=m
 CONFIG_IP6_NF_TARGET_MARK=m
+CONFIG_IP6_NF_RAW=m
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
@@ -395,7 +399,9 @@
 # CONFIG_SCTP_HMAC_SHA1 is not set
 CONFIG_SCTP_HMAC_MD5=y
 # 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
@@ -440,6 +446,11 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=m
 CONFIG_BONDING=m
@@ -461,41 +472,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -709,6 +703,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
--- a/arch/mips/configs/ip27_defconfig	Tue Jun 15 22:20:39 2004
+++ b/arch/mips/configs/ip27_defconfig	Tue Jun 15 22:20:39 2004
@@ -17,8 +17,10 @@
 #
 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=15
 # CONFIG_HOTPLUG is not set
 CONFIG_IKCONFIG=y
@@ -30,6 +32,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -112,6 +115,7 @@
 CONFIG_PAGE_SIZE_4KB=y
 # CONFIG_PAGE_SIZE_16KB is not set
 # CONFIG_PAGE_SIZE_64KB is not set
+CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_CPU_HAS_LLSC=y
 CONFIG_CPU_HAS_LLDSCD=y
 CONFIG_CPU_HAS_SYNC=y
@@ -206,7 +210,7 @@
 #
 # SCSI Transport Attributes
 #
-CONFIG_SCSI_SPI_ATTRS=m
+CONFIG_SCSI_SPI_ATTRS=y
 # CONFIG_SCSI_FC_ATTRS is not set
 
 #
@@ -293,8 +297,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -304,7 +306,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -320,40 +324,40 @@
 # QoS and/or fair queueing
 #
 CONFIG_NET_SCHED=y
-CONFIG_NET_SCH_CBQ=m
-CONFIG_NET_SCH_HTB=m
-CONFIG_NET_SCH_HFSC=m
-CONFIG_NET_SCH_CSZ=m
-CONFIG_NET_SCH_PRIO=m
-CONFIG_NET_SCH_RED=m
-CONFIG_NET_SCH_SFQ=m
-CONFIG_NET_SCH_TEQL=m
-CONFIG_NET_SCH_TBF=m
-CONFIG_NET_SCH_GRED=m
-CONFIG_NET_SCH_DSMARK=m
-CONFIG_NET_SCH_DELAY=m
+CONFIG_NET_SCH_CBQ=y
+CONFIG_NET_SCH_HTB=y
+CONFIG_NET_SCH_HFSC=y
+CONFIG_NET_SCH_CSZ=y
+CONFIG_NET_SCH_PRIO=y
+CONFIG_NET_SCH_RED=y
+CONFIG_NET_SCH_SFQ=y
+CONFIG_NET_SCH_TEQL=y
+CONFIG_NET_SCH_TBF=y
+CONFIG_NET_SCH_GRED=y
+CONFIG_NET_SCH_DSMARK=y
+CONFIG_NET_SCH_DELAY=y
 CONFIG_NET_QOS=y
 CONFIG_NET_ESTIMATOR=y
 CONFIG_NET_CLS=y
-CONFIG_NET_CLS_TCINDEX=m
-CONFIG_NET_CLS_ROUTE4=m
+CONFIG_NET_CLS_TCINDEX=y
+CONFIG_NET_CLS_ROUTE4=y
 CONFIG_NET_CLS_ROUTE=y
-CONFIG_NET_CLS_FW=m
-CONFIG_NET_CLS_U32=m
-CONFIG_NET_CLS_RSVP=m
-CONFIG_NET_CLS_RSVP6=m
+CONFIG_NET_CLS_FW=y
+CONFIG_NET_CLS_U32=y
+CONFIG_NET_CLS_RSVP=y
+CONFIG_NET_CLS_RSVP6=y
 CONFIG_NET_CLS_POLICE=y
 
 #
 # 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
@@ -361,6 +365,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -389,7 +398,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -397,45 +405,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -602,6 +594,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
@@ -691,27 +684,27 @@
 #
 CONFIG_CRYPTO=y
 CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
+CONFIG_CRYPTO_NULL=y
+CONFIG_CRYPTO_MD4=y
 CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
+CONFIG_CRYPTO_SHA1=y
+CONFIG_CRYPTO_SHA256=y
+CONFIG_CRYPTO_SHA512=y
 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_ARC4=m
-CONFIG_CRYPTO_DEFLATE=m
-CONFIG_CRYPTO_MICHAEL_MIC=m
+CONFIG_CRYPTO_BLOWFISH=y
+CONFIG_CRYPTO_TWOFISH=y
+CONFIG_CRYPTO_SERPENT=y
+CONFIG_CRYPTO_AES=y
+CONFIG_CRYPTO_CAST5=y
+CONFIG_CRYPTO_CAST6=y
+CONFIG_CRYPTO_ARC4=y
+CONFIG_CRYPTO_DEFLATE=y
+CONFIG_CRYPTO_MICHAEL_MIC=y
 # CONFIG_CRYPTO_TEST is not set
 
 #
 # Library routines
 #
 CONFIG_CRC32=y
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
diff -Nru a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
--- a/arch/mips/configs/ip32_defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/mips/configs/ip32_defconfig	Tue Jun 15 22:20:38 2004
@@ -18,8 +18,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
@@ -30,6 +32,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -289,8 +292,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -300,7 +301,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -321,12 +324,12 @@
 # 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
@@ -334,6 +337,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -360,7 +368,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -368,45 +375,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -583,6 +574,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/it8172_defconfig b/arch/mips/configs/it8172_defconfig
--- a/arch/mips/configs/it8172_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/configs/it8172_defconfig	Tue Jun 15 22:20:37 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -294,8 +297,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -305,7 +306,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -326,6 +329,11 @@
 # 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
@@ -346,41 +354,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -580,6 +571,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ivr_defconfig b/arch/mips/configs/ivr_defconfig
--- a/arch/mips/configs/ivr_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/configs/ivr_defconfig	Tue Jun 15 22:20:37 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -245,8 +248,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -256,7 +257,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -277,12 +280,12 @@
 # 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
@@ -290,6 +293,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -315,7 +323,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -323,45 +330,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -538,6 +529,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/jaguar-atx_defconfig b/arch/mips/configs/jaguar-atx_defconfig
--- a/arch/mips/configs/jaguar-atx_defconfig	Tue Jun 15 22:21:02 2004
+++ b/arch/mips/configs/jaguar-atx_defconfig	Tue Jun 15 22:21:02 2004
@@ -21,6 +21,7 @@
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
 CONFIG_IKCONFIG=y
@@ -32,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -219,10 +221,10 @@
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER 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
@@ -236,16 +238,21 @@
 # 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)
@@ -299,14 +306,7 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI 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
@@ -314,26 +314,17 @@
 # CONFIG_TR is not set
 
 #
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
 
 #
 # ISDN subsystem
@@ -483,6 +474,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLB_PAGE is not set
diff -Nru a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
--- a/arch/mips/configs/jmr3927_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/configs/jmr3927_defconfig	Tue Jun 15 22:20:37 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -219,8 +222,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -230,7 +231,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -251,12 +254,12 @@
 # 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
@@ -264,6 +267,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -289,7 +297,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -297,45 +304,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -547,6 +538,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLB_PAGE is not set
diff -Nru a/arch/mips/configs/lasat200_defconfig b/arch/mips/configs/lasat200_defconfig
--- a/arch/mips/configs/lasat200_defconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/mips/configs/lasat200_defconfig	Tue Jun 15 22:20:41 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -334,8 +337,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -345,7 +346,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -366,16 +369,21 @@
 # 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)
@@ -403,7 +411,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -411,45 +418,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -630,6 +621,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
--- a/arch/mips/configs/malta_defconfig	Tue Jun 15 22:20:44 2004
+++ b/arch/mips/configs/malta_defconfig	Tue Jun 15 22:20:44 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -233,8 +236,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -244,7 +245,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -265,12 +268,12 @@
 # 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
@@ -278,6 +281,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -322,7 +330,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -330,45 +337,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -543,6 +534,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/mirage_defconfig b/arch/mips/configs/mirage_defconfig
--- a/arch/mips/configs/mirage_defconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/mips/configs/mirage_defconfig	Tue Jun 15 22:20:43 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -231,8 +234,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -253,7 +254,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -274,6 +277,11 @@
 # 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
@@ -294,31 +302,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -334,21 +326,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -531,6 +522,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
--- a/arch/mips/configs/mpc30x_defconfig	Tue Jun 15 22:20:44 2004
+++ b/arch/mips/configs/mpc30x_defconfig	Tue Jun 15 22:20:44 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -56,6 +59,7 @@
 # CONFIG_TANBAC_TB0229 is not set
 CONFIG_VICTOR_MPC30X=y
 # CONFIG_ZAO_CAPCELLA is not set
+CONFIG_VRC4173=y
 # CONFIG_TOSHIBA_JMR3927 is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
@@ -88,7 +92,6 @@
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_IRQ_CPU=y
 CONFIG_DUMMY_KEYB=y
-CONFIG_VRC4173=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_FB is not set
 
@@ -123,7 +126,9 @@
 #
 # Bus options (PCI, PCMCIA, EISA, ISA, TC)
 #
-# CONFIG_PCI is not set
+CONFIG_PCI=y
+CONFIG_PCI_LEGACY_PROC=y
+CONFIG_PCI_NAMES=y
 CONFIG_MMU=y
 
 #
@@ -159,8 +164,13 @@
 # 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 is not set
 # CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_CARMEL is not set
 # CONFIG_BLK_DEV_RAM is not set
 # CONFIG_LBD is not set
 
@@ -182,6 +192,7 @@
 #
 # Fusion MPT device support
 #
+# CONFIG_FUSION is not set
 
 #
 # IEEE 1394 (FireWire) support
@@ -191,6 +202,7 @@
 #
 # I2O device support
 #
+# CONFIG_I2O is not set
 
 #
 # Networking support
@@ -221,8 +233,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -232,7 +242,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -253,6 +265,11 @@
 # 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
@@ -261,53 +278,66 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
 # CONFIG_MII is not set
+# CONFIG_HAPPYMEAL is not set
+# CONFIG_SUNGEM is not set
+# CONFIG_NET_VENDOR_3COM is not set
 
 #
-# Ethernet (1000 Mbit)
+# Tulip family network device support
 #
+# CONFIG_NET_TULIP is not set
+# CONFIG_HP100 is not set
+# CONFIG_NET_PCI is not set
 
 #
-# Ethernet (10000 Mbit)
+# Ethernet (1000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
+# 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
 
 #
-# Wireless LAN (non-hamradio)
+# Ethernet (10000 Mbit)
 #
-# CONFIG_NET_RADIO is not set
+# CONFIG_IXGB is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
+# CONFIG_TR is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -345,6 +375,7 @@
 CONFIG_SERIO_I8042=y
 CONFIG_SERIO_SERPORT=y
 # CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_PCIPS2 is not set
 
 #
 # Input Device Drivers
@@ -442,6 +473,7 @@
 #
 # USB support
 #
+# CONFIG_USB is not set
 
 #
 # USB Gadget Support
@@ -481,6 +513,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
--- a/arch/mips/configs/mtx1_defconfig	Tue Jun 15 22:20:42 2004
+++ b/arch/mips/configs/mtx1_defconfig	Tue Jun 15 22:20:42 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -231,8 +234,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -253,7 +254,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -274,6 +277,11 @@
 # 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
@@ -294,31 +302,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -334,21 +326,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -531,6 +522,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ocelot_c_defconfig b/arch/mips/configs/ocelot_c_defconfig
--- a/arch/mips/configs/ocelot_c_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/configs/ocelot_c_defconfig	Tue Jun 15 22:20:37 2004
@@ -18,8 +18,10 @@
 #
 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_IKCONFIG is not set
@@ -30,6 +32,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -210,8 +213,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -221,7 +222,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -242,6 +245,11 @@
 # 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
@@ -266,41 +274,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -474,6 +465,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
--- a/arch/mips/configs/ocelot_defconfig	Tue Jun 15 22:20:39 2004
+++ b/arch/mips/configs/ocelot_defconfig	Tue Jun 15 22:20:39 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -218,8 +221,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -229,7 +230,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -250,6 +253,11 @@
 # 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
@@ -270,41 +278,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -478,6 +469,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/osprey_defconfig b/arch/mips/configs/osprey_defconfig
--- a/arch/mips/configs/osprey_defconfig	Tue Jun 15 22:20:36 2004
+++ b/arch/mips/configs/osprey_defconfig	Tue Jun 15 22:20:36 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -212,8 +215,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -223,7 +224,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -244,6 +247,11 @@
 # 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
@@ -264,41 +272,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -472,6 +463,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/pb1000_defconfig b/arch/mips/configs/pb1000_defconfig
--- a/arch/mips/configs/pb1000_defconfig	Tue Jun 15 22:20:36 2004
+++ b/arch/mips/configs/pb1000_defconfig	Tue Jun 15 22:20:36 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -231,8 +234,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -253,7 +254,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -274,6 +277,11 @@
 # 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
@@ -294,31 +302,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -334,21 +326,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -531,6 +522,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
--- a/arch/mips/configs/pb1100_defconfig	Tue Jun 15 22:20:40 2004
+++ b/arch/mips/configs/pb1100_defconfig	Tue Jun 15 22:20:40 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -231,8 +234,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -253,7 +254,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -274,6 +277,11 @@
 # 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
@@ -294,31 +302,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -334,21 +326,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -531,6 +522,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
--- a/arch/mips/configs/pb1500_defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/mips/configs/pb1500_defconfig	Tue Jun 15 22:20:38 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -315,8 +318,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -337,7 +338,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -358,12 +361,12 @@
 # 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
@@ -371,6 +374,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -397,7 +405,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -405,35 +412,17 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-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 is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -449,21 +438,23 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -646,6 +637,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
--- a/arch/mips/configs/pb1550_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/configs/pb1550_defconfig	Tue Jun 15 22:20:37 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -314,8 +317,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -336,7 +337,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -357,12 +360,12 @@
 # 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
@@ -370,6 +373,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -396,7 +404,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -404,35 +411,17 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-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 is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -448,21 +437,23 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -645,6 +636,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
--- a/arch/mips/configs/rm200_defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/mips/configs/rm200_defconfig	Tue Jun 15 22:20:38 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
 CONFIG_IKCONFIG=y
@@ -32,6 +34,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -250,7 +253,7 @@
 #
 # SCSI Transport Attributes
 #
-CONFIG_SCSI_SPI_ATTRS=m
+CONFIG_SCSI_SPI_ATTRS=y
 # CONFIG_SCSI_FC_ATTRS is not set
 
 #
@@ -385,10 +388,6 @@
 CONFIG_INET6_ESP=m
 CONFIG_INET6_IPCOMP=m
 CONFIG_IPV6_TUNNEL=m
-CONFIG_DECNET=m
-# CONFIG_DECNET_SIOCGIFCONF is not set
-# CONFIG_DECNET_ROUTER is not set
-CONFIG_BRIDGE=m
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 CONFIG_BRIDGE_NETFILTER=y
@@ -450,6 +449,8 @@
 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
 
 #
 # IPv6: Netfilter Configuration
@@ -473,6 +474,7 @@
 CONFIG_IP6_NF_TARGET_LOG=m
 CONFIG_IP6_NF_MANGLE=m
 CONFIG_IP6_NF_TARGET_MARK=m
+CONFIG_IP6_NF_RAW=m
 
 #
 # DECnet: Netfilter Configuration
@@ -509,7 +511,11 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+CONFIG_BRIDGE=m
 # CONFIG_VLAN_8021Q is not set
+CONFIG_DECNET=m
+# CONFIG_DECNET_SIOCGIFCONF is not set
+# CONFIG_DECNET_ROUTER is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -554,12 +560,34 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
-CONFIG_NETDEVICES=y
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+CONFIG_HAMRADIO=y
 
 #
-# ARCnet devices
+# Packet Radio protocols
 #
-# CONFIG_ARCNET is not set
+CONFIG_AX25=m
+CONFIG_AX25_DAMA_SLAVE=y
+CONFIG_NETROM=m
+CONFIG_ROSE=m
+
+#
+# AX.25 network device drivers
+#
+CONFIG_MKISS=m
+CONFIG_6PACK=m
+CONFIG_BPQETHER=m
+# CONFIG_DMASCC is not set
+# CONFIG_SCC is not set
+# CONFIG_BAYCOM_SER_FDX is not set
+# CONFIG_BAYCOM_SER_HDX is not set
+# CONFIG_BAYCOM_PAR is not set
+# CONFIG_BAYCOM_EPP is not set
+# CONFIG_YAM is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+CONFIG_NETDEVICES=y
 CONFIG_DUMMY=m
 CONFIG_BONDING=m
 CONFIG_EQUALIZER=m
@@ -567,6 +595,11 @@
 CONFIG_ETHERTAP=m
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -633,7 +666,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -641,11 +673,12 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PLIP=m
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
+# CONFIG_S2IO is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
 
 #
 # Wireless LAN (non-hamradio)
@@ -653,59 +686,20 @@
 # CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wan interfaces
 #
-# CONFIG_TR is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PLIP=m
+# CONFIG_PPP is not set
+# 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
 
 #
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-CONFIG_HAMRADIO=y
-
-#
-# Packet Radio protocols
-#
-CONFIG_AX25=m
-CONFIG_AX25_DAMA_SLAVE=y
-CONFIG_NETROM=m
-CONFIG_ROSE=m
-
-#
-# AX.25 network device drivers
-#
-# CONFIG_MKISS is not set
-# CONFIG_6PACK is not set
-CONFIG_BPQETHER=m
-# CONFIG_DMASCC is not set
-# CONFIG_SCC is not set
-# CONFIG_BAYCOM_SER_FDX is not set
-# CONFIG_BAYCOM_SER_HDX is not set
-# CONFIG_BAYCOM_PAR is not set
-# CONFIG_BAYCOM_EPP is not set
-# CONFIG_YAM is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-
-#
 # ISDN subsystem
 #
 # CONFIG_ISDN is not set
@@ -873,6 +867,7 @@
 #
 CONFIG_USB_EHCI_HCD=m
 # CONFIG_USB_EHCI_SPLIT_ISO is not set
+# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 CONFIG_USB_OHCI_HCD=m
 CONFIG_USB_UHCI_HCD=m
 
@@ -1019,7 +1014,8 @@
 CONFIG_USB_RIO500=m
 CONFIG_USB_LEGOTOWER=m
 CONFIG_USB_LCD=m
-# CONFIG_USB_LED is not set
+CONFIG_USB_LED=m
+CONFIG_USB_CYTHERM=m
 CONFIG_USB_TEST=m
 
 #
@@ -1031,9 +1027,11 @@
 # CONFIG_USB_GADGET_PXA2XX is not set
 # CONFIG_USB_GADGET_GOKU is not set
 # CONFIG_USB_GADGET_SA1100 is not set
+# CONFIG_USB_GADGET_DUMMY_HCD is not set
 CONFIG_USB_GADGET_DUALSPEED=y
 CONFIG_USB_ZERO=m
 CONFIG_USB_ETH=m
+# CONFIG_USB_ETH_RNDIS is not set
 CONFIG_USB_GADGETFS=m
 # CONFIG_USB_FILE_STORAGE is not set
 # CONFIG_USB_G_SERIAL is not set
@@ -1093,6 +1091,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
@@ -1152,7 +1151,7 @@
 CONFIG_NCPFS_EXTRAS=y
 CONFIG_CODA_FS=m
 CONFIG_CODA_FS_OLD_API=y
-# CONFIG_INTERMEZZO_FS is not set
+CONFIG_INTERMEZZO_FS=m
 CONFIG_AFS_FS=m
 CONFIG_RXRPC=m
 
@@ -1252,7 +1251,7 @@
 CONFIG_CRYPTO_CAST6=m
 # CONFIG_CRYPTO_ARC4 is not set
 CONFIG_CRYPTO_DEFLATE=m
-CONFIG_CRYPTO_MICHAEL_MIC=y
+CONFIG_CRYPTO_MICHAEL_MIC=m
 CONFIG_CRYPTO_TEST=m
 
 #
diff -Nru a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
--- a/arch/mips/configs/sb1250-swarm_defconfig	Tue Jun 15 22:21:05 2004
+++ b/arch/mips/configs/sb1250-swarm_defconfig	Tue Jun 15 22:21:05 2004
@@ -18,8 +18,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=15
 # CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
@@ -30,6 +32,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -265,8 +268,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -276,7 +277,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -297,12 +300,12 @@
 # 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
@@ -310,6 +313,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -336,7 +344,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -344,45 +351,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -424,6 +415,7 @@
 # CONFIG_VT is not set
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_ROCKETPORT is not set
+# CONFIG_CYCLADES is not set
 # CONFIG_SYNCLINK is not set
 # CONFIG_SYNCLINKMP is not set
 # CONFIG_N_HDLC is not set
@@ -541,6 +533,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 # CONFIG_TMPFS is not set
diff -Nru a/arch/mips/configs/sead_defconfig b/arch/mips/configs/sead_defconfig
--- a/arch/mips/configs/sead_defconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/mips/configs/sead_defconfig	Tue Jun 15 22:20:41 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 # 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
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -194,11 +197,6 @@
 # Networking support
 #
 # CONFIG_NET is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
 
@@ -376,6 +374,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLB_PAGE is not set
diff -Nru a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
--- a/arch/mips/configs/tb0226_defconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/mips/configs/tb0226_defconfig	Tue Jun 15 22:20:41 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -282,8 +285,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 
 #
@@ -291,7 +292,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -312,6 +315,11 @@
 # 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
@@ -332,48 +340,31 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# 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)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# 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_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -569,6 +560,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig
--- a/arch/mips/configs/tb0229_defconfig	Tue Jun 15 22:21:03 2004
+++ b/arch/mips/configs/tb0229_defconfig	Tue Jun 15 22:21:03 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -56,6 +59,7 @@
 CONFIG_TANBAC_TB0229=y
 # CONFIG_VICTOR_MPC30X is not set
 # CONFIG_ZAO_CAPCELLA is not set
+# CONFIG_VRC4173 is not set
 # CONFIG_TOSHIBA_JMR3927 is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
@@ -239,8 +243,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -250,7 +252,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -271,12 +275,12 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
 CONFIG_DUMMY=m
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
@@ -284,6 +288,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -309,7 +318,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -317,6 +325,22 @@
 # 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=m
@@ -331,43 +355,11 @@
 CONFIG_SLIP_COMPRESSED=y
 CONFIG_SLIP_SMART=y
 CONFIG_SLIP_MODE_SLIP6=y
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-
-#
 # ISDN subsystem
 #
 # CONFIG_ISDN is not set
@@ -559,6 +551,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
--- a/arch/mips/configs/workpad_defconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/mips/configs/workpad_defconfig	Tue Jun 15 22:20:43 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -56,6 +59,7 @@
 # CONFIG_TANBAC_TB0229 is not set
 # CONFIG_VICTOR_MPC30X is not set
 # CONFIG_ZAO_CAPCELLA is not set
+CONFIG_VRC4171=y
 # CONFIG_TOSHIBA_JMR3927 is not set
 # CONFIG_MIPS_COBALT is not set
 # CONFIG_MACH_DECSTATION is not set
@@ -87,7 +91,6 @@
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_CPU_LITTLE_ENDIAN=y
 CONFIG_IRQ_CPU=y
-CONFIG_VRC4171=y
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_FB is not set
 
@@ -246,8 +249,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
@@ -257,7 +258,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -278,12 +281,12 @@
 # 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
@@ -291,6 +294,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -313,42 +321,25 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
 
 #
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -539,6 +530,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/xxs1500_defconfig b/arch/mips/configs/xxs1500_defconfig
--- a/arch/mips/configs/xxs1500_defconfig	Tue Jun 15 22:21:03 2004
+++ b/arch/mips/configs/xxs1500_defconfig	Tue Jun 15 22:21:03 2004
@@ -19,8 +19,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
 # CONFIG_IKCONFIG is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -231,8 +234,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -253,7 +254,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -274,6 +277,11 @@
 # 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
@@ -294,31 +302,15 @@
 #
 # Ethernet (10000 Mbit)
 #
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
 
 #
 # Token Ring devices
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -334,21 +326,20 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -531,6 +522,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
--- a/arch/mips/configs/yosemite_defconfig	Tue Jun 15 22:21:02 2004
+++ b/arch/mips/configs/yosemite_defconfig	Tue Jun 15 22:21:02 2004
@@ -18,8 +18,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=15
 # CONFIG_HOTPLUG is not set
 CONFIG_IKCONFIG=y
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -251,8 +254,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 
 #
@@ -260,7 +261,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -281,6 +284,11 @@
 # 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
@@ -300,41 +308,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -375,6 +366,7 @@
 # CONFIG_VT is not set
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_ROCKETPORT is not set
+# CONFIG_CYCLADES is not set
 # CONFIG_SYNCLINK is not set
 # CONFIG_SYNCLINKMP is not set
 # CONFIG_N_HDLC is not set
@@ -489,6 +481,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
diff -Nru a/arch/mips/defconfig b/arch/mips/defconfig
--- a/arch/mips/defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/defconfig	Tue Jun 15 22:20:37 2004
@@ -19,8 +19,10 @@
 #
 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_IKCONFIG=y
@@ -32,6 +34,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -298,8 +301,6 @@
 CONFIG_INET6_ESP=m
 CONFIG_INET6_IPCOMP=m
 CONFIG_IPV6_TUNNEL=m
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -359,6 +360,8 @@
 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
 
 #
 # IPv6: Netfilter Configuration
@@ -382,6 +385,7 @@
 CONFIG_IP6_NF_TARGET_LOG=m
 CONFIG_IP6_NF_MANGLE=m
 CONFIG_IP6_NF_TARGET_MARK=m
+CONFIG_IP6_NF_RAW=m
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
@@ -395,7 +399,9 @@
 # CONFIG_SCTP_HMAC_SHA1 is not set
 CONFIG_SCTP_HMAC_MD5=y
 # 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
@@ -440,6 +446,11 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=m
 CONFIG_BONDING=m
@@ -461,41 +472,24 @@
 #
 # Ethernet (10000 Mbit)
 #
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE 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
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER 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
@@ -709,6 +703,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 CONFIG_DEVPTS_FS_SECURITY=y
diff -Nru a/arch/mips/gt64120/momenco_ocelot/prom.c b/arch/mips/gt64120/momenco_ocelot/prom.c
--- a/arch/mips/gt64120/momenco_ocelot/prom.c	Tue Jun 15 22:20:36 2004
+++ b/arch/mips/gt64120/momenco_ocelot/prom.c	Tue Jun 15 22:20:36 2004
@@ -14,17 +14,7 @@
 
 #include <asm/addrspace.h>
 #include <asm/bootinfo.h>
-
-struct callvectors {
-	int	(*open) (char*, int, int);
-	int	(*close) (int);
-	int	(*read) (int, void*, int);
-	int	(*write) (int, void*, int);
-	off_t	(*lseek) (int, off_t, int);
-	int	(*printf) (const char*, ...);
-	void	(*cacheflush) (void);
-	char*	(*gets) (char*);
-};
+#include <asm/pmon.h>
 
 struct callvectors* debug_vectors;
 
diff -Nru a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
--- a/arch/mips/kernel/entry.S	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/kernel/entry.S	Tue Jun 15 22:20:37 2004
@@ -114,11 +114,13 @@
 	SAVE_STATIC
 FEXPORT(syscall_exit_work)
 	LONG_L	t0, TI_FLAGS($28)
-	li	t1, _TIF_SYSCALL_TRACE
+	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
 	and	t0, t1
 	beqz	t0, work_pending	# trace bit is set
 	local_irq_enable		# could let do_syscall_trace()
 					# call schedule() instead
+	move	a0, sp
+	li	a1, 1
 	jal	do_syscall_trace
 	b	resume_userspace
 
diff -Nru a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
--- a/arch/mips/kernel/irixelf.c	Tue Jun 15 22:21:05 2004
+++ b/arch/mips/kernel/irixelf.c	Tue Jun 15 22:21:05 2004
@@ -1130,7 +1130,7 @@
 	psinfo.pr_pid = prstatus.pr_pid = current->pid;
 	psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid;
 	psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current);
-	psinfo.pr_sid = prstatus.pr_sid = current->session;
+	psinfo.pr_sid = prstatus.pr_sid = current->signal->session;
 	prstatus.pr_utime.tv_sec = CT_TO_SECS(current->utime);
 	prstatus.pr_utime.tv_usec = CT_TO_USECS(current->utime);
 	prstatus.pr_stime.tv_sec = CT_TO_SECS(current->stime);
diff -Nru a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
--- a/arch/mips/kernel/irixsig.c	Tue Jun 15 22:20:44 2004
+++ b/arch/mips/kernel/irixsig.c	Tue Jun 15 22:20:44 2004
@@ -13,12 +13,11 @@
 #include <linux/smp_lock.h>
 #include <linux/time.h>
 #include <linux/ptrace.h>
+#include <linux/suspend.h>
 
 #include <asm/ptrace.h>
 #include <asm/uaccess.h>
 
-extern asmlinkage void do_syscall_trace(void);
-
 #undef DEBUG_SIG
 
 #define _S(nr) (1<<((nr)-1))
@@ -177,6 +176,19 @@
 	siginfo_t info;
 	int signr;
 
+	/*
+	 * We want the common case to go fast, which is why we may in certain
+	 * cases get here from kernel mode. Just return without doing anything
+	 * if so.
+	 */
+	if (!user_mode(regs))
+		return 1;
+
+	if (current->flags & PF_FREEZE) {
+		refrigerator(0);
+		goto no_signal;
+	}
+
 	if (!oldset)
 		oldset = &current->blocked;
 
@@ -186,6 +198,7 @@
 		return 1;
 	}
 
+no_signal:
 	/*
 	 * Who's code doesn't conform to the restartable syscall convention
 	 * dies here!!!  The li instruction, a single machine instruction,
@@ -263,7 +276,7 @@
 	 * Don't let your children do this ...
 	 */
 	if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
-		do_syscall_trace();
+		do_syscall_trace(regs, 1);
 	__asm__ __volatile__(
 		"move\t$29,%0\n\t"
 		"j\tsyscall_exit"
@@ -536,7 +549,7 @@
 #define P_PGID   2
 #define P_ALL    7
 
-extern int getrusage(struct task_struct *, int, struct rusage *);
+extern int getrusage(struct task_struct *, int, struct rusage __user *);
 
 #define W_EXITED     1
 #define W_TRAPPED    2
diff -Nru a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
--- a/arch/mips/kernel/linux32.c	Tue Jun 15 22:20:42 2004
+++ b/arch/mips/kernel/linux32.c	Tue Jun 15 22:20:42 2004
@@ -142,228 +142,6 @@
 }
 
 /*
- * count32() counts the number of arguments/envelopes
- */
-static int count32(u32 * argv, int max)
-{
-	int i = 0;
-
-	if (argv != NULL) {
-		for (;;) {
-			u32 p; int error;
-
-			error = get_user(p,argv);
-			if (error)
-				return error;
-			if (!p)
-				break;
-			argv++;
-			if (++i > max)
-				return -E2BIG;
-		}
-	}
-	return i;
-}
-
-
-/*
- * 'copy_strings32()' copies argument/envelope strings from user
- * memory to free pages in kernel mem. These are in a format ready
- * to be put directly into the top of new user memory.
- */
-int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm)
-{
-	struct page *kmapped_page = NULL;
-	char *kaddr = NULL;
-	int ret;
-
-	while (argc-- > 0) {
-		u32 str;
-		int len;
-		unsigned long pos;
-
-		if (get_user(str, argv+argc) || !str ||
-		     !(len = strnlen_user((char *)A(str), bprm->p))) {
-			ret = -EFAULT;
-			goto out;
-		}
-
-		if (bprm->p < len)  {
-			ret = -E2BIG;
-			goto out;
-		}
-
-		bprm->p -= len;
-		/* XXX: add architecture specific overflow check here. */
-
-		pos = bprm->p;
-		while (len > 0) {
-			int i, new, err;
-			int offset, bytes_to_copy;
-			struct page *page;
-
-			offset = pos % PAGE_SIZE;
-			i = pos/PAGE_SIZE;
-			page = bprm->page[i];
-			new = 0;
-			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
-				bprm->page[i] = page;
-				if (!page) {
-					ret = -ENOMEM;
-					goto out;
-				}
-				new = 1;
-			}
-
-			if (page != kmapped_page) {
-				if (kmapped_page)
-					kunmap(kmapped_page);
-				kmapped_page = page;
-				kaddr = kmap(kmapped_page);
-			}
-			if (new && offset)
-				memset(kaddr, 0, offset);
-			bytes_to_copy = PAGE_SIZE - offset;
-			if (bytes_to_copy > len) {
-				bytes_to_copy = len;
-				if (new)
-					memset(kaddr+offset+len, 0,
-					       PAGE_SIZE-offset-len);
-			}
-			err = copy_from_user(kaddr + offset, (char *)A(str),
-			                     bytes_to_copy);
-			if (err) {
-				ret = -EFAULT;
-				goto out;
-			}
-
-			pos += bytes_to_copy;
-			str += bytes_to_copy;
-			len -= bytes_to_copy;
-		}
-	}
-	ret = 0;
-out:
-	if (kmapped_page)
-		kunmap(kmapped_page);
-	return ret;
-}
-
-#ifdef CONFIG_MMU
-
-#define free_arg_pages(bprm) do { } while (0)
-
-#else
-
-static inline void free_arg_pages(struct linux_binprm *bprm)
-{
-	int i;
-
-	for (i = 0; i < MAX_ARG_PAGES; i++) {
-		if (bprm->page[i])
-			__free_page(bprm->page[i]);
-		bprm->page[i] = NULL;
-	}
-}
-
-#endif /* CONFIG_MMU */
-
-/*
- * sys32_execve() executes a new program.
- */
-static inline int 
-do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs)
-{
-	struct linux_binprm bprm;
-	struct file * file;
-	int retval;
-
-	sched_balance_exec();
-
-	file = open_exec(filename);
-
-	retval = PTR_ERR(file);
-	if (IS_ERR(file))
-		return retval;
-
-	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
-	memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0]));
-
-	bprm.file = file;
-	bprm.filename = filename;
-	bprm.interp = filename;
-	bprm.sh_bang = 0;
-	bprm.loader = 0;
-	bprm.exec = 0;
-	bprm.security = NULL;
-	bprm.mm = mm_alloc();
-	retval = -ENOMEM;
-	if (!bprm.mm) 
-		goto out_file;
-
-	retval = init_new_context(current, bprm.mm);
-	if (retval < 0)
-		goto out_mm;
-
-	bprm.argc = count32(argv, bprm.p / sizeof(u32));
-	if ((retval = bprm.argc) < 0)
-		goto out_mm;
-
-	bprm.envc = count32(envp, bprm.p / sizeof(u32));
-	if ((retval = bprm.envc) < 0)
-		goto out_mm;
-
-	retval = security_bprm_alloc(&bprm);
-	if (retval)
-		goto out;
-
-	retval = prepare_binprm(&bprm);
-	if (retval < 0)
-		goto out;
-	
-	retval = copy_strings_kernel(1, &bprm.filename, &bprm);
-	if (retval < 0)
-		goto out;
-
-	bprm.exec = bprm.p;
-	retval = copy_strings32(bprm.envc, envp, &bprm);
-	if (retval < 0)
-		goto out;
-
-	retval = copy_strings32(bprm.argc, argv, &bprm);
-	if (retval < 0)
-		goto out;
-
-	retval = search_binary_handler(&bprm, regs);
-	if (retval >= 0) {
-		free_arg_pages(&bprm);
-
-		/* execve success */
-		security_bprm_free(&bprm);
-		return retval;
-	}
-
-out:
-	/* Something went wrong, return the inode and free the argument pages*/
-	free_arg_pages(&bprm);
-
-	if (bprm.security)
-		security_bprm_free(&bprm);
-
-out_mm:
-	if (bprm.mm)
-		mmdrop(bprm.mm);
-
-out_file:
-	if (bprm.file) {
-		allow_write_access(bprm.file);
-		fput(bprm.file);
-	}
-	return retval;
-}
-
-/*
  * sys_execve() executes a new program.
  */
 asmlinkage int sys32_execve(nabi_no_regargs struct pt_regs regs)
@@ -371,12 +149,12 @@
 	int error;
 	char * filename;
 
-	filename = getname((char *) (long)regs.regs[4]);
+	filename = getname(compat_ptr(regs.regs[4]));
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
-	error = do_execve32(filename, (u32 *) (long)regs.regs[5],
-	                  (u32 *) (long)regs.regs[6], &regs);
+	error = compat_do_execve(filename, compat_ptr(regs.regs[5]),
+				 compat_ptr(regs.regs[6]), &regs);
 	putname(filename);
 
 out:
@@ -671,150 +449,6 @@
 	return sys_llseek(fd, offset_high, offset_low, result, origin);
 }
 
-typedef ssize_t (*IO_fn_t)(struct file *, char *, size_t, loff_t *);
-
-static long
-do_readv_writev32(int type, struct file *file, const struct compat_iovec *vector,
-		  u32 count)
-{
-	unsigned long tot_len;
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov=iovstack, *ivp;
-	struct inode *inode;
-	long retval, i;
-	IO_fn_t fn;
-
-	/* First get the "struct iovec" from user memory and
-	 * verify all the pointers
-	 */
-	if (!count)
-		return 0;
-	if(verify_area(VERIFY_READ, vector, sizeof(struct compat_iovec)*count))
-		return -EFAULT;
-	if (count > UIO_MAXIOV)
-		return -EINVAL;
-	if (count > UIO_FASTIOV) {
-		iov = kmalloc(count*sizeof(struct iovec), GFP_KERNEL);
-		if (!iov)
-			return -ENOMEM;
-	}
-
-	tot_len = 0;
-	i = count;
-	ivp = iov;
-	while (i > 0) {
-		u32 len;
-		u32 buf;
-
-		__get_user(len, &vector->iov_len);
-		__get_user(buf, &vector->iov_base);
-		tot_len += len;
-		ivp->iov_base = (void *)A(buf);
-		ivp->iov_len = (__kernel_size_t) len;
-		vector++;
-		ivp++;
-		i--;
-	}
-
-	inode = file->f_dentry->d_inode;
-	/* VERIFY_WRITE actually means a read, as we write to user space */
-	retval = locks_verify_area((type == VERIFY_WRITE
-				    ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE),
-				   inode, file, file->f_pos, tot_len);
-	if (retval) {
-		if (iov != iovstack)
-			kfree(iov);
-		return retval;
-	}
-
-	/* Then do the actual IO.  Note that sockets need to be handled
-	 * specially as they have atomicity guarantees and can handle
-	 * iovec's natively
-	 */
-#ifdef CONFIG_NET
-	if (inode->i_sock) {
-		int err;
-		err = sock_readv_writev(type, inode, file, iov, count, tot_len);
-		if (iov != iovstack)
-			kfree(iov);
-		return err;
-	}
-#endif
-
-	if (!file->f_op) {
-		if (iov != iovstack)
-			kfree(iov);
-		return -EINVAL;
-	}
-	/* VERIFY_WRITE actually means a read, as we write to user space */
-	fn = file->f_op->read;
-	if (type == VERIFY_READ)
-		fn = (IO_fn_t) file->f_op->write;
-	ivp = iov;
-	while (count > 0) {
-		void * base;
-		int len, nr;
-
-		base = ivp->iov_base;
-		len = ivp->iov_len;
-		ivp++;
-		count--;
-		nr = fn(file, base, len, &file->f_pos);
-		if (nr < 0) {
-			if (retval)
-				break;
-			retval = nr;
-			break;
-		}
-		retval += nr;
-		if (nr != len)
-			break;
-	}
-	if (iov != iovstack)
-		kfree(iov);
-
-	return retval;
-}
-
-asmlinkage long
-sys32_readv(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct file *file;
-	ssize_t ret;
-
-	ret = -EBADF;
-	file = fget(fd);
-	if (!file)
-		goto bad_file;
-	if (file->f_op && (file->f_mode & FMODE_READ) &&
-	    (file->f_op->readv || file->f_op->read))
-		ret = do_readv_writev32(VERIFY_WRITE, file, vector, count);
-
-	fput(file);
-
-bad_file:
-	return ret;
-}
-
-asmlinkage long
-sys32_writev(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct file *file;
-	ssize_t ret;
-
-	ret = -EBADF;
-	file = fget(fd);
-	if(!file)
-		goto bad_file;
-	if (file->f_op && (file->f_mode & FMODE_WRITE) &&
-	    (file->f_op->writev || file->f_op->write))
-	        ret = do_readv_writev32(VERIFY_READ, file, vector, count);
-	fput(file);
-
-bad_file:
-	return ret;
-}
-
 /* From the Single Unix Spec: pread & pwrite act like lseek to pos + op +
    lseek back to original location.  They fail just like lseek does on
    non-seekable files.  */
@@ -885,167 +519,6 @@
 bad_file:
 	return ret;
 }
-/*
- * Ooo, nasty.  We need here to frob 32-bit unsigned longs to
- * 64-bit unsigned longs.
- */
-
-static inline int
-get_fd_set32(unsigned long n, unsigned long *fdset, u32 *ufdset)
-{
-	if (ufdset) {
-		unsigned long odd;
-
-		if (verify_area(VERIFY_WRITE, ufdset, n*sizeof(u32)))
-			return -EFAULT;
-
-		odd = n & 1UL;
-		n &= ~1UL;
-		while (n) {
-			unsigned long h, l;
-			__get_user(l, ufdset);
-			__get_user(h, ufdset+1);
-			ufdset += 2;
-			*fdset++ = h << 32 | l;
-			n -= 2;
-		}
-		if (odd)
-			__get_user(*fdset, ufdset);
-	} else {
-		/* Tricky, must clear full unsigned long in the
-		 * kernel fdset at the end, this makes sure that
-		 * actually happens.
-		 */
-		memset(fdset, 0, ((n + 1) & ~1)*sizeof(u32));
-	}
-	return 0;
-}
-
-static inline void
-set_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset)
-{
-	unsigned long odd;
-
-	if (!ufdset)
-		return;
-
-	odd = n & 1UL;
-	n &= ~1UL;
-	while (n) {
-		unsigned long h, l;
-		l = *fdset++;
-		h = l >> 32;
-		__put_user(l, ufdset);
-		__put_user(h, ufdset+1);
-		ufdset += 2;
-		n -= 2;
-	}
-	if (odd)
-		__put_user(*fdset, ufdset);
-}
-
-/*
- * We can actually return ERESTARTSYS instead of EINTR, but I'd
- * like to be certain this leads to no problems. So I return
- * EINTR just for safety.
- *
- * Update: ERESTARTSYS breaks at least the xview clock binary, so
- * I'm trying ERESTARTNOHAND which restart only when you want to.
- */
-#define MAX_SELECT_SECONDS \
-	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-
-asmlinkage int sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, struct compat_timeval *tvp)
-{
-	fd_set_bits fds;
-	char *bits;
-	unsigned long nn;
-	long timeout;
-	int ret, size;
-
-	timeout = MAX_SCHEDULE_TIMEOUT;
-	if (tvp) {
-		time_t sec, usec;
-
-		if ((ret = verify_area(VERIFY_READ, tvp, sizeof(*tvp)))
-		    || (ret = __get_user(sec, &tvp->tv_sec))
-		    || (ret = __get_user(usec, &tvp->tv_usec)))
-			goto out_nofds;
-
-		ret = -EINVAL;
-		if(sec < 0 || usec < 0)
-			goto out_nofds;
-
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
-			timeout = (usec + 1000000/HZ - 1) / (1000000/HZ);
-			timeout += sec * (unsigned long) HZ;
-		}
-	}
-
-	ret = -EINVAL;
-	if (n < 0)
-		goto out_nofds;
-	if (n > current->files->max_fdset)
-		n = current->files->max_fdset;
-
-	/*
-	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
-	 * since we used fdset we need to allocate memory in units of
-	 * long-words.
-	 */
-	ret = -ENOMEM;
-	size = FDS_BYTES(n);
-	bits = kmalloc(6 * size, GFP_KERNEL);
-	if (!bits)
-		goto out_nofds;
-	fds.in      = (unsigned long *)  bits;
-	fds.out     = (unsigned long *) (bits +   size);
-	fds.ex      = (unsigned long *) (bits + 2*size);
-	fds.res_in  = (unsigned long *) (bits + 3*size);
-	fds.res_out = (unsigned long *) (bits + 4*size);
-	fds.res_ex  = (unsigned long *) (bits + 5*size);
-
-	nn = (n + 8*sizeof(u32) - 1) / (8*sizeof(u32));
-	if ((ret = get_fd_set32(nn, fds.in, inp)) ||
-	    (ret = get_fd_set32(nn, fds.out, outp)) ||
-	    (ret = get_fd_set32(nn, fds.ex, exp)))
-		goto out;
-	zero_fd_set(n, fds.res_in);
-	zero_fd_set(n, fds.res_out);
-	zero_fd_set(n, fds.res_ex);
-
-	ret = do_select(n, &fds, &timeout);
-
-	if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
-		time_t sec = 0, usec = 0;
-		if (timeout) {
-			sec = timeout / HZ;
-			usec = timeout % HZ;
-			usec *= (1000000/HZ);
-		}
-		put_user(sec, &tvp->tv_sec);
-		put_user(usec, &tvp->tv_usec);
-	}
-
-	if (ret < 0)
-		goto out;
-	if (!ret) {
-		ret = -ERESTARTNOHAND;
-		if (signal_pending(current))
-			goto out;
-		ret = 0;
-	}
-
-	set_fd_set32(nn, inp, fds.res_in);
-	set_fd_set32(nn, outp, fds.res_out);
-	set_fd_set32(nn, exp, fds.res_ex);
-
-out:
-	kfree(bits);
-out_nofds:
-	return ret;
-}
-
 
 asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
 	struct compat_timespec *interval)
diff -Nru a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
--- a/arch/mips/kernel/mips_ksyms.c	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/kernel/mips_ksyms.c	Tue Jun 15 22:20:37 2004
@@ -33,6 +33,9 @@
 EXPORT_SYMBOL_NOVERS(memmove);
 EXPORT_SYMBOL_NOVERS(strcat);
 EXPORT_SYMBOL_NOVERS(strchr);
+#ifdef CONFIG_MIPS64
+EXPORT_SYMBOL_NOVERS(strncmp);
+#endif
 EXPORT_SYMBOL_NOVERS(strlen);
 EXPORT_SYMBOL_NOVERS(strpbrk);
 EXPORT_SYMBOL_NOVERS(strncat);
diff -Nru a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
--- a/arch/mips/kernel/process.c	Tue Jun 15 22:20:39 2004
+++ b/arch/mips/kernel/process.c	Tue Jun 15 22:20:39 2004
@@ -280,12 +280,6 @@
 	return ((unsigned long *)t->reg29)[schedule_frame.pc_offset];
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 /* get_wchan - a maintenance nightmare^W^Wpain in the ass ...  */
 unsigned long get_wchan(struct task_struct *p)
 {
@@ -297,7 +291,7 @@
 	if (!mips_frame_info_initialized)
 		return 0;
 	pc = thread_saved_pc(p);
-	if (pc < first_sched || pc >= last_sched)
+	if (!in_sched_functions(pc))
 		goto out;
 
 	if (pc >= (unsigned long) sleep_on_timeout)
@@ -331,7 +325,7 @@
 	 */
 	pc    = ((unsigned long *)frame)[schedule_timeout_frame.pc_offset];
 
-	if (pc >= first_sched && pc < last_sched) {
+	if (in_sched_functions(pc)) {
 		/* schedule_timeout called by [interruptible_]sleep_on_timeout */
 		frame = ((unsigned long *)frame)[schedule_timeout_frame.frame_offset];
 		pc    = ((unsigned long *)frame)[sleep_on_timeout_frame.pc_offset];
diff -Nru a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
--- a/arch/mips/kernel/ptrace.c	Tue Jun 15 22:21:05 2004
+++ b/arch/mips/kernel/ptrace.c	Tue Jun 15 22:21:05 2004
@@ -303,8 +303,17 @@
  * Notification of system call entry/exit
  * - triggered by current->work.syscall_trace
  */
-asmlinkage void do_syscall_trace(void)
+asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
 {
+	if (unlikely(current->audit_context)) {
+		if (!entryexit)
+			audit_syscall_entry(current, regs->orig_eax,
+			                    regs->regs[4], regs->regs[5],
+			                    regs->regs[6], regs->regs[7]);
+		else
+			audit_syscall_exit(current, regs->regs[2]);
+	}
+
 	if (!test_thread_flag(TIF_SYSCALL_TRACE))
 		return;
 	if (!(current->ptrace & PT_PTRACED))
diff -Nru a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
--- a/arch/mips/kernel/scall32-o32.S	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/kernel/scall32-o32.S	Tue Jun 15 22:20:37 2004
@@ -33,8 +33,8 @@
 
 	sltiu	t0, v0, MAX_SYSCALL_NO + 1 # check syscall number
 	addiu	t1, 4			# skip to next instruction
-	beqz	t0, illegal_syscall
 	sw	t1, PT_EPC(sp)
+	beqz	t0, illegal_syscall
 
 	/* XXX Put both in one cacheline, should save a bit. */
 	sll	t0, v0, 2
@@ -49,7 +49,7 @@
 stack_done:
 	sw	a3, PT_R26(sp)          # save for syscall restart
 	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
-	li	t1, _TIF_SYSCALL_TRACE
+	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
 	and	t0, t1, t0
 	bnez	t0, syscall_trace_entry	# -> yes
 
@@ -84,6 +84,8 @@
 syscall_trace_entry:
 	SAVE_STATIC
 	sw	t2, PT_R1(sp)
+	move	a0, sp
+	li	a1, 0
 	jal	do_syscall_trace
 	lw	t2, PT_R1(sp)
 
@@ -233,13 +235,15 @@
 
 	/* Success, so skip usual error handling garbage.  */
 	LONG_L	a2, TI_FLAGS($28)	# syscall tracing enabled?
-	li	t0, _TIF_SYSCALL_TRACE
+	li	t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
 	and	t0, a2, t0
 	bnez	t0, 1f
 
 	b	o32_syscall_exit
 
 1:	SAVE_STATIC
+	move	a0, sp
+	li	a1, 1
 	jal	do_syscall_trace
 	j	syscall_exit
 
@@ -614,6 +618,15 @@
 	sys	sys_clock_nanosleep	4	/* 4265 */
 	sys	sys_tgkill		3
 	sys	sys_utimes		2
+	sys	sys_ni_syscall		0	/* sys_mbind */
+	sys	sys_ni_syscall		0	/* sys_get_mempolicy */
+	sys	sys_ni_syscall		0	/* 4270 sys_set_mempolicy */
+	sys	sys_mq_open		4
+	sys	sys_mq_unlink		1
+	sys	sys_mq_timedsend	5
+	sys	sys_mq_timedreceive	5
+	sys	sys_mq_notify		2	/* 4275 */
+	sys	sys_mq_getsetattr	3
 
 	.endm
 
diff -Nru a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
--- a/arch/mips/kernel/scall64-64.S	Tue Jun 15 22:20:42 2004
+++ b/arch/mips/kernel/scall64-64.S	Tue Jun 15 22:20:42 2004
@@ -36,14 +36,16 @@
 	STI
 	.set	at
 #endif
-	ld	t1, PT_EPC(sp)		# skip syscall on return
 
 FEXPORT(__handle_sys64)
 	subu	t0, v0, __NR_64_Linux	# check syscall number
 	sltiu	t0, t0,	__NR_64_Linux_syscalls + 1
+#if !defined(CONFIG_MIPS32_O32) && !defined(CONFIG_MIPS32_N32)
+	ld	t1, PT_EPC(sp)		# skip syscall on return
 	daddiu	t1, 4			# skip to next instruction
-	beqz	t0, illegal_syscall
 	sd	t1, PT_EPC(sp)
+#endif
+	beqz	t0, illegal_syscall
 
 	dsll	t0, v0, 3		# offset into table
 	ld	t2, (sys_call_table - (__NR_64_Linux * 8))(t0)
@@ -85,6 +87,8 @@
 syscall_trace_entry:
 	SAVE_STATIC
 	sd	t2,PT_R1(sp)
+	move	a0, sp
+	li	a1, 0
 	jal	do_syscall_trace
 	ld	t2,PT_R1(sp)
 
@@ -165,13 +169,15 @@
 
 	/* Success, so skip usual error handling garbage.  */
 	LONG_L	a2, TI_FLAGS($28)	# syscall tracing enabled?
-	li	t0, _TIF_SYSCALL_TRACE
+	li	t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
 	and	t0, a2, t0
 	bnez	t0, 1f
 
 	b	syscall_exit
 
 1:	SAVE_STATIC
+	move	a0, sp
+	li	a1, 1
 	jal	do_syscall_trace
 	j	syscall_exit
 
@@ -244,7 +250,7 @@
 	PTR	sys_setitimer
 	PTR	sys_alarm
 	PTR	sys_getpid
-	PTR	sys_sendfile
+	PTR	sys_sendfile64
 	PTR	sys_socket			/* 5040 */
 	PTR	sys_connect
 	PTR	sys_accept
@@ -432,3 +438,12 @@
 	PTR	sys_clock_nanosleep
 	PTR	sys_tgkill			/* 5225 */
 	PTR	sys_utimes
+	PTR	sys_ni_syscall			/* sys_mbind */
+	PTR	sys_ni_syscall			/* sys_get_mempolicy */
+	PTR	sys_ni_syscall			/* sys_set_mempolicy */
+	PTR	sys_mq_open			/* 5230 */
+	PTR	sys_mq_unlink
+	PTR	sys_mq_timedsend
+	PTR	sys_mq_timedreceive
+	PTR	sys_mq_notify
+	PTR	sys_mq_getsetattr		/* 5235 */
diff -Nru a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
--- a/arch/mips/kernel/scall64-n32.S	Tue Jun 15 22:20:58 2004
+++ b/arch/mips/kernel/scall64-n32.S	Tue Jun 15 22:20:58 2004
@@ -36,21 +36,26 @@
 	STI
 	.set	at
 #endif
-	ld	t1, PT_EPC(sp)		# skip syscall on return
 
 	subu	t0, v0, __NR_N32_Linux	# check syscall number
 	sltiu	t0, t0,	__NR_N32_Linux_syscalls + 1
+
+#ifndef CONFIG_MIPS32_O32
+	ld	t1, PT_EPC(sp)		# skip syscall on return
 	daddiu	t1, 4			# skip to next instruction
-	beqz	t0, not_n32_scall
 	sd	t1, PT_EPC(sp)
+#endif
+	beqz	t0, not_n32_scall
 
 	dsll	t0, v0, 3		# offset into table
 	ld	t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0)
 
 	sd	a3, PT_R26(sp)		# save a3 for syscall restarting
 
+	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
 	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
-	bltz	t0, n32_syscall_trace_entry
+	and	t0, t1, t0
+	bnez	t0, n32_syscall_trace_entry
 
 	jalr	t2			# Do The Real Thing (TM)
 
@@ -82,6 +87,8 @@
 n32_syscall_trace_entry:
 	SAVE_STATIC
 	sd	t2,PT_R1(sp)
+	move	a0, sp
+	li	a1, 0
 	jal	do_syscall_trace
 	ld	t2,PT_R1(sp)
 
@@ -128,11 +135,11 @@
 	PTR	compat_sys_ioctl		/* 6015 */
 	PTR	sys_pread64
 	PTR	sys_pwrite64
-	PTR	sys32_readv
-	PTR	sys32_writev
+	PTR	compat_sys_readv
+	PTR	compat_sys_writev
 	PTR	sys_access			/* 6020 */
 	PTR	sys_pipe
-	PTR	sys32_select
+	PTR	compat_sys_select
 	PTR	sys_sched_yield
 	PTR	sys_mremap
 	PTR	sys_msync			/* 6025 */
@@ -341,3 +348,12 @@
 	PTR	sys_clock_nanosleep
 	PTR	sys_tgkill
 	PTR	compat_sys_utimes		/* 6230 */
+	PTR	sys_ni_syscall			/* sys_mbind */
+	PTR	sys_ni_syscall			/* sys_get_mempolicy */
+	PTR	sys_ni_syscall			/* sys_set_mempolicy */
+	PTR	compat_sys_mq_open
+	PTR	sys_mq_unlink			/* 6235 */
+	PTR	compat_sys_mq_timedsend
+	PTR	compat_sys_mq_timedreceive
+	PTR	compat_sys_mq_notify
+	PTR	compat_sys_mq_getsetattr	/* 6239 */
diff -Nru a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
--- a/arch/mips/kernel/scall64-o32.S	Tue Jun 15 22:20:35 2004
+++ b/arch/mips/kernel/scall64-o32.S	Tue Jun 15 22:20:35 2004
@@ -34,8 +34,8 @@
 	subu	t0, v0, __NR_O32_Linux	# check syscall number
 	sltiu	t0, t0, __NR_O32_Linux_syscalls + 1
 	daddiu	t1, 4			# skip to next instruction
-	beqz	t0, not_o32_scall
 	sd	t1, PT_EPC(sp)
+	beqz	t0, not_o32_scall
 #if 0
  SAVE_ALL
  move a1, v0
@@ -58,8 +58,9 @@
 	bgez	t0, stackargs
 
 stack_done:
-	LONG_L	t0, TI_FLAGS($28)
-					# syscall tracing enabled?
+	li	t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
+	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
+	and	t0, t1, t0
 	bnez	t0, trace_a_syscall
 
 	jalr	t2			# Do The Real Thing (TM)
@@ -97,6 +98,8 @@
 	sd	a7, PT_R11(sp)
 
 	sd	t2,PT_R1(sp)
+	move	a0, sp
+	li	a1, 0
 	jal	do_syscall_trace
 	ld	t2,PT_R1(sp)
 
@@ -397,11 +400,11 @@
 	sys	sys_setfsgid	1
 	sys	sys32_llseek	5			/* 4140 */
 	sys	sys32_getdents	3
-	sys	sys32_select	5
+	sys	compat_sys_select	5
 	sys	sys_flock	2
 	sys	sys_msync	3
-	sys	sys32_readv	3			/* 4145 */
-	sys	sys32_writev	3
+	sys	compat_sys_readv	3		/* 4145 */
+	sys	compat_sys_writev	3
 	sys	sys_cacheflush	3
 	sys	sys_cachectl	3
 	sys	sys_sysmips	4
@@ -523,6 +526,15 @@
 	sys	sys_clock_nanosleep	4		/* 4265 */
 	sys	sys_tgkill		3
 	sys	compat_sys_utimes	2
+	sys	sys_ni_syscall		0	/* sys_mbind */
+	sys	sys_ni_syscall		0	/* sys_get_mempolicy */
+	sys	sys_ni_syscall		0	/* 4270 sys_set_mempolicy */
+	sys	compat_sys_mq_open	4
+	sys	sys_mq_unlink		1
+	sys	compat_sys_mq_timedsend	5
+	sys	compat_sys_mq_timedreceive 5
+	sys	compat_sys_mq_notify	2	/* 4275 */
+	sys	compat_sys_mq_getsetattr 3
 
 	.endm
 
diff -Nru a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
--- a/arch/mips/kernel/signal.c	Tue Jun 15 22:20:43 2004
+++ b/arch/mips/kernel/signal.c	Tue Jun 15 22:20:43 2004
@@ -18,6 +18,7 @@
 #include <linux/errno.h>
 #include <linux/wait.h>
 #include <linux/ptrace.h>
+#include <linux/suspend.h>
 #include <linux/unistd.h>
 
 #include <asm/asm.h>
@@ -34,8 +35,6 @@
 
 extern asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs);
 
-extern asmlinkage void do_syscall_trace(void);
-
 /*
  * Atomically swap in the new signal mask, and wait for a signal.
  */
@@ -232,7 +231,7 @@
 	 * Don't let your children do this ...
 	 */
 	if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
-		do_syscall_trace();
+		do_syscall_trace(&regs, 1);
 	__asm__ __volatile__(
 		"move\t$29, %0\n\t"
 		"j\tsyscall_exit"
@@ -549,6 +548,19 @@
 	}
 #endif
 
+	/*
+	 * We want the common case to go fast, which is why we may in certain
+	 * cases get here from kernel mode. Just return without doing anything
+	 * if so.
+	 */
+	if (!user_mode(regs))
+		return 1;
+
+	if (current->flags & PF_FREEZE) {
+		refrigerator(0);
+		goto no_signal;
+	}
+
 	if (!oldset)
 		oldset = &current->blocked;
 
@@ -558,6 +570,7 @@
 		return 1;
 	}
 
+no_signal:
 	/*
 	 * Who's code doesn't conform to the restartable syscall convention
 	 * dies here!!!  The li instruction, a single machine instruction,
diff -Nru a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
--- a/arch/mips/kernel/signal32.c	Tue Jun 15 22:20:40 2004
+++ b/arch/mips/kernel/signal32.c	Tue Jun 15 22:20:40 2004
@@ -18,9 +18,11 @@
 #include <linux/wait.h>
 #include <linux/ptrace.h>
 #include <linux/compat.h>
+#include <linux/suspend.h>
 
 #include <asm/asm.h>
 #include <asm/bitops.h>
+#include <asm/cacheflush.h>
 #include <asm/sim.h>
 #include <asm/uaccess.h>
 #include <asm/ucontext.h>
@@ -40,8 +42,6 @@
 
 extern asmlinkage int do_signal32(sigset_t *oldset, struct pt_regs *regs);
 
-extern asmlinkage void do_syscall_trace(void);
-
 /* 32-bit compatibility types */
 
 #define _NSIG_BPW32	32
@@ -392,7 +392,7 @@
 	 * Don't let your children do this ...
 	 */
 	if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
-		do_syscall_trace();
+		do_syscall_trace(&regs, 1);
 	__asm__ __volatile__(
 		"move\t$29, %0\n\t"
 		"j\tsyscall_exit"
@@ -696,6 +696,19 @@
 	siginfo_t info;
 	int signr;
 
+	/*
+	 * We want the common case to go fast, which is why we may in certain
+	 * cases get here from kernel mode. Just return without doing anything
+	 * if so.
+	 */
+	if (!user_mode(regs))
+		return 1;
+
+	if (current->flags & PF_FREEZE) {
+		refrigerator(0);
+		goto no_signal;
+	}
+
 	if (!oldset)
 		oldset = &current->blocked;
 
@@ -705,6 +718,7 @@
 		return 1;
 	}
 
+no_signal:
 	/*
 	 * Who's code doesn't conform to the restartable syscall convention
 	 * dies here!!!  The li instruction, a single machine instruction,
diff -Nru a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
--- a/arch/mips/kernel/signal_n32.c	Tue Jun 15 22:20:41 2004
+++ b/arch/mips/kernel/signal_n32.c	Tue Jun 15 22:20:41 2004
@@ -29,6 +29,7 @@
 
 #include <asm/asm.h>
 #include <asm/bitops.h>
+#include <asm/cacheflush.h>
 #include <asm/sim.h>
 #include <asm/uaccess.h>
 #include <asm/ucontext.h>
diff -Nru a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
--- a/arch/mips/kernel/smp.c	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/kernel/smp.c	Tue Jun 15 22:20:37 2004
@@ -151,6 +151,9 @@
 	if (!cpus)
 		return 0;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data.func = func;
 	data.info = info;
 	atomic_set(&data.started, 0);
diff -Nru a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
--- a/arch/mips/kernel/sysirix.c	Tue Jun 15 22:21:02 2004
+++ b/arch/mips/kernel/sysirix.c	Tue Jun 15 22:21:02 2004
@@ -235,7 +235,7 @@
 #undef DEBUG_PROCGRPS
 
 extern unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt);
-extern int getrusage(struct task_struct *p, int who, struct rusage *ru);
+extern int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
 extern char *prom_getenv(char *name);
 extern long prom_setenv(char *name, char *value);
 
diff -Nru a/arch/mips/mm/init.c b/arch/mips/mm/init.c
--- a/arch/mips/mm/init.c	Tue Jun 15 22:20:43 2004
+++ b/arch/mips/mm/init.c	Tue Jun 15 22:20:43 2004
@@ -238,7 +238,7 @@
 		set_page_address(page, lowmem_page_address(page));
 #endif
 		set_bit(PG_highmem, &page->flags);
-		atomic_set(&page->count, 1);
+		set_page_count(page, 1);
 		__free_page(page);
 		totalhigh_pages++;
 	}
diff -Nru a/arch/mips/momentum/jaguar_atx/prom.c b/arch/mips/momentum/jaguar_atx/prom.c
--- a/arch/mips/momentum/jaguar_atx/prom.c	Tue Jun 15 22:21:05 2004
+++ b/arch/mips/momentum/jaguar_atx/prom.c	Tue Jun 15 22:21:05 2004
@@ -25,21 +25,11 @@
 #include <asm/addrspace.h>
 #include <asm/bootinfo.h>
 #include <asm/mv64340.h>
+#include <asm/pmon.h>
 
 #include "jaguar_atx_fpga.h"
 
 extern void ja_setup_console(void);
-
-struct callvectors {
-	int	(*open) (char*, int, int);		/*	 0 */
-	int	(*close) (int);				/*	 4 */
-	int	(*read) (int, void*, int);		/*	 8 */
-	int	(*write) (int, void*, int);		/*	12 */
-	off_t	(*lseek) (int, off_t, int);		/*	16 */
-	int	(*printf) (const char*, ...);		/*	20 */
-	void	(*cacheflush) (void);			/*	24 */
-	char*	(*gets) (char*);			/*	28 */
-};
 
 struct callvectors *debug_vectors;
 
diff -Nru a/arch/mips/momentum/ocelot_c/prom.c b/arch/mips/momentum/ocelot_c/prom.c
--- a/arch/mips/momentum/ocelot_c/prom.c	Tue Jun 15 22:20:40 2004
+++ b/arch/mips/momentum/ocelot_c/prom.c	Tue Jun 15 22:20:40 2004
@@ -23,19 +23,9 @@
 #include <asm/addrspace.h>
 #include <asm/bootinfo.h>
 #include <asm/mv64340.h>
+#include <asm/pmon.h>
 
 #include "ocelot_c_fpga.h"
-
-struct callvectors {
-	int	(*open) (char*, int, int);
-	int	(*close) (int);
-	int	(*read) (int, void*, int);
-	int	(*write) (int, void*, int);
-	off_t	(*lseek) (int, off_t, int);
-	int	(*printf) (const char*, ...);
-	void	(*cacheflush) (void);
-	char*	(*gets) (char*);
-};
 
 struct callvectors* debug_vectors;
 
diff -Nru a/arch/mips/momentum/ocelot_g/prom.c b/arch/mips/momentum/ocelot_g/prom.c
--- a/arch/mips/momentum/ocelot_g/prom.c	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/momentum/ocelot_g/prom.c	Tue Jun 15 22:20:37 2004
@@ -19,20 +19,10 @@
 
 #include <asm/addrspace.h>
 #include <asm/bootinfo.h>
+#include <asm/pmon.h>
 
 #include "gt64240.h"
 #include "ocelot_pld.h"
-
-struct callvectors {
-	int	(*open) (char*, int, int);
-	int	(*close) (int);
-	int	(*read) (int, void*, int);
-	int	(*write) (int, void*, int);
-	off_t	(*lseek) (int, off_t, int);
-	int	(*printf) (const char*, ...);
-	void	(*cacheflush) (void);
-	char*	(*gets) (char*);
-};
 
 struct callvectors* debug_vectors;
 
diff -Nru a/arch/mips/pci/fixup-au1000.c b/arch/mips/pci/fixup-au1000.c
--- a/arch/mips/pci/fixup-au1000.c	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/pci/fixup-au1000.c	Tue Jun 15 22:20:37 2004
@@ -37,22 +37,72 @@
 /*
  * Shortcut
  */
-#define INTA	AU1000_PCI_INTA
-#define INTB	AU1000_PCI_INTB
+#ifdef CONFIG_SOC_AU1500
+#define INTA AU1000_PCI_INTA
+#define INTB AU1000_PCI_INTB
+#define INTC AU1000_PCI_INTC
+#define INTD AU1000_PCI_INTD
+#endif
+
+#ifdef CONFIG_SOC_AU1550
+#define INTA AU1550_PCI_INTA
+#define INTB AU1550_PCI_INTB
+#define INTC AU1550_PCI_INTC
+#define INTD AU1550_PCI_INTD
+#endif
+
+#define INTX    0xFF /* not valid */
+
+#ifdef CONFIG_MIPS_DB1500
+static char irq_tab_alchemy[][5] __initdata = {
+ [12] =	{ -1, INTA, INTX, INTX, INTX},   /* IDSEL 12 - HPT371   */
+ [13] =	{ -1, INTA, INTB, INTC, INTD},   /* IDSEL 13 - PCI slot */
+};
+#endif
+
+#ifdef CONFIG_MIPS_BOSPORUS
+static char irq_tab_alchemy[][5] __initdata = {
+ [11] =	{ -1, INTA, INTB, INTX, INTX},   /* IDSEL 11 - miniPCI  */
+ [12] =	{ -1, INTA, INTX, INTX, INTX},   /* IDSEL 12 - SN1741   */
+ [13] =	{ -1, INTA, INTB, INTC, INTD},   /* IDSEL 13 - PCI slot */
+};
+#endif
 
+#ifdef CONFIG_MIPS_MIRAGE
 static char irq_tab_alchemy[][5] __initdata = {
- [11] = { -1, INTA, INTA, INTA, INTA },
- [12] = { -1, INTA, INTA, INTA, INTA },
-#if defined( CONFIG_SOC_AU1550 )
- [13] = { -1, INTB, INTB, INTB, INTB }
+ [11] =	{ -1, INTD, INTX, INTX, INTX},   /* IDSEL 11 - SMI VGX */
+ [12] =	{ -1, INTX, INTX, INTC, INTX},   /* IDSEL 12 - PNX1300 */
+ [13] =	{ -1, INTA, INTB, INTX, INTX},   /* IDSEL 13 - miniPCI */
+};
+#endif
+
+#ifdef CONFIG_MIPS_DB1550
+static char irq_tab_alchemy[][5] __initdata = {
+ [11] =	{ -1, INTC, INTX, INTX, INTX},   /* IDSEL 11 - on-board HPT371    */
+ [12] =	{ -1, INTB, INTC, INTD, INTA},   /* IDSEL 12 - PCI slot 2 (left)  */
+ [13] =	{ -1, INTA, INTB, INTC, INTD},   /* IDSEL 13 - PCI slot 1 (right) */
+};
+#endif
+
+#ifdef CONFIG_MIPS_PB1500
+static char irq_tab_alchemy[][5] __initdata = {
+ [12] = { -1, INTA, INTX, INTX, INTX},   /* IDSEL 12 - HPT370   */
+ [13] = { -1, INTA, INTB, INTC, INTD},   /* IDSEL 13 - PCI slot */
+};
 #endif
+
+#ifdef CONFIG_MIPS_PB1550
+static char irq_tab_alchemy[][5] __initdata = {
+ [12] =	{ -1, INTB, INTC, INTD, INTA},   /* IDSEL 12 - PCI slot 2 (left)  */
+ [13] =	{ -1, INTA, INTB, INTC, INTD},   /* IDSEL 13 - PCI slot 1 (right) */
 };
+#endif
 
 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
 {
-	return irq_tab_alchemy[slot][pin];
+return irq_tab_alchemy[slot][pin];
 }
 
 struct pci_fixup pcibios_fixups[] __initdata = {
-	{ 0 }
+{ 0 }
 };
diff -Nru a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c
--- a/arch/mips/pci/ops-au1000.c	Tue Jun 15 22:21:03 2004
+++ b/arch/mips/pci/ops-au1000.c	Tue Jun 15 22:21:03 2004
@@ -33,89 +33,170 @@
 #include <linux/pci.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/vmalloc.h>
 
 #include <asm/mach-au1x00/au1000.h>
 
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(x...) printk(x)
+#else
+#define DBG(x...)
+#endif
+
 #define PCI_ACCESS_READ  0
 #define PCI_ACCESS_WRITE 1
 
 
+int (*board_pci_idsel)(unsigned int devsel, int assert);
+
+/* CP0 hazard avoidance. */
+#define BARRIER __asm__ __volatile__(".set noreorder\n\t" \
+				     "nop; nop; nop; nop;\t" \
+				     ".set reorder\n\t")
+
+void mod_wired_entry(int entry, unsigned long entrylo0,
+		unsigned long entrylo1, unsigned long entryhi,
+		unsigned long pagemask)
+{
+	unsigned long old_pagemask;
+	unsigned long old_ctx;
+
+	/* Save old context and create impossible VPN2 value */
+	old_ctx = read_c0_entryhi() & 0xff;
+	old_pagemask = read_c0_pagemask();
+	write_c0_index(entry);
+	BARRIER;
+	write_c0_pagemask(pagemask);
+	write_c0_entryhi(entryhi);
+	write_c0_entrylo0(entrylo0);
+	write_c0_entrylo1(entrylo1);
+	BARRIER;
+	tlb_write_indexed();
+	BARRIER;
+	write_c0_entryhi(old_ctx);
+	BARRIER;
+	write_c0_pagemask(old_pagemask);
+}
+
+struct vm_struct *pci_cfg_vm;
+static int pci_cfg_wired_entry;
+static int first_cfg = 1;
+unsigned long last_entryLo0, last_entryLo1;
+
 static int config_access(unsigned char access_type, struct pci_bus *bus,
-			 unsigned int devfn, unsigned char where,
+			 unsigned int dev_fn, unsigned char where,
 			 u32 * data)
 {
-	unsigned int device = PCI_SLOT(devfn);
-	unsigned int function = PCI_FUNC(devfn);
-	unsigned long config, status;
-	unsigned long cfg_addr;
+#if defined( CONFIG_SOC_AU1500 ) || defined( CONFIG_SOC_AU1550 )
+	unsigned int device = PCI_SLOT(dev_fn);
+	unsigned int function = PCI_FUNC(dev_fn);
+	unsigned long offset, status;
+	unsigned long cfg_base;
+	unsigned long flags;
+	int error = PCIBIOS_SUCCESSFUL;
+	unsigned long entryLo0, entryLo1;
 
 	if (device > 19) {
 		*data = 0xffffffff;
 		return -1;
 	}
 
-	au_writel(((0x2000 << 16) |
-		   (au_readl(Au1500_PCI_STATCMD) & 0xffff)),
-		  Au1500_PCI_STATCMD);
-	//au_writel(au_readl(Au1500_PCI_CFG) & ~PCI_ERROR, Au1500_PCI_CFG);
+	local_irq_save(flags);
+	au_writel(((0x2000 << 16) | (au_readl(Au1500_PCI_STATCMD) & 0xffff)),
+			Au1500_PCI_STATCMD);
 	au_sync_udelay(1);
 
-	/* setup the config window */
-	if (bus->number == 0) {
-		cfg_addr = (unsigned long) ioremap(Au1500_EXT_CFG |
-						   ((1 << device) << 11),
-						   0x00100000);
-	} else {
-		cfg_addr = (unsigned long) ioremap(Au1500_EXT_CFG_TYPE1 |
-						   (bus->
-						    number << 16) | (device
-								     <<
-								     11),
-						   0x00100000);
-	}
-
-	if (!cfg_addr)
-		panic(KERN_ERR "PCI unable to ioremap cfg space\n");
-
-	/* setup the lower bits of the 36 bit address */
-	config = cfg_addr | (function << 8) | (where & ~0x3);
-
-#if 1
-	if (access_type == PCI_ACCESS_WRITE) {
-		printk("cfg write:  ");
-	} else {
-		printk("cfg read:  ");
-	}
-	printk("devfn %x, device %x func %x  \n", devfn, device, function);
-	if (access_type == PCI_ACCESS_WRITE) {
-		printk("data %x\n", *data);
+	/*
+	 * We can't ioremap the entire pci config space because it's
+	 * too large. Nor can we call ioremap dynamically because some
+	 * device drivers use the pci config routines from within
+	 * interrupt handlers and that becomes a problem in get_vm_area().
+	 * We use one wired tlb to handle all config accesses for all
+	 * busses. To improve performance, if the current device
+	 * is the same as the last device accessed, we don't touch the
+	 * tlb.
+	 */
+	if (first_cfg) {
+		/* reserve a wired entry for pci config accesses */
+		first_cfg = 0;
+		pci_cfg_vm = get_vm_area(0x2000, 0);
+		if (!pci_cfg_vm)
+			panic (KERN_ERR "PCI unable to get vm area\n");
+		pci_cfg_wired_entry = read_c0_wired();
+		add_wired_entry(0, 0, (unsigned long)pci_cfg_vm->addr, PM_4K);
+		last_entryLo0  = last_entryLo1 = 0xffffffff;
+	}
+
+	/* Since the Au1xxx doesn't do the idsel timing exactly to spec,
+	 * many board vendors implement their own off-chip idsel, so call
+	 * it now.  If it doesn't succeed, may as well bail out at this point.
+	 */
+	if (board_pci_idsel) {
+		if (board_pci_idsel(device, 1) == 0) {
+			*data = 0xffffffff;
+			local_irq_restore(flags);
+			return -1;
+		}
+	}
+
+        /* setup the config window */
+        if (bus->number == 0) {
+                cfg_base = ((1<<device)<<11);
+        } else {
+                cfg_base = 0x80000000 | (bus->number<<16) | (device<<11);
+        }
+
+        /* setup the lower bits of the 36 bit address */
+        offset = (function << 8) | (where & ~0x3);
+	/* pick up any address that falls below the page mask */
+	offset |= cfg_base & ~PAGE_MASK;
+
+	/* page boundary */
+	cfg_base = cfg_base & PAGE_MASK;
+
+	entryLo0 = (6 << 26)  | (cfg_base >> 6) | (2 << 3) | 7;
+	entryLo1 = (6 << 26)  | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7;
+
+	if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) {
+		mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1,
+				(unsigned long)pci_cfg_vm->addr, PM_4K);
+		last_entryLo0 = entryLo0;
+		last_entryLo1 = entryLo1;
 	}
-#endif
 
 	if (access_type == PCI_ACCESS_WRITE) {
-		au_writel(*data, config);
+		au_writel(*data, (int)(pci_cfg_vm->addr + offset));
 	} else {
-		*data = au_readl(config);
+		*data = au_readl((int)(pci_cfg_vm->addr + offset));
 	}
 	au_sync_udelay(2);
 
-	/* unmap io space */
-	iounmap((void *) cfg_addr);
+	DBG("cfg_access %d bus->number %d dev %d at %x *data %x conf %x\n",
+			access_type, bus->number, device, where, *data, offset);
 
 	/* check master abort */
 	status = au_readl(Au1500_PCI_STATCMD);
-	if (status & (1 << 29)) {
-		printk("master abort\n");
+
+	if (status & (1<<29)) {
 		*data = 0xffffffff;
-		return -1;
+		error = -1;
+		DBG("Au1x Master Abort\n");
 	} else if ((status >> 28) & 0xf) {
-		printk("PCI ERR detected: status %x\n", status);
+		DBG("PCI ERR detected: status %x\n", status);
 		*data = 0xffffffff;
-		return -1;
-	} else {
-		printk("bios_successful: %x\n", *data);
-		return PCIBIOS_SUCCESSFUL;
+		error = -1;
+	}
+
+	/* Take away the idsel.
+	*/
+	if (board_pci_idsel) {
+		(void)board_pci_idsel(device, 0);
 	}
+
+	local_irq_restore(flags);
+	return error;
+#endif
 }
 
 static int read_config_byte(struct pci_bus *bus, unsigned int devfn,
diff -Nru a/arch/mips/sgi-ip27/ip27-hubio.c b/arch/mips/sgi-ip27/ip27-hubio.c
--- a/arch/mips/sgi-ip27/ip27-hubio.c	Tue Jun 15 22:20:43 2004
+++ b/arch/mips/sgi-ip27/ip27-hubio.c	Tue Jun 15 22:20:43 2004
@@ -166,18 +166,18 @@
 	REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, ii_iowa);
 }
 
-/**
+/*
  * hub_pio_init  -  PIO-related hub initalization
  *
  * @hub:	hubinfo structure for our hub
- **/
+ */
 void hub_pio_init(cnodeid_t cnode)
 {
 	nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
 	unsigned i;
 
 	/* initialize big window piomaps for this hub */
-	CLEAR_BITMAP(HUB_DATA(cnode)->h_bigwin_used, HUB_NUM_BIG_WINDOW);
+	bitmap_zero(HUB_DATA(cnode)->h_bigwin_used, HUB_NUM_BIG_WINDOW);
 	for (i = 0; i < HUB_NUM_BIG_WINDOW; i++)
 		IIO_ITTE_DISABLE(nasid, i);
 
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	Tue Jun 15 22:20:38 2004
+++ b/arch/mips/vr41xx/casio-e55/setup.c	Tue Jun 15 22:20:38 2004
@@ -35,7 +35,8 @@
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
 #ifdef CONFIG_SERIAL_8250
-	vr41xx_siu_init(SIU_RS232C, 0);
+	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
+	vr41xx_siu_init();
 #endif
 
 	return 0;
diff -Nru a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
--- a/arch/mips/vr41xx/common/icu.c	Tue Jun 15 22:20:36 2004
+++ b/arch/mips/vr41xx/common/icu.c	Tue Jun 15 22:20:36 2004
@@ -1,34 +1,23 @@
 /*
- * FILE NAME
- *	arch/mips/vr41xx/common/icu.c
+ *  icu.c, Interrupt Control Unit routines for the NEC VR4100 series.
  *
- * BRIEF MODULE DESCRIPTION
- *	Interrupt Control Unit routines for the NEC VR4100 series.
- *
- * Author: Yoichi Yuasa
- *         yyuasa@mvista.com or source@mvista.com
- *
- * Copyright 2001,2002 MontaVista Software 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.
- *
- *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.
+ *  Copyright (C) 2001-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:
@@ -90,6 +79,9 @@
 #define MSYSINT2REG	0x06
 #define MGIUINTHREG	0x08
 
+#define MDSIUINTREG	KSEG1ADDR(0x0f000096)
+ #define INTDSIU	0x0800
+
 #define SYSINT1_IRQ_TO_PIN(x)	((x) - SYSINT1_IRQ_BASE)	/* Pin 0-15 */
 #define SYSINT2_IRQ_TO_PIN(x)	((x) - SYSINT2_IRQ_BASE)	/* Pin 0-15 */
 
@@ -144,6 +136,18 @@
 	write_icu2(res, offset);
 
 	return res;
+}
+
+/*=======================================================================*/
+
+void vr41xx_enable_dsiuint(void)
+{
+	writew(INTDSIU, MDSIUINTREG);
+}
+
+void vr41xx_disable_dsiuint(void)
+{
+	writew(0, MDSIUINTREG);
 }
 
 /*=======================================================================*/
diff -Nru a/arch/mips/vr41xx/common/serial.c b/arch/mips/vr41xx/common/serial.c
--- a/arch/mips/vr41xx/common/serial.c	Tue Jun 15 22:20:39 2004
+++ b/arch/mips/vr41xx/common/serial.c	Tue Jun 15 22:20:39 2004
@@ -40,14 +40,8 @@
 #include <asm/io.h>
 #include <asm/vr41xx/vr41xx.h>
 
-/* VR4111 and VR4121 SIU Registers */
-#define SIURB_TYPE1		KSEG1ADDR(0x0c000000)
 #define SIUIRSEL_TYPE1		KSEG1ADDR(0x0c000008)
-
-/* VR4122, VR4131 and VR4133 SIU Registers */
-#define SIURB_TYPE2		KSEG1ADDR(0x0f000800)
 #define SIUIRSEL_TYPE2		KSEG1ADDR(0x0f000808)
-
  #define USE_RS232C		0x00
  #define USE_IRDA		0x01
  #define SIU_USES_IRDA		0x00
@@ -58,21 +52,24 @@
  #define TMICTX			0x10
  #define TMICMODE		0x20
 
-#define SIU_BASE_BAUD		1152000
+#define SIU_BASE_TYPE1		0x0c000000UL	/* VR4111 and VR4121 */
+#define SIU_BASE_TYPE2		0x0f000800UL	/* VR4122, VR4131 and VR4133 */
+#define SIU_SIZE		0x8UL
 
-/* VR4122 and VR4131 DSIU Registers */
-#define DSIURB			KSEG1ADDR(0x0f000820)
+#define SIU_BASE_BAUD		1152000
 
-#define MDSIUINTREG		KSEG1ADDR(0x0f000096)
- #define INTDSIU		0x0800
+/* 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_siu_ifselect(int interface, int module)
+void vr41xx_select_siu_interface(siu_interface_t interface,
+                                 irda_module_t module)
 {
-	u16 val = USE_RS232C;	/* Select RS-232C */
+	uint16_t val = USE_RS232C;	/* Select RS-232C */
 
 	/* Select IrDA */
 	if (interface == SIU_IRDA) {
@@ -86,6 +83,9 @@
 		case IRDA_HP:
 			val = IRDA_MODULE_HP;
 			break;
+		default:
+			printk(KERN_ERR "SIU: unknown IrDA module\n");
+			return;
 		}
 		val |= USE_IRDA | SIU_USES_IRDA;
 	}
@@ -101,45 +101,47 @@
 		writew(val, SIUIRSEL_TYPE2);
 		break;
 	default:
-		printk(KERN_INFO "Unexpected CPU of NEC VR4100 series\n");
+		printk(KERN_ERR "SIU: unsupported CPU of NEC VR4100 series\n");
 		break;
 	}
 }
 
-void __init vr41xx_siu_init(int interface, int module)
+void __init vr41xx_siu_init(void)
 {
 	struct uart_port port;
 
-	vr41xx_siu_ifselect(interface, module);
-
 	memset(&port, 0, sizeof(port));
 
 	port.line = vr41xx_serial_ports;
-	port.uartclk = SIU_BASE_BAUD;
+	port.uartclk = SIU_BASE_BAUD * 16;
 	port.irq = SIU_IRQ;
-	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
+	port.flags = UPF_RESOURCES | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
 	switch (current_cpu_data.cputype) {
 	case CPU_VR4111:
 	case CPU_VR4121:
-		port.membase = (char *)SIURB_TYPE1;
+		port.mapbase = SIU_BASE_TYPE1;
 		break;
 	case CPU_VR4122:
 	case CPU_VR4131:
 	case CPU_VR4133:
-		port.membase = (char *)SIURB_TYPE2;
+		port.mapbase = SIU_BASE_TYPE2;
 		break;
 	default:
-		panic("Unexpected CPU of NEC VR4100 series");
-		break;
+		printk(KERN_ERR "SIU: unsupported CPU of NEC VR4100 series\n");
+		return;
 	}
 	port.regshift = 0;
 	port.iotype = UPIO_MEM;
-	if (early_serial_setup(&port) != 0)
-		printk(KERN_ERR "SIU setup failed!\n");
-
-	vr41xx_supply_clock(SIU_CLOCK);
+	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;
+		}
+	}
 
-	vr41xx_serial_ports++;
+	printk(KERN_ERR "SIU: setup failed!\n");
 }
 
 void __init vr41xx_dsiu_init(void)
@@ -148,24 +150,29 @@
 
 	if (current_cpu_data.cputype != CPU_VR4122 &&
 	    current_cpu_data.cputype != CPU_VR4131 &&
-	    current_cpu_data.cputype != CPU_VR4133)
+	    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;
+	port.uartclk = DSIU_BASE_BAUD * 16;
 	port.irq = DSIU_IRQ;
-	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
-	port.membase = (char *)DSIURB;
+	port.flags = UPF_RESOURCES | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
+	port.mapbase = DSIU_BASE;
 	port.regshift = 0;
 	port.iotype = UPIO_MEM;
-	if (early_serial_setup(&port) != 0)
-		printk(KERN_ERR "DSIU setup failed!\n");
-
-	vr41xx_supply_clock(DSIU_CLOCK);
-
-	writew(INTDSIU, MDSIUINTREG);
+	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();
+			vr41xx_serial_ports++;
+			return;
+		}
+	}
 
-	vr41xx_serial_ports++;
+	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	Tue Jun 15 22:20:36 2004
+++ b/arch/mips/vr41xx/ibm-workpad/setup.c	Tue Jun 15 22:20:36 2004
@@ -35,7 +35,8 @@
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
 #ifdef CONFIG_SERIAL_8250
-	vr41xx_siu_init(SIU_RS232C, 0);
+	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
+	vr41xx_siu_init();
 #endif
 
 	return 0;
diff -Nru a/arch/mips/vr41xx/nec-eagle/setup.c b/arch/mips/vr41xx/nec-eagle/setup.c
--- a/arch/mips/vr41xx/nec-eagle/setup.c	Tue Jun 15 22:20:37 2004
+++ b/arch/mips/vr41xx/nec-eagle/setup.c	Tue Jun 15 22:20:37 2004
@@ -80,8 +80,9 @@
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
 #ifdef CONFIG_SERIAL_8250
+	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
+	vr41xx_siu_init();
 	vr41xx_dsiu_init();
-	vr41xx_siu_init(SIU_RS232C, 0);
 #endif
 
 #ifdef CONFIG_PCI
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	Tue Jun 15 22:20:38 2004
+++ b/arch/mips/vr41xx/tanbac-tb0226/setup.c	Tue Jun 15 22:20:38 2004
@@ -83,7 +83,10 @@
 	ioport_resource.start = IO_PORT_RESOURCE_START;
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
-	vr41xx_siu_init(SIU_RS232C, 0);
+#ifdef CONFIG_SERIAL_8250
+	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
+	vr41xx_siu_init();
+#endif
 
 #ifdef CONFIG_PCI
 	vr41xx_pciu_init(&pci_address_map);
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	Tue Jun 15 22:20:41 2004
+++ b/arch/mips/vr41xx/tanbac-tb0229/setup.c	Tue Jun 15 22:20:41 2004
@@ -87,8 +87,11 @@
 	ioport_resource.start = IO_PORT_RESOURCE_START;
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
-	vr41xx_siu_init(SIU_RS232C, 0);
+#ifdef CONFIG_SERIAL_8250
+	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
+	vr41xx_siu_init();
 	vr41xx_dsiu_init();
+#endif
 
 #ifdef CONFIG_PCI
 	vr41xx_pciu_init(&pci_address_map);
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	Tue Jun 15 22:20:42 2004
+++ b/arch/mips/vr41xx/victor-mpc30x/setup.c	Tue Jun 15 22:20:42 2004
@@ -84,7 +84,8 @@
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
 #ifdef CONFIG_SERIAL_8250
-	vr41xx_siu_init(SIU_RS232C, 0);
+	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
+	vr41xx_siu_init();
 #endif
 
 #ifdef CONFIG_PCI
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	Tue Jun 15 22:20:38 2004
+++ b/arch/mips/vr41xx/zao-capcella/setup.c	Tue Jun 15 22:20:38 2004
@@ -84,7 +84,8 @@
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
 #ifdef CONFIG_SERIAL_8250
-	vr41xx_siu_init(SIU_RS232C, 0);
+	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
+	vr41xx_siu_init();
 	vr41xx_dsiu_init();
 #endif
 
diff -Nru a/arch/parisc/Kconfig b/arch/parisc/Kconfig
--- a/arch/parisc/Kconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/parisc/Kconfig	Tue Jun 15 22:20:41 2004
@@ -51,25 +51,34 @@
 config PA7000
 	bool "PA7000/PA7100"
 	---help---
-	  This is the processor type of your CPU. This information is used for
-	  optimizing purposes.  In order to compile a kernel that can run on
-	  all PA CPUs (albeit not optimally fast), you can specify "PA7000"
-	  here.
+	  This is the processor type of your CPU.  This information is
+	  used for optimizing purposes.  In order to compile a kernel
+	  that can run on all 32-bit PA CPUs (albeit not optimally fast),
+	  you can specify "PA7000" here.
 
 	  Specifying "PA8000" here will allow you to select a 64-bit kernel
 	  which is required on some machines.
 
 config PA7100LC
-	bool "PA7100LC/PA7300LC"
+	bool "PA7100LC"
 	help
-	  Select this option for a 7100LC or 7300LC processor, as used
-	  in the 712, 715/Mirage, A180, B132, C160L and some other machines.
+	  Select this option for the PCX-L processor, as used in the
+	  712, 715/64, 715/80, 715/100, 715/100XC, 725/100, 743, 748,
+	  D200, D210, D300, D310 and E-class
 
 config PA7200
 	bool "PA7200"
 	help
-	  Select this option for the PCX-T' processor, as used in C110, D100
-	  and similar machines.
+	  Select this option for the PCX-T' processor, as used in the
+	  C100, C110, J100, J110, J210XC, D250, D260, D350, D360,
+	  K100, K200, K210, K220, K400, K410 and K420
+
+config PA7300LC
+	bool "PA7300LC"
+	help
+	  Select this option for the PCX-L2 processor, as used in the
+	  744, A180, B132L, B160L, B180L, C132L, C160L, C180L,
+	  D220, D230, D320 and D330.
 
 config PA8X00
 	bool "PA8000 and up"
@@ -81,14 +90,16 @@
 # Define implied options from the CPU selection here
 
 config PA20
-	bool
+	def_bool y
 	depends on PA8X00
-	default y
 
 config PA11
-	bool
-	depends on PA7000 || PA7100LC || PA7200
-	default y
+	def_bool y
+	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+
+config PREFETCH
+	def_bool y
+	depends on PA8X00
 
 config PARISC64
 	bool "64-bit kernel"
@@ -105,18 +116,6 @@
 
 config 64BIT
 	def_bool PARISC64
-
-config PDC_NARROW
-	bool "32-bit firmware"
-	depends on PARISC64
-	help
-	  This option will enable owners of C160, C180, C200, C240, C360, J280,
-	  J282, J2240 and some D/K/R class to run a 64bit kernel with their
-	  32bit PDC firmware.
-	
-	  Nobody should try this option unless they know what they are doing.
-	
-	  If unsure, say N.
 
 config SMP
 	bool "Symmetric multi-processing support"
diff -Nru a/arch/parisc/Makefile b/arch/parisc/Makefile
--- a/arch/parisc/Makefile	Tue Jun 15 22:20:59 2004
+++ b/arch/parisc/Makefile	Tue Jun 15 22:20:59 2004
@@ -16,7 +16,7 @@
 # Modified for PA-RISC Linux by Paul Lahaie, Alex deVries, 
 # Mike Shaver, Helge Deller and Martin K. Petersen
 #
-NM		= sh arch/parisc/nm
+NM		= sh $(srctree)/arch/parisc/nm
 ifdef CONFIG_PARISC64
 CROSS_COMPILE	:= hppa64-linux-
 UTS_MACHINE	:= parisc64
@@ -48,6 +48,7 @@
 cflags-$(CONFIG_PA7100)		+= -march=1.1 -mschedule=7100
 cflags-$(CONFIG_PA7200)		+= -march=1.1 -mschedule=7200
 cflags-$(CONFIG_PA7100LC)	+= -march=1.1 -mschedule=7100LC
+cflags-$(CONFIG_PA7300LC)	+= -march=1.1 -mschedule=7300
 cflags-$(CONFIG_PA8X00)		+= -march=2.0 -mschedule=8000
 
 head-y			:= arch/parisc/kernel/head.o 
diff -Nru a/arch/parisc/configs/712_defconfig b/arch/parisc/configs/712_defconfig
--- a/arch/parisc/configs/712_defconfig	Tue Jun 15 22:21:05 2004
+++ b/arch/parisc/configs/712_defconfig	Tue Jun 15 22:21:05 2004
@@ -142,6 +142,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+CONFIG_SCSI_FC_ATTRS=y
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_SCSI_AIC7XXX_OLD is not set
@@ -180,10 +186,6 @@
 #
 
 #
-# Macintosh device drivers
-#
-
-#
 # Networking support
 #
 CONFIG_NET=y
@@ -206,7 +208,6 @@
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
-CONFIG_INET_ECN=y
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -290,6 +291,8 @@
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
@@ -335,6 +338,7 @@
 CONFIG_INPUT_KEYBOARD=y
 # CONFIG_KEYBOARD_ATKBD is not set
 # 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_HIL_OLD is not set
@@ -342,6 +346,7 @@
 CONFIG_INPUT_MOUSE=y
 # CONFIG_MOUSE_PS2 is not set
 # CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_VSXXXAA is not set
 # CONFIG_MOUSE_HIL is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
@@ -385,11 +390,6 @@
 # CONFIG_LP_CONSOLE is not set
 # CONFIG_PPDEV is not set
 # CONFIG_TIPAR is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -401,7 +401,6 @@
 # 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
@@ -635,6 +634,7 @@
 # CONFIG_CRYPTO_CAST6 is not set
 # CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
 # CONFIG_CRYPTO_TEST is not set
 
 #
diff -Nru a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
--- a/arch/parisc/configs/a500_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/parisc/configs/a500_defconfig	Tue Jun 15 22:20:37 2004
@@ -27,7 +27,7 @@
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_EMBEDDED=y
-# CONFIG_KALLSYMS is not set
+CONFIG_KALLSYMS=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
@@ -78,6 +78,7 @@
 # PCMCIA/CardBus support
 #
 CONFIG_PCMCIA=m
+CONFIG_PCMCIA_DEBUG=y
 CONFIG_YENTA=m
 CONFIG_CARDBUS=y
 # CONFIG_I82092 is not set
@@ -129,6 +130,7 @@
 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_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=6144
 CONFIG_BLK_DEV_INITRD=y
@@ -163,6 +165,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -243,10 +251,6 @@
 #
 
 #
-# Macintosh device drivers
-#
-
-#
 # Networking support
 #
 CONFIG_NET=y
@@ -270,7 +274,6 @@
 # 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=m
 CONFIG_INET_ESP=m
@@ -348,7 +351,6 @@
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
@@ -504,6 +506,11 @@
 CONFIG_PCMCIA_HERMES=m
 CONFIG_AIRO_CS=m
 # 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
 
 #
@@ -512,6 +519,7 @@
 # CONFIG_TR is not set
 # CONFIG_NET_FC is not set
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -545,6 +553,8 @@
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
@@ -617,11 +627,6 @@
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 # CONFIG_LEGACY_PTYS is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -633,7 +638,6 @@
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
-# CONFIG_NVRAM is not set
 CONFIG_GEN_RTC=y
 CONFIG_GEN_RTC_X=y
 # CONFIG_DTLK is not set
@@ -682,7 +686,6 @@
 # Console display driver support
 #
 # CONFIG_MDA_CONSOLE is not set
-# CONFIG_STI_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE_COLUMNS=160
 CONFIG_DUMMY_CONSOLE_ROWS=64
 CONFIG_DUMMY_CONSOLE=y
@@ -788,7 +791,8 @@
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=m
 CONFIG_SUNRPC=m
-# CONFIG_SUNRPC_GSS is not set
+CONFIG_SUNRPC_GSS=m
+CONFIG_RPCSEC_GSS_KRB5=m
 CONFIG_SMB_FS=m
 CONFIG_SMB_NLS_DEFAULT=y
 CONFIG_SMB_NLS_REMOTE="cp437"
@@ -887,6 +891,7 @@
 CONFIG_CRYPTO_CAST6=m
 # CONFIG_CRYPTO_ARC4 is not set
 CONFIG_CRYPTO_DEFLATE=m
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
 CONFIG_CRYPTO_TEST=m
 
 #
diff -Nru a/arch/parisc/configs/b180_defconfig b/arch/parisc/configs/b180_defconfig
--- a/arch/parisc/configs/b180_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/parisc/configs/b180_defconfig	Tue Jun 15 22:20:37 2004
@@ -121,6 +121,7 @@
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_CRYPTOLOOP=y
 # CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_CARMEL=y
 # CONFIG_BLK_DEV_RAM is not set
 
 #
@@ -153,6 +154,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -245,10 +252,6 @@
 # CONFIG_I2O is not set
 
 #
-# Macintosh device drivers
-#
-
-#
 # Networking support
 #
 CONFIG_NET=y
@@ -271,7 +274,6 @@
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
-CONFIG_INET_ECN=y
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -376,6 +378,10 @@
 #
 # CONFIG_AIRO is not set
 # CONFIG_HERMES is not set
+
+#
+# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
+#
 CONFIG_NET_WIRELESS=y
 
 #
@@ -403,6 +409,8 @@
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
@@ -449,6 +457,7 @@
 CONFIG_INPUT_KEYBOARD=y
 # CONFIG_KEYBOARD_ATKBD is not set
 # 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_HIL_OLD is not set
@@ -459,6 +468,7 @@
 # CONFIG_MOUSE_INPORT is not set
 # CONFIG_MOUSE_LOGIBM is not set
 # CONFIG_MOUSE_PC110PAD is not set
+# CONFIG_MOUSE_VSXXXAA is not set
 # CONFIG_MOUSE_HIL is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
@@ -502,11 +512,6 @@
 # CONFIG_LP_CONSOLE is not set
 # CONFIG_PPDEV is not set
 # CONFIG_TIPAR is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -518,7 +523,6 @@
 # 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
@@ -768,6 +772,7 @@
 # CONFIG_CRYPTO_CAST6 is not set
 # CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
 # CONFIG_CRYPTO_TEST is not set
 
 #
diff -Nru a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
--- a/arch/parisc/configs/c3000_defconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/parisc/configs/c3000_defconfig	Tue Jun 15 22:20:41 2004
@@ -77,6 +77,7 @@
 # PCMCIA/CardBus support
 #
 CONFIG_PCMCIA=m
+CONFIG_PCMCIA_DEBUG=y
 CONFIG_YENTA=m
 CONFIG_CARDBUS=y
 # CONFIG_I82092 is not set
@@ -128,6 +129,7 @@
 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_RAM is not set
 
 #
@@ -213,6 +215,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -230,6 +238,7 @@
 CONFIG_SCSI_SATA_PROMISE=m
 CONFIG_SCSI_SATA_SIL=m
 CONFIG_SCSI_SATA_VIA=m
+# 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
@@ -304,10 +313,6 @@
 # CONFIG_I2O is not set
 
 #
-# Macintosh device drivers
-#
-
-#
 # Networking support
 #
 CONFIG_NET=y
@@ -331,7 +336,6 @@
 # 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=m
 CONFIG_INET_ESP=m
@@ -409,7 +413,6 @@
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
@@ -543,6 +546,7 @@
 # CONFIG_NET_FC is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -576,6 +580,8 @@
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
@@ -619,6 +625,7 @@
 CONFIG_INPUT_KEYBOARD=y
 # CONFIG_KEYBOARD_ATKBD is not set
 # 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_HIL_OLD is not set
@@ -626,6 +633,7 @@
 CONFIG_INPUT_MOUSE=y
 # CONFIG_MOUSE_PS2 is not set
 # CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_VSXXXAA is not set
 # CONFIG_MOUSE_HIL is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
@@ -663,11 +671,6 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -679,7 +682,6 @@
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
-# CONFIG_NVRAM is not set
 CONFIG_GEN_RTC=y
 CONFIG_GEN_RTC_X=y
 # CONFIG_DTLK is not set
@@ -831,7 +833,9 @@
 CONFIG_USB_WACOM=m
 CONFIG_USB_KBTAB=m
 # CONFIG_USB_POWERMATE is not set
+# CONFIG_USB_MTOUCH is not set
 # CONFIG_USB_XPAD is not set
+# CONFIG_USB_ATI_REMOTE is not set
 
 #
 # USB Imaging devices
@@ -968,7 +972,7 @@
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -1065,6 +1069,7 @@
 CONFIG_CRYPTO_CAST6=m
 # CONFIG_CRYPTO_ARC4 is not set
 CONFIG_CRYPTO_DEFLATE=m
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
 CONFIG_CRYPTO_TEST=m
 
 #
diff -Nru a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
--- a/arch/parisc/kernel/Makefile	Tue Jun 15 22:20:38 2004
+++ b/arch/parisc/kernel/Makefile	Tue Jun 15 22:20:38 2004
@@ -14,7 +14,7 @@
 		   pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \
 		   ptrace.o hardware.o inventory.o drivers.o semaphore.o \
 		   signal.o hpmc.o real2.o parisc_ksyms.o unaligned.o \
-		   process.o processor.o pdc_cons.o pdc_chassis.o
+		   process.o processor.o pdc_cons.o pdc_chassis.o unwind.o
 
 obj-$(CONFIG_SMP)	+= smp.o
 obj-$(CONFIG_PA11)	+= pci-dma.o
diff -Nru a/arch/parisc/kernel/asm-offsets.c b/arch/parisc/kernel/asm-offsets.c
--- a/arch/parisc/kernel/asm-offsets.c	Tue Jun 15 22:20:37 2004
+++ b/arch/parisc/kernel/asm-offsets.c	Tue Jun 15 22:20:37 2004
@@ -32,6 +32,7 @@
 #include <linux/thread_info.h>
 #include <linux/version.h>
 #include <linux/ptrace.h>
+#include <asm/pgtable.h>
 
 #include <asm/ptrace.h>
 #include <asm/processor.h>
@@ -275,6 +276,20 @@
 	BLANK();
 	DEFINE(PA_BLOCKSTEP_BIT, 31-PT_BLOCKSTEP_BIT);
 	DEFINE(PA_SINGLESTEP_BIT, 31-PT_SINGLESTEP_BIT);
+	BLANK();
+	DEFINE(ASM_PMD_SHIFT, PMD_SHIFT);
+	DEFINE(ASM_PGDIR_SHIFT, PGDIR_SHIFT);
+	DEFINE(ASM_BITS_PER_PGD, BITS_PER_PGD);
+	DEFINE(ASM_BITS_PER_PMD, BITS_PER_PMD);
+	DEFINE(ASM_BITS_PER_PTE, BITS_PER_PTE);
+	DEFINE(ASM_PGD_PMD_OFFSET, -(PAGE_SIZE << PGD_ORDER));
+	DEFINE(ASM_PMD_ENTRY, ((PAGE_OFFSET & PMD_MASK) >> PMD_SHIFT));
+	DEFINE(ASM_PGD_ENTRY, PAGE_OFFSET >> PGDIR_SHIFT);
+	DEFINE(ASM_PGD_ENTRY_SIZE, PGD_ENTRY_SIZE);
+	DEFINE(ASM_PMD_ENTRY_SIZE, PMD_ENTRY_SIZE);
+	DEFINE(ASM_PTE_ENTRY_SIZE, PTE_ENTRY_SIZE);
+	DEFINE(ASM_PT_INITIAL, PT_INITIAL);
+	DEFINE(ASM_PAGE_SIZE, PAGE_SIZE);
 	BLANK();
 	return 0;
 }
diff -Nru a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
--- a/arch/parisc/kernel/cache.c	Tue Jun 15 22:20:39 2004
+++ b/arch/parisc/kernel/cache.c	Tue Jun 15 22:20:39 2004
@@ -17,6 +17,7 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/seq_file.h>
+#include <linux/pagemap.h>
 
 #include <asm/pdc.h>
 #include <asm/cache.h>
@@ -230,68 +231,45 @@
 void __flush_dcache_page(struct page *page)
 {
 	struct address_space *mapping = page_mapping(page);
-	struct mm_struct *mm = current->active_mm;
-	struct list_head *l;
+	struct vm_area_struct *mpnt = NULL;
+	struct prio_tree_iter iter;
+	unsigned long offset;
+	unsigned long addr;
+	pgoff_t pgoff;
 
 	flush_kernel_dcache_page(page_address(page));
 
 	if (!mapping)
 		return;
-	/* check shared list first if it's not empty...it's usually
-	 * the shortest */
-	list_for_each(l, &mapping->i_mmap_shared) {
-		struct vm_area_struct *mpnt;
-		unsigned long off;
-
-		mpnt = list_entry(l, struct vm_area_struct, shared);
-
-		/*
-		 * If this VMA is not in our MM, we can ignore it.
-		 */
-		if (mpnt->vm_mm != mm)
-			continue;
-
-		if (page->index < mpnt->vm_pgoff)
-			continue;
-
-		off = page->index - mpnt->vm_pgoff;
-		if (off >= (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT)
-			continue;
-
-		flush_cache_page(mpnt, mpnt->vm_start + (off << PAGE_SHIFT));
-
-		/* All user shared mappings should be equivalently mapped,
-		 * so once we've flushed one we should be ok
-		 */
-		return;
-	}
-
-	/* then check private mapping list for read only shared mappings
-	 * which are flagged by VM_MAYSHARE */
-	list_for_each(l, &mapping->i_mmap) {
-		struct vm_area_struct *mpnt;
-		unsigned long off;
-
-		mpnt = list_entry(l, struct vm_area_struct, shared);
 
+	pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
 
-		if (mpnt->vm_mm != mm || !(mpnt->vm_flags & VM_MAYSHARE))
-			continue;
-
-		if (page->index < mpnt->vm_pgoff)
-			continue;
+	/* We have carefully arranged in arch_get_unmapped_area() that
+	 * *any* mappings of a file are always congruently mapped (whether
+	 * declared as MAP_PRIVATE or MAP_SHARED), so we only need
+	 * to flush one address here for them all to become coherent */
+
+	flush_dcache_mmap_lock(mapping);
+	while ((mpnt = vma_prio_tree_next(mpnt, &mapping->i_mmap,
+					&iter, pgoff, pgoff)) != NULL) {
+		offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
+		addr = mpnt->vm_start + offset;
+
+		/* Flush instructions produce non access tlb misses.
+		 * On PA, we nullify these instructions rather than
+		 * taking a page fault if the pte doesn't exist.
+		 * This is just for speed.  If the page translation
+		 * isn't there, there's no point exciting the
+		 * nadtlb handler into a nullification frenzy */
 
-		off = page->index - mpnt->vm_pgoff;
-		if (off >= (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT)
+		if (!translation_exists(mpnt, addr))
 			continue;
 
-		flush_cache_page(mpnt, mpnt->vm_start + (off << PAGE_SHIFT));
+		__flush_cache_page(mpnt, addr);
 
-		/* All user shared mappings should be equivalently mapped,
-		 * so once we've flushed one we should be ok
-		 */
 		break;
 	}
+	flush_dcache_mmap_unlock(mapping);
 }
 EXPORT_SYMBOL(__flush_dcache_page);
 
diff -Nru a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
--- a/arch/parisc/kernel/entry.S	Tue Jun 15 22:20:37 2004
+++ b/arch/parisc/kernel/entry.S	Tue Jun 15 22:20:37 2004
@@ -40,11 +40,13 @@
 #ifdef __LP64__
 #define CMPIB           cmpib,*
 #define CMPB            cmpb,*
+#define COND(x)		*x
 
 	.level 2.0w
 #else
 #define CMPIB           cmpib,
 #define CMPB            cmpb,
+#define COND(x)		x
 
 	.level 2.0
 #endif
@@ -389,6 +391,228 @@
 	.align		32
 	.endm
 
+	/* The following are simple 32 vs 64 bit instruction
+	 * abstractions for the macros */
+	.macro		EXTR	reg1,start,length,reg2
+#ifdef __LP64__
+	extrd,u		\reg1,32+\start,\length,\reg2
+#else
+	extrw,u		\reg1,\start,\length,\reg2
+#endif
+	.endm
+
+	.macro		DEP	reg1,start,length,reg2
+#ifdef __LP64__
+	depd		\reg1,32+\start,\length,\reg2
+#else
+	depw		\reg1,\start,\length,\reg2
+#endif
+	.endm
+
+	.macro		DEPI	val,start,length,reg
+#ifdef __LP64__
+	depdi		\val,32+\start,\length,\reg
+#else
+	depwi		\val,\start,\length,\reg
+#endif
+	.endm
+
+	/* In LP64, the space contains part of the upper 32 bits of the
+	 * fault.  We have to extract this and place it in the va,
+	 * zeroing the corresponding bits in the space register */
+	.macro		space_adjust	spc,va,tmp
+#ifdef __LP64__
+	extrd,u		\spc,63,SPACEID_SHIFT,\tmp
+	depd		%r0,63,SPACEID_SHIFT,\spc
+	depd		\tmp,31,SPACEID_SHIFT,\va
+#endif
+	.endm
+
+	.import		swapper_pg_dir,code
+
+	/* Get the pgd.  For faults on space zero (kernel space), this
+	 * is simply swapper_pg_dir.  For user space faults, the
+	 * pgd is stored in %cr25 */
+	.macro		get_pgd		spc,reg
+	ldil		L%PA(swapper_pg_dir),\reg
+	ldo		R%PA(swapper_pg_dir)(\reg),\reg
+	or,COND(=)	%r0,\spc,%r0
+	mfctl		%cr25,\reg
+	.endm
+
+	/* Only allow faults on different spaces from the
+	 * currently active one if we're the kernel */
+	.macro		space_check	spc,tmp,fault
+	mfsp		%sr7,\tmp
+	or,COND(<>)	%r0,\spc,%r0	/* user may execute gateway page
+					 * as kernel, so defeat the space
+					 * check if it is */
+	copy		\spc,\tmp
+	or,COND(=)	%r0,\tmp,%r0	/* nullify if executing as kernel */
+	cmpb,COND(<>),n	\tmp,\spc,\fault
+	.endm
+
+	/* Look up a PTE in a 2-Level scheme (faulting at each
+	 * level if the entry isn't present 
+	 *
+	 * NOTE: we use ldw even for LP64 because our pte
+	 * and pmd are allocated <4GB */
+	.macro		L2_ptep	pmd,pte,index,va,fault
+#if PT_NLEVELS == 3
+	EXTR		\va,31-ASM_PMD_SHIFT,ASM_BITS_PER_PMD,\index
+#else
+	EXTR		\va,31-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
+#endif
+	DEP		%r0,31,PAGE_SHIFT,\pmd	/* clear offset */
+	copy		%r0,\pte
+	ldw,s		\index(\pmd),\pmd
+	EXTR		\va,31-PAGE_SHIFT,ASM_BITS_PER_PTE,\index
+	bb,>=,n		\pmd,_PAGE_PRESENT_BIT,\fault
+	DEP		%r0,31,PAGE_SHIFT,\pmd	/* clear offset */
+	shladd		\index,BITS_PER_PTE_ENTRY,\pmd,\pmd
+	LDREG		%r0(\pmd),\pte		/* pmd is now pte */
+	bb,>=,n		\pte,_PAGE_PRESENT_BIT,\fault
+	.endm
+
+	/* Look up PTE in a 3-Level scheme.
+	 *
+	 * Here we implement a Hybrid L2/L3 scheme: we allocate the
+	 * first pmd adjacent to the pgd.  This means that we can
+	 * subtract a constant offset to get to it.  The pmd and pgd
+	 * sizes are arranged so that a single pmd covers 4GB (giving
+	 * a full LP64 process access to 8TB) so our lookups are
+	 * effectively L2 for the first 4GB of the kernel (i.e. for
+	 * all ILP32 processes and all the kernel for machines with
+	 * under 4GB of memory) */
+	.macro		L3_ptep pgd,pte,index,va,fault
+	extrd,u		\va,63-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
+	copy		%r0,\pte
+	extrd,u,*=	\va,31,32,%r0
+	ldw,s		\index(\pgd),\pgd
+	extrd,u,*<>	\va,31,32,%r0
+	ldo		ASM_PGD_PMD_OFFSET(\pgd),\pgd
+	extrd,u,*=	\va,31,32,%r0
+	bb,>=,n		\pgd,_PAGE_PRESENT_BIT,\fault
+	L2_ptep		\pgd,\pte,\index,\va,\fault
+	.endm
+
+	/* Set the _PAGE_ACCESSED bit of the PTE.  Be clever and
+	 * don't needlessly dirty the cache line if it was already set */
+	.macro		update_ptep	ptep,pte,tmp,tmp1
+	ldi		_PAGE_ACCESSED,\tmp1
+	or		\tmp1,\pte,\tmp
+	and,COND(<>)	\tmp1,\pte,%r0
+	STREG		\tmp,0(\ptep)
+	.endm
+
+	/* Set the dirty bit (and accessed bit).  No need to be
+	 * clever, this is only used from the dirty fault */
+	.macro		update_dirty	ptep,pte,tmp,tmp1
+	ldi		_PAGE_ACCESSED|_PAGE_DIRTY,\tmp
+	or		\tmp,\pte,\pte
+	STREG		\pte,0(\ptep)
+	.endm
+
+	/* Convert the pte and prot to tlb insertion values.  How
+	 * this happens is quite subtle, read below */
+	.macro		make_insert_tlb	spc,pte,prot
+	space_to_prot   \spc \prot        /* create prot id from space */
+	/* The following is the real subtlety.  This is depositing
+	 * T <-> _PAGE_REFTRAP
+	 * D <-> _PAGE_DIRTY
+	 * B <-> _PAGE_DMB (memory break)
+	 *
+	 * Then incredible subtlety: The access rights are
+	 * _PAGE_GATEWAY _PAGE_EXEC _PAGE_READ
+	 * See 3-14 of the parisc 2.0 manual
+	 *
+	 * Finally, _PAGE_READ goes in the top bit of PL1 (so we
+	 * trigger an access rights trap in user space if the user
+	 * tries to read an unreadable page */
+	depd            \pte,8,7,\prot
+
+	/* PAGE_USER indicates the page can be read with user privileges,
+	 * so deposit X1|11 to PL1|PL2 (remember the upper bit of PL1
+	 * contains _PAGE_READ */
+	extrd,u,*=      \pte,_PAGE_USER_BIT+32,1,%r0
+	depdi		7,11,3,\prot
+	/* If we're a gateway page, drop PL2 back to zero for promotion
+	 * to kernel privilege (so we can execute the page as kernel).
+	 * Any privilege promotion page always denys read and write */
+	extrd,u,*= 	\pte,_PAGE_GATEWAY_BIT+32,1,%r0
+	depd		%r0,11,2,\prot	/* If Gateway, Set PL2 to 0 */
+
+	/* Get rid of prot bits and convert to page addr for iitlbt */
+
+	depd		%r0,63,PAGE_SHIFT,\pte
+	extrd,u		\pte,56,32,\pte
+	.endm
+
+	/* Identical macro to make_insert_tlb above, except it
+	 * makes the tlb entry for the differently formatted pa11
+	 * insertion instructions */
+	.macro		make_insert_tlb_11	spc,pte,prot
+	zdep		\spc,30,15,\prot
+	dep		\pte,8,7,\prot
+	extru,=		\pte,_PAGE_NO_CACHE_BIT,1,%r0
+	depi		1,12,1,\prot
+	extru,=         \pte,_PAGE_USER_BIT,1,%r0
+	depi		7,11,3,\prot   /* Set for user space (1 rsvd for read) */
+	extru,= 	\pte,_PAGE_GATEWAY_BIT,1,%r0
+	depi		0,11,2,\prot	/* If Gateway, Set PL2 to 0 */
+
+	/* Get rid of prot bits and convert to page addr for iitlba */
+
+	depi		0,31,12,\pte
+	extru		\pte,24,25,\pte
+
+	.endm
+
+	/* This is for ILP32 PA2.0 only.  The TLB insertion needs
+	 * to extend into I/O space if the address is 0xfXXXXXXX
+	 * so we extend the f's into the top word of the pte in
+	 * this case */
+	.macro		f_extend	pte,tmp
+	extrd,s		\pte,42,4,\tmp
+	addi,<>		1,\tmp,%r0
+	extrd,s		\pte,63,25,\pte
+	.endm
+
+	/* The alias region is an 8MB aligned 16MB to do clear and
+	 * copy user pages at addresses congruent with the user
+	 * virtual address.
+	 *
+	 * To use the alias page, you set %r26 up with the to TLB
+	 * entry (identifying the physical page) and %r23 up with
+	 * the from tlb entry (or nothing if only a to entry---for
+	 * clear_user_page_asm) */
+	.macro		do_alias	spc,tmp,tmp1,va,pte,prot,fault
+	cmpib,COND(<>),n 0,\spc,\fault
+	ldil		L%(TMPALIAS_MAP_START),\tmp
+#if defined(__LP64__) && (TMPALIAS_MAP_START >= 0x80000000)
+	/* on LP64, ldi will sign extend into the upper 32 bits,
+	 * which is behaviour we don't want */
+	depdi		0,31,32,\tmp
+#endif
+	copy		\va,\tmp1
+	DEPI		0,31,23,\tmp1
+	cmpb,COND(<>),n	\tmp,\tmp1,\fault
+	ldi		(_PAGE_DIRTY|_PAGE_WRITE|_PAGE_READ),\prot
+	depd,z		\prot,8,7,\prot
+	/*
+	 * OK, it is in the temp alias region, check whether "from" or "to".
+	 * Check "subtle" note in pacache.S re: r23/r26.
+	 */
+#ifdef __LP64__
+	extrd,u,*=	\va,41,1,%r0
+#else
+	extrw,u,=	\va,9,1,%r0
+#endif
+	or,COND(tr)	%r23,%r0,\pte
+	or		%r26,%r0,\pte
+	.endm 
+
+
 	/*
 	 * Align fault_vector_20 on 4K boundary so that both
 	 * fault_vector_11 and fault_vector_20 are on the
@@ -979,82 +1203,23 @@
 #ifdef __LP64__
 
 dtlb_miss_20w:
-	extrd,u         spc,63,7,t1     /* adjust va */
-	depd            t1,31,7,va      /* adjust va */
-	depdi           0,63,7,spc      /* adjust space */
-	mfctl           %cr25,ptp	/* Assume user space miss */
-	or,*<>          %r0,spc,%r0     /* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extrd,u         va,33,9,t1      /* Get pgd index */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,*=           %r0,t0,%r0      /* If kernel, nullify following test */
-	cmpb,*<>,n       t0,spc,dtlb_fault /* forward */
-
-	/* First level page table lookup */
-
-	ldd,s           t1(ptp),ptp
-	extrd,u         va,42,9,t0     /* get second-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,dtlb_check_alias_20w
-	depdi           0,63,12,ptp     /* clear prot bits */
-
-	/* Second level page table lookup */
-
-	ldd,s           t0(ptp),ptp
-	extrd,u         va,51,9,t0     /* get third-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,dtlb_check_alias_20w
-	depdi           0,63,12,ptp     /* clear prot bits */
-
-	/* Third level page table lookup */
-
-	shladd           t0,3,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldd              0(ptp),pte
-	bb,>=,n          pte,_PAGE_PRESENT_BIT,dtlb_check_alias_20w
-
-	/* Check whether the "accessed" bit was set, otherwise do so */
-
-	or		t1,pte,t0	/* t0 has R bit set */
-	and,*<>         t1,pte,%r0      /* test and nullify if already set */
-	std             t0,0(ptp)       /* write back pte */
-
-	space_to_prot   spc prot        /* create prot id from space */
-	depd            pte,8,7,prot    /* add in prot bits from pte */
-
-	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
-	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
-	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
+	space_adjust	spc,va,t0
+	get_pgd		spc,ptp
+	space_check	spc,t0,dtlb_fault
 
-	/* Get rid of prot bits and convert to page addr for idtlbt */
+	L3_ptep		ptp,pte,t0,va,dtlb_check_alias_20w
 
-	depdi		0,63,12,pte
-	extrd,u         pte,56,52,pte
+	update_ptep	ptp,pte,t0,t1
+
+	make_insert_tlb	spc,pte,prot
+	
 	idtlbt          pte,prot
 
 	rfir
 	nop
 
 dtlb_check_alias_20w:
-
-	/* Check to see if fault is in the temporary alias region */
-
-	cmpib,*<>,n     0,spc,dtlb_fault /* forward */
-	ldil            L%(TMPALIAS_MAP_START),t0
-	copy            va,t1
-	depdi           0,63,23,t1
-	cmpb,*<>,n      t0,t1,dtlb_fault /* forward */
-	ldi             (_PAGE_DIRTY|_PAGE_WRITE|_PAGE_READ),prot
-	depd,z          prot,8,7,prot
-
-	/*
-	 * OK, it is in the temp alias region, check whether "from" or "to".
-	 * Check "subtle" note in pacache.S re: r23/r26.
-	 */
-
-	extrd,u,*=      va,41,1,r0
-	or,*tr          %r23,%r0,pte    /* If "from" use "from" page */
-	or,*            %r26,%r0,pte    /* else "to", use "to" page  */
+	do_alias	spc,t0,t1,va,pte,prot,dtlb_fault
 
 	idtlbt          pte,prot
 
@@ -1062,51 +1227,16 @@
 	nop
 
 nadtlb_miss_20w:
-	extrd,u         spc,63,7,t1     /* adjust va */
-	depd            t1,31,7,va      /* adjust va */
-	depdi           0,63,7,spc      /* adjust space */
-	mfctl           %cr25,ptp	/* Assume user space miss */
-	or,*<>          %r0,spc,%r0     /* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extrd,u         va,33,9,t1      /* Get pgd index */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,*=           %r0,t0,%r0      /* If kernel, nullify following test */
-	cmpb,*<>,n       t0,spc,nadtlb_fault /* forward */
-
-	/* First level page table lookup */
-
-	ldd,s           t1(ptp),ptp
-	extrd,u         va,42,9,t0     /* get second-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,nadtlb_emulate
-	depdi           0,63,12,ptp     /* clear prot bits */
-
-	/* Second level page table lookup */
-
-	ldd,s           t0(ptp),ptp
-	extrd,u         va,51,9,t0     /* get third-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,nadtlb_emulate
-	depdi           0,63,12,ptp     /* clear prot bits */
-
-	/* Third level page table lookup */
-
-	shladd           t0,3,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldd              0(ptp),pte
-	bb,>=,n          pte,_PAGE_PRESENT_BIT,nadtlb_check_flush_20w
-
-	space_to_prot   spc prot        /* create prot id from space */
-	depd            pte,8,7,prot    /* add in prot bits from pte */
-
-	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
-	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
-	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
+	space_adjust	spc,va,t0
+	get_pgd		spc,ptp
+	space_check	spc,t0,nadtlb_fault
 
-	/* Get rid of prot bits and convert to page addr for idtlbt */
+	L3_ptep		ptp,pte,t0,va,nadtlb_check_flush_20w
+
+	update_ptep	ptp,pte,t0,t1
+
+	make_insert_tlb	spc,pte,prot
 
-	depdi		0,63,12,pte
-	extrd,u         pte,56,52,pte
 	idtlbt          pte,prot
 
 	rfir
@@ -1132,49 +1262,15 @@
 #else
 
 dtlb_miss_11:
-	mfctl           %cr25,ptp	/* Assume user space miss */
-	or,<>           %r0,spc,%r0	/* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extru		va,9,10,t1	/* Get pgd index */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,=            %r0,t0,%r0	/* If kernel, nullify following test */
-	cmpb,<>,n       t0,spc,dtlb_fault /* forward */
-
-	/* First level page table lookup */
-
-	ldwx,s		t1(ptp),ptp
-	extru		va,19,10,t0	/* get second-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,dtlb_check_alias_11
-	depi		0,31,12,ptp	/* clear prot bits */
-
-	/* Second level page table lookup */
-
-	sh2addl 	 t0,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldw		 0(ptp),pte
-	bb,>=,n          pte,_PAGE_PRESENT_BIT,dtlb_check_alias_11
-
-	/* Check whether the "accessed" bit was set, otherwise do so */
-
-	or		t1,pte,t0	/* t0 has R bit set */
-	and,<>		t1,pte,%r0	/* test and nullify if already set */
-	stw		t0,0(ptp)	/* write back pte */
-
-	zdep            spc,30,15,prot  /* create prot id from space */
-	dep             pte,8,7,prot    /* add in prot bits from pte */
-
-	extru,=		pte,_PAGE_NO_CACHE_BIT,1,r0
-	depi		1,12,1,prot
-	extru,=         pte,_PAGE_USER_BIT,1,r0
-	depi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extru,= 	pte,_PAGE_GATEWAY_BIT,1,r0
-	depi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
+	get_pgd		spc,ptp
 
-	/* Get rid of prot bits and convert to page addr for idtlba */
+	space_check	spc,t0,dtlb_fault
 
-	depi		0,31,12,pte
-	extru		pte,24,25,pte
+	L2_ptep		ptp,pte,t0,va,dtlb_check_alias_11
+
+	update_ptep	ptp,pte,t0,t1
+
+	make_insert_tlb_11	spc,pte,prot
 
 	mfsp		%sr1,t0  /* Save sr1 so we can use it in tlb inserts */
 	mtsp		spc,%sr1
@@ -1215,43 +1311,16 @@
 	nop
 
 nadtlb_miss_11:
-	mfctl           %cr25,ptp	/* Assume user space miss */
-	or,<>           %r0,spc,%r0	/* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extru		va,9,10,t1	/* Get pgd index */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,=            %r0,t0,%r0	/* If kernel, nullify following test */
-	cmpb,<>,n       t0,spc,nadtlb_fault /* forward */
-
-	/* First level page table lookup */
-
-	ldwx,s		t1(ptp),ptp
-	extru		va,19,10,t0	/* get second-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,nadtlb_emulate
-	depi		0,31,12,ptp	/* clear prot bits */
-
-	/* Second level page table lookup */
-
-	sh2addl 	 t0,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldw		 0(ptp),pte
-	bb,>=,n          pte,_PAGE_PRESENT_BIT,nadtlb_check_flush_11
-
-	zdep            spc,30,15,prot  /* create prot id from space */
-	dep             pte,8,7,prot    /* add in prot bits from pte */
-
-	extru,=		pte,_PAGE_NO_CACHE_BIT,1,r0
-	depi		1,12,1,prot
-	extru,=         pte,_PAGE_USER_BIT,1,r0
-	depi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extru,= 	pte,_PAGE_GATEWAY_BIT,1,r0
-	depi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
+	get_pgd		spc,ptp
 
-	/* Get rid of prot bits and convert to page addr for idtlba */
+	space_check	spc,t0,nadtlb_fault
+
+	L2_ptep		ptp,pte,t0,va,nadtlb_check_flush_11
+
+	update_ptep	ptp,pte,t0,t1
+
+	make_insert_tlb_11	spc,pte,prot
 
-	depi		0,31,12,pte
-	extru		pte,24,25,pte
 
 	mfsp		%sr1,t0  /* Save sr1 so we can use it in tlb inserts */
 	mtsp		spc,%sr1
@@ -1289,120 +1358,44 @@
 	nop
 
 dtlb_miss_20:
-	mfctl           %cr25,ptp	/* Assume user space miss */
-	or,<>           %r0,spc,%r0	/* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extru		va,9,10,t1	/* Get pgd index */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,=            %r0,t0,%r0	/* If kernel, nullify following test */
-	cmpb,<>,n       t0,spc,dtlb_fault /* forward */
-
-	/* First level page table lookup */
-
-	ldwx,s		t1(ptp),ptp
-	extru		va,19,10,t0	/* get second-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,dtlb_check_alias_20
-	depi		0,31,12,ptp	/* clear prot bits */
-
-	/* Second level page table lookup */
-
-	sh2addl 	 t0,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldw		 0(ptp),pte
-	bb,>=,n          pte,_PAGE_PRESENT_BIT,dtlb_check_alias_20
-
-	/* Check whether the "accessed" bit was set, otherwise do so */
-
-	or		t1,pte,t0	/* t0 has R bit set */
-	and,<>		t1,pte,%r0	/* test and nullify if already set */
-	stw		t0,0(ptp)	/* write back pte */
-
-	space_to_prot   spc prot        /* create prot id from space */
-	depd            pte,8,7,prot    /* add in prot bits from pte */
-
-	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
-	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
-	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
+	space_adjust	spc,va,t0
+	get_pgd		spc,ptp
+	space_check	spc,t0,dtlb_fault
 
-	/* Get rid of prot bits and convert to page addr for idtlbt */
+	L2_ptep		ptp,pte,t0,va,dtlb_check_alias_20
+
+	update_ptep	ptp,pte,t0,t1
+
+	make_insert_tlb	spc,pte,prot
+
+	f_extend	pte,t0
 
-	extrd,s         pte,35,4,t0
-	depdi		0,63,12,pte	/* clear lower 12 bits */
-        addi,=          1,t0,0 
-        extrd,u,*tr     pte,56,25,pte 
-	extrd,s		pte,56,25,pte	/* bit 31:8 >> 8  */ 
 	idtlbt          pte,prot
 
 	rfir
 	nop
 
 dtlb_check_alias_20:
-
-	/* Check to see if fault is in the temporary alias region */
-
-	cmpib,<>,n      0,spc,dtlb_fault /* forward */
-	ldil            L%(TMPALIAS_MAP_START),t0
-	copy            va,t1
-	depwi           0,31,23,t1
-	cmpb,<>,n       t0,t1,dtlb_fault /* forward */
-	ldi             (_PAGE_DIRTY|_PAGE_WRITE|_PAGE_READ),prot
-	depd,z          prot,8,7,prot
-
-	/*
-	 * OK, it is in the temp alias region, check whether "from" or "to".
-	 * Check "subtle" note in pacache.S re: r23/r26.
-	 */
-
-	extrw,u,=       va,9,1,r0
-	or,tr           %r23,%r0,pte    /* If "from" use "from" page */
-	or              %r26,%r0,pte    /* else "to", use "to" page  */
-
+	do_alias	spc,t0,t1,va,pte,prot,dtlb_fault
+	
 	idtlbt          pte,prot
 
 	rfir
 	nop
 
 nadtlb_miss_20:
-	mfctl           %cr25,ptp	/* Assume user space miss */
-	or,<>           %r0,spc,%r0	/* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extru		va,9,10,t1	/* Get pgd index */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,=            %r0,t0,%r0	/* If kernel, nullify following test */
-	cmpb,<>,n       t0,spc,nadtlb_fault /* forward */
-
-	/* First level page table lookup */
-
-	ldwx,s		t1(ptp),ptp
-	extru		va,19,10,t0	/* get second-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,nadtlb_emulate
-	depi		0,31,12,ptp	/* clear prot bits */
-
-	/* Second level page table lookup */
-
-	sh2addl 	 t0,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldw		 0(ptp),pte
-	bb,>=,n          pte,_PAGE_PRESENT_BIT,nadtlb_check_flush_20
-
-	space_to_prot   spc prot        /* create prot id from space */
-	depd            pte,8,7,prot    /* add in prot bits from pte */
-
-	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
-	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
-	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
+	get_pgd		spc,ptp
 
-	/* Get rid of prot bits and convert to page addr for idtlbt */
+	space_check	spc,t0,nadtlb_fault
+
+	L2_ptep		ptp,pte,t0,va,nadtlb_check_flush_20
+
+	update_ptep	ptp,pte,t0,t1
+
+	make_insert_tlb	spc,pte,prot
 
-        extrd,s         pte,35,4,t0
-        depdi           0,63,12,pte     /* clear lower 12 bits */
-        addi,=          1,t0,0
-        extrd,u,*tr     pte,56,25,pte
-        extrd,s         pte,56,25,pte   /* bit 31:8 >> 8  */
+	f_extend	pte,t0
+	
         idtlbt          pte,prot
 
 	rfir
@@ -1475,119 +1468,33 @@
 	 * on the gateway page which is in the kernel address space.
 	 */
 
-	extrd,u         spc,63,7,t1     /* adjust va */
-	depd            t1,31,7,va      /* adjust va */
-	depdi           0,63,7,spc      /* adjust space */
-	cmpib,*=        0,spc,itlb_miss_kernel_20w
-	extrd,u         va,33,9,t1      /* Get pgd index */
-
-	mfctl           %cr25,ptp	/* load user pgd */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,*=           %r0,t0,%r0      /* If kernel, nullify following test */
-	cmpb,*<>,n      t0,spc,itlb_fault /* forward */
-
-	/* First level page table lookup */
-
-itlb_miss_common_20w:
-	ldd,s           t1(ptp),ptp
-	extrd,u         va,42,9,t0     /* get second-level index */
-	bb,>=,n 	ptp,_PAGE_PRESENT_BIT,itlb_fault
-	depdi           0,63,12,ptp     /* clear prot bits */
-
-	/* Second level page table lookup */
+	space_adjust	spc,va,t0
+	get_pgd		spc,ptp
+	space_check	spc,t0,itlb_fault
 
-	ldd,s           t0(ptp),ptp
-	extrd,u         va,51,9,t0     /* get third-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,itlb_fault
-	depdi           0,63,12,ptp     /* clear prot bits */
+	L3_ptep		ptp,pte,t0,va,itlb_fault
 
-	/* Third level page table lookup */
+	update_ptep	ptp,pte,t0,t1
 
-	shladd           t0,3,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldd              0(ptp),pte
-	bb,>=,n          pte,_PAGE_PRESENT_BIT,itlb_fault
-
-	/* Check whether the "accessed" bit was set, otherwise do so */
-
-	or		t1,pte,t0	/* t0 has R bit set */
-	and,*<>         t1,pte,%r0      /* test and nullify if already set */
-	std             t0,0(ptp)       /* write back pte */
-
-	space_to_prot   spc prot        /* create prot id from space */
-	depd            pte,8,7,prot    /* add in prot bits from pte */
-
-	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
-	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
-	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
-
-	/* Get rid of prot bits and convert to page addr for iitlbt */
-
-	depdi		0,63,12,pte
-	extrd,u         pte,56,32,pte
+	make_insert_tlb	spc,pte,prot
+	
 	iitlbt          pte,prot
 
 	rfir
 	nop
 
-itlb_miss_kernel_20w:
-	b               itlb_miss_common_20w
-	mfctl           %cr24,ptp	/* Load kernel pgd */
 #else
 
 itlb_miss_11:
+	get_pgd		spc,ptp
 
-	/*
-	 * I miss is a little different, since we allow users to fault
-	 * on the gateway page which is in the kernel address space.
-	 */
-
-	cmpib,=         0,spc,itlb_miss_kernel_11
-	extru		va,9,10,t1	/* Get pgd index */
-
-	mfctl           %cr25,ptp	/* load user pgd */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,=            %r0,t0,%r0	/* If kernel, nullify following test */
-	cmpb,<>,n       t0,spc,itlb_fault /* forward */
+	space_check	spc,t0,itlb_fault
 
-	/* First level page table lookup */
+	L2_ptep		ptp,pte,t0,va,itlb_fault
 
-itlb_miss_common_11:
-	ldwx,s		t1(ptp),ptp
-	extru		va,19,10,t0	/* get second-level index */
-	bb,>=,n 	ptp,_PAGE_PRESENT_BIT,itlb_fault
-	depi		0,31,12,ptp	/* clear prot bits */
+	update_ptep	ptp,pte,t0,t1
 
-	/* Second level page table lookup */
-
-	sh2addl 	 t0,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldw		 0(ptp),pte
-	bb,>=,n 	 pte,_PAGE_PRESENT_BIT,itlb_fault
-
-	/* Check whether the "accessed" bit was set, otherwise do so */
-
-	or		t1,pte,t0	/* t0 has R bit set */
-	and,<>		t1,pte,%r0	/* test and nullify if already set */
-	stw		t0,0(ptp)	/* write back pte */
-
-	zdep            spc,30,15,prot  /* create prot id from space */
-	dep             pte,8,7,prot    /* add in prot bits from pte */
-
-	extru,=		pte,_PAGE_NO_CACHE_BIT,1,r0
-	depi		1,12,1,prot
-	extru,=         pte,_PAGE_USER_BIT,1,r0
-	depi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extru,= 	pte,_PAGE_GATEWAY_BIT,1,r0
-	depi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
-
-	/* Get rid of prot bits and convert to page addr for iitlba */
-
-	depi		0,31,12,pte
-	extru		pte,24,25,pte
+	make_insert_tlb_11	spc,pte,prot
 
 	mfsp		%sr1,t0  /* Save sr1 so we can use it in tlb inserts */
 	mtsp		spc,%sr1
@@ -1600,106 +1507,35 @@
 	rfir
 	nop
 
-itlb_miss_kernel_11:
-	b               itlb_miss_common_11
-	mfctl           %cr24,ptp	/* Load kernel pgd */
-
 itlb_miss_20:
+	get_pgd		spc,ptp
 
-	/*
-	 * I miss is a little different, since we allow users to fault
-	 * on the gateway page which is in the kernel address space.
-	 */
-
-	cmpib,=         0,spc,itlb_miss_kernel_20
-	extru		va,9,10,t1	/* Get pgd index */
-
-	mfctl           %cr25,ptp	/* load user pgd */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,=            %r0,t0,%r0	/* If kernel, nullify following test */
-	cmpb,<>,n       t0,spc,itlb_fault /* forward */
-
-	/* First level page table lookup */
-
-itlb_miss_common_20:
-	ldwx,s		t1(ptp),ptp
-	extru		va,19,10,t0	/* get second-level index */
-	bb,>=,n 	ptp,_PAGE_PRESENT_BIT,itlb_fault
-	depi		0,31,12,ptp	/* clear prot bits */
-
-	/* Second level page table lookup */
-
-	sh2addl 	 t0,ptp,ptp
-	ldi		_PAGE_ACCESSED,t1
-	ldw		 0(ptp),pte
-	bb,>=,n 	 pte,_PAGE_PRESENT_BIT,itlb_fault
-
-	/* Check whether the "accessed" bit was set, otherwise do so */
+	space_check	spc,t0,itlb_fault
 
-	or		t1,pte,t0	/* t0 has R bit set */
-	and,<>		t1,pte,%r0	/* test and nullify if already set */
-	stw		t0,0(ptp)	/* write back pte */
+	L2_ptep		ptp,pte,t0,va,itlb_fault
 
-	space_to_prot   spc prot        /* create prot id from space */
-	depd            pte,8,7,prot    /* add in prot bits from pte */
+	update_ptep	ptp,pte,t0,t1
 
-	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
-	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
-	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
+	make_insert_tlb	spc,pte,prot
 
-	/* Get rid of prot bits and convert to page addr for iitlbt */
+	f_extend	pte,t0	
 
-        extrd,s         pte,35,4,t0 
-        depdi           0,63,12,pte     /* clear lower 12 bits */
-        addi,=          1,t0,0
-        extrd,u,*tr     pte,56,25,pte 
-        extrd,s         pte,56,25,pte   /* bit 31:8 >> 8  */
 	iitlbt          pte,prot
 
 	rfir
 	nop
 
-
-itlb_miss_kernel_20:
-	b               itlb_miss_common_20
-	mfctl           %cr24,ptp	/* Load kernel pgd */
 #endif
 
 #ifdef __LP64__
 
 dbit_trap_20w:
-	extrd,u         spc,63,7,t1     /* adjust va */
-	depd            t1,31,7,va      /* adjust va */
-	depdi           0,1,2,va        /* adjust va */
-	depdi           0,63,7,spc      /* adjust space */
-	mfctl           %cr25,ptp	/* Assume user space miss */
-	or,*<>          %r0,spc,%r0     /* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extrd,u         va,33,9,t1      /* Get pgd index */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,*=           %r0,t0,%r0      /* If kernel, nullify following test */
-	cmpb,*<>,n       t0,spc,dbit_fault /* forward */
-
-	/* First level page table lookup */
-
-	ldd,s           t1(ptp),ptp
-	extrd,u         va,42,9,t0     /* get second-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,dbit_fault
-	depdi           0,63,12,ptp     /* clear prot bits */
-
-	/* Second level page table lookup */
-
-	ldd,s           t0(ptp),ptp
-	extrd,u         va,51,9,t0     /* get third-level index */
-	bb,>=,n         ptp,_PAGE_PRESENT_BIT,dbit_fault
-	depdi           0,63,12,ptp     /* clear prot bits */
+	space_adjust	spc,va,t0
+	get_pgd		spc,ptp
+	space_check	spc,t0,dbit_fault
 
-	/* Third level page table lookup */
+	L3_ptep		ptp,pte,t0,va,dbit_fault
 
-	shladd           t0,3,ptp,ptp
 #ifdef CONFIG_SMP
 	CMPIB=,n        0,spc,dbit_nolock_20w
 	ldil            L%PA(pa_dbit_lock),t0
@@ -1712,27 +1548,10 @@
 
 dbit_nolock_20w:
 #endif
-	ldi		(_PAGE_ACCESSED|_PAGE_DIRTY),t1
-	ldd              0(ptp),pte
-	bb,>=,n          pte,_PAGE_PRESENT_BIT,dbit_fault
-
-	/* Set Accessed and Dirty bits in the pte */
-
-	or		t1,pte,pte
-	std             pte,0(ptp)      /* write back pte */
-
-	space_to_prot   spc prot        /* create prot id from space */
-	depd            pte,8,7,prot    /* add in prot bits from pte */
-
-	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
-	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
-	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
-
-	/* Get rid of prot bits and convert to page addr for idtlbt */
+	update_dirty	ptp,pte,t0,t1
 
-	depdi		0,63,12,pte
-	extrd,u         pte,56,52,pte
+	make_insert_tlb	spc,pte,prot
+		
 	idtlbt          pte,prot
 #ifdef CONFIG_SMP
 	CMPIB=,n        0,spc,dbit_nounlock_20w
@@ -1747,25 +1566,13 @@
 #else
 
 dbit_trap_11:
-	mfctl           %cr25,ptp	/* Assume user space trap */
-	or,<>           %r0,spc,%r0	/* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extru		va,9,10,t1	/* Get pgd index */
 
-	mfsp            %sr7,t0		/* Get current space */
-	or,=            %r0,t0,%r0	/* If kernel, nullify following test */
-	cmpb,<>,n       t0,spc,dbit_fault /* forward */
+	get_pgd		spc,ptp
 
-	/* First level page table lookup */
+	space_check	spc,t0,dbit_fault
 
-	ldwx,s		t1(ptp),ptp
-	extru		va,19,10,t0	/* get second-level index */
-	bb,>=,n 	ptp,_PAGE_PRESENT_BIT,dbit_fault
-	depi		0,31,12,ptp	/* clear prot bits */
+	L2_ptep		ptp,pte,t0,va,dbit_fault
 
-	/* Second level page table lookup */
-
-	sh2addl 	 t0,ptp,ptp
 #ifdef CONFIG_SMP
 	CMPIB=,n        0,spc,dbit_nolock_11
 	ldil            L%PA(pa_dbit_lock),t0
@@ -1778,29 +1585,9 @@
 
 dbit_nolock_11:
 #endif
-	ldi		(_PAGE_ACCESSED|_PAGE_DIRTY),t1
-	ldw		 0(ptp),pte
-	bb,>=,n 	 pte,_PAGE_PRESENT_BIT,dbit_fault
-
-	/* Set Accessed and Dirty bits in the pte */
-
-	or		t1,pte,pte
-	stw		pte,0(ptp)	/* write back pte */
-
-	zdep            spc,30,15,prot  /* create prot id from space */
-	dep             pte,8,7,prot    /* add in prot bits from pte */
-
-	extru,=		pte,_PAGE_NO_CACHE_BIT,1,r0
-	depi		1,12,1,prot
-	extru,=         pte,_PAGE_USER_BIT,1,r0
-	depi		7,11,3,prot /* Set for user space (1 rsvd for read) */
-	extru,= 	pte,_PAGE_GATEWAY_BIT,1,r0
-	depi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
-
-	/* Get rid of prot bits and convert to page addr for idtlba */
+	update_dirty	ptp,pte,t0,t1
 
-	depi		0,31,12,pte
-	extru		pte,24,25,pte
+	make_insert_tlb_11	spc,pte,prot
 
 	mfsp            %sr1,t1  /* Save sr1 so we can use it in tlb inserts */
 	mtsp		spc,%sr1
@@ -1821,25 +1608,12 @@
 	nop
 
 dbit_trap_20:
-	mfctl           %cr25,ptp	/* Assume user space trap */
-	or,<>           %r0,spc,%r0	/* If it is user space, nullify */
-	mfctl           %cr24,ptp	/* Load kernel pgd instead */
-	extru		va,9,10,t1	/* Get pgd index */
-
-	mfsp            %sr7,t0		/* Get current space */
-	or,=            %r0,t0,%r0	/* If kernel, nullify following test */
-	cmpb,<>,n       t0,spc,dbit_fault /* forward */
+	get_pgd		spc,ptp
 
-	/* First level page table lookup */
+	space_check	spc,t0,dbit_fault
 
-	ldwx,s		t1(ptp),ptp
-	extru		va,19,10,t0	/* get second-level index */
-	bb,>=,n 	ptp,_PAGE_PRESENT_BIT,dbit_fault
-	depi		0,31,12,ptp	/* clear prot bits */
+	L2_ptep		ptp,pte,t0,va,dbit_fault
 
-	/* Second level page table lookup */
-
-	sh2addl 	 t0,ptp,ptp
 #ifdef CONFIG_SMP
 	CMPIB=,n        0,spc,dbit_nolock_20
 	ldil            L%PA(pa_dbit_lock),t0
@@ -1852,28 +1626,12 @@
 
 dbit_nolock_20:
 #endif
-	ldi		(_PAGE_ACCESSED|_PAGE_DIRTY),t1
-	ldw		 0(ptp),pte
-	bb,>=,n 	 pte,_PAGE_PRESENT_BIT,dbit_fault
-
-	/* Set Accessed and Dirty bits in the pte */
-
-	or		t1,pte,pte
-	stw		pte,0(ptp)	/* write back pte */
-
-	space_to_prot   spc prot        /* create prot id from space */
-	depd            pte,8,7,prot    /* add in prot bits from pte */
-
-	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
-	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
-	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
-	depdi		0,11,2,prot	/* If Gateway, Set PL2 to 0 */
-
-        extrd,s         pte,35,4,t0 
-        depdi           0,63,12,pte     /* clear lower 12 bits */
-        addi,=          1,t0,0
-        extrd,u,*tr     pte,56,25,pte 
-        extrd,s         pte,56,25,pte   /* bit 31:8 >> 8  */
+	update_dirty	ptp,pte,t0,t1
+
+	make_insert_tlb	spc,pte,prot
+
+	f_extend	pte,t0
+	
         idtlbt          pte,prot
 
 #ifdef CONFIG_SMP
@@ -2285,9 +2043,13 @@
 	bb,<,n	%r19, 31-TIF_SIGPENDING, syscall_do_signal /* forward */
 
 syscall_restore:
-	LDREG	TI_FLAGS-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r19    /* get ti flags */
-	bb,<	%r19, 31-TIF_SYSCALL_TRACE,syscall_restore_rfi
-	LDREG	TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1	/* delay slot! */
+	/* Are we being ptraced? */
+	LDREG	TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
+
+	LDREG	TASK_PTRACE(%r1), %r19
+	bb,<	%r19,31,syscall_restore_rfi
+	nop
+
 	ldo	TASK_PT_FR31(%r1),%r19		   /* reload fpregs */
 	rest_fp	%r19
 
@@ -2337,7 +2099,6 @@
 	 * the most efficient way of doing things, but it works.
 	 */
 syscall_restore_rfi:
-	LDREG	TASK_PTRACE(%r1), %r19
 	ldo	-1(%r0),%r2			   /* Set recovery cntr to -1 */
 	mtctl	%r2,%cr0			   /*   for immediate trap */
 	LDREG	TASK_PT_PSW(%r1),%r2		   /* Get old PSW */
diff -Nru a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
--- a/arch/parisc/kernel/firmware.c	Tue Jun 15 22:20:36 2004
+++ b/arch/parisc/kernel/firmware.c	Tue Jun 15 22:20:36 2004
@@ -10,6 +10,7 @@
  * Copyright 1999 SuSE GmbH Nuernberg (Philipp Rumpf, prumpf@tux.org)
  * Copyright 1999 The Puffin Group, (Alex deVries, David Kennedy)
  * Copyright 2003 Grant Grundler <grundler parisc-linux org>
+ * Copyright 2003,2004 Ryan Bradetich <rbrad@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
@@ -71,6 +72,15 @@
 static unsigned long pdc_result[32] __attribute__ ((aligned (8)));
 static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));
 
+#ifdef __LP64__
+#define WIDE_FIRMWARE 0x1
+#define NARROW_FIRMWARE 0x2
+
+/* Firmware needs to be initially set to narrow to determine the 
+ * actual firmware width. */
+int parisc_narrow_firmware = 1;
+#endif
+
 /* on all currently-supported platforms, IODC I/O calls are always
  * 32-bit calls, and MEM_PDC calls are always the same width as the OS.
  * This means Cxxx boxes can't run wide kernels right now. -PB
@@ -87,11 +97,11 @@
 #endif
 long real32_call(unsigned long function, ...);
 
-#if defined(__LP64__) && ! defined(CONFIG_PDC_NARROW)
-#define MEM_PDC (unsigned long)(PAGE0->mem_pdc_hi) << 32 | PAGE0->mem_pdc
-#   define mem_pdc_call(args...) real64_call(MEM_PDC, args)
+#ifdef __LP64__
+#   define MEM_PDC (unsigned long)(PAGE0->mem_pdc_hi) << 32 | PAGE0->mem_pdc
+#   define mem_pdc_call(args...) unlikely(parisc_narrow_firmware) ? real32_call(MEM_PDC, args) : real64_call(MEM_PDC, args)
 #else
-#define MEM_PDC (unsigned long)PAGE0->mem_pdc
+#   define MEM_PDC (unsigned long)PAGE0->mem_pdc
 #   define mem_pdc_call(args...) real32_call(MEM_PDC, args)
 #endif
 
@@ -105,12 +115,14 @@
  */
 static unsigned long f_extend(unsigned long address)
 {
-#ifdef CONFIG_PDC_NARROW
-	if((address & 0xff000000) == 0xf0000000)
-		return 0xf0f0f0f000000000 | (u32)address;
+#ifdef __LP64__
+	if(unlikely(parisc_narrow_firmware)) {
+		if((address & 0xff000000) == 0xf0000000)
+			return 0xf0f0f0f000000000 | (u32)address;
 
-	if((address & 0xf0000000) == 0xf0000000)
-		return 0xffffffff00000000 | (u32)address;
+		if((address & 0xf0000000) == 0xf0000000)
+			return 0xffffffff00000000 | (u32)address;
+	}
 #endif
 	return address;
 }
@@ -125,11 +137,34 @@
  */
 static void convert_to_wide(unsigned long *addr)
 {
-#ifdef CONFIG_PDC_NARROW
+#ifdef __LP64__
 	int i;
-	unsigned *p = (unsigned int *)addr;
-	for(i = 31; i >= 0; --i)
-		addr[i] = p[i];
+	unsigned int *p = (unsigned int *)addr;
+
+	if(unlikely(parisc_narrow_firmware)) {
+		for(i = 31; i >= 0; --i)
+			addr[i] = p[i];
+	}
+#endif
+}
+
+/**
+ * set_firmware_width - Determine if the firmware is wide or narrow.
+ * 
+ * This function must be called before any pdc_* function that uses the convert_to_wide
+ * function.
+ */
+void __init set_firmware_width(void)
+{
+#ifdef __LP64__
+	int retval;
+
+        spin_lock_irq(&pdc_lock);
+	retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0);
+	convert_to_wide(pdc_result);
+	if(pdc_result[0] != NARROW_FIRMWARE)
+		parisc_narrow_firmware = 0;
+        spin_unlock_irq(&pdc_lock);
 #endif
 }
 
@@ -582,6 +617,7 @@
 		case 10:  *period = 1000; break;
 		case 20:  *period = 500; break;
 		case 40:  *period = 250; break;
+		case 80:  *period = 125; break;
 		default: /* Do nothing */ break;
 	}
 
diff -Nru a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c
--- a/arch/parisc/kernel/hardware.c	Tue Jun 15 22:20:39 2004
+++ b/arch/parisc/kernel/hardware.c	Tue Jun 15 22:20:39 2004
@@ -1273,8 +1273,8 @@
 	{ 0x05e6, 0x0ffe, pcxw2  },  /* 0x05e6 - 0x05e7 */
 	{ 0x05e8, 0x0ff8, pcxw2  },  /* 0x05e8 - 0x05ef */
 	{ 0x05f0, 0x0ff0, pcxw2  },  /* 0x05f0 - 0x05ff */
-	{ 0x0600, 0x0ff0, pcxl   },  /* 0x0600 - 0x060f */
-	{ 0x0610, 0x0ff0, pcxl   },  /* 0x0610 - 0x061f */
+	{ 0x0600, 0x0fe0, pcxl   },  /* 0x0600 - 0x061f */
+	{ 0x0880, 0x0ff0, mako   },  /* 0x0880 - 0x088f */
 	{ 0x0000, 0x0000, pcx    }	/* terminate table */
 };
 
@@ -1289,7 +1289,8 @@
 	[pcxu_]	{ "PA8200 (PCX-U+)",	"2.0" },
 	[pcxw]	{ "PA8500 (PCX-W)",	"2.0" },
 	[pcxw_]	{ "PA8600 (PCX-W+)",	"2.0" },
-	[pcxw2]	{ "PA8700 (PCX-W2)",	"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	Tue Jun 15 22:20:43 2004
+++ b/arch/parisc/kernel/head.S	Tue Jun 15 22:20:43 2004
@@ -82,19 +82,21 @@
 	ldo		R%PA(swapper_pg_dir)(%r4),%r4
 	mtctl		%r4,%cr24	/* Initialize kernel root pointer */
 	mtctl		%r4,%cr25	/* Initialize user root pointer */
+	ldi		ASM_PT_INITIAL,%r1
+	ldo		ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4),%r4
+1:
+	stw             %r3,0(%r4)
+	ldo		ASM_PAGE_SIZE(%r3),%r3
+	addib,>		-1,%r1,1b
+	ldo		ASM_PGD_ENTRY_SIZE(%r4),%r4
 
-#if (__PAGE_OFFSET != 0x10000000UL)
-Error! Code below (the next two stw's) needs to be changed
-#endif
-
-	stw             %r3,0x100(%r4)  /* Hardwired 0x1... kernel Vaddr start*/
-	ldo		0x1000(%r3),%r3
-	stw             %r3,0x104(%r4)
 	ldo		_PAGE_KERNEL(%r0),%r3 /* Hardwired 0 phys addr start */
+	ldil		L%PA(pg0),%r1
+	ldo		R%PA(pg0)(%r1),%r1
 $pgt_fill_loop:
-	stwm		%r3,4(%r1)
-	ldo		0x1000(%r3),%r3
-	bb,>=		%r3,8,$pgt_fill_loop
+	stwm		%r3,ASM_PTE_ENTRY_SIZE(%r1)
+	ldo		ASM_PAGE_SIZE(%r3),%r3
+	bb,>=		%r3,31-KERNEL_INITIAL_ORDER,$pgt_fill_loop
 	nop
 
 
diff -Nru a/arch/parisc/kernel/head64.S b/arch/parisc/kernel/head64.S
--- a/arch/parisc/kernel/head64.S	Tue Jun 15 22:20:36 2004
+++ b/arch/parisc/kernel/head64.S	Tue Jun 15 22:20:36 2004
@@ -88,26 +88,25 @@
 	mtctl		%r4,%cr24	/* Initialize kernel root pointer */
 	mtctl		%r4,%cr25	/* Initialize user root pointer */
 
-#if (__PAGE_OFFSET != 0x10000000UL)
-Error! Code below (the next five std's) needs to be changed
-#endif
-
-	std             %r3,0x00(%r4)   /* Hardwired 0x1... kernel Vaddr start*/
+	stw             %r3,ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4)
 
 	ldo		_PAGE_TABLE(%r1),%r3
-	std             %r3,0x400(%r5)  /* Hardwired 0x1... kernel Vaddr start*/
-	ldo		0x1000(%r3),%r3
-	std             %r3,0x408(%r5)
-	ldo		0x1000(%r3),%r3
-	std             %r3,0x410(%r5)
-	ldo		0x1000(%r3),%r3
-	std             %r3,0x418(%r5)
+	ldo		ASM_PMD_ENTRY*ASM_PMD_ENTRY_SIZE(%r5),%r5
+	ldi		ASM_PT_INITIAL,%r1
+1:
+	stw		%r3,0(%r5)
+	ldo		ASM_PAGE_SIZE(%r3),%r3
+	addib,>		-1,%r1,1b
+	ldo		ASM_PMD_ENTRY_SIZE(%r5),%r5
 
 	ldo		_PAGE_KERNEL(%r0),%r3 /* Hardwired 0 phys addr start */
+	ldil		L%PA(pg0),%r1
+	ldo		R%PA(pg0)(%r1),%r1
+
 $pgt_fill_loop:
-	std,ma		%r3,8(%r1)
-	ldo		0x1000(%r3),%r3
-	bb,>=		%r3,8,$pgt_fill_loop
+	std,ma		%r3,ASM_PTE_ENTRY_SIZE(%r1)
+	ldo		ASM_PAGE_SIZE(%r3),%r3
+	bb,>=		%r3,31-KERNEL_INITIAL_ORDER,$pgt_fill_loop
 	nop
 
 	/* And the RFI Target address too */
@@ -169,7 +168,6 @@
 	tophys_r1	%r10
 	std		%r11,  TASK_PT_GR11(%r10)
 
-#ifndef CONFIG_PDC_NARROW
 	/* Switch to wide mode; Superdome doesn't support narrow PDC
 	** calls.
 	*/
@@ -179,7 +177,6 @@
 	bv		(%rp)
 	ssm		PSW_SM_W,%r0
 2:
-#endif /* CONFIG_PDC_NARROW */
 
 	/* Set Wide mode as the "Default" (eg for traps)
 	** First trap occurs *right* after (or part of) rfi for slave CPUs.
diff -Nru a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c
--- a/arch/parisc/kernel/init_task.c	Tue Jun 15 22:20:41 2004
+++ b/arch/parisc/kernel/init_task.c	Tue Jun 15 22:20:41 2004
@@ -52,11 +52,13 @@
 	__attribute__((aligned(128))) __attribute__((__section__(".data.init_task"))) =
 		{ INIT_THREAD_INFO(init_task) };
 
-pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((aligned(4096))) = { {0}, };
 #ifdef __LP64__
-unsigned long pmd0[PTRS_PER_PMD] __attribute__ ((aligned(4096))) = { 0, };
+/* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout
+ * with the first pmd adjacent to the pgd and below it */
+pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((aligned(PAGE_SIZE))) = { {0}, };
 #endif
-unsigned long pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((aligned(4096))) = { 0, };
+pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((aligned(PAGE_SIZE))) = { {0}, };
+pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((aligned(PAGE_SIZE))) = { {0}, };
 
 /*
  * Initial task structure.
diff -Nru a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
--- a/arch/parisc/kernel/pacache.S	Tue Jun 15 22:20:37 2004
+++ b/arch/parisc/kernel/pacache.S	Tue Jun 15 22:20:37 2004
@@ -350,10 +350,6 @@
 
 	.procend
 
-#if (TMPALIAS_MAP_START >= 0x80000000UL)
-Warning TMPALIAS_MAP_START changed. If > 2 Gb, code in pacache.S is bogus
-#endif
-
 /*
  * NOTE: Code in clear_user_page has a hard coded dependency on the
  *       maximum alias boundary being 4 Mb. We've been assured by the
@@ -490,6 +486,9 @@
 
 	ldil    L%(TMPALIAS_MAP_START),%r28
 #ifdef __LP64__
+#if (TMPALIAS_MAP_START >= 0x80000000)
+	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 */
@@ -574,6 +573,95 @@
 	.exit
 
 	.procend
+	
+	.export flush_user_dcache_page
+
+flush_user_dcache_page:
+	.proc
+	.callinfo NO_CALLS
+	.entry
+
+	ldil    L%dcache_stride,%r1
+	ldw     R%dcache_stride(%r1),%r23
+
+#ifdef __LP64__
+	depdi,z 1,63-PAGE_SHIFT,1,%r25
+#else
+	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)
+
+	sync
+	bv      %r0(%r2)
+	nop
+	.exit
+
+	.procend
+
+	.export flush_user_icache_page
+
+flush_user_icache_page:
+	.proc
+	.callinfo NO_CALLS
+	.entry
+
+	ldil    L%dcache_stride,%r1
+	ldw     R%dcache_stride(%r1),%r23
+
+#ifdef __LP64__
+	depdi,z 1,63-PAGE_SHIFT,1,%r25
+#else
+	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)
+
+	sync
+	bv      %r0(%r2)
+	nop
+	.exit
+
+	.procend
+
 
 	.export purge_kernel_dcache_page
 
diff -Nru a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
--- a/arch/parisc/kernel/pci-dma.c	Tue Jun 15 22:21:02 2004
+++ b/arch/parisc/kernel/pci-dma.c	Tue Jun 15 22:21:02 2004
@@ -539,10 +539,10 @@
 	.unmap_single =		pa11_dma_unmap_single,
 	.map_sg =		pa11_dma_map_sg,
 	.unmap_sg =		pa11_dma_unmap_sg,
-	.dma_sync_single_cpu =	pa11_dma_sync_single_cpu,
-	.dma_sync_single_device = pa11_dma_sync_single_device,
-	.dma_sync_sg_cpu =	pa11_dma_sync_sg_cpu,
-	.dma_sync_sg_device =	pa11_dma_sync_sg_device,
+	.dma_sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
+	.dma_sync_single_for_device =	pa11_dma_sync_single_for_device,
+	.dma_sync_sg_for_cpu =		pa11_dma_sync_sg_for_cpu,
+	.dma_sync_sg_for_device =	pa11_dma_sync_sg_for_device,
 };
 
 
diff -Nru a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
--- a/arch/parisc/kernel/perf.c	Tue Jun 15 22:20:39 2004
+++ b/arch/parisc/kernel/perf.c	Tue Jun 15 22:20:39 2004
@@ -506,9 +506,11 @@
 		perf_processor_interface = ONYX_INTF;
 	} else if (boot_cpu_data.cpu_type == pcxw ||
 		 boot_cpu_data.cpu_type == pcxw_ ||
-		 boot_cpu_data.cpu_type == pcxw2) {
+		 boot_cpu_data.cpu_type == pcxw2 ||
+		 boot_cpu_data.cpu_type == mako) {
 		perf_processor_interface = CUDA_INTF;
-		if (boot_cpu_data.cpu_type == pcxw2) 
+		if (boot_cpu_data.cpu_type == pcxw2 ||
+		    boot_cpu_data.cpu_type == mako) 
 			bitmask_array = perf_bitmasks_piranha;
 	} else {
 		perf_processor_interface = UNKNOWN_INTF;
diff -Nru a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
--- a/arch/parisc/kernel/process.c	Tue Jun 15 22:21:05 2004
+++ b/arch/parisc/kernel/process.c	Tue Jun 15 22:21:05 2004
@@ -44,6 +44,7 @@
 #include <linux/sched.h>
 #include <linux/stddef.h>
 #include <linux/unistd.h>
+#include <linux/kallsyms.h>
 
 #include <asm/io.h>
 #include <asm/offsets.h>
@@ -51,6 +52,7 @@
 #include <asm/pdc_chassis.h>
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
+#include <asm/unwind.h>
 
 int hlt_counter;
 
@@ -367,4 +369,29 @@
 out:
 
 	return error;
+}
+
+unsigned long 
+get_wchan(struct task_struct *p)
+{
+	struct unwind_frame_info info;
+	unsigned long ip;
+	int count = 0;
+	/*
+	 * These bracket the sleeping functions..
+	 */
+#	define first_sched	((unsigned long) scheduling_functions_start_here)
+#	define last_sched	((unsigned long) scheduling_functions_end_here)
+
+	unwind_frame_init_from_blocked_task(&info, p);
+	do {
+		if (unwind_once(&info) < 0)
+			return 0;
+		ip = info.ip;
+		if (ip < first_sched || ip >= last_sched)
+			return ip;
+	} while (count++ < 16);
+	return 0;
+#	undef first_sched
+#	undef last_sched
 }
diff -Nru a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
--- a/arch/parisc/kernel/processor.c	Tue Jun 15 22:21:04 2004
+++ b/arch/parisc/kernel/processor.c	Tue Jun 15 22:21:04 2004
@@ -231,9 +231,7 @@
 	boot_cpu_data.hversion =  boot_cpu_data.pdc.model.hversion;
 	boot_cpu_data.sversion =  boot_cpu_data.pdc.model.sversion;
 
-	boot_cpu_data.cpu_type =
-			parisc_get_cpu_type(boot_cpu_data.hversion);
-
+	boot_cpu_data.cpu_type = parisc_get_cpu_type(boot_cpu_data.hversion);
 	boot_cpu_data.cpu_name = cpu_name_version[boot_cpu_data.cpu_type][0];
 	boot_cpu_data.family_name = cpu_name_version[boot_cpu_data.cpu_type][1];
 }
@@ -276,6 +274,7 @@
 	int ret;
 	struct pdc_coproc_cfg coproc_cfg;
 
+	set_firmware_width();
 	ret = pdc_coproc_cfg(&coproc_cfg);
 
 	if(ret >= 0 && coproc_cfg.ccr_functional) {
diff -Nru a/arch/parisc/kernel/real2.S b/arch/parisc/kernel/real2.S
--- a/arch/parisc/kernel/real2.S	Tue Jun 15 22:20:40 2004
+++ b/arch/parisc/kernel/real2.S	Tue Jun 15 22:20:40 2004
@@ -26,6 +26,7 @@
 
 save_cr_space:
 	.block	REG_SZ * N_SAVED_REGS
+save_cr_end:
 
 
 /************************ 32-bit real-mode calls ***********************/
@@ -123,7 +124,7 @@
 	nop
 
 restore_control_regs:
-	load32	PA(save_cr_space+(N_SAVED_REGS*REG_SZ)), %r26
+	load32	PA(save_cr_end), %r26
 	POP_CR(%cr15, %r26)
 	POP_CR(%cr31, %r26)
 	POP_CR(%cr30, %r26)
diff -Nru a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
--- a/arch/parisc/kernel/setup.c	Tue Jun 15 22:21:03 2004
+++ b/arch/parisc/kernel/setup.c	Tue Jun 15 22:21:03 2004
@@ -121,8 +121,11 @@
 
 	pdc_console_init();
 
-#ifdef CONFIG_PDC_NARROW
-	printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
+#ifdef __LP64__
+	extern int parisc_narrow_firmware;
+	if(parisc_narrow_firmware) {
+		printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
+	}
 #endif
 	setup_pdc();
 	setup_cmdline(cmdline_p);
@@ -204,6 +207,7 @@
         case pcxw:
         case pcxw_:
         case pcxw2:
+	case mako:	/* XXX : this is really mckinley bus */
                 if (NULL == proc_runway_root)
                 {
                         proc_runway_root = proc_mkdir("bus/runway", 0);
diff -Nru a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
--- a/arch/parisc/kernel/signal.c	Tue Jun 15 22:21:04 2004
+++ b/arch/parisc/kernel/signal.c	Tue Jun 15 22:21:04 2004
@@ -353,12 +353,17 @@
 		goto give_sigsegv;
 
 	/* Set up to return from userspace.  If provided, use a stub
-	   already in userspace.  */
+	   already in userspace. The first words of tramp are used to
+	   save the previous sigrestartblock trampoline that might be
+	   on the stack. We start the sigreturn trampoline at 
+	   SIGRESTARTBLOCK_TRAMP+X. */
 	err |= __put_user(in_syscall ? INSN_LDI_R25_1 : INSN_LDI_R25_0,
-			&frame->tramp[SIGRETURN_TRAMP+0]);
-	err |= __put_user(INSN_LDI_R20, &frame->tramp[SIGRETURN_TRAMP+1]);
-	err |= __put_user(INSN_BLE_SR2_R0, &frame->tramp[SIGRETURN_TRAMP+2]);
-	err |= __put_user(INSN_NOP, &frame->tramp[SIGRETURN_TRAMP+3]);
+			&frame->tramp[SIGRESTARTBLOCK_TRAMP+0]);
+	err |= __put_user(INSN_LDI_R20, 
+			&frame->tramp[SIGRESTARTBLOCK_TRAMP+1]);
+	err |= __put_user(INSN_BLE_SR2_R0, 
+			&frame->tramp[SIGRESTARTBLOCK_TRAMP+2]);
+	err |= __put_user(INSN_NOP, &frame->tramp[SIGRESTARTBLOCK_TRAMP+3]);
 
 #if DEBUG_SIG
 	/* Assert that we're flushing in the correct space... */
@@ -370,12 +375,16 @@
 	}
 #endif
 
-	flush_user_dcache_range((unsigned long) &frame->tramp[SIGRETURN_TRAMP],
+	flush_user_dcache_range((unsigned long) &frame->tramp[0],
 			   (unsigned long) &frame->tramp[TRAMP_SIZE]);
-	flush_user_icache_range((unsigned long) &frame->tramp[SIGRETURN_TRAMP],
+	flush_user_icache_range((unsigned long) &frame->tramp[0],
 			   (unsigned long) &frame->tramp[TRAMP_SIZE]);
 
-	rp = (unsigned long) &frame->tramp[SIGRETURN_TRAMP];
+	/* TRAMP Words 0-4, Lenght 5 = SIGRESTARTBLOCK_TRAMP
+	 * TRAMP Words 5-9, Length 4 = SIGRETURN_TRAMP
+	 * So the SIGRETURN_TRAMP is at the end of SIGRESTARTBLOCK_TRAMP
+	 */
+	rp = (unsigned long) &frame->tramp[SIGRESTARTBLOCK_TRAMP];
 
 	if (err)
 		goto give_sigsegv;
diff -Nru a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
--- a/arch/parisc/kernel/smp.c	Tue Jun 15 22:21:04 2004
+++ b/arch/parisc/kernel/smp.c	Tue Jun 15 22:21:04 2004
@@ -3,7 +3,7 @@
 **
 ** Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
 ** Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com>
-** Copyright (C) 2001 Grant Grundler <grundler@parisc-linux.org>
+** Copyright (C) 2001,2004 Grant Grundler <grundler@parisc-linux.org>
 ** 
 ** Lots of stuff stolen from arch/alpha/kernel/smp.c
 ** ...and then parisc stole from arch/ia64/kernel/smp.c. Thanks David! :^)
@@ -60,20 +60,16 @@
 
 volatile struct task_struct *smp_init_current_idle_task;
 
-static volatile int smp_commenced = 0;   /* Set when the idlers are all forked */
-static volatile int cpu_now_booting = 0;      /* track which CPU is booting */
-cpumask_t cpu_online_map = CPU_MASK_NONE;   /* Bitmap of online CPUs */
-#define IS_LOGGED_IN(cpunum) (cpu_isset(cpunum, cpu_online_map))
+static volatile int cpu_now_booting = 0;	/* track which CPU is booting */
+static int parisc_max_cpus = -1;		/* Command line */
 
-EXPORT_SYMBOL(cpu_online_map);
+unsigned long cache_decay_ticks;	/* declared by include/linux/sched.h */
+cpumask_t cpu_online_map = CPU_MASK_NONE;	/* Bitmap of online CPUs */
+cpumask_t cpu_possible_map = CPU_MASK_NONE;	/* Bitmap of Present CPUs */
 
-int smp_num_cpus = 1;
-int smp_threads_ready = 0;
-unsigned long cache_decay_ticks;
-static int max_cpus = -1;			     /* Command line */
-cpumask_t cpu_present_mask;
+EXPORT_SYMBOL(cpu_online_map);
+EXPORT_SYMBOL(cpu_possible_map);
 
-EXPORT_SYMBOL(cpu_present_mask);
 
 struct smp_call_struct {
 	void (*func) (void *info);
@@ -114,7 +110,7 @@
 
 #error verify IRQ_OFFSET(IPI_IRQ) is ipi_interrupt() in new IRQ region
 
-	if(IS_LOGGED_IN(cpuid) )
+	if(cpu_online(cpuid) )
 	{
 		switch_to_idle_task(current);
 	}
@@ -293,12 +289,13 @@
 {
 	int i;
 	
-	for (i = 0; i < smp_num_cpus; i++) {
-		if (i != smp_processor_id())
+	for (i = 0; i < parisc_max_cpus; i++) {
+		if (cpu_online(i) && i != smp_processor_id())
 			send_IPI_single(i, op);
 	}
 }
 
+
 inline void 
 smp_send_stop(void)	{ send_IPI_allbutself(IPI_CPU_STOP); }
 
@@ -327,12 +324,15 @@
 	struct smp_call_struct data;
 	unsigned long timeout;
 	static spinlock_t lock = SPIN_LOCK_UNLOCKED;
+
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
 	
 	data.func = func;
 	data.info = info;
 	data.wait = wait;
-	atomic_set(&data.unstarted_count, smp_num_cpus - 1);
-	atomic_set(&data.unfinished_count, smp_num_cpus - 1);
+	atomic_set(&data.unstarted_count, num_online_cpus() - 1);
+	atomic_set(&data.unfinished_count, num_online_cpus() - 1);
 
 	if (retry) {
 		spin_lock (&lock);
@@ -392,7 +392,7 @@
 
 static int __init nosmp(char *str)
 {
-	max_cpus = 0;
+	parisc_max_cpus = 0;
 	return 1;
 }
 
@@ -400,7 +400,7 @@
 
 static int __init maxcpus(char *str)
 {
-	get_option(&str, &max_cpus);
+	get_option(&str, &parisc_max_cpus);
 	return 1;
 }
 
@@ -496,17 +496,13 @@
 
 	local_irq_enable();  /* Interrupts have been off until now */
 
-	/* Slaves wait here until Big Poppa daddy say "jump" */
-	mb();	/* PARANOID */
-	while (!smp_commenced) ;
-	mb();	/* PARANOID */
-
 	cpu_idle();      /* Wait for timer to schedule some work */
 
 	/* NOTREACHED */
 	panic("smp_callin() AAAAaaaaahhhh....\n");
 }
 
+#if 0
 /*
  * Create the idle task for a new Slave CPU.  DO NOT use kernel_thread()
  * because that could end up calling schedule(). If it did, the new idle
@@ -528,7 +524,7 @@
 /*
  * Bring one cpu online.
  */
-static int __init smp_boot_one_cpu(int cpuid, int cpunum)
+int __init smp_boot_one_cpu(int cpuid, int cpunum)
 {
 	struct task_struct *idle;
 	long timeout;
@@ -573,12 +569,11 @@
 
 	/* 
 	 * OK, wait a bit for that CPU to finish staggering about. 
-	 * Slave will set a bit when it reaches smp_cpu_init() and then
-	 * wait for smp_commenced to be 1.
-	 * Once we see the bit change, we can move on.
+	 * Slave will set a bit when it reaches smp_cpu_init().
+	 * Once the "monarch CPU" sees the bit change, it can move on.
 	 */
 	for (timeout = 0; timeout < 10000; timeout++) {
-		if(IS_LOGGED_IN(cpunum)) {
+		if(cpu_online(cpunum)) {
 			/* Which implies Slave has started up */
 			cpu_now_booting = 0;
 			smp_init_current_idle_task = NULL;
@@ -605,120 +600,56 @@
 #endif
 	return 0;
 }
+#endif
 
 
-
-
-/*
-** inventory.c:do_inventory() has already 'discovered' the additional CPU's.
-** We are ready to wrest them from PDC's control now.
-** Called by smp_init bring all the secondaries online and hold them.  
-**
-** o Setup of the IPI irq handler is done in irq.c.
-** o MEM_RENDEZ is initialzed in head.S:stext()
-**
-*/
-void __init smp_boot_cpus(void)
+void __devinit smp_prepare_boot_cpu(void)
 {
-	int i, cpu_count = 1;
-	unsigned long bogosum = cpu_data[0].loops_per_jiffy; /* Count Monarch */
-
-	/* REVISIT - assumes first CPU reported by PAT PDC is BSP */
 	int bootstrap_processor=cpu_data[0].cpuid;	/* CPU ID of BSP */
 
+#ifdef ENTRY_SYS_CPUS
+	cpu_data[0].state = STATE_RUNNING;
+#endif
+
 	/* Setup BSP mappings */
 	printk(KERN_DEBUG "SMP: bootstrap CPU ID is %d\n",bootstrap_processor);
 	init_task.thread_info->cpu = bootstrap_processor; 
 	current->thread_info->cpu = bootstrap_processor;
-	/* Mark Boostrap processor as present */
-	cpu_online_map = cpumask_of_cpu(bootstrap_processor);
-	current->active_mm = &init_mm;
 
-#ifdef ENTRY_SYS_CPUS
-	cpu_data[0].state = STATE_RUNNING;
-#endif
-	cpu_present_mask = cpumask_of_cpu(bootstrap_processor);
+	cpu_set(bootstrap_processor, cpu_online_map);
+	cpu_set(bootstrap_processor, cpu_possible_map);
 
-	/* Nothing to do when told not to.  */
-	if (max_cpus == 0) {
-		printk(KERN_INFO "SMP mode deactivated.\n");
-		return;
-	}
+	/* Mark Boostrap processor as present */
+	current->active_mm = &init_mm;
 
-	if (max_cpus != -1) 
-		printk(KERN_INFO "Limiting CPUs to %d\n", max_cpus);
+	cache_decay_ticks = HZ/100;	/* FIXME very rough.  */
+}
 
-	/* We found more than one CPU.... */
-	if (boot_cpu_data.cpu_count > 1) {
 
-		for (i = 0; i < NR_CPUS; i++) {
-			if (cpu_data[i].cpuid == NO_PROC_ID || 
-			    cpu_data[i].cpuid == bootstrap_processor)
-				continue;
 
-			if (smp_boot_one_cpu(cpu_data[i].cpuid, cpu_count) < 0)
-				continue;
-
-			bogosum += cpu_data[i].loops_per_jiffy;
-			cpu_count++; /* Count good CPUs only... */
-			
-			cpu_present_mask |= 1UL << i;
-			
-			/* Bail when we've started as many CPUS as told to */
-			if (cpu_count == max_cpus)
-				break;
-		}
-	}
-	if (cpu_count == 1) {
-		printk(KERN_INFO "SMP: Bootstrap processor only.\n");
-	}
+/*
+** inventory.c:do_inventory() hasn't yet been run and thus we
+** don't 'discover' the additional CPU's until later.
+*/
+void __init smp_prepare_cpus(unsigned int max_cpus)
+{
 
-	/*
-	 * FIXME very rough.
-	 */
-	cache_decay_ticks = HZ/100;
+	if (max_cpus != -1) 
+		printk(KERN_INFO "SMP: Limited to %d CPUs\n", max_cpus);
 
-	printk(KERN_INFO "SMP: Total %d of %d processors activated "
-	       "(%lu.%02lu BogoMIPS noticed) (Present Mask: %lu).\n",
-	       cpu_count, boot_cpu_data.cpu_count, (bogosum + 25) / 5000,
-	       ((bogosum + 25) / 50) % 100, cpu_present_mask);
+	printk(KERN_INFO "SMP: Monarch CPU activated (%lu.%02lu BogoMIPS)\n",
+	       (cpu_data[0].loops_per_jiffy + 25) / 5000,
+	       ((cpu_data[0].loops_per_jiffy + 25) / 50) % 100);
 
-	smp_num_cpus = cpu_count;
-#ifdef PER_CPU_IRQ_REGION
-	ipi_init();
-#endif
 	return;
 }
 
-/* 
- * Called from main.c by Monarch Processor.
- * After this, any CPU can schedule any task.
- */
-void smp_commence(void)
-{
-	smp_commenced = 1;
-	mb();
-	return;
-}
 
-/*
- * XXX FIXME : do nothing
- */
 void smp_cpus_done(unsigned int cpu_max)
 {
-	smp_threads_ready = 1;
-}
-
-void __init smp_prepare_cpus(unsigned int max_cpus)
-{
-	smp_boot_cpus();
+	return;
 }
 
-void __devinit smp_prepare_boot_cpu(void)
-{
-	cpu_set(smp_processor_id(), cpu_online_map);
-	cpu_set(smp_processor_id(), cpu_present_mask);
-}
 
 int __devinit __cpu_up(unsigned int cpu)
 {
@@ -745,7 +676,7 @@
 #ifdef DUMP_MORE_STATE
 		for(i=0; i<NR_CPUS; i++) {
 			int cpus_per_line = 4;
-			if(IS_LOGGED_IN(i)) {
+			if(cpu_online(i)) {
 				if (j++ % cpus_per_line)
 					printk(" %3d",i);
 				else
@@ -760,7 +691,7 @@
 		printk("\nCPUSTATE  TASK CPUNUM CPUID HARDCPU(HPA)\n");
 #ifdef DUMP_MORE_STATE
 		for(i=0;i<NR_CPUS;i++) {
-			if (!IS_LOGGED_IN(i))
+			if (!cpu_online(i))
 				continue;
 			if (cpu_data[i].cpuid != NO_PROC_ID) {
 				switch(cpu_data[i].state) {
@@ -780,7 +711,7 @@
 						printk("%08x?", cpu_data[i].state);
 						break;
 				}
-				if(IS_LOGGED_IN(i)) {
+				if(cpu_online(i)) {
 					printk(" %4d",current_pid(i));
 				}	
 				printk(" %6d",cpu_number_map(i));
@@ -796,7 +727,7 @@
 #ifdef DUMP_MORE_STATE
      		printk("\nCPUSTATE   CPUID\n");
 		for (i=0;i<NR_CPUS;i++) {
-			if (!IS_LOGGED_IN(i))
+			if (!cpu_online(i))
 				continue;
 			if (cpu_data[i].cpuid != NO_PROC_ID) {
 				switch(cpu_data[i].state) {
diff -Nru a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
--- a/arch/parisc/kernel/sys_parisc.c	Tue Jun 15 22:20:44 2004
+++ b/arch/parisc/kernel/sys_parisc.c	Tue Jun 15 22:20:44 2004
@@ -68,17 +68,8 @@
  * existing mapping and use the same offset.  New scheme is to use the
  * address of the kernel data structure as the seed for the offset.
  * We'll see how that works...
- */
-#if 0
-static int get_offset(struct address_space *mapping)
-{
-	struct vm_area_struct *vma = list_entry(mapping->i_mmap_shared.next,
-			struct vm_area_struct, shared);
-	return (vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT)) &
-		(SHMLBA - 1);
-}
-#else
-/* The mapping is cacheline aligned, so there's no information in the bottom
+ *
+ * The mapping is cacheline aligned, so there's no information in the bottom
  * few bits of the address.  We're looking for 10 bits (4MB / 4k), so let's
  * drop the bottom 8 bits and use bits 8-17.  
  */
@@ -87,13 +78,12 @@
 	int offset = (unsigned long) mapping << (PAGE_SHIFT - 8);
 	return offset & 0x3FF000;
 }
-#endif
 
 static unsigned long get_shared_area(struct address_space *mapping,
 		unsigned long addr, unsigned long len, unsigned long pgoff)
 {
 	struct vm_area_struct *vma;
-	int offset = get_offset(mapping);
+	int offset = mapping ? get_offset(mapping) : 0;
 
 	addr = DCACHE_ALIGN(addr - offset) + offset;
 
@@ -117,8 +107,10 @@
 	if (!addr)
 		addr = TASK_UNMAPPED_BASE;
 
-	if (filp && (flags & MAP_SHARED)) {
+	if (filp) {
 		addr = get_shared_area(filp->f_mapping, addr, len, pgoff);
+	} else if(flags & MAP_SHARED) {
+		addr = get_shared_area(NULL, addr, len, pgoff);
 	} else {
 		addr = get_unshared_area(addr, len);
 	}
diff -Nru a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
--- a/arch/parisc/kernel/sys_parisc32.c	Tue Jun 15 22:20:38 2004
+++ b/arch/parisc/kernel/sys_parisc32.c	Tue Jun 15 22:20:38 2004
@@ -65,189 +65,6 @@
 #endif
 
 /*
- * count32() counts the number of arguments/envelopes. It is basically
- *           a copy of count() from fs/exec.c, except that it works
- *           with 32 bit argv and envp pointers.
- */
-
-static int count32(u32 *argv, int max)
-{
-	int i = 0;
-
-	if (argv != NULL) {
-		for (;;) {
-			u32 p;
-			int error;
-
-			error = get_user(p,argv);
-			if (error)
-				return error;
-			if (!p)
-				break;
-			argv++;
-			if(++i > max)
-				return -E2BIG;
-		}
-	}
-	return i;
-}
-
-
-/*
- * copy_strings32() is basically a copy of copy_strings() from fs/exec.c
- *                  except that it works with 32 bit argv and envp pointers.
- */
-
-
-static int copy_strings32(int argc, u32 *argv, struct linux_binprm *bprm)
-{
-	while (argc-- > 0) {
-		u32 str;
-		int len;
-		unsigned long pos;
-
-		if (get_user(str, argv + argc) ||
-		    !str ||
-		    !(len = strnlen_user((char *)compat_ptr(str), bprm->p)))
-			return -EFAULT;
-
-		if (bprm->p < len) 
-			return -E2BIG; 
-
-		bprm->p -= len;
-
-		pos = bprm->p;
-		while (len > 0) {
-			char *kaddr;
-			int i, new, err;
-			struct page *page;
-			int offset, bytes_to_copy;
-
-			offset = pos % PAGE_SIZE;
-			i = pos/PAGE_SIZE;
-			page = bprm->page[i];
-			new = 0;
-			if (!page) {
-				page = alloc_page(GFP_HIGHUSER);
-				bprm->page[i] = page;
-				if (!page)
-					return -ENOMEM;
-				new = 1;
-			}
-			kaddr = (char *)kmap(page);
-
-			if (new && offset)
-				memset(kaddr, 0, offset);
-			bytes_to_copy = PAGE_SIZE - offset;
-			if (bytes_to_copy > len) {
-				bytes_to_copy = len;
-				if (new)
-					memset(kaddr+offset+len, 0, PAGE_SIZE-offset-len);
-			}
-			err = copy_from_user(kaddr + offset, (char *)compat_ptr(str), bytes_to_copy);
-			flush_dcache_page(page);
-			kunmap(page);
-
-			if (err)
-				return -EFAULT; 
-
-			pos += bytes_to_copy;
-			str += bytes_to_copy;
-			len -= bytes_to_copy;
-		}
-	}
-	return 0;
-}
-
-/*
- * do_execve32() is mostly a copy of do_execve(), with the exception
- * that it processes 32 bit argv and envp pointers.
- */
-
-static inline int 
-do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs)
-{
-	struct linux_binprm bprm;
-	struct file *file;
-	int retval;
-	int i;
-
-	file = open_exec(filename);
-
-	retval = PTR_ERR(file);
-	if (IS_ERR(file))
-		return retval;
-
-	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
-	memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));
-
-	DBG(("do_execve32(%s, %p, %p, %p)\n", filename, argv, envp, regs));
-
-	bprm.file = file;
-	bprm.filename = filename;
-	bprm.interp = filename;
-	bprm.sh_bang = 0;
-	bprm.loader = 0;
-	bprm.exec = 0;
-
-	bprm.mm = mm_alloc();
-	retval = -ENOMEM;
-	if (!bprm.mm)
-		goto out_file;
-
-	retval = init_new_context(current, bprm.mm);
-	if (retval < 0)
-		goto out_mm;
-
-	if ((bprm.argc = count32(argv, bprm.p / sizeof(u32))) < 0) 
-		goto out_mm;
-
-	if ((bprm.envc = count32(envp, bprm.p / sizeof(u32))) < 0) 
-		goto out_mm;
-
-	retval = prepare_binprm(&bprm);
-	if (retval < 0)
-		goto out;
-	
-	retval = copy_strings_kernel(1, &bprm.filename, &bprm);
-	if (retval < 0)
-		goto out;
-
-	bprm.exec = bprm.p;
-	retval = copy_strings32(bprm.envc, envp, &bprm);
-	if (retval < 0)
-		goto out;
-
-	retval = copy_strings32(bprm.argc, argv, &bprm);
-	if (retval < 0)
-		goto out;
-
-	retval = search_binary_handler(&bprm,regs);
-	if (retval >= 0)
-		/* execve success */
-		return retval;
-
-out:
-	/* Something went wrong, return the inode and free the argument pages*/
-	for (i = 0; i < MAX_ARG_PAGES; i++) {
-		struct page *page = bprm.page[i];
-		if (page)
-			__free_page(page);
-	}
-
-out_mm:
-	mmdrop(bprm.mm);
-
-out_file:
-	if (bprm.file) {
-		allow_write_access(bprm.file);
-		fput(bprm.file);
-	}
-
-	return retval;
-}
-
-/*
  * sys32_execve() executes a new program.
  */
 
@@ -261,8 +78,8 @@
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
-	error = do_execve32(filename, (u32 *) regs->gr[25],
-		(u32 *) regs->gr[24], regs);
+	error = compat_do_execve(filename, compat_ptr(regs->gr[25]),
+				 compat_ptr(regs->gr[24]), regs);
 	if (error == 0)
 		current->ptrace &= ~PT_DTRACE;
 	putname(filename);
@@ -609,149 +426,6 @@
 	return error;
 }
 
-/* readv/writev stolen from mips64 */
-typedef ssize_t (*IO_fn_t)(struct file *, char *, size_t, loff_t *);
-
-static long
-do_readv_writev32(int type, struct file *file, const struct compat_iovec *vector,
-		  u32 count)
-{
-	unsigned long tot_len;
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov=iovstack, *ivp;
-	struct inode *inode;
-	long retval, i;
-	IO_fn_t fn;
-
-	/* First get the "struct iovec" from user memory and
-	 * verify all the pointers
-	 */
-	if (!count)
-		return 0;
-	if(verify_area(VERIFY_READ, vector, sizeof(struct compat_iovec)*count))
-		return -EFAULT;
-	if (count > UIO_MAXIOV)
-		return -EINVAL;
-	if (count > UIO_FASTIOV) {
-		iov = kmalloc(count*sizeof(struct iovec), GFP_KERNEL);
-		if (!iov)
-			return -ENOMEM;
-	}
-
-	tot_len = 0;
-	i = count;
-	ivp = iov;
-	while (i > 0) {
-		u32 len;
-		u32 buf;
-
-		__get_user(len, &vector->iov_len);
-		__get_user(buf, &vector->iov_base);
-		tot_len += len;
-		ivp->iov_base = compat_ptr(buf);
-		ivp->iov_len = (compat_size_t) len;
-		vector++;
-		ivp++;
-		i--;
-	}
-
-	inode = file->f_dentry->d_inode;
-	/* VERIFY_WRITE actually means a read, as we write to user space */
-	retval = locks_verify_area((type == VERIFY_WRITE
-				    ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE),
-				   inode, file, file->f_pos, tot_len);
-	if (retval) {
-		if (iov != iovstack)
-			kfree(iov);
-		return retval;
-	}
-
-	/* Then do the actual IO.  Note that sockets need to be handled
-	 * specially as they have atomicity guarantees and can handle
-	 * iovec's natively
-	 */
-	if (inode->i_sock) {
-		int err;
-		err = sock_readv_writev(type, inode, file, iov, count, tot_len);
-		if (iov != iovstack)
-			kfree(iov);
-		return err;
-	}
-
-	if (!file->f_op) {
-		if (iov != iovstack)
-			kfree(iov);
-		return -EINVAL;
-	}
-	/* VERIFY_WRITE actually means a read, as we write to user space */
-	fn = file->f_op->read;
-	if (type == VERIFY_READ)
-		fn = (IO_fn_t) file->f_op->write;		
-	ivp = iov;
-	while (count > 0) {
-		void * base;
-		int len, nr;
-
-		base = ivp->iov_base;
-		len = ivp->iov_len;
-		ivp++;
-		count--;
-		nr = fn(file, base, len, &file->f_pos);
-		if (nr < 0) {
-			if (retval)
-				break;
-			retval = nr;
-			break;
-		}
-		retval += nr;
-		if (nr != len)
-			break;
-	}
-	if (iov != iovstack)
-		kfree(iov);
-
-	return retval;
-}
-
-asmlinkage long
-sys32_readv(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct file *file;
-	ssize_t ret;
-
-	ret = -EBADF;
-	file = fget(fd);
-	if (!file)
-		goto bad_file;
-	if (file->f_op && (file->f_mode & FMODE_READ) &&
-	    (file->f_op->readv || file->f_op->read))
-		ret = do_readv_writev32(VERIFY_WRITE, file, vector, count);
-
-	fput(file);
-
-bad_file:
-	return ret;
-}
-
-asmlinkage long
-sys32_writev(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct file *file;
-	ssize_t ret;
-
-	ret = -EBADF;
-	file = fget(fd);
-	if(!file)
-		goto bad_file;
-	if (file->f_op && (file->f_mode & FMODE_WRITE) &&
-	    (file->f_op->writev || file->f_op->write))
-	        ret = do_readv_writev32(VERIFY_READ, file, vector, count);
-	fput(file);
-
-bad_file:
-	return ret;
-}
-
 /*** copied from mips64 ***/
 /*
  * Ooo, nasty.  We need here to frob 32-bit unsigned longs to
@@ -814,126 +488,6 @@
 		__put_user(*fdset, ufdset);
 }
 
-/*** This is a virtual copy of sys_select from fs/select.c and probably
- *** should be compared to it from time to time
- ***/
-static inline void *select_bits_alloc(int size)
-{
-	return kmalloc(6 * size, GFP_KERNEL);
-}
-
-static inline void select_bits_free(void *bits, int size)
-{
-	kfree(bits);
-}
-
-/*
- * We can actually return ERESTARTSYS instead of EINTR, but I'd
- * like to be certain this leads to no problems. So I return
- * EINTR just for safety.
- *
- * Update: ERESTARTSYS breaks at least the xview clock binary, so
- * I'm trying ERESTARTNOHAND which restart only when you want to.
- */
-#define MAX_SELECT_SECONDS \
-	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-#define DIVIDE_ROUND_UP(x,y) (((x)+(y)-1)/(y))
-
-asmlinkage long
-sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, struct compat_timeval *tvp)
-{
-	fd_set_bits fds;
-	char *bits;
-	long timeout;
-	int ret, size, err;
-
-	timeout = MAX_SCHEDULE_TIMEOUT;
-	if (tvp) {
-		struct compat_timeval tv32;
-		time_t sec, usec;
-
-		if ((ret = copy_from_user(&tv32, tvp, sizeof tv32)))
-			goto out_nofds;
-
-		sec = tv32.tv_sec;
-		usec = tv32.tv_usec;
-
-		ret = -EINVAL;
-		if (sec < 0 || usec < 0)
-			goto out_nofds;
-
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
-			timeout = DIVIDE_ROUND_UP(usec, 1000000/HZ);
-			timeout += sec * (unsigned long) HZ;
-		}
-	}
-
-	ret = -EINVAL;
-	if (n < 0)
-		goto out_nofds;
-
-	if (n > current->files->max_fdset)
-		n = current->files->max_fdset;
-
-	/*
-	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
-	 * since we used fdset we need to allocate memory in units of
-	 * long-words. 
-	 */
-	ret = -ENOMEM;
-	size = FDS_BYTES(n);
-	bits = select_bits_alloc(size);
-	if (!bits)
-		goto out_nofds;
-	fds.in      = (unsigned long *)  bits;
-	fds.out     = (unsigned long *) (bits +   size);
-	fds.ex      = (unsigned long *) (bits + 2*size);
-	fds.res_in  = (unsigned long *) (bits + 3*size);
-	fds.res_out = (unsigned long *) (bits + 4*size);
-	fds.res_ex  = (unsigned long *) (bits + 5*size);
-
-	if ((ret = get_fd_set32(n, inp, fds.in)) ||
-	    (ret = get_fd_set32(n, outp, fds.out)) ||
-	    (ret = get_fd_set32(n, exp, fds.ex)))
-		goto out;
-	zero_fd_set(n, fds.res_in);
-	zero_fd_set(n, fds.res_out);
-	zero_fd_set(n, fds.res_ex);
-
-	ret = do_select(n, &fds, &timeout);
-
-	if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
-		time_t sec = 0, usec = 0;
-		if (timeout) {
-			sec = timeout / HZ;
-			usec = timeout % HZ;
-			usec *= (1000000/HZ);
-		}
-		err = put_user(sec, &tvp->tv_sec);
-		err |= __put_user(usec, &tvp->tv_usec);
-		if (err)
-			ret = -EFAULT;
-	}
-
-	if (ret < 0)
-		goto out;
-	if (!ret) {
-		ret = -ERESTARTNOHAND;
-		if (signal_pending(current))
-			goto out;
-		ret = 0;
-	}
-
-	set_fd_set32(n, inp, fds.res_in);
-	set_fd_set32(n, outp, fds.res_out);
-	set_fd_set32(n, exp, fds.res_ex);
-
-out:
-	select_bits_free(bits, size);
-out_nofds:
-	return ret;
-}
-
 struct msgbuf32 {
     int mtype;
     char mtext[1];
@@ -991,7 +545,6 @@
 	return err;
 }
 
-
 asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
 {
         mm_segment_t old_fs = get_fs();
@@ -1009,94 +562,6 @@
                 return -EFAULT;
 
         return ret;
-}
-
-/* EXPORT/UNEXPORT */
-struct nfsctl_export32 {
-	char		ex_client[NFSCLNT_IDMAX+1];
-	char		ex_path[NFS_MAXPATHLEN+1];
-	__kernel_old_dev_t ex_dev;
-	compat_ino_t	ex_ino;
-	int		ex_flags;
-	__kernel_uid_t	ex_anon_uid;
-	__kernel_gid_t	ex_anon_gid;
-};
-
-struct nfsctl_arg32 {
-	int			ca_version;	/* safeguard */
-	/* wide kernel places this union on 8-byte boundary, narrow on 4 */
-	union {
-		struct nfsctl_svc	u_svc;
-		struct nfsctl_client	u_client;
-		struct nfsctl_export32	u_export;
-		struct nfsctl_fdparm	u_getfd;
-		struct nfsctl_fsparm	u_getfs;
-	} u;
-};
-
-asmlinkage int sys32_nfsservctl(int cmd, void *argp, void *resp)
-{
-	int ret, tmp;
-	struct nfsctl_arg32 n32;
-	struct nfsctl_arg n;
-
-	ret = copy_from_user(&n, argp, sizeof n.ca_version);
-	if (ret != 0)
-		return ret;
-
-	/* adjust argp to point at the union inside the user's n32 struct */
-	tmp = (unsigned long)&n32.u - (unsigned long)&n32;
-	argp = (void *)((unsigned long)argp + tmp);
-	switch(cmd) {
-	case NFSCTL_SVC:
-		ret = copy_from_user(&n.u, argp, sizeof n.u.u_svc);
-		break;
-
-	case NFSCTL_ADDCLIENT:
-	case NFSCTL_DELCLIENT:
-		ret = copy_from_user(&n.u, argp, sizeof n.u.u_client);
-		break;
-
-	case NFSCTL_GETFD:
-		ret = copy_from_user(&n.u, argp, sizeof n.u.u_getfd);
-		break;
-
-	case NFSCTL_GETFS:
-		ret = copy_from_user(&n.u, argp, sizeof n.u.u_getfs);
-		break;
-
-	case NFSCTL_UNEXPORT:		/* nfsctl_export */
-	case NFSCTL_EXPORT:		/* nfsctl_export */
-		ret = copy_from_user(&n32.u, argp, sizeof n32.u.u_export);
-#undef CP
-#define CP(x)	n.u.u_export.ex_##x = n32.u.u_export.ex_##x
-		memcpy(n.u.u_export.ex_client, n32.u.u_export.ex_client, sizeof n32.u.u_export.ex_client);
-		memcpy(n.u.u_export.ex_path, n32.u.u_export.ex_path, sizeof n32.u.u_export.ex_path);
-		CP(dev);
-		CP(ino);
-		CP(flags);
-		CP(anon_uid);
-		CP(anon_gid);
-		break;
-
-	default:
-		/* lockd probes for some other values (0x10000);
-		 * so don't BUG() */
-		ret = -EINVAL;
-		break;
-	}
-
-	if (ret == 0) {
-		unsigned char rbuf[NFS_FHSIZE + sizeof (struct knfsd_fh)];
-		KERNEL_SYSCALL(ret, sys_nfsservctl, cmd, &n, &rbuf);
-		if (cmd == NFSCTL_GETFD) {
-			ret = copy_to_user(resp, rbuf, NFS_FHSIZE);
-		} else if (cmd == NFSCTL_GETFS) {
-			ret = copy_to_user(resp, rbuf, sizeof (struct knfsd_fh));
-		}
-	}
-
-	return ret;
 }
 
 typedef long __kernel_loff_t32;		/* move this to asm/posix_types.h? */
diff -Nru a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
--- a/arch/parisc/kernel/syscall.S	Tue Jun 15 22:21:05 2004
+++ b/arch/parisc/kernel/syscall.S	Tue Jun 15 22:21:05 2004
@@ -155,9 +155,10 @@
 	stw     %r21, -56(%r30)                 /* 6th argument */
 #endif
 
+	/* Are we being ptraced? */
 	mfctl	%cr30, %r1
-	LDREG	TI_FLAGS(%r1), %r19
-	bb,<,n	%r19,31-TIF_SYSCALL_TRACE,.Ltracesys
+	LDREG	TASK_PTRACE(%r1), %r1
+	bb,<,n	%r1,31,.Ltracesys
 	
 	/* Note!  We cannot use the syscall table that is mapped
 	nearby since the gateway page is mapped execute-only. */
diff -Nru a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
--- a/arch/parisc/kernel/syscall_table.S	Tue Jun 15 22:20:36 2004
+++ b/arch/parisc/kernel/syscall_table.S	Tue Jun 15 22:20:36 2004
@@ -232,12 +232,12 @@
 	ENTRY_DIFF(getdents)
 	/* it is POSSIBLE that select will be OK because even though fd_set
 	 * contains longs, the macros and sizes are clever. */
-	ENTRY_DIFF(select)
+	ENTRY_COMP(select)
 	ENTRY_SAME(flock)
 	ENTRY_SAME(msync)
 	/* struct iovec contains pointers */
-	ENTRY_DIFF(readv)		/* 145 */
-	ENTRY_DIFF(writev)
+	ENTRY_COMP(readv)		/* 145 */
+	ENTRY_COMP(writev)
 	ENTRY_SAME(getsid)
 	ENTRY_SAME(fdatasync)
 	/* struct __sysctl_args is a mess */
@@ -266,7 +266,7 @@
 	ENTRY_SAME(ni_syscall)		/* query_module */
 	ENTRY_SAME(poll)
 	/* structs contain pointers and an in_addr... */
-	ENTRY_DIFF(nfsservctl)
+	ENTRY_COMP(nfsservctl)
 	ENTRY_SAME(setresgid)		/* 170 */
 	ENTRY_SAME(getresgid)
 	ENTRY_SAME(prctl)
@@ -334,3 +334,12 @@
 	ENTRY_SAME(epoll_ctl)		/* 225 */
 	ENTRY_SAME(epoll_wait)
  	ENTRY_SAME(remap_file_pages)
+  ENTRY_SAME(semtimedop)
+  ENTRY_SAME(mq_open)
+  ENTRY_SAME(mq_unlink)   /* 230 */
+  ENTRY_SAME(mq_timedsend)
+  ENTRY_SAME(mq_timedreceive)
+  ENTRY_SAME(mq_notify)
+  ENTRY_SAME(mq_getsetattr)
+  /* Nothing yet */       /* 235 */
+
diff -Nru a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/parisc/kernel/unwind.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,295 @@
+/*
+ * Kernel unwinding support
+ *
+ * (c) 2002-2004 Randolph Chung <tausq@debian.org>
+ *
+ * Derived partially from the IA64 implementation. The PA-RISC
+ * Runtime Architecture Document is also a useful reference to
+ * understand what is happening here
+ */
+
+/*
+ * J. David Anglin writes:
+ *
+ * "You have to adjust the current sp to that at the begining of the function.
+ * There can be up to two stack additions to allocate the frame in the
+ * prologue.  Similar things happen in the epilogue.  In the presence of
+ * interrupts, you have to be concerned about where you are in the function
+ * and what stack adjustments have taken place."
+ *
+ * For now these cases are not handled, but they should be!
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+
+#include <asm/uaccess.h>
+
+#include <asm/unwind.h>
+
+/* #define DEBUG 1 */
+#ifdef DEBUG
+#define dbg(x...) printk(x)
+#else
+#define dbg(x...)
+#endif
+
+extern const struct unwind_table_entry __start___unwind[];
+extern const struct unwind_table_entry __stop___unwind[];
+
+static spinlock_t unwind_lock;
+/*
+ * the kernel unwind block is not dynamically allocated so that
+ * we can call unwind_init as early in the bootup process as 
+ * possible (before the slab allocator is initialized)
+ */
+static struct unwind_table kernel_unwind_table;
+static struct unwind_table *unwind_tables, *unwind_tables_end;
+
+
+static inline const struct unwind_table_entry *
+find_unwind_entry_in_table(const struct unwind_table *table, unsigned long addr)
+{
+	const struct unwind_table_entry *e = 0;
+	unsigned long lo, hi, mid;
+
+	addr -= table->base_addr;
+
+	for (lo = 0, hi = table->length; lo < hi; )
+	{
+		mid = (lo + hi) / 2;
+		e = &table->table[mid];
+		if (addr < e->region_start)
+			hi = mid;
+		else if (addr > e->region_end)
+			lo = mid + 1;
+		else
+			break;
+	}
+
+	return e;
+}
+
+static inline const struct unwind_table_entry *
+find_unwind_entry(unsigned long addr)
+{
+	struct unwind_table *table = unwind_tables;
+	const struct unwind_table_entry *e = NULL;
+
+	if (addr >= kernel_unwind_table.start && 
+	    addr <= kernel_unwind_table.end)
+		e = find_unwind_entry_in_table(&kernel_unwind_table, addr);
+	else
+		for (; table; table = table->next)
+		{
+			if (addr >= table->start && 
+			    addr <= table->end)
+				e = find_unwind_entry_in_table(table, addr);
+			if (e)
+				break;
+		}
+
+	return e;
+}
+
+static void
+unwind_table_init(struct unwind_table *table, const char *name,
+		  unsigned long base_addr, unsigned long gp,
+		  const void *table_start, const void *table_end)
+{
+	const struct unwind_table_entry *start = table_start;
+	const struct unwind_table_entry *end = table_end - 1;
+
+	table->name = name;
+	table->base_addr = base_addr;
+	table->gp = gp;
+	table->start = base_addr + start->region_start;
+	table->end = base_addr + end->region_end;
+	table->table = (struct unwind_table_entry *)table_start;
+	table->length = end - start;
+	table->next = NULL;
+}
+
+void *
+unwind_table_add(const char *name, unsigned long base_addr, 
+		 unsigned long gp,
+                 const void *start, const void *end)
+{
+	struct unwind_table *table;
+	unsigned long flags;
+
+	table = kmalloc(sizeof(struct unwind_table), GFP_USER);
+	if (table == NULL)
+		return 0;
+	unwind_table_init(table, name, base_addr, gp, start, end);
+	spin_lock_irqsave(&unwind_lock, flags);
+	if (unwind_tables)
+	{
+		unwind_tables_end->next = table;
+		unwind_tables_end = table;
+	}
+	else
+	{
+		unwind_tables = unwind_tables_end = table;
+	}
+	spin_unlock_irqrestore(&unwind_lock, flags);
+
+	return table;
+}
+
+/* Called from setup_arch to import the kernel unwind info */
+static int unwind_init(void)
+{
+	long start, stop;
+	register unsigned long gp __asm__ ("r27");
+
+	start = (long)&__start___unwind[0];
+	stop = (long)&__stop___unwind[0];
+
+	printk("unwind_init: start = 0x%lx, end = 0x%lx, entries = %lu\n", 
+	    start, stop,
+	    (stop - start) / sizeof(struct unwind_table_entry));
+
+	unwind_table_init(&kernel_unwind_table, "kernel", KERNEL_START,
+			  gp, 
+			  &__start___unwind[0], &__stop___unwind[0]);
+#if 0
+	{
+		int i;
+		for (i = 0; i < 10; i++)
+		{
+			printk("region 0x%x-0x%x\n", 
+				__start___unwind[i].region_start, 
+				__start___unwind[i].region_end);
+		}
+	}
+#endif
+	return 0;
+}
+
+static void unwind_frame_regs(struct unwind_frame_info *info)
+{
+	const struct unwind_table_entry *e;
+	unsigned long npc;
+	unsigned int insn;
+	long frame_size = 0;
+	int looking_for_rp, rpoffset = 0;
+
+	e = find_unwind_entry(info->ip);
+	if (!e) {
+		unsigned long sp;
+		extern char _stext[], _etext[];
+
+		dbg("Cannot find unwind entry for 0x%lx; forced unwinding\n", info->ip);
+
+		/* Since we are doing the unwinding blind, we don't know if
+		   we are adjusting the stack correctly or extracting the rp
+		   correctly. The rp is checked to see if it belongs to the
+		   kernel text section, if not we assume we don't have a 
+		   correct stack frame and we continue to unwind the stack.
+		   This is not quite correct, and will fail for loadable
+		   modules. */
+		sp = info->sp & ~63;
+		do {
+			info->prev_sp = sp - 64;
+
+			/* FIXME: what happens if we unwind too far so that 
+			   sp no longer falls in a mapped kernel page? */
+#ifndef __LP64__
+			info->prev_ip = *(unsigned long *)(info->prev_sp - 20);
+#else
+			info->prev_ip = *(unsigned long *)(info->prev_sp - 16);
+#endif
+
+			sp = info->prev_sp;
+		} while (info->prev_ip < (unsigned long)_stext ||
+			 info->prev_ip > (unsigned long)_etext);
+	} else {
+
+		dbg("e->start = 0x%x, e->end = 0x%x, Save_SP = %d, Save_RP = %d size = %u\n",
+				e->region_start, e->region_end, e->Save_SP, e->Save_RP, e->Total_frame_size);
+
+		looking_for_rp = e->Save_RP;
+
+		for (npc = e->region_start; 
+		     (frame_size < (e->Total_frame_size << 3) || looking_for_rp) && 
+		     npc < info->ip; 
+		     npc += 4) {
+
+			insn = *(unsigned int *)npc;
+
+			if ((insn & 0xffffc000) == 0x37de0000 ||
+			    (insn & 0xffe00000) == 0x6fc00000) {
+				/* ldo X(sp), sp, or stwm X,D(sp) */
+				frame_size += (insn & 0x1 ? -1 << 13 : 0) | 
+					((insn & 0x3fff) >> 1);
+			} else if ((insn & 0xffe00008) == 0x7ec00008) {
+				/* std,ma X,D(sp) */
+				frame_size += (insn & 0x1 ? -1 << 13 : 0) | 
+					(((insn >> 4) & 0x3ff) << 3);
+			} else if (insn == 0x6bc23fd9) { 
+				/* stw rp,-20(sp) */
+				rpoffset = 20;
+				looking_for_rp = 0;
+			} else if (insn == 0x0fc212c1) {
+				/* std rp,-16(sr0,sp) */
+				rpoffset = 16;
+				looking_for_rp = 0;
+			}
+		}
+
+		info->prev_sp = info->sp - frame_size;
+		if (rpoffset)
+			info->prev_ip = *(unsigned long *)(info->prev_sp - rpoffset);
+	}
+}
+
+void unwind_frame_init(struct unwind_frame_info *info, struct task_struct *t, 
+		       struct pt_regs *regs)
+{
+	memset(info, 0, sizeof(struct unwind_frame_info));
+	info->t = t;
+	info->sp = regs->ksp;
+	info->ip = regs->kpc;
+
+	dbg("(%d) Start unwind from sp=%08lx ip=%08lx\n", (int)t->pid, info->sp, info->ip);
+}
+
+void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct task_struct *t)
+{
+	struct pt_regs *regs = &t->thread.regs;
+	unwind_frame_init(info, t, regs);
+}
+
+int unwind_once(struct unwind_frame_info *next_frame)
+{
+	unwind_frame_regs(next_frame);
+
+	if (next_frame->prev_sp == 0 ||
+	    next_frame->prev_ip == 0)
+		return -1;
+
+	next_frame->sp = next_frame->prev_sp;
+	next_frame->ip = next_frame->prev_ip;
+	next_frame->prev_sp = 0;
+	next_frame->prev_ip = 0;
+
+	dbg("(%d) Continue unwind to sp=%08lx ip=%08lx\n", (int)next_frame->t->pid, next_frame->sp, next_frame->ip);
+
+	return 0;
+}
+
+int unwind_to_user(struct unwind_frame_info *info)
+{
+	int ret;
+	
+	do {
+		ret = unwind_once(info);
+	} while (!ret && !(info->ip & 3));
+
+	return ret;
+}
+
+module_init(unwind_init);
diff -Nru a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
--- a/arch/parisc/kernel/vmlinux.lds.S	Tue Jun 15 22:20:37 2004
+++ b/arch/parisc/kernel/vmlinux.lds.S	Tue Jun 15 22:20:37 2004
@@ -26,6 +26,7 @@
 #include <asm-generic/vmlinux.lds.h>
 /* needed for the processor specific cache alignment size */	
 #include <asm/cache.h>
+#include <asm/page.h>
 	
 /* ld script to make hppa Linux kernel */
 #ifndef CONFIG_PARISC64
@@ -45,13 +46,17 @@
 SECTIONS
 {
 
-  . = 0x10100000;
+  . = KERNEL_BINARY_TEXT_START;
 
   _text = .;			/* Text and read-only data */
   .text ALIGN(16) : {
-	*(.text*)
+	*(.text)
 	SCHED_TEXT
-	*(.PARISC.unwind)
+	*(.text.do_softirq)
+	*(.text.sys_exit)
+	*(.text.do_sigaltstack)
+	*(.text.do_fork)
+	*(.text.*)
 	*(.fixup)
 	*(.lock.text)		/* out-of-line lock text */
 	*(.gnu.warning)
@@ -72,6 +77,10 @@
   __ex_table : { *(__ex_table) }
   __stop___ex_table = .;
 
+  __start___unwind = .;         /* unwind info */
+  .PARISC.unwind : { *(.PARISC.unwind) }
+  __stop___unwind = .;
+ 
   .data : {			/* Data */
 	*(.data)
 	CONSTRUCTORS
@@ -87,6 +96,10 @@
 
   . = ALIGN(L1_CACHE_BYTES);
   .data.cacheline_aligned : { *(.data.cacheline_aligned) }
+
+  /* PA-RISC locks requires 16-byte alignment */
+  . = ALIGN(16);
+  .data.lock_aligned : { *(.data.lock_aligned) }
 
   _edata = .;			/* End of data section */
 
diff -Nru a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c
--- a/arch/parisc/lib/bitops.c	Tue Jun 15 22:20:36 2004
+++ b/arch/parisc/lib/bitops.c	Tue Jun 15 22:20:36 2004
@@ -13,22 +13,20 @@
 #include <asm/atomic.h>
 
 #ifdef CONFIG_SMP
-spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
-	[0 ... (ATOMIC_HASH_SIZE-1)]  = SPIN_LOCK_UNLOCKED
+atomic_lock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = {
+	[0 ... (ATOMIC_HASH_SIZE-1)]  = (atomic_lock_t) { { 1, 1, 1, 1 } }
 };
 #endif
 
-spinlock_t __atomic_lock = SPIN_LOCK_UNLOCKED;
-
 #ifdef __LP64__
 unsigned long __xchg64(unsigned long x, unsigned long *ptr)
 {
 	unsigned long temp, flags;
 
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
 	temp = *ptr;
 	*ptr = x;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
 	return temp;
 }
 #endif
@@ -38,10 +36,10 @@
 	unsigned long flags;
 	unsigned long temp;
 
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
 	(long) temp = (long) *ptr;	/* XXX - sign extension wanted? */
 	*ptr = x;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
 	return temp;
 }
 
@@ -51,10 +49,10 @@
 	unsigned long flags;
 	unsigned long temp;
 
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
 	(long) temp = (long) *ptr;	/* XXX - sign extension wanted? */
 	*ptr = x;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
 	return temp;
 }
 
@@ -65,10 +63,10 @@
 	unsigned long flags;
 	unsigned long prev;
 
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
 	if ((prev = *ptr) == old)
 		*ptr = new;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
 	return prev;
 }
 #endif
@@ -78,9 +76,9 @@
 	unsigned long flags;
 	unsigned int prev;
 
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
 	if ((prev = *ptr) == old)
 		*ptr = new;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(ptr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
 	return (unsigned long)prev;
 }
diff -Nru a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
--- a/arch/parisc/mm/init.c	Tue Jun 15 22:20:40 2004
+++ b/arch/parisc/mm/init.c	Tue Jun 15 22:20:40 2004
@@ -424,7 +424,12 @@
  * a hole of 4kB between each vmalloced area for the same reason.
  */
 
-#define MAP_START 0x4000 /* Leave room for gateway page expansion */
+ /* Leave room for gateway page expansion */
+#if KERNEL_MAP_START < GATEWAY_PAGE_SIZE
+#error KERNEL_MAP_START is in gateway reserved region
+#endif
+#define MAP_START (KERNEL_MAP_START)
+
 #define VM_MAP_OFFSET  (32*1024)
 #define SET_MAP_OFFSET(x) ((void *)(((unsigned long)(x) + VM_MAP_OFFSET) \
 				     & ~(VM_MAP_OFFSET-1)))
@@ -545,7 +550,7 @@
 		 */
 
 		if (!pmd) {
-			pmd = (pmd_t *) alloc_bootmem_low_pages_node(NODE_DATA(0),PAGE_SIZE);
+			pmd = (pmd_t *) alloc_bootmem_low_pages_node(NODE_DATA(0),PAGE_SIZE << PMD_ORDER);
 			pmd = (pmd_t *) __pa(pmd);
 		}
 
diff -Nru a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c
--- a/arch/ppc/4xx_io/serial_sicc.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/4xx_io/serial_sicc.c	Tue Jun 15 22:20:36 2004
@@ -1431,7 +1431,6 @@
     save_flags(flags); cli();
 
     if (tty_hung_up_p(filp)) {
-        MOD_DEC_USE_COUNT;
         restore_flags(flags);
         return;
     }
@@ -1452,7 +1451,6 @@
         state->count = 0;
     }
     if (state->count) {
-        MOD_DEC_USE_COUNT;
         restore_flags(flags);
         return;
     }
@@ -1495,7 +1493,6 @@
     }
     info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
     wake_up_interruptible(&info->close_wait);
-    MOD_DEC_USE_COUNT;
 }
 
 static void siccuart_wait_until_sent(struct tty_struct *tty, int timeout)
@@ -1685,9 +1682,7 @@
 
 
     // is this a line that we've got?
-    MOD_INC_USE_COUNT;
     if (line >= SERIAL_SICC_NR) {
-        MOD_DEC_USE_COUNT;
         return -ENODEV;
     }
 
@@ -1707,7 +1702,6 @@
         if (tmp_buf)
             free_page(page);
         else if (!page) {
-            MOD_DEC_USE_COUNT;
             return -ENOMEM;
         }
         tmp_buf = (u_char *)page;
@@ -1720,7 +1714,6 @@
         (info->flags & ASYNC_CLOSING)) {
         if (info->flags & ASYNC_CLOSING)
             interruptible_sleep_on(&info->close_wait);
-        MOD_DEC_USE_COUNT;
         return -EAGAIN;
     }
 
@@ -1729,13 +1722,11 @@
      */
     retval = siccuart_startup(info);
     if (retval) {
-        MOD_DEC_USE_COUNT;
         return retval;
     }
 
     retval = block_til_ready(tty, filp, info);
     if (retval) {
-        MOD_DEC_USE_COUNT;
         return retval;
     }
 
@@ -1778,6 +1769,7 @@
 	return -ENOMEM;
     printk("IBM Vesta SICC serial port driver V 0.1 by Yudong Yang and Yi Ge / IBM CRL .\n");
     siccnormal_driver->driver_name = "serial_sicc";
+    siccnormal_driver->owner = THIS_MODULE;
     siccnormal_driver->name = SERIAL_SICC_NAME;
     siccnormal_driver->major = SERIAL_SICC_MAJOR;
     siccnormal_driver->minor_start = SERIAL_SICC_MINOR;
diff -Nru a/arch/ppc/8260_io/enet.c b/arch/ppc/8260_io/enet.c
--- a/arch/ppc/8260_io/enet.c	Tue Jun 15 22:20:35 2004
+++ b/arch/ppc/8260_io/enet.c	Tue Jun 15 22:20:35 2004
@@ -612,7 +612,7 @@
 {
 	struct net_device *dev;
 	struct scc_enet_private *cep;
-	int i, j;
+	int i, j, err;
 	unsigned char	*eap;
 	unsigned long	mem_addr;
 	bd_t		*bd;
diff -Nru a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c
--- a/arch/ppc/8260_io/fcc_enet.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc/8260_io/fcc_enet.c	Tue Jun 15 22:20:40 2004
@@ -158,12 +158,21 @@
 #define PA1_DIRA0	(PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
 #define PA1_DIRA1	(PA1_TXDAT | PA1_TXEN | PA1_TXER)
 
+#ifdef CONFIG_SBC82xx
+/* rx is clk9, tx is clk10
+ */
+#define PC_F1RXCLK     ((uint)0x00000100)
+#define PC_F1TXCLK     ((uint)0x00000200)
+#define CMX1_CLK_ROUTE ((uint)0x25000000)
+#define CMX1_CLK_MASK  ((uint)0xff000000)
+#else
 /* CLK12 is receive, CLK11 is transmit.  These are board specific.
 */
 #define PC_F1RXCLK	((uint)0x00000800)
 #define PC_F1TXCLK	((uint)0x00000400)
 #define CMX1_CLK_ROUTE	((uint)0x3e000000)
 #define CMX1_CLK_MASK	((uint)0xff000000)
+#endif /* !CONFIG_SBC82xx */
 
 /* I/O Pin assignment for FCC2.  I don't yet know the best way to do this,
  * but there is little variation among the choices.
@@ -288,6 +297,8 @@
 	ushort	skb_cur;
 	ushort	skb_dirty;
 
+	atomic_t n_pkts;  /* Number of packets in tx ring */
+
 	/* CPM dual port RAM relative addresses.
 	*/
 	cbd_t	*rx_bd_base;		/* Address of Rx and Tx buffers. */
@@ -347,6 +358,7 @@
 {
 	struct fcc_enet_private *cep = (struct fcc_enet_private *)dev->priv;
 	volatile cbd_t	*bdp;
+	int idx;
 
 	if (!cep->link) {
 		/* Link is down or autonegotiation is in progress. */
@@ -379,13 +391,24 @@
 	bdp->cbd_datlen = skb->len;
 	bdp->cbd_bufaddr = __pa(skb->data);
 
+	spin_lock_irq(&cep->lock);
+
 	/* Save skb pointer. */
-	cep->tx_skbuff[cep->skb_cur] = skb;
+	idx = cep->skb_cur & TX_RING_MOD_MASK;
+	if (cep->tx_skbuff[idx]) {
+		/* This should never happen (any more).
+		   Leave the sanity check in for now... */
+		printk(KERN_ERR "EEP. cep->tx_skbuff[%d] is %p not NULL in %s\n", 
+		       idx, cep->tx_skbuff[idx], __func__);
+		printk(KERN_ERR "Expect to lose %d bytes of sock space", 
+		       cep->tx_skbuff[idx]->truesize);
+	}
+	cep->tx_skbuff[idx] = skb;
 
 	cep->stats.tx_bytes += skb->len;
-	cep->skb_cur = (cep->skb_cur+1) & TX_RING_MOD_MASK;
+	cep->skb_cur++;
 
-	spin_lock_irq(&cep->lock);
+	atomic_inc(&cep->n_pkts);
 
 	/* Send it on its way.  Tell CPM its ready, interrupt when done,
 	 * its the last BD of the frame, and to put the CRC on the end.
@@ -404,9 +427,13 @@
 	else
 		bdp++;
 
-	if (bdp->cbd_sc & BD_ENET_TX_READY) {
-		netif_stop_queue(dev);
+
+	/* If the tx_ring is full, stop the queue */
+	if (atomic_read(&cep->n_pkts) >= (TX_RING_SIZE-1)) {
+	  if (!netif_queue_stopped(dev)) {
+		netif_stop_queue(dev);	  
 		cep->tx_full = 1;
+	  }
 	}
 
 	cep->cur_tx = (cbd_t *)bdp;
@@ -460,6 +487,7 @@
 	volatile cbd_t	*bdp;
 	ushort	int_events;
 	int	must_restart;
+	int idx;
 
 	cep = (struct fcc_enet_private *)dev->priv;
 
@@ -522,8 +550,12 @@
 			cep->stats.collisions++;
 
 		/* Free the sk buffer associated with this last transmit. */
-		dev_kfree_skb_irq(cep->tx_skbuff[cep->skb_dirty]);
-		cep->skb_dirty = (cep->skb_dirty + 1) & TX_RING_MOD_MASK;
+		idx = cep->skb_dirty & TX_RING_MOD_MASK;
+		dev_kfree_skb_irq(cep->tx_skbuff[idx]);
+		cep->tx_skbuff[idx] = NULL;
+		cep->skb_dirty++;
+
+		atomic_dec(&cep->n_pkts);
 
 		/* Update pointer to next buffer descriptor to be transmitted. */
 		if (bdp->cbd_sc & BD_ENET_TX_WRAP)
@@ -1594,11 +1626,21 @@
 	 */
 	eap = (unsigned char *)&(ep->fen_paddrh);
 	for (i=5; i>=0; i--) {
+#ifdef CONFIG_SBC82xx
+		if (i == 5) {
+			/* bd->bi_enetaddr holds the SCC0 address; the FCC
+			   devices count up from there */
+			dev->dev_addr[i] = bd->bi_enetaddr[i] & ~3;
+			dev->dev_addr[i] += 1 + fip->fc_fccnum;
+			*eap++ = dev->dev_addr[i];
+		}
+#else
 		if (i == 3) {
 			dev->dev_addr[i] = bd->bi_enetaddr[i];
 			dev->dev_addr[i] |= (1 << (7 - fip->fc_fccnum));
 			*eap++ = dev->dev_addr[i];
 		}
+#endif
 		else {
 			*eap++ = dev->dev_addr[i] = bd->bi_enetaddr[i];
 		}
@@ -1683,6 +1725,7 @@
 	while (cp->cp_cpcr & CPM_CR_FLG);
 
 	cep->skb_cur = cep->skb_dirty = 0;
+	atomic_set(&cep->n_pkts, 0);
 }
 
 /* Let 'er rip.
diff -Nru a/arch/ppc/8260_io/uart.c b/arch/ppc/8260_io/uart.c
--- a/arch/ppc/8260_io/uart.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/8260_io/uart.c	Tue Jun 15 22:20:36 2004
@@ -161,7 +161,7 @@
 #ifndef CONFIG_SCC1_ENET
 	{ 0,     0, PROFF_SCC1, SIU_INT_SCC1,   0, SCC_NUM_BASE},    /* SCC1 ttyS2 */
 #endif
-#ifndef CONFIG_SCC2_ENET
+#if !defined(CONFIG_SBC82xx) && !defined(CONFIG_SCC2_ENET)
 	{ 0,     0, PROFF_SCC2, SIU_INT_SCC2,   0, SCC_NUM_BASE + 1},    /* SCC2 ttyS3 */
 #endif
 };
@@ -475,7 +475,7 @@
 			if (break_pressed && info->line == sercons.index) {
 				if (ch != 0 && time_before(jiffies,
 							break_pressed + HZ*5)) {
-					handle_sysrq(ch, regs, NULL, NULL);
+					handle_sysrq(ch, regs, NULL);
 					break_pressed = 0;
 					goto ignore_char;
 				} else
@@ -592,9 +592,7 @@
 #ifdef SERIAL_DEBUG_OPEN
 			printk("scheduling hangup...");
 #endif
-			MOD_INC_USE_COUNT;
-			if (schedule_work(&info->tqueue_hangup) == 0)
-				MOD_DEC_USE_COUNT;
+			schedule_work(&info->tqueue_hangup);
 		}
 	}
 	if (info->flags & ASYNC_CTS_FLOW) {
@@ -723,7 +721,6 @@
 	tty = info->tty;
 	if (tty)
 		tty_hangup(tty);
-	MOD_DEC_USE_COUNT;
 }
 
 /*static void rs_8xx_timer(void)
@@ -1689,7 +1686,6 @@
 
 	if (tty_hung_up_p(filp)) {
 		DBG_CNT("before DEC-hung");
-		MOD_DEC_USE_COUNT;
 		restore_flags(flags);
 		return;
 	}
@@ -1716,7 +1712,6 @@
 	}
 	if (state->count) {
 		DBG_CNT("before DEC-2");
-		MOD_DEC_USE_COUNT;
 		restore_flags(flags);
 		return;
 	}
@@ -1770,7 +1765,6 @@
 	}
 	info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
 	wake_up_interruptible(&info->close_wait);
-	MOD_DEC_USE_COUNT;
 	restore_flags(flags);
 }
 
@@ -2021,7 +2015,6 @@
 	if (retval)
 		return retval;
 
-	MOD_INC_USE_COUNT;
 	retval = block_til_ready(tty, filp, info);
 	if (retval) {
 #ifdef SERIAL_DEBUG_OPEN
@@ -2530,6 +2523,7 @@
 
 	/* Initialize the tty_driver structure */
 
+	serial_driver->owner = THIS_MODULE;
 	serial_driver->driver_name = "serial";
 	serial_driver->devfs_name = "tts/";
 	serial_driver->name = "ttyS";
diff -Nru a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
--- a/arch/ppc/8xx_io/commproc.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/8xx_io/commproc.c	Tue Jun 15 22:20:41 2004
@@ -33,6 +33,7 @@
 #include <asm/pgtable.h>
 #include <asm/8xx_immap.h>
 #include <asm/commproc.h>
+#include <asm/io.h>
 
 extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep);
 
@@ -55,11 +56,10 @@
 
 #if 1
 void
-m8xx_cpm_reset()
+m8xx_cpm_reset(void)
 {
 	volatile immap_t	 *imp;
 	volatile cpm8xx_t	*commproc;
-	pte_t			*pte;
 
 	imp = (immap_t *)IMAP_ADDR;
 	commproc = (cpm8xx_t *)&imp->im_cpm;
diff -Nru a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c
--- a/arch/ppc/8xx_io/cs4218_tdm.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/8xx_io/cs4218_tdm.c	Tue Jun 15 22:20:36 2004
@@ -1456,21 +1456,10 @@
 	restore_flags(flags);
 }
 
-static void CS_open(void)
-{
-	MOD_INC_USE_COUNT;
-}
-
-static void CS_release(void)
-{
-	MOD_DEC_USE_COUNT;
-}
-
 static MACHINE mach_cs4218 = {
+	.owner =	THIS_MODULE,
 	.name =		"HIOX CS4218",
 	.name2 =	"Built-in Sound",
-	.open =		CS_open,
-	.release =	CS_release,
 	.dma_alloc =	CS_Alloc,
 	.dma_free =	CS_Free,
 	.irqinit =	CS_IrqInit,
diff -Nru a/arch/ppc/8xx_io/uart.c b/arch/ppc/8xx_io/uart.c
--- a/arch/ppc/8xx_io/uart.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc/8xx_io/uart.c	Tue Jun 15 22:20:43 2004
@@ -583,9 +583,7 @@
 #ifdef SERIAL_DEBUG_OPEN
 			printk("scheduling hangup...");
 #endif
-			MOD_INC_USE_COUNT;
-			if (schedule_task(&info->tqueue_hangup) == 0)
-				MOD_DEC_USE_COUNT;
+			schedule_task(&info->tqueue_hangup);
 		}
 	}
 	if (info->flags & ASYNC_CTS_FLOW) {
@@ -719,7 +717,6 @@
 	tty = info->tty;
 	if (tty)
 		tty_hangup(tty);
-	MOD_DEC_USE_COUNT;
 }
 
 /*static void rs_8xx_timer(void)
@@ -1664,7 +1661,6 @@
 
 	if (tty_hung_up_p(filp)) {
 		DBG_CNT("before DEC-hung");
-		MOD_DEC_USE_COUNT;
 		restore_flags(flags);
 		return;
 	}
@@ -1691,7 +1687,6 @@
 	}
 	if (state->count) {
 		DBG_CNT("before DEC-2");
-		MOD_DEC_USE_COUNT;
 		restore_flags(flags);
 		return;
 	}
@@ -1746,7 +1741,6 @@
 	}
 	info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
 	wake_up_interruptible(&info->close_wait);
-	MOD_DEC_USE_COUNT;
 	restore_flags(flags);
 }
 
@@ -2008,14 +2002,12 @@
 	if (retval)
 		return retval;
 
-	MOD_INC_USE_COUNT;
 	retval = block_til_ready(tty, filp, info);
 	if (retval) {
 #ifdef SERIAL_DEBUG_OPEN
 		printk("rs_open returning after block_til_ready with %d\n",
 		       retval);
 #endif
-		MOD_DEC_USE_COUNT;
 		return retval;
 	}
 
@@ -2520,6 +2512,7 @@
 
 	/* Initialize the tty_driver structure */
 
+	serial_driver->owner = THIS_MODULE;
 	serial_driver->driver_name = "serial";
 	serial_driver->devfs_name = "tts/";
 	serial_driver->name = "ttyS";
diff -Nru a/arch/ppc/Kconfig b/arch/ppc/Kconfig
--- a/arch/ppc/Kconfig	Tue Jun 15 22:21:04 2004
+++ b/arch/ppc/Kconfig	Tue Jun 15 22:21:04 2004
@@ -542,6 +542,15 @@
 	  <http://www.windriver.com/>, but the EST8260 cannot be found on it
 	  and has probably been discontinued or rebadged.
 
+config SBC82xx
+	bool "SBC82xx"
+	---help---
+	  SBC PowerQUICC II, single-board computer with MPC82xx CPU
+	  Manufacturer: Wind River Systems, Inc.
+	  Date of Release: May 2003
+	  End of Life: -
+	  URL: <http://www.windriver.com/>
+
 config SBS8260
 	bool "SBS8260"
 
@@ -575,7 +584,7 @@
 config 8260
 	bool "MPC8260 CPM Support" if WILLOW
 	depends on 6xx
-	default y if TQM8260 || RPXSUPER || EST8260 || SBS8260
+	default y if TQM8260 || RPXSUPER || EST8260 || SBS8260 || SBC82xx
 	help
 	  The MPC8260 CPM (Communications Processor Module) is a typical
 	  embedded CPU made by Motorola.  Selecting this option means that
@@ -1070,6 +1079,30 @@
 	hex "Size of user task space" if TASK_SIZE_BOOL
 	default "0x80000000"
 
+config CONSISTENT_START_BOOL
+	bool "Set custom consistent memory pool address"
+	depends on ADVANCED_OPTIONS && NOT_COHERENT_CACHE
+	help
+	  This option allows you to set the base virtual address
+	  of the the consistent memory pool.  This pool of virtual
+	  memory is used to make consistent memory allocations.
+
+config CONSISTENT_START
+	hex "Base virtual address of consistent memory pool" if CONSISTENT_START_BOOL
+	default "0xff100000" if NOT_COHERENT_CACHE
+
+config CONSISTENT_SIZE_BOOL
+	bool "Set custom consistent memory pool size"
+	depends on ADVANCED_OPTIONS && NOT_COHERENT_CACHE
+	help
+	  This option allows you to set the size of the the
+	  consistent memory pool.  This pool of virtual memory
+	  is used to make consistent memory allocations.
+
+config CONSISTENT_SIZE
+	hex "Size of consistent memory pool" if CONSISTENT_SIZE_BOOL
+	default "0x00200000" if NOT_COHERENT_CACHE
+
 config BOOT_LOAD_BOOL
 	bool "Set the boot link/load address"
 	depends on ADVANCED_OPTIONS && !PPC_MULTIPLATFORM
@@ -1238,7 +1271,7 @@
 	bool "Support for early boot texts over serial port"
 	depends on 4xx || GT64260 || LOPEC || PPLUS || PRPMC800 || PPC_GEN550
 
-config OCP
+config PPC_OCP
 	bool
 	depends on IBM_OCP
 	default y
diff -Nru a/arch/ppc/Makefile b/arch/ppc/Makefile
--- a/arch/ppc/Makefile	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/Makefile	Tue Jun 15 22:20:36 2004
@@ -43,7 +43,6 @@
 drivers-$(CONFIG_8xx)		+= arch/ppc/8xx_io/
 drivers-$(CONFIG_4xx)		+= arch/ppc/4xx_io/
 drivers-$(CONFIG_8260)		+= arch/ppc/8260_io/
-drivers-$(CONFIG_OCP)		+= arch/ppc/ocp/
 
 BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
 
@@ -87,7 +86,7 @@
 
 ifdef CONFIG_6xx
 # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later
-NEW_AS	:= $(shell echo dssall | $(AS) -o /dev/null >/dev/null 2>&1 ; echo $$?)
+NEW_AS	:= $(shell echo dssall | $(AS) -many -o /dev/null >/dev/null 2>&1 ; echo $$?)
 GOODVER	:= 2.12.1
 else
 NEW_AS	:= 0
@@ -95,7 +94,7 @@
 
 ifneq ($(NEW_AS),0)
 checkbin:
-	@echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build'
+	@echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '
 	@echo 'correctly with old versions of binutils.'
 	@echo '*** Please upgrade your binutils to ${GOODVER} or newer'
 	@false
diff -Nru a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
--- a/arch/ppc/boot/Makefile	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/boot/Makefile	Tue Jun 15 22:20:41 2004
@@ -17,11 +17,11 @@
 
 bootdir-y			:= simple
 bootdir-$(CONFIG_PPC_OF)	+= openfirmware
-subdir-y			:= lib/ common/ images/
-subdir-$(CONFIG_PPC_OF)		+= of1275/
+subdir-y			:= lib common images
+subdir-$(CONFIG_PPC_OF)		+= of1275
 
 # for cleaning
-subdir-				+= simple/ openfirmware/
+subdir-				+= simple openfirmware
 
 host-progs := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree)
 
diff -Nru a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
--- a/arch/ppc/boot/openfirmware/Makefile	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc/boot/openfirmware/Makefile	Tue Jun 15 22:20:38 2004
@@ -22,9 +22,10 @@
 images	:= $(boot)/images
 
 OBJCOPY_ARGS	:= -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
-COFF_LD_ARGS	:= -T $(boot)/ld.script -e _start -Ttext 0x00500000 -Bstatic
-CHRP_LD_ARGS	:= -T $(boot)/ld.script -e _start -Ttext 0x00800000
-NEWWORLD_LD_ARGS:= -T $(boot)/ld.script -e _start -Ttext 0x01000000
+COFF_LD_ARGS	:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00500000 \
+			-Bstatic
+CHRP_LD_ARGS	:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
+NEWWORLD_LD_ARGS:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x01000000
 
 COMMONOBJS	:= start.o misc.o common.o
 COFFOBJS	:= coffcrt0.o $(COMMONOBJS) coffmain.o
@@ -92,11 +93,11 @@
       cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) $< $(LIBS) && \
                      $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
 targets += coffboot
-$(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(boot)/ld.script FORCE
+$(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ld.script FORCE
 	$(call if_changed,gencoffb)
 targets += coffboot.initrd
 $(obj)/coffboot.initrd: $(obj)/image.initrd.o $(COFFOBJS) $(LIBS) \
-			$(boot)/ld.script FORCE
+			$(srctree)/$(boot)/ld.script FORCE
 	$(call if_changed,gencoffb)
 
 
@@ -118,20 +119,22 @@
 					 -R .comment $(del-ramdisk-sec)
 
 $(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) \
-			$(obj)/note $(boot)/ld.script
+			$(obj)/note $(srctree)/$(boot)/ld.script
 	$(call cmd,gen-elf-pmac)
 $(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \
-				   $(LIBS) $(obj)/note $(boot)/ld.script
+				   $(LIBS) $(obj)/note \
+				   $(srctree)/$(boot)/ld.script
 	$(call cmd,gen-elf-pmac)
 
 quiet_cmd_gen-chrp = CHRP    $@
       cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
 			$(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
 
-$(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) $(boot)/ld.script
+$(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
+				   $(srctree)/$(boot)/ld.script
 	$(call cmd,gen-chrp)
 $(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
-			$(boot)/ld.script
+				   $(srctree)/$(boot)/ld.script
 	$(call cmd,gen-chrp)
 
 quiet_cmd_addnote = ADDNOTE $@
diff -Nru a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
--- a/arch/ppc/boot/simple/Makefile	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/boot/simple/Makefile	Tue Jun 15 22:20:36 2004
@@ -125,7 +125,7 @@
 AFLAGS_head.o				+= $(cacheflag-y)
 
 # Linker args.  This specifies where the image will be run at.
-LD_ARGS				:= -T $(boot)/ld.script \
+LD_ARGS					:= -T $(srctree)/$(boot)/ld.script \
 				   -Ttext $(CONFIG_BOOT_LOAD) -Bstatic
 OBJCOPY_ARGS			:= -O elf32-powerpc
 
@@ -159,8 +159,8 @@
 
 targets := dummy.o
 
-$(obj)/zvmlinux: $(OBJS) $(LIBS) $(boot)/ld.script $(images)/vmlinux.gz \
-		$(obj)/dummy.o
+$(obj)/zvmlinux: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \
+		$(images)/vmlinux.gz $(obj)/dummy.o
 	$(OBJCOPY) $(OBJCOPY_ARGS) \
 		--add-section=.image=$(images)/vmlinux.gz \
 		--set-section-flags=.image=contents,alloc,load,readonly,data \
@@ -169,7 +169,7 @@
 	$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
 		-R .stabstr -R .ramdisk -R .sysmap
 
-$(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(boot)/ld.script \
+$(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(srctree)/$(boot)/ld.script \
 		$(images)/vmlinux.gz $(obj)/dummy.o
 	$(OBJCOPY) $(OBJCOPY_ARGS) \
 		--add-section=.ramdisk=$(images)/ramdisk.image.gz \
@@ -210,10 +210,10 @@
 	$(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y) \
 		$(ENTRYPOINT)
 
-$(images)/zImage-PPLUS: $(obj)/zvmlinux $(utils)/mkprep $(MKBUGBOOT)
+$(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT)
 	$(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.$(end-y)
 	$(MKBUGBOOT) $(obj)/zvmlinux $(images)/zImage.bugboot
 
-$(images)/zImage.initrd-PPLUS: $(obj)/zvmlinux.initrd $(utils)/mkprep $(MKBUGBOOT)
+$(images)/zImage.initrd-PPLUS: $(obj)/zvmlinux.initrd $(MKPREP) $(MKBUGBOOT)
 	$(MKPREP) -pbp $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y)
 	$(MKBUGBOOT) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.bugboot
diff -Nru a/arch/ppc/boot/simple/embed_config.c b/arch/ppc/boot/simple/embed_config.c
--- a/arch/ppc/boot/simple/embed_config.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/boot/simple/embed_config.c	Tue Jun 15 22:20:37 2004
@@ -10,6 +10,7 @@
 #include <linux/types.h>
 #include <linux/config.h>
 #include <linux/string.h>
+#include <asm/reg.h>
 #ifdef CONFIG_8xx
 #include <asm/mpc8xx.h>
 #endif
@@ -402,14 +403,18 @@
 
 #ifdef CONFIG_8260
 /* Compute 8260 clock values if the rom doesn't provide them.
- * We can't compute the internal core frequency (I don't know how to
- * do that).
  */
+static unsigned char bus2core_8260[] = {
+/*      0   1   2   3   4   5   6   7   8   9   a   b   c   d   e   f */
+	3,  2,  2,  2,  4,  4,  5,  9,  6, 11,  8, 10,  3, 12,  7,  2,
+	6,  5, 13,  2, 14,  4, 15,  2,  3, 11,  8, 10, 16, 12,  7,  2,
+};
+
 static void
 clk_8260(bd_t *bd)
 {
 	uint	scmr, vco_out, clkin;
-	uint	plldf, pllmf, busdf, brgdf, cpmdf;
+	uint	plldf, pllmf, corecnf;
 	volatile immap_t	*ip;
 
 	ip = (immap_t *)IMAP_ADDR;
@@ -423,8 +428,7 @@
 	*/
 	plldf = (scmr >> 12) & 1;
 	pllmf = scmr & 0xfff;
-	cpmdf = (scmr >> 16) & 0x0f;
-	busdf = (scmr >> 20) & 0x0f;
+	corecnf = (scmr >> 24) &0x1f;
 
 	/* This is arithmetic from the 8260 manual.
 	*/
@@ -433,6 +437,7 @@
 	bd->bi_vco = vco_out;		/* Save for later */
 
 	bd->bi_cpmfreq = vco_out / 2;	/* CPM Freq, in MHz */
+	bd->bi_intfreq = bd->bi_busfreq * bus2core_8260[corecnf] / 2;
 
 	/* Set Baud rate divisor.  The power up default is divide by 16,
 	 * but we set it again here in case it was changed.
@@ -440,8 +445,79 @@
 	ip->im_clkrst.car_sccr = 1;	/* DIV 16 BRG */
 	bd->bi_brgfreq = vco_out / 16;
 }
+
+static unsigned char bus2core_8280[] = {
+/*      0   1   2   3   4   5   6   7   8   9   a   b   c   d   e   f */
+	3,  2,  2,  2,  4,  4,  5,  9,  6, 11,  8, 10,  3, 12,  7,  2,
+	6,  5, 13,  2, 14,  2, 15,  2,  3,  2,  2,  2, 16,  2,  2,  2,
+};
+
+static void
+clk_8280(bd_t *bd)
+{
+	uint	scmr, main_clk, clkin;
+	uint	pllmf, corecnf;
+	volatile immap_t	*ip;
+
+	ip = (immap_t *)IMAP_ADDR;
+	scmr = ip->im_clkrst.car_scmr;
+
+	/* The clkin is always bus frequency.
+	*/
+	clkin = bd->bi_busfreq;
+
+	/* Collect the bits from the scmr.
+	*/
+	pllmf = scmr & 0xf;
+	corecnf = (scmr >> 24) & 0x1f;
+
+	/* This is arithmetic from the 8280 manual.
+	*/
+	main_clk = clkin * (pllmf + 1);
+
+	bd->bi_cpmfreq = main_clk / 2;	/* CPM Freq, in MHz */
+	bd->bi_intfreq = bd->bi_busfreq * bus2core_8280[corecnf] / 2;
+
+	/* Set Baud rate divisor.  The power up default is divide by 16,
+	 * but we set it again here in case it was changed.
+	 */
+	ip->im_clkrst.car_sccr = (ip->im_clkrst.car_sccr & 0x3) | 0x1;
+	bd->bi_brgfreq = main_clk / 16;
+}
 #endif
 
+#ifdef CONFIG_SBC82xx
+void
+embed_config(bd_t **bdp)
+{
+	u_char	*cp;
+	int	i;
+	bd_t	*bd;
+	unsigned long pvr;
+
+	bd = *bdp;
+
+	bd = &bdinfo;
+	*bdp = bd;
+	bd->bi_baudrate = 9600;
+	bd->bi_memsize = 256 * 1024 * 1024;	/* just a guess */
+
+	cp = (void*)SBC82xx_MACADDR_NVRAM_SCC1;
+	memcpy(bd->bi_enetaddr, cp, 6);
+
+	/* can busfreq be calculated? */
+	pvr = mfspr(PVR);
+	if ((pvr & 0xffff0000) == 0x80820000) {
+		bd->bi_busfreq = 100000000;
+		clk_8280(bd);
+	} else {
+		bd->bi_busfreq = 66000000;
+		clk_8260(bd);
+	}
+
+}
+#endif /* SBC82xx */
+
 #if defined(CONFIG_EST8260) || defined(CONFIG_TQM8260)
 void
 embed_config(bd_t **bdp)
@@ -705,7 +781,7 @@
 #ifdef CONFIG_IBM_OPENBIOS
 /* This could possibly work for all treeboot roms.
 */
-#if defined(CONFIG_ASH) || defined(CONFIG_BEECH)
+#if defined(CONFIG_ASH) || defined(CONFIG_BEECH) || defined(CONFIG_BUBINGA)
 #define BOARD_INFO_VECTOR       0xFFF80B50 /* openbios 1.19 moved this vector down  - armin */
 #else
 #define BOARD_INFO_VECTOR	0xFFFE0B50
@@ -742,7 +818,7 @@
 	 */
 	mtdcr(DCRN_MALCR(DCRN_MAL_BASE), MALCR_MMSR);     /* 1st reset MAL */
 	while (mfdcr(DCRN_MALCR(DCRN_MAL_BASE)) & MALCR_MMSR) {}; /* wait for the reset */	
-	out_be32(EMAC0_BASE,0x20000000);        /* then reset EMAC */
+	out_be32((volatile u32*)EMAC0_BASE,0x20000000);        /* then reset EMAC */
 #endif
 
 	bd = &bdinfo;
diff -Nru a/arch/ppc/configs/ash_defconfig b/arch/ppc/configs/ash_defconfig
--- a/arch/ppc/configs/ash_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/configs/ash_defconfig	Tue Jun 15 22:20:37 2004
@@ -4,11 +4,17 @@
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=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_STANDALONE=y
+CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
@@ -18,9 +24,16 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+# CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
+# CONFIG_KALLSYMS is not set
 CONFIG_FUTEX=y
 # CONFIG_EPOLL is not set
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
 # Loadable module support
@@ -33,66 +46,61 @@
 CONFIG_KMOD=y
 
 #
-# Platform support
+# Processor
 #
-CONFIG_PPC=y
-CONFIG_PPC32=y
 # CONFIG_6xx is not set
 CONFIG_40x=y
+# CONFIG_44x is not set
 # CONFIG_POWER3 is not set
+# CONFIG_POWER4 is not set
 # CONFIG_8xx is not set
+# CONFIG_MATH_EMULATION is not set
+# CONFIG_CPU_FREQ is not set
 CONFIG_4xx=y
 
 #
 # IBM 4xx options
 #
 CONFIG_ASH=y
-# CONFIG_BEECH is not set
-# CONFIG_CEDAR is not set
 # CONFIG_CPCI405 is not set
 # CONFIG_EP405 is not set
+# CONFIG_EVB405EP is not set
 # CONFIG_OAK is not set
-# CONFIG_REDWOOD_4 is not set
 # CONFIG_REDWOOD_5 is not set
 # CONFIG_REDWOOD_6 is not set
 # CONFIG_SYCAMORE is not set
-# CONFIG_TIVO is not set
 # CONFIG_WALNUT is not set
 CONFIG_NP405H=y
 CONFIG_IBM405_ERR77=y
 CONFIG_IBM405_ERR51=y
 CONFIG_IBM_OCP=y
+CONFIG_PPC_OCP=y
 CONFIG_IBM_OPENBIOS=y
-# CONFIG_405_DMA is not set
 # CONFIG_PM is not set
 CONFIG_UART0_TTYS0=y
 # CONFIG_UART0_TTYS1 is not set
 CONFIG_NOT_COHERENT_CACHE=y
-# CONFIG_SMP is not set
-# CONFIG_PREEMPT is not set
-# CONFIG_MATH_EMULATION is not set
-# CONFIG_CPU_FREQ is not set
 
 #
-# General setup
+# Platform options
 #
-# CONFIG_HIGHMEM is not set
-CONFIG_PCI=y
-CONFIG_PCI_DOMAINS=y
 # CONFIG_PC_KEYBOARD is not set
-CONFIG_KCORE_ELF=y
-CONFIG_BINFMT_ELF=y
+# 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 is not set
-CONFIG_PCI_LEGACY_PROC=y
-# CONFIG_PCI_NAMES is not set
-# CONFIG_HOTPLUG is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
-# Parallel port support
+# Bus options
 #
-# CONFIG_PARPORT is not set
-# CONFIG_CMDLINE_BOOL is not set
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_LEGACY_PROC=y
+# CONFIG_PCI_NAMES is not set
 
 #
 # Advanced setup
@@ -109,14 +117,26 @@
 CONFIG_BOOT_LOAD=0x00400000
 
 #
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+
+#
 # Memory Technology Devices (MTD)
 #
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # Block devices
@@ -127,32 +147,36 @@
 # 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_CARMEL is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+# CONFIG_LBD is not set
 
 #
-# Multi-device support (RAID and LVM)
+# ATA/ATAPI/MFM/RLL support
 #
-# CONFIG_MD is not set
+# CONFIG_IDE is not set
 
 #
-# ATA/IDE/MFM/RLL support
+# SCSI device support
 #
-# CONFIG_IDE is not set
+# CONFIG_SCSI is not set
 
 #
-# SCSI support
+# Multi-device support (RAID and LVM)
 #
-# CONFIG_SCSI is not set
+# CONFIG_MD is not set
 
 #
 # Fusion MPT device support
 #
+# CONFIG_FUSION is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -162,6 +186,10 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -171,38 +199,37 @@
 #
 # CONFIG_PACKET is not set
 # CONFIG_NETLINK_DEV is not set
-# CONFIG_NETFILTER 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_DHCP is not set
 CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=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_INET_ECN 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_IPV6 is not set
-# CONFIG_XFRM_USER 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_VLAN_8021Q is not set
-# CONFIG_LLC is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE 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
@@ -230,7 +257,6 @@
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-# CONFIG_ETHERTAP is not set
 
 #
 # Ethernet (10 or 100Mbit)
@@ -247,6 +273,7 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
+# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -254,6 +281,12 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
+CONFIG_IBM_EMAC=y
+# CONFIG_IBM_EMAC_ERRMSG is not set
+CONFIG_IBM_EMAC_RXB=64
+CONFIG_IBM_EMAC_TXB=8
+CONFIG_IBM_EMAC_FGAP=8
+CONFIG_IBM_EMAC_SKBRES=0
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
 # CONFIG_PPP is not set
@@ -265,10 +298,12 @@
 # CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices (depends on LLC=y)
+# Token Ring devices
 #
+# CONFIG_TR is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -286,47 +321,71 @@
 # CONFIG_IRDA is not set
 
 #
-# ISDN subsystem
+# Bluetooth support
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
-# Graphics support
+# ISDN subsystem
 #
-# CONFIG_FB is not set
+# CONFIG_ISDN is not set
 
 #
-# Old CD-ROM drivers (not SCSI, not IDE)
+# Telephony Support
 #
-# CONFIG_CD_NO_IDESCSI is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
 #
-# CONFIG_INPUT is not set
+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 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
 
 #
 # Input Device Drivers
 #
-
-#
-# Macintosh 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_NONSTANDARD is not set
 
 #
@@ -334,6 +393,7 @@
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=4
 # CONFIG_SERIAL_8250_EXTENDED is not set
 
 #
@@ -342,100 +402,145 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
+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
+
+#
+# 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_FTAPE is not set
+# CONFIG_AGP is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
 # I2C support
 #
 CONFIG_I2C=y
+# CONFIG_I2C_CHARDEV is not set
+
+#
+# I2C Algorithms
+#
 # CONFIG_I2C_ALGOBIT is not set
 # CONFIG_I2C_ALGOPCF is not set
-CONFIG_I2C_IBM_OCP_ALGO=y
-CONFIG_I2C_IBM_OCP_ADAP=y
-# CONFIG_I2C_CHARDEV is not set
 
 #
-# I2C Hardware Sensors Mainboard support
+# I2C Hardware Bus support
 #
+# CONFIG_I2C_ALI1535 is not set
 # CONFIG_I2C_ALI15X3 is not set
 # CONFIG_I2C_AMD756 is not set
 # CONFIG_I2C_AMD8111 is not set
 # CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
+# CONFIG_I2C_IBM_IIC is not set
+# CONFIG_I2C_ISA is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 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_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
-# CONFIG_I2C_SENSOR is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
 
 #
-# Mice
+# Other I2C Chip support
 #
-# CONFIG_BUSMOUSE is not set
-# CONFIG_QIC02_TAPE is not set
+# CONFIG_SENSORS_EEPROM 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
 
 #
-# IPMI
+# Misc devices
 #
-# CONFIG_IPMI_HANDLER is not set
 
 #
-# Watchdog Cards
+# Multimedia devices
 #
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-# CONFIG_SOFT_WATCHDOG is not set
-# CONFIG_WDT is not set
-# CONFIG_WDTPCI is not set
-# CONFIG_PCWATCHDOG is not set
-# CONFIG_ACQUIRE_WDT is not set
-# CONFIG_ADVANTECH_WDT is not set
-# CONFIG_EUROTECH_WDT is not set
-# CONFIG_IB700_WDT is not set
-# CONFIG_MIXCOMWD is not set
-# CONFIG_SCx200_WDT is not set
-# CONFIG_60XX_WDT is not set
-# CONFIG_W83877F_WDT is not set
-# CONFIG_MACHZ_WDT is not set
-# CONFIG_SC520_WDT is not set
-# CONFIG_AMD7XX_TCO is not set
-# CONFIG_ALIM7101_WDT is not set
-# CONFIG_SC1200_WDT is not set
-# CONFIG_WAFER_WDT is not set
-# CONFIG_CPU5_WDT 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
+# CONFIG_VIDEO_DEV is not set
 
 #
-# Ftape, the floppy tape device driver
+# Digital Video Broadcasting Devices
 #
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
-# CONFIG_HANGCHECK_TIMER is not set
+# CONFIG_DVB is not set
 
 #
-# Multimedia devices
+# Graphics support
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_FB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Sound
 #
-# CONFIG_DVB is not set
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
 
 #
 # File systems
@@ -469,10 +574,11 @@
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
 # CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
 
 #
@@ -481,6 +587,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
@@ -497,12 +604,13 @@
 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_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -528,26 +636,15 @@
 # CONFIG_EFI_PARTITION is not set
 
 #
-# Sound
+# Native Language Support
 #
-# CONFIG_SOUND is not set
+# CONFIG_NLS is not set
 
 #
 # IBM 40x options
 #
 
 #
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-
-#
 # Library routines
 #
 CONFIG_CRC32=y
@@ -556,7 +653,6 @@
 # Kernel hacking
 #
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_KALLSYMS is not set
 # CONFIG_SERIAL_TEXT_DEBUG is not set
 CONFIG_OCP=y
 
diff -Nru a/arch/ppc/configs/bubinga_defconfig b/arch/ppc/configs/bubinga_defconfig
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/configs/bubinga_defconfig	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,593 @@
+#
+# Automatically generated make config: don't edit
+#
+CONFIG_MMU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=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_STANDALONE is not set
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_EMBEDDED=y
+# CONFIG_KALLSYMS is not set
+CONFIG_FUTEX=y
+# CONFIG_EPOLL is not set
+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=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+# CONFIG_MODVERSIONS is not set
+CONFIG_KMOD=y
+
+#
+# Processor
+#
+# CONFIG_6xx is not set
+CONFIG_40x=y
+# CONFIG_44x is not set
+# CONFIG_POWER3 is not set
+# CONFIG_POWER4 is not set
+# CONFIG_8xx is not set
+# CONFIG_MATH_EMULATION is not set
+# CONFIG_CPU_FREQ is not set
+CONFIG_4xx=y
+
+#
+# IBM 4xx options
+#
+# CONFIG_ASH is not set
+CONFIG_BUBINGA=y
+# CONFIG_CPCI405 is not set
+# CONFIG_EP405 is not set
+# CONFIG_OAK is not set
+# CONFIG_REDWOOD_5 is not set
+# CONFIG_REDWOOD_6 is not set
+# CONFIG_SYCAMORE is not set
+# CONFIG_WALNUT is not set
+CONFIG_IBM405_ERR77=y
+CONFIG_IBM405_ERR51=y
+CONFIG_IBM_OCP=y
+CONFIG_BIOS_FIXUP=y
+CONFIG_405EP=y
+CONFIG_IBM_OPENBIOS=y
+# CONFIG_PM is not set
+CONFIG_UART0_TTYS0=y
+# CONFIG_UART0_TTYS1 is not set
+CONFIG_NOT_COHERENT_CACHE=y
+
+#
+# Platform options
+#
+# CONFIG_PC_KEYBOARD is not set
+# 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 is not set
+# CONFIG_CMDLINE_BOOL is not set
+
+#
+# Bus options
+#
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_LEGACY_PROC=y
+# CONFIG_PCI_NAMES is not set
+
+#
+# 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=0x00400000
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+
+#
+# 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_CARMEL 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 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
+#
+# 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 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=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP 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_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_NET_FASTROUTE is not set
+# CONFIG_NET_HW_FLOWCONTROL is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+CONFIG_NETDEVICES=y
+
+#
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+
+#
+# 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_NET_VENDOR_3COM is not set
+
+#
+# Tulip family network device support
+#
+# CONFIG_NET_TULIP is not set
+# CONFIG_HP100 is not set
+# CONFIG_NET_PCI 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_SIS190 is not set
+# CONFIG_SK98LIN is not set
+# CONFIG_TIGON3 is not set
+
+#
+# Ethernet (10000 Mbit)
+#
+# CONFIG_IXGB is not set
+CONFIG_IBM_EMAC=y
+# CONFIG_IBM_EMAC_ERRMSG is not set
+CONFIG_IBM_EMAC_RXB=64
+CONFIG_IBM_EMAC_TXB=8
+CONFIG_IBM_EMAC_FGAP=8
+CONFIG_IBM_EMAC_SKBRES=0
+# 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
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+
+#
+# Wan interfaces
+#
+# CONFIG_WAN is not set
+
+#
+# Amateur Radio support
+#
+# CONFIG_HAMRADIO is not set
+
+#
+# IrDA (infrared) support
+#
+# CONFIG_IRDA is not set
+
+#
+# Bluetooth support
+#
+# CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_PCIPS2 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
+# CONFIG_QIC02_TAPE is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+# CONFIG_NVRAM 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 is not set
+
+#
+# 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 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_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_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_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_INTERMEZZO_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_NEC98_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# IBM 40x options
+#
+
+#
+# Library routines
+#
+CONFIG_CRC32=y
+
+#
+# Kernel hacking
+#
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_SERIAL_TEXT_DEBUG is not set
+CONFIG_PPC_OCP=y
+
+#
+# Security options
+#
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
diff -Nru a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/common_defconfig
--- a/arch/ppc/configs/common_defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc/configs/common_defconfig	Tue Jun 15 22:20:38 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -20,9 +21,12 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_HOTPLUG=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
@@ -32,6 +36,8 @@
 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
@@ -113,7 +119,6 @@
 CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
-CONFIG_HOTPLUG=y
 
 #
 # PCMCIA/CardBus support
@@ -122,11 +127,6 @@
 CONFIG_PCMCIA_PROBE=y
 
 #
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
 # Advanced setup
 #
 # CONFIG_ADVANCED_OPTIONS is not set
@@ -141,6 +141,10 @@
 CONFIG_BOOT_LOAD=0x00800000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 # CONFIG_FW_LOADER is not set
@@ -151,6 +155,11 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
 # CONFIG_PNP is not set
@@ -167,17 +176,13 @@
 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_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_LBD=y
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
@@ -199,6 +204,7 @@
 #
 # IDE chipset support/bugfixes
 #
+CONFIG_IDE_GENERIC=y
 CONFIG_BLK_DEV_IDEPCI=y
 CONFIG_IDEPCI_SHARE_IRQ=y
 # CONFIG_BLK_DEV_OFFBOARD is not set
@@ -206,7 +212,6 @@
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_SL82C105=y
 CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDE_TCQ is not set
 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
 CONFIG_IDEDMA_PCI_AUTO=y
 # CONFIG_IDEDMA_ONLYDISK is not set
@@ -268,6 +273,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -279,7 +290,6 @@
 CONFIG_SCSI_AIC7XXX=m
 CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
 CONFIG_AIC7XXX_RESET_DELAY_MS=15000
-# CONFIG_AIC7XXX_PROBE_EISA_VL is not set
 # CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
 CONFIG_AIC7XXX_DEBUG_ENABLE=y
 CONFIG_AIC7XXX_DEBUG_MASK=0
@@ -289,6 +299,7 @@
 CONFIG_SCSI_ADVANSYS=m
 # CONFIG_SCSI_IN2000 is not set
 # CONFIG_SCSI_MEGARAID 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
@@ -307,14 +318,23 @@
 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_PAS16 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
+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_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
@@ -325,12 +345,22 @@
 CONFIG_SCSI_MAC53C94=y
 
 #
+# 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
+
+#
 # Fusion MPT device support
 #
 # CONFIG_FUSION is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -340,6 +370,24 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+CONFIG_ADB=y
+CONFIG_ADB_CUDA=y
+CONFIG_ADB_PMU=y
+CONFIG_PMAC_PBOOK=y
+CONFIG_PMAC_APM_EMU=y
+CONFIG_PMAC_BACKLIGHT=y
+# CONFIG_MAC_FLOPPY is not set
+CONFIG_MAC_SERIAL=m
+CONFIG_ADB_MACIO=y
+CONFIG_INPUT_ADBHID=y
+CONFIG_MAC_EMUMOUSEBTN=y
+CONFIG_THERM_WINDTUNNEL=m
+CONFIG_THERM_ADT746X=m
+# CONFIG_ANSLCD is not set
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -360,7 +408,6 @@
 # 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=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -371,8 +418,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -425,14 +470,17 @@
 # CONFIG_IP_NF_ARPTABLES is not set
 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)
 #
-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
@@ -453,16 +501,21 @@
 # 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)
@@ -488,6 +541,7 @@
 CONFIG_TULIP=y
 # CONFIG_TULIP_MWI is not set
 CONFIG_TULIP_MMIO=y
+# CONFIG_TULIP_NAPI is not set
 CONFIG_DE4X5=m
 # CONFIG_WINBOND_840 is not set
 # CONFIG_DM9102 is not set
@@ -502,6 +556,7 @@
 # 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
@@ -528,7 +583,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -536,17 +590,12 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=y
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_FILTER=y
-CONFIG_PPP_ASYNC=y
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=y
-# CONFIG_PPP_BSDCOMP is not set
-# CONFIG_PPPOE is not set
-# CONFIG_SLIP is not set
+# CONFIG_S2IO is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
 
 #
 # Wireless LAN (non-hamradio)
@@ -569,98 +618,43 @@
 # CONFIG_PLX_HERMES is not set
 # CONFIG_TMD_HERMES is not set
 # CONFIG_PCI_HERMES is not set
-CONFIG_NET_WIRELESS=y
+# CONFIG_ATMEL is not set
 
 #
-# Token Ring devices
+# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
 #
-# CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
+# CONFIG_PRISM54 is not set
+CONFIG_NET_WIRELESS=y
 
 #
 # Wan interfaces
 #
 # CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PPP=y
+CONFIG_PPP_MULTILINK=y
+CONFIG_PPP_FILTER=y
+CONFIG_PPP_ASYNC=y
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=y
+# CONFIG_PPP_BSDCOMP is not set
+# CONFIG_PPPOE is not set
+# 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
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_ISDN is not set
 
 #
-# Graphics support
+# Telephony Support
 #
-CONFIG_FB=y
-# CONFIG_FB_CYBER2000 is not set
-CONFIG_FB_OF=y
-CONFIG_FB_CONTROL=y
-CONFIG_FB_PLATINUM=y
-CONFIG_FB_VALKYRIE=y
-CONFIG_FB_CT65550=y
-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 is not set
-# CONFIG_FB_MATROX_MULTIHEAD is not set
-CONFIG_FB_RADEON=y
-CONFIG_FB_ATY128=y
-CONFIG_FB_ATY=y
-CONFIG_FB_ATY_CT=y
-CONFIG_FB_ATY_GX=y
-# CONFIG_FB_ATY_XL_INIT is not set
-# CONFIG_FB_SIS is not set
-# CONFIG_FB_NEOMAGIC is not set
-CONFIG_FB_3DFX=y
-# 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=y
-# 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
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
-CONFIG_LOGO_LINUX_CLUT224=y
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -696,38 +690,22 @@
 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_PS2_SYNAPTICS is not set
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_INPORT is not set
 # CONFIG_MOUSE_LOGIBM is not set
 # CONFIG_MOUSE_PC110PAD 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_UINPUT=m
 
 #
-# Macintosh device drivers
-#
-CONFIG_ADB_CUDA=y
-CONFIG_ADB_PMU=y
-CONFIG_PMAC_PBOOK=y
-CONFIG_PMAC_APM_EMU=y
-CONFIG_PMAC_BACKLIGHT=y
-# CONFIG_MAC_FLOPPY is not set
-CONFIG_MAC_SERIAL=m
-CONFIG_ADB=y
-CONFIG_ADB_MACIO=y
-CONFIG_INPUT_ADBHID=y
-CONFIG_MAC_EMUMOUSEBTN=y
-# CONFIG_ANSLCD is not set
-
-#
 # Character devices
 #
 CONFIG_VT=y
@@ -749,79 +727,108 @@
 CONFIG_SERIAL_PMACZILOG=y
 # CONFIG_SERIAL_PMACZILOG_CONSOLE is not set
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_QIC02_TAPE is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+CONFIG_NVRAM=y
+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_FTAPE is not set
+# CONFIG_AGP is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
 # I2C support
 #
-CONFIG_I2C=m
+CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=m
 
 #
 # I2C Algorithms
 #
-# CONFIG_I2C_ALGOBIT is not set
+CONFIG_I2C_ALGOBIT=y
 # CONFIG_I2C_ALGOPCF 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_ELEKTOR is not set
+CONFIG_I2C_HYDRA=y
 # CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
 # CONFIG_I2C_ISA is not set
 CONFIG_I2C_KEYWEST=m
 # CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 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_EEPROM is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
 
 #
-# Mice
-#
-CONFIG_BUSMOUSE=y
-# CONFIG_QIC02_TAPE is not set
-
-#
-# IPMI
+# Other I2C Chip support
 #
-# CONFIG_IPMI_HANDLER is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 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
 
 #
-# Watchdog Cards
+# Misc devices
 #
-# CONFIG_WATCHDOG is not set
-CONFIG_NVRAM=y
-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_FTAPE is not set
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
 
 #
 # Multimedia devices
@@ -834,152 +841,63 @@
 # 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
-# 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=y
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_DEVFS_FS=y
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-CONFIG_DEVPTS_FS=y
-# CONFIG_DEVPTS_FS_XATTR is not set
-CONFIG_TMPFS=y
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-CONFIG_HFS_FS=m
-# 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
+# Graphics support
 #
-CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
-# CONFIG_NFS_V4 is not set
-CONFIG_NFSD=y
-CONFIG_NFSD_V3=y
-# CONFIG_NFSD_V4 is not set
-# CONFIG_NFSD_TCP is not set
-CONFIG_LOCKD=y
-CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=y
-CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS 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
+CONFIG_FB=y
+# CONFIG_FB_PM2 is not set
+# CONFIG_FB_CYBER2000 is not set
+CONFIG_FB_OF=y
+CONFIG_FB_CONTROL=y
+CONFIG_FB_PLATINUM=y
+CONFIG_FB_VALKYRIE=y
+CONFIG_FB_CT65550=y
+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 is not set
+CONFIG_FB_MATROX_I2C=y
+# CONFIG_FB_MATROX_MULTIHEAD is not set
+# CONFIG_FB_RADEON_OLD is not set
+CONFIG_FB_RADEON=y
+CONFIG_FB_RADEON_I2C=y
+# CONFIG_FB_RADEON_DEBUG is not set
+CONFIG_FB_ATY128=y
+CONFIG_FB_ATY=y
+CONFIG_FB_ATY_CT=y
+CONFIG_FB_ATY_GX=y
+# CONFIG_FB_ATY_XL_INIT 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_VOODOO1 is not set
+# CONFIG_FB_TRIDENT is not set
+# CONFIG_FB_VIRTUAL is not set
 
 #
-# Partition Types
+# Console display driver support
 #
-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_NEC98_PARTITION is not set
-# CONFIG_SGI_PARTITION is not set
-# CONFIG_ULTRIX_PARTITION is not set
-# CONFIG_SUN_PARTITION is not set
-# CONFIG_EFI_PARTITION is not set
-CONFIG_NLS=y
+CONFIG_VGA_CONSOLE=y
+# 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
 
 #
-# Native Language Support
+# Logo configuration
 #
-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=m
-# 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_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 
 #
 # Sound
@@ -992,6 +910,10 @@
 # Advanced Linux Sound Architecture
 #
 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 is not set
 CONFIG_SND_OSSEMUL=y
@@ -1004,6 +926,8 @@
 #
 # Generic devices
 #
+CONFIG_SND_MPU401_UART=m
+CONFIG_SND_OPL3_LIB=m
 # CONFIG_SND_DUMMY is not set
 # CONFIG_SND_VIRMIDI is not set
 # CONFIG_SND_MTPAV is not set
@@ -1040,11 +964,17 @@
 # PCI devices
 #
 # CONFIG_SND_ALI5451 is not set
+# CONFIG_SND_ATIIXP is not set
+# CONFIG_SND_AU8810 is not set
+# CONFIG_SND_AU8820 is not set
+# CONFIG_SND_AU8830 is not set
 # CONFIG_SND_AZT3328 is not set
+# CONFIG_SND_BT87X is not set
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_EMU10K1 is not set
 # CONFIG_SND_KORG1212 is not set
+# CONFIG_SND_MIXART is not set
 # CONFIG_SND_NM256 is not set
 # CONFIG_SND_RME32 is not set
 # CONFIG_SND_RME96 is not set
@@ -1063,6 +993,7 @@
 # CONFIG_SND_ICE1712 is not set
 # CONFIG_SND_ICE1724 is not set
 # CONFIG_SND_INTEL8X0 is not set
+# CONFIG_SND_INTEL8X0M is not set
 # CONFIG_SND_SONICVIBES is not set
 # CONFIG_SND_VIA82XX is not set
 # CONFIG_SND_VX222 is not set
@@ -1132,13 +1063,14 @@
 # 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_XPAD is not set
+# CONFIG_USB_ATI_REMOTE is not set
 
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
-CONFIG_USB_SCANNER=m
 # CONFIG_USB_MICROTEK is not set
 # CONFIG_USB_HPUSBSCSI is not set
 
@@ -1206,17 +1138,176 @@
 #
 # 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_TEST 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 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=y
+# CONFIG_JOLIET is not set
+# CONFIG_ZISOFS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+CONFIG_DEVFS_FS=y
+# CONFIG_DEVFS_MOUNT is not set
+# CONFIG_DEVFS_DEBUG is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+CONFIG_HFS_FS=m
+CONFIG_HFSPLUS_FS=m
+# 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=y
+CONFIG_NFSD_V3=y
+# CONFIG_NFSD_V4 is not set
+# CONFIG_NFSD_TCP is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+CONFIG_MAC_PARTITION=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_NEC98_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION 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=m
+# 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
+
+#
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
 
diff -Nru a/arch/ppc/configs/cpci405_defconfig b/arch/ppc/configs/cpci405_defconfig
--- a/arch/ppc/configs/cpci405_defconfig	Tue Jun 15 22:21:02 2004
+++ b/arch/ppc/configs/cpci405_defconfig	Tue Jun 15 22:21:02 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -23,6 +24,7 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 # CONFIG_KALLSYMS is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
 # Loadable module support
@@ -59,22 +62,19 @@
 # IBM 4xx options
 #
 # CONFIG_ASH is not set
-# CONFIG_BEECH is not set
-# CONFIG_CEDAR is not set
 CONFIG_CPCI405=y
 # CONFIG_EP405 is not set
+# CONFIG_EVB405EP is not set
 # CONFIG_OAK is not set
-# CONFIG_REDWOOD_4 is not set
 # CONFIG_REDWOOD_5 is not set
 # CONFIG_REDWOOD_6 is not set
 # CONFIG_SYCAMORE is not set
-# CONFIG_TIVO is not set
 # CONFIG_WALNUT is not set
 CONFIG_IBM405_ERR77=y
 CONFIG_IBM405_ERR51=y
 CONFIG_IBM_OCP=y
+CONFIG_PPC_OCP=y
 CONFIG_405GP=y
-# CONFIG_405_DMA is not set
 # CONFIG_PM is not set
 CONFIG_UART0_TTYS0=y
 # CONFIG_UART0_TTYS1 is not set
@@ -90,7 +90,8 @@
 CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
-# CONFIG_CMDLINE_BOOL is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
 # Bus options
@@ -99,12 +100,6 @@
 CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_LEGACY_PROC=y
 # CONFIG_PCI_NAMES is not set
-# CONFIG_HOTPLUG is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
 
 #
 # Advanced setup
@@ -121,6 +116,10 @@
 CONFIG_BOOT_LOAD=0x00400000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 
@@ -130,30 +129,31 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # 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 is not set
 # CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_CARMEL is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
 # CONFIG_LBD is not set
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
@@ -174,6 +174,7 @@
 #
 # IDE chipset support/bugfixes
 #
+CONFIG_IDE_GENERIC=y
 # CONFIG_BLK_DEV_IDEPCI is not set
 # CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_IDEDMA_AUTO is not set
@@ -185,11 +186,17 @@
 # CONFIG_SCSI 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 (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -199,6 +206,10 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -214,14 +225,13 @@
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_DHCP is not set
 CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=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_INET_ECN is not set
 CONFIG_SYN_COOKIES=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -234,7 +244,6 @@
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
@@ -292,6 +301,12 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
+CONFIG_IBM_EMAC=y
+# CONFIG_IBM_EMAC_ERRMSG is not set
+CONFIG_IBM_EMAC_RXB=64
+CONFIG_IBM_EMAC_TXB=8
+CONFIG_IBM_EMAC_FGAP=8
+CONFIG_IBM_EMAC_SKBRES=0
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
 # CONFIG_PPP is not set
@@ -308,6 +323,7 @@
 # CONFIG_TR is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -328,16 +344,18 @@
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_ISDN is not set
 
 #
-# Graphics support
+# Telephony Support
 #
-# CONFIG_FB is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -374,10 +392,6 @@
 # CONFIG_INPUT_MISC is not set
 
 #
-# Macintosh device drivers
-#
-
-#
 # Character devices
 #
 # CONFIG_VT is not set
@@ -397,52 +411,8 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_UNIX98_PTYS 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
-
-#
-# I2C Hardware Bus support
-#
-# CONFIG_I2C_ALI1535 is not set
-# CONFIG_I2C_ALI15X3 is not set
-# CONFIG_I2C_AMD756 is not set
-# CONFIG_I2C_AMD8111 is not set
-# CONFIG_I2C_I801 is not set
-CONFIG_I2C_IBM_IIC=y
-# CONFIG_I2C_NFORCE2 is not set
-# CONFIG_I2C_PIIX4 is not set
-# CONFIG_I2C_SIS5595 is not set
-# CONFIG_I2C_SIS630 is not set
-# CONFIG_I2C_SIS96X is not set
-# CONFIG_I2C_VIAPRO is not set
-
-#
-# I2C Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-# CONFIG_SENSORS_ADM1021 is not set
-# CONFIG_SENSORS_EEPROM is not set
-# CONFIG_SENSORS_IT87 is not set
-# CONFIG_SENSORS_LM75 is not set
-# CONFIG_SENSORS_LM78 is not set
-# CONFIG_SENSORS_LM85 is not set
-# CONFIG_SENSORS_VIA686A is not set
-# CONFIG_SENSORS_W83781D is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -470,6 +440,15 @@
 # CONFIG_RAW_DRIVER is not set
 
 #
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Misc devices
+#
+
+#
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
@@ -480,6 +459,26 @@
 # 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
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -525,6 +524,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
@@ -541,13 +541,14 @@
 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_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -560,11 +561,11 @@
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-CONFIG_NLS=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
@@ -605,19 +606,8 @@
 # CONFIG_NLS_UTF8 is not set
 
 #
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
 # IBM 40x options
 #
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
 
 #
 # Library routines
diff -Nru a/arch/ppc/configs/ebony_defconfig b/arch/ppc/configs/ebony_defconfig
--- a/arch/ppc/configs/ebony_defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc/configs/ebony_defconfig	Tue Jun 15 22:20:38 2004
@@ -21,8 +21,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
@@ -33,6 +35,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -67,7 +70,6 @@
 CONFIG_440=y
 CONFIG_BOOKE=y
 CONFIG_IBM_OCP=y
-CONFIG_PPC_OCP=y
 # CONFIG_PM is not set
 CONFIG_NOT_COHERENT_CACHE=y
 
@@ -161,7 +163,6 @@
 #
 # Fusion MPT device support
 #
-# CONFIG_FUSION is not set
 
 #
 # IEEE 1394 (FireWire) support
@@ -210,8 +211,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -230,7 +229,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -251,16 +252,21 @@
 # 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)
@@ -277,7 +283,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -285,45 +290,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -495,6 +484,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 # CONFIG_TMPFS is not set
@@ -535,7 +525,6 @@
 # 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
 
 #
@@ -553,6 +542,7 @@
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 
 #
 # Kernel hacking
@@ -567,7 +557,7 @@
 CONFIG_BDI_SWITCH=y
 # CONFIG_DEBUG_INFO is not set
 # CONFIG_SERIAL_TEXT_DEBUG is not set
-CONFIG_OCP=y
+CONFIG_PPC_OCP=y
 
 #
 # Security options
diff -Nru a/arch/ppc/configs/ep405_defconfig b/arch/ppc/configs/ep405_defconfig
--- a/arch/ppc/configs/ep405_defconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc/configs/ep405_defconfig	Tue Jun 15 22:20:43 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -20,17 +21,22 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
-# CONFIG_EMBEDDED is not set
+CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
 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
@@ -59,16 +65,13 @@
 # IBM 4xx options
 #
 # CONFIG_ASH is not set
-# CONFIG_BEECH is not set
-# CONFIG_CEDAR is not set
+# CONFIG_BUBINGA is not set
 # CONFIG_CPCI405 is not set
 CONFIG_EP405=y
 # CONFIG_OAK is not set
-# CONFIG_REDWOOD_4 is not set
 # CONFIG_REDWOOD_5 is not set
 # CONFIG_REDWOOD_6 is not set
 # CONFIG_SYCAMORE is not set
-# CONFIG_TIVO is not set
 # CONFIG_WALNUT is not set
 # CONFIG_EP405PC is not set
 CONFIG_IBM405_ERR77=y
@@ -77,7 +80,6 @@
 CONFIG_BIOS_FIXUP=y
 CONFIG_405GP=y
 CONFIG_EMBEDDEDBOOT=y
-# CONFIG_405_DMA is not set
 # CONFIG_PM is not set
 CONFIG_UART0_TTYS0=y
 # CONFIG_UART0_TTYS1 is not set
@@ -93,7 +95,8 @@
 CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
-# CONFIG_CMDLINE_BOOL is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
 # Bus options
@@ -102,12 +105,6 @@
 CONFIG_PCI_DOMAINS=y
 # CONFIG_PCI_LEGACY_PROC is not set
 # CONFIG_PCI_NAMES is not set
-# CONFIG_HOTPLUG is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
 
 #
 # Advanced setup
@@ -124,6 +121,10 @@
 CONFIG_BOOT_LOAD=0x00400000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 
@@ -133,13 +134,18 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # 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
@@ -147,17 +153,13 @@
 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_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
 # CONFIG_LBD is not set
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 # CONFIG_IDE is not set
@@ -168,11 +170,16 @@
 # CONFIG_SCSI is not set
 
 #
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
 # Fusion MPT device support
 #
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -182,6 +189,10 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -197,30 +208,28 @@
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_DHCP is not set
 CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=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_INET_ECN 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_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
@@ -241,16 +250,21 @@
 # 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)
@@ -279,7 +293,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -287,59 +300,39 @@
 # 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_RCPCI 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
 
 #
-# Graphics support
+# Telephony Support
 #
-# CONFIG_FB is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -379,15 +372,9 @@
 # CONFIG_INPUT_MISC is not set
 
 #
-# Macintosh device drivers
-#
-
-#
 # Character devices
 #
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
+# CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -403,53 +390,9 @@
 #
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
-# CONFIG_UNIX98_PTYS is not set
-
-#
-# I2C support
-#
-CONFIG_I2C=y
-# CONFIG_I2C_CHARDEV is not set
-
-#
-# I2C Algorithms
-#
-# CONFIG_I2C_ALGOBIT is not set
-# CONFIG_I2C_ALGOPCF is not set
-
-#
-# I2C Hardware Bus support
-#
-# CONFIG_I2C_ALI1535 is not set
-# CONFIG_I2C_ALI15X3 is not set
-# CONFIG_I2C_AMD756 is not set
-# CONFIG_I2C_AMD8111 is not set
-# CONFIG_I2C_I801 is not set
-CONFIG_I2C_IBM_IIC=y
-# CONFIG_I2C_NFORCE2 is not set
-# CONFIG_I2C_PIIX4 is not set
-# CONFIG_I2C_SIS5595 is not set
-# CONFIG_I2C_SIS630 is not set
-# CONFIG_I2C_SIS96X is not set
-# CONFIG_I2C_VIAPRO is not set
-
-#
-# I2C Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-# CONFIG_SENSORS_ADM1021 is not set
-# CONFIG_SENSORS_EEPROM is not set
-# CONFIG_SENSORS_IT87 is not set
-# CONFIG_SENSORS_LM75 is not set
-# CONFIG_SENSORS_LM78 is not set
-# CONFIG_SENSORS_LM85 is not set
-# CONFIG_SENSORS_VIA686A is not set
-# CONFIG_SENSORS_W83781D is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -477,6 +420,15 @@
 # CONFIG_RAW_DRIVER is not set
 
 #
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Misc devices
+#
+
+#
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
@@ -487,6 +439,26 @@
 # 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
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -519,7 +491,9 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
@@ -530,6 +504,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
@@ -546,17 +521,17 @@
 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_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# 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_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
 
 #
@@ -566,31 +541,26 @@
 CONFIG_MSDOS_PARTITION=y
 
 #
-# Sound
+# Native Language Support
 #
-# CONFIG_SOUND is not set
+# CONFIG_NLS is not set
 
 #
 # IBM 40x options
 #
 
 #
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
-
-#
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 
 #
 # Kernel hacking
 #
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SERIAL_TEXT_DEBUG is not set
-CONFIG_OCP=y
+CONFIG_PPC_OCP=y
 
 #
 # Security options
diff -Nru a/arch/ppc/configs/ibmchrp_defconfig b/arch/ppc/configs/ibmchrp_defconfig
--- a/arch/ppc/configs/ibmchrp_defconfig	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc/configs/ibmchrp_defconfig	Tue Jun 15 22:20:40 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -20,9 +21,12 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
@@ -32,6 +36,8 @@
 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
@@ -108,12 +114,6 @@
 CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
-# CONFIG_HOTPLUG is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
 
 #
 # Advanced setup
@@ -130,6 +130,10 @@
 CONFIG_BOOT_LOAD=0x00800000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 
@@ -139,6 +143,11 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
 # CONFIG_PNP is not set
@@ -155,17 +164,13 @@
 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_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_LBD=y
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 # CONFIG_IDE is not set
@@ -195,6 +200,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -209,6 +220,7 @@
 # CONFIG_SCSI_ADVANSYS is not set
 # CONFIG_SCSI_IN2000 is not set
 # CONFIG_SCSI_MEGARAID 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
@@ -227,14 +239,23 @@
 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_PAS16 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
+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_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
@@ -243,12 +264,22 @@
 # CONFIG_SCSI_MAC53C94 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
+
+#
 # Fusion MPT device support
 #
 # CONFIG_FUSION is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -258,6 +289,15 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+# CONFIG_ADB is not set
+# CONFIG_ADB_CUDA is not set
+# CONFIG_ADB_PMU is not set
+# CONFIG_MAC_FLOPPY is not set
+# CONFIG_MAC_SERIAL is not set
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -278,7 +318,6 @@
 # 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=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -289,8 +328,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -345,14 +382,17 @@
 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)
 #
-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
@@ -373,16 +413,21 @@
 # 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)
@@ -414,6 +459,7 @@
 # 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
@@ -440,7 +486,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -448,104 +493,40 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_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_NET_FC is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# 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_IMSTT is not set
-# 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_MULTIHEAD 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_3DFX=y
-# 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=y
-# 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
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
-CONFIG_LOGO_LINUX_CLUT224=y
+# CONFIG_ISDN is not set
 
 #
-# Old CD-ROM drivers (not SCSI, not IDE)
+# Telephony Support
 #
-# CONFIG_CD_NO_IDESCSI is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -581,31 +562,22 @@
 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_PS2_SYNAPTICS is not set
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_INPORT is not set
 # CONFIG_MOUSE_LOGIBM is not set
 # CONFIG_MOUSE_PC110PAD 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_UINPUT=y
 
 #
-# Macintosh device drivers
-#
-# CONFIG_ADB_CUDA is not set
-# CONFIG_ADB_PMU is not set
-# CONFIG_MAC_FLOPPY is not set
-# CONFIG_MAC_SERIAL is not set
-# CONFIG_ADB is not set
-
-#
 # Character devices
 #
 CONFIG_VT=y
@@ -627,30 +599,8 @@
 CONFIG_SERIAL_CORE=y
 # CONFIG_SERIAL_PMACZILOG is not set
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# I2C Algorithms
-#
-
-#
-# I2C Hardware Bus support
-#
-
-#
-# I2C Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-
-#
-# Mice
-#
-CONFIG_BUSMOUSE=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -678,6 +628,15 @@
 # CONFIG_RAW_DRIVER is not set
 
 #
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Misc devices
+#
+
+#
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
@@ -688,6 +647,75 @@
 # CONFIG_DVB is not set
 
 #
+# Graphics support
+#
+CONFIG_FB=y
+# 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_IMSTT is not set
+# 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_MULTIHEAD 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 is not set
+CONFIG_FB_3DFX=y
+# 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=y
+# 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
+
+#
+# Logo configuration
+#
+CONFIG_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_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
@@ -724,10 +752,10 @@
 #
 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=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
 # CONFIG_HUGETLB_PAGE is not set
@@ -739,6 +767,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
@@ -759,7 +788,6 @@
 # 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
 
 #
@@ -782,11 +810,11 @@
 # CONFIG_ULTRIX_PARTITION is not set
 # CONFIG_SUN_PARTITION is not set
 # CONFIG_EFI_PARTITION is not set
-CONFIG_NLS=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
@@ -827,20 +855,10 @@
 # CONFIG_NLS_UTF8 is not set
 
 #
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
-
-#
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 
 #
 # Kernel hacking
diff -Nru a/arch/ppc/configs/lopec_defconfig b/arch/ppc/configs/lopec_defconfig
--- a/arch/ppc/configs/lopec_defconfig	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc/configs/lopec_defconfig	Tue Jun 15 22:20:42 2004
@@ -4,23 +4,39 @@
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=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_STANDALONE=y
+CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_EMBEDDED is not set
+CONFIG_HOTPLUG=y
+# 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_IOSCHED_CFQ=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
 # Loadable module support
@@ -33,24 +49,25 @@
 CONFIG_KMOD=y
 
 #
-# Platform support
+# Processor
 #
-CONFIG_PPC=y
-CONFIG_PPC32=y
 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_ALTIVEC=y
+# CONFIG_TAU is not set
+# CONFIG_CPU_FREQ is not set
+CONFIG_PPC_STD_MMU=y
 
 #
-# IBM 4xx options
+# Platform options
 #
-# CONFIG_8260 is not set
-CONFIG_GENERIC_ISA_DMA=y
-CONFIG_PPC_STD_MMU=y
 # CONFIG_PPC_MULTIPLATFORM is not set
 # CONFIG_APUS is not set
-# CONFIG_WILLOW_2 is not set
+# CONFIG_WILLOW is not set
 # CONFIG_PCORE is not set
 # CONFIG_POWERPMC250 is not set
 # CONFIG_EV64260 is not set
@@ -66,26 +83,31 @@
 # CONFIG_K2 is not set
 # CONFIG_PAL4 is not set
 # CONFIG_GEMINI is not set
+# CONFIG_EST8260 is not set
+# CONFIG_SBS8260 is not set
+# CONFIG_RPX6 is not set
+# CONFIG_TQM8260 is not set
 CONFIG_EPIC_SERIAL_MODE=y
+CONFIG_MPC10X_BRIDGE=y
+# CONFIG_MPC10X_STORE_GATHERING is not set
+CONFIG_PPCBUG_NVRAM=y
 # CONFIG_SMP is not set
 # CONFIG_PREEMPT is not set
-CONFIG_ALTIVEC=y
-# CONFIG_TAU is not set
-# CONFIG_CPU_FREQ is not set
+# CONFIG_HIGHMEM is not set
+CONFIG_KERNEL_ELF=y
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_MISC=m
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
-# General setup
+# Bus options
 #
-# CONFIG_HIGHMEM is not set
+CONFIG_GENERIC_ISA_DMA=y
 CONFIG_PCI=y
 CONFIG_PCI_DOMAINS=y
-CONFIG_KCORE_ELF=y
-CONFIG_BINFMT_ELF=y
-CONFIG_KERNEL_ELF=y
-CONFIG_BINFMT_MISC=m
 # CONFIG_PCI_LEGACY_PROC is not set
 CONFIG_PCI_NAMES=y
-CONFIG_HOTPLUG=y
 
 #
 # PCMCIA/CardBus support
@@ -93,15 +115,6 @@
 # CONFIG_PCMCIA is not set
 
 #
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-CONFIG_PPC601_SYNC_FIX=y
-# CONFIG_PPCBUG_NVRAM is not set
-CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="ip=on"
-
-#
 # Advanced setup
 #
 # CONFIG_ADVANCED_OPTIONS is not set
@@ -116,14 +129,27 @@
 CONFIG_BOOT_LOAD=0x00800000
 
 #
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+# 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
 #
-# CONFIG_PNP is not set
 
 #
 # Block devices
@@ -134,47 +160,77 @@
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
 CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_CARMEL is not set
 CONFIG_BLK_DEV_RAM=m
 CONFIG_BLK_DEV_RAM_SIZE=4096
-# CONFIG_BLK_DEV_INITRD is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
+# CONFIG_LBD is not set
 
 #
-# ATA/IDE/MFM/RLL support
+# ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
-
-#
-# IDE, ATA and ATAPI Block devices
-#
 CONFIG_BLK_DEV_IDE=y
 
 #
 # Please see Documentation/ide.txt for help/info on IDE drives
 #
-# CONFIG_BLK_DEV_HD is not set
 CONFIG_BLK_DEV_IDEDISK=y
 CONFIG_IDEDISK_MULTI_MODE=y
 # CONFIG_IDEDISK_STROKE is not set
-# CONFIG_BLK_DEV_IDECD 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
 #
-# CONFIG_BLK_DEV_IDEPCI is not set
+CONFIG_IDE_GENERIC=y
+CONFIG_BLK_DEV_IDEPCI=y
+# CONFIG_IDEPCI_SHARE_IRQ is not set
+# 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_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
+# CONFIG_BLK_DEV_CMD64X is not set
+# CONFIG_BLK_DEV_TRIFLEX is not set
+# CONFIG_BLK_DEV_CY82C693 is not set
+# CONFIG_BLK_DEV_CS5520 is not set
+# CONFIG_BLK_DEV_CS5530 is not set
+# CONFIG_BLK_DEV_HPT34X is not set
+# CONFIG_BLK_DEV_HPT366 is not set
+# CONFIG_BLK_DEV_SC1200 is not set
+# CONFIG_BLK_DEV_PIIX is not set
+# CONFIG_BLK_DEV_NS87415 is not set
+# CONFIG_BLK_DEV_PDC202XX_OLD is not set
+# CONFIG_BLK_DEV_PDC202XX_NEW is not set
+# CONFIG_BLK_DEV_SVWKS is not set
+# CONFIG_BLK_DEV_SIIMAGE is not set
+# CONFIG_BLK_DEV_SLC90E66 is not set
+# CONFIG_BLK_DEV_TRM290 is not set
+# CONFIG_BLK_DEV_VIA82CXXX is not set
+CONFIG_BLK_DEV_IDEDMA=y
+# CONFIG_IDEDMA_IVB is not set
+CONFIG_IDEDMA_AUTO=y
+# CONFIG_BLK_DEV_HD is not set
 
 #
-# SCSI support
+# SCSI device support
 #
 CONFIG_SCSI=y
+CONFIG_SCSI_PROC_FS=y
 
 #
 # SCSI support type (disk, tape, CD-ROM)
@@ -194,6 +250,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -202,11 +264,9 @@
 # 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_AM53C974 is not set
 # CONFIG_SCSI_MEGARAID 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
@@ -214,34 +274,41 @@
 # 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_INITIO is not set
+# CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_INIA100 is not set
-# CONFIG_SCSI_NCR53C7xx 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_PCI2000 is not set
-# CONFIG_SCSI_PCI2220I 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_QLA6322 is not set
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
-# CONFIG_SCSI_U14_34F 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 (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -251,6 +318,10 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -261,38 +332,37 @@
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 # CONFIG_NETLINK_DEV is not set
-# CONFIG_NETFILTER 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_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_INET_ECN 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_IPV6 is not set
-# CONFIG_XFRM_USER 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_BRIDGE 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
@@ -310,17 +380,21 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+CONFIG_DUMMY=m
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-CONFIG_DUMMY=m
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
-# CONFIG_ETHERTAP is not set
 
 #
 # Ethernet (10 or 100Mbit)
@@ -342,9 +416,11 @@
 # 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
@@ -373,102 +449,49 @@
 # 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_NET_FC is not set
-# 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_NET_FC is not set
+# CONFIG_RCPCI 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
 
 #
-# Graphics support
+# Telephony Support
 #
-CONFIG_FB=y
-# CONFIG_FB_CIRRUS is not set
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_CT65550 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_MATROX=y
-CONFIG_FB_MATROX_MILLENIUM=y
-# CONFIG_FB_MATROX_MYSTIQUE is not set
-# CONFIG_FB_MATROX_G450 is not set
-CONFIG_FB_MATROX_G100A=y
-CONFIG_FB_MATROX_G100=y
-# CONFIG_FB_MATROX_MULTIHEAD 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_3DFX is not set
-# CONFIG_FB_VOODOO1 is not set
-# CONFIG_FB_TRIDENT is not set
-# CONFIG_FB_PM3 is not set
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
-CONFIG_LOGO_LINUX_CLUT224=y
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
 #
-CONFIG_INPUT=m
+# CONFIG_INPUT is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=m
-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=m
-# CONFIG_INPUT_EVBUG is not set
 
 #
 # Input I/O drivers
@@ -476,23 +499,16 @@
 # 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=y
-CONFIG_INPUT_MOUSE=y
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Macintosh device drivers
-#
 
 #
 # Character devices
 #
+# CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -500,6 +516,7 @@
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=1
 # CONFIG_SERIAL_8250_EXTENDED is not set
 
 #
@@ -508,26 +525,8 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# I2C Hardware Sensors Mainboard support
-#
-
-#
-# I2C Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -553,122 +552,30 @@
 # CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
-# CONFIG_HANGCHECK_TIMER is not set
 
 #
-# Multimedia devices
-#
-CONFIG_VIDEO_DEV=m
-
-#
-# Video For Linux
+# I2C support
 #
-CONFIG_VIDEO_PROC_FS=y
+# CONFIG_I2C is not set
 
 #
-# Video Adapters
+# Misc devices
 #
-# CONFIG_VIDEO_PMS is not set
-# CONFIG_VIDEO_CPIA is not set
-# CONFIG_VIDEO_STRADIS is not set
 
 #
-# Radio Adapters
+# Multimedia devices
 #
-# CONFIG_RADIO_GEMTEK_PCI is not set
-# CONFIG_RADIO_MAXIRADIO is not set
-# CONFIG_RADIO_MAESTRO is not set
+# CONFIG_VIDEO_DEV is not set
 
 #
 # Digital Video Broadcasting Devices
 #
 # CONFIG_DVB is not set
-# CONFIG_VIDEO_BTCX 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
-# 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_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
-# CONFIG_DEVPTS_FS_XATTR is not set
-CONFIG_TMPFS=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_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_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_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
-
-#
-# Partition Types
+# Graphics support
 #
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
+# CONFIG_FB is not set
 
 #
 # Sound
@@ -707,26 +614,20 @@
 # USB Human Interface Devices (HID)
 #
 CONFIG_USB_HID=m
-CONFIG_USB_HIDINPUT=y
-# CONFIG_HID_FF is not set
+
+#
+# Input core support is needed for USB HID input layer or HIDBP support
+#
 # CONFIG_USB_HIDDEV is not set
 
 #
 # USB HID Boot Protocol drivers
 #
-# CONFIG_USB_KBD is not set
-# CONFIG_USB_MOUSE is not set
-# 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_XPAD is not set
 
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
-CONFIG_USB_SCANNER=m
 # CONFIG_USB_MICROTEK is not set
 # CONFIG_USB_HPUSBSCSI is not set
 
@@ -734,14 +635,10 @@
 # USB Multimedia devices
 #
 # CONFIG_USB_DABUSB is not set
-# CONFIG_USB_VICAM is not set
-# CONFIG_USB_DSBR is not set
-# CONFIG_USB_IBMCAM is not set
-# CONFIG_USB_KONICAWC is not set
-# CONFIG_USB_OV511 is not set
-# CONFIG_USB_PWC is not set
-CONFIG_USB_SE401=m
-# CONFIG_USB_STV680 is not set
+
+#
+# Video4Linux support is needed for USB Multimedia device support
+#
 
 #
 # USB Network adaptors
@@ -785,28 +682,126 @@
 #
 # 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_PHIDGETSERVO is not set
 # CONFIG_USB_TEST is not set
+
+#
+# USB Gadget Support
+#
 # CONFIG_USB_GADGET is not set
 
 #
-# Bluetooth support
+# File systems
 #
-# CONFIG_BT is not set
+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
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_FAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_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
 
 #
 # Library routines
 #
 # CONFIG_CRC32 is not set
+# CONFIG_LIBCRC32C is not set
 
 #
 # Kernel hacking
 #
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_KALLSYMS is not set
 # CONFIG_SERIAL_TEXT_DEBUG is not set
 
 #
diff -Nru a/arch/ppc/configs/ocotea_defconfig b/arch/ppc/configs/ocotea_defconfig
--- a/arch/ppc/configs/ocotea_defconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc/configs/ocotea_defconfig	Tue Jun 15 22:20:43 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -23,14 +24,16 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
-# CONFIG_EMBEDDED 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
@@ -63,9 +66,9 @@
 CONFIG_OCOTEA=y
 CONFIG_440GX=y
 CONFIG_440A=y
-CONFIG_PIN_TLB=y
 CONFIG_BOOKE=y
 CONFIG_IBM_OCP=y
+CONFIG_PPC_OCP=y
 CONFIG_IBM_EMAC4=y
 # CONFIG_PM is not set
 CONFIG_NOT_COHERENT_CACHE=y
@@ -90,12 +93,6 @@
 CONFIG_PCI_DOMAINS=y
 # CONFIG_PCI_LEGACY_PROC is not set
 # CONFIG_PCI_NAMES is not set
-# CONFIG_HOTPLUG is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
 
 #
 # Advanced setup
@@ -112,8 +109,13 @@
 CONFIG_BOOT_LOAD=0x01000000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
+# CONFIG_DEBUG_DRIVER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -121,29 +123,29 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # 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 is not set
 # CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_CARMEL is not set
 # CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_LBD is not set
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 # CONFIG_IDE is not set
@@ -154,11 +156,17 @@
 # CONFIG_SCSI 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 (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -168,6 +176,10 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -190,7 +202,6 @@
 # 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
@@ -219,7 +230,6 @@
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
@@ -289,6 +299,12 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
+CONFIG_IBM_EMAC=y
+# CONFIG_IBM_EMAC_ERRMSG is not set
+CONFIG_IBM_EMAC_RXB=128
+CONFIG_IBM_EMAC_TXB=128
+CONFIG_IBM_EMAC_FGAP=8
+CONFIG_IBM_EMAC_SKBRES=0
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
 # CONFIG_PPP is not set
@@ -305,6 +321,7 @@
 # CONFIG_TR is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -325,23 +342,18 @@
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
-
-#
-# Graphics support
-#
-# CONFIG_FB is not set
+# CONFIG_ISDN is not set
 
 #
-# Console display driver support
+# Telephony Support
 #
-CONFIG_VGA_CONSOLE=y
-# CONFIG_MDA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -381,15 +393,9 @@
 # CONFIG_INPUT_MISC is not set
 
 #
-# Macintosh device drivers
-#
-
-#
 # Character devices
 #
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
+# CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -411,30 +417,8 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# I2C Algorithms
-#
-
-#
-# I2C Hardware Bus support
-#
-
-#
-# I2C Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -461,6 +445,15 @@
 # CONFIG_RAW_DRIVER is not set
 
 #
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Misc devices
+#
+
+#
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
@@ -471,6 +464,26 @@
 # 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
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
 # File systems
 #
 # CONFIG_EXT2_FS is not set
@@ -503,7 +516,6 @@
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
 # CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLB_PAGE is not set
@@ -515,6 +527,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
@@ -531,12 +544,13 @@
 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_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -551,15 +565,9 @@
 CONFIG_MSDOS_PARTITION=y
 
 #
-# Sound
+# Native Language Support
 #
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
+# CONFIG_NLS is not set
 
 #
 # Library routines
diff -Nru a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
--- a/arch/ppc/configs/pmac_defconfig	Tue Jun 15 22:21:01 2004
+++ b/arch/ppc/configs/pmac_defconfig	Tue Jun 15 22:21:01 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -20,9 +21,12 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_HOTPLUG=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
@@ -32,6 +36,8 @@
 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
@@ -119,23 +125,18 @@
 CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
-CONFIG_HOTPLUG=y
 
 #
 # PCMCIA/CardBus support
 #
 CONFIG_PCMCIA=m
+# CONFIG_PCMCIA_DEBUG is not set
 CONFIG_YENTA=m
 CONFIG_CARDBUS=y
 CONFIG_I82092=m
 CONFIG_TCIC=m
 
 #
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
 # Advanced setup
 #
 CONFIG_ADVANCED_OPTIONS=y
@@ -149,6 +150,10 @@
 CONFIG_BOOT_LOAD=0x00800000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 # CONFIG_FW_LOADER is not set
@@ -159,13 +164,18 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # 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
@@ -173,17 +183,13 @@
 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_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_LBD=y
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
@@ -206,6 +212,7 @@
 #
 # IDE chipset support/bugfixes
 #
+# CONFIG_IDE_GENERIC is not set
 CONFIG_BLK_DEV_IDEPCI=y
 CONFIG_IDEPCI_SHARE_IRQ=y
 # CONFIG_BLK_DEV_OFFBOARD is not set
@@ -213,7 +220,6 @@
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_SL82C105=y
 CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDE_TCQ is not set
 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
 CONFIG_IDEDMA_PCI_AUTO=y
 # CONFIG_IDEDMA_ONLYDISK is not set
@@ -274,6 +280,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -282,7 +294,6 @@
 CONFIG_SCSI_AIC7XXX=m
 CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
 CONFIG_AIC7XXX_RESET_DELAY_MS=15000
-# CONFIG_AIC7XXX_PROBE_EISA_VL is not set
 # CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
 CONFIG_AIC7XXX_DEBUG_ENABLE=y
 CONFIG_AIC7XXX_DEBUG_MASK=0
@@ -291,6 +302,7 @@
 # CONFIG_SCSI_AIC79XX is not set
 CONFIG_SCSI_ADVANSYS=m
 # CONFIG_SCSI_MEGARAID 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
@@ -305,10 +317,19 @@
 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_QLA6322 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
 CONFIG_SCSI_MESH=y
@@ -323,6 +344,12 @@
 # CONFIG_PCMCIA_FDOMAIN is not set
 # CONFIG_PCMCIA_NINJA_SCSI is not set
 # CONFIG_PCMCIA_QLOGIC is not set
+# CONFIG_PCMCIA_SYM53C500 is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
 
 #
 # Fusion MPT device support
@@ -330,7 +357,7 @@
 # CONFIG_FUSION is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 CONFIG_IEEE1394=m
 
@@ -339,14 +366,13 @@
 #
 # 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
 #
-
-#
-# Texas Instruments PCILynx requires I2C bit-banging
-#
+# CONFIG_IEEE1394_PCILYNX is not set
 CONFIG_IEEE1394_OHCI1394=m
 
 #
@@ -366,6 +392,24 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+CONFIG_ADB=y
+CONFIG_ADB_CUDA=y
+CONFIG_ADB_PMU=y
+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
+CONFIG_THERM_WINDTUNNEL=m
+CONFIG_THERM_ADT746X=m
+# CONFIG_ANSLCD is not set
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -386,7 +430,6 @@
 # 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=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -397,8 +440,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -453,14 +494,17 @@
 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)
 #
-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
@@ -481,18 +525,69 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
-CONFIG_NETDEVICES=y
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+CONFIG_IRDA=m
 
 #
-# ARCnet devices
+# IrDA protocols
 #
-# CONFIG_ARCNET is not set
+CONFIG_IRLAN=m
+CONFIG_IRNET=m
+CONFIG_IRCOMM=m
+# CONFIG_IRDA_ULTRA is not set
+
+#
+# IrDA options
+#
+CONFIG_IRDA_CACHE_LAST_LSAP=y
+CONFIG_IRDA_FAST_RR=y
+# CONFIG_IRDA_DEBUG is not set
+
+#
+# Infrared-port device drivers
+#
+
+#
+# SIR device drivers
+#
+CONFIG_IRTTY_SIR=m
+
+#
+# Dongle support
+#
+# CONFIG_DONGLE is not set
+
+#
+# Old SIR device drivers
+#
+# CONFIG_IRPORT_SIR is not set
+
+#
+# Old Serial dongle support
+#
+
+#
+# FIR device drivers
+#
+# CONFIG_USB_IRDA is not set
+# CONFIG_SIGMATEL_FIR is not set
+# CONFIG_TOSHIBA_FIR is not set
+# CONFIG_VLSI_FIR 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
@@ -515,6 +610,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
@@ -539,7 +635,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -547,17 +642,12 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=y
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=y
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=y
-CONFIG_PPP_BSDCOMP=m
-# CONFIG_PPPOE is not set
-# CONFIG_SLIP is not set
+# CONFIG_S2IO is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
 
 #
 # Wireless LAN (non-hamradio)
@@ -585,28 +675,20 @@
 # CONFIG_PLX_HERMES is not set
 # CONFIG_TMD_HERMES is not set
 # CONFIG_PCI_HERMES is not set
+# CONFIG_ATMEL is not set
 
 #
 # Wireless 802.11b Pcmcia/Cardbus cards support
 #
 CONFIG_PCMCIA_HERMES=m
 # CONFIG_AIRO_CS is not set
-# CONFIG_PCMCIA_ATMEL is not set
 # CONFIG_PCMCIA_WL3501 is not set
-CONFIG_NET_WIRELESS=y
 
 #
-# Token Ring devices
+# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
 #
-# CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
+# CONFIG_PRISM54 is not set
+CONFIG_NET_WIRELESS=y
 
 #
 # PCMCIA network device support
@@ -622,123 +704,34 @@
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-CONFIG_IRDA=m
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=m
-CONFIG_IRNET=m
-CONFIG_IRCOMM=m
-# CONFIG_IRDA_ULTRA is not set
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-# CONFIG_IRDA_DEBUG is not set
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=m
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-# CONFIG_USB_IRDA is not set
-# CONFIG_TOSHIBA_FIR is not set
-# CONFIG_VLSI_FIR 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=y
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=y
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=y
+CONFIG_PPP_BSDCOMP=m
+# CONFIG_PPPOE is not set
+# 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
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# CONFIG_FB_CYBER2000 is not set
-CONFIG_FB_OF=y
-CONFIG_FB_CONTROL=y
-CONFIG_FB_PLATINUM=y
-CONFIG_FB_VALKYRIE=y
-CONFIG_FB_CT65550=y
-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_MULTIHEAD is not set
-CONFIG_FB_RADEON=y
-CONFIG_FB_ATY128=y
-CONFIG_FB_ATY=y
-CONFIG_FB_ATY_CT=y
-CONFIG_FB_ATY_GX=y
-# CONFIG_FB_ATY_XL_INIT is not set
-# CONFIG_FB_SIS is not set
-# CONFIG_FB_NEOMAGIC is not set
-CONFIG_FB_3DFX=y
-# CONFIG_FB_VOODOO1 is not set
-# CONFIG_FB_TRIDENT is not set
-# CONFIG_FB_VIRTUAL is not set
+# CONFIG_ISDN is not set
 
 #
-# Console display driver support
+# Telephony 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
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
-CONFIG_LOGO_LINUX_CLUT224=y
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -774,32 +767,18 @@
 CONFIG_INPUT_KEYBOARD=y
 # CONFIG_KEYBOARD_ATKBD is not set
 # 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 is not set
 # 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
 
 #
-# Macintosh device drivers
-#
-CONFIG_ADB_CUDA=y
-CONFIG_ADB_PMU=y
-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=y
-CONFIG_ADB_MACIO=y
-CONFIG_INPUT_ADBHID=y
-CONFIG_MAC_EMUMOUSEBTN=y
-# CONFIG_ANSLCD is not set
-
-#
 # Character devices
 #
 CONFIG_VT=y
@@ -822,83 +801,112 @@
 CONFIG_SERIAL_PMACZILOG=y
 # CONFIG_SERIAL_PMACZILOG_CONSOLE is not set
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_QIC02_TAPE is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+CONFIG_NVRAM=y
+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_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
 
 #
 # I2C support
 #
-CONFIG_I2C=m
+CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=m
 
 #
 # I2C Algorithms
 #
-# CONFIG_I2C_ALGOBIT is not set
+CONFIG_I2C_ALGOBIT=y
 # CONFIG_I2C_ALGOPCF 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_HYDRA is not set
 # CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
+# CONFIG_I2C_ISA is not set
 CONFIG_I2C_KEYWEST=m
 # CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 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_EEPROM is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
 
 #
-# Mice
+# Other I2C Chip support
 #
-CONFIG_BUSMOUSE=y
-# CONFIG_QIC02_TAPE is not set
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
-CONFIG_NVRAM=y
-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_FTAPE is not set
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 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
 
 #
-# PCMCIA character devices
+# Misc devices
 #
-# CONFIG_SYNCLINK_CS is not set
-# CONFIG_RAW_DRIVER is not set
 
 #
 # Multimedia devices
@@ -911,157 +919,64 @@
 # CONFIG_DVB 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
-# 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=y
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_DEVFS_FS=y
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-CONFIG_DEVPTS_FS=y
-# CONFIG_DEVPTS_FS_XATTR is not set
-CONFIG_TMPFS=y
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-CONFIG_HFS_FS=m
-# 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
+# Graphics support
 #
-CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
-# CONFIG_NFS_V4 is not set
-CONFIG_NFSD=y
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
-CONFIG_LOCKD=y
-CONFIG_EXPORTFS=y
-CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT 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
+CONFIG_FB=y
+# CONFIG_FB_PM2 is not set
+# CONFIG_FB_CYBER2000 is not set
+CONFIG_FB_OF=y
+CONFIG_FB_CONTROL=y
+CONFIG_FB_PLATINUM=y
+CONFIG_FB_VALKYRIE=y
+CONFIG_FB_CT65550=y
+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_I2C is not set
+# CONFIG_FB_MATROX_MULTIHEAD is not set
+# CONFIG_FB_RADEON_OLD is not set
+CONFIG_FB_RADEON=y
+CONFIG_FB_RADEON_I2C=y
+# CONFIG_FB_RADEON_DEBUG is not set
+CONFIG_FB_ATY128=y
+CONFIG_FB_ATY=y
+CONFIG_FB_ATY_CT=y
+CONFIG_FB_ATY_GX=y
+# CONFIG_FB_ATY_XL_INIT 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_VOODOO1 is not set
+# CONFIG_FB_TRIDENT is not set
+# CONFIG_FB_VIRTUAL is not set
 
 #
-# Partition Types
+# Console display driver support
 #
-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_NEC98_PARTITION is not set
-# CONFIG_SGI_PARTITION is not set
-# CONFIG_ULTRIX_PARTITION is not set
-# CONFIG_SUN_PARTITION is not set
-# CONFIG_EFI_PARTITION is not set
-CONFIG_SMB_NLS=y
-CONFIG_NLS=y
+# 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
 
 #
-# Native Language Support
+# Logo configuration
 #
-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=m
-# 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_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 
 #
 # Sound
@@ -1074,6 +989,9 @@
 # Advanced Linux Sound Architecture
 #
 CONFIG_SND=m
+CONFIG_SND_TIMER=m
+CONFIG_SND_PCM=m
+CONFIG_SND_RAWMIDI=m
 CONFIG_SND_SEQUENCER=m
 CONFIG_SND_SEQ_DUMMY=m
 CONFIG_SND_OSSEMUL=y
@@ -1096,11 +1014,17 @@
 # PCI devices
 #
 # CONFIG_SND_ALI5451 is not set
+# CONFIG_SND_ATIIXP is not set
+# CONFIG_SND_AU8810 is not set
+# CONFIG_SND_AU8820 is not set
+# CONFIG_SND_AU8830 is not set
 # CONFIG_SND_AZT3328 is not set
+# CONFIG_SND_BT87X is not set
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_EMU10K1 is not set
 # CONFIG_SND_KORG1212 is not set
+# CONFIG_SND_MIXART is not set
 # CONFIG_SND_NM256 is not set
 # CONFIG_SND_RME32 is not set
 # CONFIG_SND_RME96 is not set
@@ -1119,6 +1043,7 @@
 # CONFIG_SND_ICE1712 is not set
 # CONFIG_SND_ICE1724 is not set
 # CONFIG_SND_INTEL8X0 is not set
+# CONFIG_SND_INTEL8X0M is not set
 # CONFIG_SND_SONICVIBES is not set
 # CONFIG_SND_VIA82XX is not set
 # CONFIG_SND_VX222 is not set
@@ -1136,8 +1061,6 @@
 #
 # PCMCIA devices
 #
-# CONFIG_SND_VXPOCKET is not set
-# CONFIG_SND_VXP440 is not set
 
 #
 # Open Sound System
@@ -1185,13 +1108,14 @@
 # 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_XPAD is not set
+# CONFIG_USB_ATI_REMOTE is not set
 
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
-CONFIG_USB_SCANNER=m
 # CONFIG_USB_MICROTEK is not set
 # CONFIG_USB_HPUSBSCSI is not set
 
@@ -1246,17 +1170,180 @@
 #
 # 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_TEST 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=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
+# 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=y
+# CONFIG_JOLIET is not set
+# CONFIG_ZISOFS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+CONFIG_DEVFS_FS=y
+# CONFIG_DEVFS_MOUNT is not set
+# CONFIG_DEVFS_DEBUG is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+CONFIG_HFS_FS=m
+CONFIG_HFSPLUS_FS=m
+# 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=y
+# CONFIG_NFSD_V3 is not set
+# CONFIG_NFSD_TCP is not set
+CONFIG_LOCKD=y
+CONFIG_EXPORTFS=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+CONFIG_SMB_FS=m
+# CONFIG_SMB_NLS_DEFAULT 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=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_NEC98_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION 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=m
+# 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
+
+#
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
 
diff -Nru a/arch/ppc/configs/power3_defconfig b/arch/ppc/configs/power3_defconfig
--- a/arch/ppc/configs/power3_defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc/configs/power3_defconfig	Tue Jun 15 22:20:38 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -19,9 +20,12 @@
 #
 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=15
+# CONFIG_HOTPLUG is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
@@ -31,6 +35,8 @@
 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
@@ -41,6 +47,7 @@
 CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
 CONFIG_KMOD=y
+CONFIG_STOP_MACHINE=y
 
 #
 # Processor
@@ -88,6 +95,7 @@
 CONFIG_SMP=y
 # CONFIG_IRQ_ALL_CPUS is not set
 CONFIG_NR_CPUS=32
+# CONFIG_PREEMPT is not set
 CONFIG_HIGHMEM=y
 CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_ELF=y
@@ -106,19 +114,6 @@
 CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
-# CONFIG_HOTPLUG is not set
-
-#
-# Parallel port support
-#
-CONFIG_PARPORT=m
-CONFIG_PARPORT_PC=m
-CONFIG_PARPORT_PC_CML1=m
-# CONFIG_PARPORT_SERIAL is not set
-CONFIG_PARPORT_PC_FIFO=y
-# CONFIG_PARPORT_PC_SUPERIO is not set
-# CONFIG_PARPORT_OTHER is not set
-# CONFIG_PARPORT_1284 is not set
 
 #
 # Advanced setup
@@ -135,6 +130,10 @@
 CONFIG_BOOT_LOAD=0x00800000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 
@@ -144,6 +143,18 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+CONFIG_PARPORT=m
+CONFIG_PARPORT_PC=m
+CONFIG_PARPORT_PC_CML1=m
+# CONFIG_PARPORT_SERIAL is not set
+CONFIG_PARPORT_PC_FIFO=y
+# CONFIG_PARPORT_PC_SUPERIO is not set
+# CONFIG_PARPORT_OTHER is not set
+# CONFIG_PARPORT_1284 is not set
+
+#
 # Plug and Play support
 #
 # CONFIG_PNP is not set
@@ -161,24 +172,13 @@
 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_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_LBD=y
 
 #
-# 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_RAID5=y
-# CONFIG_MD_MULTIPATH is not set
-CONFIG_BLK_DEV_DM=y
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 # CONFIG_IDE is not set
@@ -208,6 +208,12 @@
 CONFIG_SCSI_LOGGING=y
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -222,6 +228,7 @@
 # CONFIG_SCSI_ADVANSYS is not set
 # CONFIG_SCSI_IN2000 is not set
 # CONFIG_SCSI_MEGARAID 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
@@ -242,14 +249,23 @@
 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_PAS16 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
+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_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
@@ -258,12 +274,31 @@
 # CONFIG_SCSI_MAC53C94 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=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_MD_LINEAR=y
+CONFIG_MD_RAID0=y
+CONFIG_MD_RAID1=y
+CONFIG_MD_RAID5=y
+CONFIG_MD_RAID6=y
+# CONFIG_MD_MULTIPATH is not set
+CONFIG_BLK_DEV_DM=y
+CONFIG_DM_CRYPT=y
+
+#
 # Fusion MPT device support
 #
 # CONFIG_FUSION is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -273,6 +308,15 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+# CONFIG_ADB is not set
+# CONFIG_ADB_CUDA is not set
+# CONFIG_ADB_PMU is not set
+# CONFIG_MAC_FLOPPY is not set
+# CONFIG_MAC_SERIAL is not set
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -293,23 +337,21 @@
 # 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=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP 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
@@ -330,16 +372,21 @@
 # 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)
@@ -371,10 +418,12 @@
 # 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=y
+# CONFIG_E100_NAPI is not set
 # CONFIG_FEALNX is not set
 # CONFIG_NATSEMI is not set
 # CONFIG_NE2K_PCI is not set
@@ -398,7 +447,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -406,107 +454,41 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PLIP is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_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_PLIP is not set
+# CONFIG_PPP is not set
+# 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
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_ISDN is not set
 
 #
-# Graphics support
+# Telephony Support
 #
-CONFIG_FB=y
-# 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_IMSTT is not set
-# 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_I2C=y
-# CONFIG_FB_MATROX_MAVEN is not set
-CONFIG_FB_MATROX_MULTIHEAD=y
-# 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_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 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
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -549,31 +531,22 @@
 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_PS2_SYNAPTICS is not set
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_INPORT is not set
 # CONFIG_MOUSE_LOGIBM is not set
 # CONFIG_MOUSE_PC110PAD 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_UINPUT=y
 
 #
-# Macintosh device drivers
-#
-# CONFIG_ADB_CUDA is not set
-# CONFIG_ADB_PMU is not set
-# CONFIG_MAC_FLOPPY is not set
-# CONFIG_MAC_SERIAL is not set
-# CONFIG_ADB is not set
-
-#
 # Character devices
 #
 CONFIG_VT=y
@@ -596,11 +569,36 @@
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_PMACZILOG is not set
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=2048
+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_QIC02_TAPE is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+CONFIG_NVRAM=y
+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
@@ -618,14 +616,18 @@
 # 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_HYDRA is not set
 # CONFIG_I2C_I801 is not set
 # CONFIG_I2C_I810 is not set
 # CONFIG_I2C_ISA is not set
 # CONFIG_I2C_KEYWEST is not set
 # CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PIIX4 is not set
 # CONFIG_I2C_PROSAVAGE is not set
 # CONFIG_I2C_SAVAGE4 is not set
@@ -638,56 +640,226 @@
 # CONFIG_I2C_VOODOO3 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_EEPROM is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
 
 #
-# Mice
+# Other I2C Chip support
 #
-# CONFIG_BUSMOUSE is not set
-# CONFIG_QIC02_TAPE is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 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
 
 #
-# IPMI
+# Misc devices
 #
-# CONFIG_IPMI_HANDLER is not set
 
 #
-# Watchdog Cards
+# Multimedia devices
 #
-# CONFIG_WATCHDOG is not set
-CONFIG_NVRAM=y
-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
+# CONFIG_VIDEO_DEV is not set
 
 #
-# Ftape, the floppy tape device driver
+# Digital Video Broadcasting Devices
 #
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
+# CONFIG_DVB is not set
 
 #
-# Multimedia devices
+# Graphics support
 #
-# CONFIG_VIDEO_DEV is not set
+CONFIG_FB=y
+# 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_IMSTT is not set
+# 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_I2C=y
+# CONFIG_FB_MATROX_MAVEN is not set
+CONFIG_FB_MATROX_MULTIHEAD=y
+# 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 is not set
+# CONFIG_FB_3DFX is not set
+# CONFIG_FB_VOODOO1 is not set
+# CONFIG_FB_TRIDENT is not set
+# CONFIG_FB_VIRTUAL is not set
 
 #
-# Digital Video Broadcasting Devices
+# Console display driver support
 #
-# CONFIG_DVB is not set
+# 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
+
+#
+# Logo configuration
+#
+CONFIG_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
+
+#
+# Sound
+#
+CONFIG_SOUND=y
+# CONFIG_DMASOUND_PMAC is not set
+
+#
+# Advanced Linux Sound Architecture
+#
+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
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=m
+CONFIG_SND_PCM_OSS=m
+CONFIG_SND_SEQUENCER_OSS=y
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+
+#
+# Generic devices
+#
+CONFIG_SND_MPU401_UART=m
+CONFIG_SND_OPL3_LIB=m
+CONFIG_SND_DUMMY=m
+# CONFIG_SND_VIRMIDI is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+
+#
+# ISA devices
+#
+# CONFIG_SND_AD1848 is not set
+# CONFIG_SND_CS4231 is not set
+CONFIG_SND_CS4232=m
+# 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_AU8810 is not set
+# CONFIG_SND_AU8820 is not set
+# CONFIG_SND_AU8830 is not set
+# CONFIG_SND_AZT3328 is not set
+# CONFIG_SND_BT87X is not set
+CONFIG_SND_CS46XX=m
+# CONFIG_SND_CS46XX_NEW_DSP is not set
+CONFIG_SND_CS4281=m
+# CONFIG_SND_EMU10K1 is not set
+# CONFIG_SND_KORG1212 is not set
+# CONFIG_SND_MIXART is not set
+# CONFIG_SND_NM256 is not set
+# CONFIG_SND_RME32 is not set
+# CONFIG_SND_RME96 is not set
+# CONFIG_SND_RME9652 is not set
+# CONFIG_SND_HDSP is not set
+# CONFIG_SND_TRIDENT is not set
+# CONFIG_SND_YMFPCI is not set
+# CONFIG_SND_ALS4000 is not set
+# CONFIG_SND_CMIPCI is not set
+# CONFIG_SND_ENS1370 is not set
+# CONFIG_SND_ENS1371 is not set
+# CONFIG_SND_ES1938 is not set
+# CONFIG_SND_ES1968 is not set
+# CONFIG_SND_MAESTRO3 is not set
+# CONFIG_SND_FM801 is not set
+# CONFIG_SND_ICE1712 is not set
+# CONFIG_SND_ICE1724 is not set
+# CONFIG_SND_INTEL8X0 is not set
+# CONFIG_SND_INTEL8X0M is not set
+# CONFIG_SND_SONICVIBES is not set
+# CONFIG_SND_VIA82XX is not set
+# CONFIG_SND_VX222 is not set
+
+#
+# ALSA PowerMac devices
+#
+# CONFIG_SND_POWERMAC is not set
+
+#
+# Open Sound System
+#
+# CONFIG_SOUND_PRIME is not set
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
 
 #
 # File systems
@@ -726,8 +898,8 @@
 #
 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_HUGETLB_PAGE is not set
@@ -739,6 +911,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
@@ -755,18 +928,18 @@
 CONFIG_NFS_FS=y
 # CONFIG_NFS_V3 is not set
 # 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_LOCKD=y
 CONFIG_EXPORTFS=y
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# 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_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
 
 #
@@ -774,11 +947,11 @@
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-CONFIG_NLS=y
 
 #
 # Native Language Support
 #
+CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_NLS_CODEPAGE_437=y
 # CONFIG_NLS_CODEPAGE_737 is not set
@@ -819,111 +992,12 @@
 # CONFIG_NLS_UTF8 is not set
 
 #
-# Sound
-#
-CONFIG_SOUND=y
-# CONFIG_DMASOUND_PMAC is not set
-
-#
-# Advanced Linux Sound Architecture
-#
-CONFIG_SND=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
-CONFIG_SND_OSSEMUL=y
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
-# CONFIG_SND_VERBOSE_PRINTK is not set
-# CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
-CONFIG_SND_DUMMY=m
-# CONFIG_SND_VIRMIDI is not set
-# CONFIG_SND_MTPAV is not set
-# CONFIG_SND_SERIAL_U16550 is not set
-# CONFIG_SND_MPU401 is not set
-
-#
-# ISA devices
-#
-# CONFIG_SND_AD1848 is not set
-# CONFIG_SND_CS4231 is not set
-CONFIG_SND_CS4232=m
-# 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_ALI5451 is not set
-# CONFIG_SND_AZT3328 is not set
-CONFIG_SND_CS46XX=m
-# CONFIG_SND_CS46XX_NEW_DSP is not set
-CONFIG_SND_CS4281=m
-# CONFIG_SND_EMU10K1 is not set
-# CONFIG_SND_KORG1212 is not set
-# CONFIG_SND_NM256 is not set
-# CONFIG_SND_RME32 is not set
-# CONFIG_SND_RME96 is not set
-# CONFIG_SND_RME9652 is not set
-# CONFIG_SND_HDSP is not set
-# CONFIG_SND_TRIDENT is not set
-# CONFIG_SND_YMFPCI is not set
-# CONFIG_SND_ALS4000 is not set
-# CONFIG_SND_CMIPCI is not set
-# CONFIG_SND_ENS1370 is not set
-# CONFIG_SND_ENS1371 is not set
-# CONFIG_SND_ES1938 is not set
-# CONFIG_SND_ES1968 is not set
-# CONFIG_SND_MAESTRO3 is not set
-# CONFIG_SND_FM801 is not set
-# CONFIG_SND_ICE1712 is not set
-# CONFIG_SND_ICE1724 is not set
-# CONFIG_SND_INTEL8X0 is not set
-# CONFIG_SND_SONICVIBES is not set
-# CONFIG_SND_VIA82XX is not set
-# CONFIG_SND_VX222 is not set
-
-#
-# ALSA PowerMac devices
-#
-# CONFIG_SND_POWERMAC is not set
-
-#
-# Open Sound System
-#
-# CONFIG_SOUND_PRIME is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
-
-#
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
 
 #
 # Kernel hacking
@@ -939,4 +1013,23 @@
 #
 # Cryptographic options
 #
-# CONFIG_CRYPTO is not set
+CONFIG_CRYPTO=y
+CONFIG_CRYPTO_HMAC=y
+CONFIG_CRYPTO_NULL=y
+CONFIG_CRYPTO_MD4=m
+CONFIG_CRYPTO_MD5=m
+CONFIG_CRYPTO_SHA1=m
+CONFIG_CRYPTO_SHA256=m
+CONFIG_CRYPTO_SHA512=m
+CONFIG_CRYPTO_DES=m
+CONFIG_CRYPTO_BLOWFISH=m
+CONFIG_CRYPTO_TWOFISH=m
+# CONFIG_CRYPTO_SERPENT is not set
+CONFIG_CRYPTO_AES=m
+CONFIG_CRYPTO_CAST5=m
+CONFIG_CRYPTO_CAST6=m
+CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_DEFLATE=m
+CONFIG_CRYPTO_MICHAEL_MIC=m
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_TEST is not set
diff -Nru a/arch/ppc/configs/redwood5_defconfig b/arch/ppc/configs/redwood5_defconfig
--- a/arch/ppc/configs/redwood5_defconfig	Tue Jun 15 22:20:44 2004
+++ b/arch/ppc/configs/redwood5_defconfig	Tue Jun 15 22:20:44 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -23,6 +24,7 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 # CONFIG_KALLSYMS is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
 # Loadable module support
@@ -59,23 +62,19 @@
 # IBM 4xx options
 #
 # CONFIG_ASH is not set
-# CONFIG_BEECH is not set
-# CONFIG_CEDAR is not set
 # CONFIG_CPCI405 is not set
 # CONFIG_EP405 is not set
 # CONFIG_OAK is not set
-# CONFIG_REDWOOD_4 is not set
 CONFIG_REDWOOD_5=y
 # CONFIG_REDWOOD_6 is not set
 # CONFIG_SYCAMORE is not set
-# CONFIG_TIVO is not set
 # CONFIG_WALNUT is not set
 CONFIG_IBM405_ERR77=y
 CONFIG_IBM405_ERR51=y
 CONFIG_IBM_OCP=y
+CONFIG_PPC_OCP=y
 CONFIG_STB03xxx=y
 CONFIG_IBM_OPENBIOS=y
-# CONFIG_405_DMA is not set
 # CONFIG_PM is not set
 CONFIG_UART0_TTYS0=y
 # CONFIG_UART0_TTYS1 is not set
@@ -92,19 +91,14 @@
 CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
-# CONFIG_CMDLINE_BOOL is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
 # Bus options
 #
 # CONFIG_PCI is not set
 # CONFIG_PCI_DOMAINS is not set
-# CONFIG_HOTPLUG is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
 
 #
 # Advanced setup
@@ -121,6 +115,10 @@
 CONFIG_BOOT_LOAD=0x00400000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 
@@ -130,13 +128,18 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # Block devices
 #
+# CONFIG_BLK_DEV_FD is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
@@ -146,11 +149,6 @@
 # CONFIG_LBD is not set
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
@@ -171,6 +169,7 @@
 #
 # 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
@@ -181,14 +180,28 @@
 # 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
 #
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -211,7 +224,6 @@
 # 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=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -224,7 +236,6 @@
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
@@ -268,6 +279,7 @@
 #
 # Ethernet (10000 Mbit)
 #
+# CONFIG_IBM_EMAC is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
 
@@ -280,6 +292,7 @@
 # Token Ring devices
 #
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -300,16 +313,18 @@
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_ISDN is not set
 
 #
-# Graphics support
+# Telephony Support
 #
-# CONFIG_FB is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -345,10 +360,6 @@
 # CONFIG_INPUT_MISC is not set
 
 #
-# Macintosh device drivers
-#
-
-#
 # Character devices
 #
 # CONFIG_VT is not set
@@ -368,43 +379,8 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_UNIX98_PTYS is not set
-
-#
-# I2C support
-#
-CONFIG_I2C=y
-# CONFIG_I2C_CHARDEV is not set
-
-#
-# I2C Algorithms
-#
-# CONFIG_I2C_ALGOBIT is not set
-# CONFIG_I2C_ALGOPCF is not set
-
-#
-# I2C Hardware Bus support
-#
-# CONFIG_I2C_AMD756 is not set
-# CONFIG_I2C_AMD8111 is not set
-CONFIG_I2C_IBM_IIC=y
-
-#
-# I2C Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-# CONFIG_SENSORS_ADM1021 is not set
-# CONFIG_SENSORS_EEPROM is not set
-# CONFIG_SENSORS_IT87 is not set
-# CONFIG_SENSORS_LM75 is not set
-# CONFIG_SENSORS_LM78 is not set
-# CONFIG_SENSORS_LM85 is not set
-# CONFIG_SENSORS_VIA686A is not set
-# CONFIG_SENSORS_W83781D is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -432,6 +408,15 @@
 # CONFIG_RAW_DRIVER is not set
 
 #
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Misc devices
+#
+
+#
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
@@ -442,6 +427,25 @@
 # CONFIG_DVB is not set
 
 #
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -485,6 +489,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
@@ -501,12 +506,13 @@
 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_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -521,18 +527,13 @@
 CONFIG_MSDOS_PARTITION=y
 
 #
-# Sound
+# Native Language Support
 #
-# CONFIG_SOUND is not set
+# CONFIG_NLS is not set
 
 #
 # IBM 40x options
 #
-
-#
-# USB support
-#
-# CONFIG_USB_GADGET is not set
 
 #
 # Library routines
diff -Nru a/arch/ppc/configs/redwood6_defconfig b/arch/ppc/configs/redwood6_defconfig
--- a/arch/ppc/configs/redwood6_defconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/configs/redwood6_defconfig	Tue Jun 15 22:20:41 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -23,6 +24,7 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 # CONFIG_KALLSYMS is not set
@@ -31,6 +33,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
 # Loadable module support
@@ -58,23 +61,19 @@
 # IBM 4xx options
 #
 # CONFIG_ASH is not set
-# CONFIG_BEECH is not set
-# CONFIG_CEDAR is not set
 # CONFIG_CPCI405 is not set
 # CONFIG_EP405 is not set
 # CONFIG_OAK is not set
-# CONFIG_REDWOOD_4 is not set
 # CONFIG_REDWOOD_5 is not set
 CONFIG_REDWOOD_6=y
 # CONFIG_SYCAMORE is not set
-# CONFIG_TIVO is not set
 # CONFIG_WALNUT is not set
 CONFIG_IBM405_ERR77=y
 CONFIG_IBM405_ERR51=y
 CONFIG_IBM_OCP=y
+CONFIG_PPC_OCP=y
 CONFIG_STB03xxx=y
 CONFIG_IBM_OPENBIOS=y
-# CONFIG_405_DMA is not set
 # CONFIG_PM is not set
 CONFIG_UART0_TTYS0=y
 # CONFIG_UART0_TTYS1 is not set
@@ -91,19 +90,14 @@
 CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
-# CONFIG_CMDLINE_BOOL is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
 # Bus options
 #
 # CONFIG_PCI is not set
 # CONFIG_PCI_DOMAINS is not set
-# CONFIG_HOTPLUG is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
 
 #
 # Advanced setup
@@ -120,6 +114,10 @@
 CONFIG_BOOT_LOAD=0x00400000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 
@@ -129,13 +127,18 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # Block devices
 #
+# CONFIG_BLK_DEV_FD is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
@@ -145,11 +148,6 @@
 # CONFIG_LBD is not set
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 # CONFIG_IDE is not set
@@ -160,14 +158,28 @@
 # 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
 #
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -190,7 +202,6 @@
 # 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=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -203,7 +214,6 @@
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
@@ -247,6 +257,7 @@
 #
 # Ethernet (10000 Mbit)
 #
+# CONFIG_IBM_EMAC is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
 
@@ -259,6 +270,7 @@
 # Token Ring devices
 #
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -279,16 +291,18 @@
 # Bluetooth support
 #
 # CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_ISDN is not set
 
 #
-# Graphics support
+# Telephony Support
 #
-# CONFIG_FB is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -324,10 +338,6 @@
 # CONFIG_INPUT_MISC is not set
 
 #
-# Macintosh device drivers
-#
-
-#
 # Character devices
 #
 # CONFIG_VT is not set
@@ -347,30 +357,8 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# I2C Algorithms
-#
-
-#
-# I2C Hardware Bus support
-#
-
-#
-# I2C Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -397,6 +385,15 @@
 # CONFIG_RAW_DRIVER is not set
 
 #
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Misc devices
+#
+
+#
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
@@ -407,6 +404,25 @@
 # CONFIG_DVB is not set
 
 #
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -440,7 +456,6 @@
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
 # CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
 # CONFIG_HUGETLB_PAGE is not set
@@ -452,6 +467,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
@@ -468,12 +484,13 @@
 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_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -488,18 +505,13 @@
 CONFIG_MSDOS_PARTITION=y
 
 #
-# Sound
+# Native Language Support
 #
-# CONFIG_SOUND is not set
+# CONFIG_NLS is not set
 
 #
 # IBM 40x options
 #
-
-#
-# USB support
-#
-# CONFIG_USB_GADGET is not set
 
 #
 # Library routines
diff -Nru a/arch/ppc/configs/sandpoint_defconfig b/arch/ppc/configs/sandpoint_defconfig
--- a/arch/ppc/configs/sandpoint_defconfig	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc/configs/sandpoint_defconfig	Tue Jun 15 22:20:40 2004
@@ -4,23 +4,39 @@
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=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_STANDALONE=y
+CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
-CONFIG_SWAP=y
+# CONFIG_SWAP is not set
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_HOTPLUG=y
+# CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
+CONFIG_KALLSYMS=y
 CONFIG_FUTEX=y
-# CONFIG_EPOLL is not set
+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
@@ -33,24 +49,25 @@
 CONFIG_KMOD=y
 
 #
-# Platform support
+# Processor
 #
-CONFIG_PPC=y
-CONFIG_PPC32=y
 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_ALTIVEC=y
+# CONFIG_TAU is not set
+# CONFIG_CPU_FREQ is not set
+CONFIG_PPC_STD_MMU=y
 
 #
-# IBM 4xx options
+# Platform options
 #
-# CONFIG_8260 is not set
-CONFIG_GENERIC_ISA_DMA=y
-CONFIG_PPC_STD_MMU=y
 # CONFIG_PPC_MULTIPLATFORM is not set
 # CONFIG_APUS is not set
-# CONFIG_WILLOW_2 is not set
+# CONFIG_WILLOW is not set
 # CONFIG_PCORE is not set
 # CONFIG_POWERPMC250 is not set
 # CONFIG_EV64260 is not set
@@ -66,28 +83,31 @@
 # CONFIG_K2 is not set
 # CONFIG_PAL4 is not set
 # CONFIG_GEMINI is not set
+# CONFIG_EST8260 is not set
+# CONFIG_SBS8260 is not set
+# CONFIG_RPX6 is not set
+# CONFIG_TQM8260 is not set
 CONFIG_PPC_GEN550=y
 CONFIG_EPIC_SERIAL_MODE=y
+CONFIG_MPC10X_BRIDGE=y
 # CONFIG_MPC10X_STORE_GATHERING is not set
 # CONFIG_SMP is not set
 # CONFIG_PREEMPT is not set
-CONFIG_ALTIVEC=y
-# CONFIG_TAU is not set
-# CONFIG_CPU_FREQ is not set
+# CONFIG_HIGHMEM is not set
+CONFIG_KERNEL_ELF=y
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_MISC=m
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
-# General setup
+# Bus options
 #
-# CONFIG_HIGHMEM is not set
+CONFIG_GENERIC_ISA_DMA=y
 CONFIG_PCI=y
 CONFIG_PCI_DOMAINS=y
-CONFIG_KCORE_ELF=y
-CONFIG_KERNEL_ELF=y
-CONFIG_BINFMT_ELF=y
-CONFIG_BINFMT_MISC=m
 # CONFIG_PCI_LEGACY_PROC is not set
 # CONFIG_PCI_NAMES is not set
-CONFIG_HOTPLUG=y
 
 #
 # PCMCIA/CardBus support
@@ -95,13 +115,6 @@
 # CONFIG_PCMCIA is not set
 
 #
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-CONFIG_PPC601_SYNC_FIX=y
-# CONFIG_CMDLINE_BOOL is not set
-
-#
 # Advanced setup
 #
 # CONFIG_ADVANCED_OPTIONS is not set
@@ -116,6 +129,10 @@
 CONFIG_BOOT_LOAD=0x00800000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 # CONFIG_FW_LOADER is not set
@@ -126,9 +143,13 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # Block devices
@@ -139,34 +160,28 @@
 # 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_CARMEL is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
+# CONFIG_LBD is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
-
-#
-# IDE, ATA and ATAPI Block devices
-#
 CONFIG_BLK_DEV_IDE=y
 
 #
 # Please see Documentation/ide.txt for help/info on IDE drives
 #
-# CONFIG_BLK_DEV_HD 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_IDE_TASK_IOCTL is not set
 CONFIG_IDE_TASKFILE_IO=y
@@ -174,7 +189,11 @@
 #
 # IDE chipset support/bugfixes
 #
+CONFIG_IDE_GENERIC=y
 # CONFIG_BLK_DEV_IDEPCI 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
@@ -182,11 +201,16 @@
 # CONFIG_SCSI is not set
 
 #
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
 # Fusion MPT device support
 #
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -196,6 +220,10 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -206,38 +234,37 @@
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 # CONFIG_NETLINK_DEV is not set
-# CONFIG_NETFILTER 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_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_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_IPV6 is not set
-# CONFIG_XFRM_USER 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_BRIDGE 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
@@ -255,17 +282,21 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+CONFIG_DUMMY=m
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-CONFIG_DUMMY=m
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
-# CONFIG_ETHERTAP is not set
 
 #
 # Ethernet (10 or 100Mbit)
@@ -287,6 +318,7 @@
 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
@@ -296,15 +328,20 @@
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_B44 is not set
-# CONFIG_TC35815 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_8139TOO=y
+CONFIG_8139TOO_PIO=y
+# CONFIG_8139TOO_TUNE_TWISTER is not set
+# CONFIG_8139TOO_8129 is not set
+# CONFIG_8139_OLD_RX_RESET is not set
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
@@ -328,6 +365,22 @@
 # 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=m
@@ -339,139 +392,45 @@
 CONFIG_PPP_BSDCOMP=m
 # CONFIG_PPPOE is not set
 # CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Token Ring devices (depends on LLC=y)
-#
 # 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
-#
-# CONFIG_IRDA is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_ISDN is not set
 
 #
-# Graphics support
+# Telephony Support
 #
-CONFIG_FB=y
-# CONFIG_FB_CIRRUS is not set
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_CT65550 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_MATROX=y
-CONFIG_FB_MATROX_MILLENIUM=y
-# CONFIG_FB_MATROX_MYSTIQUE is not set
-# CONFIG_FB_MATROX_G450 is not set
-# CONFIG_FB_MATROX_G100A is not set
-# CONFIG_FB_MATROX_MULTIHEAD 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_3DFX is not set
-# CONFIG_FB_VOODOO1 is not set
-# CONFIG_FB_TRIDENT is not set
-# CONFIG_FB_PM3 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 is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
-
-#
-# Logo configuration
-#
-# CONFIG_LOGO is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
 #
-CONFIG_INPUT=y
+# CONFIG_INPUT is not set
 
 #
 # 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=m
-# 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 is not set
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PCIPS2 is not set
+# CONFIG_SERIO is not set
+# CONFIG_SERIO_I8042 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=y
-# CONFIG_INPUT_PCSPKR is not set
-CONFIG_INPUT_UINPUT=m
-
-#
-# Macintosh device drivers
-#
 
 #
 # Character devices
 #
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
+# CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -479,6 +438,7 @@
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=2
 # CONFIG_SERIAL_8250_EXTENDED is not set
 
 #
@@ -487,26 +447,8 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# I2C Hardware Sensors Mainboard support
-#
-
-#
-# I2C Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -531,135 +473,31 @@
 # CONFIG_FTAPE is not set
 # CONFIG_AGP is not set
 # CONFIG_DRM is not set
-CONFIG_RAW_DRIVER=m
-# CONFIG_HANGCHECK_TIMER is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
-# Multimedia devices
-#
-CONFIG_VIDEO_DEV=m
-
-#
-# Video For Linux
+# I2C support
 #
-CONFIG_VIDEO_PROC_FS=y
+# CONFIG_I2C is not set
 
 #
-# Video Adapters
+# Misc devices
 #
-# CONFIG_VIDEO_PMS is not set
-# CONFIG_VIDEO_CPIA is not set
-# CONFIG_VIDEO_STRADIS is not set
 
 #
-# Radio Adapters
+# Multimedia devices
 #
-# CONFIG_RADIO_GEMTEK_PCI is not set
-# CONFIG_RADIO_MAXIRADIO is not set
-# CONFIG_RADIO_MAESTRO is not set
+# CONFIG_VIDEO_DEV is not set
 
 #
 # Digital Video Broadcasting Devices
 #
 # CONFIG_DVB is not set
-# CONFIG_VIDEO_BTCX 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=y
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS 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_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
-# CONFIG_DEVPTS_FS_XATTR is not set
-CONFIG_TMPFS=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_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_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_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
-
-#
-# Partition Types
+# Graphics support
 #
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_ACORN_PARTITION is not set
-# CONFIG_OSF_PARTITION is not set
-# CONFIG_AMIGA_PARTITION is not set
-# CONFIG_ATARI_PARTITION is not set
-# CONFIG_MAC_PARTITION is not set
-CONFIG_MSDOS_PARTITION=y
-# CONFIG_BSD_DISKLABEL is not set
-# CONFIG_MINIX_SUBPARTITION is not set
-# CONFIG_SOLARIS_X86_PARTITION is not set
-# CONFIG_UNIXWARE_DISKLABEL is not set
-# CONFIG_LDM_PARTITION is not set
-# CONFIG_NEC98_PARTITION is not set
-# CONFIG_SGI_PARTITION is not set
-# CONFIG_ULTRIX_PARTITION is not set
-# CONFIG_SUN_PARTITION is not set
-# CONFIG_EFI_PARTITION is not set
+# CONFIG_FB is not set
 
 #
 # Sound
@@ -692,47 +530,38 @@
 # CONFIG_USB_BLUETOOTH_TTY is not set
 CONFIG_USB_ACM=m
 # CONFIG_USB_PRINTER is not set
+# CONFIG_USB_STORAGE is not set
 
 #
-# SCSI support is needed for USB Storage
+# USB Human Interface Devices (HID)
 #
+# CONFIG_USB_HID is not set
 
 #
-# USB Human Interface Devices (HID)
+# Input core support is needed for USB HID input layer or HIDBP support
+#
+
+#
+# USB HID Boot Protocol drivers
 #
-CONFIG_USB_HID=y
-CONFIG_USB_HIDINPUT=y
-# CONFIG_HID_FF 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_XPAD is not set
 
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
-CONFIG_USB_SCANNER=m
 
 #
 # USB Multimedia devices
 #
 # CONFIG_USB_DABUSB is not set
-# CONFIG_USB_VICAM is not set
-# CONFIG_USB_DSBR is not set
-# CONFIG_USB_IBMCAM is not set
-# CONFIG_USB_KONICAWC is not set
-# CONFIG_USB_OV511 is not set
-# CONFIG_USB_PWC is not set
-CONFIG_USB_SE401=m
-# CONFIG_USB_STV680 is not set
+
+#
+# Video4Linux support is needed for USB Multimedia device support
+#
 
 #
 # USB Network adaptors
 #
-# CONFIG_USB_AX8817X is not set
 # CONFIG_USB_CATC is not set
 # CONFIG_USB_KAWETH is not set
 # CONFIG_USB_PEGASUS is not set
@@ -772,22 +601,123 @@
 #
 # 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_PHIDGETSERVO is not set
 # CONFIG_USB_TEST is not set
+
+#
+# USB Gadget Support
+#
 # CONFIG_USB_GADGET is not set
 
 #
-# Bluetooth support
+# File systems
 #
-# CONFIG_BT is not set
+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
+# 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=y
+# CONFIG_JOLIET is not set
+# CONFIG_ZISOFS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_FAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_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
 
 #
 # Library routines
 #
-# CONFIG_CRC32 is not set
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=m
 CONFIG_ZLIB_DEFLATE=m
 
@@ -795,7 +725,6 @@
 # Kernel hacking
 #
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_KALLSYMS is not set
 # CONFIG_SERIAL_TEXT_DEBUG is not set
 
 #
diff -Nru a/arch/ppc/configs/spruce_defconfig b/arch/ppc/configs/spruce_defconfig
--- a/arch/ppc/configs/spruce_defconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/configs/spruce_defconfig	Tue Jun 15 22:20:37 2004
@@ -21,9 +21,12 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
@@ -32,6 +35,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -102,7 +106,6 @@
 CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_LEGACY_PROC=y
 # CONFIG_PCI_NAMES is not set
-# CONFIG_HOTPLUG is not set
 
 #
 # Advanced setup
@@ -150,8 +153,8 @@
 # CONFIG_BLK_DEV_UMEM 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_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_LBD is not set
 
 #
@@ -174,7 +177,7 @@
 #
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -210,23 +213,21 @@
 # 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_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
@@ -247,23 +248,27 @@
 # 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=y
-CONFIG_CRC32=y
 # CONFIG_OAKNET is not set
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
@@ -304,7 +309,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -312,47 +316,34 @@
 # 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_RCPCI 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
@@ -403,12 +394,8 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -441,6 +428,10 @@
 # CONFIG_I2C is not set
 
 #
+# Misc devices
+#
+
+#
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
@@ -510,8 +501,8 @@
 #
 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_HUGETLB_PAGE is not set
@@ -523,6 +514,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
@@ -545,12 +537,11 @@
 CONFIG_LOCKD=y
 # CONFIG_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# 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_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
 
 #
@@ -567,6 +558,8 @@
 #
 # Library routines
 #
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 
 #
 # Kernel hacking
diff -Nru a/arch/ppc/configs/sycamore_defconfig b/arch/ppc/configs/sycamore_defconfig
--- a/arch/ppc/configs/sycamore_defconfig	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/configs/sycamore_defconfig	Tue Jun 15 22:20:36 2004
@@ -4,11 +4,17 @@
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=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_STANDALONE=y
+CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
@@ -18,9 +24,16 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+# CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
+# CONFIG_KALLSYMS is not set
 CONFIG_FUTEX=y
 # CONFIG_EPOLL is not set
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
 # Loadable module support
@@ -33,66 +46,60 @@
 CONFIG_KMOD=y
 
 #
-# Platform support
+# Processor
 #
-CONFIG_PPC=y
-CONFIG_PPC32=y
 # CONFIG_6xx is not set
 CONFIG_40x=y
+# CONFIG_44x is not set
 # CONFIG_POWER3 is not set
+# CONFIG_POWER4 is not set
 # CONFIG_8xx is not set
+# CONFIG_MATH_EMULATION is not set
+# CONFIG_CPU_FREQ is not set
 CONFIG_4xx=y
 
 #
 # IBM 4xx options
 #
 # CONFIG_ASH is not set
-# CONFIG_BEECH is not set
-# CONFIG_CEDAR is not set
 # CONFIG_CPCI405 is not set
 # CONFIG_EP405 is not set
+# CONFIG_EVB405EP is not set
 # CONFIG_OAK is not set
-# CONFIG_REDWOOD_4 is not set
 # CONFIG_REDWOOD_5 is not set
 # CONFIG_REDWOOD_6 is not set
 CONFIG_SYCAMORE=y
-# CONFIG_TIVO is not set
 # CONFIG_WALNUT is not set
-CONFIG_IBM405_ERR77=y
-CONFIG_IBM405_ERR51=y
 CONFIG_IBM_OCP=y
+CONFIG_PPC_OCP=y
 CONFIG_BIOS_FIXUP=y
+CONFIG_405GPR=y
 CONFIG_IBM_OPENBIOS=y
-# CONFIG_405_DMA is not set
-CONFIG_PM=y
+# CONFIG_PM is not set
 CONFIG_UART0_TTYS0=y
 # CONFIG_UART0_TTYS1 is not set
 CONFIG_NOT_COHERENT_CACHE=y
-# CONFIG_SMP is not set
-# CONFIG_PREEMPT is not set
-# CONFIG_MATH_EMULATION is not set
-# CONFIG_CPU_FREQ is not set
 
 #
-# General setup
+# Platform options
 #
-# CONFIG_HIGHMEM is not set
-CONFIG_PCI=y
-CONFIG_PCI_DOMAINS=y
 # CONFIG_PC_KEYBOARD is not set
-CONFIG_KCORE_ELF=y
-CONFIG_BINFMT_ELF=y
+# 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 is not set
-# CONFIG_PCI_LEGACY_PROC is not set
-# CONFIG_PCI_NAMES is not set
-# CONFIG_HOTPLUG is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
-# Parallel port support
+# Bus options
 #
-# CONFIG_PARPORT is not set
-# CONFIG_CMDLINE_BOOL is not set
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+# CONFIG_PCI_LEGACY_PROC is not set
+# CONFIG_PCI_NAMES is not set
 
 #
 # Advanced setup
@@ -109,14 +116,26 @@
 CONFIG_BOOT_LOAD=0x00400000
 
 #
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+
+#
 # Memory Technology Devices (MTD)
 #
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # Block devices
@@ -127,32 +146,36 @@
 # 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_CARMEL is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+# CONFIG_LBD is not set
 
 #
-# Multi-device support (RAID and LVM)
+# ATA/ATAPI/MFM/RLL support
 #
-# CONFIG_MD is not set
+# CONFIG_IDE is not set
 
 #
-# ATA/IDE/MFM/RLL support
+# SCSI device support
 #
-# CONFIG_IDE is not set
+# CONFIG_SCSI is not set
 
 #
-# SCSI support
+# Multi-device support (RAID and LVM)
 #
-# CONFIG_SCSI is not set
+# CONFIG_MD is not set
 
 #
 # Fusion MPT device support
 #
+# CONFIG_FUSION is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -162,6 +185,10 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -171,7 +198,6 @@
 #
 # CONFIG_PACKET is not set
 # CONFIG_NETLINK_DEV is not set
-# CONFIG_NETFILTER is not set
 CONFIG_UNIX=y
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
@@ -180,29 +206,29 @@
 CONFIG_IP_PNP=y
 # CONFIG_IP_PNP_DHCP is not set
 CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=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_INET_ECN 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_IPV6 is not set
-# CONFIG_XFRM_USER 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_VLAN_8021Q is not set
-# CONFIG_LLC is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE 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
@@ -230,7 +256,6 @@
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-# CONFIG_ETHERTAP is not set
 
 #
 # Ethernet (10 or 100Mbit)
@@ -259,6 +284,7 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
+# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -266,6 +292,12 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
+CONFIG_IBM_EMAC=y
+# CONFIG_IBM_EMAC_ERRMSG is not set
+CONFIG_IBM_EMAC_RXB=64
+CONFIG_IBM_EMAC_TXB=8
+CONFIG_IBM_EMAC_FGAP=8
+CONFIG_IBM_EMAC_SKBRES=0
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
 # CONFIG_PPP is not set
@@ -277,10 +309,12 @@
 # CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices (depends on LLC=y)
+# Token Ring devices
 #
+# CONFIG_TR is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # Wan interfaces
@@ -298,28 +332,38 @@
 # CONFIG_IRDA is not set
 
 #
-# ISDN subsystem
+# Bluetooth support
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_BT is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
-# Graphics support
+# ISDN subsystem
 #
-# CONFIG_FB is not set
+# CONFIG_ISDN is not set
 
 #
-# Old CD-ROM drivers (not SCSI, not IDE)
+# Telephony Support
 #
-# CONFIG_CD_NO_IDESCSI is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
 #
-# CONFIG_INPUT is not set
+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
@@ -330,18 +374,29 @@
 CONFIG_SERIO_I8042=y
 CONFIG_SERIO_SERPORT=y
 # CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_PCIPS2 is not set
 
 #
 # Input Device Drivers
 #
-
-#
-# Macintosh 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_NONSTANDARD is not set
 
 #
@@ -349,6 +404,7 @@
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=4
 # CONFIG_SERIAL_8250_EXTENDED is not set
 
 #
@@ -357,79 +413,132 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_QIC02_TAPE is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+# CONFIG_NVRAM 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=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
 # CONFIG_I2C_ALGOBIT is not set
 # CONFIG_I2C_ALGOPCF is not set
-CONFIG_I2C_IBM_OCP_ALGO=y
-CONFIG_I2C_IBM_OCP_ADAP=y
-CONFIG_I2C_CHARDEV=y
 
 #
-# I2C Hardware Sensors Mainboard support
+# I2C Hardware Bus support
 #
+# CONFIG_I2C_ALI1535 is not set
 # CONFIG_I2C_ALI15X3 is not set
 # CONFIG_I2C_AMD756 is not set
 # CONFIG_I2C_AMD8111 is not set
 # CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
+# CONFIG_I2C_IBM_IIC is not set
+# CONFIG_I2C_ISA is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 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_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
-# CONFIG_I2C_SENSOR is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
 
 #
-# Mice
+# Other I2C Chip support
 #
-# CONFIG_BUSMOUSE is not set
-# CONFIG_QIC02_TAPE is not set
+# CONFIG_SENSORS_EEPROM 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
 
 #
-# IPMI
+# Misc devices
 #
-# CONFIG_IPMI_HANDLER is not set
 
 #
-# Watchdog Cards
+# Multimedia devices
 #
-# CONFIG_WATCHDOG is not set
-# CONFIG_NVRAM is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-# CONFIG_APPLICOM is not set
+# CONFIG_VIDEO_DEV is not set
 
 #
-# Ftape, the floppy tape device driver
+# Digital Video Broadcasting Devices
 #
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
-# CONFIG_HANGCHECK_TIMER is not set
+# CONFIG_DVB is not set
 
 #
-# Multimedia devices
+# Graphics support
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_FB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Sound
 #
-# CONFIG_DVB is not set
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
 
 #
 # File systems
@@ -463,10 +572,11 @@
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
 # CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
 
 #
@@ -475,6 +585,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
@@ -491,12 +602,13 @@
 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_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -522,35 +634,23 @@
 # CONFIG_EFI_PARTITION is not set
 
 #
-# Sound
+# Native Language Support
 #
-# CONFIG_SOUND is not set
+# CONFIG_NLS is not set
 
 #
 # IBM 40x options
 #
 
 #
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-
-#
 # Library routines
 #
-# CONFIG_CRC32 is not set
+CONFIG_CRC32=y
 
 #
 # Kernel hacking
 #
 # CONFIG_DEBUG_KERNEL is not set
-# CONFIG_KALLSYMS is not set
 # CONFIG_SERIAL_TEXT_DEBUG is not set
 CONFIG_OCP=y
 
diff -Nru a/arch/ppc/configs/walnut_defconfig b/arch/ppc/configs/walnut_defconfig
--- a/arch/ppc/configs/walnut_defconfig	Tue Jun 15 22:20:44 2004
+++ b/arch/ppc/configs/walnut_defconfig	Tue Jun 15 22:20:44 2004
@@ -21,8 +21,10 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
@@ -33,6 +35,7 @@
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -62,6 +65,7 @@
 # IBM 4xx options
 #
 # CONFIG_ASH is not set
+# CONFIG_BUBINGA is not set
 # CONFIG_CPCI405 is not set
 # CONFIG_EP405 is not set
 # CONFIG_OAK is not set
@@ -72,7 +76,6 @@
 CONFIG_IBM405_ERR77=y
 CONFIG_IBM405_ERR51=y
 CONFIG_IBM_OCP=y
-CONFIG_PPC_OCP=y
 CONFIG_BIOS_FIXUP=y
 CONFIG_405GP=y
 CONFIG_IBM_OPENBIOS=y
@@ -91,7 +94,8 @@
 CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
-# CONFIG_CMDLINE_BOOL is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="ip=on"
 
 #
 # Bus options
@@ -172,7 +176,6 @@
 #
 # Fusion MPT device support
 #
-# CONFIG_FUSION is not set
 
 #
 # IEEE 1394 (FireWire) support
@@ -204,9 +207,9 @@
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_DHCP is not set
 CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=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
@@ -216,8 +219,6 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 
 #
@@ -225,7 +226,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -246,16 +249,21 @@
 # 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)
@@ -284,7 +292,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -292,45 +299,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -495,6 +486,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
@@ -535,7 +527,6 @@
 # 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
 
 #
@@ -568,13 +559,14 @@
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 
 #
 # Kernel hacking
 #
 # CONFIG_DEBUG_KERNEL is not set
 # CONFIG_SERIAL_TEXT_DEBUG is not set
-CONFIG_OCP=y
+CONFIG_PPC_OCP=y
 
 #
 # Security options
diff -Nru a/arch/ppc/defconfig b/arch/ppc/defconfig
--- a/arch/ppc/defconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc/defconfig	Tue Jun 15 22:20:43 2004
@@ -6,6 +6,7 @@
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
@@ -20,9 +21,12 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_HOTPLUG=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
@@ -32,6 +36,8 @@
 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
@@ -122,7 +128,6 @@
 CONFIG_PCI_DOMAINS=y
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
-CONFIG_HOTPLUG=y
 
 #
 # PCMCIA/CardBus support
@@ -131,11 +136,6 @@
 CONFIG_PCMCIA_PROBE=y
 
 #
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
 # Advanced setup
 #
 CONFIG_ADVANCED_OPTIONS=y
@@ -149,6 +149,10 @@
 CONFIG_BOOT_LOAD=0x00800000
 
 #
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
 # CONFIG_FW_LOADER is not set
@@ -159,6 +163,11 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
 # Plug and Play support
 #
 # CONFIG_PNP is not set
@@ -175,17 +184,13 @@
 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_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_LBD=y
 
 #
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
 # ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
@@ -207,6 +212,7 @@
 #
 # IDE chipset support/bugfixes
 #
+CONFIG_IDE_GENERIC=y
 CONFIG_BLK_DEV_IDEPCI=y
 CONFIG_IDEPCI_SHARE_IRQ=y
 # CONFIG_BLK_DEV_OFFBOARD is not set
@@ -214,7 +220,6 @@
 # CONFIG_BLK_DEV_OPTI621 is not set
 CONFIG_BLK_DEV_SL82C105=y
 CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDE_TCQ is not set
 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
 CONFIG_IDEDMA_PCI_AUTO=y
 # CONFIG_IDEDMA_ONLYDISK is not set
@@ -275,6 +280,12 @@
 # CONFIG_SCSI_LOGGING is not set
 
 #
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+
+#
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
@@ -286,7 +297,6 @@
 CONFIG_SCSI_AIC7XXX=m
 CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
 CONFIG_AIC7XXX_RESET_DELAY_MS=15000
-# CONFIG_AIC7XXX_PROBE_EISA_VL is not set
 # CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
 CONFIG_AIC7XXX_DEBUG_ENABLE=y
 CONFIG_AIC7XXX_DEBUG_MASK=0
@@ -296,6 +306,7 @@
 CONFIG_SCSI_ADVANSYS=m
 # CONFIG_SCSI_IN2000 is not set
 # CONFIG_SCSI_MEGARAID 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
@@ -314,14 +325,23 @@
 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_PAS16 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
+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_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
@@ -332,12 +352,22 @@
 CONFIG_SCSI_MAC53C94=y
 
 #
+# 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
+
+#
 # Fusion MPT device support
 #
 # CONFIG_FUSION is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
@@ -347,6 +377,24 @@
 # CONFIG_I2O is not set
 
 #
+# Macintosh device drivers
+#
+CONFIG_ADB=y
+CONFIG_ADB_CUDA=y
+CONFIG_ADB_PMU=y
+CONFIG_PMAC_PBOOK=y
+CONFIG_PMAC_APM_EMU=y
+CONFIG_PMAC_BACKLIGHT=y
+# CONFIG_MAC_FLOPPY is not set
+CONFIG_MAC_SERIAL=m
+CONFIG_ADB_MACIO=y
+CONFIG_INPUT_ADBHID=y
+CONFIG_MAC_EMUMOUSEBTN=y
+CONFIG_THERM_WINDTUNNEL=m
+CONFIG_THERM_ADT746X=m
+# CONFIG_ANSLCD is not set
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -367,7 +415,6 @@
 # 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=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
@@ -378,8 +425,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -434,14 +479,17 @@
 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)
 #
-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
@@ -462,16 +510,21 @@
 # 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)
@@ -504,6 +557,7 @@
 # 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
@@ -530,7 +584,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_TIGON3 is not set
 
@@ -538,17 +591,12 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=y
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=y
-# CONFIG_PPP_SYNC_TTY is not set
-CONFIG_PPP_DEFLATE=y
-# CONFIG_PPP_BSDCOMP is not set
-# CONFIG_PPPOE is not set
-# CONFIG_SLIP is not set
+# CONFIG_S2IO is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
 
 #
 # Wireless LAN (non-hamradio)
@@ -571,99 +619,43 @@
 # CONFIG_PLX_HERMES is not set
 # CONFIG_TMD_HERMES is not set
 # CONFIG_PCI_HERMES is not set
-CONFIG_NET_WIRELESS=y
+# CONFIG_ATMEL is not set
 
 #
-# Token Ring devices
+# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
 #
-# CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
+# CONFIG_PRISM54 is not set
+CONFIG_NET_WIRELESS=y
 
 #
 # Wan interfaces
 #
 # CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PPP=y
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=y
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=y
+# CONFIG_PPP_BSDCOMP is not set
+# CONFIG_PPPOE is not set
+# 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
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# CONFIG_FB_CYBER2000 is not set
-CONFIG_FB_OF=y
-CONFIG_FB_CONTROL=y
-CONFIG_FB_PLATINUM=y
-CONFIG_FB_VALKYRIE=y
-CONFIG_FB_CT65550=y
-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_MULTIHEAD is not set
-CONFIG_FB_RADEON=y
-CONFIG_FB_ATY128=y
-CONFIG_FB_ATY=y
-CONFIG_FB_ATY_CT=y
-CONFIG_FB_ATY_GX=y
-# CONFIG_FB_ATY_XL_INIT is not set
-# CONFIG_FB_SIS is not set
-# CONFIG_FB_NEOMAGIC is not set
-CONFIG_FB_3DFX=y
-# 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=y
-# 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
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
-CONFIG_LOGO_LINUX_CLUT224=y
+# CONFIG_ISDN is not set
 
 #
-# Old CD-ROM drivers (not SCSI, not IDE)
+# Telephony Support
 #
-# CONFIG_CD_NO_IDESCSI is not set
+# CONFIG_PHONE is not set
 
 #
 # Input device support
@@ -699,36 +691,21 @@
 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_PS2_SYNAPTICS is not set
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_INPORT is not set
 # CONFIG_MOUSE_LOGIBM is not set
 # CONFIG_MOUSE_PC110PAD 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
 
 #
-# Macintosh device drivers
-#
-CONFIG_ADB_CUDA=y
-CONFIG_ADB_PMU=y
-CONFIG_PMAC_PBOOK=y
-CONFIG_PMAC_APM_EMU=y
-CONFIG_PMAC_BACKLIGHT=y
-# CONFIG_MAC_FLOPPY is not set
-CONFIG_MAC_SERIAL=m
-CONFIG_ADB=y
-CONFIG_ADB_MACIO=y
-CONFIG_INPUT_ADBHID=y
-CONFIG_MAC_EMUMOUSEBTN=y
-# CONFIG_ANSLCD is not set
-
-#
 # Character devices
 #
 CONFIG_VT=y
@@ -751,79 +728,108 @@
 CONFIG_SERIAL_PMACZILOG=y
 # CONFIG_SERIAL_PMACZILOG_CONSOLE is not set
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_QIC02_TAPE is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+CONFIG_NVRAM=y
+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_FTAPE is not set
+# CONFIG_AGP is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
 # I2C support
 #
-CONFIG_I2C=m
+CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=m
 
 #
 # I2C Algorithms
 #
-# CONFIG_I2C_ALGOBIT is not set
+CONFIG_I2C_ALGOBIT=y
 # CONFIG_I2C_ALGOPCF 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_ELEKTOR is not set
+CONFIG_I2C_HYDRA=y
 # CONFIG_I2C_I801 is not set
+# CONFIG_I2C_I810 is not set
 # CONFIG_I2C_ISA is not set
 CONFIG_I2C_KEYWEST=m
 # CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_PROSAVAGE is not set
+# CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_SCx200_ACB is not set
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
+# CONFIG_I2C_VOODOO3 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_EEPROM is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
 
 #
-# Mice
+# Other I2C Chip support
 #
-CONFIG_BUSMOUSE=y
-# CONFIG_QIC02_TAPE is not set
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 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
 
 #
-# Watchdog Cards
+# Misc devices
 #
-# CONFIG_WATCHDOG is not set
-CONFIG_NVRAM=y
-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_FTAPE is not set
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
 
 #
 # Multimedia devices
@@ -836,152 +842,65 @@
 # 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
-# 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=y
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_DEVFS_FS=y
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-CONFIG_DEVPTS_FS=y
-# CONFIG_DEVPTS_FS_XATTR is not set
-CONFIG_TMPFS=y
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-CONFIG_HFS_FS=m
-# 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
+# Graphics support
 #
-CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
-# CONFIG_NFS_V4 is not set
-CONFIG_NFSD=y
-CONFIG_NFSD_V3=y
-# CONFIG_NFSD_V4 is not set
-# CONFIG_NFSD_TCP is not set
-CONFIG_LOCKD=y
-CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=y
-CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS 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
+CONFIG_FB=y
+# CONFIG_FB_PM2 is not set
+# CONFIG_FB_CYBER2000 is not set
+CONFIG_FB_OF=y
+CONFIG_FB_CONTROL=y
+CONFIG_FB_PLATINUM=y
+CONFIG_FB_VALKYRIE=y
+CONFIG_FB_CT65550=y
+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_I2C=y
+# CONFIG_FB_MATROX_MAVEN is not set
+# CONFIG_FB_MATROX_MULTIHEAD is not set
+# CONFIG_FB_RADEON_OLD is not set
+CONFIG_FB_RADEON=y
+CONFIG_FB_RADEON_I2C=y
+# CONFIG_FB_RADEON_DEBUG is not set
+CONFIG_FB_ATY128=y
+CONFIG_FB_ATY=y
+CONFIG_FB_ATY_CT=y
+CONFIG_FB_ATY_GX=y
+# CONFIG_FB_ATY_XL_INIT 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_VOODOO1 is not set
+# CONFIG_FB_TRIDENT is not set
+# CONFIG_FB_VIRTUAL is not set
 
 #
-# Partition Types
+# Console display driver support
 #
-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_NEC98_PARTITION is not set
-# CONFIG_SGI_PARTITION is not set
-# CONFIG_ULTRIX_PARTITION is not set
-# CONFIG_SUN_PARTITION is not set
-# CONFIG_EFI_PARTITION is not set
-CONFIG_NLS=y
+CONFIG_VGA_CONSOLE=y
+# 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
 
 #
-# Native Language Support
+# Logo configuration
 #
-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=m
-# 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_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
 
 #
 # Sound
@@ -994,15 +913,24 @@
 # Advanced Linux Sound Architecture
 #
 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
-# CONFIG_SND_OSSEMUL is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=m
+CONFIG_SND_PCM_OSS=m
+CONFIG_SND_SEQUENCER_OSS=y
 # CONFIG_SND_VERBOSE_PRINTK is not set
 # CONFIG_SND_DEBUG is not set
 
 #
 # Generic devices
 #
+CONFIG_SND_MPU401_UART=m
+CONFIG_SND_OPL3_LIB=m
 # CONFIG_SND_DUMMY is not set
 # CONFIG_SND_VIRMIDI is not set
 # CONFIG_SND_MTPAV is not set
@@ -1039,11 +967,17 @@
 # PCI devices
 #
 # CONFIG_SND_ALI5451 is not set
+# CONFIG_SND_ATIIXP is not set
+# CONFIG_SND_AU8810 is not set
+# CONFIG_SND_AU8820 is not set
+# CONFIG_SND_AU8830 is not set
 # CONFIG_SND_AZT3328 is not set
+# CONFIG_SND_BT87X is not set
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_EMU10K1 is not set
 # CONFIG_SND_KORG1212 is not set
+# CONFIG_SND_MIXART is not set
 # CONFIG_SND_NM256 is not set
 # CONFIG_SND_RME32 is not set
 # CONFIG_SND_RME96 is not set
@@ -1062,6 +996,7 @@
 # CONFIG_SND_ICE1712 is not set
 # CONFIG_SND_ICE1724 is not set
 # CONFIG_SND_INTEL8X0 is not set
+# CONFIG_SND_INTEL8X0M is not set
 # CONFIG_SND_SONICVIBES is not set
 # CONFIG_SND_VIA82XX is not set
 # CONFIG_SND_VX222 is not set
@@ -1131,13 +1066,14 @@
 # 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_XPAD is not set
+# CONFIG_USB_ATI_REMOTE is not set
 
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
-CONFIG_USB_SCANNER=m
 # CONFIG_USB_MICROTEK is not set
 # CONFIG_USB_HPUSBSCSI is not set
 
@@ -1205,17 +1141,176 @@
 #
 # 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_TEST 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 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=y
+# CONFIG_JOLIET is not set
+# CONFIG_ZISOFS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=m
+CONFIG_MSDOS_FS=m
+CONFIG_VFAT_FS=m
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+CONFIG_DEVFS_FS=y
+# CONFIG_DEVFS_MOUNT is not set
+# CONFIG_DEVFS_DEBUG is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+CONFIG_HFS_FS=m
+CONFIG_HFSPLUS_FS=m
+# 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=y
+CONFIG_NFSD_V3=y
+# CONFIG_NFSD_V4 is not set
+# CONFIG_NFSD_TCP is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+CONFIG_MAC_PARTITION=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_NEC98_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION 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=m
+# 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
+
+#
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
 
diff -Nru a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
--- a/arch/ppc/kernel/Makefile	Tue Jun 15 22:20:58 2004
+++ b/arch/ppc/kernel/Makefile	Tue Jun 15 22:20:58 2004
@@ -24,11 +24,12 @@
 obj-$(CONFIG_6xx)		+= l2cr.o cpu_setup_6xx.o
 obj-$(CONFIG_POWER4)		+= cpu_setup_power4.o
 obj-$(CONFIG_MODULES)		+= module.o ppc_ksyms.o
+obj-$(CONFIG_NOT_COHERENT_CACHE)	+= dma-mapping.o
 obj-$(CONFIG_PCI)		+= pci.o
-obj-$(CONFIG_PCI)		+= pci-dma.o
 obj-$(CONFIG_KGDB)		+= ppc-stub.o
 obj-$(CONFIG_SMP)		+= smp.o smp-tbsync.o
 obj-$(CONFIG_TAU)		+= temp.o
+obj-$(CONFIG_ALTIVEC)		+= vecemu.o vector.o
 
 ifdef CONFIG_MATH_EMULATION
 obj-$(CONFIG_8xx)		+= softemu8xx.o
diff -Nru a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c
--- a/arch/ppc/kernel/cputable.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/kernel/cputable.c	Tue Jun 15 22:20:41 2004
@@ -209,7 +209,15 @@
 	32, 32,
 	__setup_cpu_750fx
     },
-
+    {	/* 750GX */
+    	0xffff0000, 0x70020000, "750GX",
+    	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |
+	CPU_FTR_L2CR | CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_CAN_NAP |
+	CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS,
+	COMMON_PPC,
+	32, 32,
+	__setup_cpu_750fx
+    },
     {	/* 740/750 (L2CR bit need fixup for 740) */
     	0xffff0000, 0x00080000, "740/750",
 	CPU_FTR_COMMON |
@@ -342,6 +350,14 @@
 	32, 32,
 	__setup_cpu_603
     },
+    {	/* 8280 is a G2_LE (603e core, plus some) */
+	0x7fff0000, 0x00820000, "8280",
+	CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |
+	CPU_FTR_CAN_NAP | CPU_FTR_HAS_HIGH_BATS,
+	COMMON_PPC,
+	32, 32,
+	__setup_cpu_603
+    },
     {	/* default match, we assume split I/D cache & TB (non-601)... */
     	0x00000000, 0x00000000, "(generic PPC)",
 	CPU_FTR_COMMON |
@@ -537,8 +553,8 @@
         32, 32,
         0, /*__setup_cpu_440 */
     },
-    { /* 440GX Rev. B1 (2.1) */
-        0xf0000fff, 0x50000852, "440GX Rev. B1 (2.1)",
+    { /* 440GX Rev. C */
+        0xf0000fff, 0x50000892, "440GX Rev. C",
         CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB,
         PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
         32, 32,
diff -Nru a/arch/ppc/kernel/dma-mapping.c b/arch/ppc/kernel/dma-mapping.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/kernel/dma-mapping.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,439 @@
+/*
+ *  PowerPC version derived from arch/arm/mm/consistent.c
+ *    Copyright (C) 2001 Dan Malek (dmalek@jlc.net)
+ *
+ *  Copyright (C) 2000 Russell King
+ *
+ * Consistent memory allocators.  Used for DMA devices that want to
+ * share uncached memory with the processor core.  The function return
+ * is the virtual address and 'dma_handle' is the physical address.
+ * Mostly stolen from the ARM port, with some changes for PowerPC.
+ *						-- Dan
+ *
+ * Reorganized to get rid of the arch-specific consistent_* functions
+ * and provide non-coherent implementations for the DMA API. -Matt
+ *
+ * Added in_interrupt() safe dma_alloc_coherent()/dma_free_coherent()
+ * implementation. This is pulled straight from ARM and barely
+ * modified. -Matt
+ *
+ * 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/config.h>
+#include <linux/module.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/ptrace.h>
+#include <linux/mman.h>
+#include <linux/mm.h>
+#include <linux/swap.h>
+#include <linux/stddef.h>
+#include <linux/vmalloc.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/bootmem.h>
+#include <linux/highmem.h>
+#include <linux/dma-mapping.h>
+
+#include <asm/pgalloc.h>
+#include <asm/prom.h>
+#include <asm/io.h>
+#include <asm/hardirq.h>
+#include <asm/mmu_context.h>
+#include <asm/pgtable.h>
+#include <asm/mmu.h>
+#include <asm/uaccess.h>
+#include <asm/smp.h>
+#include <asm/machdep.h>
+
+int map_page(unsigned long va, phys_addr_t pa, int flags);
+
+#include <asm/tlbflush.h>
+
+/*
+ * This address range defaults to a value that is safe for all
+ * platforms which currently set CONFIG_NOT_COHERENT_CACHE. It
+ * can be further configured for specific applications under
+ * the "Advanced Setup" menu. -Matt
+ */
+#define CONSISTENT_BASE	(CONFIG_CONSISTENT_START)
+#define CONSISTENT_END	(CONFIG_CONSISTENT_START + CONFIG_CONSISTENT_SIZE)
+#define CONSISTENT_OFFSET(x)	(((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT)
+
+/*
+ * This is the page table (2MB) covering uncached, DMA consistent allocations
+ */
+static pte_t *consistent_pte;
+static spinlock_t consistent_lock = SPIN_LOCK_UNLOCKED;
+
+/*
+ * VM region handling support.
+ *
+ * This should become something generic, handling VM region allocations for
+ * vmalloc and similar (ioremap, module space, etc).
+ *
+ * I envisage vmalloc()'s supporting vm_struct becoming:
+ *
+ *  struct vm_struct {
+ *    struct vm_region	region;
+ *    unsigned long	flags;
+ *    struct page	**pages;
+ *    unsigned int	nr_pages;
+ *    unsigned long	phys_addr;
+ *  };
+ *
+ * get_vm_area() would then call vm_region_alloc with an appropriate
+ * struct vm_region head (eg):
+ *
+ *  struct vm_region vmalloc_head = {
+ *	.vm_list	= LIST_HEAD_INIT(vmalloc_head.vm_list),
+ *	.vm_start	= VMALLOC_START,
+ *	.vm_end		= VMALLOC_END,
+ *  };
+ *
+ * However, vmalloc_head.vm_start is variable (typically, it is dependent on
+ * the amount of RAM found at boot time.)  I would imagine that get_vm_area()
+ * would have to initialise this each time prior to calling vm_region_alloc().
+ */
+struct vm_region {
+	struct list_head	vm_list;
+	unsigned long		vm_start;
+	unsigned long		vm_end;
+};
+
+static struct vm_region consistent_head = {
+	.vm_list	= LIST_HEAD_INIT(consistent_head.vm_list),
+	.vm_start	= CONSISTENT_BASE,
+	.vm_end		= CONSISTENT_END,
+};
+
+static struct vm_region *
+vm_region_alloc(struct vm_region *head, size_t size, int gfp)
+{
+	unsigned long addr = head->vm_start, end = head->vm_end - size;
+	unsigned long flags;
+	struct vm_region *c, *new;
+
+	new = kmalloc(sizeof(struct vm_region), gfp);
+	if (!new)
+		goto out;
+
+	spin_lock_irqsave(&consistent_lock, flags);
+
+	list_for_each_entry(c, &head->vm_list, vm_list) {
+		if ((addr + size) < addr)
+			goto nospc;
+		if ((addr + size) <= c->vm_start)
+			goto found;
+		addr = c->vm_end;
+		if (addr > end)
+			goto nospc;
+	}
+
+ found:
+	/*
+	 * Insert this entry _before_ the one we found.
+	 */
+	list_add_tail(&new->vm_list, &c->vm_list);
+	new->vm_start = addr;
+	new->vm_end = addr + size;
+
+	spin_unlock_irqrestore(&consistent_lock, flags);
+	return new;
+
+ nospc:
+	spin_unlock_irqrestore(&consistent_lock, flags);
+	kfree(new);
+ out:
+	return NULL;
+}
+
+static struct vm_region *vm_region_find(struct vm_region *head, unsigned long addr)
+{
+	struct vm_region *c;
+
+	list_for_each_entry(c, &head->vm_list, vm_list) {
+		if (c->vm_start == addr)
+			goto out;
+	}
+	c = NULL;
+ out:
+	return c;
+}
+
+/*
+ * Allocate DMA-coherent memory space and return both the kernel remapped
+ * virtual and bus address for that space.
+ */
+void *
+__dma_alloc_coherent(size_t size, dma_addr_t *handle, int gfp)
+{
+	struct page *page;
+	struct vm_region *c;
+	unsigned long order;
+	u64 mask = 0x00ffffff, limit; /* ISA default */
+
+	if (!consistent_pte) {
+		printk(KERN_ERR "%s: not initialised\n", __func__);
+		dump_stack();
+		return NULL;
+	}
+
+	size = PAGE_ALIGN(size);
+	limit = (mask + 1) & ~mask;
+	if ((limit && size >= limit) || size >= (CONSISTENT_END - CONSISTENT_BASE)) {
+		printk(KERN_WARNING "coherent allocation too big (requested %#x mask %#Lx)\n",
+		       size, mask);
+		return NULL;
+	}
+
+	order = get_order(size);
+
+	if (mask != 0xffffffff)
+		gfp |= GFP_DMA;
+
+	page = alloc_pages(gfp, order);
+	if (!page)
+		goto no_page;
+
+	/*
+	 * Invalidate any data that might be lurking in the
+	 * kernel direct-mapped region for device DMA.
+	 */
+	{
+		unsigned long kaddr = (unsigned long)page_address(page);
+		memset(page_address(page), 0, size);
+		flush_dcache_range(kaddr, kaddr + size);
+	}
+
+	/*
+	 * Allocate a virtual address in the consistent mapping region.
+	 */
+	c = vm_region_alloc(&consistent_head, size,
+			    gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
+	if (c) {
+		pte_t *pte = consistent_pte + CONSISTENT_OFFSET(c->vm_start);
+		struct page *end = page + (1 << order);
+
+		/*
+		 * Set the "dma handle"
+		 */
+		*handle = page_to_bus(page);
+
+		do {
+			BUG_ON(!pte_none(*pte));
+
+			set_page_count(page, 1);
+			SetPageReserved(page);
+			set_pte(pte, mk_pte(page, pgprot_noncached(PAGE_KERNEL)));
+			page++;
+			pte++;
+		} while (size -= PAGE_SIZE);
+
+		/*
+		 * Free the otherwise unused pages.
+		 */
+		while (page < end) {
+			set_page_count(page, 1);
+			__free_page(page);
+			page++;
+		}
+
+		return (void *)c->vm_start;
+	}
+
+	if (page)
+		__free_pages(page, order);
+ no_page:
+	return NULL;
+}
+
+/*
+ * free a page as defined by the above mapping.
+ */
+void __dma_free_coherent(size_t size, void *vaddr)
+{
+	struct vm_region *c;
+	unsigned long flags;
+	pte_t *ptep;
+
+	size = PAGE_ALIGN(size);
+
+	spin_lock_irqsave(&consistent_lock, flags);
+
+	c = vm_region_find(&consistent_head, (unsigned long)vaddr);
+	if (!c)
+		goto no_area;
+
+	if ((c->vm_end - c->vm_start) != size) {
+		printk(KERN_ERR "%s: freeing wrong coherent size (%ld != %d)\n",
+		       __func__, c->vm_end - c->vm_start, size);
+		dump_stack();
+		size = c->vm_end - c->vm_start;
+	}
+
+	ptep = consistent_pte + CONSISTENT_OFFSET(c->vm_start);
+	do {
+		pte_t pte = ptep_get_and_clear(ptep);
+		unsigned long pfn;
+
+		ptep++;
+
+		if (!pte_none(pte) && pte_present(pte)) {
+			pfn = pte_pfn(pte);
+
+			if (pfn_valid(pfn)) {
+				struct page *page = pfn_to_page(pfn);
+				ClearPageReserved(page);
+
+				__free_page(page);
+				continue;
+			}
+		}
+
+		printk(KERN_CRIT "%s: bad page in kernel page table\n",
+		       __func__);
+	} while (size -= PAGE_SIZE);
+
+	flush_tlb_kernel_range(c->vm_start, c->vm_end);
+
+	list_del(&c->vm_list);
+
+	spin_unlock_irqrestore(&consistent_lock, flags);
+
+	kfree(c);
+	return;
+
+ no_area:
+	spin_unlock_irqrestore(&consistent_lock, flags);
+	printk(KERN_ERR "%s: trying to free invalid coherent area: %p\n",
+	       __func__, vaddr);
+	dump_stack();
+}
+EXPORT_SYMBOL(dma_free_coherent);
+
+/*
+ * Initialise the consistent memory allocation.
+ */
+static int __init dma_alloc_init(void)
+{
+	pgd_t *pgd;
+	pmd_t *pmd;
+	pte_t *pte;
+	int ret = 0;
+
+	spin_lock(&init_mm.page_table_lock);
+
+	do {
+		pgd = pgd_offset(&init_mm, CONSISTENT_BASE);
+		pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE);
+		if (!pmd) {
+			printk(KERN_ERR "%s: no pmd tables\n", __func__);
+			ret = -ENOMEM;
+			break;
+		}
+		WARN_ON(!pmd_none(*pmd));
+
+		pte = pte_alloc_kernel(&init_mm, pmd, CONSISTENT_BASE);
+		if (!pte) {
+			printk(KERN_ERR "%s: no pte tables\n", __func__);
+			ret = -ENOMEM;
+			break;
+		}
+
+		consistent_pte = pte;
+	} while (0);
+
+	spin_unlock(&init_mm.page_table_lock);
+
+	return ret;
+}
+
+core_initcall(dma_alloc_init);
+
+/*
+ * make an area consistent.
+ */
+void __dma_sync(void *vaddr, size_t size, int direction)
+{
+	unsigned long start = (unsigned long)vaddr;
+	unsigned long end   = start + size;
+
+	switch (direction) {
+	case DMA_NONE:
+		BUG();
+	case DMA_FROM_DEVICE:	/* invalidate only */
+		invalidate_dcache_range(start, end);
+		break;
+	case DMA_TO_DEVICE:		/* writeback only */
+		clean_dcache_range(start, end);
+		break;
+	case DMA_BIDIRECTIONAL:	/* writeback and invalidate */
+		flush_dcache_range(start, end);
+		break;
+	}
+}
+
+#ifdef CONFIG_HIGHMEM
+/*
+ * __dma_sync_page() implementation for systems using highmem.
+ * In this case, each page of a buffer must be kmapped/kunmapped
+ * in order to have a virtual address for __dma_sync(). This must
+ * not sleep so kmap_atmomic()/kunmap_atomic() are used.
+ *
+ * Note: yes, it is possible and correct to have a buffer extend
+ * beyond the first page.
+ */
+static inline void __dma_sync_page_highmem(struct page *page,
+		unsigned long offset, size_t size, int direction)
+{
+	size_t seg_size = min((size_t)PAGE_SIZE, size) - offset;
+	size_t cur_size = seg_size;
+	unsigned long flags, start, seg_offset = offset;
+	int nr_segs = PAGE_ALIGN(size + (PAGE_SIZE - offset))/PAGE_SIZE;
+	int seg_nr = 0;
+
+	local_irq_save(flags);
+
+	do {
+		start = (unsigned long)kmap_atomic(page + seg_nr,
+				KM_PPC_SYNC_PAGE) + seg_offset;
+
+		/* Sync this buffer segment */
+		__dma_sync((void *)start, seg_size, direction);
+		kunmap_atomic((void *)start, KM_PPC_SYNC_PAGE);
+		seg_nr++;
+
+		/* Calculate next buffer segment size */
+		seg_size = min((size_t)PAGE_SIZE, size - cur_size);
+
+		/* Add the segment size to our running total */
+		cur_size += seg_size;
+		seg_offset = 0;
+	} while (seg_nr < nr_segs);
+
+	local_irq_restore(flags);
+}
+#endif /* CONFIG_HIGHMEM */
+
+/*
+ * __dma_sync_page makes memory consistent. identical to __dma_sync, but
+ * takes a struct page instead of a virtual address
+ */
+void __dma_sync_page(struct page *page, unsigned long offset,
+	size_t size, int direction)
+{
+#ifdef CONFIG_HIGHMEM
+	__dma_sync_page_highmem(page, offset, size, direction);
+#else
+	unsigned long start = (unsigned long)page_address(page) + offset;
+	__dma_sync((void *)start, size, direction);
+#endif
+}
diff -Nru a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
--- a/arch/ppc/kernel/entry.S	Tue Jun 15 22:20:58 2004
+++ b/arch/ppc/kernel/entry.S	Tue Jun 15 22:20:58 2004
@@ -44,13 +44,41 @@
 #define LOAD_MSR_KERNEL(r, x)	li r,(x)
 #endif
 
-#ifdef CONFIG_4xx
+#ifdef CONFIG_BOOKE
+#define	COR	r8
+#define BOOKE_LOAD_COR	lis COR,crit_save@ha
+#define BOOKE_REST_COR	mfspr COR,SPRG2
+#define BOOKE_SAVE_COR	mtspr SPRG2,COR
+#else
+#define COR	0
+#define BOOKE_LOAD_COR
+#define BOOKE_REST_COR
+#define BOOKE_SAVE_COR
+#endif
+
+#ifdef CONFIG_BOOKE
+	.globl	mcheck_transfer_to_handler
+mcheck_transfer_to_handler:
+	mtspr	SPRG6W,r8
+	lis	r8,mcheck_save@ha
+	lwz	r0,mcheck_r10@l(r8)
+	stw	r0,GPR10(r11)
+	lwz	r0,mcheck_r11@l(r8)
+	stw	r0,GPR11(r11)
+	mfspr	r8,SPRG6R
+	b	transfer_to_handler_full
+#endif
+
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
 	.globl	crit_transfer_to_handler
 crit_transfer_to_handler:
-	lwz	r0,crit_r10@l(0)
+	BOOKE_SAVE_COR
+	BOOKE_LOAD_COR
+	lwz	r0,crit_r10@l(COR)
 	stw	r0,GPR10(r11)
-	lwz	r0,crit_r11@l(0)
+	lwz	r0,crit_r11@l(COR)
 	stw	r0,GPR11(r11)
+	BOOKE_REST_COR
 	/* fall through */
 #endif
 
@@ -82,7 +110,7 @@
 	beq	2f			/* if from user, fix up THREAD.regs */
 	addi	r11,r1,STACK_FRAME_OVERHEAD
 	stw	r11,PT_REGS(r12)
-#ifdef CONFIG_4xx
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
 	lwz	r12,PTRACE-THREAD(r12)
 	andi.	r12,r12,PT_PTRACED
 	beq+	3f
@@ -424,6 +452,29 @@
 	b	sys_swapcontext
 
 /*
+ * Top-level page fault handling.
+ * This is in assembler because if do_page_fault tells us that
+ * it is a bad kernel page fault, we want to save the non-volatile
+ * registers before calling bad_page_fault.
+ */
+	.globl	handle_page_fault
+handle_page_fault:
+	stw	r4,_DAR(r1)
+	addi	r3,r1,STACK_FRAME_OVERHEAD
+	bl	do_page_fault
+	cmpwi	r3,0
+	beq+	ret_from_except
+	SAVE_NVGPRS(r1)
+	lwz	r0,TRAP(r1)
+	clrrwi	r0,r0,1
+	stw	r0,TRAP(r1)
+	mr	r5,r3
+	addi	r3,r1,STACK_FRAME_OVERHEAD
+	lwz	r4,_DAR(r1)
+	bl	bad_page_fault
+	b	ret_from_except_full
+
+/*
  * This routine switches between two different tasks.  The process
  * state of one is saved on its kernel stack.  Then the state
  * of the other is restored from its kernel stack.  The memory
@@ -695,12 +746,14 @@
 	mtlr	r11
 	lwz	r10,_CCR(r1)
 	mtcrf	0xff,r10
+#ifdef CONFIG_40x
 	/* avoid any possible TLB misses here by turning off MSR.DR, we
 	 * assume the instructions here are mapped by a pinned TLB entry */
 	li	r10,MSR_IR
 	mtmsr	r10
 	isync
 	tophys(r1, r1)
+#endif
 	lwz	r9,_DEAR(r1)
 	lwz	r10,_ESR(r1)
 	mtspr	SPRN_DEAR,r9
@@ -711,30 +764,103 @@
 	mtspr	CSRR1,r12
 	lwz	r9,GPR9(r1)
 	lwz	r12,GPR12(r1)
-	lwz	r10,crit_sprg0@l(0)
+	BOOKE_SAVE_COR
+	BOOKE_LOAD_COR
+	lwz	r10,crit_sprg0@l(COR)
 	mtspr	SPRN_SPRG0,r10
-	lwz	r10,crit_sprg1@l(0)
+	lwz	r10,crit_sprg1@l(COR)
 	mtspr	SPRN_SPRG1,r10
-	lwz	r10,crit_sprg4@l(0)
+	lwz	r10,crit_sprg4@l(COR)
 	mtspr	SPRN_SPRG4,r10
-	lwz	r10,crit_sprg5@l(0)
+	lwz	r10,crit_sprg5@l(COR)
 	mtspr	SPRN_SPRG5,r10
-	lwz	r10,crit_sprg6@l(0)
+#ifdef CONFIG_40x
+	lwz	r10,crit_sprg6@l(COR)
 	mtspr	SPRN_SPRG6,r10
-	lwz	r10,crit_sprg7@l(0)
+#endif
+	lwz	r10,crit_sprg7@l(COR)
 	mtspr	SPRN_SPRG7,r10
-	lwz	r10,crit_srr0@l(0)
+	lwz	r10,crit_srr0@l(COR)
 	mtspr	SRR0,r10
-	lwz	r10,crit_srr1@l(0)
+	lwz	r10,crit_srr1@l(COR)
 	mtspr	SRR1,r10
-	lwz	r10,crit_pid@l(0)
+	lwz	r10,crit_pid@l(COR)
 	mtspr	SPRN_PID,r10
 	lwz	r10,GPR10(r1)
 	lwz	r11,GPR11(r1)
 	lwz	r1,GPR1(r1)
+	BOOKE_REST_COR
 	PPC405_ERR77_SYNC
 	rfci
 	b	.		/* prevent prefetch past rfci */
+
+#ifdef CONFIG_BOOKE
+/*
+ * Return from a machine check interrupt, similar to a critical
+ * interrupt.
+ */
+	.globl	ret_from_mcheck_exc
+ret_from_mcheck_exc:
+	REST_NVGPRS(r1)
+	lwz	r3,_MSR(r1)
+	andi.	r3,r3,MSR_PR
+	LOAD_MSR_KERNEL(r10,MSR_KERNEL)
+	bne	user_exc_return
+
+	lwz	r0,GPR0(r1)
+	lwz	r2,GPR2(r1)
+	REST_4GPRS(3, r1)
+	REST_2GPRS(7, r1)
+
+	lwz	r10,_XER(r1)
+	lwz	r11,_CTR(r1)
+	mtspr	XER,r10
+	mtctr	r11
+
+	stwcx.	r0,0,r1			/* to clear the reservation */
+
+	lwz	r11,_LINK(r1)
+	mtlr	r11
+	lwz	r10,_CCR(r1)
+	mtcrf	0xff,r10
+	lwz	r9,_DEAR(r1)
+	lwz	r10,_ESR(r1)
+	mtspr	SPRN_DEAR,r9
+	mtspr	SPRN_ESR,r10
+	lwz	r11,_NIP(r1)
+	lwz	r12,_MSR(r1)
+	mtspr	MCSRR0,r11
+	mtspr	MCSRR1,r12
+	lwz	r9,GPR9(r1)
+	lwz	r12,GPR12(r1)
+	mtspr	SPRG6W,r8
+	lis	r8,mcheck_save@ha
+	lwz	r10,mcheck_sprg0@l(r8)
+	mtspr	SPRN_SPRG0,r10
+	lwz	r10,mcheck_sprg1@l(r8)
+	mtspr	SPRN_SPRG1,r10
+	lwz	r10,mcheck_sprg4@l(r8)
+	mtspr	SPRN_SPRG4,r10
+	lwz	r10,mcheck_sprg5@l(r8)
+	mtspr	SPRN_SPRG5,r10
+	lwz	r10,mcheck_sprg7@l(r8)
+	mtspr	SPRN_SPRG7,r10
+	lwz	r10,mcheck_srr0@l(r8)
+	mtspr	SRR0,r10
+	lwz	r10,mcheck_srr1@l(r8)
+	mtspr	SRR1,r10
+	lwz	r10,mcheck_csrr0@l(r8)
+	mtspr	CSRR0,r10
+	lwz	r10,mcheck_csrr1@l(r8)
+	mtspr	CSRR1,r10
+	lwz	r10,mcheck_pid@l(r8)
+	mtspr	SPRN_PID,r10
+	lwz	r10,GPR10(r1)
+	lwz	r11,GPR11(r1)
+	lwz	r1,GPR1(r1)
+	mfspr	r8,SPRG6R
+	RFMCI
+#endif /* CONFIG_BOOKE */
 
 /*
  * Load the DBCR0 value for a task that is being ptraced,
diff -Nru a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
--- a/arch/ppc/kernel/head.S	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/kernel/head.S	Tue Jun 15 22:20:41 2004
@@ -412,9 +412,7 @@
 1:	stw	r10,_DSISR(r11)
 	mr	r5,r10
 	mfspr	r4,DAR
-	stw	r4,_DAR(r11)
-	addi	r3,r1,STACK_FRAME_OVERHEAD
-	EXC_XFER_EE_LITE(0x300, do_page_fault)
+	EXC_XFER_EE_LITE(0x300, handle_page_fault)
 
 #ifdef CONFIG_PPC64BRIDGE
 /* SLB fault on data access. */
@@ -436,10 +434,9 @@
 	li	r3,0			/* into the hash table */
 	mr	r4,r12			/* SRR0 is fault address */
 	bl	hash_page
-1:	addi	r3,r1,STACK_FRAME_OVERHEAD
-	mr	r4,r12
+1:	mr	r4,r12
 	mr	r5,r9
-	EXC_XFER_EE_LITE(0x400, do_page_fault)
+	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 #ifdef CONFIG_PPC64BRIDGE
 /* SLB fault on instruction access. */
@@ -491,14 +488,16 @@
 /*
  * The Altivec unavailable trap is at 0x0f20.  Foo.
  * We effectively remap it to 0x3000.
+ * We include an altivec unavailable exception vector even if
+ * not configured for Altivec, so that you can't panic a
+ * non-altivec kernel running on a machine with altivec just
+ * by executing an altivec instruction.
  */
 	. = 0xf00
 	b	Trap_0f
 
 	. = 0xf20
-#ifdef CONFIG_ALTIVEC
 	b	AltiVecUnavailable
-#endif
 
 Trap_0f:
 	EXCEPTION_PROLOG
@@ -705,6 +704,7 @@
 #ifndef CONFIG_ALTIVEC
 #define AltivecAssistException	UnknownException
 #endif
+
 	EXCEPTION(0x1300, Trap_13, InstructionBreakpoint, EXC_XFER_EE)
 	EXCEPTION(0x1400, SMI, SMIException, EXC_XFER_EE)
 	EXCEPTION(0x1500, Trap_15, UnknownException, EXC_XFER_EE)
@@ -746,12 +746,12 @@
 
 	. = 0x3000
 
-#ifdef CONFIG_ALTIVEC
 AltiVecUnavailable:
 	EXCEPTION_PROLOG
+#ifdef CONFIG_ALTIVEC
 	bne	load_up_altivec		/* if from user, just load it up */
-	EXC_XFER_EE_LITE(0xf20, KernelAltiVec)
 #endif /* CONFIG_ALTIVEC */
+	EXC_XFER_EE_LITE(0xf20, AltivecUnavailException)
 
 #ifdef CONFIG_PPC64BRIDGE
 DataAccess:
@@ -1633,7 +1633,7 @@
 	blr
 
 #endif /* CONFIG_POWER4 */
-	
+
 #ifdef CONFIG_8260
 /* Jump into the system reset for the rom.
  * We first disable the MMU, and then jump to the ROM reset address.
diff -Nru a/arch/ppc/kernel/head_44x.S b/arch/ppc/kernel/head_44x.S
--- a/arch/ppc/kernel/head_44x.S	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc/kernel/head_44x.S	Tue Jun 15 22:20:38 2004
@@ -313,7 +313,7 @@
 #define NORMAL_EXCEPTION_PROLOG						     \
 	mtspr	SPRN_SPRG0,r10;		/* save two registers to work with */\
 	mtspr	SPRN_SPRG1,r11;						     \
-	mtspr	SPRN_SPRG2,r1;						     \
+	mtspr	SPRN_SPRG4W,r1;						     \
 	mfcr	r10;			/* save CR in r10 for now	   */\
 	mfspr	r11,SPRN_SRR1;		/* check whether user or kernel    */\
 	andi.	r11,r11,MSR_PR;						     \
@@ -332,7 +332,7 @@
 	stw	r12,GPR11(r11);						     \
 	mflr	r10;							     \
 	stw	r10,_LINK(r11);						     \
-	mfspr	r10,SPRG2;						     \
+	mfspr	r10,SPRG4R;						     \
 	mfspr	r12,SRR0;						     \
 	stw	r10,GPR1(r11);						     \
 	mfspr	r9,SRR1;						     \
@@ -348,30 +348,34 @@
  * can potentially occur at any point during normal exception processing.
  * Thus we cannot use the same SPRG registers as the normal prolog above.
  * Instead we use a couple of words of memory at low physical addresses.
- * This is OK since we don't support SMP on these processors.
+ * This is OK since we don't support SMP on these processors. For Book E
+ * processors, we also have a reserved register (SPRG2) that is only used
+ * in critical exceptions so we can free up a GPR to use as the base for
+ * indirect access to the critical exception save area.  This is necessary
+ * since the MMU is always on and the save area is offset from KERNELBASE.
  */
-/* XXX but we don't have RAM mapped at 0 in space 0  -- paulus. */
 #define CRITICAL_EXCEPTION_PROLOG					     \
-	stw	r10,crit_r10@l(0);	/* save two registers to work with */\
-	stw	r11,crit_r11@l(0);					     \
+	mtspr	SPRG2,r8;		/* SPRG2 only used in criticals */   \
+	lis	r8,crit_save@ha;					     \
+	stw	r10,crit_r10@l(r8);					     \
+	stw	r11,crit_r11@l(r8);					     \
 	mfspr	r10,SPRG0;						     \
-	stw	r10,crit_sprg0@l(0);					     \
+	stw	r10,crit_sprg0@l(r8);					     \
 	mfspr	r10,SPRG1;						     \
-	stw	r10,crit_sprg1@l(0);					     \
+	stw	r10,crit_sprg1@l(r8);					     \
 	mfspr	r10,SPRG4R;						     \
-	stw	r10,crit_sprg4@l(0);					     \
+	stw	r10,crit_sprg4@l(r8);					     \
 	mfspr	r10,SPRG5R;						     \
-	stw	r10,crit_sprg5@l(0);					     \
-	mfspr	r10,SPRG6R;						     \
-	stw	r10,crit_sprg6@l(0);					     \
+	stw	r10,crit_sprg5@l(r8);					     \
 	mfspr	r10,SPRG7R;						     \
-	stw	r10,crit_sprg7@l(0);					     \
+	stw	r10,crit_sprg7@l(r8);					     \
 	mfspr	r10,SPRN_PID;						     \
-	stw	r10,crit_pid@l(0);					     \
+	stw	r10,crit_pid@l(r8);					     \
 	mfspr	r10,SRR0;						     \
-	stw	r10,crit_srr0@l(0);					     \
+	stw	r10,crit_srr0@l(r8);					     \
 	mfspr	r10,SRR1;						     \
-	stw	r10,crit_srr1@l(0);					     \
+	stw	r10,crit_srr1@l(r8);					     \
+	mfspr	r8,SPRG2;		/* SPRG2 only used in criticals */   \
 	mfcr	r10;			/* save CR in r10 for now	   */\
 	mfspr	r11,SPRN_CSRR1;		/* check whether user or kernel    */\
 	andi.	r11,r11,MSR_PR;						     \
@@ -383,7 +387,6 @@
 	lwz	r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
 	addi	r11,r11,THREAD_SIZE;					     \
 1:	subi	r11,r11,INT_FRAME_SIZE;	/* Allocate an exception frame     */\
-	tophys(r11,r11);						     \
 	stw	r10,_CCR(r11);          /* save various registers	   */\
 	stw	r12,GPR12(r11);						     \
 	stw	r9,GPR9(r11);						     \
@@ -404,6 +407,71 @@
 	SAVE_2GPRS(7, r11)
 
 /*
+ * Exception prolog for machine check exceptions.  This is similar to
+ * the critical exception prolog, except that machine check exceptions
+ * have their own save area.  For Book E processors, we also have a
+ * reserved register (SPRG6) that is only used in machine check exceptions
+ * so we can free up a GPR to use as the base for indirect access to the
+ * machine check exception save area.  This is necessary since the MMU
+ * is always on and the save area is offset from KERNELBASE.
+ */
+#define MCHECK_EXCEPTION_PROLOG					     \
+	mtspr	SPRG6W,r8;		/* SPRG6 used in machine checks */   \
+	lis	r8,mcheck_save@ha;					     \
+	stw	r10,mcheck_r10@l(r8);					     \
+	stw	r11,mcheck_r11@l(r8);					     \
+	mfspr	r10,SPRG0;						     \
+	stw	r10,mcheck_sprg0@l(r8);					     \
+	mfspr	r10,SPRG1;						     \
+	stw	r10,mcheck_sprg1@l(r8);					     \
+	mfspr	r10,SPRG4R;						     \
+	stw	r10,mcheck_sprg4@l(r8);					     \
+	mfspr	r10,SPRG5R;						     \
+	stw	r10,mcheck_sprg5@l(r8);					     \
+	mfspr	r10,SPRG7R;						     \
+	stw	r10,mcheck_sprg7@l(r8);					     \
+	mfspr	r10,SPRN_PID;						     \
+	stw	r10,mcheck_pid@l(r8);					     \
+	mfspr	r10,SRR0;						     \
+	stw	r10,mcheck_srr0@l(r8);					     \
+	mfspr	r10,SRR1;						     \
+	stw	r10,mcheck_srr1@l(r8);					     \
+	mfspr	r10,CSRR0;						     \
+	stw	r10,mcheck_csrr0@l(r8);					     \
+	mfspr	r10,CSRR1;						     \
+	stw	r10,mcheck_csrr1@l(r8);					     \
+	mfspr	r8,SPRG6R;		/* SPRG6 used in machine checks */   \
+	mfcr	r10;			/* save CR in r10 for now	   */\
+	mfspr	r11,SPRN_MCSRR1;	/* check whether user or kernel    */\
+	andi.	r11,r11,MSR_PR;						     \
+	lis	r11,mcheck_stack_top@h;					     \
+	ori	r11,r11,mcheck_stack_top@l;				     \
+	beq	1f;							     \
+	/* COMING FROM USER MODE */					     \
+	mfspr	r11,SPRG3;		/* if from user, start at top of   */\
+	lwz	r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
+	addi	r11,r11,THREAD_SIZE;					     \
+1:	subi	r11,r11,INT_FRAME_SIZE;	/* Allocate an exception frame     */\
+	stw	r10,_CCR(r11);          /* save various registers	   */\
+	stw	r12,GPR12(r11);						     \
+	stw	r9,GPR9(r11);						     \
+	mflr	r10;							     \
+	stw	r10,_LINK(r11);						     \
+	mfspr	r12,SPRN_DEAR;		/* save DEAR and ESR in the frame  */\
+	stw	r12,_DEAR(r11);		/* since they may have had stuff   */\
+	mfspr	r9,SPRN_ESR;		/* in them at the point where the  */\
+	stw	r9,_ESR(r11);		/* exception was taken		   */\
+	mfspr	r12,MCSRR0;						     \
+	stw	r1,GPR1(r11);						     \
+	mfspr	r9,MCSRR1;						     \
+	stw	r1,0(r11);						     \
+	tovirt(r1,r11);							     \
+	rlwinm	r9,r9,0,14,12;		/* clear MSR_WE (necessary?)	   */\
+	stw	r0,GPR0(r11);						     \
+	SAVE_4GPRS(3, r11);						     \
+	SAVE_2GPRS(7, r11)
+
+/*
  * Exception vectors.
  */
 #define	START_EXCEPTION(label)						     \
@@ -429,6 +497,18 @@
 			  NOCOPY, transfer_to_handler_full, \
 			  ret_from_except_full)
 
+#define MCHECK_EXCEPTION(n, label, hdlr)			\
+	START_EXCEPTION(label);					\
+	MCHECK_EXCEPTION_PROLOG;				\
+	lis	r4,MCSR_MCS@h;					\
+	mtspr	SPRN_MCSR,r4;					\
+	mfspr	r5,SPRN_ESR;					\
+	stw	r5,_ESR(r11);					\
+	addi	r3,r1,STACK_FRAME_OVERHEAD;			\
+	EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
+			  NOCOPY, mcheck_transfer_to_handler,   \
+			  ret_from_mcheck_exc)
+
 #define EXC_XFER_TEMPLATE(hdlr, trap, msr, copyee, tfer, ret)	\
 	li	r10,trap;					\
 	stw	r10,TRAP(r11);					\
@@ -463,7 +543,11 @@
 	CRITICAL_EXCEPTION(0x0100, CriticalInput, UnknownException)
 
 	/* Machine Check Interrupt */
+#ifdef CONFIG_440A
+	MCHECK_EXCEPTION(0x0200, MachineCheck, MachineCheckException)
+#else
 	CRITICAL_EXCEPTION(0x0200, MachineCheck, MachineCheckException)
+#endif
 
 	/* Data Storage Interrupt */
 	START_EXCEPTION(DataStorage)
@@ -471,7 +555,6 @@
 	mtspr	SPRG1, r11
 	mtspr	SPRG4W, r12
 	mtspr	SPRG5W, r13
-	mtspr	SPRG6W, r14
 	mfcr	r11
 	mtspr	SPRG7W, r11
 
@@ -544,15 +627,14 @@
 	rlwinm	r11,r11,0,20,15		/* Clear U0-U3 */
 
 	/* find the TLB index that caused the fault.  It has to be here. */
-	tlbsx	r14, 0, r10
+	tlbsx	r10, 0, r10
 
-	tlbwe	r11, r14, PPC44x_TLB_ATTRIB	/* Write ATTRIB */
+	tlbwe	r11, r10, PPC44x_TLB_ATTRIB	/* Write ATTRIB */
 
 	/* Done...restore registers and get out of here.
 	*/
 	mfspr	r11, SPRG7R
 	mtcr	r11
-	mfspr	r14, SPRG6R
 	mfspr	r13, SPRG5R
 	mfspr	r12, SPRG4R
 
@@ -567,7 +649,6 @@
 	 */
 	mfspr	r11, SPRG7R
 	mtcr	r11
-	mfspr	r14, SPRG6R
 	mfspr	r13, SPRG5R
 	mfspr	r12, SPRG4R
 
@@ -580,8 +661,7 @@
 	NORMAL_EXCEPTION_PROLOG
 	mr      r4,r12                  /* Pass SRR0 as arg2 */
 	li      r5,0                    /* Pass zero as arg3 */
-	addi    r3,r1,STACK_FRAME_OVERHEAD
-	EXC_XFER_EE_LITE(0x0400, do_page_fault)
+	EXC_XFER_EE_LITE(0x0400, handle_page_fault)
 
 	/* External Input Interrupt */
 	EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
@@ -635,7 +715,6 @@
 	mtspr	SPRG1, r11
 	mtspr	SPRG4W, r12
 	mtspr	SPRG5W, r13
-	mtspr	SPRG6W, r14
 	mfcr	r11
 	mtspr	SPRG7W, r11
 	mfspr	r10, SPRN_DEAR		/* Get faulting address */
@@ -688,7 +767,6 @@
 	 */
 	mfspr	r11, SPRG7R
 	mtcr	r11
-	mfspr	r14, SPRG6R
 	mfspr	r13, SPRG5R
 	mfspr	r12, SPRG4R
 	mfspr	r11, SPRG1
@@ -706,7 +784,6 @@
 	mtspr	SPRG1, r11
 	mtspr	SPRG4W, r12
 	mtspr	SPRG5W, r13
-	mtspr	SPRG6W, r14
 	mfcr	r11
 	mtspr	SPRG7W, r11
 	mfspr	r10, SRR0		/* Get faulting address */
@@ -759,7 +836,6 @@
 	 */
 	mfspr	r11, SPRG7R
 	mtcr	r11
-	mfspr	r14, SPRG6R
 	mfspr	r13, SPRG5R
 	mfspr	r12, SPRG4R
 	mfspr	r11, SPRG1
@@ -780,61 +856,50 @@
  * the MSR_DE bit set.
  */
 	/* Debug Interrupt */
-	CRITICAL_EXCEPTION(0x2000, Debug, DebugException)
-#if 0
 	START_EXCEPTION(Debug)
-	/* This first instruction was already executed by the exception
-	 * handler and must be the first instruction of every exception
-	 * handler.
-	 */
-	mtspr	SPRN_SPRG0,r10		/* Save some working registers... */
-	mtspr	SPRN_SPRG1,r11
-	mtspr	SPRN_SPRG4W,r12
-	mfcr	r10			/* ..and the cr because we change it */
-
-	mfspr   r11,SPRN_CSRR1		/* MSR at the time of fault */
-	andi.   r11,r11,MSR_PR
-	bne+    2f			/* trapped from problem state */
-
-	mfspr   r11,SPRN_CSRR0		/* Faulting instruction address */
-	lis	r12, KERNELBASE@h
-	ori	r12, r12, KERNELBASE@l
-	cmplw   r11,r12
-	blt+    2f			/* addr below exception vectors */
-
-	lis	r12, Debug@h
-	ori	r12, r12, Debug@l
-	cmplw   r11,r12
-	bgt+    2f			/* addr above TLB exception vectors */
-
-	lis     r11,DBSR_IC@h           /* Remove the trap status */
-	mtspr   SPRN_DBSR,r11
-
-	mfspr	r11,SPRN_CSRR1
-	rlwinm	r11,r11,0,23,21		/* clear MSR_DE */
-	mtspr	SPRN_CSRR1, r11		/* restore MSR at rcfi without DE */
-
-	mtcrf   0xff,r10                /* restore registers */
-	mfspr	r12,SPRN_SPRG4R
-	mfspr   r11,SPRN_SPRG1
-	mfspr   r10,SPRN_SPRG0
-
-	sync
-	rfci                            /* return to the exception handler  */
-	b	.			/* prevent prefetch past rfci */
+	CRITICAL_EXCEPTION_PROLOG
 
-2:
-	mtcrf   0xff,r10                /* restore registers */
-	mfspr   r12,SPRN_SPRG4R
-	mfspr   r11,SPRN_SPRG1
-	mfspr   r10,SPRN_SPRG0
+	/*
+	 * If this is a single step or branch-taken exception in an
+	 * exception entry sequence, it was probably meant to apply to
+	 * the code where the exception occurred (since exception entry
+	 * doesn't turn off DE automatically).  We simulate the effect
+	 * of turning off DE on entry to an exception handler by turning
+	 * off DE in the CSRR1 value and clearing the debug status.
+	 */
+	mfspr	r10,SPRN_DBSR		/* check single-step/branch taken */
+	andis.	r10,r10,(DBSR_IC|DBSR_BT)@h
+	beq+	1f
+	andi.	r0,r9,MSR_PR		/* check supervisor */
+	beq	2f			/* branch if we need to fix it up... */
 
-	CRIT_EXCEPTION_PROLOG
+	/* continue normal handling for a critical exception... */
+1:	mfspr	r4,SPRN_DBSR
 	addi	r3,r1,STACK_FRAME_OVERHEAD
-	li	r7,CRIT_EXC;
-        li      r9,MSR_KERNEL
-	FINISH_EXCEPTION(DebugException)
-#endif
+	EXC_XFER_TEMPLATE(DebugException, 0x2002, \
+		(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
+		NOCOPY, crit_transfer_to_handler, ret_from_crit_exc)
+
+	/* here it looks like we got an inappropriate debug exception. */
+2:	rlwinm	r9,r9,0,~MSR_DE		/* clear DE in the CSRR1 value */
+	mtspr	SPRN_DBSR,r10		/* clear the IC/BT debug intr status */
+	/* restore state and get out */
+	lwz	r10,_CCR(r11)
+	lwz	r0,GPR0(r11)
+	lwz	r1,GPR1(r11)
+	mtcrf	0x80,r10
+	mtspr	CSRR0,r12
+	mtspr	CSRR1,r9
+	lwz	r9,GPR9(r11)
+
+	mtspr	SPRG2,r8;		/* SPRG2 only used in criticals */
+	lis	r8,crit_save@ha;
+	lwz	r10,crit_r10@l(r8)
+	lwz	r11,crit_r11@l(r8)
+	mfspr	r8,SPRG2
+
+	rfci
+	b	.
 
 /*
  * Local functions
@@ -848,9 +913,7 @@
 	mfspr	r5,SPRN_ESR		/* Grab the ESR, save it, pass arg3 */
 	stw	r5,_ESR(r11)
 	mfspr	r4,SPRN_DEAR		/* Grab the DEAR, save it, pass arg2 */
-	stw	r4,_DEAR(r11)
-	addi	r3,r1,STACK_FRAME_OVERHEAD
-	EXC_XFER_EE_LITE(0x0300, do_page_fault)
+	EXC_XFER_EE_LITE(0x0300, handle_page_fault)
 
 /*
 
@@ -860,7 +923,6 @@
  * 	r11 - available to use
  *	r12 - Pointer to the 64-bit PTE
  *	r13 - available to use
- *	r14 - available to use
  *	MMUCR - loaded with proper value when we get here
  *	Upon exit, we reload everything and RFI.
  */
@@ -875,51 +937,50 @@
 
 	/* Load the next available TLB index */
 	lis	r13, tlb_44x_index@ha
-	lwz	r14, tlb_44x_index@l(r13)
+	lwz	r13, tlb_44x_index@l(r13)
 	/* Load the TLB high watermark */
-	lis	r13, tlb_44x_hwater@ha
-	lwz	r11, tlb_44x_hwater@l(r13)
+	lis	r11, tlb_44x_hwater@ha
+	lwz	r11, tlb_44x_hwater@l(r11)
 
 	/* Increment, rollover, and store TLB index */
-	addi	r14, r14, 1
-	cmpw	0, r14, r11			/* reserve entries */
+	addi	r13, r13, 1
+	cmpw	0, r13, r11			/* reserve entries */
 	ble	7f
-	li	r14, 0
+	li	r13, 0
 7:
 	/* Store the next available TLB index */
-	lis	r13, tlb_44x_index@ha
-	stw	r14, tlb_44x_index@l(r13)
+	lis	r11, tlb_44x_index@ha
+	stw	r13, tlb_44x_index@l(r11)
 
-	lwz	r13, 0(r12)			/* Get MS word of PTE */
-	lwz	r11, 4(r12)			/* Get LS word of PTE */
-	rlwimi	r13, r11, 0, 0 , 19		/* Insert RPN */
-	tlbwe	r13, r14, PPC44x_TLB_XLAT	/* Write XLAT */
+	lwz	r11, 0(r12)			/* Get MS word of PTE */
+	lwz	r12, 4(r12)			/* Get LS word of PTE */
+	rlwimi	r11, r12, 0, 0 , 19		/* Insert RPN */
+	tlbwe	r11, r13, PPC44x_TLB_XLAT	/* Write XLAT */
 
 	/*
 	 * Create PAGEID. This is the faulting address,
 	 * page size, and valid flag.
 	 */
-	li	r12, PPC44x_TLB_VALID | PPC44x_TLB_4K
-	rlwimi	r10, r12, 0, 20, 31		/* Insert valid and page size */
-	tlbwe	r10, r14, PPC44x_TLB_PAGEID	/* Write PAGEID */
-
-	li	r13, PPC44x_TLB_SR@l		/* Set SR */
-	rlwimi	r13, r11, 0, 30, 30		/* Set SW = _PAGE_RW */
-	rlwimi	r13, r11, 29, 29, 29		/* SX = _PAGE_HWEXEC */
-	rlwimi	r13, r11, 29, 28, 28		/* UR = _PAGE_USER */
-	rlwimi	r12, r11, 31, 26, 26		/* (_PAGE_USER>>1)->r12 */
-	and	r12, r12, r11			/* HWEXEC & USER */
-	rlwimi	r13, r12, 0, 26, 26		/* UX = HWEXEC & USER */
-
-	rlwimi	r11, r13, 0, 26, 31		/* Insert static perms */
-	rlwinm	r11, r11, 0, 20, 15		/* Clear U0-U3 */
-	tlbwe	r11, r14, PPC44x_TLB_ATTRIB	/* Write ATTRIB */
+	li	r11, PPC44x_TLB_VALID | PPC44x_TLB_4K
+	rlwimi	r10, r11, 0, 20, 31		/* Insert valid and page size */
+	tlbwe	r10, r13, PPC44x_TLB_PAGEID	/* Write PAGEID */
+
+	li	r10, PPC44x_TLB_SR@l		/* Set SR */
+	rlwimi	r10, r12, 0, 30, 30		/* Set SW = _PAGE_RW */
+	rlwimi	r10, r12, 29, 29, 29		/* SX = _PAGE_HWEXEC */
+	rlwimi	r10, r12, 29, 28, 28		/* UR = _PAGE_USER */
+	rlwimi	r11, r12, 31, 26, 26		/* (_PAGE_USER>>1)->r12 */
+	and	r11, r12, r11			/* HWEXEC & USER */
+	rlwimi	r10, r11, 0, 26, 26		/* UX = HWEXEC & USER */
+
+	rlwimi	r12, r10, 0, 26, 31		/* Insert static perms */
+	rlwinm	r12, r12, 0, 20, 15		/* Clear U0-U3 */
+	tlbwe	r12, r13, PPC44x_TLB_ATTRIB	/* Write ATTRIB */
 
 	/* Done...restore registers and get out of here.
 	*/
 	mfspr	r11, SPRG7R
 	mtcr	r11
-	mfspr	r14, SPRG6R
 	mfspr	r13, SPRG5R
 	mfspr	r12, SPRG4R
 	mfspr	r11, SPRG1
@@ -985,32 +1046,30 @@
 _GLOBAL(swapper_pg_dir)
 	.space	8192
 
-/* Stack for handling critical exceptions from kernel mode */
 	.section .bss
+/* Stack for handling critical exceptions from kernel mode */
 critical_stack_bottom:
 	.space 4096
 critical_stack_top:
 	.previous
 
-/*
- * This space gets a copy of optional info passed to us by the bootstrap
- * which is used to pass parameters into the kernel like root=/dev/sda1, etc.
- */
-_GLOBAL(cmd_line)
-	.space	512
-
-/*
- * Room for two PTE pointers, usually the kernel and current user pointers
- * to their respective root page table.
- */
-abatron_pteptrs:
-	.space	8
+/* Stack for handling machine check exceptions from kernel mode */
+mcheck_stack_bottom:
+	.space 4096
+mcheck_stack_top:
+	.previous
 
 /*
  * This area is used for temporarily saving registers during the
- * critical exception prolog.
+ * critical and machine check exception prologs. It must always
+ * follow the page aligned allocations, so it starts on a page
+ * boundary, ensuring that all crit_save areas are in a single
+ * page.
  */
-crit_save:
+
+/* crit_save */
+_GLOBAL(crit_save)
+	.space  4
 _GLOBAL(crit_r10)
 	.space	4
 _GLOBAL(crit_r11)
@@ -1023,8 +1082,6 @@
 	.space	4
 _GLOBAL(crit_sprg5)
 	.space	4
-_GLOBAL(crit_sprg6)
-	.space	4
 _GLOBAL(crit_sprg7)
 	.space	4
 _GLOBAL(crit_pid)
@@ -1033,3 +1090,47 @@
 	.space	4
 _GLOBAL(crit_srr1)
 	.space	4
+
+/* mcheck_save */
+_GLOBAL(mcheck_save)
+	.space  4
+_GLOBAL(mcheck_r10)
+	.space	4
+_GLOBAL(mcheck_r11)
+	.space	4
+_GLOBAL(mcheck_sprg0)
+	.space	4
+_GLOBAL(mcheck_sprg1)
+	.space	4
+_GLOBAL(mcheck_sprg4)
+	.space	4
+_GLOBAL(mcheck_sprg5)
+	.space	4
+_GLOBAL(mcheck_sprg7)
+	.space	4
+_GLOBAL(mcheck_pid)
+	.space	4
+_GLOBAL(mcheck_srr0)
+	.space	4
+_GLOBAL(mcheck_srr1)
+	.space	4
+_GLOBAL(mcheck_csrr0)
+	.space	4
+_GLOBAL(mcheck_csrr1)
+	.space	4
+
+/*
+ * This space gets a copy of optional info passed to us by the bootstrap
+ * which is used to pass parameters into the kernel like root=/dev/sda1, etc.
+ */
+_GLOBAL(cmd_line)
+	.space	512
+
+/*
+ * Room for two PTE pointers, usually the kernel and current user pointers
+ * to their respective root page table.
+ */
+abatron_pteptrs:
+	.space	8
+
+
diff -Nru a/arch/ppc/kernel/head_4xx.S b/arch/ppc/kernel/head_4xx.S
--- a/arch/ppc/kernel/head_4xx.S	Tue Jun 15 22:21:04 2004
+++ b/arch/ppc/kernel/head_4xx.S	Tue Jun 15 22:21:04 2004
@@ -432,8 +432,7 @@
 	NORMAL_EXCEPTION_PROLOG
 	mr	r4,r12			/* Pass SRR0 as arg2 */
 	li	r5,0			/* Pass zero as arg3 */
-	addi	r3,r1,STACK_FRAME_OVERHEAD
-	EXC_XFER_EE_LITE(0x400, do_page_fault)
+	EXC_XFER_EE_LITE(0x400, handle_page_fault)
 
 /* 0x0500 - External Interrupt Exception */
 	EXCEPTION(0x0500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
@@ -763,9 +762,7 @@
 	mfspr	r5,SPRN_ESR		/* Grab the ESR, save it, pass arg3 */
 	stw	r5,_ESR(r11)
 	mfspr	r4,SPRN_DEAR		/* Grab the DEAR, save it, pass arg2 */
-	stw	r4,_DEAR(r11)
-	addi	r3,r1,STACK_FRAME_OVERHEAD
-	EXC_XFER_EE_LITE(0x300, do_page_fault)
+	EXC_XFER_EE_LITE(0x300, handle_page_fault)
 
 /* Other PowerPC processors, namely those derived from the 6xx-series
  * have vectors from 0x2100 through 0x2F00 defined, but marked as reserved.
diff -Nru a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c
--- a/arch/ppc/kernel/irq.c	Tue Jun 15 22:20:44 2004
+++ b/arch/ppc/kernel/irq.c	Tue Jun 15 22:20:44 2004
@@ -304,8 +304,10 @@
 
 void disable_irq(unsigned int irq)
 {
+	irq_desc_t *desc = irq_desc + irq;
 	disable_irq_nosync(irq);
-	synchronize_irq(irq);
+	if (desc->action)
+		synchronize_irq(irq);
 }
 
 /**
diff -Nru a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
--- a/arch/ppc/kernel/misc.S	Tue Jun 15 22:21:02 2004
+++ b/arch/ppc/kernel/misc.S	Tue Jun 15 22:21:02 2004
@@ -780,9 +780,18 @@
 _GLOBAL(copy_page)
 	addi	r3,r3,-4
 	addi	r4,r4,-4
+
+#ifdef CONFIG_8xx
+	/* don't use prefetch on 8xx */
+    	li	r0,4096/L1_CACHE_LINE_SIZE
+	mtctr	r0
+1:	COPY_16_BYTES
+	bdnz	1b
+	blr
+
+#else	/* not 8xx, we can prefetch */
 	li	r5,4
 
-#ifndef CONFIG_8xx
 #if MAX_COPY_PREFETCH > 1
 	li	r0,MAX_COPY_PREFETCH
 	li	r11,4
@@ -790,19 +799,17 @@
 11:	dcbt	r11,r4
 	addi	r11,r11,L1_CACHE_LINE_SIZE
 	bdnz	11b
-#else /* MAX_L1_COPY_PREFETCH == 1 */
+#else /* MAX_COPY_PREFETCH == 1 */
 	dcbt	r5,r4
 	li	r11,L1_CACHE_LINE_SIZE+4
-#endif /* MAX_L1_COPY_PREFETCH */
-#endif /* CONFIG_8xx */
-
-	li	r0,4096/L1_CACHE_LINE_SIZE
+#endif /* MAX_COPY_PREFETCH */
+	li	r0,4096/L1_CACHE_LINE_SIZE - MAX_COPY_PREFETCH
+	crclr	4*cr0+eq
+2:
 	mtctr	r0
 1:
-#ifndef CONFIG_8xx
 	dcbt	r11,r4
 	dcbz	r5,r3
-#endif
 	COPY_16_BYTES
 #if L1_CACHE_LINE_SIZE >= 32
 	COPY_16_BYTES
@@ -818,7 +825,12 @@
 #endif
 #endif
 	bdnz	1b
-	blr
+	beqlr
+	crnot	4*cr0+eq,4*cr0+eq
+	li	r0,MAX_COPY_PREFETCH
+	li	r11,4
+	b	2b
+#endif	/* CONFIG_8xx */
 
 /*
  * void atomic_clear_mask(atomic_t mask, atomic_t *addr)
@@ -1385,3 +1397,4 @@
 	.long sys_mq_timedreceive	/* 265 */
 	.long sys_mq_notify
 	.long sys_mq_getsetattr
+	.long sys_ni_syscall		/* 268 reserved for sys_kexec_load */
diff -Nru a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
--- a/arch/ppc/kernel/pci.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc/kernel/pci.c	Tue Jun 15 22:20:40 2004
@@ -128,7 +128,7 @@
 		struct resource *res = dev->resource + i;
 		if (!res->flags)
 			continue;
-		if (!res->start || res->end == 0xffffffff) {
+		if (res->end == 0xffffffff) {
 			DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n",
 			    pci_name(dev), i, res->start, res->end);
 			res->end -= res->start;
@@ -347,6 +347,8 @@
 		return -1;
 	}
 	res = bus->resource[i];
+	if (res == NULL)
+		return -1;
 	pr = NULL;
 	for (j = 0; j < 4; j++) {
 		struct resource *r = parent->resource[j];
@@ -659,11 +661,11 @@
 		return;
 	bus_range = (int *) get_property(node, "bus-range", &len);
 	if (bus_range == NULL || len < 2 * sizeof(int)) {
-		printk(KERN_WARNING "Can't get bus-range for %s\n",
-		       node->full_name);
-		return;
-	}
-	pci_to_OF_bus_map[pci_bus] = bus_range[0];
+		printk(KERN_WARNING "Can't get bus-range for %s, "
+		       "assuming it starts at 0\n", node->full_name);
+		pci_to_OF_bus_map[pci_bus] = 0;
+	} else
+		pci_to_OF_bus_map[pci_bus] = bus_range[0];
 
 	for (node=node->child; node != 0;node = node->sibling) {
 		struct pci_dev* dev;
@@ -1073,6 +1075,8 @@
 	u16 w;
 	struct resource res;
 
+	if (bus->resource[0] == NULL)
+		return;
  	res = *(bus->resource[0]);
 
 	DBG("Remapping Bus %d, bridge: %s\n", bus->number, bridge->slot_name);
@@ -1168,7 +1172,8 @@
 	int has_vga = 0;
 
 	for (parent_io=0; parent_io<4; parent_io++)
-		if (bus->resource[parent_io]->flags & IORESOURCE_IO)
+		if (bus->resource[parent_io]
+		    && bus->resource[parent_io]->flags & IORESOURCE_IO)
 			break;
 	if (parent_io >= 4)
 		return;
diff -Nru a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
--- a/arch/ppc/kernel/ppc_htab.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/kernel/ppc_htab.c	Tue Jun 15 22:20:36 2004
@@ -101,7 +101,7 @@
 {
 	unsigned long mmcr0 = 0, pmc1 = 0, pmc2 = 0;
 	int n = 0;
-#ifdef CONFIG_PPC_STD_MMU
+#if defined(CONFIG_PPC_STD_MMU) && !defined(CONFIG_PPC64BRIDGE)
 	unsigned int kptes = 0, uptes = 0;
 	PTE *ptr;
 #endif /* CONFIG_PPC_STD_MMU */
@@ -135,6 +135,7 @@
 		goto return_string;
 	}
 
+#ifndef CONFIG_PPC64BRIDGE
 	for (ptr = Hash; ptr < Hash_end; ptr++) {
 		unsigned int mctx, vsid;
 
@@ -148,6 +149,7 @@
 		else
 			uptes++;
 	}
+#endif
 
 	n += sprintf( buffer + n,
 		      "PTE Hash Table Information\n"
@@ -155,16 +157,20 @@
 		      "Buckets\t\t: %lu\n"
  		      "Address\t\t: %08lx\n"
 		      "Entries\t\t: %lu\n"
+#ifndef CONFIG_PPC64BRIDGE
 		      "User ptes\t: %u\n"
 		      "Kernel ptes\t: %u\n"
-		      "Percent full\t: %lu%%\n",
-                      (unsigned long)(Hash_size>>10),
+		      "Percent full\t: %lu%%\n"
+#endif
+                      , (unsigned long)(Hash_size>>10),
 		      (Hash_size/(sizeof(PTE)*8)),
 		      (unsigned long)Hash,
-		      Hash_size/sizeof(PTE),
-                      uptes,
+		      Hash_size/sizeof(PTE)
+#ifndef CONFIG_PPC64BRIDGE
+                      , uptes,
 		      kptes,
 		      ((kptes+uptes)*100) / (Hash_size/sizeof(PTE))
+#endif
 		);
 
 	n += sprintf( buffer + n,
diff -Nru a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
--- a/arch/ppc/kernel/ppc_ksyms.c	Tue Jun 15 22:21:01 2004
+++ b/arch/ppc/kernel/ppc_ksyms.c	Tue Jun 15 22:21:01 2004
@@ -72,7 +72,7 @@
 
 extern unsigned long mm_ptov (unsigned long paddr);
 
-EXPORT_SYMBOL(clear_page);
+EXPORT_SYMBOL(clear_pages);
 EXPORT_SYMBOL(clear_user_page);
 EXPORT_SYMBOL(do_signal);
 EXPORT_SYMBOL(do_syscall_trace);
@@ -181,9 +181,6 @@
 #endif /* CONFIG_PCI */
 
 #ifdef CONFIG_NOT_COHERENT_CACHE
-EXPORT_SYMBOL(consistent_alloc);
-EXPORT_SYMBOL(consistent_free);
-EXPORT_SYMBOL(consistent_sync);
 EXPORT_SYMBOL(flush_dcache_all);
 #endif
 
@@ -203,15 +200,6 @@
 EXPORT_SYMBOL(giveup_altivec);
 #endif /* CONFIG_ALTIVEC */
 #ifdef CONFIG_SMP
-#ifdef CONFIG_DEBUG_SPINLOCK
-EXPORT_SYMBOL(_raw_spin_lock);
-EXPORT_SYMBOL(_raw_spin_unlock);
-EXPORT_SYMBOL(_raw_spin_trylock);
-EXPORT_SYMBOL(_raw_read_lock);
-EXPORT_SYMBOL(_raw_read_unlock);
-EXPORT_SYMBOL(_raw_write_lock);
-EXPORT_SYMBOL(_raw_write_unlock);
-#endif
 EXPORT_SYMBOL(smp_call_function);
 EXPORT_SYMBOL(smp_hw_index);
 EXPORT_SYMBOL(synchronize_irq);
@@ -336,7 +324,7 @@
 EXPORT_SYMBOL(cpm_install_handler);
 EXPORT_SYMBOL(cpm_free_handler);
 #endif /* CONFIG_8xx */
-#if defined(CONFIG_8xx) || defined(CONFIG_4xx)
+#if defined(CONFIG_8xx) || defined(CONFIG_40x)
 EXPORT_SYMBOL(__res);
 #endif
 #if defined(CONFIG_8xx)
diff -Nru a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
--- a/arch/ppc/kernel/process.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc/kernel/process.c	Tue Jun 15 22:20:40 2004
@@ -163,7 +163,7 @@
 void
 enable_kernel_altivec(void)
 {
-	WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled());
+	WARN_ON(preemptible());
 
 #ifdef CONFIG_SMP
 	if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
@@ -180,7 +180,7 @@
 void
 enable_kernel_fp(void)
 {
-	WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled());
+	WARN_ON(preemptible());
 
 #ifdef CONFIG_SMP
 	if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
@@ -668,12 +668,6 @@
 }
 #endif
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched    ((unsigned long) scheduling_functions_start_here)
-#define last_sched     ((unsigned long) scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long ip, sp;
@@ -688,7 +682,7 @@
 			return 0;
 		if (count > 0) {
 			ip = *(unsigned long *)(sp + 4);
-			if (ip < first_sched || ip >= last_sched)
+			if (!in_sched_functions(ip))
 				return ip;
 		}
 	} while (count++ < 16);
diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
--- a/arch/ppc/kernel/setup.c	Tue Jun 15 22:21:03 2004
+++ b/arch/ppc/kernel/setup.c	Tue Jun 15 22:21:03 2004
@@ -37,6 +37,7 @@
 #include <asm/sections.h>
 #include <asm/nvram.h>
 #include <asm/xmon.h>
+#include <asm/ocp.h>
 
 #if defined CONFIG_KGDB
 #include <asm/kgdb.h>
@@ -682,6 +683,12 @@
 	/* set up the bootmem stuff with available memory */
 	do_init_bootmem();
 	if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab);
+
+#ifdef CONFIG_PPC_OCP
+	/* Initialize OCP device list */
+	ocp_early_init();
+	if ( ppc_md.progress ) ppc_md.progress("ocp: exit", 0x3eab);
+#endif
 
 	ppc_md.setup_arch();
 	if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
diff -Nru a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
--- a/arch/ppc/kernel/smp.c	Tue Jun 15 22:21:03 2004
+++ b/arch/ppc/kernel/smp.c	Tue Jun 15 22:21:03 2004
@@ -211,6 +211,8 @@
            bitmask. --RR */
 	if (num_online_cpus() <= 1)
 		return 0;
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
 	return __smp_call_function(func, info, wait, MSG_ALL_BUT_SELF);
 }
 
diff -Nru a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
--- a/arch/ppc/kernel/traps.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/kernel/traps.c	Tue Jun 15 22:20:37 2004
@@ -41,9 +41,6 @@
 #include <asm/backlight.h>
 #endif
 
-extern int fix_alignment(struct pt_regs *);
-extern void bad_page_fault(struct pt_regs *, unsigned long, int sig);
-
 #ifdef CONFIG_XMON
 void (*debugger)(struct pt_regs *regs) = xmon;
 int (*debugger_bpt)(struct pt_regs *regs) = xmon_bpt;
@@ -222,14 +219,43 @@
 	if (check_io_access(regs))
 		return;
 
-#ifdef CONFIG_4xx
+#if defined(CONFIG_4xx) && !defined(CONFIG_440A)
 	if (reason & ESR_IMCP) {
 		printk("Instruction");
 		mtspr(SPRN_ESR, reason & ~ESR_IMCP);
 	} else
 		printk("Data");
 	printk(" machine check in kernel mode.\n");
+#elif defined(CONFIG_440A)
+	printk("Machine check in kernel mode.\n");
+	if (reason & ESR_IMCP){
+		printk("Instruction Synchronous Machine Check exception\n");
+		mtspr(SPRN_ESR, reason & ~ESR_IMCP);
+	}
+	else {
+		u32 mcsr = mfspr(SPRN_MCSR);
+		if (mcsr & MCSR_IB)
+			printk("Instruction Read PLB Error\n");
+		if (mcsr & MCSR_DRB)
+			printk("Data Read PLB Error\n");
+		if (mcsr & MCSR_DWB)
+			printk("Data Write PLB Error\n");
+		if (mcsr & MCSR_TLBP)
+			printk("TLB Parity Error\n");
+		if (mcsr & MCSR_ICP){
+			flush_instruction_cache();
+			printk("I-Cache Parity Error\n");
+		}
+		if (mcsr & MCSR_DCSP)
+			printk("D-Cache Search Parity Error\n");
+		if (mcsr & MCSR_DCFP)
+			printk("D-Cache Flush Parity Error\n");
+		if (mcsr & MCSR_IMPE)
+			printk("Machine Check exception is imprecise\n");
 
+		/* Clear MCSR */
+		mtspr(SPRN_MCSR, mcsr);
+	}
 #else /* !CONFIG_4xx */
 	printk("Machine check in kernel mode.\n");
 	printk("Caused by (from SRR1=%lx): ", reason);
@@ -605,17 +631,54 @@
 }
 #endif /* CONFIG_INT_TAU */
 
+void AltivecUnavailException(struct pt_regs *regs)
+{
+	static int kernel_altivec_count;
+
+#ifndef CONFIG_ALTIVEC
+	if (user_mode(regs)) {
+		/* A user program has executed an altivec instruction,
+		   but this kernel doesn't support altivec. */
+		_exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
+		return;
+	}
+#endif
+	/* The kernel has executed an altivec instruction without
+	   first enabling altivec.  Whinge but let it do it. */
+	if (++kernel_altivec_count < 10)
+		printk(KERN_ERR "AltiVec used in kernel (task=%p, pc=%x)\n",
+		       current, regs->nip);
+	regs->msr |= MSR_VEC;
+}
+
 #ifdef CONFIG_ALTIVEC
 void
 AltivecAssistException(struct pt_regs *regs)
 {
+	int err;
+
 	preempt_disable();
 	if (regs->msr & MSR_VEC)
 		giveup_altivec(current);
 	preempt_enable();
 
-	/* XXX quick hack for now: set the non-Java bit in the VSCR */
-	current->thread.vscr.u[3] |= 0x10000;
+	err = emulate_altivec(regs);
+	if (err == 0) {
+		regs->nip += 4;		/* skip emulated instruction */
+		emulate_single_step(regs);
+		return;
+	}
+
+	if (err == -EFAULT) {
+		/* got an error reading the instruction */
+		_exception(SIGSEGV, regs, SEGV_ACCERR, regs->nip);
+	} else {
+		/* didn't recognize the instruction */
+		/* XXX quick hack for now: set the non-Java bit in the VSCR */
+		printk(KERN_ERR "unrecognized altivec instruction "
+		       "in %s at %lx\n", current->comm, regs->nip);
+		current->thread.vscr.u[3] |= 0x10000;
+	}
 }
 #endif /* CONFIG_ALTIVEC */
 
diff -Nru a/arch/ppc/kernel/vecemu.c b/arch/ppc/kernel/vecemu.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/kernel/vecemu.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,346 @@
+/*
+ * Routines to emulate some Altivec/VMX instructions, specifically
+ * those that can trap when given denormalized operands in Java mode.
+ */
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <asm/ptrace.h>
+#include <asm/processor.h>
+#include <asm/uaccess.h>
+
+/* Functions in vector.S */
+extern void vaddfp(vector128 *dst, vector128 *a, vector128 *b);
+extern void vsubfp(vector128 *dst, vector128 *a, vector128 *b);
+extern void vmaddfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
+extern void vnmsubfp(vector128 *dst, vector128 *a, vector128 *b, vector128 *c);
+extern void vrefp(vector128 *dst, vector128 *src);
+extern void vrsqrtefp(vector128 *dst, vector128 *src);
+extern void vexptep(vector128 *dst, vector128 *src);
+
+static unsigned int exp2s[8] = {
+	0x800000,
+	0x8b95c2,
+	0x9837f0,
+	0xa5fed7,
+	0xb504f3,
+	0xc5672a,
+	0xd744fd,
+	0xeac0c7
+};
+
+/*
+ * Computes an estimate of 2^x.  The `s' argument is the 32-bit
+ * single-precision floating-point representation of x.
+ */
+static unsigned int eexp2(unsigned int s)
+{
+	int exp, pwr;
+	unsigned int mant, frac;
+
+	/* extract exponent field from input */
+	exp = ((s >> 23) & 0xff) - 127;
+	if (exp > 7) {
+		/* check for NaN input */
+		if (exp == 128 && (s & 0x7fffff) != 0)
+			return s | 0x400000;	/* return QNaN */
+		/* 2^-big = 0, 2^+big = +Inf */
+		return (s & 0x80000000)? 0: 0x7f800000;	/* 0 or +Inf */
+	}
+	if (exp < -23)
+		return 0x3f800000;	/* 1.0 */
+
+	/* convert to fixed point integer in 9.23 representation */
+	pwr = (s & 0x7fffff) | 0x800000;
+	if (exp > 0)
+		pwr <<= exp;
+	else
+		pwr >>= -exp;
+	if (s & 0x80000000)
+		pwr = -pwr;
+
+	/* extract integer part, which becomes exponent part of result */
+	exp = (pwr >> 23) + 126;
+	if (exp >= 254)
+		return 0x7f800000;
+	if (exp < -23)
+		return 0;
+
+	/* table lookup on top 3 bits of fraction to get mantissa */
+	mant = exp2s[(pwr >> 20) & 7];
+
+	/* linear interpolation using remaining 20 bits of fraction */
+	asm("mulhwu %0,%1,%2" : "=r" (frac)
+	    : "r" (pwr << 12), "r" (0x172b83ff));
+	asm("mulhwu %0,%1,%2" : "=r" (frac) : "r" (frac), "r" (mant));
+	mant += frac;
+
+	if (exp >= 0)
+		return mant + (exp << 23);
+
+	/* denormalized result */
+	exp = -exp;
+	mant += 1 << (exp - 1);
+	return mant >> exp;
+}
+
+/*
+ * Computes an estimate of log_2(x).  The `s' argument is the 32-bit
+ * single-precision floating-point representation of x.
+ */
+static unsigned int elog2(unsigned int s)
+{
+	int exp, mant, lz, frac;
+
+	exp = s & 0x7f800000;
+	mant = s & 0x7fffff;
+	if (exp == 0x7f800000) {	/* Inf or NaN */
+		if (mant != 0)
+			s |= 0x400000;	/* turn NaN into QNaN */
+		return s;
+	}
+	if ((exp | mant) == 0)		/* +0 or -0 */
+		return 0xff800000;	/* return -Inf */
+
+	if (exp == 0) {
+		/* denormalized */
+		asm("cntlzw %0,%1" : "=r" (lz) : "r" (mant));
+		mant <<= lz - 8;
+		exp = (-118 - lz) << 23;
+	} else {
+		mant |= 0x800000;
+		exp -= 127 << 23;
+	}
+
+	if (mant >= 0xb504f3) {				/* 2^0.5 * 2^23 */
+		exp |= 0x400000;			/* 0.5 * 2^23 */
+		asm("mulhwu %0,%1,%2" : "=r" (mant)
+		    : "r" (mant), "r" (0xb504f334));	/* 2^-0.5 * 2^32 */
+	}
+	if (mant >= 0x9837f0) {				/* 2^0.25 * 2^23 */
+		exp |= 0x200000;			/* 0.25 * 2^23 */
+		asm("mulhwu %0,%1,%2" : "=r" (mant)
+		    : "r" (mant), "r" (0xd744fccb));	/* 2^-0.25 * 2^32 */
+	}
+	if (mant >= 0x8b95c2) {				/* 2^0.125 * 2^23 */
+		exp |= 0x100000;			/* 0.125 * 2^23 */
+		asm("mulhwu %0,%1,%2" : "=r" (mant)
+		    : "r" (mant), "r" (0xeac0c6e8));	/* 2^-0.125 * 2^32 */
+	}
+	if (mant > 0x800000) {				/* 1.0 * 2^23 */
+		/* calculate (mant - 1) * 1.381097463 */
+		/* 1.381097463 == 0.125 / (2^0.125 - 1) */
+		asm("mulhwu %0,%1,%2" : "=r" (frac)
+		    : "r" ((mant - 0x800000) << 1), "r" (0xb0c7cd3a));
+		exp += frac;
+	}
+	s = exp & 0x80000000;
+	if (exp != 0) {
+		if (s)
+			exp = -exp;
+		asm("cntlzw %0,%1" : "=r" (lz) : "r" (exp));
+		lz = 8 - lz;
+		if (lz > 0)
+			exp >>= lz;
+		else if (lz < 0)
+			exp <<= -lz;
+		s += ((lz + 126) << 23) + exp;
+	}
+	return s;
+}
+
+#define VSCR_SAT	1
+
+static int ctsxs(unsigned int x, int scale, unsigned int *vscrp)
+{
+	int exp, mant;
+
+	exp = (x >> 23) & 0xff;
+	mant = x & 0x7fffff;
+	if (exp == 255 && mant != 0)
+		return 0;		/* NaN -> 0 */
+	exp = exp - 127 + scale;
+	if (exp < 0)
+		return 0;		/* round towards zero */
+	if (exp >= 31) {
+		/* saturate, unless the result would be -2^31 */
+		if (x + (scale << 23) != 0xcf000000)
+			*vscrp |= VSCR_SAT;
+		return (x & 0x80000000)? 0x80000000: 0x7fffffff;
+	}
+	mant |= 0x800000;
+	mant = (mant << 7) >> (30 - exp);
+	return (x & 0x80000000)? -mant: mant;
+}
+
+static unsigned int ctuxs(unsigned int x, int scale, unsigned int *vscrp)
+{
+	int exp;
+	unsigned int mant;
+
+	exp = (x >> 23) & 0xff;
+	mant = x & 0x7fffff;
+	if (exp == 255 && mant != 0)
+		return 0;		/* NaN -> 0 */
+	exp = exp - 127 + scale;
+	if (exp < 0)
+		return 0;		/* round towards zero */
+	if (x & 0x80000000) {
+		/* negative => saturate to 0 */
+		*vscrp |= VSCR_SAT;
+		return 0;
+	}
+	if (exp >= 32) {
+		/* saturate */
+		*vscrp |= VSCR_SAT;
+		return 0xffffffff;
+	}
+	mant |= 0x800000;
+	mant = (mant << 8) >> (31 - exp);
+	return mant;
+}
+
+/* Round to floating integer, towards 0 */
+static unsigned int rfiz(unsigned int x)
+{
+	int exp;
+
+	exp = ((x >> 23) & 0xff) - 127;
+	if (exp == 128 && (x & 0x7fffff) != 0)
+		return x | 0x400000;	/* NaN -> make it a QNaN */
+	if (exp >= 23)
+		return x;		/* it's an integer already (or Inf) */
+	if (exp < 0)
+		return x & 0x80000000;	/* |x| < 1.0 rounds to 0 */
+	return x & ~(0x7fffff >> exp);
+}
+
+/* Round to floating integer, towards +/- Inf */
+static unsigned int rfii(unsigned int x)
+{
+	int exp, mask;
+
+	exp = ((x >> 23) & 0xff) - 127;
+	if (exp == 128 && (x & 0x7fffff) != 0)
+		return x | 0x400000;	/* NaN -> make it a QNaN */
+	if (exp >= 23)
+		return x;		/* it's an integer already (or Inf) */
+	if ((x & 0x7fffffff) == 0)
+		return x;		/* +/-0 -> +/-0 */
+	if (exp < 0)
+		/* 0 < |x| < 1.0 rounds to +/- 1.0 */
+		return (x & 0x80000000) | 0x3f800000;
+	mask = 0x7fffff >> exp;
+	/* mantissa overflows into exponent - that's OK,
+	   it can't overflow into the sign bit */
+	return (x + mask) & ~mask;
+}
+
+/* Round to floating integer, to nearest */
+static unsigned int rfin(unsigned int x)
+{
+	int exp, half;
+
+	exp = ((x >> 23) & 0xff) - 127;
+	if (exp == 128 && (x & 0x7fffff) != 0)
+		return x | 0x400000;	/* NaN -> make it a QNaN */
+	if (exp >= 23)
+		return x;		/* it's an integer already (or Inf) */
+	if (exp < -1)
+		return x & 0x80000000;	/* |x| < 0.5 -> +/-0 */
+	if (exp == -1)
+		/* 0.5 <= |x| < 1.0 rounds to +/- 1.0 */
+		return (x & 0x80000000) | 0x3f800000;
+	half = 0x400000 >> exp;
+	/* add 0.5 to the magnitude and chop off the fraction bits */
+	return (x + half) & ~(0x7fffff >> exp);
+}
+
+int
+emulate_altivec(struct pt_regs *regs)
+{
+	unsigned int instr, i;
+	unsigned int va, vb, vc, vd;
+	vector128 *vrs;
+
+	if (get_user(instr, (unsigned int *) regs->nip))
+		return -EFAULT;
+	if ((instr >> 26) != 4)
+		return -EINVAL;		/* not an altivec instruction */
+	vd = (instr >> 21) & 0x1f;
+	va = (instr >> 16) & 0x1f;
+	vb = (instr >> 11) & 0x1f;
+	vc = (instr >> 6) & 0x1f;
+
+	vrs = current->thread.vr;
+	switch (instr & 0x3f) {
+	case 10:
+		switch (vc) {
+		case 0:	/* vaddfp */
+			vaddfp(&vrs[vd], &vrs[va], &vrs[vb]);
+			break;
+		case 1:	/* vsubfp */
+			vsubfp(&vrs[vd], &vrs[va], &vrs[vb]);
+			break;
+		case 4:	/* vrefp */
+			vrefp(&vrs[vd], &vrs[vb]);
+			break;
+		case 5:	/* vrsqrtefp */
+			vrsqrtefp(&vrs[vd], &vrs[vb]);
+			break;
+		case 6:	/* vexptefp */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = eexp2(vrs[vb].u[i]);
+			break;
+		case 7:	/* vlogefp */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = elog2(vrs[vb].u[i]);
+			break;
+		case 8:		/* vrfin */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = rfin(vrs[vb].u[i]);
+			break;
+		case 9:		/* vrfiz */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = rfiz(vrs[vb].u[i]);
+			break;
+		case 10:	/* vrfip */
+			for (i = 0; i < 4; ++i) {
+				u32 x = vrs[vb].u[i];
+				x = (x & 0x80000000)? rfiz(x): rfii(x);
+				vrs[vd].u[i] = x;
+			}
+			break;
+		case 11:	/* vrfim */
+			for (i = 0; i < 4; ++i) {
+				u32 x = vrs[vb].u[i];
+				x = (x & 0x80000000)? rfii(x): rfiz(x);
+				vrs[vd].u[i] = x;
+			}
+			break;
+		case 14:	/* vctuxs */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = ctuxs(vrs[vb].u[i], va,
+						&current->thread.vscr.u[3]);
+			break;
+		case 15:	/* vctsxs */
+			for (i = 0; i < 4; ++i)
+				vrs[vd].u[i] = ctsxs(vrs[vb].u[i], va,
+						&current->thread.vscr.u[3]);
+			break;
+		default:
+			return -EINVAL;
+		}
+		break;
+	case 46:	/* vmaddfp */
+		vmaddfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
+		break;
+	case 47:	/* vnmsubfp */
+		vnmsubfp(&vrs[vd], &vrs[va], &vrs[vb], &vrs[vc]);
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
diff -Nru a/arch/ppc/kernel/vector.S b/arch/ppc/kernel/vector.S
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/kernel/vector.S	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,217 @@
+#include <asm/ppc_asm.h>
+#include <asm/processor.h>
+
+/*
+ * The routines below are in assembler so we can closely control the
+ * usage of floating-point registers.  These routines must be called
+ * with preempt disabled.
+ */
+	.data
+fpzero:
+	.long	0
+fpone:
+	.long	0x3f800000	/* 1.0 in single-precision FP */
+fphalf:
+	.long	0x3f000000	/* 0.5 in single-precision FP */
+
+	.text
+/*
+ * Internal routine to enable floating point and set FPSCR to 0.
+ * Don't call it from C; it doesn't use the normal calling convention.
+ */
+fpenable:
+	mfmsr	r10
+	ori	r11,r10,MSR_FP
+	mtmsr	r11
+	isync
+	stfd	fr0,24(r1)
+	stfd	fr1,16(r1)
+	stfd	fr31,8(r1)
+	lis	r11,fpzero@ha
+	mffs	fr31
+	lfs	fr1,fpzero@l(r11)
+	mtfsf	0xff,fr1
+	blr
+
+fpdisable:
+	mtfsf	0xff,fr31
+	lfd	fr31,8(r1)
+	lfd	fr1,16(r1)
+	lfd	fr0,24(r1)
+	mtmsr	r10
+	isync
+	blr
+
+/*
+ * Vector add, floating point.
+ */
+	.globl	vaddfp
+vaddfp:
+	stwu	r1,-32(r1)
+	mflr	r0
+	stw	r0,36(r1)
+	bl	fpenable
+	li	r0,4
+	mtctr	r0
+	li	r6,0
+1:	lfsx	fr0,r4,r6
+	lfsx	fr1,r5,r6
+	fadds	fr0,fr0,fr1
+	stfsx	fr0,r3,r6
+	addi	r6,r6,4
+	bdnz	1b
+	bl	fpdisable
+	lwz	r0,36(r1)
+	mtlr	r0
+	addi	r1,r1,32
+	blr
+
+/*
+ * Vector subtract, floating point.
+ */
+	.globl	vsubfp
+vsubfp:
+	stwu	r1,-32(r1)
+	mflr	r0
+	stw	r0,36(r1)
+	bl	fpenable
+	li	r0,4
+	mtctr	r0
+	li	r6,0
+1:	lfsx	fr0,r4,r6
+	lfsx	fr1,r5,r6
+	fsubs	fr0,fr0,fr1
+	stfsx	fr0,r3,r6
+	addi	r6,r6,4
+	bdnz	1b
+	bl	fpdisable
+	lwz	r0,36(r1)
+	mtlr	r0
+	addi	r1,r1,32
+	blr
+
+/*
+ * Vector multiply and add, floating point.
+ */
+	.globl	vmaddfp
+vmaddfp:
+	stwu	r1,-48(r1)
+	mflr	r0
+	stw	r0,52(r1)
+	bl	fpenable
+	stfd	fr2,32(r1)
+	li	r0,4
+	mtctr	r0
+	li	r7,0
+1:	lfsx	fr0,r4,r7
+	lfsx	fr1,r5,r7
+	lfsx	fr2,r6,r7
+	fmadds	fr0,fr0,fr1,fr2
+	stfsx	fr0,r3,r7
+	addi	r7,r7,4
+	bdnz	1b
+	lfd	fr2,32(r1)
+	bl	fpdisable
+	lwz	r0,52(r1)
+	mtlr	r0
+	addi	r1,r1,48
+	blr
+
+/*
+ * Vector negative multiply and subtract, floating point.
+ */
+	.globl	vnmsubfp
+vnmsubfp:
+	stwu	r1,-48(r1)
+	mflr	r0
+	stw	r0,52(r1)
+	bl	fpenable
+	stfd	fr2,32(r1)
+	li	r0,4
+	mtctr	r0
+	li	r7,0
+1:	lfsx	fr0,r4,r7
+	lfsx	fr1,r5,r7
+	lfsx	fr2,r6,r7
+	fnmsubs	fr0,fr0,fr1,fr2
+	stfsx	fr0,r3,r7
+	addi	r7,r7,4
+	bdnz	1b
+	lfd	fr2,32(r1)
+	bl	fpdisable
+	lwz	r0,52(r1)
+	mtlr	r0
+	addi	r1,r1,48
+	blr
+
+/*
+ * Vector reciprocal estimate.  We just compute 1.0/x.
+ * r3 -> destination, r4 -> source.
+ */
+	.globl	vrefp
+vrefp:
+	stwu	r1,-32(r1)
+	mflr	r0
+	stw	r0,36(r1)
+	bl	fpenable
+	lis	r9,fpone@ha
+	li	r0,4
+	lfs	fr1,fpone@l(r9)
+	mtctr	r0
+	li	r6,0
+1:	lfsx	fr0,r4,r6
+	fdivs	fr0,fr1,fr0
+	stfsx	fr0,r3,r6
+	addi	r6,r6,4
+	bdnz	1b
+	bl	fpdisable
+	lwz	r0,36(r1)
+	mtlr	r0
+	addi	r1,r1,32
+	blr
+
+/*
+ * Vector reciprocal square-root estimate, floating point.
+ * We use the frsqrte instruction for the initial estimate followed
+ * by 2 iterations of Newton-Raphson to get sufficient accuracy.
+ * r3 -> destination, r4 -> source.
+ */
+	.globl	vrsqrtefp
+vrsqrtefp:
+	stwu	r1,-48(r1)
+	mflr	r0
+	stw	r0,52(r1)
+	bl	fpenable
+	stfd	fr2,32(r1)
+	stfd	fr3,40(r1)
+	stfd	fr4,48(r1)
+	stfd	fr5,56(r1)
+	lis	r9,fpone@ha
+	lis	r8,fphalf@ha
+	li	r0,4
+	lfs	fr4,fpone@l(r9)
+	lfs	fr5,fphalf@l(r8)
+	mtctr	r0
+	li	r6,0
+1:	lfsx	fr0,r4,r6
+	frsqrte	fr1,fr0		/* r = frsqrte(s) */
+	fmuls	fr3,fr1,fr0	/* r * s */
+	fmuls	fr2,fr1,fr5	/* r * 0.5 */
+	fnmsubs	fr3,fr1,fr3,fr4	/* 1 - s * r * r */
+	fmadds	fr1,fr2,fr3,fr1	/* r = r + 0.5 * r * (1 - s * r * r) */
+	fmuls	fr3,fr1,fr0	/* r * s */
+	fmuls	fr2,fr1,fr5	/* r * 0.5 */
+	fnmsubs	fr3,fr1,fr3,fr4	/* 1 - s * r * r */
+	fmadds	fr1,fr2,fr3,fr1	/* r = r + 0.5 * r * (1 - s * r * r) */
+	stfsx	fr1,r3,r6
+	addi	r6,r6,4
+	bdnz	1b
+	lfd	fr5,56(r1)
+	lfd	fr4,48(r1)
+	lfd	fr3,40(r1)
+	lfd	fr2,32(r1)
+	bl	fpdisable
+	lwz	r0,36(r1)
+	mtlr	r0
+	addi	r1,r1,32
+	blr
diff -Nru a/arch/ppc/lib/locks.c b/arch/ppc/lib/locks.c
--- a/arch/ppc/lib/locks.c	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc/lib/locks.c	Tue Jun 15 22:20:38 2004
@@ -7,6 +7,7 @@
 #include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/spinlock.h>
+#include <linux/module.h>
 #include <asm/ppc_asm.h>
 #include <asm/smp.h>
 
@@ -22,7 +23,7 @@
  * since they may inhibit forward progress by other CPUs in getting
  * a lock.
  */
-unsigned long __spin_trylock(volatile unsigned long *lock)
+static inline unsigned long __spin_trylock(volatile unsigned long *lock)
 {
 	unsigned long ret;
 
@@ -62,6 +63,7 @@
 	lock->owner_pc = (unsigned long)__builtin_return_address(0);
 	lock->owner_cpu = cpu;
 }
+EXPORT_SYMBOL(_raw_spin_lock);
 
 int _raw_spin_trylock(spinlock_t *lock)
 {
@@ -71,6 +73,7 @@
 	lock->owner_pc = (unsigned long)__builtin_return_address(0);
 	return 1;
 }
+EXPORT_SYMBOL(_raw_spin_trylock);
 
 void _raw_spin_unlock(spinlock_t *lp)
 {
@@ -86,6 +89,7 @@
 	wmb();
 	lp->lock = 0;
 }
+EXPORT_SYMBOL(_raw_spin_unlock);
 
 
 /*
@@ -119,6 +123,7 @@
 	}
 	wmb();
 }
+EXPORT_SYMBOL(_raw_read_lock);
 
 void _raw_read_unlock(rwlock_t *rw)
 {
@@ -129,6 +134,7 @@
 	wmb();
 	atomic_dec((atomic_t *) &(rw)->lock);
 }
+EXPORT_SYMBOL(_raw_read_unlock);
 
 void _raw_write_lock(rwlock_t *rw)
 {
@@ -169,6 +175,22 @@
 	}
 	wmb();
 }
+EXPORT_SYMBOL(_raw_write_lock);
+
+int _raw_write_trylock(rwlock_t *rw)
+{
+	if (test_and_set_bit(31, &(rw)->lock)) /* someone has a write lock */
+		return 0;
+
+	if ((rw)->lock & ~(1<<31)) {	/* someone has a read lock */
+		/* clear our write lock and wait for reads to go away */
+		clear_bit(31,&(rw)->lock);
+		return 0;
+	}
+	wmb();
+	return 1;
+}
+EXPORT_SYMBOL(_raw_write_trylock);
 
 void _raw_write_unlock(rwlock_t *rw)
 {
@@ -179,5 +201,6 @@
 	wmb();
 	clear_bit(31,&(rw)->lock);
 }
+EXPORT_SYMBOL(_raw_write_unlock);
 
 #endif
diff -Nru a/arch/ppc/lib/string.S b/arch/ppc/lib/string.S
--- a/arch/ppc/lib/string.S	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/lib/string.S	Tue Jun 15 22:20:41 2004
@@ -436,48 +436,57 @@
 73:	stwu	r9,4(r6)
 	bdnz	72b
 
+	.section __ex_table,"a"
+	.align	2
+	.long	70b,100f
+	.long	71b,101f
+	.long	72b,102f
+	.long	73b,103f
+	.text
+
 58:	srwi.	r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
 	clrlwi	r5,r5,32-LG_CACHELINE_BYTES
 	li	r11,4
 	beq	63f
 
-#if !defined(CONFIG_8xx)
+#ifdef CONFIG_8xx
+	/* Don't use prefetch on 8xx */
+	mtctr	r0
+53:	COPY_16_BYTES_WITHEX(0)
+	bdnz	53b
+
+#else /* not CONFIG_8xx */
 	/* Here we decide how far ahead to prefetch the source */
+	li	r3,4
+	cmpwi	r0,1
+	li	r7,0
+	ble	114f
+	li	r7,1
 #if MAX_COPY_PREFETCH > 1
 	/* Heuristically, for large transfers we prefetch
 	   MAX_COPY_PREFETCH cachelines ahead.  For small transfers
 	   we prefetch 1 cacheline ahead. */
 	cmpwi	r0,MAX_COPY_PREFETCH
-	li	r7,1
-	li	r3,4
-	ble	111f
+	ble	112f
 	li	r7,MAX_COPY_PREFETCH
-111:	mtctr	r7
-112:	dcbt	r3,r4
+112:	mtctr	r7
+111:	dcbt	r3,r4
 	addi	r3,r3,CACHELINE_BYTES
-	bdnz	112b
-#else /* MAX_COPY_PREFETCH == 1 */
-	li	r3,CACHELINE_BYTES + 4
-	dcbt	r11,r4
-#endif /* MAX_COPY_PREFETCH */
-#endif /* CONFIG_8xx */
-
-	mtctr	r0
-53:
-#if !defined(CONFIG_8xx)
+	bdnz	111b
+#else
 	dcbt	r3,r4
+	addi	r3,r3,CACHELINE_BYTES
+#endif /* MAX_COPY_PREFETCH > 1 */
+
+114:	subf	r8,r7,r0
+	mr	r0,r7
+	mtctr	r8
+
+53:	dcbt	r3,r4
 54:	dcbz	r11,r6
-#endif
-/* had to move these to keep extable in order */
 	.section __ex_table,"a"
 	.align	2
-	.long	70b,100f
-	.long	71b,101f
-	.long	72b,102f
-	.long	73b,103f
-#if !defined(CONFIG_8xx)
 	.long	54b,105f
-#endif
 	.text
 /* the main body of the cacheline loop */
 	COPY_16_BYTES_WITHEX(0)
@@ -495,6 +504,11 @@
 #endif
 #endif
 	bdnz	53b
+	cmpwi	r0,0
+	li	r3,4
+	li	r7,0
+	bne	114b
+#endif /* CONFIG_8xx */
 
 63:	srwi.	r0,r5,2
 	mtctr	r0
diff -Nru a/arch/ppc/mm/Makefile b/arch/ppc/mm/Makefile
--- a/arch/ppc/mm/Makefile	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc/mm/Makefile	Tue Jun 15 22:20:43 2004
@@ -12,4 +12,3 @@
 obj-$(CONFIG_PPC_STD_MMU)	+= hashtable.o ppc_mmu.o tlb.o
 obj-$(CONFIG_40x)		+= 4xx_mmu.o
 obj-$(CONFIG_44x)		+= 44x_mmu.o
-obj-$(CONFIG_NOT_COHERENT_CACHE)	+= cachemap.o
diff -Nru a/arch/ppc/mm/cachemap.c b/arch/ppc/mm/cachemap.c
--- a/arch/ppc/mm/cachemap.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,174 +0,0 @@
-/*
- *  PowerPC version derived from arch/arm/mm/consistent.c
- *    Copyright (C) 2001 Dan Malek (dmalek@jlc.net)
- *
- *  arch/ppc/mm/cachemap.c
- *
- *  Copyright (C) 2000 Russell King
- *
- * Consistent memory allocators.  Used for DMA devices that want to
- * share uncached memory with the processor core.  The function return
- * is the virtual address and 'dma_handle' is the physical address.
- * Mostly stolen from the ARM port, with some changes for PowerPC.
- *						-- Dan
- *
- * 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/config.h>
-#include <linux/module.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/ptrace.h>
-#include <linux/mman.h>
-#include <linux/mm.h>
-#include <linux/swap.h>
-#include <linux/stddef.h>
-#include <linux/vmalloc.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/bootmem.h>
-#include <linux/highmem.h>
-#include <linux/dma-mapping.h>
-
-#include <asm/pgalloc.h>
-#include <asm/prom.h>
-#include <asm/io.h>
-#include <asm/hardirq.h>
-#include <asm/mmu_context.h>
-#include <asm/pgtable.h>
-#include <asm/mmu.h>
-#include <asm/uaccess.h>
-#include <asm/smp.h>
-#include <asm/machdep.h>
-
-int map_page(unsigned long va, phys_addr_t pa, int flags);
-
-/* This function will allocate the requested contiguous pages and
- * map them into the kernel's vmalloc() space.  This is done so we
- * get unique mapping for these pages, outside of the kernel's 1:1
- * virtual:physical mapping.  This is necessary so we can cover large
- * portions of the kernel with single large page TLB entries, and
- * still get unique uncached pages for consistent DMA.
- */
-void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle)
-{
-	int order, err;
-	struct page *page, *free, *end;
-	phys_addr_t pa;
-	unsigned long flags, offset;
-	struct vm_struct *area = NULL;
-	unsigned long va = 0;
-
-	BUG_ON(in_interrupt());
-
-	/* Only allocate page size areas */
-	size = PAGE_ALIGN(size);
-	order = get_order(size);
-
-	free = page = alloc_pages(gfp, order);
-	if (! page)
-		return NULL;
-
-	pa = page_to_phys(page);
-	*dma_handle = page_to_bus(page);
-	end = page + (1 << order);
-
-	/*
-	 * we need to ensure that there are no cachelines in use,
-	 * or worse dirty in this area.
-	 */
-	invalidate_dcache_range((unsigned long)page_address(page),
-				(unsigned long)page_address(page) + size);
-
-	/*
-	 * alloc_pages() expects the block to be handled as a unit, so
-	 * it only sets the page count on the first page.  We set the
-	 * counts on each page so they can be freed individually
-	 */
-	for (; page < end; page++)
-		set_page_count(page, 1);
-
-
-	/* Allocate some common virtual space to map the new pages*/
-	area = get_vm_area(size, VM_ALLOC);
-	if (! area)
-		goto out;
-
-	va = (unsigned long) area->addr;
-
-	flags = _PAGE_KERNEL | _PAGE_NO_CACHE;
-	
-	for (offset = 0; offset < size; offset += PAGE_SIZE) {
-		err = map_page(va+offset, pa+offset, flags);
-		if (err) {
-			vfree((void *)va);
-			va = 0;
-			goto out;
-		}
-
-		free++;
-	}
-
- out:
-	/* Free pages which weren't mapped */
-	for (; free < end; free++) {
-		__free_page(free);
-	}
-
-	return (void *)va;
-}
-
-/*
- * free page(s) as defined by the above mapping.
- */
-void consistent_free(void *vaddr)
-{
-	BUG_ON(in_interrupt());
-	vfree(vaddr);
-}
-
-/*
- * make an area consistent.
- */
-void consistent_sync(void *vaddr, size_t size, int direction)
-{
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end   = start + size;
-
-	switch (direction) {
-	case DMA_NONE:
-		BUG();
-	case DMA_FROM_DEVICE:	/* invalidate only */
-		invalidate_dcache_range(start, end);
-		break;
-	case DMA_TO_DEVICE:		/* writeback only */
-		clean_dcache_range(start, end);
-		break;
-	case DMA_BIDIRECTIONAL:	/* writeback and invalidate */
-		flush_dcache_range(start, end);
-		break;
-	}
-}
-
-/*
- * consistent_sync_page make a page are consistent. identical
- * to consistent_sync, but takes a struct page instead of a virtual address
- */
-
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction)
-{
-	unsigned long start;
-
-	start = (unsigned long)page_address(page) + offset;
-	consistent_sync((void *)start, size, direction);
-}
-
-EXPORT_SYMBOL(consistent_sync_page);
diff -Nru a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
--- a/arch/ppc/mm/fault.c	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc/mm/fault.c	Tue Jun 15 22:20:38 2004
@@ -51,11 +51,6 @@
 unsigned long pte_errors;	/* updated by do_page_fault() */
 unsigned int probingmem;
 
-extern void die_if_kernel(char *, struct pt_regs *, long);
-void bad_page_fault(struct pt_regs *, unsigned long, int sig);
-void do_page_fault(struct pt_regs *, unsigned long, unsigned long);
-extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep);
-
 /*
  * Check whether the instruction at regs->nip is a store using
  * an update addressing form which will update r1.
@@ -97,8 +92,8 @@
  * the error_code parameter is ESR for a data fault, 0 for an instruction
  * fault.
  */
-void do_page_fault(struct pt_regs *regs, unsigned long address,
-		   unsigned long error_code)
+int do_page_fault(struct pt_regs *regs, unsigned long address,
+		  unsigned long error_code)
 {
 	struct vm_area_struct * vma;
 	struct mm_struct *mm = current->mm;
@@ -124,21 +119,20 @@
 #if defined(CONFIG_XMON) || defined(CONFIG_KGDB)
 	if (debugger_fault_handler && TRAP(regs) == 0x300) {
 		debugger_fault_handler(regs);
-		return;
+		return 0;
 	}
 #if !defined(CONFIG_4xx)
 	if (error_code & 0x00400000) {
 		/* DABR match */
 		if (debugger_dabr_match(regs))
-			return;
+			return 0;
 	}
 #endif /* !CONFIG_4xx */
 #endif /* CONFIG_XMON || CONFIG_KGDB */
 
-	if (in_atomic() || mm == NULL) {
-		bad_page_fault(regs, address, SIGSEGV);
-		return;
-	}
+	if (in_atomic() || mm == NULL)
+		return SIGSEGV;
+
 	down_read(&mm->mmap_sem);
 	vma = find_vma(mm, address);
 	if (!vma)
@@ -227,15 +221,14 @@
 			struct page *page = pte_page(*ptep);
 
 			if (! test_bit(PG_arch_1, &page->flags)) {
-				unsigned long phys = page_to_pfn(page) << PAGE_SHIFT;
-				__flush_dcache_icache_phys(phys);
+				flush_dcache_icache_page(page);
 				set_bit(PG_arch_1, &page->flags);
 			}
 			pte_update(ptep, 0, _PAGE_HWEXEC);
 			_tlbie(address);
 			pte_unmap(ptep);
 			up_read(&mm->mmap_sem);
-			return;
+			return 0;
 		}
 		if (ptep != NULL)
 			pte_unmap(ptep);
@@ -277,7 +270,7 @@
 	 * -- Cort
 	 */
 	pte_misses++;
-	return;
+	return 0;
 
 bad_area:
 	up_read(&mm->mmap_sem);
@@ -290,11 +283,10 @@
 		info.si_code = code;
 		info.si_addr = (void *) address;
 		force_sig_info(SIGSEGV, &info, current);
-		return;
+		return 0;
 	}
 
-	bad_page_fault(regs, address, SIGSEGV);
-	return;
+	return SIGSEGV;
 
 /*
  * We ran out of memory, or some other thing happened to us that made
@@ -310,8 +302,7 @@
 	printk("VM: killing process %s\n", current->comm);
 	if (user_mode(regs))
 		do_exit(SIGKILL);
-	bad_page_fault(regs, address, SIGKILL);
-	return;
+	return SIGKILL;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
@@ -321,18 +312,18 @@
 	info.si_addr = (void *)address;
 	force_sig_info (SIGBUS, &info, current);
 	if (!user_mode(regs))
-		bad_page_fault(regs, address, SIGBUS);
+		return SIGBUS;
+	return 0;
 }
 
 /*
  * bad_page_fault is called when we have a bad access from the kernel.
- * It is called from do_page_fault above and from some of the procedures
- * in traps.c.
+ * It is called from the DSI and ISI handlers in head.S and from some
+ * of the procedures in traps.c.
  */
 void
 bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
 {
-	extern void die(const char *,struct pt_regs *,long);
 	const struct exception_table_entry *entry;
 
 	/* Are we prepared to handle this fault?  */
@@ -359,7 +350,6 @@
 	pgd_t *dir;
 	pmd_t *pmd;
 	pte_t *pte;
-	struct mm_struct *mm;
 
 	if (address < TASK_SIZE)
 		return NULL;
diff -Nru a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
--- a/arch/ppc/mm/init.c	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc/mm/init.c	Tue Jun 15 22:20:38 2004
@@ -458,7 +458,7 @@
 
 			ClearPageReserved(page);
 			set_bit(PG_highmem, &page->flags);
-			atomic_set(&page->count, 1);
+			set_page_count(page, 1);
 			__free_page(page);
 			totalhigh_pages++;
 		}
@@ -572,6 +572,16 @@
 	clear_bit(PG_arch_1, &page->flags);
 }
 
+void flush_dcache_icache_page(struct page *page)
+{
+#ifdef CONFIG_BOOKE
+	__flush_dcache_icache(kmap(page));
+	kunmap(page);
+#else
+	__flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
+#endif
+
+}
 void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
 {
 	clear_page(page);
@@ -614,7 +624,7 @@
 			if (vma->vm_mm == current->active_mm)
 				__flush_dcache_icache((void *) address);
 			else
-				__flush_dcache_icache_phys(pfn << PAGE_SHIFT);
+				flush_dcache_icache_page(page);
 			set_bit(PG_arch_1, &page->flags);
 		}
 	}
diff -Nru a/arch/ppc/mm/mem_pieces.c b/arch/ppc/mm/mem_pieces.c
--- a/arch/ppc/mm/mem_pieces.c	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/mm/mem_pieces.c	Tue Jun 15 22:20:36 2004
@@ -120,23 +120,6 @@
 	printk("\n");
 }
 
-#if defined(CONFIG_APUS) || defined(CONFIG_PPC_OF)
-/*
- * Add some memory to an array of pieces
- */
-void __init
-mem_pieces_append(struct mem_pieces *mp, unsigned int start, unsigned int size)
-{
-	struct reg_property *rp;
-
-	if (mp->n_regions >= MEM_PIECES_MAX)
-		return;
-	rp = &mp->regions[mp->n_regions++];
-	rp->address = start;
-	rp->size = size;
-}
-#endif /* CONFIG_APUS || CONFIG_PPC_OF */
-
 void __init
 mem_pieces_sort(struct mem_pieces *mp)
 {
diff -Nru a/arch/ppc/mm/mem_pieces.h b/arch/ppc/mm/mem_pieces.h
--- a/arch/ppc/mm/mem_pieces.h	Tue Jun 15 22:20:35 2004
+++ b/arch/ppc/mm/mem_pieces.h	Tue Jun 15 22:20:35 2004
@@ -38,8 +38,6 @@
 extern void	*mem_pieces_find(unsigned int size, unsigned int align);
 extern void	 mem_pieces_remove(struct mem_pieces *mp, unsigned int start,
 				   unsigned int size, int must_exist);
-extern void	 mem_pieces_append(struct mem_pieces *mp, unsigned int start,
-				   unsigned int size);
 extern void	 mem_pieces_coalesce(struct mem_pieces *mp);
 extern void	 mem_pieces_sort(struct mem_pieces *mp);
 
diff -Nru a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c
--- a/arch/ppc/mm/pgtable.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/mm/pgtable.c	Tue Jun 15 22:20:37 2004
@@ -86,9 +86,14 @@
 	extern int mem_init_done;
 	extern void *early_get_page(void);
 
-	if (mem_init_done)
+	if (mem_init_done) {
 		pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
-	else
+		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)
 		clear_page(pte);
@@ -97,7 +102,7 @@
 
 struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	struct page *pte;
+	struct page *ptepage;
 
 #ifdef CONFIG_HIGHPTE
 	int flags = GFP_KERNEL | __GFP_HIGHMEM | __GFP_REPEAT;
@@ -105,10 +110,13 @@
 	int flags = GFP_KERNEL | __GFP_REPEAT;
 #endif
 
-	pte = alloc_pages(flags, 0);
-	if (pte)
-		clear_highpage(pte);
-	return pte;
+	ptepage = alloc_pages(flags, 0);
+	if (ptepage) {
+		ptepage->mapping = (void *) mm;
+		ptepage->index = address & PMD_MASK;
+		clear_highpage(ptepage);
+	}
+	return ptepage;
 }
 
 void pte_free_kernel(pte_t *pte)
@@ -116,15 +124,17 @@
 #ifdef CONFIG_SMP
 	hash_page_sync();
 #endif
+	virt_to_page(pte)->mapping = NULL;
 	free_page((unsigned long)pte);
 }
 
-void pte_free(struct page *pte)
+void pte_free(struct page *ptepage)
 {
 #ifdef CONFIG_SMP
 	hash_page_sync();
 #endif
-	__free_page(pte);
+	ptepage->mapping = NULL;
+	__free_page(ptepage);
 }
 
 #ifndef CONFIG_44x
diff -Nru a/arch/ppc/mm/tlb.c b/arch/ppc/mm/tlb.c
--- a/arch/ppc/mm/tlb.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc/mm/tlb.c	Tue Jun 15 22:20:42 2004
@@ -67,6 +67,17 @@
 }
 
 /*
+ * Called by ptep_set_access_flags, must flush on CPUs for which the
+ * DSI handler can't just "fixup" the TLB on a write fault
+ */
+void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr)
+{
+	if (Hash != 0)
+		return;
+	_tlbie(addr);
+}
+
+/*
  * Called at the end of a mmu_gather operation to make sure the
  * TLB flush is completely done.
  */
diff -Nru a/arch/ppc/ocp/Makefile b/arch/ppc/ocp/Makefile
--- a/arch/ppc/ocp/Makefile	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,6 +0,0 @@
-#
-# Makefile for the linux kernel.
-#
-
-obj-y   	:= ocp.o ocp-driver.o ocp-probe.o
-
diff -Nru a/arch/ppc/ocp/ocp-driver.c b/arch/ppc/ocp/ocp-driver.c
--- a/arch/ppc/ocp/ocp-driver.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,195 +0,0 @@
-/*
- * FILE NAME: ocp-driver.c
- *
- * BRIEF MODULE DESCRIPTION:
- * driver callback, id matching and registration
- * Based on drivers/pci/pci-driver, Copyright (c) 1997--1999 Martin Mares
- *
- * Maintained by: Armin <akuster@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.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS 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
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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 <asm/ocp.h>
-#include <linux/module.h>
-#include <linux/init.h>
-
-/*
- *  Registration of OCP drivers and handling of hot-pluggable devices.
- */
-
-static int
-ocp_device_probe(struct device *dev)
-{
-	int error = 0;
-	struct ocp_driver *drv;
-	struct ocp_device *ocp_dev;
-
-	drv = to_ocp_driver(dev->driver);
-	ocp_dev = to_ocp_dev(dev);
-
-	if (drv->probe) {
-		error = drv->probe(ocp_dev);
-		DBG("probe return code %d\n", error);
-		if (error >= 0) {
-			ocp_dev->driver = drv;
-			error = 0;
-		}
-	}
-	return error;
-}
-
-static int
-ocp_device_remove(struct device *dev)
-{
-	struct ocp_device *ocp_dev = to_ocp_dev(dev);
-
-	if (ocp_dev->driver) {
-		if (ocp_dev->driver->remove)
-			ocp_dev->driver->remove(ocp_dev);
-		ocp_dev->driver = NULL;
-	}
-	return 0;
-}
-
-static int
-ocp_device_suspend(struct device *dev, u32 state, u32 level)
-{
-	struct ocp_device *ocp_dev = to_ocp_dev(dev);
-
-	int error = 0;
-
-	if (ocp_dev->driver) {
-		if (level == SUSPEND_SAVE_STATE && ocp_dev->driver->save_state)
-			error = ocp_dev->driver->save_state(ocp_dev, state);
-		else if (level == SUSPEND_POWER_DOWN
-			 && ocp_dev->driver->suspend)
-			error = ocp_dev->driver->suspend(ocp_dev, state);
-	}
-	return error;
-}
-
-static int
-ocp_device_resume(struct device *dev, u32 level)
-{
-	struct ocp_device *ocp_dev = to_ocp_dev(dev);
-
-	if (ocp_dev->driver) {
-		if (level == RESUME_POWER_ON && ocp_dev->driver->resume)
-			ocp_dev->driver->resume(ocp_dev);
-	}
-	return 0;
-}
-
-/**
- * ocp_bus_match - Works out whether an OCP device matches any
- * of the IDs listed for a given OCP driver.
- * @dev: the generic device struct for the OCP device
- * @drv: the generic driver struct for the OCP driver
- *
- * Used by a driver to check whether a OCP device present in the
- * system is in its list of supported devices.  Returns 1 for a
- * match, or 0 if there is no match.
- */
-static int
-ocp_bus_match(struct device *dev, struct device_driver *drv)
-{
-	struct ocp_device *ocp_dev = to_ocp_dev(dev);
-	struct ocp_driver *ocp_drv = to_ocp_driver(drv);
-	const struct ocp_device_id *ids = ocp_drv->id_table;
-
-	if (!ids)
-		return 0;
-
-	while (ids->vendor || ids->device) {
-		if ((ids->vendor == OCP_ANY_ID
-		     || ids->vendor == ocp_dev->vendor)
-		    && (ids->device == OCP_ANY_ID
-			|| ids->device == ocp_dev->device)) {
-			DBG("Bus match -vendor:%x device:%x\n", ids->vendor,
-			    ids->device);
-			return 1;
-		}
-		ids++;
-	}
-	return 0;
-}
-
-struct bus_type ocp_bus_type = {
-	.name = "ocp",
-	.match = ocp_bus_match,
-};
-
-static int __init
-ocp_driver_init(void)
-{
-	return bus_register(&ocp_bus_type);
-}
-
-postcore_initcall(ocp_driver_init);
-
-/**
- * ocp_register_driver - register a new ocp driver
- * @drv: the driver structure to register
- *
- * Adds the driver structure to the list of registered drivers
- * Returns the number of ocp devices which were claimed by the driver
- * during registration.  The driver remains registered even if the
- * return value is zero.
- */
-int
-ocp_register_driver(struct ocp_driver *drv)
-{
-	int count = 0;
-
-	/* initialize common driver fields */
-	drv->driver.name = drv->name;
-	drv->driver.bus = &ocp_bus_type;
-	drv->driver.probe = ocp_device_probe;
-	drv->driver.resume = ocp_device_resume;
-	drv->driver.suspend = ocp_device_suspend;
-	drv->driver.remove = ocp_device_remove;
-
-	/* register with core */
-	count = driver_register(&drv->driver);
-	return count ? count : 1;
-}
-
-/**
- * ocp_unregister_driver - unregister a ocp driver
- * @drv: the driver structure to unregister
- *
- * Deletes the driver structure from the list of registered OCP drivers,
- * gives it a chance to clean up by calling its remove() function for
- * each device it was responsible for, and marks those devices as
- * driverless.
- */
-
-void
-ocp_unregister_driver(struct ocp_driver *drv)
-{
-	driver_unregister(&drv->driver);
-}
-
-EXPORT_SYMBOL(ocp_register_driver);
-EXPORT_SYMBOL(ocp_unregister_driver);
-EXPORT_SYMBOL(ocp_bus_type);
diff -Nru a/arch/ppc/ocp/ocp-probe.c b/arch/ppc/ocp/ocp-probe.c
--- a/arch/ppc/ocp/ocp-probe.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,113 +0,0 @@
-/*
- * FILE NAME: ocp-probe.c
- *
- * BRIEF MODULE DESCRIPTION:
- * Device scanning & bus set routines
- * Based on drivers/pci/probe, Copyright (c) 1997--1999 Martin Mares
- *
- * Maintained by: Armin <akuster@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.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS 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
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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/init.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/device.h>
-#include <asm/ocp.h>
-
-LIST_HEAD(ocp_devices);
-struct device *ocp_bus;
-
-static struct ocp_device * __devinit
-ocp_setup_dev(struct ocp_def *odef, unsigned int index)
-{
-	struct ocp_device *dev;
-
-	dev = kmalloc(sizeof(*dev), GFP_KERNEL);
-	if (!dev)
-		return NULL;
-	memset(dev, 0, sizeof(*dev));
-
-	dev->vendor = odef->vendor;
-	dev->device = odef->device;
-	dev->num = ocp_get_num(dev->device);
-	dev->paddr = odef->paddr;
-	dev->irq = odef->irq;
-	dev->pm = odef->pm;
-	dev->current_state = 4;
-
-	sprintf(dev->name, "OCP device %04x:%04x", dev->vendor, dev->device);
-
-	DBG("%s %s 0x%lx irq:%d pm:0x%lx \n", dev->slot_name, dev->name,
-	    (unsigned long) dev->paddr, dev->irq, dev->pm);
-
-	/* now put in global tree */
-	sprintf(dev->dev.bus_id, "%d", index);
-	dev->dev.parent = ocp_bus;
-	dev->dev.bus = &ocp_bus_type;
-	device_register(&dev->dev);
-
-	return dev;
-}
-
-static struct device * __devinit ocp_alloc_primary_bus(void)
-{
-	struct device *b;
-
-	b = kmalloc(sizeof(struct device), GFP_KERNEL);
-	if (b == NULL)
-		return NULL;
-	memset(b, 0, sizeof(struct device));
-	strcpy(b->bus_id, "ocp");
-
-	device_register(b);
-
-	return b;
-}
-
-void __devinit ocp_setup_devices(struct ocp_def *odef)
-{
-	int index;
-	struct ocp_device *dev;
-
-	if (ocp_bus == NULL)
-		ocp_bus = ocp_alloc_primary_bus();
-	for (index = 0; odef->vendor != OCP_VENDOR_INVALID; ++index, ++odef) {
-		dev = ocp_setup_dev(odef, index);
-		if (dev != NULL)
-			list_add_tail(&dev->global_list, &ocp_devices);
-	}
-}
-
-extern struct ocp_def core_ocp[];
-
-static int __init
-ocparch_init(void)
-{
-	ocp_setup_devices(core_ocp);
-	return 0;
-}
-
-subsys_initcall(ocparch_init);
-
-EXPORT_SYMBOL(ocp_devices);
diff -Nru a/arch/ppc/ocp/ocp.c b/arch/ppc/ocp/ocp.c
--- a/arch/ppc/ocp/ocp.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,109 +0,0 @@
-/*
- * ocp.c
- *
- *	The is drived from pci.c
- *
- * 	Current Maintainer
- *      Armin Kuster akuster@dslextreme.com
- *      Jan, 2002
- *
- *
- *
- * 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  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS 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
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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/list.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/config.h>
-#include <linux/stddef.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-#include <asm/io.h>
-#include <asm/ocp.h>
-#include <asm/errno.h>
-
-/**
- * ocp_get_num - This determines how many OCP devices of a given
- * device are registered
- * @device: OCP device such as HOST, PCI, GPT, UART, OPB, IIC, GPIO, EMAC, ZMII,
- *
- * The routine returns the number that devices which is registered
- */
-unsigned int ocp_get_num(unsigned int device)
-{
-	unsigned int count = 0;
-	struct ocp_device *ocp;
-	struct list_head *ocp_l;
-
-	list_for_each(ocp_l, &ocp_devices) {
-		ocp = list_entry(ocp_l, struct ocp_device, global_list);
-		if (device == ocp->device)
-			count++;
-	}
-	return count;
-}
-
-/**
- * ocp_get_dev - get ocp driver pointer for ocp device and instance of it
- * @device: OCP device such as PCI, GPT, UART, OPB, IIC, GPIO, EMAC, ZMII
- * @dev_num: ocp device number whos paddr you want
- *
- * The routine returns ocp device pointer
- * in list based on device and instance of that device
- *
- */
-struct ocp_device *
-ocp_get_dev(unsigned int device, int dev_num)
-{
-	struct ocp_device *ocp;
-	struct list_head *ocp_l;
-	int count = 0;
-
-	list_for_each(ocp_l, &ocp_devices) {
-		ocp = list_entry(ocp_l, struct ocp_device, global_list);
-		if (device == ocp->device) {
-			if (dev_num == count)
-				return ocp;
-			count++;
-		}
-	}
-	return NULL;
-}
-
-EXPORT_SYMBOL(ocp_get_dev);
-EXPORT_SYMBOL(ocp_get_num);
-
-#ifdef CONFIG_PM
-int ocp_generic_suspend(struct ocp_device *pdev, u32 state)
-{
-	ocp_force_power_off(pdev);
-	return 0;
-}
-
-int ocp_generic_resume(struct ocp_device *pdev)
-{
-	ocp_force_power_on(pdev);
-}
-
-EXPORT_SYMBOL(ocp_generic_suspend);
-EXPORT_SYMBOL(ocp_generic_resume);
-#endif /* CONFIG_PM */
diff -Nru a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
--- a/arch/ppc/platforms/4xx/Kconfig	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/platforms/4xx/Kconfig	Tue Jun 15 22:20:37 2004
@@ -16,6 +16,11 @@
 	help
 	  This option enables support for the IBM NP405H evaluation board.
 
+config BUBINGA
+	bool "Bubinga"
+	help
+	  This option enables support for the IBM 405EP evaluation board.
+
 config CPCI405
 	bool "CPCI405"
 	help
@@ -122,7 +127,7 @@
 
 config IBM_OCP
 	bool
-	depends on ASH || CPCI405 || EBONY || EP405 || OCOTEA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
+	depends on ASH || BUBINGA || CPCI405 || EBONY || EP405 || OCOTEA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
 	default y
 
 config IBM_EMAC4
@@ -132,7 +137,7 @@
 
 config BIOS_FIXUP
 	bool
-	depends on EP405 || SYCAMORE || WALNUT
+	depends on BUBINGA || EP405 || SYCAMORE || WALNUT
 	default y
 
 config 403GCX
@@ -140,6 +145,11 @@
 	depends OAK
 	default y
 
+config 405EP
+	bool
+	depends on BUBINGA
+	default y
+
 config 405GP
 	bool
 	depends on CPCI405 || EP405 || WALNUT
@@ -148,6 +158,7 @@
 config 405GPR
 	bool
 	depends on SYCAMORE
+	default y
 
 config STB03xxx
 	bool
@@ -161,7 +172,7 @@
 
 config IBM_OPENBIOS
 	bool
-	depends on ASH || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
+	depends on ASH || BUBINGA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
 	default y
 
 config PM
diff -Nru a/arch/ppc/platforms/4xx/Makefile b/arch/ppc/platforms/4xx/Makefile
--- a/arch/ppc/platforms/4xx/Makefile	Tue Jun 15 22:20:58 2004
+++ b/arch/ppc/platforms/4xx/Makefile	Tue Jun 15 22:20:58 2004
@@ -5,6 +5,7 @@
 obj-$(CONFIG_CPCI405)		+= cpci405.o
 obj-$(CONFIG_EBONY)		+= ebony.o
 obj-$(CONFIG_EP405)		+= ep405.o
+obj-$(CONFIG_BUBINGA)		+= bubinga.o
 obj-$(CONFIG_OAK)		+= oak.o
 obj-$(CONFIG_OCOTEA)		+= ocotea.o
 obj-$(CONFIG_REDWOOD_5)		+= redwood5.o
@@ -16,6 +17,7 @@
 obj-$(CONFIG_REDWOOD_5)		+= ibmstb4.o
 obj-$(CONFIG_NP405H)		+= ibmnp405h.o
 obj-$(CONFIG_REDWOOD_6)		+= ibmstbx25.o
-obj-$(CONFIG_EBONY)		+= ibm440gp.o
-obj-$(CONFIG_OCOTEA)		+= ibm440gx.o
+obj-$(CONFIG_440GP)		+= ibm440gp.o
+obj-$(CONFIG_440GX)		+= ibm440gx.o
+obj-$(CONFIG_405EP)		+= ibm405ep.o
 obj-$(CONFIG_405GPR)		+= ibm405gpr.o
diff -Nru a/arch/ppc/platforms/4xx/ash.c b/arch/ppc/platforms/4xx/ash.c
--- a/arch/ppc/platforms/4xx/ash.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/platforms/4xx/ash.c	Tue Jun 15 22:20:37 2004
@@ -18,6 +18,8 @@
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
 #include <asm/io.h>
+#include <asm/ocp.h>
+#include <asm/ibm_ocp_pci.h>
 #include <asm/todc.h>
 
 #ifdef DEBUG
@@ -53,10 +55,10 @@
 void __init
 ash_setup_arch(void)
 {
-	bd_t *bip = &__res;
-
 	ppc4xx_setup_arch();
 
+	ibm_ocp_set_emac(0, 3);
+
 #ifdef CONFIG_DEBUG_BRINGUP
 	int i;
 	printk("\n");
@@ -96,8 +98,6 @@
 void __init
 bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
 {
-
-	unsigned int bar_response, bar;
 	/*
 	 * Expected PCI mapping:
 	 *
diff -Nru a/arch/ppc/platforms/4xx/ash.h b/arch/ppc/platforms/4xx/ash.h
--- a/arch/ppc/platforms/4xx/ash.h	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/platforms/4xx/ash.h	Tue Jun 15 22:20:37 2004
@@ -15,7 +15,6 @@
 #ifdef __KERNEL__
 #ifndef __ASM_ASH_H__
 #define __ASM_ASH_H__
-#include <asm/ibm_ocp.h>
 #include <platforms/4xx/ibmnp405h.h>
 
 #ifndef __ASSEMBLY__
diff -Nru a/arch/ppc/platforms/4xx/bubinga.c b/arch/ppc/platforms/4xx/bubinga.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/platforms/4xx/bubinga.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,263 @@
+/*
+ * Support for IBM PPC 405EP evaluation board (Bubinga).
+ *
+ * Author: SAW (IBM), derived from walnut.c.
+ *         Maintained by MontaVista Software <source@mvista.com>
+ *
+ * 2003 (c) MontaVista Softare 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/config.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/threads.h>
+#include <linux/param.h>
+#include <linux/string.h>
+#include <linux/blkdev.h>
+#include <linux/pci.h>
+#include <linux/rtc.h>
+#include <linux/tty.h>
+#include <linux/serial.h>
+#include <linux/serial_core.h>
+
+#include <asm/system.h>
+#include <asm/pci-bridge.h>
+#include <asm/processor.h>
+#include <asm/machdep.h>
+#include <asm/page.h>
+#include <asm/time.h>
+#include <asm/io.h>
+#include <asm/todc.h>
+#include <asm/kgdb.h>
+#include <asm/ocp.h>
+#include <asm/ibm_ocp_pci.h>
+
+#include <platforms/4xx/ibm405ep.h>
+
+#undef DEBUG
+
+#ifdef DEBUG
+#define DBG(x...) printk(x)
+#else
+#define DBG(x...)
+#endif
+
+extern bd_t __res;
+
+void *bubinga_rtc_base;
+
+/* Some IRQs unique to the board
+ * Used by the generic 405 PCI setup functions in ppc4xx_pci.c
+ */
+int __init
+ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
+{
+	static char pci_irq_table[][4] =
+	    /*
+	     *      PCI IDSEL/INTPIN->INTLINE
+	     *      A       B       C       D
+	     */
+	{
+		{28, 28, 28, 28},	/* IDSEL 1 - PCI slot 1 */
+		{29, 29, 29, 29},	/* IDSEL 2 - PCI slot 2 */
+		{30, 30, 30, 30},	/* IDSEL 3 - PCI slot 3 */
+		{31, 31, 31, 31},	/* IDSEL 4 - PCI slot 4 */
+	};
+
+	const long min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
+	return PCI_IRQ_TABLE_LOOKUP;
+};
+
+/* The serial clock for the chip is an internal clock determined by
+ * different clock speeds/dividers.
+ * Calculate the proper input baud rate and setup the serial driver.
+ */
+static void __init
+bubinga_early_serial_map(void)
+{
+	u32 uart_div;
+	int uart_clock;
+	struct uart_port port;
+
+         /* Calculate the serial clock input frequency
+          *
+          * The base baud is the PLL OUTA (provided in the board info
+          * structure) divided by the external UART Divisor, divided
+          * by 16.
+          */
+	uart_div = (mfdcr(DCRN_CPC0_UCR_BASE) & DCRN_CPC0_UCR_U0DIV);
+	uart_clock = __res.bi_pllouta_freq / uart_div;
+
+	/* Setup serial port access */
+	memset(&port, 0, sizeof(port));
+	port.membase = (void*)ACTING_UART0_IO_BASE;
+	port.irq = ACTING_UART0_INT;
+	port.uartclk = uart_clock;
+	port.regshift = 0;
+	port.iotype = SERIAL_IO_MEM;
+	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
+	port.line = 0;
+
+	if (early_serial_setup(&port) != 0) {
+		printk("Early serial init of port 0 failed\n");
+	}
+
+	port.membase = (void*)ACTING_UART1_IO_BASE;
+	port.irq = ACTING_UART1_INT;
+	port.line = 1;
+
+	if (early_serial_setup(&port) != 0) {
+		printk("Early serial init of port 1 failed\n");
+	}
+}
+
+void __init
+bios_fixup(struct pci_controller *hose, struct pcil0_regs *pcip)
+{
+
+	unsigned int bar_response, bar;
+	/*
+	 * Expected PCI mapping:
+	 *
+	 *  PLB addr             PCI memory addr
+	 *  ---------------------       ---------------------
+	 *  0000'0000 - 7fff'ffff <---  0000'0000 - 7fff'ffff
+	 *  8000'0000 - Bfff'ffff --->  8000'0000 - Bfff'ffff
+	 *
+	 *  PLB addr             PCI io addr
+	 *  ---------------------       ---------------------
+	 *  e800'0000 - e800'ffff --->  0000'0000 - 0001'0000
+	 *
+	 * The following code is simplified by assuming that the bootrom
+	 * has been well behaved in following this mapping.
+	 */
+
+#ifdef DEBUG
+	int i;
+
+	printk("ioremap PCLIO_BASE = 0x%x\n", pcip);
+	printk("PCI bridge regs before fixup \n");
+	for (i = 0; i <= 3; i++) {
+		printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
+		printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
+		printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pcila)));
+		printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pciha)));
+	}
+	printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
+	printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
+	printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
+	printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
+
+#endif
+
+	/* added for IBM boot rom version 1.15 bios bar changes  -AK */
+
+	/* Disable region first */
+	out_le32((void *) &(pcip->pmm[0].ma), 0x00000000);
+	/* PLB starting addr, PCI: 0x80000000 */
+	out_le32((void *) &(pcip->pmm[0].la), 0x80000000);
+	/* PCI start addr, 0x80000000 */
+	out_le32((void *) &(pcip->pmm[0].pcila), PPC405_PCI_MEM_BASE);
+	/* 512MB range of PLB to PCI */
+	out_le32((void *) &(pcip->pmm[0].pciha), 0x00000000);
+	/* Enable no pre-fetch, enable region */
+	out_le32((void *) &(pcip->pmm[0].ma), ((0xffffffff -
+						(PPC405_PCI_UPPER_MEM -
+						 PPC405_PCI_MEM_BASE)) | 0x01));
+
+	/* Disable region one */
+	out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
+	out_le32((void *) &(pcip->pmm[1].la), 0x00000000);
+	out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000);
+	out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000);
+	out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
+	out_le32((void *) &(pcip->ptm1ms), 0x00000001);
+
+	/* Disable region two */
+	out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
+	out_le32((void *) &(pcip->pmm[2].la), 0x00000000);
+	out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000);
+	out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000);
+	out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
+	out_le32((void *) &(pcip->ptm2ms), 0x00000000);
+	out_le32((void *) &(pcip->ptm2la), 0x00000000);
+
+	/* Zero config bars */
+	for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
+		early_write_config_dword(hose, hose->first_busno,
+					 PCI_FUNC(hose->first_busno), bar,
+					 0x00000000);
+		early_read_config_dword(hose, hose->first_busno,
+					PCI_FUNC(hose->first_busno), bar,
+					&bar_response);
+		DBG("BUS %d, device %d, Function %d bar 0x%8.8x is 0x%8.8x\n",
+		    hose->first_busno, PCI_SLOT(hose->first_busno),
+		    PCI_FUNC(hose->first_busno), bar, bar_response);
+	}
+	/* end work arround */
+
+#ifdef DEBUG
+	printk("PCI bridge regs after fixup \n");
+	for (i = 0; i <= 3; i++) {
+		printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].ma)));
+		printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].la)));
+		printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pcila)));
+		printk(" pmm%dma\t0x%x\n", i, in_le32(&(pcip->pmm[i].pciha)));
+	}
+	printk(" ptm1ms\t0x%x\n", in_le32(&(pcip->ptm1ms)));
+	printk(" ptm1la\t0x%x\n", in_le32(&(pcip->ptm1la)));
+	printk(" ptm2ms\t0x%x\n", in_le32(&(pcip->ptm2ms)));
+	printk(" ptm2la\t0x%x\n", in_le32(&(pcip->ptm2la)));
+
+#endif
+}
+
+void __init
+bubinga_setup_arch(void)
+{
+	ppc4xx_setup_arch();
+
+	ibm_ocp_set_emac(0, 1);
+
+        bubinga_early_serial_map();
+
+        /* RTC step for the evb405ep */
+        bubinga_rtc_base = (void *) BUBINGA_RTC_VADDR;
+        TODC_INIT(TODC_TYPE_DS1743, bubinga_rtc_base, bubinga_rtc_base,
+                  bubinga_rtc_base, 8);
+        /* Identify the system */
+        printk("IBM Bubinga port (MontaVista Software, Inc. <source@mvista.com>)\n");
+}
+
+void __init
+bubinga_map_io(void)
+{
+	ppc4xx_map_io();
+     	io_block_mapping(BUBINGA_RTC_VADDR,
+                         BUBINGA_RTC_PADDR, BUBINGA_RTC_SIZE, _PAGE_IO);
+}
+
+void __init
+platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+	      unsigned long r6, unsigned long r7)
+{
+	ppc4xx_init(r3, r4, r5, r6, r7);
+
+	ppc_md.setup_arch = bubinga_setup_arch;
+	ppc_md.setup_io_mappings = bubinga_map_io;
+
+#ifdef CONFIG_GEN_RTC
+	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;
+#endif
+#ifdef CONFIG_KGDB
+	ppc_md.early_serial_map = bubinga_early_serial_map;
+#endif
+}
+
diff -Nru a/arch/ppc/platforms/4xx/bubinga.h b/arch/ppc/platforms/4xx/bubinga.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/platforms/4xx/bubinga.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,69 @@
+/*
+ * Support for IBM PPC 405EP evaluation board (Bubinga).
+ *
+ * Author: SAW (IBM), derived from walnut.h.
+ *         Maintained by MontaVista Software <source@mvista.com>
+ *
+ * 2003 (c) MontaVista Softare 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.
+ */
+
+#ifdef __KERNEL__
+#ifndef __BUBINGA_H__
+#define __BUBINGA_H__
+
+/* 405EP */
+#include <platforms/4xx/ibm405ep.h>
+
+#ifndef __ASSEMBLY__
+/*
+ * Data structure defining board information maintained by the boot
+ * ROM on IBM's evaluation board. An effort has been made to
+ * keep the field names consistent with the 8xx 'bd_t' board info
+ * structures.
+ */
+
+typedef struct board_info {
+        unsigned char    bi_s_version[4];       /* Version of this structure */
+        unsigned char    bi_r_version[30];      /* Version of the IBM ROM */
+        unsigned int     bi_memsize;            /* DRAM installed, in bytes */
+        unsigned char    bi_enetaddr[2][6];     /* Local Ethernet MAC address */        unsigned char    bi_pci_enetaddr[6];    /* PCI Ethernet MAC address */
+        unsigned int     bi_intfreq;            /* Processor speed, in Hz */
+        unsigned int     bi_busfreq;            /* PLB Bus speed, in Hz */
+        unsigned int     bi_pci_busfreq;        /* PCI Bus speed, in Hz */
+        unsigned int     bi_opb_busfreq;        /* OPB Bus speed, in Hz */
+        unsigned int     bi_pllouta_freq;       /* PLL OUTA speed, in Hz */
+} bd_t;
+
+/* Some 4xx parts use a different timebase frequency from the internal clock.
+*/
+#define bi_tbfreq bi_intfreq
+
+
+/* Memory map for the Bubinga board.
+ * Generic 4xx plus RTC.
+ */
+
+extern void *bubinga_rtc_base;
+#define BUBINGA_RTC_PADDR	((uint)0xf0000000)
+#define BUBINGA_RTC_VADDR	BUBINGA_RTC_PADDR
+#define BUBINGA_RTC_SIZE	((uint)8*1024)
+
+/* The UART clock is based off an internal clock -
+ * define BASE_BAUD based on the internal clock and divider(s).
+ * Since BASE_BAUD must be a constant, we will initialize it
+ * using clock/divider values which OpenBIOS initializes
+ * for typical configurations at various CPU speeds.
+ * The base baud is calculated as (FWDA / EXT UART DIV / 16)
+ */
+#define BASE_BAUD       0
+
+#define BUBINGA_FPGA_BASE      0xF0300000
+
+#define PPC4xx_MACHINE_NAME     "IBM Bubinga"
+
+#endif /* !__ASSEMBLY__ */
+#endif /* __BUBINGA_H__ */
+#endif /* __KERNEL__ */
diff -Nru a/arch/ppc/platforms/4xx/cpci405.c b/arch/ppc/platforms/4xx/cpci405.c
--- a/arch/ppc/platforms/4xx/cpci405.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc/platforms/4xx/cpci405.c	Tue Jun 15 22:20:43 2004
@@ -22,6 +22,7 @@
 #include <asm/pci-bridge.h>
 #include <asm/machdep.h>
 #include <asm/todc.h>
+#include <asm/ocp.h>
 
 void *cpci405_nvram;
 
@@ -53,6 +54,9 @@
 cpci405_setup_arch(void)
 {
 	ppc4xx_setup_arch();
+
+	ibm_ocp_set_emac(0, 0);
+
 	TODC_INIT(TODC_TYPE_MK48T35, cpci405_nvram, cpci405_nvram, cpci405_nvram, 8);
 }
 
diff -Nru a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
--- a/arch/ppc/platforms/4xx/ebony.c	Tue Jun 15 22:21:05 2004
+++ b/arch/ppc/platforms/4xx/ebony.c	Tue Jun 15 22:21:05 2004
@@ -41,6 +41,7 @@
 #include <asm/dma.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
+#include <asm/ocp.h>
 #include <asm/pci-bridge.h>
 #include <asm/time.h>
 #include <asm/todc.h>
@@ -119,9 +120,6 @@
 
 extern void abort(void);
 
-/* Global Variables */
-bd_t __res;
-
 static void __init
 ebony_calibrate_decr(void)
 {
@@ -308,7 +306,9 @@
 ebony_setup_arch(void)
 {
 	unsigned char * vpd_base;
-	struct ibm440gp_clocks clocks;
+	struct ibm44x_clocks clocks;
+	struct ocp_def *def;
+	struct ocp_func_emac_data *emacdata;
 
 #if !defined(CONFIG_BDI_SWITCH)
 	/*
@@ -318,10 +318,15 @@
         mtspr(SPRN_DBCR0, (DBCR0_TDE | DBCR0_IDM));
 #endif
 
-	/* Retrieve MAC addresses */
+	/* Set mac_addr for each EMAC */
 	vpd_base = ioremap64(EBONY_VPD_BASE, EBONY_VPD_SIZE);
-	memcpy(__res.bi_enetaddr[0],EBONY_NA0_ADDR(vpd_base),6);
-	memcpy(__res.bi_enetaddr[1],EBONY_NA1_ADDR(vpd_base),6);
+	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);
+	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);
 
 	/*
 	 * Determine various clocks.
@@ -330,10 +335,7 @@
 	 * --ebs
 	 */
 	ibm440gp_get_clocks(&clocks, 33333333, 6 * 1843200);
-	__res.bi_opb_busfreq = clocks.opb;
-
-	/* Use IIC in standard (100 kHz) mode */
-	__res.bi_iic_fast[0] = __res.bi_iic_fast[1] = 0;
+	ocp_sys_info.opb_bus_freq = clocks.opb;
 
 	/* Setup TODC access */
 	TODC_INIT(TODC_TYPE_DS1743,
diff -Nru a/arch/ppc/platforms/4xx/ebony.h b/arch/ppc/platforms/4xx/ebony.h
--- a/arch/ppc/platforms/4xx/ebony.h	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc/platforms/4xx/ebony.h	Tue Jun 15 22:20:43 2004
@@ -65,8 +65,6 @@
 #define UART1_IO_BASE	(u8 *) 0xE0000300
 
 #define BASE_BAUD	33000000/3/16
-#define UART0_INT	0
-#define UART1_INT	1
 
 #define STD_UART_OP(num)					\
 	{ 0, BASE_BAUD, 0, UART##num##_INT,			\
diff -Nru a/arch/ppc/platforms/4xx/ep405.c b/arch/ppc/platforms/4xx/ep405.c
--- a/arch/ppc/platforms/4xx/ep405.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/platforms/4xx/ep405.c	Tue Jun 15 22:20:37 2004
@@ -18,6 +18,7 @@
 #include <asm/pci-bridge.h>
 #include <asm/machdep.h>
 #include <asm/todc.h>
+#include <asm/ocp.h>
 #include <asm/ibm_ocp_pci.h>
 
 #undef DEBUG
@@ -58,6 +59,8 @@
 ep405_setup_arch(void)
 {
 	ppc4xx_setup_arch();
+
+	ibm_ocp_set_emac(0, 0);
 
 	if (__res.bi_nvramsize == 512*1024) {
 		/* FIXME: we should properly handle NVRTCs of different sizes */
diff -Nru a/arch/ppc/platforms/4xx/ibm405ep.c b/arch/ppc/platforms/4xx/ibm405ep.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/platforms/4xx/ibm405ep.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,134 @@
+/*
+ * arch/ppc/platforms/ibm405ep.c
+ *
+ * Support for IBM PPC 405EP processors.
+ *
+ * Author: SAW (IBM), derived from ibmnp405l.c.
+ *         Maintained by MontaVista Software <source@mvista.com>
+ *
+ * 2003 (c) MontaVista Softare 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/config.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/threads.h>
+#include <linux/param.h>
+#include <linux/string.h>
+
+#include <asm/ibm4xx.h>
+#include <asm/ocp.h>
+
+#include <platforms/4xx/ibm405ep.h>
+
+static struct ocp_func_mal_data ibm405ep_mal0_def = {
+	.num_tx_chans	= 4,		/* Number of TX channels */
+	.num_rx_chans	= 2,		/* Number of RX channels */
+	.txeob_irq	= 11,		/* TX End Of Buffer IRQ  */
+	.rxeob_irq	= 12,		/* RX End Of Buffer IRQ  */
+	.txde_irq	= 13,		/* TX Descriptor Error IRQ */
+	.rxde_irq	= 14,		/* RX Descriptor Error IRQ */
+	.serr_irq	= 10,		/* MAL System Error IRQ    */
+};
+OCP_SYSFS_MAL_DATA()
+
+static struct ocp_func_emac_data ibm405ep_emac0_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx	= -1,		/* ZMII device index */
+	.zmii_mux	= 0,		/* ZMII input of this EMAC */
+	.mal_idx	= 0,		/* MAL device index */
+	.mal_rx_chan	= 0,		/* MAL rx channel number */
+	.mal_tx_chan	= 0,		/* MAL tx channel number */
+	.wol_irq	= 9,		/* WOL interrupt number */
+	.mdio_idx	= 0,		/* MDIO via EMAC0 */
+	.tah_idx	= -1,		/* No TAH */
+};
+
+static struct ocp_func_emac_data ibm405ep_emac1_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx	= -1,		/* ZMII device index */
+	.zmii_mux	= 0,		/* ZMII input of this EMAC */
+	.mal_idx	= 0,		/* MAL device index */
+	.mal_rx_chan	= 1,		/* MAL rx channel number */
+	.mal_tx_chan	= 2,		/* MAL tx channel number */
+	.wol_irq	= 9,		/* WOL interrupt number */
+	.mdio_idx	= 0,		/* MDIO via EMAC0 */
+	.tah_idx	= -1,		/* No TAH */
+};
+OCP_SYSFS_EMAC_DATA()
+
+static struct ocp_func_iic_data ibm405ep_iic0_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+OCP_SYSFS_IIC_DATA()
+
+struct ocp_def core_ocp[] = {
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_OPB,
+	  .index	= 0,
+	  .paddr	= 0xEF600000,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 0,
+	  .paddr	= UART0_IO_BASE,
+	  .irq		= UART0_INT,
+	  .pm		= IBM_CPM_UART0
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 1,
+	  .paddr	= UART1_IO_BASE,
+	  .irq		= UART1_INT,
+	  .pm		= IBM_CPM_UART1
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .paddr	= 0xEF600500,
+	  .irq		= 2,
+	  .pm		= IBM_CPM_IIC0,
+	  .additions	= &ibm405ep_iic0_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_GPIO,
+	  .paddr	= 0xEF600700,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= IBM_CPM_GPIO0
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_MAL,
+	  .paddr	= OCP_PADDR_NA,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm405ep_mal0_def,
+	  .show		= &ocp_show_mal_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 0,
+	  .paddr	= EMAC0_BASE,
+	  .irq		= 15,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm405ep_emac0_def,
+	  .show		= &ocp_show_emac_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 1,
+	  .paddr	= 0xEF600900,
+	  .irq		= 17,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm405ep_emac1_def,
+	  .show		= &ocp_show_emac_data
+	},
+	{ .vendor	= OCP_VENDOR_INVALID
+	}
+};
diff -Nru a/arch/ppc/platforms/4xx/ibm405ep.h b/arch/ppc/platforms/4xx/ibm405ep.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/platforms/4xx/ibm405ep.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,148 @@
+/*
+ * arch/ppc/platforms/4xx/ibm405ep.h
+ *
+ * IBM PPC 405EP processor defines.
+ *
+ * Author: SAW (IBM), derived from ibm405gp.h.
+ *         Maintained by MontaVista Software <source@mvista.com>
+ *
+ * 2003 (c) MontaVista Softare 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.
+ */
+
+#ifdef __KERNEL__
+#ifndef __ASM_IBM405EP_H__
+#define __ASM_IBM405EP_H__
+
+#include <linux/config.h>
+
+/* ibm405.h at bottom of this file */
+
+/* PCI
+ * PCI Bridge config reg definitions
+ * see 17-19 of manual
+ */
+
+#define PPC405_PCI_CONFIG_ADDR	0xeec00000
+#define PPC405_PCI_CONFIG_DATA	0xeec00004
+
+#define PPC405_PCI_PHY_MEM_BASE	0x80000000	/* hose_a->pci_mem_offset */
+						/* setbat */
+#define PPC405_PCI_MEM_BASE	PPC405_PCI_PHY_MEM_BASE	/* setbat */
+#define PPC405_PCI_PHY_IO_BASE	0xe8000000	/* setbat */
+#define PPC405_PCI_IO_BASE	PPC405_PCI_PHY_IO_BASE	/* setbat */
+
+#define PPC405_PCI_LOWER_MEM	0x80000000	/* hose_a->mem_space.start */
+#define PPC405_PCI_UPPER_MEM	0xBfffffff	/* hose_a->mem_space.end */
+#define PPC405_PCI_LOWER_IO	0x00000000	/* hose_a->io_space.start */
+#define PPC405_PCI_UPPER_IO	0x0000ffff	/* hose_a->io_space.end */
+
+#define PPC405_ISA_IO_BASE	PPC405_PCI_IO_BASE
+
+#define PPC4xx_PCI_IO_PADDR	((uint)PPC405_PCI_PHY_IO_BASE)
+#define PPC4xx_PCI_IO_VADDR	PPC4xx_PCI_IO_PADDR
+#define PPC4xx_PCI_IO_SIZE	((uint)64*1024)
+#define PPC4xx_PCI_CFG_PADDR	((uint)PPC405_PCI_CONFIG_ADDR)
+#define PPC4xx_PCI_CFG_VADDR	PPC4xx_PCI_CFG_PADDR
+#define PPC4xx_PCI_CFG_SIZE	((uint)4*1024)
+#define PPC4xx_PCI_LCFG_PADDR	((uint)0xef400000)
+#define PPC4xx_PCI_LCFG_VADDR	PPC4xx_PCI_LCFG_PADDR
+#define PPC4xx_PCI_LCFG_SIZE	((uint)4*1024)
+#define PPC4xx_ONB_IO_PADDR	((uint)0xef600000)
+#define PPC4xx_ONB_IO_VADDR	PPC4xx_ONB_IO_PADDR
+#define PPC4xx_ONB_IO_SIZE	((uint)4*1024)
+
+/* serial port defines */
+#define RS_TABLE_SIZE	2
+
+#define UART0_INT	0
+#define UART1_INT	1
+
+#define PCIL0_BASE	0xEF400000
+#define UART0_IO_BASE	0xEF600300
+#define UART1_IO_BASE	0xEF600400
+#define EMAC0_BASE	0xEF600800
+
+#define BD_EMAC_ADDR(e,i) bi_enetaddr[e][i]
+
+#if defined(CONFIG_UART0_TTYS0)
+#define ACTING_UART0_IO_BASE	UART0_IO_BASE
+#define ACTING_UART1_IO_BASE	UART1_IO_BASE
+#define ACTING_UART0_INT	UART0_INT
+#define ACTING_UART1_INT	UART1_INT
+#else
+#define ACTING_UART0_IO_BASE	UART1_IO_BASE
+#define ACTING_UART1_IO_BASE	UART0_IO_BASE
+#define ACTING_UART0_INT	UART1_INT
+#define ACTING_UART1_INT	UART0_INT
+#endif
+
+#define STD_UART_OP(num)					\
+	{ 0, BASE_BAUD, 0, ACTING_UART##num##_INT,			\
+		(ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST),	\
+		iomem_base: (u8 *)ACTING_UART##num##_IO_BASE,		\
+		io_type: SERIAL_IO_MEM},
+
+#define SERIAL_DEBUG_IO_BASE	ACTING_UART0_IO_BASE
+#define SERIAL_PORT_DFNS	\
+	STD_UART_OP(0)		\
+	STD_UART_OP(1)
+
+/* DCR defines */
+#define DCRN_CPMSR_BASE         0x0BA
+#define DCRN_CPMFR_BASE         0x0B9
+
+#define DCRN_CPC0_PLLMR0_BASE   0x0F0
+#define DCRN_CPC0_BOOT_BASE     0x0F1
+#define DCRN_CPC0_CR1_BASE      0x0F2
+#define DCRN_CPC0_EPRCSR_BASE   0x0F3
+#define DCRN_CPC0_PLLMR1_BASE   0x0F4
+#define DCRN_CPC0_UCR_BASE      0x0F5
+#define DCRN_CPC0_UCR_U0DIV     0x07F
+#define DCRN_CPC0_SRR_BASE      0x0F6
+#define DCRN_CPC0_JTAGID_BASE   0x0F7
+#define DCRN_CPC0_SPARE_BASE    0x0F8
+#define DCRN_CPC0_PCI_BASE      0x0F9
+
+
+#define IBM_CPM_GPT             0x80000000      /* GPT interface */
+#define IBM_CPM_PCI             0x40000000      /* PCI bridge */
+#define IBM_CPM_UIC             0x00010000      /* Universal Int Controller */
+#define IBM_CPM_CPU             0x00008000      /* processor core */
+#define IBM_CPM_EBC             0x00002000      /* EBC controller */
+#define IBM_CPM_SDRAM0          0x00004000      /* SDRAM memory controller */
+#define IBM_CPM_GPIO0           0x00001000      /* General Purpose IO */
+#define IBM_CPM_TMRCLK          0x00000400      /* CPU timers */
+#define IBM_CPM_PLB             0x00000100      /* PLB bus arbiter */
+#define IBM_CPM_OPB             0x00000080      /* PLB to OPB bridge */
+#define IBM_CPM_DMA             0x00000040      /* DMA controller */
+#define IBM_CPM_IIC0            0x00000010      /* IIC interface */
+#define IBM_CPM_UART1           0x00000002      /* serial port 0 */
+#define IBM_CPM_UART0           0x00000001      /* serial port 1 */
+#define DFLT_IBM4xx_PM          ~(IBM_CPM_PCI | IBM_CPM_CPU | IBM_CPM_DMA \
+                                        | IBM_CPM_OPB | IBM_CPM_EBC \
+                                        | IBM_CPM_SDRAM0 | IBM_CPM_PLB \
+                                        | IBM_CPM_UIC | IBM_CPM_TMRCLK)
+#define DCRN_DMA0_BASE          0x100
+#define DCRN_DMA1_BASE          0x108
+#define DCRN_DMA2_BASE          0x110
+#define DCRN_DMA3_BASE          0x118
+#define DCRNCAP_DMA_SG          1       /* have DMA scatter/gather capability */
+#define DCRN_DMASR_BASE         0x120
+#define DCRN_EBC_BASE           0x012
+#define DCRN_DCP0_BASE          0x014
+#define DCRN_MAL_BASE           0x180
+#define DCRN_OCM0_BASE          0x018
+#define DCRN_PLB0_BASE          0x084
+#define DCRN_PLLMR_BASE         0x0B0
+#define DCRN_POB0_BASE          0x0A0
+#define DCRN_SDRAM0_BASE        0x010
+#define DCRN_UIC0_BASE          0x0C0
+#define UIC0 DCRN_UIC0_BASE
+
+#include <asm/ibm405.h>
+
+#endif				/* __ASM_IBM405EP_H__ */
+#endif				/* __KERNEL__ */
diff -Nru a/arch/ppc/platforms/4xx/ibm405gp.c b/arch/ppc/platforms/4xx/ibm405gp.c
--- a/arch/ppc/platforms/4xx/ibm405gp.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/platforms/4xx/ibm405gp.c	Tue Jun 15 22:20:41 2004
@@ -1,26 +1,111 @@
 /*
- * arch/ppc/platforms/4xx/ibm405gp.c
  *
- * Author: Armin Kuster <akuster@mvista.com>
+ *    Copyright 2000-2001 MontaVista Software Inc.
+ *      Original author: Armin Kuster akuster@mvista.com
+ *
+ *    Module name: ibm405gp.c
+ *
+ *
+ * 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.
  *
- * 2001 (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/config.h>
 #include <linux/init.h>
-#include <asm/ocp.h>
+#include <linux/smp.h>
+#include <linux/threads.h>
+#include <linux/param.h>
+#include <linux/string.h>
 #include <platforms/4xx/ibm405gp.h>
+#include <asm/ibm4xx.h>
+#include <asm/ocp.h>
+
+static struct ocp_func_emac_data ibm405gp_emac0_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx	= -1,		/* ZMII device index */
+	.zmii_mux	= 0,		/* ZMII input of this EMAC */
+	.mal_idx	= 0,		/* MAL device index */
+	.mal_rx_chan	= 0,		/* MAL rx channel number */
+	.mal_tx_chan	= 0,		/* MAL tx channel number */
+	.wol_irq	= 9,		/* WOL interrupt number */
+	.mdio_idx	= -1,		/* No shared MDIO */
+	.tah_idx	= -1,		/* No TAH */
+};
+OCP_SYSFS_EMAC_DATA()
+
+static struct ocp_func_mal_data ibm405gp_mal0_def = {
+	.num_tx_chans	= 1,		/* Number of TX channels */
+	.num_rx_chans	= 1,		/* Number of RX channels */
+	.txeob_irq	= 11,		/* TX End Of Buffer IRQ  */
+	.rxeob_irq	= 12,		/* RX End Of Buffer IRQ  */
+	.txde_irq	= 13,		/* TX Descriptor Error IRQ */
+	.rxde_irq	= 14,		/* RX Descriptor Error IRQ */
+	.serr_irq	= 10,		/* MAL System Error IRQ    */
+};
+OCP_SYSFS_MAL_DATA()
 
-struct ocp_def core_ocp[]  __initdata = {
-	{OCP_VENDOR_IBM, OCP_FUNC_OPB, OPB_BASE_START, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART0_IO_BASE, UART0_INT,IBM_CPM_UART0},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART1_IO_BASE, UART1_INT, IBM_CPM_UART1},
-	{OCP_VENDOR_IBM, OCP_FUNC_IIC, IIC0_BASE, IIC0_IRQ, IBM_CPM_IIC0},
-	{OCP_VENDOR_IBM, OCP_FUNC_GPIO, GPIO0_BASE, OCP_IRQ_NA, IBM_CPM_GPIO0},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, EMAC0_BASE, BL_MAC_ETH0, IBM_CPM_EMAC0},
-	{OCP_VENDOR_INVALID, OCP_FUNC_INVALID, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
+static struct ocp_func_iic_data ibm405gp_iic0_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+OCP_SYSFS_IIC_DATA()
 
+struct ocp_def core_ocp[] = {
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_OPB,
+	  .index	= 0,
+	  .paddr	= 0xEF600000,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 0,
+	  .paddr	= UART0_IO_BASE,
+	  .irq		= UART0_INT,
+	  .pm		= IBM_CPM_UART0
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 1,
+	  .paddr	= UART1_IO_BASE,
+	  .irq		= UART1_INT,
+	  .pm		= IBM_CPM_UART1
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .paddr	= 0xEF600500,
+	  .irq		= 2,
+	  .pm		= IBM_CPM_IIC0,
+	  .additions	= &ibm405gp_iic0_def,
+	  .show		= &ocp_show_iic_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_GPIO,
+	  .paddr	= 0xEF600700,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= IBM_CPM_GPIO0
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_MAL,
+	  .paddr	= OCP_PADDR_NA,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm405gp_mal0_def,
+	  .show		= &ocp_show_mal_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 0,
+	  .paddr	= EMAC0_BASE,
+	  .irq		= 15,
+	  .pm		= IBM_CPM_EMAC0,
+	  .additions	= &ibm405gp_emac0_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_INVALID
+	}
 };
diff -Nru a/arch/ppc/platforms/4xx/ibm405gp.h b/arch/ppc/platforms/4xx/ibm405gp.h
--- a/arch/ppc/platforms/4xx/ibm405gp.h	Tue Jun 15 22:20:35 2004
+++ b/arch/ppc/platforms/4xx/ibm405gp.h	Tue Jun 15 22:20:35 2004
@@ -51,9 +51,6 @@
 #define PPC4xx_ONB_IO_VADDR	PPC4xx_ONB_IO_PADDR
 #define PPC4xx_ONB_IO_SIZE	((uint)4*1024)
 
-#define OPB_BASE_START	0x40000000
-#define EBIU_BASE_START	0xF0100000
-
 /* serial port defines */
 #define RS_TABLE_SIZE	2
 
@@ -63,24 +60,8 @@
 #define PCIL0_BASE	0xEF400000
 #define UART0_IO_BASE	0xEF600300
 #define UART1_IO_BASE	0xEF600400
-#define IIC0_BASE	0xEF600500
-#define OPB0_BASE	0xEF600600
-#define GPIO0_BASE	0xEF600700
 #define EMAC0_BASE	0xEF600800
-#define BL_MAC_WOL	9	/* WOL */
-#define BL_MAL_SERR	10	/* MAL SERR */
-#define BL_MAL_TXDE	13	/* MAL TXDE */
-#define BL_MAL_RXDE	14	/* MAL RXDE */
-#define BL_MAL_TXEOB	11	/* MAL TX EOB */
-#define BL_MAL_RXEOB	12	/* MAL RX EOB */
-#define BL_MAC_ETH0	15	/* MAC */
-
-#define EMAC_NUMS	1
-#define IIC0_IRQ	2
-#define IIC1_IRQ	0
 
-#define IIC_OWN		0x55
-#define IIC_CLOCK	50
 #define BD_EMAC_ADDR(e,i) bi_enetaddr[i]
 
 #define STD_UART_OP(num)					\
diff -Nru a/arch/ppc/platforms/4xx/ibm405gpr.c b/arch/ppc/platforms/4xx/ibm405gpr.c
--- a/arch/ppc/platforms/4xx/ibm405gpr.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc/platforms/4xx/ibm405gpr.c	Tue Jun 15 22:20:42 2004
@@ -11,17 +11,98 @@
 
 #include <linux/config.h>
 #include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/threads.h>
+#include <linux/param.h>
+#include <linux/string.h>
+#include <platforms/4xx/ibm405gpr.h>
+#include <asm/ibm4xx.h>
 #include <asm/ocp.h>
 
-#include "ibm405gpr.h"
+static struct ocp_func_emac_data ibm405gpr_emac0_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx	= -1,		/* ZMII device index */
+	.zmii_mux	= 0,		/* ZMII input of this EMAC */
+	.mal_idx	= 0,		/* MAL device index */
+	.mal_rx_chan	= 0,		/* MAL rx channel number */
+	.mal_tx_chan	= 0,		/* MAL tx channel number */
+	.wol_irq	= 9,		/* WOL interrupt number */
+	.mdio_idx	= -1,		/* No shared MDIO */
+	.tah_idx	= -1,		/* No TAH */
+};
+OCP_SYSFS_EMAC_DATA()
 
-struct ocp_def core_ocp[]  __initdata = {
-	{OCP_VENDOR_IBM, OCP_FUNC_OPB, OPB_BASE_START, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART0_IO_BASE, UART0_INT,IBM_CPM_UART0},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART1_IO_BASE, UART1_INT, IBM_CPM_UART1},
-	{OCP_VENDOR_IBM, OCP_FUNC_IIC, IIC0_BASE, IIC0_IRQ, IBM_CPM_IIC0},
-	{OCP_VENDOR_IBM, OCP_FUNC_GPIO, GPIO0_BASE, OCP_IRQ_NA, IBM_CPM_GPIO0},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, EMAC0_BASE, BL_MAC_ETH0, IBM_CPM_EMAC0},
-	{OCP_VENDOR_INVALID, OCP_FUNC_INVALID, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
+static struct ocp_func_mal_data ibm405gpr_mal0_def = {
+	.num_tx_chans	= 1,		/* Number of TX channels */
+	.num_rx_chans	= 1,		/* Number of RX channels */
+	.txeob_irq	= 11,		/* TX End Of Buffer IRQ  */
+	.rxeob_irq	= 12,		/* RX End Of Buffer IRQ  */
+	.txde_irq	= 13,		/* TX Descriptor Error IRQ */
+	.rxde_irq	= 14,		/* RX Descriptor Error IRQ */
+	.serr_irq	= 10,		/* MAL System Error IRQ    */
+};
+OCP_SYSFS_MAL_DATA()
 
+static struct ocp_func_iic_data ibm405gpr_iic0_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+
+OCP_SYSFS_IIC_DATA()
+
+struct ocp_def core_ocp[] = {
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_OPB,
+	  .index	= 0,
+	  .paddr	= 0xEF600000,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 0,
+	  .paddr	= UART0_IO_BASE,
+	  .irq		= UART0_INT,
+	  .pm		= IBM_CPM_UART0
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 1,
+	  .paddr	= UART1_IO_BASE,
+	  .irq		= UART1_INT,
+	  .pm		= IBM_CPM_UART1
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .paddr	= 0xEF600500,
+	  .irq		= 2,
+	  .pm		= IBM_CPM_IIC0,
+	  .additions	= &ibm405gpr_iic0_def,
+	  .show		= &ocp_show_iic_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_GPIO,
+	  .paddr	= 0xEF600700,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= IBM_CPM_GPIO0
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_MAL,
+	  .paddr	= OCP_PADDR_NA,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm405gpr_mal0_def,
+	  .show		= &ocp_show_mal_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 0,
+	  .paddr	= EMAC0_BASE,
+	  .irq		= 15,
+	  .pm		= IBM_CPM_EMAC0,
+	  .additions	= &ibm405gpr_emac0_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_INVALID
+	}
 };
diff -Nru a/arch/ppc/platforms/4xx/ibm405gpr.h b/arch/ppc/platforms/4xx/ibm405gpr.h
--- a/arch/ppc/platforms/4xx/ibm405gpr.h	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/platforms/4xx/ibm405gpr.h	Tue Jun 15 22:20:41 2004
@@ -51,9 +51,6 @@
 #define PPC4xx_ONB_IO_VADDR	PPC4xx_ONB_IO_PADDR
 #define PPC4xx_ONB_IO_SIZE	((uint)4*1024)
 
-#define OPB_BASE_START	0x40000000
-#define EBIU_BASE_START	0xF0100000
-
 /* serial port defines */
 #define RS_TABLE_SIZE	2
 
@@ -63,20 +60,8 @@
 #define PCIL0_BASE	0xEF400000
 #define UART0_IO_BASE	0xEF600300
 #define UART1_IO_BASE	0xEF600400
-#define IIC0_BASE	0xEF600500
-#define OPB0_BASE	0xEF600600
-#define GPIO0_BASE	0xEF600700
 #define EMAC0_BASE	0xEF600800
-#define BL_MAC_WOL	9	/* WOL */
-#define BL_MAL_SERR	10	/* MAL SERR */
-#define BL_MAL_TXDE	13	/* MAL TXDE */
-#define BL_MAL_RXDE	14	/* MAL RXDE */
-#define BL_MAL_TXEOB	11	/* MAL TX EOB */
-#define BL_MAL_RXEOB	12	/* MAL RX EOB */
-#define BL_MAC_ETH0	15	/* MAC */
 
-#define IIC_OWN		0x55
-#define IIC_CLOCK	50
 #define BD_EMAC_ADDR(e,i) bi_enetaddr[i]
 
 #define STD_UART_OP(num)					\
diff -Nru a/arch/ppc/platforms/4xx/ibm440gp.c b/arch/ppc/platforms/4xx/ibm440gp.c
--- a/arch/ppc/platforms/4xx/ibm440gp.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc/platforms/4xx/ibm440gp.c	Tue Jun 15 22:20:42 2004
@@ -4,8 +4,10 @@
  * PPC440GP I/O descriptions
  *
  * Matt Porter <mporter@mvista.com>
+ * Copyright 2002-2004 MontaVista Software Inc.
  *
- * Copyright 2002 MontaVista Software Inc.
+ * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
+ * Copyright (c) 2003, 2004 Zultys Technologies
  *
  * 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
@@ -13,19 +15,137 @@
  * option) any later version.
  *
  */
+#include <linux/init.h>
+#include <linux/module.h>
 #include <platforms/4xx/ibm440gp.h>
 #include <asm/ocp.h>
-#include <linux/init.h>
 
-struct ocp_def core_ocp[] __initdata = {
-	{OCP_VENDOR_IBM, OCP_FUNC_OPB, PPC440GP_OPB_BASE_START, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, PPC440GP_UART0_ADDR, UART0_INT, IBM_CPM_UART0},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, PPC440GP_UART1_ADDR, UART1_INT, IBM_CPM_UART1},
-	{OCP_VENDOR_IBM, OCP_FUNC_IIC, PPC440GP_IIC0_ADDR, IIC0_IRQ, IBM_CPM_IIC0},
-	{OCP_VENDOR_IBM, OCP_FUNC_IIC, PPC440GP_IIC1_ADDR, IIC1_IRQ, IBM_CPM_IIC1},
-	{OCP_VENDOR_IBM, OCP_FUNC_GPIO, PPC440GP_GPIO0_ADDR, OCP_IRQ_NA, IBM_CPM_GPIO0},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, PPC440GP_EMAC0_ADDR, BL_MAC_ETH0, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, PPC440GP_EMAC1_ADDR, BL_MAC_ETH1, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_ZMII, PPC440GP_ZMII_ADDR, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_INVALID, OCP_FUNC_INVALID, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
+static struct ocp_func_emac_data ibm440gp_emac0_def = {
+	.rgmii_idx	= -1,           /* No RGMII */
+	.rgmii_mux	= -1,           /* No RGMII */
+	.zmii_idx       = 0,            /* ZMII device index */
+	.zmii_mux       = 0,            /* ZMII input of this EMAC */
+	.mal_idx        = 0,            /* MAL device index */
+	.mal_rx_chan    = 0,            /* MAL rx channel number */
+	.mal_tx_chan    = 0,            /* MAL tx channel number */
+	.wol_irq        = 61,		/* WOL interrupt number */
+	.mdio_idx       = -1,           /* No shared MDIO */
+	.tah_idx	= -1,           /* No TAH */
+};
+
+static struct ocp_func_emac_data ibm440gp_emac1_def = {
+	.rgmii_idx	= -1,           /* No RGMII */
+	.rgmii_mux	= -1,           /* No RGMII */
+	.zmii_idx       = 0,            /* ZMII device index */
+	.zmii_mux       = 1,            /* ZMII input of this EMAC */
+	.mal_idx        = 0,            /* MAL device index */
+	.mal_rx_chan    = 1,            /* MAL rx channel number */
+	.mal_tx_chan    = 2,            /* MAL tx channel number */
+	.wol_irq        = 63,  		/* WOL interrupt number */
+	.mdio_idx       = -1,           /* No shared MDIO */
+	.tah_idx	= -1,           /* No TAH */
+};
+OCP_SYSFS_EMAC_DATA()
+
+static struct ocp_func_mal_data ibm440gp_mal0_def = {
+	.num_tx_chans   = 4,  		/* Number of TX channels */
+	.num_rx_chans   = 2,    	/* Number of RX channels */
+	.txeob_irq	= 10,		/* TX End Of Buffer IRQ  */
+	.rxeob_irq	= 11,		/* RX End Of Buffer IRQ  */
+	.txde_irq	= 33,		/* TX Descriptor Error IRQ */
+	.rxde_irq	= 34,		/* RX Descriptor Error IRQ */
+	.serr_irq	= 32,		/* MAL System Error IRQ    */
+};
+OCP_SYSFS_MAL_DATA()
+
+static struct ocp_func_iic_data ibm440gp_iic0_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+
+static struct ocp_func_iic_data ibm440gp_iic1_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+OCP_SYSFS_IIC_DATA()
+
+struct ocp_def core_ocp[] = {
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_OPB,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000000ULL,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 0,
+	  .paddr	= PPC440GP_UART0_ADDR,
+	  .irq		= UART0_INT,
+	  .pm		= IBM_CPM_UART0,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 1,
+	  .paddr	= PPC440GP_UART1_ADDR,
+	  .irq		= UART1_INT,
+	  .pm		= IBM_CPM_UART1,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000400ULL,
+	  .irq		= 2,
+	  .pm		= IBM_CPM_IIC0,
+	  .additions	= &ibm440gp_iic0_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .index	= 1,
+	  .paddr	= 0x0000000140000500ULL,
+	  .irq		= 3,
+	  .pm		= IBM_CPM_IIC1,
+	  .additions	= &ibm440gp_iic1_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_GPIO,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000700ULL,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= IBM_CPM_GPIO0,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_MAL,
+	  .paddr	= OCP_PADDR_NA,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm440gp_mal0_def,
+	  .show		= &ocp_show_mal_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000800ULL,
+	  .irq		= 60,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm440gp_emac0_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 1,
+	  .paddr	= 0x0000000140000900ULL,
+	  .irq		= 62,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm440gp_emac1_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_ZMII,
+	  .paddr	= 0x0000000140000780ULL,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_INVALID
+	}
 };
diff -Nru a/arch/ppc/platforms/4xx/ibm440gp.h b/arch/ppc/platforms/4xx/ibm440gp.h
--- a/arch/ppc/platforms/4xx/ibm440gp.h	Tue Jun 15 22:20:39 2004
+++ b/arch/ppc/platforms/4xx/ibm440gp.h	Tue Jun 15 22:20:39 2004
@@ -22,44 +22,11 @@
 
 #include <linux/config.h>
 
-#define EMAC_NUMS		2
-#define UART_NUMS		2
-#define ZMII_NUMS		1
-#define IIC_NUMS		2
-#define IIC0_IRQ		2
-#define IIC1_IRQ		3
-#define GPIO_NUMS		1
-
-/* UART location */
+/* UART */
 #define PPC440GP_UART0_ADDR	0x0000000140000200ULL
 #define PPC440GP_UART1_ADDR	0x0000000140000300ULL
-
-/* EMAC location */
-#define PPC440GP_EMAC0_ADDR	0x0000000140000800ULL
-#define PPC440GP_EMAC1_ADDR	0x0000000140000900ULL
-#define PPC440GP_EMAC_SIZE	0x70
-
-/* EMAC IRQ's */
-#define BL_MAC_WOL	61	/* WOL */
-#define BL_MAC_WOL1	63	/* WOL */
-#define BL_MAL_SERR	32	/* MAL SERR */
-#define BL_MAL_TXDE	33	/* MAL TXDE */
-#define BL_MAL_RXDE	34	/* MAL RXDE */
-#define BL_MAL_TXEOB	10	/* MAL TX EOB */
-#define BL_MAL_RXEOB	11	/* MAL RX EOB */
-#define BL_MAC_ETH0	60	/* MAC */
-#define BL_MAC_ETH1	62	/* MAC */
-
-/* ZMII location */
-#define PPC440GP_ZMII_ADDR	0x0000000140000780ULL
-#define PPC440GP_ZMII_SIZE	0x0c
-
-/* I2C location */
-#define PPC440GP_IIC0_ADDR	0x40000400
-#define PPC440GP_IIC1_ADDR	0x40000500
-
-/* GPIO location */
-#define PPC440GP_GPIO0_ADDR	0x0000000140000700ULL
+#define UART0_INT		0
+#define UART1_INT		1
 
 /* Clock and Power Management */
 #define IBM_CPM_IIC0		0x80000000	/* IIC interface */
@@ -87,9 +54,6 @@
 				| IBM_CPM_EBC | IBM_CPM_SRAM | IBM_CPM_BGO \
 				| IBM_CPM_EBM | IBM_CPM_PLB | IBM_CPM_OPB \
 				| IBM_CPM_TMRCLK | IBM_CPM_DMA | IBM_CPM_PCI)
-
-#define PPC440GP_OPB_BASE_START	0x0000000140000000ULL
-
 /*
  * Serial port defines
  */
diff -Nru a/arch/ppc/platforms/4xx/ibm440gx.c b/arch/ppc/platforms/4xx/ibm440gx.c
--- a/arch/ppc/platforms/4xx/ibm440gx.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/platforms/4xx/ibm440gx.c	Tue Jun 15 22:20:41 2004
@@ -1,11 +1,13 @@
 /*
- * arch/ppc/platforms/ibm440gx.c
+ * arch/ppc/platforms/4xx/ibm440gx.c
  *
  * PPC440GX I/O descriptions
  *
  * Matt Porter <mporter@mvista.com>
+ * Copyright 2002-2004 MontaVista Software Inc.
  *
- * Copyright 2002-2003 MontaVista Software Inc.
+ * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
+ * Copyright (c) 2003, 2004 Zultys Technologies
  *
  * 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
@@ -13,25 +15,203 @@
  * option) any later version.
  *
  */
-
-#include <linux/config.h>
 #include <linux/init.h>
-#include <linux/smp.h>
-#include <linux/threads.h>
-#include <linux/param.h>
-#include <linux/string.h>
-#include <asm/ocp.h>
+#include <linux/module.h>
 #include <platforms/4xx/ibm440gx.h>
+#include <asm/ocp.h>
+
+static struct ocp_func_emac_data ibm440gx_emac0_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx       = 0,            /* ZMII device index */
+	.zmii_mux       = 0,            /* ZMII input of this EMAC */
+	.mal_idx        = 0,            /* MAL device index */
+	.mal_rx_chan    = 0,            /* MAL rx channel number */
+	.mal_tx_chan    = 0,            /* MAL tx channel number */
+	.wol_irq        = 61,   	/* WOL interrupt number */
+	.mdio_idx       = -1,           /* No shared MDIO */
+	.tah_idx	= -1,		/* No TAH */
+};
+
+static struct ocp_func_emac_data ibm440gx_emac1_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx       = 0,            /* ZMII device index */
+	.zmii_mux       = 1,            /* ZMII input of this EMAC */
+	.mal_idx        = 0,            /* MAL device index */
+	.mal_rx_chan    = 1,            /* MAL rx channel number */
+	.mal_tx_chan    = 1,            /* MAL tx channel number */
+	.wol_irq        = 63,  		/* WOL interrupt number */
+	.mdio_idx       = -1,           /* No shared MDIO */
+	.tah_idx	= -1,		/* No TAH */
+};
+
+static struct ocp_func_emac_data ibm440gx_emac2_def = {
+	.rgmii_idx	= 0,		/* RGMII device index */
+	.rgmii_mux	= 0,		/* RGMII input of this EMAC */
+	.zmii_idx       = 0,            /* ZMII device index */
+	.zmii_mux       = 2,            /* ZMII input of this EMAC */
+	.mal_idx        = 0,            /* MAL device index */
+	.mal_rx_chan    = 2,            /* MAL rx channel number */
+	.mal_tx_chan    = 2,            /* MAL tx channel number */
+	.wol_irq        = 65,  		/* WOL interrupt number */
+	.mdio_idx       = -1,           /* No shared MDIO */
+	.tah_idx	= 0,		/* TAH device index */
+	.jumbo		= 1,		/* Jumbo frames supported */
+};
+
+static struct ocp_func_emac_data ibm440gx_emac3_def = {
+	.rgmii_idx	= 0,		/* RGMII device index */
+	.rgmii_mux	= 1,		/* RGMII input of this EMAC */
+	.zmii_idx       = 0,            /* ZMII device index */
+	.zmii_mux       = 3,            /* ZMII input of this EMAC */
+	.mal_idx        = 0,            /* MAL device index */
+	.mal_rx_chan    = 3,            /* MAL rx channel number */
+	.mal_tx_chan    = 3,            /* MAL tx channel number */
+	.wol_irq        = 67,  		/* WOL interrupt number */
+	.mdio_idx       = -1,           /* No shared MDIO */
+	.tah_idx	= 1,		/* TAH device index */
+	.jumbo		= 1,		/* Jumbo frames supported */
+};
+OCP_SYSFS_EMAC_DATA()
+
+static struct ocp_func_mal_data ibm440gx_mal0_def = {
+	.num_tx_chans   = 4,    	/* Number of TX channels */
+	.num_rx_chans   = 4,    	/* Number of RX channels */
+	.txeob_irq	= 10,		/* TX End Of Buffer IRQ  */
+	.rxeob_irq	= 11,		/* RX End Of Buffer IRQ  */
+	.txde_irq	= 33,		/* TX Descriptor Error IRQ */
+	.rxde_irq	= 34,		/* RX Descriptor Error IRQ */
+	.serr_irq	= 32,		/* MAL System Error IRQ    */
+};
+OCP_SYSFS_MAL_DATA()
+
+static struct ocp_func_iic_data ibm440gx_iic0_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+
+static struct ocp_func_iic_data ibm440gx_iic1_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+OCP_SYSFS_IIC_DATA()
 
-struct ocp_def core_ocp[] __initdata = {
-	{OCP_VENDOR_IBM, OCP_FUNC_OPB, PPC440GX_OPB_BASE_START, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, PPC440GX_UART0_ADDR, UART0_IRQ, IBM_CPM_UART0},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, PPC440GX_UART1_ADDR, UART1_IRQ, IBM_CPM_UART1},
-	{OCP_VENDOR_IBM, OCP_FUNC_IIC, PPC440GX_IIC0_ADDR, IIC0_IRQ, IBM_CPM_IIC0},
-	{OCP_VENDOR_IBM, OCP_FUNC_IIC, PPC440GX_IIC1_ADDR, IIC1_IRQ, IBM_CPM_IIC1},
-	{OCP_VENDOR_IBM, OCP_FUNC_GPIO, PPC440GX_GPIO0_ADDR, OCP_IRQ_NA, IBM_CPM_GPIO0},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, PPC440GX_EMAC0_ADDR, BL_MAC_ETH0, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, PPC440GX_EMAC1_ADDR, BL_MAC_ETH1, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_ZMII, PPC440GX_ZMII_ADDR, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_INVALID, OCP_FUNC_INVALID, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
+struct ocp_def core_ocp[] = {
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_OPB,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000000ULL,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 0,
+	  .paddr	= PPC440GX_UART0_ADDR,
+	  .irq		= UART0_INT,
+	  .pm		= IBM_CPM_UART0,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 1,
+	  .paddr	= PPC440GX_UART1_ADDR,
+	  .irq		= UART1_INT,
+	  .pm		= IBM_CPM_UART1,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000400ULL,
+	  .irq		= 2,
+	  .pm		= IBM_CPM_IIC0,
+	  .additions	= &ibm440gx_iic0_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .index	= 1,
+	  .paddr	= 0x0000000140000500ULL,
+	  .irq		= 3,
+	  .pm		= IBM_CPM_IIC1,
+	  .additions	= &ibm440gx_iic1_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_GPIO,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000700ULL,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= IBM_CPM_GPIO0,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_MAL,
+	  .paddr	= OCP_PADDR_NA,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm440gx_mal0_def,
+	  .show		= &ocp_show_mal_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000800ULL,
+	  .irq		= 60,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm440gx_emac0_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 1,
+	  .paddr	= 0x0000000140000900ULL,
+	  .irq		= 62,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm440gx_emac1_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 2,
+	  .paddr	= 0x0000000140000C00ULL,
+	  .irq		= 64,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm440gx_emac2_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 3,
+	  .paddr	= 0x0000000140000E00ULL,
+	  .irq		= 66,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibm440gx_emac3_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_RGMII,
+	  .paddr	= 0x0000000140000790ULL,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_ZMII,
+	  .paddr	= 0x0000000140000780ULL,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_TAH,
+	  .index	= 0,
+	  .paddr	= 0x0000000140000b50ULL,
+	  .irq		= 68,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_TAH,
+	  .index	= 1,
+	  .paddr	= 0x0000000140000d50ULL,
+	  .irq		= 69,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_INVALID
+	}
 };
diff -Nru a/arch/ppc/platforms/4xx/ibm440gx.h b/arch/ppc/platforms/4xx/ibm440gx.h
--- a/arch/ppc/platforms/4xx/ibm440gx.h	Tue Jun 15 22:21:05 2004
+++ b/arch/ppc/platforms/4xx/ibm440gx.h	Tue Jun 15 22:21:05 2004
@@ -26,53 +26,8 @@
 /* UART */
 #define PPC440GX_UART0_ADDR	0x0000000140000200ULL
 #define PPC440GX_UART1_ADDR	0x0000000140000300ULL
-#define UART0_IRQ		0
-#define UART1_IRQ		1
-
-/* EMAC */
-#define PPC440GX_EMAC0_ADDR	0x0000000140000800ULL
-#define PPC440GX_EMAC1_ADDR	0x0000000140000900ULL
-#define PPC440GX_EMAC2_ADDR	0x0000000140000C00ULL
-#define PPC440GX_EMAC3_ADDR	0x0000000140000E00ULL
-#define PPC440GX_EMAC_SIZE	0xFC
-#define EMAC_NUMS               2
-#define BL_MAC_WOL	61	/* WOL */
-#define BL_MAC_WOL1	63	/* WOL */
-#define BL_MAC_WOL2	65	/* WOL */
-#define BL_MAC_WOL3	67	/* WOL */
-#define BL_MAL_SERR	32	/* MAL SERR */
-#define BL_MAL_TXDE	33	/* MAL TXDE */
-#define BL_MAL_RXDE	34	/* MAL RXDE */
-#define BL_MAL_TXEOB	10	/* MAL TX EOB */
-#define BL_MAL_RXEOB	11	/* MAL RX EOB */
-#define BL_MAC_ETH0	60	/* MAC */
-#define BL_MAC_ETH1	62	/* MAC */
-#define BL_MAC_ETH2	64	/* MAC */
-#define BL_MAC_ETH3	66	/* MAC */
-#define BL_TAH0		68	/* TAH 0 */
-#define BL_TAH1		69	/* TAH 1 */
-
-/* TAH */
-#define PPC440GX_TAH0_ADDR	0x0000000140000B00ULL
-#define PPC440GX_TAH1_ADDR	0x0000000140000D00ULL
-#define PPC440GX_TAH_SIZE	0xFC
-
-/* ZMII */
-#define PPC440GX_ZMII_ADDR	0x0000000140000780ULL
-#define PPC440GX_ZMII_SIZE	0x0c
-
-/* RGMII */
-#define PPC440GX_RGMII_ADDR	0x0000000140000790ULL
-#define PPC440GX_RGMII_SIZE	0x0c
-
-/* IIC  */
-#define PPC440GX_IIC0_ADDR	0x40000400
-#define PPC440GX_IIC1_ADDR	0x40000500
-#define IIC0_IRQ		2
-#define IIC1_IRQ		3
-
-/* GPIO */
-#define PPC440GX_GPIO0_ADDR	0x0000000140000700ULL
+#define UART0_INT		0
+#define UART1_INT		1
 
 /* Clock and Power Management */
 #define IBM_CPM_IIC0		0x80000000	/* IIC interface */
@@ -110,10 +65,6 @@
 				| IBM_CPM_TAHOE0 | IBM_CPM_TAHOE1 \
 				| IBM_CPM_EMAC0 | IBM_CPM_EMAC1 \
 			  	| IBM_CPM_EMAC2 | IBM_CPM_EMAC3 )
-
-/* OPB */
-#define PPC440GX_OPB_BASE_START	0x0000000140000000ULL
-
 /*
  * Serial port defines
  */
diff -Nru a/arch/ppc/platforms/4xx/ibmnp405h.c b/arch/ppc/platforms/4xx/ibmnp405h.c
--- a/arch/ppc/platforms/4xx/ibmnp405h.c	Tue Jun 15 22:21:03 2004
+++ b/arch/ppc/platforms/4xx/ibmnp405h.c	Tue Jun 15 22:21:03 2004
@@ -14,21 +14,159 @@
 #include <asm/ocp.h>
 #include <platforms/4xx/ibmnp405h.h>
 
+static struct ocp_func_emac_data ibmnp405h_emac0_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx	= 0,		/* ZMII device index */
+	.zmii_mux	= 0,		/* ZMII input of this EMAC */
+	.mal_idx	= 0,		/* MAL device index */
+	.mal_rx_chan	= 0,		/* MAL rx channel number */
+	.mal_tx_chan	= 0,		/* MAL tx channel number */
+	.wol_irq	= 41,		/* WOL interrupt number */
+	.mdio_idx	= -1,		/* No shared MDIO */
+	.tah_idx	= -1,		/* No TAH */
+};
+
+static struct ocp_func_emac_data ibmnp405h_emac1_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx	= 0,		/* ZMII device index */
+	.zmii_mux	= 1,		/* ZMII input of this EMAC */
+	.mal_idx	= 0,		/* MAL device index */
+	.mal_rx_chan	= 1,		/* MAL rx channel number */
+	.mal_tx_chan	= 1,		/* MAL tx channel number */
+	.wol_irq	= 41,		/* WOL interrupt number */
+	.mdio_idx	= -1,		/* No shared MDIO */
+	.tah_idx	= -1,		/* No TAH */
+};
+static struct ocp_func_emac_data ibmnp405h_emac2_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx	= 0,		/* ZMII device index */
+	.zmii_mux	= 2,		/* ZMII input of this EMAC */
+	.mal_idx	= 0,		/* MAL device index */
+	.mal_rx_chan	= 2,		/* MAL rx channel number */
+	.mal_tx_chan	= 2,		/* MAL tx channel number */
+	.wol_irq	= 41,		/* WOL interrupt number */
+	.mdio_idx	= -1,		/* No shared MDIO */
+	.tah_idx	= -1,		/* No TAH */
+};
+static struct ocp_func_emac_data ibmnp405h_emac3_def = {
+	.rgmii_idx	= -1,		/* No RGMII */
+	.rgmii_mux	= -1,		/* No RGMII */
+	.zmii_idx	= 0,		/* ZMII device index */
+	.zmii_mux	= 3,		/* ZMII input of this EMAC */
+	.mal_idx	= 0,		/* MAL device index */
+	.mal_rx_chan	= 3,		/* MAL rx channel number */
+	.mal_tx_chan	= 3,		/* MAL tx channel number */
+	.wol_irq	= 41,		/* WOL interrupt number */
+	.mdio_idx	= -1,		/* No shared MDIO */
+	.tah_idx	= -1,		/* No TAH */
+};
+OCP_SYSFS_EMAC_DATA()
+
+static struct ocp_func_mal_data ibmnp405h_mal0_def = {
+	.num_tx_chans	= 8,		/* Number of TX channels */
+	.num_rx_chans	= 4,		/* Number of RX channels */
+	.txeob_irq	= 17,		/* TX End Of Buffer IRQ  */
+	.rxeob_irq	= 18,		/* RX End Of Buffer IRQ  */
+	.txde_irq	= 46,		/* TX Descriptor Error IRQ */
+	.rxde_irq	= 47,		/* RX Descriptor Error IRQ */
+	.serr_irq	= 45,		/* MAL System Error IRQ    */
+};
+OCP_SYSFS_MAL_DATA()
+
+static struct ocp_func_iic_data ibmnp405h_iic0_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+OCP_SYSFS_IIC_DATA()
 
 struct ocp_def core_ocp[] = {
-//	{OCP_VENDOR_IBM, OCP_FUNC_PLB, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_OPB, OPB_BASE_START, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART0_IO_BASE, UART0_INT,IBM_CPM_UART0},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART1_IO_BASE, UART1_INT, IBM_CPM_UART1},
-	{OCP_VENDOR_IBM, OCP_FUNC_IIC, IIC0_BASE, IIC0_IRQ, IBM_CPM_IIC0},
-	{OCP_VENDOR_IBM, OCP_FUNC_GPIO, GPIO0_BASE, OCP_IRQ_NA, IBM_CPM_GPIO0},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, EMAC0_BASE, BL_MAC_ETH0, IBM_CPM_EMAC0},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, EMAC0_BASE, BL_MAC_ETH0, IBM_CPM_EMAC0},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, EMAC1_BASE, BL_MAC_ETH1, IBM_CPM_EMAC1},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, EMAC2_BASE, BL_MAC_ETH2, IBM_CPM_EMAC2},
-	{OCP_VENDOR_IBM, OCP_FUNC_EMAC, EMAC3_BASE, BL_MAC_ETH3, IBM_CPM_EMAC3},
-	{OCP_VENDOR_IBM, OCP_FUNC_PHY, ZMII0_BASE, OCP_IRQ_NA, OCP_CPM_NA},
-//	{OCP_VENDOR_IBM, OCP_FUNC_EXT, EBIU_BASE_START, OCP_IRQ_NA,IBM_CPM_EBC},
-//	{OCP_VENDOR_IBM, OCP_FUNC_PCI, PCIL0_BASE, OCP_IRQ_NA, IBM_CPM_PCI},
-	{OCP_VENDOR_INVALID, OCP_FUNC_INVALID, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_OPB,
+	  .index	= 0,
+	  .paddr	= 0xEF600000,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 0,
+	  .paddr	= UART0_IO_BASE,
+	  .irq		= UART0_INT,
+	  .pm		= IBM_CPM_UART0
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 1,
+	  .paddr	= UART1_IO_BASE,
+	  .irq		= UART1_INT,
+	  .pm		= IBM_CPM_UART1
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .paddr	= 0xEF600500,
+	  .irq		= 2,
+	  .pm		= IBM_CPM_IIC0,
+	  .additions	= &ibmnp405h_iic0_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_GPIO,
+	  .paddr	= 0xEF600700,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= IBM_CPM_GPIO0
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_MAL,
+	  .paddr	= OCP_PADDR_NA,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	  .additions	= &ibmnp405h_mal0_def,
+	  .show		= &ocp_show_mal_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 0,
+	  .paddr	= EMAC0_BASE,
+	  .irq		= 37,
+	  .pm		= IBM_CPM_EMAC0,
+	  .additions	= &ibmnp405h_emac0_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 1,
+	  .paddr	= 0xEF600900,
+	  .irq		= 38,
+	  .pm		= IBM_CPM_EMAC1,
+	  .additions	= &ibmnp405h_emac1_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 2,
+	  .paddr	= 0xEF600a00,
+	  .irq		= 39,
+	  .pm		= IBM_CPM_EMAC2,
+	  .additions	= &ibmnp405h_emac2_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_EMAC,
+	  .index	= 3,
+	  .paddr	= 0xEF600b00,
+	  .irq		= 40,
+	  .pm		= IBM_CPM_EMAC3,
+	  .additions	= &ibmnp405h_emac3_def,
+	  .show		= &ocp_show_emac_data,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_ZMII,
+	  .paddr	= 0xEF600C10,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_INVALID
+	}
 };
diff -Nru a/arch/ppc/platforms/4xx/ibmnp405h.h b/arch/ppc/platforms/4xx/ibmnp405h.h
--- a/arch/ppc/platforms/4xx/ibmnp405h.h	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/platforms/4xx/ibmnp405h.h	Tue Jun 15 22:20:41 2004
@@ -14,7 +14,6 @@
 #define __ASM_IBMNP405H_H__
 
 #include <linux/config.h>
-#include <asm/ibm_ocp.h>
 
 /* ibm405.h at bottom of this file */
 
@@ -42,9 +41,6 @@
 #define PPC4xx_ONB_IO_ADDR	((uint)0xef600000)
 #define PPC4xx_ONB_IO_SIZE	((uint)4*1024)
 
-#define OPB_BASE_START	0x40000000
-#define EBIU_BASE_START	0xF0100000
-
 /* serial port defines */
 #define RS_TABLE_SIZE	4
 
@@ -53,27 +49,8 @@
 #define PCIL0_BASE	0xEF400000
 #define UART0_IO_BASE	0xEF600300
 #define UART1_IO_BASE	0xEF600400
-#define IIC0_BASE	0xEF600500
 #define OPB0_BASE	0xEF600600
-#define GPIO0_BASE	0xEF600700
 #define EMAC0_BASE	0xEF600800
-#define EMAC1_BASE	0xEF600900
-#define EMAC2_BASE	0xEF600a00
-#define EMAC3_BASE	0xEF600b00
-#define ZMII0_BASE	0xEF600C10
-#define BL_MAC_WOL	41 	/* WOL */
-#define BL_MAL_SERR	45	/* MAL SERR */
-#define BL_MAL_TXDE	46	/* MAL TXDE */
-#define BL_MAL_RXDE	47	/* MAL RXDE */
-#define BL_MAL_TXEOB	17	/* MAL TX EOB */
-#define BL_MAL_RXEOB	18	/* MAL RX EOB */
-#define BL_MAC_ETH0	37	/* MAC */
-#define BL_MAC_ETH1	38	/* MAC */
-#define BL_MAC_ETH2	39	/* MAC */
-#define BL_MAC_ETH3	40	/* MAC */
-
-#define EMAC_NUMS	4
-#define IIC0_IRQ	2
 
 #define BD_EMAC_ADDR(e,i) bi_enetaddr[e][i]
 
diff -Nru a/arch/ppc/platforms/4xx/ibmstb4.c b/arch/ppc/platforms/4xx/ibmstb4.c
--- a/arch/ppc/platforms/4xx/ibmstb4.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/platforms/4xx/ibmstb4.c	Tue Jun 15 22:20:37 2004
@@ -9,19 +9,75 @@
  * or implied.
  */
 
-#include <linux/config.h>
-#include <linux/module.h>
-#include "ibmstb4.h"
+#include <linux/init.h>
 #include <asm/ocp.h>
+#include <platforms/4xx/ibmstb4.h>
 
-struct ocp_def core_ocp[] = {
-	{UART, UART0_IO_BASE, UART0_INT,IBM_CPM_UART0},
-	{UART, UART1_IO_BASE, UART1_INT, IBM_CPM_UART1},
-	{UART, UART2_IO_BASE, UART2_INT, IBM_CPM_UART2},
-	{IIC, IIC0_BASE, IIC0_IRQ, IBM_CPM_IIC0},
-	{IIC, IIC1_BASE, IIC1_IRQ, IBM_CPM_IIC1},
-	{GPIO, GPIO0_BASE, OCP_IRQ_NA, IBM_CPM_GPIO0},
-	{IDE, IDE0_BASE, IDE0_IRQ, OCP_CPM_NA},
-	{USB, USB0_BASE, USB0_IRQ, IBM_CPM_USB0},
-	{OCP_NULL_TYPE, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
+static struct ocp_func_iic_data ibmstb4_iic0_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+
+static struct ocp_func_iic_data ibmstb4_iic1_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+OCP_SYSFS_IIC_DATA()
+
+struct ocp_def core_ocp[] __initdata = {
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 0,
+	  .paddr	= UART0_IO_BASE,
+	  .irq		= UART0_INT,
+	  .pm		= IBM_CPM_UART0,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 1,
+	  .paddr	= UART1_IO_BASE,
+	  .irq		= UART1_INT,
+	  .pm		= IBM_CPM_UART1,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 2,
+	  .paddr	= UART2_IO_BASE,
+	  .irq		= UART2_INT,
+	  .pm		= IBM_CPM_UART2,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .paddr	= IIC0_BASE,
+	  .irq		= IIC0_IRQ,
+	  .pm		= IBM_CPM_IIC0,
+	  .additions	= &ibmstb4_iic0_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .paddr	= IIC1_BASE,
+	  .irq		= IIC1_IRQ,
+	  .pm		= IBM_CPM_IIC1,
+	  .additions	= &ibmstb4_iic1_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_GPIO,
+	  .paddr	= GPIO0_BASE,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= IBM_CPM_GPIO0,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IDE,
+	  .paddr	= IDE0_BASE,
+	  .irq		= IDE0_IRQ,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_USB,
+	  .paddr	= USB0_BASE,
+	  .irq		= USB0_IRQ,
+	  .pm		= OCP_CPM_NA,
+	},
+	{ .vendor	= OCP_VENDOR_INVALID,
+	}
 };
diff -Nru a/arch/ppc/platforms/4xx/ibmstb4.h b/arch/ppc/platforms/4xx/ibmstb4.h
--- a/arch/ppc/platforms/4xx/ibmstb4.h	Tue Jun 15 22:21:03 2004
+++ b/arch/ppc/platforms/4xx/ibmstb4.h	Tue Jun 15 22:21:03 2004
@@ -14,7 +14,6 @@
 #define __ASM_IBMSTB4_H__
 
 #include <linux/config.h>
-#include <platforms/4xx/ibm_ocp.h>
 
 /* serial port defines */
 #define STB04xxx_IO_BASE	((uint)0xe0000000)
diff -Nru a/arch/ppc/platforms/4xx/ibmstbx25.c b/arch/ppc/platforms/4xx/ibmstbx25.c
--- a/arch/ppc/platforms/4xx/ibmstbx25.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/platforms/4xx/ibmstbx25.c	Tue Jun 15 22:20:37 2004
@@ -9,22 +9,51 @@
  * or implied.
  */
 
-#include <linux/config.h>
-#include <linux/module.h>
 #include <linux/init.h>
 #include <asm/ocp.h>
-#include "ibmstbx25.h"
+#include <platforms/4xx/ibmstbx25.h>
 
-struct ocp_def core_ocp[]  __initdata = {
-	{OCP_VENDOR_IBM, OCP_FUNC_PLB, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_OPB, OPB_BASE_START, OCP_IRQ_NA, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART0_IO_BASE, UART0_INT,IBM_CPM_UART0},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART1_IO_BASE, UART1_INT, IBM_CPM_UART1},
-	{OCP_VENDOR_IBM, OCP_FUNC_16550, UART2_IO_BASE,UART2_INT, IBM_CPM_UART2},
-	{OCP_VENDOR_IBM, OCP_FUNC_IIC, IIC0_BASE, IIC0_IRQ, IBM_CPM_IIC0},
-	{OCP_VENDOR_IBM, OCP_FUNC_GPIO, GPIO0_BASE, OCP_IRQ_NA, IBM_CPM_GPIO0},
-	{OCP_VENDOR_IBM, OCP_FUNC_IDE, IDE0_BASE, IDE0_IRQ, OCP_CPM_NA},
-	{OCP_VENDOR_IBM, OCP_FUNC_EXT, EBIU_BASE_START, OCP_IRQ_NA,IBM_CPM_EBIU},
-	{OCP_VENDOR_INVALID, OCP_FUNC_INVALID, 0x0, OCP_IRQ_NA, OCP_CPM_NA},
+static struct ocp_func_iic_data ibmstbx25_iic0_def = {
+	.fast_mode	= 0,		/* Use standad mode (100Khz) */
+};
+OCP_SYSFS_IIC_DATA()
 
+struct ocp_def core_ocp[] __initdata = {
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index        = 0,
+	  .paddr	= UART0_IO_BASE,
+	  .irq		= UART0_INT,
+	  .pm		= IBM_CPM_UART0,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 1,
+	  .paddr	= UART1_IO_BASE,
+	  .irq		= UART1_INT,
+	  .pm		= IBM_CPM_UART1,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_16550,
+	  .index	= 2,
+	  .paddr	= UART2_IO_BASE,
+	  .irq		= UART2_INT,
+	  .pm		= IBM_CPM_UART2,
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_IIC,
+	  .paddr	= IIC0_BASE,
+	  .irq		= IIC0_IRQ,
+	  .pm		= IBM_CPM_IIC0,
+	  .additions	= &ibmstbx25_iic0_def,
+	  .show		= &ocp_show_iic_data
+	},
+	{ .vendor	= OCP_VENDOR_IBM,
+	  .function	= OCP_FUNC_GPIO,
+	  .paddr	= GPIO0_BASE,
+	  .irq		= OCP_IRQ_NA,
+	  .pm		= IBM_CPM_GPIO0,
+	},
+	{ .vendor	= OCP_VENDOR_INVALID
+	}
 };
diff -Nru a/arch/ppc/platforms/4xx/ocotea.c b/arch/ppc/platforms/4xx/ocotea.c
--- a/arch/ppc/platforms/4xx/ocotea.c	Tue Jun 15 22:20:44 2004
+++ b/arch/ppc/platforms/4xx/ocotea.c	Tue Jun 15 22:20:44 2004
@@ -41,16 +41,23 @@
 #include <asm/dma.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
+#include <asm/ocp.h>
 #include <asm/pci-bridge.h>
 #include <asm/time.h>
 #include <asm/todc.h>
 #include <asm/bootinfo.h>
 #include <asm/ppc4xx_pic.h>
 
-extern void abort(void);
+#include <syslib/ibm440gx_common.h>
 
-/* Global Variables */
-bd_t __res;
+/*
+ * 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"
+
+extern void abort(void);
 
 static void __init
 ocotea_calibrate_decr(void)
@@ -202,15 +209,15 @@
 TODC_ALLOC();
 
 static void __init
-ocotea_early_serial_map(void)
+ocotea_early_serial_map(const struct ibm44x_clocks *clks)
 {
 	struct uart_port port;
 
 	/* Setup ioremapped serial port access */
 	memset(&port, 0, sizeof(port));
 	port.membase = ioremap64(PPC440GX_UART0_ADDR, 8);
-	port.irq = 0;
-	port.uartclk = BASE_BAUD * 16;
+	port.irq = UART0_INT;
+	port.uartclk = clks->uart0;
 	port.regshift = 0;
 	port.iotype = SERIAL_IO_MEM;
 	port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
@@ -221,7 +228,8 @@
 	}
 
 	port.membase = ioremap64(PPC440GX_UART1_ADDR, 8);
-	port.irq = 1;
+	port.irq = UART1_INT;
+	port.uartclk = clks->uart1;
 	port.line = 1;
 
 	if (early_serial_setup(&port) != 0) {
@@ -234,15 +242,42 @@
 {
 	unsigned char *addr;
 	unsigned long long mac64;
+	struct ocp_def *def;
+	struct ocp_func_emac_data *emacdata;
+	int i;
+	struct ibm44x_clocks clocks;
 
-	/* Retrieve MAC addresses from flash */
+	/*
+	 * Note: Current rev. board only operates in Group 4a
+	 * mode, so we always set EMAC0-1 for SMII and EMAC2-3
+	 * for RGMII (though these could run in RTBI just the same).
+	 *
+	 * The FPGA reg 3 information isn't even suitable for
+	 * determining the phy_mode, so if the board becomes
+	 * usable in !4a, it will be necessary to parse an environment
+	 * variable from the firmware or similar to properly configure
+	 * the phy_map/phy_mode.
+	 */
+	/* Set phy_map, phy_mode, and mac_addr for each EMAC */
 	addr = ioremap64(OCOTEA_MAC_BASE, OCOTEA_MAC_SIZE);
-	mac64 = simple_strtoull(addr, 0, 16);
-	memcpy(__res.bi_enetaddr[0], (char *)&mac64+2, 6);
-	mac64 = simple_strtoull(addr+OCOTEA_MAC1_OFFSET, 0, 16);
-	memcpy(__res.bi_enetaddr[1], (char *)&mac64+2, 6);
+	for (i=0; i<4; i++) {
+		mac64 = simple_strtoull(addr+OCOTEA_MAC_OFFSET*i, 0, 16);
+		def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i);
+		emacdata = def->additions;
+		if (i < 2) {
+			emacdata->phy_map = 0x00000001;	/* Skip 0x00 */
+			emacdata->phy_mode = PHY_MODE_SMII;
+		}
+		else {
+			emacdata->phy_map = 0x0000ffff; /* Skip 0x00-0x0f */
+			emacdata->phy_mode = PHY_MODE_RGMII;
+		}
+		memcpy(emacdata->mac_addr, (char *)&mac64+2, 6);
+	}
 	iounmap(addr);
 
+	ibm440gx_tah_enable();
+
 #if !defined(CONFIG_BDI_SWITCH)
 	/*
 	 * The Abatron BDI JTAG debugger does not tolerate others
@@ -251,6 +286,15 @@
         mtspr(SPRN_DBCR0, (DBCR0_TDE | DBCR0_IDM));
 #endif
 
+	/*
+	 * Determine various clocks.
+	 * To be completely correct we should get SysClk
+	 * from FPGA, because it can be changed by on-board switches
+	 * --ebs
+	 */
+	ibm440gx_get_clocks(&clocks, 33333333, 6 * 1843200);
+	ocp_sys_info.opb_bus_freq = clocks.opb;
+
 	/* Setup TODC access */
 	TODC_INIT(TODC_TYPE_DS1743,
 			0,
@@ -279,7 +323,7 @@
 	conswitchp = &dummy_con;
 #endif
 
-	ocotea_early_serial_map();
+	ocotea_early_serial_map(&clocks);
 
 	/* Identify the system */
 	printk("IBM Ocotea port (MontaVista Software, Inc. <source@mvista.com>)\n");
@@ -370,9 +414,6 @@
 {
 	int i;
 
-	/* Enable PPC440GP interrupt compatibility mode */
-	SDR_WRITE(DCRN_SDR_MFR,SDR_READ(DCRN_SDR_MFR) | DCRN_SDR_MFR_PCM);
-
 	ppc4xx_pic_init();
 
 	for (i = 0; i < NR_IRQS; i++)
@@ -430,6 +471,9 @@
 		unsigned long r5, unsigned long r6, unsigned long r7)
 {
 	parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
+
+	/* Disable L2-Cache due to hardware issues */
+	ibm440gx_l2c_disable();
 
 	ppc_md.setup_arch = ocotea_setup_arch;
 	ppc_md.show_cpuinfo = ocotea_show_cpuinfo;
diff -Nru a/arch/ppc/platforms/4xx/ocotea.h b/arch/ppc/platforms/4xx/ocotea.h
--- a/arch/ppc/platforms/4xx/ocotea.h	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc/platforms/4xx/ocotea.h	Tue Jun 15 22:20:40 2004
@@ -25,9 +25,9 @@
 #define PPC44x_EMAC0_MR0	0xE0000800
 
 /* Location of MAC addresses in firmware */
-#define OCOTEA_MAC_BASE		(OCOTEA_SMALL_FLASH_HIGH+0xc0500)
+#define OCOTEA_MAC_BASE		(OCOTEA_SMALL_FLASH_HIGH+0xb0500)
 #define OCOTEA_MAC_SIZE		0x200
-#define OCOTEA_MAC1_OFFSET	0x100
+#define OCOTEA_MAC_OFFSET	0x100
 
 /* Default clock rate */
 #define OCOTEA_SYSCLK		25000000
@@ -37,7 +37,7 @@
 #define OCOTEA_RTC_SIZE		0x2000
 
 /* Flash */
-#define OCOTEA_FPGA_ADDR		0x0000000148300000ULL
+#define OCOTEA_FPGA_REG_0		0x0000000148300000ULL
 #define OCOTEA_BOOT_LARGE_FLASH(x)	(x & 0x40)
 #define OCOTEA_SMALL_FLASH_LOW		0x00000001ff900000ULL
 #define OCOTEA_SMALL_FLASH_HIGH		0x00000001fff00000ULL
@@ -46,6 +46,9 @@
 #define OCOTEA_LARGE_FLASH_HIGH		0x00000001ffc00000ULL
 #define OCOTEA_LARGE_FLASH_SIZE		0x400000
 
+/* FPGA_REG_3 (Ethernet Groups) */
+#define OCOTEA_FPGA_REG_3		0x0000000148300003ULL
+
 /*
  * Serial port defines
  */
@@ -57,7 +60,7 @@
 
 #define BASE_BAUD	11059200/16
 #define STD_UART_OP(num)					\
-	{ 0, BASE_BAUD, 0, UART##num##_IRQ,			\
+	{ 0, BASE_BAUD, 0, UART##num##_INT,			\
 		(ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST),	\
 		iomem_base: UART##num##_IO_BASE,		\
 		io_type: SERIAL_IO_MEM},
diff -Nru a/arch/ppc/platforms/4xx/redwood5.c b/arch/ppc/platforms/4xx/redwood5.c
--- a/arch/ppc/platforms/4xx/redwood5.c	Tue Jun 15 22:20:39 2004
+++ b/arch/ppc/platforms/4xx/redwood5.c	Tue Jun 15 22:20:39 2004
@@ -20,8 +20,6 @@
 void __init
 redwood5_setup_arch(void)
 {
-	bd_t *bip = &__res;
-
 	ppc4xx_setup_arch();
 
 #ifdef CONFIG_DEBUG_BRINGUP
diff -Nru a/arch/ppc/platforms/4xx/sycamore.c b/arch/ppc/platforms/4xx/sycamore.c
--- a/arch/ppc/platforms/4xx/sycamore.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc/platforms/4xx/sycamore.c	Tue Jun 15 22:20:42 2004
@@ -28,6 +28,7 @@
 #include <asm/page.h>
 #include <asm/time.h>
 #include <asm/io.h>
+#include <asm/ibm_ocp_pci.h>
 #include <asm/todc.h>
 
 #undef DEBUG
@@ -119,6 +120,8 @@
 
 	ppc4xx_setup_arch();
 
+	ibm_ocp_set_emac(0, 1);
+
 	kb_data = ioremap(SYCAMORE_PS2_BASE, 8);
 	if (!kb_data) {
 		printk(KERN_CRIT
@@ -218,21 +221,25 @@
 						(PPC405_PCI_UPPER_MEM -
 						 PPC405_PCI_MEM_BASE)) | 0x01));
 
-	/* Disable region one */
+	/* Enable inbound region one - 1GB size */
+	out_le32((void *) &(pcip->ptm1ms), 0xc0000001);
+
+	/* Disable outbound region one */
 	out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
 	out_le32((void *) &(pcip->pmm[1].la), 0x00000000);
 	out_le32((void *) &(pcip->pmm[1].pcila), 0x00000000);
 	out_le32((void *) &(pcip->pmm[1].pciha), 0x00000000);
 	out_le32((void *) &(pcip->pmm[1].ma), 0x00000000);
-	out_le32((void *) &(pcip->ptm1ms), 0x00000000);
 
-	/* Disable region two */
+	/* Disable inbound region two */
+	out_le32((void *) &(pcip->ptm2ms), 0x00000000);
+
+	/* Disable outbound region two */
 	out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
 	out_le32((void *) &(pcip->pmm[2].la), 0x00000000);
 	out_le32((void *) &(pcip->pmm[2].pcila), 0x00000000);
 	out_le32((void *) &(pcip->pmm[2].pciha), 0x00000000);
 	out_le32((void *) &(pcip->pmm[2].ma), 0x00000000);
-	out_le32((void *) &(pcip->ptm2ms), 0x00000000);
 
 	/* Zero config bars */
 	for (bar = PCI_BASE_ADDRESS_1; bar <= PCI_BASE_ADDRESS_2; bar += 4) {
@@ -283,9 +290,11 @@
 	ppc_md.setup_arch = sycamore_setup_arch;
 	ppc_md.setup_io_mappings = sycamore_map_io;
 
+#ifdef CONFIG_GEN_RTC
 	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;
+#endif
 }
diff -Nru a/arch/ppc/platforms/4xx/walnut.c b/arch/ppc/platforms/4xx/walnut.c
--- a/arch/ppc/platforms/4xx/walnut.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc/platforms/4xx/walnut.c	Tue Jun 15 22:20:41 2004
@@ -28,6 +28,7 @@
 #include <asm/page.h>
 #include <asm/time.h>
 #include <asm/io.h>
+#include <asm/ocp.h>
 #include <asm/ibm_ocp_pci.h>
 #include <asm/todc.h>
 
@@ -77,6 +78,8 @@
 	void *fpga_trigger;
 
 	ppc4xx_setup_arch();
+
+	ibm_ocp_set_emac(0, 0);
 
 	kb_data = ioremap(WALNUT_PS2_BASE, 8);
 	if (!kb_data) {
diff -Nru a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile
--- a/arch/ppc/platforms/Makefile	Tue Jun 15 22:21:05 2004
+++ b/arch/ppc/platforms/Makefile	Tue Jun 15 22:21:05 2004
@@ -45,6 +45,7 @@
 obj-$(CONFIG_PRPMC750)		+= prpmc750.o
 obj-$(CONFIG_PRPMC800)		+= prpmc800.o
 obj-$(CONFIG_SANDPOINT)		+= sandpoint.o
+obj-$(CONFIG_SBC82xx)		+= sbc82xx.o
 obj-$(CONFIG_SPRUCE)		+= spruce.o
 
 ifeq ($(CONFIG_SMP),y)
diff -Nru a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c
--- a/arch/ppc/platforms/pmac_feature.c	Tue Jun 15 22:21:02 2004
+++ b/arch/ppc/platforms/pmac_feature.c	Tue Jun 15 22:21:02 2004
@@ -1156,7 +1156,7 @@
 			(void)MACIO_IN32(KEYLARGO_FCR1);
 			mdelay(1);
 			LOCK(flags);
-			MACIO_BIS(KEYLARGO_FCR0, KL1_USB2_CELL_ENABLE);
+			MACIO_BIS(KEYLARGO_FCR1, KL1_USB2_CELL_ENABLE);
 		}
 		if (number < 4) {
 			reg = MACIO_IN32(KEYLARGO_FCR4);
diff -Nru a/arch/ppc/platforms/pmac_pic.c b/arch/ppc/platforms/pmac_pic.c
--- a/arch/ppc/platforms/pmac_pic.c	Tue Jun 15 22:20:58 2004
+++ b/arch/ppc/platforms/pmac_pic.c	Tue Jun 15 22:20:58 2004
@@ -260,7 +260,7 @@
 					node->child->intrs = &gatwick_int_pool[count];
 					count += 3;
 				}
-				node->child->n_intrs = 3;			
+				node->child->n_intrs = 3;
 				node->child->intrs[0].line = 15+irq_base;
 				node->child->intrs[1].line =  4+irq_base;
 				node->child->intrs[2].line =  5+irq_base;
@@ -279,7 +279,7 @@
 			node->intrs[0].line = 29+irq_base;
 			printk(KERN_INFO "irq: fixed media-bay on second controller (%d)\n",
 					node->intrs[0].line);
-		
+
 			ya_node = node->child;
 			while(ya_node)
 			{
@@ -501,7 +501,7 @@
 				pmac_irq_hw[i] = (volatile struct pmac_irq_hw*)
 					(addr + (2 - i) * 0x10);
 		}
-	
+
 		/* get addresses of second controller */
 		irqctrler = irqctrler->next;
 		if (irqctrler && irqctrler->n_addrs > 0) {
diff -Nru a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c
--- a/arch/ppc/platforms/pmac_setup.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc/platforms/pmac_setup.c	Tue Jun 15 22:20:42 2004
@@ -136,7 +136,7 @@
 
 	if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME, (int)&mbname) != 0)
 		mbname = "Unknown";
-	
+
 	/* find motherboard type */
 	seq_printf(m, "machine\t\t: ");
 	np = find_devices("device-tree");
@@ -196,7 +196,7 @@
 		int n;
 		struct reg_property *reg = (struct reg_property *)
 			get_property(np, "reg", &n);
-	
+
 		if (reg != 0) {
 			unsigned long total = 0;
 
@@ -207,9 +207,9 @@
 	}
 
 	/* Checks "l2cr-value" property in the registry */
-	np = find_devices("cpus");	
+	np = find_devices("cpus");
 	if (np == 0)
-		np = find_type_devices("cpu");	
+		np = find_type_devices("cpu");
 	if (np != 0) {
 		unsigned int *l2cr = (unsigned int *)
 			get_property(np, "l2cr-value", NULL);
@@ -277,9 +277,9 @@
 
 	/* Checks "l2cr-value" property in the registry */
 	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR) {
-		struct device_node *np = find_devices("cpus");	
+		struct device_node *np = find_devices("cpus");
 		if (np == 0)
-			np = find_type_devices("cpu");	
+			np = find_type_devices("cpu");
 		if (np != 0) {
 			unsigned int *l2cr = (unsigned int *)
 				get_property(np, "l2cr-value", NULL);
@@ -478,11 +478,11 @@
 			cuda_poll();
 		break;
 #endif /* CONFIG_ADB_CUDA */
-#ifdef CONFIG_ADB_PMU	
+#ifdef CONFIG_ADB_PMU
 	case SYS_CTRLER_PMU:
 		pmu_restart();
 		break;
-#endif /* CONFIG_ADB_PMU */	
+#endif /* CONFIG_ADB_PMU */
 	default: ;
 	}
 }
diff -Nru a/arch/ppc/platforms/sbc82xx.c b/arch/ppc/platforms/sbc82xx.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/platforms/sbc82xx.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,113 @@
+/*
+ * arch/ppc/platforms/sbc82xx.c
+ *
+ * SBC82XX platform support
+ *
+ * Author: Guy Streeter <streeter@redhat.com>
+ *
+ * Derived from: est8260_setup.c by Allen Curtis, ONZ
+ *
+ * Copyright 2004 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/config.h>
+#include <linux/seq_file.h>
+#include <linux/stddef.h>
+
+#include <asm/mpc8260.h>
+#include <asm/machdep.h>
+#include <asm/io.h>
+#include <asm/todc.h>
+#include <asm/immap_8260.h>
+
+static void (*callback_setup_arch)(void);
+
+extern unsigned char __res[sizeof(bd_t)];
+
+extern void m8260_init(unsigned long r3, unsigned long r4,
+	unsigned long r5, unsigned long r6, unsigned long r7);
+
+extern void (*late_time_init)(void);
+
+static int
+sbc82xx_show_cpuinfo(struct seq_file *m)
+{
+	bd_t	*binfo = (bd_t *)__res;
+
+	seq_printf(m, "vendor\t\t: Wind River\n"
+		      "machine\t\t: SBC PowerQUICC II\n"
+		      "\n"
+		      "mem size\t\t: 0x%08lx\n"
+		      "console baud\t\t: %ld\n"
+		      "\n",
+		      binfo->bi_memsize,
+		      binfo->bi_baudrate);
+	return 0;
+}
+
+static void __init
+sbc82xx_setup_arch(void)
+{
+	printk("SBC PowerQUICC II Port\n");
+	callback_setup_arch();
+}
+
+TODC_ALLOC();
+
+/*
+ * Timer init happens before mem_init but after paging init, so we cannot
+ * directly use ioremap() at that time.
+ * late_time_init() is call after paging init.
+ */
+#ifdef CONFIG_GEN_RTC
+static void sbc82xx_time_init(void)
+{
+	volatile memctl8260_t *mc = &immr->im_memctl;
+	TODC_INIT(TODC_TYPE_MK48T59, 0, 0, SBC82xx_TODC_NVRAM_ADDR, 0);
+
+	/* Set up CS11 for RTC chip */
+	mc->memc_br11=0;
+	mc->memc_or11=0xffff0836;
+	mc->memc_br11=0x80000801;
+
+	todc_info->nvram_data =
+		(unsigned int)ioremap(todc_info->nvram_data, 0x2000);
+	BUG_ON(!todc_info->nvram_data);
+	ppc_md.get_rtc_time	= todc_get_rtc_time;
+	ppc_md.set_rtc_time	= todc_set_rtc_time;
+	ppc_md.nvram_read_val	= todc_direct_read_val;
+	ppc_md.nvram_write_val	= todc_direct_write_val;
+	todc_time_init();
+}
+#endif /* CONFIG_GEN_RTC */
+
+void __init
+platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+	      unsigned long r6, unsigned long r7)
+{
+	/* Generic 8260 platform initialization */
+	m8260_init(r3, r4, r5, r6, r7);
+
+	/* u-boot may be using one of the FCC Ethernet devices.
+	   Use the MAC address to the SCC. */
+	__res[offsetof(bd_t, bi_enetaddr[5])] &= ~3;
+
+	/* Anything special for this platform */
+	ppc_md.show_cpuinfo	= sbc82xx_show_cpuinfo;
+
+	callback_setup_arch	= ppc_md.setup_arch;
+	ppc_md.setup_arch	= sbc82xx_setup_arch;
+#ifdef CONFIG_GEN_RTC
+	ppc_md.time_init        = NULL;
+	ppc_md.get_rtc_time     = NULL;
+	ppc_md.set_rtc_time     = NULL;
+	ppc_md.nvram_read_val   = NULL;
+	ppc_md.nvram_write_val  = NULL;
+	late_time_init		= sbc82xx_time_init;
+#endif /* CONFIG_GEN_RTC */
+}
diff -Nru a/arch/ppc/platforms/sbc82xx.h b/arch/ppc/platforms/sbc82xx.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/platforms/sbc82xx.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,24 @@
+/* Board information for the SBCPowerQUICCII, which should be generic for
+ * all 8260 boards.  The IMMR is now given to us so the hard define
+ * will soon be removed.  All of the clock values are computed from
+ * the configuration SCMR and the Power-On-Reset word.
+ */
+
+#ifndef __PPC_SBC82xx_H__
+#define __PPC_SBC82xx_H__
+
+#include <asm/ppcboot.h>
+
+#define IMAP_ADDR			0xf0000000
+#define CPM_MAP_ADDR			0xf0000000
+
+#define SBC82xx_TODC_NVRAM_ADDR		0x80000000
+
+#define SBC82xx_MACADDR_NVRAM_FCC1	0x220000c9	/* JP6B */
+#define SBC82xx_MACADDR_NVRAM_SCC1	0x220000cf	/* JP6A */
+#define SBC82xx_MACADDR_NVRAM_FCC2	0x220000d5	/* JP7A */
+#define SBC82xx_MACADDR_NVRAM_FCC3	0x220000db	/* JP7B */
+
+#define BOOTROM_RESTART_ADDR      ((uint)0x40000104)
+
+#endif /* __PPC_SBC82xx_H__ */
diff -Nru a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
--- a/arch/ppc/syslib/Makefile	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc/syslib/Makefile	Tue Jun 15 22:20:36 2004
@@ -9,12 +9,15 @@
 EXTRA_AFLAGS		:= -Wa,-m405
 endif
 
-CFLAGS_prom_init.o      += -mrelocatable-lib
-CFLAGS_btext.o          += -mrelocatable-lib
+CFLAGS_prom_init.o      += -fPIC
+CFLAGS_btext.o          += -fPIC
 
 obj-$(CONFIG_PPCBUG_NVRAM)	+= prep_nvram.o
+obj-$(CONFIG_PPC_OCP)		+= ocp.o
+obj-$(CONFIG_IBM_OCP)		+= ibm_ocp.o
 obj-$(CONFIG_44x)		+= ibm44x_common.o
 obj-$(CONFIG_440GP)		+= ibm440gp_common.o
+obj-$(CONFIG_440GX)		+= ibm440gx_common.o
 ifeq ($(CONFIG_4xx),y)
 obj-$(CONFIG_4xx)		+= ppc4xx_pic.o
 obj-$(CONFIG_40x)		+= ppc4xx_setup.o
@@ -60,6 +63,7 @@
 obj-$(CONFIG_HARRIER)		+= harrier.o
 obj-$(CONFIG_PRPMC800)		+= open_pic.o indirect_pci.o pci_auto.o
 obj-$(CONFIG_SANDPOINT)		+= i8259.o open_pic.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 \
 				   todc_time.o
 obj-$(CONFIG_8260)		+= m8260_setup.o ppc8260_pic.o
@@ -69,3 +73,5 @@
 endif
 obj-$(CONFIG_BOOTX_TEXT)	+= btext.o
 obj-$(CONFIG_MPC10X_BRIDGE)     += mpc10x_common.o indirect_pci.o
+obj-$(CONFIG_40x)		+= dcr.o
+obj-$(CONFIG_BOOKE)		+= dcr.o
diff -Nru a/arch/ppc/syslib/dcr.S b/arch/ppc/syslib/dcr.S
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/syslib/dcr.S	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,41 @@
+/*
+ * arch/ppc/syslib/dcr.S
+ *
+ * "Indirect" DCR access
+ *
+ * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.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.
+ */
+
+#include <asm/ppc_asm.h>
+#include <asm/processor.h>
+
+#define DCR_ACCESS_PROLOG(table) \
+	rlwinm  r3,r3,4,18,27;   \
+	lis     r5,table@h;      \
+	ori     r5,r5,table@l;   \
+	add     r3,r3,r5;        \
+	mtctr   r3;              \
+	bctr
+
+_GLOBAL(__mfdcr)
+	DCR_ACCESS_PROLOG(__mfdcr_table)
+
+_GLOBAL(__mtdcr)
+	DCR_ACCESS_PROLOG(__mtdcr_table)
+
+__mfdcr_table:
+	mfdcr  r3,0; blr
+__mtdcr_table:
+	mtdcr  0,r4; blr
+
+dcr     = 1
+        .rept   1023
+	mfdcr   r3,dcr; blr
+	mtdcr   dcr,r4; blr
+	dcr     = dcr + 1
+	.endr
diff -Nru a/arch/ppc/syslib/ibm440gp_common.c b/arch/ppc/syslib/ibm440gp_common.c
--- a/arch/ppc/syslib/ibm440gp_common.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/syslib/ibm440gp_common.c	Tue Jun 15 22:20:37 2004
@@ -24,7 +24,7 @@
 /*
  * Calculate 440GP clocks
  */
-void __init ibm440gp_get_clocks(struct ibm440gp_clocks* p,
+void __init ibm440gp_get_clocks(struct ibm44x_clocks* p,
 				unsigned int sys_clk,
 				unsigned int ser_clk)
 {
@@ -68,11 +68,11 @@
 
 	if (cpc0_cr0 & 0x00400000){
 		/* External UART clock */
-		p->uart = ser_clk;
+		p->uart0 = p->uart1 = ser_clk;
 	}
 	else {
 		/* Internal UART clock */
     		u32 uart_div = ((cpc0_cr0 >> 16) & 0x1f) + 1;
-		p->uart = p->plb / uart_div;
+		p->uart0 = p->uart1 = p->plb / uart_div;
 	}
 }
diff -Nru a/arch/ppc/syslib/ibm440gp_common.h b/arch/ppc/syslib/ibm440gp_common.h
--- a/arch/ppc/syslib/ibm440gp_common.h	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc/syslib/ibm440gp_common.h	Tue Jun 15 22:20:37 2004
@@ -1,5 +1,5 @@
 /*
- * arch/ppc/syslib/ibm440gp_common.h
+ * arch/ppc/kernel/ibm440gp_common.h
  *
  * PPC440GP system library
  *
@@ -20,24 +20,14 @@
 
 #include <linux/config.h>
 #include <linux/init.h>
-
-/*
- * All clocks are in Hz
- */
-struct ibm440gp_clocks {
-	unsigned int cpu;	/* CPUCoreClk */
-	unsigned int plb;	/* PLBClk */
-	unsigned int opb;	/* OPBClk */
-	unsigned int ebc;	/* PerClk */
-	unsigned int uart;
-};
+#include <syslib/ibm44x_common.h>
 
 /*
  * Please, refer to the Figure 13.1 in 440GP user manual
  *
  * if internal UART clock is used, ser_clk is ignored
  */
-void ibm440gp_get_clocks(struct ibm440gp_clocks*, unsigned int sys_clk,
+void ibm440gp_get_clocks(struct ibm44x_clocks*, unsigned int sys_clk,
 	unsigned int ser_clk) __init;
 
 #endif /* __ASSEMBLY__ */
diff -Nru a/arch/ppc/syslib/ibm440gx_common.c b/arch/ppc/syslib/ibm440gx_common.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/syslib/ibm440gx_common.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,212 @@
+/*
+ * arch/ppc/kernel/ibm440gx_common.c
+ *
+ * PPC440GX system library
+ *
+ * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
+ * Copyright (c) 2003 Zultys Technologies
+ *
+ * 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/kernel.h>
+#include <asm/ibm44x.h>
+#include <asm/mmu.h>
+#include <asm/processor.h>
+#include <syslib/ibm440gx_common.h>
+
+/*
+ * Calculate 440GX clocks
+ */
+static inline u32 __fix_zero(u32 v, u32 def){
+	return v ? v : def;
+}
+
+void __init ibm440gx_get_clocks(struct ibm44x_clocks* p, unsigned int sys_clk,
+	unsigned int ser_clk)
+{
+	u32 pllc  = CPR_READ(DCRN_CPR_PLLC);
+	u32 plld  = CPR_READ(DCRN_CPR_PLLD);
+	u32 uart0 = SDR_READ(DCRN_SDR_UART0);
+	u32 uart1 = SDR_READ(DCRN_SDR_UART1);
+
+	/* Dividers */
+	u32 fbdv   = __fix_zero((plld >> 24) & 0x1f, 32);
+	u32 fwdva  = __fix_zero((plld >> 16) & 0xf, 16);
+	u32 fwdvb  = __fix_zero((plld >> 8) & 7, 8);
+	u32 lfbdv  = __fix_zero(plld & 0x3f, 64);
+	u32 pradv0 = __fix_zero((CPR_READ(DCRN_CPR_PRIMAD) >> 24) & 7, 8);
+	u32 prbdv0 = __fix_zero((CPR_READ(DCRN_CPR_PRIMBD) >> 24) & 7, 8);
+	u32 opbdv0 = __fix_zero((CPR_READ(DCRN_CPR_OPBD) >> 24) & 3, 4);
+	u32 perdv0 = __fix_zero((CPR_READ(DCRN_CPR_PERD) >> 24) & 3, 4);
+
+	/* Input clocks for primary dividers */
+	u32 clk_a, clk_b;
+
+	if (pllc & 0x40000000){
+		u32 m;
+
+		/* Feedback path */
+		switch ((pllc >> 24) & 7){
+		case 0:
+			/* PLLOUTx */
+			m = ((pllc & 0x20000000) ? fwdvb : fwdva) * lfbdv;
+			break;
+		case 1:
+			/* CPU */
+			m = fwdva * pradv0;
+			break;
+		case 5:
+			/* PERClk */
+			m = fwdvb * prbdv0 * opbdv0 * perdv0;
+			break;
+		default:
+			printk(KERN_EMERG "invalid PLL feedback source\n");
+			goto bypass;
+		}
+		m *= fbdv;
+		p->vco = sys_clk * m;
+		clk_a = p->vco / fwdva;
+		clk_b = p->vco / fwdvb;
+	}
+	else {
+bypass:
+		/* Bypass system PLL */
+		p->vco = 0;
+		clk_a = clk_b = sys_clk;
+	}
+
+	p->cpu = clk_a / pradv0;
+	p->plb = clk_b / prbdv0;
+	p->opb = p->plb / opbdv0;
+	p->ebc = p->opb / perdv0;
+
+	/* UARTs clock */
+	if (uart0 & 0x00800000)
+		p->uart0 = ser_clk;
+	else
+		p->uart0 = p->plb / __fix_zero(uart0 & 0xff, 256);
+
+	if (uart1 & 0x00800000)
+		p->uart1 = ser_clk;
+	else
+		p->uart1 = p->plb / __fix_zero(uart1 & 0xff, 256);
+}
+
+/* Enable L2 cache (call with IRQs disabled) */
+void __init ibm440gx_l2c_enable(void){
+	u32 r;
+
+	asm volatile ("sync" ::: "memory");
+
+	/* Disable SRAM */
+	mtdcr(DCRN_SRAM0_DPC,   mfdcr(DCRN_SRAM0_DPC)   & ~SRAM_DPC_ENABLE);
+	mtdcr(DCRN_SRAM0_SB0CR, mfdcr(DCRN_SRAM0_SB0CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(DCRN_SRAM0_SB1CR, mfdcr(DCRN_SRAM0_SB1CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(DCRN_SRAM0_SB2CR, mfdcr(DCRN_SRAM0_SB2CR) & ~SRAM_SBCR_BU_MASK);
+	mtdcr(DCRN_SRAM0_SB3CR, mfdcr(DCRN_SRAM0_SB3CR) & ~SRAM_SBCR_BU_MASK);
+
+	/* Enable L2_MODE without ICU/DCU */
+	r = mfdcr(DCRN_L2C0_CFG) & ~(L2C_CFG_ICU | L2C_CFG_DCU | L2C_CFG_SS_MASK);
+	r |= L2C_CFG_L2M | L2C_CFG_SS_256;
+	mtdcr(DCRN_L2C0_CFG, r);
+
+	mtdcr(DCRN_L2C0_ADDR, 0);
+
+	/* Hardware Clear Command */
+	mtdcr(DCRN_L2C0_CMD, L2C_CMD_HCC);
+	while (!(mfdcr(DCRN_L2C0_SR) & L2C_SR_CC)) ;
+
+	/* Clear Cache Parity and Tag Errors */
+	mtdcr(DCRN_L2C0_CMD, L2C_CMD_CCP | L2C_CMD_CTE);
+
+	/* Enable 64G snoop region starting at 0 */
+	r = mfdcr(DCRN_L2C0_SNP0) & ~(L2C_SNP_BA_MASK | L2C_SNP_SSR_MASK);
+	r |= L2C_SNP_SSR_32G | L2C_SNP_ESR;
+	mtdcr(DCRN_L2C0_SNP0, r);
+
+	r = mfdcr(DCRN_L2C0_SNP1) & ~(L2C_SNP_BA_MASK | L2C_SNP_SSR_MASK);
+	r |= 0x80000000 | L2C_SNP_SSR_32G | L2C_SNP_ESR;
+	mtdcr(DCRN_L2C0_SNP1, r);
+
+	asm volatile ("sync" ::: "memory");
+
+	/* Enable ICU/DCU ports */
+	r = mfdcr(DCRN_L2C0_CFG);
+	r &= ~(L2C_CFG_DCW_MASK | L2C_CFG_CPIM | L2C_CFG_TPIM | L2C_CFG_LIM
+		| L2C_CFG_PMUX_MASK | L2C_CFG_PMIM | L2C_CFG_TPEI | L2C_CFG_CPEI
+		| L2C_CFG_NAM | L2C_CFG_NBRM);
+	r |= L2C_CFG_ICU | L2C_CFG_DCU | L2C_CFG_TPC | L2C_CFG_CPC | L2C_CFG_FRAN
+		| L2C_CFG_SMCM;
+	mtdcr(DCRN_L2C0_CFG, r);
+
+	asm volatile ("sync; isync" ::: "memory");
+}
+
+/* Disable L2 cache (call with IRQs disabled) */
+void __init ibm440gx_l2c_disable(void){
+	u32 r;
+
+	asm volatile ("sync" ::: "memory");
+
+	/* Disable L2C mode */
+	r = mfdcr(DCRN_L2C0_CFG) & ~(L2C_CFG_L2M | L2C_CFG_ICU | L2C_CFG_DCU);
+	mtdcr(DCRN_L2C0_CFG, r);
+
+	/* Enable SRAM */
+	mtdcr(DCRN_SRAM0_DPC, mfdcr(DCRN_SRAM0_DPC) | SRAM_DPC_ENABLE);
+	mtdcr(DCRN_SRAM0_SB0CR,
+	      SRAM_SBCR_BAS0 | SRAM_SBCR_BS_64KB | SRAM_SBCR_BU_RW);
+	mtdcr(DCRN_SRAM0_SB1CR,
+	      SRAM_SBCR_BAS1 | SRAM_SBCR_BS_64KB | SRAM_SBCR_BU_RW);
+	mtdcr(DCRN_SRAM0_SB2CR,
+	      SRAM_SBCR_BAS2 | SRAM_SBCR_BS_64KB | SRAM_SBCR_BU_RW);
+	mtdcr(DCRN_SRAM0_SB3CR,
+	      SRAM_SBCR_BAS3 | SRAM_SBCR_BS_64KB | SRAM_SBCR_BU_RW);
+
+	asm volatile ("sync; isync" ::: "memory");
+}
+
+int __init ibm440gx_get_eth_grp(void)
+{
+	return (SDR_READ(DCRN_SDR_PFC1) & DCRN_SDR_PFC1_EPS) >> DCRN_SDR_PFC1_EPS_SHIFT;
+}
+
+void __init ibm440gx_set_eth_grp(int group)
+{
+	SDR_WRITE(DCRN_SDR_PFC1, (SDR_READ(DCRN_SDR_PFC1) & ~DCRN_SDR_PFC1_EPS) | (group << DCRN_SDR_PFC1_EPS_SHIFT));
+}
+
+void __init ibm440gx_tah_enable(void)
+{
+	/* Enable TAH0 and TAH1 */
+	SDR_WRITE(DCRN_SDR_MFR,SDR_READ(DCRN_SDR_MFR) &
+			~DCRN_SDR_MFR_TAH0);
+	SDR_WRITE(DCRN_SDR_MFR,SDR_READ(DCRN_SDR_MFR) &
+			~DCRN_SDR_MFR_TAH1);
+}
+
+int ibm440gx_show_cpuinfo(struct seq_file *m){
+
+	u32 l2c_cfg = mfdcr(DCRN_L2C0_CFG);
+	const char* s;
+	if (l2c_cfg & L2C_CFG_L2M){
+	    switch (l2c_cfg & (L2C_CFG_ICU | L2C_CFG_DCU)){
+		case L2C_CFG_ICU: s = "I-Cache only";    break;
+		case L2C_CFG_DCU: s = "D-Cache only";    break;
+		default:	  s = "I-Cache/D-Cache"; break;
+	    }
+	}
+	else
+	    s = "disabled";
+
+	seq_printf(m, "L2-Cache\t: %s (0x%08x 0x%08x)\n", s,
+	    l2c_cfg, mfdcr(DCRN_L2C0_SR));
+
+	return 0;
+}
+
diff -Nru a/arch/ppc/syslib/ibm440gx_common.h b/arch/ppc/syslib/ibm440gx_common.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/syslib/ibm440gx_common.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,54 @@
+/*
+ * arch/ppc/kernel/ibm440gx_common.h
+ *
+ * PPC440GX system library
+ *
+ * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
+ * Copyright (c) 2003 Zultys Technologies
+ *
+ * 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__
+#ifndef __PPC_SYSLIB_IBM440GX_COMMON_H
+#define __PPC_SYSLIB_IBM440GX_COMMON_H
+
+#ifndef __ASSEMBLY__
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/seq_file.h>
+#include <syslib/ibm44x_common.h>
+
+/*
+ * Please, refer to the Figure 14.1 in 440GX user manual
+ *
+ * if internal UART clock is used, ser_clk is ignored
+ */
+void ibm440gx_get_clocks(struct ibm44x_clocks*, unsigned int sys_clk,
+	unsigned int ser_clk) __init;
+
+/* Enable L2 cache */
+void ibm440gx_l2c_enable(void) __init;
+
+/* Disable L2 cache */
+void ibm440gx_l2c_disable(void) __init;
+
+/* Get Ethernet Group */
+int ibm440gx_get_eth_grp(void) __init;
+
+/* Set Ethernet Group */
+void ibm440gx_set_eth_grp(int group) __init;
+
+/* Enable TAH devices */
+void ibm440gx_tah_enable(void) __init;
+
+/* Add L2C info to /proc/cpuinfo */
+int ibm440gx_show_cpuinfo(struct seq_file*);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __PPC_SYSLIB_IBM440GX_COMMON_H */
+#endif /* __KERNEL__ */
diff -Nru a/arch/ppc/syslib/ibm44x_common.h b/arch/ppc/syslib/ibm44x_common.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/syslib/ibm44x_common.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,36 @@
+/*
+ * arch/ppc/kernel/ibm44x_common.h
+ *
+ * PPC44x system library
+ *
+ * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
+ * Copyright (c) 2003 Zultys Technologies
+ *
+ * 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__
+#ifndef __PPC_SYSLIB_IBM44x_COMMON_H
+#define __PPC_SYSLIB_IBM44x_COMMON_H
+
+#ifndef __ASSEMBLY__
+
+/*
+ * All clocks are in Hz
+ */
+struct ibm44x_clocks {
+	unsigned int vco;	/* VCO, 0 if system PLL is bypassed */
+	unsigned int cpu;	/* CPUCoreClk */
+	unsigned int plb;	/* PLBClk */
+	unsigned int opb;	/* OPBClk */
+	unsigned int ebc;	/* PerClk */
+	unsigned int uart0;
+	unsigned int uart1;
+};
+
+#endif /* __ASSEMBLY__ */
+#endif /* __PPC_SYSLIB_IBM44x_COMMON_H */
+#endif /* __KERNEL__ */
diff -Nru a/arch/ppc/syslib/ibm_ocp.c b/arch/ppc/syslib/ibm_ocp.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/syslib/ibm_ocp.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,9 @@
+#include <linux/module.h>
+#include <asm/ocp.h>
+
+struct ocp_sys_info_data ocp_sys_info = {
+	.opb_bus_freq	=	50000000,	/* OPB Bus Frequency (Hz) */
+	.ebc_bus_freq	=	33333333,	/* EBC Bus Frequency (Hz) */
+};
+
+EXPORT_SYMBOL(ocp_sys_info);
diff -Nru a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
--- a/arch/ppc/syslib/m8xx_setup.c	Tue Jun 15 22:20:39 2004
+++ b/arch/ppc/syslib/m8xx_setup.c	Tue Jun 15 22:20:39 2004
@@ -214,14 +214,13 @@
 m8xx_restart(char *cmd)
 {
 	__volatile__ unsigned char dummy;
-	uint	msr;
 
 	cli();
 	((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr |= 0x00000080;
 
 	/* Clear the ME bit in MSR to cause checkstop on machine check
 	*/
-	mtmsr(mfmsr(msr) & ~0x1000);
+	mtmsr(mfmsr() & ~0x1000);
 
 	dummy = ((immap_t *)IMAP_ADDR)->im_clkrst.res[0];
 	printk("Restart failed\n");
@@ -248,8 +247,8 @@
 
 	bp = (bd_t *)__res;
 
-	seq_printf(m, "clock\t\t: %dMHz\n"
-		   "bus clock\t: %dMHz\n",
+	seq_printf(m, "clock\t\t: %ldMHz\n"
+		   "bus clock\t: %ldMHz\n",
 		   bp->bi_intfreq / 1000000,
 		   bp->bi_busfreq / 1000000);
 
diff -Nru a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc/syslib/ocp.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,485 @@
+/*
+ * ocp.c
+ *
+ *      (c) Benjamin Herrenschmidt (benh@kernel.crashing.org)
+ *          Mipsys - France
+ *
+ *          Derived from work (c) Armin Kuster akuster@pacbell.net
+ *
+ *          Additional support and port to 2.6 LDM/sysfs by
+ *          Matt Porter <mporter@kernel.crashing.org>
+ *          Copyright 2004 MontaVista Software, 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.
+ *
+ *  OCP (On Chip Peripheral) is a software emulated "bus" with a
+ *  pseudo discovery method for dumb peripherals. Usually these type
+ *  of peripherals are found on embedded SoC (System On a Chip)
+ *  processors or highly integrated system controllers that have
+ *  a host bridge and many peripherals.  Common examples where
+ *  this is already used include the PPC4xx, PPC85xx, MPC52xx,
+ *  and MV64xxx parts.
+ *
+ *  This subsystem creates a standard OCP bus type within the
+ *  device model.  The devices on the OCP bus are seeded by an
+ *  an initial OCP device array created by the arch-specific
+ *  Device entries can be added/removed/modified through OCP
+ *  helper functions to accomodate system and  board-specific
+ *  parameters commonly found in embedded systems. OCP also
+ *  provides a standard method for devices to describe extended
+ *  attributes about themselves to the system.  A standard access
+ *  method allows OCP drivers to obtain the information, both
+ *  SoC-specific and system/board-specific, needed for operation.
+ */
+
+#include <linux/module.h>
+#include <linux/config.h>
+#include <linux/list.h>
+#include <linux/miscdevice.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/pm.h>
+#include <linux/bootmem.h>
+#include <linux/device.h>
+
+#include <asm/io.h>
+#include <asm/ocp.h>
+#include <asm/errno.h>
+#include <asm/rwsem.h>
+#include <asm/semaphore.h>
+
+//#define DBG(x)	printk x
+#define DBG(x)
+
+extern int mem_init_done;
+
+extern struct ocp_def core_ocp[];	/* Static list of devices, provided by
+					   CPU core */
+
+LIST_HEAD(ocp_devices);			/* List of all OCP devices */
+DECLARE_RWSEM(ocp_devices_sem);		/* Global semaphores for those lists */
+
+static int ocp_inited;
+
+/* Sysfs support */
+#define OCP_DEF_ATTR(field, format_string)				\
+static ssize_t								\
+show_##field(struct device *dev, char *buf)				\
+{									\
+	struct ocp_device *odev = to_ocp_dev(dev);			\
+									\
+	return sprintf(buf, format_string, odev->def->field);		\
+}									\
+static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
+
+OCP_DEF_ATTR(vendor, "0x%04x\n");
+OCP_DEF_ATTR(function, "0x%04x\n");
+OCP_DEF_ATTR(index, "0x%04x\n");
+#ifdef CONFIG_PTE_64BIT
+OCP_DEF_ATTR(paddr, "0x%016Lx\n");
+#else
+OCP_DEF_ATTR(paddr, "0x%08lx\n");
+#endif
+OCP_DEF_ATTR(irq, "%d\n");
+OCP_DEF_ATTR(pm, "%lu\n");
+
+void ocp_create_sysfs_dev_files(struct ocp_device *odev)
+{
+	struct device *dev = &odev->dev;
+
+	/* Current OCP device def attributes */
+	device_create_file(dev, &dev_attr_vendor);
+	device_create_file(dev, &dev_attr_function);
+	device_create_file(dev, &dev_attr_index);
+	device_create_file(dev, &dev_attr_paddr);
+	device_create_file(dev, &dev_attr_irq);
+	device_create_file(dev, &dev_attr_pm);
+	/* Current OCP device additions attributes */
+	if (odev->def->additions && odev->def->show)
+		odev->def->show(dev);
+}
+
+/**
+ *	ocp_device_match	-	Match one driver to one device
+ *	@drv: driver to match
+ *	@dev: device to match
+ *
+ *	This function returns 0 if the driver and device don't match
+ */
+static int
+ocp_device_match(struct device *dev, struct device_driver *drv)
+{
+	struct ocp_device *ocp_dev = to_ocp_dev(dev);
+	struct ocp_driver *ocp_drv = to_ocp_drv(drv);
+	const struct ocp_device_id *ids = ocp_drv->id_table;
+
+	if (!ids)
+		return 0;
+
+	while (ids->vendor || ids->function) {
+		if ((ids->vendor == OCP_ANY_ID
+		     || ids->vendor == ocp_dev->def->vendor)
+		    && (ids->function == OCP_ANY_ID
+			|| ids->function == ocp_dev->def->function))
+		        return 1;
+		ids++;
+	}
+	return 0;
+}
+
+static int
+ocp_device_probe(struct device *dev)
+{
+	int error = 0;
+	struct ocp_driver *drv;
+	struct ocp_device *ocp_dev;
+
+	drv = to_ocp_drv(dev->driver);
+	ocp_dev = to_ocp_dev(dev);
+
+	if (drv->probe) {
+		error = drv->probe(ocp_dev);
+		if (error >= 0) {
+			ocp_dev->driver = drv;
+			error = 0;
+		}
+	}
+	return error;
+}
+
+static int
+ocp_device_remove(struct device *dev)
+{
+	struct ocp_device *ocp_dev = to_ocp_dev(dev);
+
+	if (ocp_dev->driver) {
+		if (ocp_dev->driver->remove)
+			ocp_dev->driver->remove(ocp_dev);
+		ocp_dev->driver = NULL;
+	}
+	return 0;
+}
+
+static int
+ocp_device_suspend(struct device *dev, u32 state)
+{
+	struct ocp_device *ocp_dev = to_ocp_dev(dev);
+	struct ocp_driver *ocp_drv = to_ocp_drv(dev->driver);
+
+	if (dev->driver && ocp_drv->suspend)
+		return ocp_drv->suspend(ocp_dev, state);
+	return 0;
+}
+
+static int
+ocp_device_resume(struct device *dev)
+{
+	struct ocp_device *ocp_dev = to_ocp_dev(dev);
+	struct ocp_driver *ocp_drv = to_ocp_drv(dev->driver);
+
+	if (dev->driver && ocp_drv->resume)
+		return ocp_drv->resume(ocp_dev);
+	return 0;
+}
+
+struct bus_type ocp_bus_type = {
+	.name = "ocp",
+	.match = ocp_device_match,
+	.suspend = ocp_device_suspend,
+	.resume = ocp_device_resume,
+};
+
+/**
+ *	ocp_register_driver	-	Register an OCP driver
+ *	@drv: pointer to statically defined ocp_driver structure
+ *
+ *	The driver's probe() callback is called either recursively
+ *	by this function or upon later call of ocp_driver_init
+ *
+ *	NOTE: Detection of devices is a 2 pass step on this implementation,
+ *	hotswap isn't supported. First, all OCP devices are put in the device
+ *	list, _then_ all drivers are probed on each match.
+ */
+int
+ocp_register_driver(struct ocp_driver *drv)
+{
+	/* initialize common driver fields */
+	drv->driver.name = drv->name;
+	drv->driver.bus = &ocp_bus_type;
+	drv->driver.probe = ocp_device_probe;
+	drv->driver.remove = ocp_device_remove;
+
+	/* register with core */
+	return driver_register(&drv->driver);
+}
+
+/**
+ *	ocp_unregister_driver	-	Unregister an OCP driver
+ *	@drv: pointer to statically defined ocp_driver structure
+ *
+ *	The driver's remove() callback is called recursively
+ *	by this function for any device already registered
+ */
+void
+ocp_unregister_driver(struct ocp_driver *drv)
+{
+	DBG(("ocp: ocp_unregister_driver(%s)...\n", drv->name));
+
+	driver_unregister(&drv->driver);
+
+	DBG(("ocp: ocp_unregister_driver(%s)... done.\n", drv->name));
+}
+
+/* Core of ocp_find_device(). Caller must hold ocp_devices_sem */
+static struct ocp_device *
+__ocp_find_device(unsigned int vendor, unsigned int function, int index)
+{
+	struct list_head	*entry;
+	struct ocp_device	*dev, *found = NULL;
+
+	DBG(("ocp: __ocp_find_device(vendor: %x, function: %x, index: %d)...\n", vendor, function, index));
+
+	list_for_each(entry, &ocp_devices) {
+		dev = list_entry(entry, struct ocp_device, link);
+		if (vendor != OCP_ANY_ID && vendor != dev->def->vendor)
+			continue;
+		if (function != OCP_ANY_ID && function != dev->def->function)
+			continue;
+		if (index != OCP_ANY_INDEX && index != dev->def->index)
+			continue;
+		found = dev;
+		break;
+	}
+
+	DBG(("ocp: __ocp_find_device(vendor: %x, function: %x, index: %d)... done\n", vendor, function, index));
+
+	return found;
+}
+
+/**
+ *	ocp_find_device	-	Find a device by function & index
+ *      @vendor: vendor ID of the device (or OCP_ANY_ID)
+ *	@function: function code of the device (or OCP_ANY_ID)
+ *	@idx: index of the device (or OCP_ANY_INDEX)
+ *
+ *	This function allows a lookup of a given function by it's
+ *	index, it's typically used to find the MAL or ZMII associated
+ *	with an EMAC or similar horrors.
+ *      You can pass vendor, though you usually want OCP_ANY_ID there...
+ */
+struct ocp_device *
+ocp_find_device(unsigned int vendor, unsigned int function, int index)
+{
+	struct ocp_device	*dev;
+
+	down_read(&ocp_devices_sem);
+	dev = __ocp_find_device(vendor, function, index);
+	up_read(&ocp_devices_sem);
+
+	return dev;
+}
+
+/**
+ *	ocp_get_one_device -	Find a def by function & index
+ *      @vendor: vendor ID of the device (or OCP_ANY_ID)
+ *	@function: function code of the device (or OCP_ANY_ID)
+ *	@idx: index of the device (or OCP_ANY_INDEX)
+ *
+ *	This function allows a lookup of a given ocp_def by it's
+ *	vendor, function, and index.  The main purpose for is to
+ *	allow modification of the def before binding to the driver
+ */
+struct ocp_def *
+ocp_get_one_device(unsigned int vendor, unsigned int function, int index)
+{
+	struct ocp_device	*dev;
+	struct ocp_def		*found = NULL;
+
+	DBG(("ocp: ocp_get_one_device(vendor: %x, function: %x, index: %d)...\n",
+		vendor, function, index));
+
+	dev = ocp_find_device(vendor, function, index);
+
+	if (dev)
+		found = dev->def;
+
+	DBG(("ocp: ocp_get_one_device(vendor: %x, function: %x, index: %d)... done.\n",
+		vendor, function, index));
+
+	return found;
+}
+
+/**
+ *	ocp_add_one_device	-	Add a device
+ *	@def: static device definition structure
+ *
+ *	This function adds a device definition to the
+ *	device list. It may only be called before
+ *	ocp_driver_init() and will return an error
+ *	otherwise.
+ */
+int
+ocp_add_one_device(struct ocp_def *def)
+{
+	struct	ocp_device	*dev;
+
+	DBG(("ocp: ocp_add_one_device()...\n"));
+
+	/* Can't be called after ocp driver init */
+	if (ocp_inited)
+		return 1;
+
+	if (mem_init_done)
+		dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+	else
+		dev = alloc_bootmem(sizeof(*dev));
+
+	if (dev == NULL)
+		return 1;
+	memset(dev, 0, sizeof(*dev));
+	dev->def = def;
+	dev->current_state = 4;
+	sprintf(dev->name, "OCP device %04x:%04x:%04x",
+		dev->def->vendor, dev->def->function, dev->def->index);
+	down_write(&ocp_devices_sem);
+	list_add_tail(&dev->link, &ocp_devices);
+	up_write(&ocp_devices_sem);
+
+	DBG(("ocp: ocp_add_one_device()...done\n"));
+
+	return 0;
+}
+
+/**
+ *	ocp_remove_one_device -	Remove a device by function & index
+ *      @vendor: vendor ID of the device (or OCP_ANY_ID)
+ *	@function: function code of the device (or OCP_ANY_ID)
+ *	@idx: index of the device (or OCP_ANY_INDEX)
+ *
+ *	This function allows removal of a given function by its
+ *	index. It may only be called before ocp_driver_init()
+ *	and will return an error otherwise.
+ */
+int
+ocp_remove_one_device(unsigned int vendor, unsigned int function, int index)
+{
+	struct ocp_device *dev;
+
+	DBG(("ocp: ocp_remove_one_device(vendor: %x, function: %x, index: %d)...\n", vendor, function, index));
+
+	/* Can't be called after ocp driver init */
+	if (ocp_inited)
+		return 1;
+
+	down_write(&ocp_devices_sem);
+	dev = __ocp_find_device(vendor, function, index);
+	list_del((struct list_head *)dev);
+	up_write(&ocp_devices_sem);
+
+	DBG(("ocp: ocp_remove_one_device(vendor: %x, function: %x, index: %d)... done.\n", vendor, function, index));
+
+	return 0;
+}
+
+/**
+ *	ocp_for_each_device	-	Iterate over OCP devices
+ *	@callback: routine to execute for each ocp device.
+ *	@arg: user data to be passed to callback routine.
+ *
+ *	This routine holds the ocp_device semaphore, so the
+ *	callback routine cannot modify the ocp_device list.
+ */
+void
+ocp_for_each_device(void(*callback)(struct ocp_device *, void *arg), void *arg)
+{
+	struct list_head *entry;
+
+	if (callback) {
+		down_read(&ocp_devices_sem);
+		list_for_each(entry, &ocp_devices)
+			callback(list_entry(entry, struct ocp_device, link),
+				arg);
+		up_read(&ocp_devices_sem);
+	}
+}
+
+/**
+ *	ocp_early_init	-	Init OCP device management
+ *
+ *	This function builds the list of devices before setup_arch.
+ *	This allows platform code to modify the device lists before
+ *	they are bound to drivers (changes to paddr, removing devices
+ *	etc)
+ */
+int __init
+ocp_early_init(void)
+{
+	struct ocp_def	*def;
+
+	DBG(("ocp: ocp_early_init()...\n"));
+
+	/* Fill the devices list */
+	for (def = core_ocp; def->vendor != OCP_VENDOR_INVALID; def++)
+		ocp_add_one_device(def);
+
+	DBG(("ocp: ocp_early_init()... done.\n"));
+
+	return 0;
+}
+
+/**
+ *	ocp_driver_init	-	Init OCP device management
+ *
+ *	This function is meant to be called via OCP bus registration.
+ */
+static int __init
+ocp_driver_init(void)
+{
+	int ret = 0, index = 0;
+	struct device *ocp_bus;
+	struct list_head *entry;
+	struct ocp_device *dev;
+
+	if (ocp_inited)
+		return ret;
+	ocp_inited = 1;
+
+	DBG(("ocp: ocp_driver_init()...\n"));
+
+	/* Allocate/register primary OCP bus */
+	ocp_bus = kmalloc(sizeof(struct device), GFP_KERNEL);
+	if (ocp_bus == NULL)
+		return 1;
+	memset(ocp_bus, 0, sizeof(struct device));
+	strcpy(ocp_bus->bus_id, "ocp");
+
+	bus_register(&ocp_bus_type);
+
+	device_register(ocp_bus);
+
+	/* Put each OCP device into global device list */
+	list_for_each(entry, &ocp_devices) {
+		dev = list_entry(entry, struct ocp_device, link);
+		sprintf(dev->dev.bus_id, "%2.2x", index);
+		dev->dev.parent = ocp_bus;
+		dev->dev.bus = &ocp_bus_type;
+		device_register(&dev->dev);
+		ocp_create_sysfs_dev_files(dev);
+		index++;
+	}
+
+	DBG(("ocp: ocp_driver_init()... done.\n"));
+
+	return 0;
+}
+
+postcore_initcall(ocp_driver_init);
+
+EXPORT_SYMBOL(ocp_bus_type);
+EXPORT_SYMBOL(ocp_find_device);
+EXPORT_SYMBOL(ocp_register_driver);
+EXPORT_SYMBOL(ocp_unregister_driver);
diff -Nru a/arch/ppc/syslib/ppc405_pci.c b/arch/ppc/syslib/ppc405_pci.c
--- a/arch/ppc/syslib/ppc405_pci.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc/syslib/ppc405_pci.c	Tue Jun 15 22:20:42 2004
@@ -57,14 +57,6 @@
 		    )
 		    ) {
 
-			DBG(KERN_ERR "PCI: 0x%lx <= resource[%d] <= 0x%lx"
-			    ", bus 0x%x dev 0x%2.2x.%1.1x,\n"
-			    KERN_ERR "  %s\n"
-			    KERN_ERR "  fixup will be attempted later\n",
-			    min_host_addr, i, max_host_addr,
-			    dev->bus->number, PCI_SLOT(dev->devfn),
-			    PCI_FUNC(dev->devfn), dev->slot.name);
-
 			/* force pcibios_assign_resources() to assign a new address */
 			res->end -= res->start;
 			res->start = 0;
diff -Nru a/arch/ppc/syslib/ppc4xx_pic.c b/arch/ppc/syslib/ppc4xx_pic.c
--- a/arch/ppc/syslib/ppc4xx_pic.c	Tue Jun 15 22:20:35 2004
+++ b/arch/ppc/syslib/ppc4xx_pic.c	Tue Jun 15 22:20:35 2004
@@ -142,9 +142,12 @@
 #ifndef UIC1
 #define UIC1 UIC0
 #endif
+#ifndef UIC2
+#define UIC2 UIC1
+#endif
 
 static void
-ppc405_uic_enable(unsigned int irq)
+ppc4xx_uic_enable(unsigned int irq)
 {
 	int bit, word;
 	irq_desc_t *desc = irq_desc + irq;
@@ -153,7 +156,7 @@
 	word = irq >> 5;
 
 #ifdef UIC_DEBUG
-	printk("ppc405_uic_enable - irq %d word %d bit 0x%x\n", irq, word, bit);
+	printk("ppc4xx_uic_enable - irq %d word %d bit 0x%x\n", irq, word, bit);
 #endif
 	ppc_cached_irq_mask[word] |= 1 << (31 - bit);
 	switch (word) {
@@ -162,38 +165,35 @@
 		if ((mfdcr(DCRN_UIC_TR(UIC0)) & (1 << (31 - bit))) == 0)
 			desc->status |= IRQ_LEVEL;
 		else
-		/* lets hope this works since in linux/irq.h
-		 * there is no define for EDGE and it's assumed
-		 * once you set status to LEVEL you would not
-		 * want to change it - Armin
-		 */
-		desc->status = desc->status & ~IRQ_LEVEL;
+			desc->status = desc->status & ~IRQ_LEVEL;
 		break;
 	case 1:
 		mtdcr(DCRN_UIC_ER(UIC1), ppc_cached_irq_mask[word]);
 		if ((mfdcr(DCRN_UIC_TR(UIC1)) & (1 << (31 - bit))) == 0)
 			desc->status |= IRQ_LEVEL;
 		else
-		/* lets hope this works since in linux/irq.h
-		 * there is no define for EDGE and it's assumed
-		 * once you set status to LEVEL you would not
-		 * want to change it - Armin
-		 */
-		desc->status = desc->status & ~IRQ_LEVEL;
-	break;
+			desc->status = desc->status & ~IRQ_LEVEL;
+		break;
+	case 2:
+		mtdcr(DCRN_UIC_ER(UIC2), ppc_cached_irq_mask[word]);
+		if ((mfdcr(DCRN_UIC_TR(UIC2)) & (1 << (31 - bit))) == 0)
+			desc->status |= IRQ_LEVEL;
+		else
+			desc->status = desc->status & ~IRQ_LEVEL;
+		break;
 	}
 
 }
 
 static void
-ppc405_uic_disable(unsigned int irq)
+ppc4xx_uic_disable(unsigned int irq)
 {
 	int bit, word;
 
 	bit = irq & 0x1f;
 	word = irq >> 5;
 #ifdef UIC_DEBUG
-	printk("ppc405_uic_disable - irq %d word %d bit 0x%x\n", irq, word,
+	printk("ppc4xx_uic_disable - irq %d word %d bit 0x%x\n", irq, word,
 	       bit);
 #endif
 	ppc_cached_irq_mask[word] &= ~(1 << (31 - bit));
@@ -204,11 +204,14 @@
 	case 1:
 		mtdcr(DCRN_UIC_ER(UIC1), ppc_cached_irq_mask[word]);
 		break;
+	case 2:
+		mtdcr(DCRN_UIC_ER(UIC2), ppc_cached_irq_mask[word]);
+		break;
 	}
 }
 
 static void
-ppc405_uic_disable_and_ack(unsigned int irq)
+ppc4xx_uic_disable_and_ack(unsigned int irq)
 {
 	int bit, word;
 
@@ -216,7 +219,7 @@
 	word = irq >> 5;
 
 #ifdef UIC_DEBUG
-	printk("ppc405_uic_disable_and_ack - irq %d word %d bit 0x%x\n", irq,
+	printk("ppc4xx_uic_disable_and_ack - irq %d word %d bit 0x%x\n", irq,
 	       word, bit);
 #endif
 	ppc_cached_irq_mask[word] &= ~(1 << (31 - bit));
@@ -224,16 +227,30 @@
 	case 0:
 		mtdcr(DCRN_UIC_ER(UIC0), ppc_cached_irq_mask[word]);
 		mtdcr(DCRN_UIC_SR(UIC0), (1 << (31 - bit)));
+#if (NR_UICS > 2)
+		mtdcr(DCRN_UIC_SR(UICB), UICB_UIC0NC);
+#endif
 		break;
 	case 1:
 		mtdcr(DCRN_UIC_ER(UIC1), ppc_cached_irq_mask[word]);
 		mtdcr(DCRN_UIC_SR(UIC1), (1 << (31 - bit)));
+#if (NR_UICS > 2)
+		mtdcr(DCRN_UIC_SR(UICB), UICB_UIC1NC);
+#endif
+		break;
+	case 2:
+		mtdcr(DCRN_UIC_ER(UIC2), ppc_cached_irq_mask[word]);
+		mtdcr(DCRN_UIC_SR(UIC2), (1 << (31 - bit)));
+#if (NR_UICS > 2)
+		mtdcr(DCRN_UIC_SR(UICB), UICB_UIC2NC);
+#endif
 		break;
 	}
+
 }
 
 static void
-ppc405_uic_end(unsigned int irq)
+ppc4xx_uic_end(unsigned int irq)
 {
 	int bit, word;
 	unsigned int tr_bits;
@@ -242,7 +259,7 @@
 	word = irq >> 5;
 
 #ifdef UIC_DEBUG
-	printk("ppc405_uic_end - irq %d word %d bit 0x%x\n", irq, word, bit);
+	printk("ppc4xx_uic_end - irq %d word %d bit 0x%x\n", irq, word, bit);
 #endif
 
 	switch (word) {
@@ -252,6 +269,9 @@
 	case 1:
 		tr_bits = mfdcr(DCRN_UIC_TR(UIC1));
 		break;
+	case 2:
+		tr_bits = mfdcr(DCRN_UIC_TR(UIC2));
+		break;
 	}
 
 	if ((tr_bits & (1 << (31 - bit))) == 0) {
@@ -259,9 +279,21 @@
 		switch (word) {
 		case 0:
 			mtdcr(DCRN_UIC_SR(UIC0), 1 << (31 - bit));
+#if (NR_UICS > 2)
+			mtdcr(DCRN_UIC_SR(UICB),  UICB_UIC0NC);
+#endif
 			break;
 		case 1:
 			mtdcr(DCRN_UIC_SR(UIC1), 1 << (31 - bit));
+#if (NR_UICS > 2)
+			mtdcr(DCRN_UIC_SR(UICB),  UICB_UIC1NC);
+#endif
+			break;
+		case 2:
+			mtdcr(DCRN_UIC_SR(UIC2), 1 << (31 - bit));
+#if (NR_UICS > 2)
+			mtdcr(DCRN_UIC_SR(UICB),  UICB_UIC2NC);
+#endif
 			break;
 		}
 	}
@@ -275,11 +307,14 @@
 		case 1:
 			mtdcr(DCRN_UIC_ER(UIC1), ppc_cached_irq_mask[word]);
 			break;
+		case 2:
+			mtdcr(DCRN_UIC_ER(UIC2), ppc_cached_irq_mask[word]);
+			break;
 		}
 	}
 }
 
-static struct hw_interrupt_type ppc405_uic = {
+static struct hw_interrupt_type ppc4xx_uic = {
 #if (NR_UICS == 1)
 	"IBM UIC",
 #else
@@ -287,15 +322,15 @@
 #endif
 	NULL,
 	NULL,
-	ppc405_uic_enable,
-	ppc405_uic_disable,
-	ppc405_uic_disable_and_ack,
-	ppc405_uic_end,
+	ppc4xx_uic_enable,
+	ppc4xx_uic_disable,
+	ppc4xx_uic_disable_and_ack,
+	ppc4xx_uic_end,
 	0
 };
 
 int
-ppc405_pic_get_irq(struct pt_regs *regs)
+ppc4xx_pic_get_irq(struct pt_regs *regs)
 {
 	int irq, cas_irq;
 	unsigned long bits;
@@ -305,9 +340,25 @@
 	 * enabled.
 	 */
 
+#if (NR_UICS > 2)
+	bits = mfdcr(DCRN_UIC_MSR(UICB));
+#else
 	bits = mfdcr(DCRN_UIC_MSR(UIC0));
-
-#if (NR_UICS > 1)
+#endif
+#if (NR_UICS > 2)
+	if (bits & UICB_UIC0NC) {
+		bits = mfdcr(DCRN_UIC_MSR(UIC0));
+		irq = 32 - ffs(bits);
+	} else if (bits & UICB_UIC1NC) {
+		bits = mfdcr(DCRN_UIC_MSR(UIC1));
+		irq = 64 - ffs(bits);
+	} else if (bits & UICB_UIC2NC) {
+		bits = mfdcr(DCRN_UIC_MSR(UIC2));
+		irq = 96 - ffs(bits);
+	} else {
+		irq = -1;
+	}
+#elif (NR_UICS > 1)
 	if (bits & UIC_CASCADE_MASK) {
 		bits = mfdcr(DCRN_UIC_MSR(UIC1));
 		cas_irq = 32 - ffs(bits);
@@ -330,7 +381,7 @@
 		irq = -1;
 
 #ifdef UIC_DEBUG
-	printk("ppc405_pic_get_irq - irq %d bit 0x%x\n", irq, bits);
+	printk("ppc4xx_pic_get_irq - irq %d bit 0x%x\n", irq, bits);
 #endif
 
 	return (irq);
@@ -354,8 +405,10 @@
 	unsigned long ppc_cached_pol_mask[NR_MASK_WORDS];
 	ppc_cached_sense_mask[0] = 0;
 	ppc_cached_sense_mask[1] = 0;
+	ppc_cached_sense_mask[2] = 0;
 	ppc_cached_pol_mask[0] = 0;
 	ppc_cached_pol_mask[1] = 0;
+	ppc_cached_pol_mask[2] = 0;
 
 	for (irq = 0; irq < NR_IRQS; irq++) {
 
@@ -398,6 +451,18 @@
 			mtdcr(DCRN_UIC_TR(UIC1), ppc_cached_sense_mask[word]);
 
 			break;
+		case 2:
+#ifdef PPC4xx_PIC_DEBUG
+			printk("Pol %x ", mfdcr(DCRN_UIC_PR(UIC2)));
+			printk("Level %x\n", mfdcr(DCRN_UIC_TR(UIC2)));
+#endif
+			/* polarity  setting */
+			mtdcr(DCRN_UIC_PR(UIC2), ppc_cached_pol_mask[word]);
+
+			/* Level setting */
+			mtdcr(DCRN_UIC_TR(UIC2), ppc_cached_sense_mask[word]);
+
+			break;
 		}
 	}
 
@@ -405,13 +470,13 @@
 void __init
 ppc4xx_pic_init(void)
 {
-
 	/*
 	 * Disable all external interrupts until they are
 	 * explicity requested.
 	 */
 	ppc_cached_irq_mask[0] = 0;
 	ppc_cached_irq_mask[1] = 0;
+	ppc_cached_irq_mask[2] = 0;
 
 #if defined CONFIG_403
 	mtdcr(DCRN_EXIER, ppc_cached_irq_mask[0]);
@@ -419,11 +484,21 @@
 	ppc4xx_pic = &ppc403_aic;
 	ppc_md.get_irq = ppc403_pic_get_irq;
 #else
+#if  (NR_UICS > 2)
+	mtdcr(DCRN_UIC_ER(UICB), UICB_UIC0NC | UICB_UIC1NC | UICB_UIC2NC);
+	mtdcr(DCRN_UIC_CR(UICB), 0);
+
+	mtdcr(DCRN_UIC_ER(UIC2), ppc_cached_irq_mask[2]);
+	mtdcr(DCRN_UIC_CR(UIC2), 0);
+
+#endif
 #if  (NR_UICS > 1)
-	ppc_cached_irq_mask[0] |= 1 << (31 - UIC0_UIC1NC);	/* enable cascading interrupt */
+#if  (NR_UICS == 2)
+	/* enable cascading interrupt */
+	ppc_cached_irq_mask[0] |= 1 << (31 - UIC0_UIC1NC);
+#endif
 	mtdcr(DCRN_UIC_ER(UIC1), ppc_cached_irq_mask[1]);
 	mtdcr(DCRN_UIC_CR(UIC1), 0);
-
 #endif
 	mtdcr(DCRN_UIC_ER(UIC0), ppc_cached_irq_mask[0]);
 	mtdcr(DCRN_UIC_CR(UIC0), 0);
@@ -432,13 +507,16 @@
 		ppc4xx_extpic_init();
 
 	/* Clear any pending interrupts */
+#if (NR_UICS > 2)
+	mtdcr(DCRN_UIC_SR(UICB), 0xffffffff);
+	mtdcr(DCRN_UIC_SR(UIC2), 0xffffffff);
+#endif
 #if (NR_UICS > 1)
 	mtdcr(DCRN_UIC_SR(UIC1), 0xffffffff);
 #endif
 	mtdcr(DCRN_UIC_SR(UIC0), 0xffffffff);
 
-	ppc4xx_pic = &ppc405_uic;
-	ppc_md.get_irq = ppc405_pic_get_irq;
+	ppc4xx_pic = &ppc4xx_uic;
+	ppc_md.get_irq = ppc4xx_pic_get_irq;
 #endif
-
 }
diff -Nru a/arch/ppc/syslib/ppc8xx_pic.h b/arch/ppc/syslib/ppc8xx_pic.h
--- a/arch/ppc/syslib/ppc8xx_pic.h	Tue Jun 15 22:20:39 2004
+++ b/arch/ppc/syslib/ppc8xx_pic.h	Tue Jun 15 22:20:39 2004
@@ -3,6 +3,7 @@
 
 #include <linux/config.h>
 #include <linux/irq.h>
+#include <linux/interrupt.h>
 
 extern struct hw_interrupt_type ppc8xx_pic;
 
diff -Nru a/arch/ppc/syslib/prom_init.c b/arch/ppc/syslib/prom_init.c
--- a/arch/ppc/syslib/prom_init.c	Tue Jun 15 22:21:04 2004
+++ b/arch/ppc/syslib/prom_init.c	Tue Jun 15 22:21:04 2004
@@ -800,8 +800,7 @@
 
 	/* First get a handle for the stdout device */
 	prom = pp;
-	prom_chosen = call_prom("finddevice", 1, 1,
-				       "/chosen");
+	prom_chosen = call_prom("finddevice", 1, 1, "/chosen");
 	if (prom_chosen == (void *)-1)
 		prom_exit();
 	if ((int) call_prom("getprop", 4, 1, prom_chosen,
diff -Nru a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
--- a/arch/ppc64/Kconfig	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc64/Kconfig	Tue Jun 15 22:20:41 2004
@@ -49,6 +49,10 @@
 
 source "init/Kconfig"
 
+config SYSVIPC_COMPAT
+	bool
+	depends on COMPAT && SYSVIPC
+	default y
 
 menu "Platform support"
 
@@ -89,6 +93,16 @@
 	bool "Apple PowerMac G5 support"
 	select ADB_PMU
 
+config PPC_SPLPAR
+	depends on PPC_PSERIES
+	bool "Support for shared-processor logical partitions"
+	default n
+	help
+	  Enabling this option will make the kernel run more efficiently
+	  on logically-partitioned pSeries systems which use shared
+	  processors, that is, which share physical processors between
+	  two or more partitions.
+
 config PMAC_DART
 	bool "Enable DART/IOMMU on PowerMac (allow >2G of RAM)"
 	depends on PPC_PMAC
@@ -173,6 +187,15 @@
 	bool "NUMA support"
 	depends on DISCONTIGMEM
 
+config SCHED_SMT
+	bool "SMT (Hyperthreading) scheduler support"
+	depends on SMP
+	default off
+	help
+	  SMT scheduler support improves the CPU scheduler's decision making
+	  when dealing with POWER5 cpus at a cost of slightly increased
+	  overhead in some places. If unsure say N here.
+
 config PREEMPT
 	bool "Preemptible Kernel"
 	depends on BROKEN
@@ -394,8 +417,25 @@
 	  debugging info resulting in a larger kernel image.
 	  Say Y here only if you plan to use gdb to debug the kernel.
 	  If you don't debug the kernel, you can say N.
+
+config IRQSTACKS
+	bool "Use separate kernel stacks when processing interrupts"
+	help
+	  If you say Y here the kernel will use separate kernel stacks
+	  for handling hard and soft interrupts.  This can help avoid
+	  overflowing the process kernel stacks.
 	  
 endmenu
+
+config SPINLINE
+	bool "Inline spinlock code at each call site"
+	depends on SMP && !PPC_SPLPAR && !PPC_ISERIES
+	help
+	  Say Y if you want to have the code for acquiring spinlocks
+	  and rwlocks inlined at each call site.  This makes the kernel
+	  somewhat bigger, but can be useful when profiling the kernel.
+
+	  If in doubt, say N.
 
 source "security/Kconfig"
 
diff -Nru a/arch/ppc64/Makefile b/arch/ppc64/Makefile
--- a/arch/ppc64/Makefile	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc64/Makefile	Tue Jun 15 22:20:37 2004
@@ -17,11 +17,12 @@
 
 HAS_BIARCH      := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi;)
 ifeq ($(HAS_BIARCH),y)
-AS              := $(AS) -64
+AS              := $(AS) -a64
 LD              := $(LD) -m elf64ppc
 CC		:= $(CC) -m64
-CHECK		:= $(CHECK) -m64
 endif
+
+CHECK		:= $(CHECK) -m64 -D__powerpc__=1
 
 LDFLAGS		:= -m elf64ppc
 LDFLAGS_vmlinux	:= -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
diff -Nru a/arch/ppc64/configs/iSeries_defconfig b/arch/ppc64/configs/iSeries_defconfig
--- a/arch/ppc64/configs/iSeries_defconfig	Tue Jun 15 22:21:05 2004
+++ b/arch/ppc64/configs/iSeries_defconfig	Tue Jun 15 22:21:05 2004
@@ -23,19 +23,23 @@
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=17
 CONFIG_HOTPLUG=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
-CONFIG_EMBEDDED=y
+# CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -48,6 +52,7 @@
 # CONFIG_MODVERSIONS is not set
 # CONFIG_KMOD is not set
 CONFIG_STOP_MACHINE=y
+CONFIG_SYSVIPC_COMPAT=y
 
 #
 # Platform support
@@ -60,6 +65,7 @@
 # CONFIG_IOMMU_VMERGE is not set
 CONFIG_SMP=y
 CONFIG_NR_CPUS=32
+# CONFIG_SCHED_SMT is not set
 CONFIG_MSCHUNKS=y
 CONFIG_LPARCFG=y
 
@@ -72,6 +78,7 @@
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
+# CONFIG_HOTPLUG_CPU is not set
 
 #
 # PCMCIA/CardBus support
@@ -148,7 +155,6 @@
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 CONFIG_SCSI_MULTI_LUN=y
-CONFIG_SCSI_REPORT_LUNS=y
 CONFIG_SCSI_CONSTANTS=y
 # CONFIG_SCSI_LOGGING is not set
 
@@ -180,6 +186,7 @@
 # CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_INIA100 is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
+# CONFIG_SCSI_IPR is not set
 # CONFIG_SCSI_QLOGIC_ISP is not set
 # CONFIG_SCSI_QLOGIC_FC is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
@@ -221,6 +228,7 @@
 #
 # I2O device support
 #
+# CONFIG_I2O is not set
 
 #
 # Macintosh device drivers
@@ -247,7 +255,6 @@
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
 # CONFIG_ARPD is not set
-CONFIG_INET_ECN=y
 CONFIG_SYN_COOKIES=y
 CONFIG_INET_AH=m
 CONFIG_INET_ESP=m
@@ -258,8 +265,6 @@
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -319,16 +324,18 @@
 CONFIG_IP_NF_ARP_MANGLE=m
 CONFIG_IP_NF_COMPAT_IPCHAINS=m
 CONFIG_IP_NF_COMPAT_IPFWADM=m
+# CONFIG_IP_NF_RAW is not set
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 CONFIG_LLC=y
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
@@ -350,16 +357,23 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+CONFIG_NETPOLL=y
+CONFIG_NETPOLL_RX=y
+CONFIG_NETPOLL_TRAP=y
+CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+CONFIG_DUMMY=m
+CONFIG_BONDING=m
+# CONFIG_EQUALIZER is not set
+CONFIG_TUN=m
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-# CONFIG_EQUALIZER is not set
-CONFIG_TUN=m
 
 #
 # Ethernet (10 or 100Mbit)
@@ -397,43 +411,9 @@
 # CONFIG_VIA_RHINE is not set
 
 #
-# Ethernet (1000 Mbit)
+# Gigabit Ethernet (1000/10000 Mbit)
 #
-CONFIG_ACENIC=y
-CONFIG_ACENIC_OMIT_TIGON_I=y
-# CONFIG_DL2K is not set
-CONFIG_E1000=y
-# CONFIG_E1000_NAPI is not set
-# CONFIG_NS83820 is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_TIGON3 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-CONFIG_IXGB=m
-# CONFIG_IXGB_NAPI is not set
-# CONFIG_VETH is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=m
-# CONFIG_PPP_MULTILINK is not set
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_NET_GIGE is not set
 
 #
 # Token Ring devices
@@ -443,33 +423,31 @@
 # CONFIG_IBMLS is not set
 # CONFIG_3C359 is not set
 # CONFIG_TMS380TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-CONFIG_NETCONSOLE=y
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
 
 #
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-CONFIG_NETPOLL=y
-CONFIG_NETPOLL_RX=y
-CONFIG_NETPOLL_TRAP=y
-CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_WAN is not set
+CONFIG_ISERIES_VETH=y
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PPP=m
+# CONFIG_PPP_MULTILINK is not set
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+CONFIG_NETCONSOLE=y
 
 #
 # ISDN subsystem
@@ -489,7 +467,10 @@
 #
 # Userland interfaces
 #
-# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
 # CONFIG_INPUT_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
@@ -518,7 +499,6 @@
 #
 # Character devices
 #
-# CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -532,11 +512,6 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -618,6 +593,7 @@
 CONFIG_REISERFS_FS=y
 # CONFIG_REISERFS_CHECK is not set
 # CONFIG_REISERFS_PROC_INFO is not set
+# CONFIG_REISERFS_FS_XATTR is not set
 CONFIG_JFS_FS=y
 CONFIG_JFS_POSIX_ACL=y
 # CONFIG_JFS_DEBUG is not set
@@ -655,6 +631,7 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
 # CONFIG_DEVPTS_FS_SECURITY is not set
@@ -695,10 +672,11 @@
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_SUNRPC=y
-CONFIG_SUNRPC_GSS=m
-CONFIG_RPCSEC_GSS_KRB5=m
+CONFIG_SUNRPC_GSS=y
+CONFIG_RPCSEC_GSS_KRB5=y
 # CONFIG_SMB_FS is not set
 CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
@@ -757,8 +735,8 @@
 #
 CONFIG_VIOCONS=y
 CONFIG_VIODASD=y
-CONFIG_VIOCD=y
-# CONFIG_VIOTAPE is not set
+CONFIG_VIOCD=m
+CONFIG_VIOTAPE=m
 CONFIG_VIOPATH=y
 
 #
@@ -778,6 +756,7 @@
 # CONFIG_DEBUGGER is not set
 # CONFIG_PPCDBG is not set
 # CONFIG_DEBUG_INFO is not set
+# CONFIG_IRQSTACKS is not set
 
 #
 # Security options
@@ -791,11 +770,11 @@
 CONFIG_CRYPTO_HMAC=y
 CONFIG_CRYPTO_NULL=m
 CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=m
+CONFIG_CRYPTO_MD5=y
 CONFIG_CRYPTO_SHA1=m
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_DES=m
+CONFIG_CRYPTO_DES=y
 CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_SERPENT=m
@@ -804,11 +783,14 @@
 CONFIG_CRYPTO_CAST6=m
 CONFIG_CRYPTO_ARC4=m
 CONFIG_CRYPTO_DEFLATE=m
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_CRC32C is not set
 CONFIG_CRYPTO_TEST=m
 
 #
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
diff -Nru a/arch/ppc64/kernel/HvLpEvent.c b/arch/ppc64/kernel/HvLpEvent.c
--- a/arch/ppc64/kernel/HvLpEvent.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc64/kernel/HvLpEvent.c	Tue Jun 15 22:20:40 2004
@@ -8,6 +8,7 @@
  */
 #include <linux/stddef.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <asm/system.h>
 #include <asm/iSeries/HvLpEvent.h>
 #include <asm/iSeries/HvCallEvent.h>
@@ -41,6 +42,8 @@
 	}
 	return rc;
 }
+EXPORT_SYMBOL(HvLpEvent_registerHandler);
+EXPORT_SYMBOL(HvLpEvent_unregisterHandler);
 
 /* (lpIndex is the partition index of the target partition.  
  * needed only for VirtualIo, VirtualLan and SessionMgr.  Zero
diff -Nru a/arch/ppc64/kernel/align.c b/arch/ppc64/kernel/align.c
--- a/arch/ppc64/kernel/align.c	Tue Jun 15 22:21:05 2004
+++ b/arch/ppc64/kernel/align.c	Tue Jun 15 22:21:05 2004
@@ -215,8 +215,9 @@
 	unsigned long i;
 	int ret;
 	unsigned dsisr;
-	unsigned char *addr, *p;
-	unsigned long *lp;
+	unsigned char __user *addr;
+	unsigned char __user *p;
+	unsigned long __user *lp;
 	union {
 		long ll;
 		double dd;
@@ -241,9 +242,9 @@
 
 	if (cur_cpu_spec->cpu_features & CPU_FTR_NODSISRALIGN) {
 	    unsigned int real_instr;
-	    if (__get_user(real_instr, (unsigned int *)regs->nip))
+	    if (__get_user(real_instr, (unsigned int __user *)regs->nip))
 		return 0;
-	    dsisr = make_dsisr(*((unsigned *)regs->nip));
+	    dsisr = make_dsisr(real_instr);
 	}
 
 	/* extract the operation and registers from the dsisr */
@@ -257,7 +258,7 @@
 	flags = aligninfo[instr].flags;
 
 	/* DAR has the operand effective address */
-	addr = (unsigned char *)regs->dar;
+	addr = (unsigned char __user *)regs->dar;
 
 	/* A size of 0 indicates an instruction we don't support */
 	/* we also don't support the multiples (lmw, stmw, lmd, stmd) */
@@ -270,7 +271,7 @@
 	 * storage
 	 */
 	if (instr == DCBZ)
-		addr = (unsigned char *) ((unsigned long)addr & -L1_CACHE_BYTES);
+		addr = (unsigned char __user *) ((unsigned long)addr & -L1_CACHE_BYTES);
 
 	/* Verify the address of the operand */
 	if (user_mode(regs)) {
@@ -360,7 +361,7 @@
 		p = addr;
 		switch (nb) {
 		case 128:	/* Special case - must be dcbz */
-			lp = (unsigned long *)p;
+			lp = (unsigned long __user *)p;
 			for (i = 0; i < L1_CACHE_BYTES / sizeof(long); ++i)
 				ret |= __put_user(0, lp++);
 			break;
diff -Nru a/arch/ppc64/kernel/asm-offsets.c b/arch/ppc64/kernel/asm-offsets.c
--- a/arch/ppc64/kernel/asm-offsets.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc64/kernel/asm-offsets.c	Tue Jun 15 22:20:42 2004
@@ -73,7 +73,6 @@
         DEFINE(ICACHEL1LINESIZE, offsetof(struct systemcfg, iCacheL1LineSize));
         DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct naca_struct, iCacheL1LogLineSize));
         DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct naca_struct, iCacheL1LinesPerPage));
-	DEFINE(SLBSIZE, offsetof(struct naca_struct, slb_size));
 	DEFINE(PLATFORM, offsetof(struct systemcfg, platform));
 
 	/* paca */
diff -Nru a/arch/ppc64/kernel/cpu_setup_power4.S b/arch/ppc64/kernel/cpu_setup_power4.S
--- a/arch/ppc64/kernel/cpu_setup_power4.S	Tue Jun 15 22:20:36 2004
+++ b/arch/ppc64/kernel/cpu_setup_power4.S	Tue Jun 15 22:20:36 2004
@@ -119,7 +119,9 @@
 	/* We only deal with 970 for now */
 	mfspr	r0,SPRN_PVR
 	srwi	r0,r0,16
-	cmpwi	r0,0x39
+	cmpwi	cr0,r0,0x39
+	cmpwi	cr1,r0,0x3c
+	cror	4*cr0+eq,4*cr0+eq,4*cr1+eq
 	bne	1f
 
 	/* Save HID0,1,4 and 5 */
@@ -149,7 +151,9 @@
 	/* We only deal with 970 for now */
 	mfspr	r0,SPRN_PVR
 	srwi	r0,r0,16
-	cmpwi	r0,0x39
+	cmpwi	cr0,r0,0x39
+	cmpwi	cr1,r0,0x3c
+	cror	4*cr0+eq,4*cr0+eq,4*cr1+eq
 	bne	1f
 
 	/* Clear interrupt prefix */
diff -Nru a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
--- a/arch/ppc64/kernel/eeh.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc64/kernel/eeh.c	Tue Jun 15 22:20:42 2004
@@ -612,33 +612,25 @@
 }
 
 /**
- * eeh_add_device - perform EEH initialization for the indicated pci device
- * @dev: pci device for which to set up EEH
+ * eeh_add_device_early - enable EEH for the indicated device_node
+ * @dn: device node for which to set up EEH
  *
- * This routine can be used to perform EEH initialization for PCI
+ * This routine must be used to perform EEH initialization for PCI
  * devices that were added after system boot (e.g. hotplug, dlpar).
+ * This routine must be called before any i/o is performed to the
+ * adapter (inluding any config-space i/o).
  * Whether this actually enables EEH or not for this device depends
- * on the type of the device, on earlier boot command-line
- * arguments & etc.
+ * on the CEC architecture, type of the device, on earlier boot
+ * command-line arguments & etc.
  */
-void eeh_add_device(struct pci_dev *dev)
+void eeh_add_device_early(struct device_node *dn)
 {
-	struct device_node *dn;
 	struct pci_controller *phb;
 	struct eeh_early_enable_info info;
 
-	if (!dev || !eeh_subsystem_enabled)
+	if (!dn || !eeh_subsystem_enabled)
 		return;
-
-#ifdef DEBUG
-	printk(KERN_DEBUG "EEH: adding device %s %s\n", pci_name(dev),
-	       pci_pretty_name(dev));
-#endif
-	dn = pci_device_to_OF_node(dev);
-	if (NULL == dn)
-		return;
-
-	phb = PCI_GET_PHB_PTR(dev);
+	phb = dn->phb;
 	if (NULL == phb || 0 == phb->buid) {
 		printk(KERN_WARNING "EEH: Expected buid but found none\n");
 		return;
@@ -646,11 +638,30 @@
 
 	info.buid_hi = BUID_HI(phb->buid);
 	info.buid_lo = BUID_LO(phb->buid);
-
 	early_enable_eeh(dn, &info);
+}
+EXPORT_SYMBOL(eeh_add_device_early);
+
+/**
+ * eeh_add_device_late - perform EEH initialization for the indicated pci device
+ * @dev: pci device for which to set up EEH
+ *
+ * This routine must be used to complete EEH initialization for PCI
+ * devices that were added after system boot (e.g. hotplug, dlpar).
+ */
+void eeh_add_device_late(struct pci_dev *dev)
+{
+	if (!dev || !eeh_subsystem_enabled)
+		return;
+
+#ifdef DEBUG
+	printk(KERN_DEBUG "EEH: adding device %s %s\n", pci_name(dev),
+	       pci_pretty_name(dev));
+#endif
+
 	pci_addr_cache_insert_device (dev);
 }
-EXPORT_SYMBOL(eeh_add_device);
+EXPORT_SYMBOL(eeh_add_device_late);
 
 /**
  * eeh_remove_device - undo EEH setup for the indicated pci device
diff -Nru a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
--- a/arch/ppc64/kernel/head.S	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc64/kernel/head.S	Tue Jun 15 22:20:40 2004
@@ -265,6 +265,9 @@
 	mfspr	r23,SPRG2;		/* Save r20 in exc. frame      */ \
 	std	r23,EX_R20(r21);	                                  \
                                                                          \
+	mfmsr	r22;			    /* set MSR.RI		   */ \
+	ori	r22,r22,MSR_RI;						      \
+	mtmsrd	r22,1;							      \
 	mfcr    r23;                        /* save CR in r23              */
 
 /*
@@ -923,8 +926,8 @@
 	stb	r0,PACAPROCENABLED(r20)	/* Soft Disabled */
 
 	mfmsr	r0
-	ori	r0,r0,MSR_EE+MSR_RI
-	mtmsrd	r0			/* Hard Enable, RI on */
+	ori	r0,r0,MSR_EE
+	mtmsrd	r0,1			/* Hard Enable */
 #endif
 
 	/*
@@ -943,9 +946,9 @@
 	 */
 	mfmsr	r0
 	li	r4,0
-	ori	r4,r4,MSR_EE+MSR_RI
+	ori	r4,r4,MSR_EE
 	andc	r0,r0,r4
-	mtmsrd	r0			/* Hard Disable, RI off */
+	mtmsrd	r0,1			/* Hard Disable */
 
 	ld	r0,SOFTE(r1)
 	cmpdi	0,r0,0			/* See if we will soft enable in */
@@ -1120,13 +1123,11 @@
 	 */
 
 	/* r20 = paca */
-	/* use a cpu feature mask if we ever change our slb size */
-SLB_NUM_ENTRIES = 64
 1:	ld	r22,PACASTABRR(r20)
 	addi	r21,r22,1
 	cmpdi	r21,SLB_NUM_ENTRIES
 	blt+	2f
-	li	r21,1			/* dont touch bolted slot 0 */
+	li	r21,2			/* dont touch slot 0 or 1 */
 2:	std	r21,PACASTABRR(r20)
 
 	/* r20 = paca, r22 = entry */
@@ -1278,6 +1279,10 @@
 	SAVE_4GPRS(16, r1)
 	SAVE_8GPRS(24, r1)
 
+	/* Set the marker value "regshere" just before the reg values */
+	SET_REG_TO_CONST(r22, 0x7265677368657265)
+	std	r22,STACK_FRAME_OVERHEAD-16(r1)
+
 	/*
 	 * Clear the RESULT field
 	 */
@@ -1948,21 +1953,6 @@
 	li      r12,1
 	rldicr  r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
 	or      r11,r11,r12
-	mtmsrd  r11
-	isync
-	blr
-
-/*
- * This subroutine clobbers r11, r12 and the LR
- */
-_GLOBAL(enable_32b_mode)
-	mfmsr   r11                      /* grab the current MSR */
-	li      r12,1
-	rldicr  r12,r12,MSR_SF_LG,(63-MSR_SF_LG)
-	andc	r11,r11,r12
-	li      r12,1
-	rldicr  r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
-	andc	r11,r11,r12
 	mtmsrd  r11
 	isync
 	blr
diff -Nru a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c
--- a/arch/ppc64/kernel/iSeries_setup.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc64/kernel/iSeries_setup.c	Tue Jun 15 22:20:43 2004
@@ -563,11 +563,6 @@
 	lmb_add(0, systemcfg->physicalMemorySize);
 	lmb_analyze();	/* ?? */
 	lmb_reserve(0, __pa(klimit));
-
-	/* 
-	 * Hardcode to GP size.  I am not sure where to get this info. DRENG
-	 */
-	naca->slb_size = 64;
 }
 
 /*
@@ -858,3 +853,12 @@
 		}
 	}
 }
+
+int __init iSeries_src_init(void)
+{
+        /* clear the progress line */
+        ppc_md.progress(" ", 0xffff);
+        return 0;
+}
+
+late_initcall(iSeries_src_init);
diff -Nru a/arch/ppc64/kernel/ioctl32.c b/arch/ppc64/kernel/ioctl32.c
--- a/arch/ppc64/kernel/ioctl32.c	Tue Jun 15 22:21:05 2004
+++ b/arch/ppc64/kernel/ioctl32.c	Tue Jun 15 22:21:05 2004
@@ -29,307 +29,6 @@
 #define CODE
 #include "compat_ioctl.c"
 
-struct ncp_ioctl_request_32 {
-	unsigned int function;
-	unsigned int size;
-	compat_caddr_t data;
-};
-
-struct ncp_fs_info_v2_32 {
-	int version;
-	unsigned int mounted_uid;
-	unsigned int connection;
-	unsigned int buffer_size;
-
-	unsigned int volume_number;
-	__u32 directory_id;
-
-	__u32 dummy1;
-	__u32 dummy2;
-	__u32 dummy3;
-};
-
-struct ncp_objectname_ioctl_32
-{
-	int		auth_type;
-	unsigned int	object_name_len;
-	compat_caddr_t	object_name;	/* an userspace data, in most cases user name */
-};
-
-struct ncp_privatedata_ioctl_32
-{
-	unsigned int	len;
-	compat_caddr_t	data;		/* ~1000 for NDS */
-};
-
-#define	NCP_IOC_NCPREQUEST_32		_IOR('n', 1, struct ncp_ioctl_request_32)
-
-#define NCP_IOC_GETMOUNTUID2_32		_IOW('n', 2, unsigned int)
-
-#define NCP_IOC_GET_FS_INFO_V2_32	_IOWR('n', 4, struct ncp_fs_info_v2_32)
-
-#define NCP_IOC_GETOBJECTNAME_32	_IOWR('n', 9, struct ncp_objectname_ioctl_32)
-#define NCP_IOC_SETOBJECTNAME_32	_IOR('n', 9, struct ncp_objectname_ioctl_32)
-#define NCP_IOC_GETPRIVATEDATA_32	_IOWR('n', 10, struct ncp_privatedata_ioctl_32)
-#define NCP_IOC_SETPRIVATEDATA_32	_IOR('n', 10, struct ncp_privatedata_ioctl_32)
-
-static int do_ncp_ncprequest(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_ioctl_request_32 n32;
-	struct ncp_ioctl_request n;
-	mm_segment_t old_fs;
-	int err;
-
-	if (copy_from_user(&n32, (struct ncp_ioctl_request_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.function = n32.function;
-	n.size = n32.size;
-	if (n.size > 65536)
-		return -EINVAL;
-	n.data = vmalloc(65536);	/* 65536 must be same as NCP_PACKET_SIZE_INTERNAL in ncpfs */
-	if (!n.data)
-		return -ENOMEM;
-	err = -EFAULT;
-	if (copy_from_user(n.data, (void *)A(n32.data), n.size))
-		goto out;
-
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_NCPREQUEST, (unsigned long)&n);
-	set_fs (old_fs);
-        if(err <= 0)
-		goto out;
-	if (err > 65536) {
-		err = -EINVAL;
-		goto out;
-	}
-	if (copy_to_user((void *)A(n32.data), n.data, err)) {
-		err = -EFAULT;
-		goto out;
-	}
- out:
-	vfree(n.data);
-	return err;
-}
-
-static int do_ncp_getmountuid2(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	mm_segment_t old_fs = get_fs();
-	__kernel_uid_t kuid;
-	int err;
-
-	cmd = NCP_IOC_GETMOUNTUID2;
-
-	set_fs(KERNEL_DS);
-	err = sys_ioctl(fd, cmd, (unsigned long)&kuid);
-	set_fs(old_fs);
-
-	if (!err)
-		err = put_user(kuid, (unsigned int*)arg);
-
-	return err;
-}
-
-static int do_ncp_getfsinfo2(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	mm_segment_t old_fs = get_fs();
-	struct ncp_fs_info_v2_32 n32;
-	struct ncp_fs_info_v2 n;
-	int err;
-
-	if (copy_from_user(&n32, (struct ncp_fs_info_v2_32*)arg, sizeof(n32)))
-		return -EFAULT;
-	if (n32.version != NCP_GET_FS_INFO_VERSION_V2)
-		return -EINVAL;
-	n.version = NCP_GET_FS_INFO_VERSION_V2;
-
-	set_fs(KERNEL_DS);
-	err = sys_ioctl(fd, NCP_IOC_GET_FS_INFO_V2, (unsigned long)&n);
-	set_fs(old_fs);
-
-	if (!err) {
-		n32.version = n.version;
-		n32.mounted_uid = n.mounted_uid;
-		n32.connection = n.connection;
-		n32.buffer_size = n.buffer_size;
-		n32.volume_number = n.volume_number;
-		n32.directory_id = n.directory_id;
-		n32.dummy1 = n.dummy1;
-		n32.dummy2 = n.dummy2;
-		n32.dummy3 = n.dummy3;
-		err = copy_to_user((struct ncp_fs_info_v2_32*)arg, &n32, sizeof(n32)) ? -EFAULT : 0;
-	}
-	return err;
-}
-
-static int do_ncp_getobjectname(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_objectname_ioctl_32 n32;
-	struct ncp_objectname_ioctl n;
-	mm_segment_t old_fs;
-	int err;
-	size_t tl;
-
-	if (copy_from_user(&n32, (struct ncp_objectname_ioctl_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.object_name_len = tl = n32.object_name_len;
-	if (tl) {
-		n.object_name = kmalloc(tl, GFP_KERNEL);
-		if (!n.object_name)
-			return -ENOMEM;
-	} else {
-		n.object_name = NULL;
-	}
-
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_GETOBJECTNAME, (unsigned long)&n);
-	set_fs (old_fs);
-        if(err)
-		goto out;
-		
-	if (tl > n.object_name_len)
-		tl = n.object_name_len;
-
-	err = -EFAULT;
-	if (tl && copy_to_user((void *)A(n32.object_name), n.object_name, tl))
-		goto out;
-
-	n32.auth_type = n.auth_type;
-	n32.object_name_len = n.object_name_len;
-	
-	if (copy_to_user((struct ncp_objectname_ioctl_32*)arg, &n32, sizeof(n32)))
-		goto out;
-	
-	err = 0;
- out:
- 	if (n.object_name)
-		kfree(n.object_name);
-
-	return err;
-}
-
-static int do_ncp_setobjectname(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_objectname_ioctl_32 n32;
-	struct ncp_objectname_ioctl n;
-	mm_segment_t old_fs;
-	int err;
-	size_t tl;
-
-	if (copy_from_user(&n32, (struct ncp_objectname_ioctl_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.auth_type = n32.auth_type;
-	n.object_name_len = tl = n32.object_name_len;
-	if (tl) {
-		n.object_name = kmalloc(tl, GFP_KERNEL);
-		if (!n.object_name)
-			return -ENOMEM;
-		err = -EFAULT;
-		if (copy_from_user(n.object_name, (void *)A(n32.object_name), tl))
-			goto out;
-	} else {
-		n.object_name = NULL;
-	}
-	
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_SETOBJECTNAME, (unsigned long)&n);
-	set_fs (old_fs);
-		
- out:
-	if (n.object_name)
-		kfree(n.object_name);
-
-	return err;
-}
-
-static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_privatedata_ioctl_32 n32;
-	struct ncp_privatedata_ioctl n;
-	mm_segment_t old_fs;
-	int err;
-	size_t tl;
-
-	if (copy_from_user(&n32, (struct ncp_privatedata_ioctl_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.len = tl = n32.len;
-	if (tl) {
-		n.data = kmalloc(tl, GFP_KERNEL);
-		if (!n.data)
-			return -ENOMEM;
-	} else {
-		n.data = NULL;
-	}
-
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_GETPRIVATEDATA, (unsigned long)&n);
-	set_fs (old_fs);
-        if(err)
-		goto out;
-		
-	if (tl > n.len)
-		tl = n.len;
-
-	err = -EFAULT;
-	if (tl && copy_to_user((void *)A(n32.data), n.data, tl))
-		goto out;
-
-	n32.len = n.len;
-	
-	if (copy_to_user((struct ncp_privatedata_ioctl_32*)arg, &n32, sizeof(n32)))
-		goto out;
-	
-	err = 0;
- out:
- 	if (n.data)
-		kfree(n.data);
-
-	return err;
-}
-
-static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_privatedata_ioctl_32 n32;
-	struct ncp_privatedata_ioctl n;
-	mm_segment_t old_fs;
-	int err;
-	size_t tl;
-
-	if (copy_from_user(&n32, (struct ncp_privatedata_ioctl_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.len = tl = n32.len;
-	if (tl) {
-		n.data = kmalloc(tl, GFP_KERNEL);
-		if (!n.data)
-			return -ENOMEM;
-		err = -EFAULT;
-		if (copy_from_user(n.data, (void *)A(n32.data), tl))
-			goto out;
-	} else {
-		n.data = NULL;
-	}
-	
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_SETPRIVATEDATA, (unsigned long)&n);
-	set_fs (old_fs);
-		
- out:
-	if (n.data)
-		kfree(n.data);
-
-	return err;
-}
-
-
 #define HANDLE_IOCTL(cmd,handler) { cmd, (ioctl_trans_handler_t)handler, 0 },
 #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd,sys_ioctl)
 
@@ -349,17 +48,6 @@
 /* Little p (/dev/rtc, /dev/envctrl, etc.) */
 COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
 COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */
-
-/* And these ioctls need translation */
-
-/* NCPFS */
-HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
-HANDLE_IOCTL(NCP_IOC_GETMOUNTUID2_32, do_ncp_getmountuid2)
-HANDLE_IOCTL(NCP_IOC_GET_FS_INFO_V2_32, do_ncp_getfsinfo2)
-HANDLE_IOCTL(NCP_IOC_GETOBJECTNAME_32, do_ncp_getobjectname)
-HANDLE_IOCTL(NCP_IOC_SETOBJECTNAME_32, do_ncp_setobjectname)
-HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32, do_ncp_getprivatedata)
-HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata)
 
 IOCTL_TABLE_END
 
diff -Nru a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c
--- a/arch/ppc64/kernel/iommu.c	Tue Jun 15 22:20:35 2004
+++ b/arch/ppc64/kernel/iommu.c	Tue Jun 15 22:20:35 2004
@@ -491,7 +491,7 @@
 	 */
 	if (order >= IOMAP_MAX_ORDER) {
 		printk("iommu_alloc_consistent size too large: 0x%lx\n", size);
-		return (void *)DMA_ERROR_CODE;
+		return NULL;
 	}
 
 	if (!tbl)
diff -Nru a/arch/ppc64/kernel/irq.c b/arch/ppc64/kernel/irq.c
--- a/arch/ppc64/kernel/irq.c	Tue Jun 15 22:20:39 2004
+++ b/arch/ppc64/kernel/irq.c	Tue Jun 15 22:20:39 2004
@@ -370,16 +370,13 @@
 	return 0;
 }
 
-static inline int handle_irq_event(int irq, struct pt_regs *regs,
-				   struct irqaction *action)
+int handle_irq_event(int irq, struct pt_regs *regs, struct irqaction *action)
 {
 	int status = 0;
 	int retval = 0;
 
-#ifndef CONFIG_PPC_ISERIES
 	if (!(action->flags & SA_INTERRUPT))
 		local_irq_enable();
-#endif
 
 	do {
 		status |= action->flags;
@@ -388,9 +385,7 @@
 	} while (action);
 	if (status & SA_SAMPLE_RANDOM)
 		add_interrupt_randomness(irq);
-#ifndef CONFIG_PPC_ISERIES
 	local_irq_disable();
-#endif
 	return retval;
 }
 
@@ -486,6 +481,9 @@
 	int cpu = smp_processor_id();
 	irq_desc_t *desc = get_irq_desc(irq);
 	irqreturn_t action_ret;
+#ifdef CONFIG_IRQSTACKS
+	struct thread_info *curtp, *irqtp;
+#endif
 
 	kstat_cpu(cpu).irqs[irq]++;
 
@@ -552,7 +550,22 @@
 	 */
 	for (;;) {
 		spin_unlock(&desc->lock);
-		action_ret = handle_irq_event(irq, regs, action);
+
+#ifdef CONFIG_IRQSTACKS
+		/* Switch to the irq stack to handle this */
+		curtp = current_thread_info();
+		irqtp = hardirq_ctx[smp_processor_id()];
+		if (curtp != irqtp) {
+			irqtp->task = curtp->task;
+			irqtp->flags = 0;
+			action_ret = call_handle_irq_event(irq, regs, action, irqtp);
+			irqtp->task = NULL;
+			if (irqtp->flags)
+				set_bits(irqtp->flags, &curtp->flags);
+		} else
+#endif
+			action_ret = handle_irq_event(irq, regs, action);
+
 		spin_lock(&desc->lock);
 		if (!noirqdebug)
 			note_interrupt(irq, desc, action_ret);
@@ -628,6 +641,21 @@
 
 	irq_enter();
 
+#ifdef CONFIG_DEBUG_STACKOVERFLOW
+	/* Debugging check for stack overflow: is there less than 4KB free? */
+	{
+		long sp;
+
+		sp = __get_SP() & (THREAD_SIZE-1);
+
+		if (unlikely(sp < (sizeof(struct thread_info) + 4096))) {
+			printk("do_IRQ: stack overflow: %ld\n",
+				sp - sizeof(struct thread_info));
+			dump_stack();
+		}
+	}
+#endif
+
 	/*
 	 * Every arch is required to implement ppc_md.get_irq.
 	 * This function will either return an irq number or -1 to
@@ -679,6 +707,7 @@
 	once++;
 
 	ppc_md.init_IRQ();
+	irq_ctx_init();
 }
 
 static struct proc_dir_entry * root_irq_dir;
@@ -702,7 +731,7 @@
 	return len;
 }
 
-static int irq_affinity_write_proc (struct file *file, const char *buffer,
+static int irq_affinity_write_proc (struct file *file, const char __user *buffer,
 					unsigned long count, void *data)
 {
 	unsigned int irq = (long)data;
@@ -962,4 +991,51 @@
 
 }
 
-#endif
+#endif /* CONFIG_PPC_ISERIES */
+
+#ifdef CONFIG_IRQSTACKS
+struct thread_info *softirq_ctx[NR_CPUS];
+struct thread_info *hardirq_ctx[NR_CPUS];
+
+void irq_ctx_init(void)
+{
+	struct thread_info *tp;
+	int i;
+
+	for (i = 0; i < NR_CPUS; i++) {
+		memset((void *)softirq_ctx[i], 0, THREAD_SIZE);
+		tp = softirq_ctx[i];
+		tp->cpu = i;
+		tp->preempt_count = SOFTIRQ_OFFSET;
+
+		memset((void *)hardirq_ctx[i], 0, THREAD_SIZE);
+		tp = hardirq_ctx[i];
+		tp->cpu = i;
+		tp->preempt_count = HARDIRQ_OFFSET;
+	}
+}
+
+void do_softirq(void)
+{
+	unsigned long flags;
+	struct thread_info *curtp, *irqtp;
+
+	if (in_interrupt())
+		return;
+
+	local_irq_save(flags);
+
+	if (local_softirq_pending()) {
+		curtp = current_thread_info();
+		irqtp = softirq_ctx[smp_processor_id()];
+		irqtp->task = curtp->task;
+		call_do_softirq(irqtp);
+		irqtp->task = NULL;
+	}
+
+	local_irq_restore(flags);
+}
+EXPORT_SYMBOL(do_softirq);
+
+#endif /* CONFIG_IRQSTACKS */
+
diff -Nru a/arch/ppc64/kernel/mf_proc.c b/arch/ppc64/kernel/mf_proc.c
--- a/arch/ppc64/kernel/mf_proc.c	Tue Jun 15 22:20:39 2004
+++ b/arch/ppc64/kernel/mf_proc.c	Tue Jun 15 22:20:39 2004
@@ -177,10 +177,14 @@
 static int proc_mf_change_vmlinux(struct file *file, const char *buffer,
 		unsigned long count, void *data)
 {
+	int rc;
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
-	mf_setVmlinuxChunk(buffer, count, file->f_pos, (u64)data);
+	rc = mf_setVmlinuxChunk(buffer, count, file->f_pos, (u64)data);
+	if (rc < 0)
+		return rc;
+
 	file->f_pos += count;
 
 	return count;			
diff -Nru a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
--- a/arch/ppc64/kernel/misc.S	Tue Jun 15 22:20:44 2004
+++ b/arch/ppc64/kernel/misc.S	Tue Jun 15 22:20:44 2004
@@ -102,6 +102,30 @@
 	blr
 #endif /* CONFIG_PPC_ISERIES */
 
+#ifdef CONFIG_IRQSTACKS
+_GLOBAL(call_do_softirq)
+	mflr	r0
+	std	r0,16(r1)
+	stdu	r1,THREAD_SIZE-112(r3)
+	mr	r1,r3
+	bl	.__do_softirq
+	ld	r1,0(r1)
+	ld	r0,16(r1)
+	mtlr	r0
+	blr
+
+_GLOBAL(call_handle_irq_event)
+	mflr	r0
+	std	r0,16(r1)
+	stdu	r1,THREAD_SIZE-112(r6)
+	mr	r1,r6
+	bl	.handle_irq_event
+	ld	r1,0(r1)
+	ld	r0,16(r1)
+	mtlr	r0
+	blr
+#endif /* CONFIG_IRQSTACKS */
+
 /*
  * Flush instruction cache.
  */
@@ -316,6 +340,8 @@
 	eieio
 	stbu	r5,1(r4)
 	bdnz	00b
+	twi	0,r5,0
+	isync
 	blr
 
 _GLOBAL(_outsb)
@@ -325,8 +351,8 @@
 	blelr-
 00:	lbzu	r5,1(r4)
 	stb	r5,0(r3)
-	eieio
 	bdnz	00b
+	sync
 	blr	
 
 _GLOBAL(_insw)
@@ -338,6 +364,8 @@
 	eieio
 	sthu	r5,2(r4)
 	bdnz	00b
+	twi	0,r5,0
+	isync
 	blr
 
 _GLOBAL(_outsw)
@@ -346,9 +374,9 @@
 	subi	r4,r4,2
 	blelr-
 00:	lhzu	r5,2(r4)
-	eieio
 	sthbrx	r5,0,r3	
 	bdnz	00b
+	sync
 	blr	
 
 _GLOBAL(_insl)
@@ -360,6 +388,8 @@
 	eieio
 	stwu	r5,4(r4)
 	bdnz	00b
+	twi	0,r5,0
+	isync
 	blr
 
 _GLOBAL(_outsl)
@@ -369,8 +399,8 @@
 	blelr-
 00:	lwzu	r5,4(r4)
 	stwbrx	r5,0,r3
-	eieio
 	bdnz	00b
+	sync
 	blr	
 
 /* _GLOBAL(ide_insw) now in drivers/ide/ide-iops.c */
@@ -383,6 +413,8 @@
 	eieio
 	sthu	r5,2(r4)
 	bdnz	00b
+	twi	0,r5,0
+	isync
 	blr
 
 /* _GLOBAL(ide_outsw) now in drivers/ide/ide-iops.c */
@@ -393,8 +425,8 @@
 	blelr-
 00:	lhzu	r5,2(r4)
 	sth	r5,0(r3)
-	eieio
 	bdnz	00b
+	sync
 	blr	
 
 _GLOBAL(_insl_ns)
@@ -406,6 +438,8 @@
 	eieio
 	stwu	r5,4(r4)
 	bdnz	00b
+	twi	0,r5,0
+	isync
 	blr
 
 _GLOBAL(_outsl_ns)
@@ -415,8 +449,8 @@
 	blelr-
 00:	lwzu	r5,4(r4)
 	stw	r5,0(r3)
-	eieio
 	bdnz	00b
+	sync
 	blr	
 
 _GLOBAL(abs)
@@ -717,8 +751,8 @@
 	.llong .ppc32_select
 	.llong .sys_flock
 	.llong .sys_msync
-	.llong .sys32_readv		/* 145 */
-	.llong .sys32_writev
+	.llong .compat_sys_readv	/* 145 */
+	.llong .compat_sys_writev
 	.llong .sys32_getsid
 	.llong .sys_fdatasync
 	.llong .sys32_sysctl
@@ -740,7 +774,7 @@
 	.llong .sys_getresuid	        /* 165 */
 	.llong .sys_ni_syscall		/* old query_module syscall */
 	.llong .sys_poll
-	.llong .sys32_nfsservctl
+	.llong .compat_sys_nfsservctl
 	.llong .sys_setresgid
 	.llong .sys_getresgid	        /* 170 */
 	.llong .sys32_prctl
@@ -840,6 +874,7 @@
 	.llong .compat_sys_mq_timedreceive /* 265 */
 	.llong .compat_sys_mq_notify
 	.llong .compat_sys_mq_getsetattr
+	.llong .sys_ni_syscall		/* 268 reserved for sys_kexec_load */
 
 	.balign 8
 _GLOBAL(sys_call_table)
@@ -1029,7 +1064,7 @@
 	.llong .sys_capget
 	.llong .sys_capset
 	.llong .sys_sigaltstack	        /* 185 */
-	.llong .sys_sendfile
+	.llong .sys_sendfile64
 	.llong .sys_ni_syscall		/* reserved for streams1 */
 	.llong .sys_ni_syscall		/* reserved for streams2 */
 	.llong .sys_vfork
@@ -1111,3 +1146,4 @@
 	.llong .sys_mq_timedreceive	/* 265 */
 	.llong .sys_mq_notify
 	.llong .sys_mq_getsetattr
+	.llong .sys_ni_syscall		/* 268 reserved for sys_kexec_load */
diff -Nru a/arch/ppc64/kernel/module.c b/arch/ppc64/kernel/module.c
--- a/arch/ppc64/kernel/module.c	Tue Jun 15 22:21:04 2004
+++ b/arch/ppc64/kernel/module.c	Tue Jun 15 22:21:04 2004
@@ -138,6 +138,16 @@
 	return relocs * sizeof(struct ppc64_stub_entry);
 }
 
+static void dedotify_versions(struct modversion_info *vers,
+			      unsigned long size)
+{
+	struct modversion_info *end;
+
+	for (end = (void *)vers + size; vers < end; vers++)
+		if (vers->name[0] == '.')
+			memmove(vers->name, vers->name+1, strlen(vers->name));
+}
+
 /* Undefined symbols which refer to .funcname, hack to funcname */
 static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab)
 {
@@ -166,6 +176,9 @@
 			me->arch.stubs_section = i;
 		else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0)
 			me->arch.toc_section = i;
+		else if (strcmp(secstrings+sechdrs[i].sh_name,"__versions")==0)
+			dedotify_versions((void *)hdr + sechdrs[i].sh_offset,
+					  sechdrs[i].sh_size);
 
 		/* We don't handle .init for the moment: rename to _init */
 		while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init")))
diff -Nru a/arch/ppc64/kernel/pSeries_nvram.c b/arch/ppc64/kernel/pSeries_nvram.c
--- a/arch/ppc64/kernel/pSeries_nvram.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc64/kernel/pSeries_nvram.c	Tue Jun 15 22:20:43 2004
@@ -29,7 +29,7 @@
 #include <asm/machdep.h>
 
 static unsigned int nvram_size;
-static unsigned int nvram_fetch, nvram_store;
+static int nvram_fetch, nvram_store;
 static char nvram_buf[NVRW_CNT];	/* assume this is in the first 4GB */
 static spinlock_t nvram_lock = SPIN_LOCK_UNLOCKED;
 
diff -Nru a/arch/ppc64/kernel/pacaData.c b/arch/ppc64/kernel/pacaData.c
--- a/arch/ppc64/kernel/pacaData.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc64/kernel/pacaData.c	Tue Jun 15 22:20:43 2004
@@ -36,11 +36,13 @@
 {									    \
 	.xLpPacaPtr = &paca[number].xLpPaca,				    \
 	.xLpRegSavePtr = &paca[number].xRegSav,				    \
+	.lock_token = 0x8000,						    \
 	.xPacaIndex = (number),		/* Paca Index */		    \
 	.default_decr = 0x00ff0000,	/* Initial Decr */		    \
 	.xStab_data = {							    \
 		.real = (asrr),		/* Real pointer to segment table */ \
 		.virt = (asrv),		/* Virt pointer to segment table */ \
+		.next_round_robin = 1,					    \
 	},								    \
 	.lpQueuePtr = (lpq),		/* &xItLpQueue, */		    \
 	/* .xRtas = {							    \
@@ -53,7 +55,8 @@
 		.xFPRegsInUse = 1,					    \
 		.xDynProcStatus = 2,					    \
 		.xDecrVal = 0x00ff0000,					    \
-		.xEndOfQuantum = 0xffffffffffffffff			    \
+		.xEndOfQuantum = 0xfffffffffffffffful,			    \
+		.xSLBCount = 64,					    \
 	},								    \
 	.xRegSav = {							    \
 		.xDesc = 0xd397d9e2,	/* "LpRS" */			    \
diff -Nru a/arch/ppc64/kernel/pmac_feature.c b/arch/ppc64/kernel/pmac_feature.c
--- a/arch/ppc64/kernel/pmac_feature.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc64/kernel/pmac_feature.c	Tue Jun 15 22:20:43 2004
@@ -343,6 +343,10 @@
 		PMAC_TYPE_POWERMAC_G5,		g5_features,
 		0,
 	},
+	{       "RackMac3,1",                   "XServe G5",
+		PMAC_TYPE_POWERMAC_G5,          g5_features,
+		0,
+	},
 };
 
 /*
diff -Nru a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
--- a/arch/ppc64/kernel/process.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc64/kernel/process.c	Tue Jun 15 22:20:41 2004
@@ -332,8 +332,8 @@
          * entry is the TOC value we need to use.
          */
 	set_fs(USER_DS);
-	__get_user(entry, (unsigned long *)fdptr);
-	__get_user(toc, (unsigned long *)fdptr+1);
+	__get_user(entry, (unsigned long __user *)fdptr);
+	__get_user(toc, (unsigned long __user *)fdptr+1);
 
 	/* Check whether the e_entry function descriptor entries
 	 * need to be relocated before we can use them.
@@ -386,7 +386,7 @@
 	unsigned int val;
 
 	val = __unpack_fe01(tsk->thread.fpexc_mode);
-	return put_user(val, (unsigned int *) adr);
+	return put_user(val, (unsigned int __user *) adr);
 }
 
 int sys_clone(unsigned long clone_flags, unsigned long p2, unsigned long p3,
@@ -410,7 +410,7 @@
 	}
 
 	return do_fork(clone_flags & ~CLONE_IDLETASK, p2, regs, 0,
-		    (int *)parent_tidptr, (int *)child_tidptr);
+		    (int __user *)parent_tidptr, (int __user *)child_tidptr);
 }
 
 int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3,
@@ -435,7 +435,7 @@
 	int error;
 	char * filename;
 	
-	filename = getname((char *) a0);
+	filename = getname((char __user *) a0);
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
@@ -445,7 +445,8 @@
 	if (regs->msr & MSR_VEC)
 		giveup_altivec(current);
 #endif /* CONFIG_ALTIVEC */
-	error = do_execve(filename, (char **) a1, (char **) a2, regs);
+	error = do_execve(filename, (char __user * __user *) a1,
+				    (char __user * __user *) a2, regs);
   
 	if (error == 0)
 		current->ptrace &= ~PT_DTRACE;
@@ -457,24 +458,30 @@
 
 static int kstack_depth_to_print = 64;
 
-static inline int validate_sp(unsigned long sp, struct task_struct *p)
+static int validate_sp(unsigned long sp, struct task_struct *p,
+		       unsigned long nbytes)
 {
 	unsigned long stack_page = (unsigned long)p->thread_info;
 
-	if (sp < stack_page + sizeof(struct thread_struct))
-		return 0;
-	if (sp >= stack_page + THREAD_SIZE)
-		return 0;
+	if (sp >= stack_page + sizeof(struct thread_struct)
+	    && sp <= stack_page + THREAD_SIZE - nbytes)
+		return 1;
+
+#ifdef CONFIG_IRQSTACKS
+	stack_page = (unsigned long) hardirq_ctx[task_cpu(p)];
+	if (sp >= stack_page + sizeof(struct thread_struct)
+	    && sp <= stack_page + THREAD_SIZE - nbytes)
+		return 1;
+
+	stack_page = (unsigned long) softirq_ctx[task_cpu(p)];
+	if (sp >= stack_page + sizeof(struct thread_struct)
+	    && sp <= stack_page + THREAD_SIZE - nbytes)
+		return 1;
+#endif
 
-	return 1;
+	return 0;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched    (*(unsigned long *)scheduling_functions_start_here)
-#define last_sched     (*(unsigned long *)scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long ip, sp;
@@ -484,16 +491,16 @@
 		return 0;
 
 	sp = p->thread.ksp;
-	if (!validate_sp(sp, p))
+	if (!validate_sp(sp, p, 112))
 		return 0;
 
 	do {
 		sp = *(unsigned long *)sp;
-		if (!validate_sp(sp, p))
+		if (!validate_sp(sp, p, 112))
 			return 0;
 		if (count > 0) {
 			ip = *(unsigned long *)(sp + 16);
-			if (ip < first_sched || ip >= last_sched)
+			if (!in_sched_functions(ip))
 				return ip;
 		}
 	} while (count++ < 16);
@@ -502,9 +509,10 @@
 
 void show_stack(struct task_struct *p, unsigned long *_sp)
 {
-	unsigned long ip;
+	unsigned long ip, newsp, lr;
 	int count = 0;
 	unsigned long sp = (unsigned long)_sp;
+	int firstframe = 1;
 
 	if (sp == 0) {
 		if (p) {
@@ -515,17 +523,40 @@
 		}
 	}
 
-	if (!validate_sp(sp, p))
-		return;
-
+	lr = 0;
 	printk("Call Trace:\n");
 	do {
-		sp = *(unsigned long *)sp;
-		if (!validate_sp(sp, p))
+		if (!validate_sp(sp, p, 112))
 			return;
-		ip = *(unsigned long *)(sp + 16);
-		printk("[%016lx] ", ip);
-		print_symbol("%s\n", ip);
+
+		_sp = (unsigned long *) sp;
+		newsp = _sp[0];
+		ip = _sp[2];
+		if (!firstframe || ip != lr) {
+			printk("[%016lx] [%016lx] ", sp, ip);
+			print_symbol("%s", ip);
+			if (firstframe)
+				printk(" (unreliable)");
+			printk("\n");
+		}
+		firstframe = 0;
+
+		/*
+		 * See if this is an exception frame.
+		 * We look for the "regshere" marker in the current frame.
+		 */
+		if (validate_sp(sp, p, sizeof(struct pt_regs) + 400)
+		    && _sp[12] == 0x7265677368657265ul) {
+			struct pt_regs *regs = (struct pt_regs *)
+				(sp + STACK_FRAME_OVERHEAD);
+			printk("--- Exception: %lx", regs->trap);
+			print_symbol(" at %s\n", regs->nip);
+			lr = regs->link;
+			print_symbol("    LR = %s\n", lr);
+			firstframe = 1;
+		}
+
+		sp = newsp;
 	} while (count++ < kstack_depth_to_print);
 }
 
diff -Nru a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
--- a/arch/ppc64/kernel/prom.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc64/kernel/prom.c	Tue Jun 15 22:20:43 2004
@@ -458,13 +458,6 @@
 		PROM_BUG();
 	}
 
-	/* 
-	 * Hardcode to GP size.  I am not sure where to get this info
-	 * in general, as there does not appear to be a slb-size OF
-	 * entry.  At least in Condor and earlier.  DRENG 
-	 */
-	_naca->slb_size = 64;
-
 	/* Add an eye catcher and the systemcfg layout version number */
 	strcpy(_systemcfg->eye_catcher, RELOC("SYSTEMCFG:PPC64"));
 	_systemcfg->version.major = SYSTEMCFG_MAJOR;
@@ -654,8 +647,6 @@
 #endif /* DEBUG_PROM */
 }
 
-static char hypertas_funcs[1024];
-
 static void __init
 prom_instantiate_rtas(void)
 {
@@ -665,6 +656,7 @@
 	struct systemcfg *_systemcfg = RELOC(systemcfg);
 	ihandle prom_rtas;
         u32 getprop_rval;
+	char hypertas_funcs[4];
 
 #ifdef DEBUG_PROM
 	prom_print(RELOC("prom_instantiate_rtas: start...\n"));
@@ -1556,7 +1548,7 @@
 		if (*mem_end != RELOC(initrd_start))
 			prom_panic(RELOC("No memory for copy_device_tree"));
 
-		prom_print("Huge device_tree: moving initrd\n");
+		prom_print(RELOC("Huge device_tree: moving initrd\n"));
 		/* Move by 4M. */
 		initrd_len = RELOC(initrd_end) - RELOC(initrd_start);
 		*mem_end = RELOC(initrd_start) + 4 * 1024 * 1024;
@@ -1590,6 +1582,7 @@
 	char *prev_name, *namep;
 	unsigned char *valp;
 	unsigned long offset = reloc_offset();
+	phandle ibm_phandle;
 
 	np = make_room(mem_start, mem_end, struct device_node);
 	memset(np, 0, sizeof(*np));
@@ -1652,23 +1645,24 @@
 		prev_propp = &pp->next;
 	}
 
-	/* Add a "linux_phandle" value */
-        if (np->node) {
-		u32 ibm_phandle = 0;
-		int len;
-
-                /* First see if "ibm,phandle" exists and use its value */
-                len = (int)
-                        call_prom(RELOC("getprop"), 4, 1, node, RELOC("ibm,phandle"),
-                                  &ibm_phandle, sizeof(ibm_phandle));
-                if (len < 0) {
-                        np->linux_phandle = np->node;
-                } else {
-                        np->linux_phandle = ibm_phandle;
-		}
-	}
-
-	*prev_propp = 0;
+	/* Add a "linux,phandle" property. */
+	namep = make_room(mem_start, mem_end, char[16]);
+	strcpy(namep, RELOC("linux,phandle"));
+	pp = make_room(mem_start, mem_end, struct property);
+	pp->name = PTRUNRELOC(namep);
+	pp->length = sizeof(phandle);
+	valp = make_room(mem_start, mem_end, phandle);
+	pp->value = PTRUNRELOC(valp);
+	*(phandle *)valp = node;
+	*prev_propp = PTRUNRELOC(pp);
+	pp->next = NULL;
+
+	/* Set np->linux_phandle to the value of the ibm,phandle property
+	   if it exists, otherwise to the phandle for this node. */
+	np->linux_phandle = node;
+	if ((int)call_prom(RELOC("getprop"), 4, 1, node, RELOC("ibm,phandle"),
+			   &ibm_phandle, sizeof(ibm_phandle)) > 0)
+		np->linux_phandle = ibm_phandle;
 
 	/* get the node's full name */
 	namep = (char *)*mem_start;
@@ -2189,11 +2183,13 @@
 		ints = imap - nintrc;
 		reg = ints - naddrc;
 	}
+	if (p == NULL) {
 #ifdef DEBUG_IRQ
-	if (p == NULL)
 		printk("hmmm, int tree for %s doesn't have ctrler\n",
 		       np->full_name);
 #endif
+		return 0;
+	}
 	*irq = ints;
 	*ictrler = p;
 	return nintrc;
@@ -2204,7 +2200,7 @@
 		       int measure_only)
 {
 	unsigned int *ints;
-	int intlen, intrcells;
+	int intlen, intrcells, intrcount;
 	int i, j, n;
 	unsigned int *irq, virq;
 	struct device_node *ic;
@@ -2214,34 +2210,40 @@
 		return mem_start;
 	intrcells = prom_n_intr_cells(np);
 	intlen /= intrcells * sizeof(unsigned int);
-	np->n_intrs = intlen;
 	np->intrs = (struct interrupt_info *) mem_start;
 	mem_start += intlen * sizeof(struct interrupt_info);
 
 	if (measure_only)
 		return mem_start;
 
-	for (i = 0; i < intlen; ++i) {
-		np->intrs[i].line = 0;
-		np->intrs[i].sense = 1;
+	intrcount = 0;
+	for (i = 0; i < intlen; ++i, ints += intrcells) {
 		n = map_interrupt(&irq, &ic, np, ints, intrcells);
 		if (n <= 0)
 			continue;
-		virq = virt_irq_create_mapping(irq[0]);
-		if (virq == NO_IRQ) {
-			printk(KERN_CRIT "Could not allocate interrupt "
-			       "number for %s\n", np->full_name);
-		} else
-			np->intrs[i].line = irq_offset_up(virq);
+
+		/* don't map IRQ numbers under a cascaded 8259 controller */
+		if (ic && device_is_compatible(ic, "chrp,iic")) {
+			np->intrs[intrcount].line = irq[0];
+		} else {
+			virq = virt_irq_create_mapping(irq[0]);
+			if (virq == NO_IRQ) {
+				printk(KERN_CRIT "Could not allocate interrupt"
+				       " number for %s\n", np->full_name);
+				continue;
+			}
+			np->intrs[intrcount].line = irq_offset_up(virq);
+		}
 
 		/* We offset irq numbers for the u3 MPIC by 128 in PowerMac */
 		if (systemcfg->platform == PLATFORM_POWERMAC && ic && ic->parent) {
 			char *name = get_property(ic->parent, "name", NULL);
 			if (name && !strcmp(name, "u3"))
-				np->intrs[i].line += 128;
+				np->intrs[intrcount].line += 128;
 		}
+		np->intrs[intrcount].sense = 1;
 		if (n > 1)
-			np->intrs[i].sense = irq[1];
+			np->intrs[intrcount].sense = irq[1];
 		if (n > 2) {
 			printk("hmmm, got %d intr cells for %s:", n,
 			       np->full_name);
@@ -2249,8 +2251,9 @@
 				printk(" %d", irq[j]);
 			printk("\n");
 		}
-		ints += intrcells;
+		++intrcount;
 	}
+	np->n_intrs = intrcount;
 
 	return mem_start;
 }
diff -Nru a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c
--- a/arch/ppc64/kernel/ptrace.c	Tue Jun 15 22:20:44 2004
+++ b/arch/ppc64/kernel/ptrace.c	Tue Jun 15 22:20:44 2004
@@ -101,7 +101,7 @@
 		ret = -EIO;
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp,(unsigned long __user *) data);
 		break;
 	}
 
@@ -123,7 +123,7 @@
 				giveup_fpu(child);
 			tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
 		}
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp,(unsigned long __user *) data);
 		break;
 	}
 
@@ -213,7 +213,7 @@
 	case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-		unsigned long *tmp = (unsigned long *)addr;
+		unsigned long __user *tmp = (unsigned long __user *)addr;
 
 		for (i = 0; i < 32; i++) {
 			ret = put_user(*reg, tmp);
@@ -228,7 +228,7 @@
 	case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-		unsigned long *tmp = (unsigned long *)addr;
+		unsigned long __user *tmp = (unsigned long __user *)addr;
 
 		for (i = 0; i < 32; i++) {
 			ret = get_user(*reg, tmp);
@@ -243,7 +243,7 @@
 	case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
-		unsigned long *tmp = (unsigned long *)addr;
+		unsigned long __user *tmp = (unsigned long __user *)addr;
 
 		if (child->thread.regs->msr & MSR_FP)
 			giveup_fpu(child);
@@ -261,7 +261,7 @@
 	case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
-		unsigned long *tmp = (unsigned long *)addr;
+		unsigned long __user *tmp = (unsigned long __user *)addr;
 
 		if (child->thread.regs->msr & MSR_FP)
 			giveup_fpu(child);
diff -Nru a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c
--- a/arch/ppc64/kernel/ptrace32.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc64/kernel/ptrace32.c	Tue Jun 15 22:20:41 2004
@@ -89,7 +89,7 @@
 		ret = -EIO;
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp, (u32*)data);
+		ret = put_user(tmp, (u32 __user *)data);
 		break;
 	}
 
@@ -106,19 +106,19 @@
 	case PPC_PTRACE_PEEKDATA_3264: {
 		u32 tmp;
 		int copied;
-		u32* addrOthers;
+		u32 __user * addrOthers;
 
 		ret = -EIO;
 
 		/* Get the addr in the other process that we want to read */
-		if (get_user(addrOthers, (u32**)addr) != 0)
+		if (get_user(addrOthers, (u32 __user * __user *)addr) != 0)
 			break;
 
 		copied = access_process_vm(child, (u64)addrOthers, &tmp,
 				sizeof(tmp), 0);
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp, (u32*)data);
+		ret = put_user(tmp, (u32 __user *)data);
 		break;
 	}
 
@@ -145,7 +145,7 @@
 			 */
 			tmp = ((unsigned int *)child->thread.fpr)[index - PT_FPR0];
 		}
-		ret = put_user((unsigned int)tmp, (u32*)data);
+		ret = put_user((unsigned int)tmp, (u32 __user *)data);
 		break;
 	}
   
@@ -186,7 +186,7 @@
 			tmp = get_reg(child, numReg);
 		} 
 		reg32bits = ((u32*)&tmp)[part];
-		ret = put_user(reg32bits, (u32*)data);
+		ret = put_user(reg32bits, (u32 __user *)data);
 		break;
 	}
 
@@ -215,11 +215,11 @@
 	case PPC_PTRACE_POKETEXT_3264:
 	case PPC_PTRACE_POKEDATA_3264: {
 		u32 tmp = data;
-		u32* addrOthers;
+		u32 __user * addrOthers;
 
 		/* Get the addr in the other process that we want to write into */
 		ret = -EIO;
-		if (get_user(addrOthers, (u32**)addr) != 0)
+		if (get_user(addrOthers, (u32 __user * __user *)addr) != 0)
 			break;
 		ret = 0;
 		if (access_process_vm(child, (u64)addrOthers, &tmp,
@@ -347,7 +347,7 @@
 	case PPC_PTRACE_GETREGS: { /* Get GPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-		unsigned int *tmp = (unsigned int *)addr;
+		unsigned int __user *tmp = (unsigned int __user *)addr;
 
 		for (i = 0; i < 32; i++) {
 			ret = put_user(*reg, tmp);
@@ -362,7 +362,7 @@
 	case PPC_PTRACE_SETREGS: { /* Set GPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.regs)[0];
-		unsigned int *tmp = (unsigned int *)addr;
+		unsigned int __user *tmp = (unsigned int __user *)addr;
 
 		for (i = 0; i < 32; i++) {
 			ret = get_user(*reg, tmp);
@@ -377,7 +377,7 @@
 	case PPC_PTRACE_GETFPREGS: { /* Get FPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
-		unsigned int *tmp = (unsigned int *)addr;
+		unsigned int __user *tmp = (unsigned int __user *)addr;
 
 		if (child->thread.regs->msr & MSR_FP)
 			giveup_fpu(child);
@@ -395,7 +395,7 @@
 	case PPC_PTRACE_SETFPREGS: { /* Get FPRs 0 - 31. */
 		int i;
 		unsigned long *reg = &((unsigned long *)child->thread.fpr)[0];
-		unsigned int *tmp = (unsigned int *)addr;
+		unsigned int __user *tmp = (unsigned int __user *)addr;
 
 		if (child->thread.regs->msr & MSR_FP)
 			giveup_fpu(child);
diff -Nru a/arch/ppc64/kernel/rtas-proc.c b/arch/ppc64/kernel/rtas-proc.c
--- a/arch/ppc64/kernel/rtas-proc.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc64/kernel/rtas-proc.c	Tue Jun 15 22:20:40 2004
@@ -541,7 +541,7 @@
 		case SENSOR_BUSY:
 			return "(busy)";
 		case SENSOR_NOT_EXIST:
-			return "(non existant)";
+			return "(non existent)";
 		case SENSOR_DR_ENTITY:
 			return "(dr entity removed)";
 		default:
@@ -698,7 +698,7 @@
 			}
 			break;
 		default:
-			n += sprintf(buf+n,  "Unkown sensor (type %d), ignoring it\n",
+			n += sprintf(buf+n,  "Unknown sensor (type %d), ignoring it\n",
 					s.token);
 			unknown = 1;
 			have_strings = 1;
diff -Nru a/arch/ppc64/kernel/rtas.c b/arch/ppc64/kernel/rtas.c
--- a/arch/ppc64/kernel/rtas.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc64/kernel/rtas.c	Tue Jun 15 22:20:37 2004
@@ -79,7 +79,7 @@
 	args->rets  = (rtas_arg_t *)&(args->args[1]);
 	args->args[0] = (int)c;
 
-	enter_rtas((void *)__pa((unsigned long)args));	
+	enter_rtas(__pa(args));
 
 	spin_unlock_irqrestore(&rtas.lock, s);
 }
@@ -115,9 +115,9 @@
 	get_paca()->xRtas = err_args;
 
 	PPCDBG(PPCDBG_RTAS, "\tentering rtas with 0x%lx\n",
-	       (void *)__pa((unsigned long)&err_args));
-	enter_rtas((void *)__pa((unsigned long)&get_paca()->xRtas));
-	PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n");	
+	       __pa(&err_args));
+	enter_rtas(__pa(&get_paca()->xRtas));
+	PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n");
 
 	err_args = get_paca()->xRtas;
 	get_paca()->xRtas = temp_args;
@@ -174,8 +174,8 @@
 		rtas_args->rets[i] = 0;
 
 	PPCDBG(PPCDBG_RTAS, "\tentering rtas with 0x%lx\n",
-		(void *)__pa((unsigned long)rtas_args));
-	enter_rtas((void *)__pa((unsigned long)rtas_args));
+		__pa(rtas_args));
+	enter_rtas(__pa(rtas_args));
 	PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n");
 
 	if (rtas_args->rets[0] == -1)
@@ -345,7 +345,7 @@
 	rtas_firmware_flash_list.num_blocks = 0;
 	flist = (struct flash_block_list *)&rtas_firmware_flash_list;
 	rtas_block_list = virt_to_abs(flist);
-	if (rtas_block_list >= (4UL << 20)) {
+	if (rtas_block_list >= 4UL*1024*1024*1024) {
 		printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n");
 		return;
 	}
@@ -480,7 +480,7 @@
 	spin_lock_irqsave(&rtas.lock, flags);
 
 	get_paca()->xRtas = args;
-	enter_rtas((void *)__pa((unsigned long)&get_paca()->xRtas));
+	enter_rtas(__pa(&get_paca()->xRtas));
 	args = get_paca()->xRtas;
 
 	spin_unlock_irqrestore(&rtas.lock, flags);
@@ -515,7 +515,7 @@
 
 	printk("%u %u Ready to die...\n",
 	       smp_processor_id(), hard_smp_processor_id());
-	enter_rtas((void *)__pa(rtas_args));
+	enter_rtas(__pa(rtas_args));
 
 	panic("Alas, I survived.\n");
 }
diff -Nru a/arch/ppc64/kernel/rtas_flash.c b/arch/ppc64/kernel/rtas_flash.c
--- a/arch/ppc64/kernel/rtas_flash.c	Tue Jun 15 22:21:02 2004
+++ b/arch/ppc64/kernel/rtas_flash.c	Tue Jun 15 22:21:02 2004
@@ -692,7 +692,7 @@
 	if (rc != 0)
 		goto cleanup;
 
-	manage_pde = create_flash_pde("ppc64/rtas" MANAGE_FLASH_NAME,
+	manage_pde = create_flash_pde("ppc64/rtas/" MANAGE_FLASH_NAME,
 				      &manage_flash_operations);
 	if (manage_pde == NULL) {
 		rc = -ENOMEM;
diff -Nru a/arch/ppc64/kernel/rtasd.c b/arch/ppc64/kernel/rtasd.c
--- a/arch/ppc64/kernel/rtasd.c	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc64/kernel/rtasd.c	Tue Jun 15 22:20:38 2004
@@ -372,7 +372,7 @@
 	if (event_scan == RTAS_UNKNOWN_SERVICE || get_eventscan_parms() == -1)
 		goto error;
 
-	rtas_log_buf = vmalloc(rtas_error_log_max*LOG_NUMBER);
+	rtas_log_buf = vmalloc(rtas_error_log_buffer_max*LOG_NUMBER);
 	if (!rtas_log_buf) {
 		printk(KERN_ERR "rtasd: no memory\n");
 		goto error;
@@ -450,7 +450,7 @@
 		return 1;
 	}
 
-	entry = create_proc_entry("ppc64/error_log", S_IRUSR, NULL);
+	entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL);
 	if (entry)
 		entry->proc_fops = &proc_rtas_log_operations;
 	else
diff -Nru a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
--- a/arch/ppc64/kernel/setup.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc64/kernel/setup.c	Tue Jun 15 22:20:40 2004
@@ -476,6 +476,7 @@
 {
 	struct device_node *prom_stdout;
 	char *name;
+	int offset;
 
 	/* The user has requested a console so this is already set up. */
 	if (strstr(saved_command_line, "console="))
@@ -493,7 +494,6 @@
 		int i;
 		u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i);
 		if (i > 8) {
-			int offset;
 			switch (reg[1]) {
 				case 0x3f8:
 					offset = 0;
@@ -511,15 +511,19 @@
 					/* We dont recognise the serial port */
 					return -ENODEV;
 			}
-
-			return add_preferred_console("ttyS", offset, NULL);
 		}
-	} else if (strcmp(name, "vty") == 0) {
+	} else if (strcmp(name, "vty") == 0)
 		/* pSeries LPAR virtual console */
 		return add_preferred_console("hvc", 0, NULL);
-	}
+	else if (strcmp(name, "ch-a") == 0)
+		offset = 0;
+	else if (strcmp(name, "ch-b") == 0)
+		offset = 1;
+	else
+		return -ENODEV;
+
+	return add_preferred_console("ttyS", offset, NULL);
 
-	return -ENODEV;
 }
 console_initcall(set_preferred_console);
 
@@ -568,6 +572,23 @@
 
 extern void (*calibrate_delay)(void);
 
+#ifdef CONFIG_IRQSTACKS
+static void __init irqstack_early_init(void)
+{
+	int i;
+
+	/* interrupt stacks must be under 256MB, we cannot afford to take SLB misses on them */
+	for (i = 0; i < NR_CPUS; i++) {
+		softirq_ctx[i] = (struct thread_info *)__va(lmb_alloc_base(THREAD_SIZE,
+					THREAD_SIZE, 0x10000000));
+		hardirq_ctx[i] = (struct thread_info *)__va(lmb_alloc_base(THREAD_SIZE,
+					THREAD_SIZE, 0x10000000));
+	}
+}
+#else
+#define irqstack_early_init()
+#endif
+
 /*
  * Called into from start_kernel, after lock_kernel has been called.
  * Initializes bootmem, which is unsed to manage page allocation until
@@ -612,6 +633,8 @@
 	/* Save unparsed command line copy for /proc/cmdline */
 	strlcpy(saved_command_line, cmd_line, sizeof(saved_command_line));
 	*cmdline_p = cmd_line;
+
+	irqstack_early_init();
 
 	/* set up the bootmem stuff with available memory */
 	do_init_bootmem();
diff -Nru a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c
--- a/arch/ppc64/kernel/signal.c	Tue Jun 15 22:20:35 2004
+++ b/arch/ppc64/kernel/signal.c	Tue Jun 15 22:20:35 2004
@@ -73,7 +73,7 @@
 /*
  * Atomically swap in the new signal mask, and wait for a signal.
  */
-long sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, int p3, int p4,
+long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, int p3, int p4,
 		       int p6, int p7, struct pt_regs *regs)
 {
 	sigset_t saveset, newset;
@@ -103,7 +103,7 @@
 	}
 }
 
-long sys_sigaltstack(const stack_t *uss, stack_t *uoss, unsigned long r5,
+long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long r5,
 		     unsigned long r6, unsigned long r7, unsigned long r8,
 		     struct pt_regs *regs)
 {
@@ -115,7 +115,7 @@
  * Set up the sigcontext for the signal frame.
  */
 
-static long setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
+static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
 		 int signr, sigset_t *set, unsigned long handler)
 {
 	/* When CONFIG_ALTIVEC is set, we _always_ setup v_regs even if the
@@ -127,7 +127,7 @@
 	 * v_regs pointer or not
 	 */
 #ifdef CONFIG_ALTIVEC
-	elf_vrreg_t *v_regs = (elf_vrreg_t *)(((unsigned long)sc->vmx_reserve) & ~0xful);
+	elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *)(((unsigned long)sc->vmx_reserve) & ~0xful);
 #endif
 	long err = 0;
 
@@ -154,7 +154,7 @@
 	/* We always copy to/from vrsave, it's 0 if we don't have or don't
 	 * use altivec.
 	 */
-	err |= __put_user(current->thread.vrsave, (u32 *)&v_regs[33]);
+	err |= __put_user(current->thread.vrsave, (u32 __user *)&v_regs[33]);
 #else /* CONFIG_ALTIVEC */
 	err |= __put_user(0, &sc->v_regs);
 #endif /* CONFIG_ALTIVEC */
@@ -174,10 +174,10 @@
  */
 
 static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
-			      struct sigcontext *sc)
+			      struct sigcontext __user *sc)
 {
 #ifdef CONFIG_ALTIVEC
-	elf_vrreg_t *v_regs;
+	elf_vrreg_t __user *v_regs;
 #endif
 	unsigned long err = 0;
 	unsigned long save_r13;
@@ -216,7 +216,7 @@
 		memset(&current->thread.vr, 0, 33);
 	/* Always get VRSAVE back */
 	if (v_regs != 0)
-		err |= __get_user(current->thread.vrsave, (u32 *)&v_regs[33]);
+		err |= __get_user(current->thread.vrsave, (u32 __user *)&v_regs[33]);
 	else
 		current->thread.vrsave = 0;
 #endif /* CONFIG_ALTIVEC */
@@ -230,7 +230,7 @@
 /*
  * Allocate space for the signal frame
  */
-static inline void * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
+static inline void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 				  size_t frame_size)
 {
         unsigned long newsp;
@@ -243,13 +243,13 @@
 			newsp = (current->sas_ss_sp + current->sas_ss_size);
 	}
 
-        return (void *)((newsp - frame_size) & -8ul);
+        return (void __user *)((newsp - frame_size) & -8ul);
 }
 
 /*
  * Setup the trampoline code on the stack
  */
-static long setup_trampoline(unsigned int syscall, unsigned int *tramp)
+static long setup_trampoline(unsigned int syscall, unsigned int __user *tramp)
 {
 	int i;
 	long err = 0;
@@ -311,8 +311,8 @@
 	if (new_ctx == NULL)
 		return 0;
 	if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx))
-	    || __get_user(tmp, (u8 *) new_ctx)
-	    || __get_user(tmp, (u8 *) (new_ctx + 1) - 1))
+	    || __get_user(tmp, (u8 __user *) new_ctx)
+	    || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
 		return -EFAULT;
 
 	/*
@@ -346,7 +346,7 @@
 		     unsigned long r6, unsigned long r7, unsigned long r8,
 		     struct pt_regs *regs)
 {
-	struct ucontext *uc = (struct ucontext *)regs->gpr[1];
+	struct ucontext __user *uc = (struct ucontext __user *)regs->gpr[1];
 	sigset_t set;
 
 	/* Always make any pending restarted system calls return -EINTR */
@@ -384,8 +384,8 @@
 	 * descriptor is the entry address of signal and the second
 	 * entry is the TOC value we need to use.
 	 */
-	func_descr_t *funct_desc_ptr;
-	struct rt_sigframe *frame;
+	func_descr_t __user *funct_desc_ptr;
+	struct rt_sigframe __user *frame;
 	unsigned long newsp = 0;
 	long err = 0;
 
@@ -418,11 +418,11 @@
 	if (err)
 		goto badframe;
 
-	funct_desc_ptr = (func_descr_t *) ka->sa.sa_handler;
+	funct_desc_ptr = (func_descr_t __user *) ka->sa.sa_handler;
 
 	/* Allocate a dummy caller frame for the signal handler. */
 	newsp = (unsigned long)frame - __SIGNAL_FRAMESIZE;
-	err |= put_user(0, (unsigned long *)newsp);
+	err |= put_user(0, (unsigned long __user *)newsp);
 
 	/* Set up "regs" so we "return" to the signal handler. */
 	err |= get_user(regs->nip, &funct_desc_ptr->entry);
@@ -432,8 +432,8 @@
 	regs->gpr[3] = signr;
 	regs->result = 0;
 	if (ka->sa.sa_flags & SA_SIGINFO) {
-		err |= get_user(regs->gpr[4], (unsigned long *)&frame->pinfo);
-		err |= get_user(regs->gpr[5], (unsigned long *)&frame->puc);
+		err |= get_user(regs->gpr[4], (unsigned long __user *)&frame->pinfo);
+		err |= get_user(regs->gpr[5], (unsigned long __user *)&frame->puc);
 		regs->gpr[6] = (unsigned long) frame;
 	} else {
 		regs->gpr[4] = (unsigned long)&frame->uc.uc_mcontext;
diff -Nru a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c
--- a/arch/ppc64/kernel/signal32.c	Tue Jun 15 22:20:59 2004
+++ b/arch/ppc64/kernel/signal32.c	Tue Jun 15 22:20:59 2004
@@ -126,7 +126,7 @@
  * We only save the altivec registers if the process has used
  * altivec instructions at some point.
  */
-static int save_user_regs(struct pt_regs *regs, struct mcontext32 *frame, int sigret)
+static int save_user_regs(struct pt_regs *regs, struct mcontext32 __user *frame, int sigret)
 {
 	elf_greg_t64 *gregs = (elf_greg_t64 *)regs;
 	int i, err = 0;
@@ -165,7 +165,7 @@
 	 * significant bits of a vector, we "cheat" and stuff VRSAVE in the
 	 * most significant bits of that same vector. --BenH
 	 */
-	if (__put_user(current->thread.vrsave, (u32 *)&frame->mc_vregs[32]))
+	if (__put_user(current->thread.vrsave, (u32 __user *)&frame->mc_vregs[32]))
 		return 1;
 #endif /* CONFIG_ALTIVEC */
 
@@ -232,7 +232,7 @@
 		memset(&current->thread.vr, 0, ELF_NVRREG32 * sizeof(vector128));
 
 	/* Always get VRSAVE back */
-	if (__get_user(current->thread.vrsave, (u32 *)&sr->mc_vregs[32]))
+	if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32]))
 		return 1;
 #endif /* CONFIG_ALTIVEC */
 
@@ -289,8 +289,8 @@
 	}
 }
 
-long sys32_sigaction(int sig, struct old_sigaction32 *act,
-		struct old_sigaction32 *oact)
+long sys32_sigaction(int sig, struct old_sigaction32 __user *act,
+		struct old_sigaction32 __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -344,8 +344,8 @@
  */
 
 
-long sys32_rt_sigaction(int sig, const struct sigaction32 *act,
-		struct sigaction32 *oact, size_t sigsetsize)
+long sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
+		struct sigaction32 __user *oact, size_t sigsetsize)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -383,10 +383,11 @@
  * of a signed int (msr in 32-bit mode) and the register representation
  * of a signed int (msr in 64-bit mode) is performed.
  */
-long sys32_rt_sigprocmask(u32 how, compat_sigset_t *set,
-		compat_sigset_t *oset, size_t sigsetsize)
+long sys32_rt_sigprocmask(u32 how, compat_sigset_t __user *set,
+		compat_sigset_t __user *oset, size_t sigsetsize)
 {
 	sigset_t s;
+	sigset_t __user *up;
 	compat_sigset_t s32;
 	int ret;
 	mm_segment_t old_fs = get_fs();
@@ -398,7 +399,9 @@
 	}
 	
 	set_fs(KERNEL_DS);
-	ret = sys_rt_sigprocmask((int)how, set ? &s : NULL, oset ? &s : NULL,
+	/* This is valid because of the set_fs() */
+	up = (sigset_t __user *) &s;
+	ret = sys_rt_sigprocmask((int)how, set ? up : NULL, oset ? up : NULL,
 				 sigsetsize); 
 	set_fs(old_fs);
 	if (ret)
@@ -411,7 +414,7 @@
 	return 0;
 }
 
-long sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize)
+long sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -419,7 +422,8 @@
 	mm_segment_t old_fs = get_fs();
 
 	set_fs(KERNEL_DS);
-	ret = sys_rt_sigpending(&s, sigsetsize);
+	/* The __user pointer cast is valid because of the set_fs() */
+	ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
 	set_fs(old_fs);
 	if (!ret) {
 		compat_from_sigset(&s32, &s);
@@ -430,7 +434,7 @@
 }
 
 
-static long copy_siginfo_to_user32(compat_siginfo_t *d, siginfo_t *s)
+static long copy_siginfo_to_user32(compat_siginfo_t __user *d, siginfo_t *s)
 {
 	long err;
 
@@ -481,8 +485,8 @@
 	return err;
 }
 
-long sys32_rt_sigtimedwait(compat_sigset_t *uthese, compat_siginfo_t *uinfo,
-		struct compat_timespec *uts, compat_size_t sigsetsize)
+long sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, compat_siginfo_t __user *uinfo,
+		struct compat_timespec __user *uts, compat_size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -497,7 +501,10 @@
 	if (uts && get_compat_timespec(&t, uts))
 		return -EFAULT;
 	set_fs(KERNEL_DS);
-	ret = sys_rt_sigtimedwait(&s, uinfo ? &info : NULL, uts ? &t : NULL,
+	/* The __user pointer casts are valid because of the set_fs() */
+	ret = sys_rt_sigtimedwait((sigset_t __user *) &s,
+			uinfo ? (siginfo_t __user *) &info : NULL,
+			uts ? (struct timespec __user *) &t : NULL,
 			sigsetsize);
 	set_fs(old_fs);
 	if (ret >= 0 && uinfo) {
@@ -514,7 +521,7 @@
  * (msr in 32-bit mode) and the register representation of a signed int
  * (msr in 64-bit mode) is performed.
  */
-long sys32_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t *uinfo)
+long sys32_rt_sigqueueinfo(u32 pid, u32 sig, compat_siginfo_t __user *uinfo)
 {
 	siginfo_t info;
 	int ret;
@@ -524,12 +531,13 @@
 	    copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE32))
 		return -EFAULT;
 	set_fs (KERNEL_DS);
-	ret = sys_rt_sigqueueinfo((int)pid, (int)sig, &info);
+	/* The __user pointer cast is valid becasuse of the set_fs() */
+	ret = sys_rt_sigqueueinfo((int)pid, (int)sig, (siginfo_t __user *) &info);
 	set_fs (old_fs);
 	return ret;
 }
 
-int sys32_rt_sigsuspend(compat_sigset_t* unewset, size_t sigsetsize, int p3,
+int sys32_rt_sigsuspend(compat_sigset_t __user * unewset, size_t sigsetsize, int p3,
 		int p4, int p6, int p7, struct pt_regs *regs)
 {
 	sigset_t saveset, newset;
@@ -581,9 +589,11 @@
  *       sigaltatck               sys32_sigaltstack
  */
 
-int sys32_sigaltstack(u32 newstack, u32 oldstack, int r5,
+int sys32_sigaltstack(u32 __new, u32 __old, int r5,
 		      int r6, int r7, int r8, struct pt_regs *regs)
 {
+	stack_32_t __user * newstack = (stack_32_t __user *)(long) __new;
+	stack_32_t __user * oldstack = (stack_32_t __user *)(long) __old;
 	stack_t uss, uoss;
 	int ret;
 	mm_segment_t old_fs;
@@ -597,27 +607,24 @@
 
 	/* Put new stack info in local 64 bit stack struct */
 	if (newstack &&
-		(get_user((long)uss.ss_sp,
-			  &((stack_32_t *)(long)newstack)->ss_sp) ||
-		 __get_user(uss.ss_flags,
-			 &((stack_32_t *)(long)newstack)->ss_flags) ||
-		 __get_user(uss.ss_size,
-			 &((stack_32_t *)(long)newstack)->ss_size)))
+		(get_user((long)uss.ss_sp, &newstack->ss_sp) ||
+		 __get_user(uss.ss_flags, &newstack->ss_flags) ||
+		 __get_user(uss.ss_size, &newstack->ss_size)))
 		return -EFAULT; 
 
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	ret = do_sigaltstack(newstack ? &uss : NULL, oldstack ? &uoss : NULL,
-			sp);
+	/* The __user pointer casts are valid because of the set_fs() */
+	ret = do_sigaltstack(
+		newstack ? (stack_t __user *) &uss : NULL,
+		oldstack ? (stack_t __user *) &uoss : NULL,
+		sp);
 	set_fs(old_fs);
 	/* Copy the stack information to the user output buffer */
 	if (!ret && oldstack  &&
-		(put_user((long)uoss.ss_sp,
-			  &((stack_32_t *)(long)oldstack)->ss_sp) ||
-		 __put_user(uoss.ss_flags,
-			 &((stack_32_t *)(long)oldstack)->ss_flags) ||
-		 __put_user(uoss.ss_size,
-			 &((stack_32_t *)(long)oldstack)->ss_size)))
+		(put_user((long)uoss.ss_sp, &oldstack->ss_sp) ||
+		 __put_user(uoss.ss_flags, &oldstack->ss_flags) ||
+		 __put_user(uoss.ss_size, &oldstack->ss_size)))
 		return -EFAULT;
 	return ret;
 }
@@ -701,7 +708,7 @@
 		return -EFAULT;
 	sigset_from_compat(&set, &c_set);
 	restore_sigmask(&set);
-	if (restore_user_regs(regs, (struct mcontext32 *)(u64)mcp, sig))
+	if (restore_user_regs(regs, (struct mcontext32 __user *)(u64)mcp, sig))
 		return -EFAULT;
 
 	return 0;
@@ -735,8 +742,8 @@
 	if (new_ctx == NULL)
 		return 0;
 	if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx))
-	    || __get_user(tmp, (u8 *) new_ctx)
-	    || __get_user(tmp, (u8 *) (new_ctx + 1) - 1))
+	    || __get_user(tmp, (u8 __user *) new_ctx)
+	    || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
 		return -EFAULT;
 
 	/*
@@ -817,7 +824,7 @@
 	/* create a stack frame for the caller of the handler */
 	newsp -= __SIGNAL_FRAMESIZE32;
 
-	if (verify_area(VERIFY_WRITE, (void *) newsp, origsp - newsp))
+	if (verify_area(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
 		goto badframe;
 
 #if _NSIG != 64
@@ -881,7 +888,7 @@
 	set.sig[0] = sigctx.oldmask + ((long)(sigctx._unused[3]) << 32);
 	restore_sigmask(&set);
 
-	sr = (struct mcontext32 *)(u64)sigctx.regs;
+	sr = (struct mcontext32 __user *)(u64)sigctx.regs;
 	if (verify_area(VERIFY_READ, sr, sizeof(*sr))
 	    || restore_user_regs(regs, sr, 1))
 		goto badframe;
diff -Nru a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c
--- a/arch/ppc64/kernel/smp.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc64/kernel/smp.c	Tue Jun 15 22:20:43 2004
@@ -390,8 +390,7 @@
 	}
 
 	/* Fixup atomic count: it exited inside IRQ handler. */
-	((struct task_struct *)paca[lcpu].xCurrent)->thread_info->preempt_count
-		= 0;
+	paca[lcpu].xCurrent->thread_info->preempt_count	= 0;
 	/* Fixup SLB round-robin so next segment (kernel) goes in segment 0 */
 	paca[lcpu].xStab_data.next_round_robin = 0;
 
@@ -618,7 +617,7 @@
 #endif
 #ifdef CONFIG_DEBUGGER
 	case PPC_MSG_DEBUGGER_BREAK:
-		debugger(regs);
+		debugger_ipi(regs);
 		break;
 #endif
 	default:
@@ -692,6 +691,9 @@
 	int ret = -1, cpus;
 	unsigned long timeout;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data.func = func;
 	data.info = info;
 	atomic_set(&data.started, 0);
@@ -814,7 +816,7 @@
 	init_idle(p, cpu);
 	unhash_process(p);
 
-	paca[cpu].xCurrent = (u64)p;
+	paca[cpu].xCurrent = p;
 	current_set[cpu] = p->thread_info;
 }
 
@@ -834,11 +836,6 @@
 	paca[boot_cpuid].prof_counter = 1;
 	paca[boot_cpuid].prof_multiplier = 1;
 
-	/*
-	 * XXX very rough. 
-	 */
-	cache_decay_ticks = HZ/100;
-
 #ifndef CONFIG_PPC_ISERIES
 	paca[boot_cpuid].next_jiffy_update_tb = tb_last_stamp = get_tb();
 
@@ -871,7 +868,7 @@
 	/* cpu_possible is set up in prom.c */
 	cpu_set(boot_cpuid, cpu_online_map);
 
-	paca[boot_cpuid].xCurrent = (u64)current;
+	paca[boot_cpuid].xCurrent = current;
 	current_set[boot_cpuid] = current->thread_info;
 }
 
@@ -914,8 +911,20 @@
 	 * use this value that I found through experimentation.
 	 * -- Cort
 	 */
-	for (c = 5000; c && !cpu_callin_map[cpu]; c--)
-		udelay(100);
+	if (system_state == SYSTEM_BOOTING)
+		for (c = 5000; c && !cpu_callin_map[cpu]; c--)
+			udelay(100);
+#ifdef CONFIG_HOTPLUG_CPU
+	else
+		/*
+		 * CPUs can take much longer to come up in the
+		 * hotplug case.  Wait five seconds.
+		 */
+		for (c = 25; c && !cpu_callin_map[cpu]; c--) {
+			set_current_state(TASK_UNINTERRUPTIBLE);
+			schedule_timeout(HZ/5);
+		}
+#endif
 
 	if (!cpu_callin_map[cpu]) {
 		printk("Processor %u is stuck.\n", cpu);
@@ -992,3 +1001,218 @@
 
 	set_cpus_allowed(current, old_mask);
 }
+
+#ifdef CONFIG_SCHED_SMT
+#ifdef CONFIG_NUMA
+static struct sched_group sched_group_cpus[NR_CPUS];
+static struct sched_group sched_group_phys[NR_CPUS];
+static struct sched_group sched_group_nodes[MAX_NUMNODES];
+static DEFINE_PER_CPU(struct sched_domain, cpu_domains);
+static DEFINE_PER_CPU(struct sched_domain, phys_domains);
+static DEFINE_PER_CPU(struct sched_domain, node_domains);
+__init void arch_init_sched_domains(void)
+{
+	int i;
+	struct sched_group *first = NULL, *last = NULL;
+
+	/* Set up domains */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		struct sched_domain *phys_domain = &per_cpu(phys_domains, i);
+		struct sched_domain *node_domain = &per_cpu(node_domains, i);
+		int node = cpu_to_node(i);
+		cpumask_t nodemask = node_to_cpumask(node);
+		cpumask_t my_cpumask = cpumask_of_cpu(i);
+		cpumask_t sibling_cpumask = cpumask_of_cpu(i ^ 0x1);
+
+		*cpu_domain = SD_SIBLING_INIT;
+		if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+			cpus_or(cpu_domain->span, my_cpumask, sibling_cpumask);
+		else
+			cpu_domain->span = my_cpumask;
+		cpu_domain->parent = phys_domain;
+		cpu_domain->groups = &sched_group_cpus[i];
+
+		*phys_domain = SD_CPU_INIT;
+		phys_domain->span = nodemask;
+		phys_domain->parent = node_domain;
+		phys_domain->groups = &sched_group_phys[first_cpu(cpu_domain->span)];
+
+		*node_domain = SD_NODE_INIT;
+		node_domain->span = cpu_possible_map;
+		node_domain->groups = &sched_group_nodes[node];
+	}
+
+	/* Set up CPU (sibling) groups */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		int j;
+		first = last = NULL;
+
+		if (i != first_cpu(cpu_domain->span))
+			continue;
+
+		for_each_cpu_mask(j, cpu_domain->span) {
+			struct sched_group *cpu = &sched_group_cpus[j];
+
+			cpus_clear(cpu->cpumask);
+			cpu_set(j, cpu->cpumask);
+			cpu->cpu_power = SCHED_LOAD_SCALE;
+
+			if (!first)
+				first = cpu;
+			if (last)
+				last->next = cpu;
+			last = cpu;
+		}
+		last->next = first;
+	}
+
+	for (i = 0; i < MAX_NUMNODES; i++) {
+		int j;
+		cpumask_t nodemask;
+		struct sched_group *node = &sched_group_nodes[i];
+		cpumask_t node_cpumask = node_to_cpumask(i);
+		cpus_and(nodemask, node_cpumask, cpu_possible_map);
+
+		if (cpus_empty(nodemask))
+			continue;
+
+		first = last = NULL;
+		/* Set up physical groups */
+		for_each_cpu_mask(j, nodemask) {
+			struct sched_domain *cpu_domain = &per_cpu(cpu_domains, j);
+			struct sched_group *cpu = &sched_group_phys[j];
+
+			if (j != first_cpu(cpu_domain->span))
+				continue;
+
+			cpu->cpumask = cpu_domain->span;
+			/*
+			 * Make each extra sibling increase power by 10% of
+			 * the basic CPU. This is very arbitrary.
+			 */
+			cpu->cpu_power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE*(cpus_weight(cpu->cpumask)-1) / 10;
+			node->cpu_power += cpu->cpu_power;
+
+			if (!first)
+				first = cpu;
+			if (last)
+				last->next = cpu;
+			last = cpu;
+		}
+		last->next = first;
+	}
+
+	/* Set up nodes */
+	first = last = NULL;
+	for (i = 0; i < MAX_NUMNODES; i++) {
+		struct sched_group *cpu = &sched_group_nodes[i];
+		cpumask_t nodemask;
+		cpumask_t node_cpumask = node_to_cpumask(i);
+		cpus_and(nodemask, node_cpumask, cpu_possible_map);
+
+		if (cpus_empty(nodemask))
+			continue;
+
+		cpu->cpumask = nodemask;
+		/* ->cpu_power already setup */
+
+		if (!first)
+			first = cpu;
+		if (last)
+			last->next = cpu;
+		last = cpu;
+	}
+	last->next = first;
+
+	mb();
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		cpu_attach_domain(cpu_domain, i);
+	}
+}
+#else /* !CONFIG_NUMA */
+static struct sched_group sched_group_cpus[NR_CPUS];
+static struct sched_group sched_group_phys[NR_CPUS];
+static DEFINE_PER_CPU(struct sched_domain, cpu_domains);
+static DEFINE_PER_CPU(struct sched_domain, phys_domains);
+__init void arch_init_sched_domains(void)
+{
+	int i;
+	struct sched_group *first = NULL, *last = NULL;
+
+	/* Set up domains */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		struct sched_domain *phys_domain = &per_cpu(phys_domains, i);
+		cpumask_t my_cpumask = cpumask_of_cpu(i);
+		cpumask_t sibling_cpumask = cpumask_of_cpu(i ^ 0x1);
+
+		*cpu_domain = SD_SIBLING_INIT;
+		if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+			cpus_or(cpu_domain->span, my_cpumask, sibling_cpumask);
+		else
+			cpu_domain->span = my_cpumask;
+		cpu_domain->parent = phys_domain;
+		cpu_domain->groups = &sched_group_cpus[i];
+
+		*phys_domain = SD_CPU_INIT;
+		phys_domain->span = cpu_possible_map;
+		phys_domain->groups = &sched_group_phys[first_cpu(cpu_domain->span)];
+	}
+
+	/* Set up CPU (sibling) groups */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		int j;
+		first = last = NULL;
+
+		if (i != first_cpu(cpu_domain->span))
+			continue;
+
+		for_each_cpu_mask(j, cpu_domain->span) {
+			struct sched_group *cpu = &sched_group_cpus[j];
+
+			cpus_clear(cpu->cpumask);
+			cpu_set(j, cpu->cpumask);
+			cpu->cpu_power = SCHED_LOAD_SCALE;
+
+			if (!first)
+				first = cpu;
+			if (last)
+				last->next = cpu;
+			last = cpu;
+		}
+		last->next = first;
+	}
+
+	first = last = NULL;
+	/* Set up physical groups */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		struct sched_group *cpu = &sched_group_phys[i];
+
+		if (i != first_cpu(cpu_domain->span))
+			continue;
+
+		cpu->cpumask = cpu_domain->span;
+		/* See SMT+NUMA setup for comment */
+		cpu->cpu_power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE*(cpus_weight(cpu->cpumask)-1) / 10;
+
+		if (!first)
+			first = cpu;
+		if (last)
+			last->next = cpu;
+		last = cpu;
+	}
+	last->next = first;
+
+	mb();
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		cpu_attach_domain(cpu_domain, i);
+	}
+}
+#endif /* CONFIG_NUMA */
+#endif /* CONFIG_SCHED_SMT */
diff -Nru a/arch/ppc64/kernel/stab.c b/arch/ppc64/kernel/stab.c
--- a/arch/ppc64/kernel/stab.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc64/kernel/stab.c	Tue Jun 15 22:20:43 2004
@@ -24,6 +24,23 @@
 static void make_slbe(unsigned long esid, unsigned long vsid, int large,
 		      int kernel_segment);
 
+static inline void slb_add_bolted(void)
+{
+#ifndef CONFIG_PPC_ISERIES
+	unsigned long esid = GET_ESID(VMALLOCBASE);
+	unsigned long vsid = get_kernel_vsid(VMALLOCBASE);
+
+	WARN_ON(!irqs_disabled());
+
+	/*
+	 * Bolt in the first vmalloc segment. Since modules end
+	 * up there it gets hit very heavily.
+	 */
+	get_paca()->xStab_data.next_round_robin = 1;
+	make_slbe(esid, vsid, 0, 1);
+#endif
+}
+
 /*
  * Build an entry for the base kernel segment and put it into
  * the segment table or SLB.  All other segment table or SLB
@@ -48,9 +65,12 @@
 		asm volatile("isync":::"memory");
 		asm volatile("slbmte  %0,%0"::"r" (0) : "memory");
 		asm volatile("isync; slbia; isync":::"memory");
+		get_paca()->xStab_data.next_round_robin = 0;
 		make_slbe(esid, vsid, seg0_largepages, 1);
 		asm volatile("isync":::"memory");
 #endif
+
+		slb_add_bolted();
 	} else {
 		asm volatile("isync; slbia; isync":::"memory");
 		make_ste(stab, esid, vsid);
@@ -317,6 +337,7 @@
 		unsigned long word0;
 		slb_dword1    data;
 	} vsid_data;
+	struct paca_struct *lpaca = get_paca();
 
 	/*
 	 * We take the next entry, round robin. Previously we tried
@@ -330,18 +351,25 @@
 	 * for the kernel stack during the first part of exception exit 
 	 * which gets invalidated due to a tlbie from another cpu at a
 	 * non recoverable point (after setting srr0/1) - Anton
+	 *
+	 * paca Ksave is always valid (even when on the interrupt stack)
+	 * so we use that.
 	 */
-	castout_entry = get_paca()->xStab_data.next_round_robin;
+	castout_entry = lpaca->xStab_data.next_round_robin;
 	do {
 		entry = castout_entry;
 		castout_entry++; 
-		if (castout_entry >= naca->slb_size)
-			castout_entry = 1; 
+		/*
+		 * We bolt in the first kernel segment and the first
+		 * vmalloc segment.
+		 */
+		if (castout_entry >= SLB_NUM_ENTRIES)
+			castout_entry = 2;
 		asm volatile("slbmfee  %0,%1" : "=r" (esid_data) : "r" (entry));
 	} while (esid_data.data.v &&
-		 esid_data.data.esid == GET_ESID(__get_SP()));
+		 esid_data.data.esid == GET_ESID(lpaca->xKsave));
 
-	get_paca()->xStab_data.next_round_robin = castout_entry;
+	lpaca->xStab_data.next_round_robin = castout_entry;
 
 	/* slbie not needed as the previous mapping is still valid. */
 
@@ -422,6 +450,9 @@
 	}
 
 	esid = GET_ESID(ea);
+#ifndef CONFIG_PPC_ISERIES
+	BUG_ON((esid << SID_SHIFT) == VMALLOCBASE);
+#endif
 	__slb_allocate(esid, vsid, context);
 
 	return 0;
@@ -479,18 +510,19 @@
 		slb_dword0 data;
 	} esid_data;
 
-
 	if (offset <= NR_STAB_CACHE_ENTRIES) {
 		int i;
 		asm volatile("isync" : : : "memory");
 		for (i = 0; i < offset; i++) {
 			esid_data.word0 = 0;
 			esid_data.data.esid = __get_cpu_var(stab_cache[i]);
+			BUG_ON(esid_data.data.esid == GET_ESID(VMALLOCBASE));
 			asm volatile("slbie %0" : : "r" (esid_data));
 		}
 		asm volatile("isync" : : : "memory");
 	} else {
 		asm volatile("isync; slbia; isync" : : : "memory");
+		slb_add_bolted();
 	}
 
 	/* Workaround POWER5 < DD2.1 issue */
diff -Nru a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
--- a/arch/ppc64/kernel/sys_ppc32.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc64/kernel/sys_ppc32.c	Tue Jun 15 22:20:42 2004
@@ -15,7 +15,6 @@
  */
 
 #include <linux/config.h>
-#include <asm/ptrace.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/fs.h> 
@@ -60,17 +59,17 @@
 #include <linux/compat.h>
 #include <linux/ptrace.h>
 #include <linux/aio_abi.h>
+#include <linux/elf.h>
+
+#include <net/scm.h>
+#include <net/sock.h>
 
+#include <asm/ptrace.h>
 #include <asm/types.h>
 #include <asm/ipc.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
-
 #include <asm/semaphore.h>
-
-#include <net/scm.h>
-#include <net/sock.h>
-#include <linux/elf.h>
 #include <asm/ppcdebug.h>
 #include <asm/time.h>
 #include <asm/ppc32.h>
@@ -78,180 +77,8 @@
 
 #include "pci.h"
 
-typedef ssize_t (*io_fn_t)(struct file *, char *, size_t, loff_t *);
-typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *);
-
-static long do_readv_writev32(int type, struct file *file,
-			      const struct compat_iovec *vector, u32 count)
-{
-	compat_ssize_t tot_len;
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov=iovstack, *ivp;
-	struct inode *inode;
-	long retval, i;
-	io_fn_t fn;
-	iov_fn_t fnv;
-
-	/*
-	 * SuS says "The readv() function *may* fail if the iovcnt argument
-	 * was less than or equal to 0, or greater than {IOV_MAX}.  Linux has
-	 * traditionally returned zero for zero segments, so...
-	 */
-	retval = 0;
-	if (count == 0)
-		goto out;
-
-	/* First get the "struct iovec" from user memory and
-	 * verify all the pointers
-	 */
-	retval = -EINVAL;
-	if (count > UIO_MAXIOV)
-		goto out;
-	if (!file->f_op)
-		goto out;
-	if (count > UIO_FASTIOV) {
-		retval = -ENOMEM;
-		iov = kmalloc(count*sizeof(struct iovec), GFP_KERNEL);
-		if (!iov)
-			goto out;
-	}
-	retval = -EFAULT;
-	if (verify_area(VERIFY_READ, vector, sizeof(struct compat_iovec)*count))
-		goto out;
-
-	/*
-	 * Single unix specification:
-	 * We should -EINVAL if an element length is not >= 0 and fitting an
-	 * ssize_t.  The total length is fitting an ssize_t
-	 *
-	 * Be careful here because iov_len is a size_t not an ssize_t
-	 */
-	tot_len = 0;
-	i = count;
-	ivp = iov;
-	retval = -EINVAL;
-	while(i > 0) {
-		compat_ssize_t tmp = tot_len;
-		compat_ssize_t len;
-		u32 buf;
-
-		if (__get_user(len, &vector->iov_len) ||
-		    __get_user(buf, &vector->iov_base)) {
-			retval = -EFAULT;
-			goto out;
-		}
-		if (len < 0)	/* size_t not fitting an compat_ssize_t .. */
-			goto out;
-		tot_len += len;
-		if (tot_len < tmp) /* maths overflow on the compat_ssize_t */
-			goto out;
-		ivp->iov_base = (void *)A(buf);
-		ivp->iov_len = (__kernel_size_t) len;
-		vector++;
-		ivp++;
-		i--;
-	}
-	if (tot_len == 0) {
-		retval = 0;
-		goto out;
-	}
-
-	inode = file->f_dentry->d_inode;
-	/* VERIFY_WRITE actually means a read, as we write to user space */
-	retval = locks_verify_area((type == READ
-				    ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE),
-				   inode, file, file->f_pos, tot_len);
-	if (retval)
-		goto out;
-
-	if (type == READ) {
-		fn = file->f_op->read;
-		fnv = file->f_op->readv;
-	} else {
-		fn = (io_fn_t)file->f_op->write;
-		fnv = file->f_op->writev;
-	}
-	if (fnv) {
-		retval = fnv(file, iov, count, &file->f_pos);
-		goto out;
-	}
-
-	/* Do it by hand, with file-ops */
-	ivp = iov;
-	while (count > 0) {
-		void * base;
-		int len, nr;
-
-		base = ivp->iov_base;
-		len = ivp->iov_len;
-		ivp++;
-		count--;
-
-		nr = fn(file, base, len, &file->f_pos);
-
-		if (nr < 0) {
-			if (!retval)
-				retval = nr;
-			break;
-		}
-		retval += nr;
-		if (nr != len)
-			break;
-	}
-out:
-	if (iov != iovstack)
-		kfree(iov);
-	if ((retval + (type == READ)) > 0)
-		dnotify_parent(file->f_dentry,
-			       (type == READ) ? DN_ACCESS : DN_MODIFY);
-
-	return retval;
-}
-
-asmlinkage long sys32_readv(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct file *file;
-	int ret = -EBADF;
-
-	file = fget(fd);
-	if (!file || !(file->f_mode & FMODE_READ))
-		goto out; 
-
-	ret = -EINVAL;
-	if (!file->f_op || (!file->f_op->readv && !file->f_op->read))
-		goto out;
-
-	ret = do_readv_writev32(READ, file, vector, count);
-
-out:
-	if (file)
-		fput(file);
-	return ret;
-}
-
-asmlinkage long sys32_writev(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct file *file;
-	int ret = -EBADF;
-
-	file = fget(fd);
-	if (!file || !(file->f_mode & FMODE_WRITE))
-		goto out;
-
-	ret = -EINVAL;
-	if (!file->f_op || (!file->f_op->writev && !file->f_op->write))
-		goto out;
-
-	ret = do_readv_writev32(WRITE, file, vector, count);
-
-out:
-	if (file)
-		fput(file);
-	return ret;
-}
-
 /* readdir & getdents */
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
 
 struct old_linux_dirent32 {
@@ -262,7 +89,7 @@
 };
 
 struct readdir_callback32 {
-	struct old_linux_dirent32 * dirent;
+	struct old_linux_dirent32 __user * dirent;
 	int count;
 };
 
@@ -270,7 +97,7 @@
 		                  off_t offset, ino_t ino, unsigned int d_type)
 {
 	struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
-	struct old_linux_dirent32 * dirent;
+	struct old_linux_dirent32 __user * dirent;
 
 	if (buf->count)
 		return -EINVAL;
@@ -284,7 +111,7 @@
 	return 0;
 }
 
-asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count)
+asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count)
 {
 	int error = -EBADF;
 	struct file * file;
@@ -316,8 +143,8 @@
 };
 
 struct getdents_callback32 {
-	struct linux_dirent32 * current_dir;
-	struct linux_dirent32 * previous;
+	struct linux_dirent32 __user * current_dir;
+	struct linux_dirent32 __user * previous;
 	int count;
 	int error;
 };
@@ -325,7 +152,7 @@
 static int filldir(void * __buf, const char * name, int namlen, off_t offset,
 		   ino_t ino, unsigned int d_type)
 {
-	struct linux_dirent32 * dirent;
+	struct linux_dirent32 __user * dirent;
 	struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
 
@@ -346,10 +173,10 @@
 		goto efault;
 	if (__put_user(0, dirent->d_name + namlen))
 		goto efault;
-	if (__put_user(d_type, (char *) dirent + reclen - 1))
+	if (__put_user(d_type, (char __user *) dirent + reclen - 1))
 		goto efault;
 	buf->previous = dirent;
-	dirent = (void *)dirent + reclen;
+	dirent = (void __user *)dirent + reclen;
 	buf->current_dir = dirent;
 	buf->count -= reclen;
 	return 0;
@@ -358,11 +185,11 @@
 	return -EFAULT;
 }
 
-long sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent,
+asmlinkage long sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent,
 		    unsigned int count)
 {
 	struct file * file;
-	struct linux_dirent32 * lastdirent;
+	struct linux_dirent32 __user * lastdirent;
 	struct getdents_callback32 buf;
 	int error;
 
@@ -398,170 +225,15 @@
 	return error;
 }
 
-/*
- * Ooo, nasty.  We need here to frob 32-bit unsigned longs to
- * 64-bit unsigned longs.
- */
-static inline int
-get_fd_set32(unsigned long n, unsigned long *fdset, u32 *ufdset)
-{
-	if (ufdset) {
-		unsigned long odd;
-
-		if (verify_area(VERIFY_WRITE, ufdset, n*sizeof(u32)))
-			return -EFAULT;
-
-		odd = n & 1UL;
-		n &= ~1UL;
-		while (n) {
-			unsigned long h, l;
-			__get_user(l, ufdset);
-			__get_user(h, ufdset+1);
-			ufdset += 2;
-			*fdset++ = h << 32 | l;
-			n -= 2;
-		}
-		if (odd)
-			__get_user(*fdset, ufdset);
-	} else {
-		/* Tricky, must clear full unsigned long in the
-		 * kernel fdset at the end, this makes sure that
-		 * actually happens.
-		 */
-		memset(fdset, 0, ((n + 1) & ~1)*sizeof(u32));
-	}
-	return 0;
-}
-
-static inline void
-set_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset)
-{
-	unsigned long odd;
-
-	if (!ufdset)
-		return;
-
-	odd = n & 1UL;
-	n &= ~1UL;
-	while (n) {
-		unsigned long h, l;
-		l = *fdset++;
-		h = l >> 32;
-		__put_user(l, ufdset);
-		__put_user(h, ufdset+1);
-		ufdset += 2;
-		n -= 2;
-	}
-	if (odd)
-		__put_user(*fdset, ufdset);
-}
-
-
-
-#define MAX_SELECT_SECONDS ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-
-asmlinkage long sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x)
-{
-	fd_set_bits fds;
-	struct compat_timeval *tvp = (struct compat_timeval *)AA(tvp_x);
-	char *bits;
-	unsigned long nn;
-	long timeout;
-	int ret, size, max_fdset;
-
-	timeout = MAX_SCHEDULE_TIMEOUT;
-	if (tvp) {
-		time_t sec, usec;
-		if ((ret = verify_area(VERIFY_READ, tvp, sizeof(*tvp)))
-		    || (ret = __get_user(sec, &tvp->tv_sec))
-		    || (ret = __get_user(usec, &tvp->tv_usec)))
-			goto out_nofds;
-
-		ret = -EINVAL;
-		if(sec < 0 || usec < 0)
-			goto out_nofds;
-
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
-			timeout = (usec + 1000000/HZ - 1) / (1000000/HZ);
-			timeout += sec * (unsigned long) HZ;
-		}
-	}
-
-	ret = -EINVAL;
-	if (n < 0)
-		goto out_nofds;
-
-	/* max_fdset can increase, so grab it once to avoid race */
-	max_fdset = current->files->max_fdset;
-	if (n > max_fdset)
-		n = max_fdset;
-
-	/*
-	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
-	 * since we used fdset we need to allocate memory in units of
-	 * long-words. 
-	 */
-	ret = -ENOMEM;
-	size = FDS_BYTES(n);
-	bits = kmalloc(6 * size, GFP_KERNEL);
-	if (!bits)
-		goto out_nofds;
-	fds.in      = (unsigned long *)  bits;
-	fds.out     = (unsigned long *) (bits +   size);
-	fds.ex      = (unsigned long *) (bits + 2*size);
-	fds.res_in  = (unsigned long *) (bits + 3*size);
-	fds.res_out = (unsigned long *) (bits + 4*size);
-	fds.res_ex  = (unsigned long *) (bits + 5*size);
-
-	nn = (n + 8*sizeof(u32) - 1) / (8*sizeof(u32));
-	if ((ret = get_fd_set32(nn, fds.in, inp)) ||
-	    (ret = get_fd_set32(nn, fds.out, outp)) ||
-	    (ret = get_fd_set32(nn, fds.ex, exp)))
-		goto out;
-	zero_fd_set(n, fds.res_in);
-	zero_fd_set(n, fds.res_out);
-	zero_fd_set(n, fds.res_ex);
-
-	ret = do_select(n, &fds, &timeout);
-
-	if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
-		time_t sec = 0, usec = 0;
-		if (timeout) {
-			sec = timeout / HZ;
-			usec = timeout % HZ;
-			usec *= (1000000/HZ);
-		}
-		put_user(sec, &tvp->tv_sec);
-		put_user(usec, &tvp->tv_usec);
-	}
-
-	if (ret < 0)
-		goto out;
-	if (!ret) {
-		ret = -ERESTARTNOHAND;
-		if (signal_pending(current))
-			goto out;
-		ret = 0;
-	}
-
-	set_fd_set32(nn, inp, fds.res_in);
-	set_fd_set32(nn, outp, fds.res_out);
-	set_fd_set32(nn, exp, fds.res_ex);
-  
-out:
-	kfree(bits);
-
-out_nofds:
-	return ret;
-}
-
-int ppc32_select(u32 n, u32* inp, u32* outp, u32* exp, u32 tvp_x)
+asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
+		compat_ulong_t __user *outp, compat_ulong_t __user *exp,
+		compat_uptr_t tvp_x)
 {
 	/* sign extend n */
-	return sys32_select((int)n, inp, outp, exp, tvp_x);
+	return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x));
 }
 
-int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
 {
 	long err;
 
@@ -619,7 +291,7 @@
 extern int do_adjtimex(struct timex *);
 extern void ppc_adjtimex(void);
 
-asmlinkage long sys32_adjtimex(struct timex32 *utp)
+asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
 {
 	struct timex txc;
 	int ret;
@@ -678,245 +350,6 @@
 	return ret;
 }
 
-/* Stuff for NFS server syscalls... */
-struct nfsctl_svc32 {
-	u16			svc32_port;
-	s32			svc32_nthreads;
-};
-
-struct nfsctl_client32 {
-	s8			cl32_ident[NFSCLNT_IDMAX+1];
-	s32			cl32_naddr;
-	struct in_addr		cl32_addrlist[NFSCLNT_ADDRMAX];
-	s32			cl32_fhkeytype;
-	s32			cl32_fhkeylen;
-	u8			cl32_fhkey[NFSCLNT_KEYMAX];
-};
-
-struct nfsctl_export32 {
-	s8			ex32_client[NFSCLNT_IDMAX+1];
-	s8			ex32_path[NFS_MAXPATHLEN+1];
-	compat_dev_t	ex32_dev;
-	compat_ino_t	ex32_ino;
-	s32			ex32_flags;
-	compat_uid_t	ex32_anon_uid;
-	compat_gid_t	ex32_anon_gid;
-};
-
-struct nfsctl_fdparm32 {
-	struct sockaddr		gd32_addr;
-	s8			gd32_path[NFS_MAXPATHLEN+1];
-	s32			gd32_version;
-};
-
-struct nfsctl_fsparm32 {
-	struct sockaddr		gd32_addr;
-	s8			gd32_path[NFS_MAXPATHLEN+1];
-	s32			gd32_maxlen;
-};
-
-struct nfsctl_arg32 {
-	s32			ca32_version;	/* safeguard */
-	union {
-		struct nfsctl_svc32	u32_svc;
-		struct nfsctl_client32	u32_client;
-		struct nfsctl_export32	u32_export;
-		struct nfsctl_fdparm32	u32_getfd;
-		struct nfsctl_fsparm32	u32_getfs;
-	} u;
-#define ca32_svc	u.u32_svc
-#define ca32_client	u.u32_client
-#define ca32_export	u.u32_export
-#define ca32_getfd	u.u32_getfd
-#define ca32_getfs	u.u32_getfs
-};
-
-union nfsctl_res32 {
-	__u8			cr32_getfh[NFS_FHSIZE];
-	struct knfsd_fh		cr32_getfs;
-};
-
-static int nfs_svc32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= __get_user(karg->ca_svc.svc_port, &arg32->ca32_svc.svc32_port);
-	err |= __get_user(karg->ca_svc.svc_nthreads, &arg32->ca32_svc.svc32_nthreads);
-	return err;
-}
-
-static int nfs_clnt32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_client.cl_ident[0],
-			  &arg32->ca32_client.cl32_ident[0],
-			  NFSCLNT_IDMAX);
-	err |= __get_user(karg->ca_client.cl_naddr, &arg32->ca32_client.cl32_naddr);
-	err |= copy_from_user(&karg->ca_client.cl_addrlist[0],
-			  &arg32->ca32_client.cl32_addrlist[0],
-			  (sizeof(struct in_addr) * NFSCLNT_ADDRMAX));
-	err |= __get_user(karg->ca_client.cl_fhkeytype,
-		      &arg32->ca32_client.cl32_fhkeytype);
-	err |= __get_user(karg->ca_client.cl_fhkeylen,
-		      &arg32->ca32_client.cl32_fhkeylen);
-	err |= copy_from_user(&karg->ca_client.cl_fhkey[0],
-			  &arg32->ca32_client.cl32_fhkey[0],
-			  NFSCLNT_KEYMAX);
-
-	if(err) return -EFAULT;
-	return 0;
-}
-
-static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_export.ex_client[0],
-			  &arg32->ca32_export.ex32_client[0],
-			  NFSCLNT_IDMAX);
-	err |= copy_from_user(&karg->ca_export.ex_path[0],
-			  &arg32->ca32_export.ex32_path[0],
-			  NFS_MAXPATHLEN);
-	err |= __get_user(karg->ca_export.ex_dev,
-		      &arg32->ca32_export.ex32_dev);
-	err |= __get_user(karg->ca_export.ex_ino,
-		      &arg32->ca32_export.ex32_ino);
-	err |= __get_user(karg->ca_export.ex_flags,
-		      &arg32->ca32_export.ex32_flags);
-	err |= __get_user(karg->ca_export.ex_anon_uid,
-		      &arg32->ca32_export.ex32_anon_uid);
-	err |= __get_user(karg->ca_export.ex_anon_gid,
-		      &arg32->ca32_export.ex32_anon_gid);
-	karg->ca_export.ex_anon_uid = karg->ca_export.ex_anon_uid;
-	karg->ca_export.ex_anon_gid = karg->ca_export.ex_anon_gid;
-
-	if(err) return -EFAULT;
-	return 0;
-}
-
-static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_getfd.gd_addr,
-			  &arg32->ca32_getfd.gd32_addr,
-			  (sizeof(struct sockaddr)));
-	err |= copy_from_user(&karg->ca_getfd.gd_path,
-			  &arg32->ca32_getfd.gd32_path,
-			  (NFS_MAXPATHLEN+1));
-	err |= __get_user(karg->ca_getfd.gd_version,
-		      &arg32->ca32_getfd.gd32_version);
-
-	if(err) return -EFAULT;
-	return 0;
-}
-
-static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_getfs.gd_addr,
-			  &arg32->ca32_getfs.gd32_addr,
-			  (sizeof(struct sockaddr)));
-	err |= copy_from_user(&karg->ca_getfs.gd_path,
-			  &arg32->ca32_getfs.gd32_path,
-			  (NFS_MAXPATHLEN+1));
-	err |= __get_user(karg->ca_getfs.gd_maxlen,
-		      &arg32->ca32_getfs.gd32_maxlen);
-
-	if(err) return -EFAULT;
-	return 0;
-}
-
-/* This really doesn't need translations, we are only passing
- * back a union which contains opaque nfs file handle data.
- */
-static int nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32)
-{
-	int err;
-
-	err = copy_to_user(res32, kres, sizeof(*res32));
-
-	if(err) return -EFAULT;
-	return 0;
-}
-
-/* Note: it is necessary to treat cmd_parm as an unsigned int, 
- * with the corresponding cast to a signed int to insure that the 
- * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
- * and the register representation of a signed int (msr in 64-bit mode) is performed.
- */
-int asmlinkage sys32_nfsservctl(u32 cmd_parm, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
-{
-  int cmd = (int)cmd_parm;
-	struct nfsctl_arg *karg = NULL;
-	union nfsctl_res *kres = NULL;
-	mm_segment_t oldfs;
-	int err;
-
-	karg = kmalloc(sizeof(*karg), GFP_USER);
-	if(!karg)
-		return -ENOMEM;
-	if(res32) {
-		kres = kmalloc(sizeof(*kres), GFP_USER);
-		if(!kres) {
-			kfree(karg);
-			return -ENOMEM;
-		}
-	}
-	switch(cmd) {
-	case NFSCTL_SVC:
-		err = nfs_svc32_trans(karg, arg32);
-		break;
-	case NFSCTL_ADDCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_DELCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_EXPORT:
-	case NFSCTL_UNEXPORT:
-		err = nfs_exp32_trans(karg, arg32);
-		break;
-	case NFSCTL_GETFD:
-		err = nfs_getfd32_trans(karg, arg32);
-		break;
-	case NFSCTL_GETFS:
-		err = nfs_getfs32_trans(karg, arg32);
-		break;
-	default:
-		err = -EINVAL;
-		break;
-	}
-	if(err)
-		goto done;
-	oldfs = get_fs();
-	set_fs(KERNEL_DS);
-	err = sys_nfsservctl(cmd, karg, kres);
-	set_fs(oldfs);
-
-	if (err)
-		goto done;
-
-	if((cmd == NFSCTL_GETFD) ||
-	   (cmd == NFSCTL_GETFS))
-		err = nfs_getfh32_res_trans(kres, res32);
-
-done:
-	if(karg)
-		kfree(karg);
-	if(kres)
-		kfree(kres);
-	return err;
-}
-
-
 
 /* These are here just in case some old sparc32 binary calls it. */
 asmlinkage long sys32_pause(void)
@@ -929,7 +362,7 @@
 
 
 
-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;
 
@@ -943,7 +376,7 @@
 	return 0;
 }
 
-static inline long put_tv32(struct compat_timeval *o, struct timeval *i)
+static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
 		(__put_user(i->tv_sec, &o->tv_sec) |
@@ -967,16 +400,18 @@
 	char _f[20-2*sizeof(int)-sizeof(int)];
 };
 
-asmlinkage long sys32_sysinfo(struct sysinfo32 *info)
+asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
 {
 	struct sysinfo s;
 	int ret, err;
 	int bitcount=0;
 	mm_segment_t old_fs = get_fs ();
 	
+	/* The __user cast is valid due to set_fs() */
 	set_fs (KERNEL_DS);
-	ret = sys_sysinfo(&s);
+	ret = sys_sysinfo((struct sysinfo __user *)&s);
 	set_fs (old_fs);
+
 	/* Check to see if any memory value is too large for 32-bit and
          * scale down if needed.
          */
@@ -1022,7 +457,7 @@
    sorts of things, like timeval and itimerval.  */
 extern struct timezone sys_tz;
 
-asmlinkage long sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
+asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -1040,7 +475,7 @@
 
 
 
-asmlinkage long sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
+asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
 {
 	struct timespec kts;
 	struct timezone ktz;
@@ -1057,625 +492,69 @@
 	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
-
-struct msgbuf32 {
-	compat_long_t mtype; 
-	char mtext[1];
-};
-
-struct semid_ds32 {
-	struct ipc_perm sem_perm;
-	compat_time_t sem_otime;
-	compat_time_t sem_ctime;
-	compat_uptr_t sem_base;
-	compat_uptr_t sem_pending;
-	compat_uptr_t sem_pending_last;
-	compat_uptr_t undo;
-	unsigned short sem_nsems;
-};
-
-struct semid64_ds32 {
-	struct ipc64_perm sem_perm;
-	unsigned int __unused1;
-	compat_time_t sem_otime;
-	unsigned int __unused2;
-	compat_time_t sem_ctime;
-	compat_ulong_t sem_nsems;
-	compat_ulong_t __unused3;
-	compat_ulong_t __unused4;
-};
-
-struct msqid_ds32 {
-	struct ipc_perm msg_perm;
-	compat_uptr_t msg_first;
-	compat_uptr_t msg_last;
-	compat_time_t msg_stime;
-	compat_time_t msg_rtime;
-	compat_time_t msg_ctime;
-	compat_ulong_t msg_lcbytes;
-	compat_ulong_t msg_lqbytes;
-	unsigned short msg_cbytes;
-	unsigned short msg_qnum;
-	unsigned short msg_qbytes;
-	compat_ipc_pid_t msg_lspid;
-	compat_ipc_pid_t msg_lrpid;
-};
-
-struct msqid64_ds32 {
-	struct ipc64_perm msg_perm;
-	unsigned int __unused1;
-	compat_time_t msg_stime;
-	unsigned int __unused2;
-	compat_time_t msg_rtime;
-	unsigned int __unused3;
-	compat_time_t msg_ctime;
-	compat_ulong_t msg_cbytes;
-	compat_ulong_t msg_qnum;
-	compat_ulong_t msg_qbytes;
-	compat_pid_t msg_lspid;
-	compat_pid_t msg_lrpid;
-	compat_ulong_t __unused4;
-	compat_ulong_t __unused5;
-};
-
-struct shmid_ds32 {
-	struct ipc_perm shm_perm;
-	int shm_segsz;
-	compat_time_t shm_atime;
-	compat_time_t shm_dtime;
-	compat_time_t shm_ctime;
-	compat_ipc_pid_t shm_cpid;
-	compat_ipc_pid_t shm_lpid;
-	unsigned short shm_nattch;
-	unsigned short __unused;
-	compat_uptr_t __unused2;
-	compat_uptr_t __unused3;
-};
-
-struct shmid64_ds32 {
-	struct ipc64_perm shm_perm;
-	unsigned int __unused1;
-	compat_time_t shm_atime;
-	unsigned int __unused2;
-	compat_time_t shm_dtime;
-	unsigned int __unused3;
-	compat_time_t shm_ctime;
-	unsigned int __unused4;
-	compat_size_t shm_segsz;
-	compat_pid_t shm_cpid;
-	compat_pid_t shm_lpid;
-	compat_ulong_t shm_nattch;
-	compat_ulong_t __unused5;
-	compat_ulong_t __unused6;
-};
-
-/*
- * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit
- * emulation..
- *
- * This is really horribly ugly.
- */
-static long do_sys32_semctl(int first, int second, int third, void *uptr)
-{
-	union semun fourth;
-	u32 pad;
-	int err, err2;
-	mm_segment_t old_fs;
-
-	if (!uptr)
-		return -EINVAL;
-	err = -EFAULT;
-	if (get_user(pad, (u32 *)uptr))
-		return err;
-	if ((third & ~IPC_64) == SETVAL)
-		fourth.val = (int)pad;
-	else
-		fourth.__pad = (void *)A(pad);
-	switch (third & (~IPC_64)) {
-
-	case IPC_INFO:
-	case IPC_RMID:
-	case SEM_INFO:
-	case GETVAL:
-	case GETPID:
-	case GETNCNT:
-	case GETZCNT:
-	case GETALL:
-	case SETALL:
-	case SETVAL:
-		err = sys_semctl(first, second, third, fourth);
-		break;
-
-	case IPC_STAT:
-	case SEM_STAT:
-		if (third & IPC_64) {
-			struct semid64_ds s64;
-			struct semid64_ds32 *usp;
-
-			usp = (struct semid64_ds32 *)A(pad);
-			fourth.__pad = &s64;
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_semctl(first, second, third, fourth);
-			set_fs(old_fs);
-			err2 = copy_to_user(&usp->sem_perm, &s64.sem_perm,
-					    sizeof(struct ipc64_perm));
-			err2 |= __put_user(s64.sem_otime, &usp->sem_otime);
-			err2 |= __put_user(s64.sem_ctime, &usp->sem_ctime);
-			err2 |= __put_user(s64.sem_nsems, &usp->sem_nsems);
-			if (err2)
-				err = -EFAULT;
-		} else {
-			struct semid_ds s;
-			struct semid_ds32 *usp;
-
-			usp = (struct semid_ds32 *)A(pad);
-			fourth.__pad = &s;
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_semctl(first, second, third, fourth);
-			set_fs(old_fs);
-			err2 = copy_to_user(&usp->sem_perm, &s.sem_perm,
-					    sizeof(struct ipc_perm));
-			err2 |= __put_user(s.sem_otime, &usp->sem_otime);
-			err2 |= __put_user(s.sem_ctime, &usp->sem_ctime);
-			err2 |= __put_user(s.sem_nsems, &usp->sem_nsems);
-			if (err2)
-				err = -EFAULT;
-		}
-		break;
- 
-	case IPC_SET:
-		if (third & IPC_64) {
-			struct semid64_ds s64;
-			struct semid64_ds32 *usp;
-
-			usp = (struct semid64_ds32 *)A(pad);
-
-			err = get_user(s64.sem_perm.uid, &usp->sem_perm.uid);
-			err |= __get_user(s64.sem_perm.gid,
-					  &usp->sem_perm.gid);
-			err |= __get_user(s64.sem_perm.mode,
-					  &usp->sem_perm.mode);
-			if (err)
-				goto out;
-			fourth.__pad = &s64;
-
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_semctl(first, second, third, fourth);
-			set_fs(old_fs);
-
-		} else {
-			struct semid_ds s;
-			struct semid_ds32 *usp;
-
-			usp = (struct semid_ds32 *)A(pad);
-
-			err = get_user(s.sem_perm.uid, &usp->sem_perm.uid);
-			err |= __get_user(s.sem_perm.gid,
-					  &usp->sem_perm.gid);
-			err |= __get_user(s.sem_perm.mode,
-					  &usp->sem_perm.mode);
-			if (err)
-				goto out;
-			fourth.__pad = &s;
-
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_semctl(first, second, third, fourth);
-			set_fs(old_fs);
-		}
-		break;
-	default:
-		err = -EINVAL;
-	}
-out:
-	return err;
-}
-
-#define MAXBUF (64*1024)
-
-static int 
-do_sys32_msgsnd(int first, int second, int third, void *uptr)
+long sys32_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
+	       u32 fifth)
 {
-	struct msgbuf *p;
-	struct msgbuf32 *up = (struct msgbuf32 *)uptr;
-	mm_segment_t old_fs;
-	int err;
-
-	if (second < 0 || (second >= MAXBUF-sizeof(struct msgbuf)))
-		return -EINVAL;
-
-	p = kmalloc(second + sizeof(struct msgbuf), GFP_USER);
-	if (!p)
-		return -ENOMEM;
-	err = get_user(p->mtype, &up->mtype);
-	err |= copy_from_user(p->mtext, &up->mtext, second);
-	if (err) {
-		err = -EFAULT;
-		goto out;
-	}
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	err = sys_msgsnd(first, p, second, third);
-	set_fs(old_fs);
-out:
-	kfree(p);
-	return err;
-}
+	int version;
 
-static int
-do_sys32_msgrcv(int first, int second, int msgtyp, int third,
-		int version, void *uptr)
-{
-	struct msgbuf32 *up;
-	struct msgbuf *p;
-	mm_segment_t old_fs;
-	int err;
-
-	if (second < 0 || (second >= MAXBUF-sizeof(struct msgbuf)))
-		return -EINVAL;
-
-	if (!version) {
-		struct ipc_kludge_32 *uipck = (struct ipc_kludge_32 *)uptr;
-		struct ipc_kludge_32 ipck;
-
-		err = -EINVAL;
-		if (!uptr)
-			goto out;
-		err = -EFAULT;
-		if (copy_from_user(&ipck, uipck, sizeof(struct ipc_kludge_32)))
-			goto out;
-		uptr = (void *)A(ipck.msgp);
-		msgtyp = ipck.msgtyp;
-	}
-	err = -ENOMEM;
-	p = kmalloc(second + sizeof (struct msgbuf), GFP_USER);
-	if (!p)
-		goto out;
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	err = sys_msgrcv(first, p, second, msgtyp, third);
-	set_fs(old_fs);
-	if (err < 0)
-		goto free_then_out;
-	up = (struct msgbuf32 *)uptr;
-	if (put_user(p->mtype, &up->mtype) ||
-	    copy_to_user(&up->mtext, p->mtext, err))
-		err = -EFAULT;
-free_then_out:
-	kfree(p);
-out:
-	return err;
-}
-
-static int
-do_sys32_msgctl(int first, int second, void *uptr)
-{
-	int err = -EINVAL, err2;
-	mm_segment_t old_fs;
-
-	switch (second & (~IPC_64)) {
-
-	case IPC_INFO:
-	case IPC_RMID:
-	case MSG_INFO:
-		err = sys_msgctl(first, second, (struct msqid_ds *)uptr);
-		break;
-
-	case IPC_SET:
-		if (second & IPC_64) {
-			struct msqid64_ds m64;
-			struct msqid64_ds32 *up = (struct msqid64_ds32 *)uptr;
-
-			err2 = copy_from_user(&m64.msg_perm, &up->msg_perm,
-					      sizeof(struct ipc64_perm));
-			err2 |= __get_user(m64.msg_qbytes, &up->msg_qbytes);
-			if (err2) {
-				err = -EFAULT;
-				break;
-			}
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_msgctl(first, second,
-					 (struct msqid_ds *)&m64);
-			set_fs(old_fs);
-		} else {
-			struct msqid_ds m;
-			struct msqid_ds32 *up = (struct msqid_ds32 *)uptr;
-
-			err2 = copy_from_user(&m.msg_perm, &up->msg_perm,
-					      sizeof(struct ipc_perm));
-			err2 |= __get_user(m.msg_qbytes, &up->msg_qbytes);
-			if (err2) {
-				err = -EFAULT;
-				break;
-			}
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_msgctl(first, second, &m);
-			set_fs(old_fs);
-		}
-		break;
-
-	case IPC_STAT:
-	case MSG_STAT:
-		if (second & IPC_64) {
-			struct msqid64_ds m64;
-			struct msqid64_ds32 *up = (struct msqid64_ds32 *)uptr;
-
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_msgctl(first, second,
-					 (struct msqid_ds *)&m64);
-			set_fs(old_fs);
-
-			err2 = copy_to_user(&up->msg_perm, &m64.msg_perm,
-					    sizeof(struct ipc64_perm));
- 			err2 |= __put_user(m64.msg_stime, &up->msg_stime);
-			err2 |= __put_user(m64.msg_rtime, &up->msg_rtime);
-			err2 |= __put_user(m64.msg_ctime, &up->msg_ctime);
-			err2 |= __put_user(m64.msg_cbytes, &up->msg_cbytes);
-			err2 |= __put_user(m64.msg_qnum, &up->msg_qnum);
-			err2 |= __put_user(m64.msg_qbytes, &up->msg_qbytes);
-			err2 |= __put_user(m64.msg_lspid, &up->msg_lspid);
-			err2 |= __put_user(m64.msg_lrpid, &up->msg_lrpid);
-			if (err2)
-				err = -EFAULT;
-		} else {
-			struct msqid64_ds m;
-			struct msqid_ds32 *up = (struct msqid_ds32 *)uptr;
-
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_msgctl(first, second, (struct msqid_ds *)&m);
-			set_fs(old_fs);
-
-			err2 = copy_to_user(&up->msg_perm, &m.msg_perm,
-					    sizeof(struct ipc_perm));
- 			err2 |= __put_user(m.msg_stime, &up->msg_stime);
-			err2 |= __put_user(m.msg_rtime, &up->msg_rtime);
-			err2 |= __put_user(m.msg_ctime, &up->msg_ctime);
-			err2 |= __put_user(m.msg_cbytes, &up->msg_cbytes);
-			err2 |= __put_user(m.msg_qnum, &up->msg_qnum);
-			err2 |= __put_user(m.msg_qbytes, &up->msg_qbytes);
-			err2 |= __put_user(m.msg_lspid, &up->msg_lspid);
-			err2 |= __put_user(m.msg_lrpid, &up->msg_lrpid);
-			if (err2)
-				err = -EFAULT;
-		}
-		break;
-	}
-	return err;
-}
-
-static int
-do_sys32_shmat(int first, int second, int third, int version, void *uptr)
-{
-	unsigned long raddr;
-	u32 *uaddr = (u32 *)A((u32)third);
-	int err = -EINVAL;
-
-	if (version == 1)
-		return err;
-	err = do_shmat(first, uptr, second, &raddr);
-	if (err)
-		return err;
-	err = put_user(raddr, uaddr);
-	return err;
-}
-
-static int
-do_sys32_shmctl(int first, int second, void *uptr)
-{
-	int err = -EINVAL, err2;
-	mm_segment_t old_fs;
-
-	switch (second & (~IPC_64)) {
-
-	case IPC_INFO:
-	case IPC_RMID:
-	case SHM_LOCK:
-	case SHM_UNLOCK:
-		err = sys_shmctl(first, second, (struct shmid_ds *)uptr);
-		break;
-	case IPC_SET:
-		if (second & IPC_64) {
-			struct shmid64_ds32 *up = (struct shmid64_ds32 *)uptr;
-			struct shmid64_ds s64;
-
-			err = get_user(s64.shm_perm.uid, &up->shm_perm.uid);
-			err |= __get_user(s64.shm_perm.gid, &up->shm_perm.gid);
-			err |= __get_user(s64.shm_perm.mode,
-					  &up->shm_perm.mode);
-			if (err)
-				break;
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_shmctl(first, second,
-					 (struct shmid_ds *)&s64);
-			set_fs(old_fs);
-		} else {
-			struct shmid_ds32 *up = (struct shmid_ds32 *)uptr;
-			struct shmid_ds s;
-
-			err = get_user(s.shm_perm.uid, &up->shm_perm.uid);
-			err |= __get_user(s.shm_perm.gid, &up->shm_perm.gid);
-			err |= __get_user(s.shm_perm.mode, &up->shm_perm.mode);
-			if (err)
-				break;
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_shmctl(first, second, &s);
-			set_fs(old_fs);
-		}
-		break;
-
-	case IPC_STAT:
-	case SHM_STAT:
-		if (second & IPC_64) {
-			struct shmid64_ds32 *up = (struct shmid64_ds32 *)uptr;
-			struct shmid64_ds s64;
-
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_shmctl(first, second,
-					 (struct shmid_ds *)&s64);
-			set_fs(old_fs);
-			if (err < 0)
-				break;
-
-			err2 = copy_to_user(&up->shm_perm, &s64.shm_perm,
-					    sizeof(struct ipc64_perm));
-			err2 |= __put_user(s64.shm_atime, &up->shm_atime);
-			err2 |= __put_user(s64.shm_dtime, &up->shm_dtime);
-			err2 |= __put_user(s64.shm_ctime, &up->shm_ctime);
-			err2 |= __put_user(s64.shm_segsz, &up->shm_segsz);
-			err2 |= __put_user(s64.shm_nattch, &up->shm_nattch);
-			err2 |= __put_user(s64.shm_cpid, &up->shm_cpid);
-			err2 |= __put_user(s64.shm_lpid, &up->shm_lpid);
-			if (err2)
-				err = -EFAULT;
-		} else {
-			struct shmid_ds32 *up = (struct shmid_ds32 *)uptr;
-			struct shmid_ds s;
-
-			old_fs = get_fs();
-			set_fs(KERNEL_DS);
-			err = sys_shmctl(first, second, &s);
-			set_fs(old_fs);
-			if (err < 0)
-				break;
-
-			err2 = copy_to_user(&up->shm_perm, &s.shm_perm,
-					    sizeof(struct ipc_perm));
-			err2 |= __put_user (s.shm_atime, &up->shm_atime);
-			err2 |= __put_user (s.shm_dtime, &up->shm_dtime);
-			err2 |= __put_user (s.shm_ctime, &up->shm_ctime);
-			err2 |= __put_user (s.shm_segsz, &up->shm_segsz);
-			err2 |= __put_user (s.shm_nattch, &up->shm_nattch);
-			err2 |= __put_user (s.shm_cpid, &up->shm_cpid);
-			err2 |= __put_user (s.shm_lpid, &up->shm_lpid);
-			if (err2)
-				err = -EFAULT;
-		}
-		break;
-
-	case SHM_INFO: {
-		struct shm_info si;
-		struct shm_info32 {
-			int used_ids;
-			u32 shm_tot, shm_rss, shm_swp;
-			u32 swap_attempts, swap_successes;
-		} *uip = (struct shm_info32 *)uptr;
-
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		err = sys_shmctl(first, second, (struct shmid_ds *)&si);
-		set_fs(old_fs);
-		if (err < 0)
-			break;
-		err2 = put_user(si.used_ids, &uip->used_ids);
-		err2 |= __put_user(si.shm_tot, &uip->shm_tot);
-		err2 |= __put_user(si.shm_rss, &uip->shm_rss);
-		err2 |= __put_user(si.shm_swp, &uip->shm_swp);
-		err2 |= __put_user(si.swap_attempts, &uip->swap_attempts);
-		err2 |= __put_user(si.swap_successes, &uip->swap_successes);
-		if (err2)
-			err = -EFAULT;
-		break;
-	}
-	}
-	return err;
-}
-
-static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems,
-			    const struct compat_timespec *timeout32)
-{
-	struct compat_timespec t32;
-	struct timespec *t64 = compat_alloc_user_space(sizeof(*t64));
-
-	if (copy_from_user(&t32, timeout32, sizeof(t32)))
-		return -EFAULT;
-
-	if (put_user(t32.tv_sec, &t64->tv_sec) ||
-	    put_user(t32.tv_nsec, &t64->tv_nsec))
-		return -EFAULT;
-
-	return sys_semtimedop(semid, tsems, nsems, t64);
-}
-
-/*
- * Note: it is necessary to treat first_parm, second_parm, and
- * third_parm as unsigned ints, with the corresponding cast to a
- * signed int to insure that the proper conversion (sign extension)
- * between the register representation of a signed int (msr in 32-bit
- * mode) and the register representation of a signed int (msr in
- * 64-bit mode) is performed.
- */
-asmlinkage long sys32_ipc(u32 call, u32 first_parm, u32 second_parm, u32 third_parm, u32 ptr, u32 fifth)
-{
-	int first  = (int)first_parm;
-	int second = (int)second_parm;
-	int third  = (int)third_parm;
-	int version, err;
-	
 	version = call >> 16; /* hack for backward compatibility */
 	call &= 0xffff;
 
 	switch (call) {
 
+	case SEMTIMEDOP:
+		if (third)
+			/* sign extend semid */
+			return compat_sys_semtimedop((int)first,
+						     compat_ptr(ptr), second,
+						     compat_ptr(third));
+		/* else fall through for normal semop() */
 	case SEMOP:
 		/* struct sembuf is the same on 32 and 64bit :)) */
-		err = sys_semtimedop(first, (struct sembuf *)AA(ptr),
-				     second, NULL);
-		break;
-	case SEMTIMEDOP:
-		err = sys32_semtimedop(first, (struct sembuf *)AA(ptr), second,
-				       (const struct compat_timespec *)AA(fifth));
-		break;
+		/* sign extend semid */
+		return sys_semtimedop((int)first, compat_ptr(ptr), second,
+				      NULL);
 	case SEMGET:
-		err = sys_semget(first, second, third);
-		break;
+		/* sign extend key, nsems */
+		return sys_semget((int)first, (int)second, third);
 	case SEMCTL:
-		err = do_sys32_semctl(first, second, third,
-				      (void *)AA(ptr));
-		break;
+		/* sign extend semid, semnum */
+		return compat_sys_semctl((int)first, (int)second, third,
+					 compat_ptr(ptr));
 
 	case MSGSND:
-		err = do_sys32_msgsnd(first, second, third,
-				      (void *)AA(ptr));
-		break;
+		/* sign extend msqid */
+		return compat_sys_msgsnd((int)first, (int)second, third,
+					 compat_ptr(ptr));
 	case MSGRCV:
-		err = do_sys32_msgrcv(first, second, fifth, third,
-				      version, (void *)AA(ptr));
-		break;
+		/* sign extend msqid, msgtyp */
+		return compat_sys_msgrcv((int)first, second, (int)fifth,
+					 third, version, compat_ptr(ptr));
 	case MSGGET:
-		err = sys_msgget((key_t)first, second);
-		break;
+		/* sign extend key */
+		return sys_msgget((int)first, second);
 	case MSGCTL:
-		err = do_sys32_msgctl(first, second, (void *)AA(ptr));
-		break;
+		/* sign extend msqid */
+		return compat_sys_msgctl((int)first, second, compat_ptr(ptr));
 
 	case SHMAT:
-		err = do_sys32_shmat(first, second, third,
-				     version, (void *)AA(ptr));
-		break;
-	case SHMDT: 
-		err = sys_shmdt((char *)AA(ptr));
-		break;
+		/* sign extend shmid */
+		return compat_sys_shmat((int)first, second, third, version,
+					compat_ptr(ptr));
+	case SHMDT:
+		return sys_shmdt(compat_ptr(ptr));
 	case SHMGET:
-		err = sys_shmget(first, second_parm, third);
-		break;
+		/* sign extend key_t */
+		return sys_shmget((int)first, second, third);
 	case SHMCTL:
-		err = do_sys32_shmctl(first, second, (void *)AA(ptr));
-		break;
+		/* sign extend shmid */
+		return compat_sys_shmctl((int)first, second, compat_ptr(ptr));
+
 	default:
-		err = -ENOSYS;
-		break;
+		return -ENOSYS;
 	}
-	return err;
+
+	return -ENOSYS;
 }
 
 /* Note: it is necessary to treat out_fd and in_fd as unsigned ints, 
@@ -1683,17 +562,20 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd, compat_off_t* offset, u32 count)
+asmlinkage long sys32_sendfile(u32 out_fd, u32 in_fd, compat_off_t __user * offset, u32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
 	off_t of;
-	
+	off_t __user *up;
+
 	if (offset && get_user(of, offset))
 		return -EFAULT;
-		
+
+	/* The __user pointer cast is valid because of the set_fs() */		
 	set_fs(KERNEL_DS);
-	ret = sys_sendfile((int)out_fd, (int)in_fd, offset ? &of : NULL, count);
+	up = offset ? (off_t __user *) &of : NULL;
+	ret = sys_sendfile((int)out_fd, (int)in_fd, up, count);
 	set_fs(old_fs);
 	
 	if (offset && put_user(of, offset))
@@ -1702,17 +584,20 @@
 	return ret;
 }
 
-asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count)
+asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
 	loff_t lof;
+	loff_t __user *up;
 	
 	if (offset && get_user(lof, offset))
 		return -EFAULT;
 		
+	/* The __user pointer cast is valid because of the set_fs() */		
 	set_fs(KERNEL_DS);
-	ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count);
+	up = offset ? (loff_t __user *) &lof : NULL;
+	ret = sys_sendfile64(out_fd, in_fd, up, count);
 	set_fs(old_fs);
 	
 	if (offset && put_user(lof, offset))
@@ -1721,191 +606,6 @@
 	return ret;
 }
 
-/*
- * count32() counts the number of arguments/envelopes
- */
-static int count32(u32 * argv, int max)
-{
-	int i = 0;
-
-	if (argv != NULL) {
-		for (;;) {
-			u32 p; int error;
-
-			error = get_user(p,argv);
-			if (error)
-				return error;
-			if (!p)
-				break;
-			argv++;
-			if (++i > max)
-				return -E2BIG;
-		}
-	}
-	return i;
-}
-
-/*
- * 'copy_string32()' copies argument/envelope strings from user
- * memory to free pages in kernel mem. These are in a format ready
- * to be put directly into the top of new user memory.
- */
-static int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm)
-{
-	while (argc-- > 0) {
-		u32 str;
-		int len;
-		unsigned long pos;
-
-		if (get_user(str, argv + argc) ||
-		    !str ||
-		    !(len = strnlen_user((char *)A(str), bprm->p)))
-			return -EFAULT;
-
-		if (bprm->p < len)
-			return -E2BIG;
-
-		bprm->p -= len;
-
-		pos = bprm->p;
-		while (len) {
-			char *kaddr;
-			struct page *page;
-			int offset, bytes_to_copy, new, err;
-
-			offset = pos % PAGE_SIZE;
-			page = bprm->page[pos / PAGE_SIZE];
-			new = 0;
-			if (!page) {
-				page = alloc_page(GFP_USER);
-				bprm->page[pos / PAGE_SIZE] = page;
-				if (!page)
-					return -ENOMEM;
-				new = 1;
-			}
-			kaddr = (char *)kmap(page);
-
-			if (new && offset)
-				memset(kaddr, 0, offset);
-			bytes_to_copy = PAGE_SIZE - offset;
-			if (bytes_to_copy > len) {
-				bytes_to_copy = len;
-				if (new)
-					memset(kaddr+offset+len, 0,
-					       PAGE_SIZE-offset-len);
-			}
-
-			err = copy_from_user(kaddr + offset, (char *)A(str),
-					     bytes_to_copy);
-			kunmap((unsigned long)kaddr);
-
-			if (err)
-				return -EFAULT;
-
-			pos += bytes_to_copy;
-			str += bytes_to_copy;
-			len -= bytes_to_copy;
-		}
-	}
-	return 0;
-}
-
-/*
- * sys32_execve() executes a new program.
- */
-static int do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs)
-{
-	struct linux_binprm bprm;
-	struct file * file;
-	int retval;
-	int i;
-
-	sched_balance_exec();
-
-	file = open_exec(filename);
-
-	retval = PTR_ERR(file);
-	if (IS_ERR(file))
-		return retval;
-
-	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
-	memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0]));
-
-	bprm.file = file;
-	bprm.filename = filename;
-	bprm.interp = filename;
-	bprm.sh_bang = 0;
-	bprm.loader = 0;
-	bprm.exec = 0;
-	bprm.security = NULL;
-	bprm.mm = mm_alloc();
-	retval = -ENOMEM;
-	if (!bprm.mm)
-		goto out_file;
-
-	retval = init_new_context(current, bprm.mm);
-	if (retval < 0)
-		goto out_mm;
-
-	bprm.argc = count32(argv, bprm.p / sizeof(u32));
-	if ((retval = bprm.argc) < 0)
-		goto out_mm;
-
-	bprm.envc = count32(envp, bprm.p / sizeof(u32));
-	if ((retval = bprm.envc) < 0)
-		goto out_mm;
-
-	retval = security_bprm_alloc(&bprm);
-	if (retval)
-		goto out;
-
-	retval = prepare_binprm(&bprm);
-	if (retval < 0) 
-		goto out; 
-
-	retval = copy_strings_kernel(1, &bprm.filename, &bprm);
-	if (retval < 0) 
-		goto out; 
-
-	bprm.exec = bprm.p;
-	retval = copy_strings32(bprm.envc, envp, &bprm);
-	if (retval < 0) 
-		goto out; 
-
-	retval = copy_strings32(bprm.argc, argv, &bprm);
-	if (retval < 0) 
-		goto out; 
-
-	retval = search_binary_handler(&bprm,regs);
-	if (retval >= 0) {
-		/* execve success */
-		security_bprm_free(&bprm);
-		return retval;
-	}
-
-out:
-	/* Something went wrong, return the inode and free the argument pages*/
-	for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
-		struct page * page = bprm.page[i];
-		if (page)
-			__free_page(page);
-	}
-
-	if (bprm.security)
-		security_bprm_free(&bprm);
-
-out_mm:
-	if (bprm.mm)
-		mmdrop(bprm.mm);
-
-out_file:
-	if (bprm.file) {
-		allow_write_access(bprm.file);
-		fput(bprm.file);
-	}
-	return retval;
-}
-
 long sys32_execve(unsigned long a0, unsigned long a1, unsigned long a2,
 		  unsigned long a3, unsigned long a4, unsigned long a5,
 		  struct pt_regs *regs)
@@ -1913,7 +613,7 @@
 	int error;
 	char * filename;
 	
-	filename = getname((char *) a0);
+	filename = getname((char __user *) a0);
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
@@ -1924,7 +624,7 @@
 		giveup_altivec(current);
 #endif /* CONFIG_ALTIVEC */
 
-	error = do_execve32(filename, (u32*) a1, (u32*) a2, regs);
+	error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs);
 
 	if (error == 0)
 		current->ptrace &= ~PT_DTRACE;
@@ -1983,14 +683,15 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_sched_rr_get_interval(u32 pid, struct compat_timespec *interval)
+asmlinkage long sys32_sched_rr_get_interval(u32 pid, struct compat_timespec __user *interval)
 {
 	struct timespec t;
 	int ret;
 	mm_segment_t old_fs = get_fs ();
-	
+
+	/* The __user pointer cast is valid because of the set_fs() */
 	set_fs (KERNEL_DS);
-	ret = sys_sched_rr_get_interval((int)pid, &t);
+	ret = sys_sched_rr_get_interval((int)pid, (struct timespec __user *) &t);
 	set_fs (old_fs);
 	if (put_compat_timespec(&t, interval))
 		return -EFAULT;
@@ -2003,7 +704,7 @@
 				  (unsigned long) dfn,
 				  (unsigned long) off,
 				  (unsigned long) len,
-				  (unsigned char *)AA(ubuf));
+				  (unsigned char __user *)AA(ubuf));
 }
 
 asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
@@ -2012,7 +713,7 @@
 				   (unsigned long) dfn,
 				   (unsigned long) off,
 				   (unsigned long) len,
-				   (unsigned char *)AA(ubuf));
+				   (unsigned char __user *)AA(ubuf));
 }
 
 #define IOBASE_BRIDGE_NUMBER	0
@@ -2073,7 +774,7 @@
 }
 
 
-asmlinkage int ppc64_newuname(struct new_utsname * name)
+asmlinkage int ppc64_newuname(struct new_utsname __user * name)
 {
 	int errno = sys_newuname(name);
 
@@ -2103,7 +804,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_access(const char * filename, u32 mode)
+asmlinkage long sys32_access(const char __user * filename, u32 mode)
 {
 	return sys_access(filename, (int)mode);
 }
@@ -2114,7 +815,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_creat(const char * pathname, u32 mode)
+asmlinkage long sys32_creat(const char __user * pathname, u32 mode)
 {
 	return sys_creat(pathname, (int)mode);
 }
@@ -2125,7 +826,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_waitpid(u32 pid, unsigned int * stat_addr, u32 options)
+asmlinkage long sys32_waitpid(u32 pid, unsigned int __user * stat_addr, u32 options)
 {
 	return sys_waitpid((int)pid, stat_addr, (int)options);
 }
@@ -2136,7 +837,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_getgroups(u32 gidsetsize, gid_t *grouplist)
+asmlinkage long sys32_getgroups(u32 gidsetsize, gid_t __user *grouplist)
 {
 	return sys_getgroups((int)gidsetsize, grouplist);
 }
@@ -2191,7 +892,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_mkdir(const char * pathname, u32 mode)
+asmlinkage long sys32_mkdir(const char __user * pathname, u32 mode)
 {
 	return sys_mkdir(pathname, (int)mode);
 }
@@ -2212,7 +913,7 @@
  * This is just a version for 32-bit applications which does
  * not force O_LARGEFILE on.
  */
-long sys32_open(const char * filename, int flags, int mode)
+asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
 {
 	char * tmp;
 	int fd, error;
@@ -2244,7 +945,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_readlink(const char * path, char * buf, u32 bufsiz)
+asmlinkage long sys32_readlink(const char __user * path, char __user * buf, u32 bufsiz)
 {
 	return sys_readlink(path, buf, (int)bufsiz);
 }
@@ -2276,7 +977,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_sched_getparam(u32 pid, struct sched_param *param)
+asmlinkage long sys32_sched_getparam(u32 pid, struct sched_param __user *param)
 {
 	return sys_sched_getparam((int)pid, param);
 }
@@ -2298,7 +999,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_sched_setparam(u32 pid, struct sched_param *param)
+asmlinkage long sys32_sched_setparam(u32 pid, struct sched_param __user *param)
 {
 	return sys_sched_setparam((int)pid, param);
 }
@@ -2309,7 +1010,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_sched_setscheduler(u32 pid, u32 policy, struct sched_param *param)
+asmlinkage long sys32_sched_setscheduler(u32 pid, u32 policy, struct sched_param __user *param)
 {
 	return sys_sched_setscheduler((int)pid, (int)policy, param);
 }
@@ -2320,7 +1021,7 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_setdomainname(char *name, u32 len)
+asmlinkage long sys32_setdomainname(char __user *name, u32 len)
 {
 	return sys_setdomainname(name, (int)len);
 }
@@ -2331,13 +1032,13 @@
  * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
  * and the register representation of a signed int (msr in 64-bit mode) is performed.
  */
-asmlinkage long sys32_setgroups(u32 gidsetsize, gid_t *grouplist)
+asmlinkage long sys32_setgroups(u32 gidsetsize, gid_t __user *grouplist)
 {
 	return sys_setgroups((int)gidsetsize, grouplist);
 }
 
 
-asmlinkage long sys32_sethostname(char *name, u32 len)
+asmlinkage long sys32_sethostname(char __user *name, u32 len)
 {
 	/* sign extend len */
 	return sys_sethostname(name, (int)len);
@@ -2371,7 +1072,7 @@
 	return sys_ssetmask((int) newmask);
 }
 
-long sys32_syslog(u32 type, char * buf, u32 len)
+asmlinkage long sys32_syslog(u32 type, char __user * buf, u32 len)
 {
 	/* sign extend len */
 	return sys_syslog(type, buf, (int)len);
@@ -2398,12 +1099,13 @@
 	u32 __unused[4];
 };
 
-extern asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
+extern asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
 {
 	struct __sysctl_args32 tmp;
 	int error;
-	size_t oldlen, *oldlenp = NULL;
-	unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
+	size_t oldlen;
+	size_t __user *oldlenp = NULL;
+	unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
 
 	if (copy_from_user(&tmp, args, sizeof(tmp)))
 		return -EFAULT;
@@ -2415,20 +1117,20 @@
 		   basically copy the whole sysctl.c here, and
 		   glibc's __sysctl uses rw memory for the structure
 		   anyway.  */
-		if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) ||
-		    put_user(oldlen, (size_t *)addr))
+		oldlenp = (size_t __user *)addr;
+		if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
+		    put_user(oldlen, oldlenp))
 			return -EFAULT;
-		oldlenp = (size_t *)addr;
 	}
 
 	lock_kernel();
-	error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval),
-			  oldlenp, (void *)A(tmp.newval), tmp.newlen);
+	error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval),
+			  oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
 	unlock_kernel();
 	if (oldlenp) {
 		if (!error) {
-			if (get_user(oldlen, (size_t *)addr) ||
-			    put_user(oldlen, (u32 *)A(tmp.oldlenp)))
+			if (get_user(oldlen, oldlenp) ||
+			    put_user(oldlen, (u32 __user *)A(tmp.oldlenp)))
 				error = -EFAULT;
 		}
 		copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -2436,7 +1138,7 @@
 	return error;
 }
 
-asmlinkage long sys32_time(compat_time_t* tloc)
+asmlinkage long sys32_time(compat_time_t __user * tloc)
 {
 	compat_time_t secs;
 
@@ -2453,7 +1155,7 @@
 	return secs;
 }
 
-int sys32_olduname(struct oldold_utsname * name)
+asmlinkage int sys32_olduname(struct oldold_utsname __user * name)
 {
 	int error;
 	
@@ -2488,37 +1190,26 @@
 	return sys_mmap(addr, len, prot, flags, fd, pgoff << 12);
 }
 
-int get_compat_timeval(struct timeval *tv, struct compat_timeval *ctv)
+int get_compat_timeval(struct timeval *tv, struct compat_timeval __user *ctv)
 {
 	return (verify_area(VERIFY_READ, ctv, sizeof(*ctv)) ||
 		__get_user(tv->tv_sec, &ctv->tv_sec) ||
 		__get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0;
 }
 
-long sys32_utimes(char *filename, struct compat_timeval *tvs)
+asmlinkage long sys32_utimes(char __user *filename, struct compat_timeval __user *tvs)
 {
-	char *kfilename;
-	struct timeval ktvs[2];
-	mm_segment_t old_fs;
-	long ret;
-
-	kfilename = getname(filename);
-	ret = PTR_ERR(kfilename);
-	if (!IS_ERR(kfilename)) {
-		if (tvs) {
-			if (get_compat_timeval(&ktvs[0], &tvs[0]) ||
-			    get_compat_timeval(&ktvs[1], &tvs[1]))
-				return -EFAULT;
-		}
+	struct timeval ktvs[2], *ptr;
 
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		ret = do_utimes(kfilename, (tvs ? &ktvs[0] : NULL));
-		set_fs(old_fs);
-
-		putname(kfilename);
+	ptr = NULL;
+	if (tvs) {
+		if (get_compat_timeval(&ktvs[0], &tvs[0]) ||
+		    get_compat_timeval(&ktvs[1], &tvs[1]))
+			return -EFAULT;
+		ptr = ktvs;
 	}
-	return ret;
+
+	return do_utimes(filename, ptr);
 }
 
 long sys32_tgkill(u32 tgid, u32 pid, int sig)
@@ -2532,13 +1223,13 @@
  * The 32 bit ABI passes long longs in an odd even register pair.
  */
 
-compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf, compat_size_t count,
+compat_ssize_t sys32_pread64(unsigned int fd, char __user *ubuf, compat_size_t count,
 			     u32 reg6, u32 poshi, u32 poslo)
 {
 	return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
 }
 
-compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf, compat_size_t count,
+compat_ssize_t sys32_pwrite64(unsigned int fd, char __user *ubuf, compat_size_t count,
 			      u32 reg6, u32 poshi, u32 poslo)
 {
 	return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);
@@ -2549,7 +1240,7 @@
 	return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count);
 }
 
-asmlinkage int sys32_truncate64(const char * path, u32 reg4,
+asmlinkage int sys32_truncate64(const char __user * path, u32 reg4,
 				unsigned long high, unsigned long low)
 {
 	return sys_truncate(path, (high << 32) | low);
@@ -2561,7 +1252,7 @@
 	return sys_ftruncate(fd, (high << 32) | low);
 }
 
-long ppc32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf,
+long ppc32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
 			  size_t len)
 {
 	return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
@@ -2582,7 +1273,7 @@
 			     (u64)len_high << 32 | len_low, advice);
 }
 
-extern long sys_timer_create(clockid_t, sigevent_t *, timer_t *);
+extern asmlinkage long sys_timer_create(clockid_t, sigevent_t __user *, timer_t __user *);
 
 long ppc32_timer_create(clockid_t clock,
 			struct compat_sigevent __user *ev32,
@@ -2611,7 +1302,10 @@
 
 	savefs = get_fs();
 	set_fs(KERNEL_DS);
-	err = sys_timer_create(clock, &event, &t);
+	/* The __user pointer casts are valid due to the set_fs() */
+	err = sys_timer_create(clock,
+		(sigevent_t __user *) &event,
+		(timer_t __user *) &t);
 	set_fs(savefs);
 
 	if (err == 0)
diff -Nru a/arch/ppc64/kernel/syscalls.c b/arch/ppc64/kernel/syscalls.c
--- a/arch/ppc64/kernel/syscalls.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc64/kernel/syscalls.c	Tue Jun 15 22:20:42 2004
@@ -57,7 +57,7 @@
  * This is really horribly ugly.
  */
 asmlinkage int 
-sys_ipc (uint call, int first, int second, long third, void *ptr, long fifth)
+sys_ipc (uint call, int first, int second, long third, void __user *ptr, long fifth)
 {
 	int version, ret;
 
@@ -67,12 +67,12 @@
 	ret = -ENOSYS;
 	switch (call) {
 	case SEMOP:
-		ret = sys_semtimedop (first, (struct sembuf *)ptr, second,
+		ret = sys_semtimedop (first, (struct sembuf __user *)ptr, second,
 				      NULL);
 		break;
 	case SEMTIMEDOP:
-		ret = sys_semtimedop (first, (struct sembuf *)ptr, second,
-				      (const struct timespec *) fifth);
+		ret = sys_semtimedop (first, (struct sembuf __user *)ptr, second,
+				      (const struct timespec __user *) fifth);
 		break;
 	case SEMGET:
 		ret = sys_semget (first, second, third);
@@ -83,13 +83,13 @@
 		ret = -EINVAL;
 		if (!ptr)
 			break;
-		if ((ret = get_user(fourth.__pad, (void **)ptr)))
+		if ((ret = get_user(fourth.__pad, (void __user * __user *)ptr)))
 			break;
 		ret = sys_semctl (first, second, third, fourth);
 		break;
 	}
 	case MSGSND:
-		ret = sys_msgsnd (first, (struct msgbuf *) ptr, second, third);
+		ret = sys_msgsnd (first, (struct msgbuf __user *) ptr, second, third);
 		break;
 	case MSGRCV:
 		switch (version) {
@@ -100,7 +100,7 @@
 			if (!ptr)
 				break;
 			if ((ret = copy_from_user(&tmp,
-						(struct ipc_kludge *) ptr,
+						(struct ipc_kludge __user *) ptr,
 						sizeof (tmp)) ? -EFAULT : 0))
 				break;
 			ret = sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp,
@@ -108,7 +108,7 @@
 			break;
 		}
 		default:
-			ret = sys_msgrcv (first, (struct msgbuf *) ptr,
+			ret = sys_msgrcv (first, (struct msgbuf __user *) ptr,
 					  second, fifth, third);
 			break;
 		}
@@ -117,35 +117,35 @@
 		ret = sys_msgget ((key_t) first, second);
 		break;
 	case MSGCTL:
-		ret = sys_msgctl (first, second, (struct msqid_ds *) ptr);
+		ret = sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
 		break;
 	case SHMAT:
 		switch (version) {
 		default: {
 			ulong raddr;
-			ret = do_shmat (first, (char *) ptr, second, &raddr);
+			ret = do_shmat (first, (char __user *) ptr, second, &raddr);
 			if (ret)
 				break;
-			ret = put_user (raddr, (ulong *) third);
+			ret = put_user (raddr, (ulong __user *) third);
 			break;
 		}
 		case 1:	/* iBCS2 emulator entry point */
 			ret = -EINVAL;
 			if (!segment_eq(get_fs(), get_ds()))
 				break;
-			ret = do_shmat (first, (char *) ptr, second,
+			ret = do_shmat (first, (char __user *) ptr, second,
 					 (ulong *) third);
 			break;
 		}
 		break;
 	case SHMDT: 
-		ret = sys_shmdt ((char *)ptr);
+		ret = sys_shmdt ((char __user *)ptr);
 		break;
 	case SHMGET:
 		ret = sys_shmget (first, second, third);
 		break;
 	case SHMCTL:
-		ret = sys_shmctl (first, second, (struct shmid_ds *) ptr);
+		ret = sys_shmctl (first, second, (struct shmid_ds __user *) ptr);
 		break;
 	}
 
@@ -156,7 +156,7 @@
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way unix traditionally does this, though.
  */
-asmlinkage int sys_pipe(int *fildes)
+asmlinkage int sys_pipe(int __user *fildes)
 {
 	int fd[2];
 	int error;
@@ -202,7 +202,7 @@
 }
 __setup("fakeppc", set_fakeppc);
 
-asmlinkage int sys_uname(struct old_utsname * name)
+asmlinkage int sys_uname(struct old_utsname __user * name)
 {
 	int err = -EFAULT;
 	
@@ -214,7 +214,7 @@
 	return err;
 }
 
-asmlinkage time_t sys64_time(time_t* tloc)
+asmlinkage time_t sys64_time(time_t __user * tloc)
 {
 	time_t secs;
 	time_t usecs;
diff -Nru a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c
--- a/arch/ppc64/kernel/sysfs.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc64/kernel/sysfs.c	Tue Jun 15 22:20:37 2004
@@ -114,6 +114,7 @@
 	unsigned long hid0;
 	unsigned long set, reset;
 	int ret;
+	unsigned int ctrl;
 
 	/* Only need to enable them once */
 	if (__get_cpu_var(pmcs_enabled))
@@ -157,6 +158,16 @@
 	if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
 		char *ptr = (char *)&paca[smp_processor_id()].xLpPaca;
 		ptr[0xBB] = 1;
+	}
+
+	/*
+	 * 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) {
+		ctrl = mfspr(CTRLF);
+		ctrl |= RUNLATCH;
+		mtspr(CTRLT, ctrl);
 	}
 }
 #endif
diff -Nru a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
--- a/arch/ppc64/kernel/time.c	Tue Jun 15 22:21:02 2004
+++ b/arch/ppc64/kernel/time.c	Tue Jun 15 22:21:02 2004
@@ -66,7 +66,7 @@
 
 void smp_local_timer_interrupt(struct pt_regs *);
 
-u64 jiffies_64 = INITIAL_JIFFIES;
+u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
 
 EXPORT_SYMBOL(jiffies_64);
 
@@ -256,7 +256,7 @@
  * call will not be needed)
  */
 
-unsigned long tb_last_stamp=0;
+unsigned long tb_last_stamp __cacheline_aligned_in_smp;
 
 /*
  * timer_interrupt - gets called when the decrementer overflows,
@@ -430,7 +430,7 @@
  * fields itself.  This way, the fields which are used for 
  * do_settimeofday get updated too.
  */
-long ppc64_sys32_stime(int* tptr)
+long ppc64_sys32_stime(int __user * tptr)
 {
 	int value;
 	struct timespec myTimeval;
@@ -455,7 +455,7 @@
  * fields itself.  This way, the fields which are used for 
  * do_settimeofday get updated too.
  */
-long ppc64_sys_stime(long* tptr)
+long ppc64_sys_stime(long __user * tptr)
 {
 	long value;
 	struct timespec myTimeval;
diff -Nru a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
--- a/arch/ppc64/kernel/traps.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc64/kernel/traps.c	Tue Jun 15 22:20:40 2004
@@ -44,6 +44,7 @@
 
 #ifdef CONFIG_DEBUGGER
 int (*__debugger)(struct pt_regs *regs);
+int (*__debugger_ipi)(struct pt_regs *regs);
 int (*__debugger_bpt)(struct pt_regs *regs);
 int (*__debugger_sstep)(struct pt_regs *regs);
 int (*__debugger_iabr_match)(struct pt_regs *regs);
@@ -51,6 +52,7 @@
 int (*__debugger_fault_handler)(struct pt_regs *regs);
 
 EXPORT_SYMBOL(__debugger);
+EXPORT_SYMBOL(__debugger_ipi);
 EXPORT_SYMBOL(__debugger_bpt);
 EXPORT_SYMBOL(__debugger_sstep);
 EXPORT_SYMBOL(__debugger_iabr_match);
@@ -69,9 +71,6 @@
 	static int die_counter;
 	int nl = 0;
 
-	if (debugger_fault_handler(regs))
-		return 1;
-
 	if (debugger(regs))
 		return 1;
 
@@ -266,6 +265,8 @@
 	}
 #endif
 
+	if (debugger_fault_handler(regs))
+		return;
 	die("Machine check", regs, 0);
 
 	/* Must die if the interrupt is not recoverable */
@@ -465,6 +466,18 @@
 	_exception(SIGTRAP, &info, regs);	
 }
 
+/*
+ * After we have successfully emulated an instruction, we have to
+ * check if the instruction was being single-stepped, and if so,
+ * pretend we got a single-step exception.  This was pointed out
+ * by Kumar Gala.  -- paulus
+ */
+static inline void emulate_single_step(struct pt_regs *regs)
+{
+	if (regs->msr & MSR_SE)
+		SingleStepException(regs);
+}
+
 static void dummy_perf(struct pt_regs *regs)
 {
 }
@@ -486,10 +499,8 @@
 	fixed = fix_alignment(regs);
 
 	if (fixed == 1) {
-		if (!user_mode(regs))
-			PPCDBG(PPCDBG_ALIGNFIXUP, "fix alignment at %lx\n",
-			       regs->nip);
 		regs->nip += 4;	/* skip over emulated instruction */
+		emulate_single_step(regs);
 		return;
 	}
 
diff -Nru a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c
--- a/arch/ppc64/kernel/vio.c	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc64/kernel/vio.c	Tue Jun 15 22:20:38 2004
@@ -32,7 +32,9 @@
 
 extern struct subsystem devices_subsys; /* needed for vio_find_name() */
 
-struct iommu_table *vio_build_iommu_table(struct vio_dev *dev);
+static struct iommu_table *vio_build_iommu_table(struct vio_dev *);
+static const struct vio_device_id *vio_match_device(
+		const struct vio_device_id *, const struct vio_dev *);
 
 #ifdef CONFIG_PPC_PSERIES
 static int vio_num_address_cells;
@@ -136,15 +138,15 @@
  * system is in its list of supported devices. Returns the matching
  * vio_device_id structure or NULL if there is no match.
  */
-const struct vio_device_id * vio_match_device(const struct vio_device_id *ids,
+static const struct vio_device_id * vio_match_device(const struct vio_device_id *ids,
 	const struct vio_dev *dev)
 {
 	DBGENTER();
 
 #ifdef CONFIG_PPC_PSERIES
 	while (ids->type) {
-		if ((strncmp(dev->archdata->type, ids->type, strlen(ids->type)) == 0) &&
-			device_is_compatible((struct device_node*)dev->archdata, ids->compat))
+		if ((strncmp(((struct device_node *)dev->dev.platform_data)->type, ids->type, strlen(ids->type)) == 0) &&
+			device_is_compatible(dev->dev.platform_data, ids->compat))
 			return ids;
 		ids++;
 	}
@@ -263,14 +265,21 @@
 	DBGENTER();
 
 	/* XXX free TCE table */
-	of_node_put(viodev->archdata);
+	of_node_put(viodev->dev.platform_data);
 	kfree(viodev);
 }
 
+static ssize_t viodev_show_devspec(struct device *dev, char *buf)
+{
+	struct device_node *of_node = dev->platform_data;
+
+	return sprintf(buf, "%s\n", of_node->full_name);
+}
+DEVICE_ATTR(devspec, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_devspec, NULL);
+
 static ssize_t viodev_show_name(struct device *dev, char *buf)
 {
-	struct vio_dev *viodev = to_vio_dev(dev);
-	struct device_node *of_node = viodev->archdata;
+	struct device_node *of_node = dev->platform_data;
 
 	return sprintf(buf, "%s\n", of_node->name);
 }
@@ -281,7 +290,7 @@
  * @of_node:	The OF node for this device.
  *
  * Creates and initializes a vio_dev structure from the data in
- * of_node (archdata) and adds it to the list of virtual devices.
+ * of_node (dev.platform_data) and adds it to the list of virtual devices.
  * Returns a pointer to the created vio_dev or NULL if node has
  * NULL device_type or compatible fields.
  */
@@ -315,7 +324,7 @@
 	}
 	memset(viodev, 0, sizeof(struct vio_dev));
 
-	viodev->archdata = (void *)of_node_get(of_node);
+	viodev->dev.platform_data = of_node_get(of_node);
 	viodev->unit_address = *unit_address;
 	viodev->iommu_table = vio_build_iommu_table(viodev);
 
@@ -345,6 +354,7 @@
 		return NULL;
 	}
 	device_create_file(&viodev->dev, &dev_attr_name);
+	device_create_file(&viodev->dev, &dev_attr_devspec);
 
 	return viodev;
 }
@@ -353,6 +363,8 @@
 void __devinit vio_unregister_device(struct vio_dev *viodev)
 {
 	DBGENTER();
+	device_remove_file(&viodev->dev, &dev_attr_devspec);
+	device_remove_file(&viodev->dev, &dev_attr_name);
 	device_unregister(&viodev->dev);
 }
 EXPORT_SYMBOL(vio_unregister_device);
@@ -368,7 +380,7 @@
 */
 const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length)
 {
-	return get_property((struct device_node *)vdev->archdata, (char*)which, length);
+	return get_property(vdev->dev.platform_data, (char*)which, length);
 }
 EXPORT_SYMBOL(vio_get_attribute);
 
@@ -415,7 +427,7 @@
  * Returns a pointer to the built tce tree, or NULL if it can't
  * find property.
 */
-struct iommu_table * vio_build_iommu_table(struct vio_dev *dev)
+static struct iommu_table * vio_build_iommu_table(struct vio_dev *dev)
 {
 	unsigned int *dma_window;
 	struct iommu_table *newTceTable;
@@ -423,7 +435,7 @@
 	unsigned long size;
 	int dma_window_property_size;
 
-	dma_window = (unsigned int *) get_property((struct device_node *)dev->archdata, "ibm,my-dma-window", &dma_window_property_size);
+	dma_window = (unsigned int *) get_property(dev->dev.platform_data, "ibm,my-dma-window", &dma_window_property_size);
 	if(!dma_window) {
 		return NULL;
 	}
diff -Nru a/arch/ppc64/kernel/viopath.c b/arch/ppc64/kernel/viopath.c
--- a/arch/ppc64/kernel/viopath.c	Tue Jun 15 22:20:37 2004
+++ b/arch/ppc64/kernel/viopath.c	Tue Jun 15 22:20:37 2004
@@ -190,6 +190,7 @@
 static int proc_viopath_show(struct seq_file *m, void *v)
 {
 	char *buf;
+	u16 vlanMap;
 	dma_addr_t handle;
 	HvLpEvent_Rc hvrc;
 	DECLARE_MUTEX_LOCKED(Semaphore);
@@ -216,12 +217,11 @@
 
 	down(&Semaphore);
 
-	dma_unmap_single(iSeries_vio_dev, handle, PAGE_SIZE, DMA_FROM_DEVICE);
-	kfree(buf);
+	vlanMap = HvLpConfig_getVirtualLanIndexMap();
 
-	buf[PAGE_SIZE] = '\0';
+	buf[PAGE_SIZE-1] = '\0';
 	seq_printf(m, "%s", buf);
-
+	seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap);
 	seq_printf(m, "SRLNBR=%c%c%c%c%c%c%c\n",
 		   e2a(xItExtVpdPanel.mfgID[2]),
 		   e2a(xItExtVpdPanel.mfgID[3]),
@@ -230,6 +230,9 @@
 		   e2a(xItExtVpdPanel.systemSerial[3]),
 		   e2a(xItExtVpdPanel.systemSerial[4]),
 		   e2a(xItExtVpdPanel.systemSerial[5]));
+
+	dma_unmap_single(iSeries_vio_dev, handle, PAGE_SIZE, DMA_FROM_DEVICE);
+	kfree(buf);
 
 	return 0;
 }
diff -Nru a/arch/ppc64/kernel/xics.c b/arch/ppc64/kernel/xics.c
--- a/arch/ppc64/kernel/xics.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc64/kernel/xics.c	Tue Jun 15 22:20:41 2004
@@ -56,7 +56,7 @@
 };
 
 /* This is used to map real irq numbers to virtual */
-static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_KERNEL);
+static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_ATOMIC);
 
 #define XICS_IPI		2
 #define XICS_IRQ_SPURIOUS	0
@@ -620,7 +620,7 @@
 	cpumask_t tmp = CPU_MASK_NONE;
 
 	irq = virt_irq_to_real(irq_offset_down(virq));
-	if (irq == XICS_IPI)
+	if (irq == XICS_IPI || irq == NO_IRQ)
 		return;
 
 	status = rtas_call(ibm_get_xive, 1, 3, (void *)&xics_status, irq);
diff -Nru a/arch/ppc64/lib/Makefile b/arch/ppc64/lib/Makefile
--- a/arch/ppc64/lib/Makefile	Tue Jun 15 22:20:35 2004
+++ b/arch/ppc64/lib/Makefile	Tue Jun 15 22:20:35 2004
@@ -4,3 +4,8 @@
 
 lib-y := checksum.o dec_and_lock.o string.o strcase.o
 lib-y += copypage.o memcpy.o copyuser.o
+
+# Lock primitives are defined as no-ops in include/linux/spinlock.h
+# for non-SMP configs. Don't build the real versions.
+
+lib-$(CONFIG_SMP) += locks.o
diff -Nru a/arch/ppc64/lib/locks.c b/arch/ppc64/lib/locks.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/ppc64/lib/locks.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,285 @@
+/*
+ * Spin and read/write lock operations.
+ *
+ * Copyright (C) 2001-2004 Paul Mackerras <paulus@au.ibm.com>, IBM
+ * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM
+ * Copyright (C) 2002 Dave Engebretsen <engebret@us.ibm.com>, IBM
+ *   Rework to support virtual processors
+ *
+ * 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/kernel.h>
+#include <linux/spinlock.h>
+#include <linux/module.h>
+#include <asm/hvcall.h>
+#include <asm/iSeries/HvCall.h>
+
+#ifndef CONFIG_SPINLINE
+
+/*
+ * On a system with shared processors (that is, where a physical
+ * processor is multiplexed between several virtual processors),
+ * there is no point spinning on a lock if the holder of the lock
+ * isn't currently scheduled on a physical processor.  Instead
+ * we detect this situation and ask the hypervisor to give the
+ * rest of our timeslice to the lock holder.
+ *
+ * So that we can tell which virtual processor is holding a lock,
+ * we put 0x80000000 | smp_processor_id() in the lock when it is
+ * held.  Conveniently, we have a word in the paca that holds this
+ * value.
+ */
+
+/* waiting for a spinlock... */
+#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES)
+void __spin_yield(spinlock_t *lock)
+{
+	unsigned int lock_value, holder_cpu, yield_count;
+	struct paca_struct *holder_paca;
+
+	lock_value = lock->lock;
+	if (lock_value == 0)
+		return;
+	holder_cpu = lock_value & 0xffff;
+	BUG_ON(holder_cpu >= NR_CPUS);
+	holder_paca = &paca[holder_cpu];
+	yield_count = holder_paca->xLpPaca.xYieldCount;
+	if ((yield_count & 1) == 0)
+		return;		/* virtual cpu is currently running */
+	rmb();
+	if (lock->lock != lock_value)
+		return;		/* something has changed */
+#ifdef CONFIG_PPC_ISERIES
+	HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
+		((u64)holder_cpu << 32) | yield_count);
+#else
+	plpar_hcall_norets(H_CONFER, holder_cpu, yield_count);
+#endif
+}
+
+#else /* SPLPAR || ISERIES */
+#define __spin_yield(x)	barrier()
+#endif
+
+/*
+ * This returns the old value in the lock, so we succeeded
+ * in getting the lock if the return value is 0.
+ */
+static __inline__ unsigned long __spin_trylock(spinlock_t *lock)
+{
+	unsigned long tmp, tmp2;
+
+	__asm__ __volatile__(
+"	lwz		%1,24(13)		# __spin_trylock\n\
+1:	lwarx		%0,0,%2\n\
+	cmpwi		0,%0,0\n\
+	bne-		2f\n\
+	stwcx.		%1,0,%2\n\
+	bne-		1b\n\
+	isync\n\
+2:"	: "=&r" (tmp), "=&r" (tmp2)
+	: "r" (&lock->lock)
+	: "cr0", "memory");
+
+	return tmp;
+}
+
+int _raw_spin_trylock(spinlock_t *lock)
+{
+	return __spin_trylock(lock) == 0;
+}
+
+EXPORT_SYMBOL(_raw_spin_trylock);
+
+void _raw_spin_lock(spinlock_t *lock)
+{
+	while (1) {
+		if (likely(__spin_trylock(lock) == 0))
+			break;
+		do {
+			HMT_low();
+			__spin_yield(lock);
+		} while (likely(lock->lock != 0));
+		HMT_medium();
+	}
+}
+
+EXPORT_SYMBOL(_raw_spin_lock);
+
+void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags)
+{
+	unsigned long flags_dis;
+
+	while (1) {
+		if (likely(__spin_trylock(lock) == 0))
+			break;
+		local_save_flags(flags_dis);
+		local_irq_restore(flags);
+		do {
+			HMT_low();
+			__spin_yield(lock);
+		} while (likely(lock->lock != 0));
+		HMT_medium();
+		local_irq_restore(flags_dis);
+	}
+}
+
+EXPORT_SYMBOL(_raw_spin_lock_flags);
+
+void spin_unlock_wait(spinlock_t *lock)
+{
+	while (lock->lock)
+		__spin_yield(lock);
+}
+
+EXPORT_SYMBOL(spin_unlock_wait);
+
+/*
+ * Waiting for a read lock or a write lock on a rwlock...
+ * This turns out to be the same for read and write locks, since
+ * we only know the holder if it is write-locked.
+ */
+#if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES)
+void __rw_yield(rwlock_t *rw)
+{
+	int lock_value;
+	unsigned int holder_cpu, yield_count;
+	struct paca_struct *holder_paca;
+
+	lock_value = rw->lock;
+	if (lock_value >= 0)
+		return;		/* no write lock at present */
+	holder_cpu = lock_value & 0xffff;
+	BUG_ON(holder_cpu >= NR_CPUS);
+	holder_paca = &paca[holder_cpu];
+	yield_count = holder_paca->xLpPaca.xYieldCount;
+	if ((yield_count & 1) == 0)
+		return;		/* virtual cpu is currently running */
+	rmb();
+	if (rw->lock != lock_value)
+		return;		/* something has changed */
+#ifdef CONFIG_PPC_ISERIES
+	HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc,
+		((u64)holder_cpu << 32) | yield_count);
+#else
+	plpar_hcall_norets(H_CONFER, holder_cpu, yield_count);
+#endif
+}
+
+#else /* SPLPAR || ISERIES */
+#define __rw_yield(x)	barrier()
+#endif
+
+/*
+ * This returns the old value in the lock + 1,
+ * so we got a read lock if the return value is > 0.
+ */
+static __inline__ long __read_trylock(rwlock_t *rw)
+{
+	long tmp;
+
+	__asm__ __volatile__(
+"1:	lwarx		%0,0,%1		# read_trylock\n\
+	extsw		%0,%0\n\
+	addic.		%0,%0,1\n\
+	ble-		2f\n\
+	stwcx.		%0,0,%1\n\
+	bne-		1b\n\
+	isync\n\
+2:"	: "=&r" (tmp)
+	: "r" (&rw->lock)
+	: "cr0", "xer", "memory");
+
+	return tmp;
+}
+
+int _raw_read_trylock(rwlock_t *rw)
+{
+	return __read_trylock(rw) > 0;
+}
+
+EXPORT_SYMBOL(_raw_read_trylock);
+
+void _raw_read_lock(rwlock_t *rw)
+{
+	while (1) {
+		if (likely(__read_trylock(rw) > 0))
+			break;
+		do {
+			HMT_low();
+			__rw_yield(rw);
+		} while (likely(rw->lock < 0));
+		HMT_medium();
+	}
+}
+
+EXPORT_SYMBOL(_raw_read_lock);
+
+void _raw_read_unlock(rwlock_t *rw)
+{
+	long tmp;
+
+	__asm__ __volatile__(
+	"eieio				# read_unlock\n\
+1:	lwarx		%0,0,%1\n\
+	addic		%0,%0,-1\n\
+	stwcx.		%0,0,%1\n\
+	bne-		1b"
+	: "=&r"(tmp)
+	: "r"(&rw->lock)
+	: "cr0", "memory");
+}
+
+EXPORT_SYMBOL(_raw_read_unlock);
+
+/*
+ * This returns the old value in the lock,
+ * so we got the write lock if the return value is 0.
+ */
+static __inline__ long __write_trylock(rwlock_t *rw)
+{
+	long tmp, tmp2;
+
+	__asm__ __volatile__(
+"	lwz		%1,24(13)		# write_trylock\n\
+1:	lwarx		%0,0,%2\n\
+	cmpwi		0,%0,0\n\
+	bne-		2f\n\
+	stwcx.		%1,0,%2\n\
+	bne-		1b\n\
+	isync\n\
+2:"	: "=&r" (tmp), "=&r" (tmp2)
+	: "r" (&rw->lock)
+	: "cr0", "memory");
+
+	return tmp;
+}
+
+int _raw_write_trylock(rwlock_t *rw)
+{
+	return __write_trylock(rw) == 0;
+}
+
+EXPORT_SYMBOL(_raw_write_trylock);
+
+void _raw_write_lock(rwlock_t *rw)
+{
+	while (1) {
+		if (likely(__write_trylock(rw) == 0))
+			break;
+		do {
+			HMT_low();
+			__rw_yield(rw);
+		} while (likely(rw->lock != 0));
+		HMT_medium();
+	}
+}
+
+EXPORT_SYMBOL(_raw_write_lock);
+
+#endif /* CONFIG_SPINLINE */
diff -Nru a/arch/ppc64/mm/fault.c b/arch/ppc64/mm/fault.c
--- a/arch/ppc64/mm/fault.c	Tue Jun 15 22:20:43 2004
+++ b/arch/ppc64/mm/fault.c	Tue Jun 15 22:20:43 2004
@@ -45,7 +45,7 @@
 {
 	unsigned int inst;
 
-	if (get_user(inst, (unsigned int *)regs->nip))
+	if (get_user(inst, (unsigned int __user *)regs->nip))
 		return 0;
 	/* check for 1 in the rA field */
 	if (((inst >> 16) & 0x1f) != 1)
diff -Nru a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c
--- a/arch/ppc64/mm/hugetlbpage.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc64/mm/hugetlbpage.c	Tue Jun 15 22:20:40 2004
@@ -24,7 +24,6 @@
 #include <asm/machdep.h>
 #include <asm/cputable.h>
 #include <asm/tlb.h>
-#include <asm/rmap.h>
 
 #include <linux/sysctl.h>
 
@@ -214,7 +213,7 @@
 		}
 		page = pmd_page(*pmd);
 		pmd_clear(pmd);
-		pgtable_remove_rmap(page);
+		dec_page_state(nr_page_table_pages);
 		pte_free_tlb(tlb, page);
 	}
 	tlb_finish_mmu(tlb, start, end);
@@ -452,8 +451,9 @@
 				goto out;
 			}
 			ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
-			unlock_page(page);
-			if (ret) {
+			if (! ret) {
+				unlock_page(page);
+			} else {
 				hugetlb_put_quota(mapping);
 				free_huge_page(page);
 				goto out;
diff -Nru a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
--- a/arch/ppc64/mm/init.c	Tue Jun 15 22:20:41 2004
+++ b/arch/ppc64/mm/init.c	Tue Jun 15 22:20:41 2004
@@ -407,7 +407,7 @@
 	area = im_get_area((unsigned long) addr, size, 
 			    IM_REGION_EXISTS | IM_REGION_SUBSET);
 	if (area == NULL) {
-		printk(KERN_ERR "%s() cannot unmap nonexistant range 0x%lx\n",
+		printk(KERN_ERR "%s() cannot unmap nonexistent range 0x%lx\n",
 				__FUNCTION__, (unsigned long) addr);
 		return 1;
 	}
diff -Nru a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c
--- a/arch/ppc64/mm/numa.c	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc64/mm/numa.c	Tue Jun 15 22:20:42 2004
@@ -19,7 +19,7 @@
 #include <asm/abs_addr.h>
 
 #if 1
-#define dbg(args...) udbg_printf(args)
+#define dbg(args...) printk(KERN_INFO args)
 #else
 #define dbg(args...)
 #endif
@@ -56,16 +56,136 @@
 	}
 }
 
+static struct device_node * __init find_cpu_node(unsigned int cpu)
+{
+	unsigned int hw_cpuid = get_hard_smp_processor_id(cpu);
+	struct device_node *cpu_node = NULL;
+	unsigned int *interrupt_server, *reg;
+	int len;
+
+	while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) {
+		/* Try interrupt server first */
+		interrupt_server = (unsigned int *)get_property(cpu_node,
+					"ibm,ppc-interrupt-server#s", &len);
+
+		if (interrupt_server && (len > 0)) {
+			while (len--) {
+				if (interrupt_server[len-1] == hw_cpuid)
+					return cpu_node;
+			}
+		} else {
+			reg = (unsigned int *)get_property(cpu_node,
+							   "reg", &len);
+			if (reg && (len > 0) && (reg[0] == hw_cpuid))
+				return cpu_node;
+		}
+	}
+
+	return NULL;
+}
+
+/* must hold reference to node during call */
+static int *of_get_associativity(struct device_node *dev)
+ {
+	unsigned int *result;
+	int len;
+
+	result = (unsigned int *)get_property(dev, "ibm,associativity", &len);
+
+	if (len <= 0)
+		return NULL;
+
+	return result;
+}
+
+static int of_node_numa_domain(struct device_node *device, int depth)
+{
+	int numa_domain;
+	unsigned int *tmp;
+
+	tmp = of_get_associativity(device);
+	if (tmp && (tmp[0] >= depth)) {
+		numa_domain = tmp[depth];
+	} else {
+		printk(KERN_ERR "WARNING: no NUMA information for "
+		       "%s\n", device->full_name);
+		numa_domain = 0;
+	}
+	return numa_domain;
+}
+
+/*
+ * In theory, the "ibm,associativity" property may contain multiple
+ * associativity lists because a resource may be multiply connected
+ * into the machine.  This resource then has different associativity
+ * characteristics relative to its multiple connections.  We ignore
+ * this for now.  We also assume that all cpu and memory sets have
+ * their distances represented at a common level.  This won't be
+ * true for heirarchical NUMA.
+ *
+ * In any case the ibm,associativity-reference-points should give
+ * the correct depth for a normal NUMA system.
+ *
+ * - Dave Hansen <haveblue@us.ibm.com>
+ */
+static int find_min_common_depth(void)
+{
+	int depth;
+	unsigned int *ref_points;
+	struct device_node *rtas_root;
+	unsigned int len;
+
+	rtas_root = of_find_node_by_path("/rtas");
+
+	if (!rtas_root) {
+		printk(KERN_ERR "WARNING: %s() could not find rtas root\n",
+				__FUNCTION__);
+		return -1;
+	}
+
+	/*
+	 * this property is 2 32-bit integers, each representing a level of
+	 * depth in the associativity nodes.  The first is for an SMP
+	 * configuration (should be all 0's) and the second is for a normal
+	 * NUMA configuration.
+	 */
+	ref_points = (unsigned int *)get_property(rtas_root,
+			"ibm,associativity-reference-points", &len);
+
+	if ((len >= 1) && ref_points) {
+		depth = ref_points[1];
+	} else {
+		printk(KERN_ERR "WARNING: could not find NUMA "
+				"associativity reference point\n");
+		depth = -1;
+	}
+	of_node_put(rtas_root);
+
+	return depth;
+}
+
+static unsigned long read_cell_ul(struct device_node *device, unsigned int **buf)
+{
+	int i;
+	unsigned long result = 0;
+
+	i = prom_n_size_cells(device);
+	/* bug on i>2 ?? */
+	while (i--) {
+		result = (result << 32) | **buf;
+		(*buf)++;
+	}
+	return result;
+}
+
 static int __init parse_numa_properties(void)
 {
 	struct device_node *cpu = NULL;
 	struct device_node *memory = NULL;
-	int *cpu_associativity;
-	int *memory_associativity;
 	int depth;
 	int max_domain = 0;
 	long entries = lmb_end_of_DRAM() >> MEMORY_INCREMENT_SHIFT;
-	long i;
+	unsigned long i;
 
 	if (strstr(saved_command_line, "numa=off")) {
 		printk(KERN_WARNING "NUMA disabled by user\n");
@@ -78,112 +198,78 @@
 	for (i = 0; i < entries ; i++)
 		numa_memory_lookup_table[i] = ARRAY_INITIALISER;
 
-	cpu = of_find_node_by_type(NULL, "cpu");
-	if (!cpu)
-		goto err;
-
-	memory = of_find_node_by_type(NULL, "memory");
-	if (!memory)
-		goto err;
-
-	cpu_associativity = (int *)get_property(cpu, "ibm,associativity", NULL);
-	if (!cpu_associativity)
-		goto err;
-
-	memory_associativity = (int *)get_property(memory, "ibm,associativity",
-						   NULL);
-	if (!memory_associativity)
-		goto err;
-
-	/* find common depth */
-	if (cpu_associativity[0] < memory_associativity[0])
-		depth = cpu_associativity[0];
-	else
-		depth = memory_associativity[0];
-
-	for (; cpu; cpu = of_find_node_by_type(cpu, "cpu")) {
-		int *tmp;
-		int cpu_nr, numa_domain;
+	depth = find_min_common_depth();
 
-		tmp = (int *)get_property(cpu, "reg", NULL);
-		if (!tmp)
-			continue;
-		cpu_nr = *tmp;
+	printk(KERN_INFO "NUMA associativity depth for CPU/Memory: %d\n", depth);
+	if (depth < 0)
+		return depth;
 
-		tmp = (int *)get_property(cpu, "ibm,associativity",
-					  NULL);
-		if (!tmp)
-			continue;
-		numa_domain = tmp[depth];
+	for_each_cpu(i) {
+		int numa_domain;
+
+		cpu = find_cpu_node(i);
 
-		/* FIXME */
-		if (numa_domain == 0xffff) {
-			dbg("cpu %d has no numa doman\n", cpu_nr);
+		if (cpu) {
+			numa_domain = of_node_numa_domain(cpu, depth);
+			of_node_put(cpu);
+
+			if (numa_domain >= MAX_NUMNODES) {
+				/*
+			 	 * POWER4 LPAR uses 0xffff as invalid node,
+				 * dont warn in this case.
+			 	 */
+				if (numa_domain != 0xffff)
+					printk(KERN_ERR "WARNING: cpu %ld "
+					       "maps to invalid NUMA node %d\n",
+					       i, numa_domain);
+				numa_domain = 0;
+			}
+		} else {
+			printk(KERN_ERR "WARNING: no NUMA information for "
+			       "cpu %ld\n", i);
 			numa_domain = 0;
 		}
 
-		if (numa_domain >= MAX_NUMNODES)
-			BUG();
-
 		node_set_online(numa_domain);
 
 		if (max_domain < numa_domain)
 			max_domain = numa_domain;
 
-		map_cpu_to_node(cpu_nr, numa_domain);
-		/* register the second thread on an SMT machine */
-		if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
-			map_cpu_to_node(cpu_nr ^ 0x1, numa_domain);
+		map_cpu_to_node(i, numa_domain);
 	}
 
-	for (; memory; memory = of_find_node_by_type(memory, "memory")) {
-		unsigned int *tmp1, *tmp2;
-		unsigned long i;
-		unsigned long start = 0;
-		unsigned long size = 0;
+	memory = NULL;
+	while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
+		unsigned long start;
+		unsigned long size;
 		int numa_domain;
 		int ranges;
+		unsigned int *memcell_buf;
+		unsigned int len;
 
-		tmp1 = (int *)get_property(memory, "reg", NULL);
-		if (!tmp1)
+		memcell_buf = (unsigned int *)get_property(memory, "reg", &len);
+		if (!memcell_buf || len <= 0)
 			continue;
 
 		ranges = memory->n_addrs;
 new_range:
-
-		i = prom_n_size_cells(memory);
-		while (i--) {
-			start = (start << 32) | *tmp1;
-			tmp1++;
-		}
-
-		i = prom_n_size_cells(memory);
-		while (i--) {
-			size = (size << 32) | *tmp1;
-			tmp1++;
-		}
+		/* these are order-sensitive, and modify the buffer pointer */
+		start = read_cell_ul(memory, &memcell_buf);
+		size = read_cell_ul(memory, &memcell_buf);
 
 		start = _ALIGN_DOWN(start, MEMORY_INCREMENT);
 		size = _ALIGN_UP(size, MEMORY_INCREMENT);
 
-		if ((start + size) > MAX_MEMORY)
-			BUG();
+		numa_domain = of_node_numa_domain(memory, depth);
 
-		tmp2 = (int *)get_property(memory, "ibm,associativity",
-					   NULL);
-		if (!tmp2)
-			continue;
-		numa_domain = tmp2[depth];
-
-		/* FIXME */
-		if (numa_domain == 0xffff) {
-			dbg("memory has no numa doman\n");
+		if (numa_domain >= MAX_NUMNODES) {
+			if (numa_domain != 0xffff)
+				printk(KERN_ERR "WARNING: memory at %lx maps "
+				       "to invalid NUMA node %d\n", start,
+				       numa_domain);
 			numa_domain = 0;
 		}
 
-		if (numa_domain >= MAX_NUMNODES)
-			BUG();
-
 		node_set_online(numa_domain);
 
 		if (max_domain < numa_domain)
@@ -205,11 +291,13 @@
 						start, size);
 				continue;
 			}
-			node_data[numa_domain].node_spanned_pages += size / PAGE_SIZE;
+			node_data[numa_domain].node_spanned_pages +=
+				size / PAGE_SIZE;
 		} else {
 			node_data[numa_domain].node_start_pfn =
 				start / PAGE_SIZE;
-			node_data[numa_domain].node_spanned_pages = size / PAGE_SIZE;
+			node_data[numa_domain].node_spanned_pages =
+				size / PAGE_SIZE;
 		}
 
 		for (i = start ; i < (start+size); i += MEMORY_INCREMENT)
@@ -227,10 +315,6 @@
 	numnodes = max_domain + 1;
 
 	return 0;
-err:
-	of_node_put(cpu);
-	of_node_put(memory);
-	return -1;
 }
 
 static void __init setup_nonnuma(void)
diff -Nru a/arch/ppc64/mm/tlb.c b/arch/ppc64/mm/tlb.c
--- a/arch/ppc64/mm/tlb.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc64/mm/tlb.c	Tue Jun 15 22:20:40 2004
@@ -31,7 +31,6 @@
 #include <asm/tlb.h>
 #include <asm/hardirq.h>
 #include <linux/highmem.h>
-#include <asm/rmap.h>
 
 DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
 
@@ -59,7 +58,8 @@
 
 	ptepage = virt_to_page(ptep);
 	mm = (struct mm_struct *) ptepage->mapping;
-	addr = ptep_to_address(ptep);
+	addr = ptepage->index +
+		(((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	Tue Jun 15 22:21:04 2004
+++ b/arch/ppc64/oprofile/common.c	Tue Jun 15 22:21:04 2004
@@ -155,12 +155,14 @@
 			break;
 
 		case PV_GPUL:
+		case PV_GPULp:
 			model = &op_model_power4;
 			model->num_counters = 8;
 			oprof_ppc64_ops.cpu_type = "ppc64/970";
 			break;
 
 		case PV_POWER5:
+		case PV_POWER5p:
 			model = &op_model_power4;
 			model->num_counters = 6;
 			oprof_ppc64_ops.cpu_type = "ppc64/power5";
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	Tue Jun 15 22:20:42 2004
+++ b/arch/ppc64/oprofile/op_model_power4.c	Tue Jun 15 22:20:42 2004
@@ -24,6 +24,8 @@
 static unsigned long reset_value[OP_MAX_COUNTER];
 
 static int num_counters;
+static int oprofile_running;
+static int mmcra_has_sihv;
 
 static void power4_reg_setup(struct op_counter_config *ctr,
 			     struct op_system_config *sys,
@@ -33,6 +35,16 @@
 
 	num_counters = num_ctrs;
 
+	/*
+	 * SIHV / SIPR bits are only implemented on POWER4+ (GQ) and above.
+	 * However we disable it on all POWER4 until we verify it works
+	 * (I was seeing some strange behaviour last time I tried).
+	 *
+	 * It has been verified to work on POWER5 so we enable it there.
+	 */
+	if (!(__is_processor(PV_POWER4) || __is_processor(PV_POWER4p)))
+		mmcra_has_sihv = 1;
+
 	for (i = 0; i < num_counters; ++i)
 		reset_value[i] = 0x80000000UL - ctr[i].count;
 
@@ -99,6 +111,8 @@
 	mmcr0 &= ~MMCR0_FC;
 	mtspr(SPRN_MMCR0, mmcr0);
 
+	oprofile_running = 1;
+
 	dbg("start on cpu %d, mmcr0 %x\n", smp_processor_id(), mmcr0);
 }
 
@@ -111,6 +125,8 @@
 	mmcr0 |= MMCR0_FC;
 	mtspr(SPRN_MMCR0, mmcr0);
 
+	oprofile_running = 0;
+
 	dbg("stop on cpu %d, mmcr0 %x\n", smp_processor_id(), mmcr0);
 
 	mb();
@@ -129,9 +145,6 @@
 {
 }
 
-/* XXX Not currently working */
-static int mmcra_has_sihv = 0;
-
 /*
  * On GQ and newer the MMCRA stores the HV and PR bits at the time
  * the SIAR was sampled. We use that to work out if the SIAR was sampled in
@@ -210,7 +223,7 @@
 	for (i = 0; i < num_counters; ++i) {
 		val = ctr_read(i);
 		if (val < 0) {
-			if (ctr[i].enabled) {
+			if (oprofile_running && ctr[i].enabled) {
 				oprofile_add_sample(pc, is_kernel, i, cpu);
 				ctr_write(i, reset_value[i]);
 			} else {
diff -Nru a/arch/ppc64/xmon/ppc-dis.c b/arch/ppc64/xmon/ppc-dis.c
--- a/arch/ppc64/xmon/ppc-dis.c	Tue Jun 15 22:20:35 2004
+++ b/arch/ppc64/xmon/ppc-dis.c	Tue Jun 15 22:20:35 2004
@@ -22,37 +22,28 @@
 #include "ansidecl.h"
 #include "ppc.h"
 
-static int print_insn_powerpc PARAMS ((FILE *, unsigned long insn,
-				       unsigned long memaddr, int dialect));
-
-extern void print_address PARAMS((unsigned long memaddr));
-
-/* Print a big endian PowerPC instruction.  For convenience, also
-   disassemble instructions supported by the Motorola PowerPC 601.  */
-
-int
-print_insn_big_powerpc (FILE *out, unsigned long insn, unsigned long memaddr)
-{
-  return print_insn_powerpc (out, insn, memaddr,
-			     PPC_OPCODE_PPC | PPC_OPCODE_601);
-}
+extern void print_address (unsigned long memaddr);
 
 /* Print a PowerPC or POWER instruction.  */
 
-static int
-print_insn_powerpc (FILE *out, unsigned long insn, unsigned long memaddr,
-		    int dialect)
+int
+print_insn_powerpc (unsigned long insn, unsigned long memaddr, int dialect)
 {
   const struct powerpc_opcode *opcode;
   const struct powerpc_opcode *opcode_end;
   unsigned long op;
 
+  if (dialect == 0)
+    dialect = PPC_OPCODE_PPC | PPC_OPCODE_CLASSIC | PPC_OPCODE_COMMON
+	      | PPC_OPCODE_64 | PPC_OPCODE_POWER4 | PPC_OPCODE_ALTIVEC;
+
   /* Get the major opcode of the instruction.  */
   op = PPC_OP (insn);
 
   /* Find the first match in the opcode table.  We could speed this up
      a bit by doing a binary search on the major opcode.  */
   opcode_end = powerpc_opcodes + powerpc_num_opcodes;
+ again:
   for (opcode = powerpc_opcodes; opcode < opcode_end; opcode++)
     {
       unsigned long table_op;
@@ -64,109 +55,106 @@
 
       table_op = PPC_OP (opcode->opcode);
       if (op < table_op)
-		break;
+	break;
       if (op > table_op)
-		continue;
+	continue;
 
       if ((insn & opcode->mask) != opcode->opcode
 	  || (opcode->flags & dialect) == 0)
-		continue;
+	continue;
 
       /* Make two passes over the operands.  First see if any of them
-		 have extraction functions, and, if they do, make sure the
-		 instruction is valid.  */
+	 have extraction functions, and, if they do, make sure the
+	 instruction is valid.  */
       invalid = 0;
       for (opindex = opcode->operands; *opindex != 0; opindex++)
-		{
-		  operand = powerpc_operands + *opindex;
-		  if (operand->extract)
-		    (*operand->extract) (insn, &invalid);
-		}
+	{
+	  operand = powerpc_operands + *opindex;
+	  if (operand->extract)
+	    (*operand->extract) (insn, dialect, &invalid);
+	}
       if (invalid)
-		continue;
+	continue;
 
       /* The instruction is valid.  */
-      fprintf(out, "%s", opcode->name);
+      printf("%s", opcode->name);
       if (opcode->operands[0] != 0)
-		fprintf(out, "\t");
+	printf("\t");
 
       /* Now extract and print the operands.  */
       need_comma = 0;
       need_paren = 0;
       for (opindex = opcode->operands; *opindex != 0; opindex++)
-		{
-		  long value;
+	{
+	  long value;
+
+	  operand = powerpc_operands + *opindex;
+
+	  /* Operands that are marked FAKE are simply ignored.  We
+	     already made sure that the extract function considered
+	     the instruction to be valid.  */
+	  if ((operand->flags & PPC_OPERAND_FAKE) != 0)
+	    continue;
+
+	  /* Extract the value from the instruction.  */
+	  if (operand->extract)
+	    value = (*operand->extract) (insn, dialect, &invalid);
+	  else
+	    {
+	      value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
+	      if ((operand->flags & PPC_OPERAND_SIGNED) != 0
+		  && (value & (1 << (operand->bits - 1))) != 0)
+		value -= 1 << operand->bits;
+	    }
 
-		  operand = powerpc_operands + *opindex;
+	  /* If the operand is optional, and the value is zero, don't
+	     print anything.  */
+	  if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
+	      && (operand->flags & PPC_OPERAND_NEXT) == 0
+	      && value == 0)
+	    continue;
 
-		  /* Operands that are marked FAKE are simply ignored.  We
-		     already made sure that the extract function considered
-		     the instruction to be valid.  */
-		  if ((operand->flags & PPC_OPERAND_FAKE) != 0)
-		    continue;
-
-		  /* Extract the value from the instruction.  */
-		  if (operand->extract)
-		    value = (*operand->extract) (insn, (int *) 0);
-		  else
-		    {
-		      value = (insn >> operand->shift) & ((1 << operand->bits) - 1);
-		      if ((operand->flags & PPC_OPERAND_SIGNED) != 0
-			  && (value & (1 << (operand->bits - 1))) != 0)
-			value -= 1 << operand->bits;
-		    }
-
-		  /* If the operand is optional, and the value is zero, don't
-		     print anything.  */
-		  if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
-		      && (operand->flags & PPC_OPERAND_NEXT) == 0
-		      && value == 0)
-		    continue;
-
-		  if (need_comma)
-		    {
-		      fprintf(out, ",");
-		      need_comma = 0;
-		    }
-
-		  /* Print the operand as directed by the flags.  */
-		  if ((operand->flags & PPC_OPERAND_GPR) != 0)
-		    fprintf(out, "r%ld", value);
-		  else if ((operand->flags & PPC_OPERAND_FPR) != 0)
-		    fprintf(out, "f%ld", value);
-		  else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0)
-		    print_address (memaddr + value);
-		  else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
-		    print_address (value & 0xffffffff);
-		  else if ((operand->flags & PPC_OPERAND_CR) == 0
-			   || (dialect & PPC_OPCODE_PPC) == 0)
-		    fprintf(out, "%ld", value);
-		  else
-		    {
-		      if (operand->bits == 3)
-				fprintf(out, "cr%d", value);
-		      else
-			{
-			  static const char *cbnames[4] = { "lt", "gt", "eq", "so" };
-			  int cr;
-			  int cc;
-
-			  cr = value >> 2;
-			  if (cr != 0)
-			    fprintf(out, "4*cr%d", cr);
-			  cc = value & 3;
-			  if (cc != 0)
-			    {
-			      if (cr != 0)
-					fprintf(out, "+");
-			      fprintf(out, "%s", cbnames[cc]);
-			    }
-			}
+	  if (need_comma)
+	    {
+	      printf(",");
+	      need_comma = 0;
+	    }
+
+	  /* Print the operand as directed by the flags.  */
+	  if ((operand->flags & PPC_OPERAND_GPR) != 0)
+	    printf("r%ld", value);
+	  else if ((operand->flags & PPC_OPERAND_FPR) != 0)
+	    printf("f%ld", value);
+	  else if ((operand->flags & PPC_OPERAND_VR) != 0)
+	    printf("v%ld", value);
+	  else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0)
+	    print_address (memaddr + value);
+	  else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
+	    print_address (value & 0xffffffff);
+	  else if ((operand->flags & PPC_OPERAND_CR) == 0
+		   || (dialect & PPC_OPCODE_PPC) == 0)
+	    printf("%ld", value);
+	  else
+	    {
+	      if (operand->bits == 3)
+		printf("cr%d", value);
+	      else
+		{
+		  static const char *cbnames[4] = { "lt", "gt", "eq", "so" };
+		  int cr;
+		  int cc;
+
+		  cr = value >> 2;
+		  if (cr != 0)
+		    printf("4*cr%d+", cr);
+		  cc = value & 3;
+		  printf("%s", cbnames[cc]);
+		}
 	    }
 
 	  if (need_paren)
 	    {
-	      fprintf(out, ")");
+	      printf(")");
 	      need_paren = 0;
 	    }
 
@@ -174,7 +162,7 @@
 	    need_comma = 1;
 	  else
 	    {
-	      fprintf(out, "(");
+	      printf("(");
 	      need_paren = 1;
 	    }
 	}
@@ -183,8 +171,14 @@
       return 4;
     }
 
+  if ((dialect & PPC_OPCODE_ANY) != 0)
+    {
+      dialect = ~PPC_OPCODE_ANY;
+      goto again;
+    }
+
   /* We could not find a match.  */
-  fprintf(out, ".long 0x%lx", insn);
+  printf(".long 0x%lx", insn);
 
   return 4;
 }
diff -Nru a/arch/ppc64/xmon/ppc-opc.c b/arch/ppc64/xmon/ppc-opc.c
--- a/arch/ppc64/xmon/ppc-opc.c	Tue Jun 15 22:20:40 2004
+++ b/arch/ppc64/xmon/ppc-opc.c	Tue Jun 15 22:20:40 2004
@@ -1,27 +1,31 @@
 /* ppc-opc.c -- PowerPC opcode list
-   Copyright 1994 Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003
+   Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support
 
-This file is part of GDB, GAS, and the GNU binutils.
+   This file is part of GDB, GAS, and the GNU binutils.
 
-GDB, GAS, and the GNU binutils are free software; you can redistribute
-them and/or modify them under the terms of the GNU General Public
-License as published by the Free Software Foundation; either version
-2, or (at your option) any later version.
-
-GDB, GAS, and the GNU binutils are distributed in the hope that they
-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 file; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   GDB, GAS, and the GNU binutils are free software; you can redistribute
+   them and/or modify them under the terms of the GNU General Public
+   License as published by the Free Software Foundation; either version
+   2, or (at your option) any later version.
+
+   GDB, GAS, and the GNU binutils are distributed in the hope that they
+   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 file; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
 
-#include <linux/posix_types.h>
-#include "ansidecl.h"
+#include "nonstdio.h"
 #include "ppc.h"
 
+#define ATTRIBUTE_UNUSED
+#define _(x)	x
+
 /* This file holds the PowerPC opcode table.  The opcode table
    includes almost all of the extended instruction mnemonics.  This
    permits the disassembler to use them, and simplifies the assembler
@@ -35,223 +39,292 @@
 
 /* Local insertion and extraction functions.  */
 
-static unsigned long insert_bat PARAMS ((unsigned long, long, const char **));
-static long extract_bat PARAMS ((unsigned long, int *));
-static unsigned long insert_bba PARAMS ((unsigned long, long, const char **));
-static long extract_bba PARAMS ((unsigned long, int *));
-static unsigned long insert_bd PARAMS ((unsigned long, long, const char **));
-static long extract_bd PARAMS ((unsigned long, int *));
-static unsigned long insert_bdm PARAMS ((unsigned long, long, const char **));
-static long extract_bdm PARAMS ((unsigned long, int *));
-static unsigned long insert_bdp PARAMS ((unsigned long, long, const char **));
-static long extract_bdp PARAMS ((unsigned long, int *));
-static unsigned long insert_bo PARAMS ((unsigned long, long, const char **));
-static long extract_bo PARAMS ((unsigned long, int *));
-static unsigned long insert_boe PARAMS ((unsigned long, long, const char **));
-static long extract_boe PARAMS ((unsigned long, int *));
-static unsigned long insert_ds PARAMS ((unsigned long, long, const char **));
-static long extract_ds PARAMS ((unsigned long, int *));
-static unsigned long insert_li PARAMS ((unsigned long, long, const char **));
-static long extract_li PARAMS ((unsigned long, int *));
-static unsigned long insert_mbe PARAMS ((unsigned long, long, const char **));
-static long extract_mbe PARAMS ((unsigned long, int *));
-static unsigned long insert_mb6 PARAMS ((unsigned long, long, const char **));
-static long extract_mb6 PARAMS ((unsigned long, int *));
-static unsigned long insert_nb PARAMS ((unsigned long, long, const char **));
-static long extract_nb PARAMS ((unsigned long, int *));
-static unsigned long insert_nsi PARAMS ((unsigned long, long, const char **));
-static long extract_nsi PARAMS ((unsigned long, int *));
-static unsigned long insert_ral PARAMS ((unsigned long, long, const char **));
-static unsigned long insert_ram PARAMS ((unsigned long, long, const char **));
-static unsigned long insert_ras PARAMS ((unsigned long, long, const char **));
-static unsigned long insert_rbs PARAMS ((unsigned long, long, const char **));
-static long extract_rbs PARAMS ((unsigned long, int *));
-static unsigned long insert_sh6 PARAMS ((unsigned long, long, const char **));
-static long extract_sh6 PARAMS ((unsigned long, int *));
-static unsigned long insert_spr PARAMS ((unsigned long, long, const char **));
-static long extract_spr PARAMS ((unsigned long, int *));
-static unsigned long insert_tbr PARAMS ((unsigned long, long, const char **));
-static long extract_tbr PARAMS ((unsigned long, int *));
+static unsigned long insert_bat (unsigned long, long, int, const char **);
+static long extract_bat (unsigned long, int, int *);
+static unsigned long insert_bba (unsigned long, long, int, const char **);
+static long extract_bba (unsigned long, int, int *);
+static unsigned long insert_bd (unsigned long, long, int, const char **);
+static long extract_bd (unsigned long, int, int *);
+static unsigned long insert_bdm (unsigned long, long, int, const char **);
+static long extract_bdm (unsigned long, int, int *);
+static unsigned long insert_bdp (unsigned long, long, int, const char **);
+static long extract_bdp (unsigned long, int, int *);
+static unsigned long insert_bo (unsigned long, long, int, const char **);
+static long extract_bo (unsigned long, int, int *);
+static unsigned long insert_boe (unsigned long, long, int, const char **);
+static long extract_boe (unsigned long, int, int *);
+static unsigned long insert_dq (unsigned long, long, int, const char **);
+static long extract_dq (unsigned long, int, int *);
+static unsigned long insert_ds (unsigned long, long, int, const char **);
+static long extract_ds (unsigned long, int, int *);
+static unsigned long insert_de (unsigned long, long, int, const char **);
+static long extract_de (unsigned long, int, int *);
+static unsigned long insert_des (unsigned long, long, int, const char **);
+static long extract_des (unsigned long, int, int *);
+static unsigned long insert_fxm (unsigned long, long, int, const char **);
+static long extract_fxm (unsigned long, int, int *);
+static unsigned long insert_li (unsigned long, long, int, const char **);
+static long extract_li (unsigned long, int, int *);
+static unsigned long insert_mbe (unsigned long, long, int, const char **);
+static long extract_mbe (unsigned long, int, int *);
+static unsigned long insert_mb6 (unsigned long, long, int, const char **);
+static long extract_mb6 (unsigned long, int, int *);
+static unsigned long insert_nb (unsigned long, long, int, const char **);
+static long extract_nb (unsigned long, int, int *);
+static unsigned long insert_nsi (unsigned long, long, int, const char **);
+static long extract_nsi (unsigned long, int, int *);
+static unsigned long insert_ral (unsigned long, long, int, const char **);
+static unsigned long insert_ram (unsigned long, long, int, const char **);
+static unsigned long insert_raq (unsigned long, long, int, const char **);
+static unsigned long insert_ras (unsigned long, long, int, const char **);
+static unsigned long insert_rbs (unsigned long, long, int, const char **);
+static long extract_rbs (unsigned long, int, int *);
+static unsigned long insert_rsq (unsigned long, long, int, const char **);
+static unsigned long insert_rtq (unsigned long, long, int, const char **);
+static unsigned long insert_sh6 (unsigned long, long, int, const char **);
+static long extract_sh6 (unsigned long, int, int *);
+static unsigned long insert_spr (unsigned long, long, int, const char **);
+static long extract_spr (unsigned long, int, int *);
+static unsigned long insert_tbr (unsigned long, long, int, const char **);
+static long extract_tbr (unsigned long, int, int *);
+static unsigned long insert_ev2 (unsigned long, long, int, const char **);
+static long extract_ev2 (unsigned long, int, int *);
+static unsigned long insert_ev4 (unsigned long, long, int, const char **);
+static long extract_ev4 (unsigned long, int, int *);
+static unsigned long insert_ev8 (unsigned long, long, int, const char **);
+static long extract_ev8 (unsigned long, int, int *);
 
 /* The operands table.
 
-   The fields are bits, shift, signed, insert, extract, flags.  */
+   The fields are bits, shift, insert, extract, flags.
+
+   We used to put parens around the various additions, like the one
+   for BA just below.  However, that caused trouble with feeble
+   compilers with a limit on depth of a parenthesized expression, like
+   (reportedly) the compiler in Microsoft Developer Studio 5.  So we
+   omit the parens, since the macros are never used in a context where
+   the addition will be ambiguous.  */
 
 const struct powerpc_operand powerpc_operands[] =
 {
   /* The zero index is used to indicate the end of the list of
      operands.  */
-#define UNUSED (0)
+#define UNUSED 0
   { 0, 0, 0, 0, 0 },
 
   /* The BA field in an XL form instruction.  */
-#define BA (1)
+#define BA UNUSED + 1
 #define BA_MASK (0x1f << 16)
   { 5, 16, 0, 0, PPC_OPERAND_CR },
 
   /* The BA field in an XL form instruction when it must be the same
      as the BT field in the same instruction.  */
-#define BAT (2)
+#define BAT BA + 1
   { 5, 16, insert_bat, extract_bat, PPC_OPERAND_FAKE },
 
   /* The BB field in an XL form instruction.  */
-#define BB (3)
+#define BB BAT + 1
 #define BB_MASK (0x1f << 11)
   { 5, 11, 0, 0, PPC_OPERAND_CR },
 
   /* The BB field in an XL form instruction when it must be the same
      as the BA field in the same instruction.  */
-#define BBA (4)
+#define BBA BB + 1
   { 5, 11, insert_bba, extract_bba, PPC_OPERAND_FAKE },
 
   /* The BD field in a B form instruction.  The lower two bits are
      forced to zero.  */
-#define BD (5)
+#define BD BBA + 1
   { 16, 0, insert_bd, extract_bd, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
 
   /* The BD field in a B form instruction when absolute addressing is
      used.  */
-#define BDA (6)
+#define BDA BD + 1
   { 16, 0, insert_bd, extract_bd, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
 
   /* The BD field in a B form instruction when the - modifier is used.
      This sets the y bit of the BO field appropriately.  */
-#define BDM (7)
+#define BDM BDA + 1
   { 16, 0, insert_bdm, extract_bdm,
       PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
 
   /* The BD field in a B form instruction when the - modifier is used
      and absolute address is used.  */
-#define BDMA (8)
+#define BDMA BDM + 1
   { 16, 0, insert_bdm, extract_bdm,
       PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
 
   /* The BD field in a B form instruction when the + modifier is used.
      This sets the y bit of the BO field appropriately.  */
-#define BDP (9)
+#define BDP BDMA + 1
   { 16, 0, insert_bdp, extract_bdp,
       PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
 
   /* The BD field in a B form instruction when the + modifier is used
      and absolute addressing is used.  */
-#define BDPA (10)
+#define BDPA BDP + 1
   { 16, 0, insert_bdp, extract_bdp,
       PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
 
   /* The BF field in an X or XL form instruction.  */
-#define BF (11)
+#define BF BDPA + 1
   { 3, 23, 0, 0, PPC_OPERAND_CR },
 
   /* An optional BF field.  This is used for comparison instructions,
      in which an omitted BF field is taken as zero.  */
-#define OBF (12)
+#define OBF BF + 1
   { 3, 23, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
 
   /* The BFA field in an X or XL form instruction.  */
-#define BFA (13)
+#define BFA OBF + 1
   { 3, 18, 0, 0, PPC_OPERAND_CR },
 
   /* The BI field in a B form or XL form instruction.  */
-#define BI (14)
+#define BI BFA + 1
 #define BI_MASK (0x1f << 16)
   { 5, 16, 0, 0, PPC_OPERAND_CR },
 
   /* The BO field in a B form instruction.  Certain values are
      illegal.  */
-#define BO (15)
+#define BO BI + 1
 #define BO_MASK (0x1f << 21)
   { 5, 21, insert_bo, extract_bo, 0 },
 
   /* The BO field in a B form instruction when the + or - modifier is
      used.  This is like the BO field, but it must be even.  */
-#define BOE (16)
+#define BOE BO + 1
   { 5, 21, insert_boe, extract_boe, 0 },
 
   /* The BT field in an X or XL form instruction.  */
-#define BT (17)
+#define BT BOE + 1
   { 5, 21, 0, 0, PPC_OPERAND_CR },
 
   /* The condition register number portion of the BI field in a B form
      or XL form instruction.  This is used for the extended
      conditional branch mnemonics, which set the lower two bits of the
      BI field.  This field is optional.  */
-#define CR (18)
+#define CR BT + 1
   { 3, 18, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
 
+  /* The CRB field in an X form instruction.  */
+#define CRB CR + 1
+  { 5, 6, 0, 0, 0 },
+
+  /* The CRFD field in an X form instruction.  */
+#define CRFD CRB + 1
+  { 3, 23, 0, 0, PPC_OPERAND_CR },
+
+  /* The CRFS field in an X form instruction.  */
+#define CRFS CRFD + 1
+  { 3, 0, 0, 0, PPC_OPERAND_CR },
+
+  /* The CT field in an X form instruction.  */
+#define CT CRFS + 1
+  { 5, 21, 0, 0, PPC_OPERAND_OPTIONAL },
+
   /* The D field in a D form instruction.  This is a displacement off
      a register, and implies that the next operand is a register in
      parentheses.  */
-#define D (19)
+#define D CT + 1
   { 16, 0, 0, 0, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
 
+  /* The DE field in a DE form instruction.  This is like D, but is 12
+     bits only.  */
+#define DE D + 1
+  { 14, 0, insert_de, extract_de, PPC_OPERAND_PARENS },
+
+  /* The DES field in a DES form instruction.  This is like DS, but is 14
+     bits only (12 stored.)  */
+#define DES DE + 1
+  { 14, 0, insert_des, extract_des, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
+
+  /* The DQ field in a DQ form instruction.  This is like D, but the
+     lower four bits are forced to zero. */
+#define DQ DES + 1
+  { 16, 0, insert_dq, extract_dq,
+      PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED | PPC_OPERAND_DQ },
+
   /* The DS field in a DS form instruction.  This is like D, but the
      lower two bits are forced to zero.  */
-#define DS (20)
-  { 16, 0, insert_ds, extract_ds, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
+#define DS DQ + 1
+  { 16, 0, insert_ds, extract_ds,
+      PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED | PPC_OPERAND_DS },
+
+  /* The E field in a wrteei instruction.  */
+#define E DS + 1
+  { 1, 15, 0, 0, 0 },
 
   /* The FL1 field in a POWER SC form instruction.  */
-#define FL1 (21)
+#define FL1 E + 1
   { 4, 12, 0, 0, 0 },
 
   /* The FL2 field in a POWER SC form instruction.  */
-#define FL2 (22)
+#define FL2 FL1 + 1
   { 3, 2, 0, 0, 0 },
 
   /* The FLM field in an XFL form instruction.  */
-#define FLM (23)
+#define FLM FL2 + 1
   { 8, 17, 0, 0, 0 },
 
   /* The FRA field in an X or A form instruction.  */
-#define FRA (24)
+#define FRA FLM + 1
 #define FRA_MASK (0x1f << 16)
   { 5, 16, 0, 0, PPC_OPERAND_FPR },
 
   /* The FRB field in an X or A form instruction.  */
-#define FRB (25)
+#define FRB FRA + 1
 #define FRB_MASK (0x1f << 11)
   { 5, 11, 0, 0, PPC_OPERAND_FPR },
 
   /* The FRC field in an A form instruction.  */
-#define FRC (26)
+#define FRC FRB + 1
 #define FRC_MASK (0x1f << 6)
   { 5, 6, 0, 0, PPC_OPERAND_FPR },
 
   /* The FRS field in an X form instruction or the FRT field in a D, X
      or A form instruction.  */
-#define FRS (27)
-#define FRT (FRS)
+#define FRS FRC + 1
+#define FRT FRS
   { 5, 21, 0, 0, PPC_OPERAND_FPR },
 
   /* The FXM field in an XFX instruction.  */
-#define FXM (28)
+#define FXM FRS + 1
 #define FXM_MASK (0xff << 12)
-  { 8, 12, 0, 0, 0 },
+  { 8, 12, insert_fxm, extract_fxm, 0 },
+
+  /* Power4 version for mfcr.  */
+#define FXM4 FXM + 1
+  { 8, 12, insert_fxm, extract_fxm, PPC_OPERAND_OPTIONAL },
 
   /* The L field in a D or X form instruction.  */
-#define L (29)
+#define L FXM4 + 1
   { 1, 21, 0, 0, PPC_OPERAND_OPTIONAL },
 
   /* The LEV field in a POWER SC form instruction.  */
-#define LEV (30)
+#define LEV L + 1
   { 7, 5, 0, 0, 0 },
 
   /* The LI field in an I form instruction.  The lower two bits are
      forced to zero.  */
-#define LI (31)
+#define LI LEV + 1
   { 26, 0, insert_li, extract_li, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
 
   /* The LI field in an I form instruction when used as an absolute
      address.  */
-#define LIA (32)
+#define LIA LI + 1
   { 26, 0, insert_li, extract_li, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
 
+  /* The LS field in an X (sync) form instruction.  */
+#define LS LIA + 1
+  { 2, 21, 0, 0, PPC_OPERAND_OPTIONAL },
+
   /* The MB field in an M form instruction.  */
-#define MB (33)
+#define MB LS + 1
 #define MB_MASK (0x1f << 6)
   { 5, 6, 0, 0, 0 },
 
   /* The ME field in an M form instruction.  */
-#define ME (34)
+#define ME MB + 1
 #define ME_MASK (0x1f << 1)
   { 5, 1, 0, 0, 0 },
 
@@ -259,129 +332,213 @@
      operand which is a bitmask indicating which bits to select.  This
      is a two operand form using PPC_OPERAND_NEXT.  See the
      description in opcode/ppc.h for what this means.  */
-#define MBE (35)
+#define MBE ME + 1
   { 5, 6, 0, 0, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT },
   { 32, 0, insert_mbe, extract_mbe, 0 },
 
   /* The MB or ME field in an MD or MDS form instruction.  The high
      bit is wrapped to the low end.  */
-#define MB6 (37)
-#define ME6 (MB6)
+#define MB6 MBE + 2
+#define ME6 MB6
 #define MB6_MASK (0x3f << 5)
   { 6, 5, insert_mb6, extract_mb6, 0 },
 
+  /* The MO field in an mbar instruction.  */
+#define MO MB6 + 1
+  { 5, 21, 0, 0, 0 },
+
   /* The NB field in an X form instruction.  The value 32 is stored as
      0.  */
-#define NB (38)
+#define NB MO + 1
   { 6, 11, insert_nb, extract_nb, 0 },
 
   /* The NSI field in a D form instruction.  This is the same as the
      SI field, only negated.  */
-#define NSI (39)
+#define NSI NB + 1
   { 16, 0, insert_nsi, extract_nsi,
       PPC_OPERAND_NEGATIVE | PPC_OPERAND_SIGNED },
 
-  /* The RA field in an D, DS, X, XO, M, or MDS form instruction.  */
-#define RA (40)
+  /* The RA field in an D, DS, DQ, X, XO, M, or MDS form instruction.  */
+#define RA NSI + 1
 #define RA_MASK (0x1f << 16)
   { 5, 16, 0, 0, PPC_OPERAND_GPR },
 
+  /* The RA field in the DQ form lq instruction, which has special
+     value restrictions.  */
+#define RAQ RA + 1
+  { 5, 16, insert_raq, 0, PPC_OPERAND_GPR },
+
   /* The RA field in a D or X form instruction which is an updating
      load, which means that the RA field may not be zero and may not
      equal the RT field.  */
-#define RAL (41)
+#define RAL RAQ + 1
   { 5, 16, insert_ral, 0, PPC_OPERAND_GPR },
 
   /* The RA field in an lmw instruction, which has special value
      restrictions.  */
-#define RAM (42)
+#define RAM RAL + 1
   { 5, 16, insert_ram, 0, PPC_OPERAND_GPR },
 
   /* The RA field in a D or X form instruction which is an updating
      store or an updating floating point load, which means that the RA
      field may not be zero.  */
-#define RAS (43)
+#define RAS RAM + 1
   { 5, 16, insert_ras, 0, PPC_OPERAND_GPR },
 
   /* The RB field in an X, XO, M, or MDS form instruction.  */
-#define RB (44)
+#define RB RAS + 1
 #define RB_MASK (0x1f << 11)
   { 5, 11, 0, 0, PPC_OPERAND_GPR },
 
   /* The RB field in an X form instruction when it must be the same as
      the RS field in the instruction.  This is used for extended
      mnemonics like mr.  */
-#define RBS (45)
+#define RBS RB + 1
   { 5, 1, insert_rbs, extract_rbs, PPC_OPERAND_FAKE },
 
   /* The RS field in a D, DS, X, XFX, XS, M, MD or MDS form
      instruction or the RT field in a D, DS, X, XFX or XO form
      instruction.  */
-#define RS (46)
-#define RT (RS)
+#define RS RBS + 1
+#define RT RS
 #define RT_MASK (0x1f << 21)
   { 5, 21, 0, 0, PPC_OPERAND_GPR },
 
+  /* The RS field of the DS form stq instruction, which has special
+     value restrictions.  */
+#define RSQ RS + 1
+  { 5, 21, insert_rsq, 0, PPC_OPERAND_GPR },
+
+  /* The RT field of the DQ form lq instruction, which has special
+     value restrictions.  */
+#define RTQ RSQ + 1
+  { 5, 21, insert_rtq, 0, PPC_OPERAND_GPR },
+
   /* The SH field in an X or M form instruction.  */
-#define SH (47)
+#define SH RTQ + 1
 #define SH_MASK (0x1f << 11)
   { 5, 11, 0, 0, 0 },
 
   /* The SH field in an MD form instruction.  This is split.  */
-#define SH6 (48)
+#define SH6 SH + 1
 #define SH6_MASK ((0x1f << 11) | (1 << 1))
   { 6, 1, insert_sh6, extract_sh6, 0 },
 
   /* The SI field in a D form instruction.  */
-#define SI (49)
+#define SI SH6 + 1
   { 16, 0, 0, 0, PPC_OPERAND_SIGNED },
 
   /* The SI field in a D form instruction when we accept a wide range
      of positive values.  */
-#define SISIGNOPT (50)
+#define SISIGNOPT SI + 1
   { 16, 0, 0, 0, PPC_OPERAND_SIGNED | PPC_OPERAND_SIGNOPT },
 
   /* The SPR field in an XFX form instruction.  This is flipped--the
      lower 5 bits are stored in the upper 5 and vice- versa.  */
-#define SPR (51)
+#define SPR SISIGNOPT + 1
+#define PMR SPR
 #define SPR_MASK (0x3ff << 11)
   { 10, 11, insert_spr, extract_spr, 0 },
 
   /* The BAT index number in an XFX form m[ft]ibat[lu] instruction.  */
-#define SPRBAT (52)
+#define SPRBAT SPR + 1
 #define SPRBAT_MASK (0x3 << 17)
   { 2, 17, 0, 0, 0 },
 
   /* The SPRG register number in an XFX form m[ft]sprg instruction.  */
-#define SPRG (53)
+#define SPRG SPRBAT + 1
 #define SPRG_MASK (0x3 << 16)
   { 2, 16, 0, 0, 0 },
 
   /* The SR field in an X form instruction.  */
-#define SR (54)
+#define SR SPRG + 1
   { 4, 16, 0, 0, 0 },
 
+  /* The STRM field in an X AltiVec form instruction.  */
+#define STRM SR + 1
+#define STRM_MASK (0x3 << 21)
+  { 2, 21, 0, 0, 0 },
+
   /* The SV field in a POWER SC form instruction.  */
-#define SV (55)
+#define SV STRM + 1
   { 14, 2, 0, 0, 0 },
 
   /* The TBR field in an XFX form instruction.  This is like the SPR
      field, but it is optional.  */
-#define TBR (56)
+#define TBR SV + 1
   { 10, 11, insert_tbr, extract_tbr, PPC_OPERAND_OPTIONAL },
 
   /* The TO field in a D or X form instruction.  */
-#define TO (57)
+#define TO TBR + 1
 #define TO_MASK (0x1f << 21)
   { 5, 21, 0, 0, 0 },
 
   /* The U field in an X form instruction.  */
-#define U (58)
+#define U TO + 1
   { 4, 12, 0, 0, 0 },
 
   /* The UI field in a D form instruction.  */
-#define UI (59)
+#define UI U + 1
   { 16, 0, 0, 0, 0 },
+
+  /* The VA field in a VA, VX or VXR form instruction.  */
+#define VA UI + 1
+#define VA_MASK	(0x1f << 16)
+  { 5, 16, 0, 0, PPC_OPERAND_VR },
+
+  /* The VB field in a VA, VX or VXR form instruction.  */
+#define VB VA + 1
+#define VB_MASK (0x1f << 11)
+  { 5, 11, 0, 0, PPC_OPERAND_VR },
+
+  /* The VC field in a VA form instruction.  */
+#define VC VB + 1
+#define VC_MASK (0x1f << 6)
+  { 5, 6, 0, 0, PPC_OPERAND_VR },
+
+  /* The VD or VS field in a VA, VX, VXR or X form instruction.  */
+#define VD VC + 1
+#define VS VD
+#define VD_MASK (0x1f << 21)
+  { 5, 21, 0, 0, PPC_OPERAND_VR },
+
+  /* The SIMM field in a VX form instruction.  */
+#define SIMM VD + 1
+  { 5, 16, 0, 0, PPC_OPERAND_SIGNED},
+
+  /* The UIMM field in a VX form instruction.  */
+#define UIMM SIMM + 1
+  { 5, 16, 0, 0, 0 },
+
+  /* The SHB field in a VA form instruction.  */
+#define SHB UIMM + 1
+  { 4, 6, 0, 0, 0 },
+
+  /* The other UIMM field in a EVX form instruction.  */
+#define EVUIMM SHB + 1
+  { 5, 11, 0, 0, 0 },
+
+  /* The other UIMM field in a half word EVX form instruction.  */
+#define EVUIMM_2 EVUIMM + 1
+  { 32, 11, insert_ev2, extract_ev2, PPC_OPERAND_PARENS },
+
+  /* The other UIMM field in a word EVX form instruction.  */
+#define EVUIMM_4 EVUIMM_2 + 1
+  { 32, 11, insert_ev4, extract_ev4, PPC_OPERAND_PARENS },
+
+  /* The other UIMM field in a double EVX form instruction.  */
+#define EVUIMM_8 EVUIMM_4 + 1
+  { 32, 11, insert_ev8, extract_ev8, PPC_OPERAND_PARENS },
+
+  /* The WS field.  */
+#define WS EVUIMM_8 + 1
+#define WS_MASK (0x7 << 11)
+  { 3, 11, 0, 0, 0 },
+
+  /* The L field in an mtmsrd instruction */
+#define MTMSRD_L WS + 1
+  { 1, 16, 0, 0, PPC_OPERAND_OPTIONAL },
+
 };
 
 /* The functions used to insert and extract complicated operands.  */
@@ -393,17 +550,21 @@
    same.  */
 
 /*ARGSUSED*/
-static unsigned long 
-insert_bat(unsigned long insn, long value, const char **errmsg)
+static unsigned long
+insert_bat (unsigned long insn,
+	    long value ATTRIBUTE_UNUSED,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (((insn >> 21) & 0x1f) << 16);
 }
 
 static long
-extract_bat(unsigned long insn, int *invalid)
+extract_bat (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid)
 {
-  if (invalid != (int *) NULL
-      && ((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
+  if (((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
     *invalid = 1;
   return 0;
 }
@@ -416,16 +577,20 @@
 
 /*ARGSUSED*/
 static unsigned long
-insert_bba(unsigned long insn, long value, const char **errmsg)
+insert_bba (unsigned long insn,
+	    long value ATTRIBUTE_UNUSED,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (((insn >> 16) & 0x1f) << 11);
 }
 
 static long
-extract_bba(unsigned long insn, int *invalid)
+extract_bba (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid)
 {
-  if (invalid != (int *) NULL
-      && ((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
+  if (((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
     *invalid = 1;
   return 0;
 }
@@ -435,48 +600,76 @@
 
 /*ARGSUSED*/
 static unsigned long
-insert_bd(unsigned long insn, long value, const char **errmsg)
+insert_bd (unsigned long insn,
+	   long value,
+	   int dialect ATTRIBUTE_UNUSED,
+	   const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (value & 0xfffc);
 }
 
 /*ARGSUSED*/
 static long
-extract_bd(unsigned long insn, int *invalid)
+extract_bd (unsigned long insn,
+	    int dialect ATTRIBUTE_UNUSED,
+	    int *invalid ATTRIBUTE_UNUSED)
 {
-  if ((insn & 0x8000) != 0)
-    return (insn & 0xfffc) - 0x10000;
-  else
-    return insn & 0xfffc;
+  return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
 }
 
 /* The BD field in a B form instruction when the - modifier is used.
    This modifier means that the branch is not expected to be taken.
-   We must set the y bit of the BO field to 1 if the offset is
-   negative.  When extracting, we require that the y bit be 1 and that
-   the offset be positive, since if the y bit is 0 we just want to
-   print the normal form of the instruction.  */
+   For chips built to versions of the architecture prior to version 2
+   (ie. not Power4 compatible), we set the y bit of the BO field to 1
+   if the offset is negative.  When extracting, we require that the y
+   bit be 1 and that the offset be positive, since if the y bit is 0
+   we just want to print the normal form of the instruction.
+   Power4 compatible targets use two bits, "a", and "t", instead of
+   the "y" bit.  "at" == 00 => no hint, "at" == 01 => unpredictable,
+   "at" == 10 => not taken, "at" == 11 => taken.  The "t" bit is 00001
+   in BO field, the "a" bit is 00010 for branch on CR(BI) and 01000
+   for branch on CTR.  We only handle the taken/not-taken hint here.  */
 
 /*ARGSUSED*/
 static unsigned long
-insert_bdm(unsigned long insn, long value, const char **errmsg)
+insert_bdm (unsigned long insn,
+	    long value,
+	    int dialect,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
-  if ((value & 0x8000) != 0)
-    insn |= 1 << 21;
+  if ((dialect & PPC_OPCODE_POWER4) == 0)
+    {
+      if ((value & 0x8000) != 0)
+	insn |= 1 << 21;
+    }
+  else
+    {
+      if ((insn & (0x14 << 21)) == (0x04 << 21))
+	insn |= 0x02 << 21;
+      else if ((insn & (0x14 << 21)) == (0x10 << 21))
+	insn |= 0x08 << 21;
+    }
   return insn | (value & 0xfffc);
 }
 
 static long
-extract_bdm(unsigned long insn, int *invalid)
+extract_bdm (unsigned long insn,
+	     int dialect,
+	     int *invalid)
 {
-  if (invalid != (int *) NULL
-      && ((insn & (1 << 21)) == 0
-	  || (insn & (1 << 15)) == 0))
-    *invalid = 1;
-  if ((insn & 0x8000) != 0)
-    return (insn & 0xfffc) - 0x10000;
+  if ((dialect & PPC_OPCODE_POWER4) == 0)
+    {
+      if (((insn & (1 << 21)) == 0) != ((insn & (1 << 15)) == 0))
+	*invalid = 1;
+    }
   else
-    return insn & 0xfffc;
+    {
+      if ((insn & (0x17 << 21)) != (0x06 << 21)
+	  && (insn & (0x1d << 21)) != (0x18 << 21))
+	*invalid = 1;
+    }
+
+  return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
 }
 
 /* The BD field in a B form instruction when the + modifier is used.
@@ -485,50 +678,94 @@
 
 /*ARGSUSED*/
 static unsigned long
-insert_bdp(unsigned long insn, long value, const char **errmsg)
+insert_bdp (unsigned long insn,
+	    long value,
+	    int dialect,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
-  if ((value & 0x8000) == 0)
-    insn |= 1 << 21;
+  if ((dialect & PPC_OPCODE_POWER4) == 0)
+    {
+      if ((value & 0x8000) == 0)
+	insn |= 1 << 21;
+    }
+  else
+    {
+      if ((insn & (0x14 << 21)) == (0x04 << 21))
+	insn |= 0x03 << 21;
+      else if ((insn & (0x14 << 21)) == (0x10 << 21))
+	insn |= 0x09 << 21;
+    }
   return insn | (value & 0xfffc);
 }
 
 static long
-extract_bdp(unsigned long insn, int *invalid)
+extract_bdp (unsigned long insn,
+	     int dialect,
+	     int *invalid)
 {
-  if (invalid != (int *) NULL
-      && ((insn & (1 << 21)) == 0
-	  || (insn & (1 << 15)) != 0))
-    *invalid = 1;
-  if ((insn & 0x8000) != 0)
-    return (insn & 0xfffc) - 0x10000;
+  if ((dialect & PPC_OPCODE_POWER4) == 0)
+    {
+      if (((insn & (1 << 21)) == 0) == ((insn & (1 << 15)) == 0))
+	*invalid = 1;
+    }
   else
-    return insn & 0xfffc;
+    {
+      if ((insn & (0x17 << 21)) != (0x07 << 21)
+	  && (insn & (0x1d << 21)) != (0x19 << 21))
+	*invalid = 1;
+    }
+
+  return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
 }
 
 /* Check for legal values of a BO field.  */
 
 static int
-valid_bo (long value)
+valid_bo (long value, int dialect)
 {
-  /* Certain encodings have bits that are required to be zero.  These
-     are (z must be zero, y may be anything):
-         001zy
-	 011zy
-	 1z00y
-	 1z01y
-	 1z1zz
-     */
-  switch (value & 0x14)
+  if ((dialect & PPC_OPCODE_POWER4) == 0)
     {
-    default:
-    case 0:
-      return 1;
-    case 0x4:
-      return (value & 0x2) == 0;
-    case 0x10:
-      return (value & 0x8) == 0;
-    case 0x14:
-      return value == 0x14;
+      /* Certain encodings have bits that are required to be zero.
+	 These are (z must be zero, y may be anything):
+	     001zy
+	     011zy
+	     1z00y
+	     1z01y
+	     1z1zz
+      */
+      switch (value & 0x14)
+	{
+	default:
+	case 0:
+	  return 1;
+	case 0x4:
+	  return (value & 0x2) == 0;
+	case 0x10:
+	  return (value & 0x8) == 0;
+	case 0x14:
+	  return value == 0x14;
+	}
+    }
+  else
+    {
+      /* Certain encodings have bits that are required to be zero.
+	 These are (z must be zero, a & t may be anything):
+	     0000z
+	     0001z
+	     0100z
+	     0101z
+	     001at
+	     011at
+	     1a00t
+	     1a01t
+	     1z1zz
+      */
+      if ((value & 0x14) == 0)
+	return (value & 0x1) == 0;
+      else if ((value & 0x14) == 0x14)
+	return value == 0x14;
+      else
+	return 1;
     }
 }
 
@@ -536,22 +773,25 @@
    the field to an illegal value.  */
 
 static unsigned long
-insert_bo(unsigned long insn, long value, const char **errmsg)
+insert_bo (unsigned long insn,
+	   long value,
+	   int dialect,
+	   const char **errmsg)
 {
-  if (errmsg != (const char **) NULL
-      && ! valid_bo (value))
-    *errmsg = "invalid conditional option";
+  if (!valid_bo (value, dialect))
+    *errmsg = _("invalid conditional option");
   return insn | ((value & 0x1f) << 21);
 }
 
 static long
-extract_bo(unsigned long insn, int *invalid)
+extract_bo (unsigned long insn,
+	    int dialect,
+	    int *invalid)
 {
   long value;
 
   value = (insn >> 21) & 0x1f;
-  if (invalid != (int *) NULL
-      && ! valid_bo (value))
+  if (!valid_bo (value, dialect))
     *invalid = 1;
   return value;
 }
@@ -561,48 +801,250 @@
    extracting it, we force it to be even.  */
 
 static unsigned long
-insert_boe(unsigned long insn, long value, const char **errmsg)
+insert_boe (unsigned long insn,
+	    long value,
+	    int dialect,
+	    const char **errmsg)
 {
-  if (errmsg != (const char **) NULL)
-    {
-      if (! valid_bo (value))
-	*errmsg = "invalid conditional option";
-      else if ((value & 1) != 0)
-	*errmsg = "attempt to set y bit when using + or - modifier";
-    }
+  if (!valid_bo (value, dialect))
+    *errmsg = _("invalid conditional option");
+  else if ((value & 1) != 0)
+    *errmsg = _("attempt to set y bit when using + or - modifier");
+
   return insn | ((value & 0x1f) << 21);
 }
 
 static long
-extract_boe(unsigned long insn, int *invalid)
+extract_boe (unsigned long insn,
+	     int dialect,
+	     int *invalid)
 {
   long value;
 
   value = (insn >> 21) & 0x1f;
-  if (invalid != (int *) NULL
-      && ! valid_bo (value))
+  if (!valid_bo (value, dialect))
     *invalid = 1;
   return value & 0x1e;
 }
 
+/* The DQ field in a DQ form instruction.  This is like D, but the
+   lower four bits are forced to zero. */
+
+/*ARGSUSED*/
+static unsigned long
+insert_dq (unsigned long insn,
+	   long value,
+	   int dialect ATTRIBUTE_UNUSED,
+	   const char **errmsg)
+{
+  if ((value & 0xf) != 0)
+    *errmsg = _("offset not a multiple of 16");
+  return insn | (value & 0xfff0);
+}
+
+/*ARGSUSED*/
+static long
+extract_dq (unsigned long insn,
+	    int dialect ATTRIBUTE_UNUSED,
+	    int *invalid ATTRIBUTE_UNUSED)
+{
+  return ((insn & 0xfff0) ^ 0x8000) - 0x8000;
+}
+
+static unsigned long
+insert_ev2 (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
+{
+  if ((value & 1) != 0)
+    *errmsg = _("offset not a multiple of 2");
+  if ((value > 62) != 0)
+    *errmsg = _("offset greater than 62");
+  return insn | ((value & 0x3e) << 10);
+}
+
+static long
+extract_ev2 (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid ATTRIBUTE_UNUSED)
+{
+  return (insn >> 10) & 0x3e;
+}
+
+static unsigned long
+insert_ev4 (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
+{
+  if ((value & 3) != 0)
+    *errmsg = _("offset not a multiple of 4");
+  if ((value > 124) != 0)
+    *errmsg = _("offset greater than 124");
+  return insn | ((value & 0x7c) << 9);
+}
+
+static long
+extract_ev4 (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid ATTRIBUTE_UNUSED)
+{
+  return (insn >> 9) & 0x7c;
+}
+
+static unsigned long
+insert_ev8 (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
+{
+  if ((value & 7) != 0)
+    *errmsg = _("offset not a multiple of 8");
+  if ((value > 248) != 0)
+    *errmsg = _("offset greater than 248");
+  return insn | ((value & 0xf8) << 8);
+}
+
+static long
+extract_ev8 (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid ATTRIBUTE_UNUSED)
+{
+  return (insn >> 8) & 0xf8;
+}
+
 /* The DS field in a DS form instruction.  This is like D, but the
    lower two bits are forced to zero.  */
 
 /*ARGSUSED*/
 static unsigned long
-insert_ds(unsigned long insn, long value, const char **errmsg)
+insert_ds (unsigned long insn,
+	   long value,
+	   int dialect ATTRIBUTE_UNUSED,
+	   const char **errmsg)
 {
+  if ((value & 3) != 0)
+    *errmsg = _("offset not a multiple of 4");
   return insn | (value & 0xfffc);
 }
 
 /*ARGSUSED*/
 static long
-extract_ds(unsigned long insn, int *invalid)
+extract_ds (unsigned long insn,
+	    int dialect ATTRIBUTE_UNUSED,
+	    int *invalid ATTRIBUTE_UNUSED)
 {
-  if ((insn & 0x8000) != 0)
-    return (insn & 0xfffc) - 0x10000;
-  else
-    return insn & 0xfffc;
+  return ((insn & 0xfffc) ^ 0x8000) - 0x8000;
+}
+
+/* The DE field in a DE form instruction.  */
+
+/*ARGSUSED*/
+static unsigned long
+insert_de (unsigned long insn,
+	   long value,
+	   int dialect ATTRIBUTE_UNUSED,
+	   const char **errmsg)
+{
+  if (value > 2047 || value < -2048)
+    *errmsg = _("offset not between -2048 and 2047");
+  return insn | ((value << 4) & 0xfff0);
+}
+
+/*ARGSUSED*/
+static long
+extract_de (unsigned long insn,
+	    int dialect ATTRIBUTE_UNUSED,
+	    int *invalid ATTRIBUTE_UNUSED)
+{
+  return (insn & 0xfff0) >> 4;
+}
+
+/* The DES field in a DES form instruction.  */
+
+/*ARGSUSED*/
+static unsigned long
+insert_des (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
+{
+  if (value > 8191 || value < -8192)
+    *errmsg = _("offset not between -8192 and 8191");
+  else if ((value & 3) != 0)
+    *errmsg = _("offset not a multiple of 4");
+  return insn | ((value << 2) & 0xfff0);
+}
+
+/*ARGSUSED*/
+static long
+extract_des (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid ATTRIBUTE_UNUSED)
+{
+  return (((insn >> 2) & 0x3ffc) ^ 0x2000) - 0x2000;
+}
+
+/* FXM mask in mfcr and mtcrf instructions.  */
+
+static unsigned long
+insert_fxm (unsigned long insn,
+	    long value,
+	    int dialect,
+	    const char **errmsg)
+{
+  /* If the optional field on mfcr is missing that means we want to use
+     the old form of the instruction that moves the whole cr.  In that
+     case we'll have VALUE zero.  There doesn't seem to be a way to
+     distinguish this from the case where someone writes mfcr %r3,0.  */
+  if (value == 0)
+    ;
+
+  /* If only one bit of the FXM field is set, we can use the new form
+     of the instruction, which is faster.  Unlike the Power4 branch hint
+     encoding, this is not backward compatible.  */
+  else if ((dialect & PPC_OPCODE_POWER4) != 0 && (value & -value) == value)
+    insn |= 1 << 20;
+
+  /* Any other value on mfcr is an error.  */
+  else if ((insn & (0x3ff << 1)) == 19 << 1)
+    {
+      *errmsg = _("ignoring invalid mfcr mask");
+      value = 0;
+    }
+
+  return insn | ((value & 0xff) << 12);
+}
+
+static long
+extract_fxm (unsigned long insn,
+	     int dialect,
+	     int *invalid)
+{
+  long mask = (insn >> 12) & 0xff;
+
+  /* Is this a Power4 insn?  */
+  if ((insn & (1 << 20)) != 0)
+    {
+      if ((dialect & PPC_OPCODE_POWER4) == 0)
+	*invalid = 1;
+      else
+	{
+	  /* Exactly one bit of MASK should be set.  */
+	  if (mask == 0 || (mask & -mask) != mask)
+	    *invalid = 1;
+	}
+    }
+
+  /* Check that non-power4 form of mfcr has a zero MASK.  */
+  else if ((insn & (0x3ff << 1)) == 19 << 1)
+    {
+      if (mask != 0)
+	*invalid = 1;
+    }
+
+  return mask;
 }
 
 /* The LI field in an I form instruction.  The lower two bits are
@@ -610,19 +1052,23 @@
 
 /*ARGSUSED*/
 static unsigned long
-insert_li(unsigned long insn, long value, const char **errmsg)
+insert_li (unsigned long insn,
+	   long value,
+	   int dialect ATTRIBUTE_UNUSED,
+	   const char **errmsg)
 {
+  if ((value & 3) != 0)
+    *errmsg = _("ignoring least significant bits in branch offset");
   return insn | (value & 0x3fffffc);
 }
 
 /*ARGSUSED*/
 static long
-extract_li(unsigned long insn, int *invalid)
+extract_li (unsigned long insn,
+	    int dialect ATTRIBUTE_UNUSED,
+	    int *invalid ATTRIBUTE_UNUSED)
 {
-  if ((insn & 0x2000000) != 0)
-    return (insn & 0x3fffffc) - 0x4000000;
-  else
-    return insn & 0x3fffffc;
+  return ((insn & 0x3fffffc) ^ 0x2000000) - 0x2000000;
 }
 
 /* The MB and ME fields in an M form instruction expressed as a single
@@ -631,59 +1077,85 @@
    instruction which uses a field of this type.  */
 
 static unsigned long
-insert_mbe(unsigned long insn, long value, const char **errmsg)
+insert_mbe (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
 {
-  unsigned long uval;
-  int mb, me;
+  unsigned long uval, mask;
+  int mb, me, mx, count, last;
 
   uval = value;
 
   if (uval == 0)
     {
-      if (errmsg != (const char **) NULL)
-	*errmsg = "illegal bitmask";
+      *errmsg = _("illegal bitmask");
       return insn;
     }
 
-  me = 31;
-  while ((uval & 1) == 0)
-    {
-      uval >>= 1;
-      --me;
-    }
+  mb = 0;
+  me = 32;
+  if ((uval & 1) != 0)
+    last = 1;
+  else
+    last = 0;
+  count = 0;
 
-  mb = me;
-  uval >>= 1;
-  while ((uval & 1) != 0)
-    {
-      uval >>= 1;
-      --mb;
-    }
+  /* mb: location of last 0->1 transition */
+  /* me: location of last 1->0 transition */
+  /* count: # transitions */
 
-  if (uval != 0)
+  for (mx = 0, mask = 1L << 31; mx < 32; ++mx, mask >>= 1)
     {
-      if (errmsg != (const char **) NULL)
-	*errmsg = "illegal bitmask";
+      if ((uval & mask) && !last)
+	{
+	  ++count;
+	  mb = mx;
+	  last = 1;
+	}
+      else if (!(uval & mask) && last)
+	{
+	  ++count;
+	  me = mx;
+	  last = 0;
+	}
     }
+  if (me == 0)
+    me = 32;
 
-  return insn | (mb << 6) | (me << 1);
+  if (count != 2 && (count != 0 || ! last))
+    *errmsg = _("illegal bitmask");
+
+  return insn | (mb << 6) | ((me - 1) << 1);
 }
 
 static long
-extract_mbe(unsigned long insn, int *invalid)
+extract_mbe (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid)
 {
   long ret;
   int mb, me;
   int i;
 
-  if (invalid != (int *) NULL)
-    *invalid = 1;
+  *invalid = 1;
 
-  ret = 0;
   mb = (insn >> 6) & 0x1f;
   me = (insn >> 1) & 0x1f;
-  for (i = mb; i < me; i++)
-    ret |= 1 << (31 - i);
+  if (mb < me + 1)
+    {
+      ret = 0;
+      for (i = mb; i <= me; i++)
+	ret |= 1L << (31 - i);
+    }
+  else if (mb == me + 1)
+    ret = ~0;
+  else /* (mb > me + 1) */
+    {
+      ret = ~0;
+      for (i = me + 1; i < mb; i++)
+	ret &= ~(1L << (31 - i));
+    }
   return ret;
 }
 
@@ -692,14 +1164,19 @@
 
 /*ARGSUSED*/
 static unsigned long
-insert_mb6(unsigned long insn, long value, const char **errmsg)
+insert_mb6 (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | ((value & 0x1f) << 6) | (value & 0x20);
 }
 
 /*ARGSUSED*/
 static long
-extract_mb6(unsigned long insn, int *invalid)
+extract_mb6 (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid ATTRIBUTE_UNUSED)
 {
   return ((insn >> 6) & 0x1f) | (insn & 0x20);
 }
@@ -708,10 +1185,13 @@
    0.  */
 
 static unsigned long
-insert_nb(unsigned long insn, long value, const char **errmsg)
+insert_nb (unsigned long insn,
+	   long value,
+	   int dialect ATTRIBUTE_UNUSED,
+	   const char **errmsg)
 {
   if (value < 0 || value > 32)
-    *errmsg = "value out of range";
+    *errmsg = _("value out of range");
   if (value == 32)
     value = 0;
   return insn | ((value & 0x1f) << 11);
@@ -719,7 +1199,9 @@
 
 /*ARGSUSED*/
 static long
-extract_nb(unsigned long insn, int *invalid)
+extract_nb (unsigned long insn,
+	    int dialect ATTRIBUTE_UNUSED,
+	    int *invalid ATTRIBUTE_UNUSED)
 {
   long ret;
 
@@ -736,20 +1218,21 @@
 
 /*ARGSUSED*/
 static unsigned long
-insert_nsi(unsigned long insn, long value, const char **errmsg)
+insert_nsi (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
-  return insn | ((- value) & 0xffff);
+  return insn | (-value & 0xffff);
 }
 
 static long
-extract_nsi(unsigned long insn, int *invalid)
+extract_nsi (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid)
 {
-  if (invalid != (int *) NULL)
-    *invalid = 1;
-  if ((insn & 0x8000) != 0)
-    return - ((insn & 0xffff) - 0x10000);
-  else
-    return - (insn & 0xffff);
+  *invalid = 1;
+  return -(((insn & 0xffff) ^ 0x8000) - 0x8000);
 }
 
 /* The RA field in a D or X form instruction which is an updating
@@ -757,10 +1240,13 @@
    equal the RT field.  */
 
 static unsigned long
-insert_ral(unsigned long insn, long value, const char **errmsg)
+insert_ral (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
 {
   if (value == 0
-      || value == ((insn >> 21) & 0x1f))
+      || (unsigned long) value == ((insn >> 21) & 0x1f))
     *errmsg = "invalid register operand when updating";
   return insn | ((value & 0x1f) << 16);
 }
@@ -769,10 +1255,30 @@
    restrictions.  */
 
 static unsigned long
-insert_ram(unsigned long insn, long value, const char **errmsg)
+insert_ram (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
 {
-  if (value >= ((insn >> 21) & 0x1f))
-    *errmsg = "index register in load range";
+  if ((unsigned long) value >= ((insn >> 21) & 0x1f))
+    *errmsg = _("index register in load range");
+  return insn | ((value & 0x1f) << 16);
+}
+
+/* The RA field in the DQ form lq instruction, which has special
+   value restrictions.  */
+
+/*ARGSUSED*/
+static unsigned long
+insert_raq (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
+{
+  long rtvalue = (insn & RT_MASK) >> 21;
+
+  if (value == rtvalue)
+    *errmsg = _("source and target register operands must be different");
   return insn | ((value & 0x1f) << 16);
 }
 
@@ -781,10 +1287,13 @@
    field may not be zero.  */
 
 static unsigned long
-insert_ras(unsigned long insn, long value, const char **errmsg)
+insert_ras (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
 {
   if (value == 0)
-    *errmsg = "invalid register operand when updating";
+    *errmsg = _("invalid register operand when updating");
   return insn | ((value & 0x1f) << 16);
 }
 
@@ -795,33 +1304,72 @@
    extraction function just checks that the fields are the same.  */
 
 /*ARGSUSED*/
-static unsigned long 
-insert_rbs(unsigned long insn, long value, const char **errmsg)
+static unsigned long
+insert_rbs (unsigned long insn,
+	    long value ATTRIBUTE_UNUSED,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | (((insn >> 21) & 0x1f) << 11);
 }
 
 static long
-extract_rbs(unsigned long insn, int *invalid)
+extract_rbs (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid)
 {
-  if (invalid != (int *) NULL
-      && ((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
+  if (((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
     *invalid = 1;
   return 0;
 }
 
+/* The RT field of the DQ form lq instruction, which has special
+   value restrictions.  */
+
+/*ARGSUSED*/
+static unsigned long
+insert_rtq (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
+{
+  if ((value & 1) != 0)
+    *errmsg = _("target register operand must be even");
+  return insn | ((value & 0x1f) << 21);
+}
+
+/* The RS field of the DS form stq instruction, which has special
+   value restrictions.  */
+
+/*ARGSUSED*/
+static unsigned long
+insert_rsq (unsigned long insn,
+	    long value ATTRIBUTE_UNUSED,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg)
+{
+  if ((value & 1) != 0)
+    *errmsg = _("source register operand must be even");
+  return insn | ((value & 0x1f) << 21);
+}
+
 /* The SH field in an MD form instruction.  This is split.  */
 
 /*ARGSUSED*/
 static unsigned long
-insert_sh6(unsigned long insn, long value, const char **errmsg)
+insert_sh6 (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
 }
 
 /*ARGSUSED*/
 static long
-extract_sh6(unsigned long insn, int *invalid)
+extract_sh6 (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid ATTRIBUTE_UNUSED)
 {
   return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
 }
@@ -830,13 +1378,18 @@
    lower 5 bits are stored in the upper 5 and vice- versa.  */
 
 static unsigned long
-insert_spr(unsigned long insn, long value, const char **errmsg)
+insert_spr (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
 }
 
 static long
-extract_spr(unsigned long insn, int *invalid)
+extract_spr (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid ATTRIBUTE_UNUSED)
 {
   return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
 }
@@ -852,7 +1405,10 @@
 #define TB (268)
 
 static unsigned long
-insert_tbr(unsigned long insn, long value, const char **errmsg)
+insert_tbr (unsigned long insn,
+	    long value,
+	    int dialect ATTRIBUTE_UNUSED,
+	    const char **errmsg ATTRIBUTE_UNUSED)
 {
   if (value == 0)
     value = TB;
@@ -860,7 +1416,9 @@
 }
 
 static long
-extract_tbr(unsigned long insn, int *invalid)
+extract_tbr (unsigned long insn,
+	     int dialect ATTRIBUTE_UNUSED,
+	     int *invalid ATTRIBUTE_UNUSED)
 {
   long ret;
 
@@ -873,23 +1431,23 @@
 /* Macros used to form opcodes.  */
 
 /* The main opcode.  */
-#define OP(x) (((x) & 0x3f) << 26)
+#define OP(x) ((((unsigned long)(x)) & 0x3f) << 26)
 #define OP_MASK OP (0x3f)
 
 /* The main opcode combined with a trap code in the TO field of a D
    form instruction.  Used for extended mnemonics for the trap
    instructions.  */
-#define OPTO(x,to) (OP (x) | (((to) & 0x1f) << 21))
+#define OPTO(x,to) (OP (x) | ((((unsigned long)(to)) & 0x1f) << 21))
 #define OPTO_MASK (OP_MASK | TO_MASK)
 
 /* The main opcode combined with a comparison size bit in the L field
    of a D form or X form instruction.  Used for extended mnemonics for
    the comparison instructions.  */
-#define OPL(x,l) (OP (x) | (((l) & 1) << 21))
+#define OPL(x,l) (OP (x) | ((((unsigned long)(l)) & 1) << 21))
 #define OPL_MASK OPL (0x3f,1)
 
 /* An A form instruction.  */
-#define A(op, xop, rc) (OP (op) | (((xop) & 0x1f) << 1) | ((rc) & 1))
+#define A(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1) | (((unsigned long)(rc)) & 1))
 #define A_MASK A (0x3f, 0x1f, 1)
 
 /* An A_MASK with the FRB field fixed.  */
@@ -902,30 +1460,44 @@
 #define AFRAFRC_MASK (A_MASK | FRA_MASK | FRC_MASK)
 
 /* A B form instruction.  */
-#define B(op, aa, lk) (OP (op) | (((aa) & 1) << 1) | ((lk) & 1))
+#define B(op, aa, lk) (OP (op) | ((((unsigned long)(aa)) & 1) << 1) | ((lk) & 1))
 #define B_MASK B (0x3f, 1, 1)
 
 /* A B form instruction setting the BO field.  */
-#define BBO(op, bo, aa, lk) (B ((op), (aa), (lk)) | (((bo) & 0x1f) << 21))
+#define BBO(op, bo, aa, lk) (B ((op), (aa), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21))
 #define BBO_MASK BBO (0x3f, 0x1f, 1, 1)
 
 /* A BBO_MASK with the y bit of the BO field removed.  This permits
    matching a conditional branch regardless of the setting of the y
-   bit.  */
-#define Y_MASK (1 << 21)
-#define BBOY_MASK (BBO_MASK &~ Y_MASK)
+   bit.  Similarly for the 'at' bits used for power4 branch hints.  */
+#define Y_MASK   (((unsigned long) 1) << 21)
+#define AT1_MASK (((unsigned long) 3) << 21)
+#define AT2_MASK (((unsigned long) 9) << 21)
+#define BBOY_MASK  (BBO_MASK &~ Y_MASK)
+#define BBOAT_MASK (BBO_MASK &~ AT1_MASK)
 
 /* A B form instruction setting the BO field and the condition bits of
    the BI field.  */
 #define BBOCB(op, bo, cb, aa, lk) \
-  (BBO ((op), (bo), (aa), (lk)) | (((cb) & 0x3) << 16))
+  (BBO ((op), (bo), (aa), (lk)) | ((((unsigned long)(cb)) & 0x3) << 16))
 #define BBOCB_MASK BBOCB (0x3f, 0x1f, 0x3, 1, 1)
 
 /* A BBOCB_MASK with the y bit of the BO field removed.  */
 #define BBOYCB_MASK (BBOCB_MASK &~ Y_MASK)
+#define BBOATCB_MASK (BBOCB_MASK &~ AT1_MASK)
+#define BBOAT2CB_MASK (BBOCB_MASK &~ AT2_MASK)
 
 /* A BBOYCB_MASK in which the BI field is fixed.  */
 #define BBOYBI_MASK (BBOYCB_MASK | BI_MASK)
+#define BBOATBI_MASK (BBOAT2CB_MASK | BI_MASK)
+
+/* An Context form instruction.  */
+#define CTX(op, xop)   (OP (op) | (((unsigned long)(xop)) & 0x7))
+#define CTX_MASK       CTX(0x3f, 0x7)
+
+/* An User Context form instruction.  */
+#define UCTX(op, xop)  (OP (op) | (((unsigned long)(xop)) & 0x1f))
+#define UCTX_MASK      UCTX(0x3f, 0x1f)
 
 /* The main opcode mask with the RA field clear.  */
 #define DRA_MASK (OP_MASK | RA_MASK)
@@ -934,12 +1506,20 @@
 #define DSO(op, xop) (OP (op) | ((xop) & 0x3))
 #define DS_MASK DSO (0x3f, 3)
 
+/* A DE form instruction.  */
+#define DEO(op, xop) (OP (op) | ((xop) & 0xf))
+#define DE_MASK DEO (0x3e, 0xf)
+
+/* An EVSEL form instruction.  */
+#define EVSEL(op, xop) (OP (op) | (((unsigned long)(xop)) & 0xff) << 3)
+#define EVSEL_MASK EVSEL(0x3f, 0xff)
+
 /* An M form instruction.  */
 #define M(op, rc) (OP (op) | ((rc) & 1))
 #define M_MASK M (0x3f, 1)
 
 /* An M form instruction with the ME field specified.  */
-#define MME(op, me, rc) (M ((op), (rc)) | (((me) & 0x1f) << 1))
+#define MME(op, me, rc) (M ((op), (rc)) | ((((unsigned long)(me)) & 0x1f) << 1))
 
 /* An M_MASK with the MB and ME fields fixed.  */
 #define MMBME_MASK (M_MASK | MB_MASK | ME_MASK)
@@ -948,7 +1528,7 @@
 #define MSHME_MASK (M_MASK | SH_MASK | ME_MASK)
 
 /* An MD form instruction.  */
-#define MD(op, xop, rc) (OP (op) | (((xop) & 0x7) << 2) | ((rc) & 1))
+#define MD(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x7) << 2) | ((rc) & 1))
 #define MD_MASK MD (0x3f, 0x7, 1)
 
 /* An MD_MASK with the MB field fixed.  */
@@ -958,18 +1538,36 @@
 #define MDSH_MASK (MD_MASK | SH6_MASK)
 
 /* An MDS form instruction.  */
-#define MDS(op, xop, rc) (OP (op) | (((xop) & 0xf) << 1) | ((rc) & 1))
+#define MDS(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0xf) << 1) | ((rc) & 1))
 #define MDS_MASK MDS (0x3f, 0xf, 1)
 
 /* An MDS_MASK with the MB field fixed.  */
 #define MDSMB_MASK (MDS_MASK | MB6_MASK)
 
 /* An SC form instruction.  */
-#define SC(op, sa, lk) (OP (op) | (((sa) & 1) << 1) | ((lk) & 1))
-#define SC_MASK (OP_MASK | (0x3ff << 16) | (1 << 1) | 1)
+#define SC(op, sa, lk) (OP (op) | ((((unsigned long)(sa)) & 1) << 1) | ((lk) & 1))
+#define SC_MASK (OP_MASK | (((unsigned long)0x3ff) << 16) | (((unsigned long)1) << 1) | 1)
+
+/* An VX form instruction.  */
+#define VX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7ff))
+
+/* The mask for an VX form instruction.  */
+#define VX_MASK	VX(0x3f, 0x7ff)
+
+/* An VA form instruction.  */
+#define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x03f))
+
+/* The mask for an VA form instruction.  */
+#define VXA_MASK VXA(0x3f, 0x3f)
+
+/* An VXR form instruction.  */
+#define VXR(op, xop, rc) (OP (op) | (((rc) & 1) << 10) | (((unsigned long)(xop)) & 0x3ff))
+
+/* The mask for a VXR form instruction.  */
+#define VXR_MASK VXR(0x3f, 0x3ff, 1)
 
 /* An X form instruction.  */
-#define X(op, xop) (OP (op) | (((xop) & 0x3ff) << 1))
+#define X(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1))
 
 /* An X form instruction with the RC bit specified.  */
 #define XRC(op, xop, rc) (X ((op), (xop)) | ((rc) & 1))
@@ -989,29 +1587,53 @@
 /* An X_MASK with the RA and RB fields fixed.  */
 #define XRARB_MASK (X_MASK | RA_MASK | RB_MASK)
 
+/* An XRARB_MASK, but with the L bit clear.  */
+#define XRLARB_MASK (XRARB_MASK & ~((unsigned long) 1 << 16))
+
 /* An X_MASK with the RT and RA fields fixed.  */
 #define XRTRA_MASK (X_MASK | RT_MASK | RA_MASK)
 
+/* An XRTRA_MASK, but with L bit clear.  */
+#define XRTLRA_MASK (XRTRA_MASK & ~((unsigned long) 1 << 21))
+
 /* An X form comparison instruction.  */
-#define XCMPL(op, xop, l) (X ((op), (xop)) | (((l) & 1) << 21))
+#define XCMPL(op, xop, l) (X ((op), (xop)) | ((((unsigned long)(l)) & 1) << 21))
 
 /* The mask for an X form comparison instruction.  */
-#define XCMP_MASK (X_MASK | (1 << 22))
+#define XCMP_MASK (X_MASK | (((unsigned long)1) << 22))
 
 /* The mask for an X form comparison instruction with the L field
    fixed.  */
-#define XCMPL_MASK (XCMP_MASK | (1 << 21))
+#define XCMPL_MASK (XCMP_MASK | (((unsigned long)1) << 21))
 
 /* An X form trap instruction with the TO field specified.  */
-#define XTO(op, xop, to) (X ((op), (xop)) | (((to) & 0x1f) << 21))
+#define XTO(op, xop, to) (X ((op), (xop)) | ((((unsigned long)(to)) & 0x1f) << 21))
 #define XTO_MASK (X_MASK | TO_MASK)
 
+/* An X form tlb instruction with the SH field specified.  */
+#define XTLB(op, xop, sh) (X ((op), (xop)) | ((((unsigned long)(sh)) & 0x1f) << 11))
+#define XTLB_MASK (X_MASK | SH_MASK)
+
+/* An X form sync instruction.  */
+#define XSYNC(op, xop, l) (X ((op), (xop)) | ((((unsigned long)(l)) & 3) << 21))
+
+/* An X form sync instruction with everything filled in except the LS field.  */
+#define XSYNC_MASK (0xff9fffff)
+
+/* An X form AltiVec dss instruction.  */
+#define XDSS(op, xop, a) (X ((op), (xop)) | ((((unsigned long)(a)) & 1) << 25))
+#define XDSS_MASK XDSS(0x3f, 0x3ff, 1)
+
 /* An XFL form instruction.  */
-#define XFL(op, xop, rc) (OP (op) | (((xop) & 0x3ff) << 1) | ((rc) & 1))
-#define XFL_MASK (XFL (0x3f, 0x3ff, 1) | (1 << 25) | (1 << 16))
+#define XFL(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1) | (((unsigned long)(rc)) & 1))
+#define XFL_MASK (XFL (0x3f, 0x3ff, 1) | (((unsigned long)1) << 25) | (((unsigned long)1) << 16))
+
+/* An X form isel instruction.  */
+#define XISEL(op, xop)  (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1))
+#define XISEL_MASK      XISEL(0x3f, 0x1f)
 
 /* An XL form instruction with the LK field set to 0.  */
-#define XL(op, xop) (OP (op) | (((xop) & 0x3ff) << 1))
+#define XL(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1))
 
 /* An XL form instruction which uses the LK field.  */
 #define XLLK(op, xop, lk) (XL ((op), (xop)) | ((lk) & 1))
@@ -1021,18 +1643,18 @@
 
 /* An XL form instruction which explicitly sets the BO field.  */
 #define XLO(op, bo, xop, lk) \
-  (XLLK ((op), (xop), (lk)) | (((bo) & 0x1f) << 21))
+  (XLLK ((op), (xop), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21))
 #define XLO_MASK (XL_MASK | BO_MASK)
 
 /* An XL form instruction which explicitly sets the y bit of the BO
    field.  */
-#define XLYLK(op, xop, y, lk) (XLLK ((op), (xop), (lk)) | (((y) & 1) << 21))
+#define XLYLK(op, xop, y, lk) (XLLK ((op), (xop), (lk)) | ((((unsigned long)(y)) & 1) << 21))
 #define XLYLK_MASK (XL_MASK | Y_MASK)
 
 /* An XL form instruction which sets the BO field and the condition
    bits of the BI field.  */
 #define XLOCB(op, bo, cb, xop, lk) \
-  (XLO ((op), (bo), (xop), (lk)) | (((cb) & 3) << 16))
+  (XLO ((op), (bo), (xop), (lk)) | ((((unsigned long)(cb)) & 3) << 16))
 #define XLOCB_MASK XLOCB (0x3f, 0x1f, 0x3, 0x3ff, 1)
 
 /* An XL_MASK or XLYLK_MASK or XLOCB_MASK with the BB field fixed.  */
@@ -1048,26 +1670,26 @@
 
 /* An XO form instruction.  */
 #define XO(op, xop, oe, rc) \
-  (OP (op) | (((xop) & 0x1ff) << 1) | (((oe) & 1) << 10) | ((rc) & 1))
+  (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 1) | ((((unsigned long)(oe)) & 1) << 10) | (((unsigned long)(rc)) & 1))
 #define XO_MASK XO (0x3f, 0x1ff, 1, 1)
 
 /* An XO_MASK with the RB field fixed.  */
 #define XORB_MASK (XO_MASK | RB_MASK)
 
 /* An XS form instruction.  */
-#define XS(op, xop, rc) (OP (op) | (((xop) & 0x1ff) << 2) | ((rc) & 1))
+#define XS(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 2) | (((unsigned long)(rc)) & 1))
 #define XS_MASK XS (0x3f, 0x1ff, 1)
 
 /* A mask for the FXM version of an XFX form instruction.  */
-#define XFXFXM_MASK (X_MASK | (1 << 20) | (1 << 11))
+#define XFXFXM_MASK (X_MASK | (1 << 11))
 
 /* An XFX form instruction with the FXM field filled in.  */
 #define XFXM(op, xop, fxm) \
-  (X ((op), (xop)) | (((fxm) & 0xff) << 12))
+  (X ((op), (xop)) | ((((unsigned long)(fxm)) & 0xff) << 12))
 
 /* An XFX form instruction with the SPR field filled in.  */
 #define XSPR(op, xop, spr) \
-  (X ((op), (xop)) | (((spr) & 0x1f) << 16) | (((spr) & 0x3e0) << 6))
+  (X ((op), (xop)) | ((((unsigned long)(spr)) & 0x1f) << 16) | ((((unsigned long)(spr)) & 0x3e0) << 6))
 #define XSPR_MASK (X_MASK | SPR_MASK)
 
 /* An XFX form instruction with the SPR field filled in except for the
@@ -1078,23 +1700,41 @@
    SPRG field.  */
 #define XSPRG_MASK (XSPR_MASK &~ SPRG_MASK)
 
+/* An X form instruction with everything filled in except the E field.  */
+#define XE_MASK (0xffff7fff)
+
+/* An X form user context instruction.  */
+#define XUC(op, xop)  (OP (op) | (((unsigned long)(xop)) & 0x1f))
+#define XUC_MASK      XUC(0x3f, 0x1f)
+
 /* The BO encodings used in extended conditional branch mnemonics.  */
 #define BODNZF	(0x0)
 #define BODNZFP	(0x1)
 #define BODZF	(0x2)
 #define BODZFP	(0x3)
-#define BOF	(0x4)
-#define BOFP	(0x5)
 #define BODNZT	(0x8)
 #define BODNZTP	(0x9)
 #define BODZT	(0xa)
 #define BODZTP	(0xb)
+
+#define BOF	(0x4)
+#define BOFP	(0x5)
+#define BOFM4	(0x6)
+#define BOFP4	(0x7)
 #define BOT	(0xc)
 #define BOTP	(0xd)
+#define BOTM4	(0xe)
+#define BOTP4	(0xf)
+
 #define BODNZ	(0x10)
 #define BODNZP	(0x11)
 #define BODZ	(0x12)
 #define BODZP	(0x13)
+#define BODNZM4 (0x18)
+#define BODNZP4 (0x19)
+#define BODZM4	(0x1a)
+#define BODZP4	(0x1b)
+
 #define BOU	(0x14)
 
 /* The BI condition bit encodings used in extended conditional branch
@@ -1123,13 +1763,40 @@
 
 /* Smaller names for the flags so each entry in the opcodes table will
    fit on a single line.  */
-#undef PPC
-#define PPC PPC_OPCODE_PPC
-#define POWER PPC_OPCODE_POWER
-#define POWER2 PPC_OPCODE_POWER2
-#define B32 PPC_OPCODE_32
-#define B64 PPC_OPCODE_64
-#define M601 PPC_OPCODE_601
+#undef	PPC
+#define PPC     PPC_OPCODE_PPC
+#define PPCCOM	PPC_OPCODE_PPC | PPC_OPCODE_COMMON
+#define NOPOWER4 PPC_OPCODE_NOPOWER4 | PPCCOM
+#define POWER4	PPC_OPCODE_POWER4
+#define PPC32   PPC_OPCODE_32 | PPC_OPCODE_PPC
+#define PPC64   PPC_OPCODE_64 | PPC_OPCODE_PPC
+#define PPC403	PPC_OPCODE_403
+#define PPC405	PPC403
+#define PPC440	PPC_OPCODE_440
+#define PPC750	PPC
+#define PPC860	PPC
+#define PPCVEC	PPC_OPCODE_ALTIVEC | PPC_OPCODE_PPC
+#define	POWER   PPC_OPCODE_POWER
+#define	POWER2	PPC_OPCODE_POWER | PPC_OPCODE_POWER2
+#define PPCPWR2	PPC_OPCODE_PPC | PPC_OPCODE_POWER | PPC_OPCODE_POWER2
+#define	POWER32	PPC_OPCODE_POWER | PPC_OPCODE_32
+#define	COM     PPC_OPCODE_POWER | PPC_OPCODE_PPC | PPC_OPCODE_COMMON
+#define	COM32   PPC_OPCODE_POWER | PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_32
+#define	M601    PPC_OPCODE_POWER | PPC_OPCODE_601
+#define PWRCOM	PPC_OPCODE_POWER | PPC_OPCODE_601 | PPC_OPCODE_COMMON
+#define	MFDEC1	PPC_OPCODE_POWER
+#define	MFDEC2	PPC_OPCODE_PPC | PPC_OPCODE_601 | PPC_OPCODE_BOOKE
+#define BOOKE	PPC_OPCODE_BOOKE
+#define BOOKE64	PPC_OPCODE_BOOKE64
+#define CLASSIC	PPC_OPCODE_CLASSIC
+#define PPCSPE	PPC_OPCODE_SPE
+#define PPCISEL	PPC_OPCODE_ISEL
+#define PPCEFS	PPC_OPCODE_EFS
+#define PPCBRLK	PPC_OPCODE_BRLOCK
+#define PPCPMR	PPC_OPCODE_PMR
+#define PPCCHLK	PPC_OPCODE_CACHELCK
+#define PPCCHLK64	PPC_OPCODE_CACHELCK | PPC_OPCODE_BOOKE64
+#define PPCRFMCI	PPC_OPCODE_RFMCI
 
 /* The opcode table.
 
@@ -1150,815 +1817,1456 @@
    sorted by major opcode.  */
 
 const struct powerpc_opcode powerpc_opcodes[] = {
-{ "tdlgti",  OPTO(2,TOLGT), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdllti",  OPTO(2,TOLLT), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdeqi",   OPTO(2,TOEQ), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdlgei",  OPTO(2,TOLGE), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdlnli",  OPTO(2,TOLNL), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdllei",  OPTO(2,TOLLE), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdlngi",  OPTO(2,TOLNG), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdgti",   OPTO(2,TOGT), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdgei",   OPTO(2,TOGE), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdnli",   OPTO(2,TONL), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdlti",   OPTO(2,TOLT), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdlei",   OPTO(2,TOLE), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdngi",   OPTO(2,TONG), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdnei",   OPTO(2,TONE), OPTO_MASK,	PPC|B64,	{ RA, SI } },
-{ "tdi",     OP(2),	OP_MASK,	PPC|B64,	{ TO, RA, SI } },
-
-{ "twlgti",  OPTO(3,TOLGT), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tlgti",   OPTO(3,TOLGT), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twllti",  OPTO(3,TOLLT), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tllti",   OPTO(3,TOLLT), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "tweqi",   OPTO(3,TOEQ), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "teqi",    OPTO(3,TOEQ), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twlgei",  OPTO(3,TOLGE), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tlgei",   OPTO(3,TOLGE), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twlnli",  OPTO(3,TOLNL), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tlnli",   OPTO(3,TOLNL), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twllei",  OPTO(3,TOLLE), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tllei",   OPTO(3,TOLLE), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twlngi",  OPTO(3,TOLNG), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tlngi",   OPTO(3,TOLNG), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twgti",   OPTO(3,TOGT), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tgti",    OPTO(3,TOGT), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twgei",   OPTO(3,TOGE), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tgei",    OPTO(3,TOGE), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twnli",   OPTO(3,TONL), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tnli",    OPTO(3,TONL), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twlti",   OPTO(3,TOLT), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tlti",    OPTO(3,TOLT), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twlei",   OPTO(3,TOLE), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tlei",    OPTO(3,TOLE), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twngi",   OPTO(3,TONG), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tngi",    OPTO(3,TONG), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twnei",   OPTO(3,TONE), OPTO_MASK,	PPC,		{ RA, SI } },
-{ "tnei",    OPTO(3,TONE), OPTO_MASK,	POWER,		{ RA, SI } },
-{ "twi",     OP(3),	OP_MASK,	PPC,		{ TO, RA, SI } },
-{ "ti",      OP(3),	OP_MASK,	POWER,		{ TO, RA, SI } },
-
-{ "mulli",   OP(7),	OP_MASK,	PPC,		{ RT, RA, SI } },
-{ "muli",    OP(7),	OP_MASK,	POWER,		{ RT, RA, SI } },
-
-{ "subfic",  OP(8),	OP_MASK,	PPC,		{ RT, RA, SI } },
-{ "sfi",     OP(8),	OP_MASK,	POWER,		{ RT, RA, SI } },
+{ "attn",    X(0,256), X_MASK,		POWER4,		{ 0 } },
+{ "tdlgti",  OPTO(2,TOLGT), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdllti",  OPTO(2,TOLLT), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdeqi",   OPTO(2,TOEQ), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdlgei",  OPTO(2,TOLGE), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdlnli",  OPTO(2,TOLNL), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdllei",  OPTO(2,TOLLE), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdlngi",  OPTO(2,TOLNG), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdgti",   OPTO(2,TOGT), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdgei",   OPTO(2,TOGE), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdnli",   OPTO(2,TONL), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdlti",   OPTO(2,TOLT), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdlei",   OPTO(2,TOLE), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdngi",   OPTO(2,TONG), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdnei",   OPTO(2,TONE), OPTO_MASK,	PPC64,		{ RA, SI } },
+{ "tdi",     OP(2),	OP_MASK,	PPC64,		{ TO, RA, SI } },
+
+{ "twlgti",  OPTO(3,TOLGT), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tlgti",   OPTO(3,TOLGT), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twllti",  OPTO(3,TOLLT), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tllti",   OPTO(3,TOLLT), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "tweqi",   OPTO(3,TOEQ), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "teqi",    OPTO(3,TOEQ), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twlgei",  OPTO(3,TOLGE), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tlgei",   OPTO(3,TOLGE), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twlnli",  OPTO(3,TOLNL), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tlnli",   OPTO(3,TOLNL), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twllei",  OPTO(3,TOLLE), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tllei",   OPTO(3,TOLLE), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twlngi",  OPTO(3,TOLNG), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tlngi",   OPTO(3,TOLNG), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twgti",   OPTO(3,TOGT), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tgti",    OPTO(3,TOGT), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twgei",   OPTO(3,TOGE), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tgei",    OPTO(3,TOGE), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twnli",   OPTO(3,TONL), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tnli",    OPTO(3,TONL), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twlti",   OPTO(3,TOLT), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tlti",    OPTO(3,TOLT), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twlei",   OPTO(3,TOLE), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tlei",    OPTO(3,TOLE), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twngi",   OPTO(3,TONG), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tngi",    OPTO(3,TONG), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twnei",   OPTO(3,TONE), OPTO_MASK,	PPCCOM,		{ RA, SI } },
+{ "tnei",    OPTO(3,TONE), OPTO_MASK,	PWRCOM,		{ RA, SI } },
+{ "twi",     OP(3),	OP_MASK,	PPCCOM,		{ TO, RA, SI } },
+{ "ti",      OP(3),	OP_MASK,	PWRCOM,		{ TO, RA, SI } },
+
+{ "macchw",	XO(4,172,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchw.",	XO(4,172,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwo",	XO(4,172,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwo.",	XO(4,172,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchws",	XO(4,236,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchws.",	XO(4,236,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwso",	XO(4,236,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwso.",	XO(4,236,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwsu",	XO(4,204,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwsu.",	XO(4,204,0,1), XO_MASK, PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwsuo",	XO(4,204,1,0), XO_MASK, PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwsuo.",	XO(4,204,1,1), XO_MASK, PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwu",	XO(4,140,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwu.",	XO(4,140,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwuo",	XO(4,140,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "macchwuo.",	XO(4,140,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhw",	XO(4,44,0,0),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhw.",	XO(4,44,0,1),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwo",	XO(4,44,1,0),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwo.",	XO(4,44,1,1),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhws",	XO(4,108,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhws.",	XO(4,108,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwso",	XO(4,108,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwso.",	XO(4,108,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwsu",	XO(4,76,0,0),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwsu.",	XO(4,76,0,1),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwsuo",	XO(4,76,1,0),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwsuo.",	XO(4,76,1,1),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwu",	XO(4,12,0,0),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwu.",	XO(4,12,0,1),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwuo",	XO(4,12,1,0),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "machhwuo.",	XO(4,12,1,1),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhw",	XO(4,428,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhw.",	XO(4,428,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwo",	XO(4,428,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwo.",	XO(4,428,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhws",	XO(4,492,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhws.",	XO(4,492,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwso",	XO(4,492,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwso.",	XO(4,492,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwsu",	XO(4,460,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwsu.",	XO(4,460,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwsuo",	XO(4,460,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwsuo.",	XO(4,460,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwu",	XO(4,396,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwu.",	XO(4,396,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwuo",	XO(4,396,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "maclhwuo.",	XO(4,396,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mulchw",	XRC(4,168,0),  X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mulchw.",	XRC(4,168,1),  X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mulchwu",	XRC(4,136,0),  X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mulchwu.",	XRC(4,136,1),  X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mulhhw",	XRC(4,40,0),   X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mulhhw.",	XRC(4,40,1),   X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mulhhwu",	XRC(4,8,0),    X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mulhhwu.",	XRC(4,8,1),    X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mullhw",	XRC(4,424,0),  X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mullhw.",	XRC(4,424,1),  X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mullhwu",	XRC(4,392,0),  X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mullhwu.",	XRC(4,392,1),  X_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmacchw",	XO(4,174,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmacchw.",	XO(4,174,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmacchwo",	XO(4,174,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmacchwo.",	XO(4,174,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmacchws",	XO(4,238,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmacchws.",	XO(4,238,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmacchwso",	XO(4,238,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmacchwso.",	XO(4,238,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmachhw",	XO(4,46,0,0),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmachhw.",	XO(4,46,0,1),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmachhwo",	XO(4,46,1,0),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmachhwo.",	XO(4,46,1,1),  XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmachhws",	XO(4,110,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmachhws.",	XO(4,110,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmachhwso",	XO(4,110,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmachhwso.",	XO(4,110,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmaclhw",	XO(4,430,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmaclhw.",	XO(4,430,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmaclhwo",	XO(4,430,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmaclhwo.",	XO(4,430,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmaclhws",	XO(4,494,0,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmaclhws.",	XO(4,494,0,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmaclhwso",	XO(4,494,1,0), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "nmaclhwso.",	XO(4,494,1,1), XO_MASK,	PPC405|PPC440,	{ RT, RA, RB } },
+{ "mfvscr",  VX(4, 1540), VX_MASK,	PPCVEC,		{ VD } },
+{ "mtvscr",  VX(4, 1604), VX_MASK,	PPCVEC,		{ VB } },
+{ "vaddcuw", VX(4,  384), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vaddfp",  VX(4,   10), VX_MASK, 	PPCVEC,		{ VD, VA, VB } },
+{ "vaddsbs", VX(4,  768), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vaddshs", VX(4,  832), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vaddsws", VX(4,  896), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vaddubm", VX(4,    0), VX_MASK, 	PPCVEC,		{ VD, VA, VB } },
+{ "vaddubs", VX(4,  512), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vadduhm", VX(4,   64), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vadduhs", VX(4,  576), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vadduwm", VX(4,  128), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vadduws", VX(4,  640), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vand",    VX(4, 1028), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vandc",   VX(4, 1092), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vavgsb",  VX(4, 1282), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vavgsh",  VX(4, 1346), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vavgsw",  VX(4, 1410), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vavgub",  VX(4, 1026), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vavguh",  VX(4, 1090), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vavguw",  VX(4, 1154), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vcfsx",   VX(4,  842), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
+{ "vcfux",   VX(4,  778), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
+{ "vcmpbfp",   VXR(4, 966, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpbfp.",  VXR(4, 966, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpeqfp",  VXR(4, 198, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpeqfp.", VXR(4, 198, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpequb",  VXR(4,   6, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpequb.", VXR(4,   6, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpequh",  VXR(4,  70, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpequh.", VXR(4,  70, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpequw",  VXR(4, 134, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpequw.", VXR(4, 134, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgefp",  VXR(4, 454, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgefp.", VXR(4, 454, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtfp",  VXR(4, 710, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtfp.", VXR(4, 710, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtsb",  VXR(4, 774, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtsb.", VXR(4, 774, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtsh",  VXR(4, 838, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtsh.", VXR(4, 838, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtsw",  VXR(4, 902, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtsw.", VXR(4, 902, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtub",  VXR(4, 518, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtub.", VXR(4, 518, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtuh",  VXR(4, 582, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtuh.", VXR(4, 582, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtuw",  VXR(4, 646, 0), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vcmpgtuw.", VXR(4, 646, 1), VXR_MASK, PPCVEC,	{ VD, VA, VB } },
+{ "vctsxs",    VX(4,  970), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
+{ "vctuxs",    VX(4,  906), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
+{ "vexptefp",  VX(4,  394), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vlogefp",   VX(4,  458), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vmaddfp",   VXA(4,  46), VXA_MASK,	PPCVEC,		{ VD, VA, VC, VB } },
+{ "vmaxfp",    VX(4, 1034), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmaxsb",    VX(4,  258), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmaxsh",    VX(4,  322), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmaxsw",    VX(4,  386), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmaxub",    VX(4,    2), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmaxuh",    VX(4,   66), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmaxuw",    VX(4,  130), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmhaddshs", VXA(4,  32), VXA_MASK,	PPCVEC,		{ VD, VA, VB, VC } },
+{ "vmhraddshs", VXA(4, 33), VXA_MASK,	PPCVEC,		{ VD, VA, VB, VC } },
+{ "vminfp",    VX(4, 1098), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vminsb",    VX(4,  770), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vminsh",    VX(4,  834), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vminsw",    VX(4,  898), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vminub",    VX(4,  514), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vminuh",    VX(4,  578), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vminuw",    VX(4,  642), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmladduhm", VXA(4,  34), VXA_MASK,	PPCVEC,		{ VD, VA, VB, VC } },
+{ "vmrghb",    VX(4,   12), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmrghh",    VX(4,   76), VX_MASK,    PPCVEC,		{ VD, VA, VB } },
+{ "vmrghw",    VX(4,  140), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmrglb",    VX(4,  268), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmrglh",    VX(4,  332), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmrglw",    VX(4,  396), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmsummbm",  VXA(4,  37), VXA_MASK,	PPCVEC,		{ VD, VA, VB, VC } },
+{ "vmsumshm",  VXA(4,  40), VXA_MASK,	PPCVEC,		{ VD, VA, VB, VC } },
+{ "vmsumshs",  VXA(4,  41), VXA_MASK,	PPCVEC,		{ VD, VA, VB, VC } },
+{ "vmsumubm",  VXA(4,  36), VXA_MASK,   PPCVEC,		{ VD, VA, VB, VC } },
+{ "vmsumuhm",  VXA(4,  38), VXA_MASK,   PPCVEC,		{ VD, VA, VB, VC } },
+{ "vmsumuhs",  VXA(4,  39), VXA_MASK,   PPCVEC,		{ VD, VA, VB, VC } },
+{ "vmulesb",   VX(4,  776), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmulesh",   VX(4,  840), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmuleub",   VX(4,  520), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmuleuh",   VX(4,  584), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmulosb",   VX(4,  264), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmulosh",   VX(4,  328), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmuloub",   VX(4,    8), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vmulouh",   VX(4,   72), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vnmsubfp",  VXA(4,  47), VXA_MASK,	PPCVEC,		{ VD, VA, VC, VB } },
+{ "vnor",      VX(4, 1284), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vor",       VX(4, 1156), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vperm",     VXA(4,  43), VXA_MASK,	PPCVEC,		{ VD, VA, VB, VC } },
+{ "vpkpx",     VX(4,  782), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vpkshss",   VX(4,  398), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vpkshus",   VX(4,  270), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vpkswss",   VX(4,  462), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vpkswus",   VX(4,  334), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vpkuhum",   VX(4,   14), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vpkuhus",   VX(4,  142), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vpkuwum",   VX(4,   78), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vpkuwus",   VX(4,  206), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vrefp",     VX(4,  266), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vrfim",     VX(4,  714), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vrfin",     VX(4,  522), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vrfip",     VX(4,  650), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vrfiz",     VX(4,  586), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vrlb",      VX(4,    4), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vrlh",      VX(4,   68), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vrlw",      VX(4,  132), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vrsqrtefp", VX(4,  330), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vsel",      VXA(4,  42), VXA_MASK,	PPCVEC,		{ VD, VA, VB, VC } },
+{ "vsl",       VX(4,  452), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vslb",      VX(4,  260), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsldoi",    VXA(4,  44), VXA_MASK,	PPCVEC,		{ VD, VA, VB, SHB } },
+{ "vslh",      VX(4,  324), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vslo",      VX(4, 1036), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vslw",      VX(4,  388), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vspltb",    VX(4,  524), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
+{ "vsplth",    VX(4,  588), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
+{ "vspltisb",  VX(4,  780), VX_MASK,	PPCVEC,		{ VD, SIMM } },
+{ "vspltish",  VX(4,  844), VX_MASK,	PPCVEC,		{ VD, SIMM } },
+{ "vspltisw",  VX(4,  908), VX_MASK,	PPCVEC,		{ VD, SIMM } },
+{ "vspltw",    VX(4,  652), VX_MASK,	PPCVEC,		{ VD, VB, UIMM } },
+{ "vsr",       VX(4,  708), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsrab",     VX(4,  772), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsrah",     VX(4,  836), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsraw",     VX(4,  900), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsrb",      VX(4,  516), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsrh",      VX(4,  580), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsro",      VX(4, 1100), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsrw",      VX(4,  644), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubcuw",   VX(4, 1408), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubfp",    VX(4,   74), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubsbs",   VX(4, 1792), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubshs",   VX(4, 1856), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubsws",   VX(4, 1920), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsububm",   VX(4, 1024), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsububs",   VX(4, 1536), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubuhm",   VX(4, 1088), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubuhs",   VX(4, 1600), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubuwm",   VX(4, 1152), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsubuws",   VX(4, 1664), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsumsws",   VX(4, 1928), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsum2sws",  VX(4, 1672), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsum4sbs",  VX(4, 1800), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsum4shs",  VX(4, 1608), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vsum4ubs",  VX(4, 1544), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+{ "vupkhpx",   VX(4,  846), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vupkhsb",   VX(4,  526), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vupkhsh",   VX(4,  590), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vupklpx",   VX(4,  974), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vupklsb",   VX(4,  654), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vupklsh",   VX(4,  718), VX_MASK,	PPCVEC,		{ VD, VB } },
+{ "vxor",      VX(4, 1220), VX_MASK,	PPCVEC,		{ VD, VA, VB } },
+
+{ "evaddw",    VX(4, 512), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evaddiw",   VX(4, 514), VX_MASK,	PPCSPE,		{ RS, RB, UIMM } },
+{ "evsubfw",   VX(4, 516), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evsubw",    VX(4, 516), VX_MASK,	PPCSPE,		{ RS, RB, RA } },
+{ "evsubifw",  VX(4, 518), VX_MASK,	PPCSPE,		{ RS, UIMM, RB } },
+{ "evsubiw",   VX(4, 518), VX_MASK,	PPCSPE,		{ RS, RB, UIMM } },
+{ "evabs",     VX(4, 520), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evneg",     VX(4, 521), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evextsb",   VX(4, 522), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evextsh",   VX(4, 523), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evrndw",    VX(4, 524), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evcntlzw",  VX(4, 525), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evcntlsw",  VX(4, 526), VX_MASK,	PPCSPE,		{ RS, RA } },
+
+{ "brinc",     VX(4, 527), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evand",     VX(4, 529), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evandc",    VX(4, 530), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmr",      VX(4, 535), VX_MASK,	PPCSPE,		{ RS, RA, BBA } },
+{ "evor",      VX(4, 535), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evorc",     VX(4, 539), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evxor",     VX(4, 534), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "eveqv",     VX(4, 537), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evnand",    VX(4, 542), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evnot",     VX(4, 536), VX_MASK,	PPCSPE,		{ RS, RA, BBA } },
+{ "evnor",     VX(4, 536), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evrlw",     VX(4, 552), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evrlwi",    VX(4, 554), VX_MASK,	PPCSPE,		{ RS, RA, EVUIMM } },
+{ "evslw",     VX(4, 548), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evslwi",    VX(4, 550), VX_MASK,	PPCSPE,		{ RS, RA, EVUIMM } },
+{ "evsrws",    VX(4, 545), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evsrwu",    VX(4, 544), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evsrwis",   VX(4, 547), VX_MASK,	PPCSPE,		{ RS, RA, EVUIMM } },
+{ "evsrwiu",   VX(4, 546), VX_MASK,	PPCSPE,		{ RS, RA, EVUIMM } },
+{ "evsplati",  VX(4, 553), VX_MASK,	PPCSPE,		{ RS, SIMM } },
+{ "evsplatfi", VX(4, 555), VX_MASK,	PPCSPE,		{ RS, SIMM } },
+{ "evmergehi", VX(4, 556), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmergelo", VX(4, 557), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmergehilo",VX(4,558), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmergelohi",VX(4,559), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evcmpgts",  VX(4, 561), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evcmpgtu",  VX(4, 560), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evcmplts",  VX(4, 563), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evcmpltu",  VX(4, 562), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evcmpeq",   VX(4, 564), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evsel",     EVSEL(4,79),EVSEL_MASK,	PPCSPE,		{ RS, RA, RB, CRFS } },
+
+{ "evldd",     VX(4, 769), VX_MASK,	PPCSPE,		{ RS, EVUIMM_8, RA } },
+{ "evlddx",    VX(4, 768), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evldw",     VX(4, 771), VX_MASK,	PPCSPE,		{ RS, EVUIMM_8, RA } },
+{ "evldwx",    VX(4, 770), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evldh",     VX(4, 773), VX_MASK,	PPCSPE,		{ RS, EVUIMM_8, RA } },
+{ "evldhx",    VX(4, 772), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evlwhe",    VX(4, 785), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evlwhex",   VX(4, 784), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evlwhou",   VX(4, 789), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evlwhoux",  VX(4, 788), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evlwhos",   VX(4, 791), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evlwhosx",  VX(4, 790), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evlwwsplat",VX(4, 793), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evlwwsplatx",VX(4, 792), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evlwhsplat",VX(4, 797), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evlwhsplatx",VX(4, 796), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evlhhesplat",VX(4, 777), VX_MASK,	PPCSPE,		{ RS, EVUIMM_2, RA } },
+{ "evlhhesplatx",VX(4, 776), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evlhhousplat",VX(4, 781), VX_MASK,	PPCSPE,		{ RS, EVUIMM_2, RA } },
+{ "evlhhousplatx",VX(4, 780), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evlhhossplat",VX(4, 783), VX_MASK,	PPCSPE,		{ RS, EVUIMM_2, RA } },
+{ "evlhhossplatx",VX(4, 782), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evstdd",    VX(4, 801), VX_MASK,	PPCSPE,		{ RS, EVUIMM_8, RA } },
+{ "evstddx",   VX(4, 800), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evstdw",    VX(4, 803), VX_MASK,	PPCSPE,		{ RS, EVUIMM_8, RA } },
+{ "evstdwx",   VX(4, 802), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evstdh",    VX(4, 805), VX_MASK,	PPCSPE,		{ RS, EVUIMM_8, RA } },
+{ "evstdhx",   VX(4, 804), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evstwwe",   VX(4, 825), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evstwwex",  VX(4, 824), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evstwwo",   VX(4, 829), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evstwwox",  VX(4, 828), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evstwhe",   VX(4, 817), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evstwhex",  VX(4, 816), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evstwho",   VX(4, 821), VX_MASK,	PPCSPE,		{ RS, EVUIMM_4, RA } },
+{ "evstwhox",  VX(4, 820), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evfsabs",   VX(4, 644), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evfsnabs",  VX(4, 645), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evfsneg",   VX(4, 646), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evfsadd",   VX(4, 640), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evfssub",   VX(4, 641), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evfsmul",   VX(4, 648), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evfsdiv",   VX(4, 649), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evfscmpgt", VX(4, 652), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evfscmplt", VX(4, 653), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evfscmpeq", VX(4, 654), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evfststgt", VX(4, 668), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evfststlt", VX(4, 669), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evfststeq", VX(4, 670), VX_MASK,	PPCSPE,		{ CRFD, RA, RB } },
+{ "evfscfui",  VX(4, 656), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfsctuiz", VX(4, 664), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfscfsi",  VX(4, 657), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfscfuf",  VX(4, 658), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfscfsf",  VX(4, 659), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfsctui",  VX(4, 660), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfsctsi",  VX(4, 661), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfsctsiz", VX(4, 666), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfsctuf",  VX(4, 662), VX_MASK,	PPCSPE,		{ RS, RB } },
+{ "evfsctsf",  VX(4, 663), VX_MASK,	PPCSPE,		{ RS, RB } },
+
+{ "efsabs",   VX(4, 708), VX_MASK,	PPCEFS,		{ RS, RA } },
+{ "efsnabs",  VX(4, 709), VX_MASK,	PPCEFS,		{ RS, RA } },
+{ "efsneg",   VX(4, 710), VX_MASK,	PPCEFS,		{ RS, RA } },
+{ "efsadd",   VX(4, 704), VX_MASK,	PPCEFS,		{ RS, RA, RB } },
+{ "efssub",   VX(4, 705), VX_MASK,	PPCEFS,		{ RS, RA, RB } },
+{ "efsmul",   VX(4, 712), VX_MASK,	PPCEFS,		{ RS, RA, RB } },
+{ "efsdiv",   VX(4, 713), VX_MASK,	PPCEFS,		{ RS, RA, RB } },
+{ "efscmpgt", VX(4, 716), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
+{ "efscmplt", VX(4, 717), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
+{ "efscmpeq", VX(4, 718), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
+{ "efststgt", VX(4, 732), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
+{ "efststlt", VX(4, 733), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
+{ "efststeq", VX(4, 734), VX_MASK,	PPCEFS,		{ CRFD, RA, RB } },
+{ "efscfui",  VX(4, 720), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efsctuiz", VX(4, 728), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efscfsi",  VX(4, 721), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efscfuf",  VX(4, 722), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efscfsf",  VX(4, 723), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efsctui",  VX(4, 724), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efsctsi",  VX(4, 725), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efsctsiz", VX(4, 730), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efsctuf",  VX(4, 726), VX_MASK,	PPCEFS,		{ RS, RB } },
+{ "efsctsf",  VX(4, 727), VX_MASK,	PPCEFS,		{ RS, RB } },
+
+{ "evmhossf",  VX(4, 1031), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhossfa", VX(4, 1063), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhosmf",  VX(4, 1039), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhosmfa", VX(4, 1071), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhosmi",  VX(4, 1037), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhosmia", VX(4, 1069), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhoumi",  VX(4, 1036), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhoumia", VX(4, 1068), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhessf",  VX(4, 1027), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhessfa", VX(4, 1059), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhesmf",  VX(4, 1035), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhesmfa", VX(4, 1067), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhesmi",  VX(4, 1033), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhesmia", VX(4, 1065), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmheumi",  VX(4, 1032), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmheumia", VX(4, 1064), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmhossfaaw",VX(4, 1287), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhossiaaw",VX(4, 1285), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhosmfaaw",VX(4, 1295), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhosmiaaw",VX(4, 1293), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhousiaaw",VX(4, 1284), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhoumiaaw",VX(4, 1292), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhessfaaw",VX(4, 1283), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhessiaaw",VX(4, 1281), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhesmfaaw",VX(4, 1291), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhesmiaaw",VX(4, 1289), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmheusiaaw",VX(4, 1280), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmheumiaaw",VX(4, 1288), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmhossfanw",VX(4, 1415), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhossianw",VX(4, 1413), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhosmfanw",VX(4, 1423), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhosmianw",VX(4, 1421), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhousianw",VX(4, 1412), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhoumianw",VX(4, 1420), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhessfanw",VX(4, 1411), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhessianw",VX(4, 1409), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhesmfanw",VX(4, 1419), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhesmianw",VX(4, 1417), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmheusianw",VX(4, 1408), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmheumianw",VX(4, 1416), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmhogsmfaa",VX(4, 1327), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhogsmiaa",VX(4, 1325), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhogumiaa",VX(4, 1324), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhegsmfaa",VX(4, 1323), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhegsmiaa",VX(4, 1321), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhegumiaa",VX(4, 1320), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmhogsmfan",VX(4, 1455), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhogsmian",VX(4, 1453), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhogumian",VX(4, 1452), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhegsmfan",VX(4, 1451), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhegsmian",VX(4, 1449), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmhegumian",VX(4, 1448), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmwhssf",  VX(4, 1095), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwhssfa", VX(4, 1127), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwhsmf",  VX(4, 1103), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwhsmfa", VX(4, 1135), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwhsmi",  VX(4, 1101), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwhsmia", VX(4, 1133), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwhumi",  VX(4, 1100), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwhumia", VX(4, 1132), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmwlumi",  VX(4, 1096), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwlumia", VX(4, 1128), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmwlssiaaw",VX(4, 1345), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwlsmiaaw",VX(4, 1353), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwlusiaaw",VX(4, 1344), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwlumiaaw",VX(4, 1352), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmwlssianw",VX(4, 1473), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwlsmianw",VX(4, 1481), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwlusianw",VX(4, 1472), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwlumianw",VX(4, 1480), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmwssf",   VX(4, 1107), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwssfa",  VX(4, 1139), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwsmf",   VX(4, 1115), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwsmfa",  VX(4, 1147), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwsmi",   VX(4, 1113), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwsmia",  VX(4, 1145), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwumi",   VX(4, 1112), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwumia",  VX(4, 1144), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmwssfaa", VX(4, 1363), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwsmfaa", VX(4, 1371), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwsmiaa", VX(4, 1369), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwumiaa", VX(4, 1368), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evmwssfan", VX(4, 1491), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwsmfan", VX(4, 1499), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwsmian", VX(4, 1497), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evmwumian", VX(4, 1496), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "evaddssiaaw",VX(4, 1217), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evaddsmiaaw",VX(4, 1225), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evaddusiaaw",VX(4, 1216), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evaddumiaaw",VX(4, 1224), VX_MASK,	PPCSPE,		{ RS, RA } },
+
+{ "evsubfssiaaw",VX(4, 1219), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evsubfsmiaaw",VX(4, 1227), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evsubfusiaaw",VX(4, 1218), VX_MASK,	PPCSPE,		{ RS, RA } },
+{ "evsubfumiaaw",VX(4, 1226), VX_MASK,	PPCSPE,		{ RS, RA } },
+
+{ "evmra",    VX(4, 1220), VX_MASK,	PPCSPE,		{ RS, RA } },
+
+{ "evdivws",  VX(4, 1222), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+{ "evdivwu",  VX(4, 1223), VX_MASK,	PPCSPE,		{ RS, RA, RB } },
+
+{ "mulli",   OP(7),	OP_MASK,	PPCCOM,		{ RT, RA, SI } },
+{ "muli",    OP(7),	OP_MASK,	PWRCOM,		{ RT, RA, SI } },
+
+{ "subfic",  OP(8),	OP_MASK,	PPCCOM,		{ RT, RA, SI } },
+{ "sfi",     OP(8),	OP_MASK,	PWRCOM,		{ RT, RA, SI } },
+
+{ "dozi",    OP(9),	OP_MASK,	M601,		{ RT, RA, SI } },
+
+{ "bce",     B(9,0,0),	B_MASK,		BOOKE64,	{ BO, BI, BD } },
+{ "bcel",    B(9,0,1),	B_MASK,		BOOKE64,	{ BO, BI, BD } },
+{ "bcea",    B(9,1,0),	B_MASK,		BOOKE64,	{ BO, BI, BDA } },
+{ "bcela",   B(9,1,1),	B_MASK,		BOOKE64,	{ BO, BI, BDA } },
 
-{ "dozi",    OP(9),	OP_MASK,	POWER|M601,	{ RT, RA, SI } },
-
-{ "cmplwi",  OPL(10,0),	OPL_MASK,	PPC,		{ OBF, RA, UI } },
-{ "cmpldi",  OPL(10,1), OPL_MASK,	PPC|B64,	{ OBF, RA, UI } },
+{ "cmplwi",  OPL(10,0),	OPL_MASK,	PPCCOM,		{ OBF, RA, UI } },
+{ "cmpldi",  OPL(10,1), OPL_MASK,	PPC64,		{ OBF, RA, UI } },
 { "cmpli",   OP(10),	OP_MASK,	PPC,		{ BF, L, RA, UI } },
-{ "cmpli",   OP(10),	OP_MASK,	POWER,		{ BF, RA, UI } },
+{ "cmpli",   OP(10),	OP_MASK,	PWRCOM,		{ BF, RA, UI } },
 
-{ "cmpwi",   OPL(11,0),	OPL_MASK,	PPC,		{ OBF, RA, SI } },
-{ "cmpdi",   OPL(11,1),	OPL_MASK,	PPC|B64,	{ OBF, RA, SI } },
+{ "cmpwi",   OPL(11,0),	OPL_MASK,	PPCCOM,		{ OBF, RA, SI } },
+{ "cmpdi",   OPL(11,1),	OPL_MASK,	PPC64,		{ OBF, RA, SI } },
 { "cmpi",    OP(11),	OP_MASK,	PPC,		{ BF, L, RA, SI } },
-{ "cmpi",    OP(11),	OP_MASK,	POWER,		{ BF, RA, SI } },
+{ "cmpi",    OP(11),	OP_MASK,	PWRCOM,		{ BF, RA, SI } },
 
-{ "addic",   OP(12),	OP_MASK,	PPC,		{ RT, RA, SI } },
-{ "ai",	     OP(12),	OP_MASK,	POWER,		{ RT, RA, SI } },
-{ "subic",   OP(12),	OP_MASK,	PPC,		{ RT, RA, NSI } },
-
-{ "addic.",  OP(13),	OP_MASK,	PPC,		{ RT, RA, SI } },
-{ "ai.",     OP(13),	OP_MASK,	POWER,		{ RT, RA, SI } },
-{ "subic.",  OP(13),	OP_MASK,	PPC,		{ RT, RA, NSI } },
-
-{ "li",	     OP(14),	DRA_MASK,	PPC,		{ RT, SI } },
-{ "lil",     OP(14),	DRA_MASK,	POWER,		{ RT, SI } },
-{ "addi",    OP(14),	OP_MASK,	PPC,		{ RT, RA, SI } },
-{ "cal",     OP(14),	OP_MASK,	POWER,		{ RT, D, RA } },
-{ "subi",    OP(14),	OP_MASK,	PPC,		{ RT, RA, NSI } },
-{ "la",	     OP(14),	OP_MASK,	PPC,		{ RT, D, RA } },
-
-{ "lis",     OP(15),	DRA_MASK,	PPC,		{ RT, SISIGNOPT } },
-{ "liu",     OP(15),	DRA_MASK,	POWER,		{ RT, SISIGNOPT } },
-{ "addis",   OP(15),	OP_MASK,	PPC,		{ RT,RA,SISIGNOPT } },
-{ "cau",     OP(15),	OP_MASK,	POWER,		{ RT,RA,SISIGNOPT } },
-{ "subis",   OP(15),	OP_MASK,	PPC,		{ RT, RA, NSI } },
-
-{ "bdnz-",   BBO(16,BODNZ,0,0), BBOYBI_MASK, PPC,	{ BDM } },
-{ "bdnz+",   BBO(16,BODNZ,0,0), BBOYBI_MASK, PPC,	{ BDP } },
-{ "bdnz",    BBO(16,BODNZ,0,0), BBOYBI_MASK, PPC,	{ BD } },
-{ "bdn",     BBO(16,BODNZ,0,0), BBOYBI_MASK, POWER,	{ BD } },
-{ "bdnzl-",  BBO(16,BODNZ,0,1), BBOYBI_MASK, PPC,	{ BDM } },
-{ "bdnzl+",  BBO(16,BODNZ,0,1), BBOYBI_MASK, PPC,	{ BDP } },
-{ "bdnzl",   BBO(16,BODNZ,0,1), BBOYBI_MASK, PPC,	{ BD } },
-{ "bdnl",    BBO(16,BODNZ,0,1), BBOYBI_MASK, POWER,	{ BD } },
-{ "bdnza-",  BBO(16,BODNZ,1,0), BBOYBI_MASK, PPC,	{ BDMA } },
-{ "bdnza+",  BBO(16,BODNZ,1,0), BBOYBI_MASK, PPC,	{ BDPA } },
-{ "bdnza",   BBO(16,BODNZ,1,0), BBOYBI_MASK, PPC,	{ BDA } },
-{ "bdna",    BBO(16,BODNZ,1,0), BBOYBI_MASK, POWER,	{ BDA } },
-{ "bdnzla-", BBO(16,BODNZ,1,1), BBOYBI_MASK, PPC,	{ BDMA } },
-{ "bdnzla+", BBO(16,BODNZ,1,1), BBOYBI_MASK, PPC,	{ BDPA } },
-{ "bdnzla",  BBO(16,BODNZ,1,1), BBOYBI_MASK, PPC,	{ BDA } },
-{ "bdnla",   BBO(16,BODNZ,1,1), BBOYBI_MASK, POWER,	{ BDA } },
-{ "bdz-",    BBO(16,BODZ,0,0), BBOYBI_MASK, PPC,	{ BDM } },
-{ "bdz+",    BBO(16,BODZ,0,0), BBOYBI_MASK, PPC,	{ BDP } },
-{ "bdz",     BBO(16,BODZ,0,0), BBOYBI_MASK, PPC|POWER,	{ BD } },
-{ "bdzl-",   BBO(16,BODZ,0,1), BBOYBI_MASK, PPC,	{ BDM } },
-{ "bdzl+",   BBO(16,BODZ,0,1), BBOYBI_MASK, PPC,	{ BDP } },
-{ "bdzl",    BBO(16,BODZ,0,1), BBOYBI_MASK, PPC|POWER,	{ BD } },
-{ "bdza-",   BBO(16,BODZ,1,0), BBOYBI_MASK, PPC,	{ BDMA } },
-{ "bdza+",   BBO(16,BODZ,1,0), BBOYBI_MASK, PPC,	{ BDPA } },
-{ "bdza",    BBO(16,BODZ,1,0), BBOYBI_MASK, PPC|POWER,	{ BDA } },
-{ "bdzla-",  BBO(16,BODZ,1,1), BBOYBI_MASK, PPC,	{ BDMA } },
-{ "bdzla+",  BBO(16,BODZ,1,1), BBOYBI_MASK, PPC,	{ BDPA } },
-{ "bdzla",   BBO(16,BODZ,1,1), BBOYBI_MASK, PPC|POWER,	{ BDA } },
-{ "blt-",    BBOCB(16,BOT,CBLT,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "blt+",    BBOCB(16,BOT,CBLT,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "blt",     BBOCB(16,BOT,CBLT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bltl-",   BBOCB(16,BOT,CBLT,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bltl+",   BBOCB(16,BOT,CBLT,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bltl",    BBOCB(16,BOT,CBLT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "blta-",   BBOCB(16,BOT,CBLT,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "blta+",   BBOCB(16,BOT,CBLT,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "blta",    BBOCB(16,BOT,CBLT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bltla-",  BBOCB(16,BOT,CBLT,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bltla+",  BBOCB(16,BOT,CBLT,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bltla",   BBOCB(16,BOT,CBLT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bgt-",    BBOCB(16,BOT,CBGT,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bgt+",    BBOCB(16,BOT,CBGT,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bgt",     BBOCB(16,BOT,CBGT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bgtl-",   BBOCB(16,BOT,CBGT,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bgtl+",   BBOCB(16,BOT,CBGT,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bgtl",    BBOCB(16,BOT,CBGT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bgta-",   BBOCB(16,BOT,CBGT,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bgta+",   BBOCB(16,BOT,CBGT,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bgta",    BBOCB(16,BOT,CBGT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bgtla-",  BBOCB(16,BOT,CBGT,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bgtla+",  BBOCB(16,BOT,CBGT,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bgtla",   BBOCB(16,BOT,CBGT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "beq-",    BBOCB(16,BOT,CBEQ,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "beq+",    BBOCB(16,BOT,CBEQ,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "beq",     BBOCB(16,BOT,CBEQ,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "beql-",   BBOCB(16,BOT,CBEQ,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "beql+",   BBOCB(16,BOT,CBEQ,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "beql",    BBOCB(16,BOT,CBEQ,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "beqa-",   BBOCB(16,BOT,CBEQ,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "beqa+",   BBOCB(16,BOT,CBEQ,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "beqa",    BBOCB(16,BOT,CBEQ,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "beqla-",  BBOCB(16,BOT,CBEQ,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "beqla+",  BBOCB(16,BOT,CBEQ,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "beqla",   BBOCB(16,BOT,CBEQ,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bso-",    BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bso+",    BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bso",     BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bsol-",   BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bsol+",   BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bsol",    BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bsoa-",   BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bsoa+",   BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bsoa",    BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bsola-",  BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bsola+",  BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bsola",   BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bun-",    BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bun+",    BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bun",     BBOCB(16,BOT,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BD } },
-{ "bunl-",   BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bunl+",   BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bunl",    BBOCB(16,BOT,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BD } },
-{ "buna-",   BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "buna+",   BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "buna",    BBOCB(16,BOT,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDA } },
-{ "bunla-",  BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bunla+",  BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bunla",   BBOCB(16,BOT,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDA } },
-{ "bge-",    BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bge+",    BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bge",     BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bgel-",   BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bgel+",   BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bgel",    BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bgea-",   BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bgea+",   BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bgea",    BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bgela-",  BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bgela+",  BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bgela",   BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bnl-",    BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bnl+",    BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bnl",     BBOCB(16,BOF,CBLT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bnll-",   BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bnll+",   BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bnll",    BBOCB(16,BOF,CBLT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bnla-",   BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnla+",   BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnla",    BBOCB(16,BOF,CBLT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bnlla-",  BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnlla+",  BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnlla",   BBOCB(16,BOF,CBLT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "ble-",    BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "ble+",    BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "ble",     BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "blel-",   BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "blel+",   BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "blel",    BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "blea-",   BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "blea+",   BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "blea",    BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "blela-",  BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "blela+",  BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "blela",   BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bng-",    BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bng+",    BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bng",     BBOCB(16,BOF,CBGT,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bngl-",   BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bngl+",   BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bngl",    BBOCB(16,BOF,CBGT,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bnga-",   BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnga+",   BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnga",    BBOCB(16,BOF,CBGT,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bngla-",  BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bngla+",  BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bngla",   BBOCB(16,BOF,CBGT,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bne-",    BBOCB(16,BOF,CBEQ,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bne+",    BBOCB(16,BOF,CBEQ,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bne",     BBOCB(16,BOF,CBEQ,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bnel-",   BBOCB(16,BOF,CBEQ,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bnel+",   BBOCB(16,BOF,CBEQ,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bnel",    BBOCB(16,BOF,CBEQ,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bnea-",   BBOCB(16,BOF,CBEQ,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnea+",   BBOCB(16,BOF,CBEQ,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnea",    BBOCB(16,BOF,CBEQ,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bnela-",  BBOCB(16,BOF,CBEQ,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnela+",  BBOCB(16,BOF,CBEQ,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnela",   BBOCB(16,BOF,CBEQ,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bns-",    BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bns+",    BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bns",     BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bnsl-",   BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bnsl+",   BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bnsl",    BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC|POWER, { CR, BD } },
-{ "bnsa-",   BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnsa+",   BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnsa",    BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bnsla-",  BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnsla+",  BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnsla",   BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC|POWER, { CR, BDA } },
-{ "bnu-",    BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bnu+",    BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bnu",     BBOCB(16,BOF,CBSO,0,0), BBOYCB_MASK, PPC,	{ CR, BD } },
-{ "bnul-",   BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BDM } },
-{ "bnul+",   BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BDP } },
-{ "bnul",    BBOCB(16,BOF,CBSO,0,1), BBOYCB_MASK, PPC,	{ CR, BD } },
-{ "bnua-",   BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnua+",   BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnua",    BBOCB(16,BOF,CBSO,1,0), BBOYCB_MASK, PPC,	{ CR, BDA } },
-{ "bnula-",  BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDMA } },
-{ "bnula+",  BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDPA } },
-{ "bnula",   BBOCB(16,BOF,CBSO,1,1), BBOYCB_MASK, PPC,	{ CR, BDA } },
-{ "bdnzt-",  BBO(16,BODNZT,0,0), BBOY_MASK, PPC,	{ BI, BDM } },
-{ "bdnzt+",  BBO(16,BODNZT,0,0), BBOY_MASK, PPC,	{ BI, BDP } },
-{ "bdnzt",   BBO(16,BODNZT,0,0), BBOY_MASK, PPC,	{ BI, BD } },
-{ "bdnztl-", BBO(16,BODNZT,0,1), BBOY_MASK, PPC,	{ BI, BDM } },
-{ "bdnztl+", BBO(16,BODNZT,0,1), BBOY_MASK, PPC,	{ BI, BDP } },
-{ "bdnztl",  BBO(16,BODNZT,0,1), BBOY_MASK, PPC,	{ BI, BD } },
-{ "bdnzta-", BBO(16,BODNZT,1,0), BBOY_MASK, PPC,	{ BI, BDMA } },
-{ "bdnzta+", BBO(16,BODNZT,1,0), BBOY_MASK, PPC,	{ BI, BDPA } },
-{ "bdnzta",  BBO(16,BODNZT,1,0), BBOY_MASK, PPC,	{ BI, BDA } },
-{ "bdnztla-",BBO(16,BODNZT,1,1), BBOY_MASK, PPC,	{ BI, BDMA } },
-{ "bdnztla+",BBO(16,BODNZT,1,1), BBOY_MASK, PPC,	{ BI, BDPA } },
-{ "bdnztla", BBO(16,BODNZT,1,1), BBOY_MASK, PPC,	{ BI, BDA } },
-{ "bdnzf-",  BBO(16,BODNZF,0,0), BBOY_MASK, PPC,	{ BI, BDM } },
-{ "bdnzf+",  BBO(16,BODNZF,0,0), BBOY_MASK, PPC,	{ BI, BDP } },
-{ "bdnzf",   BBO(16,BODNZF,0,0), BBOY_MASK, PPC,	{ BI, BD } },
-{ "bdnzfl-", BBO(16,BODNZF,0,1), BBOY_MASK, PPC,	{ BI, BDM } },
-{ "bdnzfl+", BBO(16,BODNZF,0,1), BBOY_MASK, PPC,	{ BI, BDP } },
-{ "bdnzfl",  BBO(16,BODNZF,0,1), BBOY_MASK, PPC,	{ BI, BD } },
-{ "bdnzfa-", BBO(16,BODNZF,1,0), BBOY_MASK, PPC,	{ BI, BDMA } },
-{ "bdnzfa+", BBO(16,BODNZF,1,0), BBOY_MASK, PPC,	{ BI, BDPA } },
-{ "bdnzfa",  BBO(16,BODNZF,1,0), BBOY_MASK, PPC,	{ BI, BDA } },
-{ "bdnzfla-",BBO(16,BODNZF,1,1), BBOY_MASK, PPC,	{ BI, BDMA } },
-{ "bdnzfla+",BBO(16,BODNZF,1,1), BBOY_MASK, PPC,	{ BI, BDPA } },
-{ "bdnzfla", BBO(16,BODNZF,1,1), BBOY_MASK, PPC,	{ BI, BDA } },
-{ "bt-",     BBO(16,BOT,0,0), BBOY_MASK, PPC,		{ BI, BDM } },
-{ "bt+",     BBO(16,BOT,0,0), BBOY_MASK, PPC,		{ BI, BDP } },
-{ "bt",	     BBO(16,BOT,0,0), BBOY_MASK, PPC,		{ BI, BD } },
-{ "bbt",     BBO(16,BOT,0,0), BBOY_MASK, POWER,		{ BI, BD } },
-{ "btl-",    BBO(16,BOT,0,1), BBOY_MASK, PPC,		{ BI, BDM } },
-{ "btl+",    BBO(16,BOT,0,1), BBOY_MASK, PPC,		{ BI, BDP } },
-{ "btl",     BBO(16,BOT,0,1), BBOY_MASK, PPC,		{ BI, BD } },
-{ "bbtl",    BBO(16,BOT,0,1), BBOY_MASK, POWER,		{ BI, BD } },
-{ "bta-",    BBO(16,BOT,1,0), BBOY_MASK, PPC,		{ BI, BDMA } },
-{ "bta+",    BBO(16,BOT,1,0), BBOY_MASK, PPC,		{ BI, BDPA } },
-{ "bta",     BBO(16,BOT,1,0), BBOY_MASK, PPC,		{ BI, BDA } },
-{ "bbta",    BBO(16,BOT,1,0), BBOY_MASK, POWER,		{ BI, BDA } },
-{ "btla-",   BBO(16,BOT,1,1), BBOY_MASK, PPC,		{ BI, BDMA } },
-{ "btla+",   BBO(16,BOT,1,1), BBOY_MASK, PPC,		{ BI, BDPA } },
-{ "btla",    BBO(16,BOT,1,1), BBOY_MASK, PPC,		{ BI, BDA } },
-{ "bbtla",   BBO(16,BOT,1,1), BBOY_MASK, POWER,		{ BI, BDA } },
-{ "bf-",     BBO(16,BOF,0,0), BBOY_MASK, PPC,		{ BI, BDM } },
-{ "bf+",     BBO(16,BOF,0,0), BBOY_MASK, PPC,		{ BI, BDP } },
-{ "bf",	     BBO(16,BOF,0,0), BBOY_MASK, PPC,		{ BI, BD } },
-{ "bbf",     BBO(16,BOF,0,0), BBOY_MASK, POWER,		{ BI, BD } },
-{ "bfl-",    BBO(16,BOF,0,1), BBOY_MASK, PPC,		{ BI, BDM } },
-{ "bfl+",    BBO(16,BOF,0,1), BBOY_MASK, PPC,		{ BI, BDP } },
-{ "bfl",     BBO(16,BOF,0,1), BBOY_MASK, PPC,		{ BI, BD } },
-{ "bbfl",    BBO(16,BOF,0,1), BBOY_MASK, POWER,		{ BI, BD } },
-{ "bfa-",    BBO(16,BOF,1,0), BBOY_MASK, PPC,		{ BI, BDMA } },
-{ "bfa+",    BBO(16,BOF,1,0), BBOY_MASK, PPC,		{ BI, BDPA } },
-{ "bfa",     BBO(16,BOF,1,0), BBOY_MASK, PPC,		{ BI, BDA } },
-{ "bbfa",    BBO(16,BOF,1,0), BBOY_MASK, POWER,		{ BI, BDA } },
-{ "bfla-",   BBO(16,BOF,1,1), BBOY_MASK, PPC,		{ BI, BDMA } },
-{ "bfla+",   BBO(16,BOF,1,1), BBOY_MASK, PPC,		{ BI, BDPA } },
-{ "bfla",    BBO(16,BOF,1,1), BBOY_MASK, PPC,		{ BI, BDA } },
-{ "bbfla",   BBO(16,BOF,1,1), BBOY_MASK, POWER,		{ BI, BDA } },
-{ "bdzt-",   BBO(16,BODZT,0,0), BBOY_MASK, PPC,		{ BI, BDM } },
-{ "bdzt+",   BBO(16,BODZT,0,0), BBOY_MASK, PPC,		{ BI, BDP } },
-{ "bdzt",    BBO(16,BODZT,0,0), BBOY_MASK, PPC,		{ BI, BD } },
-{ "bdztl-",  BBO(16,BODZT,0,1), BBOY_MASK, PPC,		{ BI, BDM } },
-{ "bdztl+",  BBO(16,BODZT,0,1), BBOY_MASK, PPC,		{ BI, BDP } },
-{ "bdztl",   BBO(16,BODZT,0,1), BBOY_MASK, PPC,		{ BI, BD } },
-{ "bdzta-",  BBO(16,BODZT,1,0), BBOY_MASK, PPC,		{ BI, BDMA } },
-{ "bdzta+",  BBO(16,BODZT,1,0), BBOY_MASK, PPC,		{ BI, BDPA } },
-{ "bdzta",   BBO(16,BODZT,1,0), BBOY_MASK, PPC,		{ BI, BDA } },
-{ "bdztla-", BBO(16,BODZT,1,1), BBOY_MASK, PPC,		{ BI, BDMA } },
-{ "bdztla+", BBO(16,BODZT,1,1), BBOY_MASK, PPC,		{ BI, BDPA } },
-{ "bdztla",  BBO(16,BODZT,1,1), BBOY_MASK, PPC,		{ BI, BDA } },
-{ "bdzf-",   BBO(16,BODZF,0,0), BBOY_MASK, PPC,		{ BI, BDM } },
-{ "bdzf+",   BBO(16,BODZF,0,0), BBOY_MASK, PPC,		{ BI, BDP } },
-{ "bdzf",    BBO(16,BODZF,0,0), BBOY_MASK, PPC,		{ BI, BD } },
-{ "bdzfl-",  BBO(16,BODZF,0,1), BBOY_MASK, PPC,		{ BI, BDM } },
-{ "bdzfl+",  BBO(16,BODZF,0,1), BBOY_MASK, PPC,		{ BI, BDP } },
-{ "bdzfl",   BBO(16,BODZF,0,1), BBOY_MASK, PPC,		{ BI, BD } },
-{ "bdzfa-",  BBO(16,BODZF,1,0), BBOY_MASK, PPC,		{ BI, BDMA } },
-{ "bdzfa+",  BBO(16,BODZF,1,0), BBOY_MASK, PPC,		{ BI, BDPA } },
-{ "bdzfa",   BBO(16,BODZF,1,0), BBOY_MASK, PPC,		{ BI, BDA } },
-{ "bdzfla-", BBO(16,BODZF,1,1), BBOY_MASK, PPC,		{ BI, BDMA } },
-{ "bdzfla+", BBO(16,BODZF,1,1), BBOY_MASK, PPC,		{ BI, BDPA } },
-{ "bdzfla",  BBO(16,BODZF,1,1), BBOY_MASK, PPC,		{ BI, BDA } },
-{ "bc-",     B(16,0,0),	B_MASK,		PPC,		{ BOE, BI, BDM } },
-{ "bc+",     B(16,0,0),	B_MASK,		PPC,		{ BOE, BI, BDP } },
-{ "bc",	     B(16,0,0),	B_MASK,		PPC|POWER,	{ BO, BI, BD } },
-{ "bcl-",    B(16,0,1),	B_MASK,		PPC,		{ BOE, BI, BDM } },
-{ "bcl+",    B(16,0,1),	B_MASK,		PPC,		{ BOE, BI, BDP } },
-{ "bcl",     B(16,0,1),	B_MASK,		PPC|POWER,	{ BO, BI, BD } },
-{ "bca-",    B(16,1,0),	B_MASK,		PPC,		{ BOE, BI, BDMA } },
-{ "bca+",    B(16,1,0),	B_MASK,		PPC,		{ BOE, BI, BDPA } },
-{ "bca",     B(16,1,0),	B_MASK,		PPC|POWER,	{ BO, BI, BDA } },
-{ "bcla-",   B(16,1,1),	B_MASK,		PPC,		{ BOE, BI, BDMA } },
-{ "bcla+",   B(16,1,1),	B_MASK,		PPC,		{ BOE, BI, BDPA } },
-{ "bcla",    B(16,1,1),	B_MASK,		PPC|POWER,	{ BO, BI, BDA } },
+{ "addic",   OP(12),	OP_MASK,	PPCCOM,		{ RT, RA, SI } },
+{ "ai",	     OP(12),	OP_MASK,	PWRCOM,		{ RT, RA, SI } },
+{ "subic",   OP(12),	OP_MASK,	PPCCOM,		{ RT, RA, NSI } },
+
+{ "addic.",  OP(13),	OP_MASK,	PPCCOM,		{ RT, RA, SI } },
+{ "ai.",     OP(13),	OP_MASK,	PWRCOM,		{ RT, RA, SI } },
+{ "subic.",  OP(13),	OP_MASK,	PPCCOM,		{ RT, RA, NSI } },
+
+{ "li",	     OP(14),	DRA_MASK,	PPCCOM,		{ RT, SI } },
+{ "lil",     OP(14),	DRA_MASK,	PWRCOM,		{ RT, SI } },
+{ "addi",    OP(14),	OP_MASK,	PPCCOM,		{ RT, RA, SI } },
+{ "cal",     OP(14),	OP_MASK,	PWRCOM,		{ RT, D, RA } },
+{ "subi",    OP(14),	OP_MASK,	PPCCOM,		{ RT, RA, NSI } },
+{ "la",	     OP(14),	OP_MASK,	PPCCOM,		{ RT, D, RA } },
+
+{ "lis",     OP(15),	DRA_MASK,	PPCCOM,		{ RT, SISIGNOPT } },
+{ "liu",     OP(15),	DRA_MASK,	PWRCOM,		{ RT, SISIGNOPT } },
+{ "addis",   OP(15),	OP_MASK,	PPCCOM,		{ RT,RA,SISIGNOPT } },
+{ "cau",     OP(15),	OP_MASK,	PWRCOM,		{ RT,RA,SISIGNOPT } },
+{ "subis",   OP(15),	OP_MASK,	PPCCOM,		{ RT, RA, NSI } },
+
+{ "bdnz-",   BBO(16,BODNZ,0,0),      BBOATBI_MASK, PPCCOM,	{ BDM } },
+{ "bdnz+",   BBO(16,BODNZ,0,0),      BBOATBI_MASK, PPCCOM,	{ BDP } },
+{ "bdnz",    BBO(16,BODNZ,0,0),      BBOATBI_MASK, PPCCOM,	{ BD } },
+{ "bdn",     BBO(16,BODNZ,0,0),      BBOATBI_MASK, PWRCOM,	{ BD } },
+{ "bdnzl-",  BBO(16,BODNZ,0,1),      BBOATBI_MASK, PPCCOM,	{ BDM } },
+{ "bdnzl+",  BBO(16,BODNZ,0,1),      BBOATBI_MASK, PPCCOM,	{ BDP } },
+{ "bdnzl",   BBO(16,BODNZ,0,1),      BBOATBI_MASK, PPCCOM,	{ BD } },
+{ "bdnl",    BBO(16,BODNZ,0,1),      BBOATBI_MASK, PWRCOM,	{ BD } },
+{ "bdnza-",  BBO(16,BODNZ,1,0),      BBOATBI_MASK, PPCCOM,	{ BDMA } },
+{ "bdnza+",  BBO(16,BODNZ,1,0),      BBOATBI_MASK, PPCCOM,	{ BDPA } },
+{ "bdnza",   BBO(16,BODNZ,1,0),      BBOATBI_MASK, PPCCOM,	{ BDA } },
+{ "bdna",    BBO(16,BODNZ,1,0),      BBOATBI_MASK, PWRCOM,	{ BDA } },
+{ "bdnzla-", BBO(16,BODNZ,1,1),      BBOATBI_MASK, PPCCOM,	{ BDMA } },
+{ "bdnzla+", BBO(16,BODNZ,1,1),      BBOATBI_MASK, PPCCOM,	{ BDPA } },
+{ "bdnzla",  BBO(16,BODNZ,1,1),      BBOATBI_MASK, PPCCOM,	{ BDA } },
+{ "bdnla",   BBO(16,BODNZ,1,1),      BBOATBI_MASK, PWRCOM,	{ BDA } },
+{ "bdz-",    BBO(16,BODZ,0,0),       BBOATBI_MASK, PPCCOM,	{ BDM } },
+{ "bdz+",    BBO(16,BODZ,0,0),       BBOATBI_MASK, PPCCOM,	{ BDP } },
+{ "bdz",     BBO(16,BODZ,0,0),       BBOATBI_MASK, COM,		{ BD } },
+{ "bdzl-",   BBO(16,BODZ,0,1),       BBOATBI_MASK, PPCCOM,	{ BDM } },
+{ "bdzl+",   BBO(16,BODZ,0,1),       BBOATBI_MASK, PPCCOM,	{ BDP } },
+{ "bdzl",    BBO(16,BODZ,0,1),       BBOATBI_MASK, COM,		{ BD } },
+{ "bdza-",   BBO(16,BODZ,1,0),       BBOATBI_MASK, PPCCOM,	{ BDMA } },
+{ "bdza+",   BBO(16,BODZ,1,0),       BBOATBI_MASK, PPCCOM,	{ BDPA } },
+{ "bdza",    BBO(16,BODZ,1,0),       BBOATBI_MASK, COM,		{ BDA } },
+{ "bdzla-",  BBO(16,BODZ,1,1),       BBOATBI_MASK, PPCCOM,	{ BDMA } },
+{ "bdzla+",  BBO(16,BODZ,1,1),       BBOATBI_MASK, PPCCOM,	{ BDPA } },
+{ "bdzla",   BBO(16,BODZ,1,1),       BBOATBI_MASK, COM,		{ BDA } },
+{ "blt-",    BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "blt+",    BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "blt",     BBOCB(16,BOT,CBLT,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bltl-",   BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bltl+",   BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bltl",    BBOCB(16,BOT,CBLT,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "blta-",   BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "blta+",   BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "blta",    BBOCB(16,BOT,CBLT,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bltla-",  BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bltla+",  BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bltla",   BBOCB(16,BOT,CBLT,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bgt-",    BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bgt+",    BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bgt",     BBOCB(16,BOT,CBGT,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bgtl-",   BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bgtl+",   BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bgtl",    BBOCB(16,BOT,CBGT,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bgta-",   BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bgta+",   BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bgta",    BBOCB(16,BOT,CBGT,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bgtla-",  BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bgtla+",  BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bgtla",   BBOCB(16,BOT,CBGT,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "beq-",    BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "beq+",    BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "beq",     BBOCB(16,BOT,CBEQ,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "beql-",   BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "beql+",   BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "beql",    BBOCB(16,BOT,CBEQ,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "beqa-",   BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "beqa+",   BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "beqa",    BBOCB(16,BOT,CBEQ,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "beqla-",  BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "beqla+",  BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "beqla",   BBOCB(16,BOT,CBEQ,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bso-",    BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bso+",    BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bso",     BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bsol-",   BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bsol+",   BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bsol",    BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bsoa-",   BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bsoa+",   BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bsoa",    BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bsola-",  BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bsola+",  BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bsola",   BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bun-",    BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bun+",    BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bun",     BBOCB(16,BOT,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BD } },
+{ "bunl-",   BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bunl+",   BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bunl",    BBOCB(16,BOT,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BD } },
+{ "buna-",   BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "buna+",   BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "buna",    BBOCB(16,BOT,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDA } },
+{ "bunla-",  BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bunla+",  BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bunla",   BBOCB(16,BOT,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDA } },
+{ "bge-",    BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bge+",    BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bge",     BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bgel-",   BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bgel+",   BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bgel",    BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bgea-",   BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bgea+",   BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bgea",    BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bgela-",  BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bgela+",  BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bgela",   BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bnl-",    BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bnl+",    BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bnl",     BBOCB(16,BOF,CBLT,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bnll-",   BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bnll+",   BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bnll",    BBOCB(16,BOF,CBLT,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bnla-",   BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnla+",   BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnla",    BBOCB(16,BOF,CBLT,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bnlla-",  BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnlla+",  BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnlla",   BBOCB(16,BOF,CBLT,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "ble-",    BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "ble+",    BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "ble",     BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "blel-",   BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "blel+",   BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "blel",    BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "blea-",   BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "blea+",   BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "blea",    BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "blela-",  BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "blela+",  BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "blela",   BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bng-",    BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bng+",    BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bng",     BBOCB(16,BOF,CBGT,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bngl-",   BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bngl+",   BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bngl",    BBOCB(16,BOF,CBGT,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bnga-",   BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnga+",   BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnga",    BBOCB(16,BOF,CBGT,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bngla-",  BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bngla+",  BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bngla",   BBOCB(16,BOF,CBGT,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bne-",    BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bne+",    BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bne",     BBOCB(16,BOF,CBEQ,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bnel-",   BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bnel+",   BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bnel",    BBOCB(16,BOF,CBEQ,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bnea-",   BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnea+",   BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnea",    BBOCB(16,BOF,CBEQ,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bnela-",  BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnela+",  BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnela",   BBOCB(16,BOF,CBEQ,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bns-",    BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bns+",    BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bns",     BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bnsl-",   BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bnsl+",   BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bnsl",    BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, COM,		{ CR, BD } },
+{ "bnsa-",   BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnsa+",   BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnsa",    BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bnsla-",  BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnsla+",  BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnsla",   BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, COM,		{ CR, BDA } },
+{ "bnu-",    BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bnu+",    BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bnu",     BBOCB(16,BOF,CBSO,0,0), BBOATCB_MASK, PPCCOM,	{ CR, BD } },
+{ "bnul-",   BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDM } },
+{ "bnul+",   BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BDP } },
+{ "bnul",    BBOCB(16,BOF,CBSO,0,1), BBOATCB_MASK, PPCCOM,	{ CR, BD } },
+{ "bnua-",   BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnua+",   BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnua",    BBOCB(16,BOF,CBSO,1,0), BBOATCB_MASK, PPCCOM,	{ CR, BDA } },
+{ "bnula-",  BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDMA } },
+{ "bnula+",  BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDPA } },
+{ "bnula",   BBOCB(16,BOF,CBSO,1,1), BBOATCB_MASK, PPCCOM,	{ CR, BDA } },
+{ "bdnzt-",  BBO(16,BODNZT,0,0), BBOY_MASK, NOPOWER4,	{ BI, BDM } },
+{ "bdnzt+",  BBO(16,BODNZT,0,0), BBOY_MASK, NOPOWER4,	{ BI, BDP } },
+{ "bdnzt",   BBO(16,BODNZT,0,0), BBOY_MASK, PPCCOM,	{ BI, BD } },
+{ "bdnztl-", BBO(16,BODNZT,0,1), BBOY_MASK, NOPOWER4,	{ BI, BDM } },
+{ "bdnztl+", BBO(16,BODNZT,0,1), BBOY_MASK, NOPOWER4,	{ BI, BDP } },
+{ "bdnztl",  BBO(16,BODNZT,0,1), BBOY_MASK, PPCCOM,	{ BI, BD } },
+{ "bdnzta-", BBO(16,BODNZT,1,0), BBOY_MASK, NOPOWER4,	{ BI, BDMA } },
+{ "bdnzta+", BBO(16,BODNZT,1,0), BBOY_MASK, NOPOWER4,	{ BI, BDPA } },
+{ "bdnzta",  BBO(16,BODNZT,1,0), BBOY_MASK, PPCCOM,	{ BI, BDA } },
+{ "bdnztla-",BBO(16,BODNZT,1,1), BBOY_MASK, NOPOWER4,	{ BI, BDMA } },
+{ "bdnztla+",BBO(16,BODNZT,1,1), BBOY_MASK, NOPOWER4,	{ BI, BDPA } },
+{ "bdnztla", BBO(16,BODNZT,1,1), BBOY_MASK, PPCCOM,	{ BI, BDA } },
+{ "bdnzf-",  BBO(16,BODNZF,0,0), BBOY_MASK, NOPOWER4,	{ BI, BDM } },
+{ "bdnzf+",  BBO(16,BODNZF,0,0), BBOY_MASK, NOPOWER4,	{ BI, BDP } },
+{ "bdnzf",   BBO(16,BODNZF,0,0), BBOY_MASK, PPCCOM,	{ BI, BD } },
+{ "bdnzfl-", BBO(16,BODNZF,0,1), BBOY_MASK, NOPOWER4,	{ BI, BDM } },
+{ "bdnzfl+", BBO(16,BODNZF,0,1), BBOY_MASK, NOPOWER4,	{ BI, BDP } },
+{ "bdnzfl",  BBO(16,BODNZF,0,1), BBOY_MASK, PPCCOM,	{ BI, BD } },
+{ "bdnzfa-", BBO(16,BODNZF,1,0), BBOY_MASK, NOPOWER4,	{ BI, BDMA } },
+{ "bdnzfa+", BBO(16,BODNZF,1,0), BBOY_MASK, NOPOWER4,	{ BI, BDPA } },
+{ "bdnzfa",  BBO(16,BODNZF,1,0), BBOY_MASK, PPCCOM,	{ BI, BDA } },
+{ "bdnzfla-",BBO(16,BODNZF,1,1), BBOY_MASK, NOPOWER4,	{ BI, BDMA } },
+{ "bdnzfla+",BBO(16,BODNZF,1,1), BBOY_MASK, NOPOWER4,	{ BI, BDPA } },
+{ "bdnzfla", BBO(16,BODNZF,1,1), BBOY_MASK, PPCCOM,	{ BI, BDA } },
+{ "bt-",     BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM,	{ BI, BDM } },
+{ "bt+",     BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM,	{ BI, BDP } },
+{ "bt",	     BBO(16,BOT,0,0), BBOAT_MASK, PPCCOM,	{ BI, BD } },
+{ "bbt",     BBO(16,BOT,0,0), BBOAT_MASK, PWRCOM,	{ BI, BD } },
+{ "btl-",    BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM,	{ BI, BDM } },
+{ "btl+",    BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM,	{ BI, BDP } },
+{ "btl",     BBO(16,BOT,0,1), BBOAT_MASK, PPCCOM,	{ BI, BD } },
+{ "bbtl",    BBO(16,BOT,0,1), BBOAT_MASK, PWRCOM,	{ BI, BD } },
+{ "bta-",    BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM,	{ BI, BDMA } },
+{ "bta+",    BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM,	{ BI, BDPA } },
+{ "bta",     BBO(16,BOT,1,0), BBOAT_MASK, PPCCOM,	{ BI, BDA } },
+{ "bbta",    BBO(16,BOT,1,0), BBOAT_MASK, PWRCOM,	{ BI, BDA } },
+{ "btla-",   BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM,	{ BI, BDMA } },
+{ "btla+",   BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM,	{ BI, BDPA } },
+{ "btla",    BBO(16,BOT,1,1), BBOAT_MASK, PPCCOM,	{ BI, BDA } },
+{ "bbtla",   BBO(16,BOT,1,1), BBOAT_MASK, PWRCOM,	{ BI, BDA } },
+{ "bf-",     BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM,	{ BI, BDM } },
+{ "bf+",     BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM,	{ BI, BDP } },
+{ "bf",	     BBO(16,BOF,0,0), BBOAT_MASK, PPCCOM,	{ BI, BD } },
+{ "bbf",     BBO(16,BOF,0,0), BBOAT_MASK, PWRCOM,	{ BI, BD } },
+{ "bfl-",    BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM,	{ BI, BDM } },
+{ "bfl+",    BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM,	{ BI, BDP } },
+{ "bfl",     BBO(16,BOF,0,1), BBOAT_MASK, PPCCOM,	{ BI, BD } },
+{ "bbfl",    BBO(16,BOF,0,1), BBOAT_MASK, PWRCOM,	{ BI, BD } },
+{ "bfa-",    BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM,	{ BI, BDMA } },
+{ "bfa+",    BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM,	{ BI, BDPA } },
+{ "bfa",     BBO(16,BOF,1,0), BBOAT_MASK, PPCCOM,	{ BI, BDA } },
+{ "bbfa",    BBO(16,BOF,1,0), BBOAT_MASK, PWRCOM,	{ BI, BDA } },
+{ "bfla-",   BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM,	{ BI, BDMA } },
+{ "bfla+",   BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM,	{ BI, BDPA } },
+{ "bfla",    BBO(16,BOF,1,1), BBOAT_MASK, PPCCOM,	{ BI, BDA } },
+{ "bbfla",   BBO(16,BOF,1,1), BBOAT_MASK, PWRCOM,	{ BI, BDA } },
+{ "bdzt-",   BBO(16,BODZT,0,0), BBOY_MASK, NOPOWER4,	{ BI, BDM } },
+{ "bdzt+",   BBO(16,BODZT,0,0), BBOY_MASK, NOPOWER4,	{ BI, BDP } },
+{ "bdzt",    BBO(16,BODZT,0,0), BBOY_MASK, PPCCOM,	{ BI, BD } },
+{ "bdztl-",  BBO(16,BODZT,0,1), BBOY_MASK, NOPOWER4,	{ BI, BDM } },
+{ "bdztl+",  BBO(16,BODZT,0,1), BBOY_MASK, NOPOWER4,	{ BI, BDP } },
+{ "bdztl",   BBO(16,BODZT,0,1), BBOY_MASK, PPCCOM,	{ BI, BD } },
+{ "bdzta-",  BBO(16,BODZT,1,0), BBOY_MASK, NOPOWER4,	{ BI, BDMA } },
+{ "bdzta+",  BBO(16,BODZT,1,0), BBOY_MASK, NOPOWER4,	{ BI, BDPA } },
+{ "bdzta",   BBO(16,BODZT,1,0), BBOY_MASK, PPCCOM,	{ BI, BDA } },
+{ "bdztla-", BBO(16,BODZT,1,1), BBOY_MASK, NOPOWER4,	{ BI, BDMA } },
+{ "bdztla+", BBO(16,BODZT,1,1), BBOY_MASK, NOPOWER4,	{ BI, BDPA } },
+{ "bdztla",  BBO(16,BODZT,1,1), BBOY_MASK, PPCCOM,	{ BI, BDA } },
+{ "bdzf-",   BBO(16,BODZF,0,0), BBOY_MASK, NOPOWER4,	{ BI, BDM } },
+{ "bdzf+",   BBO(16,BODZF,0,0), BBOY_MASK, NOPOWER4,	{ BI, BDP } },
+{ "bdzf",    BBO(16,BODZF,0,0), BBOY_MASK, PPCCOM,	{ BI, BD } },
+{ "bdzfl-",  BBO(16,BODZF,0,1), BBOY_MASK, NOPOWER4,	{ BI, BDM } },
+{ "bdzfl+",  BBO(16,BODZF,0,1), BBOY_MASK, NOPOWER4,	{ BI, BDP } },
+{ "bdzfl",   BBO(16,BODZF,0,1), BBOY_MASK, PPCCOM,	{ BI, BD } },
+{ "bdzfa-",  BBO(16,BODZF,1,0), BBOY_MASK, NOPOWER4,	{ BI, BDMA } },
+{ "bdzfa+",  BBO(16,BODZF,1,0), BBOY_MASK, NOPOWER4,	{ BI, BDPA } },
+{ "bdzfa",   BBO(16,BODZF,1,0), BBOY_MASK, PPCCOM,	{ BI, BDA } },
+{ "bdzfla-", BBO(16,BODZF,1,1), BBOY_MASK, NOPOWER4,	{ BI, BDMA } },
+{ "bdzfla+", BBO(16,BODZF,1,1), BBOY_MASK, NOPOWER4,	{ BI, BDPA } },
+{ "bdzfla",  BBO(16,BODZF,1,1), BBOY_MASK, PPCCOM,	{ BI, BDA } },
+{ "bc-",     B(16,0,0),	B_MASK,		PPCCOM,		{ BOE, BI, BDM } },
+{ "bc+",     B(16,0,0),	B_MASK,		PPCCOM,		{ BOE, BI, BDP } },
+{ "bc",	     B(16,0,0),	B_MASK,		COM,		{ BO, BI, BD } },
+{ "bcl-",    B(16,0,1),	B_MASK,		PPCCOM,		{ BOE, BI, BDM } },
+{ "bcl+",    B(16,0,1),	B_MASK,		PPCCOM,		{ BOE, BI, BDP } },
+{ "bcl",     B(16,0,1),	B_MASK,		COM,		{ BO, BI, BD } },
+{ "bca-",    B(16,1,0),	B_MASK,		PPCCOM,		{ BOE, BI, BDMA } },
+{ "bca+",    B(16,1,0),	B_MASK,		PPCCOM,		{ BOE, BI, BDPA } },
+{ "bca",     B(16,1,0),	B_MASK,		COM,		{ BO, BI, BDA } },
+{ "bcla-",   B(16,1,1),	B_MASK,		PPCCOM,		{ BOE, BI, BDMA } },
+{ "bcla+",   B(16,1,1),	B_MASK,		PPCCOM,		{ BOE, BI, BDPA } },
+{ "bcla",    B(16,1,1),	B_MASK,		COM,		{ BO, BI, BDA } },
 
 { "sc",      SC(17,1,0), 0xffffffff,	PPC,		{ 0 } },
 { "svc",     SC(17,0,0), SC_MASK,	POWER,		{ LEV, FL1, FL2 } },
 { "svcl",    SC(17,0,1), SC_MASK,	POWER,		{ LEV, FL1, FL2 } },
-{ "svca",    SC(17,1,0), SC_MASK,	POWER,		{ SV } },
+{ "svca",    SC(17,1,0), SC_MASK,	PWRCOM,		{ SV } },
 { "svcla",   SC(17,1,1), SC_MASK,	POWER,		{ SV } },
 
-{ "b",	     B(18,0,0),	B_MASK,		PPC|POWER,	{ LI } },
-{ "bl",      B(18,0,1),	B_MASK,		PPC|POWER,	{ LI } },
-{ "ba",      B(18,1,0),	B_MASK,		PPC|POWER,	{ LIA } },
-{ "bla",     B(18,1,1),	B_MASK,		PPC|POWER,	{ LIA } },
-
-{ "mcrf",    XL(19,0),	XLBB_MASK|(3<<21)|(3<<16), PPC|POWER, { BF, BFA } },
-
-{ "blr",     XLO(19,BOU,16,0), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "br",      XLO(19,BOU,16,0), XLBOBIBB_MASK, POWER,	{ 0 } },
-{ "blrl",    XLO(19,BOU,16,1), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "brl",     XLO(19,BOU,16,1), XLBOBIBB_MASK, POWER,	{ 0 } },
-{ "bdnzlr",  XLO(19,BODNZ,16,0), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdnzlr-", XLO(19,BODNZ,16,0), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdnzlr+", XLO(19,BODNZP,16,0), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdnzlrl", XLO(19,BODNZ,16,1), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdnzlrl-",XLO(19,BODNZ,16,1), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdnzlrl+",XLO(19,BODNZP,16,1), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdzlr",   XLO(19,BODZ,16,0), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdzlr-",  XLO(19,BODZ,16,0), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdzlr+",  XLO(19,BODZP,16,0), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdzlrl",  XLO(19,BODZ,16,1), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdzlrl-", XLO(19,BODZ,16,1), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bdzlrl+", XLO(19,BODZP,16,1), XLBOBIBB_MASK, PPC,	{ 0 } },
-{ "bltlr",   XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltlr-",  XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltlr+",  XLOCB(19,BOTP,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltr",    XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "bltlrl",  XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltlrl-", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltlrl+", XLOCB(19,BOTP,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltrl",   XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "bgtlr",   XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtlr-",  XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtlr+",  XLOCB(19,BOTP,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtr",    XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "bgtlrl",  XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtlrl-", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtlrl+", XLOCB(19,BOTP,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtrl",   XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "beqlr",   XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqlr-",  XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqlr+",  XLOCB(19,BOTP,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqr",    XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "beqlrl",  XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqlrl-", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqlrl+", XLOCB(19,BOTP,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqrl",   XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "bsolr",   XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsolr-",  XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsolr+",  XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsor",    XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "bsolrl",  XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsolrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsolrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsorl",   XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "bunlr",   XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunlr-",  XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunlr+",  XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunlrl",  XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunlrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunlrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgelr",   XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgelr-",  XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgelr+",  XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bger",    XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "bgelrl",  XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgelrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgelrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgerl",   XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnllr",   XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnllr-",  XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnllr+",  XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnlr",    XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnllrl",  XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnllrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnllrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnlrl",   XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "blelr",   XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "blelr-",  XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "blelr+",  XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bler",    XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "blelrl",  XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "blelrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "blelrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "blerl",   XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnglr",   XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnglr-",  XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnglr+",  XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bngr",    XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnglrl",  XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnglrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnglrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bngrl",   XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnelr",   XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnelr-",  XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnelr+",  XLOCB(19,BOFP,CBEQ,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bner",    XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnelrl",  XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnelrl-", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnelrl+", XLOCB(19,BOFP,CBEQ,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnerl",   XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnslr",   XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnslr-",  XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnslr+",  XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnsr",    XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnslrl",  XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnslrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnslrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnsrl",   XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, POWER, { CR } },
-{ "bnulr",   XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnulr-",  XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnulr+",  XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnulrl",  XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnulrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnulrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "btlr",    XLO(19,BOT,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "btlr-",   XLO(19,BOT,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "btlr+",   XLO(19,BOTP,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bbtr",    XLO(19,BOT,16,0), XLBOBB_MASK, POWER,	{ BI } },
-{ "btlrl",   XLO(19,BOT,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "btlrl-",  XLO(19,BOT,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "btlrl+",  XLO(19,BOTP,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bbtrl",   XLO(19,BOT,16,1), XLBOBB_MASK, POWER,	{ BI } },
-{ "bflr",    XLO(19,BOF,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bflr-",   XLO(19,BOF,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bflr+",   XLO(19,BOFP,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bbfr",    XLO(19,BOF,16,0), XLBOBB_MASK, POWER,	{ BI } },
-{ "bflrl",   XLO(19,BOF,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bflrl-",  XLO(19,BOF,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bflrl+",  XLO(19,BOFP,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bbfrl",   XLO(19,BOF,16,1), XLBOBB_MASK, POWER,	{ BI } },
-{ "bdnztlr", XLO(19,BODNZT,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnztlr-",XLO(19,BODNZT,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnztlr+",XLO(19,BODNZTP,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnztlrl",XLO(19,BODNZT,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnztlrl-",XLO(19,BODNZT,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnztlrl+",XLO(19,BODNZTP,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnzflr", XLO(19,BODNZF,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnzflr-",XLO(19,BODNZF,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnzflr+",XLO(19,BODNZFP,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnzflrl",XLO(19,BODNZF,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnzflrl-",XLO(19,BODNZF,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdnzflrl+",XLO(19,BODNZFP,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdztlr",  XLO(19,BODZT,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdztlr-", XLO(19,BODZT,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdztlr+", XLO(19,BODZTP,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdztlrl", XLO(19,BODZT,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdztlrl-",XLO(19,BODZT,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdztlrl+",XLO(19,BODZTP,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdzflr",  XLO(19,BODZF,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdzflr-", XLO(19,BODZF,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdzflr+", XLO(19,BODZFP,16,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdzflrl", XLO(19,BODZF,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdzflrl-",XLO(19,BODZF,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bdzflrl+",XLO(19,BODZFP,16,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bclr",    XLLK(19,16,0), XLYBB_MASK,	PPC,		{ BO, BI } },
-{ "bclrl",   XLLK(19,16,1), XLYBB_MASK,	PPC,		{ BO, BI } },
-{ "bclr+",   XLYLK(19,16,1,0), XLYBB_MASK, PPC,		{ BOE, BI } },
-{ "bclrl+",  XLYLK(19,16,1,1), XLYBB_MASK, PPC,		{ BOE, BI } },
-{ "bclr-",   XLYLK(19,16,0,0), XLYBB_MASK, PPC,		{ BOE, BI } },
-{ "bclrl-",  XLYLK(19,16,0,1), XLYBB_MASK, PPC,		{ BOE, BI } },
-{ "bcr",     XLLK(19,16,0), XLBB_MASK,	POWER,		{ BO, BI } },
-{ "bcrl",    XLLK(19,16,1), XLBB_MASK,	POWER,		{ BO, BI } },
-
-{ "crnot",   XL(19,33), XL_MASK,	PPC,		{ BT, BA, BBA } },
-{ "crnor",   XL(19,33),	XL_MASK,	PPC|POWER,	{ BT, BA, BB } },
+{ "b",	     B(18,0,0),	B_MASK,		COM,		{ LI } },
+{ "bl",      B(18,0,1),	B_MASK,		COM,		{ LI } },
+{ "ba",      B(18,1,0),	B_MASK,		COM,		{ LIA } },
+{ "bla",     B(18,1,1),	B_MASK,		COM,		{ LIA } },
+
+{ "mcrf",    XL(19,0),	XLBB_MASK|(3 << 21)|(3 << 16), COM,	{ BF, BFA } },
+
+{ "blr",     XLO(19,BOU,16,0), XLBOBIBB_MASK, PPCCOM,	{ 0 } },
+{ "br",      XLO(19,BOU,16,0), XLBOBIBB_MASK, PWRCOM,	{ 0 } },
+{ "blrl",    XLO(19,BOU,16,1), XLBOBIBB_MASK, PPCCOM,	{ 0 } },
+{ "brl",     XLO(19,BOU,16,1), XLBOBIBB_MASK, PWRCOM,	{ 0 } },
+{ "bdnzlr",  XLO(19,BODNZ,16,0), XLBOBIBB_MASK, PPCCOM,	{ 0 } },
+{ "bdnzlr-", XLO(19,BODNZ,16,0), XLBOBIBB_MASK, NOPOWER4,	{ 0 } },
+{ "bdnzlr-", XLO(19,BODNZM4,16,0), XLBOBIBB_MASK, POWER4,	{ 0 } },
+{ "bdnzlr+", XLO(19,BODNZP,16,0), XLBOBIBB_MASK, NOPOWER4,	{ 0 } },
+{ "bdnzlr+", XLO(19,BODNZP4,16,0), XLBOBIBB_MASK, POWER4,	{ 0 } },
+{ "bdnzlrl", XLO(19,BODNZ,16,1), XLBOBIBB_MASK, PPCCOM,	{ 0 } },
+{ "bdnzlrl-",XLO(19,BODNZ,16,1), XLBOBIBB_MASK, NOPOWER4,	{ 0 } },
+{ "bdnzlrl-",XLO(19,BODNZM4,16,1), XLBOBIBB_MASK, POWER4,	{ 0 } },
+{ "bdnzlrl+",XLO(19,BODNZP,16,1), XLBOBIBB_MASK, NOPOWER4,	{ 0 } },
+{ "bdnzlrl+",XLO(19,BODNZP4,16,1), XLBOBIBB_MASK, POWER4,	{ 0 } },
+{ "bdzlr",   XLO(19,BODZ,16,0), XLBOBIBB_MASK, PPCCOM,	{ 0 } },
+{ "bdzlr-",  XLO(19,BODZ,16,0), XLBOBIBB_MASK, NOPOWER4,	{ 0 } },
+{ "bdzlr-",  XLO(19,BODZM4,16,0), XLBOBIBB_MASK, POWER4,	{ 0 } },
+{ "bdzlr+",  XLO(19,BODZP,16,0), XLBOBIBB_MASK, NOPOWER4,	{ 0 } },
+{ "bdzlr+",  XLO(19,BODZP4,16,0), XLBOBIBB_MASK, POWER4,	{ 0 } },
+{ "bdzlrl",  XLO(19,BODZ,16,1), XLBOBIBB_MASK, PPCCOM,	{ 0 } },
+{ "bdzlrl-", XLO(19,BODZ,16,1), XLBOBIBB_MASK, NOPOWER4,	{ 0 } },
+{ "bdzlrl-", XLO(19,BODZM4,16,1), XLBOBIBB_MASK, POWER4,	{ 0 } },
+{ "bdzlrl+", XLO(19,BODZP,16,1), XLBOBIBB_MASK, NOPOWER4,	{ 0 } },
+{ "bdzlrl+", XLO(19,BODZP4,16,1), XLBOBIBB_MASK, POWER4,	{ 0 } },
+{ "bltlr",   XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bltlr-",  XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bltlr-",  XLOCB(19,BOTM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bltlr+",  XLOCB(19,BOTP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bltlr+",  XLOCB(19,BOTP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bltr",    XLOCB(19,BOT,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bltlrl",  XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bltlrl-", XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bltlrl-", XLOCB(19,BOTM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bltlrl+", XLOCB(19,BOTP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bltlrl+", XLOCB(19,BOTP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bltrl",   XLOCB(19,BOT,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bgtlr",   XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bgtlr-",  XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgtlr-",  XLOCB(19,BOTM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgtlr+",  XLOCB(19,BOTP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgtlr+",  XLOCB(19,BOTP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgtr",    XLOCB(19,BOT,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bgtlrl",  XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bgtlrl-", XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgtlrl-", XLOCB(19,BOTM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgtlrl+", XLOCB(19,BOTP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgtlrl+", XLOCB(19,BOTP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgtrl",   XLOCB(19,BOT,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "beqlr",   XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "beqlr-",  XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "beqlr-",  XLOCB(19,BOTM4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "beqlr+",  XLOCB(19,BOTP,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "beqlr+",  XLOCB(19,BOTP4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "beqr",    XLOCB(19,BOT,CBEQ,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "beqlrl",  XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "beqlrl-", XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "beqlrl-", XLOCB(19,BOTM4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "beqlrl+", XLOCB(19,BOTP,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "beqlrl+", XLOCB(19,BOTP4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "beqrl",   XLOCB(19,BOT,CBEQ,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bsolr",   XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bsolr-",  XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bsolr-",  XLOCB(19,BOTM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bsolr+",  XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bsolr+",  XLOCB(19,BOTP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bsor",    XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bsolrl",  XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bsolrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bsolrl-", XLOCB(19,BOTM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bsolrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bsolrl+", XLOCB(19,BOTP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bsorl",   XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bunlr",   XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bunlr-",  XLOCB(19,BOT,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bunlr-",  XLOCB(19,BOTM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bunlr+",  XLOCB(19,BOTP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bunlr+",  XLOCB(19,BOTP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bunlrl",  XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bunlrl-", XLOCB(19,BOT,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bunlrl-", XLOCB(19,BOTM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bunlrl+", XLOCB(19,BOTP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bunlrl+", XLOCB(19,BOTP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgelr",   XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bgelr-",  XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgelr-",  XLOCB(19,BOFM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgelr+",  XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgelr+",  XLOCB(19,BOFP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bger",    XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bgelrl",  XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bgelrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgelrl-", XLOCB(19,BOFM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgelrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgelrl+", XLOCB(19,BOFP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgerl",   XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnllr",   XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnllr-",  XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnllr-",  XLOCB(19,BOFM4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnllr+",  XLOCB(19,BOFP,CBLT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnllr+",  XLOCB(19,BOFP4,CBLT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnlr",    XLOCB(19,BOF,CBLT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnllrl",  XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnllrl-", XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnllrl-", XLOCB(19,BOFM4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnllrl+", XLOCB(19,BOFP,CBLT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnllrl+", XLOCB(19,BOFP4,CBLT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnlrl",   XLOCB(19,BOF,CBLT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "blelr",   XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "blelr-",  XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "blelr-",  XLOCB(19,BOFM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "blelr+",  XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "blelr+",  XLOCB(19,BOFP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bler",    XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "blelrl",  XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "blelrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "blelrl-", XLOCB(19,BOFM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "blelrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "blelrl+", XLOCB(19,BOFP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "blerl",   XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnglr",   XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnglr-",  XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnglr-",  XLOCB(19,BOFM4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnglr+",  XLOCB(19,BOFP,CBGT,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnglr+",  XLOCB(19,BOFP4,CBGT,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bngr",    XLOCB(19,BOF,CBGT,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnglrl",  XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnglrl-", XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnglrl-", XLOCB(19,BOFM4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnglrl+", XLOCB(19,BOFP,CBGT,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnglrl+", XLOCB(19,BOFP4,CBGT,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bngrl",   XLOCB(19,BOF,CBGT,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnelr",   XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnelr-",  XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnelr-",  XLOCB(19,BOFM4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnelr+",  XLOCB(19,BOFP,CBEQ,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnelr+",  XLOCB(19,BOFP4,CBEQ,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bner",    XLOCB(19,BOF,CBEQ,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnelrl",  XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnelrl-", XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnelrl-", XLOCB(19,BOFM4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnelrl+", XLOCB(19,BOFP,CBEQ,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnelrl+", XLOCB(19,BOFP4,CBEQ,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnerl",   XLOCB(19,BOF,CBEQ,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnslr",   XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnslr-",  XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnslr-",  XLOCB(19,BOFM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnslr+",  XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnslr+",  XLOCB(19,BOFP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnsr",    XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnslrl",  XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnslrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnslrl-", XLOCB(19,BOFM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnslrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnslrl+", XLOCB(19,BOFP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnsrl",   XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PWRCOM, { CR } },
+{ "bnulr",   XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnulr-",  XLOCB(19,BOF,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnulr-",  XLOCB(19,BOFM4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnulr+",  XLOCB(19,BOFP,CBSO,16,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnulr+",  XLOCB(19,BOFP4,CBSO,16,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnulrl",  XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, PPCCOM, { CR } },
+{ "bnulrl-", XLOCB(19,BOF,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnulrl-", XLOCB(19,BOFM4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnulrl+", XLOCB(19,BOFP,CBSO,16,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnulrl+", XLOCB(19,BOFP4,CBSO,16,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "btlr",    XLO(19,BOT,16,0), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "btlr-",   XLO(19,BOT,16,0), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "btlr-",   XLO(19,BOTM4,16,0), XLBOBB_MASK, POWER4,	{ BI } },
+{ "btlr+",   XLO(19,BOTP,16,0), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "btlr+",   XLO(19,BOTP4,16,0), XLBOBB_MASK, POWER4,	{ BI } },
+{ "bbtr",    XLO(19,BOT,16,0), XLBOBB_MASK, PWRCOM,	{ BI } },
+{ "btlrl",   XLO(19,BOT,16,1), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "btlrl-",  XLO(19,BOT,16,1), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "btlrl-",  XLO(19,BOTM4,16,1), XLBOBB_MASK, POWER4,	{ BI } },
+{ "btlrl+",  XLO(19,BOTP,16,1), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "btlrl+",  XLO(19,BOTP4,16,1), XLBOBB_MASK, POWER4,	{ BI } },
+{ "bbtrl",   XLO(19,BOT,16,1), XLBOBB_MASK, PWRCOM,	{ BI } },
+{ "bflr",    XLO(19,BOF,16,0), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bflr-",   XLO(19,BOF,16,0), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "bflr-",   XLO(19,BOFM4,16,0), XLBOBB_MASK, POWER4,	{ BI } },
+{ "bflr+",   XLO(19,BOFP,16,0), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "bflr+",   XLO(19,BOFP4,16,0), XLBOBB_MASK, POWER4,	{ BI } },
+{ "bbfr",    XLO(19,BOF,16,0), XLBOBB_MASK, PWRCOM,	{ BI } },
+{ "bflrl",   XLO(19,BOF,16,1), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bflrl-",  XLO(19,BOF,16,1), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "bflrl-",  XLO(19,BOFM4,16,1), XLBOBB_MASK, POWER4,	{ BI } },
+{ "bflrl+",  XLO(19,BOFP,16,1), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "bflrl+",  XLO(19,BOFP4,16,1), XLBOBB_MASK, POWER4,	{ BI } },
+{ "bbfrl",   XLO(19,BOF,16,1), XLBOBB_MASK, PWRCOM,	{ BI } },
+{ "bdnztlr", XLO(19,BODNZT,16,0), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bdnztlr-",XLO(19,BODNZT,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdnztlr+",XLO(19,BODNZTP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdnztlrl",XLO(19,BODNZT,16,1), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bdnztlrl-",XLO(19,BODNZT,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdnztlrl+",XLO(19,BODNZTP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdnzflr", XLO(19,BODNZF,16,0), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bdnzflr-",XLO(19,BODNZF,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdnzflr+",XLO(19,BODNZFP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdnzflrl",XLO(19,BODNZF,16,1), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bdnzflrl-",XLO(19,BODNZF,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdnzflrl+",XLO(19,BODNZFP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdztlr",  XLO(19,BODZT,16,0), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bdztlr-", XLO(19,BODZT,16,0), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "bdztlr+", XLO(19,BODZTP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdztlrl", XLO(19,BODZT,16,1), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bdztlrl-",XLO(19,BODZT,16,1), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "bdztlrl+",XLO(19,BODZTP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdzflr",  XLO(19,BODZF,16,0), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bdzflr-", XLO(19,BODZF,16,0), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "bdzflr+", XLO(19,BODZFP,16,0), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bdzflrl", XLO(19,BODZF,16,1), XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bdzflrl-",XLO(19,BODZF,16,1), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "bdzflrl+",XLO(19,BODZFP,16,1), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bclr",    XLLK(19,16,0), XLYBB_MASK,	PPCCOM,		{ BO, BI } },
+{ "bclrl",   XLLK(19,16,1), XLYBB_MASK,	PPCCOM,		{ BO, BI } },
+{ "bclr+",   XLYLK(19,16,1,0), XLYBB_MASK, PPCCOM,	{ BOE, BI } },
+{ "bclrl+",  XLYLK(19,16,1,1), XLYBB_MASK, PPCCOM,	{ BOE, BI } },
+{ "bclr-",   XLYLK(19,16,0,0), XLYBB_MASK, PPCCOM,	{ BOE, BI } },
+{ "bclrl-",  XLYLK(19,16,0,1), XLYBB_MASK, PPCCOM,	{ BOE, BI } },
+{ "bcr",     XLLK(19,16,0), XLBB_MASK,	PWRCOM,		{ BO, BI } },
+{ "bcrl",    XLLK(19,16,1), XLBB_MASK,	PWRCOM,		{ BO, BI } },
+{ "bclre",   XLLK(19,17,0), XLBB_MASK,	BOOKE64,	{ BO, BI } },
+{ "bclrel",  XLLK(19,17,1), XLBB_MASK,	BOOKE64,	{ BO, BI } },
+
+{ "rfid",    XL(19,18),	0xffffffff,	PPC64,		{ 0 } },
+
+{ "crnot",   XL(19,33), XL_MASK,	PPCCOM,		{ BT, BA, BBA } },
+{ "crnor",   XL(19,33),	XL_MASK,	COM,		{ BT, BA, BB } },
+{ "rfmci",    X(19,38), 0xffffffff,	PPCRFMCI,	{ 0 } },
 
-{ "rfi",     XL(19,50),	0xffffffff,	PPC|POWER,	{ 0 } },
-{ "rfci",    XL(19,51),	0xffffffff,	PPC,		{ 0 } },
+{ "rfi",     XL(19,50),	0xffffffff,	COM,		{ 0 } },
+{ "rfci",    XL(19,51),	0xffffffff,	PPC403 | BOOKE,	{ 0 } },
 
 { "rfsvc",   XL(19,82),	0xffffffff,	POWER,		{ 0 } },
 
-{ "crandc",  XL(19,129), XL_MASK,	PPC|POWER,	{ BT, BA, BB } },
+{ "crandc",  XL(19,129), XL_MASK,	COM,		{ BT, BA, BB } },
 
-{ "isync",   XL(19,150), 0xffffffff,	PPC,		{ 0 } },
-{ "ics",     XL(19,150), 0xffffffff,	POWER,		{ 0 } },
+{ "isync",   XL(19,150), 0xffffffff,	PPCCOM,		{ 0 } },
+{ "ics",     XL(19,150), 0xffffffff,	PWRCOM,		{ 0 } },
 
-{ "crclr",   XL(19,193), XL_MASK,	PPC,		{ BT, BAT, BBA } },
-{ "crxor",   XL(19,193), XL_MASK,	PPC|POWER,	{ BT, BA, BB } },
+{ "crclr",   XL(19,193), XL_MASK,	PPCCOM,		{ BT, BAT, BBA } },
+{ "crxor",   XL(19,193), XL_MASK,	COM,		{ BT, BA, BB } },
 
-{ "crnand",  XL(19,225), XL_MASK,	PPC|POWER,	{ BT, BA, BB } },
-
-{ "crand",   XL(19,257), XL_MASK,	PPC|POWER,	{ BT, BA, BB } },
-
-{ "crset",   XL(19,289), XL_MASK,	PPC,		{ BT, BAT, BBA } },
-{ "creqv",   XL(19,289), XL_MASK,	PPC|POWER,	{ BT, BA, BB } },
-
-{ "crorc",   XL(19,417), XL_MASK,	PPC|POWER,	{ BT, BA, BB } },
-
-{ "crmove",  XL(19,449), XL_MASK,	PPC,		{ BT, BA, BBA } },
-{ "cror",    XL(19,449), XL_MASK,	PPC|POWER,	{ BT, BA, BB } },
-
-{ "bctr",    XLO(19,BOU,528,0), XLBOBIBB_MASK, PPC|POWER, { 0 } },
-{ "bctrl",   XLO(19,BOU,528,1), XLBOBIBB_MASK, PPC|POWER, { 0 } },
-{ "bltctr",  XLOCB(19,BOT,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltctr-", XLOCB(19,BOT,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltctr+", XLOCB(19,BOTP,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltctrl", XLOCB(19,BOT,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltctrl-",XLOCB(19,BOT,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bltctrl+",XLOCB(19,BOTP,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtctr",  XLOCB(19,BOT,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtctr-", XLOCB(19,BOT,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtctr+", XLOCB(19,BOTP,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtctrl", XLOCB(19,BOT,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtctrl-",XLOCB(19,BOT,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgtctrl+",XLOCB(19,BOTP,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqctr",  XLOCB(19,BOT,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqctr-", XLOCB(19,BOT,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqctr+", XLOCB(19,BOTP,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqctrl", XLOCB(19,BOT,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqctrl-",XLOCB(19,BOT,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "beqctrl+",XLOCB(19,BOTP,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsoctr",  XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsoctr-", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsoctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsoctrl", XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsoctrl-",XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bsoctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunctr",  XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunctr-", XLOCB(19,BOT,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunctrl", XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunctrl-",XLOCB(19,BOT,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bunctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgectr",  XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgectr-", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgectr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgectrl", XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgectrl-",XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bgectrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnlctr",  XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnlctr-", XLOCB(19,BOF,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnlctr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnlctrl", XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnlctrl-",XLOCB(19,BOF,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnlctrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "blectr",  XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "blectr-", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "blectr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "blectrl", XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "blectrl-",XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "blectrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bngctr",  XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bngctr-", XLOCB(19,BOF,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bngctr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bngctrl", XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bngctrl-",XLOCB(19,BOF,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bngctrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnectr",  XLOCB(19,BOF,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnectr-", XLOCB(19,BOF,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnectr+", XLOCB(19,BOFP,CBEQ,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnectrl", XLOCB(19,BOF,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnectrl-",XLOCB(19,BOF,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnectrl+",XLOCB(19,BOFP,CBEQ,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnsctr",  XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnsctr-", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnsctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnsctrl", XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnsctrl-",XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnsctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnuctr",  XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnuctr-", XLOCB(19,BOF,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnuctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnuctrl", XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnuctrl-",XLOCB(19,BOF,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "bnuctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, PPC, { CR } },
-{ "btctr",   XLO(19,BOT,528,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "btctr-",  XLO(19,BOT,528,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "btctr+",  XLO(19,BOTP,528,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "btctrl",  XLO(19,BOT,528,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "btctrl-", XLO(19,BOT,528,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "btctrl+", XLO(19,BOTP,528,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bfctr",   XLO(19,BOF,528,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bfctr-",  XLO(19,BOF,528,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bfctr+",  XLO(19,BOFP,528,0), XLBOBB_MASK, PPC,	{ BI } },
-{ "bfctrl",  XLO(19,BOF,528,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bfctrl-", XLO(19,BOF,528,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bfctrl+", XLO(19,BOFP,528,1), XLBOBB_MASK, PPC,	{ BI } },
-{ "bcctr",   XLLK(19,528,0), XLYBB_MASK, PPC,		{ BO, BI } },
-{ "bcctr-",  XLYLK(19,528,0,0), XLYBB_MASK, PPC,	{ BOE, BI } },
-{ "bcctr+",  XLYLK(19,528,1,0), XLYBB_MASK, PPC,	{ BOE, BI } },
-{ "bcctrl",  XLLK(19,528,1), XLYBB_MASK, PPC,		{ BO, BI } },
-{ "bcctrl-", XLYLK(19,528,0,1), XLYBB_MASK, PPC,	{ BOE, BI } },
-{ "bcctrl+", XLYLK(19,528,1,1), XLYBB_MASK, PPC,	{ BOE, BI } },
-{ "bcc",     XLLK(19,528,0), XLBB_MASK,	POWER,		{ BO, BI } },
-{ "bccl",    XLLK(19,528,1), XLBB_MASK,	POWER,		{ BO, BI } },
-
-{ "rlwimi",  M(20,0),	M_MASK,		PPC,		{ RA,RS,SH,MBE,ME } },
-{ "rlimi",   M(20,0),	M_MASK,		POWER,		{ RA,RS,SH,MBE,ME } },
-
-{ "rlwimi.", M(20,1),	M_MASK,		PPC,		{ RA,RS,SH,MBE,ME } },
-{ "rlimi.",  M(20,1),	M_MASK,		POWER,		{ RA,RS,SH,MBE,ME } },
-
-{ "rotlwi",  MME(21,31,0), MMBME_MASK,	PPC,		{ RA, RS, SH } },
-{ "clrlwi",  MME(21,31,0), MSHME_MASK,	PPC,		{ RA, RS, MB } },
-{ "rlwinm",  M(21,0),	M_MASK,		PPC,		{ RA,RS,SH,MBE,ME } },
-{ "rlinm",   M(21,0),	M_MASK,		POWER,		{ RA,RS,SH,MBE,ME } },
-{ "rotlwi.", MME(21,31,1), MMBME_MASK,	PPC,		{ RA,RS,SH } },
-{ "clrlwi.", MME(21,31,1), MSHME_MASK,	PPC,		{ RA, RS, MB } },
-{ "rlwinm.", M(21,1),	M_MASK,		PPC,		{ RA,RS,SH,MBE,ME } },
-{ "rlinm.",  M(21,1),	M_MASK,		POWER,		{ RA,RS,SH,MBE,ME } },
-
-{ "rlmi",    M(22,0),	M_MASK,		POWER|M601,	{ RA,RS,RB,MBE,ME } },
-{ "rlmi.",   M(22,1),	M_MASK,		POWER|M601,	{ RA,RS,RB,MBE,ME } },
-
-{ "rotlw",   MME(23,31,0), MMBME_MASK,	PPC,		{ RA, RS, RB } },
-{ "rlwnm",   M(23,0),	M_MASK,		PPC,		{ RA,RS,RB,MBE,ME } },
-{ "rlnm",    M(23,0),	M_MASK,		POWER,		{ RA,RS,RB,MBE,ME } },
-{ "rotlw.",  MME(23,31,1), MMBME_MASK,	PPC,		{ RA, RS, RB } },
-{ "rlwnm.",  M(23,1),	M_MASK,		PPC,		{ RA,RS,RB,MBE,ME } },
-{ "rlnm.",   M(23,1),	M_MASK,		POWER,		{ RA,RS,RB,MBE,ME } },
-
-{ "nop",     OP(24),	0xffffffff,	PPC,		{ 0 } },
-{ "ori",     OP(24),	OP_MASK,	PPC,		{ RA, RS, UI } },
-{ "oril",    OP(24),	OP_MASK,	POWER,		{ RA, RS, UI } },
-
-{ "oris",    OP(25),	OP_MASK,	PPC,		{ RA, RS, UI } },
-{ "oriu",    OP(25),	OP_MASK,	POWER,		{ RA, RS, UI } },
-
-{ "xori",    OP(26),	OP_MASK,	PPC,		{ RA, RS, UI } },
-{ "xoril",   OP(26),	OP_MASK,	POWER,		{ RA, RS, UI } },
-
-{ "xoris",   OP(27),	OP_MASK,	PPC,		{ RA, RS, UI } },
-{ "xoriu",   OP(27),	OP_MASK,	POWER,		{ RA, RS, UI } },
-
-{ "andi.",   OP(28),	OP_MASK,	PPC,		{ RA, RS, UI } },
-{ "andil.",  OP(28),	OP_MASK,	POWER,		{ RA, RS, UI } },
-
-{ "andis.",  OP(29),	OP_MASK,	PPC,		{ RA, RS, UI } },
-{ "andiu.",  OP(29),	OP_MASK,	POWER,		{ RA, RS, UI } },
-
-{ "rotldi",  MD(30,0,0), MDMB_MASK,	PPC|B64,	{ RA, RS, SH6 } },
-{ "clrldi",  MD(30,0,0), MDSH_MASK,	PPC|B64,	{ RA, RS, MB6 } },
-{ "rldicl",  MD(30,0,0), MD_MASK,	PPC|B64,	{ RA, RS, SH6, MB6 } },
-{ "rotldi.", MD(30,0,1), MDMB_MASK,	PPC|B64,	{ RA, RS, SH6 } },
-{ "clrldi.", MD(30,0,1), MDSH_MASK,	PPC|B64,	{ RA, RS, MB6 } },
-{ "rldicl.", MD(30,0,1), MD_MASK,	PPC|B64,	{ RA, RS, SH6, MB6 } },
-
-{ "rldicr",  MD(30,1,0), MD_MASK,	PPC|B64,	{ RA, RS, SH6, ME6 } },
-{ "rldicr.", MD(30,1,1), MD_MASK,	PPC|B64,	{ RA, RS, SH6, ME6 } },
-
-{ "rldic",   MD(30,2,0), MD_MASK,	PPC|B64,	{ RA, RS, SH6, MB6 } },
-{ "rldic.",  MD(30,2,1), MD_MASK,	PPC|B64,	{ RA, RS, SH6, MB6 } },
-
-{ "rldimi",  MD(30,3,0), MD_MASK,	PPC|B64,	{ RA, RS, SH6, MB6 } },
-{ "rldimi.", MD(30,3,1), MD_MASK,	PPC|B64,	{ RA, RS, SH6, MB6 } },
-
-{ "rotld",   MDS(30,8,0), MDSMB_MASK,	PPC|B64,	{ RA, RS, RB } },
-{ "rldcl",   MDS(30,8,0), MDS_MASK,	PPC|B64,	{ RA, RS, RB, MB6 } },
-{ "rotld.",  MDS(30,8,1), MDSMB_MASK,	PPC|B64,	{ RA, RS, RB } },
-{ "rldcl.",  MDS(30,8,1), MDS_MASK,	PPC|B64,	{ RA, RS, RB, MB6 } },
+{ "crnand",  XL(19,225), XL_MASK,	COM,		{ BT, BA, BB } },
+
+{ "crand",   XL(19,257), XL_MASK,	COM,		{ BT, BA, BB } },
+
+{ "crset",   XL(19,289), XL_MASK,	PPCCOM,		{ BT, BAT, BBA } },
+{ "creqv",   XL(19,289), XL_MASK,	COM,		{ BT, BA, BB } },
+
+{ "crorc",   XL(19,417), XL_MASK,	COM,		{ BT, BA, BB } },
+
+{ "crmove",  XL(19,449), XL_MASK,	PPCCOM,		{ BT, BA, BBA } },
+{ "cror",    XL(19,449), XL_MASK,	COM,		{ BT, BA, BB } },
+
+{ "bctr",    XLO(19,BOU,528,0), XLBOBIBB_MASK, COM,	{ 0 } },
+{ "bctrl",   XLO(19,BOU,528,1), XLBOBIBB_MASK, COM,	{ 0 } },
+{ "bltctr",  XLOCB(19,BOT,CBLT,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bltctr-", XLOCB(19,BOT,CBLT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bltctr-", XLOCB(19,BOTM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bltctr+", XLOCB(19,BOTP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bltctr+", XLOCB(19,BOTP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bltctrl", XLOCB(19,BOT,CBLT,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bltctrl-",XLOCB(19,BOT,CBLT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bltctrl-",XLOCB(19,BOTM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bltctrl+",XLOCB(19,BOTP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bltctrl+",XLOCB(19,BOTP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgtctr",  XLOCB(19,BOT,CBGT,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bgtctr-", XLOCB(19,BOT,CBGT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgtctr-", XLOCB(19,BOTM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgtctr+", XLOCB(19,BOTP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgtctr+", XLOCB(19,BOTP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgtctrl", XLOCB(19,BOT,CBGT,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bgtctrl-",XLOCB(19,BOT,CBGT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgtctrl-",XLOCB(19,BOTM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgtctrl+",XLOCB(19,BOTP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgtctrl+",XLOCB(19,BOTP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "beqctr",  XLOCB(19,BOT,CBEQ,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "beqctr-", XLOCB(19,BOT,CBEQ,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "beqctr-", XLOCB(19,BOTM4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "beqctr+", XLOCB(19,BOTP,CBEQ,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "beqctr+", XLOCB(19,BOTP4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "beqctrl", XLOCB(19,BOT,CBEQ,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "beqctrl-",XLOCB(19,BOT,CBEQ,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "beqctrl-",XLOCB(19,BOTM4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "beqctrl+",XLOCB(19,BOTP,CBEQ,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "beqctrl+",XLOCB(19,BOTP4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bsoctr",  XLOCB(19,BOT,CBSO,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bsoctr-", XLOCB(19,BOT,CBSO,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bsoctr-", XLOCB(19,BOTM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bsoctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bsoctr+", XLOCB(19,BOTP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bsoctrl", XLOCB(19,BOT,CBSO,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bsoctrl-",XLOCB(19,BOT,CBSO,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bsoctrl-",XLOCB(19,BOTM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bsoctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bsoctrl+",XLOCB(19,BOTP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bunctr",  XLOCB(19,BOT,CBSO,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bunctr-", XLOCB(19,BOT,CBSO,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bunctr-", XLOCB(19,BOTM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bunctr+", XLOCB(19,BOTP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bunctr+", XLOCB(19,BOTP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bunctrl", XLOCB(19,BOT,CBSO,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bunctrl-",XLOCB(19,BOT,CBSO,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bunctrl-",XLOCB(19,BOTM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bunctrl+",XLOCB(19,BOTP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bunctrl+",XLOCB(19,BOTP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgectr",  XLOCB(19,BOF,CBLT,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bgectr-", XLOCB(19,BOF,CBLT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgectr-", XLOCB(19,BOFM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgectr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgectr+", XLOCB(19,BOFP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgectrl", XLOCB(19,BOF,CBLT,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bgectrl-",XLOCB(19,BOF,CBLT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgectrl-",XLOCB(19,BOFM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bgectrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bgectrl+",XLOCB(19,BOFP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnlctr",  XLOCB(19,BOF,CBLT,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bnlctr-", XLOCB(19,BOF,CBLT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnlctr-", XLOCB(19,BOFM4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnlctr+", XLOCB(19,BOFP,CBLT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnlctr+", XLOCB(19,BOFP4,CBLT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnlctrl", XLOCB(19,BOF,CBLT,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bnlctrl-",XLOCB(19,BOF,CBLT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnlctrl-",XLOCB(19,BOFM4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnlctrl+",XLOCB(19,BOFP,CBLT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnlctrl+",XLOCB(19,BOFP4,CBLT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "blectr",  XLOCB(19,BOF,CBGT,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "blectr-", XLOCB(19,BOF,CBGT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "blectr-", XLOCB(19,BOFM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "blectr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "blectr+", XLOCB(19,BOFP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "blectrl", XLOCB(19,BOF,CBGT,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "blectrl-",XLOCB(19,BOF,CBGT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "blectrl-",XLOCB(19,BOFM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "blectrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "blectrl+",XLOCB(19,BOFP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bngctr",  XLOCB(19,BOF,CBGT,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bngctr-", XLOCB(19,BOF,CBGT,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bngctr-", XLOCB(19,BOFM4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bngctr+", XLOCB(19,BOFP,CBGT,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bngctr+", XLOCB(19,BOFP4,CBGT,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bngctrl", XLOCB(19,BOF,CBGT,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bngctrl-",XLOCB(19,BOF,CBGT,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bngctrl-",XLOCB(19,BOFM4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bngctrl+",XLOCB(19,BOFP,CBGT,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bngctrl+",XLOCB(19,BOFP4,CBGT,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnectr",  XLOCB(19,BOF,CBEQ,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bnectr-", XLOCB(19,BOF,CBEQ,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnectr-", XLOCB(19,BOFM4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnectr+", XLOCB(19,BOFP,CBEQ,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnectr+", XLOCB(19,BOFP4,CBEQ,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnectrl", XLOCB(19,BOF,CBEQ,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bnectrl-",XLOCB(19,BOF,CBEQ,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnectrl-",XLOCB(19,BOFM4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnectrl+",XLOCB(19,BOFP,CBEQ,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnectrl+",XLOCB(19,BOFP4,CBEQ,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnsctr",  XLOCB(19,BOF,CBSO,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bnsctr-", XLOCB(19,BOF,CBSO,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnsctr-", XLOCB(19,BOFM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnsctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnsctr+", XLOCB(19,BOFP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnsctrl", XLOCB(19,BOF,CBSO,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bnsctrl-",XLOCB(19,BOF,CBSO,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnsctrl-",XLOCB(19,BOFM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnsctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnsctrl+",XLOCB(19,BOFP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnuctr",  XLOCB(19,BOF,CBSO,528,0),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bnuctr-", XLOCB(19,BOF,CBSO,528,0),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnuctr-", XLOCB(19,BOFM4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnuctr+", XLOCB(19,BOFP,CBSO,528,0), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnuctr+", XLOCB(19,BOFP4,CBSO,528,0), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnuctrl", XLOCB(19,BOF,CBSO,528,1),  XLBOCBBB_MASK, PPCCOM,	{ CR } },
+{ "bnuctrl-",XLOCB(19,BOF,CBSO,528,1),  XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnuctrl-",XLOCB(19,BOFM4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "bnuctrl+",XLOCB(19,BOFP,CBSO,528,1), XLBOCBBB_MASK, NOPOWER4, { CR } },
+{ "bnuctrl+",XLOCB(19,BOFP4,CBSO,528,1), XLBOCBBB_MASK, POWER4, { CR } },
+{ "btctr",   XLO(19,BOT,528,0),  XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "btctr-",  XLO(19,BOT,528,0),  XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "btctr-",  XLO(19,BOTM4,528,0), XLBOBB_MASK, POWER4, { BI } },
+{ "btctr+",  XLO(19,BOTP,528,0), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "btctr+",  XLO(19,BOTP4,528,0), XLBOBB_MASK, POWER4, { BI } },
+{ "btctrl",  XLO(19,BOT,528,1),  XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "btctrl-", XLO(19,BOT,528,1),  XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "btctrl-", XLO(19,BOTM4,528,1), XLBOBB_MASK, POWER4, { BI } },
+{ "btctrl+", XLO(19,BOTP,528,1), XLBOBB_MASK, NOPOWER4,	{ BI } },
+{ "btctrl+", XLO(19,BOTP4,528,1), XLBOBB_MASK, POWER4, { BI } },
+{ "bfctr",   XLO(19,BOF,528,0),  XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bfctr-",  XLO(19,BOF,528,0),  XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bfctr-",  XLO(19,BOFM4,528,0), XLBOBB_MASK, POWER4, { BI } },
+{ "bfctr+",  XLO(19,BOFP,528,0), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bfctr+",  XLO(19,BOFP4,528,0), XLBOBB_MASK, POWER4, { BI } },
+{ "bfctrl",  XLO(19,BOF,528,1),  XLBOBB_MASK, PPCCOM,	{ BI } },
+{ "bfctrl-", XLO(19,BOF,528,1),  XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bfctrl-", XLO(19,BOFM4,528,1), XLBOBB_MASK, POWER4, { BI } },
+{ "bfctrl+", XLO(19,BOFP,528,1), XLBOBB_MASK, NOPOWER4, { BI } },
+{ "bfctrl+", XLO(19,BOFP4,528,1), XLBOBB_MASK, POWER4, { BI } },
+{ "bcctr",   XLLK(19,528,0),     XLYBB_MASK,  PPCCOM,	{ BO, BI } },
+{ "bcctr-",  XLYLK(19,528,0,0),  XLYBB_MASK,  PPCCOM,	{ BOE, BI } },
+{ "bcctr+",  XLYLK(19,528,1,0),  XLYBB_MASK,  PPCCOM,	{ BOE, BI } },
+{ "bcctrl",  XLLK(19,528,1),     XLYBB_MASK,  PPCCOM,	{ BO, BI } },
+{ "bcctrl-", XLYLK(19,528,0,1),  XLYBB_MASK,  PPCCOM,	{ BOE, BI } },
+{ "bcctrl+", XLYLK(19,528,1,1),  XLYBB_MASK,  PPCCOM,	{ BOE, BI } },
+{ "bcc",     XLLK(19,528,0),     XLBB_MASK,   PWRCOM,	{ BO, BI } },
+{ "bccl",    XLLK(19,528,1),     XLBB_MASK,   PWRCOM,	{ BO, BI } },
+{ "bcctre",  XLLK(19,529,0),     XLYBB_MASK,  BOOKE64,	{ BO, BI } },
+{ "bcctrel", XLLK(19,529,1),     XLYBB_MASK,  BOOKE64,	{ BO, BI } },
+
+{ "rlwimi",  M(20,0),	M_MASK,		PPCCOM,		{ RA,RS,SH,MBE,ME } },
+{ "rlimi",   M(20,0),	M_MASK,		PWRCOM,		{ RA,RS,SH,MBE,ME } },
+
+{ "rlwimi.", M(20,1),	M_MASK,		PPCCOM,		{ RA,RS,SH,MBE,ME } },
+{ "rlimi.",  M(20,1),	M_MASK,		PWRCOM,		{ RA,RS,SH,MBE,ME } },
+
+{ "rotlwi",  MME(21,31,0), MMBME_MASK,	PPCCOM,		{ RA, RS, SH } },
+{ "clrlwi",  MME(21,31,0), MSHME_MASK,	PPCCOM,		{ RA, RS, MB } },
+{ "rlwinm",  M(21,0),	M_MASK,		PPCCOM,		{ RA,RS,SH,MBE,ME } },
+{ "rlinm",   M(21,0),	M_MASK,		PWRCOM,		{ RA,RS,SH,MBE,ME } },
+{ "rotlwi.", MME(21,31,1), MMBME_MASK,	PPCCOM,		{ RA,RS,SH } },
+{ "clrlwi.", MME(21,31,1), MSHME_MASK,	PPCCOM,		{ RA, RS, MB } },
+{ "rlwinm.", M(21,1),	M_MASK,		PPCCOM,		{ RA,RS,SH,MBE,ME } },
+{ "rlinm.",  M(21,1),	M_MASK,		PWRCOM,		{ RA,RS,SH,MBE,ME } },
+
+{ "rlmi",    M(22,0),	M_MASK,		M601,		{ RA,RS,RB,MBE,ME } },
+{ "rlmi.",   M(22,1),	M_MASK,		M601,		{ RA,RS,RB,MBE,ME } },
+
+{ "be",	     B(22,0,0),	B_MASK,		BOOKE64,	{ LI } },
+{ "bel",     B(22,0,1),	B_MASK,		BOOKE64,	{ LI } },
+{ "bea",     B(22,1,0),	B_MASK,		BOOKE64,	{ LIA } },
+{ "bela",    B(22,1,1),	B_MASK,		BOOKE64,	{ LIA } },
+
+{ "rotlw",   MME(23,31,0), MMBME_MASK,	PPCCOM,		{ RA, RS, RB } },
+{ "rlwnm",   M(23,0),	M_MASK,		PPCCOM,		{ RA,RS,RB,MBE,ME } },
+{ "rlnm",    M(23,0),	M_MASK,		PWRCOM,		{ RA,RS,RB,MBE,ME } },
+{ "rotlw.",  MME(23,31,1), MMBME_MASK,	PPCCOM,		{ RA, RS, RB } },
+{ "rlwnm.",  M(23,1),	M_MASK,		PPCCOM,		{ RA,RS,RB,MBE,ME } },
+{ "rlnm.",   M(23,1),	M_MASK,		PWRCOM,		{ RA,RS,RB,MBE,ME } },
+
+{ "nop",     OP(24),	0xffffffff,	PPCCOM,		{ 0 } },
+{ "ori",     OP(24),	OP_MASK,	PPCCOM,		{ RA, RS, UI } },
+{ "oril",    OP(24),	OP_MASK,	PWRCOM,		{ RA, RS, UI } },
+
+{ "oris",    OP(25),	OP_MASK,	PPCCOM,		{ RA, RS, UI } },
+{ "oriu",    OP(25),	OP_MASK,	PWRCOM,		{ RA, RS, UI } },
+
+{ "xori",    OP(26),	OP_MASK,	PPCCOM,		{ RA, RS, UI } },
+{ "xoril",   OP(26),	OP_MASK,	PWRCOM,		{ RA, RS, UI } },
+
+{ "xoris",   OP(27),	OP_MASK,	PPCCOM,		{ RA, RS, UI } },
+{ "xoriu",   OP(27),	OP_MASK,	PWRCOM,		{ RA, RS, UI } },
+
+{ "andi.",   OP(28),	OP_MASK,	PPCCOM,		{ RA, RS, UI } },
+{ "andil.",  OP(28),	OP_MASK,	PWRCOM,		{ RA, RS, UI } },
+
+{ "andis.",  OP(29),	OP_MASK,	PPCCOM,		{ RA, RS, UI } },
+{ "andiu.",  OP(29),	OP_MASK,	PWRCOM,		{ RA, RS, UI } },
+
+{ "rotldi",  MD(30,0,0), MDMB_MASK,	PPC64,		{ RA, RS, SH6 } },
+{ "clrldi",  MD(30,0,0), MDSH_MASK,	PPC64,		{ RA, RS, MB6 } },
+{ "rldicl",  MD(30,0,0), MD_MASK,	PPC64,		{ RA, RS, SH6, MB6 } },
+{ "rotldi.", MD(30,0,1), MDMB_MASK,	PPC64,		{ RA, RS, SH6 } },
+{ "clrldi.", MD(30,0,1), MDSH_MASK,	PPC64,		{ RA, RS, MB6 } },
+{ "rldicl.", MD(30,0,1), MD_MASK,	PPC64,		{ RA, RS, SH6, MB6 } },
+
+{ "rldicr",  MD(30,1,0), MD_MASK,	PPC64,		{ RA, RS, SH6, ME6 } },
+{ "rldicr.", MD(30,1,1), MD_MASK,	PPC64,		{ RA, RS, SH6, ME6 } },
+
+{ "rldic",   MD(30,2,0), MD_MASK,	PPC64,		{ RA, RS, SH6, MB6 } },
+{ "rldic.",  MD(30,2,1), MD_MASK,	PPC64,		{ RA, RS, SH6, MB6 } },
+
+{ "rldimi",  MD(30,3,0), MD_MASK,	PPC64,		{ RA, RS, SH6, MB6 } },
+{ "rldimi.", MD(30,3,1), MD_MASK,	PPC64,		{ RA, RS, SH6, MB6 } },
+
+{ "rotld",   MDS(30,8,0), MDSMB_MASK,	PPC64,		{ RA, RS, RB } },
+{ "rldcl",   MDS(30,8,0), MDS_MASK,	PPC64,		{ RA, RS, RB, MB6 } },
+{ "rotld.",  MDS(30,8,1), MDSMB_MASK,	PPC64,		{ RA, RS, RB } },
+{ "rldcl.",  MDS(30,8,1), MDS_MASK,	PPC64,		{ RA, RS, RB, MB6 } },
 
-{ "rldcr",   MDS(30,9,0), MDS_MASK,	PPC|B64,	{ RA, RS, RB, ME6 } },
-{ "rldcr.",  MDS(30,9,1), MDS_MASK,	PPC|B64,	{ RA, RS, RB, ME6 } },
+{ "rldcr",   MDS(30,9,0), MDS_MASK,	PPC64,		{ RA, RS, RB, ME6 } },
+{ "rldcr.",  MDS(30,9,1), MDS_MASK,	PPC64,		{ RA, RS, RB, ME6 } },
 
-{ "cmpw",    XCMPL(31,0,0), XCMPL_MASK, PPC,		{ OBF, RA, RB } },
-{ "cmpd",    XCMPL(31,0,1), XCMPL_MASK, PPC|B64,	{ OBF, RA, RB } },
+{ "cmpw",    XCMPL(31,0,0), XCMPL_MASK, PPCCOM,		{ OBF, RA, RB } },
+{ "cmpd",    XCMPL(31,0,1), XCMPL_MASK, PPC64,		{ OBF, RA, RB } },
 { "cmp",     X(31,0),	XCMP_MASK,	PPC,		{ BF, L, RA, RB } },
-{ "cmp",     X(31,0),	XCMPL_MASK,	POWER,		{ BF, RA, RB } },
+{ "cmp",     X(31,0),	XCMPL_MASK,	PWRCOM,		{ BF, RA, RB } },
 
-{ "twlgt",   XTO(31,4,TOLGT), XTO_MASK, PPC,		{ RA, RB } },
-{ "tlgt",    XTO(31,4,TOLGT), XTO_MASK, POWER,		{ RA, RB } },
-{ "twllt",   XTO(31,4,TOLLT), XTO_MASK, PPC,		{ RA, RB } },
-{ "tllt",    XTO(31,4,TOLLT), XTO_MASK, POWER,		{ RA, RB } },
-{ "tweq",    XTO(31,4,TOEQ), XTO_MASK,	PPC,		{ RA, RB } },
-{ "teq",     XTO(31,4,TOEQ), XTO_MASK,	POWER,		{ RA, RB } },
-{ "twlge",   XTO(31,4,TOLGE), XTO_MASK, PPC,		{ RA, RB } },
-{ "tlge",    XTO(31,4,TOLGE), XTO_MASK, POWER,		{ RA, RB } },
-{ "twlnl",   XTO(31,4,TOLNL), XTO_MASK, PPC,		{ RA, RB } },
-{ "tlnl",    XTO(31,4,TOLNL), XTO_MASK, POWER,		{ RA, RB } },
-{ "twlle",   XTO(31,4,TOLLE), XTO_MASK, PPC,		{ RA, RB } },
-{ "tlle",    XTO(31,4,TOLLE), XTO_MASK, POWER,		{ RA, RB } },
-{ "twlng",   XTO(31,4,TOLNG), XTO_MASK, PPC,		{ RA, RB } },
-{ "tlng",    XTO(31,4,TOLNG), XTO_MASK, POWER,		{ RA, RB } },
-{ "twgt",    XTO(31,4,TOGT), XTO_MASK,	PPC,		{ RA, RB } },
-{ "tgt",     XTO(31,4,TOGT), XTO_MASK,	POWER,		{ RA, RB } },
-{ "twge",    XTO(31,4,TOGE), XTO_MASK,	PPC,		{ RA, RB } },
-{ "tge",     XTO(31,4,TOGE), XTO_MASK,	POWER,		{ RA, RB } },
-{ "twnl",    XTO(31,4,TONL), XTO_MASK,	PPC,		{ RA, RB } },
-{ "tnl",     XTO(31,4,TONL), XTO_MASK,	POWER,		{ RA, RB } },
-{ "twlt",    XTO(31,4,TOLT), XTO_MASK,	PPC,		{ RA, RB } },
-{ "tlt",     XTO(31,4,TOLT), XTO_MASK,	POWER,		{ RA, RB } },
-{ "twle",    XTO(31,4,TOLE), XTO_MASK,	PPC,		{ RA, RB } },
-{ "tle",     XTO(31,4,TOLE), XTO_MASK,	POWER,		{ RA, RB } },
-{ "twng",    XTO(31,4,TONG), XTO_MASK,	PPC,		{ RA, RB } },
-{ "tng",     XTO(31,4,TONG), XTO_MASK,	POWER,		{ RA, RB } },
-{ "twne",    XTO(31,4,TONE), XTO_MASK,	PPC,		{ RA, RB } },
-{ "tne",     XTO(31,4,TONE), XTO_MASK,	POWER,		{ RA, RB } },
-{ "trap",    XTO(31,4,TOU), 0xffffffff,	PPC,		{ 0 } },
-{ "tw",      X(31,4),	X_MASK,		PPC,		{ TO, RA, RB } },
-{ "t",       X(31,4),	X_MASK,		POWER,		{ TO, RA, RB } },
+{ "twlgt",   XTO(31,4,TOLGT), XTO_MASK, PPCCOM,		{ RA, RB } },
+{ "tlgt",    XTO(31,4,TOLGT), XTO_MASK, PWRCOM,		{ RA, RB } },
+{ "twllt",   XTO(31,4,TOLLT), XTO_MASK, PPCCOM,		{ RA, RB } },
+{ "tllt",    XTO(31,4,TOLLT), XTO_MASK, PWRCOM,		{ RA, RB } },
+{ "tweq",    XTO(31,4,TOEQ), XTO_MASK,	PPCCOM,		{ RA, RB } },
+{ "teq",     XTO(31,4,TOEQ), XTO_MASK,	PWRCOM,		{ RA, RB } },
+{ "twlge",   XTO(31,4,TOLGE), XTO_MASK, PPCCOM,		{ RA, RB } },
+{ "tlge",    XTO(31,4,TOLGE), XTO_MASK, PWRCOM,		{ RA, RB } },
+{ "twlnl",   XTO(31,4,TOLNL), XTO_MASK, PPCCOM,		{ RA, RB } },
+{ "tlnl",    XTO(31,4,TOLNL), XTO_MASK, PWRCOM,		{ RA, RB } },
+{ "twlle",   XTO(31,4,TOLLE), XTO_MASK, PPCCOM,		{ RA, RB } },
+{ "tlle",    XTO(31,4,TOLLE), XTO_MASK, PWRCOM,		{ RA, RB } },
+{ "twlng",   XTO(31,4,TOLNG), XTO_MASK, PPCCOM,		{ RA, RB } },
+{ "tlng",    XTO(31,4,TOLNG), XTO_MASK, PWRCOM,		{ RA, RB } },
+{ "twgt",    XTO(31,4,TOGT), XTO_MASK,	PPCCOM,		{ RA, RB } },
+{ "tgt",     XTO(31,4,TOGT), XTO_MASK,	PWRCOM,		{ RA, RB } },
+{ "twge",    XTO(31,4,TOGE), XTO_MASK,	PPCCOM,		{ RA, RB } },
+{ "tge",     XTO(31,4,TOGE), XTO_MASK,	PWRCOM,		{ RA, RB } },
+{ "twnl",    XTO(31,4,TONL), XTO_MASK,	PPCCOM,		{ RA, RB } },
+{ "tnl",     XTO(31,4,TONL), XTO_MASK,	PWRCOM,		{ RA, RB } },
+{ "twlt",    XTO(31,4,TOLT), XTO_MASK,	PPCCOM,		{ RA, RB } },
+{ "tlt",     XTO(31,4,TOLT), XTO_MASK,	PWRCOM,		{ RA, RB } },
+{ "twle",    XTO(31,4,TOLE), XTO_MASK,	PPCCOM,		{ RA, RB } },
+{ "tle",     XTO(31,4,TOLE), XTO_MASK,	PWRCOM,		{ RA, RB } },
+{ "twng",    XTO(31,4,TONG), XTO_MASK,	PPCCOM,		{ RA, RB } },
+{ "tng",     XTO(31,4,TONG), XTO_MASK,	PWRCOM,		{ RA, RB } },
+{ "twne",    XTO(31,4,TONE), XTO_MASK,	PPCCOM,		{ RA, RB } },
+{ "tne",     XTO(31,4,TONE), XTO_MASK,	PWRCOM,		{ RA, RB } },
+{ "trap",    XTO(31,4,TOU), 0xffffffff,	PPCCOM,		{ 0 } },
+{ "tw",      X(31,4),	X_MASK,		PPCCOM,		{ TO, RA, RB } },
+{ "t",       X(31,4),	X_MASK,		PWRCOM,		{ TO, RA, RB } },
 
-{ "subfc",   XO(31,8,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "sf",      XO(31,8,0,0), XO_MASK,	POWER,		{ RT, RA, RB } },
+{ "subfc",   XO(31,8,0,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "sf",      XO(31,8,0,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
 { "subc",    XO(31,8,0,0), XO_MASK,	PPC,		{ RT, RB, RA } },
-{ "subfc.",  XO(31,8,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "sf.",     XO(31,8,0,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "subc.",   XO(31,8,0,1), XO_MASK,	PPC,		{ RT, RB, RA } },
-{ "subfco",  XO(31,8,1,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "sfo",     XO(31,8,1,0), XO_MASK,	POWER,		{ RT, RA, RB } },
+{ "subfc.",  XO(31,8,0,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "sf.",     XO(31,8,0,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "subc.",   XO(31,8,0,1), XO_MASK,	PPCCOM,		{ RT, RB, RA } },
+{ "subfco",  XO(31,8,1,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "sfo",     XO(31,8,1,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
 { "subco",   XO(31,8,1,0), XO_MASK,	PPC,		{ RT, RB, RA } },
-{ "subfco.", XO(31,8,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "sfo.",    XO(31,8,1,1), XO_MASK,	POWER,		{ RT, RA, RB } },
+{ "subfco.", XO(31,8,1,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "sfo.",    XO(31,8,1,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
 { "subco.",  XO(31,8,1,1), XO_MASK,	PPC,		{ RT, RB, RA } },
 
-{ "mulhdu",  XO(31,9,0,0), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "mulhdu.", XO(31,9,0,1), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
+{ "mulhdu",  XO(31,9,0,0), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "mulhdu.", XO(31,9,0,1), XO_MASK,	PPC64,		{ RT, RA, RB } },
 
-{ "addc",    XO(31,10,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "a",       XO(31,10,0,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "addc.",   XO(31,10,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "a.",      XO(31,10,0,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "addco",   XO(31,10,1,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "ao",      XO(31,10,1,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "addco.",  XO(31,10,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "ao.",     XO(31,10,1,1), XO_MASK,	POWER,		{ RT, RA, RB } },
+{ "addc",    XO(31,10,0,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "a",       XO(31,10,0,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "addc.",   XO(31,10,0,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "a.",      XO(31,10,0,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "addco",   XO(31,10,1,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "ao",      XO(31,10,1,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "addco.",  XO(31,10,1,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "ao.",     XO(31,10,1,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
 
 { "mulhwu",  XO(31,11,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "mulhwu.", XO(31,11,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
 
-{ "mfcr",    X(31,19),	XRARB_MASK,	POWER|PPC,	{ RT } },
+{ "isellt",  X(31,15),      X_MASK,	PPCISEL,	{ RT, RA, RB } },
+{ "iselgt",  X(31,47),      X_MASK,	PPCISEL,	{ RT, RA, RB } },
+{ "iseleq",  X(31,79),      X_MASK,	PPCISEL,	{ RT, RA, RB } },
+{ "isel",    XISEL(31,15),  XISEL_MASK,	PPCISEL,	{ RT, RA, RB, CRB } },
+
+{ "mfcr",    X(31,19),	XRARB_MASK,	NOPOWER4,	{ RT } },
+{ "mfcr",    X(31,19),	XFXFXM_MASK,	POWER4,		{ RT, FXM4 } },
 
 { "lwarx",   X(31,20),	X_MASK,		PPC,		{ RT, RA, RB } },
 
-{ "ldx",     X(31,21),	X_MASK,		PPC|B64,	{ RT, RA, RB } },
+{ "ldx",     X(31,21),	X_MASK,		PPC64,		{ RT, RA, RB } },
+
+{ "icbt",    X(31,22),	X_MASK,		BOOKE,		{ CT, RA, RB } },
+{ "icbt",    X(31,262),	XRT_MASK,	PPC403,		{ RA, RB } },
+
+{ "lwzx",    X(31,23),	X_MASK,		PPCCOM,		{ RT, RA, RB } },
+{ "lx",      X(31,23),	X_MASK,		PWRCOM,		{ RT, RA, RB } },
+
+{ "slw",     XRC(31,24,0), X_MASK,	PPCCOM,		{ RA, RS, RB } },
+{ "sl",      XRC(31,24,0), X_MASK,	PWRCOM,		{ RA, RS, RB } },
+{ "slw.",    XRC(31,24,1), X_MASK,	PPCCOM,		{ RA, RS, RB } },
+{ "sl.",     XRC(31,24,1), X_MASK,	PWRCOM,		{ RA, RS, RB } },
+
+{ "cntlzw",  XRC(31,26,0), XRB_MASK,	PPCCOM,		{ RA, RS } },
+{ "cntlz",   XRC(31,26,0), XRB_MASK,	PWRCOM,		{ RA, RS } },
+{ "cntlzw.", XRC(31,26,1), XRB_MASK,	PPCCOM,		{ RA, RS } },
+{ "cntlz.",  XRC(31,26,1), XRB_MASK, 	PWRCOM,		{ RA, RS } },
+
+{ "sld",     XRC(31,27,0), X_MASK,	PPC64,		{ RA, RS, RB } },
+{ "sld.",    XRC(31,27,1), X_MASK,	PPC64,		{ RA, RS, RB } },
+
+{ "and",     XRC(31,28,0), X_MASK,	COM,		{ RA, RS, RB } },
+{ "and.",    XRC(31,28,1), X_MASK,	COM,		{ RA, RS, RB } },
+
+{ "maskg",   XRC(31,29,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "maskg.",  XRC(31,29,1), X_MASK,	M601,		{ RA, RS, RB } },
 
-{ "lwzx",    X(31,23),	X_MASK,		PPC,		{ RT, RA, RB } },
-{ "lx",      X(31,23),	X_MASK,		POWER,		{ RT, RA, RB } },
+{ "icbte",   X(31,30),	X_MASK,		BOOKE64,	{ CT, RA, RB } },
 
-{ "slw",     XRC(31,24,0), X_MASK,	PPC,		{ RA, RS, RB } },
-{ "sl",      XRC(31,24,0), X_MASK,	POWER,		{ RA, RS, RB } },
-{ "slw.",    XRC(31,24,1), X_MASK,	PPC,		{ RA, RS, RB } },
-{ "sl.",     XRC(31,24,1), X_MASK,	POWER,		{ RA, RS, RB } },
-
-{ "cntlzw",  XRC(31,26,0), XRB_MASK,	PPC,		{ RA, RS } },
-{ "cntlz",   XRC(31,26,0), XRB_MASK,	POWER,		{ RA, RS } },
-{ "cntlzw.", XRC(31,26,1), XRB_MASK,	PPC,		{ RA, RS } },
-{ "cntlz.",  XRC(31,26,1), XRB_MASK, 	POWER,		{ RA, RS } },
-
-{ "sld",     XRC(31,27,0), X_MASK,	PPC|B64,	{ RA, RS, RB } },
-{ "sld.",    XRC(31,27,1), X_MASK,	PPC|B64,	{ RA, RS, RB } },
-
-{ "and",     XRC(31,28,0), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-{ "and.",    XRC(31,28,1), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-
-{ "maskg",   XRC(31,29,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "maskg.",  XRC(31,29,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-
-{ "cmplw",   XCMPL(31,32,0), XCMPL_MASK, PPC,		{ OBF, RA, RB } },
-{ "cmpld",   XCMPL(31,32,1), XCMPL_MASK, PPC|B64,	{ OBF, RA, RB } },
-{ "cmpl",    X(31,32),	XCMP_MASK,	PPC,		{ BF, L, RA, RB } },
-{ "cmpl",    X(31,32),	XCMPL_MASK,	POWER,		{ BF, RA, RB } },
+{ "lwzxe",   X(31,31),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
+
+{ "cmplw",   XCMPL(31,32,0), XCMPL_MASK, PPCCOM,	{ OBF, RA, RB } },
+{ "cmpld",   XCMPL(31,32,1), XCMPL_MASK, PPC64,		{ OBF, RA, RB } },
+{ "cmpl",    X(31,32),	XCMP_MASK,	 PPC,		{ BF, L, RA, RB } },
+{ "cmpl",    X(31,32),	XCMPL_MASK,	 PWRCOM,	{ BF, RA, RB } },
 
 { "subf",    XO(31,40,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "sub",     XO(31,40,0,0), XO_MASK,	PPC,		{ RT, RB, RA } },
@@ -1969,279 +3277,550 @@
 { "subfo.",  XO(31,40,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "subo.",   XO(31,40,1,1), XO_MASK,	PPC,		{ RT, RB, RA } },
 
-{ "ldux",    X(31,53),	X_MASK,		PPC|B64,	{ RT, RAL, RB } },
+{ "ldux",    X(31,53),	X_MASK,		PPC64,		{ RT, RAL, RB } },
 
 { "dcbst",   X(31,54),	XRT_MASK,	PPC,		{ RA, RB } },
 
-{ "lwzux",   X(31,55),	X_MASK,		PPC,		{ RT, RAL, RB } },
-{ "lux",     X(31,55),	X_MASK,		POWER,		{ RT, RA, RB } },
+{ "lwzux",   X(31,55),	X_MASK,		PPCCOM,		{ RT, RAL, RB } },
+{ "lux",     X(31,55),	X_MASK,		PWRCOM,		{ RT, RA, RB } },
 
-{ "cntlzd",  XRC(31,58,0), XRB_MASK,	PPC|B64,	{ RA, RS } },
-{ "cntlzd.", XRC(31,58,1), XRB_MASK,	PPC|B64,	{ RA, RS } },
+{ "dcbste",  X(31,62),	XRT_MASK,	BOOKE64,	{ RA, RB } },
 
-{ "andc",    XRC(31,60,0), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-{ "andc.",   XRC(31,60,1), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
+{ "lwzuxe",  X(31,63),	X_MASK,		BOOKE64,	{ RT, RAL, RB } },
 
-{ "tdlgt",   XTO(31,68,TOLGT), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdllt",   XTO(31,68,TOLLT), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdeq",    XTO(31,68,TOEQ), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdlge",   XTO(31,68,TOLGE), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdlnl",   XTO(31,68,TOLNL), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdlle",   XTO(31,68,TOLLE), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdlng",   XTO(31,68,TOLNG), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdgt",    XTO(31,68,TOGT), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdge",    XTO(31,68,TOGE), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdnl",    XTO(31,68,TONL), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdlt",    XTO(31,68,TOLT), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdle",    XTO(31,68,TOLE), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdng",    XTO(31,68,TONG), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "tdne",    XTO(31,68,TONE), XTO_MASK, PPC|B64,	{ RA, RB } },
-{ "td",	     X(31,68),	X_MASK,		PPC|B64,	{ TO, RA, RB } },
+{ "cntlzd",  XRC(31,58,0), XRB_MASK,	PPC64,		{ RA, RS } },
+{ "cntlzd.", XRC(31,58,1), XRB_MASK,	PPC64,		{ RA, RS } },
+
+{ "andc",    XRC(31,60,0), X_MASK,	COM,		{ RA, RS, RB } },
+{ "andc.",   XRC(31,60,1), X_MASK,	COM,		{ RA, RS, RB } },
+
+{ "tdlgt",   XTO(31,68,TOLGT), XTO_MASK, PPC64,		{ RA, RB } },
+{ "tdllt",   XTO(31,68,TOLLT), XTO_MASK, PPC64,		{ RA, RB } },
+{ "tdeq",    XTO(31,68,TOEQ), XTO_MASK,  PPC64,		{ RA, RB } },
+{ "tdlge",   XTO(31,68,TOLGE), XTO_MASK, PPC64,		{ RA, RB } },
+{ "tdlnl",   XTO(31,68,TOLNL), XTO_MASK, PPC64,		{ RA, RB } },
+{ "tdlle",   XTO(31,68,TOLLE), XTO_MASK, PPC64,		{ RA, RB } },
+{ "tdlng",   XTO(31,68,TOLNG), XTO_MASK, PPC64,		{ RA, RB } },
+{ "tdgt",    XTO(31,68,TOGT), XTO_MASK,  PPC64,		{ RA, RB } },
+{ "tdge",    XTO(31,68,TOGE), XTO_MASK,  PPC64,		{ RA, RB } },
+{ "tdnl",    XTO(31,68,TONL), XTO_MASK,  PPC64,		{ RA, RB } },
+{ "tdlt",    XTO(31,68,TOLT), XTO_MASK,  PPC64,		{ RA, RB } },
+{ "tdle",    XTO(31,68,TOLE), XTO_MASK,  PPC64,		{ RA, RB } },
+{ "tdng",    XTO(31,68,TONG), XTO_MASK,  PPC64,		{ RA, RB } },
+{ "tdne",    XTO(31,68,TONE), XTO_MASK,  PPC64,		{ RA, RB } },
+{ "td",	     X(31,68),	X_MASK,		 PPC64,		{ TO, RA, RB } },
 
-{ "mulhd",   XO(31,73,0,0), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "mulhd.",  XO(31,73,0,1), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
+{ "mulhd",   XO(31,73,0,0), XO_MASK,	 PPC64,		{ RT, RA, RB } },
+{ "mulhd.",  XO(31,73,0,1), XO_MASK,	 PPC64,		{ RT, RA, RB } },
 
 { "mulhw",   XO(31,75,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "mulhw.",  XO(31,75,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
 
-{ "mfmsr",   X(31,83),	XRARB_MASK,	PPC|POWER,	{ RT } },
+{ "dlmzb",   XRC(31,78,0),  X_MASK,	PPC403|PPC440,	{ RA, RS, RB } },
+{ "dlmzb.",  XRC(31,78,1),  X_MASK,	PPC403|PPC440,	{ RA, RS, RB } },
+
+{ "mtsrd",   X(31,82),	XRB_MASK|(1<<20), PPC64,	{ SR, RS } },
+
+{ "mfmsr",   X(31,83),	XRARB_MASK,	COM,		{ RT } },
 
-{ "ldarx",   X(31,84),	X_MASK,		PPC|B64,	{ RT, RA, RB } },
+{ "ldarx",   X(31,84),	X_MASK,		PPC64,		{ RT, RA, RB } },
 
 { "dcbf",    X(31,86),	XRT_MASK,	PPC,		{ RA, RB } },
 
-{ "lbzx",    X(31,87),	X_MASK,		PPC|POWER,	{ RT, RA, RB } },
+{ "lbzx",    X(31,87),	X_MASK,		COM,		{ RT, RA, RB } },
+
+{ "dcbfe",   X(31,94),	XRT_MASK,	BOOKE64,	{ RA, RB } },
+
+{ "lbzxe",   X(31,95),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
+
+{ "neg",     XO(31,104,0,0), XORB_MASK,	COM,		{ RT, RA } },
+{ "neg.",    XO(31,104,0,1), XORB_MASK,	COM,		{ RT, RA } },
+{ "nego",    XO(31,104,1,0), XORB_MASK,	COM,		{ RT, RA } },
+{ "nego.",   XO(31,104,1,1), XORB_MASK,	COM,		{ RT, RA } },
+
+{ "mul",     XO(31,107,0,0), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "mul.",    XO(31,107,0,1), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "mulo",    XO(31,107,1,0), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "mulo.",   XO(31,107,1,1), XO_MASK,	M601,		{ RT, RA, RB } },
+
+{ "mtsrdin", X(31,114),	XRA_MASK,	PPC64,		{ RS, RB } },
+
+{ "clf",     X(31,118), XTO_MASK,	POWER,		{ RA, RB } },
 
-{ "neg",     XO(31,104,0,0), XORB_MASK,	PPC|POWER,	{ RT, RA } },
-{ "neg.",    XO(31,104,0,1), XORB_MASK,	PPC|POWER,	{ RT, RA } },
-{ "nego",    XO(31,104,1,0), XORB_MASK,	PPC|POWER,	{ RT, RA } },
-{ "nego.",   XO(31,104,1,1), XORB_MASK,	PPC|POWER,	{ RT, RA } },
-
-{ "mul",     XO(31,107,0,0), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "mul.",    XO(31,107,0,1), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "mulo",    XO(31,107,1,0), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "mulo.",   XO(31,107,1,1), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-
-{ "clf",     X(31,118), XRB_MASK,	POWER,		{ RT, RA } },
-
-{ "lbzux",   X(31,119),	X_MASK,		PPC|POWER,	{ RT, RAL, RB } },
-
-{ "not",     XRC(31,124,0), X_MASK,	PPC|POWER,	{ RA, RS, RBS } },
-{ "nor",     XRC(31,124,0), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-{ "not.",    XRC(31,124,1), X_MASK,	PPC|POWER,	{ RA, RS, RBS } },
-{ "nor.",    XRC(31,124,1), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-
-{ "subfe",   XO(31,136,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "sfe",     XO(31,136,0,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "subfe.",  XO(31,136,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "sfe.",    XO(31,136,0,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "subfeo",  XO(31,136,1,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "sfeo",    XO(31,136,1,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "subfeo.", XO(31,136,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "sfeo.",   XO(31,136,1,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-
-{ "adde",    XO(31,138,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "ae",      XO(31,138,0,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "adde.",   XO(31,138,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "ae.",     XO(31,138,0,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "addeo",   XO(31,138,1,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "aeo",     XO(31,138,1,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "addeo.",  XO(31,138,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "aeo.",    XO(31,138,1,1), XO_MASK,	POWER,		{ RT, RA, RB } },
+{ "lbzux",   X(31,119),	X_MASK,		COM,		{ RT, RAL, RB } },
 
-{ "mtcr",    XFXM(31,144,0xff), XFXFXM_MASK|FXM_MASK, PPC|POWER, { RS }},
-{ "mtcrf",   X(31,144),	XFXFXM_MASK,	PPC|POWER,	{ FXM, RS } },
+{ "not",     XRC(31,124,0), X_MASK,	COM,		{ RA, RS, RBS } },
+{ "nor",     XRC(31,124,0), X_MASK,	COM,		{ RA, RS, RB } },
+{ "not.",    XRC(31,124,1), X_MASK,	COM,		{ RA, RS, RBS } },
+{ "nor.",    XRC(31,124,1), X_MASK,	COM,		{ RA, RS, RB } },
 
-{ "mtmsr",   X(31,146),	XRARB_MASK,	PPC|POWER,	{ RS } },
-{ "mtmsrd",  X(31,178),	XRARB_MASK,	PPC|POWER,	{ RS } },
+{ "lwarxe",  X(31,126),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
 
-{ "stdx",    X(31,149), X_MASK,		PPC|B64,	{ RS, RA, RB } },
+{ "lbzuxe",  X(31,127),	X_MASK,		BOOKE64,	{ RT, RAL, RB } },
+
+{ "wrtee",   X(31,131),	XRARB_MASK,	PPC403 | BOOKE,	{ RS } },
+
+{ "dcbtstls",X(31,134),	X_MASK,		PPCCHLK,	{ CT, RA, RB }},
+
+{ "subfe",   XO(31,136,0,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "sfe",     XO(31,136,0,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "subfe.",  XO(31,136,0,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "sfe.",    XO(31,136,0,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "subfeo",  XO(31,136,1,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "sfeo",    XO(31,136,1,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "subfeo.", XO(31,136,1,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "sfeo.",   XO(31,136,1,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+
+{ "adde",    XO(31,138,0,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "ae",      XO(31,138,0,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "adde.",   XO(31,138,0,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "ae.",     XO(31,138,0,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "addeo",   XO(31,138,1,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "aeo",     XO(31,138,1,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "addeo.",  XO(31,138,1,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "aeo.",    XO(31,138,1,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+
+{ "dcbtstlse",X(31,142),X_MASK,		PPCCHLK64,	{ CT, RA, RB }},
+
+{ "mtcr",    XFXM(31,144,0xff), XRARB_MASK, COM,	{ RS }},
+{ "mtcrf",   X(31,144),	XFXFXM_MASK,	COM,		{ FXM, RS } },
+
+{ "mtmsr",   X(31,146),	XRARB_MASK,	COM,		{ RS } },
+
+{ "stdx",    X(31,149), X_MASK,		PPC64,		{ RS, RA, RB } },
 
 { "stwcx.",  XRC(31,150,1), X_MASK,	PPC,		{ RS, RA, RB } },
 
-{ "stwx",    X(31,151), X_MASK,		PPC,		{ RS, RA, RB } },
-{ "stx",     X(31,151), X_MASK,		POWER,		{ RS, RA, RB } },
+{ "stwx",    X(31,151), X_MASK,		PPCCOM,		{ RS, RA, RB } },
+{ "stx",     X(31,151), X_MASK,		PWRCOM,		{ RS, RA, RB } },
+
+{ "stwcxe.", XRC(31,158,1), X_MASK,	BOOKE64,	{ RS, RA, RB } },
+
+{ "stwxe",   X(31,159), X_MASK,		BOOKE64,	{ RS, RA, RB } },
+
+{ "slq",     XRC(31,152,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "slq.",    XRC(31,152,1), X_MASK,	M601,		{ RA, RS, RB } },
+
+{ "sle",     XRC(31,153,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "sle.",    XRC(31,153,1), X_MASK,	M601,		{ RA, RS, RB } },
+
+{ "wrteei",  X(31,163),	XE_MASK,	PPC403 | BOOKE,	{ E } },
+
+{ "dcbtls",  X(31,166),	X_MASK,		PPCCHLK,	{ CT, RA, RB }},
+{ "dcbtlse", X(31,174),	X_MASK,		PPCCHLK64,	{ CT, RA, RB }},
+
+{ "mtmsrd",  X(31,178),	XRLARB_MASK,	PPC64,		{ RS, MTMSRD_L } },
+
+{ "stdux",   X(31,181),	X_MASK,		PPC64,		{ RS, RAS, RB } },
+
+{ "stwux",   X(31,183),	X_MASK,		PPCCOM,		{ RS, RAS, RB } },
+{ "stux",    X(31,183),	X_MASK,		PWRCOM,		{ RS, RA, RB } },
+
+{ "sliq",    XRC(31,184,0), X_MASK,	M601,		{ RA, RS, SH } },
+{ "sliq.",   XRC(31,184,1), X_MASK,	M601,		{ RA, RS, SH } },
+
+{ "stwuxe",  X(31,191),	X_MASK,		BOOKE64,	{ RS, RAS, RB } },
 
-{ "slq",     XRC(31,152,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "slq.",    XRC(31,152,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "subfze",  XO(31,200,0,0), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "sfze",    XO(31,200,0,0), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "subfze.", XO(31,200,0,1), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "sfze.",   XO(31,200,0,1), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "subfzeo", XO(31,200,1,0), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "sfzeo",   XO(31,200,1,0), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "subfzeo.",XO(31,200,1,1), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "sfzeo.",  XO(31,200,1,1), XORB_MASK, PWRCOM,		{ RT, RA } },
 
-{ "sle",     XRC(31,153,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "sle.",    XRC(31,153,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "addze",   XO(31,202,0,0), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "aze",     XO(31,202,0,0), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "addze.",  XO(31,202,0,1), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "aze.",    XO(31,202,0,1), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "addzeo",  XO(31,202,1,0), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "azeo",    XO(31,202,1,0), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "addzeo.", XO(31,202,1,1), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "azeo.",   XO(31,202,1,1), XORB_MASK, PWRCOM,		{ RT, RA } },
 
-{ "stdux",   X(31,181),	X_MASK,		PPC|B64,	{ RS, RAS, RB } },
-
-{ "stwux",   X(31,183),	X_MASK,		PPC,		{ RS, RAS, RB } },
-{ "stux",    X(31,183),	X_MASK,		POWER,		{ RS, RA, RB } },
-
-{ "sliq",    XRC(31,184,0), X_MASK,	POWER|M601,	{ RA, RS, SH } },
-{ "sliq.",   XRC(31,184,1), X_MASK,	POWER|M601,	{ RA, RS, SH } },
-
-{ "subfze",  XO(31,200,0,0), XORB_MASK, PPC,		{ RT, RA } },
-{ "sfze",    XO(31,200,0,0), XORB_MASK, POWER,		{ RT, RA } },
-{ "subfze.", XO(31,200,0,1), XORB_MASK, PPC,		{ RT, RA } },
-{ "sfze.",   XO(31,200,0,1), XORB_MASK, POWER,		{ RT, RA } },
-{ "subfzeo", XO(31,200,1,0), XORB_MASK, PPC,		{ RT, RA } },
-{ "sfzeo",   XO(31,200,1,0), XORB_MASK, POWER,		{ RT, RA } },
-{ "subfzeo.",XO(31,200,1,1), XORB_MASK, PPC,		{ RT, RA } },
-{ "sfzeo.",  XO(31,200,1,1), XORB_MASK, POWER,		{ RT, RA } },
-
-{ "addze",   XO(31,202,0,0), XORB_MASK, PPC,		{ RT, RA } },
-{ "aze",     XO(31,202,0,0), XORB_MASK, POWER,		{ RT, RA } },
-{ "addze.",  XO(31,202,0,1), XORB_MASK, PPC,		{ RT, RA } },
-{ "aze.",    XO(31,202,0,1), XORB_MASK, POWER,		{ RT, RA } },
-{ "addzeo",  XO(31,202,1,0), XORB_MASK, PPC,		{ RT, RA } },
-{ "azeo",    XO(31,202,1,0), XORB_MASK, POWER,		{ RT, RA } },
-{ "addzeo.", XO(31,202,1,1), XORB_MASK, PPC,		{ RT, RA } },
-{ "azeo.",   XO(31,202,1,1), XORB_MASK, POWER,		{ RT, RA } },
-
-{ "mtsr",    X(31,210),	XRB_MASK|(1<<20), PPC|POWER|B32, { SR, RS } },
-
-{ "stdcx.",  XRC(31,214,1), X_MASK,	PPC|B64,	{ RS, RA, RB } },
-
-{ "stbx",    X(31,215),	X_MASK,		PPC|POWER,	{ RS, RA, RB } },
-
-{ "sllq",    XRC(31,216,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "sllq.",   XRC(31,216,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-
-{ "sleq",    XRC(31,217,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "sleq.",   XRC(31,217,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-
-{ "subfme",  XO(31,232,0,0), XORB_MASK, PPC,		{ RT, RA } },
-{ "sfme",    XO(31,232,0,0), XORB_MASK, POWER,		{ RT, RA } },
-{ "subfme.", XO(31,232,0,1), XORB_MASK, PPC,		{ RT, RA } },
-{ "sfme.",   XO(31,232,0,1), XORB_MASK, POWER,		{ RT, RA } },
-{ "subfmeo", XO(31,232,1,0), XORB_MASK, PPC,		{ RT, RA } },
-{ "sfmeo",   XO(31,232,1,0), XORB_MASK, POWER,		{ RT, RA } },
-{ "subfmeo.",XO(31,232,1,1), XORB_MASK, PPC,		{ RT, RA } },
-{ "sfmeo.",  XO(31,232,1,1), XORB_MASK, POWER,		{ RT, RA } },
-
-{ "mulld",   XO(31,233,0,0), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "mulld.",  XO(31,233,0,1), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "mulldo",  XO(31,233,1,0), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "mulldo.", XO(31,233,1,1), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-
-{ "addme",   XO(31,234,0,0), XORB_MASK, PPC,		{ RT, RA } },
-{ "ame",     XO(31,234,0,0), XORB_MASK, POWER,		{ RT, RA } },
-{ "addme.",  XO(31,234,0,1), XORB_MASK, PPC,		{ RT, RA } },
-{ "ame.",    XO(31,234,0,1), XORB_MASK, POWER,		{ RT, RA } },
-{ "addmeo",  XO(31,234,1,0), XORB_MASK, PPC,		{ RT, RA } },
-{ "ameo",    XO(31,234,1,0), XORB_MASK, POWER,		{ RT, RA } },
-{ "addmeo.", XO(31,234,1,1), XORB_MASK, PPC,		{ RT, RA } },
-{ "ameo.",   XO(31,234,1,1), XORB_MASK, POWER,		{ RT, RA } },
-
-{ "mullw",   XO(31,235,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "muls",    XO(31,235,0,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "mullw.",  XO(31,235,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "muls.",   XO(31,235,0,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "mullwo",  XO(31,235,1,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "mulso",   XO(31,235,1,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "mullwo.", XO(31,235,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "mulso.",  XO(31,235,1,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-
-{ "mtsrin",  X(31,242),	XRA_MASK,	PPC|B32,	{ RS, RB } },
-{ "mtsri",   X(31,242),	XRA_MASK,	POWER|B32,	{ RS, RB } },
-
-{ "dcbtst",  X(31,246),	XRT_MASK,	PPC,		{ RA, RB } },
-
-{ "stbux",   X(31,247),	X_MASK,		PPC|POWER,	{ RS, RAS, RB } },
-
-{ "slliq",   XRC(31,248,0), X_MASK,	POWER|M601,	{ RA, RS, SH } },
-{ "slliq.",  XRC(31,248,1), X_MASK,	POWER|M601,	{ RA, RS, SH } },
-
-{ "doz",     XO(31,264,0,0), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "doz.",    XO(31,264,0,1), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "dozo",    XO(31,264,1,0), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "dozo.",   XO(31,264,1,1), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-
-{ "add",     XO(31,266,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "cax",     XO(31,266,0,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "add.",    XO(31,266,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "cax.",    XO(31,266,0,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "addo",    XO(31,266,1,0), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "caxo",    XO(31,266,1,0), XO_MASK,	POWER,		{ RT, RA, RB } },
-{ "addo.",   XO(31,266,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
-{ "caxo.",   XO(31,266,1,1), XO_MASK,	POWER,		{ RT, RA, RB } },
-
-{ "lscbx",   XRC(31,277,0), X_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "lscbx.",  XRC(31,277,1), X_MASK,	POWER|M601,	{ RT, RA, RB } },
-
-{ "dcbt",    X(31,278),	XRT_MASK,	PPC,		{ RA, RB } },
-
-{ "lhzx",    X(31,279),	X_MASK,		PPC|POWER,	{ RT, RA, RB } },
+{ "mtsr",    X(31,210),	XRB_MASK|(1<<20), COM32,	{ SR, RS } },
 
-{ "icbt",    X(31,262),	XRT_MASK,	PPC,		{ RA, RB } },
+{ "stdcx.",  XRC(31,214,1), X_MASK,	PPC64,		{ RS, RA, RB } },
 
-{ "eqv",     XRC(31,284,0), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-{ "eqv.",    XRC(31,284,1), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
+{ "stbx",    X(31,215),	X_MASK,		COM,		{ RS, RA, RB } },
 
-{ "tlbie",   X(31,306),	XRTRA_MASK,	PPC,		{ RB } },
-{ "tlbi",    X(31,306),	XRTRA_MASK,	POWER,		{ RB } },
+{ "sllq",    XRC(31,216,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "sllq.",   XRC(31,216,1), X_MASK,	M601,		{ RA, RS, RB } },
+
+{ "sleq",    XRC(31,217,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "sleq.",   XRC(31,217,1), X_MASK,	M601,		{ RA, RS, RB } },
+
+{ "stbxe",   X(31,223),	X_MASK,		BOOKE64,	{ RS, RA, RB } },
+
+{ "icblc",   X(31,230),	X_MASK,		PPCCHLK,	{ CT, RA, RB }},
+
+{ "subfme",  XO(31,232,0,0), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "sfme",    XO(31,232,0,0), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "subfme.", XO(31,232,0,1), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "sfme.",   XO(31,232,0,1), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "subfmeo", XO(31,232,1,0), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "sfmeo",   XO(31,232,1,0), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "subfmeo.",XO(31,232,1,1), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "sfmeo.",  XO(31,232,1,1), XORB_MASK, PWRCOM,		{ RT, RA } },
+
+{ "mulld",   XO(31,233,0,0), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "mulld.",  XO(31,233,0,1), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "mulldo",  XO(31,233,1,0), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "mulldo.", XO(31,233,1,1), XO_MASK,	PPC64,		{ RT, RA, RB } },
+
+{ "addme",   XO(31,234,0,0), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "ame",     XO(31,234,0,0), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "addme.",  XO(31,234,0,1), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "ame.",    XO(31,234,0,1), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "addmeo",  XO(31,234,1,0), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "ameo",    XO(31,234,1,0), XORB_MASK, PWRCOM,		{ RT, RA } },
+{ "addmeo.", XO(31,234,1,1), XORB_MASK, PPCCOM,		{ RT, RA } },
+{ "ameo.",   XO(31,234,1,1), XORB_MASK, PWRCOM,		{ RT, RA } },
+
+{ "mullw",   XO(31,235,0,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "muls",    XO(31,235,0,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "mullw.",  XO(31,235,0,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "muls.",   XO(31,235,0,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "mullwo",  XO(31,235,1,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "mulso",   XO(31,235,1,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "mullwo.", XO(31,235,1,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "mulso.",  XO(31,235,1,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+
+{ "icblce",  X(31,238),	X_MASK,		PPCCHLK64,	{ CT, RA, RB }},
+{ "mtsrin",  X(31,242),	XRA_MASK,	PPC32,		{ RS, RB } },
+{ "mtsri",   X(31,242),	XRA_MASK,	POWER32,	{ RS, RB } },
+
+{ "dcbtst",  X(31,246),	XRT_MASK,	PPC,		{ CT, RA, RB } },
+
+{ "stbux",   X(31,247),	X_MASK,		COM,		{ RS, RAS, RB } },
+
+{ "slliq",   XRC(31,248,0), X_MASK,	M601,		{ RA, RS, SH } },
+{ "slliq.",  XRC(31,248,1), X_MASK,	M601,		{ RA, RS, SH } },
+
+{ "dcbtste", X(31,253),	X_MASK,		BOOKE64,	{ CT, RA, RB } },
+
+{ "stbuxe",  X(31,255),	X_MASK,		BOOKE64,	{ RS, RAS, RB } },
+
+{ "mfdcrx",  X(31,259),	X_MASK,		BOOKE,		{ RS, RA } },
+
+{ "doz",     XO(31,264,0,0), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "doz.",    XO(31,264,0,1), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "dozo",    XO(31,264,1,0), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "dozo.",   XO(31,264,1,1), XO_MASK,	M601,		{ RT, RA, RB } },
+
+{ "add",     XO(31,266,0,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "cax",     XO(31,266,0,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "add.",    XO(31,266,0,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "cax.",    XO(31,266,0,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "addo",    XO(31,266,1,0), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "caxo",    XO(31,266,1,0), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+{ "addo.",   XO(31,266,1,1), XO_MASK,	PPCCOM,		{ RT, RA, RB } },
+{ "caxo.",   XO(31,266,1,1), XO_MASK,	PWRCOM,		{ RT, RA, RB } },
+
+{ "tlbiel",  X(31,274), XRTRA_MASK,	POWER4,		{ RB } },
+
+{ "mfapidi", X(31,275), X_MASK,		BOOKE,		{ RT, RA } },
+
+{ "lscbx",   XRC(31,277,0), X_MASK,	M601,		{ RT, RA, RB } },
+{ "lscbx.",  XRC(31,277,1), X_MASK,	M601,		{ RT, RA, RB } },
+
+{ "dcbt",    X(31,278),	XRT_MASK,	PPC,		{ CT, RA, RB } },
+
+{ "lhzx",    X(31,279),	X_MASK,		COM,		{ RT, RA, RB } },
+
+{ "eqv",     XRC(31,284,0), X_MASK,	COM,		{ RA, RS, RB } },
+{ "eqv.",    XRC(31,284,1), X_MASK,	COM,		{ RA, RS, RB } },
+
+{ "dcbte",   X(31,286),	X_MASK,		BOOKE64,	{ CT, RA, RB } },
+
+{ "lhzxe",   X(31,287),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
+
+{ "tlbie",   X(31,306),	XRTLRA_MASK,	PPC,		{ RB, L } },
+{ "tlbi",    X(31,306),	XRT_MASK,	POWER,		{ RA, RB } },
 
 { "eciwx",   X(31,310), X_MASK,		PPC,		{ RT, RA, RB } },
 
-{ "lhzux",   X(31,311),	X_MASK,		PPC|POWER,	{ RT, RAL, RB } },
+{ "lhzux",   X(31,311),	X_MASK,		COM,		{ RT, RAL, RB } },
 
-{ "xor",     XRC(31,316,0), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-{ "xor.",    XRC(31,316,1), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
+{ "xor",     XRC(31,316,0), X_MASK,	COM,		{ RA, RS, RB } },
+{ "xor.",    XRC(31,316,1), X_MASK,	COM,		{ RA, RS, RB } },
 
-{ "mfdcr",   X(31,323),	X_MASK,		PPC,		{ RT, SPR } },
+{ "lhzuxe",  X(31,319),	X_MASK,		BOOKE64,	{ RT, RAL, RB } },
 
-{ "div",     XO(31,331,0,0), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "div.",    XO(31,331,0,1), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "divo",    XO(31,331,1,0), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "divo.",   XO(31,331,1,1), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-
-{ "mfmq",    XSPR(31,339,0), XSPR_MASK,	POWER|M601,	{ RT } },
-{ "mfxer",   XSPR(31,339,1), XSPR_MASK,	PPC|POWER,	{ RT } },
-{ "mfrtcu",  XSPR(31,339,4), XSPR_MASK, PPC|POWER,	{ RT } },
-{ "mfrtcl",  XSPR(31,339,5), XSPR_MASK, PPC|POWER,	{ RT } },
-{ "mfdec",   XSPR(31,339,6), XSPR_MASK, POWER|M601,	{ RT } },
-{ "mflr",    XSPR(31,339,8), XSPR_MASK,	PPC|POWER,	{ RT } },
-{ "mfctr",   XSPR(31,339,9), XSPR_MASK,	PPC|POWER,	{ RT } },
-{ "mftid",   XSPR(31,339,17), XSPR_MASK, POWER,		{ RT } },
-{ "mfdsisr", XSPR(31,339,18), XSPR_MASK, PPC|POWER,	{ RT } },
-{ "mfdar",   XSPR(31,339,19), XSPR_MASK, PPC|POWER,	{ RT } },
-{ "mfdec",   XSPR(31,339,22), XSPR_MASK, PPC,		{ RT } },
-{ "mfsdr0",  XSPR(31,339,24), XSPR_MASK, POWER,		{ RT } },
-{ "mfsdr1",  XSPR(31,339,25), XSPR_MASK, PPC|POWER,	{ RT } },
-{ "mfsrr0",  XSPR(31,339,26), XSPR_MASK, PPC|POWER,	{ RT } },
-{ "mfsrr1",  XSPR(31,339,27), XSPR_MASK, PPC|POWER,	{ RT } },
-{ "mfsprg",  XSPR(31,339,272), XSPRG_MASK, PPC,		{ RT, SPRG } },
-{ "mfasr",   XSPR(31,339,280), XSPR_MASK, PPC|B64,	{ RT } },
-{ "mfear",   XSPR(31,339,282), XSPR_MASK, PPC,		{ RT } },
-{ "mfpvr",   XSPR(31,339,287), XSPR_MASK, PPC,		{ RT } },
-{ "mfibatu", XSPR(31,339,528), XSPRBAT_MASK, PPC,	{ RT, SPRBAT } },
-{ "mfibatl", XSPR(31,339,529), XSPRBAT_MASK, PPC,	{ RT, SPRBAT } },
-{ "mfdbatu", XSPR(31,339,536), XSPRBAT_MASK, PPC,	{ RT, SPRBAT } },
-{ "mfdbatl", XSPR(31,339,537), XSPRBAT_MASK, PPC,	{ RT, SPRBAT } },
-{ "mfspr",   X(31,339),	X_MASK,		PPC|POWER,	{ RT, SPR } },
-
-{ "lwax",    X(31,341),	X_MASK,		PPC|B64,	{ RT, RA, RB } },
-
-{ "lhax",    X(31,343),	X_MASK,		PPC|POWER,	{ RT, RA, RB } },
-
-{ "dccci",   X(31,454),	XRT_MASK,	PPC,		{ RA, RB } },
-
-{ "abs",     XO(31,360,0,0), XORB_MASK, POWER|M601,	{ RT, RA } },
-{ "abs.",    XO(31,360,0,1), XORB_MASK, POWER|M601,	{ RT, RA } },
-{ "abso",    XO(31,360,1,0), XORB_MASK, POWER|M601,	{ RT, RA } },
-{ "abso.",   XO(31,360,1,1), XORB_MASK, POWER|M601,	{ RT, RA } },
-
-{ "divs",    XO(31,363,0,0), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "divs.",   XO(31,363,0,1), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "divso",   XO(31,363,1,0), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
-{ "divso.",  XO(31,363,1,1), XO_MASK,	POWER|M601,	{ RT, RA, RB } },
+{ "mfexisr",  XSPR(31,323,64),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfexier",  XSPR(31,323,66),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfbr0",    XSPR(31,323,128), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbr1",    XSPR(31,323,129), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbr2",    XSPR(31,323,130), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbr3",    XSPR(31,323,131), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbr4",    XSPR(31,323,132), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbr5",    XSPR(31,323,133), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbr6",    XSPR(31,323,134), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbr7",    XSPR(31,323,135), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbear",   XSPR(31,323,144), XSPR_MASK, PPC403,	{ RT } },
+{ "mfbesr",   XSPR(31,323,145), XSPR_MASK, PPC403,	{ RT } },
+{ "mfiocr",   XSPR(31,323,160), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmacr0", XSPR(31,323,192), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmact0", XSPR(31,323,193), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmada0", XSPR(31,323,194), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmasa0", XSPR(31,323,195), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmacc0", XSPR(31,323,196), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmacr1", XSPR(31,323,200), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmact1", XSPR(31,323,201), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmada1", XSPR(31,323,202), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmasa1", XSPR(31,323,203), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmacc1", XSPR(31,323,204), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmacr2", XSPR(31,323,208), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmact2", XSPR(31,323,209), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmada2", XSPR(31,323,210), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmasa2", XSPR(31,323,211), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmacc2", XSPR(31,323,212), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmacr3", XSPR(31,323,216), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmact3", XSPR(31,323,217), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmada3", XSPR(31,323,218), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmasa3", XSPR(31,323,219), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmacc3", XSPR(31,323,220), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdmasr",  XSPR(31,323,224), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdcr",    X(31,323),	X_MASK,	PPC403 | BOOKE,	{ RT, SPR } },
+
+{ "div",     XO(31,331,0,0), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "div.",    XO(31,331,0,1), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "divo",    XO(31,331,1,0), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "divo.",   XO(31,331,1,1), XO_MASK,	M601,		{ RT, RA, RB } },
+
+{ "mfpmr",   X(31,334),	X_MASK,		PPCPMR,		{ RT, PMR }},
+
+{ "mfmq",       XSPR(31,339,0),    XSPR_MASK, M601,	{ RT } },
+{ "mfxer",      XSPR(31,339,1),    XSPR_MASK, COM,	{ RT } },
+{ "mfrtcu",     XSPR(31,339,4),    XSPR_MASK, COM,	{ RT } },
+{ "mfrtcl",     XSPR(31,339,5),    XSPR_MASK, COM,	{ RT } },
+{ "mfdec",      XSPR(31,339,6),    XSPR_MASK, MFDEC1,	{ RT } },
+{ "mfdec",      XSPR(31,339,22),   XSPR_MASK, MFDEC2,	{ RT } },
+{ "mflr",       XSPR(31,339,8),    XSPR_MASK, COM,	{ RT } },
+{ "mfctr",      XSPR(31,339,9),    XSPR_MASK, COM,	{ RT } },
+{ "mftid",      XSPR(31,339,17),   XSPR_MASK, POWER,	{ RT } },
+{ "mfdsisr",    XSPR(31,339,18),   XSPR_MASK, COM,	{ RT } },
+{ "mfdar",      XSPR(31,339,19),   XSPR_MASK, COM,	{ RT } },
+{ "mfsdr0",     XSPR(31,339,24),   XSPR_MASK, POWER,	{ RT } },
+{ "mfsdr1",     XSPR(31,339,25),   XSPR_MASK, COM,	{ RT } },
+{ "mfsrr0",     XSPR(31,339,26),   XSPR_MASK, COM,	{ RT } },
+{ "mfsrr1",     XSPR(31,339,27),   XSPR_MASK, COM,	{ RT } },
+{ "mfpid",      XSPR(31,339,48),   XSPR_MASK, BOOKE,    { RT } },
+{ "mfpid",      XSPR(31,339,945),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfcsrr0",    XSPR(31,339,58),   XSPR_MASK, BOOKE,    { RT } },
+{ "mfcsrr1",    XSPR(31,339,59),   XSPR_MASK, BOOKE,    { RT } },
+{ "mfdear",     XSPR(31,339,61),   XSPR_MASK, BOOKE,    { RT } },
+{ "mfdear",     XSPR(31,339,981),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfesr",      XSPR(31,339,62),   XSPR_MASK, BOOKE,    { RT } },
+{ "mfesr",      XSPR(31,339,980),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfivpr",     XSPR(31,339,63),   XSPR_MASK, BOOKE,    { RT } },
+{ "mfcmpa",     XSPR(31,339,144),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcmpb",     XSPR(31,339,145),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcmpc",     XSPR(31,339,146),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcmpd",     XSPR(31,339,147),  XSPR_MASK, PPC860,	{ RT } },
+{ "mficr",      XSPR(31,339,148),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfder",      XSPR(31,339,149),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcounta",   XSPR(31,339,150),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcountb",   XSPR(31,339,151),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcmpe",     XSPR(31,339,152),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcmpf",     XSPR(31,339,153),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcmpg",     XSPR(31,339,154),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfcmph",     XSPR(31,339,155),  XSPR_MASK, PPC860,	{ RT } },
+{ "mflctrl1",   XSPR(31,339,156),  XSPR_MASK, PPC860,	{ RT } },
+{ "mflctrl2",   XSPR(31,339,157),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfictrl",    XSPR(31,339,158),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfbar",      XSPR(31,339,159),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfvrsave",   XSPR(31,339,256),  XSPR_MASK, PPCVEC,	{ RT } },
+{ "mfusprg0",   XSPR(31,339,256),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfsprg4",    XSPR(31,339,260),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfsprg5",    XSPR(31,339,261),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfsprg6",    XSPR(31,339,262),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfsprg7",    XSPR(31,339,263),  XSPR_MASK, PPC405,	{ RT } },
+{ "mftb",       X(31,371),	   X_MASK,    CLASSIC,	{ RT, TBR } },
+{ "mftb",       XSPR(31,339,268),  XSPR_MASK, BOOKE,    { RT } },
+{ "mftbl",      XSPR(31,371,268),  XSPR_MASK, CLASSIC,	{ RT } },
+{ "mftbl",      XSPR(31,339,268),  XSPR_MASK, BOOKE,    { RT } },
+{ "mftbu",      XSPR(31,371,269),  XSPR_MASK, CLASSIC,	{ RT } },
+{ "mftbu",      XSPR(31,339,269),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfsprg",     XSPR(31,339,272),  XSPRG_MASK, PPC,	{ RT, SPRG } },
+{ "mfsprg0",    XSPR(31,339,272),  XSPR_MASK, PPC,	{ RT } },
+{ "mfsprg1",    XSPR(31,339,273),  XSPR_MASK, PPC,	{ RT } },
+{ "mfsprg2",    XSPR(31,339,274),  XSPR_MASK, PPC,	{ RT } },
+{ "mfsprg3",    XSPR(31,339,275),  XSPR_MASK, PPC,	{ RT } },
+{ "mfasr",      XSPR(31,339,280),  XSPR_MASK, PPC64,	{ RT } },
+{ "mfear",      XSPR(31,339,282),  XSPR_MASK, PPC,	{ RT } },
+{ "mfpir",      XSPR(31,339,286),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfpvr",      XSPR(31,339,287),  XSPR_MASK, PPC,	{ RT } },
+{ "mfdbsr",     XSPR(31,339,304),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfdbsr",     XSPR(31,339,1008), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdbcr0",    XSPR(31,339,308),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfdbcr0",    XSPR(31,339,1010), XSPR_MASK, PPC405,	{ RT } },
+{ "mfdbcr1",    XSPR(31,339,309),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfdbcr1",    XSPR(31,339,957),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfdbcr2",    XSPR(31,339,310),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfiac1",     XSPR(31,339,312),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfiac1",     XSPR(31,339,1012), XSPR_MASK, PPC403,	{ RT } },
+{ "mfiac2",     XSPR(31,339,313),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfiac2",     XSPR(31,339,1013), XSPR_MASK, PPC403,	{ RT } },
+{ "mfiac3",     XSPR(31,339,314),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfiac3",     XSPR(31,339,948),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfiac4",     XSPR(31,339,315),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfiac4",     XSPR(31,339,949),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfdac1",     XSPR(31,339,316),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfdac1",     XSPR(31,339,1014), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdac2",     XSPR(31,339,317),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfdac2",     XSPR(31,339,1015), XSPR_MASK, PPC403,	{ RT } },
+{ "mfdvc1",     XSPR(31,339,318),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfdvc1",     XSPR(31,339,950),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfdvc2",     XSPR(31,339,319),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfdvc2",     XSPR(31,339,951),  XSPR_MASK, PPC405,	{ RT } },
+{ "mftsr",      XSPR(31,339,336),  XSPR_MASK, BOOKE,    { RT } },
+{ "mftsr",      XSPR(31,339,984),  XSPR_MASK, PPC403,	{ RT } },
+{ "mftcr",      XSPR(31,339,340),  XSPR_MASK, BOOKE,    { RT } },
+{ "mftcr",      XSPR(31,339,986),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfivor0",    XSPR(31,339,400),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor1",    XSPR(31,339,401),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor2",    XSPR(31,339,402),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor3",    XSPR(31,339,403),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor4",    XSPR(31,339,404),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor5",    XSPR(31,339,405),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor6",    XSPR(31,339,406),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor7",    XSPR(31,339,407),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor8",    XSPR(31,339,408),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor9",    XSPR(31,339,409),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor10",   XSPR(31,339,410),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor11",   XSPR(31,339,411),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor12",   XSPR(31,339,412),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor13",   XSPR(31,339,413),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor14",   XSPR(31,339,414),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfivor15",   XSPR(31,339,415),  XSPR_MASK, BOOKE,    { RT } },
+{ "mfspefscr",  XSPR(31,339,512),  XSPR_MASK, PPCSPE,	{ RT } },
+{ "mfbbear",    XSPR(31,339,513),  XSPR_MASK, PPCBRLK,  { RT } },
+{ "mfbbtar",    XSPR(31,339,514),  XSPR_MASK, PPCBRLK,  { RT } },
+{ "mfibatu",    XSPR(31,339,528),  XSPRBAT_MASK, PPC,	{ RT, SPRBAT } },
+{ "mfibatl",    XSPR(31,339,529),  XSPRBAT_MASK, PPC,	{ RT, SPRBAT } },
+{ "mfdbatu",    XSPR(31,339,536),  XSPRBAT_MASK, PPC,	{ RT, SPRBAT } },
+{ "mfdbatl",    XSPR(31,339,537),  XSPRBAT_MASK, PPC,	{ RT, SPRBAT } },
+{ "mfic_cst",   XSPR(31,339,560),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfic_adr",   XSPR(31,339,561),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfic_dat",   XSPR(31,339,562),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfdc_cst",   XSPR(31,339,568),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfdc_adr",   XSPR(31,339,569),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfdc_dat",   XSPR(31,339,570),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmcsrr0",   XSPR(31,339,570),  XSPR_MASK, PPCRFMCI, { RT } },
+{ "mfmcsrr1",   XSPR(31,339,571),  XSPR_MASK, PPCRFMCI, { RT } },
+{ "mfmcsr",     XSPR(31,339,572),  XSPR_MASK, PPCRFMCI, { RT } },
+{ "mfdpdr",     XSPR(31,339,630),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfdpir",     XSPR(31,339,631),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfimmr",     XSPR(31,339,638),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmi_ctr",   XSPR(31,339,784),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmi_ap",    XSPR(31,339,786),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmi_epn",   XSPR(31,339,787),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmi_twc",   XSPR(31,339,789),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmi_rpn",   XSPR(31,339,790),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_ctr",   XSPR(31,339,792),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfm_casid",  XSPR(31,339,793),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_ap",    XSPR(31,339,794),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_epn",   XSPR(31,339,795),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_twb",   XSPR(31,339,796),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_twc",   XSPR(31,339,797),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_rpn",   XSPR(31,339,798),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfm_tw",     XSPR(31,339,799),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmi_dbcam", XSPR(31,339,816),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmi_dbram0",XSPR(31,339,817),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmi_dbram1",XSPR(31,339,818),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_dbcam", XSPR(31,339,824),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_dbram0",XSPR(31,339,825),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfmd_dbram1",XSPR(31,339,826),  XSPR_MASK, PPC860,	{ RT } },
+{ "mfummcr0",   XSPR(31,339,936),  XSPR_MASK, PPC750,   { RT } },
+{ "mfupmc1",    XSPR(31,339,937),  XSPR_MASK, PPC750,   { RT } },
+{ "mfupmc2",    XSPR(31,339,938),  XSPR_MASK, PPC750,   { RT } },
+{ "mfusia",     XSPR(31,339,939),  XSPR_MASK, PPC750,   { RT } },
+{ "mfummcr1",   XSPR(31,339,940),  XSPR_MASK, PPC750,   { RT } },
+{ "mfupmc3",    XSPR(31,339,941),  XSPR_MASK, PPC750,   { RT } },
+{ "mfupmc4",    XSPR(31,339,942),  XSPR_MASK, PPC750,   { RT } },
+{ "mfzpr",   	XSPR(31,339,944),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfccr0",  	XSPR(31,339,947),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfmmcr0",	XSPR(31,339,952),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfpmc1",	XSPR(31,339,953),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfsgr",	XSPR(31,339,953),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfpmc2",	XSPR(31,339,954),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfdcwr", 	XSPR(31,339,954),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfsia",	XSPR(31,339,955),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfsler",	XSPR(31,339,955),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfmmcr1",	XSPR(31,339,956),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfsu0r",	XSPR(31,339,956),  XSPR_MASK, PPC405,	{ RT } },
+{ "mfpmc3",	XSPR(31,339,957),  XSPR_MASK, PPC750,	{ RT } },
+{ "mfpmc4",	XSPR(31,339,958),  XSPR_MASK, PPC750,	{ RT } },
+{ "mficdbdr",   XSPR(31,339,979),  XSPR_MASK, PPC403,   { RT } },
+{ "mfevpr",     XSPR(31,339,982),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfcdbcr",    XSPR(31,339,983),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfpit",      XSPR(31,339,987),  XSPR_MASK, PPC403,	{ RT } },
+{ "mftbhi",     XSPR(31,339,988),  XSPR_MASK, PPC403,	{ RT } },
+{ "mftblo",     XSPR(31,339,989),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfsrr2",     XSPR(31,339,990),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfsrr3",     XSPR(31,339,991),  XSPR_MASK, PPC403,	{ RT } },
+{ "mfl2cr",     XSPR(31,339,1017), XSPR_MASK, PPC750,   { RT } },
+{ "mfdccr",     XSPR(31,339,1018), XSPR_MASK, PPC403,	{ RT } },
+{ "mficcr",     XSPR(31,339,1019), XSPR_MASK, PPC403,	{ RT } },
+{ "mfictc",     XSPR(31,339,1019), XSPR_MASK, PPC750,   { RT } },
+{ "mfpbl1",     XSPR(31,339,1020), XSPR_MASK, PPC403,	{ RT } },
+{ "mfthrm1",    XSPR(31,339,1020), XSPR_MASK, PPC750,   { RT } },
+{ "mfpbu1",     XSPR(31,339,1021), XSPR_MASK, PPC403,	{ RT } },
+{ "mfthrm2",    XSPR(31,339,1021), XSPR_MASK, PPC750,   { RT } },
+{ "mfpbl2",     XSPR(31,339,1022), XSPR_MASK, PPC403,	{ RT } },
+{ "mfthrm3",    XSPR(31,339,1022), XSPR_MASK, PPC750,   { RT } },
+{ "mfpbu2",     XSPR(31,339,1023), XSPR_MASK, PPC403,	{ RT } },
+{ "mfspr",      X(31,339),	   X_MASK,    COM,	{ RT, SPR } },
+
+{ "lwax",    X(31,341),	X_MASK,		PPC64,		{ RT, RA, RB } },
+
+{ "dst",     XDSS(31,342,0), XDSS_MASK,	PPCVEC,		{ RA, RB, STRM } },
+{ "dstt",    XDSS(31,342,1), XDSS_MASK,	PPCVEC,		{ RA, RB, STRM } },
+
+{ "lhax",    X(31,343),	X_MASK,		COM,		{ RT, RA, RB } },
+
+{ "lhaxe",   X(31,351),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
+
+{ "dstst",   XDSS(31,374,0), XDSS_MASK,	PPCVEC,		{ RA, RB, STRM } },
+{ "dststt",  XDSS(31,374,1), XDSS_MASK,	PPCVEC,		{ RA, RB, STRM } },
+
+{ "dccci",   X(31,454),	XRT_MASK,	PPC403|PPC440,	{ RA, RB } },
+
+{ "abs",     XO(31,360,0,0), XORB_MASK, M601,		{ RT, RA } },
+{ "abs.",    XO(31,360,0,1), XORB_MASK, M601,		{ RT, RA } },
+{ "abso",    XO(31,360,1,0), XORB_MASK, M601,		{ RT, RA } },
+{ "abso.",   XO(31,360,1,1), XORB_MASK, M601,		{ RT, RA } },
+
+{ "divs",    XO(31,363,0,0), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "divs.",   XO(31,363,0,1), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "divso",   XO(31,363,1,0), XO_MASK,	M601,		{ RT, RA, RB } },
+{ "divso.",  XO(31,363,1,1), XO_MASK,	M601,		{ RT, RA, RB } },
 
 { "tlbia",   X(31,370),	0xffffffff,	PPC,		{ 0 } },
 
-{ "mftbu",   XSPR(31,371,269), XSPR_MASK, PPC,		{ RT } },
-{ "mftb",    X(31,371),	X_MASK,		PPC,		{ RT, TBR } },
+{ "lwaux",   X(31,373),	X_MASK,		PPC64,		{ RT, RAL, RB } },
+
+{ "lhaux",   X(31,375),	X_MASK,		COM,		{ RT, RAL, RB } },
+
+{ "lhauxe",  X(31,383),	X_MASK,		BOOKE64,	{ RT, RAL, RB } },
+
+{ "mtdcrx",  X(31,387),	X_MASK,		BOOKE,		{ RA, RS } },
+
+{ "dcblc",   X(31,390),	X_MASK,		PPCCHLK,	{ CT, RA, RB }},
 
-{ "lwaux",   X(31,373),	X_MASK,		PPC|B64,	{ RT, RAL, RB } },
+{ "subfe64", XO(31,392,0,0), XO_MASK,	BOOKE64,	{ RT, RA, RB } },
+{ "subfe64o",XO(31,392,1,0), XO_MASK,	BOOKE64,	{ RT, RA, RB } },
 
-{ "lhaux",   X(31,375),	X_MASK,		PPC|POWER,	{ RT, RAL, RB } },
+{ "adde64",  XO(31,394,0,0), XO_MASK,	BOOKE64,	{ RT, RA, RB } },
+{ "adde64o", XO(31,394,1,0), XO_MASK,	BOOKE64,	{ RT, RA, RB } },
 
-{ "sthx",    X(31,407),	X_MASK,		PPC|POWER,	{ RS, RA, RB } },
+{ "dcblce",  X(31,398),	X_MASK,		PPCCHLK64,	{ CT, RA, RB }},
+
+{ "slbmte",  X(31,402), XRA_MASK,	PPC64,		{ RS, RB } },
+
+{ "sthx",    X(31,407),	X_MASK,		COM,		{ RS, RA, RB } },
 
 { "lfqx",    X(31,791),	X_MASK,		POWER2,		{ FRT, RA, RB } },
 
@@ -2251,280 +3830,575 @@
 
 { "stfqux",  X(31,951),	X_MASK,		POWER2,		{ FRS, RA, RB } },
 
-{ "orc",     XRC(31,412,0), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-{ "orc.",    XRC(31,412,1), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
+{ "orc",     XRC(31,412,0), X_MASK,	COM,		{ RA, RS, RB } },
+{ "orc.",    XRC(31,412,1), X_MASK,	COM,		{ RA, RS, RB } },
+
+{ "sradi",   XS(31,413,0), XS_MASK,	PPC64,		{ RA, RS, SH6 } },
+{ "sradi.",  XS(31,413,1), XS_MASK,	PPC64,		{ RA, RS, SH6 } },
 
-{ "sradi",   XS(31,413,0), XS_MASK,	PPC|B64,	{ RA, RS, SH6 } },
-{ "sradi.",  XS(31,413,1), XS_MASK,	PPC|B64,	{ RA, RS, SH6 } },
+{ "sthxe",   X(31,415),	X_MASK,		BOOKE64,	{ RS, RA, RB } },
 
-{ "slbie",   X(31,434),	XRTRA_MASK,	PPC|B64,	{ RB } },
+{ "slbie",   X(31,434),	XRTRA_MASK,	PPC64,		{ RB } },
 
 { "ecowx",   X(31,438),	X_MASK,		PPC,		{ RT, RA, RB } },
 
-{ "sthux",   X(31,439),	X_MASK,		PPC|POWER,	{ RS, RAS, RB } },
+{ "sthux",   X(31,439),	X_MASK,		COM,		{ RS, RAS, RB } },
+
+{ "sthuxe",  X(31,447),	X_MASK,		BOOKE64,	{ RS, RAS, RB } },
+
+{ "mr",	     XRC(31,444,0), X_MASK,	COM,		{ RA, RS, RBS } },
+{ "or",      XRC(31,444,0), X_MASK,	COM,		{ RA, RS, RB } },
+{ "mr.",     XRC(31,444,1), X_MASK,	COM,		{ RA, RS, RBS } },
+{ "or.",     XRC(31,444,1), X_MASK,	COM,		{ RA, RS, RB } },
+
+{ "mtexisr",  XSPR(31,451,64),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtexier",  XSPR(31,451,66),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtbr0",    XSPR(31,451,128), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbr1",    XSPR(31,451,129), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbr2",    XSPR(31,451,130), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbr3",    XSPR(31,451,131), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbr4",    XSPR(31,451,132), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbr5",    XSPR(31,451,133), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbr6",    XSPR(31,451,134), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbr7",    XSPR(31,451,135), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbear",   XSPR(31,451,144), XSPR_MASK, PPC403,	{ RS } },
+{ "mtbesr",   XSPR(31,451,145), XSPR_MASK, PPC403,	{ RS } },
+{ "mtiocr",   XSPR(31,451,160), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmacr0", XSPR(31,451,192), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmact0", XSPR(31,451,193), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmada0", XSPR(31,451,194), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmasa0", XSPR(31,451,195), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmacc0", XSPR(31,451,196), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmacr1", XSPR(31,451,200), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmact1", XSPR(31,451,201), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmada1", XSPR(31,451,202), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmasa1", XSPR(31,451,203), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmacc1", XSPR(31,451,204), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmacr2", XSPR(31,451,208), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmact2", XSPR(31,451,209), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmada2", XSPR(31,451,210), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmasa2", XSPR(31,451,211), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmacc2", XSPR(31,451,212), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmacr3", XSPR(31,451,216), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmact3", XSPR(31,451,217), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmada3", XSPR(31,451,218), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmasa3", XSPR(31,451,219), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmacc3", XSPR(31,451,220), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdmasr",  XSPR(31,451,224), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdcr",    X(31,451),	X_MASK,	PPC403 | BOOKE,	{ SPR, RS } },
+
+{ "subfze64",XO(31,456,0,0), XORB_MASK, BOOKE64,	{ RT, RA } },
+{ "subfze64o",XO(31,456,1,0), XORB_MASK, BOOKE64,	{ RT, RA } },
+
+{ "divdu",   XO(31,457,0,0), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "divdu.",  XO(31,457,0,1), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "divduo",  XO(31,457,1,0), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "divduo.", XO(31,457,1,1), XO_MASK,	PPC64,		{ RT, RA, RB } },
 
-{ "mr",	     XRC(31,444,0), X_MASK,	PPC|POWER,	{ RA, RS, RBS } },
-{ "or",      XRC(31,444,0), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-{ "mr.",     XRC(31,444,1), X_MASK,	PPC|POWER,	{ RA, RS, RBS } },
-{ "or.",     XRC(31,444,1), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-
-{ "mtdcr",   X(31,451),	X_MASK,		PPC,		{ SPR, RS } },
-
-{ "divdu",   XO(31,457,0,0), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "divdu.",  XO(31,457,0,1), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "divduo",  XO(31,457,1,0), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "divduo.", XO(31,457,1,1), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
+{ "addze64", XO(31,458,0,0), XORB_MASK, BOOKE64,	{ RT, RA } },
+{ "addze64o",XO(31,458,1,0), XORB_MASK, BOOKE64,	{ RT, RA } },
 
 { "divwu",   XO(31,459,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "divwu.",  XO(31,459,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "divwuo",  XO(31,459,1,0), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "divwuo.", XO(31,459,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
 
-{ "mtmq",    XSPR(31,467,0), XSPR_MASK,	POWER|M601,	{ RS } },
-{ "mtxer",   XSPR(31,467,1), XSPR_MASK,	PPC|POWER,	{ RS } },
-{ "mtlr",    XSPR(31,467,8), XSPR_MASK,	PPC|POWER,	{ RS } },
-{ "mtctr",   XSPR(31,467,9), XSPR_MASK,	PPC|POWER,	{ RS } },
-{ "mttid",   XSPR(31,467,17), XSPR_MASK, POWER,		{ RS } },
-{ "mtdsisr", XSPR(31,467,18), XSPR_MASK, PPC|POWER,	{ RS } },
-{ "mtdar",   XSPR(31,467,19), XSPR_MASK, PPC|POWER,	{ RS } },
-{ "mtrtcu",  XSPR(31,467,20), XSPR_MASK, PPC|POWER,	{ RS } },
-{ "mtrtcl",  XSPR(31,467,21), XSPR_MASK, PPC|POWER,	{ RS } },
-{ "mtdec",   XSPR(31,467,22), XSPR_MASK, PPC|POWER,	{ RS } },
-{ "mtsdr0",  XSPR(31,467,24), XSPR_MASK, POWER,		{ RS } },
-{ "mtsdr1",  XSPR(31,467,25), XSPR_MASK, PPC|POWER,	{ RS } },
-{ "mtsrr0",  XSPR(31,467,26), XSPR_MASK, PPC|POWER,	{ RS } },
-{ "mtsrr1",  XSPR(31,467,27), XSPR_MASK, PPC|POWER,	{ RS } },
-{ "mtsprg",  XSPR(31,467,272), XSPRG_MASK, PPC,		{ SPRG, RS } },
-{ "mtasr",   XSPR(31,467,280), XSPR_MASK, PPC|B64,	{ RS } },
-{ "mtear",   XSPR(31,467,282), XSPR_MASK, PPC,		{ RS } },
-{ "mttbl",   XSPR(31,467,284), XSPR_MASK, PPC,		{ RS } },
-{ "mttbu",   XSPR(31,467,285), XSPR_MASK, PPC,		{ RS } },
-{ "mtibatu", XSPR(31,467,528), XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
-{ "mtibatl", XSPR(31,467,529), XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
-{ "mtdbatu", XSPR(31,467,536), XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
-{ "mtdbatl", XSPR(31,467,537), XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
-{ "mtspr",   X(31,467),	X_MASK,		PPC|POWER,	{ SPR, RS } },
+{ "mtmq",      XSPR(31,467,0),    XSPR_MASK, M601,	{ RS } },
+{ "mtxer",     XSPR(31,467,1),    XSPR_MASK, COM,	{ RS } },
+{ "mtlr",      XSPR(31,467,8),    XSPR_MASK, COM,	{ RS } },
+{ "mtctr",     XSPR(31,467,9),    XSPR_MASK, COM,	{ RS } },
+{ "mttid",     XSPR(31,467,17),   XSPR_MASK, POWER,	{ RS } },
+{ "mtdsisr",   XSPR(31,467,18),   XSPR_MASK, COM,	{ RS } },
+{ "mtdar",     XSPR(31,467,19),   XSPR_MASK, COM,	{ RS } },
+{ "mtrtcu",    XSPR(31,467,20),   XSPR_MASK, COM,	{ RS } },
+{ "mtrtcl",    XSPR(31,467,21),   XSPR_MASK, COM,	{ RS } },
+{ "mtdec",     XSPR(31,467,22),   XSPR_MASK, COM,	{ RS } },
+{ "mtsdr0",    XSPR(31,467,24),   XSPR_MASK, POWER,	{ RS } },
+{ "mtsdr1",    XSPR(31,467,25),   XSPR_MASK, COM,	{ RS } },
+{ "mtsrr0",    XSPR(31,467,26),   XSPR_MASK, COM,	{ RS } },
+{ "mtsrr1",    XSPR(31,467,27),   XSPR_MASK, COM,	{ RS } },
+{ "mtpid",     XSPR(31,467,48),   XSPR_MASK, BOOKE,     { RS } },
+{ "mtpid",     XSPR(31,467,945),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtdecar",   XSPR(31,467,54),   XSPR_MASK, BOOKE,     { RS } },
+{ "mtcsrr0",   XSPR(31,467,58),   XSPR_MASK, BOOKE,     { RS } },
+{ "mtcsrr1",   XSPR(31,467,59),   XSPR_MASK, BOOKE,     { RS } },
+{ "mtdear",    XSPR(31,467,61),   XSPR_MASK, BOOKE,     { RS } },
+{ "mtdear",    XSPR(31,467,981),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtesr",     XSPR(31,467,62),   XSPR_MASK, BOOKE,     { RS } },
+{ "mtesr",     XSPR(31,467,980),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtivpr",    XSPR(31,467,63),   XSPR_MASK, BOOKE,     { RS } },
+{ "mtcmpa",    XSPR(31,467,144),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcmpb",    XSPR(31,467,145),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcmpc",    XSPR(31,467,146),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcmpd",    XSPR(31,467,147),  XSPR_MASK, PPC860,	{ RS } },
+{ "mticr",     XSPR(31,467,148),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtder",     XSPR(31,467,149),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcounta",  XSPR(31,467,150),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcountb",  XSPR(31,467,151),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcmpe",    XSPR(31,467,152),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcmpf",    XSPR(31,467,153),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcmpg",    XSPR(31,467,154),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtcmph",    XSPR(31,467,155),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtlctrl1",  XSPR(31,467,156),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtlctrl2",  XSPR(31,467,157),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtictrl",   XSPR(31,467,158),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtbar",     XSPR(31,467,159),  XSPR_MASK, PPC860,	{ RS } },
+{ "mtvrsave",  XSPR(31,467,256),  XSPR_MASK, PPCVEC,	{ RS } },
+{ "mtusprg0",  XSPR(31,467,256),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtsprg",    XSPR(31,467,272),  XSPRG_MASK,PPC,	{ SPRG, RS } },
+{ "mtsprg0",   XSPR(31,467,272),  XSPR_MASK, PPC,	{ RS } },
+{ "mtsprg1",   XSPR(31,467,273),  XSPR_MASK, PPC,	{ RS } },
+{ "mtsprg2",   XSPR(31,467,274),  XSPR_MASK, PPC,	{ RS } },
+{ "mtsprg3",   XSPR(31,467,275),  XSPR_MASK, PPC,	{ RS } },
+{ "mtsprg4",   XSPR(31,467,276),  XSPR_MASK, PPC405 | BOOKE, { RS } },
+{ "mtsprg5",   XSPR(31,467,277),  XSPR_MASK, PPC405 | BOOKE, { RS } },
+{ "mtsprg6",   XSPR(31,467,278),  XSPR_MASK, PPC405 | BOOKE, { RS } },
+{ "mtsprg7",   XSPR(31,467,279),  XSPR_MASK, PPC405 | BOOKE, { RS } },
+{ "mtasr",     XSPR(31,467,280),  XSPR_MASK, PPC64,	{ RS } },
+{ "mtear",     XSPR(31,467,282),  XSPR_MASK, PPC,	{ RS } },
+{ "mttbl",     XSPR(31,467,284),  XSPR_MASK, PPC,	{ RS } },
+{ "mttbu",     XSPR(31,467,285),  XSPR_MASK, PPC,	{ RS } },
+{ "mtdbsr",    XSPR(31,467,304),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtdbsr",    XSPR(31,467,1008), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdbcr0",   XSPR(31,467,308),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtdbcr0",   XSPR(31,467,1010), XSPR_MASK, PPC405,	{ RS } },
+{ "mtdbcr1",   XSPR(31,467,309),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtdbcr1",   XSPR(31,467,957),  XSPR_MASK, PPC405,	{ RS } },
+{ "mtdbcr2",   XSPR(31,467,310),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtiac1",    XSPR(31,467,312),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtiac1",    XSPR(31,467,1012), XSPR_MASK, PPC403,	{ RS } },
+{ "mtiac2",    XSPR(31,467,313),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtiac2",    XSPR(31,467,1013), XSPR_MASK, PPC403,	{ RS } },
+{ "mtiac3",    XSPR(31,467,314),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtiac3",    XSPR(31,467,948),  XSPR_MASK, PPC405,	{ RS } },
+{ "mtiac4",    XSPR(31,467,315),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtiac4",    XSPR(31,467,949),  XSPR_MASK, PPC405,	{ RS } },
+{ "mtdac1",    XSPR(31,467,316),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtdac1",    XSPR(31,467,1014), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdac2",    XSPR(31,467,317),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtdac2",    XSPR(31,467,1015), XSPR_MASK, PPC403,	{ RS } },
+{ "mtdvc1",    XSPR(31,467,318),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtdvc1",    XSPR(31,467,950),  XSPR_MASK, PPC405,	{ RS } },
+{ "mtdvc2",    XSPR(31,467,319),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtdvc2",    XSPR(31,467,951),  XSPR_MASK, PPC405,	{ RS } },
+{ "mttsr",     XSPR(31,467,336),  XSPR_MASK, BOOKE,     { RS } },
+{ "mttsr",     XSPR(31,467,984),  XSPR_MASK, PPC403,	{ RS } },
+{ "mttcr",     XSPR(31,467,340),  XSPR_MASK, BOOKE,     { RS } },
+{ "mttcr",     XSPR(31,467,986),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtivor0",   XSPR(31,467,400),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor1",   XSPR(31,467,401),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor2",   XSPR(31,467,402),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor3",   XSPR(31,467,403),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor4",   XSPR(31,467,404),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor5",   XSPR(31,467,405),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor6",   XSPR(31,467,406),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor7",   XSPR(31,467,407),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor8",   XSPR(31,467,408),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor9",   XSPR(31,467,409),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor10",  XSPR(31,467,410),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor11",  XSPR(31,467,411),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor12",  XSPR(31,467,412),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor13",  XSPR(31,467,413),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor14",  XSPR(31,467,414),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtivor15",  XSPR(31,467,415),  XSPR_MASK, BOOKE,     { RS } },
+{ "mtspefscr",  XSPR(31,467,512),  XSPR_MASK, PPCSPE,   { RS } },
+{ "mtbbear",   XSPR(31,467,513),  XSPR_MASK, PPCBRLK,   { RS } },
+{ "mtbbtar",   XSPR(31,467,514),  XSPR_MASK, PPCBRLK,  { RS } },
+{ "mtibatu",   XSPR(31,467,528),  XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
+{ "mtibatl",   XSPR(31,467,529),  XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
+{ "mtdbatu",   XSPR(31,467,536),  XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
+{ "mtdbatl",   XSPR(31,467,537),  XSPRBAT_MASK, PPC,	{ SPRBAT, RS } },
+{ "mtmcsrr0",  XSPR(31,467,570),  XSPR_MASK, PPCRFMCI,  { RS } },
+{ "mtmcsrr1",  XSPR(31,467,571),  XSPR_MASK, PPCRFMCI,  { RS } },
+{ "mtmcsr",    XSPR(31,467,572),  XSPR_MASK, PPCRFMCI,  { RS } },
+{ "mtummcr0",  XSPR(31,467,936),  XSPR_MASK, PPC750,    { RS } },
+{ "mtupmc1",   XSPR(31,467,937),  XSPR_MASK, PPC750,    { RS } },
+{ "mtupmc2",   XSPR(31,467,938),  XSPR_MASK, PPC750,    { RS } },
+{ "mtusia",    XSPR(31,467,939),  XSPR_MASK, PPC750,    { RS } },
+{ "mtummcr1",  XSPR(31,467,940),  XSPR_MASK, PPC750,    { RS } },
+{ "mtupmc3",   XSPR(31,467,941),  XSPR_MASK, PPC750,    { RS } },
+{ "mtupmc4",   XSPR(31,467,942),  XSPR_MASK, PPC750,    { RS } },
+{ "mtzpr",     XSPR(31,467,944),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtccr0",    XSPR(31,467,947),  XSPR_MASK, PPC405,	{ RS } },
+{ "mtmmcr0",   XSPR(31,467,952),  XSPR_MASK, PPC750,    { RS } },
+{ "mtsgr",     XSPR(31,467,953),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtpmc1",    XSPR(31,467,953),  XSPR_MASK, PPC750,    { RS } },
+{ "mtdcwr",    XSPR(31,467,954),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtpmc2",    XSPR(31,467,954),  XSPR_MASK, PPC750,    { RS } },
+{ "mtsler",    XSPR(31,467,955),  XSPR_MASK, PPC405,	{ RS } },
+{ "mtsia",     XSPR(31,467,955),  XSPR_MASK, PPC750,    { RS } },
+{ "mtsu0r",    XSPR(31,467,956),  XSPR_MASK, PPC405,	{ RS } },
+{ "mtmmcr1",   XSPR(31,467,956),  XSPR_MASK, PPC750,    { RS } },
+{ "mtpmc3",    XSPR(31,467,957),  XSPR_MASK, PPC750,    { RS } },
+{ "mtpmc4",    XSPR(31,467,958),  XSPR_MASK, PPC750,    { RS } },
+{ "mticdbdr",  XSPR(31,467,979),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtevpr",    XSPR(31,467,982),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtcdbcr",   XSPR(31,467,983),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtpit",     XSPR(31,467,987),  XSPR_MASK, PPC403,	{ RS } },
+{ "mttbhi",    XSPR(31,467,988),  XSPR_MASK, PPC403,	{ RS } },
+{ "mttblo",    XSPR(31,467,989),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtsrr2",    XSPR(31,467,990),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtsrr3",    XSPR(31,467,991),  XSPR_MASK, PPC403,	{ RS } },
+{ "mtl2cr",    XSPR(31,467,1017), XSPR_MASK, PPC750,    { RS } },
+{ "mtdccr",    XSPR(31,467,1018), XSPR_MASK, PPC403,	{ RS } },
+{ "mticcr",    XSPR(31,467,1019), XSPR_MASK, PPC403,	{ RS } },
+{ "mtictc",    XSPR(31,467,1019), XSPR_MASK, PPC750,    { RS } },
+{ "mtpbl1",    XSPR(31,467,1020), XSPR_MASK, PPC403,	{ RS } },
+{ "mtthrm1",   XSPR(31,467,1020), XSPR_MASK, PPC750,    { RS } },
+{ "mtpbu1",    XSPR(31,467,1021), XSPR_MASK, PPC403,	{ RS } },
+{ "mtthrm2",   XSPR(31,467,1021), XSPR_MASK, PPC750,    { RS } },
+{ "mtpbl2",    XSPR(31,467,1022), XSPR_MASK, PPC403,	{ RS } },
+{ "mtthrm3",   XSPR(31,467,1022), XSPR_MASK, PPC750,    { RS } },
+{ "mtpbu2",    XSPR(31,467,1023), XSPR_MASK, PPC403,	{ RS } },
+{ "mtspr",     X(31,467),	  X_MASK,    COM,	{ SPR, RS } },
 
 { "dcbi",    X(31,470),	XRT_MASK,	PPC,		{ RA, RB } },
 
-{ "nand",    XRC(31,476,0), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
-{ "nand.",   XRC(31,476,1), X_MASK,	PPC|POWER,	{ RA, RS, RB } },
+{ "nand",    XRC(31,476,0), X_MASK,	COM,		{ RA, RS, RB } },
+{ "nand.",   XRC(31,476,1), X_MASK,	COM,		{ RA, RS, RB } },
+
+{ "dcbie",   X(31,478),	XRT_MASK,	BOOKE64,	{ RA, RB } },
+
+{ "dcread",  X(31,486),	X_MASK,		PPC403|PPC440,	{ RT, RA, RB }},
+
+{ "mtpmr",   X(31,462),	X_MASK,		PPCPMR,		{ PMR, RS }},
+
+{ "icbtls",  X(31,486),	X_MASK,		PPCCHLK,	{ CT, RA, RB }},
 
-{ "nabs",    XO(31,488,0,0), XORB_MASK, POWER|M601,	{ RT, RA } },
-{ "nabs.",   XO(31,488,0,1), XORB_MASK, POWER|M601,	{ RT, RA } },
-{ "nabso",   XO(31,488,1,0), XORB_MASK, POWER|M601,	{ RT, RA } },
-{ "nabso.",  XO(31,488,1,1), XORB_MASK, POWER|M601,	{ RT, RA } },
-
-{ "divd",    XO(31,489,0,0), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "divd.",   XO(31,489,0,1), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "divdo",   XO(31,489,1,0), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
-{ "divdo.",  XO(31,489,1,1), XO_MASK,	PPC|B64,	{ RT, RA, RB } },
+{ "nabs",    XO(31,488,0,0), XORB_MASK, M601,		{ RT, RA } },
+{ "subfme64",XO(31,488,0,0), XORB_MASK, BOOKE64,	{ RT, RA } },
+{ "nabs.",   XO(31,488,0,1), XORB_MASK, M601,		{ RT, RA } },
+{ "nabso",   XO(31,488,1,0), XORB_MASK, M601,		{ RT, RA } },
+{ "subfme64o",XO(31,488,1,0), XORB_MASK, BOOKE64,	{ RT, RA } },
+{ "nabso.",  XO(31,488,1,1), XORB_MASK, M601,		{ RT, RA } },
+
+{ "divd",    XO(31,489,0,0), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "divd.",   XO(31,489,0,1), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "divdo",   XO(31,489,1,0), XO_MASK,	PPC64,		{ RT, RA, RB } },
+{ "divdo.",  XO(31,489,1,1), XO_MASK,	PPC64,		{ RT, RA, RB } },
+
+{ "addme64", XO(31,490,0,0), XORB_MASK, BOOKE64,	{ RT, RA } },
+{ "addme64o",XO(31,490,1,0), XORB_MASK, BOOKE64,	{ RT, RA } },
 
 { "divw",    XO(31,491,0,0), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "divw.",   XO(31,491,0,1), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "divwo",   XO(31,491,1,0), XO_MASK,	PPC,		{ RT, RA, RB } },
 { "divwo.",  XO(31,491,1,1), XO_MASK,	PPC,		{ RT, RA, RB } },
 
-{ "slbia",   X(31,498),	0xffffffff,	PPC|B64,	{ 0 } },
+{ "icbtlse", X(31,494),	X_MASK,		PPCCHLK64,	{ CT, RA, RB }},
+
+{ "slbia",   X(31,498),	0xffffffff,	PPC64,		{ 0 } },
 
 { "cli",     X(31,502), XRB_MASK,	POWER,		{ RT, RA } },
 
-{ "mcrxr",   X(31,512),	XRARB_MASK|(3<<21), PPC|POWER,	{ BF } },
+{ "stdcxe.", XRC(31,511,1), X_MASK,	BOOKE64,	{ RS, RA, RB } },
+
+{ "mcrxr",   X(31,512),	XRARB_MASK|(3<<21), COM,	{ BF } },
+
+{ "bblels",  X(31,518),	X_MASK,		PPCBRLK,	{ 0 }},
+{ "mcrxr64", X(31,544),	XRARB_MASK|(3<<21), BOOKE64,	{ BF } },
 
-{ "clcs",    X(31,531), XRB_MASK,	POWER|M601,	{ RT, RA } },
+{ "clcs",    X(31,531), XRB_MASK,	M601,		{ RT, RA } },
 
-{ "lswx",    X(31,533),	X_MASK,		PPC,		{ RT, RA, RB } },
-{ "lsx",     X(31,533),	X_MASK,		POWER,		{ RT, RA, RB } },
+{ "lswx",    X(31,533),	X_MASK,		PPCCOM,		{ RT, RA, RB } },
+{ "lsx",     X(31,533),	X_MASK,		PWRCOM,		{ RT, RA, RB } },
 
-{ "lwbrx",   X(31,534),	X_MASK,		PPC,		{ RT, RA, RB } },
-{ "lbrx",    X(31,534),	X_MASK,		POWER,		{ RT, RA, RB } },
+{ "lwbrx",   X(31,534),	X_MASK,		PPCCOM,		{ RT, RA, RB } },
+{ "lbrx",    X(31,534),	X_MASK,		PWRCOM,		{ RT, RA, RB } },
 
-{ "lfsx",    X(31,535),	X_MASK,		PPC|POWER,	{ FRT, RA, RB } },
+{ "lfsx",    X(31,535),	X_MASK,		COM,		{ FRT, RA, RB } },
 
-{ "srw",     XRC(31,536,0), X_MASK,	PPC,		{ RA, RS, RB } },
-{ "sr",      XRC(31,536,0), X_MASK,	POWER,		{ RA, RS, RB } },
-{ "srw.",    XRC(31,536,1), X_MASK,	PPC,		{ RA, RS, RB } },
-{ "sr.",     XRC(31,536,1), X_MASK,	POWER,		{ RA, RS, RB } },
+{ "srw",     XRC(31,536,0), X_MASK,	PPCCOM,		{ RA, RS, RB } },
+{ "sr",      XRC(31,536,0), X_MASK,	PWRCOM,		{ RA, RS, RB } },
+{ "srw.",    XRC(31,536,1), X_MASK,	PPCCOM,		{ RA, RS, RB } },
+{ "sr.",     XRC(31,536,1), X_MASK,	PWRCOM,		{ RA, RS, RB } },
 
-{ "rrib",    XRC(31,537,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "rrib.",   XRC(31,537,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "rrib",    XRC(31,537,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "rrib.",   XRC(31,537,1), X_MASK,	M601,		{ RA, RS, RB } },
 
-{ "srd",     XRC(31,539,0), X_MASK,	PPC|B64,	{ RA, RS, RB } },
-{ "srd.",    XRC(31,539,1), X_MASK,	PPC|B64,	{ RA, RS, RB } },
+{ "srd",     XRC(31,539,0), X_MASK,	PPC64,		{ RA, RS, RB } },
+{ "srd.",    XRC(31,539,1), X_MASK,	PPC64,		{ RA, RS, RB } },
 
-{ "maskir",  XRC(31,541,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "maskir.", XRC(31,541,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "maskir",  XRC(31,541,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "maskir.", XRC(31,541,1), X_MASK,	M601,		{ RA, RS, RB } },
 
+{ "lwbrxe",  X(31,542),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
+
+{ "lfsxe",   X(31,543),	X_MASK,		BOOKE64,	{ FRT, RA, RB } },
+
+{ "bbelr",   X(31,550),	X_MASK,		PPCBRLK,	{ 0 }},
 { "tlbsync", X(31,566),	0xffffffff,	PPC,		{ 0 } },
 
-{ "lfsux",   X(31,567),	X_MASK,		PPC|POWER,	{ FRT, RAS, RB } },
+{ "lfsux",   X(31,567),	X_MASK,		COM,		{ FRT, RAS, RB } },
+
+{ "lfsuxe",  X(31,575),	X_MASK,		BOOKE64,	{ FRT, RAS, RB } },
+
+{ "mfsr",    X(31,595),	XRB_MASK|(1<<20), COM32,	{ RT, SR } },
+
+{ "lswi",    X(31,597),	X_MASK,		PPCCOM,		{ RT, RA, NB } },
+{ "lsi",     X(31,597),	X_MASK,		PWRCOM,		{ RT, RA, NB } },
+
+{ "lwsync",  XSYNC(31,598,1), 0xffffffff, PPC,		{ 0 } },
+{ "ptesync", XSYNC(31,598,2), 0xffffffff, PPC64,	{ 0 } },
+{ "msync",   X(31,598), 0xffffffff,	BOOKE,		{ 0 } },
+{ "sync",    X(31,598), XSYNC_MASK,	PPCCOM,		{ LS } },
+{ "dcs",     X(31,598), 0xffffffff,	PWRCOM,		{ 0 } },
+
+{ "lfdx",    X(31,599), X_MASK,		COM,		{ FRT, RA, RB } },
+
+{ "lfdxe",   X(31,607), X_MASK,		BOOKE64,	{ FRT, RA, RB } },
+
+{ "mfsri",   X(31,627), X_MASK,		PWRCOM,		{ RT, RA, RB } },
+
+{ "dclst",   X(31,630), XRB_MASK,	PWRCOM,		{ RS, RA } },
+
+{ "lfdux",   X(31,631), X_MASK,		COM,		{ FRT, RAS, RB } },
+
+{ "lfduxe",  X(31,639), X_MASK,		BOOKE64,	{ FRT, RAS, RB } },
+
+{ "mfsrin",  X(31,659), XRA_MASK,	PPC32,		{ RT, RB } },
+
+{ "stswx",   X(31,661), X_MASK,		PPCCOM,		{ RS, RA, RB } },
+{ "stsx",    X(31,661), X_MASK,		PWRCOM,		{ RS, RA, RB } },
 
-{ "mfsr",    X(31,595),	XRB_MASK|(1<<20), PPC|POWER|B32, { RT, SR } },
+{ "stwbrx",  X(31,662), X_MASK,		PPCCOM,		{ RS, RA, RB } },
+{ "stbrx",   X(31,662), X_MASK,		PWRCOM,		{ RS, RA, RB } },
 
-{ "lswi",    X(31,597),	X_MASK,		PPC,		{ RT, RA, NB } },
-{ "lsi",     X(31,597),	X_MASK,		POWER,		{ RT, RA, NB } },
+{ "stfsx",   X(31,663), X_MASK,		COM,		{ FRS, RA, RB } },
 
-{ "sync",    X(31,598), 0xffffffff,	PPC,		{ 0 } },
-{ "dcs",     X(31,598), 0xffffffff,	POWER,		{ 0 } },
+{ "srq",     XRC(31,664,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "srq.",    XRC(31,664,1), X_MASK,	M601,		{ RA, RS, RB } },
 
-{ "lfdx",    X(31,599), X_MASK,		PPC|POWER,	{ FRT, RA, RB } },
+{ "sre",     XRC(31,665,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "sre.",    XRC(31,665,1), X_MASK,	M601,		{ RA, RS, RB } },
 
-{ "mfsri",   X(31,627), X_MASK,		POWER,		{ RT, RA, RB } },
+{ "stwbrxe", X(31,670), X_MASK,		BOOKE64,	{ RS, RA, RB } },
 
-{ "dclst",   X(31,630), XRB_MASK,	POWER,		{ RS, RA } },
+{ "stfsxe",  X(31,671), X_MASK,		BOOKE64,	{ FRS, RA, RB } },
 
-{ "lfdux",   X(31,631), X_MASK,		PPC|POWER,	{ FRT, RAS, RB } },
+{ "stfsux",  X(31,695),	X_MASK,		COM,		{ FRS, RAS, RB } },
 
-{ "mfsrin",  X(31,659), XRA_MASK,	PPC|B32,	{ RT, RB } },
+{ "sriq",    XRC(31,696,0), X_MASK,	M601,		{ RA, RS, SH } },
+{ "sriq.",   XRC(31,696,1), X_MASK,	M601,		{ RA, RS, SH } },
 
-{ "stswx",   X(31,661), X_MASK,		PPC,		{ RS, RA, RB } },
-{ "stsx",    X(31,661), X_MASK,		POWER,		{ RS, RA, RB } },
+{ "stfsuxe", X(31,703),	X_MASK,		BOOKE64,	{ FRS, RAS, RB } },
 
-{ "stwbrx",  X(31,662), X_MASK,		PPC,		{ RS, RA, RB } },
-{ "stbrx",   X(31,662), X_MASK,		POWER,		{ RS, RA, RB } },
+{ "stswi",   X(31,725),	X_MASK,		PPCCOM,		{ RS, RA, NB } },
+{ "stsi",    X(31,725),	X_MASK,		PWRCOM,		{ RS, RA, NB } },
 
-{ "stfsx",   X(31,663), X_MASK,		PPC|POWER,	{ FRS, RA, RB } },
+{ "stfdx",   X(31,727),	X_MASK,		COM,		{ FRS, RA, RB } },
 
-{ "srq",     XRC(31,664,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "srq.",    XRC(31,664,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "srlq",    XRC(31,728,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "srlq.",   XRC(31,728,1), X_MASK,	M601,		{ RA, RS, RB } },
 
-{ "sre",     XRC(31,665,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "sre.",    XRC(31,665,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "sreq",    XRC(31,729,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "sreq.",   XRC(31,729,1), X_MASK,	M601,		{ RA, RS, RB } },
 
-{ "stfsux",  X(31,695),	X_MASK,		PPC|POWER,	{ FRS, RAS, RB } },
+{ "stfdxe",  X(31,735),	X_MASK,		BOOKE64,	{ FRS, RA, RB } },
 
-{ "sriq",    XRC(31,696,0), X_MASK,	POWER|M601,	{ RA, RS, SH } },
-{ "sriq.",   XRC(31,696,1), X_MASK,	POWER|M601,	{ RA, RS, SH } },
+{ "dcba",    X(31,758),	XRT_MASK,	PPC405 | BOOKE,	{ RA, RB } },
 
-{ "stswi",   X(31,725),	X_MASK,		PPC,		{ RS, RA, NB } },
-{ "stsi",    X(31,725),	X_MASK,		POWER,		{ RS, RA, NB } },
+{ "stfdux",  X(31,759),	X_MASK,		COM,		{ FRS, RAS, RB } },
 
-{ "stfdx",   X(31,727),	X_MASK,		PPC|POWER,	{ FRS, RA, RB } },
+{ "srliq",   XRC(31,760,0), X_MASK,	M601,		{ RA, RS, SH } },
+{ "srliq.",  XRC(31,760,1), X_MASK,	M601,		{ RA, RS, SH } },
 
-{ "srlq",    XRC(31,728,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "srlq.",   XRC(31,728,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "dcbae",   X(31,766),	XRT_MASK,	BOOKE64,	{ RA, RB } },
 
-{ "sreq",    XRC(31,729,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "sreq.",   XRC(31,729,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "stfduxe", X(31,767),	X_MASK,		BOOKE64,	{ FRS, RAS, RB } },
 
-{ "stfdux",  X(31,759),	X_MASK,		PPC|POWER,	{ FRS, RAS, RB } },
+{ "tlbivax", X(31,786),	XRT_MASK,	BOOKE,		{ RA, RB } },
+{ "tlbivaxe",X(31,787),	XRT_MASK,	BOOKE64,	{ RA, RB } },
 
-{ "srliq",   XRC(31,760,0), X_MASK,	POWER|M601,	{ RA, RS, SH } },
-{ "srliq.",  XRC(31,760,1), X_MASK,	POWER|M601,	{ RA, RS, SH } },
+{ "lhbrx",   X(31,790),	X_MASK,		COM,		{ RT, RA, RB } },
 
-{ "lhbrx",   X(31,790),	X_MASK,		PPC|POWER,	{ RT, RA, RB } },
+{ "sraw",    XRC(31,792,0), X_MASK,	PPCCOM,		{ RA, RS, RB } },
+{ "sra",     XRC(31,792,0), X_MASK,	PWRCOM,		{ RA, RS, RB } },
+{ "sraw.",   XRC(31,792,1), X_MASK,	PPCCOM,		{ RA, RS, RB } },
+{ "sra.",    XRC(31,792,1), X_MASK,	PWRCOM,		{ RA, RS, RB } },
 
-{ "sraw",    XRC(31,792,0), X_MASK,	PPC,		{ RA, RS, RB } },
-{ "sra",     XRC(31,792,0), X_MASK,	POWER,		{ RA, RS, RB } },
-{ "sraw.",   XRC(31,792,1), X_MASK,	PPC,		{ RA, RS, RB } },
-{ "sra.",    XRC(31,792,1), X_MASK,	POWER,		{ RA, RS, RB } },
+{ "srad",    XRC(31,794,0), X_MASK,	PPC64,		{ RA, RS, RB } },
+{ "srad.",   XRC(31,794,1), X_MASK,	PPC64,		{ RA, RS, RB } },
 
-{ "srad",    XRC(31,794,0), X_MASK,	PPC|B64,	{ RA, RS, RB } },
-{ "srad.",   XRC(31,794,1), X_MASK,	PPC|B64,	{ RA, RS, RB } },
+{ "lhbrxe",  X(31,798),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
 
-{ "rac",     X(31,818),	X_MASK,		POWER,		{ RT, RA, RB } },
+{ "ldxe",    X(31,799),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
+{ "lduxe",   X(31,831),	X_MASK,		BOOKE64,	{ RT, RA, RB } },
 
-{ "srawi",   XRC(31,824,0), X_MASK,	PPC,		{ RA, RS, SH } },
-{ "srai",    XRC(31,824,0), X_MASK,	POWER,		{ RA, RS, SH } },
-{ "srawi.",  XRC(31,824,1), X_MASK,	PPC,		{ RA, RS, SH } },
-{ "srai.",   XRC(31,824,1), X_MASK,	POWER,		{ RA, RS, SH } },
+{ "rac",     X(31,818),	X_MASK,		PWRCOM,		{ RT, RA, RB } },
 
+{ "dss",     XDSS(31,822,0), XDSS_MASK,	PPCVEC,		{ STRM } },
+{ "dssall",  XDSS(31,822,1), XDSS_MASK,	PPCVEC,		{ 0 } },
+
+{ "srawi",   XRC(31,824,0), X_MASK,	PPCCOM,		{ RA, RS, SH } },
+{ "srai",    XRC(31,824,0), X_MASK,	PWRCOM,		{ RA, RS, SH } },
+{ "srawi.",  XRC(31,824,1), X_MASK,	PPCCOM,		{ RA, RS, SH } },
+{ "srai.",   XRC(31,824,1), X_MASK,	PWRCOM,		{ RA, RS, SH } },
+
+{ "slbmfev", X(31,851), XRA_MASK,	PPC64,		{ RT, RB } },
+
+{ "mbar",    X(31,854),	X_MASK,		BOOKE,		{ MO } },
 { "eieio",   X(31,854),	0xffffffff,	PPC,		{ 0 } },
 
-{ "sthbrx",  X(31,918),	X_MASK,		PPC|POWER,	{ RS, RA, RB } },
+{ "tlbsx",   XRC(31,914,0), X_MASK,	BOOKE,		{ RA, RB } },
+{ "tlbsx",   XRC(31,914,0), X_MASK, 	PPC403,		{ RT, RA, RB } },
+{ "tlbsx.",  XRC(31,914,1), X_MASK,	BOOKE,		{ RA, RB } },
+{ "tlbsx.",  XRC(31,914,1), X_MASK, 	PPC403,		{ RT, RA, RB } },
+{ "tlbsxe",  XRC(31,915,0), X_MASK,	BOOKE64,	{ RA, RB } },
+{ "tlbsxe.", XRC(31,915,1), X_MASK,	BOOKE64,	{ RA, RB } },
+
+{ "slbmfee", X(31,915), XRA_MASK,	PPC64,		{ RT, RB } },
+
+{ "sthbrx",  X(31,918),	X_MASK,		COM,		{ RS, RA, RB } },
 
-{ "sraq",    XRC(31,920,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "sraq.",   XRC(31,920,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "sraq",    XRC(31,920,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "sraq.",   XRC(31,920,1), X_MASK,	M601,		{ RA, RS, RB } },
 
-{ "srea",    XRC(31,921,0), X_MASK,	POWER|M601,	{ RA, RS, RB } },
-{ "srea.",   XRC(31,921,1), X_MASK,	POWER|M601,	{ RA, RS, RB } },
+{ "srea",    XRC(31,921,0), X_MASK,	M601,		{ RA, RS, RB } },
+{ "srea.",   XRC(31,921,1), X_MASK,	M601,		{ RA, RS, RB } },
 
-{ "extsh",   XRC(31,922,0), XRB_MASK,	PPC,		{ RA, RS } },
-{ "exts",    XRC(31,922,0), XRB_MASK,	POWER,		{ RA, RS } },
-{ "extsh.",  XRC(31,922,1), XRB_MASK,	PPC,		{ RA, RS } },
-{ "exts.",   XRC(31,922,1), XRB_MASK,	POWER,		{ RA, RS } },
+{ "extsh",   XRC(31,922,0), XRB_MASK,	PPCCOM,		{ RA, RS } },
+{ "exts",    XRC(31,922,0), XRB_MASK,	PWRCOM,		{ RA, RS } },
+{ "extsh.",  XRC(31,922,1), XRB_MASK,	PPCCOM,		{ RA, RS } },
+{ "exts.",   XRC(31,922,1), XRB_MASK,	PWRCOM,		{ RA, RS } },
 
-{ "sraiq",   XRC(31,952,0), X_MASK,	POWER|M601,	{ RA, RS, SH } },
-{ "sraiq.",  XRC(31,952,1), X_MASK,	POWER|M601,	{ RA, RS, SH } },
+{ "sthbrxe", X(31,926),	X_MASK,		BOOKE64,	{ RS, RA, RB } },
+
+{ "stdxe",   X(31,927), X_MASK,		BOOKE64,	{ RS, RA, RB } },
+
+{ "tlbrehi", XTLB(31,946,0), XTLB_MASK,	PPC403,		{ RT, RA } },
+{ "tlbrelo", XTLB(31,946,1), XTLB_MASK,	PPC403,		{ RT, RA } },
+{ "tlbre",   X(31,946),	X_MASK,		BOOKE,		{ 0 } },
+{ "tlbre",   X(31,946),	X_MASK,		PPC403,		{ RS, RA, SH } },
+
+{ "sraiq",   XRC(31,952,0), X_MASK,	M601,		{ RA, RS, SH } },
+{ "sraiq.",  XRC(31,952,1), X_MASK,	M601,		{ RA, RS, SH } },
 
 { "extsb",   XRC(31,954,0), XRB_MASK,	PPC,		{ RA, RS} },
 { "extsb.",  XRC(31,954,1), XRB_MASK,	PPC,		{ RA, RS} },
 
-{ "iccci",   X(31,966),	XRT_MASK,	PPC,		{ RA, RB } },
+{ "stduxe",  X(31,959),	X_MASK,		BOOKE64,	{ RS, RAS, RB } },
+
+{ "iccci",   X(31,966),	XRT_MASK,	PPC403|PPC440,	{ RA, RB } },
+
+{ "tlbwehi", XTLB(31,978,0), XTLB_MASK,	PPC403,		{ RT, RA } },
+{ "tlbwelo", XTLB(31,978,1), XTLB_MASK,	PPC403,		{ RT, RA } },
+{ "tlbwe",   X(31,978),	X_MASK,		BOOKE,		{ 0 } },
+{ "tlbwe",   X(31,978),	X_MASK,		PPC403,		{ RS, RA, SH } },
+{ "tlbld",   X(31,978),	XRTRA_MASK,	PPC,		{ RB } },
 
 { "icbi",    X(31,982),	XRT_MASK,	PPC,		{ RA, RB } },
 
 { "stfiwx",  X(31,983),	X_MASK,		PPC,		{ FRS, RA, RB } },
 
-{ "extsw",   XRC(31,986,0), XRB_MASK,	PPC,		{ RA, RS } },
-{ "extsw.",  XRC(31,986,1), XRB_MASK,	PPC,		{ RA, RS } },
+{ "extsw",   XRC(31,986,0), XRB_MASK,	PPC64 | BOOKE64,{ RA, RS } },
+{ "extsw.",  XRC(31,986,1), XRB_MASK,	PPC64,		{ RA, RS } },
+
+{ "icread",  X(31,998),	XRT_MASK,	PPC403|PPC440,	{ RA, RB } },
+
+{ "icbie",   X(31,990),	XRT_MASK,	BOOKE64,	{ RA, RB } },
+{ "stfiwxe", X(31,991),	X_MASK,		BOOKE64,	{ FRS, RA, RB } },
+
+{ "tlbli",   X(31,1010), XRTRA_MASK,	PPC,		{ RB } },
 
 { "dcbz",    X(31,1014), XRT_MASK,	PPC,		{ RA, RB } },
 { "dclz",    X(31,1014), XRT_MASK,	PPC,		{ RA, RB } },
 
-{ "lwz",     OP(32),	OP_MASK,	PPC,		{ RT, D, RA } },
-{ "l",	     OP(32),	OP_MASK,	POWER,		{ RT, D, RA } },
+{ "dcbze",   X(31,1022), XRT_MASK,	BOOKE64,	{ RA, RB } },
+
+{ "lvebx",   X(31,   7), X_MASK,	PPCVEC,		{ VD, RA, RB } },
+{ "lvehx",   X(31,  39), X_MASK,	PPCVEC,		{ VD, RA, RB } },
+{ "lvewx",   X(31,  71), X_MASK,	PPCVEC,		{ VD, RA, RB } },
+{ "lvsl",    X(31,   6), X_MASK,	PPCVEC,		{ VD, RA, RB } },
+{ "lvsr",    X(31,  38), X_MASK,	PPCVEC,		{ VD, RA, RB } },
+{ "lvx",     X(31, 103), X_MASK,	PPCVEC,		{ VD, RA, RB } },
+{ "lvxl",    X(31, 359), X_MASK,	PPCVEC,		{ VD, RA, RB } },
+{ "stvebx",  X(31, 135), X_MASK,	PPCVEC,		{ VS, RA, RB } },
+{ "stvehx",  X(31, 167), X_MASK,	PPCVEC,		{ VS, RA, RB } },
+{ "stvewx",  X(31, 199), X_MASK,	PPCVEC,		{ VS, RA, RB } },
+{ "stvx",    X(31, 231), X_MASK,	PPCVEC,		{ VS, RA, RB } },
+{ "stvxl",   X(31, 487), X_MASK,	PPCVEC,		{ VS, RA, RB } },
+
+{ "lwz",     OP(32),	OP_MASK,	PPCCOM,		{ RT, D, RA } },
+{ "l",	     OP(32),	OP_MASK,	PWRCOM,		{ RT, D, RA } },
 
-{ "lwzu",    OP(33),	OP_MASK,	PPC,		{ RT, D, RAL } },
-{ "lu",      OP(33),	OP_MASK,	POWER,		{ RT, D, RA } },
+{ "lwzu",    OP(33),	OP_MASK,	PPCCOM,		{ RT, D, RAL } },
+{ "lu",      OP(33),	OP_MASK,	PWRCOM,		{ RT, D, RA } },
 
-{ "lbz",     OP(34),	OP_MASK,	PPC|POWER,	{ RT, D, RA } },
+{ "lbz",     OP(34),	OP_MASK,	COM,		{ RT, D, RA } },
 
-{ "lbzu",    OP(35),	OP_MASK,	PPC|POWER,	{ RT, D, RAL } },
+{ "lbzu",    OP(35),	OP_MASK,	COM,		{ RT, D, RAL } },
 
-{ "stw",     OP(36),	OP_MASK,	PPC,		{ RS, D, RA } },
-{ "st",      OP(36),	OP_MASK,	POWER,		{ RS, D, RA } },
+{ "stw",     OP(36),	OP_MASK,	PPCCOM,		{ RS, D, RA } },
+{ "st",      OP(36),	OP_MASK,	PWRCOM,		{ RS, D, RA } },
 
-{ "stwu",    OP(37),	OP_MASK,	PPC,		{ RS, D, RAS } },
-{ "stu",     OP(37),	OP_MASK,	POWER,		{ RS, D, RA } },
+{ "stwu",    OP(37),	OP_MASK,	PPCCOM,		{ RS, D, RAS } },
+{ "stu",     OP(37),	OP_MASK,	PWRCOM,		{ RS, D, RA } },
 
-{ "stb",     OP(38),	OP_MASK,	PPC|POWER,	{ RS, D, RA } },
+{ "stb",     OP(38),	OP_MASK,	COM,		{ RS, D, RA } },
 
-{ "stbu",    OP(39),	OP_MASK,	PPC|POWER,	{ RS, D, RAS } },
+{ "stbu",    OP(39),	OP_MASK,	COM,		{ RS, D, RAS } },
 
-{ "lhz",     OP(40),	OP_MASK,	PPC|POWER,	{ RT, D, RA } },
+{ "lhz",     OP(40),	OP_MASK,	COM,		{ RT, D, RA } },
 
-{ "lhzu",    OP(41),	OP_MASK,	PPC|POWER,	{ RT, D, RAL } },
+{ "lhzu",    OP(41),	OP_MASK,	COM,		{ RT, D, RAL } },
 
-{ "lha",     OP(42),	OP_MASK,	PPC|POWER,	{ RT, D, RA } },
+{ "lha",     OP(42),	OP_MASK,	COM,		{ RT, D, RA } },
 
-{ "lhau",    OP(43),	OP_MASK,	PPC|POWER,	{ RT, D, RAL } },
+{ "lhau",    OP(43),	OP_MASK,	COM,		{ RT, D, RAL } },
 
-{ "sth",     OP(44),	OP_MASK,	PPC|POWER,	{ RS, D, RA } },
+{ "sth",     OP(44),	OP_MASK,	COM,		{ RS, D, RA } },
 
-{ "sthu",    OP(45),	OP_MASK,	PPC|POWER,	{ RS, D, RAS } },
+{ "sthu",    OP(45),	OP_MASK,	COM,		{ RS, D, RAS } },
 
-{ "lmw",     OP(46),	OP_MASK,	PPC,		{ RT, D, RAM } },
-{ "lm",      OP(46),	OP_MASK,	POWER,		{ RT, D, RA } },
+{ "lmw",     OP(46),	OP_MASK,	PPCCOM,		{ RT, D, RAM } },
+{ "lm",      OP(46),	OP_MASK,	PWRCOM,		{ RT, D, RA } },
 
-{ "stmw",    OP(47),	OP_MASK,	PPC,		{ RS, D, RA } },
-{ "stm",     OP(47),	OP_MASK,	POWER,		{ RS, D, RA } },
+{ "stmw",    OP(47),	OP_MASK,	PPCCOM,		{ RS, D, RA } },
+{ "stm",     OP(47),	OP_MASK,	PWRCOM,		{ RS, D, RA } },
 
-{ "lfs",     OP(48),	OP_MASK,	PPC|POWER,	{ FRT, D, RA } },
+{ "lfs",     OP(48),	OP_MASK,	COM,		{ FRT, D, RA } },
 
-{ "lfsu",    OP(49),	OP_MASK,	PPC|POWER,	{ FRT, D, RAS } },
+{ "lfsu",    OP(49),	OP_MASK,	COM,		{ FRT, D, RAS } },
 
-{ "lfd",     OP(50),	OP_MASK,	PPC|POWER,	{ FRT, D, RA } },
+{ "lfd",     OP(50),	OP_MASK,	COM,		{ FRT, D, RA } },
 
-{ "lfdu",    OP(51),	OP_MASK,	PPC|POWER,	{ FRT, D, RAS } },
+{ "lfdu",    OP(51),	OP_MASK,	COM,		{ FRT, D, RAS } },
 
-{ "stfs",    OP(52),	OP_MASK,	PPC|POWER,	{ FRS, D, RA } },
+{ "stfs",    OP(52),	OP_MASK,	COM,		{ FRS, D, RA } },
 
-{ "stfsu",   OP(53),	OP_MASK,	PPC|POWER,	{ FRS, D, RAS } },
+{ "stfsu",   OP(53),	OP_MASK,	COM,		{ FRS, D, RAS } },
 
-{ "stfd",    OP(54),	OP_MASK,	PPC|POWER,	{ FRS, D, RA } },
+{ "stfd",    OP(54),	OP_MASK,	COM,		{ FRS, D, RA } },
 
-{ "stfdu",   OP(55),	OP_MASK,	PPC|POWER,	{ FRS, D, RAS } },
+{ "stfdu",   OP(55),	OP_MASK,	COM,		{ FRS, D, RAS } },
+
+{ "lq",      OP(56),	OP_MASK,	POWER4,		{ RTQ, DQ, RAQ } },
 
 { "lfq",     OP(56),	OP_MASK,	POWER2,		{ FRT, D, RA } },
 
 { "lfqu",    OP(57),	OP_MASK,	POWER2,		{ FRT, D, RA } },
 
-{ "ld",      DSO(58,0),	DS_MASK,	PPC|B64,	{ RT, DS, RA } },
+{ "lbze",    DEO(58,0), DE_MASK,	BOOKE64,	{ RT, DE, RA } },
+{ "lbzue",   DEO(58,1), DE_MASK,	BOOKE64,	{ RT, DE, RAL } },
+{ "lhze",    DEO(58,2), DE_MASK,	BOOKE64,	{ RT, DE, RA } },
+{ "lhzue",   DEO(58,3), DE_MASK,	BOOKE64,	{ RT, DE, RAL } },
+{ "lhae",    DEO(58,4), DE_MASK,	BOOKE64,	{ RT, DE, RA } },
+{ "lhaue",   DEO(58,5), DE_MASK,	BOOKE64,	{ RT, DE, RAL } },
+{ "lwze",    DEO(58,6), DE_MASK,	BOOKE64,	{ RT, DE, RA } },
+{ "lwzue",   DEO(58,7), DE_MASK,	BOOKE64,	{ RT, DE, RAL } },
+{ "stbe",    DEO(58,8), DE_MASK,	BOOKE64,	{ RS, DE, RA } },
+{ "stbue",   DEO(58,9), DE_MASK,	BOOKE64,	{ RS, DE, RAS } },
+{ "sthe",    DEO(58,10), DE_MASK,	BOOKE64,	{ RS, DE, RA } },
+{ "sthue",   DEO(58,11), DE_MASK,	BOOKE64,	{ RS, DE, RAS } },
+{ "stwe",    DEO(58,14), DE_MASK,	BOOKE64,	{ RS, DE, RA } },
+{ "stwue",   DEO(58,15), DE_MASK,	BOOKE64,	{ RS, DE, RAS } },
+
+{ "ld",      DSO(58,0),	DS_MASK,	PPC64,		{ RT, DS, RA } },
 
-{ "ldu",     DSO(58,1), DS_MASK,	PPC|B64,	{ RT, DS, RAL } },
+{ "ldu",     DSO(58,1), DS_MASK,	PPC64,		{ RT, DS, RAL } },
 
-{ "lwa",     DSO(58,2), DS_MASK,	PPC|B64,	{ RT, DS, RA } },
+{ "lwa",     DSO(58,2), DS_MASK,	PPC64,		{ RT, DS, RA } },
 
 { "fdivs",   A(59,18,0), AFRC_MASK,	PPC,		{ FRT, FRA, FRB } },
 { "fdivs.",  A(59,18,1), AFRC_MASK,	PPC,		{ FRT, FRA, FRB } },
@@ -2560,113 +4434,128 @@
 
 { "stfqu",   OP(61),	OP_MASK,	POWER2,		{ FRS, D, RA } },
 
-{ "std",     DSO(62,0),	DS_MASK,	PPC|B64,	{ RS, DS, RA } },
+{ "lde",     DEO(62,0), DE_MASK,	BOOKE64,	{ RT, DES, RA } },
+{ "ldue",    DEO(62,1), DE_MASK,	BOOKE64,	{ RT, DES, RA } },
+{ "lfse",    DEO(62,4), DE_MASK,	BOOKE64,	{ FRT, DES, RA } },
+{ "lfsue",   DEO(62,5), DE_MASK,	BOOKE64,	{ FRT, DES, RAS } },
+{ "lfde",    DEO(62,6), DE_MASK,	BOOKE64,	{ FRT, DES, RA } },
+{ "lfdue",   DEO(62,7), DE_MASK,	BOOKE64,	{ FRT, DES, RAS } },
+{ "stde",    DEO(62,8), DE_MASK,	BOOKE64,	{ RS, DES, RA } },
+{ "stdue",   DEO(62,9), DE_MASK,	BOOKE64,	{ RS, DES, RAS } },
+{ "stfse",   DEO(62,12), DE_MASK,	BOOKE64,	{ FRS, DES, RA } },
+{ "stfsue",  DEO(62,13), DE_MASK,	BOOKE64,	{ FRS, DES, RAS } },
+{ "stfde",   DEO(62,14), DE_MASK,	BOOKE64,	{ FRS, DES, RA } },
+{ "stfdue",  DEO(62,15), DE_MASK,	BOOKE64,	{ FRS, DES, RAS } },
+
+{ "std",     DSO(62,0),	DS_MASK,	PPC64,		{ RS, DS, RA } },
+
+{ "stdu",    DSO(62,1),	DS_MASK,	PPC64,		{ RS, DS, RAS } },
 
-{ "stdu",    DSO(62,1),	DS_MASK,	PPC|B64,	{ RS, DS, RAS } },
+{ "stq",     DSO(62,2),	DS_MASK,	POWER4,		{ RSQ, DS, RA } },
 
-{ "fcmpu",   X(63,0),	X_MASK|(3<<21),	PPC|POWER,	{ BF, FRA, FRB } },
+{ "fcmpu",   X(63,0),	X_MASK|(3<<21),	COM,		{ BF, FRA, FRB } },
 
-{ "frsp",    XRC(63,12,0), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
-{ "frsp.",   XRC(63,12,1), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
+{ "frsp",    XRC(63,12,0), XRA_MASK,	COM,		{ FRT, FRB } },
+{ "frsp.",   XRC(63,12,1), XRA_MASK,	COM,		{ FRT, FRB } },
 
-{ "fctiw",   XRC(63,14,0), XRA_MASK,	PPC,		{ FRT, FRB } },
+{ "fctiw",   XRC(63,14,0), XRA_MASK,	PPCCOM,		{ FRT, FRB } },
 { "fcir",    XRC(63,14,0), XRA_MASK,	POWER2,		{ FRT, FRB } },
-{ "fctiw.",  XRC(63,14,1), XRA_MASK,	PPC,		{ FRT, FRB } },
+{ "fctiw.",  XRC(63,14,1), XRA_MASK,	PPCCOM,		{ FRT, FRB } },
 { "fcir.",   XRC(63,14,1), XRA_MASK,	POWER2,		{ FRT, FRB } },
 
-{ "fctiwz",  XRC(63,15,0), XRA_MASK,	PPC,		{ FRT, FRB } },
+{ "fctiwz",  XRC(63,15,0), XRA_MASK,	PPCCOM,		{ FRT, FRB } },
 { "fcirz",   XRC(63,15,0), XRA_MASK,	POWER2,		{ FRT, FRB } },
-{ "fctiwz.", XRC(63,15,1), XRA_MASK,	PPC,		{ FRT, FRB } },
+{ "fctiwz.", XRC(63,15,1), XRA_MASK,	PPCCOM,		{ FRT, FRB } },
 { "fcirz.",  XRC(63,15,1), XRA_MASK,	POWER2,		{ FRT, FRB } },
 
-{ "fdiv",    A(63,18,0), AFRC_MASK,	PPC,		{ FRT, FRA, FRB } },
-{ "fd",      A(63,18,0), AFRC_MASK,	POWER,		{ FRT, FRA, FRB } },
-{ "fdiv.",   A(63,18,1), AFRC_MASK,	PPC,		{ FRT, FRA, FRB } },
-{ "fd.",     A(63,18,1), AFRC_MASK,	POWER,		{ FRT, FRA, FRB } },
-
-{ "fsub",    A(63,20,0), AFRC_MASK,	PPC,		{ FRT, FRA, FRB } },
-{ "fs",      A(63,20,0), AFRC_MASK,	POWER,		{ FRT, FRA, FRB } },
-{ "fsub.",   A(63,20,1), AFRC_MASK,	PPC,		{ FRT, FRA, FRB } },
-{ "fs.",     A(63,20,1), AFRC_MASK,	POWER,		{ FRT, FRA, FRB } },
-
-{ "fadd",    A(63,21,0), AFRC_MASK,	PPC,		{ FRT, FRA, FRB } },
-{ "fa",      A(63,21,0), AFRC_MASK,	POWER,		{ FRT, FRA, FRB } },
-{ "fadd.",   A(63,21,1), AFRC_MASK,	PPC,		{ FRT, FRA, FRB } },
-{ "fa.",     A(63,21,1), AFRC_MASK,	POWER,		{ FRT, FRA, FRB } },
+{ "fdiv",    A(63,18,0), AFRC_MASK,	PPCCOM,		{ FRT, FRA, FRB } },
+{ "fd",      A(63,18,0), AFRC_MASK,	PWRCOM,		{ FRT, FRA, FRB } },
+{ "fdiv.",   A(63,18,1), AFRC_MASK,	PPCCOM,		{ FRT, FRA, FRB } },
+{ "fd.",     A(63,18,1), AFRC_MASK,	PWRCOM,		{ FRT, FRA, FRB } },
+
+{ "fsub",    A(63,20,0), AFRC_MASK,	PPCCOM,		{ FRT, FRA, FRB } },
+{ "fs",      A(63,20,0), AFRC_MASK,	PWRCOM,		{ FRT, FRA, FRB } },
+{ "fsub.",   A(63,20,1), AFRC_MASK,	PPCCOM,		{ FRT, FRA, FRB } },
+{ "fs.",     A(63,20,1), AFRC_MASK,	PWRCOM,		{ FRT, FRA, FRB } },
+
+{ "fadd",    A(63,21,0), AFRC_MASK,	PPCCOM,		{ FRT, FRA, FRB } },
+{ "fa",      A(63,21,0), AFRC_MASK,	PWRCOM,		{ FRT, FRA, FRB } },
+{ "fadd.",   A(63,21,1), AFRC_MASK,	PPCCOM,		{ FRT, FRA, FRB } },
+{ "fa.",     A(63,21,1), AFRC_MASK,	PWRCOM,		{ FRT, FRA, FRB } },
 
-{ "fsqrt",   A(63,22,0), AFRAFRC_MASK,	PPC|POWER2,	{ FRT, FRB } },
-{ "fsqrt.",  A(63,22,1), AFRAFRC_MASK,	PPC|POWER2,	{ FRT, FRB } },
+{ "fsqrt",   A(63,22,0), AFRAFRC_MASK,	PPCPWR2,	{ FRT, FRB } },
+{ "fsqrt.",  A(63,22,1), AFRAFRC_MASK,	PPCPWR2,	{ FRT, FRB } },
 
 { "fsel",    A(63,23,0), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
 { "fsel.",   A(63,23,1), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
 
-{ "fmul",    A(63,25,0), AFRB_MASK,	PPC,		{ FRT, FRA, FRC } },
-{ "fm",      A(63,25,0), AFRB_MASK,	POWER,		{ FRT, FRA, FRC } },
-{ "fmul.",   A(63,25,1), AFRB_MASK,	PPC,		{ FRT, FRA, FRC } },
-{ "fm.",     A(63,25,1), AFRB_MASK,	POWER,		{ FRT, FRA, FRC } },
+{ "fmul",    A(63,25,0), AFRB_MASK,	PPCCOM,		{ FRT, FRA, FRC } },
+{ "fm",      A(63,25,0), AFRB_MASK,	PWRCOM,		{ FRT, FRA, FRC } },
+{ "fmul.",   A(63,25,1), AFRB_MASK,	PPCCOM,		{ FRT, FRA, FRC } },
+{ "fm.",     A(63,25,1), AFRB_MASK,	PWRCOM,		{ FRT, FRA, FRC } },
 
 { "frsqrte", A(63,26,0), AFRAFRC_MASK,	PPC,		{ FRT, FRB } },
 { "frsqrte.",A(63,26,1), AFRAFRC_MASK,	PPC,		{ FRT, FRB } },
 
-{ "fmsub",   A(63,28,0), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
-{ "fms",     A(63,28,0), A_MASK,	POWER,		{ FRT,FRA,FRC,FRB } },
-{ "fmsub.",  A(63,28,1), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
-{ "fms.",    A(63,28,1), A_MASK,	POWER,		{ FRT,FRA,FRC,FRB } },
+{ "fmsub",   A(63,28,0), A_MASK,	PPCCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fms",     A(63,28,0), A_MASK,	PWRCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fmsub.",  A(63,28,1), A_MASK,	PPCCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fms.",    A(63,28,1), A_MASK,	PWRCOM,		{ FRT,FRA,FRC,FRB } },
 
-{ "fmadd",   A(63,29,0), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
-{ "fma",     A(63,29,0), A_MASK,	POWER,		{ FRT,FRA,FRC,FRB } },
-{ "fmadd.",  A(63,29,1), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
-{ "fma.",    A(63,29,1), A_MASK,	POWER,		{ FRT,FRA,FRC,FRB } },
+{ "fmadd",   A(63,29,0), A_MASK,	PPCCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fma",     A(63,29,0), A_MASK,	PWRCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fmadd.",  A(63,29,1), A_MASK,	PPCCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fma.",    A(63,29,1), A_MASK,	PWRCOM,		{ FRT,FRA,FRC,FRB } },
 
-{ "fnmsub",  A(63,30,0), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
-{ "fnms",    A(63,30,0), A_MASK,	POWER,		{ FRT,FRA,FRC,FRB } },
-{ "fnmsub.", A(63,30,1), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
-{ "fnms.",   A(63,30,1), A_MASK,	POWER,		{ FRT,FRA,FRC,FRB } },
+{ "fnmsub",  A(63,30,0), A_MASK,	PPCCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fnms",    A(63,30,0), A_MASK,	PWRCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fnmsub.", A(63,30,1), A_MASK,	PPCCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fnms.",   A(63,30,1), A_MASK,	PWRCOM,		{ FRT,FRA,FRC,FRB } },
 
-{ "fnmadd",  A(63,31,0), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
-{ "fnma",    A(63,31,0), A_MASK,	POWER,		{ FRT,FRA,FRC,FRB } },
-{ "fnmadd.", A(63,31,1), A_MASK,	PPC,		{ FRT,FRA,FRC,FRB } },
-{ "fnma.",   A(63,31,1), A_MASK,	POWER,		{ FRT,FRA,FRC,FRB } },
+{ "fnmadd",  A(63,31,0), A_MASK,	PPCCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fnma",    A(63,31,0), A_MASK,	PWRCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fnmadd.", A(63,31,1), A_MASK,	PPCCOM,		{ FRT,FRA,FRC,FRB } },
+{ "fnma.",   A(63,31,1), A_MASK,	PWRCOM,		{ FRT,FRA,FRC,FRB } },
 
-{ "fcmpo",   X(63,30),	X_MASK|(3<<21),	PPC|POWER,	{ BF, FRA, FRB } },
+{ "fcmpo",   X(63,32),	X_MASK|(3<<21),	COM,		{ BF, FRA, FRB } },
 
-{ "mtfsb1",  XRC(63,38,0), XRARB_MASK,	PPC|POWER,	{ BT } },
-{ "mtfsb1.", XRC(63,38,1), XRARB_MASK,	PPC|POWER,	{ BT } },
+{ "mtfsb1",  XRC(63,38,0), XRARB_MASK,	COM,		{ BT } },
+{ "mtfsb1.", XRC(63,38,1), XRARB_MASK,	COM,		{ BT } },
 
-{ "fneg",    XRC(63,40,0), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
-{ "fneg.",   XRC(63,40,1), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
+{ "fneg",    XRC(63,40,0), XRA_MASK,	COM,		{ FRT, FRB } },
+{ "fneg.",   XRC(63,40,1), XRA_MASK,	COM,		{ FRT, FRB } },
 
-{ "mcrfs",   X(63,64),	XRB_MASK|(3<<21)|(3<<16), PPC|POWER, { BF, BFA } },
+{ "mcrfs",   X(63,64),	XRB_MASK|(3<<21)|(3<<16), COM,	{ BF, BFA } },
 
-{ "mtfsb0",  XRC(63,70,0), XRARB_MASK,	PPC|POWER,	{ BT } },
-{ "mtfsb0.", XRC(63,70,1), XRARB_MASK,	PPC|POWER,	{ BT } },
+{ "mtfsb0",  XRC(63,70,0), XRARB_MASK,	COM,		{ BT } },
+{ "mtfsb0.", XRC(63,70,1), XRARB_MASK,	COM,		{ BT } },
 
-{ "fmr",     XRC(63,72,0), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
-{ "fmr.",    XRC(63,72,1), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
+{ "fmr",     XRC(63,72,0), XRA_MASK,	COM,		{ FRT, FRB } },
+{ "fmr.",    XRC(63,72,1), XRA_MASK,	COM,		{ FRT, FRB } },
 
-{ "mtfsfi",  XRC(63,134,0), XRA_MASK|(3<<21)|(1<<11), PPC|POWER, { BF, U } },
-{ "mtfsfi.", XRC(63,134,1), XRA_MASK|(3<<21)|(1<<11), PPC|POWER, { BF, U } },
+{ "mtfsfi",  XRC(63,134,0), XRA_MASK|(3<<21)|(1<<11), COM, { BF, U } },
+{ "mtfsfi.", XRC(63,134,1), XRA_MASK|(3<<21)|(1<<11), COM, { BF, U } },
 
-{ "fnabs",   XRC(63,136,0), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
-{ "fnabs.",  XRC(63,136,1), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
+{ "fnabs",   XRC(63,136,0), XRA_MASK,	COM,		{ FRT, FRB } },
+{ "fnabs.",  XRC(63,136,1), XRA_MASK,	COM,		{ FRT, FRB } },
 
-{ "fabs",    XRC(63,264,0), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
-{ "fabs.",   XRC(63,264,1), XRA_MASK,	PPC|POWER,	{ FRT, FRB } },
+{ "fabs",    XRC(63,264,0), XRA_MASK,	COM,		{ FRT, FRB } },
+{ "fabs.",   XRC(63,264,1), XRA_MASK,	COM,		{ FRT, FRB } },
 
-{ "mffs",    XRC(63,583,0), XRARB_MASK,	PPC|POWER,	{ FRT } },
-{ "mffs.",   XRC(63,583,1), XRARB_MASK,	PPC|POWER,	{ FRT } },
+{ "mffs",    XRC(63,583,0), XRARB_MASK,	COM,		{ FRT } },
+{ "mffs.",   XRC(63,583,1), XRARB_MASK,	COM,		{ FRT } },
 
-{ "mtfsf",   XFL(63,711,0), XFL_MASK,	PPC|POWER,	{ FLM, FRB } },
-{ "mtfsf.",  XFL(63,711,1), XFL_MASK,	PPC|POWER,	{ FLM, FRB } },
+{ "mtfsf",   XFL(63,711,0), XFL_MASK,	COM,		{ FLM, FRB } },
+{ "mtfsf.",  XFL(63,711,1), XFL_MASK,	COM,		{ FLM, FRB } },
 
-{ "fctid",   XRC(63,814,0), XRA_MASK,	PPC|B64,	{ FRT, FRB } },
-{ "fctid.",  XRC(63,814,1), XRA_MASK,	PPC|B64,	{ FRT, FRB } },
+{ "fctid",   XRC(63,814,0), XRA_MASK,	PPC64,		{ FRT, FRB } },
+{ "fctid.",  XRC(63,814,1), XRA_MASK,	PPC64,		{ FRT, FRB } },
 
-{ "fctidz",  XRC(63,815,0), XRA_MASK,	PPC|B64,	{ FRT, FRB } },
-{ "fctidz.", XRC(63,815,1), XRA_MASK,	PPC|B64,	{ FRT, FRB } },
+{ "fctidz",  XRC(63,815,0), XRA_MASK,	PPC64,		{ FRT, FRB } },
+{ "fctidz.", XRC(63,815,1), XRA_MASK,	PPC64,		{ FRT, FRB } },
 
-{ "fcfid",   XRC(63,846,0), XRA_MASK,	PPC|B64,	{ FRT, FRB } },
-{ "fcfid.",  XRC(63,846,1), XRA_MASK,	PPC|B64,	{ FRT, FRB } },
+{ "fcfid",   XRC(63,846,0), XRA_MASK,	PPC64,		{ FRT, FRB } },
+{ "fcfid.",  XRC(63,846,1), XRA_MASK,	PPC64,		{ FRT, FRB } },
 
 };
 
@@ -2675,47 +4564,56 @@
 
 /* The macro table.  This is only used by the assembler.  */
 
-const struct powerpc_macro powerpc_macros[] = {
-{ "extldi",  4,   PPC|B64,	"rldicr %0,%1,%3,(%2)-1" },
-{ "extldi.", 4,   PPC|B64,	"rldicr. %0,%1,%3,(%2)-1" },
-{ "extrdi",  4,   PPC|B64,	"rldicl %0,%1,(%2)+(%3),64-(%2)" },
-{ "extrdi.", 4,   PPC|B64,	"rldicl. %0,%1,(%2)+(%3),64-(%2)" },
-{ "insrdi",  4,   PPC|B64,	"rldimi %0,%1,64-((%2)+(%3)),%3" },
-{ "insrdi.", 4,   PPC|B64,	"rldimi. %0,%1,64-((%2)+(%3)),%3" },
-{ "rotrdi",  3,   PPC|B64,	"rldicl %0,%1,64-(%2),0" },
-{ "rotrdi.", 3,   PPC|B64,	"rldicl. %0,%1,64-(%2),0" },
-{ "sldi",    3,   PPC|B64,	"rldicr %0,%1,%2,63-(%2)" },
-{ "sldi.",   3,   PPC|B64,	"rldicr. %0,%1,%2,63-(%2)" },
-{ "srdi",    3,   PPC|B64,	"rldicl %0,%1,64-(%2),%2" },
-{ "srdi.",   3,   PPC|B64,	"rldicl. %0,%1,64-(%2),%2" },
-{ "clrrdi",  3,   PPC|B64,	"rldicr %0,%1,0,63-(%2)" },
-{ "clrrdi.", 3,   PPC|B64,	"rldicr. %0,%1,0,63-(%2)" },
-{ "clrlsldi",4,   PPC|B64,	"rldic %0,%1,%3,(%2)-(%3)" },
-{ "clrlsldi.",4,  PPC|B64,	"rldic. %0,%1,%3,(%2)-(%3)" },
-
-{ "extlwi",  4,   PPC,		"rlwinm %0,%1,%3,0,(%2)-1" },
-{ "extlwi.", 4,   PPC,		"rlwinm. %0,%1,%3,0,(%2)-1" },
-{ "extrwi",  4,   PPC,		"rlwinm %0,%1,(%2)+(%3),32-(%2),31" },
-{ "extrwi.", 4,   PPC,		"rlwinm. %0,%1,(%2)+(%3),32-(%2),31" },
-{ "inslwi",  4,   PPC,		"rlwimi %0,%1,32-(%3),%3,(%2)+(%3)-1" },
-{ "inslwi.", 4,   PPC,		"rlwimi. %0,%1,32-(%3),%3,(%2)+(%3)-1" },
-{ "insrwi",  4,   PPC,		"rlwimi %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1" },
-{ "insrwi.", 4,   PPC,		"rlwimi. %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1"},
-{ "rotrwi",  3,   PPC,		"rlwinm %0,%1,32-(%2),0,31" },
-{ "rotrwi.", 3,   PPC,		"rlwinm. %0,%1,32-(%2),0,31" },
-{ "slwi",    3,   PPC,		"rlwinm %0,%1,%2,0,31-(%2)" },
-{ "sli",     3,   POWER,	"rlinm %0,%1,%2,0,31-(%2)" },
-{ "slwi.",   3,   PPC,		"rlwinm. %0,%1,%2,0,31-(%2)" },
-{ "sli.",    3,   POWER,	"rlinm. %0,%1,%2,0,31-(%2)" },
-{ "srwi",    3,   PPC,		"rlwinm %0,%1,32-(%2),%2,31" },
-{ "sri",     3,   POWER,	"rlinm %0,%1,32-(%2),%2,31" },
-{ "srwi.",   3,   PPC,		"rlwinm. %0,%1,32-(%2),%2,31" },
-{ "sri.",    3,   POWER,	"rlinm. %0,%1,32-(%2),%2,31" },
-{ "clrrwi",  3,   PPC,		"rlwinm %0,%1,0,0,31-(%2)" },
-{ "clrrwi.", 3,   PPC,		"rlwinm. %0,%1,0,0,31-(%2)" },
-{ "clrlslwi",4,   PPC,		"rlwinm %0,%1,%3,(%2)-(%3),31-(%3)" },
-{ "clrlslwi.",4,  PPC,		"rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" },
+/* The expressions of the form (-x ! 31) & (x | 31) have the value 0
+   when x=0; 32-x when x is between 1 and 31; are negative if x is
+   negative; and are 32 or more otherwise.  This is what you want
+   when, for instance, you are emulating a right shift by a
+   rotate-left-and-mask, because the underlying instructions support
+   shifts of size 0 but not shifts of size 32.  By comparison, when
+   extracting x bits from some word you want to use just 32-x, because
+   the underlying instructions don't support extracting 0 bits but do
+   support extracting the whole word (32 bits in this case).  */
 
+const struct powerpc_macro powerpc_macros[] = {
+{ "extldi",  4,   PPC64,	"rldicr %0,%1,%3,(%2)-1" },
+{ "extldi.", 4,   PPC64,	"rldicr. %0,%1,%3,(%2)-1" },
+{ "extrdi",  4,   PPC64,	"rldicl %0,%1,(%2)+(%3),64-(%2)" },
+{ "extrdi.", 4,   PPC64,	"rldicl. %0,%1,(%2)+(%3),64-(%2)" },
+{ "insrdi",  4,   PPC64,	"rldimi %0,%1,64-((%2)+(%3)),%3" },
+{ "insrdi.", 4,   PPC64,	"rldimi. %0,%1,64-((%2)+(%3)),%3" },
+{ "rotrdi",  3,   PPC64,	"rldicl %0,%1,(-(%2)!63)&((%2)|63),0" },
+{ "rotrdi.", 3,   PPC64,	"rldicl. %0,%1,(-(%2)!63)&((%2)|63),0" },
+{ "sldi",    3,   PPC64,	"rldicr %0,%1,%2,63-(%2)" },
+{ "sldi.",   3,   PPC64,	"rldicr. %0,%1,%2,63-(%2)" },
+{ "srdi",    3,   PPC64,	"rldicl %0,%1,(-(%2)!63)&((%2)|63),%2" },
+{ "srdi.",   3,   PPC64,	"rldicl. %0,%1,(-(%2)!63)&((%2)|63),%2" },
+{ "clrrdi",  3,   PPC64,	"rldicr %0,%1,0,63-(%2)" },
+{ "clrrdi.", 3,   PPC64,	"rldicr. %0,%1,0,63-(%2)" },
+{ "clrlsldi",4,   PPC64,	"rldic %0,%1,%3,(%2)-(%3)" },
+{ "clrlsldi.",4,  PPC64,	"rldic. %0,%1,%3,(%2)-(%3)" },
+
+{ "extlwi",  4,   PPCCOM,	"rlwinm %0,%1,%3,0,(%2)-1" },
+{ "extlwi.", 4,   PPCCOM,	"rlwinm. %0,%1,%3,0,(%2)-1" },
+{ "extrwi",  4,   PPCCOM,	"rlwinm %0,%1,((%2)+(%3))&((%2)+(%3)<>32),32-(%2),31" },
+{ "extrwi.", 4,   PPCCOM,	"rlwinm. %0,%1,((%2)+(%3))&((%2)+(%3)<>32),32-(%2),31" },
+{ "inslwi",  4,   PPCCOM,	"rlwimi %0,%1,(-(%3)!31)&((%3)|31),%3,(%2)+(%3)-1" },
+{ "inslwi.", 4,   PPCCOM,	"rlwimi. %0,%1,(-(%3)!31)&((%3)|31),%3,(%2)+(%3)-1"},
+{ "insrwi",  4,   PPCCOM,	"rlwimi %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1" },
+{ "insrwi.", 4,   PPCCOM,	"rlwimi. %0,%1,32-((%2)+(%3)),%3,(%2)+(%3)-1"},
+{ "rotrwi",  3,   PPCCOM,	"rlwinm %0,%1,(-(%2)!31)&((%2)|31),0,31" },
+{ "rotrwi.", 3,   PPCCOM,	"rlwinm. %0,%1,(-(%2)!31)&((%2)|31),0,31" },
+{ "slwi",    3,   PPCCOM,	"rlwinm %0,%1,%2,0,31-(%2)" },
+{ "sli",     3,   PWRCOM,	"rlinm %0,%1,%2,0,31-(%2)" },
+{ "slwi.",   3,   PPCCOM,	"rlwinm. %0,%1,%2,0,31-(%2)" },
+{ "sli.",    3,   PWRCOM,	"rlinm. %0,%1,%2,0,31-(%2)" },
+{ "srwi",    3,   PPCCOM,	"rlwinm %0,%1,(-(%2)!31)&((%2)|31),%2,31" },
+{ "sri",     3,   PWRCOM,	"rlinm %0,%1,(-(%2)!31)&((%2)|31),%2,31" },
+{ "srwi.",   3,   PPCCOM,	"rlwinm. %0,%1,(-(%2)!31)&((%2)|31),%2,31" },
+{ "sri.",    3,   PWRCOM,	"rlinm. %0,%1,(-(%2)!31)&((%2)|31),%2,31" },
+{ "clrrwi",  3,   PPCCOM,	"rlwinm %0,%1,0,0,31-(%2)" },
+{ "clrrwi.", 3,   PPCCOM,	"rlwinm. %0,%1,0,0,31-(%2)" },
+{ "clrlslwi",4,   PPCCOM,	"rlwinm %0,%1,%3,(%2)-(%3),31-(%3)" },
+{ "clrlslwi.",4,  PPCCOM,	"rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" },
 };
 
 const int powerpc_num_macros =
diff -Nru a/arch/ppc64/xmon/ppc.h b/arch/ppc64/xmon/ppc.h
--- a/arch/ppc64/xmon/ppc.h	Tue Jun 15 22:20:38 2004
+++ b/arch/ppc64/xmon/ppc.h	Tue Jun 15 22:20:38 2004
@@ -1,5 +1,6 @@
 /* ppc.h -- Header file for PowerPC opcode table
-   Copyright 1994 Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003
+   Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support
 
 This file is part of GDB, GAS, and the GNU binutils.
@@ -58,24 +59,80 @@
 /* Values defined for the flags field of a struct powerpc_opcode.  */
 
 /* Opcode is defined for the PowerPC architecture.  */
-#define PPC_OPCODE_PPC (01)
+#define PPC_OPCODE_PPC			 1
 
 /* Opcode is defined for the POWER (RS/6000) architecture.  */
-#define PPC_OPCODE_POWER (02)
+#define PPC_OPCODE_POWER		 2
 
 /* Opcode is defined for the POWER2 (Rios 2) architecture.  */
-#define PPC_OPCODE_POWER2 (04)
+#define PPC_OPCODE_POWER2		 4
 
 /* Opcode is only defined on 32 bit architectures.  */
-#define PPC_OPCODE_32 (010)
+#define PPC_OPCODE_32			 8
 
 /* Opcode is only defined on 64 bit architectures.  */
-#define PPC_OPCODE_64 (020)
+#define PPC_OPCODE_64		      0x10
 
 /* Opcode is supported by the Motorola PowerPC 601 processor.  The 601
    is assumed to support all PowerPC (PPC_OPCODE_PPC) instructions,
    but it also supports many additional POWER instructions.  */
-#define PPC_OPCODE_601 (040)
+#define PPC_OPCODE_601		      0x20
+
+/* Opcode is supported in both the Power and PowerPC architectures
+   (ie, compiler's -mcpu=common or assembler's -mcom).  */
+#define PPC_OPCODE_COMMON	      0x40
+
+/* Opcode is supported for any Power or PowerPC platform (this is
+   for the assembler's -many option, and it eliminates duplicates).  */
+#define PPC_OPCODE_ANY		      0x80
+
+/* Opcode is supported as part of the 64-bit bridge.  */
+#define PPC_OPCODE_64_BRIDGE	     0x100
+
+/* Opcode is supported by Altivec Vector Unit */
+#define PPC_OPCODE_ALTIVEC	     0x200
+
+/* Opcode is supported by PowerPC 403 processor.  */
+#define PPC_OPCODE_403		     0x400
+
+/* Opcode is supported by PowerPC BookE processor.  */
+#define PPC_OPCODE_BOOKE	     0x800
+
+/* Opcode is only supported by 64-bit PowerPC BookE processor.  */
+#define PPC_OPCODE_BOOKE64	    0x1000
+
+/* Opcode is supported by PowerPC 440 processor.  */
+#define PPC_OPCODE_440		    0x2000
+
+/* Opcode is only supported by Power4 architecture.  */
+#define PPC_OPCODE_POWER4	    0x4000
+
+/* Opcode isn't supported by Power4 architecture.  */
+#define PPC_OPCODE_NOPOWER4	    0x8000
+
+/* Opcode is only supported by POWERPC Classic architecture.  */
+#define PPC_OPCODE_CLASSIC	   0x10000
+
+/* Opcode is only supported by e500x2 Core.  */
+#define PPC_OPCODE_SPE		   0x20000
+
+/* Opcode is supported by e500x2 Integer select APU.  */
+#define PPC_OPCODE_ISEL		   0x40000
+
+/* Opcode is an e500 SPE floating point instruction.  */
+#define PPC_OPCODE_EFS		   0x80000
+
+/* Opcode is supported by branch locking APU.  */
+#define PPC_OPCODE_BRLOCK	  0x100000
+
+/* Opcode is supported by performance monitor APU.  */
+#define PPC_OPCODE_PMR		  0x200000
+
+/* Opcode is supported by cache locking APU.  */
+#define PPC_OPCODE_CACHELCK	  0x400000
+
+/* Opcode is supported by machine check APU.  */
+#define PPC_OPCODE_RFMCI	  0x800000
 
 /* A macro to extract the major opcode from an instruction.  */
 #define PPC_OP(i) (((i) >> 26) & 0x3f)
@@ -106,8 +163,8 @@
      string (the operand will be inserted in any case).  If the
      operand value is legal, *ERRMSG will be unchanged (most operands
      can accept any value).  */
-  unsigned long (*insert) PARAMS ((unsigned long instruction, long op,
-				   const char **errmsg));
+  unsigned long (*insert)
+    (unsigned long instruction, long op, int dialect, const char **errmsg);
 
   /* Extraction function.  This is used by the disassembler.  To
      extract this operand type from an instruction, check this field.
@@ -126,7 +183,7 @@
      non-zero if this operand type can not actually be extracted from
      this operand (i.e., the instruction does not match).  If the
      operand is valid, *INVALID will not be changed.  */
-  long (*extract) PARAMS ((unsigned long instruction, int *invalid));
+  long (*extract) (unsigned long instruction, int dialect, int *invalid);
 
   /* One bit syntax flags.  */
   unsigned long flags;
@@ -210,6 +267,16 @@
    number is allowed).  This flag will only be set for a signed
    operand.  */
 #define PPC_OPERAND_NEGATIVE (04000)
+
+/* This operand names a vector unit register.  The disassembler
+   prints these with a leading 'v'.  */
+#define PPC_OPERAND_VR (010000)
+
+/* This operand is for the DS field in a DS form instruction.  */
+#define PPC_OPERAND_DS (020000)
+
+/* This operand is for the DQ field in a DQ form instruction.  */
+#define PPC_OPERAND_DQ (040000)
 
 /* The POWER and PowerPC assemblers use a few macros.  We keep them
    with the operands table for simplicity.  The macro table is an
diff -Nru a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c
--- a/arch/ppc64/xmon/xmon.c	Tue Jun 15 22:20:44 2004
+++ b/arch/ppc64/xmon/xmon.c	Tue Jun 15 22:20:44 2004
@@ -39,11 +39,16 @@
 
 #ifdef CONFIG_SMP
 volatile cpumask_t cpus_in_xmon = CPU_MASK_NONE;
-static unsigned long got_xmon = 0;
-static volatile int take_xmon = -1;
-static volatile int leaving_xmon = 0;
+static unsigned long xmon_taken = 1;
+static int xmon_owner;
+static int xmon_gate;
 #endif /* CONFIG_SMP */
 
+#define TRAP(regs)	((regs)->trap)
+#define FULL_REGS(regs)	1
+
+static unsigned long in_xmon = 0;
+
 static unsigned long adrs;
 static int size = 1;
 static unsigned long ndump = 64;
@@ -52,24 +57,39 @@
 static int termch;
 static char tmpstr[128];
 
-static u_int bus_error_jmp[100];
+#define JMP_BUF_LEN	(184/sizeof(long))
+static long bus_error_jmp[JMP_BUF_LEN];
+static int catch_memory_errors;
+static long *xmon_fault_jmp[NR_CPUS];
 #define setjmp xmon_setjmp
 #define longjmp xmon_longjmp
 
 /* Breakpoint stuff */
 struct bpt {
-	unsigned long address;
-	unsigned instr;
-	unsigned long count;
-	unsigned char enabled;
+	unsigned long	address;
+	unsigned int	instr[2];
+	atomic_t	ref_count;
+	int		enabled;
+	unsigned long	pad;
 };
 
-#define NBPTS	16
+/* Bits in bpt.enabled */
+#define BP_IABR_TE	1		/* IABR translation enabled */
+#define BP_IABR		2
+#define BP_TRAP		8
+#define BP_DABR		0x10
+
+#define NBPTS	256
 static struct bpt bpts[NBPTS];
 static struct bpt dabr;
-static struct bpt iabr;
+static struct bpt *iabr;
 static unsigned bpinstr = 0x7fe00008;	/* trap */
 
+#define BP_NUM(bp)	((bp) - bpts + 1)
+
+/* Bits in SRR1 that are copied from MSR */
+#define MSR_MASK	0xffffffff87c0ffff
+
 /* Prototypes */
 static int cmds(struct pt_regs *);
 static int mread(unsigned long, void *, int);
@@ -80,7 +100,7 @@
 static int bsesc(void);
 static void dump(void);
 static void prdump(unsigned long, long);
-static int ppc_inst_dump(unsigned long, long);
+static int ppc_inst_dump(unsigned long, long, int);
 void print_address(unsigned long);
 static void backtrace(struct pt_regs *);
 static void excprint(struct pt_regs *);
@@ -97,34 +117,40 @@
 static void flush_input(void);
 static int inchar(void);
 static void take_input(char *);
-/* static void openforth(void); */
 static unsigned long read_spr(int);
 static void write_spr(int, unsigned long);
 static void super_regs(void);
 static void remove_bpts(void);
 static void insert_bpts(void);
+static void remove_cpu_bpts(void);
+static void insert_cpu_bpts(void);
 static struct bpt *at_breakpoint(unsigned long pc);
+static struct bpt *in_breakpoint_table(unsigned long pc, unsigned long *offp);
+static int  do_step(struct pt_regs *);
 static void bpt_cmds(void);
 static void cacheflush(void);
-#ifdef CONFIG_SMP
-static void cpu_cmd(void);
-#endif /* CONFIG_SMP */
+static int  cpu_cmd(void);
 static void csum(void);
 static void bootcmds(void);
 void dump_segments(void);
 static void symbol_lookup(void);
+static int emulate_step(struct pt_regs *regs, unsigned int instr);
+static void xmon_print_symbol(unsigned long address, const char *mid,
+			      const char *after);
+static const char *getvecname(unsigned long vec);
 
 static void debug_trace(void);
 
-extern int print_insn_big_powerpc(FILE *, unsigned long, unsigned long);
+extern int print_insn_powerpc(unsigned long, unsigned long, int);
 extern void printf(const char *fmt, ...);
 extern void xmon_vfprintf(void *f, const char *fmt, va_list ap);
 extern int xmon_putc(int c, void *f);
 extern int putchar(int ch);
 extern int xmon_read_poll(void);
-extern int setjmp(u_int *);
-extern void longjmp(u_int *, int);
+extern int setjmp(long *);
+extern void longjmp(long *, int);
 extern unsigned long _ASR;
+extern char SystemCall_common[];
 
 pte_t *find_linux_pte(pgd_t *pgdir, unsigned long va);	/* from htab.c */
 
@@ -147,7 +173,6 @@
 #ifdef CONFIG_SMP
   "\
   c	print cpus stopped in xmon\n\
-  ci	send xmon interrupt to all other cpus\n\
   c#	try to switch to cpu number h (in hex)\n"
 #endif
   "\
@@ -182,22 +207,8 @@
   zh	halt\n"
 ;
 
-static int xmon_trace[NR_CPUS];
-#define SSTEP	1		/* stepping because of 's' command */
-#define BRSTEP	2		/* stepping over breakpoint */
-
-static struct pt_regs *xmon_regs[NR_CPUS];
-
-void __xmon_print_symbol(const char *fmt, unsigned long address);
-#define xmon_print_symbol(fmt, addr)		\
-do {						\
-	__check_printsym_format(fmt, "");	\
-	__xmon_print_symbol(fmt, addr);		\
-} while(0)
+static struct pt_regs *xmon_regs;
 
-/*
- * Stuff for reading and writing memory safely
- */
 extern inline void sync(void)
 {
 	asm volatile("sync; isync");
@@ -223,22 +234,278 @@
  no functions have been called from the current function.
  */
 
+/*
+ * We don't allow single-stepping an mtmsrd that would clear
+ * MSR_RI, since that would make the exception unrecoverable.
+ * Since we need to single-step to proceed from a breakpoint,
+ * we don't allow putting a breakpoint on an mtmsrd instruction.
+ * Similarly we don't allow breakpoints on rfid instructions.
+ * These macros tell us if an instruction is a mtmsrd or rfid.
+ */
+#define IS_MTMSRD(instr)	(((instr) & 0xfc0007fe) == 0x7c000164)
+#define IS_RFID(instr)		(((instr) & 0xfc0007fe) == 0x4c000024)
+
+/*
+ * Disable surveillance (the service processor watchdog function)
+ * while we are in xmon.
+ * XXX we should re-enable it when we leave. :)
+ */
 #define SURVEILLANCE_TOKEN	9000
 
 static inline void disable_surveillance(void)
 {
 #ifndef CONFIG_PPC_ISERIES
-        rtas_call(rtas_token("set-indicator"), 3, 1, NULL, SURVEILLANCE_TOKEN,
-		  0, 0);
+	/* Since this can't be a module, args should end up below 4GB. */
+	static struct rtas_args args;
+
+	if (systemcfg->platform & PLATFORM_PSERIES) {
+		/*
+		 * At this point we have got all the cpus we can into
+		 * xmon, so there is hopefully no other cpu calling RTAS
+		 * at the moment, even though we don't take rtas.lock.
+		 * If we did try to take rtas.lock there would be a
+		 * real possibility of deadlock.
+		 */
+		args.token = rtas_token("set-indicator");
+		if (args.token == RTAS_UNKNOWN_SERVICE)
+			return;
+		args.nargs = 3;
+		args.nret = 1;
+		args.rets = &args.args[3];
+		args.args[0] = SURVEILLANCE_TOKEN;
+		args.args[1] = 0;
+		args.args[2] = 0;
+		enter_rtas(__pa(&args));
+	}
 #endif
 }
 
-int
-xmon(struct pt_regs *excp)
+#ifdef CONFIG_SMP
+static int xmon_speaker;
+
+static void get_output_lock(void)
+{
+	int me = smp_processor_id() + 0x100;
+	int last_speaker = 0, prev;
+	long timeout;
+
+	if (xmon_speaker == me)
+		return;
+	for (;;) {
+		if (xmon_speaker == 0) {
+			last_speaker = cmpxchg(&xmon_speaker, 0, me);
+			if (last_speaker == 0)
+				return;
+		}
+		timeout = 10000000;
+		while (xmon_speaker == last_speaker) {
+			if (--timeout > 0)
+				continue;
+			/* hostile takeover */
+			prev = cmpxchg(&xmon_speaker, last_speaker, me);
+			if (prev == last_speaker)
+				return;
+			break;
+		}
+	}
+}
+
+static void release_output_lock(void)
+{
+	xmon_speaker = 0;
+}
+#endif
+
+int xmon_core(struct pt_regs *regs, int fromipi)
 {
-	struct pt_regs regs;
 	int cmd = 0;
 	unsigned long msr;
+	struct bpt *bp;
+	long recurse_jmp[JMP_BUF_LEN];
+	unsigned long offset;
+#ifdef CONFIG_SMP
+	int cpu;
+	int secondary;
+	unsigned long timeout;
+#endif
+
+	msr = get_msr();
+	set_msrd(msr & ~MSR_EE);	/* disable interrupts */
+
+	bp = in_breakpoint_table(regs->nip, &offset);
+	if (bp != NULL) {
+		regs->nip = bp->address + offset;
+		atomic_dec(&bp->ref_count);
+	}
+
+	remove_cpu_bpts();
+
+#ifdef CONFIG_SMP
+	cpu = smp_processor_id();
+	if (cpu_isset(cpu, cpus_in_xmon)) {
+		get_output_lock();
+		excprint(regs);
+		printf("cpu 0x%x: Exception %lx %s in xmon, "
+		       "returning to main loop\n",
+		       cpu, regs->trap, getvecname(TRAP(regs)));
+		longjmp(xmon_fault_jmp[cpu], 1);
+	}
+
+	if (setjmp(recurse_jmp) != 0) {
+		if (!in_xmon || !xmon_gate) {
+			printf("xmon: WARNING: bad recursive fault "
+			       "on cpu 0x%x\n", cpu);
+			goto waiting;
+		}
+		secondary = !(xmon_taken && cpu == xmon_owner);
+		goto cmdloop;
+	}
+
+	xmon_fault_jmp[cpu] = recurse_jmp;
+	cpu_set(cpu, cpus_in_xmon);
+
+	bp = NULL;
+	if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF))
+		bp = at_breakpoint(regs->nip);
+	if (bp || (regs->msr & MSR_RI) == 0)
+		fromipi = 0;
+
+	if (!fromipi) {
+		get_output_lock();
+		excprint(regs);
+		if (bp) {
+			printf("cpu 0x%x stopped at breakpoint 0x%x (",
+			       cpu, BP_NUM(bp));
+			xmon_print_symbol(regs->nip, " ", ")\n");
+		}
+		if ((regs->msr & MSR_RI) == 0)
+			printf("WARNING: exception is not recoverable, "
+			       "can't continue\n");
+		release_output_lock();
+	}
+
+ waiting:
+	secondary = 1;
+	while (secondary && !xmon_gate) {
+		if (in_xmon == 0) {
+			if (fromipi)
+				goto leave;
+			secondary = test_and_set_bit(0, &in_xmon);
+		}
+		barrier();
+	}
+
+	if (!secondary && !xmon_gate) {
+		/* we are the first cpu to come in */
+		/* interrupt other cpu(s) */
+		int ncpus = num_online_cpus();
+
+		xmon_owner = cpu;
+		mb();
+		if (ncpus > 1) {
+			smp_send_debugger_break(MSG_ALL_BUT_SELF);
+			/* wait for other cpus to come in */
+			for (timeout = 100000000; timeout != 0; --timeout)
+				if (cpus_weight(cpus_in_xmon) >= ncpus)
+					break;
+		}
+		remove_bpts();
+		disable_surveillance();
+		/* for breakpoint or single step, print the current instr. */
+		if (bp || TRAP(regs) == 0xd00)
+			ppc_inst_dump(regs->nip, 1, 0);
+		printf("enter ? for help\n");
+		mb();
+		xmon_gate = 1;
+		barrier();
+	}
+
+ cmdloop:
+	while (in_xmon) {
+		if (secondary) {
+			if (cpu == xmon_owner) {
+				if (!test_and_set_bit(0, &xmon_taken)) {
+					secondary = 0;
+					continue;
+				}
+				/* missed it */
+				while (cpu == xmon_owner)
+					barrier();
+			}
+			barrier();
+		} else {
+			cmd = cmds(regs);
+			if (cmd != 0) {
+				/* exiting xmon */
+				insert_bpts();
+				xmon_gate = 0;
+				wmb();
+				in_xmon = 0;
+				break;
+			}
+			/* have switched to some other cpu */
+			secondary = 1;
+		}
+	}
+ leave:
+	cpu_clear(cpu, cpus_in_xmon);
+	xmon_fault_jmp[cpu] = NULL;
+
+#else
+	/* UP is simple... */
+	if (in_xmon) {
+		printf("Exception %lx %s in xmon, returning to main loop\n",
+		       regs->trap, getvecname(TRAP(regs)));
+		longjmp(xmon_fault_jmp[0], 1);
+	}
+	if (setjmp(recurse_jmp) == 0) {
+		xmon_fault_jmp[0] = recurse_jmp;
+		in_xmon = 1;
+
+		excprint(regs);
+		bp = at_breakpoint(regs->nip);
+		if (bp) {
+			printf("Stopped at breakpoint %x (", BP_NUM(bp));
+			xmon_print_symbol(regs->nip, " ", ")\n");
+		}
+		if ((regs->msr & MSR_RI) == 0)
+			printf("WARNING: exception is not recoverable, "
+			       "can't continue\n");
+		remove_bpts();
+		disable_surveillance();
+		/* for breakpoint or single step, print the current instr. */
+		if (bp || TRAP(regs) == 0xd00)
+			ppc_inst_dump(regs->nip, 1, 0);
+		printf("enter ? for help\n");
+	}
+
+	cmd = cmds(regs);
+
+	insert_bpts();
+	in_xmon = 0;
+#endif
+
+	if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF)) {
+		bp = at_breakpoint(regs->nip);
+		if (bp != NULL) {
+			int stepped = emulate_step(regs, bp->instr[0]);
+			if (stepped == 0) {
+				regs->nip = (unsigned long) &bp->instr[0];
+				atomic_inc(&bp->ref_count);
+			}
+		}
+	}
+
+	insert_cpu_bpts();
+
+	set_msrd(msr);		/* restore interrupt enable */
+
+	return cmd != 'X';
+}
+
+int xmon(struct pt_regs *excp)
+{
+	struct pt_regs regs;
 
 	if (excp == NULL) {
 		/* Ok, grab regs as they are now.
@@ -289,142 +556,95 @@
 		regs.trap = 0;
 		excp = &regs;
 	}
+	return xmon_core(excp, 0);
+}
 
-	msr = get_msr();
-	set_msrd(msr & ~MSR_EE);	/* disable interrupts */
-	xmon_regs[smp_processor_id()] = excp;
-	excprint(excp);
-#ifdef CONFIG_SMP
-	leaving_xmon = 0;
-	/* possible race condition here if a CPU is held up and gets
-	 * here while we are exiting */
-	if (cpu_test_and_set(smp_processor_id(), cpus_in_xmon)) {
-		/* xmon probably caused an exception itself */
-		printf("We are already in xmon\n");
-		for (;;)
-			cpu_relax();
-	}
-	while (test_and_set_bit(0, &got_xmon)) {
-		if (take_xmon == smp_processor_id()) {
-			take_xmon = -1;
-			break;
-		}
-		cpu_relax();
-	}
-	/*
-	 * XXX: breakpoints are removed while any cpu is in xmon
-	 */
-#endif /* CONFIG_SMP */
-	remove_bpts();
-	disable_surveillance();
-	printf("press ? for help ");
-	cmd = cmds(excp);
-	if (cmd == 's') {
-		xmon_trace[smp_processor_id()] = SSTEP;
-		excp->msr |= MSR_SE;
-#ifdef CONFIG_SMP		
-		take_xmon = smp_processor_id();
-#endif		
-	} else if (at_breakpoint(excp->nip)) {
-		xmon_trace[smp_processor_id()] = BRSTEP;
-		excp->msr |= MSR_SE;
-	} else {
-		xmon_trace[smp_processor_id()] = 0;
-		insert_bpts();
+int xmon_bpt(struct pt_regs *regs)
+{
+	struct bpt *bp;
+	unsigned long offset;
+
+	if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
+		return 0;
+
+	/* Are we at the trap at bp->instr[1] for some bp? */
+	bp = in_breakpoint_table(regs->nip, &offset);
+	if (bp != NULL && offset == 4) {
+		regs->nip = bp->address + 4;
+		atomic_dec(&bp->ref_count);
+		return 1;
 	}
-	xmon_regs[smp_processor_id()] = 0;
-#ifdef CONFIG_SMP
-	leaving_xmon = 1;
-	if (cmd != 's')
-		clear_bit(0, &got_xmon);
-	cpu_clear(smp_processor_id(), cpus_in_xmon);
-#endif /* CONFIG_SMP */
-	set_msrd(msr);		/* restore interrupt enable */
 
-	if (cmd == 'X')
+	/* Are we at a breakpoint? */
+	bp = at_breakpoint(regs->nip);
+	if (!bp)
 		return 0;
 
+	xmon_core(regs, 0);
+
 	return 1;
 }
 
-int
-xmon_bpt(struct pt_regs *regs)
+int xmon_sstep(struct pt_regs *regs)
 {
-	struct bpt *bp;
-
-	bp = at_breakpoint(regs->nip);
-	if (!bp)
+	if (user_mode(regs))
 		return 0;
-	if (bp->count) {
-		--bp->count;
-		remove_bpts();
-		excprint(regs);
-		xmon_trace[smp_processor_id()] = BRSTEP;
-		regs->msr |= MSR_SE;
-	} else {
-		printf("Stopped at breakpoint %x (%lx ", (bp - bpts) + 1,
-			bp->address);
-		xmon_print_symbol("%s)\n", bp->address);
-		xmon(regs);
-	}
+	xmon_core(regs, 0);
 	return 1;
 }
 
-int
-xmon_sstep(struct pt_regs *regs)
+int xmon_dabr_match(struct pt_regs *regs)
 {
-	if (!xmon_trace[smp_processor_id()])
+	if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
 		return 0;
-	if (xmon_trace[smp_processor_id()] == BRSTEP) {
-		xmon_trace[smp_processor_id()] = 0;
-		insert_bpts();
-	} else {
-		xmon(regs);
-	}
+	xmon_core(regs, 0);
 	return 1;
 }
 
-int
-xmon_dabr_match(struct pt_regs *regs)
+int xmon_iabr_match(struct pt_regs *regs)
 {
-	if (dabr.enabled && dabr.count) {
-		--dabr.count;
-		remove_bpts();
-		excprint(regs);
-		xmon_trace[smp_processor_id()] = BRSTEP;
-		regs->msr |= MSR_SE;
-	} else {
-		dabr.instr = regs->nip;
-		xmon(regs);
-	}
+	if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
+		return 0;
+	if (iabr == 0)
+		return 0;
+	xmon_core(regs, 0);
 	return 1;
 }
 
-int
-xmon_iabr_match(struct pt_regs *regs)
+int xmon_ipi(struct pt_regs *regs)
 {
-	if (iabr.enabled && iabr.count) {
-		--iabr.count;
-		remove_bpts();
-		excprint(regs);
-		xmon_trace[smp_processor_id()] = BRSTEP;
-		regs->msr |= MSR_SE;
-	} else {
-		xmon(regs);
+#ifdef CONFIG_SMP
+	if (in_xmon && !cpu_isset(smp_processor_id(), cpus_in_xmon))
+		xmon_core(regs, 1);
+#endif
+	return 0;
+}
+
+int xmon_fault_handler(struct pt_regs *regs)
+{
+	struct bpt *bp;
+	unsigned long offset;
+
+	if (in_xmon && catch_memory_errors)
+		handle_fault(regs);	/* doesn't return */
+
+	if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF)) {
+		bp = in_breakpoint_table(regs->nip, &offset);
+		if (bp != NULL) {
+			regs->nip = bp->address + offset;
+			atomic_dec(&bp->ref_count);
+		}
 	}
-	return 1;
+
+	return 0;
 }
 
-static struct bpt *
-at_breakpoint(unsigned long pc)
+
+static struct bpt *at_breakpoint(unsigned long pc)
 {
 	int i;
 	struct bpt *bp;
 
-	if (dabr.enabled && pc == dabr.instr)
-		return &dabr;
-	if (iabr.enabled && pc == iabr.address)
-		return &iabr;
 	bp = bpts;
 	for (i = 0; i < NBPTS; ++i, ++bp)
 		if (bp->enabled && pc == bp->address)
@@ -432,73 +652,228 @@
 	return 0;
 }
 
-static void
-insert_bpts()
+static struct bpt *in_breakpoint_table(unsigned long nip, unsigned long *offp)
+{
+	unsigned long off;
+
+	off = nip - (unsigned long) bpts;
+	if (off >= sizeof(bpts))
+		return NULL;
+	off %= sizeof(struct bpt);
+	if (off != offsetof(struct bpt, instr[0])
+	    && off != offsetof(struct bpt, instr[1]))
+		return NULL;
+	*offp = off - offsetof(struct bpt, instr[0]);
+	return (struct bpt *) (nip - off);
+}
+
+static struct bpt *new_breakpoint(unsigned long a)
+{
+	struct bpt *bp;
+
+	a &= ~3UL;
+	bp = at_breakpoint(a);
+	if (bp)
+		return bp;
+
+	for (bp = bpts; bp < &bpts[NBPTS]; ++bp) {
+		if (!bp->enabled && atomic_read(&bp->ref_count) == 0) {
+			bp->address = a;
+			bp->instr[1] = bpinstr;
+			store_inst(&bp->instr[1]);
+			return bp;
+		}
+	}
+
+	printf("Sorry, no free breakpoints.  Please clear one first.\n");
+	return NULL;
+}
+
+static void insert_bpts(void)
 {
 	int i;
 	struct bpt *bp;
 
 	bp = bpts;
 	for (i = 0; i < NBPTS; ++i, ++bp) {
-		if (!bp->enabled)
+		if ((bp->enabled & (BP_TRAP|BP_IABR)) == 0)
 			continue;
-		if (mread(bp->address, &bp->instr, 4) != 4
-		    || mwrite(bp->address, &bpinstr, 4) != 4) {
-			printf("Couldn't insert breakpoint at %x, disabling\n",
-			       bp->address);
+		if (mread(bp->address, &bp->instr[0], 4) != 4) {
+			printf("Couldn't read instruction at %lx, "
+			       "disabling breakpoint there\n", bp->address);
 			bp->enabled = 0;
-		} else {
-			store_inst((void *)bp->address);
+			continue;
+		}
+		if (IS_MTMSRD(bp->instr[0]) || IS_RFID(bp->instr[0])) {
+			printf("Breakpoint at %lx is on an mtmsrd or rfid "
+			       "instruction, disabling it\n", bp->address);
+			bp->enabled = 0;
+			continue;
+		}
+		store_inst(&bp->instr[0]);
+		if (bp->enabled & BP_IABR)
+			continue;
+		if (mwrite(bp->address, &bpinstr, 4) != 4) {
+			printf("Couldn't write instruction at %lx, "
+			       "disabling breakpoint there\n", bp->address);
+			bp->enabled &= ~BP_TRAP;
+			continue;
 		}
+		store_inst((void *)bp->address);
 	}
+}
 
+static void insert_cpu_bpts(void)
+{
 	if (dabr.enabled)
-		set_dabr(dabr.address);
-	if ((cur_cpu_spec->cpu_features & CPU_FTR_IABR) && iabr.enabled)
-		set_iabr(iabr.address);
+		set_dabr(dabr.address | (dabr.enabled & 7));
+	if (iabr && (cur_cpu_spec->cpu_features & CPU_FTR_IABR))
+		set_iabr(iabr->address
+			 | (iabr->enabled & (BP_IABR|BP_IABR_TE)));
 }
 
-static void
-remove_bpts()
+static void remove_bpts(void)
 {
 	int i;
 	struct bpt *bp;
 	unsigned instr;
 
-	set_dabr(0);
-	if ((cur_cpu_spec->cpu_features & CPU_FTR_IABR))
-		set_iabr(0);
-
 	bp = bpts;
 	for (i = 0; i < NBPTS; ++i, ++bp) {
-		if (!bp->enabled)
+		if ((bp->enabled & (BP_TRAP|BP_IABR)) != BP_TRAP)
 			continue;
 		if (mread(bp->address, &instr, 4) == 4
 		    && instr == bpinstr
 		    && mwrite(bp->address, &bp->instr, 4) != 4)
-			printf("Couldn't remove breakpoint at %x\n",
+			printf("Couldn't remove breakpoint at %lx\n",
 			       bp->address);
 		else
 			store_inst((void *)bp->address);
 	}
 }
 
-static char *last_cmd;
+static void remove_cpu_bpts(void)
+{
+	set_dabr(0);
+	if ((cur_cpu_spec->cpu_features & CPU_FTR_IABR))
+		set_iabr(0);
+}
+
+static int branch_taken(unsigned int instr, struct pt_regs *regs)
+{
+	unsigned int bo = (instr >> 21) & 0x1f;
+	unsigned int bi;
+
+	if ((bo & 4) == 0) {
+		/* decrement counter */
+		--regs->ctr;
+		if (((bo >> 1) & 1) ^ (regs->ctr == 0))
+			return 0;
+	}
+	if ((bo & 0x10) == 0) {
+		/* check bit from CR */
+		bi = (instr >> 16) & 0x1f;
+		if (((regs->ccr >> (31 - bi)) & 1) != ((bo >> 3) & 1))
+			return 0;
+	}
+	return 1;
+}
+
+/*
+ * Emulate instructions that cause a transfer of control.
+ * Returns 1 if the step was emulated, 0 if not,
+ * or -1 if the instruction is one that should not be stepped,
+ * such as an rfid, or a mtmsrd that would clear MSR_RI.
+ */
+static int emulate_step(struct pt_regs *regs, unsigned int instr)
+{
+	unsigned int opcode, rd;
+	unsigned long int imm;
+
+	opcode = instr >> 26;
+	switch (opcode) {
+	case 16:	/* bc */
+		imm = (signed short)(instr & 0xfffc);
+		if ((instr & 2) == 0)
+			imm += regs->nip;
+		regs->nip += 4;		/* XXX check 32-bit mode */
+		if (instr & 1)
+			regs->link = regs->nip;
+		if (branch_taken(instr, regs))
+			regs->nip = imm;
+		return 1;
+	case 17:	/* sc */
+		regs->gpr[9] = regs->gpr[13];
+		regs->gpr[11] = regs->nip + 4;
+		regs->gpr[12] = regs->msr & MSR_MASK;
+		regs->gpr[13] = (unsigned long) get_paca();
+		regs->nip = (unsigned long) &SystemCall_common;
+		regs->msr = MSR_KERNEL;
+		return 1;
+	case 18:	/* b */
+		imm = instr & 0x03fffffc;
+		if (imm & 0x02000000)
+			imm -= 0x04000000;
+		if ((instr & 2) == 0)
+			imm += regs->nip;
+		if (instr & 1)
+			regs->link = regs->nip + 4;
+		regs->nip = imm;
+		return 1;
+	case 19:
+		switch (instr & 0x7fe) {
+		case 0x20:	/* bclr */
+		case 0x420:	/* bcctr */
+			imm = (instr & 0x400)? regs->ctr: regs->link;
+			regs->nip += 4;		/* XXX check 32-bit mode */
+			if (instr & 1)
+				regs->link = regs->nip;
+			if (branch_taken(instr, regs))
+				regs->nip = imm;
+			return 1;
+		case 0x24:	/* rfid, scary */
+			printf("Can't single-step an rfid instruction\n");
+			return -1;
+		}
+	case 31:
+		rd = (instr >> 21) & 0x1f;
+		switch (instr & 0x7fe) {
+		case 0xa6:	/* mfmsr */
+			regs->gpr[rd] = regs->msr & MSR_MASK;
+			regs->nip += 4;
+			return 1;
+		case 0x164:	/* mtmsrd */
+			/* only MSR_EE and MSR_RI get changed if bit 15 set */
+			/* mtmsrd doesn't change MSR_HV and MSR_ME */
+			imm = (instr & 0x10000)? 0x8002: 0xefffffffffffefffUL;
+			imm = (regs->msr & MSR_MASK & ~imm)
+				| (regs->gpr[rd] & imm);
+			if ((imm & MSR_RI) == 0) {
+				printf("Can't step an instruction that would "
+				       "clear MSR.RI\n");
+				return -1;
+			}
+			regs->msr = imm;
+			regs->nip += 4;
+			return 1;
+		}
+	}
+	return 0;
+}
 
 /* Command interpreting routine */
+static char *last_cmd;
+
 static int
 cmds(struct pt_regs *excp)
 {
 	int cmd = 0;
 
 	last_cmd = NULL;
+	xmon_regs = excp;
 	for(;;) {
 #ifdef CONFIG_SMP
-		/* Need to check if we should take any commands on
-		   this CPU. */
-		if (leaving_xmon)
-			return cmd;
-		printf("%d:", smp_processor_id());
+		printf("%x:", smp_processor_id());
 #endif /* CONFIG_SMP */
 		printf("mon> ");
 		fflush(stdout);
@@ -545,10 +920,7 @@
 			prregs(excp);	/* print regs */
 			break;
 		case 'e':
-			if (excp == NULL)
-				printf("No exception information\n");
-			else
-				excprint(excp);
+			excprint(excp);
 			break;
 		case 'S':
 			super_regs();
@@ -560,6 +932,9 @@
 			cacheflush();
 			break;
 		case 's':
+			if (do_step(excp))
+				return cmd;
+			break;
 		case 'x':
 		case 'X':
 		case EOF:
@@ -576,13 +951,13 @@
 		case 'C':
 			csum();
 			break;
-#ifdef CONFIG_SMP
 		case 'c':
-			cpu_cmd();
+			if (cpu_cmd())
+				return 0;
 			break;
-#endif /* CONFIG_SMP */
 		case 'z':
 			bootcmds();
+			break;
 		case 'T':
 			debug_trace();
 			break;
@@ -592,7 +967,7 @@
 		default:
 			printf("Unrecognized command: ");
 		        do {
-				if( ' ' < cmd && cmd <= '~' )
+				if (' ' < cmd && cmd <= '~')
 					putchar(cmd);
 				else
 					printf("\\x%x", cmd);
@@ -601,10 +976,37 @@
 			printf(" (type ? for help)\n");
 			break;
 		}
-		cpu_relax();
 	}
 }
 
+/*
+ * Step a single instruction.
+ * Some instructions we emulate, others we execute with MSR_SE set.
+ */
+static int do_step(struct pt_regs *regs)
+{
+	unsigned int instr;
+	int stepped;
+
+	/* check we are in 64-bit kernel mode, translation enabled */
+	if ((regs->msr & (MSR_SF|MSR_PR|MSR_IR)) == (MSR_SF|MSR_IR)) {
+		if (mread(regs->nip, &instr, 4) == 4) {
+			stepped = emulate_step(regs, instr);
+			if (stepped < 0)
+				return 0;
+			if (stepped > 0) {
+				regs->trap = 0xd00 | (regs->trap & 1);
+				printf("stepped to ");
+				xmon_print_symbol(regs->nip, " ", "\n");
+				ppc_inst_dump(regs->nip, 1, 0);
+				return 0;
+			}
+		}
+	}
+	regs->msr |= MSR_SE;
+	return 1;
+}
+
 static void bootcmds(void)
 {
 	int cmd;
@@ -618,56 +1020,59 @@
 		ppc_md.power_off();
 }
 
-#ifdef CONFIG_SMP
-static void cpu_cmd(void)
+static int cpu_cmd(void)
 {
+#ifdef CONFIG_SMP
 	unsigned long cpu;
 	int timeout;
-	int cmd;
+	int count;
 
-	cmd = inchar();
-	if (cmd == 'i') {
-		printf("stopping all cpus\n");
-		/* interrupt other cpu(s) */
-		cpu = MSG_ALL_BUT_SELF;
-		smp_send_debugger_break(cpu);
-		return;
-	}
-	termch = cmd;
 	if (!scanhex(&cpu)) {
 		/* print cpus waiting or in xmon */
 		printf("cpus stopped:");
+		count = 0;
 		for (cpu = 0; cpu < NR_CPUS; ++cpu) {
 			if (cpu_isset(cpu, cpus_in_xmon)) {
-				printf(" %x", cpu);
-				if (cpu == smp_processor_id())
-					printf("*", cpu);
+				if (count == 0)
+					printf(" %x", cpu);
+				++count;
+			} else {
+				if (count > 1)
+					printf("-%x", cpu - 1);
+				count = 0;
 			}
 		}
+		if (count > 1)
+			printf("-%x", NR_CPUS - 1);
 		printf("\n");
-		return;
+		return 0;
 	}
 	/* try to switch to cpu specified */
-	take_xmon = cpu;
+	if (!cpu_isset(cpu, cpus_in_xmon)) {
+		printf("cpu 0x%x isn't in xmon\n", cpu);
+		return 0;
+	}
+	xmon_taken = 0;
+	mb();
+	xmon_owner = cpu;
 	timeout = 10000000;
-	while (take_xmon >= 0) {
+	while (!xmon_taken) {
 		if (--timeout == 0) {
-			/* yes there's a race here */
-			take_xmon = -1;
+			if (test_and_set_bit(0, &xmon_taken))
+				break;
+			/* take control back */
+			mb();
+			xmon_owner = smp_processor_id();
 			printf("cpu %u didn't take control\n", cpu);
-			return;
-		}
-	}
-	/* now have to wait to be given control back */
-	while (test_and_set_bit(0, &got_xmon)) {
-		if (take_xmon == smp_processor_id()) {
-			take_xmon = -1;
-			break;
+			return 0;
 		}
-		cpu_relax();
+		barrier();
 	}
-}
+	return 1;
+#else
+	return 0;
 #endif /* CONFIG_SMP */
+}
 
 static unsigned short fcstab[256] = {
 	0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
@@ -728,6 +1133,30 @@
 	printf("%x\n", fcs);
 }
 
+/*
+ * Check if this is a suitable place to put a breakpoint.
+ */
+static long check_bp_loc(unsigned long addr)
+{
+	unsigned int instr;
+
+	addr &= ~3;
+	if (addr < KERNELBASE) {
+		printf("Breakpoints may only be placed at kernel addresses\n");
+		return 0;
+	}
+	if (!mread(addr, &instr, sizeof(instr))) {
+		printf("Can't read instruction at address %lx\n", addr);
+		return 0;
+	}
+	if (IS_MTMSRD(instr) || IS_RFID(instr)) {
+		printf("Breakpoints may not be placed on mtmsrd or rfid "
+		       "instructions\n");
+		return 0;
+	}
+	return 1;
+}
+
 static char *breakpoint_help_string = 
     "Breakpoint command usage:\n"
     "b                show breakpoints\n"
@@ -745,6 +1174,8 @@
 	unsigned long a;
 	int mode, i;
 	struct bpt *bp;
+	const char badaddr[] = "Only kernel addresses are permitted "
+		"for breakpoints\n";
 
 	cmd = inchar();
 	switch (cmd) {
@@ -758,54 +1189,66 @@
 		else
 			termch = cmd;
 		dabr.address = 0;
-		dabr.count = 0;
-		dabr.enabled = scanhex(&dabr.address);
-		scanhex(&dabr.count);
-		if (dabr.enabled)
-			dabr.address = (dabr.address & ~7) | mode;
+		dabr.enabled = 0;
+		if (scanhex(&dabr.address)) {
+			if (dabr.address < KERNELBASE) {
+				printf(badaddr);
+				break;
+			}
+			dabr.address &= ~7;
+			dabr.enabled = mode | BP_DABR;
+		}
 		break;
+
 	case 'i':	/* bi - hardware instr breakpoint */
 		if (!(cur_cpu_spec->cpu_features & CPU_FTR_IABR)) {
-			printf("Not implemented on POWER4\n");
+			printf("Hardware instruction breakpoint "
+			       "not supported on this cpu\n");
+			break;
+		}
+		if (iabr) {
+			iabr->enabled &= ~(BP_IABR | BP_IABR_TE);
+			iabr = NULL;
+		}
+		if (!scanhex(&a))
+			break;
+		if (!check_bp_loc(a))
 			break;
+		bp = new_breakpoint(a);
+		if (bp != NULL) {
+			bp->enabled |= BP_IABR | BP_IABR_TE;
+			iabr = bp;
 		}
-		iabr.address = 0;
-		iabr.count = 0;
-		iabr.enabled = scanhex(&iabr.address);
-		if (iabr.enabled)
-			iabr.address |= 3;
-		scanhex(&iabr.count);
 		break;
+
 	case 'c':
 		if (!scanhex(&a)) {
 			/* clear all breakpoints */
 			for (i = 0; i < NBPTS; ++i)
 				bpts[i].enabled = 0;
-			iabr.enabled = 0;
+			iabr = NULL;
 			dabr.enabled = 0;
 			printf("All breakpoints cleared\n");
+			break;
+		}
+
+		if (a <= NBPTS && a >= 1) {
+			/* assume a breakpoint number */
+			bp = &bpts[a-1];	/* bp nums are 1 based */
 		} else {
-			if (a <= NBPTS && a >= 1) {
-				/* assume a breakpoint number */
-				--a;	/* bp nums are 1 based */
-				bp = &bpts[a];
-			} else {
-				/* assume a breakpoint address */
-				bp = at_breakpoint(a);
-			}
+			/* assume a breakpoint address */
+			bp = at_breakpoint(a);
 			if (bp == 0) {
 				printf("No breakpoint at %x\n", a);
-			} else {
-				printf("Cleared breakpoint %x (%lx ", 
-					(bp - bpts) + 1, bp->address);
-				xmon_print_symbol("%s)\n", bp->address);
-				bp->enabled = 0;
+				break;
 			}
 		}
+
+		printf("Cleared breakpoint %x (", BP_NUM(bp));
+		xmon_print_symbol(bp->address, " ", ")\n");
+		bp->enabled = 0;
 		break;
-	case '?':
-	        printf(breakpoint_help_string);
-	        break;
+
 	default:
 		termch = cmd;
 	        cmd = skipbl();
@@ -816,53 +1259,30 @@
 		termch = cmd;
 		if (!scanhex(&a)) {
 			/* print all breakpoints */
-			int bpnum;
-
-			printf("   type            address    count\n");
+			printf("   type            address\n");
 			if (dabr.enabled) {
-				printf("   data   %.16lx %8x [", dabr.address & ~7,
-				       dabr.count);
-				if (dabr.address & 1)
+				printf("   data   %.16lx  [", dabr.address);
+				if (dabr.enabled & 1)
 					printf("r");
-				if (dabr.address & 2)
+				if (dabr.enabled & 2)
 					printf("w");
 				printf("]\n");
 			}
-			if (iabr.enabled)
-				printf("   inst   %.16lx %8x\n", iabr.address & ~3,
-				       iabr.count);
-			for (bp = bpts, bpnum = 1; bp < &bpts[NBPTS]; ++bp, ++bpnum)
-				if (bp->enabled) {
-					printf("%2x trap   %.16lx %8x  ",
-						bpnum, bp->address, bp->count);
-					xmon_print_symbol("%s\n", bp->address);
-				}
-			break;
-		}
-		
-		if (systemcfg->platform != PLATFORM_POWERMAC &&
-		   !(systemcfg->platform & PLATFORM_PSERIES)) {
-			printf("Not supported for this platform\n");
-			break;
-		}
-
-		bp = at_breakpoint(a);
-		if (bp == 0) {
-			for (bp = bpts; bp < &bpts[NBPTS]; ++bp)
+			for (bp = bpts; bp < &bpts[NBPTS]; ++bp) {
 				if (!bp->enabled)
-					break;
-			if (bp >= &bpts[NBPTS]) {
-				printf("Sorry, no free breakpoints.  Please clear one first.\n");
-				break;
+					continue;
+				printf("%2x %s   ", BP_NUM(bp),
+				    (bp->enabled & BP_IABR)? "inst": "trap");
+				xmon_print_symbol(bp->address, "  ", "\n");
 			}
+			break;
 		}
-		bp->enabled = 1;
-		bp->address = a;
-		bp->count = 0;
-		scanhex(&bp->count);
-		printf("Set breakpoint %2x trap   %.16lx %8x  ", (bp-bpts) + 1, 
-			bp->address, bp->count);
-		xmon_print_symbol("%s\n", bp->address);
+
+		if (!check_bp_loc(a))
+			break;
+		bp = new_breakpoint(a);
+		if (bp != NULL)
+			bp->enabled |= BP_TRAP;
 		break;
 	}
 }
@@ -872,76 +1292,131 @@
 const char *getvecname(unsigned long vec)
 {
 	char *ret;
+
 	switch (vec) {
-	case 0x100:	ret = "(System Reset)"; break; 
-	case 0x200:	ret = "(Machine Check)"; break; 
-	case 0x300:	ret = "(Data Access)"; break; 
+	case 0x100:	ret = "(System Reset)"; break;
+	case 0x200:	ret = "(Machine Check)"; break;
+	case 0x300:	ret = "(Data Access)"; break;
 	case 0x380:	ret = "(Data SLB Access)"; break;
-	case 0x400:	ret = "(Instruction Access)"; break; 
+	case 0x400:	ret = "(Instruction Access)"; break;
 	case 0x480:	ret = "(Instruction SLB Access)"; break;
-	case 0x500:	ret = "(Hardware Interrupt)"; break; 
-	case 0x600:	ret = "(Alignment)"; break; 
-	case 0x700:	ret = "(Program Check)"; break; 
-	case 0x800:	ret = "(FPU Unavailable)"; break; 
-	case 0x900:	ret = "(Decrementer)"; break; 
-	case 0xc00:	ret = "(System Call)"; break; 
-	case 0xd00:	ret = "(Single Step)"; break; 
-	case 0xf00:	ret = "(Performance Monitor)"; break; 
+	case 0x500:	ret = "(Hardware Interrupt)"; break;
+	case 0x600:	ret = "(Alignment)"; break;
+	case 0x700:	ret = "(Program Check)"; break;
+	case 0x800:	ret = "(FPU Unavailable)"; break;
+	case 0x900:	ret = "(Decrementer)"; break;
+	case 0xc00:	ret = "(System Call)"; break;
+	case 0xd00:	ret = "(Single Step)"; break;
+	case 0xf00:	ret = "(Performance Monitor)"; break;
+	case 0xf20:	ret = "(Altivec Unavailable)"; break;
+	case 0x1300:	ret = "(Instruction Breakpoint)"; break;
 	default: ret = "";
 	}
 	return ret;
 }
 
-/*
- * Most of our exceptions are in the form:
- *    bl handler
- *    b .ret_from_exception
- * and this currently fails to catch them.
- */
-static inline int exception_frame(unsigned long ip)
+static void get_function_bounds(unsigned long pc, unsigned long *startp,
+				unsigned long *endp)
 {
-	extern void *ret_from_syscall_1, *ret_from_syscall_2, *ret_from_except;
-
-	if ((ip == (unsigned long)ret_from_syscall_1) ||
-	    (ip == (unsigned long)ret_from_syscall_2) ||
-	    (ip == (unsigned long)ret_from_except))
-		return 1;
+	unsigned long size, offset;
+	const char *name;
+	char *modname;
 
-	return 0;
+	*startp = *endp = 0;
+	if (pc == 0)
+		return;
+	if (setjmp(bus_error_jmp) == 0) {
+		catch_memory_errors = 1;
+		sync();
+		name = kallsyms_lookup(pc, &size, &offset, &modname, tmpstr);
+		if (name != NULL) {
+			*startp = pc - offset;
+			*endp = pc - offset + size;
+		}
+		sync();
+	}
+	catch_memory_errors = 0;
 }
 
 static int xmon_depth_to_print = 64;
 
-static void xmon_show_stack(unsigned long sp)
+static void xmon_show_stack(unsigned long sp, unsigned long lr,
+			    unsigned long pc)
 {
 	unsigned long ip;
 	unsigned long newsp;
+	unsigned long marker;
 	int count = 0;
 	struct pt_regs regs;
 
 	do {
 		if (sp < PAGE_OFFSET) {
-			printf("SP in userspace\n");
+			if (sp != 0)
+				printf("SP (%lx) is in userspace\n", sp);
 			break;
 		}
 
-		if (!mread((sp + 16), &ip, sizeof(unsigned long)))
+		if (!mread(sp + 16, &ip, sizeof(unsigned long))
+		    || !mread(sp, &newsp, sizeof(unsigned long))) {
+			printf("Couldn't read stack frame at %lx\n", sp);
 			break;
+		}
 
-		printf("[%016lx] [%016lx] ", sp, ip);
-		xmon_print_symbol("%s\n", ip);
+		/*
+		 * For the first stack frame, try to work out if
+		 * LR and/or the saved LR value in the bottommost
+		 * stack frame are valid.
+		 */
+		if ((pc | lr) != 0) {
+			unsigned long fnstart, fnend;
+			unsigned long nextip;
+			int printip = 1;
+
+			get_function_bounds(pc, &fnstart, &fnend);
+			nextip = 0;
+			if (newsp > sp)
+				mread(newsp + 16, &nextip,
+				      sizeof(unsigned long));
+			if (lr == ip) {
+				if (lr < PAGE_OFFSET
+				    || (fnstart <= lr && lr < fnend))
+					printip = 0;
+			} else if (lr == nextip) {
+				printip = 0;
+			} else if (lr >= PAGE_OFFSET
+				   && !(fnstart <= lr && lr < fnend)) {
+				printf("[link register   ] ");
+				xmon_print_symbol(lr, " ", "\n");
+			}
+			if (printip) {
+				printf("[%.16lx] ", sp);
+				xmon_print_symbol(ip, " ", " (unreliable)\n");
+			}
+			pc = lr = 0;
 
-		if (exception_frame(ip)) {
-			if (mread(sp+112, &regs, sizeof(regs)) != sizeof(regs))
-				break;
+		} else {
+			printf("[%.16lx] ", sp);
+			xmon_print_symbol(ip, " ", "\n");
+		}
 
-                        printf("  exception: %lx %s regs %lx\n", regs.trap,
-			       getvecname(regs.trap), sp+112);
+		/* Look for "regshere" marker to see if this is
+		   an exception frame. */
+		if (mread(sp + 0x60, &marker, sizeof(unsigned long))
+		    && marker == 0x7265677368657265ul) {
+			if (mread(sp + 0x70, &regs, sizeof(regs))
+			    != sizeof(regs)) {
+				printf("Couldn't read registers at %lx\n",
+				       sp + 0x70);
+				break;
+			}
+                        printf("--- Exception: %lx %s at ", regs.trap,
+			       getvecname(TRAP(&regs)));
+			pc = regs.nip;
+			lr = regs.link;
+			xmon_print_symbol(pc, " ", "\n");
 		}
 
-		if (!mread(sp, &newsp, sizeof(unsigned long)))
-			break;
-		if (newsp < sp)
+		if (newsp == 0)
 			break;
 
 		sp = newsp;
@@ -952,42 +1427,36 @@
 {
 	unsigned long sp;
 
-	if (excp == NULL)
-		sp = __get_SP();
+	if (scanhex(&sp))
+		xmon_show_stack(sp, 0, 0);
 	else
-		sp = excp->gpr[1];
-
-	scanhex(&sp);
+		xmon_show_stack(excp->gpr[1], excp->link, excp->nip);
 	scannl();
-
-	xmon_show_stack(sp);
 }
 
-spinlock_t exception_print_lock = SPIN_LOCK_UNLOCKED;
-
 void excprint(struct pt_regs *fp)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&exception_print_lock, flags);
+	unsigned long trap;
 
 #ifdef CONFIG_SMP
-	printf("cpu %d: ", smp_processor_id());
+	printf("cpu 0x%x: ", smp_processor_id());
 #endif /* CONFIG_SMP */
 
-	printf("Vector: %lx %s at [%lx]\n", fp->trap, getvecname(fp->trap), fp);
-	printf("    pc: %lx", fp->nip);
-	xmon_print_symbol(" (%s)\n", fp->nip);
+	trap = TRAP(fp);
+	printf("Vector: %lx %s at [%lx]\n", fp->trap, getvecname(trap), fp);
+	printf("    pc: ");
+	xmon_print_symbol(fp->nip, ": ", "\n");
 
-	printf("    lr: %lx", fp->link);
-	xmon_print_symbol(" (%s)\n", fp->link);
+	printf("    lr: ", fp->link);
+	xmon_print_symbol(fp->link, ": ", "\n");
 
 	printf("    sp: %lx\n", fp->gpr[1]);
 	printf("   msr: %lx\n", fp->msr);
 
-	if (fp->trap == 0x300 || fp->trap == 0x380 || fp->trap == 0x600) {
+	if (trap == 0x300 || trap == 0x380 || trap == 0x600) {
 		printf("   dar: %lx\n", fp->dar);
-		printf(" dsisr: %lx\n", fp->dsisr);
+		if (trap != 0x380)
+			printf(" dsisr: %lx\n", fp->dsisr);
 	}
 
 	printf("  current = 0x%lx\n", current);
@@ -996,39 +1465,50 @@
 		printf("    pid   = %ld, comm = %s\n",
 		       current->pid, current->comm);
 	}
-
-	spin_unlock_irqrestore(&exception_print_lock, flags);
 }
 
 void prregs(struct pt_regs *fp)
 {
 	int n;
 	unsigned long base;
+	struct pt_regs regs;
 
-	if (scanhex((void *)&base))
-		fp = (struct pt_regs *) base;
+	if (scanhex(&base)) {
+		if (setjmp(bus_error_jmp) == 0) {
+			catch_memory_errors = 1;
+			sync();
+			regs = *(struct pt_regs *)base;
+			sync();
+			__delay(200);
+		} else {
+			catch_memory_errors = 0;
+			printf("*** Error reading registers from %.16lx\n",
+			       base);
+			return;
+		}
+		catch_memory_errors = 0;
+		fp = &regs;
+	}
 
-	if (setjmp(bus_error_jmp) == 0) {
-		__debugger_fault_handler = handle_fault;
-		sync();
+	if (FULL_REGS(fp)) {
 		for (n = 0; n < 16; ++n)
-			printf("R%.2ld = %.16lx   R%.2ld = %.16lx\n", n,
-			       fp->gpr[n], n+16, fp->gpr[n+16]);
-		printf("pc  = %.16lx   msr = %.16lx\nlr  = %.16lx   "
-		       "cr  = %.16lx\n", fp->nip, fp->msr, fp->link, fp->ccr);
-		printf("ctr = %.16lx   xer = %.16lx   trap = %8lx\n",
-		       fp->ctr, fp->xer, fp->trap);
-
-		sync();
-		/* wait a little while to see if we get a machine check */
-		__delay(200);
+			printf("R%.2ld = %.16lx   R%.2ld = %.16lx\n",
+			       n, fp->gpr[n], n+16, fp->gpr[n+16]);
 	} else {
-		printf("*** Error reading regs\n");
-	}
+		for (n = 0; n < 7; ++n)
+			printf("R%.2ld = %.16lx   R%.2ld = %.16lx\n",
+			       n, fp->gpr[n], n+7, fp->gpr[n+7]);
+	}
+	printf("pc  = ");
+	xmon_print_symbol(fp->nip, " ", "\n");
+	printf("lr  = ");
+	xmon_print_symbol(fp->link, " ", "\n");
+	printf("msr = %.16lx   cr  = %.8lx\n", fp->msr, fp->ccr);
+	printf("ctr = %.16lx   xer = %.16lx   trap = %8lx\n",
+	       fp->ctr, fp->xer, fp->trap);
 }
 
-void
-cacheflush(void)
+void cacheflush(void)
 {
 	int cmd;
 	unsigned long nflush;
@@ -1043,7 +1523,7 @@
 	scanhex(&nflush);
 	nflush = (nflush + L1_CACHE_BYTES - 1) / L1_CACHE_BYTES;
 	if (setjmp(bus_error_jmp) == 0) {
-		__debugger_fault_handler = handle_fault;
+		catch_memory_errors = 1;
 		sync();
 
 		if (cmd != 'i') {
@@ -1057,7 +1537,7 @@
 		/* wait a little while to see if we get a machine check */
 		__delay(200);
 	}
-	__debugger_fault_handler = 0;
+	catch_memory_errors = 0;
 }
 
 unsigned long
@@ -1077,20 +1557,7 @@
 	store_inst(instrs+1);
 	code = (unsigned long (*)(void)) opd;
 
-	if (setjmp(bus_error_jmp) == 0) {
-		__debugger_fault_handler = handle_fault;
-		sync();
-
-		ret = code();
-
-		sync();
-		/* wait a little while to see if we get a machine check */
-		__delay(200);
-	} else {
-		printf("*** Error reading spr %x\n", n);
-	}
-
-	__debugger_fault_handler = 0;
+	ret = code();
 
 	return ret;
 }
@@ -1111,20 +1578,7 @@
 	store_inst(instrs+1);
 	code = (unsigned long (*)(unsigned long)) opd;
 
-	if (setjmp(bus_error_jmp) == 0) {
-		__debugger_fault_handler = handle_fault;
-		sync();
-
-		code(val);
-
-		sync();
-		/* wait a little while to see if we get a machine check */
-		__delay(200);
-	} else {
-		printf("*** Error writing spr %x\n", n);
-	}
-
-	__debugger_fault_handler = 0;
+	code(val);
 }
 
 static unsigned long regno;
@@ -1161,15 +1615,20 @@
     
 		printf("  Local Processor Control Area (LpPaca): \n");
 		ptrLpPaca = ptrPaca->xLpPacaPtr;
-		printf("    Saved Srr0=%.16lx  Saved Srr1=%.16lx \n", ptrLpPaca->xSavedSrr0, ptrLpPaca->xSavedSrr1);
-		printf("    Saved Gpr3=%.16lx  Saved Gpr4=%.16lx \n", ptrLpPaca->xSavedGpr3, ptrLpPaca->xSavedGpr4);
+		printf("    Saved Srr0=%.16lx  Saved Srr1=%.16lx \n",
+		       ptrLpPaca->xSavedSrr0, ptrLpPaca->xSavedSrr1);
+		printf("    Saved Gpr3=%.16lx  Saved Gpr4=%.16lx \n",
+		       ptrLpPaca->xSavedGpr3, ptrLpPaca->xSavedGpr4);
 		printf("    Saved Gpr5=%.16lx \n", ptrLpPaca->xSavedGpr5);
     
 		printf("  Local Processor Register Save Area (LpRegSave): \n");
 		ptrLpRegSave = ptrPaca->xLpRegSavePtr;
-		printf("    Saved Sprg0=%.16lx  Saved Sprg1=%.16lx \n", ptrLpRegSave->xSPRG0, ptrLpRegSave->xSPRG0);
-		printf("    Saved Sprg2=%.16lx  Saved Sprg3=%.16lx \n", ptrLpRegSave->xSPRG2, ptrLpRegSave->xSPRG3);
-		printf("    Saved Msr  =%.16lx  Saved Nia  =%.16lx \n", ptrLpRegSave->xMSR, ptrLpRegSave->xNIA);
+		printf("    Saved Sprg0=%.16lx  Saved Sprg1=%.16lx \n",
+		       ptrLpRegSave->xSPRG0, ptrLpRegSave->xSPRG0);
+		printf("    Saved Sprg2=%.16lx  Saved Sprg3=%.16lx \n",
+		       ptrLpRegSave->xSPRG2, ptrLpRegSave->xSPRG3);
+		printf("    Saved Msr  =%.16lx  Saved Nia  =%.16lx \n",
+		       ptrLpRegSave->xMSR, ptrLpRegSave->xNIA);
 #endif
 
 		return;
@@ -1194,6 +1653,9 @@
 	scannl();
 }
 
+/*
+ * Stuff for reading and writing memory safely
+ */
 int
 mread(unsigned long adrs, void *buf, int size)
 {
@@ -1202,7 +1664,7 @@
 
 	n = 0;
 	if (setjmp(bus_error_jmp) == 0) {
-		__debugger_fault_handler = handle_fault;
+		catch_memory_errors = 1;
 		sync();
 		p = (char *)adrs;
 		q = (char *)buf;
@@ -1227,7 +1689,7 @@
 		__delay(200);
 		n = size;
 	}
-	__debugger_fault_handler = 0;
+	catch_memory_errors = 0;
 	return n;
 }
 
@@ -1239,7 +1701,7 @@
 
 	n = 0;
 	if (setjmp(bus_error_jmp) == 0) {
-		__debugger_fault_handler = handle_fault;
+		catch_memory_errors = 1;
 		sync();
 		p = (char *) adrs;
 		q = (char *) buf;
@@ -1266,7 +1728,7 @@
 	} else {
 		printf("*** Error writing address %x\n", adrs + n);
 	}
-	__debugger_fault_handler = 0;
+	catch_memory_errors = 0;
 	return n;
 }
 
@@ -1276,7 +1738,7 @@
 static int
 handle_fault(struct pt_regs *regs)
 {
-	switch (regs->trap) {
+	switch (TRAP(regs)) {
 	case 0x200:
 		fault_type = 0;
 		break;
@@ -1541,7 +2003,7 @@
 		scanhex(&nidump);
 		if( nidump == 0 )
 			nidump = 16;
-		adrs += ppc_inst_dump(adrs, nidump);
+		adrs += ppc_inst_dump(adrs, nidump, 1);
 		last_cmd = "di\n";
 	} else {
 		scanhex(&ndump);
@@ -1559,41 +2021,43 @@
 	long n, m, c, r, nr;
 	unsigned char temp[16];
 
-	for( n = ndump; n > 0; ){
+	for (n = ndump; n > 0;) {
 		printf("%.16lx", adrs);
 		putchar(' ');
 		r = n < 16? n: 16;
 		nr = mread(adrs, temp, r);
 		adrs += nr;
-		for( m = 0; m < r; ++m ){
+		for (m = 0; m < r; ++m) {
 		        if ((m & 7) == 0 && m > 0)
 			    putchar(' ');
-			if( m < nr )
+			if (m < nr)
 				printf("%.2x", temp[m]);
 			else
 				printf("%s", fault_chars[fault_type]);
 		}
-		for(; m < 16; ++m )
-			printf("   ");
+		if (m <= 8)
+			printf(" ");
+		for (; m < 16; ++m)
+			printf("  ");
 		printf("  |");
-		for( m = 0; m < r; ++m ){
-			if( m < nr ){
+		for (m = 0; m < r; ++m) {
+			if (m < nr) {
 				c = temp[m];
 				putchar(' ' <= c && c <= '~'? c: '.');
 			} else
 				putchar(' ');
 		}
 		n -= r;
-		for(; m < 16; ++m )
+		for (; m < 16; ++m)
 			putchar(' ');
 		printf("|\n");
-		if( nr < r )
+		if (nr < r)
 			break;
 	}
 }
 
 int
-ppc_inst_dump(unsigned long adr, long count)
+ppc_inst_dump(unsigned long adr, long count, int praddr)
 {
 	int nr, dotted;
 	unsigned long first_adr;
@@ -1601,11 +2065,13 @@
 	unsigned char val[4];
 
 	dotted = 0;
-	for (first_adr = adr; count > 0; --count, adr += 4){
+	for (first_adr = adr; count > 0; --count, adr += 4) {
 		nr = mread(adr, val, 4);
-		if( nr == 0 ){
-			const char *x = fault_chars[fault_type];
-			printf("%.16lx  %s%s%s%s\n", adr, x, x, x, x);
+		if (nr == 0) {
+			if (praddr) {
+				const char *x = fault_chars[fault_type];
+				printf("%.16lx  %s%s%s%s\n", adr, x, x, x, x);
+			}
 			break;
 		}
 		inst = GETWORD(val);
@@ -1618,9 +2084,10 @@
 		}
 		dotted = 0;
 		last_inst = inst;
-		printf("%.16lx  ", adr);
-		printf("%.8x\t", inst);
-		print_insn_big_powerpc(stdout, inst, adr);	/* always returns 4 */
+		if (praddr)
+			printf("%.16lx  %.8x", adr, inst);
+		printf("\t");
+		print_insn_powerpc(inst, adr, 0);	/* always returns 4 */
 		printf("\n");
 	}
 	return adr - first_adr;
@@ -1629,19 +2096,7 @@
 void
 print_address(unsigned long addr)
 {
-	const char *name;
-	char *modname;
-	long size, offset;
-
-	name = kallsyms_lookup(addr, &size, &offset, &modname, tmpstr);
-
-	if (name) {
-		if (modname)
-			printf("0x%lx\t# %s:%s+0x%lx", addr, modname, name, offset);
-		else
-			printf("0x%lx\t# %s+0x%lx", addr, name, offset);
-	} else
-		printf("0x%lx", addr);
+	xmon_print_symbol(addr, "\t# ", "");
 }
 
 
@@ -1781,7 +2236,7 @@
 	"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
 	"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
 	"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
-	"pc", "msr", "or3", "ctr", "lr", "xer", "ccr", "mq",
+	"pc", "msr", "or3", "ctr", "lr", "xer", "ccr", "softe",
 	"trap", "dar", "dsisr", "res"
 };
 
@@ -1809,13 +2264,11 @@
 		regname[i] = 0;
 		for (i = 0; i < N_PTREGS; ++i) {
 			if (strcmp(regnames[i], regname) == 0) {
-				unsigned long *rp = (unsigned long *)
-					xmon_regs[smp_processor_id()];
-				if (rp == NULL) {
+				if (xmon_regs == NULL) {
 					printf("regs not available\n");
 					return 0;
 				}
-				*vp = rp[i];
+				*vp = ((unsigned long *)xmon_regs)[i];
 				return 1;
 			}
 		}
@@ -1827,8 +2280,16 @@
 
 	if (c == '0') {
 		c = inchar();
-		if (c == 'x')
+		if (c == 'x') {
 			c = inchar();
+		} else {
+			d = hexdigit(c);
+			if (d == EOF) {
+				termch = c;
+				*vp = 0;
+				return 1;
+			}
+		}
 	} else if (c == '$') {
 		int i;
 		for (i=0; i<63; i++) {
@@ -1943,16 +2404,14 @@
 
 	switch (type) {
 	case 'a':
-		if (scanhex(&addr)) {
-			printf("%lx: ", addr);
-			xmon_print_symbol("%s\n", addr);
-		}
+		if (scanhex(&addr))
+			xmon_print_symbol(addr, ": ", "\n");
 		termch = 0;
 		break;
 	case 's':
 		getstring(tmp, 64);
 		if (setjmp(bus_error_jmp) == 0) {
-			__debugger_fault_handler = handle_fault;
+			catch_memory_errors = 1;
 			sync();
 			addr = kallsyms_lookup_name(tmp);
 			if (addr)
@@ -1961,58 +2420,40 @@
 				printf("Symbol '%s' not found.\n", tmp);
 			sync();
 		}
-		__debugger_fault_handler = 0;
+		catch_memory_errors = 0;
 		termch = 0;
 		break;
 	}
 }
 
 
-/* xmon version of __print_symbol */
-void __xmon_print_symbol(const char *fmt, unsigned long address)
+/* Print an address in numeric and symbolic form (if possible) */
+static void xmon_print_symbol(unsigned long address, const char *mid,
+			      const char *after)
 {
 	char *modname;
-	const char *name;
+	const char *name = NULL;
 	unsigned long offset, size;
 
+	printf("%.16lx", address);
 	if (setjmp(bus_error_jmp) == 0) {
-		__debugger_fault_handler = handle_fault;
+		catch_memory_errors = 1;
 		sync();
 		name = kallsyms_lookup(address, &size, &offset, &modname,
 				       tmpstr);
 		sync();
 		/* wait a little while to see if we get a machine check */
 		__delay(200);
-	} else {
-		name = "symbol lookup failed";
-	}
-
-	__debugger_fault_handler = 0;
-
-	if (!name) {
-		char addrstr[sizeof("0x%lx") + (BITS_PER_LONG*3/10)];
-
-		sprintf(addrstr, "0x%lx", address);
-		printf(fmt, addrstr);
-		return;
 	}
 
-	if (modname) {
-		/* This is pretty small. */
-		char buffer[sizeof("%s+%#lx/%#lx [%s]")
-			   + strlen(name) + 2*(BITS_PER_LONG*3/10)
-			   + strlen(modname)];
-
-		sprintf(buffer, "%s+%#lx/%#lx [%s]",
-			name, offset, size, modname);
-		printf(fmt, buffer);
-	} else {
-		char buffer[sizeof("%s+%#lx/%#lx")
-			   + strlen(name) + 2*(BITS_PER_LONG*3/10)];
+	catch_memory_errors = 0;
 
-		sprintf(buffer, "%s+%#lx/%#lx", name, offset, size);
-		printf(fmt, buffer);
+	if (name) {
+		printf("%s%s+%#lx/%#lx", mid, name, offset, size);
+		if (modname)
+			printf(" [%s]", modname);
 	}
+	printf("%s", after);
 }
 
 static void debug_trace(void)
@@ -2069,9 +2510,9 @@
 	int i;
 	unsigned long tmp;
 
-	printf("SLB contents of cpu %d\n", smp_processor_id());
+	printf("SLB contents of cpu %x\n", smp_processor_id());
 
-	for (i = 0; i < naca->slb_size; i++) {
+	for (i = 0; i < SLB_NUM_ENTRIES; i++) {
 		asm volatile("slbmfee  %0,%1" : "=r" (tmp) : "r" (i));
 		printf("%02d %016lx ", i, tmp);
 
@@ -2085,7 +2526,7 @@
 	int i;
 	unsigned long *tmp = (unsigned long *)get_paca()->xStab_data.virt;
 
-	printf("Segment table contents of cpu %d\n", smp_processor_id());
+	printf("Segment table contents of cpu %x\n", smp_processor_id());
 
 	for (i = 0; i < PAGE_SIZE/16; i++) {
 		unsigned long a, b;
@@ -2103,10 +2544,12 @@
 void xmon_init(void)
 {
 	__debugger = xmon;
+	__debugger_ipi = xmon_ipi;
 	__debugger_bpt = xmon_bpt;
 	__debugger_sstep = xmon_sstep;
 	__debugger_iabr_match = xmon_iabr_match;
 	__debugger_dabr_match = xmon_dabr_match;
+	__debugger_fault_handler = xmon_fault_handler;
 }
 
 void dump_segments(void)
diff -Nru a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
--- a/arch/s390/appldata/appldata_base.c	Tue Jun 15 22:20:38 2004
+++ b/arch/s390/appldata/appldata_base.c	Tue Jun 15 22:20:38 2004
@@ -85,9 +85,10 @@
  */
 static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";
 static int appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
-		   		  void *buffer, size_t *lenp);
+				  void __user *buffer, size_t *lenp);
 static int appldata_interval_handler(ctl_table *ctl, int write,
-					 struct file *filp, void *buffer,
+					 struct file *filp,
+					 void __user *buffer,
 					 size_t *lenp);
 
 static struct ctl_table_header *appldata_sysctl_header;
@@ -192,7 +193,8 @@
  * wrapper function for mod_virt_timer(), because smp_call_function_on()
  * accepts only one parameter.
  */
-static void appldata_mod_vtimer_wrap(struct appldata_mod_vtimer_args *args) {
+static void appldata_mod_vtimer_wrap(void *p) {
+	struct appldata_mod_vtimer_args *args = p;
 	mod_virt_timer(args->timer, args->expires);
 }
 
@@ -252,7 +254,7 @@
  */
 static int
 appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
-			   void *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp)
 {
 	int len, i;
 	char buf[2];
@@ -309,7 +311,7 @@
  */
 static int
 appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
-			   void *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp)
 {
 	int len, i, interval;
 	char buf[16];
@@ -347,7 +349,7 @@
 			appldata_mod_vtimer_args.expires =
 					per_cpu_interval;
 			smp_call_function_on(
-				(void *) appldata_mod_vtimer_wrap,
+				appldata_mod_vtimer_wrap,
 				&appldata_mod_vtimer_args,
 				0, 1, i);
 		}
@@ -370,7 +372,7 @@
  */
 static int
 appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
-			   void *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp)
 {
 	struct appldata_ops *ops = NULL, *tmp_ops;
 	int rc, len, found;
diff -Nru a/arch/s390/defconfig b/arch/s390/defconfig
--- a/arch/s390/defconfig	Tue Jun 15 22:20:44 2004
+++ b/arch/s390/defconfig	Tue Jun 15 22:20:44 2004
@@ -28,6 +28,7 @@
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
@@ -112,7 +113,6 @@
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 CONFIG_SCSI_MULTI_LUN=y
-# CONFIG_SCSI_REPORT_LUNS is not set
 CONFIG_SCSI_CONSTANTS=y
 CONFIG_SCSI_LOGGING=y
 
@@ -126,6 +126,7 @@
 # SCSI low-level drivers
 #
 # CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_DPT_I2O is not set
 # CONFIG_SCSI_SATA is not set
 # CONFIG_SCSI_EATA_PIO is not set
 # CONFIG_SCSI_DEBUG is not set
@@ -178,6 +179,8 @@
 # S/390 character device drivers
 #
 CONFIG_TN3270=y
+CONFIG_TN3270_TTY=y
+CONFIG_TN3270_FS=m
 CONFIG_TN3270_CONSOLE=y
 CONFIG_TN3215=y
 CONFIG_TN3215_CONSOLE=y
@@ -308,11 +311,7 @@
 # CONFIG_MII is not set
 
 #
-# Ethernet (1000 Mbit)
-#
-
-#
-# Ethernet (10000 Mbit)
+# Gigabit Ethernet (1000/10000 Mbit)
 #
 
 #
@@ -433,7 +432,6 @@
 # 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
 
 #
@@ -505,9 +503,11 @@
 # CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_DEFLATE is not set
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_TEST is not set
 
 #
 # Library routines
 #
 # CONFIG_CRC32 is not set
+# CONFIG_LIBCRC32C is not set
diff -Nru a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
--- a/arch/s390/kernel/asm-offsets.c	Tue Jun 15 22:20:38 2004
+++ b/arch/s390/kernel/asm-offsets.c	Tue Jun 15 22:20:38 2004
@@ -32,6 +32,7 @@
 	DEFINE(__TI_cpu, offsetof(struct thread_info, cpu),);
 	DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count),);
 	BLANK();
+	DEFINE(__PT_ARGS, offsetof(struct pt_regs, args),);
 	DEFINE(__PT_PSW, offsetof(struct pt_regs, psw),);
 	DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs),);
 	DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2),);
diff -Nru a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c
--- a/arch/s390/kernel/binfmt_elf32.c	Tue Jun 15 22:20:58 2004
+++ b/arch/s390/kernel/binfmt_elf32.c	Tue Jun 15 22:20:58 2004
@@ -32,10 +32,6 @@
 #define NUM_FPRS      16
 #define NUM_ACRS      16    
 
-#define TASK31_SIZE		(0x80000000UL)
-#undef TASK_SIZE
-#define TASK_SIZE TASK31_SIZE
-
 /* For SVR4/S390 the function pointer to be registered with `atexit` is
    passed in R14. */
 #define ELF_PLAT_INIT(_r, load_addr) \
@@ -51,7 +47,7 @@
    the loader.  We need to make sure that it is out of the way of the program
    that it will "exec", and that there is sufficient room for the brk.  */
 
-#define ELF_ET_DYN_BASE         (TASK31_SIZE / 3 * 2)
+#define ELF_ET_DYN_BASE         (TASK_SIZE / 3 * 2)
 
 /* Wow, the "main" arch needs arch dependent functions too.. :) */
 
@@ -169,7 +165,6 @@
 #undef start_thread
 #define start_thread                    start_thread31 
 #define setup_arg_pages(bprm, exec)     setup_arg_pages32(bprm, exec)
-#define elf_map				elf_map32
 
 MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries,"
                    " Copyright 2000 IBM Corporation"); 
@@ -188,19 +183,3 @@
 
 #include "../../../fs/binfmt_elf.c"
 
-static unsigned long
-elf_map32 (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
-{
-	unsigned long map_addr;
-
-	if (!addr) 
-		addr = TASK_UNMAPPED_BASE;
-
-	down_write(&current->mm->mmap_sem);
-	map_addr = do_mmap(filep, ELF_PAGESTART(addr),
-			   eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr),
-			   prot, type,
-			   eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr));
-	up_write(&current->mm->mmap_sem);
-	return(map_addr);
-}
diff -Nru a/arch/s390/kernel/compat_exec.c b/arch/s390/kernel/compat_exec.c
--- a/arch/s390/kernel/compat_exec.c	Tue Jun 15 22:20:44 2004
+++ b/arch/s390/kernel/compat_exec.c	Tue Jun 15 22:20:44 2004
@@ -34,9 +34,6 @@
 #endif
 
 
-#undef STACK_TOP
-#define STACK_TOP TASK31_SIZE
-
 int setup_arg_pages32(struct linux_binprm *bprm, int executable_stack)
 {
 	unsigned long stack_base;
@@ -61,6 +58,8 @@
 		return -ENOMEM;
 	}
 
+	memset(mpnt, 0, sizeof(*mpnt));
+
 	down_write(&mm->mmap_sem);
 	{
 		mpnt->vm_mm = mm;
@@ -69,11 +68,6 @@
 		/* executable stack setting would be applied here */
 		mpnt->vm_page_prot = PAGE_COPY;
 		mpnt->vm_flags = VM_STACK_FLAGS;
-		mpnt->vm_ops = NULL;
-		mpnt->vm_pgoff = 0;
-		mpnt->vm_file = NULL;
-		INIT_LIST_HEAD(&mpnt->shared);
-		mpnt->vm_private_data = (void *) 0;
 		insert_vm_struct(mm, mpnt);
 		mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
 	} 
@@ -82,7 +76,7 @@
 		struct page *page = bprm->page[i];
 		if (page) {
 			bprm->page[i] = NULL;
-			put_dirty_page(current,page,stack_base,PAGE_COPY);
+			install_arg_page(mpnt, page, stack_base);
 		}
 		stack_base += PAGE_SIZE;
 	}
diff -Nru a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
--- a/arch/s390/kernel/compat_linux.c	Tue Jun 15 22:20:43 2004
+++ b/arch/s390/kernel/compat_linux.c	Tue Jun 15 22:20:43 2004
@@ -355,144 +355,6 @@
 		return sys_ftruncate(fd, (high << 32) | low);
 }
 
-typedef ssize_t (*io_fn_t)(struct file *, char *, size_t, loff_t *);
-typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *);
-
-static long do_readv_writev32(int type, struct file *file,
-			      const struct compat_iovec *vector, u32 count)
-{
-	unsigned long tot_len;
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov=iovstack, *ivp;
-	struct inode *inode;
-	long retval, i;
-	io_fn_t fn;
-	iov_fn_t fnv;
-
-	/* First get the "struct iovec" from user memory and
-	 * verify all the pointers
-	 */
-	if (!count)
-		return 0;
-	if (verify_area(VERIFY_READ, vector, sizeof(struct compat_iovec)*count))
-		return -EFAULT;
-	if (count > UIO_MAXIOV)
-		return -EINVAL;
-	if (count > UIO_FASTIOV) {
-		iov = kmalloc(count*sizeof(struct iovec), GFP_KERNEL);
-		if (!iov)
-			return -ENOMEM;
-	}
-
-	tot_len = 0;
-	i = count;
-	ivp = iov;
-	retval = -EINVAL;
-	while(i > 0) {
-		compat_ssize_t tmp = tot_len;
-		compat_ssize_t len;
-		u32 buf;
-
-		if (__get_user(len, &vector->iov_len) ||
-		    __get_user(buf, &vector->iov_base)) {
-			retval = -EFAULT;
-			goto out;
-		}
-		if (len < 0)	/* size_t not fitting an ssize_t32 .. */
-			goto out;
-		tot_len += len;
-		if (tot_len < tmp) /* maths overflow on the compat_ssize_t */
-			goto out;
-		ivp->iov_base = (void *)A(buf);
-		ivp->iov_len = (__kernel_size_t) len;
-		vector++;
-		ivp++;
-		i--;
-	}
-	if (tot_len == 0) {
-		retval = 0;
-		goto out;
-	}
-
-	inode = file->f_dentry->d_inode;
-	/* VERIFY_WRITE actually means a read, as we write to user space */
-	retval = locks_verify_area((type == VERIFY_WRITE
-				    ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE),
-				   inode, file, file->f_pos, tot_len);
-	if (retval)
-		goto out;
-
-	/* VERIFY_WRITE actually means a read, as we write to user space */
-	fnv = (type == VERIFY_WRITE ? file->f_op->readv : file->f_op->writev);
-	if (fnv) {
-		retval = fnv(file, iov, count, &file->f_pos);
-		goto out;
-	}
-
-	fn = (type == VERIFY_WRITE ? file->f_op->read :
-	      (io_fn_t) file->f_op->write);
-
-	ivp = iov;
-	while (count > 0) {
-		void * base;
-		int len, nr;
-
-		base = ivp->iov_base;
-		len = ivp->iov_len;
-		ivp++;
-		count--;
-		nr = fn(file, base, len, &file->f_pos);
-		if (nr < 0) {
-			if (!retval)
-				retval = nr;
-			break;
-		}
-		retval += nr;
-		if (nr != len)
-			break;
-	}
-out:
-	if (iov != iovstack)
-		kfree(iov);
-
-	return retval;
-}
-
-asmlinkage long sys32_readv(int fd, struct compat_iovec *vector, unsigned long count)
-{
-	struct file *file;
-	long ret = -EBADF;
-
-	file = fget(fd);
-	if(!file)
-		goto bad_file;
-
-	if (file->f_op && (file->f_mode & FMODE_READ) &&
-	    (file->f_op->readv || file->f_op->read))
-		ret = do_readv_writev32(VERIFY_WRITE, file, vector, count);
-	fput(file);
-
-bad_file:
-	return ret;
-}
-
-asmlinkage long sys32_writev(int fd, struct compat_iovec *vector, unsigned long count)
-{
-	struct file *file;
-	int ret = -EBADF;
-
-	file = fget(fd);
-	if(!file)
-		goto bad_file;
-	if (file->f_op && (file->f_mode & FMODE_WRITE) &&
-	    (file->f_op->writev || file->f_op->write))
-		ret = do_readv_writev32(VERIFY_READ, file, vector, count);
-	fput(file);
-
-bad_file:
-	return ret;
-}
-
 /* readdir & getdents */
 
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
@@ -623,160 +485,6 @@
 
 /* end of readdir & getdents */
 
-/*
- * Ooo, nasty.  We need here to frob 32-bit unsigned longs to
- * 64-bit unsigned longs.
- */
-
-static inline int
-get_fd_set32(unsigned long n, unsigned long *fdset, u32 *ufdset)
-{
-	if (ufdset) {
-		unsigned long odd;
-
-		if (verify_area(VERIFY_WRITE, ufdset, n*sizeof(u32)))
-			return -EFAULT;
-
-		odd = n & 1UL;
-		n &= ~1UL;
-		while (n) {
-			unsigned long h, l;
-			__get_user(l, ufdset);
-			__get_user(h, ufdset+1);
-			ufdset += 2;
-			*fdset++ = h << 32 | l;
-			n -= 2;
-		}
-		if (odd)
-			__get_user(*fdset, ufdset);
-	} else {
-		/* Tricky, must clear full unsigned long in the
-		 * kernel fdset at the end, this makes sure that
-		 * actually happens.
-		 */
-		memset(fdset, 0, ((n + 1) & ~1)*sizeof(u32));
-	}
-	return 0;
-}
-
-static inline void
-set_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset)
-{
-	unsigned long odd;
-
-	if (!ufdset)
-		return;
-
-	odd = n & 1UL;
-	n &= ~1UL;
-	while (n) {
-		unsigned long h, l;
-		l = *fdset++;
-		h = l >> 32;
-		__put_user(l, ufdset);
-		__put_user(h, ufdset+1);
-		ufdset += 2;
-		n -= 2;
-	}
-	if (odd)
-		__put_user(*fdset, ufdset);
-}
-
-#define MAX_SELECT_SECONDS \
-	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-
-asmlinkage long sys32_select(int n, u32 *inp, u32 *outp, u32 *exp,
-				struct compat_timeval *tvp)
-{
-	fd_set_bits fds;
-	char *bits;
-	unsigned long nn;
-	long timeout;
-	int ret, size;
-
-	timeout = MAX_SCHEDULE_TIMEOUT;
-	if (tvp) {
-		int sec, usec;
-
-		if ((ret = verify_area(VERIFY_READ, tvp, sizeof(*tvp)))
-		    || (ret = __get_user(sec, &tvp->tv_sec))
-		    || (ret = __get_user(usec, &tvp->tv_usec)))
-			goto out_nofds;
-
-		ret = -EINVAL;
-		if(sec < 0 || usec < 0)
-			goto out_nofds;
-
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
-			timeout = (usec + 1000000/HZ - 1) / (1000000/HZ);
-			timeout += sec * (unsigned long) HZ;
-		}
-	}
-
-	ret = -EINVAL;
-	if (n < 0)
-		goto out_nofds;
-	if (n > current->files->max_fdset)
-		n = current->files->max_fdset;
-
-	/*
-	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
-	 * since we used fdset we need to allocate memory in units of
-	 * long-words. 
-	 */
-	ret = -ENOMEM;
-	size = FDS_BYTES(n);
-	bits = kmalloc(6 * size, GFP_KERNEL);
-	if (!bits)
-		goto out_nofds;
-	fds.in      = (unsigned long *)  bits;
-	fds.out     = (unsigned long *) (bits +   size);
-	fds.ex      = (unsigned long *) (bits + 2*size);
-	fds.res_in  = (unsigned long *) (bits + 3*size);
-	fds.res_out = (unsigned long *) (bits + 4*size);
-	fds.res_ex  = (unsigned long *) (bits + 5*size);
-
-	nn = (n + 8*sizeof(u32) - 1) / (8*sizeof(u32));
-	if ((ret = get_fd_set32(nn, fds.in, inp)) ||
-	    (ret = get_fd_set32(nn, fds.out, outp)) ||
-	    (ret = get_fd_set32(nn, fds.ex, exp)))
-		goto out;
-	zero_fd_set(n, fds.res_in);
-	zero_fd_set(n, fds.res_out);
-	zero_fd_set(n, fds.res_ex);
-
-	ret = do_select(n, &fds, &timeout);
-
-	if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
-		int sec = 0, usec = 0;
-		if (timeout) {
-			sec = timeout / HZ;
-			usec = timeout % HZ;
-			usec *= (1000000/HZ);
-		}
-		put_user(sec, &tvp->tv_sec);
-		put_user(usec, &tvp->tv_usec);
-	}
-
-	if (ret < 0)
-		goto out;
-	if (!ret) {
-		ret = -ERESTARTNOHAND;
-		if (signal_pending(current))
-			goto out;
-		ret = 0;
-	}
-
-	set_fd_set32(nn, inp, fds.res_in);
-	set_fd_set32(nn, outp, fds.res_out);
-	set_fd_set32(nn, exp, fds.res_ex);
-
-out:
-	kfree(bits);
-out_nofds:
-	return ret;
-}
-
 int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
 {
 	int err;
@@ -1026,188 +734,6 @@
 	return ret;
 }
 
-extern void check_pending(int signum);
-
-/*
- * count32() counts the number of arguments/envelopes
- */
-static int count32(u32 * argv)
-{
-	int i = 0;
-
-	if (argv != NULL) {
-		for (;;) {
-			u32 p; int error;
-
-			error = get_user(p,argv);
-			if (error) return error;
-			if (!p) break;
-			argv++; i++;
-		}
-	}
-	return i;
-}
-
-/*
- * 'copy_string32()' copies argument/envelope strings from user
- * memory to free pages in kernel mem. These are in a format ready
- * to be put directly into the top of new user memory.
- */
-static int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm)
-{
-	while (argc-- > 0) {
-		u32 str;
-		int len;
-		unsigned long pos;
-
-		if (get_user(str, argv + argc) ||
-		    !str ||
-		    !(len = strnlen_user((char *)A(str), bprm->p)))
-			return -EFAULT;
-
-		if (bprm->p < len)
-			return -E2BIG;
-
-		bprm->p -= len;
-
-		pos = bprm->p;
-		while (len) {
-			char *kaddr;
-			struct page *page;
-			int offset, bytes_to_copy, new, err;
-
-			offset = pos % PAGE_SIZE;
-			page = bprm->page[pos / PAGE_SIZE];
-			new = 0;
-			if (!page) {
-				page = alloc_page(GFP_USER);
-				bprm->page[pos / PAGE_SIZE] = page;
-				if (!page)
-					return -ENOMEM;
-				new = 1;
-			}
-			kaddr = (char *)kmap(page);
-
-			if (new && offset)
-				memset(kaddr, 0, offset);
-			bytes_to_copy = PAGE_SIZE - offset;
-			if (bytes_to_copy > len) {
-				bytes_to_copy = len;
-				if (new)
-					memset(kaddr+offset+len, 0,
-					       PAGE_SIZE-offset-len);
-			}
-
-			err = copy_from_user(kaddr + offset, (char *)A(str),
-					     bytes_to_copy);
-			kunmap(page);
-
-			if (err)
-				return -EFAULT;
-
-			pos += bytes_to_copy;
-			str += bytes_to_copy;
-			len -= bytes_to_copy;
-		}
-	}
-	return 0;
-}
-
-/*
- * sys32_execve() executes a new program.
- */
-static inline int 
-do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs)
-{
-	struct linux_binprm bprm;
-	struct file * file;
-	int retval;
-	int i;
-
-	sched_balance_exec();
-
-	file = open_exec(filename);
-
-	retval = PTR_ERR(file);
-	if (IS_ERR(file))
-		return retval;
-
-	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
-	memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0]));
-
-	bprm.file = file;
-	bprm.filename = filename;
-	bprm.interp = filename;
-	bprm.sh_bang = 0;
-	bprm.loader = 0;
-	bprm.exec = 0;
-	bprm.mm = mm_alloc();
-	retval = -ENOMEM;
-	if (!bprm.mm)
-		goto out_file;
-
-	/* init_new_context is empty for s390x. */
-
-	bprm.argc = count32(argv);
-	if ((retval = bprm.argc) < 0)
-		goto out_mm;
-
-	bprm.envc = count32(envp);
-	if ((retval = bprm.envc) < 0)
-		goto out_mm;
-
-	retval = security_bprm_alloc(&bprm);
-	if (retval)
-		goto out;
-
-	retval = prepare_binprm(&bprm);
-	if (retval < 0)
-		goto out;
-	
-	retval = copy_strings_kernel(1, &bprm.filename, &bprm);
-	if (retval < 0)
-		goto out;
-
-	bprm.exec = bprm.p;
-	retval = copy_strings32(bprm.envc, envp, &bprm);
-	if (retval < 0)
-		goto out;
-
-	retval = copy_strings32(bprm.argc, argv, &bprm);
-	if (retval < 0)
-		goto out;
-
-	retval = search_binary_handler(&bprm, regs);
-	if (retval >= 0) {
-		/* execve success */
-		security_bprm_free(&bprm);
-		return retval;
-	}
-
-out:
-	/* Something went wrong, return the inode and free the argument pages*/
-	for (i=0 ; i<MAX_ARG_PAGES ; i++) {
-		struct page * page = bprm.page[i];
-		if (page)
-			__free_page(page);
-	}
-
-	if (bprm.security)
-		security_bprm_free(&bprm);
-
-out_mm:
-	if (bprm.mm)
-		mmdrop(bprm.mm);
-
-out_file:
-	if (bprm.file) {
-		allow_write_access(bprm.file);
-		fput(bprm.file);
-	}
-
-	return retval;
-}
-
 /*
  * sys32_execve() executes a new program after the asm stub has set
  * things up for us.  This should basically do what I want it to.
@@ -1218,11 +744,12 @@
         int error;
         char * filename;
 
-        filename = getname((char *)A(regs.orig_gpr2));
+        filename = getname(compat_ptr(regs.orig_gpr2));
         error = PTR_ERR(filename);
         if (IS_ERR(filename))
                 goto out;
-        error = do_execve32(filename, (u32 *)A(regs.gprs[3]), (u32 *)A(regs.gprs[4]), &regs);
+        error = compat_do_execve(filename, compat_ptr(regs.gprs[3]),
+				 compat_ptr(regs.gprs[4]), &regs);
 	if (error == 0)
 	{
 		current->ptrace &= ~PT_DTRACE;
@@ -1269,226 +796,6 @@
 }
 
 #endif  /* CONFIG_MODULES */
-
-/* Stuff for NFS server syscalls... */
-struct nfsctl_svc32 {
-	u16			svc32_port;
-	s32			svc32_nthreads;
-};
-
-struct nfsctl_client32 {
-	s8			cl32_ident[NFSCLNT_IDMAX+1];
-	s32			cl32_naddr;
-	struct in_addr		cl32_addrlist[NFSCLNT_ADDRMAX];
-	s32			cl32_fhkeytype;
-	s32			cl32_fhkeylen;
-	u8			cl32_fhkey[NFSCLNT_KEYMAX];
-};
-
-struct nfsctl_export32 {
-	s8			ex32_client[NFSCLNT_IDMAX+1];
-	s8			ex32_path[NFS_MAXPATHLEN+1];
-	compat_dev_t	ex32_dev;
-	compat_ino_t	ex32_ino;
-	s32			ex32_flags;
-	compat_uid_t	ex32_anon_uid;
-	compat_gid_t	ex32_anon_gid;
-};
-
-struct nfsctl_fdparm32 {
-	struct sockaddr		gd32_addr;
-	s8			gd32_path[NFS_MAXPATHLEN+1];
-	s32			gd32_version;
-};
-
-struct nfsctl_fsparm32 {
-	struct sockaddr		gd32_addr;
-	s8			gd32_path[NFS_MAXPATHLEN+1];
-	s32			gd32_maxlen;
-};
-
-struct nfsctl_arg32 {
-	s32			ca32_version;	/* safeguard */
-	union {
-		struct nfsctl_svc32	u32_svc;
-		struct nfsctl_client32	u32_client;
-		struct nfsctl_export32	u32_export;
-		struct nfsctl_fdparm32	u32_getfd;
-		struct nfsctl_fsparm32	u32_getfs;
-	} u;
-#define ca32_svc	u.u32_svc
-#define ca32_client	u.u32_client
-#define ca32_export	u.u32_export
-#define ca32_getfd	u.u32_getfd
-#define ca32_getfs	u.u32_getfs
-#define ca32_authd	u.u32_authd
-};
-
-union nfsctl_res32 {
-	__u8			cr32_getfh[NFS_FHSIZE];
-	struct knfsd_fh		cr32_getfs;
-};
-
-static int nfs_svc32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= __get_user(karg->ca_svc.svc_port, &arg32->ca32_svc.svc32_port);
-	err |= __get_user(karg->ca_svc.svc_nthreads, &arg32->ca32_svc.svc32_nthreads);
-	return err;
-}
-
-static int nfs_clnt32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_client.cl_ident[0],
-			  &arg32->ca32_client.cl32_ident[0],
-			  NFSCLNT_IDMAX);
-	err |= __get_user(karg->ca_client.cl_naddr, &arg32->ca32_client.cl32_naddr);
-	err |= copy_from_user(&karg->ca_client.cl_addrlist[0],
-			  &arg32->ca32_client.cl32_addrlist[0],
-			  (sizeof(struct in_addr) * NFSCLNT_ADDRMAX));
-	err |= __get_user(karg->ca_client.cl_fhkeytype,
-		      &arg32->ca32_client.cl32_fhkeytype);
-	err |= __get_user(karg->ca_client.cl_fhkeylen,
-		      &arg32->ca32_client.cl32_fhkeylen);
-	err |= copy_from_user(&karg->ca_client.cl_fhkey[0],
-			  &arg32->ca32_client.cl32_fhkey[0],
-			  NFSCLNT_KEYMAX);
-	return err;
-}
-
-static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_export.ex_client[0],
-			  &arg32->ca32_export.ex32_client[0],
-			  NFSCLNT_IDMAX);
-	err |= copy_from_user(&karg->ca_export.ex_path[0],
-			  &arg32->ca32_export.ex32_path[0],
-			  NFS_MAXPATHLEN);
-	err |= __get_user(karg->ca_export.ex_dev,
-		      &arg32->ca32_export.ex32_dev);
-	err |= __get_user(karg->ca_export.ex_ino,
-		      &arg32->ca32_export.ex32_ino);
-	err |= __get_user(karg->ca_export.ex_flags,
-		      &arg32->ca32_export.ex32_flags);
-	err |= __get_user(karg->ca_export.ex_anon_uid,
-		      &arg32->ca32_export.ex32_anon_uid);
-	err |= __get_user(karg->ca_export.ex_anon_gid,
-		      &arg32->ca32_export.ex32_anon_gid);
-	karg->ca_export.ex_anon_uid = high2lowuid(karg->ca_export.ex_anon_uid);
-	karg->ca_export.ex_anon_gid = high2lowgid(karg->ca_export.ex_anon_gid);
-	return err;
-}
-
-static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_getfd.gd_addr,
-			  &arg32->ca32_getfd.gd32_addr,
-			  (sizeof(struct sockaddr)));
-	err |= copy_from_user(&karg->ca_getfd.gd_path,
-			  &arg32->ca32_getfd.gd32_path,
-			  (NFS_MAXPATHLEN+1));
-	err |= __get_user(karg->ca_getfd.gd_version,
-		      &arg32->ca32_getfd.gd32_version);
-	return err;
-}
-
-static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_getfs.gd_addr,
-			  &arg32->ca32_getfs.gd32_addr,
-			  (sizeof(struct sockaddr)));
-	err |= copy_from_user(&karg->ca_getfs.gd_path,
-			  &arg32->ca32_getfs.gd32_path,
-			  (NFS_MAXPATHLEN+1));
-	err |= __get_user(karg->ca_getfs.gd_maxlen,
-		      &arg32->ca32_getfs.gd32_maxlen);
-	return err;
-}
-
-/* This really doesn't need translations, we are only passing
- * back a union which contains opaque nfs file handle data.
- */
-static int nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32)
-{
-	return copy_to_user(res32, kres, sizeof(*res32)) ? -EFAULT : 0;
-}
-
-long asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
-{
-	struct nfsctl_arg *karg = NULL;
-	union nfsctl_res *kres = NULL;
-	mm_segment_t oldfs;
-	int err;
-
-	karg = kmalloc(sizeof(*karg), GFP_USER);
-	if(!karg)
-		return -ENOMEM;
-	if(res32) {
-		kres = kmalloc(sizeof(*kres), GFP_USER);
-		if(!kres) {
-			kfree(karg);
-			return -ENOMEM;
-		}
-	}
-	switch(cmd) {
-	case NFSCTL_SVC:
-		err = nfs_svc32_trans(karg, arg32);
-		break;
-	case NFSCTL_ADDCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_DELCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_EXPORT:
-	case NFSCTL_UNEXPORT:
-		err = nfs_exp32_trans(karg, arg32);
-		break;
-	case NFSCTL_GETFD:
-		err = nfs_getfd32_trans(karg, arg32);
-		break;
-	case NFSCTL_GETFS:
-		err = nfs_getfs32_trans(karg, arg32);
-		break;
-	default:
-		err = -EINVAL;
-		break;
-	}
-	if(err)
-		goto done;
-	oldfs = get_fs();
-	set_fs(KERNEL_DS);
-	err = sys_nfsservctl(cmd, karg, kres);
-	set_fs(oldfs);
-
-	if (err)
-		goto done;
-
-	if((cmd == NFSCTL_GETFD) ||
-	   (cmd == NFSCTL_GETFS))
-		err = nfs_getfh32_res_trans(kres, res32);
-
-done:
-	if(karg)
-		kfree(karg);
-	if(kres)
-		kfree(kres);
-	return err;
-}
 
 /* Translations due to time_t size differences.  Which affects all
    sorts of things, like timeval and itimerval.  */
diff -Nru a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
--- a/arch/s390/kernel/compat_signal.c	Tue Jun 15 22:21:02 2004
+++ b/arch/s390/kernel/compat_signal.c	Tue Jun 15 22:21:02 2004
@@ -53,7 +53,7 @@
 
 asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
 
-int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from)
+int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from)
 {
 	int err;
 
@@ -130,7 +130,8 @@
 }
 
 asmlinkage int
-sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigsetsize)
+sys32_rt_sigsuspend(struct pt_regs * regs, compat_sigset_t __user *unewset,
+								size_t sigsetsize)
 {
 	sigset_t saveset, newset;
 	compat_sigset_t set32;
@@ -162,11 +163,11 @@
                 if (do_signal(regs, &saveset))
                         return -EINTR;
         }
-}                                                         
+}
 
 asmlinkage long
-sys32_sigaction(int sig, const struct old_sigaction32 *act,
-		 struct old_sigaction32 *oact)
+sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
+		 struct old_sigaction32 __user *oact)
 {
         struct k_sigaction new_ka, old_ka;
         int ret;
@@ -199,9 +200,9 @@
 int
 do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact);
 
-asmlinkage long 
-sys32_rt_sigaction(int sig, const struct sigaction32 *act,
-	   struct sigaction32 *oact,  size_t sigsetsize)
+asmlinkage long
+sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
+	   struct sigaction32 __user *oact,  size_t sigsetsize)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -258,7 +259,8 @@
 }
 
 asmlinkage long
-sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
+sys32_sigaltstack(const stack_t32 __user *uss, stack_t32 __user *uoss,
+							struct pt_regs *regs)
 {
 	stack_t kss, koss;
 	int ret, err = 0;
@@ -275,7 +277,9 @@
 	}
 
 	set_fs (KERNEL_DS);
-	ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, regs->gprs[15]);
+	ret = do_sigaltstack((stack_t __user *) (uss ? &kss : NULL),
+			     (stack_t __user *) (uoss ? &koss : NULL),
+			     regs->gprs[15]);
 	set_fs (old_fs);
 
 	if (!ret && uoss) {
@@ -290,7 +294,7 @@
 	return ret;
 }
 
-static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
+static int save_sigregs32(struct pt_regs *regs, _sigregs32 __user *sregs)
 {
 	_s390_regs_common32 regs32;
 	int err, i;
@@ -311,7 +315,7 @@
 			      sizeof(_s390_fp_regs32));
 }
 
-static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
+static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs)
 {
 	_s390_regs_common32 regs32;
 	int err, i;
@@ -343,7 +347,7 @@
 
 asmlinkage long sys32_sigreturn(struct pt_regs *regs)
 {
-	sigframe32 *frame = (sigframe32 *)regs->gprs[15];
+	sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15];
 	sigset_t set;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -365,11 +369,11 @@
 badframe:
 	force_sig(SIGSEGV, current);
 	return 0;
-}	
+}
 
 asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
 {
-	rt_sigframe32 *frame = (rt_sigframe32 *)regs->gprs[15];
+	rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15];
 	sigset_t set;
 	stack_t st;
 	__u32 ss_sp;
@@ -399,8 +403,8 @@
 
 	/* It is more difficult to avoid calling this function than to
 	   call it and ignore errors.  */
-	set_fs (KERNEL_DS);   
-	do_sigaltstack(&st, NULL, regs->gprs[15]);
+	set_fs (KERNEL_DS);
+	do_sigaltstack((stack_t __user *)&st, NULL, regs->gprs[15]);
 	set_fs (old_fs);
 
 	return regs->gprs[2];
@@ -418,7 +422,7 @@
 /*
  * Determine which stack to use..
  */
-static inline void *
+static inline void __user *
 get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
 {
 	unsigned long sp;
@@ -439,7 +443,7 @@
 		sp = (unsigned long) ka->sa.sa_restorer;
 	}
 
-	return (void *)((sp - frame_size) & -8ul);
+	return (void __user *)((sp - frame_size) & -8ul);
 }
 
 static inline int map_signal(int sig)
@@ -455,7 +459,7 @@
 static void setup_frame32(int sig, struct k_sigaction *ka,
 			sigset_t *set, struct pt_regs * regs)
 {
-	sigframe32 *frame = get_sigframe(ka, regs, sizeof(sigframe32));
+	sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32));
 	if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32)))
 		goto give_sigsegv;
 
@@ -474,12 +478,12 @@
 	} else {
 		regs->gprs[14] = (__u64) frame->retcode;
 		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
-		               (u16 *)(frame->retcode)))
+		               (u16 __user *)(frame->retcode)))
 			goto give_sigsegv;
         }
 
 	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (unsigned int *) frame))
+	if (__put_user(regs->gprs[15], (unsigned int __user *) frame))
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
@@ -505,7 +509,7 @@
 			   sigset_t *set, struct pt_regs * regs)
 {
 	int err = 0;
-	rt_sigframe32 *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32));
+	rt_sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32));
 	if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32)))
 		goto give_sigsegv;
 
@@ -531,11 +535,11 @@
 	} else {
 		regs->gprs[14] = (__u64) frame->retcode;
 		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
-		                  (u16 *)(frame->retcode));
+		                  (u16 __user *)(frame->retcode));
 	}
 
 	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (unsigned int *) frame))
+	if (__put_user(regs->gprs[15], (unsigned int __user *) frame))
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
diff -Nru a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
--- a/arch/s390/kernel/compat_wrapper.S	Tue Jun 15 22:21:05 2004
+++ b/arch/s390/kernel/compat_wrapper.S	Tue Jun 15 22:21:05 2004
@@ -641,14 +641,14 @@
 	llgfr	%r4,%r4			# unsigned int
 	jg	sys32_getdents		# branch to system call
 
-	.globl  sys32_select_wrapper 
-sys32_select_wrapper:
+	.globl  compat_sys_select_wrapper
+compat_sys_select_wrapper:
 	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# fd_set *
-	llgtr	%r4,%r4			# fd_set *
-	llgtr	%r5,%r5			# fd_set *
-	llgtr	%r6,%r6			# struct timeval_emu31 *
-	jg	sys32_select		# branch to system call
+	llgtr	%r3,%r3			# compat_fd_set *
+	llgtr	%r4,%r4			# compat_fd_set *
+	llgtr	%r5,%r5			# compat_fd_set *
+	llgtr	%r6,%r6			# struct compat_timeval *
+	jg	compat_sys_select	# branch to system call
 
 	.globl  sys32_flock_wrapper 
 sys32_flock_wrapper:
@@ -663,19 +663,19 @@
 	lgfr	%r4,%r4			# int
 	jg	sys_msync		# branch to system call
 
-	.globl  sys32_readv_wrapper 
-sys32_readv_wrapper:
+	.globl  compat_sys_readv_wrapper
+compat_sys_readv_wrapper:
 	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# const struct iovec_emu31 *
+	llgtr	%r3,%r3			# const struct compat_iovec *
 	llgfr	%r4,%r4			# unsigned long
-	jg	sys32_readv		# branch to system call
+	jg	compat_sys_readv	# branch to system call
 
-	.globl  sys32_writev_wrapper 
-sys32_writev_wrapper:
+	.globl  compat_sys_writev_wrapper
+compat_sys_writev_wrapper:
 	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# const struct iovec_emu31 *
+	llgtr	%r3,%r3			# const struct compat_iovec *
 	llgfr	%r4,%r4			# unsigned long
-	jg	sys32_writev		# branch to system call
+	jg	compat_sys_writev	# branch to system call
 
 	.globl  sys32_getsid_wrapper 
 sys32_getsid_wrapper:
@@ -786,12 +786,12 @@
 	lgfr	%r4,%r4			# long 
 	jg	sys_poll		# branch to system call
 
-	.globl  sys32_nfsservctl_wrapper 
-sys32_nfsservctl_wrapper:
+	.globl  compat_sys_nfsservctl_wrapper
+compat_sys_nfsservctl_wrapper:
 	lgfr	%r2,%r2			# int 
-	llgtr	%r3,%r3			# struct nfsctl_arg_emu31 * 
-	llgtr	%r4,%r4			# union nfsctl_res_emu31 * 
-	jg	sys32_nfsservctl	# branch to system call
+	llgtr	%r3,%r3			# struct compat_nfsctl_arg*
+	llgtr	%r4,%r4			# union compat_nfsctl_res*
+	jg	compat_sys_nfsservctl	# branch to system call
 
 	.globl  sys32_setresgid16_wrapper 
 sys32_setresgid16_wrapper:
@@ -1097,6 +1097,8 @@
 	lgfr	%r4,%r4			# int
 	llgtr	%r5,%r5			# struct compat_timespec *
 	llgtr	%r6,%r6			# u32 *
+	lgf	%r0,164(%r15)		# int
+	stg	%r0,160(%r15)
 	jg	compat_sys_futex	# branch to system call
 
 	.globl	sys32_setxattr_wrapper
diff -Nru a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
--- a/arch/s390/kernel/debug.c	Tue Jun 15 22:20:37 2004
+++ b/arch/s390/kernel/debug.c	Tue Jun 15 22:20:37 2004
@@ -62,9 +62,9 @@
 /* internal function prototyes */
 
 static int debug_init(void);
-static ssize_t debug_output(struct file *file, char *user_buf,
+static ssize_t debug_output(struct file *file, char __user *user_buf,
 			    size_t user_len, loff_t * offset);
-static ssize_t debug_input(struct file *file, const char *user_buf,
+static ssize_t debug_input(struct file *file, const char __user *user_buf,
 			   size_t user_len, loff_t * offset);
 static int debug_open(struct inode *inode, struct file *file);
 static int debug_close(struct inode *inode, struct file *file);
@@ -74,10 +74,10 @@
 static int debug_prolog_level_fn(debug_info_t * id,
 				 struct debug_view *view, char *out_buf);
 static int debug_input_level_fn(debug_info_t * id, struct debug_view *view,
-				struct file *file, const char *user_buf,
+				struct file *file, const char __user *user_buf,
 				size_t user_buf_size, loff_t * offset);
 static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view,
-                                struct file *file, const char *user_buf,
+                                struct file *file, const char __user *user_buf,
                                 size_t user_buf_size, loff_t * offset);
 static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view,
                                 char *out_buf, const char *in_buf);
@@ -416,10 +416,10 @@
  * - copies formated debug entries to the user buffer
  */
 
-static ssize_t debug_output(struct file *file,	/* file descriptor */
-			    char *user_buf,	/* user buffer */
-			    size_t  len,	/* length of buffer */
-			    loff_t *offset	/* offset in the file */ )
+static ssize_t debug_output(struct file *file,		/* file descriptor */
+			    char __user *user_buf,	/* user buffer */
+			    size_t  len,		/* length of buffer */
+			    loff_t *offset)	      /* offset in the file */
 {
 	size_t count = 0;
 	size_t entry_offset, size = 0;
@@ -462,7 +462,7 @@
  */
 
 static ssize_t debug_input(struct file *file,
-			   const char *user_buf, size_t length,
+			   const char __user *user_buf, size_t length,
 			   loff_t *offset)
 {
 	int rc = 0;
@@ -942,7 +942,7 @@
  */
 
 static int debug_input_level_fn(debug_info_t * id, struct debug_view *view,
-				struct file *file, const char *user_buf,
+				struct file *file, const char __user *user_buf,
 				size_t in_buf_size, loff_t * offset)
 {
 	char input_buf[1];
@@ -1004,9 +1004,9 @@
 /*
  * view function: flushes debug areas 
  */
- 
+
 static int debug_input_flush_fn(debug_info_t * id, struct debug_view *view,
-                                struct file *file, const char *user_buf,
+                                struct file *file, const char __user *user_buf,
                                 size_t in_buf_size, loff_t * offset)
 {
         char input_buf[1];
diff -Nru a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
--- a/arch/s390/kernel/entry.S	Tue Jun 15 22:20:37 2004
+++ b/arch/s390/kernel/entry.S	Tue Jun 15 22:20:37 2004
@@ -24,7 +24,8 @@
  * Stack layout for the system_call stack entry.
  * The first few entries are identical to the user_regs_struct.
  */
-SP_PTREGS    =  STACK_FRAME_OVERHEAD 
+SP_PTREGS    =  STACK_FRAME_OVERHEAD
+SP_ARGS      =  STACK_FRAME_OVERHEAD + __PT_ARGS
 SP_PSW       =  STACK_FRAME_OVERHEAD + __PT_PSW
 SP_R0        =  STACK_FRAME_OVERHEAD + __PT_GPRS
 SP_R1        =  STACK_FRAME_OVERHEAD + __PT_GPRS + 4
@@ -47,7 +48,8 @@
 SP_TRAP      =  STACK_FRAME_OVERHEAD + __PT_TRAP
 SP_SIZE      =  STACK_FRAME_OVERHEAD + __PT_SIZE
 
-_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_RESTART_SVC)
+_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
+		 _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
 _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
 
 #define BASED(name) name-system_call(%r13)
@@ -229,17 +231,20 @@
 	lh	%r7,0x8a	  # get svc number from lowcore
 sysc_enter:
         GET_THREAD_INFO           # load pointer to task_struct to R9
+sysc_do_svc:
 	sla	%r7,2             # *4 and test for svc 0
-	bnz	BASED(sysc_do_restart)  # svc number > 0
+	bnz	BASED(sysc_nr_ok) # svc number > 0
 	# svc 0: system call number in %r1
 	cl	%r1,BASED(.Lnr_syscalls)
-	bnl	BASED(sysc_do_restart)
+	bnl	BASED(sysc_nr_ok)
 	lr	%r7,%r1           # copy svc number to %r7
 	sla	%r7,2             # *4
+sysc_nr_ok:
+	mvc	SP_ARGS(4,%r15),SP_R7(%r15)
 sysc_do_restart:
 	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
         l       %r8,sys_call_table-system_call(%r7,%r13) # get system call addr.
-        bo      BASED(sysc_tracesys)
+        bnz     BASED(sysc_tracesys)
         basr    %r14,%r8          # call sys_xxxx
         st      %r2,SP_R2(%r15)   # store return value (change R2 on stack)
                                   # ATTENTION: check sys_execve_glue before
@@ -262,7 +267,6 @@
 	bz	BASED(sysc_leave)      # there is no work to do
 #
 # One of the work bits is on. Find out which one.
-# Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED
 #
 sysc_work:
 	tm	__TI_flags+3(%r9),_TIF_NEED_RESCHED
@@ -271,6 +275,8 @@
 	bo	BASED(sysc_sigpending)
 	tm	__TI_flags+3(%r9),_TIF_RESTART_SVC
 	bo	BASED(sysc_restart)
+	tm	__TI_flags+3(%r9),_TIF_SINGLE_STEP
+	bo	BASED(sysc_singlestep)
 	b	BASED(sysc_leave)
 
 #
@@ -304,6 +310,17 @@
 	lm	%r2,%r6,SP_R2(%r15)    # load svc arguments
 	b	BASED(sysc_do_restart) # restart svc
 
+#
+# _TIF_SINGLE_STEP is set, call do_debugger_trap
+#
+sysc_singlestep:
+	ni	__TI_flags+3(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP
+	mvi	SP_TRAP+1(%r15),0x28	# set trap indication to pgm check
+	la	%r2,SP_PTREGS(%r15)	# address of register-save area
+	l	%r1,BASED(.Lhandle_per)	# load adr. of per handler
+	la	%r14,BASED(sysc_return)	# load adr. of system return
+	br	%r1			# branch to do_debugger_trap
+
 __critical_end:
 
 #
@@ -328,7 +345,7 @@
 	st	%r2,SP_R2(%r15)   # store return value
 sysc_tracenogo:
 	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
-        bno     BASED(sysc_return)
+        bz      BASED(sysc_return)
 	l	%r1,BASED(.Ltrace)
 	la	%r2,SP_PTREGS(%r15)    # load pt_regs
 	la	%r3,1
@@ -471,9 +488,10 @@
 pgm_per_std:
 	SAVE_ALL __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
 	GET_THREAD_INFO
-	mvc	__THREAD_per+__PER_atmid(2,%r9),__LC_PER_ATMID
-	mvc	__THREAD_per+__PER_address(4,%r9),__LC_PER_ADDRESS
-	mvc	__THREAD_per+__PER_access_id(1,%r9),__LC_PER_ACCESS_ID
+	l	%r1,__TI_task(%r9)
+	mvc	__THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
+	mvc	__THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
+	mvc	__THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID
 	la	%r4,0x7f
 	l	%r3,__LC_PGM_ILC	 # load program interruption code
         nr      %r4,%r3                  # clear per-event-bit and ilc
@@ -494,70 +512,15 @@
 #
 pgm_svcper:
 	SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
-	lh	%r7,0x8a	  # get svc number from lowcore
-        stosm   24(%r15),0x03     # reenable interrupts
-        GET_THREAD_INFO           # load pointer to task_struct to R9
-	mvc	__THREAD_per+__PER_atmid(2,%r9),__LC_PER_ATMID
-	mvc	__THREAD_per+__PER_address(4,%r9),__LC_PER_ADDRESS
-	mvc	__THREAD_per+__PER_access_id(1,%r9),__LC_PER_ACCESS_ID
-        sla     %r7,2             # *4 and test for svc 0
-	bnz	BASED(pgm_svcstd) # svc number > 0 ?
-	# svc 0: system call number in %r1
-	cl	%r1,BASED(.Lnr_syscalls)
-	bnl	BASED(pgm_svcstd)
-	lr	%r7,%r1           # copy svc number to %r7
-	sla	%r7,2             # *4
-pgm_svcstd:
-	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
-        l       %r8,sys_call_table-system_call(%r7,%r13) # get system call addr.
-        bo      BASED(pgm_tracesys)
-        basr    %r14,%r8          # call sys_xxxx
-        st      %r2,SP_R2(%r15)   # store return value (change R2 on stack)
-                                  # ATTENTION: check sys_execve_glue before
-                                  # changing anything here !!
-
-pgm_svcret:
-	tm	__TI_flags+3(%r9),_TIF_SIGPENDING
-	bno	BASED(pgm_svcper_nosig)
-	la	%r2,SP_PTREGS(%r15) # load pt_regs
-	sr	%r3,%r3		  # clear *oldset
-	l	%r1,BASED(.Ldo_signal)
-	basr	%r14,%r1	  # call do_signal
-	
-pgm_svcper_nosig:
-        mvi     SP_TRAP+3(%r15),0x28     # set trap indication to pgm check
-	la      %r2,SP_PTREGS(15)        # address of register-save area
-        l       %r1,BASED(.Lhandle_per)  # load adr. of per handler
-        la      %r14,BASED(sysc_return)  # load adr. of system return
-        br      %r1                      # branch to do_debugger_trap
-#
-# call trace before and after sys_call
-#
-pgm_tracesys:
-        l       %r1,BASED(.Ltrace)
-	la	%r2,SP_PTREGS(%r15)    # load pt_regs
-	la	%r3,0
-	srl	%r7,2
-	st	%r7,SP_R2(%r15)
-        basr    %r14,%r1
-	clc	SP_R2(4,%r15),BASED(.Lnr_syscalls)
-	bnl	BASED(pgm_svc_nogo)
-	l	%r7,SP_R2(%r15)   # strace changed the syscall
-	sll     %r7,2
-	l	%r8,sys_call_table-system_call(%r7,%r13)
-pgm_svc_go:
-	lm      %r3,%r6,SP_R3(%r15)
-	l       %r2,SP_ORIG_R2(%r15)
-        basr    %r14,%r8          # call sys_xxx
-        st      %r2,SP_R2(%r15)   # store return value
-pgm_svc_nogo:
-	tm	__TI_flags+3(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
-        bno     BASED(pgm_svcret)
-        l       %r1,BASED(.Ltrace)
-	la	%r2,SP_PTREGS(%r15)    # load pt_regs
-	la	%r3,1
-	la	%r14,BASED(pgm_svcret)
-        br      %r1
+	lh	%r7,0x8a		# get svc number from lowcore
+	GET_THREAD_INFO			# load pointer to task_struct to R9
+	l	%r1,__TI_task(%r9)
+	mvc	__THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
+	mvc	__THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
+	mvc	__THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID
+	oi	__TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
+	stosm	24(%r15),0x03		# reenable interrupts
+	b	BASED(sysc_do_svc)
 
 /*
  * IO interrupt handler routine
diff -Nru a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
--- a/arch/s390/kernel/entry64.S	Tue Jun 15 22:20:37 2004
+++ b/arch/s390/kernel/entry64.S	Tue Jun 15 22:20:37 2004
@@ -24,7 +24,8 @@
  * Stack layout for the system_call stack entry.
  * The first few entries are identical to the user_regs_struct.
  */
-SP_PTREGS    =  STACK_FRAME_OVERHEAD 
+SP_PTREGS    =  STACK_FRAME_OVERHEAD
+SP_ARGS      =  STACK_FRAME_OVERHEAD + __PT_ARGS
 SP_PSW       =  STACK_FRAME_OVERHEAD + __PT_PSW
 SP_R0        =  STACK_FRAME_OVERHEAD + __PT_GPRS
 SP_R1        =  STACK_FRAME_OVERHEAD + __PT_GPRS + 8
@@ -47,7 +48,8 @@
 SP_TRAP      =  STACK_FRAME_OVERHEAD + __PT_TRAP
 SP_SIZE      =  STACK_FRAME_OVERHEAD + __PT_SIZE
 
-_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_RESTART_SVC)
+_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
+		 _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
 _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
 
 /*
@@ -213,14 +215,17 @@
 	llgh    %r7,__LC_SVC_INT_CODE # get svc number from lowcore
 sysc_enter:
         GET_THREAD_INFO           # load pointer to task_struct to R9
+sysc_do_svc:
         slag    %r7,%r7,2         # *4 and test for svc 0
-	jnz	sysc_do_restart
+	jnz	sysc_nr_ok
 	# svc 0: system call number in %r1
 	lghi	%r0,NR_syscalls
 	clr	%r1,%r0
-	jnl	sysc_do_restart
+	jnl	sysc_nr_ok
 	lgfr	%r7,%r1           # clear high word in r1
 	slag    %r7,%r7,2         # svc 0: system call number in %r1
+sysc_nr_ok:
+	mvc	SP_ARGS(8,%r15),SP_R7(%r15)
 sysc_do_restart:
 	larl    %r10,sys_call_table
 #ifdef CONFIG_S390_SUPPORT
@@ -231,7 +236,7 @@
 #endif
 	tm	__TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
         lgf     %r8,0(%r7,%r10)   # load address of system call routine
-        jo      sysc_tracesys
+        jnz     sysc_tracesys
         basr    %r14,%r8          # call sys_xxxx
         stg     %r2,SP_R2(%r15)   # store return value (change R2 on stack)
                                   # ATTENTION: check sys_execve_glue before
@@ -254,7 +259,6 @@
 	jz	sysc_leave        # there is no work to do
 #
 # One of the work bits is on. Find out which one.
-# Checked are: _TIF_SIGPENDING and _TIF_NEED_RESCHED
 #
 sysc_work:
 	tm	__TI_flags+7(%r9),_TIF_NEED_RESCHED
@@ -263,6 +267,8 @@
 	jo	sysc_sigpending
 	tm	__TI_flags+7(%r9),_TIF_RESTART_SVC
 	jo	sysc_restart
+	tm	__TI_flags+7(%r9),_TIF_SINGLE_STEP
+	jo	sysc_singlestep
 	j	sysc_leave
 
 #
@@ -294,6 +300,17 @@
 	lmg	%r2,%r6,SP_R2(%r15)    # load svc arguments
 	j	sysc_do_restart        # restart svc
 
+#
+# _TIF_SINGLE_STEP is set, call do_debugger_trap
+#
+sysc_singlestep:
+	ni	__TI_flags+7(%r9),255-_TIF_SINGLE_STEP # clear TIF_SINGLE_STEP
+	mvi	SP_TRAP+1(%r15),0x28	# set trap indication to pgm check
+	la	%r2,SP_PTREGS(%r15)	# address of register-save area
+	larl	%r14,sysc_return	# load adr. of system return
+	jg	do_debugger_trap	# branch to do_debugger_trap
+
+
 __critical_end:
 
 #
@@ -319,7 +336,7 @@
         stg     %r2,SP_R2(%r15)     # store return value
 sysc_tracenogo:
 	tm	__TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
-        jno     sysc_return
+        jz      sysc_return
 	la	%r2,SP_PTREGS(%r15)    # load pt_regs
 	la	%r3,1
 	larl	%r14,sysc_return    # return point is sysc_return
@@ -505,9 +522,10 @@
 pgm_per_std:
 	SAVE_ALL __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
 	GET_THREAD_INFO
-	mvc	__THREAD_per+__PER_atmid(2,%r9),__LC_PER_ATMID
-	mvc	__THREAD_per+__PER_address(8,%r9),__LC_PER_ADDRESS
-	mvc	__THREAD_per+__PER_access_id(1,%r9),__LC_PER_ACCESS_ID
+	lg	%r1,__TI_task(%r9)
+	mvc	__THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
+	mvc	__THREAD_per+__PER_address(8,%r1),__LC_PER_ADDRESS
+	mvc	__THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID
 	lghi    %r4,0x7f
 	lgf     %r3,__LC_PGM_ILC	 # load program interruption code
         nr      %r4,%r3			 # clear per-event-bit and ilc
@@ -527,74 +545,15 @@
 #
 pgm_svcper:
 	SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
-	llgh    %r7,__LC_SVC_INT_CODE # get svc number from lowcore
-	stosm   48(%r15),0x03     # reenable interrupts
-        GET_THREAD_INFO           # load pointer to task_struct to R9
-	mvc	__THREAD_per+__PER_atmid(2,%r9),__LC_PER_ATMID
-	mvc	__THREAD_per+__PER_address(8,%r9),__LC_PER_ADDRESS
-	mvc	__THREAD_per+__PER_access_id(1,%r9),__LC_PER_ACCESS_ID
-	slag	%r7,%r7,2         # *4 and test for svc 0
-	jnz	pgm_svcstd
-	# svc 0: system call number in %r1
-	lghi	%r0,NR_syscalls
-	clr	%r1,%r0
-	slag	%r7,%r1,2
-pgm_svcstd:
-	larl    %r10,sys_call_table
-#ifdef CONFIG_S390_SUPPORT
-        tm      SP_PSW+3(%r15),0x01  # are we running in 31 bit mode ?
-        jo      pgm_svcper_noemu
-	larl    %r10,sys_call_table_emu # use 31 bit emulation system calls
-pgm_svcper_noemu:
-#endif
-	tm	__TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
-        lgf     %r8,0(%r7,%r10)   # load address of system call routine
-        jo      pgm_tracesys
-        basr    %r14,%r8          # call sys_xxxx
-        stg     %r2,SP_R2(%r15)   # store return value (change R2 on stack)
-                                  # ATTENTION: check sys_execve_glue before
-                                  # changing anything here !!
-
-pgm_svcret:
-	tm	__TI_flags+7(%r9),_TIF_SIGPENDING
-	jno	pgm_svcper_nosig
-        la      %r2,SP_PTREGS(%r15) # load pt_regs
-        sgr     %r3,%r3             # clear *oldset
-	brasl	%r14,do_signal
-	
-pgm_svcper_nosig:
-	lhi     %r0,__LC_PGM_OLD_PSW     # set trap indication back to pgm_chk
-	st      %r0,SP_TRAP(%r15)
-        la      %r2,SP_PTREGS(15) # address of register-save area
-        larl    %r14,sysc_return  # load adr. of system return
-        jg      do_debugger_trap
-#
-# call trace before and after sys_call
-#
-pgm_tracesys:
-	la	%r2,SP_PTREGS(%r15)    # load pt_regs
-	la	%r3,0
-	srlg	%r7,%r7,2
-	stg	%r7,SP_R2(%r15)
-        brasl   %r14,syscall_trace
-	lghi	%r0,NR_syscalls
-	clg	%r0,SP_R2(%r15)
-	jnh	pgm_svc_nogo
-	lg      %r7,SP_R2(%r15)
-	sllg    %r7,%r7,2           # strace wants to change the syscall
-	lgf	%r8,0(%r7,%r10)
-pgm_svc_go:
-	lmg     %r3,%r6,SP_R3(%r15)
-	lg      %r2,SP_ORIG_R2(%r15)
-        basr    %r14,%r8            # call sys_xxx
-        stg     %r2,SP_R2(%r15)     # store return value
-pgm_svc_nogo:
-	tm	__TI_flags+7(%r9),(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
-        jno     pgm_svcret
-	la	%r2,SP_PTREGS(%r15)    # load pt_regs
-	la	%r3,1
-	larl	%r14,pgm_svcret     # return point is sysc_return
-	jg	syscall_trace
+	llgh    %r7,__LC_SVC_INT_CODE	# get svc number from lowcore
+	GET_THREAD_INFO			# load pointer to task_struct to R9
+	lg	%r1,__TI_task(%r9)
+	mvc	__THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
+	mvc	__THREAD_per+__PER_address(8,%r1),__LC_PER_ADDRESS
+	mvc	__THREAD_per+__PER_access_id(1,%r1),__LC_PER_ACCESS_ID
+	oi	__TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
+	stosm	48(%r15),0x03		# reenable interrupts
+	j	sysc_do_svc
 
 /*
  * IO interrupt handler routine
diff -Nru a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
--- a/arch/s390/kernel/head.S	Tue Jun 15 22:20:38 2004
+++ b/arch/s390/kernel/head.S	Tue Jun 15 22:20:38 2004
@@ -478,9 +478,80 @@
         mvcle %r2,%r4,0                 # clear mem
         jo    .-4                       # branch back, if not finish
 
+	l     %r2,.Lrcp-.LPG1(%r13)	# Read SCP forced command word
+.Lservicecall:
+	stosm .Lpmask-.LPG1(%r13),0x01	# authorize ext interrupts
+
+	stctl %r0, %r0,.Lcr-.LPG1(%r13)	# get cr0
+	la    %r1,0x200			# set bit 22
+	o     %r1,.Lcr-.LPG1(%r13)	# or old cr0 with r1
+	st    %r1,.Lcr-.LPG1(%r13)
+	lctl  %r0, %r0,.Lcr-.LPG1(%r13)	# load modified cr0
+
+	mvc   __LC_EXT_NEW_PSW(8),.Lpcext-.LPG1(%r13) # set postcall psw
+	la    %r1, .Lsclph-.LPG1(%r13)
+	a     %r1,__LC_EXT_NEW_PSW+4	# set handler
+	st    %r1,__LC_EXT_NEW_PSW+4
+
+	la    %r4,_pstart-.LPG1(%r13)	# %r4 is our index for sccb stuff
+	la    %r1, .Lsccb-PARMAREA(%r4)	# our sccb
+	.insn rre,0xb2200000,%r2,%r1	# service call
+	ipm   %r1
+	srl   %r1,28			# get cc code
+	xr    %r3, %r3
+	chi   %r1,3
+	be    .Lfchunk-.LPG1(%r13)	# leave
+	chi   %r1,2
+	be    .Lservicecall-.LPG1(%r13)
+	lpsw  .Lwaitsclp-.LPG1(%r13)
+.Lsclph:
+	lh    %r1,.Lsccbr-PARMAREA(%r4)
+	chi   %r1,0x10			# 0x0010 is the sucess code
+	je    .Lprocsccb		# let's process the sccb
+	chi   %r1,0x1f0
+	bne   .Lfchunk-.LPG1(%r13)	# unhandled error code
+	c     %r2, .Lrcp-.LPG1(%r13)	# Did we try Read SCP forced
+	bne   .Lfchunk-.LPG1(%r13)	# if no, give up
+	l     %r2, .Lrcp2-.LPG1(%r13)	# try with Read SCP
+	b     .Lservicecall-.LPG1(%r13)
+.Lprocsccb:
+	lh    %r1,.Lscpincr1-PARMAREA(%r4) # use this one if != 0
+	chi   %r1,0x00
+	jne   .Lscnd
+	l     %r1,.Lscpincr2-PARMAREA(%r4) # otherwise use this one
+.Lscnd:
+	xr    %r3,%r3			# same logic
+	ic    %r3,.Lscpa1-PARMAREA(%r4)
+	chi   %r3,0x00
+	jne   .Lcompmem
+	l     %r3,.Lscpa2-PARMAREA(%r13)
+.Lcompmem:
+	mr    %r2,%r1			# mem in MB on 128-bit
+	l     %r1,.Lonemb-.LPG1(%r13)
+	mr    %r2,%r1			# mem size in bytes in %r3
+	b     .Lfchunk-.LPG1(%r13)
+
+.Lpmask:
+	.byte 0
+.align 8
+.Lpcext:.long  0x00080000,0x80000000
+.Lcr:
+	.long 0x00			# place holder for cr0
+.Lwaitsclp:
+	.long 0x020A0000
+	.long .Lsclph
+.Lrcp:
+	.int 0x00120001			# Read SCP forced code
+.Lrcp2:
+	.int 0x00020001			# Read SCP code
+.Lonemb:
+	.int 0x100000
+.Lfchunk:
+
 #
 # find memory chunks.
 #
+	lr    %r9,%r3			 # end of mem
 	mvc   __LC_PGM_NEW_PSW(8),.Lpcmem-.LPG1(%r13)
 	la    %r1,1                      # test in increments of 128KB
 	sll   %r1,17
@@ -488,38 +559,46 @@
 	slr   %r4,%r4                    # set start of chunk to zero
 	slr   %r5,%r5                    # set end of chunk to zero
 	slr   %r6,%r6			 # set access code to zero
+	la    %r10, MEMORY_CHUNKS	 # number of chunks
 .Lloop:
 	tprot 0(%r5),0			 # test protection of first byte
 	ipm   %r7
 	srl   %r7,28
 	clr   %r6,%r7			 # compare cc with last access code
 	be    .Lsame-.LPG1(%r13)
-	clr   %r4,%r5			 # chunk size > 0?
-	be    .Lsize0-.LPG1(%r13)
-	st    %r4,0(%r3)		 # store start address of chunk
-	lr    %r0,%r5
-	slr   %r0,%r4
-	st    %r0,4(%r3)		 # store size of chunk
-	st    %r6,8(%r3)		 # store type of chunk
-	la    %r3,12(%r3)
-	lr    %r4,%r5			 # set start to end
-.Lsize0:
-	lr    %r6,%r7			 # set access code to last cc
+	b     .Lchkmem-.LPG1(%r13)
 .Lsame:
 	ar    %r5,%r1			 # add 128KB to end of chunk
 	bno   .Lloop-.LPG1(%r13)	 # r1 < 0x80000000 -> loop
 .Lchkmem:				 # > 2GB or tprot got a program check
 	clr   %r4,%r5			 # chunk size > 0?
-	be    .Ldonemem-.LPG1(%r13)
+	be    .Lchkloop-.LPG1(%r13)
 	st    %r4,0(%r3)		 # store start address of chunk
 	lr    %r0,%r5
 	slr   %r0,%r4
 	st    %r0,4(%r3)		 # store size of chunk
 	st    %r6,8(%r3)		 # store type of chunk
+	la    %r3,12(%r3)
+	l     %r4,.Lmemsize-.LPG1(%r13)	 # address of variable memory_size
+	st    %r5,0(%r4)		 # store last end to memory size
+	ahi   %r10,-1			 # update chunk number
+.Lchkloop:
+	lr    %r6,%r7			 # set access code to last cc
+	# we got an exception or we're starting a new
+	# chunk , we must check if we should
+	# still try to find valid memory (if we detected
+	# the amount of available storage), and if we
+	# have chunks left
+	xr    %r0,%r0
+	clr   %r0,%r9			 # did we detect memory?
+	je    .Ldonemem			 # if not, leave
+	chi   %r10,0			 # do we have chunks left?
+	je    .Ldonemem
+	alr   %r5,%r1			 # add 128KB to end of chunk
+	lr    %r4,%r5			 # potential new chunk
+	clr    %r5,%r9			 # should we go on?
+	jl     .Lloop
 .Ldonemem:		
-        l     %r1,.Lmemsize-.LPG1(%r13)  # address of variable memory_size
-	st    %r5,0(%r1)                 # store last end to memory size
-	
         l      %r12,.Lmflags-.LPG1(%r13) # get address of machine_flags
 #
 # find out if we are running under VM
@@ -631,6 +710,23 @@
     	.byte  "root=/dev/ram0 ro"
         .byte  0
 	.org   0x11000
+.Lsccb:
+	.hword 0x1000			# length, one page
+	.byte 0x00,0x00,0x00
+	.byte 0x80			# variable response bit set
+.Lsccbr:
+	.hword 0x00			# response code
+.Lscpincr1:
+	.hword 0x00
+.Lscpa1:
+	.byte 0x00
+	.fill 89,1,0
+.Lscpa2:
+	.int 0x00
+.Lscpincr2:
+	.quad 0x00
+	.fill 3984,1,0
+	.org 0x12000
 	.global _pend
 _pend:	
 
diff -Nru a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
--- a/arch/s390/kernel/head64.S	Tue Jun 15 22:20:38 2004
+++ b/arch/s390/kernel/head64.S	Tue Jun 15 22:20:38 2004
@@ -480,12 +480,81 @@
         mvcle %r2,%r4,0                 # clear mem
         jo    .-4                       # branch back, if not finish
 
+	l     %r2,.Lrcp-.LPG1(%r13)	# Read SCP forced command word
+.Lservicecall:
+	stosm .Lpmask-.LPG1(%r13),0x01	# authorize ext interrupts
+
+	stctg %r0,%r0,.Lcr-.LPG1(%r13)	# get cr0
+	la    %r1,0x200			# set bit 22
+	og    %r1,.Lcr-.LPG1(%r13)	# or old cr0 with r1
+	stg   %r1,.Lcr-.LPG1(%r13)
+	lctlg %r0,%r0,.Lcr-.LPG1(%r13)	# load modified cr0
+
+	mvc   __LC_EXT_NEW_PSW(8),.Lpcmsk-.LPG1(%r13) # set postcall psw
+	larl  %r1,.Lsclph
+	stg   %r1,__LC_EXT_NEW_PSW+8	# set handler
+
+	larl  %r4,_pstart		# %r4 is our index for sccb stuff
+	la    %r1,.Lsccb-PARMAREA(%r4)	# our sccb
+	.insn rre,0xb2200000,%r2,%r1	# service call
+	ipm   %r1
+	srl   %r1,28			# get cc code
+	xr    %r3,%r3
+	chi   %r1,3
+	be    .Lfchunk-.LPG1(%r13)	# leave
+	chi   %r1,2
+	be    .Lservicecall-.LPG1(%r13)
+	lpsw  .Lwaitsclp-.LPG1(%r13)
+.Lsclph:
+	lh    %r1,.Lsccbr-PARMAREA(%r4)
+	chi   %r1,0x10			# 0x0010 is the sucess code
+	je    .Lprocsccb		# let's process the sccb
+	chi   %r1,0x1f0
+	bne   .Lfchunk-.LPG1(%r13)	# unhandled error code
+	c     %r2,.Lrcp-.LPG1(%r13)	# Did we try Read SCP forced
+	bne   .Lfchunk-.LPG1(%r13)	# if no, give up
+	l     %r2,.Lrcp2-.LPG1(%r13)	# try with Read SCP
+	b     .Lservicecall-.LPG1(%r13)
+.Lprocsccb:
+	lh    %r1,.Lscpincr1-PARMAREA(%r4) # use this one if != 0
+	chi   %r1,0x00
+	jne   .Lscnd
+	lg    %r1,.Lscpincr2-PARMAREA(%r4) # otherwise use this one
+.Lscnd:
+	xr    %r3,%r3			# same logic
+	ic    %r3,.Lscpa1-PARMAREA(%r4)
+	chi   %r3,0x00
+	jne   .Lcompmem
+	l     %r3,.Lscpa2-PARMAREA(%r13)
+.Lcompmem:
+	mlgr  %r2,%r1			# mem in MB on 128-bit
+	l     %r1,.Lonemb-.LPG1(%r13)
+	mlgr  %r2,%r1			# mem size in bytes in %r3
+	b     .Lfchunk-.LPG1(%r13)
+
+.Lpmask:
+	.byte 0
+	.align 8
+.Lcr:
+	.quad 0x00  # place holder for cr0
+.Lwaitsclp:
+	.long 0x020A0000
+	.quad .Lsclph
+.Lrcp:
+	.int 0x00120001 # Read SCP forced code
+.Lrcp2:
+	.int 0x00020001 # Read SCP code
+.Lonemb:
+	.int 0x100000
+
+.Lfchunk:
 					 # set program check new psw mask
 	mvc   __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13)
 
 #
 # find memory chunks.
 #
+	lgr   %r9,%r3			 # end of mem
 	larl  %r1,.Lchkmem               # set program check address
 	stg   %r1,__LC_PGM_NEW_PSW+8
 	la    %r1,1                      # test in increments of 128KB
@@ -494,51 +563,51 @@
 	slgr  %r4,%r4                    # set start of chunk to zero
 	slgr  %r5,%r5                    # set end of chunk to zero
 	slr  %r6,%r6			 # set access code to zero
+	la    %r10,MEMORY_CHUNKS	 # number of chunks
 .Lloop:
 	tprot 0(%r5),0			 # test protection of first byte
 	ipm   %r7
 	srl   %r7,28
 	clr   %r6,%r7			 # compare cc with last access code
 	je    .Lsame
-	clgr  %r4,%r5			 # chunk size > 0?
-	je    .Lsize0
-	stg   %r4,0(%r3)		 # store start address of chunk
-	lgr   %r0,%r5
-	slgr  %r0,%r4
-	stg   %r0,8(%r3)		 # store size of chunk
-	st    %r6,20(%r3)		 # store type of chunk
-	la    %r3,24(%r3)
-	lgr   %r4,%r5			 # set start to end
-	larl  %r8,memory_size
-	stg   %r5,0(%r8)                 # store memory size
-.Lsize0:
-	lr    %r6,%r7			 # set access code to last cc
+	j     .Lchkmem
 .Lsame:
 	algr  %r5,%r1			 # add 128KB to end of chunk
-	brc   12,.Lloop
+					 # no need to check here,
+	brc   12,.Lloop			 # this is the same chunk
 .Lchkmem:				 # > 16EB or tprot got a program check
 	clgr  %r4,%r5			 # chunk size > 0?
-	je    .Ldonemem
+	je    .Lchkloop
 	stg   %r4,0(%r3)		 # store start address of chunk
 	lgr   %r0,%r5
 	slgr  %r0,%r4
 	stg   %r0,8(%r3)		 # store size of chunk
 	st    %r6,20(%r3)		 # store type of chunk
 	la    %r3,24(%r3)
-	lgr   %r4,%r5
 	larl  %r8,memory_size
 	stg   %r5,0(%r8)                 # store memory size
-#
-# Running native the HSA is located at 2GB and we will get an
-# addressing exception trying to access it. We have to restart
-# the scan at 2GB to find out if the machine has more than 2GB.
-#
+	ahi   %r10,-1			 # update chunk number
+.Lchkloop:
+	lr    %r6,%r7			 # set access code to last cc
+	# we got an exception or we're starting a new
+	# chunk , we must check if we should
+	# still try to find valid memory (if we detected
+	# the amount of available storage), and if we
+	# have chunks left
 	lghi  %r4,1
 	sllg  %r4,%r4,31
 	clgr  %r5,%r4
-	jhe   .Ldonemem
-	lgr   %r5,%r4
-	j     .Lloop
+	je    .Lhsaskip
+	xr    %r0, %r0
+	clgr  %r0, %r9			 # did we detect memory?
+	je    .Ldonemem			 # if not, leave
+	chi   %r10, 0			 # do we have chunks left?
+	je    .Ldonemem
+.Lhsaskip:
+	algr  %r5,%r1			 # add 128KB to end of chunk
+	lgr   %r4,%r5			 # potential new chunk
+	clgr  %r5,%r9			 # should we go on?
+	jl    .Lloop
 .Ldonemem:		
 
 	larl  %r12,machine_flags
@@ -640,6 +709,23 @@
     	.byte  "root=/dev/ram0 ro"
         .byte  0
 	.org   0x11000
+.Lsccb:
+	.hword 0x1000			# length, one page
+	.byte 0x00,0x00,0x00
+	.byte 0x80			# variable response bit set
+.Lsccbr:
+	.hword 0x00			# response code
+.Lscpincr1:
+	.hword 0x00
+.Lscpa1:
+	.byte 0x00
+	.fill 89,1,0
+.Lscpa2:
+	.int 0x00
+.Lscpincr2:
+	.quad 0x00
+	.fill 3984,1,0
+	.org 0x12000
 	.global _pend
 _pend:	
 
diff -Nru a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
--- a/arch/s390/kernel/module.c	Tue Jun 15 22:20:58 2004
+++ b/arch/s390/kernel/module.c	Tue Jun 15 22:20:58 2004
@@ -277,7 +277,8 @@
 			*(unsigned int *) loc = val;
 		else if (r_type == R_390_GOTENT ||
 			 r_type == R_390_GOTPLTENT)
-			*(unsigned int *) loc = val >> 1;
+			*(unsigned int *) loc =
+				(val + (Elf_Addr) me->module_core - loc) >> 1;
 		else if (r_type == R_390_GOT64 ||
 			 r_type == R_390_GOTPLT64)
 			*(unsigned long *) loc = val;
diff -Nru a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
--- a/arch/s390/kernel/process.c	Tue Jun 15 22:20:43 2004
+++ b/arch/s390/kernel/process.c	Tue Jun 15 22:20:43 2004
@@ -16,6 +16,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -292,12 +293,12 @@
 {
         unsigned long clone_flags;
         unsigned long newsp;
-	int *parent_tidptr, *child_tidptr;
+	int __user *parent_tidptr, *child_tidptr;
 
         clone_flags = regs.gprs[3];
         newsp = regs.orig_gpr2;
-	parent_tidptr = (int *) regs.gprs[4];
-	child_tidptr = (int *) regs.gprs[5];
+	parent_tidptr = (int __user *) regs.gprs[4];
+	child_tidptr = (int __user *) regs.gprs[5];
         if (!newsp)
                 newsp = regs.gprs[15];
         return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0,
@@ -328,12 +329,12 @@
         int error;
         char * filename;
 
-        filename = getname((char *) regs.orig_gpr2);
+        filename = getname((char __user *) regs.orig_gpr2);
         error = PTR_ERR(filename);
         if (IS_ERR(filename))
                 goto out;
-        error = do_execve(filename, (char **) regs.gprs[3],
-			  (char **) regs.gprs[4], &regs);
+        error = do_execve(filename, (char __user * __user *) regs.gprs[3],
+			  (char __user * __user *) regs.gprs[4], &regs);
 	if (error == 0) {
 		current->ptrace &= ~PT_DTRACE;
 		current->thread.fp_regs.fpc = 0;
@@ -385,12 +386,6 @@
 	dump->regs.per_info = current->thread.per_info;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long r14, r15, bc;
@@ -413,12 +408,10 @@
 #else
 		r14 = *(unsigned long *) (bc+112);
 #endif
-		if (r14 < first_sched || r14 >= last_sched)
+		if (!in_sched_functions(r14))
 			return r14;
 		bc = (*(unsigned long *) bc) & PSW_ADDR_INSN;
 	} while (count++ < 16);
 	return 0;
 }
-#undef last_sched
-#undef first_sched
 
diff -Nru a/arch/s390/kernel/profile.c b/arch/s390/kernel/profile.c
--- a/arch/s390/kernel/profile.c	Tue Jun 15 22:20:41 2004
+++ b/arch/s390/kernel/profile.c	Tue Jun 15 22:20:41 2004
@@ -19,7 +19,8 @@
 	return len;
 }
 
-static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
+static int prof_cpu_mask_write_proc (struct file *file,
+					const char __user *buffer,
 					unsigned long count, void *data)
 {
 	cpumask_t *mask = (cpumask_t *)data;
diff -Nru a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
--- a/arch/s390/kernel/ptrace.c	Tue Jun 15 22:20:58 2004
+++ b/arch/s390/kernel/ptrace.c	Tue Jun 15 22:20:58 2004
@@ -141,7 +141,7 @@
 		/*
 		 * psw and gprs are stored on the stack
 		 */
-		tmp = *(addr_t *)((addr_t) __KSTK_PTREGS(child) + addr);
+		tmp = *(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr);
 		if (addr == (addr_t) &dummy->regs.psw.mask)
 			/* Remove per bit from user psw. */
 			tmp &= ~PSW_MASK_PER;
@@ -176,7 +176,7 @@
 	} else
 		tmp = 0;
 
-	return put_user(tmp, (addr_t *) data);
+	return put_user(tmp, (addr_t __user *) data);
 }
 
 /*
@@ -215,7 +215,7 @@
 			   high order bit but older gdb's rely on it */
 			data |= PSW_ADDR_AMODE;
 #endif
-		*(addr_t *)((addr_t) __KSTK_PTREGS(child) + addr) = data;
+		*(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr) = data;
 
 	} else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {
 		/*
@@ -269,7 +269,7 @@
 		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
 		if (copied != sizeof(tmp))
 			return -EIO;
-		return put_user(tmp, (unsigned long *) data);
+		return put_user(tmp, (unsigned long __user *) data);
 
 	case PTRACE_PEEKUSR:
 		/* read the word at location addr in the USER area. */
@@ -291,7 +291,8 @@
 
 	case PTRACE_PEEKUSR_AREA:
 	case PTRACE_POKEUSR_AREA:
-		if (copy_from_user(&parea, (void *) addr, sizeof(parea)))
+		if (copy_from_user(&parea, (void __user *) addr,
+							sizeof(parea)))
 			return -EFAULT;
 		addr = parea.kernel_addr;
 		data = parea.process_addr;
@@ -301,7 +302,7 @@
 				ret = peek_user(child, addr, data);
 			else {
 				addr_t tmp;
-				if (get_user (tmp, (addr_t *) data))
+				if (get_user (tmp, (addr_t __user *) data))
 					return -EFAULT;
 				ret = poke_user(child, addr, tmp);
 			}
@@ -360,7 +361,7 @@
 				PSW32_ADDR_AMODE31;
 		} else {
 			/* gpr 0-15 */
-			tmp = *(__u32 *)((addr_t) __KSTK_PTREGS(child) + 
+			tmp = *(__u32 *)((addr_t) &__KSTK_PTREGS(child)->psw +
 					 addr*2 + 4);
 		}
 	} else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {
@@ -402,7 +403,7 @@
 	} else
 		tmp = 0;
 
-	return put_user(tmp, (__u32 *) data);
+	return put_user(tmp, (__u32 __user *) data);
 }
 
 /*
@@ -439,8 +440,8 @@
 				(__u64) tmp & PSW32_ADDR_INSN;
 		} else {
 			/* gpr 0-15 */
-			*(__u32*)((addr_t) __KSTK_PTREGS(child) + addr*2 + 4) =
-				tmp;
+			*(__u32*)((addr_t) &__KSTK_PTREGS(child)->psw
+				  + addr*2 + 4) = tmp;
 		}
 	} else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {
 		/*
@@ -509,7 +510,7 @@
 		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
 		if (copied != sizeof(tmp))
 			return -EIO;
-		return put_user(tmp, (unsigned int *) data);
+		return put_user(tmp, (unsigned int __user *) data);
 
 	case PTRACE_PEEKUSR:
 		/* read the word at location addr in the USER area. */
@@ -530,7 +531,8 @@
 
 	case PTRACE_PEEKUSR_AREA:
 	case PTRACE_POKEUSR_AREA:
-		if (copy_from_user(&parea, (void *) addr, sizeof(parea)))
+		if (copy_from_user(&parea, (void __user *) addr,
+							sizeof(parea)))
 			return -EFAULT;
 		addr = parea.kernel_addr;
 		data = parea.process_addr;
@@ -540,7 +542,7 @@
 				ret = peek_user_emu31(child, addr, data);
 			else {
 				__u32 tmp;
-				if (get_user (tmp, (__u32 *) data))
+				if (get_user (tmp, (__u32 __user *) data))
 					return -EFAULT;
 				ret = poke_user_emu31(child, addr, tmp);
 			}
diff -Nru a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c
--- a/arch/s390/kernel/s390_ksyms.c	Tue Jun 15 22:20:42 2004
+++ b/arch/s390/kernel/s390_ksyms.c	Tue Jun 15 22:20:42 2004
@@ -45,25 +45,6 @@
 EXPORT_SYMBOL(__down_interruptible);
 
 /*
- * string functions
- */
-EXPORT_SYMBOL_NOVERS(memcmp);
-EXPORT_SYMBOL_NOVERS(memset);
-EXPORT_SYMBOL_NOVERS(memmove);
-EXPORT_SYMBOL_NOVERS(memscan);
-EXPORT_SYMBOL_NOVERS(strlen);
-EXPORT_SYMBOL_NOVERS(strchr);
-EXPORT_SYMBOL_NOVERS(strcmp);
-EXPORT_SYMBOL_NOVERS(strncat);
-EXPORT_SYMBOL_NOVERS(strncmp);
-EXPORT_SYMBOL_NOVERS(strncpy);
-EXPORT_SYMBOL_NOVERS(strnlen);
-EXPORT_SYMBOL_NOVERS(strrchr);
-EXPORT_SYMBOL_NOVERS(strstr);
-EXPORT_SYMBOL_NOVERS(strpbrk);
-EXPORT_SYMBOL_NOVERS(strcpy);
-
-/*
  * binfmt_elf loader 
  */
 extern int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs);
diff -Nru a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
--- a/arch/s390/kernel/setup.c	Tue Jun 15 22:20:36 2004
+++ b/arch/s390/kernel/setup.c	Tue Jun 15 22:20:36 2004
@@ -53,7 +53,9 @@
 unsigned int console_irq = -1;
 unsigned long memory_size = 0;
 unsigned long machine_flags = 0;
-struct { unsigned long addr, size, type; } memory_chunk[16] = { { 0 } };
+struct {
+	unsigned long addr, size, type;
+} memory_chunk[MEMORY_CHUNKS] = { { 0 } };
 #define CHUNK_READ_WRITE 0
 #define CHUNK_READ_ONLY 1
 int cpus_initialized = 0;
diff -Nru a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
--- a/arch/s390/kernel/signal.c	Tue Jun 15 22:20:43 2004
+++ b/arch/s390/kernel/signal.c	Tue Jun 15 22:20:43 2004
@@ -77,8 +77,9 @@
 	}
 }
 
-asmlinkage int
-sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize)
+asmlinkage long
+sys_rt_sigsuspend(struct pt_regs *regs, sigset_t __user *unewset,
+						size_t sigsetsize)
 {
 	sigset_t saveset, newset;
 
@@ -105,9 +106,9 @@
 	}
 }
 
-asmlinkage int 
-sys_sigaction(int sig, const struct old_sigaction *act,
-	      struct old_sigaction *oact)
+asmlinkage long
+sys_sigaction(int sig, const struct old_sigaction __user *act,
+	      struct old_sigaction __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -137,8 +138,9 @@
 	return ret;
 }
 
-asmlinkage int
-sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs)
+asmlinkage long
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+					struct pt_regs *regs)
 {
 	return do_sigaltstack(uss, uoss, regs->gprs[15]);
 }
@@ -146,7 +148,7 @@
 
 
 /* Returns non-zero on fault. */
-static int save_sigregs(struct pt_regs *regs, _sigregs *sregs)
+static int save_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
 {
 	unsigned long old_mask = regs->psw.mask;
 	int err;
@@ -175,7 +177,7 @@
 }
 
 /* Returns positive number on error */
-static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs)
+static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs)
 {
 	unsigned long old_mask = regs->psw.mask;
 	int err;
@@ -208,7 +210,7 @@
 
 asmlinkage long sys_sigreturn(struct pt_regs *regs)
 {
-	sigframe *frame = (sigframe *)regs->gprs[15];
+	sigframe __user *frame = (sigframe __user *)regs->gprs[15];
 	sigset_t set;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -234,7 +236,7 @@
 
 asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
 {
-	rt_sigframe *frame = (rt_sigframe *)regs->gprs[15];
+	rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
 	sigset_t set;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -269,7 +271,7 @@
 /*
  * Determine which stack to use..
  */
-static inline void *
+static inline void __user *
 get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
 {
 	unsigned long sp;
@@ -290,7 +292,7 @@
 		sp = (unsigned long) ka->sa.sa_restorer;
 	}
 
-	return (void *)((sp - frame_size) & -8ul);
+	return (void __user *)((sp - frame_size) & -8ul);
 }
 
 static inline int map_signal(int sig)
@@ -306,7 +308,9 @@
 static void setup_frame(int sig, struct k_sigaction *ka,
 			sigset_t *set, struct pt_regs * regs)
 {
-	sigframe *frame = get_sigframe(ka, regs, sizeof(sigframe));
+	sigframe __user *frame;
+
+	frame = get_sigframe(ka, regs, sizeof(sigframe));
 	if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe)))
 		goto give_sigsegv;
 
@@ -326,13 +330,13 @@
 	} else {
                 regs->gprs[14] = (unsigned long)
 			frame->retcode | PSW_ADDR_AMODE;
-		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, 
-	                       (u16 *)(frame->retcode)))
+		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
+	                       (u16 __user *)(frame->retcode)))
 			goto give_sigsegv;
 	}
 
 	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (addr_t *) frame))
+	if (__put_user(regs->gprs[15], (addr_t __user *) frame))
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
@@ -358,7 +362,9 @@
 			   sigset_t *set, struct pt_regs * regs)
 {
 	int err = 0;
-	rt_sigframe *frame = get_sigframe(ka, regs, sizeof(rt_sigframe));
+	rt_sigframe __user *frame;
+
+	frame = get_sigframe(ka, regs, sizeof(rt_sigframe));
 	if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe)))
 		goto give_sigsegv;
 
@@ -385,12 +391,12 @@
 	} else {
                 regs->gprs[14] = (unsigned long)
 			frame->retcode | PSW_ADDR_AMODE;
-		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, 
-	                          (u16 *)(frame->retcode));
+		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
+	                          (u16 __user *)(frame->retcode));
 	}
 
 	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (addr_t *) frame))
+	if (__put_user(regs->gprs[15], (addr_t __user *) frame))
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
diff -Nru a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
--- a/arch/s390/kernel/smp.c	Tue Jun 15 22:20:36 2004
+++ b/arch/s390/kernel/smp.c	Tue Jun 15 22:20:36 2004
@@ -31,6 +31,7 @@
 #include <linux/delay.h>
 #include <linux/cache.h>
 #include <linux/interrupt.h>
+#include <linux/cpu.h>
 
 #include <asm/sigp.h>
 #include <asm/pgalloc.h>
@@ -127,6 +128,9 @@
 	if (cpus <= 0)
 		return 0;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data.func = func;
 	data.info = info;
 	atomic_set(&data.started, 0);
@@ -647,6 +651,24 @@
 {
         return 0;
 }
+
+static DEFINE_PER_CPU(struct cpu, cpu_devices);
+
+static int __init topology_init(void)
+{
+	int cpu;
+	int ret;
+
+	for_each_cpu(cpu) {
+		ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL);
+		if (ret)
+			printk(KERN_WARNING "topology_init: register_cpu %d "
+			       "failed (%d)\n", cpu, ret);
+	}
+	return 0;
+}
+
+subsys_initcall(topology_init);
 
 EXPORT_SYMBOL(cpu_possible_map);
 EXPORT_SYMBOL(lowcore_ptr);
diff -Nru a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
--- a/arch/s390/kernel/sys_s390.c	Tue Jun 15 22:20:39 2004
+++ b/arch/s390/kernel/sys_s390.c	Tue Jun 15 22:20:39 2004
@@ -37,7 +37,7 @@
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way Unix traditionally does this, though.
  */
-asmlinkage long sys_pipe(unsigned long * fildes)
+asmlinkage long sys_pipe(unsigned long __user *fildes)
 {
 	int fd[2];
 	int error;
@@ -92,7 +92,7 @@
 	unsigned long offset;
 };
 
-asmlinkage long sys_mmap2(struct mmap_arg_struct *arg)
+asmlinkage long sys_mmap2(struct mmap_arg_struct __user  *arg)
 {
 	struct mmap_arg_struct a;
 	int error = -EFAULT;
@@ -104,7 +104,7 @@
 	return error;
 }
 
-asmlinkage long old_mmap(struct mmap_arg_struct *arg)
+asmlinkage long old_mmap(struct mmap_arg_struct __user *arg)
 {
 	struct mmap_arg_struct a;
 	long error = -EFAULT;
@@ -128,7 +128,7 @@
 	struct timeval *tvp;
 };
 
-asmlinkage long old_select(struct sel_arg_struct *arg)
+asmlinkage long old_select(struct sel_arg_struct __user *arg)
 {
 	struct sel_arg_struct a;
 
@@ -138,38 +138,6 @@
 	return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
 
 }
-#else /* CONFIG_ARCH_S390X */
-unsigned long
-arch_get_unmapped_area(struct file *filp, unsigned long addr,
-		       unsigned long len, unsigned long pgoff,
-		       unsigned long flags)
-{
-	struct vm_area_struct *vma;
-	unsigned long end;
-
-	if (test_thread_flag(TIF_31BIT)) { 
-		if (!addr) 
-			addr = 0x40000000; 
-		end = 0x80000000;		
-	} else { 
-		if (!addr) 
-			addr = TASK_SIZE / 2;
-		end = TASK_SIZE; 
-	}
-
-	if (len > end)
-		return -ENOMEM;
-	addr = PAGE_ALIGN(addr);
-
-	for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
-		/* At this point:  (!vma || addr < vma->vm_end). */
-		if (end - len < addr)
-			return -ENOMEM;
-		if (!vma || addr + len <= vma->vm_start)
-			return addr;
-		addr = vma->vm_end;
-	}
-}
 #endif /* CONFIG_ARCH_S390X */
 
 /*
@@ -177,37 +145,37 @@
  *
  * This is really horribly ugly.
  */
-asmlinkage long sys_ipc (uint call, int first, int second,
-				  unsigned long third, void *ptr)
+asmlinkage long sys_ipc(uint call, int first, int second,
+				  unsigned long third, void __user *ptr)
 {
         struct ipc_kludge tmp;
 	int ret;
 
         switch (call) {
         case SEMOP:
-		return sys_semtimedop (first, (struct sembuf *) ptr, second,
+		return sys_semtimedop (first, (struct sembuf __user *) ptr, second,
 				       NULL);
 	case SEMTIMEDOP:
-		return sys_semtimedop (first, (struct sembuf *) ptr, second,
-				       (const struct timespec *) third);
+		return sys_semtimedop (first, (struct sembuf __user *) ptr, second,
+				       (const struct timespec __user *) third);
         case SEMGET:
                 return sys_semget (first, second, third);
         case SEMCTL: {
                 union semun fourth;
                 if (!ptr)
                         return -EINVAL;
-                if (get_user(fourth.__pad, (void **) ptr))
+                if (get_user(fourth.__pad, (void __user * __user *) ptr))
                         return -EFAULT;
                 return sys_semctl (first, second, third, fourth);
-        } 
+        }
         case MSGSND:
-		return sys_msgsnd (first, (struct msgbuf *) ptr, 
+		return sys_msgsnd (first, (struct msgbuf __user *) ptr,
                                    second, third);
 		break;
         case MSGRCV:
                 if (!ptr)
                         return -EINVAL;
-                if (copy_from_user (&tmp, (struct ipc_kludge *) ptr,
+                if (copy_from_user (&tmp, (struct ipc_kludge __user *) ptr,
                                     sizeof (struct ipc_kludge)))
                         return -EFAULT;
                 return sys_msgrcv (first, tmp.msgp,
@@ -215,33 +183,33 @@
         case MSGGET:
                 return sys_msgget ((key_t) first, second);
         case MSGCTL:
-                return sys_msgctl (first, second, (struct msqid_ds *) ptr);
-                
+                return sys_msgctl (first, second, (struct msqid_ds __user *) ptr);
+
 	case SHMAT: {
 		ulong raddr;
-		ret = do_shmat (first, (char *) ptr, second, &raddr);
+		ret = do_shmat (first, (char __user *) ptr, second, &raddr);
 		if (ret)
 			return ret;
-		return put_user (raddr, (ulong *) third);
+		return put_user (raddr, (ulong __user *) third);
 		break;
         }
-	case SHMDT: 
-		return sys_shmdt ((char *)ptr);
+	case SHMDT:
+		return sys_shmdt ((char __user *)ptr);
 	case SHMGET:
 		return sys_shmget (first, second, third);
 	case SHMCTL:
 		return sys_shmctl (first, second,
-                                   (struct shmid_ds *) ptr);
+                                   (struct shmid_ds __user *) ptr);
 	default:
 		return -ENOSYS;
 
 	}
-        
+
 	return -EINVAL;
 }
 
 #ifdef CONFIG_ARCH_S390X
-asmlinkage long s390x_newuname(struct new_utsname * name)
+asmlinkage long s390x_newuname(struct new_utsname __user *name)
 {
 	int ret = sys_newuname(name);
 
@@ -288,7 +256,7 @@
 };
 
 asmlinkage long
-s390_fadvise64_64(struct fadvise64_64_args *args)
+s390_fadvise64_64(struct fadvise64_64_args __user *args)
 {
 	struct fadvise64_64_args a;
 
diff -Nru a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
--- a/arch/s390/kernel/syscalls.S	Tue Jun 15 22:20:37 2004
+++ b/arch/s390/kernel/syscalls.S	Tue Jun 15 22:20:37 2004
@@ -150,11 +150,11 @@
 SYSCALL(sys_setfsgid16,sys_ni_syscall,sys32_setfsgid16_wrapper)	/* old setfsgid16 syscall */
 SYSCALL(sys_llseek,sys_llseek,sys32_llseek_wrapper)		/* 140 */
 SYSCALL(sys_getdents,sys_getdents,sys32_getdents_wrapper)
-SYSCALL(sys_select,sys_select,sys32_select_wrapper)
+SYSCALL(sys_select,sys_select,compat_sys_select_wrapper)
 SYSCALL(sys_flock,sys_flock,sys32_flock_wrapper)
 SYSCALL(sys_msync,sys_msync,sys32_msync_wrapper)
-SYSCALL(sys_readv,sys_readv,sys32_readv_wrapper)		/* 145 */
-SYSCALL(sys_writev,sys_writev,sys32_writev_wrapper)
+SYSCALL(sys_readv,sys_readv,compat_sys_readv_wrapper)		/* 145 */
+SYSCALL(sys_writev,sys_writev,compat_sys_writev_wrapper)
 SYSCALL(sys_getsid,sys_getsid,sys32_getsid_wrapper)
 SYSCALL(sys_fdatasync,sys_fdatasync,sys32_fdatasync_wrapper)
 SYSCALL(sys_sysctl,sys_sysctl,sys32_sysctl_wrapper)
@@ -177,7 +177,7 @@
 NI_SYSCALL							/* for vm86 */
 NI_SYSCALL							/* old sys_query_module */
 SYSCALL(sys_poll,sys_poll,sys32_poll_wrapper)
-SYSCALL(sys_nfsservctl,sys_nfsservctl,sys32_nfsservctl_wrapper)
+SYSCALL(sys_nfsservctl,sys_nfsservctl,compat_sys_nfsservctl_wrapper)
 SYSCALL(sys_setresgid16,sys_ni_syscall,sys32_setresgid16_wrapper)	/* 170 old setresgid16 syscall */
 SYSCALL(sys_getresgid16,sys_ni_syscall,sys32_getresgid16_wrapper)	/* old getresgid16 syscall */
 SYSCALL(sys_prctl,sys_prctl,sys32_prctl_wrapper)
@@ -195,7 +195,7 @@
 SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper)
 SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper)		/* 185 */
 SYSCALL(sys_sigaltstack_glue,sys_sigaltstack_glue,sys32_sigaltstack_glue)
-SYSCALL(sys_sendfile,sys_sendfile,sys32_sendfile_wrapper)
+SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper)
 NI_SYSCALL							/* streams1 */
 NI_SYSCALL							/* streams2 */
 SYSCALL(sys_vfork_glue,sys_vfork_glue,sys_vfork_glue)		/* 190 */
diff -Nru a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
--- a/arch/s390/kernel/time.c	Tue Jun 15 22:20:36 2004
+++ b/arch/s390/kernel/time.c	Tue Jun 15 22:20:36 2004
@@ -468,7 +468,7 @@
 	__u64 tmp;
 	__u32 ticks;
 
-	if (!cpu_isset(smp_processor_id(), idle_cpu_mask))
+	if (!cpu_isset(smp_processor_id(), nohz_cpu_mask))
 		return;
 
 	/* Calculate how many ticks have passed */
@@ -511,7 +511,7 @@
 			do_timer(regs);
 #endif
 	}
-	cpu_clear(smp_processor_id(), idle_cpu_mask);
+	cpu_clear(smp_processor_id(), nohz_cpu_mask);
 }
 
 /*
@@ -536,7 +536,7 @@
 	 * This cpu is going really idle. Set up the clock comparator
 	 * for the next event.
 	 */
-	cpu_set(smp_processor_id(), idle_cpu_mask);
+	cpu_set(smp_processor_id(), nohz_cpu_mask);
 	timer = (__u64) (next_timer_interrupt() - jiffies) + jiffies_64;
 	timer = jiffies_timer_cc + timer * CLK_TICKS_PER_JIFFY;
 	asm volatile ("SCKC %0" : : "m" (timer));
diff -Nru a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
--- a/arch/s390/kernel/traps.c	Tue Jun 15 22:20:39 2004
+++ b/arch/s390/kernel/traps.c	Tue Jun 15 22:20:39 2004
@@ -188,7 +188,7 @@
 	printk("%s Code: ", mode);
 	for (i = 0; i < 20; i++) {
 		unsigned char c;
-		if (__get_user(c, (char *)(regs->psw.addr + i))) {
+		if (__get_user(c, (char __user *)(regs->psw.addr + i))) {
 			printk(" Bad PSW.");
 			break;
 		}
@@ -391,7 +391,7 @@
 		local_irq_enable();
 
 	if (regs->psw.mask & PSW_MASK_PSTATE)
-		get_user(*((__u16 *) opcode), location);
+		get_user(*((__u16 *) opcode), (__u16 __user *)location);
 	else
 		*((__u16 *)opcode)=*((__u16 *)location);
 	if (*((__u16 *)opcode)==S390_BREAKPOINT_U16)
diff -Nru a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
--- a/arch/s390/lib/Makefile	Tue Jun 15 22:20:36 2004
+++ b/arch/s390/lib/Makefile	Tue Jun 15 22:20:36 2004
@@ -4,6 +4,6 @@
 
 EXTRA_AFLAGS := -traditional
 
-lib-y += delay.o 
-lib-$(CONFIG_ARCH_S390_31) += memset.o strcmp.o strcpy.o strncpy.o uaccess.o
-lib-$(CONFIG_ARCH_S390X) += memset64.o strcmp64.o strcpy64.o strncpy64.o uaccess64.o
+lib-y += delay.o string.o
+lib-$(CONFIG_ARCH_S390_31) += uaccess.o
+lib-$(CONFIG_ARCH_S390X) += uaccess64.o
diff -Nru a/arch/s390/lib/memset.S b/arch/s390/lib/memset.S
--- a/arch/s390/lib/memset.S	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,30 +0,0 @@
-/*
- *  arch/s390/lib/memset.S
- *    S390 fast memset routine
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-/*
- * R2 = address to memory area
- * R3 = byte to fill memory with
- * R4 = number of bytes to fill
- */
-        .globl  memset
-memset:
-        LTR     4,4
-        JZ      memset_end
-        LR      0,2                    # save pointer to memory area
-        LR      1,3                    # move pad byte to R1
-        LR      3,4
-        SR      4,4                    # no source for MVCLE, only a pad byte
-        SR      5,5
-        MVCLE   2,4,0(1)               # thats it, MVCLE is your friend
-        JO      .-4
-        LR      2,0                    # return pointer to mem.
-memset_end:
-        BR      14
-        
-
diff -Nru a/arch/s390/lib/memset64.S b/arch/s390/lib/memset64.S
--- a/arch/s390/lib/memset64.S	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,30 +0,0 @@
-/*
- *  arch/s390/lib/memset.S
- *    S390 fast memset routine
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-/*
- * R2 = address to memory area
- * R3 = byte to fill memory with
- * R4 = number of bytes to fill
- */
-        .globl  memset
-memset:
-        LTGR    4,4
-        JZ      memset_end
-        LGR     0,2                    # save pointer to memory area
-        LGR     1,3                    # move pad byte to R1
-        LGR     3,4
-        SGR     4,4                    # no source for MVCLE, only a pad byte
-        SGR     5,5
-        MVCLE   2,4,0(1)               # thats it, MVCLE is your friend
-        JO      .-4
-        LGR     2,0                    # return pointer to mem.
-memset_end:
-        BR      14
-        
-
diff -Nru a/arch/s390/lib/strcmp.S b/arch/s390/lib/strcmp.S
--- a/arch/s390/lib/strcmp.S	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,27 +0,0 @@
-/*
- *  arch/s390/lib/strcmp.S
- *    S390 strcmp routine
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-/*
- * R2 = address of compare string
- * R3 = address of test string
- */
-        .globl   strcmp
-strcmp:
-        SR      0,0
-        SR      1,1
-        CLST    2,3
-        JO      .-4
-        JE      strcmp_equal
-        IC      0,0(3)
-        IC      1,0(2)
-        SR      1,0
-strcmp_equal:
-        LR      2,1
-        BR      14
-        
diff -Nru a/arch/s390/lib/strcmp64.S b/arch/s390/lib/strcmp64.S
--- a/arch/s390/lib/strcmp64.S	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,27 +0,0 @@
-/*
- *  arch/s390/lib/strcmp.S
- *    S390 strcmp routine
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-/*
- * R2 = address of compare string
- * R3 = address of test string
- */
-        .globl   strcmp
-strcmp:
-        SGR     0,0
-        SGR     1,1
-        CLST    2,3
-        JO      .-4
-        JE      strcmp_equal
-        IC      0,0(3)
-        IC      1,0(2)
-        SGR     1,0
-strcmp_equal:
-        LGR     2,1
-        BR      14
-        
diff -Nru a/arch/s390/lib/strcpy.S b/arch/s390/lib/strcpy.S
--- a/arch/s390/lib/strcpy.S	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,20 +0,0 @@
-/*
- *  arch/s390/kernel/strcpy.S
- *    S390 strcpy routine
- *
- *  S390 version
- *    Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-/*
- * R2 = address of destination
- * R3 = address of source string
- */
-        .globl   strcpy
-strcpy:
-	sr	%r0,%r0
-0:	mvst	%r2,%r3
-	jo	0b
-	br	%r14
-
diff -Nru a/arch/s390/lib/strcpy64.S b/arch/s390/lib/strcpy64.S
--- a/arch/s390/lib/strcpy64.S	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,20 +0,0 @@
-/*
- *  arch/s390/kernel/strcpy.S
- *    S390 strcpy routine
- *
- *  S390 version
- *    Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-/*
- * R2 = address of destination
- * R3 = address of source string
- */
-        .globl   strcpy
-strcpy:
-	sgr	%r0,%r0
-0:	mvst	%r2,%r3
-	jo	0b
-	br	%r14
-
diff -Nru a/arch/s390/lib/string.c b/arch/s390/lib/string.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/s390/lib/string.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,405 @@
+/*
+ *  arch/s390/lib/string.c
+ *    Optimized string functions
+ *
+ *  S390 version
+ *    Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
+ */
+
+#define IN_ARCH_STRING_C 1
+
+#include <linux/types.h>
+#include <linux/module.h>
+
+/*
+ * Helper functions to find the end of a string
+ */
+static inline char *__strend(const char *s)
+{
+	register unsigned long r0 asm("0") = 0;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b"
+		      : "+d" (r0), "+a" (s) :  : "cc" );
+	return (char *) r0;
+}
+
+static inline char *__strnend(const char *s, size_t n)
+{
+	register unsigned long r0 asm("0") = 0;
+	const char *p = s + n;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b"
+		      : "+d" (p), "+a" (s) : "d" (r0) : "cc" );
+	return (char *) p;
+}
+
+/**
+ * strlen - Find the length of a string
+ * @s: The string to be sized
+ *
+ * returns the length of @s
+ */
+size_t strlen(const char *s)
+{
+	return __strend(s) - s;
+}
+EXPORT_SYMBOL_NOVERS(strlen);
+
+/**
+ * strnlen - Find the length of a length-limited string
+ * @s: The string to be sized
+ * @n: The maximum number of bytes to search
+ *
+ * returns the minimum of the length of @s and @n
+ */
+size_t strnlen(const char * s, size_t n)
+{
+	return __strnend(s, n) - s;
+}
+EXPORT_SYMBOL_NOVERS(strnlen);
+
+/**
+ * strcpy - Copy a %NUL terminated string
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ *
+ * returns a pointer to @dest
+ */
+char *strcpy(char *dest, const char *src)
+{
+	register int r0 asm("0") = 0;
+	char *ret = dest;
+
+	asm volatile ("0: mvst  %0,%1\n"
+		      "   jo    0b"
+		      : "+&a" (dest), "+&a" (src) : "d" (r0)
+		      : "cc", "memory" );
+	return ret;
+}
+EXPORT_SYMBOL_NOVERS(strcpy);
+
+/**
+ * strlcpy - Copy a %NUL terminated string into a sized buffer
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @size: size of destination buffer
+ *
+ * Compatible with *BSD: the result is always a valid
+ * NUL-terminated string that fits in the buffer (unless,
+ * of course, the buffer size is zero). It does not pad
+ * out the result like strncpy() does.
+ */
+size_t strlcpy(char *dest, const char *src, size_t size)
+{
+	size_t ret = __strend(src) - src;
+
+	if (size) {
+		size_t len = (ret >= size) ? size-1 : ret;
+		dest[len] = '\0';
+		__builtin_memcpy(dest, src, len);
+	}
+	return ret;
+}
+EXPORT_SYMBOL_NOVERS(strlcpy);
+
+/**
+ * strncpy - Copy a length-limited, %NUL-terminated string
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ * @n: The maximum number of bytes to copy
+ *
+ * The result is not %NUL-terminated if the source exceeds
+ * @n bytes.
+ */
+char *strncpy(char *dest, const char *src, size_t n)
+{
+	size_t len = __strnend(src, n) - src;
+	__builtin_memset(dest + len, 0, n - len);
+	__builtin_memcpy(dest, src, len);
+	return dest;
+}
+EXPORT_SYMBOL_NOVERS(strncpy);
+
+/**
+ * strcat - Append one %NUL-terminated string to another
+ * @dest: The string to be appended to
+ * @src: The string to append to it
+ *
+ * returns a pointer to @dest
+ */
+char *strcat(char *dest, const char *src)
+{
+	register int r0 asm("0") = 0;
+	unsigned long dummy;
+	char *ret = dest;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b\n"
+		      "1: mvst  %0,%2\n"
+		      "   jo    1b"
+		      : "=&a" (dummy), "+a" (dest), "+a" (src)
+		      : "d" (r0), "0" (0UL) : "cc", "memory" );
+	return ret;
+}
+EXPORT_SYMBOL_NOVERS(strcat);
+
+/**
+ * strlcat - Append a length-limited, %NUL-terminated string to another
+ * @dest: The string to be appended to
+ * @src: The string to append to it
+ * @n: The size of the destination buffer.
+ */
+size_t strlcat(char *dest, const char *src, size_t n)
+{
+	size_t dsize = __strend(dest) - dest;
+	size_t len = __strend(src) - src;
+	size_t res = dsize + len;
+
+	if (dsize < n) {
+		dest += dsize;
+		n -= dsize;
+		if (len >= n)
+			len = n - 1;
+		dest[len] = '\0';
+		__builtin_memcpy(dest, src, len);
+	}
+	return res;
+}
+EXPORT_SYMBOL_NOVERS(strlcat);
+
+/**
+ * strncat - Append a length-limited, %NUL-terminated string to another
+ * @dest: The string to be appended to
+ * @src: The string to append to it
+ * @n: The maximum numbers of bytes to copy
+ *
+ * returns a pointer to @dest
+ *
+ * Note that in contrast to strncpy, strncat ensures the result is
+ * terminated.
+ */
+char *strncat(char *dest, const char *src, size_t n)
+{
+	size_t len = __strnend(src, n) - src;
+	char *p = __strend(dest);
+
+	p[len] = '\0';
+	__builtin_memcpy(p, src, len);
+	return dest;
+}
+EXPORT_SYMBOL_NOVERS(strncat);
+
+/**
+ * strcmp - Compare two strings
+ * @cs: One string
+ * @ct: Another string
+ *
+ * returns   0 if @cs and @ct are equal,
+ *         < 0 if @cs is less than @ct
+ *         > 0 if @cs is greater than @ct
+ */
+int strcmp(const char *cs, const char *ct)
+{
+	register int r0 asm("0") = 0;
+	int ret = 0;
+
+	asm volatile ("0: clst %2,%3\n"
+		      "   jo   0b\n"
+		      "   je   1f\n"
+		      "   ic   %0,0(%2)\n"
+		      "   ic   %1,0(%3)\n"
+		      "   sr   %0,%1\n"
+		      "1:"
+		      : "+d" (ret), "+d" (r0), "+a" (cs), "+a" (ct)
+		      : : "cc" );
+	return ret;
+}
+EXPORT_SYMBOL_NOVERS(strcmp);
+
+/**
+ * strrchr - Find the last occurrence of a character in a string
+ * @s: The string to be searched
+ * @c: The character to search for
+ */
+char * strrchr(const char * s, int c)
+{
+       size_t len = __strend(s) - s;
+
+       if (len)
+	       do {
+		       if (s[len] == (char) c)
+			       return (char *) s + len;
+	       } while (--len > 0);
+       return 0;
+}
+EXPORT_SYMBOL_NOVERS(strrchr);
+
+/**
+ * strstr - Find the first substring in a %NUL terminated string
+ * @s1: The string to be searched
+ * @s2: The string to search for
+ */
+char * strstr(const char * s1,const char * s2)
+{
+	int l1, l2;
+
+	l2 = __strend(s2) - s2;
+	if (!l2)
+		return (char *) s1;
+	l1 = __strend(s1) - s1;
+	while (l1-- >= l2) {
+		register unsigned long r2 asm("2") = (unsigned long) s1;
+		register unsigned long r3 asm("3") = (unsigned long) l2;
+		register unsigned long r4 asm("4") = (unsigned long) s2;
+		register unsigned long r5 asm("5") = (unsigned long) l2;
+		int cc;
+
+		asm volatile ("0: clcle %1,%3,0\n"
+			      "   jo    0b\n"
+			      "   ipm   %0\n"
+			      "   srl   %0,28"
+			      : "=&d" (cc), "+a" (r2), "+a" (r3),
+			        "+a" (r4), "+a" (r5) : : "cc" );
+		if (!cc)
+			return (char *) s1;
+		s1++;
+	}
+	return 0;
+}
+EXPORT_SYMBOL_NOVERS(strstr);
+
+/**
+ * memchr - Find a character in an area of memory.
+ * @s: The memory area
+ * @c: The byte to search for
+ * @n: The size of the area.
+ *
+ * returns the address of the first occurrence of @c, or %NULL
+ * if @c is not found
+ */
+void *memchr(const void *s, int c, size_t n)
+{
+	register int r0 asm("0") = (char) c;
+	const void *ret = s + n;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b\n"
+		      "   jl	1f\n"
+		      "   la    %0,0\n"
+		      "1:"
+		      : "+a" (ret), "+&a" (s) : "d" (r0) : "cc" );
+	return (void *) ret;
+}
+EXPORT_SYMBOL_NOVERS(memchr);
+
+/**
+ * memcmp - Compare two areas of memory
+ * @cs: One area of memory
+ * @ct: Another area of memory
+ * @count: The size of the area.
+ */
+int memcmp(const void *cs, const void *ct, size_t n)
+{
+	register unsigned long r2 asm("2") = (unsigned long) cs;
+	register unsigned long r3 asm("3") = (unsigned long) n;
+	register unsigned long r4 asm("4") = (unsigned long) ct;
+	register unsigned long r5 asm("5") = (unsigned long) n;
+	int ret;
+
+	asm volatile ("0: clcle %1,%3,0\n"
+		      "   jo    0b\n"
+		      "   ipm   %0\n"
+		      "   srl   %0,28"
+		      : "=&d" (ret), "+a" (r2), "+a" (r3), "+a" (r4), "+a" (r5)
+		      : : "cc" );
+	if (ret)
+		ret = *(char *) r2 - *(char *) r4;
+	return ret;
+}
+EXPORT_SYMBOL_NOVERS(memcmp);
+
+/**
+ * memscan - Find a character in an area of memory.
+ * @s: The memory area
+ * @c: The byte to search for
+ * @n: The size of the area.
+ *
+ * returns the address of the first occurrence of @c, or 1 byte past
+ * the area if @c is not found
+ */
+void *memscan(void *s, int c, size_t n)
+{
+	register int r0 asm("0") = (char) c;
+	const void *ret = s + n;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b\n"
+		      : "+a" (ret), "+&a" (s) : "d" (r0) : "cc" );
+	return (void *) ret;
+}
+EXPORT_SYMBOL_NOVERS(memscan);
+
+/**
+ * memcpy - Copy one area of memory to another
+ * @dest: Where to copy to
+ * @src: Where to copy from
+ * @n: The size of the area.
+ *
+ * returns a pointer to @dest
+ */
+void *memcpy(void *dest, const void *src, size_t n)
+{
+	return __builtin_memcpy(dest, src, n);
+}
+EXPORT_SYMBOL_NOVERS(memcpy);
+
+/**
+ * bcopy - Copy one area of memory to another
+ * @src: Where to copy from
+ * @dest: Where to copy to
+ * @n: The size of the area.
+ *
+ * Note that this is the same as memcpy(), with the arguments reversed.
+ * memcpy() is the standard, bcopy() is a legacy BSD function.
+ */
+void bcopy(const void *srcp, void *destp, size_t n)
+{
+	__builtin_memcpy(destp, srcp, n);
+}
+EXPORT_SYMBOL_NOVERS(bcopy);
+
+/**
+ * memset - Fill a region of memory with the given value
+ * @s: Pointer to the start of the area.
+ * @c: The byte to fill the area with
+ * @n: The size of the area.
+ *
+ * returns a pointer to @s
+ */
+void *memset(void *s, int c, size_t n)
+{
+	char *xs;
+
+	if (c == 0)
+		return __builtin_memset(s, 0, n);
+
+	xs = (char *) s;
+	if (n > 0)
+		do {
+			*xs++ = c;
+		} while (--n > 0);
+	return s;
+}
+EXPORT_SYMBOL_NOVERS(memset);
+
+/*
+ * missing exports for string functions defined in lib/string.c
+ */
+EXPORT_SYMBOL_NOVERS(memmove);
+EXPORT_SYMBOL_NOVERS(strchr);
+EXPORT_SYMBOL_NOVERS(strnchr);
+EXPORT_SYMBOL_NOVERS(strncmp);
+EXPORT_SYMBOL_NOVERS(strpbrk);
diff -Nru a/arch/s390/lib/strncpy.S b/arch/s390/lib/strncpy.S
--- a/arch/s390/lib/strncpy.S	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,35 +0,0 @@
-/*
- *  arch/s390/kernel/strncpy.S
- *    S390 strncpy routine
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-/*
- * R2 = address of destination
- * R3 = address of source string
- * R4 = max number of bytes to copy
- */
-        .globl   strncpy
-strncpy:
-        LR      1,2            # don't touch address in R2
-	LTR     4,4
-        JZ      strncpy_exit   # 0 bytes -> nothing to do
-	SR      0,0
-strncpy_loop:
-        ICM     0,1,0(3)       # ICM sets the cc, IC does not
-	LA      3,1(3)
-        STC     0,0(1)
-	LA      1,1(1)
-        JZ      strncpy_pad    # ICM inserted a 0x00
-        BRCT    4,strncpy_loop # R4 -= 1, jump to strncpy_loop if >  0
-strncpy_exit:
-        BR      14
-strncpy_clear:
-	STC	0,0(1)
-	LA	1,1(1)
-strncpy_pad:
-	BRCT	4,strncpy_clear
-	BR	14
diff -Nru a/arch/s390/lib/strncpy64.S b/arch/s390/lib/strncpy64.S
--- a/arch/s390/lib/strncpy64.S	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,35 +0,0 @@
-/*
- *  arch/s390/kernel/strncpy.S
- *    S390 strncpy routine
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-/*
- * R2 = address of destination
- * R3 = address of source string
- * R4 = max number of bytes to copy
- */
-        .globl   strncpy
-strncpy:
-        LGR     1,2            # don't touch address in R2
-	LTR     4,4
-        JZ      strncpy_exit   # 0 bytes -> nothing to do
-	SGR     0,0
-strncpy_loop:
-        ICM     0,1,0(3)       # ICM sets the cc, IC does not
-	LA      3,1(3)
-        STC     0,0(1)
-	LA      1,1(1)
-        JZ      strncpy_pad    # ICM inserted a 0x00
-        BRCTG   4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0
-strncpy_exit:
-        BR      14
-strncpy_clear:
-	STC	0,0(1)
-	LA	1,1(1)
-strncpy_pad:
-	BRCTG	4,strncpy_clear
-	BR	14
diff -Nru a/arch/s390/lib/uaccess.S b/arch/s390/lib/uaccess.S
--- a/arch/s390/lib/uaccess.S	Tue Jun 15 22:20:42 2004
+++ b/arch/s390/lib/uaccess.S	Tue Jun 15 22:20:42 2004
@@ -154,46 +154,57 @@
         .align 4
         .text
         .globl __strncpy_from_user_asm
-	# %r2 = dst, %r3 = src, %r4 = count
+	# %r2 = count, %r3 = dst, %r4 = src
 __strncpy_from_user_asm:
 	lhi	%r0,0
-	lhi	%r1,1
-	lhi	%r5,0
-0:	mvcp	0(%r1,%r2),0(%r3),%r0
-	tm	0(%r2),0xff
-	jz	1f
-	la	%r2,1(%r2)
-	la	%r3,1(%r3)
-	ahi	%r5,1
-	clr	%r5,%r4
-	jl	0b
-1:	lr	%r2,%r5
+	lr	%r1,%r4
+	la	%r4,0(%r4)	# clear high order bit from %r4
+	la	%r2,0(%r2,%r4)	# %r2 points to first byte after string
+	sacf	256
+0:	srst	%r2,%r1
+	jo	0b
+	sacf	0
+	lr	%r1,%r2
+	jh	1f		# \0 found in string ?
+	ahi	%r1,1		# include \0 in copy
+1:	slr	%r1,%r4		# %r1 = copy length (without \0)
+	slr	%r2,%r4		# %r2 = return length (including \0)
+2:	mvcp	0(%r1,%r3),0(%r4),%r0
+	jnz	3f
 	br	%r14
-2:	lhi	%r2,-EFAULT
+3:	la	%r3,256(%r3)
+	la	%r4,256(%r4)
+	ahi	%r1,-256
+	mvcp	0(%r1,%r3),0(%r4),%r0
+	jnz	3b
 	br	%r14
-        .section __ex_table,"a"
-	.long	0b,2b
+4:	sacf	0
+	lhi	%r2,-EFAULT
+	br	%r14
+	.section __ex_table,"a"
+	.long	0b,4b
 	.previous
 
         .align 4
         .text
         .globl __strnlen_user_asm
-	# %r2 = src, %r3 = count
+	# %r2 = count, %r3 = src
 __strnlen_user_asm:
 	lhi	%r0,0
-	lhi	%r1,1
-	lhi	%r5,0
-0:	mvcp	24(%r1,%r15),0(%r2),%r0
-	ahi	%r5,1
-	tm	24(%r15),0xff
-	jz	1f
-	la	%r2,1(%r2)
-	clr	%r5,%r3
-	jl	0b
-1:	lr	%r2,%r5
+	lr	%r1,%r3
+	la	%r3,0(%r3)	# clear high order bit from %r4
+	la	%r2,0(%r2,%r3)	# %r2 points to first byte after string
+	sacf	256
+0:	srst	%r2,%r1
+	jo	0b
+	sacf	0
+	jh	1f		# \0 found in string ?
+	ahi	%r2,1		# strnlen_user result includes the \0
+1:	slr	%r2,%r3
 	br	%r14
-2:	lhi	%r2,-EFAULT
+2:	sacf	0
+	lhi	%r2,-EFAULT
 	br	%r14
-        .section __ex_table,"a"
+	.section __ex_table,"a"
 	.long	0b,2b
 	.previous
diff -Nru a/arch/s390/lib/uaccess64.S b/arch/s390/lib/uaccess64.S
--- a/arch/s390/lib/uaccess64.S	Tue Jun 15 22:20:44 2004
+++ b/arch/s390/lib/uaccess64.S	Tue Jun 15 22:20:44 2004
@@ -152,46 +152,55 @@
         .align 4
         .text
         .globl __strncpy_from_user_asm
-	# %r2 = dst, %r3 = src, %r4 = count
+	# %r2 = count, %r3 = dst, %r4 = src
 __strncpy_from_user_asm:
 	lghi	%r0,0
-	lghi	%r1,1
-	lghi	%r5,0
-0:	mvcp	0(%r1,%r2),0(%r3),%r0
-	tm	0(%r2),0xff
-	jz	1f
-	la	%r2,1(%r2)
-	la	%r3,1(%r3)
-	aghi	%r5,1
-	clgr	%r5,%r4
-	jl	0b
-1:	lgr	%r2,%r5
+	lgr	%r1,%r4
+	la	%r2,0(%r2,%r4)	# %r2 points to first byte after string
+	sacf	256
+0:	srst	%r2,%r1
+	jo	0b
+	sacf	0
+	lgr	%r1,%r2
+	jh	1f		# \0 found in string ?
+	aghi	%r1,1		# include \0 in copy
+1:	slgr	%r1,%r4		# %r1 = copy length (without \0)
+	slgr	%r2,%r4		# %r2 = return length (including \0)
+2:	mvcp	0(%r1,%r3),0(%r4),%r0
+	jnz	3f
 	br	%r14
-2:	lghi	%r2,-EFAULT
+3:	la	%r3,256(%r3)
+	la	%r4,256(%r4)
+	aghi	%r1,-256
+	mvcp	0(%r1,%r3),0(%r4),%r0
+	jnz	3b
 	br	%r14
-        .section __ex_table,"a"
-	.quad	0b,2b
+4:	sacf	0
+	lghi	%r2,-EFAULT
+	br	%r14
+	.section __ex_table,"a"
+	.quad	0b,4b
 	.previous
 
         .align 4
         .text
         .globl __strnlen_user_asm
-	# %r2 = src, %r3 = count
+	# %r2 = count, %r3 = src
 __strnlen_user_asm:
 	lghi	%r0,0
-	lghi	%r1,1
-	lghi	%r5,0
-0:	mvcp	24(%r1,%r15),0(%r2),%r0
-	aghi	%r5,1
-	tm	24(%r15),0xff
-	jz	1f
-	la	%r2,1(%r2)
-	clgr	%r5,%r3
-	jl	0b
-1:	lgr	%r2,%r5
+	lgr	%r1,%r3
+	la	%r2,0(%r2,%r3)	# %r2 points to first byte after string
+	sacf	256
+0:	srst	%r2,%r1
+	jo	0b
+	sacf	0
+	jh	1f		# \0 found in string ?
+	aghi	%r2,1		# strnlen_user result includes the \0
+1:	slgr	%r2,%r3
 	br	%r14
-2:	lghi	%r2,-EFAULT
+2:	sacf	0
+	lghi	%r2,-EFAULT
 	br	%r14
-        .section __ex_table,"a"
+	.section __ex_table,"a"
 	.quad	0b,2b
 	.previous
diff -Nru a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
--- a/arch/s390/mm/extmem.c	Tue Jun 15 22:20:43 2004
+++ b/arch/s390/mm/extmem.c	Tue Jun 15 22:20:43 2004
@@ -55,7 +55,9 @@
 
 static spinlock_t dcss_lock = SPIN_LOCK_UNLOCKED;
 static struct list_head dcss_list = LIST_HEAD_INIT(dcss_list);
-extern struct {unsigned long addr, size, type;} memory_chunk[16];
+extern struct {
+	unsigned long addr, size, type;
+} memory_chunk[MEMORY_CHUNKS];
 
 /*
  * Create the 8 bytes, ebcdic VM segment name from
@@ -258,16 +260,16 @@
                    shared segment */
                 dcss_diag_query(dcss_name, &rwattr, &shattr, &segstart, &segend);
 		/* does segment collide with main memory? */
-		for (i=0; i<16; i++) {
-					if (memory_chunk[i].type != 0)
-						continue;
-					if (memory_chunk[i].addr > segend)
-						continue;
-					if (memory_chunk[i].addr + memory_chunk[i].size <= segstart)
-						continue;
-					spin_unlock(&dcss_lock);
-				        return -ENOENT;
-				}
+		for (i=0; i < MEMORY_CHUNKS; i++) {
+			if (memory_chunk[i].type != 0)
+				continue;
+			if (memory_chunk[i].addr > segend)
+				continue;
+			if (memory_chunk[i].addr + memory_chunk[i].size <= segstart)
+				continue;
+			spin_unlock(&dcss_lock);
+			return -ENOENT;
+		}
 		/* or does it collide with other (loaded) segments? */
         	list_for_each(l, &dcss_list) {
                 	tmp = list_entry(l, struct dcss_segment, list);
diff -Nru a/arch/s390/mm/init.c b/arch/s390/mm/init.c
--- a/arch/s390/mm/init.c	Tue Jun 15 22:20:43 2004
+++ b/arch/s390/mm/init.c	Tue Jun 15 22:20:43 2004
@@ -69,7 +69,7 @@
                 else if (PageSwapCache(mem_map+i))
                         cached++;
                 else if (page_count(mem_map+i))
-                        shared += atomic_read(&mem_map[i].count) - 1;
+                        shared += page_count(mem_map+i) - 1;
         }
         printk("%d pages of RAM\n",total);
         printk("%d reserved pages\n",reserved);
diff -Nru a/arch/s390/mm/ioremap.c b/arch/s390/mm/ioremap.c
--- a/arch/s390/mm/ioremap.c	Tue Jun 15 22:20:37 2004
+++ b/arch/s390/mm/ioremap.c	Tue Jun 15 22:20:37 2004
@@ -134,5 +134,5 @@
 void iounmap(void *addr)
 {
 	if (addr > high_memory)
-		return vfree(addr);
+		vfree(addr);
 }
diff -Nru a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
--- a/arch/sh/boot/Makefile	Tue Jun 15 22:20:42 2004
+++ b/arch/sh/boot/Makefile	Tue Jun 15 22:20:42 2004
@@ -16,5 +16,5 @@
 	@echo 'Kernel: $@ is ready'
 
 $(obj)/compressed/vmlinux: FORCE
-	$(Q)$(MAKE) -f scripts/Makefile.build obj=$(obj)/compressed $@
+	$(Q)$(MAKE) $(build)=$(obj)/compressed $@
 
diff -Nru a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
--- a/arch/sh/kernel/process.c	Tue Jun 15 22:20:43 2004
+++ b/arch/sh/kernel/process.c	Tue Jun 15 22:20:43 2004
@@ -461,12 +461,6 @@
 	return error;
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long schedule_frame;
@@ -479,7 +473,7 @@
 	 * The same comment as on the Alpha applies here, too ...
 	 */
 	pc = thread_saved_pc(p);
-	if (pc >= first_sched && pc < last_sched) {
+	if (in_sched_functions(pc)) {
 		schedule_frame = ((unsigned long *)(long)p->thread.sp)[1];
 		return (unsigned long)((unsigned long *)schedule_frame)[1];
 	}
diff -Nru a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
--- a/arch/sh/kernel/smp.c	Tue Jun 15 22:20:40 2004
+++ b/arch/sh/kernel/smp.c	Tue Jun 15 22:20:40 2004
@@ -181,6 +181,9 @@
 	if (nr_cpus < 2)
 		return 0;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	spin_lock(&smp_fn_call.lock);
 
 	atomic_set(&smp_fn_call.finished, 0);
diff -Nru a/arch/sh/mm/hugetlbpage.c b/arch/sh/mm/hugetlbpage.c
--- a/arch/sh/mm/hugetlbpage.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sh/mm/hugetlbpage.c	Tue Jun 15 22:20:41 2004
@@ -248,8 +248,9 @@
 				goto out;
 			}
 			ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
-			unlock_page(page);
-			if (ret) {
+			if (! ret) {
+				unlock_page(page);
+			} else {
 				hugetlb_put_quota(mapping);
 				free_huge_page(page);
 				goto out;
diff -Nru a/arch/sparc/Makefile b/arch/sparc/Makefile
--- a/arch/sparc/Makefile	Tue Jun 15 22:20:37 2004
+++ b/arch/sparc/Makefile	Tue Jun 15 22:20:37 2004
@@ -13,6 +13,7 @@
 
 AS              := $(AS) -32
 LDFLAGS		:= -m elf32_sparc
+CHECK		:= $(CHECK) -D__sparc__=1
 
 #CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7
 CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
diff -Nru a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
--- a/arch/sparc/kernel/apc.c	Tue Jun 15 22:21:04 2004
+++ b/arch/sparc/kernel/apc.c	Tue Jun 15 22:21:04 2004
@@ -84,47 +84,44 @@
 }
 
 static int apc_ioctl(struct inode *inode, struct file *f, 
-		     unsigned int cmd, unsigned long arg)
+		     unsigned int cmd, unsigned long __arg)
 {
-	__u8 inarg;
+	__u8 inarg, __user *arg;
 
+	arg = (__u8 __user *) __arg;
 	switch (cmd) {
-		case APCIOCGFANCTL:
-			if(put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, (__u8*) arg)) {
+	case APCIOCGFANCTL:
+		if (put_user(apc_readb(APC_FANCTL_REG) & APC_REGMASK, arg))
 				return -EFAULT;
-			}
-			break;
-		case APCIOCGCPWR:
-			if(put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			break;
-		case APCIOCGBPORT:
-			if(put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			break;
+		break;
 
-		case APCIOCSFANCTL:
-			if(get_user(inarg, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
-			break;
-		case APCIOCSCPWR:
-			if(get_user(inarg, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
-			break;
-		case APCIOCSBPORT:
-			if(get_user(inarg, (__u8*) arg)) {
-				return -EFAULT;
-			}
-			apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
-			break;
-		default:
-			return -EINVAL;
+	case APCIOCGCPWR:
+		if (put_user(apc_readb(APC_CPOWER_REG) & APC_REGMASK, arg))
+			return -EFAULT;
+		break;
+
+	case APCIOCGBPORT:
+		if (put_user(apc_readb(APC_BPORT_REG) & APC_BPMASK, arg))
+			return -EFAULT;
+		break;
+
+	case APCIOCSFANCTL:
+		if (get_user(inarg, arg))
+			return -EFAULT;
+		apc_writeb(inarg & APC_REGMASK, APC_FANCTL_REG);
+		break;
+	case APCIOCSCPWR:
+		if (get_user(inarg, arg))
+			return -EFAULT;
+		apc_writeb(inarg & APC_REGMASK, APC_CPOWER_REG);
+		break;
+	case APCIOCSBPORT:
+		if (get_user(inarg, arg))
+			return -EFAULT;
+		apc_writeb(inarg & APC_BPMASK, APC_BPORT_REG);
+		break;
+	default:
+		return -EINVAL;
 	};
 
 	return 0;
diff -Nru a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
--- a/arch/sparc/kernel/ebus.c	Tue Jun 15 22:21:03 2004
+++ b/arch/sparc/kernel/ebus.c	Tue Jun 15 22:21:03 2004
@@ -238,7 +238,7 @@
 		child->bus = dev->bus;
 		fill_ebus_child(node, &regs[0], child);
 
-		while ((node = prom_getsibling(node))) {
+		while ((node = prom_getsibling(node)) != 0) {
 			child->next = (struct linux_ebus_child *)
 				ebus_alloc(sizeof(struct linux_ebus_child));
 
@@ -330,7 +330,7 @@
 		dev->bus = ebus;
 		fill_ebus_device(nd, dev);
 
-		while ((nd = prom_getsibling(nd))) {
+		while ((nd = prom_getsibling(nd)) != 0) {
 			dev->next = (struct linux_ebus_device *)
 				ebus_alloc(sizeof(struct linux_ebus_device));
 
diff -Nru a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c
--- a/arch/sparc/kernel/init_task.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc/kernel/init_task.c	Tue Jun 15 22:20:41 2004
@@ -22,6 +22,6 @@
  * in etrap.S which assumes it.
  */
 union thread_union init_thread_union
-	__attribute__((section (".text")))
+	__attribute__((section (".text,#alloc")))
 	__attribute__((aligned (THREAD_SIZE)))
 	= { INIT_THREAD_INFO(init_task) };
diff -Nru a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
--- a/arch/sparc/kernel/irq.c	Tue Jun 15 22:20:36 2004
+++ b/arch/sparc/kernel/irq.c	Tue Jun 15 22:20:36 2004
@@ -216,7 +216,8 @@
 	if (sparc_cpu_model == sun4d) {
 		extern void sun4d_free_irq(unsigned int, void *);
 		
-		return sun4d_free_irq(irq, dev_id);
+		sun4d_free_irq(irq, dev_id);
+		return;
 	}
 	cpu_irq = irq & (NR_IRQS - 1);
         if (cpu_irq > 14) {  /* 14 irq levels on the sparc */
diff -Nru a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c
--- a/arch/sparc/kernel/muldiv.c	Tue Jun 15 22:20:43 2004
+++ b/arch/sparc/kernel/muldiv.c	Tue Jun 15 22:20:43 2004
@@ -54,25 +54,25 @@
 	}
 }
 
-#define fetch_reg(reg, regs) ({							\
-	struct reg_window *win;							\
-	register unsigned long ret;						\
-										\
-	if (!(reg)) ret = 0;							\
-	else if((reg) < 16) {							\
-		ret = regs->u_regs[(reg)];					\
-	} else {								\
-		/* Ho hum, the slightly complicated case. */			\
-		win = (struct reg_window *)regs->u_regs[UREG_FP];		\
-		if (get_user (ret, &win->locals[(reg) - 16])) return -1;	\
-	}									\
-	ret;									\
+#define fetch_reg(reg, regs) ({						\
+	struct reg_window __user *win;					\
+	register unsigned long ret;					\
+									\
+	if (!(reg)) ret = 0;						\
+	else if ((reg) < 16) {						\
+		ret = regs->u_regs[(reg)];				\
+	} else {							\
+		/* Ho hum, the slightly complicated case. */		\
+		win = (struct reg_window __user *)regs->u_regs[UREG_FP];\
+		if (get_user (ret, &win->locals[(reg) - 16])) return -1;\
+	}								\
+	ret;								\
 })
 
 static inline int
 store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
 {
-	struct reg_window *win;
+	struct reg_window __user *win;
 
 	if (!reg)
 		return 0;
@@ -81,7 +81,7 @@
 		return 0;
 	} else {
 		/* need to use put_user() in this case: */
-		win = (struct reg_window *)regs->u_regs[UREG_FP];
+		win = (struct reg_window __user *) regs->u_regs[UREG_FP];
 		return (put_user(result, &win->locals[reg - 16]));
 	}
 }
@@ -89,23 +89,30 @@
 extern void handle_hw_divzero (struct pt_regs *regs, unsigned long pc,
 			       unsigned long npc, unsigned long psr);
 
-/* Should return 0 if mul/div emulation succeeded and SIGILL should not be issued */
+/* Should return 0 if mul/div emulation succeeded and SIGILL should
+ * not be issued.
+ */
 int do_user_muldiv(struct pt_regs *regs, unsigned long pc)
 {
 	unsigned int insn;
 	int inst;
 	unsigned int rs1, rs2, rdv;
 
-	if (!pc) return -1; /* This happens to often, I think */
-	if (get_user (insn, (unsigned int *)pc)) return -1;
-	if ((insn & 0xc1400000) != 0x80400000) return -1;
+	if (!pc)
+		return -1; /* This happens to often, I think */
+	if (get_user (insn, (unsigned int __user *)pc))
+		return -1;
+	if ((insn & 0xc1400000) != 0x80400000)
+		return -1;
 	inst = ((insn >> 19) & 0xf);
-	if ((inst & 0xe) != 10 && (inst & 0xe) != 14) return -1;
+	if ((inst & 0xe) != 10 && (inst & 0xe) != 14)
+		return -1;
+
 	/* Now we know we have to do something with umul, smul, udiv or sdiv */
 	rs1 = (insn >> 14) & 0x1f;
 	rs2 = insn & 0x1f;
 	rdv = (insn >> 25) & 0x1f;
-	if(has_imm13(insn)) {
+	if (has_imm13(insn)) {
 		maybe_flush_windows(rs1, 0, rdv);
 		rs2 = sign_extend_imm13(insn);
 	} else {
diff -Nru a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
--- a/arch/sparc/kernel/process.c	Tue Jun 15 22:20:37 2004
+++ b/arch/sparc/kernel/process.c	Tue Jun 15 22:20:37 2004
@@ -400,23 +400,30 @@
 	}
 }
 
-static __inline__ struct sparc_stackf *
-clone_stackframe(struct sparc_stackf *dst, struct sparc_stackf *src)
+static __inline__ struct sparc_stackf __user *
+clone_stackframe(struct sparc_stackf __user *dst,
+		 struct sparc_stackf __user *src)
 {
-	unsigned long size;
-	struct sparc_stackf *sp;
-
-	size = ((unsigned long)src->fp) - ((unsigned long)src);
-	sp = (struct sparc_stackf *)(((unsigned long)dst) - size); 
+	unsigned long size, fp;
+	struct sparc_stackf *tmp;
+	struct sparc_stackf __user *sp;
+
+	if (get_user(tmp, &src->fp))
+		return NULL;
+
+	fp = (unsigned long) tmp;
+	size = (fp - ((unsigned long) src));
+	fp = (unsigned long) dst;
+	sp = (struct sparc_stackf __user *)(fp - size); 
 
 	/* do_fork() grabs the parent semaphore, we must release it
 	 * temporarily so we can build the child clone stack frame
 	 * without deadlocking.
 	 */
-	if (copy_to_user(sp, src, size))
-		sp = (struct sparc_stackf *) 0;
-	else if (put_user(dst, &sp->fp))
-		sp = (struct sparc_stackf *) 0;
+	if (__copy_user(sp, src, size))
+		sp = NULL;
+	else if (put_user(fp, &sp->fp))
+		sp = NULL;
 
 	return sp;
 }
@@ -435,8 +442,8 @@
 
 	return do_fork(clone_flags, stack_start,
 		       regs, stack_size,
-		       (int *) parent_tid_ptr,
-		       (int *) child_tid_ptr);
+		       (int __user *) parent_tid_ptr,
+		       (int __user *) child_tid_ptr);
 }
 
 /* Copy a Sparc thread.  The fork() return value conventions
@@ -519,15 +526,17 @@
 		p->thread.current_ds = USER_DS;
 
 		if (sp != regs->u_regs[UREG_FP]) {
-			struct sparc_stackf *childstack;
-			struct sparc_stackf *parentstack;
+			struct sparc_stackf __user *childstack;
+			struct sparc_stackf __user *parentstack;
 
 			/*
 			 * This is a clone() call with supplied user stack.
 			 * Set some valid stack frames to give to the child.
 			 */
-			childstack = (struct sparc_stackf *) (sp & ~0x7UL);
-			parentstack = (struct sparc_stackf *) regs->u_regs[UREG_FP];
+			childstack = (struct sparc_stackf __user *)
+				(sp & ~0x7UL);
+			parentstack = (struct sparc_stackf __user *)
+				regs->u_regs[UREG_FP];
 
 #if 0
 			printk("clone: parent stack:\n");
@@ -654,12 +663,14 @@
 	if(regs->u_regs[UREG_G1] == 0)
 		base = 1;
 
-	filename = getname((char *)regs->u_regs[base + UREG_I0]);
+	filename = getname((char __user *)regs->u_regs[base + UREG_I0]);
 	error = PTR_ERR(filename);
 	if(IS_ERR(filename))
 		goto out;
-	error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1],
-			  (char **) regs->u_regs[base + UREG_I2], regs);
+	error = do_execve(filename,
+			  (char __user * __user *)regs->u_regs[base + UREG_I1],
+			  (char __user * __user *)regs->u_regs[base + UREG_I2],
+			  regs);
 	putname(filename);
 	if (error == 0)
 		current->ptrace &= ~PT_DTRACE;
@@ -679,25 +690,25 @@
 {
 	long retval;
 
-	__asm__ __volatile("mov %4, %%g2\n\t"    /* Set aside fn ptr... */
-			   "mov %5, %%g3\n\t"    /* and arg. */
-			   "mov %1, %%g1\n\t"
-			   "mov %2, %%o0\n\t"    /* Clone flags. */
-			   "mov 0, %%o1\n\t"     /* usp arg == 0 */
-			   "t 0x10\n\t"          /* Linux/Sparc clone(). */
-			   "cmp %%o1, 0\n\t"
-			   "be 1f\n\t"           /* The parent, just return. */
-			   " nop\n\t"            /* Delay slot. */
-			   "jmpl %%g2, %%o7\n\t" /* Call the function. */
-			   " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */
-			   "mov %3, %%g1\n\t"
-			   "t 0x10\n\t"          /* Linux/Sparc exit(). */
-			   /* Notreached by child. */
-			   "1: mov %%o0, %0\n\t" :
-			   "=r" (retval) :
-			   "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
-			   "i" (__NR_exit),  "r" (fn), "r" (arg) :
-			   "g1", "g2", "g3", "o0", "o1", "memory", "cc");
+	__asm__ __volatile__("mov %4, %%g2\n\t"    /* Set aside fn ptr... */
+			     "mov %5, %%g3\n\t"    /* and arg. */
+			     "mov %1, %%g1\n\t"
+			     "mov %2, %%o0\n\t"    /* Clone flags. */
+			     "mov 0, %%o1\n\t"     /* usp arg == 0 */
+			     "t 0x10\n\t"          /* Linux/Sparc clone(). */
+			     "cmp %%o1, 0\n\t"
+			     "be 1f\n\t"           /* The parent, just return. */
+			     " nop\n\t"            /* Delay slot. */
+			     "jmpl %%g2, %%o7\n\t" /* Call the function. */
+			     " mov %%g3, %%o0\n\t" /* Get back the arg in delay. */
+			     "mov %3, %%g1\n\t"
+			     "t 0x10\n\t"          /* Linux/Sparc exit(). */
+			     /* Notreached by child. */
+			     "1: mov %%o0, %0\n\t" :
+			     "=r" (retval) :
+			     "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
+			     "i" (__NR_exit),  "r" (fn), "r" (arg) :
+			     "g1", "g2", "g3", "o0", "o1", "memory", "cc");
 	return retval;
 }
 
@@ -721,8 +732,7 @@
 			break;
 		rw = (struct reg_window *) fp;
 		pc = rw->ins[7];
-		if (pc < ((unsigned long) scheduling_functions_start_here) ||
-                    pc >= ((unsigned long) scheduling_functions_end_here)) {
+		if (!in_sched_functions(pc)) {
 			ret = pc;
 			goto out;
 		}
diff -Nru a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
--- a/arch/sparc/kernel/ptrace.c	Tue Jun 15 22:21:05 2004
+++ b/arch/sparc/kernel/ptrace.c	Tue Jun 15 22:21:05 2004
@@ -50,8 +50,10 @@
 static void
 pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
 {
-	if(put_user(value, addr))
-		return pt_error_return(regs, EFAULT);
+	if (put_user(value, (long __user *) addr)) {
+		pt_error_return(regs, EFAULT);
+		return;
+	}
 	regs->u_regs[UREG_I0] = 0;
 	regs->psr &= ~PSR_C;
 	regs->pc = regs->npc;
@@ -368,7 +370,7 @@
 	}
 
 	case PTRACE_GETREGS: {
-		struct pt_regs *pregs = (struct pt_regs *) addr;
+		struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
 		struct pt_regs *cregs = child->thread.kregs;
 		int rval;
 
@@ -391,7 +393,7 @@
 	}
 
 	case PTRACE_SETREGS: {
-		struct pt_regs *pregs = (struct pt_regs *) addr;
+		struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
 		struct pt_regs *cregs = child->thread.kregs;
 		unsigned long psr, pc, npc, y;
 		int i;
@@ -433,7 +435,8 @@
 				unsigned long *insnaddr;
 				unsigned long insn;
 			} fpq[16];
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		int i;
 
 		i = verify_area(VERIFY_WRITE, fps, sizeof(struct fps));
@@ -467,7 +470,8 @@
 				unsigned long *insnaddr;
 				unsigned long insn;
 			} fpq[16];
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		int i;
 
 		i = verify_area(VERIFY_READ, fps, sizeof(struct fps));
@@ -489,7 +493,8 @@
 
 	case PTRACE_READTEXT:
 	case PTRACE_READDATA: {
-		int res = ptrace_readdata(child, addr, (void *) addr2, data);
+		int res = ptrace_readdata(child, addr,
+					  (void __user *) addr2, data);
 
 		if (res == data) {
 			pt_succ_return(regs, 0);
@@ -504,7 +509,8 @@
 
 	case PTRACE_WRITETEXT:
 	case PTRACE_WRITEDATA: {
-		int res = ptrace_writedata(child, (void *) addr2, addr, data);
+		int res = ptrace_writedata(child, (void __user *) addr2,
+					   addr, data);
 
 		if (res == data) {
 			pt_succ_return(regs, 0);
diff -Nru a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
--- a/arch/sparc/kernel/signal.c	Tue Jun 15 22:20:42 2004
+++ b/arch/sparc/kernel/signal.c	Tue Jun 15 22:20:42 2004
@@ -234,7 +234,7 @@
 	if (verify_area(VERIFY_READ, sf, sizeof(*sf)))
 		goto segv_and_exit;
 
-	if (((uint) sf) & 3)
+	if (((unsigned long) sf) & 3)
 		goto segv_and_exit;
 
 	err = __get_user(pc,  &sf->info.si_regs.pc);
@@ -289,8 +289,10 @@
 
 	synchronize_user_stack();
 
-	if (current->thread.new_signal)
-		return do_new_sigreturn(regs);
+	if (current->thread.new_signal) {
+		do_new_sigreturn(regs);
+		return;
+	}
 
 	scptr = (struct sigcontext __user *) regs->u_regs[UREG_I0];
 
@@ -347,6 +349,7 @@
 	struct rt_signal_frame __user *sf;
 	unsigned int psr, pc, npc;
 	__siginfo_fpu_t __user *fpu_save;
+	mm_segment_t old_fs;
 	sigset_t set;
 	stack_t st;
 	int err;
@@ -386,7 +389,10 @@
 	/* It is more difficult to avoid calling this function than to
 	 * call it and ignore errors.
 	 */
-	do_sigaltstack(&st, NULL, (unsigned long)sf);
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
+	set_fs(old_fs);
 
 	sigdelsetmask(&set, ~_BLOCKABLE);
 	spin_lock_irq(&current->sighand->siglock);
@@ -849,7 +855,7 @@
 
 	/* Arguments passed to signal handler */
 	if (regs->u_regs[14]){
-		struct reg_window *rw = (struct reg_window __user *)
+		struct reg_window __user *rw = (struct reg_window __user *)
 			regs->u_regs[14];
 
 		err |= __put_user(signr, &rw->ins[0]);
@@ -860,8 +866,8 @@
 			goto sigsegv;
 
 		regs->u_regs[UREG_I0] = signr;
-		regs->u_regs[UREG_I1] = (uint) si;
-		regs->u_regs[UREG_I2] = (uint) uc;
+		regs->u_regs[UREG_I1] = (unsigned long) si;
+		regs->u_regs[UREG_I2] = (unsigned long) uc;
 	}
 	return;
 
@@ -932,6 +938,7 @@
 {
 	svr4_gregset_t  __user *gr;
 	unsigned long pc, npc, psr;
+	mm_segment_t old_fs;
 	sigset_t set;
 	svr4_sigset_t setv;
 	int err;
@@ -945,7 +952,7 @@
 	if (current_thread_info()->w_saved)
 		goto sigsegv_and_return;
 
-	if (((uint) c) & 3)
+	if (((unsigned long) c) & 3)
 		goto sigsegv_and_return;
 
 	if (!__access_ok((unsigned long)c, sizeof(*c)))
@@ -977,7 +984,11 @@
 		
 	/* It is more difficult to avoid calling this function than to
 	   call it and ignore errors.  */
-	do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]);
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	do_sigaltstack((const stack_t __user *) &st, NULL,
+		       regs->u_regs[UREG_I6]);
+	set_fs(old_fs);
 	
 	set.sig[0] = setv.sigbits[0];
 	set.sig[1] = setv.sigbits[1];
diff -Nru a/arch/sparc/kernel/sunos_ioctl.c b/arch/sparc/kernel/sunos_ioctl.c
--- a/arch/sparc/kernel/sunos_ioctl.c	Tue Jun 15 22:21:02 2004
+++ b/arch/sparc/kernel/sunos_ioctl.c	Tue Jun 15 22:21:02 2004
@@ -41,18 +41,19 @@
 		goto out;
 
 	/* First handle an easy compat. case for tty ldisc. */
-	if(cmd == TIOCSETD) {
-		int *p, ntty = N_TTY, tmp;
+	if (cmd == TIOCSETD) {
+		int __user *p;
+		int ntty = N_TTY, tmp;
 		mm_segment_t oldfs;
 
-		p = (int *) arg;
+		p = (int __user *) arg;
 		ret = -EFAULT;
-		if(get_user(tmp, p))
+		if (get_user(tmp, p))
 			goto out;
-		if(tmp == 2) {
+		if (tmp == 2) {
 			oldfs = get_fs();
 			set_fs(KERNEL_DS);
-			ret = sys_ioctl(fd, cmd, (int) &ntty);
+			ret = sys_ioctl(fd, cmd, (unsigned long) &ntty);
 			set_fs(oldfs);
 			ret = (ret == -EINVAL ? -EOPNOTSUPP : ret);
 			goto out;
@@ -60,7 +61,7 @@
 	}
 
 	/* Binary compatibility is good American knowhow fuckin' up. */
-	if(cmd == TIOCNOTTY) {
+	if (cmd == TIOCNOTTY) {
 		ret = sys_setsid();
 		goto out;
 	}
@@ -176,39 +177,39 @@
 		goto out;
 	/* Non posix grp */
 	case _IOW('t', 118, int): {
-		int oldval, newval, *ptr;
+		int oldval, newval, __user *ptr;
 
 		cmd = TIOCSPGRP;
-		ptr = (int *) arg;
+		ptr = (int __user *) arg;
 		ret = -EFAULT;
-		if(get_user(oldval, ptr))
+		if (get_user(oldval, ptr))
 			goto out;
 		ret = sys_ioctl(fd, cmd, arg);
 		__get_user(newval, ptr);
-		if(newval == -1) {
+		if (newval == -1) {
 			__put_user(oldval, ptr);
 			ret = -EIO;
 		}
-		if(ret == -ENOTTY)
+		if (ret == -ENOTTY)
 			ret = -EIO;
 		goto out;
 	}
 
 	case _IOR('t', 119, int): {
-		int oldval, newval, *ptr;
+		int oldval, newval, __user *ptr;
 
 		cmd = TIOCGPGRP;
-		ptr = (int *) arg;
+		ptr = (int __user *) arg;
 		ret = -EFAULT;
-		if(get_user(oldval, ptr))
+		if (get_user(oldval, ptr))
 			goto out;
 		ret = sys_ioctl(fd, cmd, arg);
 		__get_user(newval, ptr);
-		if(newval == -1) {
+		if (newval == -1) {
 			__put_user(oldval, ptr);
 			ret = -EIO;
 		}
-		if(ret == -ENOTTY)
+		if (ret == -ENOTTY)
 			ret = -EIO;
 		goto out;
 	}
diff -Nru a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
--- a/arch/sparc/kernel/sys_sparc.c	Tue Jun 15 22:20:39 2004
+++ b/arch/sparc/kernel/sys_sparc.c	Tue Jun 15 22:20:39 2004
@@ -136,7 +136,8 @@
 			if (!ptr)
 				goto out;
 			err = -EFAULT;
-			if(get_user(fourth.__pad, (void __user **)ptr))
+			if (get_user(fourth.__pad,
+				     (void __user * __user *)ptr))
 				goto out;
 			err = sys_semctl (first, second, third, fourth);
 			goto out;
@@ -165,7 +166,9 @@
 				goto out;
 				}
 			case 1: default:
-				err = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
+				err = sys_msgrcv (first,
+						  (struct msgbuf __user *) ptr,
+						  second, fifth, third);
 				goto out;
 			}
 		case MSGGET:
@@ -194,7 +197,8 @@
 				goto out;
 				}
 			case 1:	/* iBCS2 emulator entry point */
-				err = do_shmat (first, (char __user *) ptr, second, (ulong __user *) third);
+				err = do_shmat (first, (char __user *) ptr,
+						second, (ulong *) third);
 				goto out;
 			}
 		case SHMDT: 
diff -Nru a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
--- a/arch/sparc/kernel/sys_sunos.c	Tue Jun 15 22:20:39 2004
+++ b/arch/sparc/kernel/sys_sunos.c	Tue Jun 15 22:20:39 2004
@@ -71,7 +71,7 @@
 	struct file * file = NULL;
 	unsigned long retval, ret_type;
 
-	if(flags & MAP_NORESERVE) {
+	if (flags & MAP_NORESERVE) {
 		static int cnt;
 		if (cnt++ < 10)
 			printk("%s: unimplemented SunOS MAP_NORESERVE mmap() flag\n",
@@ -79,7 +79,7 @@
 		flags &= ~MAP_NORESERVE;
 	}
 	retval = -EBADF;
-	if(!(flags & MAP_ANONYMOUS)) {
+	if (!(flags & MAP_ANONYMOUS)) {
 		if (fd >= SUNOS_NR_OPEN)
 			goto out;
 		file = fget(fd);
@@ -93,8 +93,8 @@
 	 * SunOS is so stupid some times... hmph!
 	 */
 	if (file) {
-		if(imajor(file->f_dentry->d_inode) == MEM_MAJOR &&
-		   iminor(file->f_dentry->d_inode) == 5) {
+		if (imajor(file->f_dentry->d_inode) == MEM_MAJOR &&
+		    iminor(file->f_dentry->d_inode) == 5) {
 			flags |= MAP_ANONYMOUS;
 			fput(file);
 			file = 0;
@@ -103,7 +103,7 @@
 	ret_type = flags & _MAP_NEW;
 	flags &= ~_MAP_NEW;
 
-	if(!(flags & MAP_FIXED))
+	if (!(flags & MAP_FIXED))
 		addr = 0;
 	else {
 		if (ARCH_SUN4C_SUN4 &&
@@ -122,7 +122,7 @@
 	down_write(&current->mm->mmap_sem);
 	retval = do_mmap(file, addr, len, prot, flags, off);
 	up_write(&current->mm->mmap_sem);
-	if(!ret_type)
+	if (!ret_type)
 		retval = ((retval < PAGE_OFFSET) ? 0 : retval);
 
 out_putf:
@@ -149,8 +149,8 @@
 	unsigned long newbrk, oldbrk;
 
 	down_write(&current->mm->mmap_sem);
-	if(ARCH_SUN4C_SUN4) {
-		if(brk >= 0x20000000 && brk < 0xe0000000) {
+	if (ARCH_SUN4C_SUN4) {
+		if (brk >= 0x20000000 && brk < 0xe0000000) {
 			goto out;
 		}
 	}
@@ -223,7 +223,7 @@
 	lock_kernel();
 	oldbrk = current->mm->brk;
 	error = sunos_brk(((int) current->mm->brk) + increment);
-	if(!error)
+	if (!error)
 		error = oldbrk;
 	unlock_kernel();
 	return error;
@@ -314,20 +314,20 @@
 };
 
 struct sunos_dirent_callback {
-    struct sunos_dirent *curr;
-    struct sunos_dirent *previous;
+    struct sunos_dirent __user *curr;
+    struct sunos_dirent __user *previous;
     int count;
     int error;
 };
 
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
 static int sunos_filldir(void * __buf, const char * name, int namlen,
 			 loff_t offset, ino_t ino, unsigned int d_type)
 {
-	struct sunos_dirent * dirent;
-	struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf;
+	struct sunos_dirent __user *dirent;
+	struct sunos_dirent_callback * buf = __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
 	buf->error = -EINVAL;	/* only used if we fail.. */
@@ -343,16 +343,16 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (void *)dirent + reclen;
+	dirent = (void __user *) dirent + reclen;
 	buf->curr = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int sunos_getdents(unsigned int fd, void * dirent, int cnt)
+asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt)
 {
 	struct file * file;
-	struct sunos_dirent * lastdirent;
+	struct sunos_dirent __user *lastdirent;
 	struct sunos_dirent_callback buf;
 	int error = -EBADF;
 
@@ -367,7 +367,7 @@
 	if (cnt < (sizeof(struct sunos_dirent) + 255))
 		goto out_putf;
 
-	buf.curr = (struct sunos_dirent *) dirent;
+	buf.curr = (struct sunos_dirent __user *) dirent;
 	buf.previous = NULL;
 	buf.count = cnt;
 	buf.error = 0;
@@ -398,8 +398,8 @@
 };
 
 struct sunos_direntry_callback {
-    struct sunos_direntry *curr;
-    struct sunos_direntry *previous;
+    struct sunos_direntry __user *curr;
+    struct sunos_direntry __user *previous;
     int count;
     int error;
 };
@@ -407,8 +407,8 @@
 static int sunos_filldirentry(void * __buf, const char * name, int namlen,
 			      loff_t offset, ino_t ino, unsigned int d_type)
 {
-	struct sunos_direntry * dirent;
-	struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf;
+	struct sunos_direntry __user *dirent;
+	struct sunos_direntry_callback *buf = __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
 	buf->error = -EINVAL;	/* only used if we fail.. */
@@ -422,16 +422,17 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (void *)dirent + reclen;
+	dirent = (void __user *) dirent + reclen;
 	buf->curr = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int sunos_getdirentries(unsigned int fd, void * dirent, int cnt, unsigned int *basep)
+asmlinkage int sunos_getdirentries(unsigned int fd, void __user *dirent,
+				   int cnt, unsigned int __user *basep)
 {
 	struct file * file;
-	struct sunos_direntry * lastdirent;
+	struct sunos_direntry __user *lastdirent;
 	struct sunos_direntry_callback buf;
 	int error = -EBADF;
 
@@ -443,10 +444,10 @@
 		goto out;
 
 	error = -EINVAL;
-	if(cnt < (sizeof(struct sunos_direntry) + 255))
+	if (cnt < (sizeof(struct sunos_direntry) + 255))
 		goto out_putf;
 
-	buf.curr = (struct sunos_direntry *) dirent;
+	buf.curr = (struct sunos_direntry __user *) dirent;
 	buf.previous = NULL;
 	buf.count = cnt;
 	buf.error = 0;
@@ -477,7 +478,7 @@
 	char mach[9];
 };
 
-asmlinkage int sunos_uname(struct sunos_utsname *name)
+asmlinkage int sunos_uname(struct sunos_utsname __user *name)
 {
 	int ret;
 	down_read(&uts_sem);
@@ -556,7 +557,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_pathconf(char *path, int name)
+asmlinkage int sunos_pathconf(char __user *path, int name)
 {
 	int ret;
 
@@ -566,7 +567,8 @@
 
 /* SunOS mount system call emulation */
 
-asmlinkage int sunos_select(int width, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp)
+asmlinkage int sunos_select(int width, fd_set __user *inp, fd_set __user *outp,
+			    fd_set __user *exp, struct timeval __user *tvp)
 {
 	int ret;
 
@@ -604,19 +606,19 @@
 };
 
 struct sunos_nfs_mount_args {
-	struct sockaddr_in  *addr; /* file server address */
-	struct nfs_fh *fh;     /* File handle to be mounted */
+	struct sockaddr_in  __user *addr; /* file server address */
+	struct nfs_fh __user *fh;     /* File handle to be mounted */
 	int        flags;      /* flags */
 	int        wsize;      /* write size in bytes */
 	int        rsize;      /* read size in bytes */
 	int        timeo;      /* initial timeout in .1 secs */
 	int        retrans;    /* times to retry send */
-	char       *hostname;  /* server's hostname */
+	char       __user *hostname;  /* server's hostname */
 	int        acregmin;   /* attr cache file min secs */
 	int        acregmax;   /* attr cache file max secs */
 	int        acdirmin;   /* attr cache dir min secs */
 	int        acdirmax;   /* attr cache dir max secs */
-	char       *netname;   /* server's netname */
+	char       __user *netname;   /* server's netname */
 };
 
 
@@ -680,7 +682,7 @@
 	return def_value;
 }
 
-static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
+static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data)
 {
 	int  server_fd, err;
 	char *the_name, *mount_page;
@@ -729,7 +731,7 @@
 	linux_nfs_mount.acdirmax = sunos_mount.acdirmax;
 
 	the_name = getname(sunos_mount.hostname);
-	if(IS_ERR(the_name))
+	if (IS_ERR(the_name))
 		return PTR_ERR(the_name);
 
 	strlcpy(linux_nfs_mount.hostname, the_name,
@@ -749,7 +751,7 @@
 }
 
 asmlinkage int
-sunos_mount(char *type, char *dir, int flags, void *data)
+sunos_mount(char __user *type, char __user *dir, int flags, void __user *data)
 {
 	int linux_flags = 0;
 	int ret = -EINVAL;
@@ -768,11 +770,11 @@
 	if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5))
 		goto out;
 
-	if(flags & SMNT_REMOUNT)
+	if (flags & SMNT_REMOUNT)
 		linux_flags |= MS_REMOUNT;
-	if(flags & SMNT_RDONLY)
+	if (flags & SMNT_RDONLY)
 		linux_flags |= MS_RDONLY;
-	if(flags & SMNT_NOSUID)
+	if (flags & SMNT_NOSUID)
 		linux_flags |= MS_NOSUID;
 
 	dir_page = getname(dir);
@@ -785,20 +787,20 @@
 	if (IS_ERR(type_page))
 		goto out1;
 
-	if(strcmp(type_page, "ext2") == 0) {
+	if (strcmp(type_page, "ext2") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "iso9660") == 0) {
+	} else if (strcmp(type_page, "iso9660") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "minix") == 0) {
+	} else if (strcmp(type_page, "minix") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "nfs") == 0) {
+	} else if (strcmp(type_page, "nfs") == 0) {
 		ret = sunos_nfs_mount (dir_page, flags, data);
 		goto out2;
-        } else if(strcmp(type_page, "ufs") == 0) {
+        } else if (strcmp(type_page, "ufs") == 0) {
 		printk("Warning: UFS filesystem mounts unsupported.\n");
 		ret = -ENODEV;
 		goto out2;
-	} else if(strcmp(type_page, "proc")) {
+	} else if (strcmp(type_page, "proc")) {
 		ret = -ENODEV;
 		goto out2;
 	}
@@ -823,8 +825,8 @@
 	int ret;
 
 	/* So stupid... */
-	if((!pid || pid == current->pid) &&
-	   !pgid) {
+	if ((!pid || pid == current->pid) &&
+	    !pgid) {
 		sys_setsid();
 		ret = 0;
 	} else {
@@ -834,7 +836,8 @@
 }
 
 /* So stupid... */
-asmlinkage int sunos_wait4(pid_t pid, unsigned int *stat_addr, int options, struct rusage *ru)
+asmlinkage int sunos_wait4(pid_t pid, unsigned int __user *stat_addr,
+			   int options, struct rusage __user*ru)
 {
 	int ret;
 
@@ -861,7 +864,7 @@
 	return -1;
 }
 
-extern asmlinkage unsigned long sunos_gethostid(void)
+asmlinkage unsigned long sunos_gethostid(void)
 {
 	unsigned long ret;
 
@@ -882,7 +885,7 @@
 #define   _SC_SAVED_IDS           7
 #define   _SC_VERSION             8
 
-extern asmlinkage long sunos_sysconf (int name)
+asmlinkage long sunos_sysconf (int name)
 {
 	long ret;
 
@@ -947,7 +950,8 @@
 			arg3=SETALL; break;
 		}
 		/* sys_semctl(): */
-		arg4.__pad=ptr; /* value to modify semaphore to */
+		/* value to modify semaphore to */
+		arg4.__pad = (void __user *) ptr;
 		ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4 );
 		break;
 	case 1:
@@ -956,7 +960,7 @@
 		break;
 	case 2:
 		/* sys_semop(): */
-		ret = sys_semop((int)arg1, (struct sembuf *)arg2, (unsigned)arg3);
+		ret = sys_semop((int)arg1, (struct sembuf __user *)arg2, (unsigned)arg3);
 		break;
 	default:
 		ret = -EINVAL;
@@ -978,18 +982,18 @@
 		break;
 	case 1:
 		rval = sys_msgctl((int)arg1, (int)arg2,
-				  (struct msqid_ds *)arg3);
+				  (struct msqid_ds __user *)arg3);
 		break;
 	case 2:
 		lock_kernel();
 		sp = (struct sparc_stackf *)current->thread.kregs->u_regs[UREG_FP];
 		arg5 = sp->xxargs[0];
 		unlock_kernel();
-		rval = sys_msgrcv((int)arg1, (struct msgbuf *)arg2,
+		rval = sys_msgrcv((int)arg1, (struct msgbuf __user *)arg2,
 				  (size_t)arg3, (long)arg4, (int)arg5);
 		break;
 	case 3:
-		rval = sys_msgsnd((int)arg1, (struct msgbuf *)arg2,
+		rval = sys_msgsnd((int)arg1, (struct msgbuf __user *)arg2,
 				  (size_t)arg3, (int)arg4);
 		break;
 	default:
@@ -1008,17 +1012,17 @@
 	switch(op) {
 	case 0:
 		/* do_shmat(): attach a shared memory area */
-		rval = do_shmat((int)arg1,(char *)arg2,(int)arg3,&raddr);
-		if(!rval)
+		rval = do_shmat((int)arg1,(char __user *)arg2,(int)arg3,&raddr);
+		if (!rval)
 			rval = (int) raddr;
 		break;
 	case 1:
 		/* sys_shmctl(): modify shared memory area attr. */
-		rval = sys_shmctl((int)arg1,(int)arg2,(struct shmid_ds *)arg3);
+		rval = sys_shmctl((int)arg1,(int)arg2,(struct shmid_ds __user *)arg3);
 		break;
 	case 2:
 		/* sys_shmdt(): detach a shared memory area */
-		rval = sys_shmdt((char *)arg1);
+		rval = sys_shmdt((char __user *)arg1);
 		break;
 	case 3:
 		/* sys_shmget(): get a shared memory area */
@@ -1051,7 +1055,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_read(unsigned int fd,char *buf,int count)
+asmlinkage int sunos_read(unsigned int fd, char __user *buf, int count)
 {
 	int ret;
 
@@ -1059,7 +1063,8 @@
 	return ret;
 }
 
-asmlinkage int sunos_readv(unsigned long fd, const struct iovec * vector, long count)
+asmlinkage int sunos_readv(unsigned long fd, const struct iovec __user *vector,
+			   long count)
 {
 	int ret;
 
@@ -1067,7 +1072,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_write(unsigned int fd,char *buf,int count)
+asmlinkage int sunos_write(unsigned int fd, char __user *buf, int count)
 {
 	int ret;
 
@@ -1075,7 +1080,8 @@
 	return ret;
 }
 
-asmlinkage int sunos_writev(unsigned long fd, const struct iovec * vector, long count)
+asmlinkage int sunos_writev(unsigned long fd,
+			    const struct iovec __user *vector, long count)
 {
 	int ret;
 
@@ -1083,7 +1089,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_recv(int fd, void * ubuf, int size, unsigned flags)
+asmlinkage int sunos_recv(int fd, void __user *ubuf, int size, unsigned flags)
 {
 	int ret;
 
@@ -1091,7 +1097,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_send(int fd, void * buff, int len, unsigned flags)
+asmlinkage int sunos_send(int fd, void __user *buff, int len, unsigned flags)
 {
 	int ret;
 
@@ -1099,7 +1105,8 @@
 	return ret;
 }
 
-asmlinkage int sunos_accept(int fd, struct sockaddr *sa, int *addrlen)
+asmlinkage int sunos_accept(int fd, struct sockaddr __user *sa,
+			    int __user *addrlen)
 {
 	int ret;
 
@@ -1115,13 +1122,13 @@
 #define SUNOS_SV_INTERRUPT 2
 
 asmlinkage int
-sunos_sigaction(int sig, const struct old_sigaction *act,
-		struct old_sigaction *oact)
+sunos_sigaction(int sig, const struct old_sigaction __user *act,
+		struct old_sigaction __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
 
-	if(act) {
+	if (act) {
 		old_sigset_t mask;
 
 		if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
@@ -1156,8 +1163,8 @@
 }
 
 
-asmlinkage int sunos_setsockopt(int fd, int level, int optname, char *optval,
-				int optlen)
+asmlinkage int sunos_setsockopt(int fd, int level, int optname,
+				char __user *optval, int optlen)
 {
 	int tr_opt = optname;
 	int ret;
@@ -1171,8 +1178,8 @@
 	return ret;
 }
 
-asmlinkage int sunos_getsockopt(int fd, int level, int optname, char *optval,
-				int *optlen)
+asmlinkage int sunos_getsockopt(int fd, int level, int optname,
+				char __user *optval, int __user *optlen)
 {
 	int tr_opt = optname;
 	int ret;
diff -Nru a/arch/sparc/kernel/unaligned.c b/arch/sparc/kernel/unaligned.c
--- a/arch/sparc/kernel/unaligned.c	Tue Jun 15 22:20:44 2004
+++ b/arch/sparc/kernel/unaligned.c	Tue Jun 15 22:20:44 2004
@@ -109,14 +109,14 @@
 
 static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs)
 {
-	struct reg_window *win;
+	struct reg_window __user *win;
 	unsigned long ret;
 
-	if(reg < 16)
+	if (reg < 16)
 		return (!reg ? 0 : regs->u_regs[reg]);
 
 	/* Ho hum, the slightly complicated case. */
-	win = (struct reg_window *) regs->u_regs[UREG_FP];
+	win = (struct reg_window __user *) regs->u_regs[UREG_FP];
 
 	if ((unsigned long)win & 3)
 		return -1;
@@ -137,8 +137,8 @@
 	return &win->locals[reg - 16];
 }
 
-static inline unsigned long compute_effective_address(struct pt_regs *regs,
-						      unsigned int insn)
+static unsigned long compute_effective_address(struct pt_regs *regs,
+					       unsigned int insn)
 {
 	unsigned int rs1 = (insn >> 14) & 0x1f;
 	unsigned int rs2 = insn & 0x1f;
@@ -153,8 +153,8 @@
 	}
 }
 
-static inline unsigned long safe_compute_effective_address(struct pt_regs *regs,
-							   unsigned int insn)
+unsigned long safe_compute_effective_address(struct pt_regs *regs,
+					     unsigned int insn)
 {
 	unsigned int rs1 = (insn >> 14) & 0x1f;
 	unsigned int rs2 = insn & 0x1f;
@@ -431,29 +431,32 @@
 	int retval, check = (dir == load) ? VERIFY_READ : VERIFY_WRITE;
 	int size = ((insn >> 19) & 3) == 3 ? 8 : 4;
 
-	if((regs->pc | regs->npc) & 3)
+	if ((regs->pc | regs->npc) & 3)
 		return 0;
 
 	/* Must verify_area() in all the necessary places. */
-#define WINREG_ADDR(regnum) ((void *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum)))
+#define WINREG_ADDR(regnum) \
+	((void __user *)(((unsigned long *)regs->u_regs[UREG_FP])+(regnum)))
+
 	retval = 0;
 	reg = (insn >> 25) & 0x1f;
-	if(reg >= 16) {
+	if (reg >= 16) {
 		retval = verify_area(check, WINREG_ADDR(reg - 16), size);
-		if(retval)
+		if (retval)
 			return retval;
 	}
 	reg = (insn >> 14) & 0x1f;
-	if(reg >= 16) {
+	if (reg >= 16) {
 		retval = verify_area(check, WINREG_ADDR(reg - 16), size);
-		if(retval)
+		if (retval)
 			return retval;
 	}
-	if(!(insn & 0x2000)) {
+	if (!(insn & 0x2000)) {
 		reg = (insn & 0x1f);
-		if(reg >= 16) {
-			retval = verify_area(check, WINREG_ADDR(reg - 16), size);
-			if(retval)
+		if (reg >= 16) {
+			retval = verify_area(check, WINREG_ADDR(reg - 16),
+					     size);
+			if (retval)
 				return retval;
 		}
 	}
diff -Nru a/arch/sparc/kernel/windows.c b/arch/sparc/kernel/windows.c
--- a/arch/sparc/kernel/windows.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc/kernel/windows.c	Tue Jun 15 22:20:41 2004
@@ -69,8 +69,8 @@
 		unsigned long sp = tp->rwbuf_stkptrs[window];
 
 		/* Ok, let it rip. */
-		if(copy_to_user((char *) sp, &tp->reg_window[window],
-				sizeof(struct reg_window)))
+		if (copy_to_user((char __user *) sp, &tp->reg_window[window],
+				 sizeof(struct reg_window)))
 			continue;
 
 		shift_window_buffer(window, tp->w_saved - 1, tp);
@@ -117,8 +117,9 @@
 	for(window = 0; window < tp->w_saved; window++) {
 		unsigned long sp = tp->rwbuf_stkptrs[window];
 
-		if((sp & 7) ||
-		   copy_to_user((char *) sp, &tp->reg_window[window], sizeof(struct reg_window)))
+		if ((sp & 7) ||
+		    copy_to_user((char __user *) sp, &tp->reg_window[window],
+				 sizeof(struct reg_window)))
 			do_exit(SIGILL);
 	}
 	tp->w_saved = 0;
diff -Nru a/arch/sparc/math-emu/math.c b/arch/sparc/math-emu/math.c
--- a/arch/sparc/math-emu/math.c	Tue Jun 15 22:20:40 2004
+++ b/arch/sparc/math-emu/math.c	Tue Jun 15 22:20:40 2004
@@ -175,7 +175,7 @@
 #ifdef DEBUG_MATHEMU
 		printk("precise trap at %08lx\n", regs->pc);
 #endif
-		if (!get_user(insn, (u32 *)regs->pc)) {
+		if (!get_user(insn, (u32 __user *) regs->pc)) {
 			retcode = do_one_mathemu(insn, &fpt->thread.fsr, fpt->thread.float_regs);
 			if (retcode) {
 				/* in this case we need to fix up PC & nPC */
@@ -193,7 +193,7 @@
 			break;
 	}
 	/* Now empty the queue and clear the queue_not_empty flag */
-	if(retcode)
+	if (retcode)
 		fpt->thread.fsr &= ~(0x3000 | FSR_CEXC_MASK);
 	else
 		fpt->thread.fsr &= ~0x3000;
@@ -219,18 +219,18 @@
 	would_trap = (fsr & ((long)eflag << FSR_TEM_SHIFT)) != 0UL;
 
 	/* If trapping, we only want to signal one bit. */
-	if(would_trap != 0) {
+	if (would_trap != 0) {
 		eflag &= ((fsr & FSR_TEM_MASK) >> FSR_TEM_SHIFT);
-		if((eflag & (eflag - 1)) != 0) {
-			if(eflag & FP_EX_INVALID)
+		if ((eflag & (eflag - 1)) != 0) {
+			if (eflag & FP_EX_INVALID)
 				eflag = FP_EX_INVALID;
-			else if(eflag & FP_EX_OVERFLOW)
+			else if (eflag & FP_EX_OVERFLOW)
 				eflag = FP_EX_OVERFLOW;
-			else if(eflag & FP_EX_UNDERFLOW)
+			else if (eflag & FP_EX_UNDERFLOW)
 				eflag = FP_EX_UNDERFLOW;
-			else if(eflag & FP_EX_DIVZERO)
+			else if (eflag & FP_EX_DIVZERO)
 				eflag = FP_EX_DIVZERO;
-			else if(eflag & FP_EX_INEXACT)
+			else if (eflag & FP_EX_INEXACT)
 				eflag = FP_EX_INEXACT;
 		}
 	}
@@ -250,11 +250,11 @@
 	 *    CEXC just generated is OR'd into the
 	 *    existing value of AEXC.
 	 */
-	if(would_trap == 0)
+	if (would_trap == 0)
 		fsr |= ((long)eflag << FSR_AEXC_SHIFT);
 
 	/* If trapping, indicate fault trap type IEEE. */
-	if(would_trap != 0)
+	if (would_trap != 0)
 		fsr |= (1UL << 14);
 
 	*pfsr = fsr;
@@ -515,7 +515,7 @@
 		case 7: FP_PACK_QP (rd, QR); break;
 		}
 	}
-	if(_fex == 0)
+	if (_fex == 0)
 		return 1;				/* success! */
 	return record_exception(pfsr, _fex);
 }
diff -Nru a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c
--- a/arch/sparc/mm/fault.c	Tue Jun 15 22:20:39 2004
+++ b/arch/sparc/mm/fault.c	Tue Jun 15 22:20:39 2004
@@ -201,6 +201,25 @@
 	return 0;
 }
 
+extern unsigned long safe_compute_effective_address(struct pt_regs *,
+						    unsigned int);
+
+static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
+{
+	unsigned int insn;
+
+	if (text_fault)
+		return regs->pc;
+
+	if (regs->psr & PSR_PS) {
+		insn = *(unsigned int *) regs->pc;
+	} else {
+		__get_user(insn, (unsigned int *) regs->pc);
+	}
+
+	return safe_compute_effective_address(regs, insn);
+}
+
 asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
 			       unsigned long address)
 {
@@ -307,7 +326,7 @@
 		info.si_errno = 0;
 		/* info.si_code set above to make clear whether
 		   this was a SEGV_MAPERR or SEGV_ACCERR fault.  */
-		info.si_addr = (void *)address;
+		info.si_addr = (void *) compute_si_addr(regs, text_fault);
 		info.si_trapno = 0;
 		force_sig_info (SIGSEGV, &info, tsk);
 		return;
@@ -361,7 +380,7 @@
 	info.si_signo = SIGBUS;
 	info.si_errno = 0;
 	info.si_code = BUS_ADRERR;
-	info.si_addr = (void *)address;
+	info.si_addr = (void *) compute_si_addr(regs, text_fault);
 	info.si_trapno = 0;
 	force_sig_info (SIGBUS, &info, tsk);
 	if (!from_user)
@@ -412,10 +431,10 @@
 		address = regs->pc;
 	} else if (!write &&
 		   !(regs->psr & PSR_PS)) {
-		unsigned int insn, *ip;
+		unsigned int insn, __user *ip;
 
-		ip = (unsigned int *)regs->pc;
-		if (! get_user(insn, ip)) {
+		ip = (unsigned int __user *)regs->pc;
+		if (!get_user(insn, ip)) {
 			if ((insn & 0xc1680000) == 0xc0680000)
 				write = 1;
 		}
@@ -530,7 +549,7 @@
 	info.si_errno = 0;
 	/* info.si_code set above to make clear whether
 	   this was a SEGV_MAPERR or SEGV_ACCERR fault.  */
-	info.si_addr = (void *)address;
+	info.si_addr = (void *) address;
 	info.si_trapno = 0;
 	force_sig_info (SIGSEGV, &info, tsk);
 	return;
@@ -540,7 +559,7 @@
 	info.si_signo = SIGBUS;
 	info.si_errno = 0;
 	info.si_code = BUS_ADRERR;
-	info.si_addr = (void *)address;
+	info.si_addr = (void *) address;
 	info.si_trapno = 0;
 	force_sig_info (SIGBUS, &info, tsk);
 }
diff -Nru a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
--- a/arch/sparc/mm/init.c	Tue Jun 15 22:20:39 2004
+++ b/arch/sparc/mm/init.c	Tue Jun 15 22:20:39 2004
@@ -388,7 +388,7 @@
 
 		ClearPageReserved(page);
 		set_bit(PG_highmem, &page->flags);
-		atomic_set(&page->count, 1);
+		set_page_count(page, 1);
 		__free_page(page);
 		totalhigh_pages++;
 	}
diff -Nru a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
--- a/arch/sparc/mm/srmmu.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc/mm/srmmu.c	Tue Jun 15 22:20:41 2004
@@ -174,7 +174,7 @@
 
 static inline void srmmu_pmd_clear(pmd_t *pmdp) {
 	int i;
-	for (i = 0; i < SRMMU_PTRS_PER_PTE_SOFT/SRMMU_PTRS_PER_PTE; i++)
+	for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++)
 		srmmu_set_pte((pte_t *)&pmdp->pmdv[i], __pte(0));
 }
 
@@ -234,9 +234,9 @@
 	int i;
 
 	ptp = __nocache_pa((unsigned long) ptep) >> 4;
-	for (i = 0; i < SRMMU_PTRS_PER_PTE_SOFT/SRMMU_PTRS_PER_PTE; i++) {
+	for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) {
 		srmmu_set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp);
-		ptp += (SRMMU_PTRS_PER_PTE*sizeof(pte_t) >> 4);
+		ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4);
 	}
 }
 
@@ -246,9 +246,9 @@
 	int i;
 
 	ptp = page_to_pfn(ptep) << (PAGE_SHIFT-4);	/* watch for overflow */
-	for (i = 0; i < SRMMU_PTRS_PER_PTE_SOFT/SRMMU_PTRS_PER_PTE; i++) {
+	for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) {
 		srmmu_set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp);
-		ptp += (SRMMU_PTRS_PER_PTE*sizeof(pte_t) >> 4);
+		ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4);
 	}
 }
 
@@ -263,7 +263,7 @@
 static inline pmd_t *srmmu_pmd_offset(pgd_t * dir, unsigned long address)
 {
 	return (pmd_t *) srmmu_pgd_page(*dir) +
-	    ((address >> SRMMU_PMD_SHIFT_SOFT) & (SRMMU_PTRS_PER_PMD_SOFT - 1));
+	    ((address >> PMD_SHIFT) & (PTRS_PER_PMD - 1));
 }
 
 /* Find an entry in the third-level page table.. */ 
@@ -273,7 +273,7 @@
 
 	pte = __nocache_va((dir->pmdv[0] & SRMMU_PTD_PMASK) << 4);
 	return (pte_t *) pte +
-	    ((address >> PAGE_SHIFT) & (SRMMU_PTRS_PER_PTE_SOFT - 1));
+	    ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
 }
 
 static unsigned long srmmu_swp_type(swp_entry_t entry)
@@ -487,7 +487,7 @@
 static pte_t *
 srmmu_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	return (pte_t *)srmmu_get_nocache(SRMMU_PTE_SZ_SOFT, SRMMU_PTE_SZ_SOFT);
+	return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
 }
 
 static struct page *
@@ -502,7 +502,7 @@
 
 static void srmmu_free_pte_fast(pte_t *pte)
 {
-	srmmu_free_nocache((unsigned long)pte, SRMMU_PTE_SZ_SOFT);
+	srmmu_free_nocache((unsigned long)pte, PTE_SIZE);
 }
 
 static void srmmu_pte_free(struct page *pte)
@@ -514,7 +514,7 @@
 		BUG();
 	p = page_to_pfn(pte) << PAGE_SHIFT;	/* Physical address */
 	p = (unsigned long) __nocache_va(p);	/* Nocached virtual */
-	srmmu_free_nocache(p, SRMMU_PTE_SZ_SOFT);
+	srmmu_free_nocache(p, PTE_SIZE);
 }
 
 /*
@@ -829,7 +829,7 @@
 	a = 0x20; b = 0x40; c = 0x60;
 	d = 0x80; e = 0xa0; f = 0xc0; g = 0xe0;
 
-	start &= SRMMU_PMD_MASK;
+	start &= SRMMU_REAL_PMD_MASK;
 	while(start < end) {
 		faddr = (start + (0x10000 - 0x100));
 		goto inside;
@@ -849,7 +849,7 @@
 					     "r" (a), "r" (b), "r" (c), "r" (d),
 					     "r" (e), "r" (f), "r" (g));
 		} while (faddr != start);
-		start += SRMMU_PMD_SIZE;
+		start += SRMMU_REAL_PMD_SIZE;
 	}
 	srmmu_set_context(octx);
 	local_irq_restore(flags);
@@ -1067,16 +1067,15 @@
 		}
 		pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start);
 		if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) {
-			ptep = (pte_t *)__srmmu_get_nocache(SRMMU_PTE_SZ_SOFT,
-			    SRMMU_PTE_SZ_SOFT);
+			ptep = (pte_t *)__srmmu_get_nocache(PTE_SIZE, PTE_SIZE);
 			if (ptep == NULL)
 				early_pgtable_allocfail("pte");
-			memset(__nocache_fix(ptep), 0, SRMMU_PTE_SZ_SOFT);
+			memset(__nocache_fix(ptep), 0, PTE_SIZE);
 			srmmu_pmd_set(__nocache_fix(pmdp), ptep);
 		}
-		if (start > (0xffffffffUL - SRMMU_PMD_SIZE_SOFT))
+		if (start > (0xffffffffUL - PMD_SIZE))
 			break;
-		start = (start + SRMMU_PMD_SIZE_SOFT) & SRMMU_PMD_MASK_SOFT;
+		start = (start + PMD_SIZE) & PMD_MASK;
 	}
 }
 
@@ -1097,16 +1096,16 @@
 		}
 		pmdp = srmmu_pmd_offset(pgdp, start);
 		if(srmmu_pmd_none(*pmdp)) {
-			ptep = (pte_t *) __srmmu_get_nocache(SRMMU_PTE_SZ_SOFT,
-			    SRMMU_PTE_SZ_SOFT);
+			ptep = (pte_t *) __srmmu_get_nocache(PTE_SIZE,
+							     PTE_SIZE);
 			if (ptep == NULL)
 				early_pgtable_allocfail("pte");
-			memset(ptep, 0, SRMMU_PTE_SZ_SOFT);
+			memset(ptep, 0, PTE_SIZE);
 			srmmu_pmd_set(pmdp, ptep);
 		}
-		if (start > (0xffffffffUL - SRMMU_PMD_SIZE_SOFT))
+		if (start > (0xffffffffUL - PMD_SIZE))
 			break;
-		start = (start + SRMMU_PMD_SIZE_SOFT) & SRMMU_PMD_MASK_SOFT;
+		start = (start + PMD_SIZE) & PMD_MASK;
 	}
 }
 
@@ -1136,8 +1135,8 @@
 		/* A red snapper, see what it really is. */
 		what = 0;
     
-		if(!(start & ~(SRMMU_PMD_MASK))) {
-			if(srmmu_hwprobe((start-PAGE_SIZE) + SRMMU_PMD_SIZE) == prompte)
+		if(!(start & ~(SRMMU_REAL_PMD_MASK))) {
+			if(srmmu_hwprobe((start-PAGE_SIZE) + SRMMU_REAL_PMD_SIZE) == prompte)
 				what = 1;
 		}
     
@@ -1162,11 +1161,11 @@
 		}
 		pmdp = srmmu_pmd_offset(__nocache_fix(pgdp), start);
 		if(srmmu_pmd_none(*(pmd_t *)__nocache_fix(pmdp))) {
-			ptep = (pte_t *) __srmmu_get_nocache(SRMMU_PTE_SZ_SOFT,
-			    SRMMU_PTE_SZ_SOFT);
+			ptep = (pte_t *) __srmmu_get_nocache(PTE_SIZE,
+							     PTE_SIZE);
 			if (ptep == NULL)
 				early_pgtable_allocfail("pte");
-			memset(__nocache_fix(ptep), 0, SRMMU_PTE_SZ_SOFT);
+			memset(__nocache_fix(ptep), 0, PTE_SIZE);
 			srmmu_pmd_set(__nocache_fix(pmdp), ptep);
 		}
 		if(what == 1) {
@@ -1176,9 +1175,9 @@
 			 * good hardware PTE piece. Alternatives seem worse.
 			 */
 			unsigned int x;	/* Index of HW PMD in soft cluster */
-			x = (start >> SRMMU_PMD_SHIFT) & 15;
+			x = (start >> PMD_SHIFT) & 15;
 			*(unsigned long *)__nocache_fix(&pmdp->pmdv[x]) = prompte;
-			start += SRMMU_PMD_SIZE;
+			start += SRMMU_REAL_PMD_SIZE;
 			continue;
 		}
 		ptep = srmmu_pte_offset(__nocache_fix(pmdp), start);
@@ -2139,16 +2138,11 @@
 	extern void ld_mmu_iounit(void);
 	extern void ___xchg32_sun4md(void);
 
-	BTFIXUPSET_SIMM13(pmd_shift, SRMMU_PMD_SHIFT_SOFT);
-	BTFIXUPSET_SETHI(pmd_size, SRMMU_PMD_SIZE_SOFT);
-	BTFIXUPSET_SETHI(pmd_mask, SRMMU_PMD_MASK_SOFT);
-
 	BTFIXUPSET_SIMM13(pgdir_shift, SRMMU_PGDIR_SHIFT);
 	BTFIXUPSET_SETHI(pgdir_size, SRMMU_PGDIR_SIZE);
 	BTFIXUPSET_SETHI(pgdir_mask, SRMMU_PGDIR_MASK);
 
-	BTFIXUPSET_SIMM13(ptrs_per_pte, SRMMU_PTRS_PER_PTE_SOFT);
-	BTFIXUPSET_SIMM13(ptrs_per_pmd, SRMMU_PTRS_PER_PMD_SOFT);
+	BTFIXUPSET_SIMM13(ptrs_per_pmd, SRMMU_PTRS_PER_PMD);
 	BTFIXUPSET_SIMM13(ptrs_per_pgd, SRMMU_PTRS_PER_PGD);
 
 	BTFIXUPSET_INT(page_none, pgprot_val(SRMMU_PAGE_NONE));
diff -Nru a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
--- a/arch/sparc/mm/sun4c.c	Tue Jun 15 22:20:43 2004
+++ b/arch/sparc/mm/sun4c.c	Tue Jun 15 22:20:43 2004
@@ -2137,14 +2137,10 @@
 	printk("Loading sun4c MMU routines\n");
 
 	/* First the constants */
-	BTFIXUPSET_SIMM13(pmd_shift, SUN4C_PMD_SHIFT);
-	BTFIXUPSET_SETHI(pmd_size, SUN4C_PMD_SIZE);
-	BTFIXUPSET_SETHI(pmd_mask, SUN4C_PMD_MASK);
 	BTFIXUPSET_SIMM13(pgdir_shift, SUN4C_PGDIR_SHIFT);
 	BTFIXUPSET_SETHI(pgdir_size, SUN4C_PGDIR_SIZE);
 	BTFIXUPSET_SETHI(pgdir_mask, SUN4C_PGDIR_MASK);
 
-	BTFIXUPSET_SIMM13(ptrs_per_pte, SUN4C_PTRS_PER_PTE);
 	BTFIXUPSET_SIMM13(ptrs_per_pmd, SUN4C_PTRS_PER_PMD);
 	BTFIXUPSET_SIMM13(ptrs_per_pgd, SUN4C_PTRS_PER_PGD);
 	BTFIXUPSET_SIMM13(user_ptrs_per_pgd, KERNBASE / SUN4C_PGDIR_SIZE);
diff -Nru a/arch/sparc/prom/memory.c b/arch/sparc/prom/memory.c
--- a/arch/sparc/prom/memory.c	Tue Jun 15 22:21:05 2004
+++ b/arch/sparc/prom/memory.c	Tue Jun 15 22:21:05 2004
@@ -156,7 +156,7 @@
 			prom_prom_taken[iter].num_bytes =
 				(unsigned long) prom_reg_memlist[iter].reg_size;
 			prom_prom_taken[iter].theres_more =
-				&prom_phys_total[iter+1];
+				&prom_prom_taken[iter+1];
 		}
 		prom_prom_taken[iter-1].theres_more = 0x0;
 
diff -Nru a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
--- a/arch/sparc64/Kconfig	Tue Jun 15 22:20:44 2004
+++ b/arch/sparc64/Kconfig	Tue Jun 15 22:20:44 2004
@@ -130,7 +130,7 @@
 	int "Maximum number of CPUs (2-64)"
 	range 2 64
 	depends on SMP
-	default "64"
+	default "32"
 
 config CPU_FREQ
 	bool "CPU Frequency scaling"
diff -Nru a/arch/sparc64/Makefile b/arch/sparc64/Makefile
--- a/arch/sparc64/Makefile	Tue Jun 15 22:21:04 2004
+++ b/arch/sparc64/Makefile	Tue Jun 15 22:21:04 2004
@@ -8,6 +8,8 @@
 # Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
 #
 
+CHECK		:= $(CHECK) -D__sparc__=1 -D__sparc_v9__=1
+
 AFLAGS_vmlinux.lds.o += -Usparc
 
 CC		:= $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo $(CC); else echo sparc64-linux-gcc; fi )
diff -Nru a/arch/sparc64/defconfig b/arch/sparc64/defconfig
--- a/arch/sparc64/defconfig	Tue Jun 15 22:20:38 2004
+++ b/arch/sparc64/defconfig	Tue Jun 15 22:20:38 2004
@@ -25,6 +25,7 @@
 # CONFIG_IKCONFIG is not set
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
@@ -119,6 +120,7 @@
 CONFIG_FB_PM2=y
 # CONFIG_FB_PM2_FIFO_DISCONNECT is not set
 # CONFIG_FB_CYBER2000 is not set
+# CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
 # CONFIG_FB_BW2 is not set
 # CONFIG_FB_CG3 is not set
@@ -231,7 +233,6 @@
 #
 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=m
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
@@ -277,6 +278,7 @@
 CONFIG_BLK_DEV_SLC90E66=m
 CONFIG_BLK_DEV_TRM290=m
 CONFIG_BLK_DEV_VIA82CXXX=m
+# CONFIG_IDE_ARM is not set
 CONFIG_BLK_DEV_IDEDMA=y
 # CONFIG_IDEDMA_IVB is not set
 CONFIG_IDEDMA_AUTO=y
@@ -302,7 +304,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
 
@@ -334,12 +335,12 @@
 CONFIG_SCSI_SATA_SVW=m
 CONFIG_SCSI_ATA_PIIX=m
 CONFIG_SCSI_SATA_PROMISE=m
+CONFIG_SCSI_SATA_SX4=m
 CONFIG_SCSI_SATA_SIL=m
 CONFIG_SCSI_SATA_SIS=m
 CONFIG_SCSI_SATA_VIA=m
 CONFIG_SCSI_SATA_VITESSE=m
 # CONFIG_SCSI_BUSLOGIC is not set
-# CONFIG_SCSI_CPQFCTS is not set
 CONFIG_SCSI_DMX3191D=m
 # CONFIG_SCSI_EATA is not set
 CONFIG_SCSI_EATA_PIO=m
@@ -356,6 +357,9 @@
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
 # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
+CONFIG_SCSI_IPR=m
+# CONFIG_SCSI_IPR_TRACE is not set
+# CONFIG_SCSI_IPR_DUMP is not set
 CONFIG_SCSI_QLOGIC_ISP=m
 CONFIG_SCSI_QLOGIC_FC=y
 CONFIG_SCSI_QLOGIC_FC_FIRMWARE=y
@@ -1072,7 +1076,6 @@
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 CONFIG_INPUT_MISC=y
-# CONFIG_INPUT_PCSPKR is not set
 CONFIG_INPUT_SPARCSPKR=y
 # CONFIG_INPUT_UINPUT is not set
 
@@ -1128,6 +1131,7 @@
 CONFIG_SENSORS_LM83=m
 CONFIG_SENSORS_LM85=m
 CONFIG_SENSORS_LM90=m
+CONFIG_SENSORS_MAX1619=m
 CONFIG_SENSORS_VIA686A=m
 CONFIG_SENSORS_W83781D=m
 CONFIG_SENSORS_W83L785TS=m
@@ -1139,6 +1143,7 @@
 CONFIG_SENSORS_EEPROM=m
 CONFIG_SENSORS_PCF8574=m
 CONFIG_SENSORS_PCF8591=m
+CONFIG_SENSORS_RTC8564=m
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
@@ -1249,6 +1254,7 @@
 CONFIG_SMB_FS=m
 # CONFIG_SMB_NLS_DEFAULT is not set
 CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
 CONFIG_NCP_FS=m
 # CONFIG_NCPFS_PACKET_SIGNING is not set
 # CONFIG_NCPFS_IOCTL_LOCKING is not set
@@ -1260,7 +1266,6 @@
 # CONFIG_NCPFS_EXTRAS is not set
 CONFIG_CODA_FS=m
 # CONFIG_CODA_FS_OLD_API is not set
-CONFIG_INTERMEZZO_FS=m
 CONFIG_AFS_FS=m
 CONFIG_RXRPC=m
 
@@ -1420,7 +1425,6 @@
 # Advanced Linux Sound Architecture
 #
 CONFIG_SND=m
-CONFIG_SND_BIT32_EMUL=m
 CONFIG_SND_TIMER=m
 CONFIG_SND_PCM=m
 CONFIG_SND_HWDEP=m
@@ -1431,6 +1435,7 @@
 CONFIG_SND_MIXER_OSS=m
 CONFIG_SND_PCM_OSS=m
 CONFIG_SND_SEQUENCER_OSS=y
+CONFIG_SND_BIT32_EMUL=m
 # CONFIG_SND_RTCTIMER is not set
 # CONFIG_SND_VERBOSE_PRINTK is not set
 # CONFIG_SND_DEBUG is not set
@@ -1560,6 +1565,7 @@
 CONFIG_USB_KBTAB=m
 # CONFIG_USB_POWERMATE is not set
 CONFIG_USB_MTOUCH=m
+CONFIG_USB_EGALAX=m
 # CONFIG_USB_XPAD is not set
 CONFIG_USB_ATI_REMOTE=m
 
@@ -1579,6 +1585,7 @@
 # CONFIG_USB_IBMCAM is not set
 # CONFIG_USB_KONICAWC is not set
 # CONFIG_USB_OV511 is not set
+CONFIG_USB_PWC=m
 # CONFIG_USB_SE401 is not set
 # CONFIG_USB_STV680 is not set
 CONFIG_USB_W9968CF=m
@@ -1671,6 +1678,7 @@
 CONFIG_USB_LED=m
 CONFIG_USB_CYTHERM=m
 CONFIG_USB_SPEEDTOUCH=m
+CONFIG_USB_PHIDGETSERVO=m
 CONFIG_USB_TEST=m
 
 #
diff -Nru a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c
--- a/arch/sparc64/kernel/binfmt_aout32.c	Tue Jun 15 22:20:40 2004
+++ b/arch/sparc64/kernel/binfmt_aout32.c	Tue Jun 15 22:20:40 2004
@@ -147,7 +147,6 @@
  * memory and creates the pointer tables from them, and puts their
  * addresses on the "stack", returning the new stack pointer value.
  */
-#define A(__x) ((unsigned long)(__x))
 
 static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm)
 {
@@ -171,7 +170,7 @@
 	current->mm->arg_start = (unsigned long) p;
 	while (argc-->0) {
 		char c;
-		put_user(((u32)A(p)),argv++);
+		put_user(((u32)(unsigned long)(p)),argv++);
 		do {
 			get_user(c,p++);
 		} while (c);
@@ -180,7 +179,7 @@
 	current->mm->arg_end = current->mm->env_start = (unsigned long) p;
 	while (envc-->0) {
 		char c;
-		put_user(((u32)A(p)),envp++);
+		put_user(((u32)(unsigned long)(p)),envp++);
 		do {
 			get_user(c,p++);
 		} while (c);
diff -Nru a/arch/sparc64/kernel/chmc.c b/arch/sparc64/kernel/chmc.c
--- a/arch/sparc64/kernel/chmc.c	Tue Jun 15 22:20:38 2004
+++ b/arch/sparc64/kernel/chmc.c	Tue Jun 15 22:20:38 2004
@@ -243,8 +243,9 @@
 static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset)
 {
 	unsigned long ret;
+	int this_cpu = get_cpu();
 
-	if (mp->portid == smp_processor_id()) {
+	if (mp->portid == this_cpu) {
 		__asm__ __volatile__("ldxa	[%1] %2, %0"
 				     : "=r" (ret)
 				     : "r" (offset), "i" (ASI_MCU_CTRL_REG));
@@ -254,6 +255,8 @@
 				     : "r" (mp->regs + offset),
 				       "i" (ASI_PHYS_BYPASS_EC_E));
 	}
+	put_cpu();
+
 	return ret;
 }
 
diff -Nru a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c
--- a/arch/sparc64/kernel/ebus.c	Tue Jun 15 22:20:38 2004
+++ b/arch/sparc64/kernel/ebus.c	Tue Jun 15 22:20:38 2004
@@ -509,7 +509,7 @@
 		fill_ebus_child(node, &regs[0],
 				child, child_regs_nonstandard(dev));
 
-		while ((node = prom_getsibling(node))) {
+		while ((node = prom_getsibling(node)) != 0) {
 			child->next = ebus_alloc(sizeof(struct linux_ebus_child));
 
 			child = child->next;
@@ -611,7 +611,7 @@
 		dev->bus = ebus;
 		fill_ebus_device(nd, dev);
 
-		while ((nd = prom_getsibling(nd))) {
+		while ((nd = prom_getsibling(nd)) != 0) {
 			dev->next = ebus_alloc(sizeof(struct linux_ebus_device));
 
 			dev = dev->next;
diff -Nru a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
--- a/arch/sparc64/kernel/entry.S	Tue Jun 15 22:20:35 2004
+++ b/arch/sparc64/kernel/entry.S	Tue Jun 15 22:20:35 2004
@@ -1697,12 +1697,12 @@
 	 add		%sp, PTREGS_OFF, %o0
 	srl		%i0, 0, %o0
 #endif
-	mov		%i4, %o4				! IEU1
+	srl		%i4, 0, %o4				! IEU1
 	lduw		[%l7 + %l4], %l7			! Load
 	srl		%i1, 0, %o1				! IEU0	Group
 	ldx		[%curptr + TI_FLAGS], %l0		! Load
 
-	mov		%i5, %o5				! IEU1
+	srl		%i5, 0, %o5				! IEU1
 	srl		%i2, 0, %o2				! IEU0	Group
 	andcc		%l0, _TIF_SYSCALL_TRACE, %g0		! IEU0	Group
 	bne,pn		%icc, linux_syscall_trace32		! CTI
diff -Nru a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
--- a/arch/sparc64/kernel/ioctl32.c	Tue Jun 15 22:20:58 2004
+++ b/arch/sparc64/kernel/ioctl32.c	Tue Jun 15 22:20:58 2004
@@ -60,11 +60,11 @@
 	u32 r, g, b;
 	mm_segment_t old_fs = get_fs();
 	
-	ret = get_user(f.index, &(((struct fbcmap32 *)arg)->index));
-	ret |= __get_user(f.count, &(((struct fbcmap32 *)arg)->count));
-	ret |= __get_user(r, &(((struct fbcmap32 *)arg)->red));
-	ret |= __get_user(g, &(((struct fbcmap32 *)arg)->green));
-	ret |= __get_user(b, &(((struct fbcmap32 *)arg)->blue));
+	ret = get_user(f.index, &(((struct fbcmap32 __user *)arg)->index));
+	ret |= __get_user(f.count, &(((struct fbcmap32 __user *)arg)->count));
+	ret |= __get_user(r, &(((struct fbcmap32 __user *)arg)->red));
+	ret |= __get_user(g, &(((struct fbcmap32 __user *)arg)->green));
+	ret |= __get_user(b, &(((struct fbcmap32 __user *)arg)->blue));
 	if (ret)
 		return -EFAULT;
 	if ((f.index < 0) || (f.index > 255)) return -EINVAL;
@@ -113,16 +113,21 @@
 	u32 m, i;
 	mm_segment_t old_fs = get_fs();
 	
-	ret = copy_from_user (&f, (struct fbcursor32 *)arg, 2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
-	ret |= __get_user(f.size.x, &(((struct fbcursor32 *)arg)->size.x));
-	ret |= __get_user(f.size.y, &(((struct fbcursor32 *)arg)->size.y));
-	ret |= __get_user(f.cmap.index, &(((struct fbcursor32 *)arg)->cmap.index));
-	ret |= __get_user(f.cmap.count, &(((struct fbcursor32 *)arg)->cmap.count));
-	ret |= __get_user(r, &(((struct fbcursor32 *)arg)->cmap.red));
-	ret |= __get_user(g, &(((struct fbcursor32 *)arg)->cmap.green));
-	ret |= __get_user(b, &(((struct fbcursor32 *)arg)->cmap.blue));
-	ret |= __get_user(m, &(((struct fbcursor32 *)arg)->mask));
-	ret |= __get_user(i, &(((struct fbcursor32 *)arg)->image));
+	ret = copy_from_user (&f, (struct fbcursor32 __user *) arg,
+			      2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
+	ret |= __get_user(f.size.x,
+			  &(((struct fbcursor32 __user *)arg)->size.x));
+	ret |= __get_user(f.size.y,
+			  &(((struct fbcursor32 __user *)arg)->size.y));
+	ret |= __get_user(f.cmap.index,
+			  &(((struct fbcursor32 __user *)arg)->cmap.index));
+	ret |= __get_user(f.cmap.count,
+			  &(((struct fbcursor32 __user *)arg)->cmap.count));
+	ret |= __get_user(r, &(((struct fbcursor32 __user *)arg)->cmap.red));
+	ret |= __get_user(g, &(((struct fbcursor32 __user *)arg)->cmap.green));
+	ret |= __get_user(b, &(((struct fbcursor32 __user *)arg)->cmap.blue));
+	ret |= __get_user(m, &(((struct fbcursor32 __user *)arg)->mask));
+	ret |= __get_user(i, &(((struct fbcursor32 __user *)arg)->image));
 	if (ret)
 		return -EFAULT;
 	if (f.set & FB_CUR_SETCMAP) {
@@ -148,306 +153,6 @@
 	return ret;
 }
 
-struct ncp_ioctl_request_32 {
-	unsigned int function;
-	unsigned int size;
-	compat_caddr_t data;
-};
-
-struct ncp_fs_info_v2_32 {
-	int version;
-	unsigned int mounted_uid;
-	unsigned int connection;
-	unsigned int buffer_size;
-
-	unsigned int volume_number;
-	__u32 directory_id;
-
-	__u32 dummy1;
-	__u32 dummy2;
-	__u32 dummy3;
-};
-
-struct ncp_objectname_ioctl_32
-{
-	int		auth_type;
-	unsigned int	object_name_len;
-	compat_caddr_t	object_name;	/* an userspace data, in most cases user name */
-};
-
-struct ncp_privatedata_ioctl_32
-{
-	unsigned int	len;
-	compat_caddr_t	data;		/* ~1000 for NDS */
-};
-
-#define	NCP_IOC_NCPREQUEST_32		_IOR('n', 1, struct ncp_ioctl_request_32)
-
-#define NCP_IOC_GETMOUNTUID2_32		_IOW('n', 2, unsigned int)
-
-#define NCP_IOC_GET_FS_INFO_V2_32	_IOWR('n', 4, struct ncp_fs_info_v2_32)
-
-#define NCP_IOC_GETOBJECTNAME_32	_IOWR('n', 9, struct ncp_objectname_ioctl_32)
-#define NCP_IOC_SETOBJECTNAME_32	_IOR('n', 9, struct ncp_objectname_ioctl_32)
-#define NCP_IOC_GETPRIVATEDATA_32	_IOWR('n', 10, struct ncp_privatedata_ioctl_32)
-#define NCP_IOC_SETPRIVATEDATA_32	_IOR('n', 10, struct ncp_privatedata_ioctl_32)
-
-static int do_ncp_ncprequest(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_ioctl_request_32 n32;
-	struct ncp_ioctl_request n;
-	mm_segment_t old_fs;
-	int err;
-
-	if (copy_from_user(&n32, (struct ncp_ioctl_request_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.function = n32.function;
-	n.size = n32.size;
-	if (n.size > 65536)
-		return -EINVAL;
-	n.data = vmalloc(65536);	/* 65536 must be same as NCP_PACKET_SIZE_INTERNAL in ncpfs */
-	if (!n.data)
-		return -ENOMEM;
-	err = -EFAULT;
-	if (copy_from_user(n.data, A(n32.data), n.size))
-		goto out;
-
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_NCPREQUEST, (unsigned long)&n);
-	set_fs (old_fs);
-        if(err <= 0)
-		goto out;
-	if (err > 65536) {
-		err = -EINVAL;
-		goto out;
-	}
-	if (copy_to_user(A(n32.data), n.data, err)) {
-		err = -EFAULT;
-		goto out;
-	}
- out:
-	vfree(n.data);
-	return err;
-}
-
-static int do_ncp_getmountuid2(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	mm_segment_t old_fs = get_fs();
-	__kernel_uid_t kuid;
-	int err;
-
-	cmd = NCP_IOC_GETMOUNTUID2;
-
-	set_fs(KERNEL_DS);
-	err = sys_ioctl(fd, cmd, (unsigned long)&kuid);
-	set_fs(old_fs);
-
-	if (!err)
-		err = put_user(kuid, (unsigned int*)arg);
-
-	return err;
-}
-
-static int do_ncp_getfsinfo2(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	mm_segment_t old_fs = get_fs();
-	struct ncp_fs_info_v2_32 n32;
-	struct ncp_fs_info_v2 n;
-	int err;
-
-	if (copy_from_user(&n32, (struct ncp_fs_info_v2_32*)arg, sizeof(n32)))
-		return -EFAULT;
-	if (n32.version != NCP_GET_FS_INFO_VERSION_V2)
-		return -EINVAL;
-	n.version = NCP_GET_FS_INFO_VERSION_V2;
-
-	set_fs(KERNEL_DS);
-	err = sys_ioctl(fd, NCP_IOC_GET_FS_INFO_V2, (unsigned long)&n);
-	set_fs(old_fs);
-
-	if (!err) {
-		n32.version = n.version;
-		n32.mounted_uid = n.mounted_uid;
-		n32.connection = n.connection;
-		n32.buffer_size = n.buffer_size;
-		n32.volume_number = n.volume_number;
-		n32.directory_id = n.directory_id;
-		n32.dummy1 = n.dummy1;
-		n32.dummy2 = n.dummy2;
-		n32.dummy3 = n.dummy3;
-		err = copy_to_user((struct ncp_fs_info_v2_32*)arg, &n32, sizeof(n32)) ? -EFAULT : 0;
-	}
-	return err;
-}
-
-static int do_ncp_getobjectname(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_objectname_ioctl_32 n32;
-	struct ncp_objectname_ioctl n;
-	mm_segment_t old_fs;
-	int err;
-	size_t tl;
-
-	if (copy_from_user(&n32, (struct ncp_objectname_ioctl_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.object_name_len = tl = n32.object_name_len;
-	if (tl) {
-		n.object_name = kmalloc(tl, GFP_KERNEL);
-		if (!n.object_name)
-			return -ENOMEM;
-	} else {
-		n.object_name = NULL;
-	}
-
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_GETOBJECTNAME, (unsigned long)&n);
-	set_fs (old_fs);
-        if(err)
-		goto out;
-		
-	if (tl > n.object_name_len)
-		tl = n.object_name_len;
-
-	err = -EFAULT;
-	if (tl && copy_to_user(A(n32.object_name), n.object_name, tl))
-		goto out;
-
-	n32.auth_type = n.auth_type;
-	n32.object_name_len = n.object_name_len;
-	
-	if (copy_to_user((struct ncp_objectname_ioctl_32*)arg, &n32, sizeof(n32)))
-		goto out;
-	
-	err = 0;
- out:
- 	if (n.object_name)
-		kfree(n.object_name);
-
-	return err;
-}
-
-static int do_ncp_setobjectname(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_objectname_ioctl_32 n32;
-	struct ncp_objectname_ioctl n;
-	mm_segment_t old_fs;
-	int err;
-	size_t tl;
-
-	if (copy_from_user(&n32, (struct ncp_objectname_ioctl_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.auth_type = n32.auth_type;
-	n.object_name_len = tl = n32.object_name_len;
-	if (tl) {
-		n.object_name = kmalloc(tl, GFP_KERNEL);
-		if (!n.object_name)
-			return -ENOMEM;
-		err = -EFAULT;
-		if (copy_from_user(n.object_name, A(n32.object_name), tl))
-			goto out;
-	} else {
-		n.object_name = NULL;
-	}
-	
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_SETOBJECTNAME, (unsigned long)&n);
-	set_fs (old_fs);
-		
- out:
-	if (n.object_name)
-		kfree(n.object_name);
-
-	return err;
-}
-
-static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_privatedata_ioctl_32 n32;
-	struct ncp_privatedata_ioctl n;
-	mm_segment_t old_fs;
-	int err;
-	size_t tl;
-
-	if (copy_from_user(&n32, (struct ncp_privatedata_ioctl_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.len = tl = n32.len;
-	if (tl) {
-		n.data = kmalloc(tl, GFP_KERNEL);
-		if (!n.data)
-			return -ENOMEM;
-	} else {
-		n.data = NULL;
-	}
-
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_GETPRIVATEDATA, (unsigned long)&n);
-	set_fs (old_fs);
-        if(err)
-		goto out;
-		
-	if (tl > n.len)
-		tl = n.len;
-
-	err = -EFAULT;
-	if (tl && copy_to_user(A(n32.data), n.data, tl))
-		goto out;
-
-	n32.len = n.len;
-	
-	if (copy_to_user((struct ncp_privatedata_ioctl_32*)arg, &n32, sizeof(n32)))
-		goto out;
-	
-	err = 0;
- out:
- 	if (n.data)
-		kfree(n.data);
-
-	return err;
-}
-
-static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ncp_privatedata_ioctl_32 n32;
-	struct ncp_privatedata_ioctl n;
-	mm_segment_t old_fs;
-	int err;
-	size_t tl;
-
-	if (copy_from_user(&n32, (struct ncp_privatedata_ioctl_32*)arg,
-	    sizeof(n32)))
-		return -EFAULT;
-
-	n.len = tl = n32.len;
-	if (tl) {
-		n.data = kmalloc(tl, GFP_KERNEL);
-		if (!n.data)
-			return -ENOMEM;
-		err = -EFAULT;
-		if (copy_from_user(n.data, A(n32.data), tl))
-			goto out;
-	} else {
-		n.data = NULL;
-	}
-	
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, NCP_IOC_SETPRIVATEDATA, (unsigned long)&n);
-	set_fs (old_fs);
-		
- out:
-	if (n.data)
-		kfree(n.data);
-
-	return err;
-}
-
 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
 /* This really belongs in include/linux/drm.h -DaveM */
 #include "../../../drivers/char/drm/drm.h"
@@ -467,7 +172,7 @@
 
 static int drm32_version(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_version_t *uversion = (drm32_version_t *)arg;
+	drm32_version_t __user *uversion = (drm32_version_t __user *)arg;
 	char __user *name_ptr, *date_ptr, *desc_ptr;
 	u32 tmp1, tmp2, tmp3;
 	drm_version_t kversion;
@@ -545,7 +250,7 @@
 
 static int drm32_getsetunique(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_unique_t *uarg = (drm32_unique_t *)arg;
+	drm32_unique_t __user *uarg = (drm32_unique_t __user *)arg;
 	drm_unique_t karg;
 	mm_segment_t old_fs;
 	char __user *uptr;
@@ -609,7 +314,7 @@
 
 static int drm32_addmap(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_map_t *uarg = (drm32_map_t *) arg;
+	drm32_map_t __user *uarg = (drm32_map_t __user *) arg;
 	drm_map_t karg;
 	mm_segment_t old_fs;
 	u32 tmp;
@@ -624,7 +329,7 @@
 	if (ret)
 		return -EFAULT;
 
-	karg.handle = A(tmp);
+	karg.handle = (void *) (unsigned long) tmp;
 
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
@@ -654,7 +359,7 @@
 
 static int drm32_info_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_buf_info_t *uarg = (drm32_buf_info_t *)arg;
+	drm32_buf_info_t __user *uarg = (drm32_buf_info_t __user *)arg;
 	drm_buf_desc_t __user *ulist;
 	drm_buf_info_t karg;
 	mm_segment_t old_fs;
@@ -700,7 +405,7 @@
 
 static int drm32_free_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_buf_free_t *uarg = (drm32_buf_free_t *)arg;
+	drm32_buf_free_t __user *uarg = (drm32_buf_free_t __user *)arg;
 	drm_buf_free_t karg;
 	mm_segment_t old_fs;
 	int __user *ulist;
@@ -748,7 +453,7 @@
 
 static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_buf_map_t *uarg = (drm32_buf_map_t *)arg;
+	drm32_buf_map_t __user *uarg = (drm32_buf_map_t __user *)arg;
 	drm32_buf_pub_t __user *ulist;
 	drm_buf_map_t karg;
 	mm_segment_t old_fs;
@@ -760,7 +465,7 @@
 	    get_user(tmp2, &uarg->list))
 		return -EFAULT;
 
-	karg.virtual = A(tmp1);
+	karg.virtual = (void *) (unsigned long) tmp1;
 	ulist = A(tmp2);
 
 	orig_count = karg.count;
@@ -777,7 +482,7 @@
 		    get_user(tmp1, &ulist[i].address))
 			goto out;
 
-		karg.list[i].address = A(tmp1);
+		karg.list[i].address = (void *) (unsigned long) tmp1;
 	}
 
 	old_fs = get_fs();
@@ -827,7 +532,7 @@
  */
 static int drm32_dma(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_dma_t *uarg = (drm32_dma_t *) arg;
+	drm32_dma_t __user *uarg = (drm32_dma_t __user *) arg;
 	int __user *u_si, *u_ss, *u_ri, *u_rs;
 	drm_dma_t karg;
 	mm_segment_t old_fs;
@@ -937,7 +642,7 @@
 
 static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	drm32_ctx_res_t *uarg = (drm32_ctx_res_t *) arg;
+	drm32_ctx_res_t __user *uarg = (drm32_ctx_res_t __user *) arg;
 	drm_ctx_t __user *ulist;
 	drm_ctx_res_t karg;
 	mm_segment_t old_fs;
@@ -1070,18 +775,6 @@
 COMPATIBLE_IOCTL(AUDIO_GETDEV_SUNOS)
 COMPATIBLE_IOCTL(AUDIO_FLUSH)
 COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE_MULTI)
-/* NCP ioctls which do not need any translations */
-COMPATIBLE_IOCTL(NCP_IOC_CONN_LOGGED_IN)
-COMPATIBLE_IOCTL(NCP_IOC_SIGN_INIT)
-COMPATIBLE_IOCTL(NCP_IOC_SIGN_WANTED)
-COMPATIBLE_IOCTL(NCP_IOC_SET_SIGN_WANTED)
-COMPATIBLE_IOCTL(NCP_IOC_LOCKUNLOCK)
-COMPATIBLE_IOCTL(NCP_IOC_GETROOT)
-COMPATIBLE_IOCTL(NCP_IOC_SETROOT)
-COMPATIBLE_IOCTL(NCP_IOC_GETCHARSETS)
-COMPATIBLE_IOCTL(NCP_IOC_SETCHARSETS)
-COMPATIBLE_IOCTL(NCP_IOC_GETDENTRYTTL)
-COMPATIBLE_IOCTL(NCP_IOC_SETDENTRYTTL)
 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
 COMPATIBLE_IOCTL(DRM_IOCTL_GET_MAGIC)
 COMPATIBLE_IOCTL(DRM_IOCTL_IRQ_BUSID)
@@ -1107,14 +800,6 @@
 COMPATIBLE_IOCTL(WIOCSTOP)
 COMPATIBLE_IOCTL(WIOCGSTAT)
 /* And these ioctls need translation */
-/* NCPFS */
-HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
-HANDLE_IOCTL(NCP_IOC_GETMOUNTUID2_32, do_ncp_getmountuid2)
-HANDLE_IOCTL(NCP_IOC_GET_FS_INFO_V2_32, do_ncp_getfsinfo2)
-HANDLE_IOCTL(NCP_IOC_GETOBJECTNAME_32, do_ncp_getobjectname)
-HANDLE_IOCTL(NCP_IOC_SETOBJECTNAME_32, do_ncp_setobjectname)
-HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32, do_ncp_getprivatedata)
-HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata)
 /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
 HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
 HANDLE_IOCTL(FBIOGETCMAP32, fbiogetputcmap)
diff -Nru a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
--- a/arch/sparc64/kernel/irq.c	Tue Jun 15 22:21:02 2004
+++ b/arch/sparc64/kernel/irq.c	Tue Jun 15 22:21:02 2004
@@ -174,6 +174,8 @@
 	if (imap == 0UL)
 		return;
 
+	preempt_disable();
+
 	if (tlb_type == cheetah || tlb_type == cheetah_plus) {
 		unsigned long ver;
 
@@ -214,6 +216,8 @@
 	 * Things like FFB can now be handled via the new IRQ mechanism.
 	 */
 	upa_writel(tid | IMAP_VALID, imap);
+
+	preempt_enable();
 }
 
 /* This now gets passed true ino's as well. */
@@ -1164,7 +1168,7 @@
 
 #define HEX_DIGITS 16
 
-static unsigned int parse_hex_value (const char *buffer,
+static unsigned int parse_hex_value (const char __user *buffer,
 		unsigned long count, unsigned long *ret)
 {
 	unsigned char hexnum [HEX_DIGITS];
@@ -1233,7 +1237,7 @@
 	 */
 }
 
-static int irq_affinity_write_proc (struct file *file, const char *buffer,
+static int irq_affinity_write_proc (struct file *file, const char __user *buffer,
 					unsigned long count, void *data)
 {
 	int irq = (long) data, full_count = count, err;
diff -Nru a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c
--- a/arch/sparc64/kernel/module.c	Tue Jun 15 22:20:42 2004
+++ b/arch/sparc64/kernel/module.c	Tue Jun 15 22:20:42 2004
@@ -31,7 +31,7 @@
 		return;
 	}
 
-	for (p = &modvmlist ; (tmp = *p) ; p = &tmp->next) {
+	for (p = &modvmlist; (tmp = *p) != NULL; p = &tmp->next) {
 		if (tmp->addr == addr) {
 			*p = tmp->next;
 			goto found;
@@ -66,7 +66,7 @@
 		return NULL;
 		
 	addr = (void *) MODULES_VADDR;
-	for (p = &modvmlist; (tmp = *p) ; p = &tmp->next) {
+	for (p = &modvmlist; (tmp = *p) != NULL; p = &tmp->next) {
 		if (size + (unsigned long) addr < (unsigned long) tmp->addr)
 			break;
 		addr = (void *) (tmp->size + (unsigned long) tmp->addr);
diff -Nru a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
--- a/arch/sparc64/kernel/pci.c	Tue Jun 15 22:20:35 2004
+++ b/arch/sparc64/kernel/pci.c	Tue Jun 15 22:20:35 2004
@@ -7,6 +7,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/sched.h>
@@ -799,6 +800,7 @@
 
 	return ret;
 }
+EXPORT_SYMBOL(pci_domain_nr);
 
 int pci_name_bus(char *name, struct pci_bus *bus)
 {
diff -Nru a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
--- a/arch/sparc64/kernel/pci_psycho.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc64/kernel/pci_psycho.c	Tue Jun 15 22:20:41 2004
@@ -42,29 +42,29 @@
 
 /* Misc. PSYCHO PCI controller register offsets and definitions. */
 #define PSYCHO_CONTROL		0x0010UL
-#define  PSYCHO_CONTROL_IMPL	 0xf000000000000000 /* Implementation of this PSYCHO*/
-#define  PSYCHO_CONTROL_VER	 0x0f00000000000000 /* Version of this PSYCHO       */
-#define  PSYCHO_CONTROL_MID	 0x00f8000000000000 /* UPA Module ID of PSYCHO      */
-#define  PSYCHO_CONTROL_IGN	 0x0007c00000000000 /* Interrupt Group Number       */
-#define  PSYCHO_CONTROL_RESV     0x00003ffffffffff0 /* Reserved                     */
-#define  PSYCHO_CONTROL_APCKEN	 0x0000000000000008 /* Address Parity Check Enable  */
-#define  PSYCHO_CONTROL_APERR	 0x0000000000000004 /* Incoming System Addr Parerr  */
-#define  PSYCHO_CONTROL_IAP	 0x0000000000000002 /* Invert UPA Parity            */
-#define  PSYCHO_CONTROL_MODE	 0x0000000000000001 /* PSYCHO clock mode            */
+#define  PSYCHO_CONTROL_IMPL	 0xf000000000000000UL /* Implementation of this PSYCHO*/
+#define  PSYCHO_CONTROL_VER	 0x0f00000000000000UL /* Version of this PSYCHO       */
+#define  PSYCHO_CONTROL_MID	 0x00f8000000000000UL /* UPA Module ID of PSYCHO      */
+#define  PSYCHO_CONTROL_IGN	 0x0007c00000000000UL /* Interrupt Group Number       */
+#define  PSYCHO_CONTROL_RESV     0x00003ffffffffff0UL /* Reserved                     */
+#define  PSYCHO_CONTROL_APCKEN	 0x0000000000000008UL /* Address Parity Check Enable  */
+#define  PSYCHO_CONTROL_APERR	 0x0000000000000004UL /* Incoming System Addr Parerr  */
+#define  PSYCHO_CONTROL_IAP	 0x0000000000000002UL /* Invert UPA Parity            */
+#define  PSYCHO_CONTROL_MODE	 0x0000000000000001UL /* PSYCHO clock mode            */
 #define PSYCHO_PCIA_CTRL	0x2000UL
 #define PSYCHO_PCIB_CTRL	0x4000UL
-#define  PSYCHO_PCICTRL_RESV1	 0xfffffff000000000 /* Reserved                     */
-#define  PSYCHO_PCICTRL_SBH_ERR	 0x0000000800000000 /* Streaming byte hole error    */
-#define  PSYCHO_PCICTRL_SERR	 0x0000000400000000 /* SERR signal asserted         */
-#define  PSYCHO_PCICTRL_SPEED	 0x0000000200000000 /* PCI speed (1 is U2P clock)   */
-#define  PSYCHO_PCICTRL_RESV2	 0x00000001ffc00000 /* Reserved                     */
-#define  PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000 /* PCI arbitration parking      */
-#define  PSYCHO_PCICTRL_RESV3	 0x00000000001ff800 /* Reserved                     */
-#define  PSYCHO_PCICTRL_SBH_INT	 0x0000000000000400 /* Streaming byte hole int enab */
-#define  PSYCHO_PCICTRL_WEN	 0x0000000000000200 /* Power Mgmt Wake Enable       */
-#define  PSYCHO_PCICTRL_EEN	 0x0000000000000100 /* PCI Error Interrupt Enable   */
-#define  PSYCHO_PCICTRL_RESV4	 0x00000000000000c0 /* Reserved                     */
-#define  PSYCHO_PCICTRL_AEN	 0x000000000000003f /* PCI DVMA Arbitration Enable  */
+#define  PSYCHO_PCICTRL_RESV1	 0xfffffff000000000UL /* Reserved                     */
+#define  PSYCHO_PCICTRL_SBH_ERR	 0x0000000800000000UL /* Streaming byte hole error    */
+#define  PSYCHO_PCICTRL_SERR	 0x0000000400000000UL /* SERR signal asserted         */
+#define  PSYCHO_PCICTRL_SPEED	 0x0000000200000000UL /* PCI speed (1 is U2P clock)   */
+#define  PSYCHO_PCICTRL_RESV2	 0x00000001ffc00000UL /* Reserved                     */
+#define  PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000UL /* PCI arbitration parking      */
+#define  PSYCHO_PCICTRL_RESV3	 0x00000000001ff800UL /* Reserved                     */
+#define  PSYCHO_PCICTRL_SBH_INT	 0x0000000000000400UL /* Streaming byte hole int enab */
+#define  PSYCHO_PCICTRL_WEN	 0x0000000000000200UL /* Power Mgmt Wake Enable       */
+#define  PSYCHO_PCICTRL_EEN	 0x0000000000000100UL /* PCI Error Interrupt Enable   */
+#define  PSYCHO_PCICTRL_RESV4	 0x00000000000000c0UL /* Reserved                     */
+#define  PSYCHO_PCICTRL_AEN	 0x000000000000003fUL /* PCI DVMA Arbitration Enable  */
 
 /* U2P Programmer's Manual, page 13-55, configuration space
  * address format:
@@ -403,11 +403,11 @@
  */
 #define PSYCHO_STRBUF_CONTROL_A 0x2800UL
 #define PSYCHO_STRBUF_CONTROL_B 0x4800UL
-#define  PSYCHO_STRBUF_CTRL_LPTR    0x00000000000000f0 /* LRU Lock Pointer */
-#define  PSYCHO_STRBUF_CTRL_LENAB   0x0000000000000008 /* LRU Lock Enable */
-#define  PSYCHO_STRBUF_CTRL_RRDIS   0x0000000000000004 /* Rerun Disable */
-#define  PSYCHO_STRBUF_CTRL_DENAB   0x0000000000000002 /* Diagnostic Mode Enable */
-#define  PSYCHO_STRBUF_CTRL_ENAB    0x0000000000000001 /* Streaming Buffer Enable */
+#define  PSYCHO_STRBUF_CTRL_LPTR    0x00000000000000f0UL /* LRU Lock Pointer */
+#define  PSYCHO_STRBUF_CTRL_LENAB   0x0000000000000008UL /* LRU Lock Enable */
+#define  PSYCHO_STRBUF_CTRL_RRDIS   0x0000000000000004UL /* Rerun Disable */
+#define  PSYCHO_STRBUF_CTRL_DENAB   0x0000000000000002UL /* Diagnostic Mode Enable */
+#define  PSYCHO_STRBUF_CTRL_ENAB    0x0000000000000001UL /* Streaming Buffer Enable */
 #define PSYCHO_STRBUF_FLUSH_A   0x2808UL
 #define PSYCHO_STRBUF_FLUSH_B   0x4808UL
 #define PSYCHO_STRBUF_FSYNC_A   0x2810UL
@@ -416,22 +416,22 @@
 #define PSYCHO_STC_DATA_B	0xc000UL
 #define PSYCHO_STC_ERR_A	0xb400UL
 #define PSYCHO_STC_ERR_B	0xc400UL
-#define  PSYCHO_STCERR_WRITE	 0x0000000000000002	/* Write Error */
-#define  PSYCHO_STCERR_READ	 0x0000000000000001	/* Read Error */
+#define  PSYCHO_STCERR_WRITE	 0x0000000000000002UL	/* Write Error */
+#define  PSYCHO_STCERR_READ	 0x0000000000000001UL	/* Read Error */
 #define PSYCHO_STC_TAG_A	0xb800UL
 #define PSYCHO_STC_TAG_B	0xc800UL
-#define  PSYCHO_STCTAG_PPN	 0x0fffffff00000000	/* Physical Page Number */
-#define  PSYCHO_STCTAG_VPN	 0x00000000ffffe000	/* Virtual Page Number */
-#define  PSYCHO_STCTAG_VALID	 0x0000000000000002	/* Valid */
-#define  PSYCHO_STCTAG_WRITE	 0x0000000000000001	/* Writable */
+#define  PSYCHO_STCTAG_PPN	 0x0fffffff00000000UL	/* Physical Page Number */
+#define  PSYCHO_STCTAG_VPN	 0x00000000ffffe000UL	/* Virtual Page Number */
+#define  PSYCHO_STCTAG_VALID	 0x0000000000000002UL	/* Valid */
+#define  PSYCHO_STCTAG_WRITE	 0x0000000000000001UL	/* Writable */
 #define PSYCHO_STC_LINE_A	0xb900UL
 #define PSYCHO_STC_LINE_B	0xc900UL
-#define  PSYCHO_STCLINE_LINDX	 0x0000000001e00000	/* LRU Index */
-#define  PSYCHO_STCLINE_SPTR	 0x00000000001f8000	/* Dirty Data Start Pointer */
-#define  PSYCHO_STCLINE_LADDR	 0x0000000000007f00	/* Line Address */
-#define  PSYCHO_STCLINE_EPTR	 0x00000000000000fc	/* Dirty Data End Pointer */
-#define  PSYCHO_STCLINE_VALID	 0x0000000000000002	/* Valid */
-#define  PSYCHO_STCLINE_FOFN	 0x0000000000000001	/* Fetch Outstanding / Flush Necessary */
+#define  PSYCHO_STCLINE_LINDX	 0x0000000001e00000UL	/* LRU Index */
+#define  PSYCHO_STCLINE_SPTR	 0x00000000001f8000UL	/* Dirty Data Start Pointer */
+#define  PSYCHO_STCLINE_LADDR	 0x0000000000007f00UL	/* Line Address */
+#define  PSYCHO_STCLINE_EPTR	 0x00000000000000fcUL	/* Dirty Data End Pointer */
+#define  PSYCHO_STCLINE_VALID	 0x0000000000000002UL	/* Valid */
+#define  PSYCHO_STCLINE_FOFN	 0x0000000000000001UL	/* Fetch Outstanding / Flush Necessary */
 
 static spinlock_t stc_buf_lock = SPIN_LOCK_UNLOCKED;
 static unsigned long stc_error_buf[128];
@@ -555,24 +555,24 @@
  * interrogate the IOMMU state to see if it is the cause.
  */
 #define PSYCHO_IOMMU_CONTROL	0x0200UL
-#define  PSYCHO_IOMMU_CTRL_RESV     0xfffffffff9000000 /* Reserved                      */
-#define  PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000 /* Translation Error Status      */
-#define  PSYCHO_IOMMU_CTRL_XLTEERR  0x0000000001000000 /* Translation Error encountered */
-#define  PSYCHO_IOMMU_CTRL_LCKEN    0x0000000000800000 /* Enable translation locking    */
-#define  PSYCHO_IOMMU_CTRL_LCKPTR   0x0000000000780000 /* Translation lock pointer      */
-#define  PSYCHO_IOMMU_CTRL_TSBSZ    0x0000000000070000 /* TSB Size                      */
-#define  PSYCHO_IOMMU_TSBSZ_1K      0x0000000000000000 /* TSB Table 1024 8-byte entries */
-#define  PSYCHO_IOMMU_TSBSZ_2K      0x0000000000010000 /* TSB Table 2048 8-byte entries */
-#define  PSYCHO_IOMMU_TSBSZ_4K      0x0000000000020000 /* TSB Table 4096 8-byte entries */
-#define  PSYCHO_IOMMU_TSBSZ_8K      0x0000000000030000 /* TSB Table 8192 8-byte entries */
-#define  PSYCHO_IOMMU_TSBSZ_16K     0x0000000000040000 /* TSB Table 16k 8-byte entries  */
-#define  PSYCHO_IOMMU_TSBSZ_32K     0x0000000000050000 /* TSB Table 32k 8-byte entries  */
-#define  PSYCHO_IOMMU_TSBSZ_64K     0x0000000000060000 /* TSB Table 64k 8-byte entries  */
-#define  PSYCHO_IOMMU_TSBSZ_128K    0x0000000000070000 /* TSB Table 128k 8-byte entries */
-#define  PSYCHO_IOMMU_CTRL_RESV2    0x000000000000fff8 /* Reserved                      */
-#define  PSYCHO_IOMMU_CTRL_TBWSZ    0x0000000000000004 /* Assumed page size, 0=8k 1=64k */
-#define  PSYCHO_IOMMU_CTRL_DENAB    0x0000000000000002 /* Diagnostic mode enable        */
-#define  PSYCHO_IOMMU_CTRL_ENAB     0x0000000000000001 /* IOMMU Enable                  */
+#define  PSYCHO_IOMMU_CTRL_RESV     0xfffffffff9000000UL /* Reserved                      */
+#define  PSYCHO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status      */
+#define  PSYCHO_IOMMU_CTRL_XLTEERR  0x0000000001000000UL /* Translation Error encountered */
+#define  PSYCHO_IOMMU_CTRL_LCKEN    0x0000000000800000UL /* Enable translation locking    */
+#define  PSYCHO_IOMMU_CTRL_LCKPTR   0x0000000000780000UL /* Translation lock pointer      */
+#define  PSYCHO_IOMMU_CTRL_TSBSZ    0x0000000000070000UL /* TSB Size                      */
+#define  PSYCHO_IOMMU_TSBSZ_1K      0x0000000000000000UL /* TSB Table 1024 8-byte entries */
+#define  PSYCHO_IOMMU_TSBSZ_2K      0x0000000000010000UL /* TSB Table 2048 8-byte entries */
+#define  PSYCHO_IOMMU_TSBSZ_4K      0x0000000000020000UL /* TSB Table 4096 8-byte entries */
+#define  PSYCHO_IOMMU_TSBSZ_8K      0x0000000000030000UL /* TSB Table 8192 8-byte entries */
+#define  PSYCHO_IOMMU_TSBSZ_16K     0x0000000000040000UL /* TSB Table 16k 8-byte entries  */
+#define  PSYCHO_IOMMU_TSBSZ_32K     0x0000000000050000UL /* TSB Table 32k 8-byte entries  */
+#define  PSYCHO_IOMMU_TSBSZ_64K     0x0000000000060000UL /* TSB Table 64k 8-byte entries  */
+#define  PSYCHO_IOMMU_TSBSZ_128K    0x0000000000070000UL /* TSB Table 128k 8-byte entries */
+#define  PSYCHO_IOMMU_CTRL_RESV2    0x000000000000fff8UL /* Reserved                      */
+#define  PSYCHO_IOMMU_CTRL_TBWSZ    0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */
+#define  PSYCHO_IOMMU_CTRL_DENAB    0x0000000000000002UL /* Diagnostic mode enable        */
+#define  PSYCHO_IOMMU_CTRL_ENAB     0x0000000000000001UL /* IOMMU Enable                  */
 #define PSYCHO_IOMMU_TSBBASE	0x0208UL
 #define PSYCHO_IOMMU_FLUSH	0x0210UL
 #define PSYCHO_IOMMU_TAG	0xa580UL
@@ -698,18 +698,18 @@
  * relating to UPA interface transactions.
  */
 #define PSYCHO_UE_AFSR	0x0030UL
-#define  PSYCHO_UEAFSR_PPIO	0x8000000000000000 /* Primary PIO is cause         */
-#define  PSYCHO_UEAFSR_PDRD	0x4000000000000000 /* Primary DVMA read is cause   */
-#define  PSYCHO_UEAFSR_PDWR	0x2000000000000000 /* Primary DVMA write is cause  */
-#define  PSYCHO_UEAFSR_SPIO	0x1000000000000000 /* Secondary PIO is cause       */
-#define  PSYCHO_UEAFSR_SDRD	0x0800000000000000 /* Secondary DVMA read is cause */
-#define  PSYCHO_UEAFSR_SDWR	0x0400000000000000 /* Secondary DVMA write is cause*/
-#define  PSYCHO_UEAFSR_RESV1	0x03ff000000000000 /* Reserved                     */
-#define  PSYCHO_UEAFSR_BMSK	0x0000ffff00000000 /* Bytemask of failed transfer  */
-#define  PSYCHO_UEAFSR_DOFF	0x00000000e0000000 /* Doubleword Offset            */
-#define  PSYCHO_UEAFSR_MID	0x000000001f000000 /* UPA MID causing the fault    */
-#define  PSYCHO_UEAFSR_BLK	0x0000000000800000 /* Trans was block operation    */
-#define  PSYCHO_UEAFSR_RESV2	0x00000000007fffff /* Reserved                     */
+#define  PSYCHO_UEAFSR_PPIO	0x8000000000000000UL /* Primary PIO is cause         */
+#define  PSYCHO_UEAFSR_PDRD	0x4000000000000000UL /* Primary DVMA read is cause   */
+#define  PSYCHO_UEAFSR_PDWR	0x2000000000000000UL /* Primary DVMA write is cause  */
+#define  PSYCHO_UEAFSR_SPIO	0x1000000000000000UL /* Secondary PIO is cause       */
+#define  PSYCHO_UEAFSR_SDRD	0x0800000000000000UL /* Secondary DVMA read is cause */
+#define  PSYCHO_UEAFSR_SDWR	0x0400000000000000UL /* Secondary DVMA write is cause*/
+#define  PSYCHO_UEAFSR_RESV1	0x03ff000000000000UL /* Reserved                     */
+#define  PSYCHO_UEAFSR_BMSK	0x0000ffff00000000UL /* Bytemask of failed transfer  */
+#define  PSYCHO_UEAFSR_DOFF	0x00000000e0000000UL /* Doubleword Offset            */
+#define  PSYCHO_UEAFSR_MID	0x000000001f000000UL /* UPA MID causing the fault    */
+#define  PSYCHO_UEAFSR_BLK	0x0000000000800000UL /* Trans was block operation    */
+#define  PSYCHO_UEAFSR_RESV2	0x00000000007fffffUL /* Reserved                     */
 #define PSYCHO_UE_AFAR	0x0038UL
 
 static irqreturn_t psycho_ue_intr(int irq, void *dev_id, struct pt_regs *regs)
@@ -774,19 +774,19 @@
 
 /* Correctable Errors. */
 #define PSYCHO_CE_AFSR	0x0040UL
-#define  PSYCHO_CEAFSR_PPIO	0x8000000000000000 /* Primary PIO is cause         */
-#define  PSYCHO_CEAFSR_PDRD	0x4000000000000000 /* Primary DVMA read is cause   */
-#define  PSYCHO_CEAFSR_PDWR	0x2000000000000000 /* Primary DVMA write is cause  */
-#define  PSYCHO_CEAFSR_SPIO	0x1000000000000000 /* Secondary PIO is cause       */
-#define  PSYCHO_CEAFSR_SDRD	0x0800000000000000 /* Secondary DVMA read is cause */
-#define  PSYCHO_CEAFSR_SDWR	0x0400000000000000 /* Secondary DVMA write is cause*/
-#define  PSYCHO_CEAFSR_RESV1	0x0300000000000000 /* Reserved                     */
-#define  PSYCHO_CEAFSR_ESYND	0x00ff000000000000 /* Syndrome Bits                */
-#define  PSYCHO_CEAFSR_BMSK	0x0000ffff00000000 /* Bytemask of failed transfer  */
-#define  PSYCHO_CEAFSR_DOFF	0x00000000e0000000 /* Double Offset                */
-#define  PSYCHO_CEAFSR_MID	0x000000001f000000 /* UPA MID causing the fault    */
-#define  PSYCHO_CEAFSR_BLK	0x0000000000800000 /* Trans was block operation    */
-#define  PSYCHO_CEAFSR_RESV2	0x00000000007fffff /* Reserved                     */
+#define  PSYCHO_CEAFSR_PPIO	0x8000000000000000UL /* Primary PIO is cause         */
+#define  PSYCHO_CEAFSR_PDRD	0x4000000000000000UL /* Primary DVMA read is cause   */
+#define  PSYCHO_CEAFSR_PDWR	0x2000000000000000UL /* Primary DVMA write is cause  */
+#define  PSYCHO_CEAFSR_SPIO	0x1000000000000000UL /* Secondary PIO is cause       */
+#define  PSYCHO_CEAFSR_SDRD	0x0800000000000000UL /* Secondary DVMA read is cause */
+#define  PSYCHO_CEAFSR_SDWR	0x0400000000000000UL /* Secondary DVMA write is cause*/
+#define  PSYCHO_CEAFSR_RESV1	0x0300000000000000UL /* Reserved                     */
+#define  PSYCHO_CEAFSR_ESYND	0x00ff000000000000UL /* Syndrome Bits                */
+#define  PSYCHO_CEAFSR_BMSK	0x0000ffff00000000UL /* Bytemask of failed transfer  */
+#define  PSYCHO_CEAFSR_DOFF	0x00000000e0000000UL /* Double Offset                */
+#define  PSYCHO_CEAFSR_MID	0x000000001f000000UL /* UPA MID causing the fault    */
+#define  PSYCHO_CEAFSR_BLK	0x0000000000800000UL /* Trans was block operation    */
+#define  PSYCHO_CEAFSR_RESV2	0x00000000007fffffUL /* Reserved                     */
 #define PSYCHO_CE_AFAR	0x0040UL
 
 static irqreturn_t psycho_ce_intr(int irq, void *dev_id, struct pt_regs *regs)
@@ -857,20 +857,20 @@
  */
 #define PSYCHO_PCI_AFSR_A	0x2010UL
 #define PSYCHO_PCI_AFSR_B	0x4010UL
-#define  PSYCHO_PCIAFSR_PMA	0x8000000000000000 /* Primary Master Abort Error   */
-#define  PSYCHO_PCIAFSR_PTA	0x4000000000000000 /* Primary Target Abort Error   */
-#define  PSYCHO_PCIAFSR_PRTRY	0x2000000000000000 /* Primary Excessive Retries    */
-#define  PSYCHO_PCIAFSR_PPERR	0x1000000000000000 /* Primary Parity Error         */
-#define  PSYCHO_PCIAFSR_SMA	0x0800000000000000 /* Secondary Master Abort Error */
-#define  PSYCHO_PCIAFSR_STA	0x0400000000000000 /* Secondary Target Abort Error */
-#define  PSYCHO_PCIAFSR_SRTRY	0x0200000000000000 /* Secondary Excessive Retries  */
-#define  PSYCHO_PCIAFSR_SPERR	0x0100000000000000 /* Secondary Parity Error       */
-#define  PSYCHO_PCIAFSR_RESV1	0x00ff000000000000 /* Reserved                     */
-#define  PSYCHO_PCIAFSR_BMSK	0x0000ffff00000000 /* Bytemask of failed transfer  */
-#define  PSYCHO_PCIAFSR_BLK	0x0000000080000000 /* Trans was block operation    */
-#define  PSYCHO_PCIAFSR_RESV2	0x0000000040000000 /* Reserved                     */
-#define  PSYCHO_PCIAFSR_MID	0x000000003e000000 /* MID causing the error        */
-#define  PSYCHO_PCIAFSR_RESV3	0x0000000001ffffff /* Reserved                     */
+#define  PSYCHO_PCIAFSR_PMA	0x8000000000000000UL /* Primary Master Abort Error   */
+#define  PSYCHO_PCIAFSR_PTA	0x4000000000000000UL /* Primary Target Abort Error   */
+#define  PSYCHO_PCIAFSR_PRTRY	0x2000000000000000UL /* Primary Excessive Retries    */
+#define  PSYCHO_PCIAFSR_PPERR	0x1000000000000000UL /* Primary Parity Error         */
+#define  PSYCHO_PCIAFSR_SMA	0x0800000000000000UL /* Secondary Master Abort Error */
+#define  PSYCHO_PCIAFSR_STA	0x0400000000000000UL /* Secondary Target Abort Error */
+#define  PSYCHO_PCIAFSR_SRTRY	0x0200000000000000UL /* Secondary Excessive Retries  */
+#define  PSYCHO_PCIAFSR_SPERR	0x0100000000000000UL /* Secondary Parity Error       */
+#define  PSYCHO_PCIAFSR_RESV1	0x00ff000000000000UL /* Reserved                     */
+#define  PSYCHO_PCIAFSR_BMSK	0x0000ffff00000000UL /* Bytemask of failed transfer  */
+#define  PSYCHO_PCIAFSR_BLK	0x0000000080000000UL /* Trans was block operation    */
+#define  PSYCHO_PCIAFSR_RESV2	0x0000000040000000UL /* Reserved                     */
+#define  PSYCHO_PCIAFSR_MID	0x000000003e000000UL /* MID causing the error        */
+#define  PSYCHO_PCIAFSR_RESV3	0x0000000001ffffffUL /* Reserved                     */
 #define PSYCHO_PCI_AFAR_A	0x2018UL
 #define PSYCHO_PCI_AFAR_B	0x4018UL
 
@@ -1017,9 +1017,9 @@
 
 /* XXX What about PowerFail/PowerManagement??? -DaveM */
 #define PSYCHO_ECC_CTRL		0x0020
-#define  PSYCHO_ECCCTRL_EE	 0x8000000000000000 /* Enable ECC Checking */
-#define  PSYCHO_ECCCTRL_UE	 0x4000000000000000 /* Enable UE Interrupts */
-#define  PSYCHO_ECCCTRL_CE	 0x2000000000000000 /* Enable CE INterrupts */
+#define  PSYCHO_ECCCTRL_EE	 0x8000000000000000UL /* Enable ECC Checking */
+#define  PSYCHO_ECCCTRL_UE	 0x4000000000000000UL /* Enable UE Interrupts */
+#define  PSYCHO_ECCCTRL_CE	 0x2000000000000000UL /* Enable CE INterrupts */
 #define PSYCHO_UE_INO		0x2e
 #define PSYCHO_CE_INO		0x2f
 #define PSYCHO_PCIERR_A_INO	0x30
@@ -1282,14 +1282,14 @@
 #define PSYCHO_IRQ_RETRY	0x1a00UL
 #define PSYCHO_PCIA_DIAG	0x2020UL
 #define PSYCHO_PCIB_DIAG	0x4020UL
-#define  PSYCHO_PCIDIAG_RESV	 0xffffffffffffff80 /* Reserved                     */
-#define  PSYCHO_PCIDIAG_DRETRY	 0x0000000000000040 /* Disable retry limit          */
-#define  PSYCHO_PCIDIAG_DISYNC	 0x0000000000000020 /* Disable DMA wr / irq sync    */
-#define  PSYCHO_PCIDIAG_DDWSYNC	 0x0000000000000010 /* Disable DMA wr / PIO rd sync */
-#define  PSYCHO_PCIDIAG_IDDPAR	 0x0000000000000008 /* Invert DMA data parity       */
-#define  PSYCHO_PCIDIAG_IPDPAR	 0x0000000000000004 /* Invert PIO data parity       */
-#define  PSYCHO_PCIDIAG_IPAPAR	 0x0000000000000002 /* Invert PIO address parity    */
-#define  PSYCHO_PCIDIAG_LPBACK	 0x0000000000000001 /* Enable loopback mode         */
+#define  PSYCHO_PCIDIAG_RESV	 0xffffffffffffff80UL /* Reserved                     */
+#define  PSYCHO_PCIDIAG_DRETRY	 0x0000000000000040UL /* Disable retry limit          */
+#define  PSYCHO_PCIDIAG_DISYNC	 0x0000000000000020UL /* Disable DMA wr / irq sync    */
+#define  PSYCHO_PCIDIAG_DDWSYNC	 0x0000000000000010UL /* Disable DMA wr / PIO rd sync */
+#define  PSYCHO_PCIDIAG_IDDPAR	 0x0000000000000008UL /* Invert DMA data parity       */
+#define  PSYCHO_PCIDIAG_IPDPAR	 0x0000000000000004UL /* Invert PIO data parity       */
+#define  PSYCHO_PCIDIAG_IPAPAR	 0x0000000000000002UL /* Invert PIO address parity    */
+#define  PSYCHO_PCIDIAG_LPBACK	 0x0000000000000001UL /* Enable loopback mode         */
 
 static void psycho_controller_hwinit(struct pci_controller_info *p)
 {
diff -Nru a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
--- a/arch/sparc64/kernel/pci_schizo.c	Tue Jun 15 22:20:42 2004
+++ b/arch/sparc64/kernel/pci_schizo.c	Tue Jun 15 22:20:42 2004
@@ -56,24 +56,24 @@
 #define SCHIZO_STRBUF_CTRL_ENAB    0x0000000000000001UL /* Streaming Buffer Enable */
 
 /* IOMMU control register. */
-#define SCHIZO_IOMMU_CTRL_RESV     0xfffffffff9000000 /* Reserved                      */
-#define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000 /* Translation Error Status      */
-#define SCHIZO_IOMMU_CTRL_XLTEERR  0x0000000001000000 /* Translation Error encountered */
-#define SCHIZO_IOMMU_CTRL_LCKEN    0x0000000000800000 /* Enable translation locking    */
-#define SCHIZO_IOMMU_CTRL_LCKPTR   0x0000000000780000 /* Translation lock pointer      */
-#define SCHIZO_IOMMU_CTRL_TSBSZ    0x0000000000070000 /* TSB Size                      */
-#define SCHIZO_IOMMU_TSBSZ_1K      0x0000000000000000 /* TSB Table 1024 8-byte entries */
-#define SCHIZO_IOMMU_TSBSZ_2K      0x0000000000010000 /* TSB Table 2048 8-byte entries */
-#define SCHIZO_IOMMU_TSBSZ_4K      0x0000000000020000 /* TSB Table 4096 8-byte entries */
-#define SCHIZO_IOMMU_TSBSZ_8K      0x0000000000030000 /* TSB Table 8192 8-byte entries */
-#define SCHIZO_IOMMU_TSBSZ_16K     0x0000000000040000 /* TSB Table 16k 8-byte entries  */
-#define SCHIZO_IOMMU_TSBSZ_32K     0x0000000000050000 /* TSB Table 32k 8-byte entries  */
-#define SCHIZO_IOMMU_TSBSZ_64K     0x0000000000060000 /* TSB Table 64k 8-byte entries  */
-#define SCHIZO_IOMMU_TSBSZ_128K    0x0000000000070000 /* TSB Table 128k 8-byte entries */
-#define SCHIZO_IOMMU_CTRL_RESV2    0x000000000000fff8 /* Reserved                      */
-#define SCHIZO_IOMMU_CTRL_TBWSZ    0x0000000000000004 /* Assumed page size, 0=8k 1=64k */
-#define SCHIZO_IOMMU_CTRL_DENAB    0x0000000000000002 /* Diagnostic mode enable        */
-#define SCHIZO_IOMMU_CTRL_ENAB     0x0000000000000001 /* IOMMU Enable                  */
+#define SCHIZO_IOMMU_CTRL_RESV     0xfffffffff9000000UL /* Reserved                      */
+#define SCHIZO_IOMMU_CTRL_XLTESTAT 0x0000000006000000UL /* Translation Error Status      */
+#define SCHIZO_IOMMU_CTRL_XLTEERR  0x0000000001000000UL /* Translation Error encountered */
+#define SCHIZO_IOMMU_CTRL_LCKEN    0x0000000000800000UL /* Enable translation locking    */
+#define SCHIZO_IOMMU_CTRL_LCKPTR   0x0000000000780000UL /* Translation lock pointer      */
+#define SCHIZO_IOMMU_CTRL_TSBSZ    0x0000000000070000UL /* TSB Size                      */
+#define SCHIZO_IOMMU_TSBSZ_1K      0x0000000000000000UL /* TSB Table 1024 8-byte entries */
+#define SCHIZO_IOMMU_TSBSZ_2K      0x0000000000010000UL /* TSB Table 2048 8-byte entries */
+#define SCHIZO_IOMMU_TSBSZ_4K      0x0000000000020000UL /* TSB Table 4096 8-byte entries */
+#define SCHIZO_IOMMU_TSBSZ_8K      0x0000000000030000UL /* TSB Table 8192 8-byte entries */
+#define SCHIZO_IOMMU_TSBSZ_16K     0x0000000000040000UL /* TSB Table 16k 8-byte entries  */
+#define SCHIZO_IOMMU_TSBSZ_32K     0x0000000000050000UL /* TSB Table 32k 8-byte entries  */
+#define SCHIZO_IOMMU_TSBSZ_64K     0x0000000000060000UL /* TSB Table 64k 8-byte entries  */
+#define SCHIZO_IOMMU_TSBSZ_128K    0x0000000000070000UL /* TSB Table 128k 8-byte entries */
+#define SCHIZO_IOMMU_CTRL_RESV2    0x000000000000fff8UL /* Reserved                      */
+#define SCHIZO_IOMMU_CTRL_TBWSZ    0x0000000000000004UL /* Assumed page size, 0=8k 1=64k */
+#define SCHIZO_IOMMU_CTRL_DENAB    0x0000000000000002UL /* Diagnostic mode enable        */
+#define SCHIZO_IOMMU_CTRL_ENAB     0x0000000000000001UL /* IOMMU Enable                  */
 
 /* Schizo config space address format is nearly identical to
  * that of PSYCHO:
@@ -1111,9 +1111,9 @@
 
 /* Nearly identical to PSYCHO equivalents... */
 #define SCHIZO_ECC_CTRL		0x10020UL
-#define  SCHIZO_ECCCTRL_EE	 0x8000000000000000 /* Enable ECC Checking */
-#define  SCHIZO_ECCCTRL_UE	 0x4000000000000000 /* Enable UE Interrupts */
-#define  SCHIZO_ECCCTRL_CE	 0x2000000000000000 /* Enable CE INterrupts */
+#define  SCHIZO_ECCCTRL_EE	 0x8000000000000000UL /* Enable ECC Checking */
+#define  SCHIZO_ECCCTRL_UE	 0x4000000000000000UL /* Enable UE Interrupts */
+#define  SCHIZO_ECCCTRL_CE	 0x2000000000000000UL /* Enable CE INterrupts */
 
 #define SCHIZO_SAFARI_ERRCTRL	0x10008UL
 #define  SCHIZO_SAFERRCTRL_EN	 0x8000000000000000UL
diff -Nru a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
--- a/arch/sparc64/kernel/process.c	Tue Jun 15 22:20:39 2004
+++ b/arch/sparc64/kernel/process.c	Tue Jun 15 22:20:39 2004
@@ -160,39 +160,43 @@
 
 static void show_regwindow32(struct pt_regs *regs)
 {
-	struct reg_window32 *rw;
+	struct reg_window32 __user *rw;
 	struct reg_window32 r_w;
 	mm_segment_t old_fs;
 	
 	__asm__ __volatile__ ("flushw");
-	rw = (struct reg_window32 *)((long)(unsigned)regs->u_regs[14]);
+	rw = (struct reg_window32 __user *)((long)(unsigned)regs->u_regs[14]);
 	old_fs = get_fs();
 	set_fs (USER_DS);
 	if (copy_from_user (&r_w, rw, sizeof(r_w))) {
 		set_fs (old_fs);
 		return;
 	}
-	rw = &r_w;
+
 	set_fs (old_fs);			
 	printk("l0: %08x l1: %08x l2: %08x l3: %08x "
 	       "l4: %08x l5: %08x l6: %08x l7: %08x\n",
-	       rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3],
-	       rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]);
+	       r_w.locals[0], r_w.locals[1], r_w.locals[2], r_w.locals[3],
+	       r_w.locals[4], r_w.locals[5], r_w.locals[6], r_w.locals[7]);
 	printk("i0: %08x i1: %08x i2: %08x i3: %08x "
 	       "i4: %08x i5: %08x i6: %08x i7: %08x\n",
-	       rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3],
-	       rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]);
+	       r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3],
+	       r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]);
 }
 
 static void show_regwindow(struct pt_regs *regs)
 {
-	struct reg_window *rw;
+	struct reg_window __user *rw;
+	struct reg_window *rwk;
 	struct reg_window r_w;
 	mm_segment_t old_fs;
 
 	if ((regs->tstate & TSTATE_PRIV) || !(test_thread_flag(TIF_32BIT))) {
 		__asm__ __volatile__ ("flushw");
-		rw = (struct reg_window *)(regs->u_regs[14] + STACK_BIAS);
+		rw = (struct reg_window __user *)
+			(regs->u_regs[14] + STACK_BIAS);
+		rwk = (struct reg_window *)
+			(regs->u_regs[14] + STACK_BIAS);
 		if (!(regs->tstate & TSTATE_PRIV)) {
 			old_fs = get_fs();
 			set_fs (USER_DS);
@@ -200,7 +204,7 @@
 				set_fs (old_fs);
 				return;
 			}
-			rw = &r_w;
+			rwk = &r_w;
 			set_fs (old_fs);			
 		}
 	} else {
@@ -208,15 +212,15 @@
 		return;
 	}
 	printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n",
-	       rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3]);
+	       rwk->locals[0], rwk->locals[1], rwk->locals[2], rwk->locals[3]);
 	printk("l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n",
-	       rw->locals[4], rw->locals[5], rw->locals[6], rw->locals[7]);
+	       rwk->locals[4], rwk->locals[5], rwk->locals[6], rwk->locals[7]);
 	printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n",
-	       rw->ins[0], rw->ins[1], rw->ins[2], rw->ins[3]);
+	       rwk->ins[0], rwk->ins[1], rwk->ins[2], rwk->ins[3]);
 	printk("i4: %016lx i5: %016lx i6: %016lx i7: %016lx\n",
-	       rw->ins[4], rw->ins[5], rw->ins[6], rw->ins[7]);
+	       rwk->ins[4], rwk->ins[5], rwk->ins[6], rwk->ins[7]);
 	if (regs->tstate & TSTATE_PRIV)
-		print_symbol("I7: <%s>\n", rw->ins[7]);
+		print_symbol("I7: <%s>\n", rwk->ins[7]);
 }
 
 void show_stackframe(struct sparc_stackf *sf)
@@ -471,10 +475,10 @@
 	if (!(test_thread_flag(TIF_32BIT))) {
 		csp += STACK_BIAS;
 		psp += STACK_BIAS;
-		__get_user(fp, &(((struct reg_window *)psp)->ins[6]));
+		__get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));
 		fp += STACK_BIAS;
 	} else
-		__get_user(fp, &(((struct reg_window32 *)psp)->ins[6]));
+		__get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
 
 	/* Now 8-byte align the stack as this is mandatory in the
 	 * Sparc ABI due to how register windows work.  This hides
@@ -487,11 +491,12 @@
 	if (copy_in_user((void __user *) rval, (void __user *) psp, distance))
 		rval = 0;
 	else if (test_thread_flag(TIF_32BIT)) {
-		if (put_user(((u32)csp), &(((struct reg_window32 *)rval)->ins[6])))
+		if (put_user(((u32)csp),
+			     &(((struct reg_window32 __user *)rval)->ins[6])))
 			rval = 0;
 	} else {
 		if (put_user(((u64)csp - STACK_BIAS),
-			     &(((struct reg_window *)rval)->ins[6])))
+			     &(((struct reg_window __user *)rval)->ins[6])))
 			rval = 0;
 		else
 			rval = rval - STACK_BIAS;
@@ -533,7 +538,7 @@
 			unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
 			struct reg_window *rwin = &t->reg_window[window];
 
-			if (!copy_to_user((char *)sp, rwin, winsize)) {
+			if (!copy_to_user((char __user *)sp, rwin, winsize)) {
 				shift_window_buffer(window, get_thread_wsaved() - 1, t);
 				set_thread_wsaved(get_thread_wsaved() - 1);
 			}
@@ -562,7 +567,7 @@
 			unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
 			struct reg_window *rwin = &t->reg_window[window];
 
-			if (copy_to_user((char *)sp, rwin, winsize))
+			if (copy_to_user((char __user *)sp, rwin, winsize))
 				goto barf;
 		} while (window--);
 	}
@@ -574,26 +579,26 @@
 	do_exit(SIGILL);
 }
 
-asmlinkage int sparc_do_fork(unsigned long clone_flags,
-			     unsigned long stack_start,
-			     struct pt_regs *regs,
-			     unsigned long stack_size)
+asmlinkage long sparc_do_fork(unsigned long clone_flags,
+			      unsigned long stack_start,
+			      struct pt_regs *regs,
+			      unsigned long stack_size)
 {
-	unsigned long parent_tid_ptr, child_tid_ptr;
+	int __user *parent_tid_ptr, *child_tid_ptr;
 
 	clone_flags &= ~CLONE_IDLETASK;
 
-	parent_tid_ptr = regs->u_regs[UREG_I2];
-	child_tid_ptr = regs->u_regs[UREG_I4];
 	if (test_thread_flag(TIF_32BIT)) {
-		parent_tid_ptr &= 0xffffffff;
-		child_tid_ptr &= 0xffffffff;
+		parent_tid_ptr = compat_ptr(regs->u_regs[UREG_I2]);
+		child_tid_ptr = compat_ptr(regs->u_regs[UREG_I4]);
+	} else {
+		parent_tid_ptr = (int __user *) regs->u_regs[UREG_I2];
+		child_tid_ptr = (int __user *) regs->u_regs[UREG_I4];
 	}
 
 	return do_fork(clone_flags, stack_start,
 		       regs, stack_size,
-		       (int *) parent_tid_ptr,
-		       (int *) child_tid_ptr);
+		       parent_tid_ptr, child_tid_ptr);
 }
 
 /* Copy a Sparc thread.  The fork() return value conventions
@@ -694,24 +699,24 @@
 	 * So we stash 'fn' and 'arg' into global registers which
 	 * will not be modified by the parent.
 	 */
-	__asm__ __volatile("mov %4, %%g2\n\t"	   /* Save FN into global */
-			   "mov %5, %%g3\n\t"	   /* Save ARG into global */
-			   "mov %1, %%g1\n\t"	   /* Clone syscall nr. */
-			   "mov %2, %%o0\n\t"	   /* Clone flags. */
-			   "mov 0, %%o1\n\t"	   /* usp arg == 0 */
-			   "t 0x6d\n\t"		   /* Linux/Sparc clone(). */
-			   "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
-			   " mov %%o0, %0\n\t"
-			   "jmpl %%g2, %%o7\n\t"   /* Call the function. */
-			   " mov %%g3, %%o0\n\t"   /* Set arg in delay. */
-			   "mov %3, %%g1\n\t"
-			   "t 0x6d\n\t"		   /* Linux/Sparc exit(). */
-			   /* Notreached by child. */
-			   "1:" :
-			   "=r" (retval) :
-			   "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
-			   "i" (__NR_exit),  "r" (fn), "r" (arg) :
-			   "g1", "g2", "g3", "o0", "o1", "memory", "cc");
+	__asm__ __volatile__("mov %4, %%g2\n\t"	   /* Save FN into global */
+			     "mov %5, %%g3\n\t"	   /* Save ARG into global */
+			     "mov %1, %%g1\n\t"	   /* Clone syscall nr. */
+			     "mov %2, %%o0\n\t"	   /* Clone flags. */
+			     "mov 0, %%o1\n\t"	   /* usp arg == 0 */
+			     "t 0x6d\n\t"	   /* Linux/Sparc clone(). */
+			     "brz,a,pn %%o1, 1f\n\t" /* Parent, just return. */
+			     " mov %%o0, %0\n\t"
+			     "jmpl %%g2, %%o7\n\t"   /* Call the function. */
+			     " mov %%g3, %%o0\n\t"   /* Set arg in delay. */
+			     "mov %3, %%g1\n\t"
+			     "t 0x6d\n\t"	   /* Linux/Sparc exit(). */
+			     /* Notreached by child. */
+			     "1:" :
+			     "=r" (retval) :
+			     "i" (__NR_clone), "r" (flags | CLONE_VM | CLONE_UNTRACED),
+			     "i" (__NR_exit),  "r" (fn), "r" (arg) :
+			     "g1", "g2", "g3", "o0", "o1", "memory", "cc");
 	return retval;
 }
 
@@ -806,12 +811,15 @@
 	if (regs->u_regs[UREG_G1] == 0)
 		base = 1;
 
-	filename = getname((char *)regs->u_regs[base + UREG_I0]);
+	filename = getname((char __user *)regs->u_regs[base + UREG_I0]);
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
-	error = do_execve(filename, (char **) regs->u_regs[base + UREG_I1],
-			  (char **) regs->u_regs[base + UREG_I2], regs);
+	error = do_execve(filename,
+			  (char __user * __user *)
+			  regs->u_regs[base + UREG_I1],
+			  (char __user * __user *)
+			  regs->u_regs[base + UREG_I2], regs);
 	putname(filename);
 	if (!error) {
 		fprs_write(0);
@@ -847,8 +855,7 @@
 			break;
 		rw = (struct reg_window *) fp;
 		pc = rw->ins[7];
-		if (pc < ((unsigned long) scheduling_functions_start_here) ||
-		    pc >= ((unsigned long) scheduling_functions_end_here)) {
+		if (!in_sched_functions(pc)) {
 			ret = pc;
 			goto out;
 		}
diff -Nru a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
--- a/arch/sparc64/kernel/ptrace.c	Tue Jun 15 22:21:04 2004
+++ b/arch/sparc64/kernel/ptrace.c	Tue Jun 15 22:21:04 2004
@@ -53,11 +53,15 @@
 pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
 {
 	if (test_thread_flag(TIF_32BIT)) {
-		if (put_user(value, (unsigned int *)addr))
-			return pt_error_return(regs, EFAULT);
+		if (put_user(value, (unsigned int __user *) addr)) {
+			pt_error_return(regs, EFAULT);
+			return;
+		}
 	} else {
-		if (put_user(value, addr))
-			return pt_error_return(regs, EFAULT);
+		if (put_user(value, (long __user *) addr)) {
+			pt_error_return(regs, EFAULT);
+			return;
+		}
 	}
 	regs->u_regs[UREG_I0] = 0;
 	regs->tstate &= ~(TSTATE_ICARRY | TSTATE_XCARRY);
@@ -253,7 +257,8 @@
 	}
 
 	case PTRACE_GETREGS: {
-		struct pt_regs32 *pregs = (struct pt_regs32 *) addr;
+		struct pt_regs32 __user *pregs =
+			(struct pt_regs32 __user *) addr;
 		struct pt_regs *cregs = child->thread_info->kregs;
 		int rval;
 
@@ -277,7 +282,7 @@
 	}
 
 	case PTRACE_GETREGS64: {
-		struct pt_regs *pregs = (struct pt_regs *) addr;
+		struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
 		struct pt_regs *cregs = child->thread_info->kregs;
 		unsigned long tpc = cregs->tpc;
 		int rval;
@@ -304,7 +309,8 @@
 	}
 
 	case PTRACE_SETREGS: {
-		struct pt_regs32 *pregs = (struct pt_regs32 *) addr;
+		struct pt_regs32 __user *pregs =
+			(struct pt_regs32 __user *) addr;
 		struct pt_regs *cregs = child->thread_info->kregs;
 		unsigned int psr, pc, npc, y;
 		int i;
@@ -337,7 +343,7 @@
 	}
 
 	case PTRACE_SETREGS64: {
-		struct pt_regs *pregs = (struct pt_regs *) addr;
+		struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
 		struct pt_regs *cregs = child->thread_info->kregs;
 		unsigned long tstate, tpc, tnpc, y;
 		int i;
@@ -385,7 +391,8 @@
 				unsigned int insnaddr;
 				unsigned int insn;
 			} fpq[16];
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		unsigned long *fpregs = child->thread_info->fpregs;
 
 		if (copy_to_user(&fps->regs[0], fpregs,
@@ -406,7 +413,8 @@
 		struct fps {
 			unsigned int regs[64];
 			unsigned long fsr;
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		unsigned long *fpregs = child->thread_info->fpregs;
 
 		if (copy_to_user(&fps->regs[0], fpregs,
@@ -430,7 +438,8 @@
 				unsigned int insnaddr;
 				unsigned int insn;
 			} fpq[16];
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		unsigned long *fpregs = child->thread_info->fpregs;
 		unsigned fsr;
 
@@ -453,7 +462,8 @@
 		struct fps {
 			unsigned int regs[64];
 			unsigned long fsr;
-		} *fps = (struct fps *) addr;
+		};
+		struct fps __user *fps = (struct fps __user *) addr;
 		unsigned long *fpregs = child->thread_info->fpregs;
 
 		if (copy_from_user(fpregs, &fps->regs[0],
@@ -472,7 +482,7 @@
 	case PTRACE_READTEXT:
 	case PTRACE_READDATA: {
 		int res = ptrace_readdata(child, addr,
-					  (void *)addr2, data);
+					  (char __user *)addr2, data);
 		if (res == data) {
 			pt_succ_return(regs, 0);
 			goto flush_and_out;
@@ -485,7 +495,7 @@
 
 	case PTRACE_WRITETEXT:
 	case PTRACE_WRITEDATA: {
-		int res = ptrace_writedata(child, (void *) addr2,
+		int res = ptrace_writedata(child, (char __user *) addr2,
 					   addr, data);
 		if (res == data) {
 			pt_succ_return(regs, 0);
diff -Nru a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
--- a/arch/sparc64/kernel/sbus.c	Tue Jun 15 22:21:05 2004
+++ b/arch/sparc64/kernel/sbus.c	Tue Jun 15 22:21:05 2004
@@ -810,17 +810,17 @@
 /* Error interrupt handling. */
 #define SYSIO_UE_AFSR	0x0030UL
 #define SYSIO_UE_AFAR	0x0038UL
-#define  SYSIO_UEAFSR_PPIO	0x8000000000000000 /* Primary PIO is cause         */
-#define  SYSIO_UEAFSR_PDRD	0x4000000000000000 /* Primary DVMA read is cause   */
-#define  SYSIO_UEAFSR_PDWR	0x2000000000000000 /* Primary DVMA write is cause  */
-#define  SYSIO_UEAFSR_SPIO	0x1000000000000000 /* Secondary PIO is cause       */
-#define  SYSIO_UEAFSR_SDRD	0x0800000000000000 /* Secondary DVMA read is cause */
-#define  SYSIO_UEAFSR_SDWR	0x0400000000000000 /* Secondary DVMA write is cause*/
-#define  SYSIO_UEAFSR_RESV1	0x03ff000000000000 /* Reserved                     */
-#define  SYSIO_UEAFSR_DOFF	0x0000e00000000000 /* Doubleword Offset            */
-#define  SYSIO_UEAFSR_SIZE	0x00001c0000000000 /* Bad transfer size is 2**SIZE */
-#define  SYSIO_UEAFSR_MID	0x000003e000000000 /* UPA MID causing the fault    */
-#define  SYSIO_UEAFSR_RESV2	0x0000001fffffffff /* Reserved                     */
+#define  SYSIO_UEAFSR_PPIO  0x8000000000000000UL /* Primary PIO cause         */
+#define  SYSIO_UEAFSR_PDRD  0x4000000000000000UL /* Primary DVMA read cause   */
+#define  SYSIO_UEAFSR_PDWR  0x2000000000000000UL /* Primary DVMA write cause  */
+#define  SYSIO_UEAFSR_SPIO  0x1000000000000000UL /* Secondary PIO is cause    */
+#define  SYSIO_UEAFSR_SDRD  0x0800000000000000UL /* Secondary DVMA read cause */
+#define  SYSIO_UEAFSR_SDWR  0x0400000000000000UL /* Secondary DVMA write cause*/
+#define  SYSIO_UEAFSR_RESV1 0x03ff000000000000UL /* Reserved                  */
+#define  SYSIO_UEAFSR_DOFF  0x0000e00000000000UL /* Doubleword Offset         */
+#define  SYSIO_UEAFSR_SIZE  0x00001c0000000000UL /* Bad transfer size 2^SIZE  */
+#define  SYSIO_UEAFSR_MID   0x000003e000000000UL /* UPA MID causing the fault */
+#define  SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_ue_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct sbus_bus *sbus = dev_id;
@@ -881,18 +881,18 @@
 
 #define SYSIO_CE_AFSR	0x0040UL
 #define SYSIO_CE_AFAR	0x0048UL
-#define  SYSIO_CEAFSR_PPIO	0x8000000000000000 /* Primary PIO is cause         */
-#define  SYSIO_CEAFSR_PDRD	0x4000000000000000 /* Primary DVMA read is cause   */
-#define  SYSIO_CEAFSR_PDWR	0x2000000000000000 /* Primary DVMA write is cause  */
-#define  SYSIO_CEAFSR_SPIO	0x1000000000000000 /* Secondary PIO is cause       */
-#define  SYSIO_CEAFSR_SDRD	0x0800000000000000 /* Secondary DVMA read is cause */
-#define  SYSIO_CEAFSR_SDWR	0x0400000000000000 /* Secondary DVMA write is cause*/
-#define  SYSIO_CEAFSR_RESV1	0x0300000000000000 /* Reserved                     */
-#define  SYSIO_CEAFSR_ESYND	0x00ff000000000000 /* Syndrome Bits                */
-#define  SYSIO_CEAFSR_DOFF	0x0000e00000000000 /* Double Offset                */
-#define  SYSIO_CEAFSR_SIZE	0x00001c0000000000 /* Bad transfer size is 2**SIZE */
-#define  SYSIO_CEAFSR_MID	0x000003e000000000 /* UPA MID causing the fault    */
-#define  SYSIO_CEAFSR_RESV2	0x0000001fffffffff /* Reserved                     */
+#define  SYSIO_CEAFSR_PPIO  0x8000000000000000UL /* Primary PIO cause         */
+#define  SYSIO_CEAFSR_PDRD  0x4000000000000000UL /* Primary DVMA read cause   */
+#define  SYSIO_CEAFSR_PDWR  0x2000000000000000UL /* Primary DVMA write cause  */
+#define  SYSIO_CEAFSR_SPIO  0x1000000000000000UL /* Secondary PIO cause       */
+#define  SYSIO_CEAFSR_SDRD  0x0800000000000000UL /* Secondary DVMA read cause */
+#define  SYSIO_CEAFSR_SDWR  0x0400000000000000UL /* Secondary DVMA write cause*/
+#define  SYSIO_CEAFSR_RESV1 0x0300000000000000UL /* Reserved                  */
+#define  SYSIO_CEAFSR_ESYND 0x00ff000000000000UL /* Syndrome Bits             */
+#define  SYSIO_CEAFSR_DOFF  0x0000e00000000000UL /* Double Offset             */
+#define  SYSIO_CEAFSR_SIZE  0x00001c0000000000UL /* Bad transfer size 2^SIZE  */
+#define  SYSIO_CEAFSR_MID   0x000003e000000000UL /* UPA MID causing the fault */
+#define  SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_ce_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct sbus_bus *sbus = dev_id;
@@ -958,18 +958,18 @@
 
 #define SYSIO_SBUS_AFSR		0x2010UL
 #define SYSIO_SBUS_AFAR		0x2018UL
-#define  SYSIO_SBAFSR_PLE	0x8000000000000000 /* Primary Late PIO Error       */
-#define  SYSIO_SBAFSR_PTO	0x4000000000000000 /* Primary SBUS Timeout         */
-#define  SYSIO_SBAFSR_PBERR	0x2000000000000000 /* Primary SBUS Error ACK       */
-#define  SYSIO_SBAFSR_SLE	0x1000000000000000 /* Secondary Late PIO Error     */
-#define  SYSIO_SBAFSR_STO	0x0800000000000000 /* Secondary SBUS Timeout       */
-#define  SYSIO_SBAFSR_SBERR	0x0400000000000000 /* Secondary SBUS Error ACK     */
-#define  SYSIO_SBAFSR_RESV1	0x03ff000000000000 /* Reserved                     */
-#define  SYSIO_SBAFSR_RD	0x0000800000000000 /* Primary was late PIO read    */
-#define  SYSIO_SBAFSR_RESV2	0x0000600000000000 /* Reserved                     */
-#define  SYSIO_SBAFSR_SIZE	0x00001c0000000000 /* Size of transfer             */
-#define  SYSIO_SBAFSR_MID	0x000003e000000000 /* MID causing the error        */
-#define  SYSIO_SBAFSR_RESV3	0x0000001fffffffff /* Reserved                     */
+#define  SYSIO_SBAFSR_PLE   0x8000000000000000UL /* Primary Late PIO Error    */
+#define  SYSIO_SBAFSR_PTO   0x4000000000000000UL /* Primary SBUS Timeout      */
+#define  SYSIO_SBAFSR_PBERR 0x2000000000000000UL /* Primary SBUS Error ACK    */
+#define  SYSIO_SBAFSR_SLE   0x1000000000000000UL /* Secondary Late PIO Error  */
+#define  SYSIO_SBAFSR_STO   0x0800000000000000UL /* Secondary SBUS Timeout    */
+#define  SYSIO_SBAFSR_SBERR 0x0400000000000000UL /* Secondary SBUS Error ACK  */
+#define  SYSIO_SBAFSR_RESV1 0x03ff000000000000UL /* Reserved                  */
+#define  SYSIO_SBAFSR_RD    0x0000800000000000UL /* Primary was late PIO read */
+#define  SYSIO_SBAFSR_RESV2 0x0000600000000000UL /* Reserved                  */
+#define  SYSIO_SBAFSR_SIZE  0x00001c0000000000UL /* Size of transfer          */
+#define  SYSIO_SBAFSR_MID   0x000003e000000000UL /* MID causing the error     */
+#define  SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct sbus_bus *sbus = dev_id;
@@ -1030,9 +1030,9 @@
 }
 
 #define ECC_CONTROL	0x0020UL
-#define  SYSIO_ECNTRL_ECCEN	0x8000000000000000 /* Enable ECC Checking          */
-#define  SYSIO_ECNTRL_UEEN	0x4000000000000000 /* Enable UE Interrupts         */
-#define  SYSIO_ECNTRL_CEEN	0x2000000000000000 /* Enable CE Interrupts         */
+#define  SYSIO_ECNTRL_ECCEN	0x8000000000000000UL /* Enable ECC Checking   */
+#define  SYSIO_ECNTRL_UEEN	0x4000000000000000UL /* Enable UE Interrupts  */
+#define  SYSIO_ECNTRL_CEEN	0x2000000000000000UL /* Enable CE Interrupts  */
 
 #define SYSIO_UE_INO		0x34
 #define SYSIO_CE_INO		0x35
diff -Nru a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
--- a/arch/sparc64/kernel/setup.c	Tue Jun 15 22:20:39 2004
+++ b/arch/sparc64/kernel/setup.c	Tue Jun 15 22:20:39 2004
@@ -293,7 +293,7 @@
 		unsigned long tte;
 
 		tte = args[3];
-		prom_printf("%lx ", (tte & 0x07FC000000000000) >> 50);
+		prom_printf("%lx ", (tte & 0x07FC000000000000UL) >> 50);
 
 		args[2] = 2;
 		args[args[1] + 3] = 0;
diff -Nru a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
--- a/arch/sparc64/kernel/signal.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc64/kernel/signal.c	Tue Jun 15 22:20:41 2004
@@ -42,7 +42,8 @@
 /* {set, get}context() needed for 64-bit SparcLinux userland. */
 asmlinkage void sparc64_set_context(struct pt_regs *regs)
 {
-	struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
+	struct ucontext __user *ucp = (struct ucontext __user *)
+		regs->u_regs[UREG_I0];
 	mc_gregset_t __user *grp;
 	unsigned long pc, npc, tstate;
 	unsigned long fp, i7;
@@ -139,7 +140,8 @@
 
 asmlinkage void sparc64_get_context(struct pt_regs *regs)
 {
-	struct ucontext *ucp = (struct ucontext __user *) regs->u_regs[UREG_I0];
+	struct ucontext __user *ucp = (struct ucontext __user *)
+		regs->u_regs[UREG_I0];
 	mc_gregset_t __user *grp;
 	mcontext_t __user *mcp;
 	unsigned long fp, i7;
@@ -427,7 +429,7 @@
 	   call it and ignore errors.  */
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	do_sigaltstack(&st, NULL, (unsigned long)sf);
+	do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
 	set_fs(old_fs);
 
 	sigdelsetmask(&set, ~_BLOCKABLE);
diff -Nru a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
--- a/arch/sparc64/kernel/signal32.c	Tue Jun 15 22:20:35 2004
+++ b/arch/sparc64/kernel/signal32.c	Tue Jun 15 22:20:35 2004
@@ -345,8 +345,10 @@
 	current_thread_info()->restart_block.fn = do_no_restart_syscall;
 
 	synchronize_user_stack();
-	if (test_thread_flag(TIF_NEWSIGNALS))
-		return do_new_sigreturn32(regs);
+	if (test_thread_flag(TIF_NEWSIGNALS)) {
+		do_new_sigreturn32(regs);
+		return;
+	}
 
 	scptr = (struct sigcontext32 __user *)
 		(regs->u_regs[UREG_I0] & 0x00000000ffffffffUL);
@@ -469,7 +471,7 @@
 	   call it and ignore errors.  */
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	do_sigaltstack(&st, NULL, (unsigned long)sf);
+	do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf);
 	set_fs(old_fs);
 	
 	switch (_NSIG_WORDS) {
@@ -1039,7 +1041,7 @@
 	   call it and ignore errors.  */
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	do_sigaltstack(&st, NULL, regs->u_regs[UREG_I6]);
+	do_sigaltstack((stack_t __user *) &st, NULL, regs->u_regs[UREG_I6]);
 	set_fs(old_fs);
 	
 	sigdelsetmask(&set, ~_BLOCKABLE);
@@ -1347,7 +1349,7 @@
 	return ret;
 }
 
-asmlinkage int do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp)
+asmlinkage long do_sys32_sigaltstack(u32 ussa, u32 uossa, unsigned long sp)
 {
 	stack_t uss, uoss;
 	u32 u_ss_sp = 0;
@@ -1361,7 +1363,8 @@
 	uss.ss_sp = (void *) (long) u_ss_sp;
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	ret = do_sigaltstack(ussa ? &uss : NULL, uossa ? &uoss : NULL, sp);
+	ret = do_sigaltstack(ussa ? (stack_t __user *) &uss : NULL,
+			     uossa ? (stack_t __user *) &uoss : NULL, sp);
 	set_fs(old_fs);
 	if (!ret && uossa && (put_user((long)uoss.ss_sp, &((stack_t32 __user *)(long)uossa)->ss_sp) ||
 		    __put_user(uoss.ss_flags, &((stack_t32 __user *)(long)uossa)->ss_flags) ||
diff -Nru a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
--- a/arch/sparc64/kernel/smp.c	Tue Jun 15 22:20:35 2004
+++ b/arch/sparc64/kernel/smp.c	Tue Jun 15 22:20:35 2004
@@ -547,15 +547,18 @@
 static void smp_cross_call_masked(unsigned long *func, u32 ctx, u64 data1, u64 data2, cpumask_t mask)
 {
 	u64 data0 = (((u64)ctx)<<32 | (((u64)func) & 0xffffffff));
+	int this_cpu = get_cpu();
 
 	cpus_and(mask, mask, cpu_online_map);
-	cpu_clear(smp_processor_id(), mask);
+	cpu_clear(this_cpu, mask);
 
 	if (tlb_type == spitfire)
 		spitfire_xcall_deliver(data0, data1, data2, mask);
 	else
 		cheetah_xcall_deliver(data0, data1, data2, mask);
 	/* NOTE: Caller runs local copy on master. */
+
+	put_cpu();
 }
 
 extern unsigned long xcall_sync_tick;
@@ -598,6 +601,9 @@
 	if (!cpus)
 		return 0;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data.func = func;
 	data.info = info;
 	atomic_set(&data.finished, 0);
@@ -682,11 +688,12 @@
 void smp_flush_dcache_page_impl(struct page *page, int cpu)
 {
 	cpumask_t mask = cpumask_of_cpu(cpu);
+	int this_cpu = get_cpu();
 
 #ifdef CONFIG_DEBUG_DCFLUSH
 	atomic_inc(&dcpage_flushes);
 #endif
-	if (cpu == smp_processor_id()) {
+	if (cpu == this_cpu) {
 		__local_flush_dcache_page(page);
 	} else if (cpu_online(cpu)) {
 		u64 data0;
@@ -711,14 +718,17 @@
 		atomic_inc(&dcpage_flushes_xcall);
 #endif
 	}
+
+	put_cpu();
 }
 
 void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
 {
 	cpumask_t mask = cpu_online_map;
 	u64 data0;
+	int this_cpu = get_cpu();
 
-	cpu_clear(smp_processor_id(), mask);
+	cpu_clear(this_cpu, mask);
 
 #ifdef CONFIG_DEBUG_DCFLUSH
 	atomic_inc(&dcpage_flushes);
@@ -744,6 +754,8 @@
 #endif
  flush_self:
 	__local_flush_dcache_page(page);
+
+	put_cpu();
 }
 
 void smp_receive_signal(int cpu)
@@ -839,7 +851,7 @@
 
 	{
 		u32 ctx = CTX_HWBITS(mm->context);
-		int cpu = smp_processor_id();
+		int cpu = get_cpu();
 
 		if (atomic_read(&mm->mm_users) == 1) {
 			/* See smp_flush_tlb_page for info about this. */
@@ -853,6 +865,8 @@
 
 	local_flush_and_out:
 		__flush_tlb_mm(ctx, SECONDARY_CONTEXT);
+
+		put_cpu();
 	}
 }
 
@@ -860,7 +874,7 @@
 			 unsigned long end)
 {
 	u32 ctx = CTX_HWBITS(mm->context);
-	int cpu = smp_processor_id();
+	int cpu = get_cpu();
 
 	start &= PAGE_MASK;
 	end    = PAGE_ALIGN(end);
@@ -877,6 +891,8 @@
  local_flush_and_out:
 	__flush_tlb_range(ctx, start, SECONDARY_CONTEXT,
 			  end, PAGE_SIZE, (end-start));
+
+	put_cpu();
 }
 
 void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end)
@@ -895,7 +911,7 @@
 {
 	{
 		u32 ctx = CTX_HWBITS(mm->context);
-		int cpu = smp_processor_id();
+		int cpu = get_cpu();
 
 		page &= PAGE_MASK;
 		if (mm == current->active_mm &&
@@ -935,6 +951,8 @@
 
 	local_flush_and_out:
 		__flush_tlb_page(ctx, page, SECONDARY_CONTEXT);
+
+		put_cpu();
 	}
 }
 
@@ -1108,11 +1126,6 @@
 	boot_cpu_id = hard_smp_processor_id();
 	current_tick_offset = timer_tick_offset;
 
-	if (boot_cpu_id >= NR_CPUS) {
-		prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
-		prom_halt();
-	}
-
 	cpu_set(boot_cpu_id, cpu_online_map);
 	prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1;
 }
@@ -1254,6 +1267,11 @@
 
 void __devinit smp_prepare_boot_cpu(void)
 {
+	if (hard_smp_processor_id() >= NR_CPUS) {
+		prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
+		prom_halt();
+	}
+
 	current_thread_info()->cpu = hard_smp_processor_id();
 	cpu_set(smp_processor_id(), cpu_online_map);
 	cpu_set(smp_processor_id(), phys_cpu_present_map);
diff -Nru a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
--- a/arch/sparc64/kernel/sparc64_ksyms.c	Tue Jun 15 22:20:44 2004
+++ b/arch/sparc64/kernel/sparc64_ksyms.c	Tue Jun 15 22:20:44 2004
@@ -106,6 +106,7 @@
 extern void _do_read_unlock(rwlock_t *rw, char *str);
 extern void _do_write_lock(rwlock_t *rw, char *str);
 extern void _do_write_unlock(rwlock_t *rw);
+extern int _do_write_trylock(rwlock_t *rw, char *str);
 #endif
 
 extern unsigned long phys_base;
@@ -133,6 +134,8 @@
 EXPORT_SYMBOL(__write_lock);
 EXPORT_SYMBOL(__write_unlock);
 EXPORT_SYMBOL(__write_trylock);
+/* Out of line spin-locking implementation. */
+EXPORT_SYMBOL(_raw_spin_lock_flags);
 #endif
 
 /* Hard IRQ locking */
@@ -156,6 +159,7 @@
 EXPORT_SYMBOL(_do_read_unlock);
 EXPORT_SYMBOL(_do_write_lock);
 EXPORT_SYMBOL(_do_write_unlock);
+EXPORT_SYMBOL(_do_write_trylock);
 #endif
 
 EXPORT_SYMBOL(smp_call_function);
@@ -184,6 +188,11 @@
 EXPORT_SYMBOL(___test_and_change_bit);
 EXPORT_SYMBOL(___test_and_set_le_bit);
 EXPORT_SYMBOL(___test_and_clear_le_bit);
+
+/* Bit searching */
+EXPORT_SYMBOL(find_next_bit);
+EXPORT_SYMBOL(find_next_zero_bit);
+EXPORT_SYMBOL(find_next_zero_le_bit);
 
 EXPORT_SYMBOL(ivector_table);
 EXPORT_SYMBOL(enable_irq);
diff -Nru a/arch/sparc64/kernel/sunos_ioctl32.c b/arch/sparc64/kernel/sunos_ioctl32.c
--- a/arch/sparc64/kernel/sunos_ioctl32.c	Tue Jun 15 22:21:03 2004
+++ b/arch/sparc64/kernel/sunos_ioctl32.c	Tue Jun 15 22:21:03 2004
@@ -26,15 +26,6 @@
 #include <linux/compat.h>
 #include <asm/kbio.h>
 
-/* Use this to get at 32-bit user passed pointers. */
-#define A(__x)				\
-({	unsigned long __ret;		\
-	__asm__ ("srl	%0, 0, %0"	\
-		 : "=r" (__ret)		\
-		 : "0" (__x));		\
-	__ret;				\
-})
-
 #define SUNOS_NR_OPEN	256
 
 struct rtentry32 {
@@ -104,10 +95,11 @@
 
 	if(cmd == TIOCSETD) {
 		mm_segment_t old_fs = get_fs();
-		int *p, ntty = N_TTY;
+		int __user *p;
+		int ntty = N_TTY;
 		int tmp;
 
-		p = (int *)A(arg);
+		p = (int __user *) (unsigned long) arg;
 		ret = -EFAULT;
 		if(get_user(tmp, p))
 			goto out;
@@ -237,10 +229,10 @@
 
 	/* Non posix grp */
 	case _IOW('t', 118, int): {
-		int oldval, newval, *ptr;
+		int oldval, newval, __user *ptr;
 
 		cmd = TIOCSPGRP;
-		ptr = (int *) A(arg);
+		ptr = (int __user *) (unsigned long) arg;
 		ret = -EFAULT;
 		if(get_user(oldval, ptr))
 			goto out;
@@ -256,10 +248,10 @@
 	}
 
 	case _IOR('t', 119, int): {
-		int oldval, newval, *ptr;
+		int oldval, newval, __user *ptr;
 
 		cmd = TIOCGPGRP;
-		ptr = (int *) A(arg);
+		ptr = (int __user *) (unsigned long) arg;
 		ret = -EFAULT;
 		if(get_user(oldval, ptr))
 			goto out;
diff -Nru a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S
--- a/arch/sparc64/kernel/sys32.S	Tue Jun 15 22:20:37 2004
+++ b/arch/sparc64/kernel/sys32.S	Tue Jun 15 22:20:37 2004
@@ -6,79 +6,142 @@
  * Copyright (C) 1998 Jakub Jelinek   (jj@ultra.linux.cz)
  */
 
+#include <linux/config.h>
 #include <asm/errno.h>
 
 /* NOTE: call as jump breaks return stack, we have to avoid that */
 
 	.text
 
-	.align		32
-	.globl		sys32_mmap
-sys32_mmap:
-	srl		%o4, 0, %o4
-	sethi		%hi(sys_mmap), %g1
-	jmpl		%g1 + %lo(sys_mmap), %g0
-	 srl		%o5, 0, %o5
+#define SIGN1(STUB,SYSCALL,REG1) \
+	.align	32; \
+	.globl	STUB; \
+STUB:	sethi	%hi(SYSCALL), %g1; \
+	jmpl	%g1 + %lo(SYSCALL), %g0; \
+	sra	REG1, 0, REG1
 
-	.align		32
-	.globl		sys32_lseek
-	.globl		sys32_chmod, sys32_mknod
-sys32_lseek:
-	sra		%o1, 0, %o1
-	sethi		%hi(sys_lseek), %g1
-	jmpl		%g1 + %lo(sys_lseek), %g0
-	 nop
-sys32_chmod:
-	sethi		%hi(0xffff), %g2
-	sethi		%hi(sys_chmod), %g1
-	orcc		%g2, %lo(0xffff), %g2
-	jmpl		%g1 + %lo(sys_chmod), %g0
-	 and		%o1, %g2, %o1
-sys32_mknod:
-	sethi		%hi(0xffff), %g2
-	sethi		%hi(sys_mknod), %g1
-	orcc		%g2, %lo(0xffff), %g2
-	jmpl		%g1 + %lo(sys_mknod), %g0
-	 and		%o2, %g2, %o2
+#define SIGN2(STUB,SYSCALL,REG1,REG2) \
+	.align	32; \
+	.globl	STUB; \
+STUB:	sethi	%hi(SYSCALL), %g1; \
+	sra	REG1, 0, REG1; \
+	jmpl	%g1 + %lo(SYSCALL), %g0; \
+	sra	REG2, 0, REG2
 
-	.align		32
-	.globl		sys32_sendto, sys32_recvfrom
-sys32_sendto:
-	sethi		%hi(sys_sendto), %g1
-	jmpl		%g1 + %lo(sys_sendto), %g0
-	 srl		%o4, 0, %o4
-sys32_recvfrom:
-	srl		%o4, 0, %o4
-	sethi		%hi(sys_recvfrom), %g1
-	jmpl		%g1 + %lo(sys_recvfrom), %g0
-	 srl		%o5, 0, %o5
+#define SIGN3(STUB,SYSCALL,REG1,REG2,REG3) \
+	.align	32; \
+	.globl	STUB; \
+STUB:	sra	REG1, 0, REG1; \
+	sethi	%hi(SYSCALL), %g1; \
+	sra	REG2, 0, REG2; \
+	jmpl	%g1 + %lo(SYSCALL), %g0; \
+	sra	REG3, 0, REG3
 
-	.globl		sys32_bdflush
-sys32_bdflush:
-	sethi		%hi(sys_bdflush), %g1
-	jmpl		%g1 + %lo(sys_bdflush), %g0
-	 sra		%o1, 0, %o1
+#define SIGN4(STUB,SYSCALL,REG1,REG2,REG3,REG4) \
+	.align	32; \
+	.globl	STUB; \
+STUB:	sra	REG1, 0, REG1; \
+	sethi	%hi(SYSCALL), %g1; \
+	sra	REG2, 0, REG2; \
+	sra	REG3, 0, REG3; \
+	jmpl	%g1 + %lo(SYSCALL), %g0; \
+	sra	REG4, 0, REG4
+
+SIGN1(sys32_exit, sparc_exit, %o0)
+SIGN1(sys32_exit_group, sys_exit_group, %o0)
+SIGN1(sys32_wait4, compat_sys_wait4, %o2)
+SIGN1(sys32_creat, sys_creat, %o1)
+SIGN1(sys32_mknod, sys_mknod, %o1)
+SIGN1(sys32_perfctr, sys_perfctr, %o0)
+SIGN1(sys32_umount, sys_umount, %o1)
+SIGN1(sys32_signal, sys_signal, %o0)
+SIGN1(sys32_access, sys_access, %o1)
+SIGN1(sys32_msync, sys_msync, %o2)
+SIGN2(sys32_reboot, sys_reboot, %o0, %o1)
+SIGN1(sys32_setitimer, compat_sys_setitimer, %o0)
+SIGN1(sys32_getitimer, compat_sys_getitimer, %o0)
+SIGN1(sys32_sethostname, sys_sethostname, %o1)
+SIGN1(sys32_swapon, sys_swapon, %o1)
+SIGN1(sys32_sigaction, compat_sys_sigaction, %o0)
+SIGN1(sys32_rt_sigaction, compat_sys_rt_sigaction, %o0)
+SIGN1(sys32_sigprocmask, compat_sys_sigprocmask, %o0)
+SIGN1(sys32_rt_sigprocmask, compat_sys_rt_sigprocmask, %o0)
+SIGN2(sys32_rt_sigqueueinfo, compat_sys_rt_sigqueueinfo, %o0, %o1)
+SIGN1(sys32_getrusage, compat_sys_getrusage, %o0)
+SIGN1(sys32_setxattr, sys_setxattr, %o4)
+SIGN1(sys32_lsetxattr, sys_lsetxattr, %o4)
+SIGN1(sys32_fsetxattr, sys_fsetxattr, %o4)
+SIGN1(sys32_fgetxattr, sys_fgetxattr, %o0)
+SIGN1(sys32_flistxattr, sys_flistxattr, %o0)
+SIGN1(sys32_fremovexattr, sys_fremovexattr, %o0)
+SIGN2(sys32_tkill, sys_tkill, %o0, %o1)
+SIGN1(sys32_epoll_create, sys_epoll_create, %o0)
+SIGN3(sys32_epoll_ctl, sys_epoll_ctl, %o0, %o1, %o2)
+SIGN3(sys32_epoll_wait, sys_epoll_wait, %o0, %o2, %o3)
+SIGN1(sys32_readahead, compat_sys_readahead, %o0)
+SIGN2(sys32_fadvise64, compat_sys_fadvise64, %o0, %o4)
+SIGN2(sys32_fadvise64_64, compat_sys_fadvise64_64, %o0, %o5)
+SIGN2(sys32_bdflush, sys_bdflush, %o0, %o1)
+SIGN1(sys32_mlockall, sys_mlockall, %o0)
+SIGN1(sys32_nfsservctl, compat_sys_nfsservctl, %o0)
+SIGN1(sys32_clock_settime, compat_clock_settime, %o1)
+SIGN1(sys32_clock_nanosleep, compat_clock_nanosleep, %o1)
+SIGN1(sys32_timer_settime, compat_timer_settime, %o1)
+SIGN1(sys32_io_submit, compat_sys_io_submit, %o1)
+SIGN1(sys32_mq_open, compat_sys_mq_open, %o1)
+SIGN1(sys32_select, compat_sys_select, %o0)
+SIGN1(sys32_mkdir, sys_mkdir, %o1)
+SIGN3(sys32_futex, compat_sys_futex, %o1, %o2, %o5)
+SIGN1(sys32_sysfs, compat_sys_sysfs, %o0)
+SIGN3(sys32_ipc, compat_sys_ipc, %o1, %o2, %o3)
+SIGN2(sys32_sendfile, compat_sys_sendfile, %o0, %o1)
+SIGN2(sys32_sendfile64, compat_sys_sendfile64, %o0, %o1)
+SIGN1(sys32_prctl, sys_prctl, %o0)
+SIGN1(sys32_sched_rr_get_interval, compat_sys_sched_rr_get_interval, %o0)
+SIGN2(sys32_waitpid, sys_waitpid, %o0, %o2)
+SIGN1(sys32_getgroups, sys_getgroups, %o0)
+SIGN1(sys32_getpgid, sys_getpgid, %o0)
+SIGN2(sys32_getpriority, sys_getpriority, %o0, %o1)
+SIGN1(sys32_getsid, sys_getsid, %o0)
+SIGN2(sys32_kill, sys_kill, %o0, %o1)
+SIGN1(sys32_nice, sys_nice, %o0)
+SIGN1(sys32_lseek, sys_lseek, %o1)
+SIGN2(sys32_open, sparc32_open, %o1, %o2)
+SIGN1(sys32_readlink, sys_readlink, %o2)
+SIGN1(sys32_sched_get_priority_max, sys_sched_get_priority_max, %o0)
+SIGN1(sys32_sched_get_priority_min, sys_sched_get_priority_min, %o0)
+SIGN1(sys32_sched_getparam, sys_sched_getparam, %o0)
+SIGN1(sys32_sched_getscheduler, sys_sched_getscheduler, %o0)
+SIGN1(sys32_sched_setparam, sys_sched_setparam, %o0)
+SIGN2(sys32_sched_setscheduler, sys_sched_setscheduler, %o0, %o1)
+SIGN1(sys32_getdomainname, sys_getdomainname, %o1)
+SIGN1(sys32_setdomainname, sys_setdomainname, %o1)
+SIGN1(sys32_setgroups, sys_setgroups, %o0)
+SIGN2(sys32_setpgid, sys_setpgid, %o0, %o1)
+SIGN3(sys32_setpriority, sys_setpriority, %o0, %o1, %o2)
+SIGN1(sys32_ssetmask, sys_ssetmask, %o0)
+SIGN2(sys32_syslog, sys_syslog, %o0, %o1)
+SIGN1(sys32_umask, sys_umask, %o0)
+SIGN3(sys32_tgkill, sys_tgkill, %o0, %o1, %o2)
+SIGN1(sys32_sendto, sys_sendto, %o0)
+SIGN1(sys32_recvfrom, sys_recvfrom, %o0)
+SIGN3(sys32_socket, sys_socket, %o0, %o1, %o2)
+SIGN2(sys32_connect, sys_connect, %o0, %o2)
+SIGN2(sys32_bind, sys_bind, %o0, %o2)
+SIGN2(sys32_listen, sys_listen, %o0, %o1)
+SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0)
+SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0)
+SIGN2(sys32_shutdown, sys_shutdown, %o0, %o1)
+SIGN3(sys32_socketpair, sys_socketpair, %o0, %o1, %o2)
+SIGN1(sys32_getpeername, sys_getpeername, %o0)
+SIGN1(sys32_getsockname, sys_getsockname, %o0)
 
-	.align		32
 	.globl		sys32_mmap2
 sys32_mmap2:
-	srl		%o4, 0, %o4
 	sethi		%hi(sys_mmap), %g1
-	srl		%o5, 0, %o5
 	jmpl		%g1 + %lo(sys_mmap), %g0
 	 sllx		%o5, 12, %o5
 
-	.globl		sys32_mq_timedsend
-sys32_mq_timedsend:
-	sethi		%hi(compat_sys_mq_timedsend), %g1
-	jmpl		%g1 + %lo(compat_sys_mq_timedsend), %g0
-	 srl		%o4, 0, %o4
-	.globl		sys32_mq_timedreceive
-sys32_mq_timedreceive:
-	sethi		%hi(compat_sys_mq_timedreceive), %g1
-	jmpl		%g1 + %lo(compat_sys_mq_timedreceive), %g0
-	 srl		%o4, 0, %o4
-
 	.align		32
 	.globl		sys32_socketcall
 sys32_socketcall:	/* %o0=call, %o1=args */
@@ -186,23 +249,23 @@
 	 lduwa		[%o1 + 0x4] %asi, %o1
 	nop
 	nop
-do_sys_sendto: /* sys32_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
+do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
 	ldswa		[%o1 + 0x0] %asi, %o0
-	sethi		%hi(sys32_sendto), %g1
+	sethi		%hi(sys_sendto), %g1
 	lduwa		[%o1 + 0x8] %asi, %o2
 	lduwa		[%o1 + 0xc] %asi, %o3
 	lduwa		[%o1 + 0x10] %asi, %o4
 	ldswa		[%o1 + 0x14] %asi, %o5
-	jmpl		%g1 + %lo(sys32_sendto), %g0
+	jmpl		%g1 + %lo(sys_sendto), %g0
 	 lduwa		[%o1 + 0x4] %asi, %o1
-do_sys_recvfrom: /* sys32_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
+do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
 	ldswa		[%o1 + 0x0] %asi, %o0
-	sethi		%hi(sys32_recvfrom), %g1
+	sethi		%hi(sys_recvfrom), %g1
 	lduwa		[%o1 + 0x8] %asi, %o2
 	lduwa		[%o1 + 0xc] %asi, %o3
 	lduwa		[%o1 + 0x10] %asi, %o4
 	lduwa		[%o1 + 0x14] %asi, %o5
-	jmpl		%g1 + %lo(sys32_recvfrom), %g0
+	jmpl		%g1 + %lo(sys_recvfrom), %g0
 	 lduwa		[%o1 + 0x4] %asi, %o1
 do_sys_shutdown: /* sys_shutdown(int, int) */
 	ldswa		[%o1 + 0x0] %asi, %o0
diff -Nru a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
--- a/arch/sparc64/kernel/sys_sparc.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc64/kernel/sys_sparc.c	Tue Jun 15 22:20:41 2004
@@ -179,7 +179,7 @@
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way unix traditionally does this, though.
  */
-asmlinkage int sparc_pipe(struct pt_regs *regs)
+asmlinkage long sparc_pipe(struct pt_regs *regs)
 {
 	int fd[2];
 	int error;
@@ -199,22 +199,22 @@
  * This is really horribly ugly.
  */
 
-asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long third, void *ptr, long fifth)
+asmlinkage long sys_ipc(unsigned int call, int first, int second, unsigned long third, void __user *ptr, long fifth)
 {
 	int err;
 
 	/* No need for backward compatibility. We can start fresh... */
-
-	if (call <= SEMCTL)
+	if (call <= SEMCTL) {
 		switch (call) {
 		case SEMOP:
-			err = sys_semtimedop (first, (struct sembuf *)ptr, second, NULL);
+			err = sys_semtimedop(first, ptr, second, NULL);
 			goto out;
 		case SEMTIMEDOP:
-			err = sys_semtimedop (first, (struct sembuf *)ptr, second, (const struct timespec *) fifth);
+			err = sys_semtimedop(first, ptr, second,
+				(const struct timespec __user *) fifth);
 			goto out;
 		case SEMGET:
-			err = sys_semget (first, second, (int)third);
+			err = sys_semget(first, second, (int)third);
 			goto out;
 		case SEMCTL: {
 			union semun fourth;
@@ -222,79 +222,87 @@
 			if (!ptr)
 				goto out;
 			err = -EFAULT;
-			if(get_user(fourth.__pad, (void **)ptr))
+			if (get_user(fourth.__pad,
+				     (void __user * __user *) ptr))
 				goto out;
-			err = sys_semctl (first, second | IPC_64, (int)third, fourth);
+			err = sys_semctl(first, second | IPC_64,
+					 (int)third, fourth);
 			goto out;
-			}
+		}
 		default:
 			err = -ENOSYS;
 			goto out;
-		}
-	if (call <= MSGCTL) 
+		};
+	}
+	if (call <= MSGCTL) {
 		switch (call) {
 		case MSGSND:
-			err = sys_msgsnd (first, (struct msgbuf *) ptr, 
-					  second, (int)third);
+			err = sys_msgsnd(first, ptr, second, (int)third);
 			goto out;
 		case MSGRCV:
-			err = sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, (int)third);
+			err = sys_msgrcv(first, ptr, second, fifth,
+					 (int)third);
 			goto out;
 		case MSGGET:
-			err = sys_msgget ((key_t) first, second);
+			err = sys_msgget((key_t) first, second);
 			goto out;
 		case MSGCTL:
-			err = sys_msgctl (first, second | IPC_64, (struct msqid_ds *) ptr);
+			err = sys_msgctl(first, second | IPC_64, ptr);
 			goto out;
 		default:
 			err = -ENOSYS;
 			goto out;
-		}
-	if (call <= SHMCTL) 
+		};
+	}
+	if (call <= SHMCTL) {
 		switch (call) {
 		case SHMAT: {
 			ulong raddr;
-			err = do_shmat (first, (char *) ptr, second, &raddr);
+			err = do_shmat(first, ptr, second, &raddr);
 			if (!err) {
-				if (put_user(raddr, (ulong __user *) third))
+				if (put_user(raddr,
+					     (ulong __user *) third))
 					err = -EFAULT;
 			}
 			goto out;
 		}
 		case SHMDT:
-			err = sys_shmdt ((char *)ptr);
+			err = sys_shmdt(ptr);
 			goto out;
 		case SHMGET:
-			err = sys_shmget (first, second, (int)third);
+			err = sys_shmget(first, second, (int)third);
 			goto out;
 		case SHMCTL:
-			err = sys_shmctl (first, second | IPC_64, (struct shmid_ds *) ptr);
+			err = sys_shmctl(first, second | IPC_64, ptr);
 			goto out;
 		default:
 			err = -ENOSYS;
 			goto out;
-		}
-	else
+		};
+	} else {
 		err = -ENOSYS;
+	}
 out:
 	return err;
 }
 
-asmlinkage int sparc64_newuname(struct new_utsname __user *name)
+asmlinkage long sparc64_newuname(struct new_utsname __user *name)
 {
 	int ret = sys_newuname(name);
 	
 	if (current->personality == PER_LINUX32 && !ret) {
-		ret = copy_to_user(name->machine, "sparc\0\0", 8) ? -EFAULT : 0;
+		ret = (copy_to_user(name->machine, "sparc\0\0", 8)
+		       ? -EFAULT : 0);
 	}
 	return ret;
 }
 
-asmlinkage int sparc64_personality(unsigned long personality)
+asmlinkage long sparc64_personality(unsigned long personality)
 {
 	int ret;
 
-	if (current->personality == PER_LINUX32 && personality == PER_LINUX)
+	if (current->personality == PER_LINUX32 &&
+	    personality == PER_LINUX)
 		personality = PER_LINUX32;
 	ret = sys_personality(personality);
 	if (ret == PER_LINUX32)
@@ -408,8 +416,7 @@
 }
 
 /* we come to here via sys_nis_syscall so it can setup the regs argument */
-asmlinkage unsigned long
-c_sys_nis_syscall (struct pt_regs *regs)
+asmlinkage unsigned long c_sys_nis_syscall(struct pt_regs *regs)
 {
 	static int count;
 	
@@ -427,8 +434,7 @@
 
 /* #define DEBUG_SPARC_BREAKPOINT */
 
-asmlinkage void
-sparc_breakpoint (struct pt_regs *regs)
+asmlinkage void sparc_breakpoint(struct pt_regs *regs)
 {
 	siginfo_t info;
 
@@ -452,7 +458,7 @@
 
 extern void check_pending(int signum);
 
-asmlinkage int sys_getdomainname(char __user *name, int len)
+asmlinkage long sys_getdomainname(char __user *name, int len)
 {
         int nlen;
 	int err = -EFAULT;
@@ -473,7 +479,7 @@
 	return err;
 }
 
-asmlinkage int solaris_syscall(struct pt_regs *regs)
+asmlinkage long solaris_syscall(struct pt_regs *regs)
 {
 	static int count;
 
@@ -493,7 +499,7 @@
 }
 
 #ifndef CONFIG_SUNOS_EMUL
-asmlinkage int sunos_syscall(struct pt_regs *regs)
+asmlinkage long sunos_syscall(struct pt_regs *regs)
 {
 	static int count;
 
@@ -511,11 +517,11 @@
 }
 #endif
 
-asmlinkage int sys_utrap_install(utrap_entry_t type,
-				 utrap_handler_t new_p,
-				 utrap_handler_t new_d,
-				 utrap_handler_t __user *old_p,
-				 utrap_handler_t __user *old_d)
+asmlinkage long sys_utrap_install(utrap_entry_t type,
+				  utrap_handler_t new_p,
+				  utrap_handler_t new_d,
+				  utrap_handler_t __user *old_p,
+				  utrap_handler_t __user *old_d)
 {
 	if (type < UT_INSTRUCTION_EXCEPTION || type > UT_TRAP_INSTRUCTION_31)
 		return -EINVAL;
@@ -582,12 +588,11 @@
 	return 0;
 }
 
-asmlinkage long
-sys_rt_sigaction(int sig,
-		const struct sigaction __user *act,
-		struct sigaction __user *oact,
-		void __user *restorer,
-		size_t sigsetsize)
+asmlinkage long sys_rt_sigaction(int sig,
+				 const struct sigaction __user *act,
+				 struct sigaction __user *oact,
+				 void __user *restorer,
+				 size_t sigsetsize)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -615,8 +620,7 @@
 /* Invoked by rtrap code to update performance counters in
  * user space.
  */
-asmlinkage void
-update_perfctrs(void)
+asmlinkage void update_perfctrs(void)
 {
 	unsigned long pic, tmp;
 
@@ -628,16 +632,15 @@
 	reset_pic();
 }
 
-asmlinkage int
-sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2)
+asmlinkage long sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2)
 {
 	int err = 0;
 
 	switch(opcode) {
 	case PERFCTR_ON:
 		current_thread_info()->pcr_reg = arg2;
-		current_thread_info()->user_cntd0 = (u64 *) arg0;
-		current_thread_info()->user_cntd1 = (u64 *) arg1;
+		current_thread_info()->user_cntd0 = (u64 __user *) arg0;
+		current_thread_info()->user_cntd1 = (u64 __user *) arg1;
 		current_thread_info()->kernel_cntd0 =
 			current_thread_info()->kernel_cntd1 = 0;
 		write_pcr(arg2);
@@ -684,7 +687,8 @@
 		break;
 
 	case PERFCTR_SETPCR: {
-		u64 *user_pcr = (u64 *)arg0;
+		u64 __user *user_pcr = (u64 __user *)arg0;
+
 		if (!test_thread_flag(TIF_PERFCTR)) {
 			err = -EINVAL;
 			break;
@@ -698,7 +702,8 @@
 	}
 
 	case PERFCTR_GETPCR: {
-		u64 *user_pcr = (u64 *)arg0;
+		u64 __user *user_pcr = (u64 __user *)arg0;
+
 		if (!test_thread_flag(TIF_PERFCTR)) {
 			err = -EINVAL;
 			break;
diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
--- a/arch/sparc64/kernel/sys_sparc32.c	Tue Jun 15 22:20:42 2004
+++ b/arch/sparc64/kernel/sys_sparc32.c	Tue Jun 15 22:20:42 2004
@@ -62,37 +62,12 @@
 #include <asm/semaphore.h>
 #include <asm/mmu_context.h>
 
-/* Use this to get at 32-bit user passed pointers. */
-/* Things to consider: the low-level assembly stub does
-   srl x, 0, x for first four arguments, so if you have
-   pointer to something in the first four arguments, just
-   declare it as a pointer, not u32. On the other side, 
-   arguments from 5th onwards should be declared as u32
-   for pointers, and need AA() around each usage.
-   A() macro should be used for places where you e.g.
-   have some internal variable u32 and just want to get
-   rid of a compiler warning. AA() has to be used in
-   places where you want to convert a function argument
-   to 32bit pointer or when you e.g. access pt_regs
-   structure and want to consider 32bit registers only.
-   -jj
- */
-#define A(__x) ((unsigned long)(__x))
-#define AA(__x)				\
-({	unsigned long __ret;		\
-	__asm__ ("srl	%0, 0, %0"	\
-		 : "=r" (__ret)		\
-		 : "0" (__x));		\
-	__ret;				\
-})
-
- 
-asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group)
+asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
 {
 	return sys_chown(filename, low2highuid(user), low2highgid(group));
 }
 
-asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group)
+asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group)
 {
 	return sys_lchown(filename, low2highuid(user), low2highgid(group));
 }
@@ -128,7 +103,7 @@
 		low2highuid(suid));
 }
 
-asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid)
+asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid)
 {
 	int retval;
 
@@ -145,7 +120,7 @@
 		low2highgid(sgid));
 }
 
-asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid)
+asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid)
 {
 	int retval;
 
@@ -166,7 +141,7 @@
 	return sys_setfsgid((gid_t)gid);
 }
 
-static int groups16_to_user(u16 *grouplist, struct group_info *group_info)
+static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)
 {
 	int i;
 	u16 group;
@@ -180,7 +155,7 @@
 	return 0;
 }
 
-static int groups16_from_user(struct group_info *group_info, u16 *grouplist)
+static int groups16_from_user(struct group_info *group_info, u16 __user *grouplist)
 {
 	int i;
 	u16 group;
@@ -194,7 +169,7 @@
 	return 0;
 }
 
-asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist)
+asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist)
 {
 	int i;
 
@@ -218,7 +193,7 @@
 	return i;
 }
 
-asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist)
+asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
 {
 	struct group_info *group_info;
 	int retval;
@@ -265,14 +240,14 @@
 
 /* 32-bit timeval and related flotsam.  */
 
-static long get_tv32(struct timeval *o, struct compat_timeval *i)
+static long get_tv32(struct timeval *o, struct compat_timeval __user *i)
 {
 	return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) ||
 		(__get_user(o->tv_sec, &i->tv_sec) |
 		 __get_user(o->tv_usec, &i->tv_usec)));
 }
 
-static inline long put_tv32(struct compat_timeval *o, struct timeval *i)
+static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
 		(__put_user(i->tv_sec, &o->tv_sec) |
@@ -281,8 +256,7 @@
 
 struct msgbuf32 { s32 mtype; char mtext[1]; };
 
-struct ipc_perm32
-{
+struct ipc_perm32 {
 	key_t    	  key;
         compat_uid_t  uid;
         compat_gid_t  gid;
@@ -383,21 +357,22 @@
  * This is really horribly ugly.
  */
 #define IPCOP_MASK(__x)	(1UL << ((__x)&~IPC_64))
-static int do_sys32_semctl(int first, int second, int third, void *uptr)
+static int do_sys32_semctl(int first, int second, int third,
+			   compat_uptr_t __user *uptr)
 {
 	union semun fourth;
-	u32 pad;
+	compat_uptr_t pad;
 	int err = -EINVAL;
 
 	if (!uptr)
 		goto out;
 	err = -EFAULT;
-	if (get_user (pad, (u32 *)uptr))
+	if (get_user(pad, uptr))
 		goto out;
 	if ((third & ~IPC_64) == SETVAL)
 		fourth.val = (int)pad;
 	else
-		fourth.__pad = (void *)A(pad);
+		fourth.__pad = compat_ptr(pad);
 	if (IPCOP_MASK (third) &
 	    (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) |
 	     IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) |
@@ -405,7 +380,7 @@
 		err = sys_semctl (first, second, third, fourth);
 	} else if (third & IPC_64) {
 		struct semid64_ds s;
-		struct semid64_ds32 *usp = (struct semid64_ds32 *)A(pad);
+		struct semid64_ds32 __user *usp = compat_ptr(pad);
 		mm_segment_t old_fs;
 		int need_back_translation;
 
@@ -415,13 +390,13 @@
 			err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode);
 			if (err)
 				goto out;
-			fourth.__pad = &s;
+			fourth.__pad = (void __user *) &s;
 		}
 		need_back_translation =
 			(IPCOP_MASK (third) &
 			 (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
 		if (need_back_translation)
-			fourth.__pad = &s;
+			fourth.__pad = (void __user *) &s;
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
 		err = sys_semctl (first, second, third, fourth);
@@ -433,7 +408,7 @@
 		}
 	} else {
 		struct semid_ds s;
-		struct semid_ds32 *usp = (struct semid_ds32 *)A(pad);
+		struct semid_ds32 __user *usp = compat_ptr(pad);
 		mm_segment_t old_fs;
 		int need_back_translation;
 
@@ -443,13 +418,13 @@
 			err |= __get_user (s.sem_perm.mode, &usp->sem_perm.mode);
 			if (err)
 				goto out;
-			fourth.__pad = &s;
+			fourth.__pad = (void __user *) &s;
 		}
 		need_back_translation =
 			(IPCOP_MASK (third) &
 			 (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
 		if (need_back_translation)
-			fourth.__pad = &s;
+			fourth.__pad = (void __user *) &s;
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
 		err = sys_semctl (first, second, third, fourth);
@@ -472,13 +447,15 @@
 	return err;
 }
 
-static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
+static int do_sys32_msgsnd(int first, int second, int third,
+			   void __user *uptr)
 {
-	struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER);
-	struct msgbuf32 *up = (struct msgbuf32 *)uptr;
+	struct msgbuf32 __user *up = uptr;
+	struct msgbuf *p;
 	mm_segment_t old_fs;
 	int err;
 
+	p = kmalloc(second + sizeof (struct msgbuf), GFP_USER);
 	if (!p)
 		return -ENOMEM;
 	err = -EFAULT;
@@ -487,45 +464,48 @@
 		goto out;
 	old_fs = get_fs ();
 	set_fs (KERNEL_DS);
-	err = sys_msgsnd (first, p, second, third);
+	err = sys_msgsnd (first, (struct msgbuf __user *) p,
+			  second, third);
 	set_fs (old_fs);
 out:
 	kfree (p);
 	return err;
 }
 
-static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
-			    int version, void *uptr)
+static int do_sys32_msgrcv(int first, int second, int msgtyp, int third,
+			   int version, void __user *uptr)
 {
-	struct msgbuf32 *up;
+	struct msgbuf32 __user *up;
 	struct msgbuf *p;
 	mm_segment_t old_fs;
 	int err;
 
 	if (!version) {
-		struct ipc_kludge *uipck = (struct ipc_kludge *)uptr;
+		struct ipc_kludge __user *uipck = uptr;
 		struct ipc_kludge ipck;
 
 		err = -EINVAL;
 		if (!uptr)
 			goto out;
 		err = -EFAULT;
-		if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge)))
+		if (copy_from_user (&ipck, uipck,
+				    sizeof (struct ipc_kludge)))
 			goto out;
-		uptr = (void *)A(ipck.msgp);
+		uptr = compat_ptr(ipck.msgp);
 		msgtyp = ipck.msgtyp;
 	}
 	err = -ENOMEM;
-	p = kmalloc (second + sizeof (struct msgbuf), GFP_USER);
+	p = kmalloc(second + sizeof (struct msgbuf), GFP_USER);
 	if (!p)
 		goto out;
 	old_fs = get_fs ();
 	set_fs (KERNEL_DS);
-	err = sys_msgrcv (first, p, second, msgtyp, third);
+	err = sys_msgrcv (first, (struct msgbuf __user *) p, second,
+			  msgtyp, third);
 	set_fs (old_fs);
 	if (err < 0)
 		goto free_then_out;
-	up = (struct msgbuf32 *)uptr;
+	up = uptr;
 	if (put_user (p->mtype, &up->mtype) ||
 	    __copy_to_user (&up->mtext, p->mtext, err))
 		err = -EFAULT;
@@ -535,37 +515,46 @@
 	return err;
 }
 
-static int do_sys32_msgctl (int first, int second, void *uptr)
+static int do_sys32_msgctl(int first, int second, void __user *uptr)
 {
 	int err;
 
 	if (IPCOP_MASK (second) &
 	    (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (MSG_INFO) |
 	     IPCOP_MASK (IPC_RMID))) {
-		err = sys_msgctl (first, second, (struct msqid_ds *)uptr);
+		err = sys_msgctl (first, second, uptr);
 	} else if (second & IPC_64) {
 		struct msqid64_ds m;
-		struct msqid64_ds32 *up = (struct msqid64_ds32 *)uptr;
+		struct msqid64_ds32 __user *up = uptr;
 		mm_segment_t old_fs;
 
 		if (second == (IPC_SET|IPC_64)) {
-			err = get_user (m.msg_perm.uid, &up->msg_perm.uid);
-			err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid);
-			err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode);
-			err |= __get_user (m.msg_qbytes, &up->msg_qbytes);
+			err = get_user (m.msg_perm.uid,
+					&up->msg_perm.uid);
+			err |= __get_user (m.msg_perm.gid,
+					   &up->msg_perm.gid);
+			err |= __get_user (m.msg_perm.mode,
+					   &up->msg_perm.mode);
+			err |= __get_user (m.msg_qbytes,
+					   &up->msg_qbytes);
 			if (err)
 				goto out;
 		}
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_msgctl (first, second, (struct msqid_ds *)&m);
+		err = sys_msgctl(first, second,
+				 (struct msqid_ds __user *)&m);
 		set_fs (old_fs);
 		if (IPCOP_MASK (second) &
 		    (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
-			int err2 = copy_to_user(&up->msg_perm, &m.msg_perm, sizeof(struct ipc64_perm) + 3*sizeof(time_t));
-			err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes);
+			int err2 = copy_to_user(&up->msg_perm,
+						&m.msg_perm,
+						(sizeof(struct ipc64_perm) + 3*sizeof(time_t)));
+			err2 |= __put_user (m.msg_cbytes,
+					    &up->msg_cbytes);
 			err2 |= __put_user (m.msg_qnum, &up->msg_qnum);
-			err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes);
+			err2 |= __put_user (m.msg_qbytes,
+					    &up->msg_qbytes);
 			err2 |= __put_user (m.msg_lspid, &up->msg_lspid);
 			err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid);
 			if (err2)
@@ -573,38 +562,52 @@
 		}
 	} else {
 		struct msqid_ds m;
-		struct msqid_ds32 *up = (struct msqid_ds32 *)uptr;
+		struct msqid_ds32 __user *up = uptr;
 		mm_segment_t old_fs;
 
 		if (second == IPC_SET) {
-			err = get_user (m.msg_perm.uid, &up->msg_perm.uid);
-			err |= __get_user (m.msg_perm.gid, &up->msg_perm.gid);
-			err |= __get_user (m.msg_perm.mode, &up->msg_perm.mode);
-			err |= __get_user (m.msg_qbytes, &up->msg_qbytes);
+			err = get_user(m.msg_perm.uid,
+				       &up->msg_perm.uid);
+			err |= __get_user(m.msg_perm.gid,
+					  &up->msg_perm.gid);
+			err |= __get_user(m.msg_perm.mode,
+					  &up->msg_perm.mode);
+			err |= __get_user(m.msg_qbytes,
+					  &up->msg_qbytes);
 			if (err)
 				goto out;
 		}
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_msgctl (first, second, &m);
+		err = sys_msgctl(first, second,
+				 (struct msqid_ds __user *) &m);
 		set_fs (old_fs);
 		if (IPCOP_MASK (second) &
 		    (IPCOP_MASK (MSG_STAT) | IPCOP_MASK (IPC_STAT))) {
-			int err2 = put_user (m.msg_perm.key, &up->msg_perm.key);
-			err2 |= __put_user (high2lowuid(m.msg_perm.uid), &up->msg_perm.uid);
-			err2 |= __put_user (high2lowgid(m.msg_perm.gid), &up->msg_perm.gid);
-			err2 |= __put_user (high2lowuid(m.msg_perm.cuid), &up->msg_perm.cuid);
-			err2 |= __put_user (high2lowgid(m.msg_perm.cgid), &up->msg_perm.cgid);
-			err2 |= __put_user (m.msg_perm.mode, &up->msg_perm.mode);
-			err2 |= __put_user (m.msg_perm.seq, &up->msg_perm.seq);
-			err2 |= __put_user (m.msg_stime, &up->msg_stime);
-			err2 |= __put_user (m.msg_rtime, &up->msg_rtime);
-			err2 |= __put_user (m.msg_ctime, &up->msg_ctime);
-			err2 |= __put_user (m.msg_cbytes, &up->msg_cbytes);
-			err2 |= __put_user (m.msg_qnum, &up->msg_qnum);
-			err2 |= __put_user (m.msg_qbytes, &up->msg_qbytes);
-			err2 |= __put_user (m.msg_lspid, &up->msg_lspid);
-			err2 |= __put_user (m.msg_lrpid, &up->msg_lrpid);
+			int err2 = put_user(m.msg_perm.key,
+					    &up->msg_perm.key);
+			err2 |= __put_user(high2lowuid(m.msg_perm.uid),
+					   &up->msg_perm.uid);
+			err2 |= __put_user(high2lowgid(m.msg_perm.gid),
+					   &up->msg_perm.gid);
+			err2 |= __put_user(high2lowuid(m.msg_perm.cuid),
+					   &up->msg_perm.cuid);
+			err2 |= __put_user(high2lowgid(m.msg_perm.cgid),
+					   &up->msg_perm.cgid);
+			err2 |= __put_user(m.msg_perm.mode,
+					   &up->msg_perm.mode);
+			err2 |= __put_user(m.msg_perm.seq,
+					   &up->msg_perm.seq);
+			err2 |= __put_user(m.msg_stime, &up->msg_stime);
+			err2 |= __put_user(m.msg_rtime, &up->msg_rtime);
+			err2 |= __put_user(m.msg_ctime, &up->msg_ctime);
+			err2 |= __put_user(m.msg_cbytes,
+					   &up->msg_cbytes);
+			err2 |= __put_user(m.msg_qnum, &up->msg_qnum);
+			err2 |= __put_user(m.msg_qbytes,
+					   &up->msg_qbytes);
+			err2 |= __put_user(m.msg_lspid, &up->msg_lspid);
+			err2 |= __put_user(m.msg_lrpid, &up->msg_lrpid);
 			if (err2)
 				err = -EFAULT;
 		}
@@ -614,10 +617,10 @@
 	return err;
 }
 
-static int do_sys32_shmat (int first, int second, int third, int version, void *uptr)
+static int do_sys32_shmat (int first, int second, int third, int version, void __user *uptr)
 {
 	unsigned long raddr;
-	u32 *uaddr = (u32 *)A((u32)third);
+	u32 __user *uaddr = compat_ptr((compat_uptr_t)third);
 	int err = -EINVAL;
 
 	if (version == 1)
@@ -630,63 +633,75 @@
 	return err;
 }
 
-static int do_sys32_shmctl (int first, int second, void *uptr)
+static int do_sys32_shmctl(int first, int second, void __user *uptr)
 {
 	int err;
 
 	if (IPCOP_MASK (second) &
-	    (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) | IPCOP_MASK (SHM_UNLOCK) |
-	     IPCOP_MASK (IPC_RMID))) {
-		if (second == (IPC_INFO|IPC_64))
-			second = IPC_INFO; /* So that we don't have to translate it */
-		err = sys_shmctl (first, second, (struct shmid_ds *)uptr);
+	    (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SHM_LOCK) |
+	     IPCOP_MASK (SHM_UNLOCK) | IPCOP_MASK (IPC_RMID))) {
+		if (second == (IPC_INFO|IPC_64)) {
+			/* So that we don't have to translate it */
+			second = IPC_INFO;
+		}
+		err = sys_shmctl(first, second, uptr);
 	} else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) {
 		struct shmid64_ds s;
-		struct shmid64_ds32 *up = (struct shmid64_ds32 *)uptr;
+		struct shmid64_ds32 __user *up = uptr;
 		mm_segment_t old_fs;
 
 		if (second == (IPC_SET|IPC_64)) {
-			err = get_user (s.shm_perm.uid, &up->shm_perm.uid);
-			err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid);
-			err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode);
+			err = get_user(s.shm_perm.uid,
+				       &up->shm_perm.uid);
+			err |= __get_user(s.shm_perm.gid,
+					  &up->shm_perm.gid);
+			err |= __get_user(s.shm_perm.mode,
+					  &up->shm_perm.mode);
 			if (err)
 				goto out;
 		}
-		old_fs = get_fs ();
-		set_fs (KERNEL_DS);
-		err = sys_shmctl (first, second, (struct shmid_ds *)&s);
-		set_fs (old_fs);
+		old_fs = get_fs();
+		set_fs(KERNEL_DS);
+		err = sys_shmctl(first, second,
+				 (struct shmid_ds __user *)&s);
+		set_fs(old_fs);
 		if (err < 0)
 			goto out;
 
 		/* Mask it even in this case so it becomes a CSE. */
 		if (IPCOP_MASK (second) &
 		    (IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) {
-			int err2 = copy_to_user (&up->shm_perm, &s.shm_perm, sizeof(struct ipc64_perm) + 3*sizeof(time_t));
-			err2 |= __put_user (s.shm_segsz, &up->shm_segsz);
-			err2 |= __put_user (s.shm_nattch, &up->shm_nattch);
-			err2 |= __put_user (s.shm_cpid, &up->shm_cpid);
-			err2 |= __put_user (s.shm_lpid, &up->shm_lpid);
+			int err2 = copy_to_user(&up->shm_perm,
+						&s.shm_perm,
+						sizeof(struct ipc64_perm) + 3*sizeof(time_t));
+			err2 |= __put_user(s.shm_segsz, &up->shm_segsz);
+			err2 |= __put_user(s.shm_nattch,&up->shm_nattch);
+			err2 |= __put_user(s.shm_cpid, &up->shm_cpid);
+			err2 |= __put_user(s.shm_lpid, &up->shm_lpid);
 			if (err2)
 				err = -EFAULT;
 		}
 	} else {
 		struct shmid_ds s;
-		struct shmid_ds32 *up = (struct shmid_ds32 *)uptr;
+		struct shmid_ds32 __user *up = uptr;
 		mm_segment_t old_fs;
 
 		second &= ~IPC_64;
 		if (second == IPC_SET) {
-			err = get_user (s.shm_perm.uid, &up->shm_perm.uid);
-			err |= __get_user (s.shm_perm.gid, &up->shm_perm.gid);
-			err |= __get_user (s.shm_perm.mode, &up->shm_perm.mode);
+			err = get_user(s.shm_perm.uid,
+				       &up->shm_perm.uid);
+			err |= __get_user(s.shm_perm.gid,
+					  &up->shm_perm.gid);
+			err |= __get_user(s.shm_perm.mode,
+					  &up->shm_perm.mode);
 			if (err)
 				goto out;
 		}
-		old_fs = get_fs ();
-		set_fs (KERNEL_DS);
-		err = sys_shmctl (first, second, &s);
-		set_fs (old_fs);
+		old_fs = get_fs();
+		set_fs(KERNEL_DS);
+		err = sys_shmctl(first, second,
+				 (struct shmid_ds __user *) &s);
+		set_fs(old_fs);
 		if (err < 0)
 			goto out;
 
@@ -696,32 +711,46 @@
 				int used_ids;
 				u32 shm_tot, shm_rss, shm_swp;
 				u32 swap_attempts, swap_successes;
-			} *uip = (struct shm_info32 *)uptr;
-			struct shm_info *kp = (struct shm_info *)&s;
-			int err2 = put_user (kp->used_ids, &uip->used_ids);
-			err2 |= __put_user (kp->shm_tot, &uip->shm_tot);
-			err2 |= __put_user (kp->shm_rss, &uip->shm_rss);
-			err2 |= __put_user (kp->shm_swp, &uip->shm_swp);
-			err2 |= __put_user (kp->swap_attempts, &uip->swap_attempts);
-			err2 |= __put_user (kp->swap_successes, &uip->swap_successes);
+			};
+			struct shm_info32 __user *uip = uptr;
+			struct shm_info *kp = (struct shm_info *) &s;
+			int err2 = put_user(kp->used_ids,
+					    &uip->used_ids);
+			err2 |= __put_user(kp->shm_tot, &uip->shm_tot);
+			err2 |= __put_user(kp->shm_rss, &uip->shm_rss);
+			err2 |= __put_user(kp->shm_swp, &uip->shm_swp);
+			err2 |= __put_user(kp->swap_attempts,
+					   &uip->swap_attempts);
+			err2 |= __put_user(kp->swap_successes,
+					   &uip->swap_successes);
 			if (err2)
 				err = -EFAULT;
 		} else if (IPCOP_MASK (second) &
-			   (IPCOP_MASK (SHM_STAT) | IPCOP_MASK (IPC_STAT))) {
-			int err2 = put_user (s.shm_perm.key, &up->shm_perm.key);
-			err2 |= __put_user (high2lowuid(s.shm_perm.uid), &up->shm_perm.uid);
-			err2 |= __put_user (high2lowuid(s.shm_perm.gid), &up->shm_perm.gid);
-			err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid);
-			err2 |= __put_user (high2lowuid(s.shm_perm.cgid), &up->shm_perm.cgid);
-			err2 |= __put_user (s.shm_perm.mode, &up->shm_perm.mode);
-			err2 |= __put_user (s.shm_perm.seq, &up->shm_perm.seq);
-			err2 |= __put_user (s.shm_atime, &up->shm_atime);
-			err2 |= __put_user (s.shm_dtime, &up->shm_dtime);
-			err2 |= __put_user (s.shm_ctime, &up->shm_ctime);
-			err2 |= __put_user (s.shm_segsz, &up->shm_segsz);
-			err2 |= __put_user (s.shm_nattch, &up->shm_nattch);
-			err2 |= __put_user (s.shm_cpid, &up->shm_cpid);
-			err2 |= __put_user (s.shm_lpid, &up->shm_lpid);
+			   (IPCOP_MASK (SHM_STAT) |
+			    IPCOP_MASK (IPC_STAT))) {
+			int err2;
+
+			err2  = put_user(s.shm_perm.key,
+					 &up->shm_perm.key);
+			err2 |= __put_user(high2lowuid(s.shm_perm.uid),
+					   &up->shm_perm.uid);
+			err2 |= __put_user(high2lowuid(s.shm_perm.gid),
+					   &up->shm_perm.gid);
+			err2 |= __put_user(high2lowuid(s.shm_perm.cuid),
+					   &up->shm_perm.cuid);
+			err2 |= __put_user(high2lowuid(s.shm_perm.cgid),
+					   &up->shm_perm.cgid);
+			err2 |= __put_user(s.shm_perm.mode,
+					   &up->shm_perm.mode);
+			err2 |= __put_user(s.shm_perm.seq,
+					   &up->shm_perm.seq);
+			err2 |= __put_user(s.shm_atime, &up->shm_atime);
+			err2 |= __put_user(s.shm_dtime, &up->shm_dtime);
+			err2 |= __put_user(s.shm_ctime, &up->shm_ctime);
+			err2 |= __put_user(s.shm_segsz, &up->shm_segsz);
+			err2 |= __put_user(s.shm_nattch,&up->shm_nattch);
+			err2 |= __put_user(s.shm_cpid, &up->shm_cpid);
+			err2 |= __put_user(s.shm_lpid, &up->shm_lpid);
 			if (err2)
 				err = -EFAULT;
 		}
@@ -730,12 +759,14 @@
 	return err;
 }
 
-static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems,
-			    const struct compat_timespec *timeout32)
+static int sys32_semtimedop(int semid, struct sembuf __user *tsems,
+		int nsems,
+		const struct compat_timespec __user *timeout32)
 {
 	struct compat_timespec t32;
-	struct timespec *t64 = compat_alloc_user_space(sizeof(*t64));
+	struct timespec __user *t64;
 
+	t64 = compat_alloc_user_space(sizeof(*t64));
 	if (copy_from_user(&t32, timeout32, sizeof(t32)))
 		return -EFAULT;
 
@@ -746,77 +777,81 @@
 	return sys_semtimedop(semid, tsems, nsems, t64);
 }
 
-asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
+asmlinkage long compat_sys_ipc(u32 call, int first, int second, int third, compat_uptr_t __ptr, u32 fifth)
 {
 	int version, err;
+	void __user *ptr = compat_ptr(__ptr);
 
 	version = call >> 16; /* hack for backward compatibility */
 	call &= 0xffff;
 
-	if (call <= SEMCTL)
+	if (call <= SEMCTL) {
 		switch (call) {
 		case SEMOP:
-			/* struct sembuf is the same on 32 and 64bit :)) */
-			err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second, NULL);
+			/* struct sembuf is the same on 32 and 64 :)) */
+			err = sys_semtimedop (first, ptr, second, NULL);
 			goto out;
 		case SEMTIMEDOP:
-			err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second, (const struct compat_timespec *) AA(fifth));
+			err = sys32_semtimedop(first, ptr, second,
+					       compat_ptr(fifth));
 		case SEMGET:
-			err = sys_semget (first, second, third);
+			err = sys_semget(first, second, third);
 			goto out;
 		case SEMCTL:
-			err = do_sys32_semctl (first, second, third, (void *)AA(ptr));
+			err = do_sys32_semctl(first, second, third, ptr);
 			goto out;
 		default:
 			err = -ENOSYS;
 			goto out;
 		};
-	if (call <= MSGCTL) 
+	}
+	if (call <= MSGCTL) {
 		switch (call) {
 		case MSGSND:
-			err = do_sys32_msgsnd (first, second, third, (void *)AA(ptr));
+			err = do_sys32_msgsnd(first, second, third, ptr);
 			goto out;
 		case MSGRCV:
-			err = do_sys32_msgrcv (first, second, fifth, third,
-					       version, (void *)AA(ptr));
+			err = do_sys32_msgrcv(first, second, fifth,
+					      third, version, ptr);
 			goto out;
 		case MSGGET:
-			err = sys_msgget ((key_t) first, second);
+			err = sys_msgget((key_t) first, second);
 			goto out;
 		case MSGCTL:
-			err = do_sys32_msgctl (first, second, (void *)AA(ptr));
+			err = do_sys32_msgctl(first, second, ptr);
 			goto out;
 		default:
 			err = -ENOSYS;
 			goto out;
-		}
-	if (call <= SHMCTL) 
+		};
+	}
+	if (call <= SHMCTL) {
 		switch (call) {
 		case SHMAT:
-			err = do_sys32_shmat (first, second, third,
-					      version, (void *)AA(ptr));
+			err = do_sys32_shmat(first, second, third,
+					     version, ptr);
 			goto out;
 		case SHMDT: 
-			err = sys_shmdt ((char *)AA(ptr));
+			err = sys_shmdt(ptr);
 			goto out;
 		case SHMGET:
-			err = sys_shmget (first, second, third);
+			err = sys_shmget(first, second, third);
 			goto out;
 		case SHMCTL:
-			err = do_sys32_shmctl (first, second, (void *)AA(ptr));
+			err = do_sys32_shmctl(first, second, ptr);
 			goto out;
 		default:
 			err = -ENOSYS;
 			goto out;
-		}
-
+		};
+	}
 	err = -ENOSYS;
 
 out:
 	return err;
 }
 
-asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low)
+asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low)
 {
 	if ((int)high < 0)
 		return -EINVAL;
@@ -824,7 +859,7 @@
 		return sys_truncate(path, (high << 32) | low);
 }
 
-asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
+asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
 {
 	if ((int)high < 0)
 		return -EINVAL;
@@ -832,185 +867,9 @@
 		return sys_ftruncate(fd, (high << 32) | low);
 }
 
-typedef ssize_t (*io_fn_t)(struct file *, char *, size_t, loff_t *);
-typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *);
-
-static long do_readv_writev32(int type, struct file *file,
-			      const struct compat_iovec *vector, u32 count)
-{
-	compat_ssize_t tot_len;
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov=iovstack, *ivp;
-	struct inode *inode;
-	long retval, i;
-	io_fn_t fn;
-	iov_fn_t fnv;
-
-	/*
-	 * SuS says "The readv() function *may* fail if the iovcnt argument
-	 * was less than or equal to 0, or greater than {IOV_MAX}.  Linux has
-	 * traditionally returned zero for zero segments, so...
-	 */
-	retval = 0;
-	if (count == 0)
-		goto out;
-
-	/* First get the "struct iovec" from user memory and
-	 * verify all the pointers
-	 */
-	retval = -EINVAL;
-	if (count > UIO_MAXIOV)
-		goto out;
-	if (!file->f_op)
-		goto out;
-	if (count > UIO_FASTIOV) {
-		retval = -ENOMEM;
-		iov = kmalloc(count*sizeof(struct iovec), GFP_KERNEL);
-		if (!iov)
-			goto out;
-	}
-	retval = -EFAULT;
-	if (verify_area(VERIFY_READ, vector, sizeof(struct compat_iovec)*count))
-		goto out;
-
-	/*
-	 * Single unix specification:
-	 * We should -EINVAL if an element length is not >= 0 and fitting an
-	 * ssize_t.  The total length is fitting an ssize_t
-	 *
-	 * Be careful here because iov_len is a size_t not an ssize_t
-	 */
-	tot_len = 0;
-	i = count;
-	ivp = iov;
-	retval = -EINVAL;
-	while(i > 0) {
-		compat_ssize_t tmp = tot_len;
-		compat_ssize_t len;
-		u32 buf;
-
-		if (__get_user(len, &vector->iov_len) ||
-		    __get_user(buf, &vector->iov_base)) {
-			retval = -EFAULT;
-			goto out;
-		}
-		if (len < 0)	/* size_t not fitting an ssize_t32 .. */
-			goto out;
-		tot_len += len;
-		if (tot_len < tmp) /* maths overflow on the compat_ssize_t */
-			goto out;
-		ivp->iov_base = (void *)A(buf);
-		ivp->iov_len = (__kernel_size_t) len;
-		vector++;
-		ivp++;
-		i--;
-	}
-	if (tot_len == 0) {
-		retval = 0;
-		goto out;
-	}
-
-	inode = file->f_dentry->d_inode;
-	/* VERIFY_WRITE actually means a read, as we write to user space */
-	retval = locks_verify_area((type == READ
-				    ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE),
-				   inode, file, file->f_pos, tot_len);
-	if (retval)
-		goto out;
-
-	if (type == READ) {
-		fn = file->f_op->read;
-		fnv = file->f_op->readv;
-	} else {
-		fn = (io_fn_t)file->f_op->write;
-		fnv = file->f_op->writev;
-	}
-	if (fnv) {
-		retval = fnv(file, iov, count, &file->f_pos);
-		goto out;
-	}
-
-	/* Do it by hand, with file-ops */
-	ivp = iov;
-	while (count > 0) {
-		void * base;
-		int len, nr;
-
-		base = ivp->iov_base;
-		len = ivp->iov_len;
-		ivp++;
-		count--;
-
-		nr = fn(file, base, len, &file->f_pos);
-
-		if (nr < 0) {
-			if (!retval)
-				retval = nr;
-			break;
-		}
-		retval += nr;
-		if (nr != len)
-			break;
-	}
-out:
-	if (iov != iovstack)
-		kfree(iov);
-	if ((retval + (type == READ)) > 0)
-		dnotify_parent(file->f_dentry,
-			(type == READ) ? DN_ACCESS : DN_MODIFY);
-
-	return retval;
-}
-
-asmlinkage long sys32_readv(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct file *file;
-	int ret;
-
-	file = fget(fd);
-	if(!file)
-		return -EBADF;
-
-	ret = -EBADF;
-	if (!(file->f_mode & FMODE_READ))
-		goto out;
-	ret = -EINVAL;
-	if (!file->f_op || (!file->f_op->readv && !file->f_op->read))
-		goto out;
-
-	ret = do_readv_writev32(READ, file, vector, count);
-
-out:
-	fput(file);
-	return ret;
-}
-
-asmlinkage long sys32_writev(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct file *file;
-	int ret;
-
-	file = fget(fd);
-	if(!file)
-		return -EBADF;
-
-	ret = -EBADF;
-	if (!(file->f_mode & FMODE_WRITE))
-		goto out;
-	ret = -EINVAL;
-	if (!file->f_op || (!file->f_op->writev && !file->f_op->write))
-		goto out;
-
-	ret = do_readv_writev32(WRITE, file, vector, count);
-
-out:
-	fput(file);
-	return ret;
-}
-
 /* readdir & getdents */
 
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
 
 struct old_linux_dirent32 {
@@ -1021,7 +880,7 @@
 };
 
 struct readdir_callback32 {
-	struct old_linux_dirent32 * dirent;
+	struct old_linux_dirent32 __user * dirent;
 	int count;
 };
 
@@ -1029,7 +888,7 @@
 		      loff_t offset, ino_t ino, unsigned int d_type)
 {
 	struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
-	struct old_linux_dirent32 * dirent;
+	struct old_linux_dirent32 __user * dirent;
 
 	if (buf->count)
 		return -EINVAL;
@@ -1043,7 +902,7 @@
 	return 0;
 }
 
-asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count)
+asmlinkage long old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count)
 {
 	int error = -EBADF;
 	struct file * file;
@@ -1075,8 +934,8 @@
 };
 
 struct getdents_callback32 {
-	struct linux_dirent32 * current_dir;
-	struct linux_dirent32 * previous;
+	struct linux_dirent32 __user *current_dir;
+	struct linux_dirent32 __user *previous;
 	int count;
 	int error;
 };
@@ -1084,7 +943,7 @@
 static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino,
 		   unsigned int d_type)
 {
-	struct linux_dirent32 * dirent;
+	struct linux_dirent32 __user * dirent;
 	struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
 
@@ -1100,17 +959,17 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	put_user(d_type, (char *) dirent + reclen - 1);
-	dirent = (void *) dirent + reclen;
+	put_user(d_type, (char __user *) dirent + reclen - 1);
+	dirent = (void __user *) dirent + reclen;
 	buf->current_dir = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, unsigned int count)
+asmlinkage long sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count)
 {
 	struct file * file;
-	struct linux_dirent32 * lastdirent;
+	struct linux_dirent32 __user *lastdirent;
 	struct getdents_callback32 buf;
 	int error = -EBADF;
 
@@ -1128,7 +987,7 @@
 		goto out_putf;
 	lastdirent = buf.previous;
 	error = buf.error;
-	if(lastdirent) {
+	if (lastdirent) {
 		put_user(file->f_pos, &lastdirent->d_off);
 		error = count - buf.count;
 	}
@@ -1140,159 +999,7 @@
 
 /* end of readdir & getdents */
 
-/*
- * Ooo, nasty.  We need here to frob 32-bit unsigned longs to
- * 64-bit unsigned longs.
- */
-
-static int get_fd_set32(unsigned long n, unsigned long *fdset, u32 *ufdset)
-{
-	if (ufdset) {
-		unsigned long odd;
-
-		if (verify_area(VERIFY_WRITE, ufdset, n*sizeof(u32)))
-			return -EFAULT;
-
-		odd = n & 1UL;
-		n &= ~1UL;
-		while (n) {
-			unsigned long h, l;
-			__get_user(l, ufdset);
-			__get_user(h, ufdset+1);
-			ufdset += 2;
-			*fdset++ = h << 32 | l;
-			n -= 2;
-		}
-		if (odd)
-			__get_user(*fdset, ufdset);
-	} else {
-		/* Tricky, must clear full unsigned long in the
-		 * kernel fdset at the end, this makes sure that
-		 * actually happens.
-		 */
-		memset(fdset, 0, ((n + 1) & ~1)*sizeof(u32));
-	}
-	return 0;
-}
-
-static void set_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset)
-{
-	unsigned long odd;
-
-	if (!ufdset)
-		return;
-
-	odd = n & 1UL;
-	n &= ~1UL;
-	while (n) {
-		unsigned long h, l;
-		l = *fdset++;
-		h = l >> 32;
-		__put_user(l, ufdset);
-		__put_user(h, ufdset+1);
-		ufdset += 2;
-		n -= 2;
-	}
-	if (odd)
-		__put_user(*fdset, ufdset);
-}
-
-#define MAX_SELECT_SECONDS \
-	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-
-asmlinkage int sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x)
-{
-	fd_set_bits fds;
-	struct compat_timeval *tvp = (struct compat_timeval *)AA(tvp_x);
-	char *bits;
-	unsigned long nn;
-	long timeout;
-	int ret, size;
-
-	timeout = MAX_SCHEDULE_TIMEOUT;
-	if (tvp) {
-		time_t sec, usec;
-
-		if ((ret = verify_area(VERIFY_READ, tvp, sizeof(*tvp)))
-		    || (ret = __get_user(sec, &tvp->tv_sec))
-		    || (ret = __get_user(usec, &tvp->tv_usec)))
-			goto out_nofds;
-
-		ret = -EINVAL;
-		if(sec < 0 || usec < 0)
-			goto out_nofds;
-
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
-			timeout = (usec + 1000000/HZ - 1) / (1000000/HZ);
-			timeout += sec * (unsigned long) HZ;
-		}
-	}
-
-	ret = -EINVAL;
-	if (n < 0)
-		goto out_nofds;
-	if (n > current->files->max_fdset)
-		n = current->files->max_fdset;
-
-	/*
-	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
-	 * since we used fdset we need to allocate memory in units of
-	 * long-words. 
-	 */
-	ret = -ENOMEM;
-	size = FDS_BYTES(n);
-	bits = kmalloc(6 * size, GFP_KERNEL);
-	if (!bits)
-		goto out_nofds;
-	fds.in      = (unsigned long *)  bits;
-	fds.out     = (unsigned long *) (bits +   size);
-	fds.ex      = (unsigned long *) (bits + 2*size);
-	fds.res_in  = (unsigned long *) (bits + 3*size);
-	fds.res_out = (unsigned long *) (bits + 4*size);
-	fds.res_ex  = (unsigned long *) (bits + 5*size);
-
-	nn = (n + 8*sizeof(u32) - 1) / (8*sizeof(u32));
-	if ((ret = get_fd_set32(nn, fds.in, inp)) ||
-	    (ret = get_fd_set32(nn, fds.out, outp)) ||
-	    (ret = get_fd_set32(nn, fds.ex, exp)))
-		goto out;
-	zero_fd_set(n, fds.res_in);
-	zero_fd_set(n, fds.res_out);
-	zero_fd_set(n, fds.res_ex);
-
-	ret = do_select(n, &fds, &timeout);
-
-	if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
-		time_t sec = 0, usec = 0;
-		if (timeout) {
-			sec = timeout / HZ;
-			usec = timeout % HZ;
-			usec *= (1000000/HZ);
-		}
-		put_user(sec, &tvp->tv_sec);
-		put_user(usec, &tvp->tv_usec);
-	}
-
-	if (ret < 0)
-		goto out;
-	if (!ret) {
-		ret = -ERESTARTNOHAND;
-		if (signal_pending(current))
-			goto out;
-		ret = 0;
-	}
-
-	set_fd_set32(nn, inp, fds.res_in);
-	set_fd_set32(nn, outp, fds.res_out);
-	set_fd_set32(nn, exp, fds.res_ex);
-
-out:
-	kfree(bits);
-out_nofds:
-	return ret;
-}
-
-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;
 
@@ -1322,7 +1029,7 @@
 	return err;
 }
 
-asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2)
+asmlinkage long compat_sys_sysfs(int option, u32 arg1, u32 arg2)
 {
 	return sys_sysfs(option, arg1, arg2);
 }
@@ -1344,7 +1051,7 @@
 	char _f[20-2*sizeof(int)-sizeof(int)];
 };
 
-asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
+asmlinkage long sys32_sysinfo(struct sysinfo32 __user *info)
 {
 	struct sysinfo s;
 	int ret, err;
@@ -1352,7 +1059,7 @@
 	mm_segment_t old_fs = get_fs ();
 	
 	set_fs(KERNEL_DS);
-	ret = sys_sysinfo(&s);
+	ret = sys_sysinfo((struct sysinfo __user *) &s);
 	set_fs(old_fs);
 	/* Check to see if any memory value is too large for 32-bit and
          * scale down if needed.
@@ -1391,21 +1098,24 @@
 	return ret;
 }
 
-asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
+asmlinkage long compat_sys_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval)
 {
 	struct timespec t;
 	int ret;
 	mm_segment_t old_fs = get_fs ();
 	
 	set_fs (KERNEL_DS);
-	ret = sys_sched_rr_get_interval(pid, &t);
+	ret = sys_sched_rr_get_interval(pid, (struct timespec __user *) &t);
 	set_fs (old_fs);
 	if (put_compat_timespec(&t, interval))
 		return -EFAULT;
 	return ret;
 }
 
-asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize)
+asmlinkage long compat_sys_rt_sigprocmask(int how,
+					  compat_sigset_t __user *set,
+					  compat_sigset_t __user *oset,
+					  compat_size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -1423,7 +1133,10 @@
 		}
 	}
 	set_fs (KERNEL_DS);
-	ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, sigsetsize);
+	ret = sys_rt_sigprocmask(how,
+				 set ? (sigset_t __user *) &s : NULL,
+				 oset ? (sigset_t __user *) &s : NULL,
+				 sigsetsize);
 	set_fs (old_fs);
 	if (ret) return ret;
 	if (oset) {
@@ -1439,7 +1152,8 @@
 	return 0;
 }
 
-asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize)
+asmlinkage long sys32_rt_sigpending(compat_sigset_t __user *set,
+				    compat_size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -1447,7 +1161,7 @@
 	mm_segment_t old_fs = get_fs();
 		
 	set_fs (KERNEL_DS);
-	ret = sys_rt_sigpending(&s, sigsetsize);
+	ret = sys_rt_sigpending((sigset_t __user *) &s, sigsetsize);
 	set_fs (old_fs);
 	if (!ret) {
 		switch (_NSIG_WORDS) {
@@ -1462,9 +1176,10 @@
 	return ret;
 }
 
-asmlinkage int
-sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
-		      struct compat_timespec *uts, compat_size_t sigsetsize)
+asmlinkage long sys32_rt_sigtimedwait(compat_sigset_t __user *uthese,
+				      siginfo_t32 __user *uinfo,
+				      struct compat_timespec __user *uts,
+				      compat_size_t sigsetsize)
 {
 	int ret, sig;
 	sigset_t these;
@@ -1546,8 +1261,8 @@
 	return ret;
 }
 
-asmlinkage int
-sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo)
+asmlinkage long compat_sys_rt_sigqueueinfo(int pid, int sig,
+					   siginfo_t32 __user *uinfo)
 {
 	siginfo_t info;
 	int ret;
@@ -1557,14 +1272,13 @@
 	    copy_from_user (info._sifields._pad, uinfo->_sifields._pad, SI_PAD_SIZE))
 		return -EFAULT;
 	set_fs (KERNEL_DS);
-	ret = sys_rt_sigqueueinfo(pid, sig, &info);
+	ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *) &info);
 	set_fs (old_fs);
 	return ret;
 }
 
-extern void check_pending(int signum);
-
-asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact)
+asmlinkage long compat_sys_sigaction(int sig, struct old_sigaction32 __user *act,
+				     struct old_sigaction32 __user *oact)
 {
         struct k_sigaction new_ka, old_ka;
         int ret;
@@ -1602,9 +1316,11 @@
 	return ret;
 }
 
-asmlinkage int
-sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact,
-		   void *restorer, compat_size_t sigsetsize)
+asmlinkage long compat_sys_rt_sigaction(int sig,
+					struct sigaction32 __user *act,
+					struct sigaction32 __user *oact,
+					void __user *restorer,
+					compat_size_t sigsetsize)
 {
         struct k_sigaction new_ka, old_ka;
         int ret;
@@ -1659,218 +1375,33 @@
         return ret;
 }
 
-
-/*
- * count32() counts the number of arguments/envelopes
- */
-static int count32(u32 * argv, int max)
-{
-	int i = 0;
-
-	if (argv != NULL) {
-		for (;;) {
-			u32 p; int error;
-
-			error = get_user(p,argv);
-			if (error)
-				return error;
-			if (!p)
-				break;
-			argv++;
-			if (++i > max)
-				return -E2BIG;
-		}
-	}
-	return i;
-}
-
-/*
- * 'copy_string32()' copies argument/envelope strings from user
- * memory to free pages in kernel mem. These are in a format ready
- * to be put directly into the top of new user memory.
- */
-static int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm)
-{
-	while (argc-- > 0) {
-		u32 str;
-		int len;
-		unsigned long pos;
-
-		if (get_user(str, argv + argc) ||
-		    !str ||
-		    !(len = strnlen_user((char *)A(str), bprm->p)))
-			return -EFAULT;
-
-		if (bprm->p < len)
-			return -E2BIG;
-
-		bprm->p -= len;
-
-		pos = bprm->p;
-		while (len) {
-			char *kaddr;
-			struct page *page;
-			int offset, bytes_to_copy, new, err;
-
-			offset = pos % PAGE_SIZE;
-			page = bprm->page[pos / PAGE_SIZE];
-			new = 0;
-			if (!page) {
-				page = alloc_page(GFP_USER);
-				bprm->page[pos / PAGE_SIZE] = page;
-				if (!page)
-					return -ENOMEM;
-				new = 1;
-			}
-			kaddr = kmap(page);
-
-			if (new && offset)
-				memset(kaddr, 0, offset);
-			bytes_to_copy = PAGE_SIZE - offset;
-			if (bytes_to_copy > len) {
-				bytes_to_copy = len;
-				if (new)
-					memset(kaddr+offset+len, 0,
-					       PAGE_SIZE-offset-len);
-			}
-
-			err = copy_from_user(kaddr + offset, (char *)A(str),
-					     bytes_to_copy);
-			kunmap(page);
-
-			if (err)
-				return -EFAULT;
-
-			pos += bytes_to_copy;
-			str += bytes_to_copy;
-			len -= bytes_to_copy;
-		}
-	}
-	return 0;
-}
-
-/*
- * sys32_execve() executes a new program.
- */
-static inline int 
-do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs)
-{
-	struct linux_binprm bprm;
-	struct file * file;
-	int retval;
-	int i;
-
-	sched_balance_exec();
-
-	file = open_exec(filename);
-
-	retval = PTR_ERR(file);
-	if (IS_ERR(file))
-		return retval;
-
-	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
-	memset(bprm.page, 0, MAX_ARG_PAGES * sizeof(bprm.page[0]));
-
-	bprm.file = file;
-	bprm.filename = filename;
-	bprm.interp = filename;
-	bprm.sh_bang = 0;
-	bprm.loader = 0;
-	bprm.exec = 0;
-	bprm.security = NULL;
-	bprm.mm = mm_alloc();
-	retval = -ENOMEM;
-	if (!bprm.mm) 
-		goto out_file;
-
-	retval = init_new_context(current, bprm.mm);
-	if (retval < 0)
-		goto out_mm;
-
-	bprm.argc = count32(argv, bprm.p / sizeof(u32));
-	if ((retval = bprm.argc) < 0)
-		goto out_mm;
-
-	bprm.envc = count32(envp, bprm.p / sizeof(u32));
-	if ((retval = bprm.envc) < 0)
-		goto out_mm;
-
-	retval = security_bprm_alloc(&bprm);
-	if (retval)
-		goto out;
-
-	retval = prepare_binprm(&bprm);
-	if (retval < 0)
-		goto out;
-	
-	retval = copy_strings_kernel(1, &bprm.filename, &bprm);
-	if (retval < 0)
-		goto out;
-
-	bprm.exec = bprm.p;
-	retval = copy_strings32(bprm.envc, envp, &bprm);
-	if (retval < 0)
-		goto out;
-
-	retval = copy_strings32(bprm.argc, argv, &bprm);
-	if (retval < 0)
-		goto out;
-
-	retval = search_binary_handler(&bprm, regs);
-	if (retval >= 0) {
-		/* execve success */
-		security_bprm_free(&bprm);
-		return retval;
-	}
-
-out:
-	/* Something went wrong, return the inode and free the argument pages*/
-	for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
-		struct page * page = bprm.page[i];
-		if (page)
-			__free_page(page);
-	}
-
-	if (bprm.security)
-		security_bprm_free(&bprm);
-
-out_mm:
-	if (bprm.mm)
-		mmdrop(bprm.mm);
-
-out_file:
-	if (bprm.file) {
-		allow_write_access(bprm.file);
-		fput(bprm.file);
-	}
-	return retval;
-}
-
 /*
  * sparc32_execve() executes a new program after the asm stub has set
  * things up for us.  This should basically do what I want it to.
  */
-asmlinkage int sparc32_execve(struct pt_regs *regs)
+asmlinkage long sparc32_execve(struct pt_regs *regs)
 {
-        int error, base = 0;
-        char *filename;
+	int error, base = 0;
+	char *filename;
 
 	/* User register window flush is done by entry.S */
 
-        /* Check for indirect call. */
-        if((u32)regs->u_regs[UREG_G1] == 0)
-                base = 1;
+	/* Check for indirect call. */
+	if ((u32)regs->u_regs[UREG_G1] == 0)
+		base = 1;
 
-        filename = getname((char *)AA(regs->u_regs[base + UREG_I0]));
+	filename = getname(compat_ptr(regs->u_regs[base + UREG_I0]));
 	error = PTR_ERR(filename);
-        if(IS_ERR(filename))
-                goto out;
-        error = do_execve32(filename,
-        	(u32 *)AA((u32)regs->u_regs[base + UREG_I1]),
-        	(u32 *)AA((u32)regs->u_regs[base + UREG_I2]), regs);
-        putname(filename);
+	if (IS_ERR(filename))
+		goto out;
 
-	if(!error) {
+	error = compat_do_execve(filename,
+				 compat_ptr(regs->u_regs[base + UREG_I1]),
+				 compat_ptr(regs->u_regs[base + UREG_I2]), regs);
+
+	putname(filename);
+
+	if (!error) {
 		fprs_write(0);
 		current_thread_info()->xfsr[0] = 0;
 		current_thread_info()->fpsaved[0] = 0;
@@ -1878,269 +1409,45 @@
 		current->ptrace &= ~PT_DTRACE;
 	}
 out:
-        return error;
+	return error;
 }
 
 #ifdef CONFIG_MODULES
 
-asmlinkage int sys32_init_module(void *umod, u32 len, const char *uargs)
+asmlinkage long sys32_init_module(void __user *umod, u32 len,
+				  const char __user *uargs)
 {
 	return sys_init_module(umod, len, uargs);
 }
 
-asmlinkage int sys32_delete_module(const char *name_user, unsigned int flags)
+asmlinkage long sys32_delete_module(const char __user *name_user,
+				    unsigned int flags)
 {
 	return sys_delete_module(name_user, flags);
 }
 
 #else /* CONFIG_MODULES */
 
-asmlinkage int
-sys32_init_module(const char *name_user, struct module *mod_user)
+asmlinkage long sys32_init_module(const char __user *name_user,
+				  struct module __user *mod_user)
 {
 	return -ENOSYS;
 }
 
-asmlinkage int
-sys32_delete_module(const char *name_user)
+asmlinkage long sys32_delete_module(const char __user *name_user)
 {
 	return -ENOSYS;
 }
 
 #endif  /* CONFIG_MODULES */
 
-#if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)
-/* Stuff for NFS server syscalls... */
-struct nfsctl_svc32 {
-	u16			svc32_port;
-	s32			svc32_nthreads;
-};
-
-struct nfsctl_client32 {
-	s8			cl32_ident[NFSCLNT_IDMAX+1];
-	s32			cl32_naddr;
-	struct in_addr		cl32_addrlist[NFSCLNT_ADDRMAX];
-	s32			cl32_fhkeytype;
-	s32			cl32_fhkeylen;
-	u8			cl32_fhkey[NFSCLNT_KEYMAX];
-};
-
-struct nfsctl_export32 {
-	s8			ex32_client[NFSCLNT_IDMAX+1];
-	s8			ex32_path[NFS_MAXPATHLEN+1];
-	compat_dev_t	ex32_dev;
-	compat_ino_t	ex32_ino;
-	s32			ex32_flags;
-	compat_uid_t	ex32_anon_uid;
-	compat_gid_t	ex32_anon_gid;
-};
-
-struct nfsctl_fdparm32 {
-	struct sockaddr		gd32_addr;
-	s8			gd32_path[NFS_MAXPATHLEN+1];
-	s32			gd32_version;
-};
-
-struct nfsctl_fsparm32 {
-	struct sockaddr		gd32_addr;
-	s8			gd32_path[NFS_MAXPATHLEN+1];
-	s32			gd32_maxlen;
-};
-
-struct nfsctl_arg32 {
-	s32			ca32_version;	/* safeguard */
-	union {
-		struct nfsctl_svc32	u32_svc;
-		struct nfsctl_client32	u32_client;
-		struct nfsctl_export32	u32_export;
-		struct nfsctl_fdparm32	u32_getfd;
-		struct nfsctl_fsparm32	u32_getfs;
-	} u;
-#define ca32_svc	u.u32_svc
-#define ca32_client	u.u32_client
-#define ca32_export	u.u32_export
-#define ca32_getfd	u.u32_getfd
-#define ca32_getfs	u.u32_getfs
-};
-
-union nfsctl_res32 {
-	__u8			cr32_getfh[NFS_FHSIZE];
-	struct knfsd_fh		cr32_getfs;
-};
-
-static int nfs_svc32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= __get_user(karg->ca_svc.svc_port, &arg32->ca32_svc.svc32_port);
-	err |= __get_user(karg->ca_svc.svc_nthreads, &arg32->ca32_svc.svc32_nthreads);
-	return err;
-}
-
-static int nfs_clnt32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_client.cl_ident[0],
-			  &arg32->ca32_client.cl32_ident[0],
-			  NFSCLNT_IDMAX);
-	err |= __get_user(karg->ca_client.cl_naddr, &arg32->ca32_client.cl32_naddr);
-	err |= copy_from_user(&karg->ca_client.cl_addrlist[0],
-			  &arg32->ca32_client.cl32_addrlist[0],
-			  (sizeof(struct in_addr) * NFSCLNT_ADDRMAX));
-	err |= __get_user(karg->ca_client.cl_fhkeytype,
-		      &arg32->ca32_client.cl32_fhkeytype);
-	err |= __get_user(karg->ca_client.cl_fhkeylen,
-		      &arg32->ca32_client.cl32_fhkeylen);
-	err |= copy_from_user(&karg->ca_client.cl_fhkey[0],
-			  &arg32->ca32_client.cl32_fhkey[0],
-			  NFSCLNT_KEYMAX);
-	return (err ? -EFAULT : 0);
-}
-
-static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_export.ex_client[0],
-			  &arg32->ca32_export.ex32_client[0],
-			  NFSCLNT_IDMAX);
-	err |= copy_from_user(&karg->ca_export.ex_path[0],
-			  &arg32->ca32_export.ex32_path[0],
-			  NFS_MAXPATHLEN);
-	err |= __get_user(karg->ca_export.ex_dev,
-		      &arg32->ca32_export.ex32_dev);
-	err |= __get_user(karg->ca_export.ex_ino,
-		      &arg32->ca32_export.ex32_ino);
-	err |= __get_user(karg->ca_export.ex_flags,
-		      &arg32->ca32_export.ex32_flags);
-	err |= __get_user(karg->ca_export.ex_anon_uid,
-		      &arg32->ca32_export.ex32_anon_uid);
-	err |= __get_user(karg->ca_export.ex_anon_gid,
-		      &arg32->ca32_export.ex32_anon_gid);
-	karg->ca_export.ex_anon_uid = high2lowuid(karg->ca_export.ex_anon_uid);
-	karg->ca_export.ex_anon_gid = high2lowgid(karg->ca_export.ex_anon_gid);
-	return (err ? -EFAULT : 0);
-}
-
-static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_getfd.gd_addr,
-			  &arg32->ca32_getfd.gd32_addr,
-			  (sizeof(struct sockaddr)));
-	err |= copy_from_user(&karg->ca_getfd.gd_path,
-			  &arg32->ca32_getfd.gd32_path,
-			  (NFS_MAXPATHLEN+1));
-	err |= __get_user(karg->ca_getfd.gd_version,
-		      &arg32->ca32_getfd.gd32_version);
-	return (err ? -EFAULT : 0);
-}
-
-static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = __get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_getfs.gd_addr,
-			  &arg32->ca32_getfs.gd32_addr,
-			  (sizeof(struct sockaddr)));
-	err |= copy_from_user(&karg->ca_getfs.gd_path,
-			  &arg32->ca32_getfs.gd32_path,
-			  (NFS_MAXPATHLEN+1));
-	err |= __get_user(karg->ca_getfs.gd_maxlen,
-		      &arg32->ca32_getfs.gd32_maxlen);
-	return (err ? -EFAULT : 0);
-}
-
-/* This really doesn't need translations, we are only passing
- * back a union which contains opaque nfs file handle data.
- */
-static int nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32)
-{
-	return (copy_to_user(res32, kres, sizeof(*res32)) ? -EFAULT : 0);
-}
-
-int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
-{
-	struct nfsctl_arg *karg = NULL;
-	union nfsctl_res *kres = NULL;
-	mm_segment_t oldfs;
-	int err;
-
-	karg = kmalloc(sizeof(*karg), GFP_USER);
-	if(!karg)
-		return -ENOMEM;
-	if(res32) {
-		kres = kmalloc(sizeof(*kres), GFP_USER);
-		if(!kres) {
-			kfree(karg);
-			return -ENOMEM;
-		}
-	}
-	switch(cmd) {
-	case NFSCTL_SVC:
-		err = nfs_svc32_trans(karg, arg32);
-		break;
-	case NFSCTL_ADDCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_DELCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_EXPORT:
-	case NFSCTL_UNEXPORT:
-		err = nfs_exp32_trans(karg, arg32);
-		break;
-	case NFSCTL_GETFD:
-		err = nfs_getfd32_trans(karg, arg32);
-		break;
-	case NFSCTL_GETFS:
-		err = nfs_getfs32_trans(karg, arg32);
-		break;
-	default:
-		err = -EINVAL;
-		break;
-	}
-	if(err)
-		goto done;
-	oldfs = get_fs();
-	set_fs(KERNEL_DS);
-	err = sys_nfsservctl(cmd, karg, kres);
-	set_fs(oldfs);
-
-	if (err)
-		goto done;
-
-	if((cmd == NFSCTL_GETFD) ||
-	   (cmd == NFSCTL_GETFS))
-		err = nfs_getfh32_res_trans(kres, res32);
-
-done:
-	if(karg)
-		kfree(karg);
-	if(kres)
-		kfree(kres);
-	return err;
-}
-#else /* !NFSD */
-int asmlinkage sys32_nfsservctl(int cmd, void *notused, void *notused2)
-{
-	return sys_ni_syscall();
-}
-#endif
-
 /* Translations due to time_t size differences.  Which affects all
    sorts of things, like timeval and itimerval.  */
 
 extern struct timezone sys_tz;
 
-asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
+asmlinkage long sys32_gettimeofday(struct compat_timeval __user *tv,
+				   struct timezone __user *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -2155,7 +1462,7 @@
 	return 0;
 }
 
-static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
+static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
 {
 	long usec;
 
@@ -2169,7 +1476,8 @@
 	return 0;
 }
 
-asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
+asmlinkage long sys32_settimeofday(struct compat_timeval __user *tv,
+				   struct timezone __user *tz)
 {
 	struct timespec kts;
 	struct timezone ktz;
@@ -2186,99 +1494,76 @@
 	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
-asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs)
+asmlinkage long sys32_utimes(char __user *filename,
+			     struct compat_timeval __user *tvs)
 {
-	char *kfilename;
 	struct timeval ktvs[2];
-	mm_segment_t old_fs;
-	int ret;
-
-	kfilename = getname(filename);
-	ret = PTR_ERR(kfilename);
-	if (!IS_ERR(kfilename)) {
-		if (tvs) {
-			if (get_tv32(&ktvs[0], tvs) ||
-			    get_tv32(&ktvs[1], 1+tvs))
-				return -EFAULT;
-		}
-
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		ret = do_utimes(kfilename, (tvs ? &ktvs[0] : NULL));
-		set_fs(old_fs);
 
-		putname(kfilename);
+	if (tvs) {
+		if (get_tv32(&ktvs[0], tvs) ||
+		    get_tv32(&ktvs[1], 1+tvs))
+			return -EFAULT;
 	}
-	return ret;
+
+	return do_utimes(filename, (tvs ? &ktvs[0] : NULL));
 }
 
 /* These are here just in case some old sparc32 binary calls it. */
-asmlinkage int sys32_pause(void)
+asmlinkage long sys32_pause(void)
 {
 	current->state = TASK_INTERRUPTIBLE;
 	schedule();
 	return -ERESTARTNOHAND;
 }
 
-/* PCI config space poking. */
-
-asmlinkage int sys32_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
-{
-	return sys_pciconfig_read((unsigned long) bus,
-				  (unsigned long) dfn,
-				  (unsigned long) off,
-				  (unsigned long) len,
-				  (unsigned char *)AA(ubuf));
-}
-
-asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
-{
-	return sys_pciconfig_write((unsigned long) bus,
-				   (unsigned long) dfn,
-				   (unsigned long) off,
-				   (unsigned long) len,
-				   (unsigned char *)AA(ubuf));
-}
-
-asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
+asmlinkage compat_ssize_t sys32_pread64(unsigned int fd,
+					char __user *ubuf,
+					compat_size_t count,
+					unsigned long poshi,
+					unsigned long poslo)
 {
-	return sys_prctl(option,
-			 (unsigned long) arg2,
-			 (unsigned long) arg3,
-			 (unsigned long) arg4,
-			 (unsigned long) arg5);
+	return sys_pread64(fd, ubuf, count, (poshi << 32) | poslo);
 }
 
-
-asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf,
-				   compat_size_t count, u32 poshi, u32 poslo)
+asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd,
+					 char __user *ubuf,
+					 compat_size_t count,
+					 unsigned long poshi,
+					 unsigned long poslo)
 {
-	return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+	return sys_pwrite64(fd, ubuf, count, (poshi << 32) | poslo);
 }
 
-asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf,
-				    compat_size_t count, u32 poshi, u32 poslo)
+asmlinkage long compat_sys_readahead(int fd,
+				     unsigned long offhi,
+				     unsigned long offlo,
+				     compat_size_t count)
 {
-	return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+	return sys_readahead(fd, (offhi << 32) | offlo, count);
 }
 
-asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count)
+long compat_sys_fadvise64(int fd,
+			  unsigned long offhi,
+			  unsigned long offlo,
+			  compat_size_t len, int advice)
 {
-	return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
+	return sys_fadvise64_64(fd, (offhi << 32) | offlo, len, advice);
 }
 
-long sys32_fadvise64(int fd, u32 offhi, u32 offlo, s32 len, int advice)
+long compat_sys_fadvise64_64(int fd,
+			     unsigned long offhi, unsigned long offlo,
+			     unsigned long lenhi, unsigned long lenlo,
+			     int advice)
 {
-	return sys_fadvise64_64(fd, ((loff_t)AA(offhi)<<32)|AA(offlo), len, advice);
+	return sys_fadvise64_64(fd,
+				(offhi << 32) | offlo,
+				(lenhi << 32) | lenlo,
+				advice);
 }
 
-long sys32_fadvise64_64(int fd, u32 offhi, u32 offlo, u32 lenhi, u32 lenlo, int advice)
-{
-	return sys_fadvise64_64(fd, ((loff_t)AA(offhi)<<32)|AA(offlo),
-				((loff_t)AA(lenhi)<<32)|AA(lenlo), advice);
-}
-
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
+asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
+				    compat_off_t __user *offset,
+				    compat_size_t count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -2288,7 +1573,9 @@
 		return -EFAULT;
 		
 	set_fs(KERNEL_DS);
-	ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
+	ret = sys_sendfile(out_fd, in_fd,
+			   offset ? (off_t __user *) &of : NULL,
+			   count);
 	set_fs(old_fs);
 	
 	if (offset && put_user(of, offset))
@@ -2297,7 +1584,9 @@
 	return ret;
 }
 
-asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count)
+asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd,
+				      compat_loff_t __user *offset,
+				      compat_size_t count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -2307,7 +1596,9 @@
 		return -EFAULT;
 		
 	set_fs(KERNEL_DS);
-	ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count);
+	ret = sys_sendfile64(out_fd, in_fd,
+			     offset ? (loff_t __user *) &lof : NULL,
+			     count);
 	set_fs(old_fs);
 	
 	if (offset && put_user(lof, offset))
@@ -2333,57 +1624,57 @@
 
 extern int do_adjtimex(struct timex *);
 
-asmlinkage int sys32_adjtimex(struct timex32 *utp)
+asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
 {
 	struct timex txc;
 	int ret;
 
 	memset(&txc, 0, sizeof(struct timex));
 
-	if(get_user(txc.modes, &utp->modes) ||
-	   __get_user(txc.offset, &utp->offset) ||
-	   __get_user(txc.freq, &utp->freq) ||
-	   __get_user(txc.maxerror, &utp->maxerror) ||
-	   __get_user(txc.esterror, &utp->esterror) ||
-	   __get_user(txc.status, &utp->status) ||
-	   __get_user(txc.constant, &utp->constant) ||
-	   __get_user(txc.precision, &utp->precision) ||
-	   __get_user(txc.tolerance, &utp->tolerance) ||
-	   __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
-	   __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
-	   __get_user(txc.tick, &utp->tick) ||
-	   __get_user(txc.ppsfreq, &utp->ppsfreq) ||
-	   __get_user(txc.jitter, &utp->jitter) ||
-	   __get_user(txc.shift, &utp->shift) ||
-	   __get_user(txc.stabil, &utp->stabil) ||
-	   __get_user(txc.jitcnt, &utp->jitcnt) ||
-	   __get_user(txc.calcnt, &utp->calcnt) ||
-	   __get_user(txc.errcnt, &utp->errcnt) ||
-	   __get_user(txc.stbcnt, &utp->stbcnt))
+	if (get_user(txc.modes, &utp->modes) ||
+	    __get_user(txc.offset, &utp->offset) ||
+	    __get_user(txc.freq, &utp->freq) ||
+	    __get_user(txc.maxerror, &utp->maxerror) ||
+	    __get_user(txc.esterror, &utp->esterror) ||
+	    __get_user(txc.status, &utp->status) ||
+	    __get_user(txc.constant, &utp->constant) ||
+	    __get_user(txc.precision, &utp->precision) ||
+	    __get_user(txc.tolerance, &utp->tolerance) ||
+	    __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
+	    __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
+	    __get_user(txc.tick, &utp->tick) ||
+	    __get_user(txc.ppsfreq, &utp->ppsfreq) ||
+	    __get_user(txc.jitter, &utp->jitter) ||
+	    __get_user(txc.shift, &utp->shift) ||
+	    __get_user(txc.stabil, &utp->stabil) ||
+	    __get_user(txc.jitcnt, &utp->jitcnt) ||
+	    __get_user(txc.calcnt, &utp->calcnt) ||
+	    __get_user(txc.errcnt, &utp->errcnt) ||
+	    __get_user(txc.stbcnt, &utp->stbcnt))
 		return -EFAULT;
 
 	ret = do_adjtimex(&txc);
 
-	if(put_user(txc.modes, &utp->modes) ||
-	   __put_user(txc.offset, &utp->offset) ||
-	   __put_user(txc.freq, &utp->freq) ||
-	   __put_user(txc.maxerror, &utp->maxerror) ||
-	   __put_user(txc.esterror, &utp->esterror) ||
-	   __put_user(txc.status, &utp->status) ||
-	   __put_user(txc.constant, &utp->constant) ||
-	   __put_user(txc.precision, &utp->precision) ||
-	   __put_user(txc.tolerance, &utp->tolerance) ||
-	   __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
-	   __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
-	   __put_user(txc.tick, &utp->tick) ||
-	   __put_user(txc.ppsfreq, &utp->ppsfreq) ||
-	   __put_user(txc.jitter, &utp->jitter) ||
-	   __put_user(txc.shift, &utp->shift) ||
-	   __put_user(txc.stabil, &utp->stabil) ||
-	   __put_user(txc.jitcnt, &utp->jitcnt) ||
-	   __put_user(txc.calcnt, &utp->calcnt) ||
-	   __put_user(txc.errcnt, &utp->errcnt) ||
-	   __put_user(txc.stbcnt, &utp->stbcnt))
+	if (put_user(txc.modes, &utp->modes) ||
+	    __put_user(txc.offset, &utp->offset) ||
+	    __put_user(txc.freq, &utp->freq) ||
+	    __put_user(txc.maxerror, &utp->maxerror) ||
+	    __put_user(txc.esterror, &utp->esterror) ||
+	    __put_user(txc.status, &utp->status) ||
+	    __put_user(txc.constant, &utp->constant) ||
+	    __put_user(txc.precision, &utp->precision) ||
+	    __put_user(txc.tolerance, &utp->tolerance) ||
+	    __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
+	    __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
+	    __put_user(txc.tick, &utp->tick) ||
+	    __put_user(txc.ppsfreq, &utp->ppsfreq) ||
+	    __put_user(txc.jitter, &utp->jitter) ||
+	    __put_user(txc.shift, &utp->shift) ||
+	    __put_user(txc.stabil, &utp->stabil) ||
+	    __put_user(txc.jitcnt, &utp->jitcnt) ||
+	    __put_user(txc.calcnt, &utp->calcnt) ||
+	    __put_user(txc.errcnt, &utp->errcnt) ||
+	    __put_user(txc.stbcnt, &utp->stbcnt))
 		ret = -EFAULT;
 
 	return ret;
@@ -2393,7 +1684,8 @@
  * not force O_LARGEFILE on.
  */
 
-asmlinkage long sparc32_open(const char * filename, int flags, int mode)
+asmlinkage long sparc32_open(const char __user *filename,
+			     int flags, int mode)
 {
 	char * tmp;
 	int fd, error;
@@ -2430,7 +1722,7 @@
 {
 	struct vm_area_struct *vma;
 	unsigned long ret = -EINVAL;
-	unsigned long new_addr = AA(__new_addr);
+	unsigned long new_addr = __new_addr;
 
 	if (old_len > 0xf0000000UL || new_len > 0xf0000000UL)
 		goto out;
@@ -2471,13 +1763,6 @@
 	return ret;       
 }
 
-asmlinkage int sys_setpriority32(u32 which, u32 who, u32 niceval)
-{
-	return sys_setpriority((int) which,
-			       (int) who,
-			       (int) niceval);
-}
-
 struct __sysctl_args32 {
 	u32 name;
 	int nlen;
@@ -2488,15 +1773,15 @@
 	u32 __unused[4];
 };
 
-asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
+asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
 {
 #ifndef CONFIG_SYSCTL
 	return -ENOSYS;
 #else
 	struct __sysctl_args32 tmp;
 	int error;
-	size_t oldlen, *oldlenp = NULL;
-	unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
+	size_t oldlen, __user *oldlenp = NULL;
+	unsigned long addr = (((unsigned long)&args->__unused[0]) + 7UL) & ~7UL;
 
 	if (copy_from_user(&tmp, args, sizeof(tmp)))
 		return -EFAULT;
@@ -2508,20 +1793,24 @@
 		   basically copy the whole sysctl.c here, and
 		   glibc's __sysctl uses rw memory for the structure
 		   anyway.  */
-		if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) ||
-		    put_user(oldlen, (size_t *)addr))
+		if (get_user(oldlen, (u32 __user *)(unsigned long)tmp.oldlenp) ||
+		    put_user(oldlen, (size_t __user *)addr))
 			return -EFAULT;
-		oldlenp = (size_t *)addr;
+		oldlenp = (size_t __user *)addr;
 	}
 
 	lock_kernel();
-	error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval),
-			  oldlenp, (void *)A(tmp.newval), tmp.newlen);
+	error = do_sysctl((int __user *)(unsigned long) tmp.name,
+			  tmp.nlen,
+			  (void __user *)(unsigned long) tmp.oldval,
+			  oldlenp,
+			  (void __user *)(unsigned long) tmp.newval,
+			  tmp.newlen);
 	unlock_kernel();
 	if (oldlenp) {
 		if (!error) {
-			if (get_user(oldlen, (size_t *)addr) ||
-			    put_user(oldlen, (u32 *)A(tmp.oldlenp)))
+			if (get_user(oldlen, (size_t __user *)addr) ||
+			    put_user(oldlen, (u32 __user *)(unsigned long) tmp.oldlenp))
 				error = -EFAULT;
 		}
 		copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
@@ -2530,18 +1819,22 @@
 #endif
 }
 
-long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len)
+long sys32_lookup_dcookie(unsigned long cookie_high,
+			  unsigned long cookie_low,
+			  char __user *buf, size_t len)
 {
-	return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
+	return sys_lookup_dcookie((cookie_high << 32) | cookie_low,
 				  buf, len);
 }
 
 extern asmlinkage long
-sys_timer_create(clockid_t which_clock, struct sigevent *timer_event_spec,
-		 timer_t * created_timer_id);
+sys_timer_create(clockid_t which_clock,
+		 struct sigevent __user *timer_event_spec,
+		 timer_t __user *created_timer_id);
 
 long
-sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
+sys32_timer_create(u32 clock, struct sigevent32 __user *se32,
+		   timer_t __user *timer_id)
 {
 	struct sigevent se;
 	mm_segment_t oldfs;
@@ -2564,7 +1857,9 @@
 
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-	err = sys_timer_create(clock, &se, &t);
+	err = sys_timer_create(clock,
+			       (struct sigevent __user *) &se,
+			       (timer_t __user *) &t);
 	set_fs(oldfs);
 
 	if (!err)
diff -Nru a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
--- a/arch/sparc64/kernel/sys_sunos32.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc64/kernel/sys_sunos32.c	Tue Jun 15 22:20:41 2004
@@ -59,15 +59,6 @@
 #include <net/sock.h>
 #include <net/compat.h>
 
-/* Use this to get at 32-bit user passed pointers. */
-#define A(__x)				\
-({	unsigned long __ret;		\
-	__asm__ ("srl	%0, 0, %0"	\
-		 : "=r" (__ret)		\
-		 : "0" (__x));		\
-	__ret;				\
-})
-
 #define SUNOS_NR_OPEN	256
 
 asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 off)
@@ -187,7 +178,7 @@
 	/* This should do it hopefully... */
 	oldbrk = (int)current->mm->brk;
 	error = sunos_brk(((int) current->mm->brk) + increment);
-	if(!error)
+	if (!error)
 		error = oldbrk;
 	return error;
 }
@@ -273,19 +264,19 @@
 };
 
 struct sunos_dirent_callback {
-    struct sunos_dirent *curr;
-    struct sunos_dirent *previous;
+    struct sunos_dirent __user *curr;
+    struct sunos_dirent __user *previous;
     int count;
     int error;
 };
 
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(s32)-1) & ~(sizeof(s32)-1))
 
 static int sunos_filldir(void * __buf, const char * name, int namlen,
 			 loff_t offset, ino_t ino, unsigned int d_type)
 {
-	struct sunos_dirent * dirent;
+	struct sunos_dirent __user *dirent;
 	struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
@@ -302,32 +293,31 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (void *) dirent + reclen;
+	dirent = (void __user *) dirent + reclen;
 	buf->curr = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt)
+asmlinkage int sunos_getdents(unsigned int fd, void __user *dirent, int cnt)
 {
 	struct file * file;
-	struct sunos_dirent * lastdirent;
+	struct sunos_dirent __user *lastdirent;
 	struct sunos_dirent_callback buf;
 	int error = -EBADF;
-	void *dirent = (void *)A(u_dirent);
 
-	if(fd >= SUNOS_NR_OPEN)
+	if (fd >= SUNOS_NR_OPEN)
 		goto out;
 
 	file = fget(fd);
-	if(!file)
+	if (!file)
 		goto out;
 
 	error = -EINVAL;
-	if(cnt < (sizeof(struct sunos_dirent) + 255))
+	if (cnt < (sizeof(struct sunos_dirent) + 255))
 		goto out_putf;
 
-	buf.curr = (struct sunos_dirent *) dirent;
+	buf.curr = (struct sunos_dirent __user *) dirent;
 	buf.previous = NULL;
 	buf.count = cnt;
 	buf.error = 0;
@@ -358,8 +348,8 @@
 };
 
 struct sunos_direntry_callback {
-    struct sunos_direntry *curr;
-    struct sunos_direntry *previous;
+    struct sunos_direntry __user *curr;
+    struct sunos_direntry __user *previous;
     int count;
     int error;
 };
@@ -367,8 +357,9 @@
 static int sunos_filldirentry(void * __buf, const char * name, int namlen,
 			      loff_t offset, ino_t ino, unsigned int d_type)
 {
-	struct sunos_direntry * dirent;
-	struct sunos_direntry_callback * buf = (struct sunos_direntry_callback *) __buf;
+	struct sunos_direntry __user *dirent;
+	struct sunos_direntry_callback * buf =
+		(struct sunos_direntry_callback *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
 
 	buf->error = -EINVAL;	/* only used if we fail.. */
@@ -382,34 +373,34 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (void *) dirent + reclen;
+	dirent = (void __user *) dirent + reclen;
 	buf->curr = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
-asmlinkage int sunos_getdirentries(unsigned int fd, u32 u_dirent,
-				   int cnt, u32 u_basep)
+asmlinkage int sunos_getdirentries(unsigned int fd,
+				   void __user *dirent,
+				   int cnt,
+				   unsigned int __user *basep)
 {
-	void *dirent = (void *) A(u_dirent);
-	unsigned int *basep = (unsigned int *)A(u_basep);
 	struct file * file;
-	struct sunos_direntry * lastdirent;
+	struct sunos_direntry __user *lastdirent;
 	int error = -EBADF;
 	struct sunos_direntry_callback buf;
 
-	if(fd >= SUNOS_NR_OPEN)
+	if (fd >= SUNOS_NR_OPEN)
 		goto out;
 
 	file = fget(fd);
-	if(!file)
+	if (!file)
 		goto out;
 
 	error = -EINVAL;
-	if(cnt < (sizeof(struct sunos_direntry) + 255))
+	if (cnt < (sizeof(struct sunos_direntry) + 255))
 		goto out_putf;
 
-	buf.curr = (struct sunos_direntry *) dirent;
+	buf.curr = (struct sunos_direntry __user *) dirent;
 	buf.previous = NULL;
 	buf.count = cnt;
 	buf.error = 0;
@@ -440,17 +431,22 @@
 	char mach[9];
 };
 
-asmlinkage int sunos_uname(struct sunos_utsname *name)
+asmlinkage int sunos_uname(struct sunos_utsname __user *name)
 {
 	int ret;
 
 	down_read(&uts_sem);
-	ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1);
-	ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1);
+	ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0],
+			   sizeof(name->sname) - 1);
+	ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0],
+			    sizeof(name->nname) - 1);
 	ret |= put_user('\0', &name->nname[8]);
-	ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1);
-	ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1);
-	ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1);
+	ret |= copy_to_user(&name->rel[0], &system_utsname.release[0],
+			    sizeof(name->rel) - 1);
+	ret |= copy_to_user(&name->ver[0], &system_utsname.version[0],
+			    sizeof(name->ver) - 1);
+	ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0],
+			    sizeof(name->mach) - 1);
 	up_read(&uts_sem);
 	return (ret ? -EFAULT : 0);
 }
@@ -528,18 +524,15 @@
 	return ret;
 }
 
-/* SunOS mount system call emulation */
-extern asmlinkage int
-sys32_select(int n, u32 inp, u32 outp, u32 exp, u32 tvp);
-
 asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x)
 {
 	int ret;
 
 	/* SunOS binaries expect that select won't change the tvp contents */
-	ret = sys32_select (width, inp, outp, exp, tvp_x);
+	ret = compat_sys_select(width, compat_ptr(inp), compat_ptr(outp),
+				compat_ptr(exp), compat_ptr(tvp_x));
 	if (ret == -EINTR && tvp_x) {
-		struct compat_timeval *tvp = (struct compat_timeval *)A(tvp_x);
+		struct compat_timeval __user *tvp = compat_ptr(tvp_x);
 		time_t sec, usec;
 
 		__get_user(sec, &tvp->tv_sec);
@@ -555,6 +548,10 @@
 	return;
 }
 
+#if 0 /* This code doesn't translate user pointers correctly,
+       * disable for now. -DaveM
+       */
+
 /* XXXXXXXXXX SunOS mount/umount. XXXXXXXXXXX */
 #define SMNT_RDONLY       1
 #define SMNT_NOSUID       2
@@ -603,7 +600,7 @@
 	struct file   *file;
 
 	file = fget(fd);
-	if(!file)
+	if (!file)
 		return 0;
 
 	inode = file->f_dentry->d_inode;
@@ -648,7 +645,7 @@
 }
 
 /* XXXXXXXXXXXXXXXXXXXX */
-static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
+static int sunos_nfs_mount(char *dir_name, int linux_flags, void __user *data)
 {
 	int  server_fd, err;
 	char *the_name, *mount_page;
@@ -668,10 +665,10 @@
 	if (server_fd < 0)
 		return -ENXIO;
 
-	if (copy_from_user(&linux_nfs_mount.addr,sunos_mount.addr,
-				sizeof(*sunos_mount.addr)) ||
-	    copy_from_user(&linux_nfs_mount.root,sunos_mount.fh,
-				sizeof(*sunos_mount.fh))) {
+	if (copy_from_user(&linux_nfs_mount.addr, sunos_mount.addr,
+			   sizeof(*sunos_mount.addr)) ||
+	    copy_from_user(&linux_nfs_mount.root, sunos_mount.fh,
+			   sizeof(*sunos_mount.fh))) {
 		sys_close (server_fd);
 		return -EFAULT;
 	}
@@ -697,7 +694,7 @@
 	linux_nfs_mount.acdirmax = sunos_mount.acdirmax;
 
 	the_name = getname(sunos_mount.hostname);
-	if(IS_ERR(the_name))
+	if (IS_ERR(the_name))
 		return PTR_ERR(the_name);
 
 	strlcpy(linux_nfs_mount.hostname, the_name,
@@ -736,11 +733,11 @@
 	if (flags & (SMNT_GRPID|SMNT_NOSUB|SMNT_MULTI|SMNT_SYS5))
 		goto out;
 
-	if(flags & SMNT_REMOUNT)
+	if (flags & SMNT_REMOUNT)
 		linux_flags |= MS_REMOUNT;
-	if(flags & SMNT_RDONLY)
+	if (flags & SMNT_RDONLY)
 		linux_flags |= MS_RDONLY;
-	if(flags & SMNT_NOSUID)
+	if (flags & SMNT_NOSUID)
 		linux_flags |= MS_NOSUID;
 
 	dir_page = getname(dir);
@@ -753,20 +750,20 @@
 	if (IS_ERR(type_page))
 		goto out1;
 
-	if(strcmp(type_page, "ext2") == 0) {
+	if (strcmp(type_page, "ext2") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "iso9660") == 0) {
+	} else if (strcmp(type_page, "iso9660") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "minix") == 0) {
+	} else if (strcmp(type_page, "minix") == 0) {
 		dev_fname = getname(data);
-	} else if(strcmp(type_page, "nfs") == 0) {
+	} else if (strcmp(type_page, "nfs") == 0) {
 		ret = sunos_nfs_mount (dir_page, flags, data);
 		goto out2;
-        } else if(strcmp(type_page, "ufs") == 0) {
+        } else if (strcmp(type_page, "ufs") == 0) {
 		printk("Warning: UFS filesystem mounts unsupported.\n");
 		ret = -ENODEV;
 		goto out2;
-	} else if(strcmp(type_page, "proc")) {
+	} else if (strcmp(type_page, "proc")) {
 		ret = -ENODEV;
 		goto out2;
 	}
@@ -785,15 +782,15 @@
 out:
 	return ret;
 }
-
+#endif
 
 asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
 {
 	int ret;
 
 	/* So stupid... */
-	if((!pid || pid == current->pid) &&
-	   !pgid) {
+	if ((!pid || pid == current->pid) &&
+	    !pgid) {
 		sys_setsid();
 		ret = 0;
 	} else {
@@ -803,16 +800,15 @@
 }
 
 /* So stupid... */
-extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int,
-			     struct compat_rusage *);
+extern long compat_sys_wait4(compat_pid_t, compat_uint_t __user *, int,
+			     struct compat_rusage __user *);
 
-asmlinkage int sunos_wait4(compat_pid_t pid, u32 stat_addr, int options, u32 ru)
+asmlinkage int sunos_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru)
 {
 	int ret;
 
 	ret = compat_sys_wait4((pid ? pid : ((compat_pid_t)-1)),
-			       (compat_uint_t *)A(stat_addr), options,
-			       (struct compat_rusage *)A(ru));
+			       stat_addr, options, ru);
 	return ret;
 }
 
@@ -828,7 +824,7 @@
 	return -1;
 }
 
-extern asmlinkage u32 sunos_gethostid(void)
+asmlinkage u32 sunos_gethostid(void)
 {
 	u32 ret;
 
@@ -847,7 +843,7 @@
 #define   _SC_SAVED_IDS           7
 #define   _SC_VERSION             8
 
-extern asmlinkage s32 sunos_sysconf (int name)
+asmlinkage s32 sunos_sysconf (int name)
 {
 	s32 ret;
 
@@ -886,7 +882,7 @@
 	return ret;
 }
 
-asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
+asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, void __user *ptr)
 {
 	union semun arg4;
 	int ret;
@@ -911,7 +907,8 @@
 			arg3=SETALL; break;
 		}
 		/* sys_semctl(): */
-		arg4.__pad=(void *)A(ptr); /* value to modify semaphore to */
+		/* value to modify semaphore to */
+		arg4.__pad = ptr;
 		ret = sys_semctl((int)arg1, (int)arg2, (int)arg3, arg4);
 		break;
 	case 1:
@@ -920,7 +917,8 @@
 		break;
 	case 2:
 		/* sys_semop(): */
-		ret = sys_semop((int)arg1, (struct sembuf *)A(arg2), (unsigned)arg3);
+		ret = sys_semop((int)arg1, (struct sembuf __user *)(unsigned long)arg2,
+				(unsigned int) arg3);
 		break;
 	default:
 		ret = -EINVAL;
@@ -962,65 +960,65 @@
         compat_ipc_pid_t msg_lrpid;
 };
 
-static inline int sunos_msqid_get(struct msqid_ds32 *user,
+static inline int sunos_msqid_get(struct msqid_ds32 __user *user,
 				  struct msqid_ds *kern)
 {
-	if(get_user(kern->msg_perm.key, &user->msg_perm.key)		||
-	   __get_user(kern->msg_perm.uid, &user->msg_perm.uid)		||
-	   __get_user(kern->msg_perm.gid, &user->msg_perm.gid)		||
-	   __get_user(kern->msg_perm.cuid, &user->msg_perm.cuid)	||
-	   __get_user(kern->msg_perm.cgid, &user->msg_perm.cgid)	||
-	   __get_user(kern->msg_stime, &user->msg_stime)		||
-	   __get_user(kern->msg_rtime, &user->msg_rtime)		||
-	   __get_user(kern->msg_ctime, &user->msg_ctime)		||
-	   __get_user(kern->msg_ctime, &user->msg_cbytes)		||
-	   __get_user(kern->msg_ctime, &user->msg_qnum)			||
-	   __get_user(kern->msg_ctime, &user->msg_qbytes)		||
-	   __get_user(kern->msg_ctime, &user->msg_lspid)		||
-	   __get_user(kern->msg_ctime, &user->msg_lrpid))
+	if (get_user(kern->msg_perm.key, &user->msg_perm.key)		||
+	    __get_user(kern->msg_perm.uid, &user->msg_perm.uid)		||
+	    __get_user(kern->msg_perm.gid, &user->msg_perm.gid)		||
+	    __get_user(kern->msg_perm.cuid, &user->msg_perm.cuid)	||
+	    __get_user(kern->msg_perm.cgid, &user->msg_perm.cgid)	||
+	    __get_user(kern->msg_stime, &user->msg_stime)		||
+	    __get_user(kern->msg_rtime, &user->msg_rtime)		||
+	    __get_user(kern->msg_ctime, &user->msg_ctime)		||
+	    __get_user(kern->msg_ctime, &user->msg_cbytes)		||
+	    __get_user(kern->msg_ctime, &user->msg_qnum)		||
+	    __get_user(kern->msg_ctime, &user->msg_qbytes)		||
+	    __get_user(kern->msg_ctime, &user->msg_lspid)		||
+	    __get_user(kern->msg_ctime, &user->msg_lrpid))
 		return -EFAULT;
 	return 0;
 }
 
-static inline int sunos_msqid_put(struct msqid_ds32 *user,
+static inline int sunos_msqid_put(struct msqid_ds32 __user *user,
 				  struct msqid_ds *kern)
 {
-	if(put_user(kern->msg_perm.key, &user->msg_perm.key)		||
-	   __put_user(kern->msg_perm.uid, &user->msg_perm.uid)		||
-	   __put_user(kern->msg_perm.gid, &user->msg_perm.gid)		||
-	   __put_user(kern->msg_perm.cuid, &user->msg_perm.cuid)	||
-	   __put_user(kern->msg_perm.cgid, &user->msg_perm.cgid)	||
-	   __put_user(kern->msg_stime, &user->msg_stime)		||
-	   __put_user(kern->msg_rtime, &user->msg_rtime)		||
-	   __put_user(kern->msg_ctime, &user->msg_ctime)		||
-	   __put_user(kern->msg_ctime, &user->msg_cbytes)		||
-	   __put_user(kern->msg_ctime, &user->msg_qnum)			||
-	   __put_user(kern->msg_ctime, &user->msg_qbytes)		||
-	   __put_user(kern->msg_ctime, &user->msg_lspid)		||
-	   __put_user(kern->msg_ctime, &user->msg_lrpid))
+	if (put_user(kern->msg_perm.key, &user->msg_perm.key)		||
+	    __put_user(kern->msg_perm.uid, &user->msg_perm.uid)		||
+	    __put_user(kern->msg_perm.gid, &user->msg_perm.gid)		||
+	    __put_user(kern->msg_perm.cuid, &user->msg_perm.cuid)	||
+	    __put_user(kern->msg_perm.cgid, &user->msg_perm.cgid)	||
+	    __put_user(kern->msg_stime, &user->msg_stime)		||
+	    __put_user(kern->msg_rtime, &user->msg_rtime)		||
+	    __put_user(kern->msg_ctime, &user->msg_ctime)		||
+	    __put_user(kern->msg_ctime, &user->msg_cbytes)		||
+	    __put_user(kern->msg_ctime, &user->msg_qnum)		||
+	    __put_user(kern->msg_ctime, &user->msg_qbytes)		||
+	    __put_user(kern->msg_ctime, &user->msg_lspid)		||
+	    __put_user(kern->msg_ctime, &user->msg_lrpid))
 		return -EFAULT;
 	return 0;
 }
 
-static inline int sunos_msgbuf_get(struct msgbuf32 *user, struct msgbuf *kern, int len)
+static inline int sunos_msgbuf_get(struct msgbuf32 __user *user, struct msgbuf *kern, int len)
 {
-	if(get_user(kern->mtype, &user->mtype)	||
-	   __copy_from_user(kern->mtext, &user->mtext, len))
+	if (get_user(kern->mtype, &user->mtype)	||
+	    __copy_from_user(kern->mtext, &user->mtext, len))
 		return -EFAULT;
 	return 0;
 }
 
-static inline int sunos_msgbuf_put(struct msgbuf32 *user, struct msgbuf *kern, int len)
+static inline int sunos_msgbuf_put(struct msgbuf32 __user *user, struct msgbuf *kern, int len)
 {
-	if(put_user(kern->mtype, &user->mtype)	||
-	   __copy_to_user(user->mtext, kern->mtext, len))
+	if (put_user(kern->mtype, &user->mtype)	||
+	    __copy_to_user(user->mtext, kern->mtext, len))
 		return -EFAULT;
 	return 0;
 }
 
 asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
 {
-	struct sparc_stackf32 *sp;
+	struct sparc_stackf32 __user *sp;
 	struct msqid_ds kds;
 	struct msgbuf *kmbuf;
 	mm_segment_t old_fs = get_fs();
@@ -1032,13 +1030,13 @@
 		rval = sys_msgget((key_t)arg1, (int)arg2);
 		break;
 	case 1:
-		if(!sunos_msqid_get((struct msqid_ds32 *)A(arg3), &kds)) {
+		if (!sunos_msqid_get((struct msqid_ds32 __user *)(unsigned long)arg3, &kds)) {
 			set_fs(KERNEL_DS);
 			rval = sys_msgctl((int)arg1, (int)arg2,
-					  (struct msqid_ds *)A(arg3));
+					  (struct msqid_ds __user *)(unsigned long)arg3);
 			set_fs(old_fs);
-			if(!rval)
-				rval = sunos_msqid_put((struct msqid_ds32 *)A(arg3),
+			if (!rval)
+				rval = sunos_msqid_put((struct msqid_ds32 __user *)(unsigned long)arg3,
 						       &kds);
 		} else
 			rval = -EFAULT;
@@ -1047,21 +1045,22 @@
 		rval = -EFAULT;
 		kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3,
 						 GFP_KERNEL);
-		if(!kmbuf)
+		if (!kmbuf)
 			break;
-		sp = (struct sparc_stackf32 *)
+		sp = (struct sparc_stackf32 __user *)
 			(current_thread_info()->kregs->u_regs[UREG_FP] & 0xffffffffUL);
-		if(get_user(arg5, &sp->xxargs[0])) {
+		if (get_user(arg5, &sp->xxargs[0])) {
 			rval = -EFAULT;
 			kfree(kmbuf);
 			break;
 		}
 		set_fs(KERNEL_DS);
-		rval = sys_msgrcv((int)arg1, kmbuf, (size_t)arg3,
+		rval = sys_msgrcv((int)arg1, (struct msgbuf __user *) kmbuf,
+				  (size_t)arg3,
 				  (long)arg4, (int)arg5);
 		set_fs(old_fs);
-		if(!rval)
-			rval = sunos_msgbuf_put((struct msgbuf32 *)A(arg2),
+		if (!rval)
+			rval = sunos_msgbuf_put((struct msgbuf32 __user *)(unsigned long)arg2,
 						kmbuf, arg3);
 		kfree(kmbuf);
 		break;
@@ -1069,11 +1068,12 @@
 		rval = -EFAULT;
 		kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3,
 						 GFP_KERNEL);
-		if(!kmbuf || sunos_msgbuf_get((struct msgbuf32 *)A(arg2),
-					      kmbuf, arg3))
+		if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2,
+					       kmbuf, arg3))
 			break;
 		set_fs(KERNEL_DS);
-		rval = sys_msgsnd((int)arg1, kmbuf, (size_t)arg3, (int)arg4);
+		rval = sys_msgsnd((int)arg1, (struct msgbuf __user *) kmbuf,
+				  (size_t)arg3, (int)arg4);
 		set_fs(old_fs);
 		kfree(kmbuf);
 		break;
@@ -1095,40 +1095,40 @@
         unsigned short          shm_nattch;
 };
                                                         
-static inline int sunos_shmid_get(struct shmid_ds32 *user,
+static inline int sunos_shmid_get(struct shmid_ds32 __user *user,
 				  struct shmid_ds *kern)
 {
-	if(get_user(kern->shm_perm.key, &user->shm_perm.key)		||
-	   __get_user(kern->shm_perm.uid, &user->shm_perm.uid)		||
-	   __get_user(kern->shm_perm.gid, &user->shm_perm.gid)		||
-	   __get_user(kern->shm_perm.cuid, &user->shm_perm.cuid)	||
-	   __get_user(kern->shm_perm.cgid, &user->shm_perm.cgid)	||
-	   __get_user(kern->shm_segsz, &user->shm_segsz)		||
-	   __get_user(kern->shm_atime, &user->shm_atime)		||
-	   __get_user(kern->shm_dtime, &user->shm_dtime)		||
-	   __get_user(kern->shm_ctime, &user->shm_ctime)		||
-	   __get_user(kern->shm_cpid, &user->shm_cpid)			||
-	   __get_user(kern->shm_lpid, &user->shm_lpid)			||
-	   __get_user(kern->shm_nattch, &user->shm_nattch))
+	if (get_user(kern->shm_perm.key, &user->shm_perm.key)		||
+	    __get_user(kern->shm_perm.uid, &user->shm_perm.uid)		||
+	    __get_user(kern->shm_perm.gid, &user->shm_perm.gid)		||
+	    __get_user(kern->shm_perm.cuid, &user->shm_perm.cuid)	||
+	    __get_user(kern->shm_perm.cgid, &user->shm_perm.cgid)	||
+	    __get_user(kern->shm_segsz, &user->shm_segsz)		||
+	    __get_user(kern->shm_atime, &user->shm_atime)		||
+	    __get_user(kern->shm_dtime, &user->shm_dtime)		||
+	    __get_user(kern->shm_ctime, &user->shm_ctime)		||
+	    __get_user(kern->shm_cpid, &user->shm_cpid)			||
+	    __get_user(kern->shm_lpid, &user->shm_lpid)			||
+	    __get_user(kern->shm_nattch, &user->shm_nattch))
 		return -EFAULT;
 	return 0;
 }
 
-static inline int sunos_shmid_put(struct shmid_ds32 *user,
+static inline int sunos_shmid_put(struct shmid_ds32 __user *user,
 				  struct shmid_ds *kern)
 {
-	if(put_user(kern->shm_perm.key, &user->shm_perm.key)		||
-	   __put_user(kern->shm_perm.uid, &user->shm_perm.uid)		||
-	   __put_user(kern->shm_perm.gid, &user->shm_perm.gid)		||
-	   __put_user(kern->shm_perm.cuid, &user->shm_perm.cuid)	||
-	   __put_user(kern->shm_perm.cgid, &user->shm_perm.cgid)	||
-	   __put_user(kern->shm_segsz, &user->shm_segsz)		||
-	   __put_user(kern->shm_atime, &user->shm_atime)		||
-	   __put_user(kern->shm_dtime, &user->shm_dtime)		||
-	   __put_user(kern->shm_ctime, &user->shm_ctime)		||
-	   __put_user(kern->shm_cpid, &user->shm_cpid)			||
-	   __put_user(kern->shm_lpid, &user->shm_lpid)			||
-	   __put_user(kern->shm_nattch, &user->shm_nattch))
+	if (put_user(kern->shm_perm.key, &user->shm_perm.key)		||
+	    __put_user(kern->shm_perm.uid, &user->shm_perm.uid)		||
+	    __put_user(kern->shm_perm.gid, &user->shm_perm.gid)		||
+	    __put_user(kern->shm_perm.cuid, &user->shm_perm.cuid)	||
+	    __put_user(kern->shm_perm.cgid, &user->shm_perm.cgid)	||
+	    __put_user(kern->shm_segsz, &user->shm_segsz)		||
+	    __put_user(kern->shm_atime, &user->shm_atime)		||
+	    __put_user(kern->shm_dtime, &user->shm_dtime)		||
+	    __put_user(kern->shm_ctime, &user->shm_ctime)		||
+	    __put_user(kern->shm_cpid, &user->shm_cpid)			||
+	    __put_user(kern->shm_lpid, &user->shm_lpid)			||
+	    __put_user(kern->shm_nattch, &user->shm_nattch))
 		return -EFAULT;
 	return 0;
 }
@@ -1143,25 +1143,26 @@
 	switch(op) {
 	case 0:
 		/* do_shmat(): attach a shared memory area */
-		rval = do_shmat((int)arg1,(char *)A(arg2),(int)arg3,&raddr);
-		if(!rval)
+		rval = do_shmat((int)arg1,(char __user *)(unsigned long)arg2,(int)arg3,&raddr);
+		if (!rval)
 			rval = (int) raddr;
 		break;
 	case 1:
 		/* sys_shmctl(): modify shared memory area attr. */
-		if(!sunos_shmid_get((struct shmid_ds32 *)A(arg3), &ksds)) {
+		if (!sunos_shmid_get((struct shmid_ds32 __user *)(unsigned long)arg3, &ksds)) {
 			set_fs(KERNEL_DS);
-			rval = sys_shmctl((int)arg1,(int)arg2, &ksds);
+			rval = sys_shmctl((int) arg1,(int) arg2,
+					  (struct shmid_ds __user *) &ksds);
 			set_fs(old_fs);
-			if(!rval)
-				rval = sunos_shmid_put((struct shmid_ds32 *)A(arg3),
+			if (!rval)
+				rval = sunos_shmid_put((struct shmid_ds32 __user *)(unsigned long)arg3,
 						       &ksds);
 		} else
 			rval = -EFAULT;
 		break;
 	case 2:
 		/* sys_shmdt(): detach a shared memory area */
-		rval = sys_shmdt((char *)A(arg1));
+		rval = sys_shmdt((char __user *)(unsigned long)arg1);
 		break;
 	case 3:
 		/* sys_shmget(): get a shared memory area */
@@ -1203,64 +1204,60 @@
 	return ret;
 }
 
-extern asmlinkage int sys32_readv(u32 fd, u32 vector, s32 count);
-extern asmlinkage int sys32_writev(u32 fd, u32 vector, s32 count);
-
-asmlinkage int sunos_read(unsigned int fd, u32 buf, u32 count)
+asmlinkage int sunos_read(unsigned int fd, char __user *buf, u32 count)
 {
 	int ret;
 
-	ret = check_nonblock(sys_read(fd, (char *)A(buf), count), fd);
+	ret = check_nonblock(sys_read(fd, buf, count), fd);
 	return ret;
 }
 
-asmlinkage int sunos_readv(u32 fd, u32 vector, s32 count)
+asmlinkage int sunos_readv(u32 fd, void __user *vector, s32 count)
 {
 	int ret;
 
-	ret = check_nonblock(sys32_readv(fd, vector, count), fd);
+	ret = check_nonblock(compat_sys_readv(fd, vector, count), fd);
 	return ret;
 }
 
-asmlinkage int sunos_write(unsigned int fd, u32 buf, u32 count)
+asmlinkage int sunos_write(unsigned int fd, char __user *buf, u32 count)
 {
 	int ret;
 
-	ret = check_nonblock(sys_write(fd, (char *)A(buf), count), fd);
+	ret = check_nonblock(sys_write(fd, buf, count), fd);
 	return ret;
 }
 
-asmlinkage int sunos_writev(u32 fd, u32 vector, s32 count)
+asmlinkage int sunos_writev(u32 fd, void __user *vector, s32 count)
 {
 	int ret;
 
-	ret = check_nonblock(sys32_writev(fd, vector, count), fd);
+	ret = check_nonblock(compat_sys_writev(fd, vector, count), fd);
 	return ret;
 }
 
-asmlinkage int sunos_recv(int fd, u32 ubuf, int size, unsigned flags)
+asmlinkage int sunos_recv(u32 __fd, void __user *ubuf, int size, unsigned flags)
 {
-	int ret;
+	int ret, fd = (int) __fd;
 
-	ret = check_nonblock(sys_recv(fd, (void *)A(ubuf), size, flags), fd);
+	ret = check_nonblock(sys_recv(fd, ubuf, size, flags), fd);
 	return ret;
 }
 
-asmlinkage int sunos_send(int fd, u32 buff, int len, unsigned flags)
+asmlinkage int sunos_send(u32 __fd, void __user *buff, int len, unsigned flags)
 {
-	int ret;
+	int ret, fd = (int) __fd;
 
-	ret = check_nonblock(sys_send(fd, (void *)A(buff), len, flags), fd);
+	ret = check_nonblock(sys_send(fd, buff, len, flags), fd);
 	return ret;
 }
 
-asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen)
+asmlinkage int sunos_accept(u32 __fd, struct sockaddr __user *sa, int __user *addrlen)
 {
-	int ret;
+	int ret, fd = (int) __fd;
 
 	while (1) {
-		ret = check_nonblock(sys_accept(fd, (struct sockaddr *)A(sa),
-						(int *)A(addrlen)), fd);
+		ret = check_nonblock(sys_accept(fd, sa, addrlen), fd);
 		if (ret != -ENETUNREACH && ret != -EHOSTUNREACH)
 			break;
 	}
@@ -1269,7 +1266,9 @@
 
 #define SUNOS_SV_INTERRUPT 2
 
-asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact)
+asmlinkage int sunos_sigaction (int sig,
+				struct old_sigaction32 __user *act,
+				struct old_sigaction32 __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -1278,11 +1277,11 @@
 		compat_old_sigset_t mask;
 		u32 u_handler;
 
-		if (get_user(u_handler, &((struct old_sigaction32 *)A(act))->sa_handler) ||
-		    __get_user(new_ka.sa.sa_flags, &((struct old_sigaction32 *)A(act))->sa_flags))
+		if (get_user(u_handler, &act->sa_handler) ||
+		    __get_user(new_ka.sa.sa_flags, &act->sa_flags))
 			return -EFAULT;
 		new_ka.sa.sa_handler = (void *) (long) u_handler;
-		__get_user(mask, &((struct old_sigaction32 *)A(act))->sa_mask);
+		__get_user(mask, &act->sa_mask);
 		new_ka.sa.sa_restorer = NULL;
 		new_ka.ka_restorer = NULL;
 		siginitset(&new_ka.sa.sa_mask, mask);
@@ -1293,18 +1292,22 @@
 
 	if (!ret && oact) {
 		old_ka.sa.sa_flags ^= SUNOS_SV_INTERRUPT;
-		if (put_user((long)old_ka.sa.sa_handler, &((struct old_sigaction32 *)A(oact))->sa_handler) ||
-		    __put_user(old_ka.sa.sa_flags, &((struct old_sigaction32 *)A(oact))->sa_flags))
+		if (put_user((long)old_ka.sa.sa_handler, &oact->sa_handler) ||
+		    __put_user(old_ka.sa.sa_flags, &oact->sa_flags))
 			return -EFAULT;
-		__put_user(old_ka.sa.sa_mask.sig[0], &((struct old_sigaction32 *)A(oact))->sa_mask);
+		__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
 	}
 
 	return ret;
 }
 
-asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval,
-				int optlen)
+asmlinkage int sunos_setsockopt(u32 __fd, u32 __level, u32 __optname,
+				char __user *optval, u32 __optlen)
 {
+	int fd = (int) __fd;
+	int level = (int) __level;
+	int optname = (int) __optname;
+	int optlen = (int) __optlen;
 	int tr_opt = optname;
 	int ret;
 
@@ -1313,13 +1316,17 @@
 		if (tr_opt >=2 && tr_opt <= 6)
 			tr_opt += 30;
 	}
-	ret = sys_setsockopt(fd, level, tr_opt, (char *)A(optval), optlen);
+	ret = sys_setsockopt(fd, level, tr_opt,
+			     optval, optlen);
 	return ret;
 }
 
-asmlinkage int sunos_getsockopt(int fd, int level, int optname,
-				u32 optval, u32 optlen)
+asmlinkage int sunos_getsockopt(u32 __fd, u32 __level, u32 __optname,
+				char __user *optval, int __user *optlen)
 {
+	int fd = (int) __fd;
+	int level = (int) __level;
+	int optname = (int) __optname;
 	int tr_opt = optname;
 	int ret;
 
@@ -1328,6 +1335,7 @@
 		if (tr_opt >=2 && tr_opt <= 6)
 			tr_opt += 30;
 	}
-	ret = compat_sys_getsockopt(fd, level, tr_opt, (void*)(unsigned long)optval, (void*)(unsigned long)optlen);
+	ret = compat_sys_getsockopt(fd, level, tr_opt,
+				    optval, optlen);
 	return ret;
 }
diff -Nru a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
--- a/arch/sparc64/kernel/systbls.S	Tue Jun 15 22:20:39 2004
+++ b/arch/sparc64/kernel/systbls.S	Tue Jun 15 22:20:39 2004
@@ -19,62 +19,62 @@
 
 	.globl sys_call_table32
 sys_call_table32:
-/*0*/	.word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write
-/*5*/	.word sparc32_open, sys_close, compat_sys_wait4, sys_creat, sys_link
+/*0*/	.word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write
+/*5*/	.word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link
 /*10*/  .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod
-/*15*/	.word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek
+/*15*/	.word sys_chmod, sys32_lchown16, sparc_brk, sys32_perfctr, sys32_lseek
 /*20*/	.word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
 /*25*/	.word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
-/*30*/	.word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
-	.word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile
+/*30*/	.word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
+	.word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
 /*40*/	.word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
-	.word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16
+	.word sys32_umount, sys32_setgid16, sys32_getgid16, sys32_signal, sys32_geteuid16
 /*50*/	.word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_sys_ioctl
-	.word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve
-/*60*/	.word sys_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize
-	.word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
-/*70*/	.word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect
+	.word sys32_reboot, sys32_mmap2, sys_symlink, sys32_readlink, sys32_execve
+/*60*/	.word sys32_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize
+	.word sys32_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
+/*70*/	.word sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect
 	.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
-/*80*/	.word sys32_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64
-	.word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid
+/*80*/	.word sys32_setgroups16, sys_getpgrp, sys32_setgroups, sys32_setitimer, sys32_ftruncate64
+	.word sys32_swapon, sys32_getitimer, sys_setuid, sys32_sethostname, sys_setgid
 /*90*/	.word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid
-	.word sys_fsync, sys_setpriority32, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
-/*100*/ .word sys_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending
+	.word sys_fsync, sys32_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
+/*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending
 	.word sys32_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid
 /*110*/	.word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall
-	.word sys_getgroups, sys32_gettimeofday, compat_sys_getrusage, sys_nis_syscall, sys_getcwd
-/*120*/	.word sys32_readv, sys32_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod
+	.word sys32_getgroups, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd
+/*120*/	.word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod
 	.word sys_nis_syscall, sys32_setreuid16, sys32_setregid16, sys_rename, sys_truncate
 /*130*/	.word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall
-	.word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64
-/*140*/	.word sys32_sendfile64, sys_nis_syscall, compat_sys_futex, sys_gettid, compat_sys_getrlimit
-	.word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
+	.word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, sys_stat64
+/*140*/	.word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit
+	.word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write
 /*150*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
 	.word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
-/*160*/	.word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
-	.word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys_setxattr
-/*170*/	.word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
-	.word sys_setsid, sys_fchdir, sys_fgetxattr, sys_listxattr, sys_llistxattr
-/*180*/	.word sys_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
-	.word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sparc64_newuname
-/*190*/	.word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
-	.word sys_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask
-/*200*/	.word sys_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir
-	.word sys32_readahead, sys32_socketcall, sys_syslog, sys32_lookup_dcookie, sys32_fadvise64
-/*210*/	.word sys32_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys32_sysinfo
+/*160*/	.word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall
+	.word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr
+/*170*/	.word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
+	.word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr
+/*180*/	.word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
+	.word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sparc64_newuname
+/*190*/	.word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
+	.word sys32_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask
+/*200*/	.word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir
+	.word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
+/*210*/	.word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo
 	.word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex
-/*220*/	.word compat_sys_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys_getpgid
+/*220*/	.word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid
 	.word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
 /*230*/	.word sys32_select, sys_time, sys_nis_syscall, sys_stime, compat_statfs64
-	.word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
-/*240*/	.word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
-	.word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
-/*250*/	.word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl
-	.word sys_ni_syscall, compat_clock_settime, compat_clock_gettime, compat_clock_getres, compat_clock_nanosleep
-/*260*/	.word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, compat_timer_settime, compat_timer_gettime, sys_timer_getoverrun
+	.word compat_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall
+/*240*/	.word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler
+	.word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
+/*250*/	.word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
+	.word sys_ni_syscall, sys32_clock_settime, compat_clock_gettime, compat_clock_getres, sys32_clock_nanosleep
+/*260*/	.word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_timer_gettime, sys_timer_getoverrun
 	.word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
-/*270*/	.word compat_sys_io_submit, sys_io_cancel, compat_sys_io_getevents, compat_sys_mq_open, sys_mq_unlink
-	.word sys32_mq_timedsend, sys32_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall
+/*270*/	.word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
+	.word sys_mq_timedsend, sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall
 /*280*/	.word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
 
 	/* Now the 64-bit native Linux syscall table. */
@@ -90,7 +90,7 @@
 /*20*/	.word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
 /*25*/	.word sys_nis_syscall, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
 /*30*/	.word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
-	.word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile
+	.word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64
 /*40*/	.word sys_newlstat, sys_dup, sys_pipe, sys_times, sys_nis_syscall
 	.word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
 /*50*/	.word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl
@@ -148,12 +148,12 @@
 	.align 4
 	.globl sunos_sys_table
 sunos_sys_table:
-/*0*/	.word sunos_indir, sparc_exit, sys_fork
+/*0*/	.word sunos_indir, sys32_exit, sys_fork
 	.word sunos_read, sunos_write, sunos_open
 	.word sys_close, sunos_wait4, sys_creat
 	.word sys_link, sys_unlink, sunos_execv
 	.word sys_chdir, sunos_nosys, sys32_mknod
-	.word sys32_chmod, sys32_lchown16, sunos_brk
+	.word sys_chmod, sys32_lchown16, sunos_brk
 	.word sunos_nosys, sys32_lseek, sunos_getpid
 	.word sunos_nosys, sunos_nosys, sunos_nosys
 	.word sunos_getuid, sunos_nosys, sys_ptrace
@@ -180,32 +180,32 @@
 	.word compat_sys_getitimer, sys_gethostname, sys_sethostname
 	.word sunos_getdtablesize, sys_dup2, sunos_nop
 	.word compat_sys_fcntl, sunos_select, sunos_nop
-	.word sys_fsync, sys_setpriority32, sys_socket
-	.word sys_connect, sunos_accept
+	.word sys_fsync, sys32_setpriority, sys32_socket
+	.word sys32_connect, sunos_accept
 /*100*/	.word sys_getpriority, sunos_send, sunos_recv
-	.word sunos_nosys, sys_bind, sunos_setsockopt
-	.word sys_listen, sunos_nosys, sunos_sigaction
+	.word sunos_nosys, sys32_bind, sunos_setsockopt
+	.word sys32_listen, sunos_nosys, sunos_sigaction
 	.word sunos_sigblock, sunos_sigsetmask, sys_sigpause
-	.word sys32_sigstack, compat_sys_recvmsg, compat_sys_sendmsg
+	.word sys32_sigstack, sys32_recvmsg, sys32_sendmsg
 	.word sunos_nosys, sys32_gettimeofday, compat_sys_getrusage
 	.word sunos_getsockopt, sunos_nosys, sunos_readv
 	.word sunos_writev, sys32_settimeofday, sys32_fchown16
 	.word sys_fchmod, sys32_recvfrom, sys32_setreuid16
 	.word sys32_setregid16, sys_rename, sys_truncate
 	.word sys_ftruncate, sys_flock, sunos_nosys
-	.word sys32_sendto, sys_shutdown, sys_socketpair
+	.word sys32_sendto, sys32_shutdown, sys32_socketpair
 	.word sys_mkdir, sys_rmdir, sys32_utimes
-	.word sys32_sigreturn, sunos_nosys, sys_getpeername
+	.word sys32_sigreturn, sunos_nosys, sys32_getpeername
 	.word sunos_gethostid, sunos_nosys, compat_sys_getrlimit
 	.word compat_sys_setrlimit, sunos_killpg, sunos_nosys
 	.word sunos_nosys, sunos_nosys
-/*150*/	.word sys_getsockname, sunos_nosys, sunos_nosys
+/*150*/	.word sys32_getsockname, sunos_nosys, sunos_nosys
 	.word sys_poll, sunos_nosys, sunos_nosys
 	.word sunos_getdirentries, compat_sys_statfs, compat_sys_fstatfs
 	.word sys_oldumount, sunos_nosys, sunos_nosys
 	.word sys_getdomainname, sys_setdomainname
 	.word sunos_nosys, sys_quotactl, sunos_nosys
-	.word sunos_mount, sys_ustat, sunos_semsys
+	.word sunos_nosys, sys_ustat, sunos_semsys
 	.word sunos_nosys, sunos_shmsys, sunos_audit
 	.word sunos_nosys, sunos_getdents, sys_setsid
 	.word sys_fchdir, sunos_nosys, sunos_nosys
diff -Nru a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
--- a/arch/sparc64/kernel/time.c	Tue Jun 15 22:20:40 2004
+++ b/arch/sparc64/kernel/time.c	Tue Jun 15 22:20:40 2004
@@ -1035,7 +1035,8 @@
 		ft->clock_tick_ref = cpu_data(cpu).clock_tick;
 	}
 	if ((val == CPUFREQ_PRECHANGE  && freq->old < freq->new) ||
-	    (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
+	    (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
+	    (val == CPUFREQ_RESUMECHANGE)) {
 		cpu_data(cpu).udelay_val =
 			cpufreq_scale(ft->udelay_val_ref,
 				      ft->ref_freq,
diff -Nru a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
--- a/arch/sparc64/kernel/traps.c	Tue Jun 15 22:21:04 2004
+++ b/arch/sparc64/kernel/traps.c	Tue Jun 15 22:21:04 2004
@@ -1708,7 +1708,7 @@
 	printk("\n");
 }
 
-void user_instruction_dump (unsigned int *pc)
+static void user_instruction_dump (unsigned int __user *pc)
 {
 	int i;
 	unsigned int buf[9];
@@ -1813,7 +1813,7 @@
 			regs->tpc &= 0xffffffff;
 			regs->tnpc &= 0xffffffff;
 		}
-		user_instruction_dump ((unsigned int *) regs->tpc);
+		user_instruction_dump ((unsigned int __user *) regs->tpc);
 	}
 #ifdef CONFIG_SMP
 	smp_report_regs();
@@ -1838,7 +1838,7 @@
 		die_if_kernel("Kernel illegal instruction", regs);
 	if (test_thread_flag(TIF_32BIT))
 		pc = (u32)pc;
-	if (get_user(insn, (u32 *)pc) != -EFAULT) {
+	if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
 		if ((insn & 0xc1ffc000) == 0x81700000) /* POPC */ {
 			if (handle_popc(insn, regs))
 				return;
@@ -1862,9 +1862,12 @@
 	if (regs->tstate & TSTATE_PRIV) {
 		extern void kernel_unaligned_trap(struct pt_regs *regs,
 						  unsigned int insn, 
-						  unsigned long sfar, unsigned long sfsr);
+						  unsigned long sfar,
+						  unsigned long sfsr);
 
-		return kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc), sfar, sfsr);
+		kernel_unaligned_trap(regs, *((unsigned int *)regs->tpc),
+				      sfar, sfsr);
+		return;
 	}
 	info.si_signo = SIGBUS;
 	info.si_errno = 0;
diff -Nru a/arch/sparc64/kernel/unaligned.c b/arch/sparc64/kernel/unaligned.c
--- a/arch/sparc64/kernel/unaligned.c	Tue Jun 15 22:20:38 2004
+++ b/arch/sparc64/kernel/unaligned.c	Tue Jun 15 22:20:38 2004
@@ -128,12 +128,12 @@
 		win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
 		value = win->locals[reg - 16];
 	} else if (test_thread_flag(TIF_32BIT)) {
-		struct reg_window32 *win32;
-		win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+		struct reg_window32 __user *win32;
+		win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
 		get_user(value, &win32->locals[reg - 16]);
 	} else {
-		struct reg_window *win;
-		win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+		struct reg_window __user *win;
+		win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
 		get_user(value, &win->locals[reg - 16]);
 	}
 	return value;
@@ -158,8 +158,8 @@
 	}
 }
 
-static unsigned long compute_effective_address(struct pt_regs *regs,
-					       unsigned int insn, unsigned int rd)
+unsigned long compute_effective_address(struct pt_regs *regs,
+					unsigned int insn, unsigned int rd)
 {
 	unsigned int rs1 = (insn >> 14) & 0x1f;
 	unsigned int rs2 = insn & 0x1f;
@@ -175,7 +175,7 @@
 }
 
 /* This is just to make gcc think die_if_kernel does return... */
-static void unaligned_panic(char *str, struct pt_regs *regs)
+static void __attribute_used__ unaligned_panic(char *str, struct pt_regs *regs)
 {
 	die_if_kernel(str, regs);
 }
@@ -477,12 +477,12 @@
 			regs->u_regs[rd] = ret;
 	} else {
 		if (test_thread_flag(TIF_32BIT)) {
-			struct reg_window32 *win32;
-			win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+			struct reg_window32 __user *win32;
+			win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
 			put_user(ret, &win32->locals[rd - 16]);
 		} else {
-			struct reg_window *win;
-			win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+			struct reg_window __user *win;
+			win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
 			put_user(ret, &win->locals[rd - 16]);
 		}
 	}
@@ -540,10 +540,10 @@
 			data_access_exception(regs, 0, addr);
 			return 1;
 		}
-		if (put_user (first >> 32, (u32 *)addr) ||
-		    __put_user ((u32)first, (u32 *)(addr + 4)) ||
-		    __put_user (second >> 32, (u32 *)(addr + 8)) ||
-		    __put_user ((u32)second, (u32 *)(addr + 12))) {
+		if (put_user (first >> 32, (u32 __user *)addr) ||
+		    __put_user ((u32)first, (u32 __user *)(addr + 4)) ||
+		    __put_user (second >> 32, (u32 __user *)(addr + 8)) ||
+		    __put_user ((u32)second, (u32 __user *)(addr + 12))) {
 		    	data_access_exception(regs, 0, addr);
 		    	return 1;
 		}
@@ -568,10 +568,10 @@
 		for (i = 0; i < size; i++)
 			data[i] = 0;
 		
-		err = get_user (data[0], (u32 *)addr);
+		err = get_user (data[0], (u32 __user *) addr);
 		if (!err) {
 			for (i = 1; i < size; i++)
-				err |= __get_user (data[i], (u32 *)(addr + 4*i));
+				err |= __get_user (data[i], (u32 __user *)(addr + 4*i));
 		}
 		if (err && !(asi & 0x2 /* NF */)) {
 			data_access_exception(regs, 0, addr);
@@ -620,13 +620,13 @@
 		if ((insn & 0x780000) == 0x180000)
 			reg[1] = 0;
 	} else if (test_thread_flag(TIF_32BIT)) {
-		put_user(0, (int *)reg);
+		put_user(0, (int __user *) reg);
 		if ((insn & 0x780000) == 0x180000)
-			put_user(0, ((int *)reg) + 1);
+			put_user(0, ((int __user *) reg) + 1);
 	} else {
-		put_user(0, reg);
+		put_user(0, (unsigned long __user *) reg);
 		if ((insn & 0x780000) == 0x180000)
-			put_user(0, reg + 1);
+			put_user(0, (unsigned long __user *) reg + 1);
 	}
 	advance(regs);
 }
@@ -646,13 +646,13 @@
 		die_if_kernel("lddfmna from kernel", regs);
 	if (test_thread_flag(TIF_32BIT))
 		pc = (u32)pc;
-	if (get_user(insn, (u32 *)pc) != -EFAULT) {
+	if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
 		asi = sfsr >> 16;
 		if ((asi > ASI_SNFL) ||
 		    (asi < ASI_P))
 			goto daex;
-		if (get_user(first, (u32 *)sfar) ||
-		     get_user(second, (u32 *)(sfar + 4))) {
+		if (get_user(first, (u32 __user *)sfar) ||
+		     get_user(second, (u32 __user *)(sfar + 4))) {
 			if (asi & 0x2) /* NF */ {
 				first = 0; second = 0;
 			} else
@@ -698,7 +698,7 @@
 		die_if_kernel("stdfmna from kernel", regs);
 	if (test_thread_flag(TIF_32BIT))
 		pc = (u32)pc;
-	if (get_user(insn, (u32 *)pc) != -EFAULT) {
+	if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
 		freg = ((insn >> 25) & 0x1e) | ((insn >> 20) & 0x20);
 		asi = sfsr >> 16;
 		value = 0;
@@ -717,8 +717,8 @@
 			value = __swab64p(&value); break;
 		default: goto daex;
 		}
-		if (put_user (value >> 32, (u32 *)sfar) ||
-		    __put_user ((u32)value, (u32 *)(sfar + 4)))
+		if (put_user (value >> 32, (u32 __user *) sfar) ||
+		    __put_user ((u32)value, (u32 __user *)(sfar + 4)))
 			goto daex;
 	} else {
 daex:		data_access_exception(regs, sfsr, sfar);
diff -Nru a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile
--- a/arch/sparc64/lib/Makefile	Tue Jun 15 22:20:36 2004
+++ b/arch/sparc64/lib/Makefile	Tue Jun 15 22:20:36 2004
@@ -10,7 +10,8 @@
 	 VIScopy.o VISbzero.o VISmemset.o VIScsum.o VIScsumcopy.o \
 	 VIScsumcopyusr.o VISsave.o atomic.o rwlock.o bitops.o \
 	 U3memcpy.o U3copy_from_user.o U3copy_to_user.o \
-	 U3copy_in_user.o mcount.o ipcsum.o rwsem.o xor.o
+	 U3copy_in_user.o mcount.o ipcsum.o rwsem.o xor.o splock.o \
+	 find_bit.o
 
 lib-$(CONFIG_DEBUG_SPINLOCK) += debuglocks.o
 lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o
diff -Nru a/arch/sparc64/lib/debuglocks.c b/arch/sparc64/lib/debuglocks.c
--- a/arch/sparc64/lib/debuglocks.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc64/lib/debuglocks.c	Tue Jun 15 22:20:41 2004
@@ -55,7 +55,7 @@
 {
 	unsigned long caller, val;
 	int stuck = INIT_STUCK;
-	int cpu = smp_processor_id();
+	int cpu = get_cpu();
 	int shown = 0;
 
 	GET_CALLER(caller);
@@ -80,12 +80,14 @@
 	lock->owner_cpu = cpu;
 	current->thread.smp_lock_count++;
 	current->thread.smp_lock_pc = ((unsigned int)caller);
+
+	put_cpu();
 }
 
 int _spin_trylock(spinlock_t *lock)
 {
 	unsigned long val, caller;
-	int cpu = smp_processor_id();
+	int cpu = get_cpu();
 
 	GET_CALLER(caller);
 	__asm__ __volatile__("ldstub [%1], %0"
@@ -99,6 +101,9 @@
 		current->thread.smp_lock_count++;
 		current->thread.smp_lock_pc = ((unsigned int)caller);
 	}
+
+	put_cpu();
+
 	return val == 0;
 }
 
@@ -117,7 +122,7 @@
 {
 	unsigned long caller, val;
 	int stuck = INIT_STUCK;
-	int cpu = smp_processor_id();
+	int cpu = get_cpu();
 	int shown = 0;
 
 	GET_CALLER(caller);
@@ -148,13 +153,15 @@
 	rw->reader_pc[cpu] = ((unsigned int)caller);
 	current->thread.smp_lock_count++;
 	current->thread.smp_lock_pc = ((unsigned int)caller);
+
+	put_cpu();
 }
 
 void _do_read_unlock (rwlock_t *rw, char *str)
 {
 	unsigned long caller, val;
 	int stuck = INIT_STUCK;
-	int cpu = smp_processor_id();
+	int cpu = get_cpu();
 	int shown = 0;
 
 	GET_CALLER(caller);
@@ -181,13 +188,15 @@
 		}
 		goto runlock_again;
 	}
+
+	put_cpu();
 }
 
 void _do_write_lock (rwlock_t *rw, char *str)
 {
 	unsigned long caller, val;
 	int stuck = INIT_STUCK;
-	int cpu = smp_processor_id();
+	int cpu = get_cpu();
 	int shown = 0;
 
 	GET_CALLER(caller);
@@ -263,6 +272,8 @@
 	rw->writer_cpu = cpu;
 	current->thread.smp_lock_count++;
 	current->thread.smp_lock_pc = ((unsigned int)caller);
+
+	put_cpu();
 }
 
 void _do_write_unlock(rwlock_t *rw)
@@ -297,6 +308,67 @@
 		}
 		goto wlock_again;
 	}
+}
+
+int _do_write_trylock (rwlock_t *rw, char *str)
+{
+	unsigned long caller, val;
+	int cpu = get_cpu();
+
+	GET_CALLER(caller);
+
+	/* Try to acuire the write bit.  */
+	__asm__ __volatile__(
+"	mov	1, %%g3\n"
+"	sllx	%%g3, 63, %%g3\n"
+"	ldx	[%0], %%g5\n"
+"	brlz,pn	%%g5, 1f\n"
+"	 or	%%g5, %%g3, %%g7\n"
+"	casx	[%0], %%g5, %%g7\n"
+"	membar	#StoreLoad | #StoreStore\n"
+"	ba,pt	%%xcc, 2f\n"
+"	 sub	%%g5, %%g7, %0\n"
+"1:	mov	1, %0\n"
+"2:"	: "=r" (val)
+	: "0" (&(rw->lock))
+	: "g3", "g5", "g7", "memory");
+
+	if (val) {
+		put_cpu();
+		return 0;
+	}
+
+	if ((rw->lock & ((1UL<<63)-1UL)) != 0UL) {
+		/* Readers still around, drop the write
+		 * lock, return failure.
+		 */
+		__asm__ __volatile__(
+"		mov	1, %%g3\n"
+"		sllx	%%g3, 63, %%g3\n"
+"1:		ldx	[%0], %%g5\n"
+"		andn	%%g5, %%g3, %%g7\n"
+"		casx	[%0], %%g5, %%g7\n"
+"		cmp	%%g5, %%g7\n"
+"		bne,pn	%%xcc, 1b\n"
+"		 membar	#StoreLoad | #StoreStore"
+		: /* no outputs */
+		: "r" (&(rw->lock))
+		: "g3", "g5", "g7", "cc", "memory");
+
+		put_cpu();
+
+		return 0;
+	}
+
+	/* We have it, say who we are. */
+	rw->writer_pc = ((unsigned int)caller);
+	rw->writer_cpu = cpu;
+	current->thread.smp_lock_count++;
+	current->thread.smp_lock_pc = ((unsigned int)caller);
+
+	put_cpu();
+
+	return 1;
 }
 
 #endif /* CONFIG_SMP */
diff -Nru a/arch/sparc64/lib/find_bit.c b/arch/sparc64/lib/find_bit.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/sparc64/lib/find_bit.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,125 @@
+#include <asm/bitops.h>
+
+/**
+ * find_next_bit - find the next set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+unsigned long find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset)
+{
+	unsigned long *p = addr + (offset >> 6);
+	unsigned long result = offset & ~63UL;
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= 63UL;
+	if (offset) {
+		tmp = *(p++);
+		tmp &= (~0UL << offset);
+		if (size < 64)
+			goto found_first;
+		if (tmp)
+			goto found_middle;
+		size -= 64;
+		result += 64;
+	}
+	while (size & ~63UL) {
+		if ((tmp = *(p++)))
+			goto found_middle;
+		result += 64;
+		size -= 64;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
+
+found_first:
+	tmp &= (~0UL >> (64 - size));
+	if (tmp == 0UL)        /* Are any bits set? */
+		return result + size; /* Nope. */
+found_middle:
+	return result + __ffs(tmp);
+}
+
+/* find_next_zero_bit() finds the first zero bit in a bit string of length
+ * 'size' bits, starting the search at bit 'offset'. This is largely based
+ * on Linus's ALPHA routines, which are pretty portable BTW.
+ */
+
+unsigned long find_next_zero_bit(unsigned long *addr, unsigned long size, unsigned long offset)
+{
+	unsigned long *p = addr + (offset >> 6);
+	unsigned long result = offset & ~63UL;
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= 63UL;
+	if (offset) {
+		tmp = *(p++);
+		tmp |= ~0UL >> (64-offset);
+		if (size < 64)
+			goto found_first;
+		if (~tmp)
+			goto found_middle;
+		size -= 64;
+		result += 64;
+	}
+	while (size & ~63UL) {
+		if (~(tmp = *(p++)))
+			goto found_middle;
+		result += 64;
+		size -= 64;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
+
+found_first:
+	tmp |= ~0UL << size;
+	if (tmp == ~0UL)        /* Are any bits zero? */
+		return result + size; /* Nope. */
+found_middle:
+	return result + ffz(tmp);
+}
+
+unsigned long find_next_zero_le_bit(unsigned long *addr, unsigned long size, unsigned long offset)
+{
+	unsigned long *p = addr + (offset >> 6);
+	unsigned long result = offset & ~63UL;
+	unsigned long tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= 63UL;
+	if(offset) {
+		tmp = __swab64p(p++);
+		tmp |= (~0UL >> (64-offset));
+		if(size < 64)
+			goto found_first;
+		if(~tmp)
+			goto found_middle;
+		size -= 64;
+		result += 64;
+	}
+	while(size & ~63) {
+		if(~(tmp = __swab64p(p++)))
+			goto found_middle;
+		result += 64;
+		size -= 64;
+	}
+	if(!size)
+		return result;
+	tmp = __swab64p(p);
+found_first:
+	tmp |= (~0UL << size);
+	if (tmp == ~0UL)        /* Are any bits zero? */
+		return result + size; /* Nope. */
+found_middle:
+	return result + ffz(tmp);
+}
diff -Nru a/arch/sparc64/lib/splock.S b/arch/sparc64/lib/splock.S
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/sparc64/lib/splock.S	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,23 @@
+/* splock.S: Spinlock primitives too large to inline.
+ *
+ * Copyright (C) 2004 David S. Miller (davem@redhat.com)
+ */
+
+	.text
+	.align	64
+
+	.globl	_raw_spin_lock_flags
+_raw_spin_lock_flags:	/* %o0 = lock_ptr, %o1 = irq_flags */
+1:	ldstub		[%o0], %g7
+	brnz,pn		%g7, 2f
+	 membar		#StoreLoad | #StoreStore
+	retl
+	 nop
+
+2:	rdpr		%pil, %g2		! Save PIL
+	wrpr		%o1, %pil		! Set previous PIL
+3:	ldub		[%o0], %g7		! Spin on lock set
+	brnz,pt		%g7, 3b
+	 membar		#LoadLoad
+	ba,pt		%xcc, 1b		! Retry lock acquire
+	 wrpr		%g2, %pil		! Restore PIL
diff -Nru a/arch/sparc64/math-emu/math.c b/arch/sparc64/math-emu/math.c
--- a/arch/sparc64/math-emu/math.c	Tue Jun 15 22:20:41 2004
+++ b/arch/sparc64/math-emu/math.c	Tue Jun 15 22:20:41 2004
@@ -185,7 +185,7 @@
 		die_if_kernel("unfinished/unimplemented FPop from kernel", regs);
 	if (test_thread_flag(TIF_32BIT))
 		pc = (u32)pc;
-	if (get_user(insn, (u32 *)pc) != -EFAULT) {
+	if (get_user(insn, (u32 __user *) pc) != -EFAULT) {
 		if ((insn & 0xc1f80000) == 0x81a00000) /* FPOP1 */ {
 			switch ((insn >> 5) & 0x1ff) {
 			/* QUAD - ftt == 3 */
@@ -298,14 +298,14 @@
 				else if (freg < 16)
 					XR = regs->u_regs[freg];
 				else if (test_thread_flag(TIF_32BIT)) {
-					struct reg_window32 *win32;
+					struct reg_window32 __user *win32;
 					flushw_user ();
-					win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
+					win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
 					get_user(XR, &win32->locals[freg - 16]);
 				} else {
-					struct reg_window *win;
+					struct reg_window __user *win;
 					flushw_user ();
-					win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
+					win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
 					get_user(XR, &win->locals[freg - 16]);
 				}
 				IR = 0;
diff -Nru a/arch/sparc64/math-emu/sfp-util.h b/arch/sparc64/math-emu/sfp-util.h
--- a/arch/sparc64/math-emu/sfp-util.h	Tue Jun 15 22:21:02 2004
+++ b/arch/sparc64/math-emu/sfp-util.h	Tue Jun 15 22:21:02 2004
@@ -11,106 +11,106 @@
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) 						\
-  __asm__ ("addcc %4,%5,%1\n\
-  	    add %2,%3,%0\n\
-  	    bcs,a,pn %%xcc, 1f\n\
-  	    add %0, 1, %0\n\
-  	    1:"										\
-	   : "=r" ((UDItype)(sh)),				      			\
-	     "=&r" ((UDItype)(sl))				      			\
-	   : "r" ((UDItype)(ah)),				     			\
-	     "r" ((UDItype)(bh)),				      			\
-	     "r" ((UDItype)(al)),				     			\
-	     "r" ((UDItype)(bl))				       			\
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) 	\
+  __asm__ ("addcc %4,%5,%1\n\t"			\
+	   "add %2,%3,%0\n\t"			\
+  	   "bcs,a,pn %%xcc, 1f\n\t"		\
+  	   "add %0, 1, %0\n"			\
+  	   "1:"					\
+	   : "=r" ((UDItype)(sh)),		\
+	     "=&r" ((UDItype)(sl))		\
+	   : "r" ((UDItype)(ah)),		\
+	     "r" ((UDItype)(bh)),		\
+	     "r" ((UDItype)(al)),		\
+	     "r" ((UDItype)(bl))		\
 	   : "cc")
 	   
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) 						\
-  __asm__ ("subcc %4,%5,%1\n\
-  	    sub %2,%3,%0\n\
-  	    bcs,a,pn %%xcc, 1f\n\
-  	    sub %0, 1, %0\n\
-  	    1:"										\
-	   : "=r" ((UDItype)(sh)),				      			\
-	     "=&r" ((UDItype)(sl))				      			\
-	   : "r" ((UDItype)(ah)),				     			\
-	     "r" ((UDItype)(bh)),				      			\
-	     "r" ((UDItype)(al)),				     			\
-	     "r" ((UDItype)(bl))				       			\
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) 	\
+  __asm__ ("subcc %4,%5,%1\n\t"			\
+  	   "sub %2,%3,%0\n\t"			\
+  	   "bcs,a,pn %%xcc, 1f\n\t"		\
+  	   "sub %0, 1, %0\n"			\
+  	   "1:"					\
+	   : "=r" ((UDItype)(sh)),		\
+	     "=&r" ((UDItype)(sl))		\
+	   : "r" ((UDItype)(ah)),		\
+	     "r" ((UDItype)(bh)),		\
+	     "r" ((UDItype)(al)),		\
+	     "r" ((UDItype)(bl))		\
 	   : "cc")
 
-#define umul_ppmm(wh, wl, u, v)								\
-  do {											\
-	  UDItype tmp1, tmp2, tmp3, tmp4;						\
-	  __asm__ __volatile__ (							\
-		   "srl %7,0,%3\n\
-		    mulx %3,%6,%1\n\
-		    srlx %6,32,%2\n\
-		    mulx %2,%3,%4\n\
-		    sllx %4,32,%5\n\
-		    srl %6,0,%3\n\
-		    sub %1,%5,%5\n\
-		    srlx %5,32,%5\n\
-		    addcc %4,%5,%4\n\
-		    srlx %7,32,%5\n\
-		    mulx %3,%5,%3\n\
-		    mulx %2,%5,%5\n\
-		    sethi %%hi(0x80000000),%2\n\
-		    addcc %4,%3,%4\n\
-		    srlx %4,32,%4\n\
-		    add %2,%2,%2\n\
-		    movcc %%xcc,%%g0,%2\n\
-		    addcc %5,%4,%5\n\
-		    sllx %3,32,%3\n\
-		    add %1,%3,%1\n\
-		    add %5,%2,%0"							\
-	   : "=r" ((UDItype)(wh)),							\
-	     "=&r" ((UDItype)(wl)),							\
-	     "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4)			\
-	   : "r" ((UDItype)(u)),							\
-	     "r" ((UDItype)(v))								\
-	   : "cc");									\
+#define umul_ppmm(wh, wl, u, v)				\
+  do {							\
+	  UDItype tmp1, tmp2, tmp3, tmp4;		\
+	  __asm__ __volatile__ (			\
+		   "srl %7,0,%3\n\t"			\
+		   "mulx %3,%6,%1\n\t"			\
+		   "srlx %6,32,%2\n\t"			\
+		   "mulx %2,%3,%4\n\t"			\
+		   "sllx %4,32,%5\n\t"			\
+		   "srl %6,0,%3\n\t"			\
+		   "sub %1,%5,%5\n\t"			\
+		   "srlx %5,32,%5\n\t"			\
+		   "addcc %4,%5,%4\n\t"			\
+		   "srlx %7,32,%5\n\t"			\
+		   "mulx %3,%5,%3\n\t"			\
+		   "mulx %2,%5,%5\n\t"			\
+		   "sethi %%hi(0x80000000),%2\n\t"	\
+		   "addcc %4,%3,%4\n\t"			\
+		   "srlx %4,32,%4\n\t"			\
+		   "add %2,%2,%2\n\t"			\
+		   "movcc %%xcc,%%g0,%2\n\t"		\
+		   "addcc %5,%4,%5\n\t"			\
+		   "sllx %3,32,%3\n\t"			\
+		   "add %1,%3,%1\n\t"			\
+		   "add %5,%2,%0"			\
+	   : "=r" ((UDItype)(wh)),			\
+	     "=&r" ((UDItype)(wl)),			\
+	     "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \
+	   : "r" ((UDItype)(u)),			\
+	     "r" ((UDItype)(v))				\
+	   : "cc");					\
   } while (0)
   
-#define udiv_qrnnd(q, r, n1, n0, d) 							\
-  do {                                                                  		\
-    UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m;                     		\
-    __d1 = (d >> 32);                                           			\
-    __d0 = (USItype)d;                                            			\
-                                                                        		\
-    __r1 = (n1) % __d1;                                                 		\
-    __q1 = (n1) / __d1;                                                 		\
-    __m = (UWtype) __q1 * __d0;                                         		\
-    __r1 = (__r1 << 32) | (n0 >> 32);                          				\
-    if (__r1 < __m)                                                     		\
-      {                                                                 		\
-        __q1--, __r1 += (d);                                            		\
-        if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */		\
-          if (__r1 < __m)                                               		\
-            __q1--, __r1 += (d);                                        		\
-      }                                                                 		\
-    __r1 -= __m;                                                        		\
-                                                                        		\
-    __r0 = __r1 % __d1;                                                 		\
-    __q0 = __r1 / __d1;                                                 		\
-    __m = (UWtype) __q0 * __d0;                                         		\
-    __r0 = (__r0 << 32) | ((USItype)n0);                           			\
-    if (__r0 < __m)                                                     		\
-      {                                                                 		\
-        __q0--, __r0 += (d);                                            		\
-        if (__r0 >= (d))                                                		\
-          if (__r0 < __m)                                               		\
-            __q0--, __r0 += (d);                                        		\
-      }                                                                 		\
-    __r0 -= __m;                                                        		\
-                                                                        		\
-    (q) = (UWtype) (__q1 << 32)  | __q0;                                		\
-    (r) = __r0;                                                         		\
+#define udiv_qrnnd(q, r, n1, n0, d) 			\
+  do {                                                  \
+    UWtype __d1, __d0, __q1, __q0, __r1, __r0, __m;     \
+    __d1 = (d >> 32);                                   \
+    __d0 = (USItype)d;                                  \
+                                                        \
+    __r1 = (n1) % __d1;                                 \
+    __q1 = (n1) / __d1;                                 \
+    __m = (UWtype) __q1 * __d0;                         \
+    __r1 = (__r1 << 32) | (n0 >> 32);                   \
+    if (__r1 < __m)                                     \
+      {                                                 \
+        __q1--, __r1 += (d);                            \
+        if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */ \
+          if (__r1 < __m)                               \
+            __q1--, __r1 += (d);                        \
+      }                                                 \
+    __r1 -= __m;                                        \
+                                                        \
+    __r0 = __r1 % __d1;                                 \
+    __q0 = __r1 / __d1;                                 \
+    __m = (UWtype) __q0 * __d0;                         \
+    __r0 = (__r0 << 32) | ((USItype)n0);                \
+    if (__r0 < __m)                                     \
+      {                                                 \
+        __q0--, __r0 += (d);                            \
+        if (__r0 >= (d))                                \
+          if (__r0 < __m)                               \
+            __q0--, __r0 += (d);                        \
+      }                                                 \
+    __r0 -= __m;                                        \
+                                                        \
+    (q) = (UWtype) (__q1 << 32)  | __q0;                \
+    (r) = __r0;                                         \
   } while (0)
 
 #define UDIV_NEEDS_NORMALIZATION 1  
 
-#define abort()										\
+#define abort() \
 	return 0
 
 #ifdef __BIG_ENDIAN
diff -Nru a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
--- a/arch/sparc64/mm/fault.c	Tue Jun 15 22:21:03 2004
+++ b/arch/sparc64/mm/fault.c	Tue Jun 15 22:21:03 2004
@@ -207,14 +207,21 @@
 	return insn;
 }
 
-static void do_fault_siginfo(int code, int sig, unsigned long address)
+extern unsigned long compute_effective_address(struct pt_regs *, unsigned int, unsigned int);
+
+static void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
+			     unsigned int insn, int fault_code)
 {
 	siginfo_t info;
 
 	info.si_code = code;
 	info.si_signo = sig;
 	info.si_errno = 0;
-	info.si_addr = (void *) address;
+	if (fault_code & FAULT_CODE_ITLB)
+		info.si_addr = (void *) regs->tpc;
+	else
+		info.si_addr = (void *)
+			compute_effective_address(regs, insn, 0);
 	info.si_trapno = 0;
 	force_sig_info(sig, &info, current);
 }
@@ -295,7 +302,7 @@
 		/* The si_code was set to make clear whether
 		 * this was a SEGV_MAPERR or SEGV_ACCERR fault.
 		 */
-		do_fault_siginfo(si_code, SIGSEGV, address);
+		do_fault_siginfo(si_code, SIGSEGV, regs, insn, fault_code);
 		return;
 	}
 
@@ -471,7 +478,7 @@
 	 * Send a sigbus, regardless of whether we were in kernel
 	 * or user mode.
 	 */
-	do_fault_siginfo(BUS_ADRERR, SIGBUS, address);
+	do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, insn, fault_code);
 
 	/* Kernel mode? Handle exceptions or die */
 	if (regs->tstate & TSTATE_PRIV)
diff -Nru a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc64/mm/hugetlbpage.c
--- a/arch/sparc64/mm/hugetlbpage.c	Tue Jun 15 22:20:42 2004
+++ b/arch/sparc64/mm/hugetlbpage.c	Tue Jun 15 22:20:42 2004
@@ -245,8 +245,9 @@
 				goto out;
 			}
 			ret = add_to_page_cache(page, mapping, idx, GFP_ATOMIC);
-			unlock_page(page);
-			if (ret) {
+			if (! ret) {
+				unlock_page(page);
+			} else {
 				hugetlb_put_quota(mapping);
 				free_huge_page(page);
 				goto out;
diff -Nru a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
--- a/arch/sparc64/mm/init.c	Tue Jun 15 22:20:39 2004
+++ b/arch/sparc64/mm/init.c	Tue Jun 15 22:20:39 2004
@@ -152,9 +152,9 @@
 #define dcache_dirty_cpu(page) \
 	(((page)->flags >> 24) & (NR_CPUS - 1UL))
 
-static __inline__ void set_dcache_dirty(struct page *page)
+static __inline__ void set_dcache_dirty(struct page *page, int this_cpu)
 {
-	unsigned long mask = smp_processor_id();
+	unsigned long mask = this_cpu;
 	unsigned long non_cpu_bits = ~((NR_CPUS - 1UL) << 24UL);
 	mask = (mask << 24) | (1UL << PG_dcache_dirty);
 	__asm__ __volatile__("1:\n\t"
@@ -206,16 +206,19 @@
 	    (page = pfn_to_page(pfn), page_mapping(page)) &&
 	    ((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) {
 		int cpu = ((pg_flags >> 24) & (NR_CPUS - 1UL));
+		int this_cpu = get_cpu();
 
 		/* This is just to optimize away some function calls
 		 * in the SMP case.
 		 */
-		if (cpu == smp_processor_id())
+		if (cpu == this_cpu)
 			flush_dcache_page_impl(page);
 		else
 			smp_flush_dcache_page_impl(page, cpu);
 
 		clear_dcache_dirty_cpu(page, cpu);
+
+		put_cpu();
 	}
 	if (get_thread_fault_code())
 		__update_mmu_cache(vma->vm_mm->context & TAG_CONTEXT_BITS,
@@ -227,14 +230,15 @@
 	struct address_space *mapping = page_mapping(page);
 	int dirty = test_bit(PG_dcache_dirty, &page->flags);
 	int dirty_cpu = dcache_dirty_cpu(page);
+	int this_cpu = get_cpu();
 
 	if (mapping && !mapping_mapped(mapping)) {
 		if (dirty) {
-			if (dirty_cpu == smp_processor_id())
-				return;
+			if (dirty_cpu == this_cpu)
+				goto out;
 			smp_flush_dcache_page_impl(page, dirty_cpu);
 		}
-		set_dcache_dirty(page);
+		set_dcache_dirty(page, this_cpu);
 	} else {
 		/* We could delay the flush for the !page_mapping
 		 * case too.  But that case is for exec env/arg
@@ -243,6 +247,9 @@
 		 */
 		flush_dcache_page_impl(page);
 	}
+
+out:
+	put_cpu();
 }
 
 /* When shared+writable mmaps of files go away, we lose all dirty
@@ -1582,7 +1589,7 @@
  * prom_set_traptable() call, and OBP is allocating a scratchpad
  * for saving client program register state etc.
  */
-void __init sort_memlist(struct linux_mlist_p1275 *thislist)
+static void __init sort_memlist(struct linux_mlist_p1275 *thislist)
 {
 	int swapi = 0;
 	int i, mitr;
diff -Nru a/arch/sparc64/prom/memory.c b/arch/sparc64/prom/memory.c
--- a/arch/sparc64/prom/memory.c	Tue Jun 15 22:20:43 2004
+++ b/arch/sparc64/prom/memory.c	Tue Jun 15 22:20:43 2004
@@ -114,7 +114,7 @@
 		prom_prom_taken[iter].num_bytes =
 			prom_reg_memlist[iter].reg_size;
 		prom_prom_taken[iter].theres_more =
-			&prom_phys_total[iter+1];
+			&prom_prom_taken[iter+1];
 	}
 	prom_prom_taken[iter-1].theres_more = 0x0;
 
diff -Nru a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c
--- a/arch/um/drivers/harddog_kern.c	Tue Jun 15 22:20:42 2004
+++ b/arch/um/drivers/harddog_kern.c	Tue Jun 15 22:20:42 2004
@@ -71,7 +71,7 @@
 	if(timer_alive)
 		return -EBUSY;
 #ifdef CONFIG_HARDDOG_NOWAYOUT	 
-	MOD_INC_USE_COUNT;
+	__module_get(THIS_MODULE);
 #endif
 
 #ifdef CONFIG_MCONSOLE
diff -Nru a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
--- a/arch/um/drivers/net_kern.c	Tue Jun 15 22:20:40 2004
+++ b/arch/um/drivers/net_kern.c	Tue Jun 15 22:20:40 2004
@@ -124,7 +124,6 @@
 	spin_lock(&opened_lock);
 	list_add(&lp->list, &opened);
 	spin_unlock(&opened_lock);
-	MOD_INC_USE_COUNT;
  out:
 	spin_unlock(&lp->lock);
 	return(err);
@@ -144,7 +143,6 @@
 	list_del(&lp->list);
 	spin_unlock(&opened_lock);
 
-	MOD_DEC_USE_COUNT;
 	spin_unlock(&lp->lock);
 	return 0;
 }
diff -Nru a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
--- a/arch/um/kernel/mem.c	Tue Jun 15 22:20:39 2004
+++ b/arch/um/kernel/mem.c	Tue Jun 15 22:20:39 2004
@@ -294,7 +294,7 @@
 			page = &map[i];
 			ClearPageReserved(page);
 			set_bit(PG_highmem, &page->flags);
-			atomic_set(&page->count, 1);
+			set_page_count(page, 1);
 			__free_page(page);
 		}
 		phys += cur;
diff -Nru a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
--- a/arch/um/kernel/smp.c	Tue Jun 15 22:20:38 2004
+++ b/arch/um/kernel/smp.c	Tue Jun 15 22:20:38 2004
@@ -266,6 +266,9 @@
 	if (!cpus)
 		return 0;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	spin_lock_bh(&call_lock);
 	atomic_set(&scf_started, 0);
 	atomic_set(&scf_finished, 0);
diff -Nru a/arch/v850/kernel/process.c b/arch/v850/kernel/process.c
--- a/arch/v850/kernel/process.c	Tue Jun 15 22:20:37 2004
+++ b/arch/v850/kernel/process.c	Tue Jun 15 22:20:37 2004
@@ -203,8 +203,8 @@
 /*
  * These bracket the sleeping functions..
  */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
+#define first_sched	((unsigned long)__sched_text_start)
+#define last_sched	((unsigned long)__sched_text_end)
 
 unsigned long get_wchan (struct task_struct *p)
 {
diff -Nru a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
--- a/arch/v850/kernel/vmlinux.lds.S	Tue Jun 15 22:20:42 2004
+++ b/arch/v850/kernel/vmlinux.lds.S	Tue Jun 15 22:20:42 2004
@@ -12,6 +12,7 @@
  */
 
 #include <linux/config.h>
+#define VMLINUX_SYMBOL(_sym_) _##_sym_
 #include <asm-generic/vmlinux.lds.h>
 
 /* For most platforms, this will define useful things like RAM addr/size.  */
diff -Nru a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
--- a/arch/x86_64/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/arch/x86_64/Kconfig	Tue Jun 15 22:20:43 2004
@@ -239,7 +239,16 @@
 	  Say Y here if you are feeling brave and building a kernel for a 
 	  desktop, embedded or real-time system.  Say N if you are unsure. 
 
-# someone write a better help text please.
+config SCHED_SMT
+	bool "SMT (Hyperthreading) scheduler support"
+	depends on SMP
+	default off
+	help
+	  SMT scheduler support improves the CPU scheduler's decision making
+	  when dealing with Intel Pentium 4 chips with HyperThreading at a
+	  cost of slightly increased overhead in some places. If unsure say
+	  N here.
+
 config K8_NUMA
        bool "K8 NUMA support"
        depends on SMP
@@ -247,9 +256,9 @@
 	  Enable NUMA (Non Unified Memory Architecture) support for
 	  AMD Opteron Multiprocessor systems. The kernel will try to allocate
 	  memory used by a CPU on the local memory controller of the CPU
-	  and in the future do more optimizations. This may improve performance 
-	  or it may not. Code is still experimental.
-	  Say N if unsure.
+	  and add some more NUMA awareness to the kernel.
+	  This code is recommended on all multiprocessor Opteron systems
+	  and normally doesn't hurt on others.
 
 config DISCONTIGMEM
        bool
diff -Nru a/arch/x86_64/boot/compressed/misc.c b/arch/x86_64/boot/compressed/misc.c
--- a/arch/x86_64/boot/compressed/misc.c	Tue Jun 15 22:20:39 2004
+++ b/arch/x86_64/boot/compressed/misc.c	Tue Jun 15 22:20:39 2004
@@ -92,7 +92,7 @@
 static void *malloc(int size);
 static void free(void *where);
  
-static void puts(const char *);
+static void putstr(const char *);
   
 extern int end;
 static long free_mem_ptr = (long)&end;
@@ -153,7 +153,7 @@
 		vidmem[i] = ' ';
 }
 
-static void puts(const char *s)
+static void putstr(const char *s)
 {
 	int x,y,pos;
 	char c;
@@ -270,9 +270,9 @@
 
 static void error(char *x)
 {
-	puts("\n\n");
-	puts(x);
-	puts("\n\n -- System halted");
+	putstr("\n\n");
+	putstr(x);
+	putstr("\n\n -- System halted");
 
 	while(1);
 }
@@ -346,9 +346,9 @@
 	else setup_output_buffer_if_we_run_high(mv);
 
 	makecrc();
-	puts(".\nDecompressing Linux...");
+	putstr(".\nDecompressing Linux...");
 	gunzip();
-	puts("done.\nBooting the kernel.\n");
+	putstr("done.\nBooting the kernel.\n");
 	if (high_loaded) close_output_buffer_if_we_run_high(mv);
 	return high_loaded;
 }
diff -Nru a/arch/x86_64/boot/setup.S b/arch/x86_64/boot/setup.S
--- a/arch/x86_64/boot/setup.S	Tue Jun 15 22:21:04 2004
+++ b/arch/x86_64/boot/setup.S	Tue Jun 15 22:21:04 2004
@@ -132,7 +132,7 @@
 ramdisk_size:	.long	0		# its size in bytes
 
 bootsect_kludge:
-		.word  bootsect_helper, SETUPSEG
+		.long	0		# obsolete
 
 heap_end_ptr:	.word	modelist+1024	# (Header version 0x0201 or later)
 					# space from here (exclusive) down to
@@ -759,87 +759,6 @@
 	outb	%al, $0x70
 	lret
 
-# This routine only gets called, if we get loaded by the simple
-# bootsect loader _and_ have a bzImage to load.
-# Because there is no place left in the 512 bytes of the boot sector,
-# we must emigrate to code space here.
-bootsect_helper:
-	cmpw	$0, %cs:bootsect_es
-	jnz	bootsect_second
-
-	movb	$0x20, %cs:type_of_loader
-	movw	%es, %ax
-	shrw	$4, %ax
-	movb	%ah, %cs:bootsect_src_base+2
-	movw	%es, %ax
-	movw	%ax, %cs:bootsect_es
-	subw	$SYSSEG, %ax
-	lret					# nothing else to do for now
-
-bootsect_second:
-	pushw	%cx
-	pushw	%si
-	pushw	%bx
-	testw	%bx, %bx			# 64K full?
-	jne	bootsect_ex
-
-	movw	$0x8000, %cx			# full 64K, INT15 moves words
-	pushw	%cs
-	popw	%es
-	movw	$bootsect_gdt, %si
-	movw	$0x8700, %ax
-	int	$0x15
-	jc	bootsect_panic			# this, if INT15 fails
-
-	movw	%cs:bootsect_es, %es		# we reset %es to always point
-	incb	%cs:bootsect_dst_base+2		# to 0x10000
-bootsect_ex:
-	movb	%cs:bootsect_dst_base+2, %ah
-	shlb	$4, %ah				# we now have the number of
-						# moved frames in %ax
-	xorb	%al, %al
-	popw	%bx
-	popw	%si
-	popw	%cx
-	lret
-
-bootsect_gdt:
-	.word	0, 0, 0, 0
-	.word	0, 0, 0, 0
-
-bootsect_src:
-	.word	0xffff
-
-bootsect_src_base:
-	.byte	0x00, 0x00, 0x01		# base = 0x010000
-	.byte	0x93				# typbyte
-	.word	0				# limit16,base24 =0
-
-bootsect_dst:
-	.word	0xffff
-
-bootsect_dst_base:
-	.byte	0x00, 0x00, 0x10		# base = 0x100000
-	.byte	0x93				# typbyte
-	.word	0				# limit16,base24 =0
-	.word	0, 0, 0, 0			# BIOS CS
-	.word	0, 0, 0, 0			# BIOS DS
-
-bootsect_es:
-	.word	0
-
-bootsect_panic:
-	pushw	%cs
-	popw	%ds
-	cld
-	leaw	bootsect_panic_mess, %si
-	call	prtstr
-	
-bootsect_panic_loop:
-	jmp	bootsect_panic_loop
-
-bootsect_panic_mess:
-	.string	"INT15 refuses to access high mem, giving up."
 
 # This routine checks that the keyboard command queue is empty
 # (after emptying the output buffers)
diff -Nru a/arch/x86_64/defconfig b/arch/x86_64/defconfig
--- a/arch/x86_64/defconfig	Tue Jun 15 22:20:42 2004
+++ b/arch/x86_64/defconfig	Tue Jun 15 22:20:42 2004
@@ -34,6 +34,7 @@
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
@@ -72,6 +73,7 @@
 CONFIG_MTRR=y
 CONFIG_SMP=y
 # CONFIG_PREEMPT is not set
+CONFIG_SCHED_SMT=y
 CONFIG_K8_NUMA=y
 CONFIG_DISCONTIGMEM=y
 CONFIG_NUMA=y
@@ -233,6 +235,7 @@
 # CONFIG_BLK_DEV_SLC90E66 is not set
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
+# CONFIG_IDE_ARM is not set
 CONFIG_BLK_DEV_IDEDMA=y
 # CONFIG_IDEDMA_IVB is not set
 CONFIG_IDEDMA_AUTO=y
@@ -257,7 +260,6 @@
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 # CONFIG_SCSI_MULTI_LUN is not set
-# CONFIG_SCSI_REPORT_LUNS is not set
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
 
@@ -282,6 +284,7 @@
 # CONFIG_SCSI_SATA_SVW is not set
 CONFIG_SCSI_ATA_PIIX=y
 # CONFIG_SCSI_SATA_PROMISE is not set
+# CONFIG_SCSI_SATA_SX4 is not set
 # CONFIG_SCSI_SATA_SIL is not set
 # CONFIG_SCSI_SATA_SIS is not set
 CONFIG_SCSI_SATA_VIA=y
@@ -296,6 +299,7 @@
 # CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_INIA100 is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
+# CONFIG_SCSI_IPR is not set
 # CONFIG_SCSI_QLOGIC_ISP is not set
 # CONFIG_SCSI_QLOGIC_FC is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
@@ -331,6 +335,7 @@
 #
 # I2O device support
 #
+# CONFIG_I2O is not set
 
 #
 # Networking support
@@ -363,8 +368,6 @@
 # CONFIG_INET6_ESP is not set
 # CONFIG_INET6_IPCOMP is not set
 # CONFIG_IPV6_TUNNEL is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 
 #
@@ -372,7 +375,9 @@
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -393,16 +398,23 @@
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+CONFIG_NETPOLL=y
+# CONFIG_NETPOLL_RX is not set
+# CONFIG_NETPOLL_TRAP is not set
+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 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)
@@ -421,6 +433,7 @@
 CONFIG_NET_PCI=y
 # CONFIG_PCNET32 is not set
 CONFIG_AMD8111_ETH=y
+# CONFIG_AMD8111E_NAPI is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_B44 is not set
 CONFIG_FORCEDETH=y
@@ -436,7 +449,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=2
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
@@ -453,7 +465,6 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 CONFIG_TIGON3=y
 
@@ -461,47 +472,29 @@
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-CONFIG_NETCONSOLE=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 is not set
-# CONFIG_NETPOLL_TRAP is not set
-CONFIG_NET_POLL_CONTROLLER=y
+# 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=y
 
 #
 # ISDN subsystem
@@ -685,7 +678,108 @@
 #
 # USB support
 #
-# CONFIG_USB is not set
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+
+#
+# Miscellaneous USB options
+#
+CONFIG_USB_DEVICEFS=y
+# CONFIG_USB_BANDWIDTH is not set
+# CONFIG_USB_DYNAMIC_MINORS is not set
+
+#
+# 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
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_AUDIO is not set
+# CONFIG_USB_BLUETOOTH_TTY is not set
+# CONFIG_USB_MIDI is not set
+# CONFIG_USB_ACM is not set
+CONFIG_USB_PRINTER=y
+CONFIG_USB_STORAGE=y
+# CONFIG_USB_STORAGE_DEBUG is not set
+# CONFIG_USB_STORAGE_DATAFAB is not set
+# CONFIG_USB_STORAGE_FREECOM is not set
+# CONFIG_USB_STORAGE_ISD200 is not set
+# CONFIG_USB_STORAGE_DPCM is not set
+# CONFIG_USB_STORAGE_HP8200e is not set
+# CONFIG_USB_STORAGE_SDDR09 is not set
+# CONFIG_USB_STORAGE_SDDR55 is not set
+# CONFIG_USB_STORAGE_JUMPSHOT is not set
+
+#
+# USB Human Interface Devices (HID)
+#
+CONFIG_USB_HID=y
+CONFIG_USB_HIDINPUT=y
+# CONFIG_HID_FF is not set
+# CONFIG_USB_HIDDEV is not set
+# 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
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+# CONFIG_USB_HPUSBSCSI is not set
+
+#
+# USB Multimedia devices
+#
+# CONFIG_USB_DABUSB is not set
+
+#
+# Video4Linux support is needed for USB Multimedia device support
+#
+
+#
+# USB Network adaptors
+#
+# 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_USBNET is not set
+
+#
+# USB port drivers
+#
+
+#
+# USB Serial Converter support
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# 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_PHIDGETSERVO is not set
+# CONFIG_USB_TEST is not set
 
 #
 # USB Gadget Support
@@ -714,6 +808,9 @@
 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 is not set
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
 # CONFIG_XFS_FS is not set
@@ -787,7 +884,6 @@
 # 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
 
 #
@@ -833,3 +929,4 @@
 # Library routines
 #
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
diff -Nru a/arch/x86_64/ia32/fpu32.c b/arch/x86_64/ia32/fpu32.c
--- a/arch/x86_64/ia32/fpu32.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/ia32/fpu32.c	Tue Jun 15 22:20:36 2004
@@ -72,15 +72,15 @@
 
 
 static inline int convert_fxsr_from_user(struct i387_fxsave_struct *fxsave,
-					 struct _fpstate_ia32 *buf)
+					 struct _fpstate_ia32 __user *buf)
 {
 	struct _fpxreg *to;
-	struct _fpreg *from;
+	struct _fpreg __user *from;
 	int i;
 	u32 v;
 	int err = 0;
 
-#define G(num,val) err |= __get_user(val, num + (u32 *)buf)
+#define G(num,val) err |= __get_user(val, num + (u32 __user *)buf)
 	G(0, fxsave->cwd);
 	G(1, fxsave->swd);
 	G(2, fxsave->twd);
@@ -104,12 +104,12 @@
 }
 
 
-static inline int convert_fxsr_to_user(struct _fpstate_ia32 *buf,
+static inline int convert_fxsr_to_user(struct _fpstate_ia32 __user *buf,
 				       struct i387_fxsave_struct *fxsave,
 				       struct pt_regs *regs,
 				       struct task_struct *tsk)
 {
-	struct _fpreg *to;
+	struct _fpreg __user *to;
 	struct _fpxreg *from;
 	int i;
 	u16 cs,ds; 
@@ -125,7 +125,7 @@
 		cs = regs->cs;
 	} 
 
-#define P(num,val) err |= __put_user(val, num + (u32 *)buf)
+#define P(num,val) err |= __put_user(val, num + (u32 __user *)buf)
 	P(0, (u32)fxsave->cwd | 0xffff0000);
 	P(1, (u32)fxsave->swd | 0xffff0000);
 	P(2, twd_fxsr_to_i387(fxsave));
@@ -147,7 +147,7 @@
 	return 0;
 }
 
-int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fsave) 
+int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, int fsave) 
 { 
 	clear_fpu(tsk);
 	if (!fsave) { 
@@ -162,7 +162,7 @@
 }  
 
 int save_i387_ia32(struct task_struct *tsk, 
-		   struct _fpstate_ia32 *buf, 
+		   struct _fpstate_ia32 __user *buf, 
 		   struct pt_regs *regs,
 		   int fsave)
 {
diff -Nru a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
--- a/arch/x86_64/ia32/ia32_binfmt.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/ia32/ia32_binfmt.c	Tue Jun 15 22:20:36 2004
@@ -349,6 +349,8 @@
 		return -ENOMEM;
 	}
 
+	memset(mpnt, 0, sizeof(*mpnt));
+
 	down_write(&mm->mmap_sem);
 	{
 		mpnt->vm_mm = mm;
@@ -362,11 +364,6 @@
 			mpnt->vm_flags = vm_stack_flags32;
  		mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC) ? 
  			PAGE_COPY_EXEC : PAGE_COPY;
-		mpnt->vm_ops = NULL;
-		mpnt->vm_pgoff = 0;
-		mpnt->vm_file = NULL;
-		INIT_LIST_HEAD(&mpnt->shared);
-		mpnt->vm_private_data = (void *) 0;
 		insert_vm_struct(mm, mpnt);
 		mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
 	} 
@@ -375,7 +372,7 @@
 		struct page *page = bprm->page[i];
 		if (page) {
 			bprm->page[i] = NULL;
-			put_dirty_page(current,page,stack_base,mpnt->vm_page_prot);
+			install_arg_page(mpnt, page, stack_base);
 		}
 		stack_base += PAGE_SIZE;
 	}
diff -Nru a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c
--- a/arch/x86_64/ia32/ia32_ioctl.c	Tue Jun 15 22:20:40 2004
+++ b/arch/x86_64/ia32/ia32_ioctl.c	Tue Jun 15 22:20:40 2004
@@ -21,7 +21,7 @@
 #ifndef TIOCGDEV
 #define TIOCGDEV       _IOR('T',0x32, unsigned int)
 #endif
-static int tiocgdev(unsigned fd, unsigned cmd,  unsigned int *ptr) 
+static int tiocgdev(unsigned fd, unsigned cmd,  unsigned int __user *ptr) 
 { 
 
 	struct file *file = fget(fd);
@@ -54,7 +54,7 @@
 		ret = sys_ioctl(fd, RTC_IRQP_READ, (unsigned long)&val); 
 		set_fs(oldfs); 
 		if (!ret)
-			ret = put_user(val, (unsigned int*) arg); 
+			ret = put_user(val, (unsigned int __user *) arg); 
 		return ret; 
 
 	case RTC_IRQP_SET32: 
@@ -66,7 +66,7 @@
 		ret = sys_ioctl(fd, RTC_EPOCH_READ, (unsigned long) &val); 
 		set_fs(oldfs); 
 		if (!ret)
-			ret = put_user(val, (unsigned int*) arg); 
+			ret = put_user(val, (unsigned int __user *) arg); 
 		return ret; 
 
 	case RTC_EPOCH_SET32:
@@ -113,7 +113,7 @@
 	struct mtrr_gentry g;
 	struct mtrr_sentry s;
 	int get = 0, err = 0; 
-	struct mtrr_gentry32 *g32 = (struct mtrr_gentry32 *)arg; 
+	struct mtrr_gentry32 __user *g32 = (struct mtrr_gentry32 __user *)arg; 
 	mm_segment_t oldfs = get_fs(); 
 
 	switch (cmd) { 
@@ -139,7 +139,7 @@
 
 		arg = (unsigned long)&g; 
 	} else { 
-		struct mtrr_sentry32 *s32 = (struct mtrr_sentry32 *)arg;
+		struct mtrr_sentry32 __user *s32 = (struct mtrr_sentry32 __user *)arg;
 		err = get_user(s.base, &s32->base);
 		err |= get_user(s.size, &s32->size);
 		err |= get_user(s.type, &s32->type);
diff -Nru a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c
--- a/arch/x86_64/ia32/ia32_signal.c	Tue Jun 15 22:21:04 2004
+++ b/arch/x86_64/ia32/ia32_signal.c	Tue Jun 15 22:21:04 2004
@@ -42,7 +42,7 @@
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
 asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
-void signal_fault(struct pt_regs *regs, void *frame, char *where);
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
 int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from)
 {
@@ -98,6 +98,7 @@
 int ia32_copy_siginfo_from_user(siginfo_t *to, siginfo_t32 __user *from)
 {
 	int err;
+	u32 ptr32;
 	if (!access_ok (VERIFY_READ, from, sizeof(siginfo_t32)))
 		return -EFAULT;
 
@@ -107,7 +108,8 @@
 
 	err |= __get_user(to->si_pid, &from->si_pid);
 	err |= __get_user(to->si_uid, &from->si_uid);
-	err |= __get_user((u32)(u64)to->si_ptr, &from->si_ptr);
+	err |= __get_user(ptr32, &from->si_ptr);
+	to->si_ptr = (void*)(u64)ptr32;
 
 	return err;
 }
@@ -134,8 +136,9 @@
 }
 
 asmlinkage long
-sys32_sigaltstack(const stack_ia32_t *uss_ptr, stack_ia32_t *uoss_ptr, 
-				  struct pt_regs regs)
+sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
+		  stack_ia32_t __user *uoss_ptr, 
+		  struct pt_regs regs)
 {
 	stack_t uss,uoss; 
 	int ret;
@@ -191,7 +194,7 @@
 };
 
 static int
-ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 *sc, unsigned int *peax)
+ia32_restore_sigcontext(struct pt_regs *regs, struct sigcontext_ia32 __user *sc, unsigned int *peax)
 {
 	unsigned int err = 0;
 	
@@ -250,9 +253,9 @@
 
 	{
 		u32 tmp;
-		struct _fpstate_ia32 * buf;
+		struct _fpstate_ia32 __user * buf;
 		err |= __get_user(tmp, &sc->fpstate);
-		buf = (struct _fpstate_ia32 *) (u64)tmp;
+		buf = compat_ptr(tmp);
 		if (buf) {
 			if (verify_area(VERIFY_READ, buf, sizeof(*buf)))
 				goto badframe;
@@ -273,7 +276,7 @@
 
 asmlinkage long sys32_sigreturn(struct pt_regs regs)
 {
-	struct sigframe *frame = (struct sigframe *)(regs.rsp - 8);
+	struct sigframe __user *frame = (struct sigframe __user *)(regs.rsp-8);
 	sigset_t set;
 	unsigned int eax;
 
@@ -302,9 +305,8 @@
 
 asmlinkage long sys32_rt_sigreturn(struct pt_regs regs)
 {
-	struct rt_sigframe *frame = (struct rt_sigframe *)(regs.rsp - 4);
+	struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(regs.rsp - 4);
 	sigset_t set;
-	stack_t st;
 	unsigned int eax;
 
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
@@ -321,16 +323,8 @@
 	if (ia32_restore_sigcontext(&regs, &frame->uc.uc_mcontext, &eax))
 		goto badframe;
 
-	if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
+	if (sys32_sigaltstack(&frame->uc.uc_stack, NULL, regs) == -EFAULT)
 		goto badframe;
-	/* It is more difficult to avoid calling this function than to
-	   call it and ignore errors.  */
-	{
-		mm_segment_t oldds = get_fs(); 
-		set_fs(KERNEL_DS); 
-		do_sigaltstack(&st, NULL, regs.rsp);
-		set_fs(oldds);  
-	}
 
 	return eax;
 
@@ -344,20 +338,20 @@
  */
 
 static int
-ia32_setup_sigcontext(struct sigcontext_ia32 *sc, struct _fpstate_ia32 *fpstate,
+ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __user *fpstate,
 		 struct pt_regs *regs, unsigned int mask)
 {
 	int tmp, err = 0;
 
 	tmp = 0;
 	__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->gs);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
 	__asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->fs);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->fs);
 	__asm__("movl %%ds,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->ds);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->ds);
 	__asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp));
-	err |= __put_user(tmp, (unsigned int *)&sc->es);
+	err |= __put_user(tmp, (unsigned int __user *)&sc->es);
 
 	err |= __put_user((u32)regs->rdi, &sc->edi);
 	err |= __put_user((u32)regs->rsi, &sc->esi);
@@ -394,7 +388,7 @@
 /*
  * Determine which stack to use..
  */
-static void *
+static void __user *
 get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
 {
 	unsigned long rsp;
@@ -415,13 +409,13 @@
 		rsp = (unsigned long) ka->sa.sa_restorer;
 	}
 
-	return (void *)((rsp - frame_size) & -8UL);
+	return (void __user *)((rsp - frame_size) & -8UL);
 }
 
 void ia32_setup_frame(int sig, struct k_sigaction *ka,
 			compat_sigset_t *set, struct pt_regs * regs)
 {
-	struct sigframe *frame;
+	struct sigframe __user *frame;
 	int err = 0;
 
 	frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -508,7 +502,7 @@
 void ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 			   compat_sigset_t *set, struct pt_regs * regs)
 {
-	struct rt_sigframe *frame;
+	struct rt_sigframe __user *frame;
 	int err = 0;
 
 	frame = get_sigframe(ka, regs, sizeof(*frame));
diff -Nru a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
--- a/arch/x86_64/ia32/ia32entry.S	Tue Jun 15 22:20:40 2004
+++ b/arch/x86_64/ia32/ia32entry.S	Tue Jun 15 22:20:40 2004
@@ -322,7 +322,7 @@
 	.quad sys_mknod
 	.quad sys_chmod		/* 15 */
 	.quad sys_lchown16
-	.quad ni_syscall			/* old break syscall holder */
+	.quad quiet_ni_syscall			/* old break syscall holder */
 	.quad sys_stat
 	.quad sys32_lseek
 	.quad sys_getpid		/* 20 */
@@ -336,11 +336,11 @@
 	.quad sys_fstat	/* (old)fstat */
 	.quad sys_pause
 	.quad compat_sys_utime	/* 30 */
-	.quad ni_syscall	/* old stty syscall holder */
-	.quad ni_syscall	/* old gtty syscall holder */
+	.quad quiet_ni_syscall	/* old stty syscall holder */
+	.quad quiet_ni_syscall	/* old gtty syscall holder */
 	.quad sys_access
 	.quad sys_nice	
-	.quad ni_syscall	/* 35 */	/* old ftime syscall holder */
+	.quad quiet_ni_syscall	/* 35 */	/* old ftime syscall holder */
 	.quad sys_sync
 	.quad sys32_kill
 	.quad sys_rename
@@ -349,7 +349,7 @@
 	.quad sys_dup
 	.quad sys32_pipe
 	.quad compat_sys_times
-	.quad ni_syscall			/* old prof syscall holder */
+	.quad quiet_ni_syscall			/* old prof syscall holder */
 	.quad sys_brk		/* 45 */
 	.quad sys_setgid16
 	.quad sys_getgid16
@@ -358,12 +358,12 @@
 	.quad sys_getegid16	/* 50 */
 	.quad sys_acct
 	.quad sys_umount			/* new_umount */
-	.quad ni_syscall			/* old lock syscall holder */
+	.quad quiet_ni_syscall			/* old lock syscall holder */
 	.quad compat_sys_ioctl
 	.quad compat_sys_fcntl64		/* 55 */
-	.quad ni_syscall			/* old mpx syscall holder */
+	.quad quiet_ni_syscall			/* old mpx syscall holder */
 	.quad sys_setpgid
-	.quad ni_syscall			/* old ulimit syscall holder */
+	.quad quiet_ni_syscall			/* old ulimit syscall holder */
 	.quad sys32_olduname
 	.quad sys_umask		/* 60 */
 	.quad sys_chroot
@@ -403,7 +403,7 @@
 	.quad sys_fchown16		/* 95 */
 	.quad sys_getpriority
 	.quad sys_setpriority
-	.quad ni_syscall			/* old profil syscall holder */
+	.quad quiet_ni_syscall			/* old profil syscall holder */
 	.quad compat_sys_statfs
 	.quad compat_sys_fstatfs		/* 100 */
 	.quad sys_ioperm
@@ -417,7 +417,7 @@
 	.quad sys32_uname
 	.quad stub32_iopl		/* 110 */
 	.quad sys_vhangup
-	.quad ni_syscall	/* old "idle" system call */
+	.quad quiet_ni_syscall	/* old "idle" system call */
 	.quad sys32_vm86_warning	/* vm86old */ 
 	.quad compat_sys_wait4
 	.quad sys_swapoff		/* 115 */
@@ -442,16 +442,16 @@
 	.quad quiet_ni_syscall	/* bdflush */
 	.quad sys_sysfs		/* 135 */
 	.quad sys_personality
-	.quad ni_syscall	/* for afs_syscall */
+	.quad quiet_ni_syscall	/* for afs_syscall */
 	.quad sys_setfsuid16
 	.quad sys_setfsgid16
 	.quad sys_llseek		/* 140 */
 	.quad sys32_getdents
-	.quad sys32_select
+	.quad compat_sys_select
 	.quad sys_flock
 	.quad sys_msync
-	.quad sys32_readv		/* 145 */
-	.quad sys32_writev
+	.quad compat_sys_readv		/* 145 */
+	.quad compat_sys_writev
 	.quad sys_getsid
 	.quad sys_fdatasync
 	.quad sys32_sysctl	/* sysctl */
@@ -474,7 +474,7 @@
 	.quad sys32_vm86_warning	/* vm86 */ 
 	.quad quiet_ni_syscall	/* query_module */
 	.quad sys_poll
-	.quad sys32_nfsservctl
+	.quad compat_sys_nfsservctl
 	.quad sys_setresgid16	/* 170 */
 	.quad sys_getresgid16
 	.quad sys_prctl
@@ -493,8 +493,8 @@
 	.quad sys_capset
 	.quad stub32_sigaltstack
 	.quad sys32_sendfile
-	.quad ni_syscall		/* streams1 */
-	.quad ni_syscall		/* streams2 */
+	.quad quiet_ni_syscall		/* streams1 */
+	.quad quiet_ni_syscall		/* streams2 */
 	.quad stub32_vfork            /* 190 */
 	.quad compat_sys_getrlimit
 	.quad sys32_mmap2
@@ -543,51 +543,52 @@
 	.quad sys_removexattr	/* 235 */
 	.quad sys_lremovexattr
 	.quad sys_fremovexattr
-	.quad sys_tkill		/* 238 */ 
+	.quad sys_tkill
 	.quad sys_sendfile64 
 	.quad compat_sys_futex		/* 240 */
-        .quad compat_sys_sched_setaffinity
-        .quad compat_sys_sched_getaffinity
+	.quad compat_sys_sched_setaffinity
+	.quad compat_sys_sched_getaffinity
 	.quad sys32_set_thread_area
 	.quad sys32_get_thread_area
-	.quad sys32_io_setup
+	.quad sys32_io_setup		/* 245 */
 	.quad sys_io_destroy
 	.quad sys32_io_getevents
 	.quad sys32_io_submit
 	.quad sys_io_cancel
-	.quad sys_fadvise64
-	.quad quiet_ni_syscall /* free_huge_pages */
-	.quad sys_exit_group /* exit_group */
+	.quad sys_fadvise64		/* 250 */
+	.quad quiet_ni_syscall 	/* free_huge_pages */
+	.quad sys_exit_group
 	.quad sys_lookup_dcookie
 	.quad sys_epoll_create
-	.quad sys_epoll_ctl
+	.quad sys_epoll_ctl		/* 255 */
 	.quad sys_epoll_wait
 	.quad sys_remap_file_pages
 	.quad sys_set_tid_address
 	.quad sys32_timer_create
-	.quad compat_timer_settime
+	.quad compat_timer_settime	/* 260 */
 	.quad compat_timer_gettime
 	.quad sys_timer_getoverrun
 	.quad sys_timer_delete
 	.quad compat_clock_settime
-	.quad compat_clock_gettime
+	.quad compat_clock_gettime	/* 265 */
 	.quad compat_clock_getres
 	.quad compat_clock_nanosleep
-	.quad compat_statfs64   /* statfs64 */
-	.quad compat_fstatfs64  /* fstatfs64 */
-	.quad sys_tgkill
+	.quad compat_statfs64
+	.quad compat_fstatfs64
+	.quad sys_tgkill		/* 270 */
 	.quad compat_sys_utimes
 	.quad sys32_fadvise64_64
-	.quad sys_ni_syscall	/* sys_vserver */
-	.quad sys_ni_syscall	/* sys_mbind */
-	.quad sys_ni_syscall	/* 275 sys_get_mempolicy */
-	.quad sys_ni_syscall	/* sys_set_mempolicy */
+	.quad quiet_ni_syscall	/* sys_vserver */
+	.quad sys_mbind
+	.quad compat_get_mempolicy	/* 275 */
+	.quad sys_set_mempolicy
 	.quad compat_sys_mq_open
 	.quad sys_mq_unlink
 	.quad compat_sys_mq_timedsend
 	.quad compat_sys_mq_timedreceive	/* 280 */
 	.quad compat_sys_mq_notify
 	.quad compat_sys_mq_getsetattr
+	.quad quiet_ni_syscall		/* reserved for kexec */
 	/* don't forget to change IA32_NR_syscalls */
 ia32_syscall_end:		
 	.rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
diff -Nru a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c
--- a/arch/x86_64/ia32/ptrace32.c	Tue Jun 15 22:20:38 2004
+++ b/arch/x86_64/ia32/ptrace32.c	Tue Jun 15 22:20:38 2004
@@ -17,7 +17,9 @@
 #include <linux/syscalls.h>
 #include <linux/unistd.h>
 #include <linux/mm.h>
+#include <linux/ptrace.h>
 #include <asm/ptrace.h>
+#include <asm/compat.h>
 #include <asm/uaccess.h>
 #include <asm/user32.h>
 #include <asm/user.h>
@@ -25,8 +27,6 @@
 #include <asm/debugreg.h>
 #include <asm/i387.h>
 #include <asm/fpu32.h>
-#include <linux/ptrace.h>
-#include <linux/mm.h>
 
 /* determines which flags the user has access to. */
 /* 1 = access 0 = no access */
@@ -229,6 +229,7 @@
 {
 	struct task_struct *child;
 	struct pt_regs *childregs; 
+	void __user *datap = compat_ptr(data);
 	int ret;
 	__u32 val;
 
@@ -265,7 +266,7 @@
 		if (access_process_vm(child, addr, &val, sizeof(u32), 0)!=sizeof(u32))
 			ret = -EIO;
 		else
-			ret = put_user(val, (unsigned int *)(u64)data); 
+			ret = put_user(val, (unsigned int __user *)datap); 
 		break; 
 
 	case PTRACE_POKEDATA:
@@ -278,7 +279,7 @@
 	case PTRACE_PEEKUSR:
 		ret = getreg32(child, addr, &val);
 		if (ret == 0)
-			ret = put_user(val, (__u32 *)(unsigned long) data);
+			ret = put_user(val, (__u32 __user *)datap);
 		break;
 
 	case PTRACE_POKEUSR:
@@ -287,15 +288,15 @@
 
 	case PTRACE_GETREGS: { /* Get all gp regs from the child. */
 		int i;
-	  	if (!access_ok(VERIFY_WRITE, (unsigned *)(unsigned long)data, 16*4)) {
+	  	if (!access_ok(VERIFY_WRITE, datap, 16*4)) {
 			ret = -EIO;
 			break;
 		}
 		ret = 0;
 		for ( i = 0; i <= 16*4 ; i += sizeof(__u32) ) {
 			getreg32(child, i, &val);
-			ret |= __put_user(val,(u32 *) (unsigned long) data);
-			data += sizeof(u32);
+			ret |= __put_user(val,(u32 __user *)datap);
+			datap += sizeof(u32);
 		}
 		break;
 	}
@@ -303,40 +304,40 @@
 	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
 		unsigned long tmp;
 		int i;
-	  	if (!access_ok(VERIFY_READ, (unsigned *)(unsigned long)data, 16*4)) {
+	  	if (!access_ok(VERIFY_READ, datap, 16*4)) {
 			ret = -EIO;
 			break;
 		}
 		ret = 0; 
 		for ( i = 0; i <= 16*4; i += sizeof(u32) ) {
-			ret |= __get_user(tmp, (u32 *) (unsigned long) data);
+			ret |= __get_user(tmp, (u32 __user *)datap);
 			putreg32(child, i, tmp);
-			data += sizeof(u32);
+			datap += sizeof(u32);
 		}
 		break;
 	}
 
 	case PTRACE_GETFPREGS:
 		ret = -EIO; 
-		if (!access_ok(VERIFY_READ, (void *)(u64)data, 
+		if (!access_ok(VERIFY_READ, compat_ptr(data), 
 			       sizeof(struct user_i387_struct)))
 			break;
-		save_i387_ia32(child, (void *)(u64)data, childregs, 1);
+		save_i387_ia32(child, datap, childregs, 1);
 		ret = 0; 
 			break;
 
 	case PTRACE_SETFPREGS:
 		ret = -EIO;
-		if (!access_ok(VERIFY_WRITE, (void *)(u64)data, 
+		if (!access_ok(VERIFY_WRITE, datap, 
 			       sizeof(struct user_i387_struct)))
 			break;
 		ret = 0;
 		/* don't check EFAULT to be bug-to-bug compatible to i386 */
-		restore_i387_ia32(child, (void *)(u64)data, 1);
+		restore_i387_ia32(child, datap, 1);
 		break;
 
 	case PTRACE_GETFPXREGS: { 
-		struct user32_fxsr_struct *u = (void *)(u64)data; 
+		struct user32_fxsr_struct __user *u = datap;
 		init_fpu(child); 
 		ret = -EIO;
 		if (!access_ok(VERIFY_WRITE, u, sizeof(*u)))
@@ -349,7 +350,7 @@
 		break; 
 	} 
 	case PTRACE_SETFPXREGS: { 
-		struct user32_fxsr_struct *u = (void *)(u64)data; 
+		struct user32_fxsr_struct __user *u = datap;
 		unlazy_fpu(child);
 		ret = -EIO;
 		if (!access_ok(VERIFY_READ, u, sizeof(*u)))
diff -Nru a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
--- a/arch/x86_64/ia32/sys_ia32.c	Tue Jun 15 22:20:39 2004
+++ b/arch/x86_64/ia32/sys_ia32.c	Tue Jun 15 22:20:39 2004
@@ -76,9 +76,9 @@
 #define A(__x)		((unsigned long)(__x))
 #define AA(__x)		((unsigned long)(__x))
 #define ROUND_UP(x,a)	((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 
-int cp_compat_stat(struct kstat *kbuf, struct compat_stat *ubuf)
+int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf)
 {
 	typeof(ubuf->st_uid) uid = 0;
 	typeof(ubuf->st_gid) gid = 0;
@@ -110,7 +110,7 @@
 }
 
 asmlinkage long
-sys32_truncate64(char * filename, unsigned long offset_low, unsigned long offset_high)
+sys32_truncate64(char __user * filename, unsigned long offset_low, unsigned long offset_high)
 {
        return sys_truncate(filename, ((loff_t) offset_high << 32) | offset_low);
 }
@@ -125,7 +125,7 @@
    support for 64bit inode numbers. */
 
 static int
-cp_stat64(struct stat64 *ubuf, struct kstat *stat)
+cp_stat64(struct stat64 __user *ubuf, struct kstat *stat)
 {
 	typeof(ubuf->st_uid) uid = 0;
 	typeof(ubuf->st_gid) gid = 0;
@@ -154,7 +154,7 @@
 }
 
 asmlinkage long
-sys32_stat64(char * filename, struct stat64 *statbuf)
+sys32_stat64(char __user * filename, struct stat64 __user *statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_stat(filename, &stat);
@@ -164,7 +164,7 @@
 }
 
 asmlinkage long
-sys32_lstat64(char * filename, struct stat64 *statbuf)
+sys32_lstat64(char __user * filename, struct stat64 __user *statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_lstat(filename, &stat);
@@ -174,7 +174,7 @@
 }
 
 asmlinkage long
-sys32_fstat64(unsigned int fd, struct stat64 *statbuf)
+sys32_fstat64(unsigned int fd, struct stat64 __user *statbuf)
 {
 	struct kstat stat;
 	int ret = vfs_fstat(fd, &stat);
@@ -199,7 +199,7 @@
 };
 
 asmlinkage long
-sys32_mmap(struct mmap_arg_struct *arg)
+sys32_mmap(struct mmap_arg_struct __user *arg)
 {
 	struct mmap_arg_struct a;
 	struct file *file = NULL;
@@ -241,7 +241,7 @@
 }
 
 asmlinkage long
-sys32_pipe(int *fd)
+sys32_pipe(int __user *fd)
 {
 	int retval;
 	int fds[2];
@@ -256,8 +256,8 @@
 }
 
 asmlinkage long
-sys32_rt_sigaction(int sig, struct sigaction32 *act,
-		   struct sigaction32 *oact,  unsigned int sigsetsize)
+sys32_rt_sigaction(int sig, struct sigaction32 __user *act,
+		   struct sigaction32 __user *oact,  unsigned int sigsetsize)
 {
 	struct k_sigaction new_ka, old_ka;
 	int ret;
@@ -321,7 +321,7 @@
 }
 
 asmlinkage long
-sys32_sigaction (int sig, struct old_sigaction32 *act, struct old_sigaction32 *oact)
+sys32_sigaction (int sig, struct old_sigaction32 __user *act, struct old_sigaction32 __user *oact)
 {
         struct k_sigaction new_ka, old_ka;
         int ret;
@@ -395,7 +395,7 @@
 }
 
 static inline long
-get_tv32(struct timeval *o, struct compat_timeval *i)
+get_tv32(struct timeval *o, struct compat_timeval __user *i)
 {
 	int err = -EFAULT; 
 	if (access_ok(VERIFY_READ, i, sizeof(*i))) { 
@@ -406,7 +406,7 @@
 }
 
 static inline long
-put_tv32(struct compat_timeval *o, struct timeval *i)
+put_tv32(struct compat_timeval __user *o, struct timeval *i)
 {
 	int err = -EFAULT;
 	if (access_ok(VERIFY_WRITE, o, sizeof(*o))) { 
@@ -442,7 +442,7 @@
 extern struct timezone sys_tz;
 
 asmlinkage long
-sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
+sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
 {
 	if (tv) {
 		struct timeval ktv;
@@ -458,7 +458,7 @@
 }
 
 asmlinkage long
-sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
+sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
 {
 	struct timeval ktv;
 	struct timespec kts;
@@ -493,14 +493,14 @@
 };
 
 struct getdents32_callback {
-	struct linux32_dirent * current_dir;
-	struct linux32_dirent * previous;
+	struct linux32_dirent __user * current_dir;
+	struct linux32_dirent __user * previous;
 	int count;
 	int error;
 };
 
 struct readdir32_callback {
-	struct old_linux32_dirent * dirent;
+	struct old_linux32_dirent __user * dirent;
 	int count;
 };
 
@@ -508,7 +508,7 @@
 filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
 	   unsigned int d_type)
 {
-	struct linux32_dirent * dirent;
+	struct linux32_dirent __user * dirent;
 	struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2, 4);
 
@@ -524,18 +524,18 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	put_user(d_type, (char *)dirent + reclen - 1); 
-	dirent = ((void *)dirent) + reclen;
+	put_user(d_type, (char __user *)dirent + reclen - 1); 
+	dirent = ((void __user *)dirent) + reclen;
 	buf->current_dir = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
 asmlinkage long
-sys32_getdents (unsigned int fd, void * dirent, unsigned int count)
+sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
 {
 	struct file * file;
-	struct linux32_dirent * lastdirent;
+	struct linux32_dirent __user * lastdirent;
 	struct getdents32_callback buf;
 	int error;
 
@@ -544,7 +544,7 @@
 	if (!file)
 		goto out;
 
-	buf.current_dir = (struct linux32_dirent *) dirent;
+	buf.current_dir = (struct linux32_dirent __user *) dirent;
 	buf.previous = NULL;
 	buf.count = count;
 	buf.error = 0;
@@ -569,7 +569,7 @@
 fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, unsigned d_type)
 {
 	struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
-	struct old_linux32_dirent * dirent;
+	struct old_linux32_dirent __user * dirent;
 
 	if (buf->count)
 		return -EINVAL;
@@ -584,7 +584,7 @@
 }
 
 asmlinkage long
-sys32_oldreaddir (unsigned int fd, void * dirent, unsigned int count)
+sys32_oldreaddir (unsigned int fd, void __user * dirent, unsigned int count)
 {
 	int error;
 	struct file * file;
@@ -606,107 +606,6 @@
 	return error;
 }
 
-/*
- * We can actually return ERESTARTSYS instead of EINTR, but I'd
- * like to be certain this leads to no problems. So I return
- * EINTR just for safety.
- *
- * Update: ERESTARTSYS breaks at least the xview clock binary, so
- * I'm trying ERESTARTNOHAND which restart only when you want to.
- */
-#define MAX_SELECT_SECONDS \
-	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-#define ROUND_UP_TIME(x,y) (((x)+(y)-1)/(y))
-
-asmlinkage long
-sys32_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct compat_timeval *tvp32)
-{
-	fd_set_bits fds;
-	char *bits;
-	long timeout;
-	int ret, size;
-
-	timeout = MAX_SCHEDULE_TIMEOUT;
-	if (tvp32) {
-		time_t sec, usec;
-
-		get_user(sec, &tvp32->tv_sec);
-		get_user(usec, &tvp32->tv_usec);
-
-		ret = -EINVAL;
-		if (sec < 0 || usec < 0)
-			goto out_nofds;
-
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
-			timeout = ROUND_UP_TIME(usec, 1000000/HZ);
-			timeout += sec * (unsigned long) HZ;
-		}
-	}
-
-	ret = -EINVAL;
-	if (n < 0)
-		goto out_nofds;
-
-	if (n > current->files->max_fdset)
-		n = current->files->max_fdset;
-
-	/*
-	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
-	 * since we used fdset we need to allocate memory in units of
-	 * long-words. 
-	 */
-	ret = -ENOMEM;
-	size = FDS_BYTES(n);
-	bits = kmalloc(6 * size, GFP_KERNEL);
-	if (!bits)
-		goto out_nofds;
-	fds.in      = (unsigned long *)  bits;
-	fds.out     = (unsigned long *) (bits +   size);
-	fds.ex      = (unsigned long *) (bits + 2*size);
-	fds.res_in  = (unsigned long *) (bits + 3*size);
-	fds.res_out = (unsigned long *) (bits + 4*size);
-	fds.res_ex  = (unsigned long *) (bits + 5*size);
-
-	if ((ret = get_fd_set(n, inp, fds.in)) ||
-	    (ret = get_fd_set(n, outp, fds.out)) ||
-	    (ret = get_fd_set(n, exp, fds.ex)))
-		goto out;
-	zero_fd_set(n, fds.res_in);
-	zero_fd_set(n, fds.res_out);
-	zero_fd_set(n, fds.res_ex);
-
-	ret = do_select(n, &fds, &timeout);
-
-	if (tvp32 && !(current->personality & STICKY_TIMEOUTS)) {
-		time_t sec = 0, usec = 0;
-		if (timeout) {
-			sec = timeout / HZ;
-			usec = timeout % HZ;
-			usec *= (1000000/HZ);
-		}
-		put_user(sec, (int *)&tvp32->tv_sec);
-		put_user(usec, (int *)&tvp32->tv_usec);
-	}
-
-	if (ret < 0)
-		goto out;
-	if (!ret) {
-		ret = -ERESTARTNOHAND;
-		if (signal_pending(current))
-			goto out;
-		ret = 0;
-	}
-
-	set_fd_set(n, inp, fds.res_in);
-	set_fd_set(n, outp, fds.res_out);
-	set_fd_set(n, exp, fds.res_ex);
-
-out:
-	kfree(bits);
-out_nofds:
-	return ret;
-}
-
 struct sel_arg_struct {
 	unsigned int n;
 	unsigned int inp;
@@ -716,112 +615,14 @@
 };
 
 asmlinkage long
-sys32_old_select(struct sel_arg_struct *arg)
+sys32_old_select(struct sel_arg_struct __user *arg)
 {
 	struct sel_arg_struct a;
 
 	if (copy_from_user(&a, arg, sizeof(a)))
 		return -EFAULT;
-	return sys32_select(a.n, (fd_set *)A(a.inp), (fd_set *)A(a.outp), (fd_set *)A(a.exp),
-			    (struct compat_timeval *)A(a.tvp));
-}
-
-static struct iovec *
-get_compat_iovec(struct compat_iovec *iov32, struct iovec *iov_buf, u32 *count, int type, int *errp)
-{
-	int i;
-	u32 buf, len;
-	struct iovec *ivp, *iov;
-	unsigned long totlen; 
-
-	/* Get the "struct iovec" from user memory */
-
-	*errp = 0;
-	if (!*count)
-		return 0;
-	*errp = -EINVAL;
-	if (*count > UIO_MAXIOV)
-		return(struct iovec *)0;
-	*errp = -EFAULT;
-	if(verify_area(VERIFY_READ, iov32, sizeof(struct compat_iovec)*(*count)))
-		return(struct iovec *)0;
-	if (*count > UIO_FASTIOV) {
-		*errp = -ENOMEM; 
-		iov = kmalloc(*count*sizeof(struct iovec), GFP_KERNEL);
-		if (!iov)
-			return((struct iovec *)0);
-	} else
-		iov = iov_buf;
-
-	ivp = iov;
-	totlen = 0;
-	for (i = 0; i < *count; i++) {
-		*errp = __get_user(len, &iov32->iov_len) |
-		  	__get_user(buf, &iov32->iov_base);	
-		if (*errp)
-			goto error;
-		*errp = verify_area(type, (void *)A(buf), len);
-		if (*errp) {
-			if (i > 0) { 
-				*count = i;
-				break;
-			} 
-			goto error;
-		}
-		/* SuS checks: */
-		*errp = -EINVAL; 
-		if ((int)len < 0)
-			goto error;
-		if ((totlen += len) >= 0x7fffffff)
-			goto error;			
-		ivp->iov_base = (void *)A(buf);
-		ivp->iov_len = (__kernel_size_t)len;
-		iov32++;
-		ivp++;
-	}
-	*errp = 0;
-	return(iov);
-
-error:
-	if (iov != iov_buf)
-		kfree(iov);
-	return NULL;
-}
-
-asmlinkage long
-sys32_readv(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-
-	if ((iov = get_compat_iovec(vector, iovstack, &count, VERIFY_WRITE, &ret)) == NULL)
-		return ret;
-	set_fs(KERNEL_DS);
-	ret = sys_readv(fd, iov, count);
-	set_fs(old_fs);
-	if (iov != iovstack)
-		kfree(iov);
-	return ret;
-}
-
-asmlinkage long
-sys32_writev(int fd, struct compat_iovec *vector, u32 count)
-{
-	struct iovec iovstack[UIO_FASTIOV];
-	struct iovec *iov;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-
-	if ((iov = get_compat_iovec(vector, iovstack, &count, VERIFY_READ, &ret)) == NULL)
-		return ret;
-	set_fs(KERNEL_DS);
-	ret = sys_writev(fd, iov, count);
-	set_fs(old_fs);
-	if (iov != iovstack)
-		kfree(iov);
-	return ret;
+	return compat_sys_select(a.n, compat_ptr(a.inp), compat_ptr(a.outp),
+				 compat_ptr(a.exp), compat_ptr(a.tvp));
 }
 
 /*
@@ -829,7 +630,7 @@
  * sys_gettimeofday().  x86-64 did this but i386 Linux did not
  * so we have to implement this system call here.
  */
-asmlinkage long sys32_time(int * tloc)
+asmlinkage long sys32_time(int __user * tloc)
 {
 	int i;
 	struct timeval tv;
@@ -892,7 +693,7 @@
 };
 
 asmlinkage long
-sys32_sysinfo(struct sysinfo32 *info)
+sys32_sysinfo(struct sysinfo32 __user *info)
 {
 	struct sysinfo s;
 	int ret;
@@ -941,7 +742,7 @@
 }
                 
 asmlinkage long
-sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
+sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec __user *interval)
 {
 	struct timespec t;
 	int ret;
@@ -981,8 +782,8 @@
 
 
 asmlinkage long
-sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
-		      struct compat_timespec *uts, compat_size_t sigsetsize)
+sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, siginfo_t32 __user *uinfo,
+		      struct compat_timespec __user *uts, compat_size_t sigsetsize)
 {
 	sigset_t s;
 	compat_sigset_t s32;
@@ -1019,7 +820,7 @@
 }
 
 asmlinkage long
-sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo)
+sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 __user *uinfo)
 {
 	siginfo_t info;
 	int ret;
@@ -1055,7 +856,7 @@
 
 
 asmlinkage long
-sys32_sysctl(struct sysctl_ia32 *args32)
+sys32_sysctl(struct sysctl_ia32 __user *args32)
 {
 #ifndef CONFIG_SYSCTL
 	return -ENOSYS; 
@@ -1105,14 +906,14 @@
 
 /* warning: next two assume little endian */ 
 asmlinkage long
-sys32_pread(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi)
+sys32_pread(unsigned int fd, char __user *ubuf, u32 count, u32 poslo, u32 poshi)
 {
 	return sys_pread64(fd, ubuf, count,
 			 ((loff_t)AA(poshi) << 32) | AA(poslo));
 }
 
 asmlinkage long
-sys32_pwrite(unsigned int fd, char *ubuf, u32 count, u32 poslo, u32 poshi)
+sys32_pwrite(unsigned int fd, char __user *ubuf, u32 count, u32 poslo, u32 poshi)
 {
 	return sys_pwrite64(fd, ubuf, count,
 			  ((loff_t)AA(poshi) << 32) | AA(poslo));
@@ -1133,7 +934,7 @@
 }
 
 asmlinkage long
-sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
+sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -1170,7 +971,7 @@
 extern int do_adjtimex(struct timex *);
 
 asmlinkage long
-sys32_adjtimex(struct timex32 *utp)
+sys32_adjtimex(struct timex32 __user *utp)
 {
 	struct timex txc;
 	int ret;
@@ -1255,7 +1056,7 @@
 	return error;
 }
 
-asmlinkage long sys32_olduname(struct oldold_utsname * name)
+asmlinkage long sys32_olduname(struct oldold_utsname __user * name)
 {
 	int error;
 
@@ -1289,7 +1090,7 @@
 	 return error;
 }
 
-long sys32_uname(struct old_utsname * name)
+long sys32_uname(struct old_utsname __user * name)
 {
 	int err;
 	if (!name)
@@ -1323,98 +1124,27 @@
 	return ret;
 } 
 
-static int nargs(u32 src, char **dst) 
-{ 
-	int cnt;
-	u32 val; 
-
-	cnt = 0; 
-	do { 		
-		int ret = get_user(val, (__u32 *)(u64)src); 
-		if (ret)
-			return ret;
-		if (dst)
-			dst[cnt] = (char *)(u64)val; 
-		cnt++;
-		src += 4; 	
-		if (cnt >= (MAX_ARG_PAGES*PAGE_SIZE)/sizeof(void*))
-			return -E2BIG; 
-	} while(val); 
-	if (dst)
-		dst[cnt-1] = 0; 
-	return cnt; 
-} 
-
-asmlinkage long sys32_execve(char *name, u32 argv, u32 envp, struct pt_regs regs)
-{ 
-	mm_segment_t oldseg; 
-	char **buf = NULL; 
-	int na = 0,ne = 0;
-	int ret;
-	unsigned sz = 0; 
-
-	if (argv) {
-	na = nargs(argv, NULL); 
-	if (na < 0) 
-		return -EFAULT; 
-	} 	
-	if (envp) { 
-	ne = nargs(envp, NULL); 
-	if (ne < 0) 
-		return -EFAULT; 
-	}
-
-	if (argv || envp) { 
-	sz = (na+ne)*sizeof(void *); 
-	if (sz > PAGE_SIZE) 
-		buf = vmalloc(sz); 
-	else
-		buf = kmalloc(sz, GFP_KERNEL); 
-	if (!buf)
-		return -ENOMEM; 
-	} 
-	
-	if (argv) { 
-	ret = nargs(argv, buf);
-	if (ret < 0)
-		goto free;
-	}
-
-	if (envp) { 
-	ret = nargs(envp, buf + na); 
-	if (ret < 0)
-		goto free; 
-	}
-
-	name = getname(name); 
-	ret = PTR_ERR(name); 
-	if (IS_ERR(name))
-		goto free; 
-
-	oldseg = get_fs(); 
-	set_fs(KERNEL_DS);
-	ret = do_execve(name, argv ? buf : NULL, envp ? buf+na : NULL, &regs);  
-	set_fs(oldseg); 
+asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv,
+			     compat_uptr_t __user *envp, struct pt_regs regs)
+{
+	long error;
+	char * filename;
 
-	if (ret == 0)
+	filename = getname(name);
+	error = PTR_ERR(filename);
+	if (IS_ERR(filename))
+		return error;
+	error = compat_do_execve(filename, argv, envp, &regs);
+	if (error == 0)
 		current->ptrace &= ~PT_DTRACE;
-
-	putname(name);
- 
-free:
-	if (argv || envp) { 
-	if (sz > PAGE_SIZE)
-		vfree(buf); 
-	else
-	kfree(buf);
-	}
-	return ret; 
-} 
+	putname(filename);
+	return error;
+}
 
 asmlinkage long sys32_clone(unsigned int clone_flags, unsigned int newsp, struct pt_regs regs)
 {
-	void *parent_tid = (void *)regs.rdx;
-	void *child_tid = (void *)regs.rdi; 
+	void __user *parent_tid = (void __user *)regs.rdx;
+	void __user *child_tid = (void __user *)regs.rdi; 
 	if (!newsp)
 		newsp = regs.rsp;
         return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0, 
@@ -1436,234 +1166,7 @@
 }
  
 
-#if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)
-/* Stuff for NFS server syscalls... */
-struct nfsctl_svc32 {
-	u16			svc32_port;
-	s32			svc32_nthreads;
-};
-
-struct nfsctl_client32 {
-	s8			cl32_ident[NFSCLNT_IDMAX+1];
-	s32			cl32_naddr;
-	struct in_addr		cl32_addrlist[NFSCLNT_ADDRMAX];
-	s32			cl32_fhkeytype;
-	s32			cl32_fhkeylen;
-	u8			cl32_fhkey[NFSCLNT_KEYMAX];
-};
-
-struct nfsctl_export32 {
-	s8			ex32_client[NFSCLNT_IDMAX+1];
-	s8			ex32_path[NFS_MAXPATHLEN+1];
-	compat_dev_t	ex32_dev;
-	compat_ino_t	ex32_ino;
-	s32			ex32_flags;
-	compat_pid_t	ex32_anon_uid;
-	compat_gid_t	ex32_anon_gid;
-};
-
-struct nfsctl_fdparm32 {
-	struct sockaddr		gd32_addr;
-	s8			gd32_path[NFS_MAXPATHLEN+1];
-	s32			gd32_version;
-};
-
-struct nfsctl_fsparm32 {
-	struct sockaddr		gd32_addr;
-	s8			gd32_path[NFS_MAXPATHLEN+1];
-	s32			gd32_maxlen;
-};
-
-struct nfsctl_arg32 {
-	s32			ca32_version;	/* safeguard */
-	union {
-		struct nfsctl_svc32	u32_svc;
-		struct nfsctl_client32	u32_client;
-		struct nfsctl_export32	u32_export;
-		struct nfsctl_fdparm32	u32_getfd;
-		struct nfsctl_fsparm32	u32_getfs;
-	} u;
-#define ca32_svc	u.u32_svc
-#define ca32_client	u.u32_client
-#define ca32_export	u.u32_export
-#define ca32_getfd	u.u32_getfd
-#define ca32_getfs	u.u32_getfs
-};
-
-union nfsctl_res32 {
-	__u8			cr32_getfh[NFS_FHSIZE];
-	struct knfsd_fh		cr32_getfs;
-};
-
-static int nfs_svc32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = get_user(karg->ca_version, &arg32->ca32_version);
-	err |= __get_user(karg->ca_svc.svc_port, &arg32->ca32_svc.svc32_port);
-	err |= __get_user(karg->ca_svc.svc_nthreads, &arg32->ca32_svc.svc32_nthreads);
-	return err;
-}
-
-static int nfs_clnt32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_client.cl_ident[0],
-			  &arg32->ca32_client.cl32_ident[0],
-			  NFSCLNT_IDMAX);
-	err |= __get_user(karg->ca_client.cl_naddr, &arg32->ca32_client.cl32_naddr);
-	err |= copy_from_user(&karg->ca_client.cl_addrlist[0],
-			  &arg32->ca32_client.cl32_addrlist[0],
-			  (sizeof(struct in_addr) * NFSCLNT_ADDRMAX));
-	err |= __get_user(karg->ca_client.cl_fhkeytype,
-		      &arg32->ca32_client.cl32_fhkeytype);
-	err |= __get_user(karg->ca_client.cl_fhkeylen,
-		      &arg32->ca32_client.cl32_fhkeylen);
-	err |= copy_from_user(&karg->ca_client.cl_fhkey[0],
-			  &arg32->ca32_client.cl32_fhkey[0],
-			  NFSCLNT_KEYMAX);
-	return err;
-}
-
-static int nfs_exp32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_export.ex_client[0],
-			  &arg32->ca32_export.ex32_client[0],
-			  NFSCLNT_IDMAX);
-	err |= copy_from_user(&karg->ca_export.ex_path[0],
-			  &arg32->ca32_export.ex32_path[0],
-			  NFS_MAXPATHLEN);
-	err |= __get_user(karg->ca_export.ex_dev,
-		      &arg32->ca32_export.ex32_dev);
-	err |= __get_user(karg->ca_export.ex_ino,
-		      &arg32->ca32_export.ex32_ino);
-	err |= __get_user(karg->ca_export.ex_flags,
-		      &arg32->ca32_export.ex32_flags);
-	err |= __get_user(karg->ca_export.ex_anon_uid,
-		      &arg32->ca32_export.ex32_anon_uid);
-	err |= __get_user(karg->ca_export.ex_anon_gid,
-		      &arg32->ca32_export.ex32_anon_gid);
-	SET_UID(karg->ca_export.ex_anon_uid, karg->ca_export.ex_anon_uid);
-	SET_GID(karg->ca_export.ex_anon_gid, karg->ca_export.ex_anon_gid);
-	return err;
-}
-
-
-static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_getfd.gd_addr,
-			  &arg32->ca32_getfd.gd32_addr,
-			  (sizeof(struct sockaddr)));
-	err |= copy_from_user(&karg->ca_getfd.gd_path,
-			  &arg32->ca32_getfd.gd32_path,
-			  (NFS_MAXPATHLEN+1));
-	err |= get_user(karg->ca_getfd.gd_version,
-		      &arg32->ca32_getfd.gd32_version);
-	return err;
-}
-
-static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
-{
-	int err;
-	
-	err = get_user(karg->ca_version, &arg32->ca32_version);
-	err |= copy_from_user(&karg->ca_getfs.gd_addr,
-			  &arg32->ca32_getfs.gd32_addr,
-			  (sizeof(struct sockaddr)));
-	err |= copy_from_user(&karg->ca_getfs.gd_path,
-			  &arg32->ca32_getfs.gd32_path,
-			  (NFS_MAXPATHLEN+1));
-	err |= get_user(karg->ca_getfs.gd_maxlen,
-		      &arg32->ca32_getfs.gd32_maxlen);
-	return err;
-}
-
-/* This really doesn't need translations, we are only passing
- * back a union which contains opaque nfs file handle data.
- */
-static int nfs_getfh32_res_trans(union nfsctl_res *kres, union nfsctl_res32 *res32)
-{
-	return copy_to_user(res32, kres, sizeof(*res32)) ? -EFAULT : 0;
-}
-
-long asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsctl_res32 *res32)
-{
-	struct nfsctl_arg *karg = NULL;
-	union nfsctl_res *kres = NULL;
-	mm_segment_t oldfs;
-	int err;
-
-	karg = kmalloc(sizeof(*karg), GFP_USER);
-	if(!karg)
-		return -ENOMEM;
-	if(res32) {
-		kres = kmalloc(sizeof(*kres), GFP_USER);
-		if(!kres) {
-			kfree(karg);
-			return -ENOMEM;
-		}
-	}
-	switch(cmd) {
-	case NFSCTL_SVC:
-		err = nfs_svc32_trans(karg, arg32);
-		break;
-	case NFSCTL_ADDCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_DELCLIENT:
-		err = nfs_clnt32_trans(karg, arg32);
-		break;
-	case NFSCTL_EXPORT:
-	case NFSCTL_UNEXPORT:
-		err = nfs_exp32_trans(karg, arg32);
-		break;
-	case NFSCTL_GETFD:
-		err = nfs_getfd32_trans(karg, arg32);
-		break;
-	case NFSCTL_GETFS:
-		err = nfs_getfs32_trans(karg, arg32);
-		break;
-	default:
-		err = -EINVAL;
-		break;
-	}
-	if(err)
-		goto done;
-	oldfs = get_fs();
-	set_fs(KERNEL_DS);
-	err = sys_nfsservctl(cmd, karg, kres);
-	set_fs(oldfs);
-
-	if (err)
-		goto done;
-
-	if((cmd == NFSCTL_GETFD) ||
-	   (cmd == NFSCTL_GETFS))
-		err = nfs_getfh32_res_trans(kres, res32);
-
-done:
-	if(karg)
-		kfree(karg);
-	if(kres)
-		kfree(kres);
-	return err;
-}
-#else /* !NFSD */
-long asmlinkage sys32_nfsservctl(int cmd, void *notused, void *notused2)
-{
-	return sys_ni_syscall();
-}
-#endif
-
-long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p)
+long sys32_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
 { 
 	long ret; 
 	aio_context_t ctx64;
@@ -1678,7 +1181,7 @@
 } 
 
 asmlinkage long sys32_io_submit(aio_context_t ctx_id, int nr,
-		   compat_uptr_t *iocbpp)
+		   compat_uptr_t __user *iocbpp)
 {
 	struct kioctx *ctx;
 	long ret = 0;
@@ -1698,7 +1201,8 @@
 
 	for (i=0; i<nr; i++) {
 		compat_uptr_t p32;
-		struct iocb *user_iocb, tmp;
+		struct iocb __user *user_iocb;
+		struct iocb tmp;
 
 		if (unlikely(__get_user(p32, iocbpp + i))) {
 			ret = -EFAULT;
@@ -1724,8 +1228,8 @@
 asmlinkage long sys32_io_getevents(aio_context_t ctx_id,
 				 unsigned long min_nr,
 				 unsigned long nr,
-				 struct io_event *events,
-				 struct compat_timespec *timeout)
+				 struct io_event __user *events,
+				 struct compat_timespec __user *timeout)
 { 	
 	long ret;
 	mm_segment_t oldfs; 
@@ -1745,7 +1249,7 @@
 	return ret;
 } 
 
-asmlinkage long sys32_open(const char * filename, int flags, int mode)
+asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
 {
 	char * tmp;
 	int fd, error;
@@ -1782,11 +1286,11 @@
 		 timer_t __user * created_timer_id);
 
 long
-sys32_timer_create(u32 clock, struct sigevent32 *se32, timer_t *timer_id)
+sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
 {
 	struct sigevent se;
-       mm_segment_t oldfs;
-       long err;
+	mm_segment_t oldfs;
+	long err;
 
 	if (se32) { 
 		memset(&se, 0, sizeof(struct sigevent)); 
@@ -1800,9 +1304,9 @@
 	if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
 		return -EFAULT;
 
-       oldfs = get_fs();
+	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-       err = sys_timer_create(clock, se32 ? &se : NULL, timer_id);
+	err = sys_timer_create(clock, se32 ? &se : NULL, timer_id);
 	set_fs(oldfs); 
 	
 	return err; 
diff -Nru a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
--- a/arch/x86_64/ia32/syscall32.c	Tue Jun 15 22:20:42 2004
+++ b/arch/x86_64/ia32/syscall32.c	Tue Jun 15 22:20:42 2004
@@ -83,9 +83,9 @@
 
 	/* Load these always in case some future AMD CPU supports
 	   SYSENTER from compat mode too. */
-	wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
-	wrmsr(MSR_IA32_SYSENTER_ESP, 0, 0);
-	wrmsrl(MSR_IA32_SYSENTER_EIP, ia32_sysenter_target);
+	checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
+	checking_wrmsrl(MSR_IA32_SYSENTER_ESP, 0ULL);
+	checking_wrmsrl(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target);
 
 	wrmsrl(MSR_CSTAR, ia32_cstar_target);
 }
diff -Nru a/arch/x86_64/ia32/tls32.c b/arch/x86_64/ia32/tls32.c
--- a/arch/x86_64/ia32/tls32.c	Tue Jun 15 22:20:43 2004
+++ b/arch/x86_64/ia32/tls32.c	Tue Jun 15 22:20:43 2004
@@ -28,7 +28,7 @@
  * Set a given TLS descriptor:
  * When you want addresses > 32bit use arch_prctl() 
  */
-int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info)
+int do_set_thread_area(struct thread_struct *t, struct user_desc __user *u_info)
 {
 	struct user_desc info;
 	struct n_desc_struct *desc;
@@ -75,7 +75,7 @@
 	return 0;
 }
 
-asmlinkage long sys32_set_thread_area(struct user_desc *u_info)
+asmlinkage long sys32_set_thread_area(struct user_desc __user *u_info)
 { 
 	return do_set_thread_area(&current->thread, u_info); 
 } 
@@ -94,7 +94,7 @@
 	((desc)->a & 0x0ffff) | \
 	 ((desc)->b & 0xf0000) )
 	
-#define GET_32BIT(desc)		(((desc)->b >> 23) & 1)
+#define GET_32BIT(desc)		(((desc)->b >> 22) & 1)
 #define GET_CONTENTS(desc)	(((desc)->b >> 10) & 3)
 #define GET_WRITABLE(desc)	(((desc)->b >>  9) & 1)
 #define GET_LIMIT_PAGES(desc)	(((desc)->b >> 23) & 1)
@@ -102,7 +102,7 @@
 #define GET_USEABLE(desc)	(((desc)->b >> 20) & 1)
 #define GET_LONGMODE(desc)	(((desc)->b >> 21) & 1)
 
-int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info)
+int do_get_thread_area(struct thread_struct *t, struct user_desc __user *u_info)
 {
 	struct user_desc info;
 	struct n_desc_struct *desc;
@@ -132,7 +132,7 @@
 	return 0;
 }
 
-asmlinkage long sys32_get_thread_area(struct user_desc *u_info)
+asmlinkage long sys32_get_thread_area(struct user_desc __user *u_info)
 {
 	return do_get_thread_area(&current->thread, u_info);
 } 
@@ -141,10 +141,11 @@
 int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs)
 {
 	struct n_desc_struct *desc;
-	struct user_desc info, *cp;
+	struct user_desc info;
+	struct user_desc __user *cp;
 	int idx;
 	
-	cp = (void *)childregs->rsi;
+	cp = (void __user *)childregs->rsi;
 	if (copy_from_user(&info, cp, sizeof(info)))
 		return -EFAULT;
 	if (LDT_empty(&info))
diff -Nru a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
--- a/arch/x86_64/kernel/Makefile	Tue Jun 15 22:20:43 2004
+++ b/arch/x86_64/kernel/Makefile	Tue Jun 15 22:20:43 2004
@@ -25,6 +25,7 @@
 obj-$(CONFIG_GART_IOMMU)	+= pci-gart.o aperture.o
 obj-$(CONFIG_DUMMY_IOMMU)	+= pci-nommu.o pci-dma.o
 obj-$(CONFIG_SWIOTLB)		+= swiotlb.o
+obj-$(CONFIG_SCHED_SMT)		+= domain.o
 
 obj-$(CONFIG_MODULES)		+= module.o
 
diff -Nru a/arch/x86_64/kernel/Makefile-HEAD b/arch/x86_64/kernel/Makefile-HEAD
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/x86_64/kernel/Makefile-HEAD	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,38 @@
+#
+# Makefile for the linux kernel.
+#
+
+extra-y 	:= head.o head64.o init_task.o vmlinux.lds.s
+EXTRA_AFLAGS	:= -traditional
+obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o \
+		ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_x86_64.o \
+		x8664_ksyms.o i387.o syscall.o vsyscall.o \
+		setup64.o bootflag.o e820.o reboot.o warmreboot.o
+obj-y += mce.o
+
+obj-$(CONFIG_MTRR)		+= ../../i386/kernel/cpu/mtrr/
+obj-$(CONFIG_ACPI_BOOT)		+= acpi/
+obj-$(CONFIG_X86_MSR)		+= msr.o
+obj-$(CONFIG_MICROCODE)		+= microcode.o
+obj-$(CONFIG_X86_CPUID)		+= cpuid.o
+obj-$(CONFIG_SMP)		+= smp.o smpboot.o trampoline.o
+obj-$(CONFIG_X86_LOCAL_APIC)	+= apic.o  nmi.o
+obj-$(CONFIG_X86_IO_APIC)	+= io_apic.o mpparse.o
+obj-$(CONFIG_PM)		+= suspend.o
+obj-$(CONFIG_SOFTWARE_SUSPEND)	+= suspend_asm.o
+obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
+obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
+obj-$(CONFIG_GART_IOMMU)	+= pci-gart.o aperture.o
+obj-$(CONFIG_DUMMY_IOMMU)	+= pci-nommu.o pci-dma.o
+obj-$(CONFIG_SWIOTLB)		+= swiotlb.o
+obj-$(CONFIG_SCHED_SMT)		+= domain.o
+
+obj-$(CONFIG_MODULES)		+= module.o
+
+obj-y				+= topology.o
+
+bootflag-y			+= ../../i386/kernel/bootflag.o
+cpuid-$(subst m,y,$(CONFIG_X86_CPUID))  += ../../i386/kernel/cpuid.o
+topology-y                     += ../../i386/mach-default/topology.o
+swiotlb-$(CONFIG_SWIOTLB)      += ../../ia64/lib/swiotlb.o
+microcode-$(subst m,y,$(CONFIG_MICROCODE))  += ../../i386/kernel/microcode.o
diff -Nru a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c
--- a/arch/x86_64/kernel/acpi/sleep.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/kernel/acpi/sleep.c	Tue Jun 15 22:20:36 2004
@@ -114,7 +114,6 @@
 	acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
 	if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
 		printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
-	printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address);
 }
 
 static int __init acpi_sleep_setup(char *str)
diff -Nru a/arch/x86_64/kernel/domain.c b/arch/x86_64/kernel/domain.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/x86_64/kernel/domain.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,93 @@
+#include <linux/init.h>
+#include <linux/sched.h>
+
+/* Don't do any NUMA setup on Opteron right now. They seem to be
+   better off with flat scheduling. This is just for SMT. */
+
+#ifdef CONFIG_SCHED_SMT
+
+static struct sched_group sched_group_cpus[NR_CPUS];
+static struct sched_group sched_group_phys[NR_CPUS];
+static DEFINE_PER_CPU(struct sched_domain, cpu_domains);
+static DEFINE_PER_CPU(struct sched_domain, phys_domains);
+__init void arch_init_sched_domains(void)
+{
+	int i;
+	struct sched_group *first = NULL, *last = NULL;
+
+	/* Set up domains */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		struct sched_domain *phys_domain = &per_cpu(phys_domains, i);
+
+		*cpu_domain = SD_SIBLING_INIT;
+		/* Disable SMT NICE for CMP */
+		/* RED-PEN use a generic flag */ 
+		if (cpu_data[i].x86_vendor == X86_VENDOR_AMD) 
+			cpu_domain->flags &= ~SD_SHARE_CPUPOWER; 
+		cpu_domain->span = cpu_sibling_map[i];
+		cpu_domain->parent = phys_domain;
+		cpu_domain->groups = &sched_group_cpus[i];
+
+		*phys_domain = SD_CPU_INIT;
+		phys_domain->span = cpu_possible_map;
+		phys_domain->groups = &sched_group_phys[first_cpu(cpu_domain->span)];
+	}
+
+	/* Set up CPU (sibling) groups */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		int j;
+		first = last = NULL;
+
+		if (i != first_cpu(cpu_domain->span))
+			continue;
+
+		for_each_cpu_mask(j, cpu_domain->span) {
+			struct sched_group *cpu = &sched_group_cpus[j];
+
+			cpus_clear(cpu->cpumask);
+			cpu_set(j, cpu->cpumask);
+			cpu->cpu_power = SCHED_LOAD_SCALE;
+
+			if (!first)
+				first = cpu;
+			if (last)
+				last->next = cpu;
+			last = cpu;
+		}
+		last->next = first;
+	}
+
+	first = last = NULL;
+	/* Set up physical groups */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		struct sched_group *cpu = &sched_group_phys[i];
+
+		if (i != first_cpu(cpu_domain->span))
+			continue;
+
+		cpu->cpumask = cpu_domain->span;
+		/*
+		 * Make each extra sibling increase power by 10% of
+		 * the basic CPU. This is very arbitrary.
+		 */
+		cpu->cpu_power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE*(cpus_weight(cpu->cpumask)-1) / 10;
+
+		if (!first)
+			first = cpu;
+		if (last)
+			last->next = cpu;
+		last = cpu;
+	}
+	last->next = first;
+
+	mb();
+	for_each_cpu(i) {
+		struct sched_domain *cpu_domain = &per_cpu(cpu_domains, i);
+		cpu_attach_domain(cpu_domain, i);
+	}
+}
+
+#endif
diff -Nru a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c
--- a/arch/x86_64/kernel/head64.c	Tue Jun 15 22:20:39 2004
+++ b/arch/x86_64/kernel/head64.c	Tue Jun 15 22:20:39 2004
@@ -73,6 +73,8 @@
 	boot_cpu_data.x86_mask = eax & 0xf;
 }
 
+extern char _end[];
+
 void __init x86_64_start_kernel(char * real_mode_data)
 {
 	char *s;
@@ -80,6 +82,9 @@
 	clear_bss();
 	pda_init(0);
 	copy_bootdata(real_mode_data);
+#ifdef CONFIG_SMP
+	cpu_set(0, cpu_online_map);
+#endif
 	/* default console: */
 	if (!strstr(saved_command_line, "console="))
 		strcat(saved_command_line, " console=tty0"); 
@@ -95,6 +100,10 @@
 	if (strstr(saved_command_line, "disableapic"))
 		disable_apic = 1;
 #endif
+	/* You need early console to see that */
+	if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE)
+		panic("Kernel too big for kernel mapping\n");
+
 	setup_boot_cpu_data();
 	start_kernel();
 }
diff -Nru a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c
--- a/arch/x86_64/kernel/i387.c	Tue Jun 15 22:20:38 2004
+++ b/arch/x86_64/kernel/i387.c	Tue Jun 15 22:20:38 2004
@@ -77,7 +77,7 @@
  * Signal frame handlers.
  */
 
-int save_i387(struct _fpstate *buf)
+int save_i387(struct _fpstate __user *buf)
 {
 	struct task_struct *tsk = current;
 	int err = 0;
@@ -95,7 +95,7 @@
 		return 0;
 	tsk->used_math = 0; /* trigger finit */ 
 	if (tsk->thread_info->status & TS_USEDFPU) {
-		err = save_i387_checking((struct i387_fxsave_struct *)buf);
+		err = save_i387_checking((struct i387_fxsave_struct __user *)buf);
 		if (err) return err;
 		stts();
 		} else {
@@ -110,14 +110,14 @@
  * ptrace request handlers.
  */
 
-int get_fpregs(struct user_i387_struct *buf, struct task_struct *tsk)
+int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *tsk)
 {
 	init_fpu(tsk);
-	return __copy_to_user((void *)buf, &tsk->thread.i387.fxsave,
+	return __copy_to_user(buf, &tsk->thread.i387.fxsave,
 			       sizeof(struct user_i387_struct)) ? -EFAULT : 0;
 }
 
-int set_fpregs(struct task_struct *tsk, struct user_i387_struct *buf)
+int set_fpregs(struct task_struct *tsk, struct user_i387_struct __user *buf)
 {
 	if (__copy_from_user(&tsk->thread.i387.fxsave, buf, 
 			     sizeof(struct user_i387_struct)))
diff -Nru a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
--- a/arch/x86_64/kernel/io_apic.c	Tue Jun 15 22:20:40 2004
+++ b/arch/x86_64/kernel/io_apic.c	Tue Jun 15 22:20:40 2004
@@ -237,6 +237,7 @@
 			for (func = 0; func < 8; func++) { 
 				u32 class;
 				u32 vendor;
+				u8 type;
 				class = read_pci_config(num,slot,func,
 							PCI_CLASS_REVISION);
 				if (class == 0xffffffff)
@@ -251,14 +252,15 @@
 				switch (vendor) { 
 				case PCI_VENDOR_ID_VIA:
 #ifdef CONFIG_GART_IOMMU
-					if (end_pfn >= (0xffffffff>>PAGE_SHIFT) &&
+					if ((end_pfn >= (0xffffffff>>PAGE_SHIFT) ||
+					     force_iommu) &&
 					    !iommu_aperture_allowed) {
 						printk(KERN_INFO
     "Looks like a VIA chipset. Disabling IOMMU. Overwrite with \"iommu=allowed\"\n");
 						iommu_aperture_disabled = 1;
 					}
 #endif
-					/* FALL THROUGH */
+					return;
 				case PCI_VENDOR_ID_NVIDIA:
 #ifndef CONFIG_SMP
 					printk(KERN_INFO 
@@ -270,8 +272,8 @@
 				} 
 
 				/* No multi-function device? */
-				u8 type = read_pci_config_byte(num,slot,func,
-							       PCI_HEADER_TYPE);
+				type = read_pci_config_byte(num,slot,func,
+							    PCI_HEADER_TYPE);
 				if (!(type & 0x80))
 					break;
 			} 
diff -Nru a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
--- a/arch/x86_64/kernel/irq.c	Tue Jun 15 22:20:39 2004
+++ b/arch/x86_64/kernel/irq.c	Tue Jun 15 22:20:39 2004
@@ -833,7 +833,8 @@
 	return len;
 }
 
-static int irq_affinity_write_proc (struct file *file, const char *buffer,
+static int irq_affinity_write_proc (struct file *file,
+					const char __user *buffer,
 					unsigned long count, void *data)
 {
 	int irq = (long) data, full_count = count, err;
@@ -871,7 +872,8 @@
 	return len;
 }
 
-static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
+static int prof_cpu_mask_write_proc (struct file *file,
+					const char __user *buffer,
 					unsigned long count, void *data)
 {
 	unsigned long full_count = count, err;
diff -Nru a/arch/x86_64/kernel/ldt.c b/arch/x86_64/kernel/ldt.c
--- a/arch/x86_64/kernel/ldt.c	Tue Jun 15 22:21:02 2004
+++ b/arch/x86_64/kernel/ldt.c	Tue Jun 15 22:21:02 2004
@@ -125,7 +125,7 @@
 	}
 }
 
-static int read_ldt(void * ptr, unsigned long bytecount)
+static int read_ldt(void __user * ptr, unsigned long bytecount)
 {
 	int err;
 	unsigned long size;
@@ -153,7 +153,7 @@
 	return bytecount;
 }
 
-static int read_default_ldt(void * ptr, unsigned long bytecount)
+static int read_default_ldt(void __user * ptr, unsigned long bytecount)
 {
 	/* Arbitrary number */ 
 	/* x86-64 default LDT is all zeros */
@@ -164,7 +164,7 @@
 	return bytecount; 
 }
 
-static int write_ldt(void * ptr, unsigned long bytecount, int oldmode)
+static int write_ldt(void __user * ptr, unsigned long bytecount, int oldmode)
 {
 	struct task_struct *me = current;
 	struct mm_struct * mm = me->mm;
@@ -225,7 +225,7 @@
 	return error;
 }
 
-asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount)
+asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
 {
 	int ret = -ENOSYS;
 
diff -Nru a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
--- a/arch/x86_64/kernel/mce.c	Tue Jun 15 22:20:38 2004
+++ b/arch/x86_64/kernel/mce.c	Tue Jun 15 22:20:38 2004
@@ -25,8 +25,9 @@
 #define NR_BANKS 5
 
 static int mce_disabled __initdata;
-/* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic */ 
-static int tolerant = 2;
+/* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic,
+   3: never panic or exit (for testing only) */
+static int tolerant = 1;
 static int banks;
 static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL };
 
@@ -96,7 +97,8 @@
 	int i;
 	oops_begin();
 	for (i = 0; i < MCE_LOG_LEN; i++) {
-		if (mcelog.entry[i].tsc < start)
+		unsigned long tsc = mcelog.entry[i].tsc;
+		if (time_before(tsc, start))
 			continue;
 		print_mce(&mcelog.entry[i]); 
 		if (mcelog.entry[i].tsc == backup->tsc)
@@ -104,7 +106,10 @@
 	}
 	if (backup)
 		print_mce(backup);
-	panic(msg);
+	if (tolerant >= 3)
+		printk("Fake panic: %s\n", msg);
+	else
+		panic(msg);
 } 
 
 static int mce_available(struct cpuinfo_x86 *c)
@@ -120,8 +125,8 @@
 
 void do_machine_check(struct pt_regs * regs, long error_code)
 {
-	struct mce m;
-	int nowayout = 0;
+	struct mce m, panicm;
+	int nowayout = (tolerant < 1); 
 	int kill_it = 0;
 	u64 mcestart;
 	int i;
@@ -149,13 +154,31 @@
 	for (i = 0; i < banks; i++) {
 		if (!bank[i])
 			continue;
+		
+		m.misc = 0; 
+		m.addr = 0;
 
 		rdmsrl(MSR_IA32_MC0_STATUS + i*4, m.status);
 		if ((m.status & MCI_STATUS_VAL) == 0)
 			continue;
+		/* Should be implied by the banks check above, but
+		   check it anyways */
+		if ((m.status & MCI_STATUS_EN) == 0)
+			continue;
 
-		nowayout |= (tolerant < 1); 
-		nowayout |= !!(m.status & (MCI_STATUS_OVER|MCI_STATUS_PCC));
+		/* Did this bank cause the exception? */
+		/* Assume that the bank with uncorrectable errors did it,
+		   and that there is only a single one. */
+		if (m.status & MCI_STATUS_UC) {
+			panicm = m;
+		} else {
+			m.rip = 0;
+			m.cs = 0;
+		}
+
+		/* In theory _OVER could be a nowayout too, but
+		   assume any overflowed errors were no fatal. */
+		nowayout |= !!(m.status & MCI_STATUS_PCC);
 		kill_it |= !!(m.status & MCI_STATUS_UC);
 		m.bank = i;
 
@@ -176,7 +199,10 @@
 	if (nowayout)
 		mce_panic("Machine check", &m, mcestart);
 	if (kill_it) {
-		int user_space = (m.rip && (m.cs & 3));
+		int user_space = 0;
+
+		if (m.mcgstatus & MCG_STATUS_RIPV)
+			user_space = m.rip && (m.cs & 3);
 		
 		/* When the machine was in user space and the CPU didn't get
 		   confused it's normally not necessary to panic, unless you 
@@ -187,11 +213,12 @@
 		   it is best to just halt the machine. */
 		if ((!user_space && (panic_on_oops || tolerant < 2)) ||
 		    (unsigned)current->pid <= 1)
-			mce_panic("Uncorrected machine check", &m, mcestart);
+			mce_panic("Uncorrected machine check", &panicm, mcestart);
 
 		/* do_exit takes an awful lot of locks and has as slight risk 
 		   of deadlocking. If you don't want that don't set tolerant >= 2 */
-		do_exit(SIGBUS);
+		if (tolerant < 3)
+			do_exit(SIGBUS);
 	}
 }
 
@@ -207,7 +234,7 @@
  * Periodic polling timer for "silent" machine check errors.
  */
 
-static int check_interval = 3600; /* one hour */
+static int check_interval = 5 * 60; /* 5 minutes */
 static void mcheck_timer(void *data);
 static DECLARE_WORK(mcheck_work, mcheck_timer, NULL);
 
@@ -297,12 +324,12 @@
 	rdtscll(cpu_tsc[smp_processor_id()]);
 } 
 
-static ssize_t mce_read(struct file *filp, char *ubuf, size_t usize, loff_t *off)
+static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff_t *off)
 {
 	unsigned long cpu_tsc[NR_CPUS];
 	static DECLARE_MUTEX(mce_read_sem);
 	unsigned next;
-	char *buf = ubuf;
+	char __user *buf = ubuf;
 	int i, err;
 
 	down(&mce_read_sem); 
@@ -348,19 +375,20 @@
 
 static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd, unsigned long arg)
 {
+	int __user *p = (int __user *)arg;
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM; 
 	switch (cmd) {
 	case MCE_GET_RECORD_LEN: 
-		return put_user(sizeof(struct mce), (int *)arg);
+		return put_user(sizeof(struct mce), p);
 	case MCE_GET_LOG_LEN:
-		return put_user(MCE_LOG_LEN, (int *)arg);		
+		return put_user(MCE_LOG_LEN, p);		
 	case MCE_GETCLEAR_FLAGS: {
 		unsigned flags;
 		do { 
 			flags = mcelog.flags;
 		} while (cmpxchg(&mcelog.flags, flags, 0) != flags); 
-		return put_user(flags, (int *)arg); 
+		return put_user(flags, p); 
 	}
 	default:
 		return -ENOTTY; 
diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
--- a/arch/x86_64/kernel/mpparse.c	Tue Jun 15 22:20:38 2004
+++ b/arch/x86_64/kernel/mpparse.c	Tue Jun 15 22:20:38 2004
@@ -575,6 +575,7 @@
 	extern void __bad_mpf_size(void); 
 	unsigned int *bp = phys_to_virt(base);
 	struct intel_mp_floating *mpf;
+	static int printed __initdata; 
 
 	Dprintk("Scan SMP from %p for %ld bytes.\n", bp,length);
 	if (sizeof(*mpf) != 16)
@@ -598,7 +599,10 @@
 		bp += 4;
 		length -= 16;
 	}
-	printk(KERN_INFO "No mptable found.\n");
+	if (!printed) {		
+		printk(KERN_INFO "No mptable found.\n");
+		printed = 1;
+	}
 	return 0;
 }
 
@@ -920,8 +924,11 @@
 		}
 
 		/* Don't set up the ACPI SCI because it's already set up */
-		if (acpi_fadt.sci_int == gsi)
+		if (acpi_fadt.sci_int == gsi) {
+			/* we still need to set up the entry's irq */
+			acpi_gsi_to_irq(gsi, &entry->irq);
 			continue;
+		}
 
 		ioapic = mp_find_ioapic(gsi);
 		if (ioapic < 0)
diff -Nru a/arch/x86_64/kernel/msr.c b/arch/x86_64/kernel/msr.c
--- a/arch/x86_64/kernel/msr.c	Tue Jun 15 22:20:37 2004
+++ b/arch/x86_64/kernel/msr.c	Tue Jun 15 22:20:37 2004
@@ -1,4 +1,3 @@
-#ident "$Id$"
 /* ----------------------------------------------------------------------- *
  *   
  *   Copyright 2000 H. Peter Anvin - All Rights Reserved
@@ -187,10 +186,10 @@
   return ret;
 }
 
-static ssize_t msr_read(struct file * file, char * buf,
+static ssize_t msr_read(struct file * file, char __user * buf,
 			size_t count, loff_t *ppos)
 {
-  u32 *tmp = (u32 *)buf;
+  char __user *tmp = buf;
   u32 data[2];
   size_t rv;
   u32 reg = *ppos;
@@ -206,16 +205,16 @@
       return err;
     if ( copy_to_user(tmp,&data,8) )
       return -EFAULT;
-    tmp += 2;
+    tmp += 8;
   }
 
-  return ((char *)tmp) - buf;
+  return tmp - buf;
 }
 
-static ssize_t msr_write(struct file * file, const char * buf,
+static ssize_t msr_write(struct file * file, const char __user * buf,
 			 size_t count, loff_t *ppos)
 {
-  const u32 *tmp = (const u32 *)buf;
+  const char __user *tmp = buf;
   u32 data[2];
   size_t rv;
   u32 reg = *ppos;
@@ -231,10 +230,10 @@
     err = do_wrmsr(cpu, reg, data[0], data[1]);
     if ( err )
       return err;
-    tmp += 2;
+    tmp += 8;
   }
 
-  return ((char *)tmp) - buf;
+  return tmp - buf;
 }
 
 static int msr_open(struct inode *inode, struct file *file)
@@ -242,7 +241,7 @@
   int cpu = iminor(file->f_dentry->d_inode);
   struct cpuinfo_x86 *c = &(cpu_data)[cpu];
   
-  if (!cpu_online(cpu))
+  if (cpu >= NR_CPUS || !cpu_online(cpu))
     return -ENXIO;		/* No such CPU */
   if ( !cpu_has(c, X86_FEATURE_MSR) )
     return -EIO;		/* MSR not supported */
diff -Nru a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
--- a/arch/x86_64/kernel/pci-gart.c	Tue Jun 15 22:20:39 2004
+++ b/arch/x86_64/kernel/pci-gart.c	Tue Jun 15 22:20:39 2004
@@ -30,7 +30,6 @@
 #include <asm/proto.h>
 #include <asm/cacheflush.h>
 #include <asm/kdebug.h>
-#include <asm/proto.h>
 
 #ifdef CONFIG_PREEMPT
 #define preempt_atomic() in_atomic()
diff -Nru a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
--- a/arch/x86_64/kernel/process.c	Tue Jun 15 22:20:41 2004
+++ b/arch/x86_64/kernel/process.c	Tue Jun 15 22:20:41 2004
@@ -521,7 +521,8 @@
  * sys_execve() executes a new program.
  */
 asmlinkage 
-long sys_execve(char *name, char **argv,char **envp, struct pt_regs regs)
+long sys_execve(char __user *name, char __user * __user *argv,
+		char __user * __user *envp, struct pt_regs regs)
 {
 	long error;
 	char * filename;
@@ -550,7 +551,7 @@
 	return do_fork(SIGCHLD, regs.rsp, &regs, 0, NULL, NULL);
 }
 
-asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void *parent_tid, void *child_tid, struct pt_regs regs)
+asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid, struct pt_regs regs)
 {
 	if (!newsp)
 		newsp = regs.rsp;
@@ -574,12 +575,6 @@
 		    NULL, NULL);
 }
 
-/*
- * These bracket the sleeping functions..
- */
-#define first_sched	((unsigned long) scheduling_functions_start_here)
-#define last_sched	((unsigned long) scheduling_functions_end_here)
-
 unsigned long get_wchan(struct task_struct *p)
 {
 	unsigned long stack;
@@ -596,14 +591,12 @@
 		if (fp < (unsigned long)stack || fp > (unsigned long)stack+THREAD_SIZE)
 			return 0; 
 		rip = *(u64 *)(fp+8); 
-		if (rip < first_sched || rip >= last_sched)
+		if (!in_sched_functions(rip))
 			return rip; 
 		fp = *(u64 *)fp; 
 	} while (count++ < 16); 
 	return 0;
 }
-#undef last_sched
-#undef first_sched
 
 long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
 { 
@@ -672,7 +665,7 @@
 			rdmsrl(MSR_FS_BASE, base);
 		} else
 			base = task->thread.fs;
-		ret = put_user(base, (unsigned long *)addr); 
+		ret = put_user(base, (unsigned long __user *)addr); 
 		break; 
 	}
 	case ARCH_GET_GS: { 
@@ -683,7 +676,7 @@
 			rdmsrl(MSR_KERNEL_GS_BASE, base);
 		} else
 			base = task->thread.gs;
-		ret = put_user(base, (unsigned long *)addr); 
+		ret = put_user(base, (unsigned long __user *)addr); 
 		break;
 	}
 
diff -Nru a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
--- a/arch/x86_64/kernel/ptrace.c	Tue Jun 15 22:20:38 2004
+++ b/arch/x86_64/kernel/ptrace.c	Tue Jun 15 22:20:38 2004
@@ -232,7 +232,7 @@
 		ret = -EIO;
 		if (copied != sizeof(tmp))
 			break;
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp,(unsigned long __user *) data);
 		break;
 	}
 
@@ -271,7 +271,7 @@
 			tmp = 0;
 			break;
 		}
-		ret = put_user(tmp,(unsigned long *) data);
+		ret = put_user(tmp,(unsigned long __user *) data);
 		break;
 	}
 
@@ -360,19 +360,20 @@
 		   don't use it against 64bit processes, use
 		   PTRACE_ARCH_PRCTL instead. */
 	case PTRACE_SET_THREAD_AREA: {
+		struct user_desc __user *p;
 		int old; 
-		get_user(old,  &((struct user_desc *)data)->entry_number); 
-		put_user(addr, &((struct user_desc *)data)->entry_number);
-		ret = do_set_thread_area(&child->thread, 
-					 (struct user_desc *)data);
-		put_user(old,  &((struct user_desc *)data)->entry_number); 
+		p = (struct user_desc __user *)data;
+		get_user(old,  &p->entry_number); 
+		put_user(addr, &p->entry_number);
+		ret = do_set_thread_area(&child->thread, p);
+		put_user(old,  &p->entry_number); 
 		break;
 	case PTRACE_GET_THREAD_AREA:
-		get_user(old,  &((struct user_desc *)data)->entry_number); 
-		put_user(addr, &((struct user_desc *)data)->entry_number);
-		ret = do_get_thread_area(&child->thread, 
-					 (struct user_desc *)data);
-		put_user(old,  &((struct user_desc *)data)->entry_number); 
+		p = (struct user_desc __user *)data;
+		get_user(old,  &p->entry_number); 
+		put_user(addr, &p->entry_number);
+		ret = do_get_thread_area(&child->thread, p);
+		put_user(old,  &p->entry_number); 
 		break;
 	} 
 #endif
@@ -428,12 +429,12 @@
 		break;
 
 	case PTRACE_GETREGS: { /* Get all gp regs from the child. */
-	  	if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE)) {
+	  	if (!access_ok(VERIFY_WRITE, (unsigned __user *)data, FRAME_SIZE)) {
 			ret = -EIO;
 			break;
 		}
 		for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) {
-			__put_user(getreg(child, ui),(unsigned long *) data);
+			__put_user(getreg(child, ui),(unsigned long __user *) data);
 			data += sizeof(long);
 		}
 		ret = 0;
@@ -442,12 +443,12 @@
 
 	case PTRACE_SETREGS: { /* Set all gp regs in the child. */
 		unsigned long tmp;
-	  	if (!access_ok(VERIFY_READ, (unsigned *)data, FRAME_SIZE)) {
+	  	if (!access_ok(VERIFY_READ, (unsigned __user *)data, FRAME_SIZE)) {
 			ret = -EIO;
 			break;
 		}
 		for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) {
-			__get_user(tmp, (unsigned long *) data);
+			__get_user(tmp, (unsigned long __user *) data);
 			putreg(child, ui, tmp);
 			data += sizeof(long);
 		}
@@ -456,23 +457,23 @@
 	}
 
 	case PTRACE_GETFPREGS: { /* Get the child extended FPU state. */
-		if (!access_ok(VERIFY_WRITE, (unsigned *)data,
+		if (!access_ok(VERIFY_WRITE, (unsigned __user *)data,
 			       sizeof(struct user_i387_struct))) {
 			ret = -EIO;
 			break;
 		}
-		ret = get_fpregs((struct user_i387_struct *)data, child);
+		ret = get_fpregs((struct user_i387_struct __user *)data, child);
 		break;
 	}
 
 	case PTRACE_SETFPREGS: { /* Set the child extended FPU state. */
-		if (!access_ok(VERIFY_READ, (unsigned *)data,
+		if (!access_ok(VERIFY_READ, (unsigned __user *)data,
 			       sizeof(struct user_i387_struct))) {
 			ret = -EIO;
 			break;
 		}
 		child->used_math = 1;
-		ret = set_fpregs(child, (struct user_i387_struct *)data);
+		ret = set_fpregs(child, (struct user_i387_struct __user *)data);
 		break;
 	}
 
diff -Nru a/arch/x86_64/kernel/reboot.c b/arch/x86_64/kernel/reboot.c
--- a/arch/x86_64/kernel/reboot.c	Tue Jun 15 22:20:44 2004
+++ b/arch/x86_64/kernel/reboot.c	Tue Jun 15 22:20:44 2004
@@ -29,9 +29,9 @@
 static int reboot_mode = 0;
 
 /* reboot=b[ios] | t[riple] | k[bd] [, [w]arm | [c]old]
-   bios	  Use the CPU reboto vector for warm reset
+   bios	  Use the CPU reboot vector for warm reset
    warm   Don't set the cold reboot flag
-   cold   Set the cold reboto flag
+   cold   Set the cold reboot flag
    triple Force a triple fault (init)
    kbd    Use the keyboard controller. cold reset (default)
  */ 
diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
--- a/arch/x86_64/kernel/setup.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/kernel/setup.c	Tue Jun 15 22:20:36 2004
@@ -253,6 +253,8 @@
 		/* acpi=ht just means: do ACPI MADT parsing 
 		   at bootup, but don't enable the full ACPI interpreter */
 		if (!memcmp(from, "acpi=ht", 7)) { 
+			/* if (!acpi_force) */
+				disable_acpi();
 			acpi_ht = 1; 
 		}
                 else if (!memcmp(from, "pci=noacpi", 10)) 
@@ -535,8 +537,7 @@
         * the bootmem allocator) but before get_smp_config (to allow parsing
         * of MADT).
         */
-	if (!acpi_disabled)
-		acpi_boot_init();
+	acpi_boot_init();
 #endif
 #ifdef CONFIG_X86_LOCAL_APIC
 	/*
@@ -663,7 +664,7 @@
 	return r;
 }
 
-static void __init detect_ht(void)
+static void __init detect_ht(struct cpuinfo_x86 *c)
 {
 #ifdef CONFIG_SMP
 	u32 	eax, ebx, ecx, edx;
@@ -671,6 +672,9 @@
 	int	initial_apic_id;
 	int 	cpu = smp_processor_id();
 	
+	if (!cpu_has(c, X86_FEATURE_HT))
+		return;
+
 	cpuid(1, &eax, &ebx, &ecx, &edx);
 	smp_num_siblings = (ebx & 0xff0000) >> 16;
 	
@@ -768,7 +772,6 @@
 	unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; 
 	unsigned n;
 
-	select_idle_routine(c);
 	if (c->cpuid_level > 1) {
 		/* supports eax=2  call */
 		int i, j, n;
@@ -837,9 +840,6 @@
 		c->x86_cache_size = l2 ? l2 : (l1i+l1d);
 	}
 
-	if (cpu_has(c, X86_FEATURE_HT))
-		detect_ht(); 
-
 	n = cpuid_eax(0x80000000);
 	if (n >= 0x80000008) {
 		unsigned eax = cpuid_eax(0x80000008);
@@ -910,7 +910,7 @@
 			c->x86_model += ((tfms >> 16) & 0xF) << 4;
 		} 
 		if (c->x86_capability[0] & (1<<19)) 
-       		c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
+			c->x86_clflush_size = ((misc >> 8) & 0xff) * 8;
 	} else {
 		/* Have CPUID level 0 only - unheard of */
 		c->x86 = 4;
@@ -968,7 +968,10 @@
 			display_cacheinfo(c);
 			break;
 	}
-	
+
+	select_idle_routine(c);
+	detect_ht(c); 
+		
 	/*
 	 * On SMP, boot_cpu_data holds the common feature set between
 	 * all CPUs; so make sure that we indicate which features are
diff -Nru a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
--- a/arch/x86_64/kernel/setup64.c	Tue Jun 15 22:20:38 2004
+++ b/arch/x86_64/kernel/setup64.c	Tue Jun 15 22:20:38 2004
@@ -39,7 +39,7 @@
 extern struct desc_ptr cpu_gdt_descr[];
 struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 
 
-char boot_cpu_stack[IRQSTACKSIZE] __cacheline_aligned;
+char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
 
 unsigned long __supported_pte_mask = ~0UL;
 static int do_not_nx __initdata = 0;
@@ -190,7 +190,8 @@
 	pda->irqstackptr += IRQSTACKSIZE-64;
 } 
 
-char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ];
+char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ] 
+__attribute__((section(".bss.page_aligned")));
 
 void __init syscall_init(void)
 {
diff -Nru a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c
--- a/arch/x86_64/kernel/signal.c	Tue Jun 15 22:20:42 2004
+++ b/arch/x86_64/kernel/signal.c	Tue Jun 15 22:20:42 2004
@@ -40,7 +40,7 @@
             sigset_t *set, struct pt_regs * regs); 
 
 asmlinkage long
-sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs regs)
+sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs regs)
 {
 	sigset_t saveset, newset;
 
@@ -57,7 +57,7 @@
 	current->blocked = newset;
 	recalc_sigpending();
 	spin_unlock_irq(&current->sighand->siglock);
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("rt_sigsuspend savset(%lx) newset(%lx) regs(%p) rip(%lx)\n",
 		saveset, newset, &regs, regs.rip);
 #endif 
@@ -71,7 +71,7 @@
 }
 
 asmlinkage long
-sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs regs)
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, struct pt_regs regs)
 {
 	return do_sigaltstack(uss, uoss, regs.rsp);
 }
@@ -89,7 +89,7 @@
 };
 
 static int
-restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, unsigned long *prax)
+restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned long *prax)
 {
 	unsigned int err = 0;
 
@@ -117,7 +117,7 @@
 	}
 
 	{
-		struct _fpstate * buf;
+		struct _fpstate __user * buf;
 		err |= __get_user(buf, &sc->fpstate);
 
 		if (buf) {
@@ -136,11 +136,11 @@
 
 asmlinkage long sys_rt_sigreturn(struct pt_regs regs)
 {
-	struct rt_sigframe *frame = (struct rt_sigframe *)(regs.rsp - 8);
+	struct rt_sigframe __user *frame;
 	sigset_t set;
-	stack_t st;
 	long eax;
 
+	frame = (struct rt_sigframe __user *)(regs.rsp - 8);
 	if (verify_area(VERIFY_READ, frame, sizeof(*frame))) { 
 		goto badframe;
 	} 
@@ -158,16 +158,12 @@
 		goto badframe;
 	} 
 
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("%d sigreturn rip:%lx rsp:%lx frame:%p rax:%lx\n",current->pid,regs.rip,regs.rsp,frame,eax);
 #endif
 
-	if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) {
+	if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs.rsp) == -EFAULT)
 		goto badframe;
-	} 
-	/* It is more difficult to avoid calling this function than to
-	   call it and ignore errors.  */
-	do_sigaltstack(&st, NULL, regs.rsp);
 
 	return eax;
 
@@ -181,7 +177,7 @@
  */
 
 static inline int
-setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me)
+setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me)
 {
 	int err = 0;
 
@@ -218,7 +214,7 @@
  * Determine which stack to use..
  */
 
-static void *
+static void __user *
 get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
 {
 	unsigned long rsp;
@@ -233,20 +229,20 @@
 			rsp = current->sas_ss_sp + current->sas_ss_size;
 	}
 
-	return (void *)round_down(rsp - size, 16); 
+	return (void __user *)round_down(rsp - size, 16); 
 }
 
 static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 			   sigset_t *set, struct pt_regs * regs)
 {
-	struct rt_sigframe *frame;
-	struct _fpstate *fp = NULL; 
+	struct rt_sigframe __user *frame;
+	struct _fpstate __user *fp = NULL; 
 	int err = 0;
 	struct task_struct *me = current;
 
 	if (me->used_math) {
 		fp = get_stack(ka, regs, sizeof(struct _fpstate)); 
-		frame = (void *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8;
+		frame = (void __user *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8;
 
 		if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) { 
 		goto give_sigsegv;
@@ -299,7 +295,7 @@
 		goto give_sigsegv;
 	} 
 
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("%d old rip %lx old rsp %lx old rax %lx\n", current->pid,regs->rip,regs->rsp,regs->rax);
 #endif
 
@@ -324,7 +320,7 @@
 	set_fs(USER_DS);
 	regs->eflags &= ~TF_MASK;
 
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
 		current->comm, current->pid, frame, regs->rip, frame->pretcode);
 #endif
@@ -347,7 +343,7 @@
 {
 	struct k_sigaction *ka = &current->sighand->action[sig-1];
 
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("handle_signal pid:%d sig:%lu rip:%lx rsp:%lx regs=%p\n", current->pid, sig, 
 		regs->rip, regs->rsp, regs);
 #endif
@@ -459,7 +455,7 @@
 
 void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_flags)
 {
-#if DEBUG_SIG
+#ifdef DEBUG_SIG
 	printk("do_notify_resume flags:%x rip:%lx rsp:%lx caller:%lx pending:%lx\n",
 	       thread_info_flags, regs->rip, regs->rsp, __builtin_return_address(0),signal_pending(current)); 
 #endif
@@ -475,7 +471,7 @@
 		do_signal(regs,oldset);
 }
 
-void signal_fault(struct pt_regs *regs, void *frame, char *where)
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
 { 
 	struct task_struct *me = current; 
 	if (exception_trace)
diff -Nru a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
--- a/arch/x86_64/kernel/smp.c	Tue Jun 15 22:20:38 2004
+++ b/arch/x86_64/kernel/smp.c	Tue Jun 15 22:20:38 2004
@@ -404,6 +404,9 @@
 	if (!cpus)
 		return 0;
 
+	/* Can deadlock when called with interrupts disabled */
+	WARN_ON(irqs_disabled());
+
 	data.func = func;
 	data.info = info;
 	atomic_set(&data.started, 0);
diff -Nru a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
--- a/arch/x86_64/kernel/smpboot.c	Tue Jun 15 22:21:05 2004
+++ b/arch/x86_64/kernel/smpboot.c	Tue Jun 15 22:21:05 2004
@@ -73,7 +73,7 @@
 /* Set when the idlers are all forked */
 int smp_threads_ready;
 
-char cpu_sibling_map[NR_CPUS] __cacheline_aligned;
+cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned;
 
 /*
  * Trampoline 80x86 program as an array.
@@ -874,31 +874,38 @@
 	}
 
 	/*
-	 * If Hyper-Threading is avaialble, construct cpu_sibling_map[], so
-	 * that we can tell the sibling CPU efficiently.
+	 * Construct cpu_sibling_map[], so that we can tell the
+	 * sibling CPU efficiently.
 	 */
-	if (cpu_has_ht && smp_num_siblings > 1) {
-		for (cpu = 0; cpu < NR_CPUS; cpu++)
-			cpu_sibling_map[cpu] = NO_PROC_ID;
-		
-		for (cpu = 0; cpu < NR_CPUS; cpu++) {
-			int 	i;
-			if (!cpu_isset(cpu, cpu_callout_map))
-				continue;
+	for (cpu = 0; cpu < NR_CPUS; cpu++)
+		cpus_clear(cpu_sibling_map[cpu]);
+
+	for (cpu = 0; cpu < NR_CPUS; cpu++) {
+		int siblings = 0;
+		int i;
+		if (!cpu_isset(cpu, cpu_callout_map))
+			continue;
 
+		if (smp_num_siblings > 1) {
 			for (i = 0; i < NR_CPUS; i++) {
-				if (i == cpu || !cpu_isset(i, cpu_callout_map))
+				if (!cpu_isset(i, cpu_callout_map))
 					continue;
 				if (phys_proc_id[cpu] == phys_proc_id[i]) {
-					cpu_sibling_map[cpu] = i;
-					break;
+					siblings++;
+					cpu_set(i, cpu_sibling_map[cpu]);
 				}
 			}
-			if (cpu_sibling_map[cpu] == (char)NO_PROC_ID) {
-				smp_num_siblings = 1;
-				printk(KERN_WARNING "WARNING: No sibling found for CPU %d.\n", cpu);
-			}
+		} else { 
+			siblings++;
+			cpu_set(cpu, cpu_sibling_map[cpu]);
 		}
+
+		if (siblings != smp_num_siblings) {
+			printk(KERN_WARNING 
+	       "WARNING: %d siblings found for CPU%d, should be %d\n", 
+			       siblings, cpu, smp_num_siblings);
+			smp_num_siblings = siblings;
+		}       
 	}
 
 	Dprintk("Boot done.\n");
diff -Nru a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c
--- a/arch/x86_64/kernel/sys_x86_64.c	Tue Jun 15 22:20:42 2004
+++ b/arch/x86_64/kernel/sys_x86_64.c	Tue Jun 15 22:20:42 2004
@@ -25,7 +25,7 @@
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way Unix traditionally does this, though.
  */
-asmlinkage long sys_pipe(int *fildes)
+asmlinkage long sys_pipe(int __user *fildes)
 {
 	int fd[2];
 	int error;
@@ -142,7 +142,7 @@
 	}
 }
 
-asmlinkage long sys_uname(struct new_utsname * name)
+asmlinkage long sys_uname(struct new_utsname __user * name)
 {
 	int err;
 	down_read(&uts_sem);
@@ -153,13 +153,13 @@
 	return err ? -EFAULT : 0;
 }
 
-asmlinkage long wrap_sys_shmat(int shmid, char *shmaddr, int shmflg)
+asmlinkage long wrap_sys_shmat(int shmid, char __user *shmaddr, int shmflg)
 {
 	unsigned long raddr;
 	return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr;
 }
 
-asmlinkage long sys_time64(long * tloc)
+asmlinkage long sys_time64(long __user * tloc)
 {
 	struct timeval now; 
 	int i; 
diff -Nru a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
--- a/arch/x86_64/kernel/time.c	Tue Jun 15 22:20:42 2004
+++ b/arch/x86_64/kernel/time.c	Tue Jun 15 22:20:42 2004
@@ -27,6 +27,7 @@
 #include <linux/sysdev.h>
 #include <linux/bcd.h>
 #include <linux/kallsyms.h>
+#include <asm/8253pit.h>
 #include <asm/pgtable.h>
 #include <asm/vsyscall.h>
 #include <asm/timex.h>
@@ -54,7 +55,7 @@
 unsigned int cpu_khz;					/* TSC clocks / usec, not used here */
 unsigned long hpet_period;				/* fsecs / HPET clock */
 unsigned long hpet_tick;				/* HPET clocks / interrupt */
-unsigned long vxtime_hz = 1193182;
+unsigned long vxtime_hz = PIT_TICK_RATE;
 int report_lost_ticks;				/* command line option */
 unsigned long long monotonic_base;
 
@@ -531,7 +532,8 @@
 		cpu_khz_ref = cpu_khz;
 	}
         if ((val == CPUFREQ_PRECHANGE  && freq->old < freq->new) ||
-            (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
+            (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
+	    (val == CPUFREQ_RESUMECHANGE)) {
                 *lpj =
 		cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);
 
@@ -600,8 +602,8 @@
 	outb((inb(0x61) & ~0x02) | 0x01, 0x61);
 
 	outb(0xb0, 0x43);
-	outb((1193182 / (1000 / 50)) & 0xff, 0x42);
-	outb((1193182 / (1000 / 50)) >> 8, 0x42);
+	outb((PIT_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
+	outb((PIT_TICK_RATE / (1000 / 50)) >> 8, 0x42);
 	rdtscll(start);
 	sync_core();
 	while ((inb(0x61) & 0x20) == 0);
diff -Nru a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
--- a/arch/x86_64/kernel/traps.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/kernel/traps.c	Tue Jun 15 22:20:36 2004
@@ -256,8 +256,8 @@
 
 	printk("CPU %d ", cpu);
 	__show_regs(regs);
-	printk("Process %s (pid: %d, stackpage=%08lx)\n",
-		cur->comm, cur->pid, 4096+(unsigned long)cur);
+	printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
+		cur->comm, cur->pid, cur->thread_info, cur);
 
 	/*
 	 * When in-kernel, we also print out the stack and code at the
@@ -302,7 +302,7 @@
 	if (__get_user(tmp, f.filename))
 		f.filename = "unmapped filename"; 
 	printk("----------- [cut here ] --------- [please bite here ] ---------\n");
-	printk("Kernel BUG at %.50s:%d\n", f.filename, f.line); 	
+	printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", f.filename, f.line);
 } 
 
 void out_of_line_bug(void)
@@ -356,7 +356,7 @@
 	notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
 	show_registers(regs);
 	/* Executive summary in case the oops scrolled away */
-	printk("RIP "); 
+	printk(KERN_ALERT "RIP ");
 	printk_address(regs->rip); 
 	printk(" RSP <%016lx>\n", regs->rsp); 
 }
diff -Nru a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
--- a/arch/x86_64/kernel/vmlinux.lds.S	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/kernel/vmlinux.lds.S	Tue Jun 15 22:20:36 2004
@@ -39,6 +39,7 @@
 
   __bss_start = .;		/* BSS */
   .bss : {
+	*(.bss.page_aligned)	
 	*(.bss)
 	}
   __bss_end = .;
@@ -75,8 +76,8 @@
   . = ALIGN(8192);		/* init_task */
   .data.init_task : { *(.data.init_task) }
 
-  . = ALIGN(4096); 
-  .data.boot_pgt : { *(.data.boot_pgt) }
+  . = ALIGN(4096);
+  .data.page_aligned : { *(.data.page_aligned) }
 
   . = ALIGN(4096);		/* Init code and data */
   __init_begin = .;
diff -Nru a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
--- a/arch/x86_64/kernel/x8664_ksyms.c	Tue Jun 15 22:20:37 2004
+++ b/arch/x86_64/kernel/x8664_ksyms.c	Tue Jun 15 22:20:37 2004
@@ -151,6 +151,7 @@
 #undef strcmp 
 #undef strcpy 
 #undef strcat
+#undef memcmp
 
 extern void * memset(void *,int,__kernel_size_t);
 extern size_t strlen(const char *);
@@ -161,6 +162,7 @@
 extern void * memcpy(void *,const void *,__kernel_size_t);
 extern void * __memcpy(void *,const void *,__kernel_size_t);
 extern char * strcat(char *, const char *);
+extern int memcmp(const void * cs,const void * ct,size_t count);
 
 EXPORT_SYMBOL_NOVERS(memset);
 EXPORT_SYMBOL_NOVERS(strlen);
@@ -178,6 +180,7 @@
 EXPORT_SYMBOL_NOVERS(memscan);
 EXPORT_SYMBOL_NOVERS(memcpy);
 EXPORT_SYMBOL_NOVERS(__memcpy);
+EXPORT_SYMBOL_NOVERS(memcmp);
 
 /* syscall export needed for misdesigned sound drivers. */
 EXPORT_SYMBOL(sys_read);
@@ -216,6 +219,3 @@
 #endif
 
 EXPORT_SYMBOL(sys_ioctl);
-
-EXPORT_SYMBOL(memcpy_toio);
-EXPORT_SYMBOL(memcpy_fromio);
diff -Nru a/arch/x86_64/lib/Makefile b/arch/x86_64/lib/Makefile
--- a/arch/x86_64/lib/Makefile	Tue Jun 15 22:20:37 2004
+++ b/arch/x86_64/lib/Makefile	Tue Jun 15 22:20:37 2004
@@ -4,9 +4,11 @@
 
 CFLAGS_csum-partial.o := -funroll-loops
 
+obj-y := io.o
+
 lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \
 	usercopy.o getuser.o putuser.o  \
-	thunk.o io.o clear_page.o copy_page.o bitstr.o
+	thunk.o clear_page.o copy_page.o bitstr.o
 lib-y += memcpy.o memmove.o memset.o copy_user.o
 
 lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o
diff -Nru a/arch/x86_64/lib/csum-wrappers.c b/arch/x86_64/lib/csum-wrappers.c
--- a/arch/x86_64/lib/csum-wrappers.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/lib/csum-wrappers.c	Tue Jun 15 22:20:36 2004
@@ -19,7 +19,7 @@
  * src and dst are best aligned to 64bits. 
  */ 
 unsigned int 
-csum_partial_copy_from_user(const char *src, char *dst, 
+csum_partial_copy_from_user(const char __user *src, char *dst, 
 			    int len, unsigned int isum, int *errp)
 { 
 	*errp = 0;
@@ -33,7 +33,7 @@
 		if (unlikely((unsigned long)src & 6)) {			
 			while (((unsigned long)src & 6) && len >= 2) { 
 				__u16 val16;			
-				*errp = __get_user(val16, (__u16 *)src); 
+				*errp = __get_user(val16, (__u16 __user *)src); 
 				if (*errp)
 					return isum;
 				*(__u16 *)dst = val16;
@@ -43,7 +43,7 @@
 				len -= 2;
 			}
 		}
-		isum = csum_partial_copy_generic(src,dst,len,isum,errp,NULL);
+		isum = csum_partial_copy_generic((void *)src,dst,len,isum,errp,NULL);
 		if (likely(*errp == 0)) 
 			return isum;
 	} 
@@ -66,7 +66,7 @@
  * src and dst are best aligned to 64bits.
  */ 
 unsigned int 
-csum_partial_copy_to_user(const char *src, char *dst, 
+csum_partial_copy_to_user(const char *src, char __user *dst, 
 			  int len, unsigned int isum, int *errp)
 { 
 	if (unlikely(!access_ok(VERIFY_WRITE, dst, len))) {
@@ -78,7 +78,7 @@
 		while (((unsigned long)dst & 6) && len >= 2) { 
 			__u16 val16 = *(__u16 *)src;
 			isum = add32_with_carry(isum, val16);
-			*errp = __put_user(val16, (__u16 *)dst);
+			*errp = __put_user(val16, (__u16 __user *)dst);
 			if (*errp)
 				return isum;
 			src += 2; 
@@ -88,7 +88,7 @@
 	}
 
 	*errp = 0;
-	return csum_partial_copy_generic(src,dst,len,isum,NULL,errp); 
+	return csum_partial_copy_generic(src, (void *)dst,len,isum,NULL,errp); 
 } 
 
 EXPORT_SYMBOL(csum_partial_copy_to_user);
diff -Nru a/arch/x86_64/lib/io.c b/arch/x86_64/lib/io.c
--- a/arch/x86_64/lib/io.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/lib/io.c	Tue Jun 15 22:20:36 2004
@@ -2,12 +2,14 @@
 #include <asm/io.h>
 #include <linux/module.h>
 
-void *memcpy_toio(void *dst,const void*src,unsigned len)
+void *__memcpy_toio(unsigned long dst,const void*src,unsigned len)
 {
-	return __inline_memcpy(dst,src,len);
+	return __inline_memcpy((void *) dst,src,len);
 }
+EXPORT_SYMBOL(__memcpy_toio);
 
-void *memcpy_fromio(void *dst,const void*src,unsigned len)
+void *__memcpy_fromio(void *dst,unsigned long src,unsigned len)
 {
-	return __inline_memcpy(dst,src,len);
+	return __inline_memcpy(dst,(const void *) src,len);
 }
+EXPORT_SYMBOL(__memcpy_fromio);
diff -Nru a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c
--- a/arch/x86_64/lib/usercopy.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/lib/usercopy.c	Tue Jun 15 22:20:36 2004
@@ -40,7 +40,7 @@
 } while (0)
 
 long
-__strncpy_from_user(char *dst, const char *src, long count)
+__strncpy_from_user(char *dst, const char __user *src, long count)
 {
 	long res;
 	__do_strncpy_from_user(dst, src, count, res);
@@ -48,7 +48,7 @@
 }
 
 long
-strncpy_from_user(char *dst, const char *src, long count)
+strncpy_from_user(char *dst, const char __user *src, long count)
 {
 	long res = -EFAULT;
 	if (access_ok(VERIFY_READ, src, 1))
@@ -60,7 +60,7 @@
  * Zero Userspace
  */
 
-unsigned long __clear_user(void *addr, unsigned long size)
+unsigned long __clear_user(void __user *addr, unsigned long size)
 {
 	long __d0;
 	/* no memory constraint because it doesn't change any memory gcc knows
@@ -94,7 +94,7 @@
 }
 
 
-unsigned long clear_user(void *to, unsigned long n)
+unsigned long clear_user(void __user *to, unsigned long n)
 {
 	if (access_ok(VERIFY_WRITE, to, n))
 		return __clear_user(to, n);
@@ -107,7 +107,7 @@
  * Return 0 on exception, a value greater than N if too long
  */
 
-long strnlen_user(const char *s, long n)
+long strnlen_user(const char __user *s, long n)
 {
 	long res = 0;
 	char c;
@@ -127,7 +127,7 @@
 	}
 }
 
-long strlen_user(const char *s)
+long strlen_user(const char __user *s)
 {
 	long res = 0;
 	char c;
@@ -142,10 +142,10 @@
 	}
 }
 
-unsigned long copy_in_user(void *to, const void *from, unsigned len)
+unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len)
 {
 	if (access_ok(VERIFY_WRITE, to, len) && access_ok(VERIFY_READ, from, len)) { 
-		return copy_user_generic(to, from, len);
+		return copy_user_generic((void *)to, (void *)from, len);
 	} 
 	return len;		
 }
diff -Nru a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
--- a/arch/x86_64/mm/fault.c	Tue Jun 15 22:20:36 2004
+++ b/arch/x86_64/mm/fault.c	Tue Jun 15 22:20:36 2004
@@ -211,7 +211,8 @@
 int unhandled_signal(struct task_struct *tsk, int sig)
 {
 	/* Warn for strace, but not for gdb */
-	if ((tsk->ptrace & (PT_PTRACED|PT_TRACESYSGOOD)) == PT_PTRACED)
+	if (!test_ti_thread_flag(tsk->thread_info, TIF_SYSCALL_TRACE) &&
+	    (tsk->ptrace & PT_PTRACED))
 		return 0;
 	return (tsk->sighand->action[sig-1].sa.sa_handler == SIG_IGN) ||
 		(tsk->sighand->action[sig-1].sa.sa_handler == SIG_DFL);
@@ -374,7 +375,7 @@
 		    (address >> 32))
 			return;
 
-		if (exception_trace && !unhandled_signal(tsk, SIGSEGV)) { 
+		if (exception_trace && unhandled_signal(tsk, SIGSEGV)) {
 		printk(KERN_INFO 
 		       "%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n",
 					tsk->comm, tsk->pid, address, regs->rip,
@@ -423,8 +424,9 @@
 		printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
 	else
 		printk(KERN_ALERT "Unable to handle kernel paging request");
-	printk(" at %016lx RIP: \n",address);	
+	printk(" at %016lx RIP: \n" KERN_ALERT,address);
 	printk_address(regs->rip);
+	printk("\n");
 	dump_pagetable(address);
 	__die("Oops", regs, error_code);
 	/* Executive summary in case the body of the oops scrolled away */
diff -Nru a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
--- a/arch/x86_64/mm/init.c	Tue Jun 15 22:20:37 2004
+++ b/arch/x86_64/mm/init.c	Tue Jun 15 22:20:37 2004
@@ -512,9 +512,7 @@
 	/* Should check here against the e820 map to avoid double free */ 
 #ifdef CONFIG_DISCONTIGMEM
 	int nid = phys_to_nid(phys);
-	if (phys < HIGH_MEMORY && nid) 
-		panic("reserve of %lx at node %d", phys, nid);
-	reserve_bootmem_node(NODE_DATA(nid), phys, len);
+  	reserve_bootmem_node(NODE_DATA(nid), phys, len);
 #else       		
 	reserve_bootmem(phys, len);    
 #endif
diff -Nru a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c
--- a/arch/x86_64/mm/ioremap.c	Tue Jun 15 22:21:03 2004
+++ b/arch/x86_64/mm/ioremap.c	Tue Jun 15 22:21:03 2004
@@ -132,13 +132,13 @@
 	 * Don't allow anybody to remap normal RAM that we're using..
 	 */
 	if (phys_addr < virt_to_phys(high_memory)) {
+#ifndef CONFIG_DISCONTIGMEM
 		char *t_addr, *t_end;
+ 		struct page *page;
 
 		t_addr = __va(phys_addr);
 		t_end = t_addr + (size - 1);
 	   
-#ifndef CONFIG_DISCONTIGMEM	 
- 		struct page *page;
 		for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
 			if(!PageReserved(page))
 				return NULL;
@@ -158,6 +158,7 @@
 	area = get_vm_area(size, VM_IOREMAP);
 	if (!area)
 		return NULL;
+	area->phys_addr = phys_addr;
 	addr = area->addr;
 	if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) {
 		vunmap(addr);
diff -Nru a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
--- a/arch/x86_64/mm/numa.c	Tue Jun 15 22:20:44 2004
+++ b/arch/x86_64/mm/numa.c	Tue Jun 15 22:20:44 2004
@@ -124,7 +124,7 @@
 	start_pfn = node_start_pfn(nodeid);
 	end_pfn = node_end_pfn(nodeid);
 
-	printk(KERN_INFO "setting up node %d %lx-%lx\n", nodeid, start_pfn, end_pfn); 
+	Dprintk(KERN_INFO "setting up node %d %lx-%lx\n", nodeid, start_pfn, end_pfn);
 	
 	/* All nodes > 0 have a zero length zone DMA */ 
 	dma_end_pfn = __pa(MAX_DMA_ADDRESS) >> PAGE_SHIFT; 
diff -Nru a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
--- a/arch/x86_64/mm/pageattr.c	Tue Jun 15 22:20:40 2004
+++ b/arch/x86_64/mm/pageattr.c	Tue Jun 15 22:20:40 2004
@@ -32,7 +32,8 @@
 	return pte;
 } 
 
-static struct page *split_large_page(unsigned long address, pgprot_t prot)
+static struct page *split_large_page(unsigned long address, pgprot_t prot,
+				     pgprot_t ref_prot)
 { 
 	int i; 
 	unsigned long addr;
@@ -45,7 +46,7 @@
 	pbase = (pte_t *)page_address(base);
 	for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) {
 		pbase[i] = pfn_pte(addr >> PAGE_SHIFT, 
-				   addr == address ? prot : PAGE_KERNEL);
+				   addr == address ? prot : ref_prot);
 	}
 	return base;
 } 
@@ -95,7 +96,7 @@
  * No more special protections in this 2/4MB area - revert to a
  * large page again. 
  */
-static void revert_page(struct page *kpte_page, unsigned long address)
+static void revert_page(unsigned long address, pgprot_t ref_prot)
 {
        pgd_t *pgd;
        pmd_t *pmd; 
@@ -104,12 +105,14 @@
        pgd = pgd_offset_k(address); 
        pmd = pmd_offset(pgd, address);
        BUG_ON(pmd_val(*pmd) & _PAGE_PSE); 
-       large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, PAGE_KERNEL_LARGE);
+       pgprot_val(ref_prot) |= _PAGE_PSE;
+       large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, ref_prot);
        set_pte((pte_t *)pmd, large_pte);
 }      
 
 static int
-__change_page_attr(unsigned long address, struct page *page, pgprot_t prot)
+__change_page_attr(unsigned long address, struct page *page, pgprot_t prot, 
+		   pgprot_t ref_prot)
 { 
 	pte_t *kpte; 
 	struct page *kpte_page;
@@ -119,29 +122,29 @@
 	if (!kpte) return 0;
 	kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK);
 	kpte_flags = pte_val(*kpte); 
-	if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) { 
+	if (pgprot_val(prot) != pgprot_val(ref_prot)) { 
 		if ((kpte_flags & _PAGE_PSE) == 0) { 
 			pte_t old = *kpte;
-			pte_t standard = mk_pte(page, PAGE_KERNEL); 
+			pte_t standard = mk_pte(page, ref_prot); 
 
 			set_pte(kpte, mk_pte(page, prot)); 
 			if (pte_same(old,standard))
-				atomic_inc(&kpte_page->count);
+				get_page(kpte_page);
 		} else {
-			struct page *split = split_large_page(address, prot); 
+			struct page *split = split_large_page(address, prot, ref_prot); 
 			if (!split)
 				return -ENOMEM;
-			atomic_inc(&kpte_page->count);
-			set_pte(kpte,mk_pte(split, PAGE_KERNEL));
+			get_page(kpte_page);
+			set_pte(kpte,mk_pte(split, ref_prot));
 		}	
 	} else if ((kpte_flags & _PAGE_PSE) == 0) { 
-		set_pte(kpte, mk_pte(page, PAGE_KERNEL));
-		atomic_dec(&kpte_page->count); 
+		set_pte(kpte, mk_pte(page, ref_prot));
+		__put_page(kpte_page);
 	}
 
-	if (atomic_read(&kpte_page->count) == 1) { 
+	if (page_count(kpte_page) == 1) {
 		save_page(address, kpte_page); 		     
-		revert_page(kpte_page, address);
+		revert_page(address, ref_prot);
 	} 
 	return 0;
 } 
@@ -167,13 +170,17 @@
 	down_write(&init_mm.mmap_sem);
 	for (i = 0; i < numpages; !err && i++, page++) { 
 		unsigned long address = (unsigned long)page_address(page); 
-		err = __change_page_attr(address, page, prot); 
+		err = __change_page_attr(address, page, prot, PAGE_KERNEL); 
 		if (err) 
 			break; 
-		/* Handle kernel mapping too which aliases part of the lowmem */
-		if (page_to_phys(page) < KERNEL_TEXT_SIZE) {		
-			unsigned long addr2 = __START_KERNEL_map + page_to_phys(page);
-			err = __change_page_attr(addr2, page, prot);
+		/* Handle kernel mapping too which aliases part of the
+		 * lowmem */
+		/* Disabled right now. Fixme */ 
+		if (0 && page_to_phys(page) < KERNEL_TEXT_SIZE) {		
+			unsigned long addr2;
+			addr2 = __START_KERNEL_map + page_to_phys(page);
+			err = __change_page_attr(addr2, page, prot, 
+						 PAGE_KERNEL_EXECUTABLE);
 		} 
 	} 	
 	up_write(&init_mm.mmap_sem); 
diff -Nru a/crypto/cipher.c b/crypto/cipher.c
--- a/crypto/cipher.c	Tue Jun 15 22:20:40 2004
+++ b/crypto/cipher.c	Tue Jun 15 22:20:40 2004
@@ -68,19 +68,20 @@
 
 	for(;;) {
 		u8 *src_p, *dst_p;
+		int in_place;
 
 		scatterwalk_map(&walk_in, 0);
 		scatterwalk_map(&walk_out, 1);
 		src_p = scatterwalk_whichbuf(&walk_in, bsize, tmp_src);
 		dst_p = scatterwalk_whichbuf(&walk_out, bsize, tmp_dst);
+		in_place = scatterwalk_samebuf(&walk_in, &walk_out,
+					       src_p, dst_p);
 
 		nbytes -= bsize;
 
 		scatterwalk_copychunks(src_p, &walk_in, bsize, 0);
 
-		prfn(tfm, dst_p, src_p, crfn, enc, info,
-		     scatterwalk_samebuf(&walk_in, &walk_out,
-					 src_p, dst_p));
+		prfn(tfm, dst_p, src_p, crfn, enc, info, in_place);
 
 		scatterwalk_done(&walk_in, 0, nbytes);
 
diff -Nru a/crypto/digest.c b/crypto/digest.c
--- a/crypto/digest.c	Tue Jun 15 22:20:36 2004
+++ b/crypto/digest.c	Tue Jun 15 22:20:36 2004
@@ -27,13 +27,28 @@
                    struct scatterlist *sg, unsigned int nsg)
 {
 	unsigned int i;
-	
+
 	for (i = 0; i < nsg; i++) {
-		char *p = crypto_kmap(sg[i].page, 0) + sg[i].offset;
-		tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm),
-		                                      p, sg[i].length);
-		crypto_kunmap(p, 0);
-		crypto_yield(tfm);
+
+		struct page *pg = sg[i].page;
+		unsigned int offset = sg[i].offset;
+		unsigned int l = sg[i].length;
+
+		do {
+			unsigned int bytes_from_page = min(l, ((unsigned int)
+							   (PAGE_SIZE)) - 
+							   offset);
+			char *p = crypto_kmap(pg, 0) + offset;
+
+			tfm->__crt_alg->cra_digest.dia_update
+					(crypto_tfm_ctx(tfm), p,
+					 bytes_from_page);
+			crypto_kunmap(p, 0);
+			crypto_yield(tfm);
+			offset = 0;
+			pg++;
+			l -= bytes_from_page;
+		} while (l > 0);
 	}
 }
 
diff -Nru a/crypto/scatterwalk.h b/crypto/scatterwalk.h
--- a/crypto/scatterwalk.h	Tue Jun 15 22:21:03 2004
+++ b/crypto/scatterwalk.h	Tue Jun 15 22:21:03 2004
@@ -38,6 +38,7 @@
 				      void *src_p, void *dst_p)
 {
 	return walk_in->page == walk_out->page &&
+	       walk_in->offset == walk_out->offset &&
 	       walk_in->data == src_p && walk_out->data == dst_p;
 }
 
diff -Nru a/drivers/acpi/ac.c b/drivers/acpi/ac.c
--- a/drivers/acpi/ac.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/ac.c	Tue Jun 15 22:20:39 2004
@@ -185,6 +185,9 @@
 	ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_AC_FILE_STATE,
+				  acpi_device_dir(device));
+
 		remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/acpi_ksyms.c b/drivers/acpi/acpi_ksyms.c
--- a/drivers/acpi/acpi_ksyms.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/acpi_ksyms.c	Tue Jun 15 22:20:39 2004
@@ -106,7 +106,7 @@
 EXPORT_SYMBOL(acpi_os_create_semaphore);
 EXPORT_SYMBOL(acpi_os_delete_semaphore);
 EXPORT_SYMBOL(acpi_os_wait_semaphore);
-
+EXPORT_SYMBOL(acpi_os_wait_events_complete);
 EXPORT_SYMBOL(acpi_os_read_pci_configuration);
 
 /* ACPI Utilities (acpi_utils.c) */
diff -Nru a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
--- a/drivers/acpi/asus_acpi.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/acpi/asus_acpi.c	Tue Jun 15 22:20:38 2004
@@ -40,6 +40,7 @@
 #include <linux/proc_fs.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_bus.h>
+#include <asm/uaccess.h>
 
 #define ASUS_ACPI_VERSION "0.28"
 
@@ -480,16 +481,31 @@
 	return (hotk->status & ledmask) ? 1 : 0;
 }
 
+static int parse_arg(const char __user *buf, unsigned long count, int *val)
+{
+	char s[32];
+	if (!count)
+		return 0;
+	if (count > 31)
+		return -EINVAL;
+	if (copy_from_user(s, buf, count))
+		return -EFAULT;
+	s[count] = 0;
+	if (sscanf(s, "%i", val) != 1)
+		return -EINVAL;
+	return count;
+}
 
 /* FIXME: kill extraneous args so it can be called independently */
 static int
-write_led(const char *buffer, unsigned long count, struct asus_hotk *hotk, 
+write_led(const char __user *buffer, unsigned long count, struct asus_hotk *hotk, 
           char *ledname, int ledmask, int invert)
 {
 	int value;
 	int led_out = 0;
 
-	if (sscanf(buffer, "%i", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		led_out = value ? 1 : 0;
 
 	hotk->status =
@@ -518,7 +534,7 @@
 
 
 static int
-proc_write_mled(struct file *file, const char *buffer,
+proc_write_mled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -537,7 +553,7 @@
 }
 
 static int
-proc_write_wled(struct file *file, const char *buffer,
+proc_write_wled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -556,7 +572,7 @@
 }
 
 static int
-proc_write_tled(struct file *file, const char *buffer,
+proc_write_tled(struct file *file, const char __user *buffer,
 		unsigned long count, void *data)
 {
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
@@ -640,13 +656,14 @@
 
 
 static int
-proc_write_lcd(struct file *file, const char *buffer,
+proc_write_lcd(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 	
-	if (sscanf(buffer, "%i", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		set_lcd_state(hotk, value);
 	return count;
 }
@@ -707,17 +724,18 @@
 }
 
 static int
-proc_write_brn(struct file *file, const char *buffer,
+proc_write_brn(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 
-	if (sscanf(buffer, "%d", &value) == 1) {
+	count = parse_arg(buffer, count, &value);
+	if (count > 0) {
 		value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
 			/* 0 <= value <= 15 */
 		set_brightness(value, hotk);
-	} else {
+	} else if (count < 0) {
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
 	}
 
@@ -756,17 +774,17 @@
  * simultaneously, so be warned. See the acpi4asus README for more info.
  */
 static int
-proc_write_disp(struct file *file, const char *buffer,
+proc_write_disp(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	int value;
 	struct asus_hotk *hotk = (struct asus_hotk *) data;
 
-	if (sscanf(buffer, "%d", &value) == 1)
+	count = parse_arg(buffer, count, &value);
+	if (count > 0)
 		set_display(value, hotk);
-	else {
+	else if (count < 0)
 		printk(KERN_WARNING "Asus ACPI: Error reading user input\n");
-	}
 
 	return count;
 }
@@ -774,7 +792,7 @@
 
 typedef int (proc_readfunc)(char *page, char **start, off_t off, int count,
 	                     int *eof, void *data);
-typedef int (proc_writefunc)(struct file *file, const char *buffer,
+typedef int (proc_writefunc)(struct file *file, const char __user *buffer,
 	                      unsigned long count, void *data);
 
 static int
@@ -863,6 +881,29 @@
 	return 0;
 }
 
+static int asus_hotk_remove_fs(struct acpi_device* device)
+{
+	struct asus_hotk* hotk = acpi_driver_data(device);
+
+
+	if(acpi_device_dir(device)){
+		remove_proc_entry(PROC_INFO,acpi_device_dir(device));
+		if (hotk->methods->mt_wled)
+			remove_proc_entry(PROC_WLED,acpi_device_dir(device));
+		if (hotk->methods->mt_mled)
+			remove_proc_entry(PROC_MLED,acpi_device_dir(device));
+		if (hotk->methods->mt_tled)
+			remove_proc_entry(PROC_TLED,acpi_device_dir(device));
+		if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) 
+			remove_proc_entry(PROC_LCD, acpi_device_dir(device));
+		if ((hotk->methods->brightness_up && hotk->methods->brightness_down) || (hotk->methods->brightness_get && hotk->methods->brightness_get)) 
+			remove_proc_entry(PROC_BRN, acpi_device_dir(device));
+		if (hotk->methods->display_set) 
+			remove_proc_entry(PROC_DISP, acpi_device_dir(device));
+	}
+	return 0;
+}
+
 
 static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
 {
@@ -1111,7 +1152,6 @@
 	return(result);
 }
 
-
 static int asus_hotk_remove(struct acpi_device *device, int type)
 {
 	acpi_status status = 0;
@@ -1126,6 +1166,8 @@
 					    asus_hotk_notify);
 	if (ACPI_FAILURE(status))
 		printk(KERN_ERR "Asus ACPI: Error removing notify handler\n");
+
+	asus_hotk_remove_fs(device);
 
 	kfree(hotk);
 
diff -Nru a/drivers/acpi/battery.c b/drivers/acpi/battery.c
--- a/drivers/acpi/battery.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/acpi/battery.c	Tue Jun 15 22:20:43 2004
@@ -582,7 +582,7 @@
 static int
 acpi_battery_write_alarm (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	unsigned long		count,
 	void			*data)
 {
@@ -679,6 +679,13 @@
 	ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_BATTERY_FILE_ALARM,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_BATTERY_FILE_STATUS,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_BATTERY_FILE_INFO,
+				  acpi_device_dir(device));
+
 		remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/bus.c b/drivers/acpi/bus.c
--- a/drivers/acpi/bus.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/bus.c	Tue Jun 15 22:20:41 2004
@@ -112,6 +112,14 @@
 	else
 		STRUCT_TO_INT(device->status) = 0x0F;
 
+	if (device->status.functional && !device->status.present) {
+		printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
+			"functional but not present; setting present\n",
+			device->pnp.bus_id,
+			(u32) STRUCT_TO_INT(device->status));
+		device->status.present = 1;
+	}
+
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n", 
 		device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
 
diff -Nru a/drivers/acpi/button.c b/drivers/acpi/button.c
--- a/drivers/acpi/button.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/button.c	Tue Jun 15 22:20:36 2004
@@ -108,9 +108,6 @@
    -------------------------------------------------------------------------- */
 
 static struct proc_dir_entry	*acpi_button_dir;
-extern struct acpi_device 	*acpi_fixed_pwr_button;
-extern struct acpi_device	*acpi_fixed_sleep_button;
-
 
 static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
 {
@@ -241,6 +238,16 @@
 
 	button = acpi_driver_data(device);
 	if (acpi_device_dir(device)) {
+		if (button->type == ACPI_BUTTON_TYPE_LID)
+			remove_proc_entry(ACPI_BUTTON_FILE_STATE,
+					     acpi_device_dir(device));
+		remove_proc_entry(ACPI_BUTTON_FILE_INFO,
+				     acpi_device_dir(device));
+
+		remove_proc_entry(acpi_device_bid(device),
+				     acpi_device_dir(device)->parent);
+
+
 		switch (button->type) {
 			case ACPI_BUTTON_TYPE_POWER:
 			case ACPI_BUTTON_TYPE_POWERF:
@@ -529,12 +536,6 @@
 acpi_button_exit (void)
 {
 	ACPI_FUNCTION_TRACE("acpi_button_exit");
-
-	if(acpi_fixed_pwr_button) 
-		acpi_button_remove(acpi_fixed_pwr_button, ACPI_BUS_TYPE_POWER_BUTTON);
-
-	if(acpi_fixed_sleep_button)
-		acpi_button_remove(acpi_fixed_sleep_button, ACPI_BUS_TYPE_SLEEP_BUTTON);
 
 	acpi_bus_unregister_driver(&acpi_button_driver);
 
diff -Nru a/drivers/acpi/debug.c b/drivers/acpi/debug.c
--- a/drivers/acpi/debug.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/acpi/debug.c	Tue Jun 15 22:20:42 2004
@@ -55,7 +55,7 @@
 static int
 acpi_system_write_debug (
 	struct file             *file,
-        const char              *buffer,
+        const char              __user *buffer,
 	unsigned long           count,
         void                    *data)
 {
diff -Nru a/drivers/acpi/ec.c b/drivers/acpi/ec.c
--- a/drivers/acpi/ec.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/ec.c	Tue Jun 15 22:20:41 2004
@@ -548,6 +548,12 @@
 {
 	ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
 
+	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device));
+		remove_proc_entry(acpi_device_bid(device), acpi_ec_dir);
+		acpi_device_dir(device) = NULL;
+	}
+
 	return_VALUE(0);
 }
 
diff -Nru a/drivers/acpi/event.c b/drivers/acpi/event.c
--- a/drivers/acpi/event.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/event.c	Tue Jun 15 22:20:36 2004
@@ -42,7 +42,7 @@
 static ssize_t
 acpi_system_read_event (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
diff -Nru a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
--- a/drivers/acpi/events/evxface.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/events/evxface.c	Tue Jun 15 22:20:41 2004
@@ -406,6 +406,15 @@
 			goto unlock_and_exit;
 		}
 
+		/* Make sure all deferred tasks are completed */
+
+		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_os_wait_events_complete(NULL);
+		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE (status)) {
+			return_ACPI_STATUS (status);
+ 		}
+
 		if (handler_type == ACPI_SYSTEM_NOTIFY) {
 			acpi_gbl_system_notify.node  = NULL;
 			acpi_gbl_system_notify.handler = NULL;
@@ -452,6 +461,15 @@
 			goto unlock_and_exit;
 		}
 
+		/* Make sure all deferred tasks are completed */
+
+		(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+		acpi_os_wait_events_complete(NULL);
+		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
+		if (ACPI_FAILURE (status)) {
+			return_ACPI_STATUS (status);
+ 		}
+
 		/* Remove the handler */
 
 		if (handler_type == ACPI_SYSTEM_NOTIFY) {
@@ -613,6 +631,15 @@
 		status = AE_BAD_PARAMETER;
 		goto unlock_and_exit;
 	}
+
+	/* Make sure all deferred tasks are completed */
+
+	(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
+	acpi_os_wait_events_complete(NULL);
+	status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
+	if (ACPI_FAILURE (status)) {
+		return_ACPI_STATUS (status);
+ 	}
 
 	/* Remove the handler */
 
diff -Nru a/drivers/acpi/fan.c b/drivers/acpi/fan.c
--- a/drivers/acpi/fan.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/fan.c	Tue Jun 15 22:20:36 2004
@@ -114,7 +114,7 @@
 static int
 acpi_fan_write_state (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	unsigned long		count,
 	void			*data)
 {
@@ -185,6 +185,8 @@
 	ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_FAN_FILE_STATE,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/osl.c b/drivers/acpi/osl.c
--- a/drivers/acpi/osl.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/acpi/osl.c	Tue Jun 15 22:20:43 2004
@@ -66,6 +66,7 @@
 static unsigned int acpi_irq_irq;
 static OSD_HANDLER acpi_irq_handler;
 static void *acpi_irq_context;
+static struct workqueue_struct *kacpid_wq;
 
 acpi_status
 acpi_os_initialize(void)
@@ -80,6 +81,8 @@
 		return AE_NULL_ENTRY;
 	}
 #endif
+	kacpid_wq = create_singlethread_workqueue("kacpid");
+	BUG_ON(!kacpid_wq);
 
 	return AE_OK;
 }
@@ -92,6 +95,8 @@
 						 acpi_irq_handler);
 	}
 
+	destroy_workqueue(kacpid_wq);
+
 	return AE_OK;
 }
 
@@ -654,13 +659,20 @@
 	task = (void *)(dpc+1);
 	INIT_WORK(task, acpi_os_execute_deferred, (void*)dpc);
 
-	if (!schedule_work(task)) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to schedule_work() failed.\n"));
+	if (!queue_work(kacpid_wq, task)) {
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to queue_work() failed.\n"));
 		kfree(dpc);
 		status = AE_ERROR;
 	}
 
 	return_ACPI_STATUS (status);
+}
+
+void
+acpi_os_wait_events_complete(
+	void *context)
+{
+	flush_workqueue(kacpid_wq);
 }
 
 /*
diff -Nru a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
--- a/drivers/acpi/pci_link.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/pci_link.c	Tue Jun 15 22:20:36 2004
@@ -479,7 +479,7 @@
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ9  PCI, often acpi */
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ10 PCI */
 	PIRQ_PENALTY_PCI_AVAILABLE,	/* IRQ11 PCI */
-	PIRQ_PENALTY_ISA_TYPICAL,	/* IRQ12 mouse */
+	PIRQ_PENALTY_ISA_USED,	/* IRQ12 mouse */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ13 fpe, sometimes */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ14 ide0 */
 	PIRQ_PENALTY_ISA_USED,	/* IRQ15 ide1 */
@@ -546,17 +546,23 @@
 		if (link->irq.active == link->irq.possible[i])
 			break;
 	}
+	/*
+	 * forget active IRQ that is not in possible list
+	 */
+	if (i == link->irq.possible_count) {
+		if (acpi_strict)
+			printk(KERN_WARNING PREFIX "_CRS %d not found"
+				" in _PRS\n", link->irq.active);
+		link->irq.active = 0;
+	}
 
 	/*
 	 * if active found, use it; else pick entry from end of possible list.
 	 */
-	if (i != link->irq.possible_count) {
+	if (link->irq.active) {
 		irq = link->irq.active;
 	} else {
 		irq = link->irq.possible[link->irq.possible_count - 1];
-		if (acpi_strict)
-			printk(KERN_WARNING PREFIX "_CRS %d not found"
-				" in _PRS\n", link->irq.active);
 	}
 
 	if (acpi_irq_balance || !link->irq.active) {
diff -Nru a/drivers/acpi/power.c b/drivers/acpi/power.c
--- a/drivers/acpi/power.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/power.c	Tue Jun 15 22:20:41 2004
@@ -482,6 +482,8 @@
 	ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_POWER_FILE_STATUS,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_power_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/processor.c b/drivers/acpi/processor.c
--- a/drivers/acpi/processor.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/acpi/processor.c	Tue Jun 15 22:20:42 2004
@@ -1948,7 +1948,7 @@
 static ssize_t
 acpi_processor_write_throttling (
         struct file		*file,
-        const char		*buffer,
+        const char		__user *buffer,
         size_t			count,
         loff_t			*data)
 {
@@ -2009,7 +2009,7 @@
 static ssize_t
 acpi_processor_write_limit (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*data)
 {
diff -Nru a/drivers/acpi/scan.c b/drivers/acpi/scan.c
--- a/drivers/acpi/scan.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/scan.c	Tue Jun 15 22:20:39 2004
@@ -4,7 +4,6 @@
 
 #include <linux/init.h>
 #include <linux/acpi.h>
-#include <linux/module.h>
 
 #include <acpi/acpi_drivers.h>
 #include <acpi/acinterp.h>	/* for acpi_ex_eisa_id_to_string() */
@@ -16,12 +15,6 @@
 #define STRUCT_TO_INT(s)	(*((int*)&s))
 
 extern struct acpi_device		*acpi_root;
-struct acpi_device 		*acpi_fixed_pwr_button;
-struct acpi_device 		*acpi_fixed_sleep_button;
-
-EXPORT_SYMBOL(acpi_fixed_pwr_button);
-EXPORT_SYMBOL(acpi_fixed_sleep_button);
-
 
 
 #define ACPI_BUS_CLASS			"system_bus"
@@ -318,8 +311,10 @@
 		struct acpi_device * dev = container_of(node,struct acpi_device,g_list);
 
 		if (dev->driver == drv) {
+			spin_unlock(&acpi_device_lock);
 			if (drv->ops.remove)
 				drv->ops.remove(dev,ACPI_BUS_REMOVAL_NORMAL);
+			spin_lock(&acpi_device_lock);
 			dev->driver = NULL;
 			dev->driver_data = NULL;
 			atomic_dec(&drv->references);
@@ -907,13 +902,10 @@
 	struct acpi_device	*root)
 {
 	int			result = 0;
+	struct acpi_device	*device = NULL;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
 
-	acpi_fixed_pwr_button = NULL;
-	acpi_fixed_sleep_button = NULL;
-
-
 	if (!root)
 		return_VALUE(-ENODEV);
 
@@ -921,11 +913,11 @@
 	 * Enumerate all fixed-feature devices.
 	 */
 	if (acpi_fadt.pwr_button == 0)
-		result = acpi_bus_add(&acpi_fixed_pwr_button, acpi_root, 
+		result = acpi_bus_add(&device, acpi_root, 
 			NULL, ACPI_BUS_TYPE_POWER_BUTTON);
 
 	if (acpi_fadt.sleep_button == 0)
-		result = acpi_bus_add(&acpi_fixed_sleep_button, acpi_root, 
+		result = acpi_bus_add(&device, acpi_root, 
 			NULL, ACPI_BUS_TYPE_SLEEP_BUTTON);
 
 	return_VALUE(result);
diff -Nru a/drivers/acpi/system.c b/drivers/acpi/system.c
--- a/drivers/acpi/system.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/acpi/system.c	Tue Jun 15 22:20:41 2004
@@ -77,7 +77,7 @@
 	return_VALUE(size);
 }
 
-static ssize_t acpi_system_read_dsdt (struct file*, char*, size_t, loff_t*);
+static ssize_t acpi_system_read_dsdt (struct file*, char __user *, size_t, loff_t*);
 
 static struct file_operations acpi_system_dsdt_ops = {
 	.read =			acpi_system_read_dsdt,
@@ -86,7 +86,7 @@
 static ssize_t
 acpi_system_read_dsdt (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -120,7 +120,7 @@
 }
 
 
-static ssize_t acpi_system_read_fadt (struct file*, char*, size_t, loff_t*);
+static ssize_t acpi_system_read_fadt (struct file*, char __user *, size_t, loff_t*);
 
 static struct file_operations acpi_system_fadt_ops = {
 	.read =			acpi_system_read_fadt,
@@ -129,7 +129,7 @@
 static ssize_t
 acpi_system_read_fadt (
 	struct file		*file,
-	char			*buffer,
+	char			__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
diff -Nru a/drivers/acpi/tables.c b/drivers/acpi/tables.c
--- a/drivers/acpi/tables.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/acpi/tables.c	Tue Jun 15 22:20:39 2004
@@ -343,10 +343,11 @@
 	entry = (acpi_table_entry_header *)
 		((unsigned long) madt + madt_size);
 
-	while (((unsigned long) entry) < madt_end) {
+	while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < madt_end) {
 		if (entry->type == entry_id &&
 		    (!max_entries || count++ < max_entries))
-			handler(entry);
+			if (handler(entry, madt_end))
+				return -EINVAL;
 
 		entry = (acpi_table_entry_header *)
 			((unsigned long) entry + entry->length);
diff -Nru a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
--- a/drivers/acpi/thermal.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/acpi/thermal.c	Tue Jun 15 22:20:44 2004
@@ -84,11 +84,11 @@
 static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
 static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
 static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_trip_points (struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_trip_points (struct file*,const char __user *,size_t,loff_t *);
 static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_cooling_mode (struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_cooling_mode (struct file*,const char __user *,size_t,loff_t *);
 static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file);
-static ssize_t acpi_thermal_write_polling(struct file*,const char *,size_t,loff_t *);
+static ssize_t acpi_thermal_write_polling(struct file*,const char __user *,size_t,loff_t *);
 
 static struct acpi_driver acpi_thermal_driver = {
 	.name =		ACPI_THERMAL_DRIVER_NAME,
@@ -885,7 +885,7 @@
 static ssize_t
 acpi_thermal_write_trip_points (
         struct file		*file,
-        const char		*buffer,
+        const char		__user *buffer,
         size_t			count,
         loff_t			*ppos)
 {
@@ -954,7 +954,7 @@
 static ssize_t
 acpi_thermal_write_cooling_mode (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -1015,7 +1015,7 @@
 static ssize_t
 acpi_thermal_write_polling (
 	struct file		*file,
-	const char		*buffer,
+	const char		__user *buffer,
 	size_t			count,
 	loff_t			*ppos)
 {
@@ -1139,6 +1139,16 @@
 	ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs");
 
 	if (acpi_device_dir(device)) {
+		remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
+				  acpi_device_dir(device));
+		remove_proc_entry(ACPI_THERMAL_FILE_STATE,
+				  acpi_device_dir(device));
 		remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir);
 		acpi_device_dir(device) = NULL;
 	}
diff -Nru a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
--- a/drivers/acpi/toshiba_acpi.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/acpi/toshiba_acpi.c	Tue Jun 15 22:20:36 2004
@@ -252,7 +252,7 @@
 }
 
 static int
-dispatch_write(struct file* file, __user const char* buffer,
+dispatch_write(struct file* file, const char __user * buffer,
 	unsigned long count, ProcItem* item)
 {
 	int result;
diff -Nru a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
--- a/drivers/atm/ambassador.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/atm/ambassador.c	Tue Jun 15 22:20:37 2004
@@ -1706,105 +1706,108 @@
 }
 
 /********** basic loader commands and error handling **********/
+// centisecond timeouts - guessing away here
+static unsigned int command_timeouts [] = {
+	[host_memory_test]     = 15,
+	[read_adapter_memory]  = 2,
+	[write_adapter_memory] = 2,
+	[adapter_start]        = 50,
+	[get_version_number]   = 10,
+	[interrupt_host]       = 1,
+	[flash_erase_sector]   = 1,
+	[adap_download_block]  = 1,
+	[adap_erase_flash]     = 1,
+	[adap_run_in_iram]     = 1,
+	[adap_end_download]    = 1
+};
+
+
+unsigned int command_successes [] = {
+	[host_memory_test]     = COMMAND_PASSED_TEST,
+	[read_adapter_memory]  = COMMAND_READ_DATA_OK,
+	[write_adapter_memory] = COMMAND_WRITE_DATA_OK,
+	[adapter_start]        = COMMAND_COMPLETE,
+	[get_version_number]   = COMMAND_COMPLETE,
+	[interrupt_host]       = COMMAND_COMPLETE,
+	[flash_erase_sector]   = COMMAND_COMPLETE,
+	[adap_download_block]  = COMMAND_COMPLETE,
+	[adap_erase_flash]     = COMMAND_COMPLETE,
+	[adap_run_in_iram]     = COMMAND_COMPLETE,
+	[adap_end_download]    = COMMAND_COMPLETE
+};
+  
+static  int decode_loader_result (loader_command cmd, u32 result)
+{
+	int res;
+	const char *msg;
+
+	if (result == command_successes[cmd])
+		return 0;
+
+	switch (result) {
+		case BAD_COMMAND:
+			res = -EINVAL;
+			msg = "bad command";
+			break;
+		case COMMAND_IN_PROGRESS:
+			res = -ETIMEDOUT;
+			msg = "command in progress";
+			break;
+		case COMMAND_PASSED_TEST:
+			res = 0;
+			msg = "command passed test";
+			break;
+		case COMMAND_FAILED_TEST:
+			res = -EIO;
+			msg = "command failed test";
+			break;
+		case COMMAND_READ_DATA_OK:
+			res = 0;
+			msg = "command read data ok";
+			break;
+		case COMMAND_READ_BAD_ADDRESS:
+			res = -EINVAL;
+			msg = "command read bad address";
+			break;
+		case COMMAND_WRITE_DATA_OK:
+			res = 0;
+			msg = "command write data ok";
+			break;
+		case COMMAND_WRITE_BAD_ADDRESS:
+			res = -EINVAL;
+			msg = "command write bad address";
+			break;
+		case COMMAND_WRITE_FLASH_FAILURE:
+			res = -EIO;
+			msg = "command write flash failure";
+			break;
+		case COMMAND_COMPLETE:
+			res = 0;
+			msg = "command complete";
+			break;
+		case COMMAND_FLASH_ERASE_FAILURE:
+			res = -EIO;
+			msg = "command flash erase failure";
+			break;
+		case COMMAND_WRITE_BAD_DATA:
+			res = -EINVAL;
+			msg = "command write bad data";
+			break;
+		default:
+			res = -EINVAL;
+			msg = "unknown error";
+			PRINTD (DBG_LOAD|DBG_ERR,
+				"decode_loader_result got %d=%x !",
+				result, result);
+			break;
+	}
+
+	PRINTK (KERN_ERR, "%s", msg);
+	return res;
+}
 
 static int __init do_loader_command (volatile loader_block * lb,
 				     const amb_dev * dev, loader_command cmd) {
-  // centisecond timeouts - guessing away here
-  unsigned int command_timeouts [] = {
-    [host_memory_test]     = 15,
-    [read_adapter_memory]  = 2,
-    [write_adapter_memory] = 2,
-    [adapter_start]        = 50,
-    [get_version_number]   = 10,
-    [interrupt_host]       = 1,
-    [flash_erase_sector]   = 1,
-    [adap_download_block]  = 1,
-    [adap_erase_flash]     = 1,
-    [adap_run_in_iram]     = 1,
-    [adap_end_download]    = 1
-  };
-  
-  unsigned int command_successes [] = {
-    [host_memory_test]     = COMMAND_PASSED_TEST,
-    [read_adapter_memory]  = COMMAND_READ_DATA_OK,
-    [write_adapter_memory] = COMMAND_WRITE_DATA_OK,
-    [adapter_start]        = COMMAND_COMPLETE,
-    [get_version_number]   = COMMAND_COMPLETE,
-    [interrupt_host]       = COMMAND_COMPLETE,
-    [flash_erase_sector]   = COMMAND_COMPLETE,
-    [adap_download_block]  = COMMAND_COMPLETE,
-    [adap_erase_flash]     = COMMAND_COMPLETE,
-    [adap_run_in_iram]     = COMMAND_COMPLETE,
-    [adap_end_download]    = COMMAND_COMPLETE
-  };
-  
-  int decode_loader_result (loader_command cmd, u32 result) {
-    int res;
-    const char * msg;
-    
-    if (result == command_successes[cmd])
-      return 0;
-    
-    switch (result) {
-      case BAD_COMMAND:
-	res = -EINVAL;
-	msg = "bad command";
-	break;
-      case COMMAND_IN_PROGRESS:
-	res = -ETIMEDOUT;
-	msg = "command in progress";
-	break;
-      case COMMAND_PASSED_TEST:
-	res = 0;
-	msg = "command passed test";
-	break;
-      case COMMAND_FAILED_TEST:
-	res = -EIO;
-	msg = "command failed test";
-	break;
-      case COMMAND_READ_DATA_OK:
-	res = 0;
-	msg = "command read data ok";
-	break;
-      case COMMAND_READ_BAD_ADDRESS:
-	res = -EINVAL;
-	msg = "command read bad address";
-	break;
-      case COMMAND_WRITE_DATA_OK:
-	res = 0;
-	msg = "command write data ok";
-	break;
-      case COMMAND_WRITE_BAD_ADDRESS:
-	res = -EINVAL;
-	msg = "command write bad address";
-	break;
-      case COMMAND_WRITE_FLASH_FAILURE:
-	res = -EIO;
-	msg = "command write flash failure";
-	break;
-      case COMMAND_COMPLETE:
-	res = 0;
-	msg = "command complete";
-	break;
-      case COMMAND_FLASH_ERASE_FAILURE:
-	res = -EIO;
-	msg = "command flash erase failure";
-	break;
-      case COMMAND_WRITE_BAD_DATA:
-	res = -EINVAL;
-	msg = "command write bad data";
-	break;
-      default:
-	res = -EINVAL;
-	msg = "unknown error";
-	PRINTD (DBG_LOAD|DBG_ERR, "decode_loader_result got %d=%x !",
-		result, result);
-	break;
-    }
-    
-    PRINTK (KERN_ERR, "%s", msg);
-    return res;
-  }
   
   unsigned long timeout;
   
@@ -1930,6 +1933,11 @@
 
 /********** reset card **********/
 
+static inline void sf (const char * msg)
+{
+	PRINTK (KERN_ERR, "self-test failed: %s", msg);
+}
+
 static int amb_reset (amb_dev * dev, int diags) {
   u32 word;
   
@@ -1974,9 +1982,6 @@
     // XXX double check byte-order
     word = rd_mem (dev, offsetof(amb_mem, mb.loader.result));
     if (word & SELF_TEST_FAILURE) {
-      void sf (const char * msg) {
-	PRINTK (KERN_ERR, "self-test failed: %s", msg);
-      }
       if (word & GPINT_TST_FAILURE)
 	sf ("interrupt");
       if (word & SUNI_DATA_PATTERN_FAILURE)
@@ -2044,31 +2049,31 @@
 }
 
 /********** give adapter parameters **********/
+  
+static inline u32 bus_addr(void * addr) {
+    return cpu_to_be32 (virt_to_bus (addr));
+}
 
 static int __init amb_talk (amb_dev * dev) {
   adap_talk_block a;
   unsigned char pool;
   unsigned long timeout;
   
-  u32 x (void * addr) {
-    return cpu_to_be32 (virt_to_bus (addr));
-  }
-  
   PRINTD (DBG_FLOW, "amb_talk %p", dev);
   
-  a.command_start = x (dev->cq.ptrs.start);
-  a.command_end   = x (dev->cq.ptrs.limit);
-  a.tx_start      = x (dev->txq.in.start);
-  a.tx_end        = x (dev->txq.in.limit);
-  a.txcom_start   = x (dev->txq.out.start);
-  a.txcom_end     = x (dev->txq.out.limit);
+  a.command_start = bus_addr (dev->cq.ptrs.start);
+  a.command_end   = bus_addr (dev->cq.ptrs.limit);
+  a.tx_start      = bus_addr (dev->txq.in.start);
+  a.tx_end        = bus_addr (dev->txq.in.limit);
+  a.txcom_start   = bus_addr (dev->txq.out.start);
+  a.txcom_end     = bus_addr (dev->txq.out.limit);
   
   for (pool = 0; pool < NUM_RX_POOLS; ++pool) {
     // the other "a" items are set up by the adapter
-    a.rec_struct[pool].buffer_start = x (dev->rxq[pool].in.start);
-    a.rec_struct[pool].buffer_end   = x (dev->rxq[pool].in.limit);
-    a.rec_struct[pool].rx_start     = x (dev->rxq[pool].out.start);
-    a.rec_struct[pool].rx_end       = x (dev->rxq[pool].out.limit);
+    a.rec_struct[pool].buffer_start = bus_addr (dev->rxq[pool].in.start);
+    a.rec_struct[pool].buffer_end   = bus_addr (dev->rxq[pool].in.limit);
+    a.rec_struct[pool].rx_start     = bus_addr (dev->rxq[pool].out.start);
+    a.rec_struct[pool].rx_end       = bus_addr (dev->rxq[pool].out.limit);
     a.rec_struct[pool].buffer_size = cpu_to_be32 (dev->rxq[pool].buffer_size);
   }
   
@@ -2111,15 +2116,10 @@
   minor = be32_to_cpu (cmd.args.version.minor);
   PRINTK (KERN_INFO, "microcode version is %u.%u", major, minor);
 }
-
-// get end station address
-static void __init amb_esi (amb_dev * dev, u8 * esi) {
-  u32 lower4;
-  u16 upper2;
-  command cmd;
   
-  // swap bits within byte to get Ethernet ordering
-  u8 bit_swap (u8 byte) {
+// swap bits within byte to get Ethernet ordering
+u8 bit_swap (u8 byte)
+{
     const u8 swap[] = {
       0x0, 0x8, 0x4, 0xc,
       0x2, 0xa, 0x6, 0xe,
@@ -2127,7 +2127,13 @@
       0x3, 0xb, 0x7, 0xf
     };
     return ((swap[byte & 0xf]<<4) | swap[byte>>4]);
-  }
+}
+
+// get end station address
+static void __init amb_esi (amb_dev * dev, u8 * esi) {
+  u32 lower4;
+  u16 upper2;
+  command cmd;
   
   cmd.request = cpu_to_be32 (SRB_GET_BIA);
   while (command_do (dev, &cmd)) {
@@ -2155,29 +2161,31 @@
   
   return;
 }
+  
+static void fixup_plx_window (amb_dev *dev, loader_block *lb)
+{
+	// fix up the PLX-mapped window base address to match the block
+	unsigned long blb;
+	u32 mapreg;
+	blb = virt_to_bus(lb);
+	// the kernel stack had better not ever cross a 1Gb boundary!
+	mapreg = rd_plain (dev, offsetof(amb_mem, stuff[10]));
+	mapreg &= ~onegigmask;
+	mapreg |= blb & onegigmask;
+	wr_plain (dev, offsetof(amb_mem, stuff[10]), mapreg);
+	return;
+}
 
-static int __init amb_init (amb_dev * dev) {
+static int __init amb_init (amb_dev * dev)
+{
   loader_block lb;
   
-  void fixup_plx_window (void) {
-    // fix up the PLX-mapped window base address to match the block
-    unsigned long blb;
-    u32 mapreg;
-    blb = virt_to_bus (&lb);
-    // the kernel stack had better not ever cross a 1Gb boundary!
-    mapreg = rd_plain (dev, offsetof(amb_mem, stuff[10]));
-    mapreg &= ~onegigmask;
-    mapreg |= blb & onegigmask;
-    wr_plain (dev, offsetof(amb_mem, stuff[10]), mapreg);
-    return;
-  }
-  
   u32 version;
   
   if (amb_reset (dev, 1)) {
     PRINTK (KERN_ERR, "card reset failed!");
   } else {
-    fixup_plx_window ();
+    fixup_plx_window (dev, &lb);
     
     if (get_loader_version (&lb, dev, &version)) {
       PRINTK (KERN_INFO, "failed to get loader version");
@@ -2207,31 +2215,20 @@
     
   } /* amb_reset */
   
-  return -1;
+  return -EINVAL;
 }
 
-static int __init amb_probe (void) {
-  struct pci_dev * pci_dev;
-  int devs;
-  
-  void __init do_pci_device (void) {
-    amb_dev * dev;
-    
-    // read resources from PCI configuration space
-    u8 irq = pci_dev->irq;
-    u32 * membase = bus_to_virt (pci_resource_start (pci_dev, 0));
-    u32 iobase = pci_resource_start (pci_dev, 1);
-    
-    void setup_dev (void) {
+static void setup_dev(amb_dev *dev, struct pci_dev *pci_dev) 
+{
       unsigned char pool;
       memset (dev, 0, sizeof(amb_dev));
       
       // set up known dev items straight away
       dev->pci_dev = pci_dev; 
       
-      dev->iobase = iobase;
-      dev->irq = irq; 
-      dev->membase = membase;
+      dev->iobase = pci_resource_start (pci_dev, 1);
+      dev->irq = pci_dev->irq; 
+      dev->membase = bus_to_virt(pci_resource_start(pci_dev, 0));
       
       // flags (currently only dead)
       dev->flags = 0;
@@ -2258,101 +2255,125 @@
       spin_lock_init (&dev->txq.lock);
       for (pool = 0; pool < NUM_RX_POOLS; ++pool)
 	spin_lock_init (&dev->rxq[pool].lock);
-    }
-    
-    void setup_pci_dev (void) {
-      unsigned char lat;
-      
-      /* XXX check return value */
-      pci_enable_device (pci_dev);
+}
+
+static int setup_pci_dev(struct pci_dev *pci_dev)
+{
+	unsigned char lat;
+	int ret;
+      
+	// enable bus master accesses
+	pci_set_master(pci_dev);
+      
+	ret = pci_enable_device(pci_dev);
+	if (ret < 0)
+		goto out;
+
+	// frobnicate latency (upwards, usually)
+	pci_read_config_byte (pci_dev, PCI_LATENCY_TIMER, &lat);
+
+	if (!pci_lat)
+		pci_lat = (lat < MIN_PCI_LATENCY) ? MIN_PCI_LATENCY : lat;
+
+	if (lat != pci_lat) {
+		PRINTK (KERN_INFO, "Changing PCI latency timer from %hu to %hu",
+			lat, pci_lat);
+		pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, pci_lat);
+	}
+out:
+	return ret;
+}
+
+static int __init do_pci_device(struct pci_dev *pci_dev)
+{
+	amb_dev * dev;
+	int err;
+
+	// read resources from PCI configuration space
+	u8 irq = pci_dev->irq;
+	u32 * membase = bus_to_virt (pci_resource_start (pci_dev, 0));
+	u32 iobase = pci_resource_start (pci_dev, 1);
+
+	PRINTD (DBG_INFO, "found Madge ATM adapter (amb) at"
+		" IO %x, IRQ %u, MEM %p", iobase, irq, membase);
+
+	// check IO region
+	err = pci_request_region(pci_dev, 1, DEV_LABEL);
+	if (err < 0) {
+		PRINTK (KERN_ERR, "IO range already in use!");
+		goto out;
+	}
+
+	dev = kmalloc (sizeof(amb_dev), GFP_KERNEL);
+	if (!dev) {
+		PRINTK (KERN_ERR, "out of memory!");
+		err = -ENOMEM;
+		goto out_release;
+	}
+
+	setup_dev(dev, pci_dev);
+
+	err = amb_init(dev);
+	if (err < 0) {
+		PRINTK (KERN_ERR, "adapter initialisation failure");
+		goto out_free;
+	}
+
+	err = setup_pci_dev(pci_dev);
+	if (err < 0)
+		goto out_reset;
+
+	// grab (but share) IRQ and install handler
+	err = request_irq(irq, interrupt_handler, SA_SHIRQ, DEV_LABEL, dev);
+	if (err < 0) {
+		PRINTK (KERN_ERR, "request IRQ failed!");
+		goto out_disable;
+	}
 
-      // enable bus master accesses
-      pci_set_master (pci_dev);
-      
-      // frobnicate latency (upwards, usually)
-      pci_read_config_byte (pci_dev, PCI_LATENCY_TIMER, &lat);
-      if (pci_lat) {
-	PRINTD (DBG_INIT, "%s PCI latency timer from %hu to %hu",
-		"changing", lat, pci_lat);
-	pci_write_config_byte (pci_dev, PCI_LATENCY_TIMER, pci_lat);
-      } else if (lat < MIN_PCI_LATENCY) {
-	PRINTK (KERN_INFO, "%s PCI latency timer from %hu to %hu",
-		"increasing", lat, MIN_PCI_LATENCY);
-	pci_write_config_byte (pci_dev, PCI_LATENCY_TIMER, MIN_PCI_LATENCY);
-      }
-    }
-    
-    PRINTD (DBG_INFO, "found Madge ATM adapter (amb) at"
-	    " IO %x, IRQ %u, MEM %p", iobase, irq, membase);
-    
-    // check IO region
-    if (!request_region (iobase, AMB_EXTENT, DEV_LABEL)) {
-      PRINTK (KERN_ERR, "IO range already in use!");
-      return;
-    }
-    
-    dev = kmalloc (sizeof(amb_dev), GFP_KERNEL);
-    if (!dev) {
-      // perhaps we should be nice: deregister all adapters and abort?
-      PRINTK (KERN_ERR, "out of memory!");
-      release_region (iobase, AMB_EXTENT);
-      return;
-    }
-    
-    setup_dev();
-    
-    if (amb_init (dev)) {
-      PRINTK (KERN_ERR, "adapter initialisation failure");
-    } else {
-      
-      setup_pci_dev();
-      
-      // grab (but share) IRQ and install handler
-      if (request_irq (irq, interrupt_handler, SA_SHIRQ, DEV_LABEL, dev)) {
-	PRINTK (KERN_ERR, "request IRQ failed!");
-	// free_irq is at "endif"
-      } else {
-	
 	dev->atm_dev = atm_dev_register (DEV_LABEL, &amb_ops, -1, NULL);
 	if (!dev->atm_dev) {
-	  PRINTD (DBG_ERR, "failed to register Madge ATM adapter");
-	} else {
-	  
-	  PRINTD (DBG_INFO, "registered Madge ATM adapter (no. %d) (%p) at %p",
-		  dev->atm_dev->number, dev, dev->atm_dev);
-	  dev->atm_dev->dev_data = (void *) dev;
-	  
-	  // register our address
-	  amb_esi (dev, dev->atm_dev->esi);
-	  
-	  // 0 bits for vpi, 10 bits for vci
-	  dev->atm_dev->ci_range.vpi_bits = NUM_VPI_BITS;
-	  dev->atm_dev->ci_range.vci_bits = NUM_VCI_BITS;
-	  
-	  // update count and linked list
-	  ++devs;
-	  dev->prev = amb_devs;
-	  amb_devs = dev;
-	  
-	  // enable host interrupts
-	  interrupts_on (dev);
-	  
-	  // success
-	  return;
-	  
-	  // not currently reached
-	  atm_dev_deregister (dev->atm_dev);
-	} /* atm_dev_register */
-	
-	free_irq (irq, dev);
-      } /* request_irq */
-      
-      amb_reset (dev, 0);
-    } /* amb_init */
-    
-    kfree (dev);
-    release_region (iobase, AMB_EXTENT);
-  } /* kmalloc, end-of-fn */
+		PRINTD (DBG_ERR, "failed to register Madge ATM adapter");
+		err = -EINVAL;
+		goto out_free_irq;
+	}
+
+	PRINTD (DBG_INFO, "registered Madge ATM adapter (no. %d) (%p) at %p",
+		dev->atm_dev->number, dev, dev->atm_dev);
+		dev->atm_dev->dev_data = (void *) dev;
+
+	// register our address
+	amb_esi (dev, dev->atm_dev->esi);
+
+	// 0 bits for vpi, 10 bits for vci
+	dev->atm_dev->ci_range.vpi_bits = NUM_VPI_BITS;
+	dev->atm_dev->ci_range.vci_bits = NUM_VCI_BITS;
+
+	// update linked list
+	dev->prev = amb_devs;
+	amb_devs = dev;
+
+	// enable host interrupts
+	interrupts_on (dev);
+
+out:
+	return err;
+
+out_free_irq:
+	free_irq(irq, dev);
+out_disable:
+	pci_disable_device(pci_dev);
+out_reset:
+	amb_reset(dev, 0);
+out_free:
+	kfree(dev);
+out_release:
+	pci_release_region(pci_dev, 1);
+	goto out;
+}
+
+static int __init amb_probe (void) {
+  struct pci_dev * pci_dev;
+  int devs;
   
   PRINTD (DBG_FLOW, "amb_probe");
   
@@ -2360,8 +2381,11 @@
   pci_dev = NULL;
   while ((pci_dev = pci_find_device
           (PCI_VENDOR_ID_MADGE, PCI_DEVICE_ID_MADGE_AMBASSADOR, pci_dev)
-          ))
-    do_pci_device();
+          )) {
+	if (do_pci_device(pci_dev) == 0)
+		devs++;
+  }
+
   
   pci_dev = NULL;
   while ((pci_dev = pci_find_device
@@ -2474,7 +2498,10 @@
   del_timer_sync(&housekeeping);
   
   while (amb_devs) {
+    struct pci_dev *pdev;
+
     dev = amb_devs;
+    pdev = dev->pci_dev;
     amb_devs = dev->prev;
     
     PRINTD (DBG_INFO|DBG_INIT, "closing %p (atm_dev = %p)", dev, dev->atm_dev);
@@ -2482,11 +2509,12 @@
     drain_rx_pools (dev);
     interrupts_off (dev);
     amb_reset (dev, 0);
+    free_irq (dev->irq, dev);
+    pci_disable_device (pdev);
     destroy_queues (dev);
     atm_dev_deregister (dev->atm_dev);
-    free_irq (dev->irq, dev);
-    release_region (dev->iobase, AMB_EXTENT);
     kfree (dev);
+    pci_release_region (pdev, 1);
   }
   
   return;
diff -Nru a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
--- a/drivers/atm/atmtcp.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/atm/atmtcp.c	Tue Jun 15 22:20:42 2004
@@ -152,7 +152,7 @@
 }
 
 
-static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
+static int atmtcp_v_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 {
 	struct atm_cirange ci;
 	struct atm_vcc *vcc;
@@ -161,7 +161,7 @@
 	int i;
 
 	if (cmd != ATM_SETCIRANGE) return -ENOIOCTLCMD;
-	if (copy_from_user(&ci,(void *) arg,sizeof(ci))) return -EFAULT;
+	if (copy_from_user(&ci, arg,sizeof(ci))) return -EFAULT;
 	if (ci.vpi_bits == ATM_CI_MAX) ci.vpi_bits = MAX_VPI_BITS;
 	if (ci.vci_bits == ATM_CI_MAX) ci.vci_bits = MAX_VCI_BITS;
 	if (ci.vpi_bits > MAX_VPI_BITS || ci.vpi_bits < 0 ||
diff -Nru a/drivers/atm/eni.c b/drivers/atm/eni.c
--- a/drivers/atm/eni.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/atm/eni.c	Tue Jun 15 22:20:37 2004
@@ -1968,7 +1968,7 @@
 }
 
 
-static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
+static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 {
 	struct eni_dev *eni_dev = ENI_DEV(dev);
 
@@ -1983,7 +1983,7 @@
 		struct eni_multipliers mult;
 
 		if (!capable(CAP_NET_ADMIN)) return -EPERM;
-		if (copy_from_user(&mult,(void *) arg,
+		if (copy_from_user(&mult, arg,
 		    sizeof(struct eni_multipliers)))
 			return -EFAULT;
 		if ((mult.tx && mult.tx <= 100) || (mult.rx &&mult.rx <= 100) ||
@@ -1996,7 +1996,7 @@
 	if (cmd == ATM_SETCIRANGE) {
 		struct atm_cirange ci;
 
-		if (copy_from_user(&ci,(void *) arg,sizeof(struct atm_cirange)))
+		if (copy_from_user(&ci, arg,sizeof(struct atm_cirange)))
 			return -EFAULT;
 		if ((ci.vpi_bits == 0 || ci.vpi_bits == ATM_CI_MAX) &&
 		    (ci.vci_bits == NR_VCI_LD || ci.vpi_bits == ATM_CI_MAX))
@@ -2009,14 +2009,14 @@
 
 
 static int eni_getsockopt(struct atm_vcc *vcc,int level,int optname,
-    void *optval,int optlen)
+    void __user *optval,int optlen)
 {
 	return -EINVAL;
 }
 
 
 static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname,
-    void *optval,int optlen)
+    void __user *optval,int optlen)
 {
 	return -EINVAL;
 }
diff -Nru a/drivers/atm/firestream.c b/drivers/atm/firestream.c
--- a/drivers/atm/firestream.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/atm/firestream.c	Tue Jun 15 22:20:37 2004
@@ -1220,7 +1220,7 @@
 /* Some function placeholders for functions we don't yet support. */
 
 #if 0
-static int fs_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
+static int fs_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 {
 	func_enter ();
 	func_exit ();
@@ -1229,7 +1229,7 @@
 
 
 static int fs_getsockopt(struct atm_vcc *vcc,int level,int optname,
-			 void *optval,int optlen)
+			 void __user *optval,int optlen)
 {
 	func_enter ();
 	func_exit ();
@@ -1238,7 +1238,7 @@
 
 
 static int fs_setsockopt(struct atm_vcc *vcc,int level,int optname,
-			 void *optval,int optlen)
+			 void __user *optval,int optlen)
 {
 	func_enter ();
 	func_exit ();
diff -Nru a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
--- a/drivers/atm/fore200e.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/atm/fore200e.c	Tue Jun 15 22:21:05 2004
@@ -38,6 +38,7 @@
 #include <linux/atmdev.h>
 #include <linux/sonet.h>
 #include <linux/atm_suni.h>
+#include <linux/dma-mapping.h>
 #include <asm/io.h>
 #include <asm/string.h>
 #include <asm/page.h>
@@ -682,7 +683,7 @@
     opcode.opcode = OPCODE_GET_PROM;
     opcode.pad    = 0;
 
-    prom_dma = fore200e->bus->dma_map(fore200e, prom, sizeof(struct prom_data), FORE200E_DMA_FROMDEVICE);
+    prom_dma = fore200e->bus->dma_map(fore200e, prom, sizeof(struct prom_data), DMA_FROM_DEVICE);
 
     fore200e->bus->write(prom_dma, &entry->cp_entry->cmd.prom_block.prom_haddr);
     
@@ -694,7 +695,7 @@
 
     *entry->status = STATUS_FREE;
 
-    fore200e->bus->dma_unmap(fore200e, prom_dma, sizeof(struct prom_data), FORE200E_DMA_FROMDEVICE);
+    fore200e->bus->dma_unmap(fore200e, prom_dma, sizeof(struct prom_data), DMA_FROM_DEVICE);
 
     if (ok == 0) {
 	printk(FORE200E "unable to get PROM data from device %s\n", fore200e->name);
@@ -1003,7 +1004,7 @@
 	
 	/* remove DMA mapping */
 	fore200e->bus->dma_unmap(fore200e, entry->tpd->tsd[ 0 ].buffer, entry->tpd->tsd[ 0 ].length,
-				 FORE200E_DMA_TODEVICE);
+				 DMA_TO_DEVICE);
 
 	vc_map = entry->vc_map;
 
@@ -1228,12 +1229,12 @@
 	buffer = FORE200E_HDL2BUF(rpd->rsd[ i ].handle);
 	
 	/* Make device DMA transfer visible to CPU.  */
-	fore200e->bus->dma_sync_for_cpu(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, FORE200E_DMA_FROMDEVICE);
+	fore200e->bus->dma_sync_for_cpu(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, DMA_FROM_DEVICE);
 	
 	memcpy(skb_put(skb, rpd->rsd[ i ].length), buffer->data.align_addr, rpd->rsd[ i ].length);
 
 	/* Now let the device get at it again.  */
-	fore200e->bus->dma_sync_for_device(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, FORE200E_DMA_FROMDEVICE);
+	fore200e->bus->dma_sync_for_device(fore200e, buffer->data.dma_addr, rpd->rsd[ i ].length, DMA_FROM_DEVICE);
     }
 
     DPRINTK(3, "rx skb: len = %d, truesize = %d\n", skb->len, skb->truesize);
@@ -1656,7 +1657,7 @@
     vcc->itf = vcc->vci = vcc->vpi = 0;
 
     fore200e_vcc = FORE200E_VCC(vcc);
-    FORE200E_VCC(vcc) = NULL;
+    vcc->dev_data = NULL;
 
     spin_unlock_irqrestore(&fore200e->q_lock, flags);
 
@@ -1807,7 +1808,7 @@
     entry->data   = tx_copy ? data : NULL;
 
     tpd = entry->tpd;
-    tpd->tsd[ 0 ].buffer = fore200e->bus->dma_map(fore200e, data, tx_len, FORE200E_DMA_TODEVICE);
+    tpd->tsd[ 0 ].buffer = fore200e->bus->dma_map(fore200e, data, tx_len, DMA_TO_DEVICE);
     tpd->tsd[ 0 ].length = tx_len;
 
     FORE200E_NEXT_ENTRY(txq->head, QUEUE_SIZE_TX);
@@ -1881,7 +1882,7 @@
     }
     
     stats_dma_addr = fore200e->bus->dma_map(fore200e, fore200e->stats,
-					    sizeof(struct stats), FORE200E_DMA_FROMDEVICE);
+					    sizeof(struct stats), DMA_FROM_DEVICE);
     
     FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD);
 
@@ -1898,7 +1899,7 @@
 
     *entry->status = STATUS_FREE;
 
-    fore200e->bus->dma_unmap(fore200e, stats_dma_addr, sizeof(struct stats), FORE200E_DMA_FROMDEVICE);
+    fore200e->bus->dma_unmap(fore200e, stats_dma_addr, sizeof(struct stats), DMA_FROM_DEVICE);
     
     if (ok == 0) {
 	printk(FORE200E "unable to get statistics from device %s\n", fore200e->name);
@@ -1910,7 +1911,7 @@
 
 
 static int
-fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void* optval, int optlen)
+fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen)
 {
     /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */
 
@@ -1922,7 +1923,7 @@
 
 
 static int
-fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void* optval, int optlen)
+fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen)
 {
     /* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */
     
@@ -1943,7 +1944,7 @@
     int                     ok;
     u32                     oc3_regs_dma_addr;
 
-    oc3_regs_dma_addr = fore200e->bus->dma_map(fore200e, regs, sizeof(struct oc3_regs), FORE200E_DMA_FROMDEVICE);
+    oc3_regs_dma_addr = fore200e->bus->dma_map(fore200e, regs, sizeof(struct oc3_regs), DMA_FROM_DEVICE);
 
     FORE200E_NEXT_ENTRY(cmdq->head, QUEUE_SIZE_CMD);
 
@@ -1962,7 +1963,7 @@
 
     *entry->status = STATUS_FREE;
 
-    fore200e->bus->dma_unmap(fore200e, oc3_regs_dma_addr, sizeof(struct oc3_regs), FORE200E_DMA_FROMDEVICE);
+    fore200e->bus->dma_unmap(fore200e, oc3_regs_dma_addr, sizeof(struct oc3_regs), DMA_FROM_DEVICE);
     
     if (ok == 0) {
 	printk(FORE200E "unable to get OC-3 regs of device %s\n", fore200e->name);
@@ -2058,7 +2059,7 @@
 
 
 static int
-fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats* arg)
+fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats __user *arg)
 {
     struct sonet_stats tmp;
 
@@ -2087,7 +2088,7 @@
 
 
 static int
-fore200e_ioctl(struct atm_dev* dev, unsigned int cmd, void* arg)
+fore200e_ioctl(struct atm_dev* dev, unsigned int cmd, void __user * arg)
 {
     struct fore200e* fore200e = FORE200E_DEV(dev);
     
@@ -2096,19 +2097,19 @@
     switch (cmd) {
 
     case SONET_GETSTAT:
-	return fore200e_fetch_stats(fore200e, (struct sonet_stats*)arg);
+	return fore200e_fetch_stats(fore200e, (struct sonet_stats __user *)arg);
 
     case SONET_GETDIAG:
-	return put_user(0, (int*)arg) ? -EFAULT : 0;
+	return put_user(0, (int __user *)arg) ? -EFAULT : 0;
 
     case ATM_SETLOOP:
 	return fore200e_setloop(fore200e, (int)(unsigned long)arg);
 
     case ATM_GETLOOP:
-	return put_user(fore200e->loop_mode, (int*)arg) ? -EFAULT : 0;
+	return put_user(fore200e->loop_mode, (int __user *)arg) ? -EFAULT : 0;
 
     case ATM_QUERYLOOP:
-	return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int*)arg) ? -EFAULT : 0;
+	return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY, (int __user *)arg) ? -EFAULT : 0;
     }
 
     return -ENOSYS; /* not implemented */
@@ -2257,7 +2258,7 @@
 		/* allocate the receive buffer body */
 		if (fore200e_chunk_alloc(fore200e,
 					 &buffer[ i ].data, size, fore200e->bus->buffer_alignment,
-					 FORE200E_DMA_FROMDEVICE) < 0) {
+					 DMA_FROM_DEVICE) < 0) {
 		    
 		    while (i > 0)
 			fore200e_chunk_free(fore200e, &buffer[ --i ].data);
diff -Nru a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h
--- a/drivers/atm/fore200e.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/atm/fore200e.h	Tue Jun 15 22:20:41 2004
@@ -556,7 +556,7 @@
 
 typedef struct host_cmdq_entry {
     struct cp_cmdq_entry* cp_entry;    /* addr of cp resident cmd queue entry */
-    enum   status*        status;      /* addr of host resident status        */
+    enum status *status;	       /* addr of host resident status        */
 } host_cmdq_entry_t;
 
 
@@ -668,7 +668,7 @@
 
 typedef struct init_block {
     enum opcode  opcode;               /* initialize command             */
-    enum status  status;	       /* related status word            */
+    enum status	 status;	       /* related status word            */
     u32          receive_threshold;    /* not used                       */
     u32          num_connect;          /* ATM connections                */
     u32          cmd_queue_len;        /* length of command queue        */
@@ -826,36 +826,6 @@
     void                 (*irq_ack)(struct fore200e*);
     int                  (*proc_read)(struct fore200e*, char*);
 } fore200e_bus_t;
-
-
-#if defined(CONFIG_ATM_FORE200E_SBA)
-#  if defined(CONFIG_ATM_FORE200E_PCA)
-#    if (PCI_DMA_BIDIRECTIONAL == SBUS_DMA_BIDIRECTIONAL) && \
-        (PCI_DMA_TODEVICE      == SBUS_DMA_TODEVICE)      && \
-        (PCI_DMA_FROMDEVICE    == SBUS_DMA_FROMDEVICE)
-#      define FORE200E_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL
-#      define FORE200E_DMA_TODEVICE      PCI_DMA_TODEVICE
-#      define FORE200E_DMA_FROMDEVICE    PCI_DMA_FROMDEVICE
-#    else
-       /* in that case, we'll need to add an extra indirection, e.g.
-	  fore200e->bus->dma_direction[ fore200e_dma_direction ] */
-#      error PCI and SBUS DMA direction flags have different values!
-#    endif
-#  else
-#    define FORE200E_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL
-#    define FORE200E_DMA_TODEVICE      SBUS_DMA_TODEVICE
-#    define FORE200E_DMA_FROMDEVICE    SBUS_DMA_FROMDEVICE
-#  endif
-#else
-#  ifndef CONFIG_ATM_FORE200E_PCA
-#    warning compiling the fore200e driver without any hardware support enabled!
-#    include <linux/pci.h>
-#  endif
-#  define FORE200E_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL
-#  define FORE200E_DMA_TODEVICE      PCI_DMA_TODEVICE
-#  define FORE200E_DMA_FROMDEVICE    PCI_DMA_FROMDEVICE
-#endif
-
 
 /* vc mapping */
 
diff -Nru a/drivers/atm/he.c b/drivers/atm/he.c
--- a/drivers/atm/he.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/atm/he.c	Tue Jun 15 22:20:37 2004
@@ -134,7 +134,7 @@
 static int he_open(struct atm_vcc *vcc);
 static void he_close(struct atm_vcc *vcc);
 static int he_send(struct atm_vcc *vcc, struct sk_buff *skb);
-static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg);
+static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg);
 static irqreturn_t he_irq_handler(int irq, void *dev_id, struct pt_regs *regs);
 static void he_tasklet(unsigned long data);
 static int he_proc_read(struct atm_dev *dev,loff_t *pos,char *page);
@@ -2809,7 +2809,7 @@
 }
 
 static int
-he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void *arg)
+he_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user *arg)
 {
 	unsigned long flags;
 	struct he_dev *he_dev = HE_DEV(atm_dev);
@@ -2821,8 +2821,8 @@
 			if (!capable(CAP_NET_ADMIN))
 				return -EPERM;
 
-			if (copy_from_user(&reg, (struct he_ioctl_reg *) arg,
-						sizeof(struct he_ioctl_reg)))
+			if (copy_from_user(&reg, arg,
+					   sizeof(struct he_ioctl_reg)))
 				return -EFAULT;
 			
 			spin_lock_irqsave(&he_dev->global_lock, flags);
@@ -2848,7 +2848,7 @@
 			}
 			spin_unlock_irqrestore(&he_dev->global_lock, flags);
 			if (err == 0)
-				if (copy_to_user((struct he_ioctl_reg *) arg, &reg,
+				if (copy_to_user(arg, &reg,
 							sizeof(struct he_ioctl_reg)))
 					return -EFAULT;
 			break;
diff -Nru a/drivers/atm/horizon.c b/drivers/atm/horizon.c
--- a/drivers/atm/horizon.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/atm/horizon.c	Tue Jun 15 22:20:35 2004
@@ -597,126 +597,112 @@
 
 // p ranges from 1 to a power of 2
 #define CR_MAXPEXP 4
-
+ 
 static int make_rate (const hrz_dev * dev, u32 c, rounding r,
-		      u16 * bits, unsigned int * actual) {
-  
-  // note: rounding the rate down means rounding 'p' up
-  
-  const unsigned long br = test_bit(ultra, &dev->flags) ? BR_ULT : BR_HRZ;
-  
-  u32 div = CR_MIND;
-  u32 pre;
-  
-  // local fn to build the timer bits
-  int set_cr (void) {
-    // paranoia
-    if (div > CR_MAXD || (!pre) || pre > 1<<CR_MAXPEXP) {
-      PRINTD (DBG_QOS, "set_cr internal failure: d=%u p=%u",
-	      div, pre);
-      return -EINVAL;
-    } else {
-      if (bits)
-	*bits = (div<<CLOCK_SELECT_SHIFT) | (pre-1);
-      if (actual) {
-	*actual = (br + (pre<<div) - 1) / (pre<<div);
-	PRINTD (DBG_QOS, "actual rate: %u", *actual);
-      }
-      return 0;
-    }
-  }
-  
-  // br_exp and br_man are used to avoid overflowing (c*maxp*2^d) in
-  // the tests below. We could think harder about exact possibilities
-  // of failure...
-  
-  unsigned long br_man = br;
-  unsigned int br_exp = 0;
-  
-  PRINTD (DBG_QOS|DBG_FLOW, "make_rate b=%lu, c=%u, %s", br, c,
-	  (r == round_up) ? "up" : (r == round_down) ? "down" : "nearest");
-  
-  // avoid div by zero
-  if (!c) {
-    PRINTD (DBG_QOS|DBG_ERR, "zero rate is not allowed!");
-    return -EINVAL;
-  }
+		      u16 * bits, unsigned int * actual)
+{
+	// note: rounding the rate down means rounding 'p' up
+	const unsigned long br = test_bit(ultra, &dev->flags) ? BR_ULT : BR_HRZ;
+  
+	u32 div = CR_MIND;
+	u32 pre;
+  
+	// br_exp and br_man are used to avoid overflowing (c*maxp*2^d) in
+	// the tests below. We could think harder about exact possibilities
+	// of failure...
+  
+	unsigned long br_man = br;
+	unsigned int br_exp = 0;
+  
+	PRINTD (DBG_QOS|DBG_FLOW, "make_rate b=%lu, c=%u, %s", br, c,
+		r == round_up ? "up" : r == round_down ? "down" : "nearest");
+  
+	// avoid div by zero
+	if (!c) {
+		PRINTD (DBG_QOS|DBG_ERR, "zero rate is not allowed!");
+		return -EINVAL;
+	}
   
-  while (br_exp < CR_MAXPEXP + CR_MIND && (br_man % 2 == 0)) {
-    br_man = br_man >> 1;
-    ++br_exp;
-  }
-  // (br >>br_exp) <<br_exp == br and
-  // br_exp <= CR_MAXPEXP+CR_MIND
+	while (br_exp < CR_MAXPEXP + CR_MIND && (br_man % 2 == 0)) {
+		br_man = br_man >> 1;
+		++br_exp;
+	}
+	// (br >>br_exp) <<br_exp == br and
+	// br_exp <= CR_MAXPEXP+CR_MIND
   
-  if (br_man <= (c << (CR_MAXPEXP+CR_MIND-br_exp))) {
-    // Equivalent to: B <= (c << (MAXPEXP+MIND))
-    // take care of rounding
-    switch (r) {
-      case round_down:
-	pre = (br+(c<<div)-1)/(c<<div);
-	// but p must be non-zero
-	if (!pre)
-	  pre = 1;
-	break;
-      case round_nearest:
-	pre = (br+(c<<div)/2)/(c<<div);
-	// but p must be non-zero
-	if (!pre)
-	  pre = 1;
-	break;
-      case round_up:
-	pre = br/(c<<div);
-	// but p must be non-zero
-	if (!pre)
-	  return -EINVAL;
-	break;
-    }
-    PRINTD (DBG_QOS, "A: p=%u, d=%u", pre, div);
-    return set_cr ();
-  }
+	if (br_man <= (c << (CR_MAXPEXP+CR_MIND-br_exp))) {
+		// Equivalent to: B <= (c << (MAXPEXP+MIND))
+		// take care of rounding
+		switch (r) {
+			case round_down:
+				pre = (br+(c<<div)-1)/(c<<div);
+				// but p must be non-zero
+				if (!pre)
+					pre = 1;
+				break;
+			case round_nearest:
+				pre = (br+(c<<div)/2)/(c<<div);
+				// but p must be non-zero
+				if (!pre)
+					pre = 1;
+				break;
+			default:	/* round_up */
+				pre = br/(c<<div);
+				// but p must be non-zero
+				if (!pre)
+					return -EINVAL;
+		}
+		PRINTD (DBG_QOS, "A: p=%u, d=%u", pre, div);
+		goto got_it;
+	}
   
-  // at this point we have
-  // d == MIND and (c << (MAXPEXP+MIND)) < B
-  while (div < CR_MAXD) {
-    div++;
-    if (br_man <= (c << (CR_MAXPEXP+div-br_exp))) {
-      // Equivalent to: B <= (c << (MAXPEXP+d))
-      // c << (MAXPEXP+d-1) < B <= c << (MAXPEXP+d)
-      // 1 << (MAXPEXP-1) < B/2^d/c <= 1 << MAXPEXP
-      // MAXP/2 < B/c2^d <= MAXP
-      // take care of rounding
-      switch (r) {
-	case round_down:
-	  pre = (br+(c<<div)-1)/(c<<div);
-	  break;
-	case round_nearest:
-	  pre = (br+(c<<div)/2)/(c<<div);
-	  break;
-	case round_up:
-	  pre = br/(c<<div);
-	  break;
-      }
-      PRINTD (DBG_QOS, "B: p=%u, d=%u", pre, div);
-      return set_cr ();
-    }
-  }
-  // at this point we have
-  // d == MAXD and (c << (MAXPEXP+MAXD)) < B
-  // but we cannot go any higher
-  // take care of rounding
-  switch (r) {
-    case round_down:
-      return -EINVAL;
-      break;
-    case round_nearest:
-      break;
-    case round_up:
-      break;
-  }
-  pre = 1 << CR_MAXPEXP;
-  PRINTD (DBG_QOS, "C: p=%u, d=%u", pre, div);
-  return set_cr ();
+	// at this point we have
+	// d == MIND and (c << (MAXPEXP+MIND)) < B
+	while (div < CR_MAXD) {
+		div++;
+		if (br_man <= (c << (CR_MAXPEXP+div-br_exp))) {
+			// Equivalent to: B <= (c << (MAXPEXP+d))
+			// c << (MAXPEXP+d-1) < B <= c << (MAXPEXP+d)
+			// 1 << (MAXPEXP-1) < B/2^d/c <= 1 << MAXPEXP
+			// MAXP/2 < B/c2^d <= MAXP
+			// take care of rounding
+			switch (r) {
+				case round_down:
+					pre = (br+(c<<div)-1)/(c<<div);
+					break;
+				case round_nearest:
+					pre = (br+(c<<div)/2)/(c<<div);
+					break;
+				default: /* round_up */
+					pre = br/(c<<div);
+			}
+			PRINTD (DBG_QOS, "B: p=%u, d=%u", pre, div);
+			goto got_it;
+		}
+	}
+	// at this point we have
+	// d == MAXD and (c << (MAXPEXP+MAXD)) < B
+	// but we cannot go any higher
+	// take care of rounding
+	if (r == round_down)
+		return -EINVAL;
+	pre = 1 << CR_MAXPEXP;
+	PRINTD (DBG_QOS, "C: p=%u, d=%u", pre, div);
+got_it:
+	// paranoia
+	if (div > CR_MAXD || (!pre) || pre > 1<<CR_MAXPEXP) {
+		PRINTD (DBG_QOS, "set_cr internal failure: d=%u p=%u",
+			div, pre);
+		return -EINVAL;
+	} else {
+		if (bits)
+			*bits = (div<<CLOCK_SELECT_SHIFT) | (pre-1);
+		if (actual) {
+			*actual = (br + (pre<<div) - 1) / (pre<<div);
+			PRINTD (DBG_QOS, "actual rate: %u", *actual);
+		}
+		return 0;
+	}
 }
 
 static int make_rate_with_tolerance (const hrz_dev * dev, u32 c, rounding r, unsigned int tol,
@@ -1823,23 +1809,23 @@
 
 /********** read the burnt in address **********/
 
-static u16 __init read_bia (const hrz_dev * dev, u16 addr) {
+static inline void WRITE_IT_WAIT (const hrz_dev *dev, u32 ctrl)
+{
+	wr_regl (dev, CONTROL_0_REG, ctrl);
+	udelay (5);
+}
   
+static inline void CLOCK_IT (const hrz_dev *dev, u32 ctrl)
+{
+	// DI must be valid around rising SK edge
+	WRITE_IT_WAIT(dev, ctrl & ~SEEPROM_SK);
+	WRITE_IT_WAIT(dev, ctrl | SEEPROM_SK);
+}
+
+static u16 __init read_bia (const hrz_dev * dev, u16 addr)
+{
   u32 ctrl = rd_regl (dev, CONTROL_0_REG);
   
-  void WRITE_IT_WAIT (void) {
-    wr_regl (dev, CONTROL_0_REG, ctrl);
-    udelay (5);
-  }
-  
-  void CLOCK_IT (void) {
-    // DI must be valid around rising SK edge
-    ctrl &= ~SEEPROM_SK;
-    WRITE_IT_WAIT();
-    ctrl |= SEEPROM_SK;
-    WRITE_IT_WAIT();
-  }
-  
   const unsigned int addr_bits = 6;
   const unsigned int data_bits = 16;
   
@@ -1848,17 +1834,17 @@
   u16 res;
   
   ctrl &= ~(SEEPROM_CS | SEEPROM_SK | SEEPROM_DI);
-  WRITE_IT_WAIT();
+  WRITE_IT_WAIT(dev, ctrl);
   
   // wake Serial EEPROM and send 110 (READ) command
   ctrl |=  (SEEPROM_CS | SEEPROM_DI);
-  CLOCK_IT();
+  CLOCK_IT(dev, ctrl);
   
   ctrl |= SEEPROM_DI;
-  CLOCK_IT();
+  CLOCK_IT(dev, ctrl);
   
   ctrl &= ~SEEPROM_DI;
-  CLOCK_IT();
+  CLOCK_IT(dev, ctrl);
   
   for (i=0; i<addr_bits; i++) {
     if (addr & (1 << (addr_bits-1)))
@@ -1866,7 +1852,7 @@
     else
       ctrl &= ~SEEPROM_DI;
     
-    CLOCK_IT();
+    CLOCK_IT(dev, ctrl);
     
     addr = addr << 1;
   }
@@ -1878,14 +1864,14 @@
   for (i=0;i<data_bits;i++) {
     res = res >> 1;
     
-    CLOCK_IT();
+    CLOCK_IT(dev, ctrl);
     
     if (rd_regl (dev, CONTROL_0_REG) & SEEPROM_DO)
       res |= (1 << (data_bits-1));
   }
   
   ctrl &= ~(SEEPROM_SK | SEEPROM_CS);
-  WRITE_IT_WAIT();
+  WRITE_IT_WAIT(dev, ctrl);
   
   return res;
 }
diff -Nru a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
--- a/drivers/atm/idt77105.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/atm/idt77105.c	Tue Jun 15 22:20:41 2004
@@ -141,7 +141,7 @@
 }
 
 
-static int fetch_stats(struct atm_dev *dev,struct idt77105_stats *arg,int zero)
+static int fetch_stats(struct atm_dev *dev,struct idt77105_stats __user *arg,int zero)
 {
 	unsigned long flags;
 	struct idt77105_stats stats;
@@ -188,7 +188,7 @@
 }
 
 
-static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
+static int idt77105_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 {
         printk(KERN_NOTICE "%s(%d) idt77105_ioctl() called\n",dev->type,dev->number);
 	switch (cmd) {
@@ -196,16 +196,15 @@
 			if (!capable(CAP_NET_ADMIN)) return -EPERM;
 			/* fall through */
 		case IDT77105_GETSTAT:
-			return fetch_stats(dev,(struct idt77105_stats *) arg,
-			    cmd == IDT77105_GETSTATZ);
+			return fetch_stats(dev, arg, cmd == IDT77105_GETSTATZ);
 		case ATM_SETLOOP:
 			return set_loopback(dev,(int) (long) arg);
 		case ATM_GETLOOP:
-			return put_user(PRIV(dev)->loop_mode,(int *) arg) ?
+			return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ?
 			    -EFAULT : 0;
 		case ATM_QUERYLOOP:
 			return put_user(ATM_LM_LOC_ATM | ATM_LM_RMT_ATM,
-			    (int *) arg) ? -EFAULT : 0;
+			    (int __user *) arg) ? -EFAULT : 0;
 		default:
 			return -ENOIOCTLCMD;
 	}
diff -Nru a/drivers/atm/iphase.c b/drivers/atm/iphase.c
--- a/drivers/atm/iphase.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/atm/iphase.c	Tue Jun 15 22:21:03 2004
@@ -2738,12 +2738,12 @@
 	return 0;  
 }  
   
-static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg)  
+static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)  
 {  
    IA_CMDBUF ia_cmds;
    IADEV *iadev;
    int i, board;
-   u16 *tmps;
+   u16 __user *tmps;
    IF_EVENT(printk(">ia_ioctl\n");)  
    if (cmd != IA_CMD) {
       if (!dev->phy->ioctl) return -EINVAL;
@@ -2766,7 +2766,7 @@
              break;
           case MEMDUMP_SEGREG:
 	     if (!capable(CAP_NET_ADMIN)) return -EPERM;
-             tmps = (u16 *)ia_cmds.buf;
+             tmps = (u16 __user *)ia_cmds.buf;
              for(i=0; i<0x80; i+=2, tmps++)
                 if(put_user((u16)(readl(iadev->seg_reg+i) & 0xffff), tmps)) return -EFAULT;
              ia_cmds.status = 0;
@@ -2774,7 +2774,7 @@
              break;
           case MEMDUMP_REASSREG:
 	     if (!capable(CAP_NET_ADMIN)) return -EPERM;
-             tmps = (u16 *)ia_cmds.buf;
+             tmps = (u16 __user *)ia_cmds.buf;
              for(i=0; i<0x80; i+=2, tmps++)
                 if(put_user((u16)(readl(iadev->reass_reg+i) & 0xffff), tmps)) return -EFAULT;
              ia_cmds.status = 0;
@@ -2874,14 +2874,14 @@
 }  
   
 static int ia_getsockopt(struct atm_vcc *vcc, int level, int optname,   
-	void *optval, int optlen)  
+	void __user *optval, int optlen)  
 {  
 	IF_EVENT(printk(">ia_getsockopt\n");)  
 	return -EINVAL;  
 }  
   
 static int ia_setsockopt(struct atm_vcc *vcc, int level, int optname,   
-	void *optval, int optlen)  
+	void __user *optval, int optlen)  
 {  
 	IF_EVENT(printk(">ia_setsockopt\n");)  
 	return -EINVAL;  
diff -Nru a/drivers/atm/iphase.h b/drivers/atm/iphase.h
--- a/drivers/atm/iphase.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/atm/iphase.h	Tue Jun 15 22:20:37 2004
@@ -141,7 +141,7 @@
         int len;
         u32 maddr;
         int status;
-        void *buf;
+        void __user *buf;
 } IA_CMDBUF, *PIA_CMDBUF;
 
 /* cmds */
diff -Nru a/drivers/atm/lanai.c b/drivers/atm/lanai.c
--- a/drivers/atm/lanai.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/atm/lanai.c	Tue Jun 15 22:20:38 2004
@@ -2435,7 +2435,7 @@
 #if 0
 /* ioctl operations for card */
 /* NOTE: these are all DEBUGGING ONLY currently */
-static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void *arg)
+static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user *arg)
 {
 	int result = 0;
 	struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data;
diff -Nru a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
--- a/drivers/atm/nicstar.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/atm/nicstar.c	Tue Jun 15 22:20:37 2004
@@ -239,7 +239,7 @@
 static void dequeue_sm_buf(ns_dev *card, struct sk_buff *sb);
 static void dequeue_lg_buf(ns_dev *card, struct sk_buff *lb);
 static int ns_proc_read(struct atm_dev *dev, loff_t *pos, char *page);
-static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg);
+static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg);
 static void which_list(ns_dev *card, struct sk_buff *skb);
 static void ns_poll(unsigned long arg);
 static int ns_parse_mac(char *mac, unsigned char *esi);
@@ -2765,7 +2765,7 @@
 
 
 
-static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void *arg)
+static int ns_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
 {
    ns_dev *card;
    pool_levels pl;
@@ -2776,7 +2776,7 @@
    switch (cmd)
    {
       case NS_GETPSTAT:
-         if (get_user(pl.buftype, &((pool_levels *) arg)->buftype))
+         if (get_user(pl.buftype, &((pool_levels __user *) arg)->buftype))
 	    return -EFAULT;
          switch (pl.buftype)
 	 {
@@ -2812,7 +2812,7 @@
 	       return -ENOIOCTLCMD;
 
 	 }
-         if (!copy_to_user((pool_levels *) arg, &pl, sizeof(pl)))
+         if (!copy_to_user((pool_levels __user *) arg, &pl, sizeof(pl)))
 	    return (sizeof(pl));
 	 else
 	    return -EFAULT;
@@ -2820,7 +2820,7 @@
       case NS_SETBUFLEV:
          if (!capable(CAP_NET_ADMIN))
 	    return -EPERM;
-         if (copy_from_user(&pl, (pool_levels *) arg, sizeof(pl)))
+         if (copy_from_user(&pl, (pool_levels __user *) arg, sizeof(pl)))
 	    return -EFAULT;
 	 if (pl.level.min >= pl.level.init || pl.level.init >= pl.level.max)
 	    return -EINVAL;
diff -Nru a/drivers/atm/suni.c b/drivers/atm/suni.c
--- a/drivers/atm/suni.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/atm/suni.c	Tue Jun 15 22:20:43 2004
@@ -95,7 +95,7 @@
 #undef ADD_LIMITED
 
 
-static int fetch_stats(struct atm_dev *dev,struct sonet_stats *arg,int zero)
+static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int zero)
 {
 	struct sonet_stats tmp;
 	int error = 0;
@@ -115,11 +115,11 @@
   }
 
 
-static int change_diag(struct atm_dev *dev,void *arg,int set)
+static int change_diag(struct atm_dev *dev,void __user *arg,int set)
 {
 	int todo;
 
-	if (get_user(todo,(int *) arg)) return -EFAULT;
+	if (get_user(todo,(int __user *)arg)) return -EFAULT;
 	HANDLE_FLAG(SONET_INS_SBIP,TSOP_DIAG,SUNI_TSOP_DIAG_DBIP8);
 	HANDLE_FLAG(SONET_INS_LBIP,TLOP_DIAG,SUNI_TLOP_DIAG_DBIP);
 	HANDLE_FLAG(SONET_INS_PBIP,TPOP_CD,SUNI_TPOP_DIAG_DB3);
@@ -128,14 +128,14 @@
 	HANDLE_FLAG(SONET_INS_PAIS,TPOP_CD,SUNI_TPOP_DIAG_PAIS);
 	HANDLE_FLAG(SONET_INS_LOS,TSOP_DIAG,SUNI_TSOP_DIAG_DLOS);
 	HANDLE_FLAG(SONET_INS_HCS,TACP_CS,SUNI_TACP_CS_DHCS);
-	return put_user(todo,(int *) arg) ? -EFAULT : 0;
+	return put_user(todo,(int __user *)arg) ? -EFAULT : 0;
 }
 
 
 #undef HANDLE_FLAG
 
 
-static int get_diag(struct atm_dev *dev,void *arg)
+static int get_diag(struct atm_dev *dev,void __user *arg)
 {
 	int set;
 
@@ -148,7 +148,7 @@
 	if (GET(TPOP_CD) & SUNI_TPOP_DIAG_PAIS) set |= SONET_INS_PAIS;
 	if (GET(TSOP_DIAG) & SUNI_TSOP_DIAG_DLOS) set |= SONET_INS_LOS;
 	if (GET(TACP_CS) & SUNI_TACP_CS_DHCS) set |= SONET_INS_HCS;
-	return put_user(set,(int *) arg) ? -EFAULT : 0;
+	return put_user(set,(int __user *)arg) ? -EFAULT : 0;
 }
 
 
@@ -175,13 +175,12 @@
 }
 
 
-static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
+static int suni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 {
 	switch (cmd) {
 		case SONET_GETSTATZ:
 		case SONET_GETSTAT:
-			return fetch_stats(dev,(struct sonet_stats *) arg,
-			    cmd == SONET_GETSTATZ);
+			return fetch_stats(dev, arg, cmd == SONET_GETSTATZ);
 		case SONET_SETDIAG:
 			return change_diag(dev,arg,1);
 		case SONET_CLRDIAG:
@@ -192,18 +191,18 @@
 			if (arg != SONET_FRAME_SONET) return -EINVAL;
 			return 0;
 		case SONET_GETFRAMING:
-			return put_user(SONET_FRAME_SONET,(int *) arg) ?
+			return put_user(SONET_FRAME_SONET,(int __user *)arg) ?
 			    -EFAULT : 0;
 		case SONET_GETFRSENSE:
 			return -EINVAL;
 		case ATM_SETLOOP:
 			return set_loopback(dev,(int) (long) arg);
 		case ATM_GETLOOP:
-			return put_user(PRIV(dev)->loop_mode,(int *) arg) ?
+			return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ?
 			    -EFAULT : 0;
 		case ATM_QUERYLOOP:
 			return put_user(ATM_LM_LOC_PHY | ATM_LM_RMT_PHY,
-			    (int *) arg) ? -EFAULT : 0;
+			    (int __user *) arg) ? -EFAULT : 0;
 		default:
 			return -ENOIOCTLCMD;
 	}
diff -Nru a/drivers/atm/uPD98402.c b/drivers/atm/uPD98402.c
--- a/drivers/atm/uPD98402.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/atm/uPD98402.c	Tue Jun 15 22:20:39 2004
@@ -37,7 +37,7 @@
 #define GET(reg) dev->ops->phy_get(dev,uPD98402_##reg)
 
 
-static int fetch_stats(struct atm_dev *dev,struct sonet_stats *arg,int zero)
+static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int zero)
 {
 	struct sonet_stats tmp;
  	int error = 0;
@@ -83,7 +83,7 @@
 }
 
 
-static int get_sense(struct atm_dev *dev,u8 *arg)
+static int get_sense(struct atm_dev *dev,u8 __user *arg)
 {
 	unsigned long flags;
 	unsigned char s[3];
@@ -132,29 +132,28 @@
 }
 
 
-static int uPD98402_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
+static int uPD98402_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 {
 	switch (cmd) {
 
 		case SONET_GETSTATZ:
                 case SONET_GETSTAT:
-			return fetch_stats(dev,(struct sonet_stats *) arg,
-			    cmd == SONET_GETSTATZ);
+			return fetch_stats(dev,arg, cmd == SONET_GETSTATZ);
 		case SONET_SETFRAMING:
 			return set_framing(dev,(int) (long) arg);
 		case SONET_GETFRAMING:
-			return put_user(PRIV(dev)->framing,(int *) arg) ?
+			return put_user(PRIV(dev)->framing,(int __user *)arg) ?
 			    -EFAULT : 0;
 		case SONET_GETFRSENSE:
 			return get_sense(dev,arg);
 		case ATM_SETLOOP:
 			return set_loopback(dev,(int) (long) arg);
 		case ATM_GETLOOP:
-			return put_user(PRIV(dev)->loop_mode,(int *) arg) ?
+			return put_user(PRIV(dev)->loop_mode,(int __user *)arg) ?
 			    -EFAULT : 0;
 		case ATM_QUERYLOOP:
 			return put_user(ATM_LM_LOC_PHY | ATM_LM_LOC_ATM |
-			    ATM_LM_RMT_PHY,(int *) arg) ? -EFAULT : 0;
+			    ATM_LM_RMT_PHY,(int __user *)arg) ? -EFAULT : 0;
 		default:
 			return -ENOIOCTLCMD;
 	}
diff -Nru a/drivers/atm/zatm.c b/drivers/atm/zatm.c
--- a/drivers/atm/zatm.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/atm/zatm.c	Tue Jun 15 22:20:38 2004
@@ -1429,7 +1429,7 @@
 }
 
 
-static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void *arg)
+static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
 {
 	struct zatm_dev *zatm_dev;
 	unsigned long flags;
@@ -1445,7 +1445,7 @@
 				int pool;
 
 				if (get_user(pool,
-				    &((struct zatm_pool_req *) arg)->pool_num))
+				    &((struct zatm_pool_req __user *) arg)->pool_num))
 					return -EFAULT;
 				if (pool < 0 || pool > ZATM_LAST_POOL)
 					return -EINVAL;
@@ -1457,7 +1457,7 @@
 				}
 				spin_unlock_irqrestore(&zatm_dev->lock, flags);
 				return copy_to_user(
-				    &((struct zatm_pool_req *) arg)->info,
+				    &((struct zatm_pool_req __user *) arg)->info,
 				    &info,sizeof(info)) ? -EFAULT : 0;
 			}
 		case ZATM_SETPOOL:
@@ -1467,12 +1467,12 @@
 
 				if (!capable(CAP_NET_ADMIN)) return -EPERM;
 				if (get_user(pool,
-				    &((struct zatm_pool_req *) arg)->pool_num))
+				    &((struct zatm_pool_req __user *) arg)->pool_num))
 					return -EFAULT;
 				if (pool < 0 || pool > ZATM_LAST_POOL)
 					return -EINVAL;
 				if (copy_from_user(&info,
-				    &((struct zatm_pool_req *) arg)->info,
+				    &((struct zatm_pool_req __user *) arg)->info,
 				    sizeof(info))) return -EFAULT;
 				if (!info.low_water)
 					info.low_water = zatm_dev->
@@ -1504,14 +1504,14 @@
 
 
 static int zatm_getsockopt(struct atm_vcc *vcc,int level,int optname,
-    void *optval,int optlen)
+    void __user *optval,int optlen)
 {
 	return -EINVAL;
 }
 
 
 static int zatm_setsockopt(struct atm_vcc *vcc,int level,int optname,
-    void *optval,int optlen)
+    void __user *optval,int optlen)
 {
 	return -EINVAL;
 }
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/base/bus.c	Tue Jun 15 22:20:38 2004
@@ -451,7 +451,11 @@
 
 	if (bus) {
 		pr_debug("bus %s: add driver %s\n",bus->name,drv->name);
-		kobject_set_name(&drv->kobj,drv->name);
+		error = kobject_set_name(&drv->kobj,drv->name);
+		if (error) {
+			put_bus(bus);
+			return error;
+		}
 		drv->kobj.kset = &bus->drivers;
 		if ((error = kobject_register(&drv->kobj))) {
 			put_bus(bus);
@@ -555,21 +559,39 @@
  */
 int bus_register(struct bus_type * bus)
 {
-	kobject_set_name(&bus->subsys.kset.kobj,bus->name);
+	int retval;
+
+	retval = kobject_set_name(&bus->subsys.kset.kobj,bus->name);
+	if (retval)
+		goto out;
+
 	subsys_set_kset(bus,bus_subsys);
-	subsystem_register(&bus->subsys);
+	retval = subsystem_register(&bus->subsys);
+	if (retval) 
+		goto out;
 
 	kobject_set_name(&bus->devices.kobj, "devices");
 	bus->devices.subsys = &bus->subsys;
-	kset_register(&bus->devices);
+	retval = kset_register(&bus->devices);
+	if (retval)
+		goto bus_devices_fail;
 
 	kobject_set_name(&bus->drivers.kobj, "drivers");
 	bus->drivers.subsys = &bus->subsys;
 	bus->drivers.ktype = &ktype_driver;
-	kset_register(&bus->drivers);
+	retval = kset_register(&bus->drivers);
+	if (retval)
+		goto bus_drivers_fail;
 
 	pr_debug("bus type '%s' registered\n",bus->name);
 	return 0;
+
+bus_drivers_fail:
+	kset_unregister(&bus->devices);
+bus_devices_fail:
+	subsystem_unregister(&bus->subsys);
+out:
+	return retval;
 }
 
 
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/base/class.c	Tue Jun 15 22:21:05 2004
@@ -361,6 +361,8 @@
 
 int class_device_rename(struct class_device *class_dev, char *new_name)
 {
+	int error = 0;
+
 	class_dev = class_device_get(class_dev);
 	if (!class_dev)
 		return -EINVAL;
@@ -370,11 +372,11 @@
 
 	strlcpy(class_dev->class_id, new_name, KOBJ_NAME_LEN);
 
-	kobject_rename(&class_dev->kobj, new_name);
+	error = kobject_rename(&class_dev->kobj, new_name);
 
 	class_device_put(class_dev);
 
-	return 0;
+	return error;
 }
 
 struct class_device * class_device_get(struct class_device *class_dev)
diff -Nru a/drivers/base/map.c b/drivers/base/map.c
--- a/drivers/base/map.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/base/map.c	Tue Jun 15 22:20:42 2004
@@ -138,6 +138,13 @@
 	struct kobj_map *p = kmalloc(sizeof(struct kobj_map), GFP_KERNEL);
 	struct probe *base = kmalloc(sizeof(struct probe), GFP_KERNEL);
 	int i;
+
+	if ((p == NULL) || (base == NULL)) {
+		kfree(p);
+		kfree(base);
+		return NULL;
+	}
+
 	memset(base, 0, sizeof(struct probe));
 	base->dev = 1;
 	base->range = ~0;
diff -Nru a/drivers/base/node.c b/drivers/base/node.c
--- a/drivers/base/node.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/base/node.c	Tue Jun 15 22:20:37 2004
@@ -21,22 +21,30 @@
 	cpumask_t mask = node_dev->cpumap;
 	int len;
 
-	/* FIXME - someone should pass us a buffer size (count) or
-	 * use seq_file or something to avoid buffer overrun risk. */
-	len = cpumask_scnprintf(buf, 99 /* XXX FIXME */, mask);
+	/* 2004/06/03: buf currently PAGE_SIZE, need > 1 char per 4 bits. */
+	BUILD_BUG_ON(NR_CPUS/4 > PAGE_SIZE/2);
+
+	len = cpumask_scnprintf(buf, PAGE_SIZE-1, mask);
 	len += sprintf(buf + len, "\n");
 	return len;
 }
 
 static SYSDEV_ATTR(cpumap,S_IRUGO,node_read_cpumap,NULL);
 
+/* Can be overwritten by architecture specific code. */
+int __attribute__((weak)) hugetlb_report_node_meminfo(int node, char *buf)
+{
+	return 0;
+}
+
 #define K(x) ((x) << (PAGE_SHIFT - 10))
 static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
 {
+	int n;
 	int nid = dev->id;
 	struct sysinfo i;
 	si_meminfo_node(&i, nid);
-	return sprintf(buf, "\n"
+	n = sprintf(buf, "\n"
 		       "Node %d MemTotal:     %8lu kB\n"
 		       "Node %d MemFree:      %8lu kB\n"
 		       "Node %d MemUsed:      %8lu kB\n"
@@ -51,10 +59,52 @@
 		       nid, K(i.freehigh),
 		       nid, K(i.totalram-i.totalhigh),
 		       nid, K(i.freeram-i.freehigh));
+	n += hugetlb_report_node_meminfo(nid, buf + n);
+	return n;
 }
+
 #undef K 
 static SYSDEV_ATTR(meminfo,S_IRUGO,node_read_meminfo,NULL);
 
+static ssize_t node_read_numastat(struct sys_device * dev, char * buf)
+{
+	unsigned long numa_hit, numa_miss, interleave_hit, numa_foreign;
+	unsigned long local_node, other_node;
+	int i, cpu;
+	pg_data_t *pg = NODE_DATA(dev->id);
+	numa_hit = 0;
+	numa_miss = 0;
+	interleave_hit = 0;
+	numa_foreign = 0;
+	local_node = 0;
+	other_node = 0;
+	for (i = 0; i < MAX_NR_ZONES; i++) {
+		struct zone *z = &pg->node_zones[i];
+		for (cpu = 0; cpu < NR_CPUS; cpu++) {
+			struct per_cpu_pageset *ps = &z->pageset[cpu];
+			numa_hit += ps->numa_hit;
+			numa_miss += ps->numa_miss;
+			numa_foreign += ps->numa_foreign;
+			interleave_hit += ps->interleave_hit;
+			local_node += ps->local_node;
+			other_node += ps->other_node;
+		}
+	}
+	return sprintf(buf,
+		       "numa_hit %lu\n"
+		       "numa_miss %lu\n"
+		       "numa_foreign %lu\n"
+		       "interleave_hit %lu\n"
+		       "local_node %lu\n"
+		       "other_node %lu\n",
+		       numa_hit,
+		       numa_miss,
+		       numa_foreign,
+		       interleave_hit,
+		       local_node,
+		       other_node);
+}
+static SYSDEV_ATTR(numastat,S_IRUGO,node_read_numastat,NULL);
 
 /*
  * register_node - Setup a driverfs device for a node.
@@ -74,6 +124,7 @@
 	if (!error){
 		sysdev_create_file(&node->sysdev, &attr_cpumap);
 		sysdev_create_file(&node->sysdev, &attr_meminfo);
+		sysdev_create_file(&node->sysdev, &attr_numastat);
 	}
 	return error;
 }
diff -Nru a/drivers/base/platform.c b/drivers/base/platform.c
--- a/drivers/base/platform.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/base/platform.c	Tue Jun 15 22:20:37 2004
@@ -57,8 +57,9 @@
  *	type of device, like "pci" or "floppy", and <instance> is the 
  *	enumerated instance of the device, like '0' or '42'.
  *	Driver IDs are simply "<name>". 
- *	So, extract the <name> from the device, and compare it against 
- *	the name of the driver. Return whether they match or not.
+ *	So, extract the <name> from the platform_device structure, 
+ *	and compare it against the name of the driver. Return whether 
+ *	they match or not.
  */
 
 static int platform_match(struct device * dev, struct device_driver * drv)
diff -Nru a/drivers/base/power/resume.c b/drivers/base/power/resume.c
--- a/drivers/base/power/resume.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/base/power/resume.c	Tue Jun 15 22:20:44 2004
@@ -35,7 +35,10 @@
 		struct list_head * entry = dpm_off.next;
 		struct device * dev = to_device(entry);
 		list_del_init(entry);
-		resume_device(dev);
+
+		if (!dev->power.prev_state)
+			resume_device(dev);
+
 		list_add_tail(entry,&dpm_active);
 	}
 }
diff -Nru a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
--- a/drivers/base/power/runtime.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/base/power/runtime.c	Tue Jun 15 22:20:43 2004
@@ -12,9 +12,11 @@
 
 static void runtime_resume(struct device * dev)
 {
+	dev_dbg(dev, "resuming\n");
 	if (!dev->power.power_state)
 		return;
-	resume_device(dev);
+	if (!resume_device(dev))
+		dev->power.power_state = 0;
 }
 
 
diff -Nru a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c
--- a/drivers/base/power/shutdown.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/base/power/shutdown.c	Tue Jun 15 22:20:42 2004
@@ -34,8 +34,8 @@
 
 
 /**
- * We handle system devices differently - we suspend and shut them 
- * down first and resume them first. That way, we do anything stupid like
+ * We handle system devices differently - we suspend and shut them
+ * down last and resume them first. That way, we don't do anything stupid like
  * shutting down the interrupt controller before any devices..
  *
  * Note that there are not different stages for power management calls - 
@@ -45,7 +45,7 @@
 extern int sysdev_shutdown(void);
 
 /**
- * device_shutdown - call ->remove() on each device to shutdown. 
+ * device_shutdown - call ->shutdown() on each device to shutdown.
  */
 void device_shutdown(void)
 {
diff -Nru a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
--- a/drivers/base/power/suspend.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/base/power/suspend.c	Tue Jun 15 22:20:44 2004
@@ -39,16 +39,13 @@
 {
 	int error = 0;
 
-	if (dev->bus && dev->bus->suspend)
+	dev_dbg(dev, "suspending\n");
+
+	dev->power.prev_state = dev->power.power_state;
+
+	if (dev->bus && dev->bus->suspend && !dev->power.power_state)
 		error = dev->bus->suspend(dev,state);
 
-	if (!error) {
-		list_del(&dev->power.entry);
-		list_add(&dev->power.entry,&dpm_off);
-	} else if (error == -EAGAIN) {
-		list_del(&dev->power.entry);
-		list_add(&dev->power.entry,&dpm_off_irq);
-	}
 	return error;
 }
 
@@ -81,11 +78,18 @@
 	while(!list_empty(&dpm_active)) {
 		struct list_head * entry = dpm_active.prev;
 		struct device * dev = to_device(entry);
-		if ((error = suspend_device(dev,state))) {
-			if (error != -EAGAIN)
-				goto Error;
-			else
-				error = 0;
+		error = suspend_device(dev,state);
+
+		if (!error) {
+			list_del(&dev->power.entry);
+			list_add(&dev->power.entry,&dpm_off);
+		} else if (error == -EAGAIN) {
+			list_del(&dev->power.entry);
+			list_add(&dev->power.entry,&dpm_off_irq);
+		} else {
+			printk(KERN_ERR "Could not suspend device %s: "
+				"error %d\n", kobject_name(&dev->kobj), error);
+			goto Error;
 		}
 	}
  Done:
diff -Nru a/drivers/base/sys.c b/drivers/base/sys.c
--- a/drivers/base/sys.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/base/sys.c	Tue Jun 15 22:20:35 2004
@@ -180,8 +180,11 @@
 
 	/* But make sure we point to the right type for sysfs translation */
 	sysdev->kobj.ktype = &ktype_sysdev;
-	kobject_set_name(&sysdev->kobj,"%s%d",
+	error = kobject_set_name(&sysdev->kobj,"%s%d",
 			 kobject_name(&cls->kset.kobj),sysdev->id);
+	if (error)
+		return error;
+
 	pr_debug("Registering sys device '%s'\n",kobject_name(&sysdev->kobj));
 
 	/* Register the object */
diff -Nru a/drivers/block/DAC960.c b/drivers/block/DAC960.c
--- a/drivers/block/DAC960.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/block/DAC960.c	Tue Jun 15 22:20:43 2004
@@ -97,7 +97,8 @@
 	struct gendisk *disk = inode->i_bdev->bd_disk;
 	DAC960_Controller_T *p = disk->queue->queuedata;
 	int drive_nr = (long)disk->private_data;
-	struct hd_geometry g, *loc = (struct hd_geometry *)arg;
+	struct hd_geometry g;
+	struct hd_geometry __user *loc = (struct hd_geometry __user *)arg;
 
 	if (cmd != HDIO_GETGEO || !loc)
 		return -EINVAL;
@@ -6455,7 +6456,8 @@
   DAC960_ProcWriteUserCommand implements writing /proc/rd/cN/user_command.
 */
 
-static int DAC960_ProcWriteUserCommand(struct file *file, const char *Buffer,
+static int DAC960_ProcWriteUserCommand(struct file *file,
+				       const char __user *Buffer,
 				       unsigned long Count, void *Data)
 {
   DAC960_Controller_T *Controller = (DAC960_Controller_T *) Data;
@@ -6543,8 +6545,8 @@
       return DAC960_ControllerCount;
     case DAC960_IOCTL_GET_CONTROLLER_INFO:
       {
-	DAC960_ControllerInfo_T *UserSpaceControllerInfo =
-	  (DAC960_ControllerInfo_T *) Argument;
+	DAC960_ControllerInfo_T __user *UserSpaceControllerInfo =
+	  (DAC960_ControllerInfo_T __user *) Argument;
 	DAC960_ControllerInfo_T ControllerInfo;
 	DAC960_Controller_T *Controller;
 	int ControllerNumber;
@@ -6574,8 +6576,8 @@
       }
     case DAC960_IOCTL_V1_EXECUTE_COMMAND:
       {
-	DAC960_V1_UserCommand_T *UserSpaceUserCommand =
-	  (DAC960_V1_UserCommand_T *) Argument;
+	DAC960_V1_UserCommand_T __user *UserSpaceUserCommand =
+	  (DAC960_V1_UserCommand_T __user *) Argument;
 	DAC960_V1_UserCommand_T UserCommand;
 	DAC960_Controller_T *Controller;
 	DAC960_Command_T *Command = NULL;
@@ -6734,8 +6736,8 @@
       }
     case DAC960_IOCTL_V2_EXECUTE_COMMAND:
       {
-	DAC960_V2_UserCommand_T *UserSpaceUserCommand =
-	  (DAC960_V2_UserCommand_T *) Argument;
+	DAC960_V2_UserCommand_T __user *UserSpaceUserCommand =
+	  (DAC960_V2_UserCommand_T __user *) Argument;
 	DAC960_V2_UserCommand_T UserCommand;
 	DAC960_Controller_T *Controller;
 	DAC960_Command_T *Command = NULL;
@@ -6888,8 +6890,8 @@
       }
     case DAC960_IOCTL_V2_GET_HEALTH_STATUS:
       {
-	DAC960_V2_GetHealthStatus_T *UserSpaceGetHealthStatus =
-	  (DAC960_V2_GetHealthStatus_T *) Argument;
+	DAC960_V2_GetHealthStatus_T __user *UserSpaceGetHealthStatus =
+	  (DAC960_V2_GetHealthStatus_T __user *) Argument;
 	DAC960_V2_GetHealthStatus_T GetHealthStatus;
 	DAC960_V2_HealthStatusBuffer_T HealthStatusBuffer;
 	DAC960_Controller_T *Controller;
diff -Nru a/drivers/block/DAC960.h b/drivers/block/DAC960.h
--- a/drivers/block/DAC960.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/block/DAC960.h	Tue Jun 15 22:20:43 2004
@@ -1914,8 +1914,8 @@
   unsigned char ControllerNumber;
   DAC960_V1_CommandMailbox_T CommandMailbox;
   int DataTransferLength;
-  void *DataTransferBuffer;
-  DAC960_V1_DCDB_T *DCDB;
+  void __user *DataTransferBuffer;
+  DAC960_V1_DCDB_T __user *DCDB;
 }
 DAC960_V1_UserCommand_T;
 
@@ -1948,8 +1948,8 @@
   DAC960_V2_CommandMailbox_T CommandMailbox;
   int DataTransferLength;
   int RequestSenseLength;
-  void *DataTransferBuffer;
-  void *RequestSenseBuffer;
+  void __user *DataTransferBuffer;
+  void __user *RequestSenseBuffer;
 }
 DAC960_V2_UserCommand_T;
 
@@ -1980,7 +1980,7 @@
 typedef struct DAC960_V2_GetHealthStatus
 {
   unsigned char ControllerNumber;
-  DAC960_V2_HealthStatusBuffer_T *HealthStatusBuffer;
+  DAC960_V2_HealthStatusBuffer_T __user *HealthStatusBuffer;
 }
 DAC960_V2_GetHealthStatus_T;
 
diff -Nru a/drivers/block/Kconfig b/drivers/block/Kconfig
--- a/drivers/block/Kconfig	Tue Jun 15 22:20:38 2004
+++ b/drivers/block/Kconfig	Tue Jun 15 22:20:38 2004
@@ -321,12 +321,13 @@
 	  thus say N here.
 
 config BLK_DEV_RAM_SIZE
-	int "Default RAM disk size"
+	int "Default RAM disk size (kbytes)"
 	depends on BLK_DEV_RAM
 	default "4096"
 	help
-	  The default value is 4096. Only change this if you know what are
-	  you doing. If you are using IBM S/390, then set this to 8192.
+	  The default value is 4096 kilobytes. Only change this if you know
+	  what are you doing. If you are using IBM S/390, then set this to
+	  8192.
 
 config BLK_DEV_INITRD
 	bool "Initial RAM disk (initrd) support"
diff -Nru a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
--- a/drivers/block/as-iosched.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/block/as-iosched.c	Tue Jun 15 22:20:36 2004
@@ -43,7 +43,7 @@
  * read_batch_expire describes how long we will allow a stream of reads to
  * persist before looking to see whether it is time to switch over to writes.
  */
-#define default_read_batch_expire (HZ / 4)
+#define default_read_batch_expire (HZ / 2)
 
 /*
  * write_batch_expire describes how long we want a stream of writes to run for.
@@ -51,7 +51,7 @@
  * See, the problem is: we can send a lot of writes to disk cache / TCQ in
  * a short amount of time...
  */
-#define default_write_batch_expire (HZ / 16)
+#define default_write_batch_expire (HZ / 8)
 
 /*
  * max time we may wait to anticipate a read (default around 6ms)
@@ -1216,13 +1216,12 @@
 	}
 
 	as_remove_queued_request(ad->q, rq);
+	WARN_ON(arq->state != AS_RQ_QUEUED);
+
 	list_add(&rq->queuelist, insert);
+	arq->state = AS_RQ_DISPATCHED;
 	if (arq->io_context && arq->io_context->aic)
 		atomic_inc(&arq->io_context->aic->nr_dispatched);
-
-	WARN_ON(arq->state != AS_RQ_QUEUED);
-	arq->state = AS_RQ_DISPATCHED;
-
 	ad->nr_dispatched++;
 }
 
@@ -1492,6 +1491,21 @@
 	as_antic_stop(ad);
 }
 
+/*
+ * 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
+ * our explicit requeue handler.
+ */
+static void as_account_queued_request(struct as_data *ad, struct request *rq)
+{
+	if (blk_fs_request(rq)) {
+		struct as_rq *arq = RQ_DATA(rq);
+		arq->state = AS_RQ_DISPATCHED;
+		ad->nr_dispatched++;
+	}
+}
+
 static void
 as_insert_request(request_queue_t *q, struct request *rq, int where)
 {
@@ -1522,10 +1536,12 @@
 				as_move_to_dispatch(ad, ad->next_arq[REQ_ASYNC]);
 
 			list_add_tail(&rq->queuelist, ad->dispatch);
+			as_account_queued_request(ad, rq);
 			as_antic_stop(ad);
 			break;
 		case ELEVATOR_INSERT_FRONT:
 			list_add(&rq->queuelist, ad->dispatch);
+			as_account_queued_request(ad, rq);
 			as_antic_stop(ad);
 			break;
 		case ELEVATOR_INSERT_SORT:
diff -Nru a/drivers/block/carmel.c b/drivers/block/carmel.c
--- a/drivers/block/carmel.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/block/carmel.c	Tue Jun 15 22:20:43 2004
@@ -413,7 +413,7 @@
 static int carm_bdev_ioctl(struct inode *ino, struct file *fil,
 			   unsigned int cmd, unsigned long arg)
 {
-	void __user *usermem = (void *) arg;
+	void __user *usermem = (void __user *) arg;
 	struct carm_port *port = ino->i_bdev->bd_disk->private_data;
 	struct hd_geometry geom;
 
@@ -436,17 +436,6 @@
 	}
 
 	return -EOPNOTSUPP;
-}
-
-static inline unsigned long msecs_to_jiffies(unsigned long msecs)
-{
-	return ((HZ * msecs + 999) / 1000);
-}
-
-static void msleep(unsigned long msecs)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(msecs));
 }
 
 static const u32 msg_sizes[] = { 32, 64, 128, CARM_MSG_SIZE };
diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c
--- a/drivers/block/cciss.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/block/cciss.c	Tue Jun 15 22:21:03 2004
@@ -135,7 +135,6 @@
 
 static void cciss_getgeometry(int cntl_num);
 
-static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c);
 static void start_io( ctlr_info_t *h);
 static int sendcmd( __u8 cmd, int ctlr, void *buff, size_t size,
 	unsigned int use_unit_num, unsigned int log_unit, __u8 page_code,
@@ -157,6 +156,36 @@
 	.revalidate_disk= cciss_revalidate,
 };
 
+/*
+ * Enqueuing and dequeuing functions for cmdlists.
+ */
+static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c)
+{
+        if (*Qptr == NULL) {
+                *Qptr = c;
+                c->next = c->prev = c;
+        } else {
+                c->prev = (*Qptr)->prev;
+                c->next = (*Qptr);
+                (*Qptr)->prev->next = c;
+                (*Qptr)->prev = c;
+        }
+}
+
+static inline CommandList_struct *removeQ(CommandList_struct **Qptr, 
+						CommandList_struct *c)
+{
+        if (c && c->next != c) {
+                if (*Qptr == c) *Qptr = c->next;
+                c->prev->next = c->next;
+                c->next->prev = c->prev;
+        } else {
+                *Qptr = NULL;
+        }
+        return c;
+}
+#ifdef CONFIG_PROC_FS
+
 #include "cciss_scsi.c"		/* For SCSI tape support */
 
 /*
@@ -167,7 +196,6 @@
 #define RAID_UNKNOWN 6
 static const char *raid_label[] = {"0","4","1(0+1)","5","5+1","ADG",
 	                                   "UNKNOWN"};
-#ifdef CONFIG_PROC_FS
 
 static struct proc_dir_entry *proc_cciss;
 
@@ -257,7 +285,7 @@
 }
 
 static int 
-cciss_proc_write(struct file *file, const char *buffer, 
+cciss_proc_write(struct file *file, const char __user *buffer, 
 			unsigned long count, void *data)
 {
 	unsigned char cmd[80];
@@ -462,6 +490,7 @@
 	ctlr_info_t *host = get_host(disk);
 	drive_info_struct *drv = get_drv(disk);
 	int ctlr = host->ctlr;
+	void __user *argp = (void __user *)arg;
 
 #ifdef CCISS_DEBUG
 	printk(KERN_DEBUG "cciss_ioctl: Called with cmd=%x %lx\n", cmd, arg);
@@ -478,8 +507,7 @@
                 } else
 			return -ENXIO;
                 driver_geo.start= get_start_sect(inode->i_bdev);
-                if (copy_to_user((void *) arg, &driver_geo,
-                                sizeof( struct hd_geometry)))
+                if (copy_to_user(argp, &driver_geo, sizeof(struct hd_geometry)))
                         return  -EFAULT;
                 return(0);
 	}
@@ -492,7 +520,7 @@
 		pciinfo.bus = host->pdev->bus->number;
 		pciinfo.dev_fn = host->pdev->devfn;
 		pciinfo.board_id = host->board_id;
-		if (copy_to_user((void *) arg, &pciinfo,  sizeof( cciss_pci_info_struct )))
+		if (copy_to_user(argp, &pciinfo,  sizeof( cciss_pci_info_struct )))
 			return  -EFAULT;
 		return(0);
 	}	
@@ -502,7 +530,7 @@
 		if (!arg) return -EINVAL;
 		intinfo.delay = readl(&host->cfgtable->HostWrite.CoalIntDelay);
 		intinfo.count = readl(&host->cfgtable->HostWrite.CoalIntCount);
-		if (copy_to_user((void *) arg, &intinfo, sizeof( cciss_coalint_struct )))
+		if (copy_to_user(argp, &intinfo, sizeof( cciss_coalint_struct )))
 			return -EFAULT;
                 return(0);
         }
@@ -514,7 +542,7 @@
 
 		if (!arg) return -EINVAL;	
 		if (!capable(CAP_SYS_ADMIN)) return -EPERM;
-		if (copy_from_user(&intinfo, (void *) arg, sizeof( cciss_coalint_struct)))
+		if (copy_from_user(&intinfo, argp, sizeof( cciss_coalint_struct)))
 			return -EFAULT;
 		if ( (intinfo.delay == 0 ) && (intinfo.count == 0))
 
@@ -550,7 +578,7 @@
 		if (!arg) return -EINVAL;
 		for(i=0;i<16;i++)
 			NodeName[i] = readb(&host->cfgtable->ServerName[i]);
-                if (copy_to_user((void *) arg, NodeName, sizeof( NodeName_type)))
+                if (copy_to_user(argp, NodeName, sizeof( NodeName_type)))
                 	return  -EFAULT;
                 return(0);
         }
@@ -563,7 +591,7 @@
 		if (!arg) return -EINVAL;
 		if (!capable(CAP_SYS_ADMIN)) return -EPERM;
 		
-		if (copy_from_user(NodeName, (void *) arg, sizeof( NodeName_type)))
+		if (copy_from_user(NodeName, argp, sizeof( NodeName_type)))
 			return -EFAULT;
 
 		spin_lock_irqsave(CCISS_LOCK(ctlr), flags);
@@ -593,7 +621,7 @@
 
 		if (!arg) return -EINVAL;
                 heartbeat = readl(&host->cfgtable->HeartBeat);
-                if (copy_to_user((void *) arg, &heartbeat, sizeof( Heartbeat_type)))
+                if (copy_to_user(argp, &heartbeat, sizeof( Heartbeat_type)))
                 	return -EFAULT;
                 return(0);
         }
@@ -603,7 +631,7 @@
 
 		if (!arg) return -EINVAL;
                 BusTypes = readl(&host->cfgtable->BusTypes);
-                if (copy_to_user((void *) arg, &BusTypes, sizeof( BusTypes_type) ))
+                if (copy_to_user(argp, &BusTypes, sizeof( BusTypes_type) ))
                 	return  -EFAULT;
                 return(0);
         }
@@ -614,7 +642,7 @@
 		if (!arg) return -EINVAL;
 		memcpy(firmware, host->firm_ver, 4);
 
-                if (copy_to_user((void *) arg, firmware, sizeof( FirmwareVer_type)))
+                if (copy_to_user(argp, firmware, sizeof( FirmwareVer_type)))
                 	return -EFAULT;
                 return(0);
         }
@@ -624,7 +652,7 @@
 
                 if (!arg) return -EINVAL;
 
-                if (copy_to_user((void *) arg, &DriverVer, sizeof( DriverVer_type) ))
+                if (copy_to_user(argp, &DriverVer, sizeof( DriverVer_type) ))
                 	return -EFAULT;
                 return(0);
         }
@@ -648,7 +676,7 @@
 			if (disk->part[i]->nr_sects != 0)
 				luninfo.num_parts++;
 		}
- 		if (copy_to_user((void *) arg, &luninfo,
+ 		if (copy_to_user(argp, &luninfo,
  				sizeof(LogvolInfo_struct)))
  			return -EFAULT;
  		return(0);
@@ -672,7 +700,7 @@
 	
 		if (!capable(CAP_SYS_RAWIO)) return -EPERM;
 
-		if (copy_from_user(&iocommand, (void *) arg, sizeof( IOCTL_Command_struct) ))
+		if (copy_from_user(&iocommand, argp, sizeof( IOCTL_Command_struct) ))
 			return -EFAULT;
 		if((iocommand.buf_size < 1) && 
 				(iocommand.Request.Type.Direction != XFER_NONE))
@@ -753,7 +781,7 @@
 
 		/* Copy the error information out */ 
 		iocommand.error_info = *(c->err_info);
-		if ( copy_to_user((void *) arg, &iocommand, sizeof( IOCTL_Command_struct) ) )
+		if ( copy_to_user(argp, &iocommand, sizeof( IOCTL_Command_struct) ) )
 		{
 			kfree(buff);
 			cmd_free(host, c, 0);
@@ -787,7 +815,7 @@
 		DECLARE_COMPLETION(wait);
 		__u32   left;
 		__u32	sz;
-		BYTE    *data_ptr;
+		BYTE    __user *data_ptr;
 
 		if (!arg)
 			return -EINVAL;
@@ -799,7 +827,7 @@
 			status = -ENOMEM;
 			goto cleanup1;
 		}
-		if (copy_from_user(ioc, (void *) arg, sizeof(*ioc))) {
+		if (copy_from_user(ioc, argp, sizeof(*ioc))) {
 			status = -EFAULT;
 			goto cleanup1;
 		}
@@ -831,7 +859,7 @@
 			goto cleanup1;
 		}
 		left = ioc->buf_size;
-		data_ptr = (BYTE *) ioc->buf;
+		data_ptr = ioc->buf;
 		while (left) {
 			sz = (left > ioc->malloc_size) ? ioc->malloc_size : left;
 			buff_size[sg_used] = sz;
@@ -896,14 +924,14 @@
 		}
 		/* Copy the error information out */
 		ioc->error_info = *(c->err_info);
-		if (copy_to_user((void *) arg, ioc, sizeof(*ioc))) {
+		if (copy_to_user(argp, ioc, sizeof(*ioc))) {
 			cmd_free(host, c, 0);
 			status = -EFAULT;
 			goto cleanup1;
 		}
 		if (ioc->Request.Type.Direction == XFER_READ) {
 			/* Copy the data out of the buffer we created */
-			BYTE *ptr = (BYTE  *) ioc->buf;
+			BYTE __user *ptr = ioc->buf;
 	        	for(i=0; i< sg_used; i++) {
 				if (copy_to_user(ptr, buff[i], buff_size[i])) {
 					cmd_free(host, c, 0);
@@ -1683,35 +1711,6 @@
         ulong page_remapped    = (ulong) ioremap(page_base, page_offs+size);
 
         return (ulong) (page_remapped ? (page_remapped + page_offs) : 0UL);
-}
-
-/*
- * Enqueuing and dequeuing functions for cmdlists.
- */
-static inline void addQ(CommandList_struct **Qptr, CommandList_struct *c)
-{
-        if (*Qptr == NULL) {
-                *Qptr = c;
-                c->next = c->prev = c;
-        } else {
-                c->prev = (*Qptr)->prev;
-                c->next = (*Qptr);
-                (*Qptr)->prev->next = c;
-                (*Qptr)->prev = c;
-        }
-}
-
-static inline CommandList_struct *removeQ(CommandList_struct **Qptr, 
-						CommandList_struct *c)
-{
-        if (c && c->next != c) {
-                if (*Qptr == c) *Qptr = c->next;
-                c->prev->next = c->next;
-                c->next->prev = c->prev;
-        } else {
-                *Qptr = NULL;
-        }
-        return c;
 }
 
 /* 
diff -Nru a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
--- a/drivers/block/cpqarray.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/block/cpqarray.c	Tue Jun 15 22:20:37 2004
@@ -418,7 +418,8 @@
 	}
 	hba[i]->access.set_intr_mask(hba[i], 0);
 	if (request_irq(hba[i]->intr, do_ida_intr,
-		SA_INTERRUPT|SA_SHIRQ, hba[i]->devname, hba[i]))
+		SA_INTERRUPT|SA_SHIRQ|SA_SAMPLE_RANDOM,
+		hba[i]->devname, hba[i]))
 	{
 		printk(KERN_ERR "cpqarray: Unable to get irq %d for %s\n",
 				hba[i]->intr, hba[i]->devname);
@@ -1156,8 +1157,8 @@
 	ctlr_info_t *host = get_host(inode->i_bdev->bd_disk);
 	int error;
 	int diskinfo[4];
-	struct hd_geometry *geo = (struct hd_geometry *)arg;
-	ida_ioctl_t *io = (ida_ioctl_t*)arg;
+	struct hd_geometry __user *geo = (struct hd_geometry __user *)arg;
+	ida_ioctl_t __user *io = (ida_ioctl_t __user *)arg;
 	ida_ioctl_t *my_io;
 
 	switch(cmd) {
@@ -1193,7 +1194,7 @@
 		if (error)
 			goto out_passthru;
 		error = -EFAULT;
-		if (copy_to_user(io, &my_io, sizeof(*my_io)))
+		if (copy_to_user(io, my_io, sizeof(*my_io)))
 			goto out_passthru;
 		error = 0;
 out_passthru:
@@ -1201,7 +1202,7 @@
 		return error;
 	case IDAGETCTLRSIG:
 		if (!arg) return -EINVAL;
-		put_user(host->ctlr_sig, (int*)arg);
+		put_user(host->ctlr_sig, (int __user *)arg);
 		return 0;
 	case IDAREVALIDATEVOLS:
 		if (iminor(inode) != 0)
@@ -1209,7 +1210,7 @@
 		return revalidate_allvol(host);
 	case IDADRIVERVERSION:
 		if (!arg) return -EINVAL;
-		put_user(DRIVER_VERSION, (unsigned long*)arg);
+		put_user(DRIVER_VERSION, (unsigned long __user *)arg);
 		return 0;
 	case IDAGETPCIINFO:
 	{
@@ -1220,7 +1221,7 @@
 		pciinfo.bus = host->pci_dev->bus->number;
 		pciinfo.dev_fn = host->pci_dev->devfn;
 		pciinfo.board_id = host->board_id;
-		if(copy_to_user((void *) arg, &pciinfo,  
+		if(copy_to_user((void __user *) arg, &pciinfo,  
 			sizeof( ida_pci_info_struct)))
 				return -EFAULT;
 		return(0);
@@ -1271,7 +1272,7 @@
 			cmd_free(h, c, 0); 
 			return(error);
 		}
-		if (copy_from_user(p, (void*)io->sg[0].addr, io->sg[0].size)) {
+		if (copy_from_user(p, io->sg[0].addr, io->sg[0].size)) {
 			kfree(p);
 			cmd_free(h, c, 0); 
 			return -EFAULT;
@@ -1312,7 +1313,7 @@
                         cmd_free(h, c, 0);
                         return(error);
                 }
-		if (copy_from_user(p, (void*)io->sg[0].addr, io->sg[0].size)) {
+		if (copy_from_user(p, io->sg[0].addr, io->sg[0].size)) {
 			kfree(p);
                         cmd_free(h, c, 0);
 			return -EFAULT;
@@ -1353,7 +1354,7 @@
 	case DIAG_PASS_THRU:
 	case SENSE_CONTROLLER_PERFORMANCE:
 	case READ_FLASH_ROM:
-		if (copy_to_user((void*)io->sg[0].addr, p, io->sg[0].size)) {
+		if (copy_to_user(io->sg[0].addr, p, io->sg[0].size)) {
 			kfree(p);
 			return -EFAULT;
 		}
diff -Nru a/drivers/block/elevator.c b/drivers/block/elevator.c
--- a/drivers/block/elevator.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/block/elevator.c	Tue Jun 15 22:20:43 2004
@@ -169,6 +169,13 @@
 void __elv_add_request(request_queue_t *q, struct request *rq, int where,
 		       int plug)
 {
+	/*
+	 * barriers implicitly indicate back insertion
+	 */
+	if (rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER) &&
+	    where == ELEVATOR_INSERT_SORT)
+		where = ELEVATOR_INSERT_BACK;
+
 	if (plug)
 		blk_plug_device(q);
 
diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c
--- a/drivers/block/floppy.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/block/floppy.c	Tue Jun 15 22:20:37 2004
@@ -604,28 +604,27 @@
 }
 #endif
 
-#ifdef DEBUGT
-static long unsigned debugtimer;
-#endif
-
 /*
  * Debugging
  * =========
  */
+#ifdef DEBUGT
+static long unsigned debugtimer;
+
 static inline void set_debugt(void)
 {
-#ifdef DEBUGT
 	debugtimer = jiffies;
-#endif
 }
 
 static inline void debugt(const char *message)
 {
-#ifdef DEBUGT
 	if (DP->flags & DEBUGT)
 		printk("%s dtime=%lu\n", message, jiffies - debugtimer);
-#endif
 }
+#else
+static inline void set_debugt(void) { }
+static inline void debugt(const char *message) { }
+#endif /* DEBUGT */
 
 typedef void (*timeout_fn) (unsigned long);
 static struct timer_list fd_timeout = TIMER_INITIALIZER(floppy_shutdown, 0, 0);
@@ -1546,9 +1545,8 @@
 	for (i = 0; i < raw_cmd->cmd_count; i++)
 		r |= output_byte(raw_cmd->cmd[i]);
 
-#ifdef DEBUGT
 	debugt("rw_command: ");
-#endif
+
 	if (r) {
 		cont->error();
 		reset_fdc();
@@ -1570,9 +1568,7 @@
  */
 static void seek_interrupt(void)
 {
-#ifdef DEBUGT
 	debugt("seek interrupt:");
-#endif
 	if (inr != 2 || (ST0 & 0xF8) != 0x20) {
 		DPRINT("seek failed\n");
 		DRS->track = NEED_2_RECAL;
@@ -1676,24 +1672,18 @@
 	output_byte(FD_SEEK);
 	output_byte(UNIT(current_drive));
 	LAST_OUT(track);
-#ifdef DEBUGT
 	debugt("seek command:");
-#endif
 }
 
 static void recal_interrupt(void)
 {
-#ifdef DEBUGT
 	debugt("recal interrupt:");
-#endif
 	if (inr != 2)
 		FDCS->reset = 1;
 	else if (ST0 & ST0_ECE) {
 		switch (DRS->track) {
 		case NEED_1_RECAL:
-#ifdef DEBUGT
 			debugt("recal interrupt need 1 recal:");
-#endif
 			/* after a second recalibrate, we still haven't
 			 * reached track 0. Probably no drive. Raise an
 			 * error, as failing immediately might upset
@@ -1702,9 +1692,7 @@
 			cont->redo();
 			return;
 		case NEED_2_RECAL:
-#ifdef DEBUGT
 			debugt("recal interrupt need 2 recal:");
-#endif
 			/* If we already did a recalibrate,
 			 * and we are not at track 0, this
 			 * means we have moved. (The only way
@@ -1722,9 +1710,7 @@
 			DRS->select_date = jiffies;
 			/* fall through */
 		default:
-#ifdef DEBUGT
 			debugt("recal interrupt default:");
-#endif
 			/* Recalibrate moves the head by at
 			 * most 80 steps. If after one
 			 * recalibrate we don't have reached
@@ -1813,9 +1799,7 @@
 
 static void recalibrate_floppy(void)
 {
-#ifdef DEBUGT
 	debugt("recalibrate floppy:");
-#endif
 	do_floppy = recal_interrupt;
 	output_byte(FD_RECALIBRATE);
 	LAST_OUT(UNIT(current_drive));
@@ -1826,9 +1810,7 @@
  */
 static void reset_interrupt(void)
 {
-#ifdef DEBUGT
 	debugt("reset interrupt:");
-#endif
 	result();		/* get the status ready for set_fdc */
 	if (FDCS->reset) {
 		printk("reset set in interrupt, calling %p\n", cont->error);
@@ -2266,9 +2248,7 @@
 	buffer_track = -1;
 	setup_format_params(format_req.track << STRETCH(_floppy));
 	floppy_start();
-#ifdef DEBUGT
 	debugt("queue format request");
-#endif
 }
 
 static struct cont_t format_cont = {
@@ -2992,9 +2972,7 @@
 		if (TESTF(FD_NEED_TWADDLE))
 			twaddle();
 		schedule_bh(floppy_start);
-#ifdef DEBUGT
 		debugt("queue fd request");
-#endif
 		return;
 	}
 #undef REPEAT
@@ -3101,19 +3079,19 @@
  * Misc Ioctl's and support
  * ========================
  */
-static inline int fd_copyout(void *param, const void *address,
+static inline int fd_copyout(void __user *param, const void *address,
 			     unsigned long size)
 {
 	return copy_to_user(param, address, size) ? -EFAULT : 0;
 }
 
-static inline int fd_copyin(void *param, void *address, unsigned long size)
+static inline int fd_copyin(void __user *param, void *address, unsigned long size)
 {
 	return copy_from_user(address, param, size) ? -EFAULT : 0;
 }
 
-#define _COPYOUT(x) (copy_to_user((void *)param, &(x), sizeof(x)) ? -EFAULT : 0)
-#define _COPYIN(x) (copy_from_user(&(x), (void *)param, sizeof(x)) ? -EFAULT : 0)
+#define _COPYOUT(x) (copy_to_user((void __user *)param, &(x), sizeof(x)) ? -EFAULT : 0)
+#define _COPYIN(x) (copy_from_user(&(x), (void __user *)param, sizeof(x)) ? -EFAULT : 0)
 
 #define COPYOUT(x) ECALL(_COPYOUT(x))
 #define COPYIN(x) ECALL(_COPYIN(x))
@@ -3188,7 +3166,7 @@
 	.done		= raw_cmd_done
 };
 
-static inline int raw_cmd_copyout(int cmd, char *param,
+static inline int raw_cmd_copyout(int cmd, char __user *param,
 				  struct floppy_raw_cmd *ptr)
 {
 	int ret;
@@ -3226,7 +3204,7 @@
 	}
 }
 
-static inline int raw_cmd_copyin(int cmd, char *param,
+static inline int raw_cmd_copyin(int cmd, char __user *param,
 				 struct floppy_raw_cmd **rcmd)
 {
 	struct floppy_raw_cmd *ptr;
@@ -3280,7 +3258,7 @@
 	}
 }
 
-static int raw_cmd_ioctl(int cmd, void *param)
+static int raw_cmd_ioctl(int cmd, void __user *param)
 {
 	int drive, ret, ret2;
 	struct floppy_raw_cmd *my_raw_cmd;
@@ -3530,7 +3508,7 @@
 	/* copyin */
 	CLEARSTRUCT(&inparam);
 	if (_IOC_DIR(cmd) & _IOC_WRITE)
-	    ECALL(fd_copyin((void *)param, &inparam, size))
+	    ECALL(fd_copyin((void __user *)param, &inparam, size))
 
 		switch (cmd) {
 		case FDEJECT:
@@ -3626,7 +3604,7 @@
 				return -EINVAL;
 			LOCK_FDC(drive, 1);
 			set_floppy(drive);
-			CALL(i = raw_cmd_ioctl(cmd, (void *)param));
+			CALL(i = raw_cmd_ioctl(cmd, (void __user *)param));
 			process_fd_request();
 			return i;
 
@@ -3641,7 +3619,7 @@
 		}
 
 	if (_IOC_DIR(cmd) & _IOC_READ)
-		return fd_copyout((void *)param, outparam, size);
+		return fd_copyout((void __user *)param, outparam, size);
 	else
 		return 0;
 #undef OUT
@@ -4247,35 +4225,40 @@
 int __init floppy_init(void)
 {
 	int i, unit, drive;
-	int err;
+	int err, dr;
 
 	raw_cmd = NULL;
+	i = 0;
 
-	for (i = 0; i < N_DRIVE; i++) {
-		disks[i] = alloc_disk(1);
-		if (!disks[i])
-			goto Enomem;
-
-		disks[i]->major = FLOPPY_MAJOR;
-		disks[i]->first_minor = TOMINOR(i);
-		disks[i]->fops = &floppy_fops;
-		sprintf(disks[i]->disk_name, "fd%d", i);
-
-		init_timer(&motor_off_timer[i]);
-		motor_off_timer[i].data = i;
-		motor_off_timer[i].function = motor_off_callback;
+	for (dr = 0; dr < N_DRIVE; dr++) {
+		disks[dr] = alloc_disk(1);
+		if (!disks[dr]) {
+			err = -ENOMEM;
+			goto out_put_disk;
+		}
+
+		disks[dr]->major = FLOPPY_MAJOR;
+		disks[dr]->first_minor = TOMINOR(dr);
+		disks[dr]->fops = &floppy_fops;
+		sprintf(disks[dr]->disk_name, "fd%d", dr);
+
+		init_timer(&motor_off_timer[dr]);
+		motor_off_timer[dr].data = dr;
+		motor_off_timer[dr].function = motor_off_callback;
 	}
 
 	devfs_mk_dir("floppy");
-	if ((err = register_blkdev(FLOPPY_MAJOR, "fd")))
-		goto out;
+
+	err = register_blkdev(FLOPPY_MAJOR, "fd");
+	if (err)
+		goto out_devfs_remove;
 
 	floppy_queue = blk_init_queue(do_fd_request, &floppy_lock);
-	blk_queue_max_sectors(floppy_queue, 64);
 	if (!floppy_queue) {
 		err = -ENOMEM;
-		goto fail_queue;
+		goto out_unreg_blkdev;
 	}
+	blk_queue_max_sectors(floppy_queue, 64);
 
 	blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,
 			    floppy_find, NULL, NULL);
@@ -4306,17 +4289,20 @@
 	use_virtual_dma = can_use_virtual_dma & 1;
 	fdc_state[0].address = FDC1;
 	if (fdc_state[0].address == -1) {
+		del_timer(&fd_timeout);
 		err = -ENODEV;
-		goto out1;
+		goto out_unreg_region;
 	}
 #if N_FDC > 1
 	fdc_state[1].address = FDC2;
 #endif
 
 	fdc = 0;		/* reset fdc in case of unexpected interrupt */
-	if (floppy_grab_irq_and_dma()) {
+	err = floppy_grab_irq_and_dma();
+	if (err) {
+		del_timer(&fd_timeout);
 		err = -EBUSY;
-		goto out1;
+		goto out_unreg_region;
 	}
 
 	/* initialise drive state */
@@ -4373,11 +4359,8 @@
 	initialising = 0;
 	if (have_no_fdc) {
 		DPRINT("no floppy controllers found\n");
-		flush_scheduled_work();
-		if (usage_count)
-			floppy_release_irq_and_dma();
 		err = have_no_fdc;
-		goto out2;
+		goto out_flush_work;
 	}
 
 	for (drive = 0; drive < N_DRIVE; drive++) {
@@ -4392,26 +4375,37 @@
 		add_disk(disks[drive]);
 	}
 
-	platform_device_register(&floppy_device);
+	err = platform_device_register(&floppy_device);
+	if (err)
+		goto out_del_disk;
+
 	return 0;
 
-out1:
-	del_timer(&fd_timeout);
-out2:
+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)
+		floppy_release_irq_and_dma();
+out_unreg_region:
 	blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
 	blk_cleanup_queue(floppy_queue);
-fail_queue:
+out_unreg_blkdev:
 	unregister_blkdev(FLOPPY_MAJOR, "fd");
-out:
-	for (i = 0; i < N_DRIVE; i++)
-		put_disk(disks[i]);
+out_devfs_remove:
 	devfs_remove("floppy");
+out_put_disk:
+	while (dr--) {
+		del_timer(&motor_off_timer[dr]);
+		put_disk(disks[dr]);
+	}
 	return err;
-
-Enomem:
-	while (i--)
-		put_disk(disks[i]);
-	return -ENOMEM;
 }
 
 static spinlock_t floppy_usage_lock = SPIN_LOCK_UNLOCKED;
diff -Nru a/drivers/block/floppy98.c b/drivers/block/floppy98.c
--- a/drivers/block/floppy98.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/block/floppy98.c	Tue Jun 15 22:20:39 2004
@@ -704,15 +704,16 @@
 
 static void reschedule_timeout(int drive, const char *message, int marg)
 {
+	unsigned long delay;
+
 	if (drive == current_reqD)
 		drive = current_drive;
-	del_timer(&fd_timeout);
 	if (drive < 0 || drive > N_DRIVE) {
-		fd_timeout.expires = jiffies + 20UL*HZ;
+		delay = 20UL*HZ;
 		drive=0;
 	} else
-		fd_timeout.expires = jiffies + UDP->timeout;
-	add_timer(&fd_timeout);
+		delay = UDP->timeout;
+	mod_timer(&fd_timeout, delay + jiffies);
 	if (UDP->flags & FD_DEBUG){
 		DPRINT("reschedule timeout ");
 		printk(message, marg);
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
--- a/drivers/block/genhd.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/block/genhd.c	Tue Jun 15 22:20:40 2004
@@ -357,16 +357,6 @@
 	return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk));
 }
 
-static inline unsigned jiffies_to_msec(unsigned jif)
-{
-#if 1000 % HZ == 0
-	return jif * (1000 / HZ);
-#elif HZ % 1000 == 0
-	return jif / (HZ / 1000);
-#else
-	return (jif / HZ) * 1000 + (jif % HZ) * 1000 / HZ;
-#endif
-}
 static ssize_t disk_stats_read(struct gendisk * disk, char *page)
 {
 	disk_round_stats(disk);
@@ -377,14 +367,14 @@
 		"\n",
 		disk_stat_read(disk, reads), disk_stat_read(disk, read_merges),
 		(unsigned long long)disk_stat_read(disk, read_sectors),
-		jiffies_to_msec(disk_stat_read(disk, read_ticks)),
+		jiffies_to_msecs(disk_stat_read(disk, read_ticks)),
 		disk_stat_read(disk, writes), 
 		disk_stat_read(disk, write_merges),
 		(unsigned long long)disk_stat_read(disk, write_sectors),
-		jiffies_to_msec(disk_stat_read(disk, write_ticks)),
+		jiffies_to_msecs(disk_stat_read(disk, write_ticks)),
 		disk->in_flight,
-		jiffies_to_msec(disk_stat_read(disk, io_ticks)),
-		jiffies_to_msec(disk_stat_read(disk, time_in_queue)));
+		jiffies_to_msecs(disk_stat_read(disk, io_ticks)),
+		jiffies_to_msecs(disk_stat_read(disk, time_in_queue)));
 }
 static struct disk_attribute disk_attr_dev = {
 	.attr = {.name = "dev", .mode = S_IRUGO },
@@ -498,13 +488,13 @@
 		gp->major, n + gp->first_minor, disk_name(gp, n, buf),
 		disk_stat_read(gp, reads), disk_stat_read(gp, read_merges),
 		(unsigned long long)disk_stat_read(gp, read_sectors),
-		jiffies_to_msec(disk_stat_read(gp, read_ticks)),
+		jiffies_to_msecs(disk_stat_read(gp, read_ticks)),
 		disk_stat_read(gp, writes), disk_stat_read(gp, write_merges),
 		(unsigned long long)disk_stat_read(gp, write_sectors),
-		jiffies_to_msec(disk_stat_read(gp, write_ticks)),
+		jiffies_to_msecs(disk_stat_read(gp, write_ticks)),
 		gp->in_flight,
-		jiffies_to_msec(disk_stat_read(gp, io_ticks)),
-		jiffies_to_msec(disk_stat_read(gp, time_in_queue)));
+		jiffies_to_msecs(disk_stat_read(gp, io_ticks)),
+		jiffies_to_msecs(disk_stat_read(gp, time_in_queue)));
 
 	/* now show all non-0 size partitions of it */
 	for (n = 0; n < gp->minors - 1; n++) {
diff -Nru a/drivers/block/ida_cmd.h b/drivers/block/ida_cmd.h
--- a/drivers/block/ida_cmd.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/block/ida_cmd.h	Tue Jun 15 22:20:38 2004
@@ -67,7 +67,7 @@
 	__u8	reserved;
 } rhdr_t;
 
-#define SG_MAX			31
+#define SG_MAX			32
 typedef struct {
 	rhdr_t	hdr;
 	sg_t	sg[SG_MAX];
diff -Nru a/drivers/block/ida_ioctl.h b/drivers/block/ida_ioctl.h
--- a/drivers/block/ida_ioctl.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/block/ida_ioctl.h	Tue Jun 15 22:20:40 2004
@@ -57,7 +57,7 @@
 
 /* currently, sg_cnt is assumed to be 1: only the 0th element of sg is used */
 	struct {
-		void	*addr;
+		void	__user *addr;
 		size_t	size;
 	} sg[SG_MAX];
 	int	sg_cnt;
diff -Nru a/drivers/block/ioctl.c b/drivers/block/ioctl.c
--- a/drivers/block/ioctl.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/block/ioctl.c	Tue Jun 15 22:20:36 2004
@@ -5,7 +5,7 @@
 #include <linux/buffer_head.h>
 #include <asm/uaccess.h>
 
-static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg *arg)
+static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user *arg)
 {
 	struct block_device *bdevp;
 	struct gendisk *disk;
@@ -109,27 +109,27 @@
 
 static int put_ushort(unsigned long arg, unsigned short val)
 {
-	return put_user(val, (unsigned short *)arg);
+	return put_user(val, (unsigned short __user *)arg);
 }
 
 static int put_int(unsigned long arg, int val)
 {
-	return put_user(val, (int *)arg);
+	return put_user(val, (int __user *)arg);
 }
 
 static int put_long(unsigned long arg, long val)
 {
-	return put_user(val, (long *)arg);
+	return put_user(val, (long __user *)arg);
 }
 
 static int put_ulong(unsigned long arg, unsigned long val)
 {
-	return put_user(val, (unsigned long *)arg);
+	return put_user(val, (unsigned long __user *)arg);
 }
 
 static int put_u64(unsigned long arg, u64 val)
 {
-	return put_user(val, (u64 *)arg);
+	return put_user(val, (u64 __user *)arg);
 }
 
 int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
@@ -172,7 +172,7 @@
 			return -EACCES;
 		if (!arg)
 			return -EINVAL;
-		if (get_user(n, (int *) arg))
+		if (get_user(n, (int __user *) arg))
 			return -EFAULT;
 		if (bd_claim(bdev, file) < 0)
 			return -EBUSY;
@@ -180,7 +180,7 @@
 		bd_release(bdev);
 		return ret;
 	case BLKPG:
-		return blkpg_ioctl(bdev, (struct blkpg_ioctl_arg *) arg);
+		return blkpg_ioctl(bdev, (struct blkpg_ioctl_arg __user *) arg);
 	case BLKRRPART:
 		return blkdev_reread_part(bdev);
 	case BLKGETSIZE:
@@ -203,12 +203,13 @@
 	case BLKROSET:
 		if (disk->fops->ioctl) {
 			ret = disk->fops->ioctl(inode, file, cmd, arg);
-			if (ret != -EINVAL)
+			/* -EINVAL to handle old uncorrected drivers */
+			if (ret != -EINVAL && ret != -ENOTTY)
 				return ret;
 		}
 		if (!capable(CAP_SYS_ADMIN))
 			return -EACCES;
-		if (get_user(n, (int *)(arg)))
+		if (get_user(n, (int __user *)(arg)))
 			return -EFAULT;
 		set_device_ro(bdev, n);
 		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	Tue Jun 15 22:20:37 2004
+++ b/drivers/block/ll_rw_blk.c	Tue Jun 15 22:20:37 2004
@@ -42,6 +42,16 @@
  */
 static kmem_cache_t *request_cachep;
 
+/*
+ * For queue allocation
+ */
+static kmem_cache_t *requestq_cachep;
+
+/*
+ * For io context allocations
+ */
+static kmem_cache_t *iocontext_cachep;
+
 static wait_queue_head_t congestion_wqh[2] = {
 		__WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
 		__WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
@@ -70,14 +80,7 @@
  */
 static inline int queue_congestion_on_threshold(struct request_queue *q)
 {
-	int ret;
-
-	ret = q->nr_requests - (q->nr_requests / 8) + 1;
-
-	if (ret > q->nr_requests)
-		ret = q->nr_requests;
-
-	return ret;
+	return q->nr_congestion_on;
 }
 
 /*
@@ -85,14 +88,22 @@
  */
 static inline int queue_congestion_off_threshold(struct request_queue *q)
 {
-	int ret;
+	return q->nr_congestion_off;
+}
 
-	ret = q->nr_requests - (q->nr_requests / 8) - 1;
+static void blk_queue_congestion_threshold(struct request_queue *q)
+{
+	int nr;
 
-	if (ret < 1)
-		ret = 1;
+	nr = q->nr_requests - (q->nr_requests / 8) + 1;
+	if (nr > q->nr_requests)
+		nr = q->nr_requests;
+	q->nr_congestion_on = nr;
 
-	return ret;
+	nr = q->nr_requests - (q->nr_requests / 8) - 1;
+	if (nr < 1)
+		nr = 1;
+	q->nr_congestion_off = nr;
 }
 
 /*
@@ -229,6 +240,7 @@
 	blk_queue_max_sectors(q, MAX_SECTORS);
 	blk_queue_hardsect_size(q, 512);
 	blk_queue_dma_alignment(q, 511);
+	blk_queue_congestion_threshold(q);
 
 	q->unplug_thresh = 4;		/* hmm */
 	q->unplug_delay = (3 * HZ) / 1000;	/* 3 milliseconds */
@@ -265,8 +277,6 @@
 void blk_queue_bounce_limit(request_queue_t *q, u64 dma_addr)
 {
 	unsigned long bounce_pfn = dma_addr >> PAGE_SHIFT;
-	unsigned long mb = dma_addr >> 20;
-	static request_queue_t *last_q;
 
 	/*
 	 * set appropriate bounce gfp mask -- unfortunately we don't have a
@@ -280,19 +290,7 @@
 	} else
 		q->bounce_gfp = GFP_NOIO;
 
-	/*
-	 * keep this for debugging for now...
-	 */
-	if (dma_addr != BLK_BOUNCE_HIGH && q != last_q) {
-		printk("blk: queue %p, ", q);
-		if (dma_addr == BLK_BOUNCE_ANY)
-			printk("no I/O memory limit\n");
-		else
-			printk("I/O limit %luMb (mask 0x%Lx)\n", mb, (long long) dma_addr);
-	}
-
 	q->bounce_pfn = bounce_pfn;
-	last_q = q;
 }
 
 EXPORT_SYMBOL(blk_queue_bounce_limit);
@@ -1142,7 +1140,7 @@
 
 /**
  * generic_unplug_device - fire a request queue
- * @data:    The &request_queue_t in question
+ * @q:    The &request_queue_t in question
  *
  * Description:
  *   Linux uses plugging to build bigger requests queues before letting
@@ -1159,7 +1157,8 @@
 }
 EXPORT_SYMBOL(generic_unplug_device);
 
-static void blk_backing_dev_unplug(struct backing_dev_info *bdi)
+static void blk_backing_dev_unplug(struct backing_dev_info *bdi,
+				   struct page *page)
 {
 	request_queue_t *q = bdi->unplug_io_data;
 
@@ -1206,7 +1205,7 @@
 		clear_bit(QUEUE_FLAG_REENTER, &q->queue_flags);
 	} else {
 		blk_plug_device(q);
-		schedule_work(&q->unplug_work);
+		kblockd_schedule_work(&q->unplug_work);
 	}
 }
 
@@ -1283,7 +1282,7 @@
 	if (blk_queue_tagged(q))
 		blk_queue_free_tags(q);
 
-	kfree(q);
+	kmem_cache_free(requestq_cachep, q);
 }
 
 EXPORT_SYMBOL(blk_cleanup_queue);
@@ -1347,7 +1346,7 @@
 
 request_queue_t *blk_alloc_queue(int gfp_mask)
 {
-	request_queue_t *q = kmalloc(sizeof(*q), gfp_mask);
+	request_queue_t *q = kmem_cache_alloc(requestq_cachep, gfp_mask);
 
 	if (!q)
 		return NULL;
@@ -1436,7 +1435,7 @@
 out_elv:
 	blk_cleanup_queue(q);
 out_init:
-	kfree(q);
+	kmem_cache_free(requestq_cachep, q);
 	return NULL;
 }
 
@@ -1877,6 +1876,7 @@
 	elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 1);
 	generic_unplug_device(q);
 	wait_for_completion(&wait);
+	rq->waiting = NULL;
 
 	if (rq->errors)
 		err = -EIO;
@@ -2444,7 +2444,7 @@
 
 	if (unlikely(block_dump)) {
 		char b[BDEVNAME_SIZE];
-		printk("%s(%d): %s block %Lu on %s\n",
+		printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
 			current->comm, current->pid,
 			(rw & WRITE) ? "WRITE" : "READ",
 			(unsigned long long)bio->bi_sector,
@@ -2824,9 +2824,13 @@
 		panic("Failed to create kblockd\n");
 
 	request_cachep = kmem_cache_create("blkdev_requests",
-			sizeof(struct request), 0, 0, NULL, NULL);
-	if (!request_cachep)
-		panic("Can't create request pool slab cache\n");
+			sizeof(struct request), 0, SLAB_PANIC, NULL, NULL);
+
+	requestq_cachep = kmem_cache_create("blkdev_queue",
+			sizeof(request_queue_t), 0, SLAB_PANIC, NULL, NULL);
+
+	iocontext_cachep = kmem_cache_create("blkdev_ioc",
+			sizeof(struct io_context), 0, SLAB_PANIC, NULL, NULL);
 
 	blk_max_low_pfn = max_low_pfn;
 	blk_max_pfn = max_pfn;
@@ -2846,7 +2850,7 @@
 	if (atomic_dec_and_test(&ioc->refcount)) {
 		if (ioc->aic && ioc->aic->dtor)
 			ioc->aic->dtor(ioc->aic);
-		kfree(ioc);
+		kmem_cache_free(iocontext_cachep, ioc);
 	}
 }
 
@@ -2885,7 +2889,7 @@
 	local_irq_save(flags);
 	ret = tsk->io_context;
 	if (ret == NULL) {
-		ret = kmalloc(sizeof(*ret), GFP_ATOMIC);
+		ret = kmem_cache_alloc(iocontext_cachep, GFP_ATOMIC);
 		if (ret) {
 			atomic_set(&ret->refcount, 1);
 			ret->pid = tsk->pid;
@@ -2960,6 +2964,7 @@
 	int ret = queue_var_store(&q->nr_requests, page, count);
 	if (q->nr_requests < BLKDEV_MIN_RQ)
 		q->nr_requests = BLKDEV_MIN_RQ;
+	blk_queue_congestion_threshold(q);
 
 	if (rl->count[READ] >= queue_congestion_on_threshold(q))
 		set_queue_congested(q, READ);
@@ -2987,14 +2992,41 @@
 	return ret;
 }
 
+static ssize_t queue_ra_show(struct request_queue *q, char *page)
+{
+	int ra_kb = q->backing_dev_info.ra_pages << (PAGE_CACHE_SHIFT - 10);
+
+	return queue_var_show(ra_kb, (page));
+}
+
+static ssize_t
+queue_ra_store(struct request_queue *q, const char *page, size_t count)
+{
+	unsigned long ra_kb;
+	ssize_t ret = queue_var_store(&ra_kb, page, count);
+
+	if (ra_kb > (q->max_sectors >> 1))
+		ra_kb = (q->max_sectors >> 1);
+
+	q->backing_dev_info.ra_pages = ra_kb >> (PAGE_CACHE_SHIFT - 10);
+	return ret;
+}
+
 static struct queue_sysfs_entry queue_requests_entry = {
 	.attr = {.name = "nr_requests", .mode = S_IRUGO | S_IWUSR },
 	.show = queue_requests_show,
 	.store = queue_requests_store,
 };
 
+static struct queue_sysfs_entry queue_ra_entry = {
+	.attr = {.name = "read_ahead_kb", .mode = S_IRUGO | S_IWUSR },
+	.show = queue_ra_show,
+	.store = queue_ra_store,
+};
+
 static struct attribute *default_attrs[] = {
 	&queue_requests_entry.attr,
+	&queue_ra_entry.attr,
 	NULL,
 };
 
diff -Nru a/drivers/block/loop.c b/drivers/block/loop.c
--- a/drivers/block/loop.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/block/loop.c	Tue Jun 15 22:20:41 2004
@@ -308,7 +308,9 @@
 		       page->index);
 		desc->error = -EINVAL;
 	}
-	
+
+	flush_dcache_page(p->page);
+
 	desc->count = count - size;
 	desc->written += size;
 	p->offset += size;
@@ -949,7 +951,7 @@
 }
 
 static int
-loop_set_status_old(struct loop_device *lo, const struct loop_info *arg)
+loop_set_status_old(struct loop_device *lo, const struct loop_info __user *arg)
 {
 	struct loop_info info;
 	struct loop_info64 info64;
@@ -961,7 +963,7 @@
 }
 
 static int
-loop_set_status64(struct loop_device *lo, const struct loop_info64 *arg)
+loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg)
 {
 	struct loop_info64 info64;
 
@@ -971,7 +973,7 @@
 }
 
 static int
-loop_get_status_old(struct loop_device *lo, struct loop_info *arg) {
+loop_get_status_old(struct loop_device *lo, struct loop_info __user *arg) {
 	struct loop_info info;
 	struct loop_info64 info64;
 	int err = 0;
@@ -989,7 +991,7 @@
 }
 
 static int
-loop_get_status64(struct loop_device *lo, struct loop_info64 *arg) {
+loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) {
 	struct loop_info64 info64;
 	int err = 0;
 
@@ -1021,16 +1023,16 @@
 		err = loop_clr_fd(lo, inode->i_bdev);
 		break;
 	case LOOP_SET_STATUS:
-		err = loop_set_status_old(lo, (struct loop_info *) arg);
+		err = loop_set_status_old(lo, (struct loop_info __user *) arg);
 		break;
 	case LOOP_GET_STATUS:
-		err = loop_get_status_old(lo, (struct loop_info *) arg);
+		err = loop_get_status_old(lo, (struct loop_info __user *) arg);
 		break;
 	case LOOP_SET_STATUS64:
-		err = loop_set_status64(lo, (struct loop_info64 *) arg);
+		err = loop_set_status64(lo, (struct loop_info64 __user *) arg);
 		break;
 	case LOOP_GET_STATUS64:
-		err = loop_get_status64(lo, (struct loop_info64 *) arg);
+		err = loop_get_status64(lo, (struct loop_info64 __user *) arg);
 		break;
 	default:
 		err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
diff -Nru a/drivers/block/paride/epat.c b/drivers/block/paride/epat.c
--- a/drivers/block/paride/epat.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/block/paride/epat.c	Tue Jun 15 22:21:05 2004
@@ -31,6 +31,12 @@
 #define j44(a,b)		(((a>>4)&0x0f)+(b&0xf0))
 #define j53(a,b)		(((a>>3)&0x1f)+((b<<4)&0xe0))
 
+static int epatc8;
+
+module_param(epatc8, int, 0);
+MODULE_PARM_DESC(epatc8, "support for the Shuttle EP1284 chip, "
+	"used in any recent Imation SuperDisk (LS-120) drive.");
+
 /* cont =  0   IDE register file
    cont =  1   IDE control registers
    cont =  2   internal EPAT registers
@@ -209,15 +215,18 @@
 {       pi->saved_r0 = r0();
         pi->saved_r2 = r2();
 
-#ifdef CONFIG_PARIDE_EPATC8
  	/* Initialize the chip */
-        CPP(0);CPP(0x40);CPP(0xe0);              
-        w0(0);w2(1);w2(4);
-        WR(0x8,0x12);WR(0xc,0x14);WR(0x12,0x10);
-        WR(0xe,0xf);WR(0xf,4);
-     /* WR(0xe,0xa);WR(0xf,4); */
-        WR(0xe,0xd);WR(0xf,0);
-     /* CPP(0x30); */
+	CPP(0);
+
+	if (epatc8) {
+		CPP(0x40);CPP(0xe0);
+		w0(0);w2(1);w2(4);
+		WR(0x8,0x12);WR(0xc,0x14);WR(0x12,0x10);
+		WR(0xe,0xf);WR(0xf,4);
+		/* WR(0xe,0xa);WR(0xf,4); */
+		WR(0xe,0xd);WR(0xf,0);
+		/* CPP(0x30); */
+	}
 
         /* Connect to the chip */
 	CPP(0xe0);
@@ -227,15 +236,10 @@
           /* Request EPP */
           w0(0x40);w2(6);w2(7);w2(4);w2(0xc);w2(4);
         }
-#else
- 	CPP(0); CPP(0xe0);
-	w0(0); w2(1); w2(4);
-	if (pi->mode >= 3) {
-		w0(0); w2(1); w2(4); w2(0xc);
-		w0(0x40); w2(6); w2(7); w2(4); w2(0xc); w2(4);
+
+	if (!epatc8) {
+		WR(8,0x10); WR(0xc,0x14); WR(0xa,0x38); WR(0x12,0x10);
 	}
-	WR(8,0x10); WR(0xc,0x14); WR(0xa,0x38); WR(0x12,0x10);
-#endif
 }
 
 static void epat_disconnect (PIA *pi)
@@ -320,6 +324,9 @@
 
 static int __init epat_init(void)
 {
+#ifdef CONFIG_PARIDE_EPATC8
+	epatc8 = 1;
+#endif
 	return pi_register(&epat)-1;
 }
 
diff -Nru a/drivers/block/paride/paride.h b/drivers/block/paride/paride.h
--- a/drivers/block/paride/paride.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/block/paride/paride.h	Tue Jun 15 22:20:38 2004
@@ -99,7 +99,7 @@
 
 /* macros and functions exported to the protocol modules */
 
-#define delay_p			(pi->delay?udelay(pi->delay):0)
+#define delay_p			(pi->delay?udelay(pi->delay):(void)0)
 #define out_p(offs,byte)	outb(byte,pi->port+offs); delay_p;
 #define in_p(offs)		(delay_p,inb(pi->port+offs))
 
diff -Nru a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
--- a/drivers/block/paride/pcd.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/block/paride/pcd.c	Tue Jun 15 22:21:04 2004
@@ -198,7 +198,7 @@
 static int pcd_audio_ioctl(struct cdrom_device_info *cdi,
 			   unsigned int cmd, void *arg);
 static int pcd_packet(struct cdrom_device_info *cdi,
-		      struct cdrom_generic_command *cgc);
+		      struct packet_command *cgc);
 
 static int pcd_detect(void);
 static void pcd_probe_capabilities(void);
@@ -501,7 +501,7 @@
 	return r;
 }
 
-static int pcd_packet(struct cdrom_device_info *cdi, struct cdrom_generic_command *cgc)
+static int pcd_packet(struct cdrom_device_info *cdi, struct packet_command *cgc)
 {
 	return pcd_atapi(cdi->handle, cgc->cmd, cgc->buflen, cgc->buffer,
 			 "generic packet");
diff -Nru a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
--- a/drivers/block/paride/pd.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/block/paride/pd.c	Tue Jun 15 22:20:43 2004
@@ -771,7 +771,7 @@
 	 unsigned int cmd, unsigned long arg)
 {
 	struct pd_unit *disk = inode->i_bdev->bd_disk->private_data;
-	struct hd_geometry *geo = (struct hd_geometry *) arg;
+	struct hd_geometry __user *geo = (struct hd_geometry __user *) arg;
 	struct hd_geometry g;
 
 	switch (cmd) {
diff -Nru a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
--- a/drivers/block/paride/pf.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/block/paride/pf.c	Tue Jun 15 22:20:42 2004
@@ -337,7 +337,7 @@
 static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct pf_unit *pf = inode->i_bdev->bd_disk->private_data;
-	struct hd_geometry *geo = (struct hd_geometry *) arg;
+	struct hd_geometry __user *geo = (struct hd_geometry __user *) arg;
 	struct hd_geometry g;
 	sector_t capacity;
 
diff -Nru a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
--- a/drivers/block/paride/pg.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/block/paride/pg.c	Tue Jun 15 22:20:44 2004
@@ -161,6 +161,7 @@
 #include <linux/slab.h>
 #include <linux/mtio.h>
 #include <linux/pg.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 
@@ -211,9 +212,9 @@
 
 static int pg_open(struct inode *inode, struct file *file);
 static int pg_release(struct inode *inode, struct file *file);
-static ssize_t pg_read(struct file *filp, char *buf,
+static ssize_t pg_read(struct file *filp, char __user *buf,
 		       size_t count, loff_t * ppos);
-static ssize_t pg_write(struct file *filp, const char *buf,
+static ssize_t pg_write(struct file *filp, const char __user *buf,
 			size_t count, loff_t * ppos);
 static int pg_detect(void);
 
@@ -240,6 +241,8 @@
 
 static char pg_scratch[512];	/* scratch block buffer */
 
+static struct class_simple *pg_class;
+
 /* kernel glue structures */
 
 static struct file_operations pg_fops = {
@@ -568,7 +571,7 @@
 	return 0;
 }
 
-static ssize_t pg_write(struct file *filp, const char *buf, size_t count, loff_t *ppos)
+static ssize_t pg_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos)
 {
 	struct pg *dev = filp->private_data;
 	struct pg_write_hdr hdr;
@@ -579,7 +582,7 @@
 	if (count < hs)
 		return -EINVAL;
 
-	if (copy_from_user((char *) &hdr, buf, hs))
+	if (copy_from_user(&hdr, buf, hs))
 		return -EFAULT;
 
 	if (hdr.magic != PG_MAGIC)
@@ -616,7 +619,7 @@
 	return count;
 }
 
-static ssize_t pg_read(struct file *filp, char *buf, size_t count, loff_t *ppos)
+static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
 {
 	struct pg *dev = filp->private_data;
 	struct pg_read_hdr hdr;
@@ -648,7 +651,7 @@
 	hdr.duration = (jiffies - dev->start + HZ / 2) / HZ;
 	hdr.scsi = dev->status & 0x0f;
 
-	if (copy_to_user(buf, (char *) &hdr, hs))
+	if (copy_to_user(buf, &hdr, hs))
 		return -EFAULT;
 	if (copy > 0)
 		if (copy_to_user(buf + hs, dev->bufptr, copy))
@@ -658,15 +661,19 @@
 
 static int __init pg_init(void)
 {
-	int unit;
+	int unit, err = 0;
 
-	if (disable)
-		return -1;
+	if (disable){
+		err = -1;
+		goto out;
+	}
 
 	pg_init_units();
 
-	if (pg_detect())
-		return -1;
+	if (pg_detect()) {
+		err = -1;
+		goto out;
+	}
 
 	if (register_chrdev(major, name, &pg_fops)) {
 		printk("pg_init: unable to get major number %d\n", major);
@@ -675,18 +682,37 @@
 			if (dev->present)
 				pi_release(dev->pi);
 		}
-		return -1;
+		err = -1;
+		goto out;
+	}
+	pg_class = class_simple_create(THIS_MODULE, "pg");
+	if (IS_ERR(pg_class)) {
+		err = PTR_ERR(pg_class);
+		goto out_chrdev;
 	}
 	devfs_mk_dir("pg");
 	for (unit = 0; unit < PG_UNITS; unit++) {
 		struct pg *dev = &devices[unit];
 		if (dev->present) {
-			devfs_mk_cdev(MKDEV(major, unit),
+			class_simple_device_add(pg_class, MKDEV(major, unit), 
+					NULL, "pg%u", unit);
+			err = devfs_mk_cdev(MKDEV(major, unit),
 				      S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u",
 				      unit);
+			if (err) 
+				goto out_class;
 		}
 	}
-	return 0;
+	err = 0;
+	goto out;
+
+out_class:
+	class_simple_device_remove(MKDEV(major, unit));
+	class_simple_destroy(pg_class);
+out_chrdev:
+	unregister_chrdev(major, "pg");
+out:
+	return err;
 }
 
 static void __exit pg_exit(void)
@@ -695,10 +721,12 @@
 
 	for (unit = 0; unit < PG_UNITS; unit++) {
 		struct pg *dev = &devices[unit];
-		if (dev->present)
+		if (dev->present) {
+			class_simple_device_remove(MKDEV(major, unit));
 			devfs_remove("pg/%u", unit);
+		}
 	}
-
+	class_simple_destroy(pg_class);
 	devfs_remove("pg");
 	unregister_chrdev(major, name);
 
diff -Nru a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
--- a/drivers/block/paride/pt.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/block/paride/pt.c	Tue Jun 15 22:20:38 2004
@@ -145,6 +145,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/mtio.h>
+#include <linux/device.h>
 
 #include <asm/uaccess.h>
 
@@ -211,9 +212,9 @@
 static int pt_ioctl(struct inode *inode, struct file *file,
 		    unsigned int cmd, unsigned long arg);
 static int pt_release(struct inode *inode, struct file *file);
-static ssize_t pt_read(struct file *filp, char *buf,
+static ssize_t pt_read(struct file *filp, char __user *buf,
 		       size_t count, loff_t * ppos);
-static ssize_t pt_write(struct file *filp, const char *buf,
+static ssize_t pt_write(struct file *filp, const char __user *buf,
 			size_t count, loff_t * ppos);
 static int pt_detect(void);
 
@@ -260,6 +261,9 @@
 	.release = pt_release,
 };
 
+/* sysfs class support */
+static struct class_simple *pt_class;
+
 static inline int status_reg(struct pi_adapter *pi)
 {
 	return pi_read_regr(pi, 1, 6);
@@ -706,12 +710,12 @@
 	 unsigned int cmd, unsigned long arg)
 {
 	struct pt_unit *tape = file->private_data;
+	struct mtop __user *p = (void __user *)arg;
 	struct mtop mtop;
 
 	switch (cmd) {
 	case MTIOCTOP:
-		if (copy_from_user((char *) &mtop, (char *) arg,
-				   sizeof (struct mtop)))
+		if (copy_from_user(&mtop, p, sizeof(struct mtop)))
 			return -EFAULT;
 
 		switch (mtop.mt_op) {
@@ -760,7 +764,7 @@
 
 }
 
-static ssize_t pt_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
+static ssize_t pt_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
 {
 	struct pt_unit *tape = filp->private_data;
 	struct pi_adapter *pi = tape->pi;
@@ -857,7 +861,7 @@
 
 }
 
-static ssize_t pt_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
+static ssize_t pt_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 {
 	struct pt_unit *tape = filp->private_data;
 	struct pi_adapter *pi = tape->pi;
@@ -959,33 +963,62 @@
 
 static int __init pt_init(void)
 {
-	int unit;
+	int unit, err = 0;
 
-	if (disable)
-		return -1;
+	if (disable) {
+		err = -1;
+		goto out;
+	}
 
-	if (pt_detect())
-		return -1;
+	if (pt_detect()) {
+		err = -1;
+		goto out;
+	}
 
 	if (register_chrdev(major, name, &pt_fops)) {
 		printk("pt_init: unable to get major number %d\n", major);
 		for (unit = 0; unit < PT_UNITS; unit++)
 			if (pt[unit].present)
 				pi_release(pt[unit].pi);
-		return -1;
+		err = -1;
+		goto out;
+	}
+	pt_class = class_simple_create(THIS_MODULE, "pt");
+	if (IS_ERR(pt_class)) {
+		err = PTR_ERR(pt_class);
+		goto out_chrdev;
 	}
 
 	devfs_mk_dir("pt");
 	for (unit = 0; unit < PT_UNITS; unit++)
 		if (pt[unit].present) {
-			devfs_mk_cdev(MKDEV(major, unit),
+			class_simple_device_add(pt_class, MKDEV(major, unit), 
+					NULL, "pt%d", unit);
+			err = devfs_mk_cdev(MKDEV(major, unit),
 				      S_IFCHR | S_IRUSR | S_IWUSR,
 				      "pt/%d", unit);
-			devfs_mk_cdev(MKDEV(major, unit + 128),
+			if (err) {
+				class_simple_device_remove(MKDEV(major, unit));
+				goto out_class;
+			}
+			class_simple_device_add(pt_class, MKDEV(major, unit + 128),
+					NULL, "pt%dn", unit);
+			err = devfs_mk_cdev(MKDEV(major, unit + 128),
 				      S_IFCHR | S_IRUSR | S_IWUSR,
 				      "pt/%dn", unit);
+			if (err) {
+				class_simple_device_remove(MKDEV(major, unit + 128));
+				goto out_class;
+			}
 		}
-	return 0;
+	goto out;
+
+out_class:
+	class_simple_destroy(pt_class);
+out_chrdev:
+	unregister_chrdev(major, "pt");
+out:
+	return err;
 }
 
 static void __exit pt_exit(void)
@@ -993,9 +1026,12 @@
 	int unit;
 	for (unit = 0; unit < PT_UNITS; unit++)
 		if (pt[unit].present) {
+			class_simple_device_remove(MKDEV(major, unit));
 			devfs_remove("pt/%d", unit);
+			class_simple_device_remove(MKDEV(major, unit + 128));
 			devfs_remove("pt/%dn", unit);
 		}
+	class_simple_destroy(pt_class);
 	devfs_remove("pt");
 	unregister_chrdev(major, name);
 	for (unit = 0; unit < PT_UNITS; unit++)
diff -Nru a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
--- a/drivers/block/ps2esdi.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/block/ps2esdi.c	Tue Jun 15 22:20:35 2004
@@ -180,7 +180,7 @@
 MODULE_PARM(tp720esdi, "i");
 MODULE_PARM(cyl, "i");
 MODULE_PARM(head, "i");
-MODULE_PARM(track, "i");
+MODULE_PARM(sect, "i");
 MODULE_LICENSE("GPL");
 
 int init_module(void) {
@@ -1063,17 +1063,17 @@
 			 struct file *file, u_int cmd, u_long arg)
 {
 	struct ps2esdi_i_struct *p = inode->i_bdev->bd_disk->private_data;
-	struct ps2esdi_geometry *geometry = (struct ps2esdi_geometry *) arg;
-	int err;
+	struct ps2esdi_geometry geom;
 
 	if (cmd != HDIO_GETGEO)
 		return -EINVAL;
-	if ((err = verify_area(VERIFY_WRITE, geometry, sizeof(*geometry))))
-		return (err);
-	put_user(p->head, (char *) &geometry->heads);
-	put_user(p->sect, (char *) &geometry->sectors);
-	put_user(p->cyl, (short *) &geometry->cylinders);
-	put_user(get_start_sect(inode->i_bdev), (long *) &geometry->start);
+	memset(&geom, 0, sizeof(geom));
+	geom.heads = p->head;
+	geom.sectors = p->sect;
+	geom.cylinders = p->cyl;
+	geom.start = get_start_sect(inode->i_bdev);
+	if (copy_to_user((void __user *)arg, &geom, sizeof(geom)))
+		return -EFAULT;
 	return 0;
 }
 
diff -Nru a/drivers/block/rd.c b/drivers/block/rd.c
--- a/drivers/block/rd.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/block/rd.c	Tue Jun 15 22:20:41 2004
@@ -53,10 +53,11 @@
 #include <linux/pagemap.h>
 #include <linux/blkdev.h>
 #include <linux/genhd.h>
-#include <linux/bio.h>
 #include <linux/buffer_head.h>		/* for invalidate_bdev() */
 #include <linux/backing-dev.h>
 #include <linux/blkpg.h>
+#include <linux/writeback.h>
+
 #include <asm/uaccess.h>
 
 /* The RAM disk size is now a parameter */
@@ -94,16 +95,46 @@
  *               2000 Transmeta Corp.
  * aops copied from ramfs.
  */
-static int ramdisk_readpage(struct file *file, struct page *page)
-{
-	if (!PageUptodate(page)) {
-		void *kaddr = kmap_atomic(page, KM_USER0);
 
-		memset(kaddr, 0, PAGE_CACHE_SIZE);
-		flush_dcache_page(page);
-		kunmap_atomic(kaddr, KM_USER0);
-		SetPageUptodate(page);
+/*
+ * If a ramdisk page has buffers, some may be uptodate and some may be not.
+ * To bring the page uptodate we zero out the non-uptodate buffers.  The
+ * page must be locked.
+ */
+static void make_page_uptodate(struct page *page)
+{
+	if (page_has_buffers(page)) {
+		struct buffer_head *bh = page_buffers(page);
+		struct buffer_head *head = bh;
+
+		do {
+			if (!buffer_uptodate(bh)) {
+				memset(bh->b_data, 0, bh->b_size);
+				/*
+				 * akpm: I'm totally undecided about this.  The
+				 * buffer has just been magically brought "up to
+				 * date", but nobody should want to be reading
+				 * it anyway, because it hasn't been used for
+				 * anything yet.  It is still in a "not read
+				 * from disk yet" state.
+				 *
+				 * But non-uptodate buffers against an uptodate
+				 * page are against the rules.  So do it anyway.
+				 */
+				 set_buffer_uptodate(bh);
+			}
+		} while ((bh = bh->b_this_page) != head);
+	} else {
+		memset(page_address(page), 0, PAGE_CACHE_SIZE);
 	}
+	flush_dcache_page(page);
+	SetPageUptodate(page);
+}
+
+static int ramdisk_readpage(struct file *file, struct page *page)
+{
+	if (!PageUptodate(page))
+		make_page_uptodate(page);
 	unlock_page(page);
 	return 0;
 }
@@ -111,34 +142,69 @@
 static int ramdisk_prepare_write(struct file *file, struct page *page,
 				unsigned offset, unsigned to)
 {
-	if (!PageUptodate(page)) {
-		void *kaddr = kmap_atomic(page, KM_USER0);
-
-		memset(kaddr, 0, PAGE_CACHE_SIZE);
-		flush_dcache_page(page);
-		kunmap_atomic(kaddr, KM_USER0);
-		SetPageUptodate(page);
-	}
-	SetPageDirty(page);
+	if (!PageUptodate(page))
+		make_page_uptodate(page);
 	return 0;
 }
 
 static int ramdisk_commit_write(struct file *file, struct page *page,
 				unsigned offset, unsigned to)
 {
+	set_page_dirty(page);
+	return 0;
+}
+
+/*
+ * ->writepage to the the blockdev's mapping has to redirty the page so that the
+ * VM doesn't go and steal it.  We return WRITEPAGE_ACTIVATE so that the VM
+ * won't try to (pointlessly) write the page again for a while.
+ *
+ * Really, these pages should not be on the LRU at all.
+ */
+static int ramdisk_writepage(struct page *page, struct writeback_control *wbc)
+{
+	if (!PageUptodate(page))
+		make_page_uptodate(page);
+	SetPageDirty(page);
+	if (wbc->for_reclaim)
+		return WRITEPAGE_ACTIVATE;
+	unlock_page(page);
+	return 0;
+}
+
+/*
+ * This is a little speedup thing: short-circuit attempts to write back the
+ * ramdisk blockdev inode to its non-existent backing store.
+ */
+static int ramdisk_writepages(struct address_space *mapping,
+				struct writeback_control *wbc)
+{
+	return 0;
+}
+
+/*
+ * ramdisk blockdev pages have their own ->set_page_dirty() because we don't
+ * want them to contribute to dirty memory accounting.
+ */
+static int ramdisk_set_page_dirty(struct page *page)
+{
+	SetPageDirty(page);
 	return 0;
 }
 
 static struct address_space_operations ramdisk_aops = {
-	.readpage = ramdisk_readpage,
-	.prepare_write = ramdisk_prepare_write,
-	.commit_write = ramdisk_commit_write,
+	.readpage	= ramdisk_readpage,
+	.prepare_write	= ramdisk_prepare_write,
+	.commit_write	= ramdisk_commit_write,
+	.writepage	= ramdisk_writepage,
+	.set_page_dirty	= ramdisk_set_page_dirty,
+	.writepages	= ramdisk_writepages,
 };
 
 static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector,
 				struct address_space *mapping)
 {
-	unsigned long index = sector >> (PAGE_CACHE_SHIFT - 9);
+	pgoff_t index = sector >> (PAGE_CACHE_SHIFT - 9);
 	unsigned int vec_offset = vec->bv_offset;
 	int offset = (sector << 9) & ~PAGE_CACHE_MASK;
 	int size = vec->bv_len;
@@ -146,60 +212,47 @@
 
 	do {
 		int count;
-		struct page * page;
-		char * src, * dst;
-		int unlock = 0;
+		struct page *page;
+		char *src;
+		char *dst;
 
 		count = PAGE_CACHE_SIZE - offset;
 		if (count > size)
 			count = size;
 		size -= count;
 
-		page = find_get_page(mapping, index);
+		page = grab_cache_page(mapping, index);
 		if (!page) {
-			page = grab_cache_page(mapping, index);
 			err = -ENOMEM;
-			if (!page)
-				goto out;
-			err = 0;
-
-			if (!PageUptodate(page)) {
-				void *kaddr = kmap_atomic(page, KM_USER0);
-
-				memset(kaddr, 0, PAGE_CACHE_SIZE);
-				flush_dcache_page(page);
-				kunmap_atomic(kaddr, KM_USER0);
-				SetPageUptodate(page);
-			}
-
-			unlock = 1;
+			goto out;
 		}
 
+		if (!PageUptodate(page))
+			make_page_uptodate(page);
+
 		index++;
 
 		if (rw == READ) {
-			src = kmap(page) + offset;
-			dst = kmap(vec->bv_page) + vec_offset;
+			src = kmap_atomic(page, KM_USER0) + offset;
+			dst = kmap_atomic(vec->bv_page, KM_USER1) + vec_offset;
 		} else {
-			dst = kmap(page) + offset;
-			src = kmap(vec->bv_page) + vec_offset;
+			src = kmap_atomic(vec->bv_page, KM_USER0) + vec_offset;
+			dst = kmap_atomic(page, KM_USER1) + offset;
 		}
 		offset = 0;
 		vec_offset += count;
 
 		memcpy(dst, src, count);
 
-		kunmap(page);
-		kunmap(vec->bv_page);
+		kunmap_atomic(src, KM_USER0);
+		kunmap_atomic(dst, KM_USER1);
 
-		if (rw == READ) {
+		if (rw == READ)
 			flush_dcache_page(vec->bv_page);
-		} else {
-			SetPageDirty(page);
-		}
-		if (unlock)
-			unlock_page(page);
-		__free_page(page);
+		else
+			set_page_dirty(page);
+		unlock_page(page);
+		put_page(page);
 	} while (size);
 
  out:
@@ -251,7 +304,7 @@
 	struct block_device *bdev = inode->i_bdev;
 
 	if (cmd != BLKFLSBUF)
-		return -EINVAL;
+		return -ENOTTY;
 
 	/*
 	 * special: we want to release the ramdisk memory, it's not like with
@@ -268,28 +321,65 @@
 	return error;
 }
 
+/*
+ * This is the backing_dev_info for the blockdev inode itself.  It doesn't need
+ * writeback and it does not contribute to dirty memory accounting.
+ */
 static struct backing_dev_info rd_backing_dev_info = {
 	.ra_pages	= 0,	/* No readahead */
 	.memory_backed	= 1,	/* Does not contribute to dirty memory */
-	.unplug_io_fn = default_unplug_io_fn,
+	.unplug_io_fn	= default_unplug_io_fn,
+};
+
+/*
+ * This is the backing_dev_info for the files which live atop the ramdisk
+ * "device".  These files do need writeback and they do contribute to dirty
+ * memory accounting.
+ */
+static struct backing_dev_info rd_file_backing_dev_info = {
+	.ra_pages	= 0,	/* No readahead */
+	.memory_backed	= 0,	/* Does contribute to dirty memory */
+	.unplug_io_fn	= default_unplug_io_fn,
 };
 
 static int rd_open(struct inode *inode, struct file *filp)
 {
 	unsigned unit = iminor(inode);
 
-	/*
-	 * Immunize device against invalidate_buffers() and prune_icache().
-	 */
 	if (rd_bdev[unit] == NULL) {
 		struct block_device *bdev = inode->i_bdev;
+		struct address_space *mapping;
+		int gfp_mask;
+
 		inode = igrab(bdev->bd_inode);
 		rd_bdev[unit] = bdev;
 		bdev->bd_openers++;
 		bdev->bd_block_size = rd_blocksize;
 		inode->i_size = get_capacity(rd_disks[unit])<<9;
-		inode->i_mapping->a_ops = &ramdisk_aops;
-		inode->i_mapping->backing_dev_info = &rd_backing_dev_info;
+		mapping = inode->i_mapping;
+		mapping->a_ops = &ramdisk_aops;
+		mapping->backing_dev_info = &rd_backing_dev_info;
+		bdev->bd_inode_backing_dev_info = &rd_file_backing_dev_info;
+
+		/*
+		 * Deep badness.  rd_blkdev_pagecache_IO() needs to allocate
+		 * pagecache pages within a request_fn.  We cannot recur back
+		 * into the filesytem which is mounted atop the ramdisk, because
+		 * that would deadlock on fs locks.  And we really don't want
+		 * to reenter rd_blkdev_pagecache_IO when we're already within
+		 * that function.
+		 *
+		 * So we turn off __GFP_FS and __GFP_IO.
+		 *
+		 * And to give this thing a hope of working, turn on __GFP_HIGH.
+		 * Hopefully, there's enough regular memory allocation going on
+		 * for the page allocator emergency pools to keep the ramdisk
+		 * driver happy.
+		 */
+		gfp_mask = mapping_gfp_mask(mapping);
+		gfp_mask &= ~(__GFP_FS|__GFP_IO);
+		gfp_mask |= __GFP_HIGH;
+		mapping_set_gfp_mask(mapping, gfp_mask);
 	}
 
 	return 0;
diff -Nru a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
--- a/drivers/block/scsi_ioctl.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/block/scsi_ioctl.c	Tue Jun 15 22:21:05 2004
@@ -44,18 +44,18 @@
 
 #include <scsi/sg.h>
 
-static int sg_get_version(int *p)
+static int sg_get_version(int __user *p)
 {
 	static int sg_version_num = 30527;
 	return put_user(sg_version_num, p);
 }
 
-static int scsi_get_idlun(request_queue_t *q, int *p)
+static int scsi_get_idlun(request_queue_t *q, int __user *p)
 {
 	return put_user(0, p);
 }
 
-static int scsi_get_bus(request_queue_t *q, int *p)
+static int scsi_get_bus(request_queue_t *q, int __user *p)
 {
 	return put_user(0, p);
 }
@@ -65,7 +65,7 @@
 	return q->sg_timeout / (HZ / USER_HZ);
 }
 
-static int sg_set_timeout(request_queue_t *q, int *p)
+static int sg_set_timeout(request_queue_t *q, int __user *p)
 {
 	int timeout, err = get_user(timeout, p);
 
@@ -75,12 +75,12 @@
 	return err;
 }
 
-static int sg_get_reserved_size(request_queue_t *q, int *p)
+static int sg_get_reserved_size(request_queue_t *q, int __user *p)
 {
 	return put_user(q->sg_reserved_size, p);
 }
 
-static int sg_set_reserved_size(request_queue_t *q, int *p)
+static int sg_set_reserved_size(request_queue_t *q, int __user *p)
 {
 	int size, err = get_user(size, p);
 
@@ -100,7 +100,7 @@
  * will always return that we are ATAPI even for a real SCSI drive, I'm not
  * so sure this is worth doing anything about (why would you care??)
  */
-static int sg_emulated_host(request_queue_t *q, int *p)
+static int sg_emulated_host(request_queue_t *q, int __user *p)
 {
 	return put_user(1, p);
 }
@@ -113,11 +113,14 @@
 	struct request *rq;
 	struct bio *bio;
 	char sense[SCSI_SENSE_BUFFERSIZE];
+	unsigned char cmd[BLK_MAX_CDB];
 
 	if (hdr->interface_id != 'S')
 		return -EINVAL;
-	if (hdr->cmd_len > sizeof(rq->cmd))
+	if (hdr->cmd_len > BLK_MAX_CDB)
 		return -EINVAL;
+	if (copy_from_user(cmd, hdr->cmdp, hdr->cmd_len))
+		return -EFAULT;
 
 	/*
 	 * we'll do that later
@@ -156,7 +159,7 @@
 	 * fill in request structure
 	 */
 	rq->cmd_len = hdr->cmd_len;
-	memcpy(rq->cmd, hdr->cmdp, hdr->cmd_len);
+	memcpy(rq->cmd, cmd, hdr->cmd_len);
 	if (sizeof(rq->cmd) != hdr->cmd_len)
 		memset(rq->cmd + hdr->cmd_len, 0, sizeof(rq->cmd) - hdr->cmd_len);
 
@@ -217,7 +220,7 @@
 #define OMAX_SB_LEN 16          /* For backward compatibility */
 
 static int sg_scsi_ioctl(request_queue_t *q, struct gendisk *bd_disk,
-			 Scsi_Ioctl_Command *sic)
+			 Scsi_Ioctl_Command __user *sic)
 {
 	struct request *rq;
 	int err, in_len, out_len, bytes, opcode, cmdlen;
@@ -309,7 +312,7 @@
 	return err;
 }
 
-int scsi_cmd_ioctl(struct gendisk *bd_disk, unsigned int cmd, unsigned long arg)
+int scsi_cmd_ioctl(struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
 {
 	request_queue_t *q;
 	struct request *rq;
@@ -327,51 +330,40 @@
 		 * new sgv3 interface
 		 */
 		case SG_GET_VERSION_NUM:
-			err = sg_get_version((int *) arg);
+			err = sg_get_version(arg);
 			break;
 		case SCSI_IOCTL_GET_IDLUN:
-			err = scsi_get_idlun(q, (int *) arg);
+			err = scsi_get_idlun(q, arg);
 			break;
 		case SCSI_IOCTL_GET_BUS_NUMBER:
-			err = scsi_get_bus(q, (int *) arg);
+			err = scsi_get_bus(q, arg);
 			break;
 		case SG_SET_TIMEOUT:
-			err = sg_set_timeout(q, (int *) arg);
+			err = sg_set_timeout(q, arg);
 			break;
 		case SG_GET_TIMEOUT:
 			err = sg_get_timeout(q);
 			break;
 		case SG_GET_RESERVED_SIZE:
-			err = sg_get_reserved_size(q, (int *) arg);
+			err = sg_get_reserved_size(q, arg);
 			break;
 		case SG_SET_RESERVED_SIZE:
-			err = sg_set_reserved_size(q, (int *) arg);
+			err = sg_set_reserved_size(q, arg);
 			break;
 		case SG_EMULATED_HOST:
-			err = sg_emulated_host(q, (int *) arg);
+			err = sg_emulated_host(q, arg);
 			break;
 		case SG_IO: {
 			struct sg_io_hdr hdr;
-			unsigned char cdb[BLK_MAX_CDB], *old_cdb;
 
 			err = -EFAULT;
-			if (copy_from_user(&hdr, (struct sg_io_hdr *) arg, sizeof(hdr)))
-				break;
-			err = -EINVAL;
-			if (hdr.cmd_len > sizeof(rq->cmd))
-				break;
-			err = -EFAULT;
-			if (copy_from_user(cdb, hdr.cmdp, hdr.cmd_len))
+			if (copy_from_user(&hdr, arg, sizeof(hdr)))
 				break;
-
-			old_cdb = hdr.cmdp;
-			hdr.cmdp = cdb;
 			err = sg_io(q, bd_disk, &hdr);
 			if (err == -EFAULT)
 				break;
 
-			hdr.cmdp = old_cdb;
-			if (copy_to_user((struct sg_io_hdr *) arg, &hdr, sizeof(hdr)))
+			if (copy_to_user(arg, &hdr, sizeof(hdr)))
 				err = -EFAULT;
 			break;
 		}
@@ -380,7 +372,7 @@
 			struct sg_io_hdr hdr;
 
 			err = -EFAULT;
-			if (copy_from_user(&cgc, (struct cdrom_generic_command *) arg, sizeof(cgc)))
+			if (copy_from_user(&cgc, arg, sizeof(cgc)))
 				break;
 			cgc.timeout = clock_t_to_jiffies(cgc.timeout);
 			memset(&hdr, 0, sizeof(hdr));
@@ -408,11 +400,11 @@
 				break;
 
 			hdr.dxferp = cgc.buffer;
-			hdr.sbp = (char *) cgc.sense;
+			hdr.sbp = cgc.sense;
 			if (hdr.sbp)
 				hdr.mx_sb_len = sizeof(struct request_sense);
 			hdr.timeout = cgc.timeout;
-			hdr.cmdp = cgc.cmd;
+			hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
 			hdr.cmd_len = sizeof(cgc.cmd);
 
 			err = sg_io(q, bd_disk, &hdr);
@@ -424,7 +416,7 @@
 
 			cgc.stat = err;
 			cgc.buflen = hdr.resid;
-			if (copy_to_user((struct cdrom_generic_command *) arg, &cgc, sizeof(cgc)))
+			if (copy_to_user(arg, &cgc, sizeof(cgc)))
 				err = -EFAULT;
 
 			break;
@@ -438,8 +430,7 @@
 			if (!arg)
 				break;
 
-			err = sg_scsi_ioctl(q, bd_disk,
-					    (Scsi_Ioctl_Command *)arg);
+			err = sg_scsi_ioctl(q, bd_disk, arg);
 			break;
 		case CDROMCLOSETRAY:
 			close = 1;
diff -Nru a/drivers/block/swim3.c b/drivers/block/swim3.c
--- a/drivers/block/swim3.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/block/swim3.c	Tue Jun 15 22:20:39 2004
@@ -1145,3 +1145,7 @@
 }
 
 module_init(swim3_init)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Paul Mackerras");
+MODULE_ALIAS_BLOCKDEV_MAJOR(FLOPPY_MAJOR);
diff -Nru a/drivers/block/umem.c b/drivers/block/umem.c
--- a/drivers/block/umem.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/block/umem.c	Tue Jun 15 22:21:05 2004
@@ -278,7 +278,7 @@
  * Whenever IO on the active page completes, the Ready page is activated
  * and the ex-Active page is clean out and made Ready.
  * Otherwise the Ready page is only activated when it becomes full, or
- * when mm_unplug_device is called via blk_run_queues().
+ * when mm_unplug_device is called via the unplug_io_fn.
  *
  * If a request arrives while both pages a full, it is queued, and b_rdev is
  * overloaded to record whether it was a read or a write.
@@ -833,7 +833,7 @@
 		geo.start     = get_start_sect(i->i_bdev);
 		geo.cylinders = size / (geo.heads * geo.sectors);
 
-		if (copy_to_user((void *) arg, &geo, sizeof(geo)))
+		if (copy_to_user((void __user *) arg, &geo, sizeof(geo)))
 			return -EFAULT;
 		return 0;
 	}
diff -Nru a/drivers/block/viodasd.c b/drivers/block/viodasd.c
--- a/drivers/block/viodasd.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/block/viodasd.c	Tue Jun 15 22:20:38 2004
@@ -40,8 +40,11 @@
 #include <linux/string.h>
 #include <linux/dma-mapping.h>
 #include <linux/completion.h>
+#include <linux/device.h>
+#include <linux/kernel.h>
 
 #include <asm/uaccess.h>
+#include <asm/vio.h>
 #include <asm/iSeries/HvTypes.h>
 #include <asm/iSeries/HvLpEvent.h>
 #include <asm/iSeries/HvLpConfig.h>
@@ -175,6 +178,13 @@
 	struct viodasd_device *d = ino->i_bdev->bd_disk->private_data;
 	HvLpEvent_Rc hvrc;
 	struct viodasd_waitevent we;
+	u16 flags = 0;
+
+	if (d->read_only) {
+		if ((fil != NULL) && (fil->f_mode & FMODE_WRITE))
+			return -EROFS;
+		flags = vioblockflags_ro;
+	}
 
 	init_completion(&we.com);
 
@@ -186,7 +196,7 @@
 			viopath_sourceinst(viopath_hostLp),
 			viopath_targetinst(viopath_hostLp),
 			(u64)(unsigned long)&we, VIOVERSION << 16,
-			((u64)DEVICE_NO(d) << 48) /* | ((u64)flags << 32) */,
+			((u64)DEVICE_NO(d) << 48) | ((u64)flags << 32),
 			0, 0, 0);
 	if (hvrc != 0) {
 		printk(VIOD_KERN_WARNING "HV open failed %d\n", (int)hvrc);
@@ -456,7 +466,9 @@
 	int dev_no = DEVICE_NO(d);
 	struct gendisk *g;
 	struct request_queue *q;
+	u16 flags = 0;
 
+retry:
 	init_completion(&we.com);
 
 	/* Send the open event to OS/400 */
@@ -467,7 +479,7 @@
 			viopath_sourceinst(viopath_hostLp),
 			viopath_targetinst(viopath_hostLp),
 			(u64)(unsigned long)&we, VIOVERSION << 16,
-			((u64)dev_no << 48) | ((u64)vioblockflags_ro << 32),
+			((u64)dev_no << 48) | ((u64)flags<< 32),
 			0, 0, 0);
 	if (hvrc != 0) {
 		printk(VIOD_KERN_WARNING "bad rc on HV open %d\n", (int)hvrc);
@@ -476,8 +488,13 @@
 
 	wait_for_completion(&we.com);
 
-	if (we.rc != 0)
-		return;
+	if (we.rc != 0) {
+		if (flags != 0)
+			return;
+		/* try again with read only flag set */
+		flags = vioblockflags_ro;
+		goto retry;
+	}
 	if (we.max_disk > (MAX_DISKNO - 1)) {
 		static int warned;
 
@@ -498,19 +515,13 @@
 			viopath_sourceinst(viopath_hostLp),
 			viopath_targetinst(viopath_hostLp),
 			0, VIOVERSION << 16,
-			((u64)dev_no << 48) | ((u64)vioblockflags_ro << 32),
+			((u64)dev_no << 48) | ((u64)flags << 32),
 			0, 0, 0);
 	if (hvrc != 0) {
 		printk(VIOD_KERN_WARNING
 		       "bad rc sending event to OS/400 %d\n", (int)hvrc);
 		return;
 	}
-	printk(VIOD_KERN_INFO "disk %d: %lu sectors (%lu MB) "
-			"CHS=%d/%d/%d sector size %d\n",
-			dev_no, (unsigned long)(d->size >> 9),
-			(unsigned long)(d->size >> 20),
-			(int)d->cylinders, (int)d->tracks,
-			(int)d->sectors, (int)d->bytes_per_sector);
 	/* create the request queue for the disk */
 	spin_lock_init(&d->q_lock);
 	q = blk_init_queue(do_viodasd_request, &d->q_lock);
@@ -548,6 +559,14 @@
 	g->private_data = d;
 	set_capacity(g, d->size >> 9);
 
+	printk(VIOD_KERN_INFO "disk %d: %lu sectors (%lu MB) "
+			"CHS=%d/%d/%d sector size %d%s\n",
+			dev_no, (unsigned long)(d->size >> 9),
+			(unsigned long)(d->size >> 20),
+			(int)d->cylinders, (int)d->tracks,
+			(int)d->sectors, (int)d->bytes_per_sector,
+			d->read_only ? " (RO)" : "");
+
 	/* register us in the global list */
 	add_disk(g);
 }
@@ -710,6 +729,26 @@
 }
 
 /*
+ * Get the driver to reprobe for more disks.
+ */
+static ssize_t probe_disks(struct device_driver *drv, const char *buf,
+		size_t count)
+{
+	struct viodasd_device *d;
+
+	for (d = viodasd_devices; d < &viodasd_devices[MAX_DISKNO]; d++) {
+		if (d->disk == NULL)
+			probe_disk(d);
+	}
+	return count;
+}
+static DRIVER_ATTR(probe, S_IWUSR, NULL, probe_disks)
+
+static struct vio_driver viodasd_driver = {
+	.name = "viodasd"
+};
+
+/*
  * Initialize the whole device driver.  Handle module and non-module
  * versions
  */
@@ -752,6 +791,9 @@
 	for (i = 0; i < MAX_DISKNO; i++)
 		probe_disk(&viodasd_devices[i]);
 
+	vio_register_driver(&viodasd_driver);	/* FIX ME - error checking */
+	driver_create_file(&viodasd_driver.driver, &driver_attr_probe);
+
 	return 0;
 }
 module_init(viodasd_init);
@@ -760,6 +802,9 @@
 {
 	int i;
 	struct viodasd_device *d;
+
+	driver_remove_file(&viodasd_driver.driver, &driver_attr_probe);
+	vio_unregister_driver(&viodasd_driver);
 
         for (i = 0; i < MAX_DISKNO; i++) {
 		d = &viodasd_devices[i];
diff -Nru a/drivers/block/xd.c b/drivers/block/xd.c
--- a/drivers/block/xd.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/block/xd.c	Tue Jun 15 22:20:43 2004
@@ -330,12 +330,12 @@
 		case HDIO_GETGEO:
 		{
 			struct hd_geometry g;
-			struct hd_geometry *geometry = (struct hd_geometry *) arg;
+			struct hd_geometry __user *geom= (void __user *)arg;
 			g.heads = p->heads;
 			g.sectors = p->sectors;
 			g.cylinders = p->cylinders;
 			g.start = get_start_sect(inode->i_bdev);
-			return copy_to_user(geometry, &g, sizeof g) ? -EFAULT : 0;
+			return copy_to_user(geom, &g, sizeof(g)) ? -EFAULT : 0;
 		}
 		case HDIO_SET_DMA:
 			if (!capable(CAP_SYS_ADMIN)) return -EACCES;
@@ -354,9 +354,9 @@
 			}
 			return 0;
 		case HDIO_GET_DMA:
-			return put_user(!nodma, (long *) arg);
+			return put_user(!nodma, (long __user *) arg);
 		case HDIO_GET_MULTCOUNT:
-			return put_user(xd_maxsectors, (long *) arg);
+			return put_user(xd_maxsectors, (long __user *) arg);
 		default:
 			return -EINVAL;
 	}
diff -Nru a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c
--- a/drivers/bluetooth/bcm203x.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/bluetooth/bcm203x.c	Tue Jun 15 22:20:36 2004
@@ -174,7 +174,7 @@
 
 	BT_DBG("intf %p id %p", intf, id);
 
-	if (intf->altsetting->desc.bInterfaceNumber != 0)
+	if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
 		return -ENODEV;
 
 	data = kmalloc(sizeof(*data), GFP_KERNEL);
diff -Nru a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
--- a/drivers/bluetooth/bfusb.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/bluetooth/bfusb.c	Tue Jun 15 22:20:42 2004
@@ -98,14 +98,6 @@
 static void bfusb_tx_complete(struct urb *urb, struct pt_regs *regs);
 static void bfusb_rx_complete(struct urb *urb, struct pt_regs *regs);
 
-static inline void bfusb_wait_for_urb(struct urb *urb)
-{
-	while (atomic_read(&urb->count) > 1) {
-		current->state = TASK_UNINTERRUPTIBLE;
-		schedule_timeout((5 * HZ + 999) / 1000);
-	}
-}
-
 static struct urb *bfusb_get_completed(struct bfusb *bfusb)
 {
 	struct sk_buff *skb;
@@ -132,7 +124,6 @@
 	while ((skb = skb_dequeue(&bfusb->pending_q))) {
 		urb = ((struct bfusb_scb *) skb->cb)->urb;
 		usb_unlink_urb(urb);
-		bfusb_wait_for_urb(urb);
 		skb_queue_tail(&bfusb->completed_q, skb);
 	}
 
@@ -661,11 +652,11 @@
 	BT_DBG("intf %p id %p", intf, id);
 
 	/* Check number of endpoints */
-	if (intf->altsetting[0].desc.bNumEndpoints < 2)
+	if (intf->cur_altsetting->desc.bNumEndpoints < 2)
 		return -EIO;
 
-	bulk_out_ep = &intf->altsetting[0].endpoint[0];
-	bulk_in_ep  = &intf->altsetting[0].endpoint[1];
+	bulk_out_ep = &intf->cur_altsetting->endpoint[0];
+	bulk_in_ep  = &intf->cur_altsetting->endpoint[1];
 
 	if (!bulk_out_ep || !bulk_in_ep) {
 		BT_ERR("Bulk endpoints not found");
diff -Nru a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
--- a/drivers/bluetooth/bt3c_cs.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/bluetooth/bt3c_cs.c	Tue Jun 15 22:21:05 2004
@@ -491,6 +491,9 @@
 
 static struct device bt3c_device = {
 	.bus_id = "pcmcia",
+	.kobj = {
+		.k_name = "bt3c"
+	}
 };
 
 
diff -Nru a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
--- a/drivers/bluetooth/hci_bcsp.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/bluetooth/hci_bcsp.c	Tue Jun 15 22:20:44 2004
@@ -33,7 +33,6 @@
 #include <linux/config.h>
 #include <linux/module.h>
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/sched.h>
diff -Nru a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
--- a/drivers/bluetooth/hci_ldisc.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/bluetooth/hci_ldisc.c	Tue Jun 15 22:20:43 2004
@@ -32,7 +32,6 @@
 #include <linux/config.h>
 #include <linux/module.h>
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/sched.h>
@@ -499,11 +498,11 @@
 /*
  * We don't provide read/write/poll interface for user space.
  */
-static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file, unsigned char *buf, size_t nr)
+static ssize_t hci_uart_tty_read(struct tty_struct *tty, struct file *file, unsigned char __user *buf, size_t nr)
 {
 	return 0;
 }
-static ssize_t hci_uart_tty_write(struct tty_struct *tty, struct file *file, const unsigned char *data, size_t count)
+static ssize_t hci_uart_tty_write(struct tty_struct *tty, struct file *file, const unsigned char __user *data, size_t count)
 {
 	return 0;
 }
diff -Nru a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
--- a/drivers/bluetooth/hci_usb.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/bluetooth/hci_usb.c	Tue Jun 15 22:21:02 2004
@@ -29,9 +29,7 @@
  *    Copyright (c) 2000 Greg Kroah-Hartman        <greg@kroah.com>
  *    Copyright (c) 2000 Mark Douglas Corner       <mcorner@umich.edu>
  *
- * $Id: hci_usb.c,v 1.8 2002/07/18 17:23:09 maxk Exp $    
  */
-#define VERSION "2.5"
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -57,9 +55,9 @@
 
 #ifndef CONFIG_BT_HCIUSB_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #undef  BT_DMP
-#define BT_DMP( A... )
+#define BT_DMP(D...)
 #endif
 
 #ifndef CONFIG_BT_HCIUSB_ZERO_PACKET
@@ -67,6 +65,8 @@
 #define URB_ZERO_PACKET 0
 #endif
 
+#define VERSION "2.6"
+
 static struct usb_driver hci_usb_driver; 
 
 static struct usb_device_id bluetooth_ids[] = {
@@ -100,7 +100,10 @@
 	/* Digianswer device */
 	{ USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER },
 
-	{ }     /* Terminating entry */
+	/* RTX Telecom based adapter with buggy SCO support */
+	{ USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC },
+
+	{ }	/* Terminating entry */
 };
 
 struct _urb *_urb_alloc(int isoc, int gfp)
@@ -342,7 +345,7 @@
 
 static inline void hci_usb_wait_for_urb(struct urb *urb)
 {
-	while (atomic_read(&urb->count) > 1) {
+	while (atomic_read(&urb->kref.refcount) > 1) {
 		current->state = TASK_UNINTERRUPTIBLE;
 		schedule_timeout((5 * HZ + 999) / 1000);
 	}
@@ -393,7 +396,7 @@
 {
 	struct hci_usb *husb = (struct hci_usb *) hdev->driver_data;
 	unsigned long flags;
-	
+
 	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
 		return 0;
 
@@ -402,7 +405,7 @@
 	/* Synchronize with completion handlers */
 	write_lock_irqsave(&husb->completion_lock, flags);
 	write_unlock_irqrestore(&husb->completion_lock, flags);
-	
+
 	hci_usb_unlink_urbs(husb);
 	hci_usb_flush(hdev);
 	return 0;
@@ -414,7 +417,7 @@
 	int err;
 
 	BT_DBG("%s urb %p type %d", husb->hdev->name, urb, _urb->type);
-	
+
 	_urb_queue_tail(__pending_q(husb, _urb->type), _urb);
 	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if (err) {
@@ -551,7 +554,7 @@
 				skb_queue_head(q, skb);
 		}
 #endif
-		
+
 		/* Process ACL queue */
 		q = __transmit_q(husb, HCI_ACLDATA_PKT);
 		while (atomic_read(__pending_tx(husb, HCI_ACLDATA_PKT)) < HCI_MAX_BULK_TX &&
@@ -656,7 +659,7 @@
 				if (count >= HCI_SCO_HDR_SIZE) {
 					struct hci_sco_hdr *h = data;
 					len = HCI_SCO_HDR_SIZE + h->dlen;
-				} else 
+				} else
 					return -EILSEQ;
 				break;
 #endif
@@ -702,7 +705,7 @@
 	struct _urb *_urb = container_of(urb, struct _urb, urb);
 	struct hci_usb *husb = (void *) urb->context;
 	struct hci_dev *hdev = husb->hdev;
-	int    err, count = urb->actual_length;
+	int err, count = urb->actual_length;
 
 	BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb,
 			_urb->type, urb->status, count, urb->transfer_flags);
@@ -743,7 +746,7 @@
 
 resubmit:
 	urb->dev = husb->udev;
-	err      = usb_submit_urb(urb, GFP_ATOMIC);
+	err = usb_submit_urb(urb, GFP_ATOMIC);
 	BT_DBG("%s urb %p type %d resubmit status %d", hdev->name, urb,
 			_urb->type, err);
 
@@ -779,7 +782,7 @@
 	_urb_queue_tail(__completed_q(husb, _urb->type), _urb);
 
 	hci_usb_tx_wakeup(husb);
-	
+
 	read_unlock(&husb->completion_lock);
 }
 
@@ -795,17 +798,15 @@
 int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
 {
 	struct usb_device *udev = interface_to_usbdev(intf);
-	struct usb_host_endpoint *bulk_out_ep[HCI_MAX_IFACE_NUM];
-	struct usb_host_endpoint *isoc_out_ep[HCI_MAX_IFACE_NUM];
-	struct usb_host_endpoint *bulk_in_ep[HCI_MAX_IFACE_NUM];
-	struct usb_host_endpoint *isoc_in_ep[HCI_MAX_IFACE_NUM];
-	struct usb_host_endpoint *intr_in_ep[HCI_MAX_IFACE_NUM];
+	struct usb_host_endpoint *bulk_out_ep = NULL;
+	struct usb_host_endpoint *bulk_in_ep = NULL;
+	struct usb_host_endpoint *intr_in_ep = NULL;
 	struct usb_host_endpoint  *ep;
 	struct usb_host_interface *uif;
-	struct usb_interface *iface, *isoc_iface;
+	struct usb_interface *isoc_iface;
 	struct hci_usb *husb;
 	struct hci_dev *hdev;
-	int i, a, e, size, ifn, isoc_ifnum, isoc_alts;
+	int i, e, size, isoc_ifnum, isoc_alts;
 
 	BT_DBG("udev %p intf %p", udev, intf);
 
@@ -816,84 +817,37 @@
 			id = match;
 	}
 
-	iface = udev->actconfig->interface[0];
-
 	if (id->driver_info & HCI_IGNORE)
 		return -ENODEV;
 
-	if (intf->altsetting->desc.bInterfaceNumber > 0)
+	if (intf->cur_altsetting->desc.bInterfaceNumber > 0)
 		return -ENODEV;
 
-	/* Check number of endpoints */
-	if (intf->altsetting[0].desc.bNumEndpoints < 3)
-		return -EIO;
-
-	memset(bulk_out_ep, 0, sizeof(bulk_out_ep));
-	memset(isoc_out_ep, 0, sizeof(isoc_out_ep));
-	memset(bulk_in_ep,  0, sizeof(bulk_in_ep));
-	memset(isoc_in_ep,  0, sizeof(isoc_in_ep));
-	memset(intr_in_ep,  0, sizeof(intr_in_ep));
-
-	size = 0; 
-	isoc_iface = NULL;
-	isoc_alts  = isoc_ifnum = 0;
-	
 	/* Find endpoints that we need */
-
-	ifn = min_t(unsigned int, udev->actconfig->desc.bNumInterfaces, HCI_MAX_IFACE_NUM);
-	for (i = 0; i < ifn; i++) {
-		iface = udev->actconfig->interface[i];
-		for (a = 0; a < iface->num_altsetting; a++) {
-			uif = &iface->altsetting[a];
-			for (e = 0; e < uif->desc.bNumEndpoints; e++) {
-				ep = &uif->endpoint[e];
-
-				switch (ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
-				case USB_ENDPOINT_XFER_INT:
-					if (ep->desc.bEndpointAddress & USB_DIR_IN)
-						intr_in_ep[i] = ep;
-					break;
-
-				case USB_ENDPOINT_XFER_BULK:
-					if (ep->desc.bEndpointAddress & USB_DIR_IN)
-						bulk_in_ep[i]  = ep;
-					else
-						bulk_out_ep[i] = ep;
-					break;
-
-#ifdef CONFIG_BT_HCIUSB_SCO
-				case USB_ENDPOINT_XFER_ISOC:
-					if (ep->desc.wMaxPacketSize < size || a > 2)
-						break;
-					size = ep->desc.wMaxPacketSize;
-
-					isoc_iface = iface;
-					isoc_alts  = a;
-					isoc_ifnum = i;
-
-					if (ep->desc.bEndpointAddress & USB_DIR_IN)
-						isoc_in_ep[i]  = ep;
-					else
-						isoc_out_ep[i] = ep;
-					break;
-#endif
-				}
-			}
+	uif = intf->cur_altsetting;
+	for (e = 0; e < uif->desc.bNumEndpoints; e++) {
+		ep = &uif->endpoint[e];
+
+		switch (ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
+		case USB_ENDPOINT_XFER_INT:
+			if (ep->desc.bEndpointAddress & USB_DIR_IN)
+				intr_in_ep = ep;
+			break;
+
+		case USB_ENDPOINT_XFER_BULK:
+			if (ep->desc.bEndpointAddress & USB_DIR_IN)
+				bulk_in_ep  = ep;
+			else
+				bulk_out_ep = ep;
+			break;
 		}
 	}
 
-	if (!bulk_in_ep[0] || !bulk_out_ep[0] || !intr_in_ep[0]) {
+	if (!bulk_in_ep || !bulk_out_ep || !intr_in_ep) {
 		BT_DBG("Bulk endpoints not found");
 		goto done;
 	}
 
-#ifdef CONFIG_BT_HCIUSB_SCO
-	if (!isoc_in_ep[1] || !isoc_out_ep[1]) {
-		BT_DBG("Isoc endpoints not found");
-		isoc_iface = NULL;
-	}
-#endif
-
 	if (!(husb = kmalloc(sizeof(struct hci_usb), GFP_KERNEL))) {
 		BT_ERR("Can't allocate: control structure");
 		goto done;
@@ -902,32 +856,74 @@
 	memset(husb, 0, sizeof(struct hci_usb));
 
 	husb->udev = udev;
-	husb->bulk_out_ep = bulk_out_ep[0];
-	husb->bulk_in_ep  = bulk_in_ep[0];
-	husb->intr_in_ep  = intr_in_ep[0];
+	husb->bulk_out_ep = bulk_out_ep;
+	husb->bulk_in_ep  = bulk_in_ep;
+	husb->intr_in_ep  = intr_in_ep;
 
 	if (id->driver_info & HCI_DIGIANSWER)
 		husb->ctrl_req = HCI_DIGI_REQ;
 	else
 		husb->ctrl_req = HCI_CTRL_REQ;
 
+	/* Find isochronous endpoints that we can use */
+	size = 0; 
+	isoc_iface = NULL;
+	isoc_alts  = 0;
+	isoc_ifnum = 1;
+
 #ifdef CONFIG_BT_HCIUSB_SCO
+	if (!(id->driver_info & HCI_BROKEN_ISOC))
+		isoc_iface = usb_ifnum_to_if(udev, isoc_ifnum);
+
 	if (isoc_iface) {
-		BT_DBG("isoc ifnum %d alts %d", isoc_ifnum, isoc_alts);
-		if (usb_set_interface(udev, isoc_ifnum, isoc_alts)) {
-			BT_ERR("Can't set isoc interface settings");
-			isoc_iface = NULL;
-		}
-		usb_driver_claim_interface(&hci_usb_driver, isoc_iface, husb);
-		husb->isoc_iface  = isoc_iface;
-		husb->isoc_in_ep  = isoc_in_ep[isoc_ifnum];
-		husb->isoc_out_ep = isoc_out_ep[isoc_ifnum];
+		int a;
+		struct usb_host_endpoint *isoc_out_ep = NULL;
+		struct usb_host_endpoint *isoc_in_ep = NULL;
+
+		for (a = 0; a < isoc_iface->num_altsetting; a++) {
+			uif = &isoc_iface->altsetting[a];
+			for (e = 0; e < uif->desc.bNumEndpoints; e++) {
+				ep = &uif->endpoint[e];
+
+				switch (ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
+				case USB_ENDPOINT_XFER_ISOC:
+					if (ep->desc.wMaxPacketSize < size ||
+							uif->desc.bAlternateSetting > 2)
+						break;
+					size = ep->desc.wMaxPacketSize;
+
+					isoc_alts = uif->desc.bAlternateSetting;
+
+					if (ep->desc.bEndpointAddress & USB_DIR_IN)
+						isoc_in_ep  = ep;
+					else
+						isoc_out_ep = ep;
+					break;
+				}
+			}
+		}
+
+		if (!isoc_in_ep || !isoc_out_ep)
+			BT_DBG("Isoc endpoints not found");
+		else {
+			BT_DBG("isoc ifnum %d alts %d", isoc_ifnum, isoc_alts);
+			if (usb_driver_claim_interface(&hci_usb_driver, isoc_iface, husb) != 0)
+				BT_ERR("Can't claim isoc interface");
+			else if (usb_set_interface(udev, isoc_ifnum, isoc_alts)) {
+				BT_ERR("Can't set isoc interface settings");
+				usb_driver_release_interface(&hci_usb_driver, isoc_iface);
+			} else {
+				husb->isoc_iface  = isoc_iface;
+				husb->isoc_in_ep  = isoc_in_ep;
+				husb->isoc_out_ep = isoc_out_ep;
+			}
+		}
 	}
 #endif
-	
+
 	husb->completion_lock = RW_LOCK_UNLOCKED;
 
-	for (i = 0; i < 4; i++) {	
+	for (i = 0; i < 4; i++) {
 		skb_queue_head_init(&husb->transmit_q[i]);
 		_urb_queue_init(&husb->pending_q[i]);
 		_urb_queue_init(&husb->completed_q[i]);
@@ -946,10 +942,10 @@
 	hdev->driver_data = husb;
 	SET_HCIDEV_DEV(hdev, &intf->dev);
 
-	hdev->open  = hci_usb_open;
-	hdev->close = hci_usb_close;
-	hdev->flush = hci_usb_flush;
-	hdev->send  = hci_usb_send_frame;
+	hdev->open     = hci_usb_open;
+	hdev->close    = hci_usb_close;
+	hdev->flush    = hci_usb_flush;
+	hdev->send     = hci_usb_send_frame;
 	hdev->destruct = hci_usb_destruct;
 
 	hdev->owner = THIS_MODULE;
@@ -967,6 +963,8 @@
 	return 0;
 
 probe_error:
+	if (husb->isoc_iface)
+		usb_driver_release_interface(&hci_usb_driver, husb->isoc_iface);
 	kfree(husb);
 
 done:
@@ -976,11 +974,13 @@
 static void hci_usb_disconnect(struct usb_interface *intf)
 {
 	struct hci_usb *husb = usb_get_intfdata(intf);
-	struct hci_dev *hdev = husb->hdev;
+	struct hci_dev *hdev;
 
-	if (!husb)
+	if (!husb || intf == husb->isoc_iface)
 		return;
+
 	usb_set_intfdata(intf, NULL);
+	hdev = husb->hdev;
 
 	BT_DBG("%s", hdev->name);
 
@@ -996,11 +996,11 @@
 }
 
 static struct usb_driver hci_usb_driver = {
-	.owner      =  THIS_MODULE,
-	.name       =  "hci_usb",
-	.probe      =  hci_usb_probe,
-	.disconnect =  hci_usb_disconnect,
-	.id_table   =  bluetooth_ids,
+	.owner		= THIS_MODULE,
+	.name		= "hci_usb",
+	.probe		= hci_usb_probe,
+	.disconnect	= hci_usb_disconnect,
+	.id_table	= bluetooth_ids,
 };
 
 static int __init hci_usb_init(void)
diff -Nru a/drivers/bluetooth/hci_usb.h b/drivers/bluetooth/hci_usb.h
--- a/drivers/bluetooth/hci_usb.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/bluetooth/hci_usb.h	Tue Jun 15 22:20:43 2004
@@ -23,33 +23,28 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * $Id: hci_usb.h,v 1.2 2002/03/18 19:10:04 maxk Exp $
- */
-
-#ifdef __KERNEL__
-
 /* Class, SubClass, and Protocol codes that describe a Bluetooth device */
-#define HCI_DEV_CLASS        0xe0	/* Wireless class */
-#define HCI_DEV_SUBCLASS     0x01	/* RF subclass */
-#define HCI_DEV_PROTOCOL     0x01	/* Bluetooth programming protocol */
-
-#define HCI_CTRL_REQ	     0x20
-#define HCI_DIGI_REQ	     0x40
+#define HCI_DEV_CLASS		0xe0	/* Wireless class */
+#define HCI_DEV_SUBCLASS	0x01	/* RF subclass */
+#define HCI_DEV_PROTOCOL	0x01	/* Bluetooth programming protocol */
+
+#define HCI_CTRL_REQ		0x20
+#define HCI_DIGI_REQ		0x40
+
+#define HCI_IGNORE		0x01
+#define HCI_RESET		0x02
+#define HCI_DIGIANSWER		0x04
+#define HCI_BROKEN_ISOC		0x08
 
-#define HCI_IGNORE           0x01
-#define HCI_RESET            0x02
-#define HCI_DIGIANSWER       0x04
+#define HCI_MAX_IFACE_NUM	3
 
-#define HCI_MAX_IFACE_NUM	3 
-
-#define HCI_MAX_BULK_TX     	4
-#define HCI_MAX_BULK_RX     	1
+#define HCI_MAX_BULK_TX		4
+#define HCI_MAX_BULK_RX		1
 
 #define HCI_MAX_ISOC_RX		2
 #define HCI_MAX_ISOC_TX		2
 
-#define HCI_MAX_ISOC_FRAMES     10
+#define HCI_MAX_ISOC_FRAMES	10
 
 struct _urb_queue {
 	struct list_head head;
@@ -79,16 +74,16 @@
 
 static inline void _urb_queue_head(struct _urb_queue *q, struct _urb *_urb)
 {
-        unsigned long flags;
-        spin_lock_irqsave(&q->lock, flags);
+	unsigned long flags;
+	spin_lock_irqsave(&q->lock, flags);
 	list_add(&_urb->list, &q->head); _urb->queue = q;
 	spin_unlock_irqrestore(&q->lock, flags);
 }
 
 static inline void _urb_queue_tail(struct _urb_queue *q, struct _urb *_urb)
 {
-        unsigned long flags;
-        spin_lock_irqsave(&q->lock, flags);
+	unsigned long flags;
+	spin_lock_irqsave(&q->lock, flags);
 	list_add_tail(&_urb->list, &q->head); _urb->queue = q;
 	spin_unlock_irqrestore(&q->lock, flags);
 }
@@ -96,9 +91,9 @@
 static inline void _urb_unlink(struct _urb *_urb)
 {
 	struct _urb_queue *q = _urb->queue;
-        unsigned long flags;
+	unsigned long flags;
 	if (q) {
-        	spin_lock_irqsave(&q->lock, flags);
+		spin_lock_irqsave(&q->lock, flags);
 		list_del(&_urb->list); _urb->queue = NULL;
 		spin_unlock_irqrestore(&q->lock, flags);
 	}
@@ -106,41 +101,33 @@
 
 struct _urb *_urb_dequeue(struct _urb_queue *q);
 
-#ifndef container_of
-#define container_of(ptr, type, member) ({                      \
-		        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-			        (type *)( (char *)__mptr - offsetof(type,member) );})
-#endif
-
 struct hci_usb {
 	struct hci_dev		*hdev;
 
 	unsigned long		state;
 	
-	struct usb_device 	*udev;
+	struct usb_device	*udev;
 	
 	struct usb_host_endpoint	*bulk_in_ep;
 	struct usb_host_endpoint	*bulk_out_ep;
 	struct usb_host_endpoint	*intr_in_ep;
 
-	struct usb_interface            *isoc_iface;
+	struct usb_interface		*isoc_iface;
 	struct usb_host_endpoint	*isoc_out_ep;
 	struct usb_host_endpoint	*isoc_in_ep;
 
 	__u8			ctrl_req;
 
 	struct sk_buff_head	transmit_q[4];
-	struct sk_buff		*reassembly[4]; // Reassembly buffers
+	struct sk_buff		*reassembly[4];		/* Reassembly buffers */
 
 	rwlock_t		completion_lock;
 
-	atomic_t		pending_tx[4];  // Number of pending requests 
-	struct _urb_queue	pending_q[4];   // Pending requests
-	struct _urb_queue	completed_q[4]; // Completed requests
+	atomic_t		pending_tx[4];		/* Number of pending requests */
+	struct _urb_queue	pending_q[4];		/* Pending requests */
+	struct _urb_queue	completed_q[4];		/* Completed requests */
 };
 
 /* States  */
 #define HCI_USB_TX_PROCESS	1
 #define HCI_USB_TX_WAKEUP	2
-
-#endif /* __KERNEL__ */
diff -Nru a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
--- a/drivers/bluetooth/hci_vhci.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/bluetooth/hci_vhci.c	Tue Jun 15 22:21:03 2004
@@ -127,7 +127,7 @@
 }
 
 /* Get packet from user space buffer(already verified) */
-static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const char *buf, size_t count)
+static inline ssize_t hci_vhci_get_user(struct hci_vhci_struct *hci_vhci, const char __user *buf, size_t count)
 {
 	struct sk_buff *skb;
 
@@ -152,7 +152,7 @@
 } 
 
 /* Write */
-static ssize_t hci_vhci_chr_write(struct file * file, const char * buf, 
+static ssize_t hci_vhci_chr_write(struct file * file, const char __user * buf, 
 			     size_t count, loff_t *pos)
 {
 	struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data;
@@ -165,10 +165,11 @@
 
 /* Put packet to user space buffer(already verified) */
 static inline ssize_t hci_vhci_put_user(struct hci_vhci_struct *hci_vhci,
-				       struct sk_buff *skb, char *buf, int count)
+				       struct sk_buff *skb, char __user *buf,
+				       int count)
 {
 	int len = count, total = 0;
-	char *ptr = buf;
+	char __user *ptr = buf;
 
 	len = min_t(unsigned int, skb->len, len);
 	if (copy_to_user(ptr, skb->data, len))
@@ -194,7 +195,7 @@
 }
 
 /* Read */
-static ssize_t hci_vhci_chr_read(struct file * file, char * buf, size_t count, loff_t *pos)
+static ssize_t hci_vhci_chr_read(struct file * file, char __user * buf, size_t count, loff_t *pos)
 {
 	struct hci_vhci_struct *hci_vhci = (struct hci_vhci_struct *) file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
diff -Nru a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c
--- a/drivers/cdrom/aztcd.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/cdrom/aztcd.c	Tue Jun 15 22:21:02 2004
@@ -374,6 +374,7 @@
 }
 
 /* Wait for PA_OK = drive answers with AFL_PA_OK after receiving parameters*/
+#if 0
 # define PA_OK pa_ok()
 static void pa_ok(void)
 {
@@ -387,6 +388,7 @@
 		}
 	} while (aztIndatum != AFL_PA_OK);
 }
+#endif
 
 /* Wait for STEN=Low = handshake signal 'AFL_.._OK available or command executed*/
 # define STEN_LOW  sten_low()
@@ -871,7 +873,7 @@
 /* Read the table of contents header, i.e. no. of tracks and start of first 
  * track
  */
-static int aztGetDiskInfo()
+static int aztGetDiskInfo(void)
 {
 	int limit;
 	unsigned char test;
@@ -1165,6 +1167,7 @@
 	struct azt_Toc *tocPtr;
 	struct cdrom_subchnl subchnl;
 	struct cdrom_volctrl volctrl;
+	void __user *argp = (void __user *)arg;
 
 #ifdef AZT_DEBUG
 	printk("aztcd: starting aztcd_ioctl - Command:%x   Time: %li\n",
@@ -1228,8 +1231,7 @@
 #ifdef AZT_DEBUG
 			printk("aztcd ioctl MULTISESSION\n");
 #endif
-			if (copy_from_user
-			    (&ms, (void *) arg,
+			if (copy_from_user(&ms, argp,
 			     sizeof(struct cdrom_multisession)))
 				return -EFAULT;
 			if (ms.addr_format == CDROM_MSF) {
@@ -1246,8 +1248,7 @@
 			else
 				return -EINVAL;
 			ms.xa_flag = DiskInfo.xa;
-			if (copy_to_user
-			    ((void *) arg, &ms,
+			if (copy_to_user(argp, &ms,
 			     sizeof(struct cdrom_multisession)))
 				return -EFAULT;
 #ifdef AZT_DEBUG
@@ -1270,7 +1271,7 @@
 			return 0;
 		}
 	case CDROMPLAYTRKIND:	/* Play a track.  This currently ignores index. */
-		if (copy_from_user(&ti, (void *) arg, sizeof ti))
+		if (copy_from_user(&ti, argp, sizeof ti))
 			return -EFAULT;
 		if (ti.cdti_trk0 < DiskInfo.first
 		    || ti.cdti_trk0 > DiskInfo.last
@@ -1301,7 +1302,7 @@
 		  aztAudioStatus = CDROM_AUDIO_NO_STATUS;
 		}
 */
-		if (copy_from_user(&msf, (void *) arg, sizeof msf))
+		if (copy_from_user(&msf, argp, sizeof msf))
 			return -EFAULT;
 		/* convert to bcd */
 		azt_bin2bcd(&msf.cdmsf_min0);
@@ -1333,11 +1334,11 @@
 	case CDROMREADTOCHDR:	/* Read the table of contents header */
 		tocHdr.cdth_trk0 = DiskInfo.first;
 		tocHdr.cdth_trk1 = DiskInfo.last;
-		if (copy_to_user((void *) arg, &tocHdr, sizeof tocHdr))
+		if (copy_to_user(argp, &tocHdr, sizeof tocHdr))
 			return -EFAULT;
 		break;
 	case CDROMREADTOCENTRY:	/* Read an entry in the table of contents */
-		if (copy_from_user(&entry, (void *) arg, sizeof entry))
+		if (copy_from_user(&entry, argp, sizeof entry))
 			return -EFAULT;
 		if ((!aztTocUpToDate) || aztDiskChanged)
 			aztUpdateToc();
@@ -1363,12 +1364,12 @@
 		} else {
 			return -EINVAL;
 		}
-		if (copy_to_user((void *) arg, &entry, sizeof entry))
+		if (copy_to_user(argp, &entry, sizeof entry))
 			return -EFAULT;
 		break;
 	case CDROMSUBCHNL:	/* Get subchannel info */
 		if (copy_from_user
-		    (&subchnl, (void *) arg, sizeof(struct cdrom_subchnl)))
+		    (&subchnl, argp, sizeof(struct cdrom_subchnl)))
 			return -EFAULT;
 		if (aztGetQChannelInfo(&qInfo) < 0) {
 #ifdef AZT_DEBUG
@@ -1403,16 +1404,14 @@
 			subchnl.cdsc_reladdr.msf.frame =
 			    azt_bcd2bin(qInfo.trackTime.frame);
 		}
-		if (copy_to_user
-		    ((void *) arg, &subchnl, sizeof(struct cdrom_subchnl)))
+		if (copy_to_user(argp, &subchnl, sizeof(struct cdrom_subchnl)))
 			return -EFAULT;
 		break;
 	case CDROMVOLCTRL:	/* Volume control 
 				   * With my Aztech CD268-01A volume control does not work, I can only
 				   turn the channels on (any value !=0) or off (value==0). Maybe it
 				   works better with your drive */
-		if (copy_from_user
-		    (&volctrl, (char *) arg, sizeof(volctrl)))
+		if (copy_from_user(&volctrl, argp, sizeof(volctrl)))
 			return -EFAULT;
 		azt_Play.start.min = 0x21;
 		azt_Play.start.sec = 0x84;
@@ -1455,7 +1454,7 @@
 	case CDROMREADCOOKED:	/*read data in mode 1 (2048 Bytes) */
 	case CDROMREADRAW:	/*read data in mode 2 (2336 Bytes) */
 		{
-			if (copy_from_user(&msf, (void *) arg, sizeof msf))
+			if (copy_from_user(&msf, argp, sizeof msf))
 				return -EFAULT;
 			/* convert to bcd */
 			azt_bin2bcd(&msf.cdmsf_min0);
@@ -1474,16 +1473,11 @@
 				if (DiskInfo.xa) {
 					return -1;	/*XA Disks can't be read raw */
 				} else {
-					if (sendAztCmd
-					    (ACMD_PLAY_READ_RAW,
-					     &azt_Play))
+					if (sendAztCmd(ACMD_PLAY_READ_RAW, &azt_Play))
 						return -1;
 					DTEN_LOW;
-					insb(DATA_PORT, buf,
-					     CD_FRAMESIZE_RAW);
-					if (copy_to_user
-					    ((void *) arg, &buf,
-					     CD_FRAMESIZE_RAW))
+					insb(DATA_PORT, buf, CD_FRAMESIZE_RAW);
+					if (copy_to_user(argp, &buf, CD_FRAMESIZE_RAW))
 						return -EFAULT;
 				}
 			} else
@@ -1492,14 +1486,13 @@
 					return -1;
 				DTEN_LOW;
 				insb(DATA_PORT, buf, CD_FRAMESIZE);
-				if (copy_to_user
-				    ((void *) arg, &buf, CD_FRAMESIZE))
+				if (copy_to_user(argp, &buf, CD_FRAMESIZE))
 					return -EFAULT;
 				}
 		}
 		break;
 	case CDROMSEEK:	/*seek msf address */
-		if (copy_from_user(&msf, (void *) arg, sizeof msf))
+		if (copy_from_user(&msf, argp, sizeof msf))
 			return -EFAULT;
 		/* convert to bcd */
 		azt_bin2bcd(&msf.cdmsf_min0);
diff -Nru a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
--- a/drivers/cdrom/cdrom.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/cdrom/cdrom.c	Tue Jun 15 22:20:37 2004
@@ -318,11 +318,11 @@
 
 /* These are used to simplify getting data in from and back to user land */
 #define IOCTL_IN(arg, type, in)					\
-	if (copy_from_user(&(in), (type *) (arg), sizeof (in)))	\
+	if (copy_from_user(&(in), (type __user *) (arg), sizeof (in)))	\
 		return -EFAULT;
 
 #define IOCTL_OUT(arg, type, out) \
-	if (copy_to_user((type *) (arg), &(out), sizeof (out)))	\
+	if (copy_to_user((type __user *) (arg), &(out), sizeof (out)))	\
 		return -EFAULT;
 
 /* The (cdo->capability & ~cdi->mask & CDC_XXX) construct was used in
@@ -455,7 +455,7 @@
 int cdrom_get_media_event(struct cdrom_device_info *cdi,
 			  struct media_event_desc *med)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	unsigned char buffer[8];
 	struct event_header *eh = (struct event_header *) buffer;
 
@@ -482,7 +482,7 @@
  */
 int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	char buffer[16];
 
 	init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ);
@@ -503,7 +503,7 @@
 
 int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct mrw_feature_desc *mfd;
 	unsigned char buffer[16];
 	int ret;
@@ -529,7 +529,7 @@
 
 static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	unsigned char buffer[12];
 	int ret;
 
@@ -570,7 +570,7 @@
 
 static int cdrom_mrw_bgformat_susp(struct cdrom_device_info *cdi, int immed)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 
 	init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
 	cgc.cmd[0] = GPCMD_CLOSE_TRACK;
@@ -588,7 +588,7 @@
 
 static int cdrom_flush_cache(struct cdrom_device_info *cdi)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 
 	init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
 	cgc.cmd[0] = GPCMD_FLUSH_CACHE;
@@ -619,7 +619,7 @@
 
 static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct mode_page_header *mph;
 	char buffer[16];
 	int ret, offset, size;
@@ -649,9 +649,8 @@
 int cdrom_get_random_writable(struct cdrom_device_info *cdi,
 			      struct rwrt_feature_desc *rfd)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	char buffer[24];
-	struct feature_header *fh;
 	int ret;
 
 	init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ);
@@ -664,43 +663,32 @@
 	if ((ret = cdi->ops->generic_packet(cdi, &cgc)))
 		return ret;
 
-	fh = (struct feature_header *)&buffer[0];
-	if (be32_to_cpu(fh->data_len) >= (sizeof(struct feature_header)+
-					  sizeof(struct rwrt_feature_desc)))
-		memcpy(rfd, &buffer[sizeof(struct feature_header)],
-		       sizeof (*rfd));
-	else
-		memset(rfd, 0, sizeof(*rfd));
-
+	memcpy(rfd, &buffer[sizeof(struct feature_header)], sizeof (*rfd));
 	return 0;
 }
 
 int cdrom_has_defect_mgt(struct cdrom_device_info *cdi)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	char buffer[16];
-	struct feature_header *fh;
 	__u16 *feature_code;
 	int ret;
 
 	init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ);
 
-	cgc.cmd[0] = GPCMD_GET_CONFIGURATION;	/* often 0x46 */
-	cgc.cmd[3] = CDF_HWDM;			/* often 0x0024 */
-	cgc.cmd[8] = sizeof(buffer);		/* often 0x10 */
+	cgc.cmd[0] = GPCMD_GET_CONFIGURATION;
+	cgc.cmd[3] = CDF_HWDM;
+	cgc.cmd[8] = sizeof(buffer);
 	cgc.quiet = 1;
 
 	if ((ret = cdi->ops->generic_packet(cdi, &cgc)))
 		return ret;
 
-	fh = (struct feature_header *)&buffer[0];
-	ret = 1;
-	if (be32_to_cpu(fh->data_len) >= (sizeof(struct feature_header)+8)) {
-		feature_code = (__u16 *)&buffer[sizeof(struct feature_header)];
-		if (CDF_HWDM == be16_to_cpu(*feature_code))
-			ret = 0;
-	}
-	return ret;
+	feature_code = (__u16 *) &buffer[sizeof(struct feature_header)];
+	if (be16_to_cpu(*feature_code) == CDF_HWDM)
+		return 0;
+
+	return 1;
 }
 
 
@@ -785,7 +773,7 @@
 
 static int mo_open_write(struct cdrom_device_info *cdi)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	char buffer[255];
 	int ret;
 
@@ -1102,7 +1090,7 @@
 static int cdrom_read_mech_status(struct cdrom_device_info *cdi, 
 				  struct cdrom_changer_info *buf)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct cdrom_device_ops *cdo = cdi->ops;
 	int length;
 
@@ -1185,7 +1173,7 @@
 /* If SLOT < 0, unload the current slot.  Otherwise, try to load SLOT. */
 static int cdrom_load_unload(struct cdrom_device_info *cdi, int slot) 
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 
 	cdinfo(CD_CHANGER, "entering cdrom_load_unload()\n"); 
 	if (cdi->sanyo_slot && slot < 0)
@@ -1384,10 +1372,10 @@
 	*curr = requested;
 }
 
-void init_cdrom_command(struct cdrom_generic_command *cgc, void *buf, int len,
+void init_cdrom_command(struct packet_command *cgc, void *buf, int len,
 			int type)
 {
-	memset(cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(cgc, 0, sizeof(struct packet_command));
 	if (buf)
 		memset(buf, 0, len);
 	cgc->buffer = (char *) buf;
@@ -1401,7 +1389,7 @@
 #define copy_key(dest,src)	memcpy((dest), (src), sizeof(dvd_key))
 #define copy_chal(dest,src)	memcpy((dest), (src), sizeof(dvd_challenge))
 
-static void setup_report_key(struct cdrom_generic_command *cgc, unsigned agid, unsigned type)
+static void setup_report_key(struct packet_command *cgc, unsigned agid, unsigned type)
 {
 	cgc->cmd[0] = GPCMD_REPORT_KEY;
 	cgc->cmd[10] = type | (agid << 6);
@@ -1423,7 +1411,7 @@
 	cgc->data_direction = CGC_DATA_READ;
 }
 
-static void setup_send_key(struct cdrom_generic_command *cgc, unsigned agid, unsigned type)
+static void setup_send_key(struct packet_command *cgc, unsigned agid, unsigned type)
 {
 	cgc->cmd[0] = GPCMD_SEND_KEY;
 	cgc->cmd[10] = type | (agid << 6);
@@ -1449,7 +1437,7 @@
 {
 	int ret;
 	u_char buf[20];
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct cdrom_device_ops *cdo = cdi->ops;
 	rpc_state_t rpc_state;
 
@@ -1595,7 +1583,7 @@
 {
 	unsigned char buf[21], *base;
 	struct dvd_layer *layer;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct cdrom_device_ops *cdo = cdi->ops;
 	int ret, layer_num = s->physical.layer_num;
 
@@ -1645,7 +1633,7 @@
 {
 	int ret;
 	u_char buf[8];
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct cdrom_device_ops *cdo = cdi->ops;
 
 	init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ);
@@ -1668,7 +1656,7 @@
 {
 	int ret, size;
 	u_char *buf;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct cdrom_device_ops *cdo = cdi->ops;
 
 	size = sizeof(s->disckey.value) + 4;
@@ -1694,7 +1682,7 @@
 {
 	int ret;
 	u_char buf[4 + 188];
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct cdrom_device_ops *cdo = cdi->ops;
 
 	init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ);
@@ -1719,7 +1707,7 @@
 {
 	int ret = 0, size;
 	u_char *buf;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct cdrom_device_ops *cdo = cdi->ops;
 
 	size = sizeof(s->manufact.value) + 4;
@@ -1777,7 +1765,7 @@
 }
 
 int cdrom_mode_sense(struct cdrom_device_info *cdi,
-		     struct cdrom_generic_command *cgc,
+		     struct packet_command *cgc,
 		     int page_code, int page_control)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
@@ -1793,7 +1781,7 @@
 }
 
 int cdrom_mode_select(struct cdrom_device_info *cdi,
-		      struct cdrom_generic_command *cgc)
+		      struct packet_command *cgc)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
 
@@ -1811,7 +1799,7 @@
 				 struct cdrom_subchnl *subchnl, int mcn)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	char buffer[32];
 	int ret;
 
@@ -1845,7 +1833,7 @@
  * Specific READ_10 interface
  */
 static int cdrom_read_cd(struct cdrom_device_info *cdi,
-			 struct cdrom_generic_command *cgc, int lba,
+			 struct packet_command *cgc, int lba,
 			 int blocksize, int nblocks)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
@@ -1865,7 +1853,7 @@
 
 /* very generic interface for reading the various types of blocks */
 static int cdrom_read_block(struct cdrom_device_info *cdi,
-			    struct cdrom_generic_command *cgc,
+			    struct packet_command *cgc,
 			    int lba, int nblocks, int format, int blksize)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
@@ -1899,7 +1887,7 @@
 static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
 			       int lba, int nframes)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	int nr, ret;
 
 	memset(&cgc, 0, sizeof(cgc));
@@ -2052,7 +2040,7 @@
 	int ret;
 
 	/* Try the generic SCSI command ioctl's first.. */
-	ret = scsi_cmd_ioctl(ip->i_bdev->bd_disk, cmd, arg);
+	ret = scsi_cmd_ioctl(ip->i_bdev->bd_disk, cmd, (void __user *)arg);
 	if (ret != -ENOTTY)
 		return ret;
 
@@ -2446,7 +2434,7 @@
 static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct modesel_head mh;
 
 	memset(&mh, 0, sizeof(mh));
@@ -2472,7 +2460,7 @@
 		     unsigned long arg)
 {		
 	struct cdrom_device_ops *cdo = cdi->ops;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct request_sense sense;
 	char buffer[32];
 	int ret = 0;
@@ -2526,7 +2514,7 @@
 			ret = cdrom_read_cd(cdi, &cgc, lba, blocksize, 1);
 			ret |= cdrom_switch_blocksize(cdi, blocksize);
 		}
-		if (!ret && copy_to_user((char *)arg, cgc.buffer, blocksize))
+		if (!ret && copy_to_user((char __user *)arg, cgc.buffer, blocksize))
 			ret = -EFAULT;
 		kfree(cgc.buffer);
 		return ret;
@@ -2678,7 +2666,7 @@
 		if ((s = (dvd_struct *) kmalloc(size, GFP_KERNEL)) == NULL)
 			return -ENOMEM;
 		cdinfo(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); 
-		if (copy_from_user(s, (dvd_struct *)arg, size)) {
+		if (copy_from_user(s, (dvd_struct __user *)arg, size)) {
 			kfree(s);
 			return -EFAULT;
 		}
@@ -2686,7 +2674,7 @@
 			kfree(s);
 			return ret;
 		}
-		if (copy_to_user((dvd_struct *)arg, s, size))
+		if (copy_to_user((dvd_struct __user *)arg, s, size))
 			ret = -EFAULT;
 		kfree(s);
 		return ret;
@@ -2729,7 +2717,7 @@
 			 track_information *ti)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	int ret;
 
 	init_cdrom_command(&cgc, ti, 8, CGC_DATA_READ);
@@ -2757,7 +2745,7 @@
 static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information *di)
 {
 	struct cdrom_device_ops *cdo = cdi->ops;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	int ret;
 
 	/* set up command and get the disc info */
@@ -2906,7 +2894,7 @@
 } cdrom_sysctl_settings;
 
 int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
-                           void *buffer, size_t *lenp)
+                           void __user *buffer, size_t *lenp)
 {
         int pos;
 	struct cdrom_device_info *cdi;
@@ -3033,7 +3021,7 @@
 }
 
 static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
-				void *buffer, size_t *lenp)
+				void __user *buffer, size_t *lenp)
 {
 	int *valp = ctl->data;
 	int val = *valp;
diff -Nru a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c
--- a/drivers/cdrom/cdu31a.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/cdrom/cdu31a.c	Tue Jun 15 22:20:42 2004
@@ -2595,11 +2595,10 @@
 						retval = -EIO;
 						goto exit_read_audio;
 					}
-				} else if (copy_to_user((char *)(ra->buf +
+				} else if (copy_to_user(ra->buf +
 							       (CD_FRAMESIZE_RAW
-								* cframe)),
-							(char *)
-							       readahead_buffer,
+								* cframe),
+						        readahead_buffer,
 							CD_FRAMESIZE_RAW)) {
 					retval = -EFAULT;
 					goto exit_read_audio;
@@ -2612,8 +2611,7 @@
 				retval = -EIO;
 				goto exit_read_audio;
 			}
-		} else if (copy_to_user((char *)(ra->buf + (CD_FRAMESIZE_RAW *
-							    cframe)),
+		} else if (copy_to_user(ra->buf + (CD_FRAMESIZE_RAW * cframe),
 					(char *)readahead_buffer,
 					CD_FRAMESIZE_RAW)) {
 			retval = -EFAULT;
@@ -2945,6 +2943,7 @@
 static int scd_dev_ioctl(struct cdrom_device_info *cdi,
 			 unsigned int cmd, unsigned long arg)
 {
+	void __user *argp = (void __user *)arg;
 	int i;
 
 	switch (cmd) {
@@ -2959,7 +2958,7 @@
 				return -EIO;
 			}
 
-			if (copy_from_user(&ra, (char *) arg, sizeof(ra)))
+			if (copy_from_user(&ra, argp, sizeof(ra)))
 				return -EFAULT;
 
 			if (ra.nframes == 0) {
diff -Nru a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c
--- a/drivers/cdrom/optcd.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/cdrom/optcd.c	Tue Jun 15 22:20:38 2004
@@ -1440,12 +1440,12 @@
 }
 
 
-static int cdromplaymsf(unsigned long arg)
+static int cdromplaymsf(void __user *arg)
 {
 	int status;
 	struct cdrom_msf msf;
 
-	if (copy_from_user(&msf, (void *) arg, sizeof msf))
+	if (copy_from_user(&msf, arg, sizeof msf))
 		return -EFAULT;
 
 	bin2bcd(&msf);
@@ -1461,13 +1461,13 @@
 }
 
 
-static int cdromplaytrkind(unsigned long arg)
+static int cdromplaytrkind(void __user *arg)
 {
 	int status;
 	struct cdrom_ti ti;
 	struct cdrom_msf msf;
 
-	if (copy_from_user(&ti, (void *) arg, sizeof ti))
+	if (copy_from_user(&ti, arg, sizeof ti))
 		return -EFAULT;
 
 	if (ti.cdti_trk0 < disk_info.first
@@ -1505,23 +1505,23 @@
 }
 
 
-static int cdromreadtochdr(unsigned long arg)
+static int cdromreadtochdr(void __user *arg)
 {
 	struct cdrom_tochdr tochdr;
 
 	tochdr.cdth_trk0 = disk_info.first;
 	tochdr.cdth_trk1 = disk_info.last;
 
-	return copy_to_user((void *)arg, &tochdr, sizeof tochdr) ? -EFAULT : 0;
+	return copy_to_user(arg, &tochdr, sizeof tochdr) ? -EFAULT : 0;
 }
 
 
-static int cdromreadtocentry(unsigned long arg)
+static int cdromreadtocentry(void __user *arg)
 {
 	struct cdrom_tocentry entry;
 	struct cdrom_subchnl *tocptr;
 
-	if (copy_from_user(&entry, (void *) arg, sizeof entry))
+	if (copy_from_user(&entry, arg, sizeof entry))
 		return -EFAULT;
 
 	if (entry.cdte_track == CDROM_LEADOUT)
@@ -1544,17 +1544,17 @@
 	else if (entry.cdte_format != CDROM_MSF)
 		return -EINVAL;
 
-	return copy_to_user((void *)arg, &entry, sizeof entry) ? -EFAULT : 0;
+	return copy_to_user(arg, &entry, sizeof entry) ? -EFAULT : 0;
 }
 
 
-static int cdromvolctrl(unsigned long arg)
+static int cdromvolctrl(void __user *arg)
 {
 	int status;
 	struct cdrom_volctrl volctrl;
 	struct cdrom_msf msf;
 
-	if (copy_from_user(&volctrl, (char *) arg, sizeof volctrl))
+	if (copy_from_user(&volctrl, arg, sizeof volctrl))
 		return -EFAULT;
 
 	msf.cdmsf_min0 = 0x10;
@@ -1573,12 +1573,12 @@
 }
 
 
-static int cdromsubchnl(unsigned long arg)
+static int cdromsubchnl(void __user *arg)
 {
 	int status;
 	struct cdrom_subchnl subchnl;
 
-	if (copy_from_user(&subchnl, (void *) arg, sizeof subchnl))
+	if (copy_from_user(&subchnl, arg, sizeof subchnl))
 		return -EFAULT;
 
 	if (subchnl.cdsc_format != CDROM_LBA
@@ -1591,7 +1591,7 @@
 		return -EIO;
 	}
 
-	if (copy_to_user((void *)arg, &subchnl, sizeof subchnl))
+	if (copy_to_user(arg, &subchnl, sizeof subchnl))
 		return -EFAULT;
 	return 0;
 }
@@ -1600,12 +1600,12 @@
 static struct gendisk *optcd_disk;
 
 
-static int cdromread(unsigned long arg, int blocksize, int cmd)
+static int cdromread(void __user *arg, int blocksize, int cmd)
 {
 	int status;
 	struct cdrom_msf msf;
 
-	if (copy_from_user(&msf, (void *) arg, sizeof msf))
+	if (copy_from_user(&msf, arg, sizeof msf))
 		return -EFAULT;
 
 	bin2bcd(&msf);
@@ -1621,19 +1621,19 @@
 
 	fetch_data(optcd_disk->private_data, blocksize);
 
-	if (copy_to_user((void *)arg, optcd_disk->private_data, blocksize))
+	if (copy_to_user(arg, optcd_disk->private_data, blocksize))
 		return -EFAULT;
 
 	return 0;
 }
 
 
-static int cdromseek(unsigned long arg)
+static int cdromseek(void __user *arg)
 {
 	int status;
 	struct cdrom_msf msf;
 
-	if (copy_from_user(&msf, (void *)arg, sizeof msf))
+	if (copy_from_user(&msf, arg, sizeof msf))
 		return -EFAULT;
 
 	bin2bcd(&msf);
@@ -1648,11 +1648,11 @@
 
 
 #ifdef MULTISESSION
-static int cdrommultisession(unsigned long arg)
+static int cdrommultisession(void __user *arg)
 {
 	struct cdrom_multisession ms;
 
-	if (copy_from_user(&ms, (void*) arg, sizeof ms))
+	if (copy_from_user(&ms, arg, sizeof ms))
 		return -EFAULT;
 
 	ms.addr.msf.minute = disk_info.last_session.minute;
@@ -1667,7 +1667,7 @@
 
 	ms.xa_flag = disk_info.xa;
 
-  	if (copy_to_user((void *)arg, &ms, sizeof(struct cdrom_multisession)))
+  	if (copy_to_user(arg, &ms, sizeof(struct cdrom_multisession)))
 		return -EFAULT;
 
 #if DEBUG_MULTIS
@@ -1717,6 +1717,7 @@
                      unsigned int cmd, unsigned long arg)
 {
 	int status, err, retval = 0;
+	void __user *argp = (void __user *)arg;
 
 	DEBUG((DEBUG_VFS, "starting opt_ioctl"));
 
@@ -1767,10 +1768,10 @@
 	switch (cmd) {
 	case CDROMPAUSE:	retval = cdrompause(); break;
 	case CDROMRESUME:	retval = cdromresume(); break;
-	case CDROMPLAYMSF:	retval = cdromplaymsf(arg); break;
-	case CDROMPLAYTRKIND:	retval = cdromplaytrkind(arg); break;
-	case CDROMREADTOCHDR:	retval = cdromreadtochdr(arg); break;
-	case CDROMREADTOCENTRY:	retval = cdromreadtocentry(arg); break;
+	case CDROMPLAYMSF:	retval = cdromplaymsf(argp); break;
+	case CDROMPLAYTRKIND:	retval = cdromplaytrkind(argp); break;
+	case CDROMREADTOCHDR:	retval = cdromreadtochdr(argp); break;
+	case CDROMREADTOCENTRY:	retval = cdromreadtocentry(argp); break;
 
 	case CDROMSTOP:		err = exec_cmd(COMSTOP);
 				if (err < 0) {
@@ -1799,8 +1800,8 @@
 				}
 				break;
 
-	case CDROMVOLCTRL:	retval = cdromvolctrl(arg); break;
-	case CDROMSUBCHNL:	retval = cdromsubchnl(arg); break;
+	case CDROMVOLCTRL:	retval = cdromvolctrl(argp); break;
+	case CDROMSUBCHNL:	retval = cdromsubchnl(argp); break;
 
 	/* The drive detects the mode and automatically delivers the
 	   correct 2048 bytes, so we don't need these IOCTLs */
@@ -1814,7 +1815,7 @@
 				break;
 
 #ifdef MULTISESSION
-	case CDROMMULTISESSION:	retval = cdrommultisession(arg); break;
+	case CDROMMULTISESSION:	retval = cdrommultisession(argp); break;
 #endif
 
 	case CDROM_GET_MCN:	retval = -EINVAL; break; /* not implemented */
@@ -1822,16 +1823,16 @@
 
 	case CDROMREADRAW:
 			/* this drive delivers 2340 bytes in raw mode */
-			retval = cdromread(arg, CD_FRAMESIZE_RAW1, COMREADRAW);
+			retval = cdromread(argp, CD_FRAMESIZE_RAW1, COMREADRAW);
 			break;
 	case CDROMREADCOOKED:
-			retval = cdromread(arg, CD_FRAMESIZE, COMREAD);
+			retval = cdromread(argp, CD_FRAMESIZE, COMREAD);
 			break;
 	case CDROMREADALL:
-			retval = cdromread(arg, CD_FRAMESIZE_RAWER, COMREADALL);
+			retval = cdromread(argp, CD_FRAMESIZE_RAWER, COMREADALL);
 			break;
 
-	case CDROMSEEK:		retval = cdromseek(arg); break;
+	case CDROMSEEK:		retval = cdromseek(argp); break;
 	case CDROMPLAYBLK:	retval = -EINVAL; break; /* not implemented */
 	case CDROMCLOSETRAY:	break;	/* The action was taken earlier */
 	default:		retval = -EINVAL;
diff -Nru a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c
--- a/drivers/cdrom/sjcd.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/cdrom/sjcd.c	Tue Jun 15 22:20:42 2004
@@ -716,13 +716,11 @@
 static int sjcd_ioctl(struct inode *ip, struct file *fp,
 		      unsigned int cmd, unsigned long arg)
 {
+	void __user *argp = (void __user *)arg;
 #if defined( SJCD_TRACE )
 	printk("SJCD:ioctl\n");
 #endif
 
-	if (ip == NULL)
-		return (-EINVAL);
-
 	sjcd_get_status();
 	if (!sjcd_status_valid)
 		return (-EIO);
@@ -795,7 +793,7 @@
 #if defined( SJCD_TRACE )
 			printk("SJCD: ioctl: playtrkind\n");
 #endif
-			if (!copy_from_user(&ti, (void *) arg, sizeof(ti))) {
+			if (!copy_from_user(&ti, argp, sizeof(ti))) {
 				s = 0;
 				if (ti.cdti_trk0 < sjcd_first_track_no)
 					return (-EINVAL);
@@ -833,7 +831,7 @@
 			printk("SJCD: ioctl: playmsf\n");
 #endif
 			if ((s =
-			     verify_area(VERIFY_READ, (void *) arg,
+			     verify_area(VERIFY_READ, argp,
 					 sizeof(sjcd_msf))) == 0) {
 				if (sjcd_audio_status == CDROM_AUDIO_PLAY) {
 					sjcd_send_cmd(SCMD_PAUSE);
@@ -842,7 +840,7 @@
 					    CDROM_AUDIO_NO_STATUS;
 				}
 
-				if (copy_from_user(&sjcd_msf, (void *) arg,
+				if (copy_from_user(&sjcd_msf, argp,
 					       sizeof(sjcd_msf)))
 					return (-EFAULT);
 
@@ -877,7 +875,7 @@
 #endif
 			toc_header.cdth_trk0 = sjcd_first_track_no;
 			toc_header.cdth_trk1 = sjcd_last_track_no;
-			if (copy_to_user((void *)arg, &toc_header,
+			if (copy_to_user(argp, &toc_header,
 					 sizeof(toc_header)))
 				return -EFAULT;
 			return 0;
@@ -890,11 +888,11 @@
 			printk("SJCD: ioctl: readtocentry\n");
 #endif
 			if ((s =
-			     verify_area(VERIFY_WRITE, (void *) arg,
+			     verify_area(VERIFY_WRITE, argp,
 					 sizeof(toc_entry))) == 0) {
 				struct sjcd_hw_disk_info *tp;
 
-				if (copy_from_user(&toc_entry, (void *) arg,
+				if (copy_from_user(&toc_entry, argp,
 					       sizeof(toc_entry)))
 					return (-EFAULT);
 				if (toc_entry.cdte_track == CDROM_LEADOUT)
@@ -931,7 +929,7 @@
 				default:
 					return (-EINVAL);
 				}
-				if (copy_to_user((void *) arg, &toc_entry,
+				if (copy_to_user(argp, &toc_entry,
 						 sizeof(toc_entry)))
 					s = -EFAULT;
 			}
@@ -945,11 +943,11 @@
 			printk("SJCD: ioctl: subchnl\n");
 #endif
 			if ((s =
-			     verify_area(VERIFY_WRITE, (void *) arg,
+			     verify_area(VERIFY_WRITE, argp,
 					 sizeof(subchnl))) == 0) {
 				struct sjcd_hw_qinfo q_info;
 
-				if (copy_from_user(&subchnl, (void *) arg,
+				if (copy_from_user(&subchnl, argp,
 					       sizeof(subchnl)))
 					return (-EFAULT);
 
@@ -990,7 +988,7 @@
 				default:
 					return (-EINVAL);
 				}
-				if (copy_to_user((void *) arg, &subchnl,
+				if (copy_to_user(argp, &subchnl,
 					         sizeof(subchnl)))
 					s = -EFAULT;
 			}
@@ -1004,11 +1002,11 @@
 			printk("SJCD: ioctl: volctrl\n");
 #endif
 			if ((s =
-			     verify_area(VERIFY_READ, (void *) arg,
+			     verify_area(VERIFY_READ, argp,
 					 sizeof(vol_ctrl))) == 0) {
 				unsigned char dummy[4];
 
-				if (copy_from_user(&vol_ctrl, (void *) arg,
+				if (copy_from_user(&vol_ctrl, argp,
 					       sizeof(vol_ctrl)))
 					return (-EFAULT);
 				sjcd_send_4_cmd(SCMD_SET_VOLUME,
@@ -1038,8 +1036,7 @@
 #if defined( SJCD_TRACE )
 			printk("SJCD: ioctl: statistic\n");
 #endif
-			if (copy_to_user((void *)arg, &statistic,
-					 sizeof(statistic)))
+			if (copy_to_user(argp, &statistic, sizeof(statistic)))
 				return -EFAULT;
 			return 0;
 		}
diff -Nru a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
--- a/drivers/cdrom/sonycd535.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/cdrom/sonycd535.c	Tue Jun 15 22:20:39 2004
@@ -997,7 +997,7 @@
  * (not BCD), so all the conversions are done.
  */
 static int
-sony_get_subchnl_info(long arg)
+sony_get_subchnl_info(void __user *arg)
 {
 	struct cdrom_subchnl schi;
 
@@ -1009,7 +1009,7 @@
 	if (!sony_toc_read) {
 		return -EIO;
 	}
-	if (copy_from_user(&schi, (char *)arg, sizeof schi))
+	if (copy_from_user(&schi, arg, sizeof schi))
 		return -EFAULT;
 
 	switch (sony_audio_status) {
@@ -1025,7 +1025,7 @@
 
 	case CDROM_AUDIO_NO_STATUS:
 		schi.cdsc_audiostatus = sony_audio_status;
-		if (copy_to_user((char *)arg, &schi, sizeof schi))
+		if (copy_to_user(arg, &schi, sizeof schi))
 			return -EFAULT;
 		return 0;
 		break;
@@ -1053,7 +1053,7 @@
 		schi.cdsc_absaddr.lba = msf_to_log(last_sony_subcode->abs_msf);
 		schi.cdsc_reladdr.lba = msf_to_log(last_sony_subcode->rel_msf);
 	}
-	return copy_to_user((char *)arg, &schi, sizeof schi) ? -EFAULT : 0;
+	return copy_to_user(arg, &schi, sizeof schi) ? -EFAULT : 0;
 }
 
 
@@ -1070,6 +1070,7 @@
 	Byte cmd_buff[10], params[10];
 	int  i;
 	int  dsc_status;
+	void __user *argp = (void __user *)arg;
 
 	if (check_drive_status() != 0)
 		return -EIO;
@@ -1152,7 +1153,7 @@
 		break;
 
 	case CDROMPLAYMSF:			/* Play starting at the given MSF address. */
-		if (copy_from_user(params, (void *)arg, 6))
+		if (copy_from_user(params, argp, 6))
 			return -EFAULT;
 		spin_up_drive(status);
 		set_drive_mode(SONY535_AUDIO_DRIVE_MODE, status);
@@ -1184,13 +1185,12 @@
 
 	case CDROMREADTOCHDR:		/* Read the table of contents header */
 		{
-			struct cdrom_tochdr *hdr;
+			struct cdrom_tochdr __user *hdr = argp;
 			struct cdrom_tochdr loc_hdr;
 
 			sony_get_toc();
 			if (!sony_toc_read)
 				return -EIO;
-			hdr = (struct cdrom_tochdr *)arg;
 			loc_hdr.cdth_trk0 = bcd_to_int(sony_toc->first_track_num);
 			loc_hdr.cdth_trk1 = bcd_to_int(sony_toc->last_track_num);
 			if (copy_to_user(hdr, &loc_hdr, sizeof *hdr))
@@ -1201,7 +1201,7 @@
 
 	case CDROMREADTOCENTRY:	/* Read a given table of contents entry */
 		{
-			struct cdrom_tocentry *entry;
+			struct cdrom_tocentry __user *entry = argp;
 			struct cdrom_tocentry loc_entry;
 			int  track_idx;
 			Byte *msf_val = NULL;
@@ -1210,7 +1210,6 @@
 			if (!sony_toc_read) {
 				return -EIO;
 			}
-			entry = (struct cdrom_tocentry *)arg;
 
 			if (copy_from_user(&loc_entry, entry, sizeof loc_entry))
 				return -EFAULT;
@@ -1252,7 +1251,7 @@
 			if (!sony_toc_read)
 				return -EIO;
 
-			if (copy_from_user(&ti, (char *)arg, sizeof ti))
+			if (copy_from_user(&ti, argp, sizeof ti))
 				return -EFAULT;
 			if ((ti.cdti_trk0 < sony_toc->first_track_num)
 				|| (sony_toc->last_track_num < ti.cdti_trk0)
@@ -1314,14 +1313,13 @@
 		}
 
 	case CDROMSUBCHNL:			/* Get subchannel info */
-		return sony_get_subchnl_info(arg);
+		return sony_get_subchnl_info(argp);
 
 	case CDROMVOLCTRL:			/* Volume control.  What volume does this change, anyway? */
 		{
 			struct cdrom_volctrl volctrl;
 
-			if (copy_from_user(&volctrl, (char *)arg,
-					   sizeof volctrl))
+			if (copy_from_user(&volctrl, argp, sizeof volctrl))
 				return -EFAULT;
 			cmd_buff[0] = SONY535_SET_VOLUME;
 			cmd_buff[1] = volctrl.channel0;
diff -Nru a/drivers/char/Kconfig b/drivers/char/Kconfig
--- a/drivers/char/Kconfig	Tue Jun 15 22:20:36 2004
+++ b/drivers/char/Kconfig	Tue Jun 15 22:20:36 2004
@@ -112,14 +112,12 @@
 	tristate "Cyclades async mux support"
 	depends on SERIAL_NONSTANDARD
 	---help---
-	  This is a driver for a card that gives you many serial ports. You
-	  would need something like this to connect more than two modems to
+	  This driver supports Cyclades Z and Y multiserial boards.
+	  You would need something like this to connect more than two modems to
 	  your Linux box, for instance in order to become a dial-in server.
+
 	  For information about the Cyclades-Z card, read
 	  <file:drivers/char/README.cycladesZ>.
-
-	  As of 1.3.9x kernels, this driver's minor numbers start at 0 instead
-	  of 32.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called cyclades.
diff -Nru a/drivers/char/Makefile b/drivers/char/Makefile
--- a/drivers/char/Makefile	Tue Jun 15 22:21:03 2004
+++ b/drivers/char/Makefile	Tue Jun 15 22:21:03 2004
@@ -39,7 +39,6 @@
 obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
 obj-$(CONFIG_SX)		+= sx.o generic_serial.o
 obj-$(CONFIG_RIO)		+= rio/ generic_serial.o
-obj-$(CONFIG_SH_SCI)		+= sh-sci.o generic_serial.o
 obj-$(CONFIG_HVC_CONSOLE)	+= hvc_console.o
 obj-$(CONFIG_RAW_DRIVER)	+= raw.o
 obj-$(CONFIG_SGI_L1_SERIAL)	+= sn_serial.o
@@ -70,7 +69,6 @@
 obj-$(CONFIG_FTAPE) += ftape/
 obj-$(CONFIG_H8) += h8.o
 obj-$(CONFIG_PPDEV) += ppdev.o
-obj-$(CONFIG_DZ) += dz.o
 obj-$(CONFIG_NWBUTTON) += nwbutton.o
 obj-$(CONFIG_NWFLASH) += nwflash.o
 obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o
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	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/agp/amd-k7-agp.c	Tue Jun 15 22:21:05 2004
@@ -20,6 +20,8 @@
 #define AMD_TLBFLUSH	0x0c	/* In mmio region (32-bit register) */
 #define AMD_CACHEENTRY	0x10	/* In mmio region (32-bit register) */
 
+static struct pci_device_id agp_amdk7_pci_table[];
+
 struct amd_page_map {
 	unsigned long *real;
 	unsigned long *remapped;
@@ -41,7 +43,7 @@
 
 	SetPageReserved(virt_to_page(page_map->real));
 	global_cache_flush();
-	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), 
+	page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
 					    PAGE_SIZE);
 	if (page_map->remapped == NULL) {
 		ClearPageReserved(virt_to_page(page_map->real));
@@ -90,7 +92,7 @@
 	int retval = 0;
 	int i;
 
-	tables = kmalloc((nr_tables + 1) * sizeof(struct amd_page_map *), 
+	tables = kmalloc((nr_tables + 1) * sizeof(struct amd_page_map *),
 			 GFP_KERNEL);
 	if (tables == NULL)
 		return -ENOMEM;
@@ -124,7 +126,7 @@
 #define GET_PAGE_DIR_OFF(addr) (addr >> 22)
 #define GET_PAGE_DIR_IDX(addr) (GET_PAGE_DIR_OFF(addr) - \
 	GET_PAGE_DIR_OFF(agp_bridge->gart_bus_addr))
-#define GET_GATT_OFF(addr) ((addr & 0x003ff000) >> 12) 
+#define GET_GATT_OFF(addr) ((addr & 0x003ff000) >> 12)
 #define GET_GATT(addr) (amd_irongate_private.gatt_pages[\
 	GET_PAGE_DIR_IDX(addr)]->remapped)
 
@@ -174,7 +176,7 @@
 static int amd_free_gatt_table(void)
 {
 	struct amd_page_map page_dir;
-   
+
 	page_dir.real = (unsigned long *)agp_bridge->gatt_table_real;
 	page_dir.remapped = (unsigned long *)agp_bridge->gatt_table;
 
@@ -224,9 +226,9 @@
 
 	/* Write the Sync register */
 	pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL, 0x80);
-   
-   	/* Set indexing mode */
-   	pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL2, 0x00);
+
+	/* Set indexing mode */
+	pci_write_config_byte(agp_bridge->dev, AMD_MODECNTL2, 0x00);
 
 	/* Write the enable register */
 	enable_reg = INREG16(amd_irongate_private.registers, AMD_GARTENABLE);
@@ -394,7 +396,6 @@
 static int __devinit agp_amdk7_probe(struct pci_dev *pdev,
 				     const struct pci_device_id *ent)
 {
-	struct agp_device_ids *devs = amd_agp_device_ids;
 	struct agp_bridge_data *bridge;
 	u8 cap_ptr;
 	int j;
@@ -403,19 +404,10 @@
 	if (!cap_ptr)
 		return -ENODEV;
 
-	for (j = 0; devs[j].chipset_name; j++) {
-		if (pdev->device == devs[j].device_id) {
-			printk (KERN_INFO PFX "Detected AMD %s chipset\n",
-					devs[j].chipset_name);
-			goto found;
-		}
-	}
-
-	printk(KERN_ERR PFX "Unsupported AMD chipset (device id: %04x)\n",
-		    pdev->device);
-	return -ENODEV;
+	j = ent - agp_amdk7_pci_table;
+	printk(KERN_INFO PFX "Detected AMD %s chipset\n",
+	       amd_agp_device_ids[j].chipset_name);
 
-found:
 	bridge = agp_alloc_bridge();
 	if (!bridge)
 		return -ENOMEM;
@@ -442,12 +434,29 @@
 	agp_put_bridge(bridge);
 }
 
+/* must be the same order as name table above */
 static struct pci_device_id agp_amdk7_pci_table[] = {
 	{
 	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
 	.class_mask	= ~0,
 	.vendor		= PCI_VENDOR_ID_AMD,
-	.device		= PCI_ANY_ID,
+	.device		= PCI_DEVICE_ID_AMD_FE_GATE_7006,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_AMD,
+	.device		= PCI_DEVICE_ID_AMD_FE_GATE_700E,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_AMD,
+	.device		= PCI_DEVICE_ID_AMD_FE_GATE_700C,
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},
diff -Nru a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
--- a/drivers/char/agp/amd64-agp.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/agp/amd64-agp.c	Tue Jun 15 22:20:42 2004
@@ -1,7 +1,7 @@
-/* 
+/*
  * Copyright 2001-2003 SuSE Labs.
  * Distributed under the GNU public license, v2.
- * 
+ *
  * This is a GART driver for the AMD Opteron/Athlon64 on-CPU northbridge.
  * It also includes support for the AMD 8151 AGP bridge,
  * although it doesn't actually do much, as all the real
@@ -194,7 +194,7 @@
 
 	/* keep CPU's coherent. */
 	flush_amd64_tlb (hammer);
-	
+
 	return aper_base;
 }
 
@@ -261,53 +261,53 @@
 
 /* Some basic sanity checks for the aperture. */
 static int __devinit aperture_valid(u64 aper, u32 size)
-{ 
+{
 	u32 pfn, c;
-	if (aper == 0) { 
+	if (aper == 0) {
 		printk(KERN_ERR PFX "No aperture\n");
-		return 0; 
+		return 0;
 	}
 	if (size < 32*1024*1024) {
 		printk(KERN_ERR PFX "Aperture too small (%d MB)\n", size>>20);
 		return 0;
 	}
-	if (aper + size > 0xffffffff) { 
-		printk(KERN_ERR PFX "Aperture out of bounds\n"); 
+	if (aper + size > 0xffffffff) {
+		printk(KERN_ERR PFX "Aperture out of bounds\n");
 		return 0;
-	} 
+	}
 	pfn = aper >> PAGE_SHIFT;
-	for (c = 0; c < size/PAGE_SIZE; c++) { 
+	for (c = 0; c < size/PAGE_SIZE; c++) {
 		if (!pfn_valid(pfn + c))
 			break;
-		if (!PageReserved(pfn_to_page(pfn + c))) { 
+		if (!PageReserved(pfn_to_page(pfn + c))) {
 			printk(KERN_ERR PFX "Aperture pointing to RAM\n");
 			return 0;
 		}
 	}
 
 	/* Request the Aperture. This catches cases when someone else
-	   already put a mapping in there - happens with some very broken BIOS 
+	   already put a mapping in there - happens with some very broken BIOS
 
-	   Maybe better to use pci_assign_resource/pci_enable_device instead trusting
-	   the bridges? */
+	   Maybe better to use pci_assign_resource/pci_enable_device instead
+	   trusting the bridges? */
 	if (!aperture_resource &&
 	    !(aperture_resource = request_mem_region(aper, size, "aperture"))) {
-		printk(KERN_ERR PFX "Aperture conflicts with PCI mapping.\n"); 
+		printk(KERN_ERR PFX "Aperture conflicts with PCI mapping.\n");
 		return 0;
 	}
 	return 1;
-} 
+}
 
-/* 
+/*
  * W*s centric BIOS sometimes only set up the aperture in the AGP
- * bridge, not the northbridge. On AMD64 this is handled early 
+ * bridge, not the northbridge. On AMD64 this is handled early
  * in aperture.c, but when GART_IOMMU is not enabled or we run
- * on a 32bit kernel this needs to be redone. 
+ * on a 32bit kernel this needs to be redone.
  * Unfortunately it is impossible to fix the aperture here because it's too late
  * to allocate that much memory. But at least error out cleanly instead of
  * crashing.
- */ 
-static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, 
+ */
+static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
 								 u16 cap)
 {
 	u32 aper_low, aper_hi;
@@ -316,38 +316,38 @@
 	u32 nb_order, nb_base;
 	u16 apsize;
 
-	pci_read_config_dword(nb, 0x90, &nb_order); 
+	pci_read_config_dword(nb, 0x90, &nb_order);
 	nb_order = (nb_order >> 1) & 7;
-	pci_read_config_dword(nb, 0x94, &nb_base); 
-	nb_aper = nb_base << 25;	
-	if (aperture_valid(nb_aper, (32*1024*1024)<<nb_order)) { 
+	pci_read_config_dword(nb, 0x94, &nb_base);
+	nb_aper = nb_base << 25;
+	if (aperture_valid(nb_aper, (32*1024*1024)<<nb_order)) {
 		return 0;
 	}
 
 	/* Northbridge seems to contain crap. Try the AGP bridge. */
 
-	pci_read_config_word(agp, cap+0x14, &apsize); 
-	if (apsize == 0xffff) 
-		return -1; 
+	pci_read_config_word(agp, cap+0x14, &apsize);
+	if (apsize == 0xffff)
+		return -1;
 
 	apsize &= 0xfff;
 	/* Some BIOS use weird encodings not in the AGPv3 table. */
-	if (apsize & 0xff) 
-		apsize |= 0xf00; 
-	order = 7 - hweight16(apsize); 
+	if (apsize & 0xff)
+		apsize |= 0xf00;
+	order = 7 - hweight16(apsize);
 
 	pci_read_config_dword(agp, 0x10, &aper_low);
 	pci_read_config_dword(agp, 0x14, &aper_hi);
-	aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32); 
+	aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32);
 	printk(KERN_INFO PFX "Aperture from AGP @ %Lx size %u MB\n", aper, 32 << order);
 	if (order < 0 || !aperture_valid(aper, (32*1024*1024)<<order))
-		return -1; 
-	
-	pci_write_config_dword(nb, 0x90, order << 1); 
-	pci_write_config_dword(nb, 0x94, aper >> 25); 
+		return -1;
+
+	pci_write_config_dword(nb, 0x90, order << 1);
+	pci_write_config_dword(nb, 0x94, aper >> 25);
 
 	return 0;
-} 
+}
 
 static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
 {
@@ -355,19 +355,19 @@
 	int i = 0;
 
 	/* cache pci_devs of northbridges. */
-	while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) 
+	while ((loop_dev = pci_find_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev))
 			!= NULL) {
-		if (i == MAX_HAMMER_GARTS) { 
+		if (i == MAX_HAMMER_GARTS) {
 			printk(KERN_ERR PFX "Too many northbridges for AGP\n");
 			return -1;
 		}
-		if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) { 
+		if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) {
 			printk(KERN_ERR PFX "No usable aperture found.\n");
-#ifdef __x86_64__ 
+#ifdef __x86_64__
 			/* should port this to i386 */
 			printk(KERN_ERR PFX "Consider rebooting with iommu=memaper=2 to get a good aperture.\n");
-#endif 
-			return -1;  
+#endif
+			return -1;
 		}
 		hammers[i++] = loop_dev;
 	}
@@ -377,8 +377,7 @@
 
 /* Handle AMD 8151 quirks */
 static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data *bridge)
-
-{		
+{
 	char *revstring;
 	u8 rev_id;
 
@@ -417,12 +416,12 @@
 
 /* Handle shadow device of the Nvidia NForce3 */
 /* CHECK-ME original 2.4 version set up some IORRs. Check if that is needed. */
-static int __devinit nforce3_agp_init(struct pci_dev *pdev) 
-{ 
+static int __devinit nforce3_agp_init(struct pci_dev *pdev)
+{
 	u32 tmp, apbase, apbar, aplimit;
-	struct pci_dev *dev1; 
+	struct pci_dev *dev1;
 	int i;
-	unsigned size = amd64_fetch_size(); 
+	unsigned size = amd64_fetch_size();
 
 	printk(KERN_INFO PFX "Setting up Nforce3 AGP.\n");
 
@@ -432,17 +431,17 @@
 			"nForce3 chipset, but could not find "
 			"the secondary device.\n");
 		return -ENODEV;
-	}	
+	}
 
-	for (i = 0; i < ARRAY_SIZE(nforce3_sizes); i++) 
+	for (i = 0; i < ARRAY_SIZE(nforce3_sizes); i++)
 		if (nforce3_sizes[i].size == size)
-			break; 
+			break;
 
 	if (i == ARRAY_SIZE(nforce3_sizes)) {
-		printk(KERN_INFO PFX "No NForce3 size found for %d\n", size); 
-		return -ENODEV; 
+		printk(KERN_INFO PFX "No NForce3 size found for %d\n", size);
+		return -ENODEV;
 	}
-	
+
 	pci_read_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, &tmp);
 	tmp &= ~(0xf);
 	tmp |= nforce3_sizes[i].size_value;
@@ -491,8 +490,7 @@
 	    pdev->device == PCI_DEVICE_ID_AMD_8151_0) {
 		amd8151_init(pdev, bridge);
 	} else {
-		printk(KERN_INFO PFX "Detected AGP bridge %x\n",
-			pdev->devfn);
+		printk(KERN_INFO PFX "Detected AGP bridge %x\n", pdev->devfn);
 	}
 
 	bridge->driver = &amd_8151_driver;
@@ -507,10 +505,10 @@
 		return -ENODEV;
 	}
 
-	if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) { 
+	if (pdev->vendor == PCI_VENDOR_ID_NVIDIA) {
 		int ret = nforce3_agp_init(pdev);
-		if (ret) { 
-			agp_put_bridge(bridge); 
+		if (ret) {
+			agp_put_bridge(bridge);
 			return ret;
 		}
 	}
@@ -523,8 +521,8 @@
 {
 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
 
-	release_mem_region(virt_to_phys(bridge->gatt_table_real), 
-			   amd64_aperture_sizes[bridge->aperture_size_idx].size); 
+	release_mem_region(virt_to_phys(bridge->gatt_table_real),
+			   amd64_aperture_sizes[bridge->aperture_size_idx].size);
 	agp_remove_bridge(bridge);
 	agp_put_bridge(bridge);
 }
@@ -581,6 +579,15 @@
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},
+	/* SIS 755 */
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_SI,
+	.device		= PCI_DEVICE_ID_SI_755,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
 	{ }
 };
 
@@ -600,15 +607,15 @@
 	int err = 0;
 	if (agp_off)
 		return -EINVAL;
-	if (pci_module_init(&agp_amd64_pci_driver) > 0) { 
+	if (pci_module_init(&agp_amd64_pci_driver) > 0) {
 		struct pci_dev *dev;
-		if (!agp_try_unsupported && !agp_try_unsupported_boot) { 
+		if (!agp_try_unsupported && !agp_try_unsupported_boot) {
 			printk(KERN_INFO PFX "No supported AGP bridge found.\n");
-#ifdef MODULE			
+#ifdef MODULE
 			printk(KERN_INFO PFX "You can try agp_try_unsupported=1\n");
 #else
 			printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n");
-#endif			
+#endif
 			return -ENODEV;
 		}
 
@@ -622,12 +629,12 @@
 		while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev))) {
 			if (!pci_find_capability(dev, PCI_CAP_ID_AGP))
 				continue;
-			/* Only one bridge supported right now */	
+			/* Only one bridge supported right now */
 			if (agp_amd64_probe(dev, NULL) == 0) {
 				err = 0;
 				break;
-			}	
-		}		
+			}
+		}
 	}
 	return err;
 }
diff -Nru a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
--- a/drivers/char/agp/ati-agp.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/agp/ati-agp.c	Tue Jun 15 22:20:43 2004
@@ -131,6 +131,7 @@
 				i--;
 			}
 			kfree (tables);
+			tables = NULL;
 			retval = -ENOMEM;
 			break;
 		}
diff -Nru a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
--- a/drivers/char/agp/backend.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/agp/backend.c	Tue Jun 15 22:20:42 2004
@@ -238,11 +238,14 @@
 }
 EXPORT_SYMBOL(agp_put_bridge);
 
- 
+
 int agp_add_bridge(struct agp_bridge_data *bridge)
 {
 	int error;
 
+	if (agp_off)
+		return -ENODEV;
+
 	if (!bridge->dev) {
 		printk (KERN_DEBUG PFX "Erk, registering with no pci_dev!\n");
 		return -EINVAL;
@@ -308,9 +311,9 @@
 
 static int __init agp_init(void)
 {
-	if (!agp_off) 
-	printk(KERN_INFO "Linux agpgart interface v%d.%d (c) Dave Jones\n",
-	       AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR);
+	if (!agp_off)
+		printk(KERN_INFO "Linux agpgart interface v%d.%d (c) Dave Jones\n",
+			AGPGART_VERSION_MAJOR, AGPGART_VERSION_MINOR);
 	return 0;
 }
 
@@ -325,7 +328,7 @@
 		agp_off = 1;
 	if (!strcmp(s,"try_unsupported"))
 		agp_try_unsupported_boot = 1;
-	return 1;	
+	return 1;
 }
 __setup("agp=", agp_setup);
 #endif
diff -Nru a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
--- a/drivers/char/agp/intel-agp.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/agp/intel-agp.c	Tue Jun 15 22:20:40 2004
@@ -1233,7 +1233,7 @@
 				name);
 		return 0;
 	}
-	
+
 	intel_i810_private.i810_dev = i810_dev;
 	return 1;
 }
@@ -1382,8 +1382,10 @@
 		name = "E7205";
 		break;
 	default:
-		printk(KERN_ERR PFX "Unsupported Intel chipset (device id: %04x)\n",
+		if (cap_ptr)
+			printk(KERN_WARNING PFX "Unsupported Intel chipset (device id: %04x)\n",
 			    pdev->device);
+		agp_put_bridge(bridge);
 		return -ENODEV;
 	};
 
@@ -1406,7 +1408,8 @@
 	if (!r->start && r->end) {
 		if(pci_assign_resource(pdev, 0)) {
 			printk(KERN_ERR PFX "could not assign resource 0\n");
-			return (-ENODEV);
+			agp_put_bridge(bridge);
+			return -ENODEV;
 		}
 	}
 
@@ -1417,7 +1420,8 @@
 	*/
 	if (pci_enable_device(pdev)) {
 		printk(KERN_ERR PFX "Unable to Enable PCI device\n");
-		return (-ENODEV);
+		agp_put_bridge(bridge);
+		return -ENODEV;
 	}
 
 	/* Fill in the mode register */
@@ -1442,14 +1446,11 @@
 	agp_put_bridge(bridge);
 }
 
-static int agp_intel_suspend(struct pci_dev *dev, u32 state)
-{
-	return 0;
-}
-
 static int agp_intel_resume(struct pci_dev *pdev)
 {
 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
+	
+	pci_restore_state(pdev, pdev->saved_config_space);
 
 	if (bridge->driver == &intel_generic_driver)
 		intel_configure();
@@ -1462,14 +1463,36 @@
 }
 
 static struct pci_device_id agp_intel_pci_table[] = {
-	{
-	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
-	.class_mask	= ~0,
-	.vendor		= PCI_VENDOR_ID_INTEL,
-	.device		= PCI_ANY_ID,
-	.subvendor	= PCI_ANY_ID,
-	.subdevice	= PCI_ANY_ID,
-	},
+#define ID(x)						\
+	{ 						\
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),	\
+	.class_mask	= ~0,				\
+	.vendor		= PCI_VENDOR_ID_INTEL,		\
+	.device		= x,				\
+	.subvendor	= PCI_ANY_ID,			\
+	.subdevice	= PCI_ANY_ID,			\
+	}
+	ID(PCI_DEVICE_ID_INTEL_82443LX_0),
+	ID(PCI_DEVICE_ID_INTEL_82443BX_0),
+	ID(PCI_DEVICE_ID_INTEL_82443GX_0),
+	ID(PCI_DEVICE_ID_INTEL_82810_MC1),
+	ID(PCI_DEVICE_ID_INTEL_82810_MC3),
+	ID(PCI_DEVICE_ID_INTEL_82810E_MC),
+	ID(PCI_DEVICE_ID_INTEL_82815_MC),
+	ID(PCI_DEVICE_ID_INTEL_82820_HB),
+	ID(PCI_DEVICE_ID_INTEL_82820_UP_HB),
+	ID(PCI_DEVICE_ID_INTEL_82830_HB),
+	ID(PCI_DEVICE_ID_INTEL_82840_HB),
+	ID(PCI_DEVICE_ID_INTEL_82845_HB),
+	ID(PCI_DEVICE_ID_INTEL_82845G_HB),
+	ID(PCI_DEVICE_ID_INTEL_82850_HB),
+	ID(PCI_DEVICE_ID_INTEL_82855PM_HB),
+	ID(PCI_DEVICE_ID_INTEL_82855GM_HB),
+	ID(PCI_DEVICE_ID_INTEL_82860_HB),
+	ID(PCI_DEVICE_ID_INTEL_82865_HB),
+	ID(PCI_DEVICE_ID_INTEL_82875_HB),
+	ID(PCI_DEVICE_ID_INTEL_7505_0),
+	ID(PCI_DEVICE_ID_INTEL_7205_0),	
 	{ }
 };
 
@@ -1480,7 +1503,6 @@
 	.id_table	= agp_intel_pci_table,
 	.probe		= agp_intel_probe,
 	.remove		= agp_intel_remove,
-	.suspend	= agp_intel_suspend,
 	.resume		= agp_intel_resume,
 };
 
diff -Nru a/drivers/char/agp/intel-mch-agp.c b/drivers/char/agp/intel-mch-agp.c
--- a/drivers/char/agp/intel-mch-agp.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/agp/intel-mch-agp.c	Tue Jun 15 22:20:37 2004
@@ -491,10 +491,9 @@
 	char *name = "(unknown)";
 	u8 cap_ptr = 0;
 
-	if (!boot_cpu_has(X86_FEATURE_LM))
-		return -ENODEV;
-
 	cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
+	if (!cap_ptr) 
+		return -ENODEV;
 
 	bridge = agp_alloc_bridge();
 	if (!bridge)
@@ -570,14 +569,11 @@
 	agp_put_bridge(bridge);
 }
 
-static int agp_intelmch_suspend(struct pci_dev *dev, u32 state)
-{
-	return 0;
-}
-
 static int agp_intelmch_resume(struct pci_dev *pdev)
 {
 	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
+	
+	pci_restore_state(pdev, pdev->saved_config_space);
 
 	if (bridge->driver == &intel_845_driver)
 		intel_845_configure();
@@ -590,7 +586,15 @@
 	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
 	.class_mask	= ~0,
 	.vendor		= PCI_VENDOR_ID_INTEL,
-	.device		= PCI_ANY_ID,
+	.device		= PCI_DEVICE_ID_INTEL_82865_HB,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_INTEL,
+	.device		= PCI_DEVICE_ID_INTEL_82875_HB,
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},
@@ -604,7 +608,6 @@
 	.id_table	= agp_intelmch_pci_table,
 	.probe		= agp_intelmch_probe,
 	.remove		= agp_intelmch_remove,
-	.suspend	= agp_intelmch_suspend,
 	.resume		= agp_intelmch_resume,
 };
 
diff -Nru a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
--- a/drivers/char/agp/nvidia-agp.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/agp/nvidia-agp.c	Tue Jun 15 22:20:37 2004
@@ -380,7 +380,15 @@
 	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
 	.class_mask	= ~0,
 	.vendor		= PCI_VENDOR_ID_NVIDIA,
-	.device		= PCI_ANY_ID,
+	.device		= PCI_DEVICE_ID_NVIDIA_NFORCE,
+	.subvendor	= PCI_ANY_ID,
+	.subdevice	= PCI_ANY_ID,
+	},
+	{
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
+	.class_mask	= ~0,
+	.vendor		= PCI_VENDOR_ID_NVIDIA,
+	.device		= PCI_DEVICE_ID_NVIDIA_NFORCE2,
 	.subvendor	= PCI_ANY_ID,
 	.subdevice	= PCI_ANY_ID,
 	},
diff -Nru a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
--- a/drivers/char/agp/sis-agp.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/char/agp/sis-agp.c	Tue Jun 15 22:20:36 2004
@@ -13,6 +13,8 @@
 #define SIS_TLBCNTRL	0x97
 #define SIS_TLBFLUSH	0x98
 
+static int __devinitdata agp_sis_force_delay = 0;
+static int __devinitdata agp_sis_agp_spec = -1;
 
 static int sis_fetch_size(void)
 {
@@ -67,7 +69,7 @@
 			      (previous_size->size_value & ~(0x03)));
 }
 
-static void sis_648_enable(u32 mode)
+static void sis_delayed_enable(u32 mode)
 {
 	struct pci_dev *device = NULL;
 	u32 command;
@@ -94,13 +96,12 @@
 		pci_write_config_dword(device, agp + PCI_AGP_COMMAND, command);
 
 		/*
-		 * Weird: on 648(fx) and 746(fx) chipsets any rate change in the target
+		 * Weird: on some sis chipsets any rate change in the target
 		 * command register triggers a 5ms screwup during which the master
 		 * cannot be configured		 
 		 */
-		if (device->device == PCI_DEVICE_ID_SI_648 ||
-		    device->device == PCI_DEVICE_ID_SI_746) {
-			printk(KERN_INFO PFX "SiS chipset with AGP problems detected. Giving bridge time to recover.\n");
+		if (device->device == agp_bridge->dev->device) {
+			printk(KERN_INFO PFX "SiS delay workaround: giving bridge time to recover.\n");
 			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout (1+(HZ*10)/1000);
 		}
@@ -223,28 +224,35 @@
 };
 
 
+// chipsets that require the 'delay hack'
+static int sis_broken_chipsets[] __devinitdata = {
+	PCI_DEVICE_ID_SI_648,
+	PCI_DEVICE_ID_SI_746,
+	0 // terminator
+};
+
 static void __devinit sis_get_driver(struct agp_bridge_data *bridge)
 {
-	if (bridge->dev->device == PCI_DEVICE_ID_SI_648) { 
-		sis_driver.agp_enable=sis_648_enable;
-		if (agp_bridge->major_version == 3) {
-			sis_driver.aperture_sizes = agp3_generic_sizes;
-			sis_driver.size_type = U16_APER_SIZE;
-			sis_driver.num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES;
-			sis_driver.configure = agp3_generic_configure;
-			sis_driver.fetch_size = agp3_generic_fetch_size;
-			sis_driver.cleanup = agp3_generic_cleanup;
-			sis_driver.tlb_flush = agp3_generic_tlbflush;
-		}
-	}
+	int i;
 
-	if (bridge->dev->device == PCI_DEVICE_ID_SI_746) {
-		/*
-		 * We don't know enough about the 746 to enable it properly.
-		 * Though we do know that it needs the 'delay' hack to settle
-		 * after changing modes.
-		 */
-		sis_driver.agp_enable=sis_648_enable;
+	for(i=0; sis_broken_chipsets[i]!=0; ++i)
+		if(bridge->dev->device==sis_broken_chipsets[i])
+			break;
+
+	if(sis_broken_chipsets[i] || agp_sis_force_delay)
+		sis_driver.agp_enable=sis_delayed_enable;
+
+	// sis chipsets that indicate less than agp3.5
+	// are not actually fully agp3 compliant
+	if ((agp_bridge->major_version == 3 && agp_bridge->minor_version >= 5
+	     && agp_sis_agp_spec!=0) || agp_sis_agp_spec==1) {
+		sis_driver.aperture_sizes = agp3_generic_sizes;
+		sis_driver.size_type = U16_APER_SIZE;
+		sis_driver.num_aperture_sizes = AGP_GENERIC_SIZES_ENTRIES;
+		sis_driver.configure = agp3_generic_configure;
+		sis_driver.fetch_size = agp3_generic_fetch_size;
+		sis_driver.cleanup = agp3_generic_cleanup;
+		sis_driver.tlb_flush = agp3_generic_tlbflush;
 	}
 }
 
@@ -335,4 +343,8 @@
 module_init(agp_sis_init);
 module_exit(agp_sis_cleanup);
 
+MODULE_PARM(agp_sis_force_delay,"i");
+MODULE_PARM_DESC(agp_sis_force_delay,"forces sis delay hack");
+MODULE_PARM(agp_sis_agp_spec,"i");
+MODULE_PARM_DESC(agp_sis_agp_spec,"0=force sis init, 1=force generic agp3 init, default: autodetect");
 MODULE_LICENSE("GPL and additional rights");
diff -Nru a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
--- a/drivers/char/agp/sworks-agp.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/char/agp/sworks-agp.c	Tue Jun 15 22:20:39 2004
@@ -248,26 +248,13 @@
  */
 static void serverworks_tlbflush(struct agp_memory *temp)
 {
-	unsigned long end;
+	OUTREG8(serverworks_private.registers, SVWRKS_POSTFLUSH, 1);
+	while(INREG8(serverworks_private.registers, SVWRKS_POSTFLUSH) == 1)
+		cpu_relax();
 
-	OUTREG8(serverworks_private.registers, SVWRKS_POSTFLUSH, 0x01);
-	end = jiffies + 3*HZ;
-	while(INREG8(serverworks_private.registers, 
-		     SVWRKS_POSTFLUSH) == 0x01) {
-		if((signed)(end - jiffies) <= 0) {
-			printk(KERN_ERR PFX "Posted write buffer flush took more"
-			       "then 3 seconds\n");
-		}
-	}
-	OUTREG32(serverworks_private.registers, SVWRKS_DIRFLUSH, 0x00000001);
-	end = jiffies + 3*HZ;
-	while(INREG32(serverworks_private.registers, 
-		     SVWRKS_DIRFLUSH) == 0x00000001) {
-		if((signed)(end - jiffies) <= 0) {
-			printk(KERN_ERR PFX "TLB flush took more"
-			       "then 3 seconds\n");
-		}
-	}
+	OUTREG32(serverworks_private.registers, SVWRKS_DIRFLUSH, 1);
+	while(INREG32(serverworks_private.registers, SVWRKS_DIRFLUSH) == 1)
+		cpu_relax();
 }
 
 static int serverworks_configure(void)
diff -Nru a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
--- a/drivers/char/agp/via-agp.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/char/agp/via-agp.c	Tue Jun 15 22:20:44 2004
@@ -9,6 +9,8 @@
 #include <linux/agp_backend.h>
 #include "agp.h"
 
+static struct pci_device_id agp_via_pci_table[];
+
 #define VIA_GARTCTRL	0x80
 #define VIA_APSIZE	0x84
 #define VIA_ATTBASE	0x88
@@ -378,20 +380,9 @@
 	if (!cap_ptr)
 		return -ENODEV;
 
-	/* probe for known chipsets */
-	for (j = 0; devs[j].chipset_name; j++) {
-		if (pdev->device == devs[j].device_id) {
-			printk (KERN_INFO PFX "Detected VIA %s chipset\n",
-					devs[j].chipset_name);
-			goto found;
-		}
-	}
-
-	printk(KERN_ERR PFX "Unsupported VIA chipset (device id: %04x)\n",
-		    pdev->device);
-	return -ENODEV;
+	j = ent - agp_via_pci_table;
+	printk (KERN_INFO PFX "Detected VIA %s chipset\n", devs[j].chipset_name);
 
-found:
 	bridge = agp_alloc_bridge();
 	if (!bridge)
 		return -ENOMEM;
@@ -432,15 +423,40 @@
 	agp_put_bridge(bridge);
 }
 
+/* must be the same order as name table above */
 static struct pci_device_id agp_via_pci_table[] = {
-	{
-	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
-	.class_mask	= ~0,
-	.vendor		= PCI_VENDOR_ID_VIA,
-	.device		= PCI_ANY_ID,
-	.subvendor	= PCI_ANY_ID,
-	.subdevice	= PCI_ANY_ID,
-	},
+#define ID(x) \
+	{						\
+	.class		= (PCI_CLASS_BRIDGE_HOST << 8),	\
+	.class_mask	= ~0,				\
+	.vendor		= PCI_VENDOR_ID_VIA,		\
+	.device		= x,				\
+	.subvendor	= PCI_ANY_ID,			\
+	.subdevice	= PCI_ANY_ID,			\
+	}
+	ID(PCI_DEVICE_ID_VIA_82C598_0),
+	ID(PCI_DEVICE_ID_VIA_8501_0),
+	ID(PCI_DEVICE_ID_VIA_8601_0),
+	ID(PCI_DEVICE_ID_VIA_82C691_0),
+	ID(PCI_DEVICE_ID_VIA_8371_0),
+	ID(PCI_DEVICE_ID_VIA_8633_0),
+	ID(PCI_DEVICE_ID_VIA_XN266),
+	ID(PCI_DEVICE_ID_VIA_8361),
+	ID(PCI_DEVICE_ID_VIA_8363_0),
+	ID(PCI_DEVICE_ID_VIA_8753_0),
+	ID(PCI_DEVICE_ID_VIA_8367_0),
+	ID(PCI_DEVICE_ID_VIA_8653_0),
+	ID(PCI_DEVICE_ID_VIA_XM266),
+	ID(PCI_DEVICE_ID_VIA_862X_0),
+	ID(PCI_DEVICE_ID_VIA_8377_0),
+	ID(PCI_DEVICE_ID_VIA_8605_0),
+	ID(PCI_DEVICE_ID_VIA_8703_51_0),
+	ID(PCI_DEVICE_ID_VIA_8754C_0),
+	ID(PCI_DEVICE_ID_VIA_8763_0),
+	ID(PCI_DEVICE_ID_VIA_8378_0),
+	ID(PCI_DEVICE_ID_VIA_PT880),
+	ID(PCI_DEVICE_ID_VIA_8783_0),
+	ID(PCI_DEVICE_ID_VIA_PX8X0_0),	
 	{ }
 };
 
diff -Nru a/drivers/char/consolemap.c b/drivers/char/consolemap.c
--- a/drivers/char/consolemap.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/consolemap.c	Tue Jun 15 22:20:43 2004
@@ -257,12 +257,12 @@
  * 0xf000-0xf0ff "transparent" Unicodes) whereas the "new" variants set
  * Unicodes explicitly.
  */
-int con_set_trans_old(unsigned char * arg)
+int con_set_trans_old(unsigned char __user * arg)
 {
 	int i;
 	unsigned short *p = translations[USER_MAP];
 
-	i = verify_area(VERIFY_READ, (void *)arg, E_TABSZ);
+	i = verify_area(VERIFY_READ, arg, E_TABSZ);
 	if (i)
 		return i;
 
@@ -276,12 +276,12 @@
 	return 0;
 }
 
-int con_get_trans_old(unsigned char * arg)
+int con_get_trans_old(unsigned char __user * arg)
 {
 	int i, ch;
 	unsigned short *p = translations[USER_MAP];
 
-	i = verify_area(VERIFY_WRITE, (void *)arg, E_TABSZ);
+	i = verify_area(VERIFY_WRITE, arg, E_TABSZ);
 	if (i)
 		return i;
 
@@ -293,13 +293,12 @@
 	return 0;
 }
 
-int con_set_trans_new(ushort * arg)
+int con_set_trans_new(ushort __user * arg)
 {
 	int i;
 	unsigned short *p = translations[USER_MAP];
 
-	i = verify_area(VERIFY_READ, (void *)arg,
-			E_TABSZ*sizeof(unsigned short));
+	i = verify_area(VERIFY_READ, arg, E_TABSZ*sizeof(unsigned short));
 	if (i)
 		return i;
 
@@ -313,13 +312,12 @@
 	return 0;
 }
 
-int con_get_trans_new(ushort * arg)
+int con_get_trans_new(ushort __user * arg)
 {
 	int i;
 	unsigned short *p = translations[USER_MAP];
 
-	i = verify_area(VERIFY_WRITE, (void *)arg,
-			E_TABSZ*sizeof(unsigned short));
+	i = verify_area(VERIFY_WRITE, arg, E_TABSZ*sizeof(unsigned short));
 	if (i)
 		return i;
 
@@ -470,7 +468,7 @@
 }
 
 int
-con_set_unimap(int con, ushort ct, struct unipair *list)
+con_set_unimap(int con, ushort ct, struct unipair __user *list)
 {
 	int err = 0, err1, i;
 	struct uni_pagedir *p, *q;
@@ -577,6 +575,7 @@
 	dflt = p;
 	return err;
 }
+EXPORT_SYMBOL(con_set_default_unimap);
 
 int
 con_copy_unimap(int dstcon, int srccon)
@@ -597,7 +596,7 @@
 }
 
 int
-con_get_unimap(int con, ushort ct, ushort *uct, struct unipair *list)
+con_get_unimap(int con, ushort ct, ushort __user *uct, struct unipair __user *list)
 {
 	int i, j, k, ect;
 	u16 **p1, *p2;
diff -Nru a/drivers/char/cyclades.c b/drivers/char/cyclades.c
--- a/drivers/char/cyclades.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/cyclades.c	Tue Jun 15 22:20:37 2004
@@ -681,20 +681,6 @@
 static void cy_throttle (struct tty_struct *tty);
 static void cy_send_xchar (struct tty_struct *tty, char ch);
 
-static unsigned long 
-cy_get_user(unsigned long *addr)
-{
-	unsigned long result = 0;
-	int error = get_user (result, addr);
-	if (error)
-		printk ("cyclades: cy_get_user: error == %d\n", error);
-	return result;
-}
-
-#ifndef MIN
-#define MIN(a,b)        ((a) < (b) ? (a) : (b))
-#endif
-
 #define IS_CYC_Z(card) ((card).num_chips == -1)
 
 #define Z_FPGA_CHECK(card) \
@@ -708,7 +694,7 @@
 			((card).base_addr+ID_ADDRESS))->signature)))
 
 #ifndef SERIAL_XMIT_SIZE
-#define	SERIAL_XMIT_SIZE	(MIN(PAGE_SIZE, 4096))
+#define	SERIAL_XMIT_SIZE	(min(PAGE_SIZE, 4096))
 #endif
 #define WAKEUP_CHARS		256
 
@@ -2680,7 +2666,7 @@
   unsigned char *base_addr;
   int card,chip,channel,index;
   unsigned long orig_jiffies;
-  signed long char_time;
+  int char_time;
 	
     if (serial_paranoia_check(info, tty->name, "cy_wait_until_sent"))
 	return;
@@ -2705,7 +2691,7 @@
     if (timeout < 0)
 	timeout = 0;
     if (timeout)
-	char_time = MIN(char_time, timeout);
+	char_time = min(char_time, timeout);
     /*
      * If the transmitter hasn't cleared in twice the approximate
      * amount of time to send the entire FIFO, it probably won't
@@ -2932,8 +2918,8 @@
 	while (1) {
 	    int c1;
 	    
-	    c = MIN(count, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
-				SERIAL_XMIT_SIZE - info->xmit_head));
+	    c = min(count, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
+				(int)(SERIAL_XMIT_SIZE - info->xmit_head)));
 	    if (c <= 0)
 		break;
 
@@ -2945,8 +2931,8 @@
 		break;
 	    }
 	    CY_LOCK(info, flags);
-	    c1 = MIN(c, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
-			SERIAL_XMIT_SIZE - info->xmit_head));
+	    c1 = min(c, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
+			(int)(SERIAL_XMIT_SIZE - info->xmit_head)));
 			
 	    if (c1 < c)
 	    	c = c1;
@@ -2962,8 +2948,8 @@
     } else {
 	CY_LOCK(info, flags);
 	while (1) {
-	    c = MIN(count, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, 
-			SERIAL_XMIT_SIZE - info->xmit_head));
+	    c = min(count, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
+			(int)(SERIAL_XMIT_SIZE - info->xmit_head)));
 	        
 	    if (c <= 0)
 		break;
@@ -5648,8 +5634,10 @@
 #endif /* CONFIG_CYZ_INTR */
 	    )
 		free_irq(cy_card[i].irq, &cy_card[i]);
+#ifdef CONFIG_PCI
 		if (cy_card[i].pdev)
 			pci_release_regions(cy_card[i].pdev);
+#endif
         }
     }
     if (tmp_buf) {
diff -Nru a/drivers/char/drm/ati_pcigart.h b/drivers/char/drm/ati_pcigart.h
--- a/drivers/char/drm/ati_pcigart.h	Tue Jun 15 22:20:58 2004
+++ b/drivers/char/drm/ati_pcigart.h	Tue Jun 15 22:20:58 2004
@@ -67,7 +67,7 @@
 	page = virt_to_page( address );
 
 	for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) {
-		atomic_inc( &page->count );
+		get_page(page);
 		SetPageReserved( page );
 	}
 
@@ -84,7 +84,7 @@
 	page = virt_to_page( address );
 
 	for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) {
-		atomic_dec( &page->count );
+		__put_page(page);
 		ClearPageReserved( page );
 	}
 
diff -Nru a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
--- a/drivers/char/drm/drm.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/drm/drm.h	Tue Jun 15 22:20:38 2004
@@ -46,8 +46,8 @@
 #define DRM_IOC_WRITE		_IOC_WRITE
 #define DRM_IOC_READWRITE	_IOC_READ|_IOC_WRITE
 #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
-#if defined(__FreeBSD__) && defined(XFree86Server)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) && defined(IN_MODULE)
 /* Prevent name collision when including sys/ioccom.h */
 #undef ioctl
 #include <sys/ioccom.h>
@@ -130,6 +130,18 @@
 	unsigned int	age;
 } drm_tex_region_t;
 
+/**
+ * Hardware lock.
+ *
+ * The lock structure is a simple cache-line aligned integer.  To avoid
+ * processor bus contention on a multiprocessor system, there should not be any
+ * other data stored in the same cache line.
+ */
+typedef struct drm_hw_lock {
+	__volatile__ unsigned int lock;		/**< lock variable */
+	char			  padding[60];	/**< Pad to cache line */
+} drm_hw_lock_t;
+
 
 /**
  * DRM_IOCTL_VERSION ioctl argument type.
@@ -580,6 +592,16 @@
 	unsigned long handle;	/**< Used for mapping / unmapping */
 } drm_scatter_gather_t;
 
+/**
+ * DRM_IOCTL_SET_VERSION ioctl argument type.
+ */
+typedef struct drm_set_version {
+	int drm_di_major;
+	int drm_di_minor;
+	int drm_dd_major;
+	int drm_dd_minor;
+} drm_set_version_t;
+
 
 #define DRM_IOCTL_BASE			'd'
 #define DRM_IO(nr)			_IO(DRM_IOCTL_BASE,nr)
@@ -594,6 +616,7 @@
 #define DRM_IOCTL_GET_MAP               DRM_IOWR(0x04, drm_map_t)
 #define DRM_IOCTL_GET_CLIENT            DRM_IOWR(0x05, drm_client_t)
 #define DRM_IOCTL_GET_STATS             DRM_IOR( 0x06, drm_stats_t)
+#define DRM_IOCTL_SET_VERSION		DRM_IOWR(0x07, drm_set_version_t)
 
 #define DRM_IOCTL_SET_UNIQUE		DRM_IOW( 0x10, drm_unique_t)
 #define DRM_IOCTL_AUTH_MAGIC		DRM_IOW( 0x11, drm_auth_t)
diff -Nru a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
--- a/drivers/char/drm/drmP.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/drm/drmP.h	Tue Jun 15 22:20:43 2004
@@ -92,8 +92,8 @@
 #ifndef __HAVE_DMA
 #define __HAVE_DMA		0
 #endif
-#ifndef __HAVE_DMA_IRQ
-#define __HAVE_DMA_IRQ		0
+#ifndef __HAVE_IRQ
+#define __HAVE_IRQ		0
 #endif
 #ifndef __HAVE_DMA_WAITLIST
 #define __HAVE_DMA_WAITLIST	0
@@ -148,6 +148,7 @@
 #define DRM_MEM_CTXBITMAP 18
 #define DRM_MEM_STUB      19
 #define DRM_MEM_SGLISTS   20
+#define DRM_MEM_CTXLIST  21
 
 #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
 	
@@ -324,6 +325,7 @@
 #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x))
 #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist)
 
+#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
 /**
  * Get the private SAREA mapping.
  *
@@ -362,11 +364,6 @@
 typedef int drm_ioctl_t( struct inode *inode, struct file *filp,
 			 unsigned int cmd, unsigned long arg );
 
-typedef struct drm_pci_list {
-	u16 vendor;
-	u16 device;
-} drm_pci_list_t;
-
 typedef struct drm_ioctl_desc {
 	drm_ioctl_t	     *func;
 	int		     auth_needed;
@@ -463,18 +460,6 @@
 	drm_freelist_t	  freelist;
 } drm_buf_entry_t;
 
-/**
- * Hardware lock.
- *
- * The lock structure is a simple cache-line aligned integer.  To avoid
- * processor bus contention on a multiprocessor system, there should not be any
- * other data stored in the same cache line.
- */
-typedef struct drm_hw_lock {
-	__volatile__ unsigned int lock;		/**< lock variable */
-	char			  padding[60];	/**< Pad to cache line */
-} drm_hw_lock_t;
-
 /** File private data */
 typedef struct drm_file {
 	int		  authenticated;
@@ -488,6 +473,9 @@
 	struct drm_device *dev;
 	int 		  remove_auth_on_close;
 	unsigned long     lock_count;
+#ifdef DRIVER_FILE_FIELDS
+	DRIVER_FILE_FIELDS;
+#endif
 } drm_file_t;
 
 /** Wait queue */
@@ -602,6 +590,15 @@
 
 typedef drm_map_t drm_local_map_t;
 
+/**
+ * Context handle list
+ */
+typedef struct drm_ctx_list {
+	struct list_head	head;   /**< list head */
+	drm_context_t		handle; /**< context handle */
+	drm_file_t		*tag;   /**< associated fd private data */
+} drm_ctx_list_t;
+
 #if __HAVE_VBL_IRQ
 
 typedef struct drm_vbl_sig {
@@ -622,6 +619,8 @@
 	int		  unique_len;	/**< Length of unique field */
 	dev_t		  device;	/**< Device number for mknod */
 	char		  *devname;	/**< For /proc/interrupts */
+	int		  minor;        /**< Minor device number */
+	int		  if_version;	/**< Highest interface version set */
 
 	int		  blocked;	/**< Blocked due to VC switch? */
 	struct proc_dir_entry *root;	/**< Root for this device's entries */
@@ -660,6 +659,12 @@
 	drm_map_list_t	  *maplist;	/**< Linked list of regions */
 	int		  map_count;	/**< Number of mappable regions */
 
+	/** \name Context handle management */
+	/*@{*/
+	drm_ctx_list_t	  *ctxlist;	/**< Linked list of context handles */
+	int		  ctx_count;	/**< Number of context handles */
+	struct semaphore  ctxlist_sem;	/**< For ctxlist */
+
 	drm_map_t	  **context_sareas; /**< per-context SAREA's */
 	int		  max_context;
 
@@ -679,6 +684,7 @@
 	/** \name Context support */
 	/*@{*/
 	int		  irq;		/**< Interrupt used by board */
+	int		  irq_enabled;	/**< True if irq handler is enabled */
 	__volatile__ long context_flag;	/**< Context swapping flag */
 	__volatile__ long interrupt_flag; /**< Interruption handler flag */
 	__volatile__ long dma_flag;	/**< DMA dispatch flag */
@@ -714,7 +720,12 @@
 #if __REALLY_HAVE_AGP
 	drm_agp_head_t    *agp;	/**< AGP data */
 #endif
-	struct pci_dev *pdev;		/**< PCI device structure */
+
+	struct pci_dev    *pdev;	/**< PCI device structure */
+	int               pci_domain;	/**< PCI bus domain number */
+	int               pci_bus;	/**< PCI bus number */
+	int               pci_slot;	/**< PCI slot number */
+	int               pci_func;	/**< PCI function number */
 #ifdef __alpha__
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)
 	struct pci_controler *hose;
@@ -758,18 +769,6 @@
 extern int	     DRM(fasync)(int fd, struct file *filp, int on);
 
 				/* Mapping support (drm_vm.h) */
-extern struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
-				   unsigned long address,
-				   int *type);
-extern struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
-				       unsigned long address,
-				       int *type);
-extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
-				       unsigned long address,
-				       int *type);
-extern struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
-				      unsigned long address,
-				      int *type);
 extern void	     DRM(vm_open)(struct vm_area_struct *vma);
 extern void	     DRM(vm_close)(struct vm_area_struct *vma);
 extern void	     DRM(vm_shm_close)(struct vm_area_struct *vma);
@@ -804,8 +803,8 @@
 #endif
 
 				/* Misc. IOCTL support (drm_ioctl.h) */
-extern int	     DRM(irq_busid)(struct inode *inode, struct file *filp,
-				    unsigned int cmd, unsigned long arg);
+extern int	     DRM(irq_by_busid)(struct inode *inode, struct file *filp,
+				       unsigned int cmd, unsigned long arg);
 extern int	     DRM(getunique)(struct inode *inode, struct file *filp,
 				    unsigned int cmd, unsigned long arg);
 extern int	     DRM(setunique)(struct inode *inode, struct file *filp,
@@ -816,6 +815,8 @@
 				    unsigned int cmd, unsigned long arg);
 extern int	     DRM(getstats)(struct inode *inode, struct file *filp,
 				   unsigned int cmd, unsigned long arg);
+extern int	     DRM(setversion)(struct inode *inode, struct file *filp,
+				     unsigned int cmd, unsigned long arg);
 
 				/* Context IOCTL support (drm_context.h) */
 extern int	     DRM(resctx)( struct inode *inode, struct file *filp,
@@ -900,12 +901,17 @@
 extern void	     DRM(dma_takedown)(drm_device_t *dev);
 extern void	     DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf);
 extern void	     DRM(reclaim_buffers)( struct file *filp );
-#if __HAVE_DMA_IRQ
+#endif /* __HAVE_DMA */
+
+				/* IRQ support (drm_irq.h) */
+#if __HAVE_IRQ || __HAVE_DMA
 extern int           DRM(control)( struct inode *inode, struct file *filp,
 				   unsigned int cmd, unsigned long arg );
-extern int           DRM(irq_install)( drm_device_t *dev, int irq );
+#endif
+#if __HAVE_IRQ
+extern int           DRM(irq_install)( drm_device_t *dev );
 extern int           DRM(irq_uninstall)( drm_device_t *dev );
-extern irqreturn_t   DRM(dma_service)( DRM_IRQ_ARGS );
+extern irqreturn_t   DRM(irq_handler)( DRM_IRQ_ARGS );
 extern void          DRM(driver_irq_preinstall)( drm_device_t *dev );
 extern void          DRM(driver_irq_postinstall)( drm_device_t *dev );
 extern void          DRM(driver_irq_uninstall)( drm_device_t *dev );
@@ -915,12 +921,11 @@
 extern int           DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq);
 extern void          DRM(vbl_send_signals)( drm_device_t *dev );
 #endif
-#if __HAVE_DMA_IRQ_BH
-extern void          DRM(dma_immediate_bh)( void *dev );
+#if __HAVE_IRQ_BH
+extern void          DRM(irq_immediate_bh)( void *dev );
 #endif
 #endif
 
-#endif /* __HAVE_DMA */
 
 #if __REALLY_HAVE_AGP
 				/* AGP/GART support (drm_agpsupport.h) */
diff -Nru a/drivers/char/drm/drm_agpsupport.h b/drivers/char/drm/drm_agpsupport.h
--- a/drivers/char/drm/drm_agpsupport.h	Tue Jun 15 22:20:35 2004
+++ b/drivers/char/drm/drm_agpsupport.h	Tue Jun 15 22:20:35 2004
@@ -103,7 +103,11 @@
 	drm_device_t	 *dev	 = priv->dev;
 	int              retcode;
 
-	if (!dev->agp || dev->agp->acquired || !drm_agp->acquire)
+	if (!dev->agp)
+		return -ENODEV;
+	if (dev->agp->acquired)
+		return -EBUSY;
+	if (!drm_agp->acquire)
 		return -EINVAL;
 	if ((retcode = drm_agp->acquire()))
 		return retcode;
diff -Nru a/drivers/char/drm/drm_bufs.h b/drivers/char/drm/drm_bufs.h
--- a/drivers/char/drm/drm_bufs.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/drm/drm_bufs.h	Tue Jun 15 22:20:38 2004
@@ -147,7 +147,9 @@
 					      MTRR_TYPE_WRCOMB, 1 );
 		}
 #endif
-		map->handle = DRM(ioremap)( map->offset, map->size, dev );
+		if (map->type == _DRM_REGISTERS)
+			map->handle = DRM(ioremap)( map->offset, map->size,
+						    dev );
 		break;
 
 	case _DRM_SHM:
@@ -160,6 +162,12 @@
 		}
 		map->offset = (unsigned long)map->handle;
 		if ( map->flags & _DRM_CONTAINS_LOCK ) {
+			/* Prevent a 2nd X Server from creating a 2nd lock */
+			if (dev->lock.hw_lock != NULL) {
+				vfree( map->handle );
+				DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
+				return -EBUSY;
+			}
 			dev->sigdata.lock =
 			dev->lock.hw_lock = map->handle; /* Pointer to lock */
 		}
@@ -767,7 +775,7 @@
 }
 #endif /* __HAVE_PCI_DMA */
 
-#ifdef __HAVE_SG
+#if __HAVE_SG
 int DRM(addbufs_sg)( struct inode *inode, struct file *filp,
                      unsigned int cmd, unsigned long arg )
 {
diff -Nru a/drivers/char/drm/drm_context.h b/drivers/char/drm/drm_context.h
--- a/drivers/char/drm/drm_context.h	Tue Jun 15 22:20:35 2004
+++ b/drivers/char/drm/drm_context.h	Tue Jun 15 22:20:35 2004
@@ -401,6 +401,7 @@
 {
 	drm_file_t *priv = filp->private_data;
 	drm_device_t *dev = priv->dev;
+	drm_ctx_list_t * ctx_entry;
 	drm_ctx_t ctx;
 
 	if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
@@ -421,6 +422,20 @@
 	if ( ctx.handle != DRM_KERNEL_CONTEXT )
 		DRIVER_CTX_CTOR(ctx.handle); /* XXX: also pass dev ? */
 #endif
+	ctx_entry = DRM(alloc)( sizeof(*ctx_entry), DRM_MEM_CTXLIST );
+	if ( !ctx_entry ) {
+		DRM_DEBUG("out of memory\n");
+		return -ENOMEM;
+	}
+
+	INIT_LIST_HEAD( &ctx_entry->head );
+	ctx_entry->handle = ctx.handle;
+	ctx_entry->tag = priv;
+
+	down( &dev->ctxlist_sem );
+	list_add( &ctx_entry->head, &dev->ctxlist->head );
+	++dev->ctx_count;
+	up( &dev->ctxlist_sem );
 
 	if ( copy_to_user( (drm_ctx_t *)arg, &ctx, sizeof(ctx) ) )
 		return -EFAULT;
@@ -542,6 +557,20 @@
 #endif
 		DRM(ctxbitmap_free)( dev, ctx.handle );
 	}
+
+	down( &dev->ctxlist_sem );
+	if ( !list_empty( &dev->ctxlist->head ) ) {
+		drm_ctx_list_t *pos, *n;
+
+		list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) {
+			if ( pos->handle == ctx.handle ) {
+				list_del( &pos->head );
+				DRM(free)( pos, sizeof(*pos), DRM_MEM_CTXLIST );
+				--dev->ctx_count;
+			}
+		}
+	}
+	up( &dev->ctxlist_sem );
 
 	return 0;
 }
diff -Nru a/drivers/char/drm/drm_dma.h b/drivers/char/drm/drm_dma.h
--- a/drivers/char/drm/drm_dma.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/drm/drm_dma.h	Tue Jun 15 22:20:42 2004
@@ -35,7 +35,6 @@
 
 #include "drmP.h"
 
-#include <linux/interrupt.h>	/* For task queue support */
 
 #ifndef __HAVE_DMA_WAITQUEUE
 #define __HAVE_DMA_WAITQUEUE	0
@@ -43,15 +42,6 @@
 #ifndef __HAVE_DMA_RECLAIM
 #define __HAVE_DMA_RECLAIM	0
 #endif
-#ifndef __HAVE_SHARED_IRQ
-#define __HAVE_SHARED_IRQ	0
-#endif
-
-#if __HAVE_SHARED_IRQ
-#define DRM_IRQ_TYPE		SA_SHIRQ
-#else
-#define DRM_IRQ_TYPE		0
-#endif
 
 #if __HAVE_DMA
 
@@ -214,293 +204,11 @@
 }
 #endif
 
-
-
-
-#if __HAVE_DMA_IRQ
-
-/**
- * Install IRQ handler.
- *
- * \param dev DRM device.
- * \param irq IRQ number.
- *
- * Initializes the IRQ related data, and setups drm_device::vbl_queue. Installs the handler, calling the driver
- * \c DRM(driver_irq_preinstall)() and \c DRM(driver_irq_postinstall)() functions
- * before and after the installation.
- */
-int DRM(irq_install)( drm_device_t *dev, int irq )
-{
-	int ret;
-
-	if ( !irq )
-		return -EINVAL;
-
-	down( &dev->struct_sem );
-
-	/* Driver must have been initialized */
-	if ( !dev->dev_private ) {
-		up( &dev->struct_sem );
-		return -EINVAL;
-	}
-
-	if ( dev->irq ) {
-		up( &dev->struct_sem );
-		return -EBUSY;
-	}
-	dev->irq = irq;
-	up( &dev->struct_sem );
-
-	DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq );
-
-	dev->context_flag = 0;
-	dev->interrupt_flag = 0;
-	dev->dma_flag = 0;
-
-	dev->dma->next_buffer = NULL;
-	dev->dma->next_queue = NULL;
-	dev->dma->this_buffer = NULL;
-
-#if __HAVE_DMA_IRQ_BH
-	INIT_WORK(&dev->work, DRM(dma_immediate_bh), dev);
-#endif
-
-#if __HAVE_VBL_IRQ
-	init_waitqueue_head(&dev->vbl_queue);
-
-	spin_lock_init( &dev->vbl_lock );
-
-	INIT_LIST_HEAD( &dev->vbl_sigs.head );
-
-	dev->vbl_pending = 0;
-#endif
-
-				/* Before installing handler */
-	DRM(driver_irq_preinstall)(dev);
-
-				/* Install handler */
-	ret = request_irq( dev->irq, DRM(dma_service),
-			   DRM_IRQ_TYPE, dev->devname, dev );
-	if ( ret < 0 ) {
-		down( &dev->struct_sem );
-		dev->irq = 0;
-		up( &dev->struct_sem );
-		return ret;
-	}
-
-				/* After installing handler */
-	DRM(driver_irq_postinstall)(dev);
-
-	return 0;
-}
-
-/**
- * Uninstall the IRQ handler.
- *
- * \param dev DRM device.
- *
- * Calls the driver's \c DRM(driver_irq_uninstall)() function, and stops the irq.
- */
-int DRM(irq_uninstall)( drm_device_t *dev )
-{
-	int irq;
-
-	down( &dev->struct_sem );
-	irq = dev->irq;
-	dev->irq = 0;
-	up( &dev->struct_sem );
-
-	if ( !irq )
-		return -EINVAL;
-
-	DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq );
-
-	DRM(driver_irq_uninstall)( dev );
-
-	free_irq( irq, dev );
-
-	return 0;
-}
-
-/**
- * IRQ control ioctl.
- *
- * \param inode device inode.
- * \param filp file pointer.
- * \param cmd command.
- * \param arg user argument, pointing to a drm_control structure.
- * \return zero on success or a negative number on failure.
- *
- * Calls irq_install() or irq_uninstall() according to \p arg.
- */
-int DRM(control)( struct inode *inode, struct file *filp,
-		  unsigned int cmd, unsigned long arg )
-{
-	drm_file_t *priv = filp->private_data;
-	drm_device_t *dev = priv->dev;
-	drm_control_t ctl;
-
-	if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) )
-		return -EFAULT;
-
-	switch ( ctl.func ) {
-	case DRM_INST_HANDLER:
-		return DRM(irq_install)( dev, ctl.irq );
-	case DRM_UNINST_HANDLER:
-		return DRM(irq_uninstall)( dev );
-	default:
-		return -EINVAL;
-	}
-}
-
-#if __HAVE_VBL_IRQ
-
-/**
- * Wait for VBLANK.
- *
- * \param inode device inode.
- * \param filp file pointer.
- * \param cmd command.
- * \param data user argument, pointing to a drm_wait_vblank structure.
- * \return zero on success or a negative number on failure.
- *
- * Verifies the IRQ is installed. 
- *
- * If a signal is requested checks if this task has already scheduled the same signal
- * for the same vblank sequence number - nothing to be done in
- * that case. If the number of tasks waiting for the interrupt exceeds 100 the
- * function fails. Otherwise adds a new entry to drm_device::vbl_sigs for this
- * task.
- *
- * If a signal is not requested, then calls vblank_wait().
- */
-int DRM(wait_vblank)( DRM_IOCTL_ARGS )
-{
-	drm_file_t *priv = filp->private_data;
-	drm_device_t *dev = priv->dev;
-	drm_wait_vblank_t vblwait;
-	struct timeval now;
-	int ret = 0;
-	unsigned int flags;
-
-	if (!dev->irq)
-		return -EINVAL;
-
-	DRM_COPY_FROM_USER_IOCTL( vblwait, (drm_wait_vblank_t *)data,
-				  sizeof(vblwait) );
-
-	switch ( vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK ) {
-	case _DRM_VBLANK_RELATIVE:
-		vblwait.request.sequence += atomic_read( &dev->vbl_received );
-		vblwait.request.type &= ~_DRM_VBLANK_RELATIVE;
-	case _DRM_VBLANK_ABSOLUTE:
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK;
-	
-	if ( flags & _DRM_VBLANK_SIGNAL ) {
-		unsigned long irqflags;
-		drm_vbl_sig_t *vbl_sig;
-		
-		vblwait.reply.sequence = atomic_read( &dev->vbl_received );
-
-		spin_lock_irqsave( &dev->vbl_lock, irqflags );
-
-		/* Check if this task has already scheduled the same signal
-		 * for the same vblank sequence number; nothing to be done in
-		 * that case
-		 */
-		list_for_each_entry( vbl_sig, &dev->vbl_sigs.head, head ) {
-			if (vbl_sig->sequence == vblwait.request.sequence
-			    && vbl_sig->info.si_signo == vblwait.request.signal
-			    && vbl_sig->task == current)
-			{
-				spin_unlock_irqrestore( &dev->vbl_lock, irqflags );
-				goto done;
-			}
-		}
-
-		if ( dev->vbl_pending >= 100 ) {
-			spin_unlock_irqrestore( &dev->vbl_lock, irqflags );
-			return -EBUSY;
-		}
-
-		dev->vbl_pending++;
-
-		spin_unlock_irqrestore( &dev->vbl_lock, irqflags );
-
-		if ( !( vbl_sig = DRM_MALLOC( sizeof( drm_vbl_sig_t ) ) ) ) {
-			return -ENOMEM;
-		}
-
-		memset( (void *)vbl_sig, 0, sizeof(*vbl_sig) );
-
-		vbl_sig->sequence = vblwait.request.sequence;
-		vbl_sig->info.si_signo = vblwait.request.signal;
-		vbl_sig->task = current;
-
-		spin_lock_irqsave( &dev->vbl_lock, irqflags );
-
-		list_add_tail( (struct list_head *) vbl_sig, &dev->vbl_sigs.head );
-
-		spin_unlock_irqrestore( &dev->vbl_lock, irqflags );
-	} else {
-		ret = DRM(vblank_wait)( dev, &vblwait.request.sequence );
-
-		do_gettimeofday( &now );
-		vblwait.reply.tval_sec = now.tv_sec;
-		vblwait.reply.tval_usec = now.tv_usec;
-	}
-
-done:
-	DRM_COPY_TO_USER_IOCTL( (drm_wait_vblank_t *)data, vblwait,
-				sizeof(vblwait) );
-
-	return ret;
-}
-
-/**
- * Send the VBLANK signals.
- *
- * \param dev DRM device.
- *
- * Sends a signal for each task in drm_device::vbl_sigs and empties the list.
- *
- * If a signal is not requested, then calls vblank_wait().
+#if !__HAVE_IRQ
+/* This stub DRM_IOCTL_CONTROL handler is for the drivers that used to require
+ * IRQs for DMA but no longer do.  It maintains compatibility with the X Servers
+ * that try to use the control ioctl by simply returning success.
  */
-void DRM(vbl_send_signals)( drm_device_t *dev )
-{
-	struct list_head *list, *tmp;
-	drm_vbl_sig_t *vbl_sig;
-	unsigned int vbl_seq = atomic_read( &dev->vbl_received );
-	unsigned long flags;
-
-	spin_lock_irqsave( &dev->vbl_lock, flags );
-
-	list_for_each_safe( list, tmp, &dev->vbl_sigs.head ) {
-		vbl_sig = list_entry( list, drm_vbl_sig_t, head );
-		if ( ( vbl_seq - vbl_sig->sequence ) <= (1<<23) ) {
-			vbl_sig->info.si_code = vbl_seq;
-			send_sig_info( vbl_sig->info.si_signo, &vbl_sig->info, vbl_sig->task );
-
-			list_del( list );
-
-			DRM_FREE( vbl_sig, sizeof(*vbl_sig) );
-
-			dev->vbl_pending--;
-		}
-	}
-
-	spin_unlock_irqrestore( &dev->vbl_lock, flags );
-}
-
-#endif	/* __HAVE_VBL_IRQ */
-
-#else
-
 int DRM(control)( struct inode *inode, struct file *filp,
 		  unsigned int cmd, unsigned long arg )
 {
@@ -517,7 +225,6 @@
 		return -EINVAL;
 	}
 }
-
-#endif /* __HAVE_DMA_IRQ */
+#endif
 
 #endif /* __HAVE_DMA */
diff -Nru a/drivers/char/drm/drm_drv.h b/drivers/char/drm/drm_drv.h
--- a/drivers/char/drm/drm_drv.h	Tue Jun 15 22:20:44 2004
+++ b/drivers/char/drm/drm_drv.h	Tue Jun 15 22:20:44 2004
@@ -58,8 +58,8 @@
 #ifndef __HAVE_CTX_BITMAP
 #define __HAVE_CTX_BITMAP		0
 #endif
-#ifndef __HAVE_DMA_IRQ
-#define __HAVE_DMA_IRQ			0
+#ifndef __HAVE_IRQ
+#define __HAVE_IRQ			0
 #endif
 #ifndef __HAVE_DMA_QUEUE
 #define __HAVE_DMA_QUEUE		0
@@ -126,6 +126,9 @@
 #ifndef DRIVER_IOCTLS
 #define DRIVER_IOCTLS
 #endif
+#ifndef DRIVER_OPEN_HELPER
+#define DRIVER_OPEN_HELPER( priv, dev )
+#endif
 #ifndef DRIVER_FOPS
 #define DRIVER_FOPS				\
 static struct file_operations	DRM(fops) = {	\
@@ -159,15 +162,8 @@
 #undef DRM_OPTIONS_FUNC
 #endif
 
-/**
- * The default number of instances (minor numbers) to initialize.
- */
-#ifndef DRIVER_NUM_CARDS
-#define DRIVER_NUM_CARDS 1
-#endif
-
-static drm_device_t	*DRM(device);
-static int		*DRM(minor);
+#define MAX_DEVICES 4
+static drm_device_t	DRM(device)[MAX_DEVICES];
 static int		DRM(numdevs) = 0;
 
 DRIVER_FOPS;
@@ -177,10 +173,13 @@
 	[DRM_IOCTL_NR(DRM_IOCTL_VERSION)]       = { DRM(version),     0, 0 },
 	[DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)]    = { DRM(getunique),   0, 0 },
 	[DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)]     = { DRM(getmagic),    0, 0 },
-	[DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)]     = { DRM(irq_busid),   0, 1 },
+#if __HAVE_IRQ
+	[DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)]     = { DRM(irq_by_busid), 0, 1 },
+#endif
 	[DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)]       = { DRM(getmap),      0, 0 },
 	[DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)]    = { DRM(getclient),   0, 0 },
 	[DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)]     = { DRM(getstats),    0, 0 },
+	[DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)]   = { DRM(setversion),  0, 1 },
 
 	[DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)]    = { DRM(setunique),   1, 1 },
 	[DRM_IOCTL_NR(DRM_IOCTL_BLOCK)]         = { DRM(noop),        1, 1 },
@@ -222,9 +221,9 @@
 	[DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)]     = { DRM(infobufs),    1, 0 },
 	[DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)]      = { DRM(mapbufs),     1, 0 },
 	[DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)]     = { DRM(freebufs),    1, 0 },
-
-	/* The DRM_IOCTL_DMA ioctl should be defined by the driver.
-	 */
+	/* The DRM_IOCTL_DMA ioctl should be defined by the driver. */
+#endif
+#if __HAVE_IRQ || __HAVE_DMA
 	[DRM_IOCTL_NR(DRM_IOCTL_CONTROL)]       = { DRM(control),     1, 1 },
 #endif
 
@@ -330,6 +329,12 @@
 	memset(dev->maplist, 0, sizeof(*dev->maplist));
 	INIT_LIST_HEAD(&dev->maplist->head);
 
+	dev->ctxlist = DRM(alloc)(sizeof(*dev->ctxlist),
+				  DRM_MEM_CTXLIST);
+	if(dev->ctxlist == NULL) return -ENOMEM;
+	memset(dev->ctxlist, 0, sizeof(*dev->ctxlist));
+	INIT_LIST_HEAD(&dev->ctxlist->head);
+
 	dev->vmalist = NULL;
 	dev->sigdata.lock = dev->lock.hw_lock = NULL;
 	init_waitqueue_head( &dev->lock.lock_queue );
@@ -337,7 +342,7 @@
 	dev->queue_reserved = 0;
 	dev->queue_slots = 0;
 	dev->queuelist = NULL;
-	dev->irq = 0;
+	dev->irq_enabled = 0;
 	dev->context_flag = 0;
 	dev->interrupt_flag = 0;
 	dev->dma_flag = 0;
@@ -345,6 +350,7 @@
 	dev->last_switch = 0;
 	dev->last_checked = 0;
 	init_waitqueue_head( &dev->context_wait );
+	dev->if_version = 0;
 
 	dev->ctx_start = 0;
 	dev->lck_start = 0;
@@ -391,8 +397,8 @@
 	DRM_DEBUG( "\n" );
 
 	DRIVER_PRETAKEDOWN();
-#if __HAVE_DMA_IRQ
-	if ( dev->irq ) DRM(irq_uninstall)( dev );
+#if __HAVE_IRQ
+	if ( dev->irq_enabled ) DRM(irq_uninstall)( dev );
 #endif
 
 	down( &dev->struct_sem );
@@ -534,43 +540,104 @@
 	return 0;
 }
 
-/**
- * Figure out how many instances to initialize.
- *
- * \return number of cards found.
- *
- * Searches for every PCI card in \c DRIVER_CARD_LIST with matching vendor and device ids.
- */
-static int drm_count_cards(void)
+#include "drm_pciids.h"
+
+static struct pci_device_id DRM(pciidlist)[] = {
+	DRM(PCI_IDS)
+};
+
+static int DRM(probe)(struct pci_dev *pdev)
 {
-	int num = 0;
-#if defined(DRIVER_CARD_LIST)
-	int i;
-	drm_pci_list_t *l;
-	u16 device, vendor;
-	struct pci_dev *pdev = NULL;
+	drm_device_t *dev;
+#if __HAVE_CTX_BITMAP
+	int retcode;
 #endif
+	int i;
+	int is_compat = 0;
 
 	DRM_DEBUG( "\n" );
 
-#if defined(DRIVER_COUNT_CARDS)
-	num = DRIVER_COUNT_CARDS();
-#elif defined(DRIVER_CARD_LIST)
-	for (i = 0, l = DRIVER_CARD_LIST; l[i].vendor != 0; i++) {
-		pdev = NULL;
-		vendor = l[i].vendor;
-		device = l[i].device;
-		if(device == 0xffff) device = PCI_ANY_ID;
-		if(vendor == 0xffff) vendor = PCI_ANY_ID;
-		while ((pdev = pci_find_device(vendor, device, pdev))) {
-			num++;
+	for (i = 0; DRM(pciidlist)[i].vendor != 0; i++) {
+		if ((DRM(pciidlist)[i].vendor == pdev->vendor) &&
+		    (DRM(pciidlist)[i].device == pdev->device)) {
+			is_compat = 1;
 		}
 	}
+	if (is_compat == 0)
+		return -ENODEV;
+
+	if (DRM(numdevs) >= MAX_DEVICES)
+		return -ENODEV;
+
+	dev = &(DRM(device)[DRM(numdevs)]);
+
+	memset( (void *)dev, 0, sizeof(*dev) );
+	dev->count_lock = SPIN_LOCK_UNLOCKED;
+	init_timer( &dev->timer );
+	sema_init( &dev->struct_sem, 1 );
+	sema_init( &dev->ctxlist_sem, 1 );
+
+	if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
+		return -EPERM;
+	dev->device = MKDEV(DRM_MAJOR, dev->minor );
+	dev->name   = DRIVER_NAME;
+
+	dev->pdev   = pdev;
+#ifdef __alpha__
+	dev->hose   = pdev->sysdata;
+	dev->pci_domain = dev->hose->bus->number;
 #else
-	num = DRIVER_NUM_CARDS;
+	dev->pci_domain = 0;
+#endif
+	dev->pci_bus = pdev->bus->number;
+	dev->pci_slot = PCI_SLOT(pdev->devfn);
+	dev->pci_func = PCI_FUNC(pdev->devfn);
+	dev->irq = pdev->irq;
+
+	DRIVER_PREINIT();
+
+#if __REALLY_HAVE_AGP
+	dev->agp = DRM(agp_init)();
+#if __MUST_HAVE_AGP
+	if ( dev->agp == NULL ) {
+		DRM_ERROR( "Cannot initialize the agpgart module.\n" );
+		DRM(stub_unregister)(dev->minor);
+		DRM(takedown)( dev );
+		return -EINVAL;
+	}
+#endif
+#if __REALLY_HAVE_MTRR
+	if (dev->agp)
+		dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
+					dev->agp->agp_info.aper_size*1024*1024,
+					MTRR_TYPE_WRCOMB,
+					1 );
+#endif
+#endif
+
+#if __HAVE_CTX_BITMAP
+	retcode = DRM(ctxbitmap_init)( dev );
+	if( retcode ) {
+		DRM_ERROR( "Cannot allocate memory for context bitmap.\n" );
+		DRM(stub_unregister)(dev->minor);
+		DRM(takedown)( dev );
+		return retcode;
+ 	}
 #endif
-	DRM_DEBUG("numdevs = %d\n", num);
-	return num;
+	DRM(numdevs)++; /* no errors, mark it reserved */
+	
+	DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n",
+		DRIVER_NAME,
+		DRIVER_MAJOR,
+		DRIVER_MINOR,
+		DRIVER_PATCHLEVEL,
+		DRIVER_DATE,
+		dev->minor,
+		pci_pretty_name(pdev));
+
+	DRIVER_POSTINIT();
+
+	return 0;
 }
 
 /**
@@ -579,7 +646,7 @@
  *
  * \return zero on success or a negative number on failure.
  *
- * Allocates and initialize an array of drm_device structures, and attempts to
+ * Initializes an array of drm_device structures, and attempts to
  * initialize all available devices, using consecutive minors, registering the
  * stubs and initializing the AGP device.
  * 
@@ -588,88 +655,19 @@
  */
 static int __init drm_init( void )
 {
+	struct pci_dev *pdev = NULL;
 
-	drm_device_t *dev;
-	int i;
-#if __HAVE_CTX_BITMAP
-	int retcode;
-#endif
 	DRM_DEBUG( "\n" );
 
 #ifdef MODULE
 	DRM(parse_options)( drm_opts );
 #endif
 
-	DRM(numdevs) = drm_count_cards();
-	/* Force at least one instance. */
-	if (DRM(numdevs) <= 0)
-		DRM(numdevs) = 1;
-
-	DRM(device) = kmalloc(sizeof(*DRM(device)) * DRM(numdevs), GFP_KERNEL);
-	if (!DRM(device)) {
-		return -ENOMEM;
-	}
-	DRM(minor) = kmalloc(sizeof(*DRM(minor)) * DRM(numdevs), GFP_KERNEL);
-	if (!DRM(minor)) {
-		kfree(DRM(device));
-		return -ENOMEM;
-	}
-
-	DRIVER_PREINIT();
-
 	DRM(mem_init)();
 
-	for (i = 0; i < DRM(numdevs); i++) {
-		dev = &(DRM(device)[i]);
-		memset( (void *)dev, 0, sizeof(*dev) );
-		dev->count_lock = SPIN_LOCK_UNLOCKED;
-		init_timer( &dev->timer );
-		sema_init( &dev->struct_sem, 1 );
-
-		if ((DRM(minor)[i] = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0)
-			return -EPERM;
-		dev->device = MKDEV(DRM_MAJOR, DRM(minor)[i] );
-		dev->name   = DRIVER_NAME;
-
-#if __REALLY_HAVE_AGP
-		dev->agp = DRM(agp_init)();
-#if __MUST_HAVE_AGP
-		if ( dev->agp == NULL ) {
-			DRM_ERROR( "Cannot initialize the agpgart module.\n" );
-			DRM(stub_unregister)(DRM(minor)[i]);
-			DRM(takedown)( dev );
-			return -EINVAL;
-		}
-#endif
-#if __REALLY_HAVE_MTRR
-		if (dev->agp)
-			dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
-				       dev->agp->agp_info.aper_size*1024*1024,
-				       MTRR_TYPE_WRCOMB,
-				       1 );
-#endif
-#endif
-
-#if __HAVE_CTX_BITMAP
-		retcode = DRM(ctxbitmap_init)( dev );
-		if( retcode ) {
-			DRM_ERROR( "Cannot allocate memory for context bitmap.\n" );
-			DRM(stub_unregister)(DRM(minor)[i]);
-			DRM(takedown)( dev );
-			return retcode;
-		}
-#endif
-		DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n",
-		  	DRIVER_NAME,
-		  	DRIVER_MAJOR,
-		  	DRIVER_MINOR,
-		  	DRIVER_PATCHLEVEL,
-		  	DRIVER_DATE,
-		  	DRM(minor)[i] );
+	while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
+		DRM(probe)(pdev);
 	}
-
-	DRIVER_POSTINIT();
-
 	return 0;
 }
 
@@ -689,10 +687,10 @@
 
 	for (i = DRM(numdevs) - 1; i >= 0; i--) {
 		dev = &(DRM(device)[i]);
-		if ( DRM(stub_unregister)(DRM(minor)[i]) ) {
+		if ( DRM(stub_unregister)(dev->minor) ) {
 			DRM_ERROR( "Cannot unload module\n" );
 		} else {
-			DRM_DEBUG("minor %d unregistered\n", DRM(minor)[i]);
+			DRM_DEBUG("minor %d unregistered\n", dev->minor);
 			if (i == 0) {
 				DRM_INFO( "Module unloaded\n" );
 			}
@@ -722,8 +720,6 @@
 #endif
 	}
 	DRIVER_POSTCLEANUP();
-	kfree(DRM(minor));
-	kfree(DRM(device));
 	DRM(numdevs) = 0;
 }
 
@@ -795,7 +791,7 @@
 	int i;
 
 	for (i = 0; i < DRM(numdevs); i++) {
-		if (iminor(inode) == DRM(minor)[i]) {
+		if (iminor(inode) == DRM(device)[i].minor) {
 			dev = &(DRM(device)[i]);
 			break;
 		}
@@ -907,6 +903,26 @@
 #endif
 
 	DRM(fasync)( -1, filp, 0 );
+
+	down( &dev->ctxlist_sem );
+	if ( !list_empty( &dev->ctxlist->head ) ) {
+		drm_ctx_list_t *pos, *n;
+
+		list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) {
+			if ( pos->tag == priv &&
+			     pos->handle != DRM_KERNEL_CONTEXT ) {
+#ifdef DRIVER_CTX_DTOR
+				DRIVER_CTX_DTOR(pos->handle);
+#endif
+#if __HAVE_CTX_BITMAP
+				DRM(ctxbitmap_free)( dev, pos->handle );
+#endif
+				list_del( &pos->head );
+				DRM(free)( pos, sizeof(*pos), DRM_MEM_CTXLIST );
+			}
+		}
+	}
+	up( &dev->ctxlist_sem );
 
 	down( &dev->struct_sem );
 	if ( priv->remove_auth_on_close == 1 ) {
diff -Nru a/drivers/char/drm/drm_fops.h b/drivers/char/drm/drm_fops.h
--- a/drivers/char/drm/drm_fops.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/char/drm/drm_fops.h	Tue Jun 15 22:20:41 2004
@@ -72,6 +72,8 @@
 	priv->authenticated = capable(CAP_SYS_ADMIN);
 	priv->lock_count    = 0;
 
+	DRIVER_OPEN_HELPER( priv, dev );
+
 	down(&dev->struct_sem);
 	if (!dev->file_last) {
 		priv->next	= NULL;
diff -Nru a/drivers/char/drm/drm_ioctl.h b/drivers/char/drm/drm_ioctl.h
--- a/drivers/char/drm/drm_ioctl.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/drm/drm_ioctl.h	Tue Jun 15 22:20:38 2004
@@ -35,69 +35,7 @@
 
 #include "drmP.h"
 
-
-/**
- * Get interrupt from bus id.
- * 
- * \param inode device inode.
- * \param filp file pointer.
- * \param cmd command.
- * \param arg user argument, pointing to a drm_irq_busid structure.
- * \return zero on success or a negative number on failure.
- * 
- * Finds the PCI device with the specified bus id and gets its IRQ number.
- */
-int DRM(irq_busid)(struct inode *inode, struct file *filp,
-		   unsigned int cmd, unsigned long arg)
-{
-	drm_irq_busid_t p;
-	struct pci_dev	*dev;
-
-	if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p)))
-		return -EFAULT;
-#ifdef __alpha__
-	{
-		int domain = p.busnum >> 8;
-		p.busnum &= 0xff;
-
-		/*
-		 * Find the hose the device is on (the domain number is the
-		 * hose index) and offset the bus by the root bus of that
-		 * hose.
-		 */
-                for(dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,NULL);
-                    dev;
-                    dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,dev)) {
-			struct pci_controller *hose = dev->sysdata;
-			
-			if (hose->index == domain) {
-				p.busnum += hose->bus->number;
-				break;
-			}
-		}
-	}
-#endif
-	dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum));
-	if (!dev) {
-		DRM_ERROR("pci_find_slot failed for %d:%d:%d\n",
-			  p.busnum, p.devnum, p.funcnum);
-		p.irq = 0;
-		goto out;
-	}			
-	if (pci_enable_device(dev) != 0) {
-		DRM_ERROR("pci_enable_device failed for %d:%d:%d\n",
-			  p.busnum, p.devnum, p.funcnum);
-		p.irq = 0;
-		goto out;
-	}		
-	p.irq = dev->irq;
- out:
-	DRM_DEBUG("%d:%d:%d => IRQ %d\n",
-		  p.busnum, p.devnum, p.funcnum, p.irq);
-	if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p)))
-		return -EFAULT;
-	return 0;
-}
+#include "linux/pci.h"
 
 /**
  * Get the bus id.
@@ -138,8 +76,10 @@
  * \param arg user argument, pointing to a drm_unique structure.
  * \return zero on success or a negative number on failure.
  *
- * Copies the bus id from userspace into drm_device::unique, and searches for
- * the respective PCI device, updating drm_device::pdev.
+ * Copies the bus id from userspace into drm_device::unique, and verifies that
+ * it matches the device this DRM is attached to (EINVAL otherwise).  Deprecated
+ * in interface version 1.1 and will return EBUSY when setversion has requested
+ * version 1.1 or greater.
  */
 int DRM(setunique)(struct inode *inode, struct file *filp,
 		   unsigned int cmd, unsigned long arg)
@@ -147,6 +87,7 @@
 	drm_file_t	 *priv	 = filp->private_data;
 	drm_device_t	 *dev	 = priv->dev;
 	drm_unique_t	 u;
+	int		 domain, bus, slot, func, ret;
 
 	if (dev->unique_len || dev->unique) return -EBUSY;
 
@@ -164,55 +105,49 @@
 
 	dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2,
 				  DRM_MEM_DRIVER);
-	if(!dev->devname) {
-		DRM(free)(dev->devname, sizeof(*dev->devname), DRM_MEM_DRIVER);
+	if (!dev->devname)
 		return -ENOMEM;
-	}
+
 	sprintf(dev->devname, "%s@%s", dev->name, dev->unique);
 
-	do {
-		struct pci_dev *pci_dev;
-                int domain, b, d, f;
-                char *p;
- 
-                for(p = dev->unique; p && *p && *p != ':'; p++);
-                if (!p || !*p) break;
-                b = (int)simple_strtoul(p+1, &p, 10);
-                if (*p != ':') break;
-                d = (int)simple_strtoul(p+1, &p, 10);
-                if (*p != ':') break;
-                f = (int)simple_strtoul(p+1, &p, 10);
-                if (*p) break;
- 
-		domain = b >> 8;
-		b &= 0xff;
-
-#ifdef __alpha__
-		/*
-		 * Find the hose the device is on (the domain number is the
-		 * hose index) and offset the bus by the root bus of that
-		 * hose.
-		 */
-                for(pci_dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,NULL);
-                    pci_dev;
-                    pci_dev = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,pci_dev)) {
-			struct pci_controller *hose = pci_dev->sysdata;
-			
-			if (hose->index == domain) {
-				b += hose->bus->number;
-				break;
-			}
-		}
-#endif
+	/* Return error if the busid submitted doesn't match the device's actual
+	 * busid.
+	 */
+	ret = sscanf(dev->unique, "PCI:%d:%d:%d", &bus, &slot, &func);
+	if (ret != 3)
+		return DRM_ERR(EINVAL);
+	domain = bus >> 8;
+	bus &= 0xff;
+	
+	if ((domain != dev->pci_domain) ||
+	    (bus != dev->pci_bus) ||
+	    (slot != dev->pci_slot) ||
+	    (func != dev->pci_func))
+		return -EINVAL;
 
-                pci_dev = pci_find_slot(b, PCI_DEVFN(d,f));
-                if (pci_dev) {
-			dev->pdev = pci_dev;
-#ifdef __alpha__
-			dev->hose = pci_dev->sysdata;
-#endif
-		}
-        } while(0);
+	return 0;
+}
+
+static int
+DRM(set_busid)(drm_device_t *dev)
+{
+	if (dev->unique != NULL)
+		return EBUSY;
+
+	dev->unique_len = 20;
+	dev->unique = DRM(alloc)(dev->unique_len + 1, DRM_MEM_DRIVER);
+	if (dev->unique == NULL)
+		return ENOMEM;
+
+	snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d",
+		dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func);
+
+	dev->devname = DRM(alloc)(strlen(dev->name) + dev->unique_len + 2,
+				DRM_MEM_DRIVER);
+	if (dev->devname == NULL)
+		return ENOMEM;
+
+	sprintf(dev->devname, "%s@%s", dev->name, dev->unique);
 
 	return 0;
 }
@@ -361,5 +296,49 @@
 
 	if (copy_to_user((drm_stats_t *)arg, &stats, sizeof(stats)))
 		return -EFAULT;
+	return 0;
+}
+
+#define DRM_IF_MAJOR	1
+#define DRM_IF_MINOR	2
+
+int DRM(setversion)(DRM_IOCTL_ARGS)
+{
+	DRM_DEVICE;
+	drm_set_version_t sv;
+	drm_set_version_t retv;
+	int if_version;
+
+	DRM_COPY_FROM_USER_IOCTL(sv, (drm_set_version_t *)data, sizeof(sv));
+
+	retv.drm_di_major = DRM_IF_MAJOR;
+	retv.drm_di_minor = DRM_IF_MINOR;
+	retv.drm_dd_major = DRIVER_MAJOR;
+	retv.drm_dd_minor = DRIVER_MINOR;
+
+	DRM_COPY_TO_USER_IOCTL((drm_set_version_t *)data, retv, sizeof(sv));
+
+	if (sv.drm_di_major != -1) {
+		if (sv.drm_di_major != DRM_IF_MAJOR ||
+		    sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR)
+			return EINVAL;
+		if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_dd_minor);
+		dev->if_version = DRM_MAX(if_version, dev->if_version);
+		if (sv.drm_di_minor >= 1) {
+			/*
+			 * Version 1.1 includes tying of DRM to specific device
+			 */
+			DRM(set_busid)(dev);
+		}
+	}
+
+	if (sv.drm_dd_major != -1) {
+		if (sv.drm_dd_major != DRIVER_MAJOR ||
+		    sv.drm_dd_minor < 0 || sv.drm_dd_minor > DRIVER_MINOR)
+			return EINVAL;
+#ifdef DRIVER_SETVERSION
+		DRIVER_SETVERSION(dev, &sv);
+#endif
+	}
 	return 0;
 }
diff -Nru a/drivers/char/drm/drm_irq.h b/drivers/char/drm/drm_irq.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/char/drm/drm_irq.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,371 @@
+/**
+ * \file drm_irq.h 
+ * IRQ support
+ *
+ * \author Rickard E. (Rik) Faith <faith@valinux.com>
+ * \author Gareth Hughes <gareth@valinux.com>
+ */
+
+/*
+ * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com
+ *
+ * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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.
+ */
+
+#include "drmP.h"
+
+#include <linux/interrupt.h>	/* For task queue support */
+
+#ifndef __HAVE_SHARED_IRQ
+#define __HAVE_SHARED_IRQ	0
+#endif
+
+#if __HAVE_SHARED_IRQ
+#define DRM_IRQ_TYPE		SA_SHIRQ
+#else
+#define DRM_IRQ_TYPE		0
+#endif
+
+/**
+ * Get interrupt from bus id.
+ * 
+ * \param inode device inode.
+ * \param filp file pointer.
+ * \param cmd command.
+ * \param arg user argument, pointing to a drm_irq_busid structure.
+ * \return zero on success or a negative number on failure.
+ * 
+ * Finds the PCI device with the specified bus id and gets its IRQ number.
+ * This IOCTL is deprecated, and will now return EINVAL for any busid not equal
+ * to that of the device that this DRM instance attached to.
+ */
+int DRM(irq_by_busid)(struct inode *inode, struct file *filp,
+		   unsigned int cmd, unsigned long arg)
+{
+	drm_file_t *priv = filp->private_data;
+	drm_device_t *dev = priv->dev;
+	drm_irq_busid_t p;
+
+	if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p)))
+		return -EFAULT;
+
+	if ((p.busnum >> 8) != dev->pci_domain ||
+	    (p.busnum & 0xff) != dev->pci_bus ||
+	    p.devnum != dev->pci_slot ||
+	    p.funcnum != dev->pci_func)
+		return -EINVAL;
+
+	p.irq = dev->irq;
+
+	DRM_DEBUG("%d:%d:%d => IRQ %d\n",
+		  p.busnum, p.devnum, p.funcnum, p.irq);
+	if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p)))
+		return -EFAULT;
+	return 0;
+}
+
+#if __HAVE_IRQ
+
+/**
+ * Install IRQ handler.
+ *
+ * \param dev DRM device.
+ * \param irq IRQ number.
+ *
+ * Initializes the IRQ related data, and setups drm_device::vbl_queue. Installs the handler, calling the driver
+ * \c DRM(driver_irq_preinstall)() and \c DRM(driver_irq_postinstall)() functions
+ * before and after the installation.
+ */
+int DRM(irq_install)( drm_device_t *dev )
+{
+	int ret;
+ 
+	if ( dev->irq == 0 )
+		return -EINVAL;
+
+	down( &dev->struct_sem );
+
+	/* Driver must have been initialized */
+	if ( !dev->dev_private ) {
+		up( &dev->struct_sem );
+		return -EINVAL;
+	}
+
+	if ( dev->irq_enabled ) {
+		up( &dev->struct_sem );
+		return -EBUSY;
+	}
+	dev->irq_enabled = 1;
+	up( &dev->struct_sem );
+
+	DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );
+
+#if __HAVE_DMA
+	dev->dma->next_buffer = NULL;
+	dev->dma->next_queue = NULL;
+	dev->dma->this_buffer = NULL;
+#endif
+
+#if __HAVE_IRQ_BH
+	INIT_WORK(&dev->work, DRM(irq_immediate_bh), dev);
+#endif
+
+#if __HAVE_VBL_IRQ
+	init_waitqueue_head(&dev->vbl_queue);
+
+	spin_lock_init( &dev->vbl_lock );
+
+	INIT_LIST_HEAD( &dev->vbl_sigs.head );
+
+	dev->vbl_pending = 0;
+#endif
+
+				/* Before installing handler */
+	DRM(driver_irq_preinstall)(dev);
+
+				/* Install handler */
+	ret = request_irq( dev->irq, DRM(irq_handler),
+			   DRM_IRQ_TYPE, dev->devname, dev );
+	if ( ret < 0 ) {
+		down( &dev->struct_sem );
+		dev->irq_enabled = 0;
+		up( &dev->struct_sem );
+		return ret;
+	}
+
+				/* After installing handler */
+	DRM(driver_irq_postinstall)(dev);
+
+	return 0;
+}
+
+/**
+ * Uninstall the IRQ handler.
+ *
+ * \param dev DRM device.
+ *
+ * Calls the driver's \c DRM(driver_irq_uninstall)() function, and stops the irq.
+ */
+int DRM(irq_uninstall)( drm_device_t *dev )
+{
+	int irq_enabled;
+
+	down( &dev->struct_sem );
+	irq_enabled = dev->irq_enabled;
+	dev->irq_enabled = 0;
+	up( &dev->struct_sem );
+
+	if ( !irq_enabled )
+		return -EINVAL;
+
+	DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );
+
+	DRM(driver_irq_uninstall)( dev );
+
+	free_irq( dev->irq, dev );
+
+	return 0;
+}
+
+/**
+ * IRQ control ioctl.
+ *
+ * \param inode device inode.
+ * \param filp file pointer.
+ * \param cmd command.
+ * \param arg user argument, pointing to a drm_control structure.
+ * \return zero on success or a negative number on failure.
+ *
+ * Calls irq_install() or irq_uninstall() according to \p arg.
+ */
+int DRM(control)( struct inode *inode, struct file *filp,
+		  unsigned int cmd, unsigned long arg )
+{
+	drm_file_t *priv = filp->private_data;
+	drm_device_t *dev = priv->dev;
+	drm_control_t ctl;
+
+	if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) )
+		return -EFAULT;
+
+	switch ( ctl.func ) {
+	case DRM_INST_HANDLER:
+		if (dev->if_version < DRM_IF_VERSION(1, 2) &&
+		    ctl.irq != dev->irq)
+			return -EINVAL;
+		return DRM(irq_install)( dev );
+	case DRM_UNINST_HANDLER:
+		return DRM(irq_uninstall)( dev );
+	default:
+		return -EINVAL;
+	}
+}
+
+#if __HAVE_VBL_IRQ
+
+/**
+ * Wait for VBLANK.
+ *
+ * \param inode device inode.
+ * \param filp file pointer.
+ * \param cmd command.
+ * \param data user argument, pointing to a drm_wait_vblank structure.
+ * \return zero on success or a negative number on failure.
+ *
+ * Verifies the IRQ is installed. 
+ *
+ * If a signal is requested checks if this task has already scheduled the same signal
+ * for the same vblank sequence number - nothing to be done in
+ * that case. If the number of tasks waiting for the interrupt exceeds 100 the
+ * function fails. Otherwise adds a new entry to drm_device::vbl_sigs for this
+ * task.
+ *
+ * If a signal is not requested, then calls vblank_wait().
+ */
+int DRM(wait_vblank)( DRM_IOCTL_ARGS )
+{
+	drm_file_t *priv = filp->private_data;
+	drm_device_t *dev = priv->dev;
+	drm_wait_vblank_t vblwait;
+	struct timeval now;
+	int ret = 0;
+	unsigned int flags;
+
+	if (!dev->irq)
+		return -EINVAL;
+
+	DRM_COPY_FROM_USER_IOCTL( vblwait, (drm_wait_vblank_t *)data,
+				  sizeof(vblwait) );
+
+	switch ( vblwait.request.type & ~_DRM_VBLANK_FLAGS_MASK ) {
+	case _DRM_VBLANK_RELATIVE:
+		vblwait.request.sequence += atomic_read( &dev->vbl_received );
+		vblwait.request.type &= ~_DRM_VBLANK_RELATIVE;
+	case _DRM_VBLANK_ABSOLUTE:
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK;
+	
+	if ( flags & _DRM_VBLANK_SIGNAL ) {
+		unsigned long irqflags;
+		drm_vbl_sig_t *vbl_sig;
+		
+		vblwait.reply.sequence = atomic_read( &dev->vbl_received );
+
+		spin_lock_irqsave( &dev->vbl_lock, irqflags );
+
+		/* Check if this task has already scheduled the same signal
+		 * for the same vblank sequence number; nothing to be done in
+		 * that case
+		 */
+		list_for_each_entry( vbl_sig, &dev->vbl_sigs.head, head ) {
+			if (vbl_sig->sequence == vblwait.request.sequence
+			    && vbl_sig->info.si_signo == vblwait.request.signal
+			    && vbl_sig->task == current)
+			{
+				spin_unlock_irqrestore( &dev->vbl_lock, irqflags );
+				goto done;
+			}
+		}
+
+		if ( dev->vbl_pending >= 100 ) {
+			spin_unlock_irqrestore( &dev->vbl_lock, irqflags );
+			return -EBUSY;
+		}
+
+		dev->vbl_pending++;
+
+		spin_unlock_irqrestore( &dev->vbl_lock, irqflags );
+
+		if ( !( vbl_sig = DRM_MALLOC( sizeof( drm_vbl_sig_t ) ) ) ) {
+			return -ENOMEM;
+		}
+
+		memset( (void *)vbl_sig, 0, sizeof(*vbl_sig) );
+
+		vbl_sig->sequence = vblwait.request.sequence;
+		vbl_sig->info.si_signo = vblwait.request.signal;
+		vbl_sig->task = current;
+
+		spin_lock_irqsave( &dev->vbl_lock, irqflags );
+
+		list_add_tail( (struct list_head *) vbl_sig, &dev->vbl_sigs.head );
+
+		spin_unlock_irqrestore( &dev->vbl_lock, irqflags );
+	} else {
+		ret = DRM(vblank_wait)( dev, &vblwait.request.sequence );
+
+		do_gettimeofday( &now );
+		vblwait.reply.tval_sec = now.tv_sec;
+		vblwait.reply.tval_usec = now.tv_usec;
+	}
+
+done:
+	DRM_COPY_TO_USER_IOCTL( (drm_wait_vblank_t *)data, vblwait,
+				sizeof(vblwait) );
+
+	return ret;
+}
+
+/**
+ * Send the VBLANK signals.
+ *
+ * \param dev DRM device.
+ *
+ * Sends a signal for each task in drm_device::vbl_sigs and empties the list.
+ *
+ * If a signal is not requested, then calls vblank_wait().
+ */
+void DRM(vbl_send_signals)( drm_device_t *dev )
+{
+	struct list_head *list, *tmp;
+	drm_vbl_sig_t *vbl_sig;
+	unsigned int vbl_seq = atomic_read( &dev->vbl_received );
+	unsigned long flags;
+
+	spin_lock_irqsave( &dev->vbl_lock, flags );
+
+	list_for_each_safe( list, tmp, &dev->vbl_sigs.head ) {
+		vbl_sig = list_entry( list, drm_vbl_sig_t, head );
+		if ( ( vbl_seq - vbl_sig->sequence ) <= (1<<23) ) {
+			vbl_sig->info.si_code = vbl_seq;
+			send_sig_info( vbl_sig->info.si_signo, &vbl_sig->info, vbl_sig->task );
+
+			list_del( list );
+
+			DRM_FREE( vbl_sig, sizeof(*vbl_sig) );
+
+			dev->vbl_pending--;
+		}
+	}
+
+	spin_unlock_irqrestore( &dev->vbl_lock, flags );
+}
+
+#endif	/* __HAVE_VBL_IRQ */
+
+#endif /* __HAVE_IRQ */
diff -Nru a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h
--- a/drivers/char/drm/drm_memory_debug.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/drm/drm_memory_debug.h	Tue Jun 15 22:20:37 2004
@@ -67,6 +67,7 @@
 	[DRM_MEM_TOTALAGP]  = { "totalagp" },
 	[DRM_MEM_BOUNDAGP]  = { "boundagp" },
 	[DRM_MEM_CTXBITMAP] = { "ctxbitmap"},
+	[DRM_MEM_CTXLIST]   = { "ctxlist"  },
 	[DRM_MEM_STUB]      = { "stub"     },
 	{ NULL, 0, }		/* Last entry must be null */
 };
diff -Nru a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h
--- a/drivers/char/drm/drm_os_linux.h	Tue Jun 15 22:21:02 2004
+++ b/drivers/char/drm/drm_os_linux.h	Tue Jun 15 22:21:02 2004
@@ -62,14 +62,20 @@
 	verify_area( VERIFY_READ, uaddr, size )
 #define DRM_COPY_FROM_USER_UNCHECKED(arg1, arg2, arg3) 	\
 	__copy_from_user(arg1, arg2, arg3)
+#define DRM_COPY_TO_USER_UNCHECKED(arg1, arg2, arg3)	\
+	__copy_to_user(arg1, arg2, arg3)
 #define DRM_GET_USER_UNCHECKED(val, uaddr)		\
 	__get_user(val, uaddr)
+#define DRM_PUT_USER_UNCHECKED(uaddr, val)		\
+	__put_user(val, uaddr)
 
 
 /** 'malloc' without the overhead of DRM(alloc)() */
 #define DRM_MALLOC(x) kmalloc(x, GFP_KERNEL)
 /** 'free' without the overhead of DRM(free)() */
 #define DRM_FREE(x,size) kfree(x)
+
+#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data
 
 /** 
  * Get the pointer to the SAREA.
diff -Nru a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/char/drm/drm_pciids.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,203 @@
+/*
+   This file is auto-generated from the drm_pciids.txt in the DRM CVS
+   Please contact dri-devel@lists.sf.net to add new cards to this list
+*/
+#define radeon_PCI_IDS \
+	{0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4137, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4966, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4967, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4C57, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4C58, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4C59, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4C5A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4C65, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5147, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5148, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x514A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x514B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x514C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x514D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x514E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x514F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5157, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5158, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5159, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x515A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x516A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x516B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x516C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5836, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5960, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5961, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5963, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5968, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x596A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x596B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5c62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5c64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define r128_PCI_IDS \
+	{0x1002, 0x4c45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4d46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4d4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5041, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5042, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5044, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5045, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5046, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5047, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5048, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5049, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x504A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x504B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x504C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x504D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x504E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x504F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5052, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5053, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5054, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5056, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5057, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5245, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5246, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5247, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x524b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x524c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x534d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x544C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x5452, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define mga_PCI_IDS \
+	{0x102b, 0x0521, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x102b, 0x0525, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x102b, 0x2527, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define mach64_PCI_IDS \
+	{0x1002, 0x4749, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4751, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4742, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4744, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c51, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x474c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x474f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4752, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4753, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x474d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x474e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c52, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c53, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1002, 0x4c4e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define sisdrv_PCI_IDS \
+	{0x1039, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1039, 0x5300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1039, 0x6300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1039, 0x7300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define tdfx_PCI_IDS \
+	{0x121a, 0x0003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x121a, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x121a, 0x0005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x121a, 0x0007, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x121a, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x121a, 0x000b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define viadrv_PCI_IDS \
+	{0x1106, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1106, 0x3122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x1106, 0x7204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define i810_PCI_IDS \
+	{0x8086, 0x7121, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x8086, 0x7123, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x8086, 0x7125, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x8086, 0x1132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define i830_PCI_IDS \
+	{0x8086, 0x3577, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x8086, 0x2562, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x8086, 0x3582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x8086, 0x2572, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define gamma_PCI_IDS \
+	{0x3d3d, 0x0008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define savage_PCI_IDS \
+	{0x5333, 0x8a22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8a23, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c11, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c13, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c24, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c2a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c2b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c2c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8c2f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8a25, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8d01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8d02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0x5333, 0x8d04, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+	{0, 0, 0}
+
+#define ffb_PCI_IDS \
+	{0, 0, 0}
+
diff -Nru a/drivers/char/drm/drm_sarea.h b/drivers/char/drm/drm_sarea.h
--- a/drivers/char/drm/drm_sarea.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/drm/drm_sarea.h	Tue Jun 15 22:21:05 2004
@@ -32,8 +32,22 @@
 #ifndef _DRM_SAREA_H_
 #define _DRM_SAREA_H_
 
+#include "drm.h"
+
+/* SAREA area needs to be at least a page */
+#if defined(__alpha__)
+#define SAREA_MAX                       0x2000
+#elif defined(__ia64__)
+#define SAREA_MAX                       0x10000         /* 64kB */
+#else
+/* Intel 830M driver needs at least 8k SAREA */
+#define SAREA_MAX                       0x2000
+#endif
+
 /** Maximum number of drawables in the SAREA */
 #define SAREA_MAX_DRAWABLES 		256
+
+#define SAREA_DRAWABLE_CLAIMED_ENTRY    0x80000000
 
 /** SAREA drawable */
 typedef struct drm_sarea_drawable {
diff -Nru a/drivers/char/drm/drm_stub.h b/drivers/char/drm/drm_stub.h
--- a/drivers/char/drm/drm_stub.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/drm/drm_stub.h	Tue Jun 15 22:20:43 2004
@@ -209,8 +209,8 @@
 		ret2 = DRM(stub_info).info_register(name, fops, dev);
 		if (ret2) {
 			if (!ret1) {
-			unregister_chrdev(DRM_MAJOR, "drm");
-			class_simple_destroy(drm_class);
+				unregister_chrdev(DRM_MAJOR, "drm");
+				class_simple_destroy(drm_class);
 			}
 			if (!i)
 				inter_module_unregister("drm");
diff -Nru a/drivers/char/drm/drm_vm.h b/drivers/char/drm/drm_vm.h
--- a/drivers/char/drm/drm_vm.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/drm/drm_vm.h	Tue Jun 15 22:21:05 2004
@@ -35,48 +35,19 @@
 
 #include "drmP.h"
 
-/** AGP virtual memory operations */
-struct vm_operations_struct   DRM(vm_ops) = {
-	.nopage = DRM(vm_nopage),
-	.open	= DRM(vm_open),
-	.close	= DRM(vm_close),
-};
-
-/** Shared virtual memory operations */
-struct vm_operations_struct   DRM(vm_shm_ops) = {
-	.nopage = DRM(vm_shm_nopage),
-	.open	= DRM(vm_open),
-	.close	= DRM(vm_shm_close),
-};
-
-/** DMA virtual memory operations */
-struct vm_operations_struct   DRM(vm_dma_ops) = {
-	.nopage = DRM(vm_dma_nopage),
-	.open	= DRM(vm_open),
-	.close	= DRM(vm_close),
-};
-
-/** Scatter-gather virtual memory operations */
-struct vm_operations_struct   DRM(vm_sg_ops) = {
-	.nopage = DRM(vm_sg_nopage),
-	.open   = DRM(vm_open),
-	.close  = DRM(vm_close),
-};
 
 /**
  * \c nopage method for AGP virtual memory.
  *
  * \param vma virtual memory area.
  * \param address access address.
- * \param write_access sharing.
  * \return pointer to the page structure.
  * 
  * Find the right map and if it's AGP memory find the real physical page to
  * map, get the page, increment the use count and return it.
  */
-struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
-			    unsigned long address,
-			    int *type)
+static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma,
+						 unsigned long address)
 {
 #if __REALLY_HAVE_AGP
 	drm_file_t *priv  = vma->vm_file->private_data;
@@ -131,10 +102,8 @@
 
 		DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n",
 			  baddr, __va(agpmem->memory->memory[offset]), offset,
-			  atomic_read(&page->count));
+			  page_count(page));
 
-		if (type)
-			*type = VM_FAULT_MINOR;
 		return page;
         }
 vm_nopage_error:
@@ -148,15 +117,13 @@
  *
  * \param vma virtual memory area.
  * \param address access address.
- * \param write_access sharing.
  * \return pointer to the page structure.
  * 
  * Get the the mapping, find the real physical page to map, get the page, and
  * return it.
  */
-struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
-				unsigned long address,
-				int *type)
+static __inline__ struct page *DRM(do_vm_shm_nopage)(struct vm_area_struct *vma,
+						     unsigned long address)
 {
 	drm_map_t	 *map	 = (drm_map_t *)vma->vm_private_data;
 	unsigned long	 offset;
@@ -172,8 +139,6 @@
 	if (!page)
 		return NOPAGE_OOM;
 	get_page(page);
-	if (type)
-		*type = VM_FAULT_MINOR;
 
 	DRM_DEBUG("shm_nopage 0x%lx\n", address);
 	return page;
@@ -265,14 +230,12 @@
  *
  * \param vma virtual memory area.
  * \param address access address.
- * \param write_access sharing.
  * \return pointer to the page structure.
  * 
  * Determine the page number from the page offset and get it from drm_device_dma::pagelist.
  */
-struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
-				unsigned long address,
-				int *type)
+static __inline__ struct page *DRM(do_vm_dma_nopage)(struct vm_area_struct *vma,
+						     unsigned long address)
 {
 	drm_file_t	 *priv	 = vma->vm_file->private_data;
 	drm_device_t	 *dev	 = priv->dev;
@@ -291,8 +254,6 @@
 			     (offset & (~PAGE_MASK))));
 
 	get_page(page);
-	if (type)
-		*type = VM_FAULT_MINOR;
 
 	DRM_DEBUG("dma_nopage 0x%lx (page %lu)\n", address, page_nr);
 	return page;
@@ -303,14 +264,12 @@
  *
  * \param vma virtual memory area.
  * \param address access address.
- * \param write_access sharing.
  * \return pointer to the page structure.
  * 
  * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist.
  */
-struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
-			       unsigned long address,
-			       int *type)
+static __inline__ struct page *DRM(do_vm_sg_nopage)(struct vm_area_struct *vma,
+						    unsigned long address)
 {
 	drm_map_t        *map    = (drm_map_t *)vma->vm_private_data;
 	drm_file_t *priv = vma->vm_file->private_data;
@@ -331,11 +290,98 @@
 	page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
 	page = entry->pagelist[page_offset];
 	get_page(page);
-	if (type)
-		*type = VM_FAULT_MINOR;
 
 	return page;
 }
+
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
+
+static struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
+				   unsigned long address,
+				   int *type) {
+	if (type) *type = VM_FAULT_MINOR;
+	return DRM(do_vm_nopage)(vma, address);
+}
+
+static struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
+				       unsigned long address,
+				       int *type) {
+	if (type) *type = VM_FAULT_MINOR;
+	return DRM(do_vm_shm_nopage)(vma, address);
+}
+
+static struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
+				       unsigned long address,
+				       int *type) {
+	if (type) *type = VM_FAULT_MINOR;
+	return DRM(do_vm_dma_nopage)(vma, address);
+}
+
+static struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
+				      unsigned long address,
+				      int *type) {
+	if (type) *type = VM_FAULT_MINOR;
+	return DRM(do_vm_sg_nopage)(vma, address);
+}
+
+#else	/* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */
+
+static struct page *DRM(vm_nopage)(struct vm_area_struct *vma,
+				   unsigned long address,
+				   int unused) {
+	return DRM(do_vm_nopage)(vma, address);
+}
+
+static struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
+				       unsigned long address,
+				       int unused) {
+	return DRM(do_vm_shm_nopage)(vma, address);
+}
+
+static struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
+				       unsigned long address,
+				       int unused) {
+	return DRM(do_vm_dma_nopage)(vma, address);
+}
+
+static struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
+				      unsigned long address,
+				      int unused) {
+	return DRM(do_vm_sg_nopage)(vma, address);
+}
+
+#endif
+
+
+/** AGP virtual memory operations */
+static struct vm_operations_struct   DRM(vm_ops) = {
+	.nopage = DRM(vm_nopage),
+	.open	= DRM(vm_open),
+	.close	= DRM(vm_close),
+};
+
+/** Shared virtual memory operations */
+static struct vm_operations_struct   DRM(vm_shm_ops) = {
+	.nopage = DRM(vm_shm_nopage),
+	.open	= DRM(vm_open),
+	.close	= DRM(vm_shm_close),
+};
+
+/** DMA virtual memory operations */
+static struct vm_operations_struct   DRM(vm_dma_ops) = {
+	.nopage = DRM(vm_dma_nopage),
+	.open	= DRM(vm_open),
+	.close	= DRM(vm_close),
+};
+
+/** Scatter-gather virtual memory operations */
+static struct vm_operations_struct   DRM(vm_sg_ops) = {
+	.nopage = DRM(vm_sg_nopage),
+	.open   = DRM(vm_open),
+	.close  = DRM(vm_close),
+};
+
 
 /**
  * \c open method for shared virtual memory.
diff -Nru a/drivers/char/drm/ffb.h b/drivers/char/drm/ffb.h
--- a/drivers/char/drm/ffb.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/char/drm/ffb.h	Tue Jun 15 22:20:41 2004
@@ -13,3 +13,4 @@
 #define __HAVE_KERNEL_CTX_SWITCH	1
 #define __HAVE_RELEASE			1
 #endif
+
diff -Nru a/drivers/char/drm/gamma.h b/drivers/char/drm/gamma.h
--- a/drivers/char/drm/gamma.h	Tue Jun 15 22:20:35 2004
+++ b/drivers/char/drm/gamma.h	Tue Jun 15 22:20:35 2004
@@ -104,8 +104,8 @@
 	return 0;							\
 } while (0)
 
-#define __HAVE_DMA_IRQ			1
-#define __HAVE_DMA_IRQ_BH		1
+#define __HAVE_IRQ			1
+#define __HAVE_IRQ_BH			1
 
 #define DRIVER_AGP_BUFFERS_MAP( dev )					\
 	((drm_gamma_private_t *)((dev)->dev_private))->buffers
diff -Nru a/drivers/char/drm/gamma_dma.c b/drivers/char/drm/gamma_dma.c
--- a/drivers/char/drm/gamma_dma.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/char/drm/gamma_dma.c	Tue Jun 15 22:21:02 2004
@@ -116,7 +116,7 @@
 	return (!GAMMA_READ(GAMMA_DMACOUNT));
 }
 
-irqreturn_t gamma_dma_service( DRM_IRQ_ARGS )
+irqreturn_t gamma_irq_handler( DRM_IRQ_ARGS )
 {
 	drm_device_t	 *dev = (drm_device_t *)arg;
 	drm_device_dma_t *dma = dev->dma;
@@ -262,7 +262,7 @@
 	gamma_dma_schedule((drm_device_t *)dev, 0);
 }
 
-void gamma_dma_immediate_bh(void *dev)
+void gamma_irq_immediate_bh(void *dev)
 {
 	gamma_dma_schedule(dev, 0);
 }
@@ -346,6 +346,9 @@
 	drm_buf_t	  *buf;
 	drm_buf_t	  *last_buf = NULL;
 	drm_device_dma_t  *dma	    = dev->dma;
+	int		  *send_indices = NULL;
+	int		  *send_sizes = NULL;
+
 	DECLARE_WAITQUEUE(entry, current);
 
 				/* Turn off interrupt handling */
@@ -365,11 +368,31 @@
 		++must_free;
 	}
 
+	send_indices = DRM(alloc)(d->send_count * sizeof(*send_indices),
+				  DRM_MEM_DRIVER);
+	if (send_indices == NULL)
+		return -ENOMEM;
+	if (copy_from_user(send_indices, d->send_indices, 
+			   d->send_count * sizeof(*send_indices))) {
+		retcode = -EFAULT;
+                goto cleanup;
+	}
+	
+	send_sizes = DRM(alloc)(d->send_count * sizeof(*send_sizes),
+				DRM_MEM_DRIVER);
+	if (send_sizes == NULL)
+		return -ENOMEM;
+	if (copy_from_user(send_sizes, d->send_sizes, 
+			   d->send_count * sizeof(*send_sizes))) {
+		retcode = -EFAULT;
+                goto cleanup;
+	}
+
 	for (i = 0; i < d->send_count; i++) {
-		idx = d->send_indices[i];
+		idx = send_indices[i];
 		if (idx < 0 || idx >= dma->buf_count) {
 			DRM_ERROR("Index %d (of %d max)\n",
-				  d->send_indices[i], dma->buf_count - 1);
+				  send_indices[i], dma->buf_count - 1);
 			continue;
 		}
 		buf = dma->buflist[ idx ];
@@ -391,7 +414,7 @@
 				   process closes the /dev/drm? handle, so
 				   it can't also be doing DMA. */
 		buf->list	  = DRM_LIST_PRIO;
-		buf->used	  = d->send_sizes[i];
+		buf->used	  = send_sizes[i];
 		buf->context	  = d->context;
 		buf->while_locked = d->flags & _DRM_DMA_WHILE_LOCKED;
 		address		  = (unsigned long)buf->address;
@@ -402,14 +425,14 @@
 		if (buf->pending) {
 			DRM_ERROR("Sending pending buffer:"
 				  " buffer %d, offset %d\n",
-				  d->send_indices[i], i);
+				  send_indices[i], i);
 			retcode = -EINVAL;
 			goto cleanup;
 		}
 		if (buf->waiting) {
 			DRM_ERROR("Sending waiting buffer:"
 				  " buffer %d, offset %d\n",
-				  d->send_indices[i], i);
+				  send_indices[i], i);
 			retcode = -EINVAL;
 			goto cleanup;
 		}
@@ -458,6 +481,12 @@
 		gamma_dma_ready(dev);
 		gamma_free_buffer(dev, last_buf);
 	}
+	if (send_indices)
+		DRM(free)(send_indices, d->send_count * sizeof(*send_indices), 
+			  DRM_MEM_DRIVER);
+	if (send_sizes)
+		DRM(free)(send_sizes, d->send_count * sizeof(*send_sizes), 
+			  DRM_MEM_DRIVER);
 
 	if (must_free && !dev->context_flag) {
 		if (gamma_lock_free(dev, &dev->lock.hw_lock->lock,
@@ -476,9 +505,13 @@
 	drm_buf_t	  *last_buf = NULL;
 	int		  retcode   = 0;
 	drm_device_dma_t  *dma	    = dev->dma;
+	int               send_index;
+
+	if (get_user(send_index, &d->send_indices[d->send_count-1]))
+		return -EFAULT;
 
 	if (d->flags & _DRM_DMA_BLOCK) {
-		last_buf = dma->buflist[d->send_indices[d->send_count-1]];
+		last_buf = dma->buflist[send_index];
 		add_wait_queue(&last_buf->dma_wait, &entry);
 	}
 
@@ -656,12 +689,12 @@
 {
 	DRM_DEBUG( "%s\n", __FUNCTION__ );
 
-#if _HAVE_DMA_IRQ
+#if __HAVE_IRQ
 	/* Make sure interrupts are disabled here because the uninstall ioctl
 	 * may not have been called from userspace and after dev_private
 	 * is freed, it's too late.
 	 */
-	if ( dev->irq ) DRM(irq_uninstall)(dev);
+	if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
 #endif
 
 	if ( dev->dev_private ) {
diff -Nru a/drivers/char/drm/gamma_drv.c b/drivers/char/drm/gamma_drv.c
--- a/drivers/char/drm/gamma_drv.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/char/drm/gamma_drv.c	Tue Jun 15 22:20:58 2004
@@ -48,6 +48,7 @@
 #include "drm_fops.h"
 #include "drm_init.h"
 #include "drm_ioctl.h"
+#include "drm_irq.h"
 #include "gamma_lists.h"        /* NOTE */
 #include "drm_lock.h"
 #include "gamma_lock.h"		/* NOTE */
diff -Nru a/drivers/char/drm/i810.h b/drivers/char/drm/i810.h
--- a/drivers/char/drm/i810.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/drm/i810.h	Tue Jun 15 22:20:38 2004
@@ -77,7 +77,6 @@
 	[DRM_IOCTL_NR(DRM_IOCTL_I810_MC)]      = { i810_dma_mc,     1, 1 }, \
 	[DRM_IOCTL_NR(DRM_IOCTL_I810_RSTATUS)] = { i810_rstatus,    1, 0 }, \
 	[DRM_IOCTL_NR(DRM_IOCTL_I810_FLIP)] =    { i810_flip_bufs,  1, 0 }
- 
 
 #define __HAVE_COUNTERS         4
 #define __HAVE_COUNTER6         _DRM_STAT_IRQ
@@ -112,7 +111,7 @@
  * a noop stub is generated for compatibility.
  */
 /* XXX: Add vblank support? */
-#define __HAVE_DMA_IRQ		0
+#define __HAVE_IRQ		0
 
 /* Buffer customization:
  */
diff -Nru a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
--- a/drivers/char/drm/i810_dma.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/char/drm/i810_dma.c	Tue Jun 15 22:20:39 2004
@@ -232,12 +232,12 @@
 {
 	drm_device_dma_t *dma = dev->dma;
 
-#if _HAVE_DMA_IRQ
+#if __HAVE_IRQ
 	/* Make sure interrupts are disabled here because the uninstall ioctl
 	 * may not have been called from userspace and after dev_private
 	 * is freed, it's too late.
 	 */
-	if (dev->irq) DRM(irq_uninstall)(dev);
+	if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
 #endif
 
 	if (dev->dev_private) {
diff -Nru a/drivers/char/drm/i830.h b/drivers/char/drm/i830.h
--- a/drivers/char/drm/i830.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/drm/i830.h	Tue Jun 15 22:20:38 2004
@@ -115,10 +115,10 @@
 #define USE_IRQS 0
 
 #if USE_IRQS
-#define __HAVE_DMA_IRQ		1
+#define __HAVE_IRQ		1
 #define __HAVE_SHARED_IRQ	1
 #else
-#define __HAVE_DMA_IRQ          0
+#define __HAVE_IRQ          0
 #endif
 
 
diff -Nru a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
--- a/drivers/char/drm/i830_dma.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/char/drm/i830_dma.c	Tue Jun 15 22:20:36 2004
@@ -232,12 +232,12 @@
 {
 	drm_device_dma_t *dma = dev->dma;
 
-#if _HAVE_DMA_IRQ
+#if __HAVE_IRQ
 	/* Make sure interrupts are disabled here because the uninstall ioctl
 	 * may not have been called from userspace and after dev_private
 	 * is freed, it's too late.
 	 */
-	if (dev->irq) DRM(irq_uninstall)(dev);
+	if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
 #endif
 
 	if (dev->dev_private) {
@@ -1540,7 +1540,7 @@
 
 	switch( param.param ) {
 	case I830_PARAM_IRQ_ACTIVE:
-		value = dev->irq ? 1 : 0;
+		value = dev->irq_enabled;
 		break;
 	default:
 		return -EINVAL;
diff -Nru a/drivers/char/drm/i830_drv.c b/drivers/char/drm/i830_drv.c
--- a/drivers/char/drm/i830_drv.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/drm/i830_drv.c	Tue Jun 15 22:20:38 2004
@@ -50,6 +50,7 @@
 #include "drm_fops.h"
 #include "drm_init.h"
 #include "drm_ioctl.h"
+#include "drm_irq.h"
 #include "drm_lock.h"
 #include "drm_memory.h"
 #include "drm_proc.h"
diff -Nru a/drivers/char/drm/i830_irq.c b/drivers/char/drm/i830_irq.c
--- a/drivers/char/drm/i830_irq.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/drm/i830_irq.c	Tue Jun 15 22:20:43 2004
@@ -35,7 +35,7 @@
 #include <linux/delay.h>
 
 
-irqreturn_t DRM(dma_service)( DRM_IRQ_ARGS )
+irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS )
 {
 	drm_device_t	 *dev = (drm_device_t *)arg;
       	drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
diff -Nru a/drivers/char/drm/mga.h b/drivers/char/drm/mga.h
--- a/drivers/char/drm/mga.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/drm/mga.h	Tue Jun 15 22:21:05 2004
@@ -78,7 +78,7 @@
 /* DMA customization:
  */
 #define __HAVE_DMA		1
-#define __HAVE_DMA_IRQ		1
+#define __HAVE_IRQ		1
 #define __HAVE_VBL_IRQ		1
 #define __HAVE_SHARED_IRQ       1
 
diff -Nru a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c
--- a/drivers/char/drm/mga_dma.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/char/drm/mga_dma.c	Tue Jun 15 22:20:44 2004
@@ -500,14 +500,6 @@
 		return DRM_ERR(EINVAL);
 	}
 
-	DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
-	if(!dev_priv->fb) {
-		DRM_ERROR( "failed to find framebuffer!\n" );
-		/* Assign dev_private so we can do cleanup. */
-		dev->dev_private = (void *)dev_priv;
-		mga_do_cleanup_dma( dev );
-		return DRM_ERR(EINVAL);
-	}
 	DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
 	if(!dev_priv->mmio) {
 		DRM_ERROR( "failed to find mmio region!\n" );
@@ -639,12 +631,12 @@
 {
 	DRM_DEBUG( "\n" );
 
-#if _HAVE_DMA_IRQ
+#if __HAVE_IRQ
 	/* Make sure interrupts are disabled here because the uninstall ioctl
 	 * may not have been called from userspace and after dev_private
 	 * is freed, it's too late.
 	 */
-	if ( dev->irq ) DRM(irq_uninstall)(dev);
+	if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
 #endif
 
 	if ( dev->dev_private ) {
diff -Nru a/drivers/char/drm/mga_drm.h b/drivers/char/drm/mga_drm.h
--- a/drivers/char/drm/mga_drm.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/drm/mga_drm.h	Tue Jun 15 22:20:43 2004
@@ -117,6 +117,8 @@
 #define MGA_NR_TEX_REGIONS		16
 #define MGA_LOG_MIN_TEX_REGION_SIZE	16
 
+#define  DRM_MGA_IDLE_RETRY          2048
+
 #endif /* __MGA_SAREA_DEFINES__ */
 
 
@@ -230,16 +232,27 @@
 /* MGA specific ioctls
  * The device specific ioctl range is 0x40 to 0x79.
  */
-#define DRM_IOCTL_MGA_INIT		DRM_IOW( 0x40, drm_mga_init_t)
-#define DRM_IOCTL_MGA_FLUSH		DRM_IOW( 0x41, drm_lock_t)
-#define DRM_IOCTL_MGA_RESET		DRM_IO(  0x42)
-#define DRM_IOCTL_MGA_SWAP		DRM_IO(  0x43)
-#define DRM_IOCTL_MGA_CLEAR		DRM_IOW( 0x44, drm_mga_clear_t)
-#define DRM_IOCTL_MGA_VERTEX		DRM_IOW( 0x45, drm_mga_vertex_t)
-#define DRM_IOCTL_MGA_INDICES		DRM_IOW( 0x46, drm_mga_indices_t)
-#define DRM_IOCTL_MGA_ILOAD		DRM_IOW( 0x47, drm_mga_iload_t)
-#define DRM_IOCTL_MGA_BLIT		DRM_IOW( 0x48, drm_mga_blit_t)
-#define DRM_IOCTL_MGA_GETPARAM		DRM_IOWR(0x49, drm_mga_getparam_t)
+#define DRM_MGA_INIT     0x00
+#define DRM_MGA_FLUSH    0x01
+#define DRM_MGA_RESET    0x02
+#define DRM_MGA_SWAP     0x03
+#define DRM_MGA_CLEAR    0x04
+#define DRM_MGA_VERTEX   0x05
+#define DRM_MGA_INDICES  0x06
+#define DRM_MGA_ILOAD    0x07
+#define DRM_MGA_BLIT     0x08
+#define DRM_MGA_GETPARAM 0x09
+
+#define DRM_IOCTL_MGA_INIT     DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t)
+#define DRM_IOCTL_MGA_FLUSH    DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, drm_lock_t)
+#define DRM_IOCTL_MGA_RESET    DRM_IO(  DRM_COMMAND_BASE + DRM_MGA_RESET)
+#define DRM_IOCTL_MGA_SWAP     DRM_IO(  DRM_COMMAND_BASE + DRM_MGA_SWAP)
+#define DRM_IOCTL_MGA_CLEAR    DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t)
+#define DRM_IOCTL_MGA_VERTEX   DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_VERTEX, drm_mga_vertex_t)
+#define DRM_IOCTL_MGA_INDICES  DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INDICES, drm_mga_indices_t)
+#define DRM_IOCTL_MGA_ILOAD    DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t)
+#define DRM_IOCTL_MGA_BLIT     DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t)
+#define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t)
 
 typedef struct _drm_mga_warp_index {
    	int installed;
@@ -330,7 +343,7 @@
 
 typedef struct drm_mga_getparam {
 	int param;
-	int *value;
+	void *value;
 } drm_mga_getparam_t;
 
 #endif
diff -Nru a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
--- a/drivers/char/drm/mga_drv.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/drm/mga_drv.c	Tue Jun 15 22:20:40 2004
@@ -45,6 +45,7 @@
 #include "drm_fops.h"
 #include "drm_init.h"
 #include "drm_ioctl.h"
+#include "drm_irq.h"
 #include "drm_lock.h"
 #include "drm_memory.h"
 #include "drm_proc.h"
diff -Nru a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h
--- a/drivers/char/drm/mga_drv.h	Tue Jun 15 22:20:58 2004
+++ b/drivers/char/drm/mga_drv.h	Tue Jun 15 22:20:58 2004
@@ -91,7 +91,6 @@
 	unsigned int texture_size;
 
 	drm_local_map_t *sarea;
-	drm_local_map_t *fb;
 	drm_local_map_t *mmio;
 	drm_local_map_t *status;
 	drm_local_map_t *warp;
diff -Nru a/drivers/char/drm/mga_irq.c b/drivers/char/drm/mga_irq.c
--- a/drivers/char/drm/mga_irq.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/char/drm/mga_irq.c	Tue Jun 15 22:20:35 2004
@@ -36,7 +36,7 @@
 #include "mga_drm.h"
 #include "mga_drv.h"
 
-irqreturn_t mga_dma_service( DRM_IRQ_ARGS )
+irqreturn_t mga_irq_handler( DRM_IRQ_ARGS )
 {
 	drm_device_t *dev = (drm_device_t *) arg;
 	drm_mga_private_t *dev_priv = 
diff -Nru a/drivers/char/drm/r128.h b/drivers/char/drm/r128.h
--- a/drivers/char/drm/r128.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/char/drm/r128.h	Tue Jun 15 22:20:39 2004
@@ -97,7 +97,7 @@
 /* DMA customization:
  */
 #define __HAVE_DMA		1
-#define __HAVE_DMA_IRQ		1
+#define __HAVE_IRQ		1
 #define __HAVE_VBL_IRQ		1
 #define __HAVE_SHARED_IRQ       1
 
diff -Nru a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c
--- a/drivers/char/drm/r128_cce.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/drm/r128_cce.c	Tue Jun 15 22:20:37 2004
@@ -212,7 +212,7 @@
 	int i;
 
 	for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
-		if ( GET_RING_HEAD( &dev_priv->ring ) == dev_priv->ring.tail ) {
+		if ( GET_RING_HEAD( dev_priv ) == dev_priv->ring.tail ) {
 			int pm4stat = R128_READ( R128_PM4_STAT );
 			if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >=
 			       dev_priv->cce_fifo_size ) &&
@@ -238,7 +238,8 @@
 	r128_do_wait_for_idle( dev_priv );
 
 	R128_WRITE( R128_PM4_BUFFER_CNTL,
-		    dev_priv->cce_mode | dev_priv->ring.size_l2qw );
+		    dev_priv->cce_mode | dev_priv->ring.size_l2qw
+		    | R128_PM4_BUFFER_CNTL_NOUPDATE );
 	R128_READ( R128_PM4_BUFFER_ADDR ); /* as per the sample code */
 	R128_WRITE( R128_PM4_MICRO_CNTL, R128_PM4_MICRO_FREERUN );
 
@@ -253,7 +254,6 @@
 {
 	R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 );
 	R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 );
-	SET_RING_HEAD( &dev_priv->ring, 0 );
 	dev_priv->ring.tail = 0;
 }
 
@@ -264,7 +264,8 @@
 static void r128_do_cce_stop( drm_r128_private_t *dev_priv )
 {
 	R128_WRITE( R128_PM4_MICRO_CNTL, 0 );
-	R128_WRITE( R128_PM4_BUFFER_CNTL, R128_PM4_NONPM4 );
+	R128_WRITE( R128_PM4_BUFFER_CNTL,
+		    R128_PM4_NONPM4 | R128_PM4_BUFFER_CNTL_NOUPDATE );
 
 	dev_priv->cce_running = 0;
 }
@@ -333,26 +334,6 @@
 	R128_WRITE( R128_PM4_BUFFER_DL_WPTR, 0 );
 	R128_WRITE( R128_PM4_BUFFER_DL_RPTR, 0 );
 
-	/* DL_RPTR_ADDR is a physical address in AGP space. */
-	SET_RING_HEAD( &dev_priv->ring, 0 );
-
-	if ( !dev_priv->is_pci ) {
-		R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR,
-			    dev_priv->ring_rptr->offset );
-	} else {
-		drm_sg_mem_t *entry = dev->sg;
-		unsigned long tmp_ofs, page_ofs;
-
-		tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle;
-		page_ofs = tmp_ofs >> PAGE_SHIFT;
-
-		R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR,
-     			    entry->busaddr[page_ofs]);
-		DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n",
-			   (unsigned long) entry->busaddr[page_ofs],
-     			   entry->handle + tmp_ofs );
-	}
-
 	/* Set watermark control */
 	R128_WRITE( R128_PM4_BUFFER_WM_CNTL,
 		    ((R128_WATERMARK_L/4) << R128_WMA_SHIFT)
@@ -486,13 +467,6 @@
 		return DRM_ERR(EINVAL);
 	}
 
-	DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
-	if(!dev_priv->fb) {
-		DRM_ERROR("could not find framebuffer!\n");
-		dev->dev_private = (void *)dev_priv;
-		r128_do_cleanup_cce( dev );
-		return DRM_ERR(EINVAL);
-	}
 	DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
 	if(!dev_priv->mmio) {
 		DRM_ERROR("could not find mmio region!\n");
@@ -567,9 +541,6 @@
 #endif
 		dev_priv->cce_buffers_offset = dev->sg->handle;
 
-	dev_priv->ring.head = ((__volatile__ u32 *)
-			       dev_priv->ring_rptr->handle);
-
 	dev_priv->ring.start = (u32 *)dev_priv->cce_ring->handle;
 	dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle
 			      + init->ring_size / sizeof(u32));
@@ -580,7 +551,6 @@
 		(dev_priv->ring.size / sizeof(u32)) - 1;
 
 	dev_priv->ring.high_mark = 128;
-	dev_priv->ring.ring_rptr = dev_priv->ring_rptr;
 
 	dev_priv->sarea_priv->last_frame = 0;
 	R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame );
@@ -589,8 +559,9 @@
 	R128_WRITE( R128_LAST_DISPATCH_REG,
 		    dev_priv->sarea_priv->last_dispatch );
 
-#if __REALLY_HAVE_SG
+#if __REALLY_HAVE_AGP
 	if ( dev_priv->is_pci ) {
+#endif
 		if (!DRM(ati_pcigart_init)( dev, &dev_priv->phys_pci_gart,
      					    &dev_priv->bus_pci_gart) ) {
 			DRM_ERROR( "failed to init PCI GART!\n" );
@@ -599,6 +570,7 @@
 			return DRM_ERR(ENOMEM);
 		}
 		R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart );
+#if __REALLY_HAVE_AGP
 	}
 #endif
 
@@ -615,12 +587,12 @@
 int r128_do_cleanup_cce( drm_device_t *dev )
 {
 
-#if _HAVE_DMA_IRQ
+#if __HAVE_IRQ
 	/* Make sure interrupts are disabled here because the uninstall ioctl
 	 * may not have been called from userspace and after dev_private
 	 * is freed, it's too late.
 	 */
-	if ( dev->irq ) DRM(irq_uninstall)(dev);
+	if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
 #endif
 
 	if ( dev->dev_private ) {
@@ -901,7 +873,7 @@
 	int i;
 
 	for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
-		r128_update_ring_snapshot( ring );
+		r128_update_ring_snapshot( dev_priv );
 		if ( ring->space >= n )
 			return 0;
 		DRM_UDELAY( 1 );
diff -Nru a/drivers/char/drm/r128_drm.h b/drivers/char/drm/r128_drm.h
--- a/drivers/char/drm/r128_drm.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/drm/r128_drm.h	Tue Jun 15 22:20:42 2004
@@ -176,24 +176,47 @@
 /* Rage 128 specific ioctls
  * The device specific ioctl range is 0x40 to 0x79.
  */
-#define DRM_IOCTL_R128_INIT		DRM_IOW( 0x40, drm_r128_init_t)
-#define DRM_IOCTL_R128_CCE_START	DRM_IO(  0x41)
-#define DRM_IOCTL_R128_CCE_STOP		DRM_IOW( 0x42, drm_r128_cce_stop_t)
-#define DRM_IOCTL_R128_CCE_RESET	DRM_IO(  0x43)
-#define DRM_IOCTL_R128_CCE_IDLE		DRM_IO(  0x44)
-#define DRM_IOCTL_R128_RESET		DRM_IO(  0x46)
-#define DRM_IOCTL_R128_SWAP		DRM_IO(  0x47)
-#define DRM_IOCTL_R128_CLEAR		DRM_IOW( 0x48, drm_r128_clear_t)
-#define DRM_IOCTL_R128_VERTEX		DRM_IOW( 0x49, drm_r128_vertex_t)
-#define DRM_IOCTL_R128_INDICES		DRM_IOW( 0x4a, drm_r128_indices_t)
-#define DRM_IOCTL_R128_BLIT		DRM_IOW( 0x4b, drm_r128_blit_t)
-#define DRM_IOCTL_R128_DEPTH		DRM_IOW( 0x4c, drm_r128_depth_t)
-#define DRM_IOCTL_R128_STIPPLE		DRM_IOW( 0x4d, drm_r128_stipple_t)
-#define DRM_IOCTL_R128_INDIRECT		DRM_IOWR(0x4f, drm_r128_indirect_t)
-#define DRM_IOCTL_R128_FULLSCREEN	DRM_IOW( 0x50, drm_r128_fullscreen_t)
-#define DRM_IOCTL_R128_CLEAR2		DRM_IOW( 0x51, drm_r128_clear2_t)
-#define DRM_IOCTL_R128_GETPARAM		DRM_IOW( 0x52, drm_r128_getparam_t)
-#define DRM_IOCTL_R128_FLIP		DRM_IO(  0x53)
+#define DRM_R128_INIT       0x00
+#define DRM_R128_CCE_START  0x01
+#define DRM_R128_CCE_STOP   0x02
+#define DRM_R128_CCE_RESET  0x03
+#define DRM_R128_CCE_IDLE   0x04
+/* 0x05 not used */
+#define DRM_R128_RESET      0x06
+#define DRM_R128_SWAP       0x07
+#define DRM_R128_CLEAR      0x08
+#define DRM_R128_VERTEX     0x09
+#define DRM_R128_INDICES    0x0a
+#define DRM_R128_BLIT       0x0b
+#define DRM_R128_DEPTH      0x0c
+#define DRM_R128_STIPPLE    0x0d
+/* 0x0e not used */
+#define DRM_R128_INDIRECT   0x0f
+#define DRM_R128_FULLSCREEN 0x10
+#define DRM_R128_CLEAR2     0x11
+#define DRM_R128_GETPARAM   0x12
+#define DRM_R128_FLIP       0x13
+
+#define DRM_IOCTL_R128_INIT       DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INIT, drm_r128_init_t)
+#define DRM_IOCTL_R128_CCE_START  DRM_IO(  DRM_COMMAND_BASE + DRM_R128_CCE_START)
+#define DRM_IOCTL_R128_CCE_STOP   DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CCE_STOP, drm_r128_cce_stop_t)
+#define DRM_IOCTL_R128_CCE_RESET  DRM_IO(  DRM_COMMAND_BASE + DRM_R128_CCE_RESET)
+#define DRM_IOCTL_R128_CCE_IDLE   DRM_IO(  DRM_COMMAND_BASE + DRM_R128_CCE_IDLE)
+/* 0x05 not used */
+#define DRM_IOCTL_R128_RESET      DRM_IO(  DRM_COMMAND_BASE + DRM_R128_RESET)
+#define DRM_IOCTL_R128_SWAP       DRM_IO(  DRM_COMMAND_BASE + DRM_R128_SWAP)
+#define DRM_IOCTL_R128_CLEAR      DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR, drm_r128_clear_t)
+#define DRM_IOCTL_R128_VERTEX     DRM_IOW( DRM_COMMAND_BASE + DRM_R128_VERTEX, drm_r128_vertex_t)
+#define DRM_IOCTL_R128_INDICES    DRM_IOW( DRM_COMMAND_BASE + DRM_R128_INDICES, drm_r128_indices_t)
+#define DRM_IOCTL_R128_BLIT       DRM_IOW( DRM_COMMAND_BASE + DRM_R128_BLIT, drm_r128_blit_t)
+#define DRM_IOCTL_R128_DEPTH      DRM_IOW( DRM_COMMAND_BASE + DRM_R128_DEPTH, drm_r128_depth_t)
+#define DRM_IOCTL_R128_STIPPLE    DRM_IOW( DRM_COMMAND_BASE + DRM_R128_STIPPLE, drm_r128_stipple_t)
+/* 0x0e not used */
+#define DRM_IOCTL_R128_INDIRECT   DRM_IOWR(DRM_COMMAND_BASE + DRM_R128_INDIRECT, drm_r128_indirect_t)
+#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_R128_FULLSCREEN, drm_r128_fullscreen_t)
+#define DRM_IOCTL_R128_CLEAR2     DRM_IOW( DRM_COMMAND_BASE + DRM_R128_CLEAR2, drm_r128_clear2_t)
+#define DRM_IOCTL_R128_GETPARAM   DRM_IOW( DRM_COMMAND_BASE + DRM_R128_GETPARAM, drm_r128_getparam_t)
+#define DRM_IOCTL_R128_FLIP       DRM_IO(  DRM_COMMAND_BASE + DRM_R128_FLIP)
 
 typedef struct drm_r128_init {
 	enum {
@@ -316,7 +339,7 @@
 
 typedef struct drm_r128_getparam {
 	int param;
-	int *value;
+	void *value;
 } drm_r128_getparam_t;
 
 #endif
diff -Nru a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c
--- a/drivers/char/drm/r128_drv.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/drm/r128_drv.c	Tue Jun 15 22:20:38 2004
@@ -47,6 +47,7 @@
 #include "drm_fops.h"
 #include "drm_init.h"
 #include "drm_ioctl.h"
+#include "drm_irq.h"
 #include "drm_lock.h"
 #include "drm_memory.h"
 #include "drm_proc.h"
diff -Nru a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h
--- a/drivers/char/drm/r128_drv.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/drm/r128_drv.h	Tue Jun 15 22:21:05 2004
@@ -34,8 +34,7 @@
 #ifndef __R128_DRV_H__
 #define __R128_DRV_H__
 
-#define GET_RING_HEAD(ring)		DRM_READ32(  (ring)->ring_rptr, 0 ) /* (ring)->head */
-#define SET_RING_HEAD(ring,val)		DRM_WRITE32( (ring)->ring_rptr, 0, (val) ) /* (ring)->head */
+#define GET_RING_HEAD(dev_priv)		R128_READ( R128_PM4_BUFFER_DL_RPTR )
 
 typedef struct drm_r128_freelist {
    	unsigned int age;
@@ -50,13 +49,11 @@
 	int size;
 	int size_l2qw;
 
-	volatile u32 *head;
 	u32 tail;
 	u32 tail_mask;
 	int space;
 
 	int high_mark;
-	drm_local_map_t *ring_rptr;
 } drm_r128_ring_buffer_t;
 
 typedef struct drm_r128_private {
@@ -100,7 +97,6 @@
 	u32 span_pitch_offset_c;
 
 	drm_local_map_t *sarea;
-	drm_local_map_t *fb;
 	drm_local_map_t *mmio;
 	drm_local_map_t *cce_ring;
 	drm_local_map_t *ring_rptr;
@@ -132,14 +128,6 @@
 
 extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n );
 
-static __inline__ void
-r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring )
-{
-	ring->space = (GET_RING_HEAD( ring ) - ring->tail) * sizeof(u32);
-	if ( ring->space <= 0 )
-		ring->space += ring->size;
-}
-
 extern int r128_do_cce_idle( drm_r128_private_t *dev_priv );
 extern int r128_do_cleanup_cce( drm_device_t *dev );
 extern int r128_do_cleanup_pageflip( drm_device_t *dev );
@@ -279,6 +267,7 @@
 #	define R128_PM4_64PIO_64VCBM_64INDBM	(7  << 28)
 #	define R128_PM4_64BM_64VCBM_64INDBM	(8  << 28)
 #	define R128_PM4_64PIO_64VCPIO_64INDPIO	(15 << 28)
+#	define R128_PM4_BUFFER_CNTL_NOUPDATE	(1  << 27)
 
 #define R128_PM4_BUFFER_WM_CNTL		0x0708
 #	define R128_WMA_SHIFT			0
@@ -403,6 +392,15 @@
 					 (pkt) | ((n) << 16))
 
 
+static __inline__ void
+r128_update_ring_snapshot( drm_r128_private_t *dev_priv )
+{
+	drm_r128_ring_buffer_t *ring = &dev_priv->ring;
+	ring->space = (GET_RING_HEAD( dev_priv ) - ring->tail) * sizeof(u32);
+	if ( ring->space <= 0 )
+		ring->space += ring->size;
+}
+
 /* ================================================================
  * Misc helper macros
  */
@@ -412,7 +410,7 @@
 	drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i;		\
 	if ( ring->space < ring->high_mark ) {				\
 		for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {	\
-			r128_update_ring_snapshot( ring );		\
+			r128_update_ring_snapshot( dev_priv );		\
 			if ( ring->space >= ring->high_mark )		\
 				goto __ring_space_done;			\
 			DRM_UDELAY(1);				\
@@ -445,17 +443,10 @@
  * Ring control
  */
 
-#if defined(__powerpc__)
-#define r128_flush_write_combine()	(void) GET_RING_HEAD( &dev_priv->ring )
-#else
-#define r128_flush_write_combine()	DRM_WRITEMEMORYBARRIER()
-#endif
-
-
 #define R128_VERBOSE	0
 
 #define RING_LOCALS							\
-	int write; unsigned int tail_mask; volatile u32 *ring;
+	int write, _nr; unsigned int tail_mask; volatile u32 *ring;
 
 #define BEGIN_RING( n ) do {						\
 	if ( R128_VERBOSE ) {						\
@@ -463,9 +454,10 @@
 			   (n), __FUNCTION__ );				\
 	}								\
 	if ( dev_priv->ring.space <= (n) * sizeof(u32) ) {		\
+		COMMIT_RING();						\
 		r128_wait_ring( dev_priv, (n) * sizeof(u32) );		\
 	}								\
-	dev_priv->ring.space -= (n) * sizeof(u32);			\
+	_nr = n; dev_priv->ring.space -= (n) * sizeof(u32);		\
 	ring = dev_priv->ring.start;					\
 	write = dev_priv->ring.tail;					\
 	tail_mask = dev_priv->ring.tail_mask;				\
@@ -488,9 +480,23 @@
 			dev_priv->ring.start,				\
 			write * sizeof(u32) );				\
 	}								\
-	r128_flush_write_combine();					\
-	dev_priv->ring.tail = write;					\
-	R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write );			\
+	if (((dev_priv->ring.tail + _nr) & tail_mask) != write) {	\
+		DRM_ERROR( 						\
+			"ADVANCE_RING(): mismatch: nr: %x write: %x line: %d\n",	\
+			((dev_priv->ring.tail + _nr) & tail_mask),	\
+			write, __LINE__);				\
+	} else								\
+		dev_priv->ring.tail = write;				\
+} while (0)
+
+#define COMMIT_RING() do {						\
+	if ( R128_VERBOSE ) {						\
+		DRM_INFO( "COMMIT_RING() tail=0x%06x\n",		\
+			dev_priv->ring.tail );				\
+	}								\
+	DRM_MEMORYBARRIER();						\
+	R128_WRITE( R128_PM4_BUFFER_DL_WPTR, dev_priv->ring.tail );	\
+	R128_READ( R128_PM4_BUFFER_DL_WPTR );				\
 } while (0)
 
 #define OUT_RING( x ) do {						\
diff -Nru a/drivers/char/drm/r128_irq.c b/drivers/char/drm/r128_irq.c
--- a/drivers/char/drm/r128_irq.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/drm/r128_irq.c	Tue Jun 15 22:21:05 2004
@@ -36,7 +36,7 @@
 #include "r128_drm.h"
 #include "r128_drv.h"
 
-irqreturn_t r128_dma_service( DRM_IRQ_ARGS )
+irqreturn_t r128_irq_handler( DRM_IRQ_ARGS )
 {
 	drm_device_t *dev = (drm_device_t *) arg;
 	drm_r128_private_t *dev_priv = 
diff -Nru a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c
--- a/drivers/char/drm/r128_state.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/drm/r128_state.c	Tue Jun 15 22:20:37 2004
@@ -45,7 +45,7 @@
 	RING_LOCALS;
 	DRM_DEBUG( "    %s\n", __FUNCTION__ );
 
-	BEGIN_RING( 17 );
+	BEGIN_RING( (count < 3? count: 3) * 5 + 2 );
 
 	if ( count >= 1 ) {
 		OUT_RING( CCE_PACKET0( R128_AUX1_SC_LEFT, 3 ) );
@@ -916,7 +916,7 @@
 
 	count = depth->n;
 	if (count > 4096 || count <= 0)
-		return -EMSGSIZE;
+		return DRM_ERR(EMSGSIZE);
 
 	if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) {
 		return DRM_ERR(EFAULT);
@@ -1011,8 +1011,8 @@
 	DRM_DEBUG( "\n" );
 
 	count = depth->n;
-	if (count > 4096  || count <= 0)
-		return -EMSGSIZE;
+	if (count > 4096 || count <= 0)
+		return DRM_ERR(EMSGSIZE);
 
 	xbuf_size = count * sizeof(*x);
 	ybuf_size = count * sizeof(*y);
@@ -1131,7 +1131,7 @@
 
 	count = depth->n;
 	if (count > 4096 || count <= 0)
-		return -EMSGSIZE;
+		return DRM_ERR(EMSGSIZE);
 
 	if ( DRM_COPY_FROM_USER( &x, depth->x, sizeof(x) ) ) {
 		return DRM_ERR(EFAULT);
@@ -1176,7 +1176,7 @@
 
 	count = depth->n;
 	if (count > 4096 || count <= 0)
-		return -EMSGSIZE;
+		return DRM_ERR(EMSGSIZE);
 
 	if ( count > dev_priv->depth_pitch ) {
 		count = dev_priv->depth_pitch;
@@ -1280,6 +1280,7 @@
 		sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS;
 
 	r128_cce_dispatch_clear( dev, &clear );
+	COMMIT_RING();
 
 	/* Make sure we restore the 3D state next time.
 	 */
@@ -1315,8 +1316,10 @@
 	R128_WRITE( R128_CRTC_OFFSET,      dev_priv->crtc_offset );
 	R128_WRITE( R128_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl );
 
-	if (dev_priv->current_page != 0)
+	if (dev_priv->current_page != 0) {
 		r128_cce_dispatch_flip( dev );
+		COMMIT_RING();
+	}
 
 	dev_priv->page_flipping = 0;
 	return 0;
@@ -1341,6 +1344,7 @@
 
 	r128_cce_dispatch_flip( dev );
 
+	COMMIT_RING();
 	return 0;
 }
 
@@ -1362,6 +1366,7 @@
 	dev_priv->sarea_priv->dirty |= (R128_UPLOAD_CONTEXT |
 					R128_UPLOAD_MASKS);
 
+	COMMIT_RING();
 	return 0;
 }
 
@@ -1421,6 +1426,7 @@
 
 	r128_cce_dispatch_vertex( dev, buf );
 
+	COMMIT_RING();
 	return 0;
 }
 
@@ -1492,6 +1498,7 @@
 
 	r128_cce_dispatch_indices( dev, buf, elts.start, elts.end, count );
 
+	COMMIT_RING();
 	return 0;
 }
 
@@ -1501,6 +1508,7 @@
 	drm_device_dma_t *dma = dev->dma;
 	drm_r128_private_t *dev_priv = dev->dev_private;
 	drm_r128_blit_t blit;
+	int ret;
 
 	LOCK_TEST_WITH_RETURN( dev, filp );
 
@@ -1518,7 +1526,10 @@
 	RING_SPACE_TEST_WITH_RETURN( dev_priv );
 	VB_AGE_TEST_WITH_RETURN( dev_priv );
 
-	return r128_cce_dispatch_blit( filp, dev, &blit );
+	ret = r128_cce_dispatch_blit( filp, dev, &blit );
+
+	COMMIT_RING();
+	return ret;
 }
 
 int r128_cce_depth( DRM_IOCTL_ARGS )
@@ -1526,6 +1537,7 @@
 	DRM_DEVICE;
 	drm_r128_private_t *dev_priv = dev->dev_private;
 	drm_r128_depth_t depth;
+	int ret;
 
 	LOCK_TEST_WITH_RETURN( dev, filp );
 
@@ -1534,18 +1546,20 @@
 
 	RING_SPACE_TEST_WITH_RETURN( dev_priv );
 
+	ret = DRM_ERR(EINVAL);
 	switch ( depth.func ) {
 	case R128_WRITE_SPAN:
-		return r128_cce_dispatch_write_span( dev, &depth );
+		ret = r128_cce_dispatch_write_span( dev, &depth );
 	case R128_WRITE_PIXELS:
-		return r128_cce_dispatch_write_pixels( dev, &depth );
+		ret = r128_cce_dispatch_write_pixels( dev, &depth );
 	case R128_READ_SPAN:
-		return r128_cce_dispatch_read_span( dev, &depth );
+		ret = r128_cce_dispatch_read_span( dev, &depth );
 	case R128_READ_PIXELS:
-		return r128_cce_dispatch_read_pixels( dev, &depth );
+		ret = r128_cce_dispatch_read_pixels( dev, &depth );
 	}
 
-	return DRM_ERR(EINVAL);
+	COMMIT_RING();
+	return ret;
 }
 
 int r128_cce_stipple( DRM_IOCTL_ARGS )
@@ -1568,6 +1582,7 @@
 
 	r128_cce_dispatch_stipple( dev, mask );
 
+	COMMIT_RING();
 	return 0;
 }
 
@@ -1643,6 +1658,7 @@
 	 */
 	r128_cce_dispatch_indirect( dev, buf, indirect.start, indirect.end );
 
+	COMMIT_RING();
 	return 0;
 }
 
diff -Nru a/drivers/char/drm/radeon.h b/drivers/char/drm/radeon.h
--- a/drivers/char/drm/radeon.h	Tue Jun 15 22:20:58 2004
+++ b/drivers/char/drm/radeon.h	Tue Jun 15 22:20:58 2004
@@ -51,7 +51,7 @@
 #define DRIVER_DATE		"20020828"
 
 #define DRIVER_MAJOR		1
-#define DRIVER_MINOR		9
+#define DRIVER_MINOR		11
 #define DRIVER_PATCHLEVEL	0
 
 /* Interface history:
@@ -81,6 +81,11 @@
  *       Add 'GET' queries for starting additional clients on different VT's.
  * 1.9 - Add DRM_IOCTL_RADEON_CP_RESUME ioctl.
  *       Add texture rectangle support for r100.
+ * 1.10- Add SETPARAM ioctl; first parameter to set is FB_LOCATION, which
+ *       clients use to tell the DRM where they think the framebuffer is 
+ *       located in the card's address space
+ * 1.11- Add packet R200_EMIT_RB3D_BLENDCOLOR to support GL_EXT_blend_color
+ *       and GL_EXT_blend_[func|equation]_separate on r200
  */
 #define DRIVER_IOCTLS							     \
  [DRM_IOCTL_NR(DRM_IOCTL_DMA)]               = { radeon_cp_buffers,  1, 0 }, \
@@ -106,10 +111,21 @@
  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_ALLOC)]      = { radeon_mem_alloc,   1, 0 }, \
  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FREE)]       = { radeon_mem_free,    1, 0 }, \
  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INIT_HEAP)]  = { radeon_mem_init_heap, 1, 1 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_EMIT)]   = { radeon_irq_emit, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_WAIT)]   = { radeon_irq_wait, 1, 0 },
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_EMIT)]   = { radeon_irq_emit,    1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_IRQ_WAIT)]   = { radeon_irq_wait,    1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SETPARAM)]   = { radeon_cp_setparam, 1, 0 }, \
 
+#define DRIVER_FILE_FIELDS						\
+	int64_t radeon_fb_delta;					\
 
+#define DRIVER_OPEN_HELPER( filp_priv, dev )				\
+do {									\
+	drm_radeon_private_t *dev_priv = dev->dev_private;		\
+	if ( dev_priv )							\
+		filp_priv->radeon_fb_delta = dev_priv->fb_location;	\
+	else								\
+		filp_priv->radeon_fb_delta = 0;				\
+} while( 0 )
 
 /* When a client dies:
  *    - Check for and clean up flipped page state
@@ -142,7 +158,7 @@
 /* DMA customization:
  */
 #define __HAVE_DMA		1
-#define __HAVE_DMA_IRQ		1
+#define __HAVE_IRQ		1
 #define __HAVE_VBL_IRQ		1
 #define __HAVE_SHARED_IRQ       1
 
diff -Nru a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
--- a/drivers/char/drm/radeon_cp.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/drm/radeon_cp.c	Tue Jun 15 22:20:37 2004
@@ -855,7 +855,8 @@
 
 	/* Initialize the memory controller */
 	RADEON_WRITE( RADEON_MC_FB_LOCATION,
-		      (dev_priv->gart_vm_start - 1) & 0xffff0000 );
+		      ( ( dev_priv->gart_vm_start - 1 ) & 0xffff0000 )
+		    | ( dev_priv->fb_location >> 16 ) );
 
 #if __REALLY_HAVE_AGP
 	if ( !dev_priv->is_pci ) {
@@ -1071,13 +1072,6 @@
 	dev_priv->depth_offset	= init->depth_offset;
 	dev_priv->depth_pitch	= init->depth_pitch;
 
-	dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) |
-					(dev_priv->front_offset >> 10));
-	dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) |
-				       (dev_priv->back_offset >> 10));
-	dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) |
-					(dev_priv->depth_offset >> 10));
-
 	/* Hardware state for depth clears.  Remove this if/when we no
 	 * longer clear the depth buffer with a 3D rectangle.  Hard-code
 	 * all values to prevent unwanted 3D state from slipping through
@@ -1124,13 +1118,6 @@
 		return DRM_ERR(EINVAL);
 	}
 
-	DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
-	if(!dev_priv->fb) {
-		DRM_ERROR("could not find framebuffer!\n");
-		dev->dev_private = (void *)dev_priv;
-		radeon_do_cleanup_cp(dev);
-		return DRM_ERR(EINVAL);
-	}
 	DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
 	if(!dev_priv->mmio) {
 		DRM_ERROR("could not find mmio region!\n");
@@ -1204,9 +1191,26 @@
 			   dev_priv->buffers->handle );
 	}
 
+	dev_priv->fb_location = ( RADEON_READ( RADEON_MC_FB_LOCATION )
+				& 0xffff ) << 16;
+
+	dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) |
+					( ( dev_priv->front_offset
+					  + dev_priv->fb_location ) >> 10 ) );
+
+	dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) |
+				       ( ( dev_priv->back_offset
+					 + dev_priv->fb_location ) >> 10 ) );
+
+	dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) |
+					( ( dev_priv->depth_offset
+					  + dev_priv->fb_location ) >> 10 ) );
+
 
 	dev_priv->gart_size = init->gart_size;
-	dev_priv->gart_vm_start = RADEON_READ( RADEON_CONFIG_APER_SIZE );
+	dev_priv->gart_vm_start = dev_priv->fb_location
+				+ RADEON_READ( RADEON_CONFIG_APER_SIZE );
+
 #if __REALLY_HAVE_AGP
 	if ( !dev_priv->is_pci )
 		dev_priv->gart_buffers_offset = (dev_priv->buffers->offset
@@ -1271,12 +1275,12 @@
 {
 	DRM_DEBUG( "\n" );
 
-#if _HAVE_DMA_IRQ
+#if __HAVE_IRQ
 	/* Make sure interrupts are disabled here because the uninstall ioctl
 	 * may not have been called from userspace and after dev_private
 	 * is freed, it's too late.
 	 */
-	if ( dev->irq ) DRM(irq_uninstall)(dev);
+	if ( dev->irq_enabled ) DRM(irq_uninstall)(dev);
 #endif
 
 	if ( dev->dev_private ) {
diff -Nru a/drivers/char/drm/radeon_drm.h b/drivers/char/drm/radeon_drm.h
--- a/drivers/char/drm/radeon_drm.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/drm/radeon_drm.h	Tue Jun 15 22:20:42 2004
@@ -144,7 +144,8 @@
 #define RADEON_EMIT_PP_TEX_SIZE_0                   73
 #define RADEON_EMIT_PP_TEX_SIZE_1                   74
 #define RADEON_EMIT_PP_TEX_SIZE_2                   75
-#define RADEON_MAX_STATE_PACKETS                    76
+#define R200_EMIT_RB3D_BLENDCOLOR                   76
+#define RADEON_MAX_STATE_PACKETS                    77
 
 
 /* Commands understood by cmd_buffer ioctl.  More can be added but
@@ -226,6 +227,13 @@
 #define RADEON_MAX_TEXTURE_LEVELS	12
 #define RADEON_MAX_TEXTURE_UNITS	3
 
+/* Blits have strict offset rules.  All blit offset must be aligned on
+ * a 1K-byte boundary.
+ */
+#define RADEON_OFFSET_SHIFT             10
+#define RADEON_OFFSET_ALIGN             (1 << RADEON_OFFSET_SHIFT)
+#define RADEON_OFFSET_MASK              (RADEON_OFFSET_ALIGN - 1)
+
 #endif /* __RADEON_SAREA_DEFINES__ */
 
 typedef struct {
@@ -365,31 +373,58 @@
 /* Radeon specific ioctls
  * The device specific ioctl range is 0x40 to 0x79.
  */
-#define DRM_IOCTL_RADEON_CP_INIT    DRM_IOW( 0x40, drm_radeon_init_t)
-#define DRM_IOCTL_RADEON_CP_START   DRM_IO(  0x41)
-#define DRM_IOCTL_RADEON_CP_STOP    DRM_IOW( 0x42, drm_radeon_cp_stop_t)
-#define DRM_IOCTL_RADEON_CP_RESET   DRM_IO(  0x43)
-#define DRM_IOCTL_RADEON_CP_IDLE    DRM_IO(  0x44)
-#define DRM_IOCTL_RADEON_RESET      DRM_IO(  0x45)
-#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( 0x46, drm_radeon_fullscreen_t)
-#define DRM_IOCTL_RADEON_SWAP       DRM_IO(  0x47)
-#define DRM_IOCTL_RADEON_CLEAR      DRM_IOW( 0x48, drm_radeon_clear_t)
-#define DRM_IOCTL_RADEON_VERTEX     DRM_IOW( 0x49, drm_radeon_vertex_t)
-#define DRM_IOCTL_RADEON_INDICES    DRM_IOW( 0x4a, drm_radeon_indices_t)
-#define DRM_IOCTL_RADEON_STIPPLE    DRM_IOW( 0x4c, drm_radeon_stipple_t)
-#define DRM_IOCTL_RADEON_INDIRECT   DRM_IOWR(0x4d, drm_radeon_indirect_t)
-#define DRM_IOCTL_RADEON_TEXTURE    DRM_IOWR(0x4e, drm_radeon_texture_t)
-#define DRM_IOCTL_RADEON_VERTEX2    DRM_IOW( 0x4f, drm_radeon_vertex2_t)
-#define DRM_IOCTL_RADEON_CMDBUF     DRM_IOW( 0x50, drm_radeon_cmd_buffer_t)
-#define DRM_IOCTL_RADEON_GETPARAM   DRM_IOWR(0x51, drm_radeon_getparam_t)
-#define DRM_IOCTL_RADEON_FLIP	    DRM_IO(  0x52)
-#define DRM_IOCTL_RADEON_ALLOC      DRM_IOWR( 0x53, drm_radeon_mem_alloc_t)
-#define DRM_IOCTL_RADEON_FREE       DRM_IOW( 0x54, drm_radeon_mem_free_t)
-#define DRM_IOCTL_RADEON_INIT_HEAP  DRM_IOW( 0x55, drm_radeon_mem_init_heap_t)
-#define DRM_IOCTL_RADEON_IRQ_EMIT   DRM_IOWR( 0x56, drm_radeon_irq_emit_t)
-#define DRM_IOCTL_RADEON_IRQ_WAIT   DRM_IOW( 0x57, drm_radeon_irq_wait_t)
-/* added by Charl P. Botha - see radeon_cp.c for details */
-#define DRM_IOCTL_RADEON_CP_RESUME  DRM_IO(0x58)
+#define DRM_RADEON_CP_INIT    0x00 
+#define DRM_RADEON_CP_START   0x01 
+#define DRM_RADEON_CP_STOP    0x02
+#define DRM_RADEON_CP_RESET   0x03
+#define DRM_RADEON_CP_IDLE    0x04
+#define DRM_RADEON_RESET      0x05 
+#define DRM_RADEON_FULLSCREEN 0x06
+#define DRM_RADEON_SWAP       0x07 
+#define DRM_RADEON_CLEAR      0x08 
+#define DRM_RADEON_VERTEX     0x09
+#define DRM_RADEON_INDICES    0x0A
+#define DRM_RADEON_NOT_USED
+#define DRM_RADEON_STIPPLE    0x0C
+#define DRM_RADEON_INDIRECT   0x0D
+#define DRM_RADEON_TEXTURE    0x0E
+#define DRM_RADEON_VERTEX2    0x0F
+#define DRM_RADEON_CMDBUF     0x10
+#define DRM_RADEON_GETPARAM   0x11
+#define DRM_RADEON_FLIP       0x12
+#define DRM_RADEON_ALLOC      0x13
+#define DRM_RADEON_FREE       0x14
+#define DRM_RADEON_INIT_HEAP  0x15
+#define DRM_RADEON_IRQ_EMIT   0x16
+#define DRM_RADEON_IRQ_WAIT   0x17
+#define DRM_RADEON_CP_RESUME  0x18
+#define DRM_RADEON_SETPARAM   0x19
+
+#define DRM_IOCTL_RADEON_CP_INIT    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
+#define DRM_IOCTL_RADEON_CP_START   DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_CP_START)
+#define DRM_IOCTL_RADEON_CP_STOP    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_STOP, drm_radeon_cp_stop_t)
+#define DRM_IOCTL_RADEON_CP_RESET   DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_CP_RESET)
+#define DRM_IOCTL_RADEON_CP_IDLE    DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_CP_IDLE)
+#define DRM_IOCTL_RADEON_RESET      DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_RESET)
+#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FULLSCREEN, drm_radeon_fullscreen_t)
+#define DRM_IOCTL_RADEON_SWAP       DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_SWAP)
+#define DRM_IOCTL_RADEON_CLEAR      DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CLEAR, drm_radeon_clear_t)
+#define DRM_IOCTL_RADEON_VERTEX     DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX, drm_radeon_vertex_t)
+#define DRM_IOCTL_RADEON_INDICES    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INDICES, drm_radeon_indices_t)
+#define DRM_IOCTL_RADEON_STIPPLE    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_STIPPLE, drm_radeon_stipple_t)
+#define DRM_IOCTL_RADEON_INDIRECT   DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INDIRECT, drm_radeon_indirect_t)
+#define DRM_IOCTL_RADEON_TEXTURE    DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_TEXTURE, drm_radeon_texture_t)
+#define DRM_IOCTL_RADEON_VERTEX2    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_VERTEX2, drm_radeon_vertex2_t)
+#define DRM_IOCTL_RADEON_CMDBUF     DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CMDBUF, drm_radeon_cmd_buffer_t)
+#define DRM_IOCTL_RADEON_GETPARAM   DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GETPARAM, drm_radeon_getparam_t)
+#define DRM_IOCTL_RADEON_FLIP       DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_FLIP)
+#define DRM_IOCTL_RADEON_ALLOC      DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_ALLOC, drm_radeon_mem_alloc_t)
+#define DRM_IOCTL_RADEON_FREE       DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_FREE, drm_radeon_mem_free_t)
+#define DRM_IOCTL_RADEON_INIT_HEAP  DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_INIT_HEAP, drm_radeon_mem_init_heap_t)
+#define DRM_IOCTL_RADEON_IRQ_EMIT   DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_IRQ_EMIT, drm_radeon_irq_emit_t)
+#define DRM_IOCTL_RADEON_IRQ_WAIT   DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_IRQ_WAIT, drm_radeon_irq_wait_t)
+#define DRM_IOCTL_RADEON_CP_RESUME  DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_CP_RESUME)
+#define DRM_IOCTL_RADEON_SETPARAM   DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
 
 typedef struct drm_radeon_init {
 	enum {
@@ -502,7 +537,7 @@
 } drm_radeon_tex_image_t;
 
 typedef struct drm_radeon_texture {
-	int offset;
+	unsigned int offset;
 	int pitch;
 	int format;
 	int width;			/* Texture image coordinates */
@@ -537,10 +572,11 @@
 #define RADEON_PARAM_STATUS_HANDLE         8
 #define RADEON_PARAM_SAREA_HANDLE          9
 #define RADEON_PARAM_GART_TEX_HANDLE       10
+#define RADEON_PARAM_SCRATCH_OFFSET        11
 
 typedef struct drm_radeon_getparam {
 	int param;
-	int *value;
+	void *value;
 } drm_radeon_getparam_t;
 
 /* 1.6: Set up a memory manager for regions of shared memory:
@@ -576,6 +612,18 @@
 typedef struct drm_radeon_irq_wait {
 	int irq_seq;
 } drm_radeon_irq_wait_t;
+
+
+/* 1.10: Clients tell the DRM where they think the framebuffer is located in
+ * the card's address space, via a new generic ioctl to set parameters
+ */
+
+typedef struct drm_radeon_setparam {
+	unsigned int param;
+	int64_t      value;
+} drm_radeon_setparam_t;
+
+#define RADEON_SETPARAM_FB_LOCATION    1 /* determined framebuffer location */
 
 
 #endif
diff -Nru a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
--- a/drivers/char/drm/radeon_drv.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/drm/radeon_drv.c	Tue Jun 15 22:20:42 2004
@@ -48,6 +48,7 @@
 #include "drm_fops.h"
 #include "drm_init.h"
 #include "drm_ioctl.h"
+#include "drm_irq.h"
 #include "drm_lock.h"
 #include "drm_memory.h"
 #include "drm_proc.h"
diff -Nru a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
--- a/drivers/char/drm/radeon_drv.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/drm/radeon_drv.h	Tue Jun 15 22:20:40 2004
@@ -73,6 +73,8 @@
 	drm_radeon_ring_buffer_t ring;
 	drm_radeon_sarea_t *sarea_priv;
 
+	u32 fb_location;
+
 	int gart_size;
 	u32 gart_vm_start;
 	unsigned long gart_buffers_offset;
@@ -133,7 +135,6 @@
 	unsigned long gart_textures_offset;
 
 	drm_local_map_t *sarea;
-	drm_local_map_t *fb;
 	drm_local_map_t *mmio;
 	drm_local_map_t *cp_ring;
 	drm_local_map_t *ring_rptr;
@@ -184,6 +185,7 @@
 extern int radeon_cp_vertex2( DRM_IOCTL_ARGS );
 extern int radeon_cp_cmdbuf( DRM_IOCTL_ARGS );
 extern int radeon_cp_getparam( DRM_IOCTL_ARGS );
+extern int radeon_cp_setparam( DRM_IOCTL_ARGS );
 extern int radeon_cp_flip( DRM_IOCTL_ARGS );
 
 extern int radeon_mem_alloc( DRM_IOCTL_ARGS );
@@ -239,6 +241,7 @@
 #define RADEON_CRTC2_OFFSET		0x0324
 #define RADEON_CRTC2_OFFSET_CNTL	0x0328
 
+#define RADEON_RB3D_COLOROFFSET		0x1c40
 #define RADEON_RB3D_COLORPITCH		0x1c48
 
 #define RADEON_DP_GUI_MASTER_CNTL	0x146c
@@ -332,6 +335,7 @@
 #define RADEON_PP_MISC			0x1c14
 #define RADEON_PP_ROT_MATRIX_0		0x1d58
 #define RADEON_PP_TXFILTER_0		0x1c54
+#define RADEON_PP_TXOFFSET_0		0x1c5c
 #define RADEON_PP_TXFILTER_1		0x1c6c
 #define RADEON_PP_TXFILTER_2		0x1c84
 
@@ -686,6 +690,7 @@
 #define R200_SE_VTX_FMT_1                 0x208c
 #define R200_RE_CNTL                      0x1c50 
 
+#define R200_RB3D_BLENDCOLOR              0x3218
 
 /* Constants */
 #define RADEON_MAX_USEC_TIMEOUT		100000	/* 100 ms */
diff -Nru a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c
--- a/drivers/char/drm/radeon_irq.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/char/drm/radeon_irq.c	Tue Jun 15 22:21:03 2004
@@ -54,7 +54,7 @@
  * tied to dma at all, this is just a hangover from dri prehistory.
  */
 
-irqreturn_t DRM(dma_service)( DRM_IRQ_ARGS )
+irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS )
 {
 	drm_device_t *dev = (drm_device_t *) arg;
 	drm_radeon_private_t *dev_priv = 
diff -Nru a/drivers/char/drm/radeon_mem.c b/drivers/char/drm/radeon_mem.c
--- a/drivers/char/drm/radeon_mem.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/char/drm/radeon_mem.c	Tue Jun 15 22:20:44 2004
@@ -137,12 +137,12 @@
 	struct mem_block *blocks = DRM_MALLOC(sizeof(*blocks));
 
 	if (!blocks) 
-		return -ENOMEM;
+		return DRM_ERR(ENOMEM);
 	
 	*heap = DRM_MALLOC(sizeof(**heap));
 	if (!*heap) {
 		DRM_FREE( blocks, sizeof(*blocks) );
-		return -ENOMEM;
+		return DRM_ERR(ENOMEM);
 	}
 
 	blocks->start = start;
diff -Nru a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
--- a/drivers/char/drm/radeon_state.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/char/drm/radeon_state.c	Tue Jun 15 22:20:44 2004
@@ -36,6 +36,241 @@
 
 
 /* ================================================================
+ * Helper functions for client state checking and fixup
+ */
+
+static __inline__ int radeon_check_and_fixup_offset( drm_radeon_private_t *dev_priv,
+						     drm_file_t *filp_priv,
+						     u32 *offset ) {
+	u32 off = *offset;
+
+	if ( off >= dev_priv->fb_location &&
+	     off < ( dev_priv->gart_vm_start + dev_priv->gart_size ) )
+		return 0;
+
+	off += filp_priv->radeon_fb_delta;
+
+	DRM_DEBUG( "offset fixed up to 0x%x\n", off );
+
+	if ( off < dev_priv->fb_location ||
+	     off >= ( dev_priv->gart_vm_start + dev_priv->gart_size ) )
+		return DRM_ERR( EINVAL );
+
+	*offset = off;
+
+	return 0;
+}
+
+static __inline__ int radeon_check_and_fixup_offset_user( drm_radeon_private_t *dev_priv,
+							  drm_file_t *filp_priv,
+							  u32 *offset ) {
+	u32 off;
+
+	DRM_GET_USER_UNCHECKED( off, offset );
+
+	if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, &off ) )
+		return DRM_ERR( EINVAL );
+
+	DRM_PUT_USER_UNCHECKED( offset, off );
+
+	return 0;
+}
+
+static __inline__ int radeon_check_and_fixup_packets( drm_radeon_private_t *dev_priv,
+						      drm_file_t *filp_priv,
+						      int id,
+						      u32 *data ) {
+	switch ( id ) {
+
+	case RADEON_EMIT_PP_MISC:
+		if ( radeon_check_and_fixup_offset_user( dev_priv, filp_priv,
+							 &data[( RADEON_RB3D_DEPTHOFFSET
+								 - RADEON_PP_MISC ) / 4] ) ) {
+			DRM_ERROR( "Invalid depth buffer offset\n" );
+			return DRM_ERR( EINVAL );
+		}
+		break;
+
+	case RADEON_EMIT_PP_CNTL:
+		if ( radeon_check_and_fixup_offset_user( dev_priv, filp_priv,
+							 &data[( RADEON_RB3D_COLOROFFSET
+								 - RADEON_PP_CNTL ) / 4] ) ) {
+			DRM_ERROR( "Invalid colour buffer offset\n" );
+			return DRM_ERR( EINVAL );
+		}
+		break;
+
+	case R200_EMIT_PP_TXOFFSET_0:
+	case R200_EMIT_PP_TXOFFSET_1:
+	case R200_EMIT_PP_TXOFFSET_2:
+	case R200_EMIT_PP_TXOFFSET_3:
+	case R200_EMIT_PP_TXOFFSET_4:
+	case R200_EMIT_PP_TXOFFSET_5:
+		if ( radeon_check_and_fixup_offset_user( dev_priv, filp_priv,
+							 &data[0] ) ) {
+			DRM_ERROR( "Invalid R200 texture offset\n" );
+			return DRM_ERR( EINVAL );
+		}
+		break;
+
+	case RADEON_EMIT_PP_TXFILTER_0:
+	case RADEON_EMIT_PP_TXFILTER_1:
+	case RADEON_EMIT_PP_TXFILTER_2:
+		if ( radeon_check_and_fixup_offset_user( dev_priv, filp_priv,
+							 &data[( RADEON_PP_TXOFFSET_0
+								 - RADEON_PP_TXFILTER_0 ) / 4] ) ) {
+			DRM_ERROR( "Invalid R100 texture offset\n" );
+			return DRM_ERR( EINVAL );
+		}
+		break;
+
+	case R200_EMIT_PP_CUBIC_OFFSETS_0:
+	case R200_EMIT_PP_CUBIC_OFFSETS_1:
+	case R200_EMIT_PP_CUBIC_OFFSETS_2:
+	case R200_EMIT_PP_CUBIC_OFFSETS_3:
+	case R200_EMIT_PP_CUBIC_OFFSETS_4:
+	case R200_EMIT_PP_CUBIC_OFFSETS_5: {
+		int i;
+		for ( i = 0; i < 5; i++ ) {
+			if ( radeon_check_and_fixup_offset_user( dev_priv,
+								 filp_priv,
+								 &data[i] ) ) {
+				DRM_ERROR( "Invalid R200 cubic texture offset\n" );
+				return DRM_ERR( EINVAL );
+			}
+		}
+		break;
+	}
+
+	case RADEON_EMIT_RB3D_COLORPITCH:
+	case RADEON_EMIT_RE_LINE_PATTERN:
+	case RADEON_EMIT_SE_LINE_WIDTH:
+	case RADEON_EMIT_PP_LUM_MATRIX:
+	case RADEON_EMIT_PP_ROT_MATRIX_0:
+	case RADEON_EMIT_RB3D_STENCILREFMASK:
+	case RADEON_EMIT_SE_VPORT_XSCALE:
+	case RADEON_EMIT_SE_CNTL:
+	case RADEON_EMIT_SE_CNTL_STATUS:
+	case RADEON_EMIT_RE_MISC:
+	case RADEON_EMIT_PP_BORDER_COLOR_0:
+	case RADEON_EMIT_PP_BORDER_COLOR_1:
+	case RADEON_EMIT_PP_BORDER_COLOR_2:
+	case RADEON_EMIT_SE_ZBIAS_FACTOR:
+	case RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT:
+	case RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED:
+	case R200_EMIT_PP_TXCBLEND_0:
+	case R200_EMIT_PP_TXCBLEND_1:
+	case R200_EMIT_PP_TXCBLEND_2:
+	case R200_EMIT_PP_TXCBLEND_3:
+	case R200_EMIT_PP_TXCBLEND_4:
+	case R200_EMIT_PP_TXCBLEND_5:
+	case R200_EMIT_PP_TXCBLEND_6:
+	case R200_EMIT_PP_TXCBLEND_7:
+	case R200_EMIT_TCL_LIGHT_MODEL_CTL_0:
+	case R200_EMIT_TFACTOR_0:
+	case R200_EMIT_VTX_FMT_0:
+	case R200_EMIT_VAP_CTL:
+	case R200_EMIT_MATRIX_SELECT_0:
+	case R200_EMIT_TEX_PROC_CTL_2:
+	case R200_EMIT_TCL_UCP_VERT_BLEND_CTL:
+	case R200_EMIT_PP_TXFILTER_0:
+	case R200_EMIT_PP_TXFILTER_1:
+	case R200_EMIT_PP_TXFILTER_2:
+	case R200_EMIT_PP_TXFILTER_3:
+	case R200_EMIT_PP_TXFILTER_4:
+	case R200_EMIT_PP_TXFILTER_5:
+	case R200_EMIT_VTE_CNTL:
+	case R200_EMIT_OUTPUT_VTX_COMP_SEL:
+	case R200_EMIT_PP_TAM_DEBUG3:
+	case R200_EMIT_PP_CNTL_X:
+	case R200_EMIT_RB3D_DEPTHXY_OFFSET:
+	case R200_EMIT_RE_AUX_SCISSOR_CNTL:
+	case R200_EMIT_RE_SCISSOR_TL_0:
+	case R200_EMIT_RE_SCISSOR_TL_1:
+	case R200_EMIT_RE_SCISSOR_TL_2:
+	case R200_EMIT_SE_VAP_CNTL_STATUS:
+	case R200_EMIT_SE_VTX_STATE_CNTL:
+	case R200_EMIT_RE_POINTSIZE:
+	case R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0:
+	case R200_EMIT_PP_CUBIC_FACES_0:
+	case R200_EMIT_PP_CUBIC_FACES_1:
+	case R200_EMIT_PP_CUBIC_FACES_2:
+	case R200_EMIT_PP_CUBIC_FACES_3:
+	case R200_EMIT_PP_CUBIC_FACES_4:
+	case R200_EMIT_PP_CUBIC_FACES_5:
+	case RADEON_EMIT_PP_TEX_SIZE_0:
+	case RADEON_EMIT_PP_TEX_SIZE_1:
+	case RADEON_EMIT_PP_TEX_SIZE_2:
+	case R200_EMIT_RB3D_BLENDCOLOR:
+		/* These packets don't contain memory offsets */
+		break;
+
+	default:
+		DRM_ERROR( "Unknown state packet ID %d\n", id );
+		return DRM_ERR( EINVAL );
+	}
+
+	return 0;
+}
+
+static __inline__ int radeon_check_and_fixup_packet3( drm_radeon_private_t *dev_priv,
+						      drm_file_t *filp_priv,
+						      drm_radeon_cmd_buffer_t *cmdbuf,
+						      unsigned int *cmdsz ) {
+	u32 tmp[4], *cmd = ( u32* )cmdbuf->buf;
+
+	if ( DRM_COPY_FROM_USER_UNCHECKED( tmp, cmd, sizeof( tmp ) ) ) {
+		DRM_ERROR( "Failed to copy data from user space\n" );
+		return DRM_ERR( EFAULT );
+	}
+
+	*cmdsz = 2 + ( ( tmp[0] & RADEON_CP_PACKET_COUNT_MASK ) >> 16 );
+
+	if ( ( tmp[0] & 0xc0000000 ) != RADEON_CP_PACKET3 ) {
+		DRM_ERROR( "Not a type 3 packet\n" );
+		return DRM_ERR( EINVAL );
+	}
+
+	if ( 4 * *cmdsz > cmdbuf->bufsz ) {
+		DRM_ERROR( "Packet size larger than size of data provided\n" );
+		return DRM_ERR( EINVAL );
+	}
+
+	/* Check client state and fix it up if necessary */
+	if ( tmp[0] & 0x8000 ) { /* MSB of opcode: next DWORD GUI_CNTL */
+		u32 offset;
+
+		if ( tmp[1] & ( RADEON_GMC_SRC_PITCH_OFFSET_CNTL
+			      | RADEON_GMC_DST_PITCH_OFFSET_CNTL ) ) {
+			offset = tmp[2] << 10;
+			if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, &offset ) ) {
+				DRM_ERROR( "Invalid first packet offset\n" );
+				return DRM_ERR( EINVAL );
+			}
+			tmp[2] = ( tmp[2] & 0xffc00000 ) | offset >> 10;
+		}
+
+		if ( ( tmp[1] & RADEON_GMC_SRC_PITCH_OFFSET_CNTL ) &&
+		     ( tmp[1] & RADEON_GMC_DST_PITCH_OFFSET_CNTL ) ) {
+			offset = tmp[3] << 10;
+			if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, &offset ) ) {
+				DRM_ERROR( "Invalid second packet offset\n" );
+				return DRM_ERR( EINVAL );
+			}
+			tmp[3] = ( tmp[3] & 0xffc00000 ) | offset >> 10;
+		}
+
+		if ( DRM_COPY_TO_USER_UNCHECKED( cmd, tmp, sizeof( tmp ) ) ) {
+			DRM_ERROR( "Failed to copy data to user space\n" );
+			return DRM_ERR( EFAULT );
+		}
+	}
+
+	return 0;
+}
+
+
+/* ================================================================
  * CP hardware state programming functions
  */
 
@@ -57,15 +292,28 @@
 
 /* Emit 1.1 state
  */
-static void radeon_emit_state( drm_radeon_private_t *dev_priv,
-			       drm_radeon_context_regs_t *ctx,
-			       drm_radeon_texture_regs_t *tex,
-			       unsigned int dirty )
+static int radeon_emit_state( drm_radeon_private_t *dev_priv,
+			      drm_file_t *filp_priv,
+			      drm_radeon_context_regs_t *ctx,
+			      drm_radeon_texture_regs_t *tex,
+			      unsigned int dirty )
 {
 	RING_LOCALS;
 	DRM_DEBUG( "dirty=0x%08x\n", dirty );
 
 	if ( dirty & RADEON_UPLOAD_CONTEXT ) {
+		if ( radeon_check_and_fixup_offset( dev_priv, filp_priv,
+						    &ctx->rb3d_depthoffset ) ) {
+			DRM_ERROR( "Invalid depth buffer offset\n" );
+			return DRM_ERR( EINVAL );
+		}
+
+		if ( radeon_check_and_fixup_offset( dev_priv, filp_priv,
+						    &ctx->rb3d_coloroffset ) ) {
+			DRM_ERROR( "Invalid depth buffer offset\n" );
+			return DRM_ERR( EINVAL );
+		}
+
 		BEGIN_RING( 14 );
 		OUT_RING( CP_PACKET0( RADEON_PP_MISC, 6 ) );
 		OUT_RING( ctx->pp_misc );
@@ -149,6 +397,12 @@
 	}
 
 	if ( dirty & RADEON_UPLOAD_TEX0 ) {
+		if ( radeon_check_and_fixup_offset( dev_priv, filp_priv,
+						    &tex[0].pp_txoffset ) ) {
+			DRM_ERROR( "Invalid texture offset for unit 0\n" );
+			return DRM_ERR( EINVAL );
+		}
+
 		BEGIN_RING( 9 );
 		OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_0, 5 ) );
 		OUT_RING( tex[0].pp_txfilter );
@@ -163,6 +417,12 @@
 	}
 
 	if ( dirty & RADEON_UPLOAD_TEX1 ) {
+		if ( radeon_check_and_fixup_offset( dev_priv, filp_priv,
+						    &tex[1].pp_txoffset ) ) {
+			DRM_ERROR( "Invalid texture offset for unit 1\n" );
+			return DRM_ERR( EINVAL );
+		}
+
 		BEGIN_RING( 9 );
 		OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_1, 5 ) );
 		OUT_RING( tex[1].pp_txfilter );
@@ -177,6 +437,12 @@
 	}
 
 	if ( dirty & RADEON_UPLOAD_TEX2 ) {
+		if ( radeon_check_and_fixup_offset( dev_priv, filp_priv,
+						    &tex[2].pp_txoffset ) ) {
+			DRM_ERROR( "Invalid texture offset for unit 2\n" );
+			return DRM_ERR( EINVAL );
+		}
+
 		BEGIN_RING( 9 );
 		OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_2, 5 ) );
 		OUT_RING( tex[2].pp_txfilter );
@@ -189,12 +455,15 @@
 		OUT_RING( tex[2].pp_border_color );
 		ADVANCE_RING();
 	}
+
+	return 0;
 }
 
 /* Emit 1.2 state
  */
-static void radeon_emit_state2( drm_radeon_private_t *dev_priv,
-				drm_radeon_state_t *state )
+static int radeon_emit_state2( drm_radeon_private_t *dev_priv,
+			       drm_file_t *filp_priv,
+			       drm_radeon_state_t *state )
 {
 	RING_LOCALS;
 
@@ -206,7 +475,7 @@
 		ADVANCE_RING();
 	}
 
-	radeon_emit_state( dev_priv, &state->context, 
+	return radeon_emit_state( dev_priv, filp_priv, &state->context,
 			   state->tex, state->dirty );
 }
 
@@ -295,6 +564,7 @@
 	{ RADEON_PP_TEX_SIZE_0, 2, "RADEON_PP_TEX_SIZE_0" },
 	{ RADEON_PP_TEX_SIZE_1, 2, "RADEON_PP_TEX_SIZE_1" },
 	{ RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_1" },
+	{ R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR" },
 };
 
 
@@ -1065,6 +1335,7 @@
 				       drm_radeon_tex_image_t *image )
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
+	drm_file_t *filp_priv;
 	drm_buf_t *buf;
 	u32 format;
 	u32 *buffer;
@@ -1074,6 +1345,13 @@
 	int i;
 	RING_LOCALS;
 
+	DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
+
+	if ( radeon_check_and_fixup_offset( dev_priv, filp_priv, &tex->offset ) ) {
+		DRM_ERROR( "Invalid destination offset\n" );
+		return DRM_ERR( EINVAL );
+	}
+
 	dev_priv->stats.boxes |= RADEON_BOX_TEXTURE_LOAD;
 
 	/* Flush the pixel cache.  This ensures no pixel data gets mixed
@@ -1377,6 +1655,7 @@
 {
 	DRM_DEVICE;
 	drm_radeon_private_t *dev_priv = dev->dev_private;
+	drm_file_t *filp_priv;
 	drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
 	drm_device_dma_t *dma = dev->dma;
 	drm_buf_t *buf;
@@ -1390,6 +1669,8 @@
 		return DRM_ERR(EINVAL);
 	}
 
+	DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
+
 	DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex_t *)data,
 			     sizeof(vertex) );
 
@@ -1429,11 +1710,14 @@
 		buf->used = vertex.count; /* not used? */
 
 		if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) {
-			radeon_emit_state( dev_priv,
-					   &sarea_priv->context_state,
-					   sarea_priv->tex_state,
-					   sarea_priv->dirty );
-			
+			if ( radeon_emit_state( dev_priv, filp_priv,
+						&sarea_priv->context_state,
+						sarea_priv->tex_state,
+						sarea_priv->dirty ) ) {
+				DRM_ERROR( "radeon_emit_state failed\n" );
+				return DRM_ERR( EINVAL );
+			}
+
 			sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES |
 					       RADEON_UPLOAD_TEX1IMAGES |
 					       RADEON_UPLOAD_TEX2IMAGES |
@@ -1461,6 +1745,7 @@
 {
 	DRM_DEVICE;
 	drm_radeon_private_t *dev_priv = dev->dev_private;
+	drm_file_t *filp_priv;
 	drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
 	drm_device_dma_t *dma = dev->dma;
 	drm_buf_t *buf;
@@ -1475,6 +1760,8 @@
 		return DRM_ERR(EINVAL);
 	}
 
+	DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
+
 	DRM_COPY_FROM_USER_IOCTL( elts, (drm_radeon_indices_t *)data,
 			     sizeof(elts) );
 
@@ -1523,10 +1810,13 @@
 	buf->used = elts.end;
 
 	if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) {
-		radeon_emit_state( dev_priv,
-				   &sarea_priv->context_state,
-				   sarea_priv->tex_state,
-				   sarea_priv->dirty );
+		if ( radeon_emit_state( dev_priv, filp_priv,
+					&sarea_priv->context_state,
+					sarea_priv->tex_state,
+					sarea_priv->dirty ) ) {
+			DRM_ERROR( "radeon_emit_state failed\n" );
+			return DRM_ERR( EINVAL );
+		}
 
 		sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES |
 				       RADEON_UPLOAD_TEX1IMAGES |
@@ -1686,6 +1976,7 @@
 {
 	DRM_DEVICE;
 	drm_radeon_private_t *dev_priv = dev->dev_private;
+	drm_file_t *filp_priv;
 	drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv;
 	drm_device_dma_t *dma = dev->dma;
 	drm_buf_t *buf;
@@ -1700,6 +1991,8 @@
 		return DRM_ERR(EINVAL);
 	}
 
+	DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
+
 	DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex2_t *)data,
 			     sizeof(vertex) );
 
@@ -1747,7 +2040,10 @@
 					     sizeof(state) ) )
 				return DRM_ERR(EFAULT);
 
-			radeon_emit_state2( dev_priv, &state );
+			if ( radeon_emit_state2( dev_priv, filp_priv, &state ) ) {
+				DRM_ERROR( "radeon_emit_state2 failed\n" );
+				return DRM_ERR( EINVAL );
+			}
 
 			laststate = prim.stateidx;
 		}
@@ -1784,6 +2080,7 @@
 
 static int radeon_emit_packets( 
 	drm_radeon_private_t *dev_priv,
+	drm_file_t *filp_priv,
 	drm_radeon_cmd_header_t header,
 	drm_radeon_cmd_buffer_t *cmdbuf )
 {
@@ -1798,8 +2095,15 @@
 	sz = packet[id].len;
 	reg = packet[id].start;
 
-	if (sz * sizeof(int) > cmdbuf->bufsz) 
+	if (sz * sizeof(int) > cmdbuf->bufsz) {
+		DRM_ERROR( "Packet size provided larger than data provided\n" );
 		return DRM_ERR(EINVAL);
+	}
+
+	if ( radeon_check_and_fixup_packets( dev_priv, filp_priv, id, data ) ) {
+		DRM_ERROR( "Packet verification failed\n" );
+		return DRM_ERR( EINVAL );
+	}
 
 	BEGIN_RING(sz+1);
 	OUT_RING( CP_PACKET0( reg, (sz-1) ) );
@@ -1882,24 +2186,21 @@
 
 
 static int radeon_emit_packet3( drm_device_t *dev,
+				drm_file_t *filp_priv,
 				drm_radeon_cmd_buffer_t *cmdbuf )
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
-	int cmdsz, tmp;
-	int *cmd = (int *)cmdbuf->buf;
+	unsigned int cmdsz;
+	int *cmd = (int *)cmdbuf->buf, ret;
 	RING_LOCALS;
 
-
 	DRM_DEBUG("\n");
 
-	if (DRM_GET_USER_UNCHECKED( tmp, &cmd[0]))
-		return DRM_ERR(EFAULT);
-
-	cmdsz = 2 + ((tmp & RADEON_CP_PACKET_COUNT_MASK) >> 16);
-
-	if ((tmp & 0xc0000000) != RADEON_CP_PACKET3 ||
-	    cmdsz * 4 > cmdbuf->bufsz)
-		return DRM_ERR(EINVAL);
+	if ( ( ret = radeon_check_and_fixup_packet3( dev_priv, filp_priv,
+						     cmdbuf, &cmdsz ) ) ) {
+		DRM_ERROR( "Packet verification failed\n" );
+		return ret;
+	}
 
 	BEGIN_RING( cmdsz );
 	OUT_RING_USER_TABLE( cmd, cmdsz );
@@ -1912,27 +2213,25 @@
 
 
 static int radeon_emit_packet3_cliprect( drm_device_t *dev,
+					 drm_file_t *filp_priv,
 					 drm_radeon_cmd_buffer_t *cmdbuf,
 					 int orig_nbox )
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
 	drm_clip_rect_t box;
-	int cmdsz, tmp;
-	int *cmd = (int *)cmdbuf->buf;
+	unsigned int cmdsz;
+	int *cmd = (int *)cmdbuf->buf, ret;
 	drm_clip_rect_t *boxes = cmdbuf->boxes;
 	int i = 0;
 	RING_LOCALS;
 
 	DRM_DEBUG("\n");
 
-	if (DRM_GET_USER_UNCHECKED( tmp, &cmd[0]))
-		return DRM_ERR(EFAULT);
-
-	cmdsz = 2 + ((tmp & RADEON_CP_PACKET_COUNT_MASK) >> 16);
-
-	if ((tmp & 0xc0000000) != RADEON_CP_PACKET3 ||
-	    cmdsz * 4 > cmdbuf->bufsz)
-		return DRM_ERR(EINVAL);
+	if ( ( ret = radeon_check_and_fixup_packet3( dev_priv, filp_priv,
+						     cmdbuf, &cmdsz ) ) ) {
+		DRM_ERROR( "Packet verification failed\n" );
+		return ret;
+	}
 
 	if (!orig_nbox)
 		goto out;
@@ -2009,6 +2308,7 @@
 {
 	DRM_DEVICE;
 	drm_radeon_private_t *dev_priv = dev->dev_private;
+	drm_file_t *filp_priv;
 	drm_device_dma_t *dma = dev->dma;
 	drm_buf_t *buf = 0;
 	int idx;
@@ -2023,6 +2323,8 @@
 		return DRM_ERR(EINVAL);
 	}
 
+	DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
+
 	DRM_COPY_FROM_USER_IOCTL( cmdbuf, (drm_radeon_cmd_buffer_t *)data,
 			     sizeof(cmdbuf) );
 
@@ -2053,7 +2355,7 @@
 		switch (header.header.cmd_type) {
 		case RADEON_CMD_PACKET: 
 			DRM_DEBUG("RADEON_CMD_PACKET\n");
-			if (radeon_emit_packets( dev_priv, header, &cmdbuf )) {
+			if (radeon_emit_packets( dev_priv, filp_priv, header, &cmdbuf )) {
 				DRM_ERROR("radeon_emit_packets failed\n");
 				return DRM_ERR(EINVAL);
 			}
@@ -2096,7 +2398,7 @@
 
 		case RADEON_CMD_PACKET3:
 			DRM_DEBUG("RADEON_CMD_PACKET3\n");
-			if (radeon_emit_packet3( dev, &cmdbuf )) {
+			if (radeon_emit_packet3( dev, filp_priv, &cmdbuf )) {
 				DRM_ERROR("radeon_emit_packet3 failed\n");
 				return DRM_ERR(EINVAL);
 			}
@@ -2104,7 +2406,7 @@
 
 		case RADEON_CMD_PACKET3_CLIP:
 			DRM_DEBUG("RADEON_CMD_PACKET3_CLIP\n");
-			if (radeon_emit_packet3_cliprect( dev, &cmdbuf, orig_nbox )) {
+			if (radeon_emit_packet3_cliprect( dev, filp_priv, &cmdbuf, orig_nbox )) {
 				DRM_ERROR("radeon_emit_packet3_clip failed\n");
 				return DRM_ERR(EINVAL);
 			}
@@ -2212,5 +2514,33 @@
 		return DRM_ERR(EFAULT);
 	}
 	
+	return 0;
+}
+
+int radeon_cp_setparam( DRM_IOCTL_ARGS ) {
+	DRM_DEVICE;
+	drm_radeon_private_t *dev_priv = dev->dev_private;
+	drm_file_t *filp_priv;
+	drm_radeon_setparam_t sp;
+
+	if ( !dev_priv ) {
+		DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
+		return DRM_ERR( EINVAL );
+	}
+
+	DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
+
+	DRM_COPY_FROM_USER_IOCTL( sp, ( drm_radeon_setparam_t* )data,
+				  sizeof( sp ) );
+
+	switch( sp.param ) {
+	case RADEON_SETPARAM_FB_LOCATION:
+		filp_priv->radeon_fb_delta = dev_priv->fb_location - sp.value;
+		break;
+	default:
+		DRM_DEBUG( "Invalid parameter %d\n", sp.param );
+		return DRM_ERR( EINVAL );
+	}
+
 	return 0;
 }
diff -Nru a/drivers/char/drm/tdfx.h b/drivers/char/drm/tdfx.h
--- a/drivers/char/drm/tdfx.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/drm/tdfx.h	Tue Jun 15 22:20:40 2004
@@ -39,4 +39,14 @@
 #define __HAVE_MTRR		1
 #define __HAVE_CTX_BITMAP	1
 
+#define DRIVER_AUTHOR		"VA Linux Systems Inc."
+
+#define DRIVER_NAME		"tdfx"
+#define DRIVER_DESC		"3dfx Banshee/Voodoo3+"
+#define DRIVER_DATE		"20010216"
+
+#define DRIVER_MAJOR		1
+#define DRIVER_MINOR		0
+#define DRIVER_PATCHLEVEL	0
+
 #endif
diff -Nru a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c
--- a/drivers/char/drm/tdfx_drv.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/drm/tdfx_drv.c	Tue Jun 15 22:20:40 2004
@@ -34,47 +34,6 @@
 #include "tdfx.h"
 #include "drmP.h"
 
-#define DRIVER_AUTHOR		"VA Linux Systems Inc."
-
-#define DRIVER_NAME		"tdfx"
-#define DRIVER_DESC		"3dfx Banshee/Voodoo3+"
-#define DRIVER_DATE		"20010216"
-
-#define DRIVER_MAJOR		1
-#define DRIVER_MINOR		0
-#define DRIVER_PATCHLEVEL	0
-
-#ifndef PCI_VENDOR_ID_3DFX
-#define PCI_VENDOR_ID_3DFX 0x121A
-#endif
-#ifndef PCI_DEVICE_ID_3DFX_VOODOO5
-#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009
-#endif
-#ifndef PCI_DEVICE_ID_3DFX_VOODOO4
-#define PCI_DEVICE_ID_3DFX_VOODOO4 0x0007
-#endif
-#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_3000 /* Voodoo3 3000 */
-#define PCI_DEVICE_ID_3DFX_VOODOO3_3000 0x0005
-#endif
-#ifndef PCI_DEVICE_ID_3DFX_VOODOO3_2000 /* Voodoo3 3000 */
-#define PCI_DEVICE_ID_3DFX_VOODOO3_2000 0x0004
-#endif
-#ifndef PCI_DEVICE_ID_3DFX_BANSHEE
-#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003
-#endif
-
-static drm_pci_list_t DRM(idlist)[] = {
-	{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE },
-	{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3_2000 },
-	{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO3_3000 },
-	{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO4 },
-	{ PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_VOODOO5 },
-	{ 0, 0 }
-};
-
-#define DRIVER_CARD_LIST DRM(idlist)
-
-
 #include "drm_auth.h"
 #include "drm_bufs.h"
 #include "drm_context.h"
diff -Nru a/drivers/char/dz.c b/drivers/char/dz.c
--- a/drivers/char/dz.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1540 +0,0 @@
-/*
- * dz.c: Serial port driver for DECStations equiped 
- *       with the DZ chipset.
- *
- * Copyright (C) 1998 Olivier A. D. Lebaillif 
- *             
- * Email: olivier.lebaillif@ifrsys.com
- *
- * [31-AUG-98] triemer
- * Changed IRQ to use Harald's dec internals interrupts.h
- * removed base_addr code - moving address assignment to setup.c
- * Changed name of dz_init to rs_init to be consistent with tc code
- * [13-NOV-98] triemer fixed code to receive characters
- *    after patches by harald to irq code.  
- * [09-JAN-99] triemer minor fix for schedule - due to removal of timeout
- *            field from "current" - somewhere between 2.1.121 and 2.1.131
-Qua Jun 27 15:02:26 BRT 2001
- * [27-JUN-2001] Arnaldo Carvalho de Melo <acme@conectiva.com.br> - cleanups
- *  
- * Parts (C) 1999 David Airlie, airlied@linux.ie 
- * [07-SEP-99] Bugfixes 
- */
-
-/* #define DEBUG_DZ 1 */
-
-#include <linux/module.h>
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/init.h> 
-#include <linux/slab.h>
-#include <linux/mm.h>
-#include <linux/major.h>
-#include <linux/param.h>
-#include <linux/interrupt.h>
-#include <linux/serial.h>
-#include <linux/serialP.h>
-#include <asm-mips/wbflush.h>
-#include <asm/dec/interrupts.h>			/* for definition of SERIAL */
-
-/* for definition of struct console */
-#ifdef CONFIG_SERIAL_CONSOLE
-#define CONSOLE_LINE (3)
-#endif /* ifdef CONFIG_SERIAL_CONSOLE */
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(DEBUG_DZ)
-#include <linux/console.h>
-#endif /* if defined(CONFIG_SERIAL_CONSOLE) || defined(DEBUG_DZ) */
-
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-
-#include <asm/uaccess.h>
-#include <asm/irq.h>
-#include <asm/dec/machtype.h>
-#include <asm/dec/kn01.h>
-#include <asm/dec/kn02.h>
-
-#ifdef DEBUG_DZ
-#include <linux/ptrace.h>
-#include <linux/fs.h>
-#include <asm/bootinfo.h>
-
-extern int (*prom_printf) (char *,...);
-#endif
-
-
-
-#include "dz.h"
-
-#define DZ_INTR_DEBUG 1
-
-DECLARE_TASK_QUEUE(tq_serial);
-
-static struct dz_serial *lines[4];
-static unsigned char tmp_buffer[256];
-
-
-
-#ifdef DEBUG_DZ
-/*
- * debugging code to send out chars via prom 
- */
-static void debug_console( const char *s,int count)
-{
-	unsigned i;
-
-	for (i = 0; i < count; i++) {
-		if (*s == 10)
-			prom_printf("%c", 13);
-		prom_printf("%c", *s++);
-	}
-}
-#endif
-
-/*
- * ------------------------------------------------------------
- * dz_in () and dz_out ()
- *
- * These routines are used to access the registers of the DZ 
- * chip, hiding relocation differences between implementation.
- * ------------------------------------------------------------
- */
-
-static inline unsigned short dz_in (struct dz_serial *info, unsigned offset)
-{
-	volatile u16 *addr = (volatile u16 *)(info->port + offset);
-
-	return *addr;
-}
-
-static inline void dz_out (struct dz_serial *info, unsigned offset,
-                           unsigned short value)
-{
-	volatile u16 *addr = (volatile u16 *)(info->port + offset);
-	*addr = value;
-}
-
-/*
- * ------------------------------------------------------------
- * rs_stop () and rs_start ()
- *
- * These routines are called before setting or resetting 
- * tty->stopped. They enable or disable transmitter interrupts, 
- * as necessary.
- * ------------------------------------------------------------
- */
-
-static void dz_stop (struct tty_struct *tty)
-{
-	struct dz_serial *info; 
-	unsigned short mask, tmp;
-
-	if (!tty) 
-		return; 
- 
-	info = (struct dz_serial *)tty->driver_data; 
-
-	mask = 1 << info->line;
-	tmp = dz_in (info, DZ_TCR);       /* read the TX flag */
-
-	tmp &= ~mask;                   /* clear the TX flag */
-	dz_out (info, DZ_TCR, tmp);
-}
-
-static void dz_start (struct tty_struct *tty)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;
-	unsigned short mask, tmp;
-
-	mask = 1 << info->line;
-	tmp = dz_in (info, DZ_TCR);      /* read the TX flag */
-
-	tmp |= mask;                   /* set the TX flag */
-	dz_out (info, DZ_TCR, tmp);
-}
-
-/*
- * ------------------------------------------------------------
- * Here starts the interrupt handling routines.  All of the 
- * following subroutines are declared as inline and are folded 
- * into dz_interrupt.  They were separated out for readability's 
- * sake. 
- *
- * Note: rs_interrupt() is a "fast" interrupt, which means that it
- * runs with interrupts turned off.  People who may want to modify
- * rs_interrupt() should try to keep the interrupt handler as fast as
- * possible.  After you are done making modifications, it is not a bad
- * idea to do:
- * 
- * gcc -S -DKERNEL -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer dz.c
- *
- * and look at the resulting assemble code in serial.s.
- *
- * ------------------------------------------------------------
- */
-
-/*
- * ------------------------------------------------------------
- * dz_sched_event ()
- *
- * This routine is used by the interrupt handler to schedule
- * processing in the software interrupt portion of the driver.
- * ------------------------------------------------------------
- */
-static inline void dz_sched_event (struct dz_serial *info, int event)
-{
-	info->event |= 1 << event;
-	queue_task(&info->tqueue, &tq_serial);
-	mark_bh(SERIAL_BH);
-}
-
-/*
- * ------------------------------------------------------------
- * receive_char ()
- *
- * This routine deals with inputs from any lines.
- * ------------------------------------------------------------
- */
-static inline void receive_chars (struct dz_serial *info_in)
-{
-	struct dz_serial *info;
-	struct tty_struct *tty = 0;
-	struct async_icount *icount;
-	int ignore = 0;
-	unsigned short status, tmp;
-	unsigned char ch;
-
-	/*
-	 * This code is going to be a problem...  the call to tty_flip_buffer
-	 * is going to need to be rethought...
-	 */
-	do {
-		status = dz_in (info_in, DZ_RBUF);
-		info = lines[LINE(status)];
-
-		/* punt so we don't get duplicate characters */
-		if (!(status & DZ_DVAL))
-			goto ignore_char;
-
-		ch = UCHAR(status);			/* grab the char */
-
-#if 0
-		if (info->is_console) {
-			if (ch == 0)
-				return;			/* it's a break ... */
-		}
-#endif
-
-		tty = info->tty;	/* now tty points to the proper dev */
-		icount = &info->icount;
-
-		if (!tty)
-			break;
-		if (tty->flip.count >= TTY_FLIPBUF_SIZE) break;
-
-		*tty->flip.char_buf_ptr = ch;
-		*tty->flip.flag_buf_ptr = 0;
-		icount->rx++;
-
-		/* keep track of the statistics */
-		if (status & (DZ_OERR | DZ_FERR | DZ_PERR)) {
-			if (status & DZ_PERR)		/* parity error */
-				icount->parity++;
-			else if (status & DZ_FERR)	/* frame error */
-				icount->frame++;
-			if (status & DZ_OERR)		/* overrun error */
-				icount->overrun++;
-
-			/*
-			 * Check to see if we should ignore the character and
-			 * mask off conditions that should be ignored
-			 */
-
-			if (status & info->ignore_status_mask) {
-				if (++ignore > 100)
-					break;
-				goto ignore_char;
-			}
-
-			/* mask off the error conditions we want to ignore */
-			tmp = status & info->read_status_mask;
-
-			if (tmp & DZ_PERR) {
-				*tty->flip.flag_buf_ptr = TTY_PARITY;
-#ifdef DEBUG_DZ
-				debug_console("PERR\n",5);
-#endif /* DEBUG_DZ */
-			} else if (tmp & DZ_FERR) {
-				*tty->flip.flag_buf_ptr = TTY_FRAME;
-#ifdef DEBUG_DZ
-				debug_console("FERR\n",5);
-#endif /* DEBUG_DZ */
-			} if (tmp & DZ_OERR) { 
-#ifdef DEBUG_DZ
-				debug_console("OERR\n",5);
-#endif /* DEBUG_DZ */
-				if (tty->flip.count < TTY_FLIPBUF_SIZE) {
-					tty->flip.count++;
-					tty->flip.flag_buf_ptr++;
-					tty->flip.char_buf_ptr++;
-					*tty->flip.flag_buf_ptr = TTY_OVERRUN;
-				}
-			}
-		}
-	tty->flip.flag_buf_ptr++;
-	tty->flip.char_buf_ptr++;
-	tty->flip.count++;
-ignore_char:
-	;
-	} while (status & DZ_DVAL);
-
-	if (tty)
-		tty_flip_buffer_push(tty);
-}
-
-/*
- * ------------------------------------------------------------
- * transmit_char ()
- *
- * This routine deals with outputs to any lines.
- * ------------------------------------------------------------
- */
-static inline void transmit_chars (struct dz_serial *info)
-{
-	unsigned char tmp;
-
-	if (info->x_char) {           /* XON/XOFF chars */
-		dz_out(info, DZ_TDR, info->x_char);
-		info->icount.tx++;
-		info->x_char = 0;
-		return;
-	}
-
-	/* if nothing to do or stopped or hardware stopped */
-	if ((info->xmit_cnt <= 0) || info->tty->stopped ||
-	    info->tty->hw_stopped) {
-		dz_stop(info->tty);
-		return;
-	}
-
-	/*
-	 * If something to do ... (rember the dz has no output fifo so we go
-	 * one char at a time :-<
-	 */
-	tmp = (unsigned short) info->xmit_buf[info->xmit_tail++];
-	dz_out(info, DZ_TDR, tmp);
-	info->xmit_tail = info->xmit_tail & (DZ_XMIT_SIZE - 1);
-	info->icount.tx++;
-
-	if (--info->xmit_cnt < WAKEUP_CHARS)
-	dz_sched_event(info, DZ_EVENT_WRITE_WAKEUP);
-
-	/* Are we done */
-	if (info->xmit_cnt <= 0)
-		dz_stop(info->tty);
-}
-
-/*
- * ------------------------------------------------------------
- * check_modem_status ()
- *
- * Only valid for the MODEM line duh !
- * ------------------------------------------------------------
- */
-static inline void check_modem_status (struct dz_serial *info)
-{
-	unsigned short status;
-
-	/* if not ne modem line just return */
-	if (info->line != DZ_MODEM)
-		return;
-
-	status = dz_in(info, DZ_MSR);
-  
-	/* it's easy, since DSR2 is the only bit in the register */
-	if (status)
-		info->icount.dsr++;
-}
-
-/*
- * ------------------------------------------------------------
- * dz_interrupt ()
- *
- * this is the main interrupt routine for the DZ chip.
- * It deals with the multiple ports.
- * ------------------------------------------------------------
- */
-static void dz_interrupt (int irq, void *dev, struct pt_regs *regs)
-{
-	struct dz_serial *info;
-	unsigned short status;
-
-	 /* get the reason why we just got an irq */
-	status = dz_in((struct dz_serial *)dev, DZ_CSR);
-	info = lines[LINE(status)];     /* re-arrange info the proper port */
-
-	if (status & DZ_RDONE) 
-		receive_chars(info);	/* the receive function */
-
-	if (status & DZ_TRDY) 
-		transmit_chars (info);
-}
-
-/*
- * -------------------------------------------------------------------
- * Here ends the DZ interrupt routines.
- * -------------------------------------------------------------------
- */
-
-/*
- * This routine is used to handle the "bottom half" processing for the
- * serial driver, known also the "software interrupt" processing.
- * This processing is done at the kernel interrupt level, after the
- * rs_interrupt() has returned, BUT WITH INTERRUPTS TURNED ON.  This
- * is where time-consuming activities which can not be done in the
- * interrupt driver proper are done; the interrupt driver schedules
- * them using rs_sched_event(), and they get done here.
- */
-static void do_serial_bh (void)
-{
-	run_task_queue (&tq_serial);
-}
-
-static void do_softint (void *private_data)
-{
-	struct dz_serial *info = (struct dz_serial *) private_data;
-	struct tty_struct *tty = info->tty;
-
-	if (!tty)
-		return;
-
-	if (test_and_clear_bit(DZ_EVENT_WRITE_WAKEUP, &info->event)) {
-		if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
-		    tty->ldisc.write_wakeup)
-			(tty->ldisc.write_wakeup) (tty);
-		wake_up_interruptible (&tty->write_wait);
-	}
-}
-
-/*
- * -------------------------------------------------------------------
- * This routine is called from the scheduler tqueue when the interrupt
- * routine has signalled that a hangup has occurred.  The path of
- * hangup processing is:
- *
- *      serial interrupt routine -> (scheduler tqueue) ->
- *      do_serial_hangup() -> tty->hangup() -> rs_hangup()
- * ------------------------------------------------------------------- 
- */
-static void do_serial_hangup (void *private_data)
-{
-	struct dz_serial *info = (struct dz_serial *) private_data;
-	struct tty_struct *tty = info->tty;
-        
-	if (!tty)
-		return;
-
-	tty_hangup(tty);
-}
-
-/*
- * -------------------------------------------------------------------
- * startup ()
- *
- * various initialization tasks
- * ------------------------------------------------------------------- 
- */
-static int startup (struct dz_serial *info)
-{
-	unsigned long page, flags;
-	unsigned short tmp;
-
-	if (info->is_initialized)
-		return 0;
-  
-	save_and_cli(flags);
-
-	if (!info->port) {
-		if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags);
-		restore_flags(flags);
-		return -ENODEV;
-	}
-
-	if (!info->xmit_buf) {
-		page = get_zeroed_page(GFP_KERNEL);
-		if (!page) {
-			restore_flags (flags);
-		return -ENOMEM;
-		}
-		info->xmit_buf = (unsigned char *)page;
-	}
-
-	if (info->tty)
-		clear_bit(TTY_IO_ERROR, &info->tty->flags);
-
-	/* enable the interrupt and the scanning */
-	tmp = dz_in(info, DZ_CSR);
-	tmp |= (DZ_RIE | DZ_TIE | DZ_MSE);
-	dz_out(info, DZ_CSR, tmp);
-
-	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
-
-	change_speed(info);			/* set up the speed */
-
-	/*
-	 * Clear the line transmitter buffer I can't figure out why I need to
-	 * do this - but its necessary - in order for the console portion and
-	 * the interrupt portion to live happily side by side.
-	 */
-
-	info->is_initialized = 1;
-
-	restore_flags(flags);
-
-	return 0;
-}
-
-/* 
- * -------------------------------------------------------------------
- * shutdown ()
- *
- * This routine will shutdown a serial port; interrupts are disabled, and
- * DTR is dropped if the hangup on close termio flag is on.
- * ------------------------------------------------------------------- 
- */
-static void shutdown (struct dz_serial *info)
-{
-	unsigned long flags;
-	unsigned short tmp;
-
-	if (!info->is_initialized)
-		return;
-
-	save_and_cli(flags);
-
-	dz_stop (info->tty);
-
-	info->cflags &= ~DZ_CREAD;	/* turn off receive enable flag */
-	dz_out(info, DZ_LPR, info->cflags);
-
-	if (info->xmit_buf) {               /* free Tx buffer */
-		free_page((unsigned long)info->xmit_buf);
-		info->xmit_buf = 0;
-	}
-
-	if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
-		tmp = dz_in(info, DZ_TCR);
-		if (tmp & DZ_MODEM_DTR) {
-			tmp &= ~DZ_MODEM_DTR;
-			dz_out(info, DZ_TCR, tmp);
-		}
-	}
-
-	if (info->tty)
-		set_bit (TTY_IO_ERROR, &info->tty->flags);
-
-	info->is_initialized = 0;
-
-	restore_flags (flags);
-}
-
-/* 
- * -------------------------------------------------------------------
- * change_speed ()
- *
- * set the baud rate.
- * ------------------------------------------------------------------- 
- */
-static void change_speed (struct dz_serial *info)
-{
-	unsigned long flags;
-	unsigned cflag;
-	int baud;
-
-	if (!info->tty || !info->tty->termios)
-		return;
-  
-	save_and_cli(flags);
-  
-	info->cflags = info->line;
-
-	cflag = info->tty->termios->c_cflag;
-
-	switch (cflag & CSIZE) {
-		case CS5:
-			info->cflags |= DZ_CS5;
-			break;
-		case CS6:
-			info->cflags |= DZ_CS6;
-			break;
-		case CS7:
-			info->cflags |= DZ_CS7;
-			break;
-		case CS8: 
-		default:
-			info->cflags |= DZ_CS8;
-	}
-
-	if (cflag & CSTOPB)
-		info->cflags |= DZ_CSTOPB;
-	if (cflag & PARENB)
-		info->cflags |= DZ_PARENB;
-	if (cflag & PARODD)
-		info->cflags |= DZ_PARODD;
-  
-	baud = tty_get_baud_rate(info->tty);
-	switch (baud) {
-	case 50:
-		info->cflags |= DZ_B50;
-		break;
-	case 75:
-		info->cflags |= DZ_B75;
-		break;
-	case 110:
-		info->cflags |= DZ_B110;
-		break;
-	case 134:
-		info->cflags |= DZ_B134;
-		break; 
-	case 150:
-		info->cflags |= DZ_B150;
-		break;
-	case 300:
-		info->cflags |= DZ_B300;
-		break; 
-	case 600:
-		info->cflags |= DZ_B600;
-		break;
-	case 1200:
-		info->cflags |= DZ_B1200;
-		break; 
-	case 1800:
-		info->cflags |= DZ_B1800;
-		break;
-	case 2000:
-		info->cflags |= DZ_B2000;
-		break;
-	case 2400:
-		info->cflags |= DZ_B2400;
-		break;
-	case 3600:
-		info->cflags |= DZ_B3600;
-		break; 
-	case 4800:
-		info->cflags |= DZ_B4800;
-		break;
-	case 7200:
-		info->cflags |= DZ_B7200;
-		break; 
-	case 9600: 
-	default:
-		info->cflags |= DZ_B9600; 
-	}
-
-	info->cflags |= DZ_RXENAB;
-	dz_out(info, DZ_LPR, info->cflags);
-
-	/* setup accept flag */
-	info->read_status_mask = DZ_OERR;
-	if (I_INPCK(info->tty))
-		info->read_status_mask |= (DZ_FERR | DZ_PERR); 
-  
-	/* characters to ignore */
-	info->ignore_status_mask = 0;
-	if (I_IGNPAR(info->tty))
-		info->ignore_status_mask |= (DZ_FERR | DZ_PERR);
-
-	restore_flags(flags);
-}
-
-/* 
- * -------------------------------------------------------------------
- * dz_flush_char ()
- *
- * Flush the buffer.
- * ------------------------------------------------------------------- 
- */
-static void dz_flush_chars (struct tty_struct *tty)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;
-	unsigned long flags;
-
-	if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
-	    !info->xmit_buf)
-		return;
-
-	save_and_cli(flags);
-	dz_start (info->tty);
-	restore_flags(flags);
-}
-
-
-/* 
- * -------------------------------------------------------------------
- * dz_write ()
- *
- * main output routine.
- * ------------------------------------------------------------------- 
- */
-static int dz_write (struct tty_struct *tty, int from_user,
-                     const unsigned char *buf, int count)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;
-	unsigned long flags;
-	int c, ret = 0;
-
-	if (!tty )
-		return ret;
-	if (!info->xmit_buf)
-		return ret;
-	if (!tmp_buf)
-		tmp_buf = tmp_buffer;
-
-	if (from_user) {
-		down (&tmp_buf_sem);
-		while (1) {
-			c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1,
-			                   DZ_XMIT_SIZE - info->xmit_head));
-			if (c <= 0)
-				break;
-
-			c -= copy_from_user (tmp_buf, buf, c);
-			if (!c) {
-				if (!ret)
-					ret = -EFAULT;
-				break;
-			}
-
-			save_and_cli(flags);
-
-			c = MIN(c, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1,
-			               DZ_XMIT_SIZE - info->xmit_head));
-			memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c);
-			info->xmit_head = ((info->xmit_head + c) &
-					   (DZ_XMIT_SIZE - 1));
-			info->xmit_cnt += c;
-			restore_flags(flags);
-
-			buf += c;
-			count -= c;
-			ret += c;
-		}
-		up(&tmp_buf_sem);
-	} else {
-		while (1) {
-			save_and_cli(flags);
-
-			c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1,
-			                   DZ_XMIT_SIZE - info->xmit_head));
-			if (c <= 0) {
-				restore_flags (flags);
-				break;
-			}
-			memcpy(info->xmit_buf + info->xmit_head, buf, c);
-			info->xmit_head = ((info->xmit_head + c) &
-			                   (DZ_XMIT_SIZE-1));
-			info->xmit_cnt += c;
-			restore_flags(flags);
-
-			buf += c;
-			count -= c;
-			ret += c;
-		}
-	}
-
-	if (info->xmit_cnt) {
-		if (!tty->stopped) {
-			if (!tty->hw_stopped) {
-				dz_start (info->tty);
-			}
-		}
-	}
-
-	return ret;
-}
-
-/* 
- * -------------------------------------------------------------------
- * dz_write_room ()
- *
- * compute the amount of space available for writing.
- * ------------------------------------------------------------------- 
- */
-static int dz_write_room (struct tty_struct *tty)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;
-	int ret;
-
-	ret = DZ_XMIT_SIZE - info->xmit_cnt - 1;
-	if (ret < 0)
-		ret = 0;
-
-	return ret;
-}
-
-/* 
- * -------------------------------------------------------------------
- * dz_chars_in_buffer ()
- *
- * compute the amount of char left to be transmitted
- * ------------------------------------------------------------------- 
- */
-static int dz_chars_in_buffer (struct tty_struct *tty)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;
-  
-	return info->xmit_cnt;
-}
-
-/* 
- * -------------------------------------------------------------------
- * dz_flush_buffer ()
- *
- * Empty the output buffer
- * ------------------------------------------------------------------- 
- */
-static void dz_flush_buffer (struct tty_struct *tty)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;
-                                
-	cli();
-	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
-	sti();
-
-	wake_up_interruptible (&tty->write_wait);
-
-	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
-	     tty->ldisc.write_wakeup)
-		tty->ldisc.write_wakeup(tty);
-}
-
-/*
- * ------------------------------------------------------------
- * dz_throttle () and dz_unthrottle ()
- * 
- * This routine is called by the upper-layer tty layer to signal that
- * incoming characters should be throttled (or not).
- * ------------------------------------------------------------
- */
-static void dz_throttle (struct tty_struct *tty)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;  
-
-	if (I_IXOFF(tty))
-		info->x_char = STOP_CHAR(tty);
-}
-
-static void dz_unthrottle (struct tty_struct *tty)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;  
-
-	if (I_IXOFF(tty)) {
-		if (info->x_char)
-			info->x_char = 0;
-		else
-			info->x_char = START_CHAR(tty);
-	}
-}
-
-static void dz_send_xchar (struct tty_struct *tty, char ch)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;
-
-	info->x_char = ch;
-
-	if (ch)
-		dz_start(info->tty);
-}
-
-/*
- * ------------------------------------------------------------
- * rs_ioctl () and friends
- * ------------------------------------------------------------
- */
-static int get_serial_info(struct dz_serial *info,
-                           struct serial_struct *retinfo)
-{
-	struct serial_struct tmp;
-  
-	if (!retinfo)
-		return -EFAULT;
-
-	memset (&tmp, 0, sizeof(tmp));
-
-	tmp.type = info->type;
-	tmp.line = info->line;
-	tmp.port = info->port;
-	tmp.irq = SERIAL;
-	tmp.flags = info->flags;
-	tmp.baud_base = info->baud_base;
-	tmp.close_delay = info->close_delay;
-	tmp.closing_wait = info->closing_wait;
-
-	return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0;
-}
-
-static int set_serial_info (struct dz_serial *info,
-                            struct serial_struct *new_info)
-{
-	struct serial_struct new_serial;
-	struct dz_serial old_info;
-	int retval = 0;
-
-	if (!new_info)
-		return -EFAULT;
-
-	if (copy_from_user(&new_serial, new_info, sizeof(new_serial)))
-		return -EFAULT;
-
-	old_info = *info;
-
-	if (!capable(CAP_SYS_ADMIN))
-		return -EPERM;
-
-	if (info->count > 1)
-		return -EBUSY;
-
-	/*
-	 * OK, past this point, all the error checking has been done.
-	 * At this point, we start making changes.....
-	 */
-
-	info->baud_base = new_serial.baud_base;
-	info->type = new_serial.type;
-	info->close_delay = new_serial.close_delay;
-	info->closing_wait = new_serial.closing_wait;
-
-	retval = startup(info);
-
-	return retval;
-}
-
-/*
- * get_lsr_info - get line status register info
- *
- * Purpose: Let user call ioctl() to get info when the UART physically
- *          is emptied.  On bus types like RS485, the transmitter must
- *          release the bus after transmitting. This must be done when
- *          the transmit shift register is empty, not be done when the
- *          transmit holding register is empty.  This functionality
- *          allows an RS485 driver to be written in user space. 
- */
-static int get_lsr_info (struct dz_serial *info, unsigned int *value)
-{
-	unsigned short status = dz_in (info, DZ_LPR);
-
-	return put_user (status, value);
-}
-
-/*
- * This routine sends a break character out the serial port.
- */
-static void send_break (struct dz_serial *info, int duration)
-{
-	unsigned long flags;
-	unsigned short tmp, mask;
-
-	if (!info->port)
-		return;
-
-	mask = 1 << info->line;
-	tmp = dz_in (info, DZ_TCR);
-	tmp |= mask;
-
-	current->state = TASK_INTERRUPTIBLE;
-
-	save_and_cli(flags);
-	dz_out(info, DZ_TCR, tmp);
-	schedule_timeout(duration);
-	tmp &= ~mask;
-	dz_out(info, DZ_TCR, tmp);
-	restore_flags(flags);
-}
-
-static int dz_ioctl(struct tty_struct *tty, struct file *file,
-                    unsigned int cmd, unsigned long arg)
-{
-	int error;
-	struct dz_serial * info = (struct dz_serial *)tty->driver_data;
-	int retval;
-
-	if (cmd != TIOCGSERIAL && cmd != TIOCSSERIAL &&
-	    cmd != TIOCSERCONFIG && cmd != TIOCSERGWILD  &&
-	    cmd != TIOCSERSWILD && cmd != TIOCSERGSTRUCT) {
-		if (tty->flags & (1 << TTY_IO_ERROR))
-			return -EIO;
-	}
-
-	switch (cmd) {
-	case TCSBRK:		/* SVID version: non-zero arg --> no break */
-		retval = tty_check_change(tty);
-		if (retval)
-			return retval;
-		tty_wait_until_sent(tty, 0);
-		if (!arg)
-			send_break(info, HZ/4); /* 1/4 second */
-		return 0;
-
-	case TCSBRKP:		/* support for POSIX tcsendbreak() */
-		retval = tty_check_change(tty);
-		if (retval)
-			return retval;
-		tty_wait_until_sent(tty, 0);
-		send_break(info, arg ? arg*(HZ/10) : HZ/4);
-		return 0;
-
-	case TIOCGSOFTCAR:
-		return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *)arg);
-
-	case TIOCSSOFTCAR:
-		if (get_user (arg, (unsigned long *)arg))
-			return -EFAULT;
-
-		tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) |
-		                        (arg ? CLOCAL : 0);
-		return 0;
-
-	case TIOCGSERIAL:
-		return get_serial_info(info, (struct serial_struct *)arg);
-
-	case TIOCSSERIAL:
-		return set_serial_info(info, (struct serial_struct *) arg);
-
-	case TIOCSERGETLSR:		/* Get line status register */
-		return get_lsr_info (info, (unsigned int *)arg);
-
-	case TIOCSERGSTRUCT:
-		return copy_to_user((struct dz_serial *)arg, info,
-		                    sizeof(struct dz_serial)) ? -EFAULT : 0;
- 
-	default:
-		return -ENOIOCTLCMD;
-	}
-
-	return 0;
-}
-
-static void dz_set_termios (struct tty_struct *tty,
-			    struct termios *old_termios)
-{
-	struct dz_serial *info = (struct dz_serial *)tty->driver_data;
-
-	if (tty->termios->c_cflag == old_termios->c_cflag)
-		return;
-
-	change_speed (info);
-
-	if ((old_termios->c_cflag & CRTSCTS) &&
-	    !(tty->termios->c_cflag & CRTSCTS)) {
-		tty->hw_stopped = 0;
-		dz_start(tty);
-	}
-}
-
-/*
- * ------------------------------------------------------------
- * dz_close()
- * 
- * This routine is called when the serial port gets closed.  First, we
- * wait for the last remaining data to be sent.  Then, we turn off
- * the transmit enable and receive enable flags.
- * ------------------------------------------------------------
- */
-static void dz_close(struct tty_struct *tty, struct file *filp)
-{
-	struct dz_serial * info = (struct dz_serial *)tty->driver_data;
-	unsigned long flags;
-
-	if (!info)
-		return;
- 
-	save_and_cli(flags); 
-
-	if (tty_hung_up_p(filp)) {
-		restore_flags(flags);
-		return;
-	}
-
-	if ((tty->count == 1) && (info->count != 1)) {
-		/*
-		 * Uh, oh.  tty->count is 1, which means that the tty structure
-		 * will be freed.  Info->count should always be one in these
-		 * conditions.  If it's greater than one, we've got real
-		 * problems, since it means the serial port won't be shutdown.
-		 */
-		printk("dz_close: bad serial port count; tty->count is 1, "
-		       "info->count is %d\n", info->count);
-		info->count = 1;
-	}
-
-	if (--info->count < 0) {
-		printk("ds_close: bad serial port count for ttyS%02d: %d\n",
-		       info->line, info->count);
-		info->count = 0;
-	}
-
-	if (info->count) {
-		restore_flags(flags);
-		return;
-	}
-	info->flags |= DZ_CLOSING;
-	/*
-	 * Now we wait for the transmit buffer to clear; and we notify the line
-	 * discipline to only process XON/XOFF characters.
-	 */
-	tty->closing = 1;
-
-	if (info->closing_wait != DZ_CLOSING_WAIT_NONE)
-		tty_wait_until_sent(tty, info->closing_wait);
-
-	/*
-	 * At this point we stop accepting input.  To do this, we disable the
-	 * receive line status interrupts.
-	 */
-	shutdown(info);
-
-	if (tty->driver->flush_buffer)
-		tty->driver->flush_buffer (tty);
-	if (tty->ldisc.flush_buffer)
-		tty->ldisc.flush_buffer (tty);
-	tty->closing = 0;
-	info->event = 0;
-	info->tty = 0;
-
-	if (tty->ldisc.num != ldiscs[N_TTY].num) {
-		if (tty->ldisc.close)
-			tty->ldisc.close(tty);
-		tty->ldisc = ldiscs[N_TTY];
-		tty->termios->c_line = N_TTY;
-		if (tty->ldisc.open)
-			tty->ldisc.open(tty);
-	}
-	if (info->blocked_open) {
-		if (info->close_delay) {
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(info->close_delay);
-		}
-		wake_up_interruptible(&info->open_wait);
-	}
-
-	info->flags &= ~(DZ_NORMAL_ACTIVE | DZ_CLOSING);
-	wake_up_interruptible(&info->close_wait);
-
-	restore_flags(flags);
-}
-
-/*
- * dz_hangup () --- called by tty_hangup() when a hangup is signaled.
- */
-static void dz_hangup (struct tty_struct *tty)
-{
-	struct dz_serial *info = (struct dz_serial *) tty->driver_data;
-  
-	dz_flush_buffer(tty);
-	shutdown(info);
-	info->event = 0;
-	info->count = 0;
-	info->flags &= ~DZ_NORMAL_ACTIVE;
-	info->tty = 0;
-	wake_up_interruptible(&info->open_wait);
-}
-
-/*
- * ------------------------------------------------------------
- * rs_open() and friends
- * ------------------------------------------------------------
- */
-static int block_til_ready(struct tty_struct *tty, struct file *filp,
-                           struct dz_serial *info)
-{
-	DECLARE_WAITQUEUE(wait, current); 
-	int retval;
-	int do_clocal = 0;
-
-	/*
-	 * If the device is in the middle of being closed, then block
-	 * until it's done, and then try again.
-	 */
-	if (info->flags & DZ_CLOSING) {
-		interruptible_sleep_on(&info->close_wait);
-		return -EAGAIN;
-	}
-
-	/*
-	 * If non-blocking mode is set, or the port is not enabled, then make
-	 * the check up front and then exit.
-	 */
-	if ((filp->f_flags & O_NONBLOCK) ||
-	    (tty->flags & (1 << TTY_IO_ERROR))) {
-		info->flags |= DZ_NORMAL_ACTIVE;
-
-		return 0;
-	}
-
-	if (tty->termios->c_cflag & CLOCAL)
-		do_clocal = 1;
-
-	/*
-	 * Block waiting for the carrier detect and the line to become free
-	 * (i.e., not in use by the callout).  While we are in this loop,
-	 * info->count is dropped by one, so that dz_close() knows when to free
-	 * things.  We restore it upon exit, either normal or abnormal.
-	 */
-	retval = 0;
-	add_wait_queue(&info->open_wait, &wait);
-
-	info->count--;
-	info->blocked_open++;
-	while (1) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		if (tty_hung_up_p (filp) || !(info->is_initialized)) {
-			retval = -EAGAIN;
-			break;
-		}
-		if (!(info->flags & DZ_CLOSING) && do_clocal)
-			break;
-		if (signal_pending(current)) {
-			retval = -ERESTARTSYS;
-			break;
-		}
-		schedule();
-	}
-		
-	current->state = TASK_RUNNING;
-	remove_wait_queue (&info->open_wait, &wait);
-	if (!tty_hung_up_p(filp))
-		info->count++;
-	info->blocked_open--;
-
-	if (retval)
-		return retval;
-	info->flags |= DZ_NORMAL_ACTIVE;
-	return 0;
-}
-
-/*
- * This routine is called whenever a serial port is opened.  It
- * enables interrupts for a serial port. It also performs the 
- * serial-specific initialization for the tty structure.
- */
-static int dz_open (struct tty_struct *tty, struct file *filp)
-{
-	struct dz_serial *info;
-	int retval, line;
-
-	line = tty->index;
-
-	/*
-	 * The dz lines for the mouse/keyboard must be opened using their
-	 * respective drivers.
-	 */
-	if ((line < 0) || (line >= DZ_NB_PORT))
-		return -ENODEV;
-
-	if ((line == DZ_KEYBOARD) || (line == DZ_MOUSE))
-		return -ENODEV;
-
-	info = lines[line];
-	info->count++;
-
-	tty->driver_data = info;
-	info->tty = tty;
-
-	/*
-	 * Start up serial port
-	 */
-	retval = startup (info);
-	if (retval)
-		return retval;
-
-	retval = block_til_ready (tty, filp, info);
-	if (retval)
-		return retval;
-
-	return 0;
-}
-
-static void show_serial_version (void)
-{
-	printk("%s%s\n", dz_name, dz_version);
-}
-
-static struct tty_driver *serial_driver;
-
-static struct tty_operations serial_ops = {
-	.open = dz_open,
-	.close = dz_close,
-	.write = dz_write,
-	.flush_chars = dz_flush_chars,
-	.write_room = dz_write_room,
-	.chars_in_buffer = dz_chars_in_buffer,
-	.flush_buffer = dz_flush_buffer,
-	.ioctl = dz_ioctl,
-	.throttle = dz_throttle,
-	.unthrottle = dz_unthrottle,
-	.send_xchar = dz_send_xchar,
-	.set_termios = dz_set_termios,
-	.stop = dz_stop,
-	.start = dz_start,
-	.hangup = dz_hangup,
-};
-
-int __init dz_init(void)
-{
-	int i, flags;
-	struct dz_serial *info;
-
-	serial_driver = alloc_tty_driver(DZ_NB_PORT);
-	if (!serial_driver)
-		return -ENOMEM;
-
-	/* Setup base handler, and timer table. */
-	init_bh(SERIAL_BH, do_serial_bh);
-
-	show_serial_version();
-
-	serial_driver->owner = THIS_MODULE;
-	serial_driver->devfs_name = "tts/";
-	serial_driver->name = "ttyS";
-	serial_driver->major = TTY_MAJOR;
-	serial_driver->minor_start = 64;
-	serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
-	serial_driver->subtype = SERIAL_TYPE_NORMAL;
-	serial_driver->init_termios = tty_std_termios;
-	serial_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL |
-	                                     CLOCAL;
-	serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
-	tty_set_operations(serial_driver, &serial_ops);
-
-	if (tty_register_driver(serial_driver))
-		panic("Couldn't register serial driver\n");
-
-	save_flags(flags); cli();
-	for (i=0; i < DZ_NB_PORT;  i++) {
-		info = &multi[i]; 
-		lines[i] = info;
-		info->magic = SERIAL_MAGIC;
-
-		if ((mips_machtype == MACH_DS23100) ||
-		    (mips_machtype == MACH_DS5100)) 
-			info->port = (unsigned long) KN01_DZ11_BASE;
-		else 
-			info->port = (unsigned long) KN02_DZ11_BASE;
-
-		info->line = i;
-		info->tty = 0;
-		info->close_delay = 50;
-		info->closing_wait = 3000;
-		info->x_char = 0;
-		info->event = 0;
-		info->count = 0;
-		info->blocked_open = 0;
-		info->tqueue.routine = do_softint;
-		info->tqueue.data = info;
-		info->tqueue_hangup.routine = do_serial_hangup;
-		info->tqueue_hangup.data = info;
-		init_waitqueue_head(&info->open_wait); 
-		init_waitqueue_head(&info->close_wait); 
-
-		/*
-		 * If we are pointing to address zero then punt - not correctly
-		 * set up in setup.c to handle this.
-		 */
-		if (! info->port)
-			return 0;
-
-		printk("ttyS%02d at 0x%08x (irq = %d)\n", info->line,
-		       info->port, SERIAL);
-
-		tty_register_device(serial_driver, info->line, NULL);
-	}
-
-	/* Reset the chip */
-#ifndef CONFIG_SERIAL_CONSOLE
-	{
-		int tmp;
-		dz_out(info, DZ_CSR, DZ_CLR);
-		while ((tmp = dz_in(info,DZ_CSR)) & DZ_CLR);
-		wbflush();
-  
-		/* Enable scanning */
-		dz_out(info, DZ_CSR, DZ_MSE); 
-	}
-#endif
-  
-	/*
-	 * Order matters here... the trick is that flags is updated... in
-	 * request_irq - to immediatedly obliterate it is unwise.
-	 */
-	restore_flags(flags);
-
-	if (request_irq(SERIAL, dz_interrupt, SA_INTERRUPT, "DZ", lines[0]))
-		panic("Unable to register DZ interrupt\n");
- 
-	return 0;
-}
-
-#ifdef CONFIG_SERIAL_CONSOLE
-static void dz_console_put_char (unsigned char ch)
-{
-	unsigned long flags;
-	int  loops = 2500;
-	unsigned short tmp = ch;
-	/*
-	 * this code sends stuff out to serial device - spinning its wheels and
-	 * waiting.
-	 */
-
-	/* force the issue - point it at lines[3]*/
-	dz_console = &multi[CONSOLE_LINE];
-
-	save_and_cli(flags);
-
-	/* spin our wheels */
-	while (((dz_in(dz_console, DZ_CSR) & DZ_TRDY) != DZ_TRDY) &&  loops--)
-		;
-  
-	/* Actually transmit the character. */
-	dz_out(dz_console, DZ_TDR, tmp);
-
-	restore_flags(flags); 
-}
-
-/* 
- * -------------------------------------------------------------------
- * dz_console_print ()
- *
- * dz_console_print is registered for printk.
- * The console must be locked when we get here.
- * ------------------------------------------------------------------- 
- */
-static void dz_console_print (struct console *cons, 
-			      const char *str, 
-			      unsigned int count)
-{
-#ifdef DEBUG_DZ
-	prom_printf((char *)str);
-#endif
-	while (count--) {
-		if (*str == '\n')
-			dz_console_put_char('\r');
-		dz_console_put_char(*str++);
-	}
-}
-
-static struct tty_driver *dz_console_device(struct console *c, int *index)
-{
-	*index = c->index;
-	return serial_driver;
-}
-
-static int __init dz_console_setup(struct console *co, char *options)
-{
-	int baud = 9600;
-	int bits = 8;
-	int parity = 'n';
-	int cflag = CREAD | HUPCL | CLOCAL;
-	char *s;
-	unsigned short mask,tmp;
-
-	if (options) {
-		baud = simple_strtoul(options, NULL, 10);
-		s = options;
-		while (*s >= '0' && *s <= '9')
-			s++;
-		if (*s)
-			parity = *s++;
-		if (*s)
-			bits   = *s - '0';
-	}
-
-	/*
-	 * Now construct a cflag setting.
-	 */
-	switch (baud) {
-	case 1200:
-		cflag |= DZ_B1200;
-		break;
-	case 2400:
-		cflag |= DZ_B2400;
-		break;
-	case 4800:
-		cflag |= DZ_B4800;
-		break;
-	case 9600:
-	default:
-		cflag |= DZ_B9600;
-		break;
-	}
-	switch (bits) {
-	case 7:
-		cflag |= DZ_CS7;
-		break;
-	default:
-	case 8:
-		cflag |= DZ_CS8;
-		break;
-	}
-	switch (parity) {
-	case 'o':
-	case 'O':
-		cflag |= DZ_PARODD;
-		break;
-	case 'e':
-	case 'E':
-		cflag |= DZ_PARENB;
-		break;
-	}
-	co->cflag = cflag;
-
-	/* TOFIX: force to console line */
-	dz_console = &multi[CONSOLE_LINE];
-	if ((mips_machtype == MACH_DS23100) || (mips_machtype == MACH_DS5100)) 
-		dz_console->port = KN01_DZ11_BASE;
-	else 
-		dz_console->port = KN02_DZ11_BASE; 
-	dz_console->line = CONSOLE_LINE;
-
-	dz_out(dz_console, DZ_CSR, DZ_CLR);
-	while ((tmp = dz_in(dz_console,DZ_CSR)) & DZ_CLR)
-		;
-
-	/* enable scanning */
-	dz_out(dz_console, DZ_CSR, DZ_MSE); 
-
-	/*  Set up flags... */
-	dz_console->cflags = 0;
-	dz_console->cflags |= DZ_B9600;
-	dz_console->cflags |= DZ_CS8;
-	dz_console->cflags |= DZ_PARENB;
-	dz_out(dz_console, DZ_LPR, dz_console->cflags);
-
-	mask = 1 << dz_console->line;
-	tmp = dz_in (dz_console, DZ_TCR);		/* read the TX flag */
-	if (!(tmp & mask)) {
-		tmp |= mask;				/* set the TX flag */
-		dz_out (dz_console, DZ_TCR, tmp); 
-	}
-
-	return 0;
-}
-
-static struct console dz_sercons = {
-    .name	= "ttyS",
-    .write	= dz_console_print,
-    .device	= dz_console_device,
-    .setup	= dz_console_setup,
-    .flags	= CON_CONSDEV | CON_PRINTBUFFER,
-    .index	= CONSOLE_LINE,
-};
-
-void __init dz_serial_console_init(void)
-{
-	register_console(&dz_sercons);
-}
-
-#endif /* ifdef CONFIG_SERIAL_CONSOLE */
-
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/char/dz.h b/drivers/char/dz.h
--- a/drivers/char/dz.h	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,230 +0,0 @@
-/*
- * dz.h: Serial port driver for DECStations equiped 
- *       with the DZ chipset.
- *
- * Copyright (C) 1998 Olivier A. D. Lebaillif 
- *             
- * Email: olivier.lebaillif@ifrsys.com
- *
- */
-#ifndef DZ_SERIAL_H
-#define DZ_SERIAL_H
-
-/*
- * Definitions for the Control and Status Received.
- */
-#define DZ_TRDY        0x8000                 /* Transmitter empty */
-#define DZ_TIE         0x4000                 /* Transmitter Interrupt Enable */
-#define DZ_RDONE       0x0080                 /* Receiver data ready */
-#define DZ_RIE         0x0040                 /* Receive Interrupt Enable */
-#define DZ_MSE         0x0020                 /* Master Scan Enable */
-#define DZ_CLR         0x0010                 /* Master reset */
-#define DZ_MAINT       0x0008                 /* Loop Back Mode */
-
-/*
- * Definitions for the Received buffer. 
- */
-#define DZ_RBUF_MASK   0x00FF                 /* Data Mask in the Receive Buffer */
-#define DZ_LINE_MASK   0x0300                 /* Line Mask in the Receive Buffer */
-#define DZ_DVAL        0x8000                 /* Valid Data indicator */
-#define DZ_OERR        0x4000                 /* Overrun error indicator */
-#define DZ_FERR        0x2000                 /* Frame error indicator */
-#define DZ_PERR        0x1000                 /* Parity error indicator */
-
-#define LINE(x) (x & DZ_LINE_MASK) >> 8       /* Get the line number from the input buffer */
-#define UCHAR(x) (unsigned char)(x & DZ_RBUF_MASK)
-
-/*
- * Definitions for the Transmit Register.
- */
-#define DZ_LINE_KEYBOARD 0x0001
-#define DZ_LINE_MOUSE    0x0002
-#define DZ_LINE_MODEM    0x0004
-#define DZ_LINE_PRINTER  0x0008
-
-#define DZ_MODEM_DTR     0x0400               /* DTR for the modem line (2) */
-
-/*
- * Definitions for the Modem Status Register.
- */
-#define DZ_MODEM_DSR     0x0200               /* DSR for the modem line (2) */
-
-/*
- * Definitions for the Transmit Data Register.
- */
-#define DZ_BRK0          0x0100               /* Break assertion for line 0 */
-#define DZ_BRK1          0x0200               /* Break assertion for line 1 */
-#define DZ_BRK2          0x0400               /* Break assertion for line 2 */
-#define DZ_BRK3          0x0800               /* Break assertion for line 3 */
-
-/*
- * Definitions for the Line Parameter Register.
- */
-#define DZ_KEYBOARD      0x0000               /* line 0 = keyboard */
-#define DZ_MOUSE         0x0001               /* line 1 = mouse */
-#define DZ_MODEM         0x0002               /* line 2 = modem */
-#define DZ_PRINTER       0x0003               /* line 3 = printer */
-
-#define DZ_CSIZE         0x0018               /* Number of bits per byte (mask) */
-#define DZ_CS5           0x0000               /* 5 bits per byte */
-#define DZ_CS6           0x0008               /* 6 bits per byte */
-#define DZ_CS7           0x0010               /* 7 bits per byte */
-#define DZ_CS8           0x0018               /* 8 bits per byte */
-
-#define DZ_CSTOPB        0x0020               /* 2 stop bits instead of one */ 
-
-#define DZ_PARENB        0x0040               /* Parity enable */
-#define DZ_PARODD        0x0080               /* Odd parity instead of even */
-
-#define DZ_CBAUD         0x0E00               /* Baud Rate (mask) */
-#define DZ_B50           0x0000
-#define DZ_B75           0x0100
-#define DZ_B110          0x0200
-#define DZ_B134          0x0300
-#define DZ_B150          0x0400
-#define DZ_B300          0x0500
-#define DZ_B600          0x0600
-#define DZ_B1200         0x0700 
-#define DZ_B1800         0x0800
-#define DZ_B2000         0x0900
-#define DZ_B2400         0x0A00
-#define DZ_B3600         0x0B00
-#define DZ_B4800         0x0C00
-#define DZ_B7200         0x0D00
-#define DZ_B9600         0x0E00
-
-#define DZ_CREAD         0x1000               /* Enable receiver */
-#define DZ_RXENAB        0x1000               /* enable receive char */
-/*
- * Addresses for the DZ registers
- */
-#define DZ_CSR       0x00            /* Control and Status Register */
-#define DZ_RBUF      0x08            /* Receive Buffer */
-#define DZ_LPR       0x08            /* Line Parameters Register */
-#define DZ_TCR       0x10            /* Transmitter Control Register */
-#define DZ_MSR       0x18            /* Modem Status Register */
-#define DZ_TDR       0x18            /* Transmit Data Register */
-
-
-#define DZ_NB_PORT 4
-
-#define DZ_XMIT_SIZE   4096                 /* buffer size */
-#define WAKEUP_CHARS   DZ_XMIT_SIZE/4
-
-#define DZ_EVENT_WRITE_WAKEUP   0
-
-#ifndef MIN
-#define MIN(a,b)        ((a) < (b) ? (a) : (b))
-
-#define DZ_INITIALIZED       0x80000000 /* Serial port was initialized */
-#define DZ_CALLOUT_ACTIVE    0x40000000 /* Call out device is active */
-#define DZ_NORMAL_ACTIVE     0x20000000 /* Normal device is active */
-#define DZ_BOOT_AUTOCONF     0x10000000 /* Autoconfigure port on bootup */
-#define DZ_CLOSING           0x08000000 /* Serial port is closing */
-#define DZ_CTS_FLOW          0x04000000 /* Do CTS flow control */
-#define DZ_CHECK_CD          0x02000000 /* i.e., CLOCAL */
-
-#define DZ_CLOSING_WAIT_INF  0
-#define DZ_CLOSING_WAIT_NONE 65535
-
-#define DZ_SPLIT_TERMIOS   0x0008 /* Separate termios for dialin/callout */
-#define DZ_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
-#define DZ_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
-
-struct dz_serial {
-  unsigned                port;                /* base address for the port */
-  int                     type;
-  int                     flags; 
-  int                     baud_base;
-  int                     blocked_open;
-  unsigned short          close_delay;
-  unsigned short          closing_wait;
-  unsigned short          line;                /* port/line number */
-  unsigned short          cflags;              /* line configuration flag */
-  unsigned short          x_char;              /* xon/xoff character */
-  unsigned short          read_status_mask;    /* mask for read condition */
-  unsigned short          ignore_status_mask;  /* mask for ignore condition */
-  unsigned long           event;               /* mask used in BH */
-  unsigned char           *xmit_buf;           /* Transmit buffer */
-  int                     xmit_head;           /* Position of the head */
-  int                     xmit_tail;           /* Position of the tail */
-  int                     xmit_cnt;            /* Count of the chars in the buffer */
-  int                     count;               /* indicates how many times it has been opened */
-  int                     magic;
-
-  struct async_icount     icount;              /* keep track of things ... */
-  struct tty_struct       *tty;                /* tty associated */
-  struct tq_struct        tqueue;              /* Queue for BH */
-  struct tq_struct        tqueue_hangup;
-  wait_queue_head_t       open_wait;
-  wait_queue_head_t       close_wait;
-
-  unsigned char           is_console;          /* flag indicating a serial console */
-  unsigned char           is_initialized;
-};
-
-static struct dz_serial multi[DZ_NB_PORT];    /* Four serial lines in the DZ chip */
-static struct dz_serial *dz_console;
-
-/*
- * tmp_buf is used as a temporary buffer by serial_write.  We need to
- * lock it in case the copy_from_user blocks while swapping in a page,
- * and some other program tries to do a serial write at the same time.
- * Since the lock will only come under contention when the system is
- * swapping and available memory is low, it makes sense to share one
- * buffer across all the serial ports, since it significantly saves
- * memory if large numbers of serial ports are open.
- */
-static unsigned char *tmp_buf;
-static DECLARE_MUTEX(tmp_buf_sem);
-
-static char *dz_name = "DECstation DZ serial driver version ";
-static char *dz_version = "1.02";
-
-static inline unsigned short dz_in (struct dz_serial *, unsigned);
-static inline void dz_out (struct dz_serial *, unsigned, unsigned short);
-
-static inline void dz_sched_event (struct dz_serial *, int);
-static inline void receive_chars (struct dz_serial *);
-static inline void transmit_chars (struct dz_serial *);
-static inline void check_modem_status (struct dz_serial *);
-
-static void dz_stop (struct tty_struct *);
-static void dz_start (struct tty_struct *);
-static void dz_interrupt (int, void *, struct pt_regs *);
-static void do_serial_bh (void);
-static void do_softint (void *);
-static void do_serial_hangup (void *);
-static void change_speed (struct dz_serial *);
-static void dz_flush_chars (struct tty_struct *);
-static void dz_console_print (struct console *, const char *, unsigned int);
-static void dz_flush_buffer (struct tty_struct *);
-static void dz_throttle (struct tty_struct *);
-static void dz_unthrottle (struct tty_struct *);
-static void dz_send_xchar (struct tty_struct *, char);
-static void shutdown (struct dz_serial *);
-static void send_break (struct dz_serial *, int);
-static void dz_set_termios (struct tty_struct *, struct termios *);
-static void dz_close (struct tty_struct *, struct file *);
-static void dz_hangup (struct tty_struct *);
-static void show_serial_version (void);
-
-static int dz_write (struct tty_struct *, int, const unsigned char *, int);
-static int dz_write_room (struct tty_struct *);
-static int dz_chars_in_buffer (struct tty_struct *);
-static int startup (struct dz_serial *);
-static int get_serial_info (struct dz_serial *, struct serial_struct *);
-static int set_serial_info (struct dz_serial *, struct serial_struct *);
-static int get_lsr_info (struct dz_serial *, unsigned int *);
-static int dz_ioctl (struct tty_struct *, struct file *, unsigned int, unsigned long);
-static int block_til_ready (struct tty_struct *, struct file *, struct dz_serial *);
-static int dz_open (struct tty_struct *, struct file *);
-
-#ifdef MODULE
-int init_module (void)
-void cleanup_module (void)
-#endif
-
-#endif
-
-#endif /* DZ_SERIAL_H */
diff -Nru a/drivers/char/hw_random.c b/drivers/char/hw_random.c
--- a/drivers/char/hw_random.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/char/hw_random.c	Tue Jun 15 22:20:39 2004
@@ -79,7 +79,7 @@
 #define RNG_MISCDEV_MINOR		183 /* official */
 
 static int rng_dev_open (struct inode *inode, struct file *filp);
-static ssize_t rng_dev_read (struct file *filp, char *buf, size_t size,
+static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
 			     loff_t * offp);
 
 static int __init intel_init (struct pci_dev *dev);
@@ -482,7 +482,7 @@
 }
 
 
-static ssize_t rng_dev_read (struct file *filp, char *buf, size_t size,
+static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
 			     loff_t * offp)
 {
 	static spinlock_t rng_lock = SPIN_LOCK_UNLOCKED;
diff -Nru a/drivers/char/i8k.c b/drivers/char/i8k.c
--- a/drivers/char/i8k.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/i8k.c	Tue Jun 15 22:20:37 2004
@@ -79,7 +79,7 @@
 MODULE_PARM_DESC(restricted, "Allow fan control if SYS_ADMIN capability set");
 MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k");
 
-static ssize_t i8k_read(struct file *, char *, size_t, loff_t *);
+static ssize_t i8k_read(struct file *, char __user *, size_t, loff_t *);
 static int i8k_ioctl(struct inode *, struct file *, unsigned int,
 		     unsigned long);
 
@@ -330,10 +330,10 @@
     int val;
     int speed;
     unsigned char buff[16];
+    int __user *argp = (int __user *)arg;
 
-    if (!arg) {
+    if (!argp)
 	return -EINVAL;
-    }
 
     switch (cmd) {
     case I8K_BIOS_VERSION:
@@ -358,14 +358,14 @@
 	break;
 
     case I8K_GET_SPEED:
-	if (copy_from_user(&val, (int *)arg, sizeof(int))) {
+	if (copy_from_user(&val, argp, sizeof(int))) {
 	    return -EFAULT;
 	}
 	val = i8k_get_fan_speed(val);
 	break;
 
     case I8K_GET_FAN:
-	if (copy_from_user(&val, (int *)arg, sizeof(int))) {
+	if (copy_from_user(&val, argp, sizeof(int))) {
 	    return -EFAULT;
 	}
 	val = i8k_get_fan_status(val);
@@ -375,10 +375,10 @@
 	if (restricted && !capable(CAP_SYS_ADMIN)) {
 	    return -EPERM;
 	}
-	if (copy_from_user(&val, (int *)arg, sizeof(int))) {
+	if (copy_from_user(&val, argp, sizeof(int))) {
 	    return -EFAULT;
 	}
-	if (copy_from_user(&speed, (int *)arg+1, sizeof(int))) {
+	if (copy_from_user(&speed, argp+1, sizeof(int))) {
 	    return -EFAULT;
 	}
 	val = i8k_set_fan(val, speed);
@@ -394,17 +394,17 @@
 
     switch (cmd) {
     case I8K_BIOS_VERSION:
-	if (copy_to_user((int *)arg, &val, 4)) {
+	if (copy_to_user(argp, &val, 4)) {
 	    return -EFAULT;
 	}
 	break;
     case I8K_MACHINE_ID:
-	if (copy_to_user((int *)arg, buff, 16)) {
+	if (copy_to_user(argp, buff, 16)) {
 	    return -EFAULT;
 	}
 	break;
     default:
-	if (copy_to_user((int *)arg, &val, sizeof(int))) {
+	if (copy_to_user(argp, &val, sizeof(int))) {
 	    return -EFAULT;
 	}
 	break;
@@ -462,7 +462,7 @@
     return n;
 }
 
-static ssize_t i8k_read(struct file *f, char *buffer, size_t len, loff_t *fpos)
+static ssize_t i8k_read(struct file *f, char __user *buffer, size_t len, loff_t *fpos)
 {
     int n;
     char info[128];
diff -Nru a/drivers/char/ip2main.c b/drivers/char/ip2main.c
--- a/drivers/char/ip2main.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/ip2main.c	Tue Jun 15 22:21:05 2004
@@ -99,6 +99,7 @@
 #include <linux/slab.h>
 #include <linux/major.h>
 #include <linux/wait.h>
+#include <linux/device.h>
 
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
@@ -301,6 +302,9 @@
 static char rirqs[IP2_MAX_BOARDS];
 static int Valid_Irqs[] = { 3, 4, 5, 7, 10, 11, 12, 15, 0};
 
+/* for sysfs class support */
+static struct class_simple *ip2_class;
+
 // Some functions to keep track of what irq's we have
 
 static int __init
@@ -411,7 +415,9 @@
 			iiResetDelay( i2BoardPtrTable[i] );
 			/* free io addresses and Tibet */
 			release_region( ip2config.addr[i], 8 );
+			class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, 4 * i)); 
 			devfs_remove("ip2/ipl%d", i);
+			class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, 4 * i + 1));
 			devfs_remove("ip2/stat%d", i);
 		}
 		/* Disable and remove interrupt handler. */
@@ -420,6 +426,7 @@
 			clear_requested_irq( ip2config.irq[i]);
 		}
 	}
+	class_simple_destroy(ip2_class);
 	devfs_remove("ip2");
 	if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) {
 		printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err);
@@ -494,7 +501,7 @@
 ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) 
 {
 	int i, j, box;
-	int err;
+	int err = 0;
 	int status = 0;
 	static int loaded;
 	i2eBordStrPtr pB = NULL;
@@ -683,7 +690,14 @@
 	/* Register the IPL driver. */
 	if ( ( err = register_chrdev ( IP2_IPL_MAJOR, pcIpl, &ip2_ipl ) ) ) {
 		printk(KERN_ERR "IP2: failed to register IPL device (%d)\n", err );
-	} else
+	} else {
+		/* create the sysfs class */
+		ip2_class = class_simple_create(THIS_MODULE, "ip2");
+		if (IS_ERR(ip2_class)) {
+			err = PTR_ERR(ip2_class);
+			goto out_chrdev;	
+		}
+	}
 	/* Register the read_procmem thing */
 	if (!create_proc_info_entry("ip2mem",0,&proc_root,ip2_read_procmem)) {
 		printk(KERN_ERR "IP2: failed to register read_procmem\n");
@@ -700,13 +714,27 @@
 			}
 
 			if ( NULL != ( pB = i2BoardPtrTable[i] ) ) {
-				devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i),
+				class_simple_device_add(ip2_class, MKDEV(IP2_IPL_MAJOR, 
+						4 * i), NULL, "ipl%d", i);
+				err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i),
 						S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
 						"ip2/ipl%d", i);
+				if (err) {
+					class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, 
+						4 * i));
+					goto out_class;
+				}
 
-				devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i + 1),
+				class_simple_device_add(ip2_class, MKDEV(IP2_IPL_MAJOR, 
+						4 * i + 1), NULL, "stat%d", i);
+				err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i + 1),
 						S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
 						"ip2/stat%d", i);
+				if (err) {
+					class_simple_device_remove(MKDEV(IP2_IPL_MAJOR, 
+						4 * i + 1));
+					goto out_class;
+				}
 
 			    for ( box = 0; box < ABS_MAX_BOXES; ++box )
 			    {
@@ -759,8 +787,14 @@
 		}
 	}
 	ip2trace (ITRC_NO_PORT, ITRC_INIT, ITRC_RETURN, 0 );
+	goto out;
 
-	return 0;
+out_class:
+	class_simple_destroy(ip2_class);
+out_chrdev:
+	unregister_chrdev(IP2_IPL_MAJOR, "ip2");
+out:
+	return err;
 }
 
 EXPORT_SYMBOL(ip2_loadmain);
diff -Nru a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c
--- a/drivers/char/ipmi/ipmi_bt_sm.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/char/ipmi/ipmi_bt_sm.c	Tue Jun 15 22:20:44 2004
@@ -445,7 +445,7 @@
 
 	case BT_STATE_RESET1:
     		reset_flags(bt);
-    		bt->timeout = BT_RESET_DELAY;;
+    		bt->timeout = BT_RESET_DELAY;
 		bt->state = BT_STATE_RESET2;
 		break;
 
diff -Nru a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
--- a/drivers/char/ipmi/ipmi_msghandler.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/char/ipmi/ipmi_msghandler.c	Tue Jun 15 22:20:41 2004
@@ -123,6 +123,12 @@
 	unsigned char protocol;
 };
 
+struct ipmi_proc_entry
+{
+	char                   *name;
+	struct ipmi_proc_entry *next;
+};
+
 #define IPMI_IPMB_NUM_SEQ	64
 #define IPMI_MAX_CHANNELS       8
 struct ipmi_smi
@@ -149,6 +155,11 @@
 	struct ipmi_smi_handlers *handlers;
 	void                     *send_info;
 
+	/* A list of proc entries for this interface.  This does not
+	   need a lock, only one thread creates it and only one thread
+	   destroys it. */
+	struct ipmi_proc_entry *proc_entries;
+
 	/* A table of sequence numbers for this interface.  We use the
            sequence numbers for IPMB messages that go out of the
            interface to match them up with their responses.  A routine
@@ -1515,18 +1526,36 @@
 			    read_proc_t *read_proc, write_proc_t *write_proc,
 			    void *data, struct module *owner)
 {
-	struct proc_dir_entry *file;
-	int                   rv = 0;
+	struct proc_dir_entry  *file;
+	int                    rv = 0;
+	struct ipmi_proc_entry *entry;
+
+	/* Create a list element. */
+	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+	if (!entry)
+		return -ENOMEM;
+	entry->name = kmalloc(strlen(name)+1, GFP_KERNEL);
+	if (!entry->name) {
+		kfree(entry);
+		return -ENOMEM;
+	}
+	strcpy(entry->name, name);
 
 	file = create_proc_entry(name, 0, smi->proc_dir);
-	if (!file)
+	if (!file) {
+		kfree(entry->name);
+		kfree(entry);
 		rv = -ENOMEM;
-	else {
+	} else {
 		file->nlink = 1;
 		file->data = data;
 		file->read_proc = read_proc;
 		file->write_proc = write_proc;
 		file->owner = owner;
+
+		/* Stick it on the list. */
+		entry->next = smi->proc_entries;
+		smi->proc_entries = entry;
 	}
 
 	return rv;
@@ -1562,6 +1591,21 @@
 	return rv;
 }
 
+static void remove_proc_entries(ipmi_smi_t smi)
+{
+	struct ipmi_proc_entry *entry;
+
+	while (smi->proc_entries) {
+		entry = smi->proc_entries;
+		smi->proc_entries = entry->next;
+
+		remove_proc_entry(entry->name, smi->proc_dir);
+		kfree(entry->name);
+		kfree(entry);
+	}
+	remove_proc_entry(smi->proc_dir_name, proc_ipmi_root);
+}
+
 static int
 send_channel_info_cmd(ipmi_smi_t intf, int chan)
 {
@@ -1749,8 +1793,7 @@
 
 	if (rv) {
 		if (new_intf->proc_dir)
-			remove_proc_entry(new_intf->proc_dir_name,
-					  proc_ipmi_root);
+			remove_proc_entries(new_intf);
 		kfree(new_intf);
 	}
 
@@ -1806,8 +1849,7 @@
 	{
 		for (i=0; i<MAX_IPMI_INTERFACES; i++) {
 			if (ipmi_interfaces[i] == intf) {
-				remove_proc_entry(intf->proc_dir_name,
-						  proc_ipmi_root);
+				remove_proc_entries(intf);
 				spin_lock_irqsave(&interfaces_lock, flags);
 				ipmi_interfaces[i] = NULL;
 				clean_up_interface_data(intf);
diff -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	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/ipmi/ipmi_si_intf.c	Tue Jun 15 22:20:37 2004
@@ -905,10 +905,10 @@
 		 " has an interrupt.  Otherwise, set it to zero or leave"
 		 " it blank.");
 
-
-#if defined(CONFIG_ACPI_INTERPETER) || defined(CONFIG_X86) || defined(CONFIG_PCI)
 #define IPMI_MEM_ADDR_SPACE 1
 #define IPMI_IO_ADDR_SPACE  2
+
+#if defined(CONFIG_ACPI_INTERPETER) || defined(CONFIG_X86) || defined(CONFIG_PCI)
 static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr)
 {
 	int i;
diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c
--- a/drivers/char/lp.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/char/lp.c	Tue Jun 15 22:20:36 2004
@@ -291,7 +291,7 @@
 	return error;
 }
 
-static ssize_t lp_write(struct file * file, const char * buf,
+static ssize_t lp_write(struct file * file, const char __user * buf,
 		        size_t count, loff_t *ppos)
 {
 	unsigned int minor = iminor(file->f_dentry->d_inode);
@@ -407,7 +407,7 @@
 #ifdef CONFIG_PARPORT_1284
 
 /* Status readback conforming to ieee1284 */
-static ssize_t lp_read(struct file * file, char * buf,
+static ssize_t lp_read(struct file * file, char __user * buf,
 		       size_t count, loff_t *ppos)
 {
 	unsigned int minor=iminor(file->f_dentry->d_inode);
@@ -560,6 +560,7 @@
 	unsigned int minor = iminor(inode);
 	int status;
 	int retval = 0;
+	void __user *argp = (void __user *)arg;
 
 #ifdef LP_DEBUG
 	printk(KERN_DEBUG "lp%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg);
@@ -603,7 +604,7 @@
 			return -EINVAL;
 			break;
 		case LPGETIRQ:
-			if (copy_to_user((int *) arg, &LP_IRQ(minor),
+			if (copy_to_user(argp, &LP_IRQ(minor),
 					sizeof(int)))
 				return -EFAULT;
 			break;
@@ -612,7 +613,7 @@
 			status = r_str(minor);
 			lp_release_parport (&lp_table[minor]);
 
-			if (copy_to_user((int *) arg, &status, sizeof(int)))
+			if (copy_to_user(argp, &status, sizeof(int)))
 				return -EFAULT;
 			break;
 		case LPRESET:
@@ -620,7 +621,7 @@
 			break;
 #ifdef LP_STATS
 		case LPGETSTATS:
-			if (copy_to_user((int *) arg, &LP_STAT(minor),
+			if (copy_to_user(argp, &LP_STAT(minor),
 					sizeof(struct lp_stats)))
 				return -EFAULT;
 			if (capable(CAP_SYS_ADMIN))
@@ -630,13 +631,12 @@
 #endif
  		case LPGETFLAGS:
  			status = LP_F(minor);
-			if (copy_to_user((int *) arg, &status, sizeof(int)))
+			if (copy_to_user(argp, &status, sizeof(int)))
 				return -EFAULT;
 			break;
 
 		case LPSETTIMEOUT:
-			if (copy_from_user (&par_timeout,
-					    (struct timeval *) arg,
+			if (copy_from_user (&par_timeout, argp,
 					    sizeof (struct timeval))) {
 				return -EFAULT;
 			}
diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c
--- a/drivers/char/mem.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/mem.c	Tue Jun 15 22:20:40 2004
@@ -62,6 +62,19 @@
 		  test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) ||
 		  test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) )
 	  && addr >= __pa(high_memory);
+#elif defined(__x86_64__)
+	/* 
+	 * This is broken because it can generate memory type aliases,
+	 * which can cause cache corruptions
+	 * But it is only available for root and we have to be bug-to-bug
+	 * compatible with i386.
+	 */
+	if (file->f_flags & O_SYNC)
+		return 1;
+	/* same behaviour as i386. PAT always set to cached and MTRRs control the
+	   caching behaviour. 
+	   Hopefully a full PAT implementation will fix that soon. */	   
+	return 0;
 #elif defined(CONFIG_IA64)
 	/*
 	 * On ia64, we ignore O_SYNC because we cannot tolerate memory attribute aliases.
@@ -103,7 +116,7 @@
 #endif
 
 static ssize_t do_write_mem(void *p, unsigned long realp,
-			    const char * buf, size_t count, loff_t *ppos)
+			    const char __user * buf, size_t count, loff_t *ppos)
 {
 	ssize_t written;
 	unsigned long copied;
@@ -139,7 +152,7 @@
  * This funcion reads the *physical* memory. The f_pos points directly to the 
  * memory location. 
  */
-static ssize_t read_mem(struct file * file, char * buf,
+static ssize_t read_mem(struct file * file, char __user * buf,
 			size_t count, loff_t *ppos)
 {
 	unsigned long p = *ppos;
@@ -171,7 +184,7 @@
 	return read;
 }
 
-static ssize_t write_mem(struct file * file, const char * buf, 
+static ssize_t write_mem(struct file * file, const char __user * buf, 
 			 size_t count, loff_t *ppos)
 {
 	unsigned long p = *ppos;
@@ -213,7 +226,7 @@
 /*
  * This function reads the *virtual* memory as seen by the kernel.
  */
-static ssize_t read_kmem(struct file *file, char *buf, 
+static ssize_t read_kmem(struct file *file, char __user *buf, 
 			 size_t count, loff_t *ppos)
 {
 	unsigned long p = *ppos;
@@ -276,7 +289,7 @@
 /*
  * This function writes to the *virtual* memory as seen by the kernel.
  */
-static ssize_t write_kmem(struct file * file, const char * buf, 
+static ssize_t write_kmem(struct file * file, const char __user * buf, 
 			  size_t count, loff_t *ppos)
 {
 	unsigned long p = *ppos;
@@ -333,11 +346,11 @@
 }
 
 #if defined(CONFIG_ISA) || !defined(__mc68000__)
-static ssize_t read_port(struct file * file, char * buf,
+static ssize_t read_port(struct file * file, char __user * buf,
 			 size_t count, loff_t *ppos)
 {
 	unsigned long i = *ppos;
-	char *tmp = buf;
+	char __user *tmp = buf;
 
 	if (verify_area(VERIFY_WRITE,buf,count))
 		return -EFAULT; 
@@ -351,11 +364,11 @@
 	return tmp-buf;
 }
 
-static ssize_t write_port(struct file * file, const char * buf,
+static ssize_t write_port(struct file * file, const char __user * buf,
 			  size_t count, loff_t *ppos)
 {
 	unsigned long i = *ppos;
-	const char * tmp = buf;
+	const char __user * tmp = buf;
 
 	if (verify_area(VERIFY_READ,buf,count))
 		return -EFAULT;
@@ -372,13 +385,13 @@
 }
 #endif
 
-static ssize_t read_null(struct file * file, char * buf,
+static ssize_t read_null(struct file * file, char __user * buf,
 			 size_t count, loff_t *ppos)
 {
 	return 0;
 }
 
-static ssize_t write_null(struct file * file, const char * buf,
+static ssize_t write_null(struct file * file, const char __user * buf,
 			  size_t count, loff_t *ppos)
 {
 	return count;
@@ -388,7 +401,7 @@
 /*
  * For fun, we are using the MMU for this.
  */
-static inline size_t read_zero_pagealigned(char * buf, size_t size)
+static inline size_t read_zero_pagealigned(char __user * buf, size_t size)
 {
 	struct mm_struct *mm;
 	struct vm_area_struct * vma;
@@ -438,7 +451,7 @@
 	return size;
 }
 
-static ssize_t read_zero(struct file * file, char * buf, 
+static ssize_t read_zero(struct file * file, char __user * buf, 
 			 size_t count, loff_t *ppos)
 {
 	unsigned long left, unwritten, written = 0;
@@ -510,7 +523,7 @@
 }
 #endif /* CONFIG_MMU */
 
-static ssize_t write_full(struct file * file, const char * buf,
+static ssize_t write_full(struct file * file, const char __user * buf,
 			  size_t count, loff_t *ppos)
 {
 	return -ENOSPC;
@@ -615,7 +628,7 @@
 	.write		= write_full,
 };
 
-static ssize_t kmsg_write(struct file * file, const char * buf,
+static ssize_t kmsg_write(struct file * file, const char __user * buf,
 			  size_t count, loff_t *ppos)
 {
 	char *tmp;
diff -Nru a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c
--- a/drivers/char/mwave/mwavedd.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/mwave/mwavedd.c	Tue Jun 15 22:20:38 2004
@@ -466,6 +466,7 @@
 
 static struct miscdevice mwave_misc_dev = { MWAVE_MINOR, "mwave", &mwave_fops };
 
+#if 0 /* totally b0rked */
 /*
  * sysfs support <paulsch@us.ibm.com>
  */
@@ -499,6 +500,7 @@
 	&dev_attr_uart_irq,
 	&dev_attr_uart_io,
 };
+#endif
 
 /*
 * mwave_init is called on module load
@@ -508,11 +510,11 @@
 */
 static void mwave_exit(void)
 {
-	int i;
 	pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
 
 	PRINTK_1(TRACE_MWAVE, "mwavedd::mwave_exit entry\n");
 
+#if 0
 	for (i = 0; i < pDrvData->nr_registered_attrs; i++)
 		device_remove_file(&mwave_device, mwave_dev_attrs[i]);
 	pDrvData->nr_registered_attrs = 0;
@@ -521,6 +523,7 @@
 		device_unregister(&mwave_device);
 		pDrvData->device_registered = FALSE;
 	}
+#endif
 
 	if ( pDrvData->sLine >= 0 ) {
 		unregister_serial(pDrvData->sLine);
@@ -638,6 +641,7 @@
 	}
 	/* uart is registered */
 
+#if 0
 	/* sysfs */
 	memset(&mwave_device, 0, sizeof (struct device));
 	snprintf(mwave_device.bus_id, BUS_ID_SIZE, "mwave");
@@ -655,6 +659,7 @@
 		}
 		pDrvData->nr_registered_attrs++;
 	}
+#endif
 
 	/* SUCCESS! */
 	return 0;
diff -Nru a/drivers/char/mxser.c b/drivers/char/mxser.c
--- a/drivers/char/mxser.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/mxser.c	Tue Jun 15 22:20:42 2004
@@ -35,6 +35,8 @@
  *    Added support for: C102, CI-132, CI-134, CP-132, CP-114, CT-114 cards
  *                        by Damian Wrobel <dwrobel@ertel.com.pl>
  *
+ *    Added support for serial card CP104
+ *			  by James Nelson Provident Solutions <linux-info@provident-solutions.com>
  */
 
 #include <linux/config.h>
@@ -116,6 +118,9 @@
 #ifndef PCI_DEVICE_ID_C104
 #define PCI_DEVICE_ID_C104	0x1040
 #endif
+#ifndef PCI_DEVICE_ID_CP104
+#define PCI_DEVICE_ID_CP104	0x1041
+#endif
 #ifndef PCI_DEVICE_ID_CP132
 #define PCI_DEVICE_ID_CP132	0x1320
 #endif
@@ -139,6 +144,7 @@
 	MXSER_BOARD_CI104J,
 	MXSER_BOARD_C168_PCI,
 	MXSER_BOARD_C104_PCI,
+	MXSER_BOARD_CP104_PCI,
 	MXSER_BOARD_C102_ISA,
 	MXSER_BOARD_CI132,
 	MXSER_BOARD_CI134,
@@ -154,6 +160,7 @@
 	"CI-104J series",
 	"C168H/PCI series",
 	"C104H/PCI series",
+	"CP104/PCI series",
 	"C102 series",
 	"CI-132 series",
 	"CI-134 series",
@@ -169,6 +176,7 @@
 	4,
 	8,
 	4,
+	4,
 	2,
 	2,
 	4,
@@ -195,6 +203,8 @@
 	  MXSER_BOARD_C168_PCI },
 	{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C104, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
 	  MXSER_BOARD_C104_PCI },
+	{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_CP104, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
+	  MXSER_BOARD_CP104_PCI },
 	{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_CP132, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 	  MXSER_BOARD_CP132_PCI },
 	{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_CP114, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
diff -Nru a/drivers/char/n_tty.c b/drivers/char/n_tty.c
--- a/drivers/char/n_tty.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/char/n_tty.c	Tue Jun 15 22:20:36 2004
@@ -249,7 +249,7 @@
  * things.
  */
 static ssize_t opost_block(struct tty_struct * tty,
-		       const unsigned char * inbuf, unsigned int nr)
+		       const unsigned char __user * inbuf, unsigned int nr)
 {
 	char	buf[80];
 	int	space;
@@ -946,7 +946,7 @@
  * the buffer to head pointer.
  */
 static inline int copy_from_read_buf(struct tty_struct *tty,
-				      unsigned char **b,
+				      unsigned char __user **b,
 				      size_t *nr)
 
 {
@@ -976,9 +976,9 @@
 extern ssize_t redirected_tty_write(struct file *,const char *,size_t,loff_t *);
 
 static ssize_t read_chan(struct tty_struct *tty, struct file *file,
-			 unsigned char *buf, size_t nr)
+			 unsigned char __user *buf, size_t nr)
 {
-	unsigned char *b = buf;
+	unsigned char __user *b = buf;
 	DECLARE_WAITQUEUE(wait, current);
 	int c;
 	int minimum, time;
@@ -1183,9 +1183,9 @@
 }
 
 static ssize_t write_chan(struct tty_struct * tty, struct file * file,
-			  const unsigned char * buf, size_t nr)
+			  const unsigned char __user * buf, size_t nr)
 {
-	const unsigned char *b = buf;
+	const unsigned char __user *b = buf;
 	DECLARE_WAITQUEUE(wait, current);
 	int c;
 	ssize_t retval = 0;
diff -Nru a/drivers/char/nvram.c b/drivers/char/nvram.c
--- a/drivers/char/nvram.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/char/nvram.c	Tue Jun 15 22:20:39 2004
@@ -250,7 +250,7 @@
 }
 
 static ssize_t
-nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
 	unsigned char contents[NVRAM_BYTES];
 	unsigned i = *ppos;
@@ -279,7 +279,7 @@
 }
 
 static ssize_t
-nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
 	unsigned char contents[NVRAM_BYTES];
 	unsigned i = *ppos;
diff -Nru a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
--- a/drivers/char/pcmcia/synclink_cs.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/char/pcmcia/synclink_cs.c	Tue Jun 15 22:20:39 2004
@@ -1,7 +1,7 @@
 /*
  * linux/drivers/char/pcmcia/synclink_cs.c
  *
- * $Id: synclink_cs.c,v 4.21 2004/03/08 15:29:23 paulkf Exp $
+ * $Id: synclink_cs.c,v 4.22 2004/06/01 20:27:46 paulkf Exp $
  *
  * Device driver for Microgate SyncLink PC Card
  * multiprotocol serial adapter.
@@ -438,15 +438,15 @@
 static int tiocmget(struct tty_struct *tty, struct file *file);
 static int tiocmset(struct tty_struct *tty, struct file *file,
 		    unsigned int set, unsigned int clear);
-static int get_stats(MGSLPC_INFO *info, struct mgsl_icount *user_icount);
-static int get_params(MGSLPC_INFO *info, MGSL_PARAMS *user_params);
-static int set_params(MGSLPC_INFO *info, MGSL_PARAMS *new_params);
-static int get_txidle(MGSLPC_INFO *info, int*idle_mode);
+static int get_stats(MGSLPC_INFO *info, struct mgsl_icount __user *user_icount);
+static int get_params(MGSLPC_INFO *info, MGSL_PARAMS __user *user_params);
+static int set_params(MGSLPC_INFO *info, MGSL_PARAMS __user *new_params);
+static int get_txidle(MGSLPC_INFO *info, int __user *idle_mode);
 static int set_txidle(MGSLPC_INFO *info, int idle_mode);
 static int set_txenable(MGSLPC_INFO *info, int enable);
 static int tx_abort(MGSLPC_INFO *info);
 static int set_rxenable(MGSLPC_INFO *info, int enable);
-static int wait_events(MGSLPC_INFO *info, int *mask);
+static int wait_events(MGSLPC_INFO *info, int __user *mask);
 
 #define jiffies_from_ms(a) ((((a) * HZ)/1000)+1)
 
@@ -489,7 +489,7 @@
 MODULE_LICENSE("GPL");
 
 static char *driver_name = "SyncLink PC Card driver";
-static char *driver_version = "$Revision: 4.21 $";
+static char *driver_version = "$Revision: 4.22 $";
 
 static struct tty_driver *serial_driver;
 
@@ -521,8 +521,10 @@
  * (gdb) to get the .text address for the add-symbol-file command.
  * This allows remote debugging of dynamically loadable modules.
  */
-static void* mgslpc_get_text_ptr(void);
-static void* mgslpc_get_text_ptr() {return mgslpc_get_text_ptr;}
+static void* mgslpc_get_text_ptr(void)
+{
+	return mgslpc_get_text_ptr;
+}
 
 static dev_link_t *mgslpc_attach(void)
 {
@@ -1955,7 +1957,7 @@
 
 /* get the current serial statistics
  */
-static int get_stats(MGSLPC_INFO * info, struct mgsl_icount *user_icount)
+static int get_stats(MGSLPC_INFO * info, struct mgsl_icount __user *user_icount)
 {
 	int err;
 	if (debug_level >= DEBUG_LEVEL_INFO)
@@ -1968,7 +1970,7 @@
 
 /* get the current serial parameters
  */
-static int get_params(MGSLPC_INFO * info, MGSL_PARAMS *user_params)
+static int get_params(MGSLPC_INFO * info, MGSL_PARAMS __user *user_params)
 {
 	int err;
 	if (debug_level >= DEBUG_LEVEL_INFO)
@@ -1988,7 +1990,7 @@
  *
  * Returns:	0 if success, otherwise error code
  */
-static int set_params(MGSLPC_INFO * info, MGSL_PARAMS *new_params)
+static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params)
 {
  	unsigned long flags;
 	MGSL_PARAMS tmp_params;
@@ -2014,7 +2016,7 @@
 	return 0;
 }
 
-static int get_txidle(MGSLPC_INFO * info, int*idle_mode)
+static int get_txidle(MGSLPC_INFO * info, int __user *idle_mode)
 {
 	int err;
 	if (debug_level >= DEBUG_LEVEL_INFO)
@@ -2037,7 +2039,7 @@
 	return 0;
 }
 
-static int get_interface(MGSLPC_INFO * info, int*if_mode)
+static int get_interface(MGSLPC_INFO * info, int __user *if_mode)
 {
 	int err;
 	if (debug_level >= DEBUG_LEVEL_INFO)
@@ -2136,7 +2138,7 @@
  *				of events triggerred,
  * 			otherwise error code
  */
-static int wait_events(MGSLPC_INFO * info, int * mask_ptr)
+static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr)
 {
  	unsigned long flags;
 	int s;
@@ -2409,20 +2411,21 @@
 {
 	int error;
 	struct mgsl_icount cnow;	/* kernel counter temps */
-	struct serial_icounter_struct *p_cuser;	/* user space */
+	struct serial_icounter_struct __user *p_cuser;	/* user space */
+	void __user *argp = (void __user *)arg;
 	unsigned long flags;
 	
 	switch (cmd) {
 	case MGSL_IOCGPARAMS:
-		return get_params(info,(MGSL_PARAMS *)arg);
+		return get_params(info, argp);
 	case MGSL_IOCSPARAMS:
-		return set_params(info,(MGSL_PARAMS *)arg);
+		return set_params(info, argp);
 	case MGSL_IOCGTXIDLE:
-		return get_txidle(info,(int*)arg);
+		return get_txidle(info, argp);
 	case MGSL_IOCSTXIDLE:
-		return set_txidle(info,(int)arg);
+		return set_txidle(info, (int)arg);
 	case MGSL_IOCGIF:
-		return get_interface(info,(int*)arg);
+		return get_interface(info, argp);
 	case MGSL_IOCSIF:
 		return set_interface(info,(int)arg);
 	case MGSL_IOCTXENABLE:
@@ -2432,16 +2435,16 @@
 	case MGSL_IOCTXABORT:
 		return tx_abort(info);
 	case MGSL_IOCGSTATS:
-		return get_stats(info,(struct mgsl_icount*)arg);
+		return get_stats(info, argp);
 	case MGSL_IOCWAITEVENT:
-		return wait_events(info,(int*)arg);
+		return wait_events(info, argp);
 	case TIOCMIWAIT:
 		return modem_input_wait(info,(int)arg);
 	case TIOCGICOUNT:
 		spin_lock_irqsave(&info->lock,flags);
 		cnow = info->icount;
 		spin_unlock_irqrestore(&info->lock,flags);
-		p_cuser = (struct serial_icounter_struct *) arg;
+		p_cuser = argp;
 		PUT_USER(error,cnow.cts, &p_cuser->cts);
 		if (error) return error;
 		PUT_USER(error,cnow.dsr, &p_cuser->dsr);
@@ -3130,9 +3133,35 @@
 	.tiocmset = tiocmset,
 };
 
+static void synclink_cs_cleanup(void)
+{
+	int rc;
+
+	printk("Unloading %s: version %s\n", driver_name, driver_version);
+
+	while(mgslpc_device_list)
+		mgslpc_remove_device(mgslpc_device_list);
+
+	if (serial_driver) {
+		if ((rc = tty_unregister_driver(serial_driver)))
+			printk("%s(%d) failed to unregister tty driver err=%d\n",
+			       __FILE__,__LINE__,rc);
+		put_tty_driver(serial_driver);
+	}
+
+	pcmcia_unregister_driver(&mgslpc_driver);
+
+	/* XXX: this really needs to move into generic code.. */
+	while (dev_list != NULL) {
+		if (dev_list->state & DEV_CONFIG)
+			mgslpc_release((u_long)dev_list);
+		mgslpc_detach(dev_list);
+	}
+}
+
 static int __init synclink_cs_init(void)
 {
-    int error;
+    int rc;
 
     if (break_on_load) {
 	    mgslpc_get_text_ptr();
@@ -3141,14 +3170,13 @@
 
     printk("%s %s\n", driver_name, driver_version);
 
-    serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT);
-    if (!serial_driver)
-	    return -ENOMEM;
+    if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0)
+	    return rc;
 
-    error = pcmcia_register_driver(&mgslpc_driver);
-    if (error) {
-	    put_tty_driver(serial_driver);
-	    return error;
+    serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT);
+    if (!serial_driver) {
+	    rc = -ENOMEM;
+	    goto error;
     }
 
     /* Initialize the tty_driver structure */
@@ -3166,39 +3194,28 @@
     serial_driver->flags = TTY_DRIVER_REAL_RAW;
     tty_set_operations(serial_driver, &mgslpc_ops);
 
-    if (tty_register_driver(serial_driver) < 0)
+    if ((rc = tty_register_driver(serial_driver)) < 0) {
 	    printk("%s(%d):Couldn't register serial driver\n",
 		   __FILE__,__LINE__);
+	    put_tty_driver(serial_driver);
+	    serial_driver = NULL;
+	    goto error;
+    }
 			
     printk("%s %s, tty major#%d\n",
 	   driver_name, driver_version,
 	   serial_driver->major);
 	
     return 0;
+
+error:
+    synclink_cs_cleanup();
+    return rc;
 }
 
 static void __exit synclink_cs_exit(void) 
 {
-	int rc;
-
-	printk("Unloading %s: version %s\n", driver_name, driver_version);
-
-	while(mgslpc_device_list)
-		mgslpc_remove_device(mgslpc_device_list);
-
-	if ((rc = tty_unregister_driver(serial_driver)))
-		printk("%s(%d) failed to unregister tty driver err=%d\n",
-		       __FILE__,__LINE__,rc);
-	put_tty_driver(serial_driver);
-
-	pcmcia_unregister_driver(&mgslpc_driver);
-
-	/* XXX: this really needs to move into generic code.. */
-	while (dev_list != NULL) {
-		if (dev_list->state & DEV_CONFIG)
-			mgslpc_release((u_long)dev_list);
-		mgslpc_detach(dev_list);
-	}
+	synclink_cs_cleanup();
 }
 
 module_init(synclink_cs_init);
diff -Nru a/drivers/char/ppdev.c b/drivers/char/ppdev.c
--- a/drivers/char/ppdev.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/char/ppdev.c	Tue Jun 15 22:21:04 2004
@@ -59,6 +59,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/device.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/ioctl.h>
 #include <linux/parport.h>
@@ -102,7 +103,7 @@
 	port->ops->enable_irq (port);
 }
 
-static ssize_t pp_read (struct file * file, char * buf, size_t count,
+static ssize_t pp_read (struct file * file, char __user * buf, size_t count,
 			loff_t * ppos)
 {
 	unsigned int minor = iminor(file->f_dentry->d_inode);
@@ -185,8 +186,8 @@
 	return bytes_read;
 }
 
-static ssize_t pp_write (struct file * file, const char * buf, size_t count,
-			 loff_t * ppos)
+static ssize_t pp_write (struct file * file, const char __user * buf,
+			 size_t count, loff_t * ppos)
 {
 	unsigned int minor = iminor(file->f_dentry->d_inode);
 	struct pp_struct *pp = file->private_data;
@@ -334,6 +335,7 @@
 	unsigned int minor = iminor(inode);
 	struct pp_struct *pp = file->private_data;
 	struct parport * port;
+	void __user *argp = (void __user *)arg;
 
 	/* First handle the cases that don't take arguments. */
 	switch (cmd) {
@@ -395,7 +397,7 @@
 	case PPSETMODE:
 	    {
 		int mode;
-		if (copy_from_user (&mode, (int *) arg, sizeof (mode)))
+		if (copy_from_user (&mode, argp, sizeof (mode)))
 			return -EFAULT;
 		/* FIXME: validate mode */
 		pp->state.mode = mode;
@@ -417,7 +419,7 @@
 		} else {
 			mode = pp->state.mode;
 		}
-		if (copy_to_user ((int *)arg, &mode, sizeof (mode))) {
+		if (copy_to_user (argp, &mode, sizeof (mode))) {
 			return -EFAULT;
 		}
 		return 0;
@@ -425,7 +427,7 @@
 	case PPSETPHASE:
 	    {
 		int phase;
-		if (copy_from_user (&phase, (int *) arg, sizeof (phase))) {
+		if (copy_from_user (&phase, argp, sizeof (phase))) {
 			return -EFAULT;
 		}
 		/* FIXME: validate phase */
@@ -446,7 +448,7 @@
 		} else {
 			phase = pp->state.phase;
 		}
-		if (copy_to_user ((int *)arg, &phase, sizeof (phase))) {
+		if (copy_to_user (argp, &phase, sizeof (phase))) {
 			return -EFAULT;
 		}
 		return 0;
@@ -460,7 +462,7 @@
 			return -ENODEV;
 
 		modes = port->modes;
-		if (copy_to_user ((unsigned int *)arg, &modes, sizeof (modes))) {
+		if (copy_to_user (argp, &modes, sizeof (modes))) {
 			return -EFAULT;
 		}
 		return 0;
@@ -469,7 +471,7 @@
 	    {
 		int uflags;
 
-		if (copy_from_user (&uflags, (int *)arg, sizeof (uflags))) {
+		if (copy_from_user (&uflags, argp, sizeof (uflags))) {
 			return -EFAULT;
 		}
 		pp->flags &= ~PP_FLAGMASK;
@@ -481,7 +483,7 @@
 		int uflags;
 
 		uflags = pp->flags & PP_FLAGMASK;
-		if (copy_to_user ((int *)arg, &uflags, sizeof (uflags))) {
+		if (copy_to_user (argp, &uflags, sizeof (uflags))) {
 			return -EFAULT;
 		}
 		return 0;
@@ -508,17 +510,17 @@
 
 	case PPRSTATUS:
 		reg = parport_read_status (port);
-		if (copy_to_user ((unsigned char *) arg, &reg, sizeof (reg)))
+		if (copy_to_user (argp, &reg, sizeof (reg)))
 			return -EFAULT;
 		return 0;
 	case PPRDATA:
 		reg = parport_read_data (port);
-		if (copy_to_user ((unsigned char *) arg, &reg, sizeof (reg)))
+		if (copy_to_user (argp, &reg, sizeof (reg)))
 			return -EFAULT;
 		return 0;
 	case PPRCONTROL:
 		reg = parport_read_control (port);
-		if (copy_to_user ((unsigned char *) arg, &reg, sizeof (reg)))
+		if (copy_to_user (argp, &reg, sizeof (reg)))
 			return -EFAULT;
 		return 0;
 	case PPYIELD:
@@ -537,29 +539,29 @@
 		return 0;
 
 	case PPWCONTROL:
-		if (copy_from_user (&reg, (unsigned char *) arg, sizeof (reg)))
+		if (copy_from_user (&reg, argp, sizeof (reg)))
 			return -EFAULT;
 		parport_write_control (port, reg);
 		return 0;
 
 	case PPWDATA:
-		if (copy_from_user (&reg, (unsigned char *) arg, sizeof (reg)))
+		if (copy_from_user (&reg, argp, sizeof (reg)))
 			return -EFAULT;
 		parport_write_data (port, reg);
 		return 0;
 
 	case PPFCONTROL:
-		if (copy_from_user (&mask, (unsigned char *) arg,
+		if (copy_from_user (&mask, argp,
 				    sizeof (mask)))
 			return -EFAULT;
-		if (copy_from_user (&reg, 1 + (unsigned char *) arg,
+		if (copy_from_user (&reg, 1 + (unsigned char __user *) arg,
 				    sizeof (reg)))
 			return -EFAULT;
 		parport_frob_control (port, mask, reg);
 		return 0;
 
 	case PPDATADIR:
-		if (copy_from_user (&mode, (int *) arg, sizeof (mode)))
+		if (copy_from_user (&mode, argp, sizeof (mode)))
 			return -EFAULT;
 		if (mode)
 			port->ops->data_reverse (port);
@@ -568,7 +570,7 @@
 		return 0;
 
 	case PPNEGOT:
-		if (copy_from_user (&mode, (int *) arg, sizeof (mode)))
+		if (copy_from_user (&mode, argp, sizeof (mode)))
 			return -EFAULT;
 		switch ((ret = parport_negotiate (port, mode))) {
 		case 0: break;
@@ -583,8 +585,7 @@
 		return ret;
 
 	case PPWCTLONIRQ:
-		if (copy_from_user (&reg, (unsigned char *) arg,
-				    sizeof (reg)))
+		if (copy_from_user (&reg, argp, sizeof (reg)))
 			return -EFAULT;
 
 		/* Remember what to set the control lines to, for next
@@ -595,14 +596,13 @@
 
 	case PPCLRIRQ:
 		ret = atomic_read (&pp->irqc);
-		if (copy_to_user ((int *) arg, &ret, sizeof (ret)))
+		if (copy_to_user (argp, &ret, sizeof (ret)))
 			return -EFAULT;
 		atomic_sub (ret, &pp->irqc);
 		return 0;
 
 	case PPSETTIME:
-		if (copy_from_user (&par_timeout, (struct timeval *)arg,
-				    sizeof(struct timeval))) {
+		if (copy_from_user (&par_timeout, argp, sizeof(struct timeval))) {
 			return -EFAULT;
 		}
 		/* Convert to jiffies, place in pp->pdev->timeout */
@@ -621,10 +621,8 @@
 		to_jiffies = pp->pdev->timeout;
 		par_timeout.tv_sec = to_jiffies / HZ;
 		par_timeout.tv_usec = (to_jiffies % (long)HZ) * (1000000/HZ);
-		if (copy_to_user ((struct timeval *)arg, &par_timeout,
-				  sizeof(struct timeval))) {
+		if (copy_to_user (argp, &par_timeout, sizeof(struct timeval)))
 			return -EFAULT;
-		}
 		return 0;
 
 	default:
@@ -739,6 +737,8 @@
 	return mask;
 }
 
+static struct class_simple *ppdev_class;
+
 static struct file_operations pp_fops = {
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
@@ -750,23 +750,59 @@
 	.release	= pp_release,
 };
 
+static void pp_attach(struct parport *port)
+{
+	class_simple_device_add(ppdev_class, MKDEV(PP_MAJOR, port->number),
+			NULL, "parport%d", port->number);
+}
+
+static void pp_detach(struct parport *port)
+{
+	class_simple_device_remove(MKDEV(PP_MAJOR, port->number));
+}
+
+static struct parport_driver pp_driver = {
+	.name		= CHRDEV,
+	.attach		= pp_attach,
+	.detach		= pp_detach,
+};
+
 static int __init ppdev_init (void)
 {
-	int i;
+	int i, err = 0;
 
 	if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
 		printk (KERN_WARNING CHRDEV ": unable to get major %d\n",
 			PP_MAJOR);
 		return -EIO;
 	}
+	ppdev_class = class_simple_create(THIS_MODULE, CHRDEV);
+	if (IS_ERR(ppdev_class)) {
+		err = PTR_ERR(ppdev_class);
+		goto out_chrdev;
+	}
 	devfs_mk_dir("parports");
 	for (i = 0; i < PARPORT_MAX; i++) {
 		devfs_mk_cdev(MKDEV(PP_MAJOR, i),
 				S_IFCHR | S_IRUGO | S_IWUGO, "parports/%d", i);
 	}
+	if (parport_register_driver(&pp_driver)) {
+		printk (KERN_WARNING CHRDEV ": unable to register with parport\n");
+		goto out_class;
+	}
 
 	printk (KERN_INFO PP_VERSION "\n");
-	return 0;
+	goto out;
+
+out_class:
+	for (i = 0; i < PARPORT_MAX; i++)
+		devfs_remove("parports/%d", i);
+	devfs_remove("parports");
+	class_simple_destroy(ppdev_class);
+out_chrdev:
+	unregister_chrdev(PP_MAJOR, CHRDEV);
+out:
+	return err;
 }
 
 static void __exit ppdev_cleanup (void)
@@ -775,7 +811,9 @@
 	/* Clean up all parport stuff */
 	for (i = 0; i < PARPORT_MAX; i++)
 		devfs_remove("parports/%d", i);
+	parport_unregister_driver(&pp_driver);
 	devfs_remove("parports");
+	class_simple_destroy(ppdev_class);
 	unregister_chrdev (PP_MAJOR, CHRDEV);
 }
 
diff -Nru a/drivers/char/pty.c b/drivers/char/pty.c
--- a/drivers/char/pty.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/pty.c	Tue Jun 15 22:20:38 2004
@@ -211,7 +211,7 @@
  * one we got after it is open, with an ioctl.
  */
 #ifdef CONFIG_UNIX98_PTYS
-static int pty_get_device_number(struct tty_struct *tty, unsigned int *value)
+static int pty_get_device_number(struct tty_struct *tty, unsigned __user *value)
 {
 	unsigned int result = tty->index;
 	return put_user(result, value);
@@ -219,7 +219,7 @@
 #endif
 
 /* Set the lock flag on a pty */
-static int pty_set_lock(struct tty_struct *tty, int * arg)
+static int pty_set_lock(struct tty_struct *tty, int __user * arg)
 {
 	int val;
 	if (get_user(val,arg))
@@ -241,7 +241,7 @@
 	}
 	switch(cmd) {
 	case TIOCSPTLCK: /* Set PT Lock (disallow slave open) */
-		return pty_set_lock(tty, (int *) arg);
+		return pty_set_lock(tty, (int __user *) arg);
 	}
 	return -ENOIOCTLCMD;
 }
@@ -257,9 +257,9 @@
 	}
 	switch(cmd) {
 	case TIOCSPTLCK: /* Set PT Lock (disallow slave open) */
-		return pty_set_lock(tty, (int *)arg);
+		return pty_set_lock(tty, (int __user *)arg);
 	case TIOCGPTN: /* Get PT Number */
-		return pty_get_device_number(tty, (unsigned int *)arg);
+		return pty_get_device_number(tty, (unsigned int __user *)arg);
 	}
 
 	return -ENOIOCTLCMD;
diff -Nru a/drivers/char/random.c b/drivers/char/random.c
--- a/drivers/char/random.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/char/random.c	Tue Jun 15 22:20:36 2004
@@ -1586,7 +1586,7 @@
 }
 
 static ssize_t
-random_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
+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;
@@ -1666,7 +1666,7 @@
 }
 
 static ssize_t
-urandom_read(struct file * file, char * buf,
+urandom_read(struct file * file, char __user * buf,
 		      size_t nbytes, loff_t *ppos)
 {
 	return extract_entropy(sec_random_state, buf, nbytes,
@@ -1690,13 +1690,13 @@
 }
 
 static ssize_t
-random_write(struct file * file, const char * buffer,
+random_write(struct file * file, const char __user * buffer,
 	     size_t count, loff_t *ppos)
 {
 	int		ret = 0;
 	size_t		bytes;
 	__u32 		buf[16];
-	const char 	*p = buffer;
+	const char 	__user *p = buffer;
 	size_t		c = count;
 
 	while (c > 0) {
@@ -1725,20 +1725,21 @@
 random_ioctl(struct inode * inode, struct file * file,
 	     unsigned int cmd, unsigned long arg)
 {
-	int *p, *tmp, size, ent_count;
+	int *tmp, size, ent_count;
+	int __user *p = (int __user *)arg;
 	int retval;
 	unsigned long flags;
 	
 	switch (cmd) {
 	case RNDGETENTCNT:
 		ent_count = random_state->entropy_count;
-		if (put_user(ent_count, (int *) arg))
+		if (put_user(ent_count, p))
 			return -EFAULT;
 		return 0;
 	case RNDADDTOENTCNT:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-		if (get_user(ent_count, (int *) arg))
+		if (get_user(ent_count, p))
 			return -EFAULT;
 		credit_entropy_store(random_state, ent_count);
 		/*
@@ -1751,7 +1752,6 @@
 	case RNDGETPOOL:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-		p = (int *) arg;
 		if (get_user(size, p) ||
 		    put_user(random_state->poolinfo.poolwords, p++))
 			return -EFAULT;
@@ -1786,14 +1786,13 @@
 	case RNDADDENTROPY:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-		p = (int *) arg;
 		if (get_user(ent_count, p++))
 			return -EFAULT;
 		if (ent_count < 0)
 			return -EINVAL;
 		if (get_user(size, p++))
 			return -EFAULT;
-		retval = random_write(file, (const char *) p,
+		retval = random_write(file, (const char __user *) p,
 				      size, &file->f_pos);
 		if (retval < 0)
 			return retval;
@@ -1895,7 +1894,7 @@
 }
 
 static int proc_do_poolsize(ctl_table *table, int write, struct file *filp,
-			    void *buffer, size_t *lenp)
+			    void __user *buffer, size_t *lenp)
 {
 	int	ret;
 
@@ -1909,9 +1908,9 @@
 	return change_poolsize(sysctl_poolsize);
 }
 
-static int poolsize_strategy(ctl_table *table, int *name, int nlen,
-			     void *oldval, size_t *oldlenp,
-			     void *newval, size_t newlen, void **context)
+static int poolsize_strategy(ctl_table *table, int __user *name, int nlen,
+			     void __user *oldval, size_t __user *oldlenp,
+			     void __user *newval, size_t newlen, void **context)
 {
 	int	len;
 	
@@ -1946,7 +1945,7 @@
  * sysctl system call, it is returned as 16 bytes of binary data.
  */
 static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
-			void *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp)
 {
 	ctl_table	fake_table;
 	unsigned char	buf[64], tmp_uuid[16], *uuid;
@@ -1971,9 +1970,9 @@
 	return proc_dostring(&fake_table, write, filp, buffer, lenp);
 }
 
-static int uuid_strategy(ctl_table *table, int *name, int nlen,
-			 void *oldval, size_t *oldlenp,
-			 void *newval, size_t newlen, void **context)
+static int uuid_strategy(ctl_table *table, int __user *name, int nlen,
+			 void __user *oldval, size_t __user *oldlenp,
+			 void __user *newval, size_t newlen, void **context)
 {
 	unsigned char	tmp_uuid[16], *uuid;
 	unsigned int	len;
diff -Nru a/drivers/char/raw.c b/drivers/char/raw.c
--- a/drivers/char/raw.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/char/raw.c	Tue Jun 15 22:20:41 2004
@@ -140,7 +140,7 @@
 
 		/* First, find out which raw minor we want */
 
-		if (copy_from_user(&rq, (void *) arg, sizeof(rq))) {
+		if (copy_from_user(&rq, (void __user *) arg, sizeof(rq))) {
 			err = -EFAULT;
 			goto out;
 		}
@@ -211,7 +211,7 @@
 				rq.block_major = rq.block_minor = 0;
 			}
 			up(&raw_mutex);
-			if (copy_to_user((void *)arg, &rq, sizeof(rq))) {
+			if (copy_to_user((void __user *)arg, &rq, sizeof(rq))) {
 				err = -EFAULT;
 				goto out;
 			}
@@ -225,18 +225,24 @@
 	return err;
 }
 
-static ssize_t raw_file_write(struct file *file, const char *buf,
+static ssize_t raw_file_write(struct file *file, const char __user *buf,
 				   size_t count, loff_t *ppos)
 {
-	struct iovec local_iov = { .iov_base = (void *)buf, .iov_len = count };
+	struct iovec local_iov = {
+		.iov_base = (char __user *)buf,
+		.iov_len = count
+	};
 
 	return generic_file_write_nolock(file, &local_iov, 1, ppos);
 }
 
-static ssize_t raw_file_aio_write(struct kiocb *iocb, const char *buf,
+static ssize_t raw_file_aio_write(struct kiocb *iocb, const char __user *buf,
 					size_t count, loff_t pos)
 {
-	struct iovec local_iov = { .iov_base = (void *)buf, .iov_len = count };
+	struct iovec local_iov = {
+		.iov_base = (char __user *)buf,
+		.iov_len = count
+	};
 
 	return generic_file_aio_write_nolock(iocb, &local_iov, 1, &iocb->ki_pos);
 }
diff -Nru a/drivers/char/rtc.c b/drivers/char/rtc.c
--- a/drivers/char/rtc.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/rtc.c	Tue Jun 15 22:21:05 2004
@@ -97,7 +97,7 @@
 static int rtc_irq = PCI_IRQ_NONE;
 #endif
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 static int rtc_has_irq = 1;
 #endif
 
@@ -125,30 +125,28 @@
 
 static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 static struct timer_list rtc_irq_timer;
 #endif
 
-static ssize_t rtc_read(struct file *file, char *buf,
+static ssize_t rtc_read(struct file *file, char __user *buf,
 			size_t count, loff_t *ppos);
 
 static int rtc_ioctl(struct inode *inode, struct file *file,
 		     unsigned int cmd, unsigned long arg);
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 static unsigned int rtc_poll(struct file *file, poll_table *wait);
 #endif
 
 static void get_rtc_alm_time (struct rtc_time *alm_tm);
-#if RTC_IRQ
+#ifdef RTC_IRQ
 static void rtc_dropped_irq(unsigned long data);
 
 static void set_rtc_irq_bit(unsigned char bit);
 static void mask_rtc_irq_bit(unsigned char bit);
 #endif
 
-static inline unsigned char rtc_is_updating(void);
-
 static int rtc_read_proc(char *page, char **start, off_t off,
                          int count, int *eof, void *data);
 
@@ -171,7 +169,7 @@
 static unsigned long rtc_irq_data = 0;	/* our output to the world	*/
 static unsigned long rtc_max_user_freq = 64; /* > this, need CAP_SYS_RESOURCE */
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 /*
  * rtc_task_lock nests inside rtc_lock.
  */
@@ -189,7 +187,20 @@
 static const unsigned char days_in_mo[] = 
 {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
 
-#if RTC_IRQ
+/*
+ * Returns true if a clock update is in progress
+ */
+static inline unsigned char rtc_is_updating(void)
+{
+	unsigned char uip;
+
+	spin_lock_irq(&rtc_lock);
+	uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
+	spin_unlock_irq(&rtc_lock);
+	return uip;
+}
+
+#ifdef RTC_IRQ
 /*
  *	A very tiny interrupt handler. It runs with SA_INTERRUPT set,
  *	but there is possibility of conflicting with the set_rtc_mmss()
@@ -295,10 +306,10 @@
  *	Now all the various file operations that we export.
  */
 
-static ssize_t rtc_read(struct file *file, char *buf,
+static ssize_t rtc_read(struct file *file, char __user *buf,
 			size_t count, loff_t *ppos)
 {
-#if !RTC_IRQ
+#ifndef RTC_IRQ
 	return -EIO;
 #else
 	DECLARE_WAITQUEUE(wait, current);
@@ -340,9 +351,9 @@
 	} while (1);
 
 	if (count < sizeof(unsigned long))
-		retval = put_user(data, (unsigned int *)buf) ?: sizeof(int); 
+		retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int); 
 	else
-		retval = put_user(data, (unsigned long *)buf) ?: sizeof(long);
+		retval = put_user(data, (unsigned long __user *)buf) ?: sizeof(long);
  out:
 	current->state = TASK_RUNNING;
 	remove_wait_queue(&rtc_wait, &wait);
@@ -355,7 +366,7 @@
 {
 	struct rtc_time wtime; 
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 	if (rtc_has_irq == 0) {
 		switch (cmd) {
 		case RTC_AIE_OFF:
@@ -372,7 +383,7 @@
 #endif
 
 	switch (cmd) {
-#if RTC_IRQ
+#ifdef RTC_IRQ
 	case RTC_AIE_OFF:	/* Mask alarm int. enab. bit	*/
 	{
 		mask_rtc_irq_bit(RTC_AIE);
@@ -447,7 +458,7 @@
 		unsigned char hrs, min, sec;
 		struct rtc_time alm_tm;
 
-		if (copy_from_user(&alm_tm, (struct rtc_time*)arg,
+		if (copy_from_user(&alm_tm, (struct rtc_time __user *)arg,
 				   sizeof(struct rtc_time)))
 			return -EFAULT;
 
@@ -500,7 +511,7 @@
 		if (!capable(CAP_SYS_TIME))
 			return -EACCES;
 
-		if (copy_from_user(&rtc_tm, (struct rtc_time*)arg,
+		if (copy_from_user(&rtc_tm, (struct rtc_time __user *)arg,
 				   sizeof(struct rtc_time)))
 			return -EFAULT;
 
@@ -584,10 +595,10 @@
 		spin_unlock_irq(&rtc_lock);
 		return 0;
 	}
-#if RTC_IRQ
+#ifdef RTC_IRQ
 	case RTC_IRQP_READ:	/* Read the periodic IRQ rate.	*/
 	{
-		return put_user(rtc_freq, (unsigned long *)arg);
+		return put_user(rtc_freq, (unsigned long __user *)arg);
 	}
 	case RTC_IRQP_SET:	/* Set periodic IRQ rate.	*/
 	{
@@ -631,7 +642,7 @@
 #endif
 	case RTC_EPOCH_READ:	/* Read the epoch.	*/
 	{
-		return put_user (epoch, (unsigned long *)arg);
+		return put_user (epoch, (unsigned long __user *)arg);
 	}
 	case RTC_EPOCH_SET:	/* Set the epoch.	*/
 	{
@@ -650,7 +661,7 @@
 	default:
 		return -ENOTTY;
 	}
-	return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
+	return copy_to_user((void __user *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
 }
 
 static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
@@ -693,7 +704,7 @@
 
 static int rtc_release(struct inode *inode, struct file *file)
 {
-#if RTC_IRQ
+#ifdef RTC_IRQ
 	unsigned char tmp;
 
 	if (rtc_has_irq == 0)
@@ -732,7 +743,7 @@
 	return 0;
 }
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 /* Called without the kernel lock - fine */
 static unsigned int rtc_poll(struct file *file, poll_table *wait)
 {
@@ -763,7 +774,7 @@
 
 int rtc_register(rtc_task_t *task)
 {
-#if !RTC_IRQ
+#ifndef RTC_IRQ
 	return -EIO;
 #else
 	if (task == NULL || task->func == NULL)
@@ -789,7 +800,7 @@
 
 int rtc_unregister(rtc_task_t *task)
 {
-#if !RTC_IRQ
+#ifndef RTC_IRQ
 	return -EIO;
 #else
 	unsigned char tmp;
@@ -825,7 +836,7 @@
 
 int rtc_control(rtc_task_t *task, unsigned int cmd, unsigned long arg)
 {
-#if !RTC_IRQ
+#ifndef RTC_IRQ
 	return -EIO;
 #else
 	spin_lock_irq(&rtc_task_lock);
@@ -847,7 +858,7 @@
 	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= rtc_read,
-#if RTC_IRQ
+#ifdef RTC_IRQ
 	.poll		= rtc_poll,
 #endif
 	.ioctl		= rtc_ioctl,
@@ -863,7 +874,7 @@
 	&rtc_fops
 };
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 static irqreturn_t (*rtc_int_handler_ptr)(int irq, void *dev_id, struct pt_regs *regs);
 #endif
 
@@ -933,7 +944,7 @@
 		return -EIO;
 	}
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 	if (is_hpet_enabled()) {
 		rtc_int_handler_ptr = hpet_rtc_interrupt;
 	} else {
@@ -953,14 +964,14 @@
 #endif /* __sparc__ vs. others */
 
 	if (misc_register(&rtc_dev)) {
-#if RTC_IRQ
+#ifdef RTC_IRQ
 		free_irq(RTC_IRQ, NULL);
 #endif
 		release_region(RTC_PORT(0), RTC_IO_EXTENT);
 		return -ENODEV;
 	}
 	if (create_proc_read_entry ("driver/rtc", 0, 0, rtc_read_proc, NULL) == NULL) {
-#if RTC_IRQ
+#ifdef RTC_IRQ
 		free_irq(RTC_IRQ, NULL);
 #endif
 		release_region(RTC_PORT(0), RTC_IO_EXTENT);
@@ -1011,7 +1022,7 @@
 	if (guess)
 		printk(KERN_INFO "rtc: %s epoch (%lu) detected\n", guess, epoch);
 #endif
-#if RTC_IRQ
+#ifdef RTC_IRQ
 	if (rtc_has_irq == 0)
 		goto no_irq2;
 
@@ -1045,7 +1056,7 @@
 		free_irq (rtc_irq, &rtc_port);
 #else
 	release_region (RTC_PORT (0), RTC_IO_EXTENT);
-#if RTC_IRQ
+#ifdef RTC_IRQ
 	if (rtc_has_irq)
 		free_irq (RTC_IRQ, NULL);
 #endif
@@ -1055,7 +1066,7 @@
 module_init(rtc_init);
 module_exit(rtc_exit);
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 /*
  * 	At IRQ rates >= 4096Hz, an interrupt may get lost altogether.
  *	(usually during an IDE disk interrupt, with IRQ unmasking off)
@@ -1194,20 +1205,6 @@
         return len;
 }
 
-/*
- * Returns true if a clock update is in progress
- */
-/* FIXME shouldn't this be above rtc_init to make it fully inlined? */
-static inline unsigned char rtc_is_updating(void)
-{
-	unsigned char uip;
-
-	spin_lock_irq(&rtc_lock);
-	uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
-	spin_unlock_irq(&rtc_lock);
-	return uip;
-}
-
 void rtc_get_rtc_time(struct rtc_time *rtc_tm)
 {
 	unsigned long uip_watchdog = jiffies;
@@ -1298,7 +1295,7 @@
 	}
 }
 
-#if RTC_IRQ
+#ifdef RTC_IRQ
 /*
  * Used to disable/enable interrupts for any one of UIE, AIE, PIE.
  * Rumour has it that if you frob the interrupt enable/disable
diff -Nru a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c
--- a/drivers/char/scx200_gpio.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/char/scx200_gpio.c	Tue Jun 15 22:20:36 2004
@@ -26,7 +26,7 @@
 MODULE_PARM(major, "i");
 MODULE_PARM_DESC(major, "Major device number");
 
-static ssize_t scx200_gpio_write(struct file *file, const char *data, 
+static ssize_t scx200_gpio_write(struct file *file, const char __user *data, 
 				 size_t len, loff_t *ppos)
 {
 	unsigned m = iminor(file->f_dentry->d_inode);
@@ -77,7 +77,7 @@
 	return len;
 }
 
-static ssize_t scx200_gpio_read(struct file *file, char *buf,
+static ssize_t scx200_gpio_read(struct file *file, char __user *buf,
 				size_t len, loff_t *ppos)
 {
 	unsigned m = iminor(file->f_dentry->d_inode);
diff -Nru a/drivers/char/selection.c b/drivers/char/selection.c
--- a/drivers/char/selection.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/char/selection.c	Tue Jun 15 22:21:03 2004
@@ -3,10 +3,10 @@
  *
  * This module exports the functions:
  *
- *     'int set_selection(const unsigned long arg)'
+ *     'int set_selection(struct tiocl_selection __user *, struct tty_struct *)'
  *     'void clear_selection(void)'
- *     'int paste_selection(struct tty_struct *tty)'
- *     'int sel_loadlut(const unsigned long arg)'
+ *     'int paste_selection(struct tty_struct *)'
+ *     'int sel_loadlut(char __user *)'
  *
  * Now that /dev/vcs exists, most of this can disappear again.
  */
@@ -95,9 +95,9 @@
 }
 
 /* set inwordLut contents. Invoked by ioctl(). */
-int sel_loadlut(const unsigned long arg)
+int sel_loadlut(char __user *p)
 {
-	return copy_from_user(inwordLut, (u32 *)(arg+4), 32) ? -EFAULT : 0;
+	return copy_from_user(inwordLut, (u32 __user *)(p+4), 32) ? -EFAULT : 0;
 }
 
 /* does screen address p correspond to character at LH/RH edge of screen? */
@@ -113,7 +113,7 @@
 }
 
 /* set the current selection. Invoked by ioctl() or by kernel code. */
-int set_selection(const struct tiocl_selection *sel, struct tty_struct *tty, int user)
+int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty)
 {
 	int sel_mode, new_sel_start, new_sel_end, spc;
 	char *bp, *obp;
@@ -124,21 +124,13 @@
 
 	{ unsigned short xs, ys, xe, ye;
 
-	  if (user) {
-		  if (verify_area(VERIFY_READ, sel, sizeof(*sel)))
-		  	return -EFAULT;
-		  __get_user(xs, &sel->xs);
-		  __get_user(ys, &sel->ys);
-		  __get_user(xe, &sel->xe);
-		  __get_user(ye, &sel->ye);
-		  __get_user(sel_mode, &sel->sel_mode);
-	  } else {
-		  xs = sel->xs; /* set selection from kernel */
-		  ys = sel->ys;
-		  xe = sel->xe;
-		  ye = sel->ye;
-		  sel_mode = sel->sel_mode;
-	  }
+	  if (verify_area(VERIFY_READ, sel, sizeof(*sel)))
+		return -EFAULT;
+	  __get_user(xs, &sel->xs);
+	  __get_user(ys, &sel->ys);
+	  __get_user(xe, &sel->xe);
+	  __get_user(ye, &sel->ye);
+	  __get_user(sel_mode, &sel->sel_mode);
 	  xs--; ys--; xe--; ye--;
 	  xs = limit(xs, video_num_columns - 1);
 	  ys = limit(ys, video_num_lines - 1);
diff -Nru a/drivers/char/sh-sci.c b/drivers/char/sh-sci.c
--- a/drivers/char/sh-sci.c	Tue Jun 15 22:21:03 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1646 +0,0 @@
-/* $Id: sh-sci.c,v 1.16 2004/02/10 17:04:17 lethal Exp $
- *
- *  linux/drivers/char/sh-sci.c
- *
- *  SuperH on-chip serial module support.  (SCI with no FIFO / with FIFO)
- *  Copyright (C) 1999, 2000  Niibe Yutaka
- *  Copyright (C) 2000  Sugioka Toshinobu
- *  Modified to support multiple serial ports. Stuart Menefy (May 2000).
- *  Modified to support SH7760 SCIF. Paul Mundt (Oct 2003).
- *  Modified to support H8/300 Series. Yoshinori Sato (Feb 2004).
- *
- * TTY code is based on sx.c (Specialix SX driver) by:
- *
- *   (C) 1998 R.E.Wolff@BitWizard.nl
- *
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/serial.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/fcntl.h>
-#include <linux/ptrace.h>
-#include <linux/ioport.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SH_KGDB_CONSOLE)
-#include <linux/console.h>
-#endif
-#ifdef CONFIG_CPU_FREQ
-#include <linux/notifier.h>
-#include <linux/cpufreq.h>
-#endif
-
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/bitops.h>
-
-#include <linux/generic_serial.h>
-
-#ifdef CONFIG_SH_STANDARD_BIOS
-#include <asm/sh_bios.h>
-#endif
-
-#include "sh-sci.h"
-
-#ifdef CONFIG_SH_KGDB
-#include <asm/kgdb.h>
-
-int kgdb_sci_setup(void);
-static int kgdb_get_char(struct sci_port *port);
-static void kgdb_put_char(struct sci_port *port, char c);
-static void kgdb_handle_error(struct sci_port *port);
-static struct sci_port *kgdb_sci_port;
-
-#ifdef CONFIG_SH_KGDB_CONSOLE
-static struct console kgdbcons;
-void __init kgdb_console_init(void);
-#endif /* CONFIG_SH_KGDB_CONSOLE */
-
-#endif /* CONFIG_SH_KGDB */
-
-#ifdef CONFIG_SERIAL_CONSOLE
-static struct console sercons;
-static struct sci_port* sercons_port=0;
-static int sercons_baud;
-#ifdef CONFIG_MAGIC_SYSRQ
-#include <linux/sysrq.h>
-static int break_pressed;
-#endif /* CONFIG_MAGIC_SYSRQ */
-#endif /* CONFIG_SERIAL_CONSOLE */
-
-/* Function prototypes */
-static void sci_init_pins_sci(struct sci_port* port, unsigned int cflag);
-#ifndef SCI_ONLY
-static void sci_init_pins_scif(struct sci_port* port, unsigned int cflag);
-#if defined(CONFIG_CPU_SH3)
-static void sci_init_pins_irda(struct sci_port* port, unsigned int cflag);
-#endif
-#endif
-static void sci_disable_tx_interrupts(void *ptr);
-static void sci_enable_tx_interrupts(void *ptr);
-static void sci_disable_rx_interrupts(void *ptr);
-static void sci_enable_rx_interrupts(void *ptr);
-static int  sci_get_CD(void *ptr);
-static void sci_shutdown_port(void *ptr);
-static int sci_set_real_termios(void *ptr);
-static void sci_hungup(void *ptr);
-static void sci_close(void *ptr);
-static int sci_chars_in_buffer(void *ptr);
-static int sci_request_irq(struct sci_port *port);
-static void sci_free_irq(struct sci_port *port);
-static int sci_init_drivers(void);
-
-static struct tty_driver *sci_driver;
-
-static struct sci_port sci_ports[SCI_NPORTS] = SCI_INIT;
-
-static int sci_debug = 0;
-
-#ifdef MODULE
-MODULE_PARM(sci_debug, "i");
-#endif
-
-#define dprintk(x...) do { if (sci_debug) printk(x); } while(0)
-
-#ifdef CONFIG_SERIAL_CONSOLE
-static void put_char(struct sci_port *port, char c)
-{
-	unsigned long flags;
-	unsigned short status;
-
-	local_irq_save(flags);
-
-	do
-		status = sci_in(port, SCxSR);
-	while (!(status & SCxSR_TDxE(port)));
-	
-	sci_out(port, SCxTDR, c);
-	sci_in(port, SCxSR);            /* Dummy read */
-	sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
-
-	local_irq_restore(flags);
-}
-#endif
-
-#if defined(CONFIG_SH_STANDARD_BIOS) || defined(CONFIG_SH_KGDB)
-
-static void handle_error(struct sci_port *port)
-{				/* Clear error flags */
-	sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port));
-}
-
-static int get_char(struct sci_port *port)
-{
-	unsigned long flags;
-	unsigned short status;
-	int c;
-
-	local_irq_save(flags);
-        do {
-		status = sci_in(port, SCxSR);
-		if (status & SCxSR_ERRORS(port)) {
-			handle_error(port);
-			continue;
-		}
-	} while (!(status & SCxSR_RDxF(port)));
-	c = sci_in(port, SCxRDR);
-	sci_in(port, SCxSR);            /* Dummy read */
-	sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
-	local_irq_restore(flags);
-
-	return c;
-}
-
-/* Taken from sh-stub.c of GDB 4.18 */
-static const char hexchars[] = "0123456789abcdef";
-
-static __inline__ char highhex(int  x)
-{
-	return hexchars[(x >> 4) & 0xf];
-}
-
-static __inline__ char lowhex(int  x)
-{
-	return hexchars[x & 0xf];
-}
-
-#endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */
-
-/*
- * Send the packet in buffer.  The host gets one chance to read it.
- * This routine does not wait for a positive acknowledge.
- */
-
-#ifdef CONFIG_SERIAL_CONSOLE
-static void put_string(struct sci_port *port, const char *buffer, int count)
-{
-	int i;
-	const unsigned char *p = buffer;
-
-#if defined(CONFIG_SH_STANDARD_BIOS) || defined(CONFIG_SH_KGDB)
-	int checksum;
-	int usegdb=0;
-
-#ifdef CONFIG_SH_STANDARD_BIOS
-    	/* This call only does a trap the first time it is
-	 * called, and so is safe to do here unconditionally
-	 */
-	usegdb |= sh_bios_in_gdb_mode();
-#endif
-#ifdef CONFIG_SH_KGDB
-	usegdb |= (kgdb_in_gdb_mode && (port == kgdb_sci_port));
-#endif
-
-	if (usegdb) {
-	    /*  $<packet info>#<checksum>. */
-	    do {
-		unsigned char c;
-		put_char(port, '$');
-		put_char(port, 'O'); /* 'O'utput to console */
-		checksum = 'O';
-
-		for (i=0; i<count; i++) { /* Don't use run length encoding */
-			int h, l;
-
-			c = *p++;
-			h = highhex(c);
-			l = lowhex(c);
-			put_char(port, h);
-			put_char(port, l);
-			checksum += h + l;
-		}
-		put_char(port, '#');
-		put_char(port, highhex(checksum));
-		put_char(port, lowhex(checksum));
-	    } while  (get_char(port) != '+');
-	} else
-#endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */
-	for (i=0; i<count; i++) {
-		if (*p == 10)
-			put_char(port, '\r');
-		put_char(port, *p++);
-	}
-}
-#endif /* CONFIG_SERIAL_CONSOLE */
-
-
-#ifdef CONFIG_SH_KGDB
-
-/* Is the SCI ready, ie is there a char waiting? */
-static int kgdb_is_char_ready(struct sci_port *port)
-{
-        unsigned short status = sci_in(port, SCxSR);
-
-        if (status & (SCxSR_ERRORS(port) | SCxSR_BRK(port)))
-                kgdb_handle_error(port);
-
-        return (status & SCxSR_RDxF(port));
-}
-
-/* Write a char */
-static void kgdb_put_char(struct sci_port *port, char c)
-{
-        unsigned short status;
-
-        do
-                status = sci_in(port, SCxSR);
-        while (!(status & SCxSR_TDxE(port)));
-
-        sci_out(port, SCxTDR, c);
-        sci_in(port, SCxSR);    /* Dummy read */
-        sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
-}
-
-/* Get a char if there is one, else ret -1 */
-static int kgdb_get_char(struct sci_port *port)
-{
-        int c;
-
-        if (kgdb_is_char_ready(port) == 0)
-                c = -1;
-        else {
-                c = sci_in(port, SCxRDR);
-                sci_in(port, SCxSR);    /* Dummy read */
-                sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
-        }
-
-        return c;
-}
-
-/* Called from kgdbstub.c to get a character, i.e. is blocking */
-static int kgdb_sci_getchar(void)
-{
-        volatile int c;
-
-        /* Keep trying to read a character, this could be neater */
-        while ((c = kgdb_get_char(kgdb_sci_port)) < 0);
-
-        return c;
-}
-
-/* Called from kgdbstub.c to put a character, just a wrapper */
-static void kgdb_sci_putchar(int c)
-{
-
-        kgdb_put_char(kgdb_sci_port, c);
-}
-
-/* Clear any errors on the SCI */
-static void kgdb_handle_error(struct sci_port *port)
-{
-        sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port));  /* Clear error flags */
-}
-
-/* Breakpoint if there's a break sent on the serial port */
-static void kgdb_break_interrupt(int irq, void *ptr, struct pt_regs *regs)
-{
-        struct sci_port *port = ptr;
-        unsigned short status = sci_in(port, SCxSR);
-
-        if (status & SCxSR_BRK(port)) {
-
-                /* Break into the debugger if a break is detected */
-                BREAKPOINT();
-
-                /* Clear */
-                sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port));
-                return;
-        }
-}
-
-#endif /* CONFIG_SH_KGDB */
-
-static struct real_driver sci_real_driver = {
-	sci_disable_tx_interrupts,
-	sci_enable_tx_interrupts,
-	sci_disable_rx_interrupts,
-	sci_enable_rx_interrupts,
-	sci_get_CD,
-	sci_shutdown_port,
-	sci_set_real_termios,
-	sci_chars_in_buffer,
-        sci_close,
-        sci_hungup,
-	NULL
-};
-
-#if !defined(__H8300H__) && !defined(__H8300S__)
-#if defined(SCI_ONLY) || defined(SCI_AND_SCIF)
-static void sci_init_pins_sci(struct sci_port* port, unsigned int cflag)
-{
-}
-#endif
-
-#if defined(SCIF_ONLY) || defined(SCI_AND_SCIF)
-#if defined(CONFIG_CPU_SH3)
-/* For SH7707, SH7709, SH7709A, SH7729 */
-static void sci_init_pins_scif(struct sci_port* port, unsigned int cflag)
-{
-	unsigned int fcr_val = 0;
-
-	{
-		unsigned short data;
-
-		/* We need to set SCPCR to enable RTS/CTS */
-		data = ctrl_inw(SCPCR);
-		/* Clear out SCP7MD1,0, SCP6MD1,0, SCP4MD1,0*/
-		ctrl_outw(data&0x0cff, SCPCR);
-	}
-	if (cflag & CRTSCTS)
-		fcr_val |= SCFCR_MCE;
-	else {
-		unsigned short data;
-
-		/* We need to set SCPCR to enable RTS/CTS */
-		data = ctrl_inw(SCPCR);
-		/* Clear out SCP7MD1,0, SCP4MD1,0,
-		   Set SCP6MD1,0 = {01} (output)  */
-		ctrl_outw((data&0x0cff)|0x1000, SCPCR);
-
-		data = ctrl_inb(SCPDR);
-		/* Set /RTS2 (bit6) = 0 */
-		ctrl_outb(data&0xbf, SCPDR);
-	}
-	sci_out(port, SCFCR, fcr_val);
-}
-
-static void sci_init_pins_irda(struct sci_port* port, unsigned int cflag)
-{
-	unsigned int fcr_val = 0;
-
-	if (cflag & CRTSCTS)
-		fcr_val |= SCFCR_MCE;
-
-	sci_out(port, SCFCR, fcr_val);
-}
-
-#else
-
-/* For SH7750 */
-static void sci_init_pins_scif(struct sci_port* port, unsigned int cflag)
-{
-	unsigned int fcr_val = 0;
-
-	if (cflag & CRTSCTS) {
-		fcr_val |= SCFCR_MCE;
-	} else {
-		ctrl_outw(0x0080, SCSPTR2); /* Set RTS = 1 */
-	}
-	sci_out(port, SCFCR, fcr_val);
-}
-
-#endif
-#endif /* SCIF_ONLY || SCI_AND_SCIF */
-#else /* !defined(__H8300H__) && !defined(__H8300S__) */
-static void sci_init_pins_sci(struct sci_port* port, unsigned int cflag)
-{
-	int ch = (port->base - SMR0) >> 3;
-	/* set DDR regs */
-	H8300_GPIO_DDR(h8300_sci_pins[ch].port,h8300_sci_pins[ch].rx,H8300_GPIO_INPUT);
-	H8300_GPIO_DDR(h8300_sci_pins[ch].port,h8300_sci_pins[ch].tx,H8300_GPIO_OUTPUT);
-	/* tx mark output*/
-	H8300_SCI_DR(ch) |= h8300_sci_pins[ch].tx;
-}
-
-#if defined(__H8300S__)
-enum {sci_disable,sci_enable};
-
-static void h8300_sci_enable(struct sci_port* port, unsigned int ctrl)
-{
-	volatile unsigned char *mstpcrl=(volatile unsigned char *)MSTPCRL;
-	int ch = (port->base  - SMR0) >> 3;
-	unsigned char mask = 1 << (ch+1);
-	if (ctrl == sci_disable)
-		*mstpcrl |= mask;
-	else
-		*mstpcrl &= ~mask;
-}
-#endif
-#endif
-
-static void sci_setsignals(struct sci_port *port, int dtr, int rts)
-{
-	/* This routine is used for seting signals of: DTR, DCD, CTS/RTS */
-	/* We use SCIF's hardware for CTS/RTS, so don't need any for that. */
-	/* If you have signals for DTR and DCD, please implement here. */
-	;
-}
-
-static int sci_getsignals(struct sci_port *port)
-{
-	/* This routine is used for geting signals of: DTR, DCD, DSR, RI,
-	   and CTS/RTS */
-
-	return TIOCM_DTR|TIOCM_RTS|TIOCM_DSR;
-/*
-	(((o_stat & OP_DTR)?TIOCM_DTR:0) |
-	 ((o_stat & OP_RTS)?TIOCM_RTS:0) |
-	 ((i_stat & IP_CTS)?TIOCM_CTS:0) |
-	 ((i_stat & IP_DCD)?TIOCM_CAR:0) |
-	 ((i_stat & IP_DSR)?TIOCM_DSR:0) |
-	 ((i_stat & IP_RI) ?TIOCM_RNG:0)
-*/
-}
-
-static void sci_set_baud(struct sci_port *port, int baud)
-{
-	int t;
-
-	switch (baud) {
-	case 0:
-		t = -1;
-		break;
-	case 2400:
-		t = BPS_2400;
-		break;
-	case 4800:
-		t = BPS_4800;
-		break;
-	case 9600:
-		t = BPS_9600;
-		break;
-	case 19200:
-		t = BPS_19200;
-		break;
-	case 38400:
-		t = BPS_38400;
-		break;
-	case 57600:
-		t = BPS_57600;
-		break;
-	default:
-		printk(KERN_INFO "sci: unsupported baud rate: %d, using 115200 instead.\n", baud);
-	case 115200:
-		t = BPS_115200;
-		break;
-	}
-
-	if (t > 0) {
-		sci_setsignals (port, 1, -1);
-		if(t >= 256) {
-			sci_out(port, SCSMR, (sci_in(port, SCSMR) & ~3) | 1);
-			t >>= 2;
-		} else {
-			sci_out(port, SCSMR, sci_in(port, SCSMR) & ~3);
-		}
-		sci_out(port, SCBRR, t);
-		udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */
-	} else {
-		sci_setsignals (port, 0, -1);
-	}
-}
-
-static void sci_set_termios_cflag(struct sci_port *port, int cflag, int baud)
-{
-	unsigned int status;
-	unsigned int smr_val;
-
-	do
-		status = sci_in(port, SCxSR);
-	while (!(status & SCxSR_TEND(port)));
-
-	sci_out(port, SCSCR, 0x00);	/* TE=0, RE=0, CKE1=0 */
-
-#if !defined(SCI_ONLY)
-	if (port->type == PORT_SCIF) {
-		sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
-	}
-#endif
-
-	smr_val = sci_in(port, SCSMR) & 3;
-	if ((cflag & CSIZE) == CS7)
-		smr_val |= 0x40;
-	if (cflag & PARENB)
-		smr_val |= 0x20;
-	if (cflag & PARODD)
-		smr_val |= 0x30;
-	if (cflag & CSTOPB)
-		smr_val |= 0x08;
-	sci_out(port, SCSMR, smr_val);
-	sci_set_baud(port, baud);
-
-	port->init_pins(port, cflag);
-	sci_out(port, SCSCR, SCSCR_INIT(port));
-}
-
-static int sci_set_real_termios(void *ptr)
-{
-	struct sci_port *port = ptr;
-
-	if (port->old_cflag != port->gs.tty->termios->c_cflag) {
-		port->old_cflag = port->gs.tty->termios->c_cflag;
-		sci_set_termios_cflag(port, port->old_cflag, port->gs.baud);
-		sci_enable_rx_interrupts(port);
-	}
-
-	return 0;
-}
-
-/* ********************************************************************** *
- *                   the interrupt related routines                       *
- * ********************************************************************** */
-
-/*
- * This routine is used by the interrupt handler to schedule
- * processing in the software interrupt portion of the driver.
- */
-static inline void sci_sched_event(struct sci_port *port, int event)
-{
-	port->event |= 1 << event;
-	schedule_work(&port->tqueue);
-}
-
-static void sci_transmit_chars(struct sci_port *port)
-{
-	int count, i;
-	int txroom;
-	unsigned long flags;
-	unsigned short status;
-	unsigned short ctrl;
-	unsigned char c;
-
-	status = sci_in(port, SCxSR);
-	if (!(status & SCxSR_TDxE(port))) {
-		local_irq_save(flags);
-		ctrl = sci_in(port, SCSCR);
-		if (port->gs.xmit_cnt == 0) {
-			ctrl &= ~SCI_CTRL_FLAGS_TIE;
-			port->gs.flags &= ~GS_TX_INTEN;
-		} else
-			ctrl |= SCI_CTRL_FLAGS_TIE;
-		sci_out(port, SCSCR, ctrl);
-		local_irq_restore(flags);
-		return;
-	}
-
-	while (1) {
-		count = port->gs.xmit_cnt;
-#if !defined(SCI_ONLY)
-		if (port->type == PORT_SCIF) {
-			txroom = 16 - (sci_in(port, SCFDR)>>8);
-		} else {
-			txroom = (sci_in(port, SCxSR) & SCI_TDRE)?1:0;
-		}
-#else
-		txroom = (sci_in(port, SCxSR) & SCI_TDRE)?1:0;
-#endif
-		if (count > txroom)
-			count = txroom;
-
-		/* Don't copy past the end of the source buffer */
-		if (count > SERIAL_XMIT_SIZE - port->gs.xmit_tail)
-                	count = SERIAL_XMIT_SIZE - port->gs.xmit_tail;
-
-		/* If for one reason or another, we can't copy more data, we're done! */
-		if (count == 0)
-			break;
-
-		for (i=0; i<count; i++) {
-			c = port->gs.xmit_buf[port->gs.xmit_tail + i];
-			sci_out(port, SCxTDR, c);
-		}
-		sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
-
-		port->icount.tx += count;
-
-		/* Update the kernel buffer end */
-		port->gs.xmit_tail = (port->gs.xmit_tail + count) & (SERIAL_XMIT_SIZE-1);
-
-		/* This one last. (this is essential)
-		   It would allow others to start putting more data into the buffer! */
-		port->gs.xmit_cnt -= count;
-	}
-
-	if (port->gs.xmit_cnt <= port->gs.wakeup_chars)
-		sci_sched_event(port, SCI_EVENT_WRITE_WAKEUP);
-
-	local_irq_save(flags);
-	ctrl = sci_in(port, SCSCR);
-	if (port->gs.xmit_cnt == 0) {
-		ctrl &= ~SCI_CTRL_FLAGS_TIE;
-		port->gs.flags &= ~GS_TX_INTEN;
-	} else {
-#if !defined(SCI_ONLY)
-		if (port->type == PORT_SCIF) {
-			sci_in(port, SCxSR); /* Dummy read */
-			sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
-		}
-#endif
-		ctrl |= SCI_CTRL_FLAGS_TIE;
-	}
-	sci_out(port, SCSCR, ctrl);
-	local_irq_restore(flags);
-}
-
-/* On SH3, SCIF may read end-of-break as a space->mark char */
-#define STEPFN(c)  ({int __c=(c); (((__c-1)|(__c)) == -1); })
-
-static inline void sci_receive_chars(struct sci_port *port,
-				     struct pt_regs *regs)
-{
-	int i, count;
-	struct tty_struct *tty;
-	int copied=0;
-	unsigned short status;
-
-	status = sci_in(port, SCxSR);
-	if (!(status & SCxSR_RDxF(port)))
-		return;
-
-	tty = port->gs.tty;
-	while (1) {
-#if !defined(SCI_ONLY)
-		if (port->type == PORT_SCIF) {
-			count = sci_in(port, SCFDR)&0x001f;
-		} else {
-			count = (sci_in(port, SCxSR)&SCxSR_RDxF(port))?1:0;
-		}
-#else
-		count = (sci_in(port, SCxSR)&SCxSR_RDxF(port))?1:0;
-#endif
-
-		/* Don't copy more bytes than there is room for in the buffer */
-		if (tty->flip.count + count > TTY_FLIPBUF_SIZE)
-			count = TTY_FLIPBUF_SIZE - tty->flip.count;
-
-		/* If for any reason we can't copy more data, we're done! */
-		if (count == 0)
-			break;
-
-		if (port->type == PORT_SCI) {
-			tty->flip.char_buf_ptr[0] = sci_in(port, SCxRDR);
-			tty->flip.flag_buf_ptr[0] = TTY_NORMAL;
-		} else {
-			for (i=0; i<count; i++) {
-				char c = sci_in(port, SCxRDR);
-				status = sci_in(port, SCxSR);
-#if defined(__SH3__)
-				/* Skip "chars" during break */
-				if (port->break_flag) {
-					if ((c == 0) &&
-					    (status & SCxSR_FER(port))) {
-						count--; i--;
-						continue;
-					}
-					/* Nonzero => end-of-break */
-					dprintk("scif: debounce<%02x>\n", c);
-					port->break_flag = 0;
-					if (STEPFN(c)) {
-						count--; i--;
-						continue;
-					}
-				}
-#endif /* __SH3__ */
-#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-				if (break_pressed && (port == sercons_port)) {
-					if (c != 0 &&
-					    time_before(jiffies,
-							break_pressed + HZ*5)) {
-						handle_sysrq(c, regs, NULL);
-						break_pressed = 0;
-						count--; i--;
-						continue;
-					} else if (c != 0) {
-						break_pressed = 0;
-					}
-				}
-#endif /* CONFIG_SERIAL_CONSOLE && CONFIG_MAGIC_SYSRQ */
-
-				/* Store data and status */
-				tty->flip.char_buf_ptr[i] = c;
-				if (status&SCxSR_FER(port)) {
-					tty->flip.flag_buf_ptr[i] = TTY_FRAME;
-					dprintk("sci: frame error\n");
-				} else if (status&SCxSR_PER(port)) {
-					tty->flip.flag_buf_ptr[i] = TTY_PARITY;
-					dprintk("sci: parity error\n");
-				} else {
-					tty->flip.flag_buf_ptr[i] = TTY_NORMAL;
-				}
-			}
-		}
-
-		sci_in(port, SCxSR); /* dummy read */
-		sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
-
-		/* Update the kernel buffer end */
-		tty->flip.count += count;
-		tty->flip.char_buf_ptr += count;
-		tty->flip.flag_buf_ptr += count;
-
-		copied += count;
-		port->icount.rx += count;
-	}
-
-	if (copied)
-		/* Tell the rest of the system the news. New characters! */
-		tty_flip_buffer_push(tty);
-	else {
-		sci_in(port, SCxSR); /* dummy read */
-		sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
-	}
-}
-
-static inline int sci_handle_errors(struct sci_port *port)
-{
-	int copied = 0;
-	unsigned short status = sci_in(port, SCxSR);
-	struct tty_struct *tty = port->gs.tty;
-
-	if (status&SCxSR_ORER(port) && tty->flip.count<TTY_FLIPBUF_SIZE) {
-		/* overrun error */
-		copied++;
-		*tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
-		dprintk("sci: overrun error\n");
-	}
-
-	if (status&SCxSR_FER(port) && tty->flip.count<TTY_FLIPBUF_SIZE) {
-		if (sci_rxd_in(port) == 0) {
-			/* Notify of BREAK */
-			copied++;
-			*tty->flip.flag_buf_ptr++ = TTY_BREAK;
-			dprintk("sci: BREAK detected\n");
-		}
-		else {
-			/* frame error */
-			copied++;
-			*tty->flip.flag_buf_ptr++ = TTY_FRAME;
-			dprintk("sci: frame error\n");
-		}
-	}
-
-	if (status&SCxSR_PER(port) && tty->flip.count<TTY_FLIPBUF_SIZE) {
-		/* parity error */
-		copied++;
-		*tty->flip.flag_buf_ptr++ = TTY_PARITY;
-		dprintk("sci: parity error\n");
-	}
-
-	if (copied) {
-		tty->flip.count += copied;
-		tty_flip_buffer_push(tty);
-	}
-
-	return copied;
-}
-
-static inline int sci_handle_breaks(struct sci_port *port)
-{
-	int copied = 0;
-	unsigned short status = sci_in(port, SCxSR);
-	struct tty_struct *tty = port->gs.tty;
-
-	if (status&SCxSR_BRK(port) && tty->flip.count<TTY_FLIPBUF_SIZE) {
-#if defined(__SH3__)
-		/* Debounce break */
-		if (port->break_flag)
-			goto break_continue;
-		port->break_flag = 1;
-#endif
-#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-		if (port == sercons_port) {
-			if (break_pressed == 0) {
-				break_pressed = jiffies;
-				dprintk("sci: implied sysrq\n");
-				goto break_continue;
-			}
-			/* Double break implies a real break */
-			break_pressed = 0;
-		}
-#endif
-		/* Notify of BREAK */
-		copied++;
-		*tty->flip.flag_buf_ptr++ = TTY_BREAK;
-		dprintk("sci: BREAK detected\n");
-	}
- break_continue:
-
-#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_ST40STB1) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7760)
-	/* XXX: Handle SCIF overrun error */
-	if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) {
-		sci_out(port, SCLSR, 0);
-		if(tty->flip.count<TTY_FLIPBUF_SIZE) {
-			copied++;
-			*tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
-			dprintk("sci: overrun error\n");
-		}
-	}
-#endif
-
-	if (copied) {
-		tty->flip.count += copied;
-		tty_flip_buffer_push(tty);
-	}
-
-	return copied;
-}
-
-static irqreturn_t sci_rx_interrupt(int irq, void *ptr, struct pt_regs *regs)
-{
-	struct sci_port *port = ptr;
-
-	if (port->gs.flags & GS_ACTIVE)
-		if (!(port->gs.flags & SCI_RX_THROTTLE)) {
-			sci_receive_chars(port, regs);
-			return IRQ_HANDLED;
-
-		}
-	sci_disable_rx_interrupts(port);
-
-	return IRQ_HANDLED;
-}
-
-static irqreturn_t sci_tx_interrupt(int irq, void *ptr, struct pt_regs *regs)
-{
-	struct sci_port *port = ptr;
-
-	if (port->gs.flags & GS_ACTIVE)
-		sci_transmit_chars(port);
-	else {
-		sci_disable_tx_interrupts(port);
-	}
-
-	return IRQ_HANDLED;
-}
-
-static irqreturn_t sci_er_interrupt(int irq, void *ptr, struct pt_regs *regs)
-{
-	struct sci_port *port = ptr;
-
-	/* Handle errors */
-	if (port->type == PORT_SCI) {
-		if(sci_handle_errors(port)) {
-			/* discard character in rx buffer */
-			sci_in(port, SCxSR);
-			sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
-		}
-	}
-	else
-		sci_rx_interrupt(irq, ptr, regs);
-		
-	sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port));
-
-	/* Kick the transmission */
-	sci_tx_interrupt(irq, ptr, regs);
-
-	return IRQ_HANDLED;
-}
-
-#if !defined(SCI_ONLY)
-static irqreturn_t sci_br_interrupt(int irq, void *ptr, struct pt_regs *regs)
-{
-	struct sci_port *port = ptr;
-
-	/* Handle BREAKs */
-	sci_handle_breaks(port);
-	sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port));
-
-	return IRQ_HANDLED;
-}
-#endif
-
-static void do_softint(void *private_)
-{
-	struct sci_port *port = (struct sci_port *) private_;
-	struct tty_struct	*tty;
-	
-	tty = port->gs.tty;
-	if (!tty)
-		return;
-
-	if (test_and_clear_bit(SCI_EVENT_WRITE_WAKEUP, &port->event)) {
-		if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
-		    tty->ldisc.write_wakeup)
-			(tty->ldisc.write_wakeup)(tty);
-		wake_up_interruptible(&tty->write_wait);
-	}
-}
-
-/* ********************************************************************** *
- *                Here are the routines that actually                     *
- *              interface with the generic_serial driver                  *
- * ********************************************************************** */
-
-static void sci_disable_tx_interrupts(void *ptr)
-{
-	struct sci_port *port = ptr;
-	unsigned long flags;
-	unsigned short ctrl;
-
-	/* Clear TIE (Transmit Interrupt Enable) bit in SCSCR */
-	local_irq_save(flags);
-	ctrl = sci_in(port, SCSCR);
-	ctrl &= ~SCI_CTRL_FLAGS_TIE;
-	sci_out(port, SCSCR, ctrl);
-	local_irq_restore(flags);
-}
-
-static void sci_enable_tx_interrupts(void *ptr)
-{
-	struct sci_port *port = ptr; 
-
-	disable_irq(port->irqs[SCIx_TXI_IRQ]);
-	sci_transmit_chars(port);
-	enable_irq(port->irqs[SCIx_TXI_IRQ]);
-}
-
-static void sci_disable_rx_interrupts(void * ptr)
-{
-	struct sci_port *port = ptr;
-	unsigned long flags;
-	unsigned short ctrl;
-
-	/* Clear RIE (Receive Interrupt Enable) bit in SCSCR */
-	local_irq_save(flags);
-	ctrl = sci_in(port, SCSCR);
-	ctrl &= ~SCI_CTRL_FLAGS_RIE;
-	sci_out(port, SCSCR, ctrl);
-	local_irq_restore(flags);
-}
-
-static void sci_enable_rx_interrupts(void * ptr)
-{
-	struct sci_port *port = ptr;
-	unsigned long flags;
-	unsigned short ctrl;
-
-	/* Set RIE (Receive Interrupt Enable) bit in SCSCR */
-	local_irq_save(flags);
-	ctrl = sci_in(port, SCSCR);
-	ctrl |= SCI_CTRL_FLAGS_RIE;
-	sci_out(port, SCSCR, ctrl);
-	local_irq_restore(flags);
-}
-
-static int sci_get_CD(void * ptr)
-{
-	/* If you have signal for CD (Carrier Detect), please change here. */
-	return 1;
-}
-
-static int sci_chars_in_buffer(void * ptr)
-{
-	struct sci_port *port = ptr;
-
-#if !defined(SCI_ONLY)
-	if (port->type == PORT_SCIF) {
-		return (sci_in(port, SCFDR) >> 8) + ((sci_in(port, SCxSR) & SCxSR_TEND(port))? 0: 1);
-	} else {
-		return (sci_in(port, SCxSR) & SCxSR_TEND(port))? 0: 1;
-	}
-#else
-	return (sci_in(port, SCxSR) & SCxSR_TEND(port))? 0: 1;
-#endif
-}
-
-static void sci_shutdown_port(void * ptr)
-{
-	struct sci_port *port = ptr; 
-
-	port->gs.flags &= ~ GS_ACTIVE;
-	if (port->gs.tty && port->gs.tty->termios->c_cflag & HUPCL)
-		sci_setsignals(port, 0, 0);
-	sci_free_irq(port);
-#if defined(__H8300S__)
-	h8300_sci_enable(port,sci_disable);
-#endif
-}
-
-/* ********************************************************************** *
- *                Here are the routines that actually                     *
- *               interface with the rest of the system                    *
- * ********************************************************************** */
-
-static int sci_open(struct tty_struct * tty, struct file * filp)
-{
-	struct sci_port *port;
-	int retval, line;
-
-	line = tty->index;
-
-	if ((line < 0) || (line >= SCI_NPORTS))
-		return -ENODEV;
-
-	port = &sci_ports[line];
-
-	tty->driver_data = port;
-	port->gs.tty = tty;
-	port->gs.count++;
-
-	port->event = 0;
-	INIT_WORK(&port->tqueue, do_softint, port);
-
-#if defined(__H8300S__)
-		h8300_sci_enable(port,sci_enable);
-#endif
-
-	/*
-	 * Start up serial port
-	 */
-	retval = gs_init_port(&port->gs);
-	if (retval) {
-		goto failed_1;
-	}
-
-	port->gs.flags |= GS_ACTIVE;
-	sci_setsignals(port, 1,1);
-
-	if (port->gs.count == 1) {
-		retval = sci_request_irq(port);
-	}
-
-	retval = gs_block_til_ready(port, filp);
-
-	if (retval) {
-		goto failed_3;
-	}
-
-#ifdef CONFIG_SERIAL_CONSOLE
-	if (sercons.cflag && sercons.index == line) {
-		tty->termios->c_cflag = sercons.cflag;
-		port->gs.baud = sercons_baud;
-		sercons.cflag = 0;
-		sci_set_real_termios(port);
-	}
-#endif
-
-#ifdef CONFIG_SH_KGDB_CONSOLE
-        if (kgdbcons.cflag && kgdbcons.index == line) {
-                tty->termios->c_cflag = kgdbcons.cflag;
-                port->gs.baud = kgdb_baud;
-                sercons.cflag = 0;
-                sci_set_real_termios(port);
-        }
-#endif
-
-	sci_enable_rx_interrupts(port);
-
-	return 0;
-
-failed_3:
-	sci_free_irq(port);
-failed_1:
-	port->gs.count--;
-	return retval;
-}
-
-static void sci_hungup(void *ptr)
-{
-        return;
-}
-
-static void sci_close(void *ptr)
-{
-        return;
-}
-
-static int sci_tiocmget(struct tty_struct *tty, struct file *file)
-{
-	struct sci_port *port = tty->driver_data;
-	return sci_getsignals(port);
-}
-
-static int sci_tiocmset(struct tty_struct *tty, struct file *file,
-			unsigned int set, unsigned int clear)
-{
-	struct sci_port *port = tty->driver_data;
-	int rts = -1, dtr = -1;
-
-	if (set & TIOCM_RTS)
-		rts = 1;
-	if (set & TIOCM_DTR)
-		dtr = 1;
-	if (clear & TIOCM_RTS)
-		rts = 0;
-	if (clear & TIOCM_DTR)
-		dtr = 0;
-
-	sci_setsignals(port, dtr, rts);
-	return 0;
-}
-
-static int sci_ioctl(struct tty_struct * tty, struct file * filp, 
-                     unsigned int cmd, unsigned long arg)
-{
-	int rc;
-	struct sci_port *port = tty->driver_data;
-	int ival;
-
-	rc = 0;
-	switch (cmd) {
-	case TIOCGSOFTCAR:
-		rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0),
-		              (unsigned int __user *) arg);
-		break;
-	case TIOCSSOFTCAR:
-		if ((rc = get_user(ival, (unsigned int __user *) arg)) == 0)
-			tty->termios->c_cflag =
-				(tty->termios->c_cflag & ~CLOCAL) |
-				(ival ? CLOCAL : 0);
-		break;
-	case TIOCGSERIAL:
-		if ((rc = verify_area(VERIFY_WRITE, (void __user *) arg,
-		                      sizeof(struct serial_struct))) == 0)
-			rc = gs_getserial(&port->gs, (struct serial_struct *) arg);
-		break;
-	case TIOCSSERIAL:
-		if ((rc = verify_area(VERIFY_READ, (void __user *) arg,
-		                      sizeof(struct serial_struct))) == 0)
-			rc = gs_setserial(&port->gs,
-					  (struct serial_struct *) arg);
-		break;
-	default:
-		rc = -ENOIOCTLCMD;
-		break;
-	}
-
-	return rc;
-}
-
-static void sci_throttle(struct tty_struct * tty)
-{
-	struct sci_port *port = (struct sci_port *)tty->driver_data;
-
-	/* If the port is using any type of input flow
-	 * control then throttle the port.
-	 */
-	if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty)) )
-		port->gs.flags |= SCI_RX_THROTTLE;
-}
-
-static void sci_unthrottle(struct tty_struct * tty)
-{
-	struct sci_port *port = (struct sci_port *)tty->driver_data;
-
-	/* Always unthrottle even if flow control is not enabled on
-	 * this port in case we disabled flow control while the port
-	 * was throttled
-	 */
-	port->gs.flags &= ~SCI_RX_THROTTLE;
-	sci_enable_rx_interrupts(port);
-	return;
-}
-
-#ifdef CONFIG_PROC_FS
-static int sci_read_proc(char *page, char **start, off_t off, int count,
-			 int *eof, void *data)
-{
-	int i;
-	struct sci_port *port;
-	int len = 0;
-	
-        len += sprintf(page, "sciinfo:0.1\n");
-	for (i = 0; i < SCI_NPORTS && len < 4000; i++) {
-		port = &sci_ports[i];
-		len += sprintf(page+len, "%d: uart:%s address: %08x", i,
-			       (port->type == PORT_SCI) ? "SCI" : "SCIF",
-			       port->base);
-		len += sprintf(page+len, " baud:%d", port->gs.baud);
-		len += sprintf(page+len, " tx:%d rx:%d",
-			       port->icount.tx, port->icount.rx);
-
-		if (port->icount.frame)
-			len += sprintf(page+len, " fe:%d", port->icount.frame);
-		if (port->icount.parity)
-			len += sprintf(page+len, " pe:%d", port->icount.parity);
-		if (port->icount.brk)
-			len += sprintf(page+len, " brk:%d", port->icount.brk);
-		if (port->icount.overrun)
-			len += sprintf(page+len, " oe:%d", port->icount.overrun);
-		len += sprintf(page+len, "\n");
-	}
-	return len;
-}
-#endif
-
-#ifdef CONFIG_CPU_FREQ
-/*
- * Here we define a transistion notifier so that we can update all of our
- * ports' baud rate when the peripheral clock changes.
- */
-
-static int sci_notifier(struct notifier_block *self, unsigned long phase, void *p)
-{
-	struct cpufreq_freqs *freqs = p;
-	int i;
-
-	if (phase == CPUFREQ_POSTCHANGE) {
-		for (i = 0; i < SCI_NPORTS; i++) {
-			/*
-			 * This will force a baud rate change in hardware.
-			 */
-			if (sci_ports[i].gs.tty != NULL) {
-				sci_set_baud(&sci_ports[i], sci_ports[i].gs.baud);
-			}
-		}
-		printk("%s: got a postchange notification for cpu %d (old %d, new %d)\n",
-				__FUNCTION__, freqs->cpu, freqs->old, freqs->new);
-	}
-
-	return NOTIFY_OK;
-}
-
-static struct notifier_block sci_nb = { &sci_notifier, NULL, 0 };
-#endif /* CONFIG_CPU_FREQ */
-
-static struct tty_operations sci_ops = {
-	.open	= sci_open,
-	.close = gs_close,
-	.write = gs_write,
-	.put_char = gs_put_char,
-	.flush_chars = gs_flush_chars,
-	.write_room = gs_write_room,
-	.chars_in_buffer = gs_chars_in_buffer,
-	.flush_buffer = gs_flush_buffer,
-	.ioctl = sci_ioctl,
-	.throttle = sci_throttle,
-	.unthrottle = sci_unthrottle,
-	.set_termios = gs_set_termios,
-	.stop = gs_stop,
-	.start = gs_start,
-	.hangup = gs_hangup,
-#ifdef CONFIG_PROC_FS
-	.read_proc = sci_read_proc,
-#endif
-	.tiocmget = sci_tiocmget,
-	.tiocmset = sci_tiocmset,
-};
-
-/* ********************************************************************** *
- *                    Here are the initialization routines.               *
- * ********************************************************************** */
-
-static int sci_init_drivers(void)
-{
-	int error;
-	struct sci_port *port;
-	sci_driver = alloc_tty_driver(SCI_NPORTS);
-	if (!sci_driver)
-		return -ENOMEM;
-
-	sci_driver->owner = THIS_MODULE;
-	sci_driver->driver_name = "sci";
-	sci_driver->name = "ttySC";
-	sci_driver->devfs_name = "ttsc/";
-	sci_driver->major = SCI_MAJOR;
-	sci_driver->minor_start = SCI_MINOR_START;
-	sci_driver->type = TTY_DRIVER_TYPE_SERIAL;
-	sci_driver->subtype = SERIAL_TYPE_NORMAL;
-	sci_driver->init_termios = tty_std_termios;
-	sci_driver->init_termios.c_cflag =
-		B9600 | CS8 | CREAD | HUPCL | CLOCAL | CRTSCTS;
-	sci_driver->flags = TTY_DRIVER_REAL_RAW;
-	tty_set_operations(sci_driver, &sci_ops);
-	if ((error = tty_register_driver(sci_driver))) {
-		printk(KERN_ERR "sci: Couldn't register SCI driver, error = %d\n",
-		       error);
-		put_tty_driver(sci_driver);
-		return 1;
-	}
-
-	for (port = &sci_ports[0]; port < &sci_ports[SCI_NPORTS]; port++) {
-		port->gs.magic = SCI_MAGIC;
-		port->gs.close_delay = HZ/2;
-		port->gs.closing_wait = 30 * HZ;
-		port->gs.rd = &sci_real_driver;
-		init_waitqueue_head(&port->gs.open_wait);
-		init_waitqueue_head(&port->gs.close_wait);
-		port->old_cflag = 0;
-		port->icount.cts = port->icount.dsr = 
-			port->icount.rng = port->icount.dcd = 0;
-		port->icount.rx = port->icount.tx = 0;
-		port->icount.frame = port->icount.parity = 0;
-		port->icount.overrun = port->icount.brk = 0;
-	}
-
-#ifdef CONFIG_CPU_FREQ
-	/* Setup transition notifier */
-	if (cpufreq_register_notifier(&sci_nb, CPUFREQ_TRANSITION_NOTIFIER) < 0) {
-		printk(KERN_ERR "sci: Unable to register CPU frequency notifier\n");
-		return 1;
-	}
-	printk("sci: CPU frequency notifier registered\n");
-#endif
-	return 0;
-}
-
-static int sci_request_irq(struct sci_port *port)
-{
-	int i;
-#if !defined(SCI_ONLY)
-	irqreturn_t (*handlers[4])(int irq, void *p, struct pt_regs *regs) = {
-		sci_er_interrupt, sci_rx_interrupt, sci_tx_interrupt,
-		sci_br_interrupt,
-	};
-#else
-	void (*handlers[3])(int irq, void *ptr, struct pt_regs *regs) = {
-		sci_er_interrupt, sci_rx_interrupt, sci_tx_interrupt,
-	};
-#endif
-	for (i=0; i<(sizeof(handlers)/sizeof(handlers[0])); i++) {
-		if (!port->irqs[i]) continue;
-		if (request_irq(port->irqs[i], handlers[i], SA_INTERRUPT,
-				"sci", port)) {
-			printk(KERN_ERR "sci: Cannot allocate irq.\n");
-			return -ENODEV;
-		}
-	}
-	return 0;
-}
-
-static void sci_free_irq(struct sci_port *port)
-{
-	int i;
-
-	for (i=0; i<4; i++) {
-		if (!port->irqs[i]) continue;
-		free_irq(port->irqs[i], port);
-	}
-}
-
-static char banner[] __initdata =
-	KERN_INFO "SuperH SCI(F) driver initialized\n";
-
-int __init sci_init(void)
-{
-	struct sci_port *port;
-	int j;
-
-	printk("%s", banner);
-
-	for (j=0; j<SCI_NPORTS; j++) {
-		port = &sci_ports[j];
-		printk(KERN_INFO "ttySC%d at 0x%08x is a %s\n", j, port->base,
-		       (port->type == PORT_SCI) ? "SCI" : "SCIF");
-	}
-
-	sci_init_drivers();
-
-#ifdef CONFIG_SH_STANDARD_BIOS
-	sh_bios_gdb_detach();
-#endif
-	return 0;		/* Return -EIO when not detected */
-}
-
-module_init(sci_init);
-
-#ifdef MODULE
-#undef func_enter
-#undef func_exit
-
-void cleanup_module(void)
-{
-	tty_unregister_driver(sci_driver);
-	put_tty_driver(sci_driver);
-}
-
-#include "generic_serial.c"
-#endif
-
-#ifdef CONFIG_SERIAL_CONSOLE
-/*
- *	Print a string to the serial port trying not to disturb
- *	any possible real use of the port...
- */
-static void serial_console_write(struct console *co, const char *s,
-				 unsigned count)
-{
-	put_string(sercons_port, s, count);
-}
-
-static struct tty_driver *serial_console_device(struct console *c, int *index)
-{
-	*index = c->index;
-	return sci_driver;
-}
-
-/*
- *	Setup initial baud/bits/parity. We do two things here:
- *	- construct a cflag setting for the first rs_open()
- *	- initialize the serial port
- *	Return non-zero if we didn't find a serial port.
- */
-static int __init serial_console_setup(struct console *co, char *options)
-{
-	int	baud = 9600;
-	int	bits = 8;
-	int	parity = 'n';
-	int	cflag = CREAD | HUPCL | CLOCAL;
-	char	*s;
-
-	sercons_port = &sci_ports[co->index];
-
-	if (options) {
-		baud = simple_strtoul(options, NULL, 10);
-		s = options;
-		while(*s >= '0' && *s <= '9')
-			s++;
-		if (*s) parity = *s++;
-		if (*s) bits   = *s - '0';
-	}
-
-	/*
-	 *	Now construct a cflag setting.
-	 */
-	switch (baud) {
-		case 19200:
-			cflag |= B19200;
-			break;
-		case 38400:
-			cflag |= B38400;
-			break;
-		case 57600:
-			cflag |= B57600;
-			break;
-		case 115200:
-			cflag |= B115200;
-			break;
-		case 9600:
-		default:
-			cflag |= B9600;
-			baud = 9600;
-			break;
-	}
-	switch (bits) {
-		case 7:
-			cflag |= CS7;
-			break;
-		default:
-		case 8:
-			cflag |= CS8;
-			break;
-	}
-	switch (parity) {
-		case 'o': case 'O':
-			cflag |= PARODD;
-			break;
-		case 'e': case 'E':
-			cflag |= PARENB;
-			break;
-	}
-
-	co->cflag = cflag;
-	sercons_baud = baud;
-
-#if defined(__H8300S__)
-	h8300_sci_enable(sercons_port,sci_enable);
-#endif
-	sci_set_termios_cflag(sercons_port, cflag, baud);
-	sercons_port->old_cflag = cflag;
-
-	return 0;
-}
-
-static struct console sercons = {
-	.name		= "ttySC",
-	.write		= serial_console_write,
-	.device		= serial_console_device,
-	.setup		= serial_console_setup,
-	.flags		= CON_PRINTBUFFER,
-	.index		= -1,
-};
-
-/*
- *	Register console.
- */
-
-#ifdef CONFIG_SH_EARLY_PRINTK
-extern void sh_console_unregister (void);
-#endif
-
-static int __init sci_console_init(void)
-{
-	register_console(&sercons);
-#ifdef CONFIG_SH_EARLY_PRINTK
-	/* Now that the real console is available, unregister the one we
-	 * used while first booting.
-	 */
-	sh_console_unregister();
-#endif
-	return 0;
-}
-console_initcall(sci_console_init);
-
-#endif /* CONFIG_SERIAL_CONSOLE */
-
-
-#ifdef CONFIG_SH_KGDB
-
-/* Initialise the KGDB serial port */
-int kgdb_sci_setup(void)
-{
-	int cflag = CREAD | HUPCL | CLOCAL;
-
-	if ((kgdb_portnum < 0) || (kgdb_portnum >= SCI_NPORTS))
-		return -1;
-
-        kgdb_sci_port = &sci_ports[kgdb_portnum];
-
-	switch (kgdb_baud) {
-        case 115200:
-                cflag |= B115200;
-                break;
-	case 57600:
-                cflag |= B57600;
-                break;
-        case 38400:
-                cflag |= B38400;
-                break;
-        case 19200:
-                cflag |= B19200;
-                break;
-        case 9600:
-        default:
-                cflag |= B9600;
-                kgdb_baud = 9600;
-                break;
-        }
-
-	switch (kgdb_bits) {
-        case '7':
-                cflag |= CS7;
-                break;
-        default:
-        case '8':
-                cflag |= CS8;
-                break;
-        }
-
-        switch (kgdb_parity) {
-        case 'O':
-                cflag |= PARODD;
-                break;
-        case 'E':
-                cflag |= PARENB;
-                break;
-        }
-
-        kgdb_cflag = cflag;
-        sci_set_termios_cflag(kgdb_sci_port, kgdb_cflag, kgdb_baud);
-
-        /* Set up the interrupt for BREAK from GDB */
-	/* Commented out for now since it may not be possible yet...
-	   request_irq(kgdb_sci_port->irqs[0], kgdb_break_interrupt,
-	               SA_INTERRUPT, "sci", kgdb_sci_port);
-	   sci_enable_rx_interrupts(kgdb_sci_port);
-	*/
-
-	/* Setup complete: initialize function pointers */
-	kgdb_getchar = kgdb_sci_getchar;
-	kgdb_putchar = kgdb_sci_putchar;
-
-        return 0;
-}
-
-#ifdef CONFIG_SH_KGDB_CONSOLE
-
-/* Create a console device */
-static kdev_t kgdb_console_device(struct console *c)
-{
-        return MKDEV(SCI_MAJOR, SCI_MINOR_START + c->index);
-}
-
-/* Set up the KGDB console */
-static int __init kgdb_console_setup(struct console *co, char *options)
-{
-        /* NB we ignore 'options' because we've already done the setup */
-        co->cflag = kgdb_cflag;
-
-        return 0;
-}
-
-/* Register the KGDB console so we get messages (d'oh!) */
-void __init kgdb_console_init(void)
-{
-        register_console(&kgdbcons);
-}
-
-/* The console structure for KGDB */
-static struct console kgdbcons = {
-        name:"ttySC",
-        write:kgdb_console_write,
-        device:kgdb_console_device,
-        wait_key:serial_console_wait_key,
-        setup:kgdb_console_setup,
-        flags:CON_PRINTBUFFER | CON_ENABLED,
-        index:-1,
-};
-
-#endif /* CONFIG_SH_KGDB_CONSOLE */
-
-#endif /* CONFIG_SH_KGDB */
diff -Nru a/drivers/char/sh-sci.h b/drivers/char/sh-sci.h
--- a/drivers/char/sh-sci.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,478 +0,0 @@
-/* $Id: sh-sci.h,v 1.7 2004/02/10 17:04:17 lethal Exp $
- *
- *  linux/drivers/char/sh-sci.h
- *
- *  SuperH on-chip serial module support.  (SCI with no FIFO / with FIFO)
- *  Copyright (C) 1999, 2000  Niibe Yutaka
- *  Copyright (C) 2000  Greg Banks
- *  Modified to support multiple serial ports. Stuart Menefy (May 2000).
- *  Modified to support SH7760 SCIF. Paul Mundt (Oct 2003).
- *  Modified to support H8/300 Serise Yoshinori Sato (Feb 2004). 
- *
- */
-#include <linux/config.h>
-
-#if defined(__H8300H__) || defined(__H8300S__)
-#include <asm/gpio.h>
-#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
-#include <asm/regs306x.h>
-#endif
-#if defined(CONFIG_H8S2678)
-#include <asm/regs267x.h>
-#endif
-#endif
-
-/* Values for sci_port->type */
-#define PORT_SCI  0
-#define PORT_SCIF 1
-#define PORT_IRDA 1		/* XXX: temporary assignment */
-
-/* Offsets into the sci_port->irqs array */
-#define SCIx_ERI_IRQ 0
-#define SCIx_RXI_IRQ 1
-#define SCIx_TXI_IRQ 2
-
-/*                     ERI, RXI, TXI, BRI */
-#define SCI_IRQS      { 23,  24,  25,   0 }
-#define SH3_SCIF_IRQS { 56,  57,  59,  58 }
-#define SH3_IRDA_IRQS { 52,  53,  55,  54 }
-#define SH4_SCIF_IRQS { 40,  41,  43,  42 }
-#define STB1_SCIF1_IRQS {23, 24,  26,  25 }
-#define SH7760_SCIF0_IRQS { 52, 53, 55, 54 }
-#define SH7760_SCIF1_IRQS { 72, 73, 75, 74 }
-#define SH7760_SCIF2_IRQS { 76, 77, 79, 78 }
-#define H8300H_SCI_IRQS0 {52, 53, 54,   0 }
-#define H8300H_SCI_IRQS1 {56, 57, 58,   0 }
-#define H8300H_SCI_IRQS2 {60, 61, 62,   0 }
-#define H8S_SCI_IRQS0 {88, 89, 90,   0 }
-#define H8S_SCI_IRQS1 {92, 93, 94,   0 }
-#define H8S_SCI_IRQS2 {96, 97, 98,   0 }
-
-#if defined(CONFIG_CPU_SUBTYPE_SH7708)
-# define SCI_NPORTS 1
-# define SCI_INIT { \
-  { {}, PORT_SCI,  0xfffffe80, SCI_IRQS,      sci_init_pins_sci  } \
-}
-# define SCSPTR 0xffffff7c /* 8 bit */
-# define SCSCR_INIT(port)          0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
-# define SCI_ONLY
-#elif defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709)
-# define SCI_NPORTS 3
-# define SCI_INIT { \
-  { {}, PORT_SCI,  0xfffffe80, SCI_IRQS,      sci_init_pins_sci  }, \
-  { {}, PORT_SCIF, 0xA4000150, SH3_SCIF_IRQS, sci_init_pins_scif }, \
-  { {}, PORT_SCIF, 0xA4000140, SH3_IRDA_IRQS, sci_init_pins_irda }  \
-}
-# define SCPCR  0xA4000116 /* 16 bit SCI and SCIF */
-# define SCPDR  0xA4000136 /* 8  bit SCI and SCIF */
-# define SCSCR_INIT(port)          0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
-# define SCI_AND_SCIF
-#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751)
-# define SCI_NPORTS 2
-# define SCI_INIT { \
-  { {}, PORT_SCI,  0xffe00000, SCI_IRQS,      sci_init_pins_sci  }, \
-  { {}, PORT_SCIF, 0xFFE80000, SH4_SCIF_IRQS, sci_init_pins_scif }  \
-}
-# define SCSPTR1 0xffe0001c /* 8  bit SCI */
-# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
-# define SCIF_ORER 0x0001   /* overrun error bit */
-# define SCSCR_INIT(port) (((port)->type == PORT_SCI) ? \
-	0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \
-	0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ )
-# define SCI_AND_SCIF
-#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
-# define SCI_NPORTS 3
-# define SCI_INIT { \
-  { {}, PORT_SCIF, 0xfe600000, SH7760_SCIF0_IRQS, sci_init_pins_scif }, \
-  { {}, PORT_SCIF, 0xfe610000, SH7760_SCIF1_IRQS, sci_init_pins_scif }, \
-  { {}, PORT_SCIF, 0xfe620000, SH7760_SCIF2_IRQS, sci_init_pins_scif }  \
-}
-# define SCSPTR0 0xfe600024 /* 16 bit SCIF */
-# define SCSPTR1 0xfe610024 /* 16 bit SCIF */
-# define SCSPTR2 0xfe620024 /* 16 bit SCIF */
-# define SCIF_ORDER 0x0001  /* overrun error bit */
-# define SCSCR_INIT(port)          0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
-# define SCIF_ONLY
-#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
-# define SCI_NPORTS 2
-# define SCI_INIT { \
-  { {}, PORT_SCIF, 0xffe00000, STB1_SCIF1_IRQS, sci_init_pins_scif }, \
-  { {}, PORT_SCIF, 0xffe80000, SH4_SCIF_IRQS,   sci_init_pins_scif }  \
-}
-# define SCSPTR1 0xffe00020 /* 16 bit SCIF */
-# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
-# define SCIF_ORER 0x0001   /* overrun error bit */
-# define SCSCR_INIT(port)          0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
-# define SCIF_ONLY
-#elif defined(CONFIG_H83007) || defined(CONFIG_H83068)
-# define SCI_NPORTS 3
-# define SCI_INIT { \
-  { {}, PORT_SCI,  0x00ffffb0, H8300H_SCI_IRQS0, sci_init_pins_sci }, \
-  { {}, PORT_SCI,  0x00ffffb8, H8300H_SCI_IRQS1, sci_init_pins_sci }, \
-  { {}, PORT_SCI,  0x00ffffc0, H8300H_SCI_IRQS2, sci_init_pins_sci }  \
-}
-# define SCSCR_INIT(port)          0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
-# define SCI_ONLY
-# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
-#elif defined(CONFIG_H8S2678)
-# define SCI_NPORTS 3
-# define SCI_INIT { \
-  { {}, PORT_SCI,  0x00ffff78, H8S_SCI_IRQS0, sci_init_pins_sci }, \
-  { {}, PORT_SCI,  0x00ffff80, H8S_SCI_IRQS1, sci_init_pins_sci }, \
-  { {}, PORT_SCI,  0x00ffff88, H8S_SCI_IRQS2, sci_init_pins_sci }  \
-}
-# define SCSCR_INIT(port)          0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
-# define SCI_ONLY
-# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
-#else
-# error CPU subtype not defined
-#endif
-
-/* SCSCR */
-#define SCI_CTRL_FLAGS_TIE  0x80 /* all */
-#define SCI_CTRL_FLAGS_RIE  0x40 /* all */
-#define SCI_CTRL_FLAGS_TE   0x20 /* all */
-#define SCI_CTRL_FLAGS_RE   0x10 /* all */
-/*      SCI_CTRL_FLAGS_REIE 0x08  * 7750 SCIF */
-/*      SCI_CTRL_FLAGS_MPIE 0x08  * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-/*      SCI_CTRL_FLAGS_TEIE 0x04  * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-/*      SCI_CTRL_FLAGS_CKE1 0x02  * all */
-/*      SCI_CTRL_FLAGS_CKE0 0x01  * 7707 SCI/SCIF, 7708 SCI, 7709 SCI/SCIF, 7750 SCI */
-
-/* SCxSR SCI */
-#define SCI_TDRE  0x80 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-#define SCI_RDRF  0x40 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-#define SCI_ORER  0x20 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-#define SCI_FER   0x10 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-#define SCI_PER   0x08 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-#define SCI_TEND  0x04 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-/*      SCI_MPB   0x02  * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-/*      SCI_MPBT  0x01  * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
-
-#define SCI_ERRORS ( SCI_PER | SCI_FER | SCI_ORER)
-
-/* SCxSR SCIF */
-#define SCIF_ER    0x0080 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */
-#define SCIF_TEND  0x0040 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */
-#define SCIF_TDFE  0x0020 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */
-#define SCIF_BRK   0x0010 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */
-#define SCIF_FER   0x0008 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */
-#define SCIF_PER   0x0004 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */
-#define SCIF_RDF   0x0002 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */
-#define SCIF_DR    0x0001 /* 7707 SCIF, 7709 SCIF, 7750 SCIF */
-
-#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
-
-#if defined(SCI_ONLY)
-# define SCxSR_TEND(port)		SCI_TEND
-# define SCxSR_ERRORS(port)		SCI_ERRORS
-# define SCxSR_RDxF(port)               SCI_RDRF
-# define SCxSR_TDxE(port)               SCI_TDRE
-# define SCxSR_ORER(port)		SCI_ORER
-# define SCxSR_FER(port)		SCI_FER
-# define SCxSR_PER(port)		SCI_PER
-# define SCxSR_BRK(port)		0x00
-# define SCxSR_RDxF_CLEAR(port)		0xbc
-# define SCxSR_ERROR_CLEAR(port)	0xc4
-# define SCxSR_TDxE_CLEAR(port)		0x78
-# define SCxSR_BREAK_CLEAR(port)   	0xc4
-#elif defined(SCIF_ONLY) 
-# define SCxSR_TEND(port)		SCIF_TEND
-# define SCxSR_ERRORS(port)		SCIF_ERRORS
-# define SCxSR_RDxF(port)               SCIF_RDF
-# define SCxSR_TDxE(port)               SCIF_TDFE
-# define SCxSR_ORER(port)		0x0000
-# define SCxSR_FER(port)		SCIF_FER
-# define SCxSR_PER(port)		SCIF_PER
-# define SCxSR_BRK(port)		SCIF_BRK
-# define SCxSR_RDxF_CLEAR(port)		0x00fc
-# define SCxSR_ERROR_CLEAR(port)	0x0073
-# define SCxSR_TDxE_CLEAR(port)		0x00df
-# define SCxSR_BREAK_CLEAR(port)   	0x00e3
-#else
-# define SCxSR_TEND(port)	 (((port)->type == PORT_SCI) ? SCI_TEND   : SCIF_TEND)
-# define SCxSR_ERRORS(port)	 (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS)
-# define SCxSR_RDxF(port)        (((port)->type == PORT_SCI) ? SCI_RDRF   : SCIF_RDF)
-# define SCxSR_TDxE(port)        (((port)->type == PORT_SCI) ? SCI_TDRE   : SCIF_TDFE)
-# define SCxSR_ORER(port)        (((port)->type == PORT_SCI) ? SCI_ORER   : 0x0000)
-# define SCxSR_FER(port)         (((port)->type == PORT_SCI) ? SCI_FER    : SCIF_FER)
-# define SCxSR_PER(port)         (((port)->type == PORT_SCI) ? SCI_PER    : SCIF_PER)
-# define SCxSR_BRK(port)         (((port)->type == PORT_SCI) ? 0x00       : SCIF_BRK)
-# define SCxSR_RDxF_CLEAR(port)	 (((port)->type == PORT_SCI) ? 0xbc : 0x00fc)
-# define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073)
-# define SCxSR_TDxE_CLEAR(port)  (((port)->type == PORT_SCI) ? 0x78 : 0x00df)
-# define SCxSR_BREAK_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x00e3)
-#endif
-
-/* SCFCR */
-#define SCFCR_RFRST 0x0002
-#define SCFCR_TFRST 0x0004
-#define SCFCR_MCE   0x0008
-
-#define SCI_MAJOR		204
-#define SCI_MINOR_START		8
-
-/* Generic serial flags */
-#define SCI_RX_THROTTLE		0x0000001
-
-#define SCI_MAGIC 0xbabeface
-
-/*
- * Events are used to schedule things to happen at timer-interrupt
- * time, instead of at rs interrupt time.
- */
-#define SCI_EVENT_WRITE_WAKEUP	0
-
-struct sci_port {
-	struct gs_port gs;
-	int type;
-	unsigned int base;
-	unsigned char irqs[4]; /* ERI, RXI, TXI, BRI */
-	void (*init_pins)(struct sci_port* port, unsigned int cflag);
-	unsigned int old_cflag;
-	struct async_icount icount;
-	struct work_struct tqueue;
-	unsigned long event;
-	int break_flag;
-};
-
-#define SCI_IN(size, offset)					\
-  unsigned int addr = port->base + (offset);			\
-  if ((size) == 8) { 						\
-    return ctrl_inb(addr);					\
-  } else {					 		\
-    return ctrl_inw(addr);					\
-  }
-#define SCI_OUT(size, offset, value)				\
-  unsigned int addr = port->base + (offset);			\
-  if ((size) == 8) { 						\
-    ctrl_outb(value, addr);					\
-  } else {							\
-    ctrl_outw(value, addr);					\
-  }
-
-#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
-  static inline unsigned int sci_##name##_in(struct sci_port* port)	\
-  {									\
-    if (port->type == PORT_SCI) { 					\
-      SCI_IN(sci_size, sci_offset)					\
-    } else {								\
-      SCI_IN(scif_size, scif_offset);		 			\
-    }									\
-  }									\
-  static inline void sci_##name##_out(struct sci_port* port, unsigned int value) \
-  {									\
-    if (port->type == PORT_SCI) {					\
-      SCI_OUT(sci_size, sci_offset, value)				\
-    } else {								\
-      SCI_OUT(scif_size, scif_offset, value);				\
-    }									\
-  }
-
-#define CPU_SCIF_FNS(name, scif_offset, scif_size)				\
-  static inline unsigned int sci_##name##_in(struct sci_port* port)	\
-  {									\
-    SCI_IN(scif_size, scif_offset);		 			\
-  }									\
-  static inline void sci_##name##_out(struct sci_port* port, unsigned int value) \
-  {									\
-    SCI_OUT(scif_size, scif_offset, value);				\
-  }
-
-#define CPU_SCI_FNS(name, sci_offset, sci_size)				\
-  static inline unsigned int sci_##name##_in(struct sci_port* port)	\
-  {									\
-    SCI_IN(sci_size, sci_offset);		 			\
-  }									\
-  static inline void sci_##name##_out(struct sci_port* port, unsigned int value) \
-  {									\
-    SCI_OUT(sci_size, sci_offset, value);				\
-  }
-
-#ifdef CONFIG_CPU_SH3
-#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
-		 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
-                 h8_sci_offset, h8_sci_size) \
-  CPU_SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh3_scif_offset, sh3_scif_size)
-#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
-  CPU_SCIF_FNS(name, sh3_scif_offset, sh3_scif_size)
-#elif defined(__H8300H__) || defined(__H8300S__)
-#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
-		 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
-                 h8_sci_offset, h8_sci_size) \
-  CPU_SCI_FNS(name, h8_sci_offset, h8_sci_size)
-#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size)
-#else
-#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
-		 sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
-		 h8_sci_offset, h8_sci_size) \
-  CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
-#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
-  CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
-#endif
-
-/*      reg      SCI/SH3   SCI/SH4  SCIF/SH3   SCIF/SH4  SCI/H8*/
-/*      name     off  sz   off  sz   off  sz   off  sz   off  sz*/
-SCIx_FNS(SCSMR,  0x00,  8, 0x00,  8, 0x00,  8, 0x00, 16, 0x00,  8)
-SCIx_FNS(SCBRR,  0x02,  8, 0x04,  8, 0x02,  8, 0x04,  8, 0x01,  8)
-SCIx_FNS(SCSCR,  0x04,  8, 0x08,  8, 0x04,  8, 0x08, 16, 0x02,  8)
-SCIx_FNS(SCxTDR, 0x06,  8, 0x0c,  8, 0x06,  8, 0x0C,  8, 0x03,  8)
-SCIx_FNS(SCxSR,  0x08,  8, 0x10,  8, 0x08, 16, 0x10, 16, 0x04,  8)
-SCIx_FNS(SCxRDR, 0x0a,  8, 0x14,  8, 0x0A,  8, 0x14,  8, 0x05,  8)
-SCIF_FNS(SCFCR,                      0x0c,  8, 0x18, 16)
-SCIF_FNS(SCFDR,                      0x0e, 16, 0x1C, 16)
-SCIF_FNS(SCLSR,                         0,  0, 0x24, 16)
-
-#define sci_in(port, reg) sci_##reg##_in(port)
-#define sci_out(port, reg, value) sci_##reg##_out(port, value)
-
-/* H8/300 series SCI pins assignment */
-#if defined(__H8300H__) || defined(__H8300S__)
-static const struct __attribute__((packed))
-{
-	int port;             /* GPIO port no */
-	unsigned short rx,tx; /* GPIO bit no */
-} h8300_sci_pins[] =
-{
-#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
-	{    /* SCI0 */
-		.port = H8300_GPIO_P9,
-		.rx   = H8300_GPIO_B2,
-		.tx   = H8300_GPIO_B0,
-	},
-	{    /* SCI1 */
-		.port = H8300_GPIO_P9,
-		.rx   = H8300_GPIO_B3,
-		.tx   = H8300_GPIO_B1,
-	},
-	{    /* SCI2 */
-		.port = H8300_GPIO_PB,
-		.rx   = H8300_GPIO_B7,
-		.tx   = H8300_GPIO_B6,
-	}
-#elif defined(CONFIG_H8S2678)
-	{    /* SCI0 */
-		.port = H8300_GPIO_P3,
-		.rx   = H8300_GPIO_B2,
-		.tx   = H8300_GPIO_B0,
-	},
-	{    /* SCI1 */
-		.port = H8300_GPIO_P3,
-		.rx   = H8300_GPIO_B3,
-		.tx   = H8300_GPIO_B1,
-	},
-	{    /* SCI2 */
-		.port = H8300_GPIO_P5,
-		.rx   = H8300_GPIO_B1,
-		.tx   = H8300_GPIO_B0,
-	}
-#endif
-};
-#endif
-
-#if defined(CONFIG_CPU_SUBTYPE_SH7708)
-static inline int sci_rxd_in(struct sci_port *port)
-{
-	if (port->base == 0xfffffe80)
-		return ctrl_inb(SCSPTR)&0x01 ? 1 : 0; /* SCI */
-	return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709)
-static inline int sci_rxd_in(struct sci_port *port)
-{
-	if (port->base == 0xfffffe80)
-		return ctrl_inb(SCPDR)&0x01 ? 1 : 0; /* SCI */
-	if (port->base == 0xa4000150)
-		return ctrl_inb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
-	if (port->base == 0xa4000140)
-		return ctrl_inb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
-	return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751)
-static inline int sci_rxd_in(struct sci_port *port)
-{
-#ifndef SCIF_ONLY
-	if (port->base == 0xffe00000)
-		return ctrl_inb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
-#endif
-#ifndef SCI_ONLY
-	if (port->base == 0xffe80000)
-		return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
-#endif
-	return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
-static inline int sci_rxd_in(struct sci_port *port)
-{
-	if (port->base == 0xfe600000)
-		return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
-	if (port->base == 0xfe610000)
-		return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
-	if (port->base == 0xfe620000)
-		return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
-}
-#elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
-static inline int sci_rxd_in(struct sci_port *port)
-{
-	if (port->base == 0xffe00000)
-		return ctrl_inw(SCSPTR1)&0x0001 ? 1 : 0; /* SCIF */
-	else
-		return ctrl_inw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
-
-}
-#elif defined(__H8300H__) || defined(__H8300S__)
-static inline int sci_rxd_in(struct sci_port *port)
-{
-	int ch = (port->base - SMR0) >> 3;
-	return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0;
-}
-#endif
-
-/*
- * Values for the BitRate Register (SCBRR)
- *
- * The values are actually divisors for a frequency which can
- * be internal to the SH3 (14.7456MHz) or derived from an external
- * clock source.  This driver assumes the internal clock is used;
- * to support using an external clock source, config options or
- * possibly command-line options would need to be added.
- *
- * Also, to support speeds below 2400 (why?) the lower 2 bits of
- * the SCSMR register would also need to be set to non-zero values.
- *
- * -- Greg Banks 27Feb2000
- *
- * Answer: The SCBRR register is only eight bits, and the value in
- * it gets larger with lower baud rates. At around 2400 (depending on
- * the peripherial module clock) you run out of bits. However the
- * lower two bits of SCSMR allow the module clock to be divided down,
- * scaling the value which is needed in SCBRR.
- *
- * -- Stuart Menefy - 23 May 2000
- *
- * I meant, why would anyone bother with bitrates below 2400.
- *
- * -- Greg Banks - 7Jul2000
- *
- * You "speedist"!  How will I use my 110bps ASR-33 teletype with paper
- * tape reader as a console!
- *
- * -- Mitch Davis - 15 Jul 2000
- */
-
-#define PCLK           (current_cpu_data.module_clock)
-
-#if !defined(__H8300H__) && !defined(__H8300S__)
-#define SCBRR_VALUE(bps) ((PCLK+16*bps)/(32*bps)-1)
-#else
-#define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1)
-#endif
-#define BPS_2400       SCBRR_VALUE(2400)
-#define BPS_4800       SCBRR_VALUE(4800)
-#define BPS_9600       SCBRR_VALUE(9600)
-#define BPS_19200      SCBRR_VALUE(19200)
-#define BPS_38400      SCBRR_VALUE(38400)
-#define BPS_57600      SCBRR_VALUE(57600)
-#define BPS_115200     SCBRR_VALUE(115200)
-#define BPS_230400     SCBRR_VALUE(230400)
-
diff -Nru a/drivers/char/sn_serial.c b/drivers/char/sn_serial.c
--- a/drivers/char/sn_serial.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/sn_serial.c	Tue Jun 15 22:21:05 2004
@@ -502,7 +502,7 @@
 	int result;
 
 	console_nasid = ia64_sn_get_console_nasid();
-	intr_cpuid = NODEPDA(NASID_TO_COMPACT_NODEID(console_nasid))->node_first_cpu;
+	intr_cpuid = first_cpu(node_to_cpumask(nasid_to_cnodeid(console_nasid)));
 	intr_cpuloc = cpu_physical_id(intr_cpuid);
 	console_irq = CPU_VECTOR_TO_IRQ(intr_cpuloc, SGI_UART_VECTOR);
 
diff -Nru a/drivers/char/sonypi.c b/drivers/char/sonypi.c
--- a/drivers/char/sonypi.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/sonypi.c	Tue Jun 15 22:20:43 2004
@@ -461,8 +461,9 @@
 	return 0;
 }
 
-static ssize_t sonypi_misc_read(struct file * file, char * buf, 
-		                size_t count, loff_t *pos) {
+static ssize_t sonypi_misc_read(struct file * file, char __user * buf,
+			size_t count, loff_t *pos)
+{
 	DECLARE_WAITQUEUE(wait, current);
 	ssize_t i = count;
 	unsigned char c;
@@ -504,6 +505,7 @@
 static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, 
 			     unsigned int cmd, unsigned long arg) {
 	int ret = 0;
+	void __user *argp = (void __user *)arg;
 	u8 val8;
 	u16 val16;
 
@@ -514,11 +516,11 @@
 			ret = -EIO;
 			break;
 		}
-		if (copy_to_user((u8 *)arg, &val8, sizeof(val8)))
+		if (copy_to_user(argp, &val8, sizeof(val8)))
 			ret = -EFAULT;
 		break;
 	case SONYPI_IOCSBRT:
-		if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) {
+		if (copy_from_user(&val8, argp, sizeof(val8))) {
 			ret = -EFAULT;
 			break;
 		}
@@ -530,7 +532,7 @@
 			ret = -EIO;
 			break;
 		}
-		if (copy_to_user((u16 *)arg, &val16, sizeof(val16)))
+		if (copy_to_user(argp, &val16, sizeof(val16)))
 			ret = -EFAULT;
 		break;
 	case SONYPI_IOCGBAT1REM:
@@ -538,7 +540,7 @@
 			ret = -EIO;
 			break;
 		}
-		if (copy_to_user((u16 *)arg, &val16, sizeof(val16)))
+		if (copy_to_user(argp, &val16, sizeof(val16)))
 			ret = -EFAULT;
 		break;
 	case SONYPI_IOCGBAT2CAP:
@@ -546,7 +548,7 @@
 			ret = -EIO;
 			break;
 		}
-		if (copy_to_user((u16 *)arg, &val16, sizeof(val16)))
+		if (copy_to_user(argp, &val16, sizeof(val16)))
 			ret = -EFAULT;
 		break;
 	case SONYPI_IOCGBAT2REM:
@@ -554,7 +556,7 @@
 			ret = -EIO;
 			break;
 		}
-		if (copy_to_user((u16 *)arg, &val16, sizeof(val16)))
+		if (copy_to_user(argp, &val16, sizeof(val16)))
 			ret = -EFAULT;
 		break;
 	case SONYPI_IOCGBATFLAGS:
@@ -563,16 +565,16 @@
 			break;
 		}
 		val8 &= 0x07;
-		if (copy_to_user((u8 *)arg, &val8, sizeof(val8)))
+		if (copy_to_user(argp, &val8, sizeof(val8)))
 			ret = -EFAULT;
 		break;
 	case SONYPI_IOCGBLUE:
 		val8 = sonypi_device.bluetooth_power;
-		if (copy_to_user((u8 *)arg, &val8, sizeof(val8)))
+		if (copy_to_user(argp, &val8, sizeof(val8)))
 			ret = -EFAULT;
 		break;
 	case SONYPI_IOCSBLUE:
-		if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) {
+		if (copy_from_user(&val8, argp, sizeof(val8))) {
 			ret = -EFAULT;
 			break;
 		}
diff -Nru a/drivers/char/synclink.c b/drivers/char/synclink.c
--- a/drivers/char/synclink.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/char/synclink.c	Tue Jun 15 22:20:39 2004
@@ -1,7 +1,7 @@
 /*
  * linux/drivers/char/synclink.c
  *
- * $Id: synclink.c,v 4.21 2004/03/08 15:29:22 paulkf Exp $
+ * $Id: synclink.c,v 4.24 2004/06/03 14:50:09 paulkf Exp $
  *
  * Device driver for Microgate SyncLink ISA and PCI
  * high speed multiprotocol serial adapters.
@@ -782,7 +782,6 @@
 void mgsl_release_resources(struct mgsl_struct *info);
 void mgsl_add_device(struct mgsl_struct *info);
 struct mgsl_struct* mgsl_allocate_device(void);
-int mgsl_enum_isa_devices(void);
 
 /*
  * DMA buffer manupulation functions.
@@ -853,19 +852,22 @@
 static int tiocmset(struct tty_struct *tty, struct file *file,
 		    unsigned int set, unsigned int clear);
 static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount
-	*user_icount);
-static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS *user_params);
-static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS *new_params);
-static int mgsl_get_txidle(struct mgsl_struct * info, int*idle_mode);
+	__user *user_icount);
+static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS  __user *user_params);
+static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS  __user *new_params);
+static int mgsl_get_txidle(struct mgsl_struct * info, int __user *idle_mode);
 static int mgsl_set_txidle(struct mgsl_struct * info, int idle_mode);
 static int mgsl_txenable(struct mgsl_struct * info, int enable);
 static int mgsl_txabort(struct mgsl_struct * info);
 static int mgsl_rxenable(struct mgsl_struct * info, int enable);
-static int mgsl_wait_event(struct mgsl_struct * info, int * mask);
+static int mgsl_wait_event(struct mgsl_struct * info, int __user *mask);
 static int mgsl_loopmode_send_done( struct mgsl_struct * info );
 
 #define jiffies_from_ms(a) ((((a) * HZ)/1000)+1)
 
+/* set non-zero on successful registration with PCI subsystem */
+static int pci_registered;
+
 /*
  * Global linked list of SyncLink devices
  */
@@ -909,7 +911,7 @@
 MODULE_PARM(txholdbufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
 
 static char *driver_name = "SyncLink serial driver";
-static char *driver_version = "$Revision: 4.21 $";
+static char *driver_version = "$Revision: 4.24 $";
 
 static int synclink_init_one (struct pci_dev *dev,
 				     const struct pci_device_id *ent);
@@ -950,8 +952,10 @@
  * (gdb) to get the .text address for the add-symbol-file command.
  * This allows remote debugging of dynamically loadable modules.
  */
-void* mgsl_get_text_ptr(void);
-void* mgsl_get_text_ptr() {return mgsl_get_text_ptr;}
+void* mgsl_get_text_ptr(void)
+{
+	return mgsl_get_text_ptr;
+}
 
 /*
  * tmp_buf is used as a temporary buffer by mgsl_write.  We need to
@@ -2521,7 +2525,7 @@
  * 	
  * Return Value:	0 if success, otherwise error code
  */
-static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount *user_icount)
+static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount __user *user_icount)
 {
 	int err;
 	
@@ -2550,7 +2554,7 @@
  * 	
  * Return Value:	0 if success, otherwise error code
  */
-static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS *user_params)
+static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS __user *user_params)
 {
 	int err;
 	if (debug_level >= DEBUG_LEVEL_INFO)
@@ -2580,7 +2584,7 @@
  *
  * Return Value:	0 if success, otherwise error code
  */
-static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS *new_params)
+static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS __user *new_params)
 {
  	unsigned long flags;
 	MGSL_PARAMS tmp_params;
@@ -2616,7 +2620,7 @@
  * 	
  * Return Value:	0 if success, otherwise error code
  */
-static int mgsl_get_txidle(struct mgsl_struct * info, int*idle_mode)
+static int mgsl_get_txidle(struct mgsl_struct * info, int __user *idle_mode)
 {
 	int err;
 	
@@ -2763,7 +2767,7 @@
  *				of events triggerred,
  * 			otherwise error code
  */
-static int mgsl_wait_event(struct mgsl_struct * info, int * mask_ptr)
+static int mgsl_wait_event(struct mgsl_struct * info, int __user * mask_ptr)
 {
  	unsigned long flags;
 	int s;
@@ -3051,16 +3055,17 @@
 {
 	int error;
 	struct mgsl_icount cnow;	/* kernel counter temps */
-	struct serial_icounter_struct *p_cuser;	/* user space */
+	void __user *argp = (void __user *)arg;
+	struct serial_icounter_struct __user *p_cuser;	/* user space */
 	unsigned long flags;
 	
 	switch (cmd) {
 		case MGSL_IOCGPARAMS:
-			return mgsl_get_params(info,(MGSL_PARAMS *)arg);
+			return mgsl_get_params(info, argp);
 		case MGSL_IOCSPARAMS:
-			return mgsl_set_params(info,(MGSL_PARAMS *)arg);
+			return mgsl_set_params(info, argp);
 		case MGSL_IOCGTXIDLE:
-			return mgsl_get_txidle(info,(int*)arg);
+			return mgsl_get_txidle(info, argp);
 		case MGSL_IOCSTXIDLE:
 			return mgsl_set_txidle(info,(int)arg);
 		case MGSL_IOCTXENABLE:
@@ -3070,9 +3075,9 @@
 		case MGSL_IOCTXABORT:
 			return mgsl_txabort(info);
 		case MGSL_IOCGSTATS:
-			return mgsl_get_stats(info,(struct mgsl_icount*)arg);
+			return mgsl_get_stats(info, argp);
 		case MGSL_IOCWAITEVENT:
-			return mgsl_wait_event(info,(int*)arg);
+			return mgsl_wait_event(info, argp);
 		case MGSL_IOCLOOPTXDONE:
 			return mgsl_loopmode_send_done(info);
 		/* Wait for modem input (DCD,RI,DSR,CTS) change
@@ -3091,7 +3096,7 @@
 			spin_lock_irqsave(&info->irq_spinlock,flags);
 			cnow = info->icount;
 			spin_unlock_irqrestore(&info->irq_spinlock,flags);
-			p_cuser = (struct serial_icounter_struct *) arg;
+			p_cuser = argp;
 			PUT_USER(error,cnow.cts, &p_cuser->cts);
 			if (error) return error;
 			PUT_USER(error,cnow.dsr, &p_cuser->dsr);
@@ -4425,7 +4430,7 @@
  * Arguments:		none
  * Return Value:	pointer to mgsl_struct if success, otherwise NULL
  */
-struct mgsl_struct* mgsl_allocate_device()
+struct mgsl_struct* mgsl_allocate_device(void)
 {
 	struct mgsl_struct *info;
 	
@@ -4484,10 +4489,11 @@
 /*
  * perform tty device initialization
  */
-int mgsl_init_tty(void);
-int mgsl_init_tty()
+static int mgsl_init_tty(void)
 {
-	serial_driver = alloc_tty_driver(mgsl_device_count);
+	int rc;
+
+	serial_driver = alloc_tty_driver(128);
 	if (!serial_driver)
 		return -ENOMEM;
 	
@@ -4503,9 +4509,13 @@
 		B9600 | CS8 | CREAD | HUPCL | CLOCAL;
 	serial_driver->flags = TTY_DRIVER_REAL_RAW;
 	tty_set_operations(serial_driver, &mgsl_ops);
-	if (tty_register_driver(serial_driver) < 0)
+	if ((rc = tty_register_driver(serial_driver)) < 0) {
 		printk("%s(%d):Couldn't register serial driver\n",
 			__FILE__,__LINE__);
+		put_tty_driver(serial_driver);
+		serial_driver = NULL;
+		return rc;
+	}
 			
  	printk("%s %s, tty major#%d\n",
 		driver_name, driver_version,
@@ -4515,7 +4525,7 @@
 
 /* enumerate user specified ISA adapters
  */
-int mgsl_enum_isa_devices()
+static void mgsl_enum_isa_devices(void)
 {
 	struct mgsl_struct *info;
 	int i;
@@ -4546,51 +4556,9 @@
 		
 		mgsl_add_device( info );
 	}
-	
-	return 0;
 }
 
-/* mgsl_init()
- * 
- * 	Driver initialization entry point.
- * 	
- * Arguments:	None
- * Return Value:	0 if success, otherwise error code
- */
-int __init mgsl_init(void)
-{
-	int rc;
-
- 	printk("%s %s\n", driver_name, driver_version);
-	
-	mgsl_enum_isa_devices();
-	pci_register_driver(&synclink_pci_driver);
-
-	if ( !mgsl_device_list ) {
-		printk("%s(%d):No SyncLink devices found.\n",__FILE__,__LINE__);
-		return -ENODEV;
-	}
-	if ((rc = mgsl_init_tty()))
-		return rc;
-	
-	return 0;
-}
-
-static int __init synclink_init(void)
-{
-/* Uncomment this to kernel debug module.
- * mgsl_get_text_ptr() leaves the .text address in eax
- * which can be used with add-symbol-file with gdb.
- */
-	if (break_on_load) {
-	 	mgsl_get_text_ptr();
-  		BREAKPOINT();
-	}
-	
-	return mgsl_init();
-}
-
-static void __exit synclink_exit(void) 
+static void synclink_cleanup(void)
 {
 	int rc;
 	struct mgsl_struct *info;
@@ -4598,11 +4566,13 @@
 
 	printk("Unloading %s: %s\n", driver_name, driver_version);
 
-	if ((rc = tty_unregister_driver(serial_driver)))
-		printk("%s(%d) failed to unregister tty driver err=%d\n",
-		       __FILE__,__LINE__,rc);
+	if (serial_driver) {
+		if ((rc = tty_unregister_driver(serial_driver)))
+			printk("%s(%d) failed to unregister tty driver err=%d\n",
+			       __FILE__,__LINE__,rc);
+		put_tty_driver(serial_driver);
+	}
 
-	put_tty_driver(serial_driver);
 	info = mgsl_device_list;
 	while(info) {
 #ifdef CONFIG_SYNCLINK_SYNCPPP
@@ -4620,7 +4590,40 @@
 		tmp_buf = NULL;
 	}
 	
-	pci_unregister_driver(&synclink_pci_driver);
+	if (pci_registered)
+		pci_unregister_driver(&synclink_pci_driver);
+}
+
+static int __init synclink_init(void)
+{
+	int rc;
+
+	if (break_on_load) {
+	 	mgsl_get_text_ptr();
+  		BREAKPOINT();
+	}
+
+ 	printk("%s %s\n", driver_name, driver_version);
+
+	mgsl_enum_isa_devices();
+	if ((rc = pci_register_driver(&synclink_pci_driver)) < 0)
+		printk("%s:failed to register PCI driver, error=%d\n",__FILE__,rc);
+	else
+		pci_registered = 1;
+
+	if ((rc = mgsl_init_tty()) < 0)
+		goto error;
+
+	return 0;
+
+error:
+	synclink_cleanup();
+	return rc;
+}
+
+static void __exit synclink_exit(void)
+{
+	synclink_cleanup();
 }
 
 module_init(synclink_init);
diff -Nru a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
--- a/drivers/char/synclinkmp.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/synclinkmp.c	Tue Jun 15 22:20:37 2004
@@ -1,5 +1,5 @@
 /*
- * $Id: synclinkmp.c,v 4.19 2004/03/08 15:29:23 paulkf Exp $
+ * $Id: synclinkmp.c,v 4.22 2004/06/03 14:50:10 paulkf Exp $
  *
  * Device driver for Microgate SyncLink Multiport
  * high speed multiprotocol serial adapter.
@@ -494,7 +494,7 @@
 MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICES) "i");
 
 static char *driver_name = "SyncLink MultiPort driver";
-static char *driver_version = "$Revision: 4.19 $";
+static char *driver_version = "$Revision: 4.22 $";
 
 static int synclinkmp_init_one(struct pci_dev *dev,const struct pci_device_id *ent);
 static void synclinkmp_remove_one(struct pci_dev *dev);
@@ -3781,56 +3781,7 @@
 	.tiocmset = tiocmset,
 };
 
-/* Driver initialization entry point.
- */
-
-static int __init synclinkmp_init(void)
-{
-	if (break_on_load) {
-	 	synclinkmp_get_text_ptr();
-  		BREAKPOINT();
-	}
-
- 	printk("%s %s\n", driver_name, driver_version);
-
-	synclinkmp_adapter_count = -1;
-	pci_register_driver(&synclinkmp_pci_driver);
-
-	if ( !synclinkmp_device_list ) {
-		printk("%s(%d):No SyncLink devices found.\n",__FILE__,__LINE__);
-		return -ENODEV;
-	}
-
-	serial_driver = alloc_tty_driver(synclinkmp_device_count);
-	if (!serial_driver)
-		return -ENOMEM;
-
-	/* Initialize the tty_driver structure */
-
-	serial_driver->owner = THIS_MODULE;
-	serial_driver->driver_name = "synclinkmp";
-	serial_driver->name = "ttySLM";
-	serial_driver->major = ttymajor;
-	serial_driver->minor_start = 64;
-	serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
-	serial_driver->subtype = SERIAL_TYPE_NORMAL;
-	serial_driver->init_termios = tty_std_termios;
-	serial_driver->init_termios.c_cflag =
-		B9600 | CS8 | CREAD | HUPCL | CLOCAL;
-	serial_driver->flags = TTY_DRIVER_REAL_RAW;
-	tty_set_operations(serial_driver, &ops);
-	if (tty_register_driver(serial_driver) < 0)
-		printk("%s(%d):Couldn't register serial driver\n",
-			__FILE__,__LINE__);
-
- 	printk("%s %s, tty major#%d\n",
-		driver_name, driver_version,
-		serial_driver->major);
-
-	return 0;
-}
-
-static void __exit synclinkmp_exit(void)
+static void synclinkmp_cleanup(void)
 {
 	unsigned long flags;
 	int rc;
@@ -3839,10 +3790,12 @@
 
 	printk("Unloading %s %s\n", driver_name, driver_version);
 
-	if ((rc = tty_unregister_driver(serial_driver)))
-		printk("%s(%d) failed to unregister tty driver err=%d\n",
-		       __FILE__,__LINE__,rc);
-	put_tty_driver(serial_driver);
+	if (serial_driver) {
+		if ((rc = tty_unregister_driver(serial_driver)))
+			printk("%s(%d) failed to unregister tty driver err=%d\n",
+			       __FILE__,__LINE__,rc);
+		put_tty_driver(serial_driver);
+	}
 
 	info = synclinkmp_device_list;
 	while(info) {
@@ -3880,6 +3833,69 @@
 	}
 
 	pci_unregister_driver(&synclinkmp_pci_driver);
+}
+
+/* Driver initialization entry point.
+ */
+
+static int __init synclinkmp_init(void)
+{
+	int rc;
+
+	if (break_on_load) {
+	 	synclinkmp_get_text_ptr();
+  		BREAKPOINT();
+	}
+
+ 	printk("%s %s\n", driver_name, driver_version);
+
+	if ((rc = pci_register_driver(&synclinkmp_pci_driver)) < 0) {
+		printk("%s:failed to register PCI driver, error=%d\n",__FILE__,rc);
+		return rc;
+	}
+
+	serial_driver = alloc_tty_driver(128);
+	if (!serial_driver) {
+		rc = -ENOMEM;
+		goto error;
+	}
+
+	/* Initialize the tty_driver structure */
+
+	serial_driver->owner = THIS_MODULE;
+	serial_driver->driver_name = "synclinkmp";
+	serial_driver->name = "ttySLM";
+	serial_driver->major = ttymajor;
+	serial_driver->minor_start = 64;
+	serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
+	serial_driver->subtype = SERIAL_TYPE_NORMAL;
+	serial_driver->init_termios = tty_std_termios;
+	serial_driver->init_termios.c_cflag =
+		B9600 | CS8 | CREAD | HUPCL | CLOCAL;
+	serial_driver->flags = TTY_DRIVER_REAL_RAW;
+	tty_set_operations(serial_driver, &ops);
+	if ((rc = tty_register_driver(serial_driver)) < 0) {
+		printk("%s(%d):Couldn't register serial driver\n",
+			__FILE__,__LINE__);
+		put_tty_driver(serial_driver);
+		serial_driver = NULL;
+		goto error;
+	}
+
+ 	printk("%s %s, tty major#%d\n",
+		driver_name, driver_version,
+		serial_driver->major);
+
+	return 0;
+
+error:
+	synclinkmp_cleanup();
+	return rc;
+}
+
+static void __exit synclinkmp_exit(void)
+{
+	synclinkmp_cleanup();
 }
 
 module_init(synclinkmp_init);
diff -Nru a/drivers/char/sysrq.c b/drivers/char/sysrq.c
--- a/drivers/char/sysrq.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/char/sysrq.c	Tue Jun 15 22:20:44 2004
@@ -313,36 +313,18 @@
 }
 
 /*
- * This function is called by the keyboard handler when SysRq is pressed
- * and any other keycode arrives.
- */
-
-void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
-{
-	if (!sysrq_enabled)
-		return;
-
-	__sysrq_lock_table();
-	__handle_sysrq_nolock(key, pt_regs, tty);
-	__sysrq_unlock_table();
-}
-
-/*
  * This is the non-locking version of handle_sysrq
  * It must/can only be called by sysrq key handlers,
  * as they are inside of the lock
  */
 
-void __handle_sysrq_nolock(int key, struct pt_regs *pt_regs,
-		  	   struct tty_struct *tty) 
+void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
 {
 	struct sysrq_key_op *op_p;
 	int orig_log_level;
 	int i, j;
-	
-	if (!sysrq_enabled)
-		return;
 
+	__sysrq_lock_table();
 	orig_log_level = console_loglevel;
 	console_loglevel = 7;
 	printk(KERN_INFO "SysRq : ");
@@ -364,10 +346,22 @@
 		printk ("\n");
 		console_loglevel = orig_log_level;
 	}
+	__sysrq_unlock_table();
+}
+
+/*
+ * This function is called by the keyboard handler when SysRq is pressed
+ * and any other keycode arrives.
+ */
+
+void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
+{
+	if (!sysrq_enabled)
+		return;
+	__handle_sysrq(key, pt_regs, tty);
 }
 
 EXPORT_SYMBOL(handle_sysrq);
-EXPORT_SYMBOL(__handle_sysrq_nolock);
 EXPORT_SYMBOL(__sysrq_lock_table);
 EXPORT_SYMBOL(__sysrq_unlock_table);
 EXPORT_SYMBOL(__sysrq_get_key_op);
diff -Nru a/drivers/char/tipar.c b/drivers/char/tipar.c
--- a/drivers/char/tipar.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/tipar.c	Tue Jun 15 22:20:43 2004
@@ -58,6 +58,7 @@
 #include <asm/bitops.h>
 #include <linux/devfs_fs_kernel.h>	/* DevFs support */
 #include <linux/parport.h>	/* Our code depend on parport */
+#include <linux/device.h>
 
 /*
  * TI definitions
@@ -92,6 +93,8 @@
 static unsigned int tp_count;	/* tipar count */
 static unsigned long opened;	/* opened devices */
 
+static struct class_simple *tipar_class;
+
 /* --- macros for parport access -------------------------------------- */
 
 #define r_dtr(x)        (parport_read_data(table[(x)].dev->port))
@@ -424,18 +427,26 @@
 static int
 tipar_register(int nr, struct parport *port)
 {
+	int err = 0;
+
 	/* Register our module into parport */
 	table[nr].dev = parport_register_device(port, "tipar",
 						NULL, NULL, NULL, 0,
 						(void *) &table[nr]);
 
-	if (table[nr].dev == NULL)
-		return 1;
+	if (table[nr].dev == NULL) {
+		err = 1;
+		goto out;
+	}
 
+	class_simple_device_add(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
+			NULL, "par%d", nr);
 	/* Use devfs, tree: /dev/ticables/par/[0..2] */
-	devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
+	err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
 			S_IFCHR | S_IRUGO | S_IWUGO,
 			"ticables/par/%d", nr);
+	if (err)
+		goto out_class;
 
 	/* Display informations */
 	printk(KERN_INFO "tipar%d: using %s (%s).\n", nr, port->name,
@@ -447,7 +458,14 @@
 	else
 		printk("tipar%d: link cable not found.\n", nr);
 
-	return 0;
+	err = 0;
+	goto out;
+
+out_class:
+	class_simple_device_remove(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr));
+	class_simple_destroy(tipar_class);
+out:
+	return err;
 }
 
 static void
@@ -477,23 +495,38 @@
 int __init
 tipar_init_module(void)
 {
+	int err = 0;
+
 	printk("tipar: parallel link cable driver, version %s\n",
 	       DRIVER_VERSION);
 
 	if (register_chrdev(TIPAR_MAJOR, "tipar", &tipar_fops)) {
 		printk("tipar: unable to get major %d\n", TIPAR_MAJOR);
-		return -EIO;
+		err = -EIO;
+		goto out;
 	}
 
 	/* Use devfs with tree: /dev/ticables/par/[0..2] */
 	devfs_mk_dir("ticables/par");
 
+	tipar_class = class_simple_create(THIS_MODULE, "ticables");
+	if (IS_ERR(tipar_class)) {
+		err = PTR_ERR(tipar_class);
+		goto out_chrdev;
+	}
 	if (parport_register_driver(&tipar_driver)) {
 		printk("tipar: unable to register with parport\n");
-		return -EIO;
+		err = -EIO;
+		goto out;
 	}
 
-	return 0;
+	err = 0;
+	goto out;
+
+out_chrdev:
+	unregister_chrdev(TIPAR_MAJOR, "tipar");
+out:
+	return err;	
 }
 
 void __exit
@@ -510,8 +543,10 @@
 		if (table[i].dev == NULL)
 			continue;
 		parport_unregister_device(table[i].dev);
+		class_simple_device_remove(MKDEV(TIPAR_MAJOR, i));
 		devfs_remove("ticables/par/%d", i);
 	}
+	class_simple_destroy(tipar_class);
 	devfs_remove("ticables/par");
 
 	printk("tipar: module unloaded !\n");
diff -Nru a/drivers/char/toshiba.c b/drivers/char/toshiba.c
--- a/drivers/char/toshiba.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/char/toshiba.c	Tue Jun 15 22:21:03 2004
@@ -251,13 +251,14 @@
 	unsigned long arg)
 {
 	SMMRegisters regs;
+	SMMRegisters __user *argp = (SMMRegisters __user *)arg;
 	unsigned short ax,bx;
 	int err;
 
-	if (!arg)
+	if (!argp)
 		return -EINVAL;
 
-	if (copy_from_user(&regs, (SMMRegisters *) arg, sizeof(SMMRegisters)))
+	if (copy_from_user(&regs, argp, sizeof(SMMRegisters)))
 		return -EFAULT;
 
 	switch (cmd) {
@@ -281,7 +282,7 @@
 			return -EINVAL;
 	}
 
-        if (copy_to_user((SMMRegisters *) arg, &regs, sizeof(SMMRegisters)))
+        if (copy_to_user(argp, &regs, sizeof(SMMRegisters)))
         	return -EFAULT;
 
 	return (err==0) ? 0:-EINVAL;
diff -Nru a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c
--- a/drivers/char/tpqic02.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/tpqic02.c	Tue Jun 15 22:20:40 2004
@@ -1727,7 +1727,7 @@
  * request would return the EOF flag for the previous file.
  */
 
-static ssize_t qic02_tape_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
+static ssize_t qic02_tape_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
 {
 	int type = iminor(filp->f_dentry->d_inode);
 	unsigned short flags = filp->f_flags;
@@ -1905,7 +1905,7 @@
  * tape device again. The driver will detect an exception status in (No Cartridge)
  * and force a rewind. After that tar may continue writing.
  */
-static ssize_t qic02_tape_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
+static ssize_t qic02_tape_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 {
 	int type = iminor(filp->f_dentry->d_inode);
 	unsigned short flags = filp->f_flags;
@@ -2400,6 +2400,7 @@
 	struct mtop operation;
 	unsigned char blk_addr[6];
 	struct mtpos ioctl_tell;
+	void __user *argp = (void __user *)ioarg;
 
 
 	if (TP_DIAGS(current_type))
@@ -2416,7 +2417,7 @@
 	if (c == _IOC_NR(MTIOCGETCONFIG)) {
 		CHECK_IOC_SIZE(mtconfiginfo);
 
-		if (copy_to_user((char *) ioarg, (char *) &qic02_tape_dynconf, sizeof(qic02_tape_dynconf)))
+		if (copy_to_user(argp, &qic02_tape_dynconf, sizeof(qic02_tape_dynconf)))
 			return -EFAULT;
 		return 0;
 	} else if (c == _IOC_NR(MTIOCSETCONFIG)) {
@@ -2438,7 +2439,7 @@
 			qic02_release_resources();	/* and go zombie */
 
 		/* copy struct from user space to kernel space */
-		if (copy_from_user((char *) &qic02_tape_dynconf, (char *) ioarg, sizeof(qic02_tape_dynconf)))
+		if (copy_from_user(&qic02_tape_dynconf, argp, sizeof(qic02_tape_dynconf)))
 			return -EFAULT;
 		
 		return update_ifc_masks(qic02_tape_dynconf.ifc_type);
@@ -2452,7 +2453,7 @@
 		CHECK_IOC_SIZE(mtop);
 
 		/* copy mtop struct from user space to kernel space */
-		if (copy_from_user((char *) &operation, (char *) ioarg, sizeof(operation)))
+		if (copy_from_user(&operation, argp, sizeof(operation)))
 			return -EFAULT;
 
 		/* ---note: mt_count is signed, negative seeks must be
@@ -2507,7 +2508,7 @@
 		 */
 
 		/* copy results to user space */
-		if (copy_to_user((char *) ioarg, (char *) &ioctl_status, sizeof(ioctl_status)))
+		if (copy_to_user(argp, &ioctl_status, sizeof(ioctl_status)))
 			return -EFAULT;
 		return 0;
 	} else if (TP_HAVE_TELL && (c == _IOC_NR(MTIOCPOS))) {
@@ -2527,7 +2528,7 @@
 		ioctl_tell.mt_blkno = (blk_addr[3] << 16) | (blk_addr[4] << 8) | blk_addr[5];
 
 		/* copy results to user space */
-		if (copy_to_user((char *) ioarg, (char *) &ioctl_tell, sizeof(ioctl_tell)))
+		if (copy_to_user(argp, &ioctl_tell, sizeof(ioctl_tell)))
 			return -EFAULT;
 		return 0;
 
@@ -2536,7 +2537,7 @@
 }				/* qic02_tape_ioctl */
 
 
-static ssize_t qic02_do_tape_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
+static ssize_t qic02_do_tape_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
 {
 	int err;
 	
@@ -2547,7 +2548,7 @@
 	return err;
 }
 
-static ssize_t qic02_do_tape_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
+static ssize_t qic02_do_tape_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 {
 	int err;
 
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/char/tty_io.c	Tue Jun 15 22:20:41 2004
@@ -134,9 +134,9 @@
 
 static void initialize_tty_struct(struct tty_struct *tty);
 
-static ssize_t tty_read(struct file *, char *, size_t, loff_t *);
-static ssize_t tty_write(struct file *, const char *, size_t, loff_t *);
-ssize_t redirected_tty_write(struct file *, const char *, size_t, loff_t *);
+static ssize_t tty_read(struct file *, char __user *, size_t, loff_t *);
+static ssize_t tty_write(struct file *, const char __user *, size_t, loff_t *);
+ssize_t redirected_tty_write(struct file *, const char __user *, size_t, loff_t *);
 static unsigned int tty_poll(struct file *, poll_table *);
 static int tty_open(struct inode *, struct file *);
 static int tty_release(struct inode *, struct file *);
@@ -339,7 +339,7 @@
 
 EXPORT_SYMBOL(tty_check_change);
 
-static ssize_t hung_up_tty_read(struct file * file, char * buf,
+static ssize_t hung_up_tty_read(struct file * file, char __user * buf,
 				size_t count, loff_t *ppos)
 {
 	/* Can't seek (pread) on ttys.  */
@@ -348,7 +348,7 @@
 	return 0;
 }
 
-static ssize_t hung_up_tty_write(struct file * file, const char * buf,
+static ssize_t hung_up_tty_write(struct file * file, const char __user * buf,
 				 size_t count, loff_t *ppos)
 {
 	/* Can't seek (pwrite) on ttys.  */
@@ -638,7 +638,7 @@
 
 EXPORT_SYMBOL(start_tty);
 
-static ssize_t tty_read(struct file * file, char * buf, size_t count, 
+static ssize_t tty_read(struct file * file, char __user * buf, size_t count, 
 			loff_t *ppos)
 {
 	int i;
@@ -672,10 +672,10 @@
  * denial-of-service type attacks
  */
 static inline ssize_t do_tty_write(
-	ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t),
+	ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char __user *, size_t),
 	struct tty_struct *tty,
 	struct file *file,
-	const unsigned char *buf,
+	const unsigned char __user *buf,
 	size_t count)
 {
 	ssize_t ret = 0, written = 0;
@@ -717,7 +717,7 @@
 }
 
 
-static ssize_t tty_write(struct file * file, const char * buf, size_t count,
+static ssize_t tty_write(struct file * file, const char __user * buf, size_t count,
 			 loff_t *ppos)
 {
 	struct tty_struct * tty;
@@ -735,10 +735,10 @@
 	if (!tty->ldisc.write)
 		return -EIO;
 	return do_tty_write(tty->ldisc.write, tty, file,
-			    (const unsigned char *)buf, count);
+			    (const unsigned char __user *)buf, count);
 }
 
-ssize_t redirected_tty_write(struct file * file, const char * buf, size_t count,
+ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t count,
 			 loff_t *ppos)
 {
 	struct file *p = NULL;
@@ -1267,6 +1267,18 @@
 #endif
 
 	/*
+	 * Prevent flush_to_ldisc() from rescheduling the work for later.  Then
+	 * kill any delayed work.
+	 */
+	clear_bit(TTY_DONT_FLIP, &tty->flags);
+	cancel_delayed_work(&tty->flip.work);
+
+	/*
+	 * Wait for ->hangup_work and ->flip.work handlers to terminate
+	 */
+	flush_scheduled_work();
+
+	/*
 	 * Shutdown the current line discipline, and reset it to N_TTY.
 	 * N.B. why reset ldisc when we're releasing the memory??
 	 */
@@ -1282,18 +1294,6 @@
 		module_put(o_tty->ldisc.owner);
 		o_tty->ldisc = ldiscs[N_TTY];
 	}
-	
-	/*
-	 * Prevent flush_to_ldisc() from rescheduling the work for later.  Then
-	 * kill any delayed work.
-	 */
-	clear_bit(TTY_DONT_FLIP, &tty->flags);
-	cancel_delayed_work(&tty->flip.work);
-
-	/*
-	 * Wait for ->hangup_work and ->flip.work handlers to terminate
-	 */
-	flush_scheduled_work();
 
 	/* 
 	 * The release_mem function takes care of the details of clearing
@@ -1490,19 +1490,19 @@
 	return 0;
 }
 
-static int tiocsti(struct tty_struct *tty, char * arg)
+static int tiocsti(struct tty_struct *tty, char __user *p)
 {
 	char ch, mbz = 0;
 
 	if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
 		return -EPERM;
-	if (get_user(ch, arg))
+	if (get_user(ch, p))
 		return -EFAULT;
 	tty->ldisc.receive_buf(tty, &ch, &mbz, 1);
 	return 0;
 }
 
-static int tiocgwinsz(struct tty_struct *tty, struct winsize * arg)
+static int tiocgwinsz(struct tty_struct *tty, struct winsize __user * arg)
 {
 	if (copy_to_user(arg, &tty->winsize, sizeof(*arg)))
 		return -EFAULT;
@@ -1510,7 +1510,7 @@
 }
 
 static int tiocswinsz(struct tty_struct *tty, struct tty_struct *real_tty,
-	struct winsize * arg)
+	struct winsize __user * arg)
 {
 	struct winsize tmp_ws;
 
@@ -1565,11 +1565,11 @@
 }
 
 
-static int fionbio(struct file *file, int *arg)
+static int fionbio(struct file *file, int __user *p)
 {
 	int nonblock;
 
-	if (get_user(nonblock, arg))
+	if (get_user(nonblock, p))
 		return -EFAULT;
 
 	if (nonblock)
@@ -1620,7 +1620,7 @@
 	return 0;
 }
 
-static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg)
+static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
 {
 	/*
 	 * (tty == real_tty) is a cheap way of
@@ -1628,10 +1628,10 @@
 	 */
 	if (tty == real_tty && current->signal->tty != real_tty)
 		return -ENOTTY;
-	return put_user(real_tty->pgrp, arg);
+	return put_user(real_tty->pgrp, p);
 }
 
-static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg)
+static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
 {
 	pid_t pgrp;
 	int retval = tty_check_change(real_tty);
@@ -1644,7 +1644,7 @@
 	    (current->signal->tty != real_tty) ||
 	    (real_tty->session != current->signal->session))
 		return -ENOTTY;
-	if (get_user(pgrp, (pid_t *) arg))
+	if (get_user(pgrp, p))
 		return -EFAULT;
 	if (pgrp < 0)
 		return -EINVAL;
@@ -1654,7 +1654,7 @@
 	return 0;
 }
 
-static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t *arg)
+static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
 {
 	/*
 	 * (tty == real_tty) is a cheap way of
@@ -1664,14 +1664,14 @@
 		return -ENOTTY;
 	if (real_tty->session <= 0)
 		return -ENOTTY;
-	return put_user(real_tty->session, arg);
+	return put_user(real_tty->session, p);
 }
 
-static int tiocsetd(struct tty_struct *tty, int *arg)
+static int tiocsetd(struct tty_struct *tty, int __user *p)
 {
 	int ldisc;
 
-	if (get_user(ldisc, arg))
+	if (get_user(ldisc, p))
 		return -EFAULT;
 	return tty_set_ldisc(tty, ldisc);
 }
@@ -1690,7 +1690,7 @@
 }
 
 static int
-tty_tiocmget(struct tty_struct *tty, struct file *file, unsigned long arg)
+tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p)
 {
 	int retval = -EINVAL;
 
@@ -1698,21 +1698,21 @@
 		retval = tty->driver->tiocmget(tty, file);
 
 		if (retval >= 0)
-			retval = put_user(retval, (int *)arg);
+			retval = put_user(retval, p);
 	}
 	return retval;
 }
 
 static int
 tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd,
-	     unsigned long arg)
+	     unsigned __user *p)
 {
 	int retval = -EINVAL;
 
 	if (tty->driver->tiocmset) {
 		unsigned int set, clear, val;
 
-		retval = get_user(val, (unsigned int *)arg);
+		retval = get_user(val, p);
 		if (retval)
 			return retval;
 
@@ -1745,6 +1745,7 @@
 	      unsigned int cmd, unsigned long arg)
 {
 	struct tty_struct *tty, *real_tty;
+	void __user *p = (void __user *)arg;
 	int retval;
 	
 	tty = (struct tty_struct *)file->private_data;
@@ -1802,15 +1803,15 @@
 
 	switch (cmd) {
 		case TIOCSTI:
-			return tiocsti(tty, (char *)arg);
+			return tiocsti(tty, p);
 		case TIOCGWINSZ:
-			return tiocgwinsz(tty, (struct winsize *) arg);
+			return tiocgwinsz(tty, p);
 		case TIOCSWINSZ:
-			return tiocswinsz(tty, real_tty, (struct winsize *) arg);
+			return tiocswinsz(tty, real_tty, p);
 		case TIOCCONS:
 			return real_tty!=tty ? -EINVAL : tioccons(file);
 		case FIONBIO:
-			return fionbio(file, (int *) arg);
+			return fionbio(file, p);
 		case TIOCEXCL:
 			set_bit(TTY_EXCLUSIVE, &tty->flags);
 			return 0;
@@ -1829,15 +1830,15 @@
 		case TIOCSCTTY:
 			return tiocsctty(tty, arg);
 		case TIOCGPGRP:
-			return tiocgpgrp(tty, real_tty, (pid_t *) arg);
+			return tiocgpgrp(tty, real_tty, p);
 		case TIOCSPGRP:
-			return tiocspgrp(tty, real_tty, (pid_t *) arg);
+			return tiocspgrp(tty, real_tty, p);
 		case TIOCGSID:
-			return tiocgsid(tty, real_tty, (pid_t *) arg);
+			return tiocgsid(tty, real_tty, p);
 		case TIOCGETD:
-			return put_user(tty->ldisc.num, (int *) arg);
+			return put_user(tty->ldisc.num, (int __user *)p);
 		case TIOCSETD:
-			return tiocsetd(tty, (int *) arg);
+			return tiocsetd(tty, p);
 #ifdef CONFIG_VT
 		case TIOCLINUX:
 			return tioclinux(tty, arg);
@@ -1865,12 +1866,12 @@
 			return send_break(tty, arg ? arg*(HZ/10) : HZ/4);
 
 		case TIOCMGET:
-			return tty_tiocmget(tty, file, arg);
+			return tty_tiocmget(tty, file, p);
 
 		case TIOCMSET:
 		case TIOCMBIC:
 		case TIOCMBIS:
-			return tty_tiocmset(tty, file, cmd, arg);
+			return tty_tiocmset(tty, file, cmd, p);
 	}
 	if (tty->driver->ioctl) {
 		int retval = (tty->driver->ioctl)(tty, file, cmd, arg);
diff -Nru a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
--- a/drivers/char/tty_ioctl.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/char/tty_ioctl.c	Tue Jun 15 22:21:05 2004
@@ -140,7 +140,7 @@
 		(*tty->ldisc.set_termios)(tty, &old_termios);
 }
 
-static int set_termios(struct tty_struct * tty, unsigned long arg, int opt)
+static int set_termios(struct tty_struct * tty, void __user *arg, int opt)
 {
 	struct termios tmp_termios;
 	int retval = tty_check_change(tty);
@@ -151,11 +151,11 @@
 	if (opt & TERMIOS_TERMIO) {
 		memcpy(&tmp_termios, tty->termios, sizeof(struct termios));
 		if (user_termio_to_kernel_termios(&tmp_termios,
-						  (struct termio *) arg))
+						(struct termio __user *)arg))
 			return -EFAULT;
 	} else {
 		if (user_termios_to_kernel_termios(&tmp_termios,
-						   (struct termios *) arg))
+						(struct termios __user *)arg))
 			return -EFAULT;
 	}
 
@@ -172,7 +172,7 @@
 	return 0;
 }
 
-static int get_termio(struct tty_struct * tty, struct termio * termio)
+static int get_termio(struct tty_struct * tty, struct termio __user * termio)
 {
 	if (kernel_termios_to_user_termio(termio, tty->termios))
 		return -EFAULT;
@@ -222,7 +222,7 @@
 	return flags;
 }
 
-static int get_sgttyb(struct tty_struct * tty, struct sgttyb * sgttyb)
+static int get_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb)
 {
 	struct sgttyb tmp;
 
@@ -260,7 +260,7 @@
 	}
 }
 
-static int set_sgttyb(struct tty_struct * tty, struct sgttyb * sgttyb)
+static int set_sgttyb(struct tty_struct * tty, struct sgttyb __user * sgttyb)
 {
 	int retval;
 	struct sgttyb tmp;
@@ -281,7 +281,7 @@
 #endif
 
 #ifdef TIOCGETC
-static int get_tchars(struct tty_struct * tty, struct tchars * tchars)
+static int get_tchars(struct tty_struct * tty, struct tchars __user * tchars)
 {
 	struct tchars tmp;
 
@@ -294,7 +294,7 @@
 	return copy_to_user(tchars, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
 
-static int set_tchars(struct tty_struct * tty, struct tchars * tchars)
+static int set_tchars(struct tty_struct * tty, struct tchars __user * tchars)
 {
 	struct tchars tmp;
 
@@ -311,7 +311,7 @@
 #endif
 
 #ifdef TIOCGLTC
-static int get_ltchars(struct tty_struct * tty, struct ltchars * ltchars)
+static int get_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars)
 {
 	struct ltchars tmp;
 
@@ -324,7 +324,7 @@
 	return copy_to_user(ltchars, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 }
 
-static int set_ltchars(struct tty_struct * tty, struct ltchars * ltchars)
+static int set_ltchars(struct tty_struct * tty, struct ltchars __user * ltchars)
 {
 	struct ltchars tmp;
 
@@ -363,6 +363,7 @@
 		       unsigned int cmd, unsigned long arg)
 {
 	struct tty_struct * real_tty;
+	void __user *p = (void __user *)arg;
 	int retval;
 
 	if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
@@ -374,41 +375,41 @@
 	switch (cmd) {
 #ifdef TIOCGETP
 		case TIOCGETP:
-			return get_sgttyb(real_tty, (struct sgttyb *) arg);
+			return get_sgttyb(real_tty, (struct sgttyb __user *) arg);
 		case TIOCSETP:
 		case TIOCSETN:
-			return set_sgttyb(real_tty, (struct sgttyb *) arg);
+			return set_sgttyb(real_tty, (struct sgttyb __user *) arg);
 #endif
 #ifdef TIOCGETC
 		case TIOCGETC:
-			return get_tchars(real_tty, (struct tchars *) arg);
+			return get_tchars(real_tty, p);
 		case TIOCSETC:
-			return set_tchars(real_tty, (struct tchars *) arg);
+			return set_tchars(real_tty, p);
 #endif
 #ifdef TIOCGLTC
 		case TIOCGLTC:
-			return get_ltchars(real_tty, (struct ltchars *) arg);
+			return get_ltchars(real_tty, p);
 		case TIOCSLTC:
-			return set_ltchars(real_tty, (struct ltchars *) arg);
+			return set_ltchars(real_tty, p);
 #endif
 		case TCGETS:
-			if (kernel_termios_to_user_termios((struct termios *)arg, real_tty->termios))
+			if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios))
 				return -EFAULT;
 			return 0;
 		case TCSETSF:
-			return set_termios(real_tty, arg,  TERMIOS_FLUSH | TERMIOS_WAIT);
+			return set_termios(real_tty, p,  TERMIOS_FLUSH | TERMIOS_WAIT);
 		case TCSETSW:
-			return set_termios(real_tty, arg, TERMIOS_WAIT);
+			return set_termios(real_tty, p, TERMIOS_WAIT);
 		case TCSETS:
-			return set_termios(real_tty, arg, 0);
+			return set_termios(real_tty, p, 0);
 		case TCGETA:
-			return get_termio(real_tty,(struct termio *) arg);
+			return get_termio(real_tty, p);
 		case TCSETAF:
-			return set_termios(real_tty, arg, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_TERMIO);
+			return set_termios(real_tty, p, TERMIOS_FLUSH | TERMIOS_WAIT | TERMIOS_TERMIO);
 		case TCSETAW:
-			return set_termios(real_tty, arg, TERMIOS_WAIT | TERMIOS_TERMIO);
+			return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO);
 		case TCSETA:
-			return set_termios(real_tty, arg, TERMIOS_TERMIO);
+			return set_termios(real_tty, p, TERMIOS_TERMIO);
 		case TCXONC:
 			retval = tty_check_change(tty);
 			if (retval)
@@ -462,21 +463,21 @@
 		case TIOCOUTQ:
 			return put_user(tty->driver->chars_in_buffer ?
 					tty->driver->chars_in_buffer(tty) : 0,
-					(int *) arg);
+					(int __user *) arg);
 		case TIOCINQ:
 			retval = tty->read_cnt;
 			if (L_ICANON(tty))
 				retval = inq_canon(tty);
-			return put_user(retval, (unsigned int *) arg);
+			return put_user(retval, (unsigned int __user *) arg);
 		case TIOCGLCKTRMIOS:
-			if (kernel_termios_to_user_termios((struct termios *)arg, real_tty->termios_locked))
+			if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked))
 				return -EFAULT;
 			return 0;
 
 		case TIOCSLCKTRMIOS:
 			if (!capable(CAP_SYS_ADMIN))
 				return -EPERM;
-			if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios *) arg))
+			if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg))
 				return -EFAULT;
 			return 0;
 
@@ -487,7 +488,7 @@
 			if (tty->driver->type != TTY_DRIVER_TYPE_PTY ||
 			    tty->driver->subtype != PTY_TYPE_MASTER)
 				return -ENOTTY;
-			if (get_user(pktmode, (int *) arg))
+			if (get_user(pktmode, (int __user *) arg))
 				return -EFAULT;
 			if (pktmode) {
 				if (!tty->packet) {
@@ -499,9 +500,9 @@
 			return 0;
 		}
 		case TIOCGSOFTCAR:
-			return put_user(C_CLOCAL(tty) ? 1 : 0, (int *) arg);
+			return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg);
 		case TIOCSSOFTCAR:
-			if (get_user(arg, (unsigned int *) arg))
+			if (get_user(arg, (unsigned int __user *) arg))
 				return -EFAULT;
 			tty->termios->c_cflag =
 				((tty->termios->c_cflag & ~CLOCAL) |
diff -Nru a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
--- a/drivers/char/vc_screen.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/vc_screen.c	Tue Jun 15 22:20:38 2004
@@ -102,7 +102,7 @@
 extern struct semaphore con_buf_sem;
 
 static ssize_t
-vcs_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
 	struct inode *inode = file->f_dentry->d_inode;
 	unsigned int currcons = iminor(inode);
@@ -271,7 +271,7 @@
 }
 
 static ssize_t
-vcs_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
 	struct inode *inode = file->f_dentry->d_inode;
 	unsigned int currcons = iminor(inode);
diff -Nru a/drivers/char/vt.c b/drivers/char/vt.c
--- a/drivers/char/vt.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/char/vt.c	Tue Jun 15 22:20:44 2004
@@ -152,7 +152,7 @@
 static void save_cur(int currcons);
 static void reset_terminal(int currcons, int do_clear);
 static void con_flush_chars(struct tty_struct *tty);
-static void set_vesa_blanking(unsigned long arg);
+static void set_vesa_blanking(char __user *p);
 static void set_cursor(int currcons);
 static void hide_cursor(int currcons);
 static void console_callback(void *ignored);
@@ -661,11 +661,14 @@
 static void visual_init(int currcons, int init)
 {
     /* ++Geert: sw->con_init determines console size */
+    if (sw)
+	module_put(sw->owner);
     sw = conswitchp;
 #ifndef VT_SINGLE_DRIVER
     if (con_driver_map[currcons])
 	sw = con_driver_map[currcons];
 #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;
@@ -773,17 +776,17 @@
 	old_row_size = video_size_row;
 	old_screen_size = screenbuf_size;
 
-	video_num_lines = new_rows;
-	video_num_columns = new_cols;
-	video_size_row = new_row_size;
-	screenbuf_size = new_screen_size;
-
 	err = resize_screen(currcons, new_cols, new_rows);
 	if (err) {
 		kfree(newscreen);
 		return err;
 	}
 
+	video_num_lines = new_rows;
+	video_num_columns = new_cols;
+	video_size_row = new_row_size;
+	screenbuf_size = new_screen_size;
+
 	rlth = min(old_row_size, new_row_size);
 	rrem = new_row_size - rlth;
 	old_origin = origin;
@@ -808,8 +811,6 @@
 	screenbuf = newscreen;
 	kmalloced = 1;
 	screenbuf_size = new_screen_size;
-	if (IS_VISIBLE)
-		err = resize_screen(currcons, new_cols, new_rows);
 	set_origin(currcons);
 
 	/* do part of a reset_terminal() */
@@ -2273,6 +2274,7 @@
 int tioclinux(struct tty_struct *tty, unsigned long arg)
 {
 	char type, data;
+	char __user *p = (char __user *)arg;
 	int lines;
 	int ret;
 
@@ -2280,14 +2282,14 @@
 		return -EINVAL;
 	if (current->signal->tty != tty && !capable(CAP_SYS_ADMIN))
 		return -EPERM;
-	if (get_user(type, (char *)arg))
+	if (get_user(type, p))
 		return -EFAULT;
 	ret = 0;
 	switch (type)
 	{
 		case TIOCL_SETSEL:
 			acquire_console_sem();
-			ret = set_selection((struct tiocl_selection *)((char *)arg+1), tty, 1);
+			ret = set_selection((struct tiocl_selection __user *)(p+1), tty);
 			release_console_sem();
 			break;
 		case TIOCL_PASTESEL:
@@ -2297,7 +2299,7 @@
 			unblank_screen();
 			break;
 		case TIOCL_SELLOADLUT:
-			ret = sel_loadlut(arg);
+			ret = sel_loadlut(p);
 			break;
 		case TIOCL_GETSHIFTSTATE:
 			
@@ -2308,20 +2310,20 @@
 	 * related to the kernel should not use this.
 	 */
 	 		data = shift_state;
-			ret = __put_user(data, (char *) arg);
+			ret = __put_user(data, p);
 			break;
 		case TIOCL_GETMOUSEREPORTING:
 			data = mouse_reporting();
-			ret = __put_user(data, (char *) arg);
+			ret = __put_user(data, p);
 			break;
 		case TIOCL_SETVESABLANK:
-			set_vesa_blanking(arg);
+			set_vesa_blanking(p);
 			break;
 		case TIOCL_SETKMSGREDIRECT:
 			if (!capable(CAP_SYS_ADMIN)) {
 				ret = -EPERM;
 			} else {
-				if (get_user(data, (char *)arg+1))
+				if (get_user(data, p+1))
 					ret = -EFAULT;
 				else
 					kmsg_redirect = data;
@@ -2331,7 +2333,7 @@
 			ret = fg_console;
 			break;
 		case TIOCL_SCROLLCONSOLE:
-			if (get_user(lines, (s32 *)((char *)arg+4))) {
+			if (get_user(lines, (s32 __user *)(p+4))) {
 				ret = -EFAULT;
 			} else {
 				scrollfront(lines);
@@ -2668,25 +2670,38 @@
  *	and become default driver for newly opened ones.
  */
 
-void take_over_console(const struct consw *csw, int first, int last, int deflt)
+int take_over_console(const struct consw *csw, int first, int last, int deflt)
 {
 	int i, j = -1;
 	const char *desc;
+	struct module *owner;
+
+	owner = csw->owner;
+	if (!try_module_get(owner))
+		return -ENODEV;
 
 	acquire_console_sem();
 
 	desc = csw->con_startup();
 	if (!desc) {
 		release_console_sem();
-		return;
+		module_put(owner);
+		return -ENODEV;
 	}
-	if (deflt)
+	if (deflt) {
+		if (conswitchp)
+			module_put(conswitchp->owner);
+		__module_get(owner);
 		conswitchp = csw;
+	}
 
 	for (i = first; i <= last; i++) {
 		int old_was_color;
 		int currcons = i;
 
+		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)
@@ -2721,6 +2736,9 @@
 		printk("to %s\n", desc);
 
 	release_console_sem();
+
+	module_put(owner);
+	return 0;
 }
 
 void give_up_console(const struct consw *csw)
@@ -2728,8 +2746,10 @@
 	int i;
 
 	for(i = 0; i < MAX_NR_CONSOLES; i++)
-		if (con_driver_map[i] == csw)
+		if (con_driver_map[i] == csw) {
+			module_put(csw->owner);
 			con_driver_map[i] = NULL;
+		}
 }
 
 #endif
@@ -2738,11 +2758,10 @@
  *	Screen blanking
  */
 
-static void set_vesa_blanking(unsigned long arg)
+static void set_vesa_blanking(char __user *p)
 {
-    char *argp = (char *)arg + 1;
     unsigned int mode;
-    get_user(mode, argp);
+    get_user(mode, p + 1);
     vesa_blank_mode = (mode < 4) ? mode : 0;
 }
 
@@ -2918,7 +2937,7 @@
 		sw->con_set_palette(vc_cons[currcons].d, color_table);
 }
 
-static int set_get_cmap(unsigned char *arg, int set)
+static int set_get_cmap(unsigned char __user *arg, int set)
 {
     int i, j, k;
 
@@ -2953,7 +2972,7 @@
  * map, 3 bytes per colour, 16 colours, range from 0 to 255.
  */
 
-int con_set_cmap(unsigned char *arg)
+int con_set_cmap(unsigned char __user *arg)
 {
 	int rc;
 
@@ -2964,7 +2983,7 @@
 	return rc;
 }
 
-int con_get_cmap(unsigned char *arg)
+int con_get_cmap(unsigned char __user *arg)
 {
 	int rc;
 
@@ -3018,7 +3037,8 @@
 			goto quit;
 		if (!op->height) {		/* Need to guess font height [compat] */
 			int h, i;
-			u8 *charmap = op->data, tmp;
+			u8 __user *charmap = op->data;
+			u8 tmp;
 			
 			/* If from KDFONTOP ioctl, don't allow things which can be done in userland,
 			   so that we can get rid of this soon */
diff -Nru a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
--- a/drivers/char/vt_ioctl.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/vt_ioctl.c	Tue Jun 15 22:20:42 2004
@@ -75,7 +75,7 @@
 #define s (tmp.kb_table)
 #define v (tmp.kb_value)
 static inline int
-do_kdsk_ioctl(int cmd, struct kbentry *user_kbe, int perm, struct kbd_struct *kbd)
+do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, struct kbd_struct *kbd)
 {
 	struct kbentry tmp;
 	ushort *key_map, val, ov;
@@ -160,7 +160,7 @@
 #undef v
 
 static inline int 
-do_kbkeycode_ioctl(int cmd, struct kbkeycode *user_kbkc, int perm)
+do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, int perm)
 {
 	struct kbkeycode tmp;
 	int kc = 0;
@@ -183,11 +183,12 @@
 }
 
 static inline int
-do_kdgkb_ioctl(int cmd, struct kbsentry *user_kdgkb, int perm)
+do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
 {
 	struct kbsentry *kbs;
 	char *p;
 	u_char *q;
+	u_char __user *up;
 	int sz;
 	int delta;
 	char *first_free, *fj, *fnw;
@@ -212,15 +213,15 @@
 	case KDGKBSENT:
 		sz = sizeof(kbs->kb_string) - 1; /* sz should have been
 						  a struct member */
-		q = user_kdgkb->kb_string;
+		up = user_kdgkb->kb_string;
 		p = func_table[i];
 		if(p)
 			for ( ; *p && sz; p++, sz--)
-				if (put_user(*p, q++)) {
+				if (put_user(*p, up++)) {
 					ret = -EFAULT;
 					goto reterr;
 				}
-		if (put_user('\0', q)) {
+		if (put_user('\0', up)) {
 			ret = -EFAULT;
 			goto reterr;
 		}
@@ -292,7 +293,7 @@
 }
 
 static inline int 
-do_fontx_ioctl(int cmd, struct consolefontdesc *user_cfd, int perm, struct console_font_op *op)
+do_fontx_ioctl(int cmd, struct consolefontdesc __user *user_cfd, int perm, struct console_font_op *op)
 {
 	struct consolefontdesc cfdarg;
 	int i;
@@ -332,7 +333,7 @@
 }
 
 static inline int 
-do_unimap_ioctl(int cmd, struct unimapdesc *user_ud, int perm, unsigned int console)
+do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, unsigned int console)
 {
 	struct unimapdesc tmp;
 	int i = 0; 
@@ -370,6 +371,7 @@
 	struct kbd_struct * kbd;
 	unsigned int console;
 	unsigned char ucval;
+	void __user *up = (void __user *)arg;
 	int i, perm;
 	
 	console = vt->vc_num;
@@ -453,14 +455,12 @@
 		if (!capable(CAP_SYS_TTY_CONFIG))
 			return -EPERM;
 
-		if (copy_from_user(&kbrep, (void *)arg,
-				   sizeof(struct kbd_repeat)))
+		if (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat)))
 			return -EFAULT;
 		err = kbd_rate(&kbrep);
 		if (err)
 			return err;
-		if (copy_to_user((void *)arg, &kbrep,
-				 sizeof(struct kbd_repeat)))
+		if (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat)))
 			return -EFAULT;
 		return 0;
 	}
@@ -565,25 +565,25 @@
 	case KDGKBMETA:
 		ucval = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT);
 	setint:
-		return put_user(ucval, (int *)arg); 
+		return put_user(ucval, (int __user *)arg); 
 
 	case KDGETKEYCODE:
 	case KDSETKEYCODE:
 		if(!capable(CAP_SYS_TTY_CONFIG))
 			perm=0;
-		return do_kbkeycode_ioctl(cmd, (struct kbkeycode *)arg, perm);
+		return do_kbkeycode_ioctl(cmd, up, perm);
 
 	case KDGKBENT:
 	case KDSKBENT:
-		return do_kdsk_ioctl(cmd, (struct kbentry *)arg, perm, kbd);
+		return do_kdsk_ioctl(cmd, up, perm, kbd);
 
 	case KDGKBSENT:
 	case KDSKBSENT:
-		return do_kdgkb_ioctl(cmd, (struct kbsentry *)arg, perm);
+		return do_kdgkb_ioctl(cmd, up, perm);
 
 	case KDGKBDIACR:
 	{
-		struct kbdiacrs *a = (struct kbdiacrs *)arg;
+		struct kbdiacrs __user *a = up;
 
 		if (put_user(accent_table_size, &a->kb_cnt))
 			return -EFAULT;
@@ -594,7 +594,7 @@
 
 	case KDSKBDIACR:
 	{
-		struct kbdiacrs *a = (struct kbdiacrs *)arg;
+		struct kbdiacrs __user *a = up;
 		unsigned int ct;
 
 		if (!perm)
@@ -630,7 +630,7 @@
 	case KDGETLED:
 		ucval = getledstate();
 	setchar:
-		return put_user(ucval, (char*)arg);
+		return put_user(ucval, (char __user *)arg);
 
 	case KDSETLED:
 		if (!perm)
@@ -643,10 +643,7 @@
 	 * generated by pressing an appropriate key combination.
 	 * Thus, one can have a daemon that e.g. spawns a new console
 	 * upon a keypress and then changes to it.
-	 * Probably init should be changed to do this (and have a
-	 * field ks (`keyboard signal') in inittab describing the
-	 * desired action), so that the number of background daemons
-	 * does not increase.
+	 * See also the kbrequest field of inittab(5).
 	 */
 	case KDSIGACCEPT:
 	{
@@ -666,7 +663,7 @@
 
 		if (!perm)
 			return -EPERM;
-		if (copy_from_user(&tmp, (void*)arg, sizeof(struct vt_mode)))
+		if (copy_from_user(&tmp, up, sizeof(struct vt_mode)))
 			return -EFAULT;
 		if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS)
 			return -EINVAL;
@@ -690,7 +687,7 @@
 		memcpy(&tmp, &vt_cons[console]->vt_mode, sizeof(struct vt_mode));
 		release_console_sem();
 
-		rc = copy_to_user((void*)arg, &tmp, sizeof(struct vt_mode));
+		rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
 		return rc ? -EFAULT : 0;
 	}
 
@@ -701,7 +698,7 @@
 	 */
 	case VT_GETSTATE:
 	{
-		struct vt_stat *vtstat = (struct vt_stat *)arg;
+		struct vt_stat __user *vtstat = up;
 		unsigned short state, mask;
 
 		if (put_user(fg_console + 1, &vtstat->v_active))
@@ -847,7 +844,7 @@
 
 	case VT_RESIZE:
 	{
-		struct vt_sizes *vtsizes = (struct vt_sizes *) arg;
+		struct vt_sizes __user *vtsizes = up;
 		ushort ll,cc;
 		if (!perm)
 			return -EPERM;
@@ -864,11 +861,11 @@
 
 	case VT_RESIZEX:
 	{
-		struct vt_consize *vtconsize = (struct vt_consize *) arg;
+		struct vt_consize __user *vtconsize = up;
 		ushort ll,cc,vlin,clin,vcol,ccol;
 		if (!perm)
 			return -EPERM;
-		if (verify_area(VERIFY_READ, (void *)vtconsize,
+		if (verify_area(VERIFY_READ, vtconsize,
 				sizeof(struct vt_consize)))
 			return -EFAULT;
 		__get_user(ll, &vtconsize->v_rows);
@@ -935,14 +932,14 @@
 	case PIO_CMAP:
                 if (!perm)
 			return -EPERM;
-                return con_set_cmap((char *)arg);
+                return con_set_cmap(up);
 
 	case GIO_CMAP:
-                return con_get_cmap((char *)arg);
+                return con_get_cmap(up);
 
 	case PIO_FONTX:
 	case GIO_FONTX:
-		return do_fontx_ioctl(cmd, (struct consolefontdesc *)arg, perm, &op);
+		return do_fontx_ioctl(cmd, up, perm, &op);
 
 	case PIO_FONTRESET:
 	{
@@ -966,13 +963,13 @@
 	}
 
 	case KDFONTOP: {
-		if (copy_from_user(&op, (void *) arg, sizeof(op)))
+		if (copy_from_user(&op, up, sizeof(op)))
 			return -EFAULT;
 		if (!perm && op.op != KD_FONT_OP_GET)
 			return -EPERM;
 		i = con_font_op(console, &op);
 		if (i) return i;
-		if (copy_to_user((void *) arg, &op, sizeof(op)))
+		if (copy_to_user(up, &op, sizeof(op)))
 			return -EFAULT;
 		return 0;
 	}
@@ -980,24 +977,24 @@
 	case PIO_SCRNMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_trans_old((unsigned char *)arg);
+		return con_set_trans_old(up);
 
 	case GIO_SCRNMAP:
-		return con_get_trans_old((unsigned char *)arg);
+		return con_get_trans_old(up);
 
 	case PIO_UNISCRNMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_trans_new((unsigned short *)arg);
+		return con_set_trans_new(up);
 
 	case GIO_UNISCRNMAP:
-		return con_get_trans_new((unsigned short *)arg);
+		return con_get_trans_new(up);
 
 	case PIO_UNIMAPCLR:
 	      { struct unimapinit ui;
 		if (!perm)
 			return -EPERM;
-		i = copy_from_user(&ui, (void *)arg, sizeof(struct unimapinit));
+		i = copy_from_user(&ui, up, sizeof(struct unimapinit));
 		if (i) return -EFAULT;
 		con_clear_unimap(console, &ui);
 		return 0;
@@ -1005,7 +1002,7 @@
 
 	case PIO_UNIMAP:
 	case GIO_UNIMAP:
-		return do_unimap_ioctl(cmd, (struct unimapdesc *)arg, perm, console);
+		return do_unimap_ioctl(cmd, up, perm, console);
 
 	case VT_LOCKSWITCH:
 		if (!capable(CAP_SYS_TTY_CONFIG))
diff -Nru a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
--- a/drivers/char/watchdog/Kconfig	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/watchdog/Kconfig	Tue Jun 15 22:20:42 2004
@@ -84,6 +84,17 @@
 
 	  Not sure? It's safe to say N.
 
+config IXP4XX_WATCHDOG
+	tristate "IXP4xx Watchdog"
+	depends on WATCHDOG && ARCH_IXP4XX
+	help
+	  Say Y here if to include support for the watchdog timer
+	  in the Intel IXP4xx network processors. This driver can
+	  be built as a module by choosing M. The module will
+	  be called ixp4xx_wdt.
+
+	  Say N if you are unsure.
+
 config SA1100_WATCHDOG
 	tristate "SA1100 watchdog"
 	depends on WATCHDOG && ARCH_SA1100
diff -Nru a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile
--- a/drivers/char/watchdog/Makefile	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/watchdog/Makefile	Tue Jun 15 22:20:43 2004
@@ -35,3 +35,4 @@
 obj-$(CONFIG_INDYDOG) += indydog.o
 obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o
 obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
+obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o
diff -Nru a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c
--- a/drivers/char/watchdog/alim1535_wdt.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/watchdog/alim1535_wdt.c	Tue Jun 15 22:20:38 2004
@@ -16,6 +16,7 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/fs.h>
 #include <linux/pci.h>
 
 #include <asm/uaccess.h>
diff -Nru a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c
--- a/drivers/char/watchdog/alim7101_wdt.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/char/watchdog/alim7101_wdt.c	Tue Jun 15 22:20:43 2004
@@ -24,6 +24,7 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/fs.h>
 #include <linux/pci.h>
 
 #include <asm/io.h>
diff -Nru a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c
--- a/drivers/char/watchdog/ib700wdt.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/char/watchdog/ib700wdt.c	Tue Jun 15 22:21:02 2004
@@ -135,7 +135,7 @@
 ibwdt_ping(void)
 {
 	/* Write a watchdog value */
-	outb_p(wd_times[wd_margin], WDT_START);
+	outb_p(wd_margin, WDT_START);
 }
 
 static ssize_t
@@ -234,7 +234,7 @@
 {
 	spin_lock(&ibwdt_lock);
 	if (expect_close == 42)
-		outb_p(wd_times[wd_margin], WDT_STOP);
+		outb_p(0, WDT_STOP);
 	else
 		printk(KERN_CRIT PFX "WDT device closed unexpectedly.  WDT will not stop!\n");
 
@@ -254,7 +254,7 @@
 {
 	if (code == SYS_DOWN || code == SYS_HALT) {
 		/* Turn the WDT off */
-		outb_p(wd_times[wd_margin], WDT_STOP);
+		outb_p(0, WDT_STOP);
 	}
 	return NOTIFY_DONE;
 }
diff -Nru a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/char/watchdog/ixp4xx_wdt.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,233 @@
+/*
+ * drivers/watchdog/ixp4xx_wdt.c
+ *
+ * Watchdog driver for Intel IXP4xx network processors
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright 2004 (c) MontaVista, Software, Inc.
+ * Based on sa1100 driver, Copyright (C) 2000 Oleg Drokin <green@crimea.edu>
+ *
+ * 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/config.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/init.h>
+
+#include <asm/hardware.h>
+#include <asm/bitops.h>
+#include <asm/uaccess.h>
+
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
+static int nowayout = 1;
+#else
+static int nowayout = 0;
+#endif
+static int heartbeat = 60;	/* (secs) Default is 1 minute */
+static unsigned long wdt_status;
+static unsigned long boot_status;
+
+#define WDT_TICK_RATE (IXP4XX_PERIPHERAL_BUS_CLOCK * 1000000UL)
+
+#define	WDT_IN_USE		0
+#define	WDT_OK_TO_CLOSE		1
+
+static void
+wdt_enable(void)
+{
+	*IXP4XX_OSWK = IXP4XX_WDT_KEY;
+	*IXP4XX_OSWE = 0;
+	*IXP4XX_OSWT = WDT_TICK_RATE * heartbeat;
+	*IXP4XX_OSWE = IXP4XX_WDT_COUNT_ENABLE | IXP4XX_WDT_RESET_ENABLE;
+	*IXP4XX_OSWK = 0;
+}
+
+static void
+wdt_disable(void)
+{
+	*IXP4XX_OSWK = IXP4XX_WDT_KEY;
+	*IXP4XX_OSWE = 0;
+	*IXP4XX_OSWK = 0;
+}
+
+static int
+ixp4xx_wdt_open(struct inode *inode, struct file *file)
+{
+	if (test_and_set_bit(WDT_IN_USE, &wdt_status))
+		return -EBUSY;
+
+	clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+
+	wdt_enable();
+
+	return 0;
+}
+
+static ssize_t
+ixp4xx_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
+{
+	/* Can't seek (pwrite) on this device  */
+	if (ppos != &file->f_pos)
+		return -ESPIPE;
+
+	if (len) {
+		if (!nowayout) {
+			size_t i;
+
+			clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+
+			for (i = 0; i != len; i++) {
+				char c;
+
+				if (get_user(c, data + i))
+					return -EFAULT;
+				if (c == 'V')
+					set_bit(WDT_OK_TO_CLOSE, &wdt_status);
+			}
+		}
+		wdt_enable();
+	}
+
+	return len;
+}
+
+static struct watchdog_info ident = {
+	.options	= WDIOF_CARDRESET | WDIOF_MAGICCLOSE |
+			  WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
+	.identity	= "IXP4xx Watchdog",
+};
+
+
+static int
+ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+			unsigned long arg)
+{
+	int ret = -ENOIOCTLCMD;
+	int time;
+
+	switch (cmd) {
+	case WDIOC_GETSUPPORT:
+		ret = copy_to_user((struct watchdog_info *)arg, &ident,
+				   sizeof(ident)) ? -EFAULT : 0;
+		break;
+
+	case WDIOC_GETSTATUS:
+		ret = put_user(0, (int *)arg);
+		break;
+
+	case WDIOC_GETBOOTSTATUS:
+		ret = put_user(boot_status, (int *)arg);
+		break;
+
+	case WDIOC_SETTIMEOUT:
+		ret = get_user(time, (int *)arg);
+		if (ret)
+			break;
+
+		if (time <= 0 || time > 60) {
+			ret = -EINVAL;
+			break;
+		}
+
+		heartbeat = time;
+		wdt_enable();
+		/* Fall through */
+
+	case WDIOC_GETTIMEOUT:
+		ret = put_user(heartbeat, (int *)arg);
+		break;
+
+	case WDIOC_KEEPALIVE:
+		wdt_enable();
+		ret = 0;
+		break;
+	}
+	return ret;
+}
+
+static int
+ixp4xx_wdt_release(struct inode *inode, struct file *file)
+{
+	if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) {
+		wdt_disable();
+	} else {
+		printk(KERN_CRIT "WATCHDOG: Device closed unexpectdly - "
+					"timer will not stop\n");
+	}
+
+	clear_bit(WDT_IN_USE, &wdt_status);
+	clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+
+	return 0;
+}
+
+
+static struct file_operations ixp4xx_wdt_fops =
+{
+	.owner		= THIS_MODULE,
+	.write		= ixp4xx_wdt_write,
+	.ioctl		= ixp4xx_wdt_ioctl,
+	.open		= ixp4xx_wdt_open,
+	.release	= ixp4xx_wdt_release,
+};
+
+static struct miscdevice ixp4xx_wdt_miscdev =
+{
+	.minor		= WATCHDOG_MINOR,
+	.name		= "IXP4xx Watchdog",
+	.fops		= &ixp4xx_wdt_fops,
+};
+
+static int __init ixp4xx_wdt_init(void)
+{
+	int ret;
+	unsigned long processor_id;
+
+	asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
+	if (!(processor_id & 0xf)) {
+		printk("IXP4XXX Watchdog: Rev. A0 CPU detected - "
+			"watchdog disabled\n");
+
+		return -ENODEV;
+	}
+
+	ret = misc_register(&ixp4xx_wdt_miscdev);
+	if (ret == 0)
+		printk("IXP4xx Watchdog Timer: heartbeat %d sec\n", heartbeat);
+
+	boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
+			WDIOF_CARDRESET : 0;
+
+	return ret;
+}
+
+static void __exit ixp4xx_wdt_exit(void)
+{
+	misc_deregister(&ixp4xx_wdt_miscdev);
+}
+
+
+module_init(ixp4xx_wdt_init);
+module_exit(ixp4xx_wdt_exit);
+
+MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net">);
+MODULE_DESCRIPTION("IXP4xx Network Processor Watchdog");
+
+module_param(heartbeat, int, 0);
+MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 60s)");
+
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
+
+MODULE_LICENSE("GPL");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
+
diff -Nru a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
--- a/drivers/char/watchdog/pcwd.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/char/watchdog/pcwd.c	Tue Jun 15 22:20:36 2004
@@ -70,7 +70,7 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
-#define WD_VER                  "1.16 (03/27/2004)"
+#define WD_VER                  "1.16 (06/12/2004)"
 #define PFX			"pcwd: "
 
 /*
@@ -299,10 +299,11 @@
 	return 0;
 }
 
-static void pcwd_keepalive(void)
+static int pcwd_keepalive(void)
 {
 	/* user land ping */
 	next_heartbeat = jiffies + (heartbeat * HZ);
+	return 0;
 }
 
 static int pcwd_set_heartbeat(int t)
@@ -404,6 +405,7 @@
 	int status;
 	int temperature;
 	int new_heartbeat;
+	int __user *argp = (int __user *)arg;
 	static struct watchdog_info ident = {
 		.options =		WDIOF_OVERHEAT |
 					WDIOF_CARDRESET |
@@ -419,27 +421,27 @@
 		return -ENOIOCTLCMD;
 
 	case WDIOC_GETSUPPORT:
-		if(copy_to_user((void*)arg, &ident, sizeof(ident)))
+		if(copy_to_user(argp, &ident, sizeof(ident)))
 			return -EFAULT;
 		return 0;
 
 	case WDIOC_GETSTATUS:
 		pcwd_get_status(&status);
-		return put_user(status, (int *) arg);
+		return put_user(status, argp);
 
 	case WDIOC_GETBOOTSTATUS:
-		return put_user(initial_status, (int *) arg);
+		return put_user(initial_status, argp);
 
 	case WDIOC_GETTEMP:
 		if (pcwd_get_temperature(&temperature))
 			return -EFAULT;
 
-		return put_user(temperature, (int *) arg);
+		return put_user(temperature, argp);
 
 	case WDIOC_SETOPTIONS:
 		if (revision == PCWD_REVISION_C)
 		{
-			if(copy_from_user(&rv, (int*) arg, sizeof(int)))
+			if(copy_from_user(&rv, argp, sizeof(int)))
 				return -EFAULT;
 
 			if (rv & WDIOS_DISABLECARD)
@@ -464,7 +466,7 @@
 		return 0;
 
 	case WDIOC_SETTIMEOUT:
-		if (get_user(new_heartbeat, (int *) arg))
+		if (get_user(new_heartbeat, argp))
 			return -EFAULT;
 
 		if (pcwd_set_heartbeat(new_heartbeat))
@@ -474,13 +476,13 @@
 		/* Fall */
 
 	case WDIOC_GETTIMEOUT:
-		return put_user(heartbeat, (int *)arg);
+		return put_user(heartbeat, argp);
 	}
 
 	return 0;
 }
 
-static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
+static ssize_t pcwd_write(struct file *file, const char __user *buf, size_t len,
 			  loff_t *ppos)
 {
 	/*  Can't seek (pwrite) on this device  */
@@ -528,12 +530,12 @@
 {
 	if (expect_close == 42) {
 		pcwd_stop();
-		atomic_inc( &open_allowed );
 	} else {
 		printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
 		pcwd_keepalive();
 	}
 	expect_close = 0;
+	atomic_inc( &open_allowed );
 	return 0;
 }
 
@@ -541,7 +543,7 @@
  *	/dev/temperature handling
  */
 
-static ssize_t pcwd_temp_read(struct file *file, char *buf, size_t count,
+static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count,
 			 loff_t *ppos)
 {
 	int temperature;
diff -Nru a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c
--- a/drivers/char/watchdog/pcwd_pci.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/watchdog/pcwd_pci.c	Tue Jun 15 22:20:37 2004
@@ -49,7 +49,7 @@
 
 /* Module and version information */
 #define WATCHDOG_VERSION "1.00"
-#define WATCHDOG_DATE "13/03/2004"
+#define WATCHDOG_DATE "12 Jun 2004"
 #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog"
 #define WATCHDOG_NAME "pcwd_pci"
 #define PFX WATCHDOG_NAME ": "
@@ -73,7 +73,7 @@
 #define WD_PCI_TTRP             0x04	/* Temperature Trip status */
 
 /* according to documentation max. time to process a command for the pci
-   watchdog card is 100 ms, so we give it 150 ms to do it's job */
+ * watchdog card is 100 ms, so we give it 150 ms to do it's job */
 #define PCI_COMMAND_TIMEOUT	150
 
 /* Watchdog's internal commands */
@@ -404,8 +404,8 @@
 		printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
 		pcipcwd_keepalive();
 	}
-	clear_bit(0, &is_active);
 	expect_release = 0;
+	clear_bit(0, &is_active);
 	return 0;
 }
 
@@ -585,15 +585,12 @@
 		printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
 
 	/* Check that the heartbeat value is within it's range ; if not reset to the default */
-	if (heartbeat < 1 || heartbeat > 0xFFFF) {
-		heartbeat = WATCHDOG_HEARTBEAT;
+	if (pcipcwd_set_heartbeat(heartbeat)) {
+		pcipcwd_set_heartbeat(WATCHDOG_HEARTBEAT);
 		printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n",
-			heartbeat);
+			WATCHDOG_HEARTBEAT);
 	}
 
-	/* Calculate the watchdog's heartbeat */
-	pcipcwd_set_heartbeat(heartbeat);
-
 	ret = register_reboot_notifier(&pcipcwd_notifier);
 	if (ret != 0) {
 		printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
@@ -601,29 +598,30 @@
 		goto err_out_release_region;
 	}
 
-	ret = misc_register(&pcipcwd_miscdev);
-	if (ret != 0) {
-		printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-			WATCHDOG_MINOR, ret);
-		goto err_out_unregister_reboot;
-	}
-
 	if (pcipcwd_private.supports_temp) {
 		ret = misc_register(&pcipcwd_temp_miscdev);
 		if (ret != 0) {
 			printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
 				TEMP_MINOR, ret);
-			goto err_out_misc_deregister;
+			goto err_out_unregister_reboot;
 		}
 	}
 
+	ret = misc_register(&pcipcwd_miscdev);
+	if (ret != 0) {
+		printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
+			WATCHDOG_MINOR, ret);
+		goto err_out_misc_deregister;
+	}
+
 	printk(KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
 		heartbeat, nowayout);
 
 	return 0;
 
 err_out_misc_deregister:
-	misc_deregister(&pcipcwd_miscdev);
+	if (pcipcwd_private.supports_temp)
+		misc_deregister(&pcipcwd_temp_miscdev);
 err_out_unregister_reboot:
 	unregister_reboot_notifier(&pcipcwd_notifier);
 err_out_release_region:
@@ -640,9 +638,9 @@
 		pcipcwd_stop();
 
 	/* Deregister */
+	misc_deregister(&pcipcwd_miscdev);
 	if (pcipcwd_private.supports_temp)
 		misc_deregister(&pcipcwd_temp_miscdev);
-	misc_deregister(&pcipcwd_miscdev);
 	unregister_reboot_notifier(&pcipcwd_notifier);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
diff -Nru a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c
--- a/drivers/char/watchdog/pcwd_usb.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/watchdog/pcwd_usb.c	Tue Jun 15 22:20:38 2004
@@ -56,7 +56,8 @@
 
 
 /* Module and Version Information */
-#define DRIVER_VERSION "v1.00 (28/02/2004)"
+#define DRIVER_VERSION "1.00"
+#define DRIVER_DATE "12 Jun 2004"
 #define DRIVER_AUTHOR "Wim Van Sebroeck <wim@iguana.be>"
 #define DRIVER_DESC "Berkshire USB-PC Watchdog driver"
 #define DRIVER_LICENSE "GPL"
@@ -456,8 +457,8 @@
 		printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
 		usb_pcwd_keepalive(usb_pcwd_device);
 	}
-	clear_bit(0, &is_active);
 	expect_release = 0;
+	clear_bit(0, &is_active);
 	return 0;
 }
 
@@ -681,15 +682,12 @@
 		((option_switches & 0x08) ? "ON" : "OFF"));
 
 	/* Check that the heartbeat value is within it's range ; if not reset to the default */
-	if (heartbeat < 1 || heartbeat > 0xFFFF) {
-		heartbeat = WATCHDOG_HEARTBEAT;
+	if (usb_pcwd_set_heartbeat(usb_pcwd, heartbeat)) {
+		usb_pcwd_set_heartbeat(usb_pcwd, WATCHDOG_HEARTBEAT);
 		printk(KERN_INFO PFX "heartbeat value must be 0<heartbeat<65536, using %d\n",
-			heartbeat);
+			WATCHDOG_HEARTBEAT);
 	}
 
-	/* Calculate the watchdog's heartbeat */
-	usb_pcwd_set_heartbeat(usb_pcwd, heartbeat);
-
 	retval = register_reboot_notifier(&usb_pcwd_notifier);
 	if (retval != 0) {
 		printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
@@ -697,17 +695,17 @@
 		goto error;
 	}
 
-	retval = misc_register(&usb_pcwd_miscdev);
+	retval = misc_register(&usb_pcwd_temperature_miscdev);
 	if (retval != 0) {
 		printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-			WATCHDOG_MINOR, retval);
+			TEMP_MINOR, retval);
 		goto err_out_unregister_reboot;
 	}
 
-	retval = misc_register(&usb_pcwd_temperature_miscdev);
+	retval = misc_register(&usb_pcwd_miscdev);
 	if (retval != 0) {
 		printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-			TEMP_MINOR, retval);
+			WATCHDOG_MINOR, retval);
 		goto err_out_misc_deregister;
 	}
 
@@ -720,7 +718,7 @@
 	return 0;
 
 err_out_misc_deregister:
-	misc_deregister(&usb_pcwd_miscdev);
+	misc_deregister(&usb_pcwd_temperature_miscdev);
 err_out_unregister_reboot:
 	unregister_reboot_notifier(&usb_pcwd_notifier);
 error:
@@ -758,8 +756,8 @@
 	usb_pcwd->exists = 0;
 
 	/* Deregister */
-	misc_deregister(&usb_pcwd_temperature_miscdev);
 	misc_deregister(&usb_pcwd_miscdev);
+	misc_deregister(&usb_pcwd_temperature_miscdev);
 	unregister_reboot_notifier(&usb_pcwd_notifier);
 
 	up (&usb_pcwd->sem);
@@ -791,7 +789,7 @@
 		return result;
 	}
 
-	printk(KERN_INFO PFX DRIVER_DESC " " DRIVER_VERSION "\n");
+	printk(KERN_INFO PFX DRIVER_DESC " v" DRIVER_VERSION " (" DRIVER_DATE ")\n");
 	return 0;
 }
 
diff -Nru a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c
--- a/drivers/char/watchdog/sc1200wdt.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/char/watchdog/sc1200wdt.c	Tue Jun 15 22:20:37 2004
@@ -38,6 +38,7 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/pnp.h>
+#include <linux/fs.h>
 #include <linux/pci.h>
 
 #include <asm/semaphore.h>
diff -Nru a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c
--- a/drivers/char/watchdog/sc520_wdt.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/watchdog/sc520_wdt.c	Tue Jun 15 22:20:40 2004
@@ -23,22 +23,25 @@
  *	-	Switched to private locks not lock_kernel
  *	-	Used ioremap/writew/readw
  *	-	Added NOWAYOUT support
- *
- *     4/12 - 2002 Changes by Rob Radez <rob@osinvestor.com>
- *     -       Change comments
- *     -       Eliminate fop_llseek
- *     -       Change CONFIG_WATCHDOG_NOWAYOUT semantics
- *     -       Add KERN_* tags to printks
- *     -       fix possible wdt_is_open race
- *     -       Report proper capabilities in watchdog_info
- *     -       Add WDIOC_{GETSTATUS, GETBOOTSTATUS, SETTIMEOUT,
- *             GETTIMEOUT, SETOPTIONS} ioctls
- *     09/8 - 2003 Changes by Wim Van Sebroeck <wim@iguana.be>
- *     -       cleanup of trailing spaces
- *     -       added extra printk's for startup problems
- *     -       use module_param
- *     -       made timeout (the emulated heartbeat) a module_param
- *     -       made the keepalive ping an internal subroutine
+ *	4/12 - 2002 Changes by Rob Radez <rob@osinvestor.com>
+ *	-	Change comments
+ *	-	Eliminate fop_llseek
+ *	-	Change CONFIG_WATCHDOG_NOWAYOUT semantics
+ *	-	Add KERN_* tags to printks
+ *	-	fix possible wdt_is_open race
+ *	-	Report proper capabilities in watchdog_info
+ *	-	Add WDIOC_{GETSTATUS, GETBOOTSTATUS, SETTIMEOUT,
+ *		GETTIMEOUT, SETOPTIONS} ioctls
+ *	09/8 - 2003 Changes by Wim Van Sebroeck <wim@iguana.be>
+ *	-	cleanup of trailing spaces
+ *	-	added extra printk's for startup problems
+ *	-	use module_param
+ *	-	made timeout (the emulated heartbeat) a module_param
+ *	-	made the keepalive ping an internal subroutine
+ *	3/27 - 2004 Changes by Sean Young <sean@mess.org>
+ *	-	set MMCR_BASE to 0xfffef000
+ *	-	CBAR does not need to be read
+ *	-	removed debugging printks
  *
  *  This WDT driver is different from most other Linux WDT
  *  drivers in that the driver will ping the watchdog by itself,
@@ -65,8 +68,16 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
+#define OUR_NAME "sc520_wdt"
+#define PFX OUR_NAME ": "
+
 /*
- * The SC520 can timeout anywhere from 492us to 32.21s.
+ * The AMD Elan SC520 timeout value is 492us times a power of 2 (0-7)
+ *
+ *   0: 492us    2: 1.01s    4: 4.03s   6: 16.22s
+ *   1: 503ms    3: 2.01s    5: 8.05s   7: 32.21s
+ *
+ * We will program the SC520 watchdog for a timeout of 2.01s.
  * If we reset the watchdog every ~250ms we should be safe.
  */
 
@@ -83,25 +94,33 @@
 module_param(timeout, int, 0);
 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
 
-/*
- * AMD Elan SC520 timeout value is 492us times a power of 2 (0-7)
- *
- *   0: 492us    2: 1.01s    4: 4.03s   6: 16.22s
- *   1: 503ms    3: 2.01s    5: 8.05s   7: 32.21s
- */
-
-#define TIMEOUT_EXPONENT ( 1 << 3 )  /* 0x08 = 2.01s */
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
+static int nowayout = 1;
+#else
+static int nowayout = 0;
+#endif
 
-/* #define MMCR_BASE_DEFAULT 0xfffef000 */
-#define MMCR_BASE_DEFAULT ((__u16 *)0xffffe)
-#define OFFS_WDTMRCTL ((unsigned int)0xcb0)
-#define WDT_ENB 0x8000		/* [15] Watchdog Timer Enable */
-#define WDT_WRST_ENB 0x4000	/* [14] Watchdog Timer Reset Enable */
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
 
-#define OUR_NAME "sc520_wdt"
-#define PFX OUR_NAME ": "
+/*
+ * AMD Elan SC520 - Watchdog Timer Registers
+ */
+#define MMCR_BASE	0xfffef000	/* The default base address */
+#define OFFS_WDTMRCTL	0xCB0	/* Watchdog Timer Control Register */
 
-#define WRT_DOG(data) *wdtmrctl=data
+/* WDT Control Register bit definitions */
+#define WDT_EXP_SEL_01	0x0001	/* [01] Time-out = 496 us (with 33 Mhz clk). */
+#define WDT_EXP_SEL_02	0x0002	/* [02] Time-out = 508 ms (with 33 Mhz clk). */
+#define WDT_EXP_SEL_03	0x0004	/* [03] Time-out = 1.02 s (with 33 Mhz clk). */
+#define WDT_EXP_SEL_04	0x0008	/* [04] Time-out = 2.03 s (with 33 Mhz clk). */
+#define WDT_EXP_SEL_05	0x0010	/* [05] Time-out = 4.07 s (with 33 Mhz clk). */
+#define WDT_EXP_SEL_06	0x0020	/* [06] Time-out = 8.13 s (with 33 Mhz clk). */
+#define WDT_EXP_SEL_07	0x0040	/* [07] Time-out = 16.27s (with 33 Mhz clk). */
+#define WDT_EXP_SEL_08	0x0080	/* [08] Time-out = 32.54s (with 33 Mhz clk). */
+#define WDT_IRQ_FLG	0x1000	/* [12] Interrupt Request Flag */
+#define WDT_WRST_ENB	0x4000	/* [14] Watchdog Timer Reset Enable */
+#define WDT_ENB		0x8000	/* [15] Watchdog Timer Enable */
 
 static __u16 *wdtmrctl;
 
@@ -112,15 +131,6 @@
 static char wdt_expect_close;
 static spinlock_t wdt_spinlock;
 
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-static int nowayout = 1;
-#else
-static int nowayout = 0;
-#endif
-
-module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
-
 /*
  *	Whack the dog
  */
@@ -147,7 +157,7 @@
 }
 
 /*
- * Utility routines
+ *	Utility routines
  */
 
 static void wdt_config(int writeval)
@@ -157,10 +167,10 @@
 
 	/* buy some time (ping) */
 	spin_lock_irqsave(&wdt_spinlock, flags);
-	dummy=readw(wdtmrctl);  /* ensure write synchronization */
+	dummy=readw(wdtmrctl);	/* ensure write synchronization */
 	writew(0xAAAA, wdtmrctl);
 	writew(0x5555, wdtmrctl);
-	/* make WDT configuration register writable one time */
+	/* unlock WDT = make WDT configuration register writable one time */
 	writew(0x3333, wdtmrctl);
 	writew(0xCCCC, wdtmrctl);
 	/* write WDT configuration register */
@@ -168,7 +178,7 @@
 	spin_unlock_irqrestore(&wdt_spinlock, flags);
 }
 
-static void wdt_startup(void)
+static int wdt_startup(void)
 {
 	next_heartbeat = jiffies + (timeout * HZ);
 
@@ -176,28 +186,43 @@
 	timer.expires = jiffies + WDT_INTERVAL;
 	add_timer(&timer);
 
-	wdt_config(WDT_ENB | WDT_WRST_ENB | TIMEOUT_EXPONENT);
+	/* Start the watchdog */
+	wdt_config(WDT_ENB | WDT_WRST_ENB | WDT_EXP_SEL_04);
+
 	printk(KERN_INFO PFX "Watchdog timer is now enabled.\n");
+	return 0;
 }
 
-static void wdt_turnoff(void)
+static int wdt_turnoff(void)
 {
-	if (!nowayout) {
-		/* Stop the timer */
-		del_timer(&timer);
-		wdt_config(0);
-		printk(KERN_INFO PFX "Watchdog timer is now disabled...\n");
-	}
+	/* Stop the timer */
+	del_timer(&timer);
+
+	/* Stop the watchdog */
+	wdt_config(0);
+
+	printk(KERN_INFO PFX "Watchdog timer is now disabled...\n");
+	return 0;
 }
 
-static void wdt_keepalive(void)
+static int wdt_keepalive(void)
 {
 	/* user land ping */
 	next_heartbeat = jiffies + (timeout * HZ);
+	return 0;
+}
+
+static int wdt_set_heartbeat(int t)
+{
+	if ((t < 1) || (t > 3600))	/* arbitrary upper limit */
+		return -EINVAL;
+
+	timeout = t;
+	return 0;
 }
 
 /*
- * /dev/watchdog handling
+ *	/dev/watchdog handling
  */
 
 static ssize_t fop_write(struct file * file, const char * buf, size_t count, loff_t * ppos)
@@ -207,10 +232,8 @@
 		return -ESPIPE;
 
 	/* See if we got the magic character 'V' and reload the timer */
-	if(count)
-	{
-		if (!nowayout)
-		{
+	if(count) {
+		if (!nowayout) {
 			size_t ofs;
 
 			/* note: just in case someone wrote the magic character
@@ -248,11 +271,11 @@
 
 static int fop_close(struct inode * inode, struct file * file)
 {
-	if(wdt_expect_close == 42)
+	if(wdt_expect_close == 42) {
 		wdt_turnoff();
-	else {
-		del_timer(&timer);
-		printk(KERN_CRIT PFX "device file closed unexpectedly. Will not stop the WDT!\n");
+	} else {
+		printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+		wdt_keepalive();
 	}
 	clear_bit(0, &wdt_is_open);
 	wdt_expect_close = 0;
@@ -262,8 +285,7 @@
 static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 	unsigned long arg)
 {
-	static struct watchdog_info ident=
-	{
+	static struct watchdog_info ident = {
 		.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
 		.firmware_version = 1,
 		.identity = "SC520",
@@ -307,10 +329,9 @@
 			if(get_user(new_timeout, (int *)arg))
 				return -EFAULT;
 
-			if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */
+			if(wdt_set_heartbeat(new_timeout))
 				return -EINVAL;
 
-			timeout = new_timeout;
 			wdt_keepalive();
 			/* Fall through */
 		}
@@ -351,81 +372,59 @@
  *	turn the timebomb registers off.
  */
 
-static struct notifier_block wdt_notifier=
-{
+static struct notifier_block wdt_notifier = {
 	.notifier_call = wdt_notify_sys,
 };
 
 static void __exit sc520_wdt_unload(void)
 {
-	wdt_turnoff();
+	if (!nowayout)
+		wdt_turnoff();
 
 	/* Deregister */
 	misc_deregister(&wdt_miscdev);
-	iounmap(wdtmrctl);
 	unregister_reboot_notifier(&wdt_notifier);
+	iounmap(wdtmrctl);
 }
 
 static int __init sc520_wdt_init(void)
 {
 	int rc = -EBUSY;
-	unsigned long cbar;
 
 	spin_lock_init(&wdt_spinlock);
 
-	if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
-	{
-		timeout = WATCHDOG_TIMEOUT;
-		printk(KERN_INFO PFX "timeout value must be 1<=x<=3600, using %d\n",
-			timeout);
-	}
-
 	init_timer(&timer);
 	timer.function = wdt_timer_ping;
 	timer.data = 0;
 
-	rc = misc_register(&wdt_miscdev);
-	if (rc)
-	{
-		printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
-			wdt_miscdev.minor, rc);
+	/* Check that the timeout value is within it's range ; if not reset to the default */
+	if (wdt_set_heartbeat(timeout)) {
+		wdt_set_heartbeat(WATCHDOG_TIMEOUT);
+		printk(KERN_INFO PFX "timeout value must be 1<=timeout<=3600, using %d\n",
+			WATCHDOG_TIMEOUT);
+	}
+
+	wdtmrctl = ioremap((unsigned long)(MMCR_BASE + OFFS_WDTMRCTL), 2);
+	if (!wdtmrctl) {
+		printk(KERN_ERR PFX "Unable to remap memory\n");
+		rc = -ENOMEM;
 		goto err_out_region2;
 	}
 
 	rc = register_reboot_notifier(&wdt_notifier);
-	if (rc)
-	{
+	if (rc) {
 		printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
 			rc);
-		goto err_out_miscdev;
+		goto err_out_ioremap;
 	}
 
-	/* get the Base Address Register */
-	cbar = inl_p(0xfffc);
-	printk(KERN_INFO PFX "CBAR: 0x%08lx\n", cbar);
-	/* check if MMCR aliasing bit is set */
-	if (cbar & 0x80000000) {
-		printk(KERN_INFO PFX "MMCR Aliasing enabled.\n");
-		wdtmrctl = (__u16 *)(cbar & 0x3fffffff);
-	} else {
-		printk(KERN_INFO PFX "!!! WARNING !!!\n"
-		  "\t MMCR Aliasing found NOT enabled!\n"
-		  "\t Using default value of: %p\n"
-		  "\t This has not been tested!\n"
-		  "\t Please email Scott Jennings <smj@oro.net>\n"
-		  "\t  and Bill Jennings <bj@oro.net> if it works!\n"
-		  , MMCR_BASE_DEFAULT
-		  );
-	  wdtmrctl = MMCR_BASE_DEFAULT;
-	}
-
-	wdtmrctl = (__u16 *)((char *)wdtmrctl + OFFS_WDTMRCTL);
-	wdtmrctl = ioremap((unsigned long)wdtmrctl, 2);
-	if (!wdtmrctl) {
-		printk (KERN_ERR PFX "Unable to remap memory.\n");
-		rc = -ENOMEM;
+	rc = misc_register(&wdt_miscdev);
+	if (rc) {
+		printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
+			WATCHDOG_MINOR, rc);
 		goto err_out_notifier;
 	}
+
 	printk(KERN_INFO PFX "WDT driver for SC520 initialised. timeout=%d sec (nowayout=%d)\n",
 		timeout,nowayout);
 
@@ -433,8 +432,8 @@
 
 err_out_notifier:
 	unregister_reboot_notifier(&wdt_notifier);
-err_out_miscdev:
-	misc_deregister(&wdt_miscdev);
+err_out_ioremap:
+	iounmap(wdtmrctl);
 err_out_region2:
 	return rc;
 }
diff -Nru a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c
--- a/drivers/char/watchdog/scx200_wdt.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/char/watchdog/scx200_wdt.c	Tue Jun 15 22:20:42 2004
@@ -25,6 +25,7 @@
 #include <linux/watchdog.h>
 #include <linux/notifier.h>
 #include <linux/reboot.h>
+#include <linux/fs.h>
 #include <linux/pci.h>
 #include <linux/scx200.h>
 
@@ -220,10 +221,16 @@
 
 	printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n");
 
-	/* First check that this really is a NatSemi SCx200 CPU */
+	/*
+	 * First check that this really is a NatSemi SCx200 CPU or a Geode
+	 * SC1100 processor
+	 */
 	if ((pci_find_device(PCI_VENDOR_ID_NS,
 			     PCI_DEVICE_ID_NS_SCx200_BRIDGE,
-			     NULL)) == NULL)
+			     NULL)) == NULL
+	    && (pci_find_device(PCI_VENDOR_ID_NS,
+				PCI_DEVICE_ID_NS_SC1100_BRIDGE,
+				NULL)) == NULL)
 		return -ENODEV;
 
 	/* More sanity checks, verify that the configuration block is there */
diff -Nru a/drivers/char/watchdog/shwdt.c b/drivers/char/watchdog/shwdt.c
--- a/drivers/char/watchdog/shwdt.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/char/watchdog/shwdt.c	Tue Jun 15 22:20:38 2004
@@ -64,7 +64,6 @@
  */
 static int clock_division_ratio = WTCSR_CKS_4096;
 
-#define msecs_to_jiffies(msecs)	(jiffies + (HZ * msecs + 9999) / 10000)
 #define next_ping_period(cks)	msecs_to_jiffies(cks - 4)
 
 static unsigned long shwdt_is_open;
diff -Nru a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c
--- a/drivers/char/watchdog/w83627hf_wdt.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/char/watchdog/w83627hf_wdt.c	Tue Jun 15 22:20:41 2004
@@ -72,7 +72,7 @@
 #define WDT_EFDR (WDT_EFIR+1) /* Extended Function Data Register */
 
 static void
-wdt_ctrl(int timeout)
+w83627hf_select_wd_register(void)
 {
 	outb_p(0x87, WDT_EFER); /* Enter extended function mode */
 	outb_p(0x87, WDT_EFER); /* Again according to manual */
@@ -81,23 +81,64 @@
 	outb_p(0x08, WDT_EFDR); /* select logical device 8 (GPIO2) */
 	outb_p(0x30, WDT_EFER); /* select CR30 */
 	outb_p(0x01, WDT_EFDR); /* set bit 0 to activate GPIO2 */
+}
+
+static void
+w83627hf_unselect_wd_register(void)
+{
+	outb_p(0xAA, WDT_EFER); /* Leave extended function mode */
+}
+
+/* tyan motherboards seem to set F5 to 0x4C ?
+ * So explicitly init to appropriate value. */
+static void
+w83627hf_init(void)
+{
+	unsigned char t;
+
+	w83627hf_select_wd_register();
+
+	outb_p(0xF5, WDT_EFER); /* Select CRF5 */
+	t=inb_p(WDT_EFDR);      /* read CRF5 */
+	t&=~0x0C;               /* set second mode & disable keyboard turning off watchdog */
+	outb_p(t, WDT_EFDR);    /* Write back to CRF5 */
+
+	w83627hf_unselect_wd_register();
+}
+
+static void
+wdt_ctrl(int timeout)
+{
+	w83627hf_select_wd_register();
 
 	outb_p(0xF6, WDT_EFER);    /* Select CRF6 */
 	outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF6 */
 
-	outb_p(0xAA, WDT_EFER); /* Leave extended function mode */
+	w83627hf_unselect_wd_register();
 }
 
-static void
+static int
 wdt_ping(void)
 {
 	wdt_ctrl(timeout);
+	return 0;
 }
 
-static void
+static int
 wdt_disable(void)
 {
 	wdt_ctrl(0);
+	return 0;
+}
+
+static int
+wdt_set_heartbeat(int t)
+{
+	if ((t < 1) || (t > 63))
+		return -EINVAL;
+
+	timeout = t;
+	return 0;
 }
 
 static ssize_t
@@ -134,7 +175,7 @@
 	static struct watchdog_info ident = {
 		.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
 		.firmware_version = 1,
-		.identity = "Advantech WDT",
+		.identity = "W83627HF WDT",
 	};
 
 	switch (cmd) {
@@ -154,9 +195,8 @@
 	case WDIOC_SETTIMEOUT:
 	  if (get_user(new_timeout, (int *)arg))
 		  return -EFAULT;
-	  if ((new_timeout < 1) || (new_timeout > 63))
+	  if (wdt_set_heartbeat(new_timeout))
 		  return -EINVAL;
-	  timeout = new_timeout;
 	  wdt_ping();
 	  /* Fall */
 
@@ -211,8 +251,8 @@
 		printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
 		wdt_ping();
 	}
-	clear_bit(0, &wdt_is_open);
 	expect_close = 0;
+	clear_bit(0, &wdt_is_open);
 	return 0;
 }
 
@@ -264,12 +304,12 @@
 {
 	int ret;
 
-	printk(KERN_INFO "WDT driver for Advantech single board computer initialising.\n");
+	printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF Super I/O chip initialising.\n");
 
-	if (timeout < 1 || timeout > 63) {
-		timeout = WATCHDOG_TIMEOUT;
-		printk (KERN_INFO PFX "timeout value must be 1<=x<=63, using %d\n",
-			timeout);
+	if (wdt_set_heartbeat(timeout)) {
+		wdt_set_heartbeat(WATCHDOG_TIMEOUT);
+		printk (KERN_INFO PFX "timeout value must be 1<=timeout<=63, using %d\n",
+			WATCHDOG_TIMEOUT);
 	}
 
 	if (!request_region(wdt_io, 1, WATCHDOG_NAME)) {
@@ -278,6 +318,8 @@
 		ret = -EIO;
 		goto out;
 	}
+
+	w83627hf_init();
 
 	ret = register_reboot_notifier(&wdt_notifier);
 	if (ret != 0) {
diff -Nru a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c
--- a/drivers/char/watchdog/wdt.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/char/watchdog/wdt.c	Tue Jun 15 22:20:40 2004
@@ -633,8 +633,8 @@
 outmisc:
 #ifdef CONFIG_WDT_501
 	misc_deregister(&temp_miscdev);
-#endif /* CONFIG_WDT_501 */
 outrbt:
+#endif /* CONFIG_WDT_501 */
 	unregister_reboot_notifier(&wdt_notifier);
 outirq:
 	free_irq(irq, NULL);
diff -Nru a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
--- a/drivers/cpufreq/cpufreq.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/cpufreq/cpufreq.c	Tue Jun 15 22:20:37 2004
@@ -33,9 +33,10 @@
 static struct cpufreq_policy	*cpufreq_cpu_data[NR_CPUS];
 static spinlock_t		cpufreq_driver_lock = SPIN_LOCK_UNLOCKED;
 
-/* internal prototype */
+/* internal prototypes */
 static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event);
-
+static void handle_update(void *data);
+static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci);
 
 /**
  * Two notifier lists: the "policy" list is involved in the 
@@ -161,6 +162,7 @@
 show_one(cpuinfo_max_freq, cpuinfo.max_freq);
 show_one(scaling_min_freq, min);
 show_one(scaling_max_freq, max);
+show_one(scaling_cur_freq, cur);
 
 /**
  * cpufreq_per_cpu_attr_write() / store_##file_name() - sysfs write access
@@ -189,6 +191,18 @@
 store_one(scaling_max_freq,max);
 
 /**
+ * show_cpuinfo_cur_freq - current CPU frequency as detected by hardware
+ */
+static ssize_t show_cpuinfo_cur_freq (struct cpufreq_policy * policy, char *buf)
+{
+	unsigned int cur_freq = cpufreq_get(policy->cpu);
+	if (!cur_freq)
+		return sprintf(buf, "<unknown>");
+	return sprintf(buf, "%u\n", cur_freq);
+}
+
+
+/**
  * show_scaling_governor - show the current policy for the specified CPU
  */
 static ssize_t show_scaling_governor (struct cpufreq_policy * policy, char *buf)
@@ -268,6 +282,12 @@
 	.show = show_##_name, \
 }
 
+#define define_one_ro0400(_name) \
+struct freq_attr _name = { \
+	.attr = { .name = __stringify(_name), .mode = 0400 }, \
+	.show = show_##_name, \
+}
+
 #define define_one_rw(_name) \
 struct freq_attr _name = { \
 	.attr = { .name = __stringify(_name), .mode = 0644 }, \
@@ -275,10 +295,12 @@
 	.store = store_##_name, \
 }
 
+define_one_ro0400(cpuinfo_cur_freq);
 define_one_ro(cpuinfo_min_freq);
 define_one_ro(cpuinfo_max_freq);
 define_one_ro(scaling_available_governors);
 define_one_ro(scaling_driver);
+define_one_ro(scaling_cur_freq);
 define_one_rw(scaling_min_freq);
 define_one_rw(scaling_max_freq);
 define_one_rw(scaling_governor);
@@ -369,6 +391,7 @@
 	policy->cpu = cpu;
 	init_MUTEX_LOCKED(&policy->lock);
 	init_completion(&policy->kobj_unregister);
+	INIT_WORK(&policy->update, handle_update, (void *)(long)cpu);
 
 	/* call driver. From then on the cpufreq must be able
 	 * to accept all calls to ->verify and ->setpolicy for this CPU
@@ -394,6 +417,10 @@
 		sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
 		drv_attr++;
 	}
+	if (cpufreq_driver->get)
+		sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
+	if (cpufreq_driver->target)
+		sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
 
 	spin_lock_irqsave(&cpufreq_driver_lock, flags);
 	cpufreq_cpu_data[cpu] = policy;
@@ -474,11 +501,86 @@
 	return 0;
 }
 
+
+static void handle_update(void *data)
+{
+	unsigned int cpu = (unsigned int)(long)data;
+	cpufreq_update_policy(cpu);
+}
+
+/**
+ *	cpufreq_out_of_sync - If actual and saved CPU frequency differs, we're in deep trouble.
+ *	@cpu: cpu number
+ *	@old_freq: CPU frequency the kernel thinks the CPU runs at
+ *	@new_freq: CPU frequency the CPU actually runs at
+ *
+ *	We adjust to current frequency first, and need to clean up later. So either call
+ *	to cpufreq_update_policy() or schedule handle_update()).
+ */
+static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigned int new_freq)
+{
+	struct cpufreq_freqs freqs;
+
+	if (cpufreq_driver->flags & CPUFREQ_PANIC_OUTOFSYNC)
+		panic("CPU Frequency is out of sync.");
+
+	printk(KERN_WARNING "Warning: CPU frequency out of sync: cpufreq and timing "
+	       "core thinks of %u, is %u kHz.\n", old_freq, new_freq);
+
+	freqs.cpu = cpu;
+	freqs.old = old_freq;
+	freqs.new = new_freq;
+	cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
+}
+
+
+/** 
+ * cpufreq_get - get the current CPU frequency (in kHz)
+ * @cpu: CPU number
+ *
+ * Get the CPU current (static) CPU frequency
+ */
+unsigned int cpufreq_get(unsigned int cpu)
+{
+	struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
+	unsigned int ret = 0;
+
+	if (!policy)
+		return 0;
+
+	if (!cpufreq_driver->get)
+		goto out;
+
+	down(&policy->lock);
+
+	ret = cpufreq_driver->get(cpu);
+
+	if (ret && policy->cur && !(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) 
+	{
+		/* verify no discrepancy between actual and saved value exists */
+		if (unlikely(ret != policy->cur)) {
+			cpufreq_out_of_sync(cpu, policy->cur, ret);
+			schedule_work(&policy->update);
+		}
+	}
+
+	up(&policy->lock);
+
+ out:
+	cpufreq_cpu_put(policy);
+
+	return (ret);
+}
+EXPORT_SYMBOL(cpufreq_get);
+
+
 /**
- *	cpufreq_resume - restore the CPU clock frequency after resume
+ *	cpufreq_resume -  restore proper CPU frequency handling after resume
  *
- *	Restore the CPU clock frequency so that our idea of the current
- *	frequency reflects the actual hardware.
+ *	1.) resume CPUfreq hardware support (cpufreq_driver->resume())
+ *	2.) if ->target and !CPUFREQ_CONST_LOOPS: verify we're in sync
+ *	3.) schedule call cpufreq_update_policy() ASAP as interrupts are restored.
  */
 static int cpufreq_resume(struct sys_device * sysdev)
 {
@@ -498,25 +600,37 @@
 	if (!cpu_policy)
 		return -EINVAL;
 
-	if (cpufreq_driver->resume)
-		ret = cpufreq_driver->resume(cpu_policy);
-	if (ret) {
-		printk(KERN_ERR "cpufreq: resume failed in ->resume step on CPU %u\n", cpu_policy->cpu);
-		goto out;
-	}
+	if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
+		unsigned int cur_freq = 0;
 
-	if (cpufreq_driver->setpolicy)
-		ret = cpufreq_driver->setpolicy(cpu_policy);
-	else
-		/* CPUFREQ_RELATION_H or CPUFREQ_RELATION_L have the same effect here, as cpu_policy->cur is known
-		 * to be a valid and exact target frequency
-		 */
-		ret = cpufreq_driver->target(cpu_policy, cpu_policy->cur, CPUFREQ_RELATION_H);
+		if (cpufreq_driver->get)
+			cur_freq = cpufreq_driver->get(cpu_policy->cpu);
 
-	if (ret)
-		printk(KERN_ERR "cpufreq: resume failed in ->setpolicy/target step on CPU %u\n", cpu_policy->cpu);
+		if (!cur_freq || !cpu_policy->cur) {
+			printk(KERN_ERR "cpufreq: resume failed to assert current frequency is what timing core thinks it is.\n");
+			goto out;
+		}
+
+		if (unlikely(cur_freq != cpu_policy->cur)) {
+			struct cpufreq_freqs freqs;
+
+			if (cpufreq_driver->flags & CPUFREQ_PANIC_RESUME_OUTOFSYNC)
+				panic("CPU Frequency is out of sync.");
+
+			printk(KERN_WARNING "Warning: CPU frequency out of sync: cpufreq and timing"
+			       "core thinks of %u, is %u kHz.\n", cpu_policy->cur, cur_freq);
+
+			freqs.cpu = cpu;
+			freqs.old = cpu_policy->cur;
+			freqs.new = cur_freq;
+
+			notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_RESUMECHANGE, &freqs);
+			adjust_jiffies(CPUFREQ_RESUMECHANGE, &freqs);
+		}
+	}
 
 out:
+	schedule_work(&cpu_policy->update);
 	cpufreq_cpu_put(cpu_policy);
 	return ret;
 }
@@ -608,7 +722,12 @@
 			    unsigned int target_freq,
 			    unsigned int relation)
 {
-	return cpufreq_driver->target(policy, target_freq, relation);
+	int retval = -EINVAL;
+	lock_cpu_hotplug();
+	if (cpu_online(policy->cpu))
+		retval = cpufreq_driver->target(policy, target_freq, relation);
+	unlock_cpu_hotplug();
+	return retval;
 }
 EXPORT_SYMBOL_GPL(__cpufreq_driver_target);
 
@@ -904,16 +1023,20 @@
 
 static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
 {
+	if (ci->flags & CPUFREQ_CONST_LOOPS)
+		return;
+
 	if (!l_p_j_ref_freq) {
 		l_p_j_ref = loops_per_jiffy;
 		l_p_j_ref_freq = ci->old;
 	}
 	if ((val == CPUFREQ_PRECHANGE  && ci->old < ci->new) ||
-	    (val == CPUFREQ_POSTCHANGE && ci->old > ci->new))
+	    (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) ||
+	    (val == CPUFREQ_RESUMECHANGE))
 		loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, ci->new);
 }
 #else
-#define adjust_jiffies(x...) do {} while (0)
+static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) { return; }
 #endif
 
 
@@ -925,13 +1048,29 @@
  */
 void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
 {
-	if (irqs_disabled())
-		return;   /* Only valid if we're in the resume process where
-			   * everyone knows what CPU frequency we are at */
+	BUG_ON(irqs_disabled());
+
+	freqs->flags = cpufreq_driver->flags;
 
 	down_read(&cpufreq_notifier_rwsem);
 	switch (state) {
 	case CPUFREQ_PRECHANGE:
+		/* detect if the driver reported a value as "old frequency" which
+		 * is not equal to what the cpufreq core thinks is "old frequency".
+		 */
+		if (!(cpufreq_driver->flags & CPUFREQ_CONST_LOOPS)) {
+			if ((likely(cpufreq_cpu_data[freqs->cpu]->cur)) &&
+			    (unlikely(freqs->old != cpufreq_cpu_data[freqs->cpu]->cur)))
+			{
+				if (cpufreq_driver->flags & CPUFREQ_PANIC_OUTOFSYNC)
+					panic("CPU Frequency is out of sync.");
+
+				printk(KERN_WARNING "Warning: CPU frequency out of sync: "
+				       "cpufreq and timing core thinks of %u, is %u kHz.\n", 
+				       cpufreq_cpu_data[freqs->cpu]->cur, freqs->old);
+				freqs->old = cpufreq_cpu_data[freqs->cpu]->cur;
+			}
+		}
 		notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_PRECHANGE, freqs);
 		adjust_jiffies(CPUFREQ_PRECHANGE, freqs);
 		break;
@@ -969,6 +1108,9 @@
 	if (!driver_data || !driver_data->verify || !driver_data->init ||
 	    ((!driver_data->setpolicy) && (!driver_data->target)))
 		return -EINVAL;
+
+	if (driver_data->setpolicy)
+		driver_data->flags |= CPUFREQ_CONST_LOOPS;
 
 	spin_lock_irqsave(&cpufreq_driver_lock, flags);
 	if (cpufreq_driver) {
diff -Nru a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
--- a/drivers/cpufreq/cpufreq_userspace.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/cpufreq/cpufreq_userspace.c	Tue Jun 15 22:20:37 2004
@@ -145,19 +145,6 @@
 EXPORT_SYMBOL_GPL(cpufreq_setmax);
 
 
-/** 
- * cpufreq_get - get the current CPU frequency (in kHz)
- * @cpu: CPU number
- *
- * Get the CPU current (static) CPU frequency
- */
-unsigned int cpufreq_get(unsigned int cpu)
-{
-	return cpu_cur_freq[cpu];
-}
-EXPORT_SYMBOL(cpufreq_get);
-
-
 #ifdef CONFIG_CPU_FREQ_24_API
 
 
@@ -219,7 +206,7 @@
 		if (oldlen != sizeof(unsigned int))
 			return -EINVAL;
 
-		if (put_user(cpufreq_get(cpu), (unsigned int *)oldval) ||
+		if (put_user(cpufreq_get(cpu), (unsigned int __user *)oldval) ||
 		    put_user(sizeof(unsigned int), oldlenp))
 			return -EFAULT;
 	}
@@ -229,7 +216,7 @@
 		if (newlen != sizeof(unsigned int))
 			return -EINVAL;
 
-		if (get_user(freq, (unsigned int *)newval))
+		if (get_user(freq, (unsigned int __user *)newval))
 			return -EFAULT;
 
 		cpufreq_set(freq, cpu);
@@ -542,20 +529,6 @@
 	return 0;
 }
 
-/* on ARM SA1100 we need to rely on the values of cpufreq_get() - because 
- * of this, cpu_cur_freq[] needs to be set early.
- */
-#if defined(CONFIG_ARM) && defined(CONFIG_ARCH_SA1100)
-extern unsigned int sa11x0_getspeed(void);
-
-static void cpufreq_sa11x0_compat(void)
-{
-	cpu_cur_freq[0] = sa11x0_getspeed();
-}
-#else
-#define cpufreq_sa11x0_compat() do {} while(0)
-#endif
-
 
 struct cpufreq_governor cpufreq_gov_userspace = {
 	.name		= "userspace",
@@ -564,21 +537,12 @@
 };
 EXPORT_SYMBOL(cpufreq_gov_userspace);
 
-static int already_init = 0;
-
-int cpufreq_gov_userspace_init(void)
+static int __init cpufreq_gov_userspace_init(void)
 {
-	if (!already_init) {
-		down(&userspace_sem);
-		cpufreq_sa11x0_compat();
-		cpufreq_sysctl_init();
-		cpufreq_register_notifier(&userspace_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
-		already_init = 1;
-		up(&userspace_sem);
-	}
+	cpufreq_sysctl_init();
+	cpufreq_register_notifier(&userspace_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
 	return cpufreq_register_governor(&cpufreq_gov_userspace);
 }
-EXPORT_SYMBOL(cpufreq_gov_userspace_init);
 
 
 static void __exit cpufreq_gov_userspace_exit(void)
diff -Nru a/drivers/cpufreq/proc_intf.c b/drivers/cpufreq/proc_intf.c
--- a/drivers/cpufreq/proc_intf.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/cpufreq/proc_intf.c	Tue Jun 15 22:20:37 2004
@@ -164,7 +164,7 @@
  */
 static int cpufreq_proc_write (
         struct file		*file,
-        const char		*buffer,
+        const char		__user *buffer,
         unsigned long		count,
         void			*data)
 {
diff -Nru a/drivers/fc4/fc.c b/drivers/fc4/fc.c
--- a/drivers/fc4/fc.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/fc4/fc.c	Tue Jun 15 22:20:41 2004
@@ -59,8 +59,6 @@
 #define dma_unmap_single(d,h,s,dir) sbus_unmap_single(d,h,s,dir)
 #define dma_map_sg(d,s,n,dir) sbus_map_sg(d,s,n,dir)
 #define dma_unmap_sg(d,s,n,dir) sbus_unmap_sg(d,s,n,dir)
-#define scsi_to_fc_dma_dir(dir)	scsi_to_sbus_dma_dir(dir)
-#define FC_DMA_BIDIRECTIONAL	SBUS_DMA_BIDIRECTIONAL
 #else
 #define dma_alloc_consistent(d,s,p) pci_alloc_consistent(d,s,p)
 #define dma_free_consistent(d,s,v,h) pci_free_consistent(d,s,v,h)
@@ -68,8 +66,6 @@
 #define dma_unmap_single(d,h,s,dir) pci_unmap_single(d,h,s,dir)
 #define dma_map_sg(d,s,n,dir) pci_map_sg(d,s,n,dir)
 #define dma_unmap_sg(d,s,n,dir) pci_unmap_sg(d,s,n,dir)
-#define scsi_to_fc_dma_dir(dir)	scsi_to_pci_dma_dir(dir)
-#define FC_DMA_BIDIRECTIONAL	PCI_DMA_BIDIRECTIONAL
 #endif							       
 
 #define FCP_CMND(SCpnt) ((fcp_cmnd *)&(SCpnt->SCp))
@@ -167,7 +163,7 @@
 			fcmd = l->fcmds + i;
 			plogi = l->logi + 3 * i;
 			dma_unmap_single (fc->dev, fcmd->cmd, 3 * sizeof(logi),
-					  FC_DMA_BIDIRECTIONAL);
+					  DMA_BIDIRECTIONAL);
 			plogi->code = LS_PLOGI;
 			memcpy (&plogi->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn));
 			memcpy (&plogi->node_wwn, &fc->wwn_node, sizeof(fc_wwn));
@@ -188,7 +184,7 @@
 			}
 #endif			
 			fcmd->cmd = dma_map_single (fc->dev, plogi, 3 * sizeof(logi),
-						    FC_DMA_BIDIRECTIONAL);
+						    DMA_BIDIRECTIONAL);
 			fcmd->rsp = fcmd->cmd + 2 * sizeof(logi);
 			if (fc->hw_enque (fc, fcmd))
 				printk ("FC: Cannot enque PLOGI packet on %s\n", fc->name);
@@ -212,7 +208,7 @@
 		case FC_STATUS_OK:
 			plogi = l->logi + 3 * i;
 			dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi),
-					  FC_DMA_BIDIRECTIONAL);
+					  DMA_BIDIRECTIONAL);
 			if (!fc->wwn_dest.lo && !fc->wwn_dest.hi) {
 				memcpy (&fc->wwn_dest, &plogi[1].node_wwn, sizeof(fc_wwn)); 
 				FCD(("Dest WWN %08x%08x\n", *(u32 *)&fc->wwn_dest, fc->wwn_dest.lo))
@@ -231,7 +227,7 @@
 		case FC_STATUS_ERR_OFFLINE:
 			fc->state = FC_STATE_OFFLINE;
 			dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi),
-					  FC_DMA_BIDIRECTIONAL);
+					  DMA_BIDIRECTIONAL);
 			printk ("%s: FC is offline\n", fc->name);
 			if (atomic_dec_and_test (&l->todo))
 				up(&l->sem);
@@ -256,7 +252,7 @@
 	switch (status) {
 	case FC_STATUS_OK: /* Ok, let's have a fun on a loop */
 		dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi),
-				  FC_DMA_BIDIRECTIONAL);
+				  DMA_BIDIRECTIONAL);
 		p = (fc_al_posmap *)(l->logi + 3 * i);
 #ifdef FCDEBUG
 		{
@@ -306,7 +302,7 @@
 		FCD(("SID %d DID %d\n", fc->sid, fc->did))
 		fcmd = l->fcmds + i;
 		dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi),
-				 FC_DMA_BIDIRECTIONAL);
+				 DMA_BIDIRECTIONAL);
 		fch = &fcmd->fch;
 		memset(l->logi + 3 * i, 0, 3 * sizeof(logi));
 		FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT);
@@ -317,7 +313,7 @@
 		fch->param = 0;
 		l->logi [3 * i].code = LS_FLOGI;
 		fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi),
-					    FC_DMA_BIDIRECTIONAL);
+					    DMA_BIDIRECTIONAL);
 		fcmd->rsp = fcmd->cmd + sizeof(logi);
 		fcmd->cmdlen = sizeof(logi);
 		fcmd->rsplen = sizeof(logi);
@@ -434,11 +430,12 @@
 		
 		if (fcmd->data) {
 			if (SCpnt->use_sg)
-				dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->buffer, SCpnt->use_sg,
-					     scsi_to_fc_dma_dir(SCpnt->sc_data_direction));
+				dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->buffer,
+						SCpnt->use_sg,
+						SCpnt->sc_data_direction);
 			else
 				dma_unmap_single(fc->dev, fcmd->data, SCpnt->request_bufflen,
-						 scsi_to_fc_dma_dir(SCpnt->sc_data_direction));
+						 SCpnt->sc_data_direction);
 		}
 		break;
 	default:
@@ -579,7 +576,7 @@
 		fc->ls = (void *)l;
 		/* Assumes sizeof(fc_al_posmap) < 3 * sizeof(logi), which is true */
 		fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi),
-					    FC_DMA_BIDIRECTIONAL);
+					    DMA_BIDIRECTIONAL);
 		fcmd->proto = PROTO_REPORT_AL_MAP;
 		fcmd->token = i;
 		fcmd->fc = fc;
@@ -598,7 +595,7 @@
 				} else {
 					fc->state = FC_STATE_OFFLINE;
 					enable_irq(fc->irq);
-					dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL);
+					dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL);
 					if (atomic_dec_and_test (&l->todo))
 						goto all_done;
 				}
@@ -615,7 +612,7 @@
 
 				FCD(("SID %d DID %d\n", fc->sid, fc->did))
 				fcmd = l->fcmds + i;
-				dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL);
+				dma_unmap_single(fc->dev, fcmd->cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL);
 				fch = &fcmd->fch;
 				FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, FS_FABRIC_F_PORT);
 				FILL_FCHDR_SID(fch, 0);
@@ -624,7 +621,7 @@
 				FILL_FCHDR_OXRX(fch, 0xffff, 0xffff);
 				fch->param = 0;
 				l->logi [3 * i].code = LS_FLOGI;
-				fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL);
+				fcmd->cmd = dma_map_single (fc->dev, l->logi + 3 * i, 3 * sizeof(logi), DMA_BIDIRECTIONAL);
 				fcmd->rsp = fcmd->cmd + sizeof(logi);
 				fcmd->cmdlen = sizeof(logi);
 				fcmd->rsplen = sizeof(logi);
@@ -652,7 +649,7 @@
 		switch (fc->state) {
 		case FC_STATE_ONLINE: break;
 		case FC_STATE_OFFLINE: break;
-		default: dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), FC_DMA_BIDIRECTIONAL);
+		default: dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), DMA_BIDIRECTIONAL);
 			break;
 		}
 	}
@@ -821,14 +818,14 @@
 				cmd->fcp_data_len = SCpnt->request_bufflen;
 				fcmd->data = dma_map_single (fc->dev, (char *)SCpnt->request_buffer,
 							     SCpnt->request_bufflen,
-							     scsi_to_fc_dma_dir(SCpnt->sc_data_direction));
+							     SCpnt->sc_data_direction);
 			} else {
 				struct scatterlist *sg = (struct scatterlist *)SCpnt->buffer;
 				int nents;
 
 				FCD(("XXX: Use_sg %d %d\n", SCpnt->use_sg, sg->length))
 				nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg,
-						    scsi_to_fc_dma_dir(SCpnt->sc_data_direction));
+						    SCpnt->sc_data_direction);
 				if (nents > 1) printk ("%s: SG for nents %d (use_sg %d) not handled yet\n", fc->name, nents, SCpnt->use_sg);
 				fcmd->data = sg_dma_address(sg);
 				cmd->fcp_data_len = sg_dma_len(sg);
@@ -1065,7 +1062,7 @@
 	FILL_FCHDR_SEQ_DF_SEQ(fch, 0, 0, 0);
 	FILL_FCHDR_OXRX(fch, 0xffff, 0xffff);
 	fch->param = 0;
-	fcmd->cmd = dma_map_single (fc->dev, data, 2 * len, FC_DMA_BIDIRECTIONAL);
+	fcmd->cmd = dma_map_single (fc->dev, data, 2 * len, DMA_BIDIRECTIONAL);
 	fcmd->rsp = fcmd->cmd + len;
 	fcmd->cmdlen = len;
 	fcmd->rsplen = len;
@@ -1100,7 +1097,7 @@
 	
 	clear_bit(fcmd->token, fc->scsi_bitmap);
 	fc->scsi_free++;
-	dma_unmap_single (fc->dev, fcmd->cmd, 2 * len, FC_DMA_BIDIRECTIONAL);
+	dma_unmap_single (fc->dev, fcmd->cmd, 2 * len, DMA_BIDIRECTIONAL);
 	return l.status;
 }
 
diff -Nru a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
--- a/drivers/firmware/Kconfig	Tue Jun 15 22:20:35 2004
+++ b/drivers/firmware/Kconfig	Tue Jun 15 22:20:35 2004
@@ -12,7 +12,7 @@
 	help
 	  Say Y or M here if you want to enable BIOS Enhanced Disk Drive
 	  Services real mode BIOS calls to determine which disk
-	  BIOS tries boot from.  This information is then exported via driverfs.
+	  BIOS tries boot from.  This information is then exported via sysfs.
 
 	  This option is experimental, but believed to be safe,
 	  and most disk controller BIOS vendors do not yet implement this feature.
diff -Nru a/drivers/firmware/edd.c b/drivers/firmware/edd.c
--- a/drivers/firmware/edd.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/firmware/edd.c	Tue Jun 15 22:20:39 2004
@@ -15,9 +15,8 @@
  * made in setup.S, copied to safe structures in setup.c,
  * and presents it in sysfs.
  *
- * Please see http://domsch.com/linux/edd30/results.html for
+ * Please see http://linux.dell.com/edd30/results.html for
  * the list of BIOSs which have been reported to implement EDD.
- * If you don't see yours listed, please send a report as described there.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License v2.0 as published by
@@ -30,15 +29,6 @@
  *
  */
 
-/*
- * Known issues:
- * - refcounting of struct device objects could be improved.
- *
- * TODO:
- * - Add IDE and USB disk device support
- * - move edd.[ch] to better locations if/when one is decided
- */
-
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/types.h>
@@ -50,20 +40,16 @@
 #include <linux/limits.h>
 #include <linux/device.h>
 #include <linux/pci.h>
-#include <linux/device.h>
 #include <linux/blkdev.h>
 #include <linux/edd.h>
-/* FIXME - this really belongs in include/scsi/scsi.h */
-#include <../drivers/scsi/scsi.h>
-#include <../drivers/scsi/hosts.h>
+
+#define EDD_VERSION "0.15"
+#define EDD_DATE    "2004-May-17"
 
 MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>");
 MODULE_DESCRIPTION("sysfs interface to BIOS EDD information");
 MODULE_LICENSE("GPL");
-
-#define EDD_VERSION "0.13 2004-Mar-09"
-#define EDD_DEVICE_NAME_SIZE 16
-#define REPORT_URL "http://linux.dell.com/edd/results.html"
+MODULE_VERSION(EDD_VERSION);
 
 #define left (PAGE_SIZE - (p - buf) - 1)
 
@@ -334,7 +320,7 @@
 }
 
 static ssize_t
-edd_show_legacy_cylinders(struct edd_device *edev, char *buf)
+edd_show_legacy_max_cylinder(struct edd_device *edev, char *buf)
 {
 	struct edd_info *info;
 	char *p = buf;
@@ -344,12 +330,12 @@
 	if (!info || !buf)
 		return -EINVAL;
 
-	p += snprintf(p, left, "0x%x\n", info->legacy_cylinders);
+	p += snprintf(p, left, "%u\n", info->legacy_max_cylinder);
 	return (p - buf);
 }
 
 static ssize_t
-edd_show_legacy_heads(struct edd_device *edev, char *buf)
+edd_show_legacy_max_head(struct edd_device *edev, char *buf)
 {
 	struct edd_info *info;
 	char *p = buf;
@@ -359,12 +345,12 @@
 	if (!info || !buf)
 		return -EINVAL;
 
-	p += snprintf(p, left, "0x%x\n", info->legacy_heads);
+	p += snprintf(p, left, "%u\n", info->legacy_max_head);
 	return (p - buf);
 }
 
 static ssize_t
-edd_show_legacy_sectors(struct edd_device *edev, char *buf)
+edd_show_legacy_sectors_per_track(struct edd_device *edev, char *buf)
 {
 	struct edd_info *info;
 	char *p = buf;
@@ -374,7 +360,7 @@
 	if (!info || !buf)
 		return -EINVAL;
 
-	p += snprintf(p, left, "0x%x\n", info->legacy_sectors);
+	p += snprintf(p, left, "%u\n", info->legacy_sectors_per_track);
 	return (p - buf);
 }
 
@@ -389,7 +375,7 @@
 	if (!info || !buf)
 		return -EINVAL;
 
-	p += scnprintf(p, left, "0x%x\n", info->params.num_default_cylinders);
+	p += scnprintf(p, left, "%u\n", info->params.num_default_cylinders);
 	return (p - buf);
 }
 
@@ -404,7 +390,7 @@
 	if (!info || !buf)
 		return -EINVAL;
 
-	p += scnprintf(p, left, "0x%x\n", info->params.num_default_heads);
+	p += scnprintf(p, left, "%u\n", info->params.num_default_heads);
 	return (p - buf);
 }
 
@@ -419,7 +405,7 @@
 	if (!info || !buf)
 		return -EINVAL;
 
-	p += scnprintf(p, left, "0x%x\n", info->params.sectors_per_track);
+	p += scnprintf(p, left, "%u\n", info->params.sectors_per_track);
 	return (p - buf);
 }
 
@@ -434,7 +420,7 @@
 	if (!info || !buf)
 		return -EINVAL;
 
-	p += scnprintf(p, left, "0x%llx\n", info->params.number_of_sectors);
+	p += scnprintf(p, left, "%llu\n", info->params.number_of_sectors);
 	return (p - buf);
 }
 
@@ -450,7 +436,7 @@
  */
 
 static int
-edd_has_legacy_cylinders(struct edd_device *edev)
+edd_has_legacy_max_cylinder(struct edd_device *edev)
 {
 	struct edd_info *info;
 	if (!edev)
@@ -458,11 +444,11 @@
 	info = edd_dev_get_info(edev);
 	if (!info)
 		return -EINVAL;
-	return info->legacy_cylinders > 0;
+	return info->legacy_max_cylinder > 0;
 }
 
 static int
-edd_has_legacy_heads(struct edd_device *edev)
+edd_has_legacy_max_head(struct edd_device *edev)
 {
 	struct edd_info *info;
 	if (!edev)
@@ -470,11 +456,11 @@
 	info = edd_dev_get_info(edev);
 	if (!info)
 		return -EINVAL;
-	return info->legacy_heads > 0;
+	return info->legacy_max_head > 0;
 }
 
 static int
-edd_has_legacy_sectors(struct edd_device *edev)
+edd_has_legacy_sectors_per_track(struct edd_device *edev)
 {
 	struct edd_info *info;
 	if (!edev)
@@ -482,7 +468,7 @@
 	info = edd_dev_get_info(edev);
 	if (!info)
 		return -EINVAL;
-	return info->legacy_sectors > 0;
+	return info->legacy_sectors_per_track > 0;
 }
 
 static int
@@ -569,12 +555,14 @@
 static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions, NULL);
 static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags, NULL);
 static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors, NULL);
-static EDD_DEVICE_ATTR(legacy_cylinders, 0444, edd_show_legacy_cylinders,
-		       edd_has_legacy_cylinders);
-static EDD_DEVICE_ATTR(legacy_heads, 0444, edd_show_legacy_heads,
-		       edd_has_legacy_heads);
-static EDD_DEVICE_ATTR(legacy_sectors, 0444, edd_show_legacy_sectors,
-		       edd_has_legacy_sectors);
+static EDD_DEVICE_ATTR(legacy_max_cylinder, 0444,
+                       edd_show_legacy_max_cylinder,
+		       edd_has_legacy_max_cylinder);
+static EDD_DEVICE_ATTR(legacy_max_head, 0444, edd_show_legacy_max_head,
+		       edd_has_legacy_max_head);
+static EDD_DEVICE_ATTR(legacy_sectors_per_track, 0444,
+                       edd_show_legacy_sectors_per_track,
+		       edd_has_legacy_sectors_per_track);
 static EDD_DEVICE_ATTR(default_cylinders, 0444, edd_show_default_cylinders,
 		       edd_has_default_cylinders);
 static EDD_DEVICE_ATTR(default_heads, 0444, edd_show_default_heads,
@@ -601,9 +589,9 @@
 
 /* These attributes are conditional and only added for some devices. */
 static struct edd_attribute * edd_attrs[] = {
-	&edd_attr_legacy_cylinders,
-	&edd_attr_legacy_heads,
-	&edd_attr_legacy_sectors,
+	&edd_attr_legacy_max_cylinder,
+	&edd_attr_legacy_max_head,
+	&edd_attr_legacy_sectors_per_track,
 	&edd_attr_default_cylinders,
 	&edd_attr_default_heads,
 	&edd_attr_default_sectors_per_track,
@@ -690,103 +678,6 @@
 	return sysfs_create_link(&edev->kobj,&pci_dev->dev.kobj,"pci_dev");
 }
 
-/*
- * FIXME - as of 15-Jan-2003, there are some non-"scsi_device"s on the
- * scsi_bus list.  The following functions could possibly mis-access
- * memory in that case.  This is actually a problem with the SCSI
- * layer, which is being addressed there.  Until then, don't use the
- * SCSI functions.
- */
-
-#undef CONFIG_SCSI
-#undef CONFIG_SCSI_MODULE
-#if defined(CONFIG_SCSI) || defined(CONFIG_SCSI_MODULE)
-
-struct edd_match_data {
-	struct edd_device	* edev;
-	struct scsi_device	* sd;
-};
-
-/**
- * edd_match_scsidev()
- * @edev - EDD device is a known SCSI device
- * @sd - scsi_device with host who's parent is a PCI controller
- *
- * returns 1 if a match is found, 0 if not.
- */
-static int edd_match_scsidev(struct device * dev, void * d)
-{
-	struct edd_match_data * data = (struct edd_match_data *)d;
-	struct edd_info *info = edd_dev_get_info(data->edev);
-	struct scsi_device * sd = to_scsi_device(dev);
-
-	if (info) {
-		if ((sd->channel == info->params.interface_path.pci.channel) &&
-		    (sd->id == info->params.device_path.scsi.id) &&
-		    (sd->lun == info->params.device_path.scsi.lun)) {
-			data->sd = sd;
-			return 1;
-		}
-	}
-	return 0;
-}
-
-/**
- * edd_find_matching_device()
- * @edev - edd_device to match
- *
- * Search the SCSI devices for a drive that matches the EDD
- * device descriptor we have. If we find a match, return it,
- * otherwise, return NULL.
- */
-
-static struct scsi_device *
-edd_find_matching_scsi_device(struct edd_device *edev)
-{
-	struct edd_match_data data;
-	struct bus_type * scsi_bus = find_bus("scsi");
-
-	if (!scsi_bus) {
-		return NULL;
-	}
-
-	data.edev = edev;
-
-	if (edd_dev_is_type(edev, "SCSI")) {
-		if (bus_for_each_dev(scsi_bus,NULL,&data,edd_match_scsidev))
-			return data.sd;
-	}
-	return NULL;
-}
-
-static int
-edd_create_symlink_to_scsidev(struct edd_device *edev)
-{
-	struct pci_dev *pci_dev;
-	int rc = -EINVAL;
-
-	pci_dev = edd_get_pci_dev(edev);
-	if (pci_dev) {
-		struct scsi_device * sdev = edd_find_matching_scsi_device(edev);
-		if (sdev && get_device(&sdev->sdev_driverfs_dev)) {
-			rc = sysfs_create_link(&edev->kobj,
-					       &sdev->sdev_driverfs_dev.kobj,
-					       "disc");
-			put_device(&sdev->sdev_driverfs_dev);
-		}
-	}
-	return rc;
-}
-
-#else
-static int
-edd_create_symlink_to_scsidev(struct edd_device *edev)
-{
-	return -ENOSYS;
-}
-#endif
-
-
 static inline void
 edd_device_unregister(struct edd_device *edev)
 {
@@ -807,7 +698,6 @@
 
 	if (!error) {
 		edd_create_symlink_to_pcidev(edev);
-		edd_create_symlink_to_scsidev(edev);
 	}
 }
 
@@ -820,8 +710,8 @@
 		return 1;
 	memset(edev, 0, sizeof (*edev));
 	edd_dev_set_info(edev, &edd[i]);
-	snprintf(edev->kobj.name, EDD_DEVICE_NAME_SIZE, "int13_dev%02x",
-		 edd[i].device);
+	kobject_set_name(&edev->kobj, "int13_dev%02x",
+			 edd[i].device);
 	kobj_set_kset_s(edev,edd_subsys);
 	error = kobject_register(&edev->kobj);
 	if (!error)
@@ -842,9 +732,8 @@
 	int rc=0;
 	struct edd_device *edev;
 
-	printk(KERN_INFO "BIOS EDD facility v%s, %d devices found\n",
-	       EDD_VERSION, eddnr);
-	printk(KERN_INFO "Please report your BIOS at %s\n", REPORT_URL);
+	printk(KERN_INFO "BIOS EDD facility v%s %s, %d devices found\n",
+	       EDD_VERSION, EDD_DATE, eddnr);
 
 	if (!eddnr) {
 		printk(KERN_INFO "EDD information not available.\n");
diff -Nru a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
--- a/drivers/firmware/efivars.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/firmware/efivars.c	Tue Jun 15 22:20:44 2004
@@ -23,6 +23,10 @@
  *
  * Changelog:
  *
+ *  17 May 2004 - Matt Domsch <Matt_Domsch@dell.com>
+ *   remove check for efi_enabled in exit
+ *   add MODULE_VERSION
+ *
  *  26 Apr 2004 - Matt Domsch <Matt_Domsch@dell.com>
  *   minor bug fixes
  *
@@ -77,11 +81,13 @@
 
 #include <asm/uaccess.h>
 
+#define EFIVARS_VERSION "0.08"
+#define EFIVARS_DATE "2004-May-17"
+
 MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>");
 MODULE_DESCRIPTION("sysfs interface to EFI Variables");
 MODULE_LICENSE("GPL");
-
-#define EFIVARS_VERSION "0.07 2004-Apr-26"
+MODULE_VERSION(EFIVARS_VERSION);
 
 /*
  * efivars_lock protects two things:
@@ -664,7 +670,11 @@
 	unsigned long variable_name_size = 1024;
 	int i, rc = 0, error = 0;
 
-	printk(KERN_INFO "EFI Variables Facility v%s\n", EFIVARS_VERSION);
+	if (!efi_enabled)
+		return -ENODEV;
+
+	printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
+	       EFIVARS_DATE);
 
 	/*
 	 * For now we'll register the efi subsys within this driver
diff -Nru a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
--- a/drivers/i2c/algos/i2c-algo-bit.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/i2c/algos/i2c-algo-bit.c	Tue Jun 15 22:20:41 2004
@@ -381,7 +381,13 @@
 			break;
 		}
 
-		if ( count > 1 ) {		/* send ack */
+		temp++;
+		count--;
+
+		if (msg->flags & I2C_M_NO_RD_ACK)
+			continue;
+
+		if ( count > 0 ) {		/* send ack */
 			sdalo(adap);
 			DEBPROTO(printk(" Am "));
 		} else {
@@ -395,8 +401,6 @@
 		};
 		scllo(adap);
 		sdahi(adap);
-		temp++;
-		count--;
 	}
 	return rdcount;
 }
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig	Tue Jun 15 22:20:44 2004
+++ b/drivers/i2c/busses/Kconfig	Tue Jun 15 22:20:44 2004
@@ -95,6 +95,8 @@
 	    82801CA/CAM
 	    82801DB
 	    82801EB
+	    6300ESB
+	    ICH6
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-i801.
@@ -116,8 +118,14 @@
 	  will be called i2c-i810.
 
 config I2C_IBM_IIC
-	tristate "IBM IIC I2C"
+	tristate "IBM PPC 4xx on-chip I2C interface"
 	depends on IBM_OCP && I2C
+	help
+	  Say Y here if you want to use IIC peripheral found on 
+	  embedded IBM PPC 4xx based systems. 
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-ibm_iic.
 
 config I2C_IOP3XX
 	tristate "Intel XScale IOP3xx on-chip I2C interface"
@@ -145,16 +153,16 @@
 	  This support is also available as a module.  If so, the module 
 	  will be called i2c-ite.
 
-config I2C_IXP42X
-	tristate "IXP42x GPIO-Based I2C Interface"
-	depends on I2C && ARCH_IXP425
+config I2C_IXP4XX
+	tristate "IXP4xx GPIO-Based I2C Interface"
+	depends on I2C && ARCH_IXP4XX
 	select I2C_ALGOBIT
 	help
-	  Say Y here if you have an Intel IXP42x(420,421,422,425) based 
+	  Say Y here if you have an Intel IXP4xx(420,421,422,425) based 
 	  system and are using GPIO lines for an I2C bus.
 
 	  This support is also available as a module. If so, the module
-	  will be called i2c-ixp42x.
+	  will be called i2c-ixp4xx.
 
 config I2C_KEYWEST
 	tristate "Powermac Keywest I2C interface"
diff -Nru a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
--- a/drivers/i2c/busses/Makefile	Tue Jun 15 22:20:36 2004
+++ b/drivers/i2c/busses/Makefile	Tue Jun 15 22:20:36 2004
@@ -15,7 +15,7 @@
 obj-$(CONFIG_I2C_IOP3XX)	+= i2c-iop3xx.o
 obj-$(CONFIG_I2C_ISA)		+= i2c-isa.o
 obj-$(CONFIG_I2C_ITE)		+= i2c-ite.o
-obj-$(CONFIG_I2C_IXP42X)	+= i2c-ixp42x.o
+obj-$(CONFIG_I2C_IXP4XX)	+= i2c-ixp4xx.o
 obj-$(CONFIG_I2C_KEYWEST)	+= i2c-keywest.o
 obj-$(CONFIG_I2C_NFORCE2)	+= i2c-nforce2.o
 obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
diff -Nru a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
--- a/drivers/i2c/busses/i2c-ali1535.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/i2c/busses/i2c-ali1535.c	Tue Jun 15 22:20:44 2004
@@ -59,6 +59,7 @@
 #include <linux/kernel.h>
 #include <linux/stddef.h>
 #include <linux/sched.h>
+#include <linux/delay.h>
 #include <linux/ioport.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
@@ -276,7 +277,7 @@
 	/* We will always wait for a fraction of a second! */
 	timeout = 0;
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = inb_p(SMBHSTSTS);
 	} while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
 		 && (timeout++ < MAX_TIMEOUT));
@@ -350,7 +351,7 @@
 	for (timeout = 0;
 	     (timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
 	     timeout++) {
-		i2c_delay(1);
+		msleep(1);
 		temp = inb_p(SMBHSTSTS);
 	}
 	if (timeout >= MAX_TIMEOUT)
@@ -480,7 +481,7 @@
 
 static struct i2c_adapter ali1535_adapter = {
 	.owner		= THIS_MODULE,
-	.class          = I2C_ADAP_CLASS_SMBUS,
+	.class          = I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
 	.name		= "unset",
 };
diff -Nru a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c
--- a/drivers/i2c/busses/i2c-ali1563.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/i2c/busses/i2c-ali1563.c	Tue Jun 15 22:20:42 2004
@@ -16,6 +16,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/pci.h>
 #include <linux/init.h>
@@ -82,7 +83,7 @@
 
 	timeout = ALI1563_MAX_TIMEOUT;
 	do
-		i2c_delay(1);
+		msleep(1);
 	while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout);
 
 	dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, "
@@ -137,7 +138,7 @@
 
 	timeout = ALI1563_MAX_TIMEOUT;
 	do
-		i2c_delay(1);
+		msleep(1);
 	while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout);
 
 	dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, "
@@ -357,7 +358,7 @@
 
 static struct i2c_adapter ali1563_adapter = {
 	.owner	= THIS_MODULE,
-	.class	= I2C_ADAP_CLASS_SMBUS,
+	.class	= I2C_CLASS_HWMON,
 	.algo	= &ali1563_algorithm,
 };
 
diff -Nru a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
--- a/drivers/i2c/busses/i2c-ali15x3.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/i2c/busses/i2c-ali15x3.c	Tue Jun 15 22:20:40 2004
@@ -67,6 +67,7 @@
 #include <linux/stddef.h>
 #include <linux/sched.h>
 #include <linux/ioport.h>
+#include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <asm/io.h>
@@ -296,7 +297,7 @@
 	/* We will always wait for a fraction of a second! */
 	timeout = 0;
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = inb_p(SMBHSTSTS);
 	} while ((!(temp & (ALI15X3_STS_ERR | ALI15X3_STS_DONE)))
 		 && (timeout++ < MAX_TIMEOUT));
@@ -353,7 +354,7 @@
 	for (timeout = 0;
 	     (timeout < MAX_TIMEOUT) && !(temp & ALI15X3_STS_IDLE);
 	     timeout++) {
-		i2c_delay(1);
+		msleep(1);
 		temp = inb_p(SMBHSTSTS);
 	}
 	if (timeout >= MAX_TIMEOUT) {
@@ -470,7 +471,7 @@
 
 static struct i2c_adapter ali15x3_adapter = {
 	.owner		= THIS_MODULE,
-	.class          = I2C_ADAP_CLASS_SMBUS,
+	.class          = I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
 	.name		= "unset",
 };
diff -Nru a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
--- a/drivers/i2c/busses/i2c-amd756.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/i2c/busses/i2c-amd756.c	Tue Jun 15 22:20:44 2004
@@ -41,6 +41,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
+#include <linux/delay.h>
 #include <linux/stddef.h>
 #include <linux/sched.h>
 #include <linux/ioport.h>
@@ -124,7 +125,7 @@
 	if ((temp = inw_p(SMB_GLOBAL_STATUS)) & (GS_HST_STS | GS_SMB_STS)) {
 		dev_dbg(&adap->dev, ": SMBus busy (%04x). Waiting... \n", temp);
 		do {
-			i2c_delay(1);
+			msleep(1);
 			temp = inw_p(SMB_GLOBAL_STATUS);
 		} while ((temp & (GS_HST_STS | GS_SMB_STS)) &&
 		         (timeout++ < MAX_TIMEOUT));
@@ -141,7 +142,7 @@
 
 	/* We will always wait for a fraction of a second! */
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = inw_p(SMB_GLOBAL_STATUS);
 	} while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT));
 
@@ -188,7 +189,7 @@
  abort:
 	dev_warn(&adap->dev, ": Sending abort.\n");
 	outw_p(inw(SMB_GLOBAL_ENABLE) | GE_ABORT, SMB_GLOBAL_ENABLE);
-	i2c_delay(100);
+	msleep(100);
 	outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS);
 	return -1;
 }
@@ -303,7 +304,7 @@
 
 static struct i2c_adapter amd756_adapter = {
 	.owner		= THIS_MODULE,
-	.class          = I2C_ADAP_CLASS_SMBUS,
+	.class          = I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
 	.name		= "unset",
 };
diff -Nru a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
--- a/drivers/i2c/busses/i2c-amd8111.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/i2c/busses/i2c-amd8111.c	Tue Jun 15 22:20:44 2004
@@ -276,7 +276,7 @@
 	}
 
 	if (~temp[0] & AMD_SMB_STS_DONE) {
-		i2c_delay(HZ/100);
+		msleep(1);
 		amd_ec_read(smbus, AMD_SMB_STS, temp + 0);
 	}
 
@@ -359,7 +359,7 @@
 	smbus->adapter.owner = THIS_MODULE;
 	snprintf(smbus->adapter.name, I2C_NAME_SIZE,
 		"SMBus2 AMD8111 adapter at %04x", smbus->base);
-	smbus->adapter.class = I2C_ADAP_CLASS_SMBUS;
+	smbus->adapter.class = I2C_CLASS_HWMON;
 	smbus->adapter.algo = &smbus_algorithm;
 	smbus->adapter.algo_data = smbus;
 
diff -Nru a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
--- a/drivers/i2c/busses/i2c-i801.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/i2c/busses/i2c-i801.c	Tue Jun 15 22:20:40 2004
@@ -28,7 +28,8 @@
     82801CA/CAM		2483           
     82801DB		24C3   (HW PEC supported, 32 byte buffer not supported)
     82801EB		24D3   (HW PEC supported, 32 byte buffer not supported)
-
+    6300ESB		25A4
+    ICH6		266A
     This driver supports several versions of Intel's I/O Controller Hubs (ICH).
     For SMBus support, they are similar to the PIIX4 and are part
     of Intel's '810' and other chipsets.
@@ -43,6 +44,7 @@
 #include <linux/pci.h>
 #include <linux/kernel.h>
 #include <linux/stddef.h>
+#include <linux/delay.h>
 #include <linux/sched.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
@@ -121,7 +123,8 @@
 
 	I801_dev = dev;
 	if ((dev->device == PCI_DEVICE_ID_INTEL_82801DB_3) ||
-	    (dev->device == PCI_DEVICE_ID_INTEL_82801EB_3))
+	    (dev->device == PCI_DEVICE_ID_INTEL_82801EB_3) ||
+	    (dev->device == PCI_DEVICE_ID_INTEL_ESB_4))
 		isich4 = 1;
 	else
 		isich4 = 0;
@@ -205,7 +208,7 @@
 
 	/* We will always wait for a fraction of a second! */
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = inb_p(SMBHSTSTS);
 	} while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT));
 
@@ -333,7 +336,7 @@
 		timeout = 0;
 		do {
 			temp = inb_p(SMBHSTSTS);
-			i2c_delay(1);
+			msleep(1);
 		}
 		    while ((!(temp & 0x80))
 			   && (timeout++ < MAX_TIMEOUT));
@@ -393,7 +396,7 @@
 		timeout = 0;
 		do {
 			temp = inb_p(SMBHSTSTS);
-			i2c_delay(1);
+			msleep(1);
 		} while ((!(temp & 0x02))
 			   && (timeout++ < MAX_TIMEOUT));
 
@@ -539,7 +542,7 @@
 
 static struct i2c_adapter i801_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_SMBUS,
+	.class		= I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
 	.name		= "unset",
 };
@@ -576,10 +579,22 @@
 		.subdevice =	PCI_ANY_ID,
 	},
 	{
-		.vendor =   PCI_VENDOR_ID_INTEL,
-		.device =   PCI_DEVICE_ID_INTEL_82801EB_3,
-		.subvendor =    PCI_ANY_ID,
-		.subdevice =    PCI_ANY_ID,
+		.vendor =	PCI_VENDOR_ID_INTEL,
+		.device =	PCI_DEVICE_ID_INTEL_82801EB_3,
+		.subvendor =	PCI_ANY_ID,
+		.subdevice =	PCI_ANY_ID,
+	},
+	{
+		.vendor =	PCI_VENDOR_ID_INTEL,
+		.device =	PCI_DEVICE_ID_INTEL_ESB_4,
+		.subvendor =	PCI_ANY_ID,
+		.subdevice = 	PCI_ANY_ID,
+	},
+	{
+		.vendor =	PCI_VENDOR_ID_INTEL,
+		.device =	PCI_DEVICE_ID_INTEL_ICH6_16,
+		.subvendor =	PCI_ANY_ID,
+		.subdevice =	PCI_ANY_ID,
 	},
 	{ 0, }
 };
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	Tue Jun 15 22:20:43 2004
+++ b/drivers/i2c/busses/i2c-ibm_iic.c	Tue Jun 15 22:20:43 2004
@@ -3,7 +3,7 @@
  *
  * Support for the IIC peripheral on IBM PPC 4xx
  *
- * Copyright (c) 2003 Zultys Technologies.
+ * Copyright (c) 2003, 2004 Zultys Technologies.
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  *
  * Based on original work by 
@@ -45,7 +45,7 @@
 
 #include "i2c-ibm_iic.h"
 
-#define DRIVER_VERSION "2.0"
+#define DRIVER_VERSION "2.01"
 
 MODULE_DESCRIPTION("IBM IIC driver v" DRIVER_VERSION);
 MODULE_LICENSE("GPL");
@@ -69,14 +69,14 @@
 #endif
 
 #if DBG_LEVEL > 0
-#  define DBG(x...)	printk(KERN_DEBUG "ibm-iic" ##x)
+#  define DBG(f,x...)	printk(KERN_DEBUG "ibm-iic" f, ##x)
 #else
-#  define DBG(x...)	((void)0)
+#  define DBG(f,x...)	((void)0)
 #endif
 #if DBG_LEVEL > 1
-#  define DBG2(x...) 	DBG( ##x )
+#  define DBG2(f,x...) 	DBG(f, ##x)
 #else
-#  define DBG2(x...) 	((void)0)
+#  define DBG2(f,x...) 	((void)0)
 #endif
 #if DBG_LEVEL > 2
 static void dump_iic_regs(const char* header, struct ibm_iic_private* dev)
@@ -455,6 +455,16 @@
 	}		
 	for (i = 0; i < num; ++i){
 		if (unlikely(msgs[i].len <= 0)){
+			if (num == 1 && !msgs[0].len){
+				/* Special case for I2C_SMBUS_QUICK emulation.
+				 * Although this logic is FAR FROM PERFECT, this 
+				 * is what previous driver version did.
+				 * IBM IIC doesn't support 0-length transactions
+				 * (except bit-banging through IICx_DIRECTCNTL).
+				 */
+				DBG("%d: zero-length msg kludge\n", dev->idx); 
+				return 0;
+			}
 			DBG("%d: invalid len %d in msg[%d]\n", dev->idx, 
 				msgs[i].len, i);
 			return -EINVAL;
@@ -549,19 +559,24 @@
 
 	struct ibm_iic_private* dev;
 	struct i2c_adapter* adap;
+	struct ocp_func_iic_data* iic_data = ocp->def->additions;
 	int ret;
-	bd_t* bd = (bd_t*)&__res;
 	
+	if (!iic_data)
+		printk(KERN_WARNING"ibm-iic%d: missing additional data!\n",
+			ocp->def->index);
+
 	if (!(dev = kmalloc(sizeof(*dev), GFP_KERNEL))){
-		printk(KERN_CRIT "ibm-iic: failed to allocate device data\n");
+		printk(KERN_CRIT "ibm-iic%d: failed to allocate device data\n",
+			ocp->def->index);
 		return -ENOMEM;
 	}
 
 	memset(dev, 0, sizeof(*dev));
-	dev->idx = ocp->num;
+	dev->idx = ocp->def->index;
 	ocp_set_drvdata(ocp, dev);
 	
-	if (!(dev->vaddr = ioremap(ocp->paddr, sizeof(struct iic_regs)))){
+	if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){
 		printk(KERN_CRIT "ibm-iic%d: failed to ioremap device registers\n",
 			dev->idx);
 		ret = -ENXIO;
@@ -570,7 +585,7 @@
 	
 	init_waitqueue_head(&dev->wq);
 
-	dev->irq = iic_force_poll ? -1 : ocp->irq;
+	dev->irq = iic_force_poll ? -1 : ocp->def->irq;
 	if (dev->irq >= 0){
 		/* Disable interrupts until we finish intialization,
 		   assumes level-sensitive IRQ setup...
@@ -589,13 +604,12 @@
 			dev->idx);
 		
 	/* Board specific settings */
-	BUG_ON(dev->idx >= sizeof(bd->bi_iic_fast) / sizeof(bd->bi_iic_fast[0]));
-	dev->fast_mode = iic_force_fast ? 1 : bd->bi_iic_fast[dev->idx];
+	dev->fast_mode = iic_force_fast ? 1 : (iic_data ? iic_data->fast_mode : 0);
 	
 	/* clckdiv is the same for *all* IIC interfaces, 
 	 * but I'd rather make a copy than introduce another global. --ebs
 	 */
-	dev->clckdiv = iic_clckdiv(bd->bi_opb_busfreq);
+	dev->clckdiv = iic_clckdiv(ocp_sys_info.opb_bus_freq);
 	DBG("%d: clckdiv = %d\n", dev->idx, dev->clckdiv);
 	
 	/* Initialize IIC interface */
@@ -664,7 +678,7 @@
 
 static struct ocp_device_id ibm_iic_ids[] __devinitdata = 
 {
-	{ .vendor = OCP_VENDOR_IBM, .device = OCP_FUNC_IIC },
+	{ .vendor = OCP_VENDOR_IBM, .function = OCP_FUNC_IIC },
 	{ .vendor = OCP_VENDOR_INVALID }
 };
 
@@ -672,7 +686,7 @@
 
 static struct ocp_driver ibm_iic_driver =
 {
-	.name 		= "ocp_iic",
+	.name 		= "iic",
 	.id_table	= ibm_iic_ids,
 	.probe		= iic_probe,
 	.remove		= __devexit_p(iic_remove),
@@ -685,7 +699,7 @@
 static int __init iic_init(void)
 {
 	printk(KERN_INFO "IBM IIC driver v" DRIVER_VERSION "\n");
-	return ocp_module_init(&ibm_iic_driver);
+	return ocp_register_driver(&ibm_iic_driver);
 }
 
 static void __exit iic_exit(void)
diff -Nru a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c
--- a/drivers/i2c/busses/i2c-isa.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/i2c/busses/i2c-isa.c	Tue Jun 15 22:20:41 2004
@@ -43,7 +43,7 @@
 /* There can only be one... */
 static struct i2c_adapter isa_adapter = {
 	.owner		= THIS_MODULE,
-	.class          = I2C_ADAP_CLASS_SMBUS,
+	.class          = I2C_CLASS_HWMON,
 	.algo		= &isa_algorithm,
 	.name		= "ISA main adapter",
 };
diff -Nru a/drivers/i2c/busses/i2c-ixp42x.c b/drivers/i2c/busses/i2c-ixp42x.c
--- a/drivers/i2c/busses/i2c-ixp42x.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,176 +0,0 @@
-/*
- * drivers/i2c/i2c-adap-ixp42x.c
- *
- * Intel's IXP42x XScale NPU chipsets (IXP420, 421, 422, 425) do not have
- * an on board I2C controller but provide 16 GPIO pins that are often
- * used to create an I2C bus. This driver provides an i2c_adapter 
- * interface that plugs in under algo_bit and drives the GPIO pins
- * as instructed by the alogorithm driver.
- *
- * Author: Deepak Saxena <dsaxena@plexity.net>
- *
- * Copyright (c) 2003-2004 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.
- *
- * NOTE: Since different platforms will use different GPIO pins for
- *       I2C, this driver uses an IXP42x-specific platform_data
- *       pointer to pass the GPIO numbers to the driver. This 
- *       allows us to support all the different IXP42x platforms
- *       w/o having to put #ifdefs in this driver.
- *
- *       See arch/arm/mach-ixp42x/ixdp425.c for an example of building a 
- *       device list and filling in the ixp42x_i2c_pins data structure 
- *       that is passed as the platform_data to this driver.
- */
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/module.h>
-#include <linux/i2c.h>
-
-#include <asm/hardware.h>	/* Pick up IXP42x-specific bits */
-
-static inline int ixp42x_scl_pin(void *data)
-{
-	return ((struct ixp42x_i2c_pins*)data)->scl_pin;
-}
-
-static inline int ixp42x_sda_pin(void *data)
-{
-	return ((struct ixp42x_i2c_pins*)data)->sda_pin;
-}
-
-static void ixp42x_bit_setscl(void *data, int val)
-{
-	gpio_line_set(ixp42x_scl_pin(data), 0);
-	gpio_line_config(ixp42x_scl_pin(data),
-		val ? IXP425_GPIO_IN : IXP425_GPIO_OUT );
-}
-
-static void ixp42x_bit_setsda(void *data, int val)
-{
-	gpio_line_set(ixp42x_sda_pin(data), 0);
-	gpio_line_config(ixp42x_sda_pin(data),
-		val ? IXP425_GPIO_IN : IXP425_GPIO_OUT );
-}
-
-static int ixp42x_bit_getscl(void *data)
-{
-	int scl;
-
-	gpio_line_config(ixp42x_scl_pin(data), IXP425_GPIO_IN );
-	gpio_line_get(ixp42x_scl_pin(data), &scl);
-
-	return scl;
-}	
-
-static int ixp42x_bit_getsda(void *data)
-{
-	int sda;
-
-	gpio_line_config(ixp42x_sda_pin(data), IXP425_GPIO_IN );
-	gpio_line_get(ixp42x_sda_pin(data), &sda);
-
-	return sda;
-}	
-
-struct ixp42x_i2c_data {
-	struct ixp42x_i2c_pins *gpio_pins;
-	struct i2c_adapter adapter;
-	struct i2c_algo_bit_data algo_data;
-};
-
-static int ixp42x_i2c_remove(struct device *dev)
-{
-	struct platform_device *plat_dev = to_platform_device(dev);
-	struct ixp42x_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev);
-
-	dev_set_drvdata(&plat_dev->dev, NULL);
-
-	i2c_bit_del_bus(&drv_data->adapter);
-
-	kfree(drv_data);
-
-	return 0;
-}
-
-static int ixp42x_i2c_probe(struct device *dev)
-{
-	int err;
-	struct platform_device *plat_dev = to_platform_device(dev);
-	struct ixp42x_i2c_pins *gpio = plat_dev->dev.platform_data;
-	struct ixp42x_i2c_data *drv_data = 
-		kmalloc(sizeof(struct ixp42x_i2c_data), GFP_KERNEL);
-
-	if(!drv_data)
-		return -ENOMEM;
-
-	memzero(drv_data, sizeof(struct ixp42x_i2c_data));
-	drv_data->gpio_pins = gpio;
-
-	/*
-	 * We could make a lot of these structures static, but
-	 * certain platforms may have multiple GPIO-based I2C
-	 * buses for various device domains, so we need per-device
-	 * algo_data->data. 
-	 */
-	drv_data->algo_data.data = gpio;
-	drv_data->algo_data.setsda = ixp42x_bit_setsda;
-	drv_data->algo_data.setscl = ixp42x_bit_setscl;
-	drv_data->algo_data.getsda = ixp42x_bit_getsda;
-	drv_data->algo_data.getscl = ixp42x_bit_getscl;
-	drv_data->algo_data.udelay = 10;
-	drv_data->algo_data.mdelay = 10;
-	drv_data->algo_data.timeout = 100;
-
-	drv_data->adapter.id = I2C_HW_B_IXP425,
-	drv_data->adapter.algo_data = &drv_data->algo_data,
-
-	drv_data->adapter.dev.parent = &plat_dev->dev;
-
-	gpio_line_config(gpio->scl_pin, IXP425_GPIO_IN);
-	gpio_line_config(gpio->sda_pin, IXP425_GPIO_IN);
-	gpio_line_set(gpio->scl_pin, 0);
-	gpio_line_set(gpio->sda_pin, 0);
-
-	if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) {
-		printk(KERN_ERR "ERROR: Could not install %s\n", dev->bus_id);
-
-		kfree(drv_data);
-		return err;
-	}
-
-	dev_set_drvdata(&plat_dev->dev, drv_data);
-
-	return 0;
-}
-
-static struct device_driver ixp42x_i2c_driver = {
-	.name		= "IXP42X-I2C",
-	.bus		= &platform_bus_type,
-	.probe		= ixp42x_i2c_probe,
-	.remove		= ixp42x_i2c_remove,
-};
-
-static int __init ixp42x_i2c_init(void)
-{
-	return driver_register(&ixp42x_i2c_driver);
-}
-
-static void __exit ixp42x_i2c_exit(void)
-{
-	driver_unregister(&ixp42x_i2c_driver);
-}
-
-module_init(ixp42x_i2c_init);
-module_exit(ixp42x_i2c_exit);
-
-MODULE_DESCRIPTION("GPIO-based I2C driver for IXP42x systems");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>");
-
diff -Nru a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/busses/i2c-ixp4xx.c	Tue Jun 15 22:20:41 2004
@@ -0,0 +1,181 @@
+/*
+ * drivers/i2c/i2c-adap-ixp4xx.c
+ *
+ * Intel's IXP4xx XScale NPU chipsets (IXP420, 421, 422, 425) do not have
+ * an on board I2C controller but provide 16 GPIO pins that are often
+ * used to create an I2C bus. This driver provides an i2c_adapter 
+ * interface that plugs in under algo_bit and drives the GPIO pins
+ * as instructed by the alogorithm driver.
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright (c) 2003-2004 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.
+ *
+ * NOTE: Since different platforms will use different GPIO pins for
+ *       I2C, this driver uses an IXP4xx-specific platform_data
+ *       pointer to pass the GPIO numbers to the driver. This 
+ *       allows us to support all the different IXP4xx platforms
+ *       w/o having to put #ifdefs in this driver.
+ *
+ *       See arch/arm/mach-ixp4xx/ixdp425.c for an example of building a 
+ *       device list and filling in the ixp4xx_i2c_pins data structure 
+ *       that is passed as the platform_data to this driver.
+ */
+
+#include <linux/config.h>
+#ifdef CONFIG_I2C_DEBUG_BUS
+#define DEBUG	1
+#endif
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/i2c-algo-bit.h>
+
+#include <asm/hardware.h>	/* Pick up IXP4xx-specific bits */
+
+static inline int ixp4xx_scl_pin(void *data)
+{
+	return ((struct ixp4xx_i2c_pins*)data)->scl_pin;
+}
+
+static inline int ixp4xx_sda_pin(void *data)
+{
+	return ((struct ixp4xx_i2c_pins*)data)->sda_pin;
+}
+
+static void ixp4xx_bit_setscl(void *data, int val)
+{
+	gpio_line_set(ixp4xx_scl_pin(data), 0);
+	gpio_line_config(ixp4xx_scl_pin(data),
+		val ? IXP4XX_GPIO_IN : IXP4XX_GPIO_OUT );
+}
+
+static void ixp4xx_bit_setsda(void *data, int val)
+{
+	gpio_line_set(ixp4xx_sda_pin(data), 0);
+	gpio_line_config(ixp4xx_sda_pin(data),
+		val ? IXP4XX_GPIO_IN : IXP4XX_GPIO_OUT );
+}
+
+static int ixp4xx_bit_getscl(void *data)
+{
+	int scl;
+
+	gpio_line_config(ixp4xx_scl_pin(data), IXP4XX_GPIO_IN );
+	gpio_line_get(ixp4xx_scl_pin(data), &scl);
+
+	return scl;
+}	
+
+static int ixp4xx_bit_getsda(void *data)
+{
+	int sda;
+
+	gpio_line_config(ixp4xx_sda_pin(data), IXP4XX_GPIO_IN );
+	gpio_line_get(ixp4xx_sda_pin(data), &sda);
+
+	return sda;
+}	
+
+struct ixp4xx_i2c_data {
+	struct ixp4xx_i2c_pins *gpio_pins;
+	struct i2c_adapter adapter;
+	struct i2c_algo_bit_data algo_data;
+};
+
+static int ixp4xx_i2c_remove(struct device *dev)
+{
+	struct platform_device *plat_dev = to_platform_device(dev);
+	struct ixp4xx_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev);
+
+	dev_set_drvdata(&plat_dev->dev, NULL);
+
+	i2c_bit_del_bus(&drv_data->adapter);
+
+	kfree(drv_data);
+
+	return 0;
+}
+
+static int ixp4xx_i2c_probe(struct device *dev)
+{
+	int err;
+	struct platform_device *plat_dev = to_platform_device(dev);
+	struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data;
+	struct ixp4xx_i2c_data *drv_data = 
+		kmalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL);
+
+	if(!drv_data)
+		return -ENOMEM;
+
+	memzero(drv_data, sizeof(struct ixp4xx_i2c_data));
+	drv_data->gpio_pins = gpio;
+
+	/*
+	 * We could make a lot of these structures static, but
+	 * certain platforms may have multiple GPIO-based I2C
+	 * buses for various device domains, so we need per-device
+	 * algo_data->data. 
+	 */
+	drv_data->algo_data.data = gpio;
+	drv_data->algo_data.setsda = ixp4xx_bit_setsda;
+	drv_data->algo_data.setscl = ixp4xx_bit_setscl;
+	drv_data->algo_data.getsda = ixp4xx_bit_getsda;
+	drv_data->algo_data.getscl = ixp4xx_bit_getscl;
+	drv_data->algo_data.udelay = 10;
+	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.dev.parent = &plat_dev->dev;
+
+	gpio_line_config(gpio->scl_pin, IXP4XX_GPIO_IN);
+	gpio_line_config(gpio->sda_pin, IXP4XX_GPIO_IN);
+	gpio_line_set(gpio->scl_pin, 0);
+	gpio_line_set(gpio->sda_pin, 0);
+
+	if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) {
+		printk(KERN_ERR "ERROR: Could not install %s\n", dev->bus_id);
+
+		kfree(drv_data);
+		return err;
+	}
+
+	dev_set_drvdata(&plat_dev->dev, drv_data);
+
+	return 0;
+}
+
+static struct device_driver ixp4xx_i2c_driver = {
+	.name		= "IXP4XX-I2C",
+	.bus		= &platform_bus_type,
+	.probe		= ixp4xx_i2c_probe,
+	.remove		= ixp4xx_i2c_remove,
+};
+
+static int __init ixp4xx_i2c_init(void)
+{
+	return driver_register(&ixp4xx_i2c_driver);
+}
+
+static void __exit ixp4xx_i2c_exit(void)
+{
+	driver_unregister(&ixp4xx_i2c_driver);
+}
+
+module_init(ixp4xx_i2c_init);
+module_exit(ixp4xx_i2c_exit);
+
+MODULE_DESCRIPTION("GPIO-based I2C adapter for IXP4xx systems");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>");
+
diff -Nru a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c
--- a/drivers/i2c/busses/i2c-keywest.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/i2c/busses/i2c-keywest.c	Tue Jun 15 22:20:42 2004
@@ -48,7 +48,6 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
diff -Nru a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
--- a/drivers/i2c/busses/i2c-nforce2.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/i2c/busses/i2c-nforce2.c	Tue Jun 15 22:20:37 2004
@@ -119,7 +119,7 @@
 
 static struct i2c_adapter nforce2_adapter = {
 	.owner          = THIS_MODULE,
-	.class          = I2C_ADAP_CLASS_SMBUS,
+	.class          = I2C_CLASS_HWMON,
 	.algo           = &smbus_algorithm,
 	.name   	= "unset",
 };
diff -Nru a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
--- a/drivers/i2c/busses/i2c-parport-light.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/i2c/busses/i2c-parport-light.c	Tue Jun 15 22:20:43 2004
@@ -112,7 +112,7 @@
 
 static struct i2c_adapter parport_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_SMBUS,
+	.class		= I2C_CLASS_HWMON,
 	.id		= I2C_HW_B_LP,
 	.algo_data	= &parport_algo_data,
 	.name		= "Parallel port adapter (light)",
diff -Nru a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
--- a/drivers/i2c/busses/i2c-parport.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/i2c/busses/i2c-parport.c	Tue Jun 15 22:20:41 2004
@@ -147,7 +147,7 @@
 
 static struct i2c_adapter parport_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_SMBUS,
+	.class		= I2C_CLASS_HWMON,
 	.id		= I2C_HW_B_LP,
 	.name		= "Parallel port adapter",
 };
diff -Nru a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h
--- a/drivers/i2c/busses/i2c-parport.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/i2c/busses/i2c-parport.h	Tue Jun 15 22:21:05 2004
@@ -67,13 +67,18 @@
 		.getsda	= { 0x40, STAT, 1 },
 		.getscl	= { 0x08, STAT, 1 },
 	},
-	/* type 4: ADM1025 and ADM1032 evaluation boards */
+	/* type 4: ADM1032 evaluation board */
+	{
+		.setsda	= { 0x02, DATA, 1 },
+		.setscl	= { 0x01, DATA, 1 },
+		.getsda	= { 0x10, STAT, 1 },
+		.init	= { 0xf0, DATA, 0 },
+	},
+	/* type 5: ADM1025, ADM1030 and ADM1031 evaluation boards */
 	{
 		.setsda	= { 0x02, DATA, 1 },
 		.setscl	= { 0x01, DATA, 1 },
 		.getsda	= { 0x10, STAT, 1 },
-		.init	= { 0xf0, DATA, 0 }, /* ADM1025 doesn't need this,
-						but it doesn't hurt */
 	},
 };
 
@@ -85,4 +90,5 @@
 	" 1 = home brew teletext adapter\n"
 	" 2 = Velleman K8000 adapter\n"
 	" 3 = ELV adapter\n"
-	" 4 = ADM1025 and ADM1032 evaluation boards\n");
+	" 4 = ADM1032 evaluation board\n"
+	" 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n");
diff -Nru a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
--- a/drivers/i2c/busses/i2c-piix4.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/i2c/busses/i2c-piix4.c	Tue Jun 15 22:20:38 2004
@@ -31,9 +31,9 @@
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/config.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
+#include <linux/delay.h>
 #include <linux/stddef.h>
 #include <linux/sched.h>
 #include <linux/ioport.h>
@@ -261,7 +261,7 @@
 
 	/* We will always wait for a fraction of a second! (See PIIX4 docs errata) */
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = inb_p(SMBHSTSTS);
 	} while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT));
 
@@ -410,7 +410,7 @@
 
 static struct i2c_adapter piix4_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_SMBUS,
+	.class		= I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
 	.name		= "unset",
 };
diff -Nru a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
--- a/drivers/i2c/busses/i2c-sis5595.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/i2c/busses/i2c-sis5595.c	Tue Jun 15 22:20:39 2004
@@ -58,6 +58,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/delay.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
@@ -239,7 +240,7 @@
 
 	/* We will always wait for a fraction of a second! */
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = sis5595_read(SMB_STS_LO);
 	} while (!(temp & 0x40) && (timeout++ < MAX_TIMEOUT));
 
@@ -360,7 +361,7 @@
 
 static struct i2c_adapter sis5595_adapter = {
 	.owner		= THIS_MODULE,
-	.class          = I2C_ADAP_CLASS_SMBUS,
+	.class          = I2C_CLASS_HWMON,
 	.name		= "unset",
 	.algo		= &smbus_algorithm,
 };
diff -Nru a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
--- a/drivers/i2c/busses/i2c-sis630.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/i2c/busses/i2c-sis630.c	Tue Jun 15 22:20:38 2004
@@ -51,6 +51,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/delay.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
@@ -165,7 +166,7 @@
 
 	/* We will always wait for a fraction of a second! */
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = sis630_read(SMB_STS);
 		/* check if block transmitted */
 		if (size == SIS630_BLOCK_DATA && (temp & 0x10))
@@ -456,7 +457,7 @@
 
 static struct i2c_adapter sis630_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_SMBUS,
+	.class		= I2C_CLASS_HWMON,
 	.name		= "unset",
 	.algo		= &smbus_algorithm,
 };
diff -Nru a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
--- a/drivers/i2c/busses/i2c-sis96x.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/i2c/busses/i2c-sis96x.c	Tue Jun 15 22:20:38 2004
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
+#include <linux/delay.h>
 #include <linux/stddef.h>
 #include <linux/sched.h>
 #include <linux/ioport.h>
@@ -139,7 +140,7 @@
 
 	/* We will always wait for a fraction of a second! */
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = sis96x_read(SMB_STS);
 	} while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT));
 
@@ -260,7 +261,7 @@
 
 static struct i2c_adapter sis96x_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_SMBUS,
+	.class		= I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
 	.name		= "unset",
 };
diff -Nru a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
--- a/drivers/i2c/busses/i2c-via.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/i2c/busses/i2c-via.c	Tue Jun 15 22:20:40 2004
@@ -88,7 +88,7 @@
 
 static struct i2c_adapter vt586b_adapter = {
 	.owner		= THIS_MODULE,
-	.class          = I2C_ADAP_CLASS_SMBUS,
+	.class          = I2C_CLASS_HWMON,
 	.name		= "VIA i2c",
 	.algo_data	= &bit_data,
 };
diff -Nru a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
--- a/drivers/i2c/busses/i2c-viapro.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/i2c/busses/i2c-viapro.c	Tue Jun 15 22:20:43 2004
@@ -35,6 +35,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/delay.h>
 #include <linux/pci.h>
 #include <linux/kernel.h>
 #include <linux/stddef.h>
@@ -138,7 +139,7 @@
 	/* We will always wait for a fraction of a second! 
 	   I don't know if VIA needs this, Intel did  */
 	do {
-		i2c_delay(1);
+		msleep(1);
 		temp = inb_p(SMBHSTSTS);
 	} while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT));
 
@@ -289,7 +290,7 @@
 
 static struct i2c_adapter vt596_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_SMBUS,
+	.class		= I2C_CLASS_HWMON,
 	.algo		= &smbus_algorithm,
 	.name		= "unset",
 };
diff -Nru a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c
--- a/drivers/i2c/busses/i2c-voodoo3.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/i2c/busses/i2c-voodoo3.c	Tue Jun 15 22:20:40 2004
@@ -167,7 +167,7 @@
 
 static struct i2c_adapter voodoo3_i2c_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_TV_ANALOG, 
+	.class		= I2C_CLASS_TV_ANALOG, 
 	.name		= "I2C Voodoo3/Banshee adapter",
 	.algo_data	= &voo_i2c_bit_data,
 };
@@ -184,7 +184,7 @@
 
 static struct i2c_adapter voodoo3_ddc_adapter = {
 	.owner		= THIS_MODULE,
-	.class		= I2C_ADAP_CLASS_DDC, 
+	.class		= I2C_CLASS_DDC, 
 	.name		= "DDC Voodoo3/Banshee adapter",
 	.algo_data	= &voo_ddc_bit_data,
 };
diff -Nru a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
--- a/drivers/i2c/busses/scx200_acb.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/i2c/busses/scx200_acb.c	Tue Jun 15 22:20:40 2004
@@ -25,7 +25,6 @@
 */
 
 #include <linux/config.h>
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -44,7 +43,7 @@
 MODULE_LICENSE("GPL");
 
 #define MAX_DEVICES 4
-static int base[MAX_DEVICES] = { 0x840 };
+static int base[MAX_DEVICES] = { 0x820, 0x840 };
 MODULE_PARM(base, "1-4i");
 MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
 
@@ -511,7 +510,10 @@
 	/* Verify that this really is a SCx200 processor */
 	if (pci_find_device(PCI_VENDOR_ID_NS,
 			    PCI_DEVICE_ID_NS_SCx200_BRIDGE,
-			    NULL) == NULL)
+			    NULL) == NULL
+	    && pci_find_device(PCI_VENDOR_ID_NS,
+			       PCI_DEVICE_ID_NS_SC1100_BRIDGE,
+			       NULL) == NULL)
 		return -ENODEV;
 
 	rc = -ENXIO;
diff -Nru a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c
--- a/drivers/i2c/busses/scx200_i2c.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/i2c/busses/scx200_i2c.c	Tue Jun 15 22:20:40 2004
@@ -22,7 +22,6 @@
 */
 
 #include <linux/config.h>
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig	Tue Jun 15 22:20:41 2004
+++ b/drivers/i2c/chips/Kconfig	Tue Jun 15 22:20:41 2004
@@ -136,15 +136,25 @@
 
 config SENSORS_LM90
 	tristate "National Semiconductor LM90 and compatibles"
-	depends on I2C && EXPERIMENTAL
+	depends on I2C
 	select I2C_SENSOR
 	help
-	  If you say yes here you get support for National Semiconductor LM90
-	  and Analog Devices ADM1032 sensor chips.
+	  If you say yes here you get support for National Semiconductor LM90,
+	  LM89 and LM99, and Analog Devices ADM1032 sensor chips.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called lm90.
 
+config SENSORS_MAX1619
+	tristate "Maxim MAX1619 sensor chip"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for MAX1619 sensor chip.
+	  
+	  This driver can also be built as a module.  If so, the module
+	  will be called max1619.
+
 config SENSORS_VIA686A
 	tristate "VIA686A"
 	depends on I2C && EXPERIMENTAL
@@ -163,7 +173,7 @@
 	select I2C_SENSOR
 	help
 	  If you say yes here you get support for the Winbond W8378x series
-	  of sensor chips: the W83781D, W83782D, W83783S and W83682HF,
+	  of sensor chips: the W83781D, W83782D, W83783S and W83627HF,
 	  and the similar Asus AS99127F.
 	  
 	  This driver can also be built as a module.  If so, the module
@@ -229,5 +239,15 @@
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called pcf8591.
+
+config SENSORS_RTC8564
+	tristate "Epson 8564 RTC chip"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for the Epson 8564 RTC chip.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-rtc8564.
 
 endmenu
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile	Tue Jun 15 22:21:05 2004
+++ b/drivers/i2c/chips/Makefile	Tue Jun 15 22:21:05 2004
@@ -19,8 +19,10 @@
 obj-$(CONFIG_SENSORS_LM83)	+= lm83.o
 obj-$(CONFIG_SENSORS_LM85)	+= lm85.o
 obj-$(CONFIG_SENSORS_LM90)	+= lm90.o
+obj-$(CONFIG_SENSORS_MAX1619)	+= max1619.o
 obj-$(CONFIG_SENSORS_PCF8574)	+= pcf8574.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
+obj-$(CONFIG_SENSORS_RTC8564)	+= rtc8564.o
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
 obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
 
diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/i2c/chips/adm1021.c	Tue Jun 15 22:20:36 2004
@@ -200,7 +200,7 @@
 
 static int adm1021_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, adm1021_detect);
 }
diff -Nru a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c
--- a/drivers/i2c/chips/asb100.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/i2c/chips/asb100.c	Tue Jun 15 22:20:41 2004
@@ -609,7 +609,7 @@
  */
 static int asb100_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, asb100_detect);
 }
@@ -855,7 +855,13 @@
 		return err;
 	}
 
-	kfree(i2c_get_clientdata(client));
+	if (i2c_get_clientdata(client)==NULL) {
+		/* subclients */
+		kfree(client);
+	} else {
+		/* main client */
+		kfree(i2c_get_clientdata(client));
+	}
 
 	return 0;
 }
diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
--- a/drivers/i2c/chips/eeprom.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/i2c/chips/eeprom.c	Tue Jun 15 22:20:39 2004
@@ -203,11 +203,12 @@
 	new_client->driver = &eeprom_driver;
 	new_client->flags = 0;
 
+	/* prevent 24RF08 corruption */
+	i2c_smbus_write_quick(new_client, 0);
+
 	/* Now, we do the remaining detection. It is not there, unless you force
 	   the checksum to work out. */
 	if (checksum) {
-		/* prevent 24RF08 corruption */
-		i2c_smbus_write_quick(new_client, 0);
 		cs = 0;
 		for (i = 0; i <= 0x3e; i++)
 			cs += i2c_smbus_read_byte_data(new_client, i);
diff -Nru a/drivers/i2c/chips/fscher.c b/drivers/i2c/chips/fscher.c
--- a/drivers/i2c/chips/fscher.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/i2c/chips/fscher.c	Tue Jun 15 22:20:40 2004
@@ -293,7 +293,7 @@
 
 static int fscher_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, fscher_detect);
 }
diff -Nru a/drivers/i2c/chips/gl518sm.c b/drivers/i2c/chips/gl518sm.c
--- a/drivers/i2c/chips/gl518sm.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/i2c/chips/gl518sm.c	Tue Jun 15 22:21:04 2004
@@ -335,7 +335,7 @@
 
 static int gl518_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, gl518_detect);
 }
diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/i2c/chips/it87.c	Tue Jun 15 22:20:43 2004
@@ -49,6 +49,54 @@
 /* Insmod parameters */
 SENSORS_INSMOD_1(it87);
 
+#define	REG	0x2e	/* The register to read/write */
+#define	DEV	0x07	/* Register: Logical device select */
+#define	VAL	0x2f	/* The value to read/write */
+#define PME	0x04	/* The device with the fan registers in it */
+#define	DEVID	0x20	/* Register: Device ID */
+
+static inline void
+superio_outb(int reg, int val)
+{
+	outb(reg, REG);
+	outb(val, VAL);
+}
+
+static inline int
+superio_inb(int reg)
+{
+	outb(reg, REG);
+	return inb(VAL);
+}
+
+static inline void
+superio_select(void)
+{
+	outb(DEV, REG);
+	outb(PME, VAL);
+}
+
+static inline void
+superio_enter(void)
+{
+	outb(0x87, REG);
+	outb(0x01, REG);
+	outb(0x55, REG);
+	outb(0x55, REG);
+}
+
+static inline void
+superio_exit(void)
+{
+	outb(0x02, REG);
+	outb(0x02, VAL);
+}
+
+/* just IT8712F for now - this should be extended to support the other
+   chips as well */
+#define IT8712F_DEVID 0x8712
+#define IT87_ACT_REG  0x30
+#define IT87_BASE_REG 0x60
 
 /* Update battery voltage after every reading if true */
 static int update_vbat;
@@ -158,6 +206,7 @@
 
 
 static int it87_attach_adapter(struct i2c_adapter *adapter);
+static int it87_find(int *address);
 static int it87_detect(struct i2c_adapter *adapter, int address, int kind);
 static int it87_detach_client(struct i2c_client *client);
 
@@ -500,11 +549,35 @@
      * when a new adapter is inserted (and it87_driver is still present) */
 static int it87_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, it87_detect);
 }
 
+/* SuperIO detection - will change normal_isa[0] if a chip is found */
+static int it87_find(int *address)
+{
+	u16 val;
+
+	superio_enter();
+	val = (superio_inb(DEVID) << 8) |
+	       superio_inb(DEVID + 1);
+	if (val != IT8712F_DEVID) {
+		superio_exit();
+		return -ENODEV;
+	}
+
+	superio_select();
+	val = (superio_inb(IT87_BASE_REG) << 8) |
+	       superio_inb(IT87_BASE_REG + 1);
+	superio_exit();
+	*address = val & ~(IT87_EXTENT - 1);
+	if (*address == 0) {
+		return -ENODEV;
+	}
+	return 0;
+}
+
 /* This function is called by i2c_detect */
 int it87_detect(struct i2c_adapter *adapter, int address, int kind)
 {
@@ -853,6 +926,11 @@
 
 static int __init sm_it87_init(void)
 {
+	int addr;
+
+	if (!it87_find(&addr)) {
+		normal_isa[0] = addr;
+	}
 	return i2c_add_driver(&it87_driver);
 }
 
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/i2c/chips/lm75.c	Tue Jun 15 22:20:35 2004
@@ -105,7 +105,7 @@
 
 static int lm75_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, lm75_detect);
 }
diff -Nru a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c
--- a/drivers/i2c/chips/lm78.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/i2c/chips/lm78.c	Tue Jun 15 22:20:44 2004
@@ -488,7 +488,7 @@
      * when a new adapter is inserted (and lm78_driver is still present) */
 static int lm78_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, lm78_detect);
 }
diff -Nru a/drivers/i2c/chips/lm80.c b/drivers/i2c/chips/lm80.c
--- a/drivers/i2c/chips/lm80.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/i2c/chips/lm80.c	Tue Jun 15 22:20:36 2004
@@ -376,7 +376,7 @@
 
 static int lm80_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, lm80_detect);
 }
diff -Nru a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
--- a/drivers/i2c/chips/lm83.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/i2c/chips/lm83.c	Tue Jun 15 22:20:39 2004
@@ -216,7 +216,7 @@
 
 static int lm83_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, lm83_detect);
 }
diff -Nru a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
--- a/drivers/i2c/chips/lm90.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/i2c/chips/lm90.c	Tue Jun 15 22:20:36 2004
@@ -1,7 +1,7 @@
 /*
  * lm90.c - Part of lm_sensors, Linux kernel modules for hardware
  *          monitoring
- * Copyright (C) 2003  Jean Delvare <khali@linux-fr.org>
+ * Copyright (C) 2003-2004  Jean Delvare <khali@linux-fr.org>
  *
  * Based on the lm83 driver. The LM90 is a sensor chip made by National
  * Semiconductor. It reports up to two temperatures (its own plus up to
@@ -10,6 +10,17 @@
  * obtained from National's website at:
  *   http://www.national.com/pf/LM/LM90.html
  *
+ * This driver also supports the LM89 and LM99, two other sensor chips
+ * made by National Semiconductor. Both have an increased remote
+ * temperature measurement accuracy (1 degree), and the LM99
+ * additionally shifts remote temperatures (measured and limits) by 16
+ * degrees, which allows for higher temperatures measurement. The
+ * driver doesn't handle it since it can be done easily in user-space.
+ * Complete datasheets can be obtained from National's website at:
+ *   http://www.national.com/pf/LM/LM89.html
+ *   http://www.national.com/pf/LM/LM99.html
+ * Note that there is no way to differenciate between both chips.
+ *
  * This driver also supports the ADM1032, a sensor chip made by Analog
  * Devices. That chip is similar to the LM90, with a few differences
  * that are not handled by this driver. Complete datasheet can be
@@ -45,9 +56,11 @@
 /*
  * Addresses to scan
  * Address is fully defined internally and cannot be changed.
+ * LM89, LM90, LM99 and ADM1032 have address 0x4c.
+ * LM89-1, and LM99-1 have address 0x4d.
  */
 
-static unsigned short normal_i2c[] = { 0x4c, I2C_CLIENT_END };
+static unsigned short normal_i2c[] = { 0x4c, 0x4d, I2C_CLIENT_END };
 static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
@@ -56,7 +69,7 @@
  * Insmod parameters
  */
 
-SENSORS_INSMOD_2(lm90, adm1032);
+SENSORS_INSMOD_3(lm90, adm1032, lm99);
 
 /*
  * The LM90 registers
@@ -261,7 +274,7 @@
 
 static int lm90_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, lm90_detect);
 }
@@ -330,16 +343,26 @@
 			  LM90_REG_R_CHIP_ID);
 		
 		if (man_id == 0x01) { /* National Semiconductor */
-			if (chip_id >= 0x21 && chip_id < 0x30 /* LM90 */
-			 && (kind == 0 /* skip detection */
-			  || ((i2c_smbus_read_byte_data(new_client,
-				LM90_REG_R_CONFIG2) & 0xF8) == 0x00
-			   && reg_convrate <= 0x09))) {
-				kind = lm90;
+			u8 reg_config2;
+
+			reg_config2 = i2c_smbus_read_byte_data(new_client,
+				      LM90_REG_R_CONFIG2);
+
+			if (kind == 0 /* skip detection */
+			 || ((reg_config2 & 0xF8) == 0x00
+			  && reg_convrate <= 0x09)) {
+				if (address == 0x4C
+				 && (chip_id & 0xF0) == 0x20) { /* LM90 */
+					kind = lm90;
+				} else
+				if ((chip_id & 0xF0) == 0x30) { /* LM89/LM99 */
+					kind = lm99;
+				}
 			}
-		}
-		else if (man_id == 0x41) { /* Analog Devices */
-			if ((chip_id & 0xF0) == 0x40 /* ADM1032 */
+		} else
+		if (man_id == 0x41) { /* Analog Devices */
+			if (address == 0x4C
+			 && (chip_id & 0xF0) == 0x40 /* ADM1032 */
 			 && (kind == 0 /* skip detection */
 			  || (reg_config1 & 0x3F) == 0x00)) {
 				kind = adm1032;
@@ -358,6 +381,8 @@
 		name = "lm90";
 	} else if (kind == adm1032) {
 		name = "adm1032";
+	} else if (kind == lm99) {
+		name = "lm99";
 	}
 
 	/* We can fill in the remaining client fields */
diff -Nru a/drivers/i2c/chips/max1619.c b/drivers/i2c/chips/max1619.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/chips/max1619.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,378 @@
+/*
+ * max1619.c - Part of lm_sensors, Linux kernel modules for hardware
+ *             monitoring
+ * Copyright (C) 2003-2004 Alexey Fisher <fishor@mail.ru>
+ *                         Jean Delvare <khali@linux-fr.org>
+ *
+ * Based on the lm90 driver. The MAX1619 is a sensor chip made by Maxim.
+ * It reports up to two temperatures (its own plus up to
+ * one external one). Complete datasheet can be
+ * obtained from Maxim's website at:
+ *   http://pdfserv.maxim-ic.com/en/ds/MAX1619.pdf
+ *
+ * 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/config.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+
+
+static unsigned short normal_i2c[] = { I2C_CLIENT_END };
+static unsigned short normal_i2c_range[] = { 0x18, 0x1a, 0x29, 0x2b,
+						0x4c, 0x4e, I2C_CLIENT_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
+
+/*
+ * Insmod parameters
+ */
+
+SENSORS_INSMOD_1(max1619);
+
+/*
+ * The MAX1619 registers
+ */
+
+#define MAX1619_REG_R_MAN_ID		0xFE
+#define MAX1619_REG_R_CHIP_ID		0xFF
+#define MAX1619_REG_R_CONFIG		0x03
+#define MAX1619_REG_W_CONFIG		0x09
+#define MAX1619_REG_R_CONVRATE		0x04
+#define MAX1619_REG_W_CONVRATE		0x0A
+#define MAX1619_REG_R_STATUS		0x02
+#define MAX1619_REG_R_LOCAL_TEMP	0x00
+#define MAX1619_REG_R_REMOTE_TEMP	0x01
+#define MAX1619_REG_R_REMOTE_HIGH	0x07
+#define MAX1619_REG_W_REMOTE_HIGH	0x0D
+#define MAX1619_REG_R_REMOTE_LOW	0x08
+#define MAX1619_REG_W_REMOTE_LOW	0x0E
+#define MAX1619_REG_R_REMOTE_CRIT	0x10
+#define MAX1619_REG_W_REMOTE_CRIT	0x12
+#define MAX1619_REG_R_TCRIT_HYST	0x11
+#define MAX1619_REG_W_TCRIT_HYST	0x13
+
+/*
+ * Conversions and various macros
+ */
+
+#define TEMP_FROM_REG(val)	((val & 0x80 ? val-0x100 : val) * 1000)
+#define TEMP_TO_REG(val)	((val < 0 ? val+0x100*1000 : val) / 1000)
+
+/*
+ * Functions declaration
+ */
+
+static int max1619_attach_adapter(struct i2c_adapter *adapter);
+static int max1619_detect(struct i2c_adapter *adapter, int address,
+	int kind);
+static void max1619_init_client(struct i2c_client *client);
+static int max1619_detach_client(struct i2c_client *client);
+static struct max1619_data *max1619_update_device(struct device *dev);
+
+/*
+ * Driver data (common to all clients)
+ */
+
+static struct i2c_driver max1619_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "max1619",
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter	= max1619_attach_adapter,
+	.detach_client	= max1619_detach_client,
+};
+
+/*
+ * Client data (each client gets its own)
+ */
+
+struct max1619_data {
+	struct i2c_client client;
+	struct semaphore update_lock;
+	char valid; /* zero until following fields are valid */
+	unsigned long last_updated; /* in jiffies */
+
+	/* registers values */
+	u8 temp_input1; /* local */
+	u8 temp_input2, temp_low2, temp_high2; /* remote */
+	u8 temp_crit2;
+	u8 temp_hyst2;
+	u8 alarms; 
+};
+
+/*
+ * Internal variables
+ */
+
+static int max1619_id = 0;
+
+/*
+ * Sysfs stuff
+ */
+
+#define show_temp(value) \
+static ssize_t show_##value(struct device *dev, char *buf) \
+{ \
+	struct max1619_data *data = max1619_update_device(dev); \
+	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->value)); \
+}
+show_temp(temp_input1);
+show_temp(temp_input2);
+show_temp(temp_low2);
+show_temp(temp_high2);
+show_temp(temp_crit2);
+show_temp(temp_hyst2);
+
+#define set_temp2(value, reg) \
+static ssize_t set_##value(struct device *dev, const char *buf, \
+	size_t count) \
+{ \
+	struct i2c_client *client = to_i2c_client(dev); \
+	struct max1619_data *data = i2c_get_clientdata(client); \
+	data->value = TEMP_TO_REG(simple_strtol(buf, NULL, 10)); \
+	i2c_smbus_write_byte_data(client, reg, data->value); \
+	return count; \
+}
+
+set_temp2(temp_low2, MAX1619_REG_W_REMOTE_LOW);
+set_temp2(temp_high2, MAX1619_REG_W_REMOTE_HIGH);
+set_temp2(temp_crit2, MAX1619_REG_W_REMOTE_CRIT);
+set_temp2(temp_hyst2, MAX1619_REG_W_TCRIT_HYST);
+
+static ssize_t show_alarms(struct device *dev, char *buf)
+{
+	struct max1619_data *data = max1619_update_device(dev);
+	return sprintf(buf, "%d\n", data->alarms);
+}
+
+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input1, NULL);
+static DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input2, NULL);
+static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_low2,
+	set_temp_low2);
+static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp_high2,
+	set_temp_high2);
+static DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit2,
+	set_temp_crit2);
+static DEVICE_ATTR(temp2_crit_hyst, S_IWUSR | S_IRUGO, show_temp_hyst2,
+	set_temp_hyst2);
+static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
+
+/*
+ * Real code
+ */
+
+static int max1619_attach_adapter(struct i2c_adapter *adapter)
+{
+	if (!(adapter->class & I2C_CLASS_HWMON))
+		return 0;
+	return i2c_detect(adapter, &addr_data, max1619_detect);
+}
+
+/*
+ * The following function does more than just detection. If detection
+ * succeeds, it also registers the new chip.
+ */
+static int max1619_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	struct i2c_client *new_client;
+	struct max1619_data *data;
+	int err = 0;
+	const char *name = "";	
+	u8 reg_config=0, reg_convrate=0, reg_status=0;
+	u8 man_id, chip_id;
+	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+		goto exit;
+
+	if (!(data = kmalloc(sizeof(struct max1619_data), GFP_KERNEL))) {
+		err = -ENOMEM;
+		goto exit;
+	}
+	memset(data, 0, sizeof(struct max1619_data));
+
+	/* The common I2C client data is placed right before the
+	   MAX1619-specific data. */
+	new_client = &data->client;
+	i2c_set_clientdata(new_client, data);
+	new_client->addr = address;
+	new_client->adapter = adapter;
+	new_client->driver = &max1619_driver;
+	new_client->flags = 0;
+
+	/*
+	 * Now we do the remaining detection. A negative kind means that
+	 * the driver was loaded with no force parameter (default), so we
+	 * must both detect and identify the chip. A zero kind means that
+	 * the driver was loaded with the force parameter, the detection
+	 * step shall be skipped. A positive kind means that the driver
+	 * was loaded with the force parameter and a given kind of chip is
+	 * requested, so both the detection and the identification steps
+	 * are skipped.
+	 */
+	if (kind < 0) { /* detection */
+		reg_config = i2c_smbus_read_byte_data(new_client,
+			      MAX1619_REG_R_CONFIG);
+		reg_convrate = i2c_smbus_read_byte_data(new_client,
+			       MAX1619_REG_R_CONVRATE);
+		reg_status = i2c_smbus_read_byte_data(new_client,
+				MAX1619_REG_R_STATUS);
+		if ((reg_config & 0x03) != 0x00
+		 || reg_convrate > 0x07 || (reg_status & 0x61 ) !=0x00) {
+			dev_dbg(&adapter->dev,
+				"MAX1619 detection failed at 0x%02x.\n",
+				address);
+			goto exit_free;
+		}
+	}
+
+	if (kind <= 0) { /* identification */
+	
+		man_id = i2c_smbus_read_byte_data(new_client,
+			 MAX1619_REG_R_MAN_ID);
+		chip_id = i2c_smbus_read_byte_data(new_client,
+			  MAX1619_REG_R_CHIP_ID);
+		
+		if ((man_id == 0x4D) && (chip_id == 0x04)){  
+				kind = max1619;
+			}
+		}
+
+		if (kind <= 0) { /* identification failed */
+			dev_info(&adapter->dev,
+			    "Unsupported chip (man_id=0x%02X, "
+			    "chip_id=0x%02X).\n", man_id, chip_id);
+			goto exit_free;
+		}
+	
+
+	if (kind == max1619){
+		name = "max1619";
+	}
+
+	/* 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);
+
+	/* Tell the I2C layer a new client has arrived */
+	if ((err = i2c_attach_client(new_client)))
+		goto exit_free;
+
+	/* Initialize the MAX1619 chip */
+	max1619_init_client(new_client);
+
+	/* Register sysfs hooks */
+	device_create_file(&new_client->dev, &dev_attr_temp1_input);
+	device_create_file(&new_client->dev, &dev_attr_temp2_input);
+	device_create_file(&new_client->dev, &dev_attr_temp2_min);
+	device_create_file(&new_client->dev, &dev_attr_temp2_max);
+	device_create_file(&new_client->dev, &dev_attr_temp2_crit);
+	device_create_file(&new_client->dev, &dev_attr_temp2_crit_hyst);
+	device_create_file(&new_client->dev, &dev_attr_alarms);
+
+	return 0;
+
+exit_free:
+	kfree(data);
+exit:
+	return err;
+}
+
+static void max1619_init_client(struct i2c_client *client)
+{
+	u8 config;
+
+	/*
+	 * Start the conversions.
+	 */
+	i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONVRATE,
+				  5); /* 2 Hz */
+	config = i2c_smbus_read_byte_data(client, MAX1619_REG_R_CONFIG);
+	if (config & 0x40)
+		i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONFIG,
+					  config & 0xBF); /* run */
+}
+
+static int max1619_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 struct max1619_data *max1619_update_device(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct max1619_data *data = i2c_get_clientdata(client);
+
+	down(&data->update_lock);
+
+	if ((jiffies - data->last_updated > HZ * 2) ||
+	    (jiffies < data->last_updated) ||
+	    !data->valid) {
+		
+		dev_dbg(&client->dev, "Updating max1619 data.\n");
+		data->temp_input1 = i2c_smbus_read_byte_data(client,
+					MAX1619_REG_R_LOCAL_TEMP);
+		data->temp_input2 = i2c_smbus_read_byte_data(client,
+					MAX1619_REG_R_REMOTE_TEMP);
+		data->temp_high2 = i2c_smbus_read_byte_data(client,
+					MAX1619_REG_R_REMOTE_HIGH);
+		data->temp_low2 = i2c_smbus_read_byte_data(client,
+					MAX1619_REG_R_REMOTE_LOW);
+		data->temp_crit2 = i2c_smbus_read_byte_data(client,
+					MAX1619_REG_R_REMOTE_CRIT);
+		data->temp_hyst2 = i2c_smbus_read_byte_data(client,
+					MAX1619_REG_R_TCRIT_HYST);
+		data->alarms = i2c_smbus_read_byte_data(client,
+					MAX1619_REG_R_STATUS);
+
+		data->last_updated = jiffies;
+		data->valid = 1;
+	}
+
+	up(&data->update_lock);
+
+	return data;
+}
+
+static int __init sensors_max1619_init(void)
+{
+	return i2c_add_driver(&max1619_driver);
+}
+
+static void __exit sensors_max1619_exit(void)
+{
+	i2c_del_driver(&max1619_driver);
+}
+
+MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and"
+	"Jean Delvare <khali@linux-fr.org>");
+MODULE_DESCRIPTION("MAX1619 sensor driver");
+MODULE_LICENSE("GPL");
+
+module_init(sensors_max1619_init);
+module_exit(sensors_max1619_exit);
diff -Nru a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/chips/rtc8564.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,396 @@
+/*
+ *  linux/drivers/i2c/chips/rtc8564.c
+ *
+ *  Copyright (C) 2002-2004 Stefan Eletzhofer
+ *
+ *	based on linux/drivers/acron/char/pcf8583.c
+ *  Copyright (C) 2000 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
+ * published by the Free Software Foundation.
+ *
+ * Driver for system3's EPSON RTC 8564 chip
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/i2c.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/rtc.h>		/* get the user-level API */
+#include <linux/init.h>
+#include <linux/init.h>
+
+#include "rtc8564.h"
+
+#ifdef DEBUG
+# define _DBG(x, fmt, args...) do{ if (debug>=x) printk(KERN_DEBUG"%s: " fmt "\n", __FUNCTION__, ##args); } while(0);
+#else
+# define _DBG(x, fmt, args...) do { } while(0);
+#endif
+
+#define _DBGRTCTM(x, rtctm) if (debug>=x) printk("%s: secs=%d, mins=%d, hours=%d, mday=%d, " \
+			"mon=%d, year=%d, wday=%d VL=%d\n", __FUNCTION__, \
+			(rtctm).secs, (rtctm).mins, (rtctm).hours, (rtctm).mday, \
+			(rtctm).mon, (rtctm).year, (rtctm).wday, (rtctm).vl);
+
+struct rtc8564_data {
+	struct i2c_client client;
+	u16 ctrl;
+};
+
+static inline u8 _rtc8564_ctrl1(struct i2c_client *client)
+{
+	struct rtc8564_data *data = i2c_get_clientdata(client);
+	return data->ctrl & 0xff;
+}
+static inline u8 _rtc8564_ctrl2(struct i2c_client *client)
+{
+	struct rtc8564_data *data = i2c_get_clientdata(client);
+	return (data->ctrl & 0xff00) >> 8;
+}
+
+#define CTRL1(c) _rtc8564_ctrl1(c)
+#define CTRL2(c) _rtc8564_ctrl2(c)
+
+#define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10)
+#define BIN_TO_BCD(val) ((((val)/10)<<4) + (val)%10)
+
+static int debug = 0;
+MODULE_PARM(debug, "i");
+
+static struct i2c_driver rtc8564_driver;
+
+static unsigned short ignore[] = { I2C_CLIENT_END };
+static unsigned short normal_addr[] = { 0x51, 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,
+};
+
+static int rtc8564_read_mem(struct i2c_client *client, struct mem *mem);
+static int rtc8564_write_mem(struct i2c_client *client, struct mem *mem);
+
+static int rtc8564_read(struct i2c_client *client, unsigned char adr,
+			unsigned char *buf, unsigned char len)
+{
+	int ret = -EIO;
+	unsigned char addr[1] = { adr };
+	struct i2c_msg msgs[2] = {
+		{client->addr, 0, 1, addr},
+		{client->addr, I2C_M_RD, len, buf}
+	};
+
+	_DBG(1, "client=%p, adr=%d, buf=%p, len=%d", client, adr, buf, len);
+
+	if (!buf || !client) {
+		ret = -EINVAL;
+		goto done;
+	}
+
+	ret = i2c_transfer(client->adapter, msgs, 2);
+	if (ret == 2) {
+		ret = 0;
+	}
+
+done:
+	return ret;
+}
+
+static int rtc8564_write(struct i2c_client *client, unsigned char adr,
+			 unsigned char *data, unsigned char len)
+{
+	int ret = 0;
+	unsigned char _data[16];
+	struct i2c_msg wr;
+	int i;
+
+	if (!client || !data || len > 15) {
+		ret = -EINVAL;
+		goto done;
+	}
+
+	_DBG(1, "client=%p, adr=%d, buf=%p, len=%d", client, adr, data, len);
+
+	_data[0] = adr;
+	for (i = 0; i < len; i++) {
+		_data[i + 1] = data[i];
+		_DBG(5, "data[%d] = 0x%02x (%d)", i, data[i], data[i]);
+	}
+
+	wr.addr = client->addr;
+	wr.flags = 0;
+	wr.len = len + 1;
+	wr.buf = _data;
+
+	ret = i2c_transfer(client->adapter, &wr, 1);
+	if (ret == 1) {
+		ret = 0;
+	}
+
+done:
+	return ret;
+}
+
+static int rtc8564_attach(struct i2c_adapter *adap, int addr, int kind)
+{
+	int ret;
+	struct i2c_client *new_client;
+	struct rtc8564_data *d;
+	unsigned char data[10];
+	unsigned char ad[1] = { 0 };
+	struct i2c_msg ctrl_wr[1] = {
+		{addr, 0, 2, data}
+	};
+	struct i2c_msg ctrl_rd[2] = {
+		{addr, 0, 1, ad},
+		{addr, I2C_M_RD, 2, data}
+	};
+
+	d = kmalloc(sizeof(struct rtc8564_data), GFP_KERNEL);
+	if (!d) {
+		ret = -ENOMEM;
+		goto done;
+	}
+	memset(d, 0, sizeof(struct rtc8564_data));
+	new_client = &d->client;
+
+	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;
+	data[1] = 0;
+	ret = i2c_transfer(new_client->adapter, ctrl_wr, 1);
+	if (ret != 1) {
+		printk(KERN_INFO "rtc8564: cant init ctrl1\n");
+		ret = -ENODEV;
+		goto done;
+	}
+
+	/* read back ctrl1 and ctrl2 */
+	ret = i2c_transfer(new_client->adapter, ctrl_rd, 2);
+	if (ret != 2) {
+		printk(KERN_INFO "rtc8564: cant read ctrl\n");
+		ret = -ENODEV;
+		goto done;
+	}
+
+	d->ctrl = data[0] | (data[1] << 8);
+
+	_DBG(1, "RTC8564_REG_CTRL1=%02x, RTC8564_REG_CTRL2=%02x",
+	     data[0], data[1]);
+
+	ret = i2c_attach_client(new_client);
+done:
+	if (ret) {
+		kfree(d);
+	}
+	return ret;
+}
+
+static int rtc8564_probe(struct i2c_adapter *adap)
+{
+	return i2c_probe(adap, &addr_data, rtc8564_attach);
+}
+
+static int rtc8564_detach(struct i2c_client *client)
+{
+	i2c_detach_client(client);
+	kfree(i2c_get_clientdata(client));
+	return 0;
+}
+
+static int rtc8564_get_datetime(struct i2c_client *client, struct rtc_tm *dt)
+{
+	int ret = -EIO;
+	unsigned char buf[15];
+
+	_DBG(1, "client=%p, dt=%p", client, dt);
+
+	if (!dt || !client)
+		return -EINVAL;
+
+	memset(buf, 0, sizeof(buf));
+
+	ret = rtc8564_read(client, 0, buf, 15);
+	if (ret)
+		return ret;
+
+	/* century stored in minute alarm reg */
+	dt->year = BCD_TO_BIN(buf[RTC8564_REG_YEAR]);
+	dt->year += 100 * BCD_TO_BIN(buf[RTC8564_REG_AL_MIN] & 0x3f);
+	dt->mday = BCD_TO_BIN(buf[RTC8564_REG_DAY] & 0x3f);
+	dt->wday = BCD_TO_BIN(buf[RTC8564_REG_WDAY] & 7);
+	dt->mon = BCD_TO_BIN(buf[RTC8564_REG_MON_CENT] & 0x1f);
+
+	dt->secs = BCD_TO_BIN(buf[RTC8564_REG_SEC] & 0x7f);
+	dt->vl = (buf[RTC8564_REG_SEC] & 0x80) == 0x80;
+	dt->mins = BCD_TO_BIN(buf[RTC8564_REG_MIN] & 0x7f);
+	dt->hours = BCD_TO_BIN(buf[RTC8564_REG_HR] & 0x3f);
+
+	_DBGRTCTM(2, *dt);
+
+	return 0;
+}
+
+static int
+rtc8564_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo)
+{
+	int ret, len = 5;
+	unsigned char buf[15];
+
+	_DBG(1, "client=%p, dt=%p", client, dt);
+
+	if (!dt || !client)
+		return -EINVAL;
+
+	_DBGRTCTM(2, *dt);
+
+	buf[RTC8564_REG_CTRL1] = CTRL1(client) | RTC8564_CTRL1_STOP;
+	buf[RTC8564_REG_CTRL2] = CTRL2(client);
+	buf[RTC8564_REG_SEC] = BIN_TO_BCD(dt->secs);
+	buf[RTC8564_REG_MIN] = BIN_TO_BCD(dt->mins);
+	buf[RTC8564_REG_HR] = BIN_TO_BCD(dt->hours);
+
+	if (datetoo) {
+		len += 5;
+		buf[RTC8564_REG_DAY] = BIN_TO_BCD(dt->mday);
+		buf[RTC8564_REG_WDAY] = BIN_TO_BCD(dt->wday);
+		buf[RTC8564_REG_MON_CENT] = BIN_TO_BCD(dt->mon) & 0x1f;
+		/* century stored in minute alarm reg */
+		buf[RTC8564_REG_YEAR] = BIN_TO_BCD(dt->year % 100);
+		buf[RTC8564_REG_AL_MIN] = BIN_TO_BCD(dt->year / 100);
+	}
+
+	ret = rtc8564_write(client, 0, buf, len);
+	if (ret) {
+		_DBG(1, "error writing data! %d", ret);
+	}
+
+	buf[RTC8564_REG_CTRL1] = CTRL1(client);
+	ret = rtc8564_write(client, 0, buf, 1);
+	if (ret) {
+		_DBG(1, "error writing data! %d", ret);
+	}
+
+	return ret;
+}
+
+static int rtc8564_get_ctrl(struct i2c_client *client, unsigned int *ctrl)
+{
+	struct rtc8564_data *data = i2c_get_clientdata(client);
+
+	if (!ctrl || !client)
+		return -1;
+
+	*ctrl = data->ctrl;
+	return 0;
+}
+
+static int rtc8564_set_ctrl(struct i2c_client *client, unsigned int *ctrl)
+{
+	struct rtc8564_data *data = i2c_get_clientdata(client);
+	unsigned char buf[2];
+
+	if (!ctrl || !client)
+		return -1;
+
+	buf[0] = *ctrl & 0xff;
+	buf[1] = (*ctrl & 0xff00) >> 8;
+	data->ctrl = *ctrl;
+
+	return rtc8564_write(client, 0, buf, 2);
+}
+
+static int rtc8564_read_mem(struct i2c_client *client, struct mem *mem)
+{
+
+	if (!mem || !client)
+		return -EINVAL;
+
+	return rtc8564_read(client, mem->loc, mem->data, mem->nr);
+}
+
+static int rtc8564_write_mem(struct i2c_client *client, struct mem *mem)
+{
+
+	if (!mem || !client)
+		return -EINVAL;
+
+	return rtc8564_write(client, mem->loc, mem->data, mem->nr);
+}
+
+static int
+rtc8564_command(struct i2c_client *client, unsigned int cmd, void *arg)
+{
+
+	_DBG(1, "cmd=%d", cmd);
+
+	switch (cmd) {
+	case RTC_GETDATETIME:
+		return rtc8564_get_datetime(client, arg);
+
+	case RTC_SETTIME:
+		return rtc8564_set_datetime(client, arg, 0);
+
+	case RTC_SETDATETIME:
+		return rtc8564_set_datetime(client, arg, 1);
+
+	case RTC_GETCTRL:
+		return rtc8564_get_ctrl(client, arg);
+
+	case RTC_SETCTRL:
+		return rtc8564_set_ctrl(client, arg);
+
+	case MEM_READ:
+		return rtc8564_read_mem(client, arg);
+
+	case MEM_WRITE:
+		return rtc8564_write_mem(client, arg);
+
+	default:
+		return -EINVAL;
+	}
+}
+
+static struct i2c_driver rtc8564_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "RTC8564",
+	.id		= I2C_DRIVERID_RTC8564,
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter = rtc8564_probe,
+	.detach_client	= rtc8564_detach,
+	.command	= rtc8564_command
+};
+
+static __init int rtc8564_init(void)
+{
+	return i2c_add_driver(&rtc8564_driver);
+}
+
+static __exit void rtc8564_exit(void)
+{
+	i2c_del_driver(&rtc8564_driver);
+}
+
+MODULE_AUTHOR("Stefan Eletzhofer <Stefan.Eletzhofer@eletztrick.de>");
+MODULE_DESCRIPTION("EPSON RTC8564 Driver");
+MODULE_LICENSE("GPL");
+
+module_init(rtc8564_init);
+module_exit(rtc8564_exit);
diff -Nru a/drivers/i2c/chips/rtc8564.h b/drivers/i2c/chips/rtc8564.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/i2c/chips/rtc8564.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,78 @@
+/*
+ *  linux/drivers/i2c/chips/rtc8564.h
+ *
+ *  Copyright (C) 2002-2004 Stefan Eletzhofer
+ *
+ *	based on linux/drivers/acron/char/pcf8583.h
+ *  Copyright (C) 2000 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
+ * published by the Free Software Foundation.
+ */
+struct rtc_tm {
+	unsigned char	secs;
+	unsigned char	mins;
+	unsigned char	hours;
+	unsigned char	mday;
+	unsigned char	mon;
+	unsigned short	year; /* xxxx 4 digits :) */
+	unsigned char	wday;
+	unsigned char	vl;
+};
+
+struct mem {
+	unsigned int	loc;
+	unsigned int	nr;
+	unsigned char	*data;
+};
+
+#define RTC_GETDATETIME	0
+#define RTC_SETTIME	1
+#define RTC_SETDATETIME	2
+#define RTC_GETCTRL	3
+#define RTC_SETCTRL	4
+#define MEM_READ	5
+#define MEM_WRITE	6
+
+#define RTC8564_REG_CTRL1		0x0 /* T  0 S 0 | T 0 0 0 */
+#define RTC8564_REG_CTRL2		0x1 /* 0  0 0 TI/TP | AF TF AIE TIE */
+#define RTC8564_REG_SEC			0x2 /* VL 4 2 1 | 8 4 2 1 */
+#define RTC8564_REG_MIN			0x3 /* x  4 2 1 | 8 4 2 1 */
+#define RTC8564_REG_HR			0x4 /* x  x 2 1 | 8 4 2 1 */
+#define RTC8564_REG_DAY			0x5 /* x  x 2 1 | 8 4 2 1 */
+#define RTC8564_REG_WDAY		0x6 /* x  x x x | x 4 2 1 */
+#define RTC8564_REG_MON_CENT	0x7 /* C  x x 1 | 8 4 2 1 */
+#define RTC8564_REG_YEAR		0x8 /* 8  4 2 1 | 8 4 2 1 */
+#define RTC8564_REG_AL_MIN		0x9 /* AE 4 2 1 | 8 4 2 1 */
+#define RTC8564_REG_AL_HR		0xa /* AE 4 2 1 | 8 4 2 1 */
+#define RTC8564_REG_AL_DAY		0xb /* AE x 2 1 | 8 4 2 1 */
+#define RTC8564_REG_AL_WDAY		0xc /* AE x x x | x 4 2 1 */
+#define RTC8564_REG_CLKOUT		0xd /* FE x x x | x x FD1 FD0 */
+#define RTC8564_REG_TCTL		0xe /* TE x x x | x x FD1 FD0 */
+#define RTC8564_REG_TIMER		0xf /* 8 bit binary */
+
+/* Control reg */
+#define RTC8564_CTRL1_TEST1		(1<<3)
+#define RTC8564_CTRL1_STOP		(1<<5)
+#define RTC8564_CTRL1_TEST2		(1<<7)
+
+#define RTC8564_CTRL2_TIE		(1<<0)
+#define RTC8564_CTRL2_AIE		(1<<1)
+#define RTC8564_CTRL2_TF		(1<<2)
+#define RTC8564_CTRL2_AF		(1<<3)
+#define RTC8564_CTRL2_TI_TP		(1<<4)
+
+/* CLKOUT frequencies */
+#define RTC8564_FD_32768HZ		(0x0)
+#define RTC8564_FD_1024HZ		(0x1)
+#define RTC8564_FD_32			(0x2)
+#define RTC8564_FD_1HZ			(0x3)
+
+/* Timer CTRL */
+#define RTC8564_TD_4096HZ		(0x0)
+#define RTC8564_TD_64HZ			(0x1)
+#define RTC8564_TD_1HZ			(0x2)
+#define RTC8564_TD_1_60HZ		(0x3)
+
+#define I2C_DRIVERID_RTC8564 0xf000
diff -Nru a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
--- a/drivers/i2c/chips/via686a.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/i2c/chips/via686a.c	Tue Jun 15 22:20:37 2004
@@ -108,7 +108,7 @@
 #define VIA686A_TEMP_MODE_MASK 0x3F
 #define VIA686A_TEMP_MODE_CONTINUOUS (0x00)
 
-/* Conversions. Rounding and limit checking is only done on the TO_REG
+/* Conversions. Limit checking is only done on the TO_REG
    variants. 
 
 ********* VOLTAGE CONVERSIONS (Bob Dougherty) ********
@@ -123,49 +123,41 @@
  volts = (25*regVal+133)*factor
  regVal = (volts/factor-133)/25
  (These conversions were contributed by Jonathan Teh Soon Yew 
- <j.teh@iname.com>)
- 
- These get us close, but they don't completely agree with what my BIOS 
- says- they are all a bit low.  But, it all we have to go on... */
+ <j.teh@iname.com>) */
 static inline u8 IN_TO_REG(long val, int inNum)
 {
-	/* to avoid floating point, we multiply everything by 100.
-	 val is guaranteed to be positive, so we can achieve the effect of 
-	 rounding by (...*10+5)/10.  Note that the *10 is hidden in the 
-	 /250 (which should really be /2500).
-	 At the end, we need to /100 because we *100 everything and we need
-	 to /10 because of the rounding thing, so we /1000.   */
+	/* To avoid floating point, we multiply constants by 10 (100 for +12V).
+	   Rounding is done (120500 is actually 133000 - 12500).
+	   Remember that val is expressed in 0.001V/bit, which is why we divide
+	   by an additional 10000 (100000 for +12V): 1000 for val and 10 (100)
+	   for the constants. */
 	if (inNum <= 1)
 		return (u8)
-		    SENSORS_LIMIT(((val * 210240 - 13300) / 250 + 5) / 1000, 
-				  0, 255);
+		    SENSORS_LIMIT((val * 21024 - 1205000) / 250000, 0, 255);
 	else if (inNum == 2)
 		return (u8)
-		    SENSORS_LIMIT(((val * 157370 - 13300) / 250 + 5) / 1000, 
-				  0, 255);
+		    SENSORS_LIMIT((val * 15737 - 1205000) / 250000, 0, 255);
 	else if (inNum == 3)
 		return (u8)
-		    SENSORS_LIMIT(((val * 101080 - 13300) / 250 + 5) / 1000, 
-				  0, 255);
+		    SENSORS_LIMIT((val * 10108 - 1205000) / 250000, 0, 255);
 	else
-		return (u8) SENSORS_LIMIT(((val * 41714 - 13300) / 250 + 5)
-					  / 1000, 0, 255);
+		return (u8)
+		    SENSORS_LIMIT((val * 41714 - 12050000) / 2500000, 0, 255);
 }
 
 static inline long IN_FROM_REG(u8 val, int inNum)
 {
-	/* to avoid floating point, we multiply everything by 100.
-	 val is guaranteed to be positive, so we can achieve the effect of
-	 rounding by adding 0.5.  Or, to avoid fp math, we do (...*10+5)/10.
-	 We need to scale with *100 anyway, so no need to /100 at the end. */
+	/* To avoid floating point, we multiply constants by 10 (100 for +12V).
+	   We also multiply them by 1000 because we want 0.001V/bit for the
+	   output value. Rounding is done. */
 	if (inNum <= 1)
-		return (long) (((250000 * val + 13300) / 210240 * 10 + 5) /10);
+		return (long) ((250000 * val + 1330000 + 21024 / 2) / 21024);
 	else if (inNum == 2)
-		return (long) (((250000 * val + 13300) / 157370 * 10 + 5) /10);
+		return (long) ((250000 * val + 1330000 + 15737 / 2) / 15737);
 	else if (inNum == 3)
-		return (long) (((250000 * val + 13300) / 101080 * 10 + 5) /10);
+		return (long) ((250000 * val + 1330000 + 10108 / 2) / 10108);
 	else
-		return (long) (((250000 * val + 13300) / 41714 * 10 + 5) /10);
+		return (long) ((2500000 * val + 13300000 + 41714 / 2) / 41714);
 }
 
 /********* FAN RPM CONVERSIONS ********/
@@ -276,52 +268,31 @@
 	    239, 240
 };
 
-/* Converting temps to (8-bit) hyst and over registers 
- No interpolation here.  Just check the limits and go.
- The +5 effectively rounds off properly and the +50 is because 
- the temps start at -50 */
+/* Converting temps to (8-bit) hyst and over registers
+   No interpolation here.
+   The +50 is because the temps start at -50 */
 static inline u8 TEMP_TO_REG(long val)
 {
-	return (u8)
-	    SENSORS_LIMIT(viaLUT[((val <= -500) ? 0 : (val >= 1100) ? 160 : 
-				  ((val + 5) / 10 + 50))], 0, 255);
+	return viaLUT[val <= -50000 ? 0 : val >= 110000 ? 160 : 
+		      (val < 0 ? val - 500 : val + 500) / 1000 + 50];
 }
 
-/* for 8-bit temperature hyst and over registers 
- The temp values are already *10, so we don't need to do that.
- But we _will_ round these off to the nearest degree with (...*10+5)/10 */
-#define TEMP_FROM_REG(val) ((tempLUT[(val)]*10+5)/10)
-
-/* for 10-bit temperature readings 
- You might _think_ this is too long to inline, but's it's really only
- called once... */
+/* for 8-bit temperature hyst and over registers */
+#define TEMP_FROM_REG(val) (tempLUT[(val)] * 100)
+
+/* for 10-bit temperature readings */
 static inline long TEMP_FROM_REG10(u16 val)
 {
-	/* the temp values are already *10, so we don't need to do that. */
-	long temp;
 	u16 eightBits = val >> 2;
 	u16 twoBits = val & 3;
 
-	/* handle the extremes first (they won't interpolate well! ;-) */
-	if (val == 0)
-		return (long) tempLUT[0];
-	if (val == 1023)
-		return (long) tempLUT[255];
-
-	if (twoBits == 0)
-		return (long) tempLUT[eightBits];
-	else {
-		/* do some interpolation by multipying the lower and upper
-		 bounds by 25, 50 or 75, then /100. */
-		temp = ((25 * (4 - twoBits)) * tempLUT[eightBits]
-			+ (25 * twoBits) * tempLUT[eightBits + 1]);
-		/* increase the magnitude by 50 to achieve rounding. */
-		if (temp > 0)
-			temp += 50;
-		else
-			temp -= 50;
-		return (temp / 100);
-	}
+	/* no interpolation for these */
+	if (twoBits == 0 || eightBits == 255)
+		return TEMP_FROM_REG(eightBits);
+
+	/* do some linear interpolation */
+	return (tempLUT[eightBits] * (4 - twoBits) +
+	        tempLUT[eightBits + 1] * twoBits) * 25;
 }
 
 #define ALARMS_FROM_REG(val) (val)
@@ -375,24 +346,24 @@
 /* 7 voltage sensors */
 static ssize_t show_in(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf, "%ld\n", IN_FROM_REG(data->in[nr], nr)*10 );
+	return sprintf(buf, "%ld\n", IN_FROM_REG(data->in[nr], nr));
 }
 
 static ssize_t show_in_min(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf, "%ld\n", IN_FROM_REG(data->in_min[nr], nr)*10 );
+	return sprintf(buf, "%ld\n", IN_FROM_REG(data->in_min[nr], nr));
 }
 
 static ssize_t show_in_max(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf, "%ld\n", IN_FROM_REG(data->in_max[nr], nr)*10 );
+	return sprintf(buf, "%ld\n", IN_FROM_REG(data->in_max[nr], 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 via686a_data *data = i2c_get_clientdata(client);
-	unsigned long val = simple_strtoul(buf, NULL, 10)/10;
+	unsigned long val = simple_strtoul(buf, NULL, 10);
 	data->in_min[nr] = IN_TO_REG(val,nr);
 	via686a_write_value(client, VIA686A_REG_IN_MIN(nr), 
 			data->in_min[nr]);
@@ -402,7 +373,7 @@
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
-	unsigned long val = simple_strtoul(buf, NULL, 10)/10;
+	unsigned long val = simple_strtoul(buf, NULL, 10);
 	data->in_max[nr] = IN_TO_REG(val,nr);
 	via686a_write_value(client, VIA686A_REG_IN_MAX(nr), 
 			data->in_max[nr]);
@@ -449,21 +420,21 @@
 /* 3 temperatures */
 static ssize_t show_temp(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf, "%ld\n", TEMP_FROM_REG10(data->temp[nr])*100 );
+	return sprintf(buf, "%ld\n", TEMP_FROM_REG10(data->temp[nr]));
 }
 static ssize_t show_temp_over(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_over[nr])*100);
+	return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_over[nr]));
 }
 static ssize_t show_temp_hyst(struct device *dev, char *buf, int nr) {
 	struct via686a_data *data = via686a_update_device(dev);
-	return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_hyst[nr])*100);
+	return sprintf(buf, "%ld\n", TEMP_FROM_REG(data->temp_hyst[nr]));
 }
 static ssize_t set_temp_over(struct device *dev, const char *buf, 
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
-	int val = simple_strtol(buf, NULL, 10)/100;
+	int val = simple_strtol(buf, NULL, 10);
 	data->temp_over[nr] = TEMP_TO_REG(val);
 	via686a_write_value(client, VIA686A_REG_TEMP_OVER(nr), data->temp_over[nr]);
 	return count;
@@ -472,7 +443,7 @@
 		size_t count, int nr) {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct via686a_data *data = i2c_get_clientdata(client);
-	int val = simple_strtol(buf, NULL, 10)/100;
+	int val = simple_strtol(buf, NULL, 10);
 	data->temp_hyst[nr] = TEMP_TO_REG(val);
 	via686a_write_value(client, VIA686A_REG_TEMP_HYST(nr), data->temp_hyst[nr]);
 	return count;
@@ -602,7 +573,7 @@
 /* This is called when the module is loaded */
 static int via686a_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, via686a_detect);
 }
diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/i2c/chips/w83781d.c	Tue Jun 15 22:20:35 2004
@@ -183,8 +183,10 @@
 #define ALARMS_FROM_REG(val)		(val)
 #define PWM_FROM_REG(val)		(val)
 #define PWM_TO_REG(val)			(SENSORS_LIMIT((val),0,255))
-#define BEEP_MASK_FROM_REG(val)		(val)
-#define BEEP_MASK_TO_REG(val)		((val) & 0xffffff)
+#define BEEP_MASK_FROM_REG(val,type)	((type) == as99127f ? \
+					 (val) ^ 0x7fff : (val))
+#define BEEP_MASK_TO_REG(val,type)	((type) == as99127f ? \
+					 (~(val)) & 0x7fff : (val) & 0xffffff)
 
 #define BEEP_ENABLE_TO_REG(val)		((val) ? 1 : 0)
 #define BEEP_ENABLE_FROM_REG(val)	((val) ? 1 : 0)
@@ -539,14 +541,18 @@
 DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL)
 #define device_create_file_alarms(client) \
 device_create_file(&client->dev, &dev_attr_alarms);
-#define show_beep_reg(REG, reg) \
-static ssize_t show_beep_##reg (struct device *dev, char *buf) \
-{ \
-	struct w83781d_data *data = w83781d_update_device(dev); \
-	return sprintf(buf,"%ld\n", (long)BEEP_##REG##_FROM_REG(data->beep_##reg)); \
+static ssize_t show_beep_mask (struct device *dev, char *buf)
+{
+	struct w83781d_data *data = w83781d_update_device(dev);
+	return sprintf(buf, "%ld\n",
+		       (long)BEEP_MASK_FROM_REG(data->beep_mask, data->type));
+}
+static ssize_t show_beep_enable (struct device *dev, char *buf)
+{
+	struct w83781d_data *data = w83781d_update_device(dev);
+	return sprintf(buf, "%ld\n",
+		       (long)BEEP_ENABLE_FROM_REG(data->beep_enable));
 }
-show_beep_reg(ENABLE, enable);
-show_beep_reg(MASK, mask);
 
 #define BEEP_ENABLE			0	/* Store beep_enable */
 #define BEEP_MASK			1	/* Store beep_mask */
@@ -562,7 +568,7 @@
 	val = simple_strtoul(buf, NULL, 10);
 
 	if (update_mask == BEEP_MASK) {	/* We are storing beep_mask */
-		data->beep_mask = BEEP_MASK_TO_REG(val);
+		data->beep_mask = BEEP_MASK_TO_REG(val, data->type);
 		w83781d_write_value(client, W83781D_REG_BEEP_INTS1,
 				    data->beep_mask & 0xff);
 
@@ -905,7 +911,7 @@
 static int
 w83781d_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, w83781d_detect);
 }
@@ -1330,7 +1336,13 @@
 		return err;
 	}
 
-	kfree(i2c_get_clientdata(client));
+	if (i2c_get_clientdata(client)==NULL) {
+		/* subclients */
+		kfree(client);
+	} else {
+		/* main client */
+		kfree(i2c_get_clientdata(client));
+	}
 
 	return 0;
 }
diff -Nru a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c
--- a/drivers/i2c/chips/w83l785ts.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/i2c/chips/w83l785ts.c	Tue Jun 15 22:20:38 2004
@@ -32,6 +32,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
@@ -145,7 +146,7 @@
 
 static int w83l785ts_attach_adapter(struct i2c_adapter *adapter)
 {
-	if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+	if (!(adapter->class & I2C_CLASS_HWMON))
 		return 0;
 	return i2c_detect(adapter, &addr_data, w83l785ts_detect);
 }
@@ -284,7 +285,7 @@
 		if (value >= 0)
 			return value;
 		dev_dbg(&client->dev, "Read failed, will retry in %d.\n", i);
-		i2c_delay(i);
+		msleep(i);
 	}
 
 	dev_err(&client->dev, "Couldn't read value from register. "
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/i2c/i2c-core.c	Tue Jun 15 22:20:37 2004
@@ -28,6 +28,7 @@
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
+#include <linux/idr.h>
 #include <linux/seq_file.h>
 #include <asm/uaccess.h>
 
@@ -35,6 +36,7 @@
 static LIST_HEAD(adapters);
 static LIST_HEAD(drivers);
 static DECLARE_MUTEX(core_lists);
+static DEFINE_IDR(i2c_adapter_idr);
 
 int i2c_device_probe(struct device *dev)
 {
@@ -113,13 +115,19 @@
  */
 int i2c_add_adapter(struct i2c_adapter *adap)
 {
-	static int nr = 0;
+	int id, res = 0;
 	struct list_head   *item;
 	struct i2c_driver  *driver;
 
 	down(&core_lists);
 
-	adap->nr = nr++;
+	if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) {
+		res = -ENOMEM;
+		goto out_unlock;
+	}
+
+	id = idr_get_new(&i2c_adapter_idr, NULL);
+	adap->nr =  id & MAX_ID_MASK;
 	init_MUTEX(&adap->bus_lock);
 	init_MUTEX(&adap->clist_lock);
 	list_add_tail(&adap->list,&adapters);
@@ -151,10 +159,12 @@
 			/* We ignore the return code; if it fails, too bad */
 			driver->attach_adapter(adap);
 	}
-	up(&core_lists);
 
 	dev_dbg(&adap->dev, "registered as adapter #%d\n", adap->nr);
-	return 0;
+
+ out_unlock:
+	up(&core_lists);
+	return res;
 }
 
 
@@ -207,6 +217,9 @@
 	/* wait for sysfs to drop all references */
 	wait_for_completion(&adap->dev_released);
 	wait_for_completion(&adap->class_dev_released);
+
+	/* free dynamically allocated bus id */
+	idr_remove(&i2c_adapter_idr, adap->nr);
 
 	dev_dbg(&adap->dev, "adapter unregistered\n");
 
diff -Nru a/drivers/ide/Kconfig b/drivers/ide/Kconfig
--- a/drivers/ide/Kconfig	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/Kconfig	Tue Jun 15 22:20:40 2004
@@ -157,20 +157,6 @@
 
 	  If in doubt, say N.
 
-config IDEDISK_STROKE
-	bool "Auto-Geometry Resizing support"
-	depends on BLK_DEV_IDEDISK
-	help
-	  Should you have a system w/ an AWARD Bios and your drives are larger
-	  than 32GB and it will not boot, one is required to perform a few OEM
-	  operations first.  The option is called "STROKE" because it allows
-	  one to "soft clip" the drive to work around a barrier limit.  For
-	  Maxtor drives it is called "jumpon.exe".  Please search Maxtor's
-	  web-site for "JUMPON.EXE".  IBM has a similar tool at:
-	  <http://www.storage.ibm.com/hdd/support/download.htm>.
-
-	  If you are unsure, say N here.
-
 config BLK_DEV_IDECS
 	tristate "PCMCIA IDE support"
 	depends on PCMCIA
@@ -387,8 +373,8 @@
 	  If in doubt, say N.
 
 config BLK_DEV_GENERIC
-	bool "Generic PCI IDE Chipset Support"
-	depends on PCI && BLK_DEV_IDEPCI
+	tristate "Generic PCI IDE Chipset Support"
+	depends on BLK_DEV_IDEPCI
 
 config BLK_DEV_OPTI621
 	tristate "OPTi 82C621 chipset enhanced support (EXPERIMENTAL)"
@@ -438,48 +424,6 @@
 
 if BLK_DEV_IDEDMA_PCI
 
-# TCQ is disabled for now
-config BLK_DEV_IDE_TCQ
-	bool "ATA tagged command queueing (EXPERIMENTAL)"
-	depends on EXPERIMENTAL && n
-	help
-	  Support for tagged command queueing on ATA disk drives. This enables
-	  the IDE layer to have multiple in-flight requests on hardware that
-	  supports it. For now this includes the IBM Deskstar series drives,
-	  such as the 22GXP, 75GXP, 40GV, 60GXP, and 120GXP (ie any Deskstar made
-	  in the last couple of years), and at least some of the Western
-	  Digital drives in the Expert series (by nature of really being IBM
-	  drives).
-
-	  If you have such a drive, say Y here.
-
-config BLK_DEV_IDE_TCQ_DEFAULT
-	bool "TCQ on by default"
-	depends on BLK_DEV_IDE_TCQ
-	---help---
-	  Enable tagged command queueing unconditionally on drives that report
-	  support for it. Regardless of the chosen value here, tagging can be
-	  controlled at run time:
-
-	  echo "using_tcq:32" > /proc/ide/hdX/settings
-
-	  where any value between 1-32 selects chosen queue depth and enables
-	  TCQ, and 0 disables it. hdparm version 4.7 an above also support
-	  TCQ manipulations.
-
-	  Generally say Y here.
-
-config BLK_DEV_IDE_TCQ_DEPTH
-	int "Default queue depth"
-	depends on BLK_DEV_IDE_TCQ
-	default "8"
-	help
-	  Maximum size of commands to enable per-drive. Any value between 1
-	  and 32 is valid, with 32 being the maxium that the hardware supports.
-
-	  You probably just want the default of 32 here. If you enter an invalid
-	  number, the default value will be used.
-
 config BLK_DEV_IDEDMA_FORCED
 	bool "Force enable legacy 2.0.X HOSTS to use DMA"
 	help
@@ -851,9 +795,8 @@
 	  hardware may have caused damage.  Saying Y should be safe on all
 	  Apple machines.
 
-config BLK_DEV_IDE_SWARM
-	bool "SWARM onboard IDE support"
-	depends on SIBYTE_SWARM
+config IDE_ARM
+	def_bool ARM && (ARCH_A5K || ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
 
 config BLK_DEV_IDE_ICSIDE
 	tristate "ICS IDE interface support"
diff -Nru a/drivers/ide/Makefile b/drivers/ide/Makefile
--- a/drivers/ide/Makefile	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/Makefile	Tue Jun 15 22:20:40 2004
@@ -25,6 +25,9 @@
 ide-core-$(CONFIG_PROC_FS)		+= ide-proc.o
 ide-core-$(CONFIG_BLK_DEV_IDEPNP)	+= ide-pnp.o
 
+# built-in only drivers from arm/
+ide-core-$(CONFIG_IDE_ARM)		+= arm/ide_arm.o
+
 # built-in only drivers from legacy/
 ide-core-$(CONFIG_BLK_DEV_IDE_PC9800)	+= legacy/pc9800.o
 ide-core-$(CONFIG_BLK_DEV_BUDDHA)	+= legacy/buddha.o
@@ -36,7 +39,9 @@
 # built-in only drivers from ppc/
 ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE)	+= ppc/mpc8xx.o
 ide-core-$(CONFIG_BLK_DEV_IDE_PMAC)	+= ppc/pmac.o
-ide-core-$(CONFIG_BLK_DEV_IDE_SWARM)	+= ppc/swarm.o
+
+# built-in only drivers from h8300/
+ide-core-$(CONFIG_H8300)		+= h8300/ide-h8300.o
 
 obj-$(CONFIG_BLK_DEV_IDE)		+= ide-core.o
 obj-$(CONFIG_IDE_GENERIC)		+= ide-generic.o
diff -Nru a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/ide/arm/ide_arm.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,43 @@
+/*
+ * ARM/ARM26 default IDE host driver
+ *
+ * Copyright (C) 2004 Bartlomiej Zolnierkiewicz
+ * Based on code by: Russell King, Ian Molton and Alexander Schulz.
+ *
+ * May be copied or modified under the terms of the GNU General Public License.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/ide.h>
+
+#include <asm/mach-types.h>
+#include <asm/irq.h>
+
+#ifdef CONFIG_ARM26
+# define IDE_ARM_HOST	(machine_is_a5k())
+#else
+# define IDE_ARM_HOST	(1)
+#endif
+
+#ifdef CONFIG_ARCH_CLPS7500
+# include <asm/arch/hardware.h>
+#
+# define IDE_ARM_IO	(ISASLOT_IO + 0x1f0)
+# define IDE_ARM_IRQ	IRQ_ISA_14
+#else
+# define IDE_ARM_IO	0x1f0
+# define IDE_ARM_IRQ	IRQ_HARDDISK
+#endif
+
+void __init ide_arm_init(void)
+{
+	if (IDE_ARM_HOST) {
+		hw_regs_t hw;
+
+		memset(&hw, 0, sizeof(hw));
+		ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
+		hw.irq = IDE_ARM_IRQ;
+		ide_register_hw(&hw, NULL);
+	}
+}
diff -Nru a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/ide/h8300/ide-h8300.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,119 @@
+/*
+ * drivers/ide/ide-h8300.c
+ * H8/300 generic IDE interface
+ */
+
+#include <linux/init.h>
+#include <linux/ide.h>
+#include <linux/config.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+
+#define bswap(d) \
+({					\
+	u16 r;				\
+	__asm__("mov.b %w1,r1h\n\t"	\
+		"mov.b %x1,r1l\n\t"	\
+		"mov.w r1,%0"		\
+		:"=r"(r)		\
+		:"r"(d)			\
+		:"er1");		\
+	(r);				\
+})
+
+static void mm_outw(u16 d, unsigned long a)
+{
+	__asm__("mov.b %w0,r2h\n\t"
+		"mov.b %x0,r2l\n\t"
+		"mov.w r2,@%1"
+		:
+		:"r"(d),"r"(a)
+		:"er2");
+}
+
+static u16 mm_inw(unsigned long a)
+{
+	register u16 r __asm__("er0");
+	__asm__("mov.w @%1,r2\n\t"
+		"mov.b r2l,%x0\n\t"
+		"mov.b r2h,%w0"
+		:"=r"(r)
+		:"r"(a)
+		:"er2");
+	return r;
+}
+
+static void mm_outsw(unsigned long addr, void *buf, u32 len)
+{
+	unsigned short *bp = (unsigned short *)buf;
+	for (; len > 0; len--, bp++)
+		*(volatile u16 *)addr = bswap(*bp);
+}
+
+static void mm_insw(unsigned long addr, void *buf, u32 len)
+{
+	unsigned short *bp = (unsigned short *)buf;
+	for (; len > 0; len--, bp++)
+		*bp = bswap(*(volatile u16 *)addr);
+}
+
+#define H8300_IDE_GAP (2)
+
+static inline void hw_setup(hw_regs_t *hw)
+{
+	int i;
+
+	memset(hw, 0, sizeof(hw_regs_t));
+	for (i = 0; i <= IDE_STATUS_OFFSET; i++)
+		hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i;
+	hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT;
+	hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ;
+	hw->dma = NO_DMA;
+	hw->chipset = ide_generic;
+}
+
+static inline void hwif_setup(ide_hwif_t *hwif)
+{
+	default_hwif_iops(hwif);
+
+	hwif->mmio  = 2;
+	hwif->OUTW  = mm_outw;
+	hwif->OUTSW = mm_outsw;
+	hwif->INW   = mm_inw;
+	hwif->INSW  = mm_insw;
+	hwif->OUTL  = NULL;
+	hwif->INL   = NULL;
+	hwif->OUTSL = NULL;
+	hwif->INSL  = NULL;
+}
+
+void __init h8300_ide_init(void)
+{
+	hw_regs_t hw;
+	ide_hwif_t *hwif;
+	int idx;
+
+	if (!request_region(CONFIG_H8300_IDE_BASE, H8300_IDE_GAP*8, "ide-h8300"))
+		goto out_busy;
+	if (!request_region(CONFIG_H8300_IDE_ALT, H8300_IDE_GAP, "ide-h8300")) {
+		release_region(CONFIG_H8300_IDE_BASE, H8300_IDE_GAP*8);
+		goto out_busy;
+	}
+
+	hw_setup(&hw);
+
+	/* register if */
+	idx = ide_register_hw(&hw, &hwif);
+	if (idx == -1) {
+		printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
+		return;
+	}
+
+	hwif_setup(hwif);
+	printk(KERN_INFO "ide%d: H8/300 generic IDE interface\n", idx);
+	return;
+
+out_busy:
+	printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n");
+}
diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/ide-cd.c	Tue Jun 15 22:20:40 2004
@@ -535,9 +535,7 @@
 	rq->flags = REQ_PC;
 }
 
-static void cdrom_queue_request_sense(ide_drive_t *drive, 
-				      struct completion *wait,
-				      void *sense,
+static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
 				      struct request *failed_command)
 {
 	struct cdrom_info *info		= drive->driver_data;
@@ -554,7 +552,6 @@
 	rq->cmd[4] = rq->data_len = 18;
 
 	rq->flags = REQ_SENSE;
-	rq->waiting = wait;
 
 	/* NOTE! Save the failed command in "rq->buffer" */
 	rq->buffer = (void *) failed_command;
@@ -574,7 +571,7 @@
 	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
 		return ide_stopped;
 	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
+	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
 		rq->errors = 1;
 		ide_end_drive_cmd(drive, stat, err);
 		return ide_stopped;
@@ -608,7 +605,7 @@
 	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
 		return ide_stopped;
 	/* retry only "normal" I/O: */
-	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
+	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
 		rq->errors = 1;
 		ide_end_drive_cmd(drive, BUSY_STAT, 0);
 		return ide_stopped;
@@ -631,10 +628,21 @@
 		struct request *failed = (struct request *) rq->buffer;
 		struct cdrom_info *info = drive->driver_data;
 		void *sense = &info->sense_data;
-		
-		if (failed && failed->sense) {
-			sense = failed->sense;
-			failed->sense_len = rq->sense_len;
+		unsigned long flags;
+
+		if (failed) {
+			if (failed->sense) {
+				sense = failed->sense;
+				failed->sense_len = rq->sense_len;
+			}
+
+			/*
+			 * now end failed request
+			 */
+			spin_lock_irqsave(&ide_lock, flags);
+			end_that_request_chunk(failed, 0, failed->data_len);
+			end_that_request_last(failed);
+			spin_unlock_irqrestore(&ide_lock, flags);
 		}
 
 		cdrom_analyze_sense_data(drive, failed, sense);
@@ -642,6 +650,9 @@
 
 	if (!rq->current_nr_sectors && blk_fs_request(rq))
 		uptodate = 1;
+	/* make sure it's fully ended */
+	if (blk_pc_request(rq))
+		nsectors = (rq->data_len + 511) >> 9;
 	if (!nsectors)
 		nsectors = 1;
 
@@ -684,7 +695,7 @@
 
 	} else if (rq->flags & (REQ_PC | REQ_BLOCK_PC)) {
 		/* All other functions, except for READ. */
-		struct completion *wait = NULL;
+		unsigned long flags;
 
 		/*
 		 * if we have an error, pass back CHECK_CONDITION as the
@@ -706,30 +717,23 @@
 			ide_dump_status(drive, "packet command error", stat);
 		}
 		
-		/* Set the error flag and complete the request.
-		   Then, if we have a CHECK CONDITION status,
-		   queue a request sense command.  We must be careful,
-		   though: we don't want the thread in
-		   cdrom_queue_packet_command to wake up until
-		   the request sense has completed.  We do this
-		   by transferring the semaphore from the packet
-		   command request to the request sense request. */
-
 		rq->flags |= REQ_FAILED;
-		if ((stat & ERR_STAT) != 0) {
-			wait = rq->waiting;
-			rq->waiting = NULL;
-			if ((rq->flags & REQ_BLOCK_PC) != 0) {
-				cdrom_queue_request_sense(drive, wait,
-							  rq->sense, rq);
-				return 1; /* REQ_BLOCK_PC self-cares */
-			}
-		}
 
-		cdrom_end_request(drive, 0);
+		/*
+		 * instead of playing games with moving completions around,
+		 * remove failed request completely and end it when the
+		 * request sense has completed
+		 */
+		if (stat & ERR_STAT) {
+			spin_lock_irqsave(&ide_lock, flags);
+			blkdev_dequeue_request(rq);
+			HWGROUP(drive)->rq = NULL;
+			spin_unlock_irqrestore(&ide_lock, flags);
+
+			cdrom_queue_request_sense(drive, rq->sense, rq);
+		} else
+			cdrom_end_request(drive, 0);
 
-		if ((stat & ERR_STAT) != 0)
-			cdrom_queue_request_sense(drive, wait, rq->sense, rq);
 	} else if (blk_fs_request(rq)) {
 		int do_end_request = 0;
 
@@ -818,7 +822,7 @@
 		/* If we got a CHECK_CONDITION status,
 		   queue a request sense command. */
 		if ((stat & ERR_STAT) != 0)
-			cdrom_queue_request_sense(drive, NULL, NULL, NULL);
+			cdrom_queue_request_sense(drive, NULL, NULL);
 	} else {
 		blk_dump_rq_flags(rq, "ide-cd: bad rq");
 		cdrom_end_request(drive, 0);
@@ -1666,14 +1670,8 @@
 		dma_error = HWIF(drive)->ide_dma_end(drive);
 	}
 
-	if (cdrom_decode_status(drive, 0, &stat)) {
-		if ((stat & ERR_STAT) != 0) {
-			end_that_request_chunk(rq, 0, rq->data_len);
-			goto end_request; /* purge the whole thing... */
-		}
-		end_that_request_chunk(rq, 1, rq->data_len);
+	if (cdrom_decode_status(drive, 0, &stat))
 		return ide_stopped;
-	}
 
 	/*
 	 * using dma, transfer is complete now
@@ -2491,7 +2489,7 @@
 
 /* the generic packet interface to cdrom.c */
 static int ide_cdrom_packet(struct cdrom_device_info *cdi,
-			    struct cdrom_generic_command *cgc)
+			    struct packet_command *cgc)
 {
 	struct request req;
 	ide_drive_t *drive = (ide_drive_t*) cdi->handle;
@@ -2524,7 +2522,7 @@
 int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi,
 			 unsigned int cmd, unsigned long arg)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	char buffer[16];
 	int stat;
 
@@ -2535,7 +2533,7 @@
  	case CDROMSETSPINDOWN: {
  		char spindown;
  
- 		if (copy_from_user(&spindown, (void *) arg, sizeof(char)))
+ 		if (copy_from_user(&spindown, (void __user *) arg, sizeof(char)))
 			return -EFAULT;
  
                 if ((stat = cdrom_mode_sense(cdi, &cgc, GPMODE_CDROM_PAGE, 0)))
@@ -2554,7 +2552,7 @@
  
  		spindown = buffer[11] & 0x0f;
  
-		if (copy_to_user((void *) arg, &spindown, sizeof (char)))
+		if (copy_to_user((void __user *) arg, &spindown, sizeof (char)))
 			return -EFAULT;
  
  		return 0;
@@ -2908,7 +2906,7 @@
 {
 	struct cdrom_info *info = drive->driver_data;
 	struct cdrom_device_info *cdi = &info->devinfo;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	int stat, attempts = 3, size = sizeof(*cap);
 
 	/*
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/ide-disk.c	Tue Jun 15 22:20:39 2004
@@ -45,6 +45,8 @@
 
 #undef REALLY_SLOW_IO		/* most systems can safely undef this */
 
+//#define DEBUG
+
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
@@ -118,20 +120,6 @@
 	return 0;	/* lba_capacity value may be bad */
 }
 
-static int idedisk_start_tag(ide_drive_t *drive, struct request *rq)
-{
-	unsigned long flags;
-	int ret = 1;
-
-	spin_lock_irqsave(&ide_lock, flags);
-
-	if (ata_pending_commands(drive) < drive->queue_depth)
-		ret = blk_queue_start_tag(drive->queue, rq);
-
-	spin_unlock_irqrestore(&ide_lock, flags);
-	return ret;
-}
-
 #ifndef CONFIG_IDE_TASKFILE_IO
 
 /*
@@ -358,13 +346,6 @@
 
 	nsectors.all		= (u16) rq->nr_sectors;
 
-	if (drive->using_tcq && idedisk_start_tag(drive, rq)) {
-		if (!ata_pending_commands(drive))
-			BUG();
-
-		return ide_started;
-	}
-
 	if (IDE_CONTROL_REG)
 		hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
 
@@ -372,18 +353,12 @@
 		if (drive->addressing == 1) {
 			task_ioreg_t tasklets[10];
 
-			if (blk_rq_tagged(rq)) {
-				tasklets[0] = nsectors.b.low;
-				tasklets[1] = nsectors.b.high;
-				tasklets[2] = rq->tag << 3;
-				tasklets[3] = 0;
-			} else {
-				tasklets[0] = 0;
-				tasklets[1] = 0;
-				tasklets[2] = nsectors.b.low;
-				tasklets[3] = nsectors.b.high;
-			}
+			pr_debug("%s: LBA=0x%012llx\n", drive->name, block);
 
+			tasklets[0] = 0;
+			tasklets[1] = 0;
+			tasklets[2] = nsectors.b.low;
+			tasklets[3] = nsectors.b.high;
 			tasklets[4] = (task_ioreg_t) block;
 			tasklets[5] = (task_ioreg_t) (block>>8);
 			tasklets[6] = (task_ioreg_t) (block>>16);
@@ -396,14 +371,6 @@
 				tasklets[9] = (task_ioreg_t)((u64)block >> 40);
 			}
 #ifdef DEBUG
-			printk("%s: %sing: LBAsect=%lu, sectors=%ld, "
-				"buffer=0x%08lx, LBAsect=0x%012lx\n",
-				drive->name,
-				rq_data_dir(rq)==READ?"read":"writ",
-				block,
-				rq->nr_sectors,
-				(unsigned long) rq->buffer,
-				block);
 			printk("%s: 0x%02x%02x 0x%02x%02x%02x%02x%02x%02x\n",
 				drive->name, tasklets[3], tasklets[2],
 				tasklets[9], tasklets[8], tasklets[7],
@@ -422,22 +389,8 @@
 			hwif->OUTB(tasklets[6], IDE_HCYL_REG);
 			hwif->OUTB(0x00|drive->select.all,IDE_SELECT_REG);
 		} else {
-#ifdef DEBUG
-			printk("%s: %sing: LBAsect=%llu, sectors=%ld, "
-				"buffer=0x%08lx\n",
-				drive->name,
-				rq_data_dir(rq)==READ?"read":"writ",
-				(unsigned long long)block, rq->nr_sectors,
-				(unsigned long) rq->buffer);
-#endif
-			if (blk_rq_tagged(rq)) {
-				hwif->OUTB(nsectors.b.low, IDE_FEATURE_REG);
-				hwif->OUTB(rq->tag << 3, IDE_NSECTOR_REG);
-			} else {
-				hwif->OUTB(0x00, IDE_FEATURE_REG);
-				hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG);
-			}
-
+			hwif->OUTB(0x00, IDE_FEATURE_REG);
+			hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG);
 			hwif->OUTB(block, IDE_SECTOR_REG);
 			hwif->OUTB(block>>=8, IDE_LCYL_REG);
 			hwif->OUTB(block>>=8, IDE_HCYL_REG);
@@ -451,29 +404,16 @@
 		head  = track % drive->head;
 		cyl   = track / drive->head;
 
-		if (blk_rq_tagged(rq)) {
-			hwif->OUTB(nsectors.b.low, IDE_FEATURE_REG);
-			hwif->OUTB(rq->tag << 3, IDE_NSECTOR_REG);
-		} else {
-			hwif->OUTB(0x00, IDE_FEATURE_REG);
-			hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG);
-		}
+		pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect);
 
+		hwif->OUTB(0x00, IDE_FEATURE_REG);
+		hwif->OUTB(nsectors.b.low, IDE_NSECTOR_REG);
 		hwif->OUTB(cyl, IDE_LCYL_REG);
 		hwif->OUTB(cyl>>8, IDE_HCYL_REG);
 		hwif->OUTB(head|drive->select.all,IDE_SELECT_REG);
-#ifdef DEBUG
-		printk("%s: %sing: CHS=%d/%d/%d, sectors=%ld, buffer=0x%08lx\n",
-			drive->name, rq_data_dir(rq)==READ?"read":"writ", cyl,
-			head, sect, rq->nr_sectors, (unsigned long) rq->buffer);
-#endif
 	}
 
 	if (rq_data_dir(rq) == READ) {
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
-		if (blk_rq_tagged(rq))
-			return __ide_dma_queued_read(drive);
-#endif
 		if (drive->using_dma && !hwif->ide_dma_read(drive))
 			return ide_started;
 
@@ -482,12 +422,9 @@
 			   ((lba48) ? WIN_READ_EXT : WIN_READ));
 		ide_execute_command(drive, command, &read_intr, WAIT_CMD, NULL);
 		return ide_started;
-	} else if (rq_data_dir(rq) == WRITE) {
+	} else {
 		ide_startstop_t startstop;
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
-		if (blk_rq_tagged(rq))
-			return __ide_dma_queued_write(drive);
-#endif
+
 		if (drive->using_dma && !(HWIF(drive)->ide_dma_write(drive)))
 			return ide_started;
 
@@ -520,9 +457,6 @@
 		}
 		return ide_started;
 	}
-	blk_dump_rq_flags(rq, "__ide_do_rw_disk - bad command");
-	ide_end_request(drive, 0, 0);
-	return ide_stopped;
 }
 EXPORT_SYMBOL_GPL(__ide_do_rw_disk);
 
@@ -539,26 +473,11 @@
  */
 ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block)
 {
-	BUG_ON(drive->blocked);
-	if (!blk_fs_request(rq)) {
-		blk_dump_rq_flags(rq, "__ide_do_rw_disk - bad command");
-		ide_end_request(drive, 0, 0);
-		return ide_stopped;
-	}
-
 	/*
 	 * 268435455  == 137439 MB or 28bit limit
 	 *
 	 * need to add split taskfile operations based on 28bit threshold.
 	 */
-
-	if (drive->using_tcq && idedisk_start_tag(drive, rq)) {
-		if (!ata_pending_commands(drive))
-			BUG();
-
-		return ide_started;
-	}
-
 	if (drive->addressing == 1)		/* 48-bit LBA */
 		return lba_48_rw_disk(drive, rq, (unsigned long long) block);
 	if (drive->select.b.lba)		/* 28-bit LBA */
@@ -575,8 +494,6 @@
 
 	if (cmd == READ) {
 		task->command_type = IDE_DRIVE_TASK_IN;
-		if (drive->using_tcq)
-			return lba48 ? WIN_READDMA_QUEUED_EXT : WIN_READDMA_QUEUED;
 		if (drive->using_dma)
 			return lba48 ? WIN_READDMA_EXT : WIN_READDMA;
 		if (drive->mult_count) {
@@ -587,8 +504,6 @@
 		return lba48 ? WIN_READ_EXT : WIN_READ;
 	} else {
 		task->command_type = IDE_DRIVE_TASK_RAW_WRITE;
-		if (drive->using_tcq)
-			return lba48 ? WIN_WRITEDMA_QUEUED_EXT : WIN_WRITEDMA_QUEUED;
 		if (drive->using_dma)
 			return lba48 ? WIN_WRITEDMA_EXT : WIN_WRITEDMA;
 		if (drive->mult_count) {
@@ -614,23 +529,13 @@
 
 	nsectors.all = (u16) rq->nr_sectors;
 
-#ifdef DEBUG
-	printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ");
-	printk("CHS=%d/%d/%d, ", cyl, head, sect);
-	printk("sectors=%ld, ", rq->nr_sectors);
-	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
-#endif
+	pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect);
 
 	memset(&args, 0, sizeof(ide_task_t));
 
 	sectors	= (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors;
 
-	if (blk_rq_tagged(rq)) {
-		args.tfRegister[IDE_FEATURE_OFFSET] = sectors;
-		args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3;
-	} else
-		args.tfRegister[IDE_NSECTOR_OFFSET] = sectors;
-
+	args.tfRegister[IDE_NSECTOR_OFFSET]	= sectors;
 	args.tfRegister[IDE_SECTOR_OFFSET]	= sect;
 	args.tfRegister[IDE_LCYL_OFFSET]	= cyl;
 	args.tfRegister[IDE_HCYL_OFFSET]	= (cyl>>8);
@@ -650,23 +555,11 @@
 
 	nsectors.all = (u16) rq->nr_sectors;
 
-#ifdef DEBUG
-	printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ");
-	printk("LBAsect=%lld, ", block);
-	printk("sectors=%ld, ", rq->nr_sectors);
-	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
-#endif
-
 	memset(&args, 0, sizeof(ide_task_t));
 
 	sectors = (rq->nr_sectors == 256) ? 0x00 : rq->nr_sectors;
 
-	if (blk_rq_tagged(rq)) {
-		args.tfRegister[IDE_FEATURE_OFFSET] = sectors;
-		args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3;
-	} else
-		args.tfRegister[IDE_NSECTOR_OFFSET] = sectors;
-
+	args.tfRegister[IDE_NSECTOR_OFFSET]	= sectors;
 	args.tfRegister[IDE_SECTOR_OFFSET]	= block;
 	args.tfRegister[IDE_LCYL_OFFSET]	= (block>>=8);
 	args.tfRegister[IDE_HCYL_OFFSET]	= (block>>=8);
@@ -692,27 +585,12 @@
 
 	nsectors.all = (u16) rq->nr_sectors;
 
-#ifdef DEBUG
-	printk("%s: %sing: ", drive->name, (rq_data_dir(rq)==READ) ? "read" : "writ");
-	printk("LBAsect=%lld, ", block);
-	printk("sectors=%ld, ", rq->nr_sectors);
-	printk("buffer=0x%08lx\n", (unsigned long) rq->buffer);
-#endif
-
 	memset(&args, 0, sizeof(ide_task_t));
 
 	sectors = (rq->nr_sectors == 65536) ? 0 : rq->nr_sectors;
 
-	if (blk_rq_tagged(rq)) {
-		args.tfRegister[IDE_FEATURE_OFFSET] = sectors;
-		args.tfRegister[IDE_NSECTOR_OFFSET] = rq->tag << 3;
-		args.hobRegister[IDE_FEATURE_OFFSET] = sectors >> 8;
-		args.hobRegister[IDE_NSECTOR_OFFSET] = 0;
-	} else {
-		args.tfRegister[IDE_NSECTOR_OFFSET] = sectors;
-		args.hobRegister[IDE_NSECTOR_OFFSET] = sectors >> 8;
-	}
-
+	args.tfRegister[IDE_NSECTOR_OFFSET]	= sectors;
+	args.hobRegister[IDE_NSECTOR_OFFSET]	= sectors >> 8;
 	args.tfRegister[IDE_SECTOR_OFFSET]	= block;	/* low lba */
 	args.tfRegister[IDE_LCYL_OFFSET]	= (block>>=8);	/* mid lba */
 	args.tfRegister[IDE_HCYL_OFFSET]	= (block>>=8);	/* hi  lba */
@@ -734,14 +612,24 @@
 {
 	ide_hwif_t *hwif = HWIF(drive);
 
+	BUG_ON(drive->blocked);
+
+	if (!blk_fs_request(rq)) {
+		blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command");
+		ide_end_request(drive, 0, 0);
+		return ide_stopped;
+	}
+
+	pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n",
+		 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
+		 block, rq->nr_sectors, (unsigned long)rq->buffer);
+
 	if (hwif->rw_disk)
 		return hwif->rw_disk(drive, rq, block);
 	else
 		return __ide_do_rw_disk(drive, rq, block);
 }
 
-static int do_idedisk_flushcache(ide_drive_t *drive);
-
 static u8 idedisk_dump_status (ide_drive_t *drive, const char *msg, u8 stat)
 {
 	ide_hwif_t *hwif = HWIF(drive);
@@ -823,7 +711,6 @@
 	ide_hwif_t *hwif;
 	struct request *rq;
 	u8 err;
-	int i = (drive->mult_count ? drive->mult_count : 1) * SECTOR_WORDS;
 
 	err = idedisk_dump_status(drive, msg, stat);
 
@@ -863,22 +750,8 @@
 			rq->errors |= ERROR_RECAL;
 		}
 	}
-	if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ) {
-		/*
-		 * try_to_flush_leftover_data() is invoked in response to
-		 * a drive unexpectedly having its DRQ_STAT bit set.  As
-		 * an alternative to resetting the drive, this routine
-		 * tries to clear the condition by read a sector's worth
-		 * of data from the drive.  Of course, this may not help
-		 * if the drive is *waiting* for data from *us*.
-		 */
-		while (i > 0) {
-			u32 buffer[16];
-			unsigned int wcount = (i > 16) ? 16 : i;
-			i -= wcount;
-			taskfile_input_data(drive, buffer, wcount);
-		}
-	}
+	if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)
+		try_to_flush_leftover_data(drive);
 	if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) {
 		/* force an abort */
 		hwif->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
@@ -975,7 +848,6 @@
 	return addr;
 }
 
-#ifdef CONFIG_IDEDISK_STROKE
 /*
  * Sets maximum virtual LBA address of the drive.
  * Returns new maximum virtual LBA address (> 0) or 0 on failure.
@@ -1044,8 +916,6 @@
 	return addr_set;
 }
 
-#endif /* CONFIG_IDEDISK_STROKE */
-
 static unsigned long long sectors_to_MB(unsigned long long n)
 {
 	n <<= 9;		/* make it bytes */
@@ -1092,7 +962,10 @@
 			 drive->name,
 			 capacity, sectors_to_MB(capacity),
 			 set_max, sectors_to_MB(set_max));
-#ifdef CONFIG_IDEDISK_STROKE
+
+	if (!drive->stroke)
+		return;
+
 	if (lba48)
 		set_max = idedisk_set_max_address_ext(drive, set_max);
 	else
@@ -1102,7 +975,6 @@
 		printk(KERN_INFO "%s: Host Protected Area disabled.\n",
 				 drive->name);
 	}
-#endif
 }
 
 /*
@@ -1359,11 +1231,18 @@
 	return 0;
 }
 
+/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */
+#define ide_id_has_flush_cache(id)	((id)->cfs_enable_2 & 0x3000)
+
+/* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */
+#define ide_id_has_flush_cache_ext(id)	\
+	(((id)->cfs_enable_2 & 0x2400) == 0x2400)
+
 static int write_cache (ide_drive_t *drive, int arg)
 {
 	ide_task_t args;
 
-	if (!(drive->id->cfs_enable_2 & 0x3000))
+	if (!ide_id_has_flush_cache(drive->id))
 		return 1;
 
 	memset(&args, 0, sizeof(ide_task_t));
@@ -1383,7 +1262,7 @@
 	ide_task_t args;
 
 	memset(&args, 0, sizeof(ide_task_t));
-	if (drive->id->cfs_enable_2 & 0x2400)
+	if (ide_id_has_flush_cache_ext(drive->id))
 		args.tfRegister[IDE_COMMAND_OFFSET]	= WIN_FLUSH_CACHE_EXT;
 	else
 		args.tfRegister[IDE_COMMAND_OFFSET]	= WIN_FLUSH_CACHE;
@@ -1408,34 +1287,6 @@
 	return 0;
 }
 
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
-static int set_using_tcq(ide_drive_t *drive, int arg)
-{
-	int ret;
-
-	if (!drive->driver)
-		return -EPERM;
-	if (arg == drive->queue_depth && drive->using_tcq)
-		return 0;
-
-	/*
-	 * set depth, but check also id for max supported depth
-	 */
-	drive->queue_depth = arg ? arg : 1;
-	if (drive->id) {
-		if (drive->queue_depth > drive->id->queue_depth + 1)
-			drive->queue_depth = drive->id->queue_depth + 1;
-	}
-
-	if (arg)
-		ret = __ide_dma_queued_on(drive);
-	else
-		ret = __ide_dma_queued_off(drive);
-
-	return ret ? -EIO : 0;
-}
-#endif
-
 /*
  * drive->addressing:
  *	0: 28-bit
@@ -1471,9 +1322,6 @@
 	ide_add_setting(drive,	"acoustic",		SETTING_RW,					HDIO_GET_ACOUSTIC,	HDIO_SET_ACOUSTIC,	TYPE_BYTE,	0,	254,				1,	1,	&drive->acoustic,		set_acoustic);
  	ide_add_setting(drive,	"failures",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	65535,				1,	1,	&drive->failures,		NULL);
  	ide_add_setting(drive,	"max_failures",		SETTING_RW,					-1,			-1,			TYPE_INT,	0,	65535,				1,	1,	&drive->max_failures,		NULL);
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
-	ide_add_setting(drive,	"using_tcq",		SETTING_RW,					HDIO_GET_QDMA,		HDIO_SET_QDMA,		TYPE_BYTE,	0,	IDE_MAX_TAG,			1,		1,		&drive->using_tcq,		set_using_tcq);
-#endif
 }
 
 /*
@@ -1513,11 +1361,11 @@
 	switch (rq->pm->pm_step) {
 	case idedisk_pm_flush_cache:	/* Suspend step 1 (flush cache) */
 		/* Not supported? Switch to next step now. */
-		if (!drive->wcache) {
+		if (!drive->wcache || !ide_id_has_flush_cache(drive->id)) {
 			idedisk_complete_power_step(drive, rq, 0, 0);
 			return ide_stopped;
 		}
-		if (drive->id->cfs_enable_2 & 0x2400)
+		if (ide_id_has_flush_cache_ext(drive->id))
 			args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT;
 		else
 			args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE;
@@ -1678,18 +1526,25 @@
 #endif	/* CONFIG_IDEDISK_MULTI_MODE */
 	}
 	drive->no_io_32bit = id->dword_io ? 1 : 0;
-	if (drive->id->cfs_enable_2 & 0x3000)
-		write_cache(drive, (id->cfs_enable_2 & 0x3000));
 
-#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
-	if (drive->using_dma)
-		__ide_dma_queued_on(drive);
-#endif
+	/* write cache enabled? */
+	if ((id->csfo & 1) || (id->cfs_enable_1 & (1 << 5)))
+		drive->wcache = 1;
+
+	write_cache(drive, 1);
+}
+
+static void ide_cacheflush_p(ide_drive_t *drive)
+{
+	if (!drive->wcache || !ide_id_has_flush_cache(drive->id))
+		return;
+
+	if (do_idedisk_flushcache(drive))
+		printk(KERN_INFO "%s: wcache flush failed!\n", drive->name);
 }
 
 static int idedisk_cleanup (ide_drive_t *drive)
 {
-	static int ide_cacheflush_p(ide_drive_t *drive);
 	struct gendisk *g = drive->disk;
 	ide_cacheflush_p(drive);
 	if (ide_unregister_subdriver(drive))
@@ -1706,6 +1561,26 @@
 {
 	ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
 
+#ifdef	CONFIG_ALPHA
+	/* On Alpha, halt(8) doesn't actually turn the machine off,
+	   it puts you into the sort of firmware monitor. Typically,
+	   it's used to boot another kernel image, so it's not much
+	   different from reboot(8). Therefore, we don't need to
+	   spin down the disk in this case, especially since Alpha
+	   firmware doesn't handle disks in standby mode properly.
+	   On the other hand, it's reasonably safe to turn the power
+	   off when the shutdown process reaches the firmware prompt,
+	   as the firmware initialization takes rather long time -
+	   at least 10 seconds, which should be sufficient for
+	   the disk to expire its write cache. */
+	if (system_state != SYSTEM_POWER_OFF) {
+#else
+	if (system_state == SYSTEM_RESTART) {
+#endif
+		ide_cacheflush_p(drive);
+		return;
+	}
+
 	printk("Shutdown: %s\n", drive->name);
 	dev->bus->suspend(dev, PM_SUSPEND_STANDBY);
 }
@@ -1740,7 +1615,6 @@
 
 static int idedisk_open(struct inode *inode, struct file *filp)
 {
-	u8 cf;
 	ide_drive_t *drive = inode->i_bdev->bd_disk->private_data;
 	drive->usage++;
 	if (drive->removable && drive->usage == 1) {
@@ -1758,35 +1632,6 @@
 		if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL))
 			drive->doorlocking = 0;
 	}
-	drive->wcache = 0;
-	/* Cache enabled? */
-	if (drive->id->csfo & 1)
-		drive->wcache = 1;
-	/* Cache command set available? */
-	if (drive->id->cfs_enable_1 & (1 << 5))
-		drive->wcache = 1;
-	/* ATA6 cache extended commands */
-	cf = drive->id->command_set_2 >> 24;
-	if ((cf & 0xC0) == 0x40 && (cf & 0x30) != 0)
-		drive->wcache = 1;
-	return 0;
-}
-
-static int ide_cacheflush_p(ide_drive_t *drive)
-{
-	if (!(drive->id->cfs_enable_2 & 0x3000))
-		return 0;
-
-	if(drive->wcache)
-	{
-		if (do_idedisk_flushcache(drive))
-		{
-			printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
-				drive->name);
-			return -EIO;
-		}
-		return 1;
-	}
 	return 0;
 }
 
@@ -1867,10 +1712,7 @@
 	if ((!drive->head || drive->head > 16) && !drive->select.b.lba) {
 		printk(KERN_ERR "%s: INVALID GEOMETRY: %d PHYSICAL HEADS?\n",
 			drive->name, drive->head);
-		if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
-			if (do_idedisk_flushcache(drive))
-				printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
-					drive->name);
+		ide_cacheflush_p(drive);
 		ide_unregister_subdriver(drive);
 		DRIVER(drive)->busy--;
 		goto failed;
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
--- a/drivers/ide/ide-dma.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/ide-dma.c	Tue Jun 15 22:20:40 2004
@@ -513,9 +513,7 @@
 
 	if (HWIF(drive)->ide_dma_host_off(drive))
 		return 1;
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
-	__ide_dma_queued_off(drive);
-#endif
+
 	return 0;
 }
 
diff -Nru a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
--- a/drivers/ide/ide-floppy.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/ide-floppy.c	Tue Jun 15 22:20:40 2004
@@ -1482,7 +1482,7 @@
 **
 */
 
-static int idefloppy_get_format_capacities(ide_drive_t *drive, int *arg)
+static int idefloppy_get_format_capacities(ide_drive_t *drive, int __user *arg)
 {
         idefloppy_pc_t pc;
 	idefloppy_capacity_header_t *header;
@@ -1490,7 +1490,7 @@
 	int i, descriptors, blocks, length;
 	int u_array_size;
 	int u_index;
-	int *argp;
+	int __user *argp;
 
 	if (get_user(u_array_size, arg))
 		return (-EFAULT);
@@ -1558,7 +1558,7 @@
 **        0x01 - verify media after format.
 */
 
-static int idefloppy_begin_format(ide_drive_t *drive, int *arg)
+static int idefloppy_begin_format(ide_drive_t *drive, int __user *arg)
 {
 	int blocks;
 	int length;
@@ -1591,7 +1591,7 @@
 ** the dsc bit, and return either 0 or 65536.
 */
 
-static int idefloppy_get_format_progress(ide_drive_t *drive, int *arg)
+static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg)
 {
 	idefloppy_floppy_t *floppy = drive->driver_data;
 	idefloppy_pc_t pc;
@@ -1945,6 +1945,7 @@
 	struct block_device *bdev = inode->i_bdev;
 	ide_drive_t *drive = bdev->bd_disk->private_data;
 	idefloppy_floppy_t *floppy = drive->driver_data;
+	void __user *argp = (void __user *)arg;
 	int err = generic_ide_ioctl(bdev, cmd, arg);
 	int prevent = (arg) ? 1 : 0;
 	idefloppy_pc_t pc;
@@ -1972,7 +1973,7 @@
 	case IDEFLOPPY_IOCTL_FORMAT_SUPPORTED:
 		return 0;
 	case IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY:
-		return idefloppy_get_format_capacities(drive, (int *)arg);
+		return idefloppy_get_format_capacities(drive, argp);
 	case IDEFLOPPY_IOCTL_FORMAT_START:
 
 		if (!(file->f_mode & 2))
@@ -1988,7 +1989,7 @@
 
 		set_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags);
 
-		err = idefloppy_begin_format(drive, (int *)arg);
+		err = idefloppy_begin_format(drive, argp);
 		if (err)
 			clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS, &floppy->flags);
 		return err;
@@ -1999,7 +2000,7 @@
 		** format progress reporting.
 		*/
 	case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
-		return idefloppy_get_format_progress(drive, (int *)arg);
+		return idefloppy_get_format_progress(drive, argp);
 	}
  	return -EINVAL;
 }
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/ide/ide-io.c	Tue Jun 15 22:20:44 2004
@@ -97,10 +97,7 @@
 
 	if (!end_that_request_first(rq, uptodate, nr_sectors)) {
 		add_disk_randomness(rq->rq_disk);
-		if (!blk_rq_tagged(rq))
-			blkdev_dequeue_request(rq);
-		else
-			blk_queue_end_tag(drive->queue, rq);
+		blkdev_dequeue_request(rq);
 		HWGROUP(drive)->rq = NULL;
 		end_that_request_last(rq);
 		ret = 0;
@@ -855,18 +852,7 @@
 		drive->sleep = 0;
 		drive->service_start = jiffies;
 
-queue_next:
-		if (!ata_can_queue(drive)) {
-			if (!ata_pending_commands(drive))
-				hwgroup->busy = 0;
-
-			break;
-		}
-
 		if (blk_queue_plugged(drive->queue)) {
-			if (drive->using_tcq)
-				break;
-
 			printk(KERN_ERR "ide: huh? queue was plugged!\n");
 			break;
 		}
@@ -877,7 +863,7 @@
 		 */
 		rq = elv_next_request(drive->queue);
 		if (!rq) {
-			hwgroup->busy = !!ata_pending_commands(drive);
+			hwgroup->busy = 0;
 			break;
 		}
 
@@ -900,9 +886,6 @@
 			break;
 		}
 
-		if (!rq->bio && ata_pending_commands(drive))
-			break;
-
 		hwgroup->rq = rq;
 
 		/*
@@ -922,8 +905,6 @@
 		spin_lock_irq(&ide_lock);
 		if (hwif->irq != masked_irq)
 			enable_irq(hwif->irq);
-		if (startstop == ide_released)
-			goto queue_next;
 		if (startstop == ide_stopped)
 			hwgroup->busy = 0;
 	}
@@ -1388,6 +1369,7 @@
 	err = 0;
 	if (must_wait) {
 		wait_for_completion(&wait);
+		rq->waiting = NULL;
 		if (rq->errors)
 			err = -EIO;
 
diff -Nru a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
--- a/drivers/ide/ide-iops.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/ide-iops.c	Tue Jun 15 22:20:39 2004
@@ -46,7 +46,7 @@
 
 static void ide_insw (unsigned long port, void *addr, u32 count)
 {
-	return insw(port, addr, count);
+	insw(port, addr, count);
 }
 
 static u32 ide_inl (unsigned long port)
@@ -767,7 +767,7 @@
 	SELECT_MASK(drive, 1);
 	if (IDE_CONTROL_REG)
 		hwif->OUTB(drive->ctl,IDE_CONTROL_REG);
-	ide_delay_50ms();
+	msleep(50);
 	hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG);
 	timeout = jiffies + WAIT_WORSTCASE;
 	do {
@@ -775,9 +775,9 @@
 			SELECT_MASK(drive, 0);
 			return 0;	/* drive timed-out */
 		}
-		ide_delay_50ms();	/* give drive a breather */
+		msleep(50);	/* give drive a breather */
 	} while (hwif->INB(IDE_ALTSTATUS_REG) & BUSY_STAT);
-	ide_delay_50ms();	/* wait for IRQ and DRQ_STAT */
+	msleep(50);	/* wait for IRQ and DRQ_STAT */
 	if (!OK_STAT(hwif->INB(IDE_STATUS_REG),DRQ_STAT,BAD_R_STAT)) {
 		SELECT_MASK(drive, 0);
 		printk("%s: CHECK for good STATUS\n", drive->name);
@@ -827,7 +827,7 @@
 	u8 stat;
 
 //	while (HWGROUP(drive)->busy)
-//		ide_delay_50ms();
+//		msleep(50);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
 	if (hwif->ide_dma_check)	 /* check if host supports DMA */
diff -Nru a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
--- a/drivers/ide/ide-pnp.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/ide/ide-pnp.c	Tue Jun 15 22:20:41 2004
@@ -16,25 +16,9 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
  */
 
-#include <linux/ide.h>
 #include <linux/init.h>
-
 #include <linux/pnp.h>
-
-#define GENERIC_HD_DATA		0
-#define GENERIC_HD_ERROR	1
-#define GENERIC_HD_NSECTOR	2
-#define GENERIC_HD_SECTOR	3
-#define GENERIC_HD_LCYL		4
-#define GENERIC_HD_HCYL		5
-#define GENERIC_HD_SELECT	6
-#define GENERIC_HD_STATUS	7
-
-static int generic_ide_offsets[IDE_NR_PORTS] = {
-	GENERIC_HD_DATA, GENERIC_HD_ERROR, GENERIC_HD_NSECTOR, 
-	GENERIC_HD_SECTOR, GENERIC_HD_LCYL, GENERIC_HD_HCYL,
-	GENERIC_HD_SELECT, GENERIC_HD_STATUS, -1, -1
-};
+#include <linux/ide.h>
 
 /* Add your devices here :)) */
 struct pnp_device_id idepnp_devices[] = {
@@ -52,12 +36,11 @@
 	if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
 		return -1;
 
-	ide_setup_ports(&hw, (unsigned long) pnp_port_start(dev, 0),
-			generic_ide_offsets,
-			(unsigned long) pnp_port_start(dev, 1),
-			0, NULL,
-//			generic_pnp_ide_iops,
-			pnp_irq(dev, 0));
+	memset(&hw, 0, sizeof(hw));
+	ide_std_init_ports(&hw, pnp_port_start(dev, 0),
+				pnp_port_start(dev, 1));
+	hw.irq = pnp_irq(dev, 0);
+	hw.dma = NO_DMA;
 
 	index = ide_register_hw(&hw, &hwif);
 
@@ -86,11 +69,7 @@
 	.remove		= idepnp_remove,
 };
 
-
-void pnpide_init(int enable)
+void __init pnpide_init(void)
 {
-	if(enable)
-		pnp_register_driver(&idepnp_driver);
-	else
-		pnp_unregister_driver(&idepnp_driver);
+	pnp_register_driver(&idepnp_driver);
 }
diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/ide/ide-probe.c	Tue Jun 15 22:20:41 2004
@@ -241,17 +241,6 @@
 	drive->media = ide_disk;
 	printk("%s DISK drive\n", (drive->is_flash) ? "CFA" : "ATA" );
 	QUIRK_LIST(drive);
-
-	/* Initialize queue depth settings */
-	drive->queue_depth = 1;
-#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEPTH
-	drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH;
-#else
-	drive->queue_depth = drive->id->queue_depth + 1;
-#endif
-	if (drive->queue_depth < 1 || drive->queue_depth > IDE_MAX_TAG)
-		drive->queue_depth = IDE_MAX_TAG;
-
 	return;
 
 err_misc:
@@ -283,9 +272,10 @@
 	unsigned long timeout;
 	u8 s = 0, a = 0;
 
+	/* take a deep breath */
+	msleep(50);
+
 	if (IDE_CONTROL_REG) {
-		/* take a deep breath */
-		ide_delay_50ms();
 		a = hwif->INB(IDE_ALTSTATUS_REG);
 		s = hwif->INB(IDE_STATUS_REG);
 		if ((a ^ s) & ~INDEX_STAT) {
@@ -297,10 +287,8 @@
 			/* use non-intrusive polling */
 			hd_status = IDE_ALTSTATUS_REG;
 		}
-	} else {
-		ide_delay_50ms();
+	} else
 		hd_status = IDE_STATUS_REG;
-	}
 
 	/* set features register for atapi
 	 * identify command to be sure of reply
@@ -324,11 +312,11 @@
 			return 1;
 		}
 		/* give drive a breather */
-		ide_delay_50ms();
+		msleep(50);
 	} while ((hwif->INB(hd_status)) & BUSY_STAT);
 
 	/* wait for IRQ and DRQ_STAT */
-	ide_delay_50ms();
+	msleep(50);
 	if (OK_STAT((hwif->INB(IDE_STATUS_REG)), DRQ_STAT, BAD_R_STAT)) {
 		unsigned long flags;
 
@@ -457,15 +445,15 @@
 	/* needed for some systems
 	 * (e.g. crw9624 as drive0 with disk as slave)
 	 */
-	ide_delay_50ms();
+	msleep(50);
 	SELECT_DRIVE(drive);
-	ide_delay_50ms();
+	msleep(50);
 	if (hwif->INB(IDE_SELECT_REG) != drive->select.all && !drive->present) {
 		if (drive->select.b.unit != 0) {
 			/* exit with drive0 selected */
 			SELECT_DRIVE(&hwif->drives[0]);
 			/* allow BUSY_STAT to assert & clear */
-			ide_delay_50ms();
+			msleep(50);
 		}
 		/* no i/f present: mmm.. this should be a 4 -ml */
 		return 3;
@@ -488,14 +476,14 @@
 			printk("%s: no response (status = 0x%02x), "
 				"resetting drive\n", drive->name,
 				hwif->INB(IDE_STATUS_REG));
-			ide_delay_50ms();
+			msleep(50);
 			hwif->OUTB(drive->select.all, IDE_SELECT_REG);
-			ide_delay_50ms();
+			msleep(50);
 			hwif->OUTB(WIN_SRST, IDE_COMMAND_REG);
 			timeout = jiffies;
 			while (((hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) &&
 			       time_before(jiffies, timeout + WAIT_WORSTCASE))
-				ide_delay_50ms();
+				msleep(50);
 			rc = try_to_identify(drive, cmd);
 		}
 		if (rc == 1)
@@ -510,7 +498,7 @@
 	if (drive->select.b.unit != 0) {
 		/* exit with drive0 selected */
 		SELECT_DRIVE(&hwif->drives[0]);
-		ide_delay_50ms();
+		msleep(50);
 		/* ensure drive irq is clear */
 		(void) hwif->INB(IDE_STATUS_REG);
 	}
@@ -527,7 +515,7 @@
 
 	printk("%s: enabling %s -- ", hwif->name, drive->id->model);
 	SELECT_DRIVE(drive);
-	ide_delay_50ms();
+	msleep(50);
 	hwif->OUTB(EXABYTE_ENABLE_NEST, IDE_COMMAND_REG);
 	timeout = jiffies + WAIT_WORSTCASE;
 	do {
@@ -535,10 +523,10 @@
 			printk("failed (timeout)\n");
 			return;
 		}
-		ide_delay_50ms();
+		msleep(50);
 	} while ((hwif->INB(IDE_STATUS_REG)) & BUSY_STAT);
 
-	ide_delay_50ms();
+	msleep(50);
 
 	if (!OK_STAT((hwif->INB(IDE_STATUS_REG)), 0, BAD_STAT)) {
 		printk("failed (status = 0x%02x)\n", hwif->INB(IDE_STATUS_REG));
@@ -647,8 +635,6 @@
 	device_register(&hwif->gendev);
 }
 
-//EXPORT_SYMBOL(hwif_register);
-
 #ifdef CONFIG_PPC
 static int wait_hwif_ready(ide_hwif_t *hwif)
 {
@@ -691,7 +677,7 @@
  * This routine only knows how to look for drive units 0 and 1
  * on an interface, so any setting of MAX_DRIVES > 2 won't work here.
  */
-void probe_hwif (ide_hwif_t *hwif)
+static void probe_hwif(ide_hwif_t *hwif)
 {
 	unsigned int unit;
 	unsigned long flags;
@@ -781,7 +767,7 @@
 		udelay(10);
 		hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
 		do {
-			ide_delay_50ms();
+			msleep(50);
 			stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]);
 		} while ((stat & BUSY_STAT) && time_after(timeout, jiffies));
 
@@ -801,18 +787,12 @@
 
 	for (unit = 0; unit < MAX_DRIVES; ++unit) {
 		ide_drive_t *drive = &hwif->drives[unit];
-		int enable_dma = 1;
 
 		if (drive->present) {
 			if (hwif->tuneproc != NULL && 
 				drive->autotune == IDE_TUNE_AUTO)
 				/* auto-tune PIO mode */
 				hwif->tuneproc(drive, 255);
-
-#ifdef CONFIG_IDEDMA_ONLYDISK
-			if (drive->media != ide_disk)
-				enable_dma = 0;
-#endif
 			/*
 			 * MAJOR HACK BARF :-/
 			 *
@@ -832,16 +812,16 @@
 				 *   PARANOIA!!!
 				 */
 				hwif->ide_dma_off_quietly(drive);
-				if (enable_dma)
+#ifdef CONFIG_IDEDMA_ONLYDISK
+				if (drive->media == ide_disk)
+#endif
 					hwif->ide_dma_check(drive);
 			}
 		}
 	}
 }
 
-EXPORT_SYMBOL(probe_hwif);
-
-int hwif_init (ide_hwif_t *hwif);
+static int hwif_init(ide_hwif_t *hwif);
 int probe_hwif_init (ide_hwif_t *hwif)
 {
 	probe_hwif(hwif);
@@ -876,7 +856,7 @@
  *
  * This routine detects and reports such situations, but does not fix them.
  */
-void save_match (ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
+static void save_match(ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
 {
 	ide_hwif_t *m = *match;
 
@@ -889,7 +869,6 @@
 	if (!m || m->irq != hwif->irq) /* don't undo a prior perfect match */
 		*match = new;
 }
-EXPORT_SYMBOL(save_match);
 #endif /* MAX_HWIFS > 1 */
 
 /*
@@ -1236,9 +1215,7 @@
 			THIS_MODULE, ata_probe, ata_lock, hwif);
 }
 
-EXPORT_SYMBOL(init_gendisk);
-
-int hwif_init (ide_hwif_t *hwif)
+static int hwif_init(ide_hwif_t *hwif)
 {
 	int old_irq, unit;
 
@@ -1305,8 +1282,6 @@
 	unregister_blkdev(hwif->major, hwif->name);
 	return 0;
 }
-
-EXPORT_SYMBOL(hwif_init);
 
 int ideprobe_init (void)
 {
diff -Nru a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
--- a/drivers/ide/ide-proc.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/ide/ide-proc.c	Tue Jun 15 22:20:41 2004
@@ -74,210 +74,191 @@
 
 #include <asm/io.h>
 
-static int ide_getxdigit(char c)
-{
-	int digit;
-	if (isdigit(c))
-		digit = c - '0';
-	else if (isxdigit(c))
-		digit = tolower(c) - 'a' + 10;
-	else
-		digit = -1;
-	return digit;
-}
-
-static int xx_xx_parse_error (const char *data, unsigned long len, const char *msg)
-{
-	char errbuf[16];
-	int i;
-	if (len >= sizeof(errbuf))
-		len = sizeof(errbuf) - 1;
-	for (i = 0; i < len; ++i) {
-		char c = data[i];
-		if (!c || c == '\n')
-			c = '\0';
-		else if (iscntrl(c))
-			c = '?';
-		errbuf[i] = c;
-	}
-	errbuf[i] = '\0';
-	printk("proc_ide: error: %s: '%s'\n", msg, errbuf);
-	return -EINVAL;
-}
-
-static int proc_ide_write_config
-	(struct file *file, const char *buffer, unsigned long count, void *data)
+static int proc_ide_write_config(struct file *file, const char __user *buffer,
+				 unsigned long count, void *data)
 {
 	ide_hwif_t	*hwif = (ide_hwif_t *)data;
-	int		for_real = 0;
-	unsigned long	startn = 0, n, flags;
-	const char	*start = NULL, *msg = NULL;
+	ide_hwgroup_t *mygroup = (ide_hwgroup_t *)(hwif->hwgroup);
+	ide_hwgroup_t *mategroup = NULL;
+	unsigned long timeout;
+	unsigned long flags;
+	const char *start = NULL, *msg = NULL;
+	struct entry { u32 val; u16 reg; u8 size; u8 pci; } *prog, *q, *r;
+	int want_pci = 0;
+	char *buf, *s;
+	int err;
+
+	if (hwif->mate && hwif->mate->hwgroup)
+		mategroup = (ide_hwgroup_t *)(hwif->mate->hwgroup);
 
 	if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
 		return -EACCES;
-	/*
-	 * Skip over leading whitespace
-	 */
-	while (count && isspace(*buffer)) {
-		--count;
-		++buffer;
+
+	if (count >= PAGE_SIZE)
+		return -EINVAL;
+
+	s = buf = (char *)__get_free_page(GFP_USER);
+	if (!buf)
+		return -ENOMEM;
+
+	err = -ENOMEM;
+	q = prog = (struct entry *)__get_free_page(GFP_USER);
+	if (!prog)
+		goto out;
+
+	err = -EFAULT;
+	if (copy_from_user(buf, buffer, count))
+		goto out1;
+
+	buf[count] = '\0';
+
+	while (isspace(*s))
+		s++;
+
+	while (*s) {
+		char *p;
+		int digits;
+
+		start = s;
+
+		if ((char *)(q + 1) > (char *)prog + PAGE_SIZE) {
+			msg = "too many entries";
+			goto parse_error;
+		}
+
+		switch (*s++) {
+			case 'R':	q->pci = 0;
+					break;
+			case 'P':	q->pci = 1;
+					want_pci = 1;
+					break;
+			default:	msg = "expected 'R' or 'P'";
+					goto parse_error;
+		}
+
+		q->reg = simple_strtoul(s, &p, 16);
+		digits = p - s;
+		if (!digits || digits > 4 || (q->pci && q->reg > 0xff)) {
+			msg = "bad/missing register number";
+			goto parse_error;
+		}
+		if (*p++ != ':') {
+			msg = "missing ':'";
+			goto parse_error;
+		}
+		q->val = simple_strtoul(p, &s, 16);
+		digits = s - p;
+		if (digits != 2 && digits != 4 && digits != 8) {
+			msg = "bad data, 2/4/8 digits required";
+			goto parse_error;
+		}
+		q->size = digits / 2;
+
+		if (q->pci) {
+#ifdef CONFIG_BLK_DEV_IDEPCI
+			if (q->reg & (q->size - 1)) {
+				msg = "misaligned access";
+				goto parse_error;
+			}
+#else
+			msg = "not a PCI device";
+			goto parse_error;
+#endif	/* CONFIG_BLK_DEV_IDEPCI */
+		}
+
+		q++;
+
+		if (*s && !isspace(*s++)) {
+			msg = "expected whitespace after data";
+			goto parse_error;
+		}
+		while (isspace(*s))
+			s++;
 	}
+
 	/*
-	 * Do one full pass to verify all parameters,
-	 * then do another to actually write the regs.
+	 * What follows below is fucking insane, even for IDE people.
+	 * For now I've dealt with the obvious problems on the parsing
+	 * side, but IMNSHO we should simply remove the write access
+	 * to /proc/ide/.../config, killing that FPOS completely.
 	 */
+
+	err = -EBUSY;
+	timeout = jiffies + (3 * HZ);
 	spin_lock_irqsave(&ide_lock, flags);
-	do {
-		const char *p;
-		if (for_real) {
-			unsigned long timeout = jiffies + (3 * HZ);
-			ide_hwgroup_t *mygroup = (ide_hwgroup_t *)(hwif->hwgroup);
-			ide_hwgroup_t *mategroup = NULL;
-			if (hwif->mate && hwif->mate->hwgroup)
-				mategroup = (ide_hwgroup_t *)(hwif->mate->hwgroup);
-			spin_lock_irqsave(&ide_lock, flags);
-			while (mygroup->busy ||
-			       (mategroup && mategroup->busy)) {
-				spin_unlock_irqrestore(&ide_lock, flags);
-				if (time_after(jiffies, timeout)) {
-					printk("/proc/ide/%s/config: channel(s) busy, cannot write\n", hwif->name);
-					spin_unlock_irqrestore(&ide_lock, flags);
-					return -EBUSY;
-				}
-				spin_lock_irqsave(&ide_lock, flags);
-			}
+	while (mygroup->busy ||
+	       (mategroup && mategroup->busy)) {
+		spin_unlock_irqrestore(&ide_lock, flags);
+		if (time_after(jiffies, timeout)) {
+			printk("/proc/ide/%s/config: channel(s) busy, cannot write\n", hwif->name);
+			goto out1;
 		}
-		p = buffer;
-		n = count;
-		while (n > 0) {
-			int d, digits;
-			unsigned int reg = 0, val = 0, is_pci;
-			start = p;
-			startn = n--;
-			switch (*p++) {
-				case 'R':	is_pci = 0;
-						break;
-				case 'P':	is_pci = 1;
+		spin_lock_irqsave(&ide_lock, flags);
+	}
+
 #ifdef CONFIG_BLK_DEV_IDEPCI
-						if (hwif->pci_dev && !hwif->pci_dev->vendor)
-							break;
+	if (want_pci && (!hwif->pci_dev || hwif->pci_dev->vendor)) {
+		spin_unlock_irqrestore(&ide_lock, flags);
+		printk("proc_ide: PCI registers not accessible for %s\n",
+			hwif->name);
+		err = -EINVAL;
+		goto out1;
+	}
 #endif	/* CONFIG_BLK_DEV_IDEPCI */
-						msg = "not a PCI device";
-						goto parse_error;
-				default:	msg = "expected 'R' or 'P'";
-						goto parse_error;
-			}
-			digits = 0;
-			while (n > 0 && (d = ide_getxdigit(*p)) >= 0) {
-				reg = (reg << 4) | d;
-				--n;
-				++p;
-				++digits;
-			}
-			if (!digits || (digits > 4) || (is_pci && reg > 0xff)) {
-				msg = "bad/missing register number";
-				goto parse_error;
-			}
-			if (n-- == 0 || *p++ != ':') {
-				msg = "missing ':'";
-				goto parse_error;
-			}
-			digits = 0;
-			while (n > 0 && (d = ide_getxdigit(*p)) >= 0) {
-				val = (val << 4) | d;
-				--n;
-				++p;
-				++digits;
-			}
-			if (digits != 2 && digits != 4 && digits != 8) {
-				msg = "bad data, 2/4/8 digits required";
-				goto parse_error;
-			}
-			if (n > 0 && !isspace(*p)) {
-				msg = "expected whitespace after data";
-				goto parse_error;
-			}
-			while (n > 0 && isspace(*p)) {
-				--n;
-				++p;
-			}
+
+	for (r = prog; r < q; r++) {
+		unsigned int reg = r->reg, val = r->val;
+		if (r->pci) {
 #ifdef CONFIG_BLK_DEV_IDEPCI
-			if (is_pci && (reg & ((digits >> 1) - 1))) {
-				msg = "misaligned access";
-				goto parse_error;
+			int rc = 0;
+			struct pci_dev *dev = hwif->pci_dev;
+			switch (q->size) {
+				case 1:	msg = "byte";
+					rc = pci_write_config_byte(dev, reg, val);
+					break;
+				case 2:	msg = "word";
+					rc = pci_write_config_word(dev, reg, val);
+					break;
+				case 4:	msg = "dword";
+					rc = pci_write_config_dword(dev, reg, val);
+					break;
+			}
+			if (rc) {
+				spin_unlock_irqrestore(&ide_lock, flags);
+				printk("proc_ide_write_config: error writing %s at bus %02x dev %02x reg 0x%x value 0x%x\n",
+					msg, dev->bus->number, dev->devfn, reg, val);
+				printk("proc_ide_write_config: error %d\n", rc);
+				err = -EIO;
+				goto out1;
 			}
 #endif	/* CONFIG_BLK_DEV_IDEPCI */
-			if (for_real) {
-#if 0
-				printk("proc_ide_write_config: type=%c, reg=0x%x, val=0x%x, digits=%d\n", is_pci ? "PCI" : "non-PCI", reg, val, digits);
-#endif
-				if (is_pci) {
-#ifdef CONFIG_BLK_DEV_IDEPCI
-					int rc = 0;
-					struct pci_dev *dev = hwif->pci_dev;
-					switch (digits) {
-						case 2:	msg = "byte";
-							rc = pci_write_config_byte(dev, reg, val);
-							break;
-						case 4:	msg = "word";
-							rc = pci_write_config_word(dev, reg, val);
-							break;
-						case 8:	msg = "dword";
-							rc = pci_write_config_dword(dev, reg, val);
-							break;
-					}
-					if (rc) {
-						spin_unlock_irqrestore(&ide_lock, flags);
-						printk("proc_ide_write_config: error writing %s at bus %02x dev %02x reg 0x%x value 0x%x\n",
-							msg, dev->bus->number, dev->devfn, reg, val);
-						printk("proc_ide_write_config: error %d\n", rc);
-						return -EIO;
-					}
-#endif	/* CONFIG_BLK_DEV_IDEPCI */
-				} else {	/* not pci */
-#if !defined(__mc68000__) && !defined(CONFIG_APUS)
-
-/*
- * Geert Uytterhoeven
- *
- * unless you can explain me what it really does.
- * On m68k, we don't have outw() and outl() yet,
- * and I need a good reason to implement it.
- * 
- * BTW, IMHO the main remaining portability problem with the IDE driver 
- * is that it mixes IO (ioport) and MMIO (iomem) access on different platforms.
- * 
- * I think all accesses should be done using
- * 
- *     ide_in[bwl](ide_device_instance, offset)
- *     ide_out[bwl](ide_device_instance, value, offset)
- * 
- * so the architecture specific code can #define ide_{in,out}[bwl] to the
- * appropriate function.
- * 
- */
-					switch (digits) {
-						case 2:	hwif->OUTB(val, reg);
-							break;
-						case 4:	hwif->OUTW(val, reg);
-							break;
-						case 8:	hwif->OUTL(val, reg);
-							break;
-					}
-#endif /* !__mc68000__ && !CONFIG_APUS */
-				}
+		} else {	/* not pci */
+			switch (r->size) {
+				case 1:	hwif->OUTB(val, reg);
+					break;
+				case 2:	hwif->OUTW(val, reg);
+					break;
+				case 4:	hwif->OUTL(val, reg);
+					break;
 			}
 		}
-	} while (!for_real++);
+	}
 	spin_unlock_irqrestore(&ide_lock, flags);
-	return count;
+	err = count;
+out1:
+	free_page((unsigned long)prog);
+out:
+	free_page((unsigned long)buf);
+	return err;
+
 parse_error:
-	spin_unlock_irqrestore(&ide_lock, flags);
 	printk("parse error\n");
-	return xx_xx_parse_error(start, startn, msg);
+	printk("proc_ide: error: %s: '%s'\n", msg, start);
+	err = -EINVAL;
+	goto out1;
 }
 
-int proc_ide_read_config
+static int proc_ide_read_config
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
 	char		*out = page;
@@ -314,18 +295,6 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_config);
-
-static int ide_getdigit(char c)
-{
-	int digit;
-	if (isdigit(c))
-		digit = c - '0';
-	else
-		digit = -1;
-	return digit;
-}
-
 static int proc_ide_read_imodel
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
@@ -359,9 +328,7 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_imodel);
-
-int proc_ide_read_mate
+static int proc_ide_read_mate
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
 	ide_hwif_t	*hwif = (ide_hwif_t *) data;
@@ -374,9 +341,7 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_mate);
-
-int proc_ide_read_channel
+static int proc_ide_read_channel
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
 	ide_hwif_t	*hwif = (ide_hwif_t *) data;
@@ -388,9 +353,7 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_channel);
-
-int proc_ide_read_identify
+static int proc_ide_read_identify
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
 	ide_drive_t	*drive = (ide_drive_t *)data;
@@ -432,9 +395,7 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_identify);
-
-int proc_ide_read_settings
+static int proc_ide_read_settings
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
 	ide_drive_t	*drive = (ide_drive_t *) data;
@@ -466,41 +427,52 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_settings);
-
 #define MAX_LEN	30
 
-int proc_ide_write_settings
-	(struct file *file, const char *buffer, unsigned long count, void *data)
+static int proc_ide_write_settings(struct file *file, const char __user *buffer,
+				   unsigned long count, void *data)
 {
 	ide_drive_t	*drive = (ide_drive_t *) data;
 	char		name[MAX_LEN + 1];
-	int		for_real = 0, len;
+	int		for_real = 0;
 	unsigned long	n;
-	const char	*start = NULL;
 	ide_settings_t	*setting;
+	char *buf, *s;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
+
+	if (count >= PAGE_SIZE)
+		return -EINVAL;
+
+	s = buf = (char *)__get_free_page(GFP_USER);
+	if (!buf)
+		return -ENOMEM;
+
+	if (copy_from_user(buf, buffer, count)) {
+		free_page((unsigned long)buf);
+		return -EFAULT;
+	}
+
+	buf[count] = '\0';
+
 	/*
 	 * Skip over leading whitespace
 	 */
-	while (count && isspace(*buffer)) {
+	while (count && isspace(*s)) {
 		--count;
-		++buffer;
+		++s;
 	}
 	/*
 	 * Do one full pass to verify all parameters,
 	 * then do another to actually write the new settings.
 	 */
 	do {
-		const char *p;
-		p = buffer;
+		char *p = s;
 		n = count;
 		while (n > 0) {
-			int d, digits;
-			unsigned int val = 0;
-			start = p;
+			unsigned val;
+			char *q = p;
 
 			while (n > 0 && *p != ':') {
 				--n;
@@ -508,30 +480,27 @@
 			}
 			if (*p != ':')
 				goto parse_error;
-			len = min(p - start, MAX_LEN);
-			strncpy(name, start, min(len, MAX_LEN));
-			name[len] = 0;
+			if (p - q > MAX_LEN)
+				goto parse_error;
+			memcpy(name, q, p - q);
+			name[p - q] = 0;
 
 			if (n > 0) {
 				--n;
 				p++;
 			} else
 				goto parse_error;
-			
-			digits = 0;
-			while (n > 0 && (d = ide_getdigit(*p)) >= 0) {
-				val = (val * 10) + d;
-				--n;
-				++p;
-				++digits;
-			}
+
+			val = simple_strtoul(p, &q, 10);
+			n -= q - p;
+			p = q;
 			if (n > 0 && !isspace(*p))
 				goto parse_error;
 			while (n > 0 && isspace(*p)) {
 				--n;
 				++p;
 			}
-			
+
 			down(&ide_setting_sem);
 			setting = ide_find_setting_by_name(drive, name);
 			if (!setting)
@@ -544,14 +513,14 @@
 			up(&ide_setting_sem);
 		}
 	} while (!for_real++);
+	free_page((unsigned long)buf);
 	return count;
 parse_error:
+	free_page((unsigned long)buf);
 	printk("proc_ide_write_settings(): parse error\n");
 	return -EINVAL;
 }
 
-EXPORT_SYMBOL(proc_ide_write_settings);
-
 int proc_ide_read_capacity
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
@@ -563,8 +532,6 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_capacity);
-
 int proc_ide_read_geometry
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
@@ -583,7 +550,7 @@
 
 EXPORT_SYMBOL(proc_ide_read_geometry);
 
-int proc_ide_read_dmodel
+static int proc_ide_read_dmodel
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
 	ide_drive_t	*drive = (ide_drive_t *) data;
@@ -595,9 +562,7 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_dmodel);
-
-int proc_ide_read_driver
+static int proc_ide_read_driver
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
 	ide_drive_t	*drive = (ide_drive_t *) data;
@@ -609,23 +574,25 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_driver);
-
-int proc_ide_write_driver
-	(struct file *file, const char *buffer, unsigned long count, void *data)
+static int proc_ide_write_driver
+	(struct file *file, const char __user *buffer, unsigned long count, void *data)
 {
 	ide_drive_t	*drive = (ide_drive_t *) data;
+	char name[32];
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
-	if (ide_replace_subdriver(drive, buffer))
+	if (count > 31)
+		count = 31;
+	if (copy_from_user(name, buffer, count))
+		return -EFAULT;
+	name[count] = '\0';
+	if (ide_replace_subdriver(drive, name))
 		return -EINVAL;
 	return count;
 }
 
-EXPORT_SYMBOL(proc_ide_write_driver);
-
-int proc_ide_read_media
+static int proc_ide_read_media
 	(char *page, char **start, off_t off, int count, int *eof, void *data)
 {
 	ide_drive_t	*drive = (ide_drive_t *) data;
@@ -649,8 +616,6 @@
 	PROC_IDE_READ_RETURN(page,start,off,count,eof,len);
 }
 
-EXPORT_SYMBOL(proc_ide_read_media);
-
 static ide_proc_entry_t generic_drive_entries[] = {
 	{ "driver",	S_IFREG|S_IRUGO,	proc_ide_read_driver,	proc_ide_write_driver },
 	{ "identify",	S_IFREG|S_IRUSR,	proc_ide_read_identify,	NULL },
@@ -677,8 +642,6 @@
 	}
 }
 
-EXPORT_SYMBOL(ide_add_proc_entries);
-
 void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p)
 {
 	if (!dir || !p)
@@ -689,9 +652,7 @@
 	}
 }
 
-EXPORT_SYMBOL(ide_remove_proc_entries);
-
-void create_proc_ide_drives(ide_hwif_t *hwif)
+static void create_proc_ide_drives(ide_hwif_t *hwif)
 {
 	int	d;
 	struct proc_dir_entry *ent;
@@ -715,9 +676,7 @@
 	}
 }
 
-EXPORT_SYMBOL(create_proc_ide_drives);
-
-void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive)
+static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive)
 {
 	ide_driver_t *driver = drive->driver;
 
@@ -730,8 +689,6 @@
 	}
 }
 
-EXPORT_SYMBOL(destroy_proc_ide_device);
-
 void destroy_proc_ide_drives(ide_hwif_t *hwif)
 {
 	int	d;
@@ -743,8 +700,6 @@
 	}
 }
 
-EXPORT_SYMBOL(destroy_proc_ide_drives);
-
 static ide_proc_entry_t hwif_entries[] = {
 	{ "channel",	S_IFREG|S_IRUGO,	proc_ide_read_channel,	NULL },
 	{ "config",	S_IFREG|S_IRUGO|S_IWUSR,proc_ide_read_config,	proc_ide_write_config },
@@ -832,13 +787,9 @@
 		entry->proc_fops = &ide_drivers_operations;
 }
 
-EXPORT_SYMBOL(proc_ide_create);
-
 void proc_ide_destroy(void)
 {
 	remove_proc_entry("ide/drivers", proc_ide_root);
 	destroy_proc_ide_interfaces();
 	remove_proc_entry("ide", 0);
 }
-
-EXPORT_SYMBOL(proc_ide_destroy);
diff -Nru a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
--- a/drivers/ide/ide-taskfile.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/ide/ide-taskfile.c	Tue Jun 15 22:20:36 2004
@@ -201,14 +201,6 @@
 			if (!hwif->ide_dma_read(drive))
 				return ide_started;
 			break;
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
-		case WIN_READDMA_QUEUED:
-		case WIN_READDMA_QUEUED_EXT:
-			return __ide_dma_queued_read(drive);
-		case WIN_WRITEDMA_QUEUED:
-		case WIN_WRITEDMA_QUEUED_EXT:
-			return __ide_dma_queued_write(drive);
-#endif
 		default:
 			if (task->handler == NULL)
 				return ide_stopped;
@@ -309,38 +301,18 @@
  */
 #ifndef CONFIG_IDE_TASKFILE_IO
 
-#define task_map_rq(rq, flags)		ide_map_buffer((rq), (flags))
-#define task_unmap_rq(rq, buf, flags)	ide_unmap_buffer((rq), (buf), (flags))
-
 /*
  * Handler for command with PIO data-in phase, READ
  */
-/*
- * FIXME before 2.4 enable ...
- *	DATA integrity issue upon error. <andre@linux-ide.org>
- */
 ide_startstop_t task_in_intr (ide_drive_t *drive)
 {
 	struct request *rq	= HWGROUP(drive)->rq;
 	ide_hwif_t *hwif	= HWIF(drive);
 	char *pBuf		= NULL;
 	u8 stat;
-	unsigned long flags;
 
 	if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),DATA_READY,BAD_R_STAT)) {
 		if (stat & (ERR_STAT|DRQ_STAT)) {
-#if 0
-			DTF("%s: attempting to recover last " \
-				"sector counter status=0x%02x\n",
-				drive->name, stat);
-			/*
-			 * Expect a BUG BOMB if we attempt to rewind the
-			 * offset in the BH aka PAGE in the current BLOCK
-			 * segment.  This is different than the HOST segment.
-			 */
-#endif
-			if (!rq->bio)
-				rq->current_nr_sectors++;
 			return DRIVER(drive)->error(drive, "task_in_intr", stat);
 		}
 		if (!(stat & BUSY_STAT)) {
@@ -350,39 +322,13 @@
 			return ide_started;  
 		}
 	}
-#if 0
 
-	/*
-	 * Holding point for a brain dump of a thought :-/
-	 */
-
-	if (!OK_STAT(stat,DRIVE_READY,drive->bad_wstat)) {
-		DTF("%s: READ attempting to recover last " \
-			"sector counter status=0x%02x\n",
-			drive->name, stat);
-		rq->current_nr_sectors++;
-		return DRIVER(drive)->error(drive, "task_in_intr", stat);
-        }
-	if (!rq->current_nr_sectors)
-		if (!DRIVER(drive)->end_request(drive, 1, 0))
-			return ide_stopped;
-
-	if (--rq->current_nr_sectors <= 0)
-		if (!DRIVER(drive)->end_request(drive, 1, 0))
-			return ide_stopped;
-#endif
-
-	pBuf = task_map_rq(rq, &flags);
+	pBuf = rq->buffer + task_rq_offset(rq);
 	DTF("Read: %p, rq->current_nr_sectors: %d, stat: %02x\n",
 		pBuf, (int) rq->current_nr_sectors, stat);
 	taskfile_input_data(drive, pBuf, SECTOR_WORDS);
-	task_unmap_rq(rq, pBuf, &flags);
-	/*
-	 * FIXME :: We really can not legally get a new page/bh
-	 * regardless, if this is the end of our segment.
-	 * BH walking or segment can only be updated after we have a good
-	 * hwif->INB(IDE_STATUS_REG); return.
-	 */
+
+	/* FIXME: check drive status */
 	if (--rq->current_nr_sectors <= 0)
 		if (!DRIVER(drive)->end_request(drive, 1, 0))
 			return ide_stopped;
@@ -407,21 +353,10 @@
 	char *pBuf		= NULL;
 	unsigned int msect	= drive->mult_count;
 	unsigned int nsect;
-	unsigned long flags;
 	u8 stat;
 
 	if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),DATA_READY,BAD_R_STAT)) {
 		if (stat & (ERR_STAT|DRQ_STAT)) {
-			if (!rq->bio) {
-				rq->current_nr_sectors += drive->mult_count;
-				/*
-				 * NOTE: could rewind beyond beginning :-/
-				 */
-			} else {
-				printk(KERN_ERR "%s: MULTI-READ assume all data " \
-					"transfered is bad status=0x%02x\n",
-					drive->name, stat);
-			}
 			return DRIVER(drive)->error(drive, "task_mulin_intr", stat);
 		}
 		/* no data yet, so wait for another interrupt */
@@ -434,21 +369,16 @@
 		nsect = rq->current_nr_sectors;
 		if (nsect > msect)
 			nsect = msect;
-		pBuf = task_map_rq(rq, &flags);
+		pBuf = rq->buffer + task_rq_offset(rq);
 		DTF("Multiread: %p, nsect: %d, msect: %d, " \
 			" rq->current_nr_sectors: %d\n",
 			pBuf, nsect, msect, rq->current_nr_sectors);
 		taskfile_input_data(drive, pBuf, nsect * SECTOR_WORDS);
-		task_unmap_rq(rq, pBuf, &flags);
 		rq->errors = 0;
 		rq->current_nr_sectors -= nsect;
 		msect -= nsect;
-		/*
-		 * FIXME :: We really can not legally get a new page/bh
-		 * regardless, if this is the end of our segment.
-		 * BH walking or segment can only be updated after we have a
-		 * good hwif->INB(IDE_STATUS_REG); return.
-		 */
+
+		/* FIXME: check drive status */
 		if (!rq->current_nr_sectors) {
 			if (!DRIVER(drive)->end_request(drive, 1, 0))
 				return ide_stopped;
@@ -467,8 +397,6 @@
  */
 ide_startstop_t pre_task_out_intr (ide_drive_t *drive, struct request *rq)
 {
-	char *pBuf		= NULL;
-	unsigned long flags;
 	ide_startstop_t startstop;
 
 	if (ide_wait_stat(&startstop, drive, DATA_READY,
@@ -479,10 +407,8 @@
 		return startstop;
 	}
 	/* For Write_sectors we need to stuff the first sector */
-	pBuf = task_map_rq(rq, &flags);
-	taskfile_output_data(drive, pBuf, SECTOR_WORDS);
+	taskfile_output_data(drive, rq->buffer + task_rq_offset(rq), SECTOR_WORDS);
 	rq->current_nr_sectors--;
-	task_unmap_rq(rq, pBuf, &flags);
 	return ide_started;
 }
 
@@ -498,14 +424,9 @@
 	ide_hwif_t *hwif	= HWIF(drive);
 	struct request *rq	= HWGROUP(drive)->rq;
 	char *pBuf		= NULL;
-	unsigned long flags;
 	u8 stat;
 
 	if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG), DRIVE_READY, drive->bad_wstat)) {
-		DTF("%s: WRITE attempting to recover last " \
-			"sector counter status=0x%02x\n",
-			drive->name, stat);
-		rq->current_nr_sectors++;
 		return DRIVER(drive)->error(drive, "task_out_intr", stat);
 	}
 	/*
@@ -517,11 +438,10 @@
 			return ide_stopped;
 	if ((rq->current_nr_sectors==1) ^ (stat & DRQ_STAT)) {
 		rq = HWGROUP(drive)->rq;
-		pBuf = task_map_rq(rq, &flags);
+		pBuf = rq->buffer + task_rq_offset(rq);
 		DTF("write: %p, rq->current_nr_sectors: %d\n",
 			pBuf, (int) rq->current_nr_sectors);
 		taskfile_output_data(drive, pBuf, SECTOR_WORDS);
-		task_unmap_rq(rq, pBuf, &flags);
 		rq->errors = 0;
 		rq->current_nr_sectors--;
 	}
@@ -532,28 +452,11 @@
 
 EXPORT_SYMBOL(task_out_intr);
 
-#undef ALTERNATE_STATE_DIAGRAM_MULTI_OUT
-
 ide_startstop_t pre_task_mulout_intr (ide_drive_t *drive, struct request *rq)
 {
-#ifdef ALTERNATE_STATE_DIAGRAM_MULTI_OUT
-	ide_hwif_t *hwif		= HWIF(drive);
-	char *pBuf			= NULL;
-	unsigned int nsect = 0, msect	= drive->mult_count;
-        u8 stat;
-	unsigned long flags;
-#endif /* ALTERNATE_STATE_DIAGRAM_MULTI_OUT */
-
 	ide_task_t *args = rq->special;
 	ide_startstop_t startstop;
 
-#if 0
-	/*
-	 * assign private copy for multi-write
-	 */
-	memcpy(&HWGROUP(drive)->wrq, rq, sizeof(struct request));
-#endif
-
 	if (ide_wait_stat(&startstop, drive, DATA_READY,
 			drive->bad_wstat, WAIT_DRQ)) {
 		printk(KERN_ERR "%s: no DRQ after issuing %s\n",
@@ -561,31 +464,6 @@
 			drive->addressing ? "MULTWRITE_EXT" : "MULTWRITE");
 		return startstop;
 	}
-#ifdef ALTERNATE_STATE_DIAGRAM_MULTI_OUT
-
-	do {
-		nsect = rq->current_nr_sectors;
-		if (nsect > msect)
-			nsect = msect;
-		pBuf = task_map_rq(rq, &flags);
-		DTF("Pre-Multiwrite: %p, nsect: %d, msect: %d, " \
-			"rq->current_nr_sectors: %ld\n",
-			pBuf, nsect, msect, rq->current_nr_sectors);
-		msect -= nsect;
-		taskfile_output_data(drive, pBuf, nsect * SECTOR_WORDS);
-		task_unmap_rq(rq, pBuf, &flags);
-		rq->current_nr_sectors -= nsect;
-		if (!rq->current_nr_sectors) {
-			if (!DRIVER(drive)->end_request(drive, 1, 0))
-				if (!rq->bio) {
-					stat = hwif->INB(IDE_STATUS_REG);
-					return ide_stopped;
-				}
-		}
-	} while (msect);
-	rq->errors = 0;
-	return ide_started;
-#else /* ! ALTERNATE_STATE_DIAGRAM_MULTI_OUT */
 	if (!(drive_is_ready(drive))) {
 		int i;
 		for (i=0; i<100; i++) {
@@ -599,15 +477,11 @@
 	 * move the DATA-TRANSFER T-Bar as BSY != 0. <andre@linux-ide.org>
 	 */
 	return args->handler(drive);
-#endif /* ALTERNATE_STATE_DIAGRAM_MULTI_OUT */
 }
 
 EXPORT_SYMBOL(pre_task_mulout_intr);
 
 /*
- * FIXME before enabling in 2.4 ... DATA integrity issue upon error.
- */
-/*
  * Handler for command write multiple
  * Called directly from execute_drive_cmd for the first bunch of sectors,
  * afterwards only by the ISR
@@ -618,49 +492,17 @@
 	u8 stat				= hwif->INB(IDE_STATUS_REG);
 	struct request *rq		= HWGROUP(drive)->rq;
 	char *pBuf			= NULL;
-	ide_startstop_t startstop	= ide_stopped;
 	unsigned int msect		= drive->mult_count;
 	unsigned int nsect;
-	unsigned long flags;
 
-	/*
-	 * (ks/hs): Handle last IRQ on multi-sector transfer,
-	 * occurs after all data was sent in this chunk
-	 */
-	if (rq->current_nr_sectors == 0) {
+	if (!OK_STAT(stat, DATA_READY, BAD_R_STAT) || !rq->current_nr_sectors) {
 		if (stat & (ERR_STAT|DRQ_STAT)) {
-			if (!rq->bio) {
-                                rq->current_nr_sectors += drive->mult_count;
-				/*
-				 * NOTE: could rewind beyond beginning :-/
-				 */
-			} else {
-				printk(KERN_ERR "%s: MULTI-WRITE assume all data " \
-					"transfered is bad status=0x%02x\n",
-					drive->name, stat);
-			}
 			return DRIVER(drive)->error(drive, "task_mulout_intr", stat);
 		}
-		if (!rq->bio)
+		/* Handle last IRQ, occurs after all data was sent. */
+		if (!rq->current_nr_sectors) {
 			DRIVER(drive)->end_request(drive, 1, 0);
-		return startstop;
-	}
-	/*
-	 * DON'T be lazy code the above and below togather !!!
-	 */
-	if (!OK_STAT(stat,DATA_READY,BAD_R_STAT)) {
-		if (stat & (ERR_STAT|DRQ_STAT)) {
-			if (!rq->bio) {
-				rq->current_nr_sectors += drive->mult_count;
-				/*
-				 * NOTE: could rewind beyond beginning :-/
-				 */
-			} else {
-				printk("%s: MULTI-WRITE assume all data " \
-					"transfered is bad status=0x%02x\n",
-					drive->name, stat);
-			}
-			return DRIVER(drive)->error(drive, "task_mulout_intr", stat);
+			return ide_stopped;
 		}
 		/* no data yet, so wait for another interrupt */
 		if (HWGROUP(drive)->handler == NULL)
@@ -668,7 +510,6 @@
 		return ide_started;
 	}
 
-#ifndef ALTERNATE_STATE_DIAGRAM_MULTI_OUT
 	if (HWGROUP(drive)->handler != NULL) {
 		unsigned long lflags;
 		spin_lock_irqsave(&ide_lock, lflags);
@@ -676,26 +517,20 @@
 		del_timer(&HWGROUP(drive)->timer);
 		spin_unlock_irqrestore(&ide_lock, lflags);
 	}
-#endif /* ALTERNATE_STATE_DIAGRAM_MULTI_OUT */
 
 	do {
 		nsect = rq->current_nr_sectors;
 		if (nsect > msect)
 			nsect = msect;
-		pBuf = task_map_rq(rq, &flags);
+		pBuf = rq->buffer + task_rq_offset(rq);
 		DTF("Multiwrite: %p, nsect: %d, msect: %d, " \
 			"rq->current_nr_sectors: %ld\n",
 			pBuf, nsect, msect, rq->current_nr_sectors);
 		msect -= nsect;
 		taskfile_output_data(drive, pBuf, nsect * SECTOR_WORDS);
-		task_unmap_rq(rq, pBuf, &flags);
 		rq->current_nr_sectors -= nsect;
-		/*
-		 * FIXME :: We really can not legally get a new page/bh
-		 * regardless, if this is the end of our segment.
-		 * BH walking or segment can only be updated after we
-		 * have a good  hwif->INB(IDE_STATUS_REG); return.
-		 */
+
+		/* FIXME: check drive status */
 		if (!rq->current_nr_sectors) {
 			if (!DRIVER(drive)->end_request(drive, 1, 0))
 				if (!rq->bio)
@@ -1011,6 +846,12 @@
 		else
 			rq.nr_sectors = data_size / SECTOR_SIZE;
 
+		if (!rq.nr_sectors) {
+			printk(KERN_ERR "%s: in/out command without data\n",
+					drive->name);
+			return -EFAULT;
+		}
+
 		rq.hard_nr_sectors = rq.nr_sectors;
 		rq.hard_cur_sectors = rq.current_nr_sectors = rq.nr_sectors;
 	}
@@ -1052,13 +893,14 @@
 	int taskin		= 0;
 	int taskout		= 0;
 	u8 io_32bit		= drive->io_32bit;
+	char __user *buf = (char __user *)arg;
 
 //	printk("IDE Taskfile ...\n");
 
 	req_task = kmalloc(tasksize, GFP_KERNEL);
 	if (req_task == NULL) return -ENOMEM;
 	memset(req_task, 0, tasksize);
-	if (copy_from_user(req_task, (void *) arg, tasksize)) {
+	if (copy_from_user(req_task, buf, tasksize)) {
 		kfree(req_task);
 		return -EFAULT;
 	}
@@ -1074,7 +916,7 @@
 			goto abort;
 		}
 		memset(outbuf, 0, taskout);
-		if (copy_from_user(outbuf, (void *)arg + outtotal, taskout)) {
+		if (copy_from_user(outbuf, buf + outtotal, taskout)) {
 			err = -EFAULT;
 			goto abort;
 		}
@@ -1088,7 +930,7 @@
 			goto abort;
 		}
 		memset(inbuf, 0, taskin);
-		if (copy_from_user(inbuf, (void *)arg + intotal , taskin)) {
+		if (copy_from_user(inbuf, buf + intotal, taskin)) {
 			err = -EFAULT;
 			goto abort;
 		}
@@ -1196,20 +1038,20 @@
 	req_task->in_flags  = args.tf_in_flags;
 	req_task->out_flags = args.tf_out_flags;
 
-	if (copy_to_user((void *)arg, req_task, tasksize)) {
+	if (copy_to_user(buf, req_task, tasksize)) {
 		err = -EFAULT;
 		goto abort;
 	}
 	if (taskout) {
 		int outtotal = tasksize;
-		if (copy_to_user((void *)arg+outtotal, outbuf, taskout)) {
+		if (copy_to_user(buf + outtotal, outbuf, taskout)) {
 			err = -EFAULT;
 			goto abort;
 		}
 	}
 	if (taskin) {
 		int intotal = tasksize + taskout;
-		if (copy_to_user((void *)arg+intotal, inbuf, taskin)) {
+		if (copy_to_user(buf + intotal, inbuf, taskin)) {
 			err = -EFAULT;
 			goto abort;
 		}
@@ -1266,7 +1108,7 @@
 		return ide_do_drive_cmd(drive, &rq, ide_wait);
 	}
 
-	if (copy_from_user(args, (void *)arg, 4))
+	if (copy_from_user(args, (void __user *)arg, 4))
 		return -EFAULT;
 
 	memset(&tfargs, 0, sizeof(ide_task_t));
@@ -1299,7 +1141,7 @@
 		ide_driveid_update(drive);
 	}
 abort:
-	if (copy_to_user((void *)arg, argbuf, argsize))
+	if (copy_to_user((void __user *)arg, argbuf, argsize))
 		err = -EFAULT;
 	if (argsize > 4)
 		kfree(argbuf);
@@ -1325,14 +1167,15 @@
  */
 int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
 {
+	void __user *p = (void __user *)arg;
 	int err = 0;
 	u8 args[7], *argbuf = args;
 	int argsize = 7;
 
-	if (copy_from_user(args, (void *)arg, 7))
+	if (copy_from_user(args, p, 7))
 		return -EFAULT;
 	err = ide_wait_cmd_task(drive, argbuf);
-	if (copy_to_user((void *)arg, argbuf, argsize))
+	if (copy_to_user(p, argbuf, argsize))
 		err = -EFAULT;
 	return err;
 }
@@ -1493,9 +1336,6 @@
 	char *pBuf		= NULL;
 	int retries             = 5;
 
-	if (rq->current_nr_sectors == 0) 
-		return DRIVER(drive)->error(drive, "flagged_task_in_intr (no data requested)", stat); 
-
 	if (!OK_STAT(stat, DATA_READY, BAD_R_STAT)) {
 		if (stat & ERR_STAT) {
 			return DRIVER(drive)->error(drive, "flagged_task_in_intr", stat);
@@ -1542,9 +1382,6 @@
 	int retries             = 5;
 	unsigned int msect, nsect;
 
-	if (rq->current_nr_sectors == 0) 
-		return DRIVER(drive)->error(drive, "flagged_task_mulin_intr (no data requested)", stat); 
-
 	msect = drive->mult_count;
 	if (msect == 0) 
 		return DRIVER(drive)->error(drive, "flagged_task_mulin_intr (multimode not set)", stat); 
@@ -1596,14 +1433,8 @@
  */
 ide_startstop_t flagged_pre_task_out_intr (ide_drive_t *drive, struct request *rq)
 {
-	ide_hwif_t *hwif	= HWIF(drive);
-	u8 stat			= hwif->INB(IDE_STATUS_REG);
 	ide_startstop_t startstop;
 
-	if (!rq->current_nr_sectors) {
-		return DRIVER(drive)->error(drive, "flagged_pre_task_out_intr (write data not specified)", stat);
-	}
-
 	if (ide_wait_stat(&startstop, drive, DATA_READY,
 			BAD_W_STAT, WAIT_DRQ)) {
 		printk(KERN_ERR "%s: No DRQ bit after issuing write command.\n", drive->name);
@@ -1664,9 +1495,6 @@
 	char *pBuf		= NULL;
 	ide_startstop_t startstop;
 	unsigned int msect, nsect;
-
-	if (!rq->current_nr_sectors) 
-		return DRIVER(drive)->error(drive, "flagged_pre_task_mulout_intr (write data not specified)", stat);
 
 	msect = drive->mult_count;
 	if (msect == 0)
diff -Nru a/drivers/ide/ide-tcq.c b/drivers/ide/ide-tcq.c
--- a/drivers/ide/ide-tcq.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,808 +0,0 @@
-/*
- * Copyright (C) 2001, 2002 Jens Axboe <axboe@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- * Support for the DMA queued protocol, which enables ATA disk drives to
- * use tagged command queueing.
- */
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/ide.h>
-
-#include <asm/io.h>
-#include <asm/delay.h>
-
-/*
- * warning: it will be _very_ verbose if defined
- */
-#undef IDE_TCQ_DEBUG
-
-#ifdef IDE_TCQ_DEBUG
-#define TCQ_PRINTK printk
-#else
-#define TCQ_PRINTK(x...)
-#endif
-
-/*
- * use nIEN or not
- */
-#undef IDE_TCQ_NIEN
-
-/*
- * we are leaving the SERVICE interrupt alone, IBM drives have it
- * on per default and it can't be turned off. Doesn't matter, this
- * is the sane config.
- */
-#undef IDE_TCQ_FIDDLE_SI
-
-/*
- * bad drive blacklist, for drives that raport tcq capability but don't
- * work reliably with the default config. initially from freebsd table.
- */
-struct ide_tcq_blacklist {
-	char *model;
-	char works;
-	unsigned int max_sectors;
-};
-
-static struct ide_tcq_blacklist ide_tcq_blacklist[] = {
-	{
-		.model =	"IBM-DTTA",
-		.works =	1,
-		.max_sectors =	128,
-	},
-	{
-		.model =	"IBM-DJNA",
-		.works =	0,
-	},
-	{
-		.model =	"WDC AC",
-		.works = 	0,
-	},
-	{
-		.model =	NULL,
-	},
-};
-
-ide_startstop_t ide_dmaq_intr(ide_drive_t *drive);
-ide_startstop_t ide_service(ide_drive_t *drive);
-
-static struct ide_tcq_blacklist *ide_find_drive_blacklist(ide_drive_t *drive)
-{
-	struct ide_tcq_blacklist *itb;
-	int i = 0;
-
-	do {
-		itb = &ide_tcq_blacklist[i];
-
-		if (!itb->model)
-			break;
-
-		if (!strncmp(drive->id->model, itb->model, strlen(itb->model)))
-			return itb;
-
-		i++;
-	} while (1);
-
-	return NULL;
-}
-
-static inline void drive_ctl_nien(ide_drive_t *drive, int set)
-{
-#ifdef IDE_TCQ_NIEN
-	if (IDE_CONTROL_REG) {
-		int mask = set ? 0x02 : 0x00;
-
-		hwif->OUTB(drive->ctl | mask, IDE_CONTROL_REG);
-	}
-#endif
-}
-
-static ide_startstop_t ide_tcq_nop_handler(ide_drive_t *drive)
-{
-	ide_task_t *args = HWGROUP(drive)->rq->special;
-	ide_hwif_t *hwif = HWIF(drive);
-	int auto_poll_check = 0;
-	u8 stat, err;
-
-	if (args->tfRegister[IDE_FEATURE_OFFSET] & 0x01)
-		auto_poll_check = 1;
-
-	local_irq_enable();
-
-	stat = hwif->INB(IDE_STATUS_REG);
-	err = hwif->INB(IDE_ERROR_REG);
-	ide_end_drive_cmd(drive, stat, err);
-
-	/*
-	 * do taskfile and check ABRT bit -- intelligent adapters will not
-	 * pass NOP with sub-code 0x01 to device, so the command will not
-	 * fail there
-	 */
-	if (auto_poll_check) {
-		if (!(args->tfRegister[IDE_FEATURE_OFFSET] & ABRT_ERR)) {
-			HWIF(drive)->auto_poll = 1;
-			printk("%s: NOP Auto-poll enabled\n",HWIF(drive)->name);
-		}
-	}
-
-	kfree(args);
-	return ide_stopped;
-}
-
-/*
- * if we encounter _any_ error doing I/O to one of the tags, we must
- * invalidate the pending queue. clear the software busy queue and requeue
- * on the request queue for restart. issue a WIN_NOP to clear hardware queue
- */
-static void ide_tcq_invalidate_queue(ide_drive_t *drive)
-{
-	ide_hwgroup_t *hwgroup = HWGROUP(drive);
-	request_queue_t *q = drive->queue;
-	struct request *rq;
-	unsigned long flags;
-
-	printk("%s: invalidating tag queue (%d commands)\n", drive->name, ata_pending_commands(drive));
-
-	/*
-	 * first kill timer and block queue
-	 */
-	spin_lock_irqsave(&ide_lock, flags);
-
-	del_timer(&hwgroup->timer);
-
-	if (HWIF(drive)->dma)
-		HWIF(drive)->ide_dma_end(drive);
-
-	blk_queue_invalidate_tags(q);
-
-	drive->using_tcq = 0;
-	drive->queue_depth = 1;
-	hwgroup->busy = 0;
-	hwgroup->handler = NULL;
-
-	spin_unlock_irqrestore(&ide_lock, flags);
-
-	/*
-	 * now kill hardware queue with a NOP
-	 */
-	rq = &hwgroup->wrq;
-	ide_init_drive_cmd(rq);
-	rq->buffer = hwgroup->cmd_buf;
-	memset(rq->buffer, 0, sizeof(hwgroup->cmd_buf));
-	rq->buffer[0] = WIN_NOP;
-	ide_do_drive_cmd(drive, rq, ide_preempt);
-}
-
-void ide_tcq_intr_timeout(unsigned long data)
-{
-	ide_drive_t *drive = (ide_drive_t *) data;
-	ide_hwgroup_t *hwgroup = HWGROUP(drive);
-	ide_hwif_t *hwif = HWIF(drive);
-	unsigned long flags;
-
-	printk(KERN_ERR "ide_tcq_intr_timeout: timeout waiting for %s interrupt\n", hwgroup->rq ? "completion" : "service");
-
-	spin_lock_irqsave(&ide_lock, flags);
-
-	if (!hwgroup->busy)
-		printk(KERN_ERR "ide_tcq_intr_timeout: hwgroup not busy\n");
-	if (hwgroup->handler == NULL)
-		printk(KERN_ERR "ide_tcq_intr_timeout: missing isr!\n");
-
-	hwgroup->busy = 1;
-	spin_unlock_irqrestore(&ide_lock, flags);
-
-	/*
-	 * if pending commands, try service before giving up
-	 */
-	if (ata_pending_commands(drive)) {
-		u8 stat = hwif->INB(IDE_STATUS_REG);
-
-		if ((stat & SRV_STAT) && (ide_service(drive) == ide_started))
-			return;
-	}
-
-	if (drive)
-		ide_tcq_invalidate_queue(drive);
-}
-
-void __ide_tcq_set_intr(ide_hwgroup_t *hwgroup, ide_handler_t *handler)
-{
-	/*
-	 * always just bump the timer for now, the timeout handling will
-	 * have to be changed to be per-command
-	 */
-	hwgroup->timer.function = ide_tcq_intr_timeout;
-	hwgroup->timer.data = (unsigned long) hwgroup->drive;
-	mod_timer(&hwgroup->timer, jiffies + 5 * HZ);
-
-	hwgroup->handler = handler;
-}
-
-void ide_tcq_set_intr(ide_hwgroup_t *hwgroup, ide_handler_t *handler)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&ide_lock, flags);
-	__ide_tcq_set_intr(hwgroup, handler);
-	spin_unlock_irqrestore(&ide_lock, flags);
-}
-
-/*
- * wait 400ns, then poll for busy_mask to clear from alt status
- */
-#define IDE_TCQ_WAIT	(10000)
-int ide_tcq_wait_altstat(ide_drive_t *drive, byte *stat, byte busy_mask)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	int i = 0;
-
-	udelay(1);
-
-	do {
-		*stat = hwif->INB(IDE_ALTSTATUS_REG);
-
-		if (!(*stat & busy_mask))
-			break;
-
-		if (unlikely(i++ > IDE_TCQ_WAIT))
-			return 1;
-
-		udelay(10);
-	} while (1);
-
-	return 0;
-}
-
-/*
- * issue SERVICE command to drive -- drive must have been selected first,
- * and it must have reported a need for service (status has SRV_STAT set)
- *
- * Also, nIEN must be set as not to need protection against ide_dmaq_intr
- */
-ide_startstop_t ide_service(ide_drive_t *drive)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	unsigned long flags;
-	struct request *rq;
-	byte feat, stat;
-	int tag;
-
-	TCQ_PRINTK("%s: started service\n", drive->name);
-
-	/*
-	 * could be called with IDE_DMA in-progress from invalidate
-	 * handler, refuse to do anything
-	 */
-	if (hwif->dma)
-		return ide_stopped;
-
-	/*
-	 * need to select the right drive first...
-	 */
-	if (drive != HWGROUP(drive)->drive) {
-		SELECT_DRIVE(drive);
-		udelay(10);
-	}
-
-	drive_ctl_nien(drive, 1);
-
-	/*
-	 * send SERVICE, wait 400ns, wait for BUSY_STAT to clear
-	 */
-	hwif->OUTB(WIN_QUEUED_SERVICE, IDE_COMMAND_REG);
-
-	if (ide_tcq_wait_altstat(drive, &stat, BUSY_STAT)) {
-		printk(KERN_ERR "ide_service: BUSY clear took too long\n");
-		ide_dump_status(drive, "ide_service", stat);
-		ide_tcq_invalidate_queue(drive);
-		return ide_stopped;
-	}
-
-	drive_ctl_nien(drive, 0);
-
-	/*
-	 * FIXME, invalidate queue
-	 */
-	if (stat & ERR_STAT) {
-		ide_dump_status(drive, "ide_service", stat);
-		ide_tcq_invalidate_queue(drive);
-		return ide_stopped;
-	}
-
-	/*
-	 * should not happen, a buggy device could introduce loop
-	 */
-	feat = hwif->INB(IDE_NSECTOR_REG);
-	if (feat & REL) {
-		HWGROUP(drive)->rq = NULL;
-		printk(KERN_ERR "%s: release in service\n", drive->name);
-		return ide_stopped;
-	}
-
-	tag = feat >> 3;
-
-	TCQ_PRINTK("ide_service: stat %x, feat %x\n", stat, feat);
-
-	spin_lock_irqsave(&ide_lock, flags);
-
-	if ((rq = blk_queue_find_tag(drive->queue, tag))) {
-		HWGROUP(drive)->rq = rq;
-
-		/*
-		 * we'll start a dma read or write, device will trigger
-		 * interrupt to indicate end of transfer, release is not
-		 * allowed
-		 */
-		TCQ_PRINTK("ide_service: starting command, stat=%x\n", stat);
-		spin_unlock_irqrestore(&ide_lock, flags);
-		return __ide_dma_queued_start(drive);
-	}
-
-	printk(KERN_ERR "ide_service: missing request for tag %d\n", tag);
-	spin_unlock_irqrestore(&ide_lock, flags);
-	return ide_stopped;
-}
-
-ide_startstop_t ide_check_service(ide_drive_t *drive)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	byte stat;
-
-	TCQ_PRINTK("%s: ide_check_service\n", drive->name);
-
-	if (!ata_pending_commands(drive))
-		return ide_stopped;
-
-	stat = hwif->INB(IDE_STATUS_REG);
-	if (stat & SRV_STAT)
-		return ide_service(drive);
-
-	/*
-	 * we have pending commands, wait for interrupt
-	 */
-	TCQ_PRINTK("%s: wait for service interrupt\n", drive->name);
-	ide_tcq_set_intr(HWGROUP(drive), ide_dmaq_intr);
-	return ide_started;
-}
-
-ide_startstop_t ide_dmaq_complete(ide_drive_t *drive, struct request *rq, byte stat)
-{
-	byte dma_stat;
-
-	/*
-	 * transfer was in progress, stop DMA engine
-	 */
-	dma_stat = HWIF(drive)->ide_dma_end(drive);
-
-	/*
-	 * must be end of I/O, check status and complete as necessary
-	 */
-	if (unlikely(!OK_STAT(stat, READY_STAT, drive->bad_wstat | DRQ_STAT))) {
-		printk(KERN_ERR "ide_dmaq_intr: %s: error status %x\n",drive->name,stat);
-		ide_dump_status(drive, "ide_dmaq_complete", stat);
-		ide_tcq_invalidate_queue(drive);
-		return ide_stopped;
-	}
-
-	if (dma_stat)
-		printk(KERN_WARNING "%s: bad DMA status (dma_stat=%x)\n", drive->name, dma_stat);
-
-	TCQ_PRINTK("ide_dmaq_complete: ending %p, tag %d\n", rq, rq->tag);
-	ide_end_request(drive, 1, rq->nr_sectors);
-
-	/*
-	 * we completed this command, check if we can service a new command
-	 */
-	return ide_check_service(drive);
-}
-
-/*
- * intr handler for queued dma operations. this can be entered for two
- * reasons:
- *
- * 1) device has completed dma transfer
- * 2) service request to start a command
- *
- * if the drive has an active tag, we first complete that request before
- * processing any pending SERVICE.
- */
-ide_startstop_t ide_dmaq_intr(ide_drive_t *drive)
-{
-	struct request *rq = HWGROUP(drive)->rq;
-	ide_hwif_t *hwif = HWIF(drive);
-	byte stat = hwif->INB(IDE_STATUS_REG);
-
-	TCQ_PRINTK("ide_dmaq_intr: stat=%x\n", stat);
-
-	/*
-	 * if a command completion interrupt is pending, do that first and
-	 * check service afterwards
-	 */
-	if (rq) {
-		TCQ_PRINTK("ide_dmaq_intr: completion\n");
-		return ide_dmaq_complete(drive, rq, stat);
-	}
-
-	/*
-	 * service interrupt
-	 */
-	if (stat & SRV_STAT) {
-		TCQ_PRINTK("ide_dmaq_intr: SERV (stat=%x)\n", stat);
-		return ide_service(drive);
-	}
-
-	printk("ide_dmaq_intr: stat=%x, not expected\n", stat);
-	return ide_check_service(drive);
-}
-
-/*
- * check if the ata adapter this drive is attached to supports the
- * NOP auto-poll for multiple tcq enabled drives on one channel
- */
-static int ide_tcq_check_autopoll(ide_drive_t *drive)
-{
-	ide_task_t *args;
-	int i, drives;
-
-	/*
-	 * only need to probe if both drives on a channel support tcq
-	 */
-	for (i = 0, drives = 0; i < MAX_DRIVES; i++)
-		if (HWIF(drive)->drives[i].present && drive->media == ide_disk)
-			drives++;
-
-	if (drives <= 1)
-		return 0;
-
-	/*
-	 * what a mess...
-	 */
-	args = kmalloc(sizeof(*args), GFP_ATOMIC);
-	if (!args)
-		return 1;
-
-	memset(args, 0, sizeof(*args));
-
-	args->tfRegister[IDE_FEATURE_OFFSET] = 0x01;
-	args->tfRegister[IDE_COMMAND_OFFSET] = WIN_NOP;
-	args->command_type = IDE_DRIVE_TASK_NO_DATA;
-	args->handler = ide_tcq_nop_handler;
-	return ide_raw_taskfile(drive, args, NULL);
-}
-
-/*
- * configure the drive for tcq
- */
-static int ide_tcq_configure(ide_drive_t *drive)
-{
-	int tcq_mask = 1 << 1 | 1 << 14;
-	int tcq_bits = tcq_mask | 1 << 15;
-	ide_task_t *args;
-
-	/*
-	 * bit 14 and 1 must be set in word 83 of the device id to indicate
-	 * support for dma queued protocol, and bit 15 must be cleared
-	 */
-	if ((drive->id->command_set_2 & tcq_bits) ^ tcq_mask) {
-		printk(KERN_INFO "%s: TCQ not supported\n", drive->name);
-		return -EIO;
-	}
-
-	args = kmalloc(sizeof(*args), GFP_ATOMIC);
-	if (!args)
-		return -ENOMEM;
-
-	memset(args, 0, sizeof(ide_task_t));
-	args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES;
-	args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_EN_WCACHE;
-	args->command_type = IDE_DRIVE_TASK_NO_DATA;
-	args->handler	   = &task_no_data_intr;
-
-	if (ide_raw_taskfile(drive, args, NULL)) {
-		printk(KERN_WARNING "%s: failed to enable write cache\n", drive->name);
-		goto err;
-	}
-
-	/*
-	 * disable RELease interrupt, it's quicker to poll this after
-	 * having sent the command opcode
-	 */
-	memset(args, 0, sizeof(ide_task_t));
-	args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES;
-	args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_DIS_RI;
-	args->command_type = IDE_DRIVE_TASK_NO_DATA;
-	args->handler	   = &task_no_data_intr;
-
-	if (ide_raw_taskfile(drive, args, NULL)) {
-		printk(KERN_ERR "%s: disabling release interrupt fail\n", drive->name);
-		goto err;
-	}
-
-#ifdef IDE_TCQ_FIDDLE_SI
-	/*
-	 * enable SERVICE interrupt
-	 */
-	memset(args, 0, sizeof(ide_task_t));
-	args->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES;
-	args->tfRegister[IDE_FEATURE_OFFSET] = SETFEATURES_EN_SI;
-	args->command_type = IDE_DRIVE_TASK_NO_DATA;
-	args->handler	   = &task_no_data_intr;
-
-	if (ide_raw_taskfile(drive, args, NULL)) {
-		printk(KERN_ERR "%s: enabling service interrupt fail\n", drive->name);
-		goto err;
-	}
-#endif
-
-	kfree(args);
-	return 0;
-err:
-	kfree(args);
-	return -EIO;
-}
-
-/*
- * for now assume that command list is always as big as we need and don't
- * attempt to shrink it on tcq disable
- */
-static int ide_enable_queued(ide_drive_t *drive, int on)
-{
-	struct ide_tcq_blacklist *itb;
-	int depth = drive->using_tcq ? drive->queue_depth : 0;
-
-	/*
-	 * disable or adjust queue depth
-	 */
-	if (!on) {
-		if (drive->using_tcq)
-			printk(KERN_INFO "%s: TCQ disabled\n", drive->name);
-
-		drive->using_tcq = 0;
-		return 0;
-	}
-
-	if (ide_tcq_configure(drive)) {
-		drive->using_tcq = 0;
-		return 1;
-	}
-
-	/*
-	 * some drives need limited transfer size in tcq
-	 */
-	itb = ide_find_drive_blacklist(drive);
-	if (itb && itb->max_sectors) {
-		if (itb->max_sectors > HWIF(drive)->rqsize)
-			itb->max_sectors = HWIF(drive)->rqsize;
-
-		blk_queue_max_sectors(drive->queue, itb->max_sectors);
-	}
-
-	/*
-	 * enable block tagging
-	 */
-	if (!blk_queue_tagged(drive->queue))
-		blk_queue_init_tags(drive->queue, IDE_MAX_TAG, NULL);
-
-	/*
-	 * check auto-poll support
-	 */
-	ide_tcq_check_autopoll(drive);
-
-	if (depth != drive->queue_depth)
-		printk(KERN_INFO "%s: tagged command queueing enabled, command queue depth %d\n", drive->name, drive->queue_depth);
-
-	drive->using_tcq = 1;
-	return 0;
-}
-
-int ide_tcq_wait_dataphase(ide_drive_t *drive)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	byte stat;
-	int i;
-
-	do {
-		stat = hwif->INB(IDE_STATUS_REG);
-		if (!(stat & BUSY_STAT))
-			break;
-
-		udelay(10);
-	} while (1);
-
-	if (OK_STAT(stat, READY_STAT | DRQ_STAT, drive->bad_wstat))
-		return 0;
-
-	i = 0;
-	udelay(1);
-	do {
-		stat = hwif->INB(IDE_STATUS_REG);
-
-		if (OK_STAT(stat, READY_STAT | DRQ_STAT, drive->bad_wstat))
-			break;
-
-		++i;
-		if (unlikely(i >= IDE_TCQ_WAIT))
-			return 1;
-
-		udelay(10);
-	} while (1);
-
-	return 0;
-}
-
-static int ide_tcq_check_blacklist(ide_drive_t *drive)
-{
-	struct ide_tcq_blacklist *itb = ide_find_drive_blacklist(drive);
-
-	if (!itb)
-		return 0;
-
-	return !itb->works;
-}
-
-int __ide_dma_queued_on(ide_drive_t *drive)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-
-	if (drive->media != ide_disk)
-		return 1;
-	if (!drive->using_dma)
-		return 1;
-	if (hwif->chipset == ide_pdc4030)
-		return 1;
-	if (ide_tcq_check_blacklist(drive)) {
-		printk(KERN_WARNING "%s: tcq forbidden by blacklist\n",
-					drive->name);
-		return 1;
-	}
-	if (hwif->drives[0].present && hwif->drives[1].present) {
-		printk(KERN_WARNING "%s: only one drive on a channel supported"
-					" for tcq\n", drive->name);
-		return 1;
-	}
-	if (ata_pending_commands(drive)) {
-		printk(KERN_WARNING "ide-tcq; can't toggle tcq feature on "
-					"busy drive\n");
-		return 1;
-	}
-
-	return ide_enable_queued(drive, 1);
-}
-
-int __ide_dma_queued_off(ide_drive_t *drive)
-{
-	if (drive->media != ide_disk)
-		return 1;
-	if (ata_pending_commands(drive)) {
-		printk("ide-tcq; can't toggle tcq feature on busy drive\n");
-		return 1;
-	}
-
-	return ide_enable_queued(drive, 0);
-}
-
-static ide_startstop_t ide_dma_queued_rw(ide_drive_t *drive, u8 command)
-{
-	ide_hwif_t *hwif = HWIF(drive);
-	unsigned long flags;
-	byte stat, feat;
-
-	TCQ_PRINTK("%s: starting tag\n", drive->name);
-
-	/*
-	 * set nIEN, tag start operation will enable again when
-	 * it is safe
-	 */
-	drive_ctl_nien(drive, 1);
-
-	TCQ_PRINTK("%s: sending cmd=%x\n", drive->name, command);
-	hwif->OUTB(command, IDE_COMMAND_REG);
-
-	if (ide_tcq_wait_altstat(drive, &stat, BUSY_STAT)) {
-		printk("%s: alt stat timeout\n", drive->name);
-		goto err;
-	}
-
-	drive_ctl_nien(drive, 0);
-
-	if (stat & ERR_STAT)
-		goto err;
-
-	/*
-	 * bus not released, start dma
-	 */
-	feat = hwif->INB(IDE_NSECTOR_REG);
-	if (!(feat & REL)) {
-		TCQ_PRINTK("IMMED in queued_start, feat=%x\n", feat);
-		return __ide_dma_queued_start(drive);
-	}
-
-	/*
-	 * drive released the bus, clear active request and check for service
-	 */
-	spin_lock_irqsave(&ide_lock, flags);
-	HWGROUP(drive)->rq = NULL;
-	__ide_tcq_set_intr(HWGROUP(drive), ide_dmaq_intr);
-	spin_unlock_irqrestore(&ide_lock, flags);
-
-	TCQ_PRINTK("REL in queued_start\n");
-
-	stat = hwif->INB(IDE_STATUS_REG);
-	if (stat & SRV_STAT)
-		return ide_service(drive);
-
-	return ide_released;
-err:
-	ide_dump_status(drive, "rw_queued", stat);
-	ide_tcq_invalidate_queue(drive);
-	return ide_stopped;
-}
-
-ide_startstop_t __ide_dma_queued_read(ide_drive_t *drive)
-{
-	u8 command = WIN_READDMA_QUEUED;
-
-	if (drive->addressing == 1)
-		 command = WIN_READDMA_QUEUED_EXT;
-
-	return ide_dma_queued_rw(drive, command);
-}
-
-ide_startstop_t __ide_dma_queued_write(ide_drive_t *drive)
-{
-	u8 command = WIN_WRITEDMA_QUEUED;
-
-	if (drive->addressing == 1)
-		 command = WIN_WRITEDMA_QUEUED_EXT;
-
-	return ide_dma_queued_rw(drive, command);
-}
-
-ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive)
-{
-	ide_hwgroup_t *hwgroup = HWGROUP(drive);
-	struct request *rq = hwgroup->rq;
-	ide_hwif_t *hwif = HWIF(drive);
-	unsigned int reading = 0;
-
-	TCQ_PRINTK("ide_dma: setting up queued tag=%d\n", rq->tag);
-
-	if (!hwgroup->busy)
-		printk(KERN_ERR "queued_rw: hwgroup not busy\n");
-
-	if (ide_tcq_wait_dataphase(drive)) {
-		printk(KERN_WARNING "timeout waiting for data phase\n");
-		return ide_stopped;
-	}
-
-	if (rq_data_dir(rq) == READ)
-		reading = 1 << 3;
-
-	if (ide_start_dma(hwif, drive, reading))
-		return ide_stopped;
-
-	ide_tcq_set_intr(hwgroup, ide_dmaq_intr);
-
-	if (!hwif->ide_dma_begin(drive))
-		return ide_started;
-
-	return ide_stopped;
-}
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/ide/ide.c	Tue Jun 15 22:20:38 2004
@@ -188,7 +188,6 @@
 #endif
 
 EXPORT_SYMBOL(noautodma);
-EXPORT_SYMBOL(ide_bus_type);
 
 /*
  * This is declared extern in ide.h, for access by other IDE modules:
@@ -272,6 +271,8 @@
 #endif
 }
 
+extern void ide_arm_init(void);
+
 /*
  * init_ide_data() sets reasonable default values into all fields
  * of all instances of the hwifs and drives, but only on the first call.
@@ -312,12 +313,9 @@
 			ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]);
 #endif
 	}
-
-/* OBSOLETE: still needed on arm26 and arm */
-#ifdef CONFIG_ARM
-	/* Add default hw interfaces */
+#ifdef CONFIG_IDE_ARM
 	initializing = 1;
-	ide_init_default_hwifs();
+	ide_arm_init();
 	initializing = 0;
 #endif
 }
@@ -555,8 +553,6 @@
 	return -EBUSY;
 }
 
-EXPORT_SYMBOL(ide_hwif_request_regions);
-
 /**
  *	ide_hwif_release_regions - free IDE resources
  *
@@ -585,7 +581,101 @@
 			release_region(hwif->io_ports[i], 1);
 }
 
-EXPORT_SYMBOL(ide_hwif_release_regions);
+/* restore hwif to a sane state */
+static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
+{
+	hwif->hwgroup			= tmp_hwif->hwgroup;
+
+	hwif->gendev.parent		= tmp_hwif->gendev.parent;
+
+	hwif->proc			= tmp_hwif->proc;
+
+	hwif->major			= tmp_hwif->major;
+	hwif->straight8			= tmp_hwif->straight8;
+	hwif->bus_state			= tmp_hwif->bus_state;
+
+	hwif->atapi_dma			= tmp_hwif->atapi_dma;
+	hwif->ultra_mask		= tmp_hwif->ultra_mask;
+	hwif->mwdma_mask		= tmp_hwif->mwdma_mask;
+	hwif->swdma_mask		= tmp_hwif->swdma_mask;
+
+	hwif->chipset			= tmp_hwif->chipset;
+	hwif->hold			= tmp_hwif->hold;
+
+#ifdef CONFIG_BLK_DEV_IDEPCI
+	hwif->pci_dev			= tmp_hwif->pci_dev;
+	hwif->cds			= tmp_hwif->cds;
+#endif
+
+	hwif->identify			= tmp_hwif->identify;
+	hwif->tuneproc			= tmp_hwif->tuneproc;
+	hwif->speedproc			= tmp_hwif->speedproc;
+	hwif->selectproc		= tmp_hwif->selectproc;
+	hwif->reset_poll		= tmp_hwif->reset_poll;
+	hwif->pre_reset			= tmp_hwif->pre_reset;
+	hwif->resetproc			= tmp_hwif->resetproc;
+	hwif->intrproc			= tmp_hwif->intrproc;
+	hwif->maskproc			= tmp_hwif->maskproc;
+	hwif->quirkproc			= tmp_hwif->quirkproc;
+	hwif->busproc			= tmp_hwif->busproc;
+
+	hwif->ata_input_data		= tmp_hwif->ata_input_data;
+	hwif->ata_output_data		= tmp_hwif->ata_output_data;
+	hwif->atapi_input_bytes		= tmp_hwif->atapi_input_bytes;
+	hwif->atapi_output_bytes	= tmp_hwif->atapi_output_bytes;
+
+	hwif->ide_dma_read		= tmp_hwif->ide_dma_read;
+	hwif->ide_dma_write		= tmp_hwif->ide_dma_write;
+	hwif->ide_dma_begin		= tmp_hwif->ide_dma_begin;
+	hwif->ide_dma_end		= tmp_hwif->ide_dma_end;
+	hwif->ide_dma_check		= tmp_hwif->ide_dma_check;
+	hwif->ide_dma_on		= tmp_hwif->ide_dma_on;
+	hwif->ide_dma_off_quietly	= tmp_hwif->ide_dma_off_quietly;
+	hwif->ide_dma_test_irq		= tmp_hwif->ide_dma_test_irq;
+	hwif->ide_dma_host_on		= tmp_hwif->ide_dma_host_on;
+	hwif->ide_dma_host_off		= tmp_hwif->ide_dma_host_off;
+	hwif->ide_dma_verbose		= tmp_hwif->ide_dma_verbose;
+	hwif->ide_dma_lostirq		= tmp_hwif->ide_dma_lostirq;
+	hwif->ide_dma_timeout		= tmp_hwif->ide_dma_timeout;
+
+	hwif->OUTB			= tmp_hwif->OUTB;
+	hwif->OUTBSYNC			= tmp_hwif->OUTBSYNC;
+	hwif->OUTW			= tmp_hwif->OUTW;
+	hwif->OUTL			= tmp_hwif->OUTL;
+	hwif->OUTSW			= tmp_hwif->OUTSW;
+	hwif->OUTSL			= tmp_hwif->OUTSL;
+
+	hwif->INB			= tmp_hwif->INB;
+	hwif->INW			= tmp_hwif->INW;
+	hwif->INL			= tmp_hwif->INL;
+	hwif->INSW			= tmp_hwif->INSW;
+	hwif->INSL			= tmp_hwif->INSL;
+
+	hwif->mmio			= tmp_hwif->mmio;
+	hwif->rqsize			= tmp_hwif->rqsize;
+	hwif->no_lba48			= tmp_hwif->no_lba48;
+
+#ifndef CONFIG_BLK_DEV_IDECS
+	hwif->irq			= tmp_hwif->irq;
+#endif
+
+	hwif->dma_base			= tmp_hwif->dma_base;
+	hwif->dma_master		= tmp_hwif->dma_master;
+	hwif->dma_command		= tmp_hwif->dma_command;
+	hwif->dma_vendor1		= tmp_hwif->dma_vendor1;
+	hwif->dma_status		= tmp_hwif->dma_status;
+	hwif->dma_vendor3		= tmp_hwif->dma_vendor3;
+	hwif->dma_prdtable		= tmp_hwif->dma_prdtable;
+
+	hwif->dma_extra			= tmp_hwif->dma_extra;
+	hwif->config_data		= tmp_hwif->config_data;
+	hwif->select_data		= tmp_hwif->select_data;
+	hwif->autodma			= tmp_hwif->autodma;
+	hwif->udma_four			= tmp_hwif->udma_four;
+	hwif->no_dsc			= tmp_hwif->no_dsc;
+
+	hwif->hwif_data			= tmp_hwif->hwif_data;
+}
 
 /**
  *	ide_unregister		-	free an ide interface
@@ -608,18 +698,22 @@
  *	Unregister restores the hwif structures to the default state.
  *	This is raving bonkers.
  */
- 
-void ide_unregister (unsigned int index)
+
+void ide_unregister(unsigned int index)
 {
 	ide_drive_t *drive;
-	ide_hwif_t *hwif, *g;
+	ide_hwif_t *hwif, *g, *tmp_hwif;
 	ide_hwgroup_t *hwgroup;
 	int irq_count = 0, unit, i;
-	ide_hwif_t old_hwif;
 
-	if (index >= MAX_HWIFS)
-		BUG();
-		
+	BUG_ON(index >= MAX_HWIFS);
+
+	tmp_hwif = kmalloc(sizeof(*tmp_hwif), GFP_KERNEL|__GFP_NOFAIL);
+	if (!tmp_hwif) {
+		printk(KERN_ERR "%s: unable to allocate memory\n", __FUNCTION__);
+		return;
+	}
+
 	BUG_ON(in_interrupt());
 	BUG_ON(irqs_disabled());
 	down(&ide_cfg_sem);
@@ -636,7 +730,7 @@
 		drive->dead = 1;
 	}
 	hwif->present = 0;
-	
+
 	spin_unlock_irq(&ide_lock);
 
 	for (unit = 0; unit < MAX_DRIVES; ++unit) {
@@ -645,7 +739,7 @@
 			continue;
 		DRIVER(drive)->cleanup(drive);
 	}
-	
+
 #ifdef CONFIG_PROC_FS
 	destroy_proc_ide_drives(hwif);
 #endif
@@ -765,122 +859,20 @@
 		hwif->dma_prdtable = 0;
 	}
 
-	old_hwif			= *hwif;
+	/* copy original settings */
+	*tmp_hwif = *hwif;
 
-	init_hwif_data(hwif, index);	/* restore hwif data to pristine status */
+	/* restore hwif data to pristine status */
+	init_hwif_data(hwif, index);
 	init_hwif_default(hwif, index);
 
-	hwif->hwgroup			= old_hwif.hwgroup;
-
-	hwif->gendev.parent		= old_hwif.gendev.parent;
-
-	hwif->proc			= old_hwif.proc;
-
-	hwif->major			= old_hwif.major;
-//	hwif->index			= old_hwif.index;
-//	hwif->channel			= old_hwif.channel;
-	hwif->straight8			= old_hwif.straight8;
-	hwif->bus_state			= old_hwif.bus_state;
-
-	hwif->atapi_dma			= old_hwif.atapi_dma;
-	hwif->ultra_mask		= old_hwif.ultra_mask;
-	hwif->mwdma_mask		= old_hwif.mwdma_mask;
-	hwif->swdma_mask		= old_hwif.swdma_mask;
-
-	hwif->chipset			= old_hwif.chipset;
-	hwif->hold			= old_hwif.hold;
-
-#ifdef CONFIG_BLK_DEV_IDEPCI
-	hwif->pci_dev			= old_hwif.pci_dev;
-	hwif->cds			= old_hwif.cds;
-#endif /* CONFIG_BLK_DEV_IDEPCI */
-
-#if 0
-	hwif->hwifops			= old_hwif.hwifops;
-#else
-	hwif->identify			= old_hwif.identify;
-	hwif->tuneproc			= old_hwif.tuneproc;
-	hwif->speedproc			= old_hwif.speedproc;
-	hwif->selectproc		= old_hwif.selectproc;
-	hwif->reset_poll		= old_hwif.reset_poll;
-	hwif->pre_reset			= old_hwif.pre_reset;
-	hwif->resetproc			= old_hwif.resetproc;
-	hwif->intrproc			= old_hwif.intrproc;
-	hwif->maskproc			= old_hwif.maskproc;
-	hwif->quirkproc			= old_hwif.quirkproc;
-	hwif->busproc			= old_hwif.busproc;
-#endif
-
-#if 0
-	hwif->pioops			= old_hwif.pioops;
-#else
-	hwif->ata_input_data		= old_hwif.ata_input_data;
-	hwif->ata_output_data		= old_hwif.ata_output_data;
-	hwif->atapi_input_bytes		= old_hwif.atapi_input_bytes;
-	hwif->atapi_output_bytes	= old_hwif.atapi_output_bytes;
-#endif
-
-#if 0
-	hwif->dmaops			= old_hwif.dmaops;
-#else
-	hwif->ide_dma_read		= old_hwif.ide_dma_read;
-	hwif->ide_dma_write		= old_hwif.ide_dma_write;
-	hwif->ide_dma_begin		= old_hwif.ide_dma_begin;
-	hwif->ide_dma_end		= old_hwif.ide_dma_end;
-	hwif->ide_dma_check		= old_hwif.ide_dma_check;
-	hwif->ide_dma_on		= old_hwif.ide_dma_on;
-	hwif->ide_dma_off_quietly	= old_hwif.ide_dma_off_quietly;
-	hwif->ide_dma_test_irq		= old_hwif.ide_dma_test_irq;
-	hwif->ide_dma_host_on		= old_hwif.ide_dma_host_on;
-	hwif->ide_dma_host_off		= old_hwif.ide_dma_host_off;
-	hwif->ide_dma_verbose		= old_hwif.ide_dma_verbose;
-	hwif->ide_dma_lostirq		= old_hwif.ide_dma_lostirq;
-	hwif->ide_dma_timeout		= old_hwif.ide_dma_timeout;
-#endif
-
-#if 0
-	hwif->iops			= old_hwif.iops;
-#else
-	hwif->OUTB		= old_hwif.OUTB;
-	hwif->OUTBSYNC		= old_hwif.OUTBSYNC;
-	hwif->OUTW		= old_hwif.OUTW;
-	hwif->OUTL		= old_hwif.OUTL;
-	hwif->OUTSW		= old_hwif.OUTSW;
-	hwif->OUTSL		= old_hwif.OUTSL;
-
-	hwif->INB		= old_hwif.INB;
-	hwif->INW		= old_hwif.INW;
-	hwif->INL		= old_hwif.INL;
-	hwif->INSW		= old_hwif.INSW;
-	hwif->INSL		= old_hwif.INSL;
-#endif
-
-	hwif->mmio			= old_hwif.mmio;
-	hwif->rqsize			= old_hwif.rqsize;
-	hwif->no_lba48			= old_hwif.no_lba48;
-#ifndef CONFIG_BLK_DEV_IDECS
-	hwif->irq			= old_hwif.irq;
-#endif /* CONFIG_BLK_DEV_IDECS */
-
-	hwif->dma_base			= old_hwif.dma_base;
-	hwif->dma_master		= old_hwif.dma_master;
-	hwif->dma_command		= old_hwif.dma_command;
-	hwif->dma_vendor1		= old_hwif.dma_vendor1;
-	hwif->dma_status		= old_hwif.dma_status;
-	hwif->dma_vendor3		= old_hwif.dma_vendor3;
-	hwif->dma_prdtable		= old_hwif.dma_prdtable;
-
-	hwif->dma_extra			= old_hwif.dma_extra;
-	hwif->config_data		= old_hwif.config_data;
-	hwif->select_data		= old_hwif.select_data;
-	hwif->autodma			= old_hwif.autodma;
-	hwif->udma_four			= old_hwif.udma_four;
-	hwif->no_dsc			= old_hwif.no_dsc;
+	ide_hwif_restore(hwif, tmp_hwif);
 
-	hwif->hwif_data			= old_hwif.hwif_data;
 abort:
 	spin_unlock_irq(&ide_lock);
 	up(&ide_cfg_sem);
+
+	kfree(tmp_hwif);
 }
 
 EXPORT_SYMBOL(ide_unregister);
@@ -939,8 +931,6 @@
  */
 }
 
-EXPORT_SYMBOL(ide_setup_ports);
-
 /*
  * Register an IDE interface, specifying exactly the registers etc
  * Set init=1 iff calling before probes have taken place.
@@ -1001,7 +991,6 @@
  */
 
 DECLARE_MUTEX(ide_setting_sem);
-EXPORT_SYMBOL(ide_setting_sem);
 
 /**
  *	ide_add_setting	-	add an ide setting option
@@ -1095,26 +1084,6 @@
 }
 
 /**
- *	ide_remove_setting	-	remove an ide setting option
- *	@drive: drive to use
- *	@name: setting name
- *
- *	Removes the setting named from the device if it is present.
- *	The function takes the settings_lock to protect against 
- *	parallel changes. This function must not be called from IRQ
- *	context.
- */
- 
-void ide_remove_setting (ide_drive_t *drive, char *name)
-{
-	down(&ide_setting_sem);
-	__ide_remove_setting(drive, name);
-	up(&ide_setting_sem);
-}
-
-EXPORT_SYMBOL(ide_remove_setting);
-
-/**
  *	ide_find_setting_by_ioctl	-	find a drive specific ioctl
  *	@drive: drive to scan
  *	@cmd: ioctl command to handle
@@ -1295,8 +1264,6 @@
 	return 0;
 }
 
-EXPORT_SYMBOL(ide_write_setting);
-
 static int set_io_32bit(ide_drive_t *drive, int arg)
 {
 	drive->io_32bit = arg;
@@ -1390,26 +1357,6 @@
 		ide_add_setting(drive,	"ide-scsi",		SETTING_RW,					-1,		HDIO_SET_IDE_SCSI,		TYPE_BYTE,	0,	1,				1,		1,		&drive->scsi,			ide_atapi_to_scsi);
 }
 
-/*
- * Delay for *at least* 50ms.  As we don't know how much time is left
- * until the next tick occurs, we wait an extra tick to be safe.
- * This is used only during the probing/polling for drives at boot time.
- *
- * However, its usefullness may be needed in other places, thus we export it now.
- * The future may change this to a millisecond setable delay.
- */
-void ide_delay_50ms (void)
-{
-#ifndef CONFIG_BLK_DEV_IDECS
-	mdelay(50);
-#else
-	__set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(1+HZ/20);
-#endif /* CONFIG_BLK_DEV_IDECS */
-}
-
-EXPORT_SYMBOL(ide_delay_50ms);
-
 int system_bus_clock (void)
 {
 	return((int) ((!system_bus_speed) ? ide_system_bus_speed() : system_bus_speed ));
@@ -1444,8 +1391,6 @@
 	return 1;
 }
 
-EXPORT_SYMBOL(ide_replace_subdriver);
-
 int ata_attach(ide_drive_t *drive)
 {
 	struct list_head *p;
@@ -1470,8 +1415,6 @@
 	return 1;
 }
 
-EXPORT_SYMBOL(ata_attach);
-
 static int generic_ide_suspend(struct device *dev, u32 state)
 {
 	ide_drive_t *drive = dev->driver_data;
@@ -1516,13 +1459,14 @@
 	ide_drive_t *drive = bdev->bd_disk->private_data;
 	ide_settings_t *setting;
 	int err = 0;
+	void __user *p = (void __user *)arg;
 
 	down(&ide_setting_sem);
 	if ((setting = ide_find_setting_by_ioctl(drive, cmd)) != NULL) {
 		if (cmd == setting->read_ioctl) {
 			err = ide_read_setting(drive, setting);
 			up(&ide_setting_sem);
-			return err >= 0 ? put_user(err, (long *) arg) : err;
+			return err >= 0 ? put_user(err, (long __user *)arg) : err;
 		} else {
 			if (bdev != bdev->bd_contains)
 				err = -EINVAL;
@@ -1537,14 +1481,14 @@
 	switch (cmd) {
 		case HDIO_GETGEO:
 		{
-			struct hd_geometry *loc = (struct hd_geometry *) arg;
-			u16 bios_cyl = drive->bios_cyl; /* truncate */
-			if (!loc || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL;
-			if (put_user(drive->bios_head, (u8 *) &loc->heads)) return -EFAULT;
-			if (put_user(drive->bios_sect, (u8 *) &loc->sectors)) return -EFAULT;
-			if (put_user(bios_cyl, (u16 *) &loc->cylinders)) return -EFAULT;
-			if (put_user((unsigned)get_start_sect(bdev),
-				(unsigned long *) &loc->start)) return -EFAULT;
+			struct hd_geometry geom;
+			if (!p || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL;
+			geom.heads = drive->bios_head;
+			geom.sectors = drive->bios_sect;
+			geom.cylinders = (u16)drive->bios_cyl; /* truncate */
+			geom.start = get_start_sect(bdev);
+			if (copy_to_user(p, &geom, sizeof(struct hd_geometry)))
+				return -EFAULT;
 			return 0;
 		}
 
@@ -1554,7 +1498,7 @@
 				return -EINVAL;
 			if (drive->id_read == 0)
 				return -ENOMSG;
-			if (copy_to_user((char *)arg, (char *)drive->id, (cmd == HDIO_GET_IDENTITY) ? sizeof(*drive->id) : 142))
+			if (copy_to_user(p, drive->id, (cmd == HDIO_GET_IDENTITY) ? sizeof(*drive->id) : 142))
 				return -EFAULT;
 			return 0;
 
@@ -1564,7 +1508,7 @@
 					drive->nice0		<< 	IDE_NICE_0		|
 					drive->nice1		<<	IDE_NICE_1		|
 					drive->nice2		<<	IDE_NICE_2,
-					(long *) arg);
+					(long __user *) arg);
 
 #ifdef CONFIG_IDE_TASK_IOCTL
 		case HDIO_DRIVE_TASKFILE:
@@ -1593,7 +1537,7 @@
 			hw_regs_t hw;
 			int args[3];
 			if (!capable(CAP_SYS_RAWIO)) return -EACCES;
-			if (copy_from_user(args, (void *)arg, 3 * sizeof(int)))
+			if (copy_from_user(args, p, 3 * sizeof(int)))
 				return -EFAULT;
 			memset(&hw, 0, sizeof(hw));
 			ide_init_hwif_ports(&hw, (unsigned long) args[0],
@@ -1661,12 +1605,12 @@
 
 		case CDROMEJECT:
 		case CDROMCLOSETRAY:
-			return scsi_cmd_ioctl(bdev->bd_disk, cmd, arg);
+			return scsi_cmd_ioctl(bdev->bd_disk, cmd, p);
 
 		case HDIO_GET_BUSSTATE:
 			if (!capable(CAP_SYS_ADMIN))
 				return -EACCES;
-			if (put_user(HWIF(drive)->bus_state, (long *)arg))
+			if (put_user(HWIF(drive)->bus_state, (long __user *)arg))
 				return -EFAULT;
 			return 0;
 
@@ -1828,7 +1772,7 @@
 	if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) {
 		const char *hd_words[] = {
 			"none", "noprobe", "nowerr", "cdrom", "serialize",
-			"autotune", "noautotune", "minus8", "swapdata", "bswap",
+			"autotune", "noautotune", "stroke", "swapdata", "bswap",
 			"minus11", "remap", "remap63", "scsi", NULL };
 		unit = s[2] - 'a';
 		hw   = unit / MAX_DRIVES;
@@ -1862,6 +1806,9 @@
 			case -7: /* "noautotune" */
 				drive->autotune = IDE_TUNE_NOAUTO;
 				goto done;
+			case -8: /* stroke */
+				drive->stroke = 1;
+				goto done;
 			case -9: /* "swapdata" */
 			case -10: /* "bswap" */
 				drive->bswap = 1;
@@ -2056,6 +2003,9 @@
 	return 1;
 }
 
+extern void pnpide_init(void);
+extern void h8300_ide_init(void);
+
 /*
  * probe_for_hwifs() finds/initializes "known" IDE interfaces
  */
@@ -2090,12 +2040,6 @@
 		pmac_ide_probe();
 	}
 #endif /* CONFIG_BLK_DEV_IDE_PMAC */
-#ifdef CONFIG_BLK_DEV_IDE_SWARM
-	{
-		extern void swarm_ide_probe(void);
-		swarm_ide_probe();
-	}
-#endif /* CONFIG_BLK_DEV_IDE_SWARM */
 #ifdef CONFIG_BLK_DEV_GAYLE
 	{
 		extern void gayle_init(void);
@@ -2126,12 +2070,12 @@
 		buddha_init();
 	}
 #endif /* CONFIG_BLK_DEV_BUDDHA */
-#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP)
-	{
-		extern void pnpide_init(int enable);
-		pnpide_init(1);
-	}
-#endif /* CONFIG_BLK_DEV_IDEPNP */
+#ifdef CONFIG_BLK_DEV_IDEPNP
+	pnpide_init();
+#endif
+#ifdef CONFIG_H8300
+	h8300_ide_init();
+#endif
 }
 
 /*
@@ -2266,9 +2210,6 @@
 		up(&ide_setting_sem);
 		return 1;
 	}
-#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP) && defined(MODULE)
-	pnpide_init(0);
-#endif /* CONFIG_BLK_DEV_IDEPNP */
 #ifdef CONFIG_PROC_FS
 	ide_remove_proc_entries(drive->proc, DRIVER(drive)->proc);
 	ide_remove_proc_entries(drive->proc, generic_subdriver_entries);
diff -Nru a/drivers/ide/legacy/pdc4030.c b/drivers/ide/legacy/pdc4030.c
--- a/drivers/ide/legacy/pdc4030.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/legacy/pdc4030.c	Tue Jun 15 22:20:40 2004
@@ -282,8 +282,8 @@
 	hwif->OUTB(0xF3, IDE_SECTOR_REG);
 	hwif->OUTB(0x14, IDE_SELECT_REG);
 	hwif->OUTB(PROMISE_EXTENDED_COMMAND, IDE_COMMAND_REG);
-	
-	ide_delay_50ms();
+
+	msleep(50);
 
 	if (hwif->INB(IDE_ERROR_REG) == 'P' &&
 	    hwif->INB(IDE_NSECTOR_REG) == 'T' &&
@@ -755,18 +755,6 @@
 #endif
 
 	BUG_ON(rq->nr_sectors > 127);
-
-	if (!blk_fs_request(rq)) {
-		blk_dump_rq_flags(rq, "promise_rw_disk - bad command");
-		DRIVER(drive)->end_request(drive, 0, 0);
-		return ide_stopped;
-	}
-
-#ifdef DEBUG
-	printk(KERN_DEBUG "%s: %sing: LBAsect=%lu, sectors=%lu\n",
-			  drive->name, rq_data_dir(rq) ? "writ" : "read",
-			  block, rq->nr_sectors);
-#endif
 
 #ifndef CONFIG_IDE_TASKFILE_IO
 	if (IDE_CONTROL_REG)
diff -Nru a/drivers/ide/pci/adma100.h b/drivers/ide/pci/adma100.h
--- a/drivers/ide/pci/adma100.h	Tue Jun 15 22:20:44 2004
+++ b/drivers/ide/pci/adma100.h	Tue Jun 15 22:20:44 2004
@@ -17,19 +17,11 @@
 		.name		= "ADMA100",
 		.init_setup	= init_setup_pdcadma,
 		.init_chipset	= init_chipset_pdcadma,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdcadma,
 		.init_dma	= init_dma_pdcadma,
 		.channels	= 2,
 		.autodma	= NODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 }
 
diff -Nru a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
--- a/drivers/ide/pci/aec62xx.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/ide/pci/aec62xx.c	Tue Jun 15 22:20:43 2004
@@ -409,7 +409,7 @@
 	return 0;
 }
 
-static unsigned int __init init_chipset_aec62xx (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name)
 {
 	int bus_speed = system_bus_clock();
 
@@ -435,7 +435,7 @@
 	return dev->irq;
 }
 
-static void __init init_hwif_aec62xx (ide_hwif_t *hwif)
+static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
 {
 	hwif->autodma = 0;
 	hwif->tuneproc = &aec62xx_tune_drive;
@@ -468,7 +468,7 @@
 	hwif->drives[1].autodma = hwif->autodma;
 }
 
-static void __init init_dma_aec62xx (ide_hwif_t *hwif, unsigned long dmabase)
+static void __devinit init_dma_aec62xx(ide_hwif_t *hwif, unsigned long dmabase)
 {
 	struct pci_dev *dev	= hwif->pci_dev;
 
@@ -490,12 +490,12 @@
 	ide_setup_dma(hwif, dmabase, 8);
 }
 
-static void __init init_setup_aec62xx (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	ide_setup_pci_device(dev, d);
 }
 
-static void __init init_setup_aec6x80 (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	unsigned long bar4reg = pci_resource_start(dev, 4);
 
@@ -525,8 +525,6 @@
 {
 	ide_pci_device_t *d = &aec62xx_chipsets[id->driver_data];
 
-	if (dev->device != d->device)
-		BUG();
 	d->init_setup(dev, d);
 	return 0;
 }
diff -Nru a/drivers/ide/pci/aec62xx.h b/drivers/ide/pci/aec62xx.h
--- a/drivers/ide/pci/aec62xx.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/pci/aec62xx.h	Tue Jun 15 22:20:40 2004
@@ -78,75 +78,53 @@
 
 static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_ARTOP,
-		.device		= PCI_DEVICE_ID_ARTOP_ATP850UF,
 		.name		= "AEC6210",
 		.init_setup	= init_setup_aec62xx,
 		.init_chipset	= init_chipset_aec62xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_aec62xx,
 		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_ARTOP,
-		.device		= PCI_DEVICE_ID_ARTOP_ATP860,
 		.name		= "AEC6260",
 		.init_setup	= init_setup_aec62xx,
 		.init_chipset	= init_chipset_aec62xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_aec62xx,
 		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_ARTOP,
-		.device		= PCI_DEVICE_ID_ARTOP_ATP860R,
 		.name		= "AEC6260R",
 		.init_setup	= init_setup_aec62xx,
 		.init_chipset	= init_chipset_aec62xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_aec62xx,
 		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
 		.bootable	= NEVER_BOARD,
-		.extra		= 0,
 	},{	/* 3 */
-		.vendor		= PCI_VENDOR_ID_ARTOP,
-		.device		= PCI_DEVICE_ID_ARTOP_ATP865,
 		.name		= "AEC6X80",
 		.init_setup	= init_setup_aec6x80,
 		.init_chipset	= init_chipset_aec62xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_aec62xx,
 		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 4 */
-		.vendor		= PCI_VENDOR_ID_ARTOP,
-		.device		= PCI_DEVICE_ID_ARTOP_ATP865R,
 		.name		= "AEC6X80R",
 		.init_setup	= init_setup_aec6x80,
 		.init_chipset	= init_chipset_aec62xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_aec62xx,
 		.init_dma	= init_dma_aec62xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	}
 };
 
diff -Nru a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
--- a/drivers/ide/pci/alim15x3.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/alim15x3.c	Tue Jun 15 22:20:39 2004
@@ -38,7 +38,7 @@
 
 #include <asm/io.h>
 
-#include "alim15x3.h"
+#define DISPLAY_ALI_TIMINGS
 
 /*
  *	ALi devices are not plug in. Otherwise these static values would
@@ -853,6 +853,16 @@
 	ide_setup_dma(hwif, dmabase, 8);
 }
 
+static ide_pci_device_t ali15x3_chipset __devinitdata = {
+	.name		= "ALI15X3",
+	.init_chipset	= init_chipset_ali15x3,
+	.init_hwif	= init_hwif_ali15x3,
+	.init_dma	= init_dma_ali15x3,
+	.channels	= 2,
+	.autodma	= AUTODMA,
+	.bootable	= ON_BOARD,
+};
+
 /**
  *	alim15x3_init_one	-	set up an ALi15x3 IDE controller
  *	@dev: PCI device to set up
@@ -863,8 +873,8 @@
  
 static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &ali15x3_chipsets[id->driver_data];
-	
+	ide_pci_device_t *d = &ali15x3_chipset;
+
 	if(pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, NULL))
 		printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n");
 
diff -Nru a/drivers/ide/pci/alim15x3.h b/drivers/ide/pci/alim15x3.h
--- a/drivers/ide/pci/alim15x3.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,37 +0,0 @@
-#ifndef ALI15X3_H
-#define ALI15X3_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define DISPLAY_ALI_TIMINGS
-
-static unsigned int init_chipset_ali15x3(struct pci_dev *, const char *);
-static void init_hwif_common_ali15x3(ide_hwif_t *);
-static void init_hwif_ali15x3(ide_hwif_t *);
-static void init_dma_ali15x3(ide_hwif_t *, unsigned long);
-
-static ide_pci_device_t ali15x3_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_AL,
-		.device		= PCI_DEVICE_ID_AL_M5229,
-		.name		= "ALI15X3",
-		.init_chipset	= init_chipset_ali15x3,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_ali15x3,
-		.init_dma	= init_dma_ali15x3,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* ALI15X3 */
diff -Nru a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
--- a/drivers/ide/pci/amd74xx.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/ide/pci/amd74xx.c	Tue Jun 15 22:21:05 2004
@@ -1,7 +1,8 @@
 /*
  * Version 2.13
  *
- * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s IDE driver for Linux.
+ * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
+ * IDE driver for Linux.
  *
  * Copyright (c) 2000-2002 Vojtech Pavlik
  *
@@ -26,7 +27,8 @@
 #include <asm/io.h>
 
 #include "ide-timing.h"
-#include "amd74xx.h"
+
+#define DISPLAY_AMD_TIMINGS
 
 #define AMD_IDE_ENABLE		(0x00 + amd_config->base)
 #define AMD_IDE_CONFIG		(0x01 + amd_config->base)
@@ -68,6 +70,12 @@
 	{ PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE,	0x50, AMD_UDMA_133 },
 	{ PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA,	0x50, AMD_UDMA_133 },
 	{ PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2,	0x50, AMD_UDMA_133 },
+	{ PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE,	0x50, AMD_UDMA_133 },
+	{ PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA,	0x50, AMD_UDMA_133 },
+	{ PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2,	0x50, AMD_UDMA_133 },
+	{ PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE,	0x50, AMD_UDMA_133 },
+	{ PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA,	0x50, AMD_UDMA_133 },
+	{ PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2,	0x50, AMD_UDMA_133 },
 	{ 0 }
 };
 
@@ -441,11 +449,55 @@
         hwif->drives[1].autodma = hwif->autodma;
 }
 
+#define DECLARE_AMD_DEV(name_str)					\
+	{								\
+		.name		= name_str,				\
+		.init_chipset	= init_chipset_amd74xx,			\
+		.init_hwif	= init_hwif_amd74xx,			\
+		.channels	= 2,					\
+		.autodma	= AUTODMA,				\
+		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},	\
+		.bootable	= ON_BOARD,				\
+	}
+
+#define DECLARE_NV_DEV(name_str)					\
+	{								\
+		.name		= name_str,				\
+		.init_chipset	= init_chipset_amd74xx,			\
+		.init_hwif	= init_hwif_amd74xx,			\
+		.channels	= 2,					\
+		.autodma	= AUTODMA,				\
+		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},	\
+		.bootable	= ON_BOARD,				\
+	}
+
+static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
+	/*  0 */ DECLARE_AMD_DEV("AMD7401"),
+	/*  1 */ DECLARE_AMD_DEV("AMD7409"),
+	/*  2 */ DECLARE_AMD_DEV("AMD7411"),
+	/*  3 */ DECLARE_AMD_DEV("AMD7441"),
+	/*  4 */ DECLARE_AMD_DEV("AMD8111"),
+
+	/*  5 */ DECLARE_NV_DEV("NFORCE"),
+	/*  6 */ DECLARE_NV_DEV("NFORCE2"),
+	/*  7 */ DECLARE_NV_DEV("NFORCE2-U400R"),
+	/*  8 */ DECLARE_NV_DEV("NFORCE2-U400R-SATA"),
+	/*  9 */ DECLARE_NV_DEV("NFORCE3-150"),
+	/* 10 */ DECLARE_NV_DEV("NFORCE3-250"),
+	/* 11 */ DECLARE_NV_DEV("NFORCE3-250-SATA"),
+	/* 12 */ DECLARE_NV_DEV("NFORCE3-250-SATA2"),
+	/* 13 */ DECLARE_NV_DEV("NFORCE-CK804"),
+	/* 14 */ DECLARE_NV_DEV("NFORCE-CK804-SATA"),
+	/* 15 */ DECLARE_NV_DEV("NFORCE-CK804-SATA2"),
+	/* 16 */ DECLARE_NV_DEV("NFORCE-MCP04"),
+	/* 17 */ DECLARE_NV_DEV("NFORCE-MCP04-SATA"),
+	/* 18 */ DECLARE_NV_DEV("NFORCE-MCP04-SATA2")
+};
+
 static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	amd_chipset = amd74xx_chipsets + id->driver_data;
 	amd_config = amd_ide_chips + id->driver_data;
-	if (dev->device != amd_chipset->device) BUG();
 	if (dev->device != amd_config->id) BUG();
 	ide_setup_pci_device(dev, amd_chipset);
 	return 0;
@@ -465,6 +517,12 @@
 	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 10 },
 	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11 },
 	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA,	PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18 },
 	{ 0, },
 };
 MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
diff -Nru a/drivers/ide/pci/amd74xx.h b/drivers/ide/pci/amd74xx.h
--- a/drivers/ide/pci/amd74xx.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,168 +0,0 @@
-#ifndef AMD74XX_H
-#define AMD74XX_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define DISPLAY_AMD_TIMINGS
-
-static unsigned int init_chipset_amd74xx(struct pci_dev *, const char *);
-static void init_hwif_amd74xx(ide_hwif_t *);
-
-static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_AMD,
-		.device		= PCI_DEVICE_ID_AMD_COBRA_7401,
-		.name		= "AMD7401",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0
-	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_AMD,
-		.device		= PCI_DEVICE_ID_AMD_VIPER_7409,
-		.name		= "AMD7409",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0
-	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_AMD,
-		.device		= PCI_DEVICE_ID_AMD_VIPER_7411,
-		.name		= "AMD7411",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0
-	},{	/* 3 */
-		.vendor		= PCI_VENDOR_ID_AMD,
-		.device		= PCI_DEVICE_ID_AMD_OPUS_7441,
-		.name		= "AMD7441",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0
-	},{	/* 4 */
-		.vendor		= PCI_VENDOR_ID_AMD,
-		.device		= PCI_DEVICE_ID_AMD_8111_IDE,
-		.name		= "AMD8111",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.autodma	= AUTODMA,
-		.channels	= 2,
-		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0
-	},
-	{	/* 5 */
-		.vendor		= PCI_VENDOR_ID_NVIDIA,
-		.device		= PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,
-		.name		= "NFORCE",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},
-	{	/* 6 */
-		.vendor		= PCI_VENDOR_ID_NVIDIA,
-		.device		= PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE,
-		.name		= "NFORCE2",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},
-	{	/* 7 */
-		.vendor		= PCI_VENDOR_ID_NVIDIA,
-		.device		= PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE,
-		.name		= "NFORCE2S",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
-		.bootable	= ON_BOARD,
-	},
-	{	/* 8 */
-		.vendor		= PCI_VENDOR_ID_NVIDIA,
-		.device		= PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA,
-		.name		= "NFORCE2S-SATA",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
-		.bootable	= ON_BOARD,
-	},
-	{	/* 9 */
-		.vendor		= PCI_VENDOR_ID_NVIDIA,
-		.device		= PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE,
-		.name		= "NFORCE3",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
-		.bootable	= ON_BOARD,
-	},
-	{	/* 10 */
-		.vendor		= PCI_VENDOR_ID_NVIDIA,
-		.device		= PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE,
-		.name		= "NFORCE3S",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
-		.bootable	= ON_BOARD,
-	},
-	{	/* 11 */
-		.vendor		= PCI_VENDOR_ID_NVIDIA,
-		.device		= PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA,
-		.name		= "NFORCE3S-SATA",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
-		.bootable	= ON_BOARD,
-	},
-	{	/* 12 */
-		.vendor		= PCI_VENDOR_ID_NVIDIA,
-		.device		= PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2,
-		.name		= "NFORCE3S-SATA2",
-		.init_chipset	= init_chipset_amd74xx,
-		.init_hwif	= init_hwif_amd74xx,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
-		.bootable	= ON_BOARD,
-	},
-	{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* AMD74XX_H */
diff -Nru a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
--- a/drivers/ide/pci/atiixp.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/pci/atiixp.c	Tue Jun 15 22:20:40 2004
@@ -458,8 +458,6 @@
 
 static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_ATI,
-		.device		= PCI_DEVICE_ID_ATI_IXP_IDE,
 		.name		= "ATIIXP",
 		.init_chipset	= init_chipset_atiixp,
 		.init_hwif	= init_hwif_atiixp,
@@ -481,11 +479,7 @@
 
 static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &atiixp_pci_info[id->driver_data];
-
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/cmd640.h b/drivers/ide/pci/cmd640.h
--- a/drivers/ide/pci/cmd640.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,32 +0,0 @@
-#ifndef CMD640_H
-#define CMD640_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define IDE_IGNORE      ((void *)-1)
-
-static ide_pci_device_t cmd640_chipsets[] __initdata = {
-	{
-		.vendor		= PCI_VENDOR_ID_CMD,
-		.device		= PCI_DEVICE_ID_CMD_640,
-		.name		= "CMD640",
-		.init_setup	= NULL,
-		.init_chipset	= NULL,
-		.init_iops	= NULL,
-		.init_hwif	= IDE_IGNORE,
-		.init_dma	= NULL,
-		.channels	= 2,
-		.autodma	= NODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.bootable	= EOL,
-	}
-}
-
-#endif /* CMD640_H */
diff -Nru a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
--- a/drivers/ide/pci/cmd64x.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/ide/pci/cmd64x.c	Tue Jun 15 22:20:44 2004
@@ -586,7 +586,7 @@
 	return (dma_stat & 7) != 4;
 }
 
-static unsigned int __init init_chipset_cmd64x (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const char *name)
 {
 	u32 class_rev = 0;
 	u8 mrdmode = 0;
@@ -674,7 +674,7 @@
 	return 0;
 }
 
-static unsigned int __init ata66_cmd64x (ide_hwif_t *hwif)
+static unsigned int __devinit ata66_cmd64x(ide_hwif_t *hwif)
 {
 	u8 ata66 = 0, mask = (hwif->channel) ? 0x02 : 0x01;
 
@@ -689,7 +689,7 @@
 	return (ata66 & mask) ? 1 : 0;
 }
 
-static void __init init_hwif_cmd64x (ide_hwif_t *hwif)
+static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
 {
 	struct pci_dev *dev	= hwif->pci_dev;
 	unsigned int class_rev;
@@ -746,10 +746,7 @@
 
 static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &cmd64x_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &cmd64x_chipsets[id->driver_data]);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/cmd64x.h b/drivers/ide/pci/cmd64x.h
--- a/drivers/ide/pci/cmd64x.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/cmd64x.h	Tue Jun 15 22:20:39 2004
@@ -65,58 +65,34 @@
 
 static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_CMD,
-		.device		= PCI_DEVICE_ID_CMD_643,
 		.name		= "CMD643",
 		.init_chipset	= init_chipset_cmd64x,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_cmd64x,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_CMD,
-		.device		= PCI_DEVICE_ID_CMD_646,
 		.name		= "CMD646",
 		.init_chipset	= init_chipset_cmd64x,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_cmd64x,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x00,0x00,0x00}, {0x51,0x80,0x80}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_CMD,
-		.device	= PCI_DEVICE_ID_CMD_648,
 		.name		= "CMD648",
 		.init_chipset	= init_chipset_cmd64x,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_cmd64x,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{
-		.vendor		= PCI_VENDOR_ID_CMD,
-		.device		= PCI_DEVICE_ID_CMD_649,
 		.name		= "CMD649",
 		.init_chipset	= init_chipset_cmd64x,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_cmd64x,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 2,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
--- a/drivers/ide/pci/cs5520.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/ide/pci/cs5520.c	Tue Jun 15 22:20:36 2004
@@ -51,7 +51,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#include "cs5520.h"
+#define DISPLAY_CS5520_TIMINGS
 
 #if defined(DISPLAY_CS5520_TIMINGS) && defined(CONFIG_PROC_FS)
 #include <linux/stat.h>
@@ -251,7 +251,24 @@
 	hwif->drives[0].autodma = hwif->autodma;
 	hwif->drives[1].autodma = hwif->autodma;
 }
-		
+
+#define DECLARE_CS_DEV(name_str)				\
+	{							\
+		.name		= name_str,			\
+		.init_chipset	= init_chipset_cs5520,		\
+		.init_setup_dma = cs5520_init_setup_dma,	\
+		.init_hwif	= init_hwif_cs5520,		\
+		.channels	= 2,				\
+		.autodma	= AUTODMA,			\
+		.bootable	= ON_BOARD,			\
+		.flags		= IDEPCI_FLAG_ISA_PORTS,	\
+	}
+
+static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
+	/* 0 */ DECLARE_CS_DEV("Cyrix 5510"),
+	/* 1 */ DECLARE_CS_DEV("Cyrix 5520")
+};
+
 /*
  *	The 5510/5520 are a bit weird. They don't quite set up the way
  *	the PCI helper layer expects so we must do much of the set up 
diff -Nru a/drivers/ide/pci/cs5520.h b/drivers/ide/pci/cs5520.h
--- a/drivers/ide/pci/cs5520.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,48 +0,0 @@
-#ifndef CS5520_H
-#define CS5520_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define DISPLAY_CS5520_TIMINGS
-
-static unsigned int init_chipset_cs5520(struct pci_dev *, const char *);
-static void init_hwif_cs5520(ide_hwif_t *);
-static void cs5520_init_setup_dma(struct pci_dev *dev, struct ide_pci_device_s *d, ide_hwif_t *hwif);
-
-static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
-	{
-		.vendor		= PCI_VENDOR_ID_CYRIX,
-		.device		= PCI_DEVICE_ID_CYRIX_5510,
-		.name		= "Cyrix 5510",
-		.init_chipset	= init_chipset_cs5520,
-		.init_setup_dma = cs5520_init_setup_dma,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_cs5520,
-		.isa_ports	= 1,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},
-	{
-		.vendor		= PCI_VENDOR_ID_CYRIX,
-		.device		= PCI_DEVICE_ID_CYRIX_5520,
-		.name		= "Cyrix 5520",
-		.init_chipset	= init_chipset_cs5520,
-		.init_setup_dma = cs5520_init_setup_dma,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_cs5520,
-		.isa_ports	= 1,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	}
-};
-
-
-#endif /* CS5520_H */
-
-
diff -Nru a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
--- a/drivers/ide/pci/cs5530.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/cs5530.c	Tue Jun 15 22:20:39 2004
@@ -31,7 +31,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#include "cs5530.h"
+#define DISPLAY_CS5530_TIMINGS
 
 #if defined(DISPLAY_CS5530_TIMINGS) && defined(CONFIG_PROC_FS)
 #include <linux/stat.h>
@@ -404,12 +404,19 @@
 	hwif->drives[1].autodma = hwif->autodma;
 }
 
+static ide_pci_device_t cs5530_chipset __devinitdata = {
+	.name		= "CS5530",
+	.init_chipset	= init_chipset_cs5530,
+	.init_hwif	= init_hwif_cs5530,
+	.channels	= 2,
+	.autodma	= AUTODMA,
+	.bootable	= ON_BOARD,
+	.flags		= IDEPCI_FLAG_FORCE_MASTER,
+};
+
 static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &cs5530_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &cs5530_chipset);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/cs5530.h b/drivers/ide/pci/cs5530.h
--- a/drivers/ide/pci/cs5530.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,34 +0,0 @@
-#ifndef CS5530_H
-#define CS5530_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define DISPLAY_CS5530_TIMINGS
-
-static unsigned int init_chipset_cs5530(struct pci_dev *, const char *);
-static void init_hwif_cs5530(ide_hwif_t *);
-
-static ide_pci_device_t cs5530_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_CYRIX,
-		.device		= PCI_DEVICE_ID_CYRIX_5530_IDE,
-		.name		= "CS5530",
-		.init_chipset	= init_chipset_cs5530,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_cs5530,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* CS5530_H */
diff -Nru a/drivers/ide/pci/cy82c693.h b/drivers/ide/pci/cy82c693.h
--- a/drivers/ide/pci/cy82c693.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/ide/pci/cy82c693.h	Tue Jun 15 22:20:38 2004
@@ -70,23 +70,13 @@
 
 static ide_pci_device_t cy82c693_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_CONTAQ,
-		.device		= PCI_DEVICE_ID_CONTAQ_82C693,
 		.name		= "CY82C693",
 		.init_chipset	= init_chipset_cy82c693,
 		.init_iops	= init_iops_cy82c693,
 		.init_hwif	= init_hwif_cy82c693,
-		.init_dma	= NULL,
 		.channels	= 1,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
--- a/drivers/ide/pci/generic.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/pci/generic.c	Tue Jun 15 22:20:40 2004
@@ -77,8 +77,6 @@
 
 	if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
 		ide_pci_device_t *unknown = unknown_chipset;
-//		unknown->vendor = dev->vendor;
-//		unknown->device = dev->device;
 		init_setup_unknown(dev, unknown);
 		return 1;
 	}
@@ -99,15 +97,13 @@
 	ide_pci_device_t *d = &generic_chipsets[id->driver_data];
 	u16 command;
 
-	if (dev->device != d->device)
-		BUG();
-	if ((d->vendor == PCI_VENDOR_ID_UMC) &&
-	    (d->device == PCI_DEVICE_ID_UMC_UM8886A) &&
+	if (dev->vendor == PCI_VENDOR_ID_UMC &&
+	    dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
 	    (!(PCI_FUNC(dev->devfn) & 1)))
 		return 1; /* UM8886A/BF pair */
 
-	if ((d->vendor == PCI_VENDOR_ID_OPTI) &&
-	    (d->device == PCI_DEVICE_ID_OPTI_82C558) &&
+	if (dev->vendor == PCI_VENDOR_ID_OPTI &&
+	    dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
 	    (!(PCI_FUNC(dev->devfn) & 1)))
 		return 1;
 
diff -Nru a/drivers/ide/pci/generic.h b/drivers/ide/pci/generic.h
--- a/drivers/ide/pci/generic.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/ide/pci/generic.h	Tue Jun 15 22:20:37 2004
@@ -10,128 +10,77 @@
 
 static ide_pci_device_t generic_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_NS,
-		.device		= PCI_DEVICE_ID_NS_87410,
 		.name		= "NS87410",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
         },{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_PCTECH,
-		.device		= PCI_DEVICE_ID_PCTECH_SAMURAI_IDE,
 		.name		= "SAMURAI",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_HOLTEK,
-		.device		= PCI_DEVICE_ID_HOLTEK_6565,
 		.name		= "HT6565",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 3 */
-		.vendor		= PCI_VENDOR_ID_UMC,
-		.device		= PCI_DEVICE_ID_UMC_UM8673F,
 		.name		= "UM8673F",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= NODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 4 */
-		.vendor		= PCI_VENDOR_ID_UMC,
-		.device		= PCI_DEVICE_ID_UMC_UM8886A,
 		.name		= "UM8886A",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= NODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 5 */
-		.vendor		= PCI_VENDOR_ID_UMC,
-		.device		= PCI_DEVICE_ID_UMC_UM8886BF,
 		.name		= "UM8886BF",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= NODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 6 */
-		.vendor		= PCI_VENDOR_ID_HINT,
-		.device		= PCI_DEVICE_ID_HINT_VXPROII_IDE,
 		.name		= "HINT_IDE",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 7 */
-		.vendor		= PCI_VENDOR_ID_VIA,
-		.device		= PCI_DEVICE_ID_VIA_82C561,
 		.name		= "VIA_IDE",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 8 */
-		.vendor		= PCI_VENDOR_ID_OPTI,
-		.device		= PCI_DEVICE_ID_OPTI_82C558,
 		.name		= "OPTI621V",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 9 */
-		.vendor		= PCI_VENDOR_ID_VIA,
-		.device		= PCI_DEVICE_ID_VIA_8237_SATA,
 		.name		= "VIA8237SATA",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{ /* 10 */
-		.vendor		= PCI_VENDOR_ID_TOSHIBA,
-		.device		= PCI_DEVICE_ID_TOSHIBA_PICCOLO,
 		.name 		= "Piccolo0102",
 		.init_chipset	= init_chipset_generic,
 		.init_hwif	= init_hwif_generic,
@@ -139,8 +88,6 @@
 		.autodma	= NOAUTODMA,
 		.bootable	= ON_BOARD,
 	},{ /* 11 */
-		.vendor		= PCI_VENDOR_ID_TOSHIBA,
-		.device		= PCI_DEVICE_ID_TOSHIBA_PICCOLO_1,
 		.name 		= "Piccolo0103",
 		.init_chipset	= init_chipset_generic,
 		.init_hwif	= init_hwif_generic,
@@ -148,43 +95,25 @@
 		.autodma	= NOAUTODMA,
 		.bootable	= ON_BOARD,
 	},{ /* 12 */
-		.vendor		= PCI_VENDOR_ID_TOSHIBA,
-		.device		= PCI_DEVICE_ID_TOSHIBA_PICCOLO_2,
 		.name 		= "Piccolo0105",
 		.init_chipset	= init_chipset_generic,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= NOAUTODMA,
 		.bootable	= ON_BOARD,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
 #if 0
 static ide_pci_device_t unknown_chipset[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= 0,
-		.device		= 0,
 		.name		= "PCI_IDE",
 		.init_chipset	= init_chipset_generic,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_generic,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
-
 };
 #endif
 
diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
--- a/drivers/ide/pci/hpt34x.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/hpt34x.c	Tue Jun 15 22:20:39 2004
@@ -235,7 +235,7 @@
  */
 #define	HPT34X_PCI_INIT_REG		0x80
 
-static unsigned int __init init_chipset_hpt34x (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev, const char *name)
 {
 	int i = 0;
 	unsigned long hpt34xIoBase = pci_resource_start(dev, 4);
@@ -289,7 +289,7 @@
 	return dev->irq;
 }
 
-static void __init init_hwif_hpt34x (ide_hwif_t *hwif)
+static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
 {
 	u16 pcicmd = 0;
 
diff -Nru a/drivers/ide/pci/hpt34x.h b/drivers/ide/pci/hpt34x.h
--- a/drivers/ide/pci/hpt34x.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/ide/pci/hpt34x.h	Tue Jun 15 22:20:36 2004
@@ -18,22 +18,13 @@
 
 static ide_pci_device_t hpt34x_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_TTI,
-		.device		= PCI_DEVICE_ID_TTI_HPT343,
 		.name		= "HPT34X",
 		.init_chipset	= init_chipset_hpt34x,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_hpt34x,
 		.channels	= 2,
 		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= NEVER_BOARD,
 		.extra		= 16
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
--- a/drivers/ide/pci/hpt366.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/ide/pci/hpt366.c	Tue Jun 15 22:20:41 2004
@@ -795,7 +795,7 @@
 	return 0;
 }
 
-static int __init init_hpt37x(struct pci_dev *dev)
+static int __devinit init_hpt37x(struct pci_dev *dev)
 {
 	int adjust, i;
 	u16 freq;
@@ -923,7 +923,7 @@
 	return 0;
 }
 
-static int __init init_hpt366 (struct pci_dev *dev)
+static int __devinit init_hpt366(struct pci_dev *dev)
 {
 	u32 reg1	= 0;
 	u8 drive_fast	= 0;
@@ -958,7 +958,7 @@
 	return 0;
 }
 
-static unsigned int __init init_chipset_hpt366 (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const char *name)
 {
 	int ret = 0;
 	u8 test = 0;
@@ -1004,7 +1004,7 @@
 	return dev->irq;
 }
 
-static void __init init_hwif_hpt366 (ide_hwif_t *hwif)
+static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
 {
 	struct pci_dev *dev		= hwif->pci_dev;
 	u8 ata66 = 0, regmask		= (hwif->channel) ? 0x01 : 0x02;
@@ -1116,7 +1116,7 @@
 	hwif->drives[1].autodma = hwif->autodma;
 }
 
-static void __init init_dma_hpt366 (ide_hwif_t *hwif, unsigned long dmabase)
+static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
 {
 	u8 masterdma	= 0, slavedma = 0;
 	u8 dma_new	= 0, dma_old = 0;
@@ -1151,7 +1151,7 @@
 	ide_setup_dma(hwif, dmabase, 8);
 }
 
-static void __init init_setup_hpt374 (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	struct pci_dev *findev = NULL;
 
@@ -1176,12 +1176,12 @@
 	ide_setup_pci_device(dev, d);
 }
 
-static void __init init_setup_hpt37x (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_hpt37x(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	ide_setup_pci_device(dev, d);
 }
 
-static void __init init_setup_hpt366 (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	struct pci_dev *findev = NULL;
 	u8 pin1 = 0, pin2 = 0;
@@ -1241,8 +1241,6 @@
 {
 	ide_pci_device_t *d = &hpt366_chipsets[id->driver_data];
 
-	if (dev->device != d->device)
-		BUG();
 	d->init_setup(dev, d);
 	return 0;
 }
diff -Nru a/drivers/ide/pci/hpt366.h b/drivers/ide/pci/hpt366.h
--- a/drivers/ide/pci/hpt366.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/ide/pci/hpt366.h	Tue Jun 15 22:20:43 2004
@@ -425,80 +425,51 @@
 
 static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_TTI,
-		.device		= PCI_DEVICE_ID_TTI_HPT366,
 		.name		= "HPT366",
 		.init_setup	= init_setup_hpt366,
 		.init_chipset	= init_chipset_hpt366,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_hpt366,
 		.init_dma	= init_dma_hpt366,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
 		.extra		= 240
 	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_TTI,
-		.device		= PCI_DEVICE_ID_TTI_HPT372,
 		.name		= "HPT372A",
 		.init_setup	= init_setup_hpt37x,
 		.init_chipset	= init_chipset_hpt366,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_hpt366,
 		.init_dma	= init_dma_hpt366,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0
 	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_TTI,
-		.device		= PCI_DEVICE_ID_TTI_HPT302,
 		.name		= "HPT302",
 		.init_setup	= init_setup_hpt37x,
 		.init_chipset	= init_chipset_hpt366,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_hpt366,
 		.init_dma	= init_dma_hpt366,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0
 	},{	/* 3 */
-		.vendor		= PCI_VENDOR_ID_TTI,
-		.device		= PCI_DEVICE_ID_TTI_HPT371,
 		.name		= "HPT371",
 		.init_setup	= init_setup_hpt37x,
 		.init_chipset	= init_chipset_hpt366,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_hpt366,
 		.init_dma	= init_dma_hpt366,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0
 	},{	/* 4 */
-		.vendor		= PCI_VENDOR_ID_TTI,
-		.device		= PCI_DEVICE_ID_TTI_HPT374,
 		.name		= "HPT374",
 		.init_setup	= init_setup_hpt374,
 		.init_chipset	= init_chipset_hpt366,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_hpt366,
 		.init_dma	= init_dma_hpt366,
 		.channels	= 2,	/* 4 */
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c
--- a/drivers/ide/pci/it8172.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/ide/pci/it8172.c	Tue Jun 15 22:20:43 2004
@@ -288,11 +288,10 @@
 
 static int __devinit it8172_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &it8172_chipsets[id->driver_data];
         if ((!(PCI_FUNC(dev->devfn) & 1) ||
             (!((dev->class >> 8) == PCI_CLASS_STORAGE_IDE))))
                 return 1; /* IT8172 is more than only a IDE controller */
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &it8172_chipsets[id->driver_data]);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/it8172.h b/drivers/ide/pci/it8172.h
--- a/drivers/ide/pci/it8172.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/it8172.h	Tue Jun 15 22:20:39 2004
@@ -20,23 +20,14 @@
 
 static ide_pci_device_t it8172_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_ITE,
-		.device		= PCI_DEVICE_ID_ITE_IT8172G,
 		.name		= "IT8172G",
 		.init_setup	= init_setup_it8172,
 		.init_chipset	= init_chipset_it8172,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_it8172,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x00,0x00,0x00}, {0x40,0x00,0x01}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
--- a/drivers/ide/pci/ns87415.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/pci/ns87415.c	Tue Jun 15 22:20:40 2004
@@ -25,8 +25,6 @@
 
 #include <asm/io.h>
 
-#include "ns87415.h"
-
 static unsigned int ns87415_count = 0, ns87415_control[MAX_HWIFS] = { 0 };
 
 /*
@@ -217,12 +215,17 @@
 	hwif->drives[1].autodma = hwif->autodma;
 }
 
+static ide_pci_device_t ns87415_chipset __devinitdata = {
+	.name		= "NS87415",
+	.init_hwif	= init_hwif_ns87415,
+	.channels	= 2,
+	.autodma	= AUTODMA,
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &ns87415_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &ns87415_chipset);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/ns87415.h b/drivers/ide/pci/ns87415.h
--- a/drivers/ide/pci/ns87415.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,31 +0,0 @@
-#ifndef NS87415_H
-#define NS87415_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-static void init_hwif_ns87415(ide_hwif_t *);
-
-static ide_pci_device_t ns87415_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_NS,
-		.device		= PCI_DEVICE_ID_NS_87415,
-		.name		= "NS87415",
-		.init_chipset	= NULL,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_ns87415,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* NS87415_H */
diff -Nru a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
--- a/drivers/ide/pci/opti621.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/opti621.c	Tue Jun 15 22:20:39 2004
@@ -355,10 +355,7 @@
 
 static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &opti621_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/opti621.h b/drivers/ide/pci/opti621.h
--- a/drivers/ide/pci/opti621.h	Tue Jun 15 22:20:58 2004
+++ b/drivers/ide/pci/opti621.h	Tue Jun 15 22:20:58 2004
@@ -10,36 +10,21 @@
 
 static ide_pci_device_t opti621_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_OPTI,
-		.device		= PCI_DEVICE_ID_OPTI_82C621,
 		.name		= "OPTI621",
 		.init_setup	= init_setup_opti621,
-		.init_chipset	= NULL,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_opti621,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_OPTI,
-		.device		= PCI_DEVICE_ID_OPTI_82C825,
 		.name		= "OPTI621X",
 		.init_setup	= init_setup_opti621,
-		.init_chipset	= NULL,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_opti621,
 		.channels	= 2,
 		.autodma	= AUTODMA,
 		.enablebits	= {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
--- a/drivers/ide/pci/pdc202xx_new.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/ide/pci/pdc202xx_new.c	Tue Jun 15 22:20:43 2004
@@ -404,7 +404,7 @@
 }
 #endif /* CONFIG_PPC_PMAC */
 
-static unsigned int __init init_chipset_pdcnew (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const char *name)
 {
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_dword(dev, PCI_ROM_ADDRESS,
@@ -429,7 +429,7 @@
 	return dev->irq;
 }
 
-static void __init init_hwif_pdc202new (ide_hwif_t *hwif)
+static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
 {
 	hwif->autodma = 0;
 
@@ -457,12 +457,12 @@
 #endif /* PDC202_DEBUG_CABLE */
 }
 
-static void __init init_setup_pdcnew (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	ide_setup_pci_device(dev, d);
 }
 
-static void __init init_setup_pdc20270 (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	struct pci_dev *findev = NULL;
 
@@ -488,7 +488,7 @@
 	ide_setup_pci_device(dev, d);
 }
 
-static void __init init_setup_pdc20276 (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	if ((dev->bus->self) &&
 	    (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) &&
@@ -514,8 +514,6 @@
 {
 	ide_pci_device_t *d = &pdcnew_chipsets[id->driver_data];
 
-	if (dev->device != d->device)
-		BUG();
 	d->init_setup(dev, d);
 	return 0;
 }
diff -Nru a/drivers/ide/pci/pdc202xx_new.h b/drivers/ide/pci/pdc202xx_new.h
--- a/drivers/ide/pci/pdc202xx_new.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/ide/pci/pdc202xx_new.h	Tue Jun 15 22:20:36 2004
@@ -53,109 +53,67 @@
 
 static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20268,
 		.name		= "PDC20268",
 		.init_setup	= init_setup_pdcnew,
 		.init_chipset	= init_chipset_pdcnew,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202new,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20269,
 		.name		= "PDC20269",
 		.init_setup	= init_setup_pdcnew,
 		.init_chipset	= init_chipset_pdcnew,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202new,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20270,
 		.name		= "PDC20270",
 		.init_setup	= init_setup_pdc20270,
 		.init_chipset	= init_chipset_pdcnew,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202new,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-#ifdef CONFIG_PDC202XX_FORCE
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-#else /* !CONFIG_PDC202XX_FORCE */
+#ifndef CONFIG_PDC202XX_FORCE
 		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
 #endif
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 3 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20271,
 		.name		= "PDC20271",
 		.init_setup	= init_setup_pdcnew,
 		.init_chipset	= init_chipset_pdcnew,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202new,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 4 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20275,
 		.name		= "PDC20275",
 		.init_setup	= init_setup_pdcnew,
 		.init_chipset	= init_chipset_pdcnew,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202new,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 5 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20276,
 		.name		= "PDC20276",
 		.init_setup	= init_setup_pdc20276,
 		.init_chipset	= init_chipset_pdcnew,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202new,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-#ifdef CONFIG_PDC202XX_FORCE
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-#else /* !CONFIG_PDC202XX_FORCE */
+#ifndef CONFIG_PDC202XX_FORCE
 		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
 #endif
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
 	},{	/* 6 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20277,
 		.name		= "PDC20277",
 		.init_setup	= init_setup_pdcnew,
 		.init_chipset	= init_chipset_pdcnew,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202new,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= OFF_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/ide/pci/pdc202xx_old.c	Tue Jun 15 22:21:04 2004
@@ -670,7 +670,7 @@
 	return 0;
 }
 
-static unsigned int __init init_chipset_pdc202xx (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, const char *name)
 {
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_dword(dev, PCI_ROM_ADDRESS,
@@ -715,7 +715,7 @@
 	return dev->irq;
 }
 
-static void __init init_hwif_pdc202xx (ide_hwif_t *hwif)
+static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
 {
 	hwif->autodma = 0;
 	hwif->tuneproc  = &config_chipset_for_pio;
@@ -755,7 +755,7 @@
 #endif /* PDC202_DEBUG_CABLE */	
 }
 
-static void __init init_dma_pdc202xx (ide_hwif_t *hwif, unsigned long dmabase)
+static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase)
 {
 	u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0;
 
@@ -807,7 +807,7 @@
 	ide_setup_dma(hwif, dmabase, 8);
 }
 
-static void __init init_setup_pdc202ata4 (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
 		u8 irq = 0, irq2 = 0;
@@ -837,7 +837,7 @@
 	ide_setup_pci_device(dev, d);
 }
 
-static void __init init_setup_pdc20265 (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_pdc20265(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	if ((dev->bus->self) &&
 	    (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) &&
@@ -866,7 +866,7 @@
 	ide_setup_pci_device(dev, d);
 }
 
-static void __init init_setup_pdc202xx (struct pci_dev *dev, ide_pci_device_t *d)
+static void __devinit init_setup_pdc202xx(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	ide_setup_pci_device(dev, d);
 }
@@ -884,8 +884,6 @@
 {
 	ide_pci_device_t *d = &pdc202xx_chipsets[id->driver_data];
 
-	if (dev->device != d->device)
-		BUG();
 	d->init_setup(dev, d);
 	return 0;
 }
diff -Nru a/drivers/ide/pci/pdc202xx_old.h b/drivers/ide/pci/pdc202xx_old.h
--- a/drivers/ide/pci/pdc202xx_old.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/ide/pci/pdc202xx_old.h	Tue Jun 15 22:20:36 2004
@@ -180,62 +180,46 @@
 
 static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20246,
 		.name		= "PDC20246",
 		.init_setup	= init_setup_pdc202ata4,
 		.init_chipset	= init_chipset_pdc202xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202xx,
 		.init_dma	= init_dma_pdc202xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-#ifdef CONFIG_PDC202XX_FORCE
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-#else /* !CONFIG_PDC202XX_FORCE */
+#ifndef CONFIG_PDC202XX_FORCE
 		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
 #endif
 		.bootable	= OFF_BOARD,
 		.extra		= 16,
 	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20262,
 		.name		= "PDC20262",
 		.init_setup	= init_setup_pdc202ata4,
 		.init_chipset	= init_chipset_pdc202xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202xx,
 		.init_dma	= init_dma_pdc202xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-#ifdef CONFIG_PDC202XX_FORCE
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-#else /* !CONFIG_PDC202XX_FORCE */
+#ifndef CONFIG_PDC202XX_FORCE
 		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
 #endif
 		.bootable	= OFF_BOARD,
 		.extra		= 48,
+		.flags		= IDEPCI_FLAG_FORCE_PDC,
 	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20263,
 		.name		= "PDC20263",
 		.init_setup	= init_setup_pdc202ata4,
 		.init_chipset	= init_chipset_pdc202xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202xx,
 		.init_dma	= init_dma_pdc202xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-#ifdef CONFIG_PDC202XX_FORCE
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-#else /* !CONFIG_PDC202XX_FORCE */
+#ifndef CONFIG_PDC202XX_FORCE
 		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
 #endif
 		.bootable	= OFF_BOARD,
 		.extra		= 48,
 	},{	/* 3 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20265,
 		.name		= "PDC20265",
 		.init_setup	= init_setup_pdc20265,
 		.init_chipset	= init_chipset_pdc202xx,
@@ -243,36 +227,25 @@
 		.init_dma	= init_dma_pdc202xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-#ifdef CONFIG_PDC202XX_FORCE
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-#else /* !CONFIG_PDC202XX_FORCE */
+#ifndef CONFIG_PDC202XX_FORCE
 		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
 #endif
 		.bootable	= OFF_BOARD,
 		.extra		= 48,
+		.flags		= IDEPCI_FLAG_FORCE_PDC,
 	},{	/* 4 */
-		.vendor		= PCI_VENDOR_ID_PROMISE,
-		.device		= PCI_DEVICE_ID_PROMISE_20267,
 		.name		= "PDC20267",
 		.init_setup	= init_setup_pdc202xx,
 		.init_chipset	= init_chipset_pdc202xx,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_pdc202xx,
 		.init_dma	= init_dma_pdc202xx,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-#ifdef CONFIG_PDC202XX_FORCE
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-#else /* !CONFIG_PDC202XX_FORCE */
+#ifndef CONFIG_PDC202XX_FORCE
 		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
 #endif
 		.bootable	= OFF_BOARD,
 		.extra		= 48,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
--- a/drivers/ide/pci/piix.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/ide/pci/piix.c	Tue Jun 15 22:20:36 2004
@@ -49,9 +49,9 @@
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x40, &reg40);
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x42, &reg42);
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x44, &reg44);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x48, &reg48);
+ * pci_read_config_byte(HWIF(drive)->pci_dev, 0x48, &reg48);
  * pci_read_config_word(HWIF(drive)->pci_dev, 0x4a, &reg4a);
- * pci_read_config_word(HWIF(drive)->pci_dev, 0x54, &reg54);
+ * pci_read_config_byte(HWIF(drive)->pci_dev, 0x54, &reg54);
  *
  * Documentation
  *	Publically available from Intel web site. Errata documentation
@@ -153,7 +153,7 @@
 			case PCI_DEVICE_ID_INTEL_82801EB_11:
 			case PCI_DEVICE_ID_INTEL_82801E_11:
 			case PCI_DEVICE_ID_INTEL_ESB_2:
-			case PCI_DEVICE_ID_INTEL_ICH6_2:
+			case PCI_DEVICE_ID_INTEL_ICH6_19:
 				p += sprintf(p, "PIIX4 Ultra 100 ");
 				break;
 			case PCI_DEVICE_ID_INTEL_82372FB_1:
@@ -292,7 +292,7 @@
 		case PCI_DEVICE_ID_INTEL_82801DB_11:
 		case PCI_DEVICE_ID_INTEL_82801EB_11:
 		case PCI_DEVICE_ID_INTEL_ESB_2:
-		case PCI_DEVICE_ID_INTEL_ICH6_2:
+		case PCI_DEVICE_ID_INTEL_ICH6_19:
 			mode = 3;
 			break;
 		/* UDMA 66 capable */
@@ -432,15 +432,14 @@
 	int w_flag		= 0x10 << drive->dn;
 	int u_speed		= 0;
 	int			sitre;
-	u16			reg4042, reg44, reg48, reg4a, reg54;
-	u8			reg55;
+	u16			reg4042, reg4a;
+	u8			reg48, reg54, reg55;
 
 	pci_read_config_word(dev, maslave, &reg4042);
 	sitre = (reg4042 & 0x4000) ? 1 : 0;
-	pci_read_config_word(dev, 0x44, &reg44);
-	pci_read_config_word(dev, 0x48, &reg48);
+	pci_read_config_byte(dev, 0x48, &reg48);
 	pci_read_config_word(dev, 0x4a, &reg4a);
-	pci_read_config_word(dev, 0x54, &reg54);
+	pci_read_config_byte(dev, 0x54, &reg54);
 	pci_read_config_byte(dev, 0x55, &reg55);
 
 	switch(speed) {
@@ -462,30 +461,26 @@
 
 	if (speed >= XFER_UDMA_0) {
 		if (!(reg48 & u_flag))
-			pci_write_config_word(dev, 0x48, reg48|u_flag);
+			pci_write_config_byte(dev, 0x48, reg48 | u_flag);
 		if (speed == XFER_UDMA_5) {
 			pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
 		} else {
 			pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
 		}
-		if (!(reg4a & u_speed)) {
-			pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
-			pci_write_config_word(dev, 0x4a, reg4a|u_speed);
-		}
+		if ((reg4a & a_speed) != u_speed)
+			pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
 		if (speed > XFER_UDMA_2) {
-			if (!(reg54 & v_flag)) {
-				pci_write_config_word(dev, 0x54, reg54|v_flag);
-			}
-		} else {
-			pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
-		}
+			if (!(reg54 & v_flag))
+				pci_write_config_byte(dev, 0x54, reg54 | v_flag);
+		} else
+			pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
 	} else {
 		if (reg48 & u_flag)
-			pci_write_config_word(dev, 0x48, reg48 & ~u_flag);
+			pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
 		if (reg4a & a_speed)
 			pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
 		if (reg54 & v_flag)
-			pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
+			pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
 		if (reg55 & w_flag)
 			pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
 	}
@@ -627,7 +622,7 @@
 		case PCI_DEVICE_ID_INTEL_82801EB_11:
 		case PCI_DEVICE_ID_INTEL_82801E_11:
 		case PCI_DEVICE_ID_INTEL_ESB_2:
-		case PCI_DEVICE_ID_INTEL_ICH6_2:
+		case PCI_DEVICE_ID_INTEL_ICH6_19:
 		{
 			unsigned int extra = 0;
 			pci_read_config_dword(dev, 0x54, &extra);
@@ -655,8 +650,8 @@
  *	Set up the ide_hwif_t for the PIIX interface according to the
  *	capabilities of the hardware.
  */
- 
-static void __init init_hwif_piix (ide_hwif_t *hwif)
+
+static void __devinit init_hwif_piix(ide_hwif_t *hwif)
 {
 	u8 reg54h = 0, reg55h = 0, ata66 = 0;
 	u8 mask = hwif->channel ? 0xc0 : 0x30;
@@ -725,8 +720,8 @@
  *	Enable the xp fixup for the PIIX controller and then perform
  *	a standard ide PCI setup
  */
- 
-static void __init init_setup_piix (struct pci_dev *dev, ide_pci_device_t *d)
+
+static void __devinit init_setup_piix(struct pci_dev *dev, ide_pci_device_t *d)
 {
 	ide_setup_pci_device(dev, d);
 }
@@ -744,8 +739,6 @@
 {
 	ide_pci_device_t *d = &piix_pci_info[id->driver_data];
 
-	if (dev->device != d->device)
-		BUG();
 	d->init_setup(dev, d);
 	return 0;
 }
@@ -756,8 +749,8 @@
  *	Check for the present of 450NX errata #19 and errata #25. If
  *	they are found, disable use of DMA IDE
  */
- 
-static void __init piix_check_450nx(void)
+
+static void __devinit piix_check_450nx(void)
 {
 	struct pci_dev *pdev = NULL;
 	u16 cfg;
@@ -804,7 +797,7 @@
  	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18},
 #endif /* !CONFIG_SCSI_SATA */
 	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19},
-	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20},
+	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_19, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20},
 	{ 0, },
 };
 MODULE_DEVICE_TABLE(pci, piix_pci_tbl);
diff -Nru a/drivers/ide/pci/piix.h b/drivers/ide/pci/piix.h
--- a/drivers/ide/pci/piix.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/ide/pci/piix.h	Tue Jun 15 22:20:37 2004
@@ -13,20 +13,16 @@
 static unsigned int __devinit init_chipset_piix(struct pci_dev *, const char *);
 static void init_hwif_piix(ide_hwif_t *);
 
-#define DECLARE_PIIX_DEV(pci_id, name_str) \
+#define DECLARE_PIIX_DEV(name_str) \
 	{						\
-		.vendor		= PCI_VENDOR_ID_INTEL,	\
-		.device		= pci_id,		\
 		.name		= name_str,		\
 		.init_setup	= init_setup_piix,	\
 		.init_chipset	= init_chipset_piix,	\
-		.init_iops	= NULL,			\
 		.init_hwif	= init_hwif_piix,	\
 		.channels	= 2,			\
 		.autodma	= AUTODMA,		\
 		.enablebits	= {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
 		.bootable	= ON_BOARD,		\
-		.extra		= 0,			\
 	}
 
 /*
@@ -35,49 +31,37 @@
  */
  
 static ide_pci_device_t piix_pci_info[] __devinitdata = {
-	/* 0  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82371FB_0,  "PIIXa"),
-	/* 1  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82371FB_1,  "PIIXb"),
+	/*  0 */ DECLARE_PIIX_DEV("PIIXa"),
+	/*  1 */ DECLARE_PIIX_DEV("PIIXb"),
 
 	{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_INTEL,
-		.device		= PCI_DEVICE_ID_INTEL_82371MX,
 		.name		= "MPIIX",
 		.init_setup	= init_setup_piix,
-		.init_chipset	= NULL,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_piix,
 		.channels	= 2,
 		.autodma	= NODMA,
 		.enablebits	= {{0x6D,0x80,0x80}, {0x6F,0x80,0x80}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},
 
-	/* 3  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82371SB_1,  "PIIX3"),
-	/* 4  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82371AB,    "PIIX4"),
-	/* 5  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801AB_1,  "ICH0"),
-	/* 6  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82443MX_1,  "PIIX4"),
-	/* 7  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801AA_1,  "ICH"),
-	/* 8  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82372FB_1,  "PIIX4"),
-	/* 9  */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82451NX,    "PIIX4"),
-	/* 10 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801BA_9,  "ICH2"),
-	/* 11 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801BA_8,  "ICH2M"),
-	/* 12 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801CA_10, "ICH3M"),
-	/* 13 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801CA_11, "ICH3"),
-	/* 14 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801DB_11, "ICH4"),
-	/* 15 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801EB_11, "ICH5"),
-	/* 16 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801E_11,  "C-ICH"),
-	/* 17 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801DB_10, "ICH4"),
-	/* 18 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_82801EB_1,  "ICH5-SATA"),
-	/* 19 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ESB_2,      "ICH5"),
-	/* 20 */ DECLARE_PIIX_DEV(PCI_DEVICE_ID_INTEL_ICH6_2,     "ICH6"),
-	{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.init_setup	= NULL,
-		.bootable	= EOL,
-	}
+	/*  3 */ DECLARE_PIIX_DEV("PIIX3"),
+	/*  4 */ DECLARE_PIIX_DEV("PIIX4"),
+	/*  5 */ DECLARE_PIIX_DEV("ICH0"),
+	/*  6 */ DECLARE_PIIX_DEV("PIIX4"),
+	/*  7 */ DECLARE_PIIX_DEV("ICH"),
+	/*  8 */ DECLARE_PIIX_DEV("PIIX4"),
+	/*  9 */ DECLARE_PIIX_DEV("PIIX4"),
+	/* 10 */ DECLARE_PIIX_DEV("ICH2"),
+	/* 11 */ DECLARE_PIIX_DEV("ICH2M"),
+	/* 12 */ DECLARE_PIIX_DEV("ICH3M"),
+	/* 13 */ DECLARE_PIIX_DEV("ICH3"),
+	/* 14 */ DECLARE_PIIX_DEV("ICH4"),
+	/* 15 */ DECLARE_PIIX_DEV("ICH5"),
+	/* 16 */ DECLARE_PIIX_DEV("C-ICH"),
+	/* 17 */ DECLARE_PIIX_DEV("ICH4"),
+	/* 18 */ DECLARE_PIIX_DEV("ICH5-SATA"),
+	/* 19 */ DECLARE_PIIX_DEV("ICH5"),
+	/* 20 */ DECLARE_PIIX_DEV("ICH6")
 };
 
 #endif /* PIIX_H */
diff -Nru a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c
--- a/drivers/ide/pci/rz1000.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/rz1000.c	Tue Jun 15 22:20:39 2004
@@ -33,8 +33,6 @@
 
 #include <asm/io.h>
 
-#include "rz1000.h"
-
 static void __init init_hwif_rz1000 (ide_hwif_t *hwif)
 {
 	u16 reg;
@@ -54,18 +52,23 @@
 	}
 }
 
+static ide_pci_device_t rz1000_chipset __devinitdata = {
+	.name		= "RZ100x",
+	.init_hwif	= init_hwif_rz1000,
+	.channels	= 2,
+	.autodma	= NODMA,
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &rz1000_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &rz1000_chipset);
 	return 0;
 }
 
 static struct pci_device_id rz1000_pci_tbl[] = {
 	{ PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
+	{ PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{ 0, },
 };
 MODULE_DEVICE_TABLE(pci, rz1000_pci_tbl);
diff -Nru a/drivers/ide/pci/rz1000.h b/drivers/ide/pci/rz1000.h
--- a/drivers/ide/pci/rz1000.h	Tue Jun 15 22:20:44 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,45 +0,0 @@
-#ifndef RZ100X_H
-#define RZ100X_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-static void init_hwif_rz1000(ide_hwif_t *);
-
-static ide_pci_device_t rz1000_chipsets[] __devinitdata = {
-{
-		.vendor		= PCI_VENDOR_ID_PCTECH,
-		.device		= PCI_DEVICE_ID_PCTECH_RZ1000,
-		.name		= "RZ1000",
-		.init_chipset	= NULL,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_rz1000,
-		.init_dma	= NULL,
-		.channels	= 2,
-		.autodma	= NODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= PCI_VENDOR_ID_PCTECH,
-		.device		= PCI_DEVICE_ID_PCTECH_RZ1001,
-		.name		= "RZ1001",
-		.init_chipset	= NULL,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_rz1000,
-		.init_dma	= NULL,
-		.channels	= 2,
-		.autodma	= NODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* RZ100X_H */
diff -Nru a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
--- a/drivers/ide/pci/sc1200.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/ide/pci/sc1200.c	Tue Jun 15 22:20:41 2004
@@ -29,8 +29,6 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#include "sc1200.h"
-
 #define SC1200_REV_A	0x00
 #define SC1200_REV_B1	0x01
 #define SC1200_REV_B3	0x02
@@ -545,12 +543,18 @@
         hwif->drives[1].autodma = hwif->autodma;
 }
 
+static ide_pci_device_t sc1200_chipset __devinitdata = {
+	.name		= "SC1200",
+	.init_chipset	= init_chipset_sc1200,
+	.init_hwif	= init_hwif_sc1200,
+	.channels	= 2,
+	.autodma	= AUTODMA,
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &sc1200_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &sc1200_chipset);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/sc1200.h b/drivers/ide/pci/sc1200.h
--- a/drivers/ide/pci/sc1200.h	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,34 +0,0 @@
-#ifndef SC1200_H
-#define SC1200_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define DISPLAY_SC1200_TIMINGS
-
-static unsigned int init_chipset_sc1200(struct pci_dev *, const char *);
-static void init_hwif_sc1200(ide_hwif_t *);
-
-static ide_pci_device_t sc1200_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_NS,
-		.device		= PCI_DEVICE_ID_NS_SCx200_IDE,
-		.name		= "SC1200",
-		.init_chipset	= init_chipset_sc1200,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_sc1200,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* SC1200_H */
diff -Nru a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
--- a/drivers/ide/pci/serverworks.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/ide/pci/serverworks.c	Tue Jun 15 22:20:36 2004
@@ -777,8 +777,8 @@
 		d->autodma = AUTODMA;
 #endif
 
-	d->channels = (((d->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
-			(d->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) &&
+	d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ||
+			dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) &&
 		       (!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2;
 
 	ide_setup_pci_device(dev, d);
@@ -798,8 +798,6 @@
 {
 	ide_pci_device_t *d = &serverworks_chipsets[id->driver_data];
 
-	if (dev->device != d->device)
-		BUG();
 	d->init_setup(dev, d);
 	return 0;
 }
diff -Nru a/drivers/ide/pci/serverworks.h b/drivers/ide/pci/serverworks.h
--- a/drivers/ide/pci/serverworks.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/serverworks.h	Tue Jun 15 22:20:39 2004
@@ -31,66 +31,40 @@
 
 static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
 	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_SERVERWORKS,
-		.device		= PCI_DEVICE_ID_SERVERWORKS_OSB4IDE,
 		.name		= "SvrWks OSB4",
 		.init_setup	= init_setup_svwks,
 		.init_chipset	= init_chipset_svwks,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_svwks,
-		.init_dma	= NULL,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_SERVERWORKS,
-		.device		= PCI_DEVICE_ID_SERVERWORKS_CSB5IDE,
 		.name		= "SvrWks CSB5",
 		.init_setup	= init_setup_svwks,
 		.init_chipset	= init_chipset_svwks,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_svwks,
 		.init_dma	= init_dma_svwks,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_SERVERWORKS,
-		.device		= PCI_DEVICE_ID_SERVERWORKS_CSB6IDE,
 		.name		= "SvrWks CSB6",
 		.init_setup	= init_setup_csb6,
 		.init_chipset	= init_chipset_svwks,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_svwks,
 		.init_dma	= init_dma_svwks,
 		.channels	= 2,
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
 	},{	/* 3 */
-		.vendor		= PCI_VENDOR_ID_SERVERWORKS,
-		.device		= PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2,
 		.name		= "SvrWks CSB6",
 		.init_setup	= init_setup_csb6,
 		.init_chipset	= init_chipset_svwks,
-		.init_iops	= NULL,
 		.init_hwif	= init_hwif_svwks,
 		.init_dma	= init_dma_svwks,
 		.channels	= 1,	/* 2 */
 		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
 		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
 	}
 };
 
diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
--- a/drivers/ide/pci/sgiioc4.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/pci/sgiioc4.c	Tue Jun 15 22:20:40 2004
@@ -757,8 +757,6 @@
 static ide_pci_device_t sgiioc4_chipsets[] __devinitdata = {
 	{
 	 /* Channel 0 */
-	 .vendor = PCI_VENDOR_ID_SGI,
-	 .device = PCI_DEVICE_ID_SGI_IOC4,
 	 .name = "SGIIOC4",
 	 .init_hwif = ide_init_sgiioc4,
 	 .init_dma = ide_dma_sgiioc4,
@@ -772,16 +770,7 @@
 static int __devinit
 sgiioc4_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &sgiioc4_chipsets[id->driver_data];
-	if (dev->device != d->device) {
-		printk(KERN_ERR "Error in %s(dev 0x%p | id 0x%p )\n",
-		       __FUNCTION__, (void *) dev, (void *) id);
-		BUG();
-	}
-
-	if (pci_init_sgiioc4(dev, d))
-		return 0;
-
+	pci_init_sgiioc4(dev, &sgiioc4_chipsets[id->driver_data]);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
--- a/drivers/ide/pci/siimage.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/siimage.c	Tue Jun 15 22:20:39 2004
@@ -21,7 +21,6 @@
  *	if neccessary
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -32,16 +31,8 @@
 
 #include <asm/io.h>
 
-#include "siimage.h"
-
-#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
-#include <linux/proc_fs.h>
-
-static u8 siimage_proc = 0;
-#define SIIMAGE_MAX_DEVS		16
-static struct pci_dev *siimage_devs[SIIMAGE_MAX_DEVS];
-static int n_siimage_devs;
-#endif /* defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) */
+#undef SIIMAGE_VIRTUAL_DMAPIO
+#undef SIIMAGE_LARGE_DMA
 
 /**
  *	pdev_is_sata		-	check if device is SATA
@@ -121,67 +112,6 @@
 	return base;
 }
 
-#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
-/**
- *	print_siimage_get_info	-	print minimal proc information
- *	@buf: buffer to write into (kernel space)
- *	@dev: PCI device we are describing
- *	@index: Controller number
- *
- *	Print the basic information for the state of the CMD680/SI3112
- *	channel. We don't actually dump a lot of information out for
- *	this controller although we could expand it if we needed.
- */
- 
-static char *print_siimage_get_info (char *buf, struct pci_dev *dev, int index)
-{
-	char *p		= buf;
-	u8 mmio		= (pci_get_drvdata(dev) != NULL) ? 1 : 0;
-	unsigned long bmdma = pci_resource_start(dev, 4);
-	
-	if(mmio)
-		bmdma = pci_resource_start(dev, 5);
-
-	p += sprintf(p, "\nController: %d\n", index);
-	p += sprintf(p, "SiI%x Chipset.\n", dev->device);
-	if (mmio)
-		p += sprintf(p, "MMIO Base 0x%lx\n", bmdma);
-	p += sprintf(p, "%s-DMA Base 0x%lx\n", (mmio)?"MMIO":"BM", bmdma);
-	p += sprintf(p, "%s-DMA Base 0x%lx\n", (mmio)?"MMIO":"BM", bmdma+8);
-	return (char *)p;
-}
-
-/**
- *	siimage_get_info	-	proc callback
- *	@buffer: kernel buffer to complete
- *	@addr: written with base of data to return
- *	offset: seek offset
- *	count: bytes to fill in 
- *
- *	Called when the user reads data from the virtual file for this
- *	controller from /proc
- */
- 
-static int siimage_get_info (char *buffer, char **addr, off_t offset, int count)
-{
-	char *p = buffer;
-	int len;
-	u16 i;
-
-	p += sprintf(p, "\n");
-	for (i = 0; i < n_siimage_devs; i++) {
-		struct pci_dev *dev	= siimage_devs[i];
-		p = print_siimage_get_info(p, dev, i);
-	}
-	/* p - buffer must be less than 4k! */
-	len = (p - buffer) - offset;
-	*addr = buffer + offset;
-	
-	return len > count ? count : len;
-}
-
-#endif	/* defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS) */
-
 /**
  *	siimage_ratemask	-	Compute available modes
  *	@drive: IDE drive
@@ -779,15 +709,6 @@
 			case 0x00: printk("== 100\n"); break;
 		}
 	}
-
-#if defined(DISPLAY_SIIMAGE_TIMINGS) && defined(CONFIG_PROC_FS)
-	siimage_devs[n_siimage_devs++] = dev;
-
-	if (!siimage_proc) {
-		siimage_proc = 1;
-		ide_pci_create_host_proc("siimage", siimage_get_info);
-	}
-#endif /* DISPLAY_SIIMAGE_TIMINGS && CONFIG_PROC_FS */
 }
 
 /**
@@ -892,7 +813,7 @@
  *	to 133MHz clocking if the system isn't already set up to do it.
  */
 
-static unsigned int __init init_chipset_siimage (struct pci_dev *dev, const char *name)
+static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name)
 {
 	u32 class_rev	= 0;
 	u8 tmpbyte	= 0;
@@ -957,8 +878,8 @@
  *	The hardware supports buffered taskfiles and also some rather nice
  *	extended PRD tables. Unfortunately right now we don't.
  */
- 
-static void __init init_mmio_iops_siimage (ide_hwif_t *hwif)
+
+static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
 {
 	struct pci_dev *dev	= hwif->pci_dev;
 	void *addr		= pci_get_drvdata(dev);
@@ -1076,8 +997,8 @@
  *	look in we get for setting up the hwif so that we
  *	can get the iops right before using them.
  */
- 
-static void __init init_iops_siimage (ide_hwif_t *hwif)
+
+static void __devinit init_iops_siimage(ide_hwif_t *hwif)
 {
 	struct pci_dev *dev	= hwif->pci_dev;
 	u32 class_rev		= 0;
@@ -1103,8 +1024,8 @@
  *	Check for the presence of an ATA66 capable cable on the
  *	interface.
  */
- 
-static unsigned int __init ata66_siimage (ide_hwif_t *hwif)
+
+static unsigned int __devinit ata66_siimage(ide_hwif_t *hwif)
 {
 	unsigned long addr = siimage_selreg(hwif, 0);
 	if (pci_get_drvdata(hwif->pci_dev) == NULL) {
@@ -1124,8 +1045,8 @@
  *	requires several custom handlers so we override the default
  *	ide DMA handlers appropriately
  */
- 
-static void __init init_hwif_siimage (ide_hwif_t *hwif)
+
+static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
 {
 	hwif->autodma = 0;
 	
@@ -1172,6 +1093,23 @@
 	hwif->drives[1].autodma = hwif->autodma;
 }
 
+#define DECLARE_SII_DEV(name_str)			\
+	{						\
+		.name		= name_str,		\
+		.init_chipset	= init_chipset_siimage,	\
+		.init_iops	= init_iops_siimage,	\
+		.init_hwif	= init_hwif_siimage,	\
+		.channels	= 2,			\
+		.autodma	= AUTODMA,		\
+		.bootable	= ON_BOARD,		\
+	}
+
+static ide_pci_device_t siimage_chipsets[] __devinitdata = {
+	/* 0 */ DECLARE_SII_DEV("SiI680"),
+	/* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"),
+	/* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA")
+};
+
 /**
  *	siimage_init_one	-	pci layer discovery entry
  *	@dev: PCI device
@@ -1183,10 +1121,7 @@
  
 static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &siimage_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/siimage.h b/drivers/ide/pci/siimage.h
--- a/drivers/ide/pci/siimage.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,73 +0,0 @@
-#ifndef SIIMAGE_H
-#define SIIMAGE_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#include <asm/io.h>
-
-#define DISPLAY_SIIMAGE_TIMINGS
-
-#undef SIIMAGE_VIRTUAL_DMAPIO
-#undef SIIMAGE_BUFFERED_TASKFILE
-#undef SIIMAGE_LARGE_DMA
-
-#define SII_DEBUG 0
-
-#if SII_DEBUG
-#define siiprintk(x...)	printk(x)
-#else
-#define siiprintk(x...)
-#endif
-
-static unsigned int init_chipset_siimage(struct pci_dev *, const char *);
-static void init_iops_siimage(ide_hwif_t *);
-static void init_hwif_siimage(ide_hwif_t *);
-
-static ide_pci_device_t siimage_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_CMD,
-		.device		= PCI_DEVICE_ID_SII_680,
-		.name		= "SiI680",
-		.init_chipset	= init_chipset_siimage,
-		.init_iops	= init_iops_siimage,
-		.init_hwif	= init_hwif_siimage,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_CMD,
-		.device		= PCI_DEVICE_ID_SII_3112,
-		.name		= "SiI3112 Serial ATA",
-		.init_chipset	= init_chipset_siimage,
-		.init_iops	= init_iops_siimage,
-		.init_hwif	= init_hwif_siimage,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{	/* 2 */
-		.vendor		= PCI_VENDOR_ID_CMD,
-		.device		= PCI_DEVICE_ID_SII_1210SA,
-		.name		= "Adaptec AAR-1210SA",
-		.init_chipset	= init_chipset_siimage,
-		.init_iops	= init_iops_siimage,
-		.init_hwif	= init_hwif_siimage,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* SIIMAGE_H */
diff -Nru a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
--- a/drivers/ide/pci/sis5513.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/ide/pci/sis5513.c	Tue Jun 15 22:20:40 2004
@@ -63,7 +63,8 @@
 #include <asm/irq.h>
 
 #include "ide-timing.h"
-#include "sis5513.h"
+
+#define DISPLAY_SIS_TIMINGS
 
 /* registers layout and init values are chipset family dependant */
 
@@ -944,12 +945,19 @@
 	return;
 }
 
+static ide_pci_device_t sis5513_chipset __devinitdata = {
+	.name		= "SIS5513",
+	.init_chipset	= init_chipset_sis5513,
+	.init_hwif	= init_hwif_sis5513,
+	.channels	= 2,
+	.autodma	= NOAUTODMA,
+	.enablebits	= {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &sis5513_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &sis5513_chipset);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/sis5513.h b/drivers/ide/pci/sis5513.h
--- a/drivers/ide/pci/sis5513.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,34 +0,0 @@
-#ifndef SIS5513_H
-#define SIS5513_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define DISPLAY_SIS_TIMINGS
-
-static unsigned int init_chipset_sis5513(struct pci_dev *, const char *);
-static void init_hwif_sis5513(ide_hwif_t *);
-
-static ide_pci_device_t sis5513_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_SI,
-		.device		= PCI_DEVICE_ID_SI_5513,
-		.name		= "SIS5513",
-		.init_chipset	= init_chipset_sis5513,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_sis5513,
-		.channels	= 2,
-		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
-		.bootable	= ON_BOARD,
-		.extra		= 0
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* SIS5513_H */
diff -Nru a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
--- a/drivers/ide/pci/sl82c105.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/ide/pci/sl82c105.c	Tue Jun 15 22:20:38 2004
@@ -29,8 +29,6 @@
 #include <asm/io.h>
 #include <asm/dma.h>
 
-#include "sl82c105.h"
-
 #undef DEBUG
 
 #ifdef DEBUG
@@ -481,12 +479,20 @@
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 }
 
+static ide_pci_device_t sl82c105_chipset __devinitdata = {
+	.name		= "W82C105",
+	.init_chipset	= init_chipset_sl82c105,
+	.init_hwif	= init_hwif_sl82c105,
+	.init_dma	= init_dma_sl82c105,
+	.channels	= 2,
+	.autodma	= NOAUTODMA,
+	.enablebits	= {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &sl82c105_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &sl82c105_chipset);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/sl82c105.h b/drivers/ide/pci/sl82c105.h
--- a/drivers/ide/pci/sl82c105.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,34 +0,0 @@
-#ifndef W82C105_H
-#define W82C105_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-static unsigned int init_chipset_sl82c105(struct pci_dev *, const char *);
-static void init_hwif_sl82c105(ide_hwif_t *);
-static void init_dma_sl82c105(ide_hwif_t *, unsigned long);
-
-static ide_pci_device_t sl82c105_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_WINBOND,
-		.device		= PCI_DEVICE_ID_WINBOND_82C105,
-		.name		= "W82C105",
-		.init_chipset	= init_chipset_sl82c105,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_sl82c105,
-		.init_dma	= init_dma_sl82c105,
-		.channels	= 2,
-		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* W82C105_H */
diff -Nru a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
--- a/drivers/ide/pci/slc90e66.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/ide/pci/slc90e66.c	Tue Jun 15 22:20:43 2004
@@ -21,7 +21,7 @@
 
 #include <asm/io.h>
 
-#include "slc90e66.h"
+#define DISPLAY_SLC90E66_TIMINGS
 
 #if defined(DISPLAY_SLC90E66_TIMINGS) && defined(CONFIG_PROC_FS)
 #include <linux/stat.h>
@@ -364,12 +364,19 @@
 #endif /* !CONFIG_BLK_DEV_IDEDMA */
 }
 
+static ide_pci_device_t slc90e66_chipset __devinitdata = {
+	.name		= "SLC90E66",
+	.init_chipset	= init_chipset_slc90e66,
+	.init_hwif	= init_hwif_slc90e66,
+	.channels	= 2,
+	.autodma	= AUTODMA,
+	.enablebits	= {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &slc90e66_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &slc90e66_chipset);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/slc90e66.h b/drivers/ide/pci/slc90e66.h
--- a/drivers/ide/pci/slc90e66.h	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,36 +0,0 @@
-#ifndef SLC90E66_H
-#define SLC90E66_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define DISPLAY_SLC90E66_TIMINGS
-
-#define SLC90E66_DEBUG_DRIVE_INFO	0
-
-static unsigned int init_chipset_slc90e66(struct pci_dev *, const char *);
-static void init_hwif_slc90e66(ide_hwif_t *);
-
-static ide_pci_device_t slc90e66_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_EFAR,
-		.device		= PCI_DEVICE_ID_EFAR_SLC90E66_1,
-		.name		= "SLC90E66",
-		.init_chipset	= init_chipset_slc90e66,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_slc90e66,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* SLC90E66_H */
diff -Nru a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
--- a/drivers/ide/pci/triflex.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/pci/triflex.c	Tue Jun 15 22:20:39 2004
@@ -41,8 +41,6 @@
 #include <linux/ide.h>
 #include <linux/init.h>
 
-#include "triflex.h"
-
 static struct pci_dev *triflex_dev;
 
 #ifdef CONFIG_PROC_FS
@@ -217,18 +215,31 @@
 	return 0;	
 }
 
+static ide_pci_device_t triflex_device __devinitdata = {
+	.name		= "TRIFLEX",
+	.init_chipset	= init_chipset_triflex,
+	.init_hwif	= init_hwif_triflex,
+	.channels	= 2,
+	.autodma	= AUTODMA,
+	.enablebits	= {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}},
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit triflex_init_one(struct pci_dev *dev, 
 		const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &triflex_devices[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &triflex_device);
 	triflex_dev = dev;
-	
+
 	return 0;
 }
+
+static struct pci_device_id triflex_pci_tbl[] = {
+	{ PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ 0, },
+};
+MODULE_DEVICE_TABLE(pci, triflex_pci_tbl);
 
 static struct pci_driver driver = {
 	.name		= "TRIFLEX IDE",
diff -Nru a/drivers/ide/pci/triflex.h b/drivers/ide/pci/triflex.h
--- a/drivers/ide/pci/triflex.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,42 +0,0 @@
-/* 
- * triflex.h
- *
- * Copyright (C) 2002 Hewlett-Packard Development Group, L.P.
- * Author: Torben Mathiasen <torben.mathiasen@hp.com>
- *
- */
-#ifndef TRIFLEX_H
-#define TRIFLEX_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-static unsigned int __devinit init_chipset_triflex(struct pci_dev *, const char *);
-static void init_hwif_triflex(ide_hwif_t *);
-
-static ide_pci_device_t triflex_devices[] __devinitdata = {
-	{
-		.vendor 	= PCI_VENDOR_ID_COMPAQ,
-		.device		= PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE,
-		.name		= "TRIFLEX",
-		.init_chipset	= init_chipset_triflex,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_triflex,
-		.channels	= 2,
-		.autodma	= AUTODMA,
-		.enablebits	= {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}},
-		.bootable	= ON_BOARD,
-	},{	
-		.bootable	= EOL,
-	}
-};
-
-static struct pci_device_id triflex_pci_tbl[] = {
-	{ PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE, PCI_ANY_ID, 
-		PCI_ANY_ID, 0, 0, 0 },
-	{ 0, },
-};
-MODULE_DEVICE_TABLE(pci, triflex_pci_tbl);
-
-#endif /* TRIFLEX_H */
diff -Nru a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
--- a/drivers/ide/pci/trm290.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/ide/pci/trm290.c	Tue Jun 15 22:20:38 2004
@@ -140,8 +140,6 @@
 
 #include <asm/io.h>
 
-#include "trm290.h"
-
 static void trm290_prepare_drive (ide_drive_t *drive, unsigned int use_dma)
 {
 	ide_hwif_t *hwif = HWIF(drive);
@@ -302,7 +300,7 @@
 /*
  * Invoked from ide-dma.c at boot time.
  */
-void __init init_hwif_trm290 (ide_hwif_t *hwif)
+void __devinit init_hwif_trm290(ide_hwif_t *hwif)
 {
 	unsigned int cfgbase = 0;
 	unsigned long flags;
@@ -395,12 +393,17 @@
 #endif
 }
 
+static ide_pci_device_t trm290_chipset __devinitdata = {
+	.name		= "TRM290",
+	.init_hwif	= init_hwif_trm290,
+	.channels	= 2,
+	.autodma	= NOAUTODMA,
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &trm290_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &trm290_chipset);
 	return 0;
 }
 
diff -Nru a/drivers/ide/pci/trm290.h b/drivers/ide/pci/trm290.h
--- a/drivers/ide/pci/trm290.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,32 +0,0 @@
-#ifndef TRM290_H
-#define TRM290_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-extern void init_hwif_trm290(ide_hwif_t *);
-
-static ide_pci_device_t trm290_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_TEKRAM,
-		.device		= PCI_DEVICE_ID_TEKRAM_DC290,
-		.name		= "TRM290",
-		.init_chipset	= NULL,
-		.init_iops	= NULL,
-		.init_hwif	= init_hwif_trm290,
-		.init_dma	= NULL,
-		.channels	= 2,
-		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* TRM290_H */
diff -Nru a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
--- a/drivers/ide/pci/via82cxxx.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/ide/pci/via82cxxx.c	Tue Jun 15 22:20:35 2004
@@ -37,7 +37,8 @@
 #include <asm/io.h>
 
 #include "ide-timing.h"
-#include "via82cxxx.h"
+
+#define DISPLAY_VIA_TIMINGS
 
 #define VIA_IDE_ENABLE		0x40
 #define VIA_IDE_CONFIG		0x41
@@ -607,18 +608,25 @@
 	hwif->drives[1].autodma = hwif->autodma;
 }
 
+static ide_pci_device_t via82cxxx_chipset __devinitdata = {
+	.name		= "VP_IDE",
+	.init_chipset	= init_chipset_via82cxxx,
+	.init_hwif	= init_hwif_via82cxxx,
+	.channels	= 2,
+	.autodma	= NOAUTODMA,
+	.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
+	.bootable	= ON_BOARD,
+};
+
 static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	ide_pci_device_t *d = &via82cxxx_chipsets[id->driver_data];
-	if (dev->device != d->device)
-		BUG();
-	ide_setup_pci_device(dev, d);
+	ide_setup_pci_device(dev, &via82cxxx_chipset);
 	return 0;
 }
 
 static struct pci_device_id via_pci_tbl[] = {
 	{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
+	{ PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{ 0, },
 };
 MODULE_DEVICE_TABLE(pci, via_pci_tbl);
diff -Nru a/drivers/ide/pci/via82cxxx.h b/drivers/ide/pci/via82cxxx.h
--- a/drivers/ide/pci/via82cxxx.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,44 +0,0 @@
-#ifndef VIA82CXXX_H
-#define VIA82CXXX_H
-
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-
-#define DISPLAY_VIA_TIMINGS
-
-static unsigned int init_chipset_via82cxxx(struct pci_dev *, const char *);
-static void init_hwif_via82cxxx(ide_hwif_t *);
-
-static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
-	{	/* 0 */
-		.vendor		= PCI_VENDOR_ID_VIA,
-		.device		= PCI_DEVICE_ID_VIA_82C576_1,
-		.name		= "VP_IDE",
-		.init_chipset	= init_chipset_via82cxxx,
-		.init_hwif	= init_hwif_via82cxxx,
-		.channels	= 2,
-		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{	/* 1 */
-		.vendor		= PCI_VENDOR_ID_VIA,
-		.device		= PCI_DEVICE_ID_VIA_82C586_1,
-		.name		= "VP_IDE",
-		.init_chipset	= init_chipset_via82cxxx,
-		.init_hwif	= init_hwif_via82cxxx,
-		.channels	= 2,
-		.autodma	= NOAUTODMA,
-		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
-		.bootable	= ON_BOARD,
-		.extra		= 0,
-	},{
-		.vendor		= 0,
-		.device		= 0,
-		.channels	= 0,
-		.bootable	= EOL,
-	}
-};
-
-#endif /* VIA82CXXX_H */
diff -Nru a/drivers/ide/ppc/swarm.c b/drivers/ide/ppc/swarm.c
--- a/drivers/ide/ppc/swarm.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2001 Broadcom 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.
- */
-
-/*  Derived loosely from ide-pmac.c, so:
- *  
- *  Copyright (C) 1998 Paul Mackerras.
- *  Copyright (C) 1995-1998 Mark Lord
- */
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/ide.h>
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/sibyte/sb1250_int.h>
-
-#define __IDE_SWARM_C
-
-#include <asm/sibyte/swarm_ide.h>
-
-void __init swarm_ide_probe(void)
-{
-	int i;
-	ide_hwif_t *hwif;
-	/* 
-	 * Find the first untaken slot in hwifs 
-	 */
-	for (i = 0; i < MAX_HWIFS; i++) {
-		if (!ide_hwifs[i].io_ports[IDE_DATA_OFFSET]) {
-			break;
-		}
-	}
-	if (i == MAX_HWIFS) {
-		printk("No space for SWARM onboard IDE driver in ide_hwifs[].  Not enabled.\n");
-		return;
-	}
-
-	/* Set up our stuff */
-	hwif = &ide_hwifs[i];
-	hwif->hw.io_ports[IDE_DATA_OFFSET]    = SWARM_IDE_REG(0x1f0);
-	hwif->hw.io_ports[IDE_ERROR_OFFSET]   = SWARM_IDE_REG(0x1f1);
-	hwif->hw.io_ports[IDE_NSECTOR_OFFSET] = SWARM_IDE_REG(0x1f2);
-	hwif->hw.io_ports[IDE_SECTOR_OFFSET]  = SWARM_IDE_REG(0x1f3);
-	hwif->hw.io_ports[IDE_LCYL_OFFSET]    = SWARM_IDE_REG(0x1f4);
-	hwif->hw.io_ports[IDE_HCYL_OFFSET]    = SWARM_IDE_REG(0x1f5);
-	hwif->hw.io_ports[IDE_SELECT_OFFSET]  = SWARM_IDE_REG(0x1f6);
-	hwif->hw.io_ports[IDE_STATUS_OFFSET]  = SWARM_IDE_REG(0x1f7);
-	hwif->hw.io_ports[IDE_CONTROL_OFFSET] = SWARM_IDE_REG(0x3f6);
-	hwif->hw.io_ports[IDE_IRQ_OFFSET]     = SWARM_IDE_REG(0x3f7);
-//	hwif->hw->ack_intr                    = swarm_ide_ack_intr;
-	hwif->hw.irq                          = SWARM_IDE_INT;
-#if 0
-	hwif->iops                            = swarm_iops;
-#else
-	hwif->OUTB      = hwif->OUTBP         = swarm_outb;
-	hwif->OUTW      = hwif->OUTWP         = swarm_outw;
-	hwif->OUTL      = hwif->OUTLP         = swarm_outl;
-	hwif->OUTSW     = hwif->OUTSWP        = swarm_outsw;
-	hwif->OUTSL     = hwif->OUTSLP        = swarm_outsl;
-	hwif->INB       = hwif->INBP          = swarm_inb;
-	hwif->INW       = hwif->INWP          = swarm_inw;
-	hwif->INL       = hwif->INLP          = swarm_inl;
-	hwif->INSW      = hwif->INSWP         = swarm_insw;
-	hwif->INSL      = hwif->INSLP         = swarm_insl;
-#endif
-#if 0
-	hwif->pioops                          = swarm_pio_ops;
-#else
-	hwif->ata_input_data                  = swarm_ata_input_data;
-	hwif->ata_output_data                 = swarm_ata_output_data;
-	hwif->atapi_input_bytes               = swarm_atapi_input_bytes;
-	hwif->atapi_output_bytes              = swarm_atapi_output_bytes;
-#endif
-	memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
-	hwif->irq                             = hwif->hw.irq;
-	printk("SWARM onboard IDE configured as device %i\n", i);
-
-#ifndef HWIF_PROBE_CLASSIC_METHOD
-	probe_hwif_init(hwif->index);
-#endif /* HWIF_PROBE_CLASSIC_METHOD */
-
-}
-
diff -Nru a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
--- a/drivers/ide/setup-pci.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ide/setup-pci.c	Tue Jun 15 22:20:39 2004
@@ -285,14 +285,8 @@
 
 void ide_setup_pci_noise (struct pci_dev *dev, ide_pci_device_t *d)
 {
-	if ((d->vendor != dev->vendor) && (d->device != dev->device)) {
-		printk(KERN_INFO "%s: unknown IDE controller at PCI slot "
-			"%s, VID=%04x, DID=%04x\n",
-			d->name, pci_name(dev), dev->vendor, dev->device);
-        } else {
-		printk(KERN_INFO "%s: IDE controller at PCI slot %s\n",
-			d->name, pci_name(dev));
-	}
+	printk(KERN_INFO "%s: IDE controller at PCI slot %s\n",
+			 d->name, pci_name(dev));
 }
 
 EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
@@ -422,8 +416,7 @@
 	unsigned long ctl = 0, base = 0;
 	ide_hwif_t *hwif;
 
-	if(!d->isa_ports)
-	{
+	if ((d->flags & IDEPCI_FLAG_ISA_PORTS) == 0) {
 		/*  Possibly we should fail if these checks report true */
 		ide_pci_check_iomem(dev, d, 2*port);
 		ide_pci_check_iomem(dev, d, 2*port+1);
@@ -444,13 +437,12 @@
 	}
 	if ((hwif = ide_match_hwif(base, d->bootable, d->name)) == NULL)
 		return NULL;	/* no room in ide_hwifs[] */
-	if (hwif->io_ports[IDE_DATA_OFFSET] != base) {
-fixup_address:
+	if (hwif->io_ports[IDE_DATA_OFFSET] != base ||
+	    hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) {
+		memset(&hwif->hw, 0, sizeof(hwif->hw));
 		ide_init_hwif_ports(&hwif->hw, base, (ctl | 2), NULL);
 		memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
 		hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
-	} else if (hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) {
-		goto fixup_address;
 	}
 	hwif->chipset = ide_pci;
 	hwif->pci_dev = dev;
@@ -496,9 +488,7 @@
  			 * Set up BM-DMA capability
 			 * (PnP BIOS should have done this)
  			 */
-			if (!((d->device == PCI_DEVICE_ID_CYRIX_5530_IDE && d->vendor == PCI_VENDOR_ID_CYRIX)
-			    ||(d->device == PCI_DEVICE_ID_NS_SCx200_IDE && d->vendor == PCI_VENDOR_ID_NS)))
-			{
+			if ((d->flags & IDEPCI_FLAG_FORCE_MASTER) == 0) {
 				/*
 				 * default DMA off if we had to
 				 * configure it here
@@ -614,9 +604,7 @@
 		 * by the bios for raid purposes. 
 		 * Skip the normal "is it enabled" test for those.
 		 */
-		if (((d->vendor == PCI_VENDOR_ID_PROMISE) &&
-		     ((d->device == PCI_DEVICE_ID_PROMISE_20262) ||
-		      (d->device == PCI_DEVICE_ID_PROMISE_20265))) &&
+		if ((d->flags & IDEPCI_FLAG_FORCE_PDC) &&
 		    (secondpdc++==1) && (port==1))
 			goto controller_ok;
 			
diff -Nru a/drivers/ieee1394/csr.c b/drivers/ieee1394/csr.c
--- a/drivers/ieee1394/csr.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/ieee1394/csr.c	Tue Jun 15 22:20:37 2004
@@ -251,8 +251,6 @@
 
 	csr1212_init_local_csr(host->csr.rom, bus_info, host->csr.max_rom);
 
-	host->csr.rom->max_rom = host->csr.max_rom;
-
 	root = host->csr.rom->root_kv;
 
 	if(csr1212_attach_keyval_to_directory(root, node_cap) != CSR1212_SUCCESS) {
diff -Nru a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
--- a/drivers/ieee1394/csr1212.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/ieee1394/csr1212.c	Tue Jun 15 22:20:42 2004
@@ -206,7 +206,9 @@
 void csr1212_init_local_csr(struct csr1212_csr *csr,
 			    const u_int32_t *bus_info_data, int max_rom)
 {
-	csr->max_rom = max_rom;
+	static const int mr_map[] = { 4, 64, 1024, 0 };
+
+	csr->max_rom = mr_map[max_rom];
 	memcpy(csr->bus_info_data, bus_info_data, csr->bus_info_len);
 }
 
@@ -1059,6 +1061,10 @@
 		}
 
 		nkv = kv->next;
+		if (kv->prev)
+			kv->prev->next = NULL;
+		if (kv->next)
+			kv->next->prev = NULL;
 		kv->prev = NULL;
 		kv->next = NULL;
 	}
@@ -1132,7 +1138,7 @@
 			/* Make sure the Extended ROM leaf is a multiple of
 			 * max_rom in size. */
 			leaf_size = (cache->len + (csr->max_rom - 1)) &
-				(csr->max_rom - 1);
+				~(csr->max_rom - 1);
 
 			/* Zero out the unused ROM region */
 			memset(cache->data + bytes_to_quads(cache->len), 0x00,
diff -Nru a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h
--- a/drivers/ieee1394/csr1212.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/ieee1394/csr1212.h	Tue Jun 15 22:20:37 2004
@@ -38,9 +38,11 @@
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
+#include <linux/vmalloc.h>
+#include <asm/pgalloc.h>
 
-#define CSR1212_MALLOC(size)		kmalloc((size), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)
-#define CSR1212_FREE(ptr)		kfree(ptr)
+#define CSR1212_MALLOC(size)		vmalloc((size))
+#define CSR1212_FREE(ptr)		vfree(ptr)
 #define CSR1212_BE16_TO_CPU(quad)	be16_to_cpu(quad)
 #define CSR1212_CPU_TO_BE16(quad)	cpu_to_be16(quad)
 #define CSR1212_BE32_TO_CPU(quad)	be32_to_cpu(quad)
diff -Nru a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
--- a/drivers/ieee1394/eth1394.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/ieee1394/eth1394.c	Tue Jun 15 22:20:42 2004
@@ -89,7 +89,7 @@
 #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
 
 static char version[] __devinitdata =
-	"$Rev: 1198 $ Ben Collins <bcollins@debian.org>";
+	"$Rev: 1224 $ Ben Collins <bcollins@debian.org>";
 
 struct fragment_info {
 	struct list_head list;
@@ -191,7 +191,7 @@
 static void ether1394_iso(struct hpsb_iso *iso);
 
 static int ether1394_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr);
+static int ether1394_ethtool_ioctl(struct net_device *dev, void __user *useraddr);
 
 static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
 			   quadlet_t *data, u64 addr, size_t len, u16 flags);
@@ -1770,7 +1770,7 @@
 {
 	switch(cmd) {
 		case SIOCETHTOOL:
-			return ether1394_ethtool_ioctl(dev, (void *) ifr->ifr_data);
+			return ether1394_ethtool_ioctl(dev, ifr->ifr_data);
 
 		case SIOCGMIIPHY:		/* Get address of MII PHY in use. */
 		case SIOCGMIIREG:		/* Read MII PHY register. */
@@ -1782,18 +1782,18 @@
 	return 0;
 }
 
-static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int ether1394_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	u32 ethcmd;
 
-	if (get_user(ethcmd, (u32 *)useraddr))
+	if (get_user(ethcmd, (u32 __user *)useraddr))
 		return -EFAULT;
 
 	switch (ethcmd) {
 		case ETHTOOL_GDRVINFO: {
 			struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
 			strcpy (info.driver, driver_name);
-			strcpy (info.version, "$Rev: 1198 $");
+			strcpy (info.version, "$Rev: 1224 $");
 			/* FIXME XXX provide sane businfo */
 			strcpy (info.bus_info, "ieee1394");
 			if (copy_to_user (useraddr, &info, sizeof (info)))
diff -Nru a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
--- a/drivers/ieee1394/highlevel.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/ieee1394/highlevel.c	Tue Jun 15 22:20:44 2004
@@ -383,7 +383,7 @@
 		a2sa = a2->start & align_mask;
 		a2ea = (a2->end + alignment -1) & align_mask;
 
-		if ((a2sa - a1ea >= size) && (a2sa - start >= size) && (end - a1ea >= size)) {
+		if ((a2sa - a1ea >= size) && (a2sa - start >= size) && (a2sa > start)) {
 			as->start = max(start, a1ea);
 			as->end = as->start + size;
 			list_add(&as->host_list, entry);
diff -Nru a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c
--- a/drivers/ieee1394/hosts.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/ieee1394/hosts.c	Tue Jun 15 22:20:39 2004
@@ -30,7 +30,7 @@
 #include "config_roms.h"
 
 
-static void delayed_reset_bus(unsigned long __reset_info)
+static void delayed_reset_bus(void * __reset_info)
 {
 	struct hpsb_host *host = (struct hpsb_host*)__reset_info;
 	int generation = host->csr.generation + 1;
@@ -129,9 +129,6 @@
 	skb_queue_head_init(&h->pending_packet_queue);
 	INIT_LIST_HEAD(&h->addr_space);
 
-	init_timer(&h->delayed_reset);
-	h->delayed_reset.function = delayed_reset_bus;
-	h->delayed_reset.data = (unsigned long)h;
 	for (i = 2; i < 16; i++)
 		h->csr.gen_timestamp[i] = jiffies - 60 * HZ;
 
@@ -140,6 +137,8 @@
 
 	atomic_set(&h->generation, 0);
 
+	INIT_WORK(&h->delayed_reset, delayed_reset_bus, h);
+	
 	init_timer(&h->timeout);
 	h->timeout.data = (unsigned long) h;
 	h->timeout.function = abort_timedouts;
@@ -187,6 +186,10 @@
 void hpsb_remove_host(struct hpsb_host *host)
 {
         host->is_shutdown = 1;
+
+	cancel_delayed_work(&host->delayed_reset);
+	flush_scheduled_work();
+
         host->driver = &dummy_driver;
 
         highlevel_remove_host(host);
@@ -199,7 +202,7 @@
 
 int hpsb_update_config_rom_image(struct hpsb_host *host)
 {
-	unsigned long reset_time;
+	unsigned long reset_delay;
 	int next_gen = host->csr.generation + 1;
 
 	if (!host->update_config_rom)
@@ -210,21 +213,21 @@
 
 	/* Stop the delayed interrupt, we're about to change the config rom and
 	 * it would be a waste to do a bus reset twice. */
-	del_timer_sync(&host->delayed_reset);
+	cancel_delayed_work(&host->delayed_reset);
 
 	/* IEEE 1394a-2000 prohibits using the same generation number
 	 * twice in a 60 second period. */
 	if (jiffies - host->csr.gen_timestamp[next_gen] < 60 * HZ)
 		/* Wait 60 seconds from the last time this generation number was
 		 * used. */
-		reset_time = (60 * HZ) + host->csr.gen_timestamp[next_gen];
+		reset_delay = (60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies;
 	else
 		/* Wait 1 second in case some other code wants to change the
 		 * Config ROM in the near future. */
-		reset_time = jiffies + HZ;
+		reset_delay = HZ;
 
-	/* This will add the timer as well as modify it */
-	mod_timer(&host->delayed_reset, reset_time);
+	PREPARE_WORK(&host->delayed_reset, delayed_reset_bus, host);
+	schedule_delayed_work(&host->delayed_reset, reset_delay);
 
 	return 0;
 }
diff -Nru a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h
--- a/drivers/ieee1394/hosts.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/ieee1394/hosts.h	Tue Jun 15 22:20:37 2004
@@ -66,7 +66,7 @@
 	struct class_device class_dev;
 
 	int update_config_rom;
-	struct timer_list delayed_reset;
+	struct work_struct delayed_reset;
 
 	unsigned int config_roms;
 
diff -Nru a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
--- a/drivers/ieee1394/ieee1394_core.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/ieee1394/ieee1394_core.c	Tue Jun 15 22:20:38 2004
@@ -32,6 +32,7 @@
 #include <linux/bitops.h>
 #include <linux/kdev_t.h>
 #include <linux/skbuff.h>
+#include <linux/suspend.h>
 
 #include <asm/byteorder.h>
 #include <asm/semaphore.h>
@@ -400,31 +401,35 @@
 void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet,
                       int ackcode)
 {
+	unsigned long flags;
+
+	spin_lock_irqsave(&host->pending_packet_queue.lock, flags);
+
 	packet->ack_code = ackcode;
 
-	if (packet->no_waiter) {
-		/* must not have a tlabel allocated */
+	if (packet->no_waiter || packet->state == hpsb_complete) {
+		/* if packet->no_waiter, must not have a tlabel allocated */
+		spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
 		hpsb_free_packet(packet);
 		return;
 	}
 
+	atomic_dec(&packet->refcnt);	/* drop HC's reference */
+	/* here the packet must be on the host->pending_packet_queue */
+
 	if (ackcode != ACK_PENDING || !packet->expect_response) {
-		atomic_dec(&packet->refcnt);
-		skb_unlink(packet->skb);
 		packet->state = hpsb_complete;
+		__skb_unlink(packet->skb, &host->pending_packet_queue);
+		spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
 		queue_packet_complete(packet);
 		return;
 	}
 
-	if (packet->state == hpsb_complete) {
-		hpsb_free_packet(packet);
-		return;
-	}
-
-	atomic_dec(&packet->refcnt);
 	packet->state = hpsb_pending;
 	packet->sendtime = jiffies;
 
+	spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
+
 	mod_timer(&host->timeout, jiffies + host->timeout_interval);
 }
 
@@ -658,14 +663,13 @@
         }
 
         if (!tcode_match) {
+		spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
                 HPSB_INFO("unsolicited response packet received - tcode mismatch");
                 dump_packet("contents:", data, 16);
-		spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
                 return;
         }
 
 	__skb_unlink(skb, skb->list);
-	spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
 
 	if (packet->state == hpsb_queued) {
 		packet->sendtime = jiffies;
@@ -673,6 +677,8 @@
 	}
 
 	packet->state = hpsb_complete;
+	spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
+
 	queue_packet_complete(packet);
 }
 
@@ -1002,6 +1008,10 @@
 
 static void queue_packet_complete(struct hpsb_packet *packet)
 {
+	if (packet->no_waiter) {
+		hpsb_free_packet(packet);
+		return;
+	}
 	if (packet->complete_routine != NULL) {
 		skb_queue_tail(&hpsbpkt_queue, packet->skb);
 
@@ -1024,6 +1034,11 @@
 		if (khpsbpkt_kill)
 			break;
 
+		if (current->flags & PF_FREEZE) {
+			refrigerator(0);
+			continue;
+		}
+
 		while ((skb = skb_dequeue(&hpsbpkt_queue)) != NULL) {
 			packet = (struct hpsb_packet *)skb->data;
 
@@ -1042,10 +1057,11 @@
 
 static int __init ieee1394_init(void)
 {
-	int i;
+	int i, ret;
 
 	skb_queue_head_init(&hpsbpkt_queue);
 
+	/* non-fatal error */
 	if (hpsb_init_config_roms()) {
 		HPSB_ERR("Failed to initialize some config rom entries.\n");
 		HPSB_ERR("Some features may not be available\n");
@@ -1054,32 +1070,85 @@
 	khpsbpkt_pid = kernel_thread(hpsbpkt_thread, NULL, CLONE_KERNEL);
 	if (khpsbpkt_pid < 0) {
 		HPSB_ERR("Failed to start hpsbpkt thread!\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto exit_cleanup_config_roms;
 	}
 
-	devfs_mk_dir("ieee1394");
-
 	if (register_chrdev_region(IEEE1394_CORE_DEV, 256, "ieee1394")) {
 		HPSB_ERR("unable to register character device major %d!\n", IEEE1394_MAJOR);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto exit_release_kernel_thread;
 	}
 
-	devfs_mk_dir("ieee1394");
+	/* actually this is a non-fatal error */
+	ret = devfs_mk_dir("ieee1394");
+	if (ret < 0) {
+		HPSB_ERR("unable to make devfs dir for device major %d!\n", IEEE1394_MAJOR);
+		goto release_chrdev;
+	}
 
-	bus_register(&ieee1394_bus_type);
-	for (i = 0; fw_bus_attrs[i]; i++)
-		bus_create_file(&ieee1394_bus_type, fw_bus_attrs[i]);
-	class_register(&hpsb_host_class);
+	ret = bus_register(&ieee1394_bus_type);
+	if (ret < 0) {
+		HPSB_INFO("bus register failed");
+		goto release_devfs;
+	}
 
-	if (init_csr())
-		return -ENOMEM;
+	for (i = 0; fw_bus_attrs[i]; i++) {
+		ret = bus_create_file(&ieee1394_bus_type, fw_bus_attrs[i]);
+		if (ret < 0) {
+			while (i >= 0) {
+				bus_remove_file(&ieee1394_bus_type,
+						fw_bus_attrs[i--]);
+			}
+			bus_unregister(&ieee1394_bus_type);
+			goto release_devfs;
+		}
+	}
+
+	ret = class_register(&hpsb_host_class);
+	if (ret < 0)
+		goto release_all_bus;
+
+	ret = init_csr();
+	if (ret) {
+		HPSB_INFO("init csr failed");
+		ret = -ENOMEM;
+		goto release_class;
+	}
 
-	if (!disable_nodemgr)
-		init_ieee1394_nodemgr();
-	else
+	if (disable_nodemgr) {
 		HPSB_INFO("nodemgr functionality disabled");
+		return 0;
+	}
+
+	ret = init_ieee1394_nodemgr();
+	if (ret < 0) {
+		HPSB_INFO("init nodemgr failed");
+		goto cleanup_csr;
+	}
 
 	return 0;
+
+cleanup_csr:
+	cleanup_csr();
+release_class:
+	class_unregister(&hpsb_host_class);
+release_all_bus:
+	for (i = 0; fw_bus_attrs[i]; i++)
+		bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
+	bus_unregister(&ieee1394_bus_type);
+release_devfs:
+	devfs_remove("ieee1394");
+release_chrdev:
+	unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
+exit_release_kernel_thread:
+	if (khpsbpkt_pid >= 0) {
+		kill_proc(khpsbpkt_pid, SIGTERM, 1);
+		wait_for_completion(&khpsbpkt_complete);
+	}
+exit_cleanup_config_roms:
+	hpsb_cleanup_config_roms();
+	return ret;
 }
 
 static void __exit ieee1394_cleanup(void)
diff -Nru a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h
--- a/drivers/ieee1394/ieee1394_core.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/ieee1394/ieee1394_core.h	Tue Jun 15 22:20:37 2004
@@ -101,8 +101,6 @@
  *
  * Use the functions, not the variable.
  */
-#include <asm/atomic.h>
-
 static inline unsigned int get_hpsb_generation(struct hpsb_host *host)
 {
         return atomic_read(&host->generation);
diff -Nru a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
--- a/drivers/ieee1394/nodemgr.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/ieee1394/nodemgr.c	Tue Jun 15 22:20:41 2004
@@ -19,6 +19,7 @@
 #include <linux/delay.h>
 #include <linux/pci.h>
 #include <linux/moduleparam.h>
+#include <linux/suspend.h>
 #include <asm/atomic.h>
 
 #include "ieee1394_types.h"
@@ -1474,11 +1475,20 @@
 
 	/* Sit and wait for a signal to probe the nodes on the bus. This
 	 * happens when we get a bus reset. */
-	while (!down_interruptible(&hi->reset_sem) &&
-	       !down_interruptible(&nodemgr_serialize)) {
+	while (1) {
 		unsigned int generation = 0;
 		int i;
 
+		if (down_interruptible(&hi->reset_sem) ||
+		    down_interruptible(&nodemgr_serialize)) {
+			if (current->flags & PF_FREEZE) {
+				refrigerator(0);
+				continue;
+			}
+			printk("NodeMgr: received unexpected signal?!\n" );
+			break;
+		}
+
 		if (hi->kill_me)
 			break;
 
@@ -1502,6 +1512,10 @@
 			 * start the the waiting over again */
 			while (!down_trylock(&hi->reset_sem))
 				i = 0;
+
+			/* Check the kill_me again */
+			if (hi->kill_me)
+				goto caught_signal;
 		}
 
 		if (!nodemgr_check_irm_capability(host, reset_cycles)) {
@@ -1702,12 +1716,23 @@
 	.remove_host =	nodemgr_remove_host,
 };
 
-void init_ieee1394_nodemgr(void)
+int init_ieee1394_nodemgr(void)
 {
-	class_register(&nodemgr_ne_class);
-	class_register(&nodemgr_ud_class);
+	int ret;
+
+	ret = class_register(&nodemgr_ne_class);
+	if (ret < 0)
+		return ret;
+
+	ret = class_register(&nodemgr_ud_class);
+	if (ret < 0) {
+		class_unregister(&nodemgr_ne_class);
+		return ret;
+	}
 
 	hpsb_register_highlevel(&nodemgr_highlevel);
+
+	return 0;
 }
 
 void cleanup_ieee1394_nodemgr(void)
diff -Nru a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h
--- a/drivers/ieee1394/nodemgr.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/ieee1394/nodemgr.h	Tue Jun 15 22:20:41 2004
@@ -192,7 +192,7 @@
 int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *));
 
 
-void init_ieee1394_nodemgr(void);
+int init_ieee1394_nodemgr(void);
 void cleanup_ieee1394_nodemgr(void);
 
 
diff -Nru a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
--- a/drivers/ieee1394/ohci1394.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/ieee1394/ohci1394.c	Tue Jun 15 22:20:44 2004
@@ -162,7 +162,7 @@
 printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args)
 
 static char version[] __devinitdata =
-	"$Rev: 1203 $ Ben Collins <bcollins@debian.org>";
+	"$Rev: 1223 $ Ben Collins <bcollins@debian.org>";
 
 /* Module Parameters */
 static int phys_dma = 1;
@@ -516,6 +516,12 @@
 	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);
 
diff -Nru a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
--- a/drivers/ieee1394/sbp2.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/ieee1394/sbp2.c	Tue Jun 15 22:20:37 2004
@@ -78,7 +78,7 @@
 #include "sbp2.h"
 
 static char version[] __devinitdata =
-	"$Rev: 1205 $ Ben Collins <bcollins@debian.org>";
+	"$Rev: 1219 $ Ben Collins <bcollins@debian.org>";
 
 /*
  * Module load parameter definitions
@@ -876,9 +876,9 @@
 			SBP2_DMA_FREE("login FIFO DMA");
 		}
 
-		kfree(scsi_id);
-
 		list_del(&scsi_id->scsi_list);
+
+		kfree(scsi_id);
 
 		SBP2_ERR ("Could not allocate memory for scsi_id");
 
diff -Nru a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
--- a/drivers/ieee1394/video1394.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/ieee1394/video1394.c	Tue Jun 15 22:20:37 2004
@@ -864,6 +864,7 @@
 			return -EFAULT;
 
 		d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel);
+		if (d == NULL) return -EFAULT;
 
 		if ((v.buffer<0) || (v.buffer>d->num_desc)) {
 			PRINT(KERN_ERR, ohci->host->id,
@@ -926,6 +927,7 @@
 			return -EFAULT;
 
 		d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, v.channel);
+		if (d == NULL) return -EFAULT;
 
 		if ((v.buffer<0) || (v.buffer>d->num_desc)) {
 			PRINT(KERN_ERR, ohci->host->id,
@@ -1009,6 +1011,7 @@
 			return -EFAULT;
 
 		d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, v.channel);
+		if (d == NULL) return -EFAULT;
 
 		if ((v.buffer<0) || (v.buffer>d->num_desc)) {
 			PRINT(KERN_ERR, ohci->host->id,
@@ -1112,6 +1115,7 @@
 			return -EFAULT;
 
 		d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, v.channel);
+		if (d == NULL) return -EFAULT;
 
 		if ((v.buffer<0) || (v.buffer>d->num_desc)) {
 			PRINT(KERN_ERR, ohci->host->id,
diff -Nru a/drivers/input/Kconfig b/drivers/input/Kconfig
--- a/drivers/input/Kconfig	Tue Jun 15 22:20:37 2004
+++ b/drivers/input/Kconfig	Tue Jun 15 22:20:37 2004
@@ -41,9 +41,16 @@
 	  module will be called mousedev.
 
 config INPUT_MOUSEDEV_PSAUX
-	bool "Provide legacy /dev/psaux device" if EMBEDDED
+	bool "Provide legacy /dev/psaux device"
 	default y
 	depends on INPUT_MOUSEDEV
+	---help---
+	  Say Y here if you want your mouse also be accessible as char device
+	  10:1 - /dev/psaux. The data available through /dev/psaux is exactly
+	  the same as the data from /dev/input/mice.
+
+	  If unsure, say Y.
+
 
 config INPUT_MOUSEDEV_SCREEN_X
 	int "Horizontal screen resolution"
diff -Nru a/drivers/input/evbug.c b/drivers/input/evbug.c
--- a/drivers/input/evbug.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/evbug.c	Tue Jun 15 22:20:39 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -35,7 +35,7 @@
 #include <linux/device.h>
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
-MODULE_DESCRIPTION("Input driver event debug module"); 
+MODULE_DESCRIPTION("Input driver event debug module");
 MODULE_LICENSE("GPL");
 
 static char evbug_name[] = "evbug";
@@ -67,7 +67,7 @@
 static void evbug_disconnect(struct input_handle *handle)
 {
 	printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys);
-	
+
 	input_close_device(handle);
 
 	kfree(handle);
@@ -79,7 +79,7 @@
 };
 
 MODULE_DEVICE_TABLE(input, evbug_ids);
-	
+
 static struct input_handler evbug_handler = {
 	.event =	evbug_event,
 	.connect =	evbug_connect,
diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/input/evdev.c	Tue Jun 15 22:20:43 2004
@@ -126,7 +126,7 @@
 	int i = iminor(inode) - EVDEV_MINOR_BASE;
 	int accept_err;
 
-	if (i >= EVDEV_MINORS || !evdev_table[i])
+	if (i >= EVDEV_MINORS || !evdev_table[i] || !evdev_table[i]->exist)
 		return -ENODEV;
 
 	if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file)))
@@ -147,7 +147,7 @@
 	return 0;
 }
 
-static ssize_t evdev_write(struct file * file, const char * buffer, size_t count, loff_t *ppos)
+static ssize_t evdev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos)
 {
 	struct evdev_list *list = file->private_data;
 	struct input_event event;
@@ -166,7 +166,7 @@
 	return retval;
 }
 
-static ssize_t evdev_read(struct file * file, char * buffer, size_t count, loff_t *ppos)
+static ssize_t evdev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos)
 {
 	struct evdev_list *list = file->private_data;
 	int retval;
@@ -175,7 +175,7 @@
 		return -EAGAIN;
 
 	retval = wait_event_interruptible(list->evdev->wait,
-		list->head != list->tail && list->evdev->exist);
+		list->head != list->tail || (!list->evdev->exist));
 
 	if (retval)
 		return retval;
@@ -209,6 +209,8 @@
 	struct evdev *evdev = list->evdev;
 	struct input_dev *dev = evdev->handle.dev;
 	struct input_absinfo abs;
+	void __user *p = (void __user *)arg;
+	int __user *ip = (int __user *)arg;
 	int i, t, u, v;
 
 	if (!evdev->exist) return -ENODEV;
@@ -216,21 +218,21 @@
 	switch (cmd) {
 
 		case EVIOCGVERSION:
-			return put_user(EV_VERSION, (int *) arg);
+			return put_user(EV_VERSION, ip);
 
 		case EVIOCGID:
-			return copy_to_user((void *) arg, &dev->id, sizeof(struct input_id)) ? -EFAULT : 0;
-		
+			return copy_to_user(p, &dev->id, sizeof(struct input_id)) ? -EFAULT : 0;
+
 		case EVIOCGKEYCODE:
-			if (get_user(t, ((int *) arg) + 0)) return -EFAULT;
+			if (get_user(t, ip)) return -EFAULT;
 			if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
-			if (put_user(INPUT_KEYCODE(dev, t), ((int *) arg) + 1)) return -EFAULT;
+			if (put_user(INPUT_KEYCODE(dev, t), ip + 1)) return -EFAULT;
 			return 0;
 
 		case EVIOCSKEYCODE:
-			if (get_user(t, ((int *) arg) + 0)) return -EFAULT;
+			if (get_user(t, ip)) return -EFAULT;
 			if (t < 0 || t > dev->keycodemax || !dev->keycodesize) return -EINVAL;
-			if (get_user(v, ((int *) arg) + 1)) return -EFAULT;
+			if (get_user(v, ip + 1)) return -EFAULT;
 			u = SET_INPUT_KEYCODE(dev, t, v);
 			clear_bit(u, dev->keybit);
 			set_bit(v, dev->keybit);
@@ -244,10 +246,10 @@
 				struct ff_effect effect;
 				int err;
 
-				if (copy_from_user((void*)(&effect), (void*)arg, sizeof(effect)))
+				if (copy_from_user(&effect, p, sizeof(effect)))
 					return -EFAULT;
 				err = dev->upload_effect(dev, &effect);
-				if (put_user(effect.id, &(((struct ff_effect*)arg)->id)))
+				if (put_user(effect.id, &(((struct ff_effect __user *)arg)->id)))
 					return -EFAULT;
 				return err;
 			}
@@ -260,7 +262,7 @@
 			else return -ENOSYS;
 
 		case EVIOCGEFFECTS:
-			if (put_user(dev->ff_effects_max, (int*) arg))
+			if (put_user(dev->ff_effects_max, ip))
 				return -EFAULT;
 			return 0;
 
@@ -303,28 +305,28 @@
 				}
 				len = NBITS(len) * sizeof(long);
 				if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
-				return copy_to_user((char *) arg, bits, len) ? -EFAULT : len;
+				return copy_to_user(p, bits, len) ? -EFAULT : len;
 			}
 
 			if (_IOC_NR(cmd) == _IOC_NR(EVIOCGKEY(0))) {
 				int len;
 				len = NBITS(KEY_MAX) * sizeof(long);
 				if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
-				return copy_to_user((char *) arg, dev->key, len) ? -EFAULT : len;
+				return copy_to_user(p, dev->key, len) ? -EFAULT : len;
 			}
 
 			if (_IOC_NR(cmd) == _IOC_NR(EVIOCGLED(0))) {
 				int len;
 				len = NBITS(LED_MAX) * sizeof(long);
 				if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
-				return copy_to_user((char *) arg, dev->led, len) ? -EFAULT : len;
+				return copy_to_user(p, dev->led, len) ? -EFAULT : len;
 			}
 
 			if (_IOC_NR(cmd) == _IOC_NR(EVIOCGSND(0))) {
 				int len;
 				len = NBITS(SND_MAX) * sizeof(long);
 				if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
-				return copy_to_user((char *) arg, dev->snd, len) ? -EFAULT : len;
+				return copy_to_user(p, dev->snd, len) ? -EFAULT : len;
 			}
 
 			if (_IOC_NR(cmd) == _IOC_NR(EVIOCGNAME(0))) {
@@ -332,7 +334,7 @@
 				if (!dev->name) return -ENOENT;
 				len = strlen(dev->name) + 1;
 				if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
-				return copy_to_user((char *) arg, dev->name, len) ? -EFAULT : len;
+				return copy_to_user(p, dev->name, len) ? -EFAULT : len;
 			}
 
 			if (_IOC_NR(cmd) == _IOC_NR(EVIOCGPHYS(0))) {
@@ -340,7 +342,7 @@
 				if (!dev->phys) return -ENOENT;
 				len = strlen(dev->phys) + 1;
 				if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
-				return copy_to_user((char *) arg, dev->phys, len) ? -EFAULT : len;
+				return copy_to_user(p, dev->phys, len) ? -EFAULT : len;
 			}
 
 			if (_IOC_NR(cmd) == _IOC_NR(EVIOCGUNIQ(0))) {
@@ -348,7 +350,7 @@
 				if (!dev->uniq) return -ENOENT;
 				len = strlen(dev->uniq) + 1;
 				if (len > _IOC_SIZE(cmd)) len = _IOC_SIZE(cmd);
-				return copy_to_user((char *) arg, dev->uniq, len) ? -EFAULT : len;
+				return copy_to_user(p, dev->uniq, len) ? -EFAULT : len;
 			}
 
 			if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {
@@ -361,7 +363,7 @@
 				abs.fuzz = dev->absfuzz[t];
 				abs.flat = dev->absflat[t];
 
-				if (copy_to_user((void *) arg, &abs, sizeof(struct input_absinfo)))
+				if (copy_to_user(p, &abs, sizeof(struct input_absinfo)))
 					return -EFAULT;
 
 				return 0;
@@ -371,7 +373,7 @@
 
 				int t = _IOC_NR(cmd) & ABS_MAX;
 
-				if (copy_from_user(&abs, (void *) arg, sizeof(struct input_absinfo)))
+				if (copy_from_user(&abs, p, sizeof(struct input_absinfo)))
 					return -EFAULT;
 
 				dev->abs[t] = abs.value;
@@ -428,7 +430,7 @@
 
 	devfs_mk_cdev(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
 			S_IFCHR|S_IRUGO|S_IWUSR, "input/event%d", minor);
-	class_simple_device_add(input_class, 
+	class_simple_device_add(input_class,
 				MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor),
 				dev->dev, "event%d", minor);
 
diff -Nru a/drivers/input/gameport/cs461x.c b/drivers/input/gameport/cs461x.c
--- a/drivers/input/gameport/cs461x.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/gameport/cs461x.c	Tue Jun 15 22:20:36 2004
@@ -1,8 +1,8 @@
 /*
-	The all defines and part of code (such as cs461x_*) are 
-	contributed from ALSA 0.5.8 sources. 
+	The all defines and part of code (such as cs461x_*) are
+	contributed from ALSA 0.5.8 sources.
 	See http://www.alsa-project.org/ for sources
-	
+
 	Tested on Linux 686 2.4.0-test9, ALSA 0.5.8a and CS4610
 */
 
@@ -89,8 +89,8 @@
 #define JSIO_BXOE                               0x00000040
 #define JSIO_BYOE                               0x00000080
 
-/* 
-   The card initialization code is obfuscated; the module cs461x 
+/*
+   The card initialization code is obfuscated; the module cs461x
    need to be loaded after ALSA modules initialized and something
    played on the CS 4610 chip (see sources for details of CS4610
    initialization code from ALSA)
@@ -112,7 +112,7 @@
 #define BA1_DWORD_SIZE          (13 * 1024 + 512)
 #define BA1_MEMORY_COUNT        3
 
-/* 
+/*
    Only one CS461x card is still suppoted; the code requires
    redesign to avoid this limitatuion.
 */
@@ -163,7 +163,7 @@
 	if(port){
 	    gameport_unregister_port(port);
 	    kfree(port);
-	}    
+	}
 	if (ba0) iounmap(ba0);
 #ifdef CS461X_FULL_MAP
 	if (ba1.name.data0) iounmap(ba1.name.data0);
@@ -187,13 +187,13 @@
 static int cs461x_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
 {
 	unsigned js1, js2, jst;
-	
+
 	js1 = cs461x_peekBA0(BA0_JSC1);
 	js2 = cs461x_peekBA0(BA0_JSC2);
 	jst = cs461x_peekBA0(BA0_JSPT);
-	
-	*buttons = (~jst >> 4) & 0x0F; 
-	
+
+	*buttons = (~jst >> 4) & 0x0F;
+
 	axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF;
 	axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF;
 	axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF;
@@ -228,7 +228,7 @@
 {
 	int rc;
 	struct gameport* port;
-	
+
 	rc = pci_enable_device(pdev);
 	if (rc) {
 		printk(KERN_ERR "cs461x: Cannot enable PCI gameport (bus %d, devfn %d) error=%d\n",
@@ -240,7 +240,7 @@
 #ifdef CS461X_FULL_MAP
 	ba1_addr = pci_resource_start(pdev, 1);
 #endif
-	if (ba0_addr == 0 || ba0_addr == ~0 
+	if (ba0_addr == 0 || ba0_addr == ~0
 #ifdef CS461X_FULL_MAP
             || ba1_addr == 0 || ba1_addr == ~0
 #endif
@@ -281,7 +281,7 @@
 	memset(port, 0, sizeof(struct gameport));
 
 	pci_set_drvdata(pdev, port);
-	
+
 	port->open = cs461x_gameport_open;
 	port->trigger = cs461x_gameport_trigger;
 	port->read = cs461x_gameport_read;
@@ -310,7 +310,7 @@
 {
 	cs461x_free(pdev);
 }
-	
+
 static struct pci_driver cs461x_pci_driver = {
         .name =         "CS461x Gameport",
         .id_table =     cs461x_pci_tbl,
diff -Nru a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c
--- a/drivers/input/gameport/emu10k1-gp.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/input/gameport/emu10k1-gp.c	Tue Jun 15 22:20:41 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -48,7 +48,7 @@
 	int size;
 	char phys[32];
 };
-	
+
 static struct pci_device_id emu_tbl[] = {
 	{ 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */
 	{ 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */
@@ -61,7 +61,7 @@
 {
 	int ioport, iolen;
 	struct emu *emu;
-        
+
 	if (pci_enable_device(pdev))
 		return -EBUSY;
 
diff -Nru a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c
--- a/drivers/input/gameport/fm801-gp.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/input/gameport/fm801-gp.c	Tue Jun 15 22:20:41 2004
@@ -111,7 +111,7 @@
 
 	pci_set_drvdata(pci, gp);
 
-	outb(0x60, gp->gameport.io + 0x0d); /* enable joystick 1 and 2 */ 
+	outb(0x60, gp->gameport.io + 0x0d); /* enable joystick 1 and 2 */
 
 	gameport_register_port(&gp->gameport);
 
diff -Nru a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
--- a/drivers/input/gameport/gameport.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/input/gameport/gameport.c	Tue Jun 15 22:20:40 2004
@@ -168,7 +168,7 @@
 		return -1;
 
 	gameport->dev = dev;
-	
+
 	return 0;
 }
 
diff -Nru a/drivers/input/gameport/lightning.c b/drivers/input/gameport/lightning.c
--- a/drivers/input/gameport/lightning.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/gameport/lightning.c	Tue Jun 15 22:20:39 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -106,7 +106,7 @@
 
 	result = 0;
 
-fail:	outb(L4_SELECT_ANALOG, L4_PORT);	
+fail:	outb(L4_SELECT_ANALOG, L4_PORT);
 	return result;
 }
 
@@ -126,7 +126,7 @@
 static int l4_getcal(int port, int *cal)
 {
 	int i, result = -1;
-	
+
 	outb(L4_SELECT_ANALOG, L4_PORT);
 	outb(L4_SELECT_DIGITAL + (port >> 2), L4_PORT);
 
@@ -208,7 +208,7 @@
 
 	return 0;
 }
-	
+
 static int __init l4_init(void)
 {
 	int cal[4] = {255,255,255,255};
@@ -266,7 +266,7 @@
 
 			if (rev > 0x28)		/* on 2.9+ the setcal command works correctly */
 				l4_setcal(l4->port, cal);
-			
+
 			gameport_register_port(gameport);
 		}
 
diff -Nru a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c
--- a/drivers/input/gameport/ns558.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/input/gameport/ns558.c	Tue Jun 15 22:20:44 2004
@@ -12,18 +12,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -35,6 +35,7 @@
 #include <linux/ioport.h>
 #include <linux/config.h>
 #include <linux/init.h>
+#include <linux/delay.h>
 #include <linux/gameport.h>
 #include <linux/slab.h>
 #include <linux/pnp.h>
@@ -58,7 +59,7 @@
 	char phys[32];
 	char name[32];
 };
-	
+
 static LIST_HEAD(ns558_list);
 
 /*
@@ -103,7 +104,7 @@
 		i = 0;
 		goto out;
 	}
-	wait_ms(3);
+	msleep(3);
 /*
  * After some time (4ms) the axes shouldn't change anymore.
  */
@@ -115,7 +116,7 @@
 			i = 0;
 			goto out;
 		}
-/* 
+/*
  * And now find the number of mirrors of the port.
  */
 
@@ -129,7 +130,7 @@
 		outb(0xff, io & (-1 << i));
 		for (j = b = 0; j < 1000; j++)
 			if (inb(io & (-1 << i)) != inb((io & (-1 << i)) + (1 << i) - 1)) b++;
-		wait_ms(3);
+		msleep(3);
 
 		if (b > 300) {					/* We allow 30% difference */
 			release_region(io & (-1 << i), (1 << i));
@@ -291,7 +292,7 @@
 				release_region(port->gameport.io & ~(port->size - 1), port->size);
 				kfree(port);
 				break;
-		
+
 			default:
 				break;
 		}
diff -Nru a/drivers/input/gameport/vortex.c b/drivers/input/gameport/vortex.c
--- a/drivers/input/gameport/vortex.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/input/gameport/vortex.c	Tue Jun 15 22:20:43 2004
@@ -40,6 +40,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
 #include <linux/gameport.h>
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
@@ -82,7 +83,7 @@
 		axes[i] = readw(vortex->io + VORTEX_AXD + i * sizeof(u32));
 		if (axes[i] == 0x1fff) axes[i] = -1;
 	}
-        
+
         return 0;
 }
 
@@ -93,7 +94,7 @@
 	switch (mode) {
 		case GAMEPORT_MODE_COOKED:
 			writeb(0x40, vortex->io + VORTEX_GCR);
-			wait_ms(VORTEX_DATA_WAIT);
+			msleep(VORTEX_DATA_WAIT);
 			return 0;
 		case GAMEPORT_MODE_RAW:
 			writeb(0x00, vortex->io + VORTEX_GCR);
@@ -121,7 +122,7 @@
 
 	vortex->gameport.driver = vortex;
 	vortex->gameport.fuzz = 64;
-	
+
 	vortex->gameport.read = vortex_read;
 	vortex->gameport.trigger = vortex_trigger;
 	vortex->gameport.cooked_read = vortex_cooked_read;
@@ -144,7 +145,7 @@
 	vortex->io = vortex->base + id->driver_data;
 
 	gameport_register_port(&vortex->gameport);
-	
+
 	printk(KERN_INFO "gameport at pci%s speed %d kHz\n",
 		pci_name(dev), vortex->gameport.speed);
 
diff -Nru a/drivers/input/input.c b/drivers/input/input.c
--- a/drivers/input/input.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/input/input.c	Tue Jun 15 22:20:41 2004
@@ -106,7 +106,7 @@
 			}
 
 			break;
-		
+
 		case EV_ABS:
 
 			if (code > ABS_MAX || !test_bit(code, dev->absbit))
@@ -144,27 +144,27 @@
 			if (code > MSC_MAX || !test_bit(code, dev->mscbit))
 				return;
 
-			if (dev->event) dev->event(dev, type, code, value);	
-	
+			if (dev->event) dev->event(dev, type, code, value);
+
 			break;
 
 		case EV_LED:
-	
+
 			if (code > LED_MAX || !test_bit(code, dev->ledbit) || !!test_bit(code, dev->led) == value)
 				return;
 
 			change_bit(code, dev->led);
-			if (dev->event) dev->event(dev, type, code, value);	
-	
+			if (dev->event) dev->event(dev, type, code, value);
+
 			break;
 
 		case EV_SND:
-	
+
 			if (code > SND_MAX || !test_bit(code, dev->sndbit))
 				return;
 
-			if (dev->event) dev->event(dev, type, code, value);	
-	
+			if (dev->event) dev->event(dev, type, code, value);
+
 			break;
 
 		case EV_REP:
@@ -181,7 +181,7 @@
 			break;
 	}
 
-	if (type != EV_SYN) 
+	if (type != EV_SYN)
 		dev->sync = 0;
 
 	if (dev->grab)
@@ -282,11 +282,11 @@
 		if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR)
 			if (id->id.vendor != dev->id.vendor)
 				continue;
-	
+
 		if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT)
 			if (id->id.product != dev->id.product)
 				continue;
-		
+
 		if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION)
 			if (id->id.version != dev->id.version)
 				continue;
@@ -351,11 +351,11 @@
 	}
 	if (in_interrupt()) {
 		printk(KERN_ERR "input.c: calling hotplug from interrupt\n");
-		return; 
+		return;
 	}
 	if (!current->fs->root) {
 		printk(KERN_WARNING "input.c: calling hotplug without valid filesystem\n");
-		return; 
+		return;
 	}
 	if (!(envp = (char **) kmalloc(20 * sizeof(char *), GFP_KERNEL))) {
 		printk(KERN_ERR "input.c: not enough memory allocating hotplug environment\n");
@@ -381,17 +381,17 @@
 
 	envp[i++] = scratch;
 	scratch += sprintf(scratch, "PRODUCT=%x/%x/%x/%x",
-		dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version) + 1; 
-	
+		dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version) + 1;
+
 	if (dev->name) {
 		envp[i++] = scratch;
-		scratch += sprintf(scratch, "NAME=%s", dev->name) + 1; 
+		scratch += sprintf(scratch, "NAME=%s", dev->name) + 1;
 	}
 
 	if (dev->phys) {
 		envp[i++] = scratch;
-		scratch += sprintf(scratch, "PHYS=%s", dev->phys) + 1; 
-	}	
+		scratch += sprintf(scratch, "PHYS=%s", dev->phys) + 1;
+	}
 
 	SPRINTF_BIT_A(evbit, "EV=", EV_MAX);
 	SPRINTF_BIT_A2(keybit, "KEY=", KEY_MAX, EV_KEY);
@@ -506,7 +506,7 @@
 		input_table[handler->minor >> 5] = handler;
 
 	list_add_tail(&handler->node, &input_handler_list);
-	
+
 	list_for_each_entry(dev, &input_dev_list, node)
 		if (!handler->blacklist || !input_match_device(handler->blacklist, dev))
 			if ((id = input_match_device(handler->id_table, dev)))
diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c
--- a/drivers/input/joydev.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/input/joydev.c	Tue Jun 15 22:20:40 2004
@@ -1,12 +1,12 @@
 /*
  * Joystick device driver for the input driver suite.
  *
- * Copyright (c) 1999-2002 Vojtech Pavlik 
- * Copyright (c) 1999 Colin Van Dyke 
+ * Copyright (c) 1999-2002 Vojtech Pavlik
+ * Copyright (c) 1999 Colin Van Dyke
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  */
 
@@ -34,7 +34,7 @@
 MODULE_LICENSE("GPL");
 
 #define JOYDEV_MINOR_BASE	0
-#define JOYDEV_MINORS		16	
+#define JOYDEV_MINORS		16
 #define JOYDEV_BUFFER_SIZE	64
 
 #define MSECS(t)	(1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
@@ -115,7 +115,7 @@
 
 		default:
 			return;
-	}  
+	}
 
 	event.time = MSECS(jiffies);
 
@@ -449,10 +449,10 @@
 	}
 
 	joydev_table[minor] = joydev;
-	
+
 	devfs_mk_cdev(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor),
 			S_IFCHR|S_IRUGO|S_IWUSR, "input/js%d", minor);
-	class_simple_device_add(input_class, 
+	class_simple_device_add(input_class,
 				MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor),
 				dev->dev, "js%d", minor);
 
@@ -466,7 +466,7 @@
 	joydev->exist = 0;
 
 	if (joydev->open)
-		input_close_device(handle);	
+		input_close_device(handle);
 	else
 		joydev_free(joydev);
 }
diff -Nru a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
--- a/drivers/input/joystick/Kconfig	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/joystick/Kconfig	Tue Jun 15 22:20:36 2004
@@ -22,7 +22,7 @@
 	  supports many extensions, including joysticks with throttle control,
 	  with rudders, additional hats and buttons compatible with CH
 	  Flightstick Pro, ThrustMaster FCS, 6 and 8 button gamepads, or
-	  Saitek Cyborg joysticks. 
+	  Saitek Cyborg joysticks.
 
 	  Please read the file <file:Documentation/input/joystick.txt> which
 	  contains more information.
@@ -35,7 +35,7 @@
 	depends on INPUT && INPUT_JOYSTICK && GAMEPORT
 	help
 	  Say Y here if you have an FPGaming or MadCatz controller using the
-	  A3D protocol over the PC gameport. 
+	  A3D protocol over the PC gameport.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called a3d.
@@ -45,7 +45,7 @@
 	depends on INPUT && INPUT_JOYSTICK && GAMEPORT
 	help
 	  Say Y here if you have a Logitech controller using the ADI
-	  protocol over the PC gameport. 
+	  protocol over the PC gameport.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called adi.
@@ -74,7 +74,7 @@
 	depends on INPUT && INPUT_JOYSTICK && GAMEPORT
 	help
 	  Say Y here if you have a Gravis controller using the GrIP protocol
-	  over the PC gameport. 
+	  over the PC gameport.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called grip.
@@ -94,7 +94,7 @@
 	depends on INPUT && INPUT_JOYSTICK && GAMEPORT
 	help
 	  Say Y here if you have a Guillemot joystick using a digital
-	  protocol over the PC gameport. 
+	  protocol over the PC gameport.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called guillemot.
@@ -124,7 +124,7 @@
 	depends on INPUT && INPUT_JOYSTICK && GAMEPORT
 	help
 	  Say Y here if you have a ThrustMaster controller using the
-	  DirectConnect (BSP) protocol over the PC gameport. 
+	  DirectConnect (BSP) protocol over the PC gameport.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called tmdc.
@@ -137,7 +137,7 @@
 	select SERIO
 	help
 	  Say Y here if you have a Logitech WingMan Warrior joystick connected
-	  to your computer's serial port. 
+	  to your computer's serial port.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called warrior.
@@ -253,7 +253,7 @@
 	help
 	  Say Y here if you want to dump data from your joystick into the system
 	  log for debugging purposes. Say N if you are making a production
-	  configuration or aren't sure. 
+	  configuration or aren't sure.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called joydump.
diff -Nru a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c
--- a/drivers/input/joystick/a3d.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/joystick/a3d.c	Tue Jun 15 22:20:36 2004
@@ -39,8 +39,8 @@
 MODULE_DESCRIPTION("FP-Gaming Assasin 3D joystick driver");
 MODULE_LICENSE("GPL");
 
-#define A3D_MAX_START		400	/* 400 us */ 
-#define A3D_MAX_STROBE		60	/* 40 us */ 
+#define A3D_MAX_START		400	/* 400 us */
+#define A3D_MAX_STROBE		60	/* 40 us */
 #define A3D_DELAY_READ		3	/* 3 ms */
 #define A3D_MAX_LENGTH		40	/* 40*3 bits */
 #define A3D_REFRESH_TIME	HZ/50	/* 20 ms */
@@ -125,7 +125,7 @@
 
 			input_report_rel(dev, REL_X, ((data[5] << 6) | (data[6] << 3) | data[ 7]) - ((data[5] & 4) << 7));
 			input_report_rel(dev, REL_Y, ((data[8] << 6) | (data[9] << 3) | data[10]) - ((data[8] & 4) << 7));
-			
+
 			input_report_key(dev, BTN_RIGHT,  data[2] & 1);
 			input_report_key(dev, BTN_LEFT,   data[3] & 2);
 			input_report_key(dev, BTN_MIDDLE, data[3] & 4);
@@ -201,7 +201,7 @@
 	int i;
 	for (i = 0; i < 4; i++)
 		axes[i] = (a3d->axes[i] < 254) ? a3d->axes[i] : -1;
-	*buttons = a3d->buttons; 
+	*buttons = a3d->buttons;
 	return 0;
 }
 
@@ -216,7 +216,7 @@
 	if (mode != GAMEPORT_MODE_COOKED)
 		return -1;
 	if (!a3d->used++)
-		mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME);	
+		mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME);
 	return 0;
 }
 
@@ -239,7 +239,7 @@
 {
 	struct a3d *a3d = dev->private;
 	if (!a3d->used++)
-		mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME);	
+		mod_timer(&a3d->timer, jiffies + A3D_REFRESH_TIME);
 	return 0;
 }
 
@@ -340,7 +340,7 @@
 		a3d->adc.open = a3d_adc_open;
 		a3d->adc.close = a3d_adc_close;
 		a3d->adc.cooked_read = a3d_adc_cooked_read;
-		a3d->adc.fuzz = 1; 
+		a3d->adc.fuzz = 1;
 
 		a3d->adc.name = a3d_names[a3d->mode];
 		a3d->adc.phys = a3d->adcphys;
diff -Nru a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c
--- a/drivers/input/joystick/adi.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/joystick/adi.c	Tue Jun 15 22:20:39 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -72,8 +72,8 @@
  */
 
 static char *adi_names[] = {	"WingMan Extreme Digital", "ThunderPad Digital", "SideCar", "CyberMan 2",
-				"WingMan Interceptor", "WingMan Formula", "WingMan GamePad", 
-				"WingMan Extreme Digital 3D", "WingMan GamePad Extreme", 
+				"WingMan Interceptor", "WingMan Formula", "WingMan GamePad",
+				"WingMan Extreme Digital 3D", "WingMan GamePad Extreme",
 				"WingMan GamePad USB", "Unknown Device %#x" };
 
 static char adi_wmgpe_abs[] =	{ ABS_X, ABS_Y, ABS_HAT0X, ABS_HAT0Y };
@@ -178,7 +178,7 @@
 
 /*
  * adi_move_bits() detects a possible 2-stream mode, and moves
- * the bits accordingly. 
+ * the bits accordingly.
  */
 
 static void adi_move_bits(struct adi_port *port, int length)
@@ -208,7 +208,7 @@
 	int i;
 	if ((adi->idx += count) > adi->ret) return 0;
 	for (i = 0; i < count; i++)
-		bits |= ((adi->data[adi->idx - i] >> 5) & 1) << i; 
+		bits |= ((adi->data[adi->idx - i] >> 5) & 1) << i;
 	return bits;
 }
 
@@ -224,12 +224,12 @@
 	int i, t;
 
 	if (adi->ret < adi->length || adi->id != (adi_get_bits(adi, 4) | (adi_get_bits(adi, 4) << 4)))
-		return -1;	
+		return -1;
 
-	for (i = 0; i < adi->axes10; i++) 
+	for (i = 0; i < adi->axes10; i++)
 		input_report_abs(dev, *abs++, adi_get_bits(adi, 10));
 
-	for (i = 0; i < adi->axes8; i++) 
+	for (i = 0; i < adi->axes8; i++)
 		input_report_abs(dev, *abs++, adi_get_bits(adi, 8));
 
 	for (i = 0; i < adi->buttons && i < 63; i++) {
@@ -249,7 +249,7 @@
 
 	for (i = 63; i < adi->buttons; i++)
 		input_report_key(dev, *key++, adi_get_bits(adi, 1));
-	
+
 	input_sync(dev);
 
 	return 0;
@@ -294,7 +294,7 @@
 {
 	struct adi_port *port = dev->private;
 	if (!port->used++)
-		mod_timer(&port->timer, jiffies + ADI_REFRESH_TIME);	
+		mod_timer(&port->timer, jiffies + ADI_REFRESH_TIME);
 	return 0;
 }
 
@@ -321,7 +321,7 @@
 
 	for (i = 0; seq[i]; i++) {
 		gameport_trigger(gameport);
-		if (seq[i] > 0) wait_ms(seq[i]);
+		if (seq[i] > 0) msleep(seq[i]);
 		if (seq[i] < 0) mdelay(-seq[i]);
 	}
 }
@@ -334,7 +334,7 @@
 		return;
 
 	if (adi->ret < (t = adi_get_bits(adi, 10))) {
-		printk(KERN_WARNING "adi: Short ID packet: reported: %d != read: %d\n", t, adi->ret); 
+		printk(KERN_WARNING "adi: Short ID packet: reported: %d != read: %d\n", t, adi->ret);
 		return;
 	}
 
@@ -498,7 +498,7 @@
 
 	adi_init_digital(gameport);
 	adi_read_packet(port);
-	
+
 	if (port->adi[0].ret >= ADI_MIN_LEN_LENGTH)
 		adi_move_bits(port, adi_get_bits(port->adi, 10));
 
@@ -513,9 +513,9 @@
 		return;
 	}
 
-	wait_ms(ADI_INIT_DELAY);
+	msleep(ADI_INIT_DELAY);
 	if (adi_read(port)) {
-		wait_ms(ADI_DATA_DELAY);
+		msleep(ADI_DATA_DELAY);
 		adi_read(port);
 	}
 
diff -Nru a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
--- a/drivers/input/joystick/amijoy.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/input/joystick/amijoy.c	Tue Jun 15 22:20:42 2004
@@ -46,7 +46,7 @@
 MODULE_LICENSE("GPL");
 
 static int amijoy[2] = { 0, 1 };
-static int amijoy_nargs;  
+static int amijoy_nargs;
 module_param_array_named(map, amijoy, uint, amijoy_nargs, 0);
 MODULE_PARM_DESC(map, "Map of attached joysticks in form of <a>,<b> (default is 0,1)");
 
diff -Nru a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
--- a/drivers/input/joystick/analog.c	Tue Jun 15 22:20:59 2004
+++ b/drivers/input/joystick/analog.c	Tue Jun 15 22:20:59 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -142,7 +142,7 @@
 
 #ifdef __i386__
 #define GET_TIME(x)	do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
-#define DELTA(x,y)	(cpu_has_tsc?((y)-(x)):((x)-(y)+((x)<(y)?1193182L/HZ:0)))
+#define DELTA(x,y)	(cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0)))
 #define TIME_NAME	(cpu_has_tsc?"TSC":"PIT")
 static unsigned int get_time_pit(void)
 {
@@ -237,7 +237,7 @@
 
 	loopout = (ANALOG_LOOP_TIME * port->loop) / 1000;
 	timeout = ANALOG_MAX_TIME * port->speed;
-	
+
 	local_irq_save(flags);
 	gameport_trigger(gameport);
 	GET_TIME(now);
@@ -284,7 +284,7 @@
 
 	u = gameport_read(port->gameport);
 
-	if (!chf) { 
+	if (!chf) {
 		port->buttons = (~u >> 4) & 0xf;
 		return 0;
 	}
@@ -333,7 +333,7 @@
 		}
 	}
 
-	for (i = 0; i < 2; i++) 
+	for (i = 0; i < 2; i++)
 		if (port->analog[i].mask)
 			analog_decode(port->analog + i, port->axes, port->initial, port->buttons);
 
@@ -348,7 +348,7 @@
 {
 	struct analog_port *port = dev->private;
 	if (!port->used++)
-		mod_timer(&port->timer, jiffies + ANALOG_REFRESH_TIME);	
+		mod_timer(&port->timer, jiffies + ANALOG_REFRESH_TIME);
 	return 0;
 }
 
@@ -408,7 +408,7 @@
 
 static void analog_name(struct analog *analog)
 {
-	sprintf(analog->name, "Analog %d-axis %d-button", 
+	sprintf(analog->name, "Analog %d-axis %d-button",
 		hweight8(analog->mask & ANALOG_AXES_STD),
 		hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 +
 		hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4);
@@ -450,10 +450,10 @@
 	analog->dev.close = analog_close;
 	analog->dev.private = port;
 	analog->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
-	
+
 	for (i = j = 0; i < 4; i++)
 		if (analog->mask & (1 << i)) {
-			
+
 			t = analog_axes[j];
 			x = port->axes[i];
 			y = (port->axes[0] + port->axes[1]) >> 1;
@@ -481,8 +481,8 @@
 			j++;
 		}
 
-	for (i = j = 0; i < 3; i++) 
-		if (analog->mask & analog_exts[i]) 
+	for (i = j = 0; i < 3; i++)
+		if (analog->mask & analog_exts[i])
 			for (x = 0; x < 2; x++) {
 				t = analog_hats[j++];
 				set_bit(t, analog->dev.absbit);
@@ -517,7 +517,7 @@
 	else
 		printk(" [%s timer, %d %sHz clock, %d ns res]\n", TIME_NAME,
 		port->speed > 10000 ? (port->speed + 800) / 1000 : port->speed,
-		port->speed > 10000 ? "M" : "k", 
+		port->speed > 10000 ? "M" : "k",
 		port->speed > 10000 ? (port->loop * 1000) / (port->speed / 1000)
 				    : (port->loop * 1000000) / port->speed);
 }
@@ -580,11 +580,11 @@
 
 		gameport_calibrate(port->gameport, port->axes, max);
 	}
-		
-	for (i = 0; i < 4; i++) 
+
+	for (i = 0; i < 4; i++)
 		port->initial[i] = port->axes[i];
 
-	return -!(analog[0].mask || analog[1].mask);	
+	return -!(analog[0].mask || analog[1].mask);
 }
 
 static int analog_init_port(struct gameport *gameport, struct gameport_dev *dev, struct analog_port *port)
@@ -603,25 +603,25 @@
 
 		gameport_trigger(gameport);
 		t = gameport_read(gameport);
-		wait_ms(ANALOG_MAX_TIME);
+		msleep(ANALOG_MAX_TIME);
 		port->mask = (gameport_read(gameport) ^ t) & t & 0xf;
 		port->fuzz = (port->speed * ANALOG_FUZZ_MAGIC) / port->loop / 1000 + ANALOG_FUZZ_BITS;
-	
+
 		for (i = 0; i < ANALOG_INIT_RETRIES; i++) {
 			if (!analog_cooked_read(port)) break;
-			wait_ms(ANALOG_MAX_TIME);
+			msleep(ANALOG_MAX_TIME);
 		}
 
 		u = v = 0;
 
-		wait_ms(ANALOG_MAX_TIME);
+		msleep(ANALOG_MAX_TIME);
 		t = gameport_time(gameport, ANALOG_MAX_TIME * 1000);
 		gameport_trigger(gameport);
-		while ((gameport_read(port->gameport) & port->mask) && (u < t)) u++; 
+		while ((gameport_read(port->gameport) & port->mask) && (u < t)) u++;
 		udelay(ANALOG_SAITEK_DELAY);
 		t = gameport_time(gameport, ANALOG_SAITEK_TIME);
 		gameport_trigger(gameport);
-		while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++; 
+		while ((gameport_read(port->gameport) & port->mask) && (v < t)) v++;
 
 		if (v < (u >> 1)) { /* FIXME - more than one port */
 			analog_options[0] |= /* FIXME - more than one port */
@@ -721,7 +721,7 @@
 			if (!strcmp(analog_types[j].name, js[i])) {
 				analog_options[i] = analog_types[j].value;
 				break;
-			} 
+			}
 		if (analog_types[j].name) continue;
 
 		analog_options[i] = simple_strtoul(js[i], &end, 0);
diff -Nru a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c
--- a/drivers/input/joystick/cobra.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/input/joystick/cobra.c	Tue Jun 15 22:20:40 2004
@@ -72,7 +72,7 @@
 		r[i] = buf[i] = 0;
 		t[i] = COBRA_MAX_STROBE;
 	}
-	
+
 	local_irq_save(flags);
 
 	u = gameport_read(gameport);
@@ -140,14 +140,14 @@
 
 		}
 
-	mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME);	
+	mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME);
 }
 
 static int cobra_open(struct input_dev *dev)
 {
 	struct cobra *cobra = dev->private;
 	if (!cobra->used++)
-		mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME);	
+		mod_timer(&cobra->timer, jiffies + COBRA_REFRESH_TIME);
 	return 0;
 }
 
@@ -180,7 +180,7 @@
 
 	cobra->exists = cobra_read_packet(gameport, data);
 
-	for (i = 0; i < 2; i++) 
+	for (i = 0; i < 2; i++)
 		if ((cobra->exists >> i) & data[i] & 1) {
 			printk(KERN_WARNING "cobra.c: Device %d on %s has the Ext bit set. ID is: %d"
 				" Contact vojtech@ucw.cz\n", i, gameport->phys, (data[i] >> 2) & 7);
@@ -205,7 +205,7 @@
 			cobra->dev[i].id.vendor = GAMEPORT_ID_VENDOR_CREATIVE;
 			cobra->dev[i].id.product = 0x0008;
 			cobra->dev[i].id.version = 0x0100;
-		
+
 			cobra->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 			cobra->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
 
diff -Nru a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
--- a/drivers/input/joystick/db9.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/input/joystick/db9.c	Tue Jun 15 22:20:38 2004
@@ -14,14 +14,14 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -95,7 +95,7 @@
 struct db9 {
 	struct input_dev dev[DB9_MAX_DEVICES];
 	struct timer_list timer;
-	struct pardevice *pd;	
+	struct pardevice *pd;
 	int mode;
 	int used;
 	char phys[2][32];
@@ -188,7 +188,7 @@
 }
 
 /*
- * db9_saturn_read_packet() reads whole saturn packet at connector 
+ * db9_saturn_read_packet() reads whole saturn packet at connector
  * and returns device identifier code.
  */
 static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char *data, int type, int powered)
@@ -481,16 +481,16 @@
 			input_report_abs(dev, ABS_X, (data & DB9_RIGHT ? 0 : 1) - (data & DB9_LEFT ? 0 : 1));
 			input_report_abs(dev, ABS_Y, (data & DB9_DOWN  ? 0 : 1) - (data & DB9_UP   ? 0 : 1));
 
-			parport_write_control(port, 0x0a); 
+			parport_write_control(port, 0x0a);
 
-			for (i = 0; i < 7; i++) { 
+			for (i = 0; i < 7; i++) {
 				data = parport_read_data(port);
-				parport_write_control(port, 0x02); 
-				parport_write_control(port, 0x0a); 
+				parport_write_control(port, 0x02);
+				parport_write_control(port, 0x0a);
 				input_report_key(dev, db9_cd32_btn[i], ~data & DB9_FIRE2);
 				}
 
-			parport_write_control(port, 0x00); 
+			parport_write_control(port, 0x00);
 			break;
 		}
 
@@ -600,7 +600,7 @@
 
 		db9->dev[i].evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 		for (j = 0; j < db9_buttons[db9->mode]; j++)
-			set_bit(db9_btn[db9->mode][j], db9->dev[i].keybit); 
+			set_bit(db9_btn[db9->mode][j], db9->dev[i].keybit);
 		for (j = 0; j < db9_num_axis[db9->mode]; j++) {
 			set_bit(db9_abs[j], db9->dev[i].absbit);
 			if (j < 2) {
@@ -635,7 +635,7 @@
 {
 	int i, j;
 
-	for (i = 0; i < 3; i++) 
+	for (i = 0; i < 3; i++)
 		if (db9_base[i]) {
 			for (j = 0; j < min(db9_max_pads[db9_base[i]->mode], DB9_MAX_DEVICES); j++)
 				input_unregister_device(db9_base[i]->dev + j);
diff -Nru a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
--- a/drivers/input/joystick/gamecon.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/input/joystick/gamecon.c	Tue Jun 15 22:21:05 2004
@@ -15,14 +15,14 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -70,13 +70,13 @@
 #define GC_NES4		3
 #define GC_MULTI	4
 #define GC_MULTI2	5
-#define GC_N64		6	
+#define GC_N64		6
 #define GC_PSX		7
 
 #define GC_MAX		7
 
 #define GC_REFRESH_TIME	HZ/100
- 
+
 struct gc {
 	struct pardevice *pd;
 	struct input_dev dev[5];
@@ -104,7 +104,7 @@
 #define GC_N64_DELAY		133		/* delay between transmit request, and response ready (us) */
 #define GC_N64_REQUEST		0x1dd1111111ULL /* the request data command (encoded for 000000011) */
 #define GC_N64_DWS		3		/* delay between write segments (required for sound playback because of ISA DMA) */
-						/* GC_N64_DWS > 24 is known to fail */ 
+						/* GC_N64_DWS > 24 is known to fail */
 #define GC_N64_POWER_W		0xe2		/* power during write (transmit request) */
 #define GC_N64_POWER_R		0xfd		/* power during read */
 #define GC_N64_OUT		0x1d		/* output bits to the 4 pads */
@@ -113,8 +113,8 @@
 						/* than 123 us */
 #define GC_N64_CLOCK		0x02		/* clock bits for read */
 
-/* 
- * gc_n64_read_packet() reads an N64 packet. 
+/*
+ * gc_n64_read_packet() reads an N64 packet.
  * Each pad uses one bit per byte. So all pads connected to this port are read in parallel.
  */
 
@@ -224,7 +224,7 @@
  *	http://www.dim.com/~mackys/psxmemcard/ps-eng2.txt
  *	http://www.gamesx.com/controldata/psxcont/psxcont.htm
  *	ftp://milano.usal.es/pablo/
- *	
+ *
  */
 
 #define GC_PSX_DELAY	25		/* 25 usec */
@@ -331,13 +331,13 @@
 			s = gc_status_bit[i];
 
 			if (s & gc->pads[GC_N64] & ~(data[8] | data[9])) {
-	
+
 				signed char axes[2];
 				axes[0] = axes[1] = 0;
 
 				for (j = 0; j < 8; j++) {
-					if (data[23 - j] & s) axes[0] |= 1 << j; 
-					if (data[31 - j] & s) axes[1] |= 1 << j; 
+					if (data[23 - j] & s) axes[0] |= 1 << j;
+					if (data[31 - j] & s) axes[1] |= 1 << j;
 				}
 
 				input_report_abs(dev + i, ABS_X,  axes[0]);
@@ -588,7 +588,7 @@
 				break;
 
 			case GC_PSX:
-				
+
 				psx = gc_psx_read_packet(gc, data);
 
 				switch(psx) {
@@ -629,7 +629,7 @@
 		}
 
 		sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i);
-		
+
                 gc->dev[i].name = gc_names[config[i + 1]];
 		gc->dev[i].phys = gc->phys[i];
                 gc->dev[i].id.bustype = BUS_PARPORT;
@@ -646,7 +646,7 @@
 		return NULL;
 	}
 
-	for (i = 0; i < 5; i++) 
+	for (i = 0; i < 5; i++)
 		if (gc->pads[0] & gc_status_bit[i]) {
 			input_register_device(gc->dev + i);
 			printk(KERN_INFO "input: %s on %s\n", gc->dev[i].name, gc->pd->port->name);
@@ -675,7 +675,7 @@
 		if (gc_base[i]) {
 			for (j = 0; j < 5; j++)
 				if (gc_base[i]->pads[0] & gc_status_bit[j])
-					input_unregister_device(gc_base[i]->dev + j); 
+					input_unregister_device(gc_base[i]->dev + j);
 			parport_unregister_device(gc_base[i]->pd);
 		}
 }
diff -Nru a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c
--- a/drivers/input/joystick/gf2k.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/input/joystick/gf2k.c	Tue Jun 15 22:20:42 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -223,7 +223,7 @@
 {
 	struct gf2k *gf2k = dev->private;
 	if (!gf2k->used++)
-		mod_timer(&gf2k->timer, jiffies + GF2K_REFRESH);	
+		mod_timer(&gf2k->timer, jiffies + GF2K_REFRESH);
 	return 0;
 }
 
@@ -260,11 +260,11 @@
 
 	gf2k_trigger_seq(gameport, gf2k_seq_reset);
 
-	wait_ms(GF2K_TIMEOUT);
+	msleep(GF2K_TIMEOUT);
 
 	gf2k_trigger_seq(gameport, gf2k_seq_digital);
 
-	wait_ms(GF2K_TIMEOUT);
+	msleep(GF2K_TIMEOUT);
 
 	if (gf2k_read_packet(gameport, GF2K_LENGTH, data) < 12)
 		goto fail2;
@@ -324,7 +324,7 @@
 
 	for (i = 0; i < gf2k_axes[gf2k->id]; i++) {
 		gf2k->dev.absmax[gf2k_abs[i]] = (i < 2) ? gf2k->dev.abs[gf2k_abs[i]] * 2 - 32 :
-	      		  gf2k->dev.abs[gf2k_abs[0]] + gf2k->dev.abs[gf2k_abs[1]] - 32; 
+	      		  gf2k->dev.abs[gf2k_abs[0]] + gf2k->dev.abs[gf2k_abs[1]] - 32;
 		gf2k->dev.absmin[gf2k_abs[i]] = 32;
 		gf2k->dev.absfuzz[gf2k_abs[i]] = 8;
 		gf2k->dev.absflat[gf2k_abs[i]] = (i < 2) ? 24 : 0;
diff -Nru a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c
--- a/drivers/input/joystick/grip.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/joystick/grip.c	Tue Jun 15 22:20:39 2004
@@ -48,8 +48,8 @@
 #define GRIP_STROBE_GPP		200	/* 200 us */
 #define GRIP_LENGTH_XT		4
 #define GRIP_STROBE_XT		64	/* 64 us */
-#define GRIP_MAX_CHUNKS_XT	10	
-#define GRIP_MAX_BITS_XT	30	
+#define GRIP_MAX_CHUNKS_XT	10
+#define GRIP_MAX_BITS_XT	30
 
 #define GRIP_REFRESH_TIME	HZ/50	/* 20 ms */
 
@@ -153,7 +153,7 @@
 				buf = (buf << 1) | (u >> 1);
 				t = strobe;
 				i++;
-			} else 
+			} else
 
 			if ((((u ^ v) & (v ^ w)) >> 1) & ~(u | v | w) & 1) {
 				if (i == 20) {
diff -Nru a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c
--- a/drivers/input/joystick/grip_mp.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/input/joystick/grip_mp.c	Tue Jun 15 22:21:02 2004
@@ -69,7 +69,7 @@
 #define IO_MODE_FAST         0x0200           /* Used 3 data bits per gameport read     */
 #define IO_SLOT_CHANGE       0x0800           /* Multiport physical slot status changed */
 #define IO_DONE              0x1000           /* Multiport is done sending packets      */
-#define IO_RETRY             0x4000           /* Try again later to get packet          */ 
+#define IO_RETRY             0x4000           /* Try again later to get packet          */
 #define IO_RESET             0x8000           /* Force multiport to resend all packets  */
 
 /*
@@ -144,8 +144,8 @@
 /*
  * Gets a 28-bit packet from the multiport.
  *
- * After getting a packet successfully, commands encoded by sendcode may 
- * be sent to the multiport.  
+ * After getting a packet successfully, commands encoded by sendcode may
+ * be sent to the multiport.
  *
  * The multiport clock value is reflected in gameport bit B4.
  *
@@ -169,7 +169,7 @@
 
 	*packet = 0;
 	raw_data = gameport_read(gameport);
-	if (raw_data & 1)                          
+	if (raw_data & 1)
  		return IO_RETRY;
 
 	for (i = 0; i < 64; i++) {
@@ -183,11 +183,11 @@
 
 		if (raw_data & 0x31)
 			return IO_RESET;
-		gameport_trigger(gameport); 
+		gameport_trigger(gameport);
 
 		if (!poll_until(0x10, 0, 308, gameport, &raw_data))
 			return IO_RESET;
-	} else 
+	} else
 		return IO_RETRY;
 
 	/* Determine packet transfer mode and prepare for packet construction. */
@@ -195,7 +195,7 @@
 	if (raw_data & 0x20) {                 /* 3 data bits/read */
 		portvals |= raw_data >> 4;     /* Compare B4-B7 before & after trigger */
 
-		if (portvals != 0xb)           
+		if (portvals != 0xb)
 			return 0;
 		data_mask = 7;
 		bits_per_read = 3;
@@ -221,7 +221,7 @@
 			return IO_RESET;
 	}
 
-	if (raw_data)                            
+	if (raw_data)
 		return IO_RESET;
 
 	/* If 3 bits/read used, drop from 30 bits to 28. */
@@ -231,7 +231,7 @@
 		pkt = (pkt >> 2) | 0xf0000000;
 	}
 
-	if (bit_parity(pkt) == 1) 
+	if (bit_parity(pkt) == 1)
 		return IO_RESET;
 
 	/* Acknowledge packet receipt */
@@ -251,10 +251,10 @@
 
         /* Return if we just wanted the packet or multiport wants to send more */
 
-	*packet = pkt;	                             
+	*packet = pkt;
 	if ((sendflags == 0) || ((sendflags & IO_RETRY) && !(pkt & PACKET_MP_DONE)))
 		return IO_GOT_PACKET;
-	
+
 	if (pkt & PACKET_MP_MORE)
 		return IO_GOT_PACKET | IO_RETRY;
 
@@ -277,7 +277,7 @@
 		if (!poll_until(0x30, 0, 193, gameport, &raw_data))
 			return IO_GOT_PACKET | IO_RESET;
 
-		if (raw_data & 1)   
+		if (raw_data & 1)
 			return IO_GOT_PACKET | IO_RESET;
 
 		if (sendcode & 1)
@@ -429,19 +429,19 @@
 			strange_code = joytype;
 		}
 	}
-	return flags;  
+	return flags;
 }
 
 /*
  * Returns true if all multiport slot states appear valid.
  */
- 
+
 static int slots_valid(struct grip_mp *grip)
 {
 	int flags, slot, invalid = 0, active = 0;
 
 	flags = get_and_decode_packet(grip, 0);
-	if (!(flags & IO_GOT_PACKET))          
+	if (!(flags & IO_GOT_PACKET))
 		return 0;
 
 	for (slot = 0; slot < 4; slot++) {
@@ -463,7 +463,7 @@
  * Returns whether the multiport was placed into digital mode and
  * able to communicate its state successfully.
  */
- 
+
 static int multiport_init(struct grip_mp *grip)
 {
 	int dig_mode, initialized = 0, tries = 0;
@@ -481,7 +481,7 @@
 		dbg("multiport_init(): unable to achieve digital mode.\n");
 		return 0;
 	}
-	
+
 	/* Get packets, store multiport state, and check state's validity */
 	for (tries = 0; tries < 4096; tries++) {
 		if ( slots_valid(grip) ) {
@@ -520,9 +520,9 @@
 }
 
 /*
- * Get the multiport state.  
+ * Get the multiport state.
  */
- 
+
 static void get_and_report_mp_state(struct grip_mp *grip)
 {
 	int i, npkts, flags;
@@ -538,7 +538,7 @@
 			break;
 	}
 
-	for (i = 0; i < 4; i++)      
+	for (i = 0; i < 4; i++)
 		if (grip->dirty[i])
 			report_slot(grip, i);
 }
@@ -546,7 +546,7 @@
 /*
  * Called when a joystick device file is opened
  */
- 
+
 static int grip_open(struct input_dev *dev)
 {
 	struct grip_mp *grip = dev->private;
@@ -607,7 +607,7 @@
 /*
  * Repeatedly polls the multiport and generates events.
  */
- 
+
 static void grip_timer(unsigned long private)
 {
 	struct grip_mp *grip = (void*) private;
diff -Nru a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c
--- a/drivers/input/joystick/guillemot.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/input/joystick/guillemot.c	Tue Jun 15 22:20:38 2004
@@ -45,7 +45,7 @@
 #define GUILLEMOT_MAX_LENGTH	17	/* 17 bytes */
 #define GUILLEMOT_REFRESH_TIME	HZ/50	/* 20 ms */
 
-static short guillemot_abs_pad[] = 
+static short guillemot_abs_pad[] =
 	{ ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, -1 };
 
 static short guillemot_btn_pad[] =
@@ -160,7 +160,7 @@
 {
 	struct guillemot *guillemot = dev->private;
 	if (!guillemot->used++)
-		mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME);	
+		mod_timer(&guillemot->timer, jiffies + GUILLEMOT_REFRESH_TIME);
 	return 0;
 }
 
@@ -211,7 +211,7 @@
 	if (!guillemot_type[i].name) {
 		printk(KERN_WARNING "guillemot.c: Unknown joystick on %s. [ %02x%02x:%04x, ver %d.%02d ]\n",
 			gameport->phys, data[12], data[13], data[11], data[14], data[15]);
-		goto fail2;	
+		goto fail2;
 	}
 
 	sprintf(guillemot->phys, "%s/input0", gameport->phys);
@@ -237,7 +237,7 @@
 		guillemot->dev.absmax[t] = 255;
 	}
 
-	if (guillemot->type->hat) 
+	if (guillemot->type->hat)
 		for (i = 0; i < 2; i++) {
 			t = ABS_HAT0X + i;
 			set_bit(t, guillemot->dev.absbit);
diff -Nru a/drivers/input/joystick/iforce/Kconfig b/drivers/input/joystick/iforce/Kconfig
--- a/drivers/input/joystick/iforce/Kconfig	Tue Jun 15 22:20:38 2004
+++ b/drivers/input/joystick/iforce/Kconfig	Tue Jun 15 22:20:38 2004
@@ -17,7 +17,7 @@
 	depends on JOYSTICK_IFORCE && (JOYSTICK_IFORCE=m || USB=y) && USB
 	help
 	  Say Y here if you have an I-Force joystick or steering wheel
-	  connected to your USB port. 
+	  connected to your USB port.
 
 config JOYSTICK_IFORCE_232
 	bool "I-Force Serial joysticks and wheels"
diff -Nru a/drivers/input/joystick/iforce/Makefile b/drivers/input/joystick/iforce/Makefile
--- a/drivers/input/joystick/iforce/Makefile	Tue Jun 15 22:21:04 2004
+++ b/drivers/input/joystick/iforce/Makefile	Tue Jun 15 22:21:04 2004
@@ -7,14 +7,14 @@
 # Goal definition
 iforce-objs	:= iforce-ff.o iforce-main.o iforce-packets.o
 
-obj-$(CONFIG_JOYSTICK_IFORCE)	+= iforce.o 
+obj-$(CONFIG_JOYSTICK_IFORCE)	+= iforce.o
 
 ifeq ($(CONFIG_JOYSTICK_IFORCE_232),y)
-	iforce-objs += iforce-serio.o 
+	iforce-objs += iforce-serio.o
 endif
 
 ifeq ($(CONFIG_JOYSTICK_IFORCE_USB),y)
-	iforce-objs += iforce-usb.o 
+	iforce-objs += iforce-usb.o
 endif
 
 EXTRA_CFLAGS = -Werror-implicit-function-declaration
diff -Nru a/drivers/input/joystick/iforce/iforce-ff.c b/drivers/input/joystick/iforce/iforce-ff.c
--- a/drivers/input/joystick/iforce/iforce-ff.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/joystick/iforce/iforce-ff.c	Tue Jun 15 22:20:36 2004
@@ -195,7 +195,7 @@
 }
 
 /*
- * Analyse the changes in an effect, and tell if we need to send an condition 
+ * Analyse the changes in an effect, and tell if we need to send an condition
  * parameter packet
  */
 static int need_condition_modifier(struct iforce* iforce, struct ff_effect* new)
@@ -372,7 +372,7 @@
 	int core_err = 0;
 
 	if (!is_update || need_period_modifier(iforce, effect)) {
-		param1_err = make_period_modifier(iforce, mod1_chunk, 
+		param1_err = make_period_modifier(iforce, mod1_chunk,
 			is_update,
 			effect->u.periodic.magnitude, effect->u.periodic.offset,
 			effect->u.periodic.period, effect->u.periodic.phase);
diff -Nru a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
--- a/drivers/input/joystick/iforce/iforce-main.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/joystick/iforce/iforce-main.c	Tue Jun 15 22:20:39 2004
@@ -166,7 +166,7 @@
 	else {
 		/* We want to update an effect */
 		if (!CHECK_OWNERSHIP(effect->id, iforce)) return -EACCES;
-		
+
 		/* Parameter type cannot be updated */
 		if (effect->type != iforce->core_effects[effect->id].effect.type)
 			return -EINVAL;
@@ -273,7 +273,7 @@
 
 		if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags) &&
 			current->pid == iforce->core_effects[i].owner) {
-			
+
 			/* Stop effect */
 			input_report_ff(dev, i, 0);
 
diff -Nru a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c
--- a/drivers/input/joystick/iforce/iforce-packets.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/input/joystick/iforce/iforce-packets.c	Tue Jun 15 22:20:41 2004
@@ -56,7 +56,7 @@
 	int empty;
 	int head, tail;
 	unsigned long flags;
-			
+
 /*
  * Update head and tail of xmit buffer
  */
@@ -108,7 +108,7 @@
 		break;
 #endif
 #ifdef CONFIG_JOYSTICK_IFORCE_USB
-		case IFORCE_USB: 
+		case IFORCE_USB:
 
 		if (iforce->usbdev && empty &&
 			!test_and_set_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)) {
diff -Nru a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c
--- a/drivers/input/joystick/iforce/iforce-serio.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/joystick/iforce/iforce-serio.c	Tue Jun 15 22:20:36 2004
@@ -62,7 +62,7 @@
 		cs ^= iforce->xmit.buf[iforce->xmit.tail];
 		XMIT_INC(iforce->xmit.tail, 1);
 	}
-	
+
 	serio_write(iforce->serio, cs);
 
 	if (test_and_clear_bit(IFORCE_XMIT_AGAIN, iforce->xmit_flags))
diff -Nru a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h
--- a/drivers/input/joystick/iforce/iforce.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/joystick/iforce/iforce.h	Tue Jun 15 22:20:39 2004
@@ -141,7 +141,7 @@
 	struct circ_buf xmit;
 	unsigned char xmit_data[XMIT_SIZE];
 	long xmit_flags[1];
-	
+
 					/* Force Feedback */
 	wait_queue_head_t wait;
 	struct resource device_memory;
diff -Nru a/drivers/input/joystick/interact.c b/drivers/input/joystick/interact.c
--- a/drivers/input/joystick/interact.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/input/joystick/interact.c	Tue Jun 15 22:20:42 2004
@@ -63,7 +63,7 @@
 	char phys[32];
 };
 
-static short interact_abs_hhfx[] = 
+static short interact_abs_hhfx[] =
 	{ ABS_RX, ABS_RY, ABS_X, ABS_Y, ABS_HAT0X, ABS_HAT0Y, -1 };
 static short interact_abs_pp8d[] =
 	{ ABS_X, ABS_Y, -1 };
@@ -166,7 +166,7 @@
 			case INTERACT_TYPE_PP8D:
 
 				for (i = 0; i < 2; i++)
-					input_report_abs(dev, interact_abs_pp8d[i], 
+					input_report_abs(dev, interact_abs_pp8d[i],
 						((data[0] >> ((i << 1) + 20)) & 1)  - ((data[0] >> ((i << 1) + 21)) & 1));
 
 				for (i = 0; i < 8; i++)
@@ -190,7 +190,7 @@
 {
 	struct interact *interact = dev->private;
 	if (!interact->used++)
-		mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME);	
+		mod_timer(&interact->timer, jiffies + INTERACT_REFRESH_TIME);
 	return 0;
 }
 
@@ -242,7 +242,7 @@
 	if (!interact_type[i].length) {
 		printk(KERN_WARNING "interact.c: Unknown joystick on %s. [len %d d0 %08x d1 %08x i2 %08x]\n",
 			gameport->phys, i, data[0], data[1], data[2]);
-		goto fail2;	
+		goto fail2;
 	}
 
 	sprintf(interact->phys, "%s/input0", gameport->phys);
diff -Nru a/drivers/input/joystick/joydump.c b/drivers/input/joystick/joydump.c
--- a/drivers/input/joystick/joydump.c	Tue Jun 15 22:20:59 2004
+++ b/drivers/input/joystick/joydump.c	Tue Jun 15 22:20:59 2004
@@ -12,18 +12,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -63,7 +63,7 @@
 		printk(KERN_INFO "joydump: | Raw mode not available - trying cooked.    |\n");
 
 		if (gameport_open(gameport, dev, GAMEPORT_MODE_COOKED)) {
-			
+
 			printk(KERN_INFO "joydump: | Cooked not available either. Failing.      |\n");
 			printk(KERN_INFO "joydump: `-------------------- END -------------------'\n");
 			return;
diff -Nru a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
--- a/drivers/input/joystick/magellan.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/joystick/magellan.c	Tue Jun 15 22:20:36 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  *  Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -159,7 +159,7 @@
 
 	memset(magellan, 0, sizeof(struct magellan));
 
-	magellan->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);	
+	magellan->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 
 	for (i = 0; i < 9; i++)
 		set_bit(magellan_buttons[i], magellan->dev.keybit);
@@ -181,7 +181,7 @@
 	magellan->dev.id.vendor = SERIO_MAGELLAN;
 	magellan->dev.id.product = 0x0001;
 	magellan->dev.id.version = 0x0100;
-	
+
 	serio->private = magellan;
 
 	if (serio_open(serio, dev)) {
diff -Nru a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
--- a/drivers/input/joystick/sidewinder.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/input/joystick/sidewinder.c	Tue Jun 15 22:20:44 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -176,19 +176,19 @@
 				buf[i] = v >> 5;		/* Store it */
 			i++;					/* Advance index */
 			bitout = strobe;			/* Extend timeout for next bit */
-		} 
+		}
 
 		if (kick && (~v & u & 0x01)) {			/* Falling edge on axis 0 */
 			sched = kick;				/* Schedule second trigger */
 			kick = 0;				/* Don't schedule next time on falling edge */
 			pending = 1;				/* Mark schedule */
-		} 
+		}
 
 		if (pending && sched < 0 && (i > -SW_END)) {	/* Second trigger time */
 			gameport_trigger(gameport);		/* Trigger */
 			bitout = start;				/* Long bit timeout */
 			pending = 0;				/* Unmark schedule */
-			timeout = 0;				/* Switch from global to bit timeouts */ 
+			timeout = 0;				/* Switch from global to bit timeouts */
 		}
 	}
 
@@ -482,14 +482,14 @@
 	sw_read_packet(sw->gameport, buf, SW_LENGTH, i);			/* Read ID packet, this initializes the stick */
 
 	sw->fail = SW_FAIL;
-	
+
 	return -1;
 }
 
 static void sw_timer(unsigned long private)
 {
 	struct sw *sw = (void *) private;
-	
+
 	sw->reads++;
 	if (sw_read(sw)) sw->bads++;
 	mod_timer(&sw->timer, jiffies + SW_REFRESH);
@@ -653,7 +653,7 @@
 				case 60:
 					sw->number++;
 				case 45:				/* Ambiguous packet length */
-					if (j <= 40) {			/* ID length less or eq 40 -> FSP */	
+					if (j <= 40) {			/* ID length less or eq 40 -> FSP */
 				case 43:
 						sw->type = SW_ID_FSP;
 						break;
diff -Nru a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c
--- a/drivers/input/joystick/spaceball.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/joystick/spaceball.c	Tue Jun 15 22:20:36 2004
@@ -15,18 +15,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  *  Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -59,8 +59,8 @@
 
 static int spaceball_axes[] = { ABS_X, ABS_Z, ABS_Y, ABS_RX, ABS_RZ, ABS_RY };
 static char *spaceball_names[] = {
-	"?", "SpaceTec SpaceBall 1003", "SpaceTec SpaceBall 2003", "SpaceTec SpaceBall 2003B", 
-	"SpaceTec SpaceBall 2003C", "SpaceTec SpaceBall 3003", "SpaceTec SpaceBall SpaceController", 
+	"?", "SpaceTec SpaceBall 1003", "SpaceTec SpaceBall 2003", "SpaceTec SpaceBall 2003B",
+	"SpaceTec SpaceBall 2003C", "SpaceTec SpaceBall 3003", "SpaceTec SpaceBall SpaceController",
 	"SpaceTec SpaceBall 3003C", "SpaceTec SpaceBall 4000FLX", "SpaceTec SpaceBall 4000FLX Lefty" };
 
 /*
@@ -96,7 +96,7 @@
 		case 'D':					/* Ball data */
 			if (spaceball->idx != 15) return;
 			for (i = 0; i < 6; i++)
-				input_report_abs(dev, spaceball_axes[i], 
+				input_report_abs(dev, spaceball_axes[i],
 					(__s16)((data[2 * i + 3] << 8) | data[2 * i + 2]));
 			break;
 
@@ -216,7 +216,7 @@
 		return;
 	memset(spaceball, 0, sizeof(struct spaceball));
 
-	spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);	
+	spaceball->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 
 	switch (id) {
 		case SPACEBALL_4000FLX:
@@ -224,7 +224,7 @@
 			spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_9);
 			spaceball->dev.keybit[LONG(BTN_A)] |= BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_MODE);
 		default:
-			spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) 
+			spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4)
 				| BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7) | BIT(BTN_8);
 		case SPACEBALL_3003C:
 			spaceball->dev.keybit[LONG(BTN_0)] |= BIT(BTN_1) | BIT(BTN_8);
@@ -251,7 +251,7 @@
 	spaceball->dev.id.vendor = SERIO_SPACEBALL;
 	spaceball->dev.id.product = id;
 	spaceball->dev.id.version = 0x0100;
-	
+
 	serio->private = spaceball;
 
 	if (serio_open(serio, dev)) {
diff -Nru a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c
--- a/drivers/input/joystick/spaceorb.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/input/joystick/spaceorb.c	Tue Jun 15 22:20:40 2004
@@ -2,7 +2,7 @@
  * $Id: spaceorb.c,v 1.15 2002/01/22 20:29:19 vojtech Exp $
  *
  *  Copyright (c) 1999-2001 Vojtech Pavlik
- * 
+ *
  *  Based on the work of:
  *  	David Thompson
  */
@@ -14,18 +14,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  *  Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -67,7 +67,7 @@
 static unsigned char spaceorb_xor[] = "SpaceWare";
 
 static unsigned char *spaceorb_errors[] = { "EEPROM storing 0 failed", "Receive queue overflow", "Transmit queue timeout",
-		"Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" }; 
+		"Bad packet", "Power brown-out", "EEPROM checksum error", "Hardware fault" };
 
 /*
  * spaceorb_process_packet() decodes packets the driver receives from the
@@ -99,7 +99,7 @@
 
 		case 'D':				/* Ball + button data */
 			if (spaceorb->idx != 12) return;
-			for (i = 0; i < 9; i++) spaceorb->data[i+2] ^= spaceorb_xor[i]; 
+			for (i = 0; i < 9; i++) spaceorb->data[i+2] ^= spaceorb_xor[i];
 			axes[0] = ( data[2]	 << 3) | (data[ 3] >> 4);
 			axes[1] = ((data[3] & 0x0f) << 6) | (data[ 4] >> 1);
 			axes[2] = ((data[4] & 0x01) << 9) | (data[ 5] << 2) | (data[4] >> 5);
@@ -174,7 +174,7 @@
 		return;
 	memset(spaceorb, 0, sizeof(struct spaceorb));
 
-	spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);	
+	spaceorb->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 
 	for (i = 0; i < 6; i++)
 		set_bit(spaceorb_buttons[i], spaceorb->dev.keybit);
@@ -198,7 +198,7 @@
 	spaceorb->dev.id.vendor = SERIO_SPACEORB;
 	spaceorb->dev.id.product = 0x0001;
 	spaceorb->dev.id.version = 0x0100;
-	
+
 	serio->private = spaceorb;
 
 	if (serio_open(serio, dev)) {
diff -Nru a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c
--- a/drivers/input/joystick/stinger.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/joystick/stinger.c	Tue Jun 15 22:20:36 2004
@@ -147,7 +147,7 @@
 
 	memset(stinger, 0, sizeof(struct stinger));
 
-	stinger->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);	
+	stinger->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 	stinger->dev.keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) | \
 					   BIT(BTN_Y) | BIT(BTN_Z) | BIT(BTN_TL) | BIT(BTN_TR) | \
 					   BIT(BTN_START) | BIT(BTN_SELECT);
@@ -164,8 +164,8 @@
 	stinger->dev.id.version = 0x0100;
 
 	for (i = 0; i < 2; i++) {
-		stinger->dev.absmax[ABS_X+i] =  64;	
-		stinger->dev.absmin[ABS_X+i] = -64;	
+		stinger->dev.absmax[ABS_X+i] =  64;
+		stinger->dev.absmin[ABS_X+i] = -64;
 		stinger->dev.absflat[ABS_X+i] = 4;
 	}
 
diff -Nru a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c
--- a/drivers/input/joystick/tmdc.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/joystick/tmdc.c	Tue Jun 15 22:20:39 2004
@@ -4,7 +4,7 @@
  *  Copyright (c) 1998-2001 Vojtech Pavlik
  *
  *   Based on the work of:
- *	Trystan Larey-Williams 
+ *	Trystan Larey-Williams
  */
 
 /*
@@ -14,18 +14,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -58,7 +58,7 @@
 #define TMDC_BYTE_REV		11
 #define TMDC_BYTE_DEF		12
 
-#define TMDC_ABS		7	
+#define TMDC_ABS		7
 #define TMDC_ABS_HAT		4
 #define TMDC_BTN		16
 
@@ -104,7 +104,7 @@
 	unsigned char btno[2][4];
 	int used;
 	int reads;
-	int bads;	
+	int bads;
 	unsigned char exists;
 };
 
@@ -127,7 +127,7 @@
 
 	local_irq_save(flags);
 	gameport_trigger(gameport);
-	
+
 	w = gameport_read(gameport) >> 4;
 
 	do {
@@ -148,7 +148,7 @@
 				}
 				data[k][i[k]] |= (~v & 1) << (j[k]++ - 1);	/* Data bit */
 			}
-			t[k]--; 
+			t[k]--;
 		}
 	} while (t[0] > 0 || t[1] > 0);
 
@@ -175,7 +175,7 @@
 		bad = 1;
 	else
 
-	for (j = 0; j < 2; j++) 
+	for (j = 0; j < 2; j++)
 		if (r & (1 << j) & tmdc->exists) {
 
 			if (data[j][TMDC_BYTE_ID] != tmdc->mode[j]) {
@@ -227,7 +227,7 @@
 {
 	struct tmdc *tmdc = dev->private;
 	if (!tmdc->used++)
-		mod_timer(&tmdc->timer, jiffies + TMDC_REFRESH_TIME);	
+		mod_timer(&tmdc->timer, jiffies + TMDC_REFRESH_TIME);
 	return 0;
 }
 
@@ -356,7 +356,7 @@
 	struct tmdc *tmdc = gameport->private;
 	int i;
 	for (i = 0; i < 2; i++)
-		if (tmdc->exists & (1 << i)) 
+		if (tmdc->exists & (1 << i))
 			input_unregister_device(tmdc->dev + i);
 	gameport_close(gameport);
 	kfree(tmdc);
diff -Nru a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
--- a/drivers/input/joystick/turbografx.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/input/joystick/turbografx.c	Tue Jun 15 22:20:43 2004
@@ -14,18 +14,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -65,7 +65,7 @@
 
 #define TGFX_TRIGGER		0x08
 #define TGFX_UP			0x10
-#define TGFX_DOWN		0x20	
+#define TGFX_DOWN		0x20
 #define TGFX_LEFT		0x40
 #define TGFX_RIGHT		0x80
 
@@ -126,7 +126,7 @@
         if (!tgfx->used++) {
 		parport_claim(tgfx->pd);
 		parport_write_control(tgfx->pd->port, 0x04);
-                mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); 
+                mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME);
 	}
         return 0;
 }
@@ -173,7 +173,7 @@
 	memset(tgfx, 0, sizeof(struct tgfx));
 
 	tgfx->pd = parport_register_device(pp, "turbografx", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
-		
+
 	parport_put_port(pp);
 
 	if (!tgfx->pd) {
@@ -210,7 +210,7 @@
 			tgfx->dev[i].absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
 
 			for (j = 0; j < config[i+1]; j++)
-				set_bit(tgfx_buttons[j], tgfx->dev[i].keybit); 
+				set_bit(tgfx_buttons[j], tgfx->dev[i].keybit);
 
 			tgfx->dev[i].absmin[ABS_X] = -1; tgfx->dev[i].absmax[ABS_X] = 1;
 			tgfx->dev[i].absmin[ABS_Y] = -1; tgfx->dev[i].absmax[ABS_Y] = 1;
@@ -225,7 +225,7 @@
 		kfree(tgfx);
 		return NULL;
         }
-		
+
 	return tgfx;
 }
 
@@ -245,7 +245,7 @@
 {
 	int i, j;
 
-	for (i = 0; i < 3; i++) 
+	for (i = 0; i < 3; i++)
 		if (tgfx_base[i]) {
 			for (j = 0; j < 7; j++)
 				if (tgfx_base[i]->sticks & (1 << j))
diff -Nru a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c
--- a/drivers/input/joystick/twidjoy.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/joystick/twidjoy.c	Tue Jun 15 22:20:36 2004
@@ -58,6 +58,9 @@
 #include <linux/serio.h>
 #include <linux/init.h>
 
+MODULE_DESCRIPTION("Handykey Twiddler keyboard as a joystick driver");
+MODULE_LICENSE("GPL");
+
 /*
  * Constants.
  */
@@ -142,7 +145,7 @@
  * packet processing routine.
  */
 
-static void twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struc pt_regs *regs)
+static irqreturn_t twidjoy_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
 {
 	struct twidjoy *twidjoy = serio->private;
 
@@ -153,7 +156,7 @@
 	if ((data & 0x80) == 0)
 		twidjoy->idx = 0;	/* this byte starts a new packet */
 	else if (twidjoy->idx == 0)
-		return;			/* wrong MSB -- ignore this byte */
+		return IRQ_HANDLED;	/* wrong MSB -- ignore this byte */
 
 	if (twidjoy->idx < TWIDJOY_MAX_LENGTH)
 		twidjoy->data[twidjoy->idx++] = data;
@@ -163,7 +166,7 @@
 		twidjoy->idx = 0;
 	}
 
-	return;
+	return IRQ_HANDLED;
 }
 
 /*
@@ -208,7 +211,7 @@
 	twidjoy->dev.id.product = 0x0001;
 	twidjoy->dev.id.version = 0x0100;
 
-	twidjoy->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);	
+	twidjoy->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 
 	for (bp = twidjoy_buttons; bp->bitmask; bp++) {
 		for (i = 0; i < bp->bitmask; i++)
@@ -218,8 +221,8 @@
 	twidjoy->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
 
 	for (i = 0; i < 2; i++) {
-		twidjoy->dev.absmax[ABS_X+i] =  50;	
-		twidjoy->dev.absmin[ABS_X+i] = -50;	
+		twidjoy->dev.absmax[ABS_X+i] =  50;
+		twidjoy->dev.absmin[ABS_X+i] = -50;
 
 		/* TODO: arndt 20010708: Are these values appropriate? */
 		twidjoy->dev.absfuzz[ABS_X+i] = 4;
diff -Nru a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c
--- a/drivers/input/joystick/warrior.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/input/joystick/warrior.c	Tue Jun 15 22:20:42 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free warftware; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  *  Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -44,7 +44,7 @@
  */
 
 #define WARRIOR_MAX_LENGTH	16
-static char warrior_lengths[] = { 0, 4, 12, 3, 4, 4, 0, 0 }; 
+static char warrior_lengths[] = { 0, 4, 12, 3, 4, 4, 0, 0 };
 static char *warrior_name = "Logitech WingMan Warrior";
 
 /*
@@ -114,7 +114,7 @@
 		warrior->data[warrior->idx++] = data;
 
 	if (warrior->idx == warrior->len) {
-		if (warrior->idx) warrior_process_packet(warrior, regs);	
+		if (warrior->idx) warrior_process_packet(warrior, regs);
 		warrior->idx = 0;
 		warrior->len = 0;
 	}
@@ -152,7 +152,7 @@
 
 	memset(warrior, 0, sizeof(struct warrior));
 
-	warrior->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);	
+	warrior->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
 	warrior->dev.keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2);
 	warrior->dev.relbit[0] = BIT(REL_DIAL);
 	warrior->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y);
@@ -168,24 +168,24 @@
 	warrior->dev.id.version = 0x0100;
 
 	for (i = 0; i < 2; i++) {
-		warrior->dev.absmax[ABS_X+i] = -64;	
-		warrior->dev.absmin[ABS_X+i] =  64;	
-		warrior->dev.absflat[ABS_X+i] = 8;	
+		warrior->dev.absmax[ABS_X+i] = -64;
+		warrior->dev.absmin[ABS_X+i] =  64;
+		warrior->dev.absflat[ABS_X+i] = 8;
 	}
 
-	warrior->dev.absmax[ABS_THROTTLE] = -112;	
-	warrior->dev.absmin[ABS_THROTTLE] =  112;	
+	warrior->dev.absmax[ABS_THROTTLE] = -112;
+	warrior->dev.absmin[ABS_THROTTLE] =  112;
 
 	for (i = 0; i < 2; i++) {
-		warrior->dev.absmax[ABS_HAT0X+i] = -1;	
-		warrior->dev.absmin[ABS_HAT0X+i] =  1;	
+		warrior->dev.absmax[ABS_HAT0X+i] = -1;
+		warrior->dev.absmin[ABS_HAT0X+i] =  1;
 	}
 
 	warrior->dev.private = warrior;
-	
+
 	serio->private = warrior;
 
-	if (serio_open(serio, dev)) { 
+	if (serio_open(serio, dev)) {
 		kfree(warrior);
 		return;
 	}
diff -Nru a/drivers/input/keyboard/98kbd.c b/drivers/input/keyboard/98kbd.c
--- a/drivers/input/keyboard/98kbd.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/keyboard/98kbd.c	Tue Jun 15 22:20:39 2004
@@ -12,18 +12,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  */
 
 #include <linux/delay.h>
@@ -43,7 +43,7 @@
 #define KBD98_KEY	0x7f
 #define KBD98_RELEASE	0x80
 
-static unsigned char kbd98_keycode[256] = {	 
+static unsigned char kbd98_keycode[256] = {
 	  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 43, 14, 15,
 	 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 41, 26, 28, 30, 31, 32,
 	 33, 34, 35, 36, 37, 38, 39, 40, 27, 44, 45, 46, 47, 48, 49, 50,
@@ -109,8 +109,8 @@
 	struct jis_kbd_conv jis[16];
 };
 
-void kbd98_interrupt(struct serio *serio, unsigned char data,
-			unsigned int flags, struct pt_regs *regs)
+irqreturn_t kbd98_interrupt(struct serio *serio, unsigned char data,
+			    unsigned int flags, struct pt_regs *regs)
 {
 	struct kbd98 *kbd98 = serio->private;
 	unsigned char scancode, keycode;
@@ -119,15 +119,15 @@
 	switch (data) {
 		case KBD98_RET_ACK:
 			kbd98->ack = 1;
-			return;
+			goto out;
 		case KBD98_RET_NAK:
 			kbd98->ack = -1;
-			return;
+			goto out;
 	}
 
 	if (kbd98->cmdcnt) {
 		kbd98->cmdbuf[--kbd98->cmdcnt] = data;
-		return;
+		goto out;
 	}
 
 	scancode = data & KBD98_KEY;
@@ -164,7 +164,7 @@
 
 			keycode = kbd98->jis[i].emul[kbd98->shift].keycode;
 			if (keycode == KBD98_KEY_NULL)
-				return;
+				break;
 
 			if (press) {
 				kbd98->emul.scancode = scancode;
@@ -187,27 +187,31 @@
 			}
 
 			input_sync(&kbd98->dev);
-			return;
+			break;
 
 		case KEY_CAPSLOCK:
 			input_report_key(&kbd98->dev, keycode, 1);
 			input_sync(&kbd98->dev);
 			input_report_key(&kbd98->dev, keycode, 0);
 			input_sync(&kbd98->dev);
-			return;
+			break;
 
 		case KBD98_KEY_NULL:
-			return;
+			break;
 
 		case 0:
 			printk(KERN_WARNING "kbd98.c: Unknown key (scancode %#x) %s.\n",
 				data & KBD98_KEY, data & KBD98_RELEASE ? "released" : "pressed");
-			return;
+			break;
 
 		default:
 			input_report_key(&kbd98->dev, keycode, press);
 			input_sync(&kbd98->dev);
-		}
+			break;
+	}
+
+out:
+	return IRQ_HANDLED;
 }
 
 /*
@@ -243,7 +247,7 @@
 	int i;
 
 	kbd98->cmdcnt = receive;
-	
+
 	if (command & 0xff)
 		if (kbd98_sendbyte(kbd98, command & 0xff))
 			return (kbd98->cmdcnt = 0) - 1;
@@ -258,7 +262,7 @@
 		for (i = 0; i < receive; i++)
 			param[i] = kbd98->cmdbuf[(receive - 1) - i];
 
-	if (kbd98->cmdcnt) 
+	if (kbd98->cmdcnt)
 		return (kbd98->cmdcnt = 0) - 1;
 
 	return 0;
@@ -318,7 +322,7 @@
 
 	memset(kbd98, 0, sizeof(struct kbd98));
 	kbd98->emul.scancode = KBD98_KEY_UNKNOWN;
-	
+
 	kbd98->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);
 	kbd98->dev.ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_KANA);
 
diff -Nru a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
--- a/drivers/input/keyboard/Kconfig	Tue Jun 15 22:21:03 2004
+++ b/drivers/input/keyboard/Kconfig	Tue Jun 15 22:21:03 2004
@@ -62,7 +62,7 @@
 	  Say Y here if you want to use the old IBM PC/XT keyboard (or
 	  compatible) on your system. This is only possible with a
 	  parallel port keyboard adapter, you cannot connect it to the
-	  keyboard port on a PC that runs Linux. 
+	  keyboard port on a PC that runs Linux.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called xtkbd.
@@ -92,7 +92,7 @@
 	depends on AMIGA && INPUT && INPUT_KEYBOARD
 	help
 	  Say Y here if you are running Linux on any AMIGA and have a keyboard
-	  attached.	
+	  attached.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called amikbd.
@@ -103,7 +103,7 @@
 	select SERIO
 	help
 	  Say Y here if you want to use the NEC PC-9801/PC-9821 keyboard (or
-	  compatible) on your system. 
+	  compatible) on your system.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called 98kbd.
diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
--- a/drivers/input/keyboard/atkbd.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/input/keyboard/atkbd.c	Tue Jun 15 22:20:43 2004
@@ -26,7 +26,6 @@
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/workqueue.h>
-#include <linux/timer.h>
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
 MODULE_DESCRIPTION("AT and PS/2 keyboard driver");
@@ -173,22 +172,24 @@
 	unsigned char keycode[512];
 	struct input_dev dev;
 	struct serio *serio;
-	struct timer_list timer;
+
 	char name[64];
 	char phys[32];
+	unsigned short id;
+	unsigned char set;
+	unsigned int translated:1;
+	unsigned int extra:1;
+	unsigned int write:1;
+
 	unsigned char cmdbuf[4];
 	unsigned char cmdcnt;
-	unsigned char set;
-	unsigned char extra;
-	unsigned char release;
-	int lastkey;
 	volatile signed char ack;
 	unsigned char emul;
-	unsigned short id;
-	unsigned char write;
-	unsigned char translated;
-	unsigned char resend;
-	unsigned char bat_xl;
+	unsigned int resend:1;
+	unsigned int release:1;
+	unsigned int bat_xl:1;
+	unsigned int enabled:1;
+
 	unsigned int last;
 	unsigned long time;
 };
@@ -248,6 +249,9 @@
 		goto out;
 	}
 
+	if (!atkbd->enabled)
+		goto out;
+
 	if (atkbd->translated) {
 
 		if (atkbd->emul ||
@@ -300,15 +304,20 @@
 		case ATKBD_KEY_NULL:
 			break;
 		case ATKBD_KEY_UNKNOWN:
-			printk(KERN_WARNING "atkbd.c: Unknown key %s (%s set %d, code %#x on %s).\n",
-				atkbd->release ? "released" : "pressed",
-				atkbd->translated ? "translated" : "raw",
-				atkbd->set, code, serio->phys);
-			if (atkbd->translated && atkbd->set == 2 && code == 0x7a)
-				printk(KERN_WARNING "atkbd.c: This is an XFree86 bug. It shouldn't access"
-					" hardware directly.\n");
-			else
-				printk(KERN_WARNING "atkbd.c: Use 'setkeycodes %s%02x <keycode>' to make it known.\n",						code & 0x80 ? "e0" : "", code & 0x7f);
+			if (data == ATKBD_RET_ACK || data == ATKBD_RET_NAK) {
+				printk(KERN_WARNING "atkbd.c: Spurious %s on %s. Some program, "
+				       "like XFree86, might be trying access hardware directly.\n",
+				       data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys);
+			} else {
+				printk(KERN_WARNING "atkbd.c: Unknown key %s "
+				       "(%s set %d, code %#x on %s).\n",
+				       atkbd->release ? "released" : "pressed",
+				       atkbd->translated ? "translated" : "raw",
+				       atkbd->set, code, serio->phys);
+				printk(KERN_WARNING "atkbd.c: Use 'setkeycodes %s%02x <keycode>' "
+				       "to make it known.\n",
+				       code & 0x80 ? "e0" : "", code & 0x7f);
+			}
 			break;
 		case ATKBD_SCR_1:
 			scroll = 1 - atkbd->release * 2;
@@ -745,6 +754,8 @@
 		atkbd->id = 0xab00;
 	}
 
+	atkbd->enabled = 1;
+
 	if (atkbd->extra) {
 		atkbd->dev.ledbit[0] |= BIT(LED_COMPOSE) | BIT(LED_SUSPEND) | BIT(LED_SLEEP) | BIT(LED_MUTE) | BIT(LED_MISC);
 		sprintf(atkbd->name, "AT Set 2 Extra keyboard");
@@ -809,12 +820,12 @@
 		param[0] = (test_bit(LED_SCROLLL, atkbd->dev.led) ? 1 : 0)
 		         | (test_bit(LED_NUML,    atkbd->dev.led) ? 2 : 0)
  		         | (test_bit(LED_CAPSL,   atkbd->dev.led) ? 4 : 0);
-		
+
 		if (atkbd_probe(atkbd))
 			return -1;
 		if (atkbd->set != atkbd_set_3(atkbd))
 			return -1;
-		
+
 		atkbd_enable(atkbd);
 
 		if (atkbd_command(atkbd, param, ATKBD_CMD_SETLEDS))
diff -Nru a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c
--- a/drivers/input/keyboard/maple_keyb.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/input/keyboard/maple_keyb.c	Tue Jun 15 22:20:38 2004
@@ -139,7 +139,7 @@
 
 	kbd->dev.name = dev->product_name;
 	kbd->dev.id.bustype = BUS_MAPLE;
-	
+
 	input_register_device(&kbd->dev);
 
 	maple_getcond_callback(dev, dc_kbd_callback, 1, MAPLE_FUNC_KEYBOARD);
diff -Nru a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c
--- a/drivers/input/keyboard/sunkbd.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/input/keyboard/sunkbd.c	Tue Jun 15 22:20:35 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -148,7 +148,7 @@
 		case EV_LED:
 
 			sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_SETLED);
-			sunkbd->serio->write(sunkbd->serio, 
+			sunkbd->serio->write(sunkbd->serio,
 				(!!test_bit(LED_CAPSL, dev->led) << 3) | (!!test_bit(LED_SCROLLL, dev->led) << 2) |
 				(!!test_bit(LED_COMPOSE, dev->led) << 1) | !!test_bit(LED_NUML, dev->led));
 			return 0;
@@ -160,7 +160,7 @@
 				case SND_CLICK:
 					sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_NOCLICK - value);
 					return 0;
-	
+
 				case SND_BELL:
 					sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_BELLOFF - value);
 					return 0;
@@ -210,7 +210,7 @@
 	wait_event_interruptible_timeout(sunkbd->wait, sunkbd->reset >= 0, HZ);
 
 	sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_SETLED);
-	sunkbd->serio->write(sunkbd->serio, 
+	sunkbd->serio->write(sunkbd->serio,
 		(!!test_bit(LED_CAPSL, sunkbd->dev.led) << 3) | (!!test_bit(LED_SCROLLL, sunkbd->dev.led) << 2) |
 		(!!test_bit(LED_COMPOSE, sunkbd->dev.led) << 1) | !!test_bit(LED_NUML, sunkbd->dev.led));
 	sunkbd->serio->write(sunkbd->serio, SUNKBD_CMD_NOCLICK - !!test_bit(SND_CLICK, sunkbd->dev.snd));
@@ -231,7 +231,7 @@
 
 	if ((serio->type & SERIO_PROTO) && (serio->type & SERIO_PROTO) != SERIO_SUNKBD)
 		return;
-	
+
 	if (!(sunkbd = kmalloc(sizeof(struct sunkbd), GFP_KERNEL)))
 		return;
 
diff -Nru a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c
--- a/drivers/input/keyboard/xtkbd.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/input/keyboard/xtkbd.c	Tue Jun 15 22:20:41 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -43,7 +43,7 @@
 #define XTKBD_KEY	0x7f
 #define XTKBD_RELEASE	0x80
 
-static unsigned char xtkbd_keycode[256] = {	 
+static unsigned char xtkbd_keycode[256] = {
 	  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
 	 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
 	 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -98,7 +98,7 @@
 		return;
 
 	memset(xtkbd, 0, sizeof(struct xtkbd));
-	
+
 	xtkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
 
 	xtkbd->serio = serio;
diff -Nru a/drivers/input/misc/98spkr.c b/drivers/input/misc/98spkr.c
--- a/drivers/input/misc/98spkr.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/input/misc/98spkr.c	Tue Jun 15 22:20:37 2004
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/input.h>
+#include <asm/8253pit.h>
 #include <asm/io.h>
 
 MODULE_AUTHOR("Osamu Tomita <tomita@cinet.co.jp>");
@@ -41,11 +42,11 @@
 		case SND_BELL: if (value) value = 1000;
 		case SND_TONE: break;
 		default: return -1;
-	} 
+	}
 
 	if (value > 20 && value < 32767)
-		count = CLOCK_TICK_RATE / value;
-	
+		count = PIT_TICK_RATE / value;
+
 	spin_lock_irqsave(&i8253_beep_lock, flags);
 
 	if (count) {
diff -Nru a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
--- a/drivers/input/misc/Kconfig	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/misc/Kconfig	Tue Jun 15 22:20:39 2004
@@ -14,7 +14,7 @@
 
 config INPUT_PCSPKR
 	tristate "PC Speaker support"
-	depends on INPUT && INPUT_MISC
+	depends on (ALPHA || X86 || X86_64 || MIPS) && INPUT && INPUT_MISC
 	help
 	  Say Y here if you want the standard PC Speaker to be used for
 	  bells and whistles.
diff -Nru a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
--- a/drivers/input/misc/pcspkr.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/input/misc/pcspkr.c	Tue Jun 15 22:20:41 2004
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/input.h>
+#include <asm/8253pit.h>
 #include <asm/io.h>
 
 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
@@ -40,11 +41,11 @@
 		case SND_BELL: if (value) value = 1000;
 		case SND_TONE: break;
 		default: return -1;
-	} 
+	}
 
 	if (value > 20 && value < 32767)
-		count = CLOCK_TICK_RATE / value;
-	
+		count = PIT_TICK_RATE / value;
+
 	spin_lock_irqsave(&i8253_beep_lock, flags);
 
 	if (count) {
diff -Nru a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
--- a/drivers/input/misc/sparcspkr.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/input/misc/sparcspkr.c	Tue Jun 15 22:21:04 2004
@@ -53,11 +53,11 @@
 		case SND_BELL: if (value) value = 1000;
 		case SND_TONE: break;
 		default: return -1;
-	} 
+	}
 
 	if (value > 20 && value < 32767)
 		count = 1193182 / value;
-	
+
 	spin_lock_irqsave(&beep_lock, flags);
 
 	/* EBUS speaker only has on/off state, the frequency does not
@@ -108,11 +108,11 @@
 		case SND_BELL: if (value) value = 1000;
 		case SND_TONE: break;
 		default: return -1;
-	} 
+	}
 
 	if (value > 20 && value < 32767)
 		count = 1193182 / value;
-	
+
 	spin_lock_irqsave(&beep_lock, flags);
 
 	if (count) {
diff -Nru a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
--- a/drivers/input/misc/uinput.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/input/misc/uinput.c	Tue Jun 15 22:20:44 2004
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  *
  * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
- * 
+ *
  * Changes/Revisions:
  *	0.1	20/06/2002
  *		- first public version
@@ -68,7 +68,7 @@
 static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id)
 {
 	return 0;
-}					
+}
 
 static int uinput_create_device(struct uinput_device *udev)
 {
@@ -123,7 +123,7 @@
 	memset(newinput, 0, sizeof(struct input_dev));
 
 	newdev->dev = newinput;
-	
+
 	file->private_data = newdev;
 
 	return 0;
@@ -137,16 +137,16 @@
 {
 	unsigned int cnt;
 	int retval = 0;
-	
+
 	for (cnt = 0; cnt < ABS_MAX; cnt++) {
-		if (!test_bit(cnt, dev->absbit)) 
+		if (!test_bit(cnt, dev->absbit))
 			continue;
-		
+
 		if (/*!dev->absmin[cnt] || !dev->absmax[cnt] || */
 		    (dev->absmax[cnt] <= dev->absmin[cnt])) {
-			printk(KERN_DEBUG 
+			printk(KERN_DEBUG
 				"%s: invalid abs[%02x] min:%d max:%d\n",
-				UINPUT_NAME, cnt, 
+				UINPUT_NAME, cnt,
 				dev->absmin[cnt], dev->absmax[cnt]);
 			retval = -EINVAL;
 			break;
@@ -154,7 +154,7 @@
 
 		if ((dev->absflat[cnt] < dev->absmin[cnt]) ||
 		    (dev->absflat[cnt] > dev->absmax[cnt])) {
-			printk(KERN_DEBUG 
+			printk(KERN_DEBUG
 				"%s: absflat[%02x] out of range: %d "
 				"(min:%d/max:%d)\n",
 				UINPUT_NAME, cnt, dev->absflat[cnt],
@@ -190,7 +190,7 @@
 		goto exit;
 	}
 
-	if (NULL != dev->name) 
+	if (NULL != dev->name)
 		kfree(dev->name);
 
 	size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1;
@@ -229,7 +229,7 @@
 static ssize_t uinput_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
 {
 	struct uinput_device	*udev = file->private_data;
-	
+
 	if (test_bit(UIST_CREATED, &(udev->state))) {
 		struct input_event	ev;
 
@@ -247,7 +247,7 @@
 {
 	struct uinput_device *udev = file->private_data;
 	int retval = 0;
-	
+
 	if (!test_bit(UIST_CREATED, &(udev->state)))
 		return -ENODEV;
 
@@ -255,16 +255,16 @@
 		return -EAGAIN;
 
 	retval = wait_event_interruptible(udev->waitq,
-			(udev->head != udev->tail) || 
+			(udev->head != udev->tail) ||
 			!test_bit(UIST_CREATED, &(udev->state)));
-	
+
 	if (retval)
 		return retval;
 
 	if (!test_bit(UIST_CREATED, &(udev->state)))
 		return -ENODEV;
 
-	while ((udev->head != udev->tail) && 
+	while ((udev->head != udev->tail) &&
 	    (retval + sizeof(struct input_event) <= count)) {
 		if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]),
 		    sizeof(struct input_event))) return -EFAULT;
@@ -284,7 +284,7 @@
 	if (udev->head != udev->tail)
 		return POLLIN | POLLRDNORM;
 
-	return 0;			
+	return 0;
 }
 
 static int uinput_burn_device(struct uinput_device *udev)
@@ -318,7 +318,7 @@
 		case UI_DEV_CREATE:
 			retval = uinput_create_device(udev);
 			break;
-			
+
 		case UI_DEV_DESTROY:
 			retval = uinput_destroy_device(udev);
 			break;
@@ -330,7 +330,7 @@
 			}
 			set_bit(arg, udev->dev->evbit);
 			break;
-			
+
 		case UI_SET_KEYBIT:
 			if (arg > KEY_MAX) {
 				retval = -EINVAL;
@@ -338,7 +338,7 @@
 			}
 			set_bit(arg, udev->dev->keybit);
 			break;
-			
+
 		case UI_SET_RELBIT:
 			if (arg > REL_MAX) {
 				retval = -EINVAL;
@@ -346,7 +346,7 @@
 			}
 			set_bit(arg, udev->dev->relbit);
 			break;
-			
+
 		case UI_SET_ABSBIT:
 			if (arg > ABS_MAX) {
 				retval = -EINVAL;
@@ -354,7 +354,7 @@
 			}
 			set_bit(arg, udev->dev->absbit);
 			break;
-			
+
 		case UI_SET_MSCBIT:
 			if (arg > MSC_MAX) {
 				retval = -EINVAL;
@@ -362,7 +362,7 @@
 			}
 			set_bit(arg, udev->dev->mscbit);
 			break;
-			
+
 		case UI_SET_LEDBIT:
 			if (arg > LED_MAX) {
 				retval = -EINVAL;
@@ -370,7 +370,7 @@
 			}
 			set_bit(arg, udev->dev->ledbit);
 			break;
-			
+
 		case UI_SET_SNDBIT:
 			if (arg > SND_MAX) {
 				retval = -EINVAL;
@@ -378,7 +378,7 @@
 			}
 			set_bit(arg, udev->dev->sndbit);
 			break;
-			
+
 		case UI_SET_FFBIT:
 			if (arg > FF_MAX) {
 				retval = -EINVAL;
@@ -386,7 +386,7 @@
 			}
 			set_bit(arg, udev->dev->ffbit);
 			break;
-			
+
 		default:
 			retval = -EFAULT;
 	}
diff -Nru a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
--- a/drivers/input/mouse/logips2pp.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/input/mouse/logips2pp.c	Tue Jun 15 22:20:42 2004
@@ -14,6 +14,25 @@
 #include "psmouse.h"
 #include "logips2pp.h"
 
+/* Logitech mouse types */
+#define PS2PP_KIND_WHEEL	1
+#define PS2PP_KIND_MX		2
+#define PS2PP_KIND_TP3		3
+
+/* Logitech mouse features */
+#define PS2PP_WHEEL		0x01
+#define PS2PP_HWHEEL		0x02
+#define PS2PP_SIDE_BTN		0x04
+#define PS2PP_EXTRA_BTN		0x08
+#define PS2PP_TASK_BTN		0x10
+#define PS2PP_NAV_BTN		0x20
+
+struct ps2pp_info {
+	const int model;
+	unsigned const int kind;
+	unsigned const int features;
+};
+
 /*
  * Process a PS2++ or PS2T++ packet.
  */
@@ -63,7 +82,6 @@
 		packet[0] &= 0x0f;
 		packet[1] = 0;
 		packet[2] = 0;
-
 	}
 }
 
@@ -76,18 +94,9 @@
 
 static int ps2pp_cmd(struct psmouse *psmouse, unsigned char *param, unsigned char command)
 {
-	unsigned char d;
-	int i;
-
-	if (psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11))
+	if (psmouse_sliced_command(psmouse, command))
 		return -1;
 
-	for (i = 6; i >= 0; i -= 2) {
-		d = (command >> i) & 3;
-		if(psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES))
-			return -1;
-	}
-
 	if (psmouse_command(psmouse, param, PSMOUSE_CMD_POLL))
 		return -1;
 
@@ -99,7 +108,7 @@
  * enabled if we do nothing to it. Of course I put this in because I want it
  * disabled :P
  * 1 - enabled (if previously disabled, also default)
- * 0/2 - disabled 
+ * 0/2 - disabled
  */
 
 static void ps2pp_set_smartscroll(struct psmouse *psmouse)
@@ -113,14 +122,11 @@
 	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
 	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
 
-	if (psmouse_smartscroll == 1) 
-		param[0] = 1;
-	else
-	if (psmouse_smartscroll > 2)
-		return;
-
-	/* else leave param[0] == 0 to disable */
-	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
+	if (psmouse_smartscroll < 2) {
+		/* 0 - disabled, 1 - enabled */
+		param[0] = psmouse_smartscroll;
+		psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
+	}
 }
 
 /*
@@ -138,133 +144,167 @@
 	psmouse_command(psmouse, &param, PSMOUSE_CMD_SETRES);
 }
 
+static struct ps2pp_info *get_model_info(unsigned char model)
+{
+	static struct ps2pp_info ps2pp_list[] = {
+		{ 12,	0,			PS2PP_SIDE_BTN},
+		{ 13,	0,			0 },
+		{ 40,	0,			PS2PP_SIDE_BTN },
+		{ 41,	0,			PS2PP_SIDE_BTN },
+		{ 42,	0,			PS2PP_SIDE_BTN },
+		{ 43,	0,			PS2PP_SIDE_BTN },
+		{ 50,	0,			0 },
+		{ 51,	0,			0 },
+		{ 52,	PS2PP_KIND_WHEEL,	PS2PP_SIDE_BTN | PS2PP_WHEEL },
+		{ 53,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
+		{ 61,	PS2PP_KIND_MX,
+				PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
+				PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },	/* MX700 */
+		{ 73,	0,			PS2PP_SIDE_BTN },
+		{ 75,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
+		{ 76,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
+		{ 80,	PS2PP_KIND_WHEEL,	PS2PP_SIDE_BTN | PS2PP_WHEEL },
+		{ 81,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
+		{ 83,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
+		{ 88,	PS2PP_KIND_WHEEL,	PS2PP_WHEEL },
+		{ 96,	0,			0 },
+		{ 97,	PS2PP_KIND_TP3,		PS2PP_WHEEL | PS2PP_HWHEEL },
+		{ 100,	PS2PP_KIND_MX,
+				PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
+				PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },	/* MX510 */
+		{ 112,	PS2PP_KIND_MX,
+				PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
+				PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },	/* MX500 */
+		{ 114,	PS2PP_KIND_MX,
+				PS2PP_WHEEL | PS2PP_SIDE_BTN |
+				PS2PP_TASK_BTN | PS2PP_EXTRA_BTN },	/* M310 */
+		{ }
+	};
+	int i;
+
+	for (i = 0; ps2pp_list[i].model; i++)
+		if (model == ps2pp_list[i].model)
+			return &ps2pp_list[i];
+	return NULL;
+}
+
 /*
- * Detect the exact model and features of a PS2++ or PS2T++ Logitech mouse or
- * touchpad.
+ * Set up input device's properties based on the detected mouse model.
  */
 
-static int ps2pp_detect_model(struct psmouse *psmouse, unsigned char *param)
+static void ps2pp_set_model_properties(struct psmouse *psmouse, struct ps2pp_info *model_info)
 {
-	int i;
-	static struct _logips2_list {
-		const int model;
-		unsigned const int features;
-	} logips2pp_list [] = {
-		{ 12,	PS2PP_4BTN},
-		{ 13,	0 },
-		{ 40,	PS2PP_4BTN },
-		{ 41,	PS2PP_4BTN },
-		{ 42,	PS2PP_4BTN },
-		{ 43,	PS2PP_4BTN },
-		{ 50,	0 },
-		{ 51,	0 },
-		{ 52,	PS2PP_4BTN | PS2PP_WHEEL },
-		{ 53,	PS2PP_WHEEL },
-		{ 61,	PS2PP_WHEEL | PS2PP_MX },	/* MX700 */
-		{ 73,	PS2PP_4BTN },
-		{ 75,	PS2PP_WHEEL },
-		{ 76,	PS2PP_WHEEL },
-		{ 80,	PS2PP_4BTN | PS2PP_WHEEL },
-		{ 81,	PS2PP_WHEEL },
-		{ 83,	PS2PP_WHEEL },
-		{ 88,	PS2PP_WHEEL },
-		{ 96,	0 },
-		{ 97,	0 },
-		{ 100 ,	PS2PP_WHEEL | PS2PP_MX },	/* MX510 */
-		{ 112 ,	PS2PP_WHEEL | PS2PP_MX },	/* MX500 */
-		{ 114 ,	PS2PP_WHEEL | PS2PP_MX | PS2PP_MX310 },	/* MX310 */
-		{ }
-	};
+	if (model_info->features & PS2PP_SIDE_BTN)
+		set_bit(BTN_SIDE, psmouse->dev.keybit);
 
-	psmouse->vendor = "Logitech";
-	psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78);
+	if (model_info->features & PS2PP_EXTRA_BTN)
+		set_bit(BTN_EXTRA, psmouse->dev.keybit);
 
-	if (param[1] < 3)
-		clear_bit(BTN_MIDDLE, psmouse->dev.keybit);
-	if (param[1] < 2)
-		clear_bit(BTN_RIGHT, psmouse->dev.keybit);
-
-	psmouse->type = PSMOUSE_PS2;
-
-	for (i = 0; logips2pp_list[i].model; i++){
-		if (logips2pp_list[i].model == psmouse->model){
-			psmouse->type = PSMOUSE_PS2PP;
-			if (logips2pp_list[i].features & PS2PP_4BTN)
-				set_bit(BTN_SIDE, psmouse->dev.keybit);
-
-			if (logips2pp_list[i].features & PS2PP_WHEEL){
-				set_bit(REL_WHEEL, psmouse->dev.relbit);
-				psmouse->name = "Wheel Mouse";
-			}
-			if (logips2pp_list[i].features & PS2PP_MX) {
-				set_bit(BTN_SIDE, psmouse->dev.keybit);
-				set_bit(BTN_EXTRA, psmouse->dev.keybit);
-				set_bit(BTN_TASK, psmouse->dev.keybit);
-				if (!(logips2pp_list[i].features & PS2PP_MX310)){
-					set_bit(BTN_BACK, psmouse->dev.keybit);
-					set_bit(BTN_FORWARD, psmouse->dev.keybit);
-				}
-				psmouse->name = "MX Mouse";
-			}
+	if (model_info->features & PS2PP_TASK_BTN)
+		set_bit(BTN_TASK, psmouse->dev.keybit);
+
+	if (model_info->features & PS2PP_NAV_BTN) {
+		set_bit(BTN_FORWARD, psmouse->dev.keybit);
+		set_bit(BTN_BACK, psmouse->dev.keybit);
+	}
+
+	if (model_info->features & PS2PP_WHEEL)
+		set_bit(REL_WHEEL, psmouse->dev.relbit);
+
+	if (model_info->features & PS2PP_HWHEEL)
+		set_bit(REL_HWHEEL, psmouse->dev.relbit);
+
+	switch (model_info->kind) {
+		case PS2PP_KIND_WHEEL:
+			psmouse->name = "Wheel Mouse";
+			break;
+
+		case PS2PP_KIND_MX:
+			psmouse->name = "MX Mouse";
+			break;
+
+		case PS2PP_KIND_TP3:
+			psmouse->name = "TouchPad 3";
 			break;
-		}
 	}
+}
+
+
 /*
- * Do Logitech PS2++ / PS2T++ magic init.
+ * Logitech magic init. Detect whether the mouse is a Logitech one
+ * and its exact model and try turning on extended protocol for ones
+ * that support it.
  */
-	if (psmouse->type == PSMOUSE_PS2PP) {
 
-		if (psmouse->model == 97) { /* TouchPad 3 */
+int ps2pp_init(struct psmouse *psmouse, int set_properties)
+{
+	unsigned char param[4];
+	unsigned char protocol = PSMOUSE_PS2;
+	unsigned char model, buttons;
+	struct ps2pp_info *model_info;
 
-			set_bit(REL_WHEEL, psmouse->dev.relbit);
-			set_bit(REL_HWHEEL, psmouse->dev.relbit);
+	param[0] = 0;
+	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
+	psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
+	psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
+	psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
+	param[1] = 0;
+	psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO);
+
+	if (param[1] != 0) {
+		model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78);
+		buttons = param[1];
+		model_info = get_model_info(model);
+
+/*
+ * Do Logitech PS2++ / PS2T++ magic init.
+ */
+		if (model == 97) { /* Touch Pad 3 */
 
-			param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; /* Unprotect RAM */
+			/* Unprotect RAM */
+			param[0] = 0x11; param[1] = 0x04; param[2] = 0x68;
 			psmouse_command(psmouse, param, 0x30d1);
-			param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; /* Enable features */
+			/* Enable features */
+			param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b;
 			psmouse_command(psmouse, param, 0x30d1);
-			param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; /* Enable PS2++ */
+			/* Enable PS2++ */
+			param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3;
 			psmouse_command(psmouse, param, 0x30d1);
 
 			param[0] = 0;
 			if (!psmouse_command(psmouse, param, 0x13d1) &&
-				param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) {
-				psmouse->name = "TouchPad 3";
-				return PSMOUSE_PS2TPP;
+			    param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) {
+				protocol = PSMOUSE_PS2TPP;
 			}
 
-		} else {
+		} else if (get_model_info(model) != NULL) {
 
 			param[0] = param[1] = param[2] = 0;
 			ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */
 			ps2pp_cmd(psmouse, param, 0xDB);
 
-			if ((param[0] & 0x78) == 0x48 && (param[1] & 0xf3) == 0xc2 &&
-				(param[2] & 3) == ((param[1] >> 2) & 3)) {
-					ps2pp_set_smartscroll(psmouse);
-					return PSMOUSE_PS2PP;
+			if ((param[0] & 0x78) == 0x48 &&
+			    (param[1] & 0xf3) == 0xc2 &&
+			    (param[2] & 0x03) == ((param[1] >> 2) & 3)) {
+				ps2pp_set_smartscroll(psmouse);
+				protocol = PSMOUSE_PS2PP;
 			}
 		}
-	}
 
-	return 0;
-}
-
-/*
- * Logitech magic init.
- */
-int ps2pp_detect(struct psmouse *psmouse)
-{
-	unsigned char param[4];
+		if (set_properties) {
+			psmouse->vendor = "Logitech";
+			psmouse->model = model;
+
+			if (buttons < 3)
+				clear_bit(BTN_MIDDLE, psmouse->dev.keybit);
+			if (buttons < 2)
+				clear_bit(BTN_RIGHT, psmouse->dev.keybit);
 
-	param[0] = 0;
-	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
-	psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
-	psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
-	psmouse_command(psmouse,  NULL, PSMOUSE_CMD_SETSCALE11);
-	param[1] = 0;
-	psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO);
+			if (model_info)
+				ps2pp_set_model_properties(psmouse, model_info);
+		}
+	}
 
-	return param[1] != 0 ? ps2pp_detect_model(psmouse, param) : 0;
+	return protocol;
 }
 
diff -Nru a/drivers/input/mouse/logips2pp.h b/drivers/input/mouse/logips2pp.h
--- a/drivers/input/mouse/logips2pp.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/input/mouse/logips2pp.h	Tue Jun 15 22:20:43 2004
@@ -11,13 +11,8 @@
 #ifndef _LOGIPS2PP_H
 #define _LOGIPS2PP_H
 
-#define PS2PP_4BTN	0x01
-#define PS2PP_WHEEL	0x02
-#define PS2PP_MX	0x04
-#define PS2PP_MX310	0x08
-
-struct psmouse;
 void ps2pp_process_packet(struct psmouse *psmouse);
 void ps2pp_set_800dpi(struct psmouse *psmouse);
-int ps2pp_detect(struct psmouse *psmouse);
+int ps2pp_init(struct psmouse *psmouse, int set_properties);
+
 #endif
diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/input/mouse/psmouse-base.c	Tue Jun 15 22:20:38 2004
@@ -43,9 +43,9 @@
 module_param_named(smartscroll, psmouse_smartscroll, bool, 0);
 MODULE_PARM_DESC(smartscroll, "Logitech Smartscroll autorepeat, 1 = enabled (default), 0 = disabled.");
 
-unsigned int psmouse_resetafter;
+static unsigned int psmouse_resetafter;
 module_param_named(resetafter, psmouse_resetafter, uint, 0);
-MODULE_PARM_DESC(resetafter, "Reset Synaptics Touchpad after so many bad packets (0 = never).");
+MODULE_PARM_DESC(resetafter, "Reset device after so many bad packets (0 = never).");
 
 __obsolete_setup("psmouse_noext");
 __obsolete_setup("psmouse_resolution=");
@@ -56,15 +56,22 @@
 static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "PS2T++", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2"};
 
 /*
- * psmouse_process_packet() analyzes the PS/2 mouse packet contents and
- * reports relevant events to the input module.
+ * psmouse_process_byte() analyzes the PS/2 data stream and reports
+ * relevant events to the input module once full packet has arrived.
  */
 
-static void psmouse_process_packet(struct psmouse *psmouse, struct pt_regs *regs)
+static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse, struct pt_regs *regs)
 {
 	struct input_dev *dev = &psmouse->dev;
 	unsigned char *packet = psmouse->packet;
 
+	if (psmouse->pktcnt < 3 + (psmouse->type >= PSMOUSE_GENPS))
+		return PSMOUSE_GOOD_DATA;
+
+/*
+ * Full packet accumulated, process it
+ */
+
 	input_regs(dev, regs);
 
 /*
@@ -112,6 +119,8 @@
 	input_report_rel(dev, REL_Y, packet[2] ? (int) ((packet[0] << 3) & 0x100) - (int) packet[2] : 0);
 
 	input_sync(dev);
+
+	return PSMOUSE_FULL_PACKET;
 }
 
 /*
@@ -123,6 +132,7 @@
 		unsigned char data, unsigned int flags, struct pt_regs *regs)
 {
 	struct psmouse *psmouse = serio->private;
+	psmouse_ret_t rc;
 
 	if (psmouse->state == PSMOUSE_IGNORE)
 		goto out;
@@ -180,7 +190,7 @@
 		if (psmouse->pktcnt == 2) {
 			if (psmouse->packet[1] == PSMOUSE_RET_ID) {
 				psmouse->state = PSMOUSE_IGNORE;
-				serio_rescan(serio);
+				serio_reconnect(serio);
 				goto out;
 			}
 			if (psmouse->type == PSMOUSE_SYNAPTICS) {
@@ -193,19 +203,32 @@
 		}
 	}
 
-	if (psmouse->type == PSMOUSE_SYNAPTICS) {
-		/*
-		 * The synaptics driver has its own resync logic,
-		 * so it needs to receive all bytes one at a time.
-		 */
-		synaptics_process_byte(psmouse, regs);
-		goto out;
-	}
+	rc = psmouse->protocol_handler(psmouse, regs);
 
-	if (psmouse->pktcnt == 3 + (psmouse->type >= PSMOUSE_GENPS)) {
-		psmouse_process_packet(psmouse, regs);
-		psmouse->pktcnt = 0;
-		goto out;
+	switch (rc) {
+		case PSMOUSE_BAD_DATA:
+			printk(KERN_WARNING "psmouse.c: %s at %s lost sync at byte %d\n",
+				psmouse->name, psmouse->phys, psmouse->pktcnt);
+			psmouse->pktcnt = 0;
+
+			if (++psmouse->out_of_sync == psmouse_resetafter) {
+				psmouse->state = PSMOUSE_IGNORE;
+				printk(KERN_NOTICE "psmouse.c: issuing reconnect request\n");
+				serio_reconnect(psmouse->serio);
+			}
+			break;
+
+		case PSMOUSE_FULL_PACKET:
+			psmouse->pktcnt = 0;
+			if (psmouse->out_of_sync) {
+				psmouse->out_of_sync = 0;
+				printk(KERN_NOTICE "psmouse.c: %s at %s - driver resynched.\n",
+					psmouse->name, psmouse->phys);
+			}
+			break;
+
+		case PSMOUSE_GOOD_DATA:
+			break;
 	}
 out:
 	return IRQ_HANDLED;
@@ -289,6 +312,30 @@
 
 
 /*
+ * psmouse_sliced_command() sends an extended PS/2 command to the mouse
+ * using sliced syntax, understood by advanced devices, such as Logitech
+ * or Synaptics touchpads. The command is encoded as:
+ * 0xE6 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu
+ * is the command.
+ */
+int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command)
+{
+	int i;
+
+	if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11))
+		return -1;
+
+	for (i = 6; i >= 0; i -= 2) {
+		unsigned char d = (command >> i) & 3;
+		if (psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES))
+			return -1;
+	}
+
+	return 0;
+}
+
+
+/*
  * psmouse_reset() resets the mouse into power-on state.
  */
 int psmouse_reset(struct psmouse *psmouse)
@@ -363,31 +410,31 @@
  * the mouse may have.
  */
 
-static int psmouse_extensions(struct psmouse *psmouse)
+static int psmouse_extensions(struct psmouse *psmouse,
+			      unsigned int max_proto, int set_properties)
 {
 	int synaptics_hardware = 0;
 
-	psmouse->vendor = "Generic";
-	psmouse->name = "Mouse";
-	psmouse->model = 0;
-
 /*
  * Try Synaptics TouchPad
  */
-	if (psmouse_max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse)) {
+	if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse)) {
 		synaptics_hardware = 1;
-		psmouse->vendor = "Synaptics";
-		psmouse->name = "TouchPad";
 
-		if (psmouse_max_proto > PSMOUSE_IMEX) {
-			if (synaptics_init(psmouse) == 0)
+		if (set_properties) {
+			psmouse->vendor = "Synaptics";
+			psmouse->name = "TouchPad";
+		}
+
+		if (max_proto > PSMOUSE_IMEX) {
+			if (!set_properties || synaptics_init(psmouse) == 0)
 				return PSMOUSE_SYNAPTICS;
 /*
  * Some Synaptics touchpads can emulate extended protocols (like IMPS/2).
  * Unfortunately Logitech/Genius probes confuse some firmware versions so
  * we'll have to skip them.
  */
-			psmouse_max_proto = PSMOUSE_IMEX;
+			max_proto = PSMOUSE_IMEX;
 		}
 /*
  * Make sure that touchpad is in relative mode, gestures (taps) are enabled
@@ -395,35 +442,46 @@
 		synaptics_reset(psmouse);
 	}
 
-	if (psmouse_max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) {
-		set_bit(BTN_EXTRA, psmouse->dev.keybit);
-		set_bit(BTN_SIDE, psmouse->dev.keybit);
-		set_bit(REL_WHEEL, psmouse->dev.relbit);
+	if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) {
+
+		if (set_properties) {
+			set_bit(BTN_EXTRA, psmouse->dev.keybit);
+			set_bit(BTN_SIDE, psmouse->dev.keybit);
+			set_bit(REL_WHEEL, psmouse->dev.relbit);
+			psmouse->vendor = "Genius";
+			psmouse->name = "Wheel Mouse";
+		}
 
-		psmouse->vendor = "Genius";
-		psmouse->name = "Wheel Mouse";
 		return PSMOUSE_GENPS;
 	}
 
-	if (psmouse_max_proto > PSMOUSE_IMEX) {
-		int type = ps2pp_detect(psmouse);
-		if (type)
+	if (max_proto > PSMOUSE_IMEX) {
+		int type = ps2pp_init(psmouse, set_properties);
+		if (type > PSMOUSE_PS2)
 			return type;
 	}
 
-	if (psmouse_max_proto >= PSMOUSE_IMPS && intellimouse_detect(psmouse)) {
-		set_bit(REL_WHEEL, psmouse->dev.relbit);
+	if (max_proto >= PSMOUSE_IMEX && im_explorer_detect(psmouse)) {
 
-		if (psmouse_max_proto >= PSMOUSE_IMEX &&
-					im_explorer_detect(psmouse)) {
+		if (set_properties) {
+			set_bit(REL_WHEEL, psmouse->dev.relbit);
 			set_bit(BTN_SIDE, psmouse->dev.keybit);
 			set_bit(BTN_EXTRA, psmouse->dev.keybit);
+			if (!psmouse->name)
+				psmouse->name = "Explorer Mouse";
+		}
+
+		return PSMOUSE_IMEX;
+	}
+
+	if (max_proto >= PSMOUSE_IMPS && intellimouse_detect(psmouse)) {
 
-			psmouse->name = "Explorer Mouse";
-			return PSMOUSE_IMEX;
+		if (set_properties) {
+			set_bit(REL_WHEEL, psmouse->dev.relbit);
+			if (!psmouse->name)
+				psmouse->name = "Wheel Mouse";
 		}
 
-		psmouse->name = "Wheel Mouse";
 		return PSMOUSE_IMPS;
 	}
 
@@ -473,12 +531,7 @@
 	if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS))
 		printk(KERN_WARNING "psmouse.c: Failed to reset mouse on %s\n", psmouse->serio->phys);
 
-/*
- * And here we try to determine if it has any extensions over the
- * basic PS/2 3-button mouse.
- */
-
-	return psmouse->type = psmouse_extensions(psmouse);
+	return 0;
 }
 
 /*
@@ -616,7 +669,6 @@
 	psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
 	psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
 	psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
-
 	psmouse->state = PSMOUSE_CMD_MODE;
 	psmouse->serio = serio;
 	psmouse->dev.private = psmouse;
@@ -628,13 +680,21 @@
 		return;
 	}
 
-	if (psmouse_probe(psmouse) <= 0) {
+	if (psmouse_probe(psmouse) < 0) {
 		serio_close(serio);
 		kfree(psmouse);
 		serio->private = NULL;
 		return;
 	}
 
+	psmouse->type = psmouse_extensions(psmouse, psmouse_max_proto, 1);
+	if (!psmouse->vendor)
+		psmouse->vendor = "Generic";
+	if (!psmouse->name)
+		psmouse->name = "Mouse";
+	if (!psmouse->protocol_handler)
+		psmouse->protocol_handler = psmouse_process_byte;
+
 	sprintf(psmouse->devname, "%s %s %s",
 		psmouse_protocols[psmouse->type], psmouse->vendor, psmouse->name);
 	sprintf(psmouse->phys, "%s/input0",
@@ -668,27 +728,24 @@
 {
 	struct psmouse *psmouse = serio->private;
 	struct serio_dev *dev = serio->dev;
-	int old_type;
 
 	if (!dev || !psmouse) {
 		printk(KERN_DEBUG "psmouse: reconnect request, but serio is disconnected, ignoring...\n");
 		return -1;
 	}
 
-	old_type = psmouse->type;
-
 	psmouse->state = PSMOUSE_CMD_MODE;
-	psmouse->type = psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = 0;
+	psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = psmouse->out_of_sync = 0;
 	if (psmouse->reconnect) {
 	       if (psmouse->reconnect(psmouse))
 			return -1;
-	} else if (psmouse_probe(psmouse) != old_type)
+	} else if (psmouse_probe(psmouse) < 0 ||
+		   psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, 0))
 		return -1;
 
 	/* ok, the device type (and capabilities) match the old one,
 	 * we can continue using it, complete intialization
 	 */
-	psmouse->type = old_type;
 	psmouse_initialize(psmouse);
 
 	if (psmouse->ptport) {
diff -Nru a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
--- a/drivers/input/mouse/psmouse.h	Tue Jun 15 22:20:58 2004
+++ b/drivers/input/mouse/psmouse.h	Tue Jun 15 22:20:58 2004
@@ -22,6 +22,13 @@
 #define PSMOUSE_ACTIVATED	1
 #define PSMOUSE_IGNORE		2
 
+/* psmouse protocol handler return codes */
+typedef enum {
+	PSMOUSE_BAD_DATA,
+	PSMOUSE_GOOD_DATA,
+	PSMOUSE_FULL_PACKET
+} psmouse_ret_t;
+
 struct psmouse;
 
 struct psmouse_ptport {
@@ -45,6 +52,7 @@
 	unsigned char type;
 	unsigned char model;
 	unsigned long last;
+	unsigned long out_of_sync;
 	unsigned char state;
 	char acking;
 	volatile char ack;
@@ -52,6 +60,7 @@
 	char devname[64];
 	char phys[32];
 
+	psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse, struct pt_regs *regs); 
 	int (*reconnect)(struct psmouse *psmouse);
 	void (*disconnect)(struct psmouse *psmouse);
 };
@@ -65,10 +74,10 @@
 #define PSMOUSE_SYNAPTICS 	7
 
 int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command);
+int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command);
 int psmouse_reset(struct psmouse *psmouse);
 
 extern int psmouse_smartscroll;
 extern unsigned int psmouse_rate;
-extern unsigned int psmouse_resetafter;
 
 #endif /* _PSMOUSE_H */
diff -Nru a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
--- a/drivers/input/mouse/synaptics.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/mouse/synaptics.c	Tue Jun 15 22:20:39 2004
@@ -44,33 +44,11 @@
  ****************************************************************************/
 
 /*
- * Use the Synaptics extended ps/2 syntax to write a special command byte.
- * special command: 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu
- *                  is the command. A 0xF3 or 0xE9 must follow (see synaptics_send_cmd
- *                  and synaptics_mode_cmd)
- */
-static int synaptics_special_cmd(struct psmouse *psmouse, unsigned char command)
-{
-	int i;
-
-	if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11))
-		return -1;
-
-	for (i = 6; i >= 0; i -= 2) {
-		unsigned char d = (command >> i) & 3;
-		if (psmouse_command(psmouse, &d, PSMOUSE_CMD_SETRES))
-			return -1;
-	}
-
-	return 0;
-}
-
-/*
  * Send a command to the synpatics touchpad by special commands
  */
 static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param)
 {
-	if (synaptics_special_cmd(psmouse, c))
+	if (psmouse_sliced_command(psmouse, c))
 		return -1;
 	if (psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO))
 		return -1;
@@ -84,7 +62,7 @@
 {
 	unsigned char param[1];
 
-	if (synaptics_special_cmd(psmouse, mode))
+	if (psmouse_sliced_command(psmouse, mode))
 		return -1;
 	param[0] = SYN_PS_SET_MODE2;
 	if (psmouse_command(psmouse, param, PSMOUSE_CMD_SETRATE))
@@ -118,17 +96,31 @@
 
 	if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap))
 		return -1;
-	priv->capabilities = (cap[0]<<16) | (cap[1]<<8) | cap[2];
+	priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2];
 	priv->ext_cap = 0;
 	if (!SYN_CAP_VALID(priv->capabilities))
 		return -1;
 
-	if (SYN_EXT_CAP_REQUESTS(priv->capabilities)) {
+	/*
+	 * Unless capExtended is set the rest of the flags should be ignored
+	 */
+	if (!SYN_CAP_EXTENDED(priv->capabilities))
+		priv->capabilities = 0;
+
+	if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) {
 		if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) {
 			printk(KERN_ERR "Synaptics claims to have extended capabilities,"
 			       " but I'm not able to read them.");
-		} else
-			priv->ext_cap = (cap[0]<<16) | (cap[1]<<8) | cap[2];
+		} else {
+			priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
+
+			/*
+			 * if nExtBtn is greater than 8 it should be considered
+			 * invalid and treated as 0
+			 */
+			if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 8)
+				priv->ext_cap &= 0xff0fff;
+		}
 	}
 	return 0;
 }
@@ -167,11 +159,12 @@
 
 	if (SYN_CAP_EXTENDED(priv->capabilities)) {
 		printk(KERN_INFO " Touchpad has extended capability bits\n");
-		if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) &&
-		    SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) <= 8)
+		if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
 			printk(KERN_INFO " -> %d multi-buttons, i.e. besides standard buttons\n",
 			       (int)(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)));
-		else if (SYN_CAP_FOUR_BUTTON(priv->capabilities))
+		if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
+			printk(KERN_INFO " -> middle button\n");
+		if (SYN_CAP_FOUR_BUTTON(priv->capabilities))
 			printk(KERN_INFO " -> four buttons\n");
 		if (SYN_CAP_MULTIFINGER(priv->capabilities))
 			printk(KERN_INFO " -> multifinger detection\n");
@@ -219,21 +212,12 @@
 /*****************************************************************************
  *	Synaptics pass-through PS/2 port support
  ****************************************************************************/
-static int synaptics_pt_open(struct serio *port)
-{
-	return 0;
-}
-
-static void synaptics_pt_close(struct serio *port)
-{
-}
-
 static int synaptics_pt_write(struct serio *port, unsigned char c)
 {
 	struct psmouse *parent = port->driver;
 	char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */
 
-	if (synaptics_special_cmd(parent, c))
+	if (psmouse_sliced_command(parent, c))
 		return -1;
 	if (psmouse_command(parent, &rate_param, PSMOUSE_CMD_SETRATE))
 		return -1;
@@ -289,166 +273,12 @@
 	port->serio.name = "Synaptics pass-through";
 	port->serio.phys = "synaptics-pt/serio0";
 	port->serio.write = synaptics_pt_write;
-	port->serio.open = synaptics_pt_open;
-	port->serio.close = synaptics_pt_close;
 	port->serio.driver = psmouse;
 
 	port->activate = synaptics_pt_activate;
 }
 
 /*****************************************************************************
- *	Driver initialization/cleanup functions
- ****************************************************************************/
-
-static inline void set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
-{
-	dev->absmin[axis] = min;
-	dev->absmax[axis] = max;
-	dev->absfuzz[axis] = fuzz;
-	dev->absflat[axis] = flat;
-
-	set_bit(axis, dev->absbit);
-}
-
-static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
-{
-	set_bit(EV_ABS, dev->evbit);
-	set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0);
-	set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0);
-	set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
-	set_bit(ABS_TOOL_WIDTH, dev->absbit);
-
-	set_bit(EV_KEY, dev->evbit);
-	set_bit(BTN_TOUCH, dev->keybit);
-	set_bit(BTN_TOOL_FINGER, dev->keybit);
-	set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
-	set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
-
-	set_bit(BTN_LEFT, dev->keybit);
-	set_bit(BTN_RIGHT, dev->keybit);
-	set_bit(BTN_FORWARD, dev->keybit);
-	set_bit(BTN_BACK, dev->keybit);
-	if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) {
-		switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) {
-		default:
-			/*
-			 * if nExtBtn is greater than 8 it should be considered
-			 * invalid and treated as 0
-			 */
-			break;
-		case 8:
-			set_bit(BTN_7, dev->keybit);
-			set_bit(BTN_6, dev->keybit);
-		case 6:
-			set_bit(BTN_5, dev->keybit);
-			set_bit(BTN_4, dev->keybit);
-		case 4:
-			set_bit(BTN_3, dev->keybit);
-			set_bit(BTN_2, dev->keybit);
-		case 2:
-			set_bit(BTN_1, dev->keybit);
-			set_bit(BTN_0, dev->keybit);
-			break;
-		}
-	}
-
-	clear_bit(EV_REL, dev->evbit);
-	clear_bit(REL_X, dev->relbit);
-	clear_bit(REL_Y, dev->relbit);
-}
-
-void synaptics_reset(struct psmouse *psmouse)
-{
-	/* reset touchpad back to relative mode, gestures enabled */
-	synaptics_mode_cmd(psmouse, 0);
-}
-
-static void synaptics_disconnect(struct psmouse *psmouse)
-{
-	synaptics_reset(psmouse);
-	kfree(psmouse->private);
-}
-
-static int synaptics_reconnect(struct psmouse *psmouse)
-{
-	struct synaptics_data *priv = psmouse->private;
-	struct synaptics_data old_priv = *priv;
-
-	if (!synaptics_detect(psmouse))
-		return -1;
-
-	if (synaptics_query_hardware(psmouse)) {
-		printk(KERN_ERR "Unable to query Synaptics hardware.\n");
-		return -1;
-	}
-
-	if (old_priv.identity != priv->identity ||
-	    old_priv.model_id != priv->model_id ||
-	    old_priv.capabilities != priv->capabilities ||
-    	    old_priv.ext_cap != priv->ext_cap)
-    		return -1;
-
-	if (synaptics_set_mode(psmouse, 0)) {
-		printk(KERN_ERR "Unable to initialize Synaptics hardware.\n");
-		return -1;
-	}
-
-	return 0;
-}
-
-int synaptics_detect(struct psmouse *psmouse)
-{
-	unsigned char param[4];
-
-	param[0] = 0;
-
-	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
-	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
-	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
-	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
-	psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO);
-
-	return param[1] == 0x47;
-}
-
-int synaptics_init(struct psmouse *psmouse)
-{
-	struct synaptics_data *priv;
-
-	psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL);
-	if (!priv)
-		return -1;
-	memset(priv, 0, sizeof(struct synaptics_data));
-
-	if (synaptics_query_hardware(psmouse)) {
-		printk(KERN_ERR "Unable to query Synaptics hardware.\n");
-		goto init_fail;
-	}
-
-	if (synaptics_set_mode(psmouse, 0)) {
-		printk(KERN_ERR "Unable to initialize Synaptics hardware.\n");
-		goto init_fail;
-	}
-
-	priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
-
-	if (SYN_CAP_EXTENDED(priv->capabilities) && SYN_CAP_PASS_THROUGH(priv->capabilities))
-       		synaptics_pt_create(psmouse);
-
-	print_ident(priv);
-	set_input_params(&psmouse->dev, priv);
-
-	psmouse->disconnect = synaptics_disconnect;
-	psmouse->reconnect = synaptics_reconnect;
-
-	return 0;
-
- init_fail:
-	kfree(priv);
-	return -1;
-}
-
-/*****************************************************************************
  *	Functions to interpret the absolute mode packets
  ****************************************************************************/
 
@@ -471,17 +301,17 @@
 
 		hw->left  = (buf[0] & 0x01) ? 1 : 0;
 		hw->right = (buf[0] & 0x02) ? 1 : 0;
-		if (SYN_CAP_EXTENDED(priv->capabilities) &&
-		    (SYN_CAP_FOUR_BUTTON(priv->capabilities))) {
-			hw->up = ((buf[3] & 0x01)) ? 1 : 0;
-			if (hw->left)
-				hw->up = !hw->up;
-			hw->down = ((buf[3] & 0x02)) ? 1 : 0;
-			if (hw->right)
-				hw->down = !hw->down;
+
+		if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
+			hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
+
+		if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
+			hw->up   = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
+			hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0;
 		}
+
 		if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) &&
-		    ((buf[3] & 2) ? !hw->right : hw->right)) {
+		    ((buf[0] ^ buf[3]) & 0x02)) {
 			switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) {
 			default:
 				/*
@@ -490,17 +320,17 @@
 				 */
 				break;
 			case 8:
-				hw->b7 = ((buf[5] & 0x08)) ? 1 : 0;
-				hw->b6 = ((buf[4] & 0x08)) ? 1 : 0;
+				hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0;
+				hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0;
 			case 6:
-				hw->b5 = ((buf[5] & 0x04)) ? 1 : 0;
-				hw->b4 = ((buf[4] & 0x04)) ? 1 : 0;
+				hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0;
+				hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0;
 			case 4:
-				hw->b3 = ((buf[5] & 0x02)) ? 1 : 0;
-				hw->b2 = ((buf[4] & 0x02)) ? 1 : 0;
+				hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0;
+				hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0;
 			case 2:
-				hw->b1 = ((buf[5] & 0x01)) ? 1 : 0;
-				hw->b0 = ((buf[4] & 0x01)) ? 1 : 0;
+				hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0;
+				hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0;
 			}
 		}
 	} else {
@@ -525,6 +355,7 @@
 	struct synaptics_hw_state hw;
 	int num_fingers;
 	int finger_width;
+	int i;
 
 	synaptics_parse_hw_state(psmouse->packet, priv, &hw);
 
@@ -570,32 +401,20 @@
 	input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2);
 	input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3);
 
-	input_report_key(dev, BTN_LEFT,    hw.left);
-	input_report_key(dev, BTN_RIGHT,   hw.right);
-	input_report_key(dev, BTN_FORWARD, hw.up);
-	input_report_key(dev, BTN_BACK,    hw.down);
-	if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
-		switch(SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) {
-		default:
-			/*
-			 * if nExtBtn is greater than 8 it should be considered
-			 * invalid and treated as 0
-			 */
-			break;
-		case 8:
-			input_report_key(dev, BTN_7,       hw.b7);
-			input_report_key(dev, BTN_6,       hw.b6);
-		case 6:
-			input_report_key(dev, BTN_5,       hw.b5);
-			input_report_key(dev, BTN_4,       hw.b4);
-		case 4:
-			input_report_key(dev, BTN_3,       hw.b3);
-			input_report_key(dev, BTN_2,       hw.b2);
-		case 2:
-			input_report_key(dev, BTN_1,       hw.b1);
-			input_report_key(dev, BTN_0,       hw.b0);
-			break;
-		}
+	input_report_key(dev, BTN_LEFT, hw.left);
+	input_report_key(dev, BTN_RIGHT, hw.right);
+
+	if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
+		input_report_key(dev, BTN_MIDDLE, hw.middle);
+
+	if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
+		input_report_key(dev, BTN_FORWARD, hw.up);
+		input_report_key(dev, BTN_BACK, hw.down);
+	}
+
+	for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
+		input_report_key(dev, BTN_0 + i, hw.ext_buttons & (1 << i));
+
 	input_sync(dev);
 }
 
@@ -607,6 +426,9 @@
 	static unsigned char oldabs_mask[]	= { 0xC0, 0x60, 0x00, 0xC0, 0x60 };
 	static unsigned char oldabs_rslt[]	= { 0xC0, 0x00, 0x00, 0x80, 0x00 };
 
+	if (idx < 0 || idx > 4)
+		return 0;
+
 	switch (pkt_type) {
 		case SYN_NEWABS:
 		case SYN_NEWABS_RELAXED:
@@ -637,7 +459,7 @@
 	return SYN_NEWABS_STRICT;
 }
 
-void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs)
+static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs)
 {
 	struct input_dev *dev = &psmouse->dev;
 	struct synaptics_data *priv = psmouse->private;
@@ -645,11 +467,6 @@
 	input_regs(dev, regs);
 
 	if (psmouse->pktcnt >= 6) { /* Full packet received */
-		if (priv->out_of_sync) {
-			priv->out_of_sync = 0;
-			printk(KERN_NOTICE "Synaptics driver resynced.\n");
-		}
-
 		if (unlikely(priv->pkt_type == SYN_NEWABS))
 			priv->pkt_type = synaptics_detect_pkt_type(psmouse);
 
@@ -657,16 +474,142 @@
 			synaptics_pass_pt_packet(&psmouse->ptport->serio, psmouse->packet);
 		else
 			synaptics_process_packet(psmouse);
-		psmouse->pktcnt = 0;
 
-	} else if (psmouse->pktcnt &&
-		   !synaptics_validate_byte(psmouse->packet, psmouse->pktcnt - 1, priv->pkt_type)) {
-		printk(KERN_WARNING "Synaptics driver lost sync at byte %d\n", psmouse->pktcnt);
-		psmouse->pktcnt = 0;
-		if (++priv->out_of_sync == psmouse_resetafter) {
-			psmouse->state = PSMOUSE_IGNORE;
-			printk(KERN_NOTICE "synaptics: issuing reconnect request\n");
-			serio_reconnect(psmouse->serio);
-		}
+		return PSMOUSE_FULL_PACKET;
+	}
+
+	return synaptics_validate_byte(psmouse->packet, psmouse->pktcnt - 1, priv->pkt_type) ?
+		PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA;
+}
+
+/*****************************************************************************
+ *	Driver initialization/cleanup functions
+ ****************************************************************************/
+static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
+{
+	int i;
+
+	set_bit(EV_ABS, dev->evbit);
+	input_set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0);
+	input_set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0);
+	input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
+	set_bit(ABS_TOOL_WIDTH, dev->absbit);
+
+	set_bit(EV_KEY, dev->evbit);
+	set_bit(BTN_TOUCH, dev->keybit);
+	set_bit(BTN_TOOL_FINGER, dev->keybit);
+	set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
+	set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
+
+	set_bit(BTN_LEFT, dev->keybit);
+	set_bit(BTN_RIGHT, dev->keybit);
+
+	if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
+		set_bit(BTN_MIDDLE, dev->keybit);
+
+	if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
+		set_bit(BTN_FORWARD, dev->keybit);
+		set_bit(BTN_BACK, dev->keybit);
+	}
+
+	for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
+		set_bit(BTN_0 + i, dev->keybit);
+
+	clear_bit(EV_REL, dev->evbit);
+	clear_bit(REL_X, dev->relbit);
+	clear_bit(REL_Y, dev->relbit);
+}
+
+void synaptics_reset(struct psmouse *psmouse)
+{
+	/* reset touchpad back to relative mode, gestures enabled */
+	synaptics_mode_cmd(psmouse, 0);
+}
+
+static void synaptics_disconnect(struct psmouse *psmouse)
+{
+	synaptics_reset(psmouse);
+	kfree(psmouse->private);
+}
+
+static int synaptics_reconnect(struct psmouse *psmouse)
+{
+	struct synaptics_data *priv = psmouse->private;
+	struct synaptics_data old_priv = *priv;
+
+	if (!synaptics_detect(psmouse))
+		return -1;
+
+	if (synaptics_query_hardware(psmouse)) {
+		printk(KERN_ERR "Unable to query Synaptics hardware.\n");
+		return -1;
+	}
+
+	if (old_priv.identity != priv->identity ||
+	    old_priv.model_id != priv->model_id ||
+	    old_priv.capabilities != priv->capabilities ||
+	    old_priv.ext_cap != priv->ext_cap)
+		return -1;
+
+	if (synaptics_set_mode(psmouse, 0)) {
+		printk(KERN_ERR "Unable to initialize Synaptics hardware.\n");
+		return -1;
+	}
+
+	return 0;
+}
+
+int synaptics_detect(struct psmouse *psmouse)
+{
+	unsigned char param[4];
+
+	param[0] = 0;
+
+	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
+	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
+	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
+	psmouse_command(psmouse, param, PSMOUSE_CMD_SETRES);
+	psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO);
+
+	return param[1] == 0x47;
+}
+
+int synaptics_init(struct psmouse *psmouse)
+{
+	struct synaptics_data *priv;
+
+	psmouse->private = priv = kmalloc(sizeof(struct synaptics_data), GFP_KERNEL);
+	if (!priv)
+		return -1;
+	memset(priv, 0, sizeof(struct synaptics_data));
+
+	if (synaptics_query_hardware(psmouse)) {
+		printk(KERN_ERR "Unable to query Synaptics hardware.\n");
+		goto init_fail;
+	}
+
+	if (synaptics_set_mode(psmouse, 0)) {
+		printk(KERN_ERR "Unable to initialize Synaptics hardware.\n");
+		goto init_fail;
 	}
+
+	priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
+
+	if (SYN_CAP_PASS_THROUGH(priv->capabilities))
+		synaptics_pt_create(psmouse);
+
+	print_ident(priv);
+	set_input_params(&psmouse->dev, priv);
+
+	psmouse->protocol_handler = synaptics_process_byte;
+	psmouse->disconnect = synaptics_disconnect;
+	psmouse->reconnect = synaptics_reconnect;
+
+	return 0;
+
+ init_fail:
+	kfree(priv);
+	return -1;
 }
+
+
diff -Nru a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
--- a/drivers/input/mouse/synaptics.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/input/mouse/synaptics.h	Tue Jun 15 22:20:40 2004
@@ -9,7 +9,6 @@
 #ifndef _SYNAPTICS_H
 #define _SYNAPTICS_H
 
-extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs);
 extern int synaptics_detect(struct psmouse *psmouse);
 extern int synaptics_init(struct psmouse *psmouse);
 extern void synaptics_reset(struct psmouse *psmouse);
@@ -44,13 +43,14 @@
 
 /* synaptics capability bits */
 #define SYN_CAP_EXTENDED(c)		((c) & (1 << 23))
+#define SYN_CAP_MIDDLE_BUTTON(c)	((c) & (1 << 18))
 #define SYN_CAP_PASS_THROUGH(c)		((c) & (1 << 7))
 #define SYN_CAP_SLEEP(c)		((c) & (1 << 4))
 #define SYN_CAP_FOUR_BUTTON(c)		((c) & (1 << 3))
 #define SYN_CAP_MULTIFINGER(c)		((c) & (1 << 1))
 #define SYN_CAP_PALMDETECT(c)		((c) & (1 << 0))
 #define SYN_CAP_VALID(c)		((((c) & 0x00ff00) >> 8) == 0x47)
-#define SYN_EXT_CAP_REQUESTS(c)		((((c) & 0x700000) >> 20) == 1)
+#define SYN_EXT_CAP_REQUESTS(c)		(((c) & 0x700000) >> 20)
 #define SYN_CAP_MULTI_BUTTON_NO(ec)	(((ec) & 0x00f000) >> 12)
 
 /* synaptics modes query bits */
@@ -86,18 +86,12 @@
 	int y;
 	int z;
 	int w;
-	int left;
-	int right;
-	int up;
-	int down;
-	int b0;
-	int b1;
-	int b2;
-	int b3;
-	int b4;
-	int b5;
-	int b6;
-	int b7;
+	unsigned int left:1;
+	unsigned int right:1;
+	unsigned int middle:1;
+	unsigned int up:1;
+	unsigned int down:1;
+	unsigned char ext_buttons;
 };
 
 struct synaptics_data {
@@ -108,7 +102,6 @@
 	unsigned long int identity;		/* Identification */
 
 	/* Data for normal processing */
-	unsigned int out_of_sync;		/* # of packets out of sync */
 	int old_w;				/* Previous w value */
 	unsigned char pkt_type;			/* packet type - old, new, etc */
 };
diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
--- a/drivers/input/mousedev.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/input/mousedev.c	Tue Jun 15 22:21:02 2004
@@ -2,6 +2,7 @@
  * Input driver to ExplorerPS/2 device driver module.
  *
  * Copyright (c) 1999-2002 Vojtech Pavlik
+ * Copyright (c) 2004      Dmitry Torokhov
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as published by
@@ -47,15 +48,24 @@
 module_param(yres, uint, 0);
 MODULE_PARM_DESC(yres, "Vertical screen resolution");
 
+struct mousedev_motion {
+	int dx, dy, dz;
+};
+
 struct mousedev {
 	int exist;
 	int open;
 	int minor;
-	int misc;
 	char name[16];
 	wait_queue_head_t wait;
 	struct list_head list;
 	struct input_handle handle;
+
+	struct mousedev_motion packet;
+	unsigned long buttons;
+	unsigned int pkt_count;
+	int old_x[4], old_y[4];
+	unsigned int touch;
 };
 
 struct mousedev_list {
@@ -63,13 +73,10 @@
 	struct mousedev *mousedev;
 	struct list_head node;
 	int dx, dy, dz;
-	int old_x[4], old_y[4];
 	unsigned long buttons;
 	signed char ps2[6];
 	unsigned char ready, buffer, bufsiz;
 	unsigned char mode, imexseq, impsseq;
-	unsigned int pkt_count;
-	unsigned char touch;
 };
 
 #define MOUSEDEV_SEQ_LEN	6
@@ -82,135 +89,157 @@
 static struct mousedev *mousedev_table[MOUSEDEV_MINORS];
 static struct mousedev mousedev_mix;
 
-#define fx(i)  (list->old_x[(list->pkt_count - (i)) & 03])
-#define fy(i)  (list->old_y[(list->pkt_count - (i)) & 03])
+#define fx(i)  (mousedev->old_x[(mousedev->pkt_count - (i)) & 03])
+#define fy(i)  (mousedev->old_y[(mousedev->pkt_count - (i)) & 03])
 
-static void mousedev_abs_event(struct input_handle *handle, struct mousedev_list *list, unsigned int code, int value)
+static void mousedev_touchpad_event(struct mousedev *mousedev, unsigned int code, int value)
 {
-	int size;
-	int touchpad;
+	if (mousedev->touch) {
+		switch (code) {
+			case ABS_X:
+				fx(0) = value;
+				if (mousedev->pkt_count >= 2)
+					mousedev->packet.dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) / 8;
+				break;
 
-	/* Ignore joysticks */
-	if (test_bit(BTN_TRIGGER, handle->dev->keybit))
-		return;
+			case ABS_Y:
+				fy(0) = value;
+				if (mousedev->pkt_count >= 2)
+					mousedev->packet.dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) / 8;
+				break;
+		}
+	}
+}
 
-	touchpad = test_bit(BTN_TOOL_FINGER, handle->dev->keybit);
+static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, unsigned int code, int value)
+{
+	int size;
 
 	switch (code) {
 		case ABS_X:
-			if (touchpad) {
-				if (list->touch) {
-					fx(0) = value;
-					if (list->pkt_count >= 2)
-						list->dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) / 8;
-				}
-			} else {
-				size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X];
-				if (size == 0) size = xres;
-				list->dx += (value * xres - list->old_x[0]) / size;
-				list->old_x[0] += list->dx * size;
-			}
+			size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
+			if (size == 0) size = xres;
+			mousedev->packet.dx = (value * xres - mousedev->old_x[0]) / size;
+			mousedev->old_x[0] = mousedev->packet.dx * size;
 			break;
+
 		case ABS_Y:
-			if (touchpad) {
-				if (list->touch) {
-					fy(0) = value;
-					if (list->pkt_count >= 2)
-						list->dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) / 8;
-				}
-			} else {
-				size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
-				if (size == 0) size = yres;
-				list->dy -= (value * yres - list->old_y[0]) / size;
-				list->old_y[0] -= list->dy * size;
-			}
+			size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y];
+			if (size == 0) size = yres;
+			mousedev->packet.dy = (value * yres - mousedev->old_y[0]) / size;
+			mousedev->old_y[0] = mousedev->packet.dy * size;
 			break;
 	}
 }
 
-static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
+static void mousedev_rel_event(struct mousedev *mousedev, unsigned int code, int value)
+{
+	switch (code) {
+		case REL_X:	mousedev->packet.dx += value; break;
+		case REL_Y:	mousedev->packet.dy -= value; break;
+		case REL_WHEEL:	mousedev->packet.dz -= value; break;
+	}
+}
+
+static void mousedev_key_event(struct mousedev *mousedev, unsigned int code, int value)
+{
+	int index;
+
+	switch (code) {
+		case BTN_TOUCH:
+		case BTN_0:
+		case BTN_FORWARD:
+		case BTN_LEFT:		index = 0; break;
+		case BTN_STYLUS:
+		case BTN_1:
+		case BTN_RIGHT:		index = 1; break;
+		case BTN_2:
+		case BTN_STYLUS2:
+		case BTN_MIDDLE:	index = 2; break;
+		case BTN_3:
+		case BTN_BACK:
+		case BTN_SIDE:		index = 3; break;
+		case BTN_4:
+		case BTN_EXTRA:		index = 4; break;
+		default: 		return;
+	}
+
+	if (value) {
+		set_bit(index, &mousedev->buttons);
+		set_bit(index, &mousedev_mix.buttons);
+	} else {
+		clear_bit(index, &mousedev->buttons);
+		clear_bit(index, &mousedev_mix.buttons);
+	}
+}
+
+static void mousedev_notify_readers(struct mousedev *mousedev, struct mousedev_motion *packet)
 {
-	struct mousedev *mousedevs[3] = { handle->private, &mousedev_mix, NULL };
-	struct mousedev **mousedev = mousedevs;
 	struct mousedev_list *list;
-	int index, wake;
 
-	while (*mousedev) {
+	list_for_each_entry(list, &mousedev->list, node) {
+		list->dx += packet->dx;
+		list->dy += packet->dy;
+		list->dz += packet->dz;
+		list->buttons = mousedev->buttons;
+		list->ready = 1;
+		kill_fasync(&list->fasync, SIGIO, POLL_IN);
+	}
+
+	wake_up_interruptible(&mousedev->wait);
+}
+
+static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
+{
+	struct mousedev *mousedev = handle->private;
+
+	switch (type) {
+		case EV_ABS:
+			/* Ignore joysticks */
+			if (test_bit(BTN_TRIGGER, handle->dev->keybit))
+				return;
+
+			if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit))
+				mousedev_touchpad_event(mousedev, code, value);
+			else
+				mousedev_abs_event(handle->dev, mousedev, code, value);
 
-		wake = 0;
+			break;
 
-		list_for_each_entry(list, &(*mousedev)->list, node)
-			switch (type) {
-				case EV_ABS:
-					mousedev_abs_event(handle, list, code, value);
-					break;
-
-				case EV_REL:
-					switch (code) {
-						case REL_X:	list->dx += value; break;
-						case REL_Y:	list->dy -= value; break;
-						case REL_WHEEL:	if (list->mode) list->dz -= value; break;
-					}
-					break;
-
-				case EV_KEY:
-					if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) {
-						/* Handle touchpad data */
-						list->touch = value;
-						if (!list->touch)
-							list->pkt_count = 0;
-						break;
-					}
-
-					switch (code) {
-						case BTN_TOUCH:
-						case BTN_0:
-						case BTN_FORWARD:
-						case BTN_LEFT:   index = 0; break;
-						case BTN_4:
-						case BTN_EXTRA:  if (list->mode == 2) { index = 4; break; }
-						case BTN_STYLUS:
-						case BTN_1:
-						case BTN_RIGHT:  index = 1; break;
-						case BTN_3:
-						case BTN_BACK:
-						case BTN_SIDE:   if (list->mode == 2) { index = 3; break; }
-						case BTN_2:
-						case BTN_STYLUS2:
-						case BTN_MIDDLE: index = 2; break;	
-						default: return;
-					}
-					switch (value) {
-						case 0: clear_bit(index, &list->buttons); break;
-						case 1: set_bit(index, &list->buttons); break;
-						case 2: return;
-					}
-					break;
-
-				case EV_SYN:
-					switch (code) {
-						case SYN_REPORT:
-							if (list->touch) {
-								list->pkt_count++;
-								/* Input system eats duplicate events,
-								 * but we need all of them to do correct
-								 * averaging so apply present one forward
-								 */
-								fx(0) = fx(1);
-								fy(0) = fy(1);
-							}
-
-							list->ready = 1;
-							kill_fasync(&list->fasync, SIGIO, POLL_IN);
-							wake = 1;
-							break;
-					}
+		case EV_REL:
+			mousedev_rel_event(mousedev, code, value);
+			break;
+
+		case EV_KEY:
+			if (value != 2) {
+				if (code == BTN_TOUCH && test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) {
+					/* Handle touchpad data */
+					mousedev->touch = value;
+					if (!mousedev->touch)
+						mousedev->pkt_count = 0;
+				}
+				else
+					mousedev_key_event(mousedev, code, value);
 			}
+			break;
 
-		if (wake)
-			wake_up_interruptible(&((*mousedev)->wait));
+		case EV_SYN:
+			if (code == SYN_REPORT) {
+				if (mousedev->touch) {
+					mousedev->pkt_count++;
+					/* Input system eats duplicate events, but we need all of them
+					 * to do correct averaging so apply present one forward
+			 		 */
+					fx(0) = fx(1);
+					fy(0) = fy(1);
+				}
+
+				mousedev_notify_readers(mousedev, &mousedev->packet);
+				mousedev_notify_readers(&mousedev_mix, &mousedev->packet);
 
-		mousedev++;
+				memset(&mousedev->packet, 0, sizeof(struct mousedev_motion));
+			}
+			break;
 	}
 }
 
@@ -267,7 +296,7 @@
 				mousedev_free(list->mousedev);
 		}
 	}
-	
+
 	kfree(list);
 	return 0;
 }
@@ -301,11 +330,11 @@
 		if (list->mousedev->minor == MOUSEDEV_MIX) {
 			list_for_each_entry(handle, &mousedev_handler.h_list, h_node) {
 				mousedev = handle->private;
-				if (!mousedev->open && mousedev->exist)	
+				if (!mousedev->open && mousedev->exist)
 					input_open_device(handle);
 			}
-		} else 
-			if (!mousedev_mix.open && list->mousedev->exist)	
+		} else
+			if (!mousedev_mix.open && list->mousedev->exist)
 				input_open_device(&list->mousedev->handle);
 	}
 
@@ -326,8 +355,10 @@
 		list->dz -= list->ps2[off + 3];
 		list->ps2[off + 3] = (list->ps2[off + 3] & 0x0f) | ((list->buttons & 0x18) << 1);
 		list->bufsiz++;
+	} else {
+		list->ps2[off] |= ((list->buttons & 0x10) >> 3) | ((list->buttons & 0x08) >> 1);
 	}
-	
+
 	if (list->mode == 1) {
 		list->ps2[off + 3] = (list->dz > 127 ? 127 : (list->dz < -127 ? -127 : list->dz));
 		list->dz -= list->ps2[off + 3];
@@ -339,7 +370,7 @@
 }
 
 
-static ssize_t mousedev_write(struct file * file, const char * buffer, size_t count, loff_t *ppos)
+static ssize_t mousedev_write(struct file * file, const char __user * buffer, size_t count, loff_t *ppos)
 {
 	struct mousedev_list *list = file->private_data;
 	unsigned char c;
@@ -391,9 +422,9 @@
 				list->impsseq = 0;
 				list->imexseq = 0;
 				list->mode = 0;
-				list->ps2[0] = 0xaa;
-				list->ps2[1] = 0x00;
-				list->bufsiz = 2;
+				list->ps2[1] = 0xaa;
+				list->ps2[2] = 0x00;
+				list->bufsiz = 3;
 				break;
 		}
 
@@ -403,11 +434,11 @@
 	kill_fasync(&list->fasync, SIGIO, POLL_IN);
 
 	wake_up_interruptible(&list->mousedev->wait);
-		
+
 	return count;
 }
 
-static ssize_t mousedev_read(struct file * file, char * buffer, size_t count, loff_t *ppos)
+static ssize_t mousedev_read(struct file * file, char __user * buffer, size_t count, loff_t *ppos)
 {
 	struct mousedev_list *list = file->private_data;
 	int retval = 0;
@@ -431,7 +462,7 @@
 	if (copy_to_user(buffer, list->ps2 + list->bufsiz - list->buffer - count, count))
 		return -EFAULT;
 
-	return count;	
+	return count;
 }
 
 /* No kernel lock - fine */
@@ -487,7 +518,7 @@
 
 	devfs_mk_cdev(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor),
 			S_IFCHR|S_IRUGO|S_IWUSR, "input/mouse%d", minor);
-	class_simple_device_add(input_class, 
+	class_simple_device_add(input_class,
 				MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor),
 				dev->dev, "mouse%d", minor);
 
@@ -538,7 +569,7 @@
 };
 
 MODULE_DEVICE_TABLE(input, mousedev_ids);
-	
+
 static struct input_handler mousedev_handler = {
 	.event =	mousedev_event,
 	.connect =	mousedev_connect,
@@ -553,6 +584,7 @@
 static struct miscdevice psaux_mouse = {
 	PSMOUSE_MINOR, "psaux", &mousedev_fops
 };
+static int psaux_registered;
 #endif
 
 static int __init mousedev_init(void)
@@ -572,7 +604,7 @@
 				NULL, "mice");
 
 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
-	if (!(mousedev_mix.misc = !misc_register(&psaux_mouse)))
+	if (!(psaux_registered = !misc_register(&psaux_mouse)))
 		printk(KERN_WARNING "mice: could not misc_register the device\n");
 #endif
 
@@ -584,7 +616,7 @@
 static void __exit mousedev_exit(void)
 {
 #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
-	if (mousedev_mix.misc)
+	if (psaux_registered)
 		misc_deregister(&psaux_mouse);
 #endif
 	devfs_remove("input/mice");
diff -Nru a/drivers/input/power.c b/drivers/input/power.c
--- a/drivers/input/power.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/input/power.c	Tue Jun 15 22:20:43 2004
@@ -1,7 +1,7 @@
 /*
  * $Id: power.c,v 1.10 2001/09/25 09:17:15 vojtech Exp $
  *
- *  Copyright (c) 2001 "Crazy" James Simmons  
+ *  Copyright (c) 2001 "Crazy" James Simmons
  *
  *  Input driver Power Management.
  *
@@ -51,7 +51,7 @@
 
 static DECLARE_WORK(suspend_button_task, suspend_button_task_handler, NULL);
 
-static void power_event(struct input_handle *handle, unsigned int type, 
+static void power_event(struct input_handle *handle, unsigned int type,
 		        unsigned int code, int down)
 {
 	struct input_dev *dev = handle->dev;
@@ -73,7 +73,7 @@
 			case KEY_POWER:
 				/* Hum power down the machine. */
 				break;
-			default:	
+			default:
 				return;
 		}
 	} else {
@@ -83,9 +83,9 @@
 				/* This is risky. See pm.h for details. */
 				if (dev->state != PM_RESUME)
 					dev->state = PM_RESUME;
-				else 
-					dev->state = PM_SUSPEND;	
-				pm_send(dev->pm_dev, dev->state, dev); 	
+				else
+					dev->state = PM_SUSPEND;
+				pm_send(dev->pm_dev, dev->state, dev);
 				break;
 			case KEY_POWER:
 				/* Turn the input device off completely ? */
@@ -97,14 +97,14 @@
 	return;
 }
 
-static struct input_handle *power_connect(struct input_handler *handler, 
-					  struct input_dev *dev, 
+static struct input_handle *power_connect(struct input_handler *handler,
+					  struct input_dev *dev,
 					  struct input_device_id *id)
 {
 	struct input_handle *handle;
 
 	if (!test_bit(EV_KEY, dev->evbit) || !test_bit(EV_PWR, dev->evbit))
-		return NULL;	
+		return NULL;
 
 	if (!test_bit(KEY_SUSPEND, dev->keybit) || (!test_bit(KEY_POWER, dev->keybit)))
 		return NULL;
@@ -133,21 +133,21 @@
 		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
 		.evbit = { BIT(EV_KEY) },
 		.keybit = { [LONG(KEY_SUSPEND)] = BIT(KEY_SUSPEND) }
-	},	
+	},
 	{
 		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
 		.evbit = { BIT(EV_KEY) },
 		.keybit = { [LONG(KEY_POWER)] = BIT(KEY_POWER) }
-	},	
+	},
 	{
 		.flags = INPUT_DEVICE_ID_MATCH_EVBIT,
 		.evbit = { BIT(EV_PWR) },
-	},	
+	},
 	{ }, 	/* Terminating entry */
 };
 
 MODULE_DEVICE_TABLE(input, power_ids);
-	
+
 static struct input_handler power_handler = {
 	.event =	power_event,
 	.connect =	power_connect,
@@ -172,3 +172,4 @@
 
 MODULE_AUTHOR("James Simmons <jsimmons@transvirtual.com>");
 MODULE_DESCRIPTION("Input Power Management driver");
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/input/serio/98kbd-io.c b/drivers/input/serio/98kbd-io.c
--- a/drivers/input/serio/98kbd-io.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/serio/98kbd-io.c	Tue Jun 15 22:20:36 2004
@@ -42,8 +42,8 @@
  * Register numbers.
  */
 
-#define KBD98_COMMAND_REG	0x43	
-#define KBD98_STATUS_REG	0x43	
+#define KBD98_COMMAND_REG	0x43
+#define KBD98_STATUS_REG	0x43
 #define KBD98_DATA_REG		0x41
 
 spinlock_t kbd98io_lock = SPIN_LOCK_UNLOCKED;
@@ -51,7 +51,7 @@
 static struct serio kbd98_port;
 extern struct pt_regs *kbd_pt_regs;
 
-static void kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 
 /*
  * kbd98_flush() flushes all data that may be in the keyboard buffers
@@ -143,7 +143,7 @@
  * to the upper layers.
  */
 
-static void kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t kbd98io_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	unsigned long flags;
 	unsigned char data;
@@ -154,6 +154,7 @@
 	spin_unlock_irqrestore(&kbd98io_lock, flags);
 	serio_interrupt(&kbd98_port, data, 0, regs);
 
+	return IRQ_HANDLED;
 }
 
 int __init kbd98io_init(void)
diff -Nru a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c
--- a/drivers/input/serio/ct82c710.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/serio/ct82c710.c	Tue Jun 15 22:20:36 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
diff -Nru a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
--- a/drivers/input/serio/gscps2.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/input/serio/gscps2.c	Tue Jun 15 22:21:04 2004
@@ -16,7 +16,7 @@
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
- * 
+ *
  * TODO:
  * - Dino testing (did HP ever shipped a machine on which this port
  *                 was usable/enabled ?)
@@ -44,7 +44,7 @@
 
 #define PFX "gscps2.c: "
 
-/* 
+/*
  * Driver constants
  */
 
@@ -222,7 +222,7 @@
 /**
  * gscps2_interrupt() - Interruption service routine
  *
- * This function reads received PS/2 bytes and processes them on 
+ * This function reads received PS/2 bytes and processes them on
  * all interfaces.
  * The problematic part here is, that the keyboard and mouse PS/2 port
  * share the same interrupt and it's not possible to send data if any
@@ -240,9 +240,9 @@
 	  unsigned long flags;
 	  spin_lock_irqsave(&ps2port->lock, flags);
 
-	  while ( (ps2port->buffer[ps2port->append].str = 
+	  while ( (ps2port->buffer[ps2port->append].str =
 		   gscps2_readb_status(ps2port->addr)) & GSC_STAT_RBNE ) {
-		ps2port->buffer[ps2port->append].data = 
+		ps2port->buffer[ps2port->append].data =
 				gscps2_readb_input(ps2port->addr);
 		ps2port->append = ((ps2port->append+1) & BUFFER_SIZE);
 	  }
@@ -349,7 +349,7 @@
 
 	if (!dev->irq)
 		return -ENODEV;
-	
+
 	/* Offset for DINO PS/2. Works with LASI even */
 	if (dev->id.sversion == 0x96)
 		hpa += GSC_DINO_OFFSET;
@@ -368,7 +368,7 @@
 	gscps2_reset(ps2port);
 	ps2port->id = readb(ps2port->addr+GSC_ID) & 0x0f;
 	snprintf(ps2port->name, sizeof(ps2port->name)-1, "%s %s",
-		gscps2_serio_port.name, 
+		gscps2_serio_port.name,
 		(ps2port->id == GSC_ID_KEYBOARD) ? "keyboard" : "mouse" );
 
 	memcpy(&ps2port->port, &gscps2_serio_port, sizeof(gscps2_serio_port));
@@ -401,9 +401,9 @@
 		ps2port->port.phys);
 
 	serio_register_port(&ps2port->port);
-	
+
 	return 0;
-	
+
 fail:
 	free_irq(dev->irq, ps2port);
 
@@ -430,7 +430,7 @@
 	list_del(&ps2port->node);
 	iounmap(ps2port->addr);
 #if 0
-	release_mem_region(dev->hpa, GSC_STATUS + 4); 
+	release_mem_region(dev->hpa, GSC_STATUS + 4);
 #endif
 	dev_set_drvdata(&dev->dev, NULL);
 	kfree(ps2port);
@@ -441,7 +441,7 @@
 static struct parisc_device_id gscps2_device_tbl[] = {
 	{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00084 }, /* LASI PS/2 */
 #ifdef DINO_TESTED
-	{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00096 }, /* DINO PS/2 */ 
+	{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00096 }, /* DINO PS/2 */
 #endif
 	{ 0, }	/* 0 terminated list */
 };
diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/serio/i8042.c	Tue Jun 15 22:20:36 2004
@@ -150,7 +150,7 @@
  */
 
 static int i8042_command(unsigned char *param, int command)
-{ 
+{
 	unsigned long flags;
 	int retval = 0, i = 0;
 
@@ -161,7 +161,7 @@
 		dbg("%02x -> i8042 (command)", command & 0xff);
 		i8042_write_command(command & 0xff);
 	}
-	
+
 	if (!retval)
 		for (i = 0; i < ((command >> 12) & 0xf); i++) {
 			if ((retval = i8042_wait_write())) break;
@@ -172,7 +172,7 @@
 	if (!retval)
 		for (i = 0; i < ((command >> 8) & 0xf); i++) {
 			if ((retval = i8042_wait_read())) break;
-			if (i8042_read_status() & I8042_STR_AUXDATA) 
+			if (i8042_read_status() & I8042_STR_AUXDATA)
 				param[i] = ~i8042_read_data();
 			else
 				param[i] = i8042_read_data();
@@ -415,17 +415,17 @@
 		} else dfl = 0;
 
 		dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)",
-			data, (str >> 6), irq, 
+			data, (str >> 6), irq,
 			dfl & SERIO_PARITY ? ", bad parity" : "",
 			dfl & SERIO_TIMEOUT ? ", timeout" : "");
 
 		serio_interrupt(i8042_mux_port + ((str >> 6) & 3), data, dfl, regs);
-		
+
 		goto irq_ret;
 	}
 
 	dbg("%02x <- i8042 (interrupt, %s, %d%s%s)",
-		data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, 
+		data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq,
 		dfl & SERIO_PARITY ? ", bad parity" : "",
 		dfl & SERIO_TIMEOUT ? ", timeout" : "");
 
@@ -474,8 +474,17 @@
 	if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0xa9)
 		return -1;
 	param = 0xa4;
-	if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == 0x5b)
+	if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == 0x5b) {
+
+/*
+ * Do another loop test with the 0x5a value. Doing anything else upsets
+ * Profusion/ServerWorks OSB4 chipsets.
+ */
+
+		param = 0x5a;
+		i8042_command(&param, I8042_CMD_AUX_LOOP);
 		return -1;
+	}
 
 	if (mux_version)
 		*mux_version = ~param;
@@ -530,10 +539,10 @@
 
 	if (i8042_enable_mux_mode(values, &mux_version))
 		return -1;
-	
+
 	/* Workaround for broken chips which seem to support MUX, but in reality don't. */
-	/* They all report version 12.10 */
-	if (mux_version == 0xCA)
+	/* They all report version 10.12 */
+	if (mux_version == 0xAC)
 		return -1;
 
 	printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n",
@@ -598,7 +607,7 @@
 /*
  * Bit assignment test - filters out PS/2 i8042's in AT mode
  */
-	
+
 	if (i8042_command(&param, I8042_CMD_AUX_DISABLE))
 		return -1;
 	if (i8042_command(&param, I8042_CMD_CTL_RCTR) || (~param & I8042_CTR_AUXDIS)) {
@@ -609,7 +618,7 @@
 	if (i8042_command(&param, I8042_CMD_AUX_ENABLE))
 		return -1;
 	if (i8042_command(&param, I8042_CMD_CTL_RCTR) || (param & I8042_CTR_AUXDIS))
-		return -1;	
+		return -1;
 
 /*
  * Disable the interface.
@@ -639,7 +648,7 @@
 	if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
 		printk(KERN_WARNING "i8042.c: Can't write CTR while registering.\n");
 		values->exists = 0;
-		return -1; 
+		return -1;
 	}
 
 	printk(KERN_INFO "serio: i8042 %s port at %#lx,%#lx irq %d\n",
@@ -868,7 +877,7 @@
 static int i8042_notify_sys(struct notifier_block *this, unsigned long code,
         		    void *unused)
 {
-        if (code==SYS_DOWN || code==SYS_HALT) 
+        if (code == SYS_DOWN || code == SYS_HALT)
         	i8042_controller_cleanup();
         return NOTIFY_DONE;
 }
@@ -997,19 +1006,18 @@
 		sysdev_class_unregister(&kbc_sysclass);
 	}
 
-	del_timer_sync(&i8042_timer);
-
 	i8042_controller_cleanup();
-	
+
 	if (i8042_kbd_values.exists)
 		serio_unregister_port(&i8042_kbd_port);
 
 	if (i8042_aux_values.exists)
 		serio_unregister_port(&i8042_aux_port);
-	
+
 	for (i = 0; i < 4; i++)
 		if (i8042_mux_values[i].exists)
 			serio_unregister_port(i8042_mux_port + i);
+	del_timer_sync(&i8042_timer);
 
 	i8042_platform_exit();
 }
diff -Nru a/drivers/input/serio/parkbd.c b/drivers/input/serio/parkbd.c
--- a/drivers/input/serio/parkbd.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/serio/parkbd.c	Tue Jun 15 22:20:36 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -86,20 +86,9 @@
 	return 0;
 }
 
-static int parkbd_open(struct serio *port)
-{
-	return 0;
-}
-
-static void parkbd_close(struct serio *port)
-{
-}
-
 static struct serio parkbd_port =
 {
 	.write	= parkbd_write,
-	.open	= parkbd_open,
-	.close	= parkbd_close,
 	.name	= parkbd_name,
 	.phys	= parkbd_phys,
 };
@@ -115,7 +104,7 @@
 			parkbd_writing = 0;
 			parkbd_writelines(3);
 			return;
-		}	
+		}
 
 		parkbd_writelines(((parkbd_buffer >> parkbd_counter++) & 1) | 2);
 
@@ -131,7 +120,7 @@
 		if ((parkbd_counter == parkbd_mode + 10) || time_after(jiffies, parkbd_last + HZ/100)) {
 			parkbd_counter = 0;
 			parkbd_buffer = 0;
-		}	
+		}
 
 		parkbd_buffer |= (parkbd_readlines() >> 1) << parkbd_counter++;
 
diff -Nru a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c
--- a/drivers/input/serio/q40kbd.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/input/serio/q40kbd.c	Tue Jun 15 22:20:38 2004
@@ -4,7 +4,7 @@
  *  Copyright (c) 2000-2001 Vojtech Pavlik
  *
  *  Based on the work of:
- *	Richard Zidlicky <Richard.Zidlicky@stud.informatik.uni-erlangen.de>	
+ *	Richard Zidlicky <Richard.Zidlicky@stud.informatik.uni-erlangen.de>
  */
 
 /*
@@ -47,23 +47,12 @@
 MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver");
 MODULE_LICENSE("GPL");
 
-
-static int q40kbd_open(struct serio *port)
-{
-	return 0;
-}
-static void q40kbd_close(struct serio *port)
-{
-}
-
 static struct serio q40kbd_port =
 {
 	.type	= SERIO_8042,
 	.name	= "Q40 kbd port",
 	.phys	= "Q40",
 	.write	= NULL,
-	.open	= q40kbd_open,
-	.close	= q40kbd_close,
 };
 
 static irqreturn_t q40kbd_interrupt(int irq, void *dev_id,
diff -Nru a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c
--- a/drivers/input/serio/rpckbd.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/serio/rpckbd.c	Tue Jun 15 22:20:36 2004
@@ -98,7 +98,7 @@
 static void rpckbd_close(struct serio *port)
 {
 	free_irq(IRQ_KEYBOARDRX, port);
-	free_irq(IRQ_KEYBOARDTX, port);	
+	free_irq(IRQ_KEYBOARDTX, port);
 }
 
 static struct serio rpckbd_port =
diff -Nru a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
--- a/drivers/input/serio/sa1111ps2.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/input/serio/sa1111ps2.c	Tue Jun 15 22:20:40 2004
@@ -45,7 +45,6 @@
 {
 	struct ps2if *ps2if = dev_id;
 	unsigned int scancode, flag, status;
-	int handled = IRQ_NONE;
 
 	status = sa1111_readl(ps2if->base + SA1111_PS2STAT);
 	while (status & PS2STAT_RXF) {
@@ -63,11 +62,9 @@
 		serio_interrupt(&ps2if->io, scancode, flag, regs);
 
 		status = sa1111_readl(ps2if->base + SA1111_PS2STAT);
-
-		handled = IRQ_HANDLED;
         }
 
-        return handled;
+        return IRQ_HANDLED;
 }
 
 /*
diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
--- a/drivers/input/serio/serio.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/input/serio/serio.c	Tue Jun 15 22:20:36 2004
@@ -11,18 +11,18 @@
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or 
+ * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * 
+ *
  * Should you need to contact me, the author, you can do so either by
  * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -108,7 +108,7 @@
 	struct serio_event *event;
 
 	list_for_each_safe(node, next, &serio_event_list) {
-		event = container_of(node, struct serio_event, node);	
+		event = container_of(node, struct serio_event, node);
 
 		down(&serio_sem);
 		if (event->serio == NULL)
@@ -152,7 +152,7 @@
 
 	do {
 		serio_handle_events();
-		wait_event_interruptible(serio_wait, !list_empty(&serio_event_list)); 
+		wait_event_interruptible(serio_wait, !list_empty(&serio_event_list));
 		if (current->flags & PF_FREEZE)
 			refrigerator(PF_FREEZE);
 	} while (!signal_pending(current));
@@ -293,7 +293,7 @@
 int serio_open(struct serio *serio, struct serio_dev *dev)
 {
 	serio->dev = dev;
-	if (serio->open(serio)) {
+	if (serio->open && serio->open(serio)) {
 		serio->dev = NULL;
 		return -1;
 	}
@@ -303,7 +303,8 @@
 /* called from serio_dev->connect/disconnect methods under serio_sem */
 void serio_close(struct serio *serio)
 {
-	serio->close(serio);
+	if (serio->close)
+		serio->close(serio);
 	serio->dev = NULL;
 }
 
diff -Nru a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c
--- a/drivers/input/serio/serport.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/input/serio/serport.c	Tue Jun 15 22:20:58 2004
@@ -48,11 +48,6 @@
 	return -(serport->tty->driver->write(serport->tty, 0, &data, 1) != 1);
 }
 
-static int serport_serio_open(struct serio *serio)
-{
-        return 0;
-}
-
 static void serport_serio_close(struct serio *serio)
 {
 	struct serport *serport = serio->driver;
@@ -87,7 +82,6 @@
 
 	serport->serio.type = SERIO_RS232;
 	serport->serio.write = serport_serio_write;
-	serport->serio.open = serport_serio_open;
 	serport->serio.close = serport_serio_close;
 	serport->serio.driver = serport;
 
@@ -135,12 +129,12 @@
 }
 
 /*
- * serport_ldisc_read() just waits indefinitely if everything goes well. 
+ * serport_ldisc_read() just waits indefinitely if everything goes well.
  * However, when the serio driver closes the serio port, it finishes,
  * returning 0 characters.
  */
 
-static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, unsigned char * buf, size_t nr)
+static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, unsigned char __user * buf, size_t nr)
 {
 	struct serport *serport = (struct serport*) tty->disc_data;
 	char name[64];
@@ -165,9 +159,9 @@
 static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg)
 {
 	struct serport *serport = (struct serport*) tty->disc_data;
-	
+
 	if (cmd == SPIOCSTYPE)
-		return get_user(serport->serio.type, (unsigned long *) arg);
+		return get_user(serport->serio.type, (unsigned long __user *) arg);
 
 	return -EINVAL;
 }
diff -Nru a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
--- a/drivers/input/touchscreen/gunze.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/input/touchscreen/gunze.c	Tue Jun 15 22:20:39 2004
@@ -124,12 +124,10 @@
 	memset(gunze, 0, sizeof(struct gunze));
 
 	init_input_dev(&gunze->dev);
-	gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);	
-	gunze->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
+	gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 	gunze->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
-
-	gunze->dev.absmin[ABS_X] = 96;   gunze->dev.absmin[ABS_Y] = 72;
-	gunze->dev.absmax[ABS_X] = 4000; gunze->dev.absmax[ABS_Y] = 3000;
+	input_set_abs_params(&gunze->dev, ABS_X, 96, 4000, 0, 0);
+	input_set_abs_params(&gunze->dev, ABS_Y, 72, 3000, 0, 0);
 
 	gunze->serio = serio;
 	serio->private = gunze;
diff -Nru a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
--- a/drivers/input/touchscreen/h3600_ts_input.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/input/touchscreen/h3600_ts_input.c	Tue Jun 15 22:20:44 2004
@@ -1,11 +1,11 @@
 /*
  * $Id: h3600_ts_input.c,v 1.4 2002/01/23 06:39:37 jsimmons Exp $
  *
- *  Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com 
+ *  Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com
  *
- *  Sponsored by Transvirtual Technology. 
- * 
- *  Derived from the code in h3600_ts.[ch] by Charles Flynn  
+ *  Sponsored by Transvirtual Technology.
+ *
+ *  Derived from the code in h3600_ts.[ch] by Charles Flynn
  */
 
 /*
@@ -45,6 +45,10 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/irqs.h>
 
+MODULE_AUTHOR("James Simmons <jsimmons@transvirtual.com>");
+MODULE_DESCRIPTION("H3600 touchscreen driver");
+MODULE_LICENSE("GPL");
+
 /*
  * Definitions & global arrays.
  */
@@ -75,7 +79,7 @@
 #define MAX_ID                  14
 
 #define H3600_MAX_LENGTH 16
-#define H3600_KEY 0xf 
+#define H3600_KEY 0xf
 
 #define H3600_SCANCODE_RECORD	1	 /* 1 -> record button */
 #define H3600_SCANCODE_CALENDAR 2	 /* 2 -> calendar */
@@ -103,7 +107,7 @@
 	char phys[32];
 };
 
-static void action_button_handler(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t action_button_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
         int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1;
 	struct input_dev *dev = (struct input_dev *) dev_id;
@@ -111,21 +115,25 @@
 	input_regs(dev, regs);
 	input_report_key(dev, KEY_ENTER, down);
 	input_sync(dev);
+
+	return IRQ_HANDLED;
 }
 
-static void npower_button_handler(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t npower_button_handler(int irq, void *dev_id, struct pt_regs *regs)
 {
         int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1;
 	struct input_dev *dev = (struct input_dev *) dev_id;
 
-	/* 
-	 * This interrupt is only called when we release the key. So we have 
+	/*
+	 * This interrupt is only called when we release the key. So we have
 	 * to fake a key press.
-	 */ 	
+	 */
 	input_regs(dev, regs);
 	input_report_key(dev, KEY_SUSPEND, 1);
-	input_report_key(dev, KEY_SUSPEND, down); 	
+	input_report_key(dev, KEY_SUSPEND, down);
 	input_sync(dev);
+
+	return IRQ_HANDLED;
 }
 
 #ifdef CONFIG_PM
@@ -141,21 +149,21 @@
  * h3600_flite_power: enables or disables power to frontlight, using last bright */
 unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr)
 {
-	unsigned char brightness = ((pwr==FLITE_PWR_OFF) ? 0:flite_brightness);
+	unsigned char brightness = (pwr == FLITE_PWR_OFF) ? 0 : flite_brightness;
 	struct h3600_dev *ts = dev->private;
 
-	/* Must be in this order */	
+	/* Must be in this order */
        	ts->serio->write(ts->serio, 1);
 	ts->serio->write(ts->serio, pwr);
-      	ts->serio->write(ts->serio, brightness); 
+      	ts->serio->write(ts->serio, brightness);
 	return 0;
 }
 
 static int suspended = 0;
-static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req, 
+static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req,
 				void *data)
 {
-	struct input_dev *dev = (struct input_dev *) data;	
+	struct input_dev *dev = (struct input_dev *) data;
 
         switch (req) {
         case PM_SUSPEND: /* enter D1-D3 */
@@ -183,7 +191,7 @@
 /*
  * This function translates the native event packets to linux input event
  * packets. Some packets coming from serial are not touchscreen related. In
- * this case we send them off to be processed elsewhere. 
+ * this case we send them off to be processed elsewhere.
  */
 static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs)
 {
@@ -206,7 +214,7 @@
                 Note: This is true for non interrupt generated key events.
                 */
                 case KEYBD_ID:
-			down = (ts->buf[0] & 0x80) ? 0 : 1; 
+			down = (ts->buf[0] & 0x80) ? 0 : 1;
 
 			switch (ts->buf[0] & 0x7f) {
 				case H3600_SCANCODE_RECORD:
@@ -218,7 +226,7 @@
 				case H3600_SCANCODE_CONTACTS:
 					key = KEY_PROG2;
                                         break;
-				case H3600_SCANCODE_Q:        
+				case H3600_SCANCODE_Q:
 					key = KEY_Q;
                                         break;
 				case H3600_SCANCODE_START:
@@ -237,9 +245,9 @@
 					key = KEY_DOWN;
                                         break;
 				default:
-					key = 0;	
-			}	
-                        if (key) 
+					key = 0;
+			}
+                        if (key)
                         	input_report_key(dev, key, down);
                         break;
                 /*
@@ -251,13 +259,13 @@
                  *       byte 0    1       2       3
                  */
                 case TOUCHS_ID:
-			if (!touched) { 
+			if (!touched) {
 				input_report_key(dev, BTN_TOUCH, 1);
 				touched = 1;
-			}			
+			}
 
 			if (ts->len) {
-				unsigned short x, y;				
+				unsigned short x, y;
 
 				x = ts->buf[0]; x <<= 8; x += ts->buf[1];
                                 y = ts->buf[2]; y <<= 8; y += ts->buf[3];
@@ -267,7 +275,7 @@
 			} else {
 		               	input_report_key(dev, BTN_TOUCH, 0);
 				touched = 0;
-			}	
+			}
                         break;
 		default:
 			/* Send a non input event elsewhere */
@@ -280,7 +288,7 @@
 /*
  * h3600ts_event() handles events from the input module.
  */
-static int h3600ts_event(struct input_dev *dev, unsigned int type, 
+static int h3600ts_event(struct input_dev *dev, unsigned int type,
 		 	 unsigned int code, int value)
 {
 	struct h3600_dev *ts = dev->private;
@@ -290,7 +298,7 @@
 		//	ts->serio->write(ts->serio, SOME_CMD);
 			return 0;
 		}
-	}					
+	}
 	return -1;
 }
 
@@ -317,19 +325,19 @@
 #define STATE_DATA      2       /* state where we decode data */
 #define STATE_EOF       3       /* state where we decode checksum or EOF */
 
-static void h3600ts_interrupt(struct serio *serio, unsigned char data,
-                              unsigned int flags)
+static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data,
+                                     unsigned int flags, struct pt_regs *regs)
 {
         struct h3600_dev *ts = serio->private;
 
 	/*
-         * We have a new frame coming in. 
+         * We have a new frame coming in.
          */
 	switch (state) {
 		case STATE_SOF:
         		if (data == CHAR_SOF)
-                		state = STATE_ID;	
-			return;
+                		state = STATE_ID;
+			break;
         	case STATE_ID:
 			ts->event = (data & 0xf0) >> 4;
 			ts->len = (data & 0xf);
@@ -339,23 +347,25 @@
                         	break;
 			}
 			ts->chksum = data;
-                	state=(ts->len > 0 ) ? STATE_DATA : STATE_EOF;
+                	state = (ts->len > 0) ? STATE_DATA : STATE_EOF;
 			break;
 		case STATE_DATA:
 			ts->chksum += data;
 			ts->buf[ts->idx]= data;
-			if(++ts->idx == ts->len) 
+			if(++ts->idx == ts->len)
                         	state = STATE_EOF;
 			break;
 		case STATE_EOF:
                 	state = STATE_SOF;
-                	if (data == CHAR_EOF || data == ts->chksum )
-				h3600ts_process_packet(ts);
+                	if (data == CHAR_EOF || data == ts->chksum)
+				h3600ts_process_packet(ts, regs);
                 	break;
         	default:
                 	printk("Error3\n");
                 	break;
 	}
+
+	return IRQ_HANDLED;
 }
 
 /*
@@ -378,11 +388,11 @@
 	init_input_dev(&ts->dev);
 
 	/* Device specific stuff */
-        set_GPIO_IRQ_edge( GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES );
-        set_GPIO_IRQ_edge( GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE );
+        set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES);
+        set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE);
 
         if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler,
-			SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,	
+			SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
 			"h3600_action", &ts->dev)) {
 		printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n");
 		kfree(ts);
@@ -390,24 +400,19 @@
 	}
 
         if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler,
-			SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, 
+			SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
 			"h3600_suspend", &ts->dev)) {
 		free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev);
 		printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n");
 		kfree(ts);
 		return;
 	}
+
 	/* Now we have things going we setup our input device */
 	ts->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR);
-	ts->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
-	ts->dev.ledbit[0] = BIT(LED_SLEEP); 
-
-	ts->dev.absmin[ABS_X] = 60;   ts->dev.absmin[ABS_Y] = 35;
-	ts->dev.absmax[ABS_X] = 985; ts->dev.absmax[ABS_Y] = 1024;
-	ts->dev.absfuzz[ABS_X] = 0; ts->dev.absfuzz[ABS_Y] = 0;
-
-	ts->serio = serio;
-	serio->private = ts;
+	ts->dev.ledbit[0] = BIT(LED_SLEEP);
+	input_set_abs_params(&ts->dev, ABS_X, 60, 985, 0, 0);
+	input_set_abs_params(&ts->dev, ABS_Y, 35, 1024, 0, 0);
 
 	set_bit(KEY_RECORD, ts->dev.keybit);
 	set_bit(KEY_Q, ts->dev.keybit);
@@ -422,6 +427,9 @@
 	ts->dev.keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
 	ts->dev.keybit[LONG(KEY_SUSPEND)] |= BIT(KEY_SUSPEND);
 
+	ts->serio = serio;
+	serio->private = ts;
+
 	sprintf(ts->phys, "%s/input0", serio->phys);
 
        	ts->dev.event = h3600ts_event;
@@ -442,7 +450,7 @@
 
 	//h3600_flite_control(1, 25);     /* default brightness */
 #ifdef CONFIG_PM
-	ts->dev.pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT, 
+	ts->dev.pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT,
 					h3600ts_pm_callback);
 	printk("registered pm callback\n");
 #endif
@@ -458,7 +466,7 @@
 static void h3600ts_disconnect(struct serio *serio)
 {
 	struct h3600_dev *ts = serio->private;
-	
+
         free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev);
         free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, &ts->dev);
 	input_unregister_device(&ts->dev);
diff -Nru a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
--- a/drivers/isdn/hardware/avm/avm_cs.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/isdn/hardware/avm/avm_cs.c	Tue Jun 15 22:20:36 2004
@@ -505,12 +505,12 @@
 } /* avmcs_event */
 
 static struct pcmcia_driver avmcs_driver = {
-	.owner		= THIS_MODULE,
-	.drv		= {
-		.name	= "avmcs_cs",
+	.owner	= THIS_MODULE,
+	.drv	= {
+		.name	= "avm_cs",
 	},
-	.attach		= avmcs_attach,
-	.detach		= avmcs_detach,
+	.attach	= avmcs_attach,
+	.detach	= avmcs_detach,
 };
 
 static int __init avmcs_init(void)
diff -Nru a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
--- a/drivers/isdn/hardware/eicon/divasmain.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/isdn/hardware/eicon/divasmain.c	Tue Jun 15 22:20:37 2004
@@ -1,4 +1,4 @@
-/* $Id: divasmain.c,v 1.55 2004/04/08 01:17:58 armin Exp $
+/* $Id: divasmain.c,v 1.55.4.1 2004/05/21 12:15:00 armin Exp $
  *
  * Low level driver for Eicon DIVA Server ISDN cards.
  *
@@ -41,7 +41,7 @@
 #include "diva_dma.h"
 #include "diva_pci.h"
 
-static char *main_revision = "$Revision: 1.55 $";
+static char *main_revision = "$Revision: 1.55.4.1 $";
 
 static int major;
 
@@ -157,7 +157,7 @@
 
 static int divas_init_one(struct pci_dev *pdev,
 			  const struct pci_device_id *ent);
-static void divas_remove_one(struct pci_dev *pdev);
+static void __devexit divas_remove_one(struct pci_dev *pdev);
 
 static struct pci_driver diva_pci_driver = {
 	.name     = "divas",
diff -Nru a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c
--- a/drivers/isdn/hisax/nj_s.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/isdn/hisax/nj_s.c	Tue Jun 15 22:20:38 2004
@@ -104,9 +104,12 @@
 	cs->hw.njet.ctrl_reg = 0xff;  /* Reset On */
 	byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
 	mdelay(10);
-	cs->hw.njet.ctrl_reg = 0x00;  /* Reset Off and status read clear */
 	/* now edge triggered for TJ320 GE 13/07/00 */
 	/* see comment in IRQ function */
+	if (cs->subtyp) /* TJ320 */
+		cs->hw.njet.ctrl_reg = 0x40;  /* Reset Off and status read clear */
+	else
+		cs->hw.njet.ctrl_reg = 0x00;  /* Reset Off and status read clear */
 	byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
 	mdelay(10);
 	cs->hw.njet.auxd = 0;
@@ -151,7 +154,7 @@
 int __init
 setup_netjet_s(struct IsdnCard *card)
 {
-	int bytecnt;
+	int bytecnt,cfg;
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
 
@@ -183,6 +186,15 @@
 				printk(KERN_WARNING "NETjet-S: No IO-Adr for PCI card found\n");
 				return(0);
 			}
+			/* the TJ300 and TJ320 must be detected, the IRQ handling is different
+			 * unfortunatly the chips use the same device ID, but the TJ320 has
+			 * the bit20 in status PCI cfg register set
+			 */
+			pci_read_config_dword(dev_netjet, 0x04, &cfg);
+			if (cfg & 0x00100000)
+				cs->subtyp = 1; /* TJ320 */
+			else
+				cs->subtyp = 0; /* TJ300 */
 			/* 2001/10/04 Christoph Ersfeld, Formula-n Europe AG www.formula-n.com */
 			if ((dev_netjet->subsystem_vendor == 0x55) &&
 				(dev_netjet->subsystem_device == 0x02)) {
@@ -240,8 +252,8 @@
 	bytecnt = 256;
 
 	printk(KERN_INFO
-		"NETjet-S: PCI card configured at %#lx IRQ %d\n",
-		cs->hw.njet.base, cs->irq);
+		"NETjet-S: %s card configured at %#lx IRQ %d\n",
+		cs->subtyp ? "TJ320" : "TJ300", cs->hw.njet.base, cs->irq);
 	if (!request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn")) {
 		printk(KERN_WARNING
 		       "HiSax: %s config port %#lx-%#lx already in use\n",
diff -Nru a/drivers/isdn/hisax/st5481_b.c b/drivers/isdn/hisax/st5481_b.c
--- a/drivers/isdn/hisax/st5481_b.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/isdn/hisax/st5481_b.c	Tue Jun 15 22:20:39 2004
@@ -257,13 +257,18 @@
 static int st5481_setup_b_out(struct st5481_bcs *bcs)
 {
 	struct usb_device *dev = bcs->adapter->usb_dev;
-	struct usb_host_interface *altsetting;
+	struct usb_interface *intf;
+	struct usb_host_interface *altsetting = NULL;
 	struct usb_host_endpoint *endpoint;
   	struct st5481_b_out *b_out = &bcs->b_out;
 
 	DBG(4,"");
 
-	altsetting = &(dev->config->interface[0]->altsetting[3]);
+	intf = usb_ifnum_to_if(dev, 0);
+	if (intf)
+		altsetting = usb_altnum_to_altsetting(intf, 3);
+	if (!altsetting)
+		return -ENXIO;
 
 	// Allocate URBs and buffers for the B channel out
 	endpoint = &altsetting->endpoint[EP_B1_OUT - 1 + bcs->channel * 2];
diff -Nru a/drivers/isdn/hisax/st5481_d.c b/drivers/isdn/hisax/st5481_d.c
--- a/drivers/isdn/hisax/st5481_d.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/isdn/hisax/st5481_d.c	Tue Jun 15 22:20:40 2004
@@ -652,13 +652,18 @@
 static int st5481_setup_d_out(struct st5481_adapter *adapter)
 {
 	struct usb_device *dev = adapter->usb_dev;
-	struct usb_host_interface *altsetting;
+	struct usb_interface *intf;
+	struct usb_host_interface *altsetting = NULL;
 	struct usb_host_endpoint *endpoint;
 	struct st5481_d_out *d_out = &adapter->d_out;
 
 	DBG(2,"");
 
-	altsetting = &(dev->config->interface[0]->altsetting[3]);
+	intf = usb_ifnum_to_if(dev, 0);
+	if (intf)
+		altsetting = usb_altnum_to_altsetting(intf, 3);
+	if (!altsetting)
+		return -ENXIO;
 
 	// Allocate URBs and buffers for the D channel out
 	endpoint = &altsetting->endpoint[EP_D_OUT-1];
diff -Nru a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c
--- a/drivers/isdn/hisax/st5481_usb.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/isdn/hisax/st5481_usb.c	Tue Jun 15 22:20:42 2004
@@ -244,7 +244,8 @@
 	struct usb_device *dev = adapter->usb_dev;
 	struct st5481_ctrl *ctrl = &adapter->ctrl;
 	struct st5481_intr *intr = &adapter->intr;
-	struct usb_host_interface *altsetting;
+	struct usb_interface *intf;
+	struct usb_host_interface *altsetting = NULL;
 	struct usb_host_endpoint *endpoint;
 	int status;
 	struct urb *urb;
@@ -257,8 +258,11 @@
 		return status;
 	}
 
-	
-	altsetting = &(dev->config->interface[0]->altsetting[3]);	
+	intf = usb_ifnum_to_if(dev, 0);
+	if (intf)
+		altsetting = usb_altnum_to_altsetting(intf, 3);
+	if (!altsetting)
+		return -ENXIO;
 
 	// Check if the config is sane
 	if ( altsetting->desc.bNumEndpoints != 7 ) {
diff -Nru a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
--- a/drivers/isdn/i4l/isdn_common.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/isdn/i4l/isdn_common.c	Tue Jun 15 22:20:39 2004
@@ -386,7 +386,7 @@
  * Begin of a CAPI like LL<->HL interface, currently used only for 
  * supplementary service (CAPI 2.0 part III)
  */
-#include <linux/isdn//capicmd.h>
+#include <linux/isdn/capicmd.h>
 
 int
 isdn_capi_rec_hl_msg(capi_msg *cm) {
diff -Nru a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
--- a/drivers/macintosh/Kconfig	Tue Jun 15 22:20:39 2004
+++ b/drivers/macintosh/Kconfig	Tue Jun 15 22:20:39 2004
@@ -127,7 +127,7 @@
 
 config MAC_SERIAL
 	tristate "Support for PowerMac serial ports (OBSOLETE DRIVER)"
-	depends on PPC_PMAC
+	depends on PPC_PMAC && BROKEN
 	help
 	  This driver is obsolete. Use CONFIG_SERIAL_PMACZILOG in
 	  "Character devices --> Serial drivers --> PowerMac z85c30" option.
diff -Nru a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
--- a/drivers/macintosh/adb.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/macintosh/adb.c	Tue Jun 15 22:21:05 2004
@@ -10,7 +10,7 @@
  *
  * To do:
  *
- * - /proc/adb to list the devices and infos
+ * - /sys/bus/adb to list the devices and infos
  * - more /dev/adb to allow userland to receive the
  *   flow of auto-polling datas from a given device.
  * - move bus probe to a kernel thread
@@ -23,7 +23,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/fs.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/smp_lock.h>
@@ -36,6 +35,9 @@
 #include <linux/delay.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
+#include <linux/device.h>
+#include <linux/devfs_fs_kernel.h>
+
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 #ifdef CONFIG_PPC
@@ -75,6 +77,8 @@
 	NULL
 };
 
+static struct class_simple *adb_dev_class;
+
 struct adb_driver *adb_controller;
 struct notifier_block *adb_client_list = NULL;
 static int adb_got_sleep;
@@ -883,6 +887,7 @@
 }
 
 static struct file_operations adb_fops = {
+	.owner		= THIS_MODULE,
 	.llseek		= no_llseek,
 	.read		= adb_read,
 	.write		= adb_write,
@@ -893,9 +898,16 @@
 static void
 adbdev_init(void)
 {
-	if (register_chrdev(ADB_MAJOR, "adb", &adb_fops))
+	if (register_chrdev(ADB_MAJOR, "adb", &adb_fops)) {
 		printk(KERN_ERR "adb: unable to get major %d\n", ADB_MAJOR);
-	else
-		devfs_mk_cdev(MKDEV(ADB_MAJOR, 0),
-				S_IFCHR | S_IRUSR | S_IWUSR, "adb");
+		return;
+	}
+
+	devfs_mk_cdev(MKDEV(ADB_MAJOR, 0), S_IFCHR | S_IRUSR | S_IWUSR, "adb");
+
+	adb_dev_class = class_simple_create(THIS_MODULE, "adb");
+	if (IS_ERR(adb_dev_class)) {
+		return;
+	}
+	class_simple_device_add(adb_dev_class, MKDEV(ADB_MAJOR, 0), NULL, "adb");
 }
diff -Nru a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
--- a/drivers/macintosh/therm_adt746x.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/macintosh/therm_adt746x.c	Tue Jun 15 22:20:43 2004
@@ -246,8 +246,7 @@
 
 	while(monitor_running)
 	{
-		set_task_state(current, TASK_UNINTERRUPTIBLE);
-		schedule_timeout(2*HZ);
+		msleep(2000);
 
 		/* Check status */
 		/* local   : chip */
diff -Nru a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
--- a/drivers/macintosh/therm_pm72.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/macintosh/therm_pm72.c	Tue Jun 15 22:20:43 2004
@@ -146,13 +146,6 @@
 	.detach_adapter	= therm_pm72_detach,
 };
 
-
-static inline void wait_ms(unsigned int ms)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(1 + (ms * HZ + 999) / 1000);
-}
-
 /*
  * Utility function to create an i2c_client structure and
  * attach it to one of u3 adapters
@@ -251,7 +244,7 @@
 		if (rc <= 0)
 			goto error;
 		/* Wait for convertion */
-		wait_ms(1);
+		msleep(1);
 		/* Switch to data register */
 		buf[0] = 4;
 		rc = i2c_master_send(state->monitor, buf, 1);
@@ -269,7 +262,7 @@
 			printk(KERN_ERR "therm_pm72: Error reading ADC !\n");
 			return -1;
 		}
-		wait_ms(10);
+		msleep(10);
 	}
 }
 
@@ -283,7 +276,7 @@
 		nw = i2c_master_send(fcu, buf, 1);
 		if (nw > 0 || (nw < 0 && nw != -EIO) || tries >= 100)
 			break;
-		wait_ms(10);
+		msleep(10);
 		++tries;
 	}
 	if (nw <= 0) {
@@ -295,7 +288,7 @@
 		nr = i2c_master_recv(fcu, buf, nb);
 		if (nr > 0 || (nr < 0 && nr != ENODEV) || tries >= 100)
 			break;
-		wait_ms(10);
+		msleep(10);
 		++tries;
 	}
 	if (nr <= 0)
@@ -316,7 +309,7 @@
 		nw = i2c_master_send(fcu, buf, nb);
 		if (nw > 0 || (nw < 0 && nw != EIO) || tries >= 100)
 			break;
-		wait_ms(10);
+		msleep(10);
 		++tries;
 	}
 	if (nw < 0)
diff -Nru a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
--- a/drivers/md/dm-ioctl.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/md/dm-ioctl.c	Tue Jun 15 22:20:38 2004
@@ -46,7 +46,7 @@
 static struct list_head _name_buckets[NUM_BUCKETS];
 static struct list_head _uuid_buckets[NUM_BUCKETS];
 
-void dm_hash_remove_all(void);
+static void dm_hash_remove_all(void);
 
 /*
  * Guards access to both hash tables.
@@ -61,7 +61,7 @@
 		INIT_LIST_HEAD(buckets + i);
 }
 
-int dm_hash_init(void)
+static int dm_hash_init(void)
 {
 	init_buckets(_name_buckets);
 	init_buckets(_uuid_buckets);
@@ -69,7 +69,7 @@
 	return 0;
 }
 
-void dm_hash_exit(void)
+static void dm_hash_exit(void)
 {
 	dm_hash_remove_all();
 	devfs_remove(DM_DIR);
@@ -195,7 +195,7 @@
  * The kdev_t and uuid of a device can never change once it is
  * initially inserted.
  */
-int dm_hash_insert(const char *name, const char *uuid, struct mapped_device *md)
+static int dm_hash_insert(const char *name, const char *uuid, struct mapped_device *md)
 {
 	struct hash_cell *cell;
 
@@ -234,7 +234,7 @@
 	return -EBUSY;
 }
 
-void __hash_remove(struct hash_cell *hc)
+static void __hash_remove(struct hash_cell *hc)
 {
 	/* remove from the dev hash */
 	list_del(&hc->uuid_list);
@@ -246,7 +246,7 @@
 	free_cell(hc);
 }
 
-void dm_hash_remove_all(void)
+static void dm_hash_remove_all(void)
 {
 	int i;
 	struct hash_cell *hc;
@@ -262,7 +262,7 @@
 	up_write(&_hash_lock);
 }
 
-int dm_hash_rename(const char *old, const char *new)
+static int dm_hash_rename(const char *old, const char *new)
 {
 	char *new_name, *old_name;
 	struct hash_cell *hc;
@@ -377,7 +377,7 @@
 	for (i = 0; i < NUM_BUCKETS; i++) {
 		list_for_each_entry (hc, _name_buckets + i, name_list) {
 			needed += sizeof(struct dm_name_list);
-			needed += strlen(hc->name);
+			needed += strlen(hc->name) + 1;
 			needed += ALIGN_MASK;
 		}
 	}
@@ -417,9 +417,9 @@
 	return 0;
 }
 
-static void list_version_get_needed(struct target_type *tt, void *param)
+static void list_version_get_needed(struct target_type *tt, void *needed_param)
 {
-    int *needed = param;
+    size_t *needed = needed_param;
 
     *needed += strlen(tt->name);
     *needed += sizeof(tt->version);
@@ -850,7 +850,6 @@
 	int r;
 	struct mapped_device *md;
 	struct dm_table *table;
-	DECLARE_WAITQUEUE(wq, current);
 
 	md = find_device(param);
 	if (!md)
@@ -859,12 +858,10 @@
 	/*
 	 * Wait for a notification event
 	 */
-	set_current_state(TASK_INTERRUPTIBLE);
-	if (!dm_add_wait_queue(md, &wq, param->event_nr)) {
-		schedule();
-		dm_remove_wait_queue(md, &wq);
+	if (dm_wait_event(md, param->event_nr)) {
+		r = -ERESTARTSYS;
+		goto out;
 	}
- 	set_current_state(TASK_RUNNING);
 
 	/*
 	 * The userland program is going to want to know what
@@ -1136,7 +1133,7 @@
  * As well as checking the version compatibility this always
  * copies the kernel interface version out.
  */
-static int check_version(unsigned int cmd, struct dm_ioctl *user)
+static int check_version(unsigned int cmd, struct dm_ioctl __user *user)
 {
 	uint32_t version[3];
 	int r = 0;
@@ -1171,7 +1168,7 @@
 	vfree(param);
 }
 
-static int copy_params(struct dm_ioctl *user, struct dm_ioctl **param)
+static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param)
 {
 	struct dm_ioctl tmp, *dmi;
 
@@ -1228,7 +1225,7 @@
 	int r = 0;
 	unsigned int cmd;
 	struct dm_ioctl *param;
-	struct dm_ioctl *user = (struct dm_ioctl *) u;
+	struct dm_ioctl __user *user = (struct dm_ioctl __user *) u;
 	ioctl_fn fn = NULL;
 	size_t param_size;
 
diff -Nru a/drivers/md/dm-table.c b/drivers/md/dm-table.c
--- a/drivers/md/dm-table.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/md/dm-table.c	Tue Jun 15 22:21:04 2004
@@ -181,8 +181,8 @@
 	/*
 	 * Allocate both the target array and offset array at once.
 	 */
-	n_highs = (sector_t *) dm_vcalloc(sizeof(struct dm_target) +
-					  sizeof(sector_t), num);
+	n_highs = (sector_t *) dm_vcalloc(num, sizeof(struct dm_target) +
+					  sizeof(sector_t));
 	if (!n_highs)
 		return -ENOMEM;
 
diff -Nru a/drivers/md/dm-target.c b/drivers/md/dm-target.c
--- a/drivers/md/dm-target.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/md/dm-target.c	Tue Jun 15 22:21:04 2004
@@ -7,6 +7,7 @@
 #include "dm.h"
 
 #include <linux/module.h>
+#include <linux/init.h>
 #include <linux/kmod.h>
 #include <linux/bio.h>
 #include <linux/slab.h>
@@ -181,7 +182,7 @@
 	.map  = io_err_map,
 };
 
-int dm_target_init(void)
+int __init dm_target_init(void)
 {
 	return dm_register_target(&error_target);
 }
diff -Nru a/drivers/md/dm.c b/drivers/md/dm.c
--- a/drivers/md/dm.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/md/dm.c	Tue Jun 15 22:20:43 2004
@@ -80,7 +80,7 @@
 	/*
 	 * Event handling.
 	 */
-	uint32_t event_nr;
+	atomic_t event_nr;
 	wait_queue_head_t eventq;
 
 	/*
@@ -93,7 +93,7 @@
 static kmem_cache_t *_io_cache;
 static kmem_cache_t *_tio_cache;
 
-static __init int local_init(void)
+static int __init local_init(void)
 {
 	int r;
 
@@ -369,6 +369,7 @@
 		struct dm_io *io = tio->io;
 		free_tio(tio->io->md, tio);
 		dec_pending(io, -EIO);
+		bio_put(clone);
 	}
 }
 
@@ -662,6 +663,8 @@
 	return r;
 }
 
+static struct block_device_operations dm_blk_dops;
+
 /*
  * Allocate and initialise a blank device with a given minor.
  */
@@ -684,6 +687,7 @@
 	init_rwsem(&md->lock);
 	rwlock_init(&md->map_lock);
 	atomic_set(&md->holders, 1);
+	atomic_set(&md->event_nr, 0);
 
 	md->queue = blk_alloc_queue(GFP_KERNEL);
 	if (!md->queue)
@@ -753,10 +757,8 @@
 {
 	struct mapped_device *md = (struct mapped_device *) context;
 
-	down_write(&md->lock);
-	md->event_nr++;
+	atomic_inc(&md->event_nr);;
 	wake_up(&md->eventq);
-	up_write(&md->lock);
 }
 
 static void __set_size(struct gendisk *disk, sector_t size)
@@ -1054,35 +1056,13 @@
  *---------------------------------------------------------------*/
 uint32_t dm_get_event_nr(struct mapped_device *md)
 {
-	uint32_t r;
-
-	down_read(&md->lock);
-	r = md->event_nr;
-	up_read(&md->lock);
-
-	return r;
+	return atomic_read(&md->event_nr);
 }
 
-int dm_add_wait_queue(struct mapped_device *md, wait_queue_t *wq,
-		      uint32_t event_nr)
+int dm_wait_event(struct mapped_device *md, int event_nr)
 {
-	down_write(&md->lock);
-	if (event_nr != md->event_nr) {
-		up_write(&md->lock);
-		return 1;
-	}
-
-	add_wait_queue(&md->eventq, wq);
-	up_write(&md->lock);
-
-	return 0;
-}
-
-void dm_remove_wait_queue(struct mapped_device *md, wait_queue_t *wq)
-{
-	down_write(&md->lock);
-	remove_wait_queue(&md->eventq, wq);
-	up_write(&md->lock);
+	return wait_event_interruptible(md->eventq,
+			(event_nr != atomic_read(&md->event_nr)));
 }
 
 /*
@@ -1099,7 +1079,7 @@
 	return test_bit(DMF_SUSPENDED, &md->flags);
 }
 
-struct block_device_operations dm_blk_dops = {
+static struct block_device_operations dm_blk_dops = {
 	.open = dm_blk_open,
 	.release = dm_blk_close,
 	.owner = THIS_MODULE
diff -Nru a/drivers/md/dm.h b/drivers/md/dm.h
--- a/drivers/md/dm.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/md/dm.h	Tue Jun 15 22:20:40 2004
@@ -31,8 +31,6 @@
 
 #define SECTOR_SHIFT 9
 
-extern struct block_device_operations dm_blk_dops;
-
 /*
  * List of devices that a metadevice uses and should open/close.
  */
@@ -81,9 +79,7 @@
  * Event functions.
  */
 uint32_t dm_get_event_nr(struct mapped_device *md);
-int dm_add_wait_queue(struct mapped_device *md, wait_queue_t *wq,
-		      uint32_t event_nr);
-void dm_remove_wait_queue(struct mapped_device *md, wait_queue_t *wq);
+int dm_wait_event(struct mapped_device *md, int event_nr);
 
 /*
  * Info functions.
diff -Nru a/drivers/md/md.c b/drivers/md/md.c
--- a/drivers/md/md.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/md/md.c	Tue Jun 15 22:20:38 2004
@@ -1607,7 +1607,7 @@
 	spin_lock(&pers_lock);
 	if (!pers[pnum] || !try_module_get(pers[pnum]->owner)) {
 		spin_unlock(&pers_lock);
-		printk(KERN_ERR "md: personality %d is not loaded!\n",
+		printk(KERN_WARNING "md: personality %d is not loaded!\n",
 		       pnum);
 		return -EINVAL;
 	}
@@ -1934,7 +1934,7 @@
 }
 
 
-static int get_version(void * arg)
+static int get_version(void __user * arg)
 {
 	mdu_version_t ver;
 
@@ -1948,7 +1948,7 @@
 	return 0;
 }
 
-static int get_array_info(mddev_t * mddev, void * arg)
+static int get_array_info(mddev_t * mddev, void __user * arg)
 {
 	mdu_array_info_t info;
 	int nr,working,active,failed,spare;
@@ -1998,7 +1998,7 @@
 	return 0;
 }
 
-static int get_disk_info(mddev_t * mddev, void * arg)
+static int get_disk_info(mddev_t * mddev, void __user * arg)
 {
 	mdu_disk_info_t info;
 	unsigned int nr;
@@ -2251,7 +2251,12 @@
 		return -EINVAL;
 	}
 
-	rdev->sb_offset = calc_dev_sboffset(rdev->bdev);
+	if (mddev->persistent)
+		rdev->sb_offset = calc_dev_sboffset(rdev->bdev);
+	else
+		rdev->sb_offset =
+			rdev->bdev->bd_inode->i_size >> BLOCK_SIZE_BITS;
+
 	size = calc_dev_size(rdev, mddev->chunk_size);
 	rdev->size = size;
 
@@ -2372,6 +2377,103 @@
 	return 0;
 }
 
+/*
+ * update_array_info is used to change the configuration of an
+ * on-line array.
+ * The version, ctime,level,size,raid_disks,not_persistent, layout,chunk_size
+ * fields in the info are checked against the array.
+ * Any differences that cannot be handled will cause an error.
+ * Normally, only one change can be managed at a time.
+ */
+static int update_array_info(mddev_t *mddev, mdu_array_info_t *info)
+{
+	int rv = 0;
+	int cnt = 0;
+
+	if (mddev->major_version != info->major_version ||
+	    mddev->minor_version != info->minor_version ||
+/*	    mddev->patch_version != info->patch_version || */
+	    mddev->ctime         != info->ctime         ||
+	    mddev->level         != info->level         ||
+	    mddev->layout        != info->layout        ||
+	    !mddev->persistent	 != info->not_persistent||
+	    mddev->chunk_size    != info->chunk_size    )
+		return -EINVAL;
+	/* Check there is only one change */
+	if (mddev->size != info->size) cnt++;
+	if (mddev->raid_disks != info->raid_disks) cnt++;
+	if (cnt == 0) return 0;
+	if (cnt > 1) return -EINVAL;
+
+	if (mddev->size != info->size) {
+		mdk_rdev_t * rdev;
+		struct list_head *tmp;
+		if (mddev->pers->resize == NULL)
+			return -EINVAL;
+		/* The "size" is the amount of each device that is used.
+		 * This can only make sense for arrays with redundancy.
+		 * linear and raid0 always use whatever space is available
+		 * We can only consider changing the size of no resync
+		 * or reconstruction is happening, and if the new size
+		 * is acceptable. It must fit before the sb_offset or,
+		 * if that is <data_offset, it must fit before the
+		 * size of each device.
+		 * If size is zero, we find the largest size that fits.
+		 */
+		if (mddev->sync_thread)
+			return -EBUSY;
+		ITERATE_RDEV(mddev,rdev,tmp) {
+			sector_t avail;
+			int fit = (info->size == 0);
+			if (rdev->sb_offset > rdev->data_offset)
+				avail = (rdev->sb_offset*2) - rdev->data_offset;
+			else
+				avail = get_capacity(rdev->bdev->bd_disk)
+					- rdev->data_offset;
+			if (fit && (info->size == 0 || info->size > avail/2))
+				info->size = avail/2;
+			if (avail < ((sector_t)info->size << 1))
+				return -ENOSPC;
+		}
+		rv = mddev->pers->resize(mddev, (sector_t)info->size *2);
+		if (!rv) {
+			struct block_device *bdev;
+
+			bdev = bdget_disk(mddev->gendisk, 0);
+			if (bdev) {
+				down(&bdev->bd_inode->i_sem);
+				i_size_write(bdev->bd_inode, mddev->array_size << 10);
+				up(&bdev->bd_inode->i_sem);
+				bdput(bdev);
+			}
+		}
+	}
+	if (mddev->raid_disks    != info->raid_disks) {
+		/* change the number of raid disks */
+		if (mddev->pers->reshape == NULL)
+			return -EINVAL;
+		if (info->raid_disks <= 0 ||
+		    info->raid_disks >= mddev->max_disks)
+			return -EINVAL;
+		if (mddev->sync_thread)
+			return -EBUSY;
+		rv = mddev->pers->reshape(mddev, info->raid_disks);
+		if (!rv) {
+			struct block_device *bdev;
+
+			bdev = bdget_disk(mddev->gendisk, 0);
+			if (bdev) {
+				down(&bdev->bd_inode->i_sem);
+				i_size_write(bdev->bd_inode, mddev->array_size << 10);
+				up(&bdev->bd_inode->i_sem);
+				bdput(bdev);
+			}
+		}
+	}
+	md_update_sb(mddev);
+	return rv;
+}
+
 static int set_disk_faulty(mddev_t *mddev, dev_t dev)
 {
 	mdk_rdev_t *rdev;
@@ -2389,7 +2491,8 @@
 {
 	char b[BDEVNAME_SIZE];
 	int err = 0;
-	struct hd_geometry *loc = (struct hd_geometry *) arg;
+	void __user *argp = (void __user *)arg;
+	struct hd_geometry __user *loc = argp;
 	mddev_t *mddev = NULL;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -2402,7 +2505,7 @@
 	switch (cmd)
 	{
 		case RAID_VERSION:
-			err = get_version((void *)arg);
+			err = get_version(argp);
 			goto done;
 
 		case PRINT_RAID_DEBUG:
@@ -2463,33 +2566,41 @@
 	switch (cmd)
 	{
 		case SET_ARRAY_INFO:
-
-			if (!list_empty(&mddev->disks)) {
-				printk(KERN_WARNING 
-					"md: array %s already has disks!\n",
-					mdname(mddev));
-				err = -EBUSY;
-				goto abort_unlock;
-			}
-			if (mddev->raid_disks) {
-				printk(KERN_WARNING 
-					"md: array %s already initialised!\n",
-					mdname(mddev));
-				err = -EBUSY;
-				goto abort_unlock;
-			}
 			{
 				mdu_array_info_t info;
 				if (!arg)
 					memset(&info, 0, sizeof(info));
-				else if (copy_from_user(&info, (void*)arg, sizeof(info))) {
+				else if (copy_from_user(&info, argp, sizeof(info))) {
 					err = -EFAULT;
 					goto abort_unlock;
 				}
+				if (mddev->pers) {
+					err = update_array_info(mddev, &info);
+					if (err) {
+						printk(KERN_WARNING "md: couldn't update"
+						       " array info. %d\n", err);
+						goto abort_unlock;
+					}
+					goto done_unlock;
+				}
+				if (!list_empty(&mddev->disks)) {
+					printk(KERN_WARNING
+					       "md: array %s already has disks!\n",
+					       mdname(mddev));
+					err = -EBUSY;
+					goto abort_unlock;
+				}
+				if (mddev->raid_disks) {
+					printk(KERN_WARNING
+					       "md: array %s already initialised!\n",
+					       mdname(mddev));
+					err = -EBUSY;
+					goto abort_unlock;
+				}
 				err = set_array_info(mddev, &info);
 				if (err) {
 					printk(KERN_WARNING "md: couldn't set"
-						" array info. %d\n", err);
+					       " array info. %d\n", err);
 					goto abort_unlock;
 				}
 			}
@@ -2513,11 +2624,11 @@
 	switch (cmd)
 	{
 		case GET_ARRAY_INFO:
-			err = get_array_info(mddev, (void *)arg);
+			err = get_array_info(mddev, argp);
 			goto done_unlock;
 
 		case GET_DISK_INFO:
-			err = get_disk_info(mddev, (void *)arg);
+			err = get_disk_info(mddev, argp);
 			goto done_unlock;
 
 		case RESTART_ARRAY_RW:
@@ -2543,18 +2654,18 @@
 				err = -EINVAL;
 				goto abort_unlock;
 			}
-			err = put_user (2, (char *) &loc->heads);
+			err = put_user (2, (char __user *) &loc->heads);
 			if (err)
 				goto abort_unlock;
-			err = put_user (4, (char *) &loc->sectors);
+			err = put_user (4, (char __user *) &loc->sectors);
 			if (err)
 				goto abort_unlock;
 			err = put_user(get_capacity(mddev->gendisk)/8,
-						(short *) &loc->cylinders);
+					(short __user *) &loc->cylinders);
 			if (err)
 				goto abort_unlock;
 			err = put_user (get_start_sect(inode->i_bdev),
-						(long *) &loc->start);
+						(long __user *) &loc->start);
 			goto done_unlock;
 	}
 
@@ -2573,7 +2684,7 @@
 		case ADD_NEW_DISK:
 		{
 			mdu_disk_info_t info;
-			if (copy_from_user(&info, (void*)arg, sizeof(info)))
+			if (copy_from_user(&info, argp, sizeof(info)))
 				err = -EFAULT;
 			else
 				err = add_new_disk(mddev, &info);
@@ -3278,7 +3389,7 @@
 		j += sectors;
 		if (j>1) mddev->curr_resync = j;
 
-		if (last_check + window > j)
+		if (last_check + window > j || j == max_sectors)
 			continue;
 
 		last_check = j;
@@ -3444,8 +3555,8 @@
 			if (rdev->raid_disk >= 0 &&
 			    rdev->faulty &&
 			    atomic_read(&rdev->nr_pending)==0) {
-				mddev->pers->hot_remove_disk(mddev, rdev->raid_disk);
-				rdev->raid_disk = -1;
+				if (mddev->pers->hot_remove_disk(mddev, rdev->raid_disk)==0)
+					rdev->raid_disk = -1;
 			}
 			if (!rdev->faulty && rdev->raid_disk >= 0 && !rdev->in_sync)
 				spares++;
diff -Nru a/drivers/md/multipath.c b/drivers/md/multipath.c
--- a/drivers/md/multipath.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/md/multipath.c	Tue Jun 15 22:20:40 2004
@@ -54,9 +54,8 @@
 	kfree(mpb);
 }
 
-static int multipath_map (mddev_t *mddev, mdk_rdev_t **rdevp)
+static int multipath_map (multipath_conf_t *conf)
 {
-	multipath_conf_t *conf = mddev_to_conf(mddev);
 	int i, disks = conf->raid_disks;
 
 	/*
@@ -68,10 +67,9 @@
 	for (i = 0; i < disks; i++) {
 		mdk_rdev_t *rdev = conf->multipaths[i].rdev;
 		if (rdev && rdev->in_sync) {
-			*rdevp = rdev;
 			atomic_inc(&rdev->nr_pending);
 			spin_unlock_irq(&conf->device_lock);
-			return 0;
+			return i;
 		}
 	}
 	spin_unlock_irq(&conf->device_lock);
@@ -133,25 +131,7 @@
 		       (unsigned long long)bio->bi_sector);
 		multipath_reschedule_retry(mp_bh);
 	}
-	atomic_dec(&rdev->nr_pending);
-	return 0;
-}
-
-/*
- * This routine returns the disk from which the requested read should
- * be done.
- */
-
-static int multipath_read_balance (multipath_conf_t *conf)
-{
-	int disk;
-
-	for (disk = 0; disk < conf->raid_disks; disk++) {
-		mdk_rdev_t *rdev = conf->multipaths[disk].rdev;
-		if (rdev && rdev->in_sync)
-			return disk;
-	}
-	BUG();
+	rdev_dec_pending(rdev, conf->mddev);
 	return 0;
 }
 
@@ -159,16 +139,25 @@
 {
 	multipath_conf_t *conf = mddev_to_conf(mddev);
 	int i;
+	unsigned long flags;
 
+	spin_lock_irqsave(&conf->device_lock, flags);
 	for (i=0; i<mddev->raid_disks; i++) {
 		mdk_rdev_t *rdev = conf->multipaths[i].rdev;
 		if (rdev && !rdev->faulty) {
 			request_queue_t *r_queue = bdev_get_queue(rdev->bdev);
 
+			atomic_inc(&rdev->nr_pending);
+			spin_unlock_irqrestore(&conf->device_lock, flags);
+
 			if (r_queue->unplug_fn)
 				r_queue->unplug_fn(r_queue);
+
+			spin_lock_irqsave(&conf->device_lock, flags);
+			atomic_dec(&rdev->nr_pending);
 		}
 	}
+	spin_unlock_irqrestore(&conf->device_lock, flags);
 }
 static void multipath_unplug(request_queue_t *q)
 {
@@ -195,14 +184,14 @@
 		disk_stat_inc(mddev->gendisk, reads);
 		disk_stat_add(mddev->gendisk, read_sectors, bio_sectors(bio));
 	}
-	/*
-	 * read balancing logic:
-	 */
-	spin_lock_irq(&conf->device_lock);
-	mp_bh->path = multipath_read_balance(conf);
+
+	mp_bh->path = multipath_map(conf);
+	if (mp_bh->path < 0) {
+		bio_endio(bio, bio->bi_size, -EIO);
+		mempool_free(mp_bh, conf->pool);
+		return 0;
+	}
 	multipath = conf->multipaths + mp_bh->path;
-	atomic_inc(&multipath->rdev->nr_pending);
-	spin_unlock_irq(&conf->device_lock);
 
 	mp_bh->bio = *bio;
 	mp_bh->bio.bi_bdev = multipath->rdev->bdev;
@@ -366,7 +355,7 @@
 	struct multipath_bh *mp_bh;
 	struct bio *bio;
 	unsigned long flags;
-	mdk_rdev_t *rdev;
+	multipath_conf_t *conf = mddev_to_conf(mddev);
 
 	md_check_recovery(mddev);
 	for (;;) {
@@ -382,8 +371,7 @@
 		bio = &mp_bh->bio;
 		bio->bi_sector = mp_bh->master_bio->bi_sector;
 		
-		rdev = NULL;
-		if (multipath_map (mddev, &rdev)<0) {
+		if ((mp_bh->path = multipath_map (conf))<0) {
 			printk(KERN_ALERT "multipath: %s: unrecoverable IO read"
 				" error for block %llu\n",
 				bdevname(bio->bi_bdev,b),
@@ -394,7 +382,7 @@
 				" to another IO path\n",
 				bdevname(bio->bi_bdev,b),
 				(unsigned long long)bio->bi_sector);
-			bio->bi_bdev = rdev->bdev;
+			bio->bi_bdev = conf->multipaths[mp_bh->path].rdev->bdev;
 			generic_make_request(bio);
 		}
 	}
@@ -522,6 +510,7 @@
 	multipath_conf_t *conf = mddev_to_conf(mddev);
 
 	md_unregister_thread(mddev->thread);
+	mddev->thread = NULL;
 	mempool_destroy(conf->pool);
 	kfree(conf->multipaths);
 	kfree(conf);
diff -Nru a/drivers/md/raid1.c b/drivers/md/raid1.c
--- a/drivers/md/raid1.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/md/raid1.c	Tue Jun 15 22:20:41 2004
@@ -42,16 +42,17 @@
 
 static void * r1bio_pool_alloc(int gfp_flags, void *data)
 {
-	mddev_t *mddev = data;
+	struct pool_info *pi = data;
 	r1bio_t *r1_bio;
 
 	/* allocate a r1bio with room for raid_disks entries in the bios array */
-	r1_bio = kmalloc(sizeof(r1bio_t) + sizeof(struct bio*)*mddev->raid_disks,
+	r1_bio = kmalloc(sizeof(r1bio_t) + sizeof(struct bio*)*pi->raid_disks,
 			 gfp_flags);
 	if (r1_bio)
-		memset(r1_bio, 0, sizeof(*r1_bio) + sizeof(struct bio*)*mddev->raid_disks);
+		memset(r1_bio, 0, sizeof(*r1_bio) +
+			       sizeof(struct bio*) * pi->raid_disks);
 	else
-		unplug_slaves(mddev);
+		unplug_slaves(pi->mddev);
 
 	return r1_bio;
 }
@@ -69,22 +70,22 @@
 
 static void * r1buf_pool_alloc(int gfp_flags, void *data)
 {
-	conf_t *conf = data;
+	struct pool_info *pi = data;
 	struct page *page;
 	r1bio_t *r1_bio;
 	struct bio *bio;
 	int i, j;
 
-	r1_bio = r1bio_pool_alloc(gfp_flags, conf->mddev);
+	r1_bio = r1bio_pool_alloc(gfp_flags, pi);
 	if (!r1_bio) {
-		unplug_slaves(conf->mddev);
+		unplug_slaves(pi->mddev);
 		return NULL;
 	}
 
 	/*
 	 * Allocate bios : 1 for reading, n-1 for writing
 	 */
-	for (j = conf->raid_disks ; j-- ; ) {
+	for (j = pi->raid_disks ; j-- ; ) {
 		bio = bio_alloc(gfp_flags, RESYNC_PAGES);
 		if (!bio)
 			goto out_free_bio;
@@ -111,16 +112,16 @@
 	for ( ; i > 0 ; i--)
 		__free_page(bio->bi_io_vec[i-1].bv_page);
 out_free_bio:
-	while ( ++j < conf->raid_disks )
+	while ( ++j < pi->raid_disks )
 		bio_put(r1_bio->bios[j]);
-	r1bio_pool_free(r1_bio, conf->mddev);
+	r1bio_pool_free(r1_bio, data);
 	return NULL;
 }
 
 static void r1buf_pool_free(void *__r1_bio, void *data)
 {
+	struct pool_info *pi = data;
 	int i;
-	conf_t *conf = data;
 	r1bio_t *r1bio = __r1_bio;
 	struct bio *bio = r1bio->bios[0];
 
@@ -128,10 +129,10 @@
 		__free_page(bio->bi_io_vec[i].bv_page);
 		bio->bi_io_vec[i].bv_page = NULL;
 	}
-	for (i=0 ; i < conf->raid_disks; i++)
+	for (i=0 ; i < pi->raid_disks; i++)
 		bio_put(r1bio->bios[i]);
 
-	r1bio_pool_free(r1bio, conf->mddev);
+	r1bio_pool_free(r1bio, data);
 }
 
 static void put_all_bios(conf_t *conf, r1bio_t *r1_bio)
@@ -296,7 +297,7 @@
 		reschedule_retry(r1_bio);
 	}
 
-	atomic_dec(&conf->mirrors[mirror].rdev->nr_pending);
+	rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev);
 	return 0;
 }
 
@@ -343,7 +344,7 @@
 		raid_end_bio_io(r1_bio);
 	}
 
-	atomic_dec(&conf->mirrors[mirror].rdev->nr_pending);
+	rdev_dec_pending(conf->mirrors[mirror].rdev, conf->mddev);
 	return 0;
 }
 
@@ -459,11 +460,17 @@
 	spin_lock_irqsave(&conf->device_lock, flags);
 	for (i=0; i<mddev->raid_disks; i++) {
 		mdk_rdev_t *rdev = conf->mirrors[i].rdev;
-		if (rdev && !rdev->faulty) {
+		if (rdev && atomic_read(&rdev->nr_pending)) {
 			request_queue_t *r_queue = bdev_get_queue(rdev->bdev);
 
+			atomic_inc(&rdev->nr_pending);
+			spin_unlock_irqrestore(&conf->device_lock, flags);
+
 			if (r_queue->unplug_fn)
 				r_queue->unplug_fn(r_queue);
+
+			spin_lock_irqsave(&conf->device_lock, flags);
+			atomic_dec(&rdev->nr_pending);
 		}
 	}
 	spin_unlock_irqrestore(&conf->device_lock, flags);
@@ -504,7 +511,7 @@
 	mirror_info_t *mirror;
 	r1bio_t *r1_bio;
 	struct bio *read_bio;
-	int i, disks = conf->raid_disks;
+	int i, disks;
 
 	/*
 	 * Register the new request and wait if the reconstruction
@@ -564,6 +571,7 @@
 	 * inc refcount on their rdev.  Record them by setting
 	 * bios[x] to bio
 	 */
+	disks = conf->raid_disks;
 	spin_lock_irq(&conf->device_lock);
 	for (i = 0;  i < disks; i++) {
 		if (conf->mirrors[i].rdev &&
@@ -799,7 +807,7 @@
 			 conf->mirrors[r1_bio->read_disk].rdev);
 	else
 		set_bit(R1BIO_Uptodate, &r1_bio->state);
-	atomic_dec(&conf->mirrors[r1_bio->read_disk].rdev->nr_pending);
+	rdev_dec_pending(conf->mirrors[r1_bio->read_disk].rdev, conf->mddev);
 	reschedule_retry(r1_bio);
 	return 0;
 }
@@ -829,7 +837,7 @@
 		md_done_sync(mddev, r1_bio->sectors, uptodate);
 		put_buf(r1_bio);
 	}
-	atomic_dec(&conf->mirrors[mirror].rdev->nr_pending);
+	rdev_dec_pending(conf->mirrors[mirror].rdev, mddev);
 	return 0;
 }
 
@@ -947,7 +955,8 @@
 	buffs = RESYNC_WINDOW / RESYNC_BLOCK_SIZE;
 	if (conf->r1buf_pool)
 		BUG();
-	conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free, conf);
+	conf->r1buf_pool = mempool_create(buffs, r1buf_pool_alloc, r1buf_pool_free,
+					  conf->poolinfo);
 	if (!conf->r1buf_pool)
 		return -ENOMEM;
 	conf->next_resync = 0;
@@ -973,6 +982,7 @@
 	sector_t max_sector, nr_sectors;
 	int disk;
 	int i;
+	int write_targets = 0;
 
 	if (!conf->r1buf_pool)
 		if (init_resync(conf))
@@ -1049,12 +1059,24 @@
 			    sector_nr + RESYNC_SECTORS > mddev->recovery_cp)) {
 			bio->bi_rw = WRITE;
 			bio->bi_end_io = end_sync_write;
+			write_targets ++;
 		} else
 			continue;
 		bio->bi_sector = sector_nr + conf->mirrors[i].rdev->data_offset;
 		bio->bi_bdev = conf->mirrors[i].rdev->bdev;
 		bio->bi_private = r1_bio;
 	}
+	if (write_targets == 0) {
+		/* There is nowhere to write, so all non-sync
+		 * drives must be failed - so we are finished
+		 */
+		int rv = max_sector - sector_nr;
+		md_done_sync(mddev, rv, 1);
+		put_buf(r1_bio);
+		atomic_dec(&conf->mirrors[disk].rdev->nr_pending);
+		return rv;
+	}
+
 	nr_sectors = 0;
 	do {
 		struct page *page;
@@ -1117,28 +1139,28 @@
 	 */
 	conf = kmalloc(sizeof(conf_t), GFP_KERNEL);
 	mddev->private = conf;
-	if (!conf) {
-		printk(KERN_ERR "raid1: couldn't allocate memory for %s\n",
-			mdname(mddev));
-		goto out;
-	}
+	if (!conf)
+		goto out_no_mem;
+
 	memset(conf, 0, sizeof(*conf));
 	conf->mirrors = kmalloc(sizeof(struct mirror_info)*mddev->raid_disks, 
 				 GFP_KERNEL);
-	if (!conf->mirrors) {
-		printk(KERN_ERR "raid1: couldn't allocate memory for %s\n",
-		       mdname(mddev));
-		goto out_free_conf;
-	}
+	if (!conf->mirrors)
+		goto out_no_mem;
+
 	memset(conf->mirrors, 0, sizeof(struct mirror_info)*mddev->raid_disks);
 
+	conf->poolinfo = kmalloc(sizeof(*conf->poolinfo), GFP_KERNEL);
+	if (!conf->poolinfo)
+		goto out_no_mem;
+	conf->poolinfo->mddev = mddev;
+	conf->poolinfo->raid_disks = mddev->raid_disks;
 	conf->r1bio_pool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc,
-						r1bio_pool_free, mddev);
-	if (!conf->r1bio_pool) {
-		printk(KERN_ERR "raid1: couldn't allocate memory for %s\n", 
-			mdname(mddev));
-		goto out_free_conf;
-	}
+					  r1bio_pool_free,
+					  conf->poolinfo);
+	if (!conf->r1bio_pool)
+		goto out_no_mem;
+
 	mddev->queue->unplug_fn = raid1_unplug;
 
 
@@ -1224,13 +1246,21 @@
 
 	return 0;
 
+out_no_mem:
+	printk(KERN_ERR "raid1: couldn't allocate memory for %s\n",
+	       mdname(mddev));
+
 out_free_conf:
-	if (conf->r1bio_pool)
-		mempool_destroy(conf->r1bio_pool);
-	if (conf->mirrors)
-		kfree(conf->mirrors);
-	kfree(conf);
-	mddev->private = NULL;
+	if (conf) {
+		if (conf->r1bio_pool)
+			mempool_destroy(conf->r1bio_pool);
+		if (conf->mirrors)
+			kfree(conf->mirrors);
+		if (conf->poolinfo)
+			kfree(conf->poolinfo);
+		kfree(conf);
+		mddev->private = NULL;
+	}
 out:
 	return -EIO;
 }
@@ -1245,11 +1275,108 @@
 		mempool_destroy(conf->r1bio_pool);
 	if (conf->mirrors)
 		kfree(conf->mirrors);
+	if (conf->poolinfo)
+		kfree(conf->poolinfo);
 	kfree(conf);
 	mddev->private = NULL;
 	return 0;
 }
 
+static int raid1_resize(mddev_t *mddev, sector_t sectors)
+{
+	/* no resync is happening, and there is enough space
+	 * on all devices, so we can resize.
+	 * We need to make sure resync covers any new space.
+	 * If the array is shrinking we should possibly wait until
+	 * any io in the removed space completes, but it hardly seems
+	 * worth it.
+	 */
+	mddev->array_size = sectors>>1;
+	set_capacity(mddev->gendisk, mddev->array_size << 1);
+	mddev->changed = 1;
+	if (mddev->array_size > mddev->size && mddev->recovery_cp == MaxSector) {
+		mddev->recovery_cp = mddev->size << 1;
+		set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+	}
+	mddev->size = mddev->array_size;
+	return 0;
+}
+
+static int raid1_reshape(mddev_t *mddev, int raid_disks)
+{
+	/* We need to:
+	 * 1/ resize the r1bio_pool
+	 * 2/ resize conf->mirrors
+	 *
+	 * We allocate a new r1bio_pool if we can.
+	 * Then raise a device barrier and wait until all IO stops.
+	 * Then resize conf->mirrors and swap in the new r1bio pool.
+	 */
+	mempool_t *newpool, *oldpool;
+	struct pool_info *newpoolinfo;
+	mirror_info_t *newmirrors;
+	conf_t *conf = mddev_to_conf(mddev);
+
+	int d;
+
+	for (d= raid_disks; d < conf->raid_disks; d++)
+		if (conf->mirrors[d].rdev)
+			return -EBUSY;
+
+	newpoolinfo = kmalloc(sizeof(newpoolinfo), GFP_KERNEL);
+	if (!newpoolinfo)
+		return -ENOMEM;
+	newpoolinfo->mddev = mddev;
+	newpoolinfo->raid_disks = raid_disks;
+
+	newpool = mempool_create(NR_RAID1_BIOS, r1bio_pool_alloc,
+				 r1bio_pool_free, newpoolinfo);
+	if (!newpool) {
+		kfree(newpoolinfo);
+		return -ENOMEM;
+	}
+	newmirrors = kmalloc(sizeof(struct mirror_info) * raid_disks, GFP_KERNEL);
+	if (!newmirrors) {
+		kfree(newpoolinfo);
+		mempool_destroy(newpool);
+		return -ENOMEM;
+	}
+	memset(newmirrors, 0, sizeof(struct mirror_info)*raid_disks);
+
+	spin_lock_irq(&conf->resync_lock);
+	conf->barrier++;
+	wait_event_lock_irq(conf->wait_idle, !conf->nr_pending,
+			    conf->resync_lock, unplug_slaves(mddev));
+	spin_unlock_irq(&conf->resync_lock);
+
+	/* ok, everything is stopped */
+	oldpool = conf->r1bio_pool;
+	conf->r1bio_pool = newpool;
+	for (d=0; d < raid_disks && d < conf->raid_disks; d++)
+		newmirrors[d] = conf->mirrors[d];
+	kfree(conf->mirrors);
+	conf->mirrors = newmirrors;
+	kfree(conf->poolinfo);
+	conf->poolinfo = newpoolinfo;
+
+	mddev->degraded += (raid_disks - conf->raid_disks);
+	conf->raid_disks = mddev->raid_disks = raid_disks;
+
+	spin_lock_irq(&conf->resync_lock);
+	conf->barrier--;
+	spin_unlock_irq(&conf->resync_lock);
+	wake_up(&conf->wait_resume);
+	wake_up(&conf->wait_idle);
+
+
+	set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+	md_wakeup_thread(mddev->thread);
+
+	mempool_destroy(oldpool);
+	return 0;
+}
+
+
 static mdk_personality_t raid1_personality =
 {
 	.name		= "raid1",
@@ -1263,6 +1390,8 @@
 	.hot_remove_disk= raid1_remove_disk,
 	.spare_active	= raid1_spare_active,
 	.sync_request	= sync_request,
+	.resize		= raid1_resize,
+	.reshape	= raid1_reshape,
 };
 
 static int __init raid_init(void)
diff -Nru a/drivers/md/raid5.c b/drivers/md/raid5.c
--- a/drivers/md/raid5.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/md/raid5.c	Tue Jun 15 22:20:37 2004
@@ -395,7 +395,7 @@
 		md_error(conf->mddev, conf->disks[i].rdev);
 		clear_bit(R5_UPTODATE, &sh->dev[i].flags);
 	}
-	atomic_dec(&conf->disks[i].rdev->nr_pending);
+	rdev_dec_pending(conf->disks[i].rdev, conf->mddev);
 #if 0
 	/* must restore b_page before unlocking buffer... */
 	if (sh->bh_page[i] != bh->b_page) {
@@ -438,7 +438,7 @@
 	if (!uptodate)
 		md_error(conf->mddev, conf->disks[i].rdev);
 
-	atomic_dec(&conf->disks[i].rdev->nr_pending);
+	rdev_dec_pending(conf->disks[i].rdev, conf->mddev);
 	
 	clear_bit(R5_LOCKED, &sh->dev[i].flags);
 	set_bit(STRIPE_HANDLE, &sh->state);
@@ -1037,7 +1037,7 @@
 	 * parity, or to satisfy requests
 	 * or to load a block that is being partially written.
 	 */
-	if (to_read || non_overwrite || (syncing && (uptodate+failed < disks))) {
+	if (to_read || non_overwrite || (syncing && (uptodate < disks))) {
 		for (i=disks; i--;) {
 			dev = &sh->dev[i];
 			if (!test_bit(R5_LOCKED, &dev->flags) && !test_bit(R5_UPTODATE, &dev->flags) &&
@@ -1301,18 +1301,25 @@
 {
 	raid5_conf_t *conf = mddev_to_conf(mddev);
 	int i;
+	unsigned long flags;
 
+	spin_lock_irqsave(&conf->device_lock, flags);
 	for (i=0; i<mddev->raid_disks; i++) {
 		mdk_rdev_t *rdev = conf->disks[i].rdev;
-		if (rdev && !rdev->faulty) {
-			struct block_device *bdev = rdev->bdev;
-			if (bdev) {
-				request_queue_t *r_queue = bdev_get_queue(bdev);
-				if (r_queue && r_queue->unplug_fn)
-					r_queue->unplug_fn(r_queue);
-			}
+		if (rdev && atomic_read(&rdev->nr_pending)) {
+			request_queue_t *r_queue = bdev_get_queue(rdev->bdev);
+
+			atomic_inc(&rdev->nr_pending);
+			spin_unlock_irqrestore(&conf->device_lock, flags);
+
+			if (r_queue && r_queue->unplug_fn)
+				r_queue->unplug_fn(r_queue);
+
+			spin_lock_irqsave(&conf->device_lock, flags);
+			atomic_dec(&rdev->nr_pending);
 		}
 	}
+	spin_unlock_irqrestore(&conf->device_lock, flags);
 }
 
 static void raid5_unplug_device(request_queue_t *q)
@@ -1570,6 +1577,9 @@
 	conf->algorithm = mddev->layout;
 	conf->max_nr_stripes = NR_STRIPES;
 
+	/* device size must be a multiple of chunk size */
+	mddev->size &= ~(mddev->chunk_size/1024 -1);
+
 	if (!conf->chunk_size || conf->chunk_size % 4) {
 		printk(KERN_ERR "raid5: invalid chunk size %d for %s\n",
 			conf->chunk_size, mdname(mddev));
@@ -1821,6 +1831,27 @@
 	return found;
 }
 
+static int raid5_resize(mddev_t *mddev, sector_t sectors)
+{
+	/* no resync is happening, and there is enough space
+	 * on all devices, so we can resize.
+	 * We need to make sure resync covers any new space.
+	 * If the array is shrinking we should possibly wait until
+	 * any io in the removed space completes, but it hardly seems
+	 * worth it.
+	 */
+	sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
+	mddev->array_size = (sectors * (mddev->raid_disks-1))>>1;
+	set_capacity(mddev->gendisk, mddev->array_size << 1);
+	mddev->changed = 1;
+	if (sectors/2  > mddev->size && mddev->recovery_cp == MaxSector) {
+		mddev->recovery_cp = mddev->size << 1;
+		set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+	}
+	mddev->size = sectors /2;
+	return 0;
+}
+
 static mdk_personality_t raid5_personality=
 {
 	.name		= "raid5",
@@ -1834,6 +1865,7 @@
 	.hot_remove_disk= raid5_remove_disk,
 	.spare_active	= raid5_spare_active,
 	.sync_request	= sync_request,
+	.resize		= raid5_resize,
 };
 
 static int __init raid5_init (void)
diff -Nru a/drivers/md/raid6main.c b/drivers/md/raid6main.c
--- a/drivers/md/raid6main.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/md/raid6main.c	Tue Jun 15 22:20:36 2004
@@ -414,7 +414,7 @@
 		md_error(conf->mddev, conf->disks[i].rdev);
 		clear_bit(R5_UPTODATE, &sh->dev[i].flags);
 	}
-	atomic_dec(&conf->disks[i].rdev->nr_pending);
+	rdev_dec_pending(conf->disks[i].rdev, conf->mddev);
 #if 0
 	/* must restore b_page before unlocking buffer... */
 	if (sh->bh_page[i] != bh->b_page) {
@@ -457,7 +457,7 @@
 	if (!uptodate)
 		md_error(conf->mddev, conf->disks[i].rdev);
 
-	atomic_dec(&conf->disks[i].rdev->nr_pending);
+	rdev_dec_pending(conf->disks[i].rdev, conf->mddev);
 
 	clear_bit(R5_LOCKED, &sh->dev[i].flags);
 	set_bit(STRIPE_HANDLE, &sh->state);
@@ -1157,7 +1157,7 @@
 	 * parity, or to satisfy requests
 	 * or to load a block that is being partially written.
 	 */
-	if (to_read || non_overwrite || (syncing && (uptodate+failed < disks))) {
+	if (to_read || non_overwrite || (syncing && (uptodate < disks))) {
 		for (i=disks; i--;) {
 			dev = &sh->dev[i];
 			if (!test_bit(R5_LOCKED, &dev->flags) && !test_bit(R5_UPTODATE, &dev->flags) &&
@@ -1461,21 +1461,27 @@
 
 static void unplug_slaves(mddev_t *mddev)
 {
-	/* note: this is always called with device_lock held */
 	raid6_conf_t *conf = mddev_to_conf(mddev);
 	int i;
+	unsigned long flags;
 
+	spin_lock_irqsave(&conf->device_lock, flags);
 	for (i=0; i<mddev->raid_disks; i++) {
 		mdk_rdev_t *rdev = conf->disks[i].rdev;
-		if (rdev && !rdev->faulty) {
-			struct block_device *bdev = rdev->bdev;
-			if (bdev) {
-				request_queue_t *r_queue = bdev_get_queue(bdev);
-				if (r_queue && r_queue->unplug_fn)
-					r_queue->unplug_fn(r_queue);
-			}
+		if (rdev && atomic_read(&rdev->nr_pending)) {
+			request_queue_t *r_queue = bdev_get_queue(rdev->bdev);
+
+			atomic_inc(&rdev->nr_pending);
+			spin_unlock_irqrestore(&conf->device_lock, flags);
+
+			if (r_queue && r_queue->unplug_fn)
+				r_queue->unplug_fn(r_queue);
+
+			spin_lock_irqsave(&conf->device_lock, flags);
+			atomic_dec(&rdev->nr_pending);
 		}
 	}
+	spin_unlock_irqrestore(&conf->device_lock, flags);
 }
 
 static void raid6_unplug_device(request_queue_t *q)
@@ -1735,6 +1741,9 @@
 	conf->algorithm = mddev->layout;
 	conf->max_nr_stripes = NR_STRIPES;
 
+	/* device size must be a multiple of chunk size */
+	mddev->size &= ~(mddev->chunk_size/1024 -1);
+
 	if (conf->raid_disks < 4) {
 		printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n",
 		       mdname(mddev), conf->raid_disks);
@@ -1991,6 +2000,27 @@
 	return found;
 }
 
+static int raid6_resize(mddev_t *mddev, sector_t sectors)
+{
+	/* no resync is happening, and there is enough space
+	 * on all devices, so we can resize.
+	 * We need to make sure resync covers any new space.
+	 * If the array is shrinking we should possibly wait until
+	 * any io in the removed space completes, but it hardly seems
+	 * worth it.
+	 */
+	sectors &= ~((sector_t)mddev->chunk_size/512 - 1);
+	mddev->array_size = (sectors * (mddev->raid_disks-2))>>1;
+	set_capacity(mddev->gendisk, mddev->array_size << 1);
+	mddev->changed = 1;
+	if (sectors/2  > mddev->size && mddev->recovery_cp == MaxSector) {
+		mddev->recovery_cp = mddev->size << 1;
+		set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+	}
+	mddev->size = sectors /2;
+	return 0;
+}
+
 static mdk_personality_t raid6_personality=
 {
 	.name		= "raid6",
@@ -2004,6 +2034,7 @@
 	.hot_remove_disk= raid6_remove_disk,
 	.spare_active	= raid6_spare_active,
 	.sync_request	= sync_request,
+	.resize		= raid6_resize,
 };
 
 static int __init raid6_init (void)
diff -Nru a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
--- a/drivers/media/common/saa7146_fops.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/media/common/saa7146_fops.c	Tue Jun 15 22:20:40 2004
@@ -396,7 +396,7 @@
 	return 0;
 }
 
-static ssize_t fops_read(struct file *file, char *data, size_t count, loff_t *ppos)
+static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
 {
 	struct saa7146_fh *fh = file->private_data;
 
diff -Nru a/drivers/media/dvb/frontends/tda1004x.c b/drivers/media/dvb/frontends/tda1004x.c
--- a/drivers/media/dvb/frontends/tda1004x.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/media/dvb/frontends/tda1004x.c	Tue Jun 15 22:20:36 2004
@@ -190,6 +190,7 @@
 static struct fwinfo tda10046h_fwinfo[] = { {.file_size = 286720,.fw_offset = 0x3c4f9,.fw_size = 24479} };
 static int tda10046h_fwinfo_count = sizeof(tda10046h_fwinfo) / sizeof(struct fwinfo);
 
+static int errno;
 
 
 static int tda1004x_write_byte(struct dvb_i2c_bus *i2c, struct tda1004x_state *tda_state, int reg, int data)
diff -Nru a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
--- a/drivers/media/radio/radio-cadet.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/media/radio/radio-cadet.c	Tue Jun 15 22:20:40 2004
@@ -45,7 +45,7 @@
 static int curtuner=0;
 static int tunestat=0;
 static int sigstrength=0;
-static wait_queue_head_t readq;
+static wait_queue_head_t read_queue;
 struct timer_list tunertimer,rdstimer,readtimer;
 static __u8 rdsin=0,rdsout=0,rdsstat=0;
 static unsigned char rdsbuf[RDS_BUFFER];
@@ -309,7 +309,7 @@
 	 * Service pending read
 	 */
 	if( rdsin!=rdsout)
-	        wake_up_interruptible(&readq);
+	        wake_up_interruptible(&read_queue);
 
 	/* 
 	 * Clean up and exit
@@ -343,7 +343,7 @@
 	if(rdsin==rdsout) {
   	        if (file->f_flags & O_NONBLOCK)
 		        return -EWOULDBLOCK;
-	        interruptible_sleep_on(&readq);
+	        interruptible_sleep_on(&read_queue);
 	}		
 	while( i<count && rdsin!=rdsout)
 	        readbuf[i++]=rdsbuf[rdsout++];
@@ -473,7 +473,7 @@
 	if(users)
 		return -EBUSY;
 	users++;
-	init_waitqueue_head(&readq);
+	init_waitqueue_head(&read_queue);
 	return 0;
 }
 
diff -Nru a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c
--- a/drivers/media/radio/radio-typhoon.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/media/radio/radio-typhoon.c	Tue Jun 15 22:20:39 2004
@@ -326,7 +326,6 @@
 		return -EINVAL;
 	}
 	typhoon_unit.iobase = io;
-	init_MUTEX(&typhoon_unit.lock);
 
 	if (mutefreq < 87000 || mutefreq > 108500) {
 		printk(KERN_ERR "radio-typhoon: You must set a frequency (in kHz) used when muting the card,\n");
@@ -337,6 +336,7 @@
 #endif /* MODULE */
 
 	printk(KERN_INFO BANNER);
+	init_MUTEX(&typhoon_unit.lock);
 	io = typhoon_unit.iobase;
 	if (!request_region(io, 8, "typhoon")) {
 		printk(KERN_ERR "radio-typhoon: port 0x%x already in use\n",
diff -Nru a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
--- a/drivers/media/video/Kconfig	Tue Jun 15 22:21:02 2004
+++ b/drivers/media/video/Kconfig	Tue Jun 15 22:21:02 2004
@@ -33,7 +33,7 @@
 
 config VIDEO_PLANB
 	tristate "PlanB Video-In on PowerMac"
-	depends on PPC_PMAC && VIDEO_DEV
+	depends on PPC_PMAC && VIDEO_DEV && BROKEN
 	help
 	  PlanB is the V4L driver for the PowerMac 7x00/8x00 series video
 	  input hardware. If you want to experiment with this, say Y.
diff -Nru a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
--- a/drivers/media/video/bt832.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/media/video/bt832.c	Tue Jun 15 22:20:43 2004
@@ -197,7 +197,7 @@
 
 static int bt832_probe(struct i2c_adapter *adap)
 {
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, bt832_attach);
 	return 0;
 }
diff -Nru a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
--- a/drivers/media/video/bttv-i2c.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/media/video/bttv-i2c.c	Tue Jun 15 22:20:36 2004
@@ -108,8 +108,8 @@
 	.inc_use           = bttv_inc_use,
 	.dec_use           = bttv_dec_use,
 #endif
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	.class             = I2C_ADAP_CLASS_TV_ANALOG,
+#ifdef I2C_CLASS_TV_ANALOG
+	.class             = I2C_CLASS_TV_ANALOG,
 #endif
 	I2C_DEVNAME("bt848"),
 	.id                = I2C_HW_B_BT848,
@@ -291,8 +291,8 @@
 	.inc_use       = bttv_inc_use,
 	.dec_use       = bttv_dec_use,
 #endif
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	.class         = I2C_ADAP_CLASS_TV_ANALOG,
+#ifdef I2C_CLASS_TV_ANALOG
+	.class         = I2C_CLASS_TV_ANALOG,
 #endif
 	I2C_DEVNAME("bt878"),
 	.id            = I2C_ALGO_BIT | I2C_HW_B_BT848 /* FIXME */,
diff -Nru a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c
--- a/drivers/media/video/cpia_usb.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/media/video/cpia_usb.c	Tue Jun 15 22:20:36 2004
@@ -499,7 +499,7 @@
 	if (udev->descriptor.bNumConfigurations != 1)
 		return -ENODEV;
 
-	interface = &intf->altsetting[0];
+	interface = intf->cur_altsetting;
 
 	printk(KERN_INFO "USB CPiA camera found\n");
 
@@ -620,8 +620,6 @@
 		wake_up_interruptible(&ucpia->wq_stream);
 
 	udev = interface_to_usbdev(intf);
-	usb_driver_release_interface(&cpia_driver,
-				     udev->actconfig->interface[0]);
 
 	ucpia->curbuff = ucpia->workbuff = NULL;
 
diff -Nru a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
--- a/drivers/media/video/cx88/cx88-i2c.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/media/video/cx88/cx88-i2c.c	Tue Jun 15 22:20:39 2004
@@ -128,8 +128,8 @@
 	.inc_use           = cx8800_inc_use,
 	.dec_use           = cx8800_dec_use,
 #endif
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	.class             = I2C_ADAP_CLASS_TV_ANALOG,
+#ifdef I2C_CLASS_TV_ANALOG
+	.class             = I2C_CLASS_TV_ANALOG,
 #endif
 	I2C_DEVNAME("cx2388x"),
 	.id                = I2C_HW_B_BT848,
diff -Nru a/drivers/media/video/dpc7146.c b/drivers/media/video/dpc7146.c
--- a/drivers/media/video/dpc7146.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/media/video/dpc7146.c	Tue Jun 15 22:20:39 2004
@@ -106,7 +106,7 @@
 	   video port pins should be enabled here ?! */
 	saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
 
-	saa7146_i2c_adapter_prepare(dev, &dpc->i2c_adapter, I2C_ADAP_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
+	saa7146_i2c_adapter_prepare(dev, &dpc->i2c_adapter, I2C_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
 	if(i2c_add_adapter(&dpc->i2c_adapter) < 0) {
 		DEB_S(("cannot register i2c-device. skipping.\n"));
 		kfree(dpc);
diff -Nru a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c
--- a/drivers/media/video/hexium_gemini.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/media/video/hexium_gemini.c	Tue Jun 15 22:20:38 2004
@@ -250,7 +250,7 @@
 	/* enable i2c-port pins */
 	saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
 
-	saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, I2C_ADAP_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
+	saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, I2C_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
 	if (i2c_add_adapter(&hexium->i2c_adapter) < 0) {
 		DEB_S(("cannot register i2c-device. skipping.\n"));
 		kfree(hexium);
diff -Nru a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c
--- a/drivers/media/video/hexium_orion.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/media/video/hexium_orion.c	Tue Jun 15 22:21:05 2004
@@ -237,7 +237,7 @@
 	saa7146_write(dev, DD1_STREAM_B, 0x00000000);
 	saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
 
-	saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, I2C_ADAP_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
+	saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, I2C_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
 	if (i2c_add_adapter(&hexium->i2c_adapter) < 0) {
 		DEB_S(("cannot register i2c-device. skipping.\n"));
 		kfree(hexium);
diff -Nru a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c
--- a/drivers/media/video/ir-kbd-gpio.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/media/video/ir-kbd-gpio.c	Tue Jun 15 22:20:43 2004
@@ -20,7 +20,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
-#include <linux/input.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
@@ -65,7 +64,7 @@
 	[ 13 ] = KEY_STOP,        // freeze 
 	[ 29 ] = KEY_RECORD,      // capture 
 	[  3 ] = KEY_PLAY,        // unmarked
-	[ 24 ] = KEY_RED,         // unmarked
+	[ 23 ] = KEY_RED,         // unmarked
 	[  7 ] = KEY_GREEN,       // unmarked
 
 #if 0
diff -Nru a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
--- a/drivers/media/video/msp3400.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/media/video/msp3400.c	Tue Jun 15 22:20:41 2004
@@ -1353,8 +1353,8 @@
 
 static int msp_probe(struct i2c_adapter *adap)
 {
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+#ifdef I2C_CLASS_TV_ANALOG
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, msp_attach);
 #else
 	switch (adap->id) {
diff -Nru a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
--- a/drivers/media/video/mxb.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/media/video/mxb.c	Tue Jun 15 22:20:36 2004
@@ -24,42 +24,15 @@
 #define DEBUG_VARIABLE debug
 
 #include <media/saa7146_vv.h>
-#include <linux/video_decoder.h>	/* for saa7111a */
+#include <media/tuner.h>
+#include <linux/video_decoder.h>
 
 #include "mxb.h"
 #include "tea6415c.h"
 #include "tea6420.h"
 #include "tda9840.h"
-#include <media/tuner.h>
 
-#define I2C_SAA7111A            0x24
-
-/* All unused bytes are reserverd. */
-#define SAA711X_CHIP_VERSION            0x00
-#define SAA711X_ANALOG_INPUT_CONTROL_1  0x02
-#define SAA711X_ANALOG_INPUT_CONTROL_2  0x03
-#define SAA711X_ANALOG_INPUT_CONTROL_3  0x04
-#define SAA711X_ANALOG_INPUT_CONTROL_4  0x05
-#define SAA711X_HORIZONTAL_SYNC_START   0x06
-#define SAA711X_HORIZONTAL_SYNC_STOP    0x07
-#define SAA711X_SYNC_CONTROL            0x08
-#define SAA711X_LUMINANCE_CONTROL       0x09
-#define SAA711X_LUMINANCE_BRIGHTNESS    0x0A
-#define SAA711X_LUMINANCE_CONTRAST      0x0B
-#define SAA711X_CHROMA_SATURATION       0x0C
-#define SAA711X_CHROMA_HUE_CONTROL      0x0D
-#define SAA711X_CHROMA_CONTROL          0x0E
-#define SAA711X_FORMAT_DELAY_CONTROL    0x10
-#define SAA711X_OUTPUT_CONTROL_1        0x11
-#define SAA711X_OUTPUT_CONTROL_2        0x12
-#define SAA711X_OUTPUT_CONTROL_3        0x13
-#define SAA711X_V_GATE_1_START          0x15
-#define SAA711X_V_GATE_1_STOP           0x16
-#define SAA711X_V_GATE_1_MSB            0x17
-#define SAA711X_TEXT_SLICER_STATUS      0x1A
-#define SAA711X_DECODED_BYTES_OF_TS_1   0x1B
-#define SAA711X_DECODED_BYTES_OF_TS_2   0x1C
-#define SAA711X_STATUS_BYTE             0x1F
+#define I2C_SAA7111 0x24
 
 #define MXB_BOARD_CAN_DO_VBI(dev)   (dev->revision != 0) 
 
@@ -175,42 +148,33 @@
 
 static struct saa7146_extension extension;
 
-static int mxb_vbi_bypass(struct saa7146_dev* dev)
-{
-	struct mxb* mxb = (struct mxb*)dev->ext_priv;
-	s32 byte = 0x0;
-	int result = 0;
-
-	DEB_EE(("dev:%p\n",dev));
-
-	/* switch bypass in saa7111a, this should be done in the
-	   saa7111a driver of course... */
-	if ( -1 == (result = i2c_smbus_read_byte_data(mxb->saa7111a, SAA711X_OUTPUT_CONTROL_3))) {
-		DEB_D(("could not read from saa7111a.\n"));
-		return -EFAULT;
-	}
-	byte = result;
-	byte &= 0xf0;
-	byte |= 0x0a;
-
-	if ( 0 != (result = i2c_smbus_write_byte_data(mxb->saa7111a, SAA711X_OUTPUT_CONTROL_3, byte))) {
-		DEB_D(("could not write to saa7111a.\n"));
-		return -EFAULT;
-	}
-	return 0;
-}
-
 static int mxb_probe(struct saa7146_dev* dev)
 {
 	struct mxb* mxb = 0;
 	struct i2c_client *client;
 	struct list_head *item;
+	int result;
 
-	request_module("tuner");
-	request_module("tea6420");
-	request_module("tea6415c");
-	request_module("tda9840");
-	request_module("saa7111");
+	if ((result = request_module("saa7111")) < 0) {
+		printk("mxb: saa7111 i2c module not available.\n");
+		return -ENODEV;
+	}
+	if ((result = request_module("tuner")) < 0) {
+		printk("mxb: tuner i2c module not available.\n");
+		return -ENODEV;
+	}
+	if ((result = request_module("tea6420")) < 0) {
+		printk("mxb: tea6420 i2c module not available.\n");
+		return -ENODEV;
+	}
+	if ((result = request_module("tea6415c")) < 0) {
+		printk("mxb: tea6415c i2c module not available.\n");
+		return -ENODEV;
+	}
+	if ((result = request_module("tda9840")) < 0) {
+		printk("mxb: tda9840 i2c module not available.\n");
+		return -ENODEV;
+	}
 
 	mxb = (struct mxb*)kmalloc(sizeof(struct mxb), GFP_KERNEL);
 	if( NULL == mxb ) {
@@ -219,11 +183,7 @@
 	}
 	memset(mxb, 0x0, sizeof(struct mxb));	
 
-	/* FIXME: enable i2c-port pins, video-port-pins
-	   video port pins should be enabled here ?! */
-	saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
-
-	saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, I2C_ADAP_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
+	saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, I2C_CLASS_TV_ANALOG, SAA7146_I2C_BUS_BIT_RATE_480);
 	if(i2c_add_adapter(&mxb->i2c_adapter) < 0) {
 		DEB_S(("cannot register i2c-device. skipping.\n"));
 		kfree(mxb);
@@ -241,7 +201,7 @@
 			mxb->tea6415c = client;
 		if( I2C_TDA9840 == client->addr ) 
 			mxb->tda9840 = client;
-		if( I2C_SAA7111A == client->addr ) 
+		if( I2C_SAA7111 == client->addr )
 			mxb->saa7111a = client;
 		if( 0x60 == client->addr ) 
 			mxb->tuner = client;
@@ -251,8 +211,7 @@
 	if(    0 == mxb->tea6420_1	|| 0 == mxb->tea6420_2	|| 0 == mxb->tea6415c
 	    || 0 == mxb->tda9840	|| 0 == mxb->saa7111a	|| 0 == mxb->tuner ) {
 
-		printk("mxb: did not find all i2c devices. are you sure you\n");
-		printk("mxb: insmod'ed tea6420, tea6415c, saa7111, tea6415c and tuner?\n");
+		printk("mxb: did not find all i2c devices. aborting\n");
 		i2c_del_adapter(&mxb->i2c_adapter);
 		kfree(mxb);
 		return -ENODEV;
@@ -322,37 +281,35 @@
 	{-1, { 0} }
 };
 
-static unsigned char mxb_saa7111_init[25] = {
-	0x00,
-	
-	0x00,	  /* 00 - ID byte */
-	0x00,	  /* 01 - reserved */
+static const unsigned char mxb_saa7111_init[] = {
+	0x00, 0x00,	  /* 00 - ID byte */
+	0x01, 0x00,	  /* 01 - reserved */
 
 	/*front end */
-	0xd8,	  /* 02 - FUSE=x, GUDL=x, MODE=x */
-	0x23,	  /* 03 - HLNRS=0, VBSL=1, WPOFF=0, HOLDG=0, GAFIX=0, GAI1=256, GAI2=256 */
-	0x00,	  /* 04 - GAI1=256 */
-	0x00,	  /* 05 - GAI2=256 */
+	0x02, 0xd8,	  /* 02 - FUSE=x, GUDL=x, MODE=x */
+	0x03, 0x23,	  /* 03 - HLNRS=0, VBSL=1, WPOFF=0, HOLDG=0, GAFIX=0, GAI1=256, GAI2=256 */
+	0x04, 0x00,	  /* 04 - GAI1=256 */
+	0x05, 0x00,	  /* 05 - GAI2=256 */
 
 	/* decoder */
-	0xf0,	  /* 06 - HSB at  xx(50Hz) /  xx(60Hz) pixels after end of last line */
-	0x30,	  /* 07 - HSS at  xx(50Hz) /  xx(60Hz) pixels after end of last line */
-	0xa8,	  /* 08 - AUFD=x, FSEL=x, EXFIL=x, VTRC=x, HPLL=x, VNOI=x */
-	0x02,	  /* 09 - BYPS=x, PREF=x, BPSS=x, VBLB=x, UPTCV=x, APER=x */
-	0x80,	  /* 0a - BRIG=128 */
-	0x47,	  /* 0b - CONT=1.109 */
-	0x40,	  /* 0c - SATN=1.0 */
-	0x00,	  /* 0d - HUE=0 */
-	0x01,	  /* 0e - CDTO=0, CSTD=0, DCCF=0, FCTC=0, CHBW=1 */
-	0x00,	  /* 0f - reserved */
-	0xd0,	  /* 10 - OFTS=x, HDEL=x, VRLN=x, YDEL=x */
-	0x8c,	  /* 11 - GPSW=x, CM99=x, FECO=x, COMPO=x, OEYC=1, OEHV=1, VIPB=0, COLO=0 */
-	0x80,	  /* 12 - xx output control 2 */
-	0x30,	  /* 13 - xx output control 3 */
-	0x00,	  /* 14 - reserved */
-	0x15,	  /* 15 - VBI */
-	0x04,	  /* 16 - VBI */
-	0x00,	  /* 17 - VBI */
+	0x06, 0xf0,	  /* 06 - HSB at  xx(50Hz) /  xx(60Hz) pixels after end of last line */
+	0x07, 0x30,	  /* 07 - HSS at  xx(50Hz) /  xx(60Hz) pixels after end of last line */
+	0x08, 0xa8,	  /* 08 - AUFD=x, FSEL=x, EXFIL=x, VTRC=x, HPLL=x, VNOI=x */
+	0x09, 0x02,	  /* 09 - BYPS=x, PREF=x, BPSS=x, VBLB=x, UPTCV=x, APER=x */
+	0x0a, 0x80,	  /* 0a - BRIG=128 */
+	0x0b, 0x47,	  /* 0b - CONT=1.109 */
+	0x0c, 0x40,	  /* 0c - SATN=1.0 */
+	0x0d, 0x00,	  /* 0d - HUE=0 */
+	0x0e, 0x01,	  /* 0e - CDTO=0, CSTD=0, DCCF=0, FCTC=0, CHBW=1 */
+	0x0f, 0x00,	  /* 0f - reserved */
+	0x10, 0xd0,	  /* 10 - OFTS=x, HDEL=x, VRLN=x, YDEL=x */
+	0x11, 0x8c,	  /* 11 - GPSW=x, CM99=x, FECO=x, COMPO=x, OEYC=1, OEHV=1, VIPB=0, COLO=0 */
+	0x12, 0x80,	  /* 12 - xx output control 2 */
+	0x13, 0x30,	  /* 13 - xx output control 3 */
+	0x14, 0x00,	  /* 14 - reserved */
+	0x15, 0x15,	  /* 15 - VBI */
+	0x16, 0x04,	  /* 16 - VBI */
+	0x17, 0x00,	  /* 17 - VBI */
 };
 
 /* bring hardware to a sane state. this has to be done, just in case someone
@@ -362,25 +319,29 @@
 static int mxb_init_done(struct saa7146_dev* dev)
 {
 	struct mxb* mxb = (struct mxb*)dev->ext_priv;
-	
+	struct video_decoder_init init;
 	struct i2c_msg msg;
 
 	int i = 0, err = 0;
 	struct	tea6415c_multiplex vm;	
 
+	/* select video mode in saa7111a */
+	i = VIDEO_MODE_PAL;
+	/* fixme: currently pointless: gets overwritten by configuration below */
+	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_NORM, &i);
+
 	/* write configuration to saa7111a */
-	i = i2c_master_send(mxb->saa7111a, mxb_saa7111_init, sizeof(mxb_saa7111_init));
-	if (i < 0) {
-		printk("failed to initialize saa7111a. this should never happen.\n");
-	}
+	init.data = mxb_saa7111_init;
+	init.len = sizeof(mxb_saa7111_init);
+	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_INIT, &init);
 
 	/* select tuner-output on saa7111a */
 	i = 0;
 	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i);
-//	i = VIDEO_MODE_PAL;
-//	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_NORM, &i);
 
-	mxb_vbi_bypass(dev);
+	/* enable vbi bypass */
+	i = 1;
+	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i);
 
 	/* select a tuner type */
 	i = 5; 
@@ -538,36 +499,6 @@
 	return 0;
 }
 
-/* hack: this should go into saa711x */
-static int saa7111_set_gpio(struct saa7146_dev *dev, int bl)
-{
-	struct mxb* mxb = (struct mxb*)dev->ext_priv;
-	s32 byte = 0x0;
-	int result = 0;
-	
-	DEB_EE(("dev:%p\n",dev));
-
-	/* get the old register contents */
-	if ( -1 == (byte = i2c_smbus_read_byte_data(mxb->saa7111a, SAA711X_OUTPUT_CONTROL_1))) {
-		DEB_D(("could not read from saa711x\n"));
-		return -EFAULT;
-	}
-	
-	if( 0 == bl ) {
-		byte &= 0x7f;
-	} else {
-		byte |= 0x80;
-	}
-
-	/* write register contents back */
-	if ( 0 != (result = i2c_smbus_write_byte_data(mxb->saa7111a, SAA711X_OUTPUT_CONTROL_1, byte))) {
-		DEB_D(("could not write to saa711x\n"));
-		return -EFAULT;
-	}
-
-	return 0;
-}
-
 static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 
 {
 	struct saa7146_dev *dev = fh->dev;
@@ -988,18 +919,22 @@
 
 static int std_callback(struct saa7146_dev* dev, struct saa7146_standard *std)
 {
+	struct mxb* mxb = (struct mxb*)dev->ext_priv;
+	int zero = 0;
+	int one = 1;
+
 	if(V4L2_STD_PAL_I == std->id ) {
 		DEB_D(("VIDIOC_S_STD: setting mxb for PAL_I.\n"));
 		/* set the 7146 gpio register -- I don't know what this does exactly */
       		saa7146_write(dev, GPIO_CTRL, 0x00404050);
 		/* unset the 7111 gpio register -- I don't know what this does exactly */
-		saa7111_set_gpio(dev,0);
+		mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &zero);
 	} else {
 		DEB_D(("VIDIOC_S_STD: setting mxb for PAL/NTSC/SECAM.\n"));
 		/* set the 7146 gpio register -- I don't know what this does exactly */
       		saa7146_write(dev, GPIO_CTRL, 0x00404050);
 		/* set the 7111 gpio register -- I don't know what this does exactly */
-		saa7111_set_gpio(dev,1);
+		mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_GPIO, &one);
 	}
 	return 0;
 }
diff -Nru a/drivers/media/video/planb.c b/drivers/media/video/planb.c
--- a/drivers/media/video/planb.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/media/video/planb.c	Tue Jun 15 22:20:43 2004
@@ -1383,8 +1383,6 @@
 	pb->user++;
 
 	DEBUG("PlanB: device opened\n");
-
-	MOD_INC_USE_COUNT;
 	return 0;   
 }
 
@@ -1407,8 +1405,6 @@
 	planb_unlock(pb);
 
 	DEBUG("PlanB: device closed\n");
-
-	MOD_DEC_USE_COUNT;  
 }
 
 static long planb_read(struct video_device *v, char *buf, unsigned long count,
diff -Nru a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
--- a/drivers/media/video/saa5246a.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/media/video/saa5246a.c	Tue Jun 15 22:20:40 2004
@@ -143,7 +143,7 @@
  */
 static int saa5246a_probe(struct i2c_adapter *adap)
 {
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, saa5246a_attach);
 	return 0;
 }
diff -Nru a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
--- a/drivers/media/video/saa5249.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/media/video/saa5249.c	Tue Jun 15 22:20:43 2004
@@ -219,7 +219,7 @@
  
 static int saa5249_probe(struct i2c_adapter *adap)
 {
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, saa5249_attach);
 	return 0;
 }
diff -Nru a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
--- a/drivers/media/video/saa7111.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/media/video/saa7111.c	Tue Jun 15 22:20:39 2004
@@ -9,6 +9,9 @@
  * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net>
  *    - moved over to linux>=2.4.x i2c protocol (1/1/2003)
  *
+ * Changes by Michael Hunold <michael@mihu.de>
+ *    - implemented DECODER_SET_GPIO, DECODER_INIT, DECODER_SET_VBI_BYPASS
+ *
  * 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
@@ -112,7 +115,7 @@
 		u8 block_data[32];
 
 		msg.addr = client->addr;
-		msg.flags = client->flags;
+		msg.flags = 0;
 		while (len >= 2) {
 			msg.buf = (char *) block_data;
 			msg.len = 0;
@@ -142,6 +145,13 @@
 	return ret;
 }
 
+static int
+saa7111_init_decoder (struct i2c_client *client,
+	      struct video_decoder_init *init)
+{
+	return saa7111_write_block(client, init->data, init->len);
+}
+
 static inline int
 saa7111_read (struct i2c_client *client,
 	      u8                 reg)
@@ -151,7 +161,7 @@
 
 /* ----------------------------------------------------------------------- */
 
-static const unsigned char init[] = {
+static const unsigned char saa7111_i2c_init[] = {
 	0x00, 0x00,		/* 00 - ID byte */
 	0x01, 0x00,		/* 01 - reserved */
 
@@ -201,8 +211,18 @@
 	switch (cmd) {
 
 	case 0:
-		//saa7111_write_block(client, init, sizeof(init));
-		break;
+	case DECODER_INIT:
+	{
+		struct video_decoder_init *init = arg;
+		if (NULL != init)
+			return saa7111_init_decoder(client, init);
+		else {
+			struct video_decoder_init vdi;
+			vdi.data = saa7111_i2c_init;
+			vdi.len = sizeof(saa7111_i2c_init);
+			return saa7111_init_decoder(client, &vdi);
+		}
+	}
 
 	case DECODER_DUMP:
 	{
@@ -274,6 +294,32 @@
 	}
 		break;
 
+	case DECODER_SET_GPIO:
+	{
+		int *iarg = arg;
+		if (0 != *iarg) {
+			saa7111_write(client, 0x11,
+				(decoder->reg[0x11] | 0x80));
+		} else {
+			saa7111_write(client, 0x11,
+				(decoder->reg[0x11] & 0x7f));
+		}
+		break;
+	}
+
+	case DECODER_SET_VBI_BYPASS:
+	{
+		int *iarg = arg;
+		if (0 != *iarg) {
+			saa7111_write(client, 0x13,
+				(decoder->reg[0x13] & 0xf0) | 0x0a);
+		} else {
+			saa7111_write(client, 0x13,
+				(decoder->reg[0x13] & 0xf0));
+		}
+		break;
+	}
+
 	case DECODER_SET_NORM:
 	{
 		int *iarg = arg;
@@ -465,6 +511,7 @@
 	int i;
 	struct i2c_client *client;
 	struct saa7111 *decoder;
+	struct video_decoder_init vdi;
 
 	dprintk(1,
 		KERN_INFO
@@ -509,7 +556,9 @@
 		return i;
 	}
 
-	i = saa7111_write_block(client, init, sizeof(init));
+	vdi.data = saa7111_i2c_init;
+	vdi.len = sizeof(saa7111_i2c_init);
+	i = saa7111_init_decoder(client, &vdi);
 	if (i < 0) {
 		dprintk(1, KERN_ERR "%s_attach error: init status %d\n",
 			I2C_NAME(client), i);
diff -Nru a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
--- a/drivers/media/video/saa7134/saa6752hs.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/media/video/saa7134/saa6752hs.c	Tue Jun 15 22:21:04 2004
@@ -335,7 +335,7 @@
 
 static int saa6752hs_probe(struct i2c_adapter *adap)
 {
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, saa6752hs_attach);
 
 	return 0;
diff -Nru a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
--- a/drivers/media/video/saa7134/saa7134-i2c.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/media/video/saa7134/saa7134-i2c.c	Tue Jun 15 22:20:37 2004
@@ -347,8 +347,8 @@
 	.inc_use       = inc_use,
 	.dec_use       = dec_use,
 #endif
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	.class         = I2C_ADAP_CLASS_TV_ANALOG,
+#ifdef I2C_CLASS_TV_ANALOG
+	.class         = I2C_CLASS_TV_ANALOG,
 #endif
 	I2C_DEVNAME("saa7134"),
 	.id            = I2C_ALGO_SAA7134,
diff -Nru a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
--- a/drivers/media/video/saa7134/saa7134-input.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/media/video/saa7134/saa7134-input.c	Tue Jun 15 22:20:43 2004
@@ -19,7 +19,6 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/input.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
diff -Nru a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
--- a/drivers/media/video/tda7432.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/media/video/tda7432.c	Tue Jun 15 22:20:43 2004
@@ -338,8 +338,8 @@
 
 static int tda7432_probe(struct i2c_adapter *adap)
 {
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+#ifdef I2C_CLASS_TV_ANALOG
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, tda7432_attach);
 #else
 	if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848))
diff -Nru a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
--- a/drivers/media/video/tda9875.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/media/video/tda9875.c	Tue Jun 15 22:20:39 2004
@@ -272,8 +272,8 @@
 
 static int tda9875_probe(struct i2c_adapter *adap)
 {
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+#ifdef I2C_CLASS_TV_ANALOG
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, tda9875_attach);
 #else
 	if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848))
diff -Nru a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
--- a/drivers/media/video/tda9887.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/media/video/tda9887.c	Tue Jun 15 22:20:35 2004
@@ -370,8 +370,8 @@
 
 static int tda9887_probe(struct i2c_adapter *adap)
 {
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+#ifdef I2C_CLASS_TV_ANALOG
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, tda9887_attach);
 #else
 	switch (adap->id) {
diff -Nru a/drivers/media/video/tuner.c b/drivers/media/video/tuner.c
--- a/drivers/media/video/tuner.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/media/video/tuner.c	Tue Jun 15 22:20:44 2004
@@ -1067,8 +1067,8 @@
 	}
 	this_adap = 0;
 
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+#ifdef I2C_CLASS_TV_ANALOG
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, tuner_attach);
 #else
 	switch (adap->id) {
diff -Nru a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
--- a/drivers/media/video/tvaudio.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/media/video/tvaudio.c	Tue Jun 15 22:20:38 2004
@@ -1497,8 +1497,8 @@
 
 static int chip_probe(struct i2c_adapter *adap)
 {
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	if (adap->class & I2C_ADAP_CLASS_TV_ANALOG)
+#ifdef I2C_CLASS_TV_ANALOG
+	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, chip_attach);
 #else
 	switch (adap->id) {
diff -Nru a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c
--- a/drivers/media/video/tvmixer.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/media/video/tvmixer.c	Tue Jun 15 22:20:58 2004
@@ -263,8 +263,8 @@
 	struct video_audio va;
 	int i,minor;
 
-#ifdef I2C_ADAP_CLASS_TV_ANALOG
-	if (!(client->adapter->class & I2C_ADAP_CLASS_TV_ANALOG))
+#ifdef I2C_CLASS_TV_ANALOG
+	if (!(client->adapter->class & I2C_CLASS_TV_ANALOG))
 		return -1;
 #else
 	/* TV card ??? */
diff -Nru a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c
--- a/drivers/media/video/video-buf.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/media/video/video-buf.c	Tue Jun 15 22:20:40 2004
@@ -1176,7 +1176,7 @@
 	map->end      = vma->vm_end;
 	map->q        = q;
 	vma->vm_ops   = &videobuf_vm_ops;
-	vma->vm_flags |= VM_DONTEXPAND;
+	vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED;
 	vma->vm_flags &= ~VM_IO; /* using shared anonymous pages */
 	vma->vm_private_data = map;
 	dprintk(1,"mmap %p: %08lx-%08lx pgoff %08lx bufs %d-%d\n",
diff -Nru a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
--- a/drivers/media/video/videodev.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/media/video/videodev.c	Tue Jun 15 22:20:37 2004
@@ -397,12 +397,21 @@
  
 static int __init videodev_init(void)
 {
+	int ret;
+
 	printk(KERN_INFO "Linux video capture interface: v1.00\n");
-	if (register_chrdev(VIDEO_MAJOR,VIDEO_NAME, &video_fops)) {
-		printk("video_dev: unable to get major %d\n", VIDEO_MAJOR);
+	if (register_chrdev(VIDEO_MAJOR, VIDEO_NAME, &video_fops)) {
+		printk(KERN_WARNING "video_dev: unable to get major %d\n", VIDEO_MAJOR);
 		return -EIO;
 	}
-	class_register(&video_class);
+
+	ret = class_register(&video_class);
+	if (ret < 0) {
+		unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME);
+		printk(KERN_WARNING "video_dev: class_register failed\n");
+		return -EIO;
+	}
+
 	return 0;
 }
 
diff -Nru a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig
--- a/drivers/message/fusion/Kconfig	Tue Jun 15 22:21:05 2004
+++ b/drivers/message/fusion/Kconfig	Tue Jun 15 22:21:05 2004
@@ -3,7 +3,7 @@
 
 config FUSION
 	tristate "Fusion MPT (base + ScsiHost) drivers"
-	depends on PCI
+	depends on PCI && SCSI
 	---help---
 	  LSI Logic Fusion(TM) Message Passing Technology (MPT) device support
 	  provides high performance SCSI host initiator, and LAN [1] interface
diff -Nru a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
--- a/drivers/message/fusion/mptbase.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/message/fusion/mptbase.c	Tue Jun 15 22:20:38 2004
@@ -223,6 +223,7 @@
 
 //int		mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag);
 static int	ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers);
+static void	mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf);
 static void	mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info);
 static void	mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info);
 
@@ -263,6 +264,8 @@
  */
 
 static struct pci_device_id mptbase_pci_table[] = {
+	{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC909,
+		PCI_ANY_ID, PCI_ANY_ID },
 	{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC929,
 		PCI_ANY_ID, PCI_ANY_ID },
 	{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_FC919,
@@ -389,6 +392,12 @@
 				else
 					mpt_sp_log_info(ioc, log_info);
 			}
+			if (ioc_stat & MPI_IOCSTATUS_MASK) {
+				if ((int)ioc->chip_type <= (int)FC929)
+						;
+				else
+					mpt_sp_ioc_info(ioc, (u32)ioc_stat, mf);
+			}
 		} else {
 			/*
 			 *  Process turbo (context) reply...
@@ -1350,6 +1359,10 @@
 	}
 
 	ioc->chip_type = FCUNK;
+	if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC909) {
+		ioc->chip_type = FC909;
+		ioc->prod_name = "LSIFC909";
+	}
 	if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929) {
 		ioc->chip_type = FC929;
 		ioc->prod_name = "LSIFC929";
@@ -6086,9 +6099,153 @@
 	case 0x00080000:
 		desc = "Outbound DMA Overrun";
 		break;
+	
+	case 0x00090000:
+		desc = "Task Management";
+		break;
+
+	case 0x000A0000:
+		desc = "Device Problem";
+		break;
+
+	case 0x000B0000:
+		desc = "Invalid Phase Change";
+		break;
+
+	case 0x000C0000:
+		desc = "Untagged Table Size";
+		break;
+	
 	}
 
 	printk(MYIOC_s_INFO_FMT "LogInfo(0x%08x): F/W: %s\n", ioc->name, log_info, desc);
+}
+
+/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+/*
+ *	mpt_sp_ioc_info - IOC information returned from SCSI Parallel IOC.
+ *	@ioc: Pointer to MPT_ADAPTER structure
+ *	@ioc_status: U32 IOCStatus word from IOC
+ *	@mf: Pointer to MPT request frame
+ *
+ *	Refer to lsi/mpi.h.
+ */
+static void
+mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
+{
+	u32 status = ioc_status & MPI_IOCSTATUS_MASK;
+	char *desc = "";
+
+	switch (status) {
+	case MPI_IOCSTATUS_INVALID_FUNCTION: /* 0x0001 */
+		desc = "Invalid Function";
+		break;
+
+	case MPI_IOCSTATUS_BUSY: /* 0x0002 */
+		desc = "Busy";
+		break;
+
+	case MPI_IOCSTATUS_INVALID_SGL: /* 0x0003 */
+		desc = "Invalid SGL";
+		break;
+
+	case MPI_IOCSTATUS_INTERNAL_ERROR: /* 0x0004 */
+		desc = "Internal Error";
+		break;
+
+	case MPI_IOCSTATUS_RESERVED: /* 0x0005 */
+		desc = "Reserved";
+		break;
+
+	case MPI_IOCSTATUS_INSUFFICIENT_RESOURCES: /* 0x0006 */
+		desc = "Insufficient Resources";
+		break;
+
+	case MPI_IOCSTATUS_INVALID_FIELD: /* 0x0007 */
+		desc = "Invalid Field";
+		break;
+
+	case MPI_IOCSTATUS_INVALID_STATE: /* 0x0008 */
+		desc = "Invalid State";
+		break;
+
+	case MPI_IOCSTATUS_CONFIG_INVALID_ACTION: /* 0x0020 */
+	case MPI_IOCSTATUS_CONFIG_INVALID_TYPE:   /* 0x0021 */
+	case MPI_IOCSTATUS_CONFIG_INVALID_PAGE:   /* 0x0022 */
+	case MPI_IOCSTATUS_CONFIG_INVALID_DATA:   /* 0x0023 */
+	case MPI_IOCSTATUS_CONFIG_NO_DEFAULTS:    /* 0x0024 */
+	case MPI_IOCSTATUS_CONFIG_CANT_COMMIT:    /* 0x0025 */
+		/* No message for Config IOCStatus values */
+		break;
+
+	case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */
+		/* No message for recovered error
+		desc = "SCSI Recovered Error";
+		*/
+		break;
+
+	case MPI_IOCSTATUS_SCSI_INVALID_BUS: /* 0x0041 */
+		desc = "SCSI Invalid Bus";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_INVALID_TARGETID: /* 0x0042 */
+		desc = "SCSI Invalid TargetID";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */
+	  {
+		SCSIIORequest_t *pScsiReq = (SCSIIORequest_t *) mf;
+		U8 cdb = pScsiReq->CDB[0];
+		if (cdb != 0x12) { /* Inquiry is issued for device scanning */
+			desc = "SCSI Device Not There";
+		}
+		break;
+	  }
+
+	case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */
+		desc = "SCSI Data Overrun";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */
+		/* This error is checked in scsi_io_done(). Skip. 
+		desc = "SCSI Data Underrun";
+		*/
+		break;
+
+	case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */
+		desc = "SCSI I/O Data Error";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR: /* 0x0047 */
+		desc = "SCSI Protocol Error";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */
+		desc = "SCSI Task Terminated";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */
+		desc = "SCSI Residual Mismatch";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */
+		desc = "SCSI Task Management Failed";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_IOC_TERMINATED: /* 0x004B */
+		desc = "SCSI IOC Terminated";
+		break;
+
+	case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */
+		desc = "SCSI Ext Terminated";
+		break;
+
+	default:
+		desc = "Others";
+		break;
+	}
+	if (desc != "")
+		printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04x): %s\n", ioc->name, status, desc);
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff -Nru a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
--- a/drivers/message/fusion/mptbase.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/message/fusion/mptbase.h	Tue Jun 15 22:20:37 2004
@@ -81,8 +81,8 @@
 #define COPYRIGHT	"Copyright (c) 1999-2004 " MODULEAUTHOR
 #endif
 
-#define MPT_LINUX_VERSION_COMMON	"3.01.03"
-#define MPT_LINUX_PACKAGE_NAME		"@(#)mptlinux-3.01.03"
+#define MPT_LINUX_VERSION_COMMON	"3.01.06"
+#define MPT_LINUX_PACKAGE_NAME		"@(#)mptlinux-3.01.06"
 #define WHAT_MAGIC_STRING		"@" "(" "#" ")"
 
 #define show_mptmod_ver(s,ver)  \
diff -Nru a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
--- a/drivers/message/fusion/mptctl.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/message/fusion/mptctl.c	Tue Jun 15 22:20:36 2004
@@ -1199,7 +1199,7 @@
 mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
 {
 	struct mpt_ioctl_iocinfo *uarg = (struct mpt_ioctl_iocinfo *) arg;
-	struct mpt_ioctl_iocinfo karg;
+	struct mpt_ioctl_iocinfo *karg;
 	MPT_ADAPTER		*ioc;
 	struct pci_dev		*pdev;
 	struct Scsi_Host	*sh;
@@ -1219,34 +1219,46 @@
 	 */
 	if (data_size == sizeof(struct mpt_ioctl_iocinfo_rev0))
 		cim_rev = 0;
-	else if (data_size == sizeof(struct mpt_ioctl_iocinfo))
+	else if (data_size == sizeof(struct mpt_ioctl_iocinfo_rev1))
 		cim_rev = 1;
+	else if (data_size == sizeof(struct mpt_ioctl_iocinfo))
+		cim_rev = 2;
 	else if (data_size == (sizeof(struct mpt_ioctl_iocinfo_rev0)+12))
 		cim_rev = 0;	/* obsolete */
 	else
 		return -EFAULT;
-
-	if (copy_from_user(&karg, uarg, data_size)) {
+	
+	karg = kmalloc(data_size, GFP_KERNEL);
+	if (karg == NULL) {
+		printk(KERN_ERR "%s::mpt_ioctl_iocinfo() @%d - no memory available!\n",
+				__FILE__, __LINE__);
+		return -ENOMEM;
+	}
+		
+	if (copy_from_user(karg, uarg, data_size)) {
 		printk(KERN_ERR "%s@%d::mptctl_getiocinfo - "
 			"Unable to read in mpt_ioctl_iocinfo struct @ %p\n",
 				__FILE__, __LINE__, (void*)uarg);
+		kfree(karg);
 		return -EFAULT;
 	}
 
-	if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
+	if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
 	    (ioc == NULL)) {
 		dctlprintk((KERN_ERR "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
 				__FILE__, __LINE__, iocnum));
+		kfree(karg);
 		return -ENODEV;
 	}
 
 	/* Verify the data transfer size is correct.
 	 * Ignore the port setting.
 	 */
-	if (karg.hdr.maxDataSize != data_size) {
+	if (karg->hdr.maxDataSize != data_size) {
 		printk(KERN_ERR "%s@%d::mptctl_getiocinfo - "
 			"Structure size mismatch. Command not completed.\n",
 				__FILE__, __LINE__);
+		kfree(karg);
 		return -EFAULT;
 	}
 
@@ -1254,29 +1266,37 @@
 	 * program
 	 */
 	if ((int)ioc->chip_type <= (int) FC929)
-		karg.adapterType = MPT_IOCTL_INTERFACE_FC;
+		karg->adapterType = MPT_IOCTL_INTERFACE_FC;
 	else
-		karg.adapterType = MPT_IOCTL_INTERFACE_SCSI;
+		karg->adapterType = MPT_IOCTL_INTERFACE_SCSI;
 
-	port = karg.hdr.port;
+	port = karg->hdr.port;
 
-	karg.port = port;
+	karg->port = port;
 	pdev = (struct pci_dev *) ioc->pcidev;
 
-	karg.pciId = pdev->device;
+	karg->pciId = pdev->device;
 	pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
-	karg.hwRev = revision;
+	karg->hwRev = revision;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-	karg.subSystemDevice = pdev->subsystem_device;
-	karg.subSystemVendor = pdev->subsystem_vendor;
+	karg->subSystemDevice = pdev->subsystem_device;
+	karg->subSystemVendor = pdev->subsystem_vendor;
 #endif
 
 	if (cim_rev == 1) {
 		/* Get the PCI bus, device, and function numbers for the IOC
 		 */
-		karg.pciInfo.u.bits.busNumber = pdev->bus->number;
-		karg.pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn );
-		karg.pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
+		karg->pciInfo.u.bits.busNumber = pdev->bus->number;
+		karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn );
+		karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
+	} else if (cim_rev == 2) {
+		/* Get the PCI bus, device, function and segment ID numbers 
+		   for the IOC */
+		karg->pciInfo.u.bits.busNumber = pdev->bus->number;
+		karg->pciInfo.u.bits.deviceNumber = PCI_SLOT( pdev->devfn );
+		karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
+		karg->pciInfo.u.bits.functionNumber = PCI_FUNC( pdev->devfn );
+		karg->pciInfo.segmentID = pci_domain_nr(pdev->bus);
 	}
 
 	/* Get number of devices
@@ -1297,31 +1317,33 @@
 			}
 		}
 	}
-	karg.numDevices = numDevices;
+	karg->numDevices = numDevices;
 
 	/* Set the BIOS and FW Version
 	 */
-	karg.FWVersion = ioc->facts.FWVersion.Word;
-	karg.BIOSVersion = ioc->biosVersion;
+	karg->FWVersion = ioc->facts.FWVersion.Word;
+	karg->BIOSVersion = ioc->biosVersion;
 
 	/* Set the Version Strings.
 	 */
-	strncpy (karg.driverVersion, MPT_LINUX_PACKAGE_NAME, MPT_IOCTL_VERSION_LENGTH);
-	karg.driverVersion[MPT_IOCTL_VERSION_LENGTH-1]='\0';
+	strncpy (karg->driverVersion, MPT_LINUX_PACKAGE_NAME, MPT_IOCTL_VERSION_LENGTH);
+	karg->driverVersion[MPT_IOCTL_VERSION_LENGTH-1]='\0';
 
-	karg.busChangeEvent = 0;
-	karg.hostId = ioc->pfacts[port].PortSCSIID;
-	karg.rsvd[0] = karg.rsvd[1] = 0;
+	karg->busChangeEvent = 0;
+	karg->hostId = ioc->pfacts[port].PortSCSIID;
+	karg->rsvd[0] = karg->rsvd[1] = 0;
 
 	/* Copy the data from kernel memory to user memory
 	 */
-	if (copy_to_user((char *)arg, &karg, data_size)) {
+	if (copy_to_user((char *)arg, karg, data_size)) {
 		printk(KERN_ERR "%s@%d::mptctl_getiocinfo - "
 			"Unable to write out mpt_ioctl_iocinfo struct @ %p\n",
 				__FILE__, __LINE__, (void*)uarg);
+		kfree(karg);
 		return -EFAULT;
 	}
 
+	kfree(karg);
 	return 0;
 }
 
@@ -2909,6 +2931,8 @@
 	if (++where && err) goto out_fail;
 	err = register_ioctl32_conversion(MPTIOCINFO1, compat_mptctl_ioctl);
 	if (++where && err) goto out_fail;
+	err = register_ioctl32_conversion(MPTIOCINFO2, compat_mptctl_ioctl);
+	if (++where && err) goto out_fail;
 	err = register_ioctl32_conversion(MPTTARGETINFO, compat_mptctl_ioctl);
 	if (++where && err) goto out_fail;
 	err = register_ioctl32_conversion(MPTTEST, compat_mptctl_ioctl);
@@ -2968,6 +2992,7 @@
 			" (%d:err=%d)\n", where, err);
 	unregister_ioctl32_conversion(MPTIOCINFO);
 	unregister_ioctl32_conversion(MPTIOCINFO1);
+	unregister_ioctl32_conversion(MPTIOCINFO2);
 	unregister_ioctl32_conversion(MPTTARGETINFO);
 	unregister_ioctl32_conversion(MPTTEST);
 	unregister_ioctl32_conversion(MPTEVENTQUERY);
@@ -3018,6 +3043,7 @@
 #ifdef CONFIG_COMPAT
 	unregister_ioctl32_conversion(MPTIOCINFO);
 	unregister_ioctl32_conversion(MPTIOCINFO1);
+	unregister_ioctl32_conversion(MPTIOCINFO2);
 	unregister_ioctl32_conversion(MPTTARGETINFO);
 	unregister_ioctl32_conversion(MPTTEST);
 	unregister_ioctl32_conversion(MPTEVENTQUERY);
diff -Nru a/drivers/message/fusion/mptctl.h b/drivers/message/fusion/mptctl.h
--- a/drivers/message/fusion/mptctl.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/message/fusion/mptctl.h	Tue Jun 15 22:20:40 2004
@@ -91,6 +91,7 @@
 
 #define MPTIOCINFO		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
 #define MPTIOCINFO1		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
+#define MPTIOCINFO2		_IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev1)
 #define MPTTARGETINFO		_IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
 #define MPTTEST			_IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
 #define MPTEVENTQUERY		_IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
@@ -165,6 +166,18 @@
 	} u;
 };
 
+struct mpt_ioctl_pci_info2 {
+	union {
+		struct {
+			unsigned int  deviceNumber   :  5;
+			unsigned int  functionNumber :  3;
+			unsigned int  busNumber      : 24;
+		} bits;
+		unsigned int  asUlong;
+	} u;
+  int segmentID;
+};
+
 /*
  *  Adapter Information Page
  *  Read only.
@@ -175,6 +188,24 @@
 #define MPT_IOCTL_VERSION_LENGTH	(32)
 
 struct mpt_ioctl_iocinfo {
+	mpt_ioctl_header hdr;
+	int		 adapterType;	/* SCSI or FCP */
+	int		 port;		/* port number */
+	int		 pciId;		/* PCI Id. */
+	int		 hwRev;		/* hardware revision */
+	int		 subSystemDevice;	/* PCI subsystem Device ID */
+	int		 subSystemVendor;	/* PCI subsystem Vendor ID */
+	int		 numDevices;		/* number of devices */
+	int		 FWVersion;		/* FW Version (integer) */
+	int		 BIOSVersion;		/* BIOS Version (integer) */
+	char		 driverVersion[MPT_IOCTL_VERSION_LENGTH];	/* Driver Version (string) */
+	char		 busChangeEvent;
+	char		 hostId;
+	char		 rsvd[2];
+	struct mpt_ioctl_pci_info2  pciInfo; /* Added Rev 2 */
+};
+
+struct mpt_ioctl_iocinfo_rev1 {
 	mpt_ioctl_header hdr;
 	int		 adapterType;	/* SCSI or FCP */
 	int		 port;		/* port number */
diff -Nru a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
--- a/drivers/message/fusion/mptscsih.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/message/fusion/mptscsih.c	Tue Jun 15 22:21:05 2004
@@ -805,6 +805,14 @@
 
 		if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID)
 			copy_sense_data(sc, hd, mf, pScsiReply);
+                
+		/*
+		 *  Look for + dump FCP ResponseInfo[]!
+		 */
+		if (scsi_state & MPI_SCSI_STATE_RESPONSE_INFO_VALID) {
+			printk(KERN_NOTICE "  FCP_ResponseInfo=%08xh\n",
+			le32_to_cpu(pScsiReply->ResponseInfo));
+		}
 
 		switch(status) {
 		case MPI_IOCSTATUS_BUSY:			/* 0x0002 */
@@ -932,10 +940,6 @@
 			break;
 
 		case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR:		/* 0x0047 */
-			if (pScsiReply->SCSIState & MPI_SCSI_STATE_TERMINATED) {
-				/*  Not real sure here either...  */
-				sc->result = DID_RESET << 16;
-			} else
 				sc->result = DID_SOFT_ERROR << 16;
 			break;
 
@@ -1106,16 +1110,21 @@
 			 * Do OS callback
 			 * Free driver resources (chain, msg buffers)
 			 */
-			if (SCpnt->use_sg) {
-				pci_unmap_sg(hd->ioc->pcidev, (struct scatterlist *) SCpnt->request_buffer,
-					    SCpnt->use_sg, scsi_to_pci_dma_dir(SCpnt->sc_data_direction));
-			} else if (SCpnt->request_bufflen) {
-				scPrivate	*my_priv;
-
-				my_priv = (scPrivate *) &SCpnt->SCp;
-				pci_unmap_single(hd->ioc->pcidev, (dma_addr_t)(ulong)my_priv->p1,
-					   SCpnt->request_bufflen,
-					   scsi_to_pci_dma_dir(SCpnt->sc_data_direction));
+			if (scsi_device_online(SCpnt->device)) {
+				if (SCpnt->use_sg) {
+					pci_unmap_sg(hd->ioc->pcidev,
+						(struct scatterlist *) SCpnt->request_buffer,
+						SCpnt->use_sg,
+						scsi_to_pci_dma_dir(SCpnt->sc_data_direction));
+				} else if (SCpnt->request_bufflen) {
+					scPrivate	*my_priv;
+
+					my_priv = (scPrivate *) &SCpnt->SCp;
+					pci_unmap_single(hd->ioc->pcidev,
+						(dma_addr_t)(ulong)my_priv->p1,
+						SCpnt->request_bufflen,
+						scsi_to_pci_dma_dir(SCpnt->sc_data_direction));
+				}
 			}
 			SCpnt->result = DID_RESET << 16;
 			SCpnt->host_scribble = NULL;
diff -Nru a/drivers/message/i2o/Kconfig b/drivers/message/i2o/Kconfig
--- a/drivers/message/i2o/Kconfig	Tue Jun 15 22:20:36 2004
+++ b/drivers/message/i2o/Kconfig	Tue Jun 15 22:20:36 2004
@@ -3,7 +3,7 @@
 
 config I2O
 	tristate "I2O support"
-	depends on PCI && !64BIT
+	depends on PCI
 	---help---
 	  The Intelligent Input/Output (I2O) architecture allows hardware
 	  drivers to be split into two parts: an operating system specific
@@ -20,19 +20,20 @@
 	  drivers and OSM's with the following questions.
 
 	  To compile this support as a module, choose M here: the
-	  modules will be called i2o_core and i2o_config.
+	  modules will be called i2o_core.
 
 	  If unsure, say N.
 
-config I2O_PCI
-	tristate "I2O PCI support"
+config I2O_CONFIG
+	tristate "I2O Configuration support"
 	depends on PCI && I2O
 	help
-	  Say Y for support of PCI bus I2O interface adapters. Currently this
-	  is the only variety supported, so you should say Y.
+	  Say Y for support of the configuration interface for the I2O adapters.
+	  If you have a RAID controller from Adaptec and you want to use the
+	  raidutils to manage your RAID array, you have to say Y here.
 
 	  To compile this support as a module, choose M here: the
-	  module will be called i2o_pci.
+	  module will be called i2o_config.
 
 config I2O_BLOCK
 	tristate "I2O Block OSM"
diff -Nru a/drivers/message/i2o/Makefile b/drivers/message/i2o/Makefile
--- a/drivers/message/i2o/Makefile	Tue Jun 15 22:20:42 2004
+++ b/drivers/message/i2o/Makefile	Tue Jun 15 22:20:42 2004
@@ -5,7 +5,8 @@
 # In the future, some of these should be built conditionally.
 #
 
-obj-$(CONFIG_I2O)	+= i2o_core.o i2o_config.o
+obj-$(CONFIG_I2O)	+= i2o_core.o
+obj-$(CONFIG_I2O_CONFIG)+= i2o_config.o
 obj-$(CONFIG_I2O_BLOCK)	+= i2o_block.o
 obj-$(CONFIG_I2O_SCSI)	+= i2o_scsi.o
 obj-$(CONFIG_I2O_PROC)	+= i2o_proc.o
diff -Nru a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
--- a/drivers/message/i2o/i2o_block.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/message/i2o/i2o_block.c	Tue Jun 15 22:20:43 2004
@@ -83,7 +83,6 @@
 #include <asm/semaphore.h>
 #include <linux/completion.h>
 #include <asm/io.h>
-#include <asm/atomic.h>
 #include <linux/smp_lock.h>
 #include <linux/wait.h>
 
@@ -111,16 +110,12 @@
 				 I2O_EVT_IND_BSA_SCSI_SMART )
 
 
-#define I2O_LOCK(unit)	(i2ob_dev[(unit)].req_queue->queue_lock)
-
 /*
  *	Some of these can be made smaller later
  */
 
-static int i2ob_media_change_flag[MAX_I2OB];
-static u32 i2ob_max_sectors[MAX_I2OB<<4];
-
 static int i2ob_context;
+static struct block_device_operations i2ob_fops;
 
 /*
  * I2O Block device descriptor 
@@ -143,6 +138,9 @@
 	int wcache;
 	int power;
 	int index;
+	int media_change_flag;
+	u32 max_sectors;
+	struct gendisk *gd;
 };
 
 /*
@@ -162,16 +160,16 @@
 };
 
 /*
- * Per IOP requst queue information
+ * Per IOP request queue information
  *
- * We have a separate requeust_queue_t per IOP so that a heavilly
+ * We have a separate request_queue_t per IOP so that a heavilly
  * loaded I2O block device on an IOP does not starve block devices
  * across all I2O controllers.
  * 
  */
 struct i2ob_iop_queue
 {
-	atomic_t queue_depth;
+	unsigned int queue_depth;
 	struct i2ob_request request_queue[MAX_I2OB_DEPTH];
 	struct i2ob_request *i2ob_qhead;
 	request_queue_t *req_queue;
@@ -183,9 +181,8 @@
  *	Each I2O disk is one of these.
  */
 
-static struct i2ob_device i2ob_dev[MAX_I2OB<<4];
+static struct i2ob_device i2ob_dev[MAX_I2OB];
 static int i2ob_dev_count = 0;
-static struct gendisk *i2ob_disk[MAX_I2OB];
 
 /*
  * Mutex and spin lock for event handling synchronization
@@ -312,7 +309,6 @@
 	/* 
 	 * Mask out partitions from now on
 	 */
-	unit &= 0xF0;
 		
 	/* This can be optimised later - just want to be sure its right for
 	   starters */
@@ -402,7 +398,7 @@
 	}
 
 	i2o_post_message(c,m);
-	atomic_inc(&i2ob_queues[c->unit]->queue_depth);
+	i2ob_queues[c->unit]->queue_depth ++;
 
 	return 0;
 }
@@ -453,8 +449,8 @@
 	struct i2ob_request *ireq = NULL;
 	u8 st;
 	u32 *m = (u32 *)msg;
-	u8 unit = (m[2]>>8)&0xF0;	/* low 4 bits are partition */
-	struct i2ob_device *dev = &i2ob_dev[(unit&0xF0)];
+	u8 unit = m[2]>>8;
+	struct i2ob_device *dev = &i2ob_dev[unit];
 
 	/*
 	 * FAILed message
@@ -475,10 +471,10 @@
 		ireq=&i2ob_queues[c->unit]->request_queue[m[3]];
 		ireq->req->errors++;
 
-		spin_lock_irqsave(I2O_LOCK(c->unit), flags);
+		spin_lock_irqsave(dev->req_queue->queue_lock, flags);
 		i2ob_unhook_request(ireq, c->unit);
 		i2ob_end_request(ireq->req);
-		spin_unlock_irqrestore(I2O_LOCK(c->unit), flags);
+		spin_unlock_irqrestore(dev->req_queue->queue_lock, flags);
 	
 		/* Now flush the message by making it a NOP */
 		m[0]&=0x00FFFFFF;
@@ -509,10 +505,10 @@
 		ireq=&i2ob_queues[c->unit]->request_queue[m[3]];
 		ireq->req->errors++;
 		printk(KERN_WARNING "I2O Block: Data transfer to deleted device!\n");
-		spin_lock_irqsave(I2O_LOCK(c->unit), flags);
+		spin_lock_irqsave(dev->req_queue->queue_lock, flags);
 		i2ob_unhook_request(ireq, c->unit);
 		i2ob_end_request(ireq->req);
-		spin_unlock_irqrestore(I2O_LOCK(c->unit), flags);
+		spin_unlock_irqrestore(dev->req_queue->queue_lock, flags);
 		return;
 	}	
 
@@ -576,17 +572,17 @@
 	 */
 	
 	i2ob_free_sglist(dev, ireq);
-	spin_lock_irqsave(I2O_LOCK(c->unit), flags);
+	spin_lock_irqsave(dev->req_queue->queue_lock, flags);
 	i2ob_unhook_request(ireq, c->unit);
 	i2ob_end_request(ireq->req);
-	atomic_dec(&i2ob_queues[c->unit]->queue_depth);
+	i2ob_queues[c->unit]->queue_depth --;
 	
 	/*
 	 *	We may be able to do more I/O
 	 */
 	 
-	i2ob_request(dev->req_queue);
-	spin_unlock_irqrestore(I2O_LOCK(c->unit), flags);
+	i2ob_request(dev->gd->queue);
+	spin_unlock_irqrestore(dev->req_queue->queue_lock, flags);
 }
 
 /* 
@@ -598,8 +594,8 @@
 {
 	unsigned int evt;
 	unsigned long flags;
+	struct i2ob_device *dev;
 	int unit;
-	int i;
 	//The only event that has data is the SCSI_SMART event.
 	struct i2o_reply {
 		u32 header[4];
@@ -638,6 +634,7 @@
 		unit = le32_to_cpu(evt_local->header[3]);
 		evt = le32_to_cpu(evt_local->evt_indicator);
 
+		dev = &i2ob_dev[unit];
 		switch(evt)
 		{
 			/*
@@ -648,10 +645,9 @@
 			 */
 			case I2O_EVT_IND_BSA_VOLUME_LOAD:
 			{
-				struct gendisk *p = i2ob_disk[unit>>4];
-				i2ob_install_device(i2ob_dev[unit].i2odev->controller, 
-					i2ob_dev[unit].i2odev, unit);
-				add_disk(p);
+				i2ob_install_device(dev->i2odev->controller,
+					dev->i2odev, unit);
+				add_disk(dev->gd);
 				break;
 			}
 
@@ -663,17 +659,18 @@
 			 */
 			case I2O_EVT_IND_BSA_VOLUME_UNLOAD:
 			{
-				struct gendisk *p = i2ob_disk[unit>>4];
+				struct gendisk *p = dev->gd;
+				blk_queue_max_sectors(dev->gd->queue, 0);
 				del_gendisk(p);
-				for(i = unit; i <= unit+15; i++)
-					blk_queue_max_sectors(i2ob_dev[i].req_queue, 0);
-				i2ob_media_change_flag[unit] = 1;
+				put_disk(p);
+				dev->gd = NULL;
+				dev->media_change_flag = 1;
 				break;
 			}
 
 			case I2O_EVT_IND_BSA_VOLUME_UNLOAD_REQ:
 				printk(KERN_WARNING "%s: Attempt to eject locked media\n", 
-					i2ob_dev[unit].i2odev->dev_name);
+					dev->i2odev->dev_name);
 				break;
 
 			/*
@@ -691,12 +688,12 @@
 			{
 				u64 size;
 
-	  			if(i2ob_query_device(&i2ob_dev[unit], 0x0004, 0, &size, 8) !=0 )
-					i2ob_query_device(&i2ob_dev[unit], 0x0000, 4, &size, 8);
+	  			if(i2ob_query_device(dev, 0x0004, 0, &size, 8) !=0 )
+					i2ob_query_device(dev, 0x0000, 4, &size, 8);
 
-				spin_lock_irqsave(I2O_LOCK(unit), flags);	
-				set_capacity(i2ob_disk[unit>>4], size>>9);
-				spin_unlock_irqrestore(I2O_LOCK(unit), flags);	
+				spin_lock_irqsave(dev->req_queue->queue_lock, flags);
+				set_capacity(dev->gd, size>>9);
+				spin_unlock_irqrestore(dev->req_queue->queue_lock, flags);
 				break;
 			}
 
@@ -708,7 +705,7 @@
 			case I2O_EVT_IND_BSA_SCSI_SMART:
 			{
 				char buf[16];
-				printk(KERN_INFO "I2O Block: %s received a SCSI SMART Event\n",i2ob_dev[unit].i2odev->dev_name);
+				printk(KERN_INFO "I2O Block: %s received a SCSI SMART Event\n",dev->i2odev->dev_name);
 				evt_local->data[16]='\0';
 				sprintf(buf,"%s",&evt_local->data[0]);
 				printk(KERN_INFO "      Disk Serial#:%s\n",buf);
@@ -735,12 +732,12 @@
 				 * hit the fan big time. The card seems to recover but loses
 				 * the pending writes. Deeply ungood except for testing fsck
 				 */
-				if(i2ob_dev[unit].i2odev->controller->promise)
+				if(dev->i2odev->controller->promise)
 					panic("I2O controller firmware failed. Reboot and force a filesystem check.\n");
 			default:
 				printk(KERN_INFO "%s: Received event 0x%X we didn't register for\n"
 					KERN_INFO "   Blame the I2O card manufacturer 8)\n", 
-					i2ob_dev[unit].i2odev->dev_name, evt);
+					dev->i2odev->dev_name, evt);
 				break;
 		}
 	};
@@ -765,14 +762,6 @@
 	u32 m;
 	
 	while ((req = elv_next_request(q)) != NULL) {
-		/*
-		 *	On an IRQ completion if there is an inactive
-		 *	request on the queue head it means it isnt yet
-		 *	ready to dispatch.
-		 */
-		if(req->rq_status == RQ_INACTIVE)
-			return;
-
 		dev = req->rq_disk->private_data;
 
 		/* 
@@ -780,7 +769,7 @@
 		 *	generic IOP commit control. Certainly it's not right 
 		 *	its global!  
 		 */
-		if(atomic_read(&i2ob_queues[dev->unit]->queue_depth) >= dev->depth)
+		if(i2ob_queues[dev->unit]->queue_depth >= dev->depth)
 			break;
 		
 		/* Get a message */
@@ -788,7 +777,7 @@
 
 		if(m==0xFFFFFFFF)
 		{
-			if(atomic_read(&i2ob_queues[dev->unit]->queue_depth) == 0)
+			if(i2ob_queues[dev->unit]->queue_depth == 0)
 				printk(KERN_ERR "i2o_block: message queue and request queue empty!!\n");
 			break;
 		}
@@ -797,13 +786,12 @@
 		 */
 		req->errors = 0;
 		blkdev_dequeue_request(req);	
-		req->waiting = NULL;
 		
 		ireq = i2ob_queues[dev->unit]->i2ob_qhead;
 		i2ob_queues[dev->unit]->i2ob_qhead = ireq->next;
 		ireq->req = req;
 
-		i2ob_send(m, dev, ireq, (dev->unit&0xF0));
+		i2ob_send(m, dev, ireq, dev->index);
 	}
 }
 
@@ -1065,7 +1053,10 @@
 	u16 power;
 	u32 flags, status;
 	struct i2ob_device *dev=&i2ob_dev[unit];
-	int i;
+	struct gendisk *disk;
+	request_queue_t *q;
+	int segments;
+
 
 	/*
 	 * For logging purposes...
@@ -1079,21 +1070,35 @@
 	 * before any I/O can be performed. If it fails, this
 	 * device is useless.
 	 */
-	if(!i2ob_queues[unit]) {
-		if(i2ob_init_iop(unit))
+	if(!i2ob_queues[c->unit]) {
+		if(i2ob_init_iop(c->unit))
 			return 1;
 	}
 
+	q = i2ob_queues[c->unit]->req_queue;
+
 	/*
 	 * This will save one level of lookup/indirection in critical
 	 * code so that we can directly get the queue ptr from the
 	 * device instead of having to go the IOP data structure.
 	 */
-	dev->req_queue = i2ob_queues[unit]->req_queue;
+	dev->req_queue = q;
 
+	/*
+	 * Allocate a gendisk structure and initialize it
+	 */
+	disk = alloc_disk(16);
+	if (!disk)
+		return 1;
+
+	dev->gd = disk;
 	/* initialize gendik structure */
-	i2ob_disk[unit>>4]->private_data = dev;
-	i2ob_disk[unit>>4]->queue = dev->req_queue;
+	disk->major = MAJOR_NR;
+	disk->first_minor = unit<<4;
+	disk->queue = q;
+	disk->fops = &i2ob_fops;
+	sprintf(disk->disk_name, "i2o/hd%c", 'a' + unit);
+	disk->private_data = dev;
 
 	/*
 	 *	Ask for the current media data. If that isn't supported
@@ -1110,53 +1115,49 @@
 		power = 0;
 	i2ob_query_device(dev, 0x0000, 5, &flags, 4);
 	i2ob_query_device(dev, 0x0000, 6, &status, 4);
-	set_capacity(i2ob_disk[unit>>4], size>>9);
+	set_capacity(disk, size>>9);
 
 	/*
 	 * Max number of Scatter-Gather Elements
 	 */	
 
-	i2ob_dev[unit].power = power;	/* Save power state in device proper */
-	i2ob_dev[unit].flags = flags;
+	dev->power = power;	/* Save power state in device proper */
+	dev->flags = flags;
 
-	for(i=unit;i<=unit+15;i++)
-	{
-		request_queue_t *q = i2ob_dev[unit].req_queue;
-		int segments = (d->controller->status_block->inbound_frame_size - 7) / 2;
+	segments = (d->controller->status_block->inbound_frame_size - 7) / 2;
+
+	if(segments > 16)
+		segments = 16;
 
-		if(segments > 16)
-			segments = 16;
-					
-		i2ob_dev[i].power = power;	/* Save power state */
-		i2ob_dev[unit].flags = flags;	/* Keep the type info */
+	dev->power = power;	/* Save power state */
+	dev->flags = flags;	/* Keep the type info */
 		
-		blk_queue_max_sectors(q, 96);	/* 256 might be nicer but many controllers 
+	blk_queue_max_sectors(q, 96);	/* 256 might be nicer but many controllers
 						   explode on 65536 or higher */
-		blk_queue_max_phys_segments(q, segments);
-		blk_queue_max_hw_segments(q, segments);
+	blk_queue_max_phys_segments(q, segments);
+	blk_queue_max_hw_segments(q, segments);
 		
-		i2ob_dev[i].rcache = CACHE_SMARTFETCH;
-		i2ob_dev[i].wcache = CACHE_WRITETHROUGH;
+	dev->rcache = CACHE_SMARTFETCH;
+	dev->wcache = CACHE_WRITETHROUGH;
 		
-		if(d->controller->battery == 0)
-			i2ob_dev[i].wcache = CACHE_WRITETHROUGH;
+	if(d->controller->battery == 0)
+		dev->wcache = CACHE_WRITETHROUGH;
 
-		if(d->controller->promise)
-			i2ob_dev[i].wcache = CACHE_WRITETHROUGH;
+	if(d->controller->promise)
+		dev->wcache = CACHE_WRITETHROUGH;
 
-		if(d->controller->short_req)
-		{
-			blk_queue_max_sectors(q, 8);
-			blk_queue_max_phys_segments(q, 8);
-			blk_queue_max_hw_segments(q, 8);
-		}
+	if(d->controller->short_req)
+	{
+		blk_queue_max_sectors(q, 8);
+		blk_queue_max_phys_segments(q, 8);
+		blk_queue_max_hw_segments(q, 8);
 	}
 
-	strcpy(d->dev_name, i2ob_disk[unit>>4]->disk_name);
-	strcpy(i2ob_disk[unit>>4]->devfs_name, i2ob_disk[unit>>4]->disk_name);
+	strcpy(d->dev_name, disk->disk_name);
+	strcpy(disk->devfs_name, disk->disk_name);
 
 	printk(KERN_INFO "%s: Max segments %d, queue depth %d, byte limit %d.\n",
-		 d->dev_name, i2ob_dev[unit].max_segments, i2ob_dev[unit].depth, i2ob_max_sectors[unit]<<9);
+		 d->dev_name, dev->max_segments, dev->depth, dev->max_sectors<<9);
 
 	i2ob_query_device(dev, 0x0000, 0, &type, 1);
 
@@ -1197,7 +1198,7 @@
 	}
 	printk(".\n");
 	printk(KERN_INFO "%s: Maximum sectors/read set to %d.\n", 
-		d->dev_name, i2ob_max_sectors[unit]);
+		d->dev_name, dev->max_sectors);
 
 	/*
 	 * Register for the events we're interested in and that the
@@ -1233,7 +1234,7 @@
 	/* Queue is MAX_I2OB + 1... */
 	i2ob_queues[unit]->request_queue[i].next = NULL;
 	i2ob_queues[unit]->i2ob_qhead = &i2ob_queues[unit]->request_queue[0];
-	atomic_set(&i2ob_queues[unit]->queue_depth, 0);
+	i2ob_queues[unit]->queue_depth = 0;
 
 	i2ob_queues[unit]->lock = SPIN_LOCK_UNLOCKED;
 	i2ob_queues[unit]->req_queue = blk_init_queue(i2ob_request, &i2ob_queues[unit]->lock);
@@ -1257,7 +1258,6 @@
 
 	struct i2o_device *d, *b=NULL;
 	struct i2o_controller *c;
-	struct i2ob_device *dev;
 		
 	for(i=0; i< MAX_I2O_CONTROLLERS; i++)
 	{
@@ -1313,44 +1313,12 @@
 					continue; /*Already claimed on pass 1 */
 			}
 
-			if(i2o_claim_device(d, &i2o_block_handler))
-			{
-				printk(KERN_WARNING "i2o_block: Controller %d, TID %d\n", c->unit,
-					d->lct_data.tid);
-				printk(KERN_WARNING "\t%sevice refused claim! Skipping installation\n", bios?"Boot d":"D");
-				continue;
-			}
-
-			i2o_release_device(d, &i2o_block_handler);
-
-			if(scan_unit<MAX_I2OB<<4)
-			{
- 				/*
-				 * Get the device and fill in the
-				 * Tid and controller.
-				 */
-				dev=&i2ob_dev[scan_unit];
-				dev->i2odev = d; 
-				dev->controller = c;
-				dev->unit = c->unit;
-				dev->tid = d->lct_data.tid;
-
-				if(i2ob_install_device(c,d,scan_unit))
-					printk(KERN_WARNING "Could not install I2O block device\n");
-				else
-				{
-					add_disk(i2ob_disk[scan_unit>>4]);
-					scan_unit+=16;
-					i2ob_dev_count++;
-
-					/* We want to know when device goes away */
-					i2o_device_notify_on(d, &i2o_block_handler);
-				}
-			}
+			if(scan_unit<MAX_I2OB)
+				i2ob_new_device(c, d);
 			else
 			{
 				if(!warned++)
-					printk(KERN_WARNING "i2o_block: too many device, registering only %d.\n", scan_unit>>4);
+					printk(KERN_WARNING "i2o_block: too many device, registering only %d.\n", scan_unit);
 			}
 		}
 		i2o_unlock_controller(c);
@@ -1399,12 +1367,12 @@
 	printk(KERN_INFO "   Controller %d Tid %d\n",c->unit, d->lct_data.tid);
 
 	/* Check for available space */
-	if(i2ob_dev_count>=MAX_I2OB<<4)
+	if(i2ob_dev_count>=MAX_I2OB)
 	{
 		printk(KERN_ERR "i2o_block: No more devices allowed!\n");
 		return;
 	}
-	for(unit = 0; unit < (MAX_I2OB<<4); unit += 16)
+	for(unit = 0; unit < MAX_I2OB; unit ++)
 	{
 		if(!i2ob_dev[unit].i2odev)
 			break;
@@ -1420,18 +1388,20 @@
 	dev->i2odev = d; 
 	dev->controller = c;
 	dev->tid = d->lct_data.tid;
+	dev->unit = c->unit;
 
-	if(i2ob_install_device(c,d,unit))
+	if(i2ob_install_device(c,d,unit)) {
+		i2o_release_device(d, &i2o_block_handler);
 		printk(KERN_ERR "i2o_block: Could not install new device\n");
+	}
 	else	
 	{
-		add_disk(i2ob_disk[unit>>4]);
+		i2o_release_device(d, &i2o_block_handler);
+		add_disk(dev->gd);
 		i2ob_dev_count++;
 		i2o_device_notify_on(d, &i2o_block_handler);
 	}
 
-	i2o_release_device(d, &i2o_block_handler);
- 
 	return;
 }
 
@@ -1443,64 +1413,58 @@
 void i2ob_del_device(struct i2o_controller *c, struct i2o_device *d)
 {	
 	int unit = 0;
-	int i = 0;
 	unsigned long flags;
+	struct i2ob_device *dev;
 
-	spin_lock_irqsave(I2O_LOCK(c->unit), flags);
-
-	/*
-	 * Need to do this...we somtimes get two events from the IRTOS
-	 * in a row and that causes lots of problems.
-	 */
-	i2o_device_notify_off(d, &i2o_block_handler);
-
-	printk(KERN_INFO "I2O Block Device Deleted\n");
-
-	for(unit = 0; unit < MAX_I2OB<<4; unit += 16)
+	for(unit = 0; unit < MAX_I2OB; unit ++)
 	{
-		if(i2ob_dev[unit].i2odev == d)
+		dev = &i2ob_dev[unit];
+		if(dev->i2odev == d)
 		{
 			printk(KERN_INFO "  /dev/%s: Controller %d Tid %d\n", 
 				d->dev_name, c->unit, d->lct_data.tid);
 			break;
 		}
 	}
-	if(unit >= MAX_I2OB<<4)
+
+	printk(KERN_INFO "I2O Block Device Deleted\n");
+
+	if(unit >= MAX_I2OB)
 	{
 		printk(KERN_ERR "i2ob_del_device called, but not in dev table!\n");
-		spin_unlock_irqrestore(I2O_LOCK(c->unit), flags);
 		return;
 	}
 
+	spin_lock_irqsave(dev->req_queue->queue_lock, flags);
+
+	/*
+	 * Need to do this...we somtimes get two events from the IRTOS
+	 * in a row and that causes lots of problems.
+	 */
+	i2o_device_notify_off(d, &i2o_block_handler);
+
 	/* 
 	 * This will force errors when i2ob_get_queue() is called
 	 * by the kenrel.
 	 */
-	del_gendisk(i2ob_disk[unit>>4]);
-	i2ob_dev[unit].req_queue = NULL;
-	for(i = unit; i <= unit+15; i++)
-	{
-		i2ob_dev[i].i2odev = NULL;
-		blk_queue_max_sectors(i2ob_dev[i].req_queue, 0);
-	}
-	spin_unlock_irqrestore(I2O_LOCK(c->unit), flags);
-
-	/*
-	 * Decrease usage count for module
-	 */	
-
-	while(i2ob_dev[unit].refcnt--)
-		MOD_DEC_USE_COUNT;
-
-	i2ob_dev[unit].refcnt = 0;
-	
-	i2ob_dev[i].tid = 0;
+	if(dev->gd) {
+		struct gendisk *gd = dev->gd;
+		gd->queue = NULL;
+		del_gendisk(gd);
+		put_disk(gd);
+		dev->gd = NULL;
+	}
+	spin_unlock_irqrestore(dev->req_queue->queue_lock, flags);
+	dev->req_queue = NULL;
+	dev->i2odev = NULL;
+	dev->refcnt = 0;
+	dev->tid = 0;
 
 	/* 
 	 * Do we need this?
 	 * The media didn't really change...the device is just gone
 	 */
-	i2ob_media_change_flag[unit] = 1;
+	dev->media_change_flag = 1;
 
 	i2ob_dev_count--;	
 }
@@ -1511,10 +1475,9 @@
 static int i2ob_media_change(struct gendisk *disk)
 {
 	struct i2ob_device *p = disk->private_data;
-	int i = p->index;
-	if(i2ob_media_change_flag[i])
+	if(p->media_change_flag)
 	{
-		i2ob_media_change_flag[i]=0;
+		p->media_change_flag=0;
 		return 1;
 	}
 	return 0;
@@ -1523,7 +1486,7 @@
 static int i2ob_revalidate(struct gendisk *disk)
 {
 	struct i2ob_device *p = disk->private_data;
-	return i2ob_install_device(p->controller, p->i2odev, p->index<<4);
+	return i2ob_install_device(p->controller, p->i2odev, p->index);
 }
 
 /*
@@ -1536,7 +1499,7 @@
 	
 	for(i=0;i<MAX_I2OB;i++)
 	{
-		struct i2ob_device *dev=&i2ob_dev[(i<<4)];
+		struct i2ob_device *dev=&i2ob_dev[i];
 		
 		if(dev->refcnt!=0)
 		{
@@ -1598,51 +1561,36 @@
 	if (register_blkdev(MAJOR_NR, "i2o_block"))
 		return -EIO;
 
-	for (i = 0; i < MAX_I2OB; i++) {
-		struct gendisk *disk = alloc_disk(16);
-		if (!disk)
-			goto oom;
-		i2ob_dev[i<<4].index = i;
-		disk->queue = i2ob_dev[i<<4].req_queue;
-		i2ob_disk[i] = disk;
-	}
 #ifdef MODULE
 	printk(KERN_INFO "i2o_block: registered device at major %d\n", MAJOR_NR);
 #endif
 
 	/*
+	 *	Set up the queue
+	 */
+	for(i = 0; i < MAX_I2O_CONTROLLERS; i++)
+		i2ob_queues[i] = NULL;
+
+	/*
 	 *	Now fill in the boiler plate
 	 */
 	 
-	for (i = 0; i < MAX_I2OB << 4; i++) {
-		i2ob_dev[i].refcnt = 0;
-		i2ob_dev[i].flags = 0;
-		i2ob_dev[i].controller = NULL;
-		i2ob_dev[i].i2odev = NULL;
-		i2ob_dev[i].tid = 0;
-		i2ob_dev[i].head = NULL;
-		i2ob_dev[i].tail = NULL;
-		i2ob_dev[i].depth = MAX_I2OB_DEPTH;
-		i2ob_max_sectors[i] = 2;
-	}
-	
 	for (i = 0; i < MAX_I2OB; i++) {
-		struct gendisk *disk = i2ob_disk[i];
-		disk->major = MAJOR_NR;
-		disk->first_minor = i<<4;
-		disk->fops = &i2ob_fops;
-		sprintf(disk->disk_name, "i2o/hd%c", 'a' + i);
+		struct i2ob_device *dev = &i2ob_dev[i];
+		dev->index = i;
+		dev->refcnt = 0;
+		dev->flags = 0;
+		dev->controller = NULL;
+		dev->i2odev = NULL;
+		dev->tid = 0;
+		dev->head = NULL;
+		dev->tail = NULL;
+		dev->depth = MAX_I2OB_DEPTH;
+		dev->max_sectors = 2;
+		dev->gd = NULL;
 	}
 	
 	/*
-	 *	Set up the queue
-	 */
-	for(i = 0; i < MAX_I2O_CONTROLLERS; i++)
-	{
-		i2ob_queues[i] = NULL;
-	}
-
-	/*
 	 *	Register the OSM handler as we will need this to probe for
 	 *	drives, geometry and other goodies.
 	 */
@@ -1671,9 +1619,6 @@
 
 	return 0;
 
-oom:
-	while (i--)
-		put_disk(i2ob_disk[i]);
 	unregister_blkdev(MAJOR_NR, "i2o_block");
 	return -ENOMEM;
 }
@@ -1701,11 +1646,8 @@
 	if(i2ob_dev_count) {
 		struct i2o_device *d;
 		for(i = 0; i < MAX_I2OB; i++)
-		if((d=i2ob_dev[i<<4].i2odev)) {
-			i2o_device_notify_off(d, &i2o_block_handler);
-			i2o_event_register(d->controller, d->lct_data.tid, 
-				i2ob_context, i<<4, 0);
-		}
+			if((d = i2ob_dev[i].i2odev))
+				i2ob_del_device(d->controller, d);
 	}
 	
 	/*
@@ -1725,15 +1667,21 @@
 	 */
 
 	i2o_remove_handler(&i2o_block_handler);
-		 
-	for (i = 0; i < MAX_I2OB; i++)
-		put_disk(i2ob_disk[i]);
 
 	/*
 	 *	Return the block device
 	 */
 	if (unregister_blkdev(MAJOR_NR, "i2o_block") != 0)
 		printk("i2o_block: cleanup_module failed\n");
+
+	/*
+	 *	release request queue
+	 */
+	for (i = 0; i < MAX_I2O_CONTROLLERS; i ++)
+		if(i2ob_queues[i]) {
+			blk_cleanup_queue(i2ob_queues[i]->req_queue);
+			kfree(i2ob_queues[i]);
+		}
 }
 
 MODULE_AUTHOR("Red Hat");
diff -Nru a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
--- a/drivers/message/i2o/i2o_config.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/message/i2o/i2o_config.c	Tue Jun 15 22:21:02 2004
@@ -5,21 +5,24 @@
  *	
  * Written by Alan Cox, Building Number Three Ltd
  *
- * Modified 04/20/1999 by Deepak Saxena
- *   - Added basic ioctl() support
- * Modified 06/07/1999 by Deepak Saxena
- *   - Added software download ioctl (still testing)
- * Modified 09/10/1999 by Auvo Häkkinen
- *   - Changes to i2o_cfg_reply(), ioctl_parms()
- *   - Added ioct_validate()
- * Modified 09/30/1999 by Taneli Vähäkangas
- *   - Fixed ioctl_swdl()
- * Modified 10/04/1999 by Taneli Vähäkangas
- *   - Changed ioctl_swdl(), implemented ioctl_swul() and ioctl_swdel()
- * Modified 11/18/1999 by Deepak Saxena
- *   - Added event managmenet support
- *
- * 2.4 rewrite ported to 2.5 - Alan Cox <alan@redhat.com>
+ * Fixes/additions:
+ *	Deepak Saxena (04/20/1999):
+ *		Added basic ioctl() support
+ *	Deepak Saxena (06/07/1999):
+ *		Added software download ioctl (still testing)
+ *	Auvo Häkkinen (09/10/1999):
+ *		Changes to i2o_cfg_reply(), ioctl_parms()
+ *		Added ioct_validate()
+ *	Taneli Vähäkangas (09/30/1999):
+ *		Fixed ioctl_swdl()
+ *	Taneli Vähäkangas (10/04/1999):
+ *		Changed ioctl_swdl(), implemented ioctl_swul() and ioctl_swdel()
+ *	Deepak Saxena (11/18/1999):
+ *		Added event managmenet support
+ *	Alan Cox <alan@redhat.com>:
+ *		2.4 rewrite ported to 2.5
+ *	Markus Lidel <Markus.Lidel@shadowconnect.com>:
+ *		Added pass-thru support for Adaptec's raidutils
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -49,6 +52,11 @@
 
 #define MODINC(x,y) ((x) = ((x) + 1) % (y))
 
+struct sg_simple_element {
+	u32  flag_count;
+	u32 addr_bus;
+};
+
 struct i2o_cfg_info
 {
 	struct file* fp;
@@ -75,6 +83,7 @@
 static int ioctl_validate(unsigned long); 
 static int ioctl_evt_reg(unsigned long, struct file *);
 static int ioctl_evt_get(unsigned long, struct file *);
+static int ioctl_passthru(unsigned long);
 static int cfg_fasync(int, struct file*, int);
 
 /*
@@ -256,6 +265,10 @@
 			ret = ioctl_evt_get(arg, fp);
 			break;
 
+		case I2OPASSTHRU:
+			ret = ioctl_passthru(arg);
+			break;
+
 		default:
 			ret = -EINVAL;
 	}
@@ -825,6 +838,165 @@
 	if(copy_to_user(uget, &kget, sizeof(struct i2o_evt_get)))
 		return -EFAULT;
 	return 0;
+}
+
+static int ioctl_passthru(unsigned long arg)
+{
+	struct i2o_cmd_passthru *cmd = (struct i2o_cmd_passthru *) arg;
+	struct i2o_controller *c;
+	u32 msg[MSG_FRAME_SIZE];
+	u32 *user_msg = (u32*)cmd->msg;
+	u32 *reply = NULL;
+	u32 *user_reply = NULL;
+	u32 size = 0;
+	u32 reply_size = 0;
+	u32 rcode = 0;
+	ulong sg_list[SG_TABLESIZE];
+	u32 sg_offset = 0;
+	u32 sg_count = 0;
+	int sg_index = 0;
+	u32 i = 0;
+	ulong p = 0;
+
+	c = i2o_find_controller(cmd->iop);
+	if(!c)
+                return -ENXIO;
+
+	memset(&msg, 0, MSG_FRAME_SIZE*4);
+	if(get_user(size, &user_msg[0]))
+		return -EFAULT;
+	size = size>>16;
+
+	user_reply = &user_msg[size];
+	if(size > MSG_FRAME_SIZE)
+		return -EFAULT;
+	size *= 4; // Convert to bytes
+
+	/* Copy in the user's I2O command */
+	if(copy_from_user((void*)msg, (void*)user_msg, size))
+		return -EFAULT;
+	if(get_user(reply_size, &user_reply[0]) < 0)
+		return -EFAULT;
+
+	reply_size = reply_size>>16;
+	reply = kmalloc(REPLY_FRAME_SIZE*4, GFP_KERNEL);
+	if(!reply) {
+		printk(KERN_WARNING"%s: Could not allocate reply buffer\n",c->name);
+		return -ENOMEM;
+	}
+	memset(reply, 0, REPLY_FRAME_SIZE*4);
+	sg_offset = (msg[0]>>4)&0x0f;
+	msg[2] = (u32)i2o_cfg_context;
+	msg[3] = (u32)reply;
+
+	memset(sg_list,0, sizeof(sg_list[0])*SG_TABLESIZE);
+	if(sg_offset) {
+		struct sg_simple_element *sg;
+
+		if(sg_offset * 4 >= size) {
+			rcode = -EFAULT;
+			goto cleanup;
+		}
+		// TODO 64bit fix
+		sg = (struct sg_simple_element*) (msg+sg_offset);
+		sg_count = (size - sg_offset*4) / sizeof(struct sg_simple_element);
+		if (sg_count > SG_TABLESIZE) {
+			printk(KERN_DEBUG"%s:IOCTL SG List too large (%u)\n", c->name,sg_count);
+			kfree (reply);
+			return -EINVAL;
+		}
+
+		for(i = 0; i < sg_count; i++) {
+			int sg_size;
+
+			if (!(sg[i].flag_count & 0x10000000 /*I2O_SGL_FLAGS_SIMPLE_ADDRESS_ELEMENT*/)) {
+				printk(KERN_DEBUG"%s:Bad SG element %d - not simple (%x)\n",c->name,i,  sg[i].flag_count);
+				rcode = -EINVAL;
+				goto cleanup;
+			}
+			sg_size = sg[i].flag_count & 0xffffff;
+			/* Allocate memory for the transfer */
+			p = (ulong)kmalloc(sg_size, GFP_KERNEL);
+			if (!p) {
+				printk(KERN_DEBUG"%s: Could not allocate SG buffer - size = %d buffer number %d of %d\n", c->name,sg_size,i,sg_count);
+				rcode = -ENOMEM;
+				goto cleanup;
+			}
+			sg_list[sg_index++] = p; // sglist indexed with input frame, not our internal frame.
+			/* Copy in the user's SG buffer if necessary */
+			if(sg[i].flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR*/) {
+				// TODO 64bit fix
+			        if (copy_from_user((void*)p,(void*)sg[i].addr_bus, sg_size)) {
+					printk(KERN_DEBUG"%s: Could not copy SG buf %d FROM user\n",c->name,i);
+					rcode = -EFAULT;
+					goto cleanup;
+				}
+			}
+			//TODO 64bit fix
+			sg[i].addr_bus = (u32)virt_to_bus((void*)p);
+		}
+	}
+
+	rcode = i2o_post_wait(c, msg, size, 60);
+	if(rcode)
+		goto cleanup;
+
+	if(sg_offset) {
+		/* Copy back the Scatter Gather buffers back to user space */
+		u32 j;
+		// TODO 64bit fix
+		struct sg_simple_element* sg;
+		int sg_size;
+
+		// re-acquire the original message to handle correctly the sg copy operation
+		memset(&msg, 0, MSG_FRAME_SIZE*4);
+		// get user msg size in u32s
+		if (get_user(size, &user_msg[0])) {
+			rcode = -EFAULT;
+			goto cleanup;
+		}
+		size = size>>16;
+		size *= 4;
+		/* Copy in the user's I2O command */
+		if (copy_from_user ((void*)msg, (void*)user_msg, size)) {
+			rcode = -EFAULT;
+			goto cleanup;
+		}
+		sg_count = (size - sg_offset*4) / sizeof(struct sg_simple_element);
+
+		 // TODO 64bit fix
+		sg = (struct sg_simple_element*)(msg + sg_offset);
+		for (j = 0; j < sg_count; j++) {
+			/* Copy out the SG list to user's buffer if necessary */
+			if (!(sg[j].flag_count & 0x4000000 /*I2O_SGL_FLAGS_DIR*/)) {
+				sg_size = sg[j].flag_count & 0xffffff;
+				// TODO 64bit fix
+				if (copy_to_user((void*)sg[j].addr_bus,(void*)sg_list[j], sg_size)) {
+					printk(KERN_WARNING"%s: Could not copy %lx TO user %x\n",c->name, sg_list[j], sg[j].addr_bus);
+					rcode = -EFAULT;
+					goto cleanup;
+				}
+			}
+		}
+	}
+
+	/* Copy back the reply to user space */
+        if (reply_size) {
+		// we wrote our own values for context - now restore the user supplied ones
+		if(copy_from_user(reply+2, user_msg+2, sizeof(u32)*2)) {
+			printk(KERN_WARNING"%s: Could not copy message context FROM user\n",c->name);
+			rcode = -EFAULT;
+		}
+		if(copy_to_user(user_reply, reply, reply_size)) {
+			printk(KERN_WARNING"%s: Could not copy reply TO user\n",c->name);
+			rcode = -EFAULT;
+		}
+	}
+
+cleanup:
+	kfree(reply);
+	i2o_unlock_controller(c);
+	return rcode;
 }
 
 static int cfg_open(struct inode *inode, struct file *file)
diff -Nru a/drivers/message/i2o/i2o_core.c b/drivers/message/i2o/i2o_core.c
--- a/drivers/message/i2o/i2o_core.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/message/i2o/i2o_core.c	Tue Jun 15 22:20:42 2004
@@ -213,6 +213,135 @@
 
 static int verbose;
 
+#if BITS_PER_LONG == 64
+/**
+ *      i2o_context_list_add -	append an ptr to the context list and return a
+ *				matching context id.
+ *	@ptr: pointer to add to the context list
+ *	@c: controller to which the context list belong
+ *	returns context id, which could be used in the transaction context
+ *	field.
+ *
+ *	Because the context field in I2O is only 32-bit large, on 64-bit the
+ *	pointer is to large to fit in the context field. The i2o_context_list
+ *	functiones map pointers to context fields.
+ */
+u32 i2o_context_list_add(void *ptr, struct i2o_controller *c) {
+	u32 context = 1;
+	struct i2o_context_list_element **entry = &c->context_list;
+	struct i2o_context_list_element *element;
+	unsigned long flags;
+
+	spin_lock_irqsave(&c->context_list_lock, flags);
+	while(*entry && ((*entry)->flags & I2O_CONTEXT_LIST_USED)) {
+		if((*entry)->context >= context)
+			context = (*entry)->context + 1;
+		entry = &((*entry)->next);
+	}
+
+	if(!*entry) {
+		if(unlikely(!context)) {
+			spin_unlock_irqrestore(&c->context_list_lock, flags);
+			printk(KERN_EMERG "i2o_core: context list overflow\n");
+			return 0;
+		}
+
+		element = kmalloc(sizeof(struct i2o_context_list_element), GFP_KERNEL);
+		if(!element) {
+			printk(KERN_EMERG "i2o_core: could not allocate memory for context list element\n");
+			return 0;
+		}
+		element->context = context;
+		element->next = NULL;
+		*entry = element;
+	} else
+		element = *entry;
+
+	element->ptr = ptr;
+	element->flags = I2O_CONTEXT_LIST_USED;
+
+	spin_unlock_irqrestore(&c->context_list_lock, flags);
+	dprintk(KERN_DEBUG "i2o_core: add context to list %p -> %d\n", ptr, context);
+	return context;
+}
+
+/**
+ *      i2o_context_list_remove - remove a ptr from the context list and return
+ *				  the matching context id.
+ *	@ptr: pointer to be removed from the context list
+ *	@c: controller to which the context list belong
+ *	returns context id, which could be used in the transaction context
+ *	field.
+ */
+u32 i2o_context_list_remove(void *ptr, struct i2o_controller *c) {
+	struct i2o_context_list_element **entry = &c->context_list;
+	struct i2o_context_list_element *element;
+	u32 context;
+	unsigned long flags;
+
+	spin_lock_irqsave(&c->context_list_lock, flags);
+	while(*entry && ((*entry)->ptr != ptr))
+		entry = &((*entry)->next);
+
+	if(unlikely(!*entry)) {
+		spin_unlock_irqrestore(&c->context_list_lock, flags);
+		printk(KERN_WARNING "i2o_core: could not remove nonexistent ptr %p\n", ptr);
+		return 0;
+	}
+
+	element = *entry;
+
+	context = element->context;
+	element->ptr = NULL;
+	element->flags |= I2O_CONTEXT_LIST_DELETED;
+
+	spin_unlock_irqrestore(&c->context_list_lock, flags);
+	dprintk(KERN_DEBUG "i2o_core: markt as deleted in context list %p -> %d\n", ptr, context);
+	return context;
+}
+
+/**
+ *      i2o_context_list_get -	get a ptr from the context list and remove it
+ *				from the list.
+ *	@context: context id to which the pointer belong
+ *	@c: controller to which the context list belong
+ *	returns pointer to the matching context id
+ */
+void *i2o_context_list_get(u32 context, struct i2o_controller *c) {
+	struct i2o_context_list_element **entry = &c->context_list;
+	struct i2o_context_list_element *element;
+	void *ptr;
+	int count = 0;
+	unsigned long flags;
+
+	spin_lock_irqsave(&c->context_list_lock, flags);
+	while(*entry && ((*entry)->context != context)) {
+		entry = &((*entry)->next);
+		count ++;
+	}
+
+	if(unlikely(!*entry)) {
+		spin_unlock_irqrestore(&c->context_list_lock, flags);
+		printk(KERN_WARNING "i2o_core: context id %d not found\n", context);
+		return NULL;
+	}
+
+	element = *entry;
+	ptr = element->ptr;
+	if(count >= I2O_CONTEXT_LIST_MIN_LENGTH) {
+		*entry = (*entry)->next;
+		kfree(element);
+	} else {
+		element->ptr = NULL;
+		element->flags &= !I2O_CONTEXT_LIST_USED;
+	}
+
+	spin_unlock_irqrestore(&c->context_list_lock, flags);
+	dprintk(KERN_DEBUG "i2o_core: get ptr from context list %d -> %p\n", context, ptr);
+	return ptr;
+}
+#endif
+
 /*
  * I2O Core reply handler
  */
@@ -3551,6 +3680,10 @@
 	c->short_req = 0;
 	c->pdev = dev;
 
+#if BITS_PER_LONG == 64
+	c->context_list_lock = SPIN_LOCK_UNLOCKED;
+#endif
+
 	c->irq_mask = mem+0x34;
 	c->post_port = mem+0x40;
 	c->reply_port = mem+0x44;
@@ -3788,3 +3921,6 @@
 EXPORT_SYMBOL(i2o_report_status);
 EXPORT_SYMBOL(i2o_dump_message);
 EXPORT_SYMBOL(i2o_get_class_name);
+EXPORT_SYMBOL(i2o_context_list_add);
+EXPORT_SYMBOL(i2o_context_list_get);
+EXPORT_SYMBOL(i2o_context_list_remove);
diff -Nru a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
--- a/drivers/message/i2o/i2o_proc.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/message/i2o/i2o_proc.c	Tue Jun 15 22:20:42 2004
@@ -43,6 +43,7 @@
 #include <linux/pci.h>
 #include <linux/i2o.h>
 #include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/errno.h>
@@ -64,13 +65,14 @@
 	mode_t mode;			/* mode */
 	read_proc_t *read_proc;		/* read func */
 	write_proc_t *write_proc;	/* write func */
+	struct file_operations *fops_proc;	/* file operations func */
 } i2o_proc_entry;
 
 // #define DRIVERDEBUG
 
-static int i2o_proc_read_lct(char *, char **, off_t, int, int *, void *);
-static int i2o_proc_read_hrt(char *, char **, off_t, int, int *, void *);
-static int i2o_proc_read_status(char *, char **, off_t, int, int *, void *);
+static int i2o_seq_show_lct(struct seq_file *, void *);
+static int i2o_seq_show_hrt(struct seq_file *, void *);
+static int i2o_seq_show_status(struct seq_file *, void *);
 
 static int i2o_proc_read_hw(char *, char **, off_t, int, int *, void *);
 static int i2o_proc_read_ddm_table(char *, char **, off_t, int, int *, void *);
@@ -151,20 +153,56 @@
 	0xffffffff	// All classes
 };
 
+static int i2o_seq_open_hrt(struct inode *inode, struct file *file)
+{
+	return single_open(file, i2o_seq_show_hrt, PDE(inode)->data);
+};
+
+struct file_operations i2o_seq_fops_hrt = {
+	.open	= i2o_seq_open_hrt,
+	.read	= seq_read,
+	.llseek	= seq_lseek,
+	.release = single_release
+};
+
+static int i2o_seq_open_lct(struct inode *inode, struct file *file)
+{
+	return single_open(file, i2o_seq_show_lct, PDE(inode)->data);
+};
+
+struct file_operations i2o_seq_fops_lct = {
+	.open	= i2o_seq_open_lct,
+	.read	= seq_read,
+	.llseek	= seq_lseek,
+	.release = single_release
+};
+
+static int i2o_seq_open_status(struct inode *inode, struct file *file)
+{
+	return single_open(file, i2o_seq_show_status, PDE(inode)->data);
+};
+
+struct file_operations i2o_seq_fops_status = {
+	.open	= i2o_seq_open_status,
+	.read	= seq_read,
+	.llseek	= seq_lseek,
+	.release = single_release
+};
+
 /*
  * IOP specific entries...write field just in case someone 
  * ever wants one.
  */
 static i2o_proc_entry generic_iop_entries[] = 
 {
-	{"hrt", S_IFREG|S_IRUGO, i2o_proc_read_hrt, NULL},
-	{"lct", S_IFREG|S_IRUGO, i2o_proc_read_lct, NULL},
-	{"status", S_IFREG|S_IRUGO, i2o_proc_read_status, NULL},
-	{"hw", S_IFREG|S_IRUGO, i2o_proc_read_hw, NULL},
-	{"ddm_table", S_IFREG|S_IRUGO, i2o_proc_read_ddm_table, NULL},
-	{"driver_store", S_IFREG|S_IRUGO, i2o_proc_read_driver_store, NULL},
-	{"drivers_stored", S_IFREG|S_IRUGO, i2o_proc_read_drivers_stored, NULL},
-	{NULL, 0, NULL, NULL}
+	{"hrt", S_IFREG|S_IRUGO, NULL, NULL, &i2o_seq_fops_hrt},
+	{"lct", S_IFREG|S_IRUGO, NULL, NULL, &i2o_seq_fops_lct},
+	{"status", S_IFREG|S_IRUGO, NULL, NULL, &i2o_seq_fops_status},
+	{"hw", S_IFREG|S_IRUGO, i2o_proc_read_hw, NULL, NULL},
+	{"ddm_table", S_IFREG|S_IRUGO, i2o_proc_read_ddm_table, NULL, NULL},
+	{"driver_store", S_IFREG|S_IRUGO, i2o_proc_read_driver_store, NULL, NULL},
+	{"drivers_stored", S_IFREG|S_IRUGO, i2o_proc_read_drivers_stored, NULL, NULL},
+	{NULL, 0, NULL, NULL, NULL}
 };
 
 /*
@@ -172,18 +210,18 @@
  */
 static i2o_proc_entry generic_dev_entries[] = 
 {
-	{"groups", S_IFREG|S_IRUGO, i2o_proc_read_groups, NULL},
-	{"phys_dev", S_IFREG|S_IRUGO, i2o_proc_read_phys_device, NULL},
-	{"claimed", S_IFREG|S_IRUGO, i2o_proc_read_claimed, NULL},
-	{"users", S_IFREG|S_IRUGO, i2o_proc_read_users, NULL},
-	{"priv_msgs", S_IFREG|S_IRUGO, i2o_proc_read_priv_msgs, NULL},
-	{"authorized_users", S_IFREG|S_IRUGO, i2o_proc_read_authorized_users, NULL},
-	{"dev_identity", S_IFREG|S_IRUGO, i2o_proc_read_dev_identity, NULL},
-	{"ddm_identity", S_IFREG|S_IRUGO, i2o_proc_read_ddm_identity, NULL},
-	{"user_info", S_IFREG|S_IRUGO, i2o_proc_read_uinfo, NULL},
-	{"sgl_limits", S_IFREG|S_IRUGO, i2o_proc_read_sgl_limits, NULL},
-	{"sensors", S_IFREG|S_IRUGO, i2o_proc_read_sensors, NULL},
-	{NULL, 0, NULL, NULL}
+	{"groups", S_IFREG|S_IRUGO, i2o_proc_read_groups, NULL, NULL},
+	{"phys_dev", S_IFREG|S_IRUGO, i2o_proc_read_phys_device, NULL, NULL},
+	{"claimed", S_IFREG|S_IRUGO, i2o_proc_read_claimed, NULL, NULL},
+	{"users", S_IFREG|S_IRUGO, i2o_proc_read_users, NULL, NULL},
+	{"priv_msgs", S_IFREG|S_IRUGO, i2o_proc_read_priv_msgs, NULL, NULL},
+	{"authorized_users", S_IFREG|S_IRUGO, i2o_proc_read_authorized_users, NULL, NULL},
+	{"dev_identity", S_IFREG|S_IRUGO, i2o_proc_read_dev_identity, NULL, NULL},
+	{"ddm_identity", S_IFREG|S_IRUGO, i2o_proc_read_ddm_identity, NULL, NULL},
+	{"user_info", S_IFREG|S_IRUGO, i2o_proc_read_uinfo, NULL, NULL},
+	{"sgl_limits", S_IFREG|S_IRUGO, i2o_proc_read_sgl_limits, NULL, NULL},
+	{"sensors", S_IFREG|S_IRUGO, i2o_proc_read_sensors, NULL, NULL},
+	{NULL, 0, NULL, NULL, NULL}
 };
 
 /*
@@ -191,7 +229,7 @@
  */
 static i2o_proc_entry rbs_dev_entries[] = 
 {
-	{"dev_name", S_IFREG|S_IRUGO, i2o_proc_read_dev_name, NULL},
+	{"dev_name", S_IFREG|S_IRUGO, i2o_proc_read_dev_name, NULL, NULL},
 	{NULL, 0, NULL, NULL}
 };
 
@@ -223,21 +261,21 @@
  */
 static i2o_proc_entry lan_entries[] = 
 {
-	{"lan_dev_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_dev_info, NULL},
-	{"lan_mac_addr", S_IFREG|S_IRUGO, i2o_proc_read_lan_mac_addr, NULL},
+	{"lan_dev_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_dev_info, NULL, NULL},
+	{"lan_mac_addr", S_IFREG|S_IRUGO, i2o_proc_read_lan_mac_addr, NULL, NULL},
 	{"lan_mcast_addr", S_IFREG|S_IRUGO|S_IWUSR,
-	 i2o_proc_read_lan_mcast_addr, NULL},
+	 i2o_proc_read_lan_mcast_addr, NULL, NULL},
 	{"lan_batch_ctrl", S_IFREG|S_IRUGO|S_IWUSR,
-	 i2o_proc_read_lan_batch_control, NULL},
-	{"lan_operation", S_IFREG|S_IRUGO, i2o_proc_read_lan_operation, NULL},
+	 i2o_proc_read_lan_batch_control, NULL, NULL},
+	{"lan_operation", S_IFREG|S_IRUGO, i2o_proc_read_lan_operation, NULL, NULL},
 	{"lan_media_operation", S_IFREG|S_IRUGO,
-	 i2o_proc_read_lan_media_operation, NULL},
-	{"lan_alt_addr", S_IFREG|S_IRUGO, i2o_proc_read_lan_alt_addr, NULL},
-	{"lan_tx_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_tx_info, NULL},
-	{"lan_rx_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_rx_info, NULL},
+	 i2o_proc_read_lan_media_operation, NULL, NULL},
+	{"lan_alt_addr", S_IFREG|S_IRUGO, i2o_proc_read_lan_alt_addr, NULL, NULL},
+	{"lan_tx_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_tx_info, NULL, NULL},
+	{"lan_rx_info", S_IFREG|S_IRUGO, i2o_proc_read_lan_rx_info, NULL, NULL},
 
-	{"lan_hist_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_hist_stats, NULL},
-	{NULL, 0, NULL, NULL}
+	{"lan_hist_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_hist_stats, NULL, NULL},
+	{NULL, 0, NULL, NULL, NULL}
 };
 
 /*
@@ -246,20 +284,20 @@
  */
 static i2o_proc_entry lan_eth_entries[] = 
 {
-	{"lan_eth_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_eth_stats, NULL},
-	{NULL, 0, NULL, NULL}
+	{"lan_eth_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_eth_stats, NULL, NULL},
+	{NULL, 0, NULL, NULL, NULL}
 };
 
 static i2o_proc_entry lan_tr_entries[] = 
 {
-	{"lan_tr_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_tr_stats, NULL},
-	{NULL, 0, NULL, NULL}
+	{"lan_tr_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_tr_stats, NULL, NULL},
+	{NULL, 0, NULL, NULL, NULL}
 };
 
 static i2o_proc_entry lan_fddi_entries[] = 
 {
-	{"lan_fddi_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_fddi_stats, NULL},
-	{NULL, 0, NULL, NULL}
+	{"lan_fddi_stats", S_IFREG|S_IRUGO, i2o_proc_read_lan_fddi_stats, NULL, NULL},
+	{NULL, 0, NULL, NULL, NULL}
 };
 
 
@@ -300,116 +338,98 @@
 
 static spinlock_t i2o_proc_lock = SPIN_LOCK_UNLOCKED;
 
-int i2o_proc_read_hrt(char *buf, char **start, off_t offset, int count, 
-		      int *eof, void *data)
+int i2o_seq_show_hrt(struct seq_file *seq, void *v)
 {
-	struct i2o_controller *c = (struct i2o_controller *)data;
+	struct i2o_controller *c = (struct i2o_controller *)seq->private;
 	i2o_hrt *hrt = (i2o_hrt *)c->hrt;
 	u32 bus;
-	int len, i;
-
-	spin_lock(&i2o_proc_lock);
-
-	len = 0;
+	int i;
 
 	if(hrt->hrt_version)
 	{
-		len += sprintf(buf+len, 
-			       "HRT table for controller is too new a version.\n");
-		spin_unlock(&i2o_proc_lock);
-		return len;
+		seq_printf(seq, "HRT table for controller is too new a version.\n");
+		return 0;
 	}
 
-	if((hrt->num_entries * hrt->entry_len + 8) > 2048) {
-		printk(KERN_WARNING "i2o_proc: HRT does not fit into buffer\n");
-		len += sprintf(buf+len,
-			       "HRT table too big to fit in buffer.\n");
-		spin_unlock(&i2o_proc_lock);
-		return len;
-	}
-	
-	len += sprintf(buf+len, "HRT has %d entries of %d bytes each.\n",
+	seq_printf(seq, "HRT has %d entries of %d bytes each.\n",
 		       hrt->num_entries, hrt->entry_len << 2);
 
-	for(i = 0; i < hrt->num_entries && len < count; i++)
+	for(i = 0; i < hrt->num_entries; i++)
 	{
-		len += sprintf(buf+len, "Entry %d:\n", i);
-		len += sprintf(buf+len, "   Adapter ID: %0#10x\n", 
+		seq_printf(seq, "Entry %d:\n", i);
+		seq_printf(seq, "   Adapter ID: %0#10x\n",
 					hrt->hrt_entry[i].adapter_id);
-		len += sprintf(buf+len, "   Controlling tid: %0#6x\n",
+		seq_printf(seq, "   Controlling tid: %0#6x\n",
 					hrt->hrt_entry[i].parent_tid);
 
 		if(hrt->hrt_entry[i].bus_type != 0x80)
 		{
 			bus = hrt->hrt_entry[i].bus_type;
-			len += sprintf(buf+len, "   %s Information\n", bus_strings[bus]);
+			seq_printf(seq, "   %s Information\n", bus_strings[bus]);
 
 			switch(bus)
 			{
 				case I2O_BUS_LOCAL:
-					len += sprintf(buf+len, "     IOBase: %0#6x,",
+					seq_printf(seq, "     IOBase: %0#6x,",
 								hrt->hrt_entry[i].bus.local_bus.LbBaseIOPort);
-					len += sprintf(buf+len, " MemoryBase: %0#10x\n",
+					seq_printf(seq, " MemoryBase: %0#10x\n",
 								hrt->hrt_entry[i].bus.local_bus.LbBaseMemoryAddress);
 					break;
 
 				case I2O_BUS_ISA:
-					len += sprintf(buf+len, "     IOBase: %0#6x,",
+					seq_printf(seq, "     IOBase: %0#6x,",
 								hrt->hrt_entry[i].bus.isa_bus.IsaBaseIOPort);
-					len += sprintf(buf+len, " MemoryBase: %0#10x,",
+					seq_printf(seq, " MemoryBase: %0#10x,",
 								hrt->hrt_entry[i].bus.isa_bus.IsaBaseMemoryAddress);
-					len += sprintf(buf+len, " CSN: %0#4x,",
+					seq_printf(seq, " CSN: %0#4x,",
 								hrt->hrt_entry[i].bus.isa_bus.CSN);
 					break;
 
 				case I2O_BUS_EISA:
-					len += sprintf(buf+len, "     IOBase: %0#6x,",
+					seq_printf(seq, "     IOBase: %0#6x,",
 								hrt->hrt_entry[i].bus.eisa_bus.EisaBaseIOPort);
-					len += sprintf(buf+len, " MemoryBase: %0#10x,",
+					seq_printf(seq, " MemoryBase: %0#10x,",
 								hrt->hrt_entry[i].bus.eisa_bus.EisaBaseMemoryAddress);
-					len += sprintf(buf+len, " Slot: %0#4x,",
+					seq_printf(seq, " Slot: %0#4x,",
 								hrt->hrt_entry[i].bus.eisa_bus.EisaSlotNumber);
 					break;
 			 
 				case I2O_BUS_MCA:
-					len += sprintf(buf+len, "     IOBase: %0#6x,",
+					seq_printf(seq, "     IOBase: %0#6x,",
 								hrt->hrt_entry[i].bus.mca_bus.McaBaseIOPort);
-					len += sprintf(buf+len, " MemoryBase: %0#10x,",
+					seq_printf(seq, " MemoryBase: %0#10x,",
 								hrt->hrt_entry[i].bus.mca_bus.McaBaseMemoryAddress);
-					len += sprintf(buf+len, " Slot: %0#4x,",
+					seq_printf(seq, " Slot: %0#4x,",
 								hrt->hrt_entry[i].bus.mca_bus.McaSlotNumber);
 					break;
 
 				case I2O_BUS_PCI:
-					len += sprintf(buf+len, "     Bus: %0#4x",
+					seq_printf(seq, "     Bus: %0#4x",
 								hrt->hrt_entry[i].bus.pci_bus.PciBusNumber);
-					len += sprintf(buf+len, " Dev: %0#4x",
+					seq_printf(seq, " Dev: %0#4x",
 								hrt->hrt_entry[i].bus.pci_bus.PciDeviceNumber);
-					len += sprintf(buf+len, " Func: %0#4x",
+					seq_printf(seq, " Func: %0#4x",
 								hrt->hrt_entry[i].bus.pci_bus.PciFunctionNumber);
-					len += sprintf(buf+len, " Vendor: %0#6x",
+					seq_printf(seq, " Vendor: %0#6x",
 								hrt->hrt_entry[i].bus.pci_bus.PciVendorID);
-					len += sprintf(buf+len, " Device: %0#6x\n",
+					seq_printf(seq, " Device: %0#6x\n",
 								hrt->hrt_entry[i].bus.pci_bus.PciDeviceID);
 					break;
 
 				default:
-					len += sprintf(buf+len, "      Unsupported Bus Type\n");
+					seq_printf(seq, "      Unsupported Bus Type\n");
 			}
 		}
 		else
-			len += sprintf(buf+len, "   Unknown Bus Type\n");
+			seq_printf(seq, "   Unknown Bus Type\n");
 	}
-
-	spin_unlock(&i2o_proc_lock);
 	
-	return len;
+	return 0;
 }
 
-int i2o_proc_read_lct(char *buf, char **start, off_t offset, int len,
-	int *eof, void *data)
+int i2o_seq_show_lct(struct seq_file *seq, void *v)
 {
-	struct i2o_controller *c = (struct i2o_controller*)data;
+	struct i2o_controller *c = (struct i2o_controller*)seq->private;
 	i2o_lct *lct = (i2o_lct *)c->lct;
 	int entries;
 	int i;
@@ -422,23 +442,19 @@
 		"Fibre Channel Bus"
 	};
 
-	spin_lock(&i2o_proc_lock);
-	len = 0;
-
 	entries = (lct->table_size - 3)/9;
 
-	len += sprintf(buf, "LCT contains %d %s\n", entries,
+	seq_printf(seq, "LCT contains %d %s\n", entries,
 						entries == 1 ? "entry" : "entries");
 	if(lct->boot_tid)	
-		len += sprintf(buf+len, "Boot Device @ ID %d\n", lct->boot_tid);
+		seq_printf(seq, "Boot Device @ ID %d\n", lct->boot_tid);
 
-	len += 
-		sprintf(buf+len, "Current Change Indicator: %#10x\n", lct->change_ind);
+	seq_printf(seq, "Current Change Indicator: %#10x\n", lct->change_ind);
 
 	for(i = 0; i < entries; i++)
 	{
-		len += sprintf(buf+len, "Entry %d\n", i);
-		len += sprintf(buf+len, "  Class, SubClass  : %s", i2o_get_class_name(lct->lct_entry[i].class_id));
+		seq_printf(seq, "Entry %d\n", i);
+		seq_printf(seq, "  Class, SubClass  : %s", i2o_get_class_name(lct->lct_entry[i].class_id));
 	
 		/*
 		 *	Classes which we'll print subclass info for
@@ -449,23 +465,23 @@
 				switch(lct->lct_entry[i].sub_class)
 				{
 					case 0x00:
-						len += sprintf(buf+len, ", Direct-Access Read/Write");
+						seq_printf(seq, ", Direct-Access Read/Write");
 						break;
 
 					case 0x04:
-						len += sprintf(buf+len, ", WORM Drive");
+						seq_printf(seq, ", WORM Drive");
 						break;
 	
 					case 0x05:
-						len += sprintf(buf+len, ", CD-ROM Drive");
+						seq_printf(seq, ", CD-ROM Drive");
 						break;
 
 					case 0x07:
-						len += sprintf(buf+len, ", Optical Memory Device");
+						seq_printf(seq, ", Optical Memory Device");
 						break;
 
 					default:
-						len += sprintf(buf+len, ", Unknown (0x%02x)",
+						seq_printf(seq, ", Unknown (0x%02x)",
 							       lct->lct_entry[i].sub_class);
 						break;
 				}
@@ -475,27 +491,27 @@
 				switch(lct->lct_entry[i].sub_class & 0xFF)
 				{
 					case 0x30:
-						len += sprintf(buf+len, ", Ethernet");
+						seq_printf(seq, ", Ethernet");
 						break;
 
 					case 0x40:
-						len += sprintf(buf+len, ", 100base VG");
+						seq_printf(seq, ", 100base VG");
 						break;
 
 					case 0x50:
-						len += sprintf(buf+len, ", IEEE 802.5/Token-Ring");
+						seq_printf(seq, ", IEEE 802.5/Token-Ring");
 						break;
 
 					case 0x60:
-						len += sprintf(buf+len, ", ANSI X3T9.5 FDDI");
+						seq_printf(seq, ", ANSI X3T9.5 FDDI");
 						break;
 		
 					case 0x70:
-						len += sprintf(buf+len, ", Fibre Channel");
+						seq_printf(seq, ", Fibre Channel");
 						break;
 
 					default:
-						len += sprintf(buf+len, ", Unknown Sub-Class (0x%02x)",
+						seq_printf(seq, ", Unknown Sub-Class (0x%02x)",
 							       lct->lct_entry[i].sub_class & 0xFF);
 						break;
 				}
@@ -503,27 +519,27 @@
 
 			case I2O_CLASS_SCSI_PERIPHERAL:
 				if(lct->lct_entry[i].sub_class < SCSI_TABLE_SIZE)
-					len += sprintf(buf+len, ", %s", 
+					seq_printf(seq, ", %s",
 								scsi_devices[lct->lct_entry[i].sub_class]);
 				else
-					len += sprintf(buf+len, ", Unknown Device Type");
+					seq_printf(seq, ", Unknown Device Type");
 				break;
 
 			case I2O_CLASS_BUS_ADAPTER_PORT:
 				if(lct->lct_entry[i].sub_class < BUS_TABLE_SIZE)
-					len += sprintf(buf+len, ", %s", 
+					seq_printf(seq, ", %s",
 								bus_ports[lct->lct_entry[i].sub_class]);
 				else
-					len += sprintf(buf+len, ", Unknown Bus Type");
+					seq_printf(seq, ", Unknown Bus Type");
 				break;
 		}
-		len += sprintf(buf+len, "\n");
+		seq_printf(seq, "\n");
 		
-		len += sprintf(buf+len, "  Local TID        : 0x%03x\n", lct->lct_entry[i].tid);
-		len += sprintf(buf+len, "  User TID         : 0x%03x\n", lct->lct_entry[i].user_tid);
-		len += sprintf(buf+len, "  Parent TID       : 0x%03x\n", 
+		seq_printf(seq, "  Local TID        : 0x%03x\n", lct->lct_entry[i].tid);
+		seq_printf(seq, "  User TID         : 0x%03x\n", lct->lct_entry[i].user_tid);
+		seq_printf(seq, "  Parent TID       : 0x%03x\n",
 					lct->lct_entry[i].parent_tid);
-		len += sprintf(buf+len, "  Identity Tag     : 0x%x%x%x%x%x%x%x%x\n",
+		seq_printf(seq, "  Identity Tag     : 0x%x%x%x%x%x%x%x%x\n",
 					lct->lct_entry[i].identity_tag[0],
 					lct->lct_entry[i].identity_tag[1],
 					lct->lct_entry[i].identity_tag[2],
@@ -532,214 +548,207 @@
 					lct->lct_entry[i].identity_tag[5],
 					lct->lct_entry[i].identity_tag[6],
 					lct->lct_entry[i].identity_tag[7]);
-		len += sprintf(buf+len, "  Change Indicator : %0#10x\n", 
+		seq_printf(seq, "  Change Indicator : %0#10x\n",
 				lct->lct_entry[i].change_ind);
-		len += sprintf(buf+len, "  Event Capab Mask : %0#10x\n", 
+		seq_printf(seq, "  Event Capab Mask : %0#10x\n",
 				lct->lct_entry[i].device_flags);
 	}
 
-	spin_unlock(&i2o_proc_lock);
-	return len;
+	return 0;
 }
 
-int i2o_proc_read_status(char *buf, char **start, off_t offset, int len, 
-			 int *eof, void *data)
+int i2o_seq_show_status(struct seq_file *seq, void *v)
 {
-	struct i2o_controller *c = (struct i2o_controller*)data;
+	struct i2o_controller *c = (struct i2o_controller*)seq->private;
 	char prodstr[25];
 	int version;
 	
-	spin_lock(&i2o_proc_lock);
-	len = 0;
-
 	i2o_status_get(c); // reread the status block
 
-	len += sprintf(buf+len,"Organization ID        : %0#6x\n", 
+	seq_printf(seq, "Organization ID        : %0#6x\n",
 				c->status_block->org_id);
 
 	version = c->status_block->i2o_version;
 	
 /* FIXME for Spec 2.0
 	if (version == 0x02) {
-		len += sprintf(buf+len,"Lowest I2O version supported: ");
+		seq_printf(seq, "Lowest I2O version supported: ");
 		switch(workspace[2]) {
 			case 0x00:
-				len += sprintf(buf+len,"1.0\n");
+				seq_printf(seq, "1.0\n");
 				break;
 			case 0x01:
-				len += sprintf(buf+len,"1.5\n");
+				seq_printf(seq, "1.5\n");
 				break;
 			case 0x02:
-				len += sprintf(buf+len,"2.0\n");
+				seq_printf(seq, "2.0\n");
 				break;
 		}
 
-		len += sprintf(buf+len, "Highest I2O version supported: ");
+		seq_printf(seq, "Highest I2O version supported: ");
 		switch(workspace[3]) {
 			case 0x00:
-				len += sprintf(buf+len,"1.0\n");
+				seq_printf(seq, "1.0\n");
 				break;
 			case 0x01:
-				len += sprintf(buf+len,"1.5\n");
+				seq_printf(seq, "1.5\n");
 				break;
 			case 0x02:
-				len += sprintf(buf+len,"2.0\n");
+				seq_printf(seq, "2.0\n");
 				break;
 		}
 	}
 */
-	len += sprintf(buf+len,"IOP ID                 : %0#5x\n", 
+	seq_printf(seq, "IOP ID                 : %0#5x\n",
 				c->status_block->iop_id);
-	len += sprintf(buf+len,"Host Unit ID           : %0#6x\n",
+	seq_printf(seq, "Host Unit ID           : %0#6x\n",
 				c->status_block->host_unit_id);
-	len += sprintf(buf+len,"Segment Number         : %0#5x\n",
+	seq_printf(seq, "Segment Number         : %0#5x\n",
 				c->status_block->segment_number);
 
-	len += sprintf(buf+len, "I2O version            : ");
+	seq_printf(seq, "I2O version            : ");
 	switch (version) {
 		case 0x00:
-			len += sprintf(buf+len,"1.0\n");
+			seq_printf(seq, "1.0\n");
 			break;
 		case 0x01:
-			len += sprintf(buf+len,"1.5\n");
+			seq_printf(seq, "1.5\n");
 			break;
 		case 0x02:
-			len += sprintf(buf+len,"2.0\n");
+			seq_printf(seq, "2.0\n");
 			break;
 		default:
-			len += sprintf(buf+len,"Unknown version\n");
+			seq_printf(seq, "Unknown version\n");
 	}
 
-	len += sprintf(buf+len, "IOP State              : ");
+	seq_printf(seq, "IOP State              : ");
 	switch (c->status_block->iop_state) {
 		case 0x01:
-			len += sprintf(buf+len,"INIT\n");
+			seq_printf(seq, "INIT\n");
 			break;
 
 		case 0x02:
-			len += sprintf(buf+len,"RESET\n");
+			seq_printf(seq, "RESET\n");
 			break;
 
 		case 0x04:
-			len += sprintf(buf+len,"HOLD\n");
+			seq_printf(seq, "HOLD\n");
 			break;
 
 		case 0x05:
-			len += sprintf(buf+len,"READY\n");
+			seq_printf(seq, "READY\n");
 			break;
 
 		case 0x08:
-			len += sprintf(buf+len,"OPERATIONAL\n");
+			seq_printf(seq, "OPERATIONAL\n");
 			break;
 
 		case 0x10:
-			len += sprintf(buf+len,"FAILED\n");
+			seq_printf(seq, "FAILED\n");
 			break;
 
 		case 0x11:
-			len += sprintf(buf+len,"FAULTED\n");
+			seq_printf(seq, "FAULTED\n");
 			break;
 
 		default:
-			len += sprintf(buf+len,"Unknown\n");
+			seq_printf(seq, "Unknown\n");
 			break;
 	}
 
-	len += sprintf(buf+len,"Messenger Type         : ");
+	seq_printf(seq, "Messenger Type         : ");
 	switch (c->status_block->msg_type) { 
 		case 0x00:
-			len += sprintf(buf+len,"Memory mapped\n");
+			seq_printf(seq, "Memory mapped\n");
 			break;
 		case 0x01:
-			len += sprintf(buf+len,"Memory mapped only\n");
+			seq_printf(seq, "Memory mapped only\n");
 			break;
 		case 0x02:
-			len += sprintf(buf+len,"Remote only\n");
+			seq_printf(seq,"Remote only\n");
 			break;
 		case 0x03:
-			len += sprintf(buf+len,"Memory mapped and remote\n");
+			seq_printf(seq, "Memory mapped and remote\n");
 			break;
 		default:
-			len += sprintf(buf+len,"Unknown\n");
+			seq_printf(seq, "Unknown\n");
 	}
 
-	len += sprintf(buf+len,"Inbound Frame Size     : %d bytes\n", 
+	seq_printf(seq, "Inbound Frame Size     : %d bytes\n",
 				c->status_block->inbound_frame_size<<2);
-	len += sprintf(buf+len,"Max Inbound Frames     : %d\n", 
+	seq_printf(seq, "Max Inbound Frames     : %d\n",
 				c->status_block->max_inbound_frames);
-	len += sprintf(buf+len,"Current Inbound Frames : %d\n", 
+	seq_printf(seq, "Current Inbound Frames : %d\n",
 				c->status_block->cur_inbound_frames);
-	len += sprintf(buf+len,"Max Outbound Frames    : %d\n", 
+	seq_printf(seq, "Max Outbound Frames    : %d\n",
 				c->status_block->max_outbound_frames);
 
 	/* Spec doesn't say if NULL terminated or not... */
 	memcpy(prodstr, c->status_block->product_id, 24);
 	prodstr[24] = '\0';
-	len += sprintf(buf+len,"Product ID             : %s\n", prodstr);
-	len += sprintf(buf+len,"Expected LCT Size      : %d bytes\n", 
+	seq_printf(seq, "Product ID             : %s\n", prodstr);
+	seq_printf(seq, "Expected LCT Size      : %d bytes\n",
 				c->status_block->expected_lct_size);
 
-	len += sprintf(buf+len,"IOP Capabilities\n");
-	len += sprintf(buf+len,"    Context Field Size Support : ");
+	seq_printf(seq, "IOP Capabilities\n");
+	seq_printf(seq, "    Context Field Size Support : ");
 	switch (c->status_block->iop_capabilities & 0x0000003) {
 		case 0:
-			len += sprintf(buf+len,"Supports only 32-bit context fields\n");
+			seq_printf(seq, "Supports only 32-bit context fields\n");
 			break;
 		case 1:
-			len += sprintf(buf+len,"Supports only 64-bit context fields\n");
+			seq_printf(seq, "Supports only 64-bit context fields\n");
 			break;
 		case 2:
-			len += sprintf(buf+len,"Supports 32-bit and 64-bit context fields, "
+			seq_printf(seq, "Supports 32-bit and 64-bit context fields, "
 						"but not concurrently\n");
 			break;
 		case 3:
-			len += sprintf(buf+len,"Supports 32-bit and 64-bit context fields "
+			seq_printf(seq, "Supports 32-bit and 64-bit context fields "
 						"concurrently\n");
 			break;
 		default:
-			len += sprintf(buf+len,"0x%08x\n",c->status_block->iop_capabilities);
+			seq_printf(seq, "0x%08x\n",c->status_block->iop_capabilities);
 	}
-	len += sprintf(buf+len,"    Current Context Field Size : ");
+	seq_printf(seq, "    Current Context Field Size : ");
 	switch (c->status_block->iop_capabilities & 0x0000000C) {
 		case 0:
-			len += sprintf(buf+len,"not configured\n");
+			seq_printf(seq, "not configured\n");
 			break;
 		case 4:
-			len += sprintf(buf+len,"Supports only 32-bit context fields\n");
+			seq_printf(seq, "Supports only 32-bit context fields\n");
 			break;
 		case 8:
-			len += sprintf(buf+len,"Supports only 64-bit context fields\n");
+			seq_printf(seq, "Supports only 64-bit context fields\n");
 			break;
 		case 12:
-			len += sprintf(buf+len,"Supports both 32-bit or 64-bit context fields "
+			seq_printf(seq, "Supports both 32-bit or 64-bit context fields "
 						"concurrently\n");
 			break;
 		default:
-			len += sprintf(buf+len,"\n");
+			seq_printf(seq, "\n");
 	}
-	len += sprintf(buf+len,"    Inbound Peer Support       : %s\n",
+	seq_printf(seq, "    Inbound Peer Support       : %s\n",
 			(c->status_block->iop_capabilities & 0x00000010) ? "Supported" : "Not supported");
-	len += sprintf(buf+len,"    Outbound Peer Support      : %s\n",
+	seq_printf(seq, "    Outbound Peer Support      : %s\n",
 			(c->status_block->iop_capabilities & 0x00000020) ? "Supported" : "Not supported");
-	len += sprintf(buf+len,"    Peer to Peer Support       : %s\n",
+	seq_printf(seq, "    Peer to Peer Support       : %s\n",
 			(c->status_block->iop_capabilities & 0x00000040) ? "Supported" : "Not supported");
 
-	len += sprintf(buf+len, "Desired private memory size   : %d kB\n", 
+	seq_printf(seq, "Desired private memory size   : %d kB\n",
 				c->status_block->desired_mem_size>>10);
-	len += sprintf(buf+len, "Allocated private memory size : %d kB\n", 
+	seq_printf(seq, "Allocated private memory size : %d kB\n",
 				c->status_block->current_mem_size>>10);
-	len += sprintf(buf+len, "Private memory base address   : %0#10x\n", 
+	seq_printf(seq, "Private memory base address   : %0#10x\n",
 				c->status_block->current_mem_base);
-	len += sprintf(buf+len, "Desired private I/O size      : %d kB\n", 
+	seq_printf(seq, "Desired private I/O size      : %d kB\n",
 				c->status_block->desired_io_size>>10);
-	len += sprintf(buf+len, "Allocated private I/O size    : %d kB\n", 
+	seq_printf(seq, "Allocated private I/O size    : %d kB\n",
 				c->status_block->current_io_size>>10);
-	len += sprintf(buf+len, "Private I/O base address      : %0#10x\n", 
+	seq_printf(seq, "Private I/O base address      : %0#10x\n",
 				c->status_block->current_io_base);
 
-	spin_unlock(&i2o_proc_lock);
-
-	return len;
+	return 0;
 }
 
 int i2o_proc_read_hw(char *buf, char **start, off_t offset, int len, 
@@ -3146,6 +3155,9 @@
 		ent->data = data;
 		ent->read_proc = pentry->read_proc;
 		ent->write_proc = pentry->write_proc;
+		if(pentry->fops_proc)
+			ent->proc_fops = pentry->fops_proc;
+
 		ent->nlink = 1;
 
 		pentry++;
@@ -3266,7 +3278,6 @@
 		sprintf(buff, "iop%d", pctrl->unit);
 
 		i2o_proc_remove_entries(generic_iop_entries, pctrl->proc_entry);
-
 		remove_proc_entry(buff, parent);
 		pctrl->proc_entry = NULL;
 	}
@@ -3306,8 +3317,8 @@
 					break;
 				}
 			}
-			remove_proc_entry(dev_id, dev->controller->proc_entry);
 		}
+		remove_proc_entry(dev_id, dev->controller->proc_entry);
 	}
 }
 	
@@ -3329,6 +3340,7 @@
 	i2o_proc_dir_root = proc_mkdir("i2o", 0);
 	if(!i2o_proc_dir_root)
 		return -1;
+	i2o_proc_dir_root->owner = THIS_MODULE;
 
 	for(i = 0; i < MAX_I2O_CONTROLLERS; i++)
 	{
diff -Nru a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
--- a/drivers/message/i2o/i2o_scsi.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/message/i2o/i2o_scsi.c	Tue Jun 15 22:20:43 2004
@@ -62,9 +62,6 @@
 #include "../../scsi/scsi.h"
 #include "../../scsi/hosts.h"
 
-#if BITS_PER_LONG == 64
-#error FIXME: driver does not support 64-bit platforms
-#endif
 
 
 #define VERSION_STRING        "Version 0.1.2"
@@ -233,7 +230,10 @@
 		{
 			spin_unlock_irqrestore(&retry_lock, flags);
 			/* Create a scsi error for this */
-			current_command = (Scsi_Cmnd *)m[3];
+			current_command = (Scsi_Cmnd *)i2o_context_list_get(m[3], c);
+			if(!current_command)
+				return;
+
 			lock = current_command->device->host->host_lock;
 			printk("Aborted %ld\n", current_command->serial_number);
 
@@ -276,16 +276,15 @@
 		printk(KERN_INFO "i2o_scsi: bus reset completed.\n");
 		return;
 	}
-	/*
- 	 *	FIXME: 64bit breakage
-	 */
 
-	current_command = (Scsi_Cmnd *)m[3];
+	current_command = (Scsi_Cmnd *)i2o_context_list_get(m[3], c);
 	
 	/*
 	 *	Is this a control request coming back - eg an abort ?
 	 */
 	 
+	atomic_dec(&queue_depth);
+
 	if(current_command==NULL)
 	{
 		if(st)
@@ -296,8 +295,6 @@
 	
 	dprintk(KERN_INFO "Completed %ld\n", current_command->serial_number);
 	
-	atomic_dec(&queue_depth);
-	
 	if(st == 0x06)
 	{
 		if(le32_to_cpu(m[5]) < current_command->underflow)
@@ -647,9 +644,7 @@
 	if(tid == -1)
 	{
 		SCpnt->result = DID_NO_CONNECT << 16;
-		spin_lock_irqsave(host->host_lock, flags);
 		done(SCpnt);
-		spin_unlock_irqrestore(host->host_lock, flags);
 		return 0;
 	}
 	
@@ -699,8 +694,7 @@
 	
 	i2o_raw_writel(I2O_CMD_SCSI_EXEC<<24|HOST_TID<<12|tid, &msg[1]);
 	i2o_raw_writel(scsi_context, &msg[2]);	/* So the I2O layer passes to us */
-	/* Sorry 64bit folks. FIXME */
-	i2o_raw_writel((u32)SCpnt, &msg[3]);	/* We want the SCSI control block back */
+	i2o_raw_writel(i2o_context_list_add(SCpnt, c), &msg[3]);	/* We want the SCSI control block back */
 
 	/* LSI_920_PCI_QUIRK
 	 *
@@ -883,7 +877,7 @@
  *	@SCpnt: command to abort
  *
  *	Ask the I2O controller to abort a command. This is an asynchrnous
- *	process and oru callback handler will see the command complete
+ *	process and our callback handler will see the command complete
  *	with an aborted message if it succeeds. 
  *
  *	Locks: no locks are held or needed
@@ -894,10 +888,9 @@
 	struct i2o_controller *c;
 	struct Scsi_Host *host;
 	struct i2o_scsi_host *hostdata;
-	unsigned long msg;
-	u32 m;
+	u32 msg[5];
 	int tid;
-	unsigned long timeout;
+	int status = FAILED;
 	
 	printk(KERN_WARNING "i2o_scsi: Aborting command block.\n");
 	
@@ -907,37 +900,22 @@
 	if(tid==-1)
 	{
 		printk(KERN_ERR "i2o_scsi: Impossible command to abort!\n");
-		return FAILED;
+		return status;
 	}
 	c = hostdata->controller;
 
 	spin_unlock_irq(host->host_lock);
 		
-	timeout = jiffies+2*HZ;
-	do
-	{
-		m = le32_to_cpu(I2O_POST_READ32(c));
-		if(m != 0xFFFFFFFF)
-			break;
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(1);
-		mb();
-	}
-	while(time_before(jiffies, timeout));
-	
-	msg = c->mem_offset + m;
-	
-	i2o_raw_writel(FIVE_WORD_MSG_SIZE, msg);
-	i2o_raw_writel(I2O_CMD_SCSI_ABORT<<24|HOST_TID<<12|tid, msg+4);
-	i2o_raw_writel(scsi_context, msg+8);
-	i2o_raw_writel(0, msg+12);	/* Not needed for an abort */
-	i2o_raw_writel((u32)SCpnt, msg+16);	
-	wmb();
-	i2o_post_message(c,m);
-	wmb();
-	
+	msg[0] = FIVE_WORD_MSG_SIZE;
+	msg[1] = I2O_CMD_SCSI_ABORT<<24|HOST_TID<<12|tid;
+	msg[2] = scsi_context;
+	msg[3] = 0;
+	msg[4] = i2o_context_list_remove(SCpnt, c);
+	if(i2o_post_wait(c, msg, sizeof(msg), 240))
+		status = SUCCESS;
+
 	spin_lock_irq(host->host_lock);
-	return SUCCESS;
+	return status;
 }
 
 /**
diff -Nru a/drivers/misc/Kconfig b/drivers/misc/Kconfig
--- a/drivers/misc/Kconfig	Tue Jun 15 22:20:37 2004
+++ b/drivers/misc/Kconfig	Tue Jun 15 22:20:37 2004
@@ -6,7 +6,7 @@
 
 config IBM_ASM
 	tristate "Device driver for IBM RSA service processor"
-	depends on X86
+	depends on X86 && EXPERIMENTAL
 	default n
 	---help---
 	  This option enables device driver support for in-band access to the
@@ -20,6 +20,12 @@
 	  this feature serial driver support (CONFIG_SERIAL_8250) must be
 	  enabled.
 	  
+	  WARNING: This software may not be supported or function
+	  correctly on your IBM server. Please consult the IBM ServerProven
+	  website http://www.pc.ibm/ww/eserver/xseries/serverproven for
+	  information on the specific driver level and support statement
+	  for your IBM server.
+
 
 	  If unsure, say N.
 
diff -Nru a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
--- a/drivers/misc/ibmasm/module.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/misc/ibmasm/module.c	Tue Jun 15 22:20:42 2004
@@ -126,6 +126,13 @@
 
 	ibmasm_register_uart(sp);
 
+	dev_printk(KERN_DEBUG, &pdev->dev, "WARNING: This software may not be supported or function\n");
+	dev_printk(KERN_DEBUG, &pdev->dev, "correctly on your IBM server. Please consult the IBM\n");
+	dev_printk(KERN_DEBUG, &pdev->dev, "ServerProven website\n");
+	dev_printk(KERN_DEBUG, &pdev->dev, "http://www.pc.ibm.com/ww/eserver/xseries/serverproven\n");
+	dev_printk(KERN_DEBUG, &pdev->dev, "for information on the specific driver level and support\n");
+	dev_printk(KERN_DEBUG, &pdev->dev, "statement for your IBM server.\n");
+
 	return 0;
 
 error_send_message:
diff -Nru a/drivers/mtd/chips/amd_flash.c b/drivers/mtd/chips/amd_flash.c
--- a/drivers/mtd/chips/amd_flash.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/mtd/chips/amd_flash.c	Tue Jun 15 22:20:38 2004
@@ -780,8 +780,8 @@
 	map->fldrv_priv = private;
 
 	map->fldrv = &amd_flash_chipdrv;
-	MOD_INC_USE_COUNT;
 
+	__module_get(THIS_MODULE);
 	return mtd;
 }
 
diff -Nru a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
--- a/drivers/mtd/chips/cfi_cmdset_0001.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c	Tue Jun 15 22:20:38 2004
@@ -431,6 +431,7 @@
 		break;
 
 	case FL_READY:
+	case FL_STATUS:
 		/* We should really make set_vpp() count, rather than doing this */
 		DISABLE_VPP(map);
 		break;
diff -Nru a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c
--- a/drivers/mtd/chips/jedec_probe.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/mtd/chips/jedec_probe.c	Tue Jun 15 22:21:05 2004
@@ -16,7 +16,6 @@
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
@@ -109,6 +108,9 @@
 #define M29W160DT	0x22C4
 #define M29W160DB	0x2249
 #define M29W040B	0x00E3
+#define M50FW040	0x002C
+#define M50FW080	0x002D
+#define M50FW016	0x002E
 
 /* SST */
 #define SST29EE512	0x005d
@@ -1233,6 +1235,45 @@
 		.NumEraseRegions= 1,
 		.regions	= {
 			ERASEINFO(0x10000,8),
+		}
+        }, {
+		.mfr_id		= MANUFACTURER_ST,
+		.dev_id		= M50FW040,
+		.name		= "ST M50FW040",
+		.uaddr		= {
+			[0] = MTD_UADDR_UNNECESSARY,    /* x8 */
+		},
+		.DevSize	= SIZE_512KiB,
+		.CmdSet		= P_ID_INTEL_EXT,
+		.NumEraseRegions= 1,
+		.regions	= {
+			ERASEINFO(0x10000,8),
+		}
+        }, {
+		.mfr_id		= MANUFACTURER_ST,
+		.dev_id		= M50FW080,
+		.name		= "ST M50FW080",
+		.uaddr		= {
+			[0] = MTD_UADDR_UNNECESSARY,    /* x8 */
+		},
+		.DevSize	= SIZE_1MiB,
+		.CmdSet		= P_ID_INTEL_EXT,
+		.NumEraseRegions= 1,
+		.regions	= {
+			ERASEINFO(0x10000,16),
+		}
+        }, {
+		.mfr_id		= MANUFACTURER_ST,
+		.dev_id		= M50FW016,
+		.name		= "ST M50FW016",
+		.uaddr		= {
+			[0] = MTD_UADDR_UNNECESSARY,    /* x8 */
+		},
+		.DevSize	= SIZE_2MiB,
+		.CmdSet		= P_ID_INTEL_EXT,
+		.NumEraseRegions= 1,
+		.regions	= {
+			ERASEINFO(0x10000,32),
 		}
 	}, {
 		.mfr_id		= MANUFACTURER_TOSHIBA,
diff -Nru a/drivers/mtd/chips/sharp.c b/drivers/mtd/chips/sharp.c
--- a/drivers/mtd/chips/sharp.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/mtd/chips/sharp.c	Tue Jun 15 22:20:41 2004
@@ -30,6 +30,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/cfi.h>
 #include <linux/delay.h>
+#include <linux/init.h>
 
 #define CMD_RESET		0xffffffff
 #define CMD_READ_ID		0x90909090
@@ -154,7 +155,7 @@
 	map->fldrv = &sharp_chipdrv;
 	map->fldrv_priv = sharp;
 
-	MOD_INC_USE_COUNT;
+	__module_get(THIS_MODULE);
 	return mtd;
 }
 
diff -Nru a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
--- a/drivers/mtd/maps/Kconfig	Tue Jun 15 22:21:04 2004
+++ b/drivers/mtd/maps/Kconfig	Tue Jun 15 22:21:04 2004
@@ -404,6 +404,15 @@
 	  IQ80310 evaluation board. If you have one of these boards and would 
 	  like to use the flash chips on it, say 'Y'.
 
+config MTD_IXP4XX
+	tristate "CFI Flash device mapped on Intel IXP4xx based systems"
+	depends on ARM && MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP4XX
+	help
+	  This eables MTD access to flash devices on platforms based 
+	  on Intel's IXP4xx family of network processors such as the
+	  IXDP425 and Coyote. If you have an IXP4xx based board and
+	  would like to use the flash chips on it, say 'Y'.
+
 config MTD_EPXA10DB
 	tristate "CFI Flash device mapped on Epxa10db"
 	depends on ARM && MTD_CFI && MTD_PARTITIONS && ARCH_CAMELOT
@@ -479,6 +488,14 @@
 	depends on MTD_PARTITIONS && !MMU
 	help
 	  Map driver to support image based filesystems for uClinux.
+
+config MTD_WRSBC8260
+	tristate "Map driver for WindRiver PowerQUICC II MPC82xx board"
+	depends on MTD_PARTITIONS && SBC82xx
+	help
+	  Map driver for WindRiver PowerQUICC II MPC82xx board. Drives
+	  all three flash regions on CS0, CS1 and CS6 if they are configured
+	  correctly by the boot loader.
 
 endmenu
 
diff -Nru a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
--- a/drivers/mtd/maps/Makefile	Tue Jun 15 22:20:35 2004
+++ b/drivers/mtd/maps/Makefile	Tue Jun 15 22:20:35 2004
@@ -55,3 +55,5 @@
 obj-$(CONFIG_MTD_BEECH)		+= beech-mtd.o
 obj-$(CONFIG_MTD_ARCTIC)	+= arctic-mtd.o
 obj-$(CONFIG_MTD_H720X)		+= h720x-flash.o
+obj-$(CONFIG_MTD_IXP4XX)	+= ixp4xx.o
+obj-$(CONFIG_MTD_WRSBC8260)	+= wr_sbc82xx_flash.o
diff -Nru a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/mtd/maps/ixp4xx.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,244 @@
+/*
+ * $Id: ixp4xx.c,v 1.1 2004/05/13 22:21:26 dsaxena Exp $
+ *
+ * drivers/mtd/maps/ixp4xx.c
+ *
+ * MTD Map file for IXP4XX based systems. Please do not make per-board
+ * changes in here. If your board needs special setup, do it in your
+ * platform level code in arch/arm/mach-ixp4xx/board-setup.c
+ *
+ * Original Author: Intel Corporation
+ * Maintainer: Deepak Saxena <dsaxena@mvista.com>
+ *
+ * Copyright (C) 2002 Intel Corporation
+ * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+#include <linux/ioport.h>
+#include <linux/device.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
+#include <asm/mach/flash.h>
+
+#include <linux/reboot.h>
+
+#ifndef __ARMEB__
+#define	BYTE0(h)	((h) & 0xFF)
+#define	BYTE1(h)	(((h) >> 8) & 0xFF)
+#else
+#define	BYTE0(h)	(((h) >> 8) & 0xFF)
+#define	BYTE1(h)	((h) & 0xFF)
+#endif
+
+static __u16
+ixp4xx_read16(struct map_info *map, unsigned long ofs)
+{
+	return *(__u16 *) (map->map_priv_1 + ofs);
+}
+
+/*
+ * The IXP4xx expansion bus only allows 16-bit wide acceses
+ * when attached to a 16-bit wide device (such as the 28F128J3A),
+ * so we can't just memcpy_fromio().
+ */
+static void
+ixp4xx_copy_from(struct map_info *map, void *to,
+		 unsigned long from, ssize_t len)
+{
+	int i;
+	u8 *dest = (u8 *) to;
+	u16 *src = (u16 *) (map->map_priv_1 + from);
+	u16 data;
+
+	for (i = 0; i < (len / 2); i++) {
+		data = src[i];
+		dest[i * 2] = BYTE0(data);
+		dest[i * 2 + 1] = BYTE1(data);
+	}
+
+	if (len & 1)
+		dest[len - 1] = BYTE0(src[i]);
+}
+
+static void
+ixp4xx_write16(struct map_info *map, __u16 d, unsigned long adr)
+{
+	*(__u16 *) (map->map_priv_1 + adr) = d;
+}
+
+struct ixp4xx_flash_info {
+	struct mtd_info *mtd;
+	struct map_info map;
+	struct mtd_partition *partitions;
+	struct resource *res;
+};
+
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+
+static int
+ixp4xx_flash_remove(struct device *_dev)
+{
+	struct platform_device *dev = to_platform_device(_dev);
+	struct flash_platform_data *plat = dev->dev.platform_data;
+	struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
+
+	dev_set_drvdata(&dev->dev, NULL);
+
+	if(!info)
+		return 0;
+
+	/*
+	 * This is required for a soft reboot to work.
+	 */
+	ixp4xx_write16(&info->map, 0xff, 0x55 * 0x2);
+
+	if (info->mtd) {
+		del_mtd_partitions(info->mtd);
+		map_destroy(info->mtd);
+	}
+	if (info->map.map_priv_1)
+		iounmap((void *) info->map.map_priv_1);
+
+	if (info->partitions)
+		kfree(info->partitions);
+
+	if (info->res) {
+		release_resource(info->res);
+		kfree(info->res);
+	}
+
+	if (plat->exit)
+		plat->exit();
+
+	/* Disable flash write */
+	*IXP4XX_EXP_CS0 &= ~IXP4XX_FLASH_WRITABLE;
+
+	return 0;
+}
+
+static int ixp4xx_flash_probe(struct device *_dev)
+{
+	struct platform_device *dev = to_platform_device(_dev);
+	struct flash_platform_data *plat = dev->dev.platform_data;
+	struct ixp4xx_flash_info *info;
+	int err = -1;
+
+	if (!plat)
+		return -ENODEV;
+
+	if (plat->init) {
+		err = plat->init();
+		if (err)
+			return err;
+	}
+
+	info = kmalloc(sizeof(struct ixp4xx_flash_info), GFP_KERNEL);
+	if(!info) {
+		err = -ENOMEM;
+		goto Error;
+	}	
+	memzero(info, sizeof(struct ixp4xx_flash_info));
+
+	dev_set_drvdata(&dev->dev, info);
+
+	/* 
+	 * Enable flash write 
+	 * TODO: Move this out to board specific code
+	 */
+	*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
+
+	/*
+	 * Tell the MTD layer we're not 1:1 mapped so that it does
+	 * not attempt to do a direct access on us.
+	 */
+	info->map.phys = NO_XIP;
+	info->map.size = dev->resource->end - dev->resource->start + 1;
+
+	/*
+	 * We only support 16-bit accesses for now. If and when
+	 * any board use 8-bit access, we'll fixup the driver to
+	 * handle that.
+	 */
+	info->map.buswidth = 2;
+	info->map.name = dev->dev.bus_id;
+	info->map.read16 = ixp4xx_read16,
+	info->map.write16 = ixp4xx_write16,
+	info->map.copy_from = ixp4xx_copy_from,
+
+	info->res = request_mem_region(dev->resource->start, 
+			dev->resource->end - dev->resource->start + 1, 
+			"IXP4XXFlash");
+	if (!info->res) {
+		printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
+		err = -ENOMEM;
+		goto Error;
+	}
+
+	info->map.map_priv_1 =
+	    (unsigned long) ioremap(dev->resource->start, 
+				    dev->resource->end - dev->resource->start + 1);
+	if (!info->map.map_priv_1) {
+		printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
+		err = -EIO;
+		goto Error;
+	}
+
+	info->mtd = do_map_probe(plat->map_name, &info->map);
+	if (!info->mtd) {
+		printk(KERN_ERR "IXP4XXFlash: map_probe failed\n");
+		err = -ENXIO;
+		goto Error;
+	}
+	info->mtd->owner = THIS_MODULE;
+
+	err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0);
+	if (err > 0) {
+		err = add_mtd_partitions(info->mtd, info->partitions, err);
+		if(err)
+			printk(KERN_ERR "Could not parse partitions\n");
+	}
+
+	if (err)
+		goto Error;
+
+	return 0;
+
+Error:
+	ixp4xx_flash_remove(_dev);
+	return err;
+}
+
+static struct device_driver ixp4xx_flash_driver = {
+	.name		= "IXP4XX-Flash",
+	.bus		= &platform_bus_type,
+	.probe		= ixp4xx_flash_probe,
+	.remove		= ixp4xx_flash_remove,
+};
+
+static int __init ixp4xx_flash_init(void)
+{
+	return driver_register(&ixp4xx_flash_driver);
+}
+
+static void __exit ixp4xx_flash_exit(void)
+{
+	driver_unregister(&ixp4xx_flash_driver);
+}
+
+
+module_init(ixp4xx_flash_init);
+module_exit(ixp4xx_flash_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems")
+MODULE_AUTHOR("Deepak Saxena");
+
diff -Nru a/drivers/mtd/maps/lubbock-flash.c b/drivers/mtd/maps/lubbock-flash.c
--- a/drivers/mtd/maps/lubbock-flash.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/mtd/maps/lubbock-flash.c	Tue Jun 15 22:20:42 2004
@@ -15,11 +15,12 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
+#include <asm/io.h>
 #include <asm/hardware.h>
+#include <asm/arch/lubbock.h>
 
 
 #define ROM_ADDR	0x00000000
diff -Nru a/drivers/mtd/maps/tqm8xxl.c b/drivers/mtd/maps/tqm8xxl.c
--- a/drivers/mtd/maps/tqm8xxl.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/mtd/maps/tqm8xxl.c	Tue Jun 15 22:20:37 2004
@@ -105,7 +105,7 @@
 	  .name = "jffs",
 	  .offset = 0x00200000,
 	  .size = 0x00200000,
-	  .//size = MTDPART_SIZ_FULL,
+	  //.size = MTDPART_SIZ_FULL,
 	}
 };
 #endif
diff -Nru a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
--- a/drivers/mtd/maps/uclinux.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/mtd/maps/uclinux.c	Tue Jun 15 22:21:02 2004
@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/major.h>
+#include <linux/root_dev.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
diff -Nru a/drivers/mtd/maps/wr_sbc82xx_flash.c b/drivers/mtd/maps/wr_sbc82xx_flash.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/mtd/maps/wr_sbc82xx_flash.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,167 @@
+/*
+ * $Id: wr_sbc82xx_flash.c,v 1.1 2004/06/07 10:21:32 dwmw2 Exp $
+ *
+ * Map for flash chips on Wind River PowerQUICC II SBC82xx board.
+ *
+ * Copyright (C) 2004 Red Hat, Inc.
+ *
+ * Author: David Woodhouse <dwmw2@infradead.org>
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <asm/io.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/config.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/immap_8260.h>
+
+static struct mtd_info *sbcmtd[3];
+static struct mtd_partition *sbcmtd_parts[3];
+
+struct map_info sbc82xx_flash_map[3] = {
+	{.name = "Boot flash"},
+	{.name = "Alternate boot flash"},
+	{.name = "User flash"}
+};
+
+static struct mtd_partition smallflash_parts[] = {
+	{
+		.name =		"space",
+		.size =		0x100000,
+		.offset =	0,
+	}, {
+		.name =		"bootloader",
+		.size =		MTDPART_SIZ_FULL,
+		.offset =	MTDPART_OFS_APPEND,
+	}
+};
+
+static struct mtd_partition bigflash_parts[] = {
+	{
+		.name =		"bootloader",
+		.size =		0x80000,
+		.offset =	0,
+	}, {
+		.name =		"file system",
+		.size =		MTDPART_SIZ_FULL,
+		.offset =	MTDPART_OFS_APPEND,
+	}
+};
+
+static const char *part_probes[] __initdata = {"cmdlinepart", "RedBoot", NULL};
+
+int __init init_sbc82xx_flash(void)
+{
+	volatile  memctl8260_t *mc = &immr->im_memctl;
+	int bigflash;
+	int i;
+
+	/* First, register the boot flash, whichever we're booting from */
+	if ((mc->memc_br0 & 0x00001800) == 0x00001800) {
+		bigflash = 0;
+	} else if ((mc->memc_br0 & 0x00001800) == 0x00000800) {
+		bigflash = 1;
+	} else {
+		printk(KERN_WARNING "Bus Controller register BR0 is %08x. Cannot determine flash configuration\n", mc->memc_br0);
+		return 1;
+	}
+
+	/* Set parameters for the big flash chip (CS6 or CS0) */
+	sbc82xx_flash_map[bigflash].buswidth = 4;
+	sbc82xx_flash_map[bigflash].size = 0x4000000;
+
+	/* Set parameters for the small flash chip (CS0 or CS6) */
+	sbc82xx_flash_map[!bigflash].buswidth = 1;
+	sbc82xx_flash_map[!bigflash].size = 0x200000;
+
+	/* Set parameters for the user flash chip (CS1) */
+	sbc82xx_flash_map[2].buswidth = 4;
+	sbc82xx_flash_map[2].size = 0x4000000;
+
+	sbc82xx_flash_map[0].phys = mc->memc_br0 & 0xffff8000;
+	sbc82xx_flash_map[1].phys = mc->memc_br6 & 0xffff8000;
+	sbc82xx_flash_map[2].phys = mc->memc_br1 & 0xffff8000;
+
+	for (i=0; i<3; i++) {
+		int8_t flashcs[3] = { 0, 6, 1 };
+		int nr_parts;
+
+		printk(KERN_NOTICE "PowerQUICC II %s (%ld MiB on CS%d",
+		       sbc82xx_flash_map[i].name, sbc82xx_flash_map[i].size >> 20, flashcs[i]);
+		if (!sbc82xx_flash_map[i].phys) {
+			/* We know it can't be at zero. */
+			printk("): disabled by bootloader.\n");
+			continue;
+		}
+		printk(" at %08lx)\n",  sbc82xx_flash_map[i].phys);
+
+		sbc82xx_flash_map[i].virt = (unsigned long)ioremap(sbc82xx_flash_map[i].phys, sbc82xx_flash_map[i].size);
+
+		if (!sbc82xx_flash_map[i].virt) {
+			printk("Failed to ioremap\n");
+			continue;
+		}
+
+		simple_map_init(&sbc82xx_flash_map[i]);
+
+		sbcmtd[i] = do_map_probe("cfi_probe", &sbc82xx_flash_map[i]);
+
+		if (!sbcmtd[i])
+			continue;
+
+		sbcmtd[i]->owner = THIS_MODULE;
+
+		nr_parts = parse_mtd_partitions(sbcmtd[i], part_probes,
+						&sbcmtd_parts[i], 0);
+		if (nr_parts > 0) {
+			add_mtd_partitions (sbcmtd[i], sbcmtd_parts[i], nr_parts);
+			continue;
+		}
+
+		/* No partitioning detected. Use default */
+		if (i == 2) {
+			add_mtd_device(sbcmtd[i]);
+		} else if (i == bigflash) {
+			add_mtd_partitions (sbcmtd[i], bigflash_parts, ARRAY_SIZE(bigflash_parts));
+		} else {
+			add_mtd_partitions (sbcmtd[i], smallflash_parts, ARRAY_SIZE(smallflash_parts));
+		}
+	}
+	return 0;
+}
+
+static void __exit cleanup_sbc82xx_flash(void)
+{
+	int i;
+
+	for (i=0; i<3; i++) {
+		if (!sbcmtd[i])
+			continue;
+
+		if (i<2 || sbcmtd_parts[i])
+			del_mtd_partitions(sbcmtd[i]);
+		else
+			del_mtd_device(sbcmtd[i]);
+			
+		kfree(sbcmtd_parts[i]);
+		map_destroy(sbcmtd[i]);
+		
+		iounmap((void *)sbc82xx_flash_map[i].virt);
+		sbc82xx_flash_map[i].virt = 0;
+	}
+}
+
+module_init(init_sbc82xx_flash);
+module_exit(cleanup_sbc82xx_flash);
+
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
+MODULE_DESCRIPTION("Flash map driver for WindRiver PowerQUICC II");
diff -Nru a/drivers/net/3c509.c b/drivers/net/3c509.c
--- a/drivers/net/3c509.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/3c509.c	Tue Jun 15 22:20:36 2004
@@ -1315,7 +1315,7 @@
  */
 
 static int
-netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
+netdev_ethtool_ioctl (struct net_device *dev, void __user *useraddr)
 {
 	u32 ethcmd;
 	struct el3_private *lp = netdev_priv(dev);
@@ -1323,7 +1323,7 @@
 	/* dev_ioctl() in ../../net/core/dev.c has already checked
 	   capable(CAP_NET_ADMIN), so don't bother with that here.  */
 
-	if (get_user(ethcmd, (u32 *)useraddr))
+	if (get_user(ethcmd, (u32 __user *)useraddr))
 		return -EFAULT;
 
 	switch (ethcmd) {
@@ -1412,7 +1412,7 @@
 
 	switch (cmd) {
 	case SIOCETHTOOL:
-		rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		rc = netdev_ethtool_ioctl(dev, rq->ifr_data);
 		break;
 
 	default:
diff -Nru a/drivers/net/3c527.c b/drivers/net/3c527.c
--- a/drivers/net/3c527.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/3c527.c	Tue Jun 15 22:20:41 2004
@@ -287,6 +287,7 @@
 			
 		}
 	}
+	free_netdev(dev);
 	return ERR_PTR(-ENODEV);
 }
 
diff -Nru a/drivers/net/3c59x.c b/drivers/net/3c59x.c
--- a/drivers/net/3c59x.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/net/3c59x.c	Tue Jun 15 22:20:35 2004
@@ -2873,7 +2873,7 @@
 {
 	struct vortex_private *vp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 	int phy = vp->phys[0] & 0x1f;
 	int retval;
 
diff -Nru a/drivers/net/8139cp.c b/drivers/net/8139cp.c
--- a/drivers/net/8139cp.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/8139cp.c	Tue Jun 15 22:20:40 2004
@@ -1546,7 +1546,6 @@
 static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct cp_private *cp = netdev_priv(dev);
-	struct mii_ioctl_data *mii = (struct mii_ioctl_data *) &rq->ifr_data;
 	int rc;
 	unsigned long flags;
 
@@ -1554,7 +1553,7 @@
 		return -EINVAL;
 
 	spin_lock_irqsave(&cp->lock, flags);
-	rc = generic_mii_ioctl(&cp->mii_if, mii, cmd, NULL);
+	rc = generic_mii_ioctl(&cp->mii_if, if_mii(rq), cmd, NULL);
 	spin_unlock_irqrestore(&cp->lock, flags);
 	return rc;
 }
diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
--- a/drivers/net/8139too.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/net/8139too.c	Tue Jun 15 22:20:35 2004
@@ -171,7 +171,11 @@
  * Receive ring size 
  * Warning: 64K ring has hardware issues and may lock up.
  */
+#if defined(CONFIG_SH_DREAMCAST)
+#define RX_BUF_IDX	1	/* 16K ring */
+#else
 #define RX_BUF_IDX	2	/* 32K ring */
+#endif
 #define RX_BUF_LEN	(8192 << RX_BUF_IDX)
 #define RX_BUF_PAD	16
 #define RX_BUF_WRAP_PAD 2048 /* spare padding to handle lack of packet wrap */
@@ -1677,11 +1681,17 @@
 	u8 tmp8;
 	unsigned long flags;
 
-	DPRINTK ("%s: Transmit timeout, status %2.2x %4.4x "
-		 "media %2.2x.\n", dev->name,
-		 RTL_R8 (ChipCmd),
-		 RTL_R16 (IntrStatus),
-		 RTL_R8 (MediaStatus));
+	printk (KERN_DEBUG "%s: Transmit timeout, status %2.2x %4.4x %4.4x "
+		"media %2.2x.\n", dev->name, RTL_R8 (ChipCmd),
+		RTL_R16(IntrStatus), RTL_R16(IntrMask), RTL_R8(MediaStatus));
+	/* Emit info to figure out what went wrong. */
+	printk (KERN_DEBUG "%s: Tx queue start entry %ld  dirty entry %ld.\n",
+		dev->name, tp->cur_tx, tp->dirty_tx);
+	for (i = 0; i < NUM_TX_DESC; i++)
+		printk (KERN_DEBUG "%s:  Tx descriptor %d is %8.8lx.%s\n",
+			dev->name, i, RTL_R32 (TxStatus0 + (i * 4)),
+			i == tp->dirty_tx % NUM_TX_DESC ?
+				" (queue head)" : "");
 
 	tp->xstats.tx_timeouts++;
 
@@ -1694,15 +1704,6 @@
 	/* Disable interrupts by clearing the interrupt mask. */
 	RTL_W16 (IntrMask, 0x0000);
 
-	/* Emit info to figure out what went wrong. */
-	printk (KERN_DEBUG "%s: Tx queue start entry %ld  dirty entry %ld.\n",
-		dev->name, tp->cur_tx, tp->dirty_tx);
-	for (i = 0; i < NUM_TX_DESC; i++)
-		printk (KERN_DEBUG "%s:  Tx descriptor %d is %8.8lx.%s\n",
-			dev->name, i, RTL_R32 (TxStatus0 + (i * 4)),
-			i == tp->dirty_tx % NUM_TX_DESC ?
-				" (queue head)" : "");
-
 	/* Stop a shared interrupt from scavenging while we are. */
 	spin_lock_irqsave (&tp->lock, flags);
 	rtl8139_tx_clear (tp);
@@ -1714,7 +1715,6 @@
 		netif_wake_queue (dev);
 	}
 	spin_unlock(&tp->rx_lock);
-	
 }
 
 
@@ -2458,14 +2458,13 @@
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct rtl8139_private *np = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
 	int rc;
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
 	spin_lock_irq(&np->lock);
-	rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
+	rc = generic_mii_ioctl(&np->mii, if_mii(rq), cmd, NULL);
 	spin_unlock_irq(&np->lock);
 
 	return rc;
@@ -2558,6 +2557,8 @@
 	void *ioaddr = tp->mmio_addr;
 	unsigned long flags;
 
+	pci_save_state (pdev, tp->pci_state);
+
 	if (!netif_running (dev))
 		return 0;
 
@@ -2576,7 +2577,6 @@
 	spin_unlock_irqrestore (&tp->lock, flags);
 
 	pci_set_power_state (pdev, 3);
-	pci_save_state (pdev, tp->pci_state);
 
 	return 0;
 }
@@ -2587,9 +2587,9 @@
 	struct net_device *dev = pci_get_drvdata (pdev);
 	struct rtl8139_private *tp = dev->priv;
 
+	pci_restore_state (pdev, tp->pci_state);
 	if (!netif_running (dev))
 		return 0;
-	pci_restore_state (pdev, tp->pci_state);
 	pci_set_power_state (pdev, 0);
 	rtl8139_init_ring (dev);
 	rtl8139_hw_start (dev);
diff -Nru a/drivers/net/8390.h b/drivers/net/8390.h
--- a/drivers/net/8390.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/8390.h	Tue Jun 15 22:20:42 2004
@@ -143,7 +143,7 @@
 #define inb_p(_p)	inb(_p)
 #define outb_p(_v,_p)	outb(_v,_p)
 
-#elif defined(CONFIG_NET_CBUS)
+#elif defined(CONFIG_NET_CBUS) || defined(CONFIG_NE_H8300) || defined(CONFIG_NE_H8300_MODULE)
 #define EI_SHIFT(x)	(ei_local->reg_offset[x])
 #else
 #define EI_SHIFT(x)	(x)
diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig
--- a/drivers/net/Kconfig	Tue Jun 15 22:20:44 2004
+++ b/drivers/net/Kconfig	Tue Jun 15 22:20:44 2004
@@ -1210,6 +1210,39 @@
 	  <file:Documentation/networking/net-modules.txt>. The module will
 	  be called ibmveth.
 
+config IBM_EMAC
+       tristate "IBM PPC4xx EMAC driver support"
+       depends on 4xx
+       ---help---
+       This driver supports the IBM PPC4xx EMAC family of on-chip
+       Ethernet controllers.
+
+config IBM_EMAC_ERRMSG
+       bool "Verbose error messages"
+       depends on IBM_EMAC
+
+config IBM_EMAC_RXB
+       int "Number of receive buffers"
+       depends on IBM_EMAC
+       default "128" if IBM_EMAC4
+       default "64"
+
+config IBM_EMAC_TXB
+       int "Number of transmit buffers"
+       depends on IBM_EMAC
+       default "128" if IBM_EMAC4
+       default "8"
+
+config IBM_EMAC_FGAP
+       int "Frame gap"
+       depends on IBM_EMAC
+       default "8"
+
+config IBM_EMAC_SKBRES
+       int "Skb reserve amount"
+       depends on IBM_EMAC
+       default "0"
+
 config NET_PCI
 	bool "EISA, VLB, PCI and on board controllers"
 	depends on NET_ETHERNET && (ISA || EISA || PCI)
@@ -1828,6 +1861,13 @@
 	  Say Y here if you want to use the built-in 10/100 Fast ethernet
 	  controller on the Motorola ColdFire 5272 processor.
 
+config NE_H8300
+	tristate "NE2000 compatible support for H8/300"
+	depends on H8300 && NET_ETHERNET
+	help
+	  Say Y here if you want to use the NE2000 compatible
+	  controller on the Renesas H8/300 processor.
+
 endmenu
 
 #
@@ -2479,16 +2519,6 @@
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called iph5526.
-
-config RCPCI
-	tristate "Red Creek Hardware VPN (EXPERIMENTAL)"
-	depends on NETDEVICES && EXPERIMENTAL && PCI && !64BIT
-	help
-	  This is a driver for hardware which provides a Virtual Private
-	  Network (VPN). Say Y if you have it.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called rcpci.
 
 config SHAPER
 	tristate "Traffic Shaper (EXPERIMENTAL)"
diff -Nru a/drivers/net/Makefile b/drivers/net/Makefile
--- a/drivers/net/Makefile	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/Makefile	Tue Jun 15 22:20:38 2004
@@ -2,13 +2,12 @@
 # Makefile for the Linux network (ethercard) device drivers.
 #
 
-rcpci-objs	:=	rcpci45.o rclanmtl.o
-
 ifeq ($(CONFIG_ISDN_PPP),y)
   obj-$(CONFIG_ISDN) += slhc.o
 endif
 
 obj-$(CONFIG_E1000) += e1000/
+obj-$(CONFIG_IBM_EMAC) += ibm_emac/
 obj-$(CONFIG_IXGB) += ixgb/
 obj-$(CONFIG_BONDING) += bonding/
 
@@ -32,7 +31,6 @@
 obj-$(CONFIG_OAKNET) += oaknet.o 8390.o
 
 obj-$(CONFIG_DGRS) += dgrs.o
-obj-$(CONFIG_RCPCI) += rcpci.o
 obj-$(CONFIG_VORTEX) += 3c59x.o
 obj-$(CONFIG_TYPHOON) += typhoon.o
 obj-$(CONFIG_NE2K_PCI) += ne2k-pci.o 8390.o
@@ -95,6 +93,7 @@
 obj-$(CONFIG_NET_SB1250_MAC) += sb1250-mac.o
 obj-$(CONFIG_B44) += b44.o
 obj-$(CONFIG_FORCEDETH) += forcedeth.o
+obj-$(CONFIG_NE_H8300) += ne-h8300.o 8390.o
 
 obj-$(CONFIG_PPP) += ppp_generic.o slhc.o
 obj-$(CONFIG_PPP_ASYNC) += ppp_async.o
diff -Nru a/drivers/net/Space.c b/drivers/net/Space.c
--- a/drivers/net/Space.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/Space.c	Tue Jun 15 22:20:37 2004
@@ -191,7 +191,8 @@
 #ifdef CONFIG_E2100		/* Cabletron E21xx series. */
 	{e2100_probe, 0},
 #endif
-#if defined(CONFIG_NE2000) || defined(CONFIG_NE2K_CBUS)	/* ISA & PC-9800 CBUS (use ne2k-pci for PCI cards) */
+#if defined(CONFIG_NE2000) || defined(CONFIG_NE2K_CBUS)	|| \
+    defined(CONFIG_NE_H8300)  /* ISA & PC-9800 CBUS (use ne2k-pci for PCI cards) */
 	{ne_probe, 0},
 #endif
 #ifdef CONFIG_LANCE		/* ISA/VLB (use pcnet32 for PCI cards) */
diff -Nru a/drivers/net/acenic.c b/drivers/net/acenic.c
--- a/drivers/net/acenic.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/acenic.c	Tue Jun 15 22:20:40 2004
@@ -131,7 +131,6 @@
 #define PCI_DEVICE_ID_SGI_ACENIC	0x0009
 #endif
 
-#if LINUX_VERSION_CODE >= 0x20400
 static struct pci_device_id acenic_pci_tbl[] = {
 	{ PCI_VENDOR_ID_ALTEON, PCI_DEVICE_ID_ALTEON_ACENIC_FIBRE,
 	  PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_ETHERNET << 8, 0xffff00, },
@@ -156,37 +155,6 @@
 	{ }
 };
 MODULE_DEVICE_TABLE(pci, acenic_pci_tbl);
-#endif
-
-
-#ifndef MODULE_LICENSE
-#define MODULE_LICENSE(a)
-#endif
-
-#ifndef wmb
-#define wmb()	mb()
-#endif
-
-#ifndef __exit
-#define __exit
-#endif
-
-#ifndef __devinit
-#define __devinit	__init
-#endif
-
-#ifndef SMP_CACHE_BYTES
-#define SMP_CACHE_BYTES	L1_CACHE_BYTES
-#endif
-
-#ifndef SET_MODULE_OWNER
-#define SET_MODULE_OWNER(dev)		do{} while(0)
-#define ACE_MOD_INC_USE_COUNT		MOD_INC_USE_COUNT
-#define ACE_MOD_DEC_USE_COUNT		MOD_DEC_USE_COUNT
-#else
-#define ACE_MOD_INC_USE_COUNT		do{} while(0)
-#define ACE_MOD_DEC_USE_COUNT		do{} while(0)
-#endif
 
 #ifndef SET_NETDEV_DEV
 #define SET_NETDEV_DEV(net, pdev)	do{} while(0)
@@ -198,151 +166,8 @@
 #define ace_sync_irq(irq)	synchronize_irq()
 #endif
 
-#if LINUX_VERSION_CODE < 0x2051e
-#define local_irq_save(flags)		do{__save_flags(flags) ; \
-					   __cli();} while(0)
-#define local_irq_restore(flags)	__restore_flags(flags)
-#endif
-
-#if (LINUX_VERSION_CODE < 0x02030d)
-#define pci_resource_start(dev, bar)	dev->base_address[bar]
-#elif (LINUX_VERSION_CODE < 0x02032c)
-#define pci_resource_start(dev, bar)	dev->resource[bar].start
-#endif
-
-#if (LINUX_VERSION_CODE < 0x02030e)
-#define net_device device
-#endif
-
-
-#if (LINUX_VERSION_CODE < 0x02032a)
-typedef u32 dma_addr_t;
-
-static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
-					 dma_addr_t *dma_handle)
-{
-	void *virt_ptr;
-
-	virt_ptr = kmalloc(size, GFP_KERNEL);
-	if (!virt_ptr)
-		return NULL;
-	*dma_handle = virt_to_bus(virt_ptr);
-	return virt_ptr;
-}
-
-#define pci_free_consistent(cookie, size, ptr, dma_ptr)	kfree(ptr)
-#define pci_map_page(cookie, page, off, size, dir)	\
-	virt_to_bus(page_address(page)+(off))
-#define pci_unmap_page(cookie, address, size, dir)
-#define pci_set_dma_mask(dev, mask)		\
-	(((u64)(mask) & 0xffffffff00000000) == 0 ? 0 : -EIO)
-#define pci_dma_supported(dev, mask)		\
-	(((u64)(mask) & 0xffffffff00000000) == 0 ? 1 : 0)
-
-#elif (LINUX_VERSION_CODE < 0x02040d)
-
-/*
- * 2.4.13 introduced pci_map_page()/pci_unmap_page() - for 2.4.12 and prior,
- * fall back on pci_map_single()/pci_unnmap_single().
- *
- * We are guaranteed that the page is mapped at this point since
- * pci_map_page() is only used upon valid struct skb's.
- */
-static inline dma_addr_t
-pci_map_page(struct pci_dev *cookie, struct page *page, unsigned long off,
-	     size_t size, int dir)
-{
-	void *page_virt;
-
-	page_virt = page_address(page);
-	if (!page_virt)
-		BUG();
-	return pci_map_single(cookie, (page_virt + off), size, dir);
-}
-#define pci_unmap_page(cookie, dma_addr, size, dir)	\
-	pci_unmap_single(cookie, dma_addr, size, dir)
-#endif
-
-#if (LINUX_VERSION_CODE < 0x020412)
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME)		0
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL)	do{} while(0)
-#define pci_unmap_len(PTR, LEN_NAME)		0
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL)	do{} while(0)
-#endif
-
-
-#if (LINUX_VERSION_CODE < 0x02032b)
-/*
- * SoftNet
- *
- * For pre-softnet kernels we need to tell the upper layer not to
- * re-enter start_xmit() while we are in there. However softnet
- * guarantees not to enter while we are in there so there is no need
- * to do the netif_stop_queue() dance unless the transmit queue really
- * gets stuck. This should also improve performance according to tests
- * done by Aman Singla.
- */
-#define dev_kfree_skb_irq(a)			dev_kfree_skb(a)
-#define netif_wake_queue(dev)			clear_bit(0, &dev->tbusy)
-#define netif_stop_queue(dev)			set_bit(0, &dev->tbusy)
-#define late_stop_netif_stop_queue(dev)		do{} while(0)
-#define early_stop_netif_stop_queue(dev)	test_and_set_bit(0,&dev->tbusy)
-#define early_stop_netif_wake_queue(dev)	netif_wake_queue(dev)
-
-static inline void netif_start_queue(struct net_device *dev)
-{
-	dev->tbusy = 0;
-	dev->interrupt = 0;
-	dev->start = 1;
-}
-
-#define ace_mark_net_bh()			mark_bh(NET_BH)
-#define netif_queue_stopped(dev)		dev->tbusy
-#define netif_running(dev)			dev->start
-#define ace_if_down(dev)			do{dev->start = 0;} while(0)
-
-#define tasklet_struct				tq_struct
-static inline void tasklet_schedule(struct tasklet_struct *tasklet)
-{
-	queue_task(tasklet, &tq_immediate);
-	mark_bh(IMMEDIATE_BH);
-}
-
-static inline void tasklet_init(struct tasklet_struct *tasklet,
-				void (*func)(unsigned long),
-				unsigned long data)
-{
-	tasklet->next = NULL;
-	tasklet->sync = 0;
-	tasklet->routine = (void (*)(void *))func;
-	tasklet->data = (void *)data;
-}
-#define tasklet_kill(tasklet)			do{} while(0)
-#else
-#define late_stop_netif_stop_queue(dev)		netif_stop_queue(dev)
-#define early_stop_netif_stop_queue(dev)	0
-#define early_stop_netif_wake_queue(dev)	do{} while(0)
-#define ace_mark_net_bh()			do{} while(0)
-#define ace_if_down(dev)			do{} while(0)
-#endif
-
-#if (LINUX_VERSION_CODE >= 0x02031b)
-#define NEW_NETINIT
-#define ACE_PROBE_ARG				void
-#else
-#define ACE_PROBE_ARG				struct net_device *dev
-#endif
-
-#ifndef min_t
-#define min_t(type,a,b)	(((a)<(b))?(a):(b))
-#endif
-
-#ifndef ARCH_HAS_PREFETCHW
-#ifndef prefetchw
-#define prefetchw(x)				do{} while(0)
-#endif
+#ifndef offset_in_page
+#define offset_in_page(ptr)	((unsigned long)(ptr) & ~PAGE_MASK)
 #endif
 
 #define ACE_MAX_MOD_PARMS	8
@@ -595,407 +420,323 @@
 static int tx_ratio[ACE_MAX_MOD_PARMS];
 static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1};
 
+MODULE_AUTHOR("Jes Sorensen <jes@trained-monkey.org>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver");
+MODULE_PARM(link, "1-" __MODULE_STRING(8) "i");
+MODULE_PARM(trace, "1-" __MODULE_STRING(8) "i");
+MODULE_PARM(tx_coal_tick, "1-" __MODULE_STRING(8) "i");
+MODULE_PARM(max_tx_desc, "1-" __MODULE_STRING(8) "i");
+MODULE_PARM(rx_coal_tick, "1-" __MODULE_STRING(8) "i");
+MODULE_PARM(max_rx_desc, "1-" __MODULE_STRING(8) "i");
+MODULE_PARM(tx_ratio, "1-" __MODULE_STRING(8) "i");
+MODULE_PARM_DESC(link, "AceNIC/3C985/NetGear link state");
+MODULE_PARM_DESC(trace, "AceNIC/3C985/NetGear firmware trace level");
+MODULE_PARM_DESC(tx_coal_tick, "AceNIC/3C985/GA620 max clock ticks to wait from first tx descriptor arrives");
+MODULE_PARM_DESC(max_tx_desc, "AceNIC/3C985/GA620 max number of transmit descriptors to wait");
+MODULE_PARM_DESC(rx_coal_tick, "AceNIC/3C985/GA620 max clock ticks to wait from first rx descriptor arrives");
+MODULE_PARM_DESC(max_rx_desc, "AceNIC/3C985/GA620 max number of receive descriptors to wait");
+MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)");
+
+
 static char version[] __initdata = 
   "acenic.c: v0.92 08/05/2002  Jes Sorensen, linux-acenic@SunSITE.dk\n"
   "                            http://home.cern.ch/~jes/gige/acenic.html\n";
 
-static struct net_device *root_dev;
-
-static int probed __initdata = 0;
-
-
-int __devinit acenic_probe (ACE_PROBE_ARG)
+static int __devinit acenic_probe_one(struct pci_dev *pdev,
+		const struct pci_device_id *id)
 {
-#ifdef NEW_NETINIT
 	struct net_device *dev;
-#endif
 	struct ace_private *ap;
-	struct pci_dev *pdev = NULL;
-	int boards_found = 0;
-	int version_disp;
-
-	if (probed)
-		return -ENODEV;
-	probed++;
-
-	version_disp = 0;
-
-	while ((pdev = pci_find_class(PCI_CLASS_NETWORK_ETHERNET<<8, pdev))) {
-
-		if (!((pdev->vendor == PCI_VENDOR_ID_ALTEON) &&
-		      ((pdev->device == PCI_DEVICE_ID_ALTEON_ACENIC_FIBRE) ||
-		       (pdev->device == PCI_DEVICE_ID_ALTEON_ACENIC_COPPER)))&&
-		    !((pdev->vendor == PCI_VENDOR_ID_3COM) &&
-		      (pdev->device == PCI_DEVICE_ID_3COM_3C985)) &&
-		    !((pdev->vendor == PCI_VENDOR_ID_NETGEAR) &&
-		      ((pdev->device == PCI_DEVICE_ID_NETGEAR_GA620) || 
-		       (pdev->device == PCI_DEVICE_ID_NETGEAR_GA620T))) &&
-		/*
-		 * Farallon used the DEC vendor ID on their cards by
-		 * mistake for a while
-		 */
-		    !((pdev->vendor == PCI_VENDOR_ID_DEC) &&
-		      (pdev->device == PCI_DEVICE_ID_FARALLON_PN9000SX)) &&
-		    !((pdev->vendor == PCI_VENDOR_ID_ALTEON) &&
-		      (pdev->device == PCI_DEVICE_ID_FARALLON_PN9100T)) &&
-		    !((pdev->vendor == PCI_VENDOR_ID_SGI) &&
-		      (pdev->device == PCI_DEVICE_ID_SGI_ACENIC)))
-			continue;
-
-		dev = alloc_etherdev(sizeof(struct ace_private));
-		if (dev == NULL) {
-			printk(KERN_ERR "acenic: Unable to allocate "
-			       "net_device structure!\n");
-			break;
-		}
+	static int boards_found;
 
-		SET_MODULE_OWNER(dev);
-		SET_NETDEV_DEV(dev, &pdev->dev);
+	dev = alloc_etherdev(sizeof(struct ace_private));
+	if (dev == NULL) {
+		printk(KERN_ERR "acenic: Unable to allocate "
+		       "net_device structure!\n");
+		return -ENOMEM;
+	}
+
+	SET_MODULE_OWNER(dev);
+	SET_NETDEV_DEV(dev, &pdev->dev);
 
-		ap = dev->priv;
-		ap->pdev = pdev;
+	ap = dev->priv;
+	ap->pdev = pdev;
 
-		dev->open = &ace_open;
-		dev->hard_start_xmit = &ace_start_xmit;
-		dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
+	dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
 #if ACENIC_DO_VLAN
-		dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-		dev->vlan_rx_register = ace_vlan_rx_register;
-		dev->vlan_rx_kill_vid = ace_vlan_rx_kill_vid;
-#endif
-		if (1) {
-			static void ace_watchdog(struct net_device *dev);
-			dev->tx_timeout = &ace_watchdog;
-			dev->watchdog_timeo = 5*HZ;
-		}
-		dev->stop = &ace_close;
-		dev->get_stats = &ace_get_stats;
-		dev->set_multicast_list = &ace_set_multicast_list;
-		dev->do_ioctl = &ace_ioctl;
-		dev->set_mac_address = &ace_set_mac_addr;
-		dev->change_mtu = &ace_change_mtu;
+	dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+	dev->vlan_rx_register = ace_vlan_rx_register;
+	dev->vlan_rx_kill_vid = ace_vlan_rx_kill_vid;
+#endif
+	if (1) {
+		static void ace_watchdog(struct net_device *dev);
+		dev->tx_timeout = &ace_watchdog;
+		dev->watchdog_timeo = 5*HZ;
+	}
 
-		/* display version info if adapter is found */
-		if (!version_disp)
-		{
-			/* set display flag to TRUE so that */
-			/* we only display this string ONCE */
-			version_disp = 1;
-			printk(version);
-		}
+	dev->open = &ace_open;
+	dev->stop = &ace_close;
+	dev->hard_start_xmit = &ace_start_xmit;
+	dev->get_stats = &ace_get_stats;
+	dev->set_multicast_list = &ace_set_multicast_list;
+	dev->do_ioctl = &ace_ioctl;
+	dev->set_mac_address = &ace_set_mac_addr;
+	dev->change_mtu = &ace_change_mtu;
 
-		if (pci_enable_device(pdev)) {
-			free_netdev(dev);
-			continue;
-		}
+	/* we only display this string ONCE */
+	if (!boards_found)
+		printk(version);
 
-		/*
-		 * Enable master mode before we start playing with the
-		 * pci_command word since pci_set_master() will modify
-		 * it.
-		 */
-		pci_set_master(pdev);
+	if (pci_enable_device(pdev))
+		goto fail_free_netdev;
 
-		pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command);
+	/*
+	 * Enable master mode before we start playing with the
+	 * pci_command word since pci_set_master() will modify
+	 * it.
+	 */
+	pci_set_master(pdev);
 
-		/* OpenFirmware on Mac's does not set this - DOH.. */ 
-		if (!(ap->pci_command & PCI_COMMAND_MEMORY)) {
-			printk(KERN_INFO "%s: Enabling PCI Memory Mapped "
-			       "access - was not enabled by BIOS/Firmware\n",
-			       dev->name);
-			ap->pci_command = ap->pci_command | PCI_COMMAND_MEMORY;
-			pci_write_config_word(ap->pdev, PCI_COMMAND,
-					      ap->pci_command);
-			wmb();
-		}
+	pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command);
 
-		pci_read_config_byte(pdev, PCI_LATENCY_TIMER,
-				     &ap->pci_latency);
-		if (ap->pci_latency <= 0x40) {
-			ap->pci_latency = 0x40;
-			pci_write_config_byte(pdev, PCI_LATENCY_TIMER,
-					      ap->pci_latency);
-		}
+	/* OpenFirmware on Mac's does not set this - DOH.. */ 
+	if (!(ap->pci_command & PCI_COMMAND_MEMORY)) {
+		printk(KERN_INFO "%s: Enabling PCI Memory Mapped "
+		       "access - was not enabled by BIOS/Firmware\n",
+		       dev->name);
+		ap->pci_command = ap->pci_command | PCI_COMMAND_MEMORY;
+		pci_write_config_word(ap->pdev, PCI_COMMAND,
+				      ap->pci_command);
+		wmb();
+	}
 
-		/*
-		 * Remap the regs into kernel space - this is abuse of
-		 * dev->base_addr since it was means for I/O port
-		 * addresses but who gives a damn.
-		 */
-		dev->base_addr = pci_resource_start(pdev, 0);
-		ap->regs = (struct ace_regs *)ioremap(dev->base_addr, 0x4000);
-		if (!ap->regs) {
-			printk(KERN_ERR "%s:  Unable to map I/O register, "
-			       "AceNIC %i will be disabled.\n",
-			       dev->name, boards_found);
-			break;
-		}
+	pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &ap->pci_latency);
+	if (ap->pci_latency <= 0x40) {
+		ap->pci_latency = 0x40;
+		pci_write_config_byte(pdev, PCI_LATENCY_TIMER, ap->pci_latency);
+	}
 
-		switch(pdev->vendor) {
-		case PCI_VENDOR_ID_ALTEON:
-			if (pdev->device == PCI_DEVICE_ID_FARALLON_PN9100T) {
-				strncpy(ap->name, "Farallon PN9100-T "
-					"Gigabit Ethernet", sizeof (ap->name));
-				printk(KERN_INFO "%s: Farallon PN9100-T ",
-				       dev->name);
-			} else {
-				strncpy(ap->name, "AceNIC Gigabit Ethernet",
-					sizeof (ap->name));
-				printk(KERN_INFO "%s: Alteon AceNIC ",
-				       dev->name);
-			}
-			break;
-		case PCI_VENDOR_ID_3COM:
-			strncpy(ap->name, "3Com 3C985 Gigabit Ethernet",
-				sizeof (ap->name));
-			printk(KERN_INFO "%s: 3Com 3C985 ", dev->name);
-			break;
-		case PCI_VENDOR_ID_NETGEAR:
-			strncpy(ap->name, "NetGear GA620 Gigabit Ethernet",
-				sizeof (ap->name));
-			printk(KERN_INFO "%s: NetGear GA620 ", dev->name);
-			break;
-		case PCI_VENDOR_ID_DEC:
-			if (pdev->device == PCI_DEVICE_ID_FARALLON_PN9000SX) {
-				strncpy(ap->name, "Farallon PN9000-SX "
-					"Gigabit Ethernet", sizeof (ap->name));
-				printk(KERN_INFO "%s: Farallon PN9000-SX ",
-				       dev->name);
-				break;
-			}
-		case PCI_VENDOR_ID_SGI:
-			strncpy(ap->name, "SGI AceNIC Gigabit Ethernet",
+	/*
+	 * Remap the regs into kernel space - this is abuse of
+	 * dev->base_addr since it was means for I/O port
+	 * addresses but who gives a damn.
+	 */
+	dev->base_addr = pci_resource_start(pdev, 0);
+	ap->regs = (struct ace_regs *)ioremap(dev->base_addr, 0x4000);
+	if (!ap->regs) {
+		printk(KERN_ERR "%s:  Unable to map I/O register, "
+		       "AceNIC %i will be disabled.\n",
+		       dev->name, boards_found);
+		goto fail_free_netdev;
+	}
+
+	switch(pdev->vendor) {
+	case PCI_VENDOR_ID_ALTEON:
+		if (pdev->device == PCI_DEVICE_ID_FARALLON_PN9100T) {
+			strncpy(ap->name, "Farallon PN9100-T "
+				"Gigabit Ethernet", sizeof (ap->name));
+			printk(KERN_INFO "%s: Farallon PN9100-T ",
+			       dev->name);
+		} else {
+			strncpy(ap->name, "AceNIC Gigabit Ethernet",
 				sizeof (ap->name));
-			printk(KERN_INFO "%s: SGI AceNIC ", dev->name);
-			break;
-		default:
- 			strncpy(ap->name, "Unknown AceNIC based Gigabit "
-				"Ethernet", sizeof (ap->name));
-			printk(KERN_INFO "%s: Unknown AceNIC ", dev->name);
+			printk(KERN_INFO "%s: Alteon AceNIC ",
+			       dev->name);
+		}
+		break;
+	case PCI_VENDOR_ID_3COM:
+		strncpy(ap->name, "3Com 3C985 Gigabit Ethernet",
+			sizeof (ap->name));
+		printk(KERN_INFO "%s: 3Com 3C985 ", dev->name);
+		break;
+	case PCI_VENDOR_ID_NETGEAR:
+		strncpy(ap->name, "NetGear GA620 Gigabit Ethernet",
+			sizeof (ap->name));
+		printk(KERN_INFO "%s: NetGear GA620 ", dev->name);
+		break;
+	case PCI_VENDOR_ID_DEC:
+		if (pdev->device == PCI_DEVICE_ID_FARALLON_PN9000SX) {
+			strncpy(ap->name, "Farallon PN9000-SX "
+				"Gigabit Ethernet", sizeof (ap->name));
+			printk(KERN_INFO "%s: Farallon PN9000-SX ",
+			       dev->name);
 			break;
 		}
-		ap->name [sizeof (ap->name) - 1] = '\0';
-		printk("Gigabit Ethernet at 0x%08lx, ", dev->base_addr);
+	case PCI_VENDOR_ID_SGI:
+		strncpy(ap->name, "SGI AceNIC Gigabit Ethernet",
+			sizeof (ap->name));
+		printk(KERN_INFO "%s: SGI AceNIC ", dev->name);
+		break;
+	default:
+ 		strncpy(ap->name, "Unknown AceNIC based Gigabit "
+			"Ethernet", sizeof (ap->name));
+		printk(KERN_INFO "%s: Unknown AceNIC ", dev->name);
+		break;
+	}
+
+	ap->name [sizeof (ap->name) - 1] = '\0';
+	printk("Gigabit Ethernet at 0x%08lx, ", dev->base_addr);
 #ifdef __sparc__
-		printk("irq %s\n", __irq_itoa(pdev->irq));
+	printk("irq %s\n", __irq_itoa(pdev->irq));
 #else
-		printk("irq %i\n", pdev->irq);
+	printk("irq %i\n", pdev->irq);
 #endif
 
 #ifdef CONFIG_ACENIC_OMIT_TIGON_I
-		if ((readl(&ap->regs->HostCtrl) >> 28) == 4) {
-			printk(KERN_ERR "%s: Driver compiled without Tigon I"
-			       " support - NIC disabled\n", dev->name);
-			ace_init_cleanup(dev);
-			free_netdev(dev);
-			continue;
-		}
+	if ((readl(&ap->regs->HostCtrl) >> 28) == 4) {
+		printk(KERN_ERR "%s: Driver compiled without Tigon I"
+		       " support - NIC disabled\n", dev->name);
+		goto fail_uninit;
+	}
 #endif
 
-		if (ace_allocate_descriptors(dev)) {
-			/*
-			 * ace_allocate_descriptors() calls
-			 * ace_init_cleanup() on error.
-			 */
-			free_netdev(dev);
-			continue;
-		}
+	if (ace_allocate_descriptors(dev))
+		goto fail_free_netdev;
 
 #ifdef MODULE
-		if (boards_found >= ACE_MAX_MOD_PARMS)
-			ap->board_idx = BOARD_IDX_OVERFLOW;
-		else
-			ap->board_idx = boards_found;
+	if (boards_found >= ACE_MAX_MOD_PARMS)
+		ap->board_idx = BOARD_IDX_OVERFLOW;
+	else
+		ap->board_idx = boards_found;
 #else
-		ap->board_idx = BOARD_IDX_STATIC;
+	ap->board_idx = BOARD_IDX_STATIC;
 #endif
 
-		if (ace_init(dev)) {
-			/*
-			 * ace_init() calls ace_init_cleanup() on error.
-			 */
-			free_netdev(dev);
-			continue;
-		}
+	if (ace_init(dev))
+		goto fail_free_netdev;
 
-		if (register_netdev(dev)) {
-			printk(KERN_ERR "acenic: device registration failed\n");
-			ace_init_cleanup(dev);
-			free_netdev(dev);
-			continue;
-		}
-
-		if (ap->pci_using_dac)
-			dev->features |= NETIF_F_HIGHDMA;
-
-		boards_found++;
+	if (register_netdev(dev)) {
+		printk(KERN_ERR "acenic: device registration failed\n");
+		goto fail_uninit;
 	}
 
-	/*
-	 * If we're at this point we're going through ace_probe() for
-	 * the first time.  Return success (0) if we've initialized 1
-	 * or more boards. Otherwise, return failure (-ENODEV).
-	 */
-
-	if (boards_found > 0)
-		return 0;
-	else
-		return -ENODEV;
-}
+	if (ap->pci_using_dac)
+		dev->features |= NETIF_F_HIGHDMA;
 
+	pci_set_drvdata(pdev, dev);
 
-#ifdef MODULE
-MODULE_AUTHOR("Jes Sorensen <jes@trained-monkey.org>");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver");
-MODULE_PARM(link, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(trace, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(tx_coal_tick, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(max_tx_desc, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(rx_coal_tick, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(max_rx_desc, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM(tx_ratio, "1-" __MODULE_STRING(8) "i");
-MODULE_PARM_DESC(link, "AceNIC/3C985/NetGear link state");
-MODULE_PARM_DESC(trace, "AceNIC/3C985/NetGear firmware trace level");
-MODULE_PARM_DESC(tx_coal_tick, "AceNIC/3C985/GA620 max clock ticks to wait from first tx descriptor arrives");
-MODULE_PARM_DESC(max_tx_desc, "AceNIC/3C985/GA620 max number of transmit descriptors to wait");
-MODULE_PARM_DESC(rx_coal_tick, "AceNIC/3C985/GA620 max clock ticks to wait from first rx descriptor arrives");
-MODULE_PARM_DESC(max_rx_desc, "AceNIC/3C985/GA620 max number of receive descriptors to wait");
-MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)");
-#endif
+	boards_found++;
+	return 0;
 
+ fail_uninit:
+	ace_init_cleanup(dev);
+ fail_free_netdev:
+	free_netdev(dev);
+	return -ENODEV;
+}
 
-static void __exit ace_module_cleanup(void)
+static void __devexit acenic_remove_one(struct pci_dev *pdev)
 {
-	struct ace_private *ap;
-	struct ace_regs *regs;
-	struct net_device *next;
+	struct net_device *dev = pci_get_drvdata(pdev);
+	struct ace_private *ap = dev->priv;
+	struct ace_regs *regs = ap->regs;
 	short i;
 
-	while (root_dev) {
-		ap = root_dev->priv;
-		next = ap->next;
-		unregister_netdev(root_dev);
-
-		regs = ap->regs;
+	unregister_netdev(dev);
 
-		writel(readl(&regs->CpuCtrl) | CPU_HALT, &regs->CpuCtrl);
-		if (ap->version >= 2)
-			writel(readl(&regs->CpuBCtrl) | CPU_HALT,
-			       &regs->CpuBCtrl);
-		/*
-		 * This clears any pending interrupts
-		 */
-		writel(1, &regs->Mb0Lo);
-		readl(&regs->CpuCtrl);	/* flush */
+	writel(readl(&regs->CpuCtrl) | CPU_HALT, &regs->CpuCtrl);
+	if (ap->version >= 2)
+		writel(readl(&regs->CpuBCtrl) | CPU_HALT, &regs->CpuBCtrl);
+	
+	/*
+	 * This clears any pending interrupts
+	 */
+	writel(1, &regs->Mb0Lo);
+	readl(&regs->CpuCtrl);	/* flush */
 
-		/*
-		 * Make sure no other CPUs are processing interrupts
-		 * on the card before the buffers are being released.
-		 * Otherwise one might experience some `interesting'
-		 * effects.
-		 *
-		 * Then release the RX buffers - jumbo buffers were
-		 * already released in ace_close().
-		 */
-		ace_sync_irq(root_dev->irq);
+	/*
+	 * Make sure no other CPUs are processing interrupts
+	 * on the card before the buffers are being released.
+	 * Otherwise one might experience some `interesting'
+	 * effects.
+	 *
+	 * Then release the RX buffers - jumbo buffers were
+	 * already released in ace_close().
+	 */
+	ace_sync_irq(dev->irq);
 
-		for (i = 0; i < RX_STD_RING_ENTRIES; i++) {
-			struct sk_buff *skb = ap->skb->rx_std_skbuff[i].skb;
+	for (i = 0; i < RX_STD_RING_ENTRIES; i++) {
+		struct sk_buff *skb = ap->skb->rx_std_skbuff[i].skb;
 
-			if (skb) {
-				struct ring_info *ringp;
-				dma_addr_t mapping;
+		if (skb) {
+			struct ring_info *ringp;
+			dma_addr_t mapping;
 
-				ringp = &ap->skb->rx_std_skbuff[i];
-				mapping = pci_unmap_addr(ringp, mapping);
-				pci_unmap_page(ap->pdev, mapping,
-					       ACE_STD_BUFSIZE - (2 + 16),
-					       PCI_DMA_FROMDEVICE);
+			ringp = &ap->skb->rx_std_skbuff[i];
+			mapping = pci_unmap_addr(ringp, mapping);
+			pci_unmap_page(ap->pdev, mapping,
+				       ACE_STD_BUFSIZE - (2 + 16),
+				       PCI_DMA_FROMDEVICE);
 
-				ap->rx_std_ring[i].size = 0;
-				ap->skb->rx_std_skbuff[i].skb = NULL;
-				dev_kfree_skb(skb);
-			}
-		}
-		if (ap->version >= 2) {
-			for (i = 0; i < RX_MINI_RING_ENTRIES; i++) {
-				struct sk_buff *skb = ap->skb->rx_mini_skbuff[i].skb;
-
-				if (skb) {
-					struct ring_info *ringp;
-					dma_addr_t mapping;
-
-					ringp = &ap->skb->rx_mini_skbuff[i];
-					mapping = pci_unmap_addr(ringp,mapping);
-					pci_unmap_page(ap->pdev, mapping,
-						       ACE_MINI_BUFSIZE - (2 + 16),
-						       PCI_DMA_FROMDEVICE);
-
-					ap->rx_mini_ring[i].size = 0;
-					ap->skb->rx_mini_skbuff[i].skb = NULL;
-					dev_kfree_skb(skb);
-				}
-			}
+			ap->rx_std_ring[i].size = 0;
+			ap->skb->rx_std_skbuff[i].skb = NULL;
+			dev_kfree_skb(skb);
 		}
-		for (i = 0; i < RX_JUMBO_RING_ENTRIES; i++) {
-			struct sk_buff *skb = ap->skb->rx_jumbo_skbuff[i].skb;
+	}
+
+	if (ap->version >= 2) {
+		for (i = 0; i < RX_MINI_RING_ENTRIES; i++) {
+			struct sk_buff *skb = ap->skb->rx_mini_skbuff[i].skb;
+
 			if (skb) {
 				struct ring_info *ringp;
 				dma_addr_t mapping;
 
-				ringp = &ap->skb->rx_jumbo_skbuff[i];
-				mapping = pci_unmap_addr(ringp, mapping);
+				ringp = &ap->skb->rx_mini_skbuff[i];
+				mapping = pci_unmap_addr(ringp,mapping);
 				pci_unmap_page(ap->pdev, mapping,
-					       ACE_JUMBO_BUFSIZE - (2 + 16),
+					       ACE_MINI_BUFSIZE - (2 + 16),
 					       PCI_DMA_FROMDEVICE);
 
-				ap->rx_jumbo_ring[i].size = 0;
-				ap->skb->rx_jumbo_skbuff[i].skb = NULL;
+				ap->rx_mini_ring[i].size = 0;
+				ap->skb->rx_mini_skbuff[i].skb = NULL;
 				dev_kfree_skb(skb);
 			}
 		}
-
-		ace_init_cleanup(root_dev);
-		free_netdev(root_dev);
-		root_dev = next;
 	}
-}
 
+	for (i = 0; i < RX_JUMBO_RING_ENTRIES; i++) {
+		struct sk_buff *skb = ap->skb->rx_jumbo_skbuff[i].skb;
+		if (skb) {
+			struct ring_info *ringp;
+			dma_addr_t mapping;
 
-int __init ace_module_init(void)
-{
-	int status;
+			ringp = &ap->skb->rx_jumbo_skbuff[i];
+			mapping = pci_unmap_addr(ringp, mapping);
+			pci_unmap_page(ap->pdev, mapping,
+				       ACE_JUMBO_BUFSIZE - (2 + 16),
+				       PCI_DMA_FROMDEVICE);
 
-	root_dev = NULL;
+			ap->rx_jumbo_ring[i].size = 0;
+			ap->skb->rx_jumbo_skbuff[i].skb = NULL;
+			dev_kfree_skb(skb);
+		}
+	}
 
-#ifdef NEW_NETINIT
-	status = acenic_probe();
-#else
-	status = acenic_probe(NULL);
-#endif
-	return status;
+	ace_init_cleanup(dev);
+	free_netdev(dev);
 }
 
+static struct pci_driver acenic_pci_driver = {
+	.name		= "acenic",
+	.id_table	= acenic_pci_tbl,
+	.probe		= acenic_probe_one,
+	.remove		= __devexit_p(acenic_remove_one),
+};
 
-#if (LINUX_VERSION_CODE < 0x02032a)
-#ifdef MODULE
-int init_module(void)
+static int __init acenic_init(void)
 {
-	return ace_module_init();
+	return pci_module_init(&acenic_pci_driver);
 }
 
-
-void cleanup_module(void)
+static void __exit acenic_exit(void)
 {
-	ace_module_cleanup();
+	pci_unregister_driver(&acenic_pci_driver);
 }
-#endif
-#else
-module_init(ace_module_init);
-module_exit(ace_module_cleanup);
-#endif
 
+module_init(acenic_init);
+module_exit(acenic_exit);
 
 static void ace_free_descriptors(struct net_device *dev)
 {
@@ -1462,13 +1203,6 @@
 	} else
 		dev->irq = pdev->irq;
 
-	/*
-	 * Register the device here to be able to catch allocated
-	 * interrupt handlers in case the firmware doesn't come up.
-	 */
-	ap->next = root_dev;
-	root_dev = dev;
-
 #ifdef INDEX_DEBUG
 	spin_lock_init(&ap->debug_lock);
 	ap->last_tx = ACE_TX_RING_ENTRIES(ap) - 1;
@@ -2642,8 +2376,6 @@
 
 	netif_start_queue(dev);
 
-	ACE_MOD_INC_USE_COUNT;
-
 	/*
 	 * Setup the bottom half rx ring refill handler
 	 */
@@ -2660,8 +2392,6 @@
 	unsigned long flags;
 	short i;
 
-	ace_if_down(dev);
-
 	/*
 	 * Without (or before) releasing irq and stopping hardware, this
 	 * is an absolute non-sense, by the way. It will be reset instantly
@@ -2733,7 +2463,6 @@
 	ace_unmask_irq(dev);
 	local_irq_restore(flags);
 
-	ACE_MOD_DEC_USE_COUNT;
 	return 0;
 }
 
@@ -2789,12 +2518,6 @@
 	struct ace_regs *regs = ap->regs;
 	struct tx_desc *desc;
 	u32 idx, flagsize;
-
- 	/*
-	 * This only happens with pre-softnet, ie. 2.2.x kernels.
- 	 */
-	if (early_stop_netif_stop_queue(dev))
- 		return 1;
 
 restart:
 	idx = ap->tx_prd;
diff -Nru a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
--- a/drivers/net/amd8111e.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/amd8111e.c	Tue Jun 15 22:20:41 2004
@@ -1571,7 +1571,7 @@
 This function handles all the  ethtool ioctls. It gives driver info, gets/sets driver speed, gets memory mapped register values, forces auto negotiation, sets/gets WOL options for ethtool application. 
 */
 	
-static int amd8111e_ethtool_ioctl(struct net_device* dev, void* useraddr)
+static int amd8111e_ethtool_ioctl(struct net_device* dev, void __user *useraddr)
 {
 	struct amd8111e_priv *lp = netdev_priv(dev);
 	struct pci_dev *pci_dev = lp->pci_dev;
@@ -1694,7 +1694,7 @@
 }
 static int amd8111e_ioctl(struct net_device * dev , struct ifreq *ifr, int cmd)
 {
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data;
+	struct mii_ioctl_data *data = if_mii(ifr);
 	struct amd8111e_priv *lp = netdev_priv(dev);
 	int err;
 	u32 mii_regval;
@@ -1704,7 +1704,7 @@
 
 	switch(cmd) {
 	case SIOCETHTOOL:
-		return amd8111e_ethtool_ioctl(dev, (void *) ifr->ifr_data);
+		return amd8111e_ethtool_ioctl(dev, ifr->ifr_data);
 	case SIOCGMIIPHY:
 		data->phy_id = PHY_ID;
 
diff -Nru a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
--- a/drivers/net/appletalk/cops.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/appletalk/cops.c	Tue Jun 15 22:20:40 2004
@@ -524,7 +524,7 @@
 static void cops_load (struct net_device *dev)
 {
         struct ifreq ifr;
-        struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_data;
+        struct ltfirmware *ltf= (struct ltfirmware *)&ifr.ifr_ifru;
         struct cops_local *lp = netdev_priv(dev);
         int ioaddr=dev->base_addr;
 	int length, i = 0;
diff -Nru a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
--- a/drivers/net/appletalk/ipddp.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/appletalk/ipddp.c	Tue Jun 15 22:20:36 2004
@@ -259,7 +259,7 @@
 
 static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-        struct ipddp_route *rt = (struct ipddp_route *)ifr->ifr_data;
+        struct ipddp_route __user *rt = ifr->ifr_data;
         struct ipddp_route rcp;
 
         if(!capable(CAP_NET_ADMIN))
diff -Nru a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c
--- a/drivers/net/arcnet/com90xx.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/arcnet/com90xx.c	Tue Jun 15 22:20:42 2004
@@ -155,7 +155,7 @@
 		ioaddr = *port;
 
 		if (!request_region(*port, ARCNET_TOTAL_SIZE, "arcnet (90xx)")) {
-			BUGMSG2(D_INIT_REASONS, "(check_region)\n");
+			BUGMSG2(D_INIT_REASONS, "(request_region)\n");
 			BUGMSG2(D_INIT_REASONS, "S1: ");
 			BUGLVL(D_INIT_REASONS) numprint = 0;
 			*port-- = ports[--numports];
@@ -214,7 +214,7 @@
 		BUGMSG2(D_INIT, "%lXh ", *p);
 
 		if (!request_mem_region(*p, BUFFER_SIZE, "arcnet (90xx)")) {
-			BUGMSG2(D_INIT_REASONS, "(check_mem_region)\n");
+			BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n");
 			BUGMSG2(D_INIT_REASONS, "Stage 3: ");
 			BUGLVL(D_INIT_REASONS) numprint = 0;
 			*p-- = shmems[--numshmems];
diff -Nru a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
--- a/drivers/net/arm/am79c961a.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/net/arm/am79c961a.c	Tue Jun 15 22:20:43 2004
@@ -53,25 +53,31 @@
 #ifdef __arm__
 static void write_rreg(u_long base, u_int reg, u_int val)
 {
-	__asm__("str%?h	%1, [%2]	@ NET_RAP
-		str%?h	%0, [%2, #-4]	@ NET_RDP
-		" : : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
+	__asm__(
+	"str%?h	%1, [%2]	@ NET_RAP\n\t"
+	"str%?h	%0, [%2, #-4]	@ NET_RDP"
+	:
+	: "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
 }
 
 static inline unsigned short read_rreg(u_long base_addr, u_int reg)
 {
 	unsigned short v;
-	__asm__("str%?h	%1, [%2]	@ NET_RAP
-		ldr%?h	%0, [%2, #-4]	@ NET_RDP
-		" : "=r" (v): "r" (reg), "r" (ISAIO_BASE + 0x0464));
+	__asm__(
+	"str%?h	%1, [%2]	@ NET_RAP\n\t"
+	"ldr%?h	%0, [%2, #-4]	@ NET_RDP"
+	: "=r" (v)
+	: "r" (reg), "r" (ISAIO_BASE + 0x0464));
 	return v;
 }
 
 static inline void write_ireg(u_long base, u_int reg, u_int val)
 {
-	__asm__("str%?h	%1, [%2]	@ NET_RAP
-		str%?h	%0, [%2, #8]	@ NET_IDP
-		" : : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
+	__asm__(
+	"str%?h	%1, [%2]	@ NET_RAP\n\t"
+	"str%?h	%0, [%2, #8]	@ NET_IDP"
+	:
+	: "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
 }
 
 static inline unsigned short read_ireg(u_long base_addr, u_int reg)
@@ -101,16 +107,16 @@
 	}
 	while (length > 8) {
 		unsigned int tmp, tmp2;
-		__asm__ __volatile__("
-			ldm%?ia	%1!, {%2, %3}
-			str%?h	%2, [%0], #4
-			mov%?	%2, %2, lsr #16
-			str%?h	%2, [%0], #4
-			str%?h	%3, [%0], #4
-			mov%?	%3, %3, lsr #16
-			str%?h	%3, [%0], #4
-		" : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2)
-		  : "0" (offset), "1" (buf));
+		__asm__ __volatile__(
+			"ldm%?ia	%1!, {%2, %3}\n\t"
+			"str%?h	%2, [%0], #4\n\t"
+			"mov%?	%2, %2, lsr #16\n\t"
+			"str%?h	%2, [%0], #4\n\t"
+			"str%?h	%3, [%0], #4\n\t"
+			"mov%?	%3, %3, lsr #16\n\t"
+			"str%?h	%3, [%0], #4"
+		: "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2)
+		: "0" (offset), "1" (buf));
 		length -= 8;
 	}
 	while (length > 0) {
@@ -128,36 +134,36 @@
 	length = (length + 1) & ~1;
 	if ((int)buf & 2) {
 		unsigned int tmp;
-		__asm__ __volatile__("
-			ldr%?h	%2, [%0], #4
-			str%?b	%2, [%1], #1
-			mov%?	%2, %2, lsr #8
-			str%?b	%2, [%1], #1
-		" : "=&r" (offset), "=&r" (buf), "=r" (tmp): "0" (offset), "1" (buf));
+		__asm__ __volatile__(
+			"ldr%?h	%2, [%0], #4\n\t"
+			"str%?b	%2, [%1], #1\n\t"
+			"mov%?	%2, %2, lsr #8\n\t"
+			"str%?b	%2, [%1], #1"
+		: "=&r" (offset), "=&r" (buf), "=r" (tmp): "0" (offset), "1" (buf));
 		length -= 2;
 	}
 	while (length > 8) {
 		unsigned int tmp, tmp2, tmp3;
-		__asm__ __volatile__("
-			ldr%?h	%2, [%0], #4
-			ldr%?h	%3, [%0], #4
-			orr%?	%2, %2, %3, lsl #16
-			ldr%?h	%3, [%0], #4
-			ldr%?h	%4, [%0], #4
-			orr%?	%3, %3, %4, lsl #16
-			stm%?ia	%1!, {%2, %3}
-		" : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2), "=r" (tmp3)
-		  : "0" (offset), "1" (buf));
+		__asm__ __volatile__(
+			"ldr%?h	%2, [%0], #4\n\t"
+			"ldr%?h	%3, [%0], #4\n\t"
+			"orr%?	%2, %2, %3, lsl #16\n\t"
+			"ldr%?h	%3, [%0], #4\n\t"
+			"ldr%?h	%4, [%0], #4\n\t"
+			"orr%?	%3, %3, %4, lsl #16\n\t"
+			"stm%?ia	%1!, {%2, %3}"
+		: "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2), "=r" (tmp3)
+		: "0" (offset), "1" (buf));
 		length -= 8;
 	}
 	while (length > 0) {
 		unsigned int tmp;
-		__asm__ __volatile__("
-			ldr%?h	%2, [%0], #4
-			str%?b	%2, [%1], #1
-			mov%?	%2, %2, lsr #8
-			str%?b	%2, [%1], #1
-		" : "=&r" (offset), "=&r" (buf), "=r" (tmp) : "0" (offset), "1" (buf));
+		__asm__ __volatile__(
+			"ldr%?h	%2, [%0], #4\n\t"
+			"str%?b	%2, [%1], #1\n\t"
+			"mov%?	%2, %2, lsr #8\n\t"
+			"str%?b	%2, [%1], #1"
+		: "=&r" (offset), "=&r" (buf), "=r" (tmp) : "0" (offset), "1" (buf));
 		length -= 2;
 	}
 }
@@ -618,6 +624,7 @@
 		if (status & CSR0_CERR) {
 			handled = 1;
 			mod_timer(&priv->timer, jiffies);
+		}
 	} while (--n && status & (CSR0_RINT | CSR0_TINT));
 
 	return IRQ_RETVAL(handled);
diff -Nru a/drivers/net/arm/ether00.c b/drivers/net/arm/ether00.c
--- a/drivers/net/arm/ether00.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/arm/ether00.c	Tue Jun 15 22:21:05 2004
@@ -21,7 +21,6 @@
 /* includes */
 #include <linux/config.h>
 #include <linux/pci.h>
-#include <linux/netdevice.h>
 #include <linux/sched.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
diff -Nru a/drivers/net/at1700.c b/drivers/net/at1700.c
--- a/drivers/net/at1700.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/at1700.c	Tue Jun 15 22:20:39 2004
@@ -242,7 +242,7 @@
 {
 #ifdef CONFIG_MCA	
 	struct net_local *lp = netdev_priv(dev);
-	if (lp->mca_slot)
+	if (lp->mca_slot >= 0)
 		mca_mark_as_unused(lp->mca_slot);
 #endif	
 	free_irq(dev->irq, NULL);
@@ -444,11 +444,11 @@
 					break;
 			}
 			if (i == 8) {
-				goto err_out;
+				goto err_mca;
 			}
 		} else {
 			if (fmv18x_probe_list[inb(ioaddr + IOCONFIG) & 0x07] != ioaddr)
-				goto err_out;
+				goto err_mca;
 			irq = fmv_irqmap[(inb(ioaddr + IOCONFIG)>>6) & 0x03];
 		}
 	}
@@ -546,11 +546,16 @@
 	if (ret) {
 		printk ("  AT1700 at %#3x is unusable due to a conflict on"
 				"IRQ %d.\n", ioaddr, irq);
-		goto err_out;
+		goto err_mca;
 	}
 
 	return 0;
 
+err_mca:
+#ifdef CONFIG_MCA
+	if (slot >= 0)
+		mca_mark_as_unused(slot);
+#endif
 err_out:
 #ifndef CONFIG_X86_PC9800
 	release_region(ioaddr, AT1700_IO_EXTENT);
diff -Nru a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
--- a/drivers/net/au1000_eth.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/au1000_eth.c	Tue Jun 15 22:20:41 2004
@@ -1269,7 +1269,7 @@
 
 static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-	u16 *data = (u16 *)&rq->ifr_data;
+	u16 *data = (u16 *)&rq->ifr_ifru;
 
 	/* fixme */
 	switch(cmd) { 
diff -Nru a/drivers/net/auto_irq.c b/drivers/net/auto_irq.c
--- a/drivers/net/auto_irq.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,68 +0,0 @@
-/* auto_irq.c: Auto-configure IRQ lines for linux. */
-/*
-    Written 1994 by Donald Becker.
-
-    The author may be reached as becker@scyld.com
-
-    This code is a general-purpose IRQ line detector for devices with
-    jumpered IRQ lines.  If you can make the device raise an IRQ (and
-    that IRQ line isn't already being used), these routines will tell
-    you what IRQ line it's using -- perfect for those oh-so-cool boot-time
-    device probes!
-
-    To use this, first call autoirq_setup(timeout). TIMEOUT is how many
-    'jiffies' (1/100 sec.) to detect other devices that have active IRQ lines,
-    and can usually be zero at boot.  'autoirq_setup()' returns the bit
-    vector of nominally-available IRQ lines (lines may be physically in-use,
-    but not yet registered to a device).
-    Next, set up your device to trigger an interrupt.
-    Finally call autoirq_report(TIMEOUT) to find out which IRQ line was
-    most recently active.  The TIMEOUT should usually be zero, but may
-    be set to the number of jiffies to wait for a slow device to raise an IRQ.
-
-    The idea of using the setup timeout to filter out bogus IRQs came from
-    the serial driver.
-*/
-
-
-#ifdef version
-static const char *version=
-"auto_irq.c:v1.11 Donald Becker (becker@scyld.com)";
-#endif
-
-#include <linux/module.h>
-#include <linux/jiffies.h>
-#include <linux/delay.h>
-#include <asm/bitops.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <linux/netdevice.h>
-
-static unsigned long irqs;
-
-void autoirq_setup(int waittime)
-{
-	irqs = probe_irq_on();
-}
-
-#define BUSY_LOOP_UNTIL(j) while ((long)(jiffies-(j)) < 0) ;
-int autoirq_report(int waittime)
-{
-	unsigned long delay = jiffies + waittime;
-	BUSY_LOOP_UNTIL(delay)
-	return probe_irq_off(irqs);
-}
-
-EXPORT_SYMBOL(autoirq_setup);
-EXPORT_SYMBOL(autoirq_report);
-
-
-/*
- * Local variables:
- *  compile-command: "gcc -DKERNEL -Wall -O6 -fomit-frame-pointer -I/usr/src/linux/net/tcp -c auto_irq.c"
- *  version-control: t
- *  kept-new-versions: 5
- *  c-indent-level: 4
- *  tab-width: 4
- * End:
- */
diff -Nru a/drivers/net/b44.c b/drivers/net/b44.c
--- a/drivers/net/b44.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/b44.c	Tue Jun 15 22:20:39 2004
@@ -27,8 +27,8 @@
 
 #define DRV_MODULE_NAME		"b44"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"0.93"
-#define DRV_MODULE_RELDATE	"Mar, 2004"
+#define DRV_MODULE_VERSION	"0.94"
+#define DRV_MODULE_RELDATE	"May 4, 2004"
 
 #define B44_DEF_MSG_ENABLE	  \
 	(NETIF_MSG_DRV		| \
@@ -96,7 +96,7 @@
 
 static void b44_halt(struct b44 *);
 static void b44_init_rings(struct b44 *);
-static int b44_init_hw(struct b44 *);
+static void b44_init_hw(struct b44 *);
 
 static int b44_wait_bit(struct b44 *bp, unsigned long reg,
 			u32 bit, unsigned long timeout, const int clear)
@@ -331,6 +331,29 @@
 	return b44_wait_bit(bp, B44_EMAC_ISTAT, EMAC_INT_MII, 100, 0);
 }
 
+/* miilib interface */
+/* FIXME FIXME: phy_id is ignored, bp->phy_addr use is unconditional
+ * due to code existing before miilib use was added to this driver.
+ * Someone should remove this artificial driver limitation in
+ * b44_{read,write}phy.  bp->phy_addr itself is fine (and needed).
+ */
+static int b44_mii_read(struct net_device *dev, int phy_id, int location)
+{
+	u32 val;
+	struct b44 *bp = netdev_priv(dev);
+	int rc = b44_readphy(bp, location, &val);
+	if (rc)
+		return 0xffffffff;
+	return val;
+}
+
+static void b44_mii_write(struct net_device *dev, int phy_id, int location,
+			 int val)
+{
+	struct b44 *bp = netdev_priv(dev);
+	b44_writephy(bp, location, val);
+}
+
 static int b44_phy_reset(struct b44 *bp)
 {
 	u32 val;
@@ -771,7 +794,7 @@
 
 static int b44_poll(struct net_device *netdev, int *budget)
 {
-	struct b44 *bp = netdev->priv;
+	struct b44 *bp = netdev_priv(netdev);
 	int done;
 
 	spin_lock_irq(&bp->lock);
@@ -821,7 +844,7 @@
 static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct net_device *dev = dev_id;
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 	unsigned long flags;
 	u32 istat, imask;
 	int handled = 0;
@@ -858,7 +881,7 @@
 
 static void b44_tx_timeout(struct net_device *dev)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 
 	printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
 	       dev->name);
@@ -878,7 +901,7 @@
 
 static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 	dma_addr_t mapping;
 	u32 len, entry, ctrl;
 
@@ -932,7 +955,7 @@
 
 static int b44_change_mtu(struct net_device *dev, int new_mtu)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 
 	if (new_mtu < B44_MIN_MTU || new_mtu > B44_MAX_MTU)
 		return -EINVAL;
@@ -1161,7 +1184,7 @@
 
 static int b44_set_mac_addr(struct net_device *dev, void *p)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 	struct sockaddr *addr = p;
 
 	if (netif_running(dev))
@@ -1180,15 +1203,16 @@
  * packet processing.  Invoked with bp->lock held.
  */
 static void __b44_set_rx_mode(struct net_device *);
-static int b44_init_hw(struct b44 *bp)
+static void b44_init_hw(struct b44 *bp)
 {
 	u32 val;
 
 	b44_chip_reset(bp);
 	b44_phy_reset(bp);
 	b44_setup_phy(bp);
-	val = br32(B44_MAC_CTRL);
-	bw32(B44_MAC_CTRL, val | MAC_CTRL_CRC32_ENAB);
+
+	/* Enable CRC32, set proper LED modes and power on PHY */
+	bw32(B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
 	bw32(B44_RCV_LAZY, (1 << RCV_LAZY_FC_SHIFT));
 
 	/* This sets the MAC address too.  */
@@ -1212,13 +1236,11 @@
 
 	val = br32(B44_ENET_CTRL);
 	bw32(B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
-
-	return 0;
 }
 
 static int b44_open(struct net_device *dev)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 	int err;
 
 	err = b44_alloc_consistent(bp);
@@ -1232,9 +1254,7 @@
 	spin_lock_irq(&bp->lock);
 
 	b44_init_rings(bp);
-	err = b44_init_hw(bp);
-	if (err)
-		goto err_out_noinit;
+	b44_init_hw(bp);
 	bp->flags |= B44_FLAG_INIT_COMPLETE;
 
 	spin_unlock_irq(&bp->lock);
@@ -1249,11 +1269,6 @@
 
 	return 0;
 
-err_out_noinit:
-	b44_halt(bp);
-	b44_free_rings(bp);
-	spin_unlock_irq(&bp->lock);
-	free_irq(dev->irq, dev);
 err_out_free:
 	b44_free_consistent(bp);
 	return err;
@@ -1273,7 +1288,7 @@
 
 static int b44_close(struct net_device *dev)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 
 	netif_stop_queue(dev);
 
@@ -1300,7 +1315,7 @@
 
 static struct net_device_stats *b44_get_stats(struct net_device *dev)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 	struct net_device_stats *nstat = &bp->stats;
 	struct b44_hw_stats *hwstat = &bp->hw_stats;
 
@@ -1337,7 +1352,7 @@
 	return nstat;
 }
 
-static void __b44_load_mcast(struct b44 *bp, struct net_device *dev)
+static int __b44_load_mcast(struct b44 *bp, struct net_device *dev)
 {
 	struct dev_mc_list *mclist;
 	int i, num_ents;
@@ -1347,12 +1362,15 @@
 	for (i = 0; mclist && i < num_ents; i++, mclist = mclist->next) {
 		__b44_cam_write(bp, mclist->dmi_addr, i + 1);
 	}
+	return i+1;
 }
 
 static void __b44_set_rx_mode(struct net_device *dev)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 	u32 val;
+	int i=0;
+	unsigned char zero[6] = {0,0,0,0,0,0};
 
 	val = br32(B44_RXCONFIG);
 	val &= ~(RXCONFIG_PROMISC | RXCONFIG_ALLMULTI);
@@ -1365,8 +1383,11 @@
 		if (dev->flags & IFF_ALLMULTI)
 			val |= RXCONFIG_ALLMULTI;
 		else
-			__b44_load_mcast(bp, dev);
-
+			i=__b44_load_mcast(bp, dev);
+		
+		for(;i<64;i++) {
+			__b44_cam_write(bp, zero, i);			
+		}
 		bw32(B44_RXCONFIG, val);
         	val = br32(B44_CAM_CTRL);
 	        bw32(B44_CAM_CTRL, val | CAM_CTRL_ENABLE);
@@ -1375,295 +1396,252 @@
 
 static void b44_set_rx_mode(struct net_device *dev)
 {
-	struct b44 *bp = dev->priv;
+	struct b44 *bp = netdev_priv(dev);
 
 	spin_lock_irq(&bp->lock);
 	__b44_set_rx_mode(dev);
 	spin_unlock_irq(&bp->lock);
 }
 
-static int b44_ethtool_ioctl (struct net_device *dev, void __user *useraddr)
+static u32 b44_get_msglevel(struct net_device *dev)
 {
-	struct b44 *bp = dev->priv;
-	struct pci_dev *pci_dev = bp->pdev;
-	u32 ethcmd;
+	struct b44 *bp = netdev_priv(dev);
+	return bp->msg_enable;
+}
 
-	if (copy_from_user (&ethcmd, useraddr, sizeof (ethcmd)))
-		return -EFAULT;
+static void b44_set_msglevel(struct net_device *dev, u32 value)
+{
+	struct b44 *bp = netdev_priv(dev);
+	bp->msg_enable = value;
+}
 
-	switch (ethcmd) {
-	case ETHTOOL_GDRVINFO:{
-		struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
-		strcpy (info.driver, DRV_MODULE_NAME);
-		strcpy (info.version, DRV_MODULE_VERSION);
-		memset(&info.fw_version, 0, sizeof(info.fw_version));
-		strcpy (info.bus_info, pci_name(pci_dev));
-		info.eedump_len = 0;
-		info.regdump_len = 0;
-		if (copy_to_user (useraddr, &info, sizeof (info)))
-			return -EFAULT;
-		return 0;
-	}
+static void b44_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
+{
+	struct b44 *bp = netdev_priv(dev);
+	struct pci_dev *pci_dev = bp->pdev;
 
-	case ETHTOOL_GSET: {
-		struct ethtool_cmd cmd = { ETHTOOL_GSET };
+	strcpy (info->driver, DRV_MODULE_NAME);
+	strcpy (info->version, DRV_MODULE_VERSION);
+	strcpy (info->bus_info, pci_name(pci_dev));
+}
 
-		if (!(bp->flags & B44_FLAG_INIT_COMPLETE))
-			return -EAGAIN;
-		cmd.supported = (SUPPORTED_Autoneg);
-		cmd.supported |= (SUPPORTED_100baseT_Half |
-				  SUPPORTED_100baseT_Full |
-				  SUPPORTED_10baseT_Half |
-				  SUPPORTED_10baseT_Full |
-				  SUPPORTED_MII);
+static int b44_nway_reset(struct net_device *dev)
+{
+	struct b44 *bp = netdev_priv(dev);
+	u32 bmcr;
+	int r;
 
-		cmd.advertising = 0;
-		if (bp->flags & B44_FLAG_ADV_10HALF)
-			cmd.advertising |= ADVERTISE_10HALF;
-		if (bp->flags & B44_FLAG_ADV_10FULL)
-			cmd.advertising |= ADVERTISE_10FULL;
-		if (bp->flags & B44_FLAG_ADV_100HALF)
-			cmd.advertising |= ADVERTISE_100HALF;
-		if (bp->flags & B44_FLAG_ADV_100FULL)
-			cmd.advertising |= ADVERTISE_100FULL;
-		cmd.advertising |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
-		cmd.speed = (bp->flags & B44_FLAG_100_BASE_T) ?
-			SPEED_100 : SPEED_10;
-		cmd.duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ?
-			DUPLEX_FULL : DUPLEX_HALF;
-		cmd.port = 0;
-		cmd.phy_address = bp->phy_addr;
-		cmd.transceiver = (bp->flags & B44_FLAG_INTERNAL_PHY) ?
-			XCVR_INTERNAL : XCVR_EXTERNAL;
-		cmd.autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ?
-			AUTONEG_DISABLE : AUTONEG_ENABLE;
-		cmd.maxtxpkt = 0;
-		cmd.maxrxpkt = 0;
-		if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
-			return -EFAULT;
-		return 0;
+	spin_lock_irq(&bp->lock);
+	b44_readphy(bp, MII_BMCR, &bmcr);
+	b44_readphy(bp, MII_BMCR, &bmcr);
+	r = -EINVAL;
+	if (bmcr & BMCR_ANENABLE) {
+		b44_writephy(bp, MII_BMCR,
+			     bmcr | BMCR_ANRESTART);
+		r = 0;
 	}
-	case ETHTOOL_SSET: {
-		struct ethtool_cmd cmd;
+	spin_unlock_irq(&bp->lock);
 
-		if (!(bp->flags & B44_FLAG_INIT_COMPLETE))
-			return -EAGAIN;
+	return r;
+}
 
-		if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
-			return -EFAULT;
+static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+	struct b44 *bp = netdev_priv(dev);
 
-		/* We do not support gigabit. */
-		if (cmd.autoneg == AUTONEG_ENABLE) {
-			if (cmd.advertising &
-			    (ADVERTISED_1000baseT_Half |
-			     ADVERTISED_1000baseT_Full))
-				return -EINVAL;
-		} else if ((cmd.speed != SPEED_100 &&
-			    cmd.speed != SPEED_10) ||
-			   (cmd.duplex != DUPLEX_HALF &&
-			    cmd.duplex != DUPLEX_FULL)) {
-				return -EINVAL;
-		}
+	if (!(bp->flags & B44_FLAG_INIT_COMPLETE))
+		return -EAGAIN;
+	cmd->supported = (SUPPORTED_Autoneg);
+	cmd->supported |= (SUPPORTED_100baseT_Half |
+			  SUPPORTED_100baseT_Full |
+			  SUPPORTED_10baseT_Half |
+			  SUPPORTED_10baseT_Full |
+			  SUPPORTED_MII);
+
+	cmd->advertising = 0;
+	if (bp->flags & B44_FLAG_ADV_10HALF)
+		cmd->advertising |= ADVERTISE_10HALF;
+	if (bp->flags & B44_FLAG_ADV_10FULL)
+		cmd->advertising |= ADVERTISE_10FULL;
+	if (bp->flags & B44_FLAG_ADV_100HALF)
+		cmd->advertising |= ADVERTISE_100HALF;
+	if (bp->flags & B44_FLAG_ADV_100FULL)
+		cmd->advertising |= ADVERTISE_100FULL;
+	cmd->advertising |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
+	cmd->speed = (bp->flags & B44_FLAG_100_BASE_T) ?
+		SPEED_100 : SPEED_10;
+	cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ?
+		DUPLEX_FULL : DUPLEX_HALF;
+	cmd->port = 0;
+	cmd->phy_address = bp->phy_addr;
+	cmd->transceiver = (bp->flags & B44_FLAG_INTERNAL_PHY) ?
+		XCVR_INTERNAL : XCVR_EXTERNAL;
+	cmd->autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ?
+		AUTONEG_DISABLE : AUTONEG_ENABLE;
+	cmd->maxtxpkt = 0;
+	cmd->maxrxpkt = 0;
+	return 0;
+}
 
-		spin_lock_irq(&bp->lock);
+static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+	struct b44 *bp = netdev_priv(dev);
 
-		if (cmd.autoneg == AUTONEG_ENABLE) {
-			bp->flags &= ~B44_FLAG_FORCE_LINK;
-			bp->flags &= ~(B44_FLAG_ADV_10HALF |
-				       B44_FLAG_ADV_10FULL |
-				       B44_FLAG_ADV_100HALF |
-				       B44_FLAG_ADV_100FULL);
-			if (cmd.advertising & ADVERTISE_10HALF)
-				bp->flags |= B44_FLAG_ADV_10HALF;
-			if (cmd.advertising & ADVERTISE_10FULL)
-				bp->flags |= B44_FLAG_ADV_10FULL;
-			if (cmd.advertising & ADVERTISE_100HALF)
-				bp->flags |= B44_FLAG_ADV_100HALF;
-			if (cmd.advertising & ADVERTISE_100FULL)
-				bp->flags |= B44_FLAG_ADV_100FULL;
-		} else {
-			bp->flags |= B44_FLAG_FORCE_LINK;
-			if (cmd.speed == SPEED_100)
-				bp->flags |= B44_FLAG_100_BASE_T;
-			if (cmd.duplex == DUPLEX_FULL)
-				bp->flags |= B44_FLAG_FULL_DUPLEX;
-		}
+	if (!(bp->flags & B44_FLAG_INIT_COMPLETE))
+		return -EAGAIN;
 
-		b44_setup_phy(bp);
+	/* We do not support gigabit. */
+	if (cmd->autoneg == AUTONEG_ENABLE) {
+		if (cmd->advertising &
+		    (ADVERTISED_1000baseT_Half |
+		     ADVERTISED_1000baseT_Full))
+			return -EINVAL;
+	} else if ((cmd->speed != SPEED_100 &&
+		    cmd->speed != SPEED_10) ||
+		   (cmd->duplex != DUPLEX_HALF &&
+		    cmd->duplex != DUPLEX_FULL)) {
+			return -EINVAL;
+	}
 
-		spin_unlock_irq(&bp->lock);
+	spin_lock_irq(&bp->lock);
 
-		return 0;
+	if (cmd->autoneg == AUTONEG_ENABLE) {
+		bp->flags &= ~B44_FLAG_FORCE_LINK;
+		bp->flags &= ~(B44_FLAG_ADV_10HALF |
+			       B44_FLAG_ADV_10FULL |
+			       B44_FLAG_ADV_100HALF |
+			       B44_FLAG_ADV_100FULL);
+		if (cmd->advertising & ADVERTISE_10HALF)
+			bp->flags |= B44_FLAG_ADV_10HALF;
+		if (cmd->advertising & ADVERTISE_10FULL)
+			bp->flags |= B44_FLAG_ADV_10FULL;
+		if (cmd->advertising & ADVERTISE_100HALF)
+			bp->flags |= B44_FLAG_ADV_100HALF;
+		if (cmd->advertising & ADVERTISE_100FULL)
+			bp->flags |= B44_FLAG_ADV_100FULL;
+	} else {
+		bp->flags |= B44_FLAG_FORCE_LINK;
+		if (cmd->speed == SPEED_100)
+			bp->flags |= B44_FLAG_100_BASE_T;
+		if (cmd->duplex == DUPLEX_FULL)
+			bp->flags |= B44_FLAG_FULL_DUPLEX;
 	}
 
-	case ETHTOOL_GMSGLVL: {
-		struct ethtool_value edata = { ETHTOOL_GMSGLVL };
-		edata.data = bp->msg_enable;
-		if (copy_to_user(useraddr, &edata, sizeof(edata)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_SMSGLVL: {
-		struct ethtool_value edata;
-		if (copy_from_user(&edata, useraddr, sizeof(edata)))
-			return -EFAULT;
-		bp->msg_enable = edata.data;
-		return 0;
-	}
-	case ETHTOOL_NWAY_RST: {
-		u32 bmcr;
-		int r;
+	b44_setup_phy(bp);
 
-		spin_lock_irq(&bp->lock);
-		b44_readphy(bp, MII_BMCR, &bmcr);
-		b44_readphy(bp, MII_BMCR, &bmcr);
-		r = -EINVAL;
-		if (bmcr & BMCR_ANENABLE) {
-			b44_writephy(bp, MII_BMCR,
-				     bmcr | BMCR_ANRESTART);
-			r = 0;
-		}
-		spin_unlock_irq(&bp->lock);
+	spin_unlock_irq(&bp->lock);
 
-		return r;
-	}
-	case ETHTOOL_GLINK: {
-		struct ethtool_value edata = { ETHTOOL_GLINK };
-		edata.data = netif_carrier_ok(bp->dev) ? 1 : 0;
-		if (copy_to_user(useraddr, &edata, sizeof(edata)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_GRINGPARAM: {
-		struct ethtool_ringparam ering = { ETHTOOL_GRINGPARAM };
+	return 0;
+}
 
-		ering.rx_max_pending = B44_RX_RING_SIZE - 1;
-		ering.rx_pending = bp->rx_pending;
+static void b44_get_ringparam(struct net_device *dev,
+			      struct ethtool_ringparam *ering)
+{
+	struct b44 *bp = netdev_priv(dev);
 
-		/* XXX ethtool lacks a tx_max_pending, oops... */
+	ering->rx_max_pending = B44_RX_RING_SIZE - 1;
+	ering->rx_pending = bp->rx_pending;
 
-		if (copy_to_user(useraddr, &ering, sizeof(ering)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_SRINGPARAM: {
-		struct ethtool_ringparam ering;
+	/* XXX ethtool lacks a tx_max_pending, oops... */
+}
 
-		if (copy_from_user(&ering, useraddr, sizeof(ering)))
-			return -EFAULT;
+static int b44_set_ringparam(struct net_device *dev,
+			     struct ethtool_ringparam *ering)
+{
+	struct b44 *bp = netdev_priv(dev);
 
-		if ((ering.rx_pending > B44_RX_RING_SIZE - 1) ||
-		    (ering.rx_mini_pending != 0) ||
-		    (ering.rx_jumbo_pending != 0) ||
-		    (ering.tx_pending > B44_TX_RING_SIZE - 1))
-			return -EINVAL;
+	if ((ering->rx_pending > B44_RX_RING_SIZE - 1) ||
+	    (ering->rx_mini_pending != 0) ||
+	    (ering->rx_jumbo_pending != 0) ||
+	    (ering->tx_pending > B44_TX_RING_SIZE - 1))
+		return -EINVAL;
 
-		spin_lock_irq(&bp->lock);
+	spin_lock_irq(&bp->lock);
 
-		bp->rx_pending = ering.rx_pending;
-		bp->tx_pending = ering.tx_pending;
+	bp->rx_pending = ering->rx_pending;
+	bp->tx_pending = ering->tx_pending;
 
-		b44_halt(bp);
-		b44_init_rings(bp);
-		b44_init_hw(bp);
-		netif_wake_queue(bp->dev);
-		spin_unlock_irq(&bp->lock);
+	b44_halt(bp);
+	b44_init_rings(bp);
+	b44_init_hw(bp);
+	netif_wake_queue(bp->dev);
+	spin_unlock_irq(&bp->lock);
 
-		b44_enable_ints(bp);
-		
-		return 0;
-	}
-	case ETHTOOL_GPAUSEPARAM: {
-		struct ethtool_pauseparam epause = { ETHTOOL_GPAUSEPARAM };
+	b44_enable_ints(bp);
+	
+	return 0;
+}
 
-		epause.autoneg =
-			(bp->flags & B44_FLAG_PAUSE_AUTO) != 0;
-		epause.rx_pause =
-			(bp->flags & B44_FLAG_RX_PAUSE) != 0;
-		epause.tx_pause =
-			(bp->flags & B44_FLAG_TX_PAUSE) != 0;
-		if (copy_to_user(useraddr, &epause, sizeof(epause)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_SPAUSEPARAM: {
-		struct ethtool_pauseparam epause;
+static void b44_get_pauseparam(struct net_device *dev,
+				struct ethtool_pauseparam *epause)
+{
+	struct b44 *bp = netdev_priv(dev);
 
-		if (copy_from_user(&epause, useraddr, sizeof(epause)))
-			return -EFAULT;
+	epause->autoneg =
+		(bp->flags & B44_FLAG_PAUSE_AUTO) != 0;
+	epause->rx_pause =
+		(bp->flags & B44_FLAG_RX_PAUSE) != 0;
+	epause->tx_pause =
+		(bp->flags & B44_FLAG_TX_PAUSE) != 0;
+}
 
-		spin_lock_irq(&bp->lock);
-		if (epause.autoneg)
-			bp->flags |= B44_FLAG_PAUSE_AUTO;
-		else
-			bp->flags &= ~B44_FLAG_PAUSE_AUTO;
-		if (epause.rx_pause)
-			bp->flags |= B44_FLAG_RX_PAUSE;
-		else
-			bp->flags &= ~B44_FLAG_RX_PAUSE;
-		if (epause.tx_pause)
-			bp->flags |= B44_FLAG_TX_PAUSE;
-		else
-			bp->flags &= ~B44_FLAG_TX_PAUSE;
-		if (bp->flags & B44_FLAG_PAUSE_AUTO) {
-			b44_halt(bp);
-			b44_init_rings(bp);
-			b44_init_hw(bp);
-		} else {
-			__b44_set_flow_ctrl(bp, bp->flags);
-		}
-		spin_unlock_irq(&bp->lock);
+static int b44_set_pauseparam(struct net_device *dev,
+				struct ethtool_pauseparam *epause)
+{
+	struct b44 *bp = netdev_priv(dev);
 
-		b44_enable_ints(bp);
-		
-		return 0;
+	spin_lock_irq(&bp->lock);
+	if (epause->autoneg)
+		bp->flags |= B44_FLAG_PAUSE_AUTO;
+	else
+		bp->flags &= ~B44_FLAG_PAUSE_AUTO;
+	if (epause->rx_pause)
+		bp->flags |= B44_FLAG_RX_PAUSE;
+	else
+		bp->flags &= ~B44_FLAG_RX_PAUSE;
+	if (epause->tx_pause)
+		bp->flags |= B44_FLAG_TX_PAUSE;
+	else
+		bp->flags &= ~B44_FLAG_TX_PAUSE;
+	if (bp->flags & B44_FLAG_PAUSE_AUTO) {
+		b44_halt(bp);
+		b44_init_rings(bp);
+		b44_init_hw(bp);
+	} else {
+		__b44_set_flow_ctrl(bp, bp->flags);
 	}
-	};
+	spin_unlock_irq(&bp->lock);
 
-	return -EOPNOTSUPP;
+	b44_enable_ints(bp);
+	
+	return 0;
 }
 
+static struct ethtool_ops b44_ethtool_ops = {
+	.get_drvinfo		= b44_get_drvinfo,
+	.get_settings		= b44_get_settings,
+	.set_settings		= b44_set_settings,
+	.nway_reset		= b44_nway_reset,
+	.get_link		= ethtool_op_get_link,
+	.get_ringparam		= b44_get_ringparam,
+	.set_ringparam		= b44_set_ringparam,
+	.get_pauseparam		= b44_get_pauseparam,
+	.set_pauseparam		= b44_set_pauseparam,
+	.get_msglevel		= b44_get_msglevel,
+	.set_msglevel		= b44_set_msglevel,
+};
+
 static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-	struct mii_ioctl_data __user *data = (struct mii_ioctl_data __user *)&ifr->ifr_data;
-	struct b44 *bp = dev->priv;
+	struct mii_ioctl_data *data = if_mii(ifr);
+	struct b44 *bp = netdev_priv(dev);
 	int err;
 
-	switch (cmd) {
-	case SIOCETHTOOL:
-		return b44_ethtool_ioctl(dev, (void __user*) ifr->ifr_data);
-
-	case SIOCGMIIPHY:
-		data->phy_id = bp->phy_addr;
-
-		/* fallthru */
-	case SIOCGMIIREG: {
-		u32 mii_regval;
-
-		spin_lock_irq(&bp->lock);
-		err = b44_readphy(bp, data->reg_num & 0x1f, &mii_regval);
-		spin_unlock_irq(&bp->lock);
-
-		data->val_out = mii_regval;
-
-		return err;
-	}
-
-	case SIOCSMIIREG:
-		if (!capable(CAP_NET_ADMIN))
-			return -EPERM;
-
-		spin_lock_irq(&bp->lock);
-		err = b44_writephy(bp, data->reg_num & 0x1f, data->val_in);
-		spin_unlock_irq(&bp->lock);
-
-		return err;
+	spin_lock_irq(&bp->lock);
+	err = generic_mii_ioctl(&bp->mii_if, data, cmd, NULL);
+	spin_unlock_irq(&bp->lock);
 
-	default:
-		/* do nothing */
-		break;
-	};
-	return -EOPNOTSUPP;
+	return err;
 }
 
 /* Read 128-bytes of EEPROM. */
@@ -1772,7 +1750,7 @@
 	/* No interesting netdevice features in this card... */
 	dev->features |= 0;
 
-	bp = dev->priv;
+	bp = netdev_priv(dev);
 	bp->pdev = pdev;
 	bp->dev = dev;
 	if (b44_debug >= 0)
@@ -1806,6 +1784,7 @@
 	dev->watchdog_timeo = B44_TX_TIMEOUT;
 	dev->change_mtu = b44_change_mtu;
 	dev->irq = pdev->irq;
+	SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
 
 	err = b44_get_invariants(bp);
 	if (err) {
@@ -1814,6 +1793,13 @@
 		goto err_out_iounmap;
 	}
 
+	bp->mii_if.dev = dev;
+	bp->mii_if.mdio_read = b44_mii_read;
+	bp->mii_if.mdio_write = b44_mii_write;
+	bp->mii_if.phy_id = bp->phy_addr;
+	bp->mii_if.phy_id_mask = 0x1f;
+	bp->mii_if.reg_num_mask = 0x1f;
+
 	/* By default, advertise all speed/duplex settings. */
 	bp->flags |= (B44_FLAG_ADV_10HALF | B44_FLAG_ADV_10FULL |
 		      B44_FLAG_ADV_100HALF | B44_FLAG_ADV_100FULL);
@@ -1859,8 +1845,10 @@
 	struct net_device *dev = pci_get_drvdata(pdev);
 
 	if (dev) {
+		struct b44 *bp = netdev_priv(dev);
+
 		unregister_netdev(dev);
-		iounmap((void *) ((struct b44 *)(dev->priv))->regs);
+		iounmap((void *) bp->regs);
 		free_netdev(dev);
 		pci_release_regions(pdev);
 		pci_disable_device(pdev);
@@ -1894,10 +1882,10 @@
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct b44 *bp = dev->priv;
 
+	pci_restore_state(pdev, bp->pci_cfg_state);
+
 	if (!netif_running(dev))
 		return 0;
-
-	pci_restore_state(pdev, bp->pci_cfg_state);
 
 	spin_lock_irq(&bp->lock);
 
diff -Nru a/drivers/net/b44.h b/drivers/net/b44.h
--- a/drivers/net/b44.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/b44.h	Tue Jun 15 22:20:42 2004
@@ -542,6 +542,8 @@
 	u8			phy_addr;
 	u8			mdc_port;
 	u8			core_unit;
+
+	struct mii_if_info	mii_if;
 };
 
 #endif /* _B44_H */
diff -Nru a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
--- a/drivers/net/bonding/bond_main.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/net/bonding/bond_main.c	Tue Jun 15 22:21:02 2004
@@ -1103,7 +1103,7 @@
 
 		/* Yes, the mii is overlaid on the ifreq.ifr_ifru */
 		strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ);
-		mii = (struct mii_ioctl_data *)&ifr.ifr_data;
+		mii = if_mii(&ifr);
 		if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) {
 			mii->reg_num = MII_BMSR;
 			if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) {
@@ -2357,10 +2357,10 @@
 static int bond_ethtool_ioctl(struct net_device *bond_dev, struct ifreq *ifr)
 {
 	struct ethtool_drvinfo info;
-	void *addr = ifr->ifr_data;
+	void __user *addr = ifr->ifr_data;
 	uint32_t cmd;
 
-	if (get_user(cmd, (uint32_t *)addr)) {
+	if (get_user(cmd, (uint32_t __user *)addr)) {
 		return -EFAULT;
 	}
 
@@ -3667,8 +3667,10 @@
 static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd)
 {
 	struct net_device *slave_dev = NULL;
-	struct ifbond *u_binfo = NULL, k_binfo;
-	struct ifslave *u_sinfo = NULL, k_sinfo;
+	struct ifbond k_binfo;
+	struct ifbond __user *u_binfo = NULL;
+	struct ifslave k_sinfo;
+	struct ifslave __user *u_sinfo = NULL;
 	struct mii_ioctl_data *mii = NULL;
 	int prev_abi_ver = orig_app_abi_ver;
 	int res = 0;
@@ -3680,7 +3682,7 @@
 	case SIOCETHTOOL:
 		return bond_ethtool_ioctl(bond_dev, ifr);
 	case SIOCGMIIPHY:
-		mii = (struct mii_ioctl_data *)&ifr->ifr_data;
+		mii = if_mii(ifr);
 		if (!mii) {
 			return -EINVAL;
 		}
@@ -3691,7 +3693,7 @@
 		 * We do this again just in case we were called by SIOCGMIIREG
 		 * instead of SIOCGMIIPHY.
 		 */
-		mii = (struct mii_ioctl_data *)&ifr->ifr_data;
+		mii = if_mii(ifr);
 		if (!mii) {
 			return -EINVAL;
 		}
@@ -3711,7 +3713,7 @@
 		return 0;
 	case BOND_INFO_QUERY_OLD:
 	case SIOCBONDINFOQUERY:
-		u_binfo = (struct ifbond *)ifr->ifr_data;
+		u_binfo = (struct ifbond __user *)ifr->ifr_data;
 
 		if (copy_from_user(&k_binfo, u_binfo, sizeof(ifbond))) {
 			return -EFAULT;
@@ -3727,7 +3729,7 @@
 		return res;
 	case BOND_SLAVE_INFO_QUERY_OLD:
 	case SIOCBONDSLAVEINFOQUERY:
-		u_sinfo = (struct ifslave *)ifr->ifr_data;
+		u_sinfo = (struct ifslave __user *)ifr->ifr_data;
 
 		if (copy_from_user(&k_sinfo, u_sinfo, sizeof(ifslave))) {
 			return -EFAULT;
diff -Nru a/drivers/net/depca.c b/drivers/net/depca.c
--- a/drivers/net/depca.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/depca.c	Tue Jun 15 22:20:40 2004
@@ -1937,7 +1937,7 @@
 static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct depca_private *lp = (struct depca_private *) dev->priv;
-	struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_data;
+	struct depca_ioctl *ioc = (struct depca_ioctl *) &rq->ifr_ifru;
 	int i, status = 0;
 	u_long ioaddr = dev->base_addr;
 	union {
diff -Nru a/drivers/net/depca.h b/drivers/net/depca.h
--- a/drivers/net/depca.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/depca.h	Tue Jun 15 22:20:41 2004
@@ -162,7 +162,7 @@
 struct depca_ioctl {
 	unsigned short cmd;                /* Command to run */
 	unsigned short len;                /* Length of the data buffer */
-	unsigned char  *data;              /* Pointer to the data buffer */
+	unsigned char  __user *data;       /* Pointer to the data buffer */
 };
 
 /* 
diff -Nru a/drivers/net/dl2k.c b/drivers/net/dl2k.c
--- a/drivers/net/dl2k.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/dl2k.c	Tue Jun 15 22:20:39 2004
@@ -107,7 +107,7 @@
 static void set_multicast (struct net_device *dev);
 static struct net_device_stats *get_stats (struct net_device *dev);
 static int clear_stats (struct net_device *dev);
-static int rio_ethtool_ioctl (struct net_device *dev, void *useraddr);
+static int rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr);
 static int rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
 static int rio_close (struct net_device *dev);
 static int find_miiphy (struct net_device *dev);
@@ -1195,7 +1195,7 @@
 }
 
 static int
-rio_ethtool_ioctl (struct net_device *dev, void *useraddr)
+rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr)
 {
 	struct netdev_private *np = dev->priv;
        	u32 ethcmd;
@@ -1325,7 +1325,7 @@
 {
 	int phy_addr;
 	struct netdev_private *np = dev->priv;
-	struct mii_data *miidata = (struct mii_data *) &rq->ifr_data;
+	struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru;
 	
 	struct netdev_desc *desc;
 	int i;
@@ -1333,7 +1333,7 @@
 	phy_addr = np->phy_addr;
 	switch (cmd) {
 	case SIOCETHTOOL:
-		return rio_ethtool_ioctl (dev, (void *) rq->ifr_data);		
+		return rio_ethtool_ioctl(dev, rq->ifr_data);		
 	case SIOCDEVPRIVATE:
 		break;
 	
diff -Nru a/drivers/net/e100.c b/drivers/net/e100.c
--- a/drivers/net/e100.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/e100.c	Tue Jun 15 22:21:05 2004
@@ -158,7 +158,7 @@
 
 
 #define DRV_NAME		"e100"
-#define DRV_VERSION		"3.0.17"
+#define DRV_VERSION		"3.0.18"
 #define DRV_DESCRIPTION		"Intel(R) PRO/100 Network Driver"
 #define DRV_COPYRIGHT		"Copyright(c) 1999-2004 Intel Corporation"
 #define PFX			DRV_NAME ": "
@@ -641,7 +641,8 @@
 
 	/* Three cmds: write/erase enable, write data, write/erase disable */
 	cmd_addr_data[0] = op_ewen << (addr_len - 2);
-	cmd_addr_data[1] = (((op_write << addr_len) | addr) << 16) | data;
+	cmd_addr_data[1] = (((op_write << addr_len) | addr) << 16) |
+		cpu_to_le16(data);
 	cmd_addr_data[2] = op_ewds << (addr_len - 2);
 
 	/* Bit-bang cmds to write word to eeprom */
@@ -668,7 +669,6 @@
 		writeb(0, &nic->csr->eeprom_ctrl_lo);
 		e100_write_flush(nic); udelay(4);
 	}
-
 };
 
 /* General technique stolen from the eepro100 driver - very clever */
@@ -709,7 +709,7 @@
 	writeb(0, &nic->csr->eeprom_ctrl_lo);
 	e100_write_flush(nic); udelay(4);
 
-	return data;
+	return le16_to_cpu(data);
 };
 
 /* Load entire EEPROM image into driver cache and validate checksum */
@@ -724,12 +724,12 @@
 	for(addr = 0; addr < nic->eeprom_wc; addr++) {
 		nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr);
 		if(addr < nic->eeprom_wc - 1)
-			checksum += nic->eeprom[addr];
+			checksum += cpu_to_le16(nic->eeprom[addr]);
 	}
 
 	/* The checksum, stored in the last word, is calculated such that
 	 * the sum of words should be 0xBABA */
-	checksum = 0xBABA - checksum;
+	checksum = le16_to_cpu(0xBABA - checksum);
 	if(checksum != nic->eeprom[nic->eeprom_wc - 1]) {
 		DPRINTK(PROBE, ERR, "EEPROM corrupted\n");
 		return -EAGAIN;
@@ -756,9 +756,10 @@
 	/* The checksum, stored in the last word, is calculated such that
 	 * the sum of words should be 0xBABA */
 	for(addr = 0; addr < nic->eeprom_wc - 1; addr++)
-		checksum += nic->eeprom[addr];
-	nic->eeprom[nic->eeprom_wc - 1] = 0xBABA - checksum;
-	e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1, 0xBABA - checksum);
+		checksum += cpu_to_le16(nic->eeprom[addr]);
+	nic->eeprom[nic->eeprom_wc - 1] = le16_to_cpu(0xBABA - checksum);
+	e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1,
+		nic->eeprom[nic->eeprom_wc - 1]);
 
 	return 0;
 }
@@ -826,8 +827,8 @@
 	cb->prev->command &= cpu_to_le16(~cb_s);
 
 	while(nic->cb_to_send != nic->cb_to_use) {
-		if(unlikely((err = e100_exec_cmd(nic, nic->cuc_cmd,
-			nic->cb_to_send->dma_addr)))) {
+		if(unlikely(e100_exec_cmd(nic, nic->cuc_cmd,
+			nic->cb_to_send->dma_addr))) {
 			/* Ok, here's where things get sticky.  It's
 			 * possible that we can't schedule the command
 			 * because the controller is too busy, so
@@ -867,12 +868,12 @@
 
 static int mdio_read(struct net_device *netdev, int addr, int reg)
 {
-	return mdio_ctrl(netdev->priv, addr, mdi_read, reg, 0);
+	return mdio_ctrl(netdev_priv(netdev), addr, mdi_read, reg, 0);
 }
 
 static void mdio_write(struct net_device *netdev, int addr, int reg, int data)
 {
-	mdio_ctrl(netdev->priv, addr, mdi_write, reg, data);
+	mdio_ctrl(netdev_priv(netdev), addr, mdi_write, reg, data);
 }
 
 static void e100_get_defaults(struct nic *nic)
@@ -1098,7 +1099,7 @@
 
 static void e100_set_multicast_list(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 
 	DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n",
 		netdev->mc_count, netdev->flags);
@@ -1251,7 +1252,7 @@
 
 static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	int err;
 
 	if(nic->flags & ich_10h_workaround) {
@@ -1322,7 +1323,7 @@
 static void e100_clean_cbs(struct nic *nic)
 {
 	if(nic->cbs) {
-		while(nic->cb_to_clean != nic->cb_to_use) {
+		while(nic->cbs_avail != nic->params.cbs.count) {
 			struct cb *cb = nic->cb_to_clean;
 			if(cb->skb) {
 				pci_unmap_single(nic->pdev,
@@ -1332,8 +1333,8 @@
 				dev_kfree_skb(cb->skb);
 			}
 			nic->cb_to_clean = nic->cb_to_clean->next;
+			nic->cbs_avail++;
 		}
-		nic->cbs_avail = nic->params.cbs.count;
 		pci_free_consistent(nic->pdev,
 			sizeof(struct cb) * nic->params.cbs.count,
 			nic->cbs, nic->cbs_dma_addr);
@@ -1392,12 +1393,12 @@
 	if(!(rx->skb = dev_alloc_skb(RFD_BUF_LEN + rx_offset)))
 		return -ENOMEM;
 
-	/* Align, init, and map the RFA. */
+	/* Align, init, and map the RFD. */
 	rx->skb->dev = nic->netdev;
 	skb_reserve(rx->skb, rx_offset);
 	memcpy(rx->skb->data, &nic->blank_rfd, sizeof(struct rfd));
 	rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data,
-		RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
+		RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
 
 	/* Link the RFD to end of RFA by linking previous RFD to
 	 * this one, and clearing EL bit of previous.  */
@@ -1408,7 +1409,7 @@
 		wmb();
 		prev_rfd->command &= ~cpu_to_le16(cb_el);
 		pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
-					       sizeof(struct rfd), PCI_DMA_TODEVICE);
+			sizeof(struct rfd), PCI_DMA_TODEVICE);
 	}
 
 	return 0;
@@ -1426,7 +1427,7 @@
 
 	/* Need to sync before taking a peek at cb_complete bit */
 	pci_dma_sync_single_for_cpu(nic->pdev, rx->dma_addr,
-				    sizeof(struct rfd), PCI_DMA_FROMDEVICE);
+		sizeof(struct rfd), PCI_DMA_FROMDEVICE);
 	rfd_status = le16_to_cpu(rfd->status);
 
 	DPRINTK(RX_STATUS, DEBUG, "status=0x%04X\n", rfd_status);
@@ -1442,7 +1443,7 @@
 
 	/* Get data */
 	pci_unmap_single(nic->pdev, rx->dma_addr,
-			 RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
+		RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
 
 	/* Pull off the RFD and put the actual data (minus eth hdr) */
 	skb_reserve(skb, sizeof(struct rfd));
@@ -1545,7 +1546,7 @@
 static irqreturn_t e100_intr(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct net_device *netdev = dev_id;
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	u8 stat_ack = readb(&nic->csr->scb.stat_ack);
 
 	DPRINTK(INTR, DEBUG, "stat_ack = 0x%02X\n", stat_ack);
@@ -1577,7 +1578,7 @@
 #ifdef CONFIG_E100_NAPI
 static int e100_poll(struct net_device *netdev, int *budget)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	unsigned int work_to_do = min(netdev->quota, *budget);
 	unsigned int work_done = 0;
 	int tx_cleaned;
@@ -1602,7 +1603,7 @@
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void e100_netpoll(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	e100_disable_irq(nic);
 	e100_intr(nic->pdev->irq, netdev, NULL);
 	e100_enable_irq(nic);
@@ -1611,13 +1612,13 @@
 
 static struct net_device_stats *e100_get_stats(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	return &nic->net_stats;
 }
 
 static int e100_set_mac_address(struct net_device *netdev, void *p)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	struct sockaddr *addr = p;
 
 	if (!is_valid_ether_addr(addr->sa_data))
@@ -1658,17 +1659,16 @@
 		goto err_clean_cbs;
 	e100_set_multicast_list(nic->netdev);
 	e100_start_receiver(nic);
-	netif_start_queue(nic->netdev);
 	mod_timer(&nic->watchdog, jiffies);
 	if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ,
 		nic->netdev->name, nic->netdev)))
 		goto err_no_irq;
 	e100_enable_irq(nic);
+	netif_wake_queue(nic->netdev);
 	return 0;
 
 err_no_irq:
 	del_timer_sync(&nic->watchdog);
-	netif_stop_queue(nic->netdev);
 err_clean_cbs:
 	e100_clean_cbs(nic);
 err_rx_clean_list:
@@ -1689,12 +1689,12 @@
 
 static void e100_tx_timeout(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 
 	DPRINTK(TX_ERR, DEBUG, "scb.status=0x%02X\n",
 		readb(&nic->csr->scb.status));
-	e100_down(netdev->priv);
-	e100_up(netdev->priv);
+	e100_down(netdev_priv(netdev));
+	e100_up(netdev_priv(netdev));
 }
 
 static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
@@ -1770,13 +1770,13 @@
 
 static int e100_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	return mii_ethtool_gset(&nic->mii, cmd);
 }
 
 static int e100_set_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	int err;
 
 	mdio_write(netdev, nic->mii.phy_id, MII_BMCR, BMCR_RESET);
@@ -1789,7 +1789,7 @@
 static void e100_get_drvinfo(struct net_device *netdev,
 	struct ethtool_drvinfo *info)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	strcpy(info->driver, DRV_NAME);
 	strcpy(info->version, DRV_VERSION);
 	strcpy(info->fw_version, "N/A");
@@ -1798,7 +1798,7 @@
 
 static int e100_get_regs_len(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 #define E100_PHY_REGS		0x1C
 #define E100_REGS_LEN		1 + E100_PHY_REGS + \
 	sizeof(nic->mem->dump_buf) / sizeof(u32)
@@ -1808,7 +1808,7 @@
 static void e100_get_regs(struct net_device *netdev,
 	struct ethtool_regs *regs, void *p)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	u32 *buff = p;
 	int i;
 
@@ -1829,14 +1829,14 @@
 
 static void e100_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	wol->supported = (nic->mac >= mac_82558_D101_A4) ?  WAKE_MAGIC : 0;
 	wol->wolopts = (nic->flags & wol_magic) ? WAKE_MAGIC : 0;
 }
 
 static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 
 	if(wol->wolopts != WAKE_MAGIC && wol->wolopts != 0)
 		return -EOPNOTSUPP;
@@ -1854,31 +1854,31 @@
 
 static u32 e100_get_msglevel(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	return nic->msg_enable;
 }
 
 static void e100_set_msglevel(struct net_device *netdev, u32 value)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	nic->msg_enable = value;
 }
 
 static int e100_nway_reset(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	return mii_nway_restart(&nic->mii);
 }
 
 static u32 e100_get_link(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	return mii_link_ok(&nic->mii);
 }
 
 static int e100_get_eeprom_len(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	return nic->eeprom_wc << 1;
 }
 
@@ -1886,7 +1886,7 @@
 static int e100_get_eeprom(struct net_device *netdev,
 	struct ethtool_eeprom *eeprom, u8 *bytes)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 
 	eeprom->magic = E100_EEPROM_MAGIC;
 	memcpy(bytes, &((u8 *)nic->eeprom)[eeprom->offset], eeprom->len);
@@ -1897,10 +1897,11 @@
 static int e100_set_eeprom(struct net_device *netdev,
 	struct ethtool_eeprom *eeprom, u8 *bytes)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 
 	if(eeprom->magic != E100_EEPROM_MAGIC)
 		return -EINVAL;
+
 	memcpy(&((u8 *)nic->eeprom)[eeprom->offset], bytes, eeprom->len);
 
 	return e100_eeprom_save(nic, eeprom->offset >> 1,
@@ -1910,7 +1911,7 @@
 static void e100_get_ringparam(struct net_device *netdev,
 	struct ethtool_ringparam *ring)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	struct param_range *rfds = &nic->params.rfds;
 	struct param_range *cbs = &nic->params.cbs;
 
@@ -1927,7 +1928,7 @@
 static int e100_set_ringparam(struct net_device *netdev,
 	struct ethtool_ringparam *ring)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	struct param_range *rfds = &nic->params.rfds;
 	struct param_range *cbs = &nic->params.cbs;
 
@@ -1960,7 +1961,7 @@
 static void e100_diag_test(struct net_device *netdev,
 	struct ethtool_test *test, u64 *data)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	int i;
 
 	memset(data, 0, E100_TEST_LEN * sizeof(u64));
@@ -1981,7 +1982,7 @@
 
 static int e100_phys_id(struct net_device *netdev, u32 data)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 
 	if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
 		data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
@@ -2017,7 +2018,7 @@
 static void e100_get_ethtool_stats(struct net_device *netdev,
 	struct ethtool_stats *stats, u64 *data)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	int i;
 
 	for(i = 0; i < E100_NET_STATS_LEN; i++)
@@ -2072,10 +2073,9 @@
 
 static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 {
-	struct nic *nic = netdev->priv;
-	struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&ifr->ifr_data;
+	struct nic *nic = netdev_priv(netdev);
 
-	return generic_mii_ioctl(&nic->mii, mii, cmd, NULL);
+	return generic_mii_ioctl(&nic->mii, if_mii(ifr), cmd, NULL);
 }
 
 static int e100_alloc(struct nic *nic)
@@ -2096,7 +2096,7 @@
 
 static int e100_open(struct net_device *netdev)
 {
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 	int err = 0;
 
 	netif_carrier_off(netdev);
@@ -2107,7 +2107,7 @@
 
 static int e100_close(struct net_device *netdev)
 {
-	e100_down(netdev->priv);
+	e100_down(netdev_priv(netdev));
 	return 0;
 }
 
@@ -2143,7 +2143,7 @@
 	netdev->poll_controller = e100_netpoll;
 #endif
 
-	nic = netdev->priv;
+	nic = netdev_priv(netdev);
 	nic->netdev = netdev;
 	nic->pdev = pdev;
 	nic->msg_enable = (1 << debug) - 1;
@@ -2209,9 +2209,8 @@
 
 	if((err = e100_eeprom_load(nic)))
 		goto err_out_free;
-	((u16 *)netdev->dev_addr)[0] = le16_to_cpu(nic->eeprom[0]);
-	((u16 *)netdev->dev_addr)[1] = le16_to_cpu(nic->eeprom[1]);
-	((u16 *)netdev->dev_addr)[2] = le16_to_cpu(nic->eeprom[2]);
+
+	memcpy(netdev->dev_addr, nic->eeprom, ETH_ALEN);
 	if(!is_valid_ether_addr(netdev->dev_addr)) {
 		DPRINTK(PROBE, ERR, "Invalid MAC address from "
 			"EEPROM, aborting.\n");
@@ -2258,7 +2257,7 @@
 	struct net_device *netdev = pci_get_drvdata(pdev);
 
 	if(netdev) {
-		struct nic *nic = netdev->priv;
+		struct nic *nic = netdev_priv(netdev);
 		unregister_netdev(netdev);
 		e100_free(nic);
 		iounmap(nic->csr);
@@ -2273,7 +2272,7 @@
 static int e100_suspend(struct pci_dev *pdev, u32 state)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 
 	if(netif_running(netdev))
 		e100_down(nic);
@@ -2291,7 +2290,7 @@
 static int e100_resume(struct pci_dev *pdev)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
-	struct nic *nic = netdev->priv;
+	struct nic *nic = netdev_priv(netdev);
 
 	pci_set_power_state(pdev, 0);
 	pci_restore_state(pdev, nic->pm_state);
diff -Nru a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
--- a/drivers/net/e1000/e1000.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/e1000/e1000.h	Tue Jun 15 22:20:36 2004
@@ -71,6 +71,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/if_vlan.h>
+#include <linux/moduleparam.h>
 
 #define BAR_0		0
 #define BAR_1		1
@@ -89,6 +90,12 @@
 
 #define E1000_ERR(args...) printk(KERN_ERR "e1000: " args)
 
+#define PFX "e1000: "
+#define DPRINTK(nlevel, klevel, fmt, args...) \
+	(void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
+	printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
+		__FUNCTION__ , ## args))
+
 #define E1000_MAX_INTR 10
 
 /* How many descriptors for TX and RX ? */
@@ -245,5 +252,6 @@
 
 
 	uint32_t pci_state[16];
+	int msg_enable;
 };
 #endif /* _E1000_H_ */
diff -Nru a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
--- a/drivers/net/e1000/e1000_ethtool.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/e1000/e1000_ethtool.c	Tue Jun 15 22:20:40 2004
@@ -53,7 +53,7 @@
 
 #define E1000_STAT(m) sizeof(((struct e1000_adapter *)0)->m), \
 		      offsetof(struct e1000_adapter, m)
-static struct e1000_stats e1000_gstrings_stats[] = {
+static const struct e1000_stats e1000_gstrings_stats[] = {
 	{ "rx_packets", E1000_STAT(net_stats.rx_packets) },
 	{ "tx_packets", E1000_STAT(net_stats.tx_packets) },
 	{ "rx_bytes", E1000_STAT(net_stats.rx_bytes) },
@@ -89,20 +89,22 @@
 	{ "tx_flow_control_xon", E1000_STAT(stats.xontxc) },
 	{ "tx_flow_control_xoff", E1000_STAT(stats.xofftxc) },
 	{ "rx_csum_offload_good", E1000_STAT(hw_csum_good) },
-	{ "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }
+        { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) },
+	{ "rx_long_byte_count", E1000_STAT(stats.gorcl) }
 };
 #define E1000_STATS_LEN	\
 	sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats)
-static char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
+static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
 	"Register test  (offline)", "Eeprom test    (offline)",
 	"Interrupt test (offline)", "Loopback test  (offline)",
 	"Link test   (on/offline)"
 };
 #define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
 
-static void
-e1000_ethtool_gset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
+static int
+e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
 
 	if(hw->media_type == e1000_media_type_copper) {
@@ -169,11 +171,13 @@
 	}
 
 	ecmd->autoneg = (hw->autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
+	return 0;
 }
 
 static int
-e1000_ethtool_sset(struct e1000_adapter *adapter, struct ethtool_cmd *ecmd)
+e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
 
 	if(ecmd->autoneg == AUTONEG_ENABLE) {
@@ -195,42 +199,41 @@
 	return 0;
 }
 
-static int
-e1000_ethtool_gpause(struct e1000_adapter *adapter,
-                     struct ethtool_pauseparam *epause)
+static void 
+e1000_get_pauseparam(struct net_device *netdev,
+                    struct ethtool_pauseparam *pause)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
-	
-	epause->autoneg = 
+	pause->autoneg = 
 		(adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
 	
 	if(hw->fc == e1000_fc_rx_pause)
-		epause->rx_pause = 1;
+		pause->rx_pause = 1;
 	else if(hw->fc == e1000_fc_tx_pause)
-		epause->tx_pause = 1;
+		pause->tx_pause = 1;
 	else if(hw->fc == e1000_fc_full) {
-		epause->rx_pause = 1;
-		epause->tx_pause = 1;
+		pause->rx_pause = 1;
+		pause->tx_pause = 1;
 	}
-	
-	return 0;
 }
 
-static int
-e1000_ethtool_spause(struct e1000_adapter *adapter,
-                     struct ethtool_pauseparam *epause)
+static int 
+e1000_set_pauseparam(struct net_device *netdev,
+                    struct ethtool_pauseparam *pause)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
 	
-	adapter->fc_autoneg = epause->autoneg;
+	adapter->fc_autoneg = pause->autoneg;
 
-	if(epause->rx_pause && epause->tx_pause)
+	if(pause->rx_pause && pause->tx_pause)
 		hw->fc = e1000_fc_full;
-	else if(epause->rx_pause && !epause->tx_pause)
+	else if(pause->rx_pause && !pause->tx_pause)
 		hw->fc = e1000_fc_rx_pause;
-	else if(!epause->rx_pause && epause->tx_pause)
+	else if(!pause->rx_pause && pause->tx_pause)
 		hw->fc = e1000_fc_tx_pause;
-	else if(!epause->rx_pause && !epause->tx_pause)
+	else if(!pause->rx_pause && !pause->tx_pause)
 		hw->fc = e1000_fc_none;
 
 	hw->original_fc = hw->fc;
@@ -248,28 +251,101 @@
 	return 0;
 }
 
+static uint32_t
+e1000_get_rx_csum(struct net_device *netdev)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+	return adapter->rx_csum;
+}
+
+static int
+e1000_set_rx_csum(struct net_device *netdev, uint32_t data)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+	adapter->rx_csum = data;
+
+	if(netif_running(netdev)) {
+		e1000_down(adapter);
+		e1000_up(adapter);
+	} else
+		e1000_reset(adapter);
+	return 0;
+}
+
+static uint32_t
+e1000_get_tx_csum(struct net_device *netdev)
+{
+	return (netdev->features & NETIF_F_HW_CSUM) != 0;
+}
+
+static int
+e1000_set_tx_csum(struct net_device *netdev, uint32_t data)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+
+	if(adapter->hw.mac_type < e1000_82543) {
+		if (!data)
+			return -EINVAL;
+		return 0;
+	}
+
+	if (data)
+		netdev->features |= NETIF_F_HW_CSUM;
+	else
+		netdev->features &= ~NETIF_F_HW_CSUM;
+
+	return 0;
+}
+
+#ifdef NETIF_F_TSO
+static int
+e1000_set_tso(struct net_device *netdev, uint32_t data)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+	if ((adapter->hw.mac_type < e1000_82544) ||
+	    (adapter->hw.mac_type == e1000_82547)) 
+		return data ? -EINVAL : 0;
+
+	if (data)
+		netdev->features |= NETIF_F_TSO;
+	else
+		netdev->features &= ~NETIF_F_TSO;
+	return 0;
+} 
+#endif /* NETIF_F_TSO */
+
+static uint32_t
+e1000_get_msglevel(struct net_device *netdev)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+	return adapter->msg_enable;
+}
+
 static void
-e1000_ethtool_gdrvinfo(struct e1000_adapter *adapter,
-                       struct ethtool_drvinfo *drvinfo)
+e1000_set_msglevel(struct net_device *netdev, uint32_t data)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+	adapter->msg_enable = data;
+}
+
+static int 
+e1000_get_regs_len(struct net_device *netdev)
 {
-	strncpy(drvinfo->driver,  e1000_driver_name, 32);
-	strncpy(drvinfo->version, e1000_driver_version, 32);
-	strncpy(drvinfo->fw_version, "N/A", 32);
-	strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
-	drvinfo->n_stats = E1000_STATS_LEN;
-	drvinfo->testinfo_len = E1000_TEST_LEN;
 #define E1000_REGS_LEN 32
-	drvinfo->regdump_len  = E1000_REGS_LEN * sizeof(uint32_t);
-	drvinfo->eedump_len = adapter->hw.eeprom.word_size * 2;
+	return E1000_REGS_LEN * sizeof(uint32_t);
 }
 
 static void
-e1000_ethtool_gregs(struct e1000_adapter *adapter,
-                    struct ethtool_regs *regs, uint32_t *regs_buff)
+e1000_get_regs(struct net_device *netdev,
+                    struct ethtool_regs *regs, void *p)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
+	uint32_t *regs_buff = p;
 	uint16_t phy_data;
 
+	memset(p, 0, E1000_REGS_LEN * sizeof(uint32_t));
+
 	regs->version = (1 << 24) | (hw->revision_id << 16) | hw->device_id;
 
 	regs_buff[0]  = E1000_READ_REG(hw, CTRL);
@@ -342,37 +418,39 @@
 	e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data);
 	regs_buff[24] = (uint32_t)phy_data;  /* phy local receiver status */
 	regs_buff[25] = regs_buff[24];  /* phy remote receiver status */
+}
 
-	return;
+static int
+e1000_get_eeprom_len(struct net_device *netdev)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+	return adapter->hw.eeprom.word_size * 2;
 }
 
 static int
-e1000_ethtool_geeprom(struct e1000_adapter *adapter,
-                      struct ethtool_eeprom *eeprom, uint16_t *eeprom_buff)
+e1000_get_eeprom(struct net_device *netdev,
+                      struct ethtool_eeprom *eeprom, uint8_t *bytes)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
+	uint16_t *eeprom_buff;
 	int first_word, last_word;
 	int ret_val = 0;
 	uint16_t i;
 
-	if(eeprom->len == 0) {
-		ret_val = -EINVAL;
-		goto geeprom_error;
-	}
+	if(eeprom->len == 0) 
+		return -EINVAL;
 
 	eeprom->magic = hw->vendor_id | (hw->device_id << 16);
 
-	if(eeprom->offset > eeprom->offset + eeprom->len) {
-		ret_val = -EINVAL;
-		goto geeprom_error;
-	}
-
-	if((eeprom->offset + eeprom->len) > (hw->eeprom.word_size * 2))
-		eeprom->len = ((hw->eeprom.word_size * 2) - eeprom->offset);
-
 	first_word = eeprom->offset >> 1;
 	last_word = (eeprom->offset + eeprom->len - 1) >> 1;
 
+	eeprom_buff = kmalloc(sizeof(uint16_t) * 
+			(last_word - first_word + 1), GFP_KERNEL);
+	if (!eeprom_buff)
+		return -ENOMEM;
+
 	if(hw->eeprom.type == e1000_eeprom_spi)
 		ret_val = e1000_read_eeprom(hw, first_word,
 					    last_word - first_word + 1,
@@ -388,14 +466,19 @@
 	for (i = 0; i < last_word - first_word + 1; i++)
 		le16_to_cpus(&eeprom_buff[i]);
 
-geeprom_error:
+
+	memcpy(bytes, (uint8_t *)eeprom_buff + (eeprom->offset%2), 
+				eeprom->len);
+	kfree(eeprom_buff);
+
 	return ret_val;
 }
 
 static int
-e1000_ethtool_seeprom(struct e1000_adapter *adapter,
-                      struct ethtool_eeprom *eeprom, void *user_data)
+e1000_set_eeprom(struct net_device *netdev,
+                      struct ethtool_eeprom *eeprom, uint8_t *bytes)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
 	uint16_t *eeprom_buff;
 	void *ptr;
@@ -410,9 +493,6 @@
 
 	max_len = hw->eeprom.word_size * 2;
 
-	if((eeprom->offset + eeprom->len) > max_len)
-		eeprom->len = (max_len - eeprom->offset);
-
 	first_word = eeprom->offset >> 1;
 	last_word = (eeprom->offset + eeprom->len - 1) >> 1;
 	eeprom_buff = kmalloc(max_len, GFP_KERNEL);
@@ -439,11 +519,7 @@
 	for (i = 0; i < last_word - first_word + 1; i++)
 		le16_to_cpus(&eeprom_buff[i]);
 
-	if((ret_val != 0) || copy_from_user(ptr, user_data, eeprom->len)) {
-		ret_val = -EFAULT;
-		goto seeprom_error;
-	}
-
+	memcpy(ptr, bytes, eeprom->len);
 	for (i = 0; i < last_word - first_word + 1; i++)
 		eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]);
 
@@ -454,15 +530,31 @@
 	if((ret_val == 0) && first_word <= EEPROM_CHECKSUM_REG)
 		e1000_update_eeprom_checksum(hw);
 
-seeprom_error:
 	kfree(eeprom_buff);
 	return ret_val;
 }
 
-static int
-e1000_ethtool_gring(struct e1000_adapter *adapter,
+static void
+e1000_get_drvinfo(struct net_device *netdev,
+                       struct ethtool_drvinfo *drvinfo)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+
+	strncpy(drvinfo->driver,  e1000_driver_name, 32);
+	strncpy(drvinfo->version, e1000_driver_version, 32);
+	strncpy(drvinfo->fw_version, "N/A", 32);
+	strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
+	drvinfo->n_stats = E1000_STATS_LEN;
+	drvinfo->testinfo_len = E1000_TEST_LEN;
+	drvinfo->regdump_len = e1000_get_regs_len(netdev);
+	drvinfo->eedump_len = e1000_get_eeprom_len(netdev);
+}
+
+static void
+e1000_get_ringparam(struct net_device *netdev,
                     struct ethtool_ringparam *ring)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	e1000_mac_type mac_type = adapter->hw.mac_type;
 	struct e1000_desc_ring *txdr = &adapter->tx_ring;
 	struct e1000_desc_ring *rxdr = &adapter->rx_ring;
@@ -477,14 +569,14 @@
 	ring->tx_pending = txdr->count;
 	ring->rx_mini_pending = 0;
 	ring->rx_jumbo_pending = 0;
-
-	return 0;
 }
+
 static int 
-e1000_ethtool_sring(struct e1000_adapter *adapter,
+e1000_set_ringparam(struct net_device *netdev,
                     struct ethtool_ringparam *ring)
 {
 	int err;
+	struct e1000_adapter *adapter = netdev->priv;
 	e1000_mac_type mac_type = adapter->hw.mac_type;
 	struct e1000_desc_ring *txdr = &adapter->tx_ring;
 	struct e1000_desc_ring *rxdr = &adapter->rx_ring;
@@ -538,6 +630,7 @@
 	return err;
 }
 
+
 #define REG_PATTERN_TEST(R, M, W)                                              \
 {                                                                              \
 	uint32_t pat, value;                                                   \
@@ -628,6 +721,7 @@
 	for(i = 0; i < E1000_MC_TBL_SIZE; i++)
 		REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF);
 
+	*data = 0;
 	return 0;
 }
 
@@ -939,8 +1033,6 @@
 	e1000_write_phy_reg(&adapter->hw, 30, 0x8FFC);
 	e1000_write_phy_reg(&adapter->hw, 29, 0x001A);
 	e1000_write_phy_reg(&adapter->hw, 30, 0x8FF0);
-
-	return;
 }
 
 static void
@@ -1219,16 +1311,16 @@
 
 	for(i = 0; i < 64; i++) {
 		e1000_create_lbtest_frame(txdr->buffer_info[i].skb, 1024);
-		pci_dma_sync_single_for_device(pdev, txdr->buffer_info[i].dma,
-					       txdr->buffer_info[i].length,
-					       PCI_DMA_TODEVICE);
+		pci_dma_sync_single(pdev, txdr->buffer_info[i].dma,
+				    txdr->buffer_info[i].length,
+				    PCI_DMA_TODEVICE);
 	}
 	E1000_WRITE_REG(&adapter->hw, TDT, i);
 
 	msec_delay(200);
 
-	pci_dma_sync_single_for_cpu(pdev, rxdr->buffer_info[0].dma,
-				    rxdr->buffer_info[0].length, PCI_DMA_FROMDEVICE);
+	pci_dma_sync_single(pdev, rxdr->buffer_info[0].dma,
+			    rxdr->buffer_info[0].length, PCI_DMA_FROMDEVICE);
 
 	return e1000_check_lbtest_frame(rxdr->buffer_info[0].skb, 1024);
 }
@@ -1257,15 +1349,27 @@
 	return *data;
 }
 
-static int
-e1000_ethtool_test(struct e1000_adapter *adapter,
+static int 
+e1000_diag_test_count(struct net_device *netdev)
+{
+	return E1000_TEST_LEN;
+}
+
+static void
+e1000_diag_test(struct net_device *netdev, 
 		   struct ethtool_test *eth_test, uint64_t *data)
 {
-	boolean_t if_running = netif_running(adapter->netdev);
+	struct e1000_adapter *adapter = netdev->priv;
+	boolean_t if_running = netif_running(netdev);
 
 	if(eth_test->flags == ETH_TEST_FL_OFFLINE) {
 		/* Offline tests */
 
+		/* save speed, duplex, autoneg settings */
+		uint16_t autoneg_advertised = adapter->hw.autoneg_advertised;
+    		uint8_t forced_speed_duplex = adapter->hw.forced_speed_duplex;
+		uint8_t autoneg = adapter->hw.autoneg;
+
 		/* Link test performed before hardware reset so autoneg doesn't
 		 * interfere with test result */
 		if(e1000_link_test(adapter, &data[4]))
@@ -1291,6 +1395,10 @@
 		if(e1000_loopback_test(adapter, &data[3]))
 			eth_test->flags |= ETH_TEST_FL_FAILED;
 
+		/* restore Autoneg/speed/duplex settings */
+		adapter->hw.autoneg_advertised = autoneg_advertised;
+    		adapter->hw.forced_speed_duplex = forced_speed_duplex;
+    		adapter->hw.autoneg = autoneg;
 		e1000_reset(adapter);
 		if(if_running)
 			e1000_up(adapter);
@@ -1305,12 +1413,12 @@
 		data[2] = 0;
 		data[3] = 0;
 	}
-	return 0;
 }
 
 static void
-e1000_ethtool_gwol(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol)
+e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
 
 	switch(adapter->hw.device_id) {
@@ -1350,8 +1458,9 @@
 }
 
 static int
-e1000_ethtool_swol(struct e1000_adapter *adapter, struct ethtool_wolinfo *wol)
+e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 {
+	struct e1000_adapter *adapter = netdev->priv;
 	struct e1000_hw *hw = &adapter->hw;
 
 	switch(adapter->hw.device_id) {
@@ -1387,7 +1496,6 @@
 	return 0;
 }
 
-
 /* toggle LED 4 times per second = 2 "blinks" per second */
 #define E1000_ID_INTERVAL	(HZ/4)
 
@@ -1408,8 +1516,13 @@
 }
 
 static int
-e1000_ethtool_led_blink(struct e1000_adapter *adapter, struct ethtool_value *id)
+e1000_phys_id(struct net_device *netdev, uint32_t data)
 {
+	struct e1000_adapter *adapter = netdev->priv;
+
+	if(!data || data > (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ))
+		data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ);
+
 	if(!adapter->blink_timer.function) {
 		init_timer(&adapter->blink_timer);
 		adapter->blink_timer.function = e1000_led_blink_callback;
@@ -1420,11 +1533,8 @@
 	mod_timer(&adapter->blink_timer, jiffies);
 
 	set_current_state(TASK_INTERRUPTIBLE);
-	if(id->data)
-		schedule_timeout(id->data * HZ);
-	else
-		schedule_timeout(MAX_SCHEDULE_TIMEOUT);
 
+	schedule_timeout(data * HZ);
 	del_timer_sync(&adapter->blink_timer);
 	e1000_led_off(&adapter->hw);
 	clear_bit(E1000_LED_ON, &adapter->led_status);
@@ -1433,345 +1543,96 @@
 	return 0;
 }
 
-int
-e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
+static int
+e1000_nway_reset(struct net_device *netdev)
 {
 	struct e1000_adapter *adapter = netdev->priv;
-	void *addr = ifr->ifr_data;
-	uint32_t cmd;
-
-	if(get_user(cmd, (uint32_t *) addr))
-		return -EFAULT;
-
-	switch(cmd) {
-	case ETHTOOL_GSET: {
-		struct ethtool_cmd ecmd = {ETHTOOL_GSET};
-		e1000_ethtool_gset(adapter, &ecmd);
-		if(copy_to_user(addr, &ecmd, sizeof(ecmd)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_SSET: {
-		struct ethtool_cmd ecmd;
-		if(copy_from_user(&ecmd, addr, sizeof(ecmd)))
-			return -EFAULT;
-		return e1000_ethtool_sset(adapter, &ecmd);
-	}
-	case ETHTOOL_GDRVINFO: {
-		struct ethtool_drvinfo drvinfo = {ETHTOOL_GDRVINFO};
-		e1000_ethtool_gdrvinfo(adapter, &drvinfo);
-		if(copy_to_user(addr, &drvinfo, sizeof(drvinfo)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_GSTRINGS: {
-		struct ethtool_gstrings gstrings = { ETHTOOL_GSTRINGS };
-		char *strings = NULL;
-		int err = 0;
-
-		if(copy_from_user(&gstrings, addr, sizeof(gstrings)))
-			return -EFAULT;
-		switch(gstrings.string_set) {
-		case ETH_SS_TEST:
-			gstrings.len = E1000_TEST_LEN;
-			strings = kmalloc(E1000_TEST_LEN * ETH_GSTRING_LEN,
-					  GFP_KERNEL);
-			if(!strings)
-				return -ENOMEM;
-			memcpy(strings, e1000_gstrings_test, E1000_TEST_LEN *
-			       ETH_GSTRING_LEN);
-			break;
-		case ETH_SS_STATS: {
-			int i;
-			gstrings.len = E1000_STATS_LEN;
-			strings = kmalloc(E1000_STATS_LEN * ETH_GSTRING_LEN,
-					  GFP_KERNEL);
-			if(!strings)
-				return -ENOMEM;
-			for(i=0; i < E1000_STATS_LEN; i++) {
-				memcpy(&strings[i * ETH_GSTRING_LEN],
-				       e1000_gstrings_stats[i].stat_string,
-				       ETH_GSTRING_LEN);
-			}
-			break;
-		}
-		default:
-			return -EOPNOTSUPP;
-		}
-		if(copy_to_user(addr, &gstrings, sizeof(gstrings)))
-			err = -EFAULT;
-		addr += offsetof(struct ethtool_gstrings, data);
-		if(!err && copy_to_user(addr, strings,
-		   gstrings.len * ETH_GSTRING_LEN))
-			err = -EFAULT;
-
-		kfree(strings);
-		return err;
-	}
-	case ETHTOOL_GREGS: {
-		struct ethtool_regs regs = {ETHTOOL_GREGS};
-		uint32_t regs_buff[E1000_REGS_LEN];
-
-		if(copy_from_user(&regs, addr, sizeof(regs)))
-			return -EFAULT;
-		memset(regs_buff, 0, sizeof(regs_buff));
-		if (regs.len > E1000_REGS_LEN)
-			regs.len = E1000_REGS_LEN;
-		e1000_ethtool_gregs(adapter, &regs, regs_buff);
-		if(copy_to_user(addr, &regs, sizeof(regs)))
-			return -EFAULT;
-
-		addr += offsetof(struct ethtool_regs, data);
-		if(copy_to_user(addr, regs_buff, regs.len))
-			return -EFAULT;
-
-		return 0;
-	}
-	case ETHTOOL_NWAY_RST: {
-		if(netif_running(netdev)) {
-			e1000_down(adapter);
-			e1000_up(adapter);
-		}
-		return 0;
-	}
-	case ETHTOOL_PHYS_ID: {
-		struct ethtool_value id;
-		if(copy_from_user(&id, addr, sizeof(id)))
-			return -EFAULT;
-		return e1000_ethtool_led_blink(adapter, &id);
-	}
-	case ETHTOOL_GLINK: {
-		struct ethtool_value link = {ETHTOOL_GLINK};
-		link.data = netif_carrier_ok(netdev);
-		if(copy_to_user(addr, &link, sizeof(link)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_GWOL: {
-		struct ethtool_wolinfo wol = {ETHTOOL_GWOL};
-		e1000_ethtool_gwol(adapter, &wol);
-		if(copy_to_user(addr, &wol, sizeof(wol)) != 0)
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_SWOL: {
-		struct ethtool_wolinfo wol;
-		if(copy_from_user(&wol, addr, sizeof(wol)) != 0)
-			return -EFAULT;
-		return e1000_ethtool_swol(adapter, &wol);
-	}
-	case ETHTOOL_GEEPROM: {
-		struct ethtool_eeprom eeprom = {ETHTOOL_GEEPROM};
-		struct e1000_hw *hw = &adapter->hw;
-		uint16_t *eeprom_buff;
-		void *ptr;
-		int err = 0;
-
-		if(copy_from_user(&eeprom, addr, sizeof(eeprom)))
-			return -EFAULT;
-
-		eeprom_buff = kmalloc(hw->eeprom.word_size * 2, GFP_KERNEL);
-
-		if(!eeprom_buff)
-			return -ENOMEM;
-
-		if((err = e1000_ethtool_geeprom(adapter, &eeprom,
-						eeprom_buff)))
-			goto err_geeprom_ioctl;
-
-		if(copy_to_user(addr, &eeprom, sizeof(eeprom))) {
-			err = -EFAULT;
-			goto err_geeprom_ioctl;
-		}
-
-		addr += offsetof(struct ethtool_eeprom, data);
-		ptr = ((void *)eeprom_buff) + (eeprom.offset & 1);
-
-		if(copy_to_user(addr, ptr, eeprom.len))
-			err = -EFAULT;
-
-err_geeprom_ioctl:
-		kfree(eeprom_buff);
-		return err;
-	}
-	case ETHTOOL_SEEPROM: {
-		struct ethtool_eeprom eeprom;
-
-		if(copy_from_user(&eeprom, addr, sizeof(eeprom)))
-			return -EFAULT;
-
-		addr += offsetof(struct ethtool_eeprom, data);
-		return e1000_ethtool_seeprom(adapter, &eeprom, addr);
-	}
-	case ETHTOOL_GRINGPARAM: {
-		struct ethtool_ringparam ering = {ETHTOOL_GRINGPARAM};
-		e1000_ethtool_gring(adapter, &ering);
-		if(copy_to_user(addr, &ering, sizeof(ering)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_SRINGPARAM: {
-		struct ethtool_ringparam ering;
-		if(copy_from_user(&ering, addr, sizeof(ering)))
-			return -EFAULT;
-		return e1000_ethtool_sring(adapter, &ering);
-	}
-	case ETHTOOL_GPAUSEPARAM: {
-		struct ethtool_pauseparam epause = {ETHTOOL_GPAUSEPARAM};
-		e1000_ethtool_gpause(adapter, &epause);
-		if(copy_to_user(addr, &epause, sizeof(epause)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_SPAUSEPARAM: {
-		struct ethtool_pauseparam epause;
-		if(copy_from_user(&epause, addr, sizeof(epause)))
-			return -EFAULT;
-		return e1000_ethtool_spause(adapter, &epause);
-	}
-	case ETHTOOL_GSTATS: {
-		struct {
-			struct ethtool_stats eth_stats;
-			uint64_t data[E1000_STATS_LEN];
-		} stats = { {ETHTOOL_GSTATS, E1000_STATS_LEN} };
-		int i;
-
-		e1000_update_stats(adapter);
-		for(i = 0; i < E1000_STATS_LEN; i++)
-			stats.data[i] = (e1000_gstrings_stats[i].sizeof_stat ==
-					sizeof(uint64_t)) ?
-				*(uint64_t *)((char *)adapter +
-					e1000_gstrings_stats[i].stat_offset) :
-				*(uint32_t *)((char *)adapter +
-					e1000_gstrings_stats[i].stat_offset);
-		if(copy_to_user(addr, &stats, sizeof(stats)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_TEST: {
-		struct {
-			struct ethtool_test eth_test;
-			uint64_t data[E1000_TEST_LEN];
-		} test = { {ETHTOOL_TEST} };
-		int err;
-
-		if(copy_from_user(&test.eth_test, addr, sizeof(test.eth_test)))
-			return -EFAULT;
-
-		test.eth_test.len = E1000_TEST_LEN;
-
-		if((err = e1000_ethtool_test(adapter, &test.eth_test,
-					     test.data)))
-			return err;
-
-		if(copy_to_user(addr, &test, sizeof(test)) != 0)
-			return -EFAULT;
-		return 0;
+	if(netif_running(netdev)) {
+		e1000_down(adapter);
+		e1000_up(adapter);
 	}
-	case ETHTOOL_GRXCSUM: {
-		struct ethtool_value edata = { ETHTOOL_GRXCSUM };
+	return 0;
+}
 
-		edata.data = adapter->rx_csum;
-		if (copy_to_user(addr, &edata, sizeof(edata)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_SRXCSUM: {
-		struct ethtool_value edata;
+static int 
+e1000_get_stats_count(struct net_device *netdev)
+{
+	return E1000_STATS_LEN;
+}
 
-		if (copy_from_user(&edata, addr, sizeof(edata)))
-			return -EFAULT;
-		adapter->rx_csum = edata.data;
-		if(netif_running(netdev)) {
-			e1000_down(adapter);
-			e1000_up(adapter);
-		} else
-			e1000_reset(adapter);
-		return 0;
-	}
-	case ETHTOOL_GTXCSUM: {
-		struct ethtool_value edata = { ETHTOOL_GTXCSUM };
+static void 
+e1000_get_ethtool_stats(struct net_device *netdev, 
+		struct ethtool_stats *stats, uint64_t *data)
+{
+	struct e1000_adapter *adapter = netdev->priv;
+	int i;
 
-		edata.data =
-			(netdev->features & NETIF_F_HW_CSUM) != 0;
-		if (copy_to_user(addr, &edata, sizeof(edata)))
-			return -EFAULT;
-		return 0;
+	e1000_update_stats(adapter);
+	for(i = 0; i < E1000_STATS_LEN; i++) {
+		char *p = (char *)adapter+e1000_gstrings_stats[i].stat_offset;	
+		data[i] = (e1000_gstrings_stats[i].sizeof_stat == sizeof(uint64_t)) 
+			? *(uint64_t *)p : *(uint32_t *)p;
 	}
-	case ETHTOOL_STXCSUM: {
-		struct ethtool_value edata;
+}
 
-		if (copy_from_user(&edata, addr, sizeof(edata)))
-			return -EFAULT;
+static void 
+e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data)
+{
+	int i;
 
-		if(adapter->hw.mac_type < e1000_82543) {
-			if (edata.data != 0)
-				return -EINVAL;
-			return 0;
+	switch(stringset) {
+	case ETH_SS_TEST:
+		memcpy(data, *e1000_gstrings_test, 
+			E1000_TEST_LEN*ETH_GSTRING_LEN);
+		break;
+	case ETH_SS_STATS:
+		for (i=0; i < E1000_STATS_LEN; i++) {
+			memcpy(data + i * ETH_GSTRING_LEN, 
+			e1000_gstrings_stats[i].stat_string,
+			ETH_GSTRING_LEN);
 		}
-
-		if (edata.data)
-			netdev->features |= NETIF_F_HW_CSUM;
-		else
-			netdev->features &= ~NETIF_F_HW_CSUM;
-
-		return 0;
-	}
-	case ETHTOOL_GSG: {
-		struct ethtool_value edata = { ETHTOOL_GSG };
-
-		edata.data =
-			(netdev->features & NETIF_F_SG) != 0;
-		if (copy_to_user(addr, &edata, sizeof(edata)))
-			return -EFAULT;
-		return 0;
+		break;
 	}
-	case ETHTOOL_SSG: {
-		struct ethtool_value edata;
-
-		if (copy_from_user(&edata, addr, sizeof(edata)))
-			return -EFAULT;
-
-		if (edata.data)
-			netdev->features |= NETIF_F_SG;
-		else
-			netdev->features &= ~NETIF_F_SG;
+}
 
-		return 0;
-	}
+struct ethtool_ops e1000_ethtool_ops = {
+	.get_settings           = e1000_get_settings,
+	.set_settings           = e1000_set_settings,
+	.get_drvinfo            = e1000_get_drvinfo,
+	.get_regs_len           = e1000_get_regs_len,
+	.get_regs               = e1000_get_regs,
+	.get_wol                = e1000_get_wol,
+	.set_wol                = e1000_set_wol,
+	.get_msglevel	        = e1000_get_msglevel,
+	.set_msglevel	        = e1000_set_msglevel,
+	.nway_reset             = e1000_nway_reset,
+	.get_link               = ethtool_op_get_link,
+	.get_eeprom_len         = e1000_get_eeprom_len,
+	.get_eeprom             = e1000_get_eeprom,
+	.set_eeprom             = e1000_set_eeprom,
+	.get_ringparam          = e1000_get_ringparam,
+	.set_ringparam          = e1000_set_ringparam,
+	.get_pauseparam		= e1000_get_pauseparam,
+	.set_pauseparam		= e1000_set_pauseparam,
+	.get_rx_csum		= e1000_get_rx_csum,
+	.set_rx_csum		= e1000_set_rx_csum,
+	.get_tx_csum		= e1000_get_tx_csum,
+	.set_tx_csum		= e1000_set_tx_csum,
+	.get_sg			= ethtool_op_get_sg,
+	.set_sg			= ethtool_op_set_sg,
 #ifdef NETIF_F_TSO
-	case ETHTOOL_GTSO: {
-		struct ethtool_value edata = { ETHTOOL_GTSO };
-
-		edata.data = (netdev->features & NETIF_F_TSO) != 0;
-		if (copy_to_user(addr, &edata, sizeof(edata)))
-			return -EFAULT;
-		return 0;
-	}
-	case ETHTOOL_STSO: {
-		struct ethtool_value edata;
-
-		if (copy_from_user(&edata, addr, sizeof(edata)))
-			return -EFAULT;
-
-		if ((adapter->hw.mac_type < e1000_82544) ||
-		    (adapter->hw.mac_type == e1000_82547)) {
-			if (edata.data != 0)
-				return -EINVAL;
-			return 0;
-		}
-
-		if (edata.data)
-			netdev->features |= NETIF_F_TSO;
-		else
-			netdev->features &= ~NETIF_F_TSO;
-
-		return 0;
-	}
+	.get_tso		= ethtool_op_get_tso,
+	.set_tso		= e1000_set_tso,
 #endif
-	default:
-		return -EOPNOTSUPP;
-	}
-}
-
+	.self_test_count        = e1000_diag_test_count,
+	.self_test              = e1000_diag_test,
+	.get_strings            = e1000_get_strings,
+	.phys_id                = e1000_phys_id,
+	.get_stats_count        = e1000_get_stats_count,
+	.get_ethtool_stats      = e1000_get_ethtool_stats,
+};
 
+void set_ethtool_ops(struct net_device *netdev)
+{
+	SET_ETHTOOL_OPS(netdev, &e1000_ethtool_ops);
+}
diff -Nru a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
--- a/drivers/net/e1000/e1000_hw.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/net/e1000/e1000_hw.c	Tue Jun 15 22:21:04 2004
@@ -470,7 +470,6 @@
     uint16_t pcix_stat_hi_word;
     uint16_t cmd_mmrbc;
     uint16_t stat_mmrbc;
-
     DEBUGFUNC("e1000_init_hw");
 
     /* Initialize Identification LED */
@@ -910,6 +909,12 @@
     if(ret_val)
         return ret_val;
 
+    if(hw->mac_type == e1000_82545_rev_3) {
+        ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
+        phy_data |= 0x00000008;
+        ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
+    }
+
     if(hw->mac_type <= e1000_82543 ||
        hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 ||
        hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2)
@@ -1961,7 +1966,7 @@
 int32_t
 e1000_check_for_link(struct e1000_hw *hw)
 {
-    uint32_t rxcw;
+    uint32_t rxcw = 0;
     uint32_t ctrl;
     uint32_t status;
     uint32_t rctl;
@@ -1971,16 +1976,23 @@
 
     DEBUGFUNC("e1000_check_for_link");
 
+    ctrl = E1000_READ_REG(hw, CTRL);
+    status = E1000_READ_REG(hw, STATUS);
+
     /* On adapters with a MAC newer than 82544, SW Defineable pin 1 will be
      * set when the optics detect a signal. On older adapters, it will be
      * cleared when there is a signal.  This applies to fiber media only.
      */
-    if(hw->media_type == e1000_media_type_fiber)
-        signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0;
-
-    ctrl = E1000_READ_REG(hw, CTRL);
-    status = E1000_READ_REG(hw, STATUS);
-    rxcw = E1000_READ_REG(hw, RXCW);
+    if((hw->media_type == e1000_media_type_fiber) ||
+       (hw->media_type == e1000_media_type_internal_serdes)) {
+        rxcw = E1000_READ_REG(hw, RXCW);
+
+        if(hw->media_type == e1000_media_type_fiber) {
+            signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0;
+            if(status & E1000_STATUS_LU)
+                hw->get_link_status = FALSE;
+        }
+    }
 
     /* If we have a copper PHY then we only want to go out to the PHY
      * registers to see if Auto-Neg has completed and/or if our link
@@ -2093,8 +2105,8 @@
      * in. The autoneg_failed flag does this.
      */
     else if((((hw->media_type == e1000_media_type_fiber) &&
-            ((ctrl & E1000_CTRL_SWDPIN1) == signal)) ||
-            (hw->media_type == e1000_media_type_internal_serdes)) &&
+              ((ctrl & E1000_CTRL_SWDPIN1) == signal)) ||
+             (hw->media_type == e1000_media_type_internal_serdes)) &&
             (!(status & E1000_STATUS_LU)) &&
             (!(rxcw & E1000_RXCW_C))) {
         if(hw->autoneg_failed == 0) {
@@ -2125,8 +2137,7 @@
      */
     else if(((hw->media_type == e1000_media_type_fiber) ||
              (hw->media_type == e1000_media_type_internal_serdes)) &&
-              (ctrl & E1000_CTRL_SLU) &&
-              (rxcw & E1000_RXCW_C)) {
+            (ctrl & E1000_CTRL_SLU) && (rxcw & E1000_RXCW_C)) {
         DEBUGOUT("RXing /C/, enable AutoNeg and stop forcing link.\r\n");
         E1000_WRITE_REG(hw, TXCW, hw->txcw);
         E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU));
diff -Nru a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
--- a/drivers/net/e1000/e1000_hw.h	Tue Jun 15 22:20:44 2004
+++ b/drivers/net/e1000/e1000_hw.h	Tue Jun 15 22:20:44 2004
@@ -2019,7 +2019,7 @@
 #define IGP01E1000_PSSR_MDIX_SHIFT             0x000B /* shift right 11 */
 
 /* IGP01E1000 Specific Port Control Register - R/W */
-#define IGP01E1000_PSCR_TP_LOOPBACK            0x0001
+#define IGP01E1000_PSCR_TP_LOOPBACK            0x0010
 #define IGP01E1000_PSCR_CORRECT_NC_SCMBLR      0x0200
 #define IGP01E1000_PSCR_TEN_CRS_SELECT         0x0400
 #define IGP01E1000_PSCR_FLIP_CHIP              0x0800
@@ -2029,16 +2029,18 @@
 /* IGP01E1000 Specific Port Link Health Register */
 #define IGP01E1000_PLHR_SS_DOWNGRADE           0x8000
 #define IGP01E1000_PLHR_GIG_SCRAMBLER_ERROR    0x4000
+#define IGP01E1000_PLHR_MASTER_FAULT           0x2000
+#define IGP01E1000_PLHR_MASTER_RESOLUTION      0x1000
 #define IGP01E1000_PLHR_GIG_REM_RCVR_NOK       0x0800 /* LH */
 #define IGP01E1000_PLHR_IDLE_ERROR_CNT_OFLOW   0x0400 /* LH */
 #define IGP01E1000_PLHR_DATA_ERR_1             0x0200 /* LH */
 #define IGP01E1000_PLHR_DATA_ERR_0             0x0100
-#define IGP01E1000_PLHR_AUTONEG_FAULT          0x0010
-#define IGP01E1000_PLHR_AUTONEG_ACTIVE         0x0008
-#define IGP01E1000_PLHR_VALID_CHANNEL_D        0x0004
-#define IGP01E1000_PLHR_VALID_CHANNEL_C        0x0002
-#define IGP01E1000_PLHR_VALID_CHANNEL_B        0x0001
-#define IGP01E1000_PLHR_VALID_CHANNEL_A        0x0000
+#define IGP01E1000_PLHR_AUTONEG_FAULT          0x0040
+#define IGP01E1000_PLHR_AUTONEG_ACTIVE         0x0010
+#define IGP01E1000_PLHR_VALID_CHANNEL_D        0x0008
+#define IGP01E1000_PLHR_VALID_CHANNEL_C        0x0004
+#define IGP01E1000_PLHR_VALID_CHANNEL_B        0x0002
+#define IGP01E1000_PLHR_VALID_CHANNEL_A        0x0001
 
 /* IGP01E1000 Channel Quality Register */
 #define IGP01E1000_MSE_CHANNEL_D        0x000F
diff -Nru a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
--- a/drivers/net/e1000/e1000_main.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/e1000/e1000_main.c	Tue Jun 15 22:20:39 2004
@@ -27,55 +27,32 @@
 *******************************************************************************/
 
 #include "e1000.h"
+#include <linux/rtnetlink.h>
 
 /* Change Log
  *
+ * 5.2.51   5/14/04
+ *   o set default configuration to 'NAPI disabled'. NAPI enabled driver
+ *     causes kernel panic when the interface is shutdown while data is being
+ *     transferred.
+ * 5.2.47   5/04/04
+ *   o fixed ethtool -t implementation
+ * 5.2.45   4/29/04
+ *   o fixed ethtool -e implementation
+ *   o Support for ethtool ops [Stephen Hemminger (shemminger@osdl.org)]
+ * 5.2.42   4/26/04
+ *   o Added support for the DPRINTK macro for enhanced error logging.  Some
+ *     parts of the patch were supplied by Jon Mason.
+ *   o Move the register_netdevice() donw in the probe routine due to a 
+ *     loading/unloading test issue.
+ *   o Added a long RX byte count the the extra ethtool data members for BER
+ *     testing purposes.
  * 5.2.39	3/12/04
- *   o Added support to read/write eeprom data in proper order.
- *     By default device eeprom is always little-endian, word
- *     addressable 
- *   o Disable TSO as the default for the driver until hangs
- *     reported against non-IA acrhs can be root-caused.
- *   o Back out the CSA fix for 82547 as it continues to cause
- *     systems lock-ups with production systems.
- *   o Fixed FC high/low water mark values to actually be in the
- *     range of the Rx FIFO area.  It was a math error.
- *     [Dainis Jonitis (dainis_jonitis@exigengroup.lv)]
- *   o Handle failure to get new resources when doing ethtool
- *     ring paramater changes.  Previously, driver would free old,
- *     but fails to allocate new, causing problems.  Now, driver 
- *     allocates new, and if sucessful, frees old.
- *   o Changed collision threshold from 16 to 15 to comply with IEEE
- *     spec.
- *   o Toggle chip-select when checking ready status on SPI eeproms.
- *   o Put PHY into class A mode to pass IEEE tests on some designs.
- *     Designs with EEPROM word 0x7, bit 15 set will have their PHYs
- *     set to class A mode, rather than the default class AB.
- *   o Handle failures of register_netdev.  Stephen Hemminger
- *     [shemminger@osdl.org].
- *   o updated README & MAN pages, number of Transmit/Receive
- *     descriptors may be denied depending on system resources.
- *
- * 5.2.30	1/14/03
- *   o Set VLAN filtering to IEEE 802.1Q after reset so we don't break
- *     SoL connections that use VLANs.
- *   o Allow 1000/Full setting for AutoNeg param for Fiber connections
- *     Jon D Mason [jonmason@us.ibm.com].
- *   o Race between Tx queue and Tx clean fixed with a spin lock.
- *   o Added netpoll support.
- *   o Fixed endianess bug causing ethtool loopback diags to fail on ppc.
- *   o Use pdev->irq rather than netdev->irq in preparation for MSI support.
- *   o Report driver message on user override of InterruptThrottleRate
- *     module parameter.
- *   o Change I/O address storage from uint32_t to unsigned long.
- *   o Added ethtool RINGPARAM support.
- *
- * 5.2.22	10/15/03
  */
 
 char e1000_driver_name[] = "e1000";
 char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
-char e1000_driver_version[] = "5.2.39-k2";
+char e1000_driver_version[] = "5.2.52-k4";
 char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation.";
 
 /* e1000_pci_tbl - PCI Device ID Table
@@ -170,6 +147,7 @@
 static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
 static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
 			   int cmd);
+void set_ethtool_ops(struct net_device *netdev);
 static void e1000_enter_82542_rst(struct e1000_adapter *adapter);
 static void e1000_leave_82542_rst(struct e1000_adapter *adapter);
 static inline void e1000_rx_checksum(struct e1000_adapter *adapter,
@@ -206,7 +184,7 @@
 /* Exported from other modules */
 
 extern void e1000_check_options(struct e1000_adapter *adapter);
-extern int e1000_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr);
+
 
 static struct pci_driver e1000_driver = {
 	.name     = e1000_driver_name,
@@ -224,6 +202,10 @@
 MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver");
 MODULE_LICENSE("GPL");
 
+static int debug = 3;
+module_param(debug, int, 0);
+MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
+
 /**
  * e1000_init_module - Driver Registration Routine
  *
@@ -419,6 +401,12 @@
 	adapter->netdev = netdev;
 	adapter->pdev = pdev;
 	adapter->hw.back = adapter;
+	adapter->msg_enable = (1 << debug) - 1;
+
+	rtnl_lock();
+	/* we need to set the name early since the DPRINTK macro needs it set */
+	if (dev_alloc_name(netdev, netdev->name) < 0) 
+		goto err_free_unlock;
 
 	mmio_start = pci_resource_start(pdev, BAR_0);
 	mmio_len = pci_resource_len(pdev, BAR_0);
@@ -446,6 +434,7 @@
 	netdev->set_mac_address = &e1000_set_mac;
 	netdev->change_mtu = &e1000_change_mtu;
 	netdev->do_ioctl = &e1000_ioctl;
+	set_ethtool_ops(netdev);
 	netdev->tx_timeout = &e1000_tx_timeout;
 	netdev->watchdog_timeo = 5 * HZ;
 #ifdef CONFIG_E1000_NAPI
@@ -502,7 +491,7 @@
 	/* make sure the EEPROM is good */
 
 	if(e1000_validate_eeprom_checksum(&adapter->hw) < 0) {
-		printk(KERN_ERR "The EEPROM Checksum Is Not Valid\n");
+		DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
 		err = -EIO;
 		goto err_eeprom;
 	}
@@ -536,16 +525,12 @@
 	INIT_WORK(&adapter->tx_timeout_task,
 		(void (*)(void *))e1000_tx_timeout_task, netdev);
 
-	if((err = register_netdev(netdev)))
-		goto err_register;
-
 	/* we're going to reset, so assume we have no link for now */
 
 	netif_carrier_off(netdev);
 	netif_stop_queue(netdev);
 
-	printk(KERN_INFO "%s: Intel(R) PRO/1000 Network Connection\n",
-	       netdev->name);
+	DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
 	e1000_check_options(adapter);
 
 	/* Initial Wake on LAN setting
@@ -579,7 +564,12 @@
 
 	e1000_reset(adapter);
 
+	/* since we are holding the rtnl lock already, call the no-lock version */
+	if((err = register_netdevice(netdev)))
+		goto err_register;
+
 	cards_found++;
+	rtnl_unlock();
 	return 0;
 
 err_register:
@@ -587,6 +577,8 @@
 err_eeprom:
 	iounmap(adapter->hw.hw_addr);
 err_ioremap:
+err_free_unlock:
+	rtnl_unlock();
 	free_netdev(netdev);
 err_alloc_etherdev:
 	pci_release_regions(pdev);
@@ -664,7 +656,7 @@
 	/* identify the MAC */
 
 	if (e1000_set_mac_type(hw)) {
-		E1000_ERR("Unknown MAC Type\n");
+		DPRINTK(PROBE, ERR, "Unknown MAC Type\n");
 		return -EIO;
 	}
 
@@ -1391,9 +1383,8 @@
 			                           &adapter->link_speed,
 			                           &adapter->link_duplex);
 
-			printk(KERN_INFO
-			       "e1000: %s NIC Link is Up %d Mbps %s\n",
-			       netdev->name, adapter->link_speed,
+			DPRINTK(LINK, INFO, "NIC Link is Up %d Mbps %s\n",
+			       adapter->link_speed,
 			       adapter->link_duplex == FULL_DUPLEX ?
 			       "Full Duplex" : "Half Duplex");
 
@@ -1406,9 +1397,7 @@
 		if(netif_carrier_ok(netdev)) {
 			adapter->link_speed = 0;
 			adapter->link_duplex = 0;
-			printk(KERN_INFO
-			       "e1000: %s NIC Link is Down\n",
-			       netdev->name);
+			DPRINTK(LINK, INFO, "NIC Link is Down\n");
 			netif_carrier_off(netdev);
 			netif_stop_queue(netdev);
 			mod_timer(&adapter->phy_info_timer, jiffies + 2 * HZ);
@@ -1560,33 +1549,17 @@
 
 static inline int
 e1000_tx_map(struct e1000_adapter *adapter, struct sk_buff *skb,
-	unsigned int first)
+	unsigned int first, unsigned int max_per_txd,
+	unsigned int nr_frags, unsigned int mss)
 {
 	struct e1000_desc_ring *tx_ring = &adapter->tx_ring;
-	struct e1000_tx_desc *tx_desc;
 	struct e1000_buffer *buffer_info;
-	unsigned int len = skb->len, max_per_txd = E1000_MAX_DATA_PER_TXD;
+	unsigned int len = skb->len;
 	unsigned int offset = 0, size, count = 0, i;
-#ifdef NETIF_F_TSO
-	unsigned int mss;
-#endif
-	unsigned int nr_frags;
 	unsigned int f;
-
-#ifdef NETIF_F_TSO
-	mss = skb_shinfo(skb)->tso_size;
-	/* The controller does a simple calculation to 
-	 * make sure there is enough room in the FIFO before
-	 * initiating the DMA for each buffer.  The calc is:
-	 * 4 = ceil(buffer len/mss).  To make sure we don't
-	 * overrun the FIFO, adjust the max buffer len if mss
-	 * drops. */
-	if(mss)
-		max_per_txd = min(mss << 2, max_per_txd);
-#endif
-	nr_frags = skb_shinfo(skb)->nr_frags;
 	len -= skb->data_len;
 
+
 	i = tx_ring->next_to_use;
 
 	while(len) {
@@ -1658,46 +1631,6 @@
 			if(++i == tx_ring->count) i = 0;
 		}
 	}
-
-	if(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2) {
-
-		/* There aren't enough descriptors available to queue up
-		 * this send (need: count + 1 context desc + 1 desc gap
-		 * to keep tail from touching head), so undo the mapping
-		 * and abort the send.  We could have done the check before
-		 * we mapped the skb, but because of all the workarounds
-		 * (above), it's too difficult to predict how many we're
-		 * going to need.*/
-		i = tx_ring->next_to_use;
-
-		if(i == first) {
-			/* Cleanup after e1000_tx_[csum|tso] scribbling
-			 * on descriptors. */
-			tx_desc = E1000_TX_DESC(*tx_ring, first);
-			tx_desc->buffer_addr = 0;
-			tx_desc->lower.data = 0;
-			tx_desc->upper.data = 0;
-		}
-
-		while(count--) {
-			buffer_info = &tx_ring->buffer_info[i];
-
-			if(buffer_info->dma) {
-				pci_unmap_page(adapter->pdev,
-					       buffer_info->dma,
-					       buffer_info->length,
-					       PCI_DMA_TODEVICE);
-				buffer_info->dma = 0;
-			}
-
-			if(++i == tx_ring->count) i = 0;
-		}
-
-		tx_ring->next_to_use = first;
-
-		return 0;
-	}
-
 	i = (i == 0) ? tx_ring->count - 1 : i - 1;
 	tx_ring->buffer_info[i].skb = skb;
 	tx_ring->buffer_info[first].next_to_watch = i;
@@ -1792,27 +1725,72 @@
 	return 0;
 }
 
+#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 ) 
 static int
 e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 {
 	struct e1000_adapter *adapter = netdev->priv;
-	unsigned int first;
+	unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD;
+	unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
 	unsigned int tx_flags = 0;
 	unsigned long flags;
-	int count;
-
+	unsigned int len = skb->len;
+	int count = 0;
+	unsigned int mss = 0;
+	unsigned int nr_frags = 0;
+	unsigned int f;
+	nr_frags = skb_shinfo(skb)->nr_frags;
+	len -= skb->data_len;
 	if(skb->len <= 0) {
 		dev_kfree_skb_any(skb);
 		return 0;
 	}
 
+#ifdef NETIF_F_TSO
+	mss = skb_shinfo(skb)->tso_size;
+	/* The controller does a simple calculation to 
+	 * make sure there is enough room in the FIFO before
+	 * initiating the DMA for each buffer.  The calc is:
+	 * 4 = ceil(buffer len/mss).  To make sure we don't
+	 * overrun the FIFO, adjust the max buffer len if mss
+	 * drops. */
+	if(mss) {
+		max_per_txd = min(mss << 2, max_per_txd);
+		max_txd_pwr = fls(max_per_txd) - 1;
+	}
+	if((mss) || (skb->ip_summed == CHECKSUM_HW))
+		count++;
+	count++;	/*for sentinel desc*/
+#else
+	if(skb->ip_summed == CHECKSUM_HW)
+		count++;
+#endif
+
+	count += TXD_USE_COUNT(len, max_txd_pwr);
+	if(adapter->pcix_82544)
+		count++;
+
+	nr_frags = skb_shinfo(skb)->nr_frags;
+	for(f = 0; f < nr_frags; f++)
+		count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size,
+		                       max_txd_pwr);
+	if(adapter->pcix_82544)
+		count += nr_frags;
+	
 	spin_lock_irqsave(&adapter->tx_lock, flags);
+	/* need: count +  2 desc gap to keep tail from touching 
+	 * head, otherwise try next time */
+	if(E1000_DESC_UNUSED(&adapter->tx_ring) < count + 2 ) {
+		netif_stop_queue(netdev);
+		spin_unlock_irqrestore(&adapter->tx_lock, flags);
+		return 1;
+	}
+	spin_unlock_irqrestore(&adapter->tx_lock, flags);
 
 	if(adapter->hw.mac_type == e1000_82547) {
 		if(e1000_82547_fifo_workaround(adapter, skb)) {
 			netif_stop_queue(netdev);
 			mod_timer(&adapter->tx_fifo_stall_timer, jiffies);
-			spin_unlock_irqrestore(&adapter->tx_lock, flags);
 			return 1;
 		}
 	}
@@ -1829,18 +1807,12 @@
 	else if(e1000_tx_csum(adapter, skb))
 		tx_flags |= E1000_TX_FLAGS_CSUM;
 
-	if((count = e1000_tx_map(adapter, skb, first)))
-		e1000_tx_queue(adapter, count, tx_flags);
-	else {
-		netif_stop_queue(netdev);
-		spin_unlock_irqrestore(&adapter->tx_lock, flags);
-		return 1;
-	}
+	e1000_tx_queue(adapter, 
+		e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss), 
+		tx_flags);
 
 	netdev->trans_start = jiffies;
 
-	spin_unlock_irqrestore(&adapter->tx_lock, flags);
-	
 	return 0;
 }
 
@@ -1903,7 +1875,7 @@
 
 	if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
 	   (max_frame > MAX_JUMBO_FRAME_SIZE)) {
-		E1000_ERR("Invalid MTU setting\n");
+		DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
 		return -EINVAL;
 	}
 
@@ -1911,7 +1883,7 @@
 		adapter->rx_buffer_len = E1000_RXBUFFER_2048;
 
 	} else if(adapter->hw.mac_type < e1000_82543) {
-		E1000_ERR("Jumbo Frames not supported on 82542\n");
+		DPRINTK(PROBE, ERR, "Jumbo Frames not supported on 82542\n");
 		return -EINVAL;
 
 	} else if(max_frame <= E1000_RXBUFFER_4096) {
@@ -2171,6 +2143,7 @@
 	if(work_done < work_to_do || !netif_running(netdev)) {
 		netif_rx_complete(netdev);
 		e1000_irq_enable(adapter);
+		return 0;
 	}
 
 	return (work_done >= work_to_do);
@@ -2193,7 +2166,6 @@
 	unsigned int i, eop;
 	boolean_t cleaned = FALSE;
 
-	spin_lock(&adapter->tx_lock);
 
 	i = tx_ring->next_to_clean;
 	eop = tx_ring->buffer_info[i].next_to_watch;
@@ -2236,6 +2208,8 @@
 
 	tx_ring->next_to_clean = i;
 
+	spin_lock(&adapter->tx_lock);
+
 	if(cleaned && netif_queue_stopped(netdev) && netif_carrier_ok(netdev))
 		netif_wake_queue(netdev);
 
@@ -2296,7 +2270,8 @@
 
 			/* All receives must fit into a single buffer */
 
-			E1000_DBG("Receive packet consumed multiple buffers\n");
+			E1000_DBG("%s: Receive packet consumed multiple buffers\n",
+				netdev->name);
 
 			dev_kfree_skb_irq(skb);
 			rx_desc->status = 0;
@@ -2513,8 +2488,6 @@
 	case SIOCGMIIREG:
 	case SIOCSMIIREG:
 		return e1000_mii_ioctl(netdev, ifr, cmd);
-	case SIOCETHTOOL:
-		return e1000_ethtool_ioctl(netdev, ifr);
 	default:
 		return -EOPNOTSUPP;
 	}
@@ -2531,7 +2504,7 @@
 e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 {
 	struct e1000_adapter *adapter = netdev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data;
+	struct mii_ioctl_data *data = if_mii(ifr);
 	int retval;
 	uint16_t mii_reg;
 	uint16_t spddplx;
diff -Nru a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
--- a/drivers/net/e1000/e1000_param.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/e1000/e1000_param.c	Tue Jun 15 22:20:42 2004
@@ -234,7 +234,8 @@
 };
 
 static int __devinit
-e1000_validate_option(int *value, struct e1000_option *opt)
+e1000_validate_option(int *value, struct e1000_option *opt,
+	struct e1000_adapter *adapter)
 {
 	if(*value == OPTION_UNSET) {
 		*value = opt->def;
@@ -245,16 +246,17 @@
 	case enable_option:
 		switch (*value) {
 		case OPTION_ENABLED:
-			printk(KERN_INFO "%s Enabled\n", opt->name);
+			DPRINTK(PROBE, INFO, "%s Enabled\n", opt->name);
 			return 0;
 		case OPTION_DISABLED:
-			printk(KERN_INFO "%s Disabled\n", opt->name);
+			DPRINTK(PROBE, INFO, "%s Disabled\n", opt->name);
 			return 0;
 		}
 		break;
 	case range_option:
 		if(*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
-			printk(KERN_INFO "%s set to %i\n", opt->name, *value);
+			DPRINTK(PROBE, INFO,
+				"%s set to %i\n", opt->name, *value);
 			return 0;
 		}
 		break;
@@ -266,7 +268,7 @@
 			ent = &opt->arg.l.p[i];
 			if(*value == ent->i) {
 				if(ent->str[0] != '\0')
-					printk(KERN_INFO "%s\n", ent->str);
+					DPRINTK(PROBE, INFO, "%s\n", ent->str);
 				return 0;
 			}
 		}
@@ -276,7 +278,7 @@
 		BUG();
 	}
 
-	printk(KERN_INFO "Invalid %s specified (%i) %s\n",
+	DPRINTK(PROBE, INFO, "Invalid %s specified (%i) %s\n",
 	       opt->name, *value, opt->err);
 	*value = opt->def;
 	return -1;
@@ -300,9 +302,9 @@
 {
 	int bd = adapter->bd_number;
 	if(bd >= E1000_MAX_NIC) {
-		printk(KERN_NOTICE
+		DPRINTK(PROBE, NOTICE,
 		       "Warning: no configuration for board #%i\n", bd);
-		printk(KERN_NOTICE "Using defaults for all values\n");
+		DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
 		bd = E1000_MAX_NIC;
 	}
 
@@ -321,7 +323,7 @@
 			E1000_MAX_TXD : E1000_MAX_82544_TXD;
 
 		tx_ring->count = TxDescriptors[bd];
-		e1000_validate_option(&tx_ring->count, &opt);
+		e1000_validate_option(&tx_ring->count, &opt, adapter);
 		E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE);
 	}
 	{ /* Receive Descriptor Count */
@@ -339,7 +341,7 @@
 			E1000_MAX_82544_RXD;
 
 		rx_ring->count = RxDescriptors[bd];
-		e1000_validate_option(&rx_ring->count, &opt);
+		e1000_validate_option(&rx_ring->count, &opt, adapter);
 		E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE);
 	}
 	{ /* Checksum Offload Enable/Disable */
@@ -351,7 +353,7 @@
 		};
 
 		int rx_csum = XsumRX[bd];
-		e1000_validate_option(&rx_csum, &opt);
+		e1000_validate_option(&rx_csum, &opt, adapter);
 		adapter->rx_csum = rx_csum;
 	}
 	{ /* Flow Control */
@@ -373,7 +375,7 @@
 		};
 
 		int fc = FlowControl[bd];
-		e1000_validate_option(&fc, &opt);
+		e1000_validate_option(&fc, &opt, adapter);
 		adapter->hw.fc = adapter->hw.original_fc = fc;
 	}
 	{ /* Transmit Interrupt Delay */
@@ -387,7 +389,7 @@
 		};
 
 		adapter->tx_int_delay = TxIntDelay[bd];
-		e1000_validate_option(&adapter->tx_int_delay, &opt);
+		e1000_validate_option(&adapter->tx_int_delay, &opt, adapter);
 	}
 	{ /* Transmit Absolute Interrupt Delay */
 		struct e1000_option opt = {
@@ -400,7 +402,7 @@
 		};
 
 		adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
-		e1000_validate_option(&adapter->tx_abs_int_delay, &opt);
+		e1000_validate_option(&adapter->tx_abs_int_delay, &opt, adapter);
 	}
 	{ /* Receive Interrupt Delay */
 		struct e1000_option opt = {
@@ -413,7 +415,7 @@
 		};
 
 		adapter->rx_int_delay = RxIntDelay[bd];
-		e1000_validate_option(&adapter->rx_int_delay, &opt);
+		e1000_validate_option(&adapter->rx_int_delay, &opt, adapter);
 	}
 	{ /* Receive Absolute Interrupt Delay */
 		struct e1000_option opt = {
@@ -426,7 +428,7 @@
 		};
 
 		adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
-		e1000_validate_option(&adapter->rx_abs_int_delay, &opt);
+		e1000_validate_option(&adapter->rx_abs_int_delay, &opt, adapter);
 	}
 	{ /* Interrupt Throttling Rate */
 		struct e1000_option opt = {
@@ -444,13 +446,14 @@
 			adapter->itr = 1;
 			break;
 		case 0:
-			printk(KERN_INFO "%s turned off\n", opt.name);
+			DPRINTK(PROBE, INFO, "%s turned off\n", opt.name);
 			break;
 		case 1:
-			printk(KERN_INFO "%s set to dynamic mode\n", opt.name);
+			DPRINTK(PROBE, INFO,
+				"%s set to dynamic mode\n", opt.name);
 			break;
 		default:
-			e1000_validate_option(&adapter->itr, &opt);
+			e1000_validate_option(&adapter->itr, &opt, adapter);
 			break;
 		}
 	}
@@ -482,15 +485,15 @@
 	bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
 
 	if((Speed[bd] != OPTION_UNSET)) {
-		printk(KERN_INFO "Speed not valid for fiber adapters, "
+		DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
 		       "parameter ignored\n");
 	}
 	if((Duplex[bd] != OPTION_UNSET)) {
-		printk(KERN_INFO "Duplex not valid for fiber adapters, "
+		DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
 		       "parameter ignored\n");
 	}
 	if((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {
-		printk(KERN_INFO "AutoNeg other than Full/1000 is "
+		DPRINTK(PROBE, INFO, "AutoNeg other than Full/1000 is "
 		       "not valid for fiber adapters, parameter ignored\n");
 	}
 }
@@ -525,7 +528,7 @@
 		};
 
 		speed = Speed[bd];
-		e1000_validate_option(&speed, &opt);
+		e1000_validate_option(&speed, &opt, adapter);
 	}
 	{ /* Duplex */
 		struct e1000_opt_list dplx_list[] = {{           0, "" },
@@ -542,11 +545,11 @@
 		};
 
 		dplx = Duplex[bd];
-		e1000_validate_option(&dplx, &opt);
+		e1000_validate_option(&dplx, &opt, adapter);
 	}
 
 	if(AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) {
-		printk(KERN_INFO
+		DPRINTK(PROBE, INFO,
 		       "AutoNeg specified along with Speed or Duplex, "
 		       "parameter ignored\n");
 		adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
@@ -595,7 +598,7 @@
 		};
 
 		int an = AutoNeg[bd];
-		e1000_validate_option(&an, &opt);
+		e1000_validate_option(&an, &opt, adapter);
 		adapter->hw.autoneg_advertised = an;
 	}
 
@@ -603,78 +606,85 @@
 	case 0:
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
 		if(Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET)
-			printk(KERN_INFO
+			DPRINTK(PROBE, INFO,
 			       "Speed and duplex autonegotiation enabled\n");
 		break;
 	case HALF_DUPLEX:
-		printk(KERN_INFO "Half Duplex specified without Speed\n");
-		printk(KERN_INFO "Using Autonegotiation at Half Duplex only\n");
+		DPRINTK(PROBE, INFO, "Half Duplex specified without Speed\n");
+		DPRINTK(PROBE, INFO,
+			"Using Autonegotiation at Half Duplex only\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
 		adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
 		                                 ADVERTISE_100_HALF;
 		break;
 	case FULL_DUPLEX:
-		printk(KERN_INFO "Full Duplex specified without Speed\n");
-		printk(KERN_INFO "Using Autonegotiation at Full Duplex only\n");
+		DPRINTK(PROBE, INFO, "Full Duplex specified without Speed\n");
+		DPRINTK(PROBE, INFO,
+			"Using Autonegotiation at Full Duplex only\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
 		adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
 		                                 ADVERTISE_100_FULL |
 		                                 ADVERTISE_1000_FULL;
 		break;
 	case SPEED_10:
-		printk(KERN_INFO "10 Mbps Speed specified without Duplex\n");
-		printk(KERN_INFO "Using Autonegotiation at 10 Mbps only\n");
+		DPRINTK(PROBE, INFO,
+			"10 Mbps Speed specified without Duplex\n");
+		DPRINTK(PROBE, INFO, "Using Autonegotiation at 10 Mbps only\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
 		adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
 		                                 ADVERTISE_10_FULL;
 		break;
 	case SPEED_10 + HALF_DUPLEX:
-		printk(KERN_INFO "Forcing to 10 Mbps Half Duplex\n");
+		DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Half Duplex\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 0;
 		adapter->hw.forced_speed_duplex = e1000_10_half;
 		adapter->hw.autoneg_advertised = 0;
 		break;
 	case SPEED_10 + FULL_DUPLEX:
-		printk(KERN_INFO "Forcing to 10 Mbps Full Duplex\n");
+		DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Full Duplex\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 0;
 		adapter->hw.forced_speed_duplex = e1000_10_full;
 		adapter->hw.autoneg_advertised = 0;
 		break;
 	case SPEED_100:
-		printk(KERN_INFO "100 Mbps Speed specified without Duplex\n");
-		printk(KERN_INFO "Using Autonegotiation at 100 Mbps only\n");
+		DPRINTK(PROBE, INFO,
+			"100 Mbps Speed specified without Duplex\n");
+		DPRINTK(PROBE, INFO,
+			"Using Autonegotiation at 100 Mbps only\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
 		adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
 		                                 ADVERTISE_100_FULL;
 		break;
 	case SPEED_100 + HALF_DUPLEX:
-		printk(KERN_INFO "Forcing to 100 Mbps Half Duplex\n");
+		DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Half Duplex\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 0;
 		adapter->hw.forced_speed_duplex = e1000_100_half;
 		adapter->hw.autoneg_advertised = 0;
 		break;
 	case SPEED_100 + FULL_DUPLEX:
-		printk(KERN_INFO "Forcing to 100 Mbps Full Duplex\n");
+		DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Full Duplex\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 0;
 		adapter->hw.forced_speed_duplex = e1000_100_full;
 		adapter->hw.autoneg_advertised = 0;
 		break;
 	case SPEED_1000:
-		printk(KERN_INFO "1000 Mbps Speed specified without Duplex\n");
-		printk(KERN_INFO
+		DPRINTK(PROBE, INFO,
+			"1000 Mbps Speed specified without Duplex\n");
+		DPRINTK(PROBE, INFO,
 		       "Using Autonegotiation at 1000 Mbps Full Duplex only\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
 		adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
 		break;
 	case SPEED_1000 + HALF_DUPLEX:
-		printk(KERN_INFO "Half Duplex is not supported at 1000 Mbps\n");
-		printk(KERN_INFO
+		DPRINTK(PROBE, INFO,
+			"Half Duplex is not supported at 1000 Mbps\n");
+		DPRINTK(PROBE, INFO,
 		       "Using Autonegotiation at 1000 Mbps Full Duplex only\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
 		adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
 		break;
 	case SPEED_1000 + FULL_DUPLEX:
-		printk(KERN_INFO
+		DPRINTK(PROBE, INFO,
 		       "Using Autonegotiation at 1000 Mbps Full Duplex only\n");
 		adapter->hw.autoneg = adapter->fc_autoneg = 1;
 		adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
@@ -685,7 +695,8 @@
 
 	/* Speed, AutoNeg and MDI/MDI-X must all play nice */
 	if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
-		printk(KERN_INFO "Speed, AutoNeg and MDI-X specifications are "
+		DPRINTK(PROBE, INFO,
+		       "Speed, AutoNeg and MDI-X specifications are "
 		       "incompatible. Setting MDI-X to a compatible value.\n");
 	}
 }
diff -Nru a/drivers/net/eepro100.c b/drivers/net/eepro100.c
--- a/drivers/net/eepro100.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/eepro100.c	Tue Jun 15 22:20:42 2004
@@ -120,7 +120,6 @@
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
 #include <linux/ethtool.h>
-#include <linux/mii.h>
 
 /* enable PIO instead of MMIO, if CONFIG_EEPRO100_PIO is selected */
 #ifdef CONFIG_EEPRO100_PIO
@@ -2018,7 +2017,7 @@
 	return &sp->stats;
 }
 
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	u32 ethcmd;
 	struct speedo_private *sp = netdev_priv(dev);
@@ -2097,7 +2096,7 @@
 static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct speedo_private *sp = netdev_priv(dev);
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 	int phy = sp->phy[0] & 0x1f;
 	int saved_acpi;
 	int t;
@@ -2130,7 +2129,7 @@
 		pci_set_power_state(sp->pdev, saved_acpi);
 		return 0;
 	case SIOCETHTOOL:
-		return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		return netdev_ethtool_ioctl(dev, rq->ifr_data);
 	default:
 		return -EOPNOTSUPP;
 	}
diff -Nru a/drivers/net/epic100.c b/drivers/net/epic100.c
--- a/drivers/net/epic100.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/epic100.c	Tue Jun 15 22:20:40 2004
@@ -66,12 +66,15 @@
 	LK1.1.14 (Kryzsztof Halasa):
 	* fix spurious bad initializations
 	* pound phy a la SMSC's app note on the subject
+	
+	AC1.1.14ac
+	* fix power up/down for ethtool that broke in 1.11
 
 */
 
 #define DRV_NAME        "epic100"
-#define DRV_VERSION     "1.11+LK1.1.14"
-#define DRV_RELDATE     "Aug 4, 2002"
+#define DRV_VERSION     "1.11+LK1.1.14+AC1.1.14"
+#define DRV_RELDATE     "June 2, 2004"
 
 /* The user-configurable values.
    These may be modified when a driver module is loaded.*/
@@ -1424,6 +1427,27 @@
 	debug = value;
 }
 
+static int ethtool_begin(struct net_device *dev)
+{
+	unsigned long ioaddr = dev->base_addr;
+	/* power-up, if interface is down */
+	if (! netif_running(dev)) {
+		outl(0x0200, ioaddr + GENCTL);
+		outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
+	}
+	return 0;
+}
+
+static void ethtool_complete(struct net_device *dev)
+{
+	unsigned long ioaddr = dev->base_addr;
+	/* power-down, if interface is down */
+	if (! netif_running(dev)) {
+		outl(0x0008, ioaddr + GENCTL);
+		outl((inl(ioaddr + NVCTL) & ~0x483C) | 0x0000, ioaddr + NVCTL);
+	}
+}
+
 static struct ethtool_ops netdev_ethtool_ops = {
 	.get_drvinfo		= netdev_get_drvinfo,
 	.get_settings		= netdev_get_settings,
@@ -1434,13 +1458,15 @@
 	.set_msglevel		= netdev_set_msglevel,
 	.get_sg			= ethtool_op_get_sg,
 	.get_tx_csum		= ethtool_op_get_tx_csum,
+	.begin			= ethtool_begin,
+	.complete		= ethtool_complete
 };
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct epic_private *np = dev->priv;
 	long ioaddr = dev->base_addr;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 	int rc;
 
 	/* power-up, if interface is down */
diff -Nru a/drivers/net/eql.c b/drivers/net/eql.c
--- a/drivers/net/eql.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/net/eql.c	Tue Jun 15 22:20:44 2004
@@ -255,14 +255,14 @@
 	return 0;
 }
 
-static int eql_enslave(struct net_device *dev,  slaving_request_t *srq);
-static int eql_emancipate(struct net_device *dev, slaving_request_t *srq);
+static int eql_enslave(struct net_device *dev,  slaving_request_t __user *srq);
+static int eql_emancipate(struct net_device *dev, slaving_request_t __user *srq);
 
-static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *sc);
-static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *sc);
+static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *sc);
+static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *sc);
 
-static int eql_g_master_cfg(struct net_device *dev, master_config_t *mc);
-static int eql_s_master_cfg(struct net_device *dev, master_config_t *mc);
+static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mc);
+static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mc);
 
 static int eql_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {  
@@ -272,23 +272,17 @@
 
 	switch (cmd) {
 		case EQL_ENSLAVE:
-			return eql_enslave(dev,
-					   (slaving_request_t *) ifr->ifr_data);
+			return eql_enslave(dev, ifr->ifr_data);
 		case EQL_EMANCIPATE:
-			return eql_emancipate(dev,
-					      (slaving_request_t *) ifr->ifr_data);
+			return eql_emancipate(dev, ifr->ifr_data);
 		case EQL_GETSLAVECFG:
-			return eql_g_slave_cfg(dev,
-					       (slave_config_t *) ifr->ifr_data);
+			return eql_g_slave_cfg(dev, ifr->ifr_data);
 		case EQL_SETSLAVECFG:
-			return eql_s_slave_cfg(dev,
-					       (slave_config_t *) ifr->ifr_data);
+			return eql_s_slave_cfg(dev, ifr->ifr_data);
 		case EQL_GETMASTRCFG:
-			return eql_g_master_cfg(dev,
-						(master_config_t *) ifr->ifr_data);
+			return eql_g_master_cfg(dev, ifr->ifr_data);
 		case EQL_SETMASTRCFG:
-			return eql_s_master_cfg(dev,
-						(master_config_t *) ifr->ifr_data);
+			return eql_s_master_cfg(dev, ifr->ifr_data);
 		default:
 			return -EOPNOTSUPP;
 	};
@@ -411,7 +405,7 @@
 	return -ENOSPC;
 }
 
-static int eql_enslave(struct net_device *master_dev, slaving_request_t *srqp)
+static int eql_enslave(struct net_device *master_dev, slaving_request_t __user *srqp)
 {
 	struct net_device *slave_dev;
 	slaving_request_t srq;
@@ -457,7 +451,7 @@
 	return -EINVAL;
 }
 
-static int eql_emancipate(struct net_device *master_dev, slaving_request_t *srqp)
+static int eql_emancipate(struct net_device *master_dev, slaving_request_t __user *srqp)
 {
 	equalizer_t *eql = master_dev->priv;
 	struct net_device *slave_dev;
@@ -489,7 +483,7 @@
 	return ret;
 }
 
-static int eql_g_slave_cfg(struct net_device *dev, slave_config_t *scp)
+static int eql_g_slave_cfg(struct net_device *dev, slave_config_t __user *scp)
 {
 	equalizer_t *eql = dev->priv;
 	slave_t *slave;
@@ -522,7 +516,7 @@
 	return ret;
 }
 
-static int eql_s_slave_cfg(struct net_device *dev, slave_config_t *scp)
+static int eql_s_slave_cfg(struct net_device *dev, slave_config_t __user *scp)
 {
 	slave_t *slave;
 	equalizer_t *eql;
@@ -553,7 +547,7 @@
 	return ret;
 }
 
-static int eql_g_master_cfg(struct net_device *dev, master_config_t *mcp)
+static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp)
 {
 	equalizer_t *eql;
 	master_config_t mc;
@@ -569,7 +563,7 @@
 	return -EINVAL;
 }
 
-static int eql_s_master_cfg(struct net_device *dev, master_config_t *mcp)
+static int eql_s_master_cfg(struct net_device *dev, master_config_t __user *mcp)
 {
 	equalizer_t *eql;
 	master_config_t mc;
diff -Nru a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
--- a/drivers/net/ewrk3.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/net/ewrk3.c	Tue Jun 15 22:21:04 2004
@@ -1518,13 +1518,13 @@
 	return status;		/* return the device name string */
 }
 
-static int ewrk3_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int ewrk3_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
 	u_long iobase = dev->base_addr;
 	u32 ethcmd;
 
-	if (get_user(ethcmd, (u32 *)useraddr))
+	if (get_user(ethcmd, (u32 __user *)useraddr))
 		return -EFAULT;
 
 	switch (ethcmd) {
@@ -1707,7 +1707,7 @@
 static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct ewrk3_private *lp = (struct ewrk3_private *) dev->priv;
-	struct ewrk3_ioctl *ioc = (struct ewrk3_ioctl *) &rq->ifr_data;
+	struct ewrk3_ioctl *ioc = (struct ewrk3_ioctl *) &rq->ifr_ifru;
 	u_long iobase = dev->base_addr;
 	int i, j, status = 0;
 	u_char csr;
@@ -1721,7 +1721,7 @@
 
 	/* ethtool IOCTLs are handled elsewhere */
 	if (cmd == SIOCETHTOOL)
-		return ewrk3_ethtool_ioctl(dev, (void *)rq->ifr_data);
+		return ewrk3_ethtool_ioctl(dev, rq->ifr_data);
 
 	/* Other than ethtool, all we handle are private IOCTLs */
 	if (cmd != EWRK3IOCTL)
diff -Nru a/drivers/net/ewrk3.h b/drivers/net/ewrk3.h
--- a/drivers/net/ewrk3.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/ewrk3.h	Tue Jun 15 22:20:39 2004
@@ -296,7 +296,7 @@
 struct ewrk3_ioctl {
 	unsigned short cmd;                /* Command to run */
 	unsigned short len;                /* Length of the data buffer */
-	unsigned char  *data;              /* Pointer to the data buffer */
+	unsigned char  __user *data;       /* Pointer to the data buffer */
 };
 
 /* 
diff -Nru a/drivers/net/fealnx.c b/drivers/net/fealnx.c
--- a/drivers/net/fealnx.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/fealnx.c	Tue Jun 15 22:20:42 2004
@@ -84,6 +84,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/crc32.h>
+#include <linux/delay.h>
 
 #include <asm/processor.h>	/* Processor type for cache alignment. */
 #include <asm/bitops.h>
@@ -233,15 +234,29 @@
 	RxErr = 0x00000002,	/* receive error */
 };
 
-/* Bits in the NetworkConfig register. */
+/* Bits in the NetworkConfig register, W for writing, R for reading */
+/* FIXME: some names are invented by me. Marked with (name?) */
+/* If you have docs and know bit names, please fix 'em */
 enum rx_mode_bits {
-	RxModeMask = 0xe0,
-	PROM = 0x80,		/* promiscuous mode */
-	AB = 0x40,		/* accept broadcast */
-	AM = 0x20,		/* accept mutlicast */
-	ARP = 0x08,		/* receive runt pkt */
-	ALP = 0x04,		/* receive long pkt */
-	SEP = 0x02,		/* receive error pkt */
+	CR_W_ENH	= 0x02000000,	/* enhanced mode (name?) */
+	CR_W_FD		= 0x00100000,	/* full duplex */
+	CR_W_PS10	= 0x00080000,	/* 10 mbit */
+	CR_W_TXEN	= 0x00040000,	/* tx enable (name?) */
+	CR_W_PS1000	= 0x00010000,	/* 1000 mbit */
+     /* CR_W_RXBURSTMASK= 0x00000e00, Im unsure about this */
+	CR_W_RXMODEMASK	= 0x000000e0,
+	CR_W_PROM	= 0x00000080,	/* promiscuous mode */
+	CR_W_AB		= 0x00000040,	/* accept broadcast */
+	CR_W_AM		= 0x00000020,	/* accept mutlicast */
+	CR_W_ARP	= 0x00000008,	/* receive runt pkt */
+	CR_W_ALP	= 0x00000004,	/* receive long pkt */
+	CR_W_SEP	= 0x00000002,	/* receive error pkt */
+	CR_W_RXEN	= 0x00000001,	/* rx enable (unicast?) (name?) */
+
+	CR_R_TXSTOP	= 0x04000000,	/* tx stopped (name?) */
+	CR_R_FD		= 0x00100000,	/* full duplex detected */
+	CR_R_PS10	= 0x00080000,	/* 10 mbit detected */
+	CR_R_RXSTOP	= 0x00008000,	/* rx stopped (name?) */
 };
 
 /* The Tulip Rx and Tx buffer descriptors. */
@@ -375,10 +390,7 @@
 #define LXT1000_Full    0x200
 // 89/12/29 add, for phy specific status register, levelone phy, (end)
 
-/* for 3-in-1 case */
-#define PS10            0x00080000
-#define FD              0x00100000
-#define PS1000          0x00010000
+/* for 3-in-1 case, BMCRSR register */
 #define LinkIsUp2	0x00040000
 
 /* for PHY */
@@ -400,6 +412,12 @@
 	/* Media monitoring timer. */
 	struct timer_list timer;
 
+	/* Reset timer */
+	struct timer_list reset_timer;
+	int reset_timer_armed;
+	unsigned long crvalue_sv;
+	unsigned long imrvalue_sv;
+
 	/* Frequently used values: keep some adjacent for cache effect. */
 	int flags;
 	struct pci_dev *pci_dev;
@@ -435,49 +453,44 @@
 static void getlinktype(struct net_device *dev);
 static void getlinkstatus(struct net_device *dev);
 static void netdev_timer(unsigned long data);
+static void reset_timer(unsigned long data);
 static void tx_timeout(struct net_device *dev);
 static void init_ring(struct net_device *dev);
 static int start_tx(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs);
 static int netdev_rx(struct net_device *dev);
 static void set_rx_mode(struct net_device *dev);
+static void __set_rx_mode(struct net_device *dev);
 static struct net_device_stats *get_stats(struct net_device *dev);
 static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static struct ethtool_ops netdev_ethtool_ops;
 static int netdev_close(struct net_device *dev);
 static void reset_rx_descriptors(struct net_device *dev);
+static void reset_tx_descriptors(struct net_device *dev);
 
-void stop_nic_tx(long ioaddr, long crvalue)
+static void stop_nic_rx(long ioaddr, long crvalue)
 {
-	writel(crvalue & (~0x40000), ioaddr + TCRRCR);
-
-	/* wait for tx stop */
-	{
-		int i = 0, delay = 0x1000;
-
-		while ((!(readl(ioaddr + TCRRCR) & 0x04000000)) && (i < delay)) {
-			++i;
-		}
+	int delay = 0x1000;
+	writel(crvalue & ~(CR_W_RXEN), ioaddr + TCRRCR);
+	while (--delay) {
+		if ( (readl(ioaddr + TCRRCR) & CR_R_RXSTOP) == CR_R_RXSTOP)
+			break;
 	}
 }
 
 
-void stop_nic_rx(long ioaddr, long crvalue)
+static void stop_nic_rxtx(long ioaddr, long crvalue)
 {
-	writel(crvalue & (~0x1), ioaddr + TCRRCR);
-
-	/* wait for rx stop */
-	{
-		int i = 0, delay = 0x1000;
-
-		while ((!(readl(ioaddr + TCRRCR) & 0x00008000)) && (i < delay)) {
-			++i;
-		}
+	int delay = 0x1000;
+	writel(crvalue & ~(CR_W_RXEN+CR_W_TXEN), ioaddr + TCRRCR);
+	while (--delay) {
+		if ( (readl(ioaddr + TCRRCR) & (CR_R_RXSTOP+CR_R_TXSTOP))
+					    == (CR_R_RXSTOP+CR_R_TXSTOP) )
+			break;
 	}
 }
 
 
-
 static int __devinit fealnx_init_one(struct pci_dev *pdev,
 				     const struct pci_device_id *ent)
 {
@@ -495,7 +508,7 @@
 #ifndef MODULE
 	static int printed_version;
 	if (!printed_version++)
-		printk (version);
+		printk(version);
 #endif
 	
 	card_idx++;
@@ -622,7 +635,7 @@
 		np->phys[0] = 32;
 /* 89/6/23 add, (begin) */
 		/* get phy type */
-		if (readl(dev->base_addr + PHYIDENTIFIER) == MysonPHYID)
+		if (readl(ioaddr + PHYIDENTIFIER) == MysonPHYID)
 			np->PHYType = MysonPHY;
 		else
 			np->PHYType = OtherPHY;
@@ -657,7 +670,7 @@
 		if (np->flags == HAS_MII_XCVR)
 			mdio_write(dev, np->phys[0], MII_ADVERTISE, ADVERTISE_FULL);
 		else
-			writel(ADVERTISE_FULL, dev->base_addr + ANARANLPAR);
+			writel(ADVERTISE_FULL, ioaddr + ANARANLPAR);
 		np->mii.force_media = 1;
 	}
 
@@ -669,7 +682,7 @@
 	dev->set_multicast_list = &set_rx_mode;
 	dev->do_ioctl = &mii_ioctl;
 	dev->ethtool_ops = &netdev_ethtool_ops;
-	dev->tx_timeout = tx_timeout;
+	dev->tx_timeout = &tx_timeout;
 	dev->watchdog_timeo = TX_TIMEOUT;
 	
 	err = register_netdev(dev);
@@ -699,6 +712,7 @@
 	return err;
 }
 
+
 static void __devexit fealnx_remove_one(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
@@ -721,42 +735,6 @@
 		printk(KERN_ERR "fealnx: remove for unknown device\n");
 }
 
-unsigned int m80x_read_tick(void)
-/* function: Reads the Timer tick count register which decrements by 2 from  */
-/*           65536 to 0 every 1/36.414 of a second. Each 2 decrements of the *//*           count represents 838 nsec's.                                    */
-/* input   : none.                                                           */
-/* output  : none.                                                           */
-{
-	unsigned char tmp;
-	int value;
-
-	writeb((char) 0x06, 0x43);	// Command 8254 to latch T0's count
-
-	// now read the count.
-	tmp = (unsigned char) readb(0x40);
-	value = ((int) tmp) << 8;
-	tmp = (unsigned char) readb(0x40);
-	value |= (((int) tmp) & 0xff);
-	return (value);
-}
-
-
-void m80x_delay(unsigned int interval)
-/* function: to wait for a specified time.                                   */
-/* input   : interval ... the specified time.                                */
-/* output  : none.                                                           */
-{
-	unsigned int interval1, interval2, i = 0;
-
-	interval1 = m80x_read_tick();	// get initial value
-	do {
-		interval2 = m80x_read_tick();
-		if (interval1 < interval2)
-			interval1 = interval2;
-		++i;
-	} while (((interval1 - interval2) < (ushort) interval) && (i < 65535));
-}
-
 
 static ulong m80x_send_cmd_to_phy(long miiport, int opcode, int phyad, int regad)
 {
@@ -796,7 +774,7 @@
 		/* high MDC */
 		miir |= MASK_MIIR_MII_MDC;
 		writel(miir, miiport);
-		m80x_delay(30);
+		udelay(30);
 
 		/* next */
 		mask >>= 1;
@@ -831,7 +809,7 @@
 		/* high MDC, and wait */
 		miir |= MASK_MIIR_MII_MDC;
 		writel(miir, miiport);
-		m80x_delay((int) 30);
+		udelay(30);
 
 		/* next */
 		mask >>= 1;
@@ -873,8 +851,6 @@
 	/* low MDC */
 	miir &= ~MASK_MIIR_MII_MDC;
 	writel(miir, miiport);
-
-	return;
 }
 
 
@@ -949,7 +925,7 @@
 	np->imrvalue = TUNF | CNTOVF | RBU | TI | RI;
 	if (np->pci_dev->device == 0x891) {
 		np->bcrvalue |= 0x200;	/* set PROG bit */
-		np->crvalue |= 0x02000000;	/* set enhanced bit */
+		np->crvalue |= CR_W_ENH;	/* set enhanced bit */
 		np->imrvalue |= ETI;
 	}
 	writel(np->bcrvalue, ioaddr + BCR);
@@ -957,7 +933,7 @@
 	if (dev->if_port == 0)
 		dev->if_port = np->default_port;
 
-	writel(0, dev->base_addr + RXPDR);
+	writel(0, ioaddr + RXPDR);
 // 89/9/1 modify,
 //   np->crvalue = 0x00e40001;    /* tx store and forward, tx/rx enable */
 	np->crvalue |= 0x00e40001;	/* tx store and forward, tx/rx enable */
@@ -965,7 +941,7 @@
 	getlinkstatus(dev);
 	if (np->linkok)
 		getlinktype(dev);
-	set_rx_mode(dev);
+	__set_rx_mode(dev);
 
 	netif_start_queue(dev);
 
@@ -985,6 +961,11 @@
 	/* timer handler */
 	add_timer(&np->timer);
 
+	init_timer(&np->reset_timer);
+	np->reset_timer.data = (unsigned long) dev;
+	np->reset_timer.function = &reset_timer;
+	np->reset_timer_armed = 0;
+
 	return 0;
 }
 
@@ -1005,8 +986,7 @@
 				np->linkok = 1;
 				return;
 			}
-			// delay
-			m80x_delay(100);
+			udelay(100);
 		}
 	} else {
 		for (i = 0; i < DelayTime; ++i) {
@@ -1014,8 +994,7 @@
 				np->linkok = 1;
 				return;
 			}
-			// delay
-			m80x_delay(100);
+			udelay(100);
 		}
 	}
 }
@@ -1026,11 +1005,11 @@
 	struct netdev_private *np = dev->priv;
 
 	if (np->PHYType == MysonPHY) {	/* 3-in-1 case */
-		if (readl(dev->base_addr + TCRRCR) & FD)
+		if (readl(dev->base_addr + TCRRCR) & CR_R_FD)
 			np->duplexmode = 2;	/* full duplex */
 		else
 			np->duplexmode = 1;	/* half duplex */
-		if (readl(dev->base_addr + TCRRCR) & PS10)
+		if (readl(dev->base_addr + TCRRCR) & CR_R_PS10)
 			np->line_speed = 1;	/* 10M */
 		else
 			np->line_speed = 2;	/* 100M */
@@ -1112,19 +1091,18 @@
 			else
 				np->line_speed = 1;	/* 10M */
 		}
-		// chage crvalue
-		// np->crvalue&=(~PS10)&(~FD);
-		np->crvalue &= (~PS10) & (~FD) & (~PS1000);
+		np->crvalue &= (~CR_W_PS10) & (~CR_W_FD) & (~CR_W_PS1000);
 		if (np->line_speed == 1)
-			np->crvalue |= PS10;
+			np->crvalue |= CR_W_PS10;
 		else if (np->line_speed == 3)
-			np->crvalue |= PS1000;
+			np->crvalue |= CR_W_PS1000;
 		if (np->duplexmode == 2)
-			np->crvalue |= FD;
+			np->crvalue |= CR_W_FD;
 	}
 }
 
 
+/* Take lock before calling this */
 static void allocate_rx_buffers(struct net_device *dev)
 {
 	struct netdev_private *np = dev->priv;
@@ -1134,15 +1112,17 @@
 		struct sk_buff *skb;
 
 		skb = dev_alloc_skb(np->rx_buf_sz);
-		np->lack_rxbuf->skbuff = skb;
-
 		if (skb == NULL)
 			break;	/* Better luck next round. */
 
+		while (np->lack_rxbuf->skbuff)
+			np->lack_rxbuf = np->lack_rxbuf->next_desc_logical;
+
 		skb->dev = dev;	/* Mark as being used by this device. */
+		np->lack_rxbuf->skbuff = skb;
 		np->lack_rxbuf->buffer = pci_map_single(np->pci_dev, skb->tail,
 			np->rx_buf_sz, PCI_DMA_FROMDEVICE);
-		np->lack_rxbuf = np->lack_rxbuf->next_desc_logical;
+		np->lack_rxbuf->status = RXOWN;
 		++np->really_rx_count;
 	}
 }
@@ -1153,22 +1133,23 @@
 	struct net_device *dev = (struct net_device *) data;
 	struct netdev_private *np = dev->priv;
 	long ioaddr = dev->base_addr;
-	int next_tick = 10 * HZ;
 	int old_crvalue = np->crvalue;
 	unsigned int old_linkok = np->linkok;
+	unsigned long flags;
 
 	if (debug)
 		printk(KERN_DEBUG "%s: Media selection timer tick, status %8.8x "
 		       "config %8.8x.\n", dev->name, readl(ioaddr + ISR),
 		       readl(ioaddr + TCRRCR));
 
+	spin_lock_irqsave(&np->lock, flags);
+
 	if (np->flags == HAS_MII_XCVR) {
 		getlinkstatus(dev);
 		if ((old_linkok == 0) && (np->linkok == 1)) {	/* we need to detect the media type again */
 			getlinktype(dev);
 			if (np->crvalue != old_crvalue) {
-				stop_nic_tx(ioaddr, np->crvalue);
-				stop_nic_rx(ioaddr, np->crvalue & (~0x40000));
+				stop_nic_rxtx(ioaddr, np->crvalue);
 				writel(np->crvalue, ioaddr + TCRRCR);
 			}
 		}
@@ -1176,69 +1157,120 @@
 
 	allocate_rx_buffers(dev);
 
-	np->timer.expires = RUN_AT(next_tick);
+	spin_unlock_irqrestore(&np->lock, flags);
+
+	np->timer.expires = RUN_AT(10 * HZ);
 	add_timer(&np->timer);
 }
 
 
-static void tx_timeout(struct net_device *dev)
+/* Take lock before calling */
+/* Reset chip and disable rx, tx and interrupts */
+static void reset_and_disable_rxtx(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
 	long ioaddr = dev->base_addr;
-	int i;
-
-	printk(KERN_WARNING "%s: Transmit timed out, status %8.8x,"
-	       " resetting...\n", dev->name, readl(ioaddr + ISR));
-
-	{
-
-		printk(KERN_DEBUG "  Rx ring %p: ", np->rx_ring);
-		for (i = 0; i < RX_RING_SIZE; i++)
-			printk(" %8.8x", (unsigned int) np->rx_ring[i].status);
-		printk("\n" KERN_DEBUG "  Tx ring %p: ", np->tx_ring);
-		for (i = 0; i < TX_RING_SIZE; i++)
-			printk(" %4.4x", np->tx_ring[i].status);
-		printk("\n");
-	}
-
-	/* Reinit. Gross */
+	int delay=51;
 
 	/* Reset the chip's Tx and Rx processes. */
-	stop_nic_tx(ioaddr, 0);
-	reset_rx_descriptors(dev);
+	stop_nic_rxtx(ioaddr, 0);
 
 	/* Disable interrupts by clearing the interrupt mask. */
-	writel(0x0000, ioaddr + IMR);
+	writel(0, ioaddr + IMR);
 
 	/* Reset the chip to erase previous misconfiguration. */
 	writel(0x00000001, ioaddr + BCR);
 
 	/* Ueimor: wait for 50 PCI cycles (and flush posted writes btw). 
-	   We surely wait too long (address+data phase). Who cares ? */
-	for (i = 0; i < 50; i++) {
+	   We surely wait too long (address+data phase). Who cares? */
+	while (--delay) {
 		readl(ioaddr + BCR);
 		rmb();
 	}
+}
+
+
+/* Take lock before calling */
+/* Restore chip after reset */
+static void enable_rxtx(struct net_device *dev)
+{
+	struct netdev_private *np = dev->priv;
+	long ioaddr = dev->base_addr;
 
-	writel((np->cur_tx - np->tx_ring)*sizeof(struct fealnx_desc) +
-		np->tx_ring_dma, ioaddr + TXLBA);
-	writel((np->cur_rx - np->rx_ring)*sizeof(struct fealnx_desc) +
-		np->rx_ring_dma, ioaddr + RXLBA);
+	reset_rx_descriptors(dev);
+
+	writel(np->tx_ring_dma + ((char*)np->cur_tx - (char*)np->tx_ring),
+		ioaddr + TXLBA);
+	writel(np->rx_ring_dma + ((char*)np->cur_rx - (char*)np->rx_ring),
+		ioaddr + RXLBA);
 
 	writel(np->bcrvalue, ioaddr + BCR);
 
-	writel(0, dev->base_addr + RXPDR);
-	set_rx_mode(dev);
+	writel(0, ioaddr + RXPDR);
+	__set_rx_mode(dev); /* changes np->crvalue, writes it into TCRRCR */
+
 	/* Clear and Enable interrupts by setting the interrupt mask. */
 	writel(FBE | TUNF | CNTOVF | RBU | TI | RI, ioaddr + ISR);
 	writel(np->imrvalue, ioaddr + IMR);
 
-	writel(0, dev->base_addr + TXPDR);
+	writel(0, ioaddr + TXPDR);
+}
+
+
+static void reset_timer(unsigned long data)
+{
+	struct net_device *dev = (struct net_device *) data;
+	struct netdev_private *np = dev->priv;
+	unsigned long flags;
+
+	printk(KERN_WARNING "%s: resetting tx and rx machinery\n", dev->name);
+
+	spin_lock_irqsave(&np->lock, flags);
+	np->crvalue = np->crvalue_sv;
+	np->imrvalue = np->imrvalue_sv;
+
+	reset_and_disable_rxtx(dev);
+	/* works for me without this:
+	reset_tx_descriptors(dev); */
+	enable_rxtx(dev);
+	netif_start_queue(dev); /* FIXME: or netif_wake_queue(dev); ? */
+		
+	np->reset_timer_armed = 0;
+
+	spin_unlock_irqrestore(&np->lock, flags);
+}
+
+
+static void tx_timeout(struct net_device *dev)
+{
+	struct netdev_private *np = dev->priv;
+	long ioaddr = dev->base_addr;
+	unsigned long flags;
+	int i;
+
+	printk(KERN_WARNING "%s: Transmit timed out, status %8.8x,"
+	       " resetting...\n", dev->name, readl(ioaddr + ISR));
+
+	{
+		printk(KERN_DEBUG "  Rx ring %p: ", np->rx_ring);
+		for (i = 0; i < RX_RING_SIZE; i++)
+			printk(" %8.8x", (unsigned int) np->rx_ring[i].status);
+		printk("\n" KERN_DEBUG "  Tx ring %p: ", np->tx_ring);
+		for (i = 0; i < TX_RING_SIZE; i++)
+			printk(" %4.4x", np->tx_ring[i].status);
+		printk("\n");
+	}
+	
+	spin_lock_irqsave(&np->lock, flags);
+
+	reset_and_disable_rxtx(dev);
+	reset_tx_descriptors(dev);
+	enable_rxtx(dev);
+
+	spin_unlock_irqrestore(&np->lock, flags);
 
 	dev->trans_start = jiffies;
 	np->stats.tx_errors++;
-
-	return;
+	netif_wake_queue(dev); /* or .._start_.. ?? */
 }
 
 
@@ -1251,7 +1283,7 @@
 	/* initialize rx variables */
 	np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);
 	np->cur_rx = &np->rx_ring[0];
-	np->lack_rxbuf = NULL;
+	np->lack_rxbuf = np->rx_ring;
 	np->really_rx_count = 0;
 
 	/* initial rx descriptors. */
@@ -1294,6 +1326,7 @@
 
 	for (i = 0; i < TX_RING_SIZE; i++) {
 		np->tx_ring[i].status = 0;
+		/* do we need np->tx_ring[i].control = XXX; ?? */
 		np->tx_ring[i].next_desc = np->tx_ring_dma +
 			(i + 1)*sizeof(struct fealnx_desc);
 		np->tx_ring[i].next_desc_logical = &np->tx_ring[i + 1];
@@ -1341,7 +1374,7 @@
 		np->cur_tx_copy->control |= (BPT << TBSShift);	/* buffer size */
 
 		/* for the last descriptor */
-		next = (struct fealnx *) np->cur_tx_copy.next_desc_logical;
+		next = np->cur_tx_copy->next_desc_logical;
 		next->skbuff = skb;
 		next->control = TXIC | TXLD | CRCEnable | PADEnable;
 		next->control |= (skb->len << PKTSShift);	/* pkt size */
@@ -1383,35 +1416,59 @@
 }
 
 
-void free_one_rx_descriptor(struct netdev_private *np)
+/* Take lock before calling */
+/* Chip probably hosed tx ring. Clean up. */
+static void reset_tx_descriptors(struct net_device *dev)
 {
-	if (np->really_rx_count == RX_RING_SIZE)
-		np->cur_rx->status = RXOWN;
-	else {
-		np->lack_rxbuf->skbuff = np->cur_rx->skbuff;
-		np->lack_rxbuf->buffer = np->cur_rx->buffer;
-		np->lack_rxbuf->status = RXOWN;
-		++np->really_rx_count;
-		np->lack_rxbuf = np->lack_rxbuf->next_desc_logical;
+	struct netdev_private *np = dev->priv;
+	struct fealnx_desc *cur;
+	int i;
+
+	/* initialize tx variables */
+	np->cur_tx = &np->tx_ring[0];
+	np->cur_tx_copy = &np->tx_ring[0];
+	np->really_tx_count = 0;
+	np->free_tx_count = TX_RING_SIZE;
+
+	for (i = 0; i < TX_RING_SIZE; i++) {
+		cur = &np->tx_ring[i];
+		if (cur->skbuff) {
+			pci_unmap_single(np->pci_dev, cur->buffer,
+				cur->skbuff->len, PCI_DMA_TODEVICE);
+			dev_kfree_skb(cur->skbuff);
+			/* or dev_kfree_skb_irq(cur->skbuff); ? */
+			cur->skbuff = NULL;
+		}
+		cur->status = 0;
+		cur->control = 0;	/* needed? */
+		/* probably not needed. We do it for purely paranoid reasons */
+		cur->next_desc = np->tx_ring_dma +
+			(i + 1)*sizeof(struct fealnx_desc);
+		cur->next_desc_logical = &np->tx_ring[i + 1];
 	}
-	np->cur_rx = np->cur_rx->next_desc_logical;
+	/* for the last tx descriptor */
+	np->tx_ring[TX_RING_SIZE - 1].next_desc = np->tx_ring_dma;
+	np->tx_ring[TX_RING_SIZE - 1].next_desc_logical = &np->tx_ring[0];
 }
 
 
-void reset_rx_descriptors(struct net_device *dev)
+/* Take lock and stop rx before calling this */
+static void reset_rx_descriptors(struct net_device *dev)
 {
 	struct netdev_private *np = dev->priv;
-
-	stop_nic_rx(dev->base_addr, np->crvalue);
-
-	while (!(np->cur_rx->status & RXOWN))
-		free_one_rx_descriptor(np);
+	struct fealnx_desc *cur = np->cur_rx;
+	int i;
 
 	allocate_rx_buffers(dev);
 
-	writel(np->rx_ring_dma + (np->cur_rx - np->rx_ring),
+	for (i = 0; i < RX_RING_SIZE; i++) {
+		if (cur->skbuff)
+			cur->status = RXOWN;
+		cur = cur->next_desc_logical;
+	}
+
+	writel(np->rx_ring_dma + ((char*)np->cur_rx - (char*)np->rx_ring),
 		dev->base_addr + RXLBA);
-	writel(np->crvalue, dev->base_addr + TCRRCR);
 }
 
 
@@ -1421,16 +1478,14 @@
 {
 	struct net_device *dev = (struct net_device *) dev_instance;
 	struct netdev_private *np = dev->priv;
-	long ioaddr, boguscnt = max_interrupt_work;
+	long ioaddr = dev->base_addr;
+	long boguscnt = max_interrupt_work;
 	unsigned int num_tx = 0;
 	int handled = 0;
 
 	spin_lock(&np->lock);
 
-	writel(0, dev->base_addr + IMR);
-
-	ioaddr = dev->base_addr;
-	np = dev->priv;
+	writel(0, ioaddr + IMR);
 
 	do {
 		u32 intr_status = readl(ioaddr + ISR);
@@ -1471,8 +1526,11 @@
 		if (intr_status & (RI | RBU)) {
 			if (intr_status & RI)
 				netdev_rx(dev);
-			else
+			else {
+				stop_nic_rx(ioaddr, np->crvalue);
 				reset_rx_descriptors(dev);
+				writel(np->crvalue, ioaddr + TCRRCR);
+			}				
 		}
 
 		while (np->really_tx_count) {
@@ -1490,7 +1548,7 @@
 			if (tx_status & TXOWN)
 				break;
 
-			if (!(np->crvalue & 0x02000000)) {
+			if (!(np->crvalue & CR_W_ENH)) {
 				if (tx_status & (CSL | LC | EC | UDF | HF)) {
 					np->stats.tx_errors++;
 					if (tx_status & EC)
@@ -1539,7 +1597,7 @@
 			netif_wake_queue(dev);
 
 		/* read transmit status for enhanced mode only */
-		if (np->crvalue & 0x02000000) {
+		if (np->crvalue & CR_W_ENH) {
 			long data;
 
 			data = readl(ioaddr + TSR);
@@ -1552,6 +1610,20 @@
 		if (--boguscnt < 0) {
 			printk(KERN_WARNING "%s: Too much work at interrupt, "
 			       "status=0x%4.4x.\n", dev->name, intr_status);
+			if (!np->reset_timer_armed) {
+				np->reset_timer_armed = 1;
+				np->reset_timer.expires = RUN_AT(HZ/2);
+				add_timer(&np->reset_timer);
+				stop_nic_rxtx(ioaddr, 0);
+				netif_stop_queue(dev);
+				/* or netif_tx_disable(dev); ?? */
+				/* Prevent other paths from enabling tx,rx,intrs */
+				np->crvalue_sv = np->crvalue;
+				np->imrvalue_sv = np->imrvalue;
+				np->crvalue &= ~(CR_W_TXEN | CR_W_RXEN); /* or simply = 0? */
+				np->imrvalue = 0;
+			}
+
 			break;
 		}
 	} while (1);
@@ -1580,9 +1652,10 @@
 static int netdev_rx(struct net_device *dev)
 {
 	struct netdev_private *np = dev->priv;
+	long ioaddr = dev->base_addr;
 
 	/* If EOP is set on the next entry, it's a new packet. Send it up. */
-	while (!(np->cur_rx->status & RXOWN)) {
+	while (!(np->cur_rx->status & RXOWN) && np->cur_rx->skbuff) {
 		s32 rx_status = np->cur_rx->status;
 
 		if (np->really_rx_count == 0)
@@ -1634,11 +1707,20 @@
 					np->stats.rx_length_errors++;
 
 					/* free all rx descriptors related this long pkt */
-					for (i = 0; i < desno; ++i)
-						free_one_rx_descriptor(np);
+					for (i = 0; i < desno; ++i) {
+						if (!np->cur_rx->skbuff) {
+							printk(KERN_DEBUG
+								"%s: I'm scared\n", dev->name);
+							break;
+						}
+						np->cur_rx->status = RXOWN;
+						np->cur_rx = np->cur_rx->next_desc_logical;
+					}
 					continue;
-				} else {	/* something error, need to reset this chip */
+				} else {        /* rx error, need to reset this chip */
+					stop_nic_rx(ioaddr, np->crvalue);
 					reset_rx_descriptors(dev);
+					writel(np->crvalue, ioaddr + TCRRCR);
 				}
 				break;	/* exit the while loop */
 			}
@@ -1685,8 +1767,6 @@
 						 PCI_DMA_FROMDEVICE);
 				skb_put(skb = np->cur_rx->skbuff, pkt_len);
 				np->cur_rx->skbuff = NULL;
-				if (np->really_rx_count == RX_RING_SIZE)
-					np->lack_rxbuf = np->cur_rx;
 				--np->really_rx_count;
 			}
 			skb->protocol = eth_type_trans(skb, dev);
@@ -1696,24 +1776,7 @@
 			np->stats.rx_bytes += pkt_len;
 		}
 
-		if (np->cur_rx->skbuff == NULL) {
-			struct sk_buff *skb;
-
-			skb = dev_alloc_skb(np->rx_buf_sz);
-
-			if (skb != NULL) {
-				skb->dev = dev;	/* Mark as being used by this device. */
-				np->cur_rx->buffer = pci_map_single(np->pci_dev,
-								    skb->tail,
-								    np->rx_buf_sz,
-								    PCI_DMA_FROMDEVICE);
-				np->cur_rx->skbuff = skb;
-				++np->really_rx_count;
-			}
-		}
-
-		if (np->cur_rx->skbuff != NULL)
-			free_one_rx_descriptor(np);
+		np->cur_rx = np->cur_rx->next_desc_logical;
 	}			/* end of while loop */
 
 	/*  allocate skb for rx buffers */
@@ -1737,8 +1800,21 @@
 	return &np->stats;
 }
 
+
+/* for dev->set_multicast_list */
 static void set_rx_mode(struct net_device *dev)
 {
+	spinlock_t *lp = &((struct netdev_private *)dev->priv)->lock;
+	unsigned long flags;
+	spin_lock_irqsave(lp, flags);
+	__set_rx_mode(dev);
+	spin_unlock_irqrestore(lp, flags);
+}
+
+
+/* Take lock before calling */
+static void __set_rx_mode(struct net_device *dev)
+{
 	struct netdev_private *np = dev->priv;
 	long ioaddr = dev->base_addr;
 	u32 mc_filter[2];	/* Multicast hash filter */
@@ -1748,12 +1824,12 @@
 		/* Unconditionally log net taps. */
 		printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
 		memset(mc_filter, 0xff, sizeof(mc_filter));
-		rx_mode = PROM | AB | AM;
+		rx_mode = CR_W_PROM | CR_W_AB | CR_W_AM;
 	} else if ((dev->mc_count > multicast_filter_limit)
 		   || (dev->flags & IFF_ALLMULTI)) {
 		/* Too many to match, or accept all multicasts. */
 		memset(mc_filter, 0xff, sizeof(mc_filter));
-		rx_mode = AB | AM;
+		rx_mode = CR_W_AB | CR_W_AM;
 	} else {
 		struct dev_mc_list *mclist;
 		int i;
@@ -1765,26 +1841,25 @@
 			bit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F;
 			mc_filter[bit >> 5] |= (1 << bit);
 		}
-		rx_mode = AB | AM;
+		rx_mode = CR_W_AB | CR_W_AM;
 	}
 
-	stop_nic_tx(ioaddr, np->crvalue);
-	stop_nic_rx(ioaddr, np->crvalue & (~0x40000));
+	stop_nic_rxtx(ioaddr, np->crvalue);
 
 	writel(mc_filter[0], ioaddr + MAR0);
 	writel(mc_filter[1], ioaddr + MAR1);
-	np->crvalue &= ~RxModeMask;
+	np->crvalue &= ~CR_W_RXMODEMASK;
 	np->crvalue |= rx_mode;
 	writel(np->crvalue, ioaddr + TCRRCR);
 }
 
-static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
+static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
 	struct netdev_private *np = dev->priv;
 
-	strcpy (info->driver, DRV_NAME);
-	strcpy (info->version, DRV_VERSION);
-	strcpy (info->bus_info, pci_name(np->pci_dev));
+	strcpy(info->driver, DRV_NAME);
+	strcpy(info->version, DRV_VERSION);
+	strcpy(info->bus_info, pci_name(np->pci_dev));
 }
 
 static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
@@ -1848,14 +1923,13 @@
 static int mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct netdev_private *np = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
 	int rc;
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
 	spin_lock_irq(&np->lock);
-	rc = generic_mii_ioctl(&np->mii, data, cmd, NULL);
+	rc = generic_mii_ioctl(&np->mii, if_mii(rq), cmd, NULL);
 	spin_unlock_irq(&np->lock);
 
 	return rc;
@@ -1874,10 +1948,10 @@
 	writel(0x0000, ioaddr + IMR);
 
 	/* Stop the chip's Tx and Rx processes. */
-	stop_nic_tx(ioaddr, 0);
-	stop_nic_rx(ioaddr, 0);
+	stop_nic_rxtx(ioaddr, 0);
 
 	del_timer_sync(&np->timer);
+	del_timer_sync(&np->reset_timer);
 
 	free_irq(dev->irq, dev);
 
@@ -1928,7 +2002,7 @@
 {
 /* when a module, this is printed whether or not devices are found in probe */
 #ifdef MODULE
-	printk (version);
+	printk(version);
 #endif
 
 	return pci_module_init(&fealnx_driver);
diff -Nru a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
--- a/drivers/net/forcedeth.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/forcedeth.c	Tue Jun 15 22:20:36 2004
@@ -556,7 +556,7 @@
 	return &np->stats;
 }
 
-static int nv_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int nv_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct fe_priv *np = get_nvpriv(dev);
 	u8 *base = get_hwbase(dev);
@@ -634,7 +634,7 @@
 {
 	switch(cmd) {
 	case SIOCETHTOOL:
-		return nv_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		return nv_ethtool_ioctl(dev, rq->ifr_data);
 
 	default:
 		return -EOPNOTSUPP;
diff -Nru a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c
--- a/drivers/net/gt96100eth.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/net/gt96100eth.c	Tue Jun 15 22:20:43 2004
@@ -1070,22 +1070,18 @@
 {
 	int retval;
     
-	MOD_INC_USE_COUNT;
-
 	dbg(2, "%s: dev=%p\n", __FUNCTION__, dev);
 
 	// Initialize and startup the GT-96100 ethernet port
 	if ((retval = gt96100_init(dev))) {
 		err("error in gt96100_init\n");
 		free_irq(dev->irq, dev);
-		MOD_DEC_USE_COUNT;
 		return retval;
 	}
 
 	if ((retval = request_irq(dev->irq, &gt96100_interrupt,
 				  SA_SHIRQ, dev->name, dev))) {
 		err("unable to get IRQ %d\n", dev->irq);
-		MOD_DEC_USE_COUNT;
 		return retval;
 	}
 	
@@ -1106,8 +1102,6 @@
 	}
 
 	free_irq(dev->irq, dev);
-    
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
diff -Nru a/drivers/net/hamachi.c b/drivers/net/hamachi.c
--- a/drivers/net/hamachi.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/hamachi.c	Tue Jun 15 22:21:05 2004
@@ -1869,7 +1869,7 @@
 	}
 }
 
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct hamachi_private *np = dev->priv;
 	u32 ethcmd;
@@ -1937,17 +1937,17 @@
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct hamachi_private *np = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 	int rc;
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
 	if (cmd == SIOCETHTOOL)
-		rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		rc = netdev_ethtool_ioctl(dev, rq->ifr_data);
 
 	else if (cmd == (SIOCDEVPRIVATE+3)) { /* set rx,tx intr params */
-		u32 *d = (u32 *)&rq->ifr_data;
+		u32 *d = (u32 *)&rq->ifr_ifru;
 		/* Should add this check here or an ordinary user can do nasty
 		 * things. -KDU
 		 *
diff -Nru a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
--- a/drivers/net/hamradio/baycom_epp.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/hamradio/baycom_epp.c	Tue Jun 15 22:21:05 2004
@@ -1166,8 +1166,6 @@
 	bc = netdev_priv(dev);
 	if (cmd != SIOCDEVPRIVATE)
 		return -ENOIOCTLCMD;
-	if (get_user(cmd, (int *)ifr->ifr_data))
-		return -EFAULT;
 
 	if (copy_from_user(&hi, ifr->ifr_data, sizeof(hi)))
 		return -EFAULT;
diff -Nru a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
--- a/drivers/net/hamradio/baycom_par.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/hamradio/baycom_par.c	Tue Jun 15 22:21:03 2004
@@ -414,7 +414,6 @@
 {
 	struct baycom_state *bc;
 	struct baycom_ioctl bi;
-	int cmd2;
 
 	if (!dev || !dev->priv ||
 	    ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) {
@@ -425,8 +424,6 @@
 
 	if (cmd != SIOCDEVPRIVATE)
 		return -ENOIOCTLCMD;
-	if (get_user(cmd2, (int *)ifr->ifr_data))
-		return -EFAULT;
 	switch (hi->cmd) {
 	default:
 		break;
diff -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	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/hamradio/baycom_ser_fdx.c	Tue Jun 15 22:20:41 2004
@@ -529,7 +529,6 @@
 {
 	struct baycom_state *bc;
 	struct baycom_ioctl bi;
-	int cmd2;
 
 	if (!dev || !dev->priv ||
 	    ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) {
@@ -540,8 +539,6 @@
 
 	if (cmd != SIOCDEVPRIVATE)
 		return -ENOIOCTLCMD;
-	if (get_user(cmd2, (int *)ifr->ifr_data))
-		return -EFAULT;
 	switch (hi->cmd) {
 	default:
 		break;
diff -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	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/hamradio/baycom_ser_hdx.c	Tue Jun 15 22:20:36 2004
@@ -569,7 +569,6 @@
 {
 	struct baycom_state *bc;
 	struct baycom_ioctl bi;
-	int cmd2;
 
 	if (!dev || !dev->priv ||
 	    ((struct baycom_state *)dev->priv)->hdrv.magic != HDLCDRV_MAGIC) {
@@ -580,8 +579,6 @@
 
 	if (cmd != SIOCDEVPRIVATE)
 		return -ENOIOCTLCMD;
-	if (get_user(cmd2, (int *)ifr->ifr_data))
-		return -EFAULT;
 	switch (hi->cmd) {
 	default:
 		break;
diff -Nru a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
--- a/drivers/net/hamradio/bpqether.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/hamradio/bpqether.c	Tue Jun 15 22:20:40 2004
@@ -331,7 +331,7 @@
  */
 static int bpq_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-	struct bpq_ethaddr *ethaddr = (struct bpq_ethaddr *)ifr->ifr_data;
+	struct bpq_ethaddr __user *ethaddr = ifr->ifr_data;
 	struct bpqdev *bpq = dev->priv;
 	struct bpq_req req;
 
diff -Nru a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
--- a/drivers/net/hamradio/dmascc.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/hamradio/dmascc.c	Tue Jun 15 22:20:39 2004
@@ -48,21 +48,6 @@
 #include "z8530.h"
 
 
-/* Linux 2.2 and 2.3 compatibility */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,14)
-#define net_device device
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43)
-#define netif_start_queue(dev) { dev->tbusy = 0; }
-#define netif_stop_queue(dev) { dev->tbusy = 1; }
-#define netif_wake_queue(dev) { dev->tbusy = 0; mark_bh(NET_BH); }
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,47)
-#define netif_running(dev) (dev->flags & IFF_UP)
-#endif
-
-
 /* Number of buffers per channel */
 
 #define NUM_TX_BUF      2          /* NUM_TX_BUF >= 1 (min. 2 recommended) */
@@ -210,9 +195,6 @@
 };
 
 struct scc_priv {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-  char name[IFNAMSIZ];
-#endif
   int type;
   int chip;
   struct net_device *dev;
diff -Nru a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
--- a/drivers/net/hamradio/scc.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/net/hamradio/scc.c	Tue Jun 15 22:20:44 2004
@@ -1714,13 +1714,11 @@
 	struct scc_mem_config memcfg;
 	struct scc_hw_config hwcfg;
 	struct scc_calibrate cal;
-	struct scc_channel *scc;
+	struct scc_channel *scc = (struct scc_channel *) dev->priv;
 	int chan;
 	unsigned char device_name[IFNAMSIZ];
-	void *arg;
+	void __user *arg = ifr->ifr_data;
 	
-	scc = (struct scc_channel *) dev->priv;
-	arg = (void *) ifr->ifr_data;
 	
 	if (!Driver_Initialized)
 	{
diff -Nru a/drivers/net/ibm_emac/Makefile b/drivers/net/ibm_emac/Makefile
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/Makefile	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,12 @@
+#
+# Makefile for the IBM PPC4xx EMAC controllers
+#
+
+obj-$(CONFIG_IBM_EMAC) += ibm_emac.o
+
+ibm_emac-objs := ibm_emac_mal.o ibm_emac_core.o ibm_emac_phy.o
+
+# Only need this if you want to see additional debug messages
+ifeq ($(CONFIG_IBM_EMAC_ERRMSG), y)
+ibm_emac-objs += ibm_emac_debug.o
+endif
diff -Nru a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,263 @@
+/*
+ * ibm_emac.h
+ *
+ *
+ *      Armin Kuster akuster@mvista.com
+ *      June, 2002
+ *
+ * Copyright 2002 MontaVista Softare 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 _IBM_EMAC_H_
+#define _IBM_EMAC_H_
+/* General defines needed for the driver */
+
+/* Emac */
+typedef struct emac_regs {
+	u32 em0mr0;
+	u32 em0mr1;
+	u32 em0tmr0;
+	u32 em0tmr1;
+	u32 em0rmr;
+	u32 em0isr;
+	u32 em0iser;
+	u32 em0iahr;
+	u32 em0ialr;
+	u32 em0vtpid;
+	u32 em0vtci;
+	u32 em0ptr;
+	u32 em0iaht1;
+	u32 em0iaht2;
+	u32 em0iaht3;
+	u32 em0iaht4;
+	u32 em0gaht1;
+	u32 em0gaht2;
+	u32 em0gaht3;
+	u32 em0gaht4;
+	u32 em0lsah;
+	u32 em0lsal;
+	u32 em0ipgvr;
+	u32 em0stacr;
+	u32 em0trtr;
+	u32 em0rwmr;
+} emac_t;
+
+/* MODE REG 0 */
+#define EMAC_M0_RXI			0x80000000
+#define EMAC_M0_TXI			0x40000000
+#define EMAC_M0_SRST			0x20000000
+#define EMAC_M0_TXE			0x10000000
+#define EMAC_M0_RXE			0x08000000
+#define EMAC_M0_WKE			0x04000000
+
+/* MODE Reg 1 */
+#define EMAC_M1_FDE			0x80000000
+#define EMAC_M1_ILE			0x40000000
+#define EMAC_M1_VLE			0x20000000
+#define EMAC_M1_EIFC			0x10000000
+#define EMAC_M1_APP			0x08000000
+#define EMAC_M1_AEMI			0x02000000
+#define EMAC_M1_IST			0x01000000
+#define EMAC_M1_MF_1000GPCS		0x00c00000	/* Internal GPCS */
+#define EMAC_M1_MF_1000MBPS		0x00800000	/* External GPCS */
+#define EMAC_M1_MF_100MBPS		0x00400000
+#define EMAC_M1_RFS_16K                 0x00280000	/* 000 for 512 byte */
+#define EMAC_M1_TR			0x00008000
+#ifdef CONFIG_IBM_EMAC4
+#define EMAC_M1_RFS_8K                  0x00200000
+#define EMAC_M1_RFS_4K                  0x00180000
+#define EMAC_M1_RFS_2K                  0x00100000
+#define EMAC_M1_RFS_1K                  0x00080000
+#define EMAC_M1_TX_FIFO_16K             0x00050000	/* 0's for 512 byte */
+#define EMAC_M1_TX_FIFO_8K              0x00040000
+#define EMAC_M1_TX_FIFO_4K              0x00030000
+#define EMAC_M1_TX_FIFO_2K              0x00020000
+#define EMAC_M1_TX_FIFO_1K              0x00010000
+#define EMAC_M1_TX_TR                   0x00008000
+#define EMAC_M1_TX_MWSW                 0x00001000	/* 0 wait for status */
+#define EMAC_M1_JUMBO_ENABLE            0x00000800	/* Upt to 9Kr status */
+#define EMAC_M1_OPB_CLK_66              0x00000008	/* 66Mhz */
+#define EMAC_M1_OPB_CLK_83              0x00000010	/* 83Mhz */
+#define EMAC_M1_OPB_CLK_100             0x00000018	/* 100Mhz */
+#define EMAC_M1_OPB_CLK_100P            0x00000020	/* 100Mhz+ */
+#else				/* CONFIG_IBM_EMAC4 */
+#define EMAC_M1_RFS_4K			0x00300000	/* ~4k for 512 byte */
+#define EMAC_M1_RFS_2K			0x00200000
+#define EMAC_M1_RFS_1K			0x00100000
+#define EMAC_M1_TX_FIFO_2K		0x00080000	/* 0's for 512 byte */
+#define EMAC_M1_TX_FIFO_1K		0x00040000
+#define EMAC_M1_TR0_DEPEND		0x00010000	/* 0'x for single packet */
+#define EMAC_M1_TR1_DEPEND		0x00004000
+#define EMAC_M1_TR1_MULTI		0x00002000
+#define EMAC_M1_JUMBO_ENABLE		0x00001000
+#endif				/* CONFIG_IBM_EMAC4 */
+#define EMAC_M1_BASE			(EMAC_M1_TX_FIFO_2K | \
+					EMAC_M1_APP | \
+					EMAC_M1_TR)
+
+/* Transmit Mode Register 0 */
+#define EMAC_TMR0_GNP0			0x80000000
+#define EMAC_TMR0_GNP1			0x40000000
+#define EMAC_TMR0_GNPD			0x20000000
+#define EMAC_TMR0_FC			0x10000000
+#define EMAC_TMR0_TFAE_2_32		0x00000001
+#define EMAC_TMR0_TFAE_4_64		0x00000002
+#define EMAC_TMR0_TFAE_8_128		0x00000003
+#define EMAC_TMR0_TFAE_16_256		0x00000004
+#define EMAC_TMR0_TFAE_32_512		0x00000005
+#define EMAC_TMR0_TFAE_64_1024		0x00000006
+#define EMAC_TMR0_TFAE_128_2048		0x00000007
+
+/* Receive Mode Register */
+#define EMAC_RMR_SP			0x80000000
+#define EMAC_RMR_SFCS			0x40000000
+#define EMAC_RMR_ARRP			0x20000000
+#define EMAC_RMR_ARP			0x10000000
+#define EMAC_RMR_AROP			0x08000000
+#define EMAC_RMR_ARPI			0x04000000
+#define EMAC_RMR_PPP			0x02000000
+#define EMAC_RMR_PME			0x01000000
+#define EMAC_RMR_PMME			0x00800000
+#define EMAC_RMR_IAE			0x00400000
+#define EMAC_RMR_MIAE			0x00200000
+#define EMAC_RMR_BAE			0x00100000
+#define EMAC_RMR_MAE			0x00080000
+#define EMAC_RMR_RFAF_2_32		0x00000001
+#define EMAC_RMR_RFAF_4_64		0x00000002
+#define EMAC_RMR_RFAF_8_128		0x00000003
+#define EMAC_RMR_RFAF_16_256		0x00000004
+#define EMAC_RMR_RFAF_32_512		0x00000005
+#define EMAC_RMR_RFAF_64_1024		0x00000006
+#define EMAC_RMR_RFAF_128_2048		0x00000007
+#define EMAC_RMR_BASE			(EMAC_RMR_IAE | EMAC_RMR_BAE)
+
+/* Interrupt Status & enable Regs */
+#define EMAC_ISR_OVR			0x02000000
+#define EMAC_ISR_PP			0x01000000
+#define EMAC_ISR_BP			0x00800000
+#define EMAC_ISR_RP			0x00400000
+#define EMAC_ISR_SE			0x00200000
+#define EMAC_ISR_ALE			0x00100000
+#define EMAC_ISR_BFCS			0x00080000
+#define EMAC_ISR_PTLE			0x00040000
+#define EMAC_ISR_ORE			0x00020000
+#define EMAC_ISR_IRE			0x00010000
+#define EMAC_ISR_DBDM			0x00000200
+#define EMAC_ISR_DB0			0x00000100
+#define EMAC_ISR_SE0			0x00000080
+#define EMAC_ISR_TE0			0x00000040
+#define EMAC_ISR_DB1			0x00000020
+#define EMAC_ISR_SE1			0x00000010
+#define EMAC_ISR_TE1			0x00000008
+#define EMAC_ISR_MOS			0x00000002
+#define EMAC_ISR_MOF			0x00000001
+
+/* STA CONTROL REG */
+#define EMAC_STACR_OC			0x00008000
+#define EMAC_STACR_PHYE			0x00004000
+#define EMAC_STACR_WRITE		0x00002000
+#define EMAC_STACR_READ			0x00001000
+#define EMAC_STACR_CLK_83MHZ		0x00000800	/* 0's for 50Mhz */
+#define EMAC_STACR_CLK_66MHZ		0x00000400
+#define EMAC_STACR_CLK_100MHZ		0x00000C00
+
+/* Transmit Request Threshold Register */
+#define EMAC_TRTR_1600			0x18000000	/* 0's for 64 Bytes */
+#define EMAC_TRTR_1024			0x0f000000
+#define EMAC_TRTR_512			0x07000000
+#define EMAC_TRTR_256			0x03000000
+#define EMAC_TRTR_192			0x10000000
+#define EMAC_TRTR_128			0x01000000
+
+#define EMAC_TX_CTRL_GFCS		0x0200
+#define EMAC_TX_CTRL_GP			0x0100
+#define EMAC_TX_CTRL_ISA		0x0080
+#define EMAC_TX_CTRL_RSA		0x0040
+#define EMAC_TX_CTRL_IVT		0x0020
+#define EMAC_TX_CTRL_RVT		0x0010
+#define EMAC_TX_CTRL_TAH_CSUM		0x000e	/* TAH only */
+#define EMAC_TX_CTRL_TAH_SEG4		0x000a	/* TAH only */
+#define EMAC_TX_CTRL_TAH_SEG3		0x0008	/* TAH only */
+#define EMAC_TX_CTRL_TAH_SEG2		0x0006	/* TAH only */
+#define EMAC_TX_CTRL_TAH_SEG1		0x0004	/* TAH only */
+#define EMAC_TX_CTRL_TAH_SEG0		0x0002	/* TAH only */
+#define EMAC_TX_CTRL_TAH_DIS		0x0000	/* TAH only */
+
+#define EMAC_TX_CTRL_DFLT ( \
+	MAL_TX_CTRL_INTR | EMAC_TX_CTRL_GFCS | EMAC_TX_CTRL_GP )
+
+/* madmal transmit status / Control bits */
+#define EMAC_TX_ST_BFCS			0x0200
+#define EMAC_TX_ST_BPP			0x0100
+#define EMAC_TX_ST_LCS			0x0080
+#define EMAC_TX_ST_ED			0x0040
+#define EMAC_TX_ST_EC			0x0020
+#define EMAC_TX_ST_LC			0x0010
+#define EMAC_TX_ST_MC			0x0008
+#define EMAC_TX_ST_SC			0x0004
+#define EMAC_TX_ST_UR			0x0002
+#define EMAC_TX_ST_SQE			0x0001
+
+/* madmal receive status / Control bits */
+#define EMAC_RX_ST_OE			0x0200
+#define EMAC_RX_ST_PP			0x0100
+#define EMAC_RX_ST_BP			0x0080
+#define EMAC_RX_ST_RP			0x0040
+#define EMAC_RX_ST_SE			0x0020
+#define EMAC_RX_ST_AE			0x0010
+#define EMAC_RX_ST_BFCS			0x0008
+#define EMAC_RX_ST_PTL			0x0004
+#define EMAC_RX_ST_ORE			0x0002
+#define EMAC_RX_ST_IRE			0x0001
+#define EMAC_BAD_RX_PACKET		0x02ff
+#define EMAC_CSUM_VER_ERROR		0x0003
+
+/* identify a bad rx packet dependent on emac features */
+#ifdef CONFIG_IBM_EMAC4
+#define EMAC_IS_BAD_RX_PACKET(desc) \
+	(((desc & (EMAC_BAD_RX_PACKET & ~EMAC_CSUM_VER_ERROR)) || \
+	((desc & EMAC_CSUM_VER_ERROR) == EMAC_RX_ST_ORE) || \
+	((desc & EMAC_CSUM_VER_ERROR) == EMAC_RX_ST_IRE)))
+#else
+#define EMAC_IS_BAD_RX_PACKET(desc) \
+	 (desc & EMAC_BAD_RX_PACKET)
+#endif
+
+/* Revision specific EMAC register defaults */
+#ifdef CONFIG_IBM_EMAC4
+#define EMAC_M1_DEFAULT			(EMAC_M1_BASE | \
+					EMAC_M1_OPB_CLK_83 | \
+					EMAC_M1_TX_MWSW)
+#define EMAC_RMR_DEFAULT		(EMAC_RMR_BASE | \
+					EMAC_RMR_RFAF_128_2048)
+#define EMAC_TMR0_XMIT			(EMAC_TMR0_GNP0 | \
+					EMAC_TMR0_TFAE_128_2048)
+#define EMAC_TRTR_DEFAULT		EMAC_TRTR_1024
+#else				/* !CONFIG_IBM_EMAC4 */
+#define EMAC_M1_DEFAULT			EMAC_M1_BASE
+#define EMAC_RMR_DEFAULT		EMAC_RMR_BASE
+#define EMAC_TMR0_XMIT			EMAC_TMR0_GNP0
+#define EMAC_TRTR_DEFAULT		EMAC_TRTR_1600
+#endif				/* CONFIG_IBM_EMAC4 */
+
+/* SoC implementation specific EMAC register defaults */
+#if defined(CONFIG_440GP)
+#define EMAC_RWMR_DEFAULT		0x80009000
+#define EMAC_TMR0_DEFAULT		0x00000000
+#define EMAC_TMR1_DEFAULT		0xf8640000
+#elif defined(CONFIG_440GX)
+#define EMAC_RWMR_DEFAULT		0x1000a200
+#define EMAC_TMR0_DEFAULT		EMAC_TMR0_TFAE_128_2048
+#define EMAC_TMR1_DEFAULT		0x88810000
+#else
+#define EMAC_RWMR_DEFAULT		0x0f002000
+#define EMAC_TMR0_DEFAULT		0x00000000
+#define EMAC_TMR1_DEFAULT		0x380f0000
+#endif				/* CONFIG_440GP */
+
+#endif
diff -Nru a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_core.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1968 @@
+/*
+ * ibm_emac_core.c
+ *
+ * Ethernet driver for the built in ethernet on the IBM 4xx PowerPC
+ * processors.
+ * 
+ * (c) 2003 Benjamin Herrenschmidt <benh@kernel.crashing.org>
+ *
+ * Based on original work by
+ *
+ *      Armin Kuster <akuster@mvista.com>
+ * 	Johnnie Peters <jpeters@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.
+ * TODO
+ *       - Check for races in the "remove" code path
+ *       - Add some Power Management to the MAC and the PHY
+ *       - Audit remaining of non-rewritten code (--BenH)
+ *       - Cleanup message display using msglevel mecanism
+ *       - Address all errata
+ *       - Audit all register update paths to ensure they
+ *         are being written post soft reset if required.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/timer.h>
+#include <linux/ptrace.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/dma-mapping.h>
+#include <linux/ethtool.h>
+#include <linux/mii.h>
+
+#include <asm/processor.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <asm/dma.h>
+#include <asm/irq.h>
+#include <asm/uaccess.h>
+#include <asm/ocp.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/crc32.h>
+
+#include "ibm_emac_core.h"
+
+//#define MDIO_DEBUG(fmt) printk fmt
+#define MDIO_DEBUG(fmt)
+
+//#define LINK_DEBUG(fmt) printk fmt
+#define LINK_DEBUG(fmt)
+
+//#define PKT_DEBUG(fmt) printk fmt
+#define PKT_DEBUG(fmt)
+
+#define DRV_NAME        "emac"
+#define DRV_VERSION     "2.0"
+#define DRV_AUTHOR      "Benjamin Herrenschmidt <benh@kernel.crashing.org>"
+#define DRV_DESC        "IBM EMAC Ethernet driver"
+
+/*
+ * When mdio_idx >= 0, contains a list of emac ocp_devs
+ * that have had their initialization deferred until the
+ * common MDIO controller has been initialized.
+ */
+LIST_HEAD(emac_init_list);
+
+MODULE_AUTHOR(DRV_AUTHOR);
+MODULE_DESCRIPTION(DRV_DESC);
+MODULE_LICENSE("GPL");
+
+static int skb_res = SKB_RES;
+module_param(skb_res, int, 0444);
+MODULE_PARM_DESC(skb_res, "Amount of data to reserve on skb buffs\n"
+		 "The 405 handles a misaligned IP header fine but\n"
+		 "this can help if you are routing to a tunnel or a\n"
+		 "device that needs aligned data. 0..2");
+
+#define RGMII_PRIV(ocpdev) ((struct ibm_ocp_rgmii*)ocp_get_drvdata(ocpdev))
+
+static unsigned int rgmii_enable[] =
+    { RGMII_RTBI, RGMII_RGMII, RGMII_TBI, RGMII_GMII };
+
+static unsigned int rgmii_speed_mask[] = { 0,
+	0,
+	RGMII_MII2_SPDMASK,
+	RGMII_MII3_SPDMASK
+};
+
+static unsigned int rgmii_speed100[] = { 0,
+	0,
+	RGMII_MII2_100MB,
+	RGMII_MII3_100MB
+};
+
+static unsigned int rgmii_speed1000[] = { 0,
+	0,
+	RGMII_MII2_1000MB,
+	RGMII_MII3_1000MB
+};
+
+#define ZMII_PRIV(ocpdev) ((struct ibm_ocp_zmii*)ocp_get_drvdata(ocpdev))
+
+static unsigned int zmii_enable[][4] = {
+	{ZMII_SMII0, ZMII_RMII0, ZMII_MII0,
+	 ~(ZMII_MDI1 | ZMII_MDI2 | ZMII_MDI3)},
+	{ZMII_SMII1, ZMII_RMII1, ZMII_MII1,
+	 ~(ZMII_MDI0 | ZMII_MDI2 | ZMII_MDI3)},
+	{ZMII_SMII2, ZMII_RMII2, ZMII_MII2,
+	 ~(ZMII_MDI0 | ZMII_MDI1 | ZMII_MDI3)},
+	{ZMII_SMII3, ZMII_RMII3, ZMII_MII3, ~(ZMII_MDI0 | ZMII_MDI1 | ZMII_MDI2)}
+};
+static unsigned int mdi_enable[] =
+    { ZMII_MDI0, ZMII_MDI1, ZMII_MDI2, ZMII_MDI3 };
+
+static unsigned int zmii_speed = 0x0;
+static unsigned int zmii_speed100[] = { ZMII_MII0_100MB, ZMII_MII1_100MB };
+
+/* Since multiple EMACs share MDIO lines in various ways, we need
+ * to avoid re-using the same PHY ID in cases where the arch didn't
+ * setup precise phy_map entries
+ */
+static u32 busy_phy_map = 0;
+
+/* If EMACs share a common MDIO device, this points to it */
+static struct net_device *mdio_ndev = NULL;
+
+struct emac_def_dev {
+	struct list_head link;
+	struct ocp_device *ocpdev;
+	struct ibm_ocp_mal *mal;
+};
+
+static struct net_device_stats *emac_stats(struct net_device *dev)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	return &fep->stats;
+};
+
+static int
+emac_init_rgmii(struct ocp_device *rgmii_dev, int input, int phy_mode)
+{
+	struct ibm_ocp_rgmii *rgmii = RGMII_PRIV(rgmii_dev);
+	const char *mode_name[] = { "RTBI", "RGMII", "TBI", "GMII" };
+	int mode = -1;
+
+	if (!rgmii) {
+		rgmii = kmalloc(sizeof(struct ibm_ocp_rgmii), GFP_KERNEL);
+
+		if (rgmii == NULL) {
+			printk(KERN_ERR
+			       "rgmii%d: Out of memory allocating RGMII structure!\n",
+			       rgmii_dev->def->index);
+			return -ENOMEM;
+		}
+
+		memset(rgmii, 0, sizeof(*rgmii));
+
+		rgmii->base =
+		    (struct rgmii_regs *)ioremap(rgmii_dev->def->paddr,
+						 sizeof(*rgmii->base));
+		if (rgmii->base == NULL) {
+			printk(KERN_ERR
+			       "rgmii%d: Cannot ioremap bridge registers!\n",
+			       rgmii_dev->def->index);
+
+			kfree(rgmii);
+			return -ENOMEM;
+		}
+		ocp_set_drvdata(rgmii_dev, rgmii);
+	}
+
+	if (phy_mode) {
+		switch (phy_mode) {
+		case PHY_MODE_GMII:
+			mode = GMII;
+			break;
+		case PHY_MODE_TBI:
+			mode = TBI;
+			break;
+		case PHY_MODE_RTBI:
+			mode = RTBI;
+			break;
+		case PHY_MODE_RGMII:
+		default:
+			mode = RGMII;
+		}
+		rgmii->base->fer &= ~RGMII_FER_MASK(input);
+		rgmii->base->fer |= rgmii_enable[mode] << (4 * input);
+	} else {
+		switch ((rgmii->base->fer & RGMII_FER_MASK(input)) >> (4 *
+								       input)) {
+		case RGMII_RTBI:
+			mode = RTBI;
+			break;
+		case RGMII_RGMII:
+			mode = RGMII;
+			break;
+		case RGMII_TBI:
+			mode = TBI;
+			break;
+		case RGMII_GMII:
+			mode = GMII;
+		}
+	}
+
+	/* Set mode to RGMII if nothing valid is detected */
+	if (mode < 0)
+		mode = RGMII;
+
+	printk(KERN_NOTICE "rgmii%d: input %d in %s mode\n",
+	       rgmii_dev->def->index, input, mode_name[mode]);
+
+	rgmii->mode[input] = mode;
+	rgmii->users++;
+
+	return 0;
+}
+
+static void
+emac_rgmii_port_speed(struct ocp_device *ocpdev, int input, int speed)
+{
+	struct ibm_ocp_rgmii *rgmii = RGMII_PRIV(ocpdev);
+	unsigned int rgmii_speed;
+
+	rgmii_speed = in_be32(&rgmii->base->ssr);
+
+	rgmii_speed &= ~rgmii_speed_mask[input];
+
+	if (speed == 1000)
+		rgmii_speed |= rgmii_speed1000[input];
+	else if (speed == 100)
+		rgmii_speed |= rgmii_speed100[input];
+
+	out_be32(&rgmii->base->ssr, rgmii_speed);
+}
+
+static void emac_close_rgmii(struct ocp_device *ocpdev)
+{
+	struct ibm_ocp_rgmii *rgmii = RGMII_PRIV(ocpdev);
+	BUG_ON(!rgmii || rgmii->users == 0);
+
+	if (!--rgmii->users) {
+		ocp_set_drvdata(ocpdev, NULL);
+		iounmap((void *)rgmii->base);
+		kfree(rgmii);
+	}
+}
+
+static int emac_init_zmii(struct ocp_device *zmii_dev, int input, int phy_mode)
+{
+	struct ibm_ocp_zmii *zmii = ZMII_PRIV(zmii_dev);
+	const char *mode_name[] = { "SMII", "RMII", "MII" };
+	int mode = -1;
+
+	if (!zmii) {
+		zmii = kmalloc(sizeof(struct ibm_ocp_zmii), GFP_KERNEL);
+		if (zmii == NULL) {
+			printk(KERN_ERR
+			       "zmii%d: Out of memory allocating ZMII structure!\n",
+			       zmii_dev->def->index);
+			return -ENOMEM;
+		}
+		memset(zmii, 0, sizeof(*zmii));
+
+		zmii->base =
+		    (struct zmii_regs *)ioremap(zmii_dev->def->paddr,
+						sizeof(*zmii->base));
+		if (zmii->base == NULL) {
+			printk(KERN_ERR
+			       "zmii%d: Cannot ioremap bridge registers!\n",
+			       zmii_dev->def->index);
+
+			kfree(zmii);
+			return -ENOMEM;
+		}
+		ocp_set_drvdata(zmii_dev, zmii);
+	}
+
+	if (phy_mode) {
+		switch (phy_mode) {
+		case PHY_MODE_MII:
+			mode = MII;
+			break;
+		case PHY_MODE_RMII:
+			mode = RMII;
+			break;
+		case PHY_MODE_SMII:
+		default:
+			mode = SMII;
+		}
+		zmii->base->fer &= ~ZMII_FER_MASK(input);
+		zmii->base->fer |= zmii_enable[input][mode];
+	} else {
+		switch ((zmii->base->fer & ZMII_FER_MASK(input)) << (4 * input)) {
+		case ZMII_MII0:
+			mode = MII;
+			break;
+		case ZMII_RMII0:
+			mode = RMII;
+			break;
+		case ZMII_SMII0:
+			mode = SMII;
+		}
+	}
+
+	/* Set mode to SMII if nothing valid is detected */
+	if (mode < 0)
+		mode = SMII;
+
+	printk(KERN_NOTICE "zmii%d: input %d in %s mode\n",
+	       zmii_dev->def->index, input, mode_name[mode]);
+
+	zmii->mode[input] = mode;
+	zmii->users++;
+
+	return 0;
+}
+
+static void emac_enable_zmii_port(struct ocp_device *ocpdev, int input)
+{
+	u32 mask;
+	struct ibm_ocp_zmii *zmii = ZMII_PRIV(ocpdev);
+
+	mask = in_be32(&zmii->base->fer);
+	mask &= zmii_enable[input][MDI];	/* turn all non enabled MDI's off */
+	mask |= zmii_enable[input][zmii->mode[input]] | mdi_enable[input];
+	out_be32(&zmii->base->fer, mask);
+}
+
+static void
+emac_zmii_port_speed(struct ocp_device *ocpdev, int input, int speed)
+{
+	struct ibm_ocp_zmii *zmii = ZMII_PRIV(ocpdev);
+
+	if (speed == 100)
+		zmii_speed |= zmii_speed100[input];
+	else
+		zmii_speed &= ~zmii_speed100[input];
+
+	out_be32(&zmii->base->ssr, zmii_speed);
+}
+
+static void emac_close_zmii(struct ocp_device *ocpdev)
+{
+	struct ibm_ocp_zmii *zmii = ZMII_PRIV(ocpdev);
+	BUG_ON(!zmii || zmii->users == 0);
+
+	if (!--zmii->users) {
+		ocp_set_drvdata(ocpdev, NULL);
+		iounmap((void *)zmii->base);
+		kfree(zmii);
+	}
+}
+
+int emac_phy_read(struct net_device *dev, int mii_id, int reg)
+{
+	uint32_t stacr;
+	struct ocp_enet_private *fep = dev->priv;
+	emac_t *emacp = fep->emacp;
+
+	MDIO_DEBUG(("%s: phy_read, id: 0x%x, reg: 0x%x\n", dev->name, mii_id,
+		    reg));
+
+	/* Enable proper ZMII port */
+	if (fep->zmii_dev)
+		emac_enable_zmii_port(fep->zmii_dev, fep->zmii_input);
+
+	/* Use the EMAC that has the MDIO port */
+	if (fep->mdio_dev) {
+		dev = fep->mdio_dev;
+		fep = dev->priv;
+		emacp = fep->emacp;
+	}
+
+	udelay(MDIO_DELAY);
+
+	if ((in_be32(&emacp->em0stacr) & EMAC_STACR_OC) == 0) {
+		printk(KERN_WARNING "%s: PHY read timeout #1!\n", dev->name);
+		return -1;
+	}
+
+	/* Clear the speed bits and make a read request to the PHY */
+	stacr = ((EMAC_STACR_READ | (reg & 0x1f)) & ~EMAC_STACR_CLK_100MHZ);
+	stacr |= ((mii_id & 0x1F) << 5);
+
+	out_be32(&emacp->em0stacr, stacr);
+
+	udelay(MDIO_DELAY);
+	stacr = in_be32(&emacp->em0stacr);
+
+	if ((stacr & EMAC_STACR_OC) == 0) {
+		printk(KERN_WARNING "%s: PHY read timeout #2!\n", dev->name);
+		return -1;
+	}
+
+	/* Check for a read error */
+	if (stacr & EMAC_STACR_PHYE) {
+		MDIO_DEBUG(("EMAC MDIO PHY error !\n"));
+		return -1;
+	}
+
+	MDIO_DEBUG((" -> 0x%x\n", stacr >> 16));
+
+	return (stacr >> 16);
+}
+
+void emac_phy_write(struct net_device *dev, int mii_id, int reg, int data)
+{
+	uint32_t stacr;
+	struct ocp_enet_private *fep = dev->priv;
+	emac_t *emacp = fep->emacp;
+
+	MDIO_DEBUG(("%s phy_write, id: 0x%x, reg: 0x%x, data: 0x%x\n",
+		    dev->name, mii_id, reg, data));
+
+	/* Enable proper ZMII port */
+	if (fep->zmii_dev)
+		emac_enable_zmii_port(fep->zmii_dev, fep->zmii_input);
+
+	/* Use the EMAC that has the MDIO port */
+	if (fep->mdio_dev) {
+		dev = fep->mdio_dev;
+		fep = dev->priv;
+		emacp = fep->emacp;
+	}
+
+	udelay(MDIO_DELAY);
+
+	if ((in_be32(&emacp->em0stacr) & EMAC_STACR_OC) == 0) {
+		printk(KERN_WARNING "%s: PHY write timeout #2!\n", dev->name);
+		return;
+	}
+
+	/* Clear the speed bits and make a read request to the PHY */
+
+	stacr = ((EMAC_STACR_WRITE | (reg & 0x1f)) & ~EMAC_STACR_CLK_100MHZ);
+	stacr |= ((mii_id & 0x1f) << 5) | ((data & 0xffff) << 16);
+
+	out_be32(&emacp->em0stacr, stacr);
+
+	udelay(MDIO_DELAY);
+
+	if ((in_be32(&emacp->em0stacr) & EMAC_STACR_OC) == 0)
+		printk(KERN_WARNING "%s: PHY write timeout #2!\n", dev->name);
+
+	/* Check for a write error */
+	if ((stacr & EMAC_STACR_PHYE) != 0) {
+		MDIO_DEBUG(("EMAC MDIO PHY error !\n"));
+	}
+}
+
+static void emac_txeob_dev(void *param, u32 chanmask)
+{
+	struct net_device *dev = param;
+	struct ocp_enet_private *fep = dev->priv;
+	unsigned long flags;
+
+	spin_lock_irqsave(&fep->lock, flags);
+
+	PKT_DEBUG(("emac_txeob_dev() entry, tx_cnt: %d\n", fep->tx_cnt));
+
+	while (fep->tx_cnt &&
+	       !(fep->tx_desc[fep->ack_slot].ctrl & MAL_TX_CTRL_READY)) {
+
+		if (fep->tx_desc[fep->ack_slot].ctrl & MAL_TX_CTRL_LAST) {
+			/* Tell the system the transmit completed. */
+			dma_unmap_single(&fep->ocpdev->dev,
+					 fep->tx_desc[fep->ack_slot].data_ptr,
+					 fep->tx_desc[fep->ack_slot].data_len,
+					 DMA_TO_DEVICE);
+			dev_kfree_skb_irq(fep->tx_skb[fep->ack_slot]);
+
+			if (fep->tx_desc[fep->ack_slot].ctrl &
+			    (EMAC_TX_ST_EC | EMAC_TX_ST_MC | EMAC_TX_ST_SC))
+				fep->stats.collisions++;
+		}
+
+		fep->tx_skb[fep->ack_slot] = (struct sk_buff *)NULL;
+		if (++fep->ack_slot == NUM_TX_BUFF)
+			fep->ack_slot = 0;
+
+		fep->tx_cnt--;
+	}
+	if (fep->tx_cnt < NUM_TX_BUFF)
+		netif_wake_queue(dev);
+
+	PKT_DEBUG(("emac_txeob_dev() exit, tx_cnt: %d\n", fep->tx_cnt));
+
+	spin_unlock_irqrestore(&fep->lock, flags);
+}
+
+/*
+  Fill/Re-fill the rx chain with valid ctrl/ptrs.
+  This function will fill from rx_slot up to the parm end.
+  So to completely fill the chain pre-set rx_slot to 0 and
+  pass in an end of 0.
+ */
+static void emac_rx_fill(struct net_device *dev, int end)
+{
+	int i;
+	struct ocp_enet_private *fep = dev->priv;
+
+	i = fep->rx_slot;
+	do {
+		/* We don't want the 16 bytes skb_reserve done by dev_alloc_skb,
+		 * it breaks our cache line alignement. However, we still allocate
+		 * +16 so that we end up allocating the exact same size as
+		 * dev_alloc_skb() would do.
+		 * Also, because of the skb_res, the max DMA size we give to EMAC
+		 * is slighly wrong, causing it to potentially DMA 2 more bytes
+		 * from a broken/oversized packet. These 16 bytes will take care
+		 * that we don't walk on somebody else toes with that.
+		 */
+		fep->rx_skb[i] =
+		    alloc_skb(fep->rx_buffer_size + 16, GFP_ATOMIC);
+
+		if (fep->rx_skb[i] == NULL) {
+			/* Keep rx_slot here, the next time clean/fill is called
+			 * we will try again before the MAL wraps back here
+			 * If the MAL tries to use this descriptor with
+			 * the EMPTY bit off it will cause the
+			 * rxde interrupt.  That is where we will
+			 * try again to allocate an sk_buff.
+			 */
+			break;
+
+		}
+
+		if (skb_res)
+			skb_reserve(fep->rx_skb[i], skb_res);
+
+		/* We must NOT dma_map_single the cache line right after the
+		 * buffer, so we must crop our sync size to account for the
+		 * reserved space
+		 */
+		fep->rx_desc[i].data_ptr =
+		    (unsigned char *)dma_map_single(&fep->ocpdev->dev,
+						    (void *)fep->rx_skb[i]->
+						    data,
+						    fep->rx_buffer_size -
+						    skb_res, DMA_FROM_DEVICE);
+
+		/*
+		 * Some 4xx implementations use the previously
+		 * reserved bits in data_len to encode the MS
+		 * 4-bits of a 36-bit physical address (ERPN)
+		 * This must be initialized.
+		 */
+		fep->rx_desc[i].data_len = 0;
+		fep->rx_desc[i].ctrl = MAL_RX_CTRL_EMPTY | MAL_RX_CTRL_INTR |
+		    (i == (NUM_RX_BUFF - 1) ? MAL_RX_CTRL_WRAP : 0);
+
+	} while ((i = (i + 1) % NUM_RX_BUFF) != end);
+
+	fep->rx_slot = i;
+}
+
+static void
+emac_rx_csum(struct net_device *dev, unsigned short ctrl, struct sk_buff *skb)
+{
+	struct ocp_enet_private *fep = dev->priv;
+
+	/* Exit if interface has no TAH engine */
+	if (!fep->tah_dev) {
+		skb->ip_summed = CHECKSUM_NONE;
+		return;
+	}
+
+	/* Check for TCP/UDP/IP csum error */
+	if (ctrl & EMAC_CSUM_VER_ERROR) {
+		/* Let the stack verify checksum errors */
+		skb->ip_summed = CHECKSUM_NONE;
+/*		adapter->hw_csum_err++; */
+	} else {
+		/* Csum is good */
+		skb->ip_summed = CHECKSUM_UNNECESSARY;
+/*		adapter->hw_csum_good++; */
+	}
+}
+
+static int emac_rx_clean(struct net_device *dev)
+{
+	int i, b, bnum, buf[6];
+	int error, frame_length;
+	struct ocp_enet_private *fep = dev->priv;
+	unsigned short ctrl;
+
+	i = fep->rx_slot;
+
+	PKT_DEBUG(("emac_rx_clean() entry, rx_slot: %d\n", fep->rx_slot));
+
+	do {
+		if (fep->rx_skb[i] == NULL)
+			continue;	/*we have already handled the packet but haved failed to alloc */
+		/* 
+		   since rx_desc is in uncached mem we don't keep reading it directly 
+		   we pull out a local copy of ctrl and do the checks on the copy.
+		 */
+		ctrl = fep->rx_desc[i].ctrl;
+		if (ctrl & MAL_RX_CTRL_EMPTY)
+			break;	/*we don't have any more ready packets */
+
+		if (EMAC_IS_BAD_RX_PACKET(ctrl)) {
+			fep->stats.rx_errors++;
+			fep->stats.rx_dropped++;
+
+			if (ctrl & EMAC_RX_ST_OE)
+				fep->stats.rx_fifo_errors++;
+			if (ctrl & EMAC_RX_ST_AE)
+				fep->stats.rx_frame_errors++;
+			if (ctrl & EMAC_RX_ST_BFCS)
+				fep->stats.rx_crc_errors++;
+			if (ctrl & (EMAC_RX_ST_RP | EMAC_RX_ST_PTL |
+				    EMAC_RX_ST_ORE | EMAC_RX_ST_IRE))
+				fep->stats.rx_length_errors++;
+		} else {
+			if ((ctrl & (MAL_RX_CTRL_FIRST | MAL_RX_CTRL_LAST)) ==
+			    (MAL_RX_CTRL_FIRST | MAL_RX_CTRL_LAST)) {
+				/* Single descriptor packet */
+				emac_rx_csum(dev, ctrl, fep->rx_skb[i]);
+				/* Send the skb up the chain. */
+				frame_length = fep->rx_desc[i].data_len - 4;
+				skb_put(fep->rx_skb[i], frame_length);
+				fep->rx_skb[i]->dev = dev;
+				fep->rx_skb[i]->protocol =
+				    eth_type_trans(fep->rx_skb[i], dev);
+				error = netif_rx(fep->rx_skb[i]);
+
+				if ((error == NET_RX_DROP) ||
+				    (error == NET_RX_BAD)) {
+					fep->stats.rx_dropped++;
+				} else {
+					fep->stats.rx_packets++;
+					fep->stats.rx_bytes += frame_length;
+				}
+				fep->rx_skb[i] = NULL;
+			} else {
+				/* Multiple descriptor packet */
+				if (ctrl & MAL_RX_CTRL_FIRST) {
+					if (fep->rx_desc[(i + 1) % NUM_RX_BUFF].
+					    ctrl & MAL_RX_CTRL_EMPTY)
+						break;
+					bnum = 0;
+					buf[bnum] = i;
+					++bnum;
+					continue;
+				}
+				if (((ctrl & MAL_RX_CTRL_FIRST) !=
+				     MAL_RX_CTRL_FIRST) &&
+				    ((ctrl & MAL_RX_CTRL_LAST) !=
+				     MAL_RX_CTRL_LAST)) {
+					if (fep->rx_desc[(i + 1) %
+							 NUM_RX_BUFF].ctrl &
+					    MAL_RX_CTRL_EMPTY) {
+						i = buf[0];
+						break;
+					}
+					buf[bnum] = i;
+					++bnum;
+					continue;
+				}
+				if (ctrl & MAL_RX_CTRL_LAST) {
+					buf[bnum] = i;
+					++bnum;
+					skb_put(fep->rx_skb[buf[0]],
+						fep->rx_desc[buf[0]].data_len);
+					for (b = 1; b < bnum; b++) {
+						/*
+						 * MAL is braindead, we need
+						 * to copy the remainder
+						 * of the packet from the
+						 * latter descriptor buffers
+						 * to the first skb. Then
+						 * dispose of the source
+						 * skbs.
+						 *
+						 * Once the stack is fixed
+						 * to handle frags on most
+						 * protocols we can generate
+						 * a fragmented skb with
+						 * no copies.
+						 */
+						memcpy(fep->rx_skb[buf[0]]->
+						       data +
+						       fep->rx_skb[buf[0]]->len,
+						       fep->rx_skb[buf[b]]->
+						       data,
+						       fep->rx_desc[buf[b]].
+						       data_len);
+						skb_put(fep->rx_skb[buf[0]],
+							fep->rx_desc[buf[b]].
+							data_len);
+						dma_unmap_single(&fep->ocpdev->
+								 dev,
+								 fep->
+								 rx_desc[buf
+									 [b]].
+								 data_ptr,
+								 fep->
+								 rx_desc[buf
+									 [b]].
+								 data_len,
+								 DMA_FROM_DEVICE);
+						dev_kfree_skb(fep->
+							      rx_skb[buf[b]]);
+					}
+					emac_rx_csum(dev, ctrl,
+						     fep->rx_skb[buf[0]]);
+
+					fep->rx_skb[buf[0]]->dev = dev;
+					fep->rx_skb[buf[0]]->protocol =
+					    eth_type_trans(fep->rx_skb[buf[0]],
+							   dev);
+					error = netif_rx(fep->rx_skb[buf[0]]);
+
+					if ((error == NET_RX_DROP)
+					    || (error == NET_RX_BAD)) {
+						fep->stats.rx_dropped++;
+					} else {
+						fep->stats.rx_packets++;
+						fep->stats.rx_bytes +=
+						    fep->rx_skb[buf[0]]->len;
+					}
+					for (b = 0; b < bnum; b++)
+						fep->rx_skb[buf[b]] = NULL;
+				}
+			}
+		}
+	} while ((i = (i + 1) % NUM_RX_BUFF) != fep->rx_slot);
+
+	PKT_DEBUG(("emac_rx_clean() exit, rx_slot: %d\n", fep->rx_slot));
+
+	return i;
+}
+
+static void emac_rxeob_dev(void *param, u32 chanmask)
+{
+	struct net_device *dev = param;
+	struct ocp_enet_private *fep = dev->priv;
+	unsigned long flags;
+	int n;
+
+	spin_lock_irqsave(&fep->lock, flags);
+	if ((n = emac_rx_clean(dev)) != fep->rx_slot)
+		emac_rx_fill(dev, n);
+	spin_unlock_irqrestore(&fep->lock, flags);
+}
+
+/*
+ * This interrupt should never occurr, we don't program
+ * the MAL for contiunous mode.
+ */
+static void emac_txde_dev(void *param, u32 chanmask)
+{
+	struct net_device *dev = param;
+	struct ocp_enet_private *fep = dev->priv;
+
+	printk(KERN_WARNING "%s: transmit descriptor error\n", dev->name);
+
+	emac_mac_dump(dev);
+	emac_mal_dump(dev);
+
+	/* Reenable the transmit channel */
+	mal_enable_tx_channels(fep->mal, fep->commac.tx_chan_mask);
+}
+
+/*
+ * This interrupt should be very rare at best.  This occurs when
+ * the hardware has a problem with the receive descriptors.  The manual
+ * states that it occurs when the hardware cannot the receive descriptor
+ * empty bit is not set.  The recovery mechanism will be to
+ * traverse through the descriptors, handle any that are marked to be
+ * handled and reinitialize each along the way.  At that point the driver
+ * will be restarted.
+ */
+static void emac_rxde_dev(void *param, u32 chanmask)
+{
+	struct net_device *dev = param;
+	struct ocp_enet_private *fep = dev->priv;
+	unsigned long flags;
+
+	if (net_ratelimit()) {
+		printk(KERN_WARNING "%s: receive descriptor error\n",
+		       fep->ndev->name);
+
+		emac_mac_dump(dev);
+		emac_mal_dump(dev);
+		emac_desc_dump(dev);
+	}
+
+	/* Disable RX channel */
+	spin_lock_irqsave(&fep->lock, flags);
+	mal_disable_rx_channels(fep->mal, fep->commac.rx_chan_mask);
+
+	/* For now, charge the error against all emacs */
+	fep->stats.rx_errors++;
+
+	/* so do we have any good packets still? */
+	emac_rx_clean(dev);
+
+	/* When the interface is restarted it resets processing to the
+	 *  first descriptor in the table.
+	 */
+
+	fep->rx_slot = 0;
+	emac_rx_fill(dev, 0);
+
+	set_mal_dcrn(fep->mal, DCRN_MALRXEOBISR, fep->commac.rx_chan_mask);
+	set_mal_dcrn(fep->mal, DCRN_MALRXDEIR, fep->commac.rx_chan_mask);
+
+	/* Reenable the receive channels */
+	mal_enable_rx_channels(fep->mal, fep->commac.rx_chan_mask);
+	spin_unlock_irqrestore(&fep->lock, flags);
+}
+
+static irqreturn_t
+emac_mac_irq(int irq, void *dev_instance, struct pt_regs *regs)
+{
+	struct net_device *dev = dev_instance;
+	struct ocp_enet_private *fep = dev->priv;
+	emac_t *emacp = fep->emacp;
+	unsigned long tmp_em0isr;
+
+	/* EMAC interrupt */
+	tmp_em0isr = in_be32(&emacp->em0isr);
+	if (tmp_em0isr & (EMAC_ISR_TE0 | EMAC_ISR_TE1)) {
+		/* This error is a hard transmit error - could retransmit */
+		fep->stats.tx_errors++;
+
+		/* Reenable the transmit channel */
+		mal_enable_tx_channels(fep->mal, fep->commac.tx_chan_mask);
+
+	} else {
+		fep->stats.rx_errors++;
+	}
+
+	if (tmp_em0isr & EMAC_ISR_RP)
+		fep->stats.rx_length_errors++;
+	if (tmp_em0isr & EMAC_ISR_ALE)
+		fep->stats.rx_frame_errors++;
+	if (tmp_em0isr & EMAC_ISR_BFCS)
+		fep->stats.rx_crc_errors++;
+	if (tmp_em0isr & EMAC_ISR_PTLE)
+		fep->stats.rx_length_errors++;
+	if (tmp_em0isr & EMAC_ISR_ORE)
+		fep->stats.rx_length_errors++;
+	if (tmp_em0isr & EMAC_ISR_TE0)
+		fep->stats.tx_aborted_errors++;
+
+	emac_err_dump(dev, tmp_em0isr);
+
+	out_be32(&emacp->em0isr, tmp_em0isr);
+
+	return IRQ_HANDLED;
+}
+
+static int emac_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	unsigned short ctrl;
+	unsigned long flags;
+	struct ocp_enet_private *fep = dev->priv;
+	emac_t *emacp = fep->emacp;
+	int len = skb->len;
+	unsigned int offset = 0, size, f, tx_slot_first;
+	unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
+
+	spin_lock_irqsave(&fep->lock, flags);
+
+	len -= skb->data_len;
+
+	if ((fep->tx_cnt + nr_frags + len / DESC_BUF_SIZE + 1) > NUM_TX_BUFF) {
+		PKT_DEBUG(("emac_start_xmit() stopping queue\n"));
+		netif_stop_queue(dev);
+		spin_unlock_irqrestore(&fep->lock, flags);
+		restore_flags(flags);
+		return -EBUSY;
+	}
+
+	tx_slot_first = fep->tx_slot;
+
+	while (len) {
+		size = min(len, DESC_BUF_SIZE);
+
+		fep->tx_desc[fep->tx_slot].data_len = (short)size;
+		fep->tx_desc[fep->tx_slot].data_ptr =
+		    (unsigned char *)dma_map_single(&fep->ocpdev->dev,
+						    (void *)((unsigned int)skb->
+							     data + offset),
+						    size, DMA_TO_DEVICE);
+
+		ctrl = EMAC_TX_CTRL_DFLT;
+		if (fep->tx_slot != tx_slot_first)
+			ctrl |= MAL_TX_CTRL_READY;
+		if ((NUM_TX_BUFF - 1) == fep->tx_slot)
+			ctrl |= MAL_TX_CTRL_WRAP;
+		if (!nr_frags && (len == size)) {
+			ctrl |= MAL_TX_CTRL_LAST;
+			fep->tx_skb[fep->tx_slot] = skb;
+		}
+		if (skb->ip_summed == CHECKSUM_HW)
+			ctrl |= EMAC_TX_CTRL_TAH_CSUM;
+
+		fep->tx_desc[fep->tx_slot].ctrl = ctrl;
+
+		len -= size;
+		offset += size;
+
+		/* Bump tx count */
+		if (++fep->tx_cnt == NUM_TX_BUFF)
+			netif_stop_queue(dev);
+
+		/* Next descriptor */
+		if (++fep->tx_slot == NUM_TX_BUFF)
+			fep->tx_slot = 0;
+	}
+
+	for (f = 0; f < nr_frags; f++) {
+		struct skb_frag_struct *frag;
+
+		frag = &skb_shinfo(skb)->frags[f];
+		len = frag->size;
+		offset = 0;
+
+		while (len) {
+			size = min(len, DESC_BUF_SIZE);
+
+			dma_map_page(&fep->ocpdev->dev,
+				     frag->page,
+				     frag->page_offset + offset,
+				     size, DMA_TO_DEVICE);
+
+			ctrl = EMAC_TX_CTRL_DFLT | MAL_TX_CTRL_READY;
+			if ((NUM_TX_BUFF - 1) == fep->tx_slot)
+				ctrl |= MAL_TX_CTRL_WRAP;
+			if ((f == (nr_frags - 1)) && (len == size)) {
+				ctrl |= MAL_TX_CTRL_LAST;
+				fep->tx_skb[fep->tx_slot] = skb;
+			}
+
+			if (skb->ip_summed == CHECKSUM_HW)
+				ctrl |= EMAC_TX_CTRL_TAH_CSUM;
+
+			fep->tx_desc[fep->tx_slot].data_len = (short)size;
+			fep->tx_desc[fep->tx_slot].data_ptr =
+			    (char *)((page_to_pfn(frag->page) << PAGE_SHIFT) +
+				     frag->page_offset + offset);
+			fep->tx_desc[fep->tx_slot].ctrl = ctrl;
+
+			len -= size;
+			offset += size;
+
+			/* Bump tx count */
+			if (++fep->tx_cnt == NUM_TX_BUFF)
+				netif_stop_queue(dev);
+
+			/* Next descriptor */
+			if (++fep->tx_slot == NUM_TX_BUFF)
+				fep->tx_slot = 0;
+		}
+	}
+
+	/*
+	 * Deferred set READY on first descriptor of packet to
+	 * avoid TX MAL race.
+	 */
+	fep->tx_desc[tx_slot_first].ctrl |= MAL_TX_CTRL_READY;
+
+	/* Send the packet out. */
+	out_be32(&emacp->em0tmr0, EMAC_TMR0_XMIT);
+
+	fep->stats.tx_packets++;
+	fep->stats.tx_bytes += skb->len;
+
+	PKT_DEBUG(("emac_start_xmit() exitn"));
+
+	spin_unlock_irqrestore(&fep->lock, flags);
+
+	return 0;
+}
+
+static int emac_adjust_to_link(struct ocp_enet_private *fep)
+{
+	emac_t *emacp = fep->emacp;
+	struct ibm_ocp_rgmii *rgmii;
+	unsigned long mode_reg;
+	int full_duplex, speed;
+
+	full_duplex = 0;
+	speed = SPEED_10;
+
+	/* set mode register 1 defaults */
+	mode_reg = EMAC_M1_DEFAULT;
+
+	/* Read link mode on PHY */
+	if (fep->phy_mii.def->ops->read_link(&fep->phy_mii) == 0) {
+		/* If an error occurred, we don't deal with it yet */
+		full_duplex = (fep->phy_mii.duplex == DUPLEX_FULL);
+		speed = fep->phy_mii.speed;
+	}
+
+	if (fep->rgmii_dev)
+		rgmii = RGMII_PRIV(fep->rgmii_dev);
+
+	/* set speed (default is 10Mb) */
+	switch (speed) {
+	case SPEED_1000:
+		mode_reg |= EMAC_M1_JUMBO_ENABLE | EMAC_M1_RFS_16K;
+		if ((rgmii->mode[fep->rgmii_input] == RTBI)
+		    || (rgmii->mode[fep->rgmii_input] == TBI))
+			mode_reg |= EMAC_M1_MF_1000GPCS;
+		else
+			mode_reg |= EMAC_M1_MF_1000MBPS;
+		if (fep->rgmii_dev)
+			emac_rgmii_port_speed(fep->rgmii_dev, fep->rgmii_input,
+					      1000);
+		break;
+	case SPEED_100:
+		mode_reg |= EMAC_M1_MF_100MBPS | EMAC_M1_RFS_4K;
+		if (fep->rgmii_dev)
+			emac_rgmii_port_speed(fep->rgmii_dev, fep->rgmii_input,
+					      100);
+		if (fep->zmii_dev)
+			emac_zmii_port_speed(fep->zmii_dev, fep->zmii_input,
+					     100);
+		break;
+	case SPEED_10:
+	default:
+		mode_reg = (mode_reg & ~EMAC_M1_MF_100MBPS) | EMAC_M1_RFS_4K;
+		if (fep->rgmii_dev)
+			emac_rgmii_port_speed(fep->rgmii_dev, fep->rgmii_input,
+					      10);
+		if (fep->zmii_dev)
+			emac_zmii_port_speed(fep->zmii_dev, fep->zmii_input,
+					     10);
+	}
+
+	if (full_duplex)
+		mode_reg |= EMAC_M1_FDE | EMAC_M1_EIFC | EMAC_M1_IST;
+	else
+		mode_reg &= ~(EMAC_M1_FDE | EMAC_M1_EIFC | EMAC_M1_ILE);
+
+	LINK_DEBUG(("%s: adjust to link, speed: %d, duplex: %d, opened: %d\n",
+		    fep->ndev->name, speed, full_duplex, fep->opened));
+
+	printk(KERN_INFO "%s: Speed: %d, %s duplex.\n",
+	       fep->ndev->name, speed, full_duplex ? "Full" : "Half");
+	if (fep->opened)
+		out_be32(&emacp->em0mr1, mode_reg);
+
+	return 0;
+}
+
+static int emac_set_mac_address(struct net_device *ndev, void *p)
+{
+	struct ocp_enet_private *fep = ndev->priv;
+	emac_t *emacp = fep->emacp;
+	struct sockaddr *addr = p;
+
+	if (!is_valid_ether_addr(addr->sa_data))
+		return -EADDRNOTAVAIL;
+
+	memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
+
+	/* set the high address */
+	out_be32(&emacp->em0iahr,
+		 (fep->ndev->dev_addr[0] << 8) | fep->ndev->dev_addr[1]);
+
+	/* set the low address */
+	out_be32(&emacp->em0ialr,
+		 (fep->ndev->dev_addr[2] << 24) | (fep->ndev->dev_addr[3] << 16)
+		 | (fep->ndev->dev_addr[4] << 8) | fep->ndev->dev_addr[5]);
+
+	return 0;
+}
+
+static int emac_change_mtu(struct net_device *dev, int new_mtu)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	int old_mtu = dev->mtu;
+	emac_t *emacp = fep->emacp;
+	u32 em0mr0;
+	int i, full;
+	unsigned long flags;
+
+	if ((new_mtu < EMAC_MIN_MTU) || (new_mtu > EMAC_MAX_MTU)) {
+		printk(KERN_ERR
+		       "emac: Invalid MTU setting, MTU must be between %d and %d\n",
+		       EMAC_MIN_MTU, EMAC_MAX_MTU);
+		return -EINVAL;
+	}
+
+	if (old_mtu != new_mtu && netif_running(dev)) {
+		/* Stop rx engine */
+		em0mr0 = in_be32(&emacp->em0mr0);
+		out_be32(&emacp->em0mr0, em0mr0 & ~EMAC_M0_RXE);
+
+		/* Wait for descriptors to be empty */
+		do {
+			full = 0;
+			for (i = 0; i < NUM_RX_BUFF; i++)
+				if (!(fep->rx_desc[i].ctrl & MAL_RX_CTRL_EMPTY)) {
+					printk(KERN_NOTICE
+					       "emac: RX ring is still full\n");
+					full = 1;
+				}
+		} while (full);
+
+		spin_lock_irqsave(&fep->lock, flags);
+
+		mal_disable_rx_channels(fep->mal, fep->commac.rx_chan_mask);
+
+		/* Destroy all old rx skbs */
+		for (i = 0; i < NUM_RX_BUFF; i++) {
+			dma_unmap_single(&fep->ocpdev->dev,
+					 fep->rx_desc[i].data_ptr,
+					 fep->rx_desc[i].data_len,
+					 DMA_FROM_DEVICE);
+			dev_kfree_skb(fep->rx_skb[i]);
+			fep->rx_skb[i] = NULL;
+		}
+
+		/* Set new rx_buffer_size and advertise new mtu */
+		fep->rx_buffer_size =
+		    new_mtu + ENET_HEADER_SIZE + ENET_FCS_SIZE;
+		dev->mtu = new_mtu;
+
+		/* Re-init rx skbs */
+		fep->rx_slot = 0;
+		emac_rx_fill(dev, 0);
+
+		/* Restart the rx engine */
+		mal_enable_rx_channels(fep->mal, fep->commac.rx_chan_mask);
+		out_be32(&emacp->em0mr0, em0mr0 | EMAC_M0_RXE);
+
+		spin_unlock_irqrestore(&fep->lock, flags);
+	}
+
+	return 0;
+}
+
+static void __emac_set_multicast_list(struct net_device *dev)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	emac_t *emacp = fep->emacp;
+	u32 rmr = in_be32(&emacp->em0rmr);
+
+	/* First clear all special bits, they can be set later */
+	rmr &= ~(EMAC_RMR_PME | EMAC_RMR_PMME | EMAC_RMR_MAE);
+
+	if (dev->flags & IFF_PROMISC) {
+		rmr |= EMAC_RMR_PME;
+	} else if (dev->flags & IFF_ALLMULTI || 32 < dev->mc_count) {
+		/*
+		 * Must be setting up to use multicast
+		 * Now check for promiscuous multicast
+		 */
+		rmr |= EMAC_RMR_PMME;
+	} else if (dev->flags & IFF_MULTICAST && 0 < dev->mc_count) {
+		unsigned short em0gaht[4] = { 0, 0, 0, 0 };
+		struct dev_mc_list *dmi;
+
+		/* Need to hash on the multicast address. */
+		for (dmi = dev->mc_list; dmi; dmi = dmi->next) {
+			unsigned long mc_crc;
+			unsigned int bit_number;
+
+			mc_crc = ether_crc(6, (char *)dmi->dmi_addr);
+			bit_number = 63 - (mc_crc >> 26);	/* MSB: 0 LSB: 63 */
+			em0gaht[bit_number >> 4] |=
+			    0x8000 >> (bit_number & 0x0f);
+		}
+		emacp->em0gaht1 = em0gaht[0];
+		emacp->em0gaht2 = em0gaht[1];
+		emacp->em0gaht3 = em0gaht[2];
+		emacp->em0gaht4 = em0gaht[3];
+
+		/* Turn on multicast addressing */
+		rmr |= EMAC_RMR_MAE;
+	}
+	out_be32(&emacp->em0rmr, rmr);
+}
+
+static int emac_init_tah(struct ocp_enet_private *fep)
+{
+	tah_t *tahp;
+
+	/* Initialize TAH and enable checksum verification */
+	tahp = (tah_t *) ioremap(fep->tah_dev->def->paddr, sizeof(*tahp));
+
+	if (tahp == NULL) {
+		printk(KERN_ERR "tah%d: Cannot ioremap TAH registers!\n",
+		       fep->tah_dev->def->index);
+
+		return -ENOMEM;
+	}
+
+	out_be32(&tahp->tah_mr, TAH_MR_SR);
+
+	/* wait for reset to complete */
+	while (in_be32(&tahp->tah_mr) & TAH_MR_SR) ;
+
+	/* 10KB TAH TX FIFO accomodates the max MTU of 9000 */
+	out_be32(&tahp->tah_mr,
+		 TAH_MR_CVR | TAH_MR_ST_768 | TAH_MR_TFS_10KB | TAH_MR_DTFP |
+		 TAH_MR_DIG);
+
+	iounmap(&tahp);
+
+	return 0;
+}
+
+static void emac_init_rings(struct net_device *dev)
+{
+	struct ocp_enet_private *ep = dev->priv;
+	int loop;
+
+	ep->tx_desc = (struct mal_descriptor *)((char *)ep->mal->tx_virt_addr +
+						(ep->mal_tx_chan *
+						 MAL_DT_ALIGN));
+	ep->rx_desc =
+	    (struct mal_descriptor *)((char *)ep->mal->rx_virt_addr +
+				      (ep->mal_rx_chan * MAL_DT_ALIGN));
+
+	/* Fill in the transmit descriptor ring. */
+	for (loop = 0; loop < NUM_TX_BUFF; loop++) {
+		if (ep->tx_skb[loop]) {
+			dma_unmap_single(&ep->ocpdev->dev,
+					 ep->tx_desc[loop].data_ptr,
+					 ep->tx_desc[loop].data_len,
+					 DMA_TO_DEVICE);
+			dev_kfree_skb_irq(ep->tx_skb[loop]);
+		}
+		ep->tx_skb[loop] = NULL;
+		ep->tx_desc[loop].ctrl = 0;
+		ep->tx_desc[loop].data_len = 0;
+		ep->tx_desc[loop].data_ptr = NULL;
+	}
+	ep->tx_desc[loop - 1].ctrl |= MAL_TX_CTRL_WRAP;
+
+	/* Format the receive descriptor ring. */
+	ep->rx_slot = 0;
+	/* Default is MTU=1500 + Ethernet overhead */
+	ep->rx_buffer_size = ENET_DEF_BUF_SIZE;
+	emac_rx_fill(dev, 0);
+	if (ep->rx_slot != 0) {
+		printk(KERN_ERR
+		       "%s: Not enough mem for RxChain durning Open?\n",
+		       dev->name);
+		/*We couldn't fill the ring at startup?
+		 *We could clean up and fail to open but right now we will try to
+		 *carry on. It may be a sign of a bad NUM_RX_BUFF value
+		 */
+	}
+
+	ep->tx_cnt = 0;
+	ep->tx_slot = 0;
+	ep->ack_slot = 0;
+}
+
+static void emac_reset_configure(struct ocp_enet_private *fep)
+{
+	emac_t *emacp = fep->emacp;
+	int i;
+
+	mal_disable_tx_channels(fep->mal, fep->commac.tx_chan_mask);
+	mal_disable_rx_channels(fep->mal, fep->commac.rx_chan_mask);
+
+	/*
+	 * Check for a link, some PHYs don't provide a clock if
+	 * no link is present.  Some EMACs will not come out of
+	 * soft reset without a PHY clock present.
+	 */
+	if (fep->phy_mii.def->ops->poll_link(&fep->phy_mii)) {
+		/* Reset the EMAC */
+		out_be32(&emacp->em0mr0, EMAC_M0_SRST);
+		udelay(20);
+		for (i = 0; i < 100; i++) {
+			if ((in_be32(&emacp->em0mr0) & EMAC_M0_SRST) == 0)
+				break;
+			udelay(10);
+		}
+
+		if (i >= 100) {
+			printk(KERN_ERR "%s: Cannot reset EMAC\n",
+			       fep->ndev->name);
+			return;
+		}
+	}
+
+	/* Switch IRQs off for now */
+	out_be32(&emacp->em0iser, 0);
+
+	/* Configure MAL rx channel */
+	mal_set_rcbs(fep->mal, fep->mal_rx_chan, DESC_BUF_SIZE_REG);
+
+	/* set the high address */
+	out_be32(&emacp->em0iahr,
+		 (fep->ndev->dev_addr[0] << 8) | fep->ndev->dev_addr[1]);
+
+	/* set the low address */
+	out_be32(&emacp->em0ialr,
+		 (fep->ndev->dev_addr[2] << 24) | (fep->ndev->dev_addr[3] << 16)
+		 | (fep->ndev->dev_addr[4] << 8) | fep->ndev->dev_addr[5]);
+
+	/* Adjust to link */
+	if (netif_carrier_ok(fep->ndev))
+		emac_adjust_to_link(fep);
+
+	/* enable broadcast/individual address and RX FIFO defaults */
+	out_be32(&emacp->em0rmr, EMAC_RMR_DEFAULT);
+
+	/* set transmit request threshold register */
+	out_be32(&emacp->em0trtr, EMAC_TRTR_DEFAULT);
+
+	/* Reconfigure multicast */
+	__emac_set_multicast_list(fep->ndev);
+
+	/* Set receiver/transmitter defaults */
+	out_be32(&emacp->em0rwmr, EMAC_RWMR_DEFAULT);
+	out_be32(&emacp->em0tmr0, EMAC_TMR0_DEFAULT);
+	out_be32(&emacp->em0tmr1, EMAC_TMR1_DEFAULT);
+
+	/* set frame gap */
+	out_be32(&emacp->em0ipgvr, CONFIG_IBM_EMAC_FGAP);
+
+	/* Init ring buffers */
+	emac_init_rings(fep->ndev);
+}
+
+static void emac_kick(struct ocp_enet_private *fep)
+{
+	emac_t *emacp = fep->emacp;
+	unsigned long emac_ier;
+
+	emac_ier = EMAC_ISR_PP | EMAC_ISR_BP | EMAC_ISR_RP |
+	    EMAC_ISR_SE | EMAC_ISR_PTLE | EMAC_ISR_ALE |
+	    EMAC_ISR_BFCS | EMAC_ISR_ORE | EMAC_ISR_IRE;
+
+	out_be32(&emacp->em0iser, emac_ier);
+
+	/* enable all MAL transmit and receive channels */
+	mal_enable_tx_channels(fep->mal, fep->commac.tx_chan_mask);
+	mal_enable_rx_channels(fep->mal, fep->commac.rx_chan_mask);
+
+	/* set transmit and receive enable */
+	out_be32(&emacp->em0mr0, EMAC_M0_TXE | EMAC_M0_RXE);
+}
+
+static void
+emac_start_link(struct ocp_enet_private *fep, struct ethtool_cmd *ep)
+{
+	u32 advertise;
+	int autoneg;
+	int forced_speed;
+	int forced_duplex;
+
+	/* Default advertise */
+	advertise = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
+	    ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
+	    ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full;
+	autoneg = fep->want_autoneg;
+	forced_speed = fep->phy_mii.speed;
+	forced_duplex = fep->phy_mii.duplex;
+
+	/* Setup link parameters */
+	if (ep) {
+		if (ep->autoneg == AUTONEG_ENABLE) {
+			advertise = ep->advertising;
+			autoneg = 1;
+		} else {
+			autoneg = 0;
+			forced_speed = ep->speed;
+			forced_duplex = ep->duplex;
+		}
+	}
+
+	/* Configure PHY & start aneg */
+	fep->want_autoneg = autoneg;
+	if (autoneg) {
+		LINK_DEBUG(("%s: start link aneg, advertise: 0x%x\n",
+			    fep->ndev->name, advertise));
+		fep->phy_mii.def->ops->setup_aneg(&fep->phy_mii, advertise);
+	} else {
+		LINK_DEBUG(("%s: start link forced, speed: %d, duplex: %d\n",
+			    fep->ndev->name, forced_speed, forced_duplex));
+		fep->phy_mii.def->ops->setup_forced(&fep->phy_mii, forced_speed,
+						    forced_duplex);
+	}
+	fep->timer_ticks = 0;
+	mod_timer(&fep->link_timer, jiffies + HZ);
+}
+
+static void emac_link_timer(unsigned long data)
+{
+	struct ocp_enet_private *fep = (struct ocp_enet_private *)data;
+	int link;
+
+	if (fep->going_away)
+		return;
+
+	spin_lock_irq(&fep->lock);
+
+	link = fep->phy_mii.def->ops->poll_link(&fep->phy_mii);
+	LINK_DEBUG(("%s: poll_link: %d\n", fep->ndev->name, link));
+
+	if (link == netif_carrier_ok(fep->ndev)) {
+		if (!link && fep->want_autoneg && (++fep->timer_ticks) > 10)
+			emac_start_link(fep, NULL);
+		goto out;
+	}
+	printk(KERN_INFO "%s: Link is %s\n", fep->ndev->name,
+	       link ? "Up" : "Down");
+	if (link) {
+		netif_carrier_on(fep->ndev);
+		/* Chip needs a full reset on config change. That sucks, so I
+		 * should ultimately move that to some tasklet to limit
+		 * latency peaks caused by this code
+		 */
+		emac_reset_configure(fep);
+		if (fep->opened)
+			emac_kick(fep);
+	} else {
+		fep->timer_ticks = 0;
+		netif_carrier_off(fep->ndev);
+	}
+      out:
+	mod_timer(&fep->link_timer, jiffies + HZ);
+	spin_unlock_irq(&fep->lock);
+}
+
+static void emac_set_multicast_list(struct net_device *dev)
+{
+	struct ocp_enet_private *fep = dev->priv;
+
+	spin_lock_irq(&fep->lock);
+	__emac_set_multicast_list(dev);
+	spin_unlock_irq(&fep->lock);
+}
+
+static int emac_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+{
+	struct ocp_enet_private *fep = ndev->priv;
+
+	cmd->supported = fep->phy_mii.def->features;
+	cmd->port = PORT_MII;
+	cmd->transceiver = XCVR_EXTERNAL;
+	cmd->phy_address = fep->mii_phy_addr;
+	spin_lock_irq(&fep->lock);
+	cmd->autoneg = fep->want_autoneg;
+	cmd->speed = fep->phy_mii.speed;
+	cmd->duplex = fep->phy_mii.duplex;
+	spin_unlock_irq(&fep->lock);
+	return 0;
+}
+
+static int emac_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+{
+	struct ocp_enet_private *fep = ndev->priv;
+	unsigned long features = fep->phy_mii.def->features;
+
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
+
+	if (cmd->autoneg != AUTONEG_ENABLE && cmd->autoneg != AUTONEG_DISABLE)
+		return -EINVAL;
+	if (cmd->autoneg == AUTONEG_ENABLE && cmd->advertising == 0)
+		return -EINVAL;
+	if (cmd->duplex != DUPLEX_HALF && cmd->duplex != DUPLEX_FULL)
+		return -EINVAL;
+	if (cmd->autoneg == AUTONEG_DISABLE)
+		switch (cmd->speed) {
+		case SPEED_10:
+			if (cmd->duplex == DUPLEX_HALF &&
+			    (features & SUPPORTED_10baseT_Half) == 0)
+				return -EINVAL;
+			if (cmd->duplex == DUPLEX_FULL &&
+			    (features & SUPPORTED_10baseT_Full) == 0)
+				return -EINVAL;
+			break;
+		case SPEED_100:
+			if (cmd->duplex == DUPLEX_HALF &&
+			    (features & SUPPORTED_100baseT_Half) == 0)
+				return -EINVAL;
+			if (cmd->duplex == DUPLEX_FULL &&
+			    (features & SUPPORTED_100baseT_Full) == 0)
+				return -EINVAL;
+			break;
+		case SPEED_1000:
+			if (cmd->duplex == DUPLEX_HALF &&
+			    (features & SUPPORTED_1000baseT_Half) == 0)
+				return -EINVAL;
+			if (cmd->duplex == DUPLEX_FULL &&
+			    (features & SUPPORTED_1000baseT_Full) == 0)
+				return -EINVAL;
+			break;
+		default:
+			return -EINVAL;
+	} else if ((features & SUPPORTED_Autoneg) == 0)
+		return -EINVAL;
+	spin_lock_irq(&fep->lock);
+	emac_start_link(fep, cmd);
+	spin_unlock_irq(&fep->lock);
+	return 0;
+}
+
+static void
+emac_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info)
+{
+	struct ocp_enet_private *fep = ndev->priv;
+
+	strcpy(info->driver, DRV_NAME);
+	strcpy(info->version, DRV_VERSION);
+	info->fw_version[0] = '\0';
+	sprintf(info->bus_info, "IBM EMAC %d", fep->ocpdev->def->index);
+	info->regdump_len = 0;
+}
+
+static int emac_nway_reset(struct net_device *ndev)
+{
+	struct ocp_enet_private *fep = ndev->priv;
+
+	if (!fep->want_autoneg)
+		return -EINVAL;
+	spin_lock_irq(&fep->lock);
+	emac_start_link(fep, NULL);
+	spin_unlock_irq(&fep->lock);
+	return 0;
+}
+
+static u32 emac_get_link(struct net_device *ndev)
+{
+	return netif_carrier_ok(ndev);
+}
+
+static struct ethtool_ops emac_ethtool_ops = {
+	.get_settings = emac_get_settings,
+	.set_settings = emac_set_settings,
+	.get_drvinfo = emac_get_drvinfo,
+	.nway_reset = emac_nway_reset,
+	.get_link = emac_get_link
+};
+
+static int emac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	uint *data = (uint *) & rq->ifr_ifru;
+
+	switch (cmd) {
+	case SIOCGMIIPHY:
+		data[0] = fep->mii_phy_addr;
+		/* Fall through */
+	case SIOCGMIIREG:
+		data[3] = emac_phy_read(dev, fep->mii_phy_addr, data[1]);
+		return 0;
+	case SIOCSMIIREG:
+		if (!capable(CAP_NET_ADMIN))
+			return -EPERM;
+
+		emac_phy_write(dev, fep->mii_phy_addr, data[1], data[2]);
+		return 0;
+	default:
+		return -EOPNOTSUPP;
+	}
+}
+
+static int emac_open(struct net_device *dev)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	int rc;
+
+	spin_lock_irq(&fep->lock);
+
+	fep->opened = 1;
+	netif_carrier_off(dev);
+
+	/* Reset & configure the chip */
+	emac_reset_configure(fep);
+
+	spin_unlock_irq(&fep->lock);
+
+	/* Request our interrupt lines */
+	rc = request_irq(dev->irq, emac_mac_irq, 0, "IBM EMAC MAC", dev);
+	if (rc != 0) {
+		printk("dev->irq %d failed\n", dev->irq);
+		goto bail;
+	}
+	/* Kick the chip rx & tx channels into life */
+	spin_lock_irq(&fep->lock);
+	emac_kick(fep);
+	spin_unlock_irq(&fep->lock);
+
+	netif_start_queue(dev);
+      bail:
+	return rc;
+}
+
+static int emac_close(struct net_device *dev)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	emac_t *emacp = fep->emacp;
+
+	/* XXX Stop IRQ emitting here */
+	spin_lock_irq(&fep->lock);
+	fep->opened = 0;
+	mal_disable_tx_channels(fep->mal, fep->commac.tx_chan_mask);
+	mal_disable_rx_channels(fep->mal, fep->commac.rx_chan_mask);
+	netif_carrier_off(dev);
+	netif_stop_queue(dev);
+
+	/*
+	 * Check for a link, some PHYs don't provide a clock if
+	 * no link is present.  Some EMACs will not come out of
+	 * soft reset without a PHY clock present.
+	 */
+	if (fep->phy_mii.def->ops->poll_link(&fep->phy_mii)) {
+		out_be32(&emacp->em0mr0, EMAC_M0_SRST);
+		udelay(10);
+
+		if (emacp->em0mr0 & EMAC_M0_SRST) {
+			/*not sure what to do here hopefully it clears before another open */
+			printk(KERN_ERR
+			       "%s: Phy SoftReset didn't clear, no link?\n",
+			       dev->name);
+		}
+	}
+
+	/* Free the irq's */
+	free_irq(dev->irq, dev);
+
+	spin_unlock_irq(&fep->lock);
+
+	return 0;
+}
+
+static void emac_remove(struct ocp_device *ocpdev)
+{
+	struct net_device *dev = ocp_get_drvdata(ocpdev);
+	struct ocp_enet_private *ep = dev->priv;
+
+	/* FIXME: locking, races, ... */
+	ep->going_away = 1;
+	ocp_set_drvdata(ocpdev, NULL);
+	if (ep->rgmii_dev)
+		emac_close_rgmii(ep->rgmii_dev);
+	if (ep->zmii_dev)
+		emac_close_zmii(ep->zmii_dev);
+
+	unregister_netdev(dev);
+	del_timer_sync(&ep->link_timer);
+	mal_unregister_commac(ep->mal, &ep->commac);
+	iounmap((void *)ep->emacp);
+	kfree(dev);
+}
+
+struct mal_commac_ops emac_commac_ops = {
+	.txeob = &emac_txeob_dev,
+	.txde = &emac_txde_dev,
+	.rxeob = &emac_rxeob_dev,
+	.rxde = &emac_rxde_dev,
+};
+
+static int emac_init_device(struct ocp_device *ocpdev, struct ibm_ocp_mal *mal)
+{
+	int deferred_init = 0;
+	int rc = 0, i;
+	struct net_device *ndev;
+	struct ocp_enet_private *ep;
+	struct ocp_func_emac_data *emacdata;
+	int commac_reg = 0;
+	u32 phy_map;
+
+	emacdata = (struct ocp_func_emac_data *)ocpdev->def->additions;
+	if (!emacdata) {
+		printk(KERN_ERR "emac%d: Missing additional data!\n",
+		       ocpdev->def->index);
+		return -ENODEV;
+	}
+
+	/* Allocate our net_device structure */
+	ndev = alloc_etherdev(sizeof(struct ocp_enet_private));
+	if (ndev == NULL) {
+		printk(KERN_ERR
+		       "emac%d: Could not allocate ethernet device.\n",
+		       ocpdev->def->index);
+		return -ENOMEM;
+	}
+	ep = ndev->priv;
+	ep->ndev = ndev;
+	ep->ocpdev = ocpdev;
+	ndev->irq = ocpdev->def->irq;
+	ep->wol_irq = emacdata->wol_irq;
+	if (emacdata->mdio_idx >= 0) {
+		if (emacdata->mdio_idx == ocpdev->def->index) {
+			/* Set the common MDIO net_device */
+			mdio_ndev = ndev;
+			deferred_init = 1;
+		}
+		ep->mdio_dev = mdio_ndev;
+	} else {
+		ep->mdio_dev = ndev;
+	}
+
+	ocp_set_drvdata(ocpdev, ndev);
+
+	spin_lock_init(&ep->lock);
+
+	/* Fill out MAL informations and register commac */
+	ep->mal = mal;
+	ep->mal_tx_chan = emacdata->mal_tx_chan;
+	ep->mal_rx_chan = emacdata->mal_rx_chan;
+	ep->commac.ops = &emac_commac_ops;
+	ep->commac.dev = ndev;
+	ep->commac.tx_chan_mask = MAL_CHAN_MASK(ep->mal_tx_chan);
+	ep->commac.rx_chan_mask = MAL_CHAN_MASK(ep->mal_rx_chan);
+	rc = mal_register_commac(ep->mal, &ep->commac);
+	if (rc != 0)
+		goto bail;
+	commac_reg = 1;
+
+	/* Map our MMIOs */
+	ep->emacp = (emac_t *) ioremap(ocpdev->def->paddr, sizeof(emac_t));
+
+	/* Check if we need to attach to a ZMII */
+	if (emacdata->zmii_idx >= 0) {
+		ep->zmii_input = emacdata->zmii_mux;
+		ep->zmii_dev =
+		    ocp_find_device(OCP_ANY_ID, OCP_FUNC_ZMII,
+				    emacdata->zmii_idx);
+		if (ep->zmii_dev == NULL)
+			printk(KERN_WARNING
+			       "emac%d: ZMII %d requested but not found !\n",
+			       ocpdev->def->index, emacdata->zmii_idx);
+		else if ((rc =
+			  emac_init_zmii(ep->zmii_dev, ep->zmii_input,
+					 emacdata->phy_mode)) != 0)
+			goto bail;
+	}
+
+	/* Check if we need to attach to a RGMII */
+	if (emacdata->rgmii_idx >= 0) {
+		ep->rgmii_input = emacdata->rgmii_mux;
+		ep->rgmii_dev =
+		    ocp_find_device(OCP_ANY_ID, OCP_FUNC_RGMII,
+				    emacdata->rgmii_idx);
+		if (ep->rgmii_dev == NULL)
+			printk(KERN_WARNING
+			       "emac%d: RGMII %d requested but not found !\n",
+			       ocpdev->def->index, emacdata->rgmii_idx);
+		else if ((rc =
+			  emac_init_rgmii(ep->rgmii_dev, ep->rgmii_input,
+					  emacdata->phy_mode)) != 0)
+			goto bail;
+	}
+
+	/* Check if we need to attach to a TAH */
+	if (emacdata->tah_idx >= 0) {
+		ep->tah_dev =
+		    ocp_find_device(OCP_ANY_ID, OCP_FUNC_TAH,
+				    emacdata->tah_idx);
+		if (ep->tah_dev == NULL)
+			printk(KERN_WARNING
+			       "emac%d: TAH %d requested but not found !\n",
+			       ocpdev->def->index, emacdata->tah_idx);
+		else if ((rc = emac_init_tah(ep)) != 0)
+			goto bail;
+	}
+
+	if (deferred_init) {
+		if (!list_empty(&emac_init_list)) {
+			struct list_head *entry;
+			struct emac_def_dev *ddev;
+
+			list_for_each(entry, &emac_init_list) {
+				ddev =
+				    list_entry(entry, struct emac_def_dev,
+					       link);
+				emac_init_device(ddev->ocpdev, ddev->mal);
+			}
+		}
+	}
+
+	/* Init link monitoring timer */
+	init_timer(&ep->link_timer);
+	ep->link_timer.function = emac_link_timer;
+	ep->link_timer.data = (unsigned long)ep;
+	ep->timer_ticks = 0;
+
+	/* Fill up the mii_phy structure */
+	ep->phy_mii.dev = ndev;
+	ep->phy_mii.mdio_read = emac_phy_read;
+	ep->phy_mii.mdio_write = emac_phy_write;
+	ep->phy_mii.mode = emacdata->phy_mode;
+
+	/* Find PHY */
+	phy_map = emacdata->phy_map | busy_phy_map;
+	for (i = 0; i <= 0x1f; i++, phy_map >>= 1) {
+		if ((phy_map & 0x1) == 0) {
+			int val = emac_phy_read(ndev, i, MII_BMCR);
+			if (val != 0xffff && val != -1)
+				break;
+		}
+	}
+	if (i == 0x20) {
+		printk(KERN_WARNING "emac%d: Can't find PHY.\n",
+		       ocpdev->def->index);
+		rc = -ENODEV;
+		goto bail;
+	}
+	busy_phy_map |= 1 << i;
+	ep->mii_phy_addr = i;
+	rc = mii_phy_probe(&ep->phy_mii, i);
+	if (rc) {
+		printk(KERN_WARNING "emac%d: Failed to probe PHY type.\n",
+		       ocpdev->def->index);
+		rc = -ENODEV;
+		goto bail;
+	}
+
+	/* Setup initial PHY config & startup aneg */
+	if (ep->phy_mii.def->ops->init)
+		ep->phy_mii.def->ops->init(&ep->phy_mii);
+	netif_carrier_off(ndev);
+	if (ep->phy_mii.def->features & SUPPORTED_Autoneg)
+		ep->want_autoneg = 1;
+	emac_start_link(ep, NULL);
+
+	/* read the MAC Address */
+	for (i = 0; i < 6; i++)
+		ndev->dev_addr[i] = emacdata->mac_addr[i];
+
+	/* Fill in the driver function table */
+	ndev->open = &emac_open;
+	ndev->hard_start_xmit = &emac_start_xmit;
+	ndev->stop = &emac_close;
+	ndev->get_stats = &emac_stats;
+	if (emacdata->jumbo)
+		ndev->change_mtu = &emac_change_mtu;
+	ndev->set_mac_address = &emac_set_mac_address;
+	ndev->set_multicast_list = &emac_set_multicast_list;
+	ndev->do_ioctl = &emac_ioctl;
+	SET_ETHTOOL_OPS(ndev, &emac_ethtool_ops);
+	if (emacdata->tah_idx >= 0)
+		ndev->features = NETIF_F_IP_CSUM | NETIF_F_SG;
+
+	SET_MODULE_OWNER(ndev);
+
+	rc = register_netdev(ndev);
+	if (rc != 0)
+		goto bail;
+
+	printk("%s: IBM emac, MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
+	       ndev->name,
+	       ndev->dev_addr[0], ndev->dev_addr[1], ndev->dev_addr[2],
+	       ndev->dev_addr[3], ndev->dev_addr[4], ndev->dev_addr[5]);
+	printk(KERN_INFO "%s: Found %s PHY (0x%02x)\n",
+	       ndev->name, ep->phy_mii.def->name, ep->mii_phy_addr);
+
+      bail:
+	if (rc && commac_reg)
+		mal_unregister_commac(ep->mal, &ep->commac);
+	if (rc && ndev)
+		kfree(ndev);
+
+	return rc;
+}
+
+static int emac_probe(struct ocp_device *ocpdev)
+{
+	struct ocp_device *maldev;
+	struct ibm_ocp_mal *mal;
+	struct ocp_func_emac_data *emacdata;
+
+	emacdata = (struct ocp_func_emac_data *)ocpdev->def->additions;
+	if (emacdata == NULL) {
+		printk(KERN_ERR "emac%d: Missing additional datas !\n",
+		       ocpdev->def->index);
+		return -ENODEV;
+	}
+
+	/* Get the MAL device  */
+	maldev = ocp_find_device(OCP_ANY_ID, OCP_FUNC_MAL, emacdata->mal_idx);
+	if (maldev == NULL) {
+		printk("No maldev\n");
+		return -ENODEV;
+	}
+	/*
+	 * Get MAL driver data, it must be here due to link order.
+	 * When the driver is modularized, symbol dependencies will
+	 * ensure the MAL driver is already present if built as a
+	 * module.
+	 */
+	mal = (struct ibm_ocp_mal *)ocp_get_drvdata(maldev);
+	if (mal == NULL) {
+		printk("No maldrv\n");
+		return -ENODEV;
+	}
+
+	/* If we depend on another EMAC for MDIO, wait for it to show up */
+	if (emacdata->mdio_idx >= 0 &&
+	    (emacdata->mdio_idx != ocpdev->def->index) && !mdio_ndev) {
+		struct emac_def_dev *ddev;
+		/* Add this index to the deferred init table */
+		ddev = kmalloc(sizeof(struct emac_def_dev), GFP_KERNEL);
+		ddev->ocpdev = ocpdev;
+		ddev->mal = mal;
+		list_add_tail(&ddev->link, &emac_init_list);
+	} else {
+		emac_init_device(ocpdev, mal);
+	}
+
+	return 0;
+}
+
+/* Structure for a device driver */
+static struct ocp_device_id emac_ids[] = {
+	{.vendor = OCP_ANY_ID,.function = OCP_FUNC_EMAC},
+	{.vendor = OCP_VENDOR_INVALID}
+};
+
+static struct ocp_driver emac_driver = {
+	.name = "emac",
+	.id_table = emac_ids,
+
+	.probe = emac_probe,
+	.remove = emac_remove,
+};
+
+static int __init emac_init(void)
+{
+	int rc;
+
+	printk(KERN_INFO DRV_NAME ": " DRV_DESC ", version " DRV_VERSION "\n");
+	printk(KERN_INFO "Maintained by " DRV_AUTHOR "\n");
+
+	if (skb_res > 2) {
+		printk(KERN_WARNING "Invalid skb_res: %d, cropping to 2\n",
+		       skb_res);
+		skb_res = 2;
+	}
+	rc = ocp_register_driver(&emac_driver);
+	if (rc < 0) {
+		ocp_unregister_driver(&emac_driver);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static void __exit emac_exit(void)
+{
+	ocp_unregister_driver(&emac_driver);
+}
+
+module_init(emac_init);
+module_exit(emac_exit);
diff -Nru a/drivers/net/ibm_emac/ibm_emac_core.h b/drivers/net/ibm_emac/ibm_emac_core.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_core.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,146 @@
+/*
+ * ibm_emac_core.h
+ *
+ * Ethernet driver for the built in ethernet on the IBM 405 PowerPC
+ * processor.
+ *
+ *      Armin Kuster akuster@mvista.com
+ *      Sept, 2001
+ *
+ *      Orignial driver
+ *         Johnnie Peters
+ *         jpeters@mvista.com
+ *
+ * Copyright 2000 MontaVista Softare 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 _IBM_EMAC_CORE_H_
+#define _IBM_EMAC_CORE_H_
+
+#include <linux/netdevice.h>
+#include <asm/ocp.h>
+#include <asm/mmu.h>		/* For phys_addr_t */
+
+#include "ibm_emac.h"
+#include "ibm_emac_phy.h"
+#include "ibm_emac_rgmii.h"
+#include "ibm_emac_zmii.h"
+#include "ibm_emac_mal.h"
+#include "ibm_emac_tah.h"
+
+#ifndef CONFIG_IBM_EMAC_TXB
+#define NUM_TX_BUFF		64
+#define NUM_RX_BUFF		64
+#else
+#define NUM_TX_BUFF		CONFIG_IBM_EMAC_TXB
+#define NUM_RX_BUFF		CONFIG_IBM_EMAC_RXB
+#endif
+
+/* This does 16 byte alignment, exactly what we need.
+ * The packet length includes FCS, but we don't want to
+ * include that when passing upstream as it messes up
+ * bridging applications.
+ */
+#ifndef CONFIG_IBM_EMAC_SKBRES
+#define SKB_RES 2
+#else
+#define SKB_RES CONFIG_IBM_EMAC_SKBRES
+#endif
+
+/* Note about alignement. alloc_skb() returns a cache line
+ * aligned buffer. However, dev_alloc_skb() will add 16 more
+ * bytes and "reserve" them, so our buffer will actually end
+ * on a half cache line. What we do is to use directly
+ * alloc_skb, allocate 16 more bytes to match the total amount
+ * allocated by dev_alloc_skb(), but we don't reserve.
+ */
+#define MAX_NUM_BUF_DESC	255
+#define DESC_BUF_SIZE		4080	/* max 4096-16 */
+#define DESC_BUF_SIZE_REG	(DESC_BUF_SIZE / 16)
+
+/* Transmitter timeout. */
+#define TX_TIMEOUT		(2*HZ)
+
+/* MDIO latency delay */
+#define MDIO_DELAY		50
+
+/* Power managment shift registers */
+#define IBM_CPM_EMMII	0	/* Shift value for MII */
+#define IBM_CPM_EMRX	1	/* Shift value for recv */
+#define IBM_CPM_EMTX	2	/* Shift value for MAC */
+#define IBM_CPM_EMAC(x)	(((x)>>IBM_CPM_EMMII) | ((x)>>IBM_CPM_EMRX) | ((x)>>IBM_CPM_EMTX))
+
+#define ENET_HEADER_SIZE	14
+#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)
+#define EMAC_MAX_MTU		(EMAC_MAX_FRAME - ENET_HEADER_SIZE - ENET_FCS_SIZE)
+
+#ifdef CONFIG_IBM_EMAC_ERRMSG
+void emac_serr_dump_0(struct net_device *dev);
+void emac_serr_dump_1(struct net_device *dev);
+void emac_err_dump(struct net_device *dev, int em0isr);
+void emac_phy_dump(struct net_device *);
+void emac_desc_dump(struct net_device *);
+void emac_mac_dump(struct net_device *);
+void emac_mal_dump(struct net_device *);
+#else
+#define emac_serr_dump_0(dev) do { } while (0)
+#define emac_serr_dump_1(dev) do { } while (0)
+#define emac_err_dump(dev,x) do { } while (0)
+#define emac_phy_dump(dev) do { } while (0)
+#define emac_desc_dump(dev) do { } while (0)
+#define emac_mac_dump(dev) do { } while (0)
+#define emac_mal_dump(dev) do { } while (0)
+#endif
+
+struct ocp_enet_private {
+	struct sk_buff *tx_skb[NUM_TX_BUFF];
+	struct sk_buff *rx_skb[NUM_RX_BUFF];
+	struct mal_descriptor *tx_desc;
+	struct mal_descriptor *rx_desc;
+	struct mal_descriptor *rx_dirty;
+	struct net_device_stats stats;
+	int tx_cnt;
+	int rx_slot;
+	int dirty_rx;
+	int tx_slot;
+	int ack_slot;
+	int rx_buffer_size;
+
+	struct mii_phy phy_mii;
+	int mii_phy_addr;
+	int want_autoneg;
+	int timer_ticks;
+	struct timer_list link_timer;
+	struct net_device *mdio_dev;
+
+	struct ocp_device *rgmii_dev;
+	int rgmii_input;
+
+	struct ocp_device *zmii_dev;
+	int zmii_input;
+
+	struct ibm_ocp_mal *mal;
+	int mal_tx_chan, mal_rx_chan;
+	struct mal_commac commac;
+
+	struct ocp_device *tah_dev;
+
+	int opened;
+	int going_away;
+	int wol_irq;
+	emac_t *emacp;
+	struct ocp_device *ocpdev;
+	struct net_device *ndev;
+	spinlock_t lock;
+};
+#endif				/* _IBM_EMAC_CORE_H_ */
diff -Nru a/drivers/net/ibm_emac/ibm_emac_debug.c b/drivers/net/ibm_emac/ibm_emac_debug.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_debug.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,224 @@
+/*
+ * ibm_ocp_debug.c
+ *
+ * This has all the debug routines that where in *_enet.c
+ *
+ *      Armin Kuster akuster@mvista.com
+ *      April , 2002
+ *
+ * Copyright 2002 MontaVista Softare 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/kernel.h>
+#include <linux/netdevice.h>
+#include <asm/io.h>
+#include "ibm_ocp_mal.h"
+#include "ibm_ocp_zmii.h"
+#include "ibm_ocp_enet.h"
+
+extern int emac_phy_read(struct net_device *dev, int mii_id, int reg);
+
+void emac_phy_dump(struct net_device *dev)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	unsigned long i;
+	uint data;
+
+	printk(KERN_DEBUG " Prepare for Phy dump....\n");
+	for (i = 0; i < 0x1A; i++) {
+		data = emac_phy_read(dev, fep->mii_phy_addr, i);
+		printk(KERN_DEBUG "Phy reg 0x%lx ==> %4x\n", i, data);
+		if (i == 0x07)
+			i = 0x0f;
+	}
+}
+
+void emac_desc_dump(struct net_device *dev)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	int curr_slot;
+
+	printk(KERN_DEBUG
+	       "dumping the receive descriptors:  current slot is %d\n",
+	       fep->rx_slot);
+	for (curr_slot = 0; curr_slot < NUM_RX_BUFF; curr_slot++) {
+		printk(KERN_DEBUG
+		       "Desc %02d: status 0x%04x, length %3d, addr 0x%x\n",
+		       curr_slot, fep->rx_desc[curr_slot].ctrl,
+		       fep->rx_desc[curr_slot].data_len,
+		       (unsigned int)fep->rx_desc[curr_slot].data_ptr);
+	}
+}
+
+void emac_mac_dump(struct net_device *dev)
+{
+	struct ocp_enet_private *fep = dev->priv;
+	volatile emac_t *emacp = fep->emacp;
+
+	printk(KERN_DEBUG "EMAC DEBUG ********** \n");
+	printk(KERN_DEBUG "EMAC_M0  ==> 0x%x\n", in_be32(&emacp->em0mr0));
+	printk(KERN_DEBUG "EMAC_M1  ==> 0x%x\n", in_be32(&emacp->em0mr1));
+	printk(KERN_DEBUG "EMAC_TXM0==> 0x%x\n", in_be32(&emacp->em0tmr0));
+	printk(KERN_DEBUG "EMAC_TXM1==> 0x%x\n", in_be32(&emacp->em0tmr1));
+	printk(KERN_DEBUG "EMAC_RXM ==> 0x%x\n", in_be32(&emacp->em0rmr));
+	printk(KERN_DEBUG "EMAC_ISR ==> 0x%x\n", in_be32(&emacp->em0isr));
+	printk(KERN_DEBUG "EMAC_IER ==> 0x%x\n", in_be32(&emacp->em0iser));
+	printk(KERN_DEBUG "EMAC_IAH ==> 0x%x\n", in_be32(&emacp->em0iahr));
+	printk(KERN_DEBUG "EMAC_IAL ==> 0x%x\n", in_be32(&emacp->em0ialr));
+	printk(KERN_DEBUG "EMAC_VLAN_TPID_REG ==> 0x%x\n",
+	       in_be32(&emacp->em0vtpid));
+}
+
+void emac_mal_dump(struct net_device *dev)
+{
+	struct ibm_ocp_mal *mal = ((struct ocp_enet_private *)dev->priv)->mal;
+
+	printk(KERN_DEBUG " MAL DEBUG ********** \n");
+	printk(KERN_DEBUG " MCR      ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALCR));
+	printk(KERN_DEBUG " ESR      ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALESR));
+	printk(KERN_DEBUG " IER      ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALIER));
+#ifdef CONFIG_40x
+	printk(KERN_DEBUG " DBR      ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALDBR));
+#endif				/* CONFIG_40x */
+	printk(KERN_DEBUG " TXCASR   ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALTXCASR));
+	printk(KERN_DEBUG " TXCARR   ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALTXCARR));
+	printk(KERN_DEBUG " TXEOBISR ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALTXEOBISR));
+	printk(KERN_DEBUG " TXDEIR   ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALTXDEIR));
+	printk(KERN_DEBUG " RXCASR   ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALRXCASR));
+	printk(KERN_DEBUG " RXCARR   ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALRXCARR));
+	printk(KERN_DEBUG " RXEOBISR ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALRXEOBISR));
+	printk(KERN_DEBUG " RXDEIR   ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALRXDEIR));
+	printk(KERN_DEBUG " TXCTP0R  ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALTXCTP0R));
+	printk(KERN_DEBUG " TXCTP1R  ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALTXCTP1R));
+	printk(KERN_DEBUG " TXCTP2R  ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALTXCTP2R));
+	printk(KERN_DEBUG " TXCTP3R  ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALTXCTP3R));
+	printk(KERN_DEBUG " RXCTP0R  ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALRXCTP0R));
+	printk(KERN_DEBUG " RXCTP1R  ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALRXCTP1R));
+	printk(KERN_DEBUG " RCBS0    ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALRCBS0));
+	printk(KERN_DEBUG " RCBS1    ==> 0x%x\n",
+	       (unsigned int)get_mal_dcrn(mal, DCRN_MALRCBS1));
+}
+
+void emac_serr_dump_0(struct net_device *dev)
+{
+	struct ibm_ocp_mal *mal = ((struct ocp_enet_private *)dev->priv)->mal;
+	unsigned long int mal_error, plb_error, plb_addr;
+
+	mal_error = get_mal_dcrn(mal, DCRN_MALESR);
+	printk(KERN_DEBUG "ppc405_eth_serr: %s channel %ld \n",
+	       (mal_error & 0x40000000) ? "Receive" :
+	       "Transmit", (mal_error & 0x3e000000) >> 25);
+	printk(KERN_DEBUG "  -----  latched error  -----\n");
+	if (mal_error & MALESR_DE)
+		printk(KERN_DEBUG "  DE: descriptor error\n");
+	if (mal_error & MALESR_OEN)
+		printk(KERN_DEBUG "  ONE: OPB non-fullword error\n");
+	if (mal_error & MALESR_OTE)
+		printk(KERN_DEBUG "  OTE: OPB timeout error\n");
+	if (mal_error & MALESR_OSE)
+		printk(KERN_DEBUG "  OSE: OPB slave error\n");
+
+	if (mal_error & MALESR_PEIN) {
+		plb_error = mfdcr(DCRN_PLB0_BESR);
+		printk(KERN_DEBUG
+		       "  PEIN: PLB error, PLB0_BESR is 0x%x\n",
+		       (unsigned int)plb_error);
+		plb_addr = mfdcr(DCRN_PLB0_BEAR);
+		printk(KERN_DEBUG
+		       "  PEIN: PLB error, PLB0_BEAR is 0x%x\n",
+		       (unsigned int)plb_addr);
+	}
+}
+
+void emac_serr_dump_1(struct net_device *dev)
+{
+	struct ibm_ocp_mal *mal = ((struct ocp_enet_private *)dev->priv)->mal;
+	int mal_error = get_mal_dcrn(mal, DCRN_MALESR);
+
+	printk(KERN_DEBUG "  -----  cumulative errors  -----\n");
+	if (mal_error & MALESR_DEI)
+		printk(KERN_DEBUG "  DEI: descriptor error interrupt\n");
+	if (mal_error & MALESR_ONEI)
+		printk(KERN_DEBUG "  OPB non-fullword error interrupt\n");
+	if (mal_error & MALESR_OTEI)
+		printk(KERN_DEBUG "  OTEI: timeout error interrupt\n");
+	if (mal_error & MALESR_OSEI)
+		printk(KERN_DEBUG "  OSEI: slave error interrupt\n");
+	if (mal_error & MALESR_PBEI)
+		printk(KERN_DEBUG "  PBEI: PLB bus error interrupt\n");
+}
+
+void emac_err_dump(struct net_device *dev, int em0isr)
+{
+	printk(KERN_DEBUG "%s: on-chip ethernet error:\n", dev->name);
+
+	if (em0isr & EMAC_ISR_OVR)
+		printk(KERN_DEBUG "  OVR: overrun\n");
+	if (em0isr & EMAC_ISR_PP)
+		printk(KERN_DEBUG "  PP: control pause packet\n");
+	if (em0isr & EMAC_ISR_BP)
+		printk(KERN_DEBUG "  BP: packet error\n");
+	if (em0isr & EMAC_ISR_RP)
+		printk(KERN_DEBUG "  RP: runt packet\n");
+	if (em0isr & EMAC_ISR_SE)
+		printk(KERN_DEBUG "  SE: short event\n");
+	if (em0isr & EMAC_ISR_ALE)
+		printk(KERN_DEBUG "  ALE: odd number of nibbles in packet\n");
+	if (em0isr & EMAC_ISR_BFCS)
+		printk(KERN_DEBUG "  BFCS: bad FCS\n");
+	if (em0isr & EMAC_ISR_PTLE)
+		printk(KERN_DEBUG "  PTLE: oversized packet\n");
+	if (em0isr & EMAC_ISR_ORE)
+		printk(KERN_DEBUG
+		       "  ORE: packet length field > max allowed LLC\n");
+	if (em0isr & EMAC_ISR_IRE)
+		printk(KERN_DEBUG "  IRE: In Range error\n");
+	if (em0isr & EMAC_ISR_DBDM)
+		printk(KERN_DEBUG "  DBDM: xmit error or SQE\n");
+	if (em0isr & EMAC_ISR_DB0)
+		printk(KERN_DEBUG "  DB0: xmit error or SQE on TX channel 0\n");
+	if (em0isr & EMAC_ISR_SE0)
+		printk(KERN_DEBUG
+		       "  SE0: Signal Quality Error test failure from TX channel 0\n");
+	if (em0isr & EMAC_ISR_TE0)
+		printk(KERN_DEBUG "  TE0: xmit channel 0 aborted\n");
+	if (em0isr & EMAC_ISR_DB1)
+		printk(KERN_DEBUG "  DB1: xmit error or SQE on TX channel \n");
+	if (em0isr & EMAC_ISR_SE1)
+		printk(KERN_DEBUG
+		       "  SE1: Signal Quality Error test failure from TX channel 1\n");
+	if (em0isr & EMAC_ISR_TE1)
+		printk(KERN_DEBUG "  TE1: xmit channel 1 aborted\n");
+	if (em0isr & EMAC_ISR_MOS)
+		printk(KERN_DEBUG "  MOS\n");
+	if (em0isr & EMAC_ISR_MOF)
+		printk(KERN_DEBUG "  MOF\n");
+
+	emac_mac_dump(dev);
+	emac_mal_dump(dev);
+}
diff -Nru a/drivers/net/ibm_emac/ibm_emac_mal.c b/drivers/net/ibm_emac/ibm_emac_mal.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_mal.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,467 @@
+/*
+ * ibm_ocp_mal.c
+ *
+ *      Armin Kuster akuster@mvista.com
+ *      Juen, 2002
+ *
+ * Copyright 2002 MontaVista Softare 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/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/netdevice.h>
+#include <linux/init.h>
+#include <linux/dma-mapping.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/ocp.h>
+
+#include "ibm_emac_mal.h"
+
+// Locking: Should we share a lock with the client ? The client could provide
+// a lock pointer (optionally) in the commac structure... I don't think this is
+// really necessary though
+
+/* This lock protects the commac list. On today UP implementations, it's
+ * really only used as IRQ protection in mal_{register,unregister}_commac()
+ */
+static rwlock_t mal_list_lock = RW_LOCK_UNLOCKED;
+
+int mal_register_commac(struct ibm_ocp_mal *mal, struct mal_commac *commac)
+{
+	unsigned long flags;
+
+	write_lock_irqsave(&mal_list_lock, flags);
+
+	/* Don't let multiple commacs claim the same channel */
+	if ((mal->tx_chan_mask & commac->tx_chan_mask) ||
+	    (mal->rx_chan_mask & commac->rx_chan_mask)) {
+		write_unlock_irqrestore(&mal_list_lock, flags);
+		return -EBUSY;
+	}
+
+	mal->tx_chan_mask |= commac->tx_chan_mask;
+	mal->rx_chan_mask |= commac->rx_chan_mask;
+
+	list_add(&commac->list, &mal->commac);
+
+	write_unlock_irqrestore(&mal_list_lock, flags);
+
+	MOD_INC_USE_COUNT;
+
+	return 0;
+}
+
+int mal_unregister_commac(struct ibm_ocp_mal *mal, struct mal_commac *commac)
+{
+	unsigned long flags;
+
+	write_lock_irqsave(&mal_list_lock, flags);
+
+	mal->tx_chan_mask &= ~commac->tx_chan_mask;
+	mal->rx_chan_mask &= ~commac->rx_chan_mask;
+
+	list_del_init(&commac->list);
+
+	write_unlock_irqrestore(&mal_list_lock, flags);
+
+	MOD_DEC_USE_COUNT;
+
+	return 0;
+}
+
+int mal_set_rcbs(struct ibm_ocp_mal *mal, int channel, unsigned long size)
+{
+	switch (channel) {
+	case 0:
+		set_mal_dcrn(mal, DCRN_MALRCBS0, size);
+		break;
+#ifdef DCRN_MALRCBS1
+	case 1:
+		set_mal_dcrn(mal, DCRN_MALRCBS1, size);
+		break;
+#endif
+#ifdef DCRN_MALRCBS2
+	case 2:
+		set_mal_dcrn(mal, DCRN_MALRCBS2, size);
+		break;
+#endif
+#ifdef DCRN_MALRCBS3
+	case 3:
+		set_mal_dcrn(mal, DCRN_MALRCBS3, size);
+		break;
+#endif
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static irqreturn_t mal_serr(int irq, void *dev_instance, struct pt_regs *regs)
+{
+	struct ibm_ocp_mal *mal = dev_instance;
+	unsigned long mal_error;
+
+	/*
+	 * This SERR applies to one of the devices on the MAL, here we charge
+	 * it against the first EMAC registered for the MAL.
+	 */
+
+	mal_error = get_mal_dcrn(mal, DCRN_MALESR);
+
+	printk(KERN_ERR "%s: System Error (MALESR=%lx)\n",
+	       "MAL" /* FIXME: get the name right */ , mal_error);
+
+	/* FIXME: decipher error */
+	/* DIXME: distribute to commacs, if possible */
+
+	/* Clear the error status register */
+	set_mal_dcrn(mal, DCRN_MALESR, mal_error);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mal_txeob(int irq, void *dev_instance, struct pt_regs *regs)
+{
+	struct ibm_ocp_mal *mal = dev_instance;
+	struct list_head *l;
+	unsigned long isr;
+
+	isr = get_mal_dcrn(mal, DCRN_MALTXEOBISR);
+	set_mal_dcrn(mal, DCRN_MALTXEOBISR, isr);
+
+	read_lock(&mal_list_lock);
+	list_for_each(l, &mal->commac) {
+		struct mal_commac *mc = list_entry(l, struct mal_commac, list);
+
+		if (isr & mc->tx_chan_mask) {
+			mc->ops->txeob(mc->dev, isr & mc->tx_chan_mask);
+		}
+	}
+	read_unlock(&mal_list_lock);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mal_rxeob(int irq, void *dev_instance, struct pt_regs *regs)
+{
+	struct ibm_ocp_mal *mal = dev_instance;
+	struct list_head *l;
+	unsigned long isr;
+
+	isr = get_mal_dcrn(mal, DCRN_MALRXEOBISR);
+	set_mal_dcrn(mal, DCRN_MALRXEOBISR, isr);
+
+	read_lock(&mal_list_lock);
+	list_for_each(l, &mal->commac) {
+		struct mal_commac *mc = list_entry(l, struct mal_commac, list);
+
+		if (isr & mc->rx_chan_mask) {
+			mc->ops->rxeob(mc->dev, isr & mc->rx_chan_mask);
+		}
+	}
+	read_unlock(&mal_list_lock);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mal_txde(int irq, void *dev_instance, struct pt_regs *regs)
+{
+	struct ibm_ocp_mal *mal = dev_instance;
+	struct list_head *l;
+	unsigned long deir;
+
+	deir = get_mal_dcrn(mal, DCRN_MALTXDEIR);
+
+	/* FIXME: print which MAL correctly */
+	printk(KERN_WARNING "%s: Tx descriptor error (MALTXDEIR=%lx)\n",
+	       "MAL", deir);
+
+	read_lock(&mal_list_lock);
+	list_for_each(l, &mal->commac) {
+		struct mal_commac *mc = list_entry(l, struct mal_commac, list);
+
+		if (deir & mc->tx_chan_mask) {
+			mc->ops->txde(mc->dev, deir & mc->tx_chan_mask);
+		}
+	}
+	read_unlock(&mal_list_lock);
+
+	return IRQ_HANDLED;
+}
+
+/*
+ * This interrupt should be very rare at best.  This occurs when
+ * the hardware has a problem with the receive descriptors.  The manual
+ * states that it occurs when the hardware cannot the receive descriptor
+ * empty bit is not set.  The recovery mechanism will be to
+ * traverse through the descriptors, handle any that are marked to be
+ * handled and reinitialize each along the way.  At that point the driver
+ * will be restarted.
+ */
+static irqreturn_t mal_rxde(int irq, void *dev_instance, struct pt_regs *regs)
+{
+	struct ibm_ocp_mal *mal = dev_instance;
+	struct list_head *l;
+	unsigned long deir;
+
+	deir = get_mal_dcrn(mal, DCRN_MALRXDEIR);
+
+	/*
+	 * This really is needed.  This case encountered in stress testing.
+	 */
+	if (deir == 0)
+		return IRQ_HANDLED;
+
+	/* FIXME: print which MAL correctly */
+	printk(KERN_WARNING "%s: Rx descriptor error (MALRXDEIR=%lx)\n",
+	       "MAL", deir);
+
+	read_lock(&mal_list_lock);
+	list_for_each(l, &mal->commac) {
+		struct mal_commac *mc = list_entry(l, struct mal_commac, list);
+
+		if (deir & mc->rx_chan_mask) {
+			mc->ops->rxde(mc->dev, deir & mc->rx_chan_mask);
+		}
+	}
+	read_unlock(&mal_list_lock);
+
+	return IRQ_HANDLED;
+}
+
+static int __init mal_probe(struct ocp_device *ocpdev)
+{
+	struct ibm_ocp_mal *mal = NULL;
+	struct ocp_func_mal_data *maldata;
+	int err = 0;
+
+	maldata = (struct ocp_func_mal_data *)ocpdev->def->additions;
+	if (maldata == NULL) {
+		printk(KERN_ERR "mal%d: Missing additional datas !\n",
+		       ocpdev->def->index);
+		return -ENODEV;
+	}
+
+	mal = kmalloc(sizeof(struct ibm_ocp_mal), GFP_KERNEL);
+	if (mal == NULL) {
+		printk(KERN_ERR
+		       "mal%d: Out of memory allocating MAL structure !\n",
+		       ocpdev->def->index);
+		return -ENOMEM;
+	}
+	memset(mal, 0, sizeof(*mal));
+
+	switch (ocpdev->def->index) {
+	case 0:
+		mal->dcrbase = DCRN_MAL_BASE;
+		break;
+#ifdef DCRN_MAL1_BASE
+	case 1:
+		mal->dcrbase = DCRN_MAL1_BASE;
+		break;
+#endif
+	default:
+		BUG();
+	}
+
+	/**************************/
+
+	INIT_LIST_HEAD(&mal->commac);
+
+	set_mal_dcrn(mal, DCRN_MALRXCARR, 0xFFFFFFFF);
+	set_mal_dcrn(mal, DCRN_MALTXCARR, 0xFFFFFFFF);
+
+	set_mal_dcrn(mal, DCRN_MALCR, MALCR_MMSR);	/* 384 */
+	/* FIXME: Add delay */
+
+	/* Set the MAL configuration register */
+	set_mal_dcrn(mal, DCRN_MALCR,
+		     MALCR_PLBB | MALCR_OPBBL | MALCR_LEA |
+		     MALCR_PLBLT_DEFAULT);
+
+	/* It would be nice to allocate buffers separately for each
+	 * channel, but we can't because the channels share the upper
+	 * 13 bits of address lines.  Each channels buffer must also
+	 * be 4k aligned, so we allocate 4k for each channel.  This is
+	 * inefficient FIXME: do better, if possible */
+	mal->tx_virt_addr = dma_alloc_coherent(&ocpdev->dev,
+					       MAL_DT_ALIGN *
+					       maldata->num_tx_chans,
+					       &mal->tx_phys_addr, GFP_KERNEL);
+	if (mal->tx_virt_addr == NULL) {
+		printk(KERN_ERR
+		       "mal%d: Out of memory allocating MAL descriptors !\n",
+		       ocpdev->def->index);
+		err = -ENOMEM;
+		goto fail;
+	}
+
+	/* God, oh, god, I hate DCRs */
+	set_mal_dcrn(mal, DCRN_MALTXCTP0R, mal->tx_phys_addr);
+#ifdef DCRN_MALTXCTP1R
+	if (maldata->num_tx_chans > 1)
+		set_mal_dcrn(mal, DCRN_MALTXCTP1R,
+			     mal->tx_phys_addr + MAL_DT_ALIGN);
+#endif				/* DCRN_MALTXCTP1R */
+#ifdef DCRN_MALTXCTP2R
+	if (maldata->num_tx_chans > 2)
+		set_mal_dcrn(mal, DCRN_MALTXCTP2R,
+			     mal->tx_phys_addr + 2 * MAL_DT_ALIGN);
+#endif				/* DCRN_MALTXCTP2R */
+#ifdef DCRN_MALTXCTP3R
+	if (maldata->num_tx_chans > 3)
+		set_mal_dcrn(mal, DCRN_MALTXCTP3R,
+			     mal->tx_phys_addr + 3 * MAL_DT_ALIGN);
+#endif				/* DCRN_MALTXCTP3R */
+#ifdef DCRN_MALTXCTP4R
+	if (maldata->num_tx_chans > 4)
+		set_mal_dcrn(mal, DCRN_MALTXCTP4R,
+			     mal->tx_phys_addr + 4 * MAL_DT_ALIGN);
+#endif				/* DCRN_MALTXCTP4R */
+#ifdef DCRN_MALTXCTP5R
+	if (maldata->num_tx_chans > 5)
+		set_mal_dcrn(mal, DCRN_MALTXCTP5R,
+			     mal->tx_phys_addr + 5 * MAL_DT_ALIGN);
+#endif				/* DCRN_MALTXCTP5R */
+#ifdef DCRN_MALTXCTP6R
+	if (maldata->num_tx_chans > 6)
+		set_mal_dcrn(mal, DCRN_MALTXCTP6R,
+			     mal->tx_phys_addr + 6 * MAL_DT_ALIGN);
+#endif				/* DCRN_MALTXCTP6R */
+#ifdef DCRN_MALTXCTP7R
+	if (maldata->num_tx_chans > 7)
+		set_mal_dcrn(mal, DCRN_MALTXCTP7R,
+			     mal->tx_phys_addr + 7 * MAL_DT_ALIGN);
+#endif				/* DCRN_MALTXCTP7R */
+
+	mal->rx_virt_addr = dma_alloc_coherent(&ocpdev->dev,
+					       MAL_DT_ALIGN *
+					       maldata->num_rx_chans,
+					       &mal->rx_phys_addr, GFP_KERNEL);
+
+	set_mal_dcrn(mal, DCRN_MALRXCTP0R, mal->rx_phys_addr);
+#ifdef DCRN_MALRXCTP1R
+	if (maldata->num_rx_chans > 1)
+		set_mal_dcrn(mal, DCRN_MALRXCTP1R,
+			     mal->rx_phys_addr + MAL_DT_ALIGN);
+#endif				/* DCRN_MALRXCTP1R */
+#ifdef DCRN_MALRXCTP2R
+	if (maldata->num_rx_chans > 2)
+		set_mal_dcrn(mal, DCRN_MALRXCTP2R,
+			     mal->rx_phys_addr + 2 * MAL_DT_ALIGN);
+#endif				/* DCRN_MALRXCTP2R */
+#ifdef DCRN_MALRXCTP3R
+	if (maldata->num_rx_chans > 3)
+		set_mal_dcrn(mal, DCRN_MALRXCTP3R,
+			     mal->rx_phys_addr + 3 * MAL_DT_ALIGN);
+#endif				/* DCRN_MALRXCTP3R */
+
+	err = request_irq(maldata->serr_irq, mal_serr, 0, "MAL SERR", mal);
+	if (err)
+		goto fail;
+	err = request_irq(maldata->txde_irq, mal_txde, 0, "MAL TX DE ", mal);
+	if (err)
+		goto fail;
+	err = request_irq(maldata->txeob_irq, mal_txeob, 0, "MAL TX EOB", mal);
+	if (err)
+		goto fail;
+	err = request_irq(maldata->rxde_irq, mal_rxde, 0, "MAL RX DE", mal);
+	if (err)
+		goto fail;
+	err = request_irq(maldata->rxeob_irq, mal_rxeob, 0, "MAL RX EOB", mal);
+	if (err)
+		goto fail;
+
+	set_mal_dcrn(mal, DCRN_MALIER,
+		     MALIER_DE | MALIER_NE | MALIER_TE |
+		     MALIER_OPBE | MALIER_PLBE);
+
+	/* Advertise me to the rest of the world */
+	ocp_set_drvdata(ocpdev, mal);
+
+	printk(KERN_INFO "mal%d: Initialized, %d tx channels, %d rx channels\n",
+	       ocpdev->def->index, maldata->num_tx_chans,
+	       maldata->num_rx_chans);
+
+	return 0;
+
+      fail:
+	/* FIXME: dispose requested IRQs ! */
+	if (err && mal)
+		kfree(mal);
+	return err;
+}
+
+static void __exit mal_remove(struct ocp_device *ocpdev)
+{
+	struct ibm_ocp_mal *mal = ocp_get_drvdata(ocpdev);
+	struct ocp_func_mal_data *maldata = ocpdev->def->additions;
+
+	BUG_ON(!maldata);
+
+	ocp_set_drvdata(ocpdev, NULL);
+
+	/* FIXME: shut down the MAL, deal with dependency with emac */
+	free_irq(maldata->serr_irq, mal);
+	free_irq(maldata->txde_irq, mal);
+	free_irq(maldata->txeob_irq, mal);
+	free_irq(maldata->rxde_irq, mal);
+	free_irq(maldata->rxeob_irq, mal);
+
+	if (mal->tx_virt_addr)
+		dma_free_coherent(&ocpdev->dev,
+				  MAL_DT_ALIGN * maldata->num_tx_chans,
+				  mal->tx_virt_addr, mal->tx_phys_addr);
+
+	if (mal->rx_virt_addr)
+		dma_free_coherent(&ocpdev->dev,
+				  MAL_DT_ALIGN * maldata->num_rx_chans,
+				  mal->rx_virt_addr, mal->rx_phys_addr);
+
+	kfree(mal);
+}
+
+/* Structure for a device driver */
+static struct ocp_device_id mal_ids[] = {
+	{.vendor = OCP_ANY_ID,.function = OCP_FUNC_MAL},
+	{.vendor = OCP_VENDOR_INVALID}
+};
+
+static struct ocp_driver mal_driver = {
+	.name = "mal",
+	.id_table = mal_ids,
+
+	.probe = mal_probe,
+	.remove = mal_remove,
+};
+
+static int __init init_mals(void)
+{
+	int rc;
+
+	rc = ocp_register_driver(&mal_driver);
+	if (rc < 0) {
+		ocp_unregister_driver(&mal_driver);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static void __exit exit_mals(void)
+{
+	ocp_unregister_driver(&mal_driver);
+}
+
+module_init(init_mals);
+module_exit(exit_mals);
diff -Nru a/drivers/net/ibm_emac/ibm_emac_mal.h b/drivers/net/ibm_emac/ibm_emac_mal.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_mal.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,130 @@
+#ifndef _IBM_EMAC_MAL_H
+#define _IBM_EMAC_MAL_H
+
+#include <linux/list.h>
+
+#define MAL_DT_ALIGN	(4096)	/* Alignment for each channel's descriptor table */
+
+#define MAL_CHAN_MASK(chan)	(0x80000000 >> (chan))
+
+/* MAL Buffer Descriptor structure */
+struct mal_descriptor {
+	unsigned short ctrl;	/* MAL / Commac status control bits */
+	short data_len;		/* Max length is 4K-1 (12 bits)     */
+	unsigned char *data_ptr;	/* pointer to actual data buffer    */
+} __attribute__ ((packed));
+
+/* the following defines are for the MadMAL status and control registers. */
+/* MADMAL transmit and receive status/control bits  */
+#define MAL_RX_CTRL_EMPTY		0x8000
+#define MAL_RX_CTRL_WRAP		0x4000
+#define MAL_RX_CTRL_CM			0x2000
+#define MAL_RX_CTRL_LAST		0x1000
+#define MAL_RX_CTRL_FIRST		0x0800
+#define MAL_RX_CTRL_INTR		0x0400
+
+#define MAL_TX_CTRL_READY		0x8000
+#define MAL_TX_CTRL_WRAP		0x4000
+#define MAL_TX_CTRL_CM			0x2000
+#define MAL_TX_CTRL_LAST		0x1000
+#define MAL_TX_CTRL_INTR		0x0400
+
+struct mal_commac_ops {
+	void (*txeob) (void *dev, u32 chanmask);
+	void (*txde) (void *dev, u32 chanmask);
+	void (*rxeob) (void *dev, u32 chanmask);
+	void (*rxde) (void *dev, u32 chanmask);
+};
+
+struct mal_commac {
+	struct mal_commac_ops *ops;
+	void *dev;
+	u32 tx_chan_mask, rx_chan_mask;
+	struct list_head list;
+};
+
+struct ibm_ocp_mal {
+	int dcrbase;
+
+	struct list_head commac;
+	u32 tx_chan_mask, rx_chan_mask;
+
+	dma_addr_t tx_phys_addr;
+	struct mal_descriptor *tx_virt_addr;
+
+	dma_addr_t rx_phys_addr;
+	struct mal_descriptor *rx_virt_addr;
+};
+
+#define GET_MAL_STANZA(base,dcrn) \
+	case base: \
+		x = mfdcr(dcrn(base)); \
+		break;
+
+#define SET_MAL_STANZA(base,dcrn, val) \
+	case base: \
+		mtdcr(dcrn(base), (val)); \
+		break;
+
+#define GET_MAL0_STANZA(dcrn) GET_MAL_STANZA(DCRN_MAL_BASE,dcrn)
+#define SET_MAL0_STANZA(dcrn,val) SET_MAL_STANZA(DCRN_MAL_BASE,dcrn,val)
+
+#ifdef DCRN_MAL1_BASE
+#define GET_MAL1_STANZA(dcrn) GET_MAL_STANZA(DCRN_MAL1_BASE,dcrn)
+#define SET_MAL1_STANZA(dcrn,val) SET_MAL_STANZA(DCRN_MAL1_BASE,dcrn,val)
+#else				/* ! DCRN_MAL1_BASE */
+#define GET_MAL1_STANZA(dcrn)
+#define SET_MAL1_STANZA(dcrn,val)
+#endif
+
+#define get_mal_dcrn(mal, dcrn) ({ \
+	u32 x; \
+	switch ((mal)->dcrbase) { \
+		GET_MAL0_STANZA(dcrn) \
+		GET_MAL1_STANZA(dcrn) \
+	default: \
+		BUG(); \
+	} \
+x; })
+
+#define set_mal_dcrn(mal, dcrn, val) do { \
+	switch ((mal)->dcrbase) { \
+		SET_MAL0_STANZA(dcrn,val) \
+		SET_MAL1_STANZA(dcrn,val) \
+	default: \
+		BUG(); \
+	} } while (0)
+
+static inline void mal_enable_tx_channels(struct ibm_ocp_mal *mal, u32 chanmask)
+{
+	set_mal_dcrn(mal, DCRN_MALTXCASR,
+		     get_mal_dcrn(mal, DCRN_MALTXCASR) | chanmask);
+}
+
+static inline void mal_disable_tx_channels(struct ibm_ocp_mal *mal,
+					   u32 chanmask)
+{
+	set_mal_dcrn(mal, DCRN_MALTXCARR, chanmask);
+}
+
+static inline void mal_enable_rx_channels(struct ibm_ocp_mal *mal, u32 chanmask)
+{
+	set_mal_dcrn(mal, DCRN_MALRXCASR,
+		     get_mal_dcrn(mal, DCRN_MALRXCASR) | chanmask);
+}
+
+static inline void mal_disable_rx_channels(struct ibm_ocp_mal *mal,
+					   u32 chanmask)
+{
+	set_mal_dcrn(mal, DCRN_MALRXCARR, chanmask);
+}
+
+extern int mal_register_commac(struct ibm_ocp_mal *mal,
+			       struct mal_commac *commac);
+extern int mal_unregister_commac(struct ibm_ocp_mal *mal,
+				 struct mal_commac *commac);
+
+extern int mal_set_rcbs(struct ibm_ocp_mal *mal, int channel,
+			unsigned long size);
+
+#endif				/* _IBM_EMAC_MAL_H */
diff -Nru a/drivers/net/ibm_emac/ibm_emac_phy.c b/drivers/net/ibm_emac/ibm_emac_phy.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_phy.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,297 @@
+/*
+ * ibm_ocp_phy.c
+ *
+ * PHY drivers for the ibm ocp ethernet driver. Borrowed
+ * from sungem_phy.c, though I only kept the generic MII
+ * driver for now.
+ * 
+ * This file should be shared with other drivers or eventually
+ * merged as the "low level" part of miilib
+ * 
+ * (c) 2003, Benjamin Herrenscmidt (benh@kernel.crashing.org)
+ *
+ */
+
+#include <linux/config.h>
+
+#include <linux/module.h>
+
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/types.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/mii.h>
+#include <linux/ethtool.h>
+#include <linux/delay.h>
+
+#include "ibm_emac_phy.h"
+
+static int reset_one_mii_phy(struct mii_phy *phy, int phy_id)
+{
+	u16 val;
+	int limit = 10000;
+
+	val = __phy_read(phy, phy_id, MII_BMCR);
+	val &= ~BMCR_ISOLATE;
+	val |= BMCR_RESET;
+	__phy_write(phy, phy_id, MII_BMCR, val);
+
+	udelay(100);
+
+	while (limit--) {
+		val = __phy_read(phy, phy_id, MII_BMCR);
+		if ((val & BMCR_RESET) == 0)
+			break;
+		udelay(10);
+	}
+	if ((val & BMCR_ISOLATE) && limit > 0)
+		__phy_write(phy, phy_id, MII_BMCR, val & ~BMCR_ISOLATE);
+
+	return (limit <= 0);
+}
+
+static int cis8201_init(struct mii_phy *phy)
+{
+	u16 epcr;
+
+	epcr = phy_read(phy, MII_CIS8201_EPCR);
+	epcr &= ~EPCR_MODE_MASK;
+
+	switch (phy->mode) {
+	case PHY_MODE_TBI:
+		epcr |= EPCR_TBI_MODE;
+		break;
+	case PHY_MODE_RTBI:
+		epcr |= EPCR_RTBI_MODE;
+		break;
+	case PHY_MODE_GMII:
+		epcr |= EPCR_GMII_MODE;
+		break;
+	case PHY_MODE_RGMII:
+	default:
+		epcr |= EPCR_RGMII_MODE;
+	}
+
+	phy_write(phy, MII_CIS8201_EPCR, epcr);
+
+	return 0;
+}
+
+static int genmii_setup_aneg(struct mii_phy *phy, u32 advertise)
+{
+	u16 ctl, adv;
+
+	phy->autoneg = 1;
+	phy->speed = SPEED_10;
+	phy->duplex = DUPLEX_HALF;
+	phy->pause = 0;
+	phy->advertising = advertise;
+
+	/* Setup standard advertise */
+	adv = phy_read(phy, MII_ADVERTISE);
+	adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
+	if (advertise & ADVERTISED_10baseT_Half)
+		adv |= ADVERTISE_10HALF;
+	if (advertise & ADVERTISED_10baseT_Full)
+		adv |= ADVERTISE_10FULL;
+	if (advertise & ADVERTISED_100baseT_Half)
+		adv |= ADVERTISE_100HALF;
+	if (advertise & ADVERTISED_100baseT_Full)
+		adv |= ADVERTISE_100FULL;
+	phy_write(phy, MII_ADVERTISE, adv);
+
+	/* Start/Restart aneg */
+	ctl = phy_read(phy, MII_BMCR);
+	ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
+	phy_write(phy, MII_BMCR, ctl);
+
+	return 0;
+}
+
+static int genmii_setup_forced(struct mii_phy *phy, int speed, int fd)
+{
+	u16 ctl;
+
+	phy->autoneg = 0;
+	phy->speed = speed;
+	phy->duplex = fd;
+	phy->pause = 0;
+
+	ctl = phy_read(phy, MII_BMCR);
+	ctl &= ~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_ANENABLE);
+
+	/* First reset the PHY */
+	phy_write(phy, MII_BMCR, ctl | BMCR_RESET);
+
+	/* Select speed & duplex */
+	switch (speed) {
+	case SPEED_10:
+		break;
+	case SPEED_100:
+		ctl |= BMCR_SPEED100;
+		break;
+	case SPEED_1000:
+	default:
+		return -EINVAL;
+	}
+	if (fd == DUPLEX_FULL)
+		ctl |= BMCR_FULLDPLX;
+	phy_write(phy, MII_BMCR, ctl);
+
+	return 0;
+}
+
+static int genmii_poll_link(struct mii_phy *phy)
+{
+	u16 status;
+
+	(void)phy_read(phy, MII_BMSR);
+	status = phy_read(phy, MII_BMSR);
+	if ((status & BMSR_LSTATUS) == 0)
+		return 0;
+	if (phy->autoneg && !(status & BMSR_ANEGCOMPLETE))
+		return 0;
+	return 1;
+}
+
+#define	MII_CIS8201_ACSR	0x1c
+#define  ACSR_DUPLEX_STATUS	0x0020
+#define  ACSR_SPEED_1000BASET	0x0010
+#define  ACSR_SPEED_100BASET	0x0008
+
+static int cis8201_read_link(struct mii_phy *phy)
+{
+	u16 acsr;
+
+	if (phy->autoneg) {
+		acsr = phy_read(phy, MII_CIS8201_ACSR);
+
+		if (acsr & ACSR_DUPLEX_STATUS)
+			phy->duplex = DUPLEX_FULL;
+		else
+			phy->duplex = DUPLEX_HALF;
+		if (acsr & ACSR_SPEED_1000BASET) {
+			phy->speed = SPEED_1000;
+		} else if (acsr & ACSR_SPEED_100BASET)
+			phy->speed = SPEED_100;
+		else
+			phy->speed = SPEED_10;
+		phy->pause = 0;
+	}
+	/* On non-aneg, we assume what we put in BMCR is the speed,
+	 * though magic-aneg shouldn't prevent this case from occurring
+	 */
+
+	return 0;
+}
+
+static int genmii_read_link(struct mii_phy *phy)
+{
+	u16 lpa;
+
+	if (phy->autoneg) {
+		lpa = phy_read(phy, MII_LPA);
+
+		if (lpa & (LPA_10FULL | LPA_100FULL))
+			phy->duplex = DUPLEX_FULL;
+		else
+			phy->duplex = DUPLEX_HALF;
+		if (lpa & (LPA_100FULL | LPA_100HALF))
+			phy->speed = SPEED_100;
+		else
+			phy->speed = SPEED_10;
+		phy->pause = 0;
+	}
+	/* On non-aneg, we assume what we put in BMCR is the speed,
+	 * though magic-aneg shouldn't prevent this case from occurring
+	 */
+
+	return 0;
+}
+
+#define MII_BASIC_FEATURES	(SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | \
+				 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | \
+				 SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII)
+#define MII_GBIT_FEATURES	(MII_BASIC_FEATURES | \
+				 SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full)
+
+/* CIS8201 phy ops */
+static struct mii_phy_ops cis8201_phy_ops = {
+	init:cis8201_init,
+	setup_aneg:genmii_setup_aneg,
+	setup_forced:genmii_setup_forced,
+	poll_link:genmii_poll_link,
+	read_link:cis8201_read_link
+};
+
+/* Generic implementation for most 10/100 PHYs */
+static struct mii_phy_ops generic_phy_ops = {
+	setup_aneg:genmii_setup_aneg,
+	setup_forced:genmii_setup_forced,
+	poll_link:genmii_poll_link,
+	read_link:genmii_read_link
+};
+
+static struct mii_phy_def cis8201_phy_def = {
+	phy_id:0x000fc410,
+	phy_id_mask:0x000ffff0,
+	name:"CIS8201 Gigabit Ethernet",
+	features:MII_GBIT_FEATURES,
+	magic_aneg:0,
+	ops:&cis8201_phy_ops
+};
+
+static struct mii_phy_def genmii_phy_def = {
+	phy_id:0x00000000,
+	phy_id_mask:0x00000000,
+	name:"Generic MII",
+	features:MII_BASIC_FEATURES,
+	magic_aneg:0,
+	ops:&generic_phy_ops
+};
+
+static struct mii_phy_def *mii_phy_table[] = {
+	&cis8201_phy_def,
+	&genmii_phy_def,
+	NULL
+};
+
+int mii_phy_probe(struct mii_phy *phy, int mii_id)
+{
+	int rc;
+	u32 id;
+	struct mii_phy_def *def;
+	int i;
+
+	phy->autoneg = 0;
+	phy->advertising = 0;
+	phy->mii_id = mii_id;
+	phy->speed = 0;
+	phy->duplex = 0;
+	phy->pause = 0;
+
+	/* Take PHY out of isloate mode and reset it. */
+	rc = reset_one_mii_phy(phy, mii_id);
+	if (rc)
+		return -ENODEV;
+
+	/* Read ID and find matching entry */
+	id = (phy_read(phy, MII_PHYSID1) << 16 | phy_read(phy, MII_PHYSID2))
+	    & 0xfffffff0;
+	for (i = 0; (def = mii_phy_table[i]) != NULL; i++)
+		if ((id & def->phy_id_mask) == def->phy_id)
+			break;
+	/* Should never be NULL (we have a generic entry), but... */
+	if (def == NULL)
+		return -ENODEV;
+
+	phy->def = def;
+
+	/* Setup default advertising */
+	phy->advertising = def->features;
+
+	return 0;
+}
+
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/net/ibm_emac/ibm_emac_phy.h b/drivers/net/ibm_emac/ibm_emac_phy.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_phy.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,137 @@
+
+/*
+ * ibm_emac_phy.h
+ *
+ *
+ *      Benjamin Herrenschmidt <benh@kernel.crashing.org>
+ *      February 2003
+ *
+ * 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  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS 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
+ *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  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.
+ *
+ *
+ * This file basically duplicates sungem_phy.{c,h} with different PHYs
+ * supported. I'm looking into merging that in a single mii layer more
+ * flexible than mii.c 
+ */
+
+#ifndef _IBM_EMAC_PHY_H_
+#define _IBM_EMAC_PHY_H_
+
+/*
+ * PHY mode settings
+ * Used for multi-mode capable PHYs
+ */
+#define PHY_MODE_NA	0
+#define PHY_MODE_MII	1
+#define PHY_MODE_RMII	2
+#define PHY_MODE_SMII	3
+#define PHY_MODE_RGMII	4
+#define PHY_MODE_TBI	5
+#define PHY_MODE_GMII	6
+#define PHY_MODE_RTBI	7
+#define PHY_MODE_SGMII	8
+
+/*
+ * PHY specific registers/values
+ */
+
+/* CIS8201 */
+#define MII_CIS8201_EPCR	0x17
+#define EPCR_MODE_MASK		0x3000
+#define EPCR_GMII_MODE		0x0000
+#define EPCR_RGMII_MODE		0x1000
+#define EPCR_TBI_MODE		0x2000
+#define EPCR_RTBI_MODE		0x3000
+
+struct mii_phy;
+
+/* Operations supported by any kind of PHY */
+struct mii_phy_ops {
+	int (*init) (struct mii_phy * phy);
+	int (*suspend) (struct mii_phy * phy, int wol_options);
+	int (*setup_aneg) (struct mii_phy * phy, u32 advertise);
+	int (*setup_forced) (struct mii_phy * phy, int speed, int fd);
+	int (*poll_link) (struct mii_phy * phy);
+	int (*read_link) (struct mii_phy * phy);
+};
+
+/* Structure used to statically define an mii/gii based PHY */
+struct mii_phy_def {
+	u32 phy_id;		/* Concatenated ID1 << 16 | ID2 */
+	u32 phy_id_mask;	/* Significant bits */
+	u32 features;		/* Ethtool SUPPORTED_* defines */
+	int magic_aneg;		/* Autoneg does all speed test for us */
+	const char *name;
+	const struct mii_phy_ops *ops;
+};
+
+/* An instance of a PHY, partially borrowed from mii_if_info */
+struct mii_phy {
+	struct mii_phy_def *def;
+	int advertising;
+	int mii_id;
+
+	/* 1: autoneg enabled, 0: disabled */
+	int autoneg;
+
+	/* forced speed & duplex (no autoneg)
+	 * partner speed & duplex & pause (autoneg)
+	 */
+	int speed;
+	int duplex;
+	int pause;
+
+	/* PHY mode - if needed */
+	int mode;
+
+	/* Provided by host chip */
+	struct net_device *dev;
+	int (*mdio_read) (struct net_device * dev, int mii_id, int reg);
+	void (*mdio_write) (struct net_device * dev, int mii_id, int reg,
+			    int val);
+};
+
+/* Pass in a struct mii_phy with dev, mdio_read and mdio_write
+ * filled, the remaining fields will be filled on return
+ */
+extern int mii_phy_probe(struct mii_phy *phy, int mii_id);
+
+static inline int __phy_read(struct mii_phy *phy, int id, int reg)
+{
+	return phy->mdio_read(phy->dev, id, reg);
+}
+
+static inline void __phy_write(struct mii_phy *phy, int id, int reg, int val)
+{
+	phy->mdio_write(phy->dev, id, reg, val);
+}
+
+static inline int phy_read(struct mii_phy *phy, int reg)
+{
+	return phy->mdio_read(phy->dev, phy->mii_id, reg);
+}
+
+static inline void phy_write(struct mii_phy *phy, int reg, int val)
+{
+	phy->mdio_write(phy->dev, phy->mii_id, reg, val);
+}
+
+#endif				/* _IBM_EMAC_PHY_H_ */
diff -Nru a/drivers/net/ibm_emac/ibm_emac_rgmii.h b/drivers/net/ibm_emac/ibm_emac_rgmii.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_rgmii.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,65 @@
+/*
+ * Defines for the IBM RGMII bridge
+ *
+ * Based on ocp_zmii.h/ibm_emac_zmii.h
+ * Armin Kuster akuster@mvista.com
+ *
+ * Copyright 2004 MontaVista Software, Inc.
+ * Matt Porter <mporter@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.
+ */
+
+#ifndef _IBM_EMAC_RGMII_H_
+#define _IBM_EMAC_RGMII_H_
+
+#include <linux/config.h>
+
+/* RGMII bridge */
+typedef struct rgmii_regs {
+	u32 fer;		/* Function enable register */
+	u32 ssr;		/* Speed select register */
+} rgmii_t;
+
+#define RGMII_INPUTS			4
+
+/* RGMII device */
+struct ibm_ocp_rgmii {
+	struct rgmii_regs *base;
+	int mode[RGMII_INPUTS];
+	int users;		/* number of EMACs using this RGMII bridge */
+};
+
+/* Fuctional Enable Reg */
+#define RGMII_FER_MASK(x)		(0x00000007 << (4*x))
+#define RGMII_RTBI			0x00000004
+#define RGMII_RGMII			0x00000005
+#define RGMII_TBI  			0x00000006
+#define RGMII_GMII 			0x00000007
+
+/* Speed Selection reg */
+
+#define RGMII_SP2_100	0x00000002
+#define RGMII_SP2_1000	0x00000004
+#define RGMII_SP3_100	0x00000200
+#define RGMII_SP3_1000	0x00000400
+
+#define RGMII_MII2_SPDMASK	 0x00000007
+#define RGMII_MII3_SPDMASK	 0x00000700
+
+#define RGMII_MII2_100MB	 RGMII_SP2_100 & ~RGMII_SP2_1000
+#define RGMII_MII2_1000MB 	 RGMII_SP2_1000 & ~RGMII_SP2_100
+#define RGMII_MII2_10MB		 ~(RGMII_SP2_100 | RGMII_SP2_1000)
+#define RGMII_MII3_100MB	 RGMII_SP3_100 & ~RGMII_SP3_1000
+#define RGMII_MII3_1000MB 	 RGMII_SP3_1000 & ~RGMII_SP3_100
+#define RGMII_MII3_10MB		 ~(RGMII_SP3_100 | RGMII_SP3_1000)
+
+#define RTBI		0
+#define RGMII		1
+#define TBI		2
+#define GMII		3
+
+#endif				/* _IBM_EMAC_RGMII_H_ */
diff -Nru a/drivers/net/ibm_emac/ibm_emac_tah.h b/drivers/net/ibm_emac/ibm_emac_tah.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_tah.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,48 @@
+/*
+ * Defines for the IBM TAH
+ *
+ * Copyright 2004 MontaVista Software, Inc.
+ * Matt Porter <mporter@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.
+ */
+
+#ifndef _IBM_EMAC_TAH_H
+#define _IBM_EMAC_TAH_H
+
+/* TAH */
+typedef struct tah_regs {
+	u32 tah_revid;
+	u32 pad[3];
+	u32 tah_mr;
+	u32 tah_ssr0;
+	u32 tah_ssr1;
+	u32 tah_ssr2;
+	u32 tah_ssr3;
+	u32 tah_ssr4;
+	u32 tah_ssr5;
+	u32 tah_tsr;
+} tah_t;
+
+/* TAH engine */
+#define TAH_MR_CVR			0x80000000
+#define TAH_MR_SR			0x40000000
+#define TAH_MR_ST_256			0x01000000
+#define TAH_MR_ST_512			0x02000000
+#define TAH_MR_ST_768			0x03000000
+#define TAH_MR_ST_1024			0x04000000
+#define TAH_MR_ST_1280			0x05000000
+#define TAH_MR_ST_1536			0x06000000
+#define TAH_MR_TFS_16KB			0x00000000
+#define TAH_MR_TFS_2KB			0x00200000
+#define TAH_MR_TFS_4KB			0x00400000
+#define TAH_MR_TFS_6KB			0x00600000
+#define TAH_MR_TFS_8KB			0x00800000
+#define TAH_MR_TFS_10KB			0x00a00000
+#define TAH_MR_DTFP			0x00100000
+#define TAH_MR_DIG			0x00080000
+
+#endif				/* _IBM_EMAC_TAH_H */
diff -Nru a/drivers/net/ibm_emac/ibm_emac_zmii.h b/drivers/net/ibm_emac/ibm_emac_zmii.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ibm_emac/ibm_emac_zmii.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,93 @@
+/*
+ * ocp_zmii.h
+ *
+ * Defines for the IBM ZMII bridge
+ *
+ *      Armin Kuster akuster@mvista.com
+ *      Dec, 2001
+ *
+ * Copyright 2001 MontaVista Softare 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 _IBM_EMAC_ZMII_H_
+#define _IBM_EMAC_ZMII_H_
+
+#include <linux/config.h>
+
+/* ZMII bridge registers */
+struct zmii_regs {
+	u32 fer;		/* Function enable reg */
+	u32 ssr;		/* Speed select reg */
+	u32 smiirs;		/* SMII status reg */
+};
+
+#define ZMII_INPUTS	4
+
+/* ZMII device */
+struct ibm_ocp_zmii {
+	struct zmii_regs *base;
+	int mode[ZMII_INPUTS];
+	int users;		/* number of EMACs using this ZMII bridge */
+};
+
+/* Fuctional Enable Reg */
+
+#define ZMII_FER_MASK(x)	(0xf0000000 >> (4*x))
+
+#define ZMII_MDI0	0x80000000
+#define ZMII_SMII0	0x40000000
+#define ZMII_RMII0	0x20000000
+#define ZMII_MII0	0x10000000
+#define ZMII_MDI1	0x08000000
+#define ZMII_SMII1	0x04000000
+#define ZMII_RMII1	0x02000000
+#define ZMII_MII1	0x01000000
+#define ZMII_MDI2	0x00800000
+#define ZMII_SMII2	0x00400000
+#define ZMII_RMII2	0x00200000
+#define ZMII_MII2	0x00100000
+#define ZMII_MDI3	0x00080000
+#define ZMII_SMII3	0x00040000
+#define ZMII_RMII3	0x00020000
+#define ZMII_MII3	0x00010000
+
+/* Speed Selection reg */
+
+#define ZMII_SCI0	0x40000000
+#define ZMII_FSS0	0x20000000
+#define ZMII_SP0	0x10000000
+#define ZMII_SCI1	0x04000000
+#define ZMII_FSS1	0x02000000
+#define ZMII_SP1	0x01000000
+#define ZMII_SCI2	0x00400000
+#define ZMII_FSS2	0x00200000
+#define ZMII_SP2	0x00100000
+#define ZMII_SCI3	0x00040000
+#define ZMII_FSS3	0x00020000
+#define ZMII_SP3	0x00010000
+
+#define ZMII_MII0_100MB	ZMII_SP0
+#define ZMII_MII0_10MB	~ZMII_SP0
+#define ZMII_MII1_100MB	ZMII_SP1
+#define ZMII_MII1_10MB	~ZMII_SP1
+#define ZMII_MII2_100MB	ZMII_SP2
+#define ZMII_MII2_10MB	~ZMII_SP2
+#define ZMII_MII3_100MB	ZMII_SP3
+#define ZMII_MII3_10MB	~ZMII_SP3
+
+/* SMII Status reg */
+
+#define ZMII_STS0 0xFF000000	/* EMAC0 smii status mask */
+#define ZMII_STS1 0x00FF0000	/* EMAC1 smii status mask */
+
+#define SMII	0
+#define RMII	1
+#define MII	2
+#define MDI	3
+
+#endif				/* _IBM_EMAC_ZMII_H_ */
diff -Nru a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
--- a/drivers/net/ibmlana.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/ibmlana.c	Tue Jun 15 22:20:37 2004
@@ -4,7 +4,8 @@
 This is an extension to the Linux operating system, and is covered by the
 same GNU General Public License that covers that work.
 
-Copyright 1999 by Alfred Arnold (alfred@ccac.rwth-aachen.de, aarnold@elsa.de)
+Copyright 1999 by Alfred Arnold (alfred@ccac.rwth-aachen.de,
+                                 alfred.arnold@lancom.de)
 
 This driver is based both on the SK_MCA driver, which is itself based on the
 SK_G16 and 3C523 driver.
diff -Nru a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
--- a/drivers/net/ibmveth.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/net/ibmveth.c	Tue Jun 15 22:20:35 2004
@@ -55,7 +55,6 @@
 #include <asm/iommu.h>
 #include <asm/vio.h>
 #include <asm/uaccess.h>
-#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 
 #include "ibmveth.h"
@@ -874,14 +873,14 @@
 	struct net_device *netdev;
 	struct ibmveth_adapter *adapter;
 
-	unsigned int *mac_addr_p;
+	unsigned char *mac_addr_p;
 	unsigned int *mcastFilterSize_p;
 
 
 	ibmveth_debug_printk_no_adapter("entering ibmveth_probe for UA 0x%x\n", 
 					dev->unit_address);
 
-	mac_addr_p = (unsigned int *) vio_get_attribute(dev, VETH_MAC_ADDR, 0);
+	mac_addr_p = (unsigned char *) vio_get_attribute(dev, VETH_MAC_ADDR, 0);
 	if(!mac_addr_p) {
 		ibmveth_error_printk("Can't find VETH_MAC_ADDR attribute\n");
 		return 0;
@@ -902,7 +901,7 @@
 
 	adapter = netdev->priv;
 	memset(adapter, 0, sizeof(adapter));
-	dev->driver_data = netdev;
+	dev->dev.driver_data = netdev;
 
 	adapter->vdev = dev;
 	adapter->netdev = netdev;
@@ -916,8 +915,8 @@
 		The RPA doc specifies that the first byte must be 10b, so 
 		we'll just look for it to solve this 8 vs. 6 byte field issue */
 
-	while (*((char*)mac_addr_p) != (char)(0x02))
-		((char*)mac_addr_p)++;
+	if ((*mac_addr_p & 0x3) != 0x02)
+		mac_addr_p += 2;
 
 	adapter->mac_addr = 0;
 	memcpy(&adapter->mac_addr, mac_addr_p, 6);
@@ -935,6 +934,7 @@
 	netdev->do_ioctl           = ibmveth_ioctl;
 	netdev->ethtool_ops           = &netdev_ethtool_ops;
 	netdev->change_mtu         = ibmveth_change_mtu;
+	SET_NETDEV_DEV(netdev, &dev->dev);
 
 	memcpy(&netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
 
@@ -971,7 +971,7 @@
 
 static int __devexit ibmveth_remove(struct vio_dev *dev)
 {
-	struct net_device *netdev = dev->driver_data;
+	struct net_device *netdev = dev->dev.driver_data;
 	struct ibmveth_adapter *adapter = netdev->priv;
 
 	unregister_netdev(netdev);
diff -Nru a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
--- a/drivers/net/ioc3-eth.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/ioc3-eth.c	Tue Jun 15 22:20:36 2004
@@ -1529,12 +1529,11 @@
 
 static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
 	struct ioc3_private *ip = netdev_priv(dev);
 	int rc;
 
 	spin_lock_irq(&ip->ioc3_lock);
-	rc = generic_mii_ioctl(&ip->mii, data, cmd, NULL);
+	rc = generic_mii_ioctl(&ip->mii, if_mii(rq), cmd, NULL);
 	spin_unlock_irq(&ip->ioc3_lock);
 
 	return rc;
diff -Nru a/drivers/net/irda/act200l-sir.c b/drivers/net/irda/act200l-sir.c
--- a/drivers/net/irda/act200l-sir.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/irda/act200l-sir.c	Tue Jun 15 22:20:38 2004
@@ -178,7 +178,7 @@
 	/* Write control bytes */
 	sirdev_raw_write(dev, control, 3);
 	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(MSECS_TO_JIFFIES(5));
+	schedule_timeout(msecs_to_jiffies(5));
 
 	/* Go back to normal mode */
 	sirdev_set_dtr_rts(dev, TRUE, TRUE);
diff -Nru a/drivers/net/irda/act200l.c b/drivers/net/irda/act200l.c
--- a/drivers/net/irda/act200l.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/irda/act200l.c	Tue Jun 15 22:20:40 2004
@@ -148,7 +148,7 @@
 			irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
 
 			/* Give reset 1 sec to finish */
-			ret = MSECS_TO_JIFFIES(1000);
+			ret = msecs_to_jiffies(1000);
 		}
 		break;
 	case IRDA_TASK_CHILD_WAIT:
@@ -187,7 +187,7 @@
 		/* Write control bytes */
 		self->write(self->dev, control, 3);
 		irda_task_next_state(task, IRDA_TASK_WAIT);
-		ret = MSECS_TO_JIFFIES(5);
+		ret = msecs_to_jiffies(5);
 		break;
 	case IRDA_TASK_WAIT:
 		/* Go back to normal mode */
@@ -237,14 +237,14 @@
 		self->set_dtr_rts(self->dev, TRUE, TRUE);
 
 		irda_task_next_state(task, IRDA_TASK_WAIT1);
-		ret = MSECS_TO_JIFFIES(50);
+		ret = msecs_to_jiffies(50);
 		break;
 	case IRDA_TASK_WAIT1:
 		/* Reset the dongle : set RTS low for 25 ms */
 		self->set_dtr_rts(self->dev, TRUE, FALSE);
 
 		irda_task_next_state(task, IRDA_TASK_WAIT2);
-		ret = MSECS_TO_JIFFIES(50);
+		ret = msecs_to_jiffies(50);
 		break;
 	case IRDA_TASK_WAIT2:
 		/* Clear DTR and set RTS to enter command mode */
@@ -253,7 +253,7 @@
 		/* Write control bytes */
 		self->write(self->dev, control, 9);
 		irda_task_next_state(task, IRDA_TASK_WAIT3);
-		ret = MSECS_TO_JIFFIES(15);
+		ret = msecs_to_jiffies(15);
 		break;
 	case IRDA_TASK_WAIT3:
 		/* Go back to normal mode */
diff -Nru a/drivers/net/irda/actisys.c b/drivers/net/irda/actisys.c
--- a/drivers/net/irda/actisys.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/irda/actisys.c	Tue Jun 15 22:21:05 2004
@@ -238,7 +238,7 @@
 		self->set_dtr_rts(self->dev, TRUE, TRUE);
 		
 		/* Sleep 50 ms to make sure capacitor is charged */
-		ret = MSECS_TO_JIFFIES(50);
+		ret = msecs_to_jiffies(50);
 		irda_task_next_state(task, IRDA_TASK_WAIT);
 		break;
 	case IRDA_TASK_WAIT:			
diff -Nru a/drivers/net/irda/girbil.c b/drivers/net/irda/girbil.c
--- a/drivers/net/irda/girbil.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/net/irda/girbil.c	Tue Jun 15 22:20:35 2004
@@ -119,7 +119,7 @@
 			irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
 
 			/* Give reset 1 sec to finish */
-			ret = MSECS_TO_JIFFIES(1000);
+			ret = msecs_to_jiffies(1000);
 		}
 		break;
 	case IRDA_TASK_CHILD_WAIT:
@@ -153,7 +153,7 @@
 		/* Write control bytes */
 		self->write(self->dev, control, 2);
 		irda_task_next_state(task, IRDA_TASK_WAIT);
-		ret = MSECS_TO_JIFFIES(100);
+		ret = msecs_to_jiffies(100);
 		break;
 	case IRDA_TASK_WAIT:
 		/* Go back to normal mode */
@@ -194,19 +194,19 @@
 		self->set_dtr_rts(self->dev, TRUE, FALSE);
 		irda_task_next_state(task, IRDA_TASK_WAIT1);
 		/* Sleep at least 5 ms */
-		ret = MSECS_TO_JIFFIES(20);
+		ret = msecs_to_jiffies(20);
 		break;
 	case IRDA_TASK_WAIT1:
 		/* Set DTR and clear RTS to enter command mode */
 		self->set_dtr_rts(self->dev, FALSE, TRUE);
 		irda_task_next_state(task, IRDA_TASK_WAIT2);
-		ret = MSECS_TO_JIFFIES(20);
+		ret = msecs_to_jiffies(20);
 		break;
 	case IRDA_TASK_WAIT2:
 		/* Write control byte */
 		self->write(self->dev, &control, 1);
 		irda_task_next_state(task, IRDA_TASK_WAIT3);
-		ret = MSECS_TO_JIFFIES(20);
+		ret = msecs_to_jiffies(20);
 		break;
 	case IRDA_TASK_WAIT3:
 		/* Go back to normal mode */
diff -Nru a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
--- a/drivers/net/irda/irda-usb.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/irda/irda-usb.c	Tue Jun 15 22:20:40 2004
@@ -268,7 +268,7 @@
                       speed_bulk_callback, self);
 	urb->transfer_buffer_length = USB_IRDA_HEADER;
 	urb->transfer_flags = URB_ASYNC_UNLINK;
-	urb->timeout = MSECS_TO_JIFFIES(100);
+	urb->timeout = msecs_to_jiffies(100);
 
 	/* Irq disabled -> GFP_ATOMIC */
 	if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
@@ -412,7 +412,7 @@
 	 * This is how the dongle will detect the end of packet - Jean II */
 	urb->transfer_flags |= URB_ZERO_PACKET;
 	/* Timeout need to be shorter than NET watchdog timer */
-	urb->timeout = MSECS_TO_JIFFIES(200);
+	urb->timeout = msecs_to_jiffies(200);
 
 	/* Generate min turn time. FIXME: can we do better than this? */
 	/* Trying to a turnaround time at this level is trying to measure
@@ -1311,7 +1311,7 @@
 		IU_REQ_GET_CLASS_DESC,
 		USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
 		0, intf->altsetting->desc.bInterfaceNumber, desc,
-		sizeof(*desc), MSECS_TO_JIFFIES(500));
+		sizeof(*desc), msecs_to_jiffies(500));
 	
 	IRDA_DEBUG(1, "%s(), ret=%d\n", __FUNCTION__, ret);
 	if (ret < sizeof(*desc)) {
@@ -1421,7 +1421,7 @@
 	}
 
 	/* Find our endpoints */
-	interface = &intf->altsetting[0];
+	interface = intf->cur_altsetting;
 	if(!irda_usb_parse_endpoints(self, interface->endpoint,
 				     interface->desc.bNumEndpoints)) {
 		ERROR("%s(), Bogus endpoints...\n", __FUNCTION__);
diff -Nru a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
--- a/drivers/net/irda/irport.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/irda/irport.c	Tue Jun 15 22:20:42 2004
@@ -452,7 +452,7 @@
 			task->state = IRDA_TASK_WAIT;
 
 			/* Try again later */
-			ret = MSECS_TO_JIFFIES(20);
+			ret = msecs_to_jiffies(20);
 			break;
 		}
 
@@ -474,7 +474,7 @@
 			irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
 
 			/* Give dongle 1 sec to finish */
-			ret = MSECS_TO_JIFFIES(1000);
+			ret = msecs_to_jiffies(1000);
 		} else
 			/* Child finished immediately */
 			irda_task_next_state(task, IRDA_TASK_CHILD_DONE);
diff -Nru a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
--- a/drivers/net/irda/irtty-sir.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/net/irda/irtty-sir.c	Tue Jun 15 22:20:35 2004
@@ -93,12 +93,12 @@
 	tty = priv->tty;
 	if (tty->driver->wait_until_sent) {
 		lock_kernel();
-		tty->driver->wait_until_sent(tty, MSECS_TO_JIFFIES(100));
+		tty->driver->wait_until_sent(tty, msecs_to_jiffies(100));
 		unlock_kernel();
 	}
 	else {
 		set_task_state(current, TASK_UNINTERRUPTIBLE);
-		schedule_timeout(MSECS_TO_JIFFIES(USBSERIAL_TX_DONE_DELAY));
+		schedule_timeout(msecs_to_jiffies(USBSERIAL_TX_DONE_DELAY));
 	}
 }
 
diff -Nru a/drivers/net/irda/ma600-sir.c b/drivers/net/irda/ma600-sir.c
--- a/drivers/net/irda/ma600-sir.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/irda/ma600-sir.c	Tue Jun 15 22:20:42 2004
@@ -192,7 +192,7 @@
 
 	/* Wait at least 10ms: fake wait_until_sent - 10 bits at 9600 baud*/
 	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(MSECS_TO_JIFFIES(15));		/* old ma600 uses 15ms */
+	schedule_timeout(msecs_to_jiffies(15));		/* old ma600 uses 15ms */
 
 #if 1
 	/* read-back of the control byte. ma600 is the first dongle driver
@@ -216,7 +216,7 @@
 
 	/* Wait at least 10ms */
 	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(MSECS_TO_JIFFIES(10));
+	schedule_timeout(msecs_to_jiffies(10));
 
 	/* dongle is now switched to the new speed */
 	dev->speed = speed;
@@ -246,12 +246,12 @@
 	/* Reset the dongle : set DTR low for 10 ms */
 	sirdev_set_dtr_rts(dev, FALSE, TRUE);
 	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(MSECS_TO_JIFFIES(10));
+	schedule_timeout(msecs_to_jiffies(10));
 
 	/* Go back to normal mode */
 	sirdev_set_dtr_rts(dev, TRUE, TRUE);
 	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(MSECS_TO_JIFFIES(10));
+	schedule_timeout(msecs_to_jiffies(10));
 
 	dev->speed = 9600;      /* That's the dongle-default */
 
diff -Nru a/drivers/net/irda/ma600.c b/drivers/net/irda/ma600.c
--- a/drivers/net/irda/ma600.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/irda/ma600.c	Tue Jun 15 22:20:40 2004
@@ -184,7 +184,7 @@
 
 	if (self->speed_task && self->speed_task != task) {
 		IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__);
-		return MSECS_TO_JIFFIES(10);
+		return msecs_to_jiffies(10);
 	} else {
 		self->speed_task = task;
 	}
@@ -202,7 +202,7 @@
 			irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
 	
 			/* give 1 second to finish */
-			ret = MSECS_TO_JIFFIES(1000);
+			ret = msecs_to_jiffies(1000);
 		} else {
 			irda_task_next_state(task, IRDA_TASK_CHILD_DONE);
 		}
@@ -217,7 +217,7 @@
 		/* Set DTR, Clear RTS */
 		self->set_dtr_rts(self->dev, TRUE, FALSE);
 	
-		ret = MSECS_TO_JIFFIES(1);		/* Sleep 1 ms */
+		ret = msecs_to_jiffies(1);		/* Sleep 1 ms */
 		irda_task_next_state(task, IRDA_TASK_WAIT);
 		break;
 
@@ -231,7 +231,7 @@
 		irda_task_next_state(task, IRDA_TASK_WAIT1);
 
 		/* Wait at least 10 ms */
-		ret = MSECS_TO_JIFFIES(15);
+		ret = msecs_to_jiffies(15);
 		break;
 
 	case IRDA_TASK_WAIT1:
@@ -258,7 +258,7 @@
 		irda_task_next_state(task, IRDA_TASK_WAIT2);
 
 		/* Wait at least 10 ms */
-		ret = MSECS_TO_JIFFIES(10);
+		ret = msecs_to_jiffies(10);
 		break;
 
 	case IRDA_TASK_WAIT2:
@@ -298,7 +298,7 @@
 
 	if (self->reset_task && self->reset_task != task) {
 		IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__);
-		return MSECS_TO_JIFFIES(10);
+		return msecs_to_jiffies(10);
 	} else
 		self->reset_task = task;
 	
@@ -307,13 +307,13 @@
 		/* Clear DTR and Set RTS */
 		self->set_dtr_rts(self->dev, FALSE, TRUE);
 		irda_task_next_state(task, IRDA_TASK_WAIT1);
-		ret = MSECS_TO_JIFFIES(10);		/* Sleep 10 ms */
+		ret = msecs_to_jiffies(10);		/* Sleep 10 ms */
 		break;
 	case IRDA_TASK_WAIT1:
 		/* Set DTR and RTS */
 		self->set_dtr_rts(self->dev, TRUE, TRUE);
 		irda_task_next_state(task, IRDA_TASK_WAIT2);
-		ret = MSECS_TO_JIFFIES(10);		/* Sleep 10 ms */
+		ret = msecs_to_jiffies(10);		/* Sleep 10 ms */
 		break;
 	case IRDA_TASK_WAIT2:
 		irda_task_next_state(task, IRDA_TASK_DONE);
diff -Nru a/drivers/net/irda/mcp2120.c b/drivers/net/irda/mcp2120.c
--- a/drivers/net/irda/mcp2120.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/irda/mcp2120.c	Tue Jun 15 22:21:03 2004
@@ -99,7 +99,7 @@
 			irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
 
 			/* Give reset 1 sec to finish */
-			ret = MSECS_TO_JIFFIES(1000);
+			ret = msecs_to_jiffies(1000);
 		}
 		break;
 	case IRDA_TASK_CHILD_WAIT:
@@ -140,7 +140,7 @@
                 self->write(self->dev, control, 2);
  
                 irda_task_next_state(task, IRDA_TASK_WAIT);
-		ret = MSECS_TO_JIFFIES(100);
+		ret = msecs_to_jiffies(100);
                 //printk("mcp2120_change_speed irda_child_done\n");
 		break;
 	case IRDA_TASK_WAIT:
@@ -189,14 +189,14 @@
 		/* Reset dongle by setting RTS*/
 		self->set_dtr_rts(self->dev, TRUE, TRUE);
 		irda_task_next_state(task, IRDA_TASK_WAIT1);
-		ret = MSECS_TO_JIFFIES(50);
+		ret = msecs_to_jiffies(50);
 		break;
 	case IRDA_TASK_WAIT1:
                 //printk("mcp2120_reset irda_task_wait1\n");
                 /* clear RTS and wait for at least 30 ms. */
 		self->set_dtr_rts(self->dev, FALSE, FALSE);
 		irda_task_next_state(task, IRDA_TASK_WAIT2);
-		ret = MSECS_TO_JIFFIES(50);
+		ret = msecs_to_jiffies(50);
 		break;
 	case IRDA_TASK_WAIT2:
                 //printk("mcp2120_reset irda_task_wait2\n");
diff -Nru a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
--- a/drivers/net/irda/sir_dev.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/irda/sir_dev.c	Tue Jun 15 22:20:42 2004
@@ -74,7 +74,7 @@
 	while (dev->tx_buff.len > 0) {			/* wait until tx idle */
 		spin_unlock_irqrestore(&dev->tx_lock, flags);
 		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(MSECS_TO_JIFFIES(10));
+		schedule_timeout(msecs_to_jiffies(10));
 		spin_lock_irqsave(&dev->tx_lock, flags);
 	}
 
@@ -163,10 +163,8 @@
 			}
 			dev->tx_buff.len = 0;
 		}
-		if (dev->tx_buff.len > 0) {
-			spin_unlock_irqrestore(&dev->tx_lock, flags);
-			return;
-		}
+		if (dev->tx_buff.len > 0)
+			goto done;	/* more data to send later */
 	}
 
 	if (unlikely(dev->raw_tx != 0)) {
@@ -179,7 +177,7 @@
 
 		IRDA_DEBUG(3, "%s(), raw-tx done\n", __FUNCTION__);
 		dev->raw_tx = 0;
-		return;
+		goto done;	/* no post-frame handling in raw mode */
 	}
 
 	/* we have finished now sending this skb.
@@ -224,6 +222,7 @@
 		netif_wake_queue(dev->netdev);
 	}
 
+done:
 	spin_unlock_irqrestore(&dev->tx_lock, flags);
 }
 
diff -Nru a/drivers/net/irda/sir_kthread.c b/drivers/net/irda/sir_kthread.c
--- a/drivers/net/irda/sir_kthread.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/net/irda/sir_kthread.c	Tue Jun 15 22:20:43 2004
@@ -415,7 +415,7 @@
 		fsm->state = next_state;
 	} while(!delay);
 
-	irda_queue_delayed_request(&fsm->rq, MSECS_TO_JIFFIES(delay));
+	irda_queue_delayed_request(&fsm->rq, msecs_to_jiffies(delay));
 }
 
 /* schedule some device configuration task for execution by kIrDAd
diff -Nru a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
--- a/drivers/net/irda/stir4200.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/irda/stir4200.c	Tue Jun 15 22:20:38 2004
@@ -48,6 +48,7 @@
 #include <linux/netdevice.h>
 #include <linux/suspend.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
 #include <linux/usb.h>
 #include <linux/crc32.h>
 #include <net/irda/irda.h>
@@ -208,7 +209,7 @@
 			       REQ_WRITE_SINGLE,
 			       USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_DEVICE,
 			       value, reg, NULL, 0,
-			       MSECS_TO_JIFFIES(CTRL_TIMEOUT));
+			       msecs_to_jiffies(CTRL_TIMEOUT));
 }
 
 /* Send control message to read multiple registers */
@@ -221,7 +222,7 @@
 			       REQ_READ_REG,
 			       USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			       0, reg, data, count,
-			       MSECS_TO_JIFFIES(CTRL_TIMEOUT));
+			       msecs_to_jiffies(CTRL_TIMEOUT));
 }
 
 static inline int isfir(u32 speed)
@@ -652,7 +653,7 @@
 			return 0;
 
 		/* estimate transfer time for remaining chars */
-		wait_ms((count * 8000) / stir->speed);
+		msleep((count * 8000) / stir->speed);
 	}
 			
 	err = write_reg(stir, REG_FIFOCTL, FIFOCTL_CLR);
@@ -745,7 +746,7 @@
 
 	if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1),
 			 stir->io_buf, wraplen,
-			 NULL, MSECS_TO_JIFFIES(TRANSMIT_TIMEOUT))) 
+			 NULL, msecs_to_jiffies(TRANSMIT_TIMEOUT)))
 		stir->stats.tx_errors++;
 }
 
@@ -810,7 +811,7 @@
 					info("%s: receive usb submit failed",
 					     stir->netdev->name);
 				stir->receiving = 0;
-				wait_ms(10);
+				msleep(10);
 				continue;
 			}
 		}
diff -Nru a/drivers/net/irda/tekram-sir.c b/drivers/net/irda/tekram-sir.c
--- a/drivers/net/irda/tekram-sir.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/irda/tekram-sir.c	Tue Jun 15 22:20:38 2004
@@ -211,7 +211,7 @@
 
 	/* Should sleep 1 ms */
 	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(MSECS_TO_JIFFIES(1));
+	schedule_timeout(msecs_to_jiffies(1));
 
 	/* Set DTR, Set RTS */
 	sirdev_set_dtr_rts(dev, TRUE, TRUE);
diff -Nru a/drivers/net/irda/tekram.c b/drivers/net/irda/tekram.c
--- a/drivers/net/irda/tekram.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/irda/tekram.c	Tue Jun 15 22:20:41 2004
@@ -113,7 +113,7 @@
 
 	if (self->speed_task && self->speed_task != task) {
 		IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__ );
-		return MSECS_TO_JIFFIES(10);
+		return msecs_to_jiffies(10);
 	} else
 		self->speed_task = task;
 
@@ -150,7 +150,7 @@
 			irda_task_next_state(task, IRDA_TASK_CHILD_WAIT);
 
 			/* Give reset 1 sec to finish */
-			ret = MSECS_TO_JIFFIES(1000);
+			ret = msecs_to_jiffies(1000);
 		} else
 			irda_task_next_state(task, IRDA_TASK_CHILD_DONE);
 		break;
@@ -171,7 +171,7 @@
 		irda_task_next_state(task, IRDA_TASK_WAIT);
 
 		/* Wait at least 100 ms */
-		ret = MSECS_TO_JIFFIES(150);
+		ret = msecs_to_jiffies(150);
 		break;
 	case IRDA_TASK_WAIT:
 		/* Set DTR, Set RTS */
@@ -214,7 +214,7 @@
 
 	if (self->reset_task && self->reset_task != task) {
 		IRDA_DEBUG(0, "%s(), busy!\n", __FUNCTION__ );
-		return MSECS_TO_JIFFIES(10);
+		return msecs_to_jiffies(10);
 	} else
 		self->reset_task = task;
 	
@@ -227,7 +227,7 @@
 		irda_task_next_state(task, IRDA_TASK_WAIT1);
 
 		/* Sleep 50 ms */
-		ret = MSECS_TO_JIFFIES(50);
+		ret = msecs_to_jiffies(50);
 		break;
 	case IRDA_TASK_WAIT1:
 		/* Clear DTR, Set RTS */
@@ -236,7 +236,7 @@
 		irda_task_next_state(task, IRDA_TASK_WAIT2);
 		
 		/* Should sleep 1 ms */
-		ret = MSECS_TO_JIFFIES(1);
+		ret = msecs_to_jiffies(1);
 		break;
 	case IRDA_TASK_WAIT2:
 		/* Set DTR, Set RTS */
diff -Nru a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
--- a/drivers/net/iseries_veth.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/iseries_veth.c	Tue Jun 15 22:20:41 2004
@@ -461,6 +461,11 @@
 		if (cnx->msgs)
 			for (i = 0; i < VETH_NUMBUFFERS; ++i)
 				veth_recycle_msg(cnx, cnx->msgs + i);
+		spin_unlock_irq(&cnx->lock);
+		veth_flush_pending(cnx);
+		spin_lock_irq(&cnx->lock);
+		if (cnx->state & VETH_STATE_RESET)
+			goto restart;
 	}
 
 	if (cnx->state & VETH_STATE_SHUTDOWN)
@@ -796,6 +801,48 @@
 	return -EOPNOTSUPP;
 }
 
+static void veth_tx_timeout(struct net_device *dev)
+{
+	struct veth_port *port = (struct veth_port *)dev->priv;
+	struct net_device_stats *stats = &port->stats;
+	unsigned long flags;
+	int i;
+
+	stats->tx_errors++;
+
+	spin_lock_irqsave(&port->pending_gate, flags);
+
+	printk(KERN_WARNING "%s: Tx timeout!  Resetting lp connections: %08x\n",
+	       dev->name, port->pending_lpmask);
+
+	/* If we've timed out the queue must be stopped, which should
+	 * only ever happen when there is a pending packet. */
+	WARN_ON(! port->pending_lpmask);
+
+	for (i = 0; i < HVMAXARCHITECTEDLPS; i++) {
+		struct veth_lpar_connection *cnx = veth_cnx[i];
+
+		if (! (port->pending_lpmask & (1<<i)))
+			continue;
+
+		/* If we're pending on it, we must be connected to it,
+		 * so we should certainly have a structure for it. */
+		BUG_ON(! cnx);
+
+		/* Theoretically we could be kicking a connection
+		 * which doesn't deserve it, but in practice if we've
+		 * had a Tx timeout, the pending_lpmask will have
+		 * exactly one bit set - the connection causing the
+		 * problem. */
+		spin_lock(&cnx->lock);
+		cnx->state |= VETH_STATE_RESET;
+		veth_kick_statemachine(cnx);
+		spin_unlock(&cnx->lock);
+	}
+
+	spin_unlock_irqrestore(&port->pending_gate, flags);
+}
+
 struct net_device * __init veth_probe_one(int vlan)
 {
 	struct net_device *dev;
@@ -843,6 +890,9 @@
 	dev->set_multicast_list = veth_set_multicast_list;
 	dev->do_ioctl = veth_ioctl;
 
+	dev->watchdog_timeo = 2 * (VETH_ACKTIMEOUT * HZ / 1000000);
+	dev->tx_timeout = veth_tx_timeout;
+
 	rc = register_netdev(dev);
 	if (rc != 0) {
 		veth_printk(KERN_ERR,
@@ -938,19 +988,10 @@
 	int rc;
 
 	for (i = 0; i < HVMAXARCHITECTEDLPS; i++) {
-		struct sk_buff *clone;
-
-		if (! lpmask & (1<<i))
+		if ((lpmask & (1 << i)) == 0)
 			continue;
 
-		clone = skb_clone(skb, GFP_ATOMIC);
-		if (! clone) {
-			veth_error("%s: skb_clone failed %p\n",
-				   dev->name, skb);
-			continue;
-		}
-
-		rc = veth_transmit_to_one(clone, i, dev);
+		rc = veth_transmit_to_one(skb_get(skb), i, dev);
 		if (! rc)
 			lpmask &= ~(1<<i);
 	}
@@ -984,26 +1025,28 @@
 		lpmask = port->lpar_map;
 	}
 
+	spin_lock_irqsave(&port->pending_gate, flags);
+
 	lpmask = veth_transmit_to_many(skb, lpmask, dev);
 
 	if (! lpmask) {
 		dev_kfree_skb(skb);
 	} else {
-		spin_lock_irqsave(&port->pending_gate, flags);
 		if (port->pending_skb) {
 			veth_error("%s: Tx while skb was pending!\n",
 				   dev->name);
 			dev_kfree_skb(skb);
+			spin_unlock_irqrestore(&port->pending_gate, flags);
 			return 1;
 		}
 
 		port->pending_skb = skb;
 		port->pending_lpmask = lpmask;
 		netif_stop_queue(dev);
-
-		spin_unlock_irqrestore(&port->pending_gate, flags);
 	}
 
+	spin_unlock_irqrestore(&port->pending_gate, flags);
+
 	return 0;
 }
 
@@ -1057,7 +1100,7 @@
 			if (! port->pending_lpmask) {
 				dev_kfree_skb_any(port->pending_skb);
 				port->pending_skb = NULL;
-				netif_start_queue(dev);
+				netif_wake_queue(dev);
 			}
 		}
 		spin_unlock_irqrestore(&port->pending_gate, flags);
diff -Nru a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
--- a/drivers/net/ixgb/ixgb.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/ixgb/ixgb.h	Tue Jun 15 22:20:39 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,6 +23,7 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
 #ifndef _IXGB_H_
@@ -34,39 +35,44 @@
 #include <linux/types.h>
 #include <asm/byteorder.h>
 #include <linux/init.h>
+#include <linux/mm.h>
+#include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
+#include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/delay.h>
 #include <linux/timer.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
 #include <linux/string.h>
 #include <linux/pagemap.h>
 #include <linux/dma-mapping.h>
-#include <linux/bitops.h>
+#include <asm/bitops.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <linux/capability.h>
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/tcp.h>
 #include <linux/udp.h>
 #include <net/pkt_sched.h>
 #include <linux/list.h>
-#include <linux/workqueue.h>
 #include <linux/reboot.h>
 #ifdef NETIF_F_TSO
 #include <net/checksum.h>
 #endif
 
-/* ethtool support */
 #include <linux/ethtool.h>
 #include <linux/if_vlan.h>
 
-struct ixgb_adapter;
-
-#define BAR_0           0
-#define BAR_1           1
-#define BAR_5           5
+#define BAR_0		0
+#define BAR_1		1
+#define BAR_5		5
 
+struct ixgb_adapter;
 #include "ixgb_hw.h"
 #include "ixgb_ee.h"
 #include "ixgb_ids.h"
@@ -89,7 +95,7 @@
 #define IXGB_TX_QUEUE_WAKE 16
 
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
-#define IXGB_RX_BUFFER_WRITE    16
+#define IXGB_RX_BUFFER_WRITE	16	/* Must be power of 2 */
 
 /* only works for sizes that are powers of 2 */
 #define IXGB_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
@@ -101,71 +107,66 @@
 	uint64_t dma;
 	unsigned long length;
 	unsigned long time_stamp;
+	unsigned int next_to_watch;
 };
 
 struct ixgb_desc_ring {
-	/* pointer to the descriptor ring memory  */
+	/* pointer to the descriptor ring memory */
 	void *desc;
-	/* physical address of the descriptor ring  */
+	/* physical address of the descriptor ring */
 	dma_addr_t dma;
-	/* length of descriptor ring in bytes  */
+	/* length of descriptor ring in bytes */
 	unsigned int size;
-	/* number of descriptors in the ring  */
+	/* number of descriptors in the ring */
 	unsigned int count;
-	/* next descriptor to associate a buffer with  */
+	/* next descriptor to associate a buffer with */
 	unsigned int next_to_use;
-	/* next descriptor to check for DD status bit  */
+	/* next descriptor to check for DD status bit */
 	unsigned int next_to_clean;
-	/* array of buffer information structs  */
+	/* array of buffer information structs */
 	struct ixgb_buffer *buffer_info;
 };
 
 #define IXGB_DESC_UNUSED(R) \
-((((R)->next_to_clean + (R)->count) - ((R)->next_to_use + 1)) % ((R)->count))
+	((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
+	(R)->next_to_clean - (R)->next_to_use - 1)
 
-#define IXGB_GET_DESC(R, i, type)       (&(((struct type *)((R).desc))[i]))
-#define IXGB_RX_DESC(R, i)              IXGB_GET_DESC(R, i, ixgb_rx_desc)
-#define IXGB_TX_DESC(R, i)              IXGB_GET_DESC(R, i, ixgb_tx_desc)
-#define IXGB_CONTEXT_DESC(R, i)         IXGB_GET_DESC(R, i, ixgb_context_desc)
+#define IXGB_GET_DESC(R, i, type)	(&(((struct type *)((R).desc))[i]))
+#define IXGB_RX_DESC(R, i)		IXGB_GET_DESC(R, i, ixgb_rx_desc)
+#define IXGB_TX_DESC(R, i)		IXGB_GET_DESC(R, i, ixgb_tx_desc)
+#define IXGB_CONTEXT_DESC(R, i)	IXGB_GET_DESC(R, i, ixgb_context_desc)
 
 /* board specific private data structure */
 
 struct ixgb_adapter {
 	struct timer_list watchdog_timer;
 	struct vlan_group *vlgrp;
-	char *id_string;
-	u32 bd_number;
-	u32 rx_buffer_len;
-	u32 part_num;
-	u16 link_speed;
-	u16 link_duplex;
+	uint32_t bd_number;
+	uint32_t rx_buffer_len;
+	uint32_t part_num;
+	uint16_t link_speed;
+	uint16_t link_duplex;
+	spinlock_t tx_lock;
 	atomic_t irq_sem;
 	struct work_struct tx_timeout_task;
 
-#ifdef ETHTOOL_PHYS_ID
 	struct timer_list blink_timer;
 	unsigned long led_status;
-#endif
-#ifdef _INTERNAL_LOOPBACK_DRIVER_
-	struct ixgb_desc_ring diag_tx_ring;
-	struct ixgb_desc_ring diag_rx_ring;
-#endif
+
 	/* TX */
 	struct ixgb_desc_ring tx_ring;
 	unsigned long timeo_start;
-	u32 tx_cmd_type;
-	int max_data_per_txd;
+	uint32_t tx_cmd_type;
 	uint64_t hw_csum_tx_good;
 	uint64_t hw_csum_tx_error;
-	boolean_t tx_csum;
-	u32 tx_int_delay;
+	uint32_t tx_int_delay;
 	boolean_t tx_int_delay_enable;
 
 	/* RX */
 	struct ixgb_desc_ring rx_ring;
 	uint64_t hw_csum_rx_error;
 	uint64_t hw_csum_rx_good;
-	u32 rx_int_delay;
+	uint32_t rx_int_delay;
 	boolean_t raidc;
 	boolean_t rx_csum;
 
@@ -177,8 +178,6 @@
 	/* structs defined in ixgb_hw.h */
 	struct ixgb_hw hw;
 	struct ixgb_hw_stats stats;
-	u32 pci_state[16];
-	char ifname[IFNAMSIZ];
+	uint32_t pci_state[16];
 };
-
 #endif				/* _IXGB_H_ */
diff -Nru a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
--- a/drivers/net/ixgb/ixgb_ee.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/ixgb/ixgb_ee.c	Tue Jun 15 22:20:39 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,15 +23,16 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
 #include "ixgb_hw.h"
 #include "ixgb_ee.h"
 /* Local prototypes */
-static u16 ixgb_shift_in_bits(struct ixgb_hw *hw);
+static uint16_t ixgb_shift_in_bits(struct ixgb_hw *hw);
 
 static void ixgb_shift_out_bits(struct ixgb_hw *hw,
-				u16 data, u16 count);
+				uint16_t data, uint16_t count);
 static void ixgb_standby_eeprom(struct ixgb_hw *hw);
 
 static boolean_t ixgb_wait_eeprom_command(struct ixgb_hw *hw);
@@ -44,8 +45,7 @@
  * hw - Struct containing variables accessed by shared code
  * eecd_reg - EECD's current value
  *****************************************************************************/
-static void
-ixgb_raise_clock(struct ixgb_hw *hw, u32 * eecd_reg)
+static void ixgb_raise_clock(struct ixgb_hw *hw, uint32_t * eecd_reg)
 {
 	/* Raise the clock input to the EEPROM (by setting the SK bit), and then
 	 *  wait 50 microseconds.
@@ -59,14 +59,13 @@
 /******************************************************************************
  * Lowers the EEPROM's clock input.
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  * eecd_reg - EECD's current value
  *****************************************************************************/
-static void
-ixgb_lower_clock(struct ixgb_hw *hw, u32 * eecd_reg)
+static void ixgb_lower_clock(struct ixgb_hw *hw, uint32_t * eecd_reg)
 {
-	/* Lower the clock input to the EEPROM (by clearing the SK bit), and then 
-	 * wait 50 microseconds. 
+	/* Lower the clock input to the EEPROM (by clearing the SK bit), and then
+	 * wait 50 microseconds.
 	 */
 	*eecd_reg = *eecd_reg & ~IXGB_EECD_SK;
 	IXGB_WRITE_REG(hw, EECD, *eecd_reg);
@@ -82,14 +81,14 @@
  * count - number of bits to shift out
  *****************************************************************************/
 static void
-ixgb_shift_out_bits(struct ixgb_hw *hw, u16 data, u16 count)
+ixgb_shift_out_bits(struct ixgb_hw *hw, uint16_t data, uint16_t count)
 {
-	u32 eecd_reg;
-	u32 mask;
+	uint32_t eecd_reg;
+	uint32_t mask;
 
 	/* We need to shift "count" bits out to the EEPROM. So, value in the
 	 * "data" parameter will be shifted out to the EEPROM one bit at a time.
-	 * In order to do this, "data" must be broken down into bits. 
+	 * In order to do this, "data" must be broken down into bits.
 	 */
 	mask = 0x01 << (count - 1);
 	eecd_reg = IXGB_READ_REG(hw, EECD);
@@ -127,17 +126,16 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-static u16
-ixgb_shift_in_bits(struct ixgb_hw *hw)
+static uint16_t ixgb_shift_in_bits(struct ixgb_hw *hw)
 {
-	u32 eecd_reg;
-	u32 i;
-	u16 data;
+	uint32_t eecd_reg;
+	uint32_t i;
+	uint16_t data;
 
-	/* In order to read a register from the EEPROM, we need to shift 16 bits 
+	/* In order to read a register from the EEPROM, we need to shift 16 bits
 	 * in from the EEPROM. Bits are "shifted in" by raising the clock input to
 	 * the EEPROM (setting the SK bit), and then reading the value of the "DO"
-	 * bit.  During this "shifting in" process the "DI" bit should always be 
+	 * bit.  During this "shifting in" process the "DI" bit should always be
 	 * clear..
 	 */
 
@@ -167,13 +165,12 @@
  *
  * hw - Struct containing variables accessed by shared code
  *
- * Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This 
+ * Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This
  * function should be called before issuing a command to the EEPROM.
  *****************************************************************************/
-static void
-ixgb_setup_eeprom(struct ixgb_hw *hw)
+static void ixgb_setup_eeprom(struct ixgb_hw *hw)
 {
-	u32 eecd_reg;
+	uint32_t eecd_reg;
 
 	eecd_reg = IXGB_READ_REG(hw, EECD);
 
@@ -189,13 +186,12 @@
 
 /******************************************************************************
  * Returns EEPROM to a "standby" state
- * 
+ *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-static void
-ixgb_standby_eeprom(struct ixgb_hw *hw)
+static void ixgb_standby_eeprom(struct ixgb_hw *hw)
 {
-	u32 eecd_reg;
+	uint32_t eecd_reg;
 
 	eecd_reg = IXGB_READ_REG(hw, EECD);
 
@@ -226,10 +222,9 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-static void
-ixgb_clock_eeprom(struct ixgb_hw *hw)
+static void ixgb_clock_eeprom(struct ixgb_hw *hw)
 {
-	u32 eecd_reg;
+	uint32_t eecd_reg;
 
 	eecd_reg = IXGB_READ_REG(hw, EECD);
 
@@ -250,10 +245,9 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-static void
-ixgb_cleanup_eeprom(struct ixgb_hw *hw)
+static void ixgb_cleanup_eeprom(struct ixgb_hw *hw)
 {
-	u32 eecd_reg;
+	uint32_t eecd_reg;
 
 	eecd_reg = IXGB_READ_REG(hw, EECD);
 
@@ -271,18 +265,17 @@
  * hw - Struct containing variables accessed by shared code
  *
  * The command is done when the EEPROM's data out pin goes high.
- * 
+ *
  * Returns:
  *      TRUE: EEPROM data pin is high before timeout.
  *      FALSE:  Time expired.
  *****************************************************************************/
-static boolean_t
-ixgb_wait_eeprom_command(struct ixgb_hw *hw)
+static boolean_t ixgb_wait_eeprom_command(struct ixgb_hw *hw)
 {
-	u32 eecd_reg;
-	u32 i;
+	uint32_t eecd_reg;
+	uint32_t i;
 
-	/* Toggle the CS line.  This in effect tells to EEPROM to actually execute 
+	/* Toggle the CS line.  This in effect tells to EEPROM to actually execute
 	 * the command in question.
 	 */
 	ixgb_standby_eeprom(hw);
@@ -305,7 +298,7 @@
 
 /******************************************************************************
  * Verifies that the EEPROM has a valid checksum
- * 
+ *
  * hw - Struct containing variables accessed by shared code
  *
  * Reads the first 64 16 bit words of the EEPROM and sums the values read.
@@ -316,16 +309,15 @@
  *  TRUE: Checksum is valid
  *  FALSE: Checksum is not valid.
  *****************************************************************************/
-boolean_t
-ixgb_validate_eeprom_checksum(struct ixgb_hw * hw)
+boolean_t ixgb_validate_eeprom_checksum(struct ixgb_hw * hw)
 {
-	u16 checksum = 0;
-	u16 i;
+	uint16_t checksum = 0;
+	uint16_t i;
 
 	for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++)
 		checksum += ixgb_read_eeprom(hw, i);
 
-	if (checksum == (u16) EEPROM_SUM)
+	if (checksum == (uint16_t) EEPROM_SUM)
 		return (TRUE);
 	else
 		return (FALSE);
@@ -339,16 +331,15 @@
  * Sums the first 63 16 bit words of the EEPROM. Subtracts the sum from 0xBABA.
  * Writes the difference to word offset 63 of the EEPROM.
  *****************************************************************************/
-void
-ixgb_update_eeprom_checksum(struct ixgb_hw *hw)
+void ixgb_update_eeprom_checksum(struct ixgb_hw *hw)
 {
-	u16 checksum = 0;
-	u16 i;
+	uint16_t checksum = 0;
+	uint16_t i;
 
 	for (i = 0; i < EEPROM_CHECKSUM_REG; i++)
 		checksum += ixgb_read_eeprom(hw, i);
 
-	checksum = (u16) EEPROM_SUM - checksum;
+	checksum = (uint16_t) EEPROM_SUM - checksum;
 
 	ixgb_write_eeprom(hw, EEPROM_CHECKSUM_REG, checksum);
 	return;
@@ -361,18 +352,17 @@
  * reg - offset within the EEPROM to be written to
  * data - 16 bit word to be writen to the EEPROM
  *
- * If ixgb_update_eeprom_checksum is not called after this function, the 
+ * If ixgb_update_eeprom_checksum is not called after this function, the
  * EEPROM will most likely contain an invalid checksum.
  *
  *****************************************************************************/
-void
-ixgb_write_eeprom(struct ixgb_hw *hw, u16 offset, u16 data)
+void ixgb_write_eeprom(struct ixgb_hw *hw, uint16_t offset, uint16_t data)
 {
 	/*  Prepare the EEPROM for writing  */
 	ixgb_setup_eeprom(hw);
 
 	/*  Send the 9-bit EWEN (write enable) command to the EEPROM (5-bit opcode
-	 *  plus 4-bit dummy).  This puts the EEPROM into write/erase mode. 
+	 *  plus 4-bit dummy).  This puts the EEPROM into write/erase mode.
 	 */
 	ixgb_shift_out_bits(hw, EEPROM_EWEN_OPCODE, 5);
 	ixgb_shift_out_bits(hw, 0, 4);
@@ -414,17 +404,16 @@
  * Returns:
  *  The 16-bit value read from the eeprom
  *****************************************************************************/
-u16
-ixgb_read_eeprom(struct ixgb_hw * hw, u16 offset)
+uint16_t ixgb_read_eeprom(struct ixgb_hw * hw, uint16_t offset)
 {
-	u16 data;
+	uint16_t data;
 
 	/*  Prepare the EEPROM for reading  */
 	ixgb_setup_eeprom(hw);
 
 	/*  Send the READ command (opcode + addr)  */
 	ixgb_shift_out_bits(hw, EEPROM_READ_OPCODE, 3);
-	/* 
+	/*
 	 * We have a 64 word EEPROM, there are 6 address bits
 	 */
 	ixgb_shift_out_bits(hw, offset, 6);
@@ -442,32 +431,31 @@
  * Reads eeprom and stores data in shared structure.
  * Validates eeprom checksum and eeprom signature.
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
  * Returns:
  *      TRUE: if eeprom read is successful
  *      FALSE: otherwise.
  *****************************************************************************/
-boolean_t
-ixgb_get_eeprom_data(struct ixgb_hw * hw)
+boolean_t ixgb_get_eeprom_data(struct ixgb_hw * hw)
 {
-	u16 i;
-	u16 checksum = 0;
+	uint16_t i;
+	uint16_t checksum = 0;
 	struct ixgb_ee_map_type *ee_map;
 
 	DEBUGFUNC("ixgb_get_eeprom_data");
 
-	ee_map = (struct ixgb_ee_map_type *) hw->eeprom;
+	ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	DEBUGOUT("ixgb_ee: Reading eeprom data\n");
 	for (i = 0; i < IXGB_EEPROM_SIZE; i++) {
-		u16 ee_data;
+		uint16_t ee_data;
 		ee_data = ixgb_read_eeprom(hw, i);
 		checksum += ee_data;
 		hw->eeprom[i] = le16_to_cpu(ee_data);
 	}
 
-	if (checksum != (u16) EEPROM_SUM) {
+	if (checksum != (uint16_t) EEPROM_SUM) {
 		DEBUGOUT("ixgb_ee: Checksum invalid.\n");
 		return (FALSE);
 	}
@@ -485,17 +473,15 @@
  * Local function to check if the eeprom signature is good
  * If the eeprom signature is good, calls ixgb)get_eeprom_data.
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
  * Returns:
  *      TRUE: eeprom signature was good and the eeprom read was successful
  *      FALSE: otherwise.
  ******************************************************************************/
-static boolean_t
-ixgb_check_and_get_eeprom_data(struct ixgb_hw *hw)
+static boolean_t ixgb_check_and_get_eeprom_data(struct ixgb_hw *hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if ((ee_map->init_ctrl_reg_1 & le16_to_cpu(EEPROM_ICW1_SIGNATURE_MASK))
 	    == le16_to_cpu(EEPROM_ICW1_SIGNATURE_VALID)) {
@@ -506,19 +492,37 @@
 }
 
 /******************************************************************************
+ * return a word from the eeprom
+ *
+ * hw - Struct containing variables accessed by shared code
+ * index - Offset of eeprom word
+ *
+ * Returns:
+ *          Word at indexed offset in eeprom, if valid, 0 otherwise.
+ ******************************************************************************/
+uint16_t ixgb_get_eeprom_word(struct ixgb_hw * hw, uint16_t index)
+{
+
+	if ((index < IXGB_EEPROM_SIZE) &&
+	    (ixgb_check_and_get_eeprom_data(hw) == TRUE)) {
+		return (hw->eeprom[index]);
+	}
+
+	return (0);
+}
+
+/******************************************************************************
  * return the mac address from EEPROM
  *
- * hw       - Struct containing variables accessed by shared code 
+ * hw       - Struct containing variables accessed by shared code
  * mac_addr - Ethernet Address if EEPROM contents are valid, 0 otherwise
  *
  * Returns: None.
  ******************************************************************************/
-void
-ixgb_get_ee_mac_addr(struct ixgb_hw *hw, u8 * mac_addr)
+void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t * mac_addr)
 {
 	int i;
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	DEBUGFUNC("ixgb_get_ee_mac_addr");
 
@@ -533,16 +537,14 @@
 /******************************************************************************
  * return the compatibility flags from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          compatibility flags if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u16
-ixgb_get_ee_compatibility(struct ixgb_hw *hw)
+uint16_t ixgb_get_ee_compatibility(struct ixgb_hw *hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->compatibility);
@@ -553,13 +555,12 @@
 /******************************************************************************
  * return the Printed Board Assembly number from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          PBA number if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u32
-ixgb_get_ee_pba_number(struct ixgb_hw * hw)
+uint32_t ixgb_get_ee_pba_number(struct ixgb_hw * hw)
 {
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (le16_to_cpu(hw->eeprom[EEPROM_PBA_1_2_REG])
@@ -576,11 +577,9 @@
  * Returns:
  *          Initialization Control Word 1 if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u16
-ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw * hw)
+uint16_t ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->init_ctrl_reg_1);
@@ -591,16 +590,14 @@
 /******************************************************************************
  * return the Initialization Control Word 2 from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          Initialization Control Word 2 if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u16
-ixgb_get_ee_init_ctrl_reg_2(struct ixgb_hw * hw)
+uint16_t ixgb_get_ee_init_ctrl_reg_2(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->init_ctrl_reg_2);
@@ -611,16 +608,14 @@
 /******************************************************************************
  * return the Subsystem Id from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          Subsystem Id if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u16
-ixgb_get_ee_subsystem_id(struct ixgb_hw * hw)
+uint16_t ixgb_get_ee_subsystem_id(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->subsystem_id);
@@ -631,16 +626,14 @@
 /******************************************************************************
  * return the Sub Vendor Id from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          Sub Vendor Id if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u16
-ixgb_get_ee_subvendor_id(struct ixgb_hw * hw)
+uint16_t ixgb_get_ee_subvendor_id(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->subvendor_id);
@@ -651,16 +644,14 @@
 /******************************************************************************
  * return the Device Id from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          Device Id if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u16
-ixgb_get_ee_device_id(struct ixgb_hw * hw)
+uint16_t ixgb_get_ee_device_id(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->device_id);
@@ -671,16 +662,14 @@
 /******************************************************************************
  * return the Vendor Id from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          Device Id if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u16
-ixgb_get_ee_vendor_id(struct ixgb_hw * hw)
+uint16_t ixgb_get_ee_vendor_id(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->vendor_id);
@@ -691,16 +680,14 @@
 /******************************************************************************
  * return the Software Defined Pins Register from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          SDP Register if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u16
-ixgb_get_ee_swdpins_reg(struct ixgb_hw * hw)
+uint16_t ixgb_get_ee_swdpins_reg(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->swdpins_reg);
@@ -711,16 +698,14 @@
 /******************************************************************************
  * return the D3 Power Management Bits from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          D3 Power Management Bits if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u8
-ixgb_get_ee_d3_power(struct ixgb_hw * hw)
+uint8_t ixgb_get_ee_d3_power(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->d3_power);
@@ -731,16 +716,14 @@
 /******************************************************************************
  * return the D0 Power Management Bits from EEPROM
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
- * Returns: 
+ * Returns:
  *          D0 Power Management Bits if EEPROM contents are valid, 0 otherwise
  ******************************************************************************/
-u8
-ixgb_get_ee_d0_power(struct ixgb_hw * hw)
+uint8_t ixgb_get_ee_d0_power(struct ixgb_hw * hw)
 {
-	struct ixgb_ee_map_type *ee_map =
-	    (struct ixgb_ee_map_type *) hw->eeprom;
+	struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
 
 	if (ixgb_check_and_get_eeprom_data(hw) == TRUE)
 		return (ee_map->d0_power);
diff -Nru a/drivers/net/ixgb/ixgb_ee.h b/drivers/net/ixgb/ixgb_ee.h
--- a/drivers/net/ixgb/ixgb_ee.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/ixgb/ixgb_ee.h	Tue Jun 15 22:20:40 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,6 +23,7 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
 #ifndef _IXGB_EE_H_
@@ -33,9 +34,9 @@
 #define IXGB_ETH_LENGTH_OF_ADDRESS   6
 
 /* EEPROM Commands */
-#define EEPROM_READ_OPCODE  0x6		/* EERPOM read opcode */
-#define EEPROM_WRITE_OPCODE 0x5		/* EERPOM write opcode */
-#define EEPROM_ERASE_OPCODE 0x7		/* EERPOM erase opcode */
+#define EEPROM_READ_OPCODE  0x6	/* EERPOM read opcode */
+#define EEPROM_WRITE_OPCODE 0x5	/* EERPOM write opcode */
+#define EEPROM_ERASE_OPCODE 0x7	/* EERPOM erase opcode */
 #define EEPROM_EWEN_OPCODE  0x13	/* EERPOM erase/write enable */
 #define EEPROM_EWDS_OPCODE  0x10	/* EERPOM erast/write disable */
 
@@ -73,32 +74,32 @@
 
 /* EEPROM structure */
 struct ixgb_ee_map_type {
-	u8 mac_addr[IXGB_ETH_LENGTH_OF_ADDRESS];
-	u16 compatibility;
-	u16 reserved1[4];
-	u32 pba_number;
-	u16 init_ctrl_reg_1;
-	u16 subsystem_id;
-	u16 subvendor_id;
-	u16 device_id;
-	u16 vendor_id;
-	u16 init_ctrl_reg_2;
-	u16 oem_reserved[16];
-	u16 swdpins_reg;
-	u16 circuit_ctrl_reg;
-	u8 d3_power;
-	u8 d0_power;
-	u16 reserved2[28];
-	u16 checksum;
+	uint8_t mac_addr[IXGB_ETH_LENGTH_OF_ADDRESS];
+	uint16_t compatibility;
+	uint16_t reserved1[4];
+	uint32_t pba_number;
+	uint16_t init_ctrl_reg_1;
+	uint16_t subsystem_id;
+	uint16_t subvendor_id;
+	uint16_t device_id;
+	uint16_t vendor_id;
+	uint16_t init_ctrl_reg_2;
+	uint16_t oem_reserved[16];
+	uint16_t swdpins_reg;
+	uint16_t circuit_ctrl_reg;
+	uint8_t d3_power;
+	uint8_t d0_power;
+	uint16_t reserved2[28];
+	uint16_t checksum;
 };
 
 /* EEPROM Functions */
-u16 ixgb_read_eeprom(struct ixgb_hw *hw, u16 reg);
+uint16_t ixgb_read_eeprom(struct ixgb_hw *hw, uint16_t reg);
 
 boolean_t ixgb_validate_eeprom_checksum(struct ixgb_hw *hw);
 
 void ixgb_update_eeprom_checksum(struct ixgb_hw *hw);
 
-void ixgb_write_eeprom(struct ixgb_hw *hw, u16 reg, u16 data);
+void ixgb_write_eeprom(struct ixgb_hw *hw, uint16_t reg, uint16_t data);
 
 #endif				/* IXGB_EE_H */
diff -Nru a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
--- a/drivers/net/ixgb/ixgb_ethtool.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/net/ixgb/ixgb_ethtool.c	Tue Jun 15 22:20:58 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,6 +23,7 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
 /* ethtool support for ixgb */
@@ -35,22 +36,63 @@
 extern char ixgb_driver_version[];
 
 extern int ixgb_up(struct ixgb_adapter *adapter);
-extern int ixgb_down(struct ixgb_adapter *adapter);
-
-/**
- * ixgb_ethtool_ioctl - Ethtool Ioctl Support
- * @netdev: net device structure
- * @ifr: interface request structure
- **/
+extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
 
-static inline int
-ixgb_eeprom_size(struct ixgb_hw *hw)
+static inline int ixgb_eeprom_size(struct ixgb_hw *hw)
 {
 	/* return size in bytes */
 	return (IXGB_EEPROM_SIZE << 1);
 }
 
-#define SPEED_10000 10000
+struct ixgb_stats {
+	char stat_string[ETH_GSTRING_LEN];
+	int sizeof_stat;
+	int stat_offset;
+};
+
+#define IXGB_STAT(m) sizeof(((struct ixgb_adapter *)0)->m), \
+		      offsetof(struct ixgb_adapter, m)
+static struct ixgb_stats ixgb_gstrings_stats[] = {
+	{"rx_packets", IXGB_STAT(net_stats.rx_packets)},
+	{"tx_packets", IXGB_STAT(net_stats.tx_packets)},
+	{"rx_bytes", IXGB_STAT(net_stats.rx_bytes)},
+	{"tx_bytes", IXGB_STAT(net_stats.tx_bytes)},
+	{"rx_errors", IXGB_STAT(net_stats.rx_errors)},
+	{"tx_errors", IXGB_STAT(net_stats.tx_errors)},
+	{"rx_dropped", IXGB_STAT(net_stats.rx_dropped)},
+	{"tx_dropped", IXGB_STAT(net_stats.tx_dropped)},
+	{"multicast", IXGB_STAT(net_stats.multicast)},
+	{"collisions", IXGB_STAT(net_stats.collisions)},
+/*	{ "rx_length_errors", IXGB_STAT(net_stats.rx_length_errors) },	*/
+	{"rx_over_errors", IXGB_STAT(net_stats.rx_over_errors)},
+	{"rx_crc_errors", IXGB_STAT(net_stats.rx_crc_errors)},
+	{"rx_frame_errors", IXGB_STAT(net_stats.rx_frame_errors)},
+	{"rx_fifo_errors", IXGB_STAT(net_stats.rx_fifo_errors)},
+	{"rx_missed_errors", IXGB_STAT(net_stats.rx_missed_errors)},
+	{"tx_aborted_errors", IXGB_STAT(net_stats.tx_aborted_errors)},
+	{"tx_carrier_errors", IXGB_STAT(net_stats.tx_carrier_errors)},
+	{"tx_fifo_errors", IXGB_STAT(net_stats.tx_fifo_errors)},
+	{"tx_heartbeat_errors", IXGB_STAT(net_stats.tx_heartbeat_errors)},
+	{"tx_window_errors", IXGB_STAT(net_stats.tx_window_errors)},
+	{"tx_deferred_ok", IXGB_STAT(stats.dc)},
+	{"rx_long_length_errors", IXGB_STAT(stats.roc)},
+	{"rx_short_length_errors", IXGB_STAT(stats.ruc)},
+#ifdef NETIF_F_TSO
+	{"tx_tcp_seg_good", IXGB_STAT(stats.tsctc)},
+	{"tx_tcp_seg_failed", IXGB_STAT(stats.tsctfc)},
+#endif
+	{"rx_flow_control_xon", IXGB_STAT(stats.xonrxc)},
+	{"rx_flow_control_xoff", IXGB_STAT(stats.xoffrxc)},
+	{"tx_flow_control_xon", IXGB_STAT(stats.xontxc)},
+	{"tx_flow_control_xoff", IXGB_STAT(stats.xofftxc)},
+	{"rx_csum_offload_good", IXGB_STAT(hw_csum_rx_good)},
+	{"rx_csum_offload_errors", IXGB_STAT(hw_csum_rx_error)},
+	{"tx_csum_offload_good", IXGB_STAT(hw_csum_tx_good)},
+	{"tx_csum_offload_errors", IXGB_STAT(hw_csum_tx_error)}
+};
+
+#define IXGB_STATS_LEN	\
+	sizeof(ixgb_gstrings_stats) / sizeof(struct ixgb_stats)
 
 static void
 ixgb_ethtool_gset(struct ixgb_adapter *adapter, struct ethtool_cmd *ecmd)
@@ -61,7 +103,7 @@
 	ecmd->transceiver = XCVR_EXTERNAL;
 
 	if (netif_carrier_ok(adapter->netdev)) {
-		ecmd->speed = 10000;
+		ecmd->speed = SPEED_10000;
 		ecmd->duplex = DUPLEX_FULL;
 	} else {
 		ecmd->speed = -1;
@@ -78,64 +120,80 @@
 	    ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL)
 		return -EINVAL;
 	else {
-		ixgb_down(adapter);
+		ixgb_down(adapter, TRUE);
 		ixgb_up(adapter);
 	}
 
 	return 0;
 }
 
-#if 0
 static int
-ixgb_ethtool_promiscuous(struct ixgb_adapter *adapter,
-			 struct ethtool_pmode *pmode)
+ixgb_ethtool_gpause(struct ixgb_adapter *adapter,
+		    struct ethtool_pauseparam *epause)
 {
-	u32 rctl = IXGB_READ_REG(&adapter->hw, RCTL);
+	struct ixgb_hw *hw = &adapter->hw;
 
-	pmode->rctl_old = rctl;
-	if (pmode->upe)
-		rctl |= IXGB_RCTL_UPE;
-	else
-		rctl &= ~IXGB_RCTL_UPE;
+	epause->autoneg = AUTONEG_DISABLE;
 
-	if (pmode->mpe)
-		rctl |= IXGB_RCTL_MPE;
-	else
-		rctl &= ~IXGB_RCTL_MPE;
+	if (hw->fc.type == ixgb_fc_rx_pause)
+		epause->rx_pause = 1;
+	else if (hw->fc.type == ixgb_fc_tx_pause)
+		epause->tx_pause = 1;
+	else if (hw->fc.type == ixgb_fc_full) {
+		epause->rx_pause = 1;
+		epause->tx_pause = 1;
+	}
+
+	return 0;
+}
+
+static int
+ixgb_ethtool_spause(struct ixgb_adapter *adapter,
+		    struct ethtool_pauseparam *epause)
+{
+	struct ixgb_hw *hw = &adapter->hw;
+
+	if (epause->autoneg == AUTONEG_ENABLE)
+		return -EINVAL;
 
-	IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
+	if (epause->rx_pause && epause->tx_pause)
+		hw->fc.type = ixgb_fc_full;
+	else if (epause->rx_pause && !epause->tx_pause)
+		hw->fc.type = ixgb_fc_rx_pause;
+	else if (!epause->rx_pause && epause->tx_pause)
+		hw->fc.type = ixgb_fc_tx_pause;
+	else if (!epause->rx_pause && !epause->tx_pause)
+		hw->fc.type = ixgb_fc_none;
 
-	pmode->rctl_new = IXGB_READ_REG(&adapter->hw, RCTL);
+	ixgb_down(adapter, TRUE);
+	ixgb_up(adapter);
 
 	return 0;
 }
-#endif
 
-#define IXGB_REG_DUMP_LEN  136*sizeof(u32)
 static void
 ixgb_ethtool_gdrvinfo(struct ixgb_adapter *adapter,
 		      struct ethtool_drvinfo *drvinfo)
 {
 	strncpy(drvinfo->driver, ixgb_driver_name, 32);
 	strncpy(drvinfo->version, ixgb_driver_version, 32);
-	strncpy(drvinfo->fw_version, "", 32);
+	strncpy(drvinfo->fw_version, "N/A", 32);
 	strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
-#ifdef ETHTOOL_GREGS
+	drvinfo->n_stats = IXGB_STATS_LEN;
+#define IXGB_REG_DUMP_LEN  136*sizeof(uint32_t)
 	drvinfo->regdump_len = IXGB_REG_DUMP_LEN;
-#endif				/* ETHTOOL_GREGS */
 	drvinfo->eedump_len = ixgb_eeprom_size(&adapter->hw);
 }
 
-#ifdef  ETHTOOL_GREGS
 #define IXGB_GET_STAT(_A_, _R_) _A_->stats._R_
 static void
 ixgb_ethtool_gregs(struct ixgb_adapter *adapter,
-		   struct ethtool_regs *regs, u8 * regs_buff)
+		   struct ethtool_regs *regs, uint32_t * regs_buff)
 {
 	struct ixgb_hw *hw = &adapter->hw;
-	u32 *reg = (u32 *) regs_buff;
-	u32 *reg_start = reg;
-	u8 i;
+	uint32_t *reg = regs_buff;
+	uint32_t *reg_start = reg;
+	uint8_t i;
 
 	regs->version =
 	    (adapter->hw.device_id << 16) | adapter->hw.subsystem_id;
@@ -199,15 +257,6 @@
 	*reg++ = IXGB_READ_REG(hw, MSCA);	/*  74 */
 	*reg++ = IXGB_READ_REG(hw, MSRWD);	/*  75 */
 
-#if 0
-	/* Wake-up */
-	reg[IXGB_WUFC] = IXGB_READ_REG(hw, WUFC);
-	reg[IXGB_WUS] = IXGB_READ_REG(hw, WUS);
-	reg[IXGB_FFLT] = IXGB_READ_REG(hw, FFLT);
-	reg[IXGB_FFMT] = IXGB_READ_REG(hw, FFMT);
-	reg[IXGB_FTVT] = IXGB_READ_REG(hw, FTVT);
-#endif
-
 	/* Statistics */
 	*reg++ = IXGB_GET_STAT(adapter, tprl);	/*  76 */
 	*reg++ = IXGB_GET_STAT(adapter, tprh);	/*  77 */
@@ -270,22 +319,21 @@
 	*reg++ = IXGB_GET_STAT(adapter, xofftxc);	/* 134 */
 	*reg++ = IXGB_GET_STAT(adapter, rjc);	/* 135 */
 
-#if 0
-#endif
-	regs->len = (reg - reg_start) * sizeof (u32);
+	regs->len = (reg - reg_start) * sizeof(uint32_t);
 }
-#endif				/* ETHTOOL_GREGS */
 
 static int
 ixgb_ethtool_geeprom(struct ixgb_adapter *adapter,
-		     struct ethtool_eeprom *eeprom, u16 * eeprom_buff)
+		     struct ethtool_eeprom *eeprom, uint16_t * eeprom_buff)
 {
 	struct ixgb_hw *hw = &adapter->hw;
 	int i, max_len, first_word, last_word;
-	IXGB_DBG("ixgb_ethtool_geeprom\n");
+	int ret_val = 0;
 
-	if (eeprom->len == 0)
-		return -EINVAL;
+	if (eeprom->len == 0) {
+		ret_val = -EINVAL;
+		goto geeprom_error;
+	}
 
 	eeprom->magic = hw->vendor_id | (hw->device_id << 16);
 
@@ -294,8 +342,10 @@
 	/* use our function to read the eeprom and update our cache */
 	ixgb_get_eeprom_data(hw);
 
-	if (eeprom->offset > eeprom->offset + eeprom->len)
-		return -EINVAL;
+	if (eeprom->offset > eeprom->offset + eeprom->len) {
+		ret_val = -EINVAL;
+		goto geeprom_error;
+	}
 
 	if ((eeprom->offset + eeprom->len) > max_len)
 		eeprom->len = (max_len - eeprom->offset);
@@ -306,15 +356,16 @@
 	for (i = 0; i <= (last_word - first_word); i++) {
 		eeprom_buff[i] = hw->eeprom[first_word + i];
 	}
-
-	return 0;
+      geeprom_error:
+	return ret_val;
 }
+
 static int
 ixgb_ethtool_seeprom(struct ixgb_adapter *adapter,
-		     struct ethtool_eeprom *eeprom, void *user_data)
+		     struct ethtool_eeprom *eeprom, void __user *user_data)
 {
 	struct ixgb_hw *hw = &adapter->hw;
-	u16 eeprom_buff[256];
+	uint16_t eeprom_buff[256];
 	int i, max_len, first_word, last_word;
 	void *ptr;
 
@@ -334,7 +385,7 @@
 
 	first_word = eeprom->offset >> 1;
 	last_word = (eeprom->offset + eeprom->len - 1) >> 1;
-	ptr = (void *) eeprom_buff;
+	ptr = (void *)eeprom_buff;
 
 	if (eeprom->offset & 1) {
 		/* need read/modify/write of first changed EEPROM word */
@@ -361,18 +412,15 @@
 	return 0;
 }
 
-#ifdef  ETHTOOL_PHYS_ID
-
 /* toggle LED 4 times per second = 2 "blinks" per second */
-#define IXGB_ID_INTERVAL    (HZ/4)
+#define IXGB_ID_INTERVAL	(HZ/4)
 
 /* bit defines for adapter->led_status */
-#define IXGB_LED_ON     0
+#define IXGB_LED_ON		0
 
-static void
-ixgb_led_blink_callback(unsigned long data)
+static void ixgb_led_blink_callback(unsigned long data)
 {
-	struct ixgb_adapter *adapter = (struct ixgb_adapter *) data;
+	struct ixgb_adapter *adapter = (struct ixgb_adapter *)data;
 
 	if (test_and_change_bit(IXGB_LED_ON, &adapter->led_status))
 		ixgb_led_off(&adapter->hw);
@@ -388,7 +436,7 @@
 	if (!adapter->blink_timer.function) {
 		init_timer(&adapter->blink_timer);
 		adapter->blink_timer.function = ixgb_led_blink_callback;
-		adapter->blink_timer.data = (unsigned long) adapter;
+		adapter->blink_timer.data = (unsigned long)adapter;
 	}
 
 	mod_timer(&adapter->blink_timer, jiffies);
@@ -405,114 +453,121 @@
 
 	return 0;
 }
-#endif				/* ETHTOOL_PHYS_ID */
 
-int
-ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
+int ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
-	void *addr = ifr->ifr_data;
-	u32 cmd;
+	void __user *addr = ifr->ifr_data;
+	uint32_t cmd;
 
-	if (get_user(cmd, (u32 *) addr))
+	if (get_user(cmd, (uint32_t __user *) addr))
 		return -EFAULT;
 
 	switch (cmd) {
-#if 0
-	case ETHTOOL_PROMISCUOUS:{
-			struct ethtool_pmode pmode;
-
-			if (copy_from_user(&pmode, addr, sizeof (pmode)))
-				return -EFAULT;
-
-			ixgb_ethtool_promiscuous(adapter, &pmode);
-
-			if (copy_to_user(addr, &pmode, sizeof (pmode)))
-				return -EFAULT;
-
-			return 0;
-		}
-	case ETHTOOL_DOWN_UP:
-		ixgb_down(netdev->priv);
-		ixgb_up(netdev->priv);
-		return 0;
-#endif
 	case ETHTOOL_GSET:{
 			struct ethtool_cmd ecmd = { ETHTOOL_GSET };
-
 			ixgb_ethtool_gset(adapter, &ecmd);
-			if (copy_to_user(addr, &ecmd, sizeof (ecmd)))
+			if (copy_to_user(addr, &ecmd, sizeof(ecmd)))
 				return -EFAULT;
 			return 0;
 		}
 	case ETHTOOL_SSET:{
 			struct ethtool_cmd ecmd;
-
-			if (copy_from_user(&ecmd, addr, sizeof (ecmd)))
+			if (copy_from_user(&ecmd, addr, sizeof(ecmd)))
 				return -EFAULT;
 			return ixgb_ethtool_sset(adapter, &ecmd);
 		}
-	case ETHTOOL_GDRVINFO:
-		{
+	case ETHTOOL_GDRVINFO:{
 			struct ethtool_drvinfo drvinfo = { ETHTOOL_GDRVINFO };
-
 			ixgb_ethtool_gdrvinfo(adapter, &drvinfo);
-			if (copy_to_user(addr, &drvinfo, sizeof (drvinfo)))
+			if (copy_to_user(addr, &drvinfo, sizeof(drvinfo)))
 				return -EFAULT;
 			return 0;
 		}
-#if defined(ETHTOOL_GREGS) && defined(ETHTOOL_GEEPROM)
+	case ETHTOOL_GSTRINGS:{
+			struct ethtool_gstrings gstrings = { ETHTOOL_GSTRINGS };
+			char *strings = NULL;
+			int err = 0;
+
+			if (copy_from_user(&gstrings, addr, sizeof(gstrings)))
+				return -EFAULT;
+			switch (gstrings.string_set) {
+			case ETH_SS_STATS:{
+					int i;
+					gstrings.len = IXGB_STATS_LEN;
+					strings =
+					    kmalloc(IXGB_STATS_LEN *
+						    ETH_GSTRING_LEN,
+						    GFP_KERNEL);
+					if (!strings)
+						return -ENOMEM;
+					for (i = 0; i < IXGB_STATS_LEN; i++) {
+						memcpy(&strings
+						       [i * ETH_GSTRING_LEN],
+						       ixgb_gstrings_stats[i].
+						       stat_string,
+						       ETH_GSTRING_LEN);
+					}
+					break;
+				}
+			default:
+				return -EOPNOTSUPP;
+			}
+			if (copy_to_user(addr, &gstrings, sizeof(gstrings)))
+				err = -EFAULT;
+			addr += offsetof(struct ethtool_gstrings, data);
+			if (!err && copy_to_user(addr, strings,
+						 gstrings.len *
+						 ETH_GSTRING_LEN))
+				err = -EFAULT;
+
+			kfree(strings);
+			return err;
+		}
 	case ETHTOOL_GREGS:{
 			struct ethtool_regs regs = { ETHTOOL_GREGS };
-			u8 regs_buff[IXGB_REG_DUMP_LEN];
+			uint32_t regs_buff[IXGB_REG_DUMP_LEN];
 
+			if (copy_from_user(&regs, addr, sizeof(regs)))
+				return -EFAULT;
 			ixgb_ethtool_gregs(adapter, &regs, regs_buff);
-
-			if (copy_to_user(addr, &regs, sizeof (regs)))
+			if (copy_to_user(addr, &regs, sizeof(regs)))
 				return -EFAULT;
 
 			addr += offsetof(struct ethtool_regs, data);
-
 			if (copy_to_user(addr, regs_buff, regs.len))
 				return -EFAULT;
+
 			return 0;
 		}
-#endif				/* ETHTOOL_GREGS */
 	case ETHTOOL_NWAY_RST:{
-			IXGB_DBG("ETHTOOL_NWAY_RST\n");
-			ixgb_down(adapter);
-			ixgb_up(adapter);
-
+			if (netif_running(netdev)) {
+				ixgb_down(adapter, TRUE);
+				ixgb_up(adapter);
+			}
 			return 0;
 		}
-#ifdef  ETHTOOL_PHYS_ID
 	case ETHTOOL_PHYS_ID:{
 			struct ethtool_value id;
-
-			IXGB_DBG("ETHTOOL_PHYS_ID\n");
-			if (copy_from_user(&id, addr, sizeof (id)))
+			if (copy_from_user(&id, addr, sizeof(id)))
 				return -EFAULT;
 			return ixgb_ethtool_led_blink(adapter, &id);
 		}
-#endif				/* ETHTOOL_PHYS_ID */
 	case ETHTOOL_GLINK:{
 			struct ethtool_value link = { ETHTOOL_GLINK };
-
-			IXGB_DBG("ETHTOOL_GLINK\n");
 			link.data = netif_carrier_ok(netdev);
-			if (copy_to_user(addr, &link, sizeof (link)))
+			if (copy_to_user(addr, &link, sizeof(link)))
 				return -EFAULT;
 			return 0;
 		}
 
 	case ETHTOOL_GEEPROM:{
 			struct ethtool_eeprom eeprom = { ETHTOOL_GEEPROM };
-			u16 eeprom_buff[IXGB_EEPROM_SIZE];
+			uint16_t eeprom_buff[IXGB_EEPROM_SIZE];
 			void *ptr;
-			int err;
+			int err = 0;
 
-			IXGB_DBG("ETHTOOL_GEEPROM\n");
-			if (copy_from_user(&eeprom, addr, sizeof (eeprom)))
+			if (copy_from_user(&eeprom, addr, sizeof(eeprom)))
 				return -EFAULT;
 
 			if ((err =
@@ -520,12 +575,12 @@
 						  eeprom_buff)) < 0)
 				return err;
 
-			if (copy_to_user(addr, &eeprom, sizeof (eeprom)))
+			if (copy_to_user(addr, &eeprom, sizeof(eeprom)))
 				return -EFAULT;
 
 			addr += offsetof(struct ethtool_eeprom, data);
+			ptr = ((void *)eeprom_buff) + (eeprom.offset & 1);
 
-			ptr = ((void *) eeprom_buff) + (eeprom.offset & 1);
 			if (copy_to_user(addr, ptr, eeprom.len))
 				return -EFAULT;
 			return 0;
@@ -533,13 +588,133 @@
 	case ETHTOOL_SEEPROM:{
 			struct ethtool_eeprom eeprom;
 
-			IXGB_DBG("ETHTOOL_SEEPROM\n");
-			if (copy_from_user(&eeprom, addr, sizeof (eeprom)))
+			if (copy_from_user(&eeprom, addr, sizeof(eeprom)))
 				return -EFAULT;
 
 			addr += offsetof(struct ethtool_eeprom, data);
 			return ixgb_ethtool_seeprom(adapter, &eeprom, addr);
 		}
+	case ETHTOOL_GPAUSEPARAM:{
+			struct ethtool_pauseparam epause =
+			    { ETHTOOL_GPAUSEPARAM };
+			ixgb_ethtool_gpause(adapter, &epause);
+			if (copy_to_user(addr, &epause, sizeof(epause)))
+				return -EFAULT;
+			return 0;
+		}
+	case ETHTOOL_SPAUSEPARAM:{
+			struct ethtool_pauseparam epause;
+			if (copy_from_user(&epause, addr, sizeof(epause)))
+				return -EFAULT;
+			return ixgb_ethtool_spause(adapter, &epause);
+		}
+	case ETHTOOL_GSTATS:{
+			struct {
+				struct ethtool_stats eth_stats;
+				uint64_t data[IXGB_STATS_LEN];
+			} stats = { {
+			ETHTOOL_GSTATS, IXGB_STATS_LEN}};
+			int i;
+
+			for (i = 0; i < IXGB_STATS_LEN; i++)
+				stats.data[i] =
+				    (ixgb_gstrings_stats[i].sizeof_stat ==
+				     sizeof(uint64_t)) ? *(uint64_t *) ((char *)
+									adapter
+									+
+									ixgb_gstrings_stats
+									[i].
+									stat_offset)
+				    : *(uint32_t *) ((char *)adapter +
+						     ixgb_gstrings_stats[i].
+						     stat_offset);
+			if (copy_to_user(addr, &stats, sizeof(stats)))
+				return -EFAULT;
+			return 0;
+		}
+	case ETHTOOL_GRXCSUM:{
+			struct ethtool_value edata = { ETHTOOL_GRXCSUM };
+
+			edata.data = adapter->rx_csum;
+			if (copy_to_user(addr, &edata, sizeof(edata)))
+				return -EFAULT;
+			return 0;
+		}
+	case ETHTOOL_SRXCSUM:{
+			struct ethtool_value edata;
+
+			if (copy_from_user(&edata, addr, sizeof(edata)))
+				return -EFAULT;
+			adapter->rx_csum = edata.data;
+			ixgb_down(adapter, TRUE);
+			ixgb_up(adapter);
+			return 0;
+		}
+	case ETHTOOL_GTXCSUM:{
+			struct ethtool_value edata = { ETHTOOL_GTXCSUM };
+
+			edata.data = (netdev->features & NETIF_F_HW_CSUM) != 0;
+			if (copy_to_user(addr, &edata, sizeof(edata)))
+				return -EFAULT;
+			return 0;
+		}
+	case ETHTOOL_STXCSUM:{
+			struct ethtool_value edata;
+
+			if (copy_from_user(&edata, addr, sizeof(edata)))
+				return -EFAULT;
+
+			if (edata.data)
+				netdev->features |= NETIF_F_HW_CSUM;
+			else
+				netdev->features &= ~NETIF_F_HW_CSUM;
+
+			return 0;
+		}
+	case ETHTOOL_GSG:{
+			struct ethtool_value edata = { ETHTOOL_GSG };
+
+			edata.data = (netdev->features & NETIF_F_SG) != 0;
+			if (copy_to_user(addr, &edata, sizeof(edata)))
+				return -EFAULT;
+			return 0;
+		}
+	case ETHTOOL_SSG:{
+			struct ethtool_value edata;
+
+			if (copy_from_user(&edata, addr, sizeof(edata)))
+				return -EFAULT;
+
+			if (edata.data)
+				netdev->features |= NETIF_F_SG;
+			else
+				netdev->features &= ~NETIF_F_SG;
+
+			return 0;
+		}
+#ifdef NETIF_F_TSO
+	case ETHTOOL_GTSO:{
+			struct ethtool_value edata = { ETHTOOL_GTSO };
+
+			edata.data = (netdev->features & NETIF_F_TSO) != 0;
+			if (copy_to_user(addr, &edata, sizeof(edata)))
+				return -EFAULT;
+			return 0;
+		}
+	case ETHTOOL_STSO:{
+			struct ethtool_value edata;
+
+			if (copy_from_user(&edata, addr, sizeof(edata)))
+				return -EFAULT;
+
+			if (edata.data)
+				netdev->features |= NETIF_F_TSO;
+			else
+				netdev->features &= ~NETIF_F_TSO;
+
+			return 0;
+		}
+#endif
 	default:
 		return -EOPNOTSUPP;
 	}
diff -Nru a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
--- a/drivers/net/ixgb/ixgb_hw.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/ixgb/ixgb_hw.c	Tue Jun 15 22:20:42 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,6 +23,7 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
 /* ixgb_hw.c
@@ -34,32 +35,31 @@
 
 /*  Local function prototypes */
 
-static u32 ixgb_hash_mc_addr(struct ixgb_hw *hw, u8 * mc_addr);
+static uint32_t ixgb_hash_mc_addr(struct ixgb_hw *hw, uint8_t * mc_addr);
 
-static void ixgb_mta_set(struct ixgb_hw *hw, u32 hash_value);
+static void ixgb_mta_set(struct ixgb_hw *hw, uint32_t hash_value);
 
 static void ixgb_get_bus_info(struct ixgb_hw *hw);
 
-boolean_t mac_addr_valid(u8 * mac_addr);
-
 static boolean_t ixgb_link_reset(struct ixgb_hw *hw);
 
 static void ixgb_optics_reset(struct ixgb_hw *hw);
 
-u32 ixgb_mac_reset(struct ixgb_hw *hw);
+static ixgb_phy_type ixgb_identify_phy(struct ixgb_hw *hw);
 
-u32
-ixgb_mac_reset(struct ixgb_hw *hw)
+uint32_t ixgb_mac_reset(struct ixgb_hw *hw);
+
+uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
 {
-	u32 ctrl_reg;
+	uint32_t ctrl_reg;
 
-	/* Setup up hardware to known state with RESET.  */
 	ctrl_reg = IXGB_CTRL0_RST | IXGB_CTRL0_SDP3_DIR |	/* All pins are Output=1 */
 	    IXGB_CTRL0_SDP2_DIR | IXGB_CTRL0_SDP1_DIR | IXGB_CTRL0_SDP0_DIR | IXGB_CTRL0_SDP3 |	/* Initial value 1101   */
 	    IXGB_CTRL0_SDP2 | IXGB_CTRL0_SDP0;
+
 #ifdef HP_ZX1
-	outl(IXGB_CTRL0, hw->io_base);
-	outl(ctrl_reg, hw->io_base + 4);
+	/* Workaround for 82597EX reset errata */
+	IXGB_WRITE_REG_IO(hw, CTRL0, ctrl_reg);
 #else
 	IXGB_WRITE_REG(hw, CTRL0, ctrl_reg);
 #endif
@@ -72,7 +72,10 @@
 	ASSERT(!(ctrl_reg & IXGB_CTRL0_RST));
 #endif
 
-	ixgb_optics_reset(hw);
+	if (hw->phy_type == ixgb_phy_type_txn17401) {
+		ixgb_optics_reset(hw);
+	}
+
 	return ctrl_reg;
 }
 
@@ -81,11 +84,10 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-boolean_t
-ixgb_adapter_stop(struct ixgb_hw * hw)
+boolean_t ixgb_adapter_stop(struct ixgb_hw * hw)
 {
-	u32 ctrl_reg;
-	u32 icr_reg;
+	uint32_t ctrl_reg;
+	uint32_t icr_reg;
 
 	DEBUGFUNC("ixgb_adapter_stop");
 
@@ -134,27 +136,111 @@
 }
 
 /******************************************************************************
+ * Identifies the vendor of the optics module on the adapter.  The SR adapters
+ * support two different types of XPAK optics, so it is necessary to determine
+ * which optics are present before applying any optics-specific workarounds.
+ *
+ * hw - Struct containing variables accessed by shared code.
+ *
+ * Returns: the vendor of the XPAK optics module.
+ *****************************************************************************/
+static ixgb_xpak_vendor ixgb_identify_xpak_vendor(struct ixgb_hw *hw)
+{
+	uint32_t i;
+	uint16_t vendor_name[5];
+	ixgb_xpak_vendor xpak_vendor;
+
+	DEBUGFUNC("ixgb_identify_xpak_vendor");
+
+	/* Read the first few bytes of the vendor string from the XPAK NVR
+	 * registers.  These are standard XENPAK/XPAK registers, so all XPAK
+	 * devices should implement them. */
+	for (i = 0; i < 5; i++) {
+		vendor_name[i] = ixgb_read_phy_reg(hw,
+						   MDIO_PMA_PMD_XPAK_VENDOR_NAME
+						   + i, IXGB_PHY_ADDRESS,
+						   MDIO_PMA_PMD_DID);
+	}
+
+	/* Determine the actual vendor */
+	if (vendor_name[0] == 'I' &&
+	    vendor_name[1] == 'N' &&
+	    vendor_name[2] == 'T' &&
+	    vendor_name[3] == 'E' && vendor_name[4] == 'L') {
+		xpak_vendor = ixgb_xpak_vendor_intel;
+	} else {
+		xpak_vendor = ixgb_xpak_vendor_infineon;
+	}
+
+	return (xpak_vendor);
+}
+
+/******************************************************************************
+ * Determine the physical layer module on the adapter.
+ *
+ * hw - Struct containing variables accessed by shared code.  The device_id
+ *      field must be (correctly) populated before calling this routine.
+ *
+ * Returns: the phy type of the adapter.
+ *****************************************************************************/
+static ixgb_phy_type ixgb_identify_phy(struct ixgb_hw *hw)
+{
+	ixgb_phy_type phy_type;
+	ixgb_xpak_vendor xpak_vendor;
+
+	DEBUGFUNC("ixgb_identify_phy");
+
+	/* Infer the transceiver/phy type from the device id */
+	switch (hw->device_id) {
+	case IXGB_DEVICE_ID_82597EX:
+		DEBUGOUT("Identified TXN17401 optics\n");
+		phy_type = ixgb_phy_type_txn17401;
+		break;
+
+	case IXGB_DEVICE_ID_82597EX_SR:
+		/* The SR adapters carry two different types of XPAK optics
+		 * modules; read the vendor identifier to determine the exact
+		 * type of optics. */
+		xpak_vendor = ixgb_identify_xpak_vendor(hw);
+		if (xpak_vendor == ixgb_xpak_vendor_intel) {
+			DEBUGOUT("Identified TXN17201 optics\n");
+			phy_type = ixgb_phy_type_txn17201;
+		} else {
+			DEBUGOUT("Identified G6005 optics\n");
+			phy_type = ixgb_phy_type_g6005;
+		}
+		break;
+
+	default:
+		DEBUGOUT("Unknown physical layer module\n");
+		phy_type = ixgb_phy_type_unknown;
+		break;
+	}
+
+	return (phy_type);
+}
+
+/******************************************************************************
  * Performs basic configuration of the adapter.
  *
  * hw - Struct containing variables accessed by shared code
- * 
- * Resets the controller.  
+ *
+ * Resets the controller.
  * Reads and validates the EEPROM.
  * Initializes the receive address registers.
  * Initializes the multicast table.
- * Clears all on-chip counters. 
- * Calls routine to setup flow control settings. 
+ * Clears all on-chip counters.
+ * Calls routine to setup flow control settings.
  * Leaves the transmit and receive units disabled and uninitialized.
- * 
+ *
  * Returns:
- *      TRUE if successful, 
+ *      TRUE if successful,
  *      FALSE if unrecoverable problems were encountered.
  *****************************************************************************/
-boolean_t
-ixgb_init_hw(struct ixgb_hw * hw)
+boolean_t ixgb_init_hw(struct ixgb_hw * hw)
 {
-	u32 i;
-	u32 ctrl_reg;
+	uint32_t i;
+	uint32_t ctrl_reg;
 	boolean_t status;
 
 	DEBUGFUNC("ixgb_init_hw");
@@ -170,8 +256,8 @@
 
 	DEBUGOUT("Issuing an EE reset to MAC\n");
 #ifdef HP_ZX1
-	outl(IXGB_CTRL1, hw->io_base);
-	outl(IXGB_CTRL1_EE_RST, hw->io_base + 4);
+	/* Workaround for 82597EX reset errata */
+	IXGB_WRITE_REG_IO(hw, CTRL1, IXGB_CTRL1_EE_RST);
 #else
 	IXGB_WRITE_REG(hw, CTRL1, IXGB_CTRL1_EE_RST);
 #endif
@@ -183,12 +269,16 @@
 		return (FALSE);
 	}
 
-	/* Setup the receive addresses. 
+	/* Use the device id to determine the type of phy/transceiver. */
+	hw->device_id = ixgb_get_ee_device_id(hw);
+	hw->phy_type = ixgb_identify_phy(hw);
+
+	/* Setup the receive addresses.
 	 * Receive Address Registers (RARs 0 - 15).
 	 */
 	ixgb_init_rx_addrs(hw);
 
-	/* 
+	/*
 	 * Check that a valid MAC address has been set.
 	 * If it is not valid, we fail hardware init.
 	 */
@@ -217,7 +307,7 @@
 	/* Call a subroutine to setup flow control. */
 	status = ixgb_setup_fc(hw);
 
-	/* check-for-link in case lane deskew is locked */
+	/* 82597EX errata: Call check-for-link in case lane deskew is locked */
 	ixgb_check_for_link(hw);
 
 	return (status);
@@ -226,20 +316,19 @@
 /******************************************************************************
  * Initializes receive address filters.
  *
- * hw - Struct containing variables accessed by shared code 
+ * hw - Struct containing variables accessed by shared code
  *
  * Places the MAC address in receive address register 0 and clears the rest
  * of the receive addresss registers. Clears the multicast table. Assumes
  * the receiver is in reset when the routine is called.
  *****************************************************************************/
-void
-ixgb_init_rx_addrs(struct ixgb_hw *hw)
+void ixgb_init_rx_addrs(struct ixgb_hw *hw)
 {
-	u32 i;
+	uint32_t i;
 
 	DEBUGFUNC("ixgb_init_rx_addrs");
 
-	/* 
+	/*
 	 * If the current mac address is valid, assume it is a software override
 	 * to the permanent address.
 	 * Otherwise, use the permanent address from the eeprom.
@@ -289,17 +378,17 @@
  *
  * The given list replaces any existing list. Clears the last 15 receive
  * address registers and the multicast table. Uses receive address registers
- * for the first 15 multicast addresses, and hashes the rest into the 
+ * for the first 15 multicast addresses, and hashes the rest into the
  * multicast table.
  *****************************************************************************/
 void
 ixgb_mc_addr_list_update(struct ixgb_hw *hw,
-			 u8 * mc_addr_list,
-			 u32 mc_addr_count, u32 pad)
+			 uint8_t * mc_addr_list,
+			 uint32_t mc_addr_count, uint32_t pad)
 {
-	u32 hash_value;
-	u32 i;
-	u32 rar_used_count = 1;	/* RAR[0] is used for our MAC address */
+	uint32_t hash_value;
+	uint32_t i;
+	uint32_t rar_used_count = 1;	/* RAR[0] is used for our MAC address */
 
 	DEBUGFUNC("ixgb_mc_addr_list_update");
 
@@ -336,7 +425,7 @@
 				       5]);
 
 		/* Place this multicast address in the RAR if there is room, *
-		 * else put it in the MTA            
+		 * else put it in the MTA
 		 */
 		if (rar_used_count < IXGB_RAR_ENTRIES) {
 			ixgb_rar_set(hw,
@@ -366,20 +455,19 @@
  * Hashes an address to determine its location in the multicast table
  *
  * hw - Struct containing variables accessed by shared code
- * mc_addr - the multicast address to hash 
+ * mc_addr - the multicast address to hash
  *
  * Returns:
  *      The hash value
  *****************************************************************************/
-static u32
-ixgb_hash_mc_addr(struct ixgb_hw *hw, u8 * mc_addr)
+static uint32_t ixgb_hash_mc_addr(struct ixgb_hw *hw, uint8_t * mc_addr)
 {
-	u32 hash_value = 0;
+	uint32_t hash_value = 0;
 
 	DEBUGFUNC("ixgb_hash_mc_addr");
 
 	/* The portion of the address that is used for the hash table is
-	 * determined by the mc_filter_type setting.  
+	 * determined by the mc_filter_type setting.
 	 */
 	switch (hw->mc_filter_type) {
 		/* [0] [1] [2] [3] [4] [5]
@@ -388,18 +476,18 @@
 	case 0:
 		/* [47:36] i.e. 0x563 for above example address */
 		hash_value =
-		    ((mc_addr[4] >> 4) | (((u16) mc_addr[5]) << 4));
+		    ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4));
 		break;
 	case 1:		/* [46:35] i.e. 0xAC6 for above example address */
 		hash_value =
-		    ((mc_addr[4] >> 3) | (((u16) mc_addr[5]) << 5));
+		    ((mc_addr[4] >> 3) | (((uint16_t) mc_addr[5]) << 5));
 		break;
 	case 2:		/* [45:34] i.e. 0x5D8 for above example address */
 		hash_value =
-		    ((mc_addr[4] >> 2) | (((u16) mc_addr[5]) << 6));
+		    ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6));
 		break;
 	case 3:		/* [43:32] i.e. 0x634 for above example address */
-		hash_value = ((mc_addr[4]) | (((u16) mc_addr[5]) << 8));
+		hash_value = ((mc_addr[4]) | (((uint16_t) mc_addr[5]) << 8));
 		break;
 	default:
 		/* Invalid mc_filter_type, what should we do? */
@@ -418,18 +506,17 @@
  * hw - Struct containing variables accessed by shared code
  * hash_value - Multicast address hash value
  *****************************************************************************/
-static void
-ixgb_mta_set(struct ixgb_hw *hw, u32 hash_value)
+static void ixgb_mta_set(struct ixgb_hw *hw, uint32_t hash_value)
 {
-	u32 hash_bit, hash_reg;
-	u32 mta_reg;
+	uint32_t hash_bit, hash_reg;
+	uint32_t mta_reg;
 
-	/* The MTA is a register array of 128 32-bit registers.  
-	 * It is treated like an array of 4096 bits.  We want to set 
+	/* The MTA is a register array of 128 32-bit registers.
+	 * It is treated like an array of 4096 bits.  We want to set
 	 * bit BitArray[hash_value]. So we figure out what register
 	 * the bit is in, read it, OR in the new bit, then write
-	 * back the new value.  The register is determined by the 
-	 * upper 7 bits of the hash value and the bit within that 
+	 * back the new value.  The register is determined by the
+	 * upper 7 bits of the hash value and the bit within that
 	 * register are determined by the lower 5 bits of the value.
 	 */
 	hash_reg = (hash_value >> 5) & 0x7F;
@@ -451,22 +538,21 @@
  * addr - Address to put into receive address register
  * index - Receive address register to write
  *****************************************************************************/
-void
-ixgb_rar_set(struct ixgb_hw *hw, u8 * addr, u32 index)
+void ixgb_rar_set(struct ixgb_hw *hw, uint8_t * addr, uint32_t index)
 {
-	u32 rar_low, rar_high;
+	uint32_t rar_low, rar_high;
 
 	DEBUGFUNC("ixgb_rar_set");
 
 	/* HW expects these in little endian so we reverse the byte order
-	 * from network order (big endian) to little endian              
+	 * from network order (big endian) to little endian
 	 */
-	rar_low = ((u32) addr[0] |
-		   ((u32) addr[1] << 8) |
-		   ((u32) addr[2] << 16) | ((u32) addr[3] << 24));
+	rar_low = ((uint32_t) addr[0] |
+		   ((uint32_t) addr[1] << 8) |
+		   ((uint32_t) addr[2] << 16) | ((uint32_t) addr[3] << 24));
 
-	rar_high = ((u32) addr[4] |
-		    ((u32) addr[5] << 8) | IXGB_RAH_AV);
+	rar_high = ((uint32_t) addr[4] |
+		    ((uint32_t) addr[5] << 8) | IXGB_RAH_AV);
 
 	IXGB_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low);
 	IXGB_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high);
@@ -480,8 +566,7 @@
  * offset - Offset in VLAN filer table to write
  * value - Value to write into VLAN filter table
  *****************************************************************************/
-void
-ixgb_write_vfta(struct ixgb_hw *hw, u32 offset, u32 value)
+void ixgb_write_vfta(struct ixgb_hw *hw, uint32_t offset, uint32_t value)
 {
 	IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, value);
 	return;
@@ -492,10 +577,9 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
-ixgb_clear_vfta(struct ixgb_hw *hw)
+void ixgb_clear_vfta(struct ixgb_hw *hw)
 {
-	u32 offset;
+	uint32_t offset;
 
 	for (offset = 0; offset < IXGB_VLAN_FILTER_TBL_SIZE; offset++)
 		IXGB_WRITE_REG_ARRAY(hw, VFTA, offset, 0);
@@ -508,11 +592,10 @@
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
 
-boolean_t
-ixgb_setup_fc(struct ixgb_hw * hw)
+boolean_t ixgb_setup_fc(struct ixgb_hw * hw)
 {
-	u32 ctrl_reg;
-	u32 pap_reg = 0;	/* by default, assume no pause time */
+	uint32_t ctrl_reg;
+	uint32_t pap_reg = 0;	/* by default, assume no pause time */
 	boolean_t status = TRUE;
 
 	DEBUGFUNC("ixgb_setup_fc");
@@ -534,6 +617,8 @@
 	 */
 	switch (hw->fc.type) {
 	case ixgb_fc_none:	/* 0 */
+		/* Set CMDC bit to disable Rx Flow control */
+		ctrl_reg |= (IXGB_CTRL0_CMDC);
 		break;
 	case ixgb_fc_rx_pause:	/* 1 */
 		/* RX Flow control is enabled, and TX Flow control is
@@ -573,7 +658,7 @@
 	 * these registers will be set to a default threshold that may be
 	 * adjusted later by the driver's runtime code.  However, if the
 	 * ability to transmit pause frames in not enabled, then these
-	 * registers will be set to 0. 
+	 * registers will be set to 0.
 	 */
 	if (!(hw->fc.type & ixgb_fc_tx_pause)) {
 		IXGB_WRITE_REG(hw, FCRTL, 0);
@@ -603,18 +688,19 @@
  *
  * Returns:  Data word (16 bits) from MDI device.
  *
- * This routine uses the new protocol MDI Single Command and Address Operation.
+ * The 82597EX has support for several MDI access methods.  This routine
+ * uses the new protocol MDI Single Command and Address Operation.
  * This requires that first an address cycle command is sent, followed by a
  * read command.
  *****************************************************************************/
-u16
+uint16_t
 ixgb_read_phy_reg(struct ixgb_hw * hw,
-		  u32 reg_address,
-		  u32 phy_address, u32 device_type)
+		  uint32_t reg_address,
+		  uint32_t phy_address, uint32_t device_type)
 {
-	u32 i;
-	u32 data;
-	u32 command = 0;
+	uint32_t i;
+	uint32_t data;
+	uint32_t command = 0;
 
 	ASSERT(reg_address <= IXGB_MAX_PHY_REG_ADDRESS);
 	ASSERT(phy_address <= IXGB_MAX_PHY_ADDRESS);
@@ -673,11 +759,11 @@
 	ASSERT((command & IXGB_MSCA_MDI_COMMAND) == 0);
 
 	/* Operation is complete, get the data from the MDIO Read/Write Data
-	 * register and return. 
+	 * register and return.
 	 */
 	data = IXGB_READ_REG(hw, MSRWD);
 	data >>= IXGB_MSRWD_READ_DATA_SHIFT;
-	return ((u16) data);
+	return ((uint16_t) data);
 }
 
 /******************************************************************************
@@ -692,24 +778,25 @@
  *
  * Returns:  void.
  *
- * This routine uses the new protocol MDI Single Command and Address Operation.
+ * The 82597EX has support for several MDI access methods.  This routine
+ * uses the new protocol MDI Single Command and Address Operation.
  * This requires that first an address cycle command is sent, followed by a
  * write command.
  *****************************************************************************/
 void
 ixgb_write_phy_reg(struct ixgb_hw *hw,
-		   u32 reg_address,
-		   u32 phy_address, u32 device_type, u16 data)
+		   uint32_t reg_address,
+		   uint32_t phy_address, uint32_t device_type, uint16_t data)
 {
-	u32 i;
-	u32 command = 0;
+	uint32_t i;
+	uint32_t command = 0;
 
 	ASSERT(reg_address <= IXGB_MAX_PHY_REG_ADDRESS);
 	ASSERT(phy_address <= IXGB_MAX_PHY_ADDRESS);
 	ASSERT(device_type <= IXGB_MAX_PHY_DEV_TYPE);
 
 	/* Put the data in the MDIO Read/Write Data register */
-	IXGB_WRITE_REG(hw, MSRWD, (u32) data);
+	IXGB_WRITE_REG(hw, MSRWD, (uint32_t) data);
 
 	/* Setup and write the address cycle command */
 	command = ((reg_address << IXGB_MSCA_NP_ADDR_SHIFT) |
@@ -773,11 +860,10 @@
  *
  * Called by any function that needs to check the link status of the adapter.
  *****************************************************************************/
-void
-ixgb_check_for_link(struct ixgb_hw *hw)
+void ixgb_check_for_link(struct ixgb_hw *hw)
 {
-	u32 status_reg;
-	u32 xpcss_reg;
+	uint32_t status_reg;
+	uint32_t xpcss_reg;
 
 	DEBUGFUNC("ixgb_check_for_link");
 
@@ -792,42 +878,53 @@
 		DEBUGOUT("XPCSS Not Aligned while Status:LU is set.\n");
 		hw->link_up = ixgb_link_reset(hw);
 	} else {
+		/*
+		 * 82597EX errata.  Since the lane deskew problem may prevent
+		 * link, reset the link before reporting link down.
+		 */
 		hw->link_up = ixgb_link_reset(hw);
 	}
-
 	/*  Anything else for 10 Gig?? */
 }
 
-boolean_t
-ixgb_check_for_bad_link(struct ixgb_hw *hw)
+/******************************************************************************
+ * Check for a bad link condition that may have occured.
+ * The indication is that the RFC / LFC registers may be incrementing
+ * continually.  A full adapter reset is required to recover.
+ *
+ * hw - Struct containing variables accessed by hw code
+ *
+ * Called by any function that needs to check the link status of the adapter.
+ *****************************************************************************/
+boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw)
 {
-	u32 newLFC, newRFC;
+	uint32_t newLFC, newRFC;
 	boolean_t bad_link_returncode = FALSE;
 
-	/* check for a bad reset that may have occured
-	 * the indication is that the RFC / LFC registers may be incrementing
-	 * continually. Do a full adapter reset to recover
-	 */
-	newLFC = IXGB_READ_REG(hw, LFC);
-	newRFC = IXGB_READ_REG(hw, RFC);
-	if ((hw->lastLFC + 250 < newLFC) || (hw->lastRFC + 250 < newRFC)) {
-		DEBUGOUT("BAD LINK! too many LFC/RFC since last check\n");
-		bad_link_returncode = TRUE;
+	if (hw->phy_type == ixgb_phy_type_txn17401) {
+		newLFC = IXGB_READ_REG(hw, LFC);
+		newRFC = IXGB_READ_REG(hw, RFC);
+		if ((hw->lastLFC + 250 < newLFC)
+		    || (hw->lastRFC + 250 < newRFC)) {
+			DEBUGOUT
+			    ("BAD LINK! too many LFC/RFC since last check\n");
+			bad_link_returncode = TRUE;
+		}
+		hw->lastLFC = newLFC;
+		hw->lastRFC = newRFC;
 	}
-	hw->lastLFC = newLFC;
-	hw->lastRFC = newRFC;
+
 	return bad_link_returncode;
 }
 
 /******************************************************************************
- * Clears all hardware statistics counters. 
+ * Clears all hardware statistics counters.
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
-ixgb_clear_hw_cntrs(struct ixgb_hw *hw)
+void ixgb_clear_hw_cntrs(struct ixgb_hw *hw)
 {
-	volatile u32 temp_reg;
+	volatile uint32_t temp_reg;
 
 	DEBUGFUNC("ixgb_clear_hw_cntrs");
 
@@ -905,10 +1002,9 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
-ixgb_led_on(struct ixgb_hw *hw)
+void ixgb_led_on(struct ixgb_hw *hw)
 {
-	u32 ctrl0_reg = IXGB_READ_REG(hw, CTRL0);
+	uint32_t ctrl0_reg = IXGB_READ_REG(hw, CTRL0);
 
 	/* To turn on the LED, clear software-definable pin 0 (SDP0). */
 	ctrl0_reg &= ~IXGB_CTRL0_SDP0;
@@ -921,10 +1017,9 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
-ixgb_led_off(struct ixgb_hw *hw)
+void ixgb_led_off(struct ixgb_hw *hw)
 {
-	u32 ctrl0_reg = IXGB_READ_REG(hw, CTRL0);
+	uint32_t ctrl0_reg = IXGB_READ_REG(hw, CTRL0);
 
 	/* To turn off the LED, set software-definable pin 0 (SDP0). */
 	ctrl0_reg |= IXGB_CTRL0_SDP0;
@@ -937,10 +1032,9 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-static void
-ixgb_get_bus_info(struct ixgb_hw *hw)
+static void ixgb_get_bus_info(struct ixgb_hw *hw)
 {
-	u32 status_reg;
+	uint32_t status_reg;
 
 	status_reg = IXGB_READ_REG(hw, STATUS);
 
@@ -976,11 +1070,10 @@
 /******************************************************************************
  * Tests a MAC address to ensure it is a valid Individual Address
  *
- * mac_addr - pointer to MAC address. 
+ * mac_addr - pointer to MAC address.
  *
  *****************************************************************************/
-boolean_t
-mac_addr_valid(u8 * mac_addr)
+boolean_t mac_addr_valid(uint8_t * mac_addr)
 {
 	boolean_t is_valid = TRUE;
 	DEBUGFUNC("mac_addr_valid");
@@ -1007,22 +1100,23 @@
 }
 
 /******************************************************************************
- * Resets the 10GbE link.  Waits the settle time and returns the state of 
+ * Resets the 10GbE link.  Waits the settle time and returns the state of
  * the link.
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-boolean_t
-ixgb_link_reset(struct ixgb_hw * hw)
+boolean_t ixgb_link_reset(struct ixgb_hw * hw)
 {
 	boolean_t link_status = FALSE;
-	u8 wait_retries = MAX_RESET_ITERATIONS;
-	u8 lrst_retries = MAX_RESET_ITERATIONS;
+	uint8_t wait_retries = MAX_RESET_ITERATIONS;
+	uint8_t lrst_retries = MAX_RESET_ITERATIONS;
 
 	do {
+		/* Reset the link */
 		IXGB_WRITE_REG(hw, CTRL0,
 			       IXGB_READ_REG(hw, CTRL0) | IXGB_CTRL0_LRST);
 
+		/* Wait for link-up and lane re-alignment */
 		do {
 			udelay(IXGB_DELAY_USECS_AFTER_LINK_RESET);
 			link_status =
@@ -1030,6 +1124,7 @@
 			     && (IXGB_READ_REG(hw, XPCSS) &
 				 IXGB_XPCSS_ALIGN_STATUS)) ? TRUE : FALSE;
 		} while (!link_status && --wait_retries);
+
 	} while (!link_status && --lrst_retries);
 
 	return link_status;
@@ -1040,16 +1135,21 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
-ixgb_optics_reset(struct ixgb_hw *hw)
+void ixgb_optics_reset(struct ixgb_hw *hw)
 {
-	u16 mdio_reg;
+	if (hw->phy_type == ixgb_phy_type_txn17401) {
+		uint16_t mdio_reg;
 
-	ixgb_write_phy_reg(hw,
-			   TXN17401_PMA_PMD_CR1,
-			   IXGB_PHY_ADDRESS,
-			   TXN17401_PMA_PMD_DID, TXN17401_PMA_PMD_CR1_RESET);
-	mdio_reg = ixgb_read_phy_reg(hw,
-				     TXN17401_PMA_PMD_CR1,
-				     IXGB_PHY_ADDRESS, TXN17401_PMA_PMD_DID);
+		ixgb_write_phy_reg(hw,
+				   MDIO_PMA_PMD_CR1,
+				   IXGB_PHY_ADDRESS,
+				   MDIO_PMA_PMD_DID, MDIO_PMA_PMD_CR1_RESET);
+
+		mdio_reg = ixgb_read_phy_reg(hw,
+					     MDIO_PMA_PMD_CR1,
+					     IXGB_PHY_ADDRESS,
+					     MDIO_PMA_PMD_DID);
+	}
+
+	return;
 }
diff -Nru a/drivers/net/ixgb/ixgb_hw.h b/drivers/net/ixgb/ixgb_hw.h
--- a/drivers/net/ixgb/ixgb_hw.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/ixgb/ixgb_hw.h	Tue Jun 15 22:20:36 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,6 +23,7 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
 #ifndef _IXGB_HW_H_
@@ -37,6 +38,21 @@
 	ixgb_num_macs
 } ixgb_mac_type;
 
+/* Types of physical layer modules */
+typedef enum {
+	ixgb_phy_type_unknown = 0,
+	ixgb_phy_type_g6005,	/* 850nm, MM fiber, XPAK transceiver */
+	ixgb_phy_type_g6104,	/* 1310nm, SM fiber, XPAK transceiver */
+	ixgb_phy_type_txn17201,	/* 850nm, MM fiber, XPAK transceiver */
+	ixgb_phy_type_txn17401	/* 1310nm, SM fiber, XENPAK transceiver */
+} ixgb_phy_type;
+
+/* XPAK transceiver vendors, for the SR adapters */
+typedef enum {
+	ixgb_xpak_vendor_intel,
+	ixgb_xpak_vendor_infineon
+} ixgb_xpak_vendor;
+
 /* Media Types */
 typedef enum {
 	ixgb_media_type_unknown = 0,
@@ -84,6 +100,9 @@
 #define SPEED_10000  10000
 #define FULL_DUPLEX  2
 
+#define MIN_NUMBER_OF_DESCRIPTORS       8
+#define MAX_NUMBER_OF_DESCRIPTORS  0xFFF8	/* 13 bits in RDLEN/TDLEN, 128B aligned     */
+
 #define IXGB_DELAY_BEFORE_RESET        10	/* allow 10ms after idling rx/tx units      */
 #define IXGB_DELAY_AFTER_RESET          1	/* allow 1ms after the reset                */
 #define IXGB_DELAY_AFTER_EE_RESET      10	/* allow 10ms after the EEPROM reset        */
@@ -225,6 +244,9 @@
 /* CTRL0 Bit Masks */
 #define IXGB_CTRL0_LRST     0x00000008
 #define IXGB_CTRL0_JFE      0x00000010
+#define IXGB_CTRL0_XLE      0x00000020
+#define IXGB_CTRL0_MDCS     0x00000040
+#define IXGB_CTRL0_CMDC     0x00000080
 #define IXGB_CTRL0_SDP0     0x00040000
 #define IXGB_CTRL0_SDP1     0x00080000
 #define IXGB_CTRL0_SDP2     0x00100000
@@ -239,14 +261,36 @@
 #define IXGB_CTRL0_VME      0x40000000
 
 /* CTRL1 Bit Masks */
-
+#define IXGB_CTRL1_GPI0_EN     0x00000001
+#define IXGB_CTRL1_GPI1_EN     0x00000002
+#define IXGB_CTRL1_GPI2_EN     0x00000004
+#define IXGB_CTRL1_GPI3_EN     0x00000008
+#define IXGB_CTRL1_SDP4        0x00000010
+#define IXGB_CTRL1_SDP5        0x00000020
+#define IXGB_CTRL1_SDP6        0x00000040
+#define IXGB_CTRL1_SDP7        0x00000080
+#define IXGB_CTRL1_SDP4_DIR    0x00000100
+#define IXGB_CTRL1_SDP5_DIR    0x00000200
+#define IXGB_CTRL1_SDP6_DIR    0x00000400
+#define IXGB_CTRL1_SDP7_DIR    0x00000800
 #define IXGB_CTRL1_EE_RST      0x00002000
+#define IXGB_CTRL1_RO_DIS      0x00020000
+#define IXGB_CTRL1_PCIXHM_MASK 0x00C00000
+#define IXGB_CTRL1_PCIXHM_1_2  0x00000000
+#define IXGB_CTRL1_PCIXHM_5_8  0x00400000
+#define IXGB_CTRL1_PCIXHM_3_4  0x00800000
+#define IXGB_CTRL1_PCIXHM_7_8  0x00C00000
 
 /* STATUS Bit Masks */
 #define IXGB_STATUS_LU            0x00000002
-
+#define IXGB_STATUS_AIP           0x00000004
 #define IXGB_STATUS_TXOFF         0x00000010
-
+#define IXGB_STATUS_XAUIME        0x00000020
+#define IXGB_STATUS_RES           0x00000040
+#define IXGB_STATUS_RIS           0x00000080
+#define IXGB_STATUS_RIE           0x00000100
+#define IXGB_STATUS_RLF           0x00000200
+#define IXGB_STATUS_RRF           0x00000400
 #define IXGB_STATUS_PCI_SPD       0x00000800
 #define IXGB_STATUS_BUS64         0x00001000
 #define IXGB_STATUS_PCIX_MODE     0x00002000
@@ -254,31 +298,52 @@
 #define IXGB_STATUS_PCIX_SPD_66   0x00000000
 #define IXGB_STATUS_PCIX_SPD_100  0x00004000
 #define IXGB_STATUS_PCIX_SPD_133  0x00008000
+#define IXGB_STATUS_REV_ID_MASK   0x000F0000
+#define IXGB_STATUS_REV_ID_SHIFT  16
 
 /* EECD Bit Masks */
 #define IXGB_EECD_SK       0x00000001
 #define IXGB_EECD_CS       0x00000002
 #define IXGB_EECD_DI       0x00000004
 #define IXGB_EECD_DO       0x00000008
+#define IXGB_EECD_FWE_MASK 0x00000030
+#define IXGB_EECD_FWE_DIS  0x00000010
+#define IXGB_EECD_FWE_EN   0x00000020
 
 /* MFS */
 #define IXGB_MFS_SHIFT 16
 
 /* Interrupt Register Bit Masks (used for ICR, ICS, IMS, and IMC) */
 #define IXGB_INT_TXDW     0x00000001
+#define IXGB_INT_TXQE     0x00000002
 #define IXGB_INT_LSC      0x00000004
 #define IXGB_INT_RXSEQ    0x00000008
 #define IXGB_INT_RXDMT0   0x00000010
 #define IXGB_INT_RXO      0x00000040
 #define IXGB_INT_RXT0     0x00000080
+#define IXGB_INT_AUTOSCAN 0x00000200
+#define IXGB_INT_GPI0     0x00000800
+#define IXGB_INT_GPI1     0x00001000
+#define IXGB_INT_GPI2     0x00002000
+#define IXGB_INT_GPI3     0x00004000
 
 /* RCTL Bit Masks */
 #define IXGB_RCTL_RXEN        0x00000002
+#define IXGB_RCTL_SBP         0x00000004
 #define IXGB_RCTL_UPE         0x00000008
 #define IXGB_RCTL_MPE         0x00000010
+#define IXGB_RCTL_RDMTS_MASK  0x00000300
 #define IXGB_RCTL_RDMTS_1_2   0x00000000
+#define IXGB_RCTL_RDMTS_1_4   0x00000100
+#define IXGB_RCTL_RDMTS_1_8   0x00000200
+#define IXGB_RCTL_MO_MASK     0x00003000
+#define IXGB_RCTL_MO_47_36    0x00000000
+#define IXGB_RCTL_MO_46_35    0x00001000
+#define IXGB_RCTL_MO_45_34    0x00002000
+#define IXGB_RCTL_MO_43_32    0x00003000
 #define IXGB_RCTL_MO_SHIFT    12
 #define IXGB_RCTL_BAM         0x00008000
+#define IXGB_RCTL_BSIZE_MASK  0x00030000
 #define IXGB_RCTL_BSIZE_2048  0x00000000
 #define IXGB_RCTL_BSIZE_4096  0x00010000
 #define IXGB_RCTL_BSIZE_8192  0x00020000
@@ -286,27 +351,48 @@
 #define IXGB_RCTL_VFE         0x00040000
 #define IXGB_RCTL_CFIEN       0x00080000
 #define IXGB_RCTL_CFI         0x00100000
+#define IXGB_RCTL_RPDA_MASK   0x00600000
+#define IXGB_RCTL_RPDA_MC_MAC 0x00000000
+#define IXGB_RCTL_MC_ONLY     0x00400000
 #define IXGB_RCTL_CFF         0x00800000
 #define IXGB_RCTL_SECRC       0x04000000
+#define IXGB_RDT_FPDB         0x80000000
+
+#define IXGB_RCTL_IDLE_RX_UNIT 0
 
 /* FCRTL Bit Masks */
 #define IXGB_FCRTL_XONE       0x80000000
 
 /* RXDCTL Bit Masks */
+#define IXGB_RXDCTL_PTHRESH_MASK  0x000001FF
 #define IXGB_RXDCTL_PTHRESH_SHIFT 0
+#define IXGB_RXDCTL_HTHRESH_MASK  0x0003FE00
 #define IXGB_RXDCTL_HTHRESH_SHIFT 9
+#define IXGB_RXDCTL_WTHRESH_MASK  0x07FC0000
 #define IXGB_RXDCTL_WTHRESH_SHIFT 18
 
 /* RAIDC Bit Masks */
+#define IXGB_RAIDC_HIGHTHRS_MASK 0x0000003F
+#define IXGB_RAIDC_DELAY_MASK    0x000FF800
 #define IXGB_RAIDC_DELAY_SHIFT   11
+#define IXGB_RAIDC_POLL_MASK     0x1FF00000
 #define IXGB_RAIDC_POLL_SHIFT    20
 #define IXGB_RAIDC_RXT_GATE      0x40000000
 #define IXGB_RAIDC_EN            0x80000000
 
+#define IXGB_RAIDC_POLL_1000_INTERRUPTS_PER_SECOND      1220
+#define IXGB_RAIDC_POLL_5000_INTERRUPTS_PER_SECOND      244
+#define IXGB_RAIDC_POLL_10000_INTERRUPTS_PER_SECOND     122
+#define IXGB_RAIDC_POLL_20000_INTERRUPTS_PER_SECOND     61
+
 /* RXCSUM Bit Masks */
+#define IXGB_RXCSUM_IPOFL 0x00000100
 #define IXGB_RXCSUM_TUOFL 0x00000200
 
 /* RAH Bit Masks */
+#define IXGB_RAH_ASEL_MASK 0x00030000
+#define IXGB_RAH_ASEL_DEST 0x00000000
+#define IXGB_RAH_ASEL_SRC  0x00010000
 #define IXGB_RAH_AV        0x80000000
 
 /* TCTL Bit Masks */
@@ -314,64 +400,145 @@
 #define IXGB_TCTL_TXEN 0x00000002
 #define IXGB_TCTL_TPDE 0x00000004
 
+#define IXGB_TCTL_IDLE_TX_UNIT  0
+
 /* TXDCTL Bit Masks */
+#define IXGB_TXDCTL_PTHRESH_MASK  0x0000007F
+#define IXGB_TXDCTL_HTHRESH_MASK  0x00007F00
 #define IXGB_TXDCTL_HTHRESH_SHIFT 8
+#define IXGB_TXDCTL_WTHRESH_MASK  0x007F0000
+#define IXGB_TXDCTL_WTHRESH_SHIFT 16
 
 /* TSPMT Bit Masks */
+#define IXGB_TSPMT_TSMT_MASK   0x0000FFFF
+#define IXGB_TSPMT_TSPBP_MASK  0xFFFF0000
+#define IXGB_TSPMT_TSPBP_SHIFT 16
 
 /* PAP Bit Masks */
+#define IXGB_PAP_TXPC_MASK 0x0000FFFF
+#define IXGB_PAP_TXPV_MASK 0x000F0000
+#define IXGB_PAP_TXPV_10G  0x00000000
+#define IXGB_PAP_TXPV_1G   0x00010000
+#define IXGB_PAP_TXPV_2G   0x00020000
+#define IXGB_PAP_TXPV_3G   0x00030000
+#define IXGB_PAP_TXPV_4G   0x00040000
+#define IXGB_PAP_TXPV_5G   0x00050000
+#define IXGB_PAP_TXPV_6G   0x00060000
+#define IXGB_PAP_TXPV_7G   0x00070000
+#define IXGB_PAP_TXPV_8G   0x00080000
+#define IXGB_PAP_TXPV_9G   0x00090000
+#define IXGB_PAP_TXPV_WAN  0x000F0000
 
 /* PCSC1 Bit Masks */
+#define IXGB_PCSC1_LOOPBACK 0x00004000
 
 /* PCSC2 Bit Masks */
+#define IXGB_PCSC2_PCS_TYPE_MASK  0x00000003
+#define IXGB_PCSC2_PCS_TYPE_10GBX 0x00000001
 
 /* PCSS1 Bit Masks */
+#define IXGB_PCSS1_LOCAL_FAULT    0x00000080
+#define IXGB_PCSS1_RX_LINK_STATUS 0x00000004
 
 /* PCSS2 Bit Masks */
+#define IXGB_PCSS2_DEV_PRES_MASK 0x0000C000
+#define IXGB_PCSS2_DEV_PRES      0x00004000
+#define IXGB_PCSS2_TX_LF         0x00000800
+#define IXGB_PCSS2_RX_LF         0x00000400
+#define IXGB_PCSS2_10GBW         0x00000004
+#define IXGB_PCSS2_10GBX         0x00000002
+#define IXGB_PCSS2_10GBR         0x00000001
 
 /* XPCSS Bit Masks */
 #define IXGB_XPCSS_ALIGN_STATUS 0x00001000
+#define IXGB_XPCSS_PATTERN_TEST 0x00000800
+#define IXGB_XPCSS_LANE_3_SYNC  0x00000008
+#define IXGB_XPCSS_LANE_2_SYNC  0x00000004
+#define IXGB_XPCSS_LANE_1_SYNC  0x00000002
+#define IXGB_XPCSS_LANE_0_SYNC  0x00000001
 
 /* XPCSTC Bit Masks */
+#define IXGB_XPCSTC_BERT_TRIG       0x00200000
+#define IXGB_XPCSTC_BERT_SST        0x00100000
+#define IXGB_XPCSTC_BERT_PSZ_MASK   0x000C0000
+#define IXGB_XPCSTC_BERT_PSZ_SHIFT  17
+#define IXGB_XPCSTC_BERT_PSZ_INF    0x00000003
+#define IXGB_XPCSTC_BERT_PSZ_68     0x00000001
+#define IXGB_XPCSTC_BERT_PSZ_1028   0x00000000
 
 /* MSCA bit Masks */
 /* New Protocol Address */
+#define IXGB_MSCA_NP_ADDR_MASK      0x0000FFFF
 #define IXGB_MSCA_NP_ADDR_SHIFT     0
 /* Either Device Type or Register Address,depending on ST_CODE */
+#define IXGB_MSCA_DEV_TYPE_MASK     0x001F0000
 #define IXGB_MSCA_DEV_TYPE_SHIFT    16
+#define IXGB_MSCA_PHY_ADDR_MASK     0x03E00000
 #define IXGB_MSCA_PHY_ADDR_SHIFT    21
+#define IXGB_MSCA_OP_CODE_MASK      0x0C000000
+/* OP_CODE == 00, Address cycle, New Protocol           */
+/* OP_CODE == 01, Write operation                       */
+/* OP_CODE == 10, Read operation                        */
+/* OP_CODE == 11, Read, auto increment, New Protocol    */
 #define IXGB_MSCA_ADDR_CYCLE        0x00000000
 #define IXGB_MSCA_WRITE             0x04000000
 #define IXGB_MSCA_READ              0x08000000
+#define IXGB_MSCA_READ_AUTOINC      0x0C000000
+#define IXGB_MSCA_OP_CODE_SHIFT     26
+#define IXGB_MSCA_ST_CODE_MASK      0x30000000
+/* ST_CODE == 00, New Protocol  */
+/* ST_CODE == 01, Old Protocol  */
+#define IXGB_MSCA_NEW_PROTOCOL      0x00000000
+#define IXGB_MSCA_OLD_PROTOCOL      0x10000000
+#define IXGB_MSCA_ST_CODE_SHIFT     28
 /* Initiate command, self-clearing when command completes */
 #define IXGB_MSCA_MDI_COMMAND       0x40000000
 /*MDI In Progress Enable. */
+#define IXGB_MSCA_MDI_IN_PROG_EN    0x80000000
 
 /* MSRWD bit masks */
+#define IXGB_MSRWD_WRITE_DATA_MASK  0x0000FFFF
+#define IXGB_MSRWD_WRITE_DATA_SHIFT 0
+#define IXGB_MSRWD_READ_DATA_MASK   0xFFFF0000
 #define IXGB_MSRWD_READ_DATA_SHIFT  16
 
-/* Definitions for the TXN17401 devices on the MDIO bus. */
+/* Definitions for the optics devices on the MDIO bus. */
 #define IXGB_PHY_ADDRESS             0x0	/* Single PHY, multiple "Devices" */
 
-/* Five bit Device IDs */
-#define TXN17401_PMA_PMD_DID    0x01
-#define TXN17401_PCS_DID        0x03
-#define TXN17401_XGXS_DID       0x04
+/* Standard five-bit Device IDs.  See IEEE 802.3ae, clause 45 */
+#define MDIO_PMA_PMD_DID        0x01
+#define MDIO_WIS_DID            0x02
+#define MDIO_PCS_DID            0x03
+#define MDIO_XGXS_DID           0x04
 
-/* PMA/PMD registers and bit definitions. */
+/* Standard PMA/PMD registers and bit definitions. */
 /* Note: This is a very limited set of definitions,      */
 /* only implemented features are defined.                */
-#define TXN17401_PMA_PMD_CR1        0x0000
+#define MDIO_PMA_PMD_CR1        0x0000
+#define MDIO_PMA_PMD_CR1_RESET  0x8000
 
-#define TXN17401_PMA_PMD_CR1_RESET  0x8000
+#define MDIO_PMA_PMD_XPAK_VENDOR_NAME       0x803A	/* XPAK/XENPAK devices only */
 
+/* Vendor-specific MDIO registers */
+#define G6XXX_PMA_PMD_VS1                   0xC001	/* Vendor-specific register */
+#define G6XXX_XGXS_XAUI_VS2                 0x18	/* Vendor-specific register */
+
+#define G6XXX_PMA_PMD_VS1_PLL_RESET         0x80
+#define G6XXX_PMA_PMD_VS1_REMOVE_PLL_RESET  0x00
+#define G6XXX_XGXS_XAUI_VS2_INPUT_MASK      0x0F	/* XAUI lanes synchronized */
+
+/* Layout of a single receive descriptor.  The controller assumes that this
+ * structure is packed into 16 bytes, which is a safe assumption with most
+ * compilers.  However, some compilers may insert padding between the fields,
+ * in which case the structure must be packed in some compiler-specific
+ * manner. */
 struct ixgb_rx_desc {
 	uint64_t buff_addr;
-	u16 length;
-	u16 reserved;
-	u8 status;
-	u8 errors;
-	u16 special;
+	uint16_t length;
+	uint16_t reserved;
+	uint8_t status;
+	uint8_t errors;
+	uint16_t special;
 };
 
 #define IXGB_RX_DESC_STATUS_DD    0x01
@@ -379,23 +546,38 @@
 #define IXGB_RX_DESC_STATUS_IXSM  0x04
 #define IXGB_RX_DESC_STATUS_VP    0x08
 #define IXGB_RX_DESC_STATUS_TCPCS 0x20
+#define IXGB_RX_DESC_STATUS_IPCS  0x40
+#define IXGB_RX_DESC_STATUS_PIF   0x80
 
 #define IXGB_RX_DESC_ERRORS_CE   0x01
 #define IXGB_RX_DESC_ERRORS_SE   0x02
 #define IXGB_RX_DESC_ERRORS_P    0x08
 #define IXGB_RX_DESC_ERRORS_TCPE 0x20
+#define IXGB_RX_DESC_ERRORS_IPE  0x40
 #define IXGB_RX_DESC_ERRORS_RXE  0x80
 
 #define IXGB_RX_DESC_SPECIAL_VLAN_MASK  0x0FFF	/* VLAN ID is in lower 12 bits */
+#define IXGB_RX_DESC_SPECIAL_PRI_MASK   0xE000	/* Priority is in upper 3 bits */
+#define IXGB_RX_DESC_SPECIAL_PRI_SHIFT  0x000D	/* Priority is in upper 3 of 16 */
 
+/* Layout of a single transmit descriptor.  The controller assumes that this
+ * structure is packed into 16 bytes, which is a safe assumption with most
+ * compilers.  However, some compilers may insert padding between the fields,
+ * in which case the structure must be packed in some compiler-specific
+ * manner. */
 struct ixgb_tx_desc {
 	uint64_t buff_addr;
-	u32 cmd_type_len;
-	u8 status;
-	u8 popts;
-	u16 vlan;
+	uint32_t cmd_type_len;
+	uint8_t status;
+	uint8_t popts;
+	uint16_t vlan;
 };
 
+#define IXGB_TX_DESC_LENGTH_MASK    0x000FFFFF
+#define IXGB_TX_DESC_TYPE_MASK      0x00F00000
+#define IXGB_TX_DESC_TYPE_SHIFT     20
+#define IXGB_TX_DESC_CMD_MASK       0xFF000000
+#define IXGB_TX_DESC_CMD_SHIFT      24
 #define IXGB_TX_DESC_CMD_EOP        0x01000000
 #define IXGB_TX_DESC_CMD_TSE        0x04000000
 #define IXGB_TX_DESC_CMD_RS         0x08000000
@@ -408,18 +590,19 @@
 
 #define IXGB_TX_DESC_POPTS_IXSM 0x01
 #define IXGB_TX_DESC_POPTS_TXSM 0x02
+#define IXGB_TX_DESC_SPECIAL_PRI_SHIFT  IXGB_RX_DESC_SPECIAL_PRI_SHIFT	/* Priority is in upper 3 of 16 */
 
 struct ixgb_context_desc {
-	u8 ipcss;
-	u8 ipcso;
-	u16 ipcse;
-	u8 tucss;
-	u8 tucso;
-	u16 tucse;
-	u32 cmd_type_len;
-	u8 status;
-	u8 hdr_len;
-	u16 mss;
+	uint8_t ipcss;
+	uint8_t ipcso;
+	uint16_t ipcse;
+	uint8_t tucss;
+	uint8_t tucso;
+	uint16_t tucse;
+	uint32_t cmd_type_len;
+	uint8_t status;
+	uint8_t hdr_len;
+	uint16_t mss;
 };
 
 #define IXGB_CONTEXT_DESC_CMD_TCP 0x01000000
@@ -430,11 +613,14 @@
 
 #define IXGB_CONTEXT_DESC_TYPE 0x00000000
 
+#define IXGB_CONTEXT_DESC_STATUS_DD 0x01
+
 /* Filters */
 #define IXGB_RAR_ENTRIES          16	/* Number of entries in Rx Address array */
 #define IXGB_MC_TBL_SIZE          128	/* Multicast Filter Table (4096 bits) */
 #define IXGB_VLAN_FILTER_TBL_SIZE 128	/* VLAN Filter Table (4096 bits) */
 
+#define IXGB_MEMORY_REGISTER_BASE_ADDRESS   0
 #define ENET_HEADER_SIZE            14
 #define ENET_FCS_LENGTH             4
 #define IXGB_MAX_NUM_MULTICAST_ADDRESSES    128
@@ -443,29 +629,46 @@
 #define IXGB_MAX_JUMBO_FRAME_SIZE       0x3F00
 
 /* Phy Addresses */
+#define IXGB_OPTICAL_PHY_ADDR 0x0	/* Optical Module phy address */
+#define IXGB_XAUII_PHY_ADDR   0x1	/* Xauii transceiver phy address */
+#define IXGB_DIAG_PHY_ADDR    0x1F	/* Diagnostic Device phy address */
+
+/* This structure takes a 64k flash and maps it for identification commands */
+struct ixgb_flash_buffer {
+	uint8_t manufacturer_id;
+	uint8_t device_id;
+	uint8_t filler1[0x2AA8];
+	uint8_t cmd2;
+	uint8_t filler2[0x2AAA];
+	uint8_t cmd1;
+	uint8_t filler3[0xAAAA];
+};
 
 /*
  * This is a little-endian specific check.
  */
 #define IS_MULTICAST(Address) \
-    (boolean_t)(((u8 *)(Address))[0] & ((u8)0x01))
+    (boolean_t)(((uint8_t *)(Address))[0] & ((uint8_t)0x01))
 
 /*
  * Check whether an address is broadcast.
  */
 #define IS_BROADCAST(Address)               \
-    ((((u8 *)(Address))[0] == ((u8)0xff)) && (((u8 *)(Address))[1] == ((u8)0xff)))
+    ((((uint8_t *)(Address))[0] == ((uint8_t)0xff)) && (((uint8_t *)(Address))[1] == ((uint8_t)0xff)))
 
 /* Flow control parameters */
 struct ixgb_fc {
-	u32 high_water;	/* Flow Control High-water          */
-	u32 low_water;	/* Flow Control Low-water           */
-	u16 pause_time;	/* Flow Control Pause timer         */
+	uint32_t high_water;	/* Flow Control High-water          */
+	uint32_t low_water;	/* Flow Control Low-water           */
+	uint16_t pause_time;	/* Flow Control Pause timer         */
 	boolean_t send_xon;	/* Flow control send XON            */
 	ixgb_fc_type type;	/* Type of flow control             */
 };
 
 /* The historical defaults for the flow control values are given below. */
+#define FC_DEFAULT_HI_THRESH        (0x8000)	/* 32KB */
+#define FC_DEFAULT_LO_THRESH        (0x4000)	/* 16KB */
+#define FC_DEFAULT_TX_TIMER         (0x100)	/* ~130 us */
 
 /* Phy definitions */
 #define IXGB_MAX_PHY_REG_ADDRESS    0xFFFF
@@ -480,32 +683,40 @@
 };
 
 struct ixgb_hw {
-	u8 *hw_addr;	/* Base Address of the hardware     */
+	uint8_t *hw_addr;	/* Base Address of the hardware     */
 	void *back;		/* Pointer to OS-dependent struct   */
 	struct ixgb_fc fc;	/* Flow control parameters          */
 	struct ixgb_bus bus;	/* Bus parameters                   */
-	u32 phy_id;	/* Phy Identifier                   */
-	u32 phy_addr;	/* XGMII address of Phy             */
+	uint32_t phy_id;	/* Phy Identifier                   */
+	uint32_t phy_addr;	/* XGMII address of Phy             */
 	ixgb_mac_type mac_type;	/* Identifier for MAC controller    */
-	u32 max_frame_size;	/* Maximum frame size supported     */
-	u32 mc_filter_type;	/* Multicast filter hash type       */
-	u32 num_mc_addrs;	/* Number of current Multicast addrs */
-	u8 curr_mac_addr[IXGB_ETH_LENGTH_OF_ADDRESS];	/* Individual address currently programmed in MAC */
-	u32 num_tx_desc;	/* Number of Transmit descriptors   */
-	u32 num_rx_desc;	/* Number of Receive descriptors    */
-	u32 rx_buffer_size;	/* Size of Receive buffer           */
+	ixgb_phy_type phy_type;	/* Transceiver/phy identifier       */
+	uint32_t max_frame_size;	/* Maximum frame size supported     */
+	uint32_t mc_filter_type;	/* Multicast filter hash type       */
+	uint32_t num_mc_addrs;	/* Number of current Multicast addrs */
+	uint8_t curr_mac_addr[IXGB_ETH_LENGTH_OF_ADDRESS];	/* Individual address currently programmed in MAC */
+	uint32_t num_tx_desc;	/* Number of Transmit descriptors   */
+	uint32_t num_rx_desc;	/* Number of Receive descriptors    */
+	uint32_t rx_buffer_size;	/* Size of Receive buffer           */
 	boolean_t link_up;	/* TRUE if link is valid            */
 	boolean_t adapter_stopped;	/* State of adapter                 */
-	u16 device_id;	/* device id from PCI configuration space */
-	u16 vendor_id;	/* vendor id from PCI configuration space */
-	u16 subsystem_vendor_id;	/* subsystem vendor id from PCI configuration space */
-	u16 subsystem_id;	/* subsystem id from PCI configuration space */
-	u16 eeprom[IXGB_EEPROM_SIZE];	/* EEPROM contents read at init time  */
-	uint64_t io_base;	/* Our I/O mapped location */
-	u32 lastLFC;
-	u32 lastRFC;
+	uint16_t device_id;	/* device id from PCI configuration space */
+	uint16_t vendor_id;	/* vendor id from PCI configuration space */
+	uint8_t revision_id;	/* revision id from PCI configuration space */
+	uint16_t subsystem_vendor_id;	/* subsystem vendor id from PCI configuration space */
+	uint16_t subsystem_id;	/* subsystem id from PCI configuration space */
+	uint32_t bar0;		/* Base Address registers           */
+	uint32_t bar1;
+	uint32_t bar2;
+	uint32_t bar3;
+	uint16_t pci_cmd_word;	/* PCI command register id from PCI configuration space */
+	uint16_t eeprom[IXGB_EEPROM_SIZE];	/* EEPROM contents read at init time  */
+	unsigned long io_base;	/* Our I/O mapped location */
+	uint32_t lastLFC;
+	uint32_t lastRFC;
 };
 
+/* Statistics reported by the hardware */
 struct ixgb_hw_stats {
 	uint64_t tprl;
 	uint64_t tprh;
@@ -578,48 +789,49 @@
 extern boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw);
 extern boolean_t ixgb_setup_fc(struct ixgb_hw *hw);
 extern void ixgb_clear_hw_cntrs(struct ixgb_hw *hw);
-extern boolean_t mac_addr_valid(u8 * mac_addr);
+extern boolean_t mac_addr_valid(uint8_t * mac_addr);
 
-extern u16 ixgb_read_phy_reg(struct ixgb_hw *hw,
-				  u32 reg_addr,
-				  u32 phy_addr, u32 device_type);
+extern uint16_t ixgb_read_phy_reg(struct ixgb_hw *hw,
+				  uint32_t reg_addr,
+				  uint32_t phy_addr, uint32_t device_type);
 
 extern void ixgb_write_phy_reg(struct ixgb_hw *hw,
-			       u32 reg_addr,
-			       u32 phy_addr,
-			       u32 device_type, u16 data);
+			       uint32_t reg_addr,
+			       uint32_t phy_addr,
+			       uint32_t device_type, uint16_t data);
 
-extern void ixgb_rar_set(struct ixgb_hw *hw, u8 * addr, u32 index);
+extern void ixgb_rar_set(struct ixgb_hw *hw, uint8_t * addr, uint32_t index);
 
 /* Filters (multicast, vlan, receive) */
 extern void ixgb_mc_addr_list_update(struct ixgb_hw *hw,
-				     u8 * mc_addr_list,
-				     u32 mc_addr_count, u32 pad);
+				     uint8_t * mc_addr_list,
+				     uint32_t mc_addr_count, uint32_t pad);
 
 /* Vfta functions */
 extern void ixgb_write_vfta(struct ixgb_hw *hw,
-			    u32 offset, u32 value);
+			    uint32_t offset, uint32_t value);
 
 extern void ixgb_clear_vfta(struct ixgb_hw *hw);
 
 /* Access functions to eeprom data */
-void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, u8 * mac_addr);
-u16 ixgb_get_ee_compatibility(struct ixgb_hw *hw);
-u32 ixgb_get_ee_pba_number(struct ixgb_hw *hw);
-u16 ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw *hw);
-u16 ixgb_get_ee_init_ctrl_reg_2(struct ixgb_hw *hw);
-u16 ixgb_get_ee_subsystem_id(struct ixgb_hw *hw);
-u16 ixgb_get_ee_subvendor_id(struct ixgb_hw *hw);
-u16 ixgb_get_ee_device_id(struct ixgb_hw *hw);
-u16 ixgb_get_ee_vendor_id(struct ixgb_hw *hw);
-u16 ixgb_get_ee_swdpins_reg(struct ixgb_hw *hw);
-u8 ixgb_get_ee_d3_power(struct ixgb_hw *hw);
-u8 ixgb_get_ee_d0_power(struct ixgb_hw *hw);
+void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t * mac_addr);
+uint16_t ixgb_get_ee_compatibility(struct ixgb_hw *hw);
+uint32_t ixgb_get_ee_pba_number(struct ixgb_hw *hw);
+uint16_t ixgb_get_ee_init_ctrl_reg_1(struct ixgb_hw *hw);
+uint16_t ixgb_get_ee_init_ctrl_reg_2(struct ixgb_hw *hw);
+uint16_t ixgb_get_ee_subsystem_id(struct ixgb_hw *hw);
+uint16_t ixgb_get_ee_subvendor_id(struct ixgb_hw *hw);
+uint16_t ixgb_get_ee_device_id(struct ixgb_hw *hw);
+uint16_t ixgb_get_ee_vendor_id(struct ixgb_hw *hw);
+uint16_t ixgb_get_ee_swdpins_reg(struct ixgb_hw *hw);
+uint8_t ixgb_get_ee_d3_power(struct ixgb_hw *hw);
+uint8_t ixgb_get_ee_d0_power(struct ixgb_hw *hw);
 boolean_t ixgb_get_eeprom_data(struct ixgb_hw *hw);
+uint16_t ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index);
 
 /* Everything else */
 void ixgb_led_on(struct ixgb_hw *hw);
 void ixgb_led_off(struct ixgb_hw *hw);
-void ixgb_write_pci_cfg(struct ixgb_hw *hw, u32 reg, u16 * value);
+void ixgb_write_pci_cfg(struct ixgb_hw *hw, uint32_t reg, uint16_t * value);
 
 #endif				/* _IXGB_HW_H_ */
diff -Nru a/drivers/net/ixgb/ixgb_ids.h b/drivers/net/ixgb/ixgb_ids.h
--- a/drivers/net/ixgb/ixgb_ids.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/ixgb/ixgb_ids.h	Tue Jun 15 22:20:40 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,6 +23,7 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
 #ifndef _IXGB_IDS_H_
@@ -35,9 +36,17 @@
 #define INTEL_VENDOR_ID         0x8086
 #define INTEL_SUBVENDOR_ID      0x8086
 
-#define IXGB_DEVICE_ID_82597EX 	0x1048
-#define IXGB_SUBDEVICE_ID_A11F  0xA11F	/* Adapter-OEM-1310nm-Fiber */
-#define IXGB_SUBDEVICE_ID_A01F	0xA01F	/* Adapter-Retail-1310nm-Fiber */
+#define IXGB_DEVICE_ID_82597EX      0x1048
+#define IXGB_DEVICE_ID_82597EX_SR   0x1A48
+
+#define IXGB_SUBDEVICE_ID_A11F  0xA11F
+#define IXGB_SUBDEVICE_ID_A01F  0xA01F
+
+#define IXGB_SUBDEVICE_ID_A15F  0xA15F
+#define IXGB_SUBDEVICE_ID_A05F  0xA05F
+
+#define IXGB_SUBDEVICE_ID_A12F  0xA12F
+#define IXGB_SUBDEVICE_ID_A02F  0xA02F
 
 #endif				/* #ifndef _IXGB_IDS_H_ */
 
diff -Nru a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
--- a/drivers/net/ixgb/ixgb_main.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/ixgb/ixgb_main.c	Tue Jun 15 22:20:37 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,36 +23,29 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
-*******************************************************************************/
 
-#define __IXGB_MAIN__
+*******************************************************************************/
 
 #include "ixgb.h"
 
 char ixgb_driver_name[] = "ixgb";
 char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
-char ixgb_driver_version[] = "1.0.47-k1jg";
-char ixgb_copyright[] = "Copyright (c) 2001-2003 Intel Corporation.";
+char ixgb_driver_version[] = "1.0.66";
+char ixgb_copyright[] = "Copyright (c) 2001-2004 Intel Corporation.";
 
 /* ixgb_pci_tbl - PCI Device ID Table
  *
- * For selecting devices to load on private driver_data field (last one) 
- * stores an index into ixgb_strings.
  * Wildcard entries (PCI_ANY_ID) should come last
  * Last entry must be all 0s
  *
  * { Vendor ID, Device ID, SubVendor ID, SubDevice ID,
- *   Class, Class Mask, String Index }
+ *   Class, Class Mask, private data (not used) }
  */
 static struct pci_device_id ixgb_pci_tbl[] = {
-	/* Intel(R) PRO/10GbE Network Connection */
-	{INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX,
-	 INTEL_SUBVENDOR_ID, IXGB_SUBDEVICE_ID_A11F, 0, 0, 0},
-	{INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX,
-	 INTEL_SUBVENDOR_ID, IXGB_SUBDEVICE_ID_A01F, 0, 0, 0},
-	/* Generic */
 	{INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+	{INTEL_VENDOR_ID, IXGB_DEVICE_ID_82597EX_SR,
+	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 
 	/* required last entry */
 	{0,}
@@ -60,10 +53,6 @@
 
 MODULE_DEVICE_TABLE(pci, ixgb_pci_tbl);
 
-static char *ixgb_strings[] = {
-	"Intel(R) PRO/10GbE Network Connection"
-};
-
 /* Local Function Prototypes */
 
 int ixgb_up(struct ixgb_adapter *adapter);
@@ -73,8 +62,8 @@
 static int ixgb_init_module(void);
 static void ixgb_exit_module(void);
 static int ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
-static void ixgb_remove(struct pci_dev *pdev);
-static void ixgb_sw_init(struct ixgb_adapter *adapter);
+static void __devexit ixgb_remove(struct pci_dev *pdev);
+static int ixgb_sw_init(struct ixgb_adapter *adapter);
 static int ixgb_open(struct net_device *netdev);
 static int ixgb_close(struct net_device *netdev);
 static int ixgb_setup_tx_resources(struct ixgb_adapter *adapter);
@@ -88,16 +77,7 @@
 static void ixgb_free_rx_resources(struct ixgb_adapter *adapter);
 static void ixgb_set_multi(struct net_device *netdev);
 static void ixgb_watchdog(unsigned long data);
-static inline boolean_t ixgb_tso(struct ixgb_adapter *adapter,
-				 struct sk_buff *skb);
 static int ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
-static void ixgb_tx_timeout(struct net_device *netdev);
-static void ixgb_tx_timeout_task(struct net_device *netdev);
-static void ixgb_vlan_rx_register(struct net_device *netdev,
-				  struct vlan_group *grp);
-static void ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
-static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
-static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
 static struct net_device_stats *ixgb_get_stats(struct net_device *netdev);
 static int ixgb_change_mtu(struct net_device *netdev, int new_mtu);
 static int ixgb_set_mac(struct net_device *netdev, void *p);
@@ -105,25 +85,40 @@
 static inline void ixgb_irq_disable(struct ixgb_adapter *adapter);
 static inline void ixgb_irq_enable(struct ixgb_adapter *adapter);
 static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs);
-static void ixgb_clean_tx_irq(struct ixgb_adapter *adapter);
+static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter);
 #ifdef CONFIG_IXGB_NAPI
-static int ixgb_poll(struct net_device *netdev, int *budget);
+static int ixgb_clean(struct net_device *netdev, int *budget);
+static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
+				   int *work_done, int work_to_do);
 #else
-static void ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
+static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
 #endif
 static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter);
 static int ixgb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
 static inline void ixgb_rx_checksum(struct ixgb_adapter *adapter,
 				    struct ixgb_rx_desc *rx_desc,
 				    struct sk_buff *skb);
+static void ixgb_tx_timeout(struct net_device *dev);
+static void ixgb_tx_timeout_task(struct net_device *dev);
+static void ixgb_vlan_rx_register(struct net_device *netdev,
+				  struct vlan_group *grp);
+static void ixgb_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
+static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
+static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
+
 static int ixgb_notify_reboot(struct notifier_block *, unsigned long event,
 			      void *ptr);
-static int ixgb_suspend(struct pci_dev *pdev, u32 state);
+static int ixgb_suspend(struct pci_dev *pdev, uint32_t state);
+
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/* for netdump / net console */
+static void ixgb_netpoll(struct net_device *dev);
+#endif
 
 struct notifier_block ixgb_notifier_reboot = {
-	.notifier_call	= ixgb_notify_reboot,
-	.next		= NULL,
-	.priority	= 0
+	.notifier_call = ixgb_notify_reboot,
+	.next = NULL,
+	.priority = 0
 };
 
 /* Exported from other modules */
@@ -132,13 +127,13 @@
 extern int ixgb_ethtool_ioctl(struct net_device *netdev, struct ifreq *ifr);
 
 static struct pci_driver ixgb_driver = {
-	.name		= ixgb_driver_name,
-	.id_table	= ixgb_pci_tbl,
-	.probe		= ixgb_probe,
-	.remove		= __devexit_p(ixgb_remove),
+	.name = ixgb_driver_name,
+	.id_table = ixgb_pci_tbl,
+	.probe = ixgb_probe,
+	.remove = __devexit_p(ixgb_remove),
 	/* Power Managment Hooks */
-	.suspend	= NULL,
-	.resume		= NULL
+	.suspend = NULL,
+	.resume = NULL
 };
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
@@ -152,24 +147,20 @@
 #define RXDCTL_WTHRESH_DEFAULT 16	/* chip writes back at this many or RXT0 */
 
 /**
- * ixgb_init_module - Driver Registration Routine.
+ * ixgb_init_module - Driver Registration Routine
  *
  * ixgb_init_module is the first routine called when the driver is
  * loaded. All it does is register with the PCI subsystem.
  **/
 
-static int __init
-ixgb_init_module(void)
+static int __init ixgb_init_module(void)
 {
 	int ret;
-	IXGB_DBG("ixgb_init_module\n");
+	printk(KERN_INFO "%s - version %s\n",
+	       ixgb_driver_string, ixgb_driver_version);
 
-	printk(KERN_INFO "%s - version %s\n", ixgb_driver_string,
-	       ixgb_driver_version);
 	printk(KERN_INFO "%s\n", ixgb_copyright);
-#ifdef CONFIG_IXGB_NAPI
-	printk(KERN_INFO "NAPI Enabled\n");
-#endif
+
 	ret = pci_module_init(&ixgb_driver);
 	if (ret >= 0) {
 		register_reboot_notifier(&ixgb_notifier_reboot);
@@ -180,47 +171,31 @@
 module_init(ixgb_init_module);
 
 /**
- * ixgb_exit_module - Driver Exit Cleanup Routine.
+ * ixgb_exit_module - Driver Exit Cleanup Routine
  *
  * ixgb_exit_module is called just before the driver is removed
  * from memory.
  **/
 
-static void __exit
-ixgb_exit_module(void)
+static void __exit ixgb_exit_module(void)
 {
-
-	IXGB_DBG("ixgb_exit_module\n");
 	unregister_reboot_notifier(&ixgb_notifier_reboot);
 	pci_unregister_driver(&ixgb_driver);
 }
 
 module_exit(ixgb_exit_module);
 
-/**
- * ixgb_up - Driver ifconfig UP routine.
- *
- * ixgb_up is called to initialize and bring online an interface.
- * @param adapter board private structure
- **/
-
-int
-ixgb_up(struct ixgb_adapter *adapter)
+int ixgb_up(struct ixgb_adapter *adapter)
 {
 	struct net_device *netdev = adapter->netdev;
+	int err;
+	int max_frame = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
+	struct ixgb_hw *hw = &adapter->hw;
 
-	IXGB_DBG("ixgb_up\n");
+	/* hardware has been reset, we need to reload some things */
 
-	if (request_irq(netdev->irq, &ixgb_intr, SA_SHIRQ | SA_SAMPLE_RANDOM,
-			netdev->name, netdev)) {
-		IXGB_DBG("%s: request_irq failed\n", netdev->name);
-		return -1;
-	}
-	/* disable interrupts and get the hardware into a known state */
-	IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
-
-	/* hardware was reset in probe/down, we need to reload some things */
 	ixgb_set_multi(netdev);
+
 	ixgb_restore_vlan(adapter);
 
 	ixgb_configure_tx(adapter);
@@ -228,31 +203,45 @@
 	ixgb_configure_rx(adapter);
 	ixgb_alloc_rx_buffers(adapter);
 
+	if ((err = request_irq(adapter->pdev->irq, &ixgb_intr,
+			       SA_SHIRQ | SA_SAMPLE_RANDOM,
+			       netdev->name, netdev)))
+		return err;
+
+	/* disable interrupts and get the hardware into a known state */
+	IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff);
+
+	if ((hw->max_frame_size != max_frame) ||
+	    (hw->max_frame_size !=
+	     (IXGB_READ_REG(hw, MFS) >> IXGB_MFS_SHIFT))) {
+
+		hw->max_frame_size = max_frame;
+
+		IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT);
+
+		if (hw->max_frame_size >
+		    IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) {
+			uint32_t ctrl0 = IXGB_READ_REG(hw, CTRL0);
+
+			if (!(ctrl0 & IXGB_CTRL0_JFE)) {
+				ctrl0 |= IXGB_CTRL0_JFE;
+				IXGB_WRITE_REG(hw, CTRL0, ctrl0);
+			}
+		}
+	}
+
 	mod_timer(&adapter->watchdog_timer, jiffies);
 	ixgb_irq_enable(adapter);
 
-	IXGB_DBG("ixgb_up: RAH_0 is <%x>\n", IXGB_READ_REG(&adapter->hw, RAH));
-	IXGB_DBG("ixgb_up: RDBAL is <%x>\n",
-		 IXGB_READ_REG(&adapter->hw, RDBAL));
 	return 0;
 }
 
-/**
- * ixgb_down - Driver ifconfig DOWN routine.
- *
- * ixgb_down is called to uninitialize and take offline an interface.
- * @param adapter board private structure
- * @param kill_watchdog
- **/
-void
-ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
+void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
 {
 	struct net_device *netdev = adapter->netdev;
 
-	IXGB_DBG("ixgb_down\n");
-
 	ixgb_irq_disable(adapter);
-	free_irq(netdev->irq, netdev);
+	free_irq(adapter->pdev->irq, netdev);
 	if (kill_watchdog)
 		del_timer_sync(&adapter->watchdog_timer);
 	adapter->link_speed = 0;
@@ -261,21 +250,12 @@
 	netif_stop_queue(netdev);
 
 	ixgb_reset(adapter);
-
 	ixgb_clean_tx_ring(adapter);
 	ixgb_clean_rx_ring(adapter);
 }
 
-/**
- * ixgb_reset - hardware reset.
- *
- * ixgb_reset is called to initialize hardware to a known state.
- * @param adapter board private structure
- **/
-void
-ixgb_reset(struct ixgb_adapter *adapter)
+void ixgb_reset(struct ixgb_adapter *adapter)
 {
-	IXGB_DBG("ixgb_reset\n");
 
 	ixgb_adapter_stop(&adapter->hw);
 	if (!ixgb_init_hw(&adapter->hw))
@@ -283,11 +263,15 @@
 }
 
 /**
- * ixgb_probe - Device Initialization Routine.
- * @param pdev PCI device information struct
- * @param ent entry in ixgb_pci_table
+ * ixgb_probe - Device Initialization Routine
+ * @pdev: PCI device information struct
+ * @ent: entry in ixgb_pci_tbl
  *
  * Returns 0 on success, negative on failure
+ *
+ * ixgb_probe initializes an adapter identified by a pci_dev structure.
+ * The OS initialization, configuring of the adapter private structure,
+ * and a hardware reset occur.
  **/
 
 static int __devinit
@@ -300,35 +284,29 @@
 	int mmio_len;
 	int pci_using_dac;
 	int i;
+	int err;
 
-	IXGB_DBG("ixgb_probe\n");
+	if ((err = pci_enable_device(pdev)))
+		return err;
 
-	if ((i = pci_enable_device(pdev))) {
-		IXGB_ERR("pci_enable_device failed\n");
-		return i;
-	}
-
-	if (!(i = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
+	if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
 		pci_using_dac = 1;
 	} else {
-		if ((i = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
+		if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
 			IXGB_ERR("No usable DMA configuration, aborting\n");
-			return i;
+			return err;
 		}
 		pci_using_dac = 0;
 	}
 
-	if ((i = pci_request_regions(pdev, ixgb_driver_name))) {
-		IXGB_ERR("Failed to reserve PCI I/O and Memory resources.\n");
-		return i;
-	}
+	if ((err = pci_request_regions(pdev, ixgb_driver_name)))
+		return err;
 
 	pci_set_master(pdev);
 
-	/* alloc_etherdev clears the memory for us */
-	netdev = alloc_etherdev(sizeof (struct ixgb_adapter));
+	netdev = alloc_etherdev(sizeof(struct ixgb_adapter));
 	if (!netdev) {
-		IXGB_ERR("Unable to allocate net_device struct\n");
+		err = -ENOMEM;
 		goto err_alloc_etherdev;
 	}
 
@@ -345,8 +323,10 @@
 	mmio_len = pci_resource_len(pdev, BAR_0);
 
 	adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
-	if (!adapter->hw.hw_addr)
+	if (!adapter->hw.hw_addr) {
+		err = -EIO;
 		goto err_ioremap;
+	}
 
 	for (i = BAR_1; i <= BAR_5; i++) {
 		if (pci_resource_len(pdev, i) == 0)
@@ -356,8 +336,6 @@
 			break;
 		}
 	}
-	IXGB_DBG("mmio_start<%lx> hw_addr<%p>\n", mmio_start,
-		 adapter->hw.hw_addr);
 
 	netdev->open = &ixgb_open;
 	netdev->stop = &ixgb_close;
@@ -370,25 +348,28 @@
 	netdev->tx_timeout = &ixgb_tx_timeout;
 	netdev->watchdog_timeo = HZ;
 #ifdef CONFIG_IXGB_NAPI
-	netdev->poll = &ixgb_poll;
+	netdev->poll = &ixgb_clean;
 	netdev->weight = 64;
 #endif
 	netdev->vlan_rx_register = ixgb_vlan_rx_register;
 	netdev->vlan_rx_add_vid = ixgb_vlan_rx_add_vid;
 	netdev->vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	netdev->poll_controller = ixgb_netpoll;
+#endif
 
-	netdev->irq = pdev->irq;
 	netdev->mem_start = mmio_start;
 	netdev->mem_end = mmio_start + mmio_len;
 	netdev->base_addr = adapter->hw.io_base;
 
 	adapter->bd_number = cards_found;
-	adapter->id_string = ixgb_strings[ent->driver_data];
 	adapter->link_speed = 0;
 	adapter->link_duplex = 0;
 
 	/* setup the private structure */
-	ixgb_sw_init(adapter);
+
+	if ((err = ixgb_sw_init(adapter)))
+		goto err_sw_init;
 
 	netdev->features = NETIF_F_SG |
 	    NETIF_F_HW_CSUM |
@@ -403,57 +384,59 @@
 	/* make sure the EEPROM is good */
 
 	if (!ixgb_validate_eeprom_checksum(&adapter->hw)) {
-		IXGB_DBG("Invalid EEPROM checksum.\n");
+		printk(KERN_ERR "The EEPROM Checksum Is Not Valid\n");
+		err = -EIO;
 		goto err_eeprom;
 	}
 
 	ixgb_get_ee_mac_addr(&adapter->hw, netdev->dev_addr);
 
 	if (!is_valid_ether_addr(netdev->dev_addr)) {
-		IXGB_DBG("Invalid MAC address in EEPROM.\n");
+		err = -EIO;
 		goto err_eeprom;
 	}
 
-	adapter->max_data_per_txd = IXGB_MAX_JUMBO_FRAME_SIZE;
 	adapter->part_num = ixgb_get_ee_pba_number(&adapter->hw);
 
 	init_timer(&adapter->watchdog_timer);
 	adapter->watchdog_timer.function = &ixgb_watchdog;
-	adapter->watchdog_timer.data = (unsigned long) adapter;
+	adapter->watchdog_timer.data = (unsigned long)adapter;
 
 	INIT_WORK(&adapter->tx_timeout_task,
-		  (void (*)(void *)) ixgb_tx_timeout_task, netdev);
+		  (void (*)(void *))ixgb_tx_timeout_task, netdev);
 
-	register_netdev(netdev);
-	memcpy(adapter->ifname, netdev->name, IFNAMSIZ);
-	adapter->ifname[IFNAMSIZ - 1] = 0;
+	if ((err = register_netdev(netdev)))
+		goto err_register;
 
 	/* we're going to reset, so assume we have no link for now */
 
 	netif_carrier_off(netdev);
 	netif_stop_queue(netdev);
 
-	printk(KERN_INFO "%s: %s\n", netdev->name, adapter->id_string);
+	printk(KERN_INFO "%s: Intel(R) PRO/10GbE Network Connection\n",
+	       netdev->name);
 	ixgb_check_options(adapter);
-
 	/* reset the hardware with the new settings */
+
 	ixgb_reset(adapter);
 
 	cards_found++;
 	return 0;
 
+      err_register:
+      err_sw_init:
       err_eeprom:
 	iounmap(adapter->hw.hw_addr);
       err_ioremap:
-	pci_release_regions(pdev);
 	free_netdev(netdev);
       err_alloc_etherdev:
-	return -ENOMEM;
+	pci_release_regions(pdev);
+	return err;
 }
 
 /**
- * ixgb_remove - Device Removal Routine.
- * @param pdev PCI device information struct
+ * ixgb_remove - Device Removal Routine
+ * @pdev: PCI device information struct
  *
  * ixgb_remove is called by the PCI subsystem to alert the driver
  * that it should release a PCI device.  The could be caused by a
@@ -461,49 +444,36 @@
  * memory.
  **/
 
-static void __devexit
-ixgb_remove(struct pci_dev *pdev)
+static void __devexit ixgb_remove(struct pci_dev *pdev)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct ixgb_adapter *adapter = netdev->priv;
 
-	IXGB_DBG("ixgb_remove\n");
-
 	unregister_netdev(netdev);
 
-#ifdef ETHTOOL_IDENTIFY
-	ixgb_identify_stop(adapter);
-#endif
-
-	iounmap((void *) adapter->hw.hw_addr);
+	iounmap(adapter->hw.hw_addr);
 	pci_release_regions(pdev);
 
 	free_netdev(netdev);
 }
 
 /**
- * ixgb_sw_init - Initialize general software structures (struct ixgb_adapter).
- * @param adapter board private structure to initialize
+ * ixgb_sw_init - Initialize general software structures (struct ixgb_adapter)
+ * @adapter: board private structure to initialize
  *
- * ixgb_sw_init initializes the adapter private data structure.
+ * ixgb_sw_init initializes the Adapter private data structure.
  * Fields are initialized based on PCI device information and
  * OS network device settings (MTU size).
  **/
 
-static void __devinit
-ixgb_sw_init(struct ixgb_adapter *adapter)
+static int __devinit ixgb_sw_init(struct ixgb_adapter *adapter)
 {
 	struct ixgb_hw *hw = &adapter->hw;
 	struct net_device *netdev = adapter->netdev;
 	struct pci_dev *pdev = adapter->pdev;
 
-	IXGB_DBG("ixgb_sw_init\n");
-
 	/* PCI config space info */
 
-	/* FIXME: do not store, instead directly use struct pci_dev
-	 * where needed
-	 */
 	hw->vendor_id = pdev->vendor;
 	hw->device_id = pdev->device;
 	hw->subsystem_vendor_id = pdev->subsystem_vendor;
@@ -513,7 +483,8 @@
 
 	hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
 
-	if (hw->device_id == IXGB_DEVICE_ID_82597EX)
+	if ((hw->device_id == IXGB_DEVICE_ID_82597EX)
+	    || (hw->device_id == IXGB_DEVICE_ID_82597EX_SR))
 		hw->mac_type = ixgb_82597;
 	else {
 		/* should never have loaded on this device */
@@ -524,11 +495,14 @@
 	hw->fc.send_xon = 1;
 
 	atomic_set(&adapter->irq_sem, 1);
+	spin_lock_init(&adapter->tx_lock);
+
+	return 0;
 }
 
 /**
- * ixgb_open - Called when a network interface is made active.
- * @param netdev network interface device structure
+ * ixgb_open - Called when a network interface is made active
+ * @netdev: network interface device structure
  *
  * Returns 0 on success, negative value on failure
  *
@@ -539,27 +513,22 @@
  * and the stack is notified that the interface is ready.
  **/
 
-static int
-ixgb_open(struct net_device *netdev)
+static int ixgb_open(struct net_device *netdev)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
-
-	IXGB_DBG("ixgb_open\n");
+	int err;
 
 	/* allocate transmit descriptors */
 
-	if (ixgb_setup_tx_resources(adapter)) {
-		IXGB_DBG("ixgb_open: failed ixgb_setup_tx_resources.\n");
+	if ((err = ixgb_setup_tx_resources(adapter)))
 		goto err_setup_tx;
-	}
 
-	/* allocate receive descriptors and buffers */
+	/* allocate receive descriptors */
 
-	if (ixgb_setup_rx_resources(adapter)) {
-		IXGB_DBG("ixgb_open: failed ixgb_setup_rx_resources.\n");
+	if ((err = ixgb_setup_rx_resources(adapter)))
 		goto err_setup_rx;
-	}
-	if (ixgb_up(adapter))
+
+	if ((err = ixgb_up(adapter)))
 		goto err_up;
 
 	return 0;
@@ -570,12 +539,13 @@
 	ixgb_free_tx_resources(adapter);
       err_setup_tx:
 	ixgb_reset(adapter);
-	return -EBUSY;
+
+	return err;
 }
 
 /**
- * ixgb_close - Disables a network interface.
- * @param netdev network interface device structure
+ * ixgb_close - Disables a network interface
+ * @netdev: network interface device structure
  *
  * Returns 0, this is not allowed to fail
  *
@@ -585,13 +555,10 @@
  * hardware, and all transmit and receive resources are freed.
  **/
 
-static int
-ixgb_close(struct net_device *netdev)
+static int ixgb_close(struct net_device *netdev)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
 
-	IXGB_DBG("ixgb_close\n");
-
 	ixgb_down(adapter, TRUE);
 
 	ixgb_free_tx_resources(adapter);
@@ -601,22 +568,19 @@
 }
 
 /**
- * ixgb_setup_tx_resources - allocate Tx resources (Descriptors).
- * @param adapter board private structure
+ * ixgb_setup_tx_resources - allocate Tx resources (Descriptors)
+ * @adapter: board private structure
  *
  * Return 0 on success, negative on failure
  **/
 
-static int
-ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
+static int ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
 {
-	struct pci_dev *pdev = adapter->pdev;
 	struct ixgb_desc_ring *txdr = &adapter->tx_ring;
+	struct pci_dev *pdev = adapter->pdev;
 	int size;
 
-	IXGB_DBG("ixgb_setup_tx_resources\n");
-
-	size = sizeof (struct ixgb_buffer) * txdr->count;
+	size = sizeof(struct ixgb_buffer) * txdr->count;
 	txdr->buffer_info = kmalloc(size, GFP_KERNEL);
 	if (!txdr->buffer_info) {
 		return -ENOMEM;
@@ -624,7 +588,8 @@
 	memset(txdr->buffer_info, 0, size);
 
 	/* round up to nearest 4K */
-	txdr->size = txdr->count * sizeof (struct ixgb_tx_desc);
+
+	txdr->size = txdr->count * sizeof(struct ixgb_tx_desc);
 	IXGB_ROUNDUP(txdr->size, 4096);
 
 	txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
@@ -634,10 +599,6 @@
 	}
 	memset(txdr->desc, 0, txdr->size);
 
-	IXGB_DBG("txdr->desc <%p>\n", txdr->desc);
-	IXGB_DBG("txdr->next_to_use = <%p>\n", &txdr->next_to_use);
-	IXGB_DBG("txdr->next_to_clean = <%p>\n", &txdr->next_to_clean);
-
 	txdr->next_to_use = 0;
 	txdr->next_to_clean = 0;
 
@@ -646,21 +607,18 @@
 
 /**
  * ixgb_configure_tx - Configure 82597 Transmit Unit after Reset.
- * @adapter board private structure
+ * @adapter: board private structure
  *
  * Configure the Tx unit of the MAC after a reset.
  **/
 
-static void
-ixgb_configure_tx(struct ixgb_adapter *adapter)
+static void ixgb_configure_tx(struct ixgb_adapter *adapter)
 {
-	u32 tctl;
-	u32 tdlen = adapter->tx_ring.count * sizeof (struct ixgb_tx_desc);
 	uint64_t tdba = adapter->tx_ring.dma;
+	uint32_t tdlen = adapter->tx_ring.count * sizeof(struct ixgb_tx_desc);
+	uint32_t tctl;
 	struct ixgb_hw *hw = &adapter->hw;
 
-	IXGB_DBG("ixgb_configure_tx\n");
-
 	/* Setup the Base and Length of the Tx Descriptor Ring 
 	 * tx_ring.dma can be either a 32 or 64 bit value 
 	 */
@@ -694,27 +652,24 @@
 
 	/* Setup Transmit Descriptor Settings for this adapter */
 	adapter->tx_cmd_type =
-	    IXGB_TX_DESC_TYPE | IXGB_TX_DESC_CMD_RS
+	    IXGB_TX_DESC_TYPE
 	    | (adapter->tx_int_delay_enable ? IXGB_TX_DESC_CMD_IDE : 0);
 }
 
 /**
- * ixgb_setup_rx_resources - allocate Rx resources (Descriptors).
- * @param adapter board private structure
- * 
+ * ixgb_setup_rx_resources - allocate Rx resources (Descriptors)
+ * @adapter: board private structure
+ *
  * Returns 0 on success, negative on failure
  **/
 
-static int
-ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
+static int ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
 {
-	struct pci_dev *pdev = adapter->pdev;
 	struct ixgb_desc_ring *rxdr = &adapter->rx_ring;
+	struct pci_dev *pdev = adapter->pdev;
 	int size;
 
-	IXGB_DBG("ixgb_setup_rx_resources.\n");
-
-	size = sizeof (struct ixgb_buffer) * rxdr->count;
+	size = sizeof(struct ixgb_buffer) * rxdr->count;
 	rxdr->buffer_info = kmalloc(size, GFP_KERNEL);
 	if (!rxdr->buffer_info) {
 		return -ENOMEM;
@@ -722,42 +677,35 @@
 	memset(rxdr->buffer_info, 0, size);
 
 	/* Round up to nearest 4K */
-	rxdr->size = rxdr->count * sizeof (struct ixgb_rx_desc);
+
+	rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
 	IXGB_ROUNDUP(rxdr->size, 4096);
 
 	rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
 
 	if (!rxdr->desc) {
-		IXGB_DBG("pci_alloc_consistent failed.\n");
 		kfree(rxdr->buffer_info);
 		return -ENOMEM;
 	}
 	memset(rxdr->desc, 0, rxdr->size);
 
-	IXGB_DBG("rxdr->desc <%p>\n", rxdr->desc);
-	IXGB_DBG("rxdr->next_to_use = <%p>\n", &rxdr->next_to_use);
-	IXGB_DBG("rxdr->next_to_clean = <%p>\n", &rxdr->next_to_clean);
-
-	rxdr->next_to_use = 0;
 	rxdr->next_to_clean = 0;
+	rxdr->next_to_use = 0;
 
 	return 0;
 }
 
 /**
- * ixgb_setup_rctl - configure the receive control register.
- * @param adapter Board private structure
+ * ixgb_setup_rctl - configure the receive control register
+ * @adapter: Board private structure
  **/
 
-static void
-ixgb_setup_rctl(struct ixgb_adapter *adapter)
+static void ixgb_setup_rctl(struct ixgb_adapter *adapter)
 {
-	u32 rctl;
+	uint32_t rctl;
 
 	rctl = IXGB_READ_REG(&adapter->hw, RCTL);
 
-	IXGB_DBG("ixgb_setup_rctl\n");
-
 	rctl &= ~(3 << IXGB_RCTL_MO_SHIFT);
 
 	rctl |=
@@ -782,35 +730,37 @@
 		rctl |= IXGB_RCTL_BSIZE_16384;
 		break;
 	}
+
 	IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
 }
 
 /**
  * ixgb_configure_rx - Configure 82597 Receive Unit after Reset.
- * @param adapter board private structure
+ * @adapter: board private structure
  *
  * Configure the Rx unit of the MAC after a reset.
  **/
 
-static void
-ixgb_configure_rx(struct ixgb_adapter *adapter)
+static void ixgb_configure_rx(struct ixgb_adapter *adapter)
 {
 	uint64_t rdba = adapter->rx_ring.dma;
-	u32 rdlen = adapter->rx_ring.count * sizeof (struct ixgb_rx_desc);
+	uint32_t rdlen = adapter->rx_ring.count * sizeof(struct ixgb_rx_desc);
 	struct ixgb_hw *hw = &adapter->hw;
-	u32 rctl;
-	u32 rxcsum;
-
-	IXGB_DBG("ixgb_configure_rx\n");
+	uint32_t rctl;
+	uint32_t rxcsum;
+	uint32_t rxdctl;
 
 	/* make sure receives are disabled while setting up the descriptors */
+
 	rctl = IXGB_READ_REG(hw, RCTL);
 	IXGB_WRITE_REG(hw, RCTL, rctl & ~IXGB_RCTL_RXEN);
 
 	/* set the Receive Delay Timer Register */
+
 	IXGB_WRITE_REG(hw, RDTR, adapter->rx_int_delay);
 
 	/* Setup the Base and Length of the Rx Descriptor Ring */
+
 	IXGB_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL));
 	IXGB_WRITE_REG(hw, RDBAH, (rdba >> 32));
 
@@ -820,18 +770,15 @@
 	IXGB_WRITE_REG(hw, RDH, 0);
 	IXGB_WRITE_REG(hw, RDT, 0);
 
-	{
-		u32 rxdctl;
-		/* burst 16 or burst when RXT0 */
-		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);
-	}
+	/* burst 16 or burst when RXT0 */
+	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);
 
 	if (adapter->raidc) {
-		u32 raidc;
-		u8 poll_threshold;
+		uint32_t raidc;
+		uint8_t poll_threshold;
 
 		/* Poll every rx_int_delay period, if RBD exists
 		 * Receive Backlog Detection is set to <threshold> 
@@ -879,167 +826,180 @@
 }
 
 /**
- * ixgb_free_tx_resources - Free Tx Resources.
- * @param adapter board private structure
+ * ixgb_free_tx_resources - Free Tx Resources
+ * @adapter: board private structure
  *
  * Free all transmit software resources
  **/
 
-static void
-ixgb_free_tx_resources(struct ixgb_adapter *adapter)
+static void ixgb_free_tx_resources(struct ixgb_adapter *adapter)
 {
 	struct pci_dev *pdev = adapter->pdev;
 
-	IXGB_DBG("ixgb_free_tx_resources\n");
-
 	ixgb_clean_tx_ring(adapter);
 
 	kfree(adapter->tx_ring.buffer_info);
 	adapter->tx_ring.buffer_info = NULL;
 
-	pci_free_consistent(pdev, adapter->tx_ring.size, adapter->tx_ring.desc,
-			    adapter->tx_ring.dma);
+	pci_free_consistent(pdev, adapter->tx_ring.size,
+			    adapter->tx_ring.desc, adapter->tx_ring.dma);
 
 	adapter->tx_ring.desc = NULL;
 }
 
 /**
- * ixgb_clean_tx_ring - Free Tx Buffers.
- * @param adapter board private structure
+ * ixgb_clean_tx_ring - Free Tx Buffers
+ * @adapter: board private structure
  **/
 
-static void
-ixgb_clean_tx_ring(struct ixgb_adapter *adapter)
+static void ixgb_clean_tx_ring(struct ixgb_adapter *adapter)
 {
+	struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
+	struct ixgb_buffer *buffer_info;
 	struct pci_dev *pdev = adapter->pdev;
 	unsigned long size;
-	int i;
-
-	IXGB_DBG("ixgb_clean_tx_ring\n");
+	unsigned int i;
 
 	/* Free all the Tx ring sk_buffs */
 
-	for (i = 0; i < adapter->tx_ring.count; i++) {
-		if (adapter->tx_ring.buffer_info[i].skb) {
+	for (i = 0; i < tx_ring->count; i++) {
+		buffer_info = &tx_ring->buffer_info[i];
+		if (buffer_info->skb) {
 
 			pci_unmap_page(pdev,
-				       adapter->tx_ring.buffer_info[i].dma,
-				       adapter->tx_ring.buffer_info[i].length,
-				       PCI_DMA_TODEVICE);
+				       buffer_info->dma,
+				       buffer_info->length, PCI_DMA_TODEVICE);
 
-			dev_kfree_skb(adapter->tx_ring.buffer_info[i].skb);
+			dev_kfree_skb(buffer_info->skb);
 
-			adapter->tx_ring.buffer_info[i].skb = NULL;
+			buffer_info->skb = NULL;
 		}
 	}
 
-	size = sizeof (struct ixgb_buffer) * adapter->tx_ring.count;
-	memset(adapter->tx_ring.buffer_info, 0, size);
+	size = sizeof(struct ixgb_buffer) * tx_ring->count;
+	memset(tx_ring->buffer_info, 0, size);
 
 	/* Zero out the descriptor ring */
 
-	memset(adapter->tx_ring.desc, 0, adapter->tx_ring.size);
+	memset(tx_ring->desc, 0, tx_ring->size);
 
-	adapter->tx_ring.next_to_use = 0;
-	adapter->tx_ring.next_to_clean = 0;
+	tx_ring->next_to_use = 0;
+	tx_ring->next_to_clean = 0;
 
 	IXGB_WRITE_REG(&adapter->hw, TDH, 0);
 	IXGB_WRITE_REG(&adapter->hw, TDT, 0);
 }
 
 /**
- * ixgb_free_rx_resources - Free Rx Resources.
- * @param adapter board private structure
+ * ixgb_free_rx_resources - Free Rx Resources
+ * @adapter: board private structure
  *
  * Free all receive software resources
  **/
 
-static void
-ixgb_free_rx_resources(struct ixgb_adapter *adapter)
+static void ixgb_free_rx_resources(struct ixgb_adapter *adapter)
 {
+	struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
 	struct pci_dev *pdev = adapter->pdev;
 
-	IXGB_DBG("ixgb_free_rx_resources\n");
-
 	ixgb_clean_rx_ring(adapter);
 
-	kfree(adapter->rx_ring.buffer_info);
-	adapter->rx_ring.buffer_info = NULL;
+	kfree(rx_ring->buffer_info);
+	rx_ring->buffer_info = NULL;
 
-	pci_free_consistent(pdev, adapter->rx_ring.size,
-			    adapter->rx_ring.desc, adapter->rx_ring.dma);
+	pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);
 
-	adapter->rx_ring.desc = NULL;
+	rx_ring->desc = NULL;
 }
 
 /**
- * ixgb_clean_rx_ring - Free Rx Buffers.
- * @param adapter board private structure
+ * ixgb_clean_rx_ring - Free Rx Buffers
+ * @adapter: board private structure
  **/
 
-static void
-ixgb_clean_rx_ring(struct ixgb_adapter *adapter)
+static void ixgb_clean_rx_ring(struct ixgb_adapter *adapter)
 {
+	struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
+	struct ixgb_buffer *buffer_info;
 	struct pci_dev *pdev = adapter->pdev;
 	unsigned long size;
-	int i;
-
-	IXGB_DBG("ixgb_free_rx_ring\n");
+	unsigned int i;
 
 	/* Free all the Rx ring sk_buffs */
 
-	for (i = 0; i < adapter->rx_ring.count; i++) {
-		if (adapter->rx_ring.buffer_info[i].skb) {
+	for (i = 0; i < rx_ring->count; i++) {
+		buffer_info = &rx_ring->buffer_info[i];
+		if (buffer_info->skb) {
 
 			pci_unmap_single(pdev,
-					 adapter->rx_ring.buffer_info[i].dma,
-					 adapter->rx_ring.buffer_info[i].length,
+					 buffer_info->dma,
+					 buffer_info->length,
 					 PCI_DMA_FROMDEVICE);
 
-			dev_kfree_skb(adapter->rx_ring.buffer_info[i].skb);
+			dev_kfree_skb(buffer_info->skb);
 
-			adapter->rx_ring.buffer_info[i].skb = NULL;
+			buffer_info->skb = NULL;
 		}
 	}
 
-	size = sizeof (struct ixgb_buffer) * adapter->rx_ring.count;
-	memset(adapter->rx_ring.buffer_info, 0, size);
+	size = sizeof(struct ixgb_buffer) * rx_ring->count;
+	memset(rx_ring->buffer_info, 0, size);
 
 	/* Zero out the descriptor ring */
 
-	memset(adapter->rx_ring.desc, 0, adapter->rx_ring.size);
+	memset(rx_ring->desc, 0, rx_ring->size);
 
-	adapter->rx_ring.next_to_clean = 0;
-	adapter->rx_ring.next_to_use = 0;
+	rx_ring->next_to_clean = 0;
+	rx_ring->next_to_use = 0;
 
 	IXGB_WRITE_REG(&adapter->hw, RDH, 0);
 	IXGB_WRITE_REG(&adapter->hw, RDT, 0);
 }
 
 /**
- * ixgb_set_multi - Multicast and Promiscuous mode set.
- * @param netdev network interface device structure
+ * ixgb_set_mac - Change the Ethernet Address of the NIC
+ * @netdev: network interface device structure
+ * @p: pointer to an address structure
+ *
+ * Returns 0 on success, negative on failure
+ **/
+
+static int ixgb_set_mac(struct net_device *netdev, void *p)
+{
+	struct ixgb_adapter *adapter = netdev->priv;
+	struct sockaddr *addr = p;
+
+	if (!is_valid_ether_addr(addr->sa_data))
+		return -EADDRNOTAVAIL;
+
+	memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
+
+	ixgb_rar_set(&adapter->hw, addr->sa_data, 0);
+
+	return 0;
+}
+
+/**
+ * ixgb_set_multi - Multicast and Promiscuous mode set
+ * @netdev: network interface device structure
  *
  * The set_multi entry point is called whenever the multicast address
  * list or the network interface flags are updated.  This routine is
- * resposible for configuring the hardware for proper multicast,
+ * responsible for configuring the hardware for proper multicast,
  * promiscuous mode, and all-multi behavior.
  **/
 
-void
-ixgb_set_multi(struct net_device *netdev)
+static void ixgb_set_multi(struct net_device *netdev)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
 	struct ixgb_hw *hw = &adapter->hw;
-	u32 rctl;
-	int i;
 	struct dev_mc_list *mc_ptr;
-
-	IXGB_DBG("ixgb_set_multi <%x>\n", netdev->flags);
+	uint32_t rctl;
+	int i;
 
 	/* Check for Promiscuous and All Multicast modes */
 
-	rctl = IXGB_READ_REG(&adapter->hw, RCTL);
+	rctl = IXGB_READ_REG(hw, RCTL);
 
 	if (netdev->flags & IFF_PROMISC) {
 		rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE);
@@ -1054,7 +1014,7 @@
 		rctl |= IXGB_RCTL_MPE;
 		IXGB_WRITE_REG(hw, RCTL, rctl);
 	} else {
-		u8 mta[netdev->mc_count * IXGB_ETH_LENGTH_OF_ADDRESS];
+		uint8_t mta[netdev->mc_count * IXGB_ETH_LENGTH_OF_ADDRESS];
 
 		IXGB_WRITE_REG(hw, RCTL, rctl);
 
@@ -1068,15 +1028,16 @@
 }
 
 /**
- * ixgb_watchdog - Timer Call-back.
- * @param data pointer to adapter cast into an unsigned long
+ * ixgb_watchdog - Timer Call-back
+ * @data: pointer to netdev cast into an unsigned long
  **/
 
-void
-ixgb_watchdog(unsigned long data)
+static void ixgb_watchdog(unsigned long data)
 {
-	struct ixgb_adapter *adapter = (struct ixgb_adapter *) data;
+	struct ixgb_adapter *adapter = (struct ixgb_adapter *)data;
 	struct net_device *netdev = adapter->netdev;
+	struct ixgb_desc_ring *txdr = &adapter->tx_ring;
+	unsigned int i;
 
 	ixgb_check_for_link(&adapter->hw);
 
@@ -1096,36 +1057,35 @@
 		}
 	} else {
 		if (netif_carrier_ok(netdev)) {
-			printk(KERN_INFO "ixgb: %s NIC Link is Down\n",
-			       netdev->name);
 			adapter->link_speed = 0;
 			adapter->link_duplex = 0;
+			printk(KERN_INFO
+			       "ixgb: %s NIC Link is Down\n", netdev->name);
 			netif_carrier_off(netdev);
 			netif_stop_queue(netdev);
 
-			ixgb_down(adapter, FALSE);
-			ixgb_up(adapter);
 		}
 	}
 
 	ixgb_update_stats(adapter);
 
-	/* Early detection of hung controller */
-	{
-		struct ixgb_desc_ring *txdr = &adapter->tx_ring;
-		int i = txdr->next_to_clean;
-
-		if (txdr->buffer_info[i].dma &&
-		    time_after(jiffies, txdr->buffer_info[i].time_stamp + HZ) &&
-		    !(IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_TXOFF))
-		{
-			IXGB_DBG
-			    ("ixgb: %s Hung controller? Watchdog stopping queue\n",
-			     netdev->name);
-			netif_stop_queue(netdev);
+	if (!netif_carrier_ok(netdev)) {
+		if (IXGB_DESC_UNUSED(txdr) + 1 < txdr->count) {
+			/* We've lost link, so the controller stops DMA,
+			 * but we've got queued Tx work that's never going
+			 * to get done, so reset controller to flush Tx.
+			 * (Do the reset outside of interrupt context). */
+			schedule_work(&adapter->tx_timeout_task);
 		}
 	}
 
+	/* Early detection of hung controller */
+	i = txdr->next_to_clean;
+	if (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);
+
 	/* generate an interrupt to force clean up of any stragglers */
 	IXGB_WRITE_REG(&adapter->hw, ICS, IXGB_INT_TXDW);
 
@@ -1133,24 +1093,18 @@
 	mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
 }
 
-#define IXGB_TX_FLAGS_CSUM	0x00000001
-#define IXGB_TX_FLAGS_VLAN	0x00000002
-#define IXGB_TX_FLAGS_TSO	0x00000004
-
-/** Transmit Segmentation offload setup.
- * ixgb_tso - (Large Send) setup where the initial descriptor is prepared
- * @param adapter adapter specific information
- * @param skb the skb we are trying to set up for segmentation
- **/
+#define IXGB_TX_FLAGS_CSUM		0x00000001
+#define IXGB_TX_FLAGS_VLAN		0x00000002
+#define IXGB_TX_FLAGS_TSO		0x00000004
 
 static inline boolean_t
 ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
 {
 #ifdef NETIF_F_TSO
 	struct ixgb_context_desc *context_desc;
-	int i;
-	u8 ipcss, ipcso, tucss, tucso, hdr_len;
-	u16 ipcse, tucse, mss;
+	unsigned int i;
+	uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
+	uint16_t ipcse, tucse, mss;
 
 	if (likely(skb_shinfo(skb)->tso_size)) {
 		hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
@@ -1161,10 +1115,10 @@
 						      skb->nh.iph->daddr,
 						      0, IPPROTO_TCP, 0);
 		ipcss = skb->nh.raw - skb->data;
-		ipcso = (void *) &(skb->nh.iph->check) - (void *) skb->data;
+		ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data;
 		ipcse = skb->h.raw - skb->data - 1;
 		tucss = skb->h.raw - skb->data;
-		tucso = (void *) &(skb->h.th->check) - (void *) skb->data;
+		tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
 		tucse = 0;
 
 		i = adapter->tx_ring.next_to_use;
@@ -1193,32 +1147,28 @@
 							 | (skb->len -
 							    (hdr_len)));
 
-		i = (i + 1) % adapter->tx_ring.count;
+		if (++i == adapter->tx_ring.count)
+			i = 0;
 		adapter->tx_ring.next_to_use = i;
 
 		return TRUE;
 	}
 #endif
+
 	return FALSE;
 }
 
-/**
- * ixgb_tx_csum - prepare context descriptor for checksum offload.
- *
- * ixgb_tx_csum is called to prepare for checksumming a packet in hw.
- * @param adapter board private structure
- * @param skb structure containing data to send
- **/
 static inline boolean_t
 ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
 {
 	struct ixgb_context_desc *context_desc;
-	int i;
-	u8 css, cso;
+	unsigned int i;
+	uint8_t css, cso;
 
 	if (likely(skb->ip_summed == CHECKSUM_HW)) {
 		css = skb->h.raw - skb->data;
 		cso = (skb->h.raw + skb->csum) - skb->data;
+
 		i = adapter->tx_ring.next_to_use;
 		context_desc = IXGB_CONTEXT_DESC(adapter->tx_ring, i);
 
@@ -1226,7 +1176,7 @@
 		context_desc->tucso = cso;
 		context_desc->tucse = 0;
 		/* zero out any previously existing data in one instruction */
-		*(u32 *) & (context_desc->ipcss) = 0;
+		*(uint32_t *) & (context_desc->ipcss) = 0;
 		context_desc->status = 0;
 		context_desc->hdr_len = 0;
 		context_desc->mss = 0;
@@ -1234,7 +1184,8 @@
 		    cpu_to_le32(IXGB_CONTEXT_DESC_TYPE
 				| IXGB_TX_DESC_CMD_RS | IXGB_TX_DESC_CMD_IDE);
 
-		i = (i + 1) % adapter->tx_ring.count;
+		if (++i == adapter->tx_ring.count)
+			i = 0;
 		adapter->tx_ring.next_to_use = i;
 
 		return TRUE;
@@ -1243,43 +1194,41 @@
 	return FALSE;
 }
 
-/**
- * ixgb_tx_map - private function for mapping send data to hardware addresses.
- *
- * @param adapter board private structure
- * @param skb structure containing data to send
- **/
+#define IXGB_MAX_TXD_PWR	14
+#define IXGB_MAX_DATA_PER_TXD	(1<<IXGB_MAX_TXD_PWR)
 
 static inline int
-ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb)
+ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
+	    unsigned int first)
 {
 	struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
-	int len, offset, count, size, i;
-
-	int f;
-	len = skb->len - skb->data_len;
-
-	i = (tx_ring->next_to_use + tx_ring->count - 1) % tx_ring->count;
-	count = 0;
+	struct ixgb_buffer *buffer_info;
+	int len = skb->len;
+	unsigned int offset = 0, size, count = 0, i;
+
+	unsigned int nr_frags = skb_shinfo(skb)->nr_frags;
+	unsigned int f;
+	len -= skb->data_len;
 
-	offset = 0;
+	i = tx_ring->next_to_use;
 
 	while (len) {
-		i = (i + 1) % tx_ring->count;
-		size = min(len, adapter->max_data_per_txd);
-		tx_ring->buffer_info[i].length = size;
-		tx_ring->buffer_info[i].dma =
-		    pci_map_single(adapter->pdev, skb->data + offset, size,
-				   PCI_DMA_TODEVICE);
-
-		tx_ring->buffer_info[i].time_stamp = jiffies;
+		buffer_info = &tx_ring->buffer_info[i];
+		size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE);
+		buffer_info->length = size;
+		buffer_info->dma =
+		    pci_map_single(adapter->pdev,
+				   skb->data + offset, size, PCI_DMA_TODEVICE);
+		buffer_info->time_stamp = jiffies;
 
 		len -= size;
 		offset += size;
 		count++;
+		if (++i == tx_ring->count)
+			i = 0;
 	}
 
-	for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) {
+	for (f = 0; f < nr_frags; f++) {
 		struct skb_frag_struct *frag;
 
 		frag = &skb_shinfo(skb)->frags[f];
@@ -1287,44 +1236,41 @@
 		offset = 0;
 
 		while (len) {
-			i = (i + 1) % tx_ring->count;
-			size = min(len, adapter->max_data_per_txd);
-			tx_ring->buffer_info[i].length = size;
-			tx_ring->buffer_info[i].dma =
-			    pci_map_page(adapter->pdev, frag->page,
-					 frag->page_offset + offset, size,
-					 PCI_DMA_TODEVICE);
+			buffer_info = &tx_ring->buffer_info[i];
+			size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE);
+			buffer_info->length = size;
+			buffer_info->dma =
+			    pci_map_page(adapter->pdev,
+					 frag->page,
+					 frag->page_offset + offset,
+					 size, PCI_DMA_TODEVICE);
+			buffer_info->time_stamp = jiffies;
 
-			tx_ring->buffer_info[i].time_stamp = jiffies;
 			len -= size;
 			offset += size;
 			count++;
+			if (++i == tx_ring->count)
+				i = 0;
 		}
 	}
+	i = (i == 0) ? tx_ring->count - 1 : i - 1;
 	tx_ring->buffer_info[i].skb = skb;
+	tx_ring->buffer_info[first].next_to_watch = i;
 
 	return count;
 }
 
-/**
- * ixgb_tx_queue - private function to start transmit on hardware.
- *
- * @param adapter board private structure
- * @param count number of tx_descriptors to initialize (consume)
- * @param vlan_id the vlan tag to insert (if necessary)
- * @param tx_flags special handling for this transmit, if any
- **/
-
 static inline void
 ixgb_tx_queue(struct ixgb_adapter *adapter, int count, int vlan_id,
 	      int tx_flags)
 {
 	struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
 	struct ixgb_tx_desc *tx_desc = NULL;
-	u32 cmd_type_len = adapter->tx_cmd_type;
-	u8 status = 0;
-	u8 popts = 0;
-	int i;
+	struct ixgb_buffer *buffer_info;
+	uint32_t cmd_type_len = adapter->tx_cmd_type;
+	uint8_t status = 0;
+	uint8_t popts = 0;
+	unsigned int i;
 
 	if (tx_flags & IXGB_TX_FLAGS_TSO) {
 		cmd_type_len |= IXGB_TX_DESC_CMD_TSE;
@@ -1341,18 +1287,21 @@
 	i = tx_ring->next_to_use;
 
 	while (count--) {
+		buffer_info = &tx_ring->buffer_info[i];
 		tx_desc = IXGB_TX_DESC(*tx_ring, i);
-		tx_desc->buff_addr = cpu_to_le64(tx_ring->buffer_info[i].dma);
+		tx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
 		tx_desc->cmd_type_len =
-		    cpu_to_le32(cmd_type_len | tx_ring->buffer_info[i].length);
+		    cpu_to_le32(cmd_type_len | buffer_info->length);
 		tx_desc->status = status;
 		tx_desc->popts = popts;
 		tx_desc->vlan = cpu_to_le16(vlan_id);
 
-		i = (i + 1) % tx_ring->count;
+		if (++i == tx_ring->count)
+			i = 0;
 	}
 
-	tx_desc->cmd_type_len |= cpu_to_le32(IXGB_TX_DESC_CMD_EOP);
+	tx_desc->cmd_type_len |= cpu_to_le32(IXGB_TX_DESC_CMD_EOP
+					     | IXGB_TX_DESC_CMD_RS);
 
 	/* Force memory writes to complete before letting h/w
 	 * know there are new descriptors to fetch.  (Only
@@ -1364,95 +1313,70 @@
 	IXGB_WRITE_REG(&adapter->hw, TDT, i);
 }
 
-#define TXD_USE_COUNT(S, X) (((S) / (X)) + (((S) % (X)) ? 1 : 0))
+/* Tx Descriptors needed, worst case */
+#define TXD_USE_COUNT(S) (((S) >> IXGB_MAX_TXD_PWR) + \
+			 (((S) & (IXGB_MAX_DATA_PER_TXD - 1)) ? 1 : 0))
+#define DESC_NEEDED TXD_USE_COUNT(IXGB_MAX_DATA_PER_TXD) + \
+	MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1
 
-/**
- * ixgb_xmit_frame - hard_start_xmit linked function, transmit entry point.
- *
- * ixgb_xmit_frame is called to send an skb on the wire.
- * @param skb contains data to send
- * @param netdev network interface device structure 
- **/
-
-static int
-ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
+static int ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
+	unsigned int first;
+	unsigned int tx_flags = 0;
+	unsigned long flags;
 	int vlan_id = 0;
-	int tx_flags = 0, count;
-	int f;
 
-	count =
-	    TXD_USE_COUNT(skb->len - skb->data_len, adapter->max_data_per_txd);
-
-	if (count == 0) {
+	if (skb->len <= 0) {
 		dev_kfree_skb_any(skb);
 		return 0;
 	}
 
-	for (f = 0; f < skb_shinfo(skb)->nr_frags; f++)
-		count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size,
-				       adapter->max_data_per_txd);
-#ifdef NETIF_F_TSO
-	if ((skb_shinfo(skb)->tso_size) || (skb->ip_summed == CHECKSUM_HW))
-		count++;
-#else
-	if (skb->ip_summed == CHECKSUM_HW)
-		count++;
-#endif
-
-	if (unlikely(IXGB_DESC_UNUSED(&adapter->tx_ring) < count)) {
+	spin_lock_irqsave(&adapter->tx_lock, flags);
+	if (unlikely(IXGB_DESC_UNUSED(&adapter->tx_ring) < DESC_NEEDED)) {
 		netif_stop_queue(netdev);
+		spin_unlock_irqrestore(&adapter->tx_lock, flags);
 		return 1;
 	}
+	spin_unlock_irqrestore(&adapter->tx_lock, flags);
 
 	if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
 		tx_flags |= IXGB_TX_FLAGS_VLAN;
 		vlan_id = vlan_tx_tag_get(skb);
 	}
 
+	first = adapter->tx_ring.next_to_use;
+
 	if (ixgb_tso(adapter, skb))
 		tx_flags |= IXGB_TX_FLAGS_TSO;
 	else if (ixgb_tx_csum(adapter, skb))
 		tx_flags |= IXGB_TX_FLAGS_CSUM;
 
-	count = ixgb_tx_map(adapter, skb);
-	ixgb_tx_queue(adapter, count, vlan_id, tx_flags);
+	ixgb_tx_queue(adapter, ixgb_tx_map(adapter, skb, first), vlan_id,
+		      tx_flags);
+
 	netdev->trans_start = jiffies;
 
 	return 0;
 }
 
 /**
- * ixgb_tx_timeout - Respond to a Tx Hang by resetting the adapter.
- * @param netdev network interface device structure
+ * ixgb_tx_timeout - Respond to a Tx Hang
+ * @netdev: network interface device structure
  **/
 
-static void
-ixgb_tx_timeout(struct net_device *netdev)
+static void ixgb_tx_timeout(struct net_device *netdev)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
 
-	IXGB_DBG("ixgb_tx_timeout\n");
-
 	/* Do the reset outside of interrupt context */
 	schedule_work(&adapter->tx_timeout_task);
 }
 
-/**
- * ixgb_tx_timeout_task - worker function to reset hardware and dump queues.
- * This function is pointed to by adapter->tx_timeout_task
- *
- * @param netdev network interface device structure 
- **/
-
-static void
-ixgb_tx_timeout_task(struct net_device *netdev)
+static void ixgb_tx_timeout_task(struct net_device *netdev)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
 
-	IXGB_DBG("ixgb_tx_timeout_task\n");
-
 	netif_device_detach(netdev);
 	ixgb_down(adapter, TRUE);
 	ixgb_up(adapter);
@@ -1460,15 +1384,14 @@
 }
 
 /**
- * ixgb_get_stats - Get System Network Statistics.
- * @param netdev network interface device structure
+ * ixgb_get_stats - Get System Network Statistics
+ * @netdev: network interface device structure
  *
  * Returns the address of the device statistics structure.
  * The statistics are actually updated from the timer callback.
  **/
 
-static struct net_device_stats *
-ixgb_get_stats(struct net_device *netdev)
+static struct net_device_stats *ixgb_get_stats(struct net_device *netdev)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
 
@@ -1476,22 +1399,19 @@
 }
 
 /**
- * ixgb_change_mtu - Change the Maximum Transfer Unit.
- * @param netdev network interface device structure
- * @param new_mtu new value for maximum frame size
+ * ixgb_change_mtu - Change the Maximum Transfer Unit
+ * @netdev: network interface device structure
+ * @new_mtu: new value for maximum frame size
  *
  * Returns 0 on success, negative on failure
  **/
 
-static int
-ixgb_change_mtu(struct net_device *netdev, int new_mtu)
+static int ixgb_change_mtu(struct net_device *netdev, int new_mtu)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
-	u32 old_mtu = adapter->rx_buffer_len;
+	uint32_t old_mtu = adapter->rx_buffer_len;
 	int max_frame = new_mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
 
-	IXGB_DBG("ixgb_change_mtu\n");
-
 	if ((max_frame < IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH)
 	    || (max_frame > IXGB_MAX_JUMBO_FRAME_SIZE + ENET_FCS_LENGTH)) {
 		IXGB_ERR("Invalid MTU setting\n");
@@ -1513,69 +1433,23 @@
 		adapter->rx_buffer_len = IXGB_RXBUFFER_16384;
 	}
 
+	netdev->mtu = new_mtu;
+
 	if (old_mtu != adapter->rx_buffer_len && netif_running(netdev)) {
 
 		ixgb_down(adapter, TRUE);
 		ixgb_up(adapter);
 	}
 
-	if (adapter->hw.max_frame_size != max_frame) {
-		struct ixgb_hw *hw = &adapter->hw;
-
-		adapter->hw.max_frame_size = max_frame;
-
-		IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT);
-
-		if (hw->max_frame_size >
-		    IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) {
-			u32 ctrl0 = IXGB_READ_REG(hw, CTRL0);
-
-			if (!(ctrl0 & IXGB_CTRL0_JFE)) {
-				ctrl0 |= IXGB_CTRL0_JFE;
-				IXGB_WRITE_REG(hw, CTRL0, ctrl0);
-			}
-		}
-
-		printk(KERN_ERR "%s: ixgb_change_mtu MFS is set to <%x>\n",
-		       adapter->netdev->name,
-		       (IXGB_READ_REG(hw, MFS) >> IXGB_MFS_SHIFT));
-	}
-
-	netdev->mtu = new_mtu;
-
-	return 0;
-}
-
-/**
- * ixgb_set_mac - Change the Ethernet Address of the NIC.
- * @param netdev network interface device structure
- * @param p pointer to an address structure
- * 
- * Returns 0 on success, negative on failure
- **/
-
-static int
-ixgb_set_mac(struct net_device *netdev, void *p)
-{
-	struct ixgb_adapter *adapter = netdev->priv;
-	struct sockaddr *addr = (struct sockaddr *) p;
-
-	IXGB_DBG("ixgb_set_mac\n");
-
-	memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
-
-	ixgb_rar_set(&adapter->hw, addr->sa_data, 0);
-
 	return 0;
 }
 
 /**
  * ixgb_update_stats - Update the board statistics counters.
- * @param adapter board private structure
+ * @adapter: board private structure
  **/
 
-static void
-ixgb_update_stats(struct ixgb_adapter *adapter)
+static void ixgb_update_stats(struct ixgb_adapter *adapter)
 {
 	adapter->stats.tprl += IXGB_READ_REG(&adapter->hw, TPRL);
 	adapter->stats.tprh += IXGB_READ_REG(&adapter->hw, TPRH);
@@ -1678,309 +1552,241 @@
 
 /**
  * ixgb_irq_disable - Mask off interrupt generation on the NIC
- * @param adapter board private structure
+ * @adapter: board private structure
  **/
 
-static inline void
-ixgb_irq_disable(struct ixgb_adapter *adapter)
+static inline void ixgb_irq_disable(struct ixgb_adapter *adapter)
 {
-	IXGB_DBG("ixgb_irq_disable\n");
-
 	atomic_inc(&adapter->irq_sem);
 	IXGB_WRITE_REG(&adapter->hw, IMC, ~0);
-	synchronize_irq(adapter->netdev->irq);
+	IXGB_WRITE_FLUSH(&adapter->hw);
+	synchronize_irq(adapter->pdev->irq);
 }
 
 /**
- * ixgb_irq_enable - Enable default interrupt generation settings.
- * @param adapter board private structure
+ * ixgb_irq_enable - Enable default interrupt generation settings
+ * @adapter: board private structure
  **/
 
-static inline void
-ixgb_irq_enable(struct ixgb_adapter *adapter)
+static inline void ixgb_irq_enable(struct ixgb_adapter *adapter)
 {
-	IXGB_DBG("ixgb_irq_enable\n");
-
 	if (atomic_dec_and_test(&adapter->irq_sem)) {
 		IXGB_WRITE_REG(&adapter->hw, IMS,
 			       IXGB_INT_RXT0 | IXGB_INT_RXDMT0 | IXGB_INT_TXDW |
 			       IXGB_INT_RXO | IXGB_INT_LSC);
+		IXGB_WRITE_FLUSH(&adapter->hw);
 	}
 }
 
 #define IXGB_MAX_INTR 10
 /**
- * ixgb_intr - Interrupt Handler.
- * @param irq interrupt number
- * @param data pointer to a network interface device structure
- * @param regs CPU registers structure
+ * ixgb_intr - Interrupt Handler
+ * @irq: interrupt number
+ * @data: pointer to a network interface device structure
+ * @pt_regs: CPU registers structure
  **/
 
-static irqreturn_t
-ixgb_intr(int irq, void *data, struct pt_regs *regs)
+static irqreturn_t ixgb_intr(int irq, void *data, struct pt_regs *regs)
 {
-	struct net_device *netdev = (struct net_device *) data;
+	struct net_device *netdev = data;
 	struct ixgb_adapter *adapter = netdev->priv;
-#ifdef CONFIG_IXGB_NAPI
-	if (netif_rx_schedule_prep(netdev)) {
-		ixgb_irq_disable(adapter);
-		__netif_rx_schedule(netdev);
-	}
-
-	return IRQ_HANDLED; /* FIXME: check for shared interrupts */
-#else
 	struct ixgb_hw *hw = &adapter->hw;
-	u32 icr;
-	uint i = IXGB_MAX_INTR;
-	boolean_t rxdmt0 = FALSE;
-	int handled = 0;
-
-	while (i && (icr = IXGB_READ_REG(hw, ICR))) {
-		handled = 1;
+	uint32_t icr = IXGB_READ_REG(&adapter->hw, ICR);
+#ifndef CONFIG_IXGB_NAPI
+	unsigned int i;
+#endif
 
-		if (icr & IXGB_INT_RXDMT0)
-			rxdmt0 = TRUE;
+	if (unlikely(!icr))
+		return IRQ_NONE;	/* Not our interrupt */
 
-		if (unlikely(icr & (IXGB_INT_RXSEQ | IXGB_INT_LSC))) {
-			mod_timer(&adapter->watchdog_timer, jiffies);
-		}
+	if (unlikely(icr & (IXGB_INT_RXSEQ | IXGB_INT_LSC))) {
+		mod_timer(&adapter->watchdog_timer, jiffies);
+	}
+#ifdef CONFIG_IXGB_NAPI
+	if (netif_rx_schedule_prep(netdev)) {
 
-		/* adapter->generate_int = 0; */
-		ixgb_clean_rx_irq(adapter);
-		ixgb_clean_tx_irq(adapter);
+		/* Disable interrupts and register for poll. The flush 
+		   of the posted write is intentionally left out.
+		 */
 
-		i--;
+		atomic_inc(&adapter->irq_sem);
+		IXGB_WRITE_REG(hw, IMC, ~0);
+		__netif_rx_schedule(netdev);
 	}
-
+#else
+	for (i = 0; i < IXGB_MAX_INTR; i++)
+		if (!ixgb_clean_rx_irq(adapter) & !ixgb_clean_tx_irq(adapter))
+			break;
 	/* if RAIDC:EN == 1 and ICR:RXDMT0 == 1, we need to
 	 * set IMS:RXDMT0 to 1 to restart the RBD timer (POLL)
 	 */
-	if (rxdmt0 && adapter->raidc) {
+	if ((icr & IXGB_INT_RXDMT0) && adapter->raidc) {
 		/* ready the timer by writing the clear reg */
 		IXGB_WRITE_REG(hw, IMC, IXGB_INT_RXDMT0);
 		/* now restart it, h/w will decide if its necessary */
 		IXGB_WRITE_REG(hw, IMS, IXGB_INT_RXDMT0);
 	}
-
-	return IRQ_RETVAL(handled);
-#endif				// NAPI else
+#endif
+	return IRQ_HANDLED;
 }
 
 #ifdef CONFIG_IXGB_NAPI
-static int
-ixgb_process_intr(struct net_device *netdev)
+/**
+ * ixgb_clean - NAPI Rx polling callback
+ * @adapter: board private structure
+ **/
+
+static int ixgb_clean(struct net_device *netdev, int *budget)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
-	u32 icr;
-	int i = IXGB_MAX_INTR;
-	int hasReceived = 0;
-
-	while (i && (icr = IXGB_READ_REG(&adapter->hw, ICR))) {
-		if (icr & IXGB_INT_RXT0)
-			hasReceived = 1;
+	int work_to_do = min(*budget, netdev->quota);
+	int work_done = 0;
 
-		if (!(icr & ~(IXGB_INT_RXT0)))
-			break;
+	ixgb_clean_tx_irq(adapter);
+	ixgb_clean_rx_irq(adapter, &work_done, work_to_do);
 
-		if (icr & (IXGB_INT_RXSEQ | IXGB_INT_LSC)) {
-			mod_timer(&adapter->watchdog_timer, jiffies);
-		}
+	*budget -= work_done;
+	netdev->quota -= work_done;
 
-		ixgb_clean_tx_irq(adapter);
-		i--;
+	if (work_done < work_to_do || !netif_running(netdev)) {
+		netif_rx_complete(netdev);
+		/* RAIDC will be automatically restarted by irq_enable */
+		ixgb_irq_enable(adapter);
 	}
 
-	return hasReceived;
+	return (work_done >= work_to_do);
 }
-
 #endif
+
 /**
- * ixgb_clean_tx_irq - Reclaim resources after transmit completes.
- * @param adapter board private structure
+ * ixgb_clean_tx_irq - Reclaim resources after transmit completes
+ * @adapter: board private structure
  **/
 
-static void
-ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
+static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
 {
 	struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
 	struct net_device *netdev = adapter->netdev;
 	struct pci_dev *pdev = adapter->pdev;
-	int i = adapter->tx_ring.next_to_clean;
-	struct ixgb_tx_desc *tx_desc = IXGB_TX_DESC(*tx_ring, i);
-	while ((tx_desc->status & IXGB_TX_DESC_STATUS_DD)) {
-		if (tx_desc->popts
-		    & (IXGB_TX_DESC_POPTS_TXSM | IXGB_TX_DESC_POPTS_IXSM))
-			adapter->hw_csum_tx_good++;
-
-		if (tx_ring->buffer_info[i].dma) {
-			pci_unmap_page(pdev, tx_ring->buffer_info[i].dma,
-				       tx_ring->buffer_info[i].length,
-				       PCI_DMA_TODEVICE);
-			tx_ring->buffer_info[i].dma = 0;
-		}
-
-		if (tx_ring->buffer_info[i].skb) {
-			dev_kfree_skb_any(tx_ring->buffer_info[i].skb);
-			tx_ring->buffer_info[i].skb = NULL;
-		}
-
-		*(u32 *) & (tx_desc->status) = 0;
-
-		i = (i + 1) % tx_ring->count;
-		tx_desc = IXGB_TX_DESC(*tx_ring, i);
-	}
-
-	tx_ring->next_to_clean = i;
-
-	if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev) &&
-	    (IXGB_DESC_UNUSED(tx_ring) > IXGB_TX_QUEUE_WAKE)) {
-
-		netif_wake_queue(netdev);
-	}
-}
-
-#ifdef CONFIG_IXGB_NAPI
-static int
-ixgb_poll(struct net_device *netdev, int *budget)
-{
-	struct ixgb_adapter *adapter = netdev->priv;
-	struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
-	struct pci_dev *pdev = adapter->pdev;
-	struct ixgb_rx_desc *rx_desc;
-	struct sk_buff *skb;
-	u32 length;
-	int i;
-	int received = 0;
-	int rx_work_limit = *budget;
-
-	if (rx_work_limit > netdev->quota)
-		rx_work_limit = netdev->quota;
-
-	ixgb_process_intr(netdev);
-
-	i = rx_ring->next_to_clean;
-	rx_desc = IXGB_RX_DESC(*rx_ring, i);
-
-	while ((rx_desc->status & IXGB_RX_DESC_STATUS_DD)) {
-		if (--rx_work_limit < 0)
-			goto not_done;
-
-		pci_unmap_single(pdev,
-				 rx_ring->buffer_info[i].dma,
-				 rx_ring->buffer_info[i].length,
-				 PCI_DMA_FROMDEVICE);
-
-		skb = rx_ring->buffer_info[i].skb;
-		length = le16_to_cpu(rx_desc->length);
-
-		if (!(rx_desc->status & IXGB_RX_DESC_STATUS_EOP)) {
+	struct ixgb_tx_desc *tx_desc, *eop_desc;
+	struct ixgb_buffer *buffer_info;
+	unsigned int i, eop;
+	boolean_t cleaned = FALSE;
+
+	i = tx_ring->next_to_clean;
+	eop = tx_ring->buffer_info[i].next_to_watch;
+	eop_desc = IXGB_TX_DESC(*tx_ring, eop);
+
+	while (eop_desc->status & cpu_to_le32(IXGB_TX_DESC_STATUS_DD)) {
+
+		for (cleaned = FALSE; !cleaned;) {
+			tx_desc = IXGB_TX_DESC(*tx_ring, i);
+			buffer_info = &tx_ring->buffer_info[i];
+
+			if (tx_desc->popts
+			    & (IXGB_TX_DESC_POPTS_TXSM |
+			       IXGB_TX_DESC_POPTS_IXSM))
+				adapter->hw_csum_tx_good++;
+
+			if (buffer_info->dma) {
+
+				pci_unmap_page(pdev,
+					       buffer_info->dma,
+					       buffer_info->length,
+					       PCI_DMA_TODEVICE);
 
-			/* All receives must fit into a single buffer */
-
-			IXGB_DBG("Receive packet consumed multiple buffers\n");
-
-			dev_kfree_skb_irq(skb);
-			rx_desc->status = 0;
-			rx_ring->buffer_info[i].skb = NULL;
-
-			i = (i + 1) % rx_ring->count;
-
-			rx_desc = IXGB_RX_DESC(*rx_ring, i);
-			continue;
-		}
-
-		if (rx_desc->
-		    errors & (IXGB_RX_DESC_ERRORS_CE | IXGB_RX_DESC_ERRORS_SE |
-			      IXGB_RX_DESC_ERRORS_P | IXGB_RX_DESC_ERRORS_RXE))
-		{
+				buffer_info->dma = 0;
+			}
 
-			IXGB_DBG("Receive Errors Reported by Hardware-%x.\n",
-				 rx_desc->errors);
+			if (buffer_info->skb) {
 
-			dev_kfree_skb_irq(skb);
-			rx_desc->status = 0;
-			rx_ring->buffer_info[i].skb = NULL;
-			i = (i + 1) % rx_ring->count;
-			rx_desc = IXGB_RX_DESC(*rx_ring, i);
-			continue;
-		}
+				dev_kfree_skb_any(buffer_info->skb);
 
-		/* Good Receive */
-		skb_put(skb, length);
+				buffer_info->skb = NULL;
+			}
 
-		/* Receive Checksum Offload */
-		ixgb_rx_checksum(adapter, rx_desc, skb);
+			*(uint32_t *) & (tx_desc->status) = 0;
 
-		skb->protocol = eth_type_trans(skb, netdev);
-		if (adapter->vlgrp
-		    && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) {
-			vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
-				(rx_desc-> special & IXGB_RX_DESC_SPECIAL_VLAN_MASK));
-		} else {
-			netif_receive_skb(skb);
+			cleaned = (i == eop);
+			if (++i == tx_ring->count)
+				i = 0;
 		}
-		netdev->last_rx = jiffies;
-
-		rx_desc->status = 0;
-		rx_ring->buffer_info[i].skb = NULL;
-
-		i = (i + 1) % rx_ring->count;
 
-		rx_desc = IXGB_RX_DESC(*rx_ring, i);
-		received++;
+		eop = tx_ring->buffer_info[i].next_to_watch;
+		eop_desc = IXGB_TX_DESC(*tx_ring, eop);
 	}
 
-	if (!received)
-		received = 1;
-
-	ixgb_alloc_rx_buffers(adapter);
-
-	rx_ring->next_to_clean = i;
-	netdev->quota -= received;
-	*budget -= received;
-
-	netif_rx_complete(netdev);
-
-	/* NOTE: RAIDC will be automatically restarted by this enable */
-	ixgb_irq_enable(adapter);
-	return 0;
-
-      not_done:
+	tx_ring->next_to_clean = i;
 
-	ixgb_alloc_rx_buffers(adapter);
+	spin_lock(&adapter->tx_lock);
+	if (cleaned && netif_queue_stopped(netdev) && netif_carrier_ok(netdev)
+	    && (IXGB_DESC_UNUSED(tx_ring) > IXGB_TX_QUEUE_WAKE)) {
 
-	rx_ring->next_to_clean = i;
-	netdev->quota -= received;
-	*budget -= received;
+		netif_wake_queue(netdev);
+	}
+	spin_unlock(&adapter->tx_lock);
 
-	return 1;
+	return cleaned;
 }
-#else
+
 /**
- * ixgb_clean_rx_irq - Send received data up the network stack.
- * @param adapter board private structure
+ * ixgb_clean_rx_irq - Send received data up the network stack,
+ * @adapter: board private structure
  **/
 
-static void
+static boolean_t
+#ifdef CONFIG_IXGB_NAPI
+ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
+#else
 ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
+#endif
 {
 	struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
 	struct net_device *netdev = adapter->netdev;
 	struct pci_dev *pdev = adapter->pdev;
-	struct ixgb_rx_desc *rx_desc;
-	struct sk_buff *skb;
-	u32 length;
-	int i;
+	struct ixgb_rx_desc *rx_desc, *next_rxd;
+	struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer;
+	struct sk_buff *skb, *next_skb;
+	uint32_t length;
+	unsigned int i, j;
+	boolean_t cleaned = FALSE;
 
 	i = rx_ring->next_to_clean;
 	rx_desc = IXGB_RX_DESC(*rx_ring, i);
+	buffer_info = &rx_ring->buffer_info[i];
+
+	while (rx_desc->status & IXGB_RX_DESC_STATUS_DD) {
+
+		skb = buffer_info->skb;
+		prefetch(skb->data);
 
-	while ((rx_desc->status & IXGB_RX_DESC_STATUS_DD)) {
-		pci_unmap_single(pdev, rx_ring->buffer_info[i].dma,
-				 rx_ring->buffer_info[i].length,
-				 PCI_DMA_FROMDEVICE);
+		if (++i == rx_ring->count)
+			i = 0;
+		next_rxd = IXGB_RX_DESC(*rx_ring, i);
+		prefetch(next_rxd);
+
+		if ((j = i + 1) == rx_ring->count)
+			j = 0;
+		next2_buffer = &rx_ring->buffer_info[j];
+		prefetch(next2_buffer);
+
+		next_buffer = &rx_ring->buffer_info[i];
+		next_skb = next_buffer->skb;
+		prefetch(next_skb);
+
+#ifdef CONFIG_IXGB_NAPI
+		if (*work_done >= work_to_do)
+			break;
+
+		(*work_done)++;
+#endif
+
+		cleaned = TRUE;
+
+		pci_unmap_single(pdev,
+				 buffer_info->dma,
+				 buffer_info->length, PCI_DMA_FROMDEVICE);
 
-		skb = rx_ring->buffer_info[i].skb;
 		length = le16_to_cpu(rx_desc->length);
 
 		if (unlikely(!(rx_desc->status & IXGB_RX_DESC_STATUS_EOP))) {
@@ -1992,9 +1798,10 @@
 
 			dev_kfree_skb_irq(skb);
 			rx_desc->status = 0;
-			rx_ring->buffer_info[i].skb = NULL;
-			i = (i + 1) % rx_ring->count;
-			rx_desc = IXGB_RX_DESC(*rx_ring, i);
+			buffer_info->skb = NULL;
+
+			rx_desc = next_rxd;
+			buffer_info = next_buffer;
 			continue;
 		}
 
@@ -2003,14 +1810,12 @@
 				| IXGB_RX_DESC_ERRORS_P |
 				IXGB_RX_DESC_ERRORS_RXE))) {
 
-			IXGB_DBG("Receive Errors Reported by Hardware-%x.\n",
-				 rx_desc->errors);
-
 			dev_kfree_skb_irq(skb);
 			rx_desc->status = 0;
-			rx_ring->buffer_info[i].skb = NULL;
-			i = (i + 1) % rx_ring->count;
-			rx_desc = IXGB_RX_DESC(*rx_ring, i);
+			buffer_info->skb = NULL;
+
+			rx_desc = next_rxd;
+			buffer_info = next_buffer;
 			continue;
 		}
 
@@ -2021,53 +1826,63 @@
 		ixgb_rx_checksum(adapter, rx_desc, skb);
 
 		skb->protocol = eth_type_trans(skb, netdev);
+#ifdef CONFIG_IXGB_NAPI
+		if (adapter->vlgrp
+		    && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) {
+			vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
+						 le16_to_cpu(rx_desc->
+							     special &
+							     IXGB_RX_DESC_SPECIAL_VLAN_MASK));
+		} else {
+			netif_receive_skb(skb);
+		}
+#else				/* CONFIG_IXGB_NAPI */
 		if (adapter->vlgrp
 		    && (rx_desc->status & IXGB_RX_DESC_STATUS_VP)) {
 			vlan_hwaccel_rx(skb, adapter->vlgrp,
-					(rx_desc->
-					 special &
-					 IXGB_RX_DESC_SPECIAL_VLAN_MASK));
+					le16_to_cpu(rx_desc->
+						    special &
+						    IXGB_RX_DESC_SPECIAL_VLAN_MASK));
 		} else {
 			netif_rx(skb);
 		}
-
+#endif				/* CONFIG_IXGB_NAPI */
 		netdev->last_rx = jiffies;
 
 		rx_desc->status = 0;
+		buffer_info->skb = NULL;
 
-		rx_ring->buffer_info[i].skb = NULL;
-		i = (i + 1) % rx_ring->count;
-
-		rx_desc = IXGB_RX_DESC(*rx_ring, i);
-	}			/* while */
+		rx_desc = next_rxd;
+		buffer_info = next_buffer;
+	}
 
 	rx_ring->next_to_clean = i;
 
 	ixgb_alloc_rx_buffers(adapter);
+
+	return cleaned;
 }
-#endif
 
 /**
- * ixgb_alloc_rx_buffers - Replace used receive buffers.
- * @param adapter address of board private structure
+ * ixgb_alloc_rx_buffers - Replace used receive buffers
+ * @adapter: address of board private structure
  **/
 
-static void
-ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter)
+static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter)
 {
 	struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
 	struct net_device *netdev = adapter->netdev;
 	struct pci_dev *pdev = adapter->pdev;
 	struct ixgb_rx_desc *rx_desc;
+	struct ixgb_buffer *buffer_info;
 	struct sk_buff *skb;
-	int reserve_len;
-	int i;
+	int reserve_len = 2;
+	unsigned int i;
 	int num_group_tail_writes;
 	long cleancount;
 
-	reserve_len = 2;
-
 	i = rx_ring->next_to_use;
+	buffer_info = &rx_ring->buffer_info[i];
 	cleancount = IXGB_DESC_UNUSED(rx_ring);
 
 	/* lessen this to 4 if we're
@@ -2080,14 +1895,13 @@
 	while (--cleancount > 0) {
 		rx_desc = IXGB_RX_DESC(*rx_ring, i);
 
-		/* allocate a new one */
 		skb = dev_alloc_skb(adapter->rx_buffer_len + reserve_len);
 
 		if (unlikely(!skb)) {
-			/* better luck next time around */
-			IXGB_DBG("Could not allocate SKB\n");
+			/* Better luck next round */
 			break;
 		}
+
 		/* Make buffer alignment 2 beyond a 16 byte boundary
 		 * this will result in a 16 byte aligned IP header after
 		 * the 14 byte MAC header is removed
@@ -2096,24 +1910,28 @@
 
 		skb->dev = netdev;
 
-		rx_ring->buffer_info[i].skb = skb;
-		rx_ring->buffer_info[i].length = adapter->rx_buffer_len;
-		rx_ring->buffer_info[i].dma =
-		    pci_map_single(pdev, skb->data, adapter->rx_buffer_len,
-				   PCI_DMA_FROMDEVICE);
+		buffer_info->skb = skb;
+		buffer_info->length = adapter->rx_buffer_len;
+		buffer_info->dma =
+		    pci_map_single(pdev,
+				   skb->data,
+				   adapter->rx_buffer_len, PCI_DMA_FROMDEVICE);
 
-		rx_desc->buff_addr = cpu_to_le64(rx_ring->buffer_info[i].dma);
+		rx_desc->buff_addr = cpu_to_le64(buffer_info->dma);
 
-		if (!(i % num_group_tail_writes)) {
+		if ((i & ~(num_group_tail_writes - 1)) == i) {
 			/* Force memory writes to complete before letting h/w
 			 * know there are new descriptors to fetch.  (Only
 			 * applicable for weak-ordered memory model archs,
 			 * such as IA-64). */
 			wmb();
-			/* move tail */
+
 			IXGB_WRITE_REG(&adapter->hw, RDT, i);
 		}
-		i = (i + 1) % rx_ring->count;
+
+		if (++i == rx_ring->count)
+			i = 0;
+		buffer_info = &rx_ring->buffer_info[i];
 	}
 
 	rx_ring->next_to_use = i;
@@ -2126,14 +1944,11 @@
  * @param cmd ioctl command to execute
  **/
 
-int
-ixgb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
+static int ixgb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 {
-
 	switch (cmd) {
 	case SIOCETHTOOL:
 		return ixgb_ethtool_ioctl(netdev, ifr);
-
 	default:
 		return -EOPNOTSUPP;
 	}
@@ -2142,17 +1957,49 @@
 }
 
 /**
+ * ixgb_rx_checksum - Receive Checksum Offload for 82597.
+ * @adapter: board private structure
+ * @rx_desc: receive descriptor
+ * @sk_buff: socket buffer with received data
+ **/
+
+static inline void
+ixgb_rx_checksum(struct ixgb_adapter *adapter,
+		 struct ixgb_rx_desc *rx_desc, struct sk_buff *skb)
+{
+	/* Ignore Checksum bit is set OR 
+	 * TCP Checksum has not been calculated 
+	 */
+	if ((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) ||
+	    (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) {
+		skb->ip_summed = CHECKSUM_NONE;
+		return;
+	}
+
+	/* At this point we know the hardware did the TCP checksum */
+	/* now look at the TCP checksum error bit */
+	if (rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) {
+		/* let the stack verify checksum errors */
+		skb->ip_summed = CHECKSUM_NONE;
+		adapter->hw_csum_rx_error++;
+	} else {
+		/* TCP checksum is good */
+		skb->ip_summed = CHECKSUM_UNNECESSARY;
+		adapter->hw_csum_rx_good++;
+	}
+}
+
+/**
  * ixgb_vlan_rx_register - enables or disables vlan tagging/stripping.
  * 
  * @param netdev network interface device structure
  * @param grp indicates to enable or disable tagging/stripping
  **/
-
 static void
 ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
-	u32 ctrl, rctl;
+	uint32_t ctrl, rctl;
 
 	ixgb_irq_disable(adapter);
 	adapter->vlgrp = grp;
@@ -2164,17 +2011,20 @@
 		IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
 
 		/* enable VLAN receive filtering */
+
 		rctl = IXGB_READ_REG(&adapter->hw, RCTL);
 		rctl |= IXGB_RCTL_VFE;
 		rctl &= ~IXGB_RCTL_CFIEN;
 		IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
 	} else {
 		/* disable VLAN tag insert/strip */
+
 		ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
 		ctrl &= ~IXGB_CTRL0_VME;
 		IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
 
 		/* disable VLAN filtering */
+
 		rctl = IXGB_READ_REG(&adapter->hw, RCTL);
 		rctl &= ~IXGB_RCTL_VFE;
 		IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
@@ -2183,17 +2033,10 @@
 	ixgb_irq_enable(adapter);
 }
 
-/**
- * ixgb_vlan_rx_add_vid - adds a vlan id to be tagged/stripped in packet data.
- * @param netdev network interface device structure
- * @param vid the vlan to be added
- **/
-
-static void
-ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
+static void ixgb_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
-	u32 vfta, index;
+	uint32_t vfta, index;
 
 	/* add VID to filter table */
 
@@ -2203,17 +2046,10 @@
 	ixgb_write_vfta(&adapter->hw, index, vfta);
 }
 
-/**
- * ixgb_vlan_rx_kill_vid - removes a vlan id from tag/strip tables.
- * @param netdev network interface device structure
- * @param vid the vlan to be deleted
- **/
-
-static void
-ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
+static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
 {
 	struct ixgb_adapter *adapter = netdev->priv;
-	u32 vfta, index;
+	uint32_t vfta, index;
 
 	ixgb_irq_disable(adapter);
 
@@ -2230,17 +2066,12 @@
 	ixgb_write_vfta(&adapter->hw, index, vfta);
 }
 
-/**
- * ixgb_restore_vlan - restores vlan settings after adapter reset.
- * @param adapter the address of the board private structure
- **/
-static void
-ixgb_restore_vlan(struct ixgb_adapter *adapter)
+static void ixgb_restore_vlan(struct ixgb_adapter *adapter)
 {
 	ixgb_vlan_rx_register(adapter->netdev, adapter->vlgrp);
 
 	if (adapter->vlgrp) {
-		u16 vid;
+		uint16_t vid;
 		for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
 			if (!adapter->vlgrp->vlan_devices[vid])
 				continue;
@@ -2250,55 +2081,6 @@
 }
 
 /**
- * ixgb_rx_checksum - Receive Checksum Offload for 82597.
- * @param adapter board private structure
- * @param rx_desc receive descriptor
- * @param skb socket buffer with received data
- **/
-
-static inline void
-ixgb_rx_checksum(struct ixgb_adapter *adapter,
-		 struct ixgb_rx_desc *rx_desc, struct sk_buff *skb)
-{
-	/* Ignore Checksum bit is set OR 
-	 * TCP Checksum has not been calculated 
-	 */
-	if ((rx_desc->status & IXGB_RX_DESC_STATUS_IXSM) ||
-	    (!(rx_desc->status & IXGB_RX_DESC_STATUS_TCPCS))) {
-		skb->ip_summed = CHECKSUM_NONE;
-		return;
-	}
-
-	/* At this point we know the hardware did the TCP checksum 
-	 * now look at the TCP checksum error bit
-	 */
-	if (rx_desc->errors & IXGB_RX_DESC_ERRORS_TCPE) {
-		/* let the stack verify checksum errors */
-		skb->ip_summed = CHECKSUM_NONE;
-		adapter->hw_csum_rx_error++;
-	} else {
-		/* TCP checksum is good */
-		skb->ip_summed = CHECKSUM_UNNECESSARY;
-		adapter->hw_csum_rx_good++;
-	}
-}
-
-/**
- * ixgb_write_pci_cfg - write PCI configuration space.
- * @param hw board specific data structure
- * @param reg PCI configuration space register to write to
- * @param value Value to be written to reg
- **/
-
-void
-ixgb_write_pci_cfg(struct ixgb_hw *hw, u32 reg, u16 * value)
-{
-	struct ixgb_adapter *adapter = (struct ixgb_adapter *) hw->back;
-
-	pci_write_config_word(adapter->pdev, reg, *value);
-}
-
-/**
  * ixgb_notify_reboot - handles OS notification of reboot event.
  * @param nb notifier block, unused
  * @param event Event being passed to driver to act upon
@@ -2313,7 +2095,7 @@
 	case SYS_DOWN:
 	case SYS_HALT:
 	case SYS_POWER_OFF:
-		while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {
+		while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
 			if (pci_dev_driver(pdev) == &ixgb_driver)
 				ixgb_suspend(pdev, 3);
 		}
@@ -2326,8 +2108,7 @@
  * @param pdev pci driver structure used for passing to
  * @param state power state to enter 
  **/
-static int
-ixgb_suspend(struct pci_dev *pdev, u32 state)
+static int ixgb_suspend(struct pci_dev *pdev, uint32_t state)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct ixgb_adapter *adapter = netdev->priv;
@@ -2345,5 +2126,21 @@
 
 	return 0;
 }
+
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+
+static void ixgb_netpoll(struct net_device *dev)
+{
+	struct ixgb_adapter *adapter = dev->priv;
+	disable_irq(adapter->pdev->irq);
+	ixgb_intr(adapter->pdev->irq, dev, NULL);
+	enable_irq(adapter->pdev->irq);
+}
+#endif
 
 /* ixgb_main.c */
diff -Nru a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
--- a/drivers/net/ixgb/ixgb_osdep.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/ixgb/ixgb_osdep.h	Tue Jun 15 22:20:42 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,14 +23,15 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
-/* glue for the OS independant part of ixgb 
+/* glue for the OS independent part of ixgb
  * includes register access macros
  */
 
-#ifndef IXGB_OSDEP_H
-#define IXGB_OSDEP_H
+#ifndef _IXGB_OSDEP_H_
+#define _IXGB_OSDEP_H_
 
 #include <linux/types.h>
 #include <linux/pci.h>
@@ -39,35 +40,42 @@
 #include <linux/interrupt.h>
 #include <linux/sched.h>
 
-/* FIXME: eliminate me */
+#ifndef msec_delay
 #define msec_delay(x)	do { if(in_interrupt()) { \
-	                	mdelay(x); \
+				/* Don't mdelay in interrupt context! */ \
+	                	BUG(); \
 			} else { \
 				set_current_state(TASK_UNINTERRUPTIBLE); \
-				schedule_timeout((x * HZ)/1000); \
+				schedule_timeout((x * HZ)/1000 + 2); \
 			} } while(0)
+#endif
+
+#define PCI_COMMAND_REGISTER   PCI_COMMAND
+#define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
 
 typedef enum {
+#undef FALSE
 	FALSE = 0,
+#undef TRUE
 	TRUE = 1
 } boolean_t;
 
+#undef ASSERT
+#define ASSERT(x)	if(!(x)) BUG()
 #define MSGOUT(S, A, B)	printk(KERN_DEBUG S "\n", A, B)
 
 #if DBG
-#define ASSERT(x)	if(!(x)) BUG()
-#define DEBUGOUT(S)		printk(KERN_ERR S "\n")
-#define DEBUGOUT1(S, A...)	printk(KERN_ERR S "\n", A)
+#define DEBUGOUT(S)		printk(KERN_DEBUG S "\n")
+#define DEBUGOUT1(S, A...)	printk(KERN_DEBUG S "\n", A)
 #else
-#define ASSERT(x)
 #define DEBUGOUT(S)
 #define DEBUGOUT1(S, A...)
 #endif
 
+#define DEBUGFUNC(F) DEBUGOUT(F)
 #define DEBUGOUT2 DEBUGOUT1
-#define DEBUGOUT3 DEBUGOUT1
-#define DEBUGOUT7 DEBUGOUT1
-#define DEBUGFUNC(F)        DEBUGOUT(F)
+#define DEBUGOUT3 DEBUGOUT2
+#define DEBUGOUT7 DEBUGOUT3
 
 #define IXGB_WRITE_REG(a, reg, value) ( \
     writel((value), ((a)->hw_addr + IXGB_##reg)))
@@ -81,4 +89,8 @@
 #define IXGB_READ_REG_ARRAY(a, reg, offset) ( \
     readl((a)->hw_addr + IXGB_##reg + ((offset) << 2)))
 
-#endif				/* IXGB_OSDEP_H */
+#define IXGB_WRITE_FLUSH(a) IXGB_READ_REG(a, STATUS)
+
+#define IXGB_MEMCPY memcpy
+
+#endif				/* _IXGB_OSDEP_H_ */
diff -Nru a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
--- a/drivers/net/ixgb/ixgb_param.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/ixgb/ixgb_param.c	Tue Jun 15 22:21:05 2004
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   
-  Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+  Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify it 
   under the terms of the GNU General Public License as published by the Free 
@@ -23,6 +23,7 @@
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
 *******************************************************************************/
 
 #include "ixgb.h"
@@ -31,11 +32,11 @@
  * maximum number of ports that the driver can manage.
  */
 
-#define IXGB_MAX_NIC			 8
+#define IXGB_MAX_NIC 8
 
-#define OPTION_UNSET			-1
-#define OPTION_DISABLED			 0
-#define OPTION_ENABLED			 1
+#define OPTION_UNSET    -1
+#define OPTION_DISABLED 0
+#define OPTION_ENABLED  1
 
 /* Module Parameters are always initialized to -1, so that the driver
  * can tell the difference between no user specified value or the
@@ -102,17 +103,14 @@
 
 IXGB_PARAM(XsumRX, "Disable or enable Receive Checksum offload");
 
-/* XsumTX - Transmit Checksum Offload Enable/Disable
+/* Transmit Interrupt Delay in units of 0.8192 microseconds
  *
- * Valid Range: 0, 1
- *  - 0 - disables all checksum offload
- *  - 1 - enables transmmit IP/TCP/UDP checksum offload
- *        on 82597 based NICs
+ * Valid Range: 0-65535
  *
- * Default Value: 1
+ * Default Value: 32
  */
 
-IXGB_PARAM(XsumTX, "Disable or enable Transmit Checksum offload");
+IXGB_PARAM(TxIntDelay, "Transmit Interrupt Delay");
 
 /* Receive Interrupt Delay in units of 0.8192 microseconds
  *
@@ -163,15 +161,6 @@
 
 IXGB_PARAM(FCReqTimeout, "Flow Control Request Timeout");
 
-/* Transmit Interrupt Delay in units of 0.8192 microseconds
- *
- * Valid Range: 0-65535
- *
- * Default Value: 32
- */
-
-IXGB_PARAM(TxIntDelay, "Transmit Interrupt Delay");
-
 /* Interrupt Delay Enable
  *
  * Valid Range: 0, 1
@@ -187,25 +176,31 @@
 #define DEFAULT_TXD			    256
 #define MAX_TXD				   4096
 #define MIN_TXD				     64
+
 #define DEFAULT_RXD			   1024
 #define MAX_RXD				   4096
 #define MIN_RXD				     64
-#define DEFAULT_TIDV			     32
-#define MAX_TIDV		         0xFFFF
+
+#define DEFAULT_TIDV	   		     32
+#define MAX_TIDV			 0xFFFF
 #define MIN_TIDV			      0
-#define DEFAULT_RDTR			     72
+
+#define DEFAULT_RDTR		   	     72
 #define MAX_RDTR			 0xFFFF
 #define MIN_RDTR			      0
+
 #define XSUMRX_DEFAULT		 OPTION_ENABLED
+
 #define FLOW_CONTROL_FULL	   ixgb_fc_full
 #define FLOW_CONTROL_DEFAULT  FLOW_CONTROL_FULL
-#define DEFAULT_FCRTL	    		0x28000
+#define DEFAULT_FCRTL	  		0x28000
 #define DEFAULT_FCRTH			0x30000
 #define MIN_FCRTL			      0
 #define MAX_FCRTL			0x3FFE8
 #define MIN_FCRTH			      8
 #define MAX_FCRTH			0x3FFF0
-#define DEFAULT_FCPAUSE		 	  0x100
+
+#define DEFAULT_FCPAUSE		  	0x100	/* this may be too long */
 #define MIN_FCPAUSE			      1
 #define MAX_FCPAUSE			 0xffff
 
@@ -215,11 +210,11 @@
 	char *err;
 	int def;
 	union {
-		struct {	/* range option information */
+		struct {	/* range_option info */
 			int min;
 			int max;
 		} r;
-		struct {	/* list option information */
+		struct {	/* list_option info */
 			int nr;
 			struct ixgb_opt_list {
 				int i;
@@ -229,8 +224,7 @@
 	} arg;
 };
 
-static int __devinit
-ixgb_validate_option(int *value, struct ixgb_option *opt)
+static int __devinit ixgb_validate_option(int *value, struct ixgb_option *opt)
 {
 	if (*value == OPTION_UNSET) {
 		*value = opt->def;
@@ -254,8 +248,7 @@
 			return 0;
 		}
 		break;
-	case list_option:
-		{
+	case list_option:{
 			int i;
 			struct ixgb_opt_list *ent;
 
@@ -263,7 +256,7 @@
 				ent = &opt->arg.l.p[i];
 				if (*value == ent->i) {
 					if (ent->str[0] != '\0')
-						printk(KERN_INFO "%s",
+						printk(KERN_INFO "%s\n",
 						       ent->str);
 					return 0;
 				}
@@ -274,8 +267,8 @@
 		BUG();
 	}
 
-	printk(KERN_INFO "Invalid %s specified (%i) %s\n", opt->name, *value,
-	       opt->err);
+	printk(KERN_INFO "Invalid %s specified (%i) %s\n",
+	       opt->name, *value, opt->err);
 	*value = opt->def;
 	return -1;
 }
@@ -286,24 +279,20 @@
  * ixgb_check_options - Range Checking for Command Line Parameters
  * @adapter: board private structure
  *
- * This routine checks all command line paramters for valid user
+ * This routine checks all command line parameters for valid user
  * input.  If an invalid value is given, or if no user specified
  * value exists, a default value is used.  The final value is stored
  * in a variable in the adapter structure.
  **/
 
-void __devinit
-ixgb_check_options(struct ixgb_adapter *adapter)
+void __devinit ixgb_check_options(struct ixgb_adapter *adapter)
 {
-	int board = adapter->bd_number;
-
-	IXGB_DBG("ixgb_check_options\n");
-
-	if (board >= IXGB_MAX_NIC) {
-		printk(KERN_NOTICE "Warning: no configuration for board #%i\n",
-		       board);
+	int bd = adapter->bd_number;
+	if (bd >= IXGB_MAX_NIC) {
+		printk(KERN_NOTICE
+		       "Warning: no configuration for board #%i\n", bd);
 		printk(KERN_NOTICE "Using defaults for all values\n");
-		board = IXGB_MAX_NIC;
+		bd = IXGB_MAX_NIC;
 	}
 
 	{			/* Transmit Descriptor Count */
@@ -312,63 +301,50 @@
 			.name = "Transmit Descriptors",
 			.err = "using default of " __MODULE_STRING(DEFAULT_TXD),
 			.def = DEFAULT_TXD,
-			.arg = {.r = {.min = MIN_TXD,.max = MAX_TXD}}
+			.arg = {.r = {.min = MIN_TXD,
+				      .max = MAX_TXD}}
 		};
 		struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
 
-		tx_ring->count = TxDescriptors[board];
+		tx_ring->count = TxDescriptors[bd];
 		ixgb_validate_option(&tx_ring->count, &opt);
 		IXGB_ROUNDUP(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
 	}
-
 	{			/* Receive Descriptor Count */
 		struct ixgb_option opt = {
 			.type = range_option,
 			.name = "Receive Descriptors",
 			.err = "using default of " __MODULE_STRING(DEFAULT_RXD),
 			.def = DEFAULT_RXD,
-			.arg = {.r = {.min = MIN_RXD,.max = MAX_RXD}}
+			.arg = {.r = {.min = MIN_RXD,
+				      .max = MAX_RXD}}
 		};
 		struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
 
-		rx_ring->count = RxDescriptors[board];
+		rx_ring->count = RxDescriptors[bd];
 		ixgb_validate_option(&rx_ring->count, &opt);
 		IXGB_ROUNDUP(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
 	}
-
 	{			/* Receive Checksum Offload Enable */
 		struct ixgb_option opt = {
 			.type = enable_option,
 			.name = "Receive Checksum Offload",
 			.err = "defaulting to Enabled",
-			.def = OPTION_ENABLED,
+			.def = OPTION_ENABLED
 		};
-		int rx_csum = XsumRX[board];
 
+		int rx_csum = XsumRX[bd];
 		ixgb_validate_option(&rx_csum, &opt);
 		adapter->rx_csum = rx_csum;
 	}
-
-	{			/* Transmit Checksum Offload Enable */
-		struct ixgb_option opt = {
-			.type = enable_option,
-			.name = "Transmit Checksum Offload",
-			.err = "defaulting to Enabled",
-			.def = OPTION_ENABLED,
-		};
-		int tx_csum = XsumTX[board];
-
-		ixgb_validate_option(&tx_csum, &opt);
-		adapter->tx_csum = tx_csum;
-	}
-
 	{			/* Flow Control */
-		struct ixgb_opt_list fc_list[] = {
-			{ixgb_fc_none, "Flow Control Disabled\n"},
-			{ixgb_fc_rx_pause, "Flow Control Receive Only\n"},
-			{ixgb_fc_tx_pause, "Flow Control Transmit Only\n"},
-			{ixgb_fc_full, "Flow Control Enabled\n"},
-			{ixgb_fc_default, "Flow Control Hardware Default\n"}
+
+		struct ixgb_opt_list fc_list[] =
+		    { {ixgb_fc_none, "Flow Control Disabled"},
+		{ixgb_fc_rx_pause, "Flow Control Receive Only"},
+		{ixgb_fc_tx_pause, "Flow Control Transmit Only"},
+		{ixgb_fc_full, "Flow Control Enabled"},
+		{ixgb_fc_default, "Flow Control Hardware Default"}
 		};
 
 		struct ixgb_option opt = {
@@ -376,60 +352,63 @@
 			.name = "Flow Control",
 			.err = "reading default settings from EEPROM",
 			.def = ixgb_fc_full,
-			.arg = {.l = {.nr = LIST_LEN(fc_list),.p = fc_list}}
+			.arg = {.l = {.nr = LIST_LEN(fc_list),
+				      .p = fc_list}}
 		};
 
-		int fc = FlowControl[board];
-
+		int fc = FlowControl[bd];
 		ixgb_validate_option(&fc, &opt);
 		adapter->hw.fc.type = fc;
 	}
 	{			/* Receive Flow Control High Threshold */
-		struct ixgb_option fcrth = {
+		struct ixgb_option opt = {
 			.type = range_option,
 			.name = "Rx Flow Control High Threshold",
 			.err =
 			    "using default of " __MODULE_STRING(DEFAULT_FCRTH),
 			.def = DEFAULT_FCRTH,
-			.arg = {.r = {.min = MIN_FCRTH,.max = MAX_FCRTH}}
+			.arg = {.r = {.min = MIN_FCRTH,
+				      .max = MAX_FCRTH}}
 		};
 
-		adapter->hw.fc.high_water = RxFCHighThresh[board];
-		ixgb_validate_option(&adapter->hw.fc.high_water, &fcrth);
+		adapter->hw.fc.high_water = RxFCHighThresh[bd];
+		ixgb_validate_option(&adapter->hw.fc.high_water, &opt);
 		if (!(adapter->hw.fc.type & ixgb_fc_rx_pause))
 			printk(KERN_INFO
 			       "Ignoring RxFCHighThresh when no RxFC\n");
 	}
 	{			/* Receive Flow Control Low Threshold */
-		struct ixgb_option fcrtl = {
+		struct ixgb_option opt = {
 			.type = range_option,
 			.name = "Rx Flow Control Low Threshold",
 			.err =
 			    "using default of " __MODULE_STRING(DEFAULT_FCRTL),
 			.def = DEFAULT_FCRTL,
-			.arg = {.r = {.min = MIN_FCRTL,.max = MAX_FCRTL}}
+			.arg = {.r = {.min = MIN_FCRTL,
+				      .max = MAX_FCRTL}}
 		};
 
-		adapter->hw.fc.low_water = RxFCLowThresh[board];
-		ixgb_validate_option(&adapter->hw.fc.low_water, &fcrtl);
+		adapter->hw.fc.low_water = RxFCLowThresh[bd];
+		ixgb_validate_option(&adapter->hw.fc.low_water, &opt);
 		if (!(adapter->hw.fc.type & ixgb_fc_rx_pause))
 			printk(KERN_INFO
 			       "Ignoring RxFCLowThresh when no RxFC\n");
 	}
 	{			/* Flow Control Pause Time Request */
-		struct ixgb_option fcpap = {
+		struct ixgb_option opt = {
 			.type = range_option,
 			.name = "Flow Control Pause Time Request",
 			.err =
 			    "using default of "
 			    __MODULE_STRING(DEFAULT_FCPAUSE),
 			.def = DEFAULT_FCPAUSE,
-			.arg = {.r = {.min = MIN_FCPAUSE,.max = MAX_FCPAUSE}}
+			.arg = {.r = {.min = MIN_FCPAUSE,
+				      .max = MAX_FCPAUSE}}
 		};
 
-		int pause_time = FCReqTimeout[board];
+		int pause_time = FCReqTimeout[bd];
 
-		ixgb_validate_option(&pause_time, &fcpap);
+		ixgb_validate_option(&pause_time, &opt);
 		if (!(adapter->hw.fc.type & ixgb_fc_rx_pause))
 			printk(KERN_INFO
 			       "Ignoring FCReqTimeout when no RxFC\n");
@@ -454,10 +433,11 @@
 			.err =
 			    "using default of " __MODULE_STRING(DEFAULT_RDTR),
 			.def = DEFAULT_RDTR,
-			.arg = {.r = {.min = MIN_RDTR,.max = MAX_RDTR}}
+			.arg = {.r = {.min = MIN_RDTR,
+				      .max = MAX_RDTR}}
 		};
 
-		adapter->rx_int_delay = RxIntDelay[board];
+		adapter->rx_int_delay = RxIntDelay[bd];
 		ixgb_validate_option(&adapter->rx_int_delay, &opt);
 	}
 	{			/* Receive Interrupt Moderation */
@@ -465,14 +445,13 @@
 			.type = enable_option,
 			.name = "Advanced Receive Interrupt Moderation",
 			.err = "defaulting to Enabled",
-			.def = OPTION_ENABLED,
+			.def = OPTION_ENABLED
 		};
-		int raidc = RAIDC[board];
+		int raidc = RAIDC[bd];
 
 		ixgb_validate_option(&raidc, &opt);
 		adapter->raidc = raidc;
 	}
-
 	{			/* Transmit Interrupt Delay */
 		struct ixgb_option opt = {
 			.type = range_option,
@@ -480,10 +459,11 @@
 			.err =
 			    "using default of " __MODULE_STRING(DEFAULT_TIDV),
 			.def = DEFAULT_TIDV,
-			.arg = {.r = {.min = MIN_TIDV,.max = MAX_TIDV}}
+			.arg = {.r = {.min = MIN_TIDV,
+				      .max = MAX_TIDV}}
 		};
 
-		adapter->tx_int_delay = TxIntDelay[board];
+		adapter->tx_int_delay = TxIntDelay[bd];
 		ixgb_validate_option(&adapter->tx_int_delay, &opt);
 	}
 
@@ -492,9 +472,9 @@
 			.type = enable_option,
 			.name = "Tx Interrupt Delay Enable",
 			.err = "defaulting to Enabled",
-			.def = OPTION_ENABLED,
+			.def = OPTION_ENABLED
 		};
-		int ide = IntDelayEnable[board];
+		int ide = IntDelayEnable[bd];
 
 		ixgb_validate_option(&ide, &opt);
 		adapter->tx_int_delay_enable = ide;
diff -Nru a/drivers/net/lance.c b/drivers/net/lance.c
--- a/drivers/net/lance.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/lance.c	Tue Jun 15 22:20:37 2004
@@ -37,6 +37,9 @@
 
     Get rid of check_region, check kmalloc return in lance_probe1
     Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 11/01/2001
+
+	Reworked detection, added support for Racal InterLan EtherBlaster cards
+	Vesselin Kostadinov <vesok at yahoo dot com > - 22/4/2004
 */
 
 static const char version[] = "lance.c:v1.15ac 1999/11/13 dplatt@3do.com, becker@cesdis.gsfc.nasa.gov\n";
@@ -62,6 +65,26 @@
 static int lance_probe1(struct net_device *dev, int ioaddr, int irq, int options);
 static int __init do_lance_probe(struct net_device *dev);
 
+
+static struct card {
+	char id_offset14;
+	char id_offset15;
+} cards[] = {
+	{	//"normal"
+		.id_offset14 = 0x57,
+		.id_offset15 = 0x57,
+	},
+	{	//NI6510EB
+		.id_offset14 = 0x52,
+		.id_offset15 = 0x44,
+	},
+	{	//Racal InterLan EtherBlaster
+		.id_offset14 = 0x52,
+		.id_offset15 = 0x49,
+	},
+};
+#define NUM_CARDS 3
+
 #ifdef LANCE_DEBUG
 static int lance_debug = LANCE_DEBUG;
 #else
@@ -380,13 +403,20 @@
 							"lance-probe");
 
 		if (r) {
-			/* Detect "normal" 0x57 0x57 and the NI6510EB 0x52 0x44
-			   signatures w/ minimal I/O reads */
-			char offset15, offset14 = inb(ioaddr + 14);
-			
-			if ((offset14 == 0x52 || offset14 == 0x57) &&
-				((offset15 = inb(ioaddr + 15)) == 0x57 ||
-				 offset15 == 0x44)) {
+			/* Detect the card with minimal I/O reads */
+			char offset14 = inb(ioaddr + 14);
+			int card;
+			for (card = 0; card < NUM_CARDS; ++card)
+				if (cards[card].id_offset14 == offset14)
+					break;
+			if (card < NUM_CARDS) {/*yes, the first byte matches*/
+				char offset15 = inb(ioaddr + 15);
+				for (card = 0; card < NUM_CARDS; ++card)
+					if ((cards[card].id_offset14 == offset14) &&
+						(cards[card].id_offset15 == offset15))
+						break;
+			}
+			if (card < NUM_CARDS) { /*Signature OK*/
 				result = lance_probe1(dev, ioaddr, 0, 0);
 				if (!result) {
 					struct lance_private *lp = dev->priv;
diff -Nru a/drivers/net/natsemi.c b/drivers/net/natsemi.c
--- a/drivers/net/natsemi.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/natsemi.c	Tue Jun 15 22:20:36 2004
@@ -1961,12 +1961,12 @@
 	spin_unlock_irq(&np->lock);
 }
 
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct netdev_private *np = dev->priv;
 	u32 cmd;
 
-	if (get_user(cmd, (u32 *)useraddr))
+	if (get_user(cmd, (u32 __user *)useraddr))
 		return -EFAULT;
 
 	switch (cmd) {
@@ -2417,11 +2417,11 @@
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 
 	switch(cmd) {
 	case SIOCETHTOOL:
-		return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		return netdev_ethtool_ioctl(dev, rq->ifr_data);
 	case SIOCGMIIPHY:		/* Get address of MII PHY in use. */
 	case SIOCDEVPRIVATE:		/* for binary compat, remove in 2.5 */
 		data->phy_id = 1;
diff -Nru a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/ne-h8300.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,666 @@
+/* ne-h8300.c: A NE2000 clone on H8/300 driver for linux. */
+/*
+    original ne.c
+    Written 1992-94 by Donald Becker.
+
+    Copyright 1993 United States Government as represented by the
+    Director, National Security Agency.
+
+    This software may be used and distributed according to the terms
+    of the GNU General Public License, incorporated herein by reference.
+
+    The author may be reached as becker@scyld.com, or C/O
+    Scyld Computing Corporation, 410 Severn Ave., Suite 210, Annapolis MD 21403
+
+    H8/300 modified
+    Yoshinori Sato <ysato@users.sourceforge.jp>
+*/
+
+static const char version1[] =
+"ne-h8300.c:v1.00 2004/04/11 ysato\n";
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+
+#include <asm/system.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+
+#include "8390.h"
+
+/* Some defines that people can play with if so inclined. */
+
+/* Do we perform extra sanity checks on stuff ? */
+/* #define NE_SANITY_CHECK */
+
+/* Do we implement the read before write bugfix ? */
+/* #define NE_RW_BUGFIX */
+
+/* Do we have a non std. amount of memory? (in units of 256 byte pages) */
+/* #define PACKETBUF_MEMSIZE	0x40 */
+
+/* A zero-terminated list of I/O addresses to be probed at boot. */
+
+/* ---- No user-serviceable parts below ---- */
+
+#define NE_BASE	 (dev->base_addr)
+#define NE_CMD	 	0x00
+#define NE_DATAPORT	(ei_status.word16?0x20:0x10)	/* NatSemi-defined port window offset. */
+#define NE_RESET	(ei_status.word16?0x3f:0x1f)	/* Issue a read to reset, a write to clear. */
+#define NE_IO_EXTENT	(ei_status.word16?0x40:0x20)
+
+#define NESM_START_PG	0x40	/* First page of TX buffer */
+#define NESM_STOP_PG	0x80	/* Last page +1 of RX ring */
+
+static int ne_probe1(struct net_device *dev, int ioaddr);
+
+static int ne_open(struct net_device *dev);
+static int ne_close(struct net_device *dev);
+
+static void ne_reset_8390(struct net_device *dev);
+static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
+			  int ring_page);
+static void ne_block_input(struct net_device *dev, int count,
+			  struct sk_buff *skb, int ring_offset);
+static void ne_block_output(struct net_device *dev, const int count,
+		const unsigned char *buf, const int start_page);
+
+
+static u32 reg_offset[16];
+
+static int __init init_reg_offset(struct net_device *dev,unsigned long base_addr)
+{
+	struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+	int i;
+	unsigned char bus_width;
+
+	bus_width = *(volatile unsigned char *)ABWCR;
+	bus_width &= 1 << ((base_addr >> 21) & 7);
+
+	for (i = 0; i < sizeof(reg_offset) / sizeof(u32); i++)
+		if (bus_width == 0)
+			reg_offset[i] = i * 2 + 1;
+		else
+			reg_offset[i] = i;
+
+	ei_local->reg_offset = reg_offset;
+	return 0;
+}
+
+static int __initdata h8300_ne_count = 0;
+#ifdef CONFIG_H8300H_H8MAX
+static unsigned long __initdata h8300_ne_base[] = { 0x800600 };
+static int h8300_ne_irq[] = {EXT_IRQ4};
+#endif
+#ifdef CONFIG_H8300H_AKI3068NET
+static unsigned long __initdata h8300_ne_base[] = { 0x200000 };
+static int h8300_ne_irq[] = {EXT_IRQ5};
+#endif
+
+static inline int init_dev(struct net_device *dev)
+{
+	if (h8300_ne_count < (sizeof(h8300_ne_base) / sizeof(unsigned long))) {
+		dev->base_addr = h8300_ne_base[h8300_ne_count];
+		dev->irq       = h8300_ne_irq[h8300_ne_count];
+		h8300_ne_count++;
+		return 0;
+	} else
+		return -ENODEV;
+}
+
+/*  Probe for various non-shared-memory ethercards.
+
+   NEx000-clone boards have a Station Address PROM (SAPROM) in the packet
+   buffer memory space.  NE2000 clones have 0x57,0x57 in bytes 0x0e,0x0f of
+   the SAPROM, while other supposed NE2000 clones must be detected by their
+   SA prefix.
+
+   Reading the SAPROM from a word-wide card with the 8390 set in byte-wide
+   mode results in doubled values, which can be detected and compensated for.
+
+   The probe is also responsible for initializing the card and filling
+   in the 'dev' and 'ei_status' structures.
+
+   We use the minimum memory size for some ethercard product lines, iff we can't
+   distinguish models.  You can increase the packet buffer size by setting
+   PACKETBUF_MEMSIZE.  Reported Cabletron packet buffer locations are:
+	E1010   starts at 0x100 and ends at 0x2000.
+	E1010-x starts at 0x100 and ends at 0x8000. ("-x" means "more memory")
+	E2010	 starts at 0x100 and ends at 0x4000.
+	E2010-x starts at 0x100 and ends at 0xffff.  */
+
+static int __init do_ne_probe(struct net_device *dev)
+{
+	unsigned int base_addr = dev->base_addr;
+
+	SET_MODULE_OWNER(dev);
+
+	/* First check any supplied i/o locations. User knows best. <cough> */
+	if (base_addr > 0x1ff)	/* Check a single specified location. */
+		return ne_probe1(dev, base_addr);
+	else if (base_addr != 0)	/* Don't probe at all. */
+		return -ENXIO;
+
+	return -ENODEV;
+}
+
+static void cleanup_card(struct net_device *dev)
+{
+	free_irq(dev->irq, dev);
+	release_region(dev->base_addr, NE_IO_EXTENT);
+}
+
+struct net_device * __init ne_probe(int unit)
+{
+	struct net_device *dev = alloc_ei_netdev();
+	int err;
+
+	if (!dev)
+		return ERR_PTR(-ENOMEM);
+
+	if (init_dev(dev))
+		return ERR_PTR(-ENODEV);
+
+	sprintf(dev->name, "eth%d", unit);
+	netdev_boot_setup_check(dev);
+
+	err = init_reg_offset(dev, dev->base_addr);
+	if (err)
+		goto out;
+
+	err = do_ne_probe(dev);
+	if (err)
+		goto out;
+	err = register_netdev(dev);
+	if (err)
+		goto out1;
+	return dev;
+out1:
+	cleanup_card(dev);
+out:
+	free_netdev(dev);
+	return ERR_PTR(err);
+}
+
+static int __init ne_probe1(struct net_device *dev, int ioaddr)
+{
+	int i;
+	unsigned char SA_prom[16];
+	int wordlength = 2;
+	const char *name = NULL;
+	int start_page, stop_page;
+	int reg0, ret;
+	static unsigned version_printed;
+	struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+	unsigned char bus_width;
+
+	if (!request_region(ioaddr, NE_IO_EXTENT, dev->name))
+		return -EBUSY;
+
+	reg0 = inb_p(ioaddr);
+	if (reg0 == 0xFF) {
+		ret = -ENODEV;
+		goto err_out;
+	}
+
+	/* Do a preliminary verification that we have a 8390. */
+	{
+		int regd;
+		outb_p(E8390_NODMA+E8390_PAGE1+E8390_STOP, ioaddr + E8390_CMD);
+		regd = inb_p(ioaddr + EI_SHIFT(0x0d));
+		outb_p(0xff, ioaddr + EI_SHIFT(0x0d));
+		outb_p(E8390_NODMA+E8390_PAGE0, ioaddr + E8390_CMD);
+		inb_p(ioaddr + EN0_COUNTER0); /* Clear the counter by reading. */
+		if (inb_p(ioaddr + EN0_COUNTER0) != 0) {
+			outb_p(reg0, ioaddr + EI_SHIFT(0));
+			outb_p(regd, ioaddr + EI_SHIFT(0x0d));	/* Restore the old values. */
+			ret = -ENODEV;
+			goto err_out;
+		}
+	}
+
+	if (ei_debug  &&  version_printed++ == 0)
+		printk(KERN_INFO "%s", version1);
+
+	printk(KERN_INFO "NE*000 ethercard probe at %08x:", ioaddr);
+
+	/* Read the 16 bytes of station address PROM.
+	   We must first initialize registers, similar to NS8390_init(eifdev, 0).
+	   We can't reliably read the SAPROM address without this.
+	   (I learned the hard way!). */
+	{
+		struct {unsigned char value, offset; } program_seq[] =
+		{
+			{E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD}, /* Select page 0*/
+			{0x48,	EN0_DCFG},	/* Set byte-wide (0x48) access. */
+			{0x00,	EN0_RCNTLO},	/* Clear the count regs. */
+			{0x00,	EN0_RCNTHI},
+			{0x00,	EN0_IMR},	/* Mask completion irq. */
+			{0xFF,	EN0_ISR},
+			{E8390_RXOFF, EN0_RXCR},	/* 0x20  Set to monitor */
+			{E8390_TXOFF, EN0_TXCR},	/* 0x02  and loopback mode. */
+			{32,	EN0_RCNTLO},
+			{0x00,	EN0_RCNTHI},
+			{0x00,	EN0_RSARLO},	/* DMA starting at 0x0000. */
+			{0x00,	EN0_RSARHI},
+			{E8390_RREAD+E8390_START, E8390_CMD},
+		};
+
+		for (i = 0; i < sizeof(program_seq)/sizeof(program_seq[0]); i++)
+			outb_p(program_seq[i].value, ioaddr + program_seq[i].offset);
+
+	}
+	bus_width = *(volatile unsigned char *)ABWCR;
+	bus_width &= 1 << ((ioaddr >> 21) & 7);
+	ei_status.word16 = (bus_width == 0); /* temporary setting */
+	for(i = 0; i < 16 /*sizeof(SA_prom)*/; i++) {
+		SA_prom[i] = inb_p(ioaddr + NE_DATAPORT);
+		inb_p(ioaddr + NE_DATAPORT); /* dummy read */
+	}
+
+	start_page = NESM_START_PG;
+	stop_page = NESM_STOP_PG;
+
+	if (bus_width)
+		wordlength = 1;
+	else
+		outb_p(0x49, ioaddr + EN0_DCFG);
+
+	/* Set up the rest of the parameters. */
+	name = (wordlength == 2) ? "NE2000" : "NE1000";
+
+	if (! dev->irq) {
+		printk(" failed to detect IRQ line.\n");
+		ret = -EAGAIN;
+		goto err_out;
+	}
+
+	/* Snarf the interrupt now.  There's no point in waiting since we cannot
+	   share and the board will usually be enabled. */
+	ret = request_irq(dev->irq, ei_interrupt, 0, name, dev);
+	if (ret) {
+		printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
+		goto err_out;
+	}
+
+	dev->base_addr = ioaddr;
+
+	for(i = 0; i < ETHER_ADDR_LEN; i++) {
+		printk(" %2.2x", SA_prom[i]);
+		dev->dev_addr[i] = SA_prom[i];
+	}
+
+	printk("\n%s: %s found at %#x, using IRQ %d.\n",
+		dev->name, name, ioaddr, dev->irq);
+
+	ei_status.name = name;
+	ei_status.tx_start_page = start_page;
+	ei_status.stop_page = stop_page;
+	ei_status.word16 = (wordlength == 2);
+
+	ei_status.rx_start_page = start_page + TX_PAGES;
+#ifdef PACKETBUF_MEMSIZE
+	 /* Allow the packet buffer size to be overridden by know-it-alls. */
+	ei_status.stop_page = ei_status.tx_start_page + PACKETBUF_MEMSIZE;
+#endif
+
+	ei_status.reset_8390 = &ne_reset_8390;
+	ei_status.block_input = &ne_block_input;
+	ei_status.block_output = &ne_block_output;
+	ei_status.get_8390_hdr = &ne_get_8390_hdr;
+	ei_status.priv = 0;
+	dev->open = &ne_open;
+	dev->stop = &ne_close;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev->poll_controller = ei_poll;
+#endif
+	NS8390_init(dev, 0);
+	return 0;
+
+err_out:
+	release_region(ioaddr, NE_IO_EXTENT);
+	return ret;
+}
+
+static int ne_open(struct net_device *dev)
+{
+	ei_open(dev);
+	return 0;
+}
+
+static int ne_close(struct net_device *dev)
+{
+	if (ei_debug > 1)
+		printk(KERN_DEBUG "%s: Shutting down ethercard.\n", dev->name);
+	ei_close(dev);
+	return 0;
+}
+
+/* Hard reset the card.  This used to pause for the same period that a
+   8390 reset command required, but that shouldn't be necessary. */
+
+static void ne_reset_8390(struct net_device *dev)
+{
+	unsigned long reset_start_time = jiffies;
+	struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+
+	if (ei_debug > 1)
+		printk(KERN_DEBUG "resetting the 8390 t=%ld...", jiffies);
+
+	/* DON'T change these to inb_p/outb_p or reset will fail on clones. */
+	outb(inb(NE_BASE + NE_RESET), NE_BASE + NE_RESET);
+
+	ei_status.txing = 0;
+	ei_status.dmaing = 0;
+
+	/* This check _should_not_ be necessary, omit eventually. */
+	while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
+		if (jiffies - reset_start_time > 2*HZ/100) {
+			printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name);
+			break;
+		}
+	outb_p(ENISR_RESET, NE_BASE + EN0_ISR);	/* Ack intr. */
+}
+
+/* Grab the 8390 specific header. Similar to the block_input routine, but
+   we don't need to be concerned with ring wrap as the header will be at
+   the start of a page, so we optimize accordingly. */
+
+static void ne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
+{
+	struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+	/* This *shouldn't* happen. If it does, it's the last thing you'll see */
+
+	if (ei_status.dmaing)
+	{
+		printk(KERN_EMERG "%s: DMAing conflict in ne_get_8390_hdr "
+			"[DMAstat:%d][irqlock:%d].\n",
+			dev->name, ei_status.dmaing, ei_status.irqlock);
+		return;
+	}
+
+	ei_status.dmaing |= 0x01;
+	outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, NE_BASE + NE_CMD);
+	outb_p(sizeof(struct e8390_pkt_hdr), NE_BASE + EN0_RCNTLO);
+	outb_p(0, NE_BASE + EN0_RCNTHI);
+	outb_p(0, NE_BASE + EN0_RSARLO);		/* On page boundary */
+	outb_p(ring_page, NE_BASE + EN0_RSARHI);
+	outb_p(E8390_RREAD+E8390_START, NE_BASE + NE_CMD);
+
+	if (ei_status.word16) {
+		int len;
+		unsigned short *p = (unsigned short *)hdr;
+		for (len = sizeof(struct e8390_pkt_hdr)>>1; len > 0; len--)
+			*p++ = inw(NE_BASE + NE_DATAPORT);
+	} else
+		insb(NE_BASE + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr));
+
+	outb_p(ENISR_RDC, NE_BASE + EN0_ISR);	/* Ack intr. */
+	ei_status.dmaing &= ~0x01;
+
+	le16_to_cpus(&hdr->count);
+}
+
+/* Block input and output, similar to the Crynwr packet driver.  If you
+   are porting to a new ethercard, look at the packet driver source for hints.
+   The NEx000 doesn't share the on-board packet memory -- you have to put
+   the packet out through the "remote DMA" dataport using outb. */
+
+static void ne_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
+{
+	struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+#ifdef NE_SANITY_CHECK
+	int xfer_count = count;
+#endif
+	char *buf = skb->data;
+
+	/* This *shouldn't* happen. If it does, it's the last thing you'll see */
+	if (ei_status.dmaing)
+	{
+		printk(KERN_EMERG "%s: DMAing conflict in ne_block_input "
+			"[DMAstat:%d][irqlock:%d].\n",
+			dev->name, ei_status.dmaing, ei_status.irqlock);
+		return;
+	}
+	ei_status.dmaing |= 0x01;
+	outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, NE_BASE + NE_CMD);
+	outb_p(count & 0xff, NE_BASE + EN0_RCNTLO);
+	outb_p(count >> 8, NE_BASE + EN0_RCNTHI);
+	outb_p(ring_offset & 0xff, NE_BASE + EN0_RSARLO);
+	outb_p(ring_offset >> 8, NE_BASE + EN0_RSARHI);
+	outb_p(E8390_RREAD+E8390_START, NE_BASE + NE_CMD);
+	if (ei_status.word16)
+	{
+		int len;
+		unsigned short *p = (unsigned short *)buf;
+		for (len = count>>1; len > 0; len--)
+			*p++ = inw(NE_BASE + NE_DATAPORT);
+		if (count & 0x01)
+		{
+			buf[count-1] = inb(NE_BASE + NE_DATAPORT);
+#ifdef NE_SANITY_CHECK
+			xfer_count++;
+#endif
+		}
+	} else {
+		insb(NE_BASE + NE_DATAPORT, buf, count);
+	}
+
+#ifdef NE_SANITY_CHECK
+	/* This was for the ALPHA version only, but enough people have
+	   been encountering problems so it is still here.  If you see
+	   this message you either 1) have a slightly incompatible clone
+	   or 2) have noise/speed problems with your bus. */
+
+	if (ei_debug > 1)
+	{
+		/* DMA termination address check... */
+		int addr, tries = 20;
+		do {
+			/* DON'T check for 'inb_p(EN0_ISR) & ENISR_RDC' here
+			   -- it's broken for Rx on some cards! */
+			int high = inb_p(NE_BASE + EN0_RSARHI);
+			int low = inb_p(NE_BASE + EN0_RSARLO);
+			addr = (high << 8) + low;
+			if (((ring_offset + xfer_count) & 0xff) == low)
+				break;
+		} while (--tries > 0);
+	 	if (tries <= 0)
+			printk(KERN_WARNING "%s: RX transfer address mismatch,"
+				"%#4.4x (expected) vs. %#4.4x (actual).\n",
+				dev->name, ring_offset + xfer_count, addr);
+	}
+#endif
+	outb_p(ENISR_RDC, NE_BASE + EN0_ISR);	/* Ack intr. */
+	ei_status.dmaing &= ~0x01;
+}
+
+static void ne_block_output(struct net_device *dev, int count,
+		const unsigned char *buf, const int start_page)
+{
+	struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
+	unsigned long dma_start;
+#ifdef NE_SANITY_CHECK
+	int retries = 0;
+#endif
+
+	/* Round the count up for word writes.  Do we need to do this?
+	   What effect will an odd byte count have on the 8390?
+	   I should check someday. */
+
+	if (ei_status.word16 && (count & 0x01))
+		count++;
+
+	/* This *shouldn't* happen. If it does, it's the last thing you'll see */
+	if (ei_status.dmaing)
+	{
+		printk(KERN_EMERG "%s: DMAing conflict in ne_block_output."
+			"[DMAstat:%d][irqlock:%d]\n",
+			dev->name, ei_status.dmaing, ei_status.irqlock);
+		return;
+	}
+	ei_status.dmaing |= 0x01;
+	/* We should already be in page 0, but to be safe... */
+	outb_p(E8390_PAGE0+E8390_START+E8390_NODMA, NE_BASE + NE_CMD);
+
+#ifdef NE_SANITY_CHECK
+retry:
+#endif
+
+#ifdef NE8390_RW_BUGFIX
+	/* Handle the read-before-write bug the same way as the
+	   Crynwr packet driver -- the NatSemi method doesn't work.
+	   Actually this doesn't always work either, but if you have
+	   problems with your NEx000 this is better than nothing! */
+
+	outb_p(0x42, NE_BASE + EN0_RCNTLO);
+	outb_p(0x00, NE_BASE + EN0_RCNTHI);
+	outb_p(0x42, NE_BASE + EN0_RSARLO);
+	outb_p(0x00, NE_BASE + EN0_RSARHI);
+	outb_p(E8390_RREAD+E8390_START, NE_BASE + NE_CMD);
+	/* Make certain that the dummy read has occurred. */
+	udelay(6);
+#endif
+
+	outb_p(ENISR_RDC, NE_BASE + EN0_ISR);
+
+	/* Now the normal output. */
+	outb_p(count & 0xff, NE_BASE + EN0_RCNTLO);
+	outb_p(count >> 8,   NE_BASE + EN0_RCNTHI);
+	outb_p(0x00, NE_BASE + EN0_RSARLO);
+	outb_p(start_page, NE_BASE + EN0_RSARHI);
+
+	outb_p(E8390_RWRITE+E8390_START, NE_BASE + NE_CMD);
+	if (ei_status.word16) {
+		int len;
+		unsigned short *p = (unsigned short *)buf;
+		for (len = count>>1; len > 0; len--)
+			outw(*p++, NE_BASE + NE_DATAPORT);
+	} else {
+		outsb(NE_BASE + NE_DATAPORT, buf, count);
+	}
+
+	dma_start = jiffies;
+
+#ifdef NE_SANITY_CHECK
+	/* This was for the ALPHA version only, but enough people have
+	   been encountering problems so it is still here. */
+
+	if (ei_debug > 1)
+	{
+		/* DMA termination address check... */
+		int addr, tries = 20;
+		do {
+			int high = inb_p(NE_BASE + EN0_RSARHI);
+			int low = inb_p(NE_BASE + EN0_RSARLO);
+			addr = (high << 8) + low;
+			if ((start_page << 8) + count == addr)
+				break;
+		} while (--tries > 0);
+
+		if (tries <= 0)
+		{
+			printk(KERN_WARNING "%s: Tx packet transfer address mismatch,"
+				"%#4.4x (expected) vs. %#4.4x (actual).\n",
+				dev->name, (start_page << 8) + count, addr);
+			if (retries++ == 0)
+				goto retry;
+		}
+	}
+#endif
+
+	while ((inb_p(NE_BASE + EN0_ISR) & ENISR_RDC) == 0)
+		if (jiffies - dma_start > 2*HZ/100) {		/* 20ms */
+			printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
+			ne_reset_8390(dev);
+			NS8390_init(dev,1);
+			break;
+		}
+
+	outb_p(ENISR_RDC, NE_BASE + EN0_ISR);	/* Ack intr. */
+	ei_status.dmaing &= ~0x01;
+	return;
+}
+
+
+#ifdef MODULE
+#define MAX_NE_CARDS	1	/* Max number of NE cards per module */
+static struct net_device *dev_ne[MAX_NE_CARDS];
+static int io[MAX_NE_CARDS];
+static int irq[MAX_NE_CARDS];
+static int bad[MAX_NE_CARDS];	/* 0xbad = bad sig or no reset ack */
+
+MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
+MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
+MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
+MODULE_PARM_DESC(io, "I/O base address(es)");
+MODULE_PARM_DESC(irq, "IRQ number(s)");
+MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver");
+MODULE_LICENSE("GPL");
+
+/* This is set up so that no ISA autoprobe takes place. We can't guarantee
+that the ne2k probe is the last 8390 based probe to take place (as it
+is at boot) and so the probe will get confused by any other 8390 cards.
+ISA device autoprobes on a running machine are not recommended anyway. */
+
+int init_module(void)
+{
+	int this_dev, found = 0;
+	int err;
+
+	for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
+		struct net_device *dev = alloc_ei_netdev();
+		if (!dev)
+			break;
+		if (io[this_dev]) {
+			dev->irq = irq[this_dev];
+			dev->mem_end = bad[this_dev];
+			dev->base_addr = io[this_dev];
+		} else {
+			dev->base_addr = h8300_ne_base[this_dev];
+			dev->irq = h8300_ne_irq[this_dev];
+		}
+		err = init_reg_offset(dev, dev->base_addr);
+		if (!err) {
+			if (do_ne_probe(dev) == 0) {
+				if (register_netdev(dev) == 0) {
+					dev_ne[found++] = dev;
+					continue;
+				}
+				cleanup_card(dev);
+			}
+		}
+		free_netdev(dev);
+		if (found)
+			break;
+		if (io[this_dev] != 0)
+			printk(KERN_WARNING "ne.c: No NE*000 card found at i/o = %#x\n", dev->base_addr);
+		else
+			printk(KERN_NOTICE "ne.c: You must supply \"io=0xNNN\" value(s) for ISA cards.\n");
+		return -ENXIO;
+	}
+	if (found)
+		return 0;
+	return -ENODEV;
+}
+
+void cleanup_module(void)
+{
+	int this_dev;
+
+	for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
+		struct net_device *dev = dev_ne[this_dev];
+		if (dev) {
+			unregister_netdev(dev);
+			cleanup_card(dev);
+			free_netdev(dev);
+		}
+	}
+}
+#endif /* MODULE */
diff -Nru a/drivers/net/netconsole.c b/drivers/net/netconsole.c
--- a/drivers/net/netconsole.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/netconsole.c	Tue Jun 15 22:20:40 2004
@@ -40,7 +40,6 @@
 #include <linux/module.h>
 #include <linux/console.h>
 #include <linux/tty_driver.h>
-#include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/string.h>
 #include <linux/sysrq.h>
diff -Nru a/drivers/net/ns83820.c b/drivers/net/ns83820.c
--- a/drivers/net/ns83820.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/ns83820.c	Tue Jun 15 22:21:03 2004
@@ -1190,7 +1190,7 @@
 	return &dev->stats;
 }
 
-static int ns83820_ethtool_ioctl (struct ns83820 *dev, void *useraddr)
+static int ns83820_ethtool_ioctl (struct ns83820 *dev, void __user *useraddr)
 {
 	u32 ethcmd;
 
@@ -1236,7 +1236,7 @@
 
 	switch(cmd) {
 	case SIOCETHTOOL:
-		return ns83820_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		return ns83820_ethtool_ioctl(dev, rq->ifr_data);
 
 	default:
 		return -EOPNOTSUPP;
diff -Nru a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
--- a/drivers/net/pci-skeleton.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/pci-skeleton.c	Tue Jun 15 22:20:36 2004
@@ -1778,7 +1778,7 @@
 static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct netdrv_private *tp = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 	unsigned long flags;
 	int rc = 0;
 
diff -Nru a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
--- a/drivers/net/pcmcia/3c574_cs.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/pcmcia/3c574_cs.c	Tue Jun 15 22:20:38 2004
@@ -1196,7 +1196,7 @@
 {
 	struct el3_private *lp = netdev_priv(dev);
 	ioaddr_t ioaddr = dev->base_addr;
-	u16 *data = (u16 *)&rq->ifr_data;
+	u16 *data = (u16 *)&rq->ifr_ifru;
 	int phy = lp->phys & 0x1f;
 
 	DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n",
diff -Nru a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
--- a/drivers/net/pcmcia/axnet_cs.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/pcmcia/axnet_cs.c	Tue Jun 15 22:20:41 2004
@@ -778,7 +778,7 @@
 static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
     axnet_dev_t *info = PRIV(dev);
-    u16 *data = (u16 *)&rq->ifr_data;
+    u16 *data = (u16 *)&rq->ifr_ifru;
     ioaddr_t mii_addr = dev->base_addr + AXNET_MII_EEP;
     switch (cmd) {
     case SIOCGMIIPHY:
@@ -937,7 +937,6 @@
 static const char *version_8390 =
     "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@scyld.com)\n";
 
-#include <asm/uaccess.h>
 #include <asm/bitops.h>
 #include <asm/irq.h>
 #include <linux/fcntl.h>
diff -Nru a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
--- a/drivers/net/pcmcia/pcnet_cs.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/net/pcmcia/pcnet_cs.c	Tue Jun 15 22:20:44 2004
@@ -1281,7 +1281,7 @@
 static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
     pcnet_dev_t *info = PRIV(dev);
-    u16 *data = (u16 *)&rq->ifr_data;
+    u16 *data = (u16 *)&rq->ifr_ifru;
     ioaddr_t mii_addr = dev->base_addr + DLINK_GPIO;
     switch (cmd) {
     case SIOCGMIIPHY:
diff -Nru a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
--- a/drivers/net/pcmcia/smc91c92_cs.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/pcmcia/smc91c92_cs.c	Tue Jun 15 22:20:42 2004
@@ -2119,12 +2119,12 @@
     return 0;
 }
 
-static int smc_ethtool_ioctl (struct net_device *dev, void *useraddr)
+static int smc_ethtool_ioctl (struct net_device *dev, void __user *useraddr)
 {
     u32 ethcmd;
     struct smc_private *smc = netdev_priv(dev);
 
-    if (get_user(ethcmd, (u32 *)useraddr))
+    if (get_user(ethcmd, (u32 __user *)useraddr))
 	return -EFAULT;
 
     switch (ethcmd) {
@@ -2221,7 +2221,7 @@
     u_short saved_bank;
     ioaddr_t ioaddr = dev->base_addr;
 
-    mii = (struct mii_ioctl_data *) &rq->ifr_data;
+    mii = if_mii(rq);
     if (!netif_running(dev))
     	return -EINVAL;
 
@@ -2229,7 +2229,7 @@
     case SIOCETHTOOL:
 	saved_bank = inw(ioaddr + BANK_SELECT);
 	SMC_SELECT_BANK(3);
-	rc = smc_ethtool_ioctl(dev, (void *) rq->ifr_data);
+	rc = smc_ethtool_ioctl(dev, rq->ifr_data);
 	SMC_SELECT_BANK(saved_bank);
 	break;
 
diff -Nru a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
--- a/drivers/net/pcmcia/xirc2ps_cs.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/pcmcia/xirc2ps_cs.c	Tue Jun 15 22:20:39 2004
@@ -1681,7 +1681,7 @@
 {
     local_info_t *local = netdev_priv(dev);
     ioaddr_t ioaddr = dev->base_addr;
-    u16 *data = (u16 *)&rq->ifr_data;
+    u16 *data = (u16 *)&rq->ifr_ifru;
 
     DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n",
 	  dev->name, rq->ifr_ifrn.ifrn_name, cmd,
diff -Nru a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
--- a/drivers/net/pcnet32.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/pcnet32.c	Tue Jun 15 22:20:38 2004
@@ -22,8 +22,8 @@
  *************************************************************************/
 
 #define DRV_NAME	"pcnet32"
-#define DRV_VERSION	"1.29"
-#define DRV_RELDATE	"04.06.2004"
+#define DRV_VERSION	"1.30c"
+#define DRV_RELDATE	"05.25.2004"
 #define PFX		DRV_NAME ": "
 
 static const char *version =
@@ -86,7 +86,7 @@
 
 static struct net_device *pcnet32_dev;
 
-static int max_interrupt_work = 80;
+static int max_interrupt_work = 2;
 static int rx_copybreak = 200;
 
 #define PCNET32_PORT_AUI      0x00
@@ -132,6 +132,8 @@
 };
 #define PCNET32_TEST_LEN (sizeof(pcnet32_gstrings_test) / ETH_GSTRING_LEN)
 
+#define PCNET32_NUM_REGS 168
+
 #define MAX_UNITS 8	/* More are supported, limit only on options */
 static int options[MAX_UNITS];
 static int full_duplex[MAX_UNITS];
@@ -234,7 +236,15 @@
  *	   Jim Lewis <jklewis@us.ibm.com> added ethernet loopback test.
  *	   Thomas Munck Steenholdt <tmus@tmus.dk> non-mii ioctl corrections.
  * v1.29   6 Apr 2004 Jim Lewis <jklewis@us.ibm.com> added physical
- *	   identification code (blink led's).
+ *	   identification code (blink led's) and register dump.
+ *	   Don Fry added timer for 971/972 so skbufs don't remain on tx ring
+ *	   forever.
+ * v1.30   18 May 2004 Don Fry removed timer and Last Transmit Interrupt
+ *	   (ltint) as they added complexity and didn't give good throughput.
+ * v1.30a  22 May 2004 Don Fry limit frames received during interrupt.
+ * v1.30b  24 May 2004 Don Fry fix bogus tx carrier errors with 79c973,
+ *	   assisted by Bruce Penrod <bmpenrod@endruntechnologies.com>.
+ * v1.30c  25 May 2004 Don Fry added netif_wake_queue after pcnet32_restart.
  */
 
 
@@ -339,7 +349,6 @@
     char		tx_full;
     int			options;
     int	shared_irq:1,			/* shared irq possible */
-	ltint:1,			/* enable TxDone-intr inhibitor */
 	dxsuflo:1,			/* disable transmit stop on uflo */
 	mii:1;				/* mii port available */
     struct net_device	*next;
@@ -372,6 +381,9 @@
 static int pcnet32_loopback_test(struct net_device *dev, uint64_t *data1);
 static int pcnet32_phys_id(struct net_device *dev, u32 data);
 static void pcnet32_led_blink_callback(struct net_device *dev);
+static int pcnet32_get_regs_len(struct net_device *dev);
+static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs,
+	void *ptr);
 
 enum pci_flags_bit {
     PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
@@ -492,9 +504,9 @@
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void pcnet32_poll_controller(struct net_device *dev)
 {
-	disable_irq(dev->irq);
-	pcnet32_interrupt(0, dev, NULL);
-	enable_irq(dev->irq);
+    disable_irq(dev->irq);
+    pcnet32_interrupt(0, dev, NULL);
+    enable_irq(dev->irq);
 }
 #endif
 
@@ -681,7 +693,7 @@
 	    for (i=0; i<6; i++)
 		*packet++ = dev->dev_addr[i];
 	    for (i=0; i<6; i++)
-		*packet++ = dev->dev_addr[i]; 
+		*packet++ = dev->dev_addr[i];
 	    /* type */
 	    *packet++ = 0x08;
 	    *packet++ = 0x06;
@@ -837,6 +849,82 @@
     return 0;
 }
 
+static int pcnet32_get_regs_len(struct net_device *dev)
+{
+    return(PCNET32_NUM_REGS * sizeof(u16));
+}
+
+static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs,
+	void *ptr)
+{
+    int i, csr0;
+    u16 *buff = ptr;
+    struct pcnet32_private *lp = dev->priv;
+    struct pcnet32_access *a = &lp->a;
+    ulong ioaddr = dev->base_addr;
+    int ticks;
+    unsigned long flags;
+
+    spin_lock_irqsave(&lp->lock, flags);
+
+    csr0 = a->read_csr(ioaddr, 0);
+    if (!(csr0 & 0x0004)) {	/* If not stopped */
+	/* set SUSPEND (SPND) - CSR5 bit 0 */
+	a->write_csr(ioaddr, 5, 0x0001);
+
+	/* poll waiting for bit to be set */
+	ticks = 0;
+	while (!(a->read_csr(ioaddr, 5) & 0x0001)) {
+	    spin_unlock_irqrestore(&lp->lock, flags);
+	    mdelay(1);
+	    spin_lock_irqsave(&lp->lock, flags);
+	    ticks++;
+	    if (ticks > 200) {
+		if (netif_msg_hw(lp))
+		    printk(KERN_DEBUG "%s: Error getting into suspend!\n",
+			    dev->name);
+		break;
+	    }
+	}
+    }
+
+    /* read address PROM */
+    for (i=0; i<16; i += 2)
+	*buff++ = inw(ioaddr + i);
+
+    /* read control and status registers */
+    for (i=0; i<90; i++) {
+	*buff++ = a->read_csr(ioaddr, i);
+    }
+
+    *buff++ = a->read_csr(ioaddr, 112);
+    *buff++ = a->read_csr(ioaddr, 114);
+
+    /* read bus configuration registers */
+    for (i=0; i<36; i++) {
+	*buff++ = a->read_bcr(ioaddr, i);
+    }
+
+    /* read mii phy registers */
+    if (lp->mii) {
+	for (i=0; i<32; i++) {
+	    lp->a.write_bcr(ioaddr, 33, ((lp->mii_if.phy_id) << 5) | i);
+	    *buff++ = lp->a.read_bcr(ioaddr, 34);
+	}
+    }
+
+    if (!(csr0 & 0x0004)) {	/* If not stopped */
+	/* clear SUSPEND (SPND) - CSR5 bit 0 */
+	a->write_csr(ioaddr, 5, 0x0000);
+    }
+
+    i = buff - (u16 *)ptr;
+    for (; i < PCNET32_NUM_REGS; i++)
+	*buff++ = 0;
+
+    spin_unlock_irqrestore(&lp->lock, flags);
+}
+
 static struct ethtool_ops pcnet32_ethtool_ops = {
     .get_settings	= pcnet32_get_settings,
     .set_settings	= pcnet32_set_settings,
@@ -853,6 +941,8 @@
     .self_test_count	= pcnet32_self_test_count,
     .self_test		= pcnet32_ethtool_test,
     .phys_id		= pcnet32_phys_id,
+    .get_regs_len	= pcnet32_get_regs_len,
+    .get_regs		= pcnet32_get_regs,
 };
 
 /* only probes for non-PCI devices, the rest are handled by
@@ -924,7 +1014,7 @@
     struct pcnet32_private *lp;
     dma_addr_t lp_dma_addr;
     int i, media;
-    int fdx, mii, fset, dxsuflo, ltint;
+    int fdx, mii, fset, dxsuflo;
     int chip_version;
     char *chipname;
     struct net_device *dev;
@@ -956,7 +1046,7 @@
     }
 
     /* initialize variables */
-    fdx = mii = fset = dxsuflo = ltint = 0;
+    fdx = mii = fset = dxsuflo = 0;
     chip_version = (chip_version >> 12) & 0xffff;
 
     switch (chip_version) {
@@ -976,7 +1066,6 @@
     case 0x2623:
 	chipname = "PCnet/FAST 79C971"; /* PCI */
 	fdx = 1; mii = 1; fset = 1;
-	ltint = 1;
 	break;
     case 0x2624:
 	chipname = "PCnet/FAST+ 79C972"; /* PCI */
@@ -1007,7 +1096,7 @@
 	fdx = 1; mii = 1;
 	break;
     case 0x2628:
-	chipname = "PCnet/FAST III 79C976";
+	chipname = "PCnet/PRO 79C976";
 	fdx = 1; mii = 1;
 	break;
     default:
@@ -1029,7 +1118,6 @@
 	a->write_bcr(ioaddr, 18, (a->read_bcr(ioaddr, 18) | 0x0860));
 	a->write_csr(ioaddr, 80, (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00);
 	dxsuflo = 1;
-	ltint = 1;
     }
 
     dev = alloc_etherdev(0);
@@ -1136,7 +1224,6 @@
     lp->mii_if.phy_id_mask = 0x1f;
     lp->mii_if.reg_num_mask = 0x1f;
     lp->dxsuflo = dxsuflo;
-    lp->ltint = ltint;
     lp->mii = mii;
     lp->msg_enable = pcnet32_debug;
     if ((cards_found >= MAX_UNITS) || (options[cards_found] > sizeof(options_mapping)))
@@ -1355,12 +1442,6 @@
     }
 #endif
 
-    if (lp->ltint) { /* Enable TxDone-intr inhibitor */
-	val = lp->a.read_csr (ioaddr, 5);
-	val |= (1<<14);
-	lp->a.write_csr (ioaddr, 5, val);
-    }
-
     lp->init_block.mode = le16_to_cpu((lp->options & PCNET32_PORT_PORTSEL) << 7);
     pcnet32_load_multicast(dev);
 
@@ -1371,7 +1452,7 @@
 
     /* Re-initialize the PCNET32, and start it when done. */
     lp->a.write_csr (ioaddr, 1, (lp->dma_addr +
-	     offsetof(struct pcnet32_private, init_block)) & 0xffff);
+		offsetof(struct pcnet32_private, init_block)) & 0xffff);
     lp->a.write_csr (ioaddr, 2, (lp->dma_addr +
 		offsetof(struct pcnet32_private, init_block)) >> 16);
 
@@ -1553,12 +1634,16 @@
 	   lp->cur_rx);
 	for (i = 0 ; i < RX_RING_SIZE; i++)
 	printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ",
-	       lp->rx_ring[i].base, -lp->rx_ring[i].buf_length,
-	       lp->rx_ring[i].msg_length, (unsigned)lp->rx_ring[i].status);
+	       le32_to_cpu(lp->rx_ring[i].base),
+	       (-le16_to_cpu(lp->rx_ring[i].buf_length)) & 0xffff,
+	       le32_to_cpu(lp->rx_ring[i].msg_length),
+	       le16_to_cpu(lp->rx_ring[i].status));
 	for (i = 0 ; i < TX_RING_SIZE; i++)
 	printk("%s %08x %04x %08x %04x", i & 1 ? "" : "\n ",
-	       lp->tx_ring[i].base, -lp->tx_ring[i].length,
-	       lp->tx_ring[i].misc, (unsigned)lp->tx_ring[i].status);
+	       le32_to_cpu(lp->tx_ring[i].base),
+	       (-le16_to_cpu(lp->tx_ring[i].length)) & 0xffff,
+	       le32_to_cpu(lp->tx_ring[i].misc),
+	       le16_to_cpu(lp->tx_ring[i].status));
 	printk("\n");
     }
     pcnet32_restart(dev, 0x0042);
@@ -1579,30 +1664,17 @@
     int entry;
     unsigned long flags;
 
+    spin_lock_irqsave(&lp->lock, flags);
+
     if (netif_msg_tx_queued(lp)) {
 	printk(KERN_DEBUG "%s: pcnet32_start_xmit() called, csr0 %4.4x.\n",
 	       dev->name, lp->a.read_csr(ioaddr, 0));
     }
 
-    spin_lock_irqsave(&lp->lock, flags);
-
     /* Default status -- will not enable Successful-TxDone
      * interrupt when that option is available to us.
      */
     status = 0x8300;
-    entry = (lp->cur_tx - lp->dirty_tx) & TX_RING_MOD_MASK;
-    if ((lp->ltint) &&
-	((entry == TX_RING_SIZE/3) ||
-	 (entry == (TX_RING_SIZE*2)/3) ||
-	 (entry >= TX_RING_SIZE-2)))
-    {
-	/* Enable Successful-TxDone interrupt if we have
-	 * 1/3, 2/3 or nearly all of, our ring buffer Tx'd
-	 * but not yet cleaned up.  Thus, most of the time,
-	 * we will not enable Successful-TxDone interrupts.
-	 */
-	status = 0x9300;
-    }
 
     /* Fill in a Tx ring entry */
 
@@ -1696,6 +1768,9 @@
 		    /* There was an major error, log it. */
 		    int err_status = le32_to_cpu(lp->tx_ring[entry].misc);
 		    lp->stats.tx_errors++;
+		    if (netif_msg_tx_err(lp))
+			printk(KERN_ERR "%s: Tx error status=%04x err_status=%08x\n",
+				dev->name, status, err_status);
 		    if (err_status & 0x04000000) lp->stats.tx_aborted_errors++;
 		    if (err_status & 0x08000000) lp->stats.tx_carrier_errors++;
 		    if (err_status & 0x10000000) lp->stats.tx_window_errors++;
@@ -1740,7 +1815,7 @@
 	    }
 
 	    delta = (lp->cur_tx - dirty_tx) & (TX_RING_MOD_MASK + TX_RING_SIZE);
-	    if (delta >= TX_RING_SIZE) {
+	    if (delta > TX_RING_SIZE) {
 		if (netif_msg_drv(lp))
 		    printk(KERN_ERR "%s: out-of-sync dirty pointer, %d vs. %d, full=%d.\n",
 			    dev->name, dirty_tx, lp->cur_tx, lp->tx_full);
@@ -1785,6 +1860,7 @@
 	    /* stop the chip to clear the error condition, then restart */
 	    lp->a.write_csr (ioaddr, 0, 0x0004);
 	    pcnet32_restart(dev, 0x0002);
+	    netif_wake_queue(dev);
 	}
     }
 
@@ -1806,6 +1882,7 @@
 {
     struct pcnet32_private *lp = dev->priv;
     int entry = lp->cur_rx & RX_RING_MOD_MASK;
+    int boguscnt = RX_RING_SIZE / 2;
 
     /* If we own the next entry, it's a new packet. Send it up. */
     while ((short)le16_to_cpu(lp->rx_ring[entry].status) >= 0) {
@@ -1872,6 +1949,7 @@
 		    if (i > RX_RING_SIZE -2) {
 			lp->stats.rx_dropped++;
 			lp->rx_ring[entry].status |= le16_to_cpu(0x8000);
+			wmb();	/* Make sure adapter sees owner change */
 			lp->cur_rx++;
 		    }
 		    break;
@@ -1907,6 +1985,7 @@
 	wmb(); /* Make sure owner changes after all others are visible */
 	lp->rx_ring[entry].status |= le16_to_cpu(0x8000);
 	entry = (++lp->cur_rx) & RX_RING_MOD_MASK;
+	if (--boguscnt <= 0) break;	/* don't stay in loop forever */
     }
 
     return 0;
@@ -1945,9 +2024,12 @@
 
     free_irq(dev->irq, dev);
 
+    spin_lock_irqsave(&lp->lock, flags);
+
     /* free all allocated skbuffs */
     for (i = 0; i < RX_RING_SIZE; i++) {
 	lp->rx_ring[i].status = 0;
+	wmb();		/* Make sure adapter sees owner change */
 	if (lp->rx_skbuff[i]) {
 	    pci_unmap_single(lp->pci_dev, lp->rx_dma_addr[i], PKT_BUF_SZ-2,
 		    PCI_DMA_FROMDEVICE);
@@ -1958,6 +2040,8 @@
     }
 
     for (i = 0; i < TX_RING_SIZE; i++) {
+	lp->tx_ring[i].status = 0;	/* CPU owns buffer */
+	wmb();		/* Make sure adapter sees owner change */
 	if (lp->tx_skbuff[i]) {
 	    pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[i],
 		    lp->tx_skbuff[i]->len, PCI_DMA_TODEVICE);
@@ -1967,6 +2051,8 @@
 	lp->tx_dma_addr[i] = 0;
     }
 
+    spin_unlock_irqrestore(&lp->lock, flags);
+
     return 0;
 }
 
@@ -2046,57 +2132,51 @@
     }
 
     lp->a.write_csr (ioaddr, 0, 0x0004); /* Temporarily stop the lance. */
-
     pcnet32_restart(dev, 0x0042); /*  Resume normal operation */
+    netif_wake_queue(dev);
+
     spin_unlock_irqrestore(&lp->lock, flags);
 }
 
+/* This routine assumes that the lp->lock is held */
 static int mdio_read(struct net_device *dev, int phy_id, int reg_num)
 {
     struct pcnet32_private *lp = dev->priv;
     unsigned long ioaddr = dev->base_addr;
     u16 val_out;
-    int phyaddr;
 
     if (!lp->mii)
 	return 0;
 
-    phyaddr = lp->a.read_bcr(ioaddr, 33);
-
     lp->a.write_bcr(ioaddr, 33, ((phy_id & 0x1f) << 5) | (reg_num & 0x1f));
     val_out = lp->a.read_bcr(ioaddr, 34);
-    lp->a.write_bcr(ioaddr, 33, phyaddr);
 
     return val_out;
 }
 
+/* This routine assumes that the lp->lock is held */
 static void mdio_write(struct net_device *dev, int phy_id, int reg_num, int val)
 {
     struct pcnet32_private *lp = dev->priv;
     unsigned long ioaddr = dev->base_addr;
-    int phyaddr;
 
     if (!lp->mii)
 	return;
 
-    phyaddr = lp->a.read_bcr(ioaddr, 33);
-
     lp->a.write_bcr(ioaddr, 33, ((phy_id & 0x1f) << 5) | (reg_num & 0x1f));
     lp->a.write_bcr(ioaddr, 34, val);
-    lp->a.write_bcr(ioaddr, 33, phyaddr);
 }
 
 static int pcnet32_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
     struct pcnet32_private *lp = dev->priv;
-    struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
     int rc;
     unsigned long flags;
 
     /* SIOC[GS]MIIxxx ioctls */
     if (lp->mii) {
 	spin_lock_irqsave(&lp->lock, flags);
-	rc = generic_mii_ioctl(&lp->mii_if, data, cmd, NULL);
+	rc = generic_mii_ioctl(&lp->mii_if, if_mii(rq), cmd, NULL);
 	spin_unlock_irqrestore(&lp->lock, flags);
     } else {
 	rc = -EOPNOTSUPP;
diff -Nru a/drivers/net/plip.c b/drivers/net/plip.c
--- a/drivers/net/plip.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/net/plip.c	Tue Jun 15 22:21:04 2004
@@ -1217,7 +1217,10 @@
 plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct net_local *nl = netdev_priv(dev);
-	struct plipconf *pc = (struct plipconf *) &rq->ifr_data;
+	struct plipconf *pc = (struct plipconf *) &rq->ifr_ifru;
+
+	if (cmd != SIOCDEVPLIP)
+		return -EOPNOTSUPP;
 
 	switch(pc->pcmd) {
 	case PLIP_GET_TIMEOUT:
diff -Nru a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
--- a/drivers/net/ppp_async.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/net/ppp_async.c	Tue Jun 15 22:20:43 2004
@@ -205,10 +205,10 @@
 {
 	struct asyncppp *ap;
 
-	write_lock(&disc_data_lock);
+	write_lock_irq(&disc_data_lock);
 	ap = tty->disc_data;
 	tty->disc_data = 0;
-	write_unlock(&disc_data_lock);
+	write_unlock_irq(&disc_data_lock);
 	if (ap == 0)
 		return;
 
diff -Nru a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
--- a/drivers/net/ppp_synctty.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/ppp_synctty.c	Tue Jun 15 22:20:39 2004
@@ -251,10 +251,10 @@
 {
 	struct syncppp *ap;
 
-	write_lock(&disc_data_lock);
+	write_lock_irq(&disc_data_lock);
 	ap = tty->disc_data;
 	tty->disc_data = 0;
-	write_unlock(&disc_data_lock);
+	write_unlock_irq(&disc_data_lock);
 	if (ap == 0)
 		return;
 
diff -Nru a/drivers/net/r8169.c b/drivers/net/r8169.c
--- a/drivers/net/r8169.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/r8169.c	Tue Jun 15 22:20:40 2004
@@ -1156,7 +1156,7 @@
 
 static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
 {
-	desc->addr = 0x0badbadbadbadbad;
+	desc->addr = 0x0badbadbadbadbadull;
 	desc->status &= ~cpu_to_le32(OWNbit | RsvdMask);
 }
 
diff -Nru a/drivers/net/rcif.h b/drivers/net/rcif.h
--- a/drivers/net/rcif.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,292 +0,0 @@
-/*
-** *************************************************************************
-**
-**
-**     R C I F . H
-**
-**
-**  RedCreek InterFace include file.
-**
-**  ---------------------------------------------------------------------
-**  ---     Copyright (c) 1998-1999, RedCreek Communications Inc.     ---
-**  ---                   All rights reserved.                        ---
-**  ---------------------------------------------------------------------
-**
-** File Description:
-**
-** Header file private ioctl commands.
-**
-**
-**  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.
-** *************************************************************************
-*/
-
-#ifndef RCIF_H
-#define RCIF_H
-
-/* The following protocol revision # should be incremented every time
-   a new protocol or new structures are used in this file. */
-int USER_PROTOCOL_REV = 2;	/* used to track different protocol revisions */
-
-/* define a single TCB & buffer */
-typedef struct {		/* a single buffer */
-	U32 context;		/* context */
-	U32 scount;		/* segment count */
-	U32 size;		/* segment size */
-	U32 addr;		/* segment physical address */
-} __attribute__ ((packed))
-    singleB, *psingleB;
-typedef struct {		/* a single TCB */
-	/*
-	   **  +-----------------------+
-	   **  |         1             |  one buffer in the TCB
-	   **  +-----------------------+
-	   **  |  <user's Context>     |  user's buffer reference
-	   **  +-----------------------+
-	   **  |         1             |  one segment buffer
-	   **  +-----------------------+                            _
-	   **  |    <buffer size>      |  size                       \ 
-	   **  +-----------------------+                              \ segment descriptor
-	   **  |  <physical address>   |  physical address of buffer  /
-	   **  +-----------------------+                            _/
-	 */
-	U32 bcount;		/* buffer count */
-	singleB b;		/* buffer */
-
-} __attribute__ ((packed))
-    singleTCB, *psingleTCB;
-
-/*
-   When adding new entries, please add all 5 related changes, since 
-   it helps keep everything consistent:
-      1) User structure entry
-      2) User data entry
-      3) Structure short-cut entry
-      4) Data short-cut entry
-      5) Command identifier entry
-
-   For Example ("GETSPEED"):
-      1) struct  RCgetspeed_tag { U32 LinkSpeedCode; } RCgetspeed;
-      2) struct  RCgetspeed_tag *getspeed;
-      3) #define RCUS_GETSPEED  data.RCgetspeed;
-      4) #define RCUD_GETSPEED  _RC_user_data.getspeed
-      5) #define RCUC_GETSPEED  0x02
-  
-   Notes for the "GETSPEED" entry, above:
-      1) RCgetspeed      - RC{name}
-         RCgetspeed_tag  - RC{name}_tag
-         LinkSpeedCode   - create any structure format desired (not too large,
-                           since memory will be unioned with all other entries)
-      2) RCgetspeed_tag  - RC{name}_tag chosen in #1
-         getspeed        - arbitrary name (ptr to structure in #1)
-      3) RCUS_GETSPEED   - RCUS_{NAME}   ("NAME" & "name" do not have to the same)
-         data.RCgetspeed - data.RC{name}  ("RC{name}" from #1)
-      4) RCUD_GETSPEED   - _RC_user_data.getspeed  ("getspeed" from #2)
-      5) RCUC_GETSPEED   - unique hex identifier entry.
-*/
-
-typedef struct RC_user_tag RCuser_struct;
-
-/* 1) User structure entry */
-struct RC_user_tag {
-	int cmd;
-	union {
-		/* GETINFO structure */
-		struct RCgetinfo_tag {
-			unsigned long int mem_start;
-			unsigned long int mem_end;
-			unsigned long int base_addr;
-			unsigned char irq;
-			unsigned char dma;
-			unsigned char port;
-		} RCgetinfo;	/* <---- RCgetinfo */
-
-		/* GETSPEED structure */
-		struct RCgetspeed_tag {
-			U32 LinkSpeedCode;
-		} RCgetspeed;	/* <---- RCgetspeed */
-
-		/* SETSPEED structure */
-		struct RCsetspeed_tag {
-			U16 LinkSpeedCode;
-		} RCsetspeed;	/* <---- RCsetspeed */
-
-		/* GETPROM structure */
-		struct RCgetprom_tag {
-			U32 PromMode;
-		} RCgetprom;	/* <---- RCgetprom */
-
-		/* SETPROM structure */
-		struct RCsetprom_tag {
-			U16 PromMode;
-		} RCsetprom;	/* <---- RCsetprom */
-
-		/* GETBROADCAST structure */
-		struct RCgetbroadcast_tag {
-			U32 BroadcastMode;
-		} RCgetbroadcast;	/* <---- RCgetbroadcast */
-
-		/* SETBROADCAST structure */
-		struct RCsetbroadcast_tag {
-			U16 BroadcastMode;
-		} RCsetbroadcast;	/* <---- RCsetbroadcast */
-
-		/* GETFIRMWAREVER structure */
-#define FirmStringLen 80
-		struct RCgetfwver_tag {
-			U8 FirmString[FirmStringLen];
-		} RCgetfwver;	/* <---- RCgetfwver */
-
-		/* GETIPANDMASK structure */
-		struct RCgetipnmask_tag {
-			U32 IpAddr;
-			U32 NetMask;
-		} RCgetipandmask;	/* <---- RCgetipandmask */
-
-		/* SETIPANDMASK structure */
-		struct RCsetipnmask_tag {
-			U32 IpAddr;
-			U32 NetMask;
-		} RCsetipandmask;	/* <---- RCsetipandmask */
-
-		/* GETMAC structure */
-#define MAC_SIZE 10
-		struct RCgetmac_tag {
-			U8 mac[MAC_SIZE];
-		} RCgetmac;	/* <---- RCgetmac */
-
-		/* SETMAC structure */
-		struct RCsetmac_tag {
-			U8 mac[MAC_SIZE];
-		} RCsetmac;	/* <---- RCsetmac */
-
-		/* GETLINKSTATUS structure */
-		struct RCgetlnkstatus_tag {
-			U32 ReturnStatus;
-		} RCgetlnkstatus;	/* <---- RCgetlnkstatus */
-
-		/* GETLINKSTATISTICS structure */
-		struct RCgetlinkstats_tag {
-			RCLINKSTATS StatsReturn;
-		} RCgetlinkstats;	/* <---- RCgetlinkstats */
-
-		/* DEFAULT structure (when no command was recognized) */
-		struct RCdefault_tag {
-			int rc;
-		} RCdefault;	/* <---- RCdefault */
-
-	} data;
-
-};				/* struct RC_user_tag { ... } */
-
-/* 2) User data entry */
-/* RCUD = RedCreek User Data */
-union RC_user_data_tag {	/* structure tags used are taken from RC_user_tag structure above */
-	struct RCgetinfo_tag *getinfo;
-	struct RCgetspeed_tag *getspeed;
-	struct RCgetprom_tag *getprom;
-	struct RCgetbroadcast_tag *getbroadcast;
-	struct RCgetfwver_tag *getfwver;
-	struct RCgetipnmask_tag *getipandmask;
-	struct RCgetmac_tag *getmac;
-	struct RCgetlnkstatus_tag *getlinkstatus;
-	struct RCgetlinkstats_tag *getlinkstatistics;
-	struct RCdefault_tag *rcdefault;
-	struct RCsetspeed_tag *setspeed;
-	struct RCsetprom_tag *setprom;
-	struct RCsetbroadcast_tag *setbroadcast;
-	struct RCsetipnmask_tag *setipandmask;
-	struct RCsetmac_tag *setmac;
-} _RC_user_data;		/* declare as a global, so the defines below will work */
-
-/* 3) Structure short-cut entry */
-/* define structure short-cuts *//* structure names are taken from RC_user_tag structure above */
-#define RCUS_GETINFO           data.RCgetinfo;
-#define RCUS_GETSPEED          data.RCgetspeed;
-#define RCUS_GETPROM           data.RCgetprom;
-#define RCUS_GETBROADCAST      data.RCgetbroadcast;
-#define RCUS_GETFWVER          data.RCgetfwver;
-#define RCUS_GETIPANDMASK      data.RCgetipandmask;
-#define RCUS_GETMAC            data.RCgetmac;
-#define RCUS_GETLINKSTATUS     data.RCgetlnkstatus;
-#define RCUS_GETLINKSTATISTICS data.RCgetlinkstats;
-#define RCUS_DEFAULT           data.RCdefault;
-#define RCUS_SETSPEED          data.RCsetspeed;
-#define RCUS_SETPROM           data.RCsetprom;
-#define RCUS_SETBROADCAST      data.RCsetbroadcast;
-#define RCUS_SETIPANDMASK      data.RCsetipandmask;
-#define RCUS_SETMAC            data.RCsetmac;
-
-/* 4) Data short-cut entry */
-/* define data short-cuts *//* pointer names are from RC_user_data_tag union (just below RC_user_tag) */
-#define RCUD_GETINFO           _RC_user_data.getinfo
-#define RCUD_GETSPEED          _RC_user_data.getspeed
-#define RCUD_GETPROM           _RC_user_data.getprom
-#define RCUD_GETBROADCAST      _RC_user_data.getbroadcast
-#define RCUD_GETFWVER          _RC_user_data.getfwver
-#define RCUD_GETIPANDMASK      _RC_user_data.getipandmask
-#define RCUD_GETMAC            _RC_user_data.getmac
-#define RCUD_GETLINKSTATUS     _RC_user_data.getlinkstatus
-#define RCUD_GETLINKSTATISTICS _RC_user_data.getlinkstatistics
-#define RCUD_DEFAULT           _RC_user_data.rcdefault
-#define RCUD_SETSPEED          _RC_user_data.setspeed
-#define RCUD_SETPROM           _RC_user_data.setprom
-#define RCUD_SETBROADCAST      _RC_user_data.setbroadcast
-#define RCUD_SETIPANDMASK      _RC_user_data.setipandmask
-#define RCUD_SETMAC            _RC_user_data.setmac
-
-/* 5) Command identifier entry */
-/* define command identifiers */
-#define RCUC_GETINFO            0x01
-#define RCUC_GETSPEED           0x02
-#define RCUC_GETFWVER           0x03
-#define RCUC_GETIPANDMASK       0x04
-#define RCUC_GETMAC             0x05
-#define RCUC_GETLINKSTATUS      0x06
-#define RCUC_GETLINKSTATISTICS  0x07
-#define RCUC_GETPROM            0x14
-#define RCUC_GETBROADCAST       0x15
-#define RCUC_DEFAULT            0xff
-#define RCUC_SETSPEED           0x08
-#define RCUC_SETIPANDMASK       0x09
-#define RCUC_SETMAC             0x0a
-#define RCUC_SETPROM            0x16
-#define RCUC_SETBROADCAST       0x17
-
-/* define ioctl commands to use, when talking to RC 45/PCI driver */
-#define RCU_PROTOCOL_REV         SIOCDEVPRIVATE
-#define RCU_COMMAND              SIOCDEVPRIVATE+1
-
-/*
-   Intended use for the above defines is shown below (GETINFO, as this example):
-
-      RCuser_struct RCuser;           // declare RCuser structure
-      struct ifreq ifr;               // declare an interface request structure
-
-      RCuser.cmd = RCUC_GETINFO;           // set user command to GETINFO
-      ifr->ifr_data = (caddr_t) &RCuser;   // set point to user structure
-
-      sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);   // get a socket
-      ioctl(sock, RCU_COMMAND, &ifr);                  // do ioctl on socket
-
-      RCUD_GETINFO = &RCuser.RCUS_GETINFO;   // set data pointer for GETINFO
-
-      // print results
-      printf("memory 0x%lx-0x%lx, base address 0x%x, irq 0x%x\n",
-              RCUD_GETINFO->mem_start, RCUD_GETINFO->mem_end,
-              RCUD_GETINFO->base_addr, RCUD_GETINFO->irq);
-*/
-
-#endif				/* RCIF_H */
diff -Nru a/drivers/net/rclanmtl.c b/drivers/net/rclanmtl.c
--- a/drivers/net/rclanmtl.c	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2029 +0,0 @@
-/*
-** *************************************************************************
-**
-**
-**     R C L A N M T L . C             $Revision: 6 $
-**
-**
-**  RedCreek I2O LAN Message Transport Layer program module.
-**
-**  ---------------------------------------------------------------------
-**  ---     Copyright (c) 1997-1999, RedCreek Communications Inc.     ---
-**  ---                   All rights reserved.                        ---
-**  ---------------------------------------------------------------------
-**
-**  File Description:
-**
-**  Host side I2O (Intelligent I/O) LAN message transport layer.
-**
-**  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.
-**
-** 1998-1999, LAN API was modified and enhanced by Alice Hennessy.
-**
-** Sometime in 1997, LAN API was written from scratch by Wendell Nichols.
-** *************************************************************************
-*/
-
-#define DEBUG 1
-
-#define RC_LINUX_MODULE
-#include "rclanmtl.h"
-
- /* RedCreek LAN device Target ID */
-#define RC_LAN_TARGET_ID  0x10
- /* RedCreek's OSM default LAN receive Initiator */
-#define DEFAULT_RECV_INIT_CONTEXT  0xA17
-
-/*
-** I2O message structures
-*/
-
-#define    I2O_TID_SZ                                  12
-#define    I2O_FUNCTION_SZ                             8
-
-/* Transaction Reply Lists (TRL) Control Word structure */
-
-#define    I2O_TRL_FLAGS_SINGLE_FIXED_LENGTH           0x00
-#define    I2O_TRL_FLAGS_SINGLE_VARIABLE_LENGTH        0x40
-#define    I2O_TRL_FLAGS_MULTIPLE_FIXED_LENGTH         0x80
-
-/* LAN Class specific functions */
-
-#define    I2O_LAN_PACKET_SEND                         0x3B
-#define    I2O_LAN_SDU_SEND                            0x3D
-#define    I2O_LAN_RECEIVE_POST                        0x3E
-#define    I2O_LAN_RESET                               0x35
-#define    I2O_LAN_SHUTDOWN                            0x37
-
-/* Private Class specfic function */
-#define    I2O_PRIVATE                                 0xFF
-
-/*  I2O Executive Function Codes.  */
-
-#define    I2O_EXEC_ADAPTER_ASSIGN                     0xB3
-#define    I2O_EXEC_ADAPTER_READ                       0xB2
-#define    I2O_EXEC_ADAPTER_RELEASE                    0xB5
-#define    I2O_EXEC_BIOS_INFO_SET                      0xA5
-#define    I2O_EXEC_BOOT_DEVICE_SET                    0xA7
-#define    I2O_EXEC_CONFIG_VALIDATE                    0xBB
-#define    I2O_EXEC_CONN_SETUP                         0xCA
-#define    I2O_EXEC_DEVICE_ASSIGN                      0xB7
-#define    I2O_EXEC_DEVICE_RELEASE                     0xB9
-#define    I2O_EXEC_HRT_GET                            0xA8
-#define    I2O_EXEC_IOP_CLEAR                          0xBE
-#define    I2O_EXEC_IOP_CONNECT                        0xC9
-#define    I2O_EXEC_IOP_RESET                          0xBD
-#define    I2O_EXEC_LCT_NOTIFY                         0xA2
-#define    I2O_EXEC_OUTBOUND_INIT                      0xA1
-#define    I2O_EXEC_PATH_ENABLE                        0xD3
-#define    I2O_EXEC_PATH_QUIESCE                       0xC5
-#define    I2O_EXEC_PATH_RESET                         0xD7
-#define    I2O_EXEC_STATIC_MF_CREATE                   0xDD
-#define    I2O_EXEC_STATIC_MF_RELEASE                  0xDF
-#define    I2O_EXEC_STATUS_GET                         0xA0
-#define    I2O_EXEC_SW_DOWNLOAD                        0xA9
-#define    I2O_EXEC_SW_UPLOAD                          0xAB
-#define    I2O_EXEC_SW_REMOVE                          0xAD
-#define    I2O_EXEC_SYS_ENABLE                         0xD1
-#define    I2O_EXEC_SYS_MODIFY                         0xC1
-#define    I2O_EXEC_SYS_QUIESCE                        0xC3
-#define    I2O_EXEC_SYS_TAB_SET                        0xA3
-
- /* Init Outbound Q status */
-#define    I2O_EXEC_OUTBOUND_INIT_IN_PROGRESS          0x01
-#define    I2O_EXEC_OUTBOUND_INIT_REJECTED             0x02
-#define    I2O_EXEC_OUTBOUND_INIT_FAILED               0x03
-#define    I2O_EXEC_OUTBOUND_INIT_COMPLETE             0x04
-
-#define    I2O_UTIL_NOP                                0x00
-
-/* I2O Get Status State values */
-
-#define    I2O_IOP_STATE_INITIALIZING                  0x01
-#define    I2O_IOP_STATE_RESET                         0x02
-#define    I2O_IOP_STATE_HOLD                          0x04
-#define    I2O_IOP_STATE_READY                         0x05
-#define    I2O_IOP_STATE_OPERATIONAL                   0x08
-#define    I2O_IOP_STATE_FAILED                        0x10
-#define    I2O_IOP_STATE_FAULTED                       0x11
-
-/* Defines for Request Status Codes:  Table 3-1 Reply Status Codes.  */
-
-#define    I2O_REPLY_STATUS_SUCCESS                    0x00
-#define    I2O_REPLY_STATUS_ABORT_DIRTY                0x01
-#define    I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER     0x02
-#define    I2O_REPLY_STATUS_ABORT_PARTIAL_TRANSFER     0x03
-#define    I2O_REPLY_STATUS_ERROR_DIRTY                0x04
-#define    I2O_REPLY_STATUS_ERROR_NO_DATA_TRANSFER     0x05
-#define    I2O_REPLY_STATUS_ERROR_PARTIAL_TRANSFER     0x06
-#define    I2O_REPLY_STATUS_PROCESS_ABORT_DIRTY        0x07
-#define    I2O_REPLY_STATUS_PROCESS_ABORT_NO_DATA_TRANSFER   0x08
-#define    I2O_REPLY_STATUS_PROCESS_ABORT_PARTIAL_TRANSFER   0x09
-#define    I2O_REPLY_STATUS_TRANSACTION_ERROR          0x0A
-#define    I2O_REPLY_STATUS_PROGRESS_REPORT            0x80
-
-/* DetailedStatusCode defines for ALL messages: Table 3-2 Detailed Status Codes.*/
-
-#define    I2O_DETAIL_STATUS_SUCCESS                        0x0000
-#define    I2O_DETAIL_STATUS_BAD_KEY                        0x0001
-#define    I2O_DETAIL_STATUS_CHAIN_BUFFER_TOO_LARGE         0x0002
-#define    I2O_DETAIL_STATUS_DEVICE_BUSY                    0x0003
-#define    I2O_DETAIL_STATUS_DEVICE_LOCKED                  0x0004
-#define    I2O_DETAIL_STATUS_DEVICE_NOT_AVAILABLE           0x0005
-#define    I2O_DETAIL_STATUS_DEVICE_RESET                   0x0006
-#define    I2O_DETAIL_STATUS_INAPPROPRIATE_FUNCTION         0x0007
-#define    I2O_DETAIL_STATUS_INSUFFICIENT_RESOURCE_HARD     0x0008
-#define    I2O_DETAIL_STATUS_INSUFFICIENT_RESOURCE_SOFT     0x0009
-#define    I2O_DETAIL_STATUS_INVALID_INITIATOR_ADDRESS      0x000A
-#define    I2O_DETAIL_STATUS_INVALID_MESSAGE_FLAGS          0x000B
-#define    I2O_DETAIL_STATUS_INVALID_OFFSET                 0x000C
-#define    I2O_DETAIL_STATUS_INVALID_PARAMETER              0x000D
-#define    I2O_DETAIL_STATUS_INVALID_REQUEST                0x000E
-#define    I2O_DETAIL_STATUS_INVALID_TARGET_ADDRESS         0x000F
-#define    I2O_DETAIL_STATUS_MESSAGE_TOO_LARGE              0x0010
-#define    I2O_DETAIL_STATUS_MESSAGE_TOO_SMALL              0x0011
-#define    I2O_DETAIL_STATUS_MISSING_PARAMETER              0x0012
-#define    I2O_DETAIL_STATUS_NO_SUCH_PAGE                   0x0013
-#define    I2O_DETAIL_STATUS_REPLY_BUFFER_FULL              0x0014
-#define    I2O_DETAIL_STATUS_TCL_ERROR                      0x0015
-#define    I2O_DETAIL_STATUS_TIMEOUT                        0x0016
-#define    I2O_DETAIL_STATUS_UNKNOWN_ERROR                  0x0017
-#define    I2O_DETAIL_STATUS_UNKNOWN_FUNCTION               0x0018
-#define    I2O_DETAIL_STATUS_UNSUPPORTED_FUNCTION           0x0019
-#define    I2O_DETAIL_STATUS_UNSUPPORTED_VERSION            0x001A
-
- /* I2O msg header defines for VersionOffset */
-#define I2OMSGVER_1_5   0x0001
-#define SGL_OFFSET_0    I2OMSGVER_1_5
-#define SGL_OFFSET_4    (0x0040 | I2OMSGVER_1_5)
-#define TRL_OFFSET_5    (0x0050 | I2OMSGVER_1_5)
-#define TRL_OFFSET_6    (0x0060 | I2OMSGVER_1_5)
-
- /* I2O msg header defines for MsgFlags */
-#define MSG_STATIC      0x0100
-#define MSG_64BIT_CNTXT 0x0200
-#define MSG_MULTI_TRANS 0x1000
-#define MSG_FAIL        0x2000
-#define MSG_LAST        0x4000
-#define MSG_REPLY       0x8000
-
-  /* normal LAN request message MsgFlags and VersionOffset (0x1041) */
-#define LAN_MSG_REQST  (MSG_MULTI_TRANS | SGL_OFFSET_4)
-
- /* minimum size msg */
-#define THREE_WORD_MSG_SIZE 0x00030000
-#define FOUR_WORD_MSG_SIZE  0x00040000
-#define FIVE_WORD_MSG_SIZE  0x00050000
-#define SIX_WORD_MSG_SIZE   0x00060000
-#define SEVEN_WORD_MSG_SIZE 0x00070000
-#define EIGHT_WORD_MSG_SIZE 0x00080000
-#define NINE_WORD_MSG_SIZE  0x00090000
-
-/* Special TID Assignments */
-
-#define I2O_IOP_TID   0
-#define I2O_HOST_TID  0xB91
-
- /* RedCreek I2O private message codes */
-#define RC_PRIVATE_GET_MAC_ADDR     0x0001/**/	/* OBSOLETE */
-#define RC_PRIVATE_SET_MAC_ADDR     0x0002
-#define RC_PRIVATE_GET_NIC_STATS    0x0003
-#define RC_PRIVATE_GET_LINK_STATUS  0x0004
-#define RC_PRIVATE_SET_LINK_SPEED   0x0005
-#define RC_PRIVATE_SET_IP_AND_MASK  0x0006
-/* #define RC_PRIVATE_GET_IP_AND_MASK  0x0007 *//* OBSOLETE */
-#define RC_PRIVATE_GET_LINK_SPEED   0x0008
-#define RC_PRIVATE_GET_FIRMWARE_REV 0x0009
-/* #define RC_PRIVATE_GET_MAC_ADDR     0x000A */
-#define RC_PRIVATE_GET_IP_AND_MASK  0x000B
-#define RC_PRIVATE_DEBUG_MSG        0x000C
-#define RC_PRIVATE_REPORT_DRIVER_CAPABILITY  0x000D
-#define RC_PRIVATE_SET_PROMISCUOUS_MODE  0x000e
-#define RC_PRIVATE_GET_PROMISCUOUS_MODE  0x000f
-#define RC_PRIVATE_SET_BROADCAST_MODE    0x0010
-#define RC_PRIVATE_GET_BROADCAST_MODE    0x0011
-
-#define RC_PRIVATE_REBOOT           0x00FF
-
-/* I2O message header */
-typedef struct _I2O_MESSAGE_FRAME {
-	U8 VersionOffset;
-	U8 MsgFlags;
-	U16 MessageSize;
-	BF TargetAddress:I2O_TID_SZ;
-	BF InitiatorAddress:I2O_TID_SZ;
-	BF Function:I2O_FUNCTION_SZ;
-	U32 InitiatorContext;
-	/* SGL[] */
-} I2O_MESSAGE_FRAME, *PI2O_MESSAGE_FRAME;
-
- /* assumed a 16K minus 256 byte space for outbound queue message frames */
-#define MSG_FRAME_SIZE  512
-#define NMBR_MSG_FRAMES 30
-
- /* 
-    ** in reserved space right after PAB in host memory is area for returning
-    ** values from card 
-  */
-
-/*
-** typedef NICSTAT
-**
-** Data structure for NIC statistics retruned from PCI card.  Data copied from
-** here to user allocated RCLINKSTATS (see rclanmtl.h) structure.
-*/
-typedef struct tag_NicStat {
-	unsigned long TX_good;
-	unsigned long TX_maxcol;
-	unsigned long TX_latecol;
-	unsigned long TX_urun;
-	unsigned long TX_crs;	/* lost carrier sense */
-	unsigned long TX_def;	/* transmit deferred */
-	unsigned long TX_singlecol;	/* single collisions */
-	unsigned long TX_multcol;
-	unsigned long TX_totcol;
-	unsigned long Rcv_good;
-	unsigned long Rcv_CRCerr;
-	unsigned long Rcv_alignerr;
-	unsigned long Rcv_reserr;	/* rnr'd pkts */
-	unsigned long Rcv_orun;
-	unsigned long Rcv_cdt;
-	unsigned long Rcv_runt;
-	unsigned long dump_status;	/* last field directly from the chip */
-} NICSTAT, *P_NICSTAT;
-
-#define DUMP_DONE   0x0000A005	/* completed statistical dump */
-#define DUMP_CLEAR  0x0000A007	/* completed stat dump and clear counters */
-
-static volatile int msgFlag;
-
-/* local function prototypes */
-static void ProcessOutboundI2OMsg (PPAB pPab, U32 phyMsgAddr);
-static int FillI2OMsgSGLFromTCB (PU32 pMsg, PRCTCB pXmitCntrlBlock);
-static int GetI2OStatus (PPAB pPab);
-static int SendI2OOutboundQInitMsg (PPAB pPab);
-static int SendEnableSysMsg (PPAB pPab);
-
-/*
-** =========================================================================
-** RCInitI2OMsgLayer()
-**
-** Initialize the RedCreek I2O Module and adapter.
-**
-** Inputs:  dev - the devices net_device struct
-**          TransmitCallbackFunction - address of transmit callback function
-**          ReceiveCallbackFunction  - address of receive  callback function
-**
-** private message block is allocated by user.  It must be in locked pages.
-** p_msgbuf and p_phymsgbuf point to the same location.  Must be contigous
-** memory block of a minimum of 16K byte and long word aligned.
-** =========================================================================
-*/
-RC_RETURN
-RCInitI2OMsgLayer (struct net_device *dev,
-		   PFNTXCALLBACK TransmitCallbackFunction,
-		   PFNRXCALLBACK ReceiveCallbackFunction,
-		   PFNCALLBACK RebootCallbackFunction)
-{
-	int result;
-	PPAB pPab;
-	U32 pciBaseAddr = dev->base_addr;
-	PDPA pDpa = dev->priv;
-	PU8 p_msgbuf = pDpa->msgbuf;
-	PU8 p_phymsgbuf = (PU8) pDpa->msgbuf_dma;
-
-	dprintk
-	    ("InitI2O: Adapter:0x%04ux ATU:0x%08ulx msgbuf:%p phymsgbuf:0x%08ulx\n"
-	     "TransmitCallbackFunction:0x%08ulx  ReceiveCallbackFunction:0x%08ulx\n",
-	     pDpa->id, pciBaseAddr, p_msgbuf, (u32) p_phymsgbuf,
-	     (u32) TransmitCallbackFunction, (u32) ReceiveCallbackFunction);
-
-	/* Check if this interface already initialized - if so, shut it down */
-	if (pDpa->pPab != NULL) {
-		printk (KERN_WARNING
-			"(rcpci45 driver:) pDpa->pPab [%d] != NULL\n",
-			pDpa->id);
-/*          RCResetLANCard(pDpa->id, 0, (PU32)NULL, (PFNCALLBACK)NULL); */
-		pDpa->pPab = NULL;
-	}
-
-	/* store adapter instance values in adapter block.
-	 * Adapter block is at beginning of message buffer */
-
-	pPab = kmalloc (sizeof (*pPab), GFP_KERNEL);
-	if (!pPab) {
-		printk (KERN_ERR
-			"(rcpci45 driver:) RCInitI2OMsgLayer: Could not allocate memory for PAB struct!\n");
-		result = RC_RTN_MALLOC_ERROR;
-		goto err_out;
-	}
-
-	memset (pPab, 0, sizeof (*pPab));
-	pDpa->pPab = pPab;
-	pPab->p_atu = (PATU) pciBaseAddr;
-	pPab->pPci45LinBaseAddr = (PU8) pciBaseAddr;
-
-	/* Set outbound message frame addr */
-	pPab->outMsgBlockPhyAddr = (U32) p_phymsgbuf;
-	pPab->pLinOutMsgBlock = (PU8) p_msgbuf;
-
-	/* store callback function addresses */
-	pPab->pTransCallbackFunc = TransmitCallbackFunction;
-	pPab->pRecvCallbackFunc = ReceiveCallbackFunction;
-	pPab->pRebootCallbackFunc = RebootCallbackFunction;
-	pPab->pCallbackFunc = (PFNCALLBACK) NULL;
-
-	/*
-	   ** Initialize I2O IOP
-	 */
-	result = GetI2OStatus (pPab);
-
-	if (result != RC_RTN_NO_ERROR)
-		goto err_out_dealloc;
-
-	if (pPab->IOPState == I2O_IOP_STATE_OPERATIONAL) {
-		printk (KERN_INFO
-			"(rcpci45 driver:) pPab->IOPState == op: resetting adapter\n");
-		RCResetLANCard (dev, 0, (PU32) NULL, (PFNCALLBACK) NULL);
-	}
-
-	result = SendI2OOutboundQInitMsg (pPab);
-
-	if (result != RC_RTN_NO_ERROR)
-		goto err_out_dealloc;
-
-	result = SendEnableSysMsg (pPab);
-
-	if (result != RC_RTN_NO_ERROR)
-		goto err_out_dealloc;
-
-	return RC_RTN_NO_ERROR;
-
-      err_out_dealloc:
-	kfree (pPab);
-      err_out:
-	return result;
-}
-
-/*
-** =========================================================================
-** Disable and Enable I2O interrupts.  I2O interrupts are enabled at Init time
-** but can be disabled and re-enabled through these two function calls.
-** Packets will still be put into any posted received buffers and packets will
-** be sent through RCI2OSendPacket() functions.  Disabling I2O interrupts
-** will prevent hardware interrupt to host even though the outbound I2O msg
-** queue is not emtpy.
-** =========================================================================
-*/
-#define i960_OUT_POST_Q_INT_BIT        0x0008	/* bit set masks interrupts */
-
-RC_RETURN
-RCDisableI2OInterrupts (struct net_device * dev)
-{
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	pPab->p_atu->OutIntMask |= i960_OUT_POST_Q_INT_BIT;
-
-	return RC_RTN_NO_ERROR;
-}
-
-RC_RETURN
-RCEnableI2OInterrupts (struct net_device * dev)
-{
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	pPab->p_atu->OutIntMask &= ~i960_OUT_POST_Q_INT_BIT;
-
-	return RC_RTN_NO_ERROR;
-
-}
-
-/*
-** =========================================================================
-** RCI2OSendPacket()
-** =========================================================================
-*/
-RC_RETURN
-RCI2OSendPacket (struct net_device * dev, U32 InitiatorContext,
-		 PRCTCB pTransCtrlBlock)
-{
-	U32 msgOffset;
-	PU32 pMsg;
-	int size;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	dprintk ("RCI2OSendPacket()...\n");
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	/* get Inbound free Q entry - reading from In Q gets free Q entry */
-	/* offset to Msg Frame in PCI msg block */
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		dprintk ("RCI2OSendPacket(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	size = FillI2OMsgSGLFromTCB (pMsg + 4, pTransCtrlBlock);
-
-	if (size == -1) {	/* error processing TCB - send NOP msg */
-		dprintk ("RCI2OSendPacket(): Error Rrocess TCB!\n");
-		pMsg[0] = THREE_WORD_MSG_SIZE | SGL_OFFSET_0;
-		pMsg[1] =
-		    I2O_UTIL_NOP << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-		return RC_RTN_TCB_ERROR;
-	} else {		/* send over msg header */
-
-		pMsg[0] = (size + 4) << 16 | LAN_MSG_REQST;	/* send over message size and flags */
-		pMsg[1] =
-		    I2O_LAN_PACKET_SEND << 24 | I2O_HOST_TID << 12 |
-		    RC_LAN_TARGET_ID;
-		pMsg[2] = InitiatorContext;
-		pMsg[3] = 0;	/* batch reply */
-		/* post to Inbound Post Q */
-		pPab->p_atu->InQueue = msgOffset;
-		return RC_RTN_NO_ERROR;
-	}
-}
-
-/*
-** =========================================================================
-** RCI2OPostRecvBuffer()
-**
-** inputs:  pBufrCntrlBlock - pointer to buffer control block
-**
-** returns TRUE if successful in sending message, else FALSE.
-** =========================================================================
-*/
-RC_RETURN
-RCPostRecvBuffers (struct net_device * dev, PRCTCB pTransCtrlBlock)
-{
-	U32 msgOffset;
-	PU32 pMsg;
-	int size;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	dprintk ("RCPostRecvBuffers()...\n");
-
-	/* search for DeviceHandle */
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	/* get Inbound free Q entry - reading from In Q gets free Q entry */
-	/* offset to Msg Frame in PCI msg block */
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		dprintk ("RCPostRecvBuffers(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	size = FillI2OMsgSGLFromTCB (pMsg + 4, pTransCtrlBlock);
-
-	if (size == -1) {	/* error prcessing TCB - send 3 DWORD private msg == NOP */
-		dprintk
-		    ("RCPostRecvBuffers(): Error Processing TCB! size = %d\n",
-		     size);
-		pMsg[0] = THREE_WORD_MSG_SIZE | SGL_OFFSET_0;
-		pMsg[1] =
-		    I2O_UTIL_NOP << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-		/* post to Post Q */
-		pPab->p_atu->InQueue = msgOffset;
-		return RC_RTN_TCB_ERROR;
-	} else {		/* send over size msg header */
-
-		pMsg[0] = (size + 4) << 16 | LAN_MSG_REQST;	/* send over message size and flags */
-		pMsg[1] =
-		    I2O_LAN_RECEIVE_POST << 24 | I2O_HOST_TID << 12 |
-		    RC_LAN_TARGET_ID;
-		pMsg[2] = DEFAULT_RECV_INIT_CONTEXT;
-		pMsg[3] = *(PU32) pTransCtrlBlock;	/* number of packet buffers */
-		/* post to Post Q */
-		pPab->p_atu->InQueue = msgOffset;
-		return RC_RTN_NO_ERROR;
-	}
-}
-
-/*
-** =========================================================================
-** RCProcI2OMsgQ()
-**
-** Process I2O outbound message queue until empty.
-** =========================================================================
-*/
-irqreturn_t
-RCProcI2OMsgQ (struct net_device *dev)
-{
-	U32 phyAddrMsg;
-	PU8 p8Msg;
-	PU32 p32;
-	U16 count;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-	unsigned char debug_msg[20];
-
-	if (pPab == NULL)
-		return IRQ_NONE;
-
-	phyAddrMsg = pPab->p_atu->OutQueue;
-
-	while (phyAddrMsg != 0xFFFFFFFF) {
-		p8Msg =
-		    pPab->pLinOutMsgBlock + (phyAddrMsg -
-					     pPab->outMsgBlockPhyAddr);
-		p32 = (PU32) p8Msg;
-
-		dprintk ("msg: 0x%x  0x%x \n", p8Msg[7], p32[5]);
-
-		/* Send Packet Reply Msg */
-		if (I2O_LAN_PACKET_SEND == p8Msg[7]) {	/* function code byte */
-			count = *(PU16) (p8Msg + 2);
-			count -= p8Msg[0] >> 4;
-			/* status, count, context[], adapter */
-			(*pPab->pTransCallbackFunc) (p8Msg[19], count, p32 + 5,
-						     dev);
-		} else if (I2O_LAN_RECEIVE_POST == p8Msg[7]) {	/* Receive Packet Reply Msg */
-			dprintk
-			    ("I2O_RECV_REPLY pPab:0x%08ulx p8Msg:0x%08ulx p32:0x%08ulx\n",
-			     (u32) pPab, (u32) p8Msg, (u32) p32);
-			dprintk ("msg: 0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n",
-				 p32[0], p32[1], p32[2], p32[3]);
-			dprintk ("     0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n",
-				 p32[4], p32[5], p32[6], p32[7]);
-			dprintk ("     0x%08ulx:0X%08ulx:0x%08ulx:0x%08ulx\n",
-				 p32[8], p32[9], p32[10], p32[11]);
-			/*  status, count, buckets remaining, packetParmBlock, adapter */
-			(*pPab->pRecvCallbackFunc) (p8Msg[19], p8Msg[12],
-						    p32[5], p32 + 6, dev);
-		} else if (I2O_LAN_RESET == p8Msg[7]
-			   || I2O_LAN_SHUTDOWN == p8Msg[7])
-			if (pPab->pCallbackFunc)
-				(*pPab->pCallbackFunc) (p8Msg[19], 0, 0, dev);
-			else
-				pPab->pCallbackFunc = (PFNCALLBACK) 1;
-		else if (I2O_PRIVATE == p8Msg[7]) {
-			dprintk ("i2o private 0x%x, 0x%x \n", p8Msg[7], p32[5]);
-			switch (p32[5]) {
-			case RC_PRIVATE_DEBUG_MSG:
-				msgFlag = 1;
-				dprintk ("Received I2O_PRIVATE msg\n");
-				debug_msg[15] = (p32[6] & 0xff000000) >> 24;
-				debug_msg[14] = (p32[6] & 0x00ff0000) >> 16;
-				debug_msg[13] = (p32[6] & 0x0000ff00) >> 8;
-				debug_msg[12] = (p32[6] & 0x000000ff);
-
-				debug_msg[11] = (p32[7] & 0xff000000) >> 24;
-				debug_msg[10] = (p32[7] & 0x00ff0000) >> 16;
-				debug_msg[9] = (p32[7] & 0x0000ff00) >> 8;
-				debug_msg[8] = (p32[7] & 0x000000ff);
-
-				debug_msg[7] = (p32[8] & 0xff000000) >> 24;
-				debug_msg[6] = (p32[8] & 0x00ff0000) >> 16;
-				debug_msg[5] = (p32[8] & 0x0000ff00) >> 8;
-				debug_msg[4] = (p32[8] & 0x000000ff);
-
-				debug_msg[3] = (p32[9] & 0xff000000) >> 24;
-				debug_msg[2] = (p32[9] & 0x00ff0000) >> 16;
-				debug_msg[1] = (p32[9] & 0x0000ff00) >> 8;
-				debug_msg[0] = (p32[9] & 0x000000ff);
-
-				debug_msg[16] = '\0';
-				dprintk ("%s", debug_msg);
-				break;
-			case RC_PRIVATE_REBOOT:
-				dprintk ("Adapter reboot initiated...\n");
-				if (pPab->pRebootCallbackFunc)
-					(*pPab->pRebootCallbackFunc) (0, 0, 0,
-								      dev);
-				break;
-			default:
-				printk (KERN_WARNING
-					"(rcpci45 driver:) Unknown private I2O msg received: 0x%x\n",
-					p32[5]);
-				break;
-			}
-		}
-
-		/* 
-		   ** Process other Msg's
-		 */
-		else
-			ProcessOutboundI2OMsg (pPab, phyAddrMsg);
-
-		/* return MFA to outbound free Q */
-		pPab->p_atu->OutQueue = phyAddrMsg;
-
-		/* any more msgs? */
-		phyAddrMsg = pPab->p_atu->OutQueue;
-	}
-
-	return IRQ_HANDLED;
-}
-
-/*
-** =========================================================================
-**  Returns LAN interface statistical counters to space provided by caller at
-**  StatsReturnAddr.  Returns 0 if success, else RC_RETURN code.
-**  This function will call the WaitCallback function provided by
-**  user while waiting for card to respond.
-** =========================================================================
-*/
-RC_RETURN
-RCGetLinkStatistics (struct net_device *dev,
-		     P_RCLINKSTATS StatsReturnAddr,
-		     PFNWAITCALLBACK WaitCallback)
-{
-	U32 msgOffset;
-	volatile U32 timeout;
-	volatile PU32 pMsg;
-	volatile PU32 p32, pReturnAddr;
-	P_NICSTAT pStats;
-	int i;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-/*dprintk("Get82558Stats() StatsReturnAddr:0x%08ulx\n", StatsReturnAddr); */
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		dprintk ("Get8255XStats(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-/*dprintk("Get82558Stats - pMsg = 0x%08ulx, InQ msgOffset = 0x%08ulx\n", pMsg, msgOffset);*/
-/*dprintk("Get82558Stats - pMsg = 0x%08X, InQ msgOffset = 0x%08X\n", pMsg, msgOffset);*/
-
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = DEFAULT_RECV_INIT_CONTEXT;
-	pMsg[3] = 0x112;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_NIC_STATS;
-	pMsg[5] = pPab->outMsgBlockPhyAddr;
-
-	p32 = (PU32) pPab->outMsgBlockPhyAddr;
-	pStats = (P_NICSTAT) pPab->pLinOutMsgBlock;
-	pStats->dump_status = 0xFFFFFFFF;
-
-	/* post to Inbound Post Q */
-	pPab->p_atu->InQueue = msgOffset;
-
-	timeout = 100000;
-	while (1) {
-		if (WaitCallback)
-			(*WaitCallback) ();
-
-		udelay (10);
-
-		if (pStats->dump_status != 0xFFFFFFFF)
-			break;
-
-		if (!timeout--) {
-			dprintk
-			    ("RCGet82558Stats() Timeout waiting for NIC statistics\n");
-			return RC_RTN_MSG_REPLY_TIMEOUT;
-		}
-	}
-
-	pReturnAddr = (PU32) StatsReturnAddr;
-
-	/* copy Nic stats to user's structure */
-	for (i = 0; i < (int) sizeof (RCLINKSTATS) / 4; i++)
-		pReturnAddr[i] = p32[i];
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** Get82558LinkStatus()
-** =========================================================================
-*/
-RC_RETURN
-RCGetLinkStatus (struct net_device * dev, PU32 ReturnAddr,
-		 PFNWAITCALLBACK WaitCallback)
-{
-	U32 msgOffset;
-	volatile U32 timeout;
-	volatile PU32 pMsg;
-	volatile PU32 p32;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	dprintk ("Get82558LinkStatus() ReturnPhysAddr:0x%08ulx\n",
-		 (u32) ReturnAddr);
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		dprintk ("Get82558LinkStatus(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-/*dprintk("Get82558LinkStatus - pMsg = 0x%08ulx, InQ msgOffset = 0x%08ulx\n", pMsg, msgOffset);*/
-/*dprintk("Get82558LinkStatus - pMsg = 0x%08X, InQ msgOffset = 0x%08X\n", pMsg, msgOffset);*/
-
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = DEFAULT_RECV_INIT_CONTEXT;
-	pMsg[3] = 0x112;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_LINK_STATUS;
-	pMsg[5] = pPab->outMsgBlockPhyAddr;
-
-	p32 = (PU32) pPab->pLinOutMsgBlock;
-	*p32 = 0xFFFFFFFF;
-
-	/* post to Inbound Post Q */
-	pPab->p_atu->InQueue = msgOffset;
-
-	timeout = 100000;
-	while (1) {
-		if (WaitCallback)
-			(*WaitCallback) ();
-
-		udelay (10);
-
-		if (*p32 != 0xFFFFFFFF)
-			break;
-
-		if (!timeout--) {
-			dprintk ("Timeout waiting for link status\n");
-			return RC_RTN_MSG_REPLY_TIMEOUT;
-		}
-	}
-
-	*ReturnAddr = *p32;	/* 1 = up 0 = down */
-
-	return RC_RTN_NO_ERROR;
-
-}
-
-/*
-** =========================================================================
-** RCGetMAC()
-**
-** get the MAC address the adapter is listening for in non-promiscous mode.
-** MAC address is in media format.
-** =========================================================================
-*/
-RC_RETURN
-RCGetMAC (struct net_device * dev, PFNWAITCALLBACK WaitCallback)
-{
-	unsigned timeout;
-	U32 off;
-	PU8 mac = dev->dev_addr;
-	PU32 p;
-	U32 temp[2];
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-	PATU p_atu;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	p_atu = pPab->p_atu;
-
-	p_atu->EtherMacLow = 0;	/* first zero return data */
-	p_atu->EtherMacHi = 0;
-
-	off = p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	p = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	dprintk ("RCGetMAC: p_atu 0x%08x, off 0x%08x, p 0x%08x\n",
-		 (uint) p_atu, (uint) off, (uint) p);
-	/* setup private message */
-	p[0] = FIVE_WORD_MSG_SIZE | SGL_OFFSET_0;
-	p[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	p[2] = 0;		/* initiator context */
-	p[3] = 0x218;		/* transaction context */
-	p[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_MAC_ADDR;
-
-	p_atu->InQueue = off;	/* send it to the I2O device */
-	dprintk ("RCGetMAC: p_atu 0x%08x, off 0x%08x, p 0x%08x\n",
-		 (uint) p_atu, (uint) off, (uint) p);
-
-	/* wait for the rcpci45 board to update the info */
-	timeout = 1000000;
-	while (0 == p_atu->EtherMacLow) {
-		if (WaitCallback)
-			(*WaitCallback) ();
-
-		udelay (10);
-
-		if (!timeout--) {
-			printk ("rc_getmac: Timeout\n");
-			return RC_RTN_MSG_REPLY_TIMEOUT;
-		}
-	}
-
-	/* read the mac address  */
-	temp[0] = p_atu->EtherMacLow;
-	temp[1] = p_atu->EtherMacHi;
-	memcpy ((char *) mac, (char *) temp, 6);
-
-	dprintk ("rc_getmac: 0x%x\n", (u32) mac);
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCSetMAC()
-**
-** set MAC address the adapter is listening for in non-promiscous mode.
-** MAC address is in media format.
-** =========================================================================
-*/
-RC_RETURN
-RCSetMAC (struct net_device * dev, PU8 mac)
-{
-	U32 off;
-	PU32 pMsg;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	off = pPab->p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	/* setup private message */
-	pMsg[0] = SEVEN_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_SET_MAC_ADDR;
-	pMsg[5] = *(unsigned *) mac;	/* first four bytes */
-	pMsg[6] = *(unsigned *) (mac + 4);	/* last two bytes */
-
-	pPab->p_atu->InQueue = off;	/* send it to the I2O device */
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCSetLinkSpeed()
-**
-** set ethernet link speed. 
-** input: speedControl - determines action to take as follows
-**          0 = reset and auto-negotiate (NWay)
-**          1 = Full Duplex 100BaseT
-**          2 = Half duplex 100BaseT
-**          3 = Full Duplex  10BaseT
-**          4 = Half duplex  10BaseT
-**          all other values are ignore (do nothing)
-** =========================================================================
-*/
-RC_RETURN
-RCSetLinkSpeed (struct net_device * dev, U16 LinkSpeedCode)
-{
-	U32 off;
-	PU32 pMsg;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	off = pPab->p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	/* setup private message */
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_SET_LINK_SPEED;
-	pMsg[5] = LinkSpeedCode;	/* link speed code */
-
-	pPab->p_atu->InQueue = off;	/* send it to the I2O device */
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCSetPromiscuousMode()
-**
-** Defined values for Mode:
-**  0 - turn off promiscuous mode
-**  1 - turn on  promiscuous mode
-**
-** =========================================================================
-*/
-RC_RETURN
-RCSetPromiscuousMode (struct net_device * dev, U16 Mode)
-{
-	U32 off;
-	PU32 pMsg;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	off = pPab->p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	/* setup private message */
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_SET_PROMISCUOUS_MODE;
-	pMsg[5] = Mode;		/* promiscuous mode setting */
-
-	pPab->p_atu->InQueue = off;	/* send it to the device */
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCGetPromiscuousMode()
-**
-** get promiscuous mode setting
-**
-** Possible return values placed in pMode:
-**  0 = promisuous mode not set
-**  1 = promisuous mode is set
-**
-** =========================================================================
-*/
-RC_RETURN
-RCGetPromiscuousMode (struct net_device * dev, PU32 pMode,
-		      PFNWAITCALLBACK WaitCallback)
-{
-	U32 msgOffset, timeout;
-	PU32 pMsg;
-	volatile PU32 p32;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		printk (KERN_WARNING
-			"(rcpci45 driver:) RCGetLinkSpeed(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	/* virtual pointer to return buffer - clear first two dwords */
-	p32 = (volatile PU32) pPab->pLinOutMsgBlock;
-	p32[0] = 0xff;
-
-	/* setup private message */
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_PROMISCUOUS_MODE;
-	/* phys address to return status - area right after PAB */
-	pMsg[5] = pPab->outMsgBlockPhyAddr;
-
-	/* post to Inbound Post Q */
-
-	pPab->p_atu->InQueue = msgOffset;
-
-	/* wait for response */
-	timeout = 1000000;
-	while (1) {
-		if (WaitCallback)
-			(*WaitCallback) ();
-
-		udelay (10);	/* please don't hog the bus!!! */
-
-		if (p32[0] != 0xff)
-			break;
-
-		if (!timeout--) {
-			dprintk
-			    ("Timeout waiting for promiscuous mode from adapter\n");
-			dprintk ("0x%8x\n", p32[0]);
-			return RC_RTN_NO_LINK_SPEED;
-		}
-	}
-
-	/* get mode */
-	*pMode = (U8) ((volatile PU8) p32)[0] & 0x0f;
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCSetBroadcastMode()
-**
-** Defined values for Mode:
-**  0 - turn off promiscuous mode
-**  1 - turn on  promiscuous mode
-**
-** =========================================================================
-*/
-RC_RETURN
-RCSetBroadcastMode (struct net_device * dev, U16 Mode)
-{
-	U32 off;
-	PU32 pMsg;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	off = pPab->p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	/* setup private message */
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_SET_BROADCAST_MODE;
-	pMsg[5] = Mode;		/* promiscuous mode setting */
-
-	pPab->p_atu->InQueue = off;	/* send it to the device */
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCGetBroadcastMode()
-**
-** get promiscuous mode setting
-**
-** Possible return values placed in pMode:
-**  0 = promisuous mode not set
-**  1 = promisuous mode is set
-**
-** =========================================================================
-*/
-RC_RETURN
-RCGetBroadcastMode (struct net_device * dev, PU32 pMode,
-		    PFNWAITCALLBACK WaitCallback)
-{
-	U32 msgOffset, timeout;
-	PU32 pMsg;
-	volatile PU32 p32;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		printk (KERN_WARNING
-			"(rcpci45 driver:) RCGetLinkSpeed(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	/* virtual pointer to return buffer - clear first two dwords */
-	p32 = (volatile PU32) pPab->pLinOutMsgBlock;
-	p32[0] = 0xff;
-
-	/* setup private message */
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_BROADCAST_MODE;
-	/* phys address to return status - area right after PAB */
-	pMsg[5] = pPab->outMsgBlockPhyAddr;
-
-	/* post to Inbound Post Q */
-
-	pPab->p_atu->InQueue = msgOffset;
-
-	/* wait for response */
-	timeout = 1000000;
-	while (1) {
-		if (WaitCallback)
-			(*WaitCallback) ();
-
-		udelay (10);	/* please don't hog the bus!!! */
-
-		if (p32[0] != 0xff)
-			break;
-
-		if (!timeout--) {
-			printk (KERN_WARNING
-				"(rcpci45 driver:) Timeout waiting for promiscuous mode from adapter\n");
-			printk (KERN_WARNING "(rcpci45 driver:) 0x%8x\n",
-				p32[0]);
-			return RC_RTN_NO_LINK_SPEED;
-		}
-	}
-
-	/* get mode */
-	*pMode = (U8) ((volatile PU8) p32)[0] & 0x0f;
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCGetLinkSpeed()
-**
-** get ethernet link speed. 
-**
-** 0 = Unknown
-** 1 = Full Duplex 100BaseT
-** 2 = Half duplex 100BaseT
-** 3 = Full Duplex  10BaseT
-** 4 = Half duplex  10BaseT
-**
-** =========================================================================
-*/
-RC_RETURN
-RCGetLinkSpeed (struct net_device * dev, PU32 pLinkSpeedCode,
-		PFNWAITCALLBACK WaitCallback)
-{
-	U32 msgOffset, timeout;
-	PU32 pMsg;
-	volatile PU32 p32;
-	U8 IOPLinkSpeed;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		printk (KERN_WARNING
-			"(rcpci45 driver:) RCGetLinkSpeed(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	/* virtual pointer to return buffer - clear first two dwords */
-	p32 = (volatile PU32) pPab->pLinOutMsgBlock;
-	p32[0] = 0xff;
-
-	/* setup private message */
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_LINK_SPEED;
-	/* phys address to return status - area right after PAB */
-	pMsg[5] = pPab->outMsgBlockPhyAddr;
-
-	/* post to Inbound Post Q */
-
-	pPab->p_atu->InQueue = msgOffset;
-
-	/* wait for response */
-	timeout = 1000000;
-	while (1) {
-		if (WaitCallback)
-			(*WaitCallback) ();
-
-		udelay (10);	/* please don't hog the bus!!! */
-
-		if (p32[0] != 0xff)
-			break;
-
-		if (!timeout--) {
-			dprintk ("Timeout waiting for link speed from IOP\n");
-			dprintk ("0x%8x\n", p32[0]);
-			return RC_RTN_NO_LINK_SPEED;
-		}
-	}
-
-	/* get Link speed */
-	IOPLinkSpeed = (U8) ((volatile PU8) p32)[0] & 0x0f;
-
-	*pLinkSpeedCode = IOPLinkSpeed;
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCReportDriverCapability(struct net_device *dev, U32 capability)
-**
-** Currently defined bits:
-** WARM_REBOOT_CAPABLE   0x01
-**
-** =========================================================================
-*/
-RC_RETURN
-RCReportDriverCapability (struct net_device * dev, U32 capability)
-{
-	U32 off;
-	PU32 pMsg;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	off = pPab->p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	/* setup private message */
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] =
-	    RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_REPORT_DRIVER_CAPABILITY;
-	pMsg[5] = capability;
-
-	pPab->p_atu->InQueue = off;	/* send it to the I2O device */
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCGetFirmwareVer()
-**
-** Return firmware version in the form "SoftwareVersion : Bt BootVersion"
-**
-** =========================================================================
-*/
-RC_RETURN
-RCGetFirmwareVer (struct net_device * dev, PU8 pFirmString,
-		  PFNWAITCALLBACK WaitCallback)
-{
-	U32 msgOffset, timeout;
-	PU32 pMsg;
-	volatile PU32 p32;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	msgOffset = pPab->p_atu->InQueue;
-	if (msgOffset == 0xFFFFFFFF) {
-		dprintk ("RCGetFirmwareVer(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	/* virtual pointer to return buffer - clear first two dwords */
-	p32 = (volatile PU32) pPab->pLinOutMsgBlock;
-	p32[0] = 0xff;
-
-	/* setup private message */
-	pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_FIRMWARE_REV;
-	/* phys address to return status - area right after PAB */
-	pMsg[5] = pPab->outMsgBlockPhyAddr;
-
-	/* post to Inbound Post Q */
-
-	pPab->p_atu->InQueue = msgOffset;
-
-	/* wait for response */
-	timeout = 1000000;
-	while (1) {
-		if (WaitCallback)
-			(*WaitCallback) ();
-
-		udelay (10);	/* please don't hog the bus!!! */
-
-		if (p32[0] != 0xff)
-			break;
-
-		if (!timeout--) {
-			dprintk ("Timeout waiting for link speed from IOP\n");
-			return RC_RTN_NO_FIRM_VER;
-		}
-	}
-
-	strcpy (pFirmString, (PU8) p32);
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCResetLANCard()
-**
-** ResourceFlags indicates whether to return buffer resource explicitly
-** to host or keep and reuse.
-** CallbackFunction (if not NULL) is the function to be called when 
-** reset is complete.
-** If CallbackFunction is NULL, ReturnAddr will have a 1 placed in it when
-** reset is done (if not NULL).
-**
-** =========================================================================
-*/
-RC_RETURN
-RCResetLANCard (struct net_device * dev, U16 ResourceFlags, PU32 ReturnAddr,
-		PFNCALLBACK CallbackFunction)
-{
-	unsigned long off;
-	PU32 pMsg;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-	long timeout = 0;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	off = pPab->p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	pPab->pCallbackFunc = CallbackFunction;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	/* setup message */
-	pMsg[0] = FOUR_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_LAN_RESET << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = DEFAULT_RECV_INIT_CONTEXT;
-	pMsg[3] = ResourceFlags << 16;	/* resource flags */
-
-	pPab->p_atu->InQueue = off;	/* send it to the I2O device */
-
-	if (CallbackFunction == (PFNCALLBACK) NULL) {
-		/* call RCProcI2OMsgQ() until something in pPab->pCallbackFunc
-		   or until timer goes off */
-		while (pPab->pCallbackFunc == (PFNCALLBACK) NULL) {
-			RCProcI2OMsgQ (dev);
-			udelay (1000);	/* please don't hog the bus!!! */
-			timeout++;
-			if (timeout > 10000) {
-				break;
-			}
-		}
-		if (ReturnAddr != (PU32) NULL)
-			*ReturnAddr = (U32) pPab->pCallbackFunc;
-	}
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCResetIOP()
-**
-** Send StatusGet Msg, wait for results return directly to buffer.
-**
-** =========================================================================
-*/
-RC_RETURN
-RCResetIOP (struct net_device * dev)
-{
-	U32 msgOffset, timeout;
-	PU32 pMsg;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-	volatile PU32 p32;
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	pMsg[0] = NINE_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_EXEC_IOP_RESET << 24 | I2O_HOST_TID << 12 | I2O_IOP_TID;
-	pMsg[2] = 0;		/* universal context */
-	pMsg[3] = 0;		/* universal context */
-	pMsg[4] = 0;		/* universal context */
-	pMsg[5] = 0;		/* universal context */
-	/* phys address to return status - area right after PAB */
-	pMsg[6] = pPab->outMsgBlockPhyAddr;
-	pMsg[7] = 0;
-	pMsg[8] = 1;		/*  return 1 byte */
-
-	/* virtual pointer to return buffer - clear first two dwords */
-	p32 = (volatile PU32) pPab->pLinOutMsgBlock;
-	p32[0] = 0;
-	p32[1] = 0;
-
-	/* post to Inbound Post Q */
-
-	pPab->p_atu->InQueue = msgOffset;
-
-	/* wait for response */
-	timeout = 1000000;
-	while (1) {
-		udelay (10);	/* please don't hog the bus!!! */
-
-		if (p32[0] || p32[1])
-			break;
-
-		if (!timeout--) {
-			dprintk ("RCResetIOP timeout\n");
-			return RC_RTN_MSG_REPLY_TIMEOUT;
-		}
-	}
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCShutdownLANCard()
-**
-** ResourceFlags indicates whether to return buffer resource explicitly
-** to host or keep and reuse.
-** CallbackFunction (if not NULL) is the function to be called when 
-** shutdown is complete.
-** If CallbackFunction is NULL, ReturnAddr will have a 1 placed in it when
-** shutdown is done (if not NULL).
-**
-** =========================================================================
-*/
-RC_RETURN
-RCShutdownLANCard (struct net_device * dev, U16 ResourceFlags,
-		   PU32 ReturnAddr, PFNCALLBACK CallbackFunction)
-{
-	volatile PU32 pMsg;
-	U32 off;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-	long timeout = 0;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	off = pPab->p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	pPab->pCallbackFunc = CallbackFunction;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	/* setup message */
-	pMsg[0] = FOUR_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] =
-	    I2O_LAN_SHUTDOWN << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = DEFAULT_RECV_INIT_CONTEXT;
-	pMsg[3] = ResourceFlags << 16;	/* resource flags */
-
-	pPab->p_atu->InQueue = off;	/* send it to the I2O device */
-
-	if (CallbackFunction == (PFNCALLBACK) NULL) {
-		/* call RCProcI2OMsgQ() until something in pPab->pCallbackFunc
-		   or until timer goes off */
-		while (pPab->pCallbackFunc == (PFNCALLBACK) NULL) {
-			RCProcI2OMsgQ (dev);
-			udelay (1000);	/* please don't hog the bus!!! */
-			timeout++;
-			if (timeout > 10000) {
-				printk (KERN_WARNING
-					"(rcpci45 driver:) RCShutdownLANCard(): timeout\n");
-				break;
-			}
-		}
-		if (ReturnAddr != (PU32) NULL)
-			*ReturnAddr = (U32) pPab->pCallbackFunc;
-	}
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** RCSetRavlinIPandMask()
-**
-** Set the Ravlin 45/PCI cards IP address and network mask.
-**
-** IP address and mask must be in network byte order.
-** For example, IP address 1.2.3.4 and mask 255.255.255.0 would be
-** 0x04030201 and 0x00FFFFFF on a little endian machine.
-**
-** =========================================================================
-*/
-RC_RETURN
-RCSetRavlinIPandMask (struct net_device * dev, U32 ipAddr, U32 netMask)
-{
-	volatile PU32 pMsg;
-	U32 off;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	off = pPab->p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	/* setup private message */
-	pMsg[0] = SEVEN_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x219;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_SET_IP_AND_MASK;
-	pMsg[5] = ipAddr;
-	pMsg[6] = netMask;
-
-	pPab->p_atu->InQueue = off;	/* send it to the I2O device */
-	return RC_RTN_NO_ERROR;
-
-}
-
-/*
-** =========================================================================
-** RCGetRavlinIPandMask()
-**
-** get the IP address and MASK from the card
-** 
-** =========================================================================
-*/
-RC_RETURN
-RCGetRavlinIPandMask (struct net_device * dev, PU32 pIpAddr, PU32 pNetMask,
-		      PFNWAITCALLBACK WaitCallback)
-{
-	unsigned timeout;
-	U32 off;
-	PU32 pMsg, p32;
-	PPAB pPab = ((PDPA) dev->priv)->pPab;
-	PATU p_atu;
-
-	dprintk
-	    ("RCGetRavlinIPandMask: pIpAddr is 0x%08ulx, *IpAddr is 0x%08ulx\n",
-	     (u32) pIpAddr, *pIpAddr);
-
-	if (pPab == NULL)
-		return RC_RTN_ADPTR_NOT_REGISTERED;
-
-	p_atu = pPab->p_atu;
-	off = p_atu->InQueue;	/* get addresss of message */
-
-	if (0xFFFFFFFF == off)
-		return RC_RTN_FREE_Q_EMPTY;
-
-	p32 = (volatile PU32) pPab->pLinOutMsgBlock;
-	*p32 = 0xFFFFFFFF;
-
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + off);
-
-	dprintk
-	    ("RCGetRavlinIPandMask: p_atu 0x%08ulx, off 0x%08ulx, p32 0x%08ulx\n",
-	     (u32) p_atu, off, (u32) p32);
-	/* setup private message */
-	pMsg[0] = FIVE_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
-	pMsg[2] = 0;		/* initiator context */
-	pMsg[3] = 0x218;	/* transaction context */
-	pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_IP_AND_MASK;
-	pMsg[5] = pPab->outMsgBlockPhyAddr;
-
-	p_atu->InQueue = off;	/* send it to the I2O device */
-	dprintk
-	    ("RCGetRavlinIPandMask: p_atu 0x%08ulx, off 0x%08ulx, p32 0x%08ulx\n",
-	     (u32) p_atu, off, (u32) p32);
-
-	/* wait for the rcpci45 board to update the info */
-	timeout = 100000;
-	while (0xffffffff == *p32) {
-		if (WaitCallback)
-			(*WaitCallback) ();
-
-		udelay (10);
-
-		if (!timeout--) {
-			dprintk ("RCGetRavlinIPandMask: Timeout\n");
-			return RC_RTN_MSG_REPLY_TIMEOUT;
-		}
-	}
-
-	dprintk
-	    ("RCGetRavlinIPandMask: after time out\np32[0] (IpAddr) 0x%08ulx, p32[1] (IPmask) 0x%08ulx\n",
-	     p32[0], p32[1]);
-
-	/* send IP and mask to user's space  */
-	*pIpAddr = p32[0];
-	*pNetMask = p32[1];
-
-	dprintk
-	    ("RCGetRavlinIPandMask: pIpAddr is 0x%08ulx, *IpAddr is 0x%08ulx\n",
-	     (u32) pIpAddr, *pIpAddr);
-
-	return RC_RTN_NO_ERROR;
-}
-
-/* 
-** /////////////////////////////////////////////////////////////////////////
-** /////////////////////////////////////////////////////////////////////////
-**
-**                        local functions
-**
-** /////////////////////////////////////////////////////////////////////////
-** /////////////////////////////////////////////////////////////////////////
-*/
-
-/*
-** =========================================================================
-** SendI2OOutboundQInitMsg()
-**
-** =========================================================================
-*/
-static int
-SendI2OOutboundQInitMsg (PPAB pPab)
-{
-	U32 msgOffset, timeout, phyOutQFrames, i;
-	volatile PU32 pMsg;
-	volatile PU32 p32;
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		dprintk ("SendI2OOutboundQInitMsg(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	dprintk
-	    ("SendI2OOutboundQInitMsg - pMsg = 0x%08ulx, InQ msgOffset = 0x%08ulx\n",
-	     (u32) pMsg, msgOffset);
-
-	pMsg[0] = EIGHT_WORD_MSG_SIZE | TRL_OFFSET_6;
-	pMsg[1] =
-	    I2O_EXEC_OUTBOUND_INIT << 24 | I2O_HOST_TID << 12 | I2O_IOP_TID;
-	pMsg[2] = DEFAULT_RECV_INIT_CONTEXT;
-	pMsg[3] = 0x106;	/* transaction context */
-	pMsg[4] = 4096;		/* Host page frame size */
-	pMsg[5] = MSG_FRAME_SIZE << 16 | 0x80;	/* outbound msg frame size and Initcode */
-	pMsg[6] = 0xD0000004;	/* simple sgl element LE, EOB */
-	/* phys address to return status - area right after PAB */
-	pMsg[7] = pPab->outMsgBlockPhyAddr;
-
-	/* virtual pointer to return buffer - clear first two dwords */
-	p32 = (PU32) pPab->pLinOutMsgBlock;
-	p32[0] = 0;
-
-	/* post to Inbound Post Q */
-	pPab->p_atu->InQueue = msgOffset;
-
-	/* wait for response */
-	timeout = 100000;
-	while (1) {
-		udelay (10);	/* please don't hog the bus!!! */
-
-		if (p32[0])
-			break;
-
-		if (!timeout--) {
-			dprintk
-			    ("Timeout wait for InitOutQ InPrgress status from IOP\n");
-			return RC_RTN_NO_I2O_STATUS;
-		}
-	}
-
-	timeout = 100000;
-	while (1) {
-		udelay (10);	/* please don't hog the bus!!! */
-
-		if (p32[0] == I2O_EXEC_OUTBOUND_INIT_COMPLETE)
-			break;
-
-		if (!timeout--) {
-			dprintk
-			    ("Timeout wait for InitOutQ Complete status from IOP\n");
-			return RC_RTN_NO_I2O_STATUS;
-		}
-	}
-
-	/* load PCI outbound free Q with MF physical addresses */
-	phyOutQFrames = pPab->outMsgBlockPhyAddr;
-
-	for (i = 0; i < NMBR_MSG_FRAMES; i++) {
-		pPab->p_atu->OutQueue = phyOutQFrames;
-		phyOutQFrames += MSG_FRAME_SIZE;
-	}
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** GetI2OStatus()
-**
-** Send StatusGet Msg, wait for results return directly to buffer.
-**
-** =========================================================================
-*/
-static int
-GetI2OStatus (PPAB pPab)
-{
-	U32 msgOffset, timeout;
-	PU32 pMsg;
-	volatile PU32 p32;
-
-	msgOffset = pPab->p_atu->InQueue;
-	dprintk ("GetI2OStatus: msg offset = 0x%x\n", msgOffset);
-	if (msgOffset == 0xFFFFFFFF) {
-		dprintk ("GetI2OStatus(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	pMsg[0] = NINE_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_EXEC_STATUS_GET << 24 | I2O_HOST_TID << 12 | I2O_IOP_TID;
-	pMsg[2] = 0;		/* universal context */
-	pMsg[3] = 0;		/* universal context */
-	pMsg[4] = 0;		/* universal context */
-	pMsg[5] = 0;		/* universal context */
-	/* phys address to return status - area right after PAB */
-	pMsg[6] = pPab->outMsgBlockPhyAddr;
-	pMsg[7] = 0;
-	pMsg[8] = 88;		/*  return 88 bytes */
-
-	/* virtual pointer to return buffer - clear first two dwords */
-	p32 = (volatile PU32) pPab->pLinOutMsgBlock;
-	p32[0] = 0;
-	p32[1] = 0;
-
-	dprintk
-	    ("GetI2OStatus - pMsg:0x%08ulx, msgOffset:0x%08ulx, [1]:0x%08ulx, [6]:0x%08ulx\n",
-	     (u32) pMsg, msgOffset, pMsg[1], pMsg[6]);
-
-	/* post to Inbound Post Q */
-	pPab->p_atu->InQueue = msgOffset;
-
-	dprintk ("Return status to p32 = 0x%08ulx\n", (u32) p32);
-
-	/* wait for response */
-	timeout = 1000000;
-	while (1) {
-		udelay (10);	/* please don't hog the bus!!! */
-
-		if (p32[0] && p32[1])
-			break;
-
-		if (!timeout--) {
-			dprintk ("Timeout waiting for status from IOP\n");
-			dprintk ("0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n",
-				 p32[0], p32[1], p32[2], p32[3]);
-			dprintk ("0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n",
-				 p32[4], p32[5], p32[6], p32[7]);
-			dprintk ("0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n",
-				 p32[8], p32[9], p32[10], p32[11]);
-			return RC_RTN_NO_I2O_STATUS;
-		}
-	}
-
-	dprintk ("0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n", p32[0], p32[1],
-		 p32[2], p32[3]);
-	dprintk ("0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n", p32[4], p32[5],
-		 p32[6], p32[7]);
-	dprintk ("0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n", p32[8], p32[9],
-		 p32[10], p32[11]);
-	/* get IOP state */
-	pPab->IOPState = ((volatile PU8) p32)[10];
-	pPab->InboundMFrameSize = ((volatile PU16) p32)[6];
-
-	dprintk ("IOP state 0x%02x InFrameSize = 0x%04x\n",
-		 pPab->IOPState, pPab->InboundMFrameSize);
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** SendEnableSysMsg()
-**
-**
-** =========================================================================
-*/
-static int
-SendEnableSysMsg (PPAB pPab)
-{
-	U32 msgOffset;
-	volatile PU32 pMsg;
-
-	msgOffset = pPab->p_atu->InQueue;
-
-	if (msgOffset == 0xFFFFFFFF) {
-		dprintk ("SendEnableSysMsg(): Inbound Free Q empty!\n");
-		return RC_RTN_FREE_Q_EMPTY;
-	}
-
-	/* calc virtual address of msg - virtual already mapped to physical */
-	pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset);
-
-	dprintk
-	    ("SendEnableSysMsg - pMsg = 0x%08ulx, InQ msgOffset = 0x%08ulx\n",
-	     (u32) pMsg, msgOffset);
-
-	pMsg[0] = FOUR_WORD_MSG_SIZE | SGL_OFFSET_0;
-	pMsg[1] = I2O_EXEC_SYS_ENABLE << 24 | I2O_HOST_TID << 12 | I2O_IOP_TID;
-	pMsg[2] = DEFAULT_RECV_INIT_CONTEXT;
-	pMsg[3] = 0x110;	/* transaction context */
-	pMsg[4] = 0x50657465;	/*  RedCreek Private */
-
-	/* post to Inbound Post Q */
-	pPab->p_atu->InQueue = msgOffset;
-
-	return RC_RTN_NO_ERROR;
-}
-
-/*
-** =========================================================================
-** FillI2OMsgFromTCB()
-**
-** inputs   pMsgU32 - virtual pointer (mapped to physical) of message frame
-**          pXmitCntrlBlock - pointer to caller buffer control block.
-**
-** fills in LAN SGL after Transaction Control Word or Bucket Count.
-** =========================================================================
-*/
-static int
-FillI2OMsgSGLFromTCB (PU32 pMsgFrame, PRCTCB pTransCtrlBlock)
-{
-	unsigned int nmbrBuffers, nmbrSeg, nmbrDwords, context, flags;
-	PU32 pTCB, pMsg;
-
-	/* SGL element flags */
-#define EOB        0x40000000
-#define LE         0x80000000
-#define SIMPLE_SGL 0x10000000
-#define BC_PRESENT 0x01000000
-
-	pTCB = (PU32) pTransCtrlBlock;
-	pMsg = pMsgFrame;
-	nmbrDwords = 0;
-
-	dprintk ("FillI2OMsgSGLFromTCBX\n");
-	dprintk ("TCB  0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n",
-		 pTCB[0], pTCB[1], pTCB[2], pTCB[3], pTCB[4]);
-	dprintk ("pTCB 0x%08ulx, pMsg 0x%08ulx\n", (u32) pTCB, (u32) pMsg);
-
-	nmbrBuffers = *pTCB++;
-
-	if (!nmbrBuffers) {
-		return -1;
-	}
-
-	do {
-		context = *pTCB++;	/* buffer tag (context) */
-		nmbrSeg = *pTCB++;	/* number of segments */
-
-		if (!nmbrSeg) {
-			return -1;
-		}
-
-		flags = SIMPLE_SGL | BC_PRESENT;
-
-		if (1 == nmbrSeg) {
-			flags |= EOB;
-
-			if (1 == nmbrBuffers)
-				flags |= LE;
-		}
-
-		/* 1st SGL buffer element has context */
-		pMsg[0] = pTCB[0] | flags;	/* send over count (segment size) */
-		pMsg[1] = context;
-		pMsg[2] = pTCB[1];	/* send buffer segment physical address */
-		nmbrDwords += 3;
-		pMsg += 3;
-		pTCB += 2;
-
-		if (--nmbrSeg) {
-			do {
-				flags = SIMPLE_SGL;
-
-				if (1 == nmbrSeg) {
-					flags |= EOB;
-
-					if (1 == nmbrBuffers)
-						flags |= LE;
-				}
-
-				pMsg[0] = pTCB[0] | flags;	/* send over count */
-				pMsg[1] = pTCB[1];	/* send buffer segment physical address */
-				nmbrDwords += 2;
-				pTCB += 2;
-				pMsg += 2;
-
-			} while (--nmbrSeg);
-		}
-
-	} while (--nmbrBuffers);
-
-	return nmbrDwords;
-}
-
-/*
-** =========================================================================
-** ProcessOutboundI2OMsg()
-**
-** process I2O reply message
-** * change to msg structure *
-** =========================================================================
-*/
-static void
-ProcessOutboundI2OMsg (PPAB pPab, U32 phyAddrMsg)
-{
-	PU8 p8Msg;
-	PU32 p32;
-/*      U16 count; */
-
-	p8Msg = pPab->pLinOutMsgBlock + (phyAddrMsg - pPab->outMsgBlockPhyAddr);
-	p32 = (PU32) p8Msg;
-
-	dprintk
-	    ("VXD: ProcessOutboundI2OMsg - pPab 0x%08ulx, phyAdr 0x%08ulx, linAdr 0x%08ulx\n",
-	     (u32) pPab, phyAddrMsg, (u32) p8Msg);
-	dprintk ("msg :0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n", p32[0], p32[1],
-		 p32[2], p32[3]);
-	dprintk ("msg :0x%08ulx:0x%08ulx:0x%08ulx:0x%08ulx\n", p32[4], p32[5],
-		 p32[6], p32[7]);
-
-	if (p32[4] >> 24 != I2O_REPLY_STATUS_SUCCESS) {
-		dprintk ("Message reply status not success\n");
-		return;
-	}
-
-	switch (p8Msg[7]) {	/* function code byte */
-	case I2O_EXEC_SYS_TAB_SET:
-		msgFlag = 1;
-		dprintk ("Received I2O_EXEC_SYS_TAB_SET reply\n");
-		break;
-
-	case I2O_EXEC_HRT_GET:
-		msgFlag = 1;
-		dprintk ("Received I2O_EXEC_HRT_GET reply\n");
-		break;
-
-	case I2O_EXEC_LCT_NOTIFY:
-		msgFlag = 1;
-		dprintk ("Received I2O_EXEC_LCT_NOTIFY reply\n");
-		break;
-
-	case I2O_EXEC_SYS_ENABLE:
-		msgFlag = 1;
-		dprintk ("Received I2O_EXEC_SYS_ENABLE reply\n");
-		break;
-
-	default:
-		dprintk ("Received UNKNOWN reply\n");
-		break;
-	}
-}
diff -Nru a/drivers/net/rclanmtl.h b/drivers/net/rclanmtl.h
--- a/drivers/net/rclanmtl.h	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,701 +0,0 @@
-/*
-** *************************************************************************
-**
-**
-**     R C L A N M T L . H             $Revision: 6 $
-**
-**
-**  RedCreek I2O LAN Message Transport Layer header file.
-**
-**  ---------------------------------------------------------------------
-**  ---     Copyright (c) 1997-1999, RedCreek Communications Inc.     ---
-**  ---                   All rights reserved.                        ---
-**  ---------------------------------------------------------------------
-**
-**  File Description:
-**
-**  Header file for host I2O (Intelligent I/O) LAN message transport layer 
-**  API and data types.
-**
-**  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.
-**
-** *************************************************************************
-*/
-
-#ifndef RCLANMTL_H
-#define RCLANMTL_H
-
-/* Linux specific includes */
-#include <asm/types.h>
-#ifdef RC_LINUX_MODULE		/* linux modules need non-library version of string functions */
-#include <linux/string.h>
-#else
-#include <string.h>
-#endif
-#include <linux/delay.h>	/* for udelay() */
-
-#include <linux/netdevice.h>
-#include <linux/if_ether.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-
-#include <asm/io.h>
-
-/* Debug stuff. Define for debug output */
-#undef RCDEBUG
-
-#ifdef RCDEBUG
-#define dprintk(args...) printk(KERN_DEBUG "rc: " args)
-#else
-#define dprintk(args...) { }
-#endif
-
-/* Typedefs */
-
- /* scalar data types */
-typedef __u8 U8;
-typedef __u16 U16;
-typedef __u32 U32;
-typedef __u8 *PU8;
-typedef __u16 *PU16;
-typedef __u32 *PU32;
-typedef unsigned long BF;
-typedef int RC_RETURN;
-
- /* 
-    ** type PFNWAITCALLBACK
-    **
-    ** pointer to void function - type used for WaitCallback in some functions 
-  */
-typedef void (*PFNWAITCALLBACK) (void);	/* void argument avoids compiler complaint */
-
- /*
-    ** type PFNTXCALLBACK 
-    **
-    ** Pointer to user's transmit callback function.  This user function is
-    ** called from RCProcI2OMsgQ() when packet have been transmitted from buffers
-    ** given in the RCI2OSendPacket() function.  BufferContext is a pointer to
-    ** an array of 32 bit context values.  These are the values the user assigned
-    ** and passed in the TCB to the RCI2OSendPacket() function.  PcktCount
-    ** indicates the number of buffer context values in the BufferContext[] array.
-    ** The User's TransmitCallbackFunction should recover (put back in free queue)
-    ** the packet buffers associated with the buffer context values.
-  */
-typedef void (*PFNTXCALLBACK) (U32 Status,
-			       U16 PcktCount,
-			       PU32 BufferContext, struct net_device *);
-
- /* 
-    ** type PFNRXCALLBACK 
-    **
-    ** Pointer to user's receive callback function.  This user function
-    ** is called from RCProcI2OMsgQ() when packets have been received into
-    ** previously posted packet buffers throught the RCPostRecvBuffers() function.
-    ** The received callback function should process the Packet Descriptor Block
-    ** pointed to by PacketDescBlock. See Packet Decription Block below.
-  */
-typedef void (*PFNRXCALLBACK) (U32 Status,
-			       U8 PktCount,
-			       U32 BucketsRemain,
-			       PU32 PacketDescBlock, struct net_device *);
-
- /* 
-    ** type PFNCALLBACK 
-    **
-    ** Pointer to user's generic callback function.  This user function
-    ** can be passed to LANReset or LANShutdown and is called when the 
-    ** the reset or shutdown is complete.
-    ** Param1 and Param2 are invalid for LANReset and LANShutdown.
-  */
-typedef void (*PFNCALLBACK) (U32 Status,
-			     U32 Param1, U32 Param2, struct net_device * dev);
-
-/*
-**  Message Unit CSR definitions for RedCreek PCI45 board
-*/
-typedef struct tag_rcatu {
-	volatile unsigned long APICRegSel;	/* APIC Register Select */
-	volatile unsigned long reserved0;
-	volatile unsigned long APICWinReg;	/* APIC Window Register */
-	volatile unsigned long reserved1;
-	volatile unsigned long InMsgReg0;	/* inbound message register 0 */
-	volatile unsigned long InMsgReg1;	/* inbound message register 1 */
-	volatile unsigned long OutMsgReg0;	/* outbound message register 0 */
-	volatile unsigned long OutMsgReg1;	/* outbound message register 1 */
-	volatile unsigned long InDoorReg;	/* inbound doorbell register */
-	volatile unsigned long InIntStat;	/* inbound interrupt status register */
-	volatile unsigned long InIntMask;	/* inbound interrupt mask register */
-	volatile unsigned long OutDoorReg;	/* outbound doorbell register */
-	volatile unsigned long OutIntStat;	/* outbound interrupt status register */
-	volatile unsigned long OutIntMask;	/* outbound interrupt mask register */
-	volatile unsigned long reserved2;
-	volatile unsigned long reserved3;
-	volatile unsigned long InQueue;	/* inbound queue port */
-	volatile unsigned long OutQueue;	/* outbound queue port */
-	volatile unsigned long reserved4;
-	volatile unsigned long reserver5;
-	/* RedCreek extension */
-	volatile unsigned long EtherMacLow;
-	volatile unsigned long EtherMacHi;
-	volatile unsigned long IPaddr;
-	volatile unsigned long IPmask;
-} *PATU;
-
- /* 
-    ** typedef PAB
-    **
-    ** PCI Adapter Block - holds instance specific information.
-  */
-typedef struct {
-	PATU p_atu;		/* ptr to  ATU register block */
-	PU8 pPci45LinBaseAddr;
-	PU8 pLinOutMsgBlock;
-	U32 outMsgBlockPhyAddr;
-	PFNTXCALLBACK pTransCallbackFunc;
-	PFNRXCALLBACK pRecvCallbackFunc;
-	PFNCALLBACK pRebootCallbackFunc;
-	PFNCALLBACK pCallbackFunc;
-	U16 IOPState;
-	U16 InboundMFrameSize;
-} *PPAB;
-
-/*
- * Driver Private Area, DPA.
- */
-typedef struct {
-	U8 id;			/* the AdapterID */
-
-	/* These two field are basically for the RCioctl function.
-	 * I could not determine if they could be avoided. (RAA)*/
-	U32 pci_addr;		/* the pci address of the adapter */
-	U32 pci_addr_len;
-
-	struct pci_dev *pci_dev;
-	struct timer_list timer;	/*  timer */
-	struct net_device_stats stats;	/* the statistics structure */
-	unsigned long numOutRcvBuffers;	/* number of outstanding receive buffers */
-	unsigned char shutdown;
-	unsigned char reboot;
-	unsigned char nexus;
-	PU8 msgbuf;		/* Pointer to Lan Api Private Area */
-	dma_addr_t msgbuf_dma;
-	PPAB pPab;		/* Pointer to the PCI Adapter Block */
-} *PDPA;
-
-/* PCI/45 Configuration space values */
-#define RC_PCI45_VENDOR_ID  0x4916
-#define RC_PCI45_DEVICE_ID  0x1960
-
- /* RedCreek API function return values */
-#define RC_RTN_NO_ERROR             0
-#define RC_RTN_I2O_NOT_INIT         1
-#define RC_RTN_FREE_Q_EMPTY         2
-#define RC_RTN_TCB_ERROR            3
-#define RC_RTN_TRANSACTION_ERROR    4
-#define RC_RTN_ADAPTER_ALREADY_INIT 5
-#define RC_RTN_MALLOC_ERROR         6
-#define RC_RTN_ADPTR_NOT_REGISTERED 7
-#define RC_RTN_MSG_REPLY_TIMEOUT    8
-#define RC_RTN_NO_I2O_STATUS        9
-#define RC_RTN_NO_FIRM_VER         10
-#define RC_RTN_NO_LINK_SPEED       11
-
-/* Driver capability flags */
-#define WARM_REBOOT_CAPABLE      0x01
-
-/*
-** Status - Transmit and Receive callback status word 
-**
-** A 32 bit Status is returned to the TX and RX callback functions.  This value
-** contains both the reply status and the detailed status as follows:
-**
-**  32    24     16            0
-**  +------+------+------------+
-**  | Reply|      |  Detailed  |
-**  |Status|   0  |   Status   |
-**  +------+------+------------+
-**
-** Reply Status and Detailed Status of zero indicates No Errors.
-*/
- /* reply message status defines */
-#define    I2O_REPLY_STATUS_SUCCESS                    0x00
-#define    I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER     0x02
-#define    I2O_REPLY_STATUS_TRANSACTION_ERROR          0x0A
-
-/* DetailedStatusCode defines */
-#define    I2O_LAN_DSC_SUCCESS                         0x0000
-#define    I2O_LAN_DSC_DEVICE_FAILURE                  0x0001
-#define    I2O_LAN_DSC_DESTINATION_NOT_FOUND           0x0002
-#define    I2O_LAN_DSC_TRANSMIT_ERROR                  0x0003
-#define    I2O_LAN_DSC_TRANSMIT_ABORTED                0x0004
-#define    I2O_LAN_DSC_RECEIVE_ERROR                   0x0005
-#define    I2O_LAN_DSC_RECEIVE_ABORTED                 0x0006
-#define    I2O_LAN_DSC_DMA_ERROR                       0x0007
-#define    I2O_LAN_DSC_BAD_PACKET_DETECTED             0x0008
-#define    I2O_LAN_DSC_OUT_OF_MEMORY                   0x0009
-#define    I2O_LAN_DSC_BUCKET_OVERRUN                  0x000A
-#define    I2O_LAN_DSC_IOP_INTERNAL_ERROR              0x000B
-#define    I2O_LAN_DSC_CANCELED                        0x000C
-#define    I2O_LAN_DSC_INVALID_TRANSACTION_CONTEXT     0x000D
-#define    I2O_LAN_DSC_DESTINATION_ADDRESS_DETECTED    0x000E
-#define    I2O_LAN_DSC_DESTINATION_ADDRESS_OMITTED     0x000F
-#define    I2O_LAN_DSC_PARTIAL_PACKET_RETURNED         0x0010
-
-/*
-** Packet Description Block   (Received packets)
-**
-** A pointer to this block structure is returned to the ReceiveCallback 
-** function.  It contains the list of packet buffers which have either been
-** filled with a packet or returned to host due to a LANReset function. 
-** Currently there will only be one packet per receive bucket (buffer) posted. 
-**
-**   32   24               0     
-**  +-----------------------+  -\
-**  |   Buffer 1 Context    |    \
-**  +-----------------------+     \
-**  |      0xC0000000       |     / First Bucket Descriptor
-**  +-----+-----------------+    /
-**  |  0  | packet 1 length |   / 
-**  +-----------------------+  -\
-**  |   Buffer 2 Context    |    \
-**  +-----------------------+     \
-**  |      0xC0000000       |     / Second Bucket Descriptor
-**  +-----+-----------------+    /
-**  |  0  | packet 2 length |   / 
-**  +-----+-----------------+  -
-**  |         ...           |  ----- more bucket descriptors
-**  +-----------------------+  -\
-**  |   Buffer n Context    |    \
-**  +-----------------------+     \
-**  |      0xC0000000       |     / Last Bucket Descriptor
-**  +-----+-----------------+    /
-**  |  0  | packet n length |   / 
-**  +-----+-----------------+  -
-**
-** Buffer Context values are those given to adapter in the TCB on calls to
-** RCPostRecvBuffers().
-**  
-*/
-
-/*
-** Transaction Control Block (TCB) structure
-**
-** A structure like this is filled in by the user and passed by reference to 
-** RCI2OSendPacket() and RCPostRecvBuffers() functions.  Minimum size is five
-** 32-bit words for one buffer with one segment descriptor.  
-** MAX_NMBR_POST_BUFFERS_PER_MSG defines the maximum single segment buffers
-** that can be described in a given TCB.
-**
-**   32                    0
-**  +-----------------------+
-**  |   Buffer Count        |  Number of buffers in the TCB
-**  +-----------------------+
-**  |   Buffer 1 Context    |  first buffer reference
-**  +-----------------------+
-**  |   Buffer 1 Seg Count  |  number of segments in buffer
-**  +-----------------------+
-**  |   Buffer 1 Seg Desc 1 |  first segment descriptor (size, physical address)
-**  +-----------------------+
-**  |         ...           |  more segment descriptors (size, physical address)
-**  +-----------------------+
-**  |   Buffer 1 Seg Desc n |  last segment descriptor (size, physical address)
-**  +-----------------------+
-**  |   Buffer 2 Context    |  second buffer reference
-**  +-----------------------+
-**  |   Buffer 2 Seg Count  |  number of segments in buffer
-**  +-----------------------+
-**  |   Buffer 2 Seg Desc 1 |  segment descriptor (size, physical address)
-**  +-----------------------+
-**  |         ...           |  more segment descriptors (size, physical address)
-**  +-----------------------+
-**  |   Buffer 2 Seg Desc n |
-**  +-----------------------+
-**  |         ...           |  more buffer descriptor blocks ...
-**  +-----------------------+
-**  |   Buffer n Context    |
-**  +-----------------------+
-**  |   Buffer n Seg Count  |
-**  +-----------------------+
-**  |   Buffer n Seg Desc 1 |
-**  +-----------------------+
-**  |         ...           |
-**  +-----------------------+
-**  |   Buffer n Seg Desc n |
-**  +-----------------------+
-**
-**
-** A TCB for one contigous packet buffer would look like the following:
-**
-**   32                    0
-**  +-----------------------+
-**  |         1             |  one buffer in the TCB
-**  +-----------------------+
-**  |  <user's Context>     |  user's buffer reference
-**  +-----------------------+
-**  |         1             |  one segment buffer
-**  +-----------------------+                            _
-**  |    <buffer size>      |  size                       \ 
-**  +-----------------------+                              \ segment descriptor
-**  |  <physical address>   |  physical address of buffer  /
-**  +-----------------------+                            _/
-**
-*/
-
- /* Buffer Segment Descriptor */
-typedef struct {
-	U32 size;
-	U32 phyAddress;
-} BSD, *PBSD;
-
-typedef PU32 PRCTCB;
-/*
-** -------------------------------------------------------------------------
-** Exported functions comprising the API to the LAN I2O message transport layer
-** -------------------------------------------------------------------------
-*/
-
- /*
-    ** InitRCI2OMsgLayer()
-    ** 
-    ** Called once prior to using the I2O LAN message transport layer.  User 
-    ** provides both the physical and virual address of a locked page buffer 
-    ** that is used as a private buffer for the RedCreek I2O message
-    ** transport layer.  This buffer must be a contigous memory block of a 
-    ** minimum of 16K bytes and long word aligned.  The user also must provide
-    ** the base address of the RedCreek PCI adapter assigned by BIOS or operating
-    ** system.  
-    **
-    ** Inputs:  dev - the net_device struct for the device.
-    **          TransmitCallbackFunction - address of user's TX callback function
-    **          ReceiveCallbackFunction  - address of user's RX callback function
-    **          RebootCallbackFunction  - address of user's reboot callback function
-    **
-  */
-RC_RETURN RCInitI2OMsgLayer (struct net_device *dev,
-			     PFNTXCALLBACK TransmitCallbackFunction,
-			     PFNRXCALLBACK ReceiveCallbackFunction,
-			     PFNCALLBACK RebootCallbackFunction);
-
- /*
-    ** RCSetRavlinIPandMask()
-    **
-    ** Set the Ravlin 45/PCI cards IP address and network mask.
-    **
-    ** IP address and mask must be in network byte order.
-    ** For example, IP address 1.2.3.4 and mask 255.255.255.0 would be
-    ** 0x04030201 and 0x00FFFFFF on a little endian machine.
-    **
-  */
-RC_RETURN RCSetRavlinIPandMask (struct net_device *dev, U32 ipAddr,
-				U32 netMask);
-
-/*
-** =========================================================================
-** RCGetRavlinIPandMask()
-**
-** get the IP address and MASK from the card
-** 
-** =========================================================================
-*/
-RC_RETURN
-RCGetRavlinIPandMask (struct net_device *dev, PU32 pIpAddr, PU32 pNetMask,
-		      PFNWAITCALLBACK WaitCallback);
-
- /* 
-    ** RCProcI2OMsgQ()
-    ** 
-    ** Called from user's polling loop or Interrupt Service Routine for a PCI 
-    ** interrupt from the RedCreek PCI adapter.  User responsible for determining
-    ** and hooking the PCI interrupt. This function will call the registered
-    ** callback functions, TransmitCallbackFunction or ReceiveCallbackFunction,
-    ** if a TX or RX transaction has completed.
-  */
-irqreturn_t RCProcI2OMsgQ (struct net_device *dev);
-
- /*
-    ** Disable and Enable I2O interrupts.  I2O interrupts are enabled at Init time
-    ** but can be disabled and re-enabled through these two function calls.
-    ** Packets will still be put into any posted received buffers and packets will
-    ** be sent through RCI2OSendPacket() functions.  Disabling I2O interrupts
-    ** will prevent hardware interrupt to host even though the outbound I2O msg
-    ** queue is not emtpy.
-  */
-RC_RETURN RCEnableI2OInterrupts (struct net_device *dev);
-RC_RETURN RCDisableI2OInterrupts (struct net_device *dev);
-
- /* 
-    ** RCPostRecvBuffers()
-    ** 
-    ** Post user's page locked buffers for use by the PCI adapter to
-    ** return ethernet packets received from the LAN.  Transaction Control Block,
-    ** provided by user, contains buffer descriptor(s) which includes a buffer
-    ** context number along with buffer size and physical address.  See TCB above.
-    ** The buffer context and actual packet length are returned to the 
-    ** ReceiveCallbackFunction when packets have been received.  Buffers posted
-    ** to the RedCreek adapter are considered owned by the adapter until the
-    ** context is return to user through the ReceiveCallbackFunction.
-  */
-RC_RETURN RCPostRecvBuffers (struct net_device *dev,
-			     PRCTCB pTransactionCtrlBlock);
-#define MAX_NMBR_POST_BUFFERS_PER_MSG 32
-
- /*
-    ** RCI2OSendPacket()
-    ** 
-    ** Send user's ethernet packet from a locked page buffer.  
-    ** Packet must have full MAC header, however without a CRC.  
-    ** Initiator context is a user provided value that is returned 
-    ** to the TransmitCallbackFunction when packet buffer is free.
-    ** Transmit buffer are considered owned by the adapter until context's
-    ** returned to user through the TransmitCallbackFunction.
-  */
-RC_RETURN RCI2OSendPacket (struct net_device *dev,
-			   U32 context, PRCTCB pTransactionCtrlBlock);
-
- /* Ethernet Link Statistics structure */
-typedef struct tag_RC_link_stats {
-	U32 TX_good;		/* good transmit frames */
-	U32 TX_maxcol;		/* frames not TX due to MAX collisions */
-	U32 TX_latecol;		/* frames not TX due to late collisions */
-	U32 TX_urun;		/* frames not TX due to DMA underrun */
-	U32 TX_crs;		/* frames TX with lost carrier sense */
-	U32 TX_def;		/* frames deferred due to activity on link */
-	U32 TX_singlecol;	/* frames TX with one and only on collision */
-	U32 TX_multcol;		/* frames TX with more than one collision */
-	U32 TX_totcol;		/* total collisions detected during TX */
-	U32 Rcv_good;		/* good frames received */
-	U32 Rcv_CRCerr;		/* frames RX and discarded with CRC errors */
-	U32 Rcv_alignerr;	/* frames RX with alignment and CRC errors */
-	U32 Rcv_reserr;		/* good frames discarded due to no RX buffer */
-	U32 Rcv_orun;		/* RX frames lost due to FIFO overrun */
-	U32 Rcv_cdt;		/* RX frames with collision during RX */
-	U32 Rcv_runt;		/* RX frames shorter than 64 bytes */
-} RCLINKSTATS, *P_RCLINKSTATS;
-
- /*
-    ** RCGetLinkStatistics()
-    **
-    ** Returns link statistics in user's structure at address StatsReturnAddr
-    ** If given, not NULL, the function WaitCallback is called during the wait
-    ** loop while waiting for the adapter to respond.
-  */
-RC_RETURN RCGetLinkStatistics (struct net_device *dev,
-			       P_RCLINKSTATS StatsReturnAddr,
-			       PFNWAITCALLBACK WaitCallback);
-
- /*
-    ** RCGetLinkStatus()
-    **
-    ** Return link status, up or down, to user's location addressed by ReturnAddr.
-    ** If given, not NULL, the function WaitCallback is called during the wait
-    ** loop while waiting for the adapter to respond.
-  */
-RC_RETURN RCGetLinkStatus (struct net_device *dev,
-			   PU32 pReturnStatus, PFNWAITCALLBACK WaitCallback);
-
- /* Link Status defines - value returned in pReturnStatus */
-#define RC_LAN_LINK_STATUS_DOWN     0
-#define RC_LAN_LINK_STATUS_UP       1
-
- /*
-    ** RCGetMAC()
-    **
-    ** Get the current MAC address assigned to user.  RedCreek Ravlin 45/PCI 
-    ** has two MAC addresses.  One which is private to the PCI Card, and 
-    ** another MAC which is given to the user as its link layer MAC address. The
-    ** adapter runs in promiscous mode because of the dual address requirement.
-    ** The MAC address is returned to the unsigned char array pointer to by mac.
-  */
-RC_RETURN RCGetMAC (struct net_device *dev, PFNWAITCALLBACK WaitCallback);
-
- /*
-    ** RCSetMAC()
-    **
-    ** Set a new user port MAC address.  This address will be returned on
-    ** subsequent RCGetMAC() calls.
-  */
-RC_RETURN RCSetMAC (struct net_device *dev, PU8 mac);
-
- /*
-    ** RCSetLinkSpeed()
-    **
-    ** set adapter's link speed based on given input code.
-  */
-RC_RETURN RCSetLinkSpeed (struct net_device *dev, U16 LinkSpeedCode);
- /* Set link speed codes */
-#define LNK_SPD_AUTO_NEG_NWAY   0
-#define LNK_SPD_100MB_FULL      1
-#define LNK_SPD_100MB_HALF      2
-#define LNK_SPD_10MB_FULL       3
-#define LNK_SPD_10MB_HALF       4
-
- /*
-    ** RCGetLinkSpeed()
-    **
-    ** Return link speed code.
-  */
- /* Return link speed codes */
-#define LNK_SPD_UNKNOWN         0
-#define LNK_SPD_100MB_FULL      1
-#define LNK_SPD_100MB_HALF      2
-#define LNK_SPD_10MB_FULL       3
-#define LNK_SPD_10MB_HALF       4
-
-RC_RETURN
-RCGetLinkSpeed (struct net_device *dev, PU32 pLinkSpeedCode,
-		PFNWAITCALLBACK WaitCallback);
-/*
-** =========================================================================
-** RCSetPromiscuousMode(struct net_device *dev, U16 Mode)
-**
-** Defined values for Mode:
-**  0 - turn off promiscuous mode
-**  1 - turn on  promiscuous mode
-**
-** =========================================================================
-*/
-#define PROMISCUOUS_MODE_OFF 0
-#define PROMISCUOUS_MODE_ON  1
-RC_RETURN RCSetPromiscuousMode (struct net_device *dev, U16 Mode);
-/*
-** =========================================================================
-** RCGetPromiscuousMode(struct net_device *dev, PU32 pMode, PFNWAITCALLBACK WaitCallback)
-**
-** get promiscuous mode setting
-**
-** Possible return values placed in pMode:
-**  0 = promisuous mode not set
-**  1 = promisuous mode is set
-**
-** =========================================================================
-*/
-RC_RETURN
-RCGetPromiscuousMode (struct net_device *dev, PU32 pMode,
-		      PFNWAITCALLBACK WaitCallback);
-
-/*
-** =========================================================================
-** RCSetBroadcastMode(struct net_device *dev, U16 Mode)
-**
-** Defined values for Mode:
-**  0 - turn off promiscuous mode
-**  1 - turn on  promiscuous mode
-**
-** =========================================================================
-*/
-#define BROADCAST_MODE_OFF 0
-#define BROADCAST_MODE_ON  1
-RC_RETURN RCSetBroadcastMode (struct net_device *dev, U16 Mode);
-/*
-** =========================================================================
-** RCGetBroadcastMode(struct net_device *dev, PU32 pMode, PFNWAITCALLBACK WaitCallback)
-**
-** get broadcast mode setting
-**
-** Possible return values placed in pMode:
-**  0 = broadcast mode not set
-**  1 = broadcast mode is set
-**
-** =========================================================================
-*/
-RC_RETURN
-RCGetBroadcastMode (struct net_device *dev, PU32 pMode,
-		    PFNWAITCALLBACK WaitCallback);
-/*
-** =========================================================================
-** RCReportDriverCapability(struct net_device *dev, U32 capability)
-**
-** Currently defined bits:
-** WARM_REBOOT_CAPABLE   0x01
-**
-** =========================================================================
-*/
-RC_RETURN RCReportDriverCapability (struct net_device *dev, U32 capability);
-
-/*
-** RCGetFirmwareVer()
-**
-** Return firmware version in the form "SoftwareVersion : Bt BootVersion"
-**
-** WARNING: user's space pointed to by pFirmString should be at least 60 bytes.
-*/
-RC_RETURN
-RCGetFirmwareVer (struct net_device *dev, PU8 pFirmString,
-		  PFNWAITCALLBACK WaitCallback);
-
-/*
-** ----------------------------------------------
-** LAN adapter Reset and Shutdown functions
-** ----------------------------------------------
-*/
- /* resource flag bit assignments for RCResetLANCard() & RCShutdownLANCard() */
-#define RC_RESOURCE_RETURN_POSTED_RX_BUCKETS  0x0001
-#define RC_RESOURCE_RETURN_PEND_TX_BUFFERS    0x0002
-
- /*
-    ** RCResetLANCard()
-    **
-    ** Reset LAN card operation.  Causes a software reset of the ethernet
-    ** controller and restarts the command and receive units. Depending on 
-    ** the ResourceFlags given, the buffers are either returned to the
-    ** host with reply status of I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER and
-    ** detailed status of I2O_LAN_DSC_CANCELED (new receive buffers must be
-    ** posted after issuing this) OR the buffers are kept and reused by
-    ** the ethernet controller. If CallbackFunction is not NULL, the function
-    ** will be called when the reset is complete.  If the CallbackFunction is
-    ** NULL,a 1 will be put into the ReturnAddr after waiting for the reset 
-    ** to complete (please disable I2O interrupts during this method).
-    ** Any outstanding transmit or receive buffers that are complete will be
-    ** returned via the normal reply messages before the requested resource
-    ** buffers are returned.
-    ** A call to RCPostRecvBuffers() is needed to return the ethernet to full
-    ** operation if the receive buffers were returned during LANReset.
-    ** Note: The IOP status is not affected by a LAN reset.
-  */
-RC_RETURN RCResetLANCard (struct net_device *dev, U16 ResourceFlags,
-			  PU32 ReturnAddr, PFNCALLBACK CallbackFunction);
-
- /*
-    ** RCShutdownLANCard()
-    **
-    ** Shutdown LAN card operation and put into an idle (suspended) state.
-    ** The LAN card is restarted with RCResetLANCard() function.
-    ** Depending on the ResourceFlags given, the buffers are either returned 
-    ** to the host with reply status of I2O_REPLY_STATUS_ABORT_NO_DATA_TRANSFER 
-    ** and detailed status of I2O_LAN_DSC_CANCELED (new receive buffers must be
-    ** posted after issuing this) OR the buffers are kept and reused by
-    ** the ethernet controller. If CallbackFunction is not NULL, the function
-    ** will be called when the reset is complete.  If the CallbackFunction is
-    ** NULL,a 1 will be put into the ReturnAddr after waiting for the reset 
-    ** to complete (please disable I2O interrupts during this method).
-    ** Any outstanding transmit or receive buffers that are complete will be
-    ** returned via the normal reply messages before the requested resource
-    ** buffers are returned.
-    ** Note: The IOP status is not affected by a LAN shutdown.
-  */
-RC_RETURN
-RCShutdownLANCard (struct net_device *dev, U16 ResourceFlags, PU32 ReturnAddr,
-		   PFNCALLBACK CallbackFunction);
-
- /*
-    ** RCResetIOP();
-    **     Initializes IOPState to I2O_IOP_STATE_RESET.
-    **     Stops access to outbound message Q.
-    **     Discards any outstanding transmit or posted receive buffers.
-    **     Clears outbound message Q. 
-  */
-RC_RETURN RCResetIOP (struct net_device *dev);
-
-#endif				/* RCLANMTL_H */
diff -Nru a/drivers/net/rcpci45.c b/drivers/net/rcpci45.c
--- a/drivers/net/rcpci45.c	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1049 +0,0 @@
-/* 
-**
-**  RCpci45.c  
-**
-**
-**
-**  ---------------------------------------------------------------------
-**  ---     Copyright (c) 1998, 1999, RedCreek Communications Inc.    ---
-**  ---                   All rights reserved.                        ---
-**  ---------------------------------------------------------------------
-**
-** Written by Pete Popov and Brian Moyle.
-**
-** Known Problems
-** 
-** None known at this time.
-**
-**  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.
-**
-**  Francois Romieu, Apr 2003: Converted to pci DMA mapping API.
-**
-**  Pete Popov, Oct 2001: Fixed a few bugs to make the driver functional
-**  again. Note that this card is not supported or manufactured by 
-**  RedCreek anymore.
-**   
-**  Rasmus Andersen, December 2000: Converted to new PCI API and general
-**  cleanup.
-**
-**  Pete Popov, January 11,99: Fixed a couple of 2.1.x problems 
-**  (virt_to_bus() not called), tested it under 2.2pre5 (as a module), and 
-**  added a #define(s) to enable the use of the same file for both, the 2.0.x 
-**  kernels as well as the 2.1.x.
-**
-**  Ported to 2.1.x by Alan Cox 1998/12/9. 
-**
-**  Sometime in mid 1998, written by Pete Popov and Brian Moyle.
-**
-***************************************************************************/
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/in.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/pci.h>
-#include <linux/timer.h>
-
-#include <asm/irq.h>		/* For NR_IRQS only. */
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-
-static char version[] __initdata =
-    "RedCreek Communications PCI linux driver version 2.21\n";
-
-#define RC_LINUX_MODULE
-#include "rclanmtl.h"
-#include "rcif.h"
-
-#define RUN_AT(x) (jiffies + (x))
-
-#define NEW_MULTICAST
-
-#define MAX_ETHER_SIZE        1520
-#define MAX_NMBR_RCV_BUFFERS    96
-#define RC_POSTED_BUFFERS_LOW_MARK MAX_NMBR_RCV_BUFFERS-16
-#define BD_SIZE 3		/* Bucket Descriptor size */
-#define BD_LEN_OFFSET 2		/* Bucket Descriptor offset to length field */
-
-/* RedCreek LAN device Target ID */
-#define RC_LAN_TARGET_ID  0x10
-/* RedCreek's OSM default LAN receive Initiator */
-#define DEFAULT_RECV_INIT_CONTEXT  0xA17
-
-/* minimum msg buffer size needed by the card 
- * Note that the size of this buffer is hard code in the
- * ipsec card's firmware. Thus, the size MUST be a minimum
- * of 16K. Otherwise the card will end up using memory
- * that does not belong to it.
- */
-#define MSG_BUF_SIZE  16384
-
-/* 2003/04/20: I don't know about the hardware ability but the driver won't
- * play safe with 64 bit addressing and DAC without NETIF_F_HIGHDMA doesn't
- * really make sense anyway. Let's play safe - romieu.
- */
-#define RCPCI45_DMA_MASK	((u64) 0xffffffff)
-
-static U32 DriverControlWord;
-
-static void rc_timer (unsigned long);
-
-static int RCopen (struct net_device *);
-static int RC_xmit_packet (struct sk_buff *, struct net_device *);
-static irqreturn_t RCinterrupt (int, void *, struct pt_regs *);
-static int RCclose (struct net_device *dev);
-static struct net_device_stats *RCget_stats (struct net_device *);
-static int RCioctl (struct net_device *, struct ifreq *, int);
-static int RCconfig (struct net_device *, struct ifmap *);
-static void RCxmit_callback (U32, U16, PU32, struct net_device *);
-static void RCrecv_callback (U32, U8, U32, PU32, struct net_device *);
-static void RCreset_callback (U32, U32, U32, struct net_device *);
-static void RCreboot_callback (U32, U32, U32, struct net_device *);
-static int RC_allocate_and_post_buffers (struct net_device *, int);
-
-static struct pci_device_id rcpci45_pci_table[] = {
-	{ PCI_VENDOR_ID_REDCREEK, PCI_DEVICE_ID_RC45, PCI_ANY_ID, PCI_ANY_ID,},
-	{}
-};
-MODULE_DEVICE_TABLE (pci, rcpci45_pci_table);
-MODULE_LICENSE("GPL");
-
-static void __devexit
-rcpci45_remove_one (struct pci_dev *pdev)
-{
-	struct net_device *dev = pci_get_drvdata (pdev);
-	PDPA pDpa = dev->priv;
-
-	RCResetIOP (dev);
-	unregister_netdev (dev);
-	free_irq (dev->irq, dev);
-	iounmap ((void *) dev->base_addr);
-	pci_release_regions (pdev);
-	pci_free_consistent (pdev, MSG_BUF_SIZE, pDpa->msgbuf,
-			     pDpa->msgbuf_dma);
-	if (pDpa->pPab)
-		kfree (pDpa->pPab);
-	free_netdev (dev);
-	pci_set_drvdata (pdev, NULL);
-}
-
-static int
-rcpci45_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
-{
-	unsigned long *vaddr;
-	PDPA pDpa;
-	int error;
-	static int card_idx = -1;
-	struct net_device *dev;
-	unsigned long pci_start, pci_len;
-
-	card_idx++;
-
-	/* 
-	 * Allocate and fill new device structure. 
-	 * We need enough for struct net_device plus DPA plus the LAN 
-	 * API private area, which requires a minimum of 16KB.  The top 
-	 * of the allocated area will be assigned to struct net_device; 
-	 * the next chunk will be assigned to DPA; and finally, the rest 
-	 * will be assigned to the LAN API layer.
-	 */
-
-	dev = alloc_etherdev(sizeof(*pDpa));
-	if (!dev) {
-		printk (KERN_ERR
-			"(rcpci45 driver:) alloc_etherdev alloc failed\n");
-		error = -ENOMEM;
-		goto err_out;
-	}
-
-	SET_MODULE_OWNER(dev);
-	SET_NETDEV_DEV(dev, &pdev->dev);
-
-	error = pci_enable_device (pdev);
-	if (error) {
-		printk (KERN_ERR
-			"(rcpci45 driver:) %d: pci enable device error\n",
-			card_idx);
-		goto err_out;
-	}
-	pci_start = pci_resource_start (pdev, 0);
-	pci_len = pci_resource_len (pdev, 0);
-	printk("pci_start %lx pci_len %lx\n", pci_start, pci_len);
-
-	pci_set_drvdata (pdev, dev);
-
-	pDpa = dev->priv;
-	pDpa->id = card_idx;
-	pDpa->pci_dev = pdev;
-	pDpa->pci_addr = pci_start;
-
-	if (!pci_start || !(pci_resource_flags (pdev, 0) & IORESOURCE_MEM)) {
-		printk (KERN_ERR
-			"(rcpci45 driver:) No PCI mem resources! Aborting\n");
-		error = -EBUSY;
-		goto err_out_free_dev;
-	}
-
-	/*
-	 * pDpa->msgbuf is where the card will dma the I2O 
-	 * messages. Thus, we need contiguous physical pages of memory.
-	 * 2003/04/20:  pci_alloc_consistent() provides well over the needed
-	 * alignment on a 256 bytes boundary for the LAN API private area.
-	 * Thus it isn't needed anymore to align it by hand.
-         */
-	pDpa->msgbuf = pci_alloc_consistent (pdev, MSG_BUF_SIZE,
-					     &pDpa->msgbuf_dma);
-	if (!pDpa->msgbuf) {
-		printk (KERN_ERR "(rcpci45 driver:) \
-			Could not allocate %d byte memory for the \
-				private msgbuf!\n", MSG_BUF_SIZE);
-		error = -ENOMEM;
-		goto err_out_free_dev;
-	}
-
-	/* The adapter is accessible through memory-access read/write, not
-	 * I/O read/write.  Thus, we need to map it to some virtual address
-	 * area in order to access the registers as normal memory.
-	 */
-	error = pci_request_regions (pdev, dev->name);
-	if (error)
-		goto err_out_free_msgbuf;
-
-	error = pci_set_dma_mask (pdev, RCPCI45_DMA_MASK);
-	if (error) {
-		printk (KERN_ERR
-			"(rcpci45 driver:) pci_set_dma_mask failed!\n");
-		goto err_out_free_region;
-	}
-
-	vaddr = (ulong *) ioremap (pci_start, pci_len);
-	if (!vaddr) {
-		printk (KERN_ERR
-			"(rcpci45 driver:) \
-			Unable to remap address range from %lu to %lu\n",
-			pci_start, pci_start + pci_len);
-		error = -EIO;
-		goto err_out_free_region;
-	}
-
-	dev->base_addr = (unsigned long) vaddr;
-	dev->irq = pdev->irq;
-	dev->open = &RCopen;
-	dev->hard_start_xmit = &RC_xmit_packet;
-	dev->stop = &RCclose;
-	dev->get_stats = &RCget_stats;
-	dev->do_ioctl = &RCioctl;
-	dev->set_config = &RCconfig;
-
-	if ((error = register_netdev(dev)))
-		goto err_out_iounmap;
-
-	return 0;		/* success */
-
-err_out_iounmap:
-	iounmap((void *) dev->base_addr);
-err_out_free_region:
-	pci_release_regions (pdev);
-err_out_free_msgbuf:
-	pci_free_consistent (pdev, MSG_BUF_SIZE, pDpa->msgbuf,
-			     pDpa->msgbuf_dma);
-err_out_free_dev:
-	free_netdev (dev);
-err_out:
-	card_idx--;
-	return error;
-}
-
-static struct pci_driver rcpci45_driver = {
-	.name		= "rcpci45",
-	.id_table	= rcpci45_pci_table,
-	.probe		= rcpci45_init_one,
-	.remove		= __devexit_p(rcpci45_remove_one),
-};
-
-static int __init
-rcpci_init_module (void)
-{
-	int rc = pci_module_init (&rcpci45_driver);
-	if (!rc)
-		printk (KERN_ERR "%s", version);
-	return rc;
-}
-
-static int
-RCopen (struct net_device *dev)
-{
-	int post_buffers = MAX_NMBR_RCV_BUFFERS;
-	PDPA pDpa = dev->priv;
-	int count = 0;
-	int requested = 0;
-	int error;
-
-	if (pDpa->nexus) {
-		/* This is not the first time RCopen is called.  Thus,
-		 * the interface was previously opened and later closed
-		 * by RCclose().  RCclose() does a Shutdown; to wake up
-		 * the adapter, a reset is mandatory before we can post
-		 * receive buffers.  However, if the adapter initiated 
-		 * a reboot while the interface was closed -- and interrupts
-		 * were turned off -- we need will need to reinitialize
-		 * the adapter, rather than simply waking it up.  
-		 */
-		printk (KERN_INFO "Waking up adapter...\n");
-		RCResetLANCard (dev, 0, 0, 0);
-	} else {
-		pDpa->nexus = 1;
-		/* 
-		 * RCInitI2OMsgLayer is done only once, unless the
-		 * adapter was sent a warm reboot
-		 */
-		error = RCInitI2OMsgLayer (dev, (PFNTXCALLBACK) RCxmit_callback,
-					   (PFNRXCALLBACK) RCrecv_callback,
-					   (PFNCALLBACK) RCreboot_callback);
-		if (error) {
-			printk (KERN_ERR "%s: Unable to init msg layer (%x)\n",
-					dev->name, error);
-			goto err_out;
-		}
-		if ((error = RCGetMAC (dev, NULL))) {
-			printk (KERN_ERR "%s: Unable to get adapter MAC\n",
-					dev->name);
-			goto err_out;
-		}
-	}
-
-	/* Request a shared interrupt line. */
-	error = request_irq (dev->irq, RCinterrupt, SA_SHIRQ, dev->name, dev);
-	if (error) {
-		printk (KERN_ERR "%s: unable to get IRQ %d\n", 
-				dev->name, dev->irq);
-		goto err_out;
-	}
-
-	DriverControlWord |= WARM_REBOOT_CAPABLE;
-	RCReportDriverCapability (dev, DriverControlWord);
-
-	printk (KERN_INFO "%s: RedCreek Communications IPSEC VPN adapter\n",
-		dev->name);
-
-	RCEnableI2OInterrupts (dev);
-
-	while (post_buffers) {
-		if (post_buffers > MAX_NMBR_POST_BUFFERS_PER_MSG)
-			requested = MAX_NMBR_POST_BUFFERS_PER_MSG;
-		else
-			requested = post_buffers;
-		count = RC_allocate_and_post_buffers (dev, requested);
-
-		if (count < requested) {
-			/*
-			 * Check to see if we were able to post 
-			 * any buffers at all.
-			 */
-			if (post_buffers == MAX_NMBR_RCV_BUFFERS) {
-				printk (KERN_ERR "%s: \
-					unable to allocate any buffers\n", 
-						dev->name);
-				goto err_out_free_irq;
-			}
-			printk (KERN_WARNING "%s: \
-			unable to allocate all requested buffers\n", dev->name);
-			break;	/* we'll try to post more buffers later */
-		} else
-			post_buffers -= count;
-	}
-	pDpa->numOutRcvBuffers = MAX_NMBR_RCV_BUFFERS - post_buffers;
-	pDpa->shutdown = 0;	/* just in case */
-	netif_start_queue (dev);
-	return 0;
-
-err_out_free_irq:
-	free_irq (dev->irq, dev);
-err_out:
-	return error;
-}
-
-static int
-RC_xmit_packet (struct sk_buff *skb, struct net_device *dev)
-{
-
-	PDPA pDpa = dev->priv;
-	singleTCB tcb;
-	psingleTCB ptcb = &tcb;
-	RC_RETURN status = 0;
-
-	netif_stop_queue (dev);
-
-	if (pDpa->shutdown || pDpa->reboot) {
-		printk ("RC_xmit_packet: tbusy!\n");
-		return 1;
-	}
-
-	/*
-	 * The user is free to reuse the TCB after RCI2OSendPacket() 
-	 * returns, since the function copies the necessary info into its 
-	 * own private space.  Thus, our TCB can be a local structure.  
-	 * The skb, on the other hand, will be freed up in our interrupt 
-	 * handler.
-	 */
-
-	ptcb->bcount = 1;
-
-	/* 
-	 * we'll get the context when the adapter interrupts us to tell us that
-	 * the transmission is done. At that time, we can free skb.
-	 */
-	ptcb->b.context = (U32) skb;
-	ptcb->b.scount = 1;
-	ptcb->b.size = skb->len;
-	ptcb->b.addr = pci_map_single(pDpa->pci_dev, skb->data, skb->len,
-				      PCI_DMA_TODEVICE);
-
-	if ((status = RCI2OSendPacket (dev, (U32) NULL, (PRCTCB) ptcb))
-	    != RC_RTN_NO_ERROR) {
-		printk ("%s: send error 0x%x\n", dev->name, (uint) status);
-		return 1;
-	} else {
-		dev->trans_start = jiffies;
-		netif_wake_queue (dev);
-	}
-	/*
-	 * That's it!
-	 */
-	return 0;
-}
-
-/*
- * RCxmit_callback()
- *
- * The transmit callback routine. It's called by RCProcI2OMsgQ()
- * because the adapter is done with one or more transmit buffers and
- * it's returning them to us, or we asked the adapter to return the
- * outstanding transmit buffers by calling RCResetLANCard() with 
- * RC_RESOURCE_RETURN_PEND_TX_BUFFERS flag. 
- * All we need to do is free the buffers.
- */
-static void
-RCxmit_callback (U32 Status,
-		 U16 PcktCount, PU32 BufferContext, struct net_device *dev)
-{
-	struct sk_buff *skb;
-	PDPA pDpa = dev->priv;
-
-	if (!pDpa) {
-		printk (KERN_ERR "%s: Fatal Error in xmit callback, !pDpa\n",
-				dev->name);
-		return;
-	}
-
-	if (Status != I2O_REPLY_STATUS_SUCCESS)
-		printk (KERN_INFO "%s: xmit_callback: Status = 0x%x\n", 
-				dev->name, (uint) Status);
-	if (pDpa->shutdown || pDpa->reboot)
-		printk (KERN_INFO "%s: xmit callback: shutdown||reboot\n",
-				dev->name);
-
-	while (PcktCount--) {
-		skb = (struct sk_buff *) (BufferContext[0]);
-		BufferContext++;
-		pci_unmap_single(pDpa->pci_dev, BufferContext[1], skb->len,
-				 PCI_DMA_TODEVICE);
-		dev_kfree_skb_irq (skb);
-	}
-	netif_wake_queue (dev);
-}
-
-static void
-RCreset_callback (U32 Status, U32 p1, U32 p2, struct net_device *dev)
-{
-	PDPA pDpa = dev->priv;
-
-	printk ("RCreset_callback Status 0x%x\n", (uint) Status);
-	/*
-	 * Check to see why we were called.
-	 */
-	if (pDpa->shutdown) {
-		printk (KERN_INFO "%s: shutting down interface\n",
-				dev->name);
-		pDpa->shutdown = 0;
-		pDpa->reboot = 0;
-	} else if (pDpa->reboot) {
-		printk (KERN_INFO "%s: reboot, shutdown adapter\n",
-				dev->name);
-		/*
-		 * We don't set any of the flags in RCShutdownLANCard()
-		 * and we don't pass a callback routine to it.
-		 * The adapter will have already initiated the reboot by
-		 * the time the function returns.
-		 */
-		RCDisableI2OInterrupts (dev);
-		RCShutdownLANCard (dev, 0, 0, 0);
-		printk (KERN_INFO "%s: scheduling timer...\n", dev->name);
-		init_timer (&pDpa->timer);
-		pDpa->timer.expires = RUN_AT ((40 * HZ) / 10);	/* 4 sec. */
-		pDpa->timer.data = (unsigned long) dev;
-		pDpa->timer.function = &rc_timer;	/* timer handler */
-		add_timer (&pDpa->timer);
-	}
-}
-
-static void
-RCreboot_callback (U32 Status, U32 p1, U32 p2, struct net_device *dev)
-{
-	PDPA pDpa = dev->priv;
-
-	printk (KERN_INFO "%s: reboot: rcv buffers outstanding = %d\n",
-		 dev->name, (uint) pDpa->numOutRcvBuffers);
-
-	if (pDpa->shutdown) {
-		printk (KERN_INFO "%s: skip reboot, shutdown initiated\n",
-				dev->name);
-		return;
-	}
-	pDpa->reboot = 1;
-	/*
-	 * OK, we reset the adapter and ask it to return all
-	 * outstanding transmit buffers as well as the posted
-	 * receive buffers.  When the adapter is done returning
-	 * those buffers, it will call our RCreset_callback() 
-	 * routine.  In that routine, we'll call RCShutdownLANCard()
-	 * to tell the adapter that it's OK to start the reboot and
-	 * schedule a timer callback routine to execute 3 seconds 
-	 * later; this routine will reinitialize the adapter at that time.
-	 */
-	RCResetLANCard (dev, RC_RESOURCE_RETURN_POSTED_RX_BUCKETS |
-			RC_RESOURCE_RETURN_PEND_TX_BUFFERS, 0,
-			(PFNCALLBACK) RCreset_callback);
-}
-
-/*
- * RCrecv_callback()
- * 
- * The receive packet callback routine.  This is called by
- * RCProcI2OMsgQ() after the adapter posts buffers which have been
- * filled (one ethernet packet per buffer).
- */
-static void
-RCrecv_callback (U32 Status,
-		 U8 PktCount,
-		 U32 BucketsRemain,
-		 PU32 PacketDescBlock, struct net_device *dev)
-{
-
-	U32 len, count;
-	PDPA pDpa = dev->priv;
-	struct sk_buff *skb;
-	singleTCB tcb;
-	psingleTCB ptcb = &tcb;
-
-	ptcb->bcount = 1;
-
-	if ((pDpa->shutdown || pDpa->reboot) && !Status)
-		printk (KERN_INFO "%s: shutdown||reboot && !Status (%d)\n",
-				dev->name, PktCount);
-
-	if ((Status != I2O_REPLY_STATUS_SUCCESS) || pDpa->shutdown) {
-		/*
-		 * Free whatever buffers the adapter returned, but don't
-		 * pass them to the kernel.
-		 */
-
-		if (!pDpa->shutdown && !pDpa->reboot)
-			printk (KERN_INFO "%s: recv error status = 0x%x\n",
-					dev->name, (uint) Status);
-		else
-			printk (KERN_DEBUG "%s: Returning %d buffs stat 0x%x\n",
-					dev->name, PktCount, (uint) Status);
-		/*
-		 * TO DO: check the nature of the failure and put the 
-		 * adapter in failed mode if it's a hard failure.  
-		 * Send a reset to the adapter and free all outstanding memory.
-		 */
-		if (PacketDescBlock) {
-			while (PktCount--) {
-				skb = (struct sk_buff *) PacketDescBlock[0];
-				dev_kfree_skb (skb);
-				pDpa->numOutRcvBuffers--;
-				/* point to next context field */
-				PacketDescBlock += BD_SIZE;
-			}
-		}
-		return;
-	} else {
-		while (PktCount--) {
-			skb = (struct sk_buff *) PacketDescBlock[0];
-			len = PacketDescBlock[2];
-			skb->dev = dev;
-			skb_put (skb, len);	/* adjust length and tail */
-			skb->protocol = eth_type_trans (skb, dev);
-			netif_rx (skb);	/* send the packet to the kernel */
-			dev->last_rx = jiffies;
-			pDpa->numOutRcvBuffers--;	
-			/* point to next context field */
-			PacketDescBlock += BD_SIZE;
-		}
-	}
-
-	/*
-	 * Replenish the posted receive buffers. 
-	 * DO NOT replenish buffers if the driver has already
-	 * initiated a reboot or shutdown!
-	 */
-
-	if (!pDpa->shutdown && !pDpa->reboot) {
-		count = RC_allocate_and_post_buffers (dev,
-						      MAX_NMBR_RCV_BUFFERS -
-						      pDpa->numOutRcvBuffers);
-		pDpa->numOutRcvBuffers += count;
-	}
-
-}
-
-/*
- * RCinterrupt()
- * 
- * Interrupt handler. 
- * This routine sets up a couple of pointers and calls
- * RCProcI2OMsgQ(), which in turn process the message and
- * calls one of our callback functions.
- */
-static irqreturn_t
-RCinterrupt (int irq, void *dev_id, struct pt_regs *regs)
-{
-
-	PDPA pDpa;
-	struct net_device *dev = dev_id;
-
-	pDpa = dev->priv;
-
-	if (pDpa->shutdown)
-		printk (KERN_DEBUG "%s: shutdown, service irq\n",
-				dev->name);
-
-	return RCProcI2OMsgQ (dev);
-}
-
-#define REBOOT_REINIT_RETRY_LIMIT 4
-static void
-rc_timer (unsigned long data)
-{
-	struct net_device *dev = (struct net_device *) data;
-	PDPA pDpa = dev->priv;
-	int init_status;
-	static int retry;
-	int post_buffers = MAX_NMBR_RCV_BUFFERS;
-	int count = 0;
-	int requested = 0;
-
-	if (pDpa->reboot) {
-		init_status =
-		    RCInitI2OMsgLayer (dev, (PFNTXCALLBACK) RCxmit_callback,
-				       (PFNRXCALLBACK) RCrecv_callback,
-				       (PFNCALLBACK) RCreboot_callback);
-
-		switch (init_status) {
-		case RC_RTN_NO_ERROR:
-
-			pDpa->reboot = 0;
-			pDpa->shutdown = 0;	/* just in case */
-			RCReportDriverCapability (dev, DriverControlWord);
-			RCEnableI2OInterrupts (dev);
-
-
-			if (!(dev->flags & IFF_UP)) {
-				retry = 0;
-				return;
-			}
-			while (post_buffers) {
-				if (post_buffers > 
-						MAX_NMBR_POST_BUFFERS_PER_MSG)
-					requested = 
-						MAX_NMBR_POST_BUFFERS_PER_MSG;
-				else
-					requested = post_buffers;
-				count =
-				    RC_allocate_and_post_buffers (dev,
-								  requested);
-				post_buffers -= count;
-				if (count < requested)
-					break;
-			}
-			pDpa->numOutRcvBuffers =
-			    MAX_NMBR_RCV_BUFFERS - post_buffers;
-			printk ("Initialization done.\n");
-			netif_wake_queue (dev);
-			retry = 0;
-			return;
-		case RC_RTN_FREE_Q_EMPTY:
-			retry++;
-			printk (KERN_WARNING "%s inbound free q empty\n",
-					dev->name);
-			break;
-		default:
-			retry++;
-			printk (KERN_WARNING "%s bad stat after reboot: %d\n",
-					dev->name, init_status);
-			break;
-		}
-
-		if (retry > REBOOT_REINIT_RETRY_LIMIT) {
-			printk (KERN_WARNING "%s unable to reinitialize adapter after reboot\n", dev->name);
-			printk (KERN_WARNING "%s shutting down interface\n", dev->name);
-			RCDisableI2OInterrupts (dev);
-			dev->flags &= ~IFF_UP;
-		} else {
-			printk (KERN_INFO "%s: rescheduling timer...\n",
-					dev->name);
-			init_timer (&pDpa->timer);
-			pDpa->timer.expires = RUN_AT ((40 * HZ) / 10);
-			pDpa->timer.data = (unsigned long) dev;
-			pDpa->timer.function = &rc_timer;
-			add_timer (&pDpa->timer);
-		}
-	} else
-		printk (KERN_WARNING "%s: unexpected timer irq\n", dev->name);
-}
-
-static int
-RCclose (struct net_device *dev)
-{
-	PDPA pDpa = dev->priv;
-
-	printk("RCclose\n");
-	netif_stop_queue (dev);
-
-	if (pDpa->reboot) {
-		printk (KERN_INFO "%s skipping reset -- adapter already in reboot mode\n", dev->name);
-		dev->flags &= ~IFF_UP;
-		pDpa->shutdown = 1;
-		return 0;
-	}
-
-	pDpa->shutdown = 1;
-
-	/*
-	 * We can't allow the driver to be unloaded until the adapter returns
-	 * all posted receive buffers.  It doesn't hurt to tell the adapter
-	 * to return all posted receive buffers and outstanding xmit buffers,
-	 * even if there are none.
-	 */
-
-	RCShutdownLANCard (dev, RC_RESOURCE_RETURN_POSTED_RX_BUCKETS |
-			   RC_RESOURCE_RETURN_PEND_TX_BUFFERS, 0,
-			   (PFNCALLBACK) RCreset_callback);
-
-	dev->flags &= ~IFF_UP;
-	return 0;
-}
-
-static struct net_device_stats *
-RCget_stats (struct net_device *dev)
-{
-	RCLINKSTATS RCstats;
-
-	PDPA pDpa = dev->priv;
-
-	if (!pDpa) {
-		return 0;
-	} else if (!(dev->flags & IFF_UP)) {
-		return 0;
-	}
-
-	memset (&RCstats, 0, sizeof (RCLINKSTATS));
-	if ((RCGetLinkStatistics (dev, &RCstats, (void *) 0)) ==
-	    RC_RTN_NO_ERROR) {
-
-		/* total packets received    */
-		pDpa->stats.rx_packets = RCstats.Rcv_good
-		/* total packets transmitted    */;
-		pDpa->stats.tx_packets = RCstats.TX_good;
-
-		pDpa->stats.rx_errors = RCstats.Rcv_CRCerr + 
-			RCstats.Rcv_alignerr + RCstats.Rcv_reserr + 
-			RCstats.Rcv_orun + RCstats.Rcv_cdt + RCstats.Rcv_runt;
-
-		pDpa->stats.tx_errors = RCstats.TX_urun + RCstats.TX_crs + 
-			RCstats.TX_def + RCstats.TX_totcol;
-
-		/*
-		 * This needs improvement.
-		 */
-		pDpa->stats.rx_dropped = 0; /* no space in linux buffers   */
-		pDpa->stats.tx_dropped = 0; /* no space available in linux */
-		pDpa->stats.multicast = 0;  /* multicast packets received  */
-		pDpa->stats.collisions = RCstats.TX_totcol;
-
-		/* detailed rx_errors: */
-		pDpa->stats.rx_length_errors = 0;
-		pDpa->stats.rx_over_errors = RCstats.Rcv_orun;
-		pDpa->stats.rx_crc_errors = RCstats.Rcv_CRCerr;
-		pDpa->stats.rx_frame_errors = 0;
-		pDpa->stats.rx_fifo_errors = 0;	
-		pDpa->stats.rx_missed_errors = 0;
-
-		/* detailed tx_errors */
-		pDpa->stats.tx_aborted_errors = 0;
-		pDpa->stats.tx_carrier_errors = 0;
-		pDpa->stats.tx_fifo_errors = 0;
-		pDpa->stats.tx_heartbeat_errors = 0;
-		pDpa->stats.tx_window_errors = 0;
-
-		return ((struct net_device_stats *) &(pDpa->stats));
-	}
-	return 0;
-}
-
-static int
-RCioctl (struct net_device *dev, struct ifreq *rq, int cmd)
-{
-	RCuser_struct RCuser;
-	PDPA pDpa = dev->priv;
-
-	if (!capable (CAP_NET_ADMIN))
-		return -EPERM;
-
-	switch (cmd) {
-
-	case RCU_PROTOCOL_REV:
-		/*
-		 * Assign user protocol revision, to tell user-level
-		 * controller program whether or not it's in sync.
-		 */
-		rq->ifr_ifru.ifru_data = (caddr_t) USER_PROTOCOL_REV;
-		break;
-
-	case RCU_COMMAND:
-		{
-			if (copy_from_user
-			    (&RCuser, rq->ifr_data, sizeof (RCuser)))
-				return -EFAULT;
-
-			dprintk ("RCioctl: RCuser_cmd = 0x%x\n", RCuser.cmd);
-
-			switch (RCuser.cmd) {
-			case RCUC_GETFWVER:
-				RCUD_GETFWVER = &RCuser.RCUS_GETFWVER;
-				RCGetFirmwareVer (dev,
-						  (PU8) & RCUD_GETFWVER->
-						  FirmString, NULL);
-				break;
-			case RCUC_GETINFO:
-				RCUD_GETINFO = &RCuser.RCUS_GETINFO;
-				RCUD_GETINFO->mem_start = dev->base_addr;
-				RCUD_GETINFO->mem_end =
-				    dev->base_addr + pDpa->pci_addr_len;
-				RCUD_GETINFO->base_addr = pDpa->pci_addr;
-				RCUD_GETINFO->irq = dev->irq;
-				break;
-			case RCUC_GETIPANDMASK:
-				RCUD_GETIPANDMASK = &RCuser.RCUS_GETIPANDMASK;
-				RCGetRavlinIPandMask (dev,
-						      (PU32) &
-						      RCUD_GETIPANDMASK->IpAddr,
-						      (PU32) &
-						      RCUD_GETIPANDMASK->
-						      NetMask, NULL);
-				break;
-			case RCUC_GETLINKSTATISTICS:
-				RCUD_GETLINKSTATISTICS =
-				    &RCuser.RCUS_GETLINKSTATISTICS;
-				RCGetLinkStatistics (dev,
-						     (P_RCLINKSTATS) &
-						     RCUD_GETLINKSTATISTICS->
-						     StatsReturn, NULL);
-				break;
-			case RCUC_GETLINKSTATUS:
-				RCUD_GETLINKSTATUS = &RCuser.RCUS_GETLINKSTATUS;
-				RCGetLinkStatus (dev,
-						 (PU32) & RCUD_GETLINKSTATUS->
-						 ReturnStatus, NULL);
-				break;
-			case RCUC_GETMAC:
-				RCUD_GETMAC = &RCuser.RCUS_GETMAC;
-				RCGetMAC (dev, NULL);
-				memcpy(RCUD_GETMAC, dev->dev_addr, 8);
-				break;
-			case RCUC_GETPROM:
-				RCUD_GETPROM = &RCuser.RCUS_GETPROM;
-				RCGetPromiscuousMode (dev,
-						      (PU32) & RCUD_GETPROM->
-						      PromMode, NULL);
-				break;
-			case RCUC_GETBROADCAST:
-				RCUD_GETBROADCAST = &RCuser.RCUS_GETBROADCAST;
-				RCGetBroadcastMode (dev,
-						    (PU32) & RCUD_GETBROADCAST->
-						    BroadcastMode, NULL);
-				break;
-			case RCUC_GETSPEED:
-				if (!(dev->flags & IFF_UP)) {
-					return -ENODATA;
-				}
-				RCUD_GETSPEED = &RCuser.RCUS_GETSPEED;
-				RCGetLinkSpeed (dev,
-						(PU32) & RCUD_GETSPEED->
-						LinkSpeedCode, NULL);
-				break;
-			case RCUC_SETIPANDMASK:
-				RCUD_SETIPANDMASK = &RCuser.RCUS_SETIPANDMASK;
-				RCSetRavlinIPandMask (dev,
-						      (U32) RCUD_SETIPANDMASK->
-						      IpAddr,
-						      (U32) RCUD_SETIPANDMASK->
-						      NetMask);
-				break;
-			case RCUC_SETMAC:
-				RCSetMAC (dev, (PU8) & RCUD_SETMAC->mac);
-				break;
-			case RCUC_SETSPEED:
-				RCUD_SETSPEED = &RCuser.RCUS_SETSPEED;
-				RCSetLinkSpeed (dev,
-						(U16) RCUD_SETSPEED->
-						LinkSpeedCode);
-				break;
-			case RCUC_SETPROM:
-				RCUD_SETPROM = &RCuser.RCUS_SETPROM;
-				RCSetPromiscuousMode (dev,
-						      (U16) RCUD_SETPROM->
-						      PromMode);
-				break;
-			case RCUC_SETBROADCAST:
-				RCUD_SETBROADCAST = &RCuser.RCUS_SETBROADCAST;
-				RCSetBroadcastMode (dev,
-						    (U16) RCUD_SETBROADCAST->
-						    BroadcastMode);
-				break;
-			default:
-				RCUD_DEFAULT = &RCuser.RCUS_DEFAULT;
-				RCUD_DEFAULT->rc = 0x11223344;
-				break;
-			}
-			if (copy_to_user (rq->ifr_data, &RCuser, 
-						sizeof (RCuser)))
-				return -EFAULT;
-			break;
-		}		/* RCU_COMMAND */
-
-	default:
-		rq->ifr_ifru.ifru_data = (caddr_t) 0x12345678;
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static int
-RCconfig (struct net_device *dev, struct ifmap *map)
-{
-	/*
-	 * To be completed ...
-	 */
-	return 0;
-	if (dev->flags & IFF_UP)	/* can't act on a running interface */
-		return -EBUSY;
-
-	/* Don't allow changing the I/O address */
-	if (map->base_addr != dev->base_addr) {
-		printk (KERN_WARNING "%s Change I/O address not implemented\n",
-				dev->name);
-		return -EOPNOTSUPP;
-	}
-	return 0;
-}
-
-static void __exit
-rcpci_cleanup_module (void)
-{
-	pci_unregister_driver (&rcpci45_driver);
-}
-
-module_init (rcpci_init_module);
-module_exit (rcpci_cleanup_module);
-
-static int
-RC_allocate_and_post_buffers (struct net_device *dev, int numBuffers)
-{
-
-	int i;
-	PU32 p;
-	psingleB pB;
-	struct sk_buff *skb;
-	PDPA pDpa = dev->priv;
-	RC_RETURN status;
-	U32 res = 0;
-
-	if (!numBuffers)
-		return 0;
-	else if (numBuffers > MAX_NMBR_POST_BUFFERS_PER_MSG) {
-		printk (KERN_ERR "%s: Too many buffers requested!\n",
-				dev->name);
-		numBuffers = 32;
-	}
-
-	p = (PU32) kmalloc (sizeof (U32) + numBuffers * sizeof (singleB),
-			    GFP_DMA | GFP_ATOMIC);
-
-	if (!p) {
-		printk (KERN_WARNING "%s unable to allocate TCB\n",
-				dev->name);
-		goto out;
-	}
-
-	p[0] = 0;		/* Buffer Count */
-	pB = (psingleB) ((U32) p + sizeof (U32));/* point to the first buffer */
-
-	for (i = 0; i < numBuffers; i++) {
-		skb = dev_alloc_skb (MAX_ETHER_SIZE + 2);
-		if (!skb) {
-			printk (KERN_WARNING 
-					"%s: unable to allocate enough skbs!\n",
-					dev->name);
-			goto err_out_unmap;
-		}
-		skb_reserve (skb, 2);	/* Align IP on 16 byte boundaries */
-		pB->context = (U32) skb;
-		pB->scount = 1;	/* segment count */
-		pB->size = MAX_ETHER_SIZE;
-		pB->addr = pci_map_single(pDpa->pci_dev, skb->data, 
-					  MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE);
-		p[0]++;
-		pB++;
-	}
-
-	if ((status = RCPostRecvBuffers (dev, (PRCTCB) p)) != RC_RTN_NO_ERROR) {
-		printk (KERN_WARNING "%s: Post buffer failed, error 0x%x\n",
-				dev->name, status);
-		goto err_out_unmap;
-	}
-out_free:
-	res = p[0];
-	kfree (p);
-out:
-	return (res);		/* return the number of posted buffers */
-
-err_out_unmap:
-	for (; p[0] > 0; p[0]--) {
-		--pB;
-		skb = (struct sk_buff *) pB->context;
-		pci_unmap_single(pDpa->pci_dev, pB->addr, MAX_ETHER_SIZE,
-				 PCI_DMA_FROMDEVICE);
-		dev_kfree_skb (skb);
-	}
-	goto out_free;
-}
diff -Nru a/drivers/net/rrunner.c b/drivers/net/rrunner.c
--- a/drivers/net/rrunner.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/rrunner.c	Tue Jun 15 22:20:38 2004
@@ -1715,7 +1715,7 @@
 		return error;
 		
 	case SIOCRRID:
-		return put_user(0x52523032, (int *)(&rq->ifr_data[0]));
+		return put_user(0x52523032, (int __user *)rq->ifr_data);
 	default:
 		return error;
 	}
diff -Nru a/drivers/net/s2io.c b/drivers/net/s2io.c
--- a/drivers/net/s2io.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/s2io.c	Tue Jun 15 22:20:42 2004
@@ -99,45 +99,45 @@
 };
 
 static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
-	{"tmac_frms"},
-	{"tmac_data_octets"},
-	{"tmac_drop_frms"},
-	{"tmac_mcst_frms"},
-	{"tmac_bcst_frms"},
-	{"tmac_pause_ctrl_frms"},
-	{"tmac_any_err_frms"},
-	{"tmac_vld_ip_octets"},
-	{"tmac_vld_ip"},
-	{"tmac_drop_ip"},
-	{"tmac_icmp"},
-	{"tmac_rst_tcp"},
-	{"tmac_tcp"},
-	{"tmac_udp"},
-	{"rmac_vld_frms"},
-	{"rmac_data_octets"},
-	{"rmac_fcs_err_frms"},
-	{"rmac_drop_frms"},
-	{"rmac_vld_mcst_frms"},
-	{"rmac_vld_bcst_frms"},
-	{"rmac_in_rng_len_err_frms"},
-	{"rmac_long_frms"},
-	{"rmac_pause_ctrl_frms"},
-	{"rmac_discarded_frms"},
-	{"rmac_usized_frms"},
-	{"rmac_osized_frms"},
-	{"rmac_frag_frms"},
-	{"rmac_jabber_frms"},
-	{"rmac_ip"},
-	{"rmac_ip_octets"},
-	{"rmac_hdr_err_ip"},
-	{"rmac_drop_ip"},
-	{"rmac_icmp"},
-	{"rmac_tcp"},
-	{"rmac_udp"},
-	{"rmac_err_drp_udp"},
-	{"rmac_pause_cnt"},
-	{"rmac_accepted_ip"},
-	{"rmac_err_tcp"},
+	"tmac_frms",
+	"tmac_data_octets",
+	"tmac_drop_frms",
+	"tmac_mcst_frms",
+	"tmac_bcst_frms",
+	"tmac_pause_ctrl_frms",
+	"tmac_any_err_frms",
+	"tmac_vld_ip_octets",
+	"tmac_vld_ip",
+	"tmac_drop_ip",
+	"tmac_icmp",
+	"tmac_rst_tcp",
+	"tmac_tcp",
+	"tmac_udp",
+	"rmac_vld_frms",
+	"rmac_data_octets",
+	"rmac_fcs_err_frms",
+	"rmac_drop_frms",
+	"rmac_vld_mcst_frms",
+	"rmac_vld_bcst_frms",
+	"rmac_in_rng_len_err_frms",
+	"rmac_long_frms",
+	"rmac_pause_ctrl_frms",
+	"rmac_discarded_frms",
+	"rmac_usized_frms",
+	"rmac_osized_frms",
+	"rmac_frag_frms",
+	"rmac_jabber_frms",
+	"rmac_ip",
+	"rmac_ip_octets",
+	"rmac_hdr_err_ip",
+	"rmac_drop_ip",
+	"rmac_icmp",
+	"rmac_tcp",
+	"rmac_udp",
+	"rmac_err_drp_udp",
+	"rmac_pause_cnt",
+	"rmac_accepted_ip",
+	"rmac_err_tcp",
 };
 
 #define S2IO_STAT_LEN sizeof(ethtool_stats_keys)/ ETH_GSTRING_LEN
@@ -238,7 +238,7 @@
       name:"S2IO",
       id_table:s2io_tbl,
       probe:s2io_init_nic,
-      remove:s2io_rem_nic,
+      remove:__devexit_p(s2io_rem_nic),
 };
 
 /*  
@@ -2339,9 +2339,6 @@
 	struct net_device *dev = (struct net_device *) dev_id;
 	nic_t *sp = dev->priv;
 	XENA_dev_config_t *bar0 = (XENA_dev_config_t *) sp->bar0;
-#ifndef CONFIG_S2IO_NAPI
-	int i, ret;
-#endif
 	u64 reason = 0, general_mask = 0;
 	mac_info_t *mac_control;
 	struct config_param *config;
@@ -4358,7 +4355,7 @@
 *  and free up all resource held up by the device. This could be in response 
 *  to a Hot plug event or when the driver is to be removed from memory.
 */
-static void __exit s2io_rem_nic(struct pci_dev *pdev)
+static void __devexit s2io_rem_nic(struct pci_dev *pdev)
 {
 	struct net_device *dev =
 	    (struct net_device *) pci_get_drvdata(pdev);
diff -Nru a/drivers/net/s2io.h b/drivers/net/s2io.h
--- a/drivers/net/s2io.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/s2io.h	Tue Jun 15 22:20:38 2004
@@ -825,7 +825,7 @@
  */
 static int __devinit s2io_init_nic(struct pci_dev *pdev,
 				   const struct pci_device_id *pre);
-static void __exit s2io_rem_nic(struct pci_dev *pdev);
+static void __devexit s2io_rem_nic(struct pci_dev *pdev);
 static int initSharedMem(struct s2io_nic *sp);
 static void freeSharedMem(struct s2io_nic *sp);
 static int initNic(struct s2io_nic *nic);
diff -Nru a/drivers/net/sb1000.c b/drivers/net/sb1000.c
--- a/drivers/net/sb1000.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/sb1000.c	Tue Jun 15 22:20:36 2004
@@ -49,6 +49,7 @@
 #include <linux/delay.h>	/* for udelay() */
 #include <linux/etherdevice.h>
 #include <linux/pnp.h>
+#include <linux/init.h>
 
 #include <asm/bitops.h>
 #include <asm/io.h>
@@ -1030,14 +1031,14 @@
 	case SIOCGCMFREQUENCY:		/* get frequency */
 		if ((status = sb1000_get_frequency(ioaddr, name, &frequency)))
 			return status;
-		if(put_user(frequency, (int*) ifr->ifr_data))
+		if(put_user(frequency, (int __user *) ifr->ifr_data))
 			return -EFAULT;
 		break;
 
 	case SIOCSCMFREQUENCY:		/* set frequency */
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
-		if(get_user(frequency, (int*) ifr->ifr_data))
+		if(get_user(frequency, (int __user *) ifr->ifr_data))
 			return -EFAULT;
 		if ((status = sb1000_set_frequency(ioaddr, name, frequency)))
 			return status;
diff -Nru a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
--- a/drivers/net/sb1250-mac.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/net/sb1250-mac.c	Tue Jun 15 22:21:02 2004
@@ -2721,7 +2721,7 @@
 static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct sbmac_softc *sc = netdev_priv(dev);
-	u16 *data = (u16 *)&rq->ifr_data;
+	u16 *data = (u16 *)&rq->ifr_ifru;
 	unsigned long flags;
 	int retval;
 	
diff -Nru a/drivers/net/shaper.c b/drivers/net/shaper.c
--- a/drivers/net/shaper.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/net/shaper.c	Tue Jun 15 22:20:43 2004
@@ -579,7 +579,7 @@
 
 static int shaper_ioctl(struct net_device *dev,  struct ifreq *ifr, int cmd)
 {
-	struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_data;
+	struct shaperconf *ss= (struct shaperconf *)&ifr->ifr_ifru;
 	struct shaper *sh=dev->priv;
 	
 	if(ss->ss_cmd == SHAPER_SET_DEV || ss->ss_cmd == SHAPER_SET_SPEED)
diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
--- a/drivers/net/sis900.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/sis900.c	Tue Jun 15 22:20:39 2004
@@ -260,9 +260,13 @@
 	u8 reg;
 	int i;
 
-	if ((isa_bridge = pci_find_device(0x1039, 0x0008, isa_bridge)) == NULL) {
-		printk("%s: Can not find ISA bridge\n", net_dev->name);
-		return 0;
+	isa_bridge = pci_find_device(PCI_VENDOR_ID_SI, 0x0008, isa_bridge);
+	if (!isa_bridge) {
+		isa_bridge = pci_find_device(PCI_VENDOR_ID_SI, 0x0018, isa_bridge);
+		if (!isa_bridge) {
+			printk("%s: Can not find ISA bridge\n", net_dev->name);
+			return 0;
+		}
 	}
 	pci_read_config_byte(isa_bridge, 0x48, &reg);
 	pci_write_config_byte(isa_bridge, 0x48, reg | 0x40);
@@ -1889,7 +1893,7 @@
 static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
 {
 	struct sis900_private *sis_priv = net_dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 
 	switch(cmd) {
 	case SIOCGMIIPHY:		/* Get address of MII PHY in use. */
@@ -2195,6 +2199,7 @@
 		return 0;
 
 	netif_stop_queue(net_dev);
+	netif_device_detach(net_dev);
 
 	/* Stop the chip's Tx and Rx Status Machine */
 	outl(RxDIS | TxDIS | inl(ioaddr + cr), ioaddr + cr);
diff -Nru a/drivers/net/sis900.h b/drivers/net/sis900.h
--- a/drivers/net/sis900.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/sis900.h	Tue Jun 15 22:20:37 2004
@@ -77,7 +77,7 @@
 	IE = 0x00000001
 };
 
-/* maximum dma burst fro transmission and receive*/
+/* maximum dma burst for transmission and receive */
 #define MAX_DMA_RANGE	7	/* actually 0 means MAXIMUM !! */
 #define TxMXDMA_shift   	20
 #define RxMXDMA_shift    20
@@ -86,7 +86,7 @@
 	DMA_BURST_512 = 0,	DMA_BURST_64 = 5
 };
 
-/* transmit FIFO threshholds */
+/* transmit FIFO thresholds */
 #define TX_FILL_THRESH   16	/* 1/4 FIFO size */
 #define TxFILLT_shift   	8
 #define TxDRNT_shift    	0
@@ -140,7 +140,7 @@
 	EEREQ = 0x00000400, EEDONE = 0x00000200, EEGNT = 0x00000100
 };
 
-/* Manamgement Data I/O (mdio) frame */
+/* Management Data I/O (mdio) frame */
 #define MIIread         0x6000
 #define MIIwrite        0x5002
 #define MIIpmdShift     7
diff -Nru a/drivers/net/sk98lin/skvpd.c b/drivers/net/sk98lin/skvpd.c
--- a/drivers/net/sk98lin/skvpd.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/sk98lin/skvpd.c	Tue Jun 15 22:20:41 2004
@@ -468,6 +468,17 @@
 	
 	pAC->vpd.vpd_size = vpd_size;
 
+	/* Asus K8V Se Deluxe bugfix. Correct VPD content */
+	/* MBo April 2004 */
+	if (((unsigned char)pAC->vpd.vpd_buf[0x3f] == 0x38) &&
+	    ((unsigned char)pAC->vpd.vpd_buf[0x40] == 0x3c) &&
+	    ((unsigned char)pAC->vpd.vpd_buf[0x41] == 0x45)) {
+		printk("sk98lin: Asus mainboard with buggy VPD? "
+				"Correcting data.\n");
+		pAC->vpd.vpd_buf[0x40] = 0x38;
+	}
+
+
 	/* find the end tag of the RO area */
 	if (!(r = vpd_find_para(pAC, VPD_RV, &rp))) {
 		SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL,
diff -Nru a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c
--- a/drivers/net/sk_mca.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/sk_mca.c	Tue Jun 15 22:20:42 2004
@@ -4,7 +4,8 @@
 This is an extension to the Linux operating system, and is covered by the
 same GNU General Public License that covers that work.
 
-Copyright 1999 by Alfred Arnold (alfred@ccac.rwth-aachen.de, aarnold@elsa.de)
+Copyright 1999 by Alfred Arnold (alfred@ccac.rwth-aachen.de,
+                                 alfred.arnold@lancom.de)
 
 This driver is based both on the 3C523 driver and the SK_G16 driver.
 
diff -Nru a/drivers/net/sk_mca.h b/drivers/net/sk_mca.h
--- a/drivers/net/sk_mca.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/sk_mca.h	Tue Jun 15 22:20:41 2004
@@ -100,7 +100,7 @@
 #define CSR3_ALE_HIGH      0	/* Bit 1 = 0 -> ALE asserted high    */
 #define CSR3_ALE_LOW       2	/* Bit 1 = 1 -> ALE asserted low     */
 #define CSR3_BSWAP_OFF     0	/* Bit 2 = 0 -> no byte swap         */
-#define CSR3_BSWAP_ON      0	/* Bit 2 = 1 -> byte swap            */
+#define CSR3_BSWAP_ON      4	/* Bit 2 = 1 -> byte swap            */
 
 /* LANCE structures */
 
diff -Nru a/drivers/net/slip.c b/drivers/net/slip.c
--- a/drivers/net/slip.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/slip.c	Tue Jun 15 22:21:05 2004
@@ -1138,6 +1138,7 @@
 {
 	struct slip *sl = (struct slip *) tty->disc_data;
 	unsigned int tmp;
+	int __user *p = (int __user *)arg;
 
 	/* First make sure we're connected. */
 	if (!sl || sl->magic != SLIP_MAGIC) {
@@ -1147,17 +1148,17 @@
 	switch(cmd) {
 	 case SIOCGIFNAME:
 		tmp = strlen(sl->dev->name) + 1;
-		if (copy_to_user((void *)arg, sl->dev->name, tmp))
+		if (copy_to_user((void __user *)arg, sl->dev->name, tmp))
 			return -EFAULT;
 		return 0;
 
 	case SIOCGIFENCAP:
-		if (put_user(sl->mode, (int *)arg))
+		if (put_user(sl->mode, p))
 			return -EFAULT;
 		return 0;
 
 	case SIOCSIFENCAP:
-		if (get_user(tmp,(int *)arg))
+		if (get_user(tmp, p))
 			return -EFAULT;
 #ifndef SL_INCLUDE_CSLIP
 		if (tmp & (SL_MODE_CSLIP|SL_MODE_ADAPTIVE))  {
@@ -1185,7 +1186,7 @@
 #ifdef CONFIG_SLIP_SMART
 	/* VSV changes start here */
         case SIOCSKEEPALIVE:
-		if (get_user(tmp,(int *)arg))
+		if (get_user(tmp, p))
 			return -EFAULT;
                 if (tmp > 255) /* max for unchar */
 			return -EINVAL;
@@ -1205,12 +1206,12 @@
 		return 0;
 
         case SIOCGKEEPALIVE:
-		if (put_user(sl->keepalive, (int *)arg))
+		if (put_user(sl->keepalive, p))
 			return -EFAULT;
 		return 0;
 
         case SIOCSOUTFILL:
-		if (get_user(tmp,(int *)arg))
+		if (get_user(tmp, p))
 			return -EFAULT;
                 if (tmp > 255) /* max for unchar */
 			return -EINVAL;
@@ -1229,7 +1230,7 @@
                 return 0;
 
         case SIOCGOUTFILL:
-		if (put_user(sl->outfill, (int *)arg))
+		if (put_user(sl->outfill, p))
 			return -EFAULT;
 		return 0;
 	/* VSV changes end */
@@ -1254,6 +1255,7 @@
 static int sl_ioctl(struct net_device *dev,struct ifreq *rq,int cmd)
 {
 	struct slip *sl = (struct slip*)(dev->priv);
+	unsigned long *p = (unsigned long *)&rq->ifr_ifru;
 
 	if (sl == NULL)		/* Allocation failed ?? */
 		return -ENODEV;
@@ -1268,11 +1270,11 @@
 	switch(cmd){
         case SIOCSKEEPALIVE:
 		/* max for unchar */
-                if (((unsigned int)((unsigned long)rq->ifr_data)) > 255) {
+                if ((unsigned)*p > 255) {
 			spin_unlock_bh(&sl->lock);
 			return -EINVAL;
 		}
-		sl->keepalive = (unchar) ((unsigned long)rq->ifr_data);
+		sl->keepalive = (unchar) *p;
 		if (sl->keepalive != 0) {
 			sl->keepalive_timer.expires=jiffies+sl->keepalive*HZ;
 			mod_timer(&sl->keepalive_timer, jiffies+sl->keepalive*HZ);
@@ -1283,15 +1285,15 @@
 		break;
 
         case SIOCGKEEPALIVE:
-		rq->ifr_data=(caddr_t)((unsigned long)sl->keepalive);
+		*p = sl->keepalive;
 		break;
 
         case SIOCSOUTFILL:
-                if (((unsigned)((unsigned long)rq->ifr_data)) > 255) { /* max for unchar */
+                if ((unsigned)*p > 255) { /* max for unchar */
 			spin_unlock_bh(&sl->lock);
 			return -EINVAL;
 		}
-                if ((sl->outfill = (unchar)((unsigned long) rq->ifr_data)) != 0){
+                if ((sl->outfill = (unchar)*p) != 0){
 			mod_timer(&sl->outfill_timer, jiffies+sl->outfill*HZ);
 			set_bit(SLF_OUTWAIT, &sl->flags);
 		} else {
@@ -1300,7 +1302,7 @@
                 break;
 
         case SIOCGOUTFILL:
-		rq->ifr_data=(caddr_t)((unsigned long)sl->outfill);
+		*p = sl->outfill;
 		break;
 
         case SIOCSLEASE:
@@ -1312,12 +1314,12 @@
 			return -EPERM;
 		}
 		sl->leased = 0;
-                if ((unsigned long)rq->ifr_data)
+                if (*p)
 			sl->leased = 1;
                 break;
 
         case SIOCGLEASE:
-		rq->ifr_data=(caddr_t)((unsigned long)sl->leased);
+		*p = sl->leased;
 	};
 	spin_unlock_bh(&sl->lock);
 	return 0;
diff -Nru a/drivers/net/starfire.c b/drivers/net/starfire.c
--- a/drivers/net/starfire.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/starfire.c	Tue Jun 15 22:20:38 2004
@@ -1997,7 +1997,7 @@
 }
 
 
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct ethtool_cmd ecmd;
 	struct netdev_private *np = dev->priv;
@@ -2079,16 +2079,16 @@
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct netdev_private *np = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
 	int rc;
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
 	if (cmd == SIOCETHTOOL)
-		rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		rc = netdev_ethtool_ioctl(dev, rq->ifr_data);
 
 	else {
+		struct mii_ioctl_data *data = if_mii(rq);
 		spin_lock_irq(&np->lock);
 		rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL);
 		spin_unlock_irq(&np->lock);
diff -Nru a/drivers/net/sundance.c b/drivers/net/sundance.c
--- a/drivers/net/sundance.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/sundance.c	Tue Jun 15 22:20:41 2004
@@ -1576,7 +1576,7 @@
 }
 	
 
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct netdev_private *np = dev->priv;
 	u32 ethcmd;
@@ -1659,7 +1659,6 @@
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct netdev_private *np = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
 	int rc;
 	int i;
 	long ioaddr = dev->base_addr;
@@ -1668,11 +1667,11 @@
 		return -EINVAL;
 
 	if (cmd == SIOCETHTOOL)
-		rc = netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		rc = netdev_ethtool_ioctl(dev, rq->ifr_data);
 
 	else {
 		spin_lock_irq(&np->lock);
-		rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL);
+		rc = generic_mii_ioctl(&np->mii_if, if_mii(rq), cmd, NULL);
 		spin_unlock_irq(&np->lock);
 	}
 	switch (cmd) {
diff -Nru a/drivers/net/sungem.c b/drivers/net/sungem.c
--- a/drivers/net/sungem.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/sungem.c	Tue Jun 15 22:21:03 2004
@@ -2510,7 +2510,7 @@
 static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
 	struct gem *gp = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data;
+	struct mii_ioctl_data *data = if_mii(ifr);
 	int rc = -EOPNOTSUPP;
 	
 	/* Hold the PM semaphore while doing ioctl's or we may collide
diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c
--- a/drivers/net/tg3.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/tg3.c	Tue Jun 15 22:20:41 2004
@@ -56,8 +56,8 @@
 
 #define DRV_MODULE_NAME		"tg3"
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"3.3"
-#define DRV_MODULE_RELDATE	"April 27, 2004"
+#define DRV_MODULE_VERSION	"3.6"
+#define DRV_MODULE_RELDATE	"June 12, 2004"
 
 #define TG3_DEF_MAC_MODE	0
 #define TG3_DEF_RX_MODE		0
@@ -80,7 +80,8 @@
 /* hardware minimum and maximum for a single frame's data payload */
 #define TG3_MIN_MTU			60
 #define TG3_MAX_MTU(tp)	\
-	(GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 ? 9000 : 1500)
+	((GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 && \
+	  GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) ? 9000 : 1500)
 
 /* These numbers seem to be hard coded in the NIC firmware somehow.
  * You can't change the ring sizes, but you can change where you place
@@ -98,7 +99,8 @@
  * replace things like '% foo' with '& (foo - 1)'.
  */
 #define TG3_RX_RCB_RING_SIZE(tp)	\
-	(GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ? \
+	((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 || \
+	  GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) ? \
 	 512 : 1024)
 
 #define TG3_TX_RING_SIZE		512
@@ -126,7 +128,8 @@
 /* minimum number of free TX descriptors required to wake up TX process */
 #define TG3_TX_WAKEUP_THRESH		(TG3_TX_RING_SIZE / 4)
 
-#define TG3_NUM_STATS		25	/* number of ETHTOOL_GSTATS u64's */
+/* number of ETHTOOL_GSTATS u64's */
+#define TG3_NUM_STATS		(sizeof(struct tg3_ethtool_stats)/sizeof(u64))
 
 static char version[] __devinitdata =
 	DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -174,6 +177,8 @@
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
 	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5788,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5789,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
 	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5901,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
 	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5901_2,
@@ -182,6 +187,20 @@
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
 	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5705F,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5720,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5721,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750M,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751M,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
+	{ PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751F,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
 	{ PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
 	{ PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX,
@@ -204,10 +223,13 @@
 struct {
 	char string[ETH_GSTRING_LEN];
 } ethtool_stats_keys[TG3_NUM_STATS] = {
+	{ "rx_octets" },
 	{ "rx_fragments" },
 	{ "rx_ucast_packets" },
+	{ "rx_mcast_packets" },
 	{ "rx_bcast_packets" },
 	{ "rx_fcs_errors" },
+	{ "rx_align_errors" },
 	{ "rx_xon_pause_rcvd" },
 	{ "rx_xoff_pause_rcvd" },
 	{ "rx_mac_ctrl_rcvd" },
@@ -217,6 +239,19 @@
 	{ "rx_undersize_packets" },
 	{ "rx_in_length_errors" },
 	{ "rx_out_length_errors" },
+	{ "rx_64_or_less_octet_packets" },
+	{ "rx_65_to_127_octet_packets" },
+	{ "rx_128_to_255_octet_packets" },
+	{ "rx_256_to_511_octet_packets" },
+	{ "rx_512_to_1023_octet_packets" },
+	{ "rx_1024_to_1522_octet_packets" },
+	{ "rx_1523_to_2047_octet_packets" },
+	{ "rx_2048_to_4095_octet_packets" },
+	{ "rx_4096_to_8191_octet_packets" },
+	{ "rx_8192_to_9022_octet_packets" },
+
+	{ "tx_octets" },
+	{ "tx_collisions" },
 
 	{ "tx_xon_sent" },
 	{ "tx_xoff_sent" },
@@ -227,9 +262,43 @@
 	{ "tx_deferred" },
 	{ "tx_excessive_collisions" },
 	{ "tx_late_collisions" },
+	{ "tx_collide_2times" },
+	{ "tx_collide_3times" },
+	{ "tx_collide_4times" },
+	{ "tx_collide_5times" },
+	{ "tx_collide_6times" },
+	{ "tx_collide_7times" },
+	{ "tx_collide_8times" },
+	{ "tx_collide_9times" },
+	{ "tx_collide_10times" },
+	{ "tx_collide_11times" },
+	{ "tx_collide_12times" },
+	{ "tx_collide_13times" },
+	{ "tx_collide_14times" },
+	{ "tx_collide_15times" },
 	{ "tx_ucast_packets" },
 	{ "tx_mcast_packets" },
-	{ "tx_bcast_packets" }
+	{ "tx_bcast_packets" },
+	{ "tx_carrier_sense_errors" },
+	{ "tx_discards" },
+	{ "tx_errors" },
+
+	{ "dma_writeq_full" },
+	{ "dma_write_prioq_full" },
+	{ "rxbds_empty" },
+	{ "rx_discards" },
+	{ "rx_errors" },
+	{ "rx_threshold_hit" },
+
+	{ "dma_readq_full" },
+	{ "dma_read_prioq_full" },
+	{ "tx_comp_queue_full" },
+
+	{ "ring_set_send_prod_index" },
+	{ "ring_status_update" },
+	{ "nic_irqs" },
+	{ "nic_avoided_irqs" },
+	{ "nic_tx_threshold_hit" }
 };
 
 static void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
@@ -373,6 +442,7 @@
 	tp->pci_clock_ctrl = clock_ctrl;
 
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750 &&
 	    (orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE) != 0) {
 		tw32_f(TG3PCI_CLOCK_CTRL,
 		     clock_ctrl |
@@ -396,7 +466,7 @@
 	if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) {
 		tw32_f(MAC_MI_MODE,
 		     (tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL));
-		udelay(40);
+		udelay(80);
 	}
 
 	*val = 0xffffffff;
@@ -429,7 +499,7 @@
 
 	if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) {
 		tw32_f(MAC_MI_MODE, tp->mi_mode);
-		udelay(40);
+		udelay(80);
 	}
 
 	return ret;
@@ -443,7 +513,7 @@
 	if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) {
 		tw32_f(MAC_MI_MODE,
 		     (tp->mi_mode & ~MAC_MI_MODE_AUTO_POLL));
-		udelay(40);
+		udelay(80);
 	}
 
 	frame_val  = ((PHY_ADDR << MI_COM_PHY_ADDR_SHIFT) &
@@ -472,7 +542,7 @@
 
 	if ((tp->mi_mode & MAC_MI_MODE_AUTO_POLL) != 0) {
 		tw32_f(MAC_MI_MODE, tp->mi_mode);
-		udelay(40);
+		udelay(80);
 	}
 
 	return ret;
@@ -748,8 +818,8 @@
 	if ((tp->phy_id & PHY_ID_MASK) == PHY_ID_BCM5401) {
 		/* Cannot do read-modify-write on 5401 */
 		tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4c20);
-	}
-	else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
+	} else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+		   GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) {
 		u32 phy_reg;
 
 		/* Set bit 14 with read-modify-write to preserve other bits */
@@ -842,6 +912,12 @@
 
 static int tg3_setup_phy(struct tg3 *, int);
 
+#define RESET_KIND_SHUTDOWN	0
+#define RESET_KIND_INIT		1
+#define RESET_KIND_SUSPEND	2
+
+static void tg3_write_sig_post_reset(struct tg3 *, int);
+
 static int tg3_set_power_state(struct tg3 *tp, int state)
 {
 	u32 misc_host_ctrl;
@@ -928,6 +1004,8 @@
 			mac_mode = MAC_MODE_PORT_MODE_TBI;
 		}
 
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750)
+			tw32(MAC_LED_CTRL, tp->led_ctrl);
 
 		if (((power_caps & PCI_PM_CAP_PME_D3cold) &&
 		     (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)))
@@ -953,7 +1031,8 @@
 		     CLOCK_CTRL_ALTCLK |
 		     CLOCK_CTRL_PWRDOWN_PLL133);
 		udelay(40);
-	} else {
+	} else if (!((GET_ASIC_REV(tp->pci_chip_rev_id) == 5750) &&
+		     (tp->tg3_flags & TG3_FLAG_ENABLE_ASF))) {
 		u32 newbits1, newbits2;
 
 		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
@@ -962,7 +1041,8 @@
 				    CLOCK_CTRL_TXCLK_DISABLE |
 				    CLOCK_CTRL_ALTCLK);
 			newbits2 = newbits1 | CLOCK_CTRL_44MHZ_CORE;
-		} else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
+		} else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+			   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
 			newbits1 = CLOCK_CTRL_625_CORE;
 			newbits2 = newbits1 | CLOCK_CTRL_ALTCLK;
 		} else {
@@ -976,7 +1056,8 @@
 		tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl | newbits2);
 		udelay(40);
 
-		if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+		    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) {
 			u32 newbits3;
 
 			if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
@@ -999,6 +1080,8 @@
 	/* Finally, set the new power state. */
 	pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control);
 
+	tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN);
+
 	return 0;
 }
 
@@ -1027,6 +1110,8 @@
 static void tg3_setup_flow_control(struct tg3 *tp, u32 local_adv, u32 remote_adv)
 {
 	u32 new_tg3_flags = 0;
+	u32 old_rx_mode = tp->rx_mode;
+	u32 old_tx_mode = tp->tx_mode;
 
 	if (local_adv & ADVERTISE_PAUSE_CAP) {
 		if (local_adv & ADVERTISE_PAUSE_ASYM) {
@@ -1057,10 +1142,18 @@
 	else
 		tp->rx_mode &= ~RX_MODE_FLOW_CTRL_ENABLE;
 
+	if (old_rx_mode != tp->rx_mode) {
+		tw32_f(MAC_RX_MODE, tp->rx_mode);
+	}
+	
 	if (new_tg3_flags & TG3_FLAG_TX_PAUSE)
 		tp->tx_mode |= TX_MODE_FLOW_CTRL_ENABLE;
 	else
 		tp->tx_mode &= ~TX_MODE_FLOW_CTRL_ENABLE;
+
+	if (old_tx_mode != tp->tx_mode) {
+		tw32_f(MAC_TX_MODE, tp->tx_mode);
+	}
 }
 
 static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 *duplex)
@@ -1311,7 +1404,7 @@
 
 	tp->mi_mode = MAC_MI_MODE_BASE;
 	tw32_f(MAC_MI_MODE, tp->mi_mode);
-	udelay(40);
+	udelay(80);
 
 	tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x02);
 
@@ -1380,11 +1473,14 @@
 	else
 		tg3_writephy(tp, MII_TG3_IMASK, ~0);
 
-	if (tp->led_mode == led_mode_three_link)
-		tg3_writephy(tp, MII_TG3_EXT_CTRL,
-			     MII_TG3_EXT_CTRL_LNK3_LED_MODE);
-	else
-		tg3_writephy(tp, MII_TG3_EXT_CTRL, 0);
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
+		if (tp->led_ctrl == LED_CTRL_MODE_PHY_1)
+			tg3_writephy(tp, MII_TG3_EXT_CTRL,
+				     MII_TG3_EXT_CTRL_LNK3_LED_MODE);
+		else
+			tg3_writephy(tp, MII_TG3_EXT_CTRL, 0);
+	}
 
 	current_link_up = 0;
 	current_speed = SPEED_INVALID;
@@ -1497,14 +1593,13 @@
 
 	tp->mac_mode &= ~MAC_MODE_LINK_POLARITY;
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700) {
-		if ((tp->led_mode == led_mode_link10) ||
+		if ((tp->led_ctrl == LED_CTRL_MODE_PHY_2) ||
 		    (current_link_up == 1 &&
 		     tp->link_config.active_speed == SPEED_10))
 			tp->mac_mode |= MAC_MODE_LINK_POLARITY;
 	} else {
 		if (current_link_up == 1)
 			tp->mac_mode |= MAC_MODE_LINK_POLARITY;
-		tw32(MAC_LED_CTRL, LED_CTRL_PHY_MODE_1);
 	}
 
 	/* ??? Without this setting Netgear GA302T PHY does not
@@ -1514,7 +1609,7 @@
 	    tp->pci_chip_rev_id == CHIPREV_ID_5700_ALTIMA) {
 		tp->mi_mode |= MAC_MI_MODE_AUTO_POLL;
 		tw32_f(MAC_MI_MODE, tp->mi_mode);
-		udelay(40);
+		udelay(80);
 	}
 
 	tw32_f(MAC_MODE, tp->mac_mode);
@@ -2038,9 +2133,15 @@
 	if (current_link_up == 1) {
 		tp->link_config.active_speed = SPEED_1000;
 		tp->link_config.active_duplex = DUPLEX_FULL;
+		tw32(MAC_LED_CTRL, (tp->led_ctrl |
+				    LED_CTRL_LNKLED_OVERRIDE |
+				    LED_CTRL_1000MBPS_ON));
 	} else {
 		tp->link_config.active_speed = SPEED_INVALID;
 		tp->link_config.active_duplex = DUPLEX_INVALID;
+		tw32(MAC_LED_CTRL, (tp->led_ctrl |
+				    LED_CTRL_LNKLED_OVERRIDE |
+				    LED_CTRL_TRAFFIC_OVERRIDE));
 	}
 
 	if (current_link_up != netif_carrier_ok(tp->dev)) {
@@ -2093,11 +2194,14 @@
 		      (6 << TX_LENGTHS_IPG_SHIFT) |
 		      (32 << TX_LENGTHS_SLOT_TIME_SHIFT)));
 
-	if (netif_carrier_ok(tp->dev)) {
-		tw32(HOSTCC_STAT_COAL_TICKS,
-		     DEFAULT_STAT_COAL_TICKS);
-	} else {
-		tw32(HOSTCC_STAT_COAL_TICKS, 0);
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) {
+		if (netif_carrier_ok(tp->dev)) {
+			tw32(HOSTCC_STAT_COAL_TICKS,
+			     DEFAULT_STAT_COAL_TICKS);
+		} else {
+			tw32(HOSTCC_STAT_COAL_TICKS, 0);
+		}
 	}
 
 	return err;
@@ -2435,7 +2539,7 @@
 
 static int tg3_poll(struct net_device *netdev, int *budget)
 {
-	struct tg3 *tp = netdev->priv;
+	struct tg3 *tp = netdev_priv(netdev);
 	struct tg3_hw_status *sblk = tp->hw_status;
 	unsigned long flags;
 	int done;
@@ -2517,7 +2621,7 @@
 static irqreturn_t tg3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct net_device *dev = dev_id;
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	struct tg3_hw_status *sblk = tp->hw_status;
 	unsigned long flags;
 	unsigned int handled = 1;
@@ -2597,7 +2701,7 @@
 
 static void tg3_tx_timeout(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 
 	printk(KERN_ERR PFX "%s: transmit timed out, resetting\n",
 	       dev->name);
@@ -2713,7 +2817,7 @@
 
 static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	dma_addr_t mapping;
 	unsigned int i;
 	u32 len, entry, base_flags, mss;
@@ -2841,8 +2945,12 @@
 				would_hit_hwbug = entry + 1;
 			}
 
-			tg3_set_txd(tp, entry, mapping, len,
-				    base_flags, (i == last));
+			if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
+				tg3_set_txd(tp, entry, mapping, len,
+					    base_flags, (i == last)|(mss << 1));
+			else
+				tg3_set_txd(tp, entry, mapping, len,
+					    base_flags, (i == last));
 
 			entry = NEXT_TX(entry);
 		}
@@ -2913,7 +3021,7 @@
 
 static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	dma_addr_t mapping;
 	u32 len, entry, base_flags, mss;
 	unsigned long flags;
@@ -3028,8 +3136,12 @@
 			tp->tx_buffers[entry].skb = NULL;
 			pci_unmap_addr_set(&tp->tx_buffers[entry], mapping, mapping);
 
-			tg3_set_txd(tp, entry, mapping, len,
-				    base_flags, (i == last));
+			if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
+				tg3_set_txd(tp, entry, mapping, len,
+					    base_flags, (i == last)|(mss << 1));
+			else
+				tg3_set_txd(tp, entry, mapping, len,
+					    base_flags, (i == last));
 
 			entry = NEXT_TX(entry);
 		}
@@ -3079,7 +3191,7 @@
 
 static int tg3_change_mtu(struct net_device *dev, int new_mtu)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 
 	if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp))
 		return -EINVAL;
@@ -3387,7 +3499,8 @@
 	unsigned int i;
 	u32 val;
 
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
 		switch (ofs) {
 		case RCVLSC_MODE:
 		case DMAC_MODE:
@@ -3395,7 +3508,7 @@
 		case BUFMGR_MODE:
 		case MEMARB_MODE:
 			/* We can't enable/disable these bits of the
-			 * 5705, just say success.
+			 * 5705/5750, just say success.
 			 */
 			return 0;
 
@@ -3494,28 +3607,115 @@
 }
 
 /* tp->lock is held. */
+static int tg3_nvram_lock(struct tg3 *tp)
+{
+	if (tp->tg3_flags & TG3_FLAG_NVRAM) {
+		int i;
+
+		tw32(NVRAM_SWARB, SWARB_REQ_SET1);
+		for (i = 0; i < 8000; i++) {
+			if (tr32(NVRAM_SWARB) & SWARB_GNT1)
+				break;
+			udelay(20);
+		}
+		if (i == 8000)
+			return -ENODEV;
+	}
+	return 0;
+}
+
+/* tp->lock is held. */
+static void tg3_nvram_unlock(struct tg3 *tp)
+{
+	if (tp->tg3_flags & TG3_FLAG_NVRAM)
+		tw32_f(NVRAM_SWARB, SWARB_REQ_CLR1);
+}
+
+/* tp->lock is held. */
+static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind)
+{
+	tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX,
+		      NIC_SRAM_FIRMWARE_MBOX_MAGIC1);
+
+	if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) {
+		switch (kind) {
+		case RESET_KIND_INIT:
+			tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
+				      DRV_STATE_START);
+			break;
+
+		case RESET_KIND_SHUTDOWN:
+			tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
+				      DRV_STATE_UNLOAD);
+			break;
+
+		case RESET_KIND_SUSPEND:
+			tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
+				      DRV_STATE_SUSPEND);
+			break;
+
+		default:
+			break;
+		};
+	}
+}
+
+/* tp->lock is held. */
+static void tg3_write_sig_post_reset(struct tg3 *tp, int kind)
+{
+	if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) {
+		switch (kind) {
+		case RESET_KIND_INIT:
+			tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
+				      DRV_STATE_START_DONE);
+			break;
+
+		case RESET_KIND_SHUTDOWN:
+			tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
+				      DRV_STATE_UNLOAD_DONE);
+			break;
+
+		default:
+			break;
+		};
+	}
+}
+
+/* tp->lock is held. */
+static void tg3_write_sig_legacy(struct tg3 *tp, int kind)
+{
+	if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) {
+		switch (kind) {
+		case RESET_KIND_INIT:
+			tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
+				      DRV_STATE_START);
+			break;
+
+		case RESET_KIND_SHUTDOWN:
+			tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
+				      DRV_STATE_UNLOAD);
+			break;
+
+		case RESET_KIND_SUSPEND:
+			tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
+				      DRV_STATE_SUSPEND);
+			break;
+
+		default:
+			break;
+		};
+	}
+}
+
+/* tp->lock is held. */
 static int tg3_chip_reset(struct tg3 *tp)
 {
 	u32 val;
 	u32 flags_save;
 	int i;
 
-	if (!(tp->tg3_flags2 & TG3_FLG2_SUN_5704)) {
-		/* Force NVRAM to settle.
-		 * This deals with a chip bug which can result in EEPROM
-		 * corruption.
-		 */
-		if (tp->tg3_flags & TG3_FLAG_NVRAM) {
-			int i;
-
-			tw32(NVRAM_SWARB, SWARB_REQ_SET1);
-			for (i = 0; i < 100000; i++) {
-				if (tr32(NVRAM_SWARB) & SWARB_GNT1)
-					break;
-				udelay(10);
-			}
-		}
-	}
+	if (!(tp->tg3_flags2 & TG3_FLG2_SUN_5704))
+		tg3_nvram_lock(tp);
 
 	/*
 	 * We must avoid the readl() that normally takes place.
@@ -3528,7 +3728,19 @@
 
 	/* do the reset */
 	val = GRC_MISC_CFG_CORECLK_RESET;
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
+
+	if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
+		if (tr32(0x7e2c) == 0x60) {
+			tw32(0x7e2c, 0x20);
+		}
+		if (tp->pci_chip_rev_id != CHIPREV_ID_5750_A0) {
+			tw32(GRC_MISC_CFG, (1 << 29));
+			val |= (1 << 29);
+		}
+	}
+
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
 		val |= GRC_MISC_CFG_KEEP_GPHY_POWER;
 	tw32(GRC_MISC_CFG, val);
 
@@ -3542,9 +3754,24 @@
 	 */
 	pci_read_config_dword(tp->pdev, PCI_COMMAND, &val);
 
-	udelay(40);
-	udelay(40);
-	udelay(40);
+	udelay(120);
+
+	if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
+		if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A0) {
+			int i;
+			u32 cfg_val;
+
+			/* Wait for link training to complete.  */
+			for (i = 0; i < 5000; i++)
+				udelay(100);
+
+			pci_read_config_dword(tp->pdev, 0xc4, &cfg_val);
+			pci_write_config_dword(tp->pdev, 0xc4,
+					       cfg_val | (1 << 15));
+		}
+		/* Set PCIE max payload size and clear error status.  */
+		pci_write_config_dword(tp->pdev, 0xd8, 0xf5000);
+	}
 
 	/* Re-enable indirect register accesses. */
 	pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
@@ -3568,18 +3795,20 @@
 
 	tw32(GRC_MODE, tp->grc_mode);
 
+	if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0) {
+		u32 val = tr32(0xc4);
+
+		tw32(0xc4, val | (1 << 15));
+	}
+
 	if ((tp->nic_sram_data_cfg & NIC_SRAM_DATA_CFG_MINI_PCI) != 0 &&
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
-		tp->pci_clock_ctrl |=
-			(CLOCK_CTRL_FORCE_CLKRUN | CLOCK_CTRL_CLKRUN_OENABLE);
+		tp->pci_clock_ctrl |= CLOCK_CTRL_CLKRUN_OENABLE;
+		if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0)
+			tp->pci_clock_ctrl |= CLOCK_CTRL_FORCE_CLKRUN;
 		tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
 	}
 
-	/* Prevent PXE from restarting.  */
-	tg3_write_mem(tp,
-		      NIC_SRAM_FIRMWARE_MBOX,
-		      NIC_SRAM_FIRMWARE_MBOX_MAGIC1);
-
 	if (tp->phy_id == PHY_ID_SERDES) {
 		tp->mac_mode = MAC_MODE_PORT_MODE_TBI;
 		tw32_f(MAC_MODE, tp->mac_mode);
@@ -3602,15 +3831,26 @@
 		return -ENODEV;
 	}
 
+	if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
+	    tp->pci_chip_rev_id != CHIPREV_ID_5750_A0) {
+		u32 val = tr32(0x7c00);
+
+		tw32(0x7c00, val | (1 << 25));
+	}
+
 	/* Reprobe ASF enable state.  */
 	tp->tg3_flags &= ~TG3_FLAG_ENABLE_ASF;
+	tp->tg3_flags2 &= ~TG3_FLG2_ASF_NEW_HANDSHAKE;
 	tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val);
 	if (val == NIC_SRAM_DATA_SIG_MAGIC) {
 		u32 nic_cfg;
 
 		tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg);
-		if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE)
+		if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) {
 			tp->tg3_flags |= TG3_FLAG_ENABLE_ASF;
+			if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
+				tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE;
+		}
 	}
 
 	return 0;
@@ -3643,15 +3883,18 @@
 	int err;
 
 	tg3_stop_fw(tp);
+
+	tg3_write_sig_pre_reset(tp, RESET_KIND_SHUTDOWN);
+
 	tg3_abort_hw(tp);
 	err = tg3_chip_reset(tp);
+
+	tg3_write_sig_legacy(tp, RESET_KIND_SHUTDOWN);
+	tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN);
+
 	if (err)
 		return err;
 
-	if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF)
-		tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
-			      DRV_STATE_UNLOAD);
-
 	return 0;
 }
 
@@ -3951,305 +4194,305 @@
 #if TG3_TSO_SUPPORT != 0
 
 #define TG3_TSO_FW_RELEASE_MAJOR	0x1
-#define TG3_TSO_FW_RELASE_MINOR		0x4
+#define TG3_TSO_FW_RELASE_MINOR		0x6
 #define TG3_TSO_FW_RELEASE_FIX		0x0
 #define TG3_TSO_FW_START_ADDR		0x08000000
 #define TG3_TSO_FW_TEXT_ADDR		0x08000000
-#define TG3_TSO_FW_TEXT_LEN		0x1a90
-#define TG3_TSO_FW_RODATA_ADDR		0x08001a90
+#define TG3_TSO_FW_TEXT_LEN		0x1aa0
+#define TG3_TSO_FW_RODATA_ADDR		0x08001aa0
 #define TG3_TSO_FW_RODATA_LEN		0x60
 #define TG3_TSO_FW_DATA_ADDR		0x08001b20
-#define TG3_TSO_FW_DATA_LEN		0x20
-#define TG3_TSO_FW_SBSS_ADDR		0x08001b40
+#define TG3_TSO_FW_DATA_LEN		0x30
+#define TG3_TSO_FW_SBSS_ADDR		0x08001b50
 #define TG3_TSO_FW_SBSS_LEN		0x2c
-#define TG3_TSO_FW_BSS_ADDR		0x08001b70
+#define TG3_TSO_FW_BSS_ADDR		0x08001b80
 #define TG3_TSO_FW_BSS_LEN		0x894
 
-static u32 tg3TsoFwText[] = {
-	0x00000000, 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, 0x3c1d0800,
-	0x37bd4000, 0x03a0f021, 0x3c100800, 0x26100000, 0x0e000010, 0x00000000,
-	0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0x3c04fefe,
-	0xafbf0018, 0x0e0005d4, 0x34840002, 0x0e000664, 0x00000000, 0x3c030800,
-	0x90631b58, 0x24020002, 0x3c040800, 0x24841a9c, 0x14620003, 0x24050001,
-	0x3c040800, 0x24841a90, 0x24060003, 0x00003821, 0xafa00010, 0x0e000678,
+static u32 tg3TsoFwText[(TG3_TSO_FW_TEXT_LEN / 4) + 1] = {
+	0x0e000003, 0x00000000, 0x08001b24, 0x00000000, 0x10000003, 0x00000000,
+	0x0000000d, 0x0000000d, 0x3c1d0800, 0x37bd4000, 0x03a0f021, 0x3c100800,
+	0x26100000, 0x0e000010, 0x00000000, 0x0000000d, 0x27bdffe0, 0x3c04fefe,
+	0xafbf0018, 0x0e0005d8, 0x34840002, 0x0e000668, 0x00000000, 0x3c030800,
+	0x90631b68, 0x24020002, 0x3c040800, 0x24841aac, 0x14620003, 0x24050001,
+	0x3c040800, 0x24841aa0, 0x24060006, 0x00003821, 0xafa00010, 0x0e00067c,
 	0xafa00014, 0x8f625c50, 0x34420001, 0xaf625c50, 0x8f625c90, 0x34420001,
 	0xaf625c90, 0x2402ffff, 0x0e000034, 0xaf625404, 0x8fbf0018, 0x03e00008,
 	0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0xafbf001c,
 	0xafb20018, 0xafb10014, 0x0e00005b, 0xafb00010, 0x24120002, 0x24110001,
 	0x8f706820, 0x32020100, 0x10400003, 0x00000000, 0x0e0000bb, 0x00000000,
-	0x8f706820, 0x32022000, 0x10400004, 0x32020001, 0x0e0001ef, 0x24040001,
+	0x8f706820, 0x32022000, 0x10400004, 0x32020001, 0x0e0001f0, 0x24040001,
 	0x32020001, 0x10400003, 0x00000000, 0x0e0000a3, 0x00000000, 0x3c020800,
-	0x90421b88, 0x14520003, 0x00000000, 0x0e0004bf, 0x00000000, 0x0a00003c,
+	0x90421b98, 0x14520003, 0x00000000, 0x0e0004c0, 0x00000000, 0x0a00003c,
 	0xaf715028, 0x8fbf001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008,
-	0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841ab0, 0x00002821, 0x00003021,
-	0x00003821, 0xafbf0018, 0xafa00010, 0x0e000678, 0xafa00014, 0x3c040800,
-	0x248423c8, 0xa4800000, 0x3c010800, 0xa0201b88, 0x3c010800, 0xac201b8c,
-	0x3c010800, 0xac201b90, 0x3c010800, 0xac201b94, 0x3c010800, 0xac201b9c,
-	0x3c010800, 0xac201ba8, 0x3c010800, 0xac201bac, 0x8f624434, 0x3c010800,
-	0xac221b78, 0x8f624438, 0x3c010800, 0xac221b7c, 0x8f624410, 0xac80f7a8,
-	0x3c010800, 0xac201b74, 0x3c010800, 0xac2023d0, 0x3c010800, 0xac2023b8,
-	0x3c010800, 0xac2023bc, 0x3c010800, 0xac2023f0, 0x3c010800, 0xac221b80,
+	0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841ac0, 0x00002821, 0x00003021,
+	0x00003821, 0xafbf0018, 0xafa00010, 0x0e00067c, 0xafa00014, 0x3c040800,
+	0x248423d8, 0xa4800000, 0x3c010800, 0xa0201b98, 0x3c010800, 0xac201b9c,
+	0x3c010800, 0xac201ba0, 0x3c010800, 0xac201ba4, 0x3c010800, 0xac201bac,
+	0x3c010800, 0xac201bb8, 0x3c010800, 0xac201bbc, 0x8f624434, 0x3c010800,
+	0xac221b88, 0x8f624438, 0x3c010800, 0xac221b8c, 0x8f624410, 0xac80f7a8,
+	0x3c010800, 0xac201b84, 0x3c010800, 0xac2023e0, 0x3c010800, 0xac2023c8,
+	0x3c010800, 0xac2023cc, 0x3c010800, 0xac202400, 0x3c010800, 0xac221b90,
 	0x8f620068, 0x24030007, 0x00021702, 0x10430005, 0x00000000, 0x8f620068,
-	0x00021702, 0x14400004, 0x24020001, 0x3c010800, 0x0a000097, 0xac2023fc,
-	0xac820034, 0x3c040800, 0x24841abc, 0x3c050800, 0x8ca523fc, 0x00003021,
-	0x00003821, 0xafa00010, 0x0e000678, 0xafa00014, 0x8fbf0018, 0x03e00008,
-	0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841ac8, 0x00002821, 0x00003021,
-	0x00003821, 0xafbf0018, 0xafa00010, 0x0e000678, 0xafa00014, 0x0e00005b,
+	0x00021702, 0x14400004, 0x24020001, 0x3c010800, 0x0a000097, 0xac20240c,
+	0xac820034, 0x3c040800, 0x24841acc, 0x3c050800, 0x8ca5240c, 0x00003021,
+	0x00003821, 0xafa00010, 0x0e00067c, 0xafa00014, 0x8fbf0018, 0x03e00008,
+	0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841ad8, 0x00002821, 0x00003021,
+	0x00003821, 0xafbf0018, 0xafa00010, 0x0e00067c, 0xafa00014, 0x0e00005b,
 	0x00000000, 0x0e0000b4, 0x00002021, 0x8fbf0018, 0x03e00008, 0x27bd0020,
 	0x24020001, 0x8f636820, 0x00821004, 0x00021027, 0x00621824, 0x03e00008,
 	0xaf636820, 0x27bdffd0, 0xafbf002c, 0xafb60028, 0xafb50024, 0xafb40020,
 	0xafb3001c, 0xafb20018, 0xafb10014, 0xafb00010, 0x8f675c5c, 0x3c030800,
-	0x24631bac, 0x8c620000, 0x14470005, 0x3c0200ff, 0x3c020800, 0x90421b88,
-	0x14400118, 0x3c0200ff, 0x3442fff8, 0x00e28824, 0xac670000, 0x00111902,
+	0x24631bbc, 0x8c620000, 0x14470005, 0x3c0200ff, 0x3c020800, 0x90421b98,
+	0x14400119, 0x3c0200ff, 0x3442fff8, 0x00e28824, 0xac670000, 0x00111902,
 	0x306300ff, 0x30e20003, 0x000211c0, 0x00622825, 0x00a04021, 0x00071602,
-	0x3c030800, 0x90631b88, 0x3044000f, 0x14600036, 0x00804821, 0x24020001,
-	0x3c010800, 0xa0221b88, 0x00051100, 0x00821025, 0x3c010800, 0xac201b8c,
-	0x3c010800, 0xac201b90, 0x3c010800, 0xac201b94, 0x3c010800, 0xac201b9c,
-	0x3c010800, 0xac201ba8, 0x3c010800, 0xac201ba0, 0x3c010800, 0xac201ba4,
-	0x3c010800, 0xa42223c8, 0x9622000c, 0x30437fff, 0x3c010800, 0xa4222400,
-	0x30428000, 0x3c010800, 0xa4231bb6, 0x10400005, 0x24020001, 0x3c010800,
-	0xac2223e4, 0x0a000102, 0x2406003e, 0x24060036, 0x3c010800, 0xac2023e4,
-	0x9622000a, 0x3c030800, 0x94631bb6, 0x3c010800, 0xac2023e0, 0x3c010800,
-	0xac2023e8, 0x00021302, 0x00021080, 0x00c21021, 0x00621821, 0x3c010800,
-	0xa42223c0, 0x3c010800, 0x0a000115, 0xa4231b86, 0x9622000c, 0x3c010800,
-	0xa42223dc, 0x3c040800, 0x24841b8c, 0x8c820000, 0x00021100, 0x3c010800,
-	0x00220821, 0xac311bb8, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821,
-	0xac271bbc, 0x8c820000, 0x25030001, 0x306601ff, 0x00021100, 0x3c010800,
-	0x00220821, 0xac261bc0, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821,
-	0xac291bc4, 0x96230008, 0x3c020800, 0x8c421b9c, 0x00432821, 0x3c010800,
-	0xac251b9c, 0x9622000a, 0x30420004, 0x14400018, 0x00061100, 0x8f630c14,
+	0x3c030800, 0x90631b98, 0x3044000f, 0x14600036, 0x00804821, 0x24020001,
+	0x3c010800, 0xa0221b98, 0x00051100, 0x00821025, 0x3c010800, 0xac201b9c,
+	0x3c010800, 0xac201ba0, 0x3c010800, 0xac201ba4, 0x3c010800, 0xac201bac,
+	0x3c010800, 0xac201bb8, 0x3c010800, 0xac201bb0, 0x3c010800, 0xac201bb4,
+	0x3c010800, 0xa42223d8, 0x9622000c, 0x30437fff, 0x3c010800, 0xa4222410,
+	0x30428000, 0x3c010800, 0xa4231bc6, 0x10400005, 0x24020001, 0x3c010800,
+	0xac2223f4, 0x0a000102, 0x2406003e, 0x24060036, 0x3c010800, 0xac2023f4,
+	0x9622000a, 0x3c030800, 0x94631bc6, 0x3c010800, 0xac2023f0, 0x3c010800,
+	0xac2023f8, 0x00021302, 0x00021080, 0x00c21021, 0x00621821, 0x3c010800,
+	0xa42223d0, 0x3c010800, 0x0a000115, 0xa4231b96, 0x9622000c, 0x3c010800,
+	0xa42223ec, 0x3c040800, 0x24841b9c, 0x8c820000, 0x00021100, 0x3c010800,
+	0x00220821, 0xac311bc8, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821,
+	0xac271bcc, 0x8c820000, 0x25030001, 0x306601ff, 0x00021100, 0x3c010800,
+	0x00220821, 0xac261bd0, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821,
+	0xac291bd4, 0x96230008, 0x3c020800, 0x8c421bac, 0x00432821, 0x3c010800,
+	0xac251bac, 0x9622000a, 0x30420004, 0x14400018, 0x00061100, 0x8f630c14,
 	0x3063000f, 0x2c620002, 0x1440000b, 0x3c02c000, 0x8f630c14, 0x3c020800,
-	0x8c421b30, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b30, 0x2c620002,
+	0x8c421b40, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b40, 0x2c620002,
 	0x1040fff7, 0x3c02c000, 0x00e21825, 0xaf635c5c, 0x8f625c50, 0x30420002,
-	0x10400014, 0x00000000, 0x0a000147, 0x00000000, 0x3c030800, 0x8c631b70,
-	0x3c040800, 0x94841b84, 0x01221025, 0x3c010800, 0xa42223ca, 0x24020001,
-	0x3c010800, 0xac221ba8, 0x24630001, 0x0085202a, 0x3c010800, 0x10800003,
-	0xac231b70, 0x3c010800, 0xa4251b84, 0x3c060800, 0x24c61b8c, 0x8cc20000,
-	0x24420001, 0xacc20000, 0x28420080, 0x14400005, 0x00000000, 0x0e000652,
-	0x24040002, 0x0a0001e5, 0x00000000, 0x3c020800, 0x8c421ba8, 0x10400077,
-	0x24020001, 0x3c050800, 0x90a51b88, 0x14a20071, 0x00000000, 0x3c150800,
-	0x96b51b86, 0x3c040800, 0x8c841b9c, 0x32a3ffff, 0x0083102a, 0x1440006b,
-	0x00000000, 0x14830003, 0x00000000, 0x3c010800, 0xac2523e0, 0x1060005b,
+	0x10400014, 0x00000000, 0x0a000147, 0x00000000, 0x3c030800, 0x8c631b80,
+	0x3c040800, 0x94841b94, 0x01221025, 0x3c010800, 0xa42223da, 0x24020001,
+	0x3c010800, 0xac221bb8, 0x24630001, 0x0085202a, 0x3c010800, 0x10800003,
+	0xac231b80, 0x3c010800, 0xa4251b94, 0x3c060800, 0x24c61b9c, 0x8cc20000,
+	0x24420001, 0xacc20000, 0x28420080, 0x14400005, 0x00000000, 0x0e000656,
+	0x24040002, 0x0a0001e6, 0x00000000, 0x3c020800, 0x8c421bb8, 0x10400078,
+	0x24020001, 0x3c050800, 0x90a51b98, 0x14a20072, 0x00000000, 0x3c150800,
+	0x96b51b96, 0x3c040800, 0x8c841bac, 0x32a3ffff, 0x0083102a, 0x1440006c,
+	0x00000000, 0x14830003, 0x00000000, 0x3c010800, 0xac2523f0, 0x1060005c,
 	0x00009021, 0x24d60004, 0x0060a021, 0x24d30014, 0x8ec20000, 0x00028100,
-	0x3c110800, 0x02308821, 0x0e000621, 0x8e311bb8, 0x00402821, 0x10a00053,
-	0x00000000, 0x9628000a, 0x31020040, 0x10400004, 0x2407180c, 0x8e22000c,
-	0x2407188c, 0xaca20018, 0x3c030800, 0x00701821, 0x8c631bc0, 0x3c020800,
-	0x00501021, 0x8c421bc4, 0x00031d00, 0x00021400, 0x00621825, 0xaca30014,
-	0x8ec30004, 0x96220008, 0x00432023, 0x3242ffff, 0x3083ffff, 0x00431021,
-	0x0282102a, 0x14400002, 0x02b23023, 0x00803021, 0x8e620000, 0x30c4ffff,
-	0x00441021, 0xae620000, 0x8e220000, 0xaca20000, 0x8e220004, 0x8e63fff4,
-	0x00431021, 0xaca20004, 0xa4a6000e, 0x8e62fff4, 0x00441021, 0xae62fff4,
-	0x96230008, 0x0043102a, 0x14400005, 0x02469021, 0x8e62fff0, 0xae60fff4,
-	0x24420001, 0xae62fff0, 0xaca00008, 0x3242ffff, 0x14540008, 0x24020305,
-	0x31020080, 0x54400001, 0x34e70010, 0x24020905, 0xa4a2000c, 0x0a0001ca,
-	0x34e70020, 0xa4a2000c, 0x3c020800, 0x8c4223e0, 0x10400003, 0x3c024b65,
-	0x0a0001d2, 0x34427654, 0x3c02b49a, 0x344289ab, 0xaca2001c, 0x30e2ffff,
-	0xaca20010, 0x0e00059f, 0x00a02021, 0x3242ffff, 0x0054102b, 0x1440ffaa,
-	0x00000000, 0x24020002, 0x3c010800, 0x0a0001e5, 0xa0221b88, 0x8ec2083c,
-	0x24420001, 0x0a0001e5, 0xaec2083c, 0x0e0004bf, 0x00000000, 0x8fbf002c,
-	0x8fb60028, 0x8fb50024, 0x8fb40020, 0x8fb3001c, 0x8fb20018, 0x8fb10014,
-	0x8fb00010, 0x03e00008, 0x27bd0030, 0x27bdffd0, 0xafbf0028, 0xafb30024,
-	0xafb20020, 0xafb1001c, 0xafb00018, 0x8f725c9c, 0x3c0200ff, 0x3442fff8,
-	0x3c060800, 0x24c61ba4, 0x02428824, 0x9623000e, 0x8cc20000, 0x00431021,
-	0xacc20000, 0x8e220010, 0x30420020, 0x14400011, 0x00809821, 0x0e000637,
-	0x02202021, 0x3c02c000, 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002,
-	0x10400121, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x1040011c,
-	0x00000000, 0x0a00020c, 0x00000000, 0x8e240008, 0x8e230014, 0x00041402,
-	0x000241c0, 0x00031502, 0x304201ff, 0x2442ffff, 0x3042007f, 0x00031942,
-	0x30637800, 0x00021100, 0x24424000, 0x00625021, 0x9542000a, 0x3084ffff,
-	0x30420008, 0x104000b3, 0x000429c0, 0x3c020800, 0x8c4223f0, 0x1440002d,
-	0x25050008, 0x95020014, 0x3c010800, 0xa42223c0, 0x8d070010, 0x00071402,
-	0x3c010800, 0xa42223c2, 0x3c010800, 0xa42723c4, 0x9502000e, 0x30e3ffff,
-	0x00431023, 0x3c010800, 0xac2223f8, 0x8f626800, 0x3c030010, 0x00431024,
-	0x10400005, 0x00000000, 0x9503001a, 0x9502001c, 0x0a000241, 0x00431021,
-	0x9502001a, 0x3c010800, 0xac2223ec, 0x3c02c000, 0x02421825, 0x3c010800,
-	0xac2823f0, 0x3c010800, 0xac3223f4, 0xaf635c9c, 0x8f625c90, 0x30420002,
-	0x104000df, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x104000da,
-	0x00000000, 0x0a00024e, 0x00000000, 0x9502000e, 0x3c030800, 0x946323c4,
-	0x00434823, 0x3123ffff, 0x2c620008, 0x1040001c, 0x00000000, 0x95020014,
-	0x24420028, 0x00a22821, 0x00031042, 0x1840000b, 0x00002021, 0x24c60848,
-	0x00403821, 0x94a30000, 0x8cc20000, 0x24840001, 0x00431021, 0xacc20000,
-	0x0087102a, 0x1440fff9, 0x24a50002, 0x31220001, 0x1040001f, 0x3c024000,
-	0x3c040800, 0x248423ec, 0xa0a00001, 0x94a30000, 0x8c820000, 0x00431021,
-	0x0a00028d, 0xac820000, 0x8f626800, 0x3c030010, 0x00431024, 0x10400009,
-	0x00000000, 0x9502001a, 0x3c030800, 0x8c6323ec, 0x00431021, 0x3c010800,
-	0xac2223ec, 0x0a00028e, 0x3c024000, 0x9502001a, 0x9504001c, 0x3c030800,
-	0x8c6323ec, 0x00441023, 0x00621821, 0x3c010800, 0xac2323ec, 0x3c024000,
-	0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x1440fffc, 0x00000000,
-	0x9542000a, 0x30420010, 0x10400095, 0x00000000, 0x3c060800, 0x24c623f0,
-	0x3c020800, 0x944223c4, 0x8cc50000, 0x3c040800, 0x8c8423f8, 0x24420030,
-	0x00a22821, 0x94a20004, 0x3c030800, 0x8c6323ec, 0x00441023, 0x00621821,
-	0x00603821, 0x00032402, 0x30e2ffff, 0x00823821, 0x00071402, 0x00e23821,
-	0x00071027, 0x3c010800, 0xac2323ec, 0xa4a20006, 0x3c030800, 0x8c6323f4,
-	0x3c0200ff, 0x3442fff8, 0x00628824, 0x96220008, 0x24040001, 0x24034000,
-	0x000241c0, 0x00e01021, 0xa502001a, 0xa500001c, 0xacc00000, 0x3c010800,
-	0xac241b50, 0xaf635cb8, 0x8f625cb0, 0x30420002, 0x10400003, 0x00000000,
-	0x3c010800, 0xac201b50, 0x8e220008, 0xaf625cb8, 0x8f625cb0, 0x30420002,
-	0x10400003, 0x00000000, 0x3c010800, 0xac201b50, 0x3c020800, 0x8c421b50,
-	0x1040ffec, 0x00000000, 0x3c040800, 0x0e000637, 0x8c8423f4, 0x0a00032c,
-	0x00000000, 0x3c030800, 0x90631b88, 0x24020002, 0x14620003, 0x3c034b65,
-	0x0a0002e3, 0x00008021, 0x8e22001c, 0x34637654, 0x10430002, 0x24100002,
-	0x24100001, 0x01002021, 0x0e000352, 0x02003021, 0x24020003, 0x3c010800,
-	0xa0221b88, 0x24020002, 0x1202000a, 0x24020001, 0x3c030800, 0x8c6323e0,
-	0x10620006, 0x00000000, 0x3c020800, 0x944223c8, 0x00021400, 0x0a000321,
-	0xae220014, 0x3c040800, 0x248423ca, 0x94820000, 0x00021400, 0xae220014,
-	0x3c020800, 0x8c421bac, 0x3c03c000, 0x3c010800, 0xa0201b88, 0x00431025,
-	0xaf625c5c, 0x8f625c50, 0x30420002, 0x10400009, 0x00000000, 0x2484f7e2,
-	0x8c820000, 0x00431025, 0xaf625c5c, 0x8f625c50, 0x30420002, 0x1440fffa,
-	0x00000000, 0x3c020800, 0x24421b74, 0x8c430000, 0x24630001, 0xac430000,
-	0x8f630c14, 0x3063000f, 0x2c620002, 0x1440000c, 0x3c024000, 0x8f630c14,
-	0x3c020800, 0x8c421b30, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b30,
-	0x2c620002, 0x1040fff7, 0x00000000, 0x3c024000, 0x02421825, 0xaf635c9c,
-	0x8f625c90, 0x30420002, 0x1440fffc, 0x00000000, 0x12600003, 0x00000000,
-	0x0e0004bf, 0x00000000, 0x8fbf0028, 0x8fb30024, 0x8fb20020, 0x8fb1001c,
-	0x8fb00018, 0x03e00008, 0x27bd0030, 0x8f634450, 0x3c040800, 0x24841b78,
-	0x8c820000, 0x00031c02, 0x0043102b, 0x14400007, 0x3c038000, 0x8c840004,
-	0x8f624450, 0x00021c02, 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444,
-	0x8f624444, 0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008,
-	0x3042ffff, 0x3c024000, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002,
-	0x1440fffc, 0x00000000, 0x03e00008, 0x00000000, 0x27bdffe0, 0x00805821,
-	0x14c00011, 0x256e0008, 0x3c020800, 0x8c4223e4, 0x10400007, 0x24020016,
-	0x3c010800, 0xa42223c2, 0x2402002a, 0x3c010800, 0x0a000366, 0xa42223c4,
-	0x8d670010, 0x00071402, 0x3c010800, 0xa42223c2, 0x3c010800, 0xa42723c4,
-	0x3c040800, 0x948423c4, 0x3c030800, 0x946323c2, 0x95cf0006, 0x3c020800,
-	0x944223c0, 0x00832023, 0x01e2c023, 0x3065ffff, 0x24a20028, 0x01c24821,
-	0x3082ffff, 0x14c0001a, 0x01226021, 0x9582000c, 0x3042003f, 0x3c010800,
-	0xa42223c6, 0x95820004, 0x95830006, 0x3c010800, 0xac2023d4, 0x3c010800,
-	0xac2023d8, 0x00021400, 0x00431025, 0x3c010800, 0xac221bb0, 0x95220004,
-	0x3c010800, 0xa4221bb4, 0x95230002, 0x01e51023, 0x0043102a, 0x10400010,
-	0x24020001, 0x3c010800, 0x0a00039a, 0xac2223e8, 0x3c030800, 0x8c6323d8,
-	0x3c020800, 0x94421bb4, 0x00431021, 0xa5220004, 0x3c020800, 0x94421bb0,
-	0xa5820004, 0x3c020800, 0x8c421bb0, 0xa5820006, 0x3c020800, 0x8c4223e0,
-	0x3c0d0800, 0x8dad23d4, 0x3c0a0800, 0x144000e5, 0x8d4a23d8, 0x3c020800,
-	0x94421bb4, 0x004a1821, 0x3063ffff, 0x0062182b, 0x24020002, 0x10c2000d,
-	0x01435023, 0x3c020800, 0x944223c6, 0x30420009, 0x10400008, 0x00000000,
-	0x9582000c, 0x3042fff6, 0xa582000c, 0x3c020800, 0x944223c6, 0x30420009,
-	0x01a26823, 0x3c020800, 0x8c4223e8, 0x1040004a, 0x01203821, 0x3c020800,
-	0x944223c2, 0x00004021, 0xa520000a, 0x01e21023, 0xa5220002, 0x3082ffff,
-	0x00021042, 0x18400008, 0x00003021, 0x00401821, 0x94e20000, 0x25080001,
-	0x00c23021, 0x0103102a, 0x1440fffb, 0x24e70002, 0x00061c02, 0x30c2ffff,
-	0x00623021, 0x00061402, 0x00c23021, 0x00c02821, 0x00061027, 0xa522000a,
-	0x00003021, 0x2527000c, 0x00004021, 0x94e20000, 0x25080001, 0x00c23021,
-	0x2d020004, 0x1440fffb, 0x24e70002, 0x95220002, 0x00004021, 0x91230009,
-	0x00442023, 0x01803821, 0x3082ffff, 0xa4e00010, 0x00621821, 0x00021042,
-	0x18400010, 0x00c33021, 0x00404821, 0x94e20000, 0x24e70002, 0x00c23021,
+	0x3c110800, 0x02308821, 0x0e000625, 0x8e311bc8, 0x00402821, 0x10a00054,
+	0x00000000, 0x9628000a, 0x31020040, 0x10400005, 0x2407180c, 0x8e22000c,
+	0x2407188c, 0x00021400, 0xaca20018, 0x3c030800, 0x00701821, 0x8c631bd0,
+	0x3c020800, 0x00501021, 0x8c421bd4, 0x00031d00, 0x00021400, 0x00621825,
+	0xaca30014, 0x8ec30004, 0x96220008, 0x00432023, 0x3242ffff, 0x3083ffff,
+	0x00431021, 0x0282102a, 0x14400002, 0x02b23023, 0x00803021, 0x8e620000,
+	0x30c4ffff, 0x00441021, 0xae620000, 0x8e220000, 0xaca20000, 0x8e220004,
+	0x8e63fff4, 0x00431021, 0xaca20004, 0xa4a6000e, 0x8e62fff4, 0x00441021,
+	0xae62fff4, 0x96230008, 0x0043102a, 0x14400005, 0x02469021, 0x8e62fff0,
+	0xae60fff4, 0x24420001, 0xae62fff0, 0xaca00008, 0x3242ffff, 0x14540008,
+	0x24020305, 0x31020080, 0x54400001, 0x34e70010, 0x24020905, 0xa4a2000c,
+	0x0a0001cb, 0x34e70020, 0xa4a2000c, 0x3c020800, 0x8c4223f0, 0x10400003,
+	0x3c024b65, 0x0a0001d3, 0x34427654, 0x3c02b49a, 0x344289ab, 0xaca2001c,
+	0x30e2ffff, 0xaca20010, 0x0e0005a2, 0x00a02021, 0x3242ffff, 0x0054102b,
+	0x1440ffa9, 0x00000000, 0x24020002, 0x3c010800, 0x0a0001e6, 0xa0221b98,
+	0x8ec2083c, 0x24420001, 0x0a0001e6, 0xaec2083c, 0x0e0004c0, 0x00000000,
+	0x8fbf002c, 0x8fb60028, 0x8fb50024, 0x8fb40020, 0x8fb3001c, 0x8fb20018,
+	0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0030, 0x27bdffd0, 0xafbf0028,
+	0xafb30024, 0xafb20020, 0xafb1001c, 0xafb00018, 0x8f725c9c, 0x3c0200ff,
+	0x3442fff8, 0x3c070800, 0x24e71bb4, 0x02428824, 0x9623000e, 0x8ce20000,
+	0x00431021, 0xace20000, 0x8e220010, 0x30420020, 0x14400011, 0x00809821,
+	0x0e00063b, 0x02202021, 0x3c02c000, 0x02421825, 0xaf635c9c, 0x8f625c90,
+	0x30420002, 0x1040011e, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002,
+	0x10400119, 0x00000000, 0x0a00020d, 0x00000000, 0x8e240008, 0x8e230014,
+	0x00041402, 0x000231c0, 0x00031502, 0x304201ff, 0x2442ffff, 0x3042007f,
+	0x00031942, 0x30637800, 0x00021100, 0x24424000, 0x00624821, 0x9522000a,
+	0x3084ffff, 0x30420008, 0x104000b0, 0x000429c0, 0x3c020800, 0x8c422400,
+	0x14400024, 0x24c50008, 0x94c20014, 0x3c010800, 0xa42223d0, 0x8cc40010,
+	0x00041402, 0x3c010800, 0xa42223d2, 0x3c010800, 0xa42423d4, 0x94c2000e,
+	0x3083ffff, 0x00431023, 0x3c010800, 0xac222408, 0x94c2001a, 0x3c010800,
+	0xac262400, 0x3c010800, 0xac322404, 0x3c010800, 0xac2223fc, 0x3c02c000,
+	0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x104000e5, 0x00000000,
+	0xaf635c9c, 0x8f625c90, 0x30420002, 0x104000e0, 0x00000000, 0x0a000246,
+	0x00000000, 0x94c2000e, 0x3c030800, 0x946323d4, 0x00434023, 0x3103ffff,
+	0x2c620008, 0x1040001c, 0x00000000, 0x94c20014, 0x24420028, 0x00a22821,
+	0x00031042, 0x1840000b, 0x00002021, 0x24e60848, 0x00403821, 0x94a30000,
+	0x8cc20000, 0x24840001, 0x00431021, 0xacc20000, 0x0087102a, 0x1440fff9,
+	0x24a50002, 0x31020001, 0x1040001f, 0x3c024000, 0x3c040800, 0x248423fc,
+	0xa0a00001, 0x94a30000, 0x8c820000, 0x00431021, 0x0a000285, 0xac820000,
+	0x8f626800, 0x3c030010, 0x00431024, 0x10400009, 0x00000000, 0x94c2001a,
+	0x3c030800, 0x8c6323fc, 0x00431021, 0x3c010800, 0xac2223fc, 0x0a000286,
+	0x3c024000, 0x94c2001a, 0x94c4001c, 0x3c030800, 0x8c6323fc, 0x00441023,
+	0x00621821, 0x3c010800, 0xac2323fc, 0x3c024000, 0x02421825, 0xaf635c9c,
+	0x8f625c90, 0x30420002, 0x1440fffc, 0x00000000, 0x9522000a, 0x30420010,
+	0x1040009b, 0x00000000, 0x3c030800, 0x946323d4, 0x3c070800, 0x24e72400,
+	0x8ce40000, 0x8f626800, 0x24630030, 0x00832821, 0x3c030010, 0x00431024,
+	0x1440000a, 0x00000000, 0x94a20004, 0x3c040800, 0x8c842408, 0x3c030800,
+	0x8c6323fc, 0x00441023, 0x00621821, 0x3c010800, 0xac2323fc, 0x3c040800,
+	0x8c8423fc, 0x00041c02, 0x3082ffff, 0x00622021, 0x00041402, 0x00822021,
+	0x00041027, 0xa4a20006, 0x3c030800, 0x8c632404, 0x3c0200ff, 0x3442fff8,
+	0x00628824, 0x96220008, 0x24050001, 0x24034000, 0x000231c0, 0x00801021,
+	0xa4c2001a, 0xa4c0001c, 0xace00000, 0x3c010800, 0xac251b60, 0xaf635cb8,
+	0x8f625cb0, 0x30420002, 0x10400003, 0x00000000, 0x3c010800, 0xac201b60,
+	0x8e220008, 0xaf625cb8, 0x8f625cb0, 0x30420002, 0x10400003, 0x00000000,
+	0x3c010800, 0xac201b60, 0x3c020800, 0x8c421b60, 0x1040ffec, 0x00000000,
+	0x3c040800, 0x0e00063b, 0x8c842404, 0x0a00032a, 0x00000000, 0x3c030800,
+	0x90631b98, 0x24020002, 0x14620003, 0x3c034b65, 0x0a0002e1, 0x00008021,
+	0x8e22001c, 0x34637654, 0x10430002, 0x24100002, 0x24100001, 0x00c02021,
+	0x0e000350, 0x02003021, 0x24020003, 0x3c010800, 0xa0221b98, 0x24020002,
+	0x1202000a, 0x24020001, 0x3c030800, 0x8c6323f0, 0x10620006, 0x00000000,
+	0x3c020800, 0x944223d8, 0x00021400, 0x0a00031f, 0xae220014, 0x3c040800,
+	0x248423da, 0x94820000, 0x00021400, 0xae220014, 0x3c020800, 0x8c421bbc,
+	0x3c03c000, 0x3c010800, 0xa0201b98, 0x00431025, 0xaf625c5c, 0x8f625c50,
+	0x30420002, 0x10400009, 0x00000000, 0x2484f7e2, 0x8c820000, 0x00431025,
+	0xaf625c5c, 0x8f625c50, 0x30420002, 0x1440fffa, 0x00000000, 0x3c020800,
+	0x24421b84, 0x8c430000, 0x24630001, 0xac430000, 0x8f630c14, 0x3063000f,
+	0x2c620002, 0x1440000c, 0x3c024000, 0x8f630c14, 0x3c020800, 0x8c421b40,
+	0x3063000f, 0x24420001, 0x3c010800, 0xac221b40, 0x2c620002, 0x1040fff7,
+	0x00000000, 0x3c024000, 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002,
+	0x1440fffc, 0x00000000, 0x12600003, 0x00000000, 0x0e0004c0, 0x00000000,
+	0x8fbf0028, 0x8fb30024, 0x8fb20020, 0x8fb1001c, 0x8fb00018, 0x03e00008,
+	0x27bd0030, 0x8f634450, 0x3c040800, 0x24841b88, 0x8c820000, 0x00031c02,
+	0x0043102b, 0x14400007, 0x3c038000, 0x8c840004, 0x8f624450, 0x00021c02,
+	0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024,
+	0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff, 0x3c024000,
+	0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc, 0x00000000,
+	0x03e00008, 0x00000000, 0x27bdffe0, 0x00805821, 0x14c00011, 0x256e0008,
+	0x3c020800, 0x8c4223f4, 0x10400007, 0x24020016, 0x3c010800, 0xa42223d2,
+	0x2402002a, 0x3c010800, 0x0a000364, 0xa42223d4, 0x8d670010, 0x00071402,
+	0x3c010800, 0xa42223d2, 0x3c010800, 0xa42723d4, 0x3c040800, 0x948423d4,
+	0x3c030800, 0x946323d2, 0x95cf0006, 0x3c020800, 0x944223d0, 0x00832023,
+	0x01e2c023, 0x3065ffff, 0x24a20028, 0x01c24821, 0x3082ffff, 0x14c0001a,
+	0x01226021, 0x9582000c, 0x3042003f, 0x3c010800, 0xa42223d6, 0x95820004,
+	0x95830006, 0x3c010800, 0xac2023e4, 0x3c010800, 0xac2023e8, 0x00021400,
+	0x00431025, 0x3c010800, 0xac221bc0, 0x95220004, 0x3c010800, 0xa4221bc4,
+	0x95230002, 0x01e51023, 0x0043102a, 0x10400010, 0x24020001, 0x3c010800,
+	0x0a000398, 0xac2223f8, 0x3c030800, 0x8c6323e8, 0x3c020800, 0x94421bc4,
+	0x00431021, 0xa5220004, 0x3c020800, 0x94421bc0, 0xa5820004, 0x3c020800,
+	0x8c421bc0, 0xa5820006, 0x3c020800, 0x8c4223f0, 0x3c0d0800, 0x8dad23e4,
+	0x3c0a0800, 0x144000e5, 0x8d4a23e8, 0x3c020800, 0x94421bc4, 0x004a1821,
+	0x3063ffff, 0x0062182b, 0x24020002, 0x10c2000d, 0x01435023, 0x3c020800,
+	0x944223d6, 0x30420009, 0x10400008, 0x00000000, 0x9582000c, 0x3042fff6,
+	0xa582000c, 0x3c020800, 0x944223d6, 0x30420009, 0x01a26823, 0x3c020800,
+	0x8c4223f8, 0x1040004a, 0x01203821, 0x3c020800, 0x944223d2, 0x00004021,
+	0xa520000a, 0x01e21023, 0xa5220002, 0x3082ffff, 0x00021042, 0x18400008,
+	0x00003021, 0x00401821, 0x94e20000, 0x25080001, 0x00c23021, 0x0103102a,
+	0x1440fffb, 0x24e70002, 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061402,
+	0x00c23021, 0x00c02821, 0x00061027, 0xa522000a, 0x00003021, 0x2527000c,
+	0x00004021, 0x94e20000, 0x25080001, 0x00c23021, 0x2d020004, 0x1440fffb,
+	0x24e70002, 0x95220002, 0x00004021, 0x91230009, 0x00442023, 0x01803821,
+	0x3082ffff, 0xa4e00010, 0x00621821, 0x00021042, 0x18400010, 0x00c33021,
+	0x00404821, 0x94e20000, 0x24e70002, 0x00c23021, 0x30e2007f, 0x14400006,
+	0x25080001, 0x8d630000, 0x3c02007f, 0x3442ff80, 0x00625824, 0x25670008,
+	0x0109102a, 0x1440fff3, 0x00000000, 0x30820001, 0x10400005, 0x00061c02,
+	0xa0e00001, 0x94e20000, 0x00c23021, 0x00061c02, 0x30c2ffff, 0x00623021,
+	0x00061402, 0x00c23021, 0x0a00047d, 0x30c6ffff, 0x24020002, 0x14c20081,
+	0x00000000, 0x3c020800, 0x8c42240c, 0x14400007, 0x00000000, 0x3c020800,
+	0x944223d2, 0x95230002, 0x01e21023, 0x10620077, 0x00000000, 0x3c020800,
+	0x944223d2, 0x01e21023, 0xa5220002, 0x3c020800, 0x8c42240c, 0x1040001a,
+	0x31e3ffff, 0x8dc70010, 0x3c020800, 0x94421b96, 0x00e04021, 0x00072c02,
+	0x00aa2021, 0x00431023, 0x00823823, 0x00072402, 0x30e2ffff, 0x00823821,
+	0x00071027, 0xa522000a, 0x3102ffff, 0x3c040800, 0x948423d4, 0x00453023,
+	0x00e02821, 0x00641823, 0x006d1821, 0x00c33021, 0x00061c02, 0x30c2ffff,
+	0x0a00047d, 0x00623021, 0x01203821, 0x00004021, 0x3082ffff, 0x00021042,
+	0x18400008, 0x00003021, 0x00401821, 0x94e20000, 0x25080001, 0x00c23021,
+	0x0103102a, 0x1440fffb, 0x24e70002, 0x00061c02, 0x30c2ffff, 0x00623021,
+	0x00061402, 0x00c23021, 0x00c02821, 0x00061027, 0xa522000a, 0x00003021,
+	0x2527000c, 0x00004021, 0x94e20000, 0x25080001, 0x00c23021, 0x2d020004,
+	0x1440fffb, 0x24e70002, 0x95220002, 0x00004021, 0x91230009, 0x00442023,
+	0x01803821, 0x3082ffff, 0xa4e00010, 0x3c040800, 0x948423d4, 0x00621821,
+	0x00c33021, 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061c02, 0x3c020800,
+	0x944223d0, 0x00c34821, 0x00441023, 0x00021fc2, 0x00431021, 0x00021043,
+	0x18400010, 0x00003021, 0x00402021, 0x94e20000, 0x24e70002, 0x00c23021,
 	0x30e2007f, 0x14400006, 0x25080001, 0x8d630000, 0x3c02007f, 0x3442ff80,
-	0x00625824, 0x25670008, 0x0109102a, 0x1440fff3, 0x00000000, 0x30820001,
-	0x10400005, 0x00061c02, 0xa0e00001, 0x94e20000, 0x00c23021, 0x00061c02,
-	0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x0a00047f, 0x30c6ffff,
-	0x24020002, 0x14c20081, 0x00000000, 0x3c020800, 0x8c4223fc, 0x14400007,
-	0x00000000, 0x3c020800, 0x944223c2, 0x95230002, 0x01e21023, 0x10620077,
-	0x00000000, 0x3c020800, 0x944223c2, 0x01e21023, 0xa5220002, 0x3c020800,
-	0x8c4223fc, 0x1040001a, 0x31e3ffff, 0x8dc70010, 0x3c020800, 0x94421b86,
-	0x00e04021, 0x00072c02, 0x00aa2021, 0x00431023, 0x00823823, 0x00072402,
-	0x30e2ffff, 0x00823821, 0x00071027, 0xa522000a, 0x3102ffff, 0x3c040800,
-	0x948423c4, 0x00453023, 0x00e02821, 0x00641823, 0x006d1821, 0x00c33021,
-	0x00061c02, 0x30c2ffff, 0x0a00047f, 0x00623021, 0x01203821, 0x00004021,
-	0x3082ffff, 0x00021042, 0x18400008, 0x00003021, 0x00401821, 0x94e20000,
-	0x25080001, 0x00c23021, 0x0103102a, 0x1440fffb, 0x24e70002, 0x00061c02,
-	0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c02821, 0x00061027,
-	0xa522000a, 0x00003021, 0x2527000c, 0x00004021, 0x94e20000, 0x25080001,
-	0x00c23021, 0x2d020004, 0x1440fffb, 0x24e70002, 0x95220002, 0x00004021,
-	0x91230009, 0x00442023, 0x01803821, 0x3082ffff, 0xa4e00010, 0x3c040800,
-	0x948423c4, 0x00621821, 0x00c33021, 0x00061c02, 0x30c2ffff, 0x00623021,
-	0x00061c02, 0x3c020800, 0x944223c0, 0x00c34821, 0x00441023, 0x00021fc2,
-	0x00431021, 0x00021043, 0x18400010, 0x00003021, 0x00402021, 0x94e20000,
-	0x24e70002, 0x00c23021, 0x30e2007f, 0x14400006, 0x25080001, 0x8d630000,
-	0x3c02007f, 0x3442ff80, 0x00625824, 0x25670008, 0x0104102a, 0x1440fff3,
-	0x00000000, 0x3c020800, 0x944223dc, 0x00c23021, 0x3122ffff, 0x00c23021,
-	0x00061c02, 0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c04021,
-	0x00061027, 0xa5820010, 0xadc00014, 0x0a00049f, 0xadc00000, 0x8dc70010,
-	0x00e04021, 0x11400007, 0x00072c02, 0x00aa3021, 0x00061402, 0x30c3ffff,
-	0x00433021, 0x00061402, 0x00c22821, 0x00051027, 0xa522000a, 0x3c030800,
-	0x946323c4, 0x3102ffff, 0x01e21021, 0x00433023, 0x00cd3021, 0x00061c02,
-	0x30c2ffff, 0x00623021, 0x00061402, 0x00c23021, 0x00c04021, 0x00061027,
-	0xa5820010, 0x3102ffff, 0x00051c00, 0x00431025, 0xadc20010, 0x3c020800,
-	0x8c4223e4, 0x10400002, 0x25e2fff2, 0xa5c20034, 0x3c020800, 0x8c4223d8,
-	0x3c040800, 0x8c8423d4, 0x24420001, 0x3c010800, 0xac2223d8, 0x3c020800,
-	0x8c421bb0, 0x3303ffff, 0x00832021, 0x3c010800, 0xac2423d4, 0x00431821,
-	0x0062102b, 0x10400003, 0x2482ffff, 0x3c010800, 0xac2223d4, 0x3c010800,
-	0xac231bb0, 0x03e00008, 0x27bd0020, 0x27bdffb8, 0x3c050800, 0x24a51b86,
-	0xafbf0044, 0xafbe0040, 0xafb7003c, 0xafb60038, 0xafb50034, 0xafb40030,
-	0xafb3002c, 0xafb20028, 0xafb10024, 0xafb00020, 0x94a90000, 0x3c020800,
-	0x944223c0, 0x3c030800, 0x8c631ba0, 0x3c040800, 0x8c841b9c, 0x01221023,
-	0x0064182a, 0xa7a9001e, 0x106000bc, 0xa7a20016, 0x24be0022, 0x97b6001e,
-	0x24b3001a, 0x24b70016, 0x8fc20000, 0x14400008, 0x00000000, 0x8fc2fff8,
-	0x97a30016, 0x8fc4fff4, 0x00431021, 0x0082202a, 0x148000ae, 0x00000000,
-	0x97d50818, 0x32a2ffff, 0x104000a1, 0x00009021, 0x0040a021, 0x00008821,
-	0x0e000621, 0x00000000, 0x00403021, 0x14c00007, 0x00000000, 0x3c020800,
-	0x8c4223cc, 0x24420001, 0x3c010800, 0x0a000593, 0xac2223cc, 0x3c100800,
-	0x02118021, 0x8e101bb8, 0x9608000a, 0x31020040, 0x10400004, 0x2407180c,
-	0x8e02000c, 0x2407188c, 0xacc20018, 0x31020080, 0x54400001, 0x34e70010,
-	0x3c020800, 0x00511021, 0x8c421bc0, 0x3c030800, 0x00711821, 0x8c631bc4,
-	0x00021500, 0x00031c00, 0x00431025, 0xacc20014, 0x96040008, 0x3242ffff,
-	0x00821021, 0x0282102a, 0x14400002, 0x02b22823, 0x00802821, 0x8e020000,
-	0x02459021, 0xacc20000, 0x8e020004, 0x00c02021, 0x26310010, 0xac820004,
-	0x30e2ffff, 0xac800008, 0xa485000e, 0xac820010, 0x24020305, 0x0e00059f,
-	0xa482000c, 0x3242ffff, 0x0054102b, 0x1440ffc6, 0x3242ffff, 0x0a00058b,
-	0x00000000, 0x8e620000, 0x8e63fffc, 0x0043102a, 0x10400066, 0x00000000,
-	0x8e62fff0, 0x00028900, 0x3c100800, 0x02118021, 0x0e000621, 0x8e101bb8,
-	0x00403021, 0x14c00005, 0x00000000, 0x8e62082c, 0x24420001, 0x0a000593,
-	0xae62082c, 0x9608000a, 0x31020040, 0x10400004, 0x2407180c, 0x8e02000c,
-	0x2407188c, 0xacc20018, 0x3c020800, 0x00511021, 0x8c421bc0, 0x3c030800,
-	0x00711821, 0x8c631bc4, 0x00021500, 0x00031c00, 0x00431025, 0xacc20014,
-	0x8e63fff4, 0x96020008, 0x00432023, 0x3242ffff, 0x3083ffff, 0x00431021,
-	0x02c2102a, 0x10400003, 0x00802821, 0x97a9001e, 0x01322823, 0x8e620000,
-	0x30a4ffff, 0x00441021, 0xae620000, 0xa4c5000e, 0x8e020000, 0xacc20000,
-	0x8e020004, 0x8e63fff4, 0x00431021, 0xacc20004, 0x8e63fff4, 0x96020008,
-	0x00641821, 0x0062102a, 0x14400006, 0x02459021, 0x8e62fff0, 0xae60fff4,
-	0x24420001, 0x0a00056e, 0xae62fff0, 0xae63fff4, 0xacc00008, 0x3242ffff,
-	0x10560003, 0x31020004, 0x10400006, 0x24020305, 0x31020080, 0x54400001,
-	0x34e70010, 0x34e70020, 0x24020905, 0xa4c2000c, 0x8ee30000, 0x8ee20004,
-	0x14620007, 0x3c02b49a, 0x8ee20860, 0x54400001, 0x34e70400, 0x3c024b65,
-	0x0a000585, 0x34427654, 0x344289ab, 0xacc2001c, 0x30e2ffff, 0xacc20010,
-	0x0e00059f, 0x00c02021, 0x3242ffff, 0x0056102b, 0x1440ff9c, 0x00000000,
-	0x8e620000, 0x8e63fffc, 0x0043102a, 0x1440ff4a, 0x00000000, 0x8fbf0044,
-	0x8fbe0040, 0x8fb7003c, 0x8fb60038, 0x8fb50034, 0x8fb40030, 0x8fb3002c,
-	0x8fb20028, 0x8fb10024, 0x8fb00020, 0x03e00008, 0x27bd0048, 0x27bdffe8,
-	0xafbf0014, 0xafb00010, 0x8f624450, 0x8f634410, 0x0a0005ae, 0x00808021,
-	0x8f626820, 0x30422000, 0x10400003, 0x00000000, 0x0e0001ef, 0x00002021,
-	0x8f624450, 0x8f634410, 0x3042ffff, 0x0043102b, 0x1440fff5, 0x00000000,
-	0x8f630c14, 0x3063000f, 0x2c620002, 0x1440000b, 0x00000000, 0x8f630c14,
-	0x3c020800, 0x8c421b30, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b30,
-	0x2c620002, 0x1040fff7, 0x00000000, 0xaf705c18, 0x8f625c10, 0x30420002,
-	0x10400009, 0x00000000, 0x8f626820, 0x30422000, 0x1040fff8, 0x00000000,
-	0x0e0001ef, 0x00002021, 0x0a0005c1, 0x00000000, 0x8fbf0014, 0x8fb00010,
-	0x03e00008, 0x27bd0018, 0x00000000, 0x00000000, 0x27bdffe8, 0x3c1bc000,
-	0xafbf0014, 0xafb00010, 0xaf60680c, 0x8f626804, 0x34420082, 0xaf626804,
-	0x8f634000, 0x24020b50, 0x3c010800, 0xac221b44, 0x24020b78, 0x3c010800,
-	0xac221b54, 0x34630002, 0xaf634000, 0x0e000601, 0x00808021, 0x3c010800,
-	0xa0221b58, 0x304200ff, 0x24030002, 0x14430005, 0x00000000, 0x3c020800,
-	0x8c421b44, 0x0a0005f4, 0xac5000c0, 0x3c020800, 0x8c421b44, 0xac5000bc,
-	0x8f624434, 0x8f634438, 0x8f644410, 0x3c010800, 0xac221b4c, 0x3c010800,
-	0xac231b5c, 0x3c010800, 0xac241b48, 0x8fbf0014, 0x8fb00010, 0x03e00008,
-	0x27bd0018, 0x3c040800, 0x8c870000, 0x3c03aa55, 0x3463aa55, 0x3c06c003,
-	0xac830000, 0x8cc20000, 0x14430007, 0x24050002, 0x3c0355aa, 0x346355aa,
-	0xac830000, 0x8cc20000, 0x50430001, 0x24050001, 0x3c020800, 0xac470000,
-	0x03e00008, 0x00a01021, 0x27bdfff8, 0x18800009, 0x00002821, 0x8f63680c,
-	0x8f62680c, 0x1043fffe, 0x00000000, 0x24a50001, 0x00a4102a, 0x1440fff9,
-	0x00000000, 0x03e00008, 0x27bd0008, 0x8f634450, 0x3c020800, 0x8c421b4c,
-	0x00031c02, 0x0043102b, 0x14400008, 0x3c038000, 0x3c040800, 0x8c841b5c,
-	0x8f624450, 0x00021c02, 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444,
-	0x8f624444, 0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008,
-	0x3042ffff, 0x3082ffff, 0x2442e000, 0x2c422001, 0x14400003, 0x3c024000,
-	0x0a000644, 0x2402ffff, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002,
-	0x1440fffc, 0x00001021, 0x03e00008, 0x00000000, 0x8f624450, 0x3c030800,
-	0x8c631b48, 0x0a00064d, 0x3042ffff, 0x8f624450, 0x3042ffff, 0x0043102b,
-	0x1440fffc, 0x00000000, 0x03e00008, 0x00000000, 0x27bdffe0, 0x00802821,
-	0x3c040800, 0x24841ae0, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010,
-	0x0e000678, 0xafa00014, 0x0a00065c, 0x00000000, 0x8fbf0018, 0x03e00008,
-	0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x3c020800, 0x34423000,
-	0x3c030800, 0x34633000, 0x3c040800, 0x348437ff, 0x3c010800, 0xac221b64,
-	0x24020040, 0x3c010800, 0xac221b68, 0x3c010800, 0xac201b60, 0xac600000,
-	0x24630004, 0x0083102b, 0x5040fffd, 0xac600000, 0x03e00008, 0x00000000,
-	0x00804821, 0x8faa0010, 0x3c020800, 0x8c421b60, 0x3c040800, 0x8c841b68,
-	0x8fab0014, 0x24430001, 0x0044102b, 0x3c010800, 0xac231b60, 0x14400003,
-	0x00004021, 0x3c010800, 0xac201b60, 0x3c020800, 0x8c421b60, 0x3c030800,
-	0x8c631b64, 0x91240000, 0x00021140, 0x00431021, 0x00481021, 0x25080001,
-	0xa0440000, 0x29020008, 0x1440fff4, 0x25290001, 0x3c020800, 0x8c421b60,
-	0x3c030800, 0x8c631b64, 0x8f64680c, 0x00021140, 0x00431021, 0xac440008,
-	0xac45000c, 0xac460010, 0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c,
-	0x00000000, 0x00000000,
+	0x00625824, 0x25670008, 0x0104102a, 0x1440fff3, 0x00000000, 0x3c020800,
+	0x944223ec, 0x00c23021, 0x3122ffff, 0x00c23021, 0x00061c02, 0x30c2ffff,
+	0x00623021, 0x00061402, 0x00c23021, 0x00c04021, 0x00061027, 0xa5820010,
+	0xadc00014, 0x0a00049d, 0xadc00000, 0x8dc70010, 0x00e04021, 0x11400007,
+	0x00072c02, 0x00aa3021, 0x00061402, 0x30c3ffff, 0x00433021, 0x00061402,
+	0x00c22821, 0x00051027, 0xa522000a, 0x3c030800, 0x946323d4, 0x3102ffff,
+	0x01e21021, 0x00433023, 0x00cd3021, 0x00061c02, 0x30c2ffff, 0x00623021,
+	0x00061402, 0x00c23021, 0x00c04021, 0x00061027, 0xa5820010, 0x3102ffff,
+	0x00051c00, 0x00431025, 0xadc20010, 0x3c020800, 0x8c4223f4, 0x10400005,
+	0x2de205eb, 0x14400002, 0x25e2fff2, 0x34028870, 0xa5c20034, 0x3c030800,
+	0x246323e8, 0x8c620000, 0x24420001, 0xac620000, 0x3c040800, 0x8c8423e4,
+	0x3c020800, 0x8c421bc0, 0x3303ffff, 0x00832021, 0x00431821, 0x0062102b,
+	0x3c010800, 0xac2423e4, 0x10400003, 0x2482ffff, 0x3c010800, 0xac2223e4,
+	0x3c010800, 0xac231bc0, 0x03e00008, 0x27bd0020, 0x27bdffb8, 0x3c050800,
+	0x24a51b96, 0xafbf0044, 0xafbe0040, 0xafb7003c, 0xafb60038, 0xafb50034,
+	0xafb40030, 0xafb3002c, 0xafb20028, 0xafb10024, 0xafb00020, 0x94a90000,
+	0x3c020800, 0x944223d0, 0x3c030800, 0x8c631bb0, 0x3c040800, 0x8c841bac,
+	0x01221023, 0x0064182a, 0xa7a9001e, 0x106000be, 0xa7a20016, 0x24be0022,
+	0x97b6001e, 0x24b3001a, 0x24b70016, 0x8fc20000, 0x14400008, 0x00000000,
+	0x8fc2fff8, 0x97a30016, 0x8fc4fff4, 0x00431021, 0x0082202a, 0x148000b0,
+	0x00000000, 0x97d50818, 0x32a2ffff, 0x104000a3, 0x00009021, 0x0040a021,
+	0x00008821, 0x0e000625, 0x00000000, 0x00403021, 0x14c00007, 0x00000000,
+	0x3c020800, 0x8c4223dc, 0x24420001, 0x3c010800, 0x0a000596, 0xac2223dc,
+	0x3c100800, 0x02118021, 0x8e101bc8, 0x9608000a, 0x31020040, 0x10400005,
+	0x2407180c, 0x8e02000c, 0x2407188c, 0x00021400, 0xacc20018, 0x31020080,
+	0x54400001, 0x34e70010, 0x3c020800, 0x00511021, 0x8c421bd0, 0x3c030800,
+	0x00711821, 0x8c631bd4, 0x00021500, 0x00031c00, 0x00431025, 0xacc20014,
+	0x96040008, 0x3242ffff, 0x00821021, 0x0282102a, 0x14400002, 0x02b22823,
+	0x00802821, 0x8e020000, 0x02459021, 0xacc20000, 0x8e020004, 0x00c02021,
+	0x26310010, 0xac820004, 0x30e2ffff, 0xac800008, 0xa485000e, 0xac820010,
+	0x24020305, 0x0e0005a2, 0xa482000c, 0x3242ffff, 0x0054102b, 0x1440ffc5,
+	0x3242ffff, 0x0a00058e, 0x00000000, 0x8e620000, 0x8e63fffc, 0x0043102a,
+	0x10400067, 0x00000000, 0x8e62fff0, 0x00028900, 0x3c100800, 0x02118021,
+	0x0e000625, 0x8e101bc8, 0x00403021, 0x14c00005, 0x00000000, 0x8e62082c,
+	0x24420001, 0x0a000596, 0xae62082c, 0x9608000a, 0x31020040, 0x10400005,
+	0x2407180c, 0x8e02000c, 0x2407188c, 0x00021400, 0xacc20018, 0x3c020800,
+	0x00511021, 0x8c421bd0, 0x3c030800, 0x00711821, 0x8c631bd4, 0x00021500,
+	0x00031c00, 0x00431025, 0xacc20014, 0x8e63fff4, 0x96020008, 0x00432023,
+	0x3242ffff, 0x3083ffff, 0x00431021, 0x02c2102a, 0x10400003, 0x00802821,
+	0x97a9001e, 0x01322823, 0x8e620000, 0x30a4ffff, 0x00441021, 0xae620000,
+	0xa4c5000e, 0x8e020000, 0xacc20000, 0x8e020004, 0x8e63fff4, 0x00431021,
+	0xacc20004, 0x8e63fff4, 0x96020008, 0x00641821, 0x0062102a, 0x14400006,
+	0x02459021, 0x8e62fff0, 0xae60fff4, 0x24420001, 0x0a000571, 0xae62fff0,
+	0xae63fff4, 0xacc00008, 0x3242ffff, 0x10560003, 0x31020004, 0x10400006,
+	0x24020305, 0x31020080, 0x54400001, 0x34e70010, 0x34e70020, 0x24020905,
+	0xa4c2000c, 0x8ee30000, 0x8ee20004, 0x14620007, 0x3c02b49a, 0x8ee20860,
+	0x54400001, 0x34e70400, 0x3c024b65, 0x0a000588, 0x34427654, 0x344289ab,
+	0xacc2001c, 0x30e2ffff, 0xacc20010, 0x0e0005a2, 0x00c02021, 0x3242ffff,
+	0x0056102b, 0x1440ff9b, 0x00000000, 0x8e620000, 0x8e63fffc, 0x0043102a,
+	0x1440ff48, 0x00000000, 0x8fbf0044, 0x8fbe0040, 0x8fb7003c, 0x8fb60038,
+	0x8fb50034, 0x8fb40030, 0x8fb3002c, 0x8fb20028, 0x8fb10024, 0x8fb00020,
+	0x03e00008, 0x27bd0048, 0x27bdffe8, 0xafbf0014, 0xafb00010, 0x8f624450,
+	0x8f634410, 0x0a0005b1, 0x00808021, 0x8f626820, 0x30422000, 0x10400003,
+	0x00000000, 0x0e0001f0, 0x00002021, 0x8f624450, 0x8f634410, 0x3042ffff,
+	0x0043102b, 0x1440fff5, 0x00000000, 0x8f630c14, 0x3063000f, 0x2c620002,
+	0x1440000b, 0x00000000, 0x8f630c14, 0x3c020800, 0x8c421b40, 0x3063000f,
+	0x24420001, 0x3c010800, 0xac221b40, 0x2c620002, 0x1040fff7, 0x00000000,
+	0xaf705c18, 0x8f625c10, 0x30420002, 0x10400009, 0x00000000, 0x8f626820,
+	0x30422000, 0x1040fff8, 0x00000000, 0x0e0001f0, 0x00002021, 0x0a0005c4,
+	0x00000000, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x00000000,
+	0x00000000, 0x00000000, 0x27bdffe8, 0x3c1bc000, 0xafbf0014, 0xafb00010,
+	0xaf60680c, 0x8f626804, 0x34420082, 0xaf626804, 0x8f634000, 0x24020b50,
+	0x3c010800, 0xac221b54, 0x24020b78, 0x3c010800, 0xac221b64, 0x34630002,
+	0xaf634000, 0x0e000605, 0x00808021, 0x3c010800, 0xa0221b68, 0x304200ff,
+	0x24030002, 0x14430005, 0x00000000, 0x3c020800, 0x8c421b54, 0x0a0005f8,
+	0xac5000c0, 0x3c020800, 0x8c421b54, 0xac5000bc, 0x8f624434, 0x8f634438,
+	0x8f644410, 0x3c010800, 0xac221b5c, 0x3c010800, 0xac231b6c, 0x3c010800,
+	0xac241b58, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x3c040800,
+	0x8c870000, 0x3c03aa55, 0x3463aa55, 0x3c06c003, 0xac830000, 0x8cc20000,
+	0x14430007, 0x24050002, 0x3c0355aa, 0x346355aa, 0xac830000, 0x8cc20000,
+	0x50430001, 0x24050001, 0x3c020800, 0xac470000, 0x03e00008, 0x00a01021,
+	0x27bdfff8, 0x18800009, 0x00002821, 0x8f63680c, 0x8f62680c, 0x1043fffe,
+	0x00000000, 0x24a50001, 0x00a4102a, 0x1440fff9, 0x00000000, 0x03e00008,
+	0x27bd0008, 0x8f634450, 0x3c020800, 0x8c421b5c, 0x00031c02, 0x0043102b,
+	0x14400008, 0x3c038000, 0x3c040800, 0x8c841b6c, 0x8f624450, 0x00021c02,
+	0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024,
+	0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff, 0x3082ffff,
+	0x2442e000, 0x2c422001, 0x14400003, 0x3c024000, 0x0a000648, 0x2402ffff,
+	0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc, 0x00001021,
+	0x03e00008, 0x00000000, 0x8f624450, 0x3c030800, 0x8c631b58, 0x0a000651,
+	0x3042ffff, 0x8f624450, 0x3042ffff, 0x0043102b, 0x1440fffc, 0x00000000,
+	0x03e00008, 0x00000000, 0x27bdffe0, 0x00802821, 0x3c040800, 0x24841af0,
+	0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, 0x0e00067c, 0xafa00014,
+	0x0a000660, 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x00000000,
+	0x00000000, 0x00000000, 0x3c020800, 0x34423000, 0x3c030800, 0x34633000,
+	0x3c040800, 0x348437ff, 0x3c010800, 0xac221b74, 0x24020040, 0x3c010800,
+	0xac221b78, 0x3c010800, 0xac201b70, 0xac600000, 0x24630004, 0x0083102b,
+	0x5040fffd, 0xac600000, 0x03e00008, 0x00000000, 0x00804821, 0x8faa0010,
+	0x3c020800, 0x8c421b70, 0x3c040800, 0x8c841b78, 0x8fab0014, 0x24430001,
+	0x0044102b, 0x3c010800, 0xac231b70, 0x14400003, 0x00004021, 0x3c010800,
+	0xac201b70, 0x3c020800, 0x8c421b70, 0x3c030800, 0x8c631b74, 0x91240000,
+	0x00021140, 0x00431021, 0x00481021, 0x25080001, 0xa0440000, 0x29020008,
+	0x1440fff4, 0x25290001, 0x3c020800, 0x8c421b70, 0x3c030800, 0x8c631b74,
+	0x8f64680c, 0x00021140, 0x00431021, 0xac440008, 0xac45000c, 0xac460010,
+	0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c, 0x00000000, 0x00000000,
 };
 
 u32 tg3TsoFwRodata[] = {
@@ -4257,201 +4500,200 @@
 	0x00000000, 0x00000000, 0x73746b6f, 0x66666c64, 0x496e0000, 0x73746b6f,
 	0x66662a2a, 0x00000000, 0x53774576, 0x656e7430, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x66617461, 0x6c457272, 0x00000000, 0x00000000,
+	0x00000000,
 };
 
-#if 0 /* All zeros, don't eat up space with it. */
 u32 tg3TsoFwData[] = {
+	0x00000000, 0x73746b6f, 0x66666c64, 0x5f76312e, 0x362e3000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-	0x00000000, 0x00000000, 0x00000000
+	0x00000000,
 };
-#endif
 
 /* 5705 needs a special version of the TSO firmware.  */
 #define TG3_TSO5_FW_RELEASE_MAJOR	0x1
-#define TG3_TSO5_FW_RELASE_MINOR	0x1
+#define TG3_TSO5_FW_RELASE_MINOR	0x2
 #define TG3_TSO5_FW_RELEASE_FIX		0x0
 #define TG3_TSO5_FW_START_ADDR		0x00010000
 #define TG3_TSO5_FW_TEXT_ADDR		0x00010000
-#define TG3_TSO5_FW_TEXT_LEN		0xeb0
-#define TG3_TSO5_FW_RODATA_ADDR		0x00010eb0
+#define TG3_TSO5_FW_TEXT_LEN		0xe90
+#define TG3_TSO5_FW_RODATA_ADDR		0x00010e90
 #define TG3_TSO5_FW_RODATA_LEN		0x50
-#define TG3_TSO5_FW_DATA_ADDR		0x00010f20
+#define TG3_TSO5_FW_DATA_ADDR		0x00010f00
 #define TG3_TSO5_FW_DATA_LEN		0x20
-#define TG3_TSO5_FW_SBSS_ADDR		0x00010f40
+#define TG3_TSO5_FW_SBSS_ADDR		0x00010f20
 #define TG3_TSO5_FW_SBSS_LEN		0x28
-#define TG3_TSO5_FW_BSS_ADDR		0x00010f70
+#define TG3_TSO5_FW_BSS_ADDR		0x00010f50
 #define TG3_TSO5_FW_BSS_LEN		0x88
 
-static u32 tg3Tso5FwText[] = {
-	0x0c004003, 0x00000000, 0x00010f30, 0x00000000, 0x10000003, 0x00000000,
+static u32 tg3Tso5FwText[(TG3_TSO5_FW_TEXT_LEN / 4) + 1] = {
+	0x0c004003, 0x00000000, 0x00010f04, 0x00000000, 0x10000003, 0x00000000,
 	0x0000000d, 0x0000000d, 0x3c1d0001, 0x37bde000, 0x03a0f021, 0x3c100001,
 	0x26100000, 0x0c004010, 0x00000000, 0x0000000d, 0x27bdffe0, 0x3c04fefe,
-	0xafbf0018, 0x0c0042f0, 0x34840002, 0x0c00436c, 0x00000000, 0x3c030001,
-	0x90630f54, 0x24020002, 0x3c040001, 0x24840ebc, 0x14620003, 0x24050001,
-	0x3c040001, 0x24840eb0, 0x24060001, 0x00003821, 0xafa00010, 0x0c004380,
+	0xafbf0018, 0x0c0042e8, 0x34840002, 0x0c004364, 0x00000000, 0x3c030001,
+	0x90630f34, 0x24020002, 0x3c040001, 0x24840e9c, 0x14620003, 0x24050001,
+	0x3c040001, 0x24840e90, 0x24060002, 0x00003821, 0xafa00010, 0x0c004378,
 	0xafa00014, 0x0c00402c, 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020,
 	0x00000000, 0x00000000, 0x27bdffe0, 0xafbf001c, 0xafb20018, 0xafb10014,
-	0x0c0042d3, 0xafb00010, 0x3c128000, 0x24110001, 0x8f706810, 0x32020400,
+	0x0c0042d4, 0xafb00010, 0x3c128000, 0x24110001, 0x8f706810, 0x32020400,
 	0x10400007, 0x00000000, 0x8f641008, 0x00921024, 0x14400003, 0x00000000,
-	0x0c004064, 0x00000000, 0x3c020001, 0x90420f76, 0x10510003, 0x32020200,
+	0x0c004064, 0x00000000, 0x3c020001, 0x90420f56, 0x10510003, 0x32020200,
 	0x1040fff1, 0x00000000, 0x0c0041b4, 0x00000000, 0x08004034, 0x00000000,
 	0x8fbf001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020,
-	0x27bdffe0, 0x3c040001, 0x24840ed0, 0x00002821, 0x00003021, 0x00003821,
-	0xafbf0018, 0xafa00010, 0x0c004380, 0xafa00014, 0x0000d021, 0x24020130,
-	0xaf625000, 0x3c010001, 0xa4200f70, 0x3c010001, 0xa0200f77, 0x8fbf0018,
-	0x03e00008, 0x27bd0020, 0x00000000, 0x00000000, 0x3c030001, 0x24630f80,
+	0x27bdffe0, 0x3c040001, 0x24840eb0, 0x00002821, 0x00003021, 0x00003821,
+	0xafbf0018, 0xafa00010, 0x0c004378, 0xafa00014, 0x0000d021, 0x24020130,
+	0xaf625000, 0x3c010001, 0xa4200f50, 0x3c010001, 0xa0200f57, 0x8fbf0018,
+	0x03e00008, 0x27bd0020, 0x00000000, 0x00000000, 0x3c030001, 0x24630f60,
 	0x90620000, 0x27bdfff0, 0x14400003, 0x0080c021, 0x08004073, 0x00004821,
 	0x3c022000, 0x03021024, 0x10400003, 0x24090002, 0x08004073, 0xa0600000,
 	0x24090001, 0x00181040, 0x30431f80, 0x346f8008, 0x1520004b, 0x25eb0028,
-	0x3c040001, 0x00832021, 0x8c848010, 0x3c050001, 0x24a50f9a, 0x00041402,
-	0xa0a20000, 0x3c010001, 0xa0240f9b, 0x3c020001, 0x00431021, 0x94428014,
-	0x3c010001, 0xa0220f9c, 0x3c0c0001, 0x01836021, 0x8d8c8018, 0x304200ff,
-	0x24420008, 0x000220c3, 0x24020001, 0x3c010001, 0xa0220f80, 0x0124102b,
+	0x3c040001, 0x00832021, 0x8c848010, 0x3c050001, 0x24a50f7a, 0x00041402,
+	0xa0a20000, 0x3c010001, 0xa0240f7b, 0x3c020001, 0x00431021, 0x94428014,
+	0x3c010001, 0xa0220f7c, 0x3c0c0001, 0x01836021, 0x8d8c8018, 0x304200ff,
+	0x24420008, 0x000220c3, 0x24020001, 0x3c010001, 0xa0220f60, 0x0124102b,
 	0x1040000c, 0x00003821, 0x24a6000e, 0x01602821, 0x8ca20000, 0x8ca30004,
 	0x24a50008, 0x24e70001, 0xacc20000, 0xacc30004, 0x00e4102b, 0x1440fff8,
-	0x24c60008, 0x00003821, 0x3c080001, 0x25080f9b, 0x91060000, 0x3c020001,
-	0x90420f9c, 0x2503000d, 0x00c32821, 0x00461023, 0x00021fc2, 0x00431021,
+	0x24c60008, 0x00003821, 0x3c080001, 0x25080f7b, 0x91060000, 0x3c020001,
+	0x90420f7c, 0x2503000d, 0x00c32821, 0x00461023, 0x00021fc2, 0x00431021,
 	0x00021043, 0x1840000c, 0x00002021, 0x91020001, 0x00461023, 0x00021fc2,
 	0x00431021, 0x00021843, 0x94a20000, 0x24e70001, 0x00822021, 0x00e3102a,
 	0x1440fffb, 0x24a50002, 0x00041c02, 0x3082ffff, 0x00622021, 0x00041402,
 	0x00822021, 0x3c02ffff, 0x01821024, 0x3083ffff, 0x00431025, 0x3c010001,
-	0x080040fa, 0xac220fa0, 0x3c050001, 0x24a50f9c, 0x90a20000, 0x3c0c0001,
+	0x080040fa, 0xac220f80, 0x3c050001, 0x24a50f7c, 0x90a20000, 0x3c0c0001,
 	0x01836021, 0x8d8c8018, 0x000220c2, 0x1080000e, 0x00003821, 0x01603021,
 	0x24a5000c, 0x8ca20000, 0x8ca30004, 0x24a50008, 0x24e70001, 0xacc20000,
-	0xacc30004, 0x00e4102b, 0x1440fff8, 0x24c60008, 0x3c050001, 0x24a50f9c,
+	0xacc30004, 0x00e4102b, 0x1440fff8, 0x24c60008, 0x3c050001, 0x24a50f7c,
 	0x90a20000, 0x30430007, 0x24020004, 0x10620011, 0x28620005, 0x10400005,
 	0x24020002, 0x10620008, 0x000710c0, 0x080040fa, 0x00000000, 0x24020006,
 	0x1062000e, 0x000710c0, 0x080040fa, 0x00000000, 0x00a21821, 0x9463000c,
 	0x004b1021, 0x080040fa, 0xa4430000, 0x000710c0, 0x00a21821, 0x8c63000c,
 	0x004b1021, 0x080040fa, 0xac430000, 0x00a21821, 0x8c63000c, 0x004b2021,
 	0x00a21021, 0xac830000, 0x94420010, 0xa4820004, 0x95e70006, 0x3c020001,
-	0x90420f9c, 0x3c030001, 0x90630f9a, 0x00e2c823, 0x3c020001, 0x90420f9b,
+	0x90420f7c, 0x3c030001, 0x90630f7a, 0x00e2c823, 0x3c020001, 0x90420f7b,
 	0x24630028, 0x01e34021, 0x24420028, 0x15200012, 0x01e23021, 0x94c2000c,
-	0x3c010001, 0xa4220f98, 0x94c20004, 0x94c30006, 0x3c010001, 0xa4200f96,
-	0x3c010001, 0xa4200f92, 0x00021400, 0x00431025, 0x3c010001, 0xac220f8c,
-	0x95020004, 0x3c010001, 0x08004124, 0xa4220f90, 0x3c020001, 0x94420f90,
-	0x3c030001, 0x94630f92, 0x00431021, 0xa5020004, 0x3c020001, 0x94420f8c,
-	0xa4c20004, 0x3c020001, 0x8c420f8c, 0xa4c20006, 0x3c040001, 0x94840f92,
-	0x3c020001, 0x94420f90, 0x3c0a0001, 0x954a0f96, 0x00441821, 0x3063ffff,
-	0x0062182a, 0x24020002, 0x1122000b, 0x00832023, 0x3c030001, 0x94630f98,
-	0x30620009, 0x10400006, 0x3062fff6, 0xa4c2000c, 0x3c020001, 0x94420f98,
+	0x3c010001, 0xa4220f78, 0x94c20004, 0x94c30006, 0x3c010001, 0xa4200f76,
+	0x3c010001, 0xa4200f72, 0x00021400, 0x00431025, 0x3c010001, 0xac220f6c,
+	0x95020004, 0x3c010001, 0x08004124, 0xa4220f70, 0x3c020001, 0x94420f70,
+	0x3c030001, 0x94630f72, 0x00431021, 0xa5020004, 0x3c020001, 0x94420f6c,
+	0xa4c20004, 0x3c020001, 0x8c420f6c, 0xa4c20006, 0x3c040001, 0x94840f72,
+	0x3c020001, 0x94420f70, 0x3c0a0001, 0x954a0f76, 0x00441821, 0x3063ffff,
+	0x0062182a, 0x24020002, 0x1122000b, 0x00832023, 0x3c030001, 0x94630f78,
+	0x30620009, 0x10400006, 0x3062fff6, 0xa4c2000c, 0x3c020001, 0x94420f78,
 	0x30420009, 0x01425023, 0x24020001, 0x1122001b, 0x29220002, 0x50400005,
 	0x24020002, 0x11200007, 0x31a2ffff, 0x08004197, 0x00000000, 0x1122001d,
-	0x24020016, 0x08004197, 0x31a2ffff, 0x3c0e0001, 0x95ce0fa0, 0x10800005,
+	0x24020016, 0x08004197, 0x31a2ffff, 0x3c0e0001, 0x95ce0f80, 0x10800005,
 	0x01806821, 0x01c42021, 0x00041c02, 0x3082ffff, 0x00627021, 0x000e1027,
-	0xa502000a, 0x3c030001, 0x90630f9b, 0x31a2ffff, 0x00e21021, 0x0800418d,
-	0x00432023, 0x3c020001, 0x94420fa0, 0x00442021, 0x00041c02, 0x3082ffff,
+	0xa502000a, 0x3c030001, 0x90630f7b, 0x31a2ffff, 0x00e21021, 0x0800418d,
+	0x00432023, 0x3c020001, 0x94420f80, 0x00442021, 0x00041c02, 0x3082ffff,
 	0x00622021, 0x00807021, 0x00041027, 0x08004185, 0xa502000a, 0x3c050001,
-	0x24a50f9a, 0x90a30000, 0x14620002, 0x24e2fff2, 0xa5e20034, 0x90a20000,
-	0x00e21023, 0xa5020002, 0x3c030001, 0x94630fa0, 0x3c020001, 0x94420f7a,
+	0x24a50f7a, 0x90a30000, 0x14620002, 0x24e2fff2, 0xa5e20034, 0x90a20000,
+	0x00e21023, 0xa5020002, 0x3c030001, 0x94630f80, 0x3c020001, 0x94420f5a,
 	0x30e5ffff, 0x00641821, 0x00451023, 0x00622023, 0x00041c02, 0x3082ffff,
-	0x00622021, 0x00041027, 0xa502000a, 0x3c030001, 0x90630f9c, 0x24620001,
+	0x00622021, 0x00041027, 0xa502000a, 0x3c030001, 0x90630f7c, 0x24620001,
 	0x14a20005, 0x00807021, 0x01631021, 0x90420000, 0x08004185, 0x00026200,
 	0x24620002, 0x14a20003, 0x306200fe, 0x004b1021, 0x944c0000, 0x3c020001,
-	0x94420fa2, 0x3183ffff, 0x3c040001, 0x90840f9b, 0x00431021, 0x00e21021,
+	0x94420f82, 0x3183ffff, 0x3c040001, 0x90840f7b, 0x00431021, 0x00e21021,
 	0x00442023, 0x008a2021, 0x00041c02, 0x3082ffff, 0x00622021, 0x00041402,
 	0x00822021, 0x00806821, 0x00041027, 0xa4c20010, 0x31a2ffff, 0x000e1c00,
-	0x00431025, 0x3c040001, 0x24840f92, 0xade20010, 0x94820000, 0x3c050001,
-	0x94a50f96, 0x3c030001, 0x8c630f8c, 0x24420001, 0x00b92821, 0xa4820000,
-	0x3322ffff, 0x00622021, 0x0083182b, 0x3c010001, 0xa4250f96, 0x10600003,
-	0x24a2ffff, 0x3c010001, 0xa4220f96, 0x3c024000, 0x03021025, 0x3c010001,
-	0xac240f8c, 0xaf621008, 0x03e00008, 0x27bd0010, 0x3c030001, 0x90630f76,
+	0x00431025, 0x3c040001, 0x24840f72, 0xade20010, 0x94820000, 0x3c050001,
+	0x94a50f76, 0x3c030001, 0x8c630f6c, 0x24420001, 0x00b92821, 0xa4820000,
+	0x3322ffff, 0x00622021, 0x0083182b, 0x3c010001, 0xa4250f76, 0x10600003,
+	0x24a2ffff, 0x3c010001, 0xa4220f76, 0x3c024000, 0x03021025, 0x3c010001,
+	0xac240f6c, 0xaf621008, 0x03e00008, 0x27bd0010, 0x3c030001, 0x90630f56,
 	0x27bdffe8, 0x24020001, 0xafbf0014, 0x10620026, 0xafb00010, 0x8f620cf4,
-	0x2442ffff, 0x3042007f, 0x00021100, 0x8c434000, 0x3c010001, 0xac230f84,
+	0x2442ffff, 0x3042007f, 0x00021100, 0x8c434000, 0x3c010001, 0xac230f64,
 	0x8c434008, 0x24444000, 0x8c5c4004, 0x30620040, 0x14400002, 0x24020088,
-	0x24020008, 0x3c010001, 0xa4220f88, 0x30620004, 0x10400005, 0x24020001,
-	0x3c010001, 0xa0220f77, 0x080041d5, 0x00031402, 0x3c010001, 0xa0200f77,
-	0x00031402, 0x3c010001, 0xa4220f74, 0x9483000c, 0x24020001, 0x3c010001,
-	0xa4200f70, 0x3c010001, 0xa0220f76, 0x3c010001, 0xa4230f82, 0x24020001,
+	0x24020008, 0x3c010001, 0xa4220f68, 0x30620004, 0x10400005, 0x24020001,
+	0x3c010001, 0xa0220f57, 0x080041d5, 0x00031402, 0x3c010001, 0xa0200f57,
+	0x00031402, 0x3c010001, 0xa4220f54, 0x9483000c, 0x24020001, 0x3c010001,
+	0xa4200f50, 0x3c010001, 0xa0220f56, 0x3c010001, 0xa4230f62, 0x24020001,
 	0x1342001e, 0x00000000, 0x13400005, 0x24020003, 0x13420067, 0x00000000,
-	0x080042cf, 0x00000000, 0x3c020001, 0x94420f82, 0x241a0001, 0x3c010001,
-	0xa4200f7e, 0x3c010001, 0xa4200f72, 0x304407ff, 0x00021bc2, 0x00031823,
+	0x080042cf, 0x00000000, 0x3c020001, 0x94420f62, 0x241a0001, 0x3c010001,
+	0xa4200f5e, 0x3c010001, 0xa4200f52, 0x304407ff, 0x00021bc2, 0x00031823,
 	0x3063003e, 0x34630036, 0x00021242, 0x3042003c, 0x00621821, 0x3c010001,
-	0xa4240f78, 0x00832021, 0x24630030, 0x3c010001, 0xa4240f7a, 0x3c010001,
-	0xa4230f7c, 0x3c060001, 0x24c60f72, 0x94c50000, 0x94c30002, 0x3c040001,
-	0x94840f7a, 0x00651021, 0x0044102a, 0x10400013, 0x3c108000, 0x00a31021,
-	0xa4c20000, 0x3c02a000, 0xaf620cf4, 0x3c010001, 0xa0200f76, 0x8f641008,
+	0xa4240f58, 0x00832021, 0x24630030, 0x3c010001, 0xa4240f5a, 0x3c010001,
+	0xa4230f5c, 0x3c060001, 0x24c60f52, 0x94c50000, 0x94c30002, 0x3c040001,
+	0x94840f5a, 0x00651021, 0x0044102a, 0x10400013, 0x3c108000, 0x00a31021,
+	0xa4c20000, 0x3c02a000, 0xaf620cf4, 0x3c010001, 0xa0200f56, 0x8f641008,
 	0x00901024, 0x14400003, 0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4,
 	0x00501024, 0x104000b7, 0x00000000, 0x0800420f, 0x00000000, 0x3c030001,
-	0x94630f70, 0x00851023, 0xa4c40000, 0x00621821, 0x3042ffff, 0x3c010001,
-	0xa4230f70, 0xaf620ce8, 0x3c020001, 0x94420f88, 0x34420024, 0xaf620cec,
-	0x94c30002, 0x3c020001, 0x94420f70, 0x14620012, 0x3c028000, 0x3c108000,
-	0x3c02a000, 0xaf620cf4, 0x3c010001, 0xa0200f76, 0x8f641008, 0x00901024,
+	0x94630f50, 0x00851023, 0xa4c40000, 0x00621821, 0x3042ffff, 0x3c010001,
+	0xa4230f50, 0xaf620ce8, 0x3c020001, 0x94420f68, 0x34420024, 0xaf620cec,
+	0x94c30002, 0x3c020001, 0x94420f50, 0x14620012, 0x3c028000, 0x3c108000,
+	0x3c02a000, 0xaf620cf4, 0x3c010001, 0xa0200f56, 0x8f641008, 0x00901024,
 	0x14400003, 0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4, 0x00501024,
 	0x1440fff7, 0x00000000, 0x080042cf, 0x241a0003, 0xaf620cf4, 0x3c108000,
 	0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064, 0x00000000,
 	0x8f620cf4, 0x00501024, 0x1440fff7, 0x00000000, 0x080042cf, 0x241a0003,
-	0x3c070001, 0x24e70f70, 0x94e20000, 0x03821021, 0xaf620ce0, 0x3c020001,
-	0x8c420f84, 0xaf620ce4, 0x3c050001, 0x94a50f74, 0x94e30000, 0x3c040001,
-	0x94840f78, 0x3c020001, 0x94420f7e, 0x00a32823, 0x00822023, 0x30a6ffff,
-	0x3083ffff, 0x00c3102b, 0x14400043, 0x00000000, 0x3c020001, 0x94420f7c,
-	0x00021400, 0x00621025, 0xaf620ce8, 0x94e20000, 0x3c030001, 0x94630f74,
+	0x3c070001, 0x24e70f50, 0x94e20000, 0x03821021, 0xaf620ce0, 0x3c020001,
+	0x8c420f64, 0xaf620ce4, 0x3c050001, 0x94a50f54, 0x94e30000, 0x3c040001,
+	0x94840f58, 0x3c020001, 0x94420f5e, 0x00a32823, 0x00822023, 0x30a6ffff,
+	0x3083ffff, 0x00c3102b, 0x14400043, 0x00000000, 0x3c020001, 0x94420f5c,
+	0x00021400, 0x00621025, 0xaf620ce8, 0x94e20000, 0x3c030001, 0x94630f54,
 	0x00441021, 0xa4e20000, 0x3042ffff, 0x14430021, 0x3c020008, 0x3c020001,
-	0x90420f77, 0x10400006, 0x3c03000c, 0x3c020001, 0x94420f88, 0x34630624,
-	0x0800427c, 0x0000d021, 0x3c020001, 0x94420f88, 0x3c030008, 0x34630624,
+	0x90420f57, 0x10400006, 0x3c03000c, 0x3c020001, 0x94420f68, 0x34630624,
+	0x0800427c, 0x0000d021, 0x3c020001, 0x94420f68, 0x3c030008, 0x34630624,
 	0x00431025, 0xaf620cec, 0x3c108000, 0x3c02a000, 0xaf620cf4, 0x3c010001,
-	0xa0200f76, 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064,
+	0xa0200f56, 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064,
 	0x00000000, 0x8f620cf4, 0x00501024, 0x10400015, 0x00000000, 0x08004283,
-	0x00000000, 0x3c030001, 0x94630f88, 0x34420624, 0x3c108000, 0x00621825,
+	0x00000000, 0x3c030001, 0x94630f68, 0x34420624, 0x3c108000, 0x00621825,
 	0x3c028000, 0xaf630cec, 0xaf620cf4, 0x8f641008, 0x00901024, 0x14400003,
 	0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4, 0x00501024, 0x1440fff7,
-	0x00000000, 0x3c010001, 0x080042cf, 0xa4200f7e, 0x3c020001, 0x94420f7c,
-	0x00021400, 0x00c21025, 0xaf620ce8, 0x3c020001, 0x90420f77, 0x10400009,
-	0x3c03000c, 0x3c020001, 0x94420f88, 0x34630624, 0x0000d021, 0x00431025,
-	0xaf620cec, 0x080042c1, 0x3c108000, 0x3c020001, 0x94420f88, 0x3c030008,
-	0x34630604, 0x00431025, 0xaf620cec, 0x3c020001, 0x94420f7e, 0x00451021,
-	0x3c010001, 0xa4220f7e, 0x3c108000, 0x3c02a000, 0xaf620cf4, 0x3c010001,
-	0xa0200f76, 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064,
+	0x00000000, 0x3c010001, 0x080042cf, 0xa4200f5e, 0x3c020001, 0x94420f5c,
+	0x00021400, 0x00c21025, 0xaf620ce8, 0x3c020001, 0x90420f57, 0x10400009,
+	0x3c03000c, 0x3c020001, 0x94420f68, 0x34630624, 0x0000d021, 0x00431025,
+	0xaf620cec, 0x080042c1, 0x3c108000, 0x3c020001, 0x94420f68, 0x3c030008,
+	0x34630604, 0x00431025, 0xaf620cec, 0x3c020001, 0x94420f5e, 0x00451021,
+	0x3c010001, 0xa4220f5e, 0x3c108000, 0x3c02a000, 0xaf620cf4, 0x3c010001,
+	0xa0200f56, 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064,
 	0x00000000, 0x8f620cf4, 0x00501024, 0x1440fff7, 0x00000000, 0x8fbf0014,
-	0x8fb00010, 0x03e00008, 0x27bd0018, 0x27bdffe0, 0x3c040001, 0x24840ee0,
-	0x00002821, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, 0x0c004380,
-	0xafa00014, 0x0000d021, 0x24020130, 0xaf625000, 0x3c010001, 0xa4200f70,
-	0x3c010001, 0xa0200f77, 0x8f636804, 0x3c020001, 0x3442e000, 0x00621824,
-	0x3c020001, 0x14620003, 0x00000000, 0x080042eb, 0x00000000, 0x8fbf0018,
-	0x03e00008, 0x27bd0020, 0x27bdffe8, 0x3c1bc000, 0xafbf0014, 0xafb00010,
-	0xaf60680c, 0x8f626804, 0x34420082, 0xaf626804, 0x8f634000, 0x24020b50,
-	0x3c010001, 0xac220f40, 0x24020b78, 0x3c010001, 0xac220f50, 0x34630002,
-	0xaf634000, 0x0c00431d, 0x00808021, 0x3c010001, 0xa0220f54, 0x304200ff,
-	0x24030002, 0x14430005, 0x00000000, 0x3c020001, 0x8c420f40, 0x08004310,
-	0xac5000c0, 0x3c020001, 0x8c420f40, 0xac5000bc, 0x8f624434, 0x8f634438,
-	0x8f644410, 0x3c010001, 0xac220f48, 0x3c010001, 0xac230f58, 0x3c010001,
-	0xac240f44, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x03e00008,
-	0x24020001, 0x27bdfff8, 0x18800009, 0x00002821, 0x8f63680c, 0x8f62680c,
-	0x1043fffe, 0x00000000, 0x24a50001, 0x00a4102a, 0x1440fff9, 0x00000000,
-	0x03e00008, 0x27bd0008, 0x8f634450, 0x3c020001, 0x8c420f48, 0x00031c02,
-	0x0043102b, 0x14400008, 0x3c038000, 0x3c040001, 0x8c840f58, 0x8f624450,
-	0x00021c02, 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444,
-	0x00431024, 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff,
-	0x3082ffff, 0x2442e000, 0x2c422001, 0x14400003, 0x3c024000, 0x0800434f,
-	0x2402ffff, 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc,
-	0x00001021, 0x03e00008, 0x00000000, 0x8f624450, 0x3c030001, 0x8c630f44,
-	0x08004358, 0x3042ffff, 0x8f624450, 0x3042ffff, 0x0043102b, 0x1440fffc,
-	0x00000000, 0x03e00008, 0x00000000, 0x27bdffe0, 0x00802821, 0x3c040001,
-	0x24840ef0, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, 0x0c004380,
-	0xafa00014, 0x08004367, 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020,
-	0x3c020001, 0x3442d600, 0x3c030001, 0x3463d600, 0x3c040001, 0x3484ddff,
-	0x3c010001, 0xac220f60, 0x24020040, 0x3c010001, 0xac220f64, 0x3c010001,
-	0xac200f5c, 0xac600000, 0x24630004, 0x0083102b, 0x5040fffd, 0xac600000,
-	0x03e00008, 0x00000000, 0x00804821, 0x8faa0010, 0x3c020001, 0x8c420f5c,
-	0x3c040001, 0x8c840f64, 0x8fab0014, 0x24430001, 0x0044102b, 0x3c010001,
-	0xac230f5c, 0x14400003, 0x00004021, 0x3c010001, 0xac200f5c, 0x3c020001,
-	0x8c420f5c, 0x3c030001, 0x8c630f60, 0x91240000, 0x00021140, 0x00431021,
-	0x00481021, 0x25080001, 0xa0440000, 0x29020008, 0x1440fff4, 0x25290001,
-	0x3c020001, 0x8c420f5c, 0x3c030001, 0x8c630f60, 0x8f64680c, 0x00021140,
-	0x00431021, 0xac440008, 0xac45000c, 0xac460010, 0xac470014, 0xac4a0018,
-	0x03e00008, 0xac4b001c, 0x00000000, 0x00000000,
+	0x8fb00010, 0x03e00008, 0x27bd0018, 0x00000000, 0x27bdffe0, 0x3c040001,
+	0x24840ec0, 0x00002821, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010,
+	0x0c004378, 0xafa00014, 0x0000d021, 0x24020130, 0xaf625000, 0x3c010001,
+	0xa4200f50, 0x3c010001, 0xa0200f57, 0x8fbf0018, 0x03e00008, 0x27bd0020,
+	0x27bdffe8, 0x3c1bc000, 0xafbf0014, 0xafb00010, 0xaf60680c, 0x8f626804,
+	0x34420082, 0xaf626804, 0x8f634000, 0x24020b50, 0x3c010001, 0xac220f20,
+	0x24020b78, 0x3c010001, 0xac220f30, 0x34630002, 0xaf634000, 0x0c004315,
+	0x00808021, 0x3c010001, 0xa0220f34, 0x304200ff, 0x24030002, 0x14430005,
+	0x00000000, 0x3c020001, 0x8c420f20, 0x08004308, 0xac5000c0, 0x3c020001,
+	0x8c420f20, 0xac5000bc, 0x8f624434, 0x8f634438, 0x8f644410, 0x3c010001,
+	0xac220f28, 0x3c010001, 0xac230f38, 0x3c010001, 0xac240f24, 0x8fbf0014,
+	0x8fb00010, 0x03e00008, 0x27bd0018, 0x03e00008, 0x24020001, 0x27bdfff8,
+	0x18800009, 0x00002821, 0x8f63680c, 0x8f62680c, 0x1043fffe, 0x00000000,
+	0x24a50001, 0x00a4102a, 0x1440fff9, 0x00000000, 0x03e00008, 0x27bd0008,
+	0x8f634450, 0x3c020001, 0x8c420f28, 0x00031c02, 0x0043102b, 0x14400008,
+	0x3c038000, 0x3c040001, 0x8c840f38, 0x8f624450, 0x00021c02, 0x0083102b,
+	0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024, 0x1440fffd,
+	0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff, 0x3082ffff, 0x2442e000,
+	0x2c422001, 0x14400003, 0x3c024000, 0x08004347, 0x2402ffff, 0x00822025,
+	0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc, 0x00001021, 0x03e00008,
+	0x00000000, 0x8f624450, 0x3c030001, 0x8c630f24, 0x08004350, 0x3042ffff,
+	0x8f624450, 0x3042ffff, 0x0043102b, 0x1440fffc, 0x00000000, 0x03e00008,
+	0x00000000, 0x27bdffe0, 0x00802821, 0x3c040001, 0x24840ed0, 0x00003021,
+	0x00003821, 0xafbf0018, 0xafa00010, 0x0c004378, 0xafa00014, 0x0800435f,
+	0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x3c020001, 0x3442d600,
+	0x3c030001, 0x3463d600, 0x3c040001, 0x3484ddff, 0x3c010001, 0xac220f40,
+	0x24020040, 0x3c010001, 0xac220f44, 0x3c010001, 0xac200f3c, 0xac600000,
+	0x24630004, 0x0083102b, 0x5040fffd, 0xac600000, 0x03e00008, 0x00000000,
+	0x00804821, 0x8faa0010, 0x3c020001, 0x8c420f3c, 0x3c040001, 0x8c840f44,
+	0x8fab0014, 0x24430001, 0x0044102b, 0x3c010001, 0xac230f3c, 0x14400003,
+	0x00004021, 0x3c010001, 0xac200f3c, 0x3c020001, 0x8c420f3c, 0x3c030001,
+	0x8c630f40, 0x91240000, 0x00021140, 0x00431021, 0x00481021, 0x25080001,
+	0xa0440000, 0x29020008, 0x1440fff4, 0x25290001, 0x3c020001, 0x8c420f3c,
+	0x3c030001, 0x8c630f40, 0x8f64680c, 0x00021140, 0x00431021, 0xac440008,
+	0xac45000c, 0xac460010, 0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c,
+	0x00000000, 0x00000000, 0x00000000,
 };
 
-u32 tg3Tso5FwRodata[] = {
+u32 tg3Tso5FwRodata[(TG3_TSO5_FW_RODATA_LEN / 4) + 1] = {
 	0x4d61696e, 0x43707542, 0x00000000, 0x4d61696e, 0x43707541, 0x00000000,
 	0x00000000, 0x00000000, 0x73746b6f, 0x66666c64, 0x00000000, 0x00000000,
 	0x73746b6f, 0x66666c64, 0x00000000, 0x00000000, 0x66617461, 0x6c457272,
-	0x00000000, 0x00000000, 0x00000000
+	0x00000000, 0x00000000, 0x00000000,
 };
 
-u32 tg3Tso5FwData[] = {
-	0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x73746b6f, 
-	0x66666c64, 0x5f76312e, 0x312e3000, 0x00000000
+u32 tg3Tso5FwData[(TG3_TSO5_FW_DATA_LEN / 4) + 1] = {
+	0x00000000, 0x73746b6f, 0x66666c64, 0x5f76312e, 0x322e3000, 0x00000000,
+	0x00000000, 0x00000000, 0x00000000,
 };
 
 /* tp->lock is held. */
@@ -4461,6 +4703,9 @@
 	unsigned long cpu_base, cpu_scratch_base, cpu_scratch_size;
 	int err, i;
 
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
+		return 0;
+
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
 		info.text_base = TG3_TSO5_FW_TEXT_ADDR;
 		info.text_len = TG3_TSO5_FW_TEXT_LEN;
@@ -4487,7 +4732,7 @@
 		info.rodata_data = &tg3TsoFwRodata[0];
 		info.data_base = TG3_TSO_FW_DATA_ADDR;
 		info.data_len = TG3_TSO_FW_DATA_LEN;
-		info.data_data = NULL;
+		info.data_data = &tg3TsoFwData[0];
 		cpu_base = TX_CPU_BASE;
 		cpu_scratch_base = TX_CPU_SCRATCH_BASE;
 		cpu_scratch_size = TX_CPU_SCRATCH_SIZE;
@@ -4563,7 +4808,7 @@
 
 static int tg3_set_mac_addr(struct net_device *dev, void *p)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	struct sockaddr *addr = p;
 
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
@@ -4608,6 +4853,8 @@
 
 	tg3_stop_fw(tp);
 
+	tg3_write_sig_pre_reset(tp, RESET_KIND_INIT);
+
 	if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) {
 		err = tg3_abort_hw(tp);
 		if (err)
@@ -4618,18 +4865,15 @@
 	if (err)
 		return err;
 
-	if (tp->tg3_flags & TG3_FLAG_ENABLE_ASF)
-		tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
-			      DRV_STATE_START);
-	else
-		tg3_write_mem(tp, NIC_SRAM_FW_DRV_STATE_MBOX,
-			      DRV_STATE_SUSPEND);
+	tg3_write_sig_legacy(tp, RESET_KIND_INIT);
 
 	/* This works around an issue with Athlon chipsets on
 	 * B3 tigon3 silicon.  This bit has no effect on any
-	 * other revision.
+	 * other revision.  But do not set this on PCI Express
+	 * chips.
 	 */
-	tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT;
+	if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS))
+		tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT;
 	tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
 
 	if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
@@ -4682,7 +4926,9 @@
 	tw32(GRC_MISC_CFG, val);
 
 	/* Initialize MBUF/DESC pool. */
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
+		/* Do nothing.  */
+	} else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
 		tw32(BUFMGR_MB_POOL_ADDR, NIC_SRAM_MBUF_POOL_BASE);
 		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
 			tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE64);
@@ -4740,17 +4986,6 @@
 		return -ENODEV;
 	}
 
-	/* Clear statistics/status block in chip, and status block in ram. */
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
-		for (i = NIC_SRAM_STATS_BLK;
-	     	     i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE;
-	     	     i += sizeof(u32)) {
-			tg3_write_mem(tp, i, 0);
-			udelay(40);
-		}
-	}
-	memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
-
 	/* Setup replenish threshold. */
 	tw32(RCVBDI_STD_THRESH, tp->rx_pending / 8);
 
@@ -4781,7 +5016,8 @@
 	/* Don't even try to program the JUMBO/MINI buffer descriptor
 	 * configs on 5705.
 	 */
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
 		tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS,
 		     RX_STD_MAX_SIZE_5705 << BDINFO_FLAGS_MAXLEN_SHIFT);
 	} else {
@@ -4810,10 +5046,11 @@
 
 	}
 
-	/* There is only one send ring on 5705, no need to explicitly
+	/* There is only one send ring on 5705/5750, no need to explicitly
 	 * disable the others.
 	 */
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) {
 		/* Clear out send RCB ring in SRAM. */
 		for (i = NIC_SRAM_SEND_RCB; i < NIC_SRAM_RCV_RET_RCB; i += TG3_BDINFO_SIZE)
 			tg3_write_mem(tp, i + TG3_BDINFO_MAXLEN_FLAGS,
@@ -4838,10 +5075,11 @@
 			       NIC_SRAM_TX_BUFFER_DESC);
 	}
 
-	/* There is only one receive return ring on 5705, no need to explicitly
-	 * disable the others.
+	/* There is only one receive return ring on 5705/5750, no need
+	 * to explicitly disable the others.
 	 */
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) {
 		for (i = NIC_SRAM_RCV_RET_RCB; i < NIC_SRAM_STATS_BLK;
 		     i += TG3_BDINFO_SIZE) {
 			tg3_write_mem(tp, i + TG3_BDINFO_MAXLEN_FLAGS,
@@ -4895,17 +5133,24 @@
 		      RDMAC_MODE_LNGREAD_ENAB);
 	if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
 		rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE;
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
-		if (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) {
-			if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
-				rdmac_mode |= RDMAC_MODE_FIFO_SIZE_128;
-			} else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) &&
-				   !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) {
-				rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
-			}
+	if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
+	     tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) ||
+	    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)) {
+		if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE &&
+		    (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 ||
+		     tp->pci_chip_rev_id == CHIPREV_ID_5705_A2)) {
+			rdmac_mode |= RDMAC_MODE_FIFO_SIZE_128;
+		} else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) &&
+			   !(tp->tg3_flags2 & TG3_FLG2_IS_5788)) {
+			rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
 		}
 	}
 
+#if TG3_TSO_SUPPORT != 0
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
+		rdmac_mode |= (1 << 27);
+#endif
+
 	/* Receive/send statistics. */
 	if ((rdmac_mode & RDMAC_MODE_FIFO_SIZE_128) &&
 	    (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
@@ -4933,10 +5178,11 @@
 	tw32(HOSTCC_TXCOL_TICKS, LOW_TXCOL_TICKS);
 	tw32(HOSTCC_RXMAX_FRAMES, 1);
 	tw32(HOSTCC_TXMAX_FRAMES, LOW_RXMAX_FRAMES);
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) {
 		tw32(HOSTCC_RXCOAL_TICK_INT, 0);
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
 		tw32(HOSTCC_TXCOAL_TICK_INT, 0);
+	}
 	tw32(HOSTCC_RXCOAL_MAXF_INT, 1);
 	tw32(HOSTCC_TXCOAL_MAXF_INT, 0);
 
@@ -4946,10 +5192,11 @@
 	tw32(HOSTCC_STATUS_BLK_HOST_ADDR + TG3_64BIT_REG_LOW,
 	     ((u64) tp->status_mapping & 0xffffffff));
 
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) {
 		/* Status/statistics block address.  See tg3_timer,
 		 * the tg3_periodic_fetch_stats call there, and
-		 * tg3_get_stats to see how this works for 5705 chips.
+		 * tg3_get_stats to see how this works for 5705/5750 chips.
 		 */
 		tw32(HOSTCC_STAT_COAL_TICKS,
 		     DEFAULT_STAT_COAL_TICKS);
@@ -4965,9 +5212,19 @@
 
 	tw32(RCVCC_MODE, RCVCC_MODE_ENABLE | RCVCC_MODE_ATTN_ENABLE);
 	tw32(RCVLPC_MODE, RCVLPC_MODE_ENABLE);
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750)
 		tw32(RCVLSC_MODE, RCVLSC_MODE_ENABLE | RCVLSC_MODE_ATTN_ENABLE);
 
+	/* Clear statistics/status block in chip, and status block in ram. */
+	for (i = NIC_SRAM_STATS_BLK;
+	     i < NIC_SRAM_STATUS_BLK + TG3_HW_STATUS_SIZE;
+	     i += sizeof(u32)) {
+		tg3_write_mem(tp, i, 0);
+		udelay(40);
+	}
+	memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
+
 	tp->mac_mode = MAC_MODE_TXSTAT_ENABLE | MAC_MODE_RXSTAT_ENABLE |
 		MAC_MODE_TDE_ENABLE | MAC_MODE_RDE_ENABLE | MAC_MODE_FHDE_ENABLE;
 	tw32_f(MAC_MODE, tp->mac_mode | MAC_MODE_RXSTAT_CLEAR | MAC_MODE_TXSTAT_CLEAR);
@@ -4983,7 +5240,8 @@
 	tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0);
 	tr32(MAILBOX_INTERRUPT_0);
 
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750) {
 		tw32_f(DMAC_MODE, DMAC_MODE_ENABLE);
 		udelay(40);
 	}
@@ -4993,10 +5251,21 @@
 	       WDMAC_MODE_ADDROFLOW_ENAB | WDMAC_MODE_FIFOOFLOW_ENAB |
 	       WDMAC_MODE_FIFOURUN_ENAB | WDMAC_MODE_FIFOOREAD_ENAB |
 	       WDMAC_MODE_LNGREAD_ENAB);
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
-	    (tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) != 0 &&
-	    !(tp->tg3_flags2 & TG3_FLG2_IS_5788))
-		val |= WDMAC_MODE_RX_ACCEL;
+
+	if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
+	     tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
+		if ((tp->tg3_flags & TG3_FLG2_TSO_CAPABLE) &&
+		    (tp->pci_chip_rev_id == CHIPREV_ID_5705_A1 ||
+		     tp->pci_chip_rev_id == CHIPREV_ID_5705_A2)) {
+			/* nothing */
+		} else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) &&
+			   !(tp->tg3_flags2 & TG3_FLG2_IS_5788) &&
+			   !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) {
+			val |= WDMAC_MODE_RX_ACCEL;
+		}
+	}
+
 	tw32_f(WDMAC_MODE, val);
 	udelay(40);
 
@@ -5019,13 +5288,18 @@
 	udelay(40);
 
 	tw32(RCVDCC_MODE, RCVDCC_MODE_ENABLE | RCVDCC_MODE_ATTN_ENABLE);
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 &&
+	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750)
 		tw32(MBFREE_MODE, MBFREE_MODE_ENABLE);
 	tw32(SNDDATAC_MODE, SNDDATAC_MODE_ENABLE);
 	tw32(SNDBDC_MODE, SNDBDC_MODE_ENABLE | SNDBDC_MODE_ATTN_ENABLE);
 	tw32(RCVBDI_MODE, RCVBDI_MODE_ENABLE | RCVBDI_MODE_RCB_ATTN_ENAB);
 	tw32(RCVDBDI_MODE, RCVDBDI_MODE_ENABLE | RCVDBDI_MODE_INV_RING_SZ);
 	tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE);
+#if TG3_TSO_SUPPORT != 0
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
+		tw32(SNDDATAI_MODE, SNDDATAI_MODE_ENABLE | 0x8);
+#endif
 	tw32(SNDBDI_MODE, SNDBDI_MODE_ENABLE | SNDBDI_MODE_ATTN_ENABLE);
 	tw32(SNDBDS_MODE, SNDBDS_MODE_ENABLE | SNDBDS_MODE_ATTN_ENABLE);
 
@@ -5060,9 +5334,10 @@
 
 	tp->mi_mode = MAC_MI_MODE_BASE;
 	tw32_f(MAC_MI_MODE, tp->mi_mode);
-	udelay(40);
+	udelay(80);
+
+	tw32(MAC_LED_CTRL, tp->led_ctrl);
 
-	tw32(MAC_LED_CTRL, 0);
 	tw32(MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB);
 	if (tp->phy_id == PHY_ID_SERDES) {
 		tw32_f(MAC_RX_MODE, RX_MODE_RESET);
@@ -5109,7 +5384,8 @@
 	tw32(MAC_RCV_RULE_1,  0x86000004 & RCV_RULE_DISABLE_MASK);
 	tw32(MAC_RCV_VALUE_1, 0xffffffff & RCV_RULE_DISABLE_MASK);
 
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
 		limit = 8;
 	else
 		limit = 16;
@@ -5151,6 +5427,8 @@
 		break;
 	};
 
+	tg3_write_sig_post_reset(tp, RESET_KIND_INIT);
+
 	if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE)
 		tg3_enable_ints(tp);
 
@@ -5251,7 +5529,8 @@
 		return;
 	}
 
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
 		tg3_periodic_fetch_stats(tp);
 
 	/* This part only runs once per second. */
@@ -5321,7 +5600,7 @@
 
 static int tg3_open(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	int err;
 
 	spin_lock_irq(&tp->lock);
@@ -5624,7 +5903,7 @@
 
 static int tg3_close(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 
 	netif_stop_queue(dev);
 
@@ -5709,10 +5988,13 @@
 	if (!hw_stats)
 		return old_estats;
 
+	ESTAT_ADD(rx_octets);
 	ESTAT_ADD(rx_fragments);
 	ESTAT_ADD(rx_ucast_packets);
+	ESTAT_ADD(rx_mcast_packets);
 	ESTAT_ADD(rx_bcast_packets);
 	ESTAT_ADD(rx_fcs_errors);
+	ESTAT_ADD(rx_align_errors);
 	ESTAT_ADD(rx_xon_pause_rcvd);
 	ESTAT_ADD(rx_xoff_pause_rcvd);
 	ESTAT_ADD(rx_mac_ctrl_rcvd);
@@ -5722,7 +6004,19 @@
 	ESTAT_ADD(rx_undersize_packets);
 	ESTAT_ADD(rx_in_length_errors);
 	ESTAT_ADD(rx_out_length_errors);
+	ESTAT_ADD(rx_64_or_less_octet_packets);
+	ESTAT_ADD(rx_65_to_127_octet_packets);
+	ESTAT_ADD(rx_128_to_255_octet_packets);
+	ESTAT_ADD(rx_256_to_511_octet_packets);
+	ESTAT_ADD(rx_512_to_1023_octet_packets);
+	ESTAT_ADD(rx_1024_to_1522_octet_packets);
+	ESTAT_ADD(rx_1523_to_2047_octet_packets);
+	ESTAT_ADD(rx_2048_to_4095_octet_packets);
+	ESTAT_ADD(rx_4096_to_8191_octet_packets);
+	ESTAT_ADD(rx_8192_to_9022_octet_packets);
 
+	ESTAT_ADD(tx_octets);
+	ESTAT_ADD(tx_collisions);
 	ESTAT_ADD(tx_xon_sent);
 	ESTAT_ADD(tx_xoff_sent);
 	ESTAT_ADD(tx_flow_control);
@@ -5732,16 +6026,50 @@
 	ESTAT_ADD(tx_deferred);
 	ESTAT_ADD(tx_excessive_collisions);
 	ESTAT_ADD(tx_late_collisions);
+	ESTAT_ADD(tx_collide_2times);
+	ESTAT_ADD(tx_collide_3times);
+	ESTAT_ADD(tx_collide_4times);
+	ESTAT_ADD(tx_collide_5times);
+	ESTAT_ADD(tx_collide_6times);
+	ESTAT_ADD(tx_collide_7times);
+	ESTAT_ADD(tx_collide_8times);
+	ESTAT_ADD(tx_collide_9times);
+	ESTAT_ADD(tx_collide_10times);
+	ESTAT_ADD(tx_collide_11times);
+	ESTAT_ADD(tx_collide_12times);
+	ESTAT_ADD(tx_collide_13times);
+	ESTAT_ADD(tx_collide_14times);
+	ESTAT_ADD(tx_collide_15times);
 	ESTAT_ADD(tx_ucast_packets);
 	ESTAT_ADD(tx_mcast_packets);
 	ESTAT_ADD(tx_bcast_packets);
+	ESTAT_ADD(tx_carrier_sense_errors);
+	ESTAT_ADD(tx_discards);
+	ESTAT_ADD(tx_errors);
+
+	ESTAT_ADD(dma_writeq_full);
+	ESTAT_ADD(dma_write_prioq_full);
+	ESTAT_ADD(rxbds_empty);
+	ESTAT_ADD(rx_discards);
+	ESTAT_ADD(rx_errors);
+	ESTAT_ADD(rx_threshold_hit);
+
+	ESTAT_ADD(dma_readq_full);
+	ESTAT_ADD(dma_read_prioq_full);
+	ESTAT_ADD(tx_comp_queue_full);
+
+	ESTAT_ADD(ring_set_send_prod_index);
+	ESTAT_ADD(ring_status_update);
+	ESTAT_ADD(nic_irqs);
+	ESTAT_ADD(nic_avoided_irqs);
+	ESTAT_ADD(nic_tx_threshold_hit);
 
 	return estats;
 }
 
 static struct net_device_stats *tg3_get_stats(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	struct net_device_stats *stats = &tp->net_stats;
 	struct net_device_stats *old_stats = &tp->net_stats_prev;
 	struct tg3_hw_stats *hw_stats = tp->hw_stats;
@@ -5765,7 +6093,8 @@
 		get_stat64(&hw_stats->tx_octets);
 
 	stats->rx_errors = old_stats->rx_errors +
-		get_stat64(&hw_stats->rx_errors);
+		get_stat64(&hw_stats->rx_errors) +
+		get_stat64(&hw_stats->rx_discards);
 	stats->tx_errors = old_stats->tx_errors +
 		get_stat64(&hw_stats->tx_errors) +
 		get_stat64(&hw_stats->tx_mac_errors) +
@@ -5832,7 +6161,7 @@
 
 static void __tg3_set_rx_mode(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	u32 rx_mode;
 
 	rx_mode = tp->rx_mode & ~(RX_MODE_PROMISC |
@@ -5896,7 +6225,7 @@
 
 static void tg3_set_rx_mode(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 
 	spin_lock_irq(&tp->lock);
 	__tg3_set_rx_mode(dev);
@@ -5914,7 +6243,7 @@
 		struct ethtool_regs *regs, void *_p)
 {
 	u32 *p = _p;
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	u8 *orig_p = _p;
 	int i;
 
@@ -5977,9 +6306,75 @@
 	spin_unlock_irq(&tp->lock);
 }
 
+static int tg3_get_eeprom_len(struct net_device *dev)
+{
+	return EEPROM_CHIP_SIZE;
+}
+
+static int __devinit tg3_nvram_read_using_eeprom(struct tg3 *tp,
+						 u32 offset, u32 *val);
+static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data)
+{
+	struct tg3 *tp = dev->priv;
+	int ret;
+	u8  *pd;
+	u32 i, offset, len, val, b_offset, b_count;
+
+	offset = eeprom->offset;
+	len = eeprom->len;
+	eeprom->len = 0;
+
+	ret = tg3_nvram_read_using_eeprom(tp, 0, &eeprom->magic);
+	if (ret)
+		return ret;
+	eeprom->magic = swab32(eeprom->magic);
+
+	if (offset & 3) {
+		/* adjustments to start on required 4 byte boundary */
+		b_offset = offset & 3;
+		b_count = 4 - b_offset;
+		if (b_count > len) {
+			/* i.e. offset=1 len=2 */
+			b_count = len;
+		}
+		ret = tg3_nvram_read_using_eeprom(tp, offset-b_offset, &val);
+		if (ret)
+			return ret;
+		memcpy(data, ((char*)&val) + b_offset, b_count);
+		len -= b_count;
+		offset += b_count;
+	        eeprom->len += b_count;
+	}
+
+	/* read bytes upto the last 4 byte boundary */
+	pd = &data[eeprom->len];
+	for (i = 0; i < (len - (len & 3)); i += 4) {
+		ret = tg3_nvram_read_using_eeprom(tp, offset + i, 
+				(u32*)(pd + i));
+		if (ret) {
+			eeprom->len += i;
+			return ret;
+		}
+	}
+	eeprom->len += i;
+
+	if (len & 3) {
+		/* read last bytes not ending on 4 byte boundary */
+		pd = &data[eeprom->len];
+		b_count = len & 3;
+		b_offset = offset + len - b_count;
+		ret = tg3_nvram_read_using_eeprom(tp, b_offset, &val);
+		if (ret)
+			return ret;
+		memcpy(pd, ((char*)&val), b_count);
+		eeprom->len += b_count;
+	}
+	return 0;
+}
+
 static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-  	struct tg3 *tp = dev->priv;
+  	struct tg3 *tp = netdev_priv(dev);
   
 	if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
 					tp->link_config.phy_is_low_power)
@@ -6014,7 +6409,7 @@
   
 static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
 	    tp->link_config.phy_is_low_power)
@@ -6053,7 +6448,7 @@
   
 static void tg3_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	strcpy(info->driver, DRV_MODULE_NAME);
 	strcpy(info->version, DRV_MODULE_VERSION);
@@ -6062,7 +6457,7 @@
   
 static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	wol->supported = WAKE_MAGIC;
 	wol->wolopts = 0;
@@ -6073,7 +6468,7 @@
   
 static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	if (wol->wolopts & ~WAKE_MAGIC)
 		return -EINVAL;
@@ -6094,20 +6489,20 @@
   
 static u32 tg3_get_msglevel(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	return tp->msg_enable;
 }
   
 static void tg3_set_msglevel(struct net_device *dev, u32 value)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	tp->msg_enable = value;
 }
   
 #if TG3_TSO_SUPPORT != 0
 static int tg3_set_tso(struct net_device *dev, u32 value)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 
 	if (!(tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) {
 		if (value)
@@ -6120,7 +6515,7 @@
   
 static int tg3_nway_reset(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	u32 bmcr;
 	int r;
   
@@ -6139,7 +6534,7 @@
   
 static void tg3_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	ering->rx_max_pending = TG3_RX_RING_SIZE - 1;
 	ering->rx_mini_max_pending = 0;
@@ -6153,7 +6548,7 @@
   
 static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	if ((ering->rx_pending > TG3_RX_RING_SIZE - 1) ||
 	    (ering->rx_jumbo_pending > TG3_RX_JUMBO_RING_SIZE - 1) ||
@@ -6184,7 +6579,7 @@
   
 static void tg3_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	epause->autoneg = (tp->tg3_flags & TG3_FLAG_PAUSE_AUTONEG) != 0;
 	epause->rx_pause = (tp->tg3_flags & TG3_FLAG_PAUSE_RX) != 0;
@@ -6193,7 +6588,7 @@
   
 static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	tg3_netif_stop(tp);
 	spin_lock_irq(&tp->lock);
@@ -6221,13 +6616,13 @@
   
 static u32 tg3_get_rx_csum(struct net_device *dev)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	return (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0;
 }
   
 static int tg3_set_rx_csum(struct net_device *dev, u32 data)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) {
 		if (data != 0)
@@ -6247,7 +6642,7 @@
   
 static int tg3_set_tx_csum(struct net_device *dev, u32 data)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
   
 	if (tp->tg3_flags & TG3_FLAG_BROKEN_CHECKSUMS) {
 		if (data != 0)
@@ -6284,13 +6679,13 @@
 				   struct ethtool_stats *estats, u64 *tmp_stats)
 {
 	struct tg3 *tp = dev->priv;
-	memcpy(tmp_stats, &tp->estats, sizeof(tp->estats));
+	memcpy(tmp_stats, tg3_get_estats(tp), sizeof(tp->estats));
 }
 
 static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&ifr->ifr_data;
-	struct tg3 *tp = dev->priv;
+	struct mii_ioctl_data *data = if_mii(ifr);
+	struct tg3 *tp = netdev_priv(dev);
 	int err;
 
 	switch(cmd) {
@@ -6330,7 +6725,7 @@
 #if TG3_VLAN_TAG_USED
 static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 
 	spin_lock_irq(&tp->lock);
 	spin_lock(&tp->tx_lock);
@@ -6346,7 +6741,7 @@
 
 static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
 {
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 
 	spin_lock_irq(&tp->lock);
 	spin_lock(&tp->tx_lock);
@@ -6369,6 +6764,8 @@
 	.set_msglevel		= tg3_set_msglevel,
 	.nway_reset		= tg3_nway_reset,
 	.get_link		= ethtool_op_get_link,
+	.get_eeprom_len		= tg3_get_eeprom_len,
+	.get_eeprom		= tg3_get_eeprom,
 	.get_ringparam		= tg3_get_ringparam,
 	.set_ringparam		= tg3_set_ringparam,
 	.get_pauseparam		= tg3_get_pauseparam,
@@ -6412,7 +6809,15 @@
 
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
 	    GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701) {
-		u32 nvcfg1 = tr32(NVRAM_CFG1);
+		u32 nvcfg1;
+
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
+			u32 nvaccess = tr32(NVRAM_ACCESS);
+
+			tw32_f(NVRAM_ACCESS, nvaccess | ACCESS_ENABLE);
+		}
+
+		nvcfg1 = tr32(NVRAM_CFG1);
 
 		tp->tg3_flags |= TG3_FLAG_NVRAM;
 		if (nvcfg1 & NVRAM_CFG1_FLASHIF_ENAB) {
@@ -6423,6 +6828,11 @@
 			tw32(NVRAM_CFG1, nvcfg1);
 		}
 
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
+			u32 nvaccess = tr32(NVRAM_ACCESS);
+
+			tw32_f(NVRAM_ACCESS, nvaccess & ~ACCESS_ENABLE);
+		}
 	} else {
 		tp->tg3_flags &= ~(TG3_FLAG_NVRAM | TG3_FLAG_NVRAM_BUFFERED);
 	}
@@ -6465,7 +6875,7 @@
 static int __devinit tg3_nvram_read(struct tg3 *tp,
 				    u32 offset, u32 *val)
 {
-	int i, saw_done_clear;
+	int i;
 
 	if (tp->tg3_flags2 & TG3_FLG2_SUN_5704) {
 		printk(KERN_ERR PFX "Attempt to do nvram_read on Sun 5704\n");
@@ -6483,11 +6893,12 @@
 	if (offset > NVRAM_ADDR_MSK)
 		return -EINVAL;
 
-	tw32(NVRAM_SWARB, SWARB_REQ_SET1);
-	for (i = 0; i < 1000; i++) {
-		if (tr32(NVRAM_SWARB) & SWARB_GNT1)
-			break;
-		udelay(20);
+	tg3_nvram_lock(tp);
+
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
+		u32 nvaccess = tr32(NVRAM_ACCESS);
+
+		tw32_f(NVRAM_ACCESS, nvaccess | ACCESS_ENABLE);
 	}
 
 	tw32(NVRAM_ADDR, offset);
@@ -6495,24 +6906,26 @@
 	     NVRAM_CMD_RD | NVRAM_CMD_GO |
 	     NVRAM_CMD_FIRST | NVRAM_CMD_LAST | NVRAM_CMD_DONE);
 
-	/* Wait for done bit to clear then set again. */
-	saw_done_clear = 0;
+	/* Wait for done bit to clear. */
 	for (i = 0; i < 1000; i++) {
 		udelay(10);
-		if (!saw_done_clear &&
-		    !(tr32(NVRAM_CMD) & NVRAM_CMD_DONE))
-			saw_done_clear = 1;
-		else if (saw_done_clear &&
-			 (tr32(NVRAM_CMD) & NVRAM_CMD_DONE))
+		if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) {
+			udelay(10);
+			*val = swab32(tr32(NVRAM_RDDATA));
 			break;
+		}
 	}
-	if (i >= 1000) {
-		tw32(NVRAM_SWARB, SWARB_REQ_CLR1);
-		return -EBUSY;
+
+	tg3_nvram_unlock(tp);
+
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
+		u32 nvaccess = tr32(NVRAM_ACCESS);
+
+		tw32_f(NVRAM_ACCESS, nvaccess & ~ACCESS_ENABLE);
 	}
 
-	*val = swab32(tr32(NVRAM_RDDATA));
-	tw32(NVRAM_SWARB, 0x20);
+	if (i >= 1000)
+		return -EBUSY;
 
 	return 0;
 }
@@ -6564,7 +6977,6 @@
 {
 	u32 eeprom_phy_id, hw_phy_id_1, hw_phy_id_2;
 	u32 hw_phy_id, hw_phy_id_masked;
-	enum phy_led_mode eeprom_led_mode;
 	u32 val;
 	int i, eeprom_signature_found, err;
 
@@ -6580,11 +6992,10 @@
 	}
 
 	eeprom_phy_id = PHY_ID_INVALID;
-	eeprom_led_mode = led_mode_auto;
 	eeprom_signature_found = 0;
 	tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val);
 	if (val == NIC_SRAM_DATA_SIG_MAGIC) {
-		u32 nic_cfg;
+		u32 nic_cfg, led_cfg;
 
 		tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg);
 		tp->nic_sram_data_cfg = nic_cfg;
@@ -6608,28 +7019,64 @@
 			}
 		}
 
-		switch (nic_cfg & NIC_SRAM_DATA_CFG_LED_MODE_MASK) {
-		case NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD:
-			eeprom_led_mode = led_mode_three_link;
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
+			tg3_read_mem(tp, NIC_SRAM_DATA_CFG_2, &led_cfg);
+			led_cfg &= (NIC_SRAM_DATA_CFG_LED_MODE_MASK |
+				    SHASTA_EXT_LED_MODE_MASK);
+		} else
+			led_cfg = nic_cfg & NIC_SRAM_DATA_CFG_LED_MODE_MASK;
+
+		switch (led_cfg) {
+		default:
+		case NIC_SRAM_DATA_CFG_LED_MODE_PHY_1:
+			tp->led_ctrl = LED_CTRL_MODE_PHY_1;
 			break;
 
-		case NIC_SRAM_DATA_CFG_LED_LINK_SPD:
-			eeprom_led_mode = led_mode_link10;
+		case NIC_SRAM_DATA_CFG_LED_MODE_PHY_2:
+			tp->led_ctrl = LED_CTRL_MODE_PHY_2;
 			break;
 
-		default:
-			eeprom_led_mode = led_mode_auto;
+		case NIC_SRAM_DATA_CFG_LED_MODE_MAC:
+			tp->led_ctrl = LED_CTRL_MODE_MAC;
 			break;
+
+		case SHASTA_EXT_LED_SHARED:
+			tp->led_ctrl = LED_CTRL_MODE_SHARED;
+			if (tp->pci_chip_rev_id != CHIPREV_ID_5750_A0 &&
+			    tp->pci_chip_rev_id != CHIPREV_ID_5750_A1)
+				tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 |
+						 LED_CTRL_MODE_PHY_2);
+			break;
+
+		case SHASTA_EXT_LED_MAC:
+			tp->led_ctrl = LED_CTRL_MODE_SHASTA_MAC;
+			break;
+
+		case SHASTA_EXT_LED_COMBO:
+			tp->led_ctrl = LED_CTRL_MODE_COMBO;
+			if (tp->pci_chip_rev_id != CHIPREV_ID_5750_A0)
+				tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 |
+						 LED_CTRL_MODE_PHY_2);
+			break;
+
 		};
 
+		if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
+		     GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) &&
+		    tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL)
+			tp->led_ctrl = LED_CTRL_MODE_PHY_2;
+
 		if (((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) ||
 		     (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) ||
 		     (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) &&
 		    (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP))
 			tp->tg3_flags |= TG3_FLAG_EEPROM_WRITE_PROT;
 
-		if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE)
+		if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) {
 			tp->tg3_flags |= TG3_FLAG_ENABLE_ASF;
+			if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
+				tp->tg3_flags2 |= TG3_FLG2_ASF_NEW_HANDSHAKE;
+		}
 		if (nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL)
 			tp->tg3_flags |= TG3_FLAG_SERDES_WOL_CAP;
 	}
@@ -6678,10 +7125,7 @@
 		tg3_readphy(tp, MII_BMSR, &bmsr);
 		tg3_readphy(tp, MII_BMSR, &bmsr);
 
-		if ((bmsr & BMSR_LSTATUS) &&
-		    !(GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
-		      GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
-		      GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705))
+		if (bmsr & BMSR_LSTATUS)
 			goto skip_phy_reset;
 		    
 		err = tg3_phy_reset(tp);
@@ -6728,15 +7172,8 @@
 		err = tg3_init_5401phy_dsp(tp);
 	}
 
-	/* Determine the PHY led mode. */
-	if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL) {
-		tp->led_mode = led_mode_link10;
-	} else {
-		tp->led_mode = led_mode_three_link;
-		if (eeprom_signature_found &&
-		    eeprom_led_mode != led_mode_auto)
-			tp->led_mode = eeprom_led_mode;
-	}
+	if (!eeprom_signature_found)
+		tp->led_ctrl = LED_CTRL_MODE_PHY_1;
 
 	if (tp->phy_id == PHY_ID_SERDES)
 		tp->link_config.advertising =
@@ -6918,6 +7355,9 @@
 	tp->pci_hdr_type     = (cacheline_sz_reg >> 16) & 0xff;
 	tp->pci_bist         = (cacheline_sz_reg >> 24) & 0xff;
 
+	if (pci_find_capability(tp->pdev, PCI_CAP_ID_EXP) != 0)
+		tp->tg3_flags2 |= TG3_FLG2_PCI_EXPRESS;
+
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 &&
 	    tp->pci_lat_timer < 64) {
 		tp->pci_lat_timer = 64;
@@ -6970,8 +7410,12 @@
 	/* Back to back register writes can cause problems on this chip,
 	 * the workaround is to read back all reg writes except those to
 	 * mailbox regs.  See tg3_write_indirect_reg32().
+	 *
+	 * PCI Express 5750_A0 rev chips need this workaround too.
 	 */
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 ||
+	    ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
+	     tp->pci_chip_rev_id == CHIPREV_ID_5750_A0))
 		tp->tg3_flags |= TG3_FLAG_5701_REG_WRITE_BUG;
 
 	if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0)
@@ -7038,8 +7482,8 @@
 	if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0)
 		tp->tg3_flags2 |= TG3_FLG2_PHY_5704_A0_BUG;
 
-	/* Note: 5750 also needs this flag set to improve bit error rate. */
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
 		tp->tg3_flags2 |= TG3_FLG2_PHY_BER_BUG;
 
 	/* Only 5701 and later support tagged irq status mode.
@@ -7057,7 +7501,7 @@
 
 	/* Initialize MAC MI mode, polling disabled. */
 	tw32_f(MAC_MI_MODE, tp->mi_mode);
-	udelay(40);
+	udelay(80);
 
 	/* Initialize data/descriptor byte/word swapping. */
 	val = tr32(GRC_MODE);
@@ -7098,12 +7542,22 @@
 	udelay(50);
 	tg3_nvram_init(tp);
 
+	/* Always use host TXDs, it performs better in particular
+	 * with multi-frag packets.  The tests below are kept here
+	 * as documentation should we change this decision again
+	 * in the future.
+	 */
+	tp->tg3_flags |= TG3_FLAG_HOST_TXDS;
+
+#if 0
 	/* Determine if TX descriptors will reside in
 	 * main memory or in the chip SRAM.
 	 */
 	if ((tp->tg3_flags & TG3_FLAG_PCIX_TARGET_HWBUG) != 0 ||
-	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
 		tp->tg3_flags |= TG3_FLAG_HOST_TXDS;
+#endif
 
 	grc_misc_cfg = tr32(GRC_MISC_CFG);
 	grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK;
@@ -7126,7 +7580,9 @@
 	     tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
 	     (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5901 ||
 	      tp->pdev->device == PCI_DEVICE_ID_TIGON3_5901_2 ||
-	      tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)))
+	      tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) ||
+	    (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
+	     tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F))
 		tp->tg3_flags |= TG3_FLAG_10_100_ONLY;
 
 	err = tg3_phy_probe(tp);
@@ -7140,11 +7596,6 @@
 
 	if (tp->phy_id == PHY_ID_SERDES) {
 		tp->tg3_flags &= ~TG3_FLAG_USE_MI_INTERRUPT;
-
-		/* And override led_mode in case Dell ever makes
-		 * a fibre board.
-		 */
-		tp->led_mode = led_mode_three_link;
 	} else {
 		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700)
 			tp->tg3_flags |= TG3_FLAG_USE_MI_INTERRUPT;
@@ -7161,7 +7612,7 @@
 	else
 		tp->tg3_flags &= ~TG3_FLAG_USE_LINKCHG_REG;
 
-	/* The led_mode is set during tg3_phy_probe, here we might
+	/* The led_ctrl is set during tg3_phy_probe, here we might
 	 * have to force the link status polling mechanism based
 	 * upon subsystem IDs.
 	 */
@@ -7244,10 +7695,16 @@
 		return 0;
 #endif
 
-	if (PCI_FUNC(tp->pdev->devfn) == 0)
-		mac_offset = 0x7c;
-	else
-		mac_offset = 0xcc;
+	mac_offset = 0x7c;
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
+	    !(tp->tg3_flags & TG3_FLG2_SUN_5704)) {
+		if (tr32(TG3PCI_DUAL_MAC_CTRL) & DUAL_MAC_CTRL_ID)
+			mac_offset = 0xcc;
+		if (tg3_nvram_lock(tp))
+			tw32_f(NVRAM_CMD, NVRAM_CMD_RESET);
+		else
+			tg3_nvram_unlock(tp);
+	}
 
 	/* First try to get it from MAC address mailbox. */
 	tg3_read_mem(tp, NIC_SRAM_MAC_ADDR_HIGH_MBOX, &hi);
@@ -7390,50 +7847,9 @@
 		goto out_nofree;
 	}
 
-	if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) == 0) {
-		tp->dma_rwctrl =
-			(0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
-			(0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) |
-			(0x7 << DMA_RWCTRL_WRITE_WATER_SHIFT) |
-			(0x7 << DMA_RWCTRL_READ_WATER_SHIFT) |
-			(0x0f << DMA_RWCTRL_MIN_DMA_SHIFT);
-		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
-			tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA
-					    << DMA_RWCTRL_MIN_DMA_SHIFT);
-	} else {
-		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
-			tp->dma_rwctrl =
-				(0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
-				(0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) |
-				(0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) |
-				(0x7 << DMA_RWCTRL_READ_WATER_SHIFT) |
-				(0x00 << DMA_RWCTRL_MIN_DMA_SHIFT);
-		else
-			tp->dma_rwctrl =
-				(0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
-				(0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT) |
-				(0x3 << DMA_RWCTRL_WRITE_WATER_SHIFT) |
-				(0x3 << DMA_RWCTRL_READ_WATER_SHIFT) |
-				(0x0f << DMA_RWCTRL_MIN_DMA_SHIFT);
+	tp->dma_rwctrl = ((0x7 << DMA_RWCTRL_PCI_WRITE_CMD_SHIFT) |
+			  (0x6 << DMA_RWCTRL_PCI_READ_CMD_SHIFT));
 
-		/* Wheee, some more chip bugs... */
-		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
-		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
-			u32 ccval = (tr32(TG3PCI_CLOCK_CTRL) & 0x1f);
-
-			if (ccval == 0x6 || ccval == 0x7)
-				tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA;
-		}
-	}
-
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
-	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
-		tp->dma_rwctrl &= ~(DMA_RWCTRL_MIN_DMA
-				    << DMA_RWCTRL_MIN_DMA_SHIFT);
-
-	/* We don't do this on x86 because it seems to hurt performace.
-	 * It does help things on other platforms though.
-	 */
 #ifndef CONFIG_X86
 	{
 		u8 byte;
@@ -7445,55 +7861,63 @@
 		else
 			cacheline_size = (int) byte * 4;
 
-		tp->dma_rwctrl &= ~(DMA_RWCTRL_READ_BNDRY_MASK |
-				    DMA_RWCTRL_WRITE_BNDRY_MASK);
-
 		switch (cacheline_size) {
 		case 16:
-			tp->dma_rwctrl |=
-				(DMA_RWCTRL_READ_BNDRY_16 |
-				 DMA_RWCTRL_WRITE_BNDRY_16);
-			break;
-
 		case 32:
-			tp->dma_rwctrl |=
-				(DMA_RWCTRL_READ_BNDRY_32 |
-				 DMA_RWCTRL_WRITE_BNDRY_32);
-			break;
-
 		case 64:
-			tp->dma_rwctrl |=
-				(DMA_RWCTRL_READ_BNDRY_64 |
-				 DMA_RWCTRL_WRITE_BNDRY_64);
-			break;
-
 		case 128:
-			tp->dma_rwctrl |=
-				(DMA_RWCTRL_READ_BNDRY_128 |
-				 DMA_RWCTRL_WRITE_BNDRY_128);
-			break;
-
+			if ((tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
+			    !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) {
+				tp->dma_rwctrl |=
+					DMA_RWCTRL_WRITE_BNDRY_384_PCIX;
+				break;
+			} else if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
+				tp->dma_rwctrl &=
+					~(DMA_RWCTRL_PCI_WRITE_CMD);
+				tp->dma_rwctrl |=
+					DMA_RWCTRL_WRITE_BNDRY_128_PCIE;
+				break;
+			}
+			/* fallthrough */
 		case 256:
-			tp->dma_rwctrl |=
-				(DMA_RWCTRL_READ_BNDRY_256 |
-				 DMA_RWCTRL_WRITE_BNDRY_256);
-			break;
-
-		case 512:
-			tp->dma_rwctrl |=
-				(DMA_RWCTRL_READ_BNDRY_512 |
-				 DMA_RWCTRL_WRITE_BNDRY_512);
-			break;
-
-		case 1024:
-			tp->dma_rwctrl |=
-				(DMA_RWCTRL_READ_BNDRY_1024 |
-				 DMA_RWCTRL_WRITE_BNDRY_1024);
-			break;
+			if (!(tp->tg3_flags & TG3_FLAG_PCIX_MODE) &&
+			    !(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS))
+				tp->dma_rwctrl |=
+					DMA_RWCTRL_WRITE_BNDRY_256;
+			else if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS))
+				tp->dma_rwctrl |=
+					DMA_RWCTRL_WRITE_BNDRY_256_PCIX;
 		};
 	}
 #endif
 
+	if (tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) {
+		tp->dma_rwctrl |= 0x001f0000;
+	} else if (!(tp->tg3_flags & TG3_FLAG_PCIX_MODE)) {
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750)
+			tp->dma_rwctrl |= 0x003f0000;
+		else
+			tp->dma_rwctrl |= 0x003f000f;
+	} else {
+		if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
+		    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
+			u32 ccval = (tr32(TG3PCI_CLOCK_CTRL) & 0x1f);
+
+			if (ccval == 0x6 || ccval == 0x7)
+				tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA;
+
+			/* Set bit 23 to renable PCIX hw bug fix */
+			tp->dma_rwctrl |= 0x009f0000;
+		} else {
+			tp->dma_rwctrl |= 0x001b000f;
+		}
+	}
+
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
+		tp->dma_rwctrl &= 0xfffffff0;
+
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) {
 		/* Remove this if it causes problems for some boards. */
@@ -7636,6 +8060,7 @@
 	case PHY_ID_BCM5703:	return "5703";
 	case PHY_ID_BCM5704:	return "5704";
 	case PHY_ID_BCM5705:	return "5705";
+	case PHY_ID_BCM5750:	return "5750";
 	case PHY_ID_BCM8002:	return "8002";
 	case PHY_ID_SERDES:	return "serdes";
 	default:		return "unknown";
@@ -7750,7 +8175,7 @@
 	dev->vlan_rx_kill_vid = tg3_vlan_rx_kill_vid;
 #endif
 
-	tp = dev->priv;
+	tp = netdev_priv(dev);
 	tp->pdev = pdev;
 	tp->dev = dev;
 	tp->pm_cap = pm_cap;
@@ -7829,7 +8254,8 @@
 		goto err_out_iounmap;
 	}
 
-	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
+	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750) {
 		tp->bufmgr_config.mbuf_read_dma_low_water =
 			DEFAULT_MB_RDMA_LOW_WATER_5705;
 		tp->bufmgr_config.mbuf_mac_rx_low_water =
@@ -7842,8 +8268,8 @@
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
 	    GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 ||
 	    tp->pci_chip_rev_id == CHIPREV_ID_5705_A0 ||
-	    (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0 ||
-	    (tp->tg3_flags2 & TG3_FLG2_IS_5788)) {
+	    ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0 &&
+	     GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5750)) {
 		tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
 	} else {
 		tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
@@ -7970,8 +8396,10 @@
 	struct net_device *dev = pci_get_drvdata(pdev);
 
 	if (dev) {
+		struct tg3 *tp = netdev_priv(dev);
+
 		unregister_netdev(dev);
-		iounmap((void *) ((struct tg3 *)(dev->priv))->regs);
+		iounmap((void *)tp->regs);
 		free_netdev(dev);
 		pci_release_regions(pdev);
 		pci_disable_device(pdev);
@@ -7982,7 +8410,7 @@
 static int tg3_suspend(struct pci_dev *pdev, u32 state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	int err;
 
 	if (!netif_running(dev))
@@ -8029,11 +8457,13 @@
 static int tg3_resume(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
-	struct tg3 *tp = dev->priv;
+	struct tg3 *tp = netdev_priv(dev);
 	int err;
 
 	if (!netif_running(dev))
 		return 0;
+
+	pci_restore_state(tp->pdev, tp->pci_cfg_state);
 
 	err = tg3_set_power_state(tp, 0);
 	if (err)
diff -Nru a/drivers/net/tg3.h b/drivers/net/tg3.h
--- a/drivers/net/tg3.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/tg3.h	Tue Jun 15 22:20:37 2004
@@ -118,12 +118,17 @@
 #define  CHIPREV_ID_5704_A2		 0x2002
 #define  CHIPREV_ID_5705_A0		 0x3000
 #define  CHIPREV_ID_5705_A1		 0x3001
+#define  CHIPREV_ID_5705_A2		 0x3002
+#define  CHIPREV_ID_5705_A3		 0x3003
+#define  CHIPREV_ID_5750_A0		 0x4000
+#define  CHIPREV_ID_5750_A1		 0x4001
 #define  GET_ASIC_REV(CHIP_REV_ID)	((CHIP_REV_ID) >> 12)
 #define   ASIC_REV_5700			 0x07
 #define   ASIC_REV_5701			 0x00
 #define   ASIC_REV_5703			 0x01
 #define   ASIC_REV_5704			 0x02
 #define   ASIC_REV_5705			 0x03
+#define   ASIC_REV_5750			 0x04
 #define  GET_CHIP_REV(CHIP_REV_ID)	((CHIP_REV_ID) >> 8)
 #define   CHIPREV_5700_AX		 0x70
 #define   CHIPREV_5700_BX		 0x71
@@ -144,8 +149,11 @@
 #define  DMA_RWCTRL_READ_BNDRY_MASK	 0x00000700
 #define  DMA_RWCTRL_READ_BNDRY_DISAB	 0x00000000
 #define  DMA_RWCTRL_READ_BNDRY_16	 0x00000100
+#define  DMA_RWCTRL_READ_BNDRY_128_PCIX	 0x00000100
 #define  DMA_RWCTRL_READ_BNDRY_32	 0x00000200
+#define  DMA_RWCTRL_READ_BNDRY_256_PCIX	 0x00000200
 #define  DMA_RWCTRL_READ_BNDRY_64	 0x00000300
+#define  DMA_RWCTRL_READ_BNDRY_384_PCIX	 0x00000300
 #define  DMA_RWCTRL_READ_BNDRY_128	 0x00000400
 #define  DMA_RWCTRL_READ_BNDRY_256	 0x00000500
 #define  DMA_RWCTRL_READ_BNDRY_512	 0x00000600
@@ -153,8 +161,11 @@
 #define  DMA_RWCTRL_WRITE_BNDRY_MASK	 0x00003800
 #define  DMA_RWCTRL_WRITE_BNDRY_DISAB	 0x00000000
 #define  DMA_RWCTRL_WRITE_BNDRY_16	 0x00000800
+#define  DMA_RWCTRL_WRITE_BNDRY_128_PCIX 0x00000800
 #define  DMA_RWCTRL_WRITE_BNDRY_32	 0x00001000
+#define  DMA_RWCTRL_WRITE_BNDRY_256_PCIX 0x00001000
 #define  DMA_RWCTRL_WRITE_BNDRY_64	 0x00001800
+#define  DMA_RWCTRL_WRITE_BNDRY_384_PCIX 0x00001800
 #define  DMA_RWCTRL_WRITE_BNDRY_128	 0x00002000
 #define  DMA_RWCTRL_WRITE_BNDRY_256	 0x00002800
 #define  DMA_RWCTRL_WRITE_BNDRY_512	 0x00003000
@@ -170,6 +181,9 @@
 #define  DMA_RWCTRL_PCI_READ_CMD_SHIFT	 24
 #define  DMA_RWCTRL_PCI_WRITE_CMD	 0xf0000000
 #define  DMA_RWCTRL_PCI_WRITE_CMD_SHIFT	 28
+#define  DMA_RWCTRL_WRITE_BNDRY_64_PCIE	 0x10000000
+#define  DMA_RWCTRL_WRITE_BNDRY_128_PCIE 0x30000000
+#define  DMA_RWCTRL_WRITE_BNDRY_DISAB_PCIE 0x70000000
 #define TG3PCI_PCISTATE			0x00000070
 #define  PCISTATE_FORCE_RESET		 0x00000001
 #define  PCISTATE_INT_NOT_ACTIVE	 0x00000002
@@ -202,7 +216,11 @@
 #define TG3PCI_STD_RING_PROD_IDX	0x00000098 /* 64-bit */
 #define TG3PCI_RCV_RET_RING_CON_IDX	0x000000a0 /* 64-bit */
 #define TG3PCI_SND_PROD_IDX		0x000000a8 /* 64-bit */
-/* 0xb0 --> 0x100 unused */
+/* 0xb0 --> 0xb8 unused */
+#define TG3PCI_DUAL_MAC_CTRL		0x000000b8
+#define  DUAL_MAC_CTRL_CH_MASK		 0x00000003
+#define  DUAL_MAC_CTRL_ID		 0x00000004
+/* 0xbc --> 0x100 unused */
 
 /* 0x100 --> 0x200 unused */
 
@@ -334,9 +352,12 @@
 #define  LED_CTRL_100MBPS_STATUS	 0x00000100
 #define  LED_CTRL_10MBPS_STATUS		 0x00000200
 #define  LED_CTRL_TRAFFIC_STATUS	 0x00000400
-#define  LED_CTRL_MAC_MODE		 0x00000000
-#define  LED_CTRL_PHY_MODE_1		 0x00000800
-#define  LED_CTRL_PHY_MODE_2		 0x00001000
+#define  LED_CTRL_MODE_MAC		 0x00000000
+#define  LED_CTRL_MODE_PHY_1		 0x00000800
+#define  LED_CTRL_MODE_PHY_2		 0x00001000
+#define  LED_CTRL_MODE_SHASTA_MAC	 0x00002000
+#define  LED_CTRL_MODE_SHARED		 0x00004000
+#define  LED_CTRL_MODE_COMBO		 0x00008000
 #define  LED_CTRL_BLINK_RATE_MASK	 0x7ff80000
 #define  LED_CTRL_BLINK_RATE_SHIFT	 19
 #define  LED_CTRL_BLINK_PER_OVERRIDE	 0x00080000
@@ -1332,6 +1353,9 @@
 #define  SWARB_REQ3			 0x00008000
 #define    NVRAM_BUFFERED_PAGE_SIZE	   264
 #define    NVRAM_BUFFERED_PAGE_POS	   9
+#define NVRAM_ACCESS			0x00007024
+#define  ACCESS_ENABLE			 0x00000001
+#define  ACCESS_WR_ENABLE		 0x00000002
 /* 0x7024 --> 0x7400 unused */
 
 /* 0x7400 --> 0x8000 unused */
@@ -1355,11 +1379,9 @@
 
 #define NIC_SRAM_DATA_CFG			0x00000b58
 #define  NIC_SRAM_DATA_CFG_LED_MODE_MASK	 0x0000000c
-#define  NIC_SRAM_DATA_CFG_LED_MODE_UNKNOWN	 0x00000000
-#define  NIC_SRAM_DATA_CFG_LED_TRIPLE_SPD	 0x00000004
-#define  NIC_SRAM_DATA_CFG_LED_OPEN_DRAIN	 0x00000004
-#define  NIC_SRAM_DATA_CFG_LED_LINK_SPD		 0x00000008
-#define  NIC_SRAM_DATA_CFG_LED_OUTPUT		 0x00000008
+#define  NIC_SRAM_DATA_CFG_LED_MODE_MAC		 0x00000000
+#define  NIC_SRAM_DATA_CFG_LED_MODE_PHY_1	 0x00000004
+#define  NIC_SRAM_DATA_CFG_LED_MODE_PHY_2	 0x00000008
 #define  NIC_SRAM_DATA_CFG_PHY_TYPE_MASK	 0x00000030
 #define  NIC_SRAM_DATA_CFG_PHY_TYPE_UNKNOWN	 0x00000000
 #define  NIC_SRAM_DATA_CFG_PHY_TYPE_COPPER	 0x00000010
@@ -1386,7 +1408,9 @@
 #define NIC_SRAM_FW_ASF_STATUS_MBOX	0x00000c00
 #define NIC_SRAM_FW_DRV_STATE_MBOX	0x00000c04
 #define  DRV_STATE_START		 0x00000001
+#define  DRV_STATE_START_DONE		 0x80000001
 #define  DRV_STATE_UNLOAD		 0x00000002
+#define  DRV_STATE_UNLOAD_DONE		 0x80000002
 #define  DRV_STATE_WOL			 0x00000003
 #define  DRV_STATE_SUSPEND		 0x00000004
 
@@ -1395,6 +1419,14 @@
 #define NIC_SRAM_MAC_ADDR_HIGH_MBOX	0x00000c14
 #define NIC_SRAM_MAC_ADDR_LOW_MBOX	0x00000c18
 
+#define NIC_SRAM_DATA_CFG_2		0x00000d38
+
+#define  SHASTA_EXT_LED_MODE_MASK	 0x00018000
+#define  SHASTA_EXT_LED_LEGACY		 0x00000000
+#define  SHASTA_EXT_LED_SHARED		 0x00008000
+#define  SHASTA_EXT_LED_MAC		 0x00010000
+#define  SHASTA_EXT_LED_COMBO		 0x00018000
+
 #define NIC_SRAM_RX_MINI_BUFFER_DESC	0x00001000
 
 #define NIC_SRAM_DMA_DESC_POOL_BASE	0x00002000
@@ -1756,12 +1788,6 @@
 	u8				__reserved4[0xb00-0x9c0];
 };
 
-enum phy_led_mode {
-	led_mode_auto,
-	led_mode_three_link,
-	led_mode_link10
-};
-
 /* 'mapping' is superfluous as the chip does not write into
  * the tx/rx post rings so we could just fetch it from there.
  * But the cache behavior is better how we are doing it now.
@@ -1819,10 +1845,13 @@
 
 struct tg3_ethtool_stats {
 	/* Statistics maintained by Receive MAC. */
+	u64 	    	rx_octets;
 	u64		rx_fragments;
 	u64		rx_ucast_packets;
+	u64		rx_mcast_packets;
 	u64		rx_bcast_packets;
 	u64		rx_fcs_errors;
+	u64		rx_align_errors;
 	u64		rx_xon_pause_rcvd;
 	u64		rx_xoff_pause_rcvd;
 	u64		rx_mac_ctrl_rcvd;
@@ -1832,8 +1861,20 @@
 	u64		rx_undersize_packets;
 	u64		rx_in_length_errors;
 	u64		rx_out_length_errors;
+	u64		rx_64_or_less_octet_packets;
+	u64		rx_65_to_127_octet_packets;
+	u64		rx_128_to_255_octet_packets;
+	u64		rx_256_to_511_octet_packets;
+	u64		rx_512_to_1023_octet_packets;
+	u64		rx_1024_to_1522_octet_packets;
+	u64		rx_1523_to_2047_octet_packets;
+	u64		rx_2048_to_4095_octet_packets;
+	u64		rx_4096_to_8191_octet_packets;
+	u64		rx_8192_to_9022_octet_packets;
 
 	/* Statistics maintained by Transmit MAC. */
+	u64		tx_octets;
+	u64		tx_collisions;
 	u64		tx_xon_sent;
 	u64		tx_xoff_sent;
 	u64		tx_flow_control;
@@ -1843,9 +1884,46 @@
 	u64		tx_deferred;
 	u64		tx_excessive_collisions;
 	u64		tx_late_collisions;
+	u64		tx_collide_2times;
+	u64		tx_collide_3times;
+	u64		tx_collide_4times;
+	u64		tx_collide_5times;
+	u64		tx_collide_6times;
+	u64		tx_collide_7times;
+	u64		tx_collide_8times;
+	u64		tx_collide_9times;
+	u64		tx_collide_10times;
+	u64		tx_collide_11times;
+	u64		tx_collide_12times;
+	u64		tx_collide_13times;
+	u64		tx_collide_14times;
+	u64		tx_collide_15times;
 	u64		tx_ucast_packets;
 	u64		tx_mcast_packets;
 	u64		tx_bcast_packets;
+	u64		tx_carrier_sense_errors;
+	u64		tx_discards;
+	u64		tx_errors;
+
+	/* Statistics maintained by Receive List Placement. */
+	u64		dma_writeq_full;
+	u64		dma_write_prioq_full;
+	u64		rxbds_empty;
+	u64		rx_discards;
+	u64		rx_errors;
+	u64		rx_threshold_hit;
+
+	/* Statistics maintained by Send Data Initiator. */
+	u64		dma_readq_full;
+	u64		dma_read_prioq_full;
+	u64		tx_comp_queue_full;
+
+	/* Statistics maintained by Host Coalescing. */
+	u64		ring_set_send_prod_index;
+	u64		ring_status_update;
+	u64		nic_irqs;
+	u64		nic_avoided_irqs;
+	u64		nic_tx_threshold_hit;
 };
 
 struct tg3 {
@@ -1964,6 +2042,8 @@
 #define TG3_FLG2_PHY_ADC_BUG		0x00000040
 #define TG3_FLG2_PHY_5704_A0_BUG	0x00000080
 #define TG3_FLG2_PHY_BER_BUG		0x00000100
+#define TG3_FLG2_PCI_EXPRESS		0x00000200
+#define TG3_FLG2_ASF_NEW_HANDSHAKE	0x00000400
 
 	u32				split_mode_max_reqs;
 #define SPLIT_MODE_5704_MAX_REQ		3
@@ -2009,6 +2089,7 @@
 #define PHY_ID_BCM5703			0x60008160
 #define PHY_ID_BCM5704			0x60008190
 #define PHY_ID_BCM5705			0x600081a0
+#define PHY_ID_BCM5750			0x60008180
 #define PHY_ID_BCM8002			0x60010140
 #define PHY_ID_SERDES			0xfeedbee0
 #define PHY_ID_INVALID			0xffffffff
@@ -2018,7 +2099,7 @@
 #define PHY_REV_BCM5401_C0		0x6
 #define PHY_REV_BCM5411_X0		0x1 /* Found on Netgear GA302T */
 
-	enum phy_led_mode		led_mode;
+	u32				led_ctrl;
 
 	char				board_part_number[24];
 	u32				nic_sram_data_cfg;
@@ -2032,7 +2113,7 @@
 	((X) == PHY_ID_BCM5400 || (X) == PHY_ID_BCM5401 || \
 	 (X) == PHY_ID_BCM5411 || (X) == PHY_ID_BCM5701 || \
 	 (X) == PHY_ID_BCM5703 || (X) == PHY_ID_BCM5704 || \
-	 (X) == PHY_ID_BCM5705 || \
+	 (X) == PHY_ID_BCM5705 || (X) == PHY_ID_BCM5750 || \
 	 (X) == PHY_ID_BCM8002 || (X) == PHY_ID_SERDES)
 
 	struct tg3_hw_stats		*hw_stats;
diff -Nru a/drivers/net/tlan.c b/drivers/net/tlan.c
--- a/drivers/net/tlan.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/tlan.c	Tue Jun 15 22:20:37 2004
@@ -446,7 +446,9 @@
 		pci_free_consistent(priv->pciDev, priv->dmaSize, priv->dmaStorage, priv->dmaStorageDMA );
 	}
 
+#ifdef CONFIG_PCI
 	pci_release_regions(pdev);
+#endif
 	
 	free_netdev( dev );
 		
@@ -673,8 +675,10 @@
 err_out_free_dev:
 	free_netdev(dev);
 err_out_regions:
+#ifdef CONFIG_PCI
 	if (pdev)
 		pci_release_regions(pdev);
+#endif
 err_out:
 	if (pdev)
 		pci_disable_device(pdev);
@@ -980,7 +984,7 @@
 static int TLan_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	TLanPrivateInfo *priv = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 	u32 phy   = priv->phy[priv->phyNum];
 	
 	if (!priv->phyOnline)
diff -Nru a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
--- a/drivers/net/tokenring/olympic.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/net/tokenring/olympic.c	Tue Jun 15 22:20:43 2004
@@ -1806,7 +1806,7 @@
 
 static void __exit olympic_pci_cleanup(void)
 {
-	return pci_unregister_driver(&olympic_driver) ; 
+	pci_unregister_driver(&olympic_driver) ; 
 }	
 
 
diff -Nru a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
--- a/drivers/net/tulip/de2104x.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/net/tulip/de2104x.c	Tue Jun 15 22:20:43 2004
@@ -357,13 +357,6 @@
 static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
 
 
-static inline unsigned long
-msec_to_jiffies(unsigned long ms)
-{
-	return (((ms)*HZ+999)/1000);
-}
-
-
 #define dr32(reg)		readl(de->regs + (reg))
 #define dw32(reg,val)		writel((val), de->regs + (reg))
 
@@ -1216,7 +1209,7 @@
 
 		/* de4x5.c delays, so we do too */
 		current->state = TASK_UNINTERRUPTIBLE;
-		schedule_timeout(msec_to_jiffies(10));
+		schedule_timeout(msecs_to_jiffies(10));
 	}
 }
 
diff -Nru a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
--- a/drivers/net/tulip/de4x5.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/tulip/de4x5.c	Tue Jun 15 22:20:36 2004
@@ -5535,7 +5535,7 @@
 de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
     struct de4x5_private *lp = netdev_priv(dev);
-    struct de4x5_ioctl *ioc = (struct de4x5_ioctl *) &rq->ifr_data;
+    struct de4x5_ioctl *ioc = (struct de4x5_ioctl *) &rq->ifr_ifru;
     u_long iobase = dev->base_addr;
     int i, j, status = 0;
     s32 omr;
diff -Nru a/drivers/net/tulip/de4x5.h b/drivers/net/tulip/de4x5.h
--- a/drivers/net/tulip/de4x5.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/tulip/de4x5.h	Tue Jun 15 22:20:42 2004
@@ -1005,7 +1005,7 @@
 struct de4x5_ioctl {
 	unsigned short cmd;                /* Command to run */
 	unsigned short len;                /* Length of the data buffer */
-	unsigned char  *data;              /* Pointer to the data buffer */
+	unsigned char  __user *data;       /* Pointer to the data buffer */
 };
 
 /* 
diff -Nru a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
--- a/drivers/net/tulip/dmfe.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/net/tulip/dmfe.c	Tue Jun 15 22:20:58 2004
@@ -299,6 +299,9 @@
 static struct ethtool_ops netdev_ethtool_ops;
 static u16 read_srom_word(long ,int);
 static irqreturn_t dmfe_interrupt(int , void *, struct pt_regs *);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void poll_dmfe (struct net_device *dev);
+#endif
 static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long);
 static void allocate_rx_buffer(struct dmfe_board_info *);
 static void update_cr6(u32, unsigned long);
@@ -417,6 +420,9 @@
 	dev->stop = &dmfe_stop;
 	dev->get_stats = &dmfe_get_stats;
 	dev->set_multicast_list = &dmfe_set_filter_mode;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev->poll_controller = &poll_dmfe;
+#endif
 	dev->ethtool_ops = &netdev_ethtool_ops;
 	spin_lock_init(&db->lock);
 
@@ -790,6 +796,23 @@
 	return IRQ_HANDLED;
 }
 
+
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+
+static void poll_dmfe (struct net_device *dev)
+{
+	/* disable_irq here is not very nice, but with the lockless
+	   interrupt handler we have no other choice. */
+	disable_irq(dev->irq);
+	dmfe_interrupt (dev->irq, dev, NULL);
+	enable_irq(dev->irq);
+}
+#endif
 
 /*
  *	Free TX resource after TX complete
diff -Nru a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
--- a/drivers/net/tulip/eeprom.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/tulip/eeprom.c	Tue Jun 15 22:21:03 2004
@@ -90,12 +90,8 @@
  */
 static void __devinit tulip_build_fake_mediatable(struct tulip_private *tp)
 {
-#ifdef __hppa__
-	unsigned char *ee_data = tp->eeprom;
-
-	if (ee_data[0] == 0x3c && ee_data[1] == 0x10 && 
-		(ee_data[2] == 0x63 || ee_data[2] == 0x61) && ee_data[3] == 0x10) {
-
+#ifdef CONFIG_GSC
+	if (tp->flags & NEEDS_FAKE_MEDIA_TABLE) {
 		static unsigned char leafdata[] =
 			{ 0x01,       /* phy number */
 			  0x02,       /* gpr setup sequence length */
@@ -306,12 +302,12 @@
 
 /*  EEPROM_Ctrl bits. */
 #define EE_SHIFT_CLK	0x02	/* EEPROM shift clock. */
-#define EE_CS			0x01	/* EEPROM chip select. */
+#define EE_CS		0x01	/* EEPROM chip select. */
 #define EE_DATA_WRITE	0x04	/* Data from the Tulip to EEPROM. */
-#define EE_WRITE_0		0x01
-#define EE_WRITE_1		0x05
+#define EE_WRITE_0	0x01
+#define EE_WRITE_1	0x05
 #define EE_DATA_READ	0x08	/* Data from the EEPROM chip. */
-#define EE_ENB			(0x4800 | EE_CS)
+#define EE_ENB		(0x4800 | EE_CS)
 
 /* Delay between EEPROM clock transitions.
    Even at 33Mhz current PCI implementations don't overrun the EEPROM clock.
@@ -322,11 +318,12 @@
 #define EE_READ_CMD		(6)
 
 /* Note: this routine returns extra data bits for size detection. */
-int __devinit tulip_read_eeprom(long ioaddr, int location, int addr_len)
+int __devinit tulip_read_eeprom(struct net_device *dev, int location, int addr_len)
 {
 	int i;
 	unsigned retval = 0;
-	long ee_addr = ioaddr + CSR9;
+	struct tulip_private *tp = dev->priv;
+	long ee_addr = tp->base_addr + CSR9;
 	int read_cmd = location | (EE_READ_CMD << addr_len);
 
 	outl(EE_ENB & ~EE_CS, ee_addr);
@@ -354,6 +351,6 @@
 
 	/* Terminate the EEPROM access. */
 	outl(EE_ENB & ~EE_CS, ee_addr);
-	return retval;
+	return (tp->flags & HAS_SWAPPED_SEEPROM) ? swab16(retval) : retval;
 }
 
diff -Nru a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
--- a/drivers/net/tulip/interrupt.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/tulip/interrupt.c	Tue Jun 15 22:20:38 2004
@@ -133,6 +133,10 @@
 			   tp->rx_ring[entry].status);
 
        do {
+		if (inl(dev->base_addr + CSR5) == 0xffffffff) {
+			printk(KERN_DEBUG " In tulip_poll(), hardware disappeared.\n");
+			break;
+		}
                /* Acknowledge current RX interrupt sources. */
                outl((RxIntr | RxNoBuf), dev->base_addr + CSR5);
  
diff -Nru a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h
--- a/drivers/net/tulip/tulip.h	Tue Jun 15 22:21:02 2004
+++ b/drivers/net/tulip/tulip.h	Tue Jun 15 22:21:02 2004
@@ -64,6 +64,8 @@
 	COMET_MAC_ADDR		= 0x0800,
 	HAS_PCI_MWI		= 0x1000,
 	HAS_PHY_IRQ		= 0x2000,
+	HAS_SWAPPED_SEEPROM	= 0x4000,
+	NEEDS_FAKE_MEDIA_TABLE	= 0x8000,
 };
 
 
@@ -407,7 +409,7 @@
 
 /* eeprom.c */
 void tulip_parse_eeprom(struct net_device *dev);
-int tulip_read_eeprom(long ioaddr, int location, int addr_len);
+int tulip_read_eeprom(struct net_device *dev, int location, int addr_len);
 
 /* interrupt.c */
 extern unsigned int tulip_max_interrupt_work;
diff -Nru a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
--- a/drivers/net/tulip/tulip_core.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/tulip/tulip_core.c	Tue Jun 15 22:20:41 2004
@@ -226,8 +226,9 @@
 	{ 0x1113, 0x1216, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
 	{ 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 },
 	{ 0x1113, 0x9511, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
-	{ 0x14f1, 0x1803, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CONEXANT },
+	{ 0x1186, 0x1541, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
 	{ 0x1186, 0x1561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
+	{ 0x14f1, 0x1803, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CONEXANT },
 	{ 0x1626, 0x8410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
 	{ 0x1737, 0xAB09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
 	{ 0x1737, 0xAB08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, COMET },
@@ -829,7 +830,7 @@
 }
 
 
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct tulip_private *np = netdev_priv(dev);
 	u32 ethcmd;
@@ -858,14 +859,14 @@
 {
 	struct tulip_private *tp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 	const unsigned int phy_idx = 0;
 	int phy = tp->phys[phy_idx] & 0x1f;
 	unsigned int regnum = data->reg_num;
 
 	switch (cmd) {
 	case SIOCETHTOOL:
-		return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		return netdev_ethtool_ioctl(dev, rq->ifr_data);
 
 	case SIOCGMIIPHY:		/* Get address of MII PHY in use. */
 		if (tp->mii_cnt)
@@ -1245,6 +1246,7 @@
 	long ioaddr;
 	static int board_idx = -1;
 	int chip_idx = ent->driver_data;
+	const char *chip_name = tulip_tbl[chip_idx].chip_name;
 	unsigned int eeprom_missing = 0;
 	unsigned int force_csr0 = 0;
 
@@ -1413,6 +1415,23 @@
 
 	pci_set_master(pdev);
 
+#ifdef CONFIG_GSC
+	if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP) {
+		switch (pdev->subsystem_device) {
+		default:
+			break;
+		case 0x1061:
+		case 0x1062:
+		case 0x1063:
+		case 0x1098:
+		case 0x1099:
+		case 0x10EE:
+			tp->flags |= HAS_SWAPPED_SEEPROM | NEEDS_FAKE_MEDIA_TABLE;
+			chip_name = "GSC DS21140 Tulip";
+		}
+	}
+#endif
+
 	/* Clear the missed-packet counter. */
 	inl(ioaddr + CSR8);
 
@@ -1441,11 +1460,13 @@
 	} else {
 		/* A serial EEPROM interface, we read now and sort it out later. */
 		int sa_offset = 0;
-		int ee_addr_size = tulip_read_eeprom(ioaddr, 0xff, 8) & 0x40000 ? 8 : 6;
+		int ee_addr_size = tulip_read_eeprom(dev, 0xff, 8) & 0x40000 ? 8 : 6;
 
-		for (i = 0; i < sizeof(tp->eeprom)/2; i++)
-			((u16 *)ee_data)[i] =
-				le16_to_cpu(tulip_read_eeprom(ioaddr, i, ee_addr_size));
+		for (i = 0; i < sizeof(tp->eeprom); i+=2) {
+			u16 data = tulip_read_eeprom(dev, i/2, ee_addr_size);
+			ee_data[i] = data & 0xff;
+			ee_data[i + 1] = data >> 8;
+		}
 
 		/* DEC now has a specification (see Notes) but early board makers
 		   just put the address in the first EEPROM locations. */
@@ -1488,25 +1509,26 @@
                        tp->flags &= ~HAS_MEDIA_TABLE;
                }
 #endif
-#ifdef __hppa__
-		/* 3x5 HSC (J3514A) has a broken srom */
-		if(ee_data[0] == 0x61 && ee_data[1] == 0x10) {
+#ifdef CONFIG_GSC
+		/* Check to see if we have a broken srom */
+		if (ee_data[0] == 0x61 && ee_data[1] == 0x10) {
 			/* pci_vendor_id and subsystem_id are swapped */
 			ee_data[0] = ee_data[2];
 			ee_data[1] = ee_data[3];
 			ee_data[2] = 0x61;
 			ee_data[3] = 0x10;
 
-			/* srom need to be byte-swaped and shifted up 1 word.  
-			 * This shift needs to happen at the end of the MAC
-			 * first because of the 2 byte overlap.
+			/* HSC-PCI boards need to be byte-swaped and shifted
+			 * up 1 word.  This shift needs to happen at the end
+			 * of the MAC first because of the 2 byte overlap.
 			 */
-			for(i = 4; i >= 0; i -= 2) {
+			for (i = 4; i >= 0; i -= 2) {
 				ee_data[17 + i + 3] = ee_data[17 + i];
 				ee_data[16 + i + 5] = ee_data[16 + i];
 			}
 		}
 #endif
+
 		for (i = 0; i < 6; i ++) {
 			dev->dev_addr[i] = ee_data[i + sa_offset];
 			sum += ee_data[i + sa_offset];
@@ -1627,7 +1649,7 @@
 		goto err_out_free_ring;
 
 	printk(KERN_INFO "%s: %s rev %d at %#3lx,",
-	       dev->name, tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr);
+	       dev->name, chip_name, chip_rev, ioaddr);
 	pci_set_drvdata(pdev, dev);
 
 	if (eeprom_missing)
diff -Nru a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
--- a/drivers/net/tulip/winbond-840.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/tulip/winbond-840.c	Tue Jun 15 22:20:37 2004
@@ -1526,8 +1526,8 @@
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
-	struct netdev_private *np = dev->priv;
+	struct mii_ioctl_data *data = if_mii(rq);
+	struct netdev_private *np = netdev_priv(dev);
 
 	switch(cmd) {
 	case SIOCGMIIPHY:		/* Get address of MII PHY in use. */
@@ -1733,10 +1733,7 @@
 
 static int __init w840_init(void)
 {
-/* when a module, this is printed whether or not devices are found in probe */
-#ifdef MODULE
 	printk(version);
-#endif
 	return pci_module_init(&w840_driver);
 }
 
diff -Nru a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c
--- a/drivers/net/tulip/xircom_tulip_cb.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/tulip/xircom_tulip_cb.c	Tue Jun 15 22:20:37 2004
@@ -1369,7 +1369,7 @@
 }
 
 
-static int xircom_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int xircom_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct ethtool_cmd ecmd;
 	struct xircom_private *tp = dev->priv;
@@ -1471,13 +1471,13 @@
 static int xircom_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct xircom_private *tp = dev->priv;
-	u16 *data = (u16 *)&rq->ifr_data;
+	u16 *data = (u16 *)&rq->ifr_ifru;
 	int phy = tp->phys[0] & 0x1f;
 	unsigned long flags;
 
 	switch(cmd) {
 	case SIOCETHTOOL:
-		return xircom_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		return xircom_ethtool_ioctl(dev, rq->ifr_data);
 
 	/* Legacy mii-diag interface */
 	case SIOCGMIIPHY:		/* Get address of MII PHY in use. */
diff -Nru a/drivers/net/tun.c b/drivers/net/tun.c
--- a/drivers/net/tun.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/tun.c	Tue Jun 15 22:20:40 2004
@@ -129,8 +129,8 @@
 		dev->addr_len = 0;
 		dev->mtu = 1500;
 
-		/* Type PPP seems most suitable */
-		dev->type = ARPHRD_PPP; 
+		/* Zero header length */
+		dev->type = ARPHRD_NONE; 
 		dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
 		dev->tx_queue_len = 10;
 		break;
@@ -241,10 +241,10 @@
 }
 
 /* Write */
-static ssize_t tun_chr_write(struct file * file, const char * buf, 
+static ssize_t tun_chr_write(struct file * file, const char __user * buf, 
 			     size_t count, loff_t *pos)
 {
-	struct iovec iv = { (void *) buf, count };
+	struct iovec iv = { (void __user *) buf, count };
 	return tun_chr_writev(file, &iv, 1, pos);
 }
 
@@ -333,7 +333,7 @@
 }
 
 /* Read */
-static ssize_t tun_chr_read(struct file * file, char * buf, 
+static ssize_t tun_chr_read(struct file * file, char __user * buf, 
 			    size_t count, loff_t *pos)
 {
 	struct iovec iv = { buf, count };
@@ -462,7 +462,7 @@
 		struct ifreq ifr;
 		int err;
 
-		if (copy_from_user(&ifr, (void *)arg, sizeof(ifr)))
+		if (copy_from_user(&ifr, (void __user *)arg, sizeof(ifr)))
 			return -EFAULT;
 		ifr.ifr_name[IFNAMSIZ-1] = '\0';
 
@@ -473,7 +473,7 @@
 		if (err)
 			return err;
 
-		if (copy_to_user((void *)arg, &ifr, sizeof(ifr)))
+		if (copy_to_user((void __user *)arg, &ifr, sizeof(ifr)))
 			return -EFAULT;
 		return 0;
 	}
diff -Nru a/drivers/net/typhoon.c b/drivers/net/typhoon.c
--- a/drivers/net/typhoon.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/typhoon.c	Tue Jun 15 22:20:42 2004
@@ -1162,7 +1162,7 @@
 }
 
 static inline int
-typhoon_ethtool_ioctl(struct net_device *dev, void *useraddr)
+typhoon_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct typhoon *tp = (struct typhoon *) dev->priv;
 	u32 ethcmd;
@@ -1237,7 +1237,7 @@
 {
 	switch (cmd) {
 	case SIOCETHTOOL:
-		return typhoon_ethtool_ioctl(dev, (void *) ifr->ifr_data);
+		return typhoon_ethtool_ioctl(dev, ifr->ifr_data);
 	default:
 		break;
 	}
diff -Nru a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
--- a/drivers/net/via-rhine.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/net/via-rhine.c	Tue Jun 15 22:21:04 2004
@@ -74,8 +74,8 @@
 
 	LK1.1.11:
 	- David Woodhouse: Set dev->base_addr before the first time we call
-					   wait_for_reset(). It's a lot happier that way.
-					   Free np->tx_bufs only if we actually allocated it.
+			   wait_for_reset(). It's a lot happier that way.
+			   Free np->tx_bufs only if we actually allocated it.
 
 	LK1.1.12:
 	- Martin Eriksson: Allow Memory-Mapped IO to be enabled.
@@ -85,7 +85,7 @@
 	- Replace some MII-related magic numbers with constants
 
 	LK1.1.14 (Ivan G.):
- 	- fixes comments for Rhine-III
+	- fixes comments for Rhine-III
 	- removes W_MAX_TIMEOUT (unused)
 	- adds HasDavicomPhy for Rhine-I (basis: linuxfet driver; my card
 	  is R-I and has Davicom chip, flag is referenced in kernel driver)
@@ -96,10 +96,10 @@
 	- transmit frame queue message is off by one - fixed
 	- adds IntrNormalSummary to "Something Wicked" exclusion list
 	  so normal interrupts will not trigger the message (src: Donald Becker)
- 	(Roger Luethi)
- 	- show confused chip where to continue after Tx error
- 	- location of collision counter is chip specific
- 	- allow selecting backoff algorithm (module parameter)
+	(Roger Luethi)
+	- show confused chip where to continue after Tx error
+	- location of collision counter is chip specific
+	- allow selecting backoff algorithm (module parameter)
 
 	LK1.1.15 (jgarzik):
 	- Use new MII lib helper generic_mii_ioctl
@@ -128,14 +128,14 @@
 */
 
 #define DRV_NAME	"via-rhine"
-#define DRV_VERSION	"1.1.19-2.5"
-#define DRV_RELDATE	"July-12-2003"
+#define DRV_VERSION	"1.1.20-2.6"
+#define DRV_RELDATE	"May-23-2004"
 
 
 /* A few user-configurable values.
    These may be modified when a driver module is loaded. */
 
-static int debug = 1;			/* 1 normal messages, 0 quiet .. 7 verbose. */
+static int debug = 1;	/* 1 normal messages, 0 quiet .. 7 verbose. */
 static int max_interrupt_work = 20;
 
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
@@ -155,12 +155,12 @@
    Use option values 0x10 and 0x100 for forcing half duplex fixed speed.
    Use option values 0x20 and 0x200 for forcing full duplex operation.
 */
-#define MAX_UNITS 8		/* More are supported, limit only on options */
+#define MAX_UNITS	8	/* More are supported, limit only on options */
 static int options[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
-   The Rhine has a 64 element 8390-like hash table.  */
+   The Rhine has a 64 element 8390-like hash table. */
 static const int multicast_filter_limit = 32;
 
 
@@ -172,16 +172,16 @@
    bonding and packet priority.
    There are no ill effects from too-large receive rings. */
 #define TX_RING_SIZE	16
-#define TX_QUEUE_LEN	10		/* Limit ring entries actually used.  */
+#define TX_QUEUE_LEN	10	/* Limit ring entries actually used. */
 #define RX_RING_SIZE	16
 
 
 /* Operational parameters that usually are not changed. */
 
 /* Time in jiffies before concluding the transmitter is hung. */
-#define TX_TIMEOUT  (2*HZ)
+#define TX_TIMEOUT	(2*HZ)
 
-#define PKT_BUF_SZ		1536			/* Size of each temporary Rx buffer.*/
+#define PKT_BUF_SZ	1536	/* Size of each temporary Rx buffer.*/
 
 #if !defined(__OPTIMIZE__)  ||  !defined(__KERNEL__)
 #warning  You must compile this file with the correct options!
@@ -206,7 +206,7 @@
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/crc32.h>
-#include <asm/processor.h>		/* Processor type for cache alignment. */
+#include <asm/processor.h>	/* Processor type for cache alignment. */
 #include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -214,18 +214,16 @@
 
 /* These identify the driver base version and may not be removed. */
 static char version[] __devinitdata =
-KERN_INFO DRV_NAME ".c:v1.10-LK" DRV_VERSION "  " DRV_RELDATE "  Written by Donald Becker\n"
-KERN_INFO "  http://www.scyld.com/network/via-rhine.html\n";
+KERN_INFO DRV_NAME ".c:v1.10-LK" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n";
 
 static char shortname[] = DRV_NAME;
 
 
-/* This driver was written to use PCI memory space, however most versions
-   of the Rhine only work correctly with I/O space accesses. */
+/* This driver was written to use PCI memory space. Some early versions
+   of the Rhine may only work correctly with I/O space accesses. */
 #ifdef CONFIG_VIA_RHINE_MMIO
-#define USE_MEM
+#define USE_MMIO
 #else
-#define USE_IO
 #undef readb
 #undef readw
 #undef readl
@@ -258,7 +256,7 @@
 MODULE_PARM_DESC(full_duplex, "VIA Rhine full duplex setting(s) (1)");
 
 /*
-				Theory of Operation
+		Theory of Operation
 
 I. Board Compatibility
 
@@ -281,7 +279,7 @@
 
 This driver uses two statically allocated fixed-size descriptor lists
 formed into rings by a branch from the final descriptor to the beginning of
-the list.  The ring sizes are set at compile time by RX/TX_RING_SIZE.
+the list. The ring sizes are set at compile time by RX/TX_RING_SIZE.
 
 IIIb/c. Transmit/Receive Structure
 
@@ -292,29 +290,29 @@
 
 The driver allocates full frame size skbuffs for the Rx ring buffers at
 open() time and passes the skb->data field to the chip as receive data
-buffers.  When an incoming frame is less than RX_COPYBREAK bytes long,
+buffers. When an incoming frame is less than RX_COPYBREAK bytes long,
 a fresh skbuff is allocated and the frame is copied to the new skbuff.
 When the incoming frame is larger, the skbuff is passed directly up the
-protocol stack.  Buffers consumed this way are replaced by newly allocated
-skbuffs in the last phase of via_rhine_rx().
+protocol stack. Buffers consumed this way are replaced by newly allocated
+skbuffs in the last phase of rhine_rx().
 
 The RX_COPYBREAK value is chosen to trade-off the memory wasted by
 using a full-sized skbuff for small frames vs. the copying costs of larger
-frames.  New boards are typically used in generously configured machines
+frames. New boards are typically used in generously configured machines
 and the underfilled buffers have negligible impact compared to the benefit of
 a single allocation size, so the default value of zero results in never
-copying packets.  When copying is done, the cost is usually mitigated by using
-a combined copy/checksum routine.  Copying also preloads the cache, which is
+copying packets. When copying is done, the cost is usually mitigated by using
+a combined copy/checksum routine. Copying also preloads the cache, which is
 most useful with small frames.
 
 Since the VIA chips are only able to transfer data to buffers on 32 bit
 boundaries, the IP header at offset 14 in an ethernet frame isn't
-longword aligned for further processing.  Copying these unaligned buffers
+longword aligned for further processing. Copying these unaligned buffers
 has the beneficial effect of 16-byte aligning the IP header.
 
 IIId. Synchronization
 
-The driver runs as two independent, single-threaded flows of control.  One
+The driver runs as two independent, single-threaded flows of control. One
 is the send-packet routine, which enforces single-threaded use by the
 dev->priv->lock spinlock. The other thread is the interrupt handler, which
 is single threaded by the hardware and interrupt handling software.
@@ -324,7 +322,7 @@
 is not available it stops the transmit queue by calling netif_stop_queue.
 
 The interrupt handler has exclusive control over the Rx ring and records stats
-from the Tx ring.  After reaping the stats, it marks the Tx queue entry as
+from the Tx ring. After reaping the stats, it marks the Tx queue entry as
 empty by incrementing the dirty_tx mark. If at least half of the entries in
 the Rx ring are available the transmit queue is woken up if it was stopped.
 
@@ -350,7 +348,7 @@
 */
 
 
-/* This table drives the PCI probe routines.  It's mostly boilerplate in all
+/* This table drives the PCI probe routines. It's mostly boilerplate in all
    of the drivers, and will likely be provided by some future kernel.
    Note the matching code -- the first table entry matchs all 56** cards but
    second only the 1234 card.
@@ -361,14 +359,14 @@
 	PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3,
 };
 
-enum via_rhine_chips {
+enum rhine_chips {
 	VT86C100A = 0,
 	VT6102,
 	VT6105,
 	VT6105M
 };
 
-struct via_rhine_chip_info {
+struct rhine_chip_info {
 	const char *name;
 	u16 pci_flags;
 	int io_size;
@@ -378,9 +376,10 @@
 
 enum chip_capability_flags {
 	CanHaveMII=1, HasESIPhy=2, HasDavicomPhy=4,
-	ReqTxAlign=0x10, HasWOL=0x20, };
+	ReqTxAlign=0x10, HasWOL=0x20,
+};
 
-#ifdef USE_MEM
+#ifdef USE_MMIO
 #define RHINE_IOTYPE (PCI_USES_MEM | PCI_USES_MASTER | PCI_ADDR1)
 #else
 #define RHINE_IOTYPE (PCI_USES_IO  | PCI_USES_MASTER | PCI_ADDR0)
@@ -388,8 +387,8 @@
 /* Beware of PCI posted writes */
 #define IOSYNC	do { readb(dev->base_addr + StationAddr); } while (0)
 
-/* directly indexed by enum via_rhine_chips, above */
-static struct via_rhine_chip_info via_rhine_chip_info[] __devinitdata =
+/* directly indexed by enum rhine_chips, above */
+static struct rhine_chip_info rhine_chip_info[] __devinitdata =
 {
 	{ "VIA VT86C100A Rhine", RHINE_IOTYPE, 128,
 	  CanHaveMII | ReqTxAlign | HasDavicomPhy },
@@ -401,15 +400,15 @@
 	  CanHaveMII | HasWOL },
 };
 
-static struct pci_device_id via_rhine_pci_tbl[] =
+static struct pci_device_id rhine_pci_tbl[] =
 {
 	{0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT86C100A},
 	{0x1106, 0x3065, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT6102},
 	{0x1106, 0x3106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT6105}, /* 6105{,L,LOM} */
 	{0x1106, 0x3053, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT6105M},
-	{0,}			/* terminate list */
+	{0,}	/* terminate list */
 };
-MODULE_DEVICE_TABLE(pci, via_rhine_pci_tbl);
+MODULE_DEVICE_TABLE(pci, rhine_pci_tbl);
 
 
 /* Offsets to the device registers. */
@@ -432,7 +431,7 @@
 	BackCaptureEffect=0x04, BackRandom=0x08
 };
 
-#ifdef USE_MEM
+#ifdef USE_MMIO
 /* Registers we check that mmio and reg are the same. */
 int mmio_verify_registers[] = {
 	RxConfig, TxConfig, IntrEnable, ConfigA, ConfigB, ConfigC, ConfigD,
@@ -469,7 +468,7 @@
 };
 
 /* Initial value for tx_desc.desc_length, Buffer size goes to bits 0-10 */
-#define TXDESC 0x00e08000
+#define TXDESC		0x00e08000
 
 enum rx_status_bits {
 	RxOK=0x8000, RxWholePkt=0x0300, RxErr=0x008F
@@ -489,7 +488,7 @@
 };
 
 #define MAX_MII_CNT	4
-struct netdev_private {
+struct rhine_private {
 	/* Descriptor rings */
 	struct rx_desc *rx_ring;
 	struct tx_desc *tx_ring;
@@ -517,48 +516,48 @@
 	/* Frequently used values: keep some adjacent for cache effect. */
 	int chip_id, drv_flags;
 	struct rx_desc *rx_head_desc;
-	unsigned int cur_rx, dirty_rx;		/* Producer/consumer ring indices */
+	unsigned int cur_rx, dirty_rx;	/* Producer/consumer ring indices */
 	unsigned int cur_tx, dirty_tx;
-	unsigned int rx_buf_sz;				/* Based on MTU+slack. */
-	u16 chip_cmd;						/* Current setting for ChipCmd */
+	unsigned int rx_buf_sz;		/* Based on MTU+slack. */
+	u16 chip_cmd;			/* Current setting for ChipCmd */
 
 	/* These values are keep track of the transceiver/media in use. */
-	unsigned int default_port:4;		/* Last dev->if_port value. */
+	unsigned int default_port:4;	/* Last dev->if_port value. */
 	u8 tx_thresh, rx_thresh;
 
 	/* MII transceiver section. */
-	unsigned char phys[MAX_MII_CNT];			/* MII device addresses. */
-	unsigned int mii_cnt;			/* number of MIIs found, but only the first one is used */
-	u16 mii_status;						/* last read MII status */
+	unsigned char phys[MAX_MII_CNT];	/* MII device addresses. */
+	unsigned int mii_cnt;		/* number of MIIs found, but only the first one is used */
+	u16 mii_status;			/* last read MII status */
 	struct mii_if_info mii_if;
 };
 
 static int  mdio_read(struct net_device *dev, int phy_id, int location);
 static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
-static int  via_rhine_open(struct net_device *dev);
-static void via_rhine_check_duplex(struct net_device *dev);
-static void via_rhine_timer(unsigned long data);
-static void via_rhine_tx_timeout(struct net_device *dev);
-static int  via_rhine_start_tx(struct sk_buff *skb, struct net_device *dev);
-static irqreturn_t via_rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
-static void via_rhine_tx(struct net_device *dev);
-static void via_rhine_rx(struct net_device *dev);
-static void via_rhine_error(struct net_device *dev, int intr_status);
-static void via_rhine_set_rx_mode(struct net_device *dev);
-static struct net_device_stats *via_rhine_get_stats(struct net_device *dev);
+static int  rhine_open(struct net_device *dev);
+static void rhine_check_duplex(struct net_device *dev);
+static void rhine_timer(unsigned long data);
+static void rhine_tx_timeout(struct net_device *dev);
+static int  rhine_start_tx(struct sk_buff *skb, struct net_device *dev);
+static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs);
+static void rhine_tx(struct net_device *dev);
+static void rhine_rx(struct net_device *dev);
+static void rhine_error(struct net_device *dev, int intr_status);
+static void rhine_set_rx_mode(struct net_device *dev);
+static struct net_device_stats *rhine_get_stats(struct net_device *dev);
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static struct ethtool_ops netdev_ethtool_ops;
-static int  via_rhine_close(struct net_device *dev);
+static int  rhine_close(struct net_device *dev);
 
 static inline u32 get_intr_status(struct net_device *dev)
 {
 	long ioaddr = dev->base_addr;
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	u32 intr_status;
 
 	intr_status = readw(ioaddr + IntrStatus);
 	/* On Rhine-II, Bit 3 indicates Tx descriptor write-back race. */
-	if (np->chip_id == VT6102)
+	if (rp->chip_id == VT6102)
 		intr_status |= readb(ioaddr + IntrStatus2) << 16;
 	return intr_status;
 }
@@ -590,7 +589,7 @@
 			boguscnt ? "succeeded" : "failed");
 }
 
-#ifdef USE_MEM
+#ifdef USE_MMIO
 static void __devinit enable_mmio(long ioaddr, int chip_id)
 {
 	int n;
@@ -616,19 +615,19 @@
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
-static void via_rhine_poll(struct net_device *dev)
+static void rhine_poll(struct net_device *dev)
 {
 	disable_irq(dev->irq);
-	via_rhine_interrupt(dev->irq, (void *)dev, NULL);
+	rhine_interrupt(dev->irq, (void *)dev, NULL);
 	enable_irq(dev->irq);
 }
 #endif
 
-static int __devinit via_rhine_init_one (struct pci_dev *pdev,
-					 const struct pci_device_id *ent)
+static int __devinit rhine_init_one(struct pci_dev *pdev,
+				    const struct pci_device_id *ent)
 {
 	struct net_device *dev;
-	struct netdev_private *np;
+	struct rhine_private *rp;
 	int i, option;
 	int chip_id = (int) ent->driver_data;
 	static int card_idx = -1;
@@ -636,7 +635,7 @@
 	long memaddr;
 	int io_size;
 	int pci_flags;
-#ifdef USE_MEM
+#ifdef USE_MMIO
 	long ioaddr0;
 #endif
 
@@ -649,34 +648,36 @@
 
 	card_idx++;
 	option = card_idx < MAX_UNITS ? options[card_idx] : 0;
-	io_size = via_rhine_chip_info[chip_id].io_size;
-	pci_flags = via_rhine_chip_info[chip_id].pci_flags;
+	io_size = rhine_chip_info[chip_id].io_size;
+	pci_flags = rhine_chip_info[chip_id].pci_flags;
 
-	if (pci_enable_device (pdev))
+	if (pci_enable_device(pdev))
 		goto err_out;
 
 	/* this should always be supported */
 	if (pci_set_dma_mask(pdev, 0xffffffff)) {
-		printk(KERN_ERR "32-bit PCI DMA addresses not supported by the card!?\n");
+		printk(KERN_ERR "32-bit PCI DMA addresses not supported by "
+		       "the card!?\n");
 		goto err_out;
 	}
 
 	/* sanity check */
-	if ((pci_resource_len (pdev, 0) < io_size) ||
-	    (pci_resource_len (pdev, 1) < io_size)) {
-		printk (KERN_ERR "Insufficient PCI resources, aborting\n");
+	if ((pci_resource_len(pdev, 0) < io_size) ||
+	    (pci_resource_len(pdev, 1) < io_size)) {
+		printk(KERN_ERR "Insufficient PCI resources, aborting\n");
 		goto err_out;
 	}
 
-	ioaddr = pci_resource_start (pdev, 0);
-	memaddr = pci_resource_start (pdev, 1);
+	ioaddr = pci_resource_start(pdev, 0);
+	memaddr = pci_resource_start(pdev, 1);
 
 	if (pci_flags & PCI_USES_MASTER)
-		pci_set_master (pdev);
+		pci_set_master(pdev);
 
-	dev = alloc_etherdev(sizeof(*np));
+	dev = alloc_etherdev(sizeof(*rp));
 	if (dev == NULL) {
-		printk (KERN_ERR "init_ethernet failed for card #%d\n", card_idx);
+		printk(KERN_ERR "init_ethernet failed for card #%d\n",
+		       card_idx);
 		goto err_out;
 	}
 	SET_MODULE_OWNER(dev);
@@ -685,14 +686,14 @@
 	if (pci_request_regions(pdev, shortname))
 		goto err_out_free_netdev;
 
-#ifdef USE_MEM
+#ifdef USE_MMIO
 	ioaddr0 = ioaddr;
 	enable_mmio(ioaddr0, chip_id);
 
-	ioaddr = (long) ioremap (memaddr, io_size);
+	ioaddr = (long) ioremap(memaddr, io_size);
 	if (!ioaddr) {
-		printk (KERN_ERR "ioremap failed for device %s, region 0x%X @ 0x%lX\n",
-				pci_name(pdev), io_size, memaddr);
+		printk(KERN_ERR "ioremap failed for device %s, region 0x%X "
+		       "@ 0x%lX\n", pci_name(pdev), io_size, memaddr);
 		goto err_out_free_res;
 	}
 
@@ -703,15 +704,15 @@
 		unsigned char a = inb(ioaddr0+reg);
 		unsigned char b = readb(ioaddr+reg);
 		if (a != b) {
-			printk (KERN_ERR "MMIO do not match PIO [%02x] (%02x != %02x)\n",
-					reg, a, b);
+			printk(KERN_ERR "MMIO do not match PIO [%02x] "
+			       "(%02x != %02x)\n", reg, a, b);
 			goto err_out_unmap;
 		}
 	}
-#endif
+#endif /* USE_MMIO */
 
 	/* D-Link provided reset code (with comment additions) */
-	if (via_rhine_chip_info[chip_id].drv_flags & HasWOL) {
+	if (rhine_chip_info[chip_id].drv_flags & HasWOL) {
 		unsigned char byOrgValue;
 
 		/* clear sticky bit before reset & read ethernet address */
@@ -735,14 +736,14 @@
 	wait_for_reset(dev, chip_id, shortname);
 
 	/* Reload the station address from the EEPROM. */
-#ifdef USE_IO
-	reload_eeprom(ioaddr);
-#else
+#ifdef USE_MMIO
 	reload_eeprom(ioaddr0);
 	/* Reloading from eeprom overwrites cfgA-D, so we must re-enable MMIO.
 	   If reload_eeprom() was done first this could be avoided, but it is
 	   not known if that still works with the "win98-reboot" problem. */
 	enable_mmio(ioaddr0, chip_id);
+#else
+	reload_eeprom(ioaddr);
 #endif
 
 	for (i = 0; i < 6; i++)
@@ -756,7 +757,7 @@
 	if (chip_id == VT6102) {
 		/*
 		 * for 3065D, EEPROM reloaded will cause bit 0 in MAC_REG_CFGA
-		 * turned on.  it makes MAC receive magic packet
+		 * turned on. it makes MAC receive magic packet
 		 * automatically. So, we turn it off. (D-Link)
 		 */
 		writeb(readb(ioaddr + ConfigA) & 0xFE, ioaddr + ConfigA);
@@ -765,38 +766,38 @@
 	/* Select backoff algorithm */
 	if (backoff)
 		writeb(readb(ioaddr + ConfigD) & (0xF0 | backoff),
-			ioaddr + ConfigD);
+		       ioaddr + ConfigD);
 
 	dev->irq = pdev->irq;
 
-	np = dev->priv;
-	spin_lock_init (&np->lock);
-	np->chip_id = chip_id;
-	np->drv_flags = via_rhine_chip_info[chip_id].drv_flags;
-	np->pdev = pdev;
-	np->mii_if.dev = dev;
-	np->mii_if.mdio_read = mdio_read;
-	np->mii_if.mdio_write = mdio_write;
-	np->mii_if.phy_id_mask = 0x1f;
-	np->mii_if.reg_num_mask = 0x1f;
+	rp = netdev_priv(dev);
+	spin_lock_init(&rp->lock);
+	rp->chip_id = chip_id;
+	rp->drv_flags = rhine_chip_info[chip_id].drv_flags;
+	rp->pdev = pdev;
+	rp->mii_if.dev = dev;
+	rp->mii_if.mdio_read = mdio_read;
+	rp->mii_if.mdio_write = mdio_write;
+	rp->mii_if.phy_id_mask = 0x1f;
+	rp->mii_if.reg_num_mask = 0x1f;
 
 	if (dev->mem_start)
 		option = dev->mem_start;
 
 	/* The chip-specific entries in the device structure. */
-	dev->open = via_rhine_open;
-	dev->hard_start_xmit = via_rhine_start_tx;
-	dev->stop = via_rhine_close;
-	dev->get_stats = via_rhine_get_stats;
-	dev->set_multicast_list = via_rhine_set_rx_mode;
+	dev->open = rhine_open;
+	dev->hard_start_xmit = rhine_start_tx;
+	dev->stop = rhine_close;
+	dev->get_stats = rhine_get_stats;
+	dev->set_multicast_list = rhine_set_rx_mode;
 	dev->do_ioctl = netdev_ioctl;
 	dev->ethtool_ops = &netdev_ethtool_ops;
-	dev->tx_timeout = via_rhine_tx_timeout;
+	dev->tx_timeout = rhine_tx_timeout;
 	dev->watchdog_timeo = TX_TIMEOUT;
 #ifdef CONFIG_NET_POLL_CONTROLLER
-	dev->poll_controller = via_rhine_poll;
+	dev->poll_controller = rhine_poll;
 #endif
-	if (np->drv_flags & ReqTxAlign)
+	if (rp->drv_flags & ReqTxAlign)
 		dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
 
 	/* dev->name not defined before register_netdev()! */
@@ -807,40 +808,41 @@
 	/* The lower four bits are the media type. */
 	if (option > 0) {
 		if (option & 0x220)
-			np->mii_if.full_duplex = 1;
-		np->default_port = option & 15;
+			rp->mii_if.full_duplex = 1;
+		rp->default_port = option & 15;
 	}
-	if (card_idx < MAX_UNITS  &&  full_duplex[card_idx] > 0)
-		np->mii_if.full_duplex = 1;
+	if (card_idx < MAX_UNITS && full_duplex[card_idx] > 0)
+		rp->mii_if.full_duplex = 1;
 
-	if (np->mii_if.full_duplex) {
-		printk(KERN_INFO "%s: Set to forced full duplex, autonegotiation"
-			   " disabled.\n", dev->name);
-		np->mii_if.force_media = 1;
+	if (rp->mii_if.full_duplex) {
+		printk(KERN_INFO "%s: Set to forced full duplex, "
+		       "autonegotiation disabled.\n", dev->name);
+		rp->mii_if.force_media = 1;
 	}
 
 	printk(KERN_INFO "%s: %s at 0x%lx, ",
-		   dev->name, via_rhine_chip_info[chip_id].name,
-		   (pci_flags & PCI_USES_IO) ? ioaddr : memaddr);
+	       dev->name, rhine_chip_info[chip_id].name,
+	       (pci_flags & PCI_USES_IO) ? ioaddr : memaddr);
 
 	for (i = 0; i < 5; i++)
-			printk("%2.2x:", dev->dev_addr[i]);
+		printk("%2.2x:", dev->dev_addr[i]);
 	printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], pdev->irq);
 
 	pci_set_drvdata(pdev, dev);
 
-	if (np->drv_flags & CanHaveMII) {
+	if (rp->drv_flags & CanHaveMII) {
 		int phy, phy_idx = 0;
-		np->phys[0] = 1;		/* Standard for this chip. */
+		rp->phys[0] = 1;		/* Standard for this chip. */
 		for (phy = 1; phy < 32 && phy_idx < MAX_MII_CNT; phy++) {
 			int mii_status = mdio_read(dev, phy, 1);
-			if (mii_status != 0xffff  &&  mii_status != 0x0000) {
-				np->phys[phy_idx++] = phy;
-				np->mii_if.advertising = mdio_read(dev, phy, 4);
-				printk(KERN_INFO "%s: MII PHY found at address %d, status "
-					   "0x%4.4x advertising %4.4x Link %4.4x.\n",
-					   dev->name, phy, mii_status, np->mii_if.advertising,
-					   mdio_read(dev, phy, 5));
+			if (mii_status != 0xffff && mii_status != 0x0000) {
+				rp->phys[phy_idx++] = phy;
+				rp->mii_if.advertising = mdio_read(dev, phy, 4);
+				printk(KERN_INFO "%s: MII PHY found at address "
+				       "%d, status 0x%4.4x advertising %4.4x "
+				       "Link %4.4x.\n", dev->name, phy,
+				       mii_status, rp->mii_if.advertising,
+				       mdio_read(dev, phy, 5));
 
 				/* set IFF_RUNNING */
 				if (mii_status & BMSR_LSTATUS)
@@ -851,49 +853,50 @@
 				break;
 			}
 		}
-		np->mii_cnt = phy_idx;
-		np->mii_if.phy_id = np->phys[0];
+		rp->mii_cnt = phy_idx;
+		rp->mii_if.phy_id = rp->phys[0];
 	}
 
 	/* Allow forcing the media type. */
 	if (option > 0) {
 		if (option & 0x220)
-			np->mii_if.full_duplex = 1;
-		np->default_port = option & 0x3ff;
-		if (np->default_port & 0x330) {
+			rp->mii_if.full_duplex = 1;
+		rp->default_port = option & 0x3ff;
+		if (option & 0x330) {
 			/* FIXME: shouldn't someone check this variable? */
-			/* np->medialock = 1; */
-			printk(KERN_INFO "  Forcing %dMbs %s-duplex operation.\n",
-				   (option & 0x300 ? 100 : 10),
-				   (option & 0x220 ? "full" : "half"));
-			if (np->mii_cnt)
-				mdio_write(dev, np->phys[0], MII_BMCR,
-						   ((option & 0x300) ? 0x2000 : 0) |  /* 100mbps? */
-						   ((option & 0x220) ? 0x0100 : 0));  /* Full duplex? */
+			/* rp->medialock = 1; */
+			printk(KERN_INFO " Forcing %dMbs %s-duplex "
+				"operation.\n",
+			       (option & 0x300 ? 100 : 10),
+			       (option & 0x220 ? "full" : "half"));
+			if (rp->mii_cnt)
+				mdio_write(dev, rp->phys[0], MII_BMCR,
+					   ((option & 0x300) ? 0x2000 : 0) | /* 100mbps? */
+					   ((option & 0x220) ? 0x0100 : 0)); /* Full duplex? */
 		}
 	}
 
 	return 0;
 
 err_out_unmap:
-#ifdef USE_MEM
+#ifdef USE_MMIO
 	iounmap((void *)ioaddr);
 err_out_free_res:
 #endif
 	pci_release_regions(pdev);
 err_out_free_netdev:
-	free_netdev (dev);
+	free_netdev(dev);
 err_out:
 	return -ENODEV;
 }
 
 static int alloc_ring(struct net_device* dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	void *ring;
 	dma_addr_t ring_dma;
 
-	ring = pci_alloc_consistent(np->pdev,
+	ring = pci_alloc_consistent(rp->pdev,
 				    RX_RING_SIZE * sizeof(struct rx_desc) +
 				    TX_RING_SIZE * sizeof(struct tx_desc),
 				    &ring_dma);
@@ -901,11 +904,12 @@
 		printk(KERN_ERR "Could not allocate DMA memory.\n");
 		return -ENOMEM;
 	}
-	if (np->drv_flags & ReqTxAlign) {
-		np->tx_bufs = pci_alloc_consistent(np->pdev, PKT_BUF_SZ * TX_RING_SIZE,
-								   &np->tx_bufs_dma);
-		if (np->tx_bufs == NULL) {
-			pci_free_consistent(np->pdev,
+	if (rp->drv_flags & ReqTxAlign) {
+		rp->tx_bufs = pci_alloc_consistent(rp->pdev,
+						   PKT_BUF_SZ * TX_RING_SIZE,
+						   &rp->tx_bufs_dma);
+		if (rp->tx_bufs == NULL) {
+			pci_free_consistent(rp->pdev,
 				    RX_RING_SIZE * sizeof(struct rx_desc) +
 				    TX_RING_SIZE * sizeof(struct tx_desc),
 				    ring, ring_dma);
@@ -913,137 +917,138 @@
 		}
 	}
 
-	np->rx_ring = ring;
-	np->tx_ring = ring + RX_RING_SIZE * sizeof(struct rx_desc);
-	np->rx_ring_dma = ring_dma;
-	np->tx_ring_dma = ring_dma + RX_RING_SIZE * sizeof(struct rx_desc);
+	rp->rx_ring = ring;
+	rp->tx_ring = ring + RX_RING_SIZE * sizeof(struct rx_desc);
+	rp->rx_ring_dma = ring_dma;
+	rp->tx_ring_dma = ring_dma + RX_RING_SIZE * sizeof(struct rx_desc);
 
 	return 0;
 }
 
 void free_ring(struct net_device* dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 
-	pci_free_consistent(np->pdev,
+	pci_free_consistent(rp->pdev,
 			    RX_RING_SIZE * sizeof(struct rx_desc) +
 			    TX_RING_SIZE * sizeof(struct tx_desc),
-			    np->rx_ring, np->rx_ring_dma);
-	np->tx_ring = NULL;
+			    rp->rx_ring, rp->rx_ring_dma);
+	rp->tx_ring = NULL;
 
-	if (np->tx_bufs)
-		pci_free_consistent(np->pdev, PKT_BUF_SZ * TX_RING_SIZE,
-							np->tx_bufs, np->tx_bufs_dma);
+	if (rp->tx_bufs)
+		pci_free_consistent(rp->pdev, PKT_BUF_SZ * TX_RING_SIZE,
+				    rp->tx_bufs, rp->tx_bufs_dma);
 
-	np->tx_bufs = NULL;
+	rp->tx_bufs = NULL;
 
 }
 
 static void alloc_rbufs(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	dma_addr_t next;
 	int i;
 
-	np->dirty_rx = np->cur_rx = 0;
+	rp->dirty_rx = rp->cur_rx = 0;
 
-	np->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);
-	np->rx_head_desc = &np->rx_ring[0];
-	next = np->rx_ring_dma;
+	rp->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);
+	rp->rx_head_desc = &rp->rx_ring[0];
+	next = rp->rx_ring_dma;
 
 	/* Init the ring entries */
 	for (i = 0; i < RX_RING_SIZE; i++) {
-		np->rx_ring[i].rx_status = 0;
-		np->rx_ring[i].desc_length = cpu_to_le32(np->rx_buf_sz);
+		rp->rx_ring[i].rx_status = 0;
+		rp->rx_ring[i].desc_length = cpu_to_le32(rp->rx_buf_sz);
 		next += sizeof(struct rx_desc);
-		np->rx_ring[i].next_desc = cpu_to_le32(next);
-		np->rx_skbuff[i] = 0;
+		rp->rx_ring[i].next_desc = cpu_to_le32(next);
+		rp->rx_skbuff[i] = 0;
 	}
 	/* Mark the last entry as wrapping the ring. */
-	np->rx_ring[i-1].next_desc = cpu_to_le32(np->rx_ring_dma);
+	rp->rx_ring[i-1].next_desc = cpu_to_le32(rp->rx_ring_dma);
 
 	/* Fill in the Rx buffers.  Handle allocation failure gracefully. */
 	for (i = 0; i < RX_RING_SIZE; i++) {
-		struct sk_buff *skb = dev_alloc_skb(np->rx_buf_sz);
-		np->rx_skbuff[i] = skb;
+		struct sk_buff *skb = dev_alloc_skb(rp->rx_buf_sz);
+		rp->rx_skbuff[i] = skb;
 		if (skb == NULL)
 			break;
 		skb->dev = dev;                 /* Mark as being used by this device. */
 
-		np->rx_skbuff_dma[i] =
-			pci_map_single(np->pdev, skb->tail, np->rx_buf_sz,
-						   PCI_DMA_FROMDEVICE);
+		rp->rx_skbuff_dma[i] =
+			pci_map_single(rp->pdev, skb->tail, rp->rx_buf_sz,
+				       PCI_DMA_FROMDEVICE);
 
-		np->rx_ring[i].addr = cpu_to_le32(np->rx_skbuff_dma[i]);
-		np->rx_ring[i].rx_status = cpu_to_le32(DescOwn);
+		rp->rx_ring[i].addr = cpu_to_le32(rp->rx_skbuff_dma[i]);
+		rp->rx_ring[i].rx_status = cpu_to_le32(DescOwn);
 	}
-	np->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
+	rp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
 }
 
 static void free_rbufs(struct net_device* dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	int i;
 
 	/* Free all the skbuffs in the Rx queue. */
 	for (i = 0; i < RX_RING_SIZE; i++) {
-		np->rx_ring[i].rx_status = 0;
-		np->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
-		if (np->rx_skbuff[i]) {
-			pci_unmap_single(np->pdev,
-							 np->rx_skbuff_dma[i],
-							 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
-			dev_kfree_skb(np->rx_skbuff[i]);
+		rp->rx_ring[i].rx_status = 0;
+		rp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
+		if (rp->rx_skbuff[i]) {
+			pci_unmap_single(rp->pdev,
+					 rp->rx_skbuff_dma[i],
+					 rp->rx_buf_sz, PCI_DMA_FROMDEVICE);
+			dev_kfree_skb(rp->rx_skbuff[i]);
 		}
-		np->rx_skbuff[i] = 0;
+		rp->rx_skbuff[i] = 0;
 	}
 }
 
 static void alloc_tbufs(struct net_device* dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	dma_addr_t next;
 	int i;
 
-	np->dirty_tx = np->cur_tx = 0;
-	next = np->tx_ring_dma;
+	rp->dirty_tx = rp->cur_tx = 0;
+	next = rp->tx_ring_dma;
 	for (i = 0; i < TX_RING_SIZE; i++) {
-		np->tx_skbuff[i] = 0;
-		np->tx_ring[i].tx_status = 0;
-		np->tx_ring[i].desc_length = cpu_to_le32(TXDESC);
+		rp->tx_skbuff[i] = 0;
+		rp->tx_ring[i].tx_status = 0;
+		rp->tx_ring[i].desc_length = cpu_to_le32(TXDESC);
 		next += sizeof(struct tx_desc);
-		np->tx_ring[i].next_desc = cpu_to_le32(next);
-		np->tx_buf[i] = &np->tx_bufs[i * PKT_BUF_SZ];
+		rp->tx_ring[i].next_desc = cpu_to_le32(next);
+		rp->tx_buf[i] = &rp->tx_bufs[i * PKT_BUF_SZ];
 	}
-	np->tx_ring[i-1].next_desc = cpu_to_le32(np->tx_ring_dma);
+	rp->tx_ring[i-1].next_desc = cpu_to_le32(rp->tx_ring_dma);
 
 }
 
 static void free_tbufs(struct net_device* dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	int i;
 
 	for (i = 0; i < TX_RING_SIZE; i++) {
-		np->tx_ring[i].tx_status = 0;
-		np->tx_ring[i].desc_length = cpu_to_le32(TXDESC);
-		np->tx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
-		if (np->tx_skbuff[i]) {
-			if (np->tx_skbuff_dma[i]) {
-				pci_unmap_single(np->pdev,
-								 np->tx_skbuff_dma[i],
-								 np->tx_skbuff[i]->len, PCI_DMA_TODEVICE);
+		rp->tx_ring[i].tx_status = 0;
+		rp->tx_ring[i].desc_length = cpu_to_le32(TXDESC);
+		rp->tx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
+		if (rp->tx_skbuff[i]) {
+			if (rp->tx_skbuff_dma[i]) {
+				pci_unmap_single(rp->pdev,
+						 rp->tx_skbuff_dma[i],
+						 rp->tx_skbuff[i]->len,
+						 PCI_DMA_TODEVICE);
 			}
-			dev_kfree_skb(np->tx_skbuff[i]);
+			dev_kfree_skb(rp->tx_skbuff[i]);
 		}
-		np->tx_skbuff[i] = 0;
-		np->tx_buf[i] = 0;
+		rp->tx_skbuff[i] = 0;
+		rp->tx_buf[i] = 0;
 	}
 }
 
 static void init_registers(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
 	int i;
 
@@ -1054,38 +1059,39 @@
 	writew(0x0006, ioaddr + PCIBusConfig);	/* Tune configuration??? */
 	/* Configure initial FIFO thresholds. */
 	writeb(0x20, ioaddr + TxConfig);
-	np->tx_thresh = 0x20;
-	np->rx_thresh = 0x60;			/* Written in via_rhine_set_rx_mode(). */
-	np->mii_if.full_duplex = 0;
+	rp->tx_thresh = 0x20;
+	rp->rx_thresh = 0x60;		/* Written in rhine_set_rx_mode(). */
+	rp->mii_if.full_duplex = 0;
 
 	if (dev->if_port == 0)
-		dev->if_port = np->default_port;
+		dev->if_port = rp->default_port;
 
-	writel(np->rx_ring_dma, ioaddr + RxRingPtr);
-	writel(np->tx_ring_dma, ioaddr + TxRingPtr);
+	writel(rp->rx_ring_dma, ioaddr + RxRingPtr);
+	writel(rp->tx_ring_dma, ioaddr + TxRingPtr);
 
-	via_rhine_set_rx_mode(dev);
+	rhine_set_rx_mode(dev);
 
 	/* Enable interrupts by setting the interrupt mask. */
 	writew(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow |
-		   IntrRxDropped | IntrRxNoBuf | IntrTxAborted |
-		   IntrTxDone | IntrTxError | IntrTxUnderrun |
-		   IntrPCIErr | IntrStatsMax | IntrLinkChange,
-		   ioaddr + IntrEnable);
-
-	np->chip_cmd = CmdStart|CmdTxOn|CmdRxOn|CmdNoTxPoll;
-	if (np->mii_if.force_media)
-		np->chip_cmd |= CmdFDuplex;
-	writew(np->chip_cmd, ioaddr + ChipCmd);
+	       IntrRxDropped | IntrRxNoBuf | IntrTxAborted |
+	       IntrTxDone | IntrTxError | IntrTxUnderrun |
+	       IntrPCIErr | IntrStatsMax | IntrLinkChange,
+	       ioaddr + IntrEnable);
+
+	rp->chip_cmd = CmdStart|CmdTxOn|CmdRxOn|CmdNoTxPoll;
+	if (rp->mii_if.force_media)
+		rp->chip_cmd |= CmdFDuplex;
+	writew(rp->chip_cmd, ioaddr + ChipCmd);
 
-	via_rhine_check_duplex(dev);
+	rhine_check_duplex(dev);
 
-	/* The LED outputs of various MII xcvrs should be configured.  */
+	/* The LED outputs of various MII xcvrs should be configured. */
 	/* For NS or Mison phys, turn on bit 1 in register 0x17 */
 	/* For ESI phys, turn on bit 7 in register 0x17. */
-	mdio_write(dev, np->phys[0], 0x17, mdio_read(dev, np->phys[0], 0x17) |
-			   (np->drv_flags & HasESIPhy) ? 0x0080 : 0x0001);
+	mdio_write(dev, rp->phys[0], 0x17, mdio_read(dev, rp->phys[0], 0x17) |
+		   (rp->drv_flags & HasESIPhy) ? 0x0080 : 0x0001);
 }
+
 /* Read and write over the MII Management Data I/O (MDIO) interface. */
 
 static int mdio_read(struct net_device *dev, int phy_id, int regnum)
@@ -1099,7 +1105,7 @@
 	writeb(0x00, ioaddr + MIICmd);
 	writeb(phy_id, ioaddr + MIIPhyAddr);
 	writeb(regnum, ioaddr + MIIRegAddr);
-	writeb(0x40, ioaddr + MIICmd);			/* Trigger read */
+	writeb(0x40, ioaddr + MIICmd);		/* Trigger read */
 	boguscnt = 1024;
 	while ((readb(ioaddr + MIICmd) & 0x40) && --boguscnt > 0)
 		;
@@ -1108,20 +1114,20 @@
 
 static void mdio_write(struct net_device *dev, int phy_id, int regnum, int value)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
 	int boguscnt = 1024;
 
-	if (phy_id == np->phys[0]) {
+	if (phy_id == rp->phys[0]) {
 		switch (regnum) {
-		case MII_BMCR:					/* Is user forcing speed/duplex? */
-			if (value & 0x9000)			/* Autonegotiation. */
-				np->mii_if.force_media = 0;
+		case MII_BMCR:		/* Is user forcing speed/duplex? */
+			if (value & 0x9000)	/* Autonegotiation. */
+				rp->mii_if.force_media = 0;
 			else
-				np->mii_if.full_duplex = (value & 0x0100) ? 1 : 0;
+				rp->mii_if.full_duplex = (value & 0x0100) ? 1 : 0;
 			break;
 		case MII_ADVERTISE:
-			np->mii_if.advertising = value;
+			rp->mii_if.advertising = value;
 			break;
 		}
 	}
@@ -1133,128 +1139,130 @@
 	writeb(phy_id, ioaddr + MIIPhyAddr);
 	writeb(regnum, ioaddr + MIIRegAddr);
 	writew(value, ioaddr + MIIData);
-	writeb(0x20, ioaddr + MIICmd);			/* Trigger write. */
+	writeb(0x20, ioaddr + MIICmd);		/* Trigger write. */
 }
 
 
-static int via_rhine_open(struct net_device *dev)
+static int rhine_open(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
 	int i;
 
 	/* Reset the chip. */
 	writew(CmdReset, ioaddr + ChipCmd);
 
-	i = request_irq(np->pdev->irq, &via_rhine_interrupt, SA_SHIRQ, dev->name, dev);
+	i = request_irq(rp->pdev->irq, &rhine_interrupt, SA_SHIRQ, dev->name,
+			dev);
 	if (i)
 		return i;
 
 	if (debug > 1)
-		printk(KERN_DEBUG "%s: via_rhine_open() irq %d.\n",
-			   dev->name, np->pdev->irq);
+		printk(KERN_DEBUG "%s: rhine_open() irq %d.\n",
+		       dev->name, rp->pdev->irq);
 
 	i = alloc_ring(dev);
 	if (i)
 		return i;
 	alloc_rbufs(dev);
 	alloc_tbufs(dev);
-	wait_for_reset(dev, np->chip_id, dev->name);
+	wait_for_reset(dev, rp->chip_id, dev->name);
 	init_registers(dev);
 	if (debug > 2)
-		printk(KERN_DEBUG "%s: Done via_rhine_open(), status %4.4x "
-			   "MII status: %4.4x.\n",
-			   dev->name, readw(ioaddr + ChipCmd),
-			   mdio_read(dev, np->phys[0], MII_BMSR));
+		printk(KERN_DEBUG "%s: Done rhine_open(), status %4.4x "
+		       "MII status: %4.4x.\n",
+		       dev->name, readw(ioaddr + ChipCmd),
+		       mdio_read(dev, rp->phys[0], MII_BMSR));
 
 	netif_start_queue(dev);
 
 	/* Set the timer to check for link beat. */
-	init_timer(&np->timer);
-	np->timer.expires = jiffies + 2 * HZ/100;
-	np->timer.data = (unsigned long)dev;
-	np->timer.function = &via_rhine_timer;				/* timer handler */
-	add_timer(&np->timer);
+	init_timer(&rp->timer);
+	rp->timer.expires = jiffies + 2 * HZ/100;
+	rp->timer.data = (unsigned long)dev;
+	rp->timer.function = &rhine_timer;		/* timer handler */
+	add_timer(&rp->timer);
 
 	return 0;
 }
 
-static void via_rhine_check_duplex(struct net_device *dev)
+static void rhine_check_duplex(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
-	int mii_lpa = mdio_read(dev, np->phys[0], MII_LPA);
-	int negotiated = mii_lpa & np->mii_if.advertising;
+	int mii_lpa = mdio_read(dev, rp->phys[0], MII_LPA);
+	int negotiated = mii_lpa & rp->mii_if.advertising;
 	int duplex;
 
-	if (np->mii_if.force_media  ||  mii_lpa == 0xffff)
+	if (rp->mii_if.force_media || mii_lpa == 0xffff)
 		return;
 	duplex = (negotiated & 0x0100) || (negotiated & 0x01C0) == 0x0040;
-	if (np->mii_if.full_duplex != duplex) {
-		np->mii_if.full_duplex = duplex;
+	if (rp->mii_if.full_duplex != duplex) {
+		rp->mii_if.full_duplex = duplex;
 		if (debug)
-			printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d link"
-				   " partner capability of %4.4x.\n", dev->name,
-				   duplex ? "full" : "half", np->phys[0], mii_lpa);
+			printk(KERN_INFO "%s: Setting %s-duplex based on "
+			       "MII #%d link partner capability of %4.4x.\n",
+			       dev->name, duplex ? "full" : "half",
+			       rp->phys[0], mii_lpa);
 		if (duplex)
-			np->chip_cmd |= CmdFDuplex;
+			rp->chip_cmd |= CmdFDuplex;
 		else
-			np->chip_cmd &= ~CmdFDuplex;
-		writew(np->chip_cmd, ioaddr + ChipCmd);
+			rp->chip_cmd &= ~CmdFDuplex;
+		writew(rp->chip_cmd, ioaddr + ChipCmd);
 	}
 }
 
 
-static void via_rhine_timer(unsigned long data)
+static void rhine_timer(unsigned long data)
 {
 	struct net_device *dev = (struct net_device *)data;
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
 	int next_tick = 10*HZ;
 	int mii_status;
 
 	if (debug > 3) {
 		printk(KERN_DEBUG "%s: VIA Rhine monitor tick, status %4.4x.\n",
-			   dev->name, readw(ioaddr + IntrStatus));
+		       dev->name, readw(ioaddr + IntrStatus));
 	}
 
-	spin_lock_irq (&np->lock);
+	spin_lock_irq (&rp->lock);
 
-	via_rhine_check_duplex(dev);
+	rhine_check_duplex(dev);
 
 	/* make IFF_RUNNING follow the MII status bit "Link established" */
-	mii_status = mdio_read(dev, np->phys[0], MII_BMSR);
-	if ( (mii_status & BMSR_LSTATUS) != (np->mii_status & BMSR_LSTATUS) ) {
+	mii_status = mdio_read(dev, rp->phys[0], MII_BMSR);
+	if ((mii_status & BMSR_LSTATUS) != (rp->mii_status & BMSR_LSTATUS)) {
 		if (mii_status & BMSR_LSTATUS)
 			netif_carrier_on(dev);
 		else
 			netif_carrier_off(dev);
 	}
-	np->mii_status = mii_status;
+	rp->mii_status = mii_status;
 
-	spin_unlock_irq (&np->lock);
+	spin_unlock_irq(&rp->lock);
 
-	np->timer.expires = jiffies + next_tick;
-	add_timer(&np->timer);
+	rp->timer.expires = jiffies + next_tick;
+	add_timer(&rp->timer);
 }
 
 
-static void via_rhine_tx_timeout (struct net_device *dev)
+static void rhine_tx_timeout(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
 
-	printk (KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status "
-		"%4.4x, resetting...\n",
-		dev->name, readw (ioaddr + IntrStatus),
-		mdio_read (dev, np->phys[0], MII_BMSR));
+	printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status "
+	       "%4.4x, resetting...\n",
+	       dev->name, readw(ioaddr + IntrStatus),
+	       mdio_read(dev, rp->phys[0], MII_BMSR));
 
 	dev->if_port = 0;
 
 	/* protect against concurrent rx interrupts */
-	disable_irq(np->pdev->irq);
+	disable_irq(rp->pdev->irq);
 
-	spin_lock(&np->lock);
+	spin_lock(&rp->lock);
 
 	/* Reset the chip. */
 	writew(CmdReset, ioaddr + ChipCmd);
@@ -1266,20 +1274,20 @@
 	alloc_rbufs(dev);
 
 	/* Reinitialize the hardware. */
-	wait_for_reset(dev, np->chip_id, dev->name);
+	wait_for_reset(dev, rp->chip_id, dev->name);
 	init_registers(dev);
 
-	spin_unlock(&np->lock);
-	enable_irq(np->pdev->irq);
+	spin_unlock(&rp->lock);
+	enable_irq(rp->pdev->irq);
 
 	dev->trans_start = jiffies;
-	np->stats.tx_errors++;
+	rp->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
-static int via_rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
+static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	unsigned entry;
 	u32 intr_status;
 
@@ -1287,7 +1295,7 @@
 	   with the "ownership" bits last. */
 
 	/* Calculate the next Tx descriptor entry. */
-	entry = np->cur_tx % TX_RING_SIZE;
+	entry = rp->cur_tx % TX_RING_SIZE;
 
 	if (skb->len < ETH_ZLEN) {
 		skb = skb_padto(skb, ETH_ZLEN);
@@ -1295,39 +1303,40 @@
 			return 0;
 	}
 
-	np->tx_skbuff[entry] = skb;
+	rp->tx_skbuff[entry] = skb;
 
-	if ((np->drv_flags & ReqTxAlign) &&
-		(((long)skb->data & 3) || skb_shinfo(skb)->nr_frags != 0 || skb->ip_summed == CHECKSUM_HW)
-		) {
+	if ((rp->drv_flags & ReqTxAlign) &&
+	    (((long)skb->data & 3) || skb_shinfo(skb)->nr_frags != 0 || skb->ip_summed == CHECKSUM_HW)) {
 		/* Must use alignment buffer. */
 		if (skb->len > PKT_BUF_SZ) {
 			/* packet too long, drop it */
 			dev_kfree_skb(skb);
-			np->tx_skbuff[entry] = NULL;
-			np->stats.tx_dropped++;
+			rp->tx_skbuff[entry] = NULL;
+			rp->stats.tx_dropped++;
 			return 0;
 		}
-		skb_copy_and_csum_dev(skb, np->tx_buf[entry]);
-		np->tx_skbuff_dma[entry] = 0;
-		np->tx_ring[entry].addr = cpu_to_le32(np->tx_bufs_dma +
-										  (np->tx_buf[entry] - np->tx_bufs));
+		skb_copy_and_csum_dev(skb, rp->tx_buf[entry]);
+		rp->tx_skbuff_dma[entry] = 0;
+		rp->tx_ring[entry].addr = cpu_to_le32(rp->tx_bufs_dma +
+						      (rp->tx_buf[entry] -
+						       rp->tx_bufs));
 	} else {
-		np->tx_skbuff_dma[entry] =
-			pci_map_single(np->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
-		np->tx_ring[entry].addr = cpu_to_le32(np->tx_skbuff_dma[entry]);
+		rp->tx_skbuff_dma[entry] =
+			pci_map_single(rp->pdev, skb->data, skb->len,
+				       PCI_DMA_TODEVICE);
+		rp->tx_ring[entry].addr = cpu_to_le32(rp->tx_skbuff_dma[entry]);
 	}
 
-	np->tx_ring[entry].desc_length =
+	rp->tx_ring[entry].desc_length =
 		cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
 
 	/* lock eth irq */
-	spin_lock_irq (&np->lock);
+	spin_lock_irq(&rp->lock);
 	wmb();
-	np->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
+	rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
 	wmb();
 
-	np->cur_tx++;
+	rp->cur_tx++;
 
 	/* Non-x86 Todo: explicitly flush cache lines here. */
 
@@ -1337,27 +1346,27 @@
 	 */
 	intr_status = get_intr_status(dev);
 	if ((intr_status & IntrTxErrSummary) == 0) {
-		writew(CmdTxDemand | np->chip_cmd, dev->base_addr + ChipCmd);
+		writew(CmdTxDemand | rp->chip_cmd, dev->base_addr + ChipCmd);
 	}
 	IOSYNC;
 
-	if (np->cur_tx == np->dirty_tx + TX_QUEUE_LEN)
+	if (rp->cur_tx == rp->dirty_tx + TX_QUEUE_LEN)
 		netif_stop_queue(dev);
 
 	dev->trans_start = jiffies;
 
-	spin_unlock_irq (&np->lock);
+	spin_unlock_irq(&rp->lock);
 
 	if (debug > 4) {
 		printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
-			   dev->name, np->cur_tx-1, entry);
+		       dev->name, rp->cur_tx-1, entry);
 	}
 	return 0;
 }
 
 /* The interrupt handler does all of the Rx thread work and cleans up
    after the Tx thread. */
-static irqreturn_t via_rhine_interrupt(int irq, void *dev_instance, struct pt_regs *rgs)
+static irqreturn_t rhine_interrupt(int irq, void *dev_instance, struct pt_regs *rgs)
 {
 	struct net_device *dev = dev_instance;
 	long ioaddr;
@@ -1378,11 +1387,11 @@
 
 		if (debug > 4)
 			printk(KERN_DEBUG "%s: Interrupt, status %8.8x.\n",
-				   dev->name, intr_status);
+			       dev->name, intr_status);
 
 		if (intr_status & (IntrRxDone | IntrRxErr | IntrRxDropped |
-						   IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf))
-			via_rhine_rx(dev);
+		    IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf))
+			rhine_rx(dev);
 
 		if (intr_status & (IntrTxErrSummary | IntrTxDone)) {
 			if (intr_status & IntrTxErrSummary) {
@@ -1391,140 +1400,147 @@
 				while ((readw(ioaddr+ChipCmd) & CmdTxOn) && --cnt)
 					udelay(5);
 				if (debug > 2 && !cnt)
-					printk(KERN_WARNING "%s: via_rhine_interrupt() "
-						   "Tx engine still on.\n",
-						   dev->name);
+					printk(KERN_WARNING "%s: "
+					       "rhine_interrupt() Tx engine"
+					       "still on.\n", dev->name);
 			}
-			via_rhine_tx(dev);
+			rhine_tx(dev);
 		}
 
 		/* Abnormal error summary/uncommon events handlers. */
 		if (intr_status & (IntrPCIErr | IntrLinkChange |
 				   IntrStatsMax | IntrTxError | IntrTxAborted |
 				   IntrTxUnderrun | IntrTxDescRace))
-			via_rhine_error(dev, intr_status);
+			rhine_error(dev, intr_status);
 
 		if (--boguscnt < 0) {
 			printk(KERN_WARNING "%s: Too much work at interrupt, "
-				   "status=%#8.8x.\n",
-				   dev->name, intr_status);
+			       "status=%#8.8x.\n",
+			       dev->name, intr_status);
 			break;
 		}
 	}
 
 	if (debug > 3)
 		printk(KERN_DEBUG "%s: exiting interrupt, status=%8.8x.\n",
-			   dev->name, readw(ioaddr + IntrStatus));
+		       dev->name, readw(ioaddr + IntrStatus));
 	return IRQ_RETVAL(handled);
 }
 
 /* This routine is logically part of the interrupt handler, but isolated
    for clarity. */
-static void via_rhine_tx(struct net_device *dev)
+static void rhine_tx(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
-	int txstatus = 0, entry = np->dirty_tx % TX_RING_SIZE;
+	struct rhine_private *rp = netdev_priv(dev);
+	int txstatus = 0, entry = rp->dirty_tx % TX_RING_SIZE;
 
-	spin_lock (&np->lock);
+	spin_lock(&rp->lock);
 
 	/* find and cleanup dirty tx descriptors */
-	while (np->dirty_tx != np->cur_tx) {
-		txstatus = le32_to_cpu(np->tx_ring[entry].tx_status);
+	while (rp->dirty_tx != rp->cur_tx) {
+		txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status);
 		if (debug > 6)
 			printk(KERN_DEBUG " Tx scavenge %d status %8.8x.\n",
-				   entry, txstatus);
+			       entry, txstatus);
 		if (txstatus & DescOwn)
 			break;
 		if (txstatus & 0x8000) {
 			if (debug > 1)
-				printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n",
-					   dev->name, txstatus);
-			np->stats.tx_errors++;
-			if (txstatus & 0x0400) np->stats.tx_carrier_errors++;
-			if (txstatus & 0x0200) np->stats.tx_window_errors++;
-			if (txstatus & 0x0100) np->stats.tx_aborted_errors++;
-			if (txstatus & 0x0080) np->stats.tx_heartbeat_errors++;
-			if (((np->chip_id == VT86C100A) && txstatus & 0x0002) ||
-				(txstatus & 0x0800) || (txstatus & 0x1000)) {
-				np->stats.tx_fifo_errors++;
-				np->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
+				printk(KERN_DEBUG "%s: Transmit error, "
+				       "Tx status %8.8x.\n",
+				       dev->name, txstatus);
+			rp->stats.tx_errors++;
+			if (txstatus & 0x0400) rp->stats.tx_carrier_errors++;
+			if (txstatus & 0x0200) rp->stats.tx_window_errors++;
+			if (txstatus & 0x0100) rp->stats.tx_aborted_errors++;
+			if (txstatus & 0x0080) rp->stats.tx_heartbeat_errors++;
+			if (((rp->chip_id == VT86C100A) && txstatus & 0x0002) ||
+			    (txstatus & 0x0800) || (txstatus & 0x1000)) {
+				rp->stats.tx_fifo_errors++;
+				rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
 				break; /* Keep the skb - we try again */
 			}
 			/* Transmitter restarted in 'abnormal' handler. */
 		} else {
-			if (np->chip_id == VT86C100A)
-				np->stats.collisions += (txstatus >> 3) & 0x0F;
+			if (rp->chip_id == VT86C100A)
+				rp->stats.collisions += (txstatus >> 3) & 0x0F;
 			else
-				np->stats.collisions += txstatus & 0x0F;
+				rp->stats.collisions += txstatus & 0x0F;
 			if (debug > 6)
 				printk(KERN_DEBUG "collisions: %1.1x:%1.1x\n",
-					(txstatus >> 3) & 0xF,
-					txstatus & 0xF);
-			np->stats.tx_bytes += np->tx_skbuff[entry]->len;
-			np->stats.tx_packets++;
+				       (txstatus >> 3) & 0xF,
+				       txstatus & 0xF);
+			rp->stats.tx_bytes += rp->tx_skbuff[entry]->len;
+			rp->stats.tx_packets++;
 		}
 		/* Free the original skb. */
-		if (np->tx_skbuff_dma[entry]) {
-			pci_unmap_single(np->pdev,
-							 np->tx_skbuff_dma[entry],
-							 np->tx_skbuff[entry]->len, PCI_DMA_TODEVICE);
+		if (rp->tx_skbuff_dma[entry]) {
+			pci_unmap_single(rp->pdev,
+					 rp->tx_skbuff_dma[entry],
+					 rp->tx_skbuff[entry]->len,
+					 PCI_DMA_TODEVICE);
 		}
-		dev_kfree_skb_irq(np->tx_skbuff[entry]);
-		np->tx_skbuff[entry] = NULL;
-		entry = (++np->dirty_tx) % TX_RING_SIZE;
+		dev_kfree_skb_irq(rp->tx_skbuff[entry]);
+		rp->tx_skbuff[entry] = NULL;
+		entry = (++rp->dirty_tx) % TX_RING_SIZE;
 	}
-	if ((np->cur_tx - np->dirty_tx) < TX_QUEUE_LEN - 4)
-		netif_wake_queue (dev);
+	if ((rp->cur_tx - rp->dirty_tx) < TX_QUEUE_LEN - 4)
+		netif_wake_queue(dev);
 
-	spin_unlock (&np->lock);
+	spin_unlock(&rp->lock);
 }
 
 /* This routine is logically part of the interrupt handler, but isolated
    for clarity and better register allocation. */
-static void via_rhine_rx(struct net_device *dev)
+static void rhine_rx(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
-	int entry = np->cur_rx % RX_RING_SIZE;
-	int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
+	struct rhine_private *rp = netdev_priv(dev);
+	int entry = rp->cur_rx % RX_RING_SIZE;
+	int boguscnt = rp->dirty_rx + RX_RING_SIZE - rp->cur_rx;
 
 	if (debug > 4) {
-		printk(KERN_DEBUG "%s: via_rhine_rx(), entry %d status %8.8x.\n",
-			   dev->name, entry, le32_to_cpu(np->rx_head_desc->rx_status));
+		printk(KERN_DEBUG "%s: rhine_rx(), entry %d status %8.8x.\n",
+		       dev->name, entry,
+		       le32_to_cpu(rp->rx_head_desc->rx_status));
 	}
 
 	/* If EOP is set on the next entry, it's a new packet. Send it up. */
-	while ( ! (np->rx_head_desc->rx_status & cpu_to_le32(DescOwn))) {
-		struct rx_desc *desc = np->rx_head_desc;
+	while (!(rp->rx_head_desc->rx_status & cpu_to_le32(DescOwn))) {
+		struct rx_desc *desc = rp->rx_head_desc;
 		u32 desc_status = le32_to_cpu(desc->rx_status);
 		int data_size = desc_status >> 16;
 
 		if (debug > 4)
-			printk(KERN_DEBUG "  via_rhine_rx() status is %8.8x.\n",
-				   desc_status);
+			printk(KERN_DEBUG " rhine_rx() status is %8.8x.\n",
+			       desc_status);
 		if (--boguscnt < 0)
 			break;
-		if ( (desc_status & (RxWholePkt | RxErr)) !=  RxWholePkt) {
-			if ((desc_status & RxWholePkt) !=  RxWholePkt) {
-				printk(KERN_WARNING "%s: Oversized Ethernet frame spanned "
-					   "multiple buffers, entry %#x length %d status %8.8x!\n",
-					   dev->name, entry, data_size, desc_status);
-				printk(KERN_WARNING "%s: Oversized Ethernet frame %p vs %p.\n",
-					   dev->name, np->rx_head_desc, &np->rx_ring[entry]);
-				np->stats.rx_length_errors++;
+		if ((desc_status & (RxWholePkt | RxErr)) != RxWholePkt) {
+			if ((desc_status & RxWholePkt) != RxWholePkt) {
+				printk(KERN_WARNING "%s: Oversized Ethernet "
+				       "frame spanned multiple buffers, entry "
+				       "%#x length %d status %8.8x!\n",
+				       dev->name, entry, data_size,
+				       desc_status);
+				printk(KERN_WARNING "%s: Oversized Ethernet "
+				       "frame %p vs %p.\n", dev->name,
+				       rp->rx_head_desc, &rp->rx_ring[entry]);
+				rp->stats.rx_length_errors++;
 			} else if (desc_status & RxErr) {
 				/* There was a error. */
 				if (debug > 2)
-					printk(KERN_DEBUG "  via_rhine_rx() Rx error was %8.8x.\n",
-						   desc_status);
-				np->stats.rx_errors++;
-				if (desc_status & 0x0030) np->stats.rx_length_errors++;
-				if (desc_status & 0x0048) np->stats.rx_fifo_errors++;
-				if (desc_status & 0x0004) np->stats.rx_frame_errors++;
+					printk(KERN_DEBUG " rhine_rx() Rx "
+					       "error was %8.8x.\n",
+					       desc_status);
+				rp->stats.rx_errors++;
+				if (desc_status & 0x0030) rp->stats.rx_length_errors++;
+				if (desc_status & 0x0048) rp->stats.rx_fifo_errors++;
+				if (desc_status & 0x0004) rp->stats.rx_frame_errors++;
 				if (desc_status & 0x0002) {
 					/* this can also be updated outside the interrupt handler */
-					spin_lock (&np->lock);
-					np->stats.rx_crc_errors++;
-					spin_unlock (&np->lock);
+					spin_lock(&rp->lock);
+					rp->stats.rx_crc_errors++;
+					spin_unlock(&rp->lock);
 				}
 			}
 		} else {
@@ -1532,76 +1548,89 @@
 			/* Length should omit the CRC */
 			int pkt_len = data_size - 4;
 
-			/* Check if the packet is long enough to accept without copying
-			   to a minimally-sized skbuff. */
+			/* Check if the packet is long enough to accept without
+			   copying to a minimally-sized skbuff. */
 			if (pkt_len < rx_copybreak &&
 				(skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
 				skb->dev = dev;
 				skb_reserve(skb, 2);	/* 16 byte align the IP header */
-				pci_dma_sync_single_for_cpu(np->pdev, np->rx_skbuff_dma[entry],
-						    np->rx_buf_sz, PCI_DMA_FROMDEVICE);
-
-				/* *_IP_COPYSUM isn't defined anywhere and eth_copy_and_sum
-				   is memcpy for all archs so this is kind of pointless right
-				   now ... or? */
-#if HAS_IP_COPYSUM                     /* Call copy + cksum if available. */
-				eth_copy_and_sum(skb, np->rx_skbuff[entry]->tail, pkt_len, 0);
+				pci_dma_sync_single_for_cpu(rp->pdev,
+							    rp->rx_skbuff_dma[entry],
+							    rp->rx_buf_sz,
+							    PCI_DMA_FROMDEVICE);
+
+				/* *_IP_COPYSUM isn't defined anywhere and
+				   eth_copy_and_sum is memcpy for all archs so
+				   this is kind of pointless right now
+				   ... or? */
+#if HAS_IP_COPYSUM		/* Call copy + cksum if available. */
+				eth_copy_and_sum(skb,
+						 rp->rx_skbuff[entry]->tail,
+						 pkt_len, 0);
 				skb_put(skb, pkt_len);
 #else
-				memcpy(skb_put(skb, pkt_len), np->rx_skbuff[entry]->tail,
-					   pkt_len);
+				memcpy(skb_put(skb, pkt_len),
+				       rp->rx_skbuff[entry]->tail, pkt_len);
 #endif
-				pci_dma_sync_single_for_device(np->pdev, np->rx_skbuff_dma[entry],
-						    np->rx_buf_sz, PCI_DMA_FROMDEVICE);
+				pci_dma_sync_single_for_device(rp->pdev,
+							       rp->rx_skbuff_dma[entry],
+							       rp->rx_buf_sz,
+							       PCI_DMA_FROMDEVICE);
 			} else {
-				skb = np->rx_skbuff[entry];
+				skb = rp->rx_skbuff[entry];
 				if (skb == NULL) {
-					printk(KERN_ERR "%s: Inconsistent Rx descriptor chain.\n",
-						   dev->name);
+					printk(KERN_ERR "%s: Inconsistent Rx "
+					       "descriptor chain.\n",
+					       dev->name);
 					break;
 				}
-				np->rx_skbuff[entry] = NULL;
+				rp->rx_skbuff[entry] = NULL;
 				skb_put(skb, pkt_len);
-				pci_unmap_single(np->pdev, np->rx_skbuff_dma[entry],
-								 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
+				pci_unmap_single(rp->pdev,
+						 rp->rx_skbuff_dma[entry],
+						 rp->rx_buf_sz,
+						 PCI_DMA_FROMDEVICE);
 			}
 			skb->protocol = eth_type_trans(skb, dev);
 			netif_rx(skb);
 			dev->last_rx = jiffies;
-			np->stats.rx_bytes += pkt_len;
-			np->stats.rx_packets++;
+			rp->stats.rx_bytes += pkt_len;
+			rp->stats.rx_packets++;
 		}
-		entry = (++np->cur_rx) % RX_RING_SIZE;
-		np->rx_head_desc = &np->rx_ring[entry];
+		entry = (++rp->cur_rx) % RX_RING_SIZE;
+		rp->rx_head_desc = &rp->rx_ring[entry];
 	}
 
 	/* Refill the Rx ring buffers. */
-	for (; np->cur_rx - np->dirty_rx > 0; np->dirty_rx++) {
+	for (; rp->cur_rx - rp->dirty_rx > 0; rp->dirty_rx++) {
 		struct sk_buff *skb;
-		entry = np->dirty_rx % RX_RING_SIZE;
-		if (np->rx_skbuff[entry] == NULL) {
-			skb = dev_alloc_skb(np->rx_buf_sz);
-			np->rx_skbuff[entry] = skb;
+		entry = rp->dirty_rx % RX_RING_SIZE;
+		if (rp->rx_skbuff[entry] == NULL) {
+			skb = dev_alloc_skb(rp->rx_buf_sz);
+			rp->rx_skbuff[entry] = skb;
 			if (skb == NULL)
-				break;			/* Better luck next round. */
-			skb->dev = dev;			/* Mark as being used by this device. */
-			np->rx_skbuff_dma[entry] =
-				pci_map_single(np->pdev, skb->tail, np->rx_buf_sz,
-							   PCI_DMA_FROMDEVICE);
-			np->rx_ring[entry].addr = cpu_to_le32(np->rx_skbuff_dma[entry]);
+				break;	/* Better luck next round. */
+			skb->dev = dev;	/* Mark as being used by this device. */
+			rp->rx_skbuff_dma[entry] =
+				pci_map_single(rp->pdev, skb->tail,
+					       rp->rx_buf_sz,
+					       PCI_DMA_FROMDEVICE);
+			rp->rx_ring[entry].addr = cpu_to_le32(rp->rx_skbuff_dma[entry]);
 		}
-		np->rx_ring[entry].rx_status = cpu_to_le32(DescOwn);
+		rp->rx_ring[entry].rx_status = cpu_to_le32(DescOwn);
 	}
 
 	/* Pre-emptively restart Rx engine. */
 	writew(readw(dev->base_addr + ChipCmd) | CmdRxOn | CmdRxDemand,
-		   dev->base_addr + ChipCmd);
+	       dev->base_addr + ChipCmd);
 }
 
-/* Clears the "tally counters" for CRC errors and missed frames(?).
-   It has been reported that some chips need a write of 0 to clear
-   these, for others the counters are set to 1 when written to and
-   instead cleared when read. So we clear them both ways ... */
+/*
+ * Clears the "tally counters" for CRC errors and missed frames(?).
+ * It has been reported that some chips need a write of 0 to clear
+ * these, for others the counters are set to 1 when written to and
+ * instead cleared when read. So we clear them both ways ...
+ */
 static inline void clear_tally_counters(const long ioaddr)
 {
 	writel(0, ioaddr + RxMissed);
@@ -1609,10 +1638,10 @@
 	readw(ioaddr + RxMissed);
 }
 
-static void via_rhine_restart_tx(struct net_device *dev) {
-	struct netdev_private *np = dev->priv;
+static void rhine_restart_tx(struct net_device *dev) {
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
-	int entry = np->dirty_tx % TX_RING_SIZE;
+	int entry = rp->dirty_tx % TX_RING_SIZE;
 	u32 intr_status;
 
 	/*
@@ -1624,120 +1653,123 @@
 	if ((intr_status & IntrTxErrSummary) == 0) {
 
 		/* We know better than the chip where it should continue. */
-		writel(np->tx_ring_dma + entry * sizeof(struct tx_desc),
-			   ioaddr + TxRingPtr);
+		writel(rp->tx_ring_dma + entry * sizeof(struct tx_desc),
+		       ioaddr + TxRingPtr);
 
-		writew(CmdTxDemand | np->chip_cmd, ioaddr + ChipCmd);
+		writew(CmdTxDemand | rp->chip_cmd, ioaddr + ChipCmd);
 		IOSYNC;
 	}
 	else {
 		/* This should never happen */
 		if (debug > 1)
-			printk(KERN_WARNING "%s: via_rhine_restart_tx() "
-				   "Another error occured %8.8x.\n",
-				   dev->name, intr_status);
+			printk(KERN_WARNING "%s: rhine_restart_tx() "
+			       "Another error occured %8.8x.\n",
+			       dev->name, intr_status);
 	}
 
 }
 
-static void via_rhine_error(struct net_device *dev, int intr_status)
+static void rhine_error(struct net_device *dev, int intr_status)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
 
-	spin_lock (&np->lock);
+	spin_lock(&rp->lock);
 
 	if (intr_status & (IntrLinkChange)) {
 		if (readb(ioaddr + MIIStatus) & 0x02) {
 			/* Link failed, restart autonegotiation. */
-			if (np->drv_flags & HasDavicomPhy)
-				mdio_write(dev, np->phys[0], MII_BMCR, 0x3300);
+			if (rp->drv_flags & HasDavicomPhy)
+				mdio_write(dev, rp->phys[0], MII_BMCR, 0x3300);
 		} else
-			via_rhine_check_duplex(dev);
+			rhine_check_duplex(dev);
 		if (debug)
-			printk(KERN_ERR "%s: MII status changed: Autonegotiation "
-				   "advertising %4.4x  partner %4.4x.\n", dev->name,
-			   mdio_read(dev, np->phys[0], MII_ADVERTISE),
-			   mdio_read(dev, np->phys[0], MII_LPA));
+			printk(KERN_ERR "%s: MII status changed: "
+			       "Autonegotiation advertising %4.4x partner "
+			       "%4.4x.\n", dev->name,
+			       mdio_read(dev, rp->phys[0], MII_ADVERTISE),
+			       mdio_read(dev, rp->phys[0], MII_LPA));
 	}
 	if (intr_status & IntrStatsMax) {
-		np->stats.rx_crc_errors	+= readw(ioaddr + RxCRCErrs);
-		np->stats.rx_missed_errors	+= readw(ioaddr + RxMissed);
+		rp->stats.rx_crc_errors += readw(ioaddr + RxCRCErrs);
+		rp->stats.rx_missed_errors += readw(ioaddr + RxMissed);
 		clear_tally_counters(ioaddr);
 	}
 	if (intr_status & IntrTxAborted) {
 		if (debug > 1)
 			printk(KERN_INFO "%s: Abort %8.8x, frame dropped.\n",
-				   dev->name, intr_status);
+			       dev->name, intr_status);
 	}
 	if (intr_status & IntrTxUnderrun) {
-		if (np->tx_thresh < 0xE0)
-			writeb(np->tx_thresh += 0x20, ioaddr + TxConfig);
+		if (rp->tx_thresh < 0xE0)
+			writeb(rp->tx_thresh += 0x20, ioaddr + TxConfig);
 		if (debug > 1)
 			printk(KERN_INFO "%s: Transmitter underrun, Tx "
-				   "threshold now %2.2x.\n",
-				   dev->name, np->tx_thresh);
+			       "threshold now %2.2x.\n",
+			       dev->name, rp->tx_thresh);
 	}
 	if (intr_status & IntrTxDescRace) {
 		if (debug > 2)
 			printk(KERN_INFO "%s: Tx descriptor write-back race.\n",
-				   dev->name);
+			       dev->name);
 	}
-	if ((intr_status & IntrTxError) && ~( IntrTxAborted | IntrTxUnderrun |
-										   IntrTxDescRace )) {
-		if (np->tx_thresh < 0xE0) {
-			writeb(np->tx_thresh += 0x20, ioaddr + TxConfig);
+	if ((intr_status & IntrTxError) &&
+	    (intr_status & (IntrTxAborted |
+	     IntrTxUnderrun | IntrTxDescRace)) == 0) {
+		if (rp->tx_thresh < 0xE0) {
+			writeb(rp->tx_thresh += 0x20, ioaddr + TxConfig);
 		}
 		if (debug > 1)
 			printk(KERN_INFO "%s: Unspecified error. Tx "
-				   "threshold now %2.2x.\n",
-				   dev->name, np->tx_thresh);
+			       "threshold now %2.2x.\n",
+			       dev->name, rp->tx_thresh);
 	}
-	if (intr_status & ( IntrTxAborted | IntrTxUnderrun | IntrTxDescRace |
-						IntrTxError ))
-		via_rhine_restart_tx(dev);
-
-	if (intr_status & ~( IntrLinkChange | IntrStatsMax | IntrTxUnderrun |
-						 IntrTxError | IntrTxAborted | IntrNormalSummary |
-						 IntrTxDescRace )) {
+	if (intr_status & (IntrTxAborted | IntrTxUnderrun | IntrTxDescRace |
+			   IntrTxError))
+		rhine_restart_tx(dev);
+
+	if (intr_status & ~(IntrLinkChange | IntrStatsMax | IntrTxUnderrun |
+			    IntrTxError | IntrTxAborted | IntrNormalSummary |
+			    IntrTxDescRace)) {
 		if (debug > 1)
-			printk(KERN_ERR "%s: Something Wicked happened! %8.8x.\n",
-				   dev->name, intr_status);
+			printk(KERN_ERR "%s: Something Wicked happened! "
+			       "%8.8x.\n", dev->name, intr_status);
 	}
 
-	spin_unlock (&np->lock);
+	spin_unlock(&rp->lock);
 }
 
-static struct net_device_stats *via_rhine_get_stats(struct net_device *dev)
+static struct net_device_stats *rhine_get_stats(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
 	unsigned long flags;
 
-	spin_lock_irqsave(&np->lock, flags);
-	np->stats.rx_crc_errors	+= readw(ioaddr + RxCRCErrs);
-	np->stats.rx_missed_errors	+= readw(ioaddr + RxMissed);
+	spin_lock_irqsave(&rp->lock, flags);
+	rp->stats.rx_crc_errors += readw(ioaddr + RxCRCErrs);
+	rp->stats.rx_missed_errors += readw(ioaddr + RxMissed);
 	clear_tally_counters(ioaddr);
-	spin_unlock_irqrestore(&np->lock, flags);
+	spin_unlock_irqrestore(&rp->lock, flags);
 
-	return &np->stats;
+	return &rp->stats;
 }
 
-static void via_rhine_set_rx_mode(struct net_device *dev)
+static void rhine_set_rx_mode(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	long ioaddr = dev->base_addr;
-	u32 mc_filter[2];			/* Multicast hash filter */
-	u8 rx_mode;					/* Note: 0x02=accept runt, 0x01=accept errs */
+	u32 mc_filter[2];	/* Multicast hash filter */
+	u8 rx_mode;		/* Note: 0x02=accept runt, 0x01=accept errs */
 
-	if (dev->flags & IFF_PROMISC) {			/* Set promiscuous. */
+	if (dev->flags & IFF_PROMISC) {		/* Set promiscuous. */
 		/* Unconditionally log net taps. */
-		printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
+		printk(KERN_NOTICE "%s: Promiscuous mode enabled.\n",
+		       dev->name);
 		rx_mode = 0x1C;
 		writel(0xffffffff, ioaddr + MulticastFilter0);
 		writel(0xffffffff, ioaddr + MulticastFilter1);
 	} else if ((dev->mc_count > multicast_filter_limit)
-			   ||  (dev->flags & IFF_ALLMULTI)) {
+		   || (dev->flags & IFF_ALLMULTI)) {
 		/* Too many to match, or accept all multicasts. */
 		writel(0xffffffff, ioaddr + MulticastFilter0);
 		writel(0xffffffff, ioaddr + MulticastFilter1);
@@ -1747,7 +1779,7 @@
 		int i;
 		memset(mc_filter, 0, sizeof(mc_filter));
 		for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
-			 i++, mclist = mclist->next) {
+		     i++, mclist = mclist->next) {
 			int bit_nr = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
 
 			mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31));
@@ -1756,66 +1788,66 @@
 		writel(mc_filter[1], ioaddr + MulticastFilter1);
 		rx_mode = 0x0C;
 	}
-	writeb(np->rx_thresh | rx_mode, ioaddr + RxConfig);
+	writeb(rp->rx_thresh | rx_mode, ioaddr + RxConfig);
 }
 
-static void netdev_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info)
+static void netdev_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 
-	strcpy (info->driver, DRV_NAME);
-	strcpy (info->version, DRV_VERSION);
-	strcpy (info->bus_info, pci_name(np->pdev));
+	strcpy(info->driver, DRV_NAME);
+	strcpy(info->version, DRV_VERSION);
+	strcpy(info->bus_info, pci_name(rp->pdev));
 }
 
 static int netdev_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	int rc;
 
-	if (!(np->drv_flags & CanHaveMII))
+	if (!(rp->drv_flags & CanHaveMII))
 		return -EINVAL;
 
-	spin_lock_irq(&np->lock);
-	rc = mii_ethtool_gset(&np->mii_if, cmd);
-	spin_unlock_irq(&np->lock);
+	spin_lock_irq(&rp->lock);
+	rc = mii_ethtool_gset(&rp->mii_if, cmd);
+	spin_unlock_irq(&rp->lock);
 
 	return rc;
 }
 
 static int netdev_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 	int rc;
 
-	if (!(np->drv_flags & CanHaveMII))
+	if (!(rp->drv_flags & CanHaveMII))
 		return -EINVAL;
 
-	spin_lock_irq(&np->lock);
-	rc = mii_ethtool_sset(&np->mii_if, cmd);
-	spin_unlock_irq(&np->lock);
+	spin_lock_irq(&rp->lock);
+	rc = mii_ethtool_sset(&rp->mii_if, cmd);
+	spin_unlock_irq(&rp->lock);
 
 	return rc;
 }
 
 static int netdev_nway_reset(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 
-	if (!(np->drv_flags & CanHaveMII))
+	if (!(rp->drv_flags & CanHaveMII))
 		return -EINVAL;
 
-	return mii_nway_restart(&np->mii_if);
+	return mii_nway_restart(&rp->mii_if);
 }
 
 static u32 netdev_get_link(struct net_device *dev)
 {
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 
-	if (!(np->drv_flags & CanHaveMII))
+	if (!(rp->drv_flags & CanHaveMII))
 		return 0;	/* -EINVAL */
 
-	return mii_link_ok(&np->mii_if);
+	return mii_link_ok(&rp->mii_if);
 }
 
 static u32 netdev_get_msglevel(struct net_device *dev)
@@ -1842,37 +1874,37 @@
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-	struct netdev_private *np = dev->priv;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
+	struct rhine_private *rp = netdev_priv(dev);
 	int rc;
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
-	spin_lock_irq(&np->lock);
-	rc = generic_mii_ioctl(&np->mii_if, data, cmd, NULL);
-	spin_unlock_irq(&np->lock);
+	spin_lock_irq(&rp->lock);
+	rc = generic_mii_ioctl(&rp->mii_if, if_mii(rq), cmd, NULL);
+	spin_unlock_irq(&rp->lock);
 
 	return rc;
 }
 
-static int via_rhine_close(struct net_device *dev)
+static int rhine_close(struct net_device *dev)
 {
 	long ioaddr = dev->base_addr;
-	struct netdev_private *np = dev->priv;
+	struct rhine_private *rp = netdev_priv(dev);
 
-	del_timer_sync(&np->timer);
+	del_timer_sync(&rp->timer);
 
-	spin_lock_irq(&np->lock);
+	spin_lock_irq(&rp->lock);
 
 	netif_stop_queue(dev);
 
 	if (debug > 1)
-		printk(KERN_DEBUG "%s: Shutting down ethercard, status was %4.4x.\n",
-			   dev->name, readw(ioaddr + ChipCmd));
+		printk(KERN_DEBUG "%s: Shutting down ethercard, "
+		       "status was %4.4x.\n",
+		       dev->name, readw(ioaddr + ChipCmd));
 
 	/* Switch to loopback mode to avoid hardware races. */
-	writeb(np->tx_thresh | 0x02, ioaddr + TxConfig);
+	writeb(rp->tx_thresh | 0x02, ioaddr + TxConfig);
 
 	/* Disable interrupts by clearing the interrupt mask. */
 	writew(0x0000, ioaddr + IntrEnable);
@@ -1880,9 +1912,9 @@
 	/* Stop the chip's Tx and Rx processes. */
 	writew(CmdStop, ioaddr + ChipCmd);
 
-	spin_unlock_irq(&np->lock);
+	spin_unlock_irq(&rp->lock);
 
-	free_irq(np->pdev->irq, dev);
+	free_irq(rp->pdev->irq, dev);
 	free_rbufs(dev);
 	free_tbufs(dev);
 	free_ring(dev);
@@ -1891,7 +1923,7 @@
 }
 
 
-static void __devexit via_rhine_remove_one (struct pci_dev *pdev)
+static void __devexit rhine_remove_one(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 
@@ -1899,7 +1931,7 @@
 
 	pci_release_regions(pdev);
 
-#ifdef USE_MEM
+#ifdef USE_MMIO
 	iounmap((char *)(dev->base_addr));
 #endif
 
@@ -1909,39 +1941,29 @@
 }
 
 
-static struct pci_driver via_rhine_driver = {
+static struct pci_driver rhine_driver = {
 	.name		= "via-rhine",
-	.id_table	= via_rhine_pci_tbl,
-	.probe		= via_rhine_init_one,
-	.remove		= __devexit_p(via_rhine_remove_one),
+	.id_table	= rhine_pci_tbl,
+	.probe		= rhine_init_one,
+	.remove		= __devexit_p(rhine_remove_one),
 };
 
 
-static int __init via_rhine_init (void)
+static int __init rhine_init(void)
 {
 /* when a module, this is printed whether or not devices are found in probe */
 #ifdef MODULE
 	printk(version);
 #endif
-	return pci_module_init (&via_rhine_driver);
+	return pci_module_init(&rhine_driver);
 }
 
 
-static void __exit via_rhine_cleanup (void)
+static void __exit rhine_cleanup(void)
 {
-	pci_unregister_driver (&via_rhine_driver);
+	pci_unregister_driver(&rhine_driver);
 }
 
 
-module_init(via_rhine_init);
-module_exit(via_rhine_cleanup);
-
-
-/*
- * Local variables:
- *  compile-command: "gcc -DMODULE -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -c via-rhine.c `[ -f /usr/include/linux/modversions.h ] && echo -DMODVERSIONS`"
- *  c-indent-level: 4
- *  c-basic-offset: 4
- *  tab-width: 4
- * End:
- */
+module_init(rhine_init);
+module_exit(rhine_cleanup);
diff -Nru a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
--- a/drivers/net/wan/Kconfig	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/wan/Kconfig	Tue Jun 15 22:20:38 2004
@@ -57,119 +57,6 @@
 	  The driver will be compiled as a module: the
 	  module will be called cosa.
 
-#
-# COMX drivers
-#
-# Not updated to 2.6.
-config COMX
-	tristate "MultiGate (COMX) synchronous serial boards support"
-	depends on WAN && (ISA || PCI) && BROKEN
-	---help---
-	  Drivers for the PC synchronous serial adapters by
-	  ITConsult-Pro Co, Hungary.
-
-	  Read <file:Documentation/networking/comx.txt> for help on configuring
-	  and using COMX interfaces. Further info on these cards can be found
-	  at <http://www.itc.hu/> or <info@itc.hu>.
-
-	  Say Y if you want to use any board from the MultiGate (COMX)
-	  family, you must also say Y to "/proc file system support"
-	  (CONFIG_PROC_FS) in order to use these drivers.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called comx.
-
-config COMX_HW_COMX
-	tristate "Support for COMX/CMX/HiCOMX boards"
-	depends on COMX
-	help
-	  Driver for the 'CMX', 'COMX' and 'HiCOMX' boards.
-
-	  You will need additional firmware to use these cards, which are
-	  downloadable from <ftp://ftp.itc.hu/>.
-
-	  Say Y if you have a board like this.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called comx-hw-comx.
-
-config COMX_HW_LOCOMX
-	tristate "Support for LoCOMX board"
-	depends on COMX
-	help
-	  Driver for the 'LoCOMX' board.
-
-	  Say Y if you have a board like this.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called comx-hw-locomx.
-
-config COMX_HW_MIXCOM
-	tristate "Support for MixCOM board"
-	depends on COMX
-	---help---
-	  Driver for the 'MixCOM' board.
-
-	  If you want to use the watchdog device on this card, you should
-	  select it in the Watchdog Cards section of the Character Devices
-	  configuration. The ISDN interface of this card is Teles 16.3
-	  compatible, you should enable it in the ISDN configuration menu. The
-	  driver for the flash ROM of this card is available separately on
-	  <ftp://ftp.itc.hu/>.
-
-	  Say Y if you have a board like this.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called comx-hw-mixcom.
-
-config COMX_HW_MUNICH
-	tristate "Support for MUNICH based boards: SliceCOM, PCICOM (WelCOM)"
-	depends on COMX
-	---help---
-	  Driver for the 'SliceCOM' (channelized E1) and 'PciCOM' (X21) boards.
-
-	  Read <file:Documentation/networking/slicecom.txt> for help on
-	  configuring and using SliceCOM interfaces. Further info on these
-	  cards can be found at <http://www.itc.hu> or <info@itc.hu>.
-
-	  Say Y if you have a board like this.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called comx-hw-munich.
-
-config COMX_PROTO_PPP
-	tristate "Support for HDLC and syncPPP protocols on MultiGate boards"
-	depends on COMX
-	help
-	  Cisco-HDLC and synchronous PPP protocol driver.
-
-	  Say Y if you want to use either protocol.
-
-	  To compile this as a module, choose M here: the
-	  module will be called comx-proto-ppp.
-
-config COMX_PROTO_LAPB
-	tristate "Support for LAPB protocol on MultiGate boards"
-	depends on WAN && (COMX!=n && LAPB=m && LAPB || LAPB=y && COMX)
-	help
-	  LAPB protocol driver.
-
-	  Say Y if you want to use this protocol.
-
-	  To compile this as a module, choose M here: the
-	  module will be called comx-proto-lapb.
-
-config COMX_PROTO_FR
-	tristate "Support for Frame Relay on MultiGate boards"
-	depends on COMX
-	help
-	  Frame Relay protocol driver.
-
-	  Say Y if you want to use this protocol.
-
-	  To compile this as a module, choose M here: the
-	  module will be called comx-proto-fr.
-
 config DSCC4
 	tristate "Etinc PCISYNC serial board support"
 	depends on WAN && PCI && m
diff -Nru a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
--- a/drivers/net/wan/Makefile	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/wan/Makefile	Tue Jun 15 22:20:41 2004
@@ -32,14 +32,6 @@
 
 obj-$(CONFIG_HOSTESS_SV11)	+= z85230.o	syncppp.o	hostess_sv11.o
 obj-$(CONFIG_SEALEVEL_4021)	+= z85230.o	syncppp.o	sealevel.o
-obj-$(CONFIG_COMX)		+= 				comx.o
-obj-$(CONFIG_COMX_HW_COMX)	+= 				comx-hw-comx.o
-obj-$(CONFIG_COMX_HW_LOCOMX)	+= z85230.o	syncppp.o	comx-hw-locomx.o
-obj-$(CONFIG_COMX_HW_MIXCOM)	+=				comx-hw-mixcom.o
-obj-$(CONFIG_COMX_HW_MUNICH)	+=				comx-hw-munich.o
-obj-$(CONFIG_COMX_PROTO_PPP)	+=		syncppp.o	comx-proto-ppp.o
-obj-$(CONFIG_COMX_PROTO_LAPB)	+=				comx-proto-lapb.o
-obj-$(CONFIG_COMX_PROTO_FR)	+=				comx-proto-fr.o
 obj-$(CONFIG_COSA)		+=		syncppp.o	cosa.o
 obj-$(CONFIG_FARSYNC)		+=		syncppp.o	farsync.o
 obj-$(CONFIG_DSCC4)             +=				dscc4.o
@@ -69,6 +61,9 @@
 obj-$(CONFIG_WANXL)		+= wanxl.o
 obj-$(CONFIG_PCI200SYN)		+= pci200syn.o
 
+clean-files := wanxlfw.inc
+$(obj)/wanxl.o:	$(obj)/wanxlfw.inc
+
 ifeq ($(CONFIG_WANXL_BUILD_FIRMWARE),y)
 ifeq ($(ARCH),m68k)
   AS68K = $(AS)
@@ -80,12 +75,12 @@
 
 quiet_cmd_build_wanxlfw = BLD FW  $@
       cmd_build_wanxlfw = \
-	$(CPP) -Wp,-MD,$(depfile) -Iinclude $(obj)/wanxlfw.S | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
+	$(CPP) -Wp,-MD,$(depfile) -I$(srctree)/include $< | $(AS68K) -m68360 -o $(obj)/wanxlfw.o; \
 	$(LD68K) --oformat binary -Ttext 0x1000 $(obj)/wanxlfw.o -o $(obj)/wanxlfw.bin; \
 	hexdump -ve '"\n" 16/1 "0x%02X,"' $(obj)/wanxlfw.bin | sed 's/0x  ,//g;1s/^/static u8 firmware[]={/;$$s/,$$/\n};\n/' >$(obj)/wanxlfw.inc; \
 	rm -f $(obj)/wanxlfw.bin $(obj)/wanxlfw.o
 
-$(obj)/wanxlfw.inc:	$(obj)/wanxlfw.S
+$(obj)/wanxlfw.inc:	$(src)/wanxlfw.S
 	$(call if_changed_dep,build_wanxlfw)
 targets += wanxlfw.inc
 endif
diff -Nru a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c
--- a/drivers/net/wan/c101.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/net/wan/c101.c	Tue Jun 15 22:20:43 2004
@@ -379,8 +379,6 @@
 		return result;
 	}
 
-	/* XXX: are we OK with having that done when card is already up? */
-
 	sca_init_sync_port(card); /* Set up C101 memory */
 	hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), dev);
 
diff -Nru a/drivers/net/wan/comx-hw-comx.c b/drivers/net/wan/comx-hw-comx.c
--- a/drivers/net/wan/comx-hw-comx.c	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1450 +0,0 @@
-/*
- * Hardware-level driver for the COMX and HICOMX cards
- * for Linux kernel 2.2.X
- *
- * Original authors:  Arpad Bakay <bakay.arpad@synergon.hu>,
- *                    Peter Bajan <bajan.peter@synergon.hu>,
- * Rewritten by: Tivadar Szemethy <tiv@itc.hu>
- * Currently maintained by: Gergely Madarasz <gorgo@itc.hu>
- *
- * Copyright (C) 1995-2000 ITConsult-Pro Co. <info@itc.hu>
- *
- * Contributors:
- * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 0.86
- * Daniele Bellucci         <bellucda@tiscali.it>   - 0.87
- *
- * 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.
- *
- * Version 0.80 (99/06/11):
- *		- port back to kernel, add support builtin driver 
- *		- cleaned up the source code a bit
- *
- * Version 0.81 (99/06/22):
- *		- cleaned up the board load functions, no more long reset
- *		  timeouts
- *		- lower modem lines on close
- *		- some interrupt handling fixes
- *
- * Version 0.82 (99/08/24):
- *		- fix multiple board support
- *
- * Version 0.83 (99/11/30):
- *		- interrupt handling and locking fixes during initalization
- *		- really fix multiple board support
- * 
- * Version 0.84 (99/12/02):
- *		- some workarounds for problematic hardware/firmware
- *
- * Version 0.85 (00/01/14):
- *		- some additional workarounds :/
- *		- printk cleanups
- * Version 0.86 (00/08/15):
- * 		- resource release on failure at COMX_init
- *
- * Version 0.87 (03/07/09)
- *              - audit copy_from_user in comxhw_write_proc
- */
-
-#define VERSION "0.87"
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/netdevice.h>
-#include <linux/proc_fs.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-
-#include <asm/uaccess.h>
-#include <asm/io.h>
-
-#include "comx.h"
-#include "comxhw.h"
-
-MODULE_AUTHOR("Gergely Madarasz <gorgo@itc.hu>, Tivadar Szemethy <tiv@itc.hu>, Arpad Bakay");
-MODULE_DESCRIPTION("Hardware-level driver for the COMX and HICOMX adapters\n");
-MODULE_LICENSE("GPL");
-
-#define	COMX_readw(dev, offset)	(readw(dev->mem_start + offset + \
-	(unsigned int)(((struct comx_privdata *)\
-	((struct comx_channel *)dev->priv)->HW_privdata)->channel) \
-	* COMX_CHANNEL_OFFSET))
-
-#define COMX_WRITE(dev, offset, value)	(writew(value, dev->mem_start + offset \
-	+ (unsigned int)(((struct comx_privdata *) \
-	((struct comx_channel *)dev->priv)->HW_privdata)->channel) \
-	* COMX_CHANNEL_OFFSET))
-
-#define COMX_CMD(dev, cmd)	(COMX_WRITE(dev, OFF_A_L2_CMD, cmd))
-
-struct comx_firmware {
-	int	len;
-	unsigned char *data;
-};
-
-struct comx_privdata {
-	struct comx_firmware *firmware;
-	u16	clock;
-	char	channel;		// channel no.
-	int	memory_size;
-	short	io_extent;
-	u_long	histogram[5];
-};
-
-static struct net_device *memory_used[(COMX_MEM_MAX - COMX_MEM_MIN) / 0x10000];
-extern struct comx_hardware hicomx_hw;
-extern struct comx_hardware comx_hw;
-extern struct comx_hardware cmx_hw;
-
-static irqreturn_t COMX_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-
-static void COMX_board_on(struct net_device *dev)
-{
-	outb_p( (byte) (((dev->mem_start & 0xf0000) >> 16) | 
-	    COMX_ENABLE_BOARD_IT | COMX_ENABLE_BOARD_MEM), dev->base_addr);
-}
-
-static void COMX_board_off(struct net_device *dev)
-{
-	outb_p( (byte) (((dev->mem_start & 0xf0000) >> 16) | 
-	   COMX_ENABLE_BOARD_IT), dev->base_addr);
-}
-
-static void HICOMX_board_on(struct net_device *dev)
-{
-	outb_p( (byte) (((dev->mem_start & 0xf0000) >> 12) | 
-	   HICOMX_ENABLE_BOARD_MEM), dev->base_addr);
-}
-
-static void HICOMX_board_off(struct net_device *dev)
-{
-	outb_p( (byte) (((dev->mem_start & 0xf0000) >> 12) | 
-	   HICOMX_DISABLE_BOARD_MEM), dev->base_addr);
-}
-
-static void COMX_set_clock(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-
-	COMX_WRITE(dev, OFF_A_L1_CLKINI, hw->clock);
-}
-
-static struct net_device *COMX_access_board(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct net_device *ret;
-	int mempos = (dev->mem_start - COMX_MEM_MIN) >> 16;
-	unsigned long flags;
-
-
-	save_flags(flags); cli();
-	
-	ret = memory_used[mempos];
-
-	if(ret == dev) {
-		goto out;
-	}
-
-	memory_used[mempos] = dev;
-
-	if (!ch->twin || ret != ch->twin) {
-		if (ret) ((struct comx_channel *)ret->priv)->HW_board_off(ret);
-		ch->HW_board_on(dev);
-	}
-out:
-	restore_flags(flags);
-	return ret;
-}
-
-static void COMX_release_board(struct net_device *dev, struct net_device *savep)
-{
-	unsigned long flags;
-	int mempos = (dev->mem_start - COMX_MEM_MIN) >> 16;
-	struct comx_channel *ch = dev->priv;
-
-	save_flags(flags); cli();
-
-	if (memory_used[mempos] == savep) {
-		goto out;
-	}
-
-	memory_used[mempos] = savep;
-	if (!ch->twin || ch->twin != savep) {
-		ch->HW_board_off(dev);
-		if (savep) ((struct comx_channel*)savep->priv)->HW_board_on(savep);
-	}
-out:
-	restore_flags(flags);
-}
-
-static int COMX_txe(struct net_device *dev) 
-{
-	struct net_device *savep;
-	struct comx_channel *ch = dev->priv;
-	int rc = 0;
-
-	savep = ch->HW_access_board(dev);
-	if (COMX_readw(dev,OFF_A_L2_LINKUP) == LINKUP_READY) {
-		rc = COMX_readw(dev,OFF_A_L2_TxEMPTY);
-	} 
-	ch->HW_release_board(dev,savep);
-	if(rc==0xffff) {
-		printk(KERN_ERR "%s, OFF_A_L2_TxEMPTY is %d\n",dev->name, rc);
-	}
-	return rc;
-}
-
-static int COMX_send_packet(struct net_device *dev, struct sk_buff *skb)
-{
-	struct net_device *savep;
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	int ret = FRAME_DROPPED;
-	word tmp;
-
-	savep = ch->HW_access_board(dev);	
-
-	if (ch->debug_flags & DEBUG_HW_TX) {
-		comx_debug_bytes(dev, skb->data, skb->len,"COMX_send packet");
-	}
-
-	if (skb->len > COMX_MAX_TX_SIZE) {
-		ret=FRAME_DROPPED;
-		goto out;
-	}
-
-	tmp=COMX_readw(dev, OFF_A_L2_TxEMPTY);
-	if ((ch->line_status & LINE_UP) && tmp==1) {
-		int lensave = skb->len;
-		int dest = COMX_readw(dev, OFF_A_L2_TxBUFP);
-		word *data = (word *)skb->data;
-
-		if(dest==0xffff) {
-			printk(KERN_ERR "%s: OFF_A_L2_TxBUFP is %d\n", dev->name, dest);
-			ret=FRAME_DROPPED;
-			goto out;
-		}
-					
-		writew((unsigned short)skb->len, dev->mem_start + dest);
-		dest += 2;
-		while (skb->len > 1) {
-			writew(*data++, dev->mem_start + dest);
-			dest += 2; skb->len -= 2;
-		}
-		if (skb->len == 1) {
-			writew(*((byte *)data), dev->mem_start + dest);
-		}
-		writew(0, dev->mem_start + (int)hw->channel * 
-		   COMX_CHANNEL_OFFSET + OFF_A_L2_TxEMPTY);
-		ch->stats.tx_packets++;	
-		ch->stats.tx_bytes += lensave; 
-		ret = FRAME_ACCEPTED;
-	} else {
-		ch->stats.tx_dropped++;
-		printk(KERN_INFO "%s: frame dropped\n",dev->name);
-		if(tmp) {
-			printk(KERN_ERR "%s: OFF_A_L2_TxEMPTY is %d\n",dev->name,tmp);
-		}
-	}
-	
-out:
-	ch->HW_release_board(dev, savep);
-	dev_kfree_skb(skb);
-	return ret;
-}
-
-static inline int comx_read_buffer(struct net_device *dev) 
-{
-	struct comx_channel *ch = dev->priv;
-	word rbuf_offs;
-	struct sk_buff *skb;
-	word len;
-	int i=0;
-	word *writeptr;
-
-	i = 0;
-	rbuf_offs = COMX_readw(dev, OFF_A_L2_RxBUFP);
-	if(rbuf_offs == 0xffff) {
-		printk(KERN_ERR "%s: OFF_A_L2_RxBUFP is %d\n",dev->name,rbuf_offs);
-		return 0;
-	}
-	len = readw(dev->mem_start + rbuf_offs);
-	if(len > COMX_MAX_RX_SIZE) {
-		printk(KERN_ERR "%s: packet length is %d\n",dev->name,len);
-		return 0;
-	}
-	if ((skb = dev_alloc_skb(len + 16)) == NULL) {
-		ch->stats.rx_dropped++;
-		COMX_WRITE(dev, OFF_A_L2_DAV, 0);
-		return 0;
-	}
-	rbuf_offs += 2;
-	skb_reserve(skb, 16);
-	skb_put(skb, len);
-	skb->dev = dev;
-	writeptr = (word *)skb->data;
-	while (i < len) {
-		*writeptr++ = readw(dev->mem_start + rbuf_offs);
-		rbuf_offs += 2; 
-		i += 2;
-	}
-	COMX_WRITE(dev, OFF_A_L2_DAV, 0);
-	ch->stats.rx_packets++;
-	ch->stats.rx_bytes += len;
-	if (ch->debug_flags & DEBUG_HW_RX) {
-		comx_debug_skb(dev, skb, "COMX_interrupt receiving");
-	}
-	ch->LINE_rx(dev, skb);
-	return 1;
-}
-
-static inline char comx_line_change(struct net_device *dev, char linestat)
-{
-	struct comx_channel *ch=dev->priv;
-	char idle=1;
-	
-	
-	if (linestat & LINE_UP) { /* Vonal fol */
-		if (ch->lineup_delay) {
-			if (!test_and_set_bit(0, &ch->lineup_pending)) {
-				ch->lineup_timer.function = comx_lineup_func;
-				ch->lineup_timer.data = (unsigned long)dev;
-				ch->lineup_timer.expires = jiffies +
-					HZ*ch->lineup_delay;
-				add_timer(&ch->lineup_timer);
-				idle=0;
-			}
-		} else {
-			idle=0;
-			ch->LINE_status(dev, ch->line_status |= LINE_UP);
-		}
-	} else { /* Vonal le */
-		idle=0;
-		if (test_and_clear_bit(0, &ch->lineup_pending)) {
-			del_timer(&ch->lineup_timer);
-		} else {
-			ch->line_status &= ~LINE_UP;
-			if (ch->LINE_status) {
-				ch->LINE_status(dev, ch->line_status);
-			}
-		}
-	}
-	return idle;
-}
-
-
-
-static irqreturn_t COMX_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-	struct net_device *dev = dev_id;
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	struct net_device *interrupted;
-	unsigned long jiffs;
-	char idle = 0;
-	int count = 0;
-	word tmp;
-
-	if (dev == NULL) {
-		printk(KERN_ERR "COMX_interrupt: irq %d for unknown device\n", irq);
-		return IRQ_NONE;
-	}
-
-	jiffs = jiffies;
-
-	interrupted = ch->HW_access_board(dev);
-
-	while (!idle && count < 5000) {
-		char channel = 0;
-		idle = 1;
-
-		while (channel < 2) {
-			char linestat = 0;
-			char buffers_emptied = 0;
-
-			if (channel == 1) {
-				if (ch->twin) {
-					dev = ch->twin;
-					ch = dev->priv;
-					hw = ch->HW_privdata;
-				} else {
-					break;
-				}
-			} else {
-				COMX_WRITE(dev, OFF_A_L1_REPENA, 
-				    COMX_readw(dev, OFF_A_L1_REPENA) & 0xFF00);
-			}
-			channel++;
-
-			if ((ch->init_status & (HW_OPEN | LINE_OPEN)) != 
-			   (HW_OPEN | LINE_OPEN)) {
-				continue;
-			}
-	
-			/* Collect stats */
-			tmp = COMX_readw(dev, OFF_A_L1_ABOREC);
-			COMX_WRITE(dev, OFF_A_L1_ABOREC, 0);
-			if(tmp==0xffff) {
-				printk(KERN_ERR "%s: OFF_A_L1_ABOREC is %d\n",dev->name,tmp);
-				break;
-			} else {
-				ch->stats.rx_missed_errors += (tmp >> 8) & 0xff;
-				ch->stats.rx_over_errors += tmp & 0xff;
-			}
-			tmp = COMX_readw(dev, OFF_A_L1_CRCREC);
-			COMX_WRITE(dev, OFF_A_L1_CRCREC, 0);
-			if(tmp==0xffff) {
-				printk(KERN_ERR "%s: OFF_A_L1_CRCREC is %d\n",dev->name,tmp);
-				break;
-			} else {
-				ch->stats.rx_crc_errors += (tmp >> 8) & 0xff;
-				ch->stats.rx_missed_errors += tmp & 0xff;
-			}
-			
-			if ((ch->line_status & LINE_UP) && ch->LINE_rx) {
-				tmp=COMX_readw(dev, OFF_A_L2_DAV); 
-				while (tmp==1) {
-					idle=0;
-					buffers_emptied+=comx_read_buffer(dev);
-					tmp=COMX_readw(dev, OFF_A_L2_DAV); 
-				}
-				if(tmp) {
-					printk(KERN_ERR "%s: OFF_A_L2_DAV is %d\n", dev->name, tmp);
-					break;
-				}
-			}
-
-			tmp=COMX_readw(dev, OFF_A_L2_TxEMPTY);
-			if (tmp==1 && ch->LINE_tx) {
-				ch->LINE_tx(dev);
-			} 
-			if(tmp==0xffff) {
-				printk(KERN_ERR "%s: OFF_A_L2_TxEMPTY is %d\n", dev->name, tmp);
-				break;
-			}
-
-			if (COMX_readw(dev, OFF_A_L1_PBUFOVR) >> 8) {
-				linestat &= ~LINE_UP;
-			} else {
-				linestat |= LINE_UP;
-			}
-
-			if ((linestat & LINE_UP) != (ch->line_status & LINE_UP)) {
-				ch->stats.tx_carrier_errors++;
-				idle &= comx_line_change(dev,linestat);
-			}
-				
-			hw->histogram[(int)buffers_emptied]++;
-		}
-		count++;
-	}
-
-	if(count==5000) {
-		printk(KERN_WARNING "%s: interrupt stuck\n",dev->name);
-	}
-
-	ch->HW_release_board(dev, interrupted);
-	return IRQ_HANDLED;
-}
-
-static int COMX_open(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	struct proc_dir_entry *procfile = ch->procdir->subdir;
-	unsigned long jiffs;
-	int twin_open=0;
-	int retval;
-	struct net_device *savep;
-
-	if (!dev->base_addr || !dev->irq || !dev->mem_start) {
-		return -ENODEV;
-	}
-
-	if (ch->twin && (((struct comx_channel *)(ch->twin->priv))->init_status & HW_OPEN)) {
-		twin_open=1;
-	}
-
-	if (!twin_open) {
-		if (!request_region(dev->base_addr, hw->io_extent, dev->name)) {
-			return -EAGAIN;
-		}
-		if (request_irq(dev->irq, COMX_interrupt, 0, dev->name, 
-		   (void *)dev)) {
-			printk(KERN_ERR "comx-hw-comx: unable to obtain irq %d\n", dev->irq);
-			release_region(dev->base_addr, hw->io_extent);
-			return -EAGAIN;
-		}
-		ch->init_status |= IRQ_ALLOCATED;
-		if (!ch->HW_load_board || ch->HW_load_board(dev)) {
-			ch->init_status &= ~IRQ_ALLOCATED;
-			retval=-ENODEV;
-			goto error;
-		}
-	}
-
-	savep = ch->HW_access_board(dev);
-	COMX_WRITE(dev, OFF_A_L2_LINKUP, 0);
-
-	if (ch->HW_set_clock) {
-		ch->HW_set_clock(dev);
-	}
-
-	COMX_CMD(dev, COMX_CMD_INIT); 
-	jiffs = jiffies;
-	while (COMX_readw(dev, OFF_A_L2_LINKUP) != 1 && time_before(jiffies, jiffs + HZ)) {
-		schedule_timeout(1);
-	}
-	
-	if (time_after_eq(jiffies, jiffs + HZ)) {
-		printk(KERN_ERR "%s: board timeout on INIT command\n", dev->name);
-		ch->HW_release_board(dev, savep);
-		retval=-EIO;
-		goto error;
-	}
-	udelay(1000);
-
-	COMX_CMD(dev, COMX_CMD_OPEN);
-
-	jiffs = jiffies;
-	while (COMX_readw(dev, OFF_A_L2_LINKUP) != 3 && time_before(jiffies, jiffs + HZ)) {
-		schedule_timeout(1);
-	}
-	
-	if (time_after_eq(jiffies, jiffs + HZ)) {
-		printk(KERN_ERR "%s: board timeout on OPEN command\n", dev->name);
-		ch->HW_release_board(dev, savep);
-		retval=-EIO;
-		goto error;
-	}
-	
-	ch->init_status |= HW_OPEN;
-	
-	/* Ez eleg ciki, de ilyen a rendszer */
-	if (COMX_readw(dev, OFF_A_L1_PBUFOVR) >> 8) {
-		ch->line_status &= ~LINE_UP;
-	} else {
-		ch->line_status |= LINE_UP;
-	}
-	
-	if (ch->LINE_status) {
-		ch->LINE_status(dev, ch->line_status);
-	}
-
-	ch->HW_release_board(dev, savep);
-
-	for ( ; procfile ; procfile = procfile->next) {
-		if (strcmp(procfile->name, FILENAME_IRQ) == 0 
-		    || strcmp(procfile->name, FILENAME_IO) == 0
-		    || strcmp(procfile->name, FILENAME_MEMADDR) == 0
-		    || strcmp(procfile->name, FILENAME_CHANNEL) == 0
-		    || strcmp(procfile->name, FILENAME_FIRMWARE) == 0
-		    || strcmp(procfile->name, FILENAME_CLOCK) == 0) {
-			procfile->mode = S_IFREG | 0444;
-		
-		}
-	}	
-	
-	return 0;	
-
-error:
-	if(!twin_open) {
-		release_region(dev->base_addr, hw->io_extent);
-		free_irq(dev->irq, (void *)dev);
-	}
-	return retval;
-
-}
-
-static int COMX_close(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct proc_dir_entry *procfile = ch->procdir->subdir;
-	struct comx_privdata *hw = ch->HW_privdata;
-	struct comx_channel *twin_ch;
-	struct net_device *savep;
-
-	savep = ch->HW_access_board(dev);
-
-	COMX_CMD(dev, COMX_CMD_CLOSE);
-	udelay(1000);
-	COMX_CMD(dev, COMX_CMD_EXIT);
-
-	ch->HW_release_board(dev, savep);
-
-	if (ch->init_status & IRQ_ALLOCATED) {
-		free_irq(dev->irq, (void *)dev);
-		ch->init_status &= ~IRQ_ALLOCATED;
-	}
-	release_region(dev->base_addr, hw->io_extent);
-
-	if (ch->twin && (twin_ch = ch->twin->priv) && 
-	    (twin_ch->init_status & HW_OPEN)) {
-		/* Pass the irq to the twin */
-		if (request_irq(dev->irq, COMX_interrupt, 0, ch->twin->name, 
-		   (void *)ch->twin) == 0) {
-			twin_ch->init_status |= IRQ_ALLOCATED;
-		}
-	}
-
-	for ( ; procfile ; procfile = procfile->next) {
-		if (strcmp(procfile->name, FILENAME_IRQ) == 0 
-		    || strcmp(procfile->name, FILENAME_IO) == 0
-		    || strcmp(procfile->name, FILENAME_MEMADDR) == 0
-		    || strcmp(procfile->name, FILENAME_CHANNEL) == 0
-		    || strcmp(procfile->name, FILENAME_FIRMWARE) == 0
-		    || strcmp(procfile->name, FILENAME_CLOCK) == 0) {
-			procfile->mode = S_IFREG | 0644;
-		}
-	}
-	
-	ch->init_status &= ~HW_OPEN;
-	return 0;
-}
-
-static int COMX_statistics(struct net_device *dev, char *page)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	struct net_device *savep;
-	int len = 0;
-
-	savep = ch->HW_access_board(dev);
-
-	len += sprintf(page + len, "Board data: %s %s %s %s\nPBUFOVR: %02x, "
-		"MODSTAT: %02x, LINKUP: %02x, DAV: %02x\nRxBUFP: %02x, "
-		"TxEMPTY: %02x, TxBUFP: %02x\n",
-		(ch->init_status & HW_OPEN) ? "HW_OPEN" : "",
-		(ch->init_status & LINE_OPEN) ? "LINE_OPEN" : "",
-		(ch->init_status & FW_LOADED) ? "FW_LOADED" : "",
-		(ch->init_status & IRQ_ALLOCATED) ? "IRQ_ALLOCATED" : "",
-		COMX_readw(dev, OFF_A_L1_PBUFOVR) & 0xff,
-		(COMX_readw(dev, OFF_A_L1_PBUFOVR) >> 8) & 0xff,
-		COMX_readw(dev, OFF_A_L2_LINKUP) & 0xff,
-		COMX_readw(dev, OFF_A_L2_DAV) & 0xff,
-		COMX_readw(dev, OFF_A_L2_RxBUFP) & 0xff,
-		COMX_readw(dev, OFF_A_L2_TxEMPTY) & 0xff,
-		COMX_readw(dev, OFF_A_L2_TxBUFP) & 0xff);
-
-	len += sprintf(page + len, "hist[0]: %8lu hist[1]: %8lu hist[2]: %8lu\n"
-		"hist[3]: %8lu hist[4]: %8lu\n",hw->histogram[0],hw->histogram[1],
-		hw->histogram[2],hw->histogram[3],hw->histogram[4]);
-
-	ch->HW_release_board(dev, savep);
-
-	return len;
-}
-
-static int COMX_load_board(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	struct comx_firmware *fw = hw->firmware;
-	word board_segment = dev->mem_start >> 16;
-	int mempos = (dev->mem_start - COMX_MEM_MIN) >> 16;
-	unsigned long flags;
-	unsigned char id1, id2;
-	struct net_device *saved;
-	int retval;
-	int loopcount;
-	int len;
-	byte *COMX_address;
-
-	if (!fw || !fw->len) {
-		struct comx_channel *twin_ch = ch->twin ? ch->twin->priv : NULL;
-		struct comx_privdata *twin_hw;
-
-		if (!twin_ch || !(twin_hw = twin_ch->HW_privdata)) {
-			return -EAGAIN;
-		}
-
-		if (!(fw = twin_hw->firmware) || !fw->len) {
-			return -EAGAIN;
-		}
-	}
-
-	id1 = fw->data[OFF_FW_L1_ID]; 
-	id2 = fw->data[OFF_FW_L1_ID + 1];
-
-	if (id1 != FW_L1_ID_1 || id2 != FW_L1_ID_2_COMX) {
-		printk(KERN_ERR "%s: incorrect firmware, load aborted\n", 
-			dev->name);
-		return -EAGAIN;
-	}
-
-	printk(KERN_INFO "%s: Loading COMX Layer 1 firmware %s\n", dev->name, 
-		(char *)(fw->data + OFF_FW_L1_ID + 2));
-
-	id1 = fw->data[OFF_FW_L2_ID]; 
-	id2 = fw->data[OFF_FW_L2_ID + 1];
-	if (id1 == FW_L2_ID_1 && (id2 == 0xc0 || id2 == 0xc1 || id2 == 0xc2)) {
-		printk(KERN_INFO "with Layer 2 code %s\n", 
-			(char *)(fw->data + OFF_FW_L2_ID + 2));
-	}
-
-	outb_p(board_segment | COMX_BOARD_RESET, dev->base_addr);
-	/* 10 usec should be enough here */
-	udelay(100);
-
-	save_flags(flags); cli();
-	saved=memory_used[mempos];
-	if(saved) {
-		((struct comx_channel *)saved->priv)->HW_board_off(saved);
-	}
-	memory_used[mempos]=dev;
-
-	outb_p(board_segment | COMX_ENABLE_BOARD_MEM, dev->base_addr);
-
-	writeb(0, dev->mem_start + COMX_JAIL_OFFSET);	
-
-	loopcount=0;
-	while(loopcount++ < 10000 && 
-	    readb(dev->mem_start + COMX_JAIL_OFFSET) != COMX_JAIL_VALUE) {
-		udelay(100);
-	}	
-	
-	if (readb(dev->mem_start + COMX_JAIL_OFFSET) != COMX_JAIL_VALUE) {
-		printk(KERN_ERR "%s: Can't reset board, JAIL value is %02x\n",
-			dev->name, readb(dev->mem_start + COMX_JAIL_OFFSET));
-		retval=-ENODEV;
-		goto out;
-	}
-
-	writeb(0x55, dev->mem_start + 0x18ff);
-	
-	loopcount=0;
-	while(loopcount++ < 10000 && readb(dev->mem_start + 0x18ff) != 0) {
-		udelay(100);
-	}
-
-	if(readb(dev->mem_start + 0x18ff) != 0) {
-		printk(KERN_ERR "%s: Can't reset board, reset timeout\n",
-			dev->name);
-		retval=-ENODEV;
-		goto out;
-	}		
-
-	len = 0;
-	COMX_address = (byte *)dev->mem_start;
-	while (fw->len > len) {
-		writeb(fw->data[len++], COMX_address++);
-	}
-
-	len = 0;
-	COMX_address = (byte *)dev->mem_start;
-	while (len != fw->len && readb(COMX_address++) == fw->data[len]) {
-		len++;
-	}
-
-	if (len != fw->len) {
-		printk(KERN_ERR "%s: error loading firmware: [%d] is 0x%02x "
-			"instead of 0x%02x\n", dev->name, len, 
-			readb(COMX_address - 1), fw->data[len]);
-		retval=-EAGAIN;
-		goto out;
-	}
-
-	writeb(0, dev->mem_start + COMX_JAIL_OFFSET);
-
-	loopcount = 0;
-	while ( loopcount++ < 10000 && COMX_readw(dev, OFF_A_L2_LINKUP) != 1 ) {
-		udelay(100);
-	}
-
-	if (COMX_readw(dev, OFF_A_L2_LINKUP) != 1) {
-		printk(KERN_ERR "%s: error starting firmware, linkup word is %04x\n",
-			dev->name, COMX_readw(dev, OFF_A_L2_LINKUP));
-		retval=-EAGAIN;
-		goto out;
-	}
-
-
-	ch->init_status |= FW_LOADED;
-	retval=0;
-
-out: 
-	outb_p(board_segment | COMX_DISABLE_ALL, dev->base_addr);
-	if(saved) {
-		((struct comx_channel *)saved->priv)->HW_board_on(saved);
-	}
-	memory_used[mempos]=saved;
-	restore_flags(flags);
-	return retval;
-}
-
-static int CMX_load_board(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	struct comx_firmware *fw = hw->firmware;
-	word board_segment = dev->mem_start >> 16;
-	int mempos = (dev->mem_start - COMX_MEM_MIN) >> 16;
-	#if 0
-	unsigned char id1, id2;
-	#endif
-	struct net_device *saved;
-	unsigned long flags;
-	int retval;
-	int loopcount;
-	int len;
-	byte *COMX_address;
-
-	if (!fw || !fw->len) {
-		struct comx_channel *twin_ch = ch->twin ? ch->twin->priv : NULL;
-		struct comx_privdata *twin_hw;
-
-		if (!twin_ch || !(twin_hw = twin_ch->HW_privdata)) {
-			return -EAGAIN;
-		}
-
-		if (!(fw = twin_hw->firmware) || !fw->len) {
-			return -EAGAIN;
-		}
-	}
-
-	/* Ide kell olyat tenni, hogy ellenorizze az ID-t */
-
-	if (inb_p(dev->base_addr) != CMX_ID_BYTE) {
-		printk(KERN_ERR "%s: CMX id byte is invalid(%02x)\n", dev->name,
-			inb_p(dev->base_addr));
-		return -ENODEV;
-	}
-
-	printk(KERN_INFO "%s: Loading CMX Layer 1 firmware %s\n", dev->name, 
-		(char *)(fw->data + OFF_FW_L1_ID + 2));
-
-	save_flags(flags); cli();
-	saved=memory_used[mempos];
-	if(saved) {
-		((struct comx_channel *)saved->priv)->HW_board_off(saved);
-	}
-	memory_used[mempos]=dev;
-	
-	outb_p(board_segment | COMX_ENABLE_BOARD_MEM | COMX_BOARD_RESET, 
-		dev->base_addr);
-
-	len = 0;
-	COMX_address = (byte *)dev->mem_start;
-	while (fw->len > len) {
-		writeb(fw->data[len++], COMX_address++);
-	}
-
-	len = 0;
-	COMX_address = (byte *)dev->mem_start;
-	while (len != fw->len && readb(COMX_address++) == fw->data[len]) {
-		len++;
-	}
-
-	outb_p(board_segment | COMX_ENABLE_BOARD_MEM, dev->base_addr);
-
-	if (len != fw->len) {
-		printk(KERN_ERR "%s: error loading firmware: [%d] is 0x%02x "
-			"instead of 0x%02x\n", dev->name, len, 
-			readb(COMX_address - 1), fw->data[len]);
-		retval=-EAGAIN;
-		goto out;
-	}
-
-	loopcount=0;
-	while( loopcount++ < 10000 && COMX_readw(dev, OFF_A_L2_LINKUP) != 1 ) {
-		udelay(100);
-	}
-
-	if (COMX_readw(dev, OFF_A_L2_LINKUP) != 1) {
-		printk(KERN_ERR "%s: error starting firmware, linkup word is %04x\n",
-			dev->name, COMX_readw(dev, OFF_A_L2_LINKUP));
-		retval=-EAGAIN;
-		goto out;
-	}
-
-	ch->init_status |= FW_LOADED;
-	retval=0;
-
-out: 
-	outb_p(board_segment | COMX_DISABLE_ALL, dev->base_addr);
-	if(saved) {
-		((struct comx_channel *)saved->priv)->HW_board_on(saved);
-	}
-	memory_used[mempos]=saved;
-	restore_flags(flags);
-	return retval;
-}
-
-static int HICOMX_load_board(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	struct comx_firmware *fw = hw->firmware;
-	word board_segment = dev->mem_start >> 12;
-	int mempos = (dev->mem_start - COMX_MEM_MIN) >> 16;
-	struct net_device *saved;
-	unsigned char id1, id2;
-	unsigned long flags;
-	int retval;
-	int loopcount;
-	int len;
-	word *HICOMX_address;
-	char id = 1;
-
-	if (!fw || !fw->len) {
-		struct comx_channel *twin_ch = ch->twin ? ch->twin->priv : NULL;
-		struct comx_privdata *twin_hw;
-
-		if (!twin_ch || !(twin_hw = twin_ch->HW_privdata)) {
-			return -EAGAIN;
-		}
-
-		if (!(fw = twin_hw->firmware) || !fw->len) {
-			return -EAGAIN;
-		}
-	}
-
-	while (id != 4) {
-		if (inb_p(dev->base_addr + id++) != HICOMX_ID_BYTE) {
-			break;
-		}
-	}
-
-	if (id != 4) {
-		printk(KERN_ERR "%s: can't find HICOMX at 0x%04x, id[%d] = %02x\n",
-			dev->name, (unsigned int)dev->base_addr, id - 1,
-			inb_p(dev->base_addr + id - 1));
-		return -1;	
-	}
-
-	id1 = fw->data[OFF_FW_L1_ID]; 
-	id2 = fw->data[OFF_FW_L1_ID + 1];
-	if (id1 != FW_L1_ID_1 || id2 != FW_L1_ID_2_HICOMX) {
-		printk(KERN_ERR "%s: incorrect firmware, load aborted\n", dev->name);
-		return -EAGAIN;
-	}
-
-	printk(KERN_INFO "%s: Loading HICOMX Layer 1 firmware %s\n", dev->name, 
-		(char *)(fw->data + OFF_FW_L1_ID + 2));
-
-	id1 = fw->data[OFF_FW_L2_ID]; 
-	id2 = fw->data[OFF_FW_L2_ID + 1];
-	if (id1 == FW_L2_ID_1 && (id2 == 0xc0 || id2 == 0xc1 || id2 == 0xc2)) {
-		printk(KERN_INFO "with Layer 2 code %s\n", 
-			(char *)(fw->data + OFF_FW_L2_ID + 2));
-	}
-
-	outb_p(board_segment | HICOMX_BOARD_RESET, dev->base_addr);
-	udelay(10);	
-
-	save_flags(flags); cli();
-	saved=memory_used[mempos];
-	if(saved) {
-		((struct comx_channel *)saved->priv)->HW_board_off(saved);
-	}
-	memory_used[mempos]=dev;
-
-	outb_p(board_segment | HICOMX_ENABLE_BOARD_MEM, dev->base_addr);
-	outb_p(HICOMX_PRG_MEM, dev->base_addr + 1);
-
-	len = 0;
-	HICOMX_address = (word *)dev->mem_start;
-	while (fw->len > len) {
-		writeb(fw->data[len++], HICOMX_address++);
-	}
-
-	len = 0;
-	HICOMX_address = (word *)dev->mem_start;
-	while (len != fw->len && (readw(HICOMX_address++) & 0xff) == fw->data[len]) {
-		len++;
-	}
-
-	if (len != fw->len) {
-		printk(KERN_ERR "%s: error loading firmware: [%d] is 0x%02x "
-			"instead of 0x%02x\n", dev->name, len, 
-			readw(HICOMX_address - 1) & 0xff, fw->data[len]);
-		retval=-EAGAIN;
-		goto out;
-	}
-
-	outb_p(board_segment | HICOMX_BOARD_RESET, dev->base_addr);
-	outb_p(HICOMX_DATA_MEM, dev->base_addr + 1);
-
-	outb_p(board_segment | HICOMX_ENABLE_BOARD_MEM, dev->base_addr);
-
-	loopcount=0;
-	while(loopcount++ < 10000 && COMX_readw(dev, OFF_A_L2_LINKUP) != 1) {
-		udelay(100);
-	}
-
-	if ( COMX_readw(dev, OFF_A_L2_LINKUP) != 1 ) {
-		printk(KERN_ERR "%s: error starting firmware, linkup word is %04x\n",
-			dev->name, COMX_readw(dev, OFF_A_L2_LINKUP));
-		retval=-EAGAIN;
-		goto out;
-	}
-
-	ch->init_status |= FW_LOADED;
-	retval=0;
-
-out:
-	outb_p(board_segment | HICOMX_DISABLE_ALL, dev->base_addr);
-	outb_p(HICOMX_DATA_MEM, dev->base_addr + 1);
-
-	if(saved) {
-		((struct comx_channel *)saved->priv)->HW_board_on(saved);
-	}
-	memory_used[mempos]=saved;
-	restore_flags(flags);
-	return retval;
-}
-
-static struct net_device *comx_twin_check(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct proc_dir_entry *procfile = ch->procdir->parent->subdir;
-	struct comx_privdata *hw = ch->HW_privdata;
-
-	struct net_device *twin;
-	struct comx_channel *ch_twin;
-	struct comx_privdata *hw_twin;
-
-
-	for ( ; procfile ; procfile = procfile->next) {
-	
-		if(!S_ISDIR(procfile->mode)) {
-			continue;
-		}
-	
-		twin=procfile->data;
-		ch_twin=twin->priv;
-		hw_twin=ch_twin->HW_privdata;
-
-
-		if (twin != dev && dev->irq && dev->base_addr && dev->mem_start &&
-		   dev->irq == twin->irq && dev->base_addr == twin->base_addr &&
-	  	   dev->mem_start == twin->mem_start &&
-		   hw->channel == (1 - hw_twin->channel) &&
-		   ch->hardware == ch_twin->hardware) {
-		   	return twin;
-		}
-	}
-	return NULL;
-}
-
-static int comxhw_write_proc(struct file *file, const char *buffer, 
-	u_long count, void *data)
-{
-	struct proc_dir_entry *entry = (struct proc_dir_entry *)data;
-	struct net_device *dev = entry->parent->data;
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	char *page;
-
-
-	if(ch->init_status & HW_OPEN) {
-		return -EAGAIN;	
-	}
-	
-	if (strcmp(FILENAME_FIRMWARE, entry->name) != 0) {
-		if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
-			return -ENOMEM;
-		}
-		if(copy_from_user(page, buffer, count = (min_t(int, count, PAGE_SIZE))))
-		{
-			count = -EFAULT;
-			goto out;
-		}
-		if (page[count-1] == '\n')
-			page[count-1] = '\0';
-		else if (count < PAGE_SIZE)
-			page[count] = '\0';
-		else if (page[count]) {
- 			count = -EINVAL;
-			goto out;
-		}
-		page[count]=0;	/* Null terminate */
-	} else {
-		byte *tmp;
-
-		if (!hw->firmware) {
-			if ((hw->firmware = kmalloc(sizeof(struct comx_firmware), 
-			    GFP_KERNEL)) == NULL) {
-			    	return -ENOMEM;
-			}
-			hw->firmware->len = 0;
-			hw->firmware->data = NULL;
-		}
-		
-		if ((tmp = kmalloc(count + file->f_pos, GFP_KERNEL)) == NULL) {
-			return -ENOMEM;
-		}
-		
-		/* Ha nem 0 a fpos, akkor meglevo file-t irunk. Gyenge trukk. */
-		if (hw->firmware && hw->firmware->len && file->f_pos 
-		    && hw->firmware->len < count + file->f_pos) {
-			memcpy(tmp, hw->firmware->data, hw->firmware->len);
-		}
-		if (hw->firmware->data) {
-			kfree(hw->firmware->data);
-		}
-		if (copy_from_user(tmp + file->f_pos, buffer, count))
-			return -EFAULT;
-		hw->firmware->len = entry->size = file->f_pos + count;
-		hw->firmware->data = tmp;
-		file->f_pos += count;
-		return count;
-	}
-
-	if (strcmp(entry->name, FILENAME_CHANNEL) == 0) {
-		hw->channel = simple_strtoul(page, NULL, 0);
-		if (hw->channel >= MAX_CHANNELNO) {
-			printk(KERN_ERR "Invalid channel number\n");
-			hw->channel = 0;
-		}
-		if ((ch->twin = comx_twin_check(dev)) != NULL) {
-			struct comx_channel *twin_ch = ch->twin->priv;
-			twin_ch->twin = dev;
-		}
-	} else if (strcmp(entry->name, FILENAME_IRQ) == 0) {
-		dev->irq = simple_strtoul(page, NULL, 0);
-		if (dev->irq == 2) {
-			dev->irq = 9;
-		}
-		if (dev->irq < 3 || dev->irq > 15) {
-			printk(KERN_ERR "comxhw: Invalid irq number\n");
-			dev->irq = 0;
-		}
-		if ((ch->twin = comx_twin_check(dev)) != NULL) {
-			struct comx_channel *twin_ch = ch->twin->priv;
-			twin_ch->twin = dev;
-		}
-	} else if (strcmp(entry->name, FILENAME_IO) == 0) {
-		dev->base_addr = simple_strtoul(page, NULL, 0);
-		if ((dev->base_addr & 3) != 0 || dev->base_addr < 0x300 
-		   || dev->base_addr > 0x3fc) {
-			printk(KERN_ERR "Invalid io value\n");
-			dev->base_addr = 0;
-		}
-		if ((ch->twin = comx_twin_check(dev)) != NULL) {
-			struct comx_channel *twin_ch = ch->twin->priv;
-
-			twin_ch->twin = dev;
-		}
-	} else if (strcmp(entry->name, FILENAME_MEMADDR) == 0) {
-		dev->mem_start = simple_strtoul(page, NULL, 0);
-		if (dev->mem_start <= 0xf000 && dev->mem_start >= 0xa000) {
-			dev->mem_start *= 16;
-		}
-		if ((dev->mem_start & 0xfff) != 0 || dev->mem_start < COMX_MEM_MIN
-		    || dev->mem_start + hw->memory_size > COMX_MEM_MAX) {
-			printk(KERN_ERR "Invalid memory page\n");
-			dev->mem_start = 0;
-		}
-		dev->mem_end = dev->mem_start + hw->memory_size;
-		if ((ch->twin = comx_twin_check(dev)) != NULL) {
-			struct comx_channel *twin_ch = ch->twin->priv;
-
-			twin_ch->twin = dev;
-		}
-	} else if (strcmp(entry->name, FILENAME_CLOCK) == 0) {
-		if (strncmp("ext", page, 3) == 0) {
-			hw->clock = 0;
-		} else {
-			int kbps;
-
-			kbps = simple_strtoul(page, NULL, 0);
-			hw->clock = kbps ? COMX_CLOCK_CONST/kbps : 0;
-		}
-	}
-out:
-	free_page((unsigned long)page);
-	return count;
-}
-
-static int comxhw_read_proc(char *page, char **start, off_t off, int count,
-	int *eof, void *data)
-{
-	struct proc_dir_entry *file = (struct proc_dir_entry *)data;
-	struct net_device *dev = file->parent->data;
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-	int len = 0;
-
-
-	if (strcmp(file->name, FILENAME_IO) == 0) {
-		len = sprintf(page, "0x%03x\n", (unsigned int)dev->base_addr);
-	} else if (strcmp(file->name, FILENAME_IRQ) == 0) {
-		len = sprintf(page, "0x%02x\n", dev->irq == 9 ? 2 : dev->irq);
-	} else if (strcmp(file->name, FILENAME_CHANNEL) == 0) {
-		len = sprintf(page, "%01d\n", hw->channel);
-	} else if (strcmp(file->name, FILENAME_MEMADDR) == 0) {
-		len = sprintf(page, "0x%05x\n", (unsigned int)dev->mem_start);
-	} else if (strcmp(file->name, FILENAME_TWIN) == 0) {
-		len = sprintf(page, "%s\n", ch->twin ? ch->twin->name : "none");
-	} else if (strcmp(file->name, FILENAME_CLOCK) == 0) {
-		if (hw->clock) {
-			len = sprintf(page, "%-8d\n", COMX_CLOCK_CONST/hw->clock);
-		} else {
-			len = sprintf(page, "external\n");
-		}
-	} else if (strcmp(file->name, FILENAME_FIRMWARE) == 0) {
-		len = min_t(int, FILE_PAGESIZE,
-			  min_t(int, count, 
-			      hw->firmware ?
-			      (hw->firmware->len - off) : 0));
-		if (len < 0) {
-			len = 0;
-		}
-		*start = hw->firmware ? (hw->firmware->data + off) : NULL;
-		if (off + len >= (hw->firmware ? hw->firmware->len : 0) || len == 0) {
-			*eof = 1;
-		}
-		return len;
-	}	
-
-	if (off >= len) {
-		*eof = 1;
-		return 0;
-	}
-
-	*start = page + off;
-	if (count >= len - off) {
-		*eof = 1;
-	}
-	return min_t(int, count, len - off);
-}
-
-/* Called on echo comx >boardtype */
-static int COMX_init(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw;
-	struct proc_dir_entry *new_file;
-
-	if ((ch->HW_privdata = kmalloc(sizeof(struct comx_privdata), 
-	    GFP_KERNEL)) == NULL) {
-	    	return -ENOMEM;
-	}
-	memset(hw = ch->HW_privdata, 0, sizeof(struct comx_privdata));
-
-	if (ch->hardware == &comx_hw || ch->hardware == &cmx_hw) {
-		hw->memory_size = COMX_MEMORY_SIZE;
-		hw->io_extent = COMX_IO_EXTENT;
-		dev->base_addr = COMX_DEFAULT_IO;
-		dev->irq = COMX_DEFAULT_IRQ;
-		dev->mem_start = COMX_DEFAULT_MEMADDR;
-		dev->mem_end = COMX_DEFAULT_MEMADDR + COMX_MEMORY_SIZE;
-	} else if (ch->hardware == &hicomx_hw) {
-		hw->memory_size = HICOMX_MEMORY_SIZE;
-		hw->io_extent = HICOMX_IO_EXTENT;
-		dev->base_addr = HICOMX_DEFAULT_IO;
-		dev->irq = HICOMX_DEFAULT_IRQ;
-		dev->mem_start = HICOMX_DEFAULT_MEMADDR;
-		dev->mem_end = HICOMX_DEFAULT_MEMADDR + HICOMX_MEMORY_SIZE;
-	} else {
-		printk(KERN_ERR "SERIOUS INTERNAL ERROR in %s, line %d\n", __FILE__, __LINE__);
-	}
-
-	if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, ch->procdir))
-	    == NULL) {
-	    goto cleanup_HW_privdata;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &comxhw_read_proc;
-	new_file->write_proc = &comxhw_write_proc;
-	new_file->size = 6;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, ch->procdir))
-	    == NULL) {
-	    goto cleanup_filename_io;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &comxhw_read_proc;
-	new_file->write_proc = &comxhw_write_proc;
-	new_file->size = 5;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-	    goto cleanup_filename_irq;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &comxhw_read_proc;
-	new_file->write_proc = &comxhw_write_proc;
-	new_file->size = 2;		// Ezt tudjuk
-	new_file->nlink = 1;
-
-	if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw) {
-		if ((new_file = create_proc_entry(FILENAME_CLOCK, S_IFREG | 0644, 
-		   ch->procdir)) == NULL) {
-		    goto cleanup_filename_channel;
-		}
-		new_file->data = (void *)new_file;
-		new_file->read_proc = &comxhw_read_proc;
-		new_file->write_proc = &comxhw_write_proc;
-		new_file->size = 9;
-		new_file->nlink = 1;
-	}
-
-	if ((new_file = create_proc_entry(FILENAME_MEMADDR, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		    goto cleanup_filename_clock;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &comxhw_read_proc;
-	new_file->write_proc = &comxhw_write_proc;
-	new_file->size = 8;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444, 
-	    ch->procdir)) == NULL) {
-		    goto cleanup_filename_memaddr;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &comxhw_read_proc;
-	new_file->write_proc = NULL;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_FIRMWARE, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		    goto cleanup_filename_twin;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &comxhw_read_proc;
-	new_file->write_proc = &comxhw_write_proc;
-	new_file->nlink = 1;
-
-	if (ch->hardware == &comx_hw) {
-		ch->HW_board_on = COMX_board_on;
-		ch->HW_board_off = COMX_board_off;
-		ch->HW_load_board = COMX_load_board;
-	} else if (ch->hardware == &cmx_hw) {
-		ch->HW_board_on = COMX_board_on;
-		ch->HW_board_off = COMX_board_off;
-		ch->HW_load_board = CMX_load_board;
-		ch->HW_set_clock = COMX_set_clock;
-	} else if (ch->hardware == &hicomx_hw) {
-		ch->HW_board_on = HICOMX_board_on;
-		ch->HW_board_off = HICOMX_board_off;
-		ch->HW_load_board = HICOMX_load_board;
-		ch->HW_set_clock = COMX_set_clock;
-	} else {
-		printk(KERN_ERR "SERIOUS INTERNAL ERROR in %s, line %d\n", __FILE__, __LINE__);
-	}
-
-	ch->HW_access_board = COMX_access_board;
-	ch->HW_release_board = COMX_release_board;
-	ch->HW_txe = COMX_txe;
-	ch->HW_open = COMX_open;
-	ch->HW_close = COMX_close;
-	ch->HW_send_packet = COMX_send_packet;
-	ch->HW_statistics = COMX_statistics;
-
-	if ((ch->twin = comx_twin_check(dev)) != NULL) {
-		struct comx_channel *twin_ch = ch->twin->priv;
-
-		twin_ch->twin = dev;
-	}
-
-	MOD_INC_USE_COUNT;
-	return 0;
-
-cleanup_filename_twin:
-	remove_proc_entry(FILENAME_TWIN, ch->procdir);
-cleanup_filename_memaddr:
-	remove_proc_entry(FILENAME_MEMADDR, ch->procdir);
-cleanup_filename_clock:
-	if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw)
-		remove_proc_entry(FILENAME_CLOCK, ch->procdir);
-cleanup_filename_channel:
-	remove_proc_entry(FILENAME_CHANNEL, ch->procdir);
-cleanup_filename_irq:
-	remove_proc_entry(FILENAME_IRQ, ch->procdir);
-cleanup_filename_io:
-	remove_proc_entry(FILENAME_IO, ch->procdir);
-cleanup_HW_privdata:
-	kfree(ch->HW_privdata);
-	return -EIO;
-}
-
-/* Called on echo valami >boardtype */
-static int COMX_exit(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_privdata *hw = ch->HW_privdata;
-
-	if (hw->firmware) {
-		if (hw->firmware->data) kfree(hw->firmware->data);
-		kfree(hw->firmware);
-	} if (ch->twin) {
-		struct comx_channel *twin_ch = ch->twin->priv;
-
-		twin_ch->twin = NULL;
-	}
-	
-	kfree(ch->HW_privdata);
-	remove_proc_entry(FILENAME_IO, ch->procdir);
-	remove_proc_entry(FILENAME_IRQ, ch->procdir);
-	remove_proc_entry(FILENAME_CHANNEL, ch->procdir);
-	remove_proc_entry(FILENAME_MEMADDR, ch->procdir);
-	remove_proc_entry(FILENAME_FIRMWARE, ch->procdir);
-	remove_proc_entry(FILENAME_TWIN, ch->procdir);
-	if (ch->hardware == &hicomx_hw || ch->hardware == &cmx_hw) {
-		remove_proc_entry(FILENAME_CLOCK, ch->procdir);
-	}
-
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static int COMX_dump(struct net_device *dev)
-{
-	printk(KERN_INFO "%s: COMX_dump called, why ?\n", dev->name);
-	return 0;
-}
-
-static struct comx_hardware comx_hw = {
-	"comx",
-	VERSION,
-	COMX_init,
-	COMX_exit,
-	COMX_dump,
-	NULL
-};
-
-static struct comx_hardware cmx_hw = {
-	"cmx",
-	VERSION,
-	COMX_init,
-	COMX_exit,
-	COMX_dump,
-	NULL
-};
-
-static struct comx_hardware hicomx_hw = {
-	"hicomx",
-	VERSION,
-	COMX_init,
-	COMX_exit,
-	COMX_dump,
-	NULL
-};
-
-static int __init comx_hw_comx_init(void)
-{
-	comx_register_hardware(&comx_hw);
-	comx_register_hardware(&cmx_hw);
-	comx_register_hardware(&hicomx_hw);
-	return 0;
-}
-
-static void __exit comx_hw_comx_exit(void)
-{
-	comx_unregister_hardware("comx");
-	comx_unregister_hardware("cmx");
-	comx_unregister_hardware("hicomx");
-}
-
-module_init(comx_hw_comx_init);
-module_exit(comx_hw_comx_exit);
diff -Nru a/drivers/net/wan/comx-hw-locomx.c b/drivers/net/wan/comx-hw-locomx.c
--- a/drivers/net/wan/comx-hw-locomx.c	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,496 +0,0 @@
-/*
- * Hardware driver for the LoCOMX card, using the generic z85230
- * functions
- *
- * Author: Gergely Madarasz <gorgo@itc.hu>
- *
- * Based on skeleton code and old LoCOMX driver by Tivadar Szemethy <tiv@itc.hu> 
- * and the hostess_sv11 driver
- *
- * Contributors:
- * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.14)
- *
- * Copyright (C) 1999 ITConsult-Pro Co. <info@itc.hu>
- *
- * 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.
- *
- * Version 0.10 (99/06/17):
- *		- rewritten for the z85230 layer
- *
- * Version 0.11 (99/06/21):
- *		- some printk's fixed
- *		- get rid of a memory leak (it was impossible though :))
- * 
- * Version 0.12 (99/07/07):
- *		- check CTS for modem lines, not DCD (which is always high
- *		  in case of this board)
- * Version 0.13 (99/07/08):
- *		- Fix the transmitter status check
- *		- Handle the net device statistics better
- * Version 0.14 (00/08/15):
- * 		- resource release on failure at LOCOMX_init
- */
-
-#define VERSION "0.14"
-
-#include <linux/interrupt.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/netdevice.h>
-#include <linux/proc_fs.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-
-#include <asm/types.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-
-#include "comx.h"
-#include "z85230.h"
-
-MODULE_AUTHOR("Gergely Madarasz <gorgo@itc.hu>");
-MODULE_DESCRIPTION("Hardware driver for the LoCOMX board");
-MODULE_LICENSE("GPL");
-
-#define RX_DMA 3
-#define TX_DMA 1
-#define LOCOMX_ID 0x33
-#define LOCOMX_IO_EXTENT 8
-#define LOCOMX_DEFAULT_IO 0x368
-#define LOCOMX_DEFAULT_IRQ 7
-
-u8 z8530_locomx[] = {
-	11,     TCRTxCP,
-	14,     DTRREQ,
-	255
-};
-
-struct locomx_data {
-	int	io_extent;
-	struct	z8530_dev board;
-	struct timer_list status_timer;
-};
-
-static int LOCOMX_txe(struct net_device *dev)
-{
-	struct comx_channel *ch = netdev_priv(dev);
-	struct locomx_data *hw = ch->HW_privdata;
-
-	return (!hw->board.chanA.tx_next_skb);
-}
-
-
-static void locomx_rx(struct z8530_channel *c, struct sk_buff *skb)
-{
-	struct net_device *dev = c->netdevice;
-	struct comx_channel *ch = netdev_priv(dev);
-	
-	if (ch->debug_flags & DEBUG_HW_RX) {
-		comx_debug_skb(dev, skb, "locomx_rx receiving");
-	}
-	ch->LINE_rx(dev,skb);
-}
-
-static int LOCOMX_send_packet(struct net_device *dev, struct sk_buff *skb) 
-{
-	struct comx_channel *ch = netdev_priv(dev);
-	struct locomx_data *hw = ch->HW_privdata;
-
-	if (ch->debug_flags & DEBUG_HW_TX) {
-		comx_debug_bytes(dev, skb->data, skb->len, "LOCOMX_send_packet");
-	}
-
-	if (!(ch->line_status & LINE_UP)) {
-		return FRAME_DROPPED;
-	}
-
-	if(z8530_queue_xmit(&hw->board.chanA,skb)) {
-		printk(KERN_WARNING "%s: FRAME_DROPPED\n",dev->name);
-		return FRAME_DROPPED;
-	}
-
-	if (ch->debug_flags & DEBUG_HW_TX) {
-		comx_debug(dev, "%s: LOCOMX_send_packet was successful\n\n", dev->name);
-	}
-
-	if(!hw->board.chanA.tx_next_skb) {
-		return FRAME_QUEUED;
-	} else {
-		return FRAME_ACCEPTED;
-	}
-}
-
-static void locomx_status_timerfun(unsigned long d)
-{
-	struct net_device *dev = (struct net_device *)d;
-	struct comx_channel *ch = netdev_priv(dev);
-	struct locomx_data *hw = ch->HW_privdata;
-
-	if(!(ch->line_status & LINE_UP) &&
-	    (hw->board.chanA.status & CTS)) {
-		ch->LINE_status(dev, ch->line_status | LINE_UP);
-	}
-	if((ch->line_status & LINE_UP) &&
-	    !(hw->board.chanA.status & CTS)) {
-		ch->LINE_status(dev, ch->line_status & ~LINE_UP);
-	}
-	mod_timer(&hw->status_timer,jiffies + ch->lineup_delay * HZ);
-}
-
-
-static int LOCOMX_open(struct net_device *dev)
-{
-	struct comx_channel *ch = netdev_priv(dev);
-	struct locomx_data *hw = ch->HW_privdata;
-	struct proc_dir_entry *procfile = ch->procdir->subdir;
-	unsigned long flags;
-	int ret;
-
-	if (!dev->base_addr || !dev->irq) {
-		return -ENODEV;
-	}
-
-	if (!request_region(dev->base_addr, hw->io_extent, dev->name)) {
-		return -EAGAIN;
-	}
-
-	hw->board.chanA.ctrlio=dev->base_addr + 5;
-	hw->board.chanA.dataio=dev->base_addr + 7;
-	
-	hw->board.irq=dev->irq;
-	hw->board.chanA.netdevice=dev;
-	hw->board.chanA.dev=&hw->board;
-	hw->board.name=dev->name;
-	hw->board.chanA.txdma=TX_DMA;
-	hw->board.chanA.rxdma=RX_DMA;
-	hw->board.chanA.irqs=&z8530_nop;
-	hw->board.chanB.irqs=&z8530_nop;
-
-	if(request_irq(dev->irq, z8530_interrupt, SA_INTERRUPT, 
-	    dev->name, &hw->board)) {
-		printk(KERN_ERR "%s: unable to obtain irq %d\n", dev->name, 
-			dev->irq);
-		ret=-EAGAIN;
-		goto irq_fail;
-	}
-	if(request_dma(TX_DMA,"LoCOMX (TX)")) {
-		printk(KERN_ERR "%s: unable to obtain TX DMA (DMA channel %d)\n", 
-			dev->name, TX_DMA);
-		ret=-EAGAIN;
-		goto dma1_fail;
-	}
-
-	if(request_dma(RX_DMA,"LoCOMX (RX)")) {
-		printk(KERN_ERR "%s: unable to obtain RX DMA (DMA channel %d)\n", 
-			dev->name, RX_DMA);
-		ret=-EAGAIN;
-		goto dma2_fail;
-	}
-	
-	save_flags(flags); 
-	cli();
-
-	if(z8530_init(&hw->board)!=0)
-	{
-		printk(KERN_ERR "%s: Z8530 device not found.\n",dev->name);
-		ret=-ENODEV;
-		goto z8530_fail;
-	}
-
-	hw->board.chanA.dcdcheck=CTS;
-
-	z8530_channel_load(&hw->board.chanA, z8530_hdlc_kilostream_85230);
-	z8530_channel_load(&hw->board.chanA, z8530_locomx);
-	z8530_channel_load(&hw->board.chanB, z8530_dead_port);
-
-	z8530_describe(&hw->board, "I/O", dev->base_addr);
-
-	if((ret=z8530_sync_dma_open(dev, &hw->board.chanA))!=0) {
-		goto z8530_fail;
-	}
-
-	restore_flags(flags);
-
-
-	hw->board.active=1;
-	hw->board.chanA.rx_function=locomx_rx;
-
-	ch->init_status |= HW_OPEN;
-	if (hw->board.chanA.status & DCD) {
-		ch->line_status |= LINE_UP;
-	} else {
-		ch->line_status &= ~LINE_UP;
-	}
-
-	comx_status(dev, ch->line_status);
-
-	init_timer(&hw->status_timer);
-	hw->status_timer.function=locomx_status_timerfun;
-	hw->status_timer.data=(unsigned long)dev;
-	hw->status_timer.expires=jiffies + ch->lineup_delay * HZ;
-	add_timer(&hw->status_timer);
-
-	for (; procfile ; procfile = procfile->next) {
-		if (strcmp(procfile->name, FILENAME_IO) == 0 ||
-		     strcmp(procfile->name, FILENAME_IRQ) == 0) {
-			procfile->mode = S_IFREG |  0444;
-		}
-	}
-	return 0;
-
-z8530_fail:
-	restore_flags(flags);
-	free_dma(RX_DMA);
-dma2_fail:
-	free_dma(TX_DMA);
-dma1_fail:
-	free_irq(dev->irq, &hw->board);
-irq_fail:
-	release_region(dev->base_addr, hw->io_extent);
-	return ret;
-}
-
-static int LOCOMX_close(struct net_device *dev)
-{
-	struct comx_channel *ch = netdev_priv(dev);
-	struct locomx_data *hw = ch->HW_privdata;
-	struct proc_dir_entry *procfile = ch->procdir->subdir;
-
-	hw->board.chanA.rx_function=z8530_null_rx;
-	netif_stop_queue(dev);
-	z8530_sync_dma_close(dev, &hw->board.chanA);
-
-	z8530_shutdown(&hw->board);
-
-	del_timer(&hw->status_timer);
-	free_dma(RX_DMA);
-	free_dma(TX_DMA);
-	free_irq(dev->irq,&hw->board);
-	release_region(dev->base_addr,8);
-
-	for (; procfile ; procfile = procfile->next) {
-		if (strcmp(procfile->name, FILENAME_IO) == 0 ||
-		    strcmp(procfile->name, FILENAME_IRQ) == 0) {
-			procfile->mode = S_IFREG |  0644;
-		}
-	}
-
-	ch->init_status &= ~HW_OPEN;
-	return 0;
-}
-
-static int LOCOMX_statistics(struct net_device *dev,char *page)
-{
-	int len = 0;
-
-	len += sprintf(page + len, "Hello\n");
-
-	return len;
-}
-
-static int LOCOMX_dump(struct net_device *dev) {
-	printk(KERN_INFO "LOCOMX_dump called\n");
-	return(-1);
-}
-
-static int locomx_read_proc(char *page, char **start, off_t off, int count,
-	int *eof, void *data)
-{
-	struct proc_dir_entry *file = (struct proc_dir_entry *)data;
-	struct net_device *dev = file->parent->data;
-	int len = 0;
-
-	if (strcmp(file->name, FILENAME_IO) == 0) {
-		len = sprintf(page, "0x%x\n", (unsigned int)dev->base_addr);
-	} else if (strcmp(file->name, FILENAME_IRQ) == 0) {
-		len = sprintf(page, "%d\n", (unsigned int)dev->irq);
-	} else {
-		printk(KERN_ERR "hw_read_proc: internal error, filename %s\n", 
-			file->name);
-		return -EBADF;
-	}
-
-	if (off >= len) {
-		*eof = 1;
-		return 0;
-	}
-
-	*start = page + off;
-	if (count >= len - off) {
-		*eof = 1;
-	}
-	return min_t(int, count, len - off);
-}
-
-static int locomx_write_proc(struct file *file, const char *buffer,
-	u_long count, void *data)
-{
-	struct proc_dir_entry *entry = (struct proc_dir_entry *)data;
-	struct net_device *dev = (struct net_device *)entry->parent->data;
-	int val;
-	char *page;
-
-	if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
-		return -ENOMEM;
-	}
-
-	if (copy_from_user(page, buffer, count = min_t(unsigned long, count, PAGE_SIZE))) {
-		free_page((unsigned long)page);
-		return -EBADF;
-	}
-	if (*(page + count - 1) == '\n') {
-		*(page + count - 1) = 0;
-	}
-
-	if (strcmp(entry->name, FILENAME_IO) == 0) {
-		val = simple_strtoul(page, NULL, 0);
-		if (val != 0x360 && val != 0x368 && val != 0x370 && 
-		   val != 0x378) {
-			printk(KERN_ERR "LoCOMX: incorrect io address!\n");	
-		} else {
-			dev->base_addr = val;
-		}
-	} else if (strcmp(entry->name, FILENAME_IRQ) == 0) {
-		val = simple_strtoul(page, NULL, 0);
-		if (val != 3 && val != 4 && val != 5 && val != 6 && val != 7) {
-			printk(KERN_ERR "LoCOMX: incorrect irq value!\n");
-		} else {
-			dev->irq = val;
-		}	
-	} else {
-		printk(KERN_ERR "locomx_write_proc: internal error, filename %s\n", 
-			entry->name);
-		free_page((unsigned long)page);
-		return -EBADF;
-	}
-
-	free_page((unsigned long)page);
-	return count;
-}
-
-
-
-static int LOCOMX_init(struct net_device *dev) 
-{
-	struct comx_channel *ch = netdev_priv(dev);
-	struct locomx_data *hw;
-	struct proc_dir_entry *new_file;
-
-	/* Alloc data for private structure */
-	if ((ch->HW_privdata = kmalloc(sizeof(struct locomx_data), 
-	   GFP_KERNEL)) == NULL) {
-	   	return -ENOMEM;
-	}
-
-	memset(hw = ch->HW_privdata, 0, sizeof(struct locomx_data));
-	hw->io_extent = LOCOMX_IO_EXTENT;
-
-	/* Register /proc files */
-	if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		goto cleanup_HW_privdata;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &locomx_read_proc;
-	new_file->write_proc = &locomx_write_proc;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, 
-	    ch->procdir)) == NULL)  {
-		goto cleanup_filename_io;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &locomx_read_proc;
-	new_file->write_proc = &locomx_write_proc;
-	new_file->nlink = 1;
-
-/* 	No clock yet */
-/*
-	if ((new_file = create_proc_entry(FILENAME_CLOCK, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		return -EIO;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &locomx_read_proc;
-	new_file->write_proc = &locomx_write_proc;
-	new_file->nlink = 1;
-*/
-
-	ch->HW_access_board = NULL;
-	ch->HW_release_board = NULL;
-	ch->HW_txe = LOCOMX_txe;
-	ch->HW_open = LOCOMX_open;
-	ch->HW_close = LOCOMX_close;
-	ch->HW_send_packet = LOCOMX_send_packet;
-	ch->HW_statistics = LOCOMX_statistics;
-	ch->HW_set_clock = NULL;
-
-	ch->current_stats = &hw->board.chanA.stats;
-	memcpy(ch->current_stats, &ch->stats, sizeof(struct net_device_stats));
-
-	dev->base_addr = LOCOMX_DEFAULT_IO;
-	dev->irq = LOCOMX_DEFAULT_IRQ;
-	
-	
-	/* O.K. Count one more user on this module */
-	MOD_INC_USE_COUNT;
-	return 0;
-cleanup_filename_io:
-	remove_proc_entry(FILENAME_IO, ch->procdir);
-cleanup_HW_privdata:
-	kfree(ch->HW_privdata);
-	return -EIO;
-}
-
-
-static int LOCOMX_exit(struct net_device *dev)
-{
-	struct comx_channel *ch = netdev_priv(dev);
-
-	ch->HW_access_board = NULL;
-	ch->HW_release_board = NULL;
-	ch->HW_txe = NULL;
-	ch->HW_open = NULL;
-	ch->HW_close = NULL;
-	ch->HW_send_packet = NULL;
-	ch->HW_statistics = NULL;
-	ch->HW_set_clock = NULL;
-	memcpy(&ch->stats, ch->current_stats, sizeof(struct net_device_stats));
-	ch->current_stats = &ch->stats;
-
-	kfree(ch->HW_privdata);
-
-	remove_proc_entry(FILENAME_IO, ch->procdir);
-	remove_proc_entry(FILENAME_IRQ, ch->procdir);
-//	remove_proc_entry(FILENAME_CLOCK, ch->procdir);
-
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static struct comx_hardware locomx_hw = {
-	"locomx",
-	VERSION,
-	LOCOMX_init, 
-	LOCOMX_exit,
-	LOCOMX_dump,
-	NULL
-};
-	
-static int __init comx_hw_locomx_init(void)
-{
-	comx_register_hardware(&locomx_hw);
-	return 0;
-}
-
-static void __exit comx_hw_locomx_exit(void)
-{
-	comx_unregister_hardware("locomx");
-}
-
-module_init(comx_hw_locomx_init);
-module_exit(comx_hw_locomx_exit);
diff -Nru a/drivers/net/wan/comx-hw-mixcom.c b/drivers/net/wan/comx-hw-mixcom.c
--- a/drivers/net/wan/comx-hw-mixcom.c	Tue Jun 15 22:21:04 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,960 +0,0 @@
-/* 
- * Hardware driver for the MixCom synchronous serial board 
- *
- * Author: Gergely Madarasz <gorgo@itc.hu>
- *
- * based on skeleton driver code and a preliminary hscx driver by 
- * Tivadar Szemethy <tiv@itc.hu>
- *
- * Copyright (C) 1998-1999 ITConsult-Pro Co. <info@itc.hu>
- *
- * Contributors:
- * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.65)
- *
- * 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.
- *
- * Version 0.60 (99/06/11):
- *		- ported to the kernel, now works as builtin code
- *
- * Version 0.61 (99/06/11):
- *		- recognize the one-channel MixCOM card (id byte = 0x13)
- *		- printk fixes
- * 
- * Version 0.62 (99/07/15):
- *		- fixes according to the new hw docs 
- *		- report line status when open
- *
- * Version 0.63 (99/09/21):
- *		- line status report fixes
- *
- * Version 0.64 (99/12/01):
- *		- some more cosmetical fixes
- *
- * Version 0.65 (00/08/15)
- *		- resource release on failure at MIXCOM_init
- */
-
-#define VERSION "0.65"
-
-#include <linux/interrupt.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/netdevice.h>
-#include <linux/proc_fs.h>
-#include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/init.h>
-
-#include <asm/types.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-
-#include "comx.h"
-#include "mixcom.h"
-#include "hscx.h"
-
-MODULE_AUTHOR("Gergely Madarasz <gorgo@itc.hu>");
-MODULE_DESCRIPTION("Hardware-level driver for the serial port of the MixCom board");
-MODULE_LICENSE("GPL");
-
-#define MIXCOM_DATA(d) ((struct mixcom_privdata *)(COMX_CHANNEL(d)-> \
-	HW_privdata))
-
-#define MIXCOM_BOARD_BASE(d) (d->base_addr - MIXCOM_SERIAL_OFFSET - \
-	(1 - MIXCOM_DATA(d)->channel) * MIXCOM_CHANNEL_OFFSET)
-
-#define MIXCOM_DEV_BASE(port,channel) (port + MIXCOM_SERIAL_OFFSET + \
-	(1 - channel) * MIXCOM_CHANNEL_OFFSET)
-
-/* Values used to set the IRQ line */
-static unsigned char mixcom_set_irq[]={0xFF, 0xFF, 0xFF, 0x0, 0xFF, 0x2, 0x4, 0x6, 0xFF, 0xFF, 0x8, 0xA, 0xC, 0xFF, 0xE, 0xFF};
-
-static unsigned char* hscx_versions[]={"A1", NULL, "A2", NULL, "A3", "2.1"};
-
-struct mixcom_privdata {
-	u16	clock;
-	char	channel;
-	long	txbusy;
-	struct sk_buff *sending;
-	unsigned tx_ptr;
-	struct sk_buff *recving;
-	unsigned rx_ptr;
-	unsigned char status;
-	char	card_has_status;
-};
-
-static inline void wr_hscx(struct net_device *dev, int reg, unsigned char val) 
-{
-	outb(val, dev->base_addr + reg);
-}
-
-static inline unsigned char rd_hscx(struct net_device *dev, int reg)
-{
-	return inb(dev->base_addr + reg);
-}
-
-static inline void hscx_cmd(struct net_device *dev, int cmd)
-{
-	unsigned long jiffs = jiffies;
-	unsigned char cec;
-	unsigned delay = 0;
-
-	while ((cec = (rd_hscx(dev, HSCX_STAR) & HSCX_CEC) != 0) && 
-	    time_before(jiffies, jiffs + HZ)) {
-		udelay(1);
-		if (++delay > (100000 / HZ)) break;
-	}
-	if (cec) {
-		printk(KERN_WARNING "%s: CEC stuck, probably no clock!\n",dev->name);
-	} else {
-		wr_hscx(dev, HSCX_CMDR, cmd);
-	}
-}
-
-static inline void hscx_fill_fifo(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-	register word to_send = hw->sending->len - hw->tx_ptr;
-
-
-	outsb(dev->base_addr + HSCX_FIFO,
-        	&(hw->sending->data[hw->tx_ptr]), min_t(unsigned int, to_send, 32));
-	if (to_send <= 32) {
-        	hscx_cmd(dev, HSCX_XTF | HSCX_XME);
-	        kfree_skb(hw->sending);
-        	hw->sending = NULL; 
-        	hw->tx_ptr = 0;
-        } else {
-	        hscx_cmd(dev, HSCX_XTF);
-        	hw->tx_ptr += 32;
-        }
-}
-
-static inline void hscx_empty_fifo(struct net_device *dev, int cnt)
-{
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-
-	if (hw->recving == NULL) {
-        	if (!(hw->recving = dev_alloc_skb(HSCX_MTU + 16))) {
-	                ch->stats.rx_dropped++;
-        	        hscx_cmd(dev, HSCX_RHR);
-                } else {
-	                skb_reserve(hw->recving, 16);
-        	        skb_put(hw->recving, HSCX_MTU);
-                }
-	        hw->rx_ptr = 0;
-        }
-	if (cnt > 32 || !cnt || hw->recving == NULL) {
-        	printk(KERN_ERR "hscx_empty_fifo: cnt is %d, hw->recving %p\n",
-		        cnt, (void *)hw->recving);
-	        return;
-        }
-        
-	insb(dev->base_addr + HSCX_FIFO, &(hw->recving->data[hw->rx_ptr]),cnt);
-	hw->rx_ptr += cnt;
-	hscx_cmd(dev, HSCX_RMC);
-}
-
-
-static int MIXCOM_txe(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-
-	return !test_bit(0, &hw->txbusy);
-}
-
-static int mixcom_probe(struct net_device *dev)
-{
-	unsigned long flags;
-	int id, vstr, ret=0;
-
-	save_flags(flags); cli();
-
-	id=inb_p(MIXCOM_BOARD_BASE(dev) + MIXCOM_ID_OFFSET) & 0x7f;
-
- 	if (id != MIXCOM_ID ) {
-		ret=-ENODEV;
-		printk(KERN_WARNING "%s: no MixCOM board found at 0x%04lx\n",dev->name, dev->base_addr);
-		goto out;
-	}
-
-	vstr=inb_p(dev->base_addr + HSCX_VSTR) & 0x0f;
-	if(vstr>=sizeof(hscx_versions)/sizeof(char*) || 
-	    hscx_versions[vstr]==NULL) {
-		printk(KERN_WARNING "%s: board found but no HSCX chip detected at 0x%4lx (vstr = 0x%1x)\n",dev->name,dev->base_addr,vstr);
-		ret = -ENODEV;
-	} else {
-		printk(KERN_INFO "%s: HSCX chip version %s\n",dev->name,hscx_versions[vstr]);
-		ret = 0;
-	}
-
-out:
-
-	restore_flags(flags);
-	return ret;
-}
-
-#if 0
-static void MIXCOM_set_clock(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-
-	if (hw->clock) {
-		;
-	} else {
-		;
-	}
-}
-#endif
-
-static void mixcom_board_on(struct net_device *dev)
-{
-	outb_p(MIXCOM_OFF , MIXCOM_BOARD_BASE(dev) + MIXCOM_IT_OFFSET);
-	udelay(1000);
-	outb_p(mixcom_set_irq[dev->irq] | MIXCOM_ON, 
-		MIXCOM_BOARD_BASE(dev) + MIXCOM_IT_OFFSET);
-	udelay(1000);
-}
-
-static void mixcom_board_off(struct net_device *dev)
-{
-	outb_p(MIXCOM_OFF , MIXCOM_BOARD_BASE(dev) + MIXCOM_IT_OFFSET);
-	udelay(1000);
-}
-
-static void mixcom_off(struct net_device *dev)
-{
-	wr_hscx(dev, HSCX_CCR1, 0x0);
-}
-
-static void mixcom_on(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-
-	wr_hscx(dev, HSCX_CCR1, HSCX_PU | HSCX_ODS | HSCX_ITF); // power up, push-pull
-	wr_hscx(dev, HSCX_CCR2, HSCX_CIE /* | HSCX_RIE */ );
-	wr_hscx(dev, HSCX_MODE, HSCX_TRANS | HSCX_ADM8 | HSCX_RAC | HSCX_RTS );
-	wr_hscx(dev, HSCX_RLCR, HSCX_RC | 47); // 1504 bytes
-	wr_hscx(dev, HSCX_MASK, HSCX_RSC | HSCX_TIN );
-	hscx_cmd(dev, HSCX_XRES | HSCX_RHR);
-
-	if (ch->HW_set_clock) ch->HW_set_clock(dev);
-
-}
-
-static int MIXCOM_send_packet(struct net_device *dev, struct sk_buff *skb) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-	unsigned long flags;
-
-	if (ch->debug_flags & DEBUG_HW_TX) {
-		comx_debug_bytes(dev, skb->data, skb->len, "MIXCOM_send_packet");
-	}
-
-	if (!(ch->line_status & LINE_UP)) {
-		return FRAME_DROPPED;
-	}
-
-	if (skb->len > HSCX_MTU) {
-		ch->stats.tx_errors++;	
-		return FRAME_ERROR;
-	}
-
-	save_flags(flags); cli();
-
-	if (test_and_set_bit(0, &hw->txbusy)) {
-		printk(KERN_ERR "%s: transmitter called while busy... dropping frame (length %d)\n", dev->name, skb->len);
-		restore_flags(flags);
-		return FRAME_DROPPED;
-	}
-
-
-	hw->sending = skb;
-	hw->tx_ptr = 0;
-	hw->txbusy = 1;
-//	atomic_inc(&skb->users);	// save it
-	hscx_fill_fifo(dev);
-	restore_flags(flags);
-
-	ch->stats.tx_packets++;
-	ch->stats.tx_bytes += skb->len; 
-
-	if (ch->debug_flags & DEBUG_HW_TX) {
-		comx_debug(dev, "MIXCOM_send_packet was successful\n\n");
-	}
-
-	return FRAME_ACCEPTED;
-}
-
-static inline void mixcom_receive_frame(struct net_device *dev) 
-{
-	struct comx_channel *ch=dev->priv;
-	struct mixcom_privdata *hw=ch->HW_privdata;
-	register byte rsta;
-	register word length;
-
-	rsta = rd_hscx(dev, HSCX_RSTA) & (HSCX_VFR | HSCX_RDO | 
-		HSCX_CRC | HSCX_RAB);
-	length = ((rd_hscx(dev, HSCX_RBCH) & 0x0f) << 8) | 
-		rd_hscx(dev, HSCX_RBCL);
-
-	if ( length > hw->rx_ptr ) {
-		hscx_empty_fifo(dev, length - hw->rx_ptr);
-	}
-	
-	if (!(rsta & HSCX_VFR)) {
-		ch->stats.rx_length_errors++;
-	}
-	if (rsta & HSCX_RDO) {
-		ch->stats.rx_over_errors++;
-	}
-	if (!(rsta & HSCX_CRC)) {
-		ch->stats.rx_crc_errors++;
-	}
-	if (rsta & HSCX_RAB) {
-		ch->stats.rx_frame_errors++;
-	}
-	ch->stats.rx_packets++; 
-	ch->stats.rx_bytes += length;
-
-	if (rsta == (HSCX_VFR | HSCX_CRC) && hw->recving) {
-		skb_trim(hw->recving, hw->rx_ptr - 1);
-		if (ch->debug_flags & DEBUG_HW_RX) {
-			comx_debug_skb(dev, hw->recving,
-				"MIXCOM_interrupt receiving");
-		}
-		hw->recving->dev = dev;
-		if (ch->LINE_rx) {
-			ch->LINE_rx(dev, hw->recving);
-		}
-	}
-	else if(hw->recving) {
-		kfree_skb(hw->recving);
-	}
-	hw->recving = NULL; 
-	hw->rx_ptr = 0;
-}
-
-
-static inline void mixcom_extended_interrupt(struct net_device *dev) 
-{
-	struct comx_channel *ch=dev->priv;
-	struct mixcom_privdata *hw=ch->HW_privdata;
-	register byte exir;
-
-	exir = rd_hscx(dev, HSCX_EXIR) & (HSCX_XDU | HSCX_RFO | HSCX_CSC );
-
-	if (exir & HSCX_RFO) {
-		ch->stats.rx_over_errors++;
-		if (hw->rx_ptr) {
-			kfree_skb(hw->recving);
-			hw->recving = NULL; hw->rx_ptr = 0;
-		}
-		printk(KERN_ERR "MIXCOM: rx overrun\n");
-		hscx_cmd(dev, HSCX_RHR);
-	}
-
-	if (exir & HSCX_XDU) { // xmit underrun
-		ch->stats.tx_errors++;
-		ch->stats.tx_aborted_errors++;
-		if (hw->tx_ptr) {
-			kfree_skb(hw->sending);
-			hw->sending = NULL; 
-			hw->tx_ptr = 0;
-		}
-		hscx_cmd(dev, HSCX_XRES);
-		clear_bit(0, &hw->txbusy);
-		if (ch->LINE_tx) {
-			ch->LINE_tx(dev);
-		}
-		printk(KERN_ERR "MIXCOM: tx underrun\n");
-	}
-
-	if (exir & HSCX_CSC) {        
-		ch->stats.tx_carrier_errors++;
-		if ((rd_hscx(dev, HSCX_STAR) & HSCX_CTS) == 0) { // Vonal le
-			if (test_and_clear_bit(0, &ch->lineup_pending)) {
-               			del_timer(&ch->lineup_timer);
-			} else if (ch->line_status & LINE_UP) {
-        		       	ch->line_status &= ~LINE_UP;
-                		if (ch->LINE_status) {
-                      			ch->LINE_status(dev,ch->line_status);
-                      		}
-		      	}
-		}
-		if (!(ch->line_status & LINE_UP) && (rd_hscx(dev, HSCX_STAR) & 
-		    HSCX_CTS)) { // Vonal fol
-			if (!test_and_set_bit(0,&ch->lineup_pending)) {
-				ch->lineup_timer.function = comx_lineup_func;
-	        	        ch->lineup_timer.data = (unsigned long)dev;
-        	        	ch->lineup_timer.expires = jiffies + HZ * 
-        	        		ch->lineup_delay;
-	                	add_timer(&ch->lineup_timer);
-		                hscx_cmd(dev, HSCX_XRES);
-        		        clear_bit(0, &hw->txbusy);
-                		if (hw->sending) {
-					kfree_skb(hw->sending);
-				}
-				hw->sending=NULL;
-				hw->tx_ptr = 0;
-			}
-		}
-	}
-}
-
-
-static irqreturn_t MIXCOM_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-	unsigned long flags;
-	struct net_device *dev = (struct net_device *)dev_id;
-	struct comx_channel *ch, *twin_ch;
-	struct mixcom_privdata *hw, *twin_hw;
-	register unsigned char ista;
-
-	if (dev==NULL) {
-		printk(KERN_ERR "comx_interrupt: irq %d for unknown device\n",irq);
-		return IRQ_NONE;
-	}
-
-	ch = dev->priv; 
-	hw = ch->HW_privdata;
-
-	save_flags(flags); cli(); 
-
-	while((ista = (rd_hscx(dev, HSCX_ISTA) & (HSCX_RME | HSCX_RPF | 
-	    HSCX_XPR | HSCX_EXB | HSCX_EXA | HSCX_ICA)))) {
-		register byte ista2 = 0;
-
-		if (ista & HSCX_RME) {
-			mixcom_receive_frame(dev);
-		}
-		if (ista & HSCX_RPF) {
-			hscx_empty_fifo(dev, 32);
-		}
-		if (ista & HSCX_XPR) {
-			if (hw->tx_ptr) {
-				hscx_fill_fifo(dev);
-			} else {
-				clear_bit(0, &hw->txbusy);
-               			ch->LINE_tx(dev);
-			}
-		}
-		
-		if (ista & HSCX_EXB) {
-			mixcom_extended_interrupt(dev);
-		}
-		
-		if ((ista & HSCX_EXA) && ch->twin)  {
-			mixcom_extended_interrupt(ch->twin);
-		}
-	
-		if ((ista & HSCX_ICA) && ch->twin &&
-		    (ista2 = rd_hscx(ch->twin, HSCX_ISTA) &
-		    (HSCX_RME | HSCX_RPF | HSCX_XPR ))) {
-			if (ista2 & HSCX_RME) {
-				mixcom_receive_frame(ch->twin);
-			}
-			if (ista2 & HSCX_RPF) {
-				hscx_empty_fifo(ch->twin, 32);
-			}
-			if (ista2 & HSCX_XPR) {
-				twin_ch=ch->twin->priv;
-				twin_hw=twin_ch->HW_privdata;
-				if (twin_hw->tx_ptr) {
-					hscx_fill_fifo(ch->twin);
-				} else {
-					clear_bit(0, &twin_hw->txbusy);
-					ch->LINE_tx(ch->twin);
-				}
-			}
-		}
-	}
-
-	restore_flags(flags);
-	return IRQ_HANDLED;
-}
-
-static int MIXCOM_open(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-	struct proc_dir_entry *procfile = ch->procdir->subdir;
-	unsigned long flags; 
-	int ret = -ENODEV;
-
-	if (!dev->base_addr || !dev->irq)
-		goto err_ret;
-
-
-	if(hw->channel==1) {
-		if(!TWIN(dev) || !(COMX_CHANNEL(TWIN(dev))->init_status & 
-		    IRQ_ALLOCATED)) {
-			printk(KERN_ERR "%s: channel 0 not yet initialized\n",dev->name);
-			ret = -EAGAIN;
-			goto err_ret;
-		}
-	}
-
-
-	/* Is our hw present at all ? Not checking for channel 0 if it is already 
-	   open */
-	if(hw->channel!=0 || !(ch->init_status & IRQ_ALLOCATED)) {
-		if (!request_region(dev->base_addr, MIXCOM_IO_EXTENT, dev->name)) {
-			ret = -EAGAIN;
-			goto err_ret;
-		}
-		if (mixcom_probe(dev)) {
-			ret = -ENODEV;
-			goto err_release_region;
-		}
-	}
-
-	if(hw->channel==0 && !(ch->init_status & IRQ_ALLOCATED)) {
-		if (request_irq(dev->irq, MIXCOM_interrupt, 0, 
-		    dev->name, (void *)dev)) {
-			printk(KERN_ERR "MIXCOM: unable to obtain irq %d\n", dev->irq);
-			ret = -EAGAIN;
-			goto err_release_region;
-		}
-	}
-
-	save_flags(flags); cli();
-
-	if(hw->channel==0 && !(ch->init_status & IRQ_ALLOCATED)) {
-		ch->init_status|=IRQ_ALLOCATED;
-		mixcom_board_on(dev);
-	}
-
-	mixcom_on(dev);
-
-
-	hw->status=inb(MIXCOM_BOARD_BASE(dev) + MIXCOM_STATUS_OFFSET);
-	if(hw->status != 0xff) {
-		printk(KERN_DEBUG "%s: board has status register, good\n", dev->name);
-		hw->card_has_status=1;
-	}
-
-	hw->txbusy = 0;
-	ch->init_status |= HW_OPEN;
-	
-	if (rd_hscx(dev, HSCX_STAR) & HSCX_CTS) {
-		ch->line_status |= LINE_UP;
-	} else {
-		ch->line_status &= ~LINE_UP;
-	}
-
-	restore_flags(flags);
-
-	ch->LINE_status(dev, ch->line_status);
-
-	for (; procfile ; procfile = procfile->next) {
-		if (strcmp(procfile->name, FILENAME_IO) == 0 ||
-		    strcmp(procfile->name, FILENAME_CHANNEL) == 0 ||
-		    strcmp(procfile->name, FILENAME_CLOCK) == 0 ||
-		    strcmp(procfile->name, FILENAME_IRQ) == 0) {
-			procfile->mode = S_IFREG |  0444;
-		}
-	}
-
-	return 0;
-	
-err_release_region:
-	release_region(dev->base_addr, MIXCOM_IO_EXTENT);
-err_ret:
-	return ret;
-}
-
-static int MIXCOM_close(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-	struct proc_dir_entry *procfile = ch->procdir->subdir;
-	unsigned long flags;
-
-
-	save_flags(flags); cli();
-
-	mixcom_off(dev);
-
-	/* This is channel 0, twin is not open, we can safely turn off everything */
-	if(hw->channel==0 && (!(TWIN(dev)) || 
-	    !(COMX_CHANNEL(TWIN(dev))->init_status & HW_OPEN))) {
-		mixcom_board_off(dev);
-		free_irq(dev->irq, dev);
-		release_region(dev->base_addr, MIXCOM_IO_EXTENT);
-		ch->init_status &= ~IRQ_ALLOCATED;
-	}
-
-	/* This is channel 1, channel 0 has already been shutdown, we can release
-	   this one too */
-	if(hw->channel==1 && !(COMX_CHANNEL(TWIN(dev))->init_status & HW_OPEN)) {
-		if(COMX_CHANNEL(TWIN(dev))->init_status & IRQ_ALLOCATED) {
-			mixcom_board_off(TWIN(dev));
-			free_irq(TWIN(dev)->irq, TWIN(dev));
-			release_region(TWIN(dev)->base_addr, MIXCOM_IO_EXTENT);
-			COMX_CHANNEL(TWIN(dev))->init_status &= ~IRQ_ALLOCATED;
-		}
-	}
-
-	/* the ioports for channel 1 can be safely released */
-	if(hw->channel==1) {
-		release_region(dev->base_addr, MIXCOM_IO_EXTENT);
-	}
-
-	restore_flags(flags);
-
-	/* If we don't hold any hardware open */
-	if(!(ch->init_status & IRQ_ALLOCATED)) {
-		for (; procfile ; procfile = procfile->next) {
-			if (strcmp(procfile->name, FILENAME_IO) == 0 ||
-			    strcmp(procfile->name, FILENAME_CHANNEL) == 0 ||
-			    strcmp(procfile->name, FILENAME_CLOCK) == 0 ||
-			    strcmp(procfile->name, FILENAME_IRQ) == 0) {
-				procfile->mode = S_IFREG |  0644;
-			}
-		}
-	}
-
-	/* channel 0 was only waiting for us to close channel 1 
-	   close it completely */
-   
-	if(hw->channel==1 && !(COMX_CHANNEL(TWIN(dev))->init_status & HW_OPEN)) {
-		for (procfile=COMX_CHANNEL(TWIN(dev))->procdir->subdir; 
-		    procfile ; procfile = procfile->next) {
-			if (strcmp(procfile->name, FILENAME_IO) == 0 ||
-			    strcmp(procfile->name, FILENAME_CHANNEL) == 0 ||
-			    strcmp(procfile->name, FILENAME_CLOCK) == 0 ||
-			    strcmp(procfile->name, FILENAME_IRQ) == 0) {
-				procfile->mode = S_IFREG |  0644;
-			}
-		}
-	}
-	
-	ch->init_status &= ~HW_OPEN;
-	return 0;
-}
-
-static int MIXCOM_statistics(struct net_device *dev,char *page)
-{
-	struct comx_channel *ch = dev->priv;
-	// struct mixcom_privdata *hw = ch->HW_privdata;
-	int len = 0;
-
-	if(ch->init_status && IRQ_ALLOCATED) {
-		len += sprintf(page + len, "Mixcom board: hardware open\n");
-	}
-
-	return len;
-}
-
-static int MIXCOM_dump(struct net_device *dev) {
-	return 0;
-}
-
-static int mixcom_read_proc(char *page, char **start, off_t off, int count,
-	int *eof, void *data)
-{
-	struct proc_dir_entry *file = (struct proc_dir_entry *)data;
-	struct net_device *dev = file->parent->data;
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-	int len = 0;
-
-	if (strcmp(file->name, FILENAME_IO) == 0) {
-		len = sprintf(page, "0x%x\n", 
-			(unsigned int)MIXCOM_BOARD_BASE(dev));
-	} else if (strcmp(file->name, FILENAME_IRQ) == 0) {
-		len = sprintf(page, "%d\n", (unsigned int)dev->irq);
-	} else if (strcmp(file->name, FILENAME_CLOCK) == 0) {
-		if (hw->clock) len = sprintf(page, "%d\n", hw->clock);
-			else len = sprintf(page, "external\n");
-	} else if (strcmp(file->name, FILENAME_CHANNEL) == 0) {
-		len = sprintf(page, "%01d\n", hw->channel);
-	} else if (strcmp(file->name, FILENAME_TWIN) == 0) {
-		if (ch->twin) {
-			len = sprintf(page, "%s\n",ch->twin->name);
-		} else {
-			len = sprintf(page, "none\n");
-		}
-	} else {
-		printk(KERN_ERR "mixcom_read_proc: internal error, filename %s\n", file->name);
-		return -EBADF;
-	}
-
-	if (off >= len) {
-		*eof = 1;
-		return 0;
-	}
-	*start = page + off;
-	if (count >= len - off) *eof = 1;
-	return min_t(int, count, len - off);
-}
-
-
-static struct net_device *mixcom_twin_check(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct proc_dir_entry *procfile = ch->procdir->parent->subdir;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-
-	struct net_device *twin;
-	struct comx_channel *ch_twin;
-	struct mixcom_privdata *hw_twin;
-
-
-	for ( ; procfile ; procfile = procfile->next) {
-		if(!S_ISDIR(procfile->mode)) continue;
-                
-        	twin = procfile->data;
-	        ch_twin = twin->priv;
-        	hw_twin = ch_twin->HW_privdata;
-
-
-	        if (twin != dev && dev->irq && dev->base_addr && 
-        	    dev->irq == twin->irq && 
-        	    ch->hardware == ch_twin->hardware &&
-		    dev->base_addr == twin->base_addr + 
-		    (1-2*hw->channel)*MIXCOM_CHANNEL_OFFSET &&
-		    hw->channel == (1 - hw_twin->channel)) {
-	        	if  (!TWIN(twin) || TWIN(twin)==dev) {
-	        		return twin;
-	        	}
-		}
-        }
-	return NULL;
-}
-
-
-static void setup_twin(struct net_device* dev) 
-{
-
-	if(TWIN(dev) && TWIN(TWIN(dev))) {
-		TWIN(TWIN(dev))=NULL;
-	}
-	if ((TWIN(dev) = mixcom_twin_check(dev)) != NULL) {
-		if (TWIN(TWIN(dev)) && TWIN(TWIN(dev)) != dev) {
-			TWIN(dev)=NULL;
-		} else {
-			TWIN(TWIN(dev))=dev;
-		}
-	}	
-}
-
-static int mixcom_write_proc(struct file *file, const char *buffer,
-	u_long count, void *data)
-{
-	struct proc_dir_entry *entry = (struct proc_dir_entry *)data;
-	struct net_device *dev = (struct net_device *)entry->parent->data;
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-	char *page;
-	int value;
-
-	if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
-		return -ENOMEM;
-	}
-
-	if (copy_from_user(page, buffer, count = min_t(unsigned long, count, PAGE_SIZE))) {
-		free_page((unsigned long)page);
-		return -EFAULT;
-	}
-	if (*(page + count - 1) == '\n') {
-		*(page + count - 1) = 0;
-	}
-
-	if (strcmp(entry->name, FILENAME_IO) == 0) {
-		value = simple_strtoul(page, NULL, 0);
-		if (value != 0x180 && value != 0x280 && value != 0x380) {
-			printk(KERN_ERR "MIXCOM: incorrect io address!\n");
-		} else {
-			dev->base_addr = MIXCOM_DEV_BASE(value,hw->channel);
-		}
-	} else if (strcmp(entry->name, FILENAME_IRQ) == 0) {
-		value = simple_strtoul(page, NULL, 0); 
-		if (value < 0 || value > 15 || mixcom_set_irq[value]==0xFF) {
-			printk(KERN_ERR "MIXCOM: incorrect irq value!\n");
-		} else {
-			dev->irq = value;	
-		}
-	} else if (strcmp(entry->name, FILENAME_CLOCK) == 0) {
-		if (strncmp("ext", page, 3) == 0) {
-			hw->clock = 0;
-		} else {
-			int kbps;
-
-			kbps = simple_strtoul(page, NULL, 0);
-			if (!kbps) {
-				hw->clock = 0;
-			} else {
-				hw->clock = kbps;
-			}
-			if (hw->clock < 32 || hw->clock > 2000) {
-				hw->clock = 0;
-				printk(KERN_ERR "MIXCOM: invalid clock rate!\n");
-			}
-		}
-		if (ch->init_status & HW_OPEN && ch->HW_set_clock) {
-			ch->HW_set_clock(dev);
-		}
-	} else if (strcmp(entry->name, FILENAME_CHANNEL) == 0) {
-		value = simple_strtoul(page, NULL, 0);
-        	if (value > 2) {
-                	printk(KERN_ERR "Invalid channel number\n");
-	        } else {
-        		dev->base_addr+=(hw->channel - value) * MIXCOM_CHANNEL_OFFSET;
-	        	hw->channel = value;
-		}	        
-	} else {
-		printk(KERN_ERR "hw_read_proc: internal error, filename %s\n", 
-			entry->name);
-		return -EBADF;
-	}
-
-	setup_twin(dev);
-
-	free_page((unsigned long)page);
-	return count;
-}
-
-static int MIXCOM_init(struct net_device *dev) {
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw;
-	struct proc_dir_entry *new_file;
-
-	if ((ch->HW_privdata = kmalloc(sizeof(struct mixcom_privdata), 
-	    GFP_KERNEL)) == NULL) {
-	    	return -ENOMEM;
-	}
-
-	memset(hw = ch->HW_privdata, 0, sizeof(struct mixcom_privdata));
-
-	if ((new_file = create_proc_entry(FILENAME_IO, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		goto cleanup_HW_privdata;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &mixcom_read_proc;
-	new_file->write_proc = &mixcom_write_proc;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-	    	goto cleanup_filename_io;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &mixcom_read_proc;
-	new_file->write_proc = &mixcom_write_proc;
-	new_file->nlink = 1;
-
-#if 0
-	if ((new_file = create_proc_entry(FILENAME_CLOCK, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-	    	return -EIO;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &mixcom_read_proc;
-	new_file->write_proc = &mixcom_write_proc;
-	new_file->nlink = 1;
-#endif
-
-	if ((new_file = create_proc_entry(FILENAME_CHANNEL, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-	    	goto cleanup_filename_irq;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &mixcom_read_proc;
-	new_file->write_proc = &mixcom_write_proc;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444, 
-	    ch->procdir)) == NULL) {
-	    	goto cleanup_filename_channel;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &mixcom_read_proc;
-	new_file->write_proc = &mixcom_write_proc;
-	new_file->nlink = 1;
-
-	setup_twin(dev);
-
-	/* Fill in ch_struct hw specific pointers */
-	ch->HW_access_board = NULL;
-	ch->HW_release_board = NULL;
-	ch->HW_txe = MIXCOM_txe;
-	ch->HW_open = MIXCOM_open;
-	ch->HW_close = MIXCOM_close;
-	ch->HW_send_packet = MIXCOM_send_packet;
-	ch->HW_statistics = MIXCOM_statistics;
-	ch->HW_set_clock = NULL;
-
-	dev->base_addr = MIXCOM_DEV_BASE(MIXCOM_DEFAULT_IO,0);
-	dev->irq = MIXCOM_DEFAULT_IRQ;
-
-	MOD_INC_USE_COUNT;
-	return 0;
-cleanup_filename_channel:
-	remove_proc_entry(FILENAME_CHANNEL, ch->procdir);
-cleanup_filename_irq:
-	remove_proc_entry(FILENAME_IRQ, ch->procdir);
-cleanup_filename_io:
-	remove_proc_entry(FILENAME_IO, ch->procdir);
-cleanup_HW_privdata:
-	kfree(ch->HW_privdata);
-	return -EIO;
-}
-
-static int MIXCOM_exit(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct mixcom_privdata *hw = ch->HW_privdata;
-
-	if(hw->channel==0 && TWIN(dev)) {
-		return -EBUSY;
-	}
-
-	if(hw->channel==1 && TWIN(dev)) {
-		TWIN(TWIN(dev))=NULL;
-	}
-
-	kfree(ch->HW_privdata);
-	remove_proc_entry(FILENAME_IO, ch->procdir);
-	remove_proc_entry(FILENAME_IRQ, ch->procdir);
-#if 0
-	remove_proc_entry(FILENAME_CLOCK, ch->procdir);
-#endif
-	remove_proc_entry(FILENAME_CHANNEL, ch->procdir);
-	remove_proc_entry(FILENAME_TWIN, ch->procdir);
-
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static struct comx_hardware mixcomhw = {
-	"mixcom",
-	VERSION,
-	MIXCOM_init, 
-	MIXCOM_exit,
-	MIXCOM_dump,
-	NULL
-};
-	
-static int __init comx_hw_mixcom_init(void)
-{
-	return comx_register_hardware(&mixcomhw);
-}
-
-static void __exit comx_hw_mixcom_exit(void)
-{
-	comx_unregister_hardware("mixcom");
-}
-
-module_init(comx_hw_mixcom_init);
-module_exit(comx_hw_mixcom_exit);
diff -Nru a/drivers/net/wan/comx-hw-munich.c b/drivers/net/wan/comx-hw-munich.c
--- a/drivers/net/wan/comx-hw-munich.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2854 +0,0 @@
-/*
- * Hardware-level driver for the SliceCOM board for Linux kernels 2.4.X
- *
- * Current maintainer / latest changes: Pasztor Szilard <don@itc.hu>
- *
- * Original author: Bartok Istvan <bartoki@itc.hu>
- * Based on skeleton by Tivadar Szemethy <tiv@itc.hu>
- *
- * 0.51:
- *      - port for 2.4.x
- *	- clean up some code, make it more portable
- *	- busted direct hardware access through mapped memory
- *	- fix a possible race
- *	- prevent procfs buffer overflow
- *
- * 0.50:
- *	- support for the pcicom board, lots of rearrangements
- *	- handle modem status lines
- *
- * 0.50a:
- *	- fix for falc version 1.0
- *
- * 0.50b: T&t
- *	- fix for bad localbus
- */
-
-#define VERSION		"0.51"
-#define VERSIONSTR	"SliceCOM v" VERSION ", 2002/01/07\n"
-
-#include <linux/config.h>
-#include <linux/ctype.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/netdevice.h>
-#include <linux/proc_fs.h>
-#include <linux/ioport.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-
-#include <asm/delay.h>
-#include <asm/types.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-
-#define COMX_NEW
-
-#ifndef COMX_NEW
-#include "../include/comx.h"
-#include "../include/munich32x.h"
-#include "../include/falc-lh.h"
-#else
-#include "comx.h"
-#include "munich32x.h"
-#include "falc-lh.h"
-#endif
-
-MODULE_AUTHOR("Bartok Istvan <bartoki@itc.hu>, Gergely Madarasz <gorgo@itc.hu>, Szilard Pasztor <don@itc.hu>");
-MODULE_DESCRIPTION("Hardware-level driver for the SliceCOM and PciCOM (WelCOM) adapters");
-MODULE_LICENSE("GPL");
-/*
- *	TODO: az ilyenek a comxhw.h -ban szoktak lenni, idovel menjenek majd oda:
- */
-
-#define FILENAME_BOARDNUM	"boardnum"	/* /proc/comx/comx0.1/boardnum          */
-#define FILENAME_TIMESLOTS	"timeslots"	/* /proc/comx/comx0.1/timeslots         */
-#define FILENAME_FRAMING	"framing"	/* /proc/comx/comx0.1/framing           */
-#define FILENAME_LINECODE	"linecode"	/* /proc/comx/comx0.1/linecode          */
-#define FILENAME_CLOCK_SOURCE	"clock_source"	/* /proc/comx/comx0.1/clock_source      */
-#define FILENAME_LOOPBACK	"loopback"	/* /proc/comx/comx0.1/loopback          */
-#define FILENAME_REG		"reg"		/* /proc/comx/comx0.1/reg               */
-#define FILENAME_LBIREG		"lbireg"	/* /proc/comx/comx0.1/lbireg            */
-
-#define SLICECOM_BOARDNUM_DEFAULT	0
-
-#define SLICECOM_FRAMING_CRC4		1
-#define SLICECOM_FRAMING_NO_CRC4	2
-#define SLICECOM_FRAMING_DEFAULT	SLICECOM_FRAMING_CRC4
-
-#define SLICECOM_LINECODE_HDB3		1
-#define SLICECOM_LINECODE_AMI		2
-#define SLICECOM_LINECODE_DEFAULT	SLICECOM_LINECODE_HDB3
-
-#define SLICECOM_CLOCK_SOURCE_LINE	1
-#define SLICECOM_CLOCK_SOURCE_INTERNAL	2
-#define SLICECOM_CLOCK_SOURCE_DEFAULT	SLICECOM_CLOCK_SOURCE_LINE
-
-#define SLICECOM_LOOPBACK_NONE		1
-#define SLICECOM_LOOPBACK_LOCAL		2
-#define SLICECOM_LOOPBACK_REMOTE	3
-#define SLICECOM_LOOPBACK_DEFAULT	SLICECOM_LOOPBACK_NONE
-
-#define MUNICH_VIRT(addr) (void *)(&bar1[addr])
-
-struct slicecom_stringtable
-{
-    char *name;
-    int value;
-};
-
-/* A convention: keep "default" the last not NULL when reading from /proc,
-   "error" is an indication that something went wrong, we have an undefined value */
-
-struct slicecom_stringtable slicecom_framings[] =
-{
-    {"crc4", SLICECOM_FRAMING_CRC4},
-    {"no-crc4", SLICECOM_FRAMING_NO_CRC4},
-    {"default", SLICECOM_FRAMING_DEFAULT},
-    {"error", 0}
-};
-
-struct slicecom_stringtable slicecom_linecodes[] =
-{
-    {"hdb3", SLICECOM_LINECODE_HDB3},
-    {"ami", SLICECOM_LINECODE_AMI},
-    {"default", SLICECOM_LINECODE_DEFAULT},
-    {"error", 0}
-};
-
-struct slicecom_stringtable slicecom_clock_sources[] =
-{
-    {"line", SLICECOM_CLOCK_SOURCE_LINE},
-    {"internal", SLICECOM_CLOCK_SOURCE_INTERNAL},
-    {"default", SLICECOM_CLOCK_SOURCE_DEFAULT},
-    {"error", 0}
-};
-
-struct slicecom_stringtable slicecom_loopbacks[] =
-{
-    {"none", SLICECOM_LOOPBACK_NONE},
-    {"local", SLICECOM_LOOPBACK_LOCAL},
-    {"remote", SLICECOM_LOOPBACK_REMOTE},
-    {"default", SLICECOM_LOOPBACK_DEFAULT},
-    {"error", 0}
-};
-
-/*
- *	Some tunable values...
- *
- *	Note: when tuning values which change the length of text in
- *	/proc/comx/comx[n]/status, keep in mind that it must be shorter then
- *	PAGESIZE !
- */
-
-#define MAX_BOARDS	4	/* ezzel 4 kartya lehet a gepben: 0..3          */
-#define RX_DESC_MAX	8	/* Rx ring size, must be >= 4                   */
-#define TX_DESC_MAX	4	/* Tx ring size, must be >= 2                   */
-				/* a sokkal hosszabb Tx ring mar ronthatja a nem-FIFO packet    */
-				/* schedulerek (fair queueing, stb.) hatekonysagat.             */
-#define MAX_WORK	10	/* TOD: update the info max. ennyi-1 esemenyt dolgoz fel egy interrupt hivasnal */
-
-/*
- *	These are tunable too, but don't touch them without fully understanding what is happening
- */
-
-#define UDELAY		20	/* We wait UDELAY usecs with disabled interrupts before and     */
-				/* after each command to avoid writing into each other's        */
-				/* ccb->action_spec. A _send_packet nem var, mert azt az        */
-				/* _interrupt()-bol is meghivhatja a LINE_tx()                  */
-
-/*
- *	Just to avoid warnings about implicit declarations:
- */
-
-static int MUNICH_close(struct net_device *dev);
-static struct comx_hardware slicecomhw;
-static struct comx_hardware pcicomhw;
-
-static unsigned long flags;
-static spinlock_t mister_lock = SPIN_LOCK_UNLOCKED;
-
-typedef volatile struct		/* Time Slot Assignment */
-{
-    u32 rxfillmask:8,		// ----------------------------+------+
-				//                             |      |
-      rxchannel:5,		// ----------------------+---+ |      |
-      rti:1,			// ---------------------+|   | |      |
-      res2:2,			// -------------------++||   | |      |
-				//                    ||||   | |      |
-      txfillmask:8,		// ----------+------+ ||||   | |      |
-				//           |      | ||||   | |      |
-      txchannel:5,		// ----+---+ |      | ||||   | |      |
-      tti:1,			// ---+|   | |      | ||||   | |      |
-      res1:2;			// -++||   | |      | ||||   | |      |
-				//   3          2          1
-    				//  10987654 32109876 54321098 76543210
-} timeslot_spec_t;
-
-typedef volatile struct		/* Receive Descriptor */
-{
-    u32 zero1:16, no:13, hi:1, hold:1, zero2:1;
-
-    u32 next;
-    u32 data;
-
-    u32 zero3:8, status:8, bno:13, zero4:1, c:1, fe:1;
-} rx_desc_t;
-
-typedef volatile struct		/* Transmit Descriptor */
-{
-    u32 fnum:11, csm:1, no13:1, zero1:2, v110:1, no:13, hi:1, hold:1, fe:1;
-
-    u32 next;
-    u32 data;
-
-} tx_desc_t;
-
-typedef volatile struct		/* Channel Specification */
-{
-    u32 iftf:1, mode:2, fa:1, trv:2, crc:1, inv:1, cs:1, tflag:7, ra:1, ro:1,
-	th:1, ta:1, to:1, ti:1, ri:1, nitbs:1, fit:1, fir:1, re:1, te:1, ch:1,
-	ifc:1, sfe:1, fe2:1;
-
-    u32 frda;
-    u32 ftda;
-
-    u32 itbs:6, zero1:26;
-
-} channel_spec_t;
-
-typedef volatile struct		/* Configuration Control Block */
-{
-    u32 action_spec;
-    u32 reserved1;
-    u32 reserved2;
-    timeslot_spec_t timeslot_spec[32];
-    channel_spec_t channel_spec[32];
-    u32 current_rx_desc[32];
-    u32 current_tx_desc[32];
-    u32 csa;			/* Control Start Address. CSA = *CCBA; CCB = *CSA */
-				/* MUNICH does it like: CCB = *( *CCBA )          */
-} munich_ccb_t;
-
-typedef volatile struct		/* Entry in the interrupt queue */
-{
-    u32 all;
-} munich_intq_t;
-
-#define MUNICH_INTQLEN	63	/* Rx/Tx Interrupt Queue Length
-				   (not the real len, but the TIQL/RIQL value)  */
-#define MUNICH_INTQMAX	( 16*(MUNICH_INTQLEN+1) )	/* Rx/Tx/Periph Interrupt Queue size in munich_intq_t's */
-#define MUNICH_INTQSIZE	( 4*MUNICH_INTQMAX )	/* Rx/Tx/Periph Interrupt Queue size in bytes           */
-
-#define MUNICH_PIQLEN	4	/* Peripheral Interrupt Queue Length. Unlike the RIQL/TIQL, */
-#define MUNICH_PIQMAX	( 4*MUNICH_PIQLEN )	/* PIQL register needs it like this                     */
-#define MUNICH_PIQSIZE	( 4*MUNICH_PIQMAX )
-
-typedef volatile u32 vol_u32;	/* TOD: ezek megszunnek ha atirom readw()/writew()-re - kész */
-typedef volatile u8 vol_u8;
-
-typedef volatile struct		/* counters of E1-errors and errored seconds, see rfc2495 */
-{
-    /* use here only unsigned ints, we depend on it when calculating the sum for the last N intervals */
-
-    unsigned line_code_violations,	/* AMI: bipolar violations, HDB3: hdb3 violations                       */
-      path_code_violations,	/* FAS errors and CRC4 errors                                                   */
-      e_bit_errors,		/* E-Bit Errors (the remote side received from us with CRC4-error) */
-      slip_secs,		/* number of seconds with (receive) Controlled Slip(s)          */
-      fr_loss_secs,		/* number of seconds an Out Of Frame defect was detected                */
-      line_err_secs,		/* number of seconds with one or more Line Code Violations              */
-      degraded_mins,		/* Degraded Minute - the estimated error rate is >1E-6, but <1E-3       */
-      errored_secs,		/* Errored Second - at least one of these happened:
-				   - Path Code Violation
-				   - Out Of Frame defect
-				   - Slip
-				   - receiving AIS
-				   - not incremented during an Unavailable Second                       */
-      bursty_err_secs,		/* Bursty Errored Second: (rfc2495 says it does not apply to E1)
-				   - Path Code Violations >1, but <320
-				   - not a Severely Errored Second
-				   - no AIS
-				   - not incremented during an Unavailabla Second                       */
-      severely_err_secs,	/* Severely Errored Second:
-				   - CRC4: >=832 Path COde Violations || >0 Out Of Frame defects
-				   - noCRC4: >=2048 Line Code Violations
-				   - not incremented during an Unavailable Second                       */
-      unavail_secs;		/* number of Unavailable Seconds. Unavailable state is said after:
-				   - 10 contiguous Severely Errored Seconds
-				   - or RAI || AIS || LOF || LOS 
-				   - (any) loopback has been set                                                */
-
-    /*
-     * we do not strictly comply to the rfc: we do not retroactively reduce errored_secs,
-     * bursty_err_secs, severely_err_secs when 'unavailable state' is reached
-     */
-
-} e1_stats_t;
-
-typedef volatile struct		/* ezek board-adatok, nem lehetnek a slicecom_privdata -ban     */
-{
-    int use_count;		/* num. of interfaces using the board                           */
-    int irq;			/* a kartya irq-ja. belemasoljuk a dev->irq -kba is, de csak hogy       */
-    /* szebb legyen az ifconfig outputja                            */
-    /* ha != 0, az azt jelenti hogy az az irq most nekunk sikeresen */
-    /* le van foglalva                                              */
-    struct pci_dev *pci;	/* a kartya PCI strukturaja. NULL, ha nincs kartya              */
-    u32 *bar1;			/* pci->base_address[0] ioremap()-ed by munich_probe(),         */
-    /* on x86 can be used both as a bus or virtual address.         */
-    /* These are the Munich's registers                             */
-    u8 *lbi;			/* pci->base_address[1] ioremap()-ed by munich_probe(),         */
-    /* this is a 256-byte range, the start of the LBI on the board  */
-    munich_ccb_t *ccb;		/* virtual address of CCB                                       */
-    munich_intq_t *tiq;		/* Tx Interrupt Queue                                           */
-    munich_intq_t *riq;		/* Rx Interrupt Queue                                           */
-    munich_intq_t *piq;		/* Peripheral Interrupt Queue (FALC interrupts arrive here)     */
-    int tiq_ptr,		/* A 'current' helyek a tiq/riq/piq -ban.                       */
-      riq_ptr,			/* amikor feldolgoztam az interruptokat, a legelso ures         */
-      piq_ptr;			/* interrupt_information szora mutatnak.                        */
-    struct net_device *twins[32];	/* MUNICH channel -> network interface assignment       */
-
-    unsigned long lastcheck;	/* When were the Rx rings last checked. Time in jiffies         */
-
-    struct timer_list modemline_timer;
-    char isx21;
-    char lineup;
-    char framing;		/* a beallitasok tarolasa                               */
-    char linecode;
-    char clock_source;
-    char loopback;
-
-    char devname[30];		/* what to show in /proc/interrupts                     */
-    unsigned histogram[MAX_WORK];	/* number of processed events in the interrupt loop     */
-    unsigned stat_pri_races;	/* number of special events, we try to handle them      */
-    unsigned stat_pti_races;
-    unsigned stat_pri_races_missed;	/* when it can not be handled, because of MAX_WORK      */
-    unsigned stat_pti_races_missed;
-
-#define SLICECOM_BOARD_INTERVALS_SIZE	97
-    e1_stats_t intervals[SLICECOM_BOARD_INTERVALS_SIZE];	/* E1 line statistics           */
-    unsigned current_interval;	/* pointer to the current interval                      */
-    unsigned elapsed_seconds;	/* elapsed seconds from the start of the current interval */
-    unsigned ses_seconds;	/* counter of contiguous Severely Errored Seconds       */
-    unsigned is_unavailable;	/* set to 1 after 10 contiguous Severely Errored Seconds */
-    unsigned no_ses_seconds;	/* contiguous Severely Error -free seconds in unavail state */
-
-    unsigned deg_elapsed_seconds;	/* for counting the 'Degraded Mins'                     */
-    unsigned deg_cumulated_errors;
-
-    struct module *owner;	/* pointer to our module to avoid module load races */
-} munich_board_t;
-
-struct slicecom_privdata
-{
-    int busy;			/* transmitter busy - number of packets in the Tx ring  */
-    int channel;		/* Munich logical channel ('channel-group' in Cisco)    */
-    unsigned boardnum;
-    u32 timeslots;		/* i-th bit means i-th timeslot is our                  */
-
-    int tx_ring_hist[TX_DESC_MAX];	/* histogram: number of packets in Tx ring when _send_packet is called  */
-
-    tx_desc_t tx_desc[TX_DESC_MAX];	/* the ring of Tx descriptors                           */
-    u8 tx_data[TX_DESC_MAX][TXBUFFER_SIZE];	/* buffers for data to transmit                 */
-    int tx_desc_ptr;		/* hanyadik descriptornal tartunk a beirassal   */
-    /* ahol ez all, oda irtunk utoljara                     */
-
-    rx_desc_t rx_desc[RX_DESC_MAX];	/* the ring of Rx descriptors                           */
-    u8 rx_data[RX_DESC_MAX][RXBUFFER_SIZE];	/* buffers for received data                            */
-    int rx_desc_ptr;		/* hanyadik descriptornal tartunk az olvasassal */
-
-    int rafutott;
-};
-
-static u32 reg, reg_ertek;	/* why static: don't write stack trash into regs if strtoul() fails */
-static u32 lbireg;
-static u8 lbireg_ertek;		/* why static: don't write stack trash into regs if strtoul() fails */
-
-static munich_board_t slicecom_boards[MAX_BOARDS];
-static munich_board_t pcicom_boards[MAX_BOARDS];
-
-/*
- * Reprogram Idle Channel Registers in the FALC - send special code in not used channels
- * Should be called from the open and close, when the timeslot assignment changes
- */
-
-void rework_idle_channels(struct net_device *dev)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw = ch->HW_privdata;
-    munich_board_t *board = slicecom_boards + hw->boardnum;
-    munich_ccb_t *ccb = board->ccb;
-
-    u8 *lbi = board->lbi;
-    int i, j, tmp;
-
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    for (i = 0; i < 4; i++)
-    {
-	tmp = 0xFF;
-	for (j = 0; j < 8; j++)
-	    if (ccb->timeslot_spec[8 * i + j].tti == 0) tmp ^= (0x80 >> j);
-	writeb(tmp, lbi + 0x30 + i);
-    }
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-}
-
-/*
- * Set PCM framing - /proc/comx/comx0/framing
- */
-
-void slicecom_set_framing(int boardnum, int value)
-{
-    u8 *lbi = slicecom_boards[boardnum].lbi;
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    slicecom_boards[boardnum].framing = value;
-    switch (value)
-    {
-	case SLICECOM_FRAMING_CRC4:
-	    writeb(readb(lbi + FMR1) | 8, lbi + FMR1);
-	    writeb((readb(lbi + FMR2) & 0x3f) | 0x80, lbi + FMR2);
-	    break;
-	case SLICECOM_FRAMING_NO_CRC4:
-	    writeb(readb(lbi + FMR1) & 0xf7, lbi + FMR1);
-	    writeb(readb(lbi + FMR2) & 0x3f, lbi + FMR2);
-	    break;
-	default:
-	    printk("slicecom: board %d: unhandled " FILENAME_FRAMING
-		   " value %d\n", boardnum, value);
-    }
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-}
-
-/*
- * Set PCM linecode - /proc/comx/comx0/linecode
- */
-
-void slicecom_set_linecode(int boardnum, int value)
-{
-    u8 *lbi = slicecom_boards[boardnum].lbi;
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    slicecom_boards[boardnum].linecode = value;
-    switch (value)
-    {
-	case SLICECOM_LINECODE_HDB3:
-	    writeb(readb(lbi + FMR0) | 0xf0, lbi + FMR0);
-	    break;
-	case SLICECOM_LINECODE_AMI:
-	    writeb((readb(lbi + FMR0) & 0x0f) | 0xa0, lbi + FMR0);
-	    break;
-	default:
-	    printk("slicecom: board %d: unhandled " FILENAME_LINECODE
-		   " value %d\n", boardnum, value);
-    }
-    spin_unlock_irqrestore(&mister_lock, flags);
-}
-
-/*
- * Set PCM clock source - /proc/comx/comx0/clock_source
- */
-
-void slicecom_set_clock_source(int boardnum, int value)
-{
-    u8 *lbi = slicecom_boards[boardnum].lbi;
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    slicecom_boards[boardnum].clock_source = value;
-    switch (value)
-    {
-	case SLICECOM_CLOCK_SOURCE_LINE:
-	    writeb(readb(lbi + LIM0) & ~1, lbi + LIM0);
-	    break;
-	case SLICECOM_CLOCK_SOURCE_INTERNAL:
-	    writeb(readb(lbi + LIM0) | 1, lbi + LIM0);
-	    break;
-	default:
-	    printk("slicecom: board %d: unhandled " FILENAME_CLOCK_SOURCE
-		   " value %d\n", boardnum, value);
-    }
-    spin_unlock_irqrestore(&mister_lock, flags);
-}
-
-/*
- * Set loopbacks - /proc/comx/comx0/loopback
- */
-
-void slicecom_set_loopback(int boardnum, int value)
-{
-    u8 *lbi = slicecom_boards[boardnum].lbi;
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    slicecom_boards[boardnum].loopback = value;
-    switch (value)
-    {
-	case SLICECOM_LOOPBACK_NONE:
-	    writeb(readb(lbi + LIM0) & ~2, lbi + LIM0);	/* Local Loop OFF  */
-	    writeb(readb(lbi + LIM1) & ~2, lbi + LIM1);	/* Remote Loop OFF */
-	    break;
-	case SLICECOM_LOOPBACK_LOCAL:
-	    writeb(readb(lbi + LIM1) & ~2, lbi + LIM1);	/* Remote Loop OFF */
-	    writeb(readb(lbi + LIM0) | 2, lbi + LIM0);	/* Local Loop ON   */
-	    break;
-	case SLICECOM_LOOPBACK_REMOTE:
-	    writeb(readb(lbi + LIM0) & ~2, lbi + LIM0);	/* Local Loop OFF  */
-	    writeb(readb(lbi + LIM1) | 2, lbi + LIM1);	/* Remote Loop ON  */
-	    break;
-	default:
-	    printk("slicecom: board %d: unhandled " FILENAME_LOOPBACK
-		   " value %d\n", boardnum, value);
-    }
-    spin_unlock_irqrestore(&mister_lock, flags);
-}
-
-/*
- * Update E1 line status LEDs on the adapter
- */
-
-void slicecom_update_leds(munich_board_t * board)
-{
-    u32 *bar1 = board->bar1;
-    u8 *lbi = board->lbi;
-    u8 frs0;
-    u32 leds;
-    int i;
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    leds = 0;
-    frs0 = readb(lbi + FRS0);	/* FRS0 bits described on page 137 */
-
-    if (!(frs0 & 0xa0))
-    {
-	leds |= 0x2000;		/* Green LED: Input signal seems to be OK, no LOS, no LFA       */
-	if (frs0 & 0x10)
-	    leds |= 0x8000;	/* Red LED: Receiving Remote Alarm                                      */
-    }
-    writel(leds, MUNICH_VIRT(GPDATA));
-
-    if (leds == 0x2000 && !board->lineup)
-    {				/* line up */
-	board->lineup = 1;
-	for (i = 0; i < 32; i++)
-	{
-	    if (board->twins[i] && (board->twins[i]->flags & IFF_RUNNING))
-	    {
-		struct comx_channel *ch = board->twins[i]->priv;
-
-		if (!test_and_set_bit(0, &ch->lineup_pending))
-		{
-		    ch->lineup_timer.function = comx_lineup_func;
-		    ch->lineup_timer.data = (unsigned long)board->twins[i];
-		    ch->lineup_timer.expires = jiffies + HZ * ch->lineup_delay;
-		    add_timer(&ch->lineup_timer);
-		}
-	    }
-	}
-    }
-    else if (leds != 0x2000 && board->lineup)
-    {				/* line down */
-	board->lineup = 0;
-	for (i = 0; i < 32; i++)
-	    if (board->twins[i] && (board->twins[i]->flags & IFF_RUNNING))
-	    {
-		struct comx_channel *ch = board->twins[i]->priv;
-
-		if (test_and_clear_bit(0, &ch->lineup_pending))
-		    del_timer(&ch->lineup_timer);
-		else if (ch->line_status & LINE_UP)
-		{
-		    ch->line_status &= ~LINE_UP;
-		    if (ch->LINE_status)
-			ch->LINE_status(board->twins[i], ch->line_status);
-		}
-	    }
-    }
-    spin_unlock_irqrestore(&mister_lock, flags);
-}
-
-/*
- * This function gets called every second when the FALC issues the interrupt.
- * Hardware counters contain error counts for last 1-second time interval.
- * We add them to the global counters here.
- * Read rfc2495 to understand this.
- */
-
-void slicecom_update_line_counters(munich_board_t * board)
-{
-    e1_stats_t *curr_int = &board->intervals[board->current_interval];
-
-    u8 *lbi = board->lbi;
-
-    unsigned framing_errors, code_violations, path_code_violations, crc4_errors,
-	e_bit_errors;
-    unsigned slip_detected,	/* this one has logical value, not the number of slips! */
-      out_of_frame_defect,	/* logical value        */
-      ais_defect,		/* logical value        */
-      errored_sec, bursty_err_sec, severely_err_sec = 0, failure_sec;
-    u8 isr2, isr3, isr5, frs0;
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    isr2 = readb(lbi + ISR2);	/* ISR0-5 described on page 156     */
-    isr3 = readb(lbi + ISR3);
-    isr5 = readb(lbi + ISR5);
-    frs0 = readb(lbi + FRS0);	/* FRS0 described on page 137       */
-
-    /* Error Events: */
-
-    code_violations = readb(lbi + CVCL) + (readb(lbi + CVCH) << 8);
-    framing_errors = readb(lbi + FECL) + (readb(lbi + FECH) << 8);
-    crc4_errors = readb(lbi + CEC1L) + (readb(lbi + CEC1H) << 8);
-    e_bit_errors = readb(lbi + EBCL) + (readb(lbi + EBCH) << 8);
-    slip_detected = isr3 & (ISR3_RSN | ISR3_RSP);
-
-    path_code_violations = framing_errors + crc4_errors;
-
-    curr_int->line_code_violations += code_violations;
-    curr_int->path_code_violations += path_code_violations;
-    curr_int->e_bit_errors += e_bit_errors;
-
-    /* Performance Defects: */
-
-    /* there was an LFA in the last second, but maybe disappeared: */
-    out_of_frame_defect = (isr2 & ISR2_LFA) || (frs0 & FRS0_LFA);
-
-    /* there was an AIS in the last second, but maybe disappeared: */
-    ais_defect = (isr2 & ISR2_AIS) || (frs0 & FRS0_AIS);
-
-    /* Performance Parameters: */
-
-    if (out_of_frame_defect)
-	curr_int->fr_loss_secs++;
-    if (code_violations)
-	curr_int->line_err_secs++;
-
-    errored_sec = ((board->framing == SLICECOM_FRAMING_NO_CRC4) &&
-		   (code_violations)) || path_code_violations ||
-	out_of_frame_defect || slip_detected || ais_defect;
-
-    bursty_err_sec = !out_of_frame_defect && !ais_defect &&
-	(path_code_violations > 1) && (path_code_violations < 320);
-
-    switch (board->framing)
-    {
-	case SLICECOM_FRAMING_CRC4:
-	    severely_err_sec = out_of_frame_defect ||
-		(path_code_violations >= 832);
-	    break;
-	case SLICECOM_FRAMING_NO_CRC4:
-	    severely_err_sec = (code_violations >= 2048);
-	    break;
-    }
-
-    /*
-     * failure_sec: true if there was a condition leading to a failure
-     * (and leading to unavailable state) in this second:
-     */
-
-    failure_sec = (isr2 & ISR2_RA) || (frs0 & FRS0_RRA)	/* Remote/Far End/Distant Alarm Failure */
-	|| ais_defect || out_of_frame_defect	/* AIS or LOF Failure                           */
-	|| (isr2 & ISR2_LOS) || (frs0 & FRS0_LOS)	/* Loss Of Signal Failure                       */
-	|| (board->loopback != SLICECOM_LOOPBACK_NONE);	/* Loopback has been set                        */
-
-    if (board->is_unavailable)
-    {
-	if (severely_err_sec)
-	    board->no_ses_seconds = 0;
-	else
-	    board->no_ses_seconds++;
-
-	if ((board->no_ses_seconds >= 10) && !failure_sec)
-	{
-	    board->is_unavailable = 0;
-	    board->ses_seconds = 0;
-	    board->no_ses_seconds = 0;
-	}
-    }
-    else
-    {
-	if (severely_err_sec)
-	    board->ses_seconds++;
-	else
-	    board->ses_seconds = 0;
-
-	if ((board->ses_seconds >= 10) || failure_sec)
-	{
-	    board->is_unavailable = 1;
-	    board->ses_seconds = 0;
-	    board->no_ses_seconds = 0;
-	}
-    }
-
-    if (board->is_unavailable)
-	curr_int->unavail_secs++;
-    else
-    {
-	if (slip_detected)
-	    curr_int->slip_secs++;
-	curr_int->errored_secs += errored_sec;
-	curr_int->bursty_err_secs += bursty_err_sec;
-	curr_int->severely_err_secs += severely_err_sec;
-    }
-
-    /* the RFC does not say clearly which errors to count here, we try to count bit errors */
-
-    if (!board->is_unavailable && !severely_err_sec)
-    {
-	board->deg_cumulated_errors += code_violations;
-	board->deg_elapsed_seconds++;
-	if (board->deg_elapsed_seconds >= 60)
-	{
-	    if (board->deg_cumulated_errors >= 123)
-		curr_int->degraded_mins++;
-	    board->deg_cumulated_errors = 0;
-	    board->deg_elapsed_seconds = 0;
-	}
-
-    }
-
-    board->elapsed_seconds++;
-    if (board->elapsed_seconds >= 900)
-    {
-	board->current_interval =
-	    (board->current_interval + 1) % SLICECOM_BOARD_INTERVALS_SIZE;
-	memset((void *)&board->intervals[board->current_interval], 0,
-	       sizeof(e1_stats_t));
-	board->elapsed_seconds = 0;
-    }
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-}
-
-static void pcicom_modemline(unsigned long b)
-{
-    munich_board_t *board = (munich_board_t *) b;
-    struct net_device *dev = board->twins[0];
-    struct comx_channel *ch = netdev_priv(dev);
-    unsigned long regs;
-
-    regs = readl((void *)(&board->bar1[GPDATA]));
-    if ((ch->line_status & LINE_UP) && (regs & 0x0800))
-    {
-	ch->line_status &= ~LINE_UP;
-	board->lineup = 0;
-	if (ch->LINE_status)
-	{
-	    ch->LINE_status(dev, ch->line_status);
-	}
-    }
-
-    if (!(ch->line_status & LINE_UP) && !(regs & 0x0800))
-    {
-	ch->line_status |= LINE_UP;
-	board->lineup = 1;
-	if (ch->LINE_status)
-	{
-	    ch->LINE_status(dev, ch->line_status);
-	}
-    }
-
-    mod_timer((struct timer_list *)&board->modemline_timer, jiffies + HZ);
-}
-
-/* 
- * Is it possible to transmit ?
- * Called (may be called) by the protocol layer 
- */
-
-static int MUNICH_txe(struct net_device *dev)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw = ch->HW_privdata;
-
-    return (hw->busy < TX_DESC_MAX - 1);
-}
-
-/* 
- * Hw probe function. Detects all the boards in the system,
- * and fills up slicecom_boards[] and pcicom_boards[]
- * Returns 0 on success.
- * We do not disable interrupts!
- */
-static int munich_probe(void)
-{
-    struct pci_dev *pci;
-    int boardnum;
-    int slicecom_boardnum;
-    int pcicom_boardnum;
-    u32 *bar1;
-    u8 *lbi;
-    munich_board_t *board;
-
-    for (boardnum = 0; boardnum < MAX_BOARDS; boardnum++)
-    {
-	pcicom_boards[boardnum].pci = 0;
-	pcicom_boards[boardnum].bar1 = 0;
-	pcicom_boards[boardnum].lbi = 0;
-	slicecom_boards[boardnum].pci = 0;
-	slicecom_boards[boardnum].bar1 = 0;
-	slicecom_boards[boardnum].lbi = 0;
-    }
-
-    pci = NULL;
-    board = NULL;
-    slicecom_boardnum = 0;
-    pcicom_boardnum = 0;
-
-    for (boardnum = 0;
-	boardnum < MAX_BOARDS && (pci = pci_find_device(PCI_VENDOR_ID_SIEMENS,
-	PCI_DEVICE_ID_SIEMENS_MUNICH32X, pci)); boardnum++)
-    {
-	if (pci_enable_device(pci))
-	    continue;
-
-	printk("munich_probe: munich chip found, IRQ %d\n", pci->irq);
-
-	bar1 = ioremap_nocache(pci->resource[0].start, 0x100);
-	lbi = ioremap_nocache(pci->resource[1].start, 0x100);
-
-	if (bar1 && lbi)
-	{
-	    pci_write_config_dword(pci, MUNICH_PCI_PCIRES, 0xe0000);
-	    set_current_state(TASK_UNINTERRUPTIBLE);
-	    schedule_timeout(1);
-	    pci_write_config_dword(pci, MUNICH_PCI_PCIRES, 0);
-	    set_current_state(TASK_UNINTERRUPTIBLE);
-	    schedule_timeout(1);
-	    /* check the type of the card */
-	    writel(LREG0_MAGIC, MUNICH_VIRT(LREG0));
-	    writel(LREG1_MAGIC, MUNICH_VIRT(LREG1));
-	    writel(LREG2_MAGIC, MUNICH_VIRT(LREG2));
-	    writel(LREG3_MAGIC, MUNICH_VIRT(LREG3));
-	    writel(LREG4_MAGIC, MUNICH_VIRT(LREG4));
-	    writel(LREG5_MAGIC, MUNICH_VIRT(LREG5));
-	    writel(LCONF_MAGIC2,MUNICH_VIRT(LCONF));	/* enable the DMSM */
-
-	    if ((readb(lbi + VSTR) == 0x13) || (readb(lbi + VSTR) == 0x10))
-	    {
-		board = slicecom_boards + slicecom_boardnum;
-		sprintf((char *)board->devname, "slicecom%d",
-			slicecom_boardnum);
-		board->isx21 = 0;
-		slicecom_boardnum++;
-	    }
-	    else if ((readb(lbi + VSTR) == 0x6) || (readb(lbi + GIS) == 0x6))
-	    {
-		board = pcicom_boards + pcicom_boardnum;
-		sprintf((char *)board->devname, "pcicom%d", pcicom_boardnum);
-		board->isx21 = 1;
-		pcicom_boardnum++;
-	    }
-	    if (board)
-	    {
-		printk("munich_probe: %s board found\n", board->devname);
-		writel(LCONF_MAGIC1, MUNICH_VIRT(LCONF));	/* reset the DMSM */
-		board->pci = pci;
-		board->bar1 = bar1;
-		board->lbi = lbi;
-		board->framing = SLICECOM_FRAMING_DEFAULT;
-		board->linecode = SLICECOM_LINECODE_DEFAULT;
-		board->clock_source = SLICECOM_CLOCK_SOURCE_DEFAULT;
-		board->loopback = SLICECOM_LOOPBACK_DEFAULT;
-		board->owner = THIS_MODULE;
-	    }
-	    else
-	    {
-		printk("munich_probe: Board error, VSTR: %02X\n",
-		       readb(lbi + VSTR));
-		iounmap((void *)bar1);
-		iounmap((void *)lbi);
-	    }
-	}
-	else
-	{
-	    printk("munich_probe: ioremap() failed, not enabling this board!\n");
-	    /* .pci = NULL, so the MUNICH_open will not try to open it            */
-	    if (bar1) iounmap((void *)bar1);
-	    if (lbi) iounmap((void *)lbi);
-	}
-    }
-
-    if (!pci && !boardnum)
-    {
-	printk("munich_probe: no PCI present!\n");
-	return -ENODEV;
-    }
-
-    if (pcicom_boardnum + slicecom_boardnum == 0)
-    {
-	printk
-	    ("munich_probe: Couldn't find any munich board: vendor:device %x:%x not found\n",
-	     PCI_VENDOR_ID_SIEMENS, PCI_DEVICE_ID_SIEMENS_MUNICH32X);
-	return -ENODEV;
-    }
-
-    /* Found some */
-    if (pcicom_boardnum)
-	printk("%d pcicom board(s) found.\n", pcicom_boardnum);
-    if (slicecom_boardnum)
-	printk("%d slicecom board(s) found.\n", slicecom_boardnum);
-
-    return 0;
-}
-
-/* 
- * Reset the hardware. Get called only from within this module if needed.
- */
-#if 0
-static int slicecom_reset(struct net_device *dev)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-
-    printk("slicecom_reset: resetting the hardware\n");
-
-    /* Begin to reset the hardware */
-
-    if (ch->HW_set_clock)
-	ch->HW_set_clock(dev);
-
-    /* And finish it */
-
-    return 0;
-}
-#endif
-
-/* 
- * Transmit a packet. 
- * Called by the protocol layer
- * Return values:	
- *	FRAME_ACCEPTED:	frame is being transmited, transmitter is busy
- *	FRAME_QUEUED:	frame is being transmitted, there's more room in
- *				the transmitter for additional packet(s)
- *	FRAME_ERROR:
- *	FRAME_DROPPED:	there was some error
- */
-
-static int MUNICH_send_packet(struct net_device *dev, struct sk_buff *skb)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw = ch->HW_privdata;
-
-    /* Send it to the debug facility too if needed: */
-
-    if (ch->debug_flags & DEBUG_HW_TX)
-	comx_debug_bytes(dev, skb->data, skb->len, "MUNICH_send_packet");
-
-    /* If the line is inactive, don't accept: */
-
-    /* TODO: atgondolni hogy mi is legyen itt */
-    /* if (!(ch->line_status & LINE_UP)) return FRAME_DROPPED; */
-
-    /* More check, to be sure: */
-
-    if (skb->len > TXBUFFER_SIZE)
-    {
-	ch->stats.tx_errors++;
-	kfree_skb(skb);
-	return FRAME_ERROR;
-    }
-
-    /* Maybe you have to disable irq's while programming the hw: */
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    /* And more check: */
-
-    if (hw->busy >= TX_DESC_MAX - 1)
-    {
-	printk(KERN_ERR
-	       "%s: Transmitter called while busy... dropping frame, busy = %d\n",
-	       dev->name, hw->busy);
-	spin_unlock_irqrestore(&mister_lock, flags);
-	kfree_skb(skb);
-	return FRAME_DROPPED;
-    }
-
-    if (hw->busy >= 0)
-	hw->tx_ring_hist[hw->busy]++;
-    /* DELL: */
-    else
-	printk("slicecom: %s: FATAL: busy = %d\n", dev->name, hw->busy);
-
-//              /* DEL: */
-//      printk("slicecom: %s: _send_packet called, busy = %d\n", dev->name, hw->busy );
-
-    /* Packet can go, update stats: */
-
-    ch->stats.tx_packets++;
-    ch->stats.tx_bytes += skb->len;
-
-    /* Pass the packet to the HW:                   */
-    /* Step forward with the transmit descriptors:  */
-
-    hw->tx_desc_ptr = (hw->tx_desc_ptr + 1) % TX_DESC_MAX;
-
-    memcpy(&(hw->tx_data[hw->tx_desc_ptr][0]), skb->data, skb->len);
-    hw->tx_desc[hw->tx_desc_ptr].no = skb->len;
-
-    /* We don't issue any command, just step with the HOLD bit      */
-
-    hw->tx_desc[hw->tx_desc_ptr].hold = 1;
-    hw->tx_desc[(hw->tx_desc_ptr + TX_DESC_MAX - 1) % TX_DESC_MAX].hold = 0;
-
-#ifdef COMX_NEW
-    dev_kfree_skb(skb);
-#endif
-    /* csomag kerult a Tx ringbe: */
-
-    hw->busy++;
-
-    /* Report it: */
-
-    if (ch->debug_flags & DEBUG_HW_TX)
-	comx_debug(dev, "%s: MUNICH_send_packet was successful\n\n", dev->name);
-
-    if (hw->busy >= TX_DESC_MAX - 1)
-    {
-	spin_unlock_irqrestore(&mister_lock, flags);
-	return FRAME_ACCEPTED;
-    }
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-
-    /* All done */
-
-    return FRAME_QUEUED;
-}
-
-/*
- * Interrupt handler routine.
- * Called by the Linux kernel.
- * BEWARE! The interrupts are enabled on the call!
- */
-static irqreturn_t MUNICH_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-    struct sk_buff *skb;
-    int length;
-    int rx_status;
-    int work;			/* hany esemenyt kezeltem mar le                                */
-    u32 *bar1;
-    u8 *lbi;
-    u32 stat,			/* az esemenyek, amiket a ebben a loop korben le kell meg kezelni       */
-      race_stat = 0,		/* race eseten ebben uzenek magamnak hogy mit kell meg lekezelni        */
-      ack;			/* ezt fogom a vegen a STAT-ba irni, kiveszek belole 1-1 bitet ha       */
-
-    /* az adott dolgot nem kell ack-olni mert volt vele munkam, es  */
-    /* legjobb ha visszaterek ide megegyszer                        */
-    munich_intq_t int_info;
-
-    struct net_device *dev;
-    struct comx_channel *ch;
-    struct slicecom_privdata *hw;
-    munich_board_t *board = (munich_board_t *) dev_id;
-    int channel;
-
-    //      , boardnum = (int)dev_id;
-
-    // board = munich_boards + boardnum;
-    bar1 = board->bar1;
-    lbi = board->lbi;
-
-    //      Do not uncomment this under heavy load! :->
-    //      printk("MUNICH_interrupt: masked STAT=0x%08x, tiq=0x%08x, riq=0x%08x, piq=0x%08x\n", stat, board->tiq[0].all, board->riq[0].all, board->piq[0].all );
-
-    for (work = 0; (stat = (race_stat | (readl(MUNICH_VIRT(STAT)) & ~STAT_NOT_HANDLED_BY_INTERRUPT))) && (work < MAX_WORK - 1); work++)
-    {
-	ack = stat & (STAT_PRI | STAT_PTI | STAT_LBII);
-
-	/* Handle the interrupt information in the Rx queue. We don't really trust      */
-	/* info from this queue, because it can be overflowed, so later check           */
-	/* every Rx ring for received packets. But there are some errors which can't    */
-	/* be counted from the Rx rings, so we parse it.                                        */
-
-	int_info = board->riq[board->riq_ptr];
-	if (int_info.all & 0xF0000000)	/* ha ez nem 0, akkor itt interrupt_info van                    */
-	{
-	    ack &= ~STAT_PRI;	/* don't ack the interrupt, we had some work to do              */
-
-	    channel = PCM_INT_CHANNEL(int_info.all);
-	    dev = board->twins[channel];
-
-	    if (dev == NULL)
-	    {
-		printk
-		    ("MUNICH_interrupt: got an Rx interrupt info for NULL device "
-		     "%s.twins[%d], int_info = 0x%08x\n", board->devname,
-		     channel, int_info.all);
-		goto go_for_next_interrupt;
-	    }
-
-	    ch = netdev_priv(dev);
-	    hw = (struct slicecom_privdata *)ch->HW_privdata;
-
-	    //      printk("Rx STAT=0x%08x int_info=0x%08x rx_desc_ptr=%d rx_desc.status=0x%01x\n",
-	    //              stat, int_info.all, hw->rx_desc_ptr, hw->rx_desc[ hw->rx_desc_ptr ].status );
-
-	    if (int_info.all & PCM_INT_HI)
-		printk("SliceCOM: %s: Host Initiated interrupt\n", dev->name);
-	    if (int_info.all & PCM_INT_IFC)
-		printk("SliceCOM: %s: Idle/Flag Change\n", dev->name);
-	    /* TOD: jo ez az Idle/Flag Change valamire? - azonnal latszik belole hogy mikor ad a masik oldal */
-	    /* TOD: ilyen IT most nem is jon, mert ki van maszkolva az interrupt, biztosan kell ez? */
-
-	    if (int_info.all & PCM_INT_FO)
-		/* Internal buffer (RB) overrun */
-		ch->stats.rx_over_errors++;	/* TOD: Ez azt jelenti hogy a belso RB nem volt hozzaferheto, es ezert kihagyott valamit. De nem csak csomag lehetett, hanem esemeny, stb. is. lasd page 247. Ezzel a 'cat status'-hoz igazodok, de a netdevice.h szerint nem egyertelmu hogy ide ez kellene. Nem lehet hogy rx_missed ? */
-		/* DE: nem gotozok sehova, elvileg jo igy */
-		/* kesobb meg visszaterek az FO-ra, ha packet-FO volt. Keresd a "packet-FO"-t. */
-	    if (int_info.all & PCM_INT_FI)	/* frame received, but we do not trust the int_info queue       */
-		if (int_info.all & PCM_INT_SF)
-		{		/* Short Frame: rovidebb mint a CRC */
-		    /* "rovidebb mint CRC+2byte" vizsgalat a "CRC+2"-nel */
-		    ch->stats.rx_length_errors++;	/* TOD: noveljem? ne noveljem? */
-		    goto go_for_next_interrupt;
-		}
-
-	    go_for_next_interrupt:	/* One step in the interrupt queue */
-	    board->riq[board->riq_ptr].all = 0;	/* megjelolom hogy itt meg nem jart a hw */
-	    board->riq_ptr = (board->riq_ptr + 1) % MUNICH_INTQMAX;
-
-	}
-
-	/* Check every Rx ring for incomed packets: */
-
-	for (channel = 0; channel < 32; channel++)
-	{
-	    dev = board->twins[channel];
-
-	    if (dev != NULL)
-	    {
-		ch = netdev_priv(dev);
-		hw = (struct slicecom_privdata *)ch->HW_privdata;
-
-		rx_status = hw->rx_desc[hw->rx_desc_ptr].status;
-
-		if (!(rx_status & 0x80))	/* mar jart itt a hardver */
-		{
-		    ack &= ~STAT_PRI;	/* Don't ack, we had some work          */
-
-		    /* Ez most egy kicsit zuros, mert itt mar nem latom az int_infot        */
-		    if (rx_status & RX_STATUS_ROF)
-			ch->stats.rx_over_errors++;	/* TOD: 'cat status'-hoz igazodok */
-
-		    if (rx_status & RX_STATUS_RA)
-			/* Abort received or issued on channel  */
-			ch->stats.rx_frame_errors++;	/* or HOLD bit in the descriptor                */
-			/* TOD: 'cat status'-hoz igazodok */
-
-		    if (rx_status & RX_STATUS_LFD)
-		    {		/* Long Frame (longer then MFL in the MODE1) */
-			ch->stats.rx_length_errors++;
-			goto go_for_next_frame;
-		    }
-
-		    if (rx_status & RX_STATUS_NOB)
-		    {		/* Not n*8 bits long frame - frame alignment */
-			ch->stats.rx_frame_errors++;	/* ez viszont nem igazodik a 'cat status'-hoz */
-			goto go_for_next_frame;
-		    }
-
-		    if (rx_status & RX_STATUS_CRCO)
-		    {		/* CRC error */
-			ch->stats.rx_crc_errors++;
-			goto go_for_next_frame;
-		    }
-
-		    if (rx_status & RX_STATUS_SF)
-		    {		/* Short Frame: rovidebb mint CRC+2byte */
-			ch->stats.rx_errors++;	/* The HW does not set PCI_INT_ERR bit for this one, see page 246 */
-			ch->stats.rx_length_errors++;
-			goto go_for_next_frame;
-		    }
-
-		    if (rx_status != 0)
-		    {
-			printk("SliceCOM: %s: unhandled rx_status: 0x%02x\n",
-			       dev->name, rx_status);
-			goto go_for_next_frame;
-		    }
-
-		    /* frame received without errors: */
-
-		    length = hw->rx_desc[hw->rx_desc_ptr].bno;
-		    ch->stats.rx_packets++;	/* Count only 'good' packets */
-		    ch->stats.rx_bytes += length;
-
-		    /* Allocate a larger skb and reserve the heading for efficiency: */
-
-		    if ((skb = dev_alloc_skb(length + 16)) == NULL)
-		    {
-			ch->stats.rx_dropped++;
-			goto go_for_next_frame;
-		    }
-
-		    /* Do bookkeeping: */
-
-		    skb_reserve(skb, 16);
-		    skb_put(skb, length);
-		    skb->dev = dev;
-
-		    /* Now copy the data into the buffer: */
-
-		    memcpy(skb->data, &(hw->rx_data[hw->rx_desc_ptr][0]), length);
-
-		    /* DEL: UGLY HACK!!!! */
-		    if (*((int *)skb->data) == 0x02000000 &&
-			*(((int *)skb->data) + 1) == 0x3580008f)
-		    {
-			printk("%s: swapping hack\n", dev->name);
-			*((int *)skb->data) = 0x3580008f;
-			*(((int *)skb->data) + 1) = 0x02000000;
-		    }
-
-		    if (ch->debug_flags & DEBUG_HW_RX)
-			comx_debug_skb(dev, skb, "MUNICH_interrupt receiving");
-
-		    /* Pass it to the protocol entity: */
-
-		    ch->LINE_rx(dev, skb);
-
-		    go_for_next_frame:
-		    /* DEL: rafutott-e a HOLD bitre -detektalas */
-		    {
-			if( ((rx_desc_t*)phys_to_virt(board->ccb->current_rx_desc[channel]))->hold
-			    && ((rx_desc_t*)phys_to_virt(board->ccb->current_rx_desc[channel]))->status != 0xff)
-			    hw->rafutott++;	/* rafutott: hanyszor volt olyan hogy a current descriptoron HOLD bit volt, es a hw mar befejezte az irast (azaz a hw rafutott a HOLD bitre) */
-		    }
-
-		    //      if( jiffies % 2 )               /* DELL: okozzunk egy kis Rx ring slipet :) */
-		    //      {
-		    /* Step forward with the receive descriptors: */
-		    /* if you change this, change the copy of it below too! Search for: "RxSlip" */
-		    hw->rx_desc[(hw->rx_desc_ptr + RX_DESC_MAX - 1) % RX_DESC_MAX].hold = 1;
-		    hw->rx_desc[hw->rx_desc_ptr].status = 0xFF;	/* megjelolom hogy itt meg nem jart a hw */
-		    hw->rx_desc[(hw->rx_desc_ptr + RX_DESC_MAX - 2) % RX_DESC_MAX].hold = 0;
-		    hw->rx_desc_ptr = (hw->rx_desc_ptr + 1) % RX_DESC_MAX;
-		    //      }
-		}
-	    }
-	}
-
-	stat &= ~STAT_PRI;
-
-//      }
-
-//      if( stat & STAT_PTI )   /* TOD: primko megvalositas: mindig csak egy esemenyt dolgozok fel, */
-	/* es nem torlom a STAT-ot, ezert ujra visszajon ide a rendszer. Amikor */
-	/* jon interrupt, de nincs mit feldolgozni, akkor torlom a STAT-ot.     */
-	/* 'needs a rewrite', de elso megoldasnak jo lesz                       */
-//              {
-	int_info = board->tiq[board->tiq_ptr];
-	if (int_info.all & 0xF0000000)	/* ha ez nem 0, akkor itt interrupt_info van    */
-	{
-	    ack &= ~STAT_PTI;	/* don't ack the interrupt, we had some work to do      */
-
-	    channel = PCM_INT_CHANNEL(int_info.all);
-	    dev = board->twins[channel];
-
-	    if (dev == NULL)
-	    {
-		printk("MUNICH_interrupt: got a Tx interrupt for NULL device "
-		       "%s.twins[%d], int_info = 0x%08x\n",
-		       board->isx21 ? "pcicom" : "slicecom", channel, int_info.all);
-		goto go_for_next_tx_interrupt;
-	    }
-
-	    ch = netdev_priv(dev);
-	    hw = (struct slicecom_privdata *)ch->HW_privdata;
-
-	    //      printk("Tx STAT=0x%08x int_info=0x%08x tiq_ptr=%d\n", stat, int_info.all, board->tiq_ptr );
-
-	    if (int_info.all & PCM_INT_FE2)
-	    {			/* "Tx available"                               */
-		/* do nothing */
-	    }
-	    else if (int_info.all & PCM_INT_FO)
-	    {			/* Internal buffer (RB) overrun */
-		ch->stats.rx_over_errors++;
-	    }
-	    else
-	    {
-		printk("slicecom: %s: unhandled Tx int_info: 0x%08x\n",
-		       dev->name, int_info.all);
-	    }
-
-	    go_for_next_tx_interrupt:
-	    board->tiq[board->tiq_ptr].all = 0;
-	    board->tiq_ptr = (board->tiq_ptr + 1) % MUNICH_INTQMAX;
-	}
-
-	/* Check every Tx ring for incoming packets: */
-
-	for (channel = 0; channel < 32; channel++)
-	{
-	    dev = board->twins[channel];
-
-	    if (dev != NULL)
-	    {
-		int newbusy;
-
-		ch = netdev_priv(dev);
-		hw = (struct slicecom_privdata *)ch->HW_privdata;
-
-		/* We don't trust the "Tx available" info from the TIQ, but check        */
-		/* every ring if there is some free room                                        */
-
-		if (ch->init_status && netif_running(dev))
-		{
-		    newbusy = ( TX_DESC_MAX + (& hw->tx_desc[ hw->tx_desc_ptr ]) -
-			(tx_desc_t*)phys_to_virt(board->ccb->current_tx_desc[ hw->channel ]) ) % TX_DESC_MAX;
-
-		    if(newbusy < 0)
-		    {
-			printk("slicecom: %s: FATAL: fresly computed busy = %d, HW: 0x%p, SW: 0x%p\n",
-			dev->name, newbusy,
-			phys_to_virt(board->ccb->current_tx_desc[hw->channel]),
-			& hw->tx_desc[hw->tx_desc_ptr]);
-		    }
-
-		    /* Fogyott valami a Tx ringbol? */
-
-		    if (newbusy < hw->busy)
-		    {
-			// ack &= ~STAT_PTI;                            /* Don't ack, we had some work  */
-			hw->busy = newbusy;
-			if (ch->LINE_tx)
-			    ch->LINE_tx(dev);	/* Report it to protocol driver */
-		    }
-		    else if (newbusy > hw->busy)
-			printk("slicecom: %s: newbusy > hw->busy, this should not happen!\n", dev->name);
-		}
-	    }
-	}
-	stat &= ~STAT_PTI;
-
-	int_info = board->piq[board->piq_ptr];
-	if (int_info.all & 0xF0000000)	/* ha ez nem 0, akkor itt interrupt_info van            */
-	{
-	    ack &= ~STAT_LBII;	/* don't ack the interrupt, we had some work to do      */
-
-	    /* We do not really use (yet) the interrupt info from this queue, */
-
-	    // printk("slicecom: %s: LBI Interrupt event: %08x\n", board->devname, int_info.all);
-
-	    if (!board->isx21)
-	    {
-		slicecom_update_leds(board);
-		slicecom_update_line_counters(board);
-	    }
-
-	    goto go_for_next_lbi_interrupt;	/* To avoid warning about unused label  */
-
-	    go_for_next_lbi_interrupt:	/* One step in the interrupt queue */
-	    board->piq[board->piq_ptr].all = 0;	/* megjelolom hogy itt meg nem jart a hw        */
-	    board->piq_ptr = (board->piq_ptr + 1) % MUNICH_PIQMAX;
-	}
-	stat &= ~STAT_LBII;
-
-	writel(ack, MUNICH_VIRT(STAT));
-
-	if (stat & STAT_TSPA)
-	{
-	    //      printk("slicecom: %s: PCM TSP Asynchronous\n", board->devname);
-	    writel(STAT_TSPA, MUNICH_VIRT(STAT));
-	    stat &= ~STAT_TSPA;
-	}
-
-	if (stat & STAT_RSPA)
-	{
-	    //      printk("slicecom: %s: PCM RSP Asynchronous\n", board->devname);
-	    writel(STAT_RSPA, MUNICH_VIRT(STAT));
-	    stat &= ~STAT_RSPA;
-	}
-	if (stat)
-	{
-	    printk("MUNICH_interrupt: unhandled interrupt, STAT=0x%08x\n",
-		   stat);
-	    writel(stat, MUNICH_VIRT(STAT));	/* ha valamit megsem kezeltunk le, azert ack-ot kuldunk neki */
-	}
-
-    }
-    board->histogram[work]++;
-
-    /* We can miss these if we reach the MAX_WORK   */
-    /* Count it to see how often it happens         */
-
-    if (race_stat & STAT_PRI)
-	board->stat_pri_races_missed++;
-    if (race_stat & STAT_PTI)
-	board->stat_pti_races_missed++;
-    return IRQ_HANDLED;
-}
-
-/* 
- * Hardware open routine.
- * Called by comx (upper) layer when the user wants to bring up the interface
- * with ifconfig.
- * Initializes hardware, allocates resources etc.
- * Returns 0 on OK, or standard error value on error.
- */
-
-static int MUNICH_open(struct net_device *dev)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw = ch->HW_privdata;
-    struct proc_dir_entry *procfile = ch->procdir->subdir;
-    munich_board_t *board;
-    munich_ccb_t *ccb;
-
-    u32 *bar1;
-    u8 *lbi;
-    u32 stat;
-    unsigned long flags, jiffs;
-
-    int i, channel;
-    u32 timeslots = hw->timeslots;
-
-    board = hw->boardnum + (ch->hardware == &pcicomhw ? pcicom_boards : slicecom_boards);
-
-    bar1 = board->bar1;
-    lbi = board->lbi;
-
-    /* TODO: a timeslotok ellenorzese kell majd ide .. hat, biztos? mar a write_proc-ban is
-       ellenorzom valamennyire.
-       if (!dev->io || !dev->irq) return -ENODEV;
-     */
-
-    if (!board->pci)
-    {
-	printk("MUNICH_open: no %s board with boardnum = %d\n",
-	       ch->hardware->name, hw->boardnum);
-	return -ENODEV;
-    }
-
-    spin_lock_irqsave(&mister_lock, flags);
-    /* lock the section to avoid race with multiple opens and make sure
-       that no interrupts get called while this lock is active */
-
-    if (board->use_count == 0)	/* bring up the board if it was unused                  */
-	/* if fails, frees allocated resources and returns.     */
-	/* TOD: is it safe? nem kellene resetelni a kartyat?    */
-    {
-	printk("MUNICH_open: %s: bringing up board\n", board->devname);
-
-	/* Clean up the board's static struct if messed: */
-
-	for (i = 0; i < 32; i++)
-	    board->twins[i] = NULL;
-	for (i = 0; i < MAX_WORK; i++)
-	    board->histogram[i] = 0;
-
-	board->lineup = 0;
-
-	/* Allocate CCB: */
-        board->ccb = kmalloc(sizeof(munich_ccb_t), GFP_KERNEL);
-	if (board->ccb == NULL)
-	{
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -ENOMEM;
-	}
-	memset((void *)board->ccb, 0, sizeof(munich_ccb_t));
-	board->ccb->csa = virt_to_phys(board->ccb);
-	ccb = board->ccb;
-	for (i = 0; i < 32; i++)
-	{
-	    ccb->timeslot_spec[i].tti = 1;
-	    ccb->timeslot_spec[i].rti = 1;
-	}
-
-	/* Interrupt queues: */
-
-	board->tiq = kmalloc(MUNICH_INTQSIZE, GFP_KERNEL);
-	if (board->tiq == NULL)
-	{
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -ENOMEM;
-	}
-	memset((void *)board->tiq, 0, MUNICH_INTQSIZE);
-
-	board->riq = kmalloc(MUNICH_INTQSIZE, GFP_KERNEL);
-	if (board->riq == NULL)
-	{
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -ENOMEM;
-	}
-	memset((void *)board->riq, 0, MUNICH_INTQSIZE);
-
-	board->piq = kmalloc(MUNICH_PIQSIZE, GFP_KERNEL);
-	if (board->piq == NULL)
-	{
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -ENOMEM;
-	}
-	memset((void *)board->piq, 0, MUNICH_PIQSIZE);
-
-	board->tiq_ptr = 0;
-	board->riq_ptr = 0;
-	board->piq_ptr = 0;
-
-	/* Request irq: */
-
-	board->irq = 0;
-
-	/* (char*) cast to avoid warning about discarding volatile:             */
-	if (request_irq(board->pci->irq, MUNICH_interrupt, 0,
-	    (char *)board->devname, (void *)board))
-	{
-	    printk("MUNICH_open: %s: unable to obtain irq %d\n", board->devname,
-		   board->pci->irq);
-	    /* TOD: free other resources (a sok malloc feljebb)                     */
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -EAGAIN;
-	}
-	board->irq = board->pci->irq;	/* csak akkor legyen != 0, ha tenyleg le van foglalva nekunk */
-
-	/* Programming device: */
-
-	/* Reset the board like a power-on: */
-	/* TOD:
-	   - It is not a real power-on: if a DMA transaction fails with master abort, the board
-	   stays in half-dead state.
-	   - It doesn't reset the FALC line driver */
-
-	pci_write_config_dword(board->pci, MUNICH_PCI_PCIRES, 0xe0000);
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(1);
-	pci_write_config_dword(board->pci, MUNICH_PCI_PCIRES, 0);
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(1);
-
-        writel(virt_to_phys(&ccb->csa), MUNICH_VIRT(CCBA));
-        writel(virt_to_phys( board->tiq ), MUNICH_VIRT(TIQBA));
-        writel(MUNICH_INTQLEN, MUNICH_VIRT(TIQL));
-        writel(virt_to_phys( board->riq ), MUNICH_VIRT(RIQBA));
-        writel(MUNICH_INTQLEN, MUNICH_VIRT(RIQL));
-        writel(virt_to_phys( board->piq ), MUNICH_VIRT(PIQBA));
-        writel(MUNICH_PIQLEN, MUNICH_VIRT(PIQL));
-        
-	/* Put the magic values into the registers: */
-
-	writel(MODE1_MAGIC, MUNICH_VIRT(MODE1));
-	writel(MODE2_MAGIC, MUNICH_VIRT(MODE2));
-
-	writel(LREG0_MAGIC, MUNICH_VIRT(LREG0));
-	writel(LREG1_MAGIC, MUNICH_VIRT(LREG1));
-	writel(LREG2_MAGIC, MUNICH_VIRT(LREG2));
-	writel(LREG3_MAGIC, MUNICH_VIRT(LREG3));
-	writel(LREG4_MAGIC, MUNICH_VIRT(LREG4));
-	writel(LREG5_MAGIC, MUNICH_VIRT(LREG5));
-
-	writel(LCONF_MAGIC1, MUNICH_VIRT(LCONF));	/* reset the DMSM */
-	writel(LCONF_MAGIC2, MUNICH_VIRT(LCONF));	/* enable the DMSM */
-
-	writel(~0, MUNICH_VIRT(TXPOLL));
-	writel(board->isx21 ? 0x1400 : 0xa000, MUNICH_VIRT(GPDIR));
-
-	if (readl(MUNICH_VIRT(STAT))) writel(readl(MUNICH_VIRT(STAT)), MUNICH_VIRT(STAT));
-
-	ccb->action_spec = CCB_ACTIONSPEC_RES | CCB_ACTIONSPEC_IA;
-	writel(CMD_ARPCM, MUNICH_VIRT(CMD));	/* Start the PCM core reset */
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(1);
-
-	stat = 0;		/* Wait for the action to complete max. 1 second */
-	jiffs = jiffies;
-	while (!((stat = readl(MUNICH_VIRT(STAT))) & (STAT_PCMA | STAT_PCMF)) && time_before(jiffies, jiffs + HZ))
-	{
-	    set_current_state(TASK_UNINTERRUPTIBLE);
-	    schedule_timeout(1);
-	}
-
-	if (stat & STAT_PCMF)
-	{
-	    printk(KERN_ERR
-		   "MUNICH_open: %s: Initial ARPCM failed. STAT=0x%08x\n",
-		   board->devname, stat);
-	    writel(readl(MUNICH_VIRT(STAT)) & STAT_PCMF, MUNICH_VIRT(STAT));
-	    free_irq(board->irq, (void *)board);	/* TOD: free other resources too *//* maybe shut down hw? */
-	    board->irq = 0;
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -EAGAIN;
-	}
-	else if (!(stat & STAT_PCMA))
-	{
-	    printk(KERN_ERR
-		   "MUNICH_open: %s: Initial ARPCM timeout. STAT=0x%08x\n",
-		   board->devname, stat);
-	    free_irq(board->irq, (void *)board);	/* TOD: free other resources too *//* maybe shut off the hw? */
-	    board->irq = 0;
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -EIO;
-	}
-
-	writel(readl(MUNICH_VIRT(STAT)) & STAT_PCMA, MUNICH_VIRT(STAT));	/* Acknowledge */
-
-	if (board->isx21) writel(0, MUNICH_VIRT(GPDATA));
-
-	printk("MUNICH_open: %s: succesful HW-open took %ld jiffies\n",
-	       board->devname, jiffies - jiffs);
-
-	/* Set up the FALC hanging on the Local Bus: */
-
-	if (!board->isx21)
-	{
-	    writeb(0x0e, lbi + FMR1);
-	    writeb(0, lbi + LIM0);
-	    writeb(0xb0, lbi + LIM1);	/* TODO: input threshold */
-	    writeb(0xf7, lbi + XPM0);
-	    writeb(0x02, lbi + XPM1);
-	    writeb(0x00, lbi + XPM2);
-	    writeb(0xf0, lbi + FMR0);
-	    writeb(0x80, lbi + PCD);
-	    writeb(0x80, lbi + PCR);
-	    writeb(0x00, lbi + LIM2);
-	    writeb(0x07, lbi + XC0);
-	    writeb(0x3d, lbi + XC1);
-	    writeb(0x05, lbi + RC0);
-	    writeb(0x00, lbi + RC1);
-	    writeb(0x83, lbi + FMR2);
-	    writeb(0x9f, lbi + XSW);
-	    writeb(0x0f, lbi + XSP);
-	    writeb(0x00, lbi + TSWM);
-	    writeb(0xe0, lbi + MODE);
-	    writeb(0xff, lbi + IDLE);	/* Idle Code to send in unused timeslots        */
-	    writeb(0x83, lbi + IPC);	/* interrupt query line mode: Push/pull output, active high     */
-	    writeb(0xbf, lbi + IMR3);	/* send an interrupt every second               */
-
-	    slicecom_set_framing(hw->boardnum, board->framing);
-	    slicecom_set_linecode(hw->boardnum, board->linecode);
-	    slicecom_set_clock_source(hw->boardnum, board->clock_source);
-	    slicecom_set_loopback(hw->boardnum, board->loopback);
-
-	    memset((void *)board->intervals, 0, sizeof(board->intervals));
-	    board->current_interval = 0;
-	    board->elapsed_seconds = 0;
-	    board->ses_seconds = 0;
-	    board->is_unavailable = 0;
-	    board->no_ses_seconds = 0;
-	    board->deg_elapsed_seconds = 0;
-	    board->deg_cumulated_errors = 0;
-	}
-
-	/* Enable the interrupts last                                                   */
-	/* These interrupts will be enabled. We do not need the others. */
-
-	writel(readl(MUNICH_VIRT(IMASK)) & ~(STAT_PTI | STAT_PRI | STAT_LBII | STAT_TSPA | STAT_RSPA), MUNICH_VIRT(IMASK));
-    }
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-
-    dev->irq = board->irq;	/* hogy szep legyen az ifconfig outputja */
-    ccb = board->ccb;		/* TODO: ez igy csunya egy kicsit hogy benn is meg kinn is beletoltom :( */
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    set_current_state(TASK_UNINTERRUPTIBLE);
-    schedule_timeout(1);
-
-    /* Check if the selected timeslots aren't used already */
-
-    for (i = 0; i < 32; i++)
-	if (((1 << i) & timeslots) && !ccb->timeslot_spec[i].tti)
-	{
-	    printk("MUNICH_open: %s: timeslot %d already used by %s\n",
-		   dev->name, i, board->twins[ccb->timeslot_spec[i].txchannel]->name);
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -EBUSY;	/* TODO: lehet hogy valami mas errno kellene? */
-	}
-
-    /* find a free channel: */
-    /* TODO: ugly, rewrite it  */
-
-    for (channel = 0; channel <= 32; channel++)
-    {
-	if (channel == 32)
-	{			/* not found a free one */
-	    printk
-		("MUNICH_open: %s: FATAL: can not find a free channel - this should not happen!\n",
-		 dev->name);
-	    spin_unlock_irqrestore(&mister_lock, flags);
-	    return -ENODEV;
-	}
-	if (board->twins[channel] == NULL)
-	    break;		/* found the first free one */
-    }
-
-    board->lastcheck = jiffies;	/* avoid checking uninitialized hardware channel */
-
-    /* Open the channel. If fails, calls MUNICH_close() to properly free resources and stop the HW */
-
-    hw->channel = channel;
-    board->twins[channel] = dev;
-
-    board->use_count++;		/* meg nem nyitottuk meg a csatornat, de a twins-ben
-				   mar elfoglaltunk egyet, es ha a _close-t akarjuk hivni, akkor ez kell. */
-    for (i = 0; i < 32; i++)
-	if ((1 << i) & timeslots)
-	{
-	    ccb->timeslot_spec[i].tti = 0;
-	    ccb->timeslot_spec[i].txchannel = channel;
-	    ccb->timeslot_spec[i].txfillmask = ~0;
-
-	    ccb->timeslot_spec[i].rti = 0;
-	    ccb->timeslot_spec[i].rxchannel = channel;
-	    ccb->timeslot_spec[i].rxfillmask = ~0;
-	}
-
-    if (!board->isx21) rework_idle_channels(dev);
-
-    memset((void *)&(hw->tx_desc), 0, TX_DESC_MAX * sizeof(tx_desc_t));
-    memset((void *)&(hw->rx_desc), 0, RX_DESC_MAX * sizeof(rx_desc_t));
-
-    for (i = 0; i < TX_DESC_MAX; i++)
-    {
-	hw->tx_desc[i].fe = 1;
-	hw->tx_desc[i].fnum = 2;
-                hw->tx_desc[i].data     = virt_to_phys( & (hw->tx_data[i][0]) );
-                hw->tx_desc[i].next     = virt_to_phys( & (hw->tx_desc[ (i+1) % TX_DESC_MAX ]) );
-
-    }
-    hw->tx_desc_ptr = 0;	/* we will send an initial packet so it is correct: "oda irtunk utoljara" */
-    hw->busy = 0;
-    hw->tx_desc[hw->tx_desc_ptr].hold = 1;
-    hw->tx_desc[hw->tx_desc_ptr].no = 1;	/* TOD: inkabb csak 0 hosszut kuldjunk ki az initkor? */
-
-    for (i = 0; i < RX_DESC_MAX; i++)
-    {
-	hw->rx_desc[i].no = RXBUFFER_SIZE;
-	hw->rx_desc[i].data = virt_to_phys(&(hw->rx_data[i][0]));
-	hw->rx_desc[i].next = virt_to_phys(&(hw->rx_desc[(i+1) % RX_DESC_MAX]));
-	hw->rx_desc[i].status = 0xFF;
-    }
-    hw->rx_desc_ptr = 0;
-
-    hw->rx_desc[(hw->rx_desc_ptr + RX_DESC_MAX - 2) % RX_DESC_MAX].hold = 1;
-
-    memset((void *)&ccb->channel_spec[channel], 0, sizeof(channel_spec_t));
-
-    ccb->channel_spec[channel].ti = 0;	/* Transmit off */
-    ccb->channel_spec[channel].to = 1;
-    ccb->channel_spec[channel].ta = 0;
-
-    ccb->channel_spec[channel].th = 1;	/* Transmit hold        */
-
-    ccb->channel_spec[channel].ri = 0;	/* Receive off  */
-    ccb->channel_spec[channel].ro = 1;
-    ccb->channel_spec[channel].ra = 0;
-
-    ccb->channel_spec[channel].mode = 3;	/* HDLC */
-
-    ccb->action_spec = CCB_ACTIONSPEC_IN | (channel << 8);
-    writel(CMD_ARPCM, MUNICH_VIRT(CMD));
-    set_current_state(TASK_UNINTERRUPTIBLE);
-    schedule_timeout(1);
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-
-    stat = 0;
-    jiffs = jiffies;
-    while (!((stat = readl(MUNICH_VIRT(STAT))) & (STAT_PCMA | STAT_PCMF)) && time_before(jiffies, jiffs + HZ))
-    {
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(1);
-    }
-
-    if (stat & STAT_PCMF)
-    {
-	printk(KERN_ERR "MUNICH_open: %s: %s channel %d off failed\n",
-	       dev->name, board->devname, channel);
-	writel(readl(MUNICH_VIRT(STAT)) & STAT_PCMF, MUNICH_VIRT(STAT));
-	MUNICH_close(dev);
-	return -EAGAIN;
-    }
-    else if (!(stat & STAT_PCMA))
-    {
-	printk(KERN_ERR "MUNICH_open: %s: %s channel %d off timeout\n",
-	       dev->name, board->devname, channel);
-	MUNICH_close(dev);
-	return -EIO;
-    }
-
-    writel(readl(MUNICH_VIRT(STAT)) & STAT_PCMA, MUNICH_VIRT(STAT));
-    //      printk("MUNICH_open: %s: succesful channel off took %ld jiffies\n", board->devname, jiffies-jiffs);
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    set_current_state(TASK_UNINTERRUPTIBLE);
-    schedule_timeout(1);
-
-    ccb->channel_spec[channel].ifc = 1;	/* 1 .. 'Idle/Flag change' interrupt letiltva   */
-    ccb->channel_spec[channel].fit = 1;
-    ccb->channel_spec[channel].nitbs = 1;
-    ccb->channel_spec[channel].itbs = 2;
-
-    /* TODOO: lehet hogy jo lenne igy, de utana kellene nezni hogy nem okoz-e fragmentaciot */
-    //      ccb->channel_spec[channel].itbs = 2 * number_of_timeslots;
-    //      printk("open: %s: number_of_timeslots: %d\n", dev->name, number_of_timeslots);
-
-    ccb->channel_spec[channel].mode = 3;	/* HDLC */
-    ccb->channel_spec[channel].ftda = virt_to_phys(&(hw->tx_desc));
-    ccb->channel_spec[channel].frda = virt_to_phys(&(hw->rx_desc[0]));
-
-    ccb->channel_spec[channel].ti = 1;	/* Transmit init        */
-    ccb->channel_spec[channel].to = 0;
-    ccb->channel_spec[channel].ta = 1;
-
-    ccb->channel_spec[channel].th = 0;
-
-    ccb->channel_spec[channel].ri = 1;	/* Receive init */
-    ccb->channel_spec[channel].ro = 0;
-    ccb->channel_spec[channel].ra = 1;
-
-    ccb->action_spec = CCB_ACTIONSPEC_ICO | (channel << 8);
-    writel(CMD_ARPCM, MUNICH_VIRT(CMD));	/* Start the channel init */
-    set_current_state(TASK_UNINTERRUPTIBLE);
-    schedule_timeout(1);
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-
-    stat = 0;			/* Wait for the action to complete max. 1 second */
-    jiffs = jiffies;
-    while (!((stat = readl(MUNICH_VIRT(STAT))) & (STAT_PCMA | STAT_PCMF)) && time_before(jiffies, jiffs + HZ))
-    {
-	set_current_state(TASK_UNINTERRUPTIBLE);
-        schedule_timeout(1);
-    }
-
-    if (stat & STAT_PCMF)
-    {
-	printk(KERN_ERR "MUNICH_open: %s: channel open ARPCM failed\n",
-	       board->devname);
-	writel(readl(MUNICH_VIRT(STAT)) & STAT_PCMF, MUNICH_VIRT(STAT));
-	MUNICH_close(dev);
-	return -EAGAIN;
-    }
-    else if (!(stat & STAT_PCMA))
-    {
-	printk(KERN_ERR "MUNICH_open: %s: channel open ARPCM timeout\n",
-	       board->devname);
-	MUNICH_close(dev);
-	return -EIO;
-    }
-
-    writel(readl(MUNICH_VIRT(STAT)) & STAT_PCMA, MUNICH_VIRT(STAT));
-    //      printk("MUNICH_open: %s: succesful channel open took %ld jiffies\n", board->devname, jiffies-jiffs);
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    ccb->channel_spec[channel].nitbs = 0;	/* once ITBS defined, these must be 0   */
-    ccb->channel_spec[channel].itbs = 0;
-
-    if (board->isx21)
-    {
-	init_timer(&board->modemline_timer);
-	board->modemline_timer.data = (unsigned long)board;
-	board->modemline_timer.function = pcicom_modemline;
-	board->modemline_timer.expires = jiffies + HZ;
-	add_timer((struct timer_list *)&board->modemline_timer);
-    }
-
-    /* It is done. Declare that we're open: */
-    hw->busy = 0;		/* It may be 1 if the frame at Tx init already ended, but it is not     */
-    /* a real problem: we compute hw->busy on every interrupt                       */
-    hw->rafutott = 0;
-    ch->init_status |= HW_OPEN;
-
-    /* Initialize line state: */
-    if (board->lineup)
-	ch->line_status |= LINE_UP;
-    else
-	ch->line_status &= ~LINE_UP;
-
-    /* Remove w attribute from /proc files associated to hw parameters:
-       no write when the device is open */
-
-    for (; procfile; procfile = procfile->next)
-	if (strcmp(procfile->name, FILENAME_BOARDNUM) == 0 ||
-	    strcmp(procfile->name, FILENAME_TIMESLOTS) == 0)
-	    procfile->mode = S_IFREG | 0444;
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-
-    return 0;
-}
-
-/*
- * Hardware close routine.
- * Called by comx (upper) layer when the user wants to bring down the interface
- * with ifconfig.
- * We also call it from MUNICH_open, if the open fails.
- * Brings down hardware, frees resources, stops receiver
- * Returns 0 on OK, or standard error value on error.
- */
-
-static int MUNICH_close(struct net_device *dev)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw = ch->HW_privdata;
-    struct proc_dir_entry *procfile = ch->procdir->subdir;
-    munich_board_t *board;
-    munich_ccb_t *ccb;
-
-    u32 *bar1;
-    u32 timeslots = hw->timeslots;
-    int stat, i, channel = hw->channel;
-    unsigned long jiffs;
-
-    board = hw->boardnum + (ch->hardware == &pcicomhw ? pcicom_boards : slicecom_boards);
-
-    ccb = board->ccb;
-    bar1 = board->bar1;
-
-    if (board->isx21)
-	del_timer((struct timer_list *)&board->modemline_timer);
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    set_current_state(TASK_UNINTERRUPTIBLE);
-    schedule_timeout(1);
-
-    /* Disable receiver for the channel: */
-
-    for (i = 0; i < 32; i++)
-	if ((1 << i) & timeslots)
-	{
-	    ccb->timeslot_spec[i].tti = 1;
-	    ccb->timeslot_spec[i].txfillmask = 0;	/* just to be double-sure :) */
-
-	    ccb->timeslot_spec[i].rti = 1;
-	    ccb->timeslot_spec[i].rxfillmask = 0;
-	}
-
-    if (!board->isx21) rework_idle_channels(dev);
-
-    ccb->channel_spec[channel].ti = 0;	/* Receive off, Transmit off */
-    ccb->channel_spec[channel].to = 1;
-    ccb->channel_spec[channel].ta = 0;
-    ccb->channel_spec[channel].th = 1;
-
-    ccb->channel_spec[channel].ri = 0;
-    ccb->channel_spec[channel].ro = 1;
-    ccb->channel_spec[channel].ra = 0;
-
-    board->twins[channel] = NULL;
-
-    ccb->action_spec = CCB_ACTIONSPEC_IN | (channel << 8);
-    writel(CMD_ARPCM, MUNICH_VIRT(CMD));
-    set_current_state(TASK_UNINTERRUPTIBLE);
-    schedule_timeout(1);
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-
-    stat = 0;
-    jiffs = jiffies;
-    while (!((stat = readl(MUNICH_VIRT(STAT))) & (STAT_PCMA | STAT_PCMF)) && time_before(jiffies, jiffs + HZ))
-    {
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(1);
-    }
-
-    if (stat & STAT_PCMF)
-    {
-	printk(KERN_ERR
-	       "MUNICH_close: %s: FATAL: channel off ARPCM failed, not closing!\n",
-	       dev->name);
-	writel(readl(MUNICH_VIRT(STAT)) & STAT_PCMF, MUNICH_VIRT(STAT));
-	/* If we return success, the privdata (and the descriptor list) will be freed */
-	return -EIO;
-    }
-    else if (!(stat & STAT_PCMA))
-	printk(KERN_ERR "MUNICH_close: %s: channel off ARPCM timeout\n",
-	       board->devname);
-
-    writel(readl(MUNICH_VIRT(STAT)) & STAT_PCMA, MUNICH_VIRT(STAT));
-    //      printk("MUNICH_close: %s: channel off took %ld jiffies\n", board->devname, jiffies-jiffs);
-
-    spin_lock_irqsave(&mister_lock, flags);
-
-    if (board->use_count) board->use_count--;
-
-    if (!board->use_count)	/* we were the last user of the board */
-    {
-	printk("MUNICH_close: bringing down board %s\n", board->devname);
-
-	/* program down the board: */
-
-	writel(0x0000FF7F, MUNICH_VIRT(IMASK));	/* do not send any interrupts */
-	writel(0, MUNICH_VIRT(CMD));	/* stop the timer if someone started it */
-	writel(~0U, MUNICH_VIRT(STAT));	/* if an interrupt came between the cli()-sti(), quiet it */
-	if (ch->hardware == &pcicomhw)
-	    writel(0x1400, MUNICH_VIRT(GPDATA));
-
-	/* Put the board into 'reset' state: */
-	pci_write_config_dword(board->pci, MUNICH_PCI_PCIRES, 0xe0000);
-
-	/* Free irq and other resources: */
-	if (board->irq)
-	    free_irq(board->irq, (void *)board);	/* Ha nem inicializalta magat, akkor meg nincs irq */
-	board->irq = 0;
-
-	/* Free CCB and the interrupt queues */
-	if (board->ccb) kfree((void *)board->ccb);
-	if (board->tiq) kfree((void *)board->tiq);
-	if (board->riq) kfree((void *)board->riq);
-	if (board->piq) kfree((void *)board->piq);
-	board->ccb = NULL;
-	board->tiq = board->riq = board->piq = NULL;
-    }
-
-    /* Enable setting of hw parameters */
-    for (; procfile; procfile = procfile->next)
-	if (strcmp(procfile->name, FILENAME_BOARDNUM) == 0 ||
-	    strcmp(procfile->name, FILENAME_TIMESLOTS) == 0)
-	    procfile->mode = S_IFREG | 0644;
-
-    /* We're not open anymore */
-    ch->init_status &= ~HW_OPEN;
-
-    spin_unlock_irqrestore(&mister_lock, flags);
-
-    return 0;
-}
-
-/* 
- * Give (textual) status information.
- * The text it returns will be a part of what appears when the user does a
- * cat /proc/comx/comx[n]/status 
- * Don't write more than PAGESIZE.
- * Return value: number of bytes written (length of the string, incl. 0)
- */
-
-static int MUNICH_minden(struct net_device *dev, char *page)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw = ch->HW_privdata;
-    munich_board_t *board;
-    struct net_device *devp;
-
-    u8 *lbi;
-    e1_stats_t *curr_int, *prev_int;
-    e1_stats_t last4, last96;	/* sum of last 4, resp. last 96 intervals               */
-    unsigned *sump,		/* running pointer for the sum data                     */
-     *p;			/* running pointer for the interval data                */
-
-    int len = 0;
-    u8 frs0, frs1;
-    u8 fmr2;
-    int i, j;
-    u32 timeslots;
-
-    board = hw->boardnum + (ch->hardware == &pcicomhw ? pcicom_boards : slicecom_boards);
-
-    lbi = board->lbi;
-    curr_int = &board->intervals[board->current_interval];
-    prev_int =
-	&board->
-	intervals[(board->current_interval + SLICECOM_BOARD_INTERVALS_SIZE -
-		   1) % SLICECOM_BOARD_INTERVALS_SIZE];
-
-    if (!board->isx21)
-    {
-	frs0 = readb(lbi + FRS0);
-	fmr2 = readb(lbi + FMR2);
-	len += scnprintf(page + len, PAGE_SIZE - len, "Controller status:\n");
-	if (frs0 == 0)
-	    len += scnprintf(page + len, PAGE_SIZE - len, "\tNo alarms\n");
-	else
-	{
-	    if (frs0 & FRS0_LOS)
-	            len += scnprintf(page + len, PAGE_SIZE - len, "\tLoss Of Signal\n");
-	    else
-	    {
-		if (frs0 & FRS0_AIS)
-		    len += scnprintf(page + len, PAGE_SIZE - len,
-				 "\tAlarm Indication Signal\n");
-		else
-		{
-		    if (frs0 & FRS0_AUXP)
-			len += scnprintf(page + len, PAGE_SIZE - len,
-				     "\tAuxiliary Pattern Indication\n");
-		    if (frs0 & FRS0_LFA)
-			len += scnprintf(page + len, PAGE_SIZE - len,
-				     "\tLoss of Frame Alignment\n");
-		    else
-		    {
-			if (frs0 & FRS0_RRA)
-			    len += scnprintf(page + len, PAGE_SIZE - len,
-					 "\tReceive Remote Alarm\n");
-
-			/* You can't set this framing with the /proc interface, but it  */
-			/* may be good to have here this alarm if you set it by hand:   */
-
-			if ((board->framing == SLICECOM_FRAMING_CRC4) &&
-			    (frs0 & FRS0_LMFA))
-			    len += scnprintf(page + len, PAGE_SIZE - len,
-					 "\tLoss of CRC4 Multiframe Alignment\n");
-
-			if (((fmr2 & 0xc0) == 0xc0) && (frs0 & FRS0_NMF))
-			    len += scnprintf(page + len, PAGE_SIZE - len,
-				 "\tNo CRC4 Multiframe alignment Found after 400 msec\n");
-		    }
-		}
-	    }
-	}
-
-	frs1 = readb(lbi + FRS1);
-	if (FRS1_XLS & frs1)
-	    len += scnprintf(page + len, PAGE_SIZE - len,
-		 "\tTransmit Line Short\n");
-
-	/* debug Rx ring: DEL: - vagy meghagyni, de akkor legyen kicsit altalanosabb */
-    }
-
-    len += scnprintf(page + len, PAGE_SIZE - len, "Rx ring:\n");
-    len += scnprintf(page + len, PAGE_SIZE - len, "\trafutott: %d\n", hw->rafutott);
-    len += scnprintf(page + len, PAGE_SIZE - len,
-		 "\tlastcheck: %ld, jiffies: %ld\n", board->lastcheck, jiffies);
-    len += scnprintf(page + len, PAGE_SIZE - len, "\tbase: %08x\n",
-	(u32) virt_to_phys(&hw->rx_desc[0]));
-    len += scnprintf(page + len, PAGE_SIZE - len, "\trx_desc_ptr: %d\n",
-		 hw->rx_desc_ptr);
-    len += scnprintf(page + len, PAGE_SIZE - len, "\trx_desc_ptr: %08x\n",
-	(u32) virt_to_phys(&hw->rx_desc[hw->rx_desc_ptr]));
-    len += scnprintf(page + len, PAGE_SIZE - len, "\thw_curr_ptr: %08x\n",
-		 board->ccb->current_rx_desc[hw->channel]);
-
-    for (i = 0; i < RX_DESC_MAX; i++)
-	len += scnprintf(page + len, PAGE_SIZE - len, "\t%08x %08x %08x %08x\n",
-		     *((u32 *) & hw->rx_desc[i] + 0),
-		     *((u32 *) & hw->rx_desc[i] + 1),
-		     *((u32 *) & hw->rx_desc[i] + 2),
-		     *((u32 *) & hw->rx_desc[i] + 3));
-
-    if (!board->isx21)
-    {
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "Interfaces using this board: (channel-group, interface, timeslots)\n");
-	for (i = 0; i < 32; i++)
-	{
-	    devp = board->twins[i];
-	    if (devp != NULL)
-	    {
-		timeslots =
-		    ((struct slicecom_privdata *)((struct comx_channel *)devp->
-						  priv)->HW_privdata)->
-		    timeslots;
-		len += scnprintf(page + len, PAGE_SIZE - len, "\t%2d %s: ", i,
-			     devp->name);
-		for (j = 0; j < 32; j++)
-		    if ((1 << j) & timeslots)
-			len += scnprintf(page + len, PAGE_SIZE - len, "%d ", j);
-		len += scnprintf(page + len, PAGE_SIZE - len, "\n");
-	    }
-	}
-    }
-
-    len += scnprintf(page + len, PAGE_SIZE - len, "Interrupt work histogram:\n");
-    for (i = 0; i < MAX_WORK; i++)
-	len += scnprintf(page + len, PAGE_SIZE - len, "hist[%2d]: %8u%c", i,
-		     board->histogram[i], (i &&
-					   ((i + 1) % 4 == 0 ||
-					    i == MAX_WORK - 1)) ? '\n' : ' ');
-
-    len += scnprintf(page + len, PAGE_SIZE - len, "Tx ring histogram:\n");
-    for (i = 0; i < TX_DESC_MAX; i++)
-	len += scnprintf(page + len, PAGE_SIZE - len, "hist[%2d]: %8u%c", i,
-		     hw->tx_ring_hist[i], (i &&
-					   ((i + 1) % 4 == 0 ||
-					    i ==
-					    TX_DESC_MAX - 1)) ? '\n' : ' ');
-
-    if (!board->isx21)
-    {
-
-	memset((void *)&last4, 0, sizeof(last4));
-	memset((void *)&last96, 0, sizeof(last96));
-
-	/* Calculate the sum of last 4 intervals: */
-
-	for (i = 1; i <= 4; i++)
-	{
-	    p = (unsigned *)&board->intervals[(board->current_interval +
-			   SLICECOM_BOARD_INTERVALS_SIZE -
-			   i) % SLICECOM_BOARD_INTERVALS_SIZE];
-	    sump = (unsigned *)&last4;
-	    for (j = 0; j < (sizeof(e1_stats_t) / sizeof(unsigned)); j++)
-		sump[j] += p[j];
-	}
-
-	/* Calculate the sum of last 96 intervals: */
-
-	for (i = 1; i <= 96; i++)
-	{
-	    p = (unsigned *)&board->intervals[(board->current_interval +
-			   SLICECOM_BOARD_INTERVALS_SIZE -
-			   i) % SLICECOM_BOARD_INTERVALS_SIZE];
-	    sump = (unsigned *)&last96;
-	    for (j = 0; j < (sizeof(e1_stats_t) / sizeof(unsigned)); j++)
-		sump[j] += p[j];
-	}
-
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "Data in current interval (%d seconds elapsed):\n",
-		     board->elapsed_seconds);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Line Code Violations, %d Path Code Violations, %d E-Bit Errors\n",
-		     curr_int->line_code_violations,
-		     curr_int->path_code_violations, curr_int->e_bit_errors);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Slip Secs, %d Fr Loss Secs, %d Line Err Secs, %d Degraded Mins\n",
-		     curr_int->slip_secs, curr_int->fr_loss_secs,
-		     curr_int->line_err_secs, curr_int->degraded_mins);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Errored Secs, %d Bursty Err Secs, %d Severely Err Secs, %d Unavail Secs\n",
-		     curr_int->errored_secs, curr_int->bursty_err_secs,
-		     curr_int->severely_err_secs, curr_int->unavail_secs);
-
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "Data in Interval 1 (15 minutes):\n");
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Line Code Violations, %d Path Code Violations, %d E-Bit Errors\n",
-		     prev_int->line_code_violations,
-		     prev_int->path_code_violations, prev_int->e_bit_errors);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Slip Secs, %d Fr Loss Secs, %d Line Err Secs, %d Degraded Mins\n",
-		     prev_int->slip_secs, prev_int->fr_loss_secs,
-		     prev_int->line_err_secs, prev_int->degraded_mins);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Errored Secs, %d Bursty Err Secs, %d Severely Err Secs, %d Unavail Secs\n",
-		     prev_int->errored_secs, prev_int->bursty_err_secs,
-		     prev_int->severely_err_secs, prev_int->unavail_secs);
-
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "Data in last 4 intervals (1 hour):\n");
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Line Code Violations, %d Path Code Violations, %d E-Bit Errors\n",
-		     last4.line_code_violations, last4.path_code_violations,
-		     last4.e_bit_errors);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Slip Secs, %d Fr Loss Secs, %d Line Err Secs, %d Degraded Mins\n",
-		     last4.slip_secs, last4.fr_loss_secs, last4.line_err_secs,
-		     last4.degraded_mins);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Errored Secs, %d Bursty Err Secs, %d Severely Err Secs, %d Unavail Secs\n",
-		     last4.errored_secs, last4.bursty_err_secs,
-		     last4.severely_err_secs, last4.unavail_secs);
-
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "Data in last 96 intervals (24 hours):\n");
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Line Code Violations, %d Path Code Violations, %d E-Bit Errors\n",
-		     last96.line_code_violations, last96.path_code_violations,
-		     last96.e_bit_errors);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Slip Secs, %d Fr Loss Secs, %d Line Err Secs, %d Degraded Mins\n",
-		     last96.slip_secs, last96.fr_loss_secs,
-		     last96.line_err_secs, last96.degraded_mins);
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "   %d Errored Secs, %d Bursty Err Secs, %d Severely Err Secs, %d Unavail Secs\n",
-		     last96.errored_secs, last96.bursty_err_secs,
-		     last96.severely_err_secs, last96.unavail_secs);
-
-    }
-
-//      len +=scnprintf( page + len, PAGE_SIZE - len, "Special events:\n" );
-//      len +=scnprintf( page + len, PAGE_SIZE - len, "\tstat_pri/missed: %u / %u\n", board->stat_pri_races, board->stat_pri_races_missed );
-//      len +=scnprintf( page + len, PAGE_SIZE - len, "\tstat_pti/missed: %u / %u\n", board->stat_pti_races, board->stat_pti_races_missed );
-    return len;
-}
-
-/*
- * Memory dump function. Not used currently.
- */
-static int BOARD_dump(struct net_device *dev)
-{
-    printk
-	("BOARD_dump() requested. It is unimplemented, it should not be called\n");
-    return (-1);
-}
-
-/* 
- * /proc file read function for the files registered by this module.
- * This function is called by the procfs implementation when a user
- * wants to read from a file registered by this module.
- * page is the workspace, start should point to the real start of data,
- * off is the file offset, data points to the file's proc_dir_entry
- * structure.
- * Returns the number of bytes copied to the request buffer.
- */
-
-static int munich_read_proc(char *page, char **start, off_t off, int count,
-			    int *eof, void *data)
-{
-    struct proc_dir_entry *file = (struct proc_dir_entry *)data;
-    struct net_device *dev = file->parent->data;
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw = ch->HW_privdata;
-    munich_board_t *board;
-
-    int len = 0, i;
-    u32 timeslots = hw->timeslots;
-
-    board = hw->boardnum + (ch->hardware == &pcicomhw ? pcicom_boards : slicecom_boards);
-
-    if (!strcmp(file->name, FILENAME_BOARDNUM))
-	len = sprintf(page, "%d\n", hw->boardnum);
-    else if (!strcmp(file->name, FILENAME_TIMESLOTS))
-    {
-	for (i = 0; i < 32; i++)
-	    if ((1 << i) & timeslots)
-		len += scnprintf(page + len, PAGE_SIZE - len, "%d ", i);
-	len += scnprintf(page + len, PAGE_SIZE - len, "\n");
-    }
-    else if (!strcmp(file->name, FILENAME_FRAMING))
-    {
-	i = 0;
-	while (slicecom_framings[i].value &&
-	       slicecom_framings[i].value != board->framing)
-	    i++;
-	len += scnprintf(page + len, PAGE_SIZE - len, "%s\n",
-		     slicecom_framings[i].name);
-    }
-    else if (!strcmp(file->name, FILENAME_LINECODE))
-    {
-	i = 0;
-	while (slicecom_linecodes[i].value &&
-	       slicecom_linecodes[i].value != board->linecode)
-	    i++;
-	len += scnprintf(page + len, PAGE_SIZE - len, "%s\n",
-		     slicecom_linecodes[i].name);
-    }
-    else if (!strcmp(file->name, FILENAME_CLOCK_SOURCE))
-    {
-	i = 0;
-	while (slicecom_clock_sources[i].value &&
-	       slicecom_clock_sources[i].value != board->clock_source)
-	    i++;
-	len +=
-	    scnprintf(page + len, PAGE_SIZE - len, "%s\n",
-		     slicecom_clock_sources[i].name);
-    }
-    else if (!strcmp(file->name, FILENAME_LOOPBACK))
-    {
-	i = 0;
-	while (slicecom_loopbacks[i].value &&
-	       slicecom_loopbacks[i].value != board->loopback)
-	    i++;
-	len += scnprintf(page + len, PAGE_SIZE - len, "%s\n",
-		     slicecom_loopbacks[i].name);
-    }
-    /* We set permissions to write-only for REG and LBIREG, but root can read them anyway: */
-    else if (!strcmp(file->name, FILENAME_REG))
-    {
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "%s: " FILENAME_REG ": write-only file\n", dev->name);
-    }
-    else if (!strcmp(file->name, FILENAME_LBIREG))
-    {
-	len += scnprintf(page + len, PAGE_SIZE - len,
-		     "%s: " FILENAME_LBIREG ": write-only file\n", dev->name);
-    }
-    else
-    {
-	printk("slicecom_read_proc: internal error, filename %s\n", file->name);
-	return -EBADF;
-    }
-    /* file handling administration: count eof status, offset, start address
-       and count: */
-
-    if (off >= len)
-    {
-	*eof = 1;
-	return 0;
-    }
-
-    *start = page + off;
-    if (count >= len - off)
-	*eof = 1;
-    return min((off_t) count, (off_t) len - off);
-}
-
-/* 
- * Write function for /proc files registered by us.
- * See the comment on read function above.
- * Beware! buffer is in userspace!!!
- * Returns the number of bytes written
- */
-
-static int munich_write_proc(struct file *file, const char *buffer,
-			     u_long count, void *data)
-{
-    struct proc_dir_entry *entry = (struct proc_dir_entry *)data;
-    struct net_device *dev = (struct net_device *)entry->parent->data;
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw = ch->HW_privdata;
-    munich_board_t *board;
-
-    unsigned long ts, tmp_boardnum;
-
-    u32 tmp_timeslots = 0;
-    char *page, *p;
-    int i;
-
-    board = hw->boardnum + (ch->hardware == &pcicomhw ? pcicom_boards : slicecom_boards);
-
-    /* Paranoia checking: */
-
-    if (PDE(file->f_dentry->d_inode) != entry)
-    {
-	printk(KERN_ERR "munich_write_proc: file <-> data internal error\n");
-	return -EIO;
-    }
-
-    /* Request tmp buffer */
-    if (!(page = (char *)__get_free_page(GFP_KERNEL)))
-	return -ENOMEM;
-
-    /* Copy user data and cut trailing \n */
-    if (copy_from_user(page, buffer, count = min(count, PAGE_SIZE))) {
-	    free_page((unsigned long)page);
-	    return -EFAULT;
-    }
-    if (*(page + count - 1) == '\n')
-	*(page + count - 1) = 0;
-    *(page + PAGE_SIZE - 1) = 0;
-
-    if (!strcmp(entry->name, FILENAME_BOARDNUM))
-    {
-	tmp_boardnum = simple_strtoul(page, NULL, 0);
-	if (0 <= tmp_boardnum && tmp_boardnum < MAX_BOARDS)
-	    hw->boardnum = tmp_boardnum;
-	else
-	{
-	    printk("%s: " FILENAME_BOARDNUM " range is 0...%d\n", dev->name,
-		   MAX_BOARDS - 1);
-	    free_page((unsigned long)page);
-	    return -EINVAL;
-	}
-    }
-    else if (!strcmp(entry->name, FILENAME_TIMESLOTS))
-    {
-	p = page;
-	while (*p)
-	{
-	    if (isspace(*p))
-		p++;
-	    else
-	    {
-		ts = simple_strtoul(p, &p, 10);	/* base = 10: Don't read 09 as an octal number */
-		/* ts = 0 ha nem tudta beolvasni a stringet, erre egy kicsit epitek itt: */
-		if (0 <= ts && ts < 32)
-		{
-		    tmp_timeslots |= (1 << ts);
-		}
-		else
-		{
-		    printk("%s: " FILENAME_TIMESLOTS " range is 1...31\n",
-			   dev->name);
-		    free_page((unsigned long)page);
-		    return -EINVAL;
-		}
-	    }
-	}
-	hw->timeslots = tmp_timeslots;
-    }
-    else if (!strcmp(entry->name, FILENAME_FRAMING))
-    {
-	i = 0;
-	while (slicecom_framings[i].value &&
-	       strncmp(slicecom_framings[i].name, page,
-		       strlen(slicecom_framings[i].name)))
-	    i++;
-	if (!slicecom_framings[i].value)
-	{
-	    printk("slicecom: %s: Invalid " FILENAME_FRAMING " '%s'\n",
-		   dev->name, page);
-	    free_page((unsigned long)page);
-	    return -EINVAL;
-	}
-	else
-	{			/*
-				 * If somebody says:
-				 *      echo >boardnum  0
-				 *      echo >framing   no-crc4
-				 *      echo >boardnum  1
-				 * - when the framing was set, hw->boardnum was 0, so it would set the framing for board 0
-				 * Workaround: allow to set it only if interface is administrative UP
-				 */
-	    if (netif_running(dev))
-		slicecom_set_framing(hw->boardnum, slicecom_framings[i].value);
-	    else
-	    {
-		printk("%s: " FILENAME_FRAMING
-		       " can not be set while the interface is DOWN\n",
-		       dev->name);
-		free_page((unsigned long)page);
-		return -EINVAL;
-	    }
-	}
-    }
-    else if (!strcmp(entry->name, FILENAME_LINECODE))
-    {
-	i = 0;
-	while (slicecom_linecodes[i].value &&
-	       strncmp(slicecom_linecodes[i].name, page,
-		       strlen(slicecom_linecodes[i].name)))
-	    i++;
-	if (!slicecom_linecodes[i].value)
-	{
-	    printk("slicecom: %s: Invalid " FILENAME_LINECODE " '%s'\n",
-		   dev->name, page);
-	    free_page((unsigned long)page);
-	    return -EINVAL;
-	}
-	else
-	{			/*
-				 * Allow to set it only if interface is administrative UP,
-				 * for the same reason as FILENAME_FRAMING
-				 */
-	    if (netif_running(dev))
-		slicecom_set_linecode(hw->boardnum,
-				      slicecom_linecodes[i].value);
-	    else
-	    {
-		printk("%s: " FILENAME_LINECODE
-		       " can not be set while the interface is DOWN\n",
-		       dev->name);
-		free_page((unsigned long)page);
-		return -EINVAL;
-	    }
-	}
-    }
-    else if (!strcmp(entry->name, FILENAME_CLOCK_SOURCE))
-    {
-	i = 0;
-	while (slicecom_clock_sources[i].value &&
-	       strncmp(slicecom_clock_sources[i].name, page,
-		       strlen(slicecom_clock_sources[i].name)))
-	    i++;
-	if (!slicecom_clock_sources[i].value)
-	{
-	    printk("%s: Invalid " FILENAME_CLOCK_SOURCE " '%s'\n", dev->name,
-		   page);
-	    free_page((unsigned long)page);
-	    return -EINVAL;
-	}
-	else
-	{			/*
-				 * Allow to set it only if interface is administrative UP,
-				 * for the same reason as FILENAME_FRAMING
-				 */
-	    if (netif_running(dev))
-		slicecom_set_clock_source(hw->boardnum,
-					  slicecom_clock_sources[i].value);
-	    else
-	    {
-		printk("%s: " FILENAME_CLOCK_SOURCE
-		       " can not be set while the interface is DOWN\n",
-		       dev->name);
-		free_page((unsigned long)page);
-		return -EINVAL;
-	    }
-	}
-    }
-    else if (!strcmp(entry->name, FILENAME_LOOPBACK))
-    {
-	i = 0;
-	while (slicecom_loopbacks[i].value &&
-	       strncmp(slicecom_loopbacks[i].name, page,
-		       strlen(slicecom_loopbacks[i].name)))
-	    i++;
-	if (!slicecom_loopbacks[i].value)
-	{
-	    printk("%s: Invalid " FILENAME_LOOPBACK " '%s'\n", dev->name, page);
-	    free_page((unsigned long)page);
-	    return -EINVAL;
-	}
-	else
-	{			/*
-				 * Allow to set it only if interface is administrative UP,
-				 * for the same reason as FILENAME_FRAMING
-				 */
-	    if (netif_running(dev))
-		slicecom_set_loopback(hw->boardnum,
-				      slicecom_loopbacks[i].value);
-	    else
-	    {
-		printk("%s: " FILENAME_LOOPBACK
-		       " can not be set while the interface is DOWN\n",
-		       dev->name);
-		free_page((unsigned long)page);
-		return -EINVAL;
-	    }
-	}
-    }
-    else if (!strcmp(entry->name, FILENAME_REG))
-    {				/* DEL: 'reg' csak tmp */
-	char *p;
-	u32 *bar1 = board->bar1;
-
-	reg = simple_strtoul(page, &p, 0);
-	reg_ertek = simple_strtoul(p + 1, NULL, 0);
-
-	if (reg < 0x100)
-	{
-	    printk("reg(0x%02x) := 0x%08x  jiff: %lu\n", reg, reg_ertek, jiffies);
-	    writel(reg_ertek, MUNICH_VIRT(reg >> 2));
-	}
-	else
-	{
-	    printk("reg(0x%02x) is 0x%08x  jiff: %lu\n", reg - 0x100,
-		   readl(MUNICH_VIRT((reg - 0x100) >> 2)), jiffies);
-	}
-    }
-    else if (!strcmp(entry->name, FILENAME_LBIREG))
-    {				/* DEL: 'lbireg' csak tmp */
-	char *p;
-	u8 *lbi = board->lbi;
-
-	lbireg = simple_strtoul(page, &p, 0);
-	lbireg_ertek = simple_strtoul(p + 1, NULL, 0);
-
-	if (lbireg < 0x100)
-	{
-	    printk("lbireg(0x%02x) := 0x%02x  jiff: %lu\n", lbireg,
-		   lbireg_ertek, jiffies);
-	    writeb(lbireg_ertek, lbi + lbireg);
-	}
-	else
-	    printk("lbireg(0x%02x) is 0x%02x  jiff: %lu\n", lbireg - 0x100,
-		   readb(lbi + lbireg - 0x100), jiffies);
-    }
-    else
-    {
-	printk(KERN_ERR "munich_write_proc: internal error, filename %s\n",
-	       entry->name);
-	free_page((unsigned long)page);
-	return -EBADF;
-    }
-
-    /* Don't forget to free the workspace */
-    free_page((unsigned long)page);
-    return count;
-}
-
-/* 
- * Boardtype init function.
- * Called by the comx (upper) layer, when you set boardtype.
- * Allocates resources associated to using munich board for this device,
- * initializes ch_struct pointers etc.
- * Returns 0 on success and standard error codes on error.
- */
-
-static int init_escape(struct comx_channel *ch)
-{
-    kfree(ch->HW_privdata);
-    return -EIO;
-}
-
-static int BOARD_init(struct net_device *dev)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-    struct slicecom_privdata *hw;
-    struct proc_dir_entry *new_file;
-
-    /* Alloc data for private structure */
-    if ((ch->HW_privdata =
-	kmalloc(sizeof(struct slicecom_privdata), GFP_KERNEL)) == NULL)
-        return -ENOMEM;
-        
-    memset(hw = ch->HW_privdata, 0, sizeof(struct slicecom_privdata));
-
-    /* Register /proc files */
-    if ((new_file = create_proc_entry(FILENAME_BOARDNUM, S_IFREG | 0644,
-			   ch->procdir)) == NULL)
-	return init_escape(ch);
-    new_file->data = (void *)new_file;
-    new_file->read_proc = &munich_read_proc;
-    new_file->write_proc = &munich_write_proc;
-//      new_file->proc_iops = &comx_normal_inode_ops;
-    new_file->nlink = 1;
-
-    if (ch->hardware == &slicecomhw)
-    {
-	if ((new_file = create_proc_entry(FILENAME_TIMESLOTS, S_IFREG | 0644,
-			       ch->procdir)) == NULL)
-	    return init_escape(ch);
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &munich_read_proc;
-	new_file->write_proc = &munich_write_proc;
-//              new_file->proc_iops = &comx_normal_inode_ops;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_FRAMING, S_IFREG | 0644,
-			       ch->procdir)) == NULL)
-	    return init_escape(ch);
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &munich_read_proc;
-	new_file->write_proc = &munich_write_proc;
-//              new_file->proc_iops = &comx_normal_inode_ops;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_LINECODE, S_IFREG | 0644,
-			       ch->procdir)) == NULL)
-	    return init_escape(ch);
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &munich_read_proc;
-	new_file->write_proc = &munich_write_proc;
-//              new_file->proc_iops = &comx_normal_inode_ops;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_CLOCK_SOURCE, S_IFREG | 0644,
-			       ch->procdir)) == NULL)
-	    return init_escape(ch);
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &munich_read_proc;
-	new_file->write_proc = &munich_write_proc;
-//              new_file->proc_iops = &comx_normal_inode_ops;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_LOOPBACK, S_IFREG | 0644,
-			       ch->procdir)) == NULL)
-	    return init_escape(ch);
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &munich_read_proc;
-	new_file->write_proc = &munich_write_proc;
-//              new_file->proc_iops = &comx_normal_inode_ops;
-	new_file->nlink = 1;
-    }
-
-    /* DEL: ez itt csak fejlesztesi celokra!! */
-    if ((new_file = create_proc_entry(FILENAME_REG, S_IFREG | 0200, ch->procdir)) == NULL)
-	return init_escape(ch);
-    new_file->data = (void *)new_file;
-    new_file->read_proc = &munich_read_proc;
-    new_file->write_proc = &munich_write_proc;
-//      new_file->proc_iops = &comx_normal_inode_ops;
-    new_file->nlink = 1;
-
-    /* DEL: ez itt csak fejlesztesi celokra!! */
-    if ((new_file = create_proc_entry(FILENAME_LBIREG, S_IFREG | 0200,
-			   ch->procdir)) == NULL)
-	return init_escape(ch);
-    new_file->data = (void *)new_file;
-    new_file->read_proc = &munich_read_proc;
-    new_file->write_proc = &munich_write_proc;
-//      new_file->proc_iops = &comx_normal_inode_ops;
-    new_file->nlink = 1;
-
-    /* Fill in ch_struct hw specific pointers: */
-
-    ch->HW_txe = MUNICH_txe;
-    ch->HW_open = MUNICH_open;
-    ch->HW_close = MUNICH_close;
-    ch->HW_send_packet = MUNICH_send_packet;
-#ifndef COMX_NEW
-    ch->HW_minden = MUNICH_minden;
-#else
-    ch->HW_statistics = MUNICH_minden;
-#endif
-
-    hw->boardnum = SLICECOM_BOARDNUM_DEFAULT;
-    hw->timeslots = ch->hardware == &pcicomhw ?  0xffffffff : 2;
-
-    /* O.K. Count one more user on this module */
-    MOD_INC_USE_COUNT;
-    return 0;
-}
-
-/* 
- * Boardtype exit function.
- * Called by the comx (upper) layer, when you clear boardtype from munich.
- * Frees resources associated to using munich board for this device,
- * resets ch_struct pointers etc.
- */
-static int BOARD_exit(struct net_device *dev)
-{
-    struct comx_channel *ch = netdev_priv(dev);
-
-    /* Free private data area */
-//    board = hw->boardnum + (ch->hardware == &pcicomhw ? pcicom_boards : slicecom_boards);
-
-    kfree(ch->HW_privdata);
-    /* Remove /proc files */
-    remove_proc_entry(FILENAME_BOARDNUM, ch->procdir);
-    if (ch->hardware == &slicecomhw)
-    {
-	remove_proc_entry(FILENAME_TIMESLOTS, ch->procdir);
-	remove_proc_entry(FILENAME_FRAMING, ch->procdir);
-	remove_proc_entry(FILENAME_LINECODE, ch->procdir);
-	remove_proc_entry(FILENAME_CLOCK_SOURCE, ch->procdir);
-	remove_proc_entry(FILENAME_LOOPBACK, ch->procdir);
-    }
-    remove_proc_entry(FILENAME_REG, ch->procdir);
-    remove_proc_entry(FILENAME_LBIREG, ch->procdir);
-
-    /* Minus one user for the module accounting */
-    MOD_DEC_USE_COUNT;
-    return 0;
-}
-
-static struct comx_hardware slicecomhw =
-{
-    "slicecom",
-#ifdef COMX_NEW
-    VERSION,
-#endif
-    BOARD_init,
-    BOARD_exit,
-    BOARD_dump,
-    NULL
-};
-
-static struct comx_hardware pcicomhw =
-{
-    "pcicom",
-#ifdef COMX_NEW
-    VERSION,
-#endif
-    BOARD_init,
-    BOARD_exit,
-    BOARD_dump,
-    NULL
-};
-
-/* Module management */
-
-static int __init init_mister(void)
-{
-    printk(VERSIONSTR);
-    comx_register_hardware(&slicecomhw);
-    comx_register_hardware(&pcicomhw);
-    return munich_probe();
-}
-
-static void __exit cleanup_mister(void)
-{
-    int i;
-
-    comx_unregister_hardware("slicecom");
-    comx_unregister_hardware("pcicom");
-
-    for (i = 0; i < MAX_BOARDS; i++)
-    {
-	if (slicecom_boards[i].bar1)
-	    iounmap((void *)slicecom_boards[i].bar1);
-	if (slicecom_boards[i].lbi)
-	    iounmap((void *)slicecom_boards[i].lbi);
-	if (pcicom_boards[i].bar1)
-	    iounmap((void *)pcicom_boards[i].bar1);
-	if (pcicom_boards[i].lbi)
-	    iounmap((void *)pcicom_boards[i].lbi);
-    }
-}
-
-module_init(init_mister);
-module_exit(cleanup_mister);
diff -Nru a/drivers/net/wan/comx-proto-fr.c b/drivers/net/wan/comx-proto-fr.c
--- a/drivers/net/wan/comx-proto-fr.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1014 +0,0 @@
-/*
- * Frame-relay protocol module for the COMX driver 
- * for Linux 2.2.X
- *
- * Original author: Tivadar Szemethy <tiv@itc.hu>
- * Maintainer: Gergely Madarasz <gorgo@itc.hu>
- *
- * Copyright (C) 1998-1999 ITConsult-Pro Co. <info@itc.hu>
- * 
- * Contributors:
- * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.73)
- *
- * 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.
- *
- * Version 0.70 (99/06/14):
- *		- cleaned up the source code a bit
- *		- ported back to kernel, now works as builtin code 
- *
- * Version 0.71 (99/06/25):
- *		- use skb priorities and queues for sending keepalive
- * 		- use device queues for slave->master data transmit
- *		- set IFF_RUNNING only line protocol up
- *		- fixes on slave device flags
- * 
- * Version 0.72 (99/07/09):
- *		- handle slave tbusy with master tbusy (should be fixed)
- *		- fix the keepalive timer addition/deletion
- *
- * Version 0.73 (00/08/15)
- * 		- resource release on failure at fr_master_init and
- *		  fr_slave_init 		  
- */
-
-#define VERSION "0.73"
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/jiffies.h>
-#include <linux/netdevice.h>
-#include <linux/proc_fs.h>
-#include <linux/if_arp.h>
-#include <linux/inetdevice.h>
-#include <linux/pkt_sched.h>
-#include <linux/init.h>
-
-#include <asm/uaccess.h>
-
-#include "comx.h"
-#include "comxhw.h"
-
-MODULE_AUTHOR("Author: Tivadar Szemethy <tiv@itc.hu>");
-MODULE_DESCRIPTION("Frame Relay protocol implementation for the COMX drivers"
-	"for Linux kernel 2.4.X");
-MODULE_LICENSE("GPL");
-
-#define	FRAD_UI		0x03
-#define	NLPID_IP	0xcc
-#define	NLPID_Q933_LMI	0x08
-#define	NLPID_CISCO_LMI	0x09	
-#define Q933_ENQ	0x75
-#define	Q933_LINESTAT	0x51
-#define	Q933_COUNTERS	0x53
-
-#define	MAXALIVECNT	3		/* No. of failures */
-
-struct fr_data {
-	u16	dlci;
-	struct	net_device *master;
-	char	keepa_pend;
-	char	keepa_freq;
-	char	keepalivecnt, keeploopcnt;
-	struct	timer_list keepa_timer;
-	u8	local_cnt, remote_cnt;
-};
-
-static struct comx_protocol fr_master_protocol;
-static struct comx_protocol fr_slave_protocol;
-static struct comx_hardware fr_dlci;
-
-static void fr_keepalive_send(struct net_device *dev) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-	struct sk_buff *skb;
-	u8 *fr_packet;
-	
-	skb=alloc_skb(dev->hard_header_len + 13, GFP_ATOMIC);
-	
-	if(skb==NULL)
-		return;
-               
-        skb_reserve(skb, dev->hard_header_len);
-        
-        fr_packet=(u8*)skb_put(skb, 13);
-                 
-	fr_packet[0] = (fr->dlci & (1024 - 15)) >> 2;
-	fr_packet[1] = (fr->dlci & 15) << 4 | 1;	// EA bit 1
-	fr_packet[2] = FRAD_UI;
-	fr_packet[3] = NLPID_Q933_LMI;
-	fr_packet[4] = 0;
-	fr_packet[5] = Q933_ENQ;
-	fr_packet[6] = Q933_LINESTAT;
-	fr_packet[7] = 0x01;
-	fr_packet[8] = 0x01;
-	fr_packet[9] = Q933_COUNTERS;
-	fr_packet[10] = 0x02;
-	fr_packet[11] = ++fr->local_cnt;
-	fr_packet[12] = fr->remote_cnt;
-
-	skb->dev = dev;
-	skb->priority = TC_PRIO_CONTROL;
-	dev_queue_xmit(skb);
-}
-
-static void fr_keepalive_timerfun(unsigned long d) 
-{
-	struct net_device *dev = (struct net_device *)d;
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-	struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-	struct comx_channel *sch;
-	struct fr_data *sfr;
-	struct net_device *sdev;
-
-	if (ch->init_status & LINE_OPEN) {
-		if (fr->keepalivecnt == MAXALIVECNT) {
-			comx_status(dev, ch->line_status & ~PROTO_UP);
-			dev->flags &= ~IFF_RUNNING;
-			for (; dir ; dir = dir->next) {
-				if(!S_ISDIR(dir->mode)) {
-				    continue;
-				}
-	
-				if ((sdev = dir->data) && (sch = sdev->priv) && 
-				    (sdev->type == ARPHRD_DLCI) && 
-				    (sfr = sch->LINE_privdata) 
-				    && (sfr->master == dev) && 
-				    (sdev->flags & IFF_UP)) {
-					sdev->flags &= ~IFF_RUNNING;
-					comx_status(sdev, 
-						sch->line_status & ~PROTO_UP);
-				}
-			}
-		}
-		if (fr->keepalivecnt <= MAXALIVECNT) {
-			++fr->keepalivecnt;
-		}
-		fr_keepalive_send(dev);
-	}
-	mod_timer(&fr->keepa_timer, jiffies + HZ * fr->keepa_freq);
-}
-
-static void fr_rx_lmi(struct net_device *dev, struct sk_buff *skb, 
-	u16 dlci, u8 nlpid) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-	struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-	struct comx_channel *sch;
-	struct fr_data *sfr;
-	struct net_device *sdev;
-
-	if (dlci != fr->dlci || nlpid != NLPID_Q933_LMI || !fr->keepa_freq) {
-		return;
-	}
-
-	fr->remote_cnt = skb->data[7];
-	if (skb->data[8] == fr->local_cnt) { // keepalive UP!
-		fr->keepalivecnt = 0;
-		if ((ch->line_status & LINE_UP) && 
-		    !(ch->line_status & PROTO_UP)) {
-			comx_status(dev, ch->line_status |= PROTO_UP);
-			dev->flags |= IFF_RUNNING;
-			for (; dir ; dir = dir->next) {
-				if(!S_ISDIR(dir->mode)) {
-				    continue;
-				}
-	
-				if ((sdev = dir->data) && (sch = sdev->priv) && 
-				    (sdev->type == ARPHRD_DLCI) && 
-				    (sfr = sch->LINE_privdata) 
-				    && (sfr->master == dev) && 
-				    (sdev->flags & IFF_UP)) {
-					sdev->flags |= IFF_RUNNING;
-					comx_status(sdev, 
-						sch->line_status | PROTO_UP);
-				}
-			}
-		}
-	}
-}
-
-static void fr_set_keepalive(struct net_device *dev, int keepa) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-
-	if (!keepa && fr->keepa_freq) { // switch off
-		fr->keepa_freq = 0;
-		if (ch->line_status & LINE_UP) {
-			comx_status(dev, ch->line_status | PROTO_UP);
-			dev->flags |= IFF_RUNNING;
-			del_timer(&fr->keepa_timer);
-		}
-		return;
-	}
-
-	if (keepa) { // bekapcs
-		if(fr->keepa_freq && (ch->line_status & LINE_UP)) {
-			del_timer(&fr->keepa_timer);
-		}
-		fr->keepa_freq = keepa;
-		fr->local_cnt = fr->remote_cnt = 0;
-		init_timer(&fr->keepa_timer);
-		fr->keepa_timer.expires = jiffies + HZ;
-		fr->keepa_timer.function = fr_keepalive_timerfun;
-		fr->keepa_timer.data = (unsigned long)dev;
-		ch->line_status &= ~(PROTO_UP | PROTO_LOOP);
-		dev->flags &= ~IFF_RUNNING;
-		comx_status(dev, ch->line_status);
-		if(ch->line_status & LINE_UP) {
-			add_timer(&fr->keepa_timer);
-		}
-	}
-}
-
-static void fr_rx(struct net_device *dev, struct sk_buff *skb) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-	struct net_device *sdev = dev;
-	struct comx_channel *sch;
-	struct fr_data *sfr;
-	u16 dlci;
-	u8 nlpid;
-
-	if(skb->len <= 4 || skb->data[2] != FRAD_UI) {
-		kfree_skb(skb);
-		return;
-	}
-
-	/* Itt majd ki kell talalni, melyik slave kapja a csomagot */
-	dlci = ((skb->data[0] & 0xfc) << 2) | ((skb->data[1] & 0xf0) >> 4);
-	if ((nlpid = skb->data[3]) == 0) { // Optional padding 
-		nlpid = skb->data[4];
-		skb_pull(skb, 1);
-	}
-	skb_pull(skb, 4);	/* DLCI and header throw away */
-
-	if (ch->debug_flags & DEBUG_COMX_DLCI) {
-		comx_debug(dev, "Frame received, DLCI: %d, NLPID: 0x%02x\n", 
-			dlci, nlpid);
-		comx_debug_skb(dev, skb, "Contents");
-	}
-
-	/* Megkeressuk, kihez tartozik */
-	for (; dir ; dir = dir->next) {
-		if(!S_ISDIR(dir->mode)) {
-			continue;
-		}
-		if ((sdev = dir->data) && (sch = sdev->priv) && 
-		    (sdev->type == ARPHRD_DLCI) && (sfr = sch->LINE_privdata) &&
-		    (sfr->master == dev) && (sfr->dlci == dlci)) {
-			skb->dev = sdev;	
-			if (ch->debug_flags & DEBUG_COMX_DLCI) {
-				comx_debug(dev, "Passing it to %s\n",sdev->name);
-			}
-			if (dev != sdev) {
-				sch->stats.rx_packets++;
-				sch->stats.rx_bytes += skb->len;
-			}
-			break;
-		}
-	}
-	switch(nlpid) {
-		case NLPID_IP:
-			skb->protocol = htons(ETH_P_IP);
-			skb->mac.raw = skb->data;
-			comx_rx(sdev, skb);
-			break;
-		case NLPID_Q933_LMI:
-			fr_rx_lmi(dev, skb, dlci, nlpid);
-		default:
-			kfree_skb(skb);
-			break;
-	}
-}
-
-static int fr_tx(struct net_device *dev) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-	struct net_device *sdev;
-	struct comx_channel *sch;
-	struct fr_data *sfr;
-	int cnt = 1;
-
-	/* Ha minden igaz, 2 helyen fog allni a tbusy: a masternel, 
-	   es annal a slave-nel aki eppen kuldott.
-	   Egy helyen akkor all, ha a master kuldott.
-	   Ez megint jo lesz majd, ha utemezni akarunk */
-	   
-	/* This should be fixed, the slave tbusy should be set when 
-	   the masters queue is full and reset when not */
-
-	for (; dir ; dir = dir->next) {
-		if(!S_ISDIR(dir->mode)) {
-		    continue;
-		}
-		if ((sdev = dir->data) && (sch = sdev->priv) && 
-		    (sdev->type == ARPHRD_DLCI) && (sfr = sch->LINE_privdata) &&
-		    (sfr->master == dev) && (netif_queue_stopped(sdev))) {
-		    	netif_wake_queue(sdev);
-			cnt++;
-		}
-	}
-
-	netif_wake_queue(dev);
-	return 0;
-}
-
-static void fr_status(struct net_device *dev, unsigned short status)
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-	struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-	struct net_device *sdev;
-	struct comx_channel *sch;
-	struct fr_data *sfr;
-
-	if (status & LINE_UP) {
-		if (!fr->keepa_freq) {
-			status |= PROTO_UP;
-		}
-	} else {
-		status &= ~(PROTO_UP | PROTO_LOOP);
-	}
-
-	if (dev == fr->master && fr->keepa_freq) {
-		if (status & LINE_UP) {
-			fr->keepa_timer.expires = jiffies + HZ;
-			add_timer(&fr->keepa_timer);
-			fr->keepalivecnt = MAXALIVECNT + 1;
-			fr->keeploopcnt = 0;
-		} else {
-			del_timer(&fr->keepa_timer);
-		}
-	}
-		
-	/* Itt a status valtozast vegig kell vinni az osszes slave-n */
-	for (; dir ; dir = dir->next) {
-		if(!S_ISDIR(dir->mode)) {
-		    continue;
-		}
-	
-		if ((sdev = dir->data) && (sch = sdev->priv) && 
-		    (sdev->type == ARPHRD_FRAD || sdev->type == ARPHRD_DLCI) && 
-		    (sfr = sch->LINE_privdata) && (sfr->master == dev)) {
-			if(status & LINE_UP) {
-				netif_wake_queue(sdev);
-			}
-			comx_status(sdev, status);
-			if(status & (PROTO_UP | PROTO_LOOP)) {
-				dev->flags |= IFF_RUNNING;
-			} else {
-				dev->flags &= ~IFF_RUNNING;
-			}
-		}
-	}
-}
-
-static int fr_open(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-	struct proc_dir_entry *comxdir = ch->procdir;
-	struct comx_channel *mch;
-
-	if (!(ch->init_status & HW_OPEN)) {
-		return -ENODEV;
-	}
-
-	if ((ch->hardware == &fr_dlci && ch->protocol != &fr_slave_protocol) ||
-	    (ch->protocol == &fr_slave_protocol && ch->hardware != &fr_dlci)) {
-		printk(KERN_ERR "Trying to open an improperly set FR interface, giving up\n");
-		return -EINVAL;
-	}
-
-	if (!fr->master) {
-		return -ENODEV;
-	}
-	mch = fr->master->priv;
-	if (fr->master != dev && (!(mch->init_status & LINE_OPEN) 
-	   || (mch->protocol != &fr_master_protocol))) {
-		printk(KERN_ERR "Master %s is inactive, or incorrectly set up, "
-			"unable to open %s\n", fr->master->name, dev->name);
-		return -ENODEV;
-	}
-
-	ch->init_status |= LINE_OPEN;
-	ch->line_status &= ~(PROTO_UP | PROTO_LOOP);
-	dev->flags &= ~IFF_RUNNING;
-
-	if (fr->master == dev) {
-		if (fr->keepa_freq) {
-			fr->keepa_timer.function = fr_keepalive_timerfun;
-			fr->keepa_timer.data = (unsigned long)dev;
-			add_timer(&fr->keepa_timer);
-		} else {
-			if (ch->line_status & LINE_UP) {
-				ch->line_status |= PROTO_UP;
-				dev->flags |= IFF_RUNNING;
-			}
-		}
-	} else {
-		ch->line_status = mch->line_status;
-		if(fr->master->flags & IFF_RUNNING) {
-			dev->flags |= IFF_RUNNING;
-		}
-	}
-
-	for (; comxdir ; comxdir = comxdir->next) {
-		if (strcmp(comxdir->name, FILENAME_DLCI) == 0 ||
-		   strcmp(comxdir->name, FILENAME_MASTER) == 0 ||
-		   strcmp(comxdir->name, FILENAME_KEEPALIVE) == 0) {
-			comxdir->mode = S_IFREG | 0444;
-		}
-	}
-//	comx_status(dev, ch->line_status);
-	return 0;
-}
-
-static int fr_close(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-	struct proc_dir_entry *comxdir = ch->procdir;
-
-	if (fr->master == dev) { // Ha master 
-		struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-		struct net_device *sdev = dev;
-		struct comx_channel *sch;
-		struct fr_data *sfr;
-
-		if (!(ch->init_status & HW_OPEN)) {
-			return -ENODEV;
-		}
-
-		if (fr->keepa_freq) {
-			del_timer(&fr->keepa_timer);
-		}
-		
-		for (; dir ; dir = dir->next) {
-			if(!S_ISDIR(dir->mode)) {
-				continue;
-			}
-			if ((sdev = dir->data) && (sch = sdev->priv) && 
-			    (sdev->type == ARPHRD_DLCI) && 
-			    (sfr = sch->LINE_privdata) &&
-			    (sfr->master == dev) && 
-			    (sch->init_status & LINE_OPEN)) {
-				dev_close(sdev);
-			}
-		}
-	}
-
-	ch->init_status &= ~LINE_OPEN;
-	ch->line_status &= ~(PROTO_UP | PROTO_LOOP);
-	dev->flags &= ~IFF_RUNNING;
-
-	for (; comxdir ; comxdir = comxdir->next) {
-		if (strcmp(comxdir->name, FILENAME_DLCI) == 0 ||
-		    strcmp(comxdir->name, FILENAME_MASTER) == 0 ||
-		    strcmp(comxdir->name, FILENAME_KEEPALIVE) == 0) {
-			comxdir->mode = S_IFREG | 0444;
-		}
-	}
-
-	return 0;
-}
-
-static int fr_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct comx_channel *sch, *mch;
-	struct fr_data *fr = ch->LINE_privdata;
-	struct fr_data *sfr;
-	struct net_device *sdev;
-	struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-
-	if (!fr->master) {
-		printk(KERN_ERR "BUG: fr_xmit without a master!!! dev: %s\n", dev->name);
-		return 0;
-	}
-
-	mch = fr->master->priv;
-
-	/* Ennek majd a slave utemezeskor lesz igazan jelentosege */
-	if (ch->debug_flags & DEBUG_COMX_DLCI) {
-		comx_debug_skb(dev, skb, "Sending frame");
-	}
-
-	if (dev != fr->master) {
-		struct sk_buff *newskb=skb_clone(skb, GFP_ATOMIC);
-		if (!newskb)
-			return -ENOMEM;
-		newskb->dev=fr->master;
-		dev_queue_xmit(newskb);
-		ch->stats.tx_bytes += skb->len;
-		ch->stats.tx_packets++;
-		dev_kfree_skb(skb);
-	} else {
-		netif_stop_queue(dev);
-		for (; dir ; dir = dir->next) {
-			if(!S_ISDIR(dir->mode)) {
-			    continue;
-			}
-			if ((sdev = dir->data) && (sch = sdev->priv) && 
-			    (sdev->type == ARPHRD_DLCI) && (sfr = sch->LINE_privdata) &&
-			    (sfr->master == dev) && (netif_queue_stopped(sdev))) {
-				netif_stop_queue(sdev);
-			}
-		}
-		 	
-		switch(mch->HW_send_packet(dev, skb)) {
-			case FRAME_QUEUED:
-				netif_wake_queue(dev);
-				break;
-			case FRAME_ACCEPTED:
-			case FRAME_DROPPED:
-				break;
-			case FRAME_ERROR:
-				printk(KERN_ERR "%s: Transmit frame error (len %d)\n", 
-					dev->name, skb->len);
-				break;
-		}
-	}
-	return 0;
-}
-
-static int fr_header(struct sk_buff *skb, struct net_device *dev, 
-	unsigned short type, void *daddr, void *saddr, unsigned len) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-
-	skb_push(skb, dev->hard_header_len);	  
-	/* Put in DLCI */
-	skb->data[0] = (fr->dlci & (1024 - 15)) >> 2;
-	skb->data[1] = (fr->dlci & 15) << 4 | 1;	// EA bit 1
-	skb->data[2] = FRAD_UI;
-	skb->data[3] = NLPID_IP;
-
-	return dev->hard_header_len;  
-}
-
-static int fr_statistics(struct net_device *dev, char *page) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-	int len = 0;
-
-	if (fr->master == dev) {
-		struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-		struct net_device *sdev;
-		struct comx_channel *sch;
-		struct fr_data *sfr;
-		int slaves = 0;
-
-		len += sprintf(page + len, 
-			"This is a Frame Relay master device\nSlaves: ");
-		for (; dir ; dir = dir->next) {
-			if(!S_ISDIR(dir->mode)) {
-				continue;
-			}
-			if ((sdev = dir->data) && (sch = sdev->priv) && 
-			    (sdev->type == ARPHRD_DLCI) &&
-			    (sfr = sch->LINE_privdata) && 
-			    (sfr->master == dev) && (sdev != dev)) {
-				slaves++;
-				len += sprintf(page + len, "%s ", sdev->name);
-			}
-		}
-		len += sprintf(page + len, "%s\n", slaves ? "" : "(none)");
-		if (fr->keepa_freq) {
-			len += sprintf(page + len, "Line keepalive (value %d) "
-				"status %s [%d]\n", fr->keepa_freq, 
-				ch->line_status & PROTO_LOOP ? "LOOP" :
-				ch->line_status & PROTO_UP ? "UP" : "DOWN", 
-				fr->keepalivecnt);
-		} else {
-			len += sprintf(page + len, "Line keepalive protocol "
-				"is not set\n");
-		}
-	} else {		// if slave
-		len += sprintf(page + len, 
-			"This is a Frame Relay slave device, master: %s\n",
-			fr->master ? fr->master->name : "(not set)");
-	}
-	return len;
-}
-
-static int fr_read_proc(char *page, char **start, off_t off, int count,
-	int *eof, void *data)
-{
-	struct proc_dir_entry *file = (struct proc_dir_entry *)data;
-	struct net_device *dev = file->parent->data;
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = NULL;
-	int len = 0;
-
-	if (ch) {
-		fr = ch->LINE_privdata;
-	}
-
-	if (strcmp(file->name, FILENAME_DLCI) == 0) {
-		len = sprintf(page, "%04d\n", fr->dlci);
-	} else if (strcmp(file->name, FILENAME_MASTER) == 0) {
-		len = sprintf(page, "%-9s\n", fr->master ? fr->master->name :
-			"(none)");
-	} else if (strcmp(file->name, FILENAME_KEEPALIVE) == 0) {
-		len = fr->keepa_freq ? sprintf(page, "% 3d\n", fr->keepa_freq) 
-			: sprintf(page, "off\n");
-	} else {
-		printk(KERN_ERR "comxfr: internal error, filename %s\n", file->name);
-		return -EBADF;
-	}
-
-	if (off >= len) {
-		*eof = 1;
-		return 0;
-	}
-
-	*start = page + off;
-	if (count >= len - off) *eof = 1;
-	return min_t(int, count, len - off);
-}
-
-static int fr_write_proc(struct file *file, const char *buffer, 
-	u_long count, void *data)
-{
-	struct proc_dir_entry *entry = (struct proc_dir_entry *)data;
-	struct net_device *dev = entry->parent->data;
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = NULL; 
-	char *page;
-
-	if (ch) {
-		fr = ch->LINE_privdata;
-	}
-
-	if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
-		return -ENOMEM;
-	}
-
-	if (copy_from_user(page, buffer, count)) {
-		free_page((unsigned long)page);
-		return -EFAULT;
-	}
-	if (*(page + count - 1) == '\n') {
-		*(page + count - 1) = 0;
-	}
-
-	if (strcmp(entry->name, FILENAME_DLCI) == 0) {
-		u16 dlci_new = simple_strtoul(page, NULL, 10);
-
-		if (dlci_new > 1023) {
-			printk(KERN_ERR "Invalid DLCI value\n");
-		}
-		else fr->dlci = dlci_new;
-	} else if (strcmp(entry->name, FILENAME_MASTER) == 0) {
-		struct net_device *new_master = dev_get_by_name(page);
-
-		if (new_master && new_master->type == ARPHRD_FRAD) {
-			struct comx_channel *sch = new_master->priv;
-			struct fr_data *sfr = sch->LINE_privdata;
-
-			if (sfr && sfr->master == new_master) {
-				if(fr->master)
-					dev_put(fr->master);
-				fr->master = new_master;
-				/* Megorokli a master statuszat */
-				ch->line_status = sch->line_status;
-			}
-		}
-	} else if (strcmp(entry->name, FILENAME_KEEPALIVE) == 0) {
-		int keepa_new = -1;
-
-		if (strcmp(page, KEEPALIVE_OFF) == 0) {
-			keepa_new = 0;
-		} else {
-			keepa_new = simple_strtoul(page, NULL, 10);
-		}
-
-		if (keepa_new < 0 || keepa_new > 100) {
-			printk(KERN_ERR "invalid keepalive\n");
-		} else {
-			if (fr->keepa_freq && keepa_new != fr->keepa_freq) {
-				fr_set_keepalive(dev, 0);
-			}
-			if (keepa_new) {
-				fr_set_keepalive(dev, keepa_new);
-			}
-		}
-	} else {
-		printk(KERN_ERR "comxfr_write_proc: internal error, filename %s\n", 
-			entry->name);
-		count = -EBADF;
-	}
-
-	free_page((unsigned long)page);
-	return count;
-}
-
-static int fr_exit(struct net_device *dev) 
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-	struct net_device *sdev = dev;
-	struct comx_channel *sch;
-	struct fr_data *sfr;
-	struct proc_dir_entry *dir = ch->procdir->parent->subdir;
-
-	/* Ha lezarunk egy master-t, le kell kattintani a slave-eket is */
-	if (fr->master && fr->master == dev) {
-		for (; dir ; dir = dir->next) {
-			if(!S_ISDIR(dir->mode)) {
-				continue;
-			}
-			if ((sdev = dir->data) && (sch = sdev->priv) && 
-			    (sdev->type == ARPHRD_DLCI) && 
-			    (sfr = sch->LINE_privdata) && (sfr->master == dev)) {
-				dev_close(sdev);
-				sfr->master = NULL;
-			}
-		}
-	}
-	dev->flags		= 0;
-	dev->type		= 0;
-	dev->mtu		= 0;
-	dev->hard_header_len    = 0;
-
-	ch->LINE_rx	= NULL;
-	ch->LINE_tx	= NULL;
-	ch->LINE_status = NULL;
-	ch->LINE_open	= NULL;
-	ch->LINE_close	= NULL;
-	ch->LINE_xmit	= NULL;
-	ch->LINE_header	= NULL;
-	ch->LINE_rebuild_header	= NULL;
-	ch->LINE_statistics = NULL;
-
-	ch->LINE_status = 0;
-
-	if (fr->master != dev) { // if not master, remove dlci
-		if(fr->master)
-			dev_put(fr->master);
-		remove_proc_entry(FILENAME_DLCI, ch->procdir);
-		remove_proc_entry(FILENAME_MASTER, ch->procdir);
-	} else {
-		if (fr->keepa_freq) {
-			fr_set_keepalive(dev, 0);
-		}
-		remove_proc_entry(FILENAME_KEEPALIVE, ch->procdir);
-		remove_proc_entry(FILENAME_DLCI, ch->procdir);
-	}
-
-	kfree(fr);
-	ch->LINE_privdata = NULL;
-
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static int fr_master_init(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr;
-	struct proc_dir_entry *new_file;
-
-	if ((fr = ch->LINE_privdata = kmalloc(sizeof(struct fr_data), 
-	    GFP_KERNEL)) == NULL) {
-		return -ENOMEM;
-	}
-	memset(fr, 0, sizeof(struct fr_data));
-	fr->master = dev;	// this means master
-	fr->dlci = 0;		// let's say default
-
-	dev->flags	= IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
-	dev->type	= ARPHRD_FRAD;
-	dev->mtu	= 1500;
-	dev->hard_header_len    = 4;		
-	dev->addr_len	= 0;
-
-	ch->LINE_rx	= fr_rx;
-	ch->LINE_tx	= fr_tx;
-	ch->LINE_status = fr_status;
-	ch->LINE_open	= fr_open;
-	ch->LINE_close	= fr_close;
-	ch->LINE_xmit	= fr_xmit;
-	ch->LINE_header	= fr_header;
-	ch->LINE_rebuild_header	= NULL;
-	ch->LINE_statistics = fr_statistics;
-
-	if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		goto cleanup_LINE_privdata;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &fr_read_proc;
-	new_file->write_proc = &fr_write_proc;
-	new_file->size = 5;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_KEEPALIVE, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		goto cleanup_filename_dlci;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &fr_read_proc;
-	new_file->write_proc = &fr_write_proc;
-	new_file->size = 4;
-	new_file->nlink = 1;
-
-	fr_set_keepalive(dev, 0);
-
-	MOD_INC_USE_COUNT;
-	return 0;
-cleanup_filename_dlci:
-	 remove_proc_entry(FILENAME_DLCI, ch->procdir);
-cleanup_LINE_privdata:
-	kfree(fr);
-	return -EIO;
-}
-
-static int fr_slave_init(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr;
-	struct proc_dir_entry *new_file;
-
-	if ((fr = ch->LINE_privdata = kmalloc(sizeof(struct fr_data), 
-	    GFP_KERNEL)) == NULL) {
-		return -ENOMEM;
-	}
-	memset(fr, 0, sizeof(struct fr_data));
-
-	dev->flags	= IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
-	dev->type	= ARPHRD_DLCI;
-	dev->mtu	= 1500;
-	dev->hard_header_len    = 4;		
-	dev->addr_len	= 0;
-
-	ch->LINE_rx	= fr_rx;
-	ch->LINE_tx	= fr_tx;
-	ch->LINE_status = fr_status;
-	ch->LINE_open	= fr_open;
-	ch->LINE_close	= fr_close;
-	ch->LINE_xmit	= fr_xmit;
-	ch->LINE_header	= fr_header;
-	ch->LINE_rebuild_header	= NULL;
-	ch->LINE_statistics = fr_statistics;
-
-	if ((new_file = create_proc_entry(FILENAME_DLCI, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		goto cleanup_LINE_privdata;
-	}
-	
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &fr_read_proc;
-	new_file->write_proc = &fr_write_proc;
-	new_file->size = 5;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_MASTER, S_IFREG | 0644, 
-	    ch->procdir)) == NULL) {
-		goto cleanup_filename_dlci;
-	}
-	new_file->data = (void *)new_file;
-	new_file->read_proc = &fr_read_proc;
-	new_file->write_proc = &fr_write_proc;
-	new_file->size = 10;
-	new_file->nlink = 1;
-	MOD_INC_USE_COUNT;
-	return 0;
-cleanup_filename_dlci:
-         remove_proc_entry(FILENAME_DLCI, ch->procdir);
-cleanup_LINE_privdata:
-	kfree(fr);
-	return -EIO;
-}
-
-static int dlci_open(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-
-	ch->init_status |= HW_OPEN;
-
-	MOD_INC_USE_COUNT;
-	return 0;
-}
-
-static int dlci_close(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-
-	ch->init_status &= ~HW_OPEN;
-
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static int dlci_txe(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct fr_data *fr = ch->LINE_privdata;
-
-	if (!fr->master) {
-		return 0;
-	}
-
-	ch = fr->master->priv;
-	fr = ch->LINE_privdata;
-	return ch->HW_txe(fr->master);
-}
-
-static int dlci_statistics(struct net_device *dev, char *page) 
-{
-	return 0;
-}
-
-static int dlci_init(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-
-	ch->HW_open = dlci_open;
-	ch->HW_close = dlci_close;
-	ch->HW_txe = dlci_txe;
-	ch->HW_statistics = dlci_statistics;
-
-	/* Nincs egyeb hw info, mert ugyis a fr->master-bol fog minden kiderulni */
-
-	MOD_INC_USE_COUNT;
-	return 0;
-}
-
-static int dlci_exit(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-
-	ch->HW_open = NULL;
-	ch->HW_close = NULL;
-	ch->HW_txe = NULL;
-	ch->HW_statistics = NULL;
-
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static int dlci_dump(struct net_device *dev)
-{
-	printk(KERN_INFO "dlci_dump %s, HOGY MI ???\n", dev->name);
-	return -1;
-}
-
-static struct comx_protocol fr_master_protocol = {
-	.name		= "frad", 
-	.version	= VERSION,
-	.encap_type	= ARPHRD_FRAD, 
-	.line_init	= fr_master_init, 
-	.line_exit	= fr_exit, 
-};
-
-static struct comx_protocol fr_slave_protocol = {
-	.name		= "ietf-ip", 
-	.version	= VERSION,
-	.encap_type	= ARPHRD_DLCI, 
-	.line_init	= fr_slave_init, 
-	.line_exit	= fr_exit, 
-};
-
-static struct comx_hardware fr_dlci = { 
-	.name		= "dlci", 
-	.version	= VERSION,
-	.hw_init	= dlci_init, 
-	.hw_exit	= dlci_exit, 
-	.hw_dump	= dlci_dump, 
-};
-
-static int __init comx_proto_fr_init(void)
-{
-	int ret; 
-
-	if ((ret = comx_register_hardware(&fr_dlci))) {
-		return ret;
-	}
-	if ((ret = comx_register_protocol(&fr_master_protocol))) {
-		return ret;
-	}
-	return comx_register_protocol(&fr_slave_protocol);
-}
-
-static void __exit comx_proto_fr_exit(void)
-{
-	comx_unregister_hardware(fr_dlci.name);
-	comx_unregister_protocol(fr_master_protocol.name);
-	comx_unregister_protocol(fr_slave_protocol.name);
-}
-
-module_init(comx_proto_fr_init);
-module_exit(comx_proto_fr_exit);
diff -Nru a/drivers/net/wan/comx-proto-lapb.c b/drivers/net/wan/comx-proto-lapb.c
--- a/drivers/net/wan/comx-proto-lapb.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,551 +0,0 @@
-/*
- * LAPB protocol module for the COMX driver 
- * for Linux kernel 2.2.X
- *
- * Original author: Tivadar Szemethy <tiv@itc.hu>
- * Maintainer: Gergely Madarasz <gorgo@itc.hu>
- *
- * Copyright (C) 1997-1999 (C) ITConsult-Pro Co. <info@itc.hu>
- *
- * 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.
- *
- * Version 0.80 (99/06/14):
- *		- cleaned up the source code a bit
- *		- ported back to kernel, now works as non-module
- *
- * Changed      (00/10/29, Henner Eisen):
- * 		- comx_rx() / comxlapb_data_indication() return status.
- * 
- */
-
-#define VERSION "0.80"
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/netdevice.h>
-#include <linux/proc_fs.h>
-#include <linux/if_arp.h>
-#include <linux/inetdevice.h>
-#include <asm/uaccess.h>
-#include <linux/lapb.h>
-#include <linux/init.h>
-
-#include	"comx.h"
-#include	"comxhw.h"
-
-static struct proc_dir_entry *create_comxlapb_proc_entry(char *name, int mode,
-	int size, struct proc_dir_entry *dir);
-
-static void comxlapb_rx(struct net_device *dev, struct sk_buff *skb) 
-{
-	if (!dev || !dev->priv) {
-		dev_kfree_skb(skb);
-	} else {
-		lapb_data_received(dev, skb);
-	}
-}
-
-static int comxlapb_tx(struct net_device *dev) 
-{
-	netif_wake_queue(dev);
-	return 0;
-}
-
-static int comxlapb_header(struct sk_buff *skb, struct net_device *dev, 
-	unsigned short type, void *daddr, void *saddr, unsigned len) 
-{
-	return dev->hard_header_len;  
-}
-
-static void comxlapb_status(struct net_device *dev, unsigned short status)
-{
-	struct comx_channel *ch;
-
-	if (!dev || !(ch = dev->priv)) {
-		return;
-	}
-	if (status & LINE_UP) {
-		netif_wake_queue(dev);
-	}
-	comx_status(dev, status);
-}
-
-static int comxlapb_open(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	int err = 0;
-
-	if (!(ch->init_status & HW_OPEN)) {
-		return -ENODEV;
-	}
-
-	err = lapb_connect_request(dev);
-
-	if (ch->debug_flags & DEBUG_COMX_LAPB) {
-		comx_debug(dev, "%s: lapb opened, error code: %d\n", 
-			dev->name, err);
-	}
-
-	if (!err) {
-		ch->init_status |= LINE_OPEN;
-		MOD_INC_USE_COUNT;
-	}
-	return err;
-}
-
-static int comxlapb_close(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-
-	if (!(ch->init_status & HW_OPEN)) {
-		return -ENODEV;
-	}
-
-	if (ch->debug_flags & DEBUG_COMX_LAPB) {
-		comx_debug(dev, "%s: lapb closed\n", dev->name);
-	}
-
-	lapb_disconnect_request(dev);
-
-	ch->init_status &= ~LINE_OPEN;
-	ch->line_status &= ~PROTO_UP;
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static int comxlapb_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct sk_buff *skb2;
-
-	if (!dev || !(ch = dev->priv) || !(dev->flags & (IFF_UP | IFF_RUNNING))) {
-		return -ENODEV;
-	}
-
-	if (dev->type == ARPHRD_X25) { // first byte tells what to do 
-		switch(skb->data[0]) {
-			case 0x00:	
-				break;	// transmit
-			case 0x01:	
-				lapb_connect_request(dev);
-				kfree_skb(skb);
-				return 0;
-			case 0x02:	
-				lapb_disconnect_request(dev);
-			default:
-				kfree_skb(skb);
-				return 0;
-		}
-		skb_pull(skb,1);
-	}
-
-	netif_stop_queue(dev);
-	
-	if ((skb2 = skb_clone(skb, GFP_ATOMIC)) != NULL) {
-		lapb_data_request(dev, skb2);
-	}
-
-	return FRAME_ACCEPTED;
-}
-
-static int comxlapb_statistics(struct net_device *dev, char *page) 
-{
-	struct lapb_parms_struct parms;
-	int len = 0;
-
-	len += sprintf(page + len, "Line status: ");
-	if (lapb_getparms(dev, &parms) != LAPB_OK) {
-		len += sprintf(page + len, "not initialized\n");
-		return len;
-	}
-	len += sprintf(page + len, "%s (%s), T1: %d/%d, T2: %d/%d, N2: %d/%d, "
-		"window: %d\n", parms.mode & LAPB_DCE ? "DCE" : "DTE", 
-		parms.mode & LAPB_EXTENDED ? "EXTENDED" : "STANDARD",
-		parms.t1timer, parms.t1, parms.t2timer, parms.t2, 
-		parms.n2count, parms.n2, parms.window);
-
-	return len;
-}
-
-static int comxlapb_read_proc(char *page, char **start, off_t off, int count,
-	int *eof, void *data)
-{
-	struct proc_dir_entry *file = (struct proc_dir_entry *)data;
-	struct net_device *dev = file->parent->data;
-	struct lapb_parms_struct parms;
-	int len = 0;
-
-	if (lapb_getparms(dev, &parms)) {
-		return -ENODEV;
-	}
-
-	if (strcmp(file->name, FILENAME_T1) == 0) {
-		len += sprintf(page + len, "%02u / %02u\n", 
-			parms.t1timer, parms.t1);
-	} else if (strcmp(file->name, FILENAME_T2) == 0) {
-		len += sprintf(page + len, "%02u / %02u\n", 
-			parms.t2timer, parms.t2);
-	} else if (strcmp(file->name, FILENAME_N2) == 0) {
-		len += sprintf(page + len, "%02u / %02u\n", 
-			parms.n2count, parms.n2);
-	} else if (strcmp(file->name, FILENAME_WINDOW) == 0) {
-		len += sprintf(page + len, "%u\n", parms.window);
-	} else if (strcmp(file->name, FILENAME_MODE) == 0) {
-		len += sprintf(page + len, "%s, %s\n", 
-			parms.mode & LAPB_DCE ? "DCE" : "DTE",
-			parms.mode & LAPB_EXTENDED ? "EXTENDED" : "STANDARD");
-	} else {
-		printk(KERN_ERR "comxlapb: internal error, filename %s\n", file->name);
-		return -EBADF;
-	}
-
-	if (off >= len) {
-		*eof = 1;
-		return 0;
-	}
-
-	*start = page + off;
-	if (count >= len - off) {
-		*eof = 1;
-	}
-	return min_t(int, count, len - off);
-}
-
-static int comxlapb_write_proc(struct file *file, const char *buffer, 
-	u_long count, void *data)
-{
-	struct proc_dir_entry *entry = (struct proc_dir_entry *)data;
-	struct net_device *dev = entry->parent->data;
-	struct lapb_parms_struct parms;
-	unsigned long parm;
-	char *page;
-
-	if (lapb_getparms(dev, &parms)) {
-		return -ENODEV;
-	}
-
-	if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
-		return -ENOMEM;
-	}
-
-	if (copy_from_user(page, buffer, count)) {
-		free_page((unsigned long)page);
-		return -EFAULT;
-	}
-	if (*(page + count - 1) == '\n') {
-		*(page + count - 1) = 0;
-	}
-
-	if (strcmp(entry->name, FILENAME_T1) == 0) {
-		parm=simple_strtoul(page,NULL,10);
-		if (parm > 0 && parm < 100) {
-			parms.t1=parm;
-			lapb_setparms(dev, &parms);
-		}
-	} else if (strcmp(entry->name, FILENAME_T2) == 0) {
-		parm=simple_strtoul(page, NULL, 10);
-		if (parm > 0 && parm < 100) {
-			parms.t2=parm;
-			lapb_setparms(dev, &parms);
-		}
-	} else if (strcmp(entry->name, FILENAME_N2) == 0) {
-		parm=simple_strtoul(page, NULL, 10);
-		if (parm > 0 && parm < 100) {
-			parms.n2=parm;
-			lapb_setparms(dev, &parms);
-		}
-	} else if (strcmp(entry->name, FILENAME_WINDOW) == 0) {
-		parms.window = simple_strtoul(page, NULL, 10);
-		lapb_setparms(dev, &parms);
-	} else if (strcmp(entry->name, FILENAME_MODE) == 0) {
-		if (comx_strcasecmp(page, "dte") == 0) {
-			parms.mode &= ~(LAPB_DCE | LAPB_DTE); 
-			parms.mode |= LAPB_DTE;
-		} else if (comx_strcasecmp(page, "dce") == 0) {
-			parms.mode &= ~(LAPB_DTE | LAPB_DCE); 
-			parms.mode |= LAPB_DCE;
-		} else if (comx_strcasecmp(page, "std") == 0 || 
-		    comx_strcasecmp(page, "standard") == 0) {
-			parms.mode &= ~LAPB_EXTENDED; 
-			parms.mode |= LAPB_STANDARD;
-		} else if (comx_strcasecmp(page, "ext") == 0 || 
-		    comx_strcasecmp(page, "extended") == 0) {
-			parms.mode &= ~LAPB_STANDARD; 
-			parms.mode |= LAPB_EXTENDED;
-		}
-		lapb_setparms(dev, &parms);
-	} else {
-		printk(KERN_ERR "comxlapb_write_proc: internal error, filename %s\n", 
-			entry->name);
-		return -EBADF;
-	}
-
-	free_page((unsigned long)page);
-	return count;
-}
-
-static void comxlapb_connected(struct net_device *dev, int reason)
-{
-	struct comx_channel *ch = dev->priv; 
-	struct proc_dir_entry *comxdir = ch->procdir->subdir;
-
-	if (ch->debug_flags & DEBUG_COMX_LAPB) {
-		comx_debug(ch->dev, "%s: lapb connected, reason: %d\n", 
-			ch->dev->name, reason);
-	}
-
-	if (ch->dev->type == ARPHRD_X25) {
-		unsigned char *p;
-		struct sk_buff *skb;
-
-		if ((skb = dev_alloc_skb(1)) == NULL) {
-			printk(KERN_ERR "comxlapb: out of memory!\n");
-			return;
-		}
-		p = skb_put(skb,1);
-		*p = 0x01;		// link established
-		skb->dev = ch->dev;
-		skb->protocol = htons(ETH_P_X25);
-		skb->mac.raw = skb->data;
-		skb->pkt_type = PACKET_HOST;
-
-		netif_rx(skb);
-		ch->dev->last_rx = jiffies;
-	}
-
-	for (; comxdir; comxdir = comxdir->next) {
-		if (strcmp(comxdir->name, FILENAME_MODE) == 0) {
-			comxdir->mode = S_IFREG | 0444;
-		}
-	}
-
-
-	ch->line_status |= PROTO_UP;
-	comx_status(ch->dev, ch->line_status);
-}
-
-static void comxlapb_disconnected(struct net_device *dev, int reason)
-{
-	struct comx_channel *ch = dev->priv; 
-	struct proc_dir_entry *comxdir = ch->procdir->subdir;
-
-	if (ch->debug_flags & DEBUG_COMX_LAPB) {
-		comx_debug(ch->dev, "%s: lapb disconnected, reason: %d\n", 
-			ch->dev->name, reason);
-	}
-
-	if (ch->dev->type == ARPHRD_X25) {
-		unsigned char *p;
-		struct sk_buff *skb;
-
-		if ((skb = dev_alloc_skb(1)) == NULL) {
-			printk(KERN_ERR "comxlapb: out of memory!\n");
-			return;
-		}
-		p = skb_put(skb,1);
-		*p = 0x02;		// link disconnected
-		skb->dev = ch->dev;
-		skb->protocol = htons(ETH_P_X25);
-		skb->mac.raw = skb->data;
-		skb->pkt_type = PACKET_HOST;
-
-		netif_rx(skb);
-		ch->dev->last_rx = jiffies;
-	}
-
-	for (; comxdir; comxdir = comxdir->next) {
-		if (strcmp(comxdir->name, FILENAME_MODE) == 0) {
-			comxdir->mode = S_IFREG | 0644;
-		}
-	}
-	
-	ch->line_status &= ~PROTO_UP;
-	comx_status(ch->dev, ch->line_status);
-}
-
-static int comxlapb_data_indication(struct net_device *dev, struct sk_buff *skb)
-{
-	struct comx_channel *ch = dev->priv; 
-
-	if (ch->dev->type == ARPHRD_X25) {
-		skb_push(skb, 1);
-
-		if (skb_cow(skb, 1))
-			return NET_RX_DROP;
-
-		skb->data[0] = 0;	// indicate data for X25
-		skb->protocol = htons(ETH_P_X25);
-	} else {
-		skb->protocol = htons(ETH_P_IP);
-	}
-
-	skb->dev = ch->dev;
-	skb->mac.raw = skb->data;
-	return comx_rx(ch->dev, skb);
-}
-
-static void comxlapb_data_transmit(struct net_device *dev, struct sk_buff *skb)
-{
-	struct comx_channel *ch = dev->priv; 
-
-	if (ch->HW_send_packet) {
-		ch->HW_send_packet(ch->dev, skb);
-	}
-}
-
-static int comxlapb_exit(struct net_device *dev) 
-{
-	struct comx_channel *ch = dev->priv;
-
-	dev->flags		= 0;
-	dev->type		= 0;
-	dev->mtu		= 0;
-	dev->hard_header_len    = 0;
-
-	ch->LINE_rx	= NULL;
-	ch->LINE_tx	= NULL;
-	ch->LINE_status = NULL;
-	ch->LINE_open	= NULL;
-	ch->LINE_close	= NULL;
-	ch->LINE_xmit	= NULL;
-	ch->LINE_header	= NULL;
-	ch->LINE_statistics = NULL;
-
-	if (ch->debug_flags & DEBUG_COMX_LAPB) {
-		comx_debug(dev, "%s: unregistering lapb\n", dev->name);
-	}
-	lapb_unregister(dev);
-
-	remove_proc_entry(FILENAME_T1, ch->procdir);
-	remove_proc_entry(FILENAME_T2, ch->procdir);
-	remove_proc_entry(FILENAME_N2, ch->procdir);
-	remove_proc_entry(FILENAME_MODE, ch->procdir);
-	remove_proc_entry(FILENAME_WINDOW, ch->procdir);
-
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static int comxlapb_init(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct lapb_register_struct lapbreg;
-
-	dev->mtu		= 1500;
-	dev->hard_header_len    = 4;
-	dev->addr_len		= 0;
-
-	ch->LINE_rx	= comxlapb_rx;
-	ch->LINE_tx	= comxlapb_tx;
-	ch->LINE_status = comxlapb_status;
-	ch->LINE_open	= comxlapb_open;
-	ch->LINE_close	= comxlapb_close;
-	ch->LINE_xmit	= comxlapb_xmit;
-	ch->LINE_header	= comxlapb_header;
-	ch->LINE_statistics = comxlapb_statistics;
-
-	lapbreg.connect_confirmation = comxlapb_connected;
-	lapbreg.connect_indication = comxlapb_connected;
-	lapbreg.disconnect_confirmation = comxlapb_disconnected;
-	lapbreg.disconnect_indication = comxlapb_disconnected;
-	lapbreg.data_indication = comxlapb_data_indication;
-	lapbreg.data_transmit = comxlapb_data_transmit;
-	if (lapb_register(dev, &lapbreg)) {
-		return -ENOMEM;
-	}
-	if (ch->debug_flags & DEBUG_COMX_LAPB) {
-		comx_debug(dev, "%s: lapb registered\n", dev->name);
-	}
-
-	if (!create_comxlapb_proc_entry(FILENAME_T1, 0644, 8, ch->procdir)) {
-		return -ENOMEM;
-	}
-	if (!create_comxlapb_proc_entry(FILENAME_T2, 0644, 8, ch->procdir)) {
-		return -ENOMEM;
-	}
-	if (!create_comxlapb_proc_entry(FILENAME_N2, 0644, 8, ch->procdir)) {
-		return -ENOMEM;
-	}
-	if (!create_comxlapb_proc_entry(FILENAME_MODE, 0644, 14, ch->procdir)) {
-		return -ENOMEM;
-	}
-	if (!create_comxlapb_proc_entry(FILENAME_WINDOW, 0644, 0, ch->procdir)) {
-		return -ENOMEM;
-	}
-
-	MOD_INC_USE_COUNT;
-	return 0;
-}
-
-static int comxlapb_init_lapb(struct net_device *dev) 
-{
-	dev->flags	= IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
-	dev->type	= ARPHRD_LAPB;
-
-	return(comxlapb_init(dev));
-}
-
-static int comxlapb_init_x25(struct net_device *dev)
-{
-	dev->flags		= IFF_NOARP;
-	dev->type		= ARPHRD_X25;
-
-	return(comxlapb_init(dev));
-}
-
-static struct proc_dir_entry *create_comxlapb_proc_entry(char *name, int mode,
-	int size, struct proc_dir_entry *dir)
-{
-	struct proc_dir_entry *new_file;
-
-	if ((new_file = create_proc_entry(name, S_IFREG | mode, dir)) != NULL) {
-		new_file->data = (void *)new_file;
-		new_file->read_proc = &comxlapb_read_proc;
-		new_file->write_proc = &comxlapb_write_proc;
-		new_file->size = size;
-		new_file->nlink = 1;
-	}
-	return(new_file);
-}
-
-static struct comx_protocol comxlapb_protocol = {
-	"lapb", 
-	VERSION,
-	ARPHRD_LAPB, 
-	comxlapb_init_lapb, 
-	comxlapb_exit, 
-	NULL 
-};
-
-static struct comx_protocol comx25_protocol = {
-	"x25", 
-	VERSION,
-	ARPHRD_X25, 
-	comxlapb_init_x25, 
-	comxlapb_exit, 
-	NULL 
-};
-
-static int __init comx_proto_lapb_init(void)
-{
-	int ret;
-
-	if ((ret = comx_register_protocol(&comxlapb_protocol)) != 0) {
-		return ret;
-	}
-	return comx_register_protocol(&comx25_protocol);
-}
-
-static void __exit comx_proto_lapb_exit(void)
-{
-	comx_unregister_protocol(comxlapb_protocol.name);
-	comx_unregister_protocol(comx25_protocol.name);
-}
-
-module_init(comx_proto_lapb_init);
-module_exit(comx_proto_lapb_exit);
-
-MODULE_LICENSE("GPL");
diff -Nru a/drivers/net/wan/comx-proto-ppp.c b/drivers/net/wan/comx-proto-ppp.c
--- a/drivers/net/wan/comx-proto-ppp.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,269 +0,0 @@
-/*
- * Synchronous PPP / Cisco-HDLC driver for the COMX boards
- *
- * Author: Gergely Madarasz <gorgo@itc.hu>
- *
- * based on skeleton code by Tivadar Szemethy <tiv@itc.hu>
- *
- * Copyright (C) 1999 ITConsult-Pro Co. <info@itc.hu>
- *
- * 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.
- *
- *
- * Version 0.10 (99/06/10):
- *		- written the first code :)
- *
- * Version 0.20 (99/06/16):
- *		- added hdlc protocol 
- *		- protocol up is IFF_RUNNING
- *
- * Version 0.21 (99/07/15):
- *		- some small fixes with the line status
- *
- * Version 0.22 (99/08/05):
- *		- don't test IFF_RUNNING but the pp_link_state of the sppp
- * 
- * Version 0.23 (99/12/02):
- *		- tbusy fixes
- *
- */
-
-#define VERSION "0.23"
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/jiffies.h>
-#include <linux/netdevice.h>
-#include <linux/proc_fs.h>
-#include <linux/if_arp.h>
-#include <linux/inetdevice.h>
-#include <asm/uaccess.h>
-#include <linux/init.h>
-
-#include <net/syncppp.h>
-#include	"comx.h"
-
-MODULE_AUTHOR("Author: Gergely Madarasz <gorgo@itc.hu>");
-MODULE_DESCRIPTION("Cisco-HDLC / Synchronous PPP driver for the COMX sync serial boards");
-MODULE_LICENSE("GPL");
-
-static struct comx_protocol syncppp_protocol;
-static struct comx_protocol hdlc_protocol;
-
-struct syncppp_data {
-	struct timer_list status_timer;
-};
-
-static void syncppp_status_timerfun(unsigned long d) {
-	struct net_device *dev=(struct net_device *)d;
-	struct comx_channel *ch=dev->priv;
-	struct syncppp_data *spch=ch->LINE_privdata;
-	struct sppp *sp = (struct sppp *)sppp_of(dev);
-        
-	if(!(ch->line_status & PROTO_UP) && 
-	    (sp->pp_link_state==SPPP_LINK_UP)) {
-    		comx_status(dev, ch->line_status | PROTO_UP);
-	}
-	if((ch->line_status & PROTO_UP) &&
-	    (sp->pp_link_state==SPPP_LINK_DOWN)) {
-	    	comx_status(dev, ch->line_status & ~PROTO_UP);
-	}
-	mod_timer(&spch->status_timer,jiffies + HZ*3);
-}
-
-static int syncppp_tx(struct net_device *dev) 
-{
-	struct comx_channel *ch=dev->priv;
-	
-	if(ch->line_status & LINE_UP) {
-		netif_wake_queue(dev);
-	}
-	return 0;
-}
-
-static void syncppp_status(struct net_device *dev, unsigned short status)
-{
-	status &= ~(PROTO_UP | PROTO_LOOP);
-	if(status & LINE_UP) {
-		netif_wake_queue(dev);
-		sppp_open(dev);
-	} else 	{
-		/* Line went down */
-		netif_stop_queue(dev);
-		sppp_close(dev);
-	}
-	comx_status(dev, status);
-}
-
-static int syncppp_open(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct syncppp_data *spch = ch->LINE_privdata;
-
-	if (!(ch->init_status & HW_OPEN)) return -ENODEV;
-
-	ch->init_status |= LINE_OPEN;
-	ch->line_status &= ~(PROTO_UP | PROTO_LOOP);
-
-	if(ch->line_status & LINE_UP) {
-		sppp_open(dev);
-	}
-
-	init_timer(&spch->status_timer);
-	spch->status_timer.function=syncppp_status_timerfun;
-	spch->status_timer.data=(unsigned long)dev;
-	spch->status_timer.expires=jiffies + HZ*3;
-	add_timer(&spch->status_timer);
-	
-	return 0;
-}
-
-static int syncppp_close(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct syncppp_data *spch = ch->LINE_privdata;
-
-	if (!(ch->init_status & HW_OPEN)) return -ENODEV;
-	del_timer(&spch->status_timer);
-	
-	sppp_close(dev);
-
-	ch->init_status &= ~LINE_OPEN;
-	ch->line_status &= ~(PROTO_UP | PROTO_LOOP);
-
-	return 0;
-}
-
-static int syncppp_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-
-	netif_stop_queue(dev);
-	switch(ch->HW_send_packet(dev, skb)) {
-		case FRAME_QUEUED:
-			netif_wake_queue(dev);
-			break;
-		case FRAME_ACCEPTED:
-		case FRAME_DROPPED:
-			break;
-		case FRAME_ERROR:
-			printk(KERN_ERR "%s: Transmit frame error (len %d)\n", 
-				dev->name, skb->len);
-		break;
-	}
-	return 0;
-}
-
-
-static int syncppp_statistics(struct net_device *dev, char *page) 
-{
-	int len = 0;
-
-	len += sprintf(page + len, " ");
-	return len;
-}
-
-
-static int syncppp_exit(struct net_device *dev) 
-{
-	struct comx_channel *ch = dev->priv;
-
-	sppp_detach(dev);
-
-	dev->flags = 0;
-	dev->type = 0;
-	dev->mtu = 0;
-
-	ch->LINE_rx = NULL;
-	ch->LINE_tx = NULL;
-	ch->LINE_status = NULL;
-	ch->LINE_open = NULL;
-	ch->LINE_close = NULL;
-	ch->LINE_xmit = NULL;
-	ch->LINE_header	= NULL;
-	ch->LINE_rebuild_header	= NULL;
-	ch->LINE_statistics = NULL;
-
-	kfree(ch->LINE_privdata);
-	ch->LINE_privdata = NULL;
-
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
-static int syncppp_init(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct ppp_device *pppdev = (struct ppp_device *)ch->if_ptr;
-
-	ch->LINE_privdata = kmalloc(sizeof(struct syncppp_data), GFP_KERNEL);
-	if (!ch->LINE_privdata)
-		return -ENOMEM;
-
-	pppdev->dev = dev;
-	sppp_attach(pppdev);
-
-	if(ch->protocol == &hdlc_protocol) {
-		pppdev->sppp.pp_flags |= PP_CISCO;
-		dev->type = ARPHRD_HDLC;
-	} else {
-		pppdev->sppp.pp_flags &= ~PP_CISCO;
-		dev->type = ARPHRD_PPP;
-	}
-
-	ch->LINE_rx = sppp_input;
-	ch->LINE_tx = syncppp_tx;
-	ch->LINE_status = syncppp_status;
-	ch->LINE_open = syncppp_open;
-	ch->LINE_close = syncppp_close;
-	ch->LINE_xmit = syncppp_xmit;
-	ch->LINE_header	= NULL;
-	ch->LINE_statistics = syncppp_statistics;
-
-
-	MOD_INC_USE_COUNT;
-	return 0;
-}
-
-static struct comx_protocol syncppp_protocol = {
-	"ppp", 
-	VERSION,
-	ARPHRD_PPP, 
-	syncppp_init, 
-	syncppp_exit, 
-	NULL 
-};
-
-static struct comx_protocol hdlc_protocol = {
-	"hdlc", 
-	VERSION,
-	ARPHRD_PPP, 
-	syncppp_init, 
-	syncppp_exit, 
-	NULL 
-};
-
-static int __init comx_proto_ppp_init(void)
-{
-	int ret;
-
-	ret = comx_register_protocol(&hdlc_protocol);
-	if (!ret) {
-		ret = comx_register_protocol(&syncppp_protocol);
-		if (ret)
-			comx_unregister_protocol(hdlc_protocol.name);
-	}
-	return ret;
-}
-
-static void __exit comx_proto_ppp_exit(void)
-{
-	comx_unregister_protocol(syncppp_protocol.name);
-	comx_unregister_protocol(hdlc_protocol.name);
-}
-
-module_init(comx_proto_ppp_init);
-module_exit(comx_proto_ppp_exit);
diff -Nru a/drivers/net/wan/comx.c b/drivers/net/wan/comx.c
--- a/drivers/net/wan/comx.c	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1128 +0,0 @@
-/*
- * Device driver framework for the COMX line of synchronous serial boards
- * 
- * for Linux kernel 2.2.X / 2.4.X
- *
- * Original authors:  Arpad Bakay <bakay.arpad@synergon.hu>,
- *                    Peter Bajan <bajan.peter@synergon.hu>,
- * Previous maintainer: Tivadar Szemethy <tiv@itc.hu>
- * Current maintainer: Gergely Madarasz <gorgo@itc.hu>
- *
- * Copyright (C) 1995-1999 ITConsult-Pro Co.
- *
- * Contributors:
- * Arnaldo Carvalho de Melo <acme@conectiva.com.br> (0.85)
- *
- * 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.
- *
- * Version 0.80 (99/06/11):
- *		- clean up source code (playing a bit of indent)
- *		- port back to kernel, add support for non-module versions
- *		- add support for board resets when channel protocol is down
- *		- reset the device structure after protocol exit
- *		  the syncppp driver needs it
- *		- add support for /proc/comx/protocols and 
- *		  /proc/comx/boardtypes
- *
- * Version 0.81 (99/06/21):
- *		- comment out the board reset support code, the locomx
- *		  driver seems not buggy now
- *		- printk() levels fixed
- *
- * Version 0.82 (99/07/08):
- *		- Handle stats correctly if the lowlevel driver is
- *		  is not a comx one (locomx - z85230)
- *
- * Version 0.83 (99/07/15):
- *		- reset line_status when interface is down
- *
- * Version 0.84 (99/12/01):
- *		- comx_status should not check for IFF_UP (to report
- *		  line status from dev->open())
- *
- * Version 0.85 (00/08/15):
- * 		- resource release on failure in comx_mkdir
- * 		- fix return value on failure at comx_write_proc
- *
- * Changed      (00/10/29, Henner Eisen):
- * 		- comx_rx() / comxlapb_data_indication() return status.
- */
-
-#define VERSION "0.85"
-
-#include <linux/config.h>
-#include <linux/module.h>
-
-#include <linux/types.h>
-#include <linux/jiffies.h>
-#include <linux/netdevice.h>
-#include <linux/proc_fs.h>
-#include <asm/uaccess.h>
-#include <linux/ctype.h>
-#include <linux/init.h>
-#include <linux/smp_lock.h>
-
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
-#ifndef CONFIG_PROC_FS
-#error For now, COMX really needs the /proc filesystem
-#endif
-
-#include <net/syncppp.h>
-#include "comx.h"
-
-MODULE_AUTHOR("Gergely Madarasz <gorgo@itc.hu>");
-MODULE_DESCRIPTION("Common code for the COMX synchronous serial adapters");
-MODULE_LICENSE("GPL");
-
-static struct comx_hardware *comx_channels = NULL;
-static struct comx_protocol *comx_lines = NULL;
-
-static int comx_mkdir(struct inode *, struct dentry *, int);
-static int comx_rmdir(struct inode *, struct dentry *);
-static struct dentry *comx_lookup(struct inode *, struct dentry *, struct nameidata *);
-
-static struct inode_operations comx_root_inode_ops = {
-	.lookup = comx_lookup,
-	.mkdir = comx_mkdir,
-	.rmdir = comx_rmdir,
-};
-
-static int comx_delete_dentry(struct dentry *dentry);
-static struct proc_dir_entry *create_comx_proc_entry(char *name, int mode,
-	int size, struct proc_dir_entry *dir);
-
-static struct dentry_operations comx_dentry_operations = {
-	.d_delete	= comx_delete_dentry,
-};
-
-
-static struct proc_dir_entry * comx_root_dir;
-
-struct comx_debugflags_struct	comx_debugflags[] = {
-	{ "comx_rx",		DEBUG_COMX_RX		},
-	{ "comx_tx", 		DEBUG_COMX_TX		},
-	{ "hw_tx",		DEBUG_HW_TX		},
-	{ "hw_rx", 		DEBUG_HW_RX		},
-	{ "hdlc_keepalive",	DEBUG_HDLC_KEEPALIVE	},
-	{ "comxppp",		DEBUG_COMX_PPP		},
-	{ "comxlapb",		DEBUG_COMX_LAPB		},
-	{ "dlci",		DEBUG_COMX_DLCI		},
-	{ NULL,			0			} 
-};
-
-
-int comx_debug(struct net_device *dev, char *fmt, ...)
-{
-	struct comx_channel *ch = dev->priv;
-	char *page,*str;
-	va_list args;
-	int len;
-
-	if (!ch->debug_area) return 0;
-
-	if (!(page = (char *)__get_free_page(GFP_ATOMIC))) return -ENOMEM;
-
-	va_start(args, fmt);
-	len = vsprintf(str = page, fmt, args);
-	va_end(args);
-
-	if (len >= PAGE_SIZE) {
-		printk(KERN_ERR "comx_debug: PANIC! len = %d !!!\n", len);
-		free_page((unsigned long)page);
-		return -EINVAL;
-	}
-
-	while (len) {
-		int to_copy;
-		int free = (ch->debug_start - ch->debug_end + ch->debug_size) 
-			% ch->debug_size;
-
-		to_copy = min_t(int, free ? free : ch->debug_size, 
-			      min_t(int, ch->debug_size - ch->debug_end, len));
-		memcpy(ch->debug_area + ch->debug_end, str, to_copy);
-		str += to_copy;
-		len -= to_copy;
-		ch->debug_end = (ch->debug_end + to_copy) % ch->debug_size;
-		if (ch->debug_start == ch->debug_end) // Full ? push start away
-			ch->debug_start = (ch->debug_start + len + 1) % 
-					ch->debug_size;
-		ch->debug_file->size = (ch->debug_end - ch->debug_start +
-					ch->debug_size) % ch->debug_size;
-	} 
-
-	free_page((unsigned long)page);
-	return 0;
-}
-
-int comx_debug_skb(struct net_device *dev, struct sk_buff *skb, char *msg)
-{
-	struct comx_channel *ch = dev->priv;
-
-	if (!ch->debug_area) return 0;
-	if (!skb) comx_debug(dev, "%s: %s NULL skb\n\n", dev->name, msg);
-	if (!skb->len) comx_debug(dev, "%s: %s empty skb\n\n", dev->name, msg);
-
-	return comx_debug_bytes(dev, skb->data, skb->len, msg);
-}
-
-int comx_debug_bytes(struct net_device *dev, unsigned char *bytes, int len, 
-		char *msg)
-{
-	int pos = 0;
-	struct comx_channel *ch = dev->priv;
-
-	if (!ch->debug_area) return 0;
-
-	comx_debug(dev, "%s: %s len %d\n", dev->name, msg, len);
-
-	while (pos != len) {
-		char line[80];
-		int i = 0;
-
-		memset(line, 0, 80);
-		sprintf(line,"%04d ", pos);
-		do {
-			sprintf(line + 5 + (pos % 16) * 3, "%02x", bytes[pos]);
-			sprintf(line + 60 + (pos % 16), "%c", 
-				isprint(bytes[pos]) ? bytes[pos] : '.');
-			pos++;
-		} while (pos != len && pos % 16);
-
-		while ( i++ != 78 ) if (line[i] == 0) line[i] = ' ';
-		line[77] = '\n';
-		line[78] = 0;
-	
-		comx_debug(dev, "%s", line);
-	}
-	comx_debug(dev, "\n");
-	return 0;
-}
-
-static void comx_loadavg_timerfun(unsigned long d)
-{
-	struct net_device *dev = (struct net_device *)d;
-	struct comx_channel *ch = dev->priv;
-
-	ch->avg_bytes[ch->loadavg_counter] = ch->current_stats->rx_bytes;
-	ch->avg_bytes[ch->loadavg_counter + ch->loadavg_size] = 
-		ch->current_stats->tx_bytes;
-
-	ch->loadavg_counter = (ch->loadavg_counter + 1) % ch->loadavg_size;
-
-	mod_timer(&ch->loadavg_timer,jiffies + HZ * ch->loadavg[0]);
-}
-
-#if 0
-static void comx_reset_timerfun(unsigned long d)
-{ 
-	struct net_device *dev = (struct net_device *)d;
-	struct comx_channel *ch = dev->priv;
-
-	if(!(ch->line_status & (PROTO_LOOP | PROTO_UP))) {
-		if(test_and_set_bit(0,&ch->reset_pending) && ch->HW_reset) {
-			ch->HW_reset(dev);
-		}
-	}
-
-	mod_timer(&ch->reset_timer, jiffies + HZ * ch->reset_timeout);
-}
-#endif                                            
-
-static int comx_open(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct proc_dir_entry *comxdir = ch->procdir->subdir;
-	int ret=0;
-
-	if (!ch->protocol || !ch->hardware) return -ENODEV;
-
-	if ((ret = ch->HW_open(dev))) return ret;
-	if ((ret = ch->LINE_open(dev))) { 
-		ch->HW_close(dev); 
-		return ret; 
-	};
-
-	for (; comxdir ; comxdir = comxdir->next) {
-		if (strcmp(comxdir->name, FILENAME_HARDWARE) == 0 ||
-		   strcmp(comxdir->name, FILENAME_PROTOCOL) == 0)
-			comxdir->mode = S_IFREG | 0444;
-	}
-
-#if 0
-	ch->reset_pending = 1;
-	ch->reset_timeout = 30;
-	ch->reset_timer.function = comx_reset_timerfun;
-	ch->reset_timer.data = (unsigned long)dev;
-	ch->reset_timer.expires = jiffies + HZ * ch->reset_timeout;
-	add_timer(&ch->reset_timer);
-#endif
-
-	return 0;
-}
-
-static int comx_close(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	struct proc_dir_entry *comxdir = ch->procdir->subdir;
-	int ret = -ENODEV;
-
-	if (test_and_clear_bit(0, &ch->lineup_pending)) {
-		del_timer(&ch->lineup_timer);
-	}
-
-#if 0	
-	del_timer(&ch->reset_timer);
-#endif
-
-	if (ch->init_status & LINE_OPEN && ch->protocol && ch->LINE_close) {
-		ret = ch->LINE_close(dev);
-	}
-
-	if (ret) return ret;
-
-	if (ch->init_status & HW_OPEN && ch->hardware && ch->HW_close) {
-		ret = ch->HW_close(dev);
-	}
-	
-	ch->line_status=0;
-
-	for (; comxdir ; comxdir = comxdir->next) {
-		if (strcmp(comxdir->name, FILENAME_HARDWARE) == 0 ||
-		    strcmp(comxdir->name, FILENAME_PROTOCOL) == 0)
-			comxdir->mode = S_IFREG | 0644;
-	}
-
-	return ret;
-}
-
-void comx_status(struct net_device *dev, int status)
-{
-	struct comx_channel *ch = dev->priv;
-
-#if 0
-	if(status & (PROTO_UP | PROTO_LOOP)) {
-		clear_bit(0,&ch->reset_pending);
-	}
-#endif
-
-	printk(KERN_NOTICE "Interface %s: modem status %s, line protocol %s\n",
-		    dev->name, status & LINE_UP ? "UP" : "DOWN", 
-		    status & PROTO_LOOP ? "LOOP" : status & PROTO_UP ? 
-		    "UP" : "DOWN");
-	
-	ch->line_status = status;
-}
-
-static int comx_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-	int rc;
-
-	if (skb->len > dev->mtu + dev->hard_header_len) {
-		printk(KERN_ERR "comx_xmit: %s: skb->len %d > dev->mtu %d\n", dev->name,
-		(int)skb->len, dev->mtu);
-	}
-	
-	if (ch->debug_flags & DEBUG_COMX_TX) {
-		comx_debug_skb(dev, skb, "comx_xmit skb");
-	}
-	
-	rc=ch->LINE_xmit(skb, dev);
-//	if (!rc) dev_kfree_skb(skb);
-
-	return rc;
-}
-
-static int comx_header(struct sk_buff *skb, struct net_device *dev, 
-	unsigned short type, void *daddr, void *saddr, unsigned len) 
-{
-	struct comx_channel *ch = dev->priv;
-
-	if (ch->LINE_header) {
-		return (ch->LINE_header(skb, dev, type, daddr, saddr, len));
-	} else {
-		return 0;
-	}
-}
-
-static int comx_rebuild_header(struct sk_buff *skb) 
-{
-	struct net_device *dev = skb->dev;
-	struct comx_channel *ch = dev->priv;
-
-	if (ch->LINE_rebuild_header) {
-		return(ch->LINE_rebuild_header(skb));
-	} else {
-		return 0;
-	}
-}
-
-int comx_rx(struct net_device *dev, struct sk_buff *skb)
-{
-	struct comx_channel *ch = dev->priv;
-
-	if (ch->debug_flags & DEBUG_COMX_RX) {
-		comx_debug_skb(dev, skb, "comx_rx skb");
-	}
-	if (skb) {
-		netif_rx(skb);
-		dev->last_rx = jiffies;
-	}
-	return 0;
-}
-
-static struct net_device_stats *comx_stats(struct net_device *dev)
-{
-	struct comx_channel *ch = dev->priv;
-
-	return ch->current_stats;
-}
-
-void comx_lineup_func(unsigned long d)
-{
-	struct net_device *dev = (struct net_device *)d;
-	struct comx_channel *ch = dev->priv;
-
-	del_timer(&ch->lineup_timer);
-	clear_bit(0, &ch->lineup_pending);
-
-	if (ch->LINE_status) {
-		ch->LINE_status(dev, ch->line_status |= LINE_UP);
-	}
-}
-
-#define LOADAVG(avg, off) (int) \
-	((ch->avg_bytes[(ch->loadavg_counter - 1 + ch->loadavg_size * 2) \
-	% ch->loadavg_size + off] -  ch->avg_bytes[(ch->loadavg_counter - 1 \
-		- ch->loadavg[avg] / ch->loadavg[0] + ch->loadavg_size * 2) \
-		% ch->loadavg_size + off]) / ch->loadavg[avg] * 8)
-
-static int comx_statistics(struct net_device *dev, char *page)
-{
-	struct comx_channel *ch = dev->priv;
-	int len = 0;
-	int tmp;
-	int i = 0;
-	char tmpstr[20];
-	int tmpstrlen = 0;
-
-	len += sprintf(page + len, "Interface administrative status is %s, "
-		"modem status is %s, protocol is %s\n", 
-		dev->flags & IFF_UP ? "UP" : "DOWN",
-		ch->line_status & LINE_UP ? "UP" : "DOWN",
-		ch->line_status & PROTO_LOOP ? "LOOP" : 
-		ch->line_status & PROTO_UP ? "UP" : "DOWN");
-	len += sprintf(page + len, "Modem status changes: %lu, Transmitter status "
-		"is %s, tbusy: %d\n", ch->current_stats->tx_carrier_errors, ch->HW_txe ? 
-		ch->HW_txe(dev) ? "IDLE" : "BUSY" : "NOT READY", netif_running(dev));
-	len += sprintf(page + len, "Interface load (input): %d / %d / %d bits/s (",
-		LOADAVG(0,0), LOADAVG(1, 0), LOADAVG(2, 0));
-	tmpstr[0] = 0;
-	for (i=0; i != 3; i++) {
-		char tf;
-
-		tf = ch->loadavg[i] % 60 == 0 && 
-			ch->loadavg[i] / 60 > 0 ? 'm' : 's';
-		tmpstrlen += sprintf(tmpstr + tmpstrlen, "%d%c%s", 
-			ch->loadavg[i] / (tf == 'm' ? 60 : 1), tf, 
-			i == 2 ? ")\n" : "/");
-	}
-	len += sprintf(page + len, 
-		"%s              (output): %d / %d / %d bits/s (%s", tmpstr, 
-		LOADAVG(0,ch->loadavg_size), LOADAVG(1, ch->loadavg_size), 
-		LOADAVG(2, ch->loadavg_size), tmpstr);
-
-	len += sprintf(page + len, "Debug flags: ");
-	tmp = len; i = 0;
-	while (comx_debugflags[i].name) {
-		if (ch->debug_flags & comx_debugflags[i].value) 
-			len += sprintf(page + len, "%s ", 
-				comx_debugflags[i].name);
-		i++;
-	}
-	len += sprintf(page + len, "%s\n", tmp == len ? "none" : "");
-
-	len += sprintf(page + len, "RX errors: len: %lu, overrun: %lu, crc: %lu, "
-		"aborts: %lu\n           buffer overrun: %lu, pbuffer overrun: %lu\n"
-		"TX errors: underrun: %lu\n",
-		ch->current_stats->rx_length_errors, ch->current_stats->rx_over_errors, 
-		ch->current_stats->rx_crc_errors, ch->current_stats->rx_frame_errors, 
-		ch->current_stats->rx_missed_errors, ch->current_stats->rx_fifo_errors,
-		ch->current_stats->tx_fifo_errors);
-
-	if (ch->LINE_statistics && (ch->init_status & LINE_OPEN)) {
-		len += ch->LINE_statistics(dev, page + len);
-	} else {
-		len += sprintf(page+len, "Line status: driver not initialized\n");
-	}
-	if (ch->HW_statistics && (ch->init_status & HW_OPEN)) {
-		len += ch->HW_statistics(dev, page + len);
-	} else {
-		len += sprintf(page+len, "Board status: driver not initialized\n");
-	}
-
-	return len;
-}
-
-static int comx_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
-	struct comx_channel *ch = dev->priv;
-
-	if (ch->LINE_ioctl) {
-		return(ch->LINE_ioctl(dev, ifr, cmd));
-	}
-	return -EINVAL;
-}
-
-static void comx_reset_dev(struct net_device *dev)
-{
-	dev->open = comx_open;
-	dev->stop = comx_close;
-	dev->hard_start_xmit = comx_xmit;
-	dev->hard_header = comx_header;
-	dev->rebuild_header = comx_rebuild_header;
-	dev->get_stats = comx_stats;
-	dev->do_ioctl = comx_ioctl;
-	dev->change_mtu = NULL;
-	dev->tx_queue_len = 20;
-	dev->flags = IFF_NOARP;
-}
-
-static int comx_init_dev(struct net_device *dev)
-{
-	struct comx_channel *ch;
-
-	if ((ch = kmalloc(sizeof(struct comx_channel), GFP_KERNEL)) == NULL) {
-		return -ENOMEM;
-	}
-	memset(ch, 0, sizeof(struct comx_channel));
-
-	ch->loadavg[0] = 5;
-	ch->loadavg[1] = 300;
-	ch->loadavg[2] = 900;
-	ch->loadavg_size = ch->loadavg[2] / ch->loadavg[0] + 1; 
-	if ((ch->avg_bytes = kmalloc(ch->loadavg_size * 
-		sizeof(unsigned long) * 2, GFP_KERNEL)) == NULL) {
-		kfree(ch);
-		return -ENOMEM;
-	}
-
-	memset(ch->avg_bytes, 0, ch->loadavg_size * sizeof(unsigned long) * 2);
-	ch->loadavg_counter = 0;
-	ch->loadavg_timer.function = comx_loadavg_timerfun;
-	ch->loadavg_timer.data = (unsigned long)dev;
-	ch->loadavg_timer.expires = jiffies + HZ * ch->loadavg[0];
-	add_timer(&ch->loadavg_timer);
-
-	dev->priv = (void *)ch;
-	ch->dev = dev;
-	ch->line_status &= ~LINE_UP;
-
-	ch->current_stats = &ch->stats;
-
-	comx_reset_dev(dev);
-	return 0;
-}
-
-static int comx_read_proc(char *page, char **start, off_t off, int count, 
-	int *eof, void *data)
-{
-	struct proc_dir_entry *file = (struct proc_dir_entry *)data;
-	struct net_device *dev = file->parent->data;
-	struct comx_channel *ch = dev->priv;
-	int len = 0;
-
-	if (strcmp(file->name, FILENAME_STATUS) == 0) {
-		len = comx_statistics(dev, page);
-	} else if (strcmp(file->name, FILENAME_HARDWARE) == 0) {
-		len = sprintf(page, "%s\n", ch->hardware ? 
-			ch->hardware->name : HWNAME_NONE);
-	} else if (strcmp(file->name, FILENAME_PROTOCOL) == 0) {
-		len = sprintf(page, "%s\n", ch->protocol ? 
-			ch->protocol->name : PROTONAME_NONE);
-	} else if (strcmp(file->name, FILENAME_LINEUPDELAY) == 0) {
-		len = sprintf(page, "%01d\n", ch->lineup_delay);
-	}
-
-	if (off >= len) {
-		*eof = 1;
-		return 0;
-	}
-
-	*start = page + off;
-	if (count >= len - off) {
-		*eof = 1;
-	}
-	return min_t(int, count, len - off);
-}
-
-
-static int comx_root_read_proc(char *page, char **start, off_t off, int count, 
-	int *eof, void *data)
-{
-	struct proc_dir_entry *file = (struct proc_dir_entry *)data;
-	struct comx_hardware *hw;
-	struct comx_protocol *line;
-
-	int len = 0;
-
-	if (strcmp(file->name, FILENAME_HARDWARELIST) == 0) {
-		for(hw=comx_channels;hw;hw=hw->next) 
-			len+=sprintf(page+len, "%s\n", hw->name);
-	} else if (strcmp(file->name, FILENAME_PROTOCOLLIST) == 0) {
-		for(line=comx_lines;line;line=line->next)
-			len+=sprintf(page+len, "%s\n", line->name);
-	}
-
-	if (off >= len) {
-		*eof = 1;
-		return 0;
-	}
-
-	*start = page + off;
-	if (count >= len - off) {
-		*eof = 1;
-	}
-	return min_t(int, count, len - off);
-}
-
-
-
-static int comx_write_proc(struct file *file, const char *buffer, u_long count,
-	void *data)
-{
-	struct proc_dir_entry *entry = (struct proc_dir_entry *)data;
-	struct net_device *dev = (struct net_device *)entry->parent->data;
-	struct comx_channel *ch = dev->priv;
-	char *page;
-	struct comx_hardware *hw = comx_channels;
-	struct comx_protocol *line = comx_lines;
-	int ret=0;
-
-	if (count > PAGE_SIZE) {
-		printk(KERN_ERR "count is %lu > %d!!!\n", count, (int)PAGE_SIZE);
-		return -ENOSPC;
-	}
-
-	if (!(page = (char *)__get_free_page(GFP_KERNEL))) return -ENOMEM;
-
-	if(copy_from_user(page, buffer, count))
-	{
-		count = -EFAULT;
-		goto out;
-	}
-
-	if (page[count-1] == '\n')
-		page[count-1] = '\0';
-	else if (count < PAGE_SIZE)
-		page[count] = '\0';
-	else if (page[count]) {
-		count = -EINVAL;
-		goto out;
-	}
-
-	if (strcmp(entry->name, FILENAME_DEBUG) == 0) {
-		int i;
-		int ret = 0;
-
-		if ((i = simple_strtoul(page, NULL, 10)) != 0) {
-			unsigned long flags;
-
-			save_flags(flags); cli();
-			if (ch->debug_area) kfree(ch->debug_area);
-			if ((ch->debug_area = kmalloc(ch->debug_size = i, 
-				GFP_KERNEL)) == NULL) {
-				ret = -ENOMEM;
-			}
-			ch->debug_start = ch->debug_end = 0;
-			restore_flags(flags);
-			free_page((unsigned long)page);
-			return ret ? ret : count;
-		}
-		
-		if (*page != '+' && *page != '-') {
-			free_page((unsigned long)page);
-			return -EINVAL;
-		}
-		while (comx_debugflags[i].value && 
-			strncmp(comx_debugflags[i].name, page + 1, 
-			strlen(comx_debugflags[i].name))) {
-			i++;
-		}
-	
-		if (comx_debugflags[i].value == 0) {
-			printk(KERN_ERR "Invalid debug option\n");
-			free_page((unsigned long)page);
-			return -EINVAL;
-		}
-		if (*page == '+') {
-			ch->debug_flags |= comx_debugflags[i].value;
-		} else {
-			ch->debug_flags &= ~comx_debugflags[i].value;
-		}
-	} else if (strcmp(entry->name, FILENAME_HARDWARE) == 0) {
-		if(strlen(page)>10) {
-			free_page((unsigned long)page);
-			return -EINVAL;
-		}
-		while (hw) { 
-			if (strcmp(hw->name, page) == 0) {
-				break;
-			} else {
-				hw = hw->next;
-			}
-		}
-#ifdef CONFIG_KMOD
-		if(!hw && comx_strcasecmp(HWNAME_NONE,page) != 0){
-			request_module("comx-hw-%s",page);
-		}		
-		hw=comx_channels;
-		while (hw) {
-			if (comx_strcasecmp(hw->name, page) == 0) {
-				break;
-			} else {
-				hw = hw->next;
-			}
-		}
-#endif
-
-		if (comx_strcasecmp(HWNAME_NONE, page) != 0 && !hw)  {
-			free_page((unsigned long)page);
-			return -ENODEV;
-		}
-		if (ch->init_status & HW_OPEN) {
-			free_page((unsigned long)page);
-			return -EBUSY;
-		}
-		if (ch->hardware && ch->hardware->hw_exit && 
-		   (ret=ch->hardware->hw_exit(dev))) {
-			free_page((unsigned long)page);
-			return ret;
-		}
-		ch->hardware = hw;
-		entry->size = strlen(page) + 1;
-		if (hw && hw->hw_init) hw->hw_init(dev);
-	} else if (strcmp(entry->name, FILENAME_PROTOCOL) == 0) {
-		if(strlen(page)>10) {
-			free_page((unsigned long)page);
-			return -EINVAL;
-		}
-		while (line) {
-			if (comx_strcasecmp(line->name, page) == 0) {
-				break;
-			} else {
-				line = line->next;
-			}
-		}
-#ifdef CONFIG_KMOD
-		if(!line && comx_strcasecmp(PROTONAME_NONE, page) != 0) {
-			request_module("comx-proto-%s",page);
-		}		
-		line=comx_lines;
-		while (line) {
-			if (comx_strcasecmp(line->name, page) == 0) {
-				break;
-			} else {
-				line = line->next;
-			}
-		}
-#endif
-		
-		if (comx_strcasecmp(PROTONAME_NONE, page) != 0 && !line) {
-			free_page((unsigned long)page);
-			return -ENODEV;
-		}
-		
-		if (ch->init_status & LINE_OPEN) {
-			free_page((unsigned long)page);
-			return -EBUSY;
-		}
-		
-		if (ch->protocol && ch->protocol->line_exit && 
-		    (ret=ch->protocol->line_exit(dev))) {
-			free_page((unsigned long)page);
-			return ret;
-		}
-		ch->protocol = line;
-		entry->size = strlen(page) + 1;
-		comx_reset_dev(dev);
-		if (line && line->line_init) line->line_init(dev);
-	} else if (strcmp(entry->name, FILENAME_LINEUPDELAY) == 0) {
-		int i;
-
-		if ((i = simple_strtoul(page, NULL, 10)) != 0) {
-			if (i >=0 && i < 10) { 
-				ch->lineup_delay = i; 
-			} else {
-				printk(KERN_ERR "comx: invalid lineup_delay value\n");
-			}
-		}
-	}
-out:
-	free_page((unsigned long)page);
-	return count;
-}
-
-static int comx_mkdir(struct inode *dir, struct dentry *dentry, int mode)
-{
-	struct proc_dir_entry *new_dir, *debug_file;
-	struct net_device *dev;
-	struct comx_channel *ch;
-	int ret = -EIO;
-
-	if ((dev = kmalloc(sizeof(struct net_device), GFP_KERNEL)) == NULL) {
-		return -ENOMEM;
-	}
-	memset(dev, 0, sizeof(struct net_device));
-
-	lock_kernel();
-	if ((new_dir = create_proc_entry(dentry->d_name.name, mode | S_IFDIR, 
-		comx_root_dir)) == NULL) {
-		goto cleanup_dev;
-	}
-
-	new_dir->nlink = 2;
-	new_dir->data = NULL; // ide jon majd a struct dev
-
-	/* Ezek kellenek */
-	if (!create_comx_proc_entry(FILENAME_HARDWARE, 0644, 
-	    strlen(HWNAME_NONE) + 1, new_dir)) {
-		goto cleanup_new_dir;
-	}
-	if (!create_comx_proc_entry(FILENAME_PROTOCOL, 0644, 
-	    strlen(PROTONAME_NONE) + 1, new_dir)) {
-		goto cleanup_filename_hardware;
-	}
-	if (!create_comx_proc_entry(FILENAME_STATUS, 0444, 0, new_dir)) {
-		goto cleanup_filename_protocol;
-	}
-	if (!create_comx_proc_entry(FILENAME_LINEUPDELAY, 0644, 2, new_dir)) {
-		goto cleanup_filename_status;
-	}
-
-	if ((debug_file = create_proc_entry(FILENAME_DEBUG, 
-	    S_IFREG | 0644, new_dir)) == NULL) {
-		goto cleanup_filename_lineupdelay;
-	}
-	debug_file->data = (void *)debug_file; 
-	debug_file->read_proc = NULL; // see below
-	debug_file->write_proc = &comx_write_proc;
-	debug_file->nlink = 1;
-
-	strcpy(dev->name, (char *)new_dir->name);
-	dev->init = comx_init_dev;
-
-	if (register_netdevice(dev)) {
-		goto cleanup_filename_debug;
-	}
-	ch = dev->priv;
-	if((ch->if_ptr = (void *)kmalloc(sizeof(struct ppp_device), 
-				 GFP_KERNEL)) == NULL) {
-		goto cleanup_register;
-	}
-	memset(ch->if_ptr, 0, sizeof(struct ppp_device));
-	ch->debug_file = debug_file; 
-	ch->procdir = new_dir;
-	new_dir->data = dev;
-
-	ch->debug_start = ch->debug_end = 0;
-	if ((ch->debug_area = kmalloc(ch->debug_size = DEFAULT_DEBUG_SIZE, 
-	    GFP_KERNEL)) == NULL) {
-		ret = -ENOMEM;
-		goto cleanup_if_ptr;
-	}
-
-	ch->lineup_delay = DEFAULT_LINEUP_DELAY;
-
-	MOD_INC_USE_COUNT;
-	unlock_kernel();
-	return 0;
-cleanup_if_ptr:
-	kfree(ch->if_ptr);
-cleanup_register:
-	unregister_netdevice(dev);
-cleanup_filename_debug:
-	remove_proc_entry(FILENAME_DEBUG, new_dir);
-cleanup_filename_lineupdelay:
-	remove_proc_entry(FILENAME_LINEUPDELAY, new_dir);
-cleanup_filename_status:
-	remove_proc_entry(FILENAME_STATUS, new_dir);
-cleanup_filename_protocol:
-	remove_proc_entry(FILENAME_PROTOCOL, new_dir);
-cleanup_filename_hardware:
-	remove_proc_entry(FILENAME_HARDWARE, new_dir);
-cleanup_new_dir:
-	remove_proc_entry(dentry->d_name.name, comx_root_dir);
-cleanup_dev:
-	kfree(dev);
-	unlock_kernel();
-	return ret;
-}
-
-static int comx_rmdir(struct inode *dir, struct dentry *dentry)
-{
-	struct proc_dir_entry *entry = PDE(dentry->d_inode);
-	struct net_device *dev;
-	struct comx_channel *ch;
-	int ret;
-
-	lock_kernel();
-	dev = entry->data;
-	ch = dev->priv;
-	if (dev->flags & IFF_UP) {
-		printk(KERN_ERR "%s: down interface before removing it\n", dev->name);
-		unlock_kernel();
-		return -EBUSY;
-	}
-
-	if (ch->protocol && ch->protocol->line_exit && 
-	    (ret=ch->protocol->line_exit(dev))) {
-		unlock_kernel();
-		return ret;
-	}
-	if (ch->hardware && ch->hardware->hw_exit && 
-	   (ret=ch->hardware->hw_exit(dev))) { 
-		if(ch->protocol && ch->protocol->line_init) {
-			ch->protocol->line_init(dev);
-		}
-		unlock_kernel();
-		return ret;
-	}
-	ch->protocol = NULL;
-	ch->hardware = NULL;
-
-	del_timer(&ch->loadavg_timer);
-	kfree(ch->avg_bytes);
-
-	unregister_netdev(dev);
-	if (ch->debug_area) {
-		kfree(ch->debug_area);
-	}
-	if (dev->priv) {
-		kfree(dev->priv);
-	}
-	free_netdev(dev);
-
-	remove_proc_entry(FILENAME_DEBUG, entry);
-	remove_proc_entry(FILENAME_LINEUPDELAY, entry);
-	remove_proc_entry(FILENAME_STATUS, entry);
-	remove_proc_entry(FILENAME_HARDWARE, entry);
-	remove_proc_entry(FILENAME_PROTOCOL, entry);
-	remove_proc_entry(dentry->d_name.name, comx_root_dir);
-
-	MOD_DEC_USE_COUNT;
-	unlock_kernel();
-	return 0;
-}
-
-static struct dentry *comx_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
-{
-	struct proc_dir_entry *de;
-	struct inode *inode = NULL;
-
-	lock_kernel();
-	if ((de = PDE(dir)) != NULL) {
-		for (de = de->subdir ; de ; de = de->next) {
-			if ((de->namelen == dentry->d_name.len) &&
-			    (memcmp(dentry->d_name.name, de->name, 
-			    de->namelen) == 0))	{
-			 	if ((inode = proc_get_inode(dir->i_sb, 
-			 	    de->low_ino, de)) == NULL) { 
-			 		printk(KERN_ERR "COMX: lookup error\n"); 
-					unlock_kernel();
-			 		return ERR_PTR(-EINVAL); 
-			 	}
-				break;
-			}
-		}
-	}
-	unlock_kernel();
-	dentry->d_op = &comx_dentry_operations;
-	d_add(dentry, inode);
-	return NULL;
-}
-
-int comx_strcasecmp(const char *cs, const char *ct)
-{
-	register signed char __res;
-
-	while (1) {
-		if ((__res = toupper(*cs) - toupper(*ct++)) != 0 || !*cs++) {
-			break;
-		}
-	}
-	return __res;
-}
-
-static int comx_delete_dentry(struct dentry *dentry)
-{
-	return 1;
-}
-
-static struct proc_dir_entry *create_comx_proc_entry(char *name, int mode,
-	int size, struct proc_dir_entry *dir)
-{
-	struct proc_dir_entry *new_file;
-
-	if ((new_file = create_proc_entry(name, S_IFREG | mode, dir)) != NULL) {
-		new_file->data = (void *)new_file;
-		new_file->read_proc = &comx_read_proc;
-		new_file->write_proc = &comx_write_proc;
-		new_file->size = size;
-		new_file->nlink = 1;
-	}
-	return(new_file);
-}
-
-int comx_register_hardware(struct comx_hardware *comx_hw)
-{
-	struct comx_hardware *hw = comx_channels;
-
-	if (!hw) {
-		comx_channels = comx_hw;
-	} else {
-		while (hw->next != NULL && strcmp(comx_hw->name, hw->name) != 0) {
-			hw = hw->next;
-		}
-		if (strcmp(comx_hw->name, hw->name) == 0) {
-			return -1;
-		}
-		hw->next = comx_hw;
-	}
-
-	printk(KERN_INFO "COMX: driver for hardware type %s, version %s\n", comx_hw->name, comx_hw->version);
-	return 0;
-}
-
-int comx_unregister_hardware(char *name)
-{
-	struct comx_hardware *hw = comx_channels;
-
-	if (!hw) {
-		return -1;
-	}
-
-	if (strcmp(hw->name, name) == 0) {
-		comx_channels = comx_channels->next;
-		return 0;
-	}
-
-	while (hw->next != NULL && strcmp(hw->next->name,name) != 0) {
-		hw = hw->next;
-	}
-
-	if (hw->next != NULL && strcmp(hw->next->name, name) == 0) {
-		hw->next = hw->next->next;
-		return 0;
-	}
-	return -1;
-}
-
-int comx_register_protocol(struct comx_protocol *comx_line)
-{
-	struct comx_protocol *pr = comx_lines;
-
-	if (!pr) {
-		comx_lines = comx_line;
-	} else {
-		while (pr->next != NULL && strcmp(comx_line->name, pr->name) !=0) {
-			pr = pr->next;
-		}
-		if (strcmp(comx_line->name, pr->name) == 0) {
-			return -1;
-		}
-		pr->next = comx_line;
-	}
-
-	printk(KERN_INFO "COMX: driver for protocol type %s, version %s\n", comx_line->name, comx_line->version);
-	return 0;
-}
-
-int comx_unregister_protocol(char *name)
-{
-	struct comx_protocol *pr = comx_lines;
-
-	if (!pr) {
-		return -1;
-	}
-
-	if (strcmp(pr->name, name) == 0) {
-		comx_lines = comx_lines->next;
-		return 0;
-	}
-
-	while (pr->next != NULL && strcmp(pr->next->name,name) != 0) {
-		pr = pr->next;
-	}
-
-	if (pr->next != NULL && strcmp(pr->next->name, name) == 0) {
-		pr->next = pr->next->next;
-		return 0;
-	}
-	return -1;
-}
-
-static int __init comx_init(void)
-{
-	struct proc_dir_entry *new_file;
-
-	comx_root_dir = create_proc_entry("comx", 
-		S_IFDIR | S_IWUSR | S_IRUGO | S_IXUGO, &proc_root);
-	if (!comx_root_dir)
-		return -ENOMEM;
-	comx_root_dir->proc_iops = &comx_root_inode_ops;
-
-	if ((new_file = create_proc_entry(FILENAME_HARDWARELIST, 
-	   S_IFREG | 0444, comx_root_dir)) == NULL) {
-		return -ENOMEM;
-	}
-	
-	new_file->data = new_file;
-	new_file->read_proc = &comx_root_read_proc;
-	new_file->write_proc = NULL;
-	new_file->nlink = 1;
-
-	if ((new_file = create_proc_entry(FILENAME_PROTOCOLLIST, 
-	   S_IFREG | 0444, comx_root_dir)) == NULL) {
-		return -ENOMEM;
-	}
-	
-	new_file->data = new_file;
-	new_file->read_proc = &comx_root_read_proc;
-	new_file->write_proc = NULL;
-	new_file->nlink = 1;
-
-
-	printk(KERN_INFO "COMX: driver version %s (C) 1995-1999 ITConsult-Pro Co. <info@itc.hu>\n", 
-		VERSION);
-	return 0;
-}
-
-static void __exit comx_exit(void)
-{
-	remove_proc_entry(FILENAME_HARDWARELIST, comx_root_dir);
-	remove_proc_entry(FILENAME_PROTOCOLLIST, comx_root_dir);
-	remove_proc_entry(comx_root_dir->name, &proc_root);
-}
-
-module_init(comx_init);
-module_exit(comx_exit);
-
-EXPORT_SYMBOL(comx_register_hardware);
-EXPORT_SYMBOL(comx_unregister_hardware);
-EXPORT_SYMBOL(comx_register_protocol);
-EXPORT_SYMBOL(comx_unregister_protocol);
-EXPORT_SYMBOL(comx_debug_skb);
-EXPORT_SYMBOL(comx_debug_bytes);
-EXPORT_SYMBOL(comx_debug);
-EXPORT_SYMBOL(comx_lineup_func);
-EXPORT_SYMBOL(comx_status);
-EXPORT_SYMBOL(comx_rx);
-EXPORT_SYMBOL(comx_strcasecmp);
-EXPORT_SYMBOL(comx_root_dir);
diff -Nru a/drivers/net/wan/comx.h b/drivers/net/wan/comx.h
--- a/drivers/net/wan/comx.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,232 +0,0 @@
-/*
- * General definitions for the COMX driver 
- * 
- * Original authors:  Arpad Bakay <bakay.arpad@synergon.hu>,
- *                    Peter Bajan <bajan.peter@synergon.hu>,
- * Previous maintainer: Tivadar Szemethy <tiv@itc.hu>
- * Currently maintained by: Gergely Madarasz <gorgo@itc.hu>
- *
- * Copyright (C) 1995-1999 ITConsult-Pro Co. <info@itc.hu>
- *
- * 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.
- *
- *
- * net_device_stats:
- *	rx_length_errors	rec_len < 4 || rec_len > 2000
- *	rx_over_errors		receive overrun (OVR)
- *	rx_crc_errors		rx crc error
- *	rx_frame_errors		aborts rec'd (ABO)
- *	rx_fifo_errors		status fifo overrun (PBUFOVR)
- *	rx_missed_errors	receive buffer overrun (BUFOVR)
- *	tx_aborted_errors	?
- *	tx_carrier_errors	modem line status changes
- *	tx_fifo_errors		tx underrun (locomx)
- */
-#include <linux/config.h>
-
-struct comx_protocol {
-	char	*name;
-	char	*version;
-	unsigned short encap_type;
-	int	(*line_init)(struct net_device *dev);
-	int	(*line_exit)(struct net_device *dev);
-	struct comx_protocol *next;
-	};
-
-struct comx_hardware {
-	char *name; 
-	char *version;
-	int	(*hw_init)(struct net_device *dev);
-	int	(*hw_exit)(struct net_device *dev);
-	int	(*hw_dump)(struct net_device *dev);
-	struct comx_hardware *next;
-	};
-
-struct comx_channel {
-	void		*if_ptr;	// General purpose pointer
-	struct net_device 	*dev;		// Where we belong to
-	struct net_device	*twin;		// On dual-port cards
-	struct proc_dir_entry *procdir;	// the directory
-
-	unsigned char	init_status;
-	unsigned char	line_status;
-
-	struct timer_list lineup_timer;	// against line jitter
-	long int	lineup_pending;
-	unsigned char	lineup_delay;
-
-#if 0
-	struct timer_list reset_timer; // for board resetting
-	long		reset_pending;
-	int		reset_timeout;
-#endif
-
-	struct net_device_stats	stats;	
-	struct net_device_stats *current_stats;
-#if 0
-	unsigned long	board_resets;
-#endif
-	unsigned long 	*avg_bytes;
-	int		loadavg_counter, loadavg_size;
-	int		loadavg[3];
-	struct timer_list loadavg_timer;
-	int		debug_flags;
-	char 		*debug_area;
-	int		debug_start, debug_end, debug_size;
-	struct proc_dir_entry *debug_file;
-#ifdef	CONFIG_COMX_DEBUG_RAW
-	char		*raw;
-	int		raw_len;
-#endif
-	// LINE specific	
-	struct comx_protocol *protocol;
-	void		(*LINE_rx)(struct net_device *dev, struct sk_buff *skb);
-	int		(*LINE_tx)(struct net_device *dev);
-	void		(*LINE_status)(struct net_device *dev, u_short status);
-	int		(*LINE_open)(struct net_device *dev);
-	int		(*LINE_close)(struct net_device *dev);
-	int		(*LINE_xmit)(struct sk_buff *skb, struct net_device *dev);
-	int		(*LINE_header)(struct sk_buff *skb, struct net_device *dev,
-				u_short type,void *daddr, void *saddr, 
-				unsigned len);
-	int		(*LINE_rebuild_header)(struct sk_buff *skb);
-	int		(*LINE_statistics)(struct net_device *dev, char *page);
-	int		(*LINE_parameter_check)(struct net_device *dev);
-	int		(*LINE_ioctl)(struct net_device *dev, struct ifreq *ifr,
-				int cmd);
-	void		(*LINE_mod_use)(int);
-	void *		LINE_privdata;
-
-	// HW specific
-
-	struct comx_hardware *hardware;
-	void	(*HW_board_on)(struct net_device *dev);
-	void	(*HW_board_off)(struct net_device *dev);
-	struct net_device *(*HW_access_board)(struct net_device *dev);
-	void	(*HW_release_board)(struct net_device *dev, struct net_device *savep);
-	int	(*HW_txe)(struct net_device *dev);
-	int	(*HW_open)(struct net_device *dev);
-	int	(*HW_close)(struct net_device *dev);
-	int	(*HW_send_packet)(struct net_device *dev,struct sk_buff *skb);
-	int	(*HW_statistics)(struct net_device *dev, char *page);
-#if 0
-	int	(*HW_reset)(struct net_device *dev, char *page);
-#endif
-	int	(*HW_load_board)(struct net_device *dev);
-	void	(*HW_set_clock)(struct net_device *dev);
-	void	*HW_privdata;
-	};
-
-struct comx_debugflags_struct {
-	char *name;
-	int  value;
-	};
-
-#define	COMX_ROOT_DIR_NAME	"comx"
-
-#define	FILENAME_HARDWARE	"boardtype"
-#define FILENAME_HARDWARELIST	"boardtypes"
-#define FILENAME_PROTOCOL	"protocol"
-#define FILENAME_PROTOCOLLIST	"protocols"
-#define FILENAME_DEBUG		"debug"
-#define FILENAME_CLOCK		"clock"
-#define	FILENAME_STATUS		"status"
-#define	FILENAME_IO		"io"
-#define FILENAME_IRQ		"irq"
-#define	FILENAME_KEEPALIVE	"keepalive"
-#define FILENAME_LINEUPDELAY	"lineup_delay"
-#define FILENAME_CHANNEL	"channel"
-#define FILENAME_FIRMWARE	"firmware"
-#define FILENAME_MEMADDR	"memaddr"
-#define	FILENAME_TWIN		"twin"
-#define FILENAME_T1		"t1"
-#define FILENAME_T2		"t2"
-#define FILENAME_N2		"n2"
-#define FILENAME_WINDOW		"window"
-#define FILENAME_MODE		"mode"
-#define	FILENAME_DLCI		"dlci"
-#define	FILENAME_MASTER		"master"
-#ifdef	CONFIG_COMX_DEBUG_RAW
-#define	FILENAME_RAW		"raw"
-#endif
-
-#define PROTONAME_NONE		"none"
-#define HWNAME_NONE		"none"
-#define KEEPALIVE_OFF		"off"
-
-#define FRAME_ACCEPTED		0		/* sending and xmitter busy */
-#define FRAME_DROPPED		1
-#define FRAME_ERROR		2		/* xmitter error */
-#define	FRAME_QUEUED		3		/* sending but more can come */
-
-#define	LINE_UP			1		/* Modem UP */
-#define PROTO_UP		2
-#define PROTO_LOOP		4
-
-#define	HW_OPEN			1
-#define	LINE_OPEN		2
-#define FW_LOADED		4
-#define IRQ_ALLOCATED		8
-
-#define DEBUG_COMX_RX		2
-#define	DEBUG_COMX_TX		4
-#define	DEBUG_HW_TX		16
-#define	DEBUG_HW_RX		32
-#define	DEBUG_HDLC_KEEPALIVE	64
-#define	DEBUG_COMX_PPP		128
-#define DEBUG_COMX_LAPB		256
-#define	DEBUG_COMX_DLCI		512
-
-#define	DEBUG_PAGESIZE		3072
-#define DEFAULT_DEBUG_SIZE	4096
-#define	DEFAULT_LINEUP_DELAY	1
-#define	FILE_PAGESIZE		3072
-
-#ifndef	COMX_PPP_MAJOR
-#define	COMX_PPP_MAJOR		88
-#endif
-
-
-#define COMX_CHANNEL(dev) ((struct comx_channel*)dev->priv)
-
-#define TWIN(dev) (COMX_CHANNEL(dev)->twin)
-
-
-#ifndef byte
-typedef u8	byte;
-#endif
-#ifndef word
-typedef u16	word;
-#endif
-
-#ifndef	SEEK_SET
-#define	SEEK_SET	0
-#endif
-#ifndef	SEEK_CUR
-#define	SEEK_CUR	1
-#endif
-#ifndef	SEEK_END
-#define	SEEK_END	2
-#endif
-
-extern struct proc_dir_entry * comx_root_dir;
-
-extern int	comx_register_hardware(struct comx_hardware *comx_hw);
-extern int	comx_unregister_hardware(char *name);
-extern int	comx_register_protocol(struct comx_protocol *comx_line);
-extern int	comx_unregister_protocol(char *name);
-
-extern int	comx_rx(struct net_device *dev, struct sk_buff *skb);
-extern void	comx_status(struct net_device *dev, int status);
-extern void	comx_lineup_func(unsigned long d);
-
-extern int	comx_debug(struct net_device *dev, char *fmt, ...);
-extern int	comx_debug_skb(struct net_device *dev, struct sk_buff *skb, char *msg);
-extern int	comx_debug_bytes(struct net_device *dev, unsigned char *bytes, int len,
-		char *msg);
-extern int	comx_strcasecmp(const char *cs, const char *ct);
-
-extern struct inode_operations comx_normal_inode_ops;
diff -Nru a/drivers/net/wan/comxhw.h b/drivers/net/wan/comxhw.h
--- a/drivers/net/wan/comxhw.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,113 +0,0 @@
-/*
- * Defines for comxhw.c
- *
- * Original authors:  Arpad Bakay <bakay.arpad@synergon.hu>,
- *                    Peter Bajan <bajan.peter@synergon.hu>,
- * Previous maintainer: Tivadar Szemethy <tiv@itc.hu>
- * Current maintainer: Gergely Madarasz <gorgo@itc.hu>
- *
- * Copyright (C) 1995-1999 ITConsult-Pro Co. <info@itc.hu>
- *
- * 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.
- *
- */
-
-#define	LOCOMX_IO_EXTENT	8
-#define COMX_IO_EXTENT		4
-#define	HICOMX_IO_EXTENT	16
-
-#define COMX_MAX_TX_SIZE	1600
-#define COMX_MAX_RX_SIZE	2048
-
-#define COMX_JAIL_OFFSET	0xffff
-#define COMX_JAIL_VALUE		0xfe
-#define	COMX_MEMORY_SIZE	65536
-#define HICOMX_MEMORY_SIZE	16384
-#define COMX_MEM_MIN		0xa0000
-#define COMX_MEM_MAX		0xf0000
-
-#define	COMX_DEFAULT_IO		0x360
-#define	COMX_DEFAULT_IRQ	10
-#define	COMX_DEFAULT_MEMADDR	0xd0000
-#define	HICOMX_DEFAULT_IO	0x320
-#define	HICOMX_DEFAULT_IRQ	10
-#define	HICOMX_DEFAULT_MEMADDR	0xd0000
-#define	LOCOMX_DEFAULT_IO	0x368
-#define	LOCOMX_DEFAULT_IRQ	7
-
-#define MAX_CHANNELNO		2
-
-#define	COMX_CHANNEL_OFFSET	0x2000
-
-#define COMX_ENABLE_BOARD_IT    0x40
-#define COMX_BOARD_RESET       	0x20
-#define COMX_ENABLE_BOARD_MEM   0x10
-#define COMX_DISABLE_BOARD_MEM  0
-#define COMX_DISABLE_ALL	0x00
-
-#define HICOMX_DISABLE_ALL	0x00
-#define HICOMX_ENABLE_BOARD_MEM	0x02
-#define HICOMX_DISABLE_BOARD_MEM 0x0
-#define HICOMX_BOARD_RESET	0x01
-#define HICOMX_PRG_MEM		4
-#define HICOMX_DATA_MEM		0
-#define HICOMX_ID_BYTE		0x55
-
-#define CMX_ID_BYTE		0x31
-#define COMX_CLOCK_CONST	8000
-
-#define	LINKUP_READY		3
-
-#define	OFF_FW_L1_ID	0x01e	 /* ID bytes */
-#define OFF_FW_L2_ID	0x1006
-#define	FW_L1_ID_1	0xab
-#define FW_L1_ID_2_COMX		0xc0
-#define FW_L1_ID_2_HICOMX	0xc1
-#define	FW_L2_ID_1	0xab
-
-#define OFF_A_L2_CMD     0x130   /* command register for L2 */
-#define OFF_A_L2_CMDPAR  0x131   /* command parameter byte */
-#define OFF_A_L1_STATB   0x122   /* stat. block for L1 */
-#define OFF_A_L1_ABOREC  0x122   /* receive ABORT counter */
-#define OFF_A_L1_OVERRUN 0x123   /* receive overrun counter */
-#define OFF_A_L1_CRCREC  0x124   /* CRC error counter */
-#define OFF_A_L1_BUFFOVR 0x125   /* buffer overrun counter */
-#define OFF_A_L1_PBUFOVR 0x126   /* priority buffer overrun counter */
-#define OFF_A_L1_MODSTAT 0x127   /* current state of modem ctrl lines */
-#define OFF_A_L1_STATE   0x127   /* end of stat. block for L1 */
-#define OFF_A_L1_TXPC    0x128   /* Tx counter for the PC */
-#define OFF_A_L1_TXZ80   0x129   /* Tx counter for the Z80 */
-#define OFF_A_L1_RXPC    0x12a   /* Rx counter for the PC */
-#define OFF_A_L1_RXZ80   0x12b   /* Rx counter for the Z80 */
-#define OFF_A_L1_REPENA  0x12c   /* IT rep disable */
-#define OFF_A_L1_CHNR    0x12d   /* L1 channel logical number */
-#define OFF_A_L1_CLKINI  0x12e   /* Timer Const */
-#define OFF_A_L2_LINKUP	 0x132	 /* Linkup byte */
-#define OFF_A_L2_DAV	 0x134   /* Rx DAV */
-#define OFF_A_L2_RxBUFP  0x136	 /* Rx buff relative to membase */
-#define OFF_A_L2_TxEMPTY 0x138   /* Tx Empty */
-#define OFF_A_L2_TxBUFP  0x13a   /* Tx Buf */
-#define OFF_A_L2_NBUFFS	 0x144	 /* Number of buffers to fetch */
-
-#define OFF_A_L2_SABMREC 0x164	 /* LAPB no. of SABMs received */
-#define OFF_A_L2_SABMSENT 0x165	 /* LAPB no. of SABMs sent */
-#define OFF_A_L2_REJREC  0x166	 /* LAPB no. of REJs received */
-#define OFF_A_L2_REJSENT 0x167	 /* LAPB no. of REJs sent */
-#define OFF_A_L2_FRMRREC 0x168	 /* LAPB no. of FRMRs received */
-#define OFF_A_L2_FRMRSENT 0x169	 /* LAPB no. of FRMRs sent */
-#define OFF_A_L2_PROTERR 0x16A	 /* LAPB no. of protocol errors rec'd */
-#define OFF_A_L2_LONGREC 0x16B	 /* LAPB no. of long frames */
-#define OFF_A_L2_INVNR   0x16C	 /* LAPB no. of invalid N(R)s rec'd */
-#define OFF_A_L2_UNDEFFR 0x16D	 /* LAPB no. of invalid frames */
-
-#define	OFF_A_L2_T1	0x174	 /* T1 timer */
-#define	OFF_A_L2_ADDR	0x176	 /* DCE = 1, DTE = 3 */
-
-#define	COMX_CMD_INIT	1
-#define COMX_CMD_EXIT	2
-#define COMX_CMD_OPEN	16
-#define COMX_CMD_CLOSE	17
-
diff -Nru a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
--- a/drivers/net/wan/cosa.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/wan/cosa.c	Tue Jun 15 22:20:36 2004
@@ -93,6 +93,7 @@
 #include <linux/netdevice.h>
 #include <linux/spinlock.h>
 #include <linux/smp_lock.h>
+#include <linux/device.h>
 
 #undef COSA_SLOW_IO	/* for testing purposes only */
 #undef REALLY_SLOW_IO
@@ -233,6 +234,9 @@
 /* IRQ can be safely autoprobed */
 static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, };
 
+/* for class stuff*/
+static struct class_simple *cosa_class;
+
 #ifdef MODULE
 MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
 MODULE_PARM_DESC(io, "The I/O bases of the COSA or SRP cards");
@@ -359,7 +363,7 @@
 
 static int __init cosa_init(void)
 {
-	int i;
+	int i, err = 0;
 
 	printk(KERN_INFO "cosa v1.08 (c) 1997-2000 Jan Kasprzak <kas@fi.muni.cz>\n");
 #ifdef CONFIG_SMP
@@ -369,12 +373,14 @@
 		if (register_chrdev(cosa_major, "cosa", &cosa_fops)) {
 			printk(KERN_WARNING "cosa: unable to get major %d\n",
 				cosa_major);
-			return -EIO;
+			err = -EIO;
+			goto out;
 		}
 	} else {
 		if (!(cosa_major=register_chrdev(0, "cosa", &cosa_fops))) {
 			printk(KERN_WARNING "cosa: unable to register chardev\n");
-			return -EIO;
+			err = -EIO;
+			goto out;
 		}
 	}
 	for (i=0; i<MAX_CARDS; i++)
@@ -384,15 +390,33 @@
 	if (!nr_cards) {
 		printk(KERN_WARNING "cosa: no devices found.\n");
 		unregister_chrdev(cosa_major, "cosa");
-		return -ENODEV;
+		err = -ENODEV;
+		goto out;
 	}
 	devfs_mk_dir("cosa");
+	cosa_class = class_simple_create(THIS_MODULE, "cosa");
+	if (IS_ERR(cosa_class)) {
+		err = PTR_ERR(cosa_class);
+		goto out_chrdev;
+	}
 	for (i=0; i<nr_cards; i++) {
-		devfs_mk_cdev(MKDEV(cosa_major, i),
+		class_simple_device_add(cosa_class, MKDEV(cosa_major, i),
+				NULL, "cosa%d", i);
+		err = devfs_mk_cdev(MKDEV(cosa_major, i),
 				S_IFCHR|S_IRUSR|S_IWUSR,
 				"cosa/%d", i);
+		if (err) {
+			class_simple_device_remove(MKDEV(cosa_major, i));
+			goto out_chrdev;		
+		}
 	}
-	return 0;
+	err = 0;
+	goto out;
+	
+out_chrdev:
+	unregister_chrdev(cosa_major, "cosa");
+out:
+	return err;
 }
 module_init(cosa_init);
 
@@ -402,8 +426,11 @@
 	int i;
 	printk(KERN_INFO "Unloading the cosa module\n");
 
-	for (i=0; i<nr_cards; i++)
+	for (i=0; i<nr_cards; i++) {
+		class_simple_device_remove(MKDEV(cosa_major, i));
 		devfs_remove("cosa/%d", i);
+	}
+	class_simple_destroy(cosa_class);
 	devfs_remove("cosa");
 	for (cosa=cosa_cards; nr_cards--; cosa++) {
 		/* Clean up the per-channel data */
diff -Nru a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
--- a/drivers/net/wan/dlci.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/wan/dlci.c	Tue Jun 15 22:20:40 2004
@@ -229,7 +229,7 @@
 	return(ret);
 }
 
-static int dlci_config(struct net_device *dev, struct dlci_conf *conf, int get)
+static int dlci_config(struct net_device *dev, struct dlci_conf __user *conf, int get)
 {
 	struct dlci_conf	config;
 	struct dlci_local	*dlp;
@@ -286,7 +286,7 @@
 			if (!*(short *)(dev->dev_addr))
 				return(-EINVAL);
 
-			return(dlci_config(dev, (struct dlci_conf *) ifr->ifr_data, cmd == DLCI_GET_CONF));
+			return(dlci_config(dev, ifr->ifr_data, cmd == DLCI_GET_CONF));
 			break;
 
 		default: 
@@ -454,7 +454,7 @@
 	return(err);
 }
 
-static int dlci_ioctl(unsigned int cmd, void *arg)
+static int dlci_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct dlci_add add;
 	int err;
diff -Nru a/drivers/net/wan/falc-lh.h b/drivers/net/wan/falc-lh.h
--- a/drivers/net/wan/falc-lh.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,102 +0,0 @@
-/*
- *	Defines for comx-hw-slicecom.c - FALC-LH specific
- *
- *	Author:		Bartok Istvan <bartoki@itc.hu>
- *	Last modified:	Mon Feb  7 20:00:38 CET 2000
- *
- *	:set tabstop=6
- */
-
-/*
- *	Control register offsets on the LBI (page 90)
- *	use it like:
- *	lbi[ MODE ] = 0x34;
- */
-
-#define MODE	0x03
-#define IPC		0x08
-#define IMR0	0x14	/* Interrupt Mask Register 0	*/
-#define IMR1	0x15
-#define IMR2	0x16
-#define IMR3	0x17
-#define IMR4	0x18
-#define IMR5	0x19
-#define FMR0	0x1a	/* Framer Mode Register 0	*/
-#define FMR1	0x1b
-#define FMR2	0x1c
-#define XSW		0x1e
-#define XSP		0x1f
-#define XC0		0x20
-#define XC1		0x21
-#define RC0		0x22
-#define RC1		0x23
-#define XPM0	0x24
-#define XPM1	0x25
-#define XPM2	0x26
-#define TSWM	0x27
-#define IDLE	0x29	/* Idle Code	*/
-#define LIM0	0x34
-#define LIM1	0x35
-#define PCD		0x36
-#define PCR		0x37
-#define LIM2	0x38
-
-/*
- *	Status registers on the LBI (page 134)
- *	these are read-only, use it like:
- *	if( lbi[ FRS0 ] ) ...
- */
-
-#define FRS0	0x4c	/* Framer Receive Status register 0	*/
-#define FRS1	0x4d	/* Framer Receive Status register 1	*/
-#define FECL	0x50	/* Framing Error Counter low byte	*/ /* Counts FAS word receive errors		*/
-#define FECH	0x51	/*                       high byte	*/
-#define CVCL	0x52	/* Code Violation Counter low byte	*/ /* Counts bipolar and HDB3 code violations	*/
-#define CVCH	0x53	/*                        high byte	*/
-#define CEC1L	0x54	/* CRC4 Error Counter 1 low byte	*/ /* Counts CRC4 errors in the incoming stream	*/
-#define CEC1H	0x55	/*                      high byte	*/
-#define EBCL	0x56	/* E Bit error Counter low byte	*/ /* E-bits: the remote end sends them, when	*/
-#define EBCH	0x57	/*                     high byte	*/ /* it detected a CRC4-error			*/
-#define ISR0	0x68	/* Interrupt Status Register 0	*/
-#define ISR1	0x69	/* Interrupt Status Register 1	*/
-#define ISR2	0x6a	/* Interrupt Status Register 2	*/
-#define ISR3	0x6b	/* Interrupt Status Register 3	*/
-#define ISR5	0x6c	/* Interrupt Status Register 5	*/
-#define GIS	0x6e	/* Global Interrupt Status Register	*/
-#define VSTR	0x6f	/* version information */
-
-/*
- *	Bit fields
- */
-
-#define FRS0_LOS		(1 << 7)
-#define FRS0_AIS		(1 << 6)
-#define FRS0_LFA		(1 << 5)
-#define FRS0_RRA		(1 << 4)
-#define FRS0_AUXP		(1 << 3)
-#define FRS0_NMF		(1 << 2)
-#define FRS0_LMFA		(1 << 1)
-
-#define FRS1_XLS		(1 << 1)
-#define FRS1_XLO		(1)
-
-#define ISR2_FAR		(1 << 7)
-#define ISR2_LFA		(1 << 6)
-#define ISR2_MFAR		(1 << 5)
-#define ISR2_T400MS	(1 << 4)
-#define ISR2_AIS		(1 << 3)
-#define ISR2_LOS		(1 << 2)
-#define ISR2_RAR		(1 << 1)
-#define ISR2_RA		(1)
-
-#define ISR3_ES		(1 << 7)
-#define ISR3_SEC		(1 << 6)
-#define ISR3_LMFA16	(1 << 5)
-#define ISR3_AIS16	(1 << 4)
-#define ISR3_RA16		(1 << 3)
-#define ISR3_API		(1 << 2)
-#define ISR3_RSN		(1 << 1)
-#define ISR3_RSP		(1)
-
-#define ISR5_XSP		(1 << 7)
-#define ISR5_XSN		(1 << 6)
diff -Nru a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c
--- a/drivers/net/wan/farsync.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/wan/farsync.c	Tue Jun 15 22:20:42 2004
@@ -1,9 +1,9 @@
 /*
- *      FarSync X21 driver for Linux (generic HDLC version)
+ *      FarSync WAN driver for Linux (2.6.x kernel version)
  *
  *      Actually sync driver for X.21, V.35 and V.24 on FarSync T-series cards
  *
- *      Copyright (C) 2001 FarSite Communications Ltd.
+ *      Copyright (C) 2001-2004 FarSite Communications Ltd.
  *      www.farsite.co.uk
  *
  *      This program is free software; you can redistribute it and/or
@@ -11,63 +11,79 @@
  *      as published by the Free Software Foundation; either version
  *      2 of the License, or (at your option) any later version.
  *
- *      Author: R.J.Dunlop      <bob.dunlop@farsite.co.uk>
+ *      Author:      R.J.Dunlop    <bob.dunlop@farsite.co.uk>
+ *      Maintainer:  Kevin Curtis  <kevin.curtis@farsite.co.uk>
  */
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/version.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
 #include <linux/if.h>
 #include <linux/hdlc.h>
+#include <asm/io.h>
+#include <asm/uaccess.h>
 
 #include "farsync.h"
 
-
 /*
  *      Module info
  */
 MODULE_AUTHOR("R.J.Dunlop <bob.dunlop@farsite.co.uk>");
-MODULE_DESCRIPTION("FarSync T-Series X21 driver. FarSite Communications Ltd.");
+MODULE_DESCRIPTION("FarSync T-Series WAN driver. FarSite Communications Ltd.");
+MODULE_PARM(fst_txq_low, "i");
+MODULE_PARM(fst_txq_high, "i");
+MODULE_PARM(fst_max_reads, "i");
+MODULE_PARM(fst_excluded_cards, "i");
+MODULE_PARM(fst_excluded_list, "0-32i");
 MODULE_LICENSE("GPL");
 
 /*      Driver configuration and global parameters
  *      ==========================================
  */
 
-/*      Number of ports (per card) supported
+/*      Number of ports (per card) and cards supported
  */
 #define FST_MAX_PORTS           4
-
-
-/*      PCI vendor and device IDs
- */
-#define FSC_PCI_VENDOR_ID       0x1619  /* FarSite Communications Ltd */
-#define T2P_PCI_DEVICE_ID       0x0400  /* T2P X21 2 port card */
-#define T4P_PCI_DEVICE_ID       0x0440  /* T4P X21 4 port card */
-
+#define FST_MAX_CARDS           32
 
 /*      Default parameters for the link
  */
-#define FST_TX_QUEUE_LEN        100     /* At 8Mbps a longer queue length is
-                                         * useful, the syncppp module forces
-                                         * this down assuming a slower line I
-                                         * guess.
-                                         */
-#define FST_MAX_MTU             8000    /* Huge but possible */
-#define FST_DEF_MTU             1500    /* Common sane value */
+#define FST_TX_QUEUE_LEN        100	/* At 8Mbps a longer queue length is
+					 * useful, the syncppp module forces
+					 * this down assuming a slower line I
+					 * guess.
+					 */
+#define FST_TXQ_DEPTH           16	/* This one is for the buffering
+					 * of frames on the way down to the card
+					 * so that we can keep the card busy
+					 * and maximise throughput
+					 */
+#define FST_HIGH_WATER_MARK     12	/* Point at which we flow control
+					 * network layer */
+#define FST_LOW_WATER_MARK      8	/* Point at which we remove flow
+					 * control from network layer */
+#define FST_MAX_MTU             8000	/* Huge but possible */
+#define FST_DEF_MTU             1500	/* Common sane value */
 
 #define FST_TX_TIMEOUT          (2*HZ)
 
-
 #ifdef ARPHRD_RAWHDLC
-#define ARPHRD_MYTYPE   ARPHRD_RAWHDLC  /* Raw frames */
+#define ARPHRD_MYTYPE   ARPHRD_RAWHDLC	/* Raw frames */
 #else
-#define ARPHRD_MYTYPE   ARPHRD_HDLC     /* Cisco-HDLC (keepalives etc) */
+#define ARPHRD_MYTYPE   ARPHRD_HDLC	/* Cisco-HDLC (keepalives etc) */
 #endif
 
+/*
+ * Modules parameters and associated varaibles
+ */
+int fst_txq_low = FST_LOW_WATER_MARK;
+int fst_txq_high = FST_HIGH_WATER_MARK;
+int fst_max_reads = 7;
+int fst_excluded_cards = 0;
+int fst_excluded_list[FST_MAX_CARDS];
 
 /*      Card shared memory layout
  *      =========================
@@ -84,58 +100,57 @@
  *      be used to check that we have not got out of step with the firmware
  *      contained in the .CDE files.
  */
-#define SMC_VERSION 11
+#define SMC_VERSION 24
 
-#define FST_MEMSIZE 0x100000    /* Size of card memory (1Mb) */
+#define FST_MEMSIZE 0x100000	/* Size of card memory (1Mb) */
 
-#define SMC_BASE 0x00002000L    /* Base offset of the shared memory window main
-                                 * configuration structure */
-#define BFM_BASE 0x00010000L    /* Base offset of the shared memory window DMA
-                                 * buffers */
+#define SMC_BASE 0x00002000L	/* Base offset of the shared memory window main
+				 * configuration structure */
+#define BFM_BASE 0x00010000L	/* Base offset of the shared memory window DMA
+				 * buffers */
 
-#define LEN_TX_BUFFER 8192      /* Size of packet buffers */
+#define LEN_TX_BUFFER 8192	/* Size of packet buffers */
 #define LEN_RX_BUFFER 8192
 
-#define LEN_SMALL_TX_BUFFER 256 /* Size of obsolete buffs used for DOS diags */
+#define LEN_SMALL_TX_BUFFER 256	/* Size of obsolete buffs used for DOS diags */
 #define LEN_SMALL_RX_BUFFER 256
 
-#define NUM_TX_BUFFER 2         /* Must be power of 2. Fixed by firmware */
+#define NUM_TX_BUFFER 2		/* Must be power of 2. Fixed by firmware */
 #define NUM_RX_BUFFER 8
 
 /* Interrupt retry time in milliseconds */
 #define INT_RETRY_TIME 2
 
-
 /*      The Am186CH/CC processors support a SmartDMA mode using circular pools
  *      of buffer descriptors. The structure is almost identical to that used
  *      in the LANCE Ethernet controllers. Details available as PDF from the
  *      AMD web site: http://www.amd.com/products/epd/processors/\
  *                    2.16bitcont/3.am186cxfa/a21914/21914.pdf
  */
-struct txdesc {                 /* Transmit descriptor */
-        volatile u16 ladr;      /* Low order address of packet. This is a
-                                 * linear address in the Am186 memory space
-                                 */
-        volatile u8  hadr;      /* High order address. Low 4 bits only, high 4
-                                 * bits must be zero
-                                 */
-        volatile u8  bits;      /* Status and config */
-        volatile u16 bcnt;      /* 2s complement of packet size in low 15 bits.
-                                 * Transmit terminal count interrupt enable in
-                                 * top bit.
-                                 */
-                 u16 unused;    /* Not used in Tx */
+struct txdesc {			/* Transmit descriptor */
+	volatile u16 ladr;	/* Low order address of packet. This is a
+				 * linear address in the Am186 memory space
+				 */
+	volatile u8 hadr;	/* High order address. Low 4 bits only, high 4
+				 * bits must be zero
+				 */
+	volatile u8 bits;	/* Status and config */
+	volatile u16 bcnt;	/* 2s complement of packet size in low 15 bits.
+				 * Transmit terminal count interrupt enable in
+				 * top bit.
+				 */
+	u16 unused;		/* Not used in Tx */
 };
 
-struct rxdesc {                 /* Receive descriptor */
-        volatile u16 ladr;      /* Low order address of packet */
-        volatile u8  hadr;      /* High order address */
-        volatile u8  bits;      /* Status and config */
-        volatile u16 bcnt;      /* 2s complement of buffer size in low 15 bits.
-                                 * Receive terminal count interrupt enable in
-                                 * top bit.
-                                 */
-        volatile u16 mcnt;      /* Message byte count (15 bits) */
+struct rxdesc {			/* Receive descriptor */
+	volatile u16 ladr;	/* Low order address of packet */
+	volatile u8 hadr;	/* High order address */
+	volatile u8 bits;	/* Status and config */
+	volatile u16 bcnt;	/* 2s complement of buffer size in low 15 bits.
+				 * Receive terminal count interrupt enable in
+				 * top bit.
+				 */
+	volatile u16 mcnt;	/* Message byte count (15 bits) */
 };
 
 /* Convert a length into the 15 bit 2's complement */
@@ -146,57 +161,99 @@
 #define cnv_bcnt(len)   (-(len))
 
 /* Status and config bits for the above */
-#define DMA_OWN         0x80            /* SmartDMA owns the descriptor */
-#define TX_STP          0x02            /* Tx: start of packet */
-#define TX_ENP          0x01            /* Tx: end of packet */
-#define RX_ERR          0x40            /* Rx: error (OR of next 4 bits) */
-#define RX_FRAM         0x20            /* Rx: framing error */
-#define RX_OFLO         0x10            /* Rx: overflow error */
-#define RX_CRC          0x08            /* Rx: CRC error */
-#define RX_HBUF         0x04            /* Rx: buffer error */
-#define RX_STP          0x02            /* Rx: start of packet */
-#define RX_ENP          0x01            /* Rx: end of packet */
-
+#define DMA_OWN         0x80	/* SmartDMA owns the descriptor */
+#define TX_STP          0x02	/* Tx: start of packet */
+#define TX_ENP          0x01	/* Tx: end of packet */
+#define RX_ERR          0x40	/* Rx: error (OR of next 4 bits) */
+#define RX_FRAM         0x20	/* Rx: framing error */
+#define RX_OFLO         0x10	/* Rx: overflow error */
+#define RX_CRC          0x08	/* Rx: CRC error */
+#define RX_HBUF         0x04	/* Rx: buffer error */
+#define RX_STP          0x02	/* Rx: start of packet */
+#define RX_ENP          0x01	/* Rx: end of packet */
 
-/* Interrupts from the card are caused by various events and these are presented
+/* Interrupts from the card are caused by various events which are presented
  * in a circular buffer as several events may be processed on one physical int
  */
 #define MAX_CIRBUFF     32
 
 struct cirbuff {
-        u8 rdindex;             /* read, then increment and wrap */
-        u8 wrindex;             /* write, then increment and wrap */
-        u8 evntbuff[MAX_CIRBUFF];
+	u8 rdindex;		/* read, then increment and wrap */
+	u8 wrindex;		/* write, then increment and wrap */
+	u8 evntbuff[MAX_CIRBUFF];
 };
 
 /* Interrupt event codes.
  * Where appropriate the two low order bits indicate the port number
  */
-#define CTLA_CHG        0x18    /* Control signal changed */
+#define CTLA_CHG        0x18	/* Control signal changed */
 #define CTLB_CHG        0x19
 #define CTLC_CHG        0x1A
 #define CTLD_CHG        0x1B
 
-#define INIT_CPLT       0x20    /* Initialisation complete */
-#define INIT_FAIL       0x21    /* Initialisation failed */
+#define INIT_CPLT       0x20	/* Initialisation complete */
+#define INIT_FAIL       0x21	/* Initialisation failed */
 
-#define ABTA_SENT       0x24    /* Abort sent */
+#define ABTA_SENT       0x24	/* Abort sent */
 #define ABTB_SENT       0x25
 #define ABTC_SENT       0x26
 #define ABTD_SENT       0x27
 
-#define TXA_UNDF        0x28    /* Transmission underflow */
+#define TXA_UNDF        0x28	/* Transmission underflow */
 #define TXB_UNDF        0x29
 #define TXC_UNDF        0x2A
 #define TXD_UNDF        0x2B
 
+#define F56_INT         0x2C
+#define M32_INT         0x2D
+
+#define TE1_ALMA        0x30
 
 /* Port physical configuration. See farsync.h for field values */
 struct port_cfg {
-        u16  lineInterface;     /* Physical interface type */
-        u8   x25op;             /* Unused at present */
-        u8   internalClock;     /* 1 => internal clock, 0 => external */
-        u32  lineSpeed;         /* Speed in bps */
+	u16 lineInterface;	/* Physical interface type */
+	u8 x25op;		/* Unused at present */
+	u8 internalClock;	/* 1 => internal clock, 0 => external */
+	u8 transparentMode;	/* 1 => on, 0 => off */
+	u8 invertClock;		/* 0 => normal, 1 => inverted */
+	u8 padBytes[6];		/* Padding */
+	u32 lineSpeed;		/* Speed in bps */
+};
+
+/* TE1 port physical configuration */
+struct su_config {
+	u32 dataRate;
+	u8 clocking;
+	u8 framing;
+	u8 structure;
+	u8 interface;
+	u8 coding;
+	u8 lineBuildOut;
+	u8 equalizer;
+	u8 transparentMode;
+	u8 loopMode;
+	u8 range;
+	u8 txBufferMode;
+	u8 rxBufferMode;
+	u8 startingSlot;
+	u8 losThreshold;
+	u8 enableIdleCode;
+	u8 idleCode;
+	u8 spare[44];
+};
+
+/* TE1 Status */
+struct su_status {
+	u32 receiveBufferDelay;
+	u32 framingErrorCount;
+	u32 codeViolationCount;
+	u32 crcErrorCount;
+	u32 lineAttenuation;
+	u8 portStarted;
+	u8 lossOfSignal;
+	u8 receiveRemoteAlarm;
+	u8 alarmIndicationSignal;
+	u8 spare[40];
 };
 
 /* Finally sling all the above together into the shared memory structure.
@@ -206,154 +263,216 @@
  * See farsync.h for some field values.
  */
 struct fst_shared {
-                                /* DMA descriptor rings */
-        struct rxdesc rxDescrRing[FST_MAX_PORTS][NUM_RX_BUFFER];
-        struct txdesc txDescrRing[FST_MAX_PORTS][NUM_TX_BUFFER];
+	/* DMA descriptor rings */
+	struct rxdesc rxDescrRing[FST_MAX_PORTS][NUM_RX_BUFFER];
+	struct txdesc txDescrRing[FST_MAX_PORTS][NUM_TX_BUFFER];
+
+	/* Obsolete small buffers */
+	u8 smallRxBuffer[FST_MAX_PORTS][NUM_RX_BUFFER][LEN_SMALL_RX_BUFFER];
+	u8 smallTxBuffer[FST_MAX_PORTS][NUM_TX_BUFFER][LEN_SMALL_TX_BUFFER];
 
-                                /* Obsolete small buffers */
-        u8  smallRxBuffer[FST_MAX_PORTS][NUM_RX_BUFFER][LEN_SMALL_RX_BUFFER];
-        u8  smallTxBuffer[FST_MAX_PORTS][NUM_TX_BUFFER][LEN_SMALL_TX_BUFFER];
+	u8 taskStatus;		/* 0x00 => initialising, 0x01 => running,
+				 * 0xFF => halted
+				 */
 
-        u8  taskStatus;         /* 0x00 => initialising, 0x01 => running,
-                                 * 0xFF => halted
-                                 */
+	u8 interruptHandshake;	/* Set to 0x01 by adapter to signal interrupt,
+				 * set to 0xEE by host to acknowledge interrupt
+				 */
 
-        u8  interruptHandshake; /* Set to 0x01 by adapter to signal interrupt,
-                                 * set to 0xEE by host to acknowledge interrupt
-                                 */
+	u16 smcVersion;		/* Must match SMC_VERSION */
 
-        u16 smcVersion;         /* Must match SMC_VERSION */
+	u32 smcFirmwareVersion;	/* 0xIIVVRRBB where II = product ID, VV = major
+				 * version, RR = revision and BB = build
+				 */
 
-        u32 smcFirmwareVersion; /* 0xIIVVRRBB where II = product ID, VV = major
-                                 * version, RR = revision and BB = build
-                                 */
+	u16 txa_done;		/* Obsolete completion flags */
+	u16 rxa_done;
+	u16 txb_done;
+	u16 rxb_done;
+	u16 txc_done;
+	u16 rxc_done;
+	u16 txd_done;
+	u16 rxd_done;
 
-        u16 txa_done;           /* Obsolete completion flags */
-        u16 rxa_done;
-        u16 txb_done;
-        u16 rxb_done;
-        u16 txc_done;
-        u16 rxc_done;
-        u16 txd_done;
-        u16 rxd_done;
+	u16 mailbox[4];		/* Diagnostics mailbox. Not used */
 
-        u16 mailbox[4];         /* Diagnostics mailbox. Not used */
+	struct cirbuff interruptEvent;	/* interrupt causes */
 
-        struct cirbuff interruptEvent;  /* interrupt causes */
+	u32 v24IpSts[FST_MAX_PORTS];	/* V.24 control input status */
+	u32 v24OpSts[FST_MAX_PORTS];	/* V.24 control output status */
 
-        u32 v24IpSts[FST_MAX_PORTS];    /* V.24 control input status */
-        u32 v24OpSts[FST_MAX_PORTS];    /* V.24 control output status */
+	struct port_cfg portConfig[FST_MAX_PORTS];
 
-        struct port_cfg portConfig[FST_MAX_PORTS];
+	u16 clockStatus[FST_MAX_PORTS];	/* lsb: 0=> present, 1=> absent */
 
-        u16 clockStatus[FST_MAX_PORTS]; /* lsb: 0=> present, 1=> absent */
+	u16 cableStatus;	/* lsb: 0=> present, 1=> absent */
 
-        u16 cableStatus;                /* lsb: 0=> present, 1=> absent */
+	u16 txDescrIndex[FST_MAX_PORTS];	/* transmit descriptor ring index */
+	u16 rxDescrIndex[FST_MAX_PORTS];	/* receive descriptor ring index */
 
-        u16 txDescrIndex[FST_MAX_PORTS]; /* transmit descriptor ring index */
-        u16 rxDescrIndex[FST_MAX_PORTS]; /* receive descriptor ring index */
+	u16 portMailbox[FST_MAX_PORTS][2];	/* command, modifier */
+	u16 cardMailbox[4];	/* Not used */
 
-        u16 portMailbox[FST_MAX_PORTS][2];      /* command, modifier */
-        u16 cardMailbox[4];                     /* Not used */
+	/* Number of times the card thinks the host has
+	 * missed an interrupt by not acknowledging
+	 * within 2mS (I guess NT has problems)
+	 */
+	u32 interruptRetryCount;
 
-                                /* Number of times that card thinks the host has
-                                 * missed an interrupt by not acknowledging
-                                 * within 2mS (I guess NT has problems)
-                                 */
-        u32 interruptRetryCount;
+	/* Driver private data used as an ID. We'll not
+	 * use this as I'd rather keep such things
+	 * in main memory rather than on the PCI bus
+	 */
+	u32 portHandle[FST_MAX_PORTS];
 
-                                /* Driver private data used as an ID. We'll not
-                                 * use this on Linux I'd rather keep such things
-                                 * in main memory rather than on the PCI bus
-                                 */
-        u32 portHandle[FST_MAX_PORTS];
+	/* Count of Tx underflows for stats */
+	u32 transmitBufferUnderflow[FST_MAX_PORTS];
 
-                                /* Count of Tx underflows for stats */
-        u32 transmitBufferUnderflow[FST_MAX_PORTS];
+	/* Debounced V.24 control input status */
+	u32 v24DebouncedSts[FST_MAX_PORTS];
 
-                                /* Debounced V.24 control input status */
-        u32 v24DebouncedSts[FST_MAX_PORTS];
+	/* Adapter debounce timers. Don't touch */
+	u32 ctsTimer[FST_MAX_PORTS];
+	u32 ctsTimerRun[FST_MAX_PORTS];
+	u32 dcdTimer[FST_MAX_PORTS];
+	u32 dcdTimerRun[FST_MAX_PORTS];
 
-                                /* Adapter debounce timers. Don't touch */
-        u32 ctsTimer[FST_MAX_PORTS];
-        u32 ctsTimerRun[FST_MAX_PORTS];
-        u32 dcdTimer[FST_MAX_PORTS];
-        u32 dcdTimerRun[FST_MAX_PORTS];
+	u32 numberOfPorts;	/* Number of ports detected at startup */
 
-        u32 numberOfPorts;      /* Number of ports detected at startup */
+	u16 _reserved[64];
 
-        u16 _reserved[64];
+	u16 cardMode;		/* Bit-mask to enable features:
+				 * Bit 0: 1 enables LED identify mode
+				 */
 
-        u16 cardMode;           /* Bit-mask to enable features:
-                                 * Bit 0: 1 enables LED identify mode
-                                 */
+	u16 portScheduleOffset;
 
-        u16 portScheduleOffset;
+	struct su_config suConfig;	/* TE1 Bits */
+	struct su_status suStatus;
 
-        u32 endOfSmcSignature;  /* endOfSmcSignature MUST be the last member of
-                                 * the structure and marks the end of the shared
-                                 * memory. Adapter code initializes its value as
-                                 * END_SIG.
-                                 */
+	u32 endOfSmcSignature;	/* endOfSmcSignature MUST be the last member of
+				 * the structure and marks the end of shared
+				 * memory. Adapter code initializes it as
+				 * END_SIG.
+				 */
 };
 
 /* endOfSmcSignature value */
 #define END_SIG                 0x12345678
 
 /* Mailbox values. (portMailbox) */
-#define NOP             0       /* No operation */
-#define ACK             1       /* Positive acknowledgement to PC driver */
-#define NAK             2       /* Negative acknowledgement to PC driver */
-#define STARTPORT       3       /* Start an HDLC port */
-#define STOPPORT        4       /* Stop an HDLC port */
-#define ABORTTX         5       /* Abort the transmitter for a port */
-#define SETV24O         6       /* Set V24 outputs */
+#define NOP             0	/* No operation */
+#define ACK             1	/* Positive acknowledgement to PC driver */
+#define NAK             2	/* Negative acknowledgement to PC driver */
+#define STARTPORT       3	/* Start an HDLC port */
+#define STOPPORT        4	/* Stop an HDLC port */
+#define ABORTTX         5	/* Abort the transmitter for a port */
+#define SETV24O         6	/* Set V24 outputs */
+
+/* PLX Chip Register Offsets */
+#define CNTRL_9052      0x50	/* Control Register */
+#define CNTRL_9054      0x6c	/* Control Register */
+
+#define INTCSR_9052     0x4c	/* Interrupt control/status register */
+#define INTCSR_9054     0x68	/* Interrupt control/status register */
 
+/* 9054 DMA Registers */
+/*
+ * Note that we will be using DMA Channel 0 for copying rx data
+ * and Channel 1 for copying tx data
+ */
+#define DMAMODE0        0x80
+#define DMAPADR0        0x84
+#define DMALADR0        0x88
+#define DMASIZ0         0x8c
+#define DMADPR0         0x90
+#define DMAMODE1        0x94
+#define DMAPADR1        0x98
+#define DMALADR1        0x9c
+#define DMASIZ1         0xa0
+#define DMADPR1         0xa4
+#define DMACSR0         0xa8
+#define DMACSR1         0xa9
+#define DMAARB          0xac
+#define DMATHR          0xb0
+#define DMADAC0         0xb4
+#define DMADAC1         0xb8
+#define DMAMARBR        0xac
+
+#define FST_MIN_DMA_LEN 64
+#define FST_RX_DMA_INT  0x01
+#define FST_TX_DMA_INT  0x02
+#define FST_CARD_INT    0x04
 
 /* Larger buffers are positioned in memory at offset BFM_BASE */
 struct buf_window {
-        u8 txBuffer[FST_MAX_PORTS][NUM_TX_BUFFER][LEN_TX_BUFFER];
-        u8 rxBuffer[FST_MAX_PORTS][NUM_RX_BUFFER][LEN_RX_BUFFER];
+	u8 txBuffer[FST_MAX_PORTS][NUM_TX_BUFFER][LEN_TX_BUFFER];
+	u8 rxBuffer[FST_MAX_PORTS][NUM_RX_BUFFER][LEN_RX_BUFFER];
 };
 
 /* Calculate offset of a buffer object within the shared memory window */
-#define BUF_OFFSET(X)   offsetof(struct buf_window, X)
+#define BUF_OFFSET(X)   ((unsigned int)&(((struct buf_window *)BFM_BASE)->X))
 
 #pragma pack()
 
-
 /*      Device driver private information
  *      =================================
  */
 /*      Per port (line or channel) information
  */
 struct fst_port_info {
-        struct net_device      *dev;
-        struct fst_card_info   *card;   /* Card we're associated with */
-        int                     index;  /* Port index on the card */
-        int                     hwif;   /* Line hardware (lineInterface copy) */
-        int                     run;    /* Port is running */
-        int                     rxpos;  /* Next Rx buffer to use */
-        int                     txpos;  /* Next Tx buffer to use */
-        int                     txipos; /* Next Tx buffer to check for free */
-        int                     txcnt;  /* Count of Tx buffers in use */
+        struct net_device *dev; /* Device struct - must be first */
+	struct fst_card_info *card;	/* Card we're associated with */
+	int index;		/* Port index on the card */
+	int hwif;		/* Line hardware (lineInterface copy) */
+	int run;		/* Port is running */
+	int mode;		/* Normal or FarSync raw */
+	int rxpos;		/* Next Rx buffer to use */
+	int txpos;		/* Next Tx buffer to use */
+	int txipos;		/* Next Tx buffer to check for free */
+	int start;		/* Indication of start/stop to network */
+	/*
+	 * A sixteen entry transmit queue
+	 */
+	int txqs;		/* index to get next buffer to tx */
+	int txqe;		/* index to queue next packet */
+	struct sk_buff *txq[FST_TXQ_DEPTH];	/* The queue */
+	int rxqdepth;
 };
 
 /*      Per card information
  */
 struct fst_card_info {
-        char          *mem;             /* Card memory mapped to kernel space */
-        char          *ctlmem;          /* Control memory for PCI cards */
-        unsigned int   phys_mem;        /* Physical memory window address */
-        unsigned int   phys_ctlmem;     /* Physical control memory address */
-        unsigned int   irq;             /* Interrupt request line number */
-        unsigned int   nports;          /* Number of serial ports */
-        unsigned int   type;            /* Type index of card */
-        unsigned int   state;           /* State of card */
-        spinlock_t     card_lock;       /* Lock for SMP access */
-        unsigned short pci_conf;        /* PCI card config in I/O space */
-                                        /* Per port info */
-        struct fst_port_info ports[ FST_MAX_PORTS ];
+	char *mem;		/* Card memory mapped to kernel space */
+	char *ctlmem;		/* Control memory for PCI cards */
+	unsigned int phys_mem;	/* Physical memory window address */
+	unsigned int phys_ctlmem;	/* Physical control memory address */
+	unsigned int irq;	/* Interrupt request line number */
+	unsigned int nports;	/* Number of serial ports */
+	unsigned int type;	/* Type index of card */
+	unsigned int state;	/* State of card */
+	spinlock_t card_lock;	/* Lock for SMP access */
+	unsigned short pci_conf;	/* PCI card config in I/O space */
+	/* Per port info */
+	struct fst_port_info ports[FST_MAX_PORTS];
+	struct pci_dev *device;	/* Information about the pci device */
+	int card_no;		/* Inst of the card on the system */
+	int family;		/* TxP or TxU */
+	int dmarx_in_progress;
+	int dmatx_in_progress;
+	unsigned long int_count;
+	unsigned long int_time_ave;
+	void *rx_dma_handle_host;
+	dma_addr_t rx_dma_handle_card;
+	void *tx_dma_handle_host;
+	dma_addr_t tx_dma_handle_card;
+	struct sk_buff *dma_skb_rx;
+	struct fst_port_info *dma_port_rx;
+	struct fst_port_info *dma_port_tx;
+	int dma_len_rx;
+	int dma_len_tx;
+	int dma_txpos;
+	int dma_rxpos;
 };
 
 /* Convert an HDLC device pointer into a port info pointer and similar */
@@ -380,7 +499,6 @@
 #define FST_WRW(C,E,W)  writew ((W), (C)->mem + WIN_OFFSET(E))
 #define FST_WRL(C,E,L)  writel ((L), (C)->mem + WIN_OFFSET(E))
 
-
 /*
  *      Debug support
  */
@@ -399,30 +517,151 @@
                                 printk ( KERN_DEBUG FST_NAME ": " fmt, ## A )
 
 #else
-# define dbg(X...)      /* NOP */
+#define dbg(X...)		/* NOP */
 #endif
 
-
 /*      Printing short cuts
  */
 #define printk_err(fmt,A...)    printk ( KERN_ERR     FST_NAME ": " fmt, ## A )
 #define printk_warn(fmt,A...)   printk ( KERN_WARNING FST_NAME ": " fmt, ## A )
 #define printk_info(fmt,A...)   printk ( KERN_INFO    FST_NAME ": " fmt, ## A )
 
-
 /*
  *      PCI ID lookup table
  */
-static struct pci_device_id fst_pci_dev_id[] = {
-        { FSC_PCI_VENDOR_ID, T2P_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-                                        FST_TYPE_T2P },
-        { FSC_PCI_VENDOR_ID, T4P_PCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-                                        FST_TYPE_T4P },
-        { 0, }                          /* End */
+static struct pci_device_id fst_pci_dev_id[] __devinitdata = {
+	{PCI_VENDOR_ID_FARSITE, PCI_DEVICE_ID_FARSITE_T2P, PCI_ANY_ID, 
+	 PCI_ANY_ID, 0, 0, FST_TYPE_T2P},
+
+	{PCI_VENDOR_ID_FARSITE, PCI_DEVICE_ID_FARSITE_T4P, PCI_ANY_ID, 
+	 PCI_ANY_ID, 0, 0, FST_TYPE_T4P},
+
+	{PCI_VENDOR_ID_FARSITE, PCI_DEVICE_ID_FARSITE_T1U, PCI_ANY_ID, 
+	 PCI_ANY_ID, 0, 0, FST_TYPE_T1U},
+
+	{PCI_VENDOR_ID_FARSITE, PCI_DEVICE_ID_FARSITE_T2U, PCI_ANY_ID, 
+	 PCI_ANY_ID, 0, 0, FST_TYPE_T2U},
+
+	{PCI_VENDOR_ID_FARSITE, PCI_DEVICE_ID_FARSITE_T4U, PCI_ANY_ID, 
+	 PCI_ANY_ID, 0, 0, FST_TYPE_T4U},
+
+	{PCI_VENDOR_ID_FARSITE, PCI_DEVICE_ID_FARSITE_TE1, PCI_ANY_ID, 
+	 PCI_ANY_ID, 0, 0, FST_TYPE_TE1},
+
+	{PCI_VENDOR_ID_FARSITE, PCI_DEVICE_ID_FARSITE_TE1C, PCI_ANY_ID, 
+	 PCI_ANY_ID, 0, 0, FST_TYPE_TE1},
+	{0,}			/* End */
 };
 
-MODULE_DEVICE_TABLE ( pci, fst_pci_dev_id );
+MODULE_DEVICE_TABLE(pci, fst_pci_dev_id);
+
+/*
+ *      Device Driver Work Queues
+ *
+ *      So that we don't spend too much time processing events in the 
+ *      Interrupt Service routine, we will declare a work queue per Card 
+ *      and make the ISR schedule a task in the queue for later execution.
+ *      In the 2.4 Kernel we used to use the immediate queue for BH's
+ *      Now that they are gone, tasklets seem to be much better than work 
+ *      queues.
+ */
+
+static void do_bottom_half_tx(struct fst_card_info *card);
+static void do_bottom_half_rx(struct fst_card_info *card);
+static void fst_process_tx_work_q(unsigned long work_q);
+static void fst_process_int_work_q(unsigned long work_q);
+
+DECLARE_TASKLET(fst_tx_task, fst_process_tx_work_q, 0);
+DECLARE_TASKLET(fst_int_task, fst_process_int_work_q, 0);
+
+struct fst_card_info *fst_card_array[FST_MAX_CARDS];
+spinlock_t fst_work_q_lock;
+u64 fst_work_txq;
+u64 fst_work_intq;
+
+static void
+fst_q_work_item(u64 * queue, int card_index)
+{
+	unsigned long flags;
+	u64 mask;
+
+	/*
+	 * Grab the queue exclusively
+	 */
+	spin_lock_irqsave(&fst_work_q_lock, flags);
+
+	/*
+	 * Making an entry in the queue is simply a matter of setting
+	 * a bit for the card indicating that there is work to do in the
+	 * bottom half for the card.  Note the limitation of 64 cards.
+	 * That ought to be enough
+	 */
+	mask = 1 << card_index;
+	*queue |= mask;
+	spin_unlock_irqrestore(&fst_work_q_lock, flags);
+}
+
+static void
+fst_process_tx_work_q(unsigned long /*void **/work_q)
+{
+	unsigned long flags;
+	u64 work_txq;
+	int i;
 
+	/*
+	 * Grab the queue exclusively
+	 */
+	dbg(DBG_TX, "fst_process_tx_work_q\n");
+	spin_lock_irqsave(&fst_work_q_lock, flags);
+	work_txq = fst_work_txq;
+	fst_work_txq = 0;
+	spin_unlock_irqrestore(&fst_work_q_lock, flags);
+
+	/*
+	 * Call the bottom half for each card with work waiting
+	 */
+	for (i = 0; i < FST_MAX_CARDS; i++) {
+		if (work_txq & 0x01) {
+			if (fst_card_array[i] != NULL) {
+				dbg(DBG_TX, "Calling tx bh for card %d\n", i);
+				do_bottom_half_tx(fst_card_array[i]);
+			}
+		}
+		work_txq = work_txq >> 1;
+	}
+}
+
+static void
+fst_process_int_work_q(unsigned long /*void **/work_q)
+{
+	unsigned long flags;
+	u64 work_intq;
+	int i;
+
+	/*
+	 * Grab the queue exclusively
+	 */
+	dbg(DBG_INTR, "fst_process_int_work_q\n");
+	spin_lock_irqsave(&fst_work_q_lock, flags);
+	work_intq = fst_work_intq;
+	fst_work_intq = 0;
+	spin_unlock_irqrestore(&fst_work_q_lock, flags);
+
+	/*
+	 * Call the bottom half for each card with work waiting
+	 */
+	for (i = 0; i < FST_MAX_CARDS; i++) {
+		if (work_intq & 0x01) {
+			if (fst_card_array[i] != NULL) {
+				dbg(DBG_INTR,
+				    "Calling rx & tx bh for card %d\n", i);
+				do_bottom_half_rx(fst_card_array[i]);
+				do_bottom_half_tx(fst_card_array[i]);
+			}
+		}
+		work_intq = work_intq >> 1;
+	}
+}
 
 /*      Card control functions
  *      ======================
@@ -432,1005 +671,1725 @@
  * Used to be a simple write to card control space but a glitch in the latest
  * AMD Am186CH processor means that we now have to do it by asserting and de-
  * asserting the PLX chip PCI Adapter Software Reset. Bit 30 in CNTRL register
- * at offset 0x50.
+ * at offset 9052_CNTRL.  Note the updates for the TXU.
  */
 static inline void
-fst_cpureset ( struct fst_card_info *card )
+fst_cpureset(struct fst_card_info *card)
 {
-        unsigned int regval;
+	unsigned char interrupt_line_register;
+	unsigned long j = jiffies + 1;
+	unsigned int regval;
+
+	if (card->family == FST_FAMILY_TXU) {
+		if (pci_read_config_byte
+		    (card->device, PCI_INTERRUPT_LINE, &interrupt_line_register)) {
+			dbg(DBG_ASS,
+			    "Error in reading interrupt line register\n");
+		}
+		/*
+		 * Assert PLX software reset and Am186 hardware reset
+		 * and then deassert the PLX software reset but 186 still in reset
+		 */
+		outw(0x440f, card->pci_conf + CNTRL_9054 + 2);
+		outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
+		/*
+		 * We are delaying here to allow the 9054 to reset itself
+		 */
+		j = jiffies + 1;
+		while (jiffies < j)
+			/* Do nothing */ ;
+		outw(0x240f, card->pci_conf + CNTRL_9054 + 2);
+		/*
+		 * We are delaying here to allow the 9054 to reload its eeprom
+		 */
+		j = jiffies + 1;
+		while (jiffies < j)
+			/* Do nothing */ ;
+		outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
+
+		if (pci_write_config_byte
+		    (card->device, PCI_INTERRUPT_LINE, interrupt_line_register)) {
+			dbg(DBG_ASS,
+			    "Error in writing interrupt line register\n");
+		}
 
-        regval = inl ( card->pci_conf + 0x50 );
+	} else {
+		regval = inl(card->pci_conf + CNTRL_9052);
 
-        outl ( regval |  0x40000000, card->pci_conf + 0x50 );
-        outl ( regval & ~0x40000000, card->pci_conf + 0x50 );
+		outl(regval | 0x40000000, card->pci_conf + CNTRL_9052);
+		outl(regval & ~0x40000000, card->pci_conf + CNTRL_9052);
+	}
 }
 
 /*      Release the processor from reset
  */
 static inline void
-fst_cpurelease ( struct fst_card_info *card )
+fst_cpurelease(struct fst_card_info *card)
 {
-        (void) readb ( card->ctlmem );
+	if (card->family == FST_FAMILY_TXU) {
+		/*
+		 * Force posted writes to complete
+		 */
+		(void) readb(card->mem);
+
+		/*
+		 * Release LRESET DO = 1
+		 * Then release Local Hold, DO = 1
+		 */
+		outw(0x040e, card->pci_conf + CNTRL_9054 + 2);
+		outw(0x040f, card->pci_conf + CNTRL_9054 + 2);
+	} else {
+		(void) readb(card->ctlmem);
+	}
 }
 
 /*      Clear the cards interrupt flag
  */
 static inline void
-fst_clear_intr ( struct fst_card_info *card )
+fst_clear_intr(struct fst_card_info *card)
+{
+	if (card->family == FST_FAMILY_TXU) {
+		(void) readb(card->ctlmem);
+	} else {
+		/* Poke the appropriate PLX chip register (same as enabling interrupts)
+		 */
+		outw(0x0543, card->pci_conf + INTCSR_9052);
+	}
+}
+
+/*      Enable card interrupts
+ */
+static inline void
+fst_enable_intr(struct fst_card_info *card)
 {
-        /* Poke the appropriate PLX chip register (same as enabling interrupts)
-         */
-        outw ( 0x0543, card->pci_conf + 0x4C );
+	if (card->family == FST_FAMILY_TXU) {
+		outl(0x0f0c0900, card->pci_conf + INTCSR_9054);
+	} else {
+		outw(0x0543, card->pci_conf + INTCSR_9052);
+	}
 }
 
 /*      Disable card interrupts
  */
 static inline void
-fst_disable_intr ( struct fst_card_info *card )
+fst_disable_intr(struct fst_card_info *card)
+{
+	if (card->family == FST_FAMILY_TXU) {
+		outl(0x00000000, card->pci_conf + INTCSR_9054);
+	} else {
+		outw(0x0000, card->pci_conf + INTCSR_9052);
+	}
+}
+
+/*      Process the result of trying to pass a recieved frame up the stack
+ */
+static void
+fst_process_rx_status(int rx_status, char *name)
+{
+	switch (rx_status) {
+	case NET_RX_SUCCESS:
+		{
+			/*
+			 * Nothing to do here
+			 */
+			break;
+		}
+
+	case NET_RX_CN_LOW:
+		{
+			dbg(DBG_ASS, "%s: Receive Low Congestion\n", name);
+			break;
+		}
+
+	case NET_RX_CN_MOD:
+		{
+			dbg(DBG_ASS, "%s: Receive Moderate Congestion\n", name);
+			break;
+		}
+
+	case NET_RX_CN_HIGH:
+		{
+			dbg(DBG_ASS, "%s: Receive High Congestion\n", name);
+			break;
+		}
+
+	case NET_RX_DROP:
+		{
+			dbg(DBG_ASS, "%s: Received packet dropped\n", name);
+			break;
+		}
+	}
+}
+
+/*      Initilaise DMA for PLX 9054
+ */
+static inline void
+fst_init_dma(struct fst_card_info *card)
+{
+	/*
+	 * This is only required for the PLX 9054
+	 */
+	if (card->family == FST_FAMILY_TXU) {
+	        pci_set_master(card->device);
+		outl(0x00020441, card->pci_conf + DMAMODE0);
+		outl(0x00020441, card->pci_conf + DMAMODE1);
+		outl(0x0, card->pci_conf + DMATHR);
+	}
+}
+
+/*      Tx dma complete interrupt
+ */
+static void
+fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
+		    int len, int txpos)
+{
+	struct net_device *dev = port_to_dev(port);
+	struct net_device_stats *stats = hdlc_stats(dev);
+
+	/*
+	 * Everything is now set, just tell the card to go
+	 */
+	dbg(DBG_TX, "fst_tx_dma_complete\n");
+	FST_WRB(card, txDescrRing[port->index][txpos].bits,
+		DMA_OWN | TX_STP | TX_ENP);
+	stats->tx_packets++;
+	stats->tx_bytes += len;
+	dev->trans_start = jiffies;
+}
+
+/*      Rx dma complete interrupt
+ */
+static void
+fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port,
+		    int len, struct sk_buff *skb, int rxp)
+{
+	struct net_device *dev = port_to_dev(port);
+	struct net_device_stats *stats = hdlc_stats(dev);
+	int pi;
+	int rx_status;
+
+	dbg(DBG_TX, "fst_rx_dma_complete\n");
+	pi = port->index;
+	memcpy(skb_put(skb, len), card->rx_dma_handle_host, len);
+
+	/* Reset buffer descriptor */
+	FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
+
+	/* Update stats */
+	stats->rx_packets++;
+	stats->rx_bytes += len;
+
+	/* Push upstream */
+	dbg(DBG_RX, "Pushing the frame up the stack\n");
+	skb->mac.raw = skb->data;
+	skb->dev = dev;
+	if (port->mode == FST_RAW) {
+		/*
+		 * Mark it for our own raw sockets interface
+		 */
+		skb->protocol = htons(ETH_P_CUST);
+		skb->pkt_type = PACKET_HOST;
+	} else {
+		skb->protocol = hdlc_type_trans(skb, skb->dev);
+	}
+	rx_status = netif_rx(skb);
+	fst_process_rx_status(rx_status, port_to_dev(port)->name);
+	if (rx_status == NET_RX_DROP)
+		stats->rx_dropped++;
+	dev->last_rx = jiffies;
+}
+
+/*
+ *      Receive a frame through the DMA
+ */
+static inline void
+fst_rx_dma(struct fst_card_info *card, unsigned char *skb,
+	   unsigned char *mem, int len)
 {
-        outw ( 0x0000, card->pci_conf + 0x4C );
+	/*
+	 * This routine will setup the DMA and start it
+	 */
+
+	dbg(DBG_RX, "In fst_rx_dma %p %p %d\n", skb, mem, len);
+	if (card->dmarx_in_progress) {
+		dbg(DBG_ASS, "In fst_rx_dma while dma in progress\n");
+	}
+
+	outl((unsigned long) skb, card->pci_conf + DMAPADR0);	/* Copy to here */
+	outl((unsigned long) mem, card->pci_conf + DMALADR0);	/* from here */
+	outl(len, card->pci_conf + DMASIZ0);	/* for this length */
+	outl(0x00000000c, card->pci_conf + DMADPR0);	/* In this direction */
+
+	/*
+	 * We use the dmarx_in_progress flag to flag the channel as busy
+	 */
+	card->dmarx_in_progress = 1;
+	outb(0x03, card->pci_conf + DMACSR0);	/* Start the transfer */
 }
 
+/*
+ *      Send a frame through the DMA
+ */
+static inline void
+fst_tx_dma(struct fst_card_info *card, unsigned char *skb,
+	   unsigned char *mem, int len)
+{
+	/*
+	 * This routine will setup the DMA and start it.
+	 */
+
+	dbg(DBG_TX, "In fst_tx_dma %p %p %d\n", skb, mem, len);
+	if (card->dmatx_in_progress) {
+		dbg(DBG_ASS, "In fst_tx_dma while dma in progress\n");
+	}
+
+	outl((unsigned long) skb, card->pci_conf + DMAPADR1);	/* Copy from here */
+	outl((unsigned long) mem, card->pci_conf + DMALADR1);	/* to here */
+	outl(len, card->pci_conf + DMASIZ1);	/* for this length */
+	outl(0x000000004, card->pci_conf + DMADPR1);	/* In this direction */
+
+	/*
+	 * We use the dmatx_in_progress to flag the channel as busy
+	 */
+	card->dmatx_in_progress = 1;
+	outb(0x03, card->pci_conf + DMACSR1);	/* Start the transfer */
+}
 
 /*      Issue a Mailbox command for a port.
  *      Note we issue them on a fire and forget basis, not expecting to see an
  *      error and not waiting for completion.
  */
 static void
-fst_issue_cmd ( struct fst_port_info *port, unsigned short cmd )
+fst_issue_cmd(struct fst_port_info *port, unsigned short cmd)
 {
-        struct fst_card_info *card;
-        unsigned short mbval;
-        unsigned long flags;
-        int safety;
-
-        card = port->card;
-        spin_lock_irqsave ( &card->card_lock, flags );
-        mbval = FST_RDW ( card, portMailbox[port->index][0]);
-
-        safety = 0;
-        /* Wait for any previous command to complete */
-        while ( mbval > NAK )
-        {
-                spin_unlock_irqrestore ( &card->card_lock, flags );
-                schedule_timeout ( 1 );
-                spin_lock_irqsave ( &card->card_lock, flags );
-
-                if ( ++safety > 1000 )
-                {
-                        printk_err ("Mailbox safety timeout\n");
-                        break;
-                }
+	struct fst_card_info *card;
+	unsigned short mbval;
+	unsigned long flags;
+	int safety;
+
+	card = port->card;
+	spin_lock_irqsave(&card->card_lock, flags);
+	mbval = FST_RDW(card, portMailbox[port->index][0]);
+
+	safety = 0;
+	/* Wait for any previous command to complete */
+	while (mbval > NAK) {
+		spin_unlock_irqrestore(&card->card_lock, flags);
+		schedule_timeout(1);
+		spin_lock_irqsave(&card->card_lock, flags);
+
+		if (++safety > 2000) {
+			printk_err("Mailbox safety timeout\n");
+			break;
+		}
+
+		mbval = FST_RDW(card, portMailbox[port->index][0]);
+	}
+	if (safety > 0) {
+		dbg(DBG_CMD, "Mailbox clear after %d jiffies\n", safety);
+	}
+	if (mbval == NAK) {
+		dbg(DBG_CMD, "issue_cmd: previous command was NAK'd\n");
+	}
 
-                mbval = FST_RDW ( card, portMailbox[port->index][0]);
-        }
-        if ( safety > 0 )
-        {
-                dbg ( DBG_CMD,"Mailbox clear after %d jiffies\n", safety );
-        }
-        if ( mbval == NAK )
-        {
-                dbg ( DBG_CMD,"issue_cmd: previous command was NAK'd\n");
-        }
-
-        FST_WRW ( card, portMailbox[port->index][0], cmd );
-
-        if ( cmd == ABORTTX || cmd == STARTPORT )
-        {
-                port->txpos  = 0;
-                port->txipos = 0;
-                port->txcnt  = 0;
-        }
+	FST_WRW(card, portMailbox[port->index][0], cmd);
 
-        spin_unlock_irqrestore ( &card->card_lock, flags );
-}
+	if (cmd == ABORTTX || cmd == STARTPORT) {
+		port->txpos = 0;
+		port->txipos = 0;
+		port->start = 0;
+	}
 
+	spin_unlock_irqrestore(&card->card_lock, flags);
+}
 
 /*      Port output signals control
  */
 static inline void
-fst_op_raise ( struct fst_port_info *port, unsigned int outputs )
+fst_op_raise(struct fst_port_info *port, unsigned int outputs)
 {
-        outputs |= FST_RDL ( port->card, v24OpSts[port->index]);
-        FST_WRL ( port->card, v24OpSts[port->index], outputs );
+	outputs |= FST_RDL(port->card, v24OpSts[port->index]);
+	FST_WRL(port->card, v24OpSts[port->index], outputs);
 
-        if ( port->run )
-                fst_issue_cmd ( port, SETV24O );
+	if (port->run)
+		fst_issue_cmd(port, SETV24O);
 }
 
 static inline void
-fst_op_lower ( struct fst_port_info *port, unsigned int outputs )
+fst_op_lower(struct fst_port_info *port, unsigned int outputs)
 {
-        outputs = ~outputs & FST_RDL ( port->card, v24OpSts[port->index]);
-        FST_WRL ( port->card, v24OpSts[port->index], outputs );
+	outputs = ~outputs & FST_RDL(port->card, v24OpSts[port->index]);
+	FST_WRL(port->card, v24OpSts[port->index], outputs);
 
-        if ( port->run )
-                fst_issue_cmd ( port, SETV24O );
+	if (port->run)
+		fst_issue_cmd(port, SETV24O);
 }
 
-
 /*
  *      Setup port Rx buffers
  */
 static void
-fst_rx_config ( struct fst_port_info *port )
+fst_rx_config(struct fst_port_info *port)
 {
-        int i;
-        int pi;
-        unsigned int offset;
-        unsigned long flags;
-        struct fst_card_info *card;
-
-        pi   = port->index;
-        card = port->card;
-        spin_lock_irqsave ( &card->card_lock, flags );
-        for ( i = 0 ; i < NUM_RX_BUFFER ; i++ )
-        {
-                offset = BUF_OFFSET ( rxBuffer[pi][i][0]);
-
-                FST_WRW ( card, rxDescrRing[pi][i].ladr, (u16) offset );
-                FST_WRB ( card, rxDescrRing[pi][i].hadr, (u8)( offset >> 16 ));
-                FST_WRW ( card, rxDescrRing[pi][i].bcnt,
-                                        cnv_bcnt ( LEN_RX_BUFFER ));
-                FST_WRW ( card, rxDescrRing[pi][i].mcnt, 0 );
-                FST_WRB ( card, rxDescrRing[pi][i].bits, DMA_OWN );
-        }
-        port->rxpos  = 0;
-        spin_unlock_irqrestore ( &card->card_lock, flags );
+	int i;
+	int pi;
+	unsigned int offset;
+	unsigned long flags;
+	struct fst_card_info *card;
+
+	pi = port->index;
+	card = port->card;
+	spin_lock_irqsave(&card->card_lock, flags);
+	for (i = 0; i < NUM_RX_BUFFER; i++) {
+		offset = BUF_OFFSET(rxBuffer[pi][i][0]);
+
+		FST_WRW(card, rxDescrRing[pi][i].ladr, (u16) offset);
+		FST_WRB(card, rxDescrRing[pi][i].hadr, (u8) (offset >> 16));
+		FST_WRW(card, rxDescrRing[pi][i].bcnt, cnv_bcnt(LEN_RX_BUFFER));
+		FST_WRW(card, rxDescrRing[pi][i].mcnt, LEN_RX_BUFFER);
+		FST_WRB(card, rxDescrRing[pi][i].bits, DMA_OWN);
+	}
+	port->rxpos = 0;
+	spin_unlock_irqrestore(&card->card_lock, flags);
 }
 
-
 /*
  *      Setup port Tx buffers
  */
 static void
-fst_tx_config ( struct fst_port_info *port )
+fst_tx_config(struct fst_port_info *port)
 {
-        int i;
-        int pi;
-        unsigned int offset;
-        unsigned long flags;
-        struct fst_card_info *card;
-
-        pi   = port->index;
-        card = port->card;
-        spin_lock_irqsave ( &card->card_lock, flags );
-        for ( i = 0 ; i < NUM_TX_BUFFER ; i++ )
-        {
-                offset = BUF_OFFSET ( txBuffer[pi][i][0]);
-
-                FST_WRW ( card, txDescrRing[pi][i].ladr, (u16) offset );
-                FST_WRB ( card, txDescrRing[pi][i].hadr, (u8)( offset >> 16 ));
-                FST_WRW ( card, txDescrRing[pi][i].bcnt, 0 );
-                FST_WRB ( card, txDescrRing[pi][i].bits, 0 );
-        }
-        port->txpos  = 0;
-        port->txipos = 0;
-        port->txcnt  = 0;
-        spin_unlock_irqrestore ( &card->card_lock, flags );
+	int i;
+	int pi;
+	unsigned int offset;
+	unsigned long flags;
+	struct fst_card_info *card;
+
+	pi = port->index;
+	card = port->card;
+	spin_lock_irqsave(&card->card_lock, flags);
+	for (i = 0; i < NUM_TX_BUFFER; i++) {
+		offset = BUF_OFFSET(txBuffer[pi][i][0]);
+
+		FST_WRW(card, txDescrRing[pi][i].ladr, (u16) offset);
+		FST_WRB(card, txDescrRing[pi][i].hadr, (u8) (offset >> 16));
+		FST_WRW(card, txDescrRing[pi][i].bcnt, 0);
+		FST_WRB(card, txDescrRing[pi][i].bits, 0);
+	}
+	port->txpos = 0;
+	port->txipos = 0;
+	port->start = 0;
+	spin_unlock_irqrestore(&card->card_lock, flags);
 }
 
+/*      TE1 Alarm change interrupt event
+ */
+static void
+fst_intr_te1_alarm(struct fst_card_info *card, struct fst_port_info *port)
+{
+	u8 los;
+	u8 rra;
+	u8 ais;
+
+	los = FST_RDB(card, suStatus.lossOfSignal);
+	rra = FST_RDB(card, suStatus.receiveRemoteAlarm);
+	ais = FST_RDB(card, suStatus.alarmIndicationSignal);
+
+	if (los) {
+		/*
+		 * Lost the link
+		 */
+		if (netif_carrier_ok(port_to_dev(port))) {
+			dbg(DBG_INTR, "Net carrier off\n");
+			netif_carrier_off(port_to_dev(port));
+		}
+	} else {
+		/*
+		 * Link available
+		 */
+		if (!netif_carrier_ok(port_to_dev(port))) {
+			dbg(DBG_INTR, "Net carrier on\n");
+			netif_carrier_on(port_to_dev(port));
+		}
+	}
+
+	if (los)
+		dbg(DBG_INTR, "Assert LOS Alarm\n");
+	else
+		dbg(DBG_INTR, "De-assert LOS Alarm\n");
+	if (rra)
+		dbg(DBG_INTR, "Assert RRA Alarm\n");
+	else
+		dbg(DBG_INTR, "De-assert RRA Alarm\n");
+
+	if (ais)
+		dbg(DBG_INTR, "Assert AIS Alarm\n");
+	else
+		dbg(DBG_INTR, "De-assert AIS Alarm\n");
+}
 
 /*      Control signal change interrupt event
  */
-static irqreturn_t
-fst_intr_ctlchg ( struct fst_card_info *card, struct fst_port_info *port )
+static void
+fst_intr_ctlchg(struct fst_card_info *card, struct fst_port_info *port)
 {
-        int signals;
+	int signals;
 
-        signals = FST_RDL ( card, v24DebouncedSts[port->index]);
+	signals = FST_RDL(card, v24DebouncedSts[port->index]);
 
-        if ( signals & (( port->hwif == X21 ) ? IPSTS_INDICATE : IPSTS_DCD ))
-        {
-                if ( ! netif_carrier_ok ( port_to_dev ( port )))
-                {
-                        dbg ( DBG_INTR,"DCD active\n");
-                        netif_carrier_on ( port_to_dev ( port ));
-                }
-        }
-        else
-        {
-                if ( netif_carrier_ok ( port_to_dev ( port )))
-                {
-                        dbg ( DBG_INTR,"DCD lost\n");
-                        netif_carrier_off ( port_to_dev ( port ));
-                }
-        }
-	return IRQ_HANDLED;
+	if (signals & (((port->hwif == X21) || (port->hwif == X21D))
+		       ? IPSTS_INDICATE : IPSTS_DCD)) {
+		if (!netif_carrier_ok(port_to_dev(port))) {
+			dbg(DBG_INTR, "DCD active\n");
+			netif_carrier_on(port_to_dev(port));
+		}
+	} else {
+		if (netif_carrier_ok(port_to_dev(port))) {
+			dbg(DBG_INTR, "DCD lost\n");
+			netif_carrier_off(port_to_dev(port));
+		}
+	}
+}
+
+/*      Log Rx Errors
+ */
+static void
+fst_log_rx_error(struct fst_card_info *card, struct fst_port_info *port,
+		 unsigned char dmabits, int rxp, unsigned short len)
+{
+	struct net_device *dev = port_to_dev(port);
+	struct net_device_stats *stats = hdlc_stats(dev);
+
+	/* 
+	 * Increment the appropriate error counter
+	 */
+	stats->rx_errors++;
+	if (dmabits & RX_OFLO) {
+		stats->rx_fifo_errors++;
+		dbg(DBG_ASS, "Rx fifo error on card %d port %d buffer %d\n",
+		    card->card_no, port->index, rxp);
+	}
+	if (dmabits & RX_CRC) {
+		stats->rx_crc_errors++;
+		dbg(DBG_ASS, "Rx crc error on card %d port %d\n",
+		    card->card_no, port->index);
+	}
+	if (dmabits & RX_FRAM) {
+		stats->rx_frame_errors++;
+		dbg(DBG_ASS, "Rx frame error on card %d port %d\n",
+		    card->card_no, port->index);
+	}
+	if (dmabits == (RX_STP | RX_ENP)) {
+		stats->rx_length_errors++;
+		dbg(DBG_ASS, "Rx length error (%d) on card %d port %d\n",
+		    len, card->card_no, port->index);
+	}
 }
 
+/*      Rx Error Recovery
+ */
+static void
+fst_recover_rx_error(struct fst_card_info *card, struct fst_port_info *port,
+		     unsigned char dmabits, int rxp, unsigned short len)
+{
+	int i;
+	int pi;
+
+	pi = port->index;
+	/* 
+	 * Discard buffer descriptors until we see the start of the
+	 * next frame.  Note that for long frames this could be in
+	 * a subsequent interrupt. 
+	 */
+	i = 0;
+	while ((dmabits & (DMA_OWN | RX_STP)) == 0) {
+		FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
+		rxp = (rxp+1) % NUM_RX_BUFFER;
+		if (++i > NUM_RX_BUFFER) {
+			dbg(DBG_ASS, "intr_rx: Discarding more bufs"
+			    " than we have\n");
+			break;
+		}
+		dmabits = FST_RDB(card, rxDescrRing[pi][rxp].bits);
+		dbg(DBG_ASS, "DMA Bits of next buffer was %x\n", dmabits);
+	}
+	dbg(DBG_ASS, "There were %d subsequent buffers in error\n", i);
+
+	/* Discard the terminal buffer */
+	if (!(dmabits & DMA_OWN)) {
+		FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
+		rxp = (rxp+1) % NUM_RX_BUFFER;
+	}
+	port->rxpos = rxp;
+	return;
+
+}
 
 /*      Rx complete interrupt
  */
 static void
-fst_intr_rx ( struct fst_card_info *card, struct fst_port_info *port )
+fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port)
 {
-        unsigned char dmabits;
-        int pi;
-        int rxp;
-        unsigned short len;
-        struct sk_buff *skb;
+	unsigned char dmabits;
+	int pi;
+	int rxp;
+	int rx_status;
+	unsigned short len;
+	struct sk_buff *skb;
 	struct net_device *dev = port_to_dev(port);
 	struct net_device_stats *stats = hdlc_stats(dev);
-        int i;
 
+	/* Check we have a buffer to process */
+	pi = port->index;
+	rxp = port->rxpos;
+	dmabits = FST_RDB(card, rxDescrRing[pi][rxp].bits);
+	if (dmabits & DMA_OWN) {
+		dbg(DBG_RX | DBG_INTR, "intr_rx: No buffer port %d pos %d\n",
+		    pi, rxp);
+		return;
+	}
+	if (card->dmarx_in_progress) {
+		return;
+	}
 
-        /* Check we have a buffer to process */
-        pi  = port->index;
-        rxp = port->rxpos;
-        dmabits = FST_RDB ( card, rxDescrRing[pi][rxp].bits );
-        if ( dmabits & DMA_OWN )
-        {
-                dbg ( DBG_RX | DBG_INTR,"intr_rx: No buffer port %d pos %d\n",
-                                        pi, rxp );
-                return;
-        }
-
-        /* Get buffer length */
-        len = FST_RDW ( card, rxDescrRing[pi][rxp].mcnt );
-        /* Discard the CRC */
-        len -= 2;
-
-        /* Check buffer length and for other errors. We insist on one packet
-         * in one buffer. This simplifies things greatly and since we've
-         * allocated 8K it shouldn't be a real world limitation
-         */
-        dbg ( DBG_RX,"intr_rx: %d,%d: flags %x len %d\n", pi, rxp, dmabits,
-                                        len );
-        if ( dmabits != ( RX_STP | RX_ENP ) || len > LEN_RX_BUFFER - 2 )
-        {
-                stats->rx_errors++;
-
-                /* Update error stats and discard buffer */
-                if ( dmabits & RX_OFLO )
-                {
-                        stats->rx_fifo_errors++;
-                }
-                if ( dmabits & RX_CRC )
-                {
-                        stats->rx_crc_errors++;
-                }
-                if ( dmabits & RX_FRAM )
-                {
-                        stats->rx_frame_errors++;
-                }
-                if ( dmabits == ( RX_STP | RX_ENP ))
-                {
-                        stats->rx_length_errors++;
-                }
+	/* Get buffer length */
+	len = FST_RDW(card, rxDescrRing[pi][rxp].mcnt);
+	/* Discard the CRC */
+	len -= 2;
+	if (len == 0) {
+		/*
+		 * This seems to happen on the TE1 interface sometimes
+		 * so throw the frame away and log the event.
+		 */
+		printk_err("Frame received with 0 length. Card %d Port %d\n",
+			   card->card_no, port->index);
+		/* Return descriptor to card */
+		FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
+
+		rxp = (rxp+1) % NUM_RX_BUFFER;
+		port->rxpos = rxp;
+		return;
+	}
 
-                /* Discard buffer descriptors until we see the end of packet
-                 * marker
-                 */
-                i = 0;
-                while (( dmabits & ( DMA_OWN | RX_ENP )) == 0 )
-                {
-                        FST_WRB ( card, rxDescrRing[pi][rxp].bits, DMA_OWN );
-                        if ( ++rxp >= NUM_RX_BUFFER )
-                                rxp = 0;
-                        if ( ++i > NUM_RX_BUFFER )
-                        {
-                                dbg ( DBG_ASS,"intr_rx: Discarding more bufs"
-                                                " than we have\n");
-                                break;
-                        }
-                        dmabits = FST_RDB ( card, rxDescrRing[pi][rxp].bits );
-                }
+	/* Check buffer length and for other errors. We insist on one packet
+	 * in one buffer. This simplifies things greatly and since we've
+	 * allocated 8K it shouldn't be a real world limitation
+	 */
+	dbg(DBG_RX, "intr_rx: %d,%d: flags %x len %d\n", pi, rxp, dmabits, len);
+	if (dmabits != (RX_STP | RX_ENP) || len > LEN_RX_BUFFER - 2) {
+		fst_log_rx_error(card, port, dmabits, rxp, len);
+		fst_recover_rx_error(card, port, dmabits, rxp, len);
+		return;
+	}
 
-                /* Discard the terminal buffer */
-                if ( ! ( dmabits & DMA_OWN ))
-                {
-                        FST_WRB ( card, rxDescrRing[pi][rxp].bits, DMA_OWN );
-                        if ( ++rxp >= NUM_RX_BUFFER )
-                                rxp = 0;
-                }
-                port->rxpos = rxp;
-                return;
-        }
-
-        /* Allocate SKB */
-        if (( skb = dev_alloc_skb ( len )) == NULL )
-        {
-                dbg ( DBG_RX,"intr_rx: can't allocate buffer\n");
-
-                stats->rx_dropped++;
-
-                /* Return descriptor to card */
-                FST_WRB ( card, rxDescrRing[pi][rxp].bits, DMA_OWN );
-
-                if ( ++rxp >= NUM_RX_BUFFER )
-                        port->rxpos = 0;
-                else
-                        port->rxpos = rxp;
-                return;
-        }
-
-        memcpy_fromio ( skb_put ( skb, len ),
-                                card->mem + BUF_OFFSET ( rxBuffer[pi][rxp][0]),
-                                len );
-
-        /* Reset buffer descriptor */
-        FST_WRB ( card, rxDescrRing[pi][rxp].bits, DMA_OWN );
-        if ( ++rxp >= NUM_RX_BUFFER )
-                port->rxpos = 0;
-        else
-                port->rxpos = rxp;
-
-        /* Update stats */
-        stats->rx_packets++;
-        stats->rx_bytes += len;
-
-        /* Push upstream */
-        skb->mac.raw = skb->data;
-        skb->dev = dev;
-        skb->protocol = hdlc_type_trans(skb, skb->dev);
-        netif_rx ( skb );
+	/* Allocate SKB */
+	if ((skb = dev_alloc_skb(len)) == NULL) {
+		dbg(DBG_RX, "intr_rx: can't allocate buffer\n");
+
+		stats->rx_dropped++;
+
+		/* Return descriptor to card */
+		FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
+
+		rxp = (rxp+1) % NUM_RX_BUFFER;
+		port->rxpos = rxp;
+		return;
+	}
 
-        dev->last_rx = jiffies;
+	/*
+	 * We know the length we need to receive, len.
+	 * It's not worth using the DMA for reads of less than
+	 * FST_MIN_DMA_LEN
+	 */
+
+	if ((len < FST_MIN_DMA_LEN) || (card->family == FST_FAMILY_TXP)) {
+		memcpy_fromio(skb_put(skb, len),
+			      card->mem + BUF_OFFSET(rxBuffer[pi][rxp][0]),
+			      len);
+
+		/* Reset buffer descriptor */
+		FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN);
+
+		/* Update stats */
+		stats->rx_packets++;
+		stats->rx_bytes += len;
+
+		/* Push upstream */
+		dbg(DBG_RX, "Pushing frame up the stack\n");
+		skb->mac.raw = skb->data;
+		skb->dev = dev;
+		if (port->mode == FST_RAW) {
+			/*
+			 * Mark it for our own raw sockets interface
+			 */
+			skb->protocol = htons(ETH_P_CUST);
+			skb->pkt_type = PACKET_HOST;
+		} else {
+			skb->protocol = hdlc_type_trans(skb, skb->dev);
+		}
+		rx_status = netif_rx(skb);
+		fst_process_rx_status(rx_status, port_to_dev(port)->name);
+		if (rx_status == NET_RX_DROP) {
+			stats->rx_dropped++;
+		}
+		dev->last_rx = jiffies;
+	} else {
+		card->dma_skb_rx = skb;
+		card->dma_port_rx = port;
+		card->dma_len_rx = len;
+		card->dma_rxpos = rxp;
+		fst_rx_dma(card, (char *) card->rx_dma_handle_card,
+			   (char *) BUF_OFFSET(rxBuffer[pi][rxp][0]), len);
+	}
+	if (rxp != port->rxpos) {
+		dbg(DBG_ASS, "About to increment rxpos by more than 1\n");
+		dbg(DBG_ASS, "rxp = %d rxpos = %d\n", rxp, port->rxpos);
+	}
+	rxp = (rxp+1) % NUM_RX_BUFFER;
+	port->rxpos = rxp;
 }
 
+/*
+ *      The bottom halfs to the ISR
+ *
+ */
+
+static void
+do_bottom_half_tx(struct fst_card_info *card)
+{
+	struct fst_port_info *port;
+	int pi;
+	int txq_length;
+	struct sk_buff *skb;
+	unsigned long flags;
+	struct net_device *dev;
+	struct net_device_stats *stats;
+
+	/*
+	 *  Find a free buffer for the transmit
+	 *  Step through each port on this card
+	 */
+
+	dbg(DBG_TX, "do_bottom_half_tx\n");
+	for (pi = 0, port = card->ports; pi < card->nports; pi++, port++) {
+		if (!port->run)
+			continue;
+
+                dev = port_to_dev(port);
+                stats = hdlc_stats(dev);
+		while (!
+		       (FST_RDB(card, txDescrRing[pi][port->txpos].bits) &
+			DMA_OWN)
+                       && !(card->dmatx_in_progress)) {
+			/*
+			 * There doesn't seem to be a txdone event per-se
+			 * We seem to have to deduce it, by checking the DMA_OWN
+			 * bit on the next buffer we think we can use
+			 */
+			spin_lock_irqsave(&card->card_lock, flags);
+			if ((txq_length = port->txqe - port->txqs) < 0) {
+				/*
+				 * This is the case where one has wrapped and the
+				 * maths gives us a negative number
+				 */
+				txq_length = txq_length + FST_TXQ_DEPTH;
+			}
+			spin_unlock_irqrestore(&card->card_lock, flags);
+			if (txq_length > 0) {
+				/*
+				 * There is something to send
+				 */
+				spin_lock_irqsave(&card->card_lock, flags);
+				skb = port->txq[port->txqs];
+				port->txqs++;
+				if (port->txqs == FST_TXQ_DEPTH) {
+					port->txqs = 0;
+				}
+				spin_unlock_irqrestore(&card->card_lock, flags);
+				/*
+				 * copy the data and set the required indicators on the
+				 * card.
+				 */
+				FST_WRW(card, txDescrRing[pi][port->txpos].bcnt,
+					cnv_bcnt(skb->len));
+				if ((skb->len < FST_MIN_DMA_LEN)
+				    || (card->family == FST_FAMILY_TXP)) {
+					/* Enqueue the packet with normal io */
+					memcpy_toio(card->mem +
+						    BUF_OFFSET(txBuffer[pi]
+							       [port->
+								txpos][0]),
+						    skb->data, skb->len);
+					FST_WRB(card,
+						txDescrRing[pi][port->txpos].
+						bits,
+						DMA_OWN | TX_STP | TX_ENP);
+					stats->tx_packets++;
+					stats->tx_bytes += skb->len;
+					dev->trans_start = jiffies;
+				} else {
+					/* Or do it through dma */
+					memcpy(card->tx_dma_handle_host,
+					       skb->data, skb->len);
+					card->dma_port_tx = port;
+					card->dma_len_tx = skb->len;
+					card->dma_txpos = port->txpos;
+					fst_tx_dma(card,
+						   (char *) card->
+						   tx_dma_handle_card,
+						   (char *)
+						   BUF_OFFSET(txBuffer[pi]
+							      [port->txpos][0]),
+						   skb->len);
+				}
+				if (++port->txpos >= NUM_TX_BUFFER)
+					port->txpos = 0;
+				/*
+				 * If we have flow control on, can we now release it?
+				 */
+				if (port->start) {
+					if (txq_length < fst_txq_low) {
+						netif_wake_queue(port_to_dev
+								 (port));
+						port->start = 0;
+					}
+				}
+				dev_kfree_skb(skb);
+			} else {
+				/*
+				 * Nothing to send so break out of the while loop
+				 */
+				break;
+			}
+		}
+	}
+}
+
+static void
+do_bottom_half_rx(struct fst_card_info *card)
+{
+	struct fst_port_info *port;
+	int pi;
+	int rx_count = 0;
+
+	/* Check for rx completions on all ports on this card */
+	dbg(DBG_RX, "do_bottom_half_rx\n");
+	for (pi = 0, port = card->ports; pi < card->nports; pi++, port++) {
+		if (!port->run)
+			continue;
+
+		while (!(FST_RDB(card, rxDescrRing[pi][port->rxpos].bits)
+			 & DMA_OWN) && !(card->dmarx_in_progress)) {
+			if (rx_count > fst_max_reads) {
+				/*
+				 * Don't spend forever in receive processing
+				 * Schedule another event
+				 */
+				fst_q_work_item(&fst_work_intq, card->card_no);
+				tasklet_schedule(&fst_int_task);
+				break;	/* Leave the loop */
+			}
+			fst_intr_rx(card, port);
+			rx_count++;
+		}
+	}
+}
 
 /*
  *      The interrupt service routine
  *      Dev_id is our fst_card_info pointer
  */
-static irqreturn_t
-fst_intr ( int irq, void *dev_id, struct pt_regs *regs )
+irqreturn_t
+fst_intr(int irq, void *dev_id, struct pt_regs *regs)
 {
-        struct fst_card_info *card;
-        struct fst_port_info *port;
-        int rdidx;                      /* Event buffer indices */
-        int wridx;
-        int event;                      /* Actual event for processing */
-        int pi;
-
-        if (( card = dev_id ) == NULL )
-        {
-                dbg ( DBG_INTR,"intr: spurious %d\n", irq );
-                return IRQ_NONE;
-        }
-
-        dbg ( DBG_INTR,"intr: %d %p\n", irq, card );
-
-        spin_lock ( &card->card_lock );
-
-        /* Clear and reprime the interrupt source */
-        fst_clear_intr ( card );
-
-        /* Set the software acknowledge */
-        FST_WRB ( card, interruptHandshake, 0xEE );
-
-        /* Drain the event queue */
-        rdidx = FST_RDB ( card, interruptEvent.rdindex );
-        wridx = FST_RDB ( card, interruptEvent.wrindex );
-        while ( rdidx != wridx )
-        {
-                event = FST_RDB ( card, interruptEvent.evntbuff[rdidx]);
-
-                port = &card->ports[event & 0x03];
-
-                dbg ( DBG_INTR,"intr: %x\n", event );
-
-                switch ( event )
-                {
-                case CTLA_CHG:
-                case CTLB_CHG:
-                case CTLC_CHG:
-                case CTLD_CHG:
-                        if ( port->run )
-                                fst_intr_ctlchg ( card, port );
-                        break;
-
-                case ABTA_SENT:
-                case ABTB_SENT:
-                case ABTC_SENT:
-                case ABTD_SENT:
-                        dbg ( DBG_TX,"Abort complete port %d\n", event & 0x03 );
-                        break;
+	struct fst_card_info *card;
+	struct fst_port_info *port;
+	int rdidx;		/* Event buffer indices */
+	int wridx;
+	int event;		/* Actual event for processing */
+	unsigned int dma_intcsr = 0;
+	unsigned int do_card_interrupt;
+	unsigned int int_retry_count;
+
+	if ((card = dev_id) == NULL) {
+		dbg(DBG_INTR, "intr: spurious %d\n", irq);
+		return IRQ_NONE;
+	}
 
-                case TXA_UNDF:
-                case TXB_UNDF:
-                case TXC_UNDF:
-                case TXD_UNDF:
-                        /* Difficult to see how we'd get this given that we
-                         * always load up the entire packet for DMA.
-                         */
-                        dbg ( DBG_TX,"Tx underflow port %d\n", event & 0x03 );
-                        hdlc_stats(port_to_dev(port))->tx_errors++;
-                        hdlc_stats(port_to_dev(port))->tx_fifo_errors++;
-                        break;
+	/*
+	 * Check to see if the interrupt was for this card
+	 * return if not
+	 * Note that the call to clear the interrupt is important
+	 */
+	dbg(DBG_INTR, "intr: %d %p\n", irq, card);
+	if (card->state != FST_RUNNING) {
+		printk_err
+		    ("Interrupt received for card %d in a non running state (%d)\n",
+		     card->card_no, card->state);
+
+		/* 
+		 * It is possible to really be running, i.e. we have re-loaded
+		 * a running card
+		 * Clear and reprime the interrupt source 
+		 */
+		fst_clear_intr(card);
+		return IRQ_HANDLED;
+	}
 
-                case INIT_CPLT:
-                        dbg ( DBG_INIT,"Card init OK intr\n");
-                        break;
+	/* Clear and reprime the interrupt source */
+	fst_clear_intr(card);
 
-                case INIT_FAIL:
-                        dbg ( DBG_INIT,"Card init FAILED intr\n");
-                        card->state = FST_IFAILED;
-                        break;
+	/*
+	 * Is the interrupt for this card (handshake == 1)
+	 */
+	do_card_interrupt = 0;
+	if (FST_RDB(card, interruptHandshake) == 1) {
+		do_card_interrupt += FST_CARD_INT;
+		/* Set the software acknowledge */
+		FST_WRB(card, interruptHandshake, 0xEE);
+	}
+	if (card->family == FST_FAMILY_TXU) {
+		/*
+		 * Is it a DMA Interrupt
+		 */
+		dma_intcsr = inl(card->pci_conf + INTCSR_9054);
+		if (dma_intcsr & 0x00200000) {
+			/*
+			 * DMA Channel 0 (Rx transfer complete)
+			 */
+			dbg(DBG_RX, "DMA Rx xfer complete\n");
+			outb(0x8, card->pci_conf + DMACSR0);
+			fst_rx_dma_complete(card, card->dma_port_rx,
+					    card->dma_len_rx, card->dma_skb_rx,
+					    card->dma_rxpos);
+			card->dmarx_in_progress = 0;
+			do_card_interrupt += FST_RX_DMA_INT;
+		}
+		if (dma_intcsr & 0x00400000) {
+			/*
+			 * DMA Channel 1 (Tx transfer complete)
+			 */
+			dbg(DBG_TX, "DMA Tx xfer complete\n");
+			outb(0x8, card->pci_conf + DMACSR1);
+			fst_tx_dma_complete(card, card->dma_port_tx,
+					    card->dma_len_tx, card->dma_txpos);
+			card->dmatx_in_progress = 0;
+			do_card_interrupt += FST_TX_DMA_INT;
+		}
+	}
 
-                default:
-                        printk_err ("intr: unknown card event code. ignored\n");
-                        break;
-                }
+	/*
+	 * Have we been missing Interrupts
+	 */
+	int_retry_count = FST_RDL(card, interruptRetryCount);
+	if (int_retry_count) {
+		dbg(DBG_ASS, "Card %d int_retry_count is  %d\n",
+		    card->card_no, int_retry_count);
+		FST_WRL(card, interruptRetryCount, 0);
+	}
 
-                /* Bump and wrap the index */
-                if ( ++rdidx >= MAX_CIRBUFF )
-                        rdidx = 0;
-        }
-        FST_WRB ( card, interruptEvent.rdindex, rdidx );
-
-        for ( pi = 0, port = card->ports ; pi < card->nports ; pi++, port++ )
-        {
-                if ( ! port->run )
-                        continue;
-
-                /* Check for rx completions */
-                while ( ! ( FST_RDB ( card, rxDescrRing[pi][port->rxpos].bits )
-                                                                & DMA_OWN ))
-                {
-                        fst_intr_rx ( card, port );
-                }
+	if (!do_card_interrupt) {
+		return IRQ_HANDLED;
+	}
 
-                /* Check for Tx completions */
-                while ( port->txcnt > 0 && ! ( FST_RDB ( card,
-                        txDescrRing[pi][port->txipos].bits ) & DMA_OWN ))
-                {
-                        --port->txcnt;
-                        if ( ++port->txipos >= NUM_TX_BUFFER )
-                                port->txipos = 0;
-                        netif_wake_queue ( port_to_dev ( port ));
-                }
-        }
+	/* Scehdule the bottom half of the ISR */
+	fst_q_work_item(&fst_work_intq, card->card_no);
+	tasklet_schedule(&fst_int_task);
+
+	/* Drain the event queue */
+	rdidx = FST_RDB(card, interruptEvent.rdindex) & 0x1f;
+	wridx = FST_RDB(card, interruptEvent.wrindex) & 0x1f;
+	while (rdidx != wridx) {
+		event = FST_RDB(card, interruptEvent.evntbuff[rdidx]);
+		port = &card->ports[event & 0x03];
+
+		dbg(DBG_INTR, "Processing Interrupt event: %x\n", event);
+
+		switch (event) {
+		case TE1_ALMA:
+			dbg(DBG_INTR, "TE1 Alarm intr\n");
+			if (port->run)
+				fst_intr_te1_alarm(card, port);
+			break;
+
+		case CTLA_CHG:
+		case CTLB_CHG:
+		case CTLC_CHG:
+		case CTLD_CHG:
+			if (port->run)
+				fst_intr_ctlchg(card, port);
+			break;
+
+		case ABTA_SENT:
+		case ABTB_SENT:
+		case ABTC_SENT:
+		case ABTD_SENT:
+			dbg(DBG_TX, "Abort complete port %d\n", port->index);
+			break;
+
+		case TXA_UNDF:
+		case TXB_UNDF:
+		case TXC_UNDF:
+		case TXD_UNDF:
+			/* Difficult to see how we'd get this given that we
+			 * always load up the entire packet for DMA.
+			 */
+			dbg(DBG_TX, "Tx underflow port %d\n", port->index);
+                        hdlc_stats(port_to_dev(port))->tx_errors++;
+                        hdlc_stats(port_to_dev(port))->tx_fifo_errors;
+			dbg(DBG_ASS, "Tx underflow on card %d port %d\n",
+			    card->card_no, port->index);
+			break;
+
+		case INIT_CPLT:
+			dbg(DBG_INIT, "Card init OK intr\n");
+			break;
+
+		case INIT_FAIL:
+			dbg(DBG_INIT, "Card init FAILED intr\n");
+			card->state = FST_IFAILED;
+			break;
+
+		default:
+			printk_err("intr: unknown card event %d. ignored\n",
+				   event);
+			break;
+		}
 
-        spin_unlock ( &card->card_lock );
-	return IRQ_HANDLED;
+		/* Bump and wrap the index */
+		if (++rdidx >= MAX_CIRBUFF)
+			rdidx = 0;
+	}
+	FST_WRB(card, interruptEvent.rdindex, rdidx);
+        return IRQ_HANDLED;
 }
 
-
 /*      Check that the shared memory configuration is one that we can handle
  *      and that some basic parameters are correct
  */
 static void
-check_started_ok ( struct fst_card_info *card )
+check_started_ok(struct fst_card_info *card)
 {
-        int i;
+	int i;
 
-        /* Check structure version and end marker */
-        if ( FST_RDW ( card, smcVersion ) != SMC_VERSION )
-        {
-                printk_err ("Bad shared memory version %d expected %d\n",
-                                FST_RDW ( card, smcVersion ), SMC_VERSION );
-                card->state = FST_BADVERSION;
-                return;
-        }
-        if ( FST_RDL ( card, endOfSmcSignature ) != END_SIG )
-        {
-                printk_err ("Missing shared memory signature\n");
-                card->state = FST_BADVERSION;
-                return;
-        }
-        /* Firmware status flag, 0x00 = initialising, 0x01 = OK, 0xFF = fail */
-        if (( i = FST_RDB ( card, taskStatus )) == 0x01 )
-        {
-                card->state = FST_RUNNING;
-        }
-        else if ( i == 0xFF )
-        {
-                printk_err ("Firmware initialisation failed. Card halted\n");
-                card->state = FST_HALTED;
-                return;
-        }
-        else if ( i != 0x00 )
-        {
-                printk_err ("Unknown firmware status 0x%x\n", i );
-                card->state = FST_HALTED;
-                return;
-        }
-
-        /* Finally check the number of ports reported by firmware against the
-         * number we assumed at card detection. Should never happen with
-         * existing firmware etc so we just report it for the moment.
-         */
-        if ( FST_RDL ( card, numberOfPorts ) != card->nports )
-        {
-                printk_warn ("Port count mismatch."
-                                " Firmware thinks %d we say %d\n",
-                                FST_RDL ( card, numberOfPorts ), card->nports );
-        }
-}
+	/* Check structure version and end marker */
+	if (FST_RDW(card, smcVersion) != SMC_VERSION) {
+		printk_err("Bad shared memory version %d expected %d\n",
+			   FST_RDW(card, smcVersion), SMC_VERSION);
+		card->state = FST_BADVERSION;
+		return;
+	}
+	if (FST_RDL(card, endOfSmcSignature) != END_SIG) {
+		printk_err("Missing shared memory signature\n");
+		card->state = FST_BADVERSION;
+		return;
+	}
+	/* Firmware status flag, 0x00 = initialising, 0x01 = OK, 0xFF = fail */
+	if ((i = FST_RDB(card, taskStatus)) == 0x01) {
+		card->state = FST_RUNNING;
+	} else if (i == 0xFF) {
+		printk_err("Firmware initialisation failed. Card halted\n");
+		card->state = FST_HALTED;
+		return;
+	} else if (i != 0x00) {
+		printk_err("Unknown firmware status 0x%x\n", i);
+		card->state = FST_HALTED;
+		return;
+	}
 
+	/* Finally check the number of ports reported by firmware against the
+	 * number we assumed at card detection. Should never happen with
+	 * existing firmware etc so we just report it for the moment.
+	 */
+	if (FST_RDL(card, numberOfPorts) != card->nports) {
+		printk_warn("Port count mismatch on card %d."
+			    " Firmware thinks %d we say %d\n", card->card_no,
+			    FST_RDL(card, numberOfPorts), card->nports);
+	}
+}
 
 static int
-set_conf_from_info ( struct fst_card_info *card, struct fst_port_info *port,
-                struct fstioc_info *info )
+set_conf_from_info(struct fst_card_info *card, struct fst_port_info *port,
+		   struct fstioc_info *info)
 {
-        int err;
+	int err;
+	unsigned char my_framing;
+
+	/* Set things according to the user set valid flags 
+	 * Several of the old options have been invalidated/replaced by the 
+	 * generic hdlc package.
+	 */
+	err = 0;
+	if (info->valid & FSTVAL_PROTO) {
+		if (info->proto == FST_RAW)
+			port->mode = FST_RAW;
+		else
+			port->mode = FST_GEN_HDLC;
+	}
 
-        /* Set things according to the user set valid flags.
-         * Several of the old options have been invalidated/replaced by the
-         * generic HDLC package.
-         */
-        err = 0;
-        if ( info->valid & FSTVAL_PROTO )
-                err = -EINVAL;
-        if ( info->valid & FSTVAL_CABLE )
-                err = -EINVAL;
-        if ( info->valid & FSTVAL_SPEED )
-                err = -EINVAL;
+	if (info->valid & FSTVAL_CABLE)
+		err = -EINVAL;
 
-        if ( info->valid & FSTVAL_MODE )
-                FST_WRW ( card, cardMode, info->cardMode );
+	if (info->valid & FSTVAL_SPEED)
+		err = -EINVAL;
+
+	if (info->valid & FSTVAL_PHASE)
+		FST_WRB(card, portConfig[port->index].invertClock,
+			info->invertClock);
+	if (info->valid & FSTVAL_MODE)
+		FST_WRW(card, cardMode, info->cardMode);
+	if (info->valid & FSTVAL_TE1) {
+		FST_WRL(card, suConfig.dataRate, info->lineSpeed);
+		FST_WRB(card, suConfig.clocking, info->clockSource);
+		my_framing = FRAMING_E1;
+		if (info->framing == E1)
+			my_framing = FRAMING_E1;
+		if (info->framing == T1)
+			my_framing = FRAMING_T1;
+		if (info->framing == J1)
+			my_framing = FRAMING_J1;
+		FST_WRB(card, suConfig.framing, my_framing);
+		FST_WRB(card, suConfig.structure, info->structure);
+		FST_WRB(card, suConfig.interface, info->interface);
+		FST_WRB(card, suConfig.coding, info->coding);
+		FST_WRB(card, suConfig.lineBuildOut, info->lineBuildOut);
+		FST_WRB(card, suConfig.equalizer, info->equalizer);
+		FST_WRB(card, suConfig.transparentMode, info->transparentMode);
+		FST_WRB(card, suConfig.loopMode, info->loopMode);
+		FST_WRB(card, suConfig.range, info->range);
+		FST_WRB(card, suConfig.txBufferMode, info->txBufferMode);
+		FST_WRB(card, suConfig.rxBufferMode, info->rxBufferMode);
+		FST_WRB(card, suConfig.startingSlot, info->startingSlot);
+		FST_WRB(card, suConfig.losThreshold, info->losThreshold);
+		if (info->idleCode)
+			FST_WRB(card, suConfig.enableIdleCode, 1);
+		else
+			FST_WRB(card, suConfig.enableIdleCode, 0);
+		FST_WRB(card, suConfig.idleCode, info->idleCode);
+#if FST_DEBUG
+		if (info->valid & FSTVAL_TE1) {
+			printk("Setting TE1 data\n");
+			printk("Line Speed = %d\n", info->lineSpeed);
+			printk("Start slot = %d\n", info->startingSlot);
+			printk("Clock source = %d\n", info->clockSource);
+			printk("Framing = %d\n", my_framing);
+			printk("Structure = %d\n", info->structure);
+			printk("interface = %d\n", info->interface);
+			printk("Coding = %d\n", info->coding);
+			printk("Line build out = %d\n", info->lineBuildOut);
+			printk("Equaliser = %d\n", info->equalizer);
+			printk("Transparent mode = %d\n",
+			       info->transparentMode);
+			printk("Loop mode = %d\n", info->loopMode);
+			printk("Range = %d\n", info->range);
+			printk("Tx Buffer mode = %d\n", info->txBufferMode);
+			printk("Rx Buffer mode = %d\n", info->rxBufferMode);
+			printk("LOS Threshold = %d\n", info->losThreshold);
+			printk("Idle Code = %d\n", info->idleCode);
+		}
+#endif
+	}
 #if FST_DEBUG
-        if ( info->valid & FSTVAL_DEBUG )
-                fst_debug_mask = info->debug;
+	if (info->valid & FSTVAL_DEBUG) {
+		fst_debug_mask = info->debug;
+	}
 #endif
 
-        return err;
+	return err;
 }
 
 static void
-gather_conf_info ( struct fst_card_info *card, struct fst_port_info *port,
-                struct fstioc_info *info )
+gather_conf_info(struct fst_card_info *card, struct fst_port_info *port,
+		 struct fstioc_info *info)
 {
-        int i;
+	int i;
 
-        memset ( info, 0, sizeof ( struct fstioc_info ));
+	memset(info, 0, sizeof (struct fstioc_info));
 
-        i = port->index;
-        info->nports = card->nports;
-        info->type   = card->type;
-        info->state  = card->state;
-        info->proto  = FST_GEN_HDLC;
-        info->index  = i;
+	i = port->index;
+	info->kernelVersion = LINUX_VERSION_CODE;
+	info->nports = card->nports;
+	info->type = card->type;
+	info->state = card->state;
+	info->proto = FST_GEN_HDLC;
+	info->index = i;
 #if FST_DEBUG
-        info->debug  = fst_debug_mask;
+	info->debug = fst_debug_mask;
 #endif
 
-        /* Only mark information as valid if card is running.
-         * Copy the data anyway in case it is useful for diagnostics
-         */
-        info->valid
-                = (( card->state == FST_RUNNING ) ? FSTVAL_ALL : FSTVAL_CARD )
+	/* Only mark information as valid if card is running.
+	 * Copy the data anyway in case it is useful for diagnostics
+	 */
+	info->valid = ((card->state == FST_RUNNING) ? FSTVAL_ALL : FSTVAL_CARD)
 #if FST_DEBUG
-                | FSTVAL_DEBUG
+	    | FSTVAL_DEBUG
 #endif
-                ;
+	    ;
 
-        info->lineInterface = FST_RDW ( card, portConfig[i].lineInterface );
-        info->internalClock = FST_RDB ( card, portConfig[i].internalClock );
-        info->lineSpeed     = FST_RDL ( card, portConfig[i].lineSpeed );
-        info->v24IpSts      = FST_RDL ( card, v24IpSts[i] );
-        info->v24OpSts      = FST_RDL ( card, v24OpSts[i] );
-        info->clockStatus   = FST_RDW ( card, clockStatus[i] );
-        info->cableStatus   = FST_RDW ( card, cableStatus );
-        info->cardMode      = FST_RDW ( card, cardMode );
-        info->smcFirmwareVersion  = FST_RDL ( card, smcFirmwareVersion );
+	info->lineInterface = FST_RDW(card, portConfig[i].lineInterface);
+	info->internalClock = FST_RDB(card, portConfig[i].internalClock);
+	info->lineSpeed = FST_RDL(card, portConfig[i].lineSpeed);
+	info->invertClock = FST_RDB(card, portConfig[i].invertClock);
+	info->v24IpSts = FST_RDL(card, v24IpSts[i]);
+	info->v24OpSts = FST_RDL(card, v24OpSts[i]);
+	info->clockStatus = FST_RDW(card, clockStatus[i]);
+	info->cableStatus = FST_RDW(card, cableStatus);
+	info->cardMode = FST_RDW(card, cardMode);
+	info->smcFirmwareVersion = FST_RDL(card, smcFirmwareVersion);
+
+	/*
+	 * The T2U can report cable presence for both A or B
+	 * in bits 0 and 1 of cableStatus.  See which port we are and 
+	 * do the mapping.
+	 */
+	if (card->family == FST_FAMILY_TXU) {
+		if (port->index == 0) {
+			/*
+			 * Port A
+			 */
+			info->cableStatus = info->cableStatus & 1;
+		} else {
+			/*
+			 * Port B
+			 */
+			info->cableStatus = info->cableStatus >> 1;
+			info->cableStatus = info->cableStatus & 1;
+		}
+	}
+	/*
+	 * Some additional bits if we are TE1
+	 */
+	if (card->type == FST_TYPE_TE1) {
+		info->lineSpeed = FST_RDL(card, suConfig.dataRate);
+		info->clockSource = FST_RDB(card, suConfig.clocking);
+		info->framing = FST_RDB(card, suConfig.framing);
+		info->structure = FST_RDB(card, suConfig.structure);
+		info->interface = FST_RDB(card, suConfig.interface);
+		info->coding = FST_RDB(card, suConfig.coding);
+		info->lineBuildOut = FST_RDB(card, suConfig.lineBuildOut);
+		info->equalizer = FST_RDB(card, suConfig.equalizer);
+		info->loopMode = FST_RDB(card, suConfig.loopMode);
+		info->range = FST_RDB(card, suConfig.range);
+		info->txBufferMode = FST_RDB(card, suConfig.txBufferMode);
+		info->rxBufferMode = FST_RDB(card, suConfig.rxBufferMode);
+		info->startingSlot = FST_RDB(card, suConfig.startingSlot);
+		info->losThreshold = FST_RDB(card, suConfig.losThreshold);
+		if (FST_RDB(card, suConfig.enableIdleCode))
+			info->idleCode = FST_RDB(card, suConfig.idleCode);
+		else
+			info->idleCode = 0;
+		info->receiveBufferDelay =
+		    FST_RDL(card, suStatus.receiveBufferDelay);
+		info->framingErrorCount =
+		    FST_RDL(card, suStatus.framingErrorCount);
+		info->codeViolationCount =
+		    FST_RDL(card, suStatus.codeViolationCount);
+		info->crcErrorCount = FST_RDL(card, suStatus.crcErrorCount);
+		info->lineAttenuation = FST_RDL(card, suStatus.lineAttenuation);
+		info->lossOfSignal = FST_RDB(card, suStatus.lossOfSignal);
+		info->receiveRemoteAlarm =
+		    FST_RDB(card, suStatus.receiveRemoteAlarm);
+		info->alarmIndicationSignal =
+		    FST_RDB(card, suStatus.alarmIndicationSignal);
+	}
 }
 
-
 static int
-fst_set_iface ( struct fst_card_info *card, struct fst_port_info *port,
-                struct ifreq *ifr )
+fst_set_iface(struct fst_card_info *card, struct fst_port_info *port,
+	      struct ifreq *ifr)
 {
-        sync_serial_settings sync;
-        int i;
+	sync_serial_settings sync;
+	int i;
+
+	if (ifr->ifr_settings.size != sizeof (sync)) {
+		return -ENOMEM;
+	}
+
+	if (copy_from_user
+	    (&sync, ifr->ifr_settings.ifs_ifsu.sync, sizeof (sync))) {
+		return -EFAULT;
+	}
+
+	if (sync.loopback)
+		return -EINVAL;
+
+	i = port->index;
+
+	switch (ifr->ifr_settings.type) {
+	case IF_IFACE_V35:
+		FST_WRW(card, portConfig[i].lineInterface, V35);
+		port->hwif = V35;
+		break;
+
+	case IF_IFACE_V24:
+		FST_WRW(card, portConfig[i].lineInterface, V24);
+		port->hwif = V24;
+		break;
+
+	case IF_IFACE_X21:
+		FST_WRW(card, portConfig[i].lineInterface, X21);
+		port->hwif = X21;
+		break;
+
+	case IF_IFACE_X21D:
+		FST_WRW(card, portConfig[i].lineInterface, X21D);
+		port->hwif = X21D;
+		break;
+
+	case IF_IFACE_T1:
+		FST_WRW(card, portConfig[i].lineInterface, T1);
+		port->hwif = T1;
+		break;
+
+	case IF_IFACE_E1:
+		FST_WRW(card, portConfig[i].lineInterface, E1);
+		port->hwif = E1;
+		break;
+
+	case IF_IFACE_SYNC_SERIAL:
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	switch (sync.clock_type) {
+	case CLOCK_EXT:
+		FST_WRB(card, portConfig[i].internalClock, EXTCLK);
+		break;
+
+	case CLOCK_INT:
+		FST_WRB(card, portConfig[i].internalClock, INTCLK);
+		break;
 
-        if (copy_from_user (&sync, ifr->ifr_settings.ifs_ifsu.sync,
-			    sizeof (sync)))
-                return -EFAULT;
-
-        if ( sync.loopback )
-                return -EINVAL;
-
-        i = port->index;
-
-        switch (ifr->ifr_settings.type)
-        {
-        case IF_IFACE_V35:
-                FST_WRW ( card, portConfig[i].lineInterface, V35 );
-                port->hwif = V35;
-                break;
-
-        case IF_IFACE_V24:
-                FST_WRW ( card, portConfig[i].lineInterface, V24 );
-                port->hwif = V24;
-                break;
-
-        case IF_IFACE_X21:
-                FST_WRW ( card, portConfig[i].lineInterface, X21 );
-                port->hwif = X21;
-                break;
-
-        case IF_IFACE_SYNC_SERIAL:
-                break;
-
-        default:
-                return -EINVAL;
-        }
-
-        switch ( sync.clock_type )
-        {
-        case CLOCK_EXT:
-                FST_WRB ( card, portConfig[i].internalClock, EXTCLK );
-                break;
-
-        case CLOCK_INT:
-                FST_WRB ( card, portConfig[i].internalClock, INTCLK );
-                break;
-
-        default:
-                return -EINVAL;
-        }
-        FST_WRL ( card, portConfig[i].lineSpeed, sync.clock_rate );
-        return 0;
+	default:
+		return -EINVAL;
+	}
+	FST_WRL(card, portConfig[i].lineSpeed, sync.clock_rate);
+	return 0;
 }
 
 static int
-fst_get_iface ( struct fst_card_info *card, struct fst_port_info *port,
-                struct ifreq *ifr )
+fst_get_iface(struct fst_card_info *card, struct fst_port_info *port,
+	      struct ifreq *ifr)
 {
-        sync_serial_settings sync;
-        int i;
+	sync_serial_settings sync;
+	int i;
+
+	/* First check what line type is set, we'll default to reporting X.21
+	 * if nothing is set as IF_IFACE_SYNC_SERIAL implies it can't be
+	 * changed
+	 */
+	switch (port->hwif) {
+	case E1:
+		ifr->ifr_settings.type = IF_IFACE_E1;
+		break;
+	case T1:
+		ifr->ifr_settings.type = IF_IFACE_T1;
+		break;
+	case V35:
+		ifr->ifr_settings.type = IF_IFACE_V35;
+		break;
+	case V24:
+		ifr->ifr_settings.type = IF_IFACE_V24;
+		break;
+	case X21D:
+		ifr->ifr_settings.type = IF_IFACE_X21D;
+		break;
+	case X21:
+	default:
+		ifr->ifr_settings.type = IF_IFACE_X21;
+		break;
+	}
+	if (ifr->ifr_settings.size == 0) {
+		return 0;	/* only type requested */
+	}
+	if (ifr->ifr_settings.size < sizeof (sync)) {
+		return -ENOMEM;
+	}
 
-        /* First check what line type is set, we'll default to reporting X.21
-         * if nothing is set as IF_IFACE_SYNC_SERIAL implies it can't be
-         * changed
-         */
-        switch ( port->hwif )
-        {
-        case V35:
-                ifr->ifr_settings.type = IF_IFACE_V35;
-                break;
-        case V24:
-                ifr->ifr_settings.type = IF_IFACE_V24;
-                break;
-        case X21:
-        default:
-                ifr->ifr_settings.type = IF_IFACE_X21;
-                break;
-        }
-
-	if (ifr->ifr_settings.size < sizeof(sync)) {
-		ifr->ifr_settings.size = sizeof(sync); /* data size wanted */
-		return -ENOBUFS;
-	}
-
-        i = port->index;
-        sync.clock_rate = FST_RDL ( card, portConfig[i].lineSpeed );
-        /* Lucky card and linux use same encoding here */
-        sync.clock_type = FST_RDB ( card, portConfig[i].internalClock );
-        sync.loopback = 0;
-
-        if (copy_to_user (ifr->ifr_settings.ifs_ifsu.sync, &sync,
-			  sizeof(sync)))
-                return -EFAULT;
+	i = port->index;
+	sync.clock_rate = FST_RDL(card, portConfig[i].lineSpeed);
+	/* Lucky card and linux use same encoding here */
+	sync.clock_type = FST_RDB(card, portConfig[i].internalClock) ==
+	    INTCLK ? CLOCK_INT : CLOCK_EXT;
+	sync.loopback = 0;
 
-        return 0;
-}
+	if (copy_to_user(ifr->ifr_settings.ifs_ifsu.sync, &sync, sizeof (sync))) {
+		return -EFAULT;
+	}
 
+	ifr->ifr_settings.size = sizeof (sync);
+	return 0;
+}
 
 static int
-fst_ioctl ( struct net_device *dev, struct ifreq *ifr, int cmd )
+fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-        struct fst_card_info *card;
-        struct fst_port_info *port;
-        struct fstioc_write wrthdr;
-        struct fstioc_info info;
-        unsigned long flags;
-
-        dbg ( DBG_IOCTL,"ioctl: %x, %p\n", cmd, ifr->ifr_data );
-
-        port = dev_to_port ( dev );
-        card = port->card;
-
-        if ( !capable ( CAP_NET_ADMIN ))
-                return -EPERM;
-
-        switch ( cmd )
-        {
-        case FSTCPURESET:
-                fst_cpureset ( card );
-                card->state = FST_RESET;
-                return 0;
-
-        case FSTCPURELEASE:
-                fst_cpurelease ( card );
-                card->state = FST_STARTING;
-                return 0;
-
-        case FSTWRITE:                  /* Code write (download) */
-
-                /* First copy in the header with the length and offset of data
-                 * to write
-                 */
-                if ( ifr->ifr_data == NULL )
-                {
-                        return -EINVAL;
-                }
-                if ( copy_from_user ( &wrthdr, ifr->ifr_data,
-                                        sizeof ( struct fstioc_write )))
-                {
-                        return -EFAULT;
-                }
+	struct fst_card_info *card;
+	struct fst_port_info *port;
+	struct fstioc_write wrthdr;
+	struct fstioc_info info;
+	unsigned long flags;
 
-                /* Sanity check the parameters. We don't support partial writes
-                 * when going over the top
-                 */
-                if ( wrthdr.size > FST_MEMSIZE || wrthdr.offset > FST_MEMSIZE
-				|| wrthdr.size + wrthdr.offset > FST_MEMSIZE )
-                {
-                        return -ENXIO;
-                }
+	dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data);
 
-                /* Now copy the data to the card.
-                 * This will probably break on some architectures.
-                 * I'll fix it when I have something to test on.
-                 */
-                if ( copy_from_user ( card->mem + wrthdr.offset,
-                                ifr->ifr_data + sizeof ( struct fstioc_write ),
-                                wrthdr.size ))
-                {
-                        return -EFAULT;
-                }
+	port = dev_to_port(dev);
+	card = port->card;
 
-                /* Writes to the memory of a card in the reset state constitute
-                 * a download
-                 */
-                if ( card->state == FST_RESET )
-                {
-                        card->state = FST_DOWNLOAD;
-                }
-                return 0;
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
 
-        case FSTGETCONF:
+	switch (cmd) {
+	case FSTCPURESET:
+		fst_cpureset(card);
+		card->state = FST_RESET;
+		return 0;
 
-                /* If card has just been started check the shared memory config
-                 * version and marker
-                 */
-                if ( card->state == FST_STARTING )
-                {
-                        check_started_ok ( card );
-
-                        /* If everything checked out enable card interrupts */
-                        if ( card->state == FST_RUNNING )
-                        {
-                                spin_lock_irqsave ( &card->card_lock, flags );
-                                fst_clear_intr ( card );
-                                FST_WRB ( card, interruptHandshake, 0xEE );
-                                spin_unlock_irqrestore ( &card->card_lock,
-                                                                flags );
-                        }
-                }
+	case FSTCPURELEASE:
+		fst_cpurelease(card);
+		card->state = FST_STARTING;
+		return 0;
 
-                if ( ifr->ifr_data == NULL )
-                {
-                        return -EINVAL;
-                }
+	case FSTWRITE:		/* Code write (download) */
 
-                gather_conf_info ( card, port, &info );
+		/* First copy in the header with the length and offset of data
+		 * to write
+		 */
+		if (ifr->ifr_data == NULL) {
+			return -EINVAL;
+		}
+		if (copy_from_user(&wrthdr, ifr->ifr_data,
+				   sizeof (struct fstioc_write))) {
+			return -EFAULT;
+		}
 
-                if ( copy_to_user ( ifr->ifr_data, &info, sizeof ( info )))
-                {
-                        return -EFAULT;
-                }
-                return 0;
+		/* Sanity check the parameters. We don't support partial writes
+		 * when going over the top
+		 */
+		if (wrthdr.size > FST_MEMSIZE || wrthdr.offset > FST_MEMSIZE
+		    || wrthdr.size + wrthdr.offset > FST_MEMSIZE) {
+			return -ENXIO;
+		}
 
-        case FSTSETCONF:
+		/* Now copy the data to the card.
+		 * This will probably break on some architectures.
+		 * I'll fix it when I have something to test on.
+		 */
+		if (copy_from_user(card->mem + wrthdr.offset,
+				   ifr->ifr_data + sizeof (struct fstioc_write),
+				   wrthdr.size)) {
+			return -EFAULT;
+		}
 
-                /* Most of the setting have been moved to the generic ioctls
-                 * this just covers debug and board ident mode now
-                 */
-                if ( copy_from_user ( &info,  ifr->ifr_data, sizeof ( info )))
-                {
-                        return -EFAULT;
-                }
+		/* Writes to the memory of a card in the reset state constitute
+		 * a download
+		 */
+		if (card->state == FST_RESET) {
+			card->state = FST_DOWNLOAD;
+		}
+		return 0;
 
-                return set_conf_from_info ( card, port, &info );
+	case FSTGETCONF:
 
-        case SIOCWANDEV:
-                switch (ifr->ifr_settings.type)
-                {
-                case IF_GET_IFACE:
-                        return fst_get_iface ( card, port, ifr );
-
-                case IF_IFACE_SYNC_SERIAL:
-                case IF_IFACE_V35:
-                case IF_IFACE_V24:
-                case IF_IFACE_X21:
-                        return fst_set_iface ( card, port, ifr );
+		/* If card has just been started check the shared memory config
+		 * version and marker
+		 */
+		if (card->state == FST_STARTING) {
+			check_started_ok(card);
 
-                default:
-                        return hdlc_ioctl ( dev, ifr, cmd );
-                }
+			/* If everything checked out enable card interrupts */
+			if (card->state == FST_RUNNING) {
+				spin_lock_irqsave(&card->card_lock, flags);
+				fst_enable_intr(card);
+				FST_WRB(card, interruptHandshake, 0xEE);
+				spin_unlock_irqrestore(&card->card_lock, flags);
+			}
+		}
 
-        default:
-                /* Not one of ours. Pass through to HDLC package */
-                return hdlc_ioctl ( dev, ifr, cmd );
-        }
-}
+		if (ifr->ifr_data == NULL) {
+			return -EINVAL;
+		}
 
+		gather_conf_info(card, port, &info);
 
-static void
-fst_openport ( struct fst_port_info *port )
-{
-        int signals;
+		if (copy_to_user(ifr->ifr_data, &info, sizeof (info))) {
+			return -EFAULT;
+		}
+		return 0;
 
-        /* Only init things if card is actually running. This allows open to
-         * succeed for downloads etc.
-         */
-        if ( port->card->state == FST_RUNNING )
-        {
-                if ( port->run )
-                {
-                        dbg ( DBG_OPEN,"open: found port already running\n");
+	case FSTSETCONF:
 
-                        fst_issue_cmd ( port, STOPPORT );
-                        port->run = 0;
-                }
+		/*
+		 * Most of the settings have been moved to the generic ioctls
+		 * this just covers debug and board ident now
+		 */
 
-                fst_rx_config ( port );
-                fst_tx_config ( port );
-                fst_op_raise ( port, OPSTS_RTS | OPSTS_DTR );
+		if (card->state != FST_RUNNING) {
+			printk_err
+			    ("Attempt to configure card %d in non-running state (%d)\n",
+			     card->card_no, card->state);
+			return -EIO;
+		}
+		if (copy_from_user(&info, ifr->ifr_data, sizeof (info))) {
+			return -EFAULT;
+		}
 
-                fst_issue_cmd ( port, STARTPORT );
-                port->run = 1;
+		return set_conf_from_info(card, port, &info);
 
-                signals = FST_RDL ( port->card, v24DebouncedSts[port->index]);
-                if ( signals & (( port->hwif == X21 ) ? IPSTS_INDICATE
-                                                      : IPSTS_DCD ))
-                        netif_carrier_on ( port_to_dev ( port ));
-                else
-                        netif_carrier_off ( port_to_dev ( port ));
-        }
+	case SIOCWANDEV:
+		switch (ifr->ifr_settings.type) {
+		case IF_GET_IFACE:
+			return fst_get_iface(card, port, ifr);
+
+		case IF_IFACE_SYNC_SERIAL:
+		case IF_IFACE_V35:
+		case IF_IFACE_V24:
+		case IF_IFACE_X21:
+		case IF_IFACE_X21D:
+		case IF_IFACE_T1:
+		case IF_IFACE_E1:
+			return fst_set_iface(card, port, ifr);
+
+		case IF_PROTO_RAW:
+			port->mode = FST_RAW;
+			return 0;
+
+		case IF_GET_PROTO:
+			if (port->mode == FST_RAW) {
+				ifr->ifr_settings.type = IF_PROTO_RAW;
+				return 0;
+			}
+			return hdlc_ioctl(dev, ifr, cmd);
+
+		default:
+			port->mode = FST_GEN_HDLC;
+			dbg(DBG_IOCTL, "Passing this type to hdlc %x\n",
+			    ifr->ifr_settings.type);
+			return hdlc_ioctl(dev, ifr, cmd);
+		}
+
+	default:
+		/* Not one of ours. Pass through to HDLC package */
+		return hdlc_ioctl(dev, ifr, cmd);
+	}
 }
 
 static void
-fst_closeport ( struct fst_port_info *port )
+fst_openport(struct fst_port_info *port)
 {
-        if ( port->card->state == FST_RUNNING )
-        {
-                if ( port->run )
-                {
-                        port->run = 0;
-                        fst_op_lower ( port, OPSTS_RTS | OPSTS_DTR );
+	int signals;
+	int txq_length;
+
+	/* Only init things if card is actually running. This allows open to
+	 * succeed for downloads etc.
+	 */
+	if (port->card->state == FST_RUNNING) {
+		if (port->run) {
+			dbg(DBG_OPEN, "open: found port already running\n");
+
+			fst_issue_cmd(port, STOPPORT);
+			port->run = 0;
+		}
+
+		fst_rx_config(port);
+		fst_tx_config(port);
+		fst_op_raise(port, OPSTS_RTS | OPSTS_DTR);
+
+		fst_issue_cmd(port, STARTPORT);
+		port->run = 1;
+
+		signals = FST_RDL(port->card, v24DebouncedSts[port->index]);
+		if (signals & (((port->hwif == X21) || (port->hwif == X21D))
+			       ? IPSTS_INDICATE : IPSTS_DCD))
+			netif_carrier_on(port_to_dev(port));
+		else
+			netif_carrier_off(port_to_dev(port));
+
+		txq_length = port->txqe - port->txqs;
+		port->txqe = 0;
+		port->txqs = 0;
+	}
 
-                        fst_issue_cmd ( port, STOPPORT );
-                }
-                else
-                {
-                        dbg ( DBG_OPEN,"close: port not running\n");
-                }
-        }
 }
 
+static void
+fst_closeport(struct fst_port_info *port)
+{
+	if (port->card->state == FST_RUNNING) {
+		if (port->run) {
+			port->run = 0;
+			fst_op_lower(port, OPSTS_RTS | OPSTS_DTR);
+
+			fst_issue_cmd(port, STOPPORT);
+		} else {
+			dbg(DBG_OPEN, "close: port not running\n");
+		}
+	}
+}
 
 static int
-fst_open ( struct net_device *dev )
+fst_open(struct net_device *dev)
 {
-        int err;
+	int err;
+	struct fst_port_info *port;
 
-        err = hdlc_open (dev);
-        if ( err )
-                return err;
+	port = dev_to_port(dev);
+	if (!try_module_get(THIS_MODULE))
+          return -EBUSY;
+
+	if (port->mode != FST_RAW) {
+		err = hdlc_open(dev);
+		if (err)
+			return err;
+	}
 
-        fst_openport ( dev_to_port ( dev ));
-        netif_wake_queue ( dev );
-        return 0;
+	fst_openport(port);
+	netif_wake_queue(dev);
+	return 0;
 }
 
 static int
-fst_close ( struct net_device *dev )
+fst_close(struct net_device *dev)
 {
-        netif_stop_queue ( dev );
-        fst_closeport ( dev_to_port ( dev ));
-        hdlc_close ( dev );
-        return 0;
+	struct fst_port_info *port;
+	struct fst_card_info *card;
+	unsigned char tx_dma_done;
+	unsigned char rx_dma_done;
+
+	port = dev_to_port(dev);
+	card = port->card;
+
+	tx_dma_done = inb(card->pci_conf + DMACSR1);
+	rx_dma_done = inb(card->pci_conf + DMACSR0);
+	dbg(DBG_OPEN,
+	    "Port Close: tx_dma_in_progress = %d (%x) rx_dma_in_progress = %d (%x)\n",
+	    card->dmatx_in_progress, tx_dma_done, card->dmarx_in_progress,
+	    rx_dma_done);
+
+	netif_stop_queue(dev);
+	fst_closeport(dev_to_port(dev));
+	if (port->mode != FST_RAW) {
+		hdlc_close(dev);
+	}
+	module_put(THIS_MODULE);
+	return 0;
 }
 
 static int
-fst_attach ( struct net_device *dev, unsigned short encoding, unsigned short parity )
+fst_attach(struct net_device *dev, unsigned short encoding, unsigned short parity)
 {
-        /* Setting currently fixed in FarSync card so we check and forget */
-        if ( encoding != ENCODING_NRZ || parity != PARITY_CRC16_PR1_CCITT )
-                return -EINVAL;
-        return 0;
+	/*
+	 * Setting currently fixed in FarSync card so we check and forget
+	 */
+	if (encoding != ENCODING_NRZ || parity != PARITY_CRC16_PR1_CCITT)
+		return -EINVAL;
+	return 0;
 }
 
-
 static void
-fst_tx_timeout ( struct net_device *dev )
+fst_tx_timeout(struct net_device *dev)
 {
-        struct fst_port_info *port;
+	struct fst_port_info *port;
+	struct fst_card_info *card;
 	struct net_device_stats *stats = hdlc_stats(dev);
 
-        dbg ( DBG_INTR | DBG_TX,"tx_timeout\n");
-
-        port = dev_to_port ( dev );
-
-        stats->tx_errors++;
-        stats->tx_aborted_errors++;
-
-        if ( port->txcnt > 0 )
-                fst_issue_cmd ( port, ABORTTX );
-
-        dev->trans_start = jiffies;
-        netif_wake_queue ( dev );
+	port = dev_to_port(dev);
+	card = port->card;
+	stats->tx_errors++;
+	stats->tx_aborted_errors++;
+	dbg(DBG_ASS, "Tx timeout card %d port %d\n",
+	    card->card_no, port->index);
+	fst_issue_cmd(port, ABORTTX);
+
+	dev->trans_start = jiffies;
+	netif_wake_queue(dev);
+	port->start = 0;
 }
 
-
 static int
-fst_start_xmit ( struct sk_buff *skb, struct net_device *dev )
+fst_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
+	struct fst_card_info *card;
+	struct fst_port_info *port;
 	struct net_device_stats *stats = hdlc_stats(dev);
-        struct fst_card_info *card;
-        struct fst_port_info *port;
-        unsigned char dmabits;
-        unsigned long flags;
-        int pi;
-        int txp;
-
-        port = dev_to_port ( dev );
-        card = port->card;
-
-        /* Drop packet with error if we don't have carrier */
-        if ( ! netif_carrier_ok ( dev ))
-        {
-                dev_kfree_skb ( skb );
-                stats->tx_errors++;
-                stats->tx_carrier_errors++;
-                return 0;
-        }
-
-        /* Drop it if it's too big! MTU failure ? */
-        if ( skb->len > LEN_TX_BUFFER )
-        {
-                dbg ( DBG_TX,"Packet too large %d vs %d\n", skb->len,
-                                                LEN_TX_BUFFER );
-                dev_kfree_skb ( skb );
-                stats->tx_errors++;
-                return 0;
-        }
-
-        /* Check we have a buffer */
-        pi = port->index;
-        spin_lock_irqsave ( &card->card_lock, flags );
-        txp = port->txpos;
-        dmabits = FST_RDB ( card, txDescrRing[pi][txp].bits );
-        if ( dmabits & DMA_OWN )
-        {
-                spin_unlock_irqrestore ( &card->card_lock, flags );
-                dbg ( DBG_TX,"Out of Tx buffers\n");
-                dev_kfree_skb ( skb );
-                stats->tx_errors++;
-                return 0;
-        }
-        if ( ++port->txpos >= NUM_TX_BUFFER )
-                port->txpos = 0;
-
-        if ( ++port->txcnt >= NUM_TX_BUFFER )
-                netif_stop_queue ( dev );
-
-        /* Release the card lock before we copy the data as we now have
-         * exclusive access to the buffer.
-         */
-        spin_unlock_irqrestore ( &card->card_lock, flags );
-
-        /* Enqueue the packet */
-        memcpy_toio ( card->mem + BUF_OFFSET ( txBuffer[pi][txp][0]),
-                                                skb->data, skb->len );
-        FST_WRW ( card, txDescrRing[pi][txp].bcnt, cnv_bcnt ( skb->len ));
-        FST_WRB ( card, txDescrRing[pi][txp].bits, DMA_OWN | TX_STP | TX_ENP );
+	unsigned long flags;
+	int txq_length;
 
-        stats->tx_packets++;
-        stats->tx_bytes += skb->len;
+	port = dev_to_port(dev);
+	card = port->card;
+	dbg(DBG_TX, "fst_start_xmit: length = %d\n", skb->len);
+
+	/* Drop packet with error if we don't have carrier */
+	if (!netif_carrier_ok(dev)) {
+		dev_kfree_skb(skb);
+		stats->tx_errors++;
+		stats->tx_carrier_errors++;
+		dbg(DBG_ASS,
+		    "Tried to transmit but no carrier on card %d port %d\n",
+		    card->card_no, port->index);
+		return 0;
+	}
 
-        dev_kfree_skb ( skb );
+	/* Drop it if it's too big! MTU failure ? */
+	if (skb->len > LEN_TX_BUFFER) {
+		dbg(DBG_ASS, "Packet too large %d vs %d\n", skb->len,
+		    LEN_TX_BUFFER);
+		dev_kfree_skb(skb);
+		stats->tx_errors++;
+		return 0;
+	}
 
-        dev->trans_start = jiffies;
-        return 0;
-}
+	/*
+	 * We are always going to queue the packet
+	 * so that the bottom half is the only place we tx from
+	 * Check there is room in the port txq
+	 */
+	spin_lock_irqsave(&card->card_lock, flags);
+	if ((txq_length = port->txqe - port->txqs) < 0) {
+		/*
+		 * This is the case where the next free has wrapped but the
+		 * last used hasn't
+		 */
+		txq_length = txq_length + FST_TXQ_DEPTH;
+	}
+	spin_unlock_irqrestore(&card->card_lock, flags);
+	if (txq_length > fst_txq_high) {
+		/*
+		 * We have got enough buffers in the pipeline.  Ask the network
+		 * layer to stop sending frames down
+		 */
+		netif_stop_queue(dev);
+		port->start = 1;	/* I'm using this to signal stop sent up */
+	}
+
+	if (txq_length == FST_TXQ_DEPTH - 1) {
+		/*
+		 * This shouldn't have happened but such is life
+		 */
+		dev_kfree_skb(skb);
+		stats->tx_errors++;
+		dbg(DBG_ASS, "Tx queue overflow card %d port %d\n",
+		    card->card_no, port->index);
+		return 0;
+	}
+
+	/*
+	 * queue the buffer
+	 */
+	spin_lock_irqsave(&card->card_lock, flags);
+	port->txq[port->txqe] = skb;
+	port->txqe++;
+	if (port->txqe == FST_TXQ_DEPTH)
+		port->txqe = 0;
+	spin_unlock_irqrestore(&card->card_lock, flags);
+
+	/* Scehdule the bottom half which now does transmit processing */
+	fst_q_work_item(&fst_work_txq, card->card_no);
+	tasklet_schedule(&fst_tx_task);
 
+	return 0;
+}
 
 /*
  *      Card setup having checked hardware resources.
@@ -1440,22 +2399,26 @@
  *      disabled.
  */
 static char *type_strings[] __devinitdata = {
-        "no hardware",                  /* Should never be seen */
-        "FarSync T2P",
-        "FarSync T4P"
+	"no hardware",		/* Should never be seen */
+	"FarSync T2P",
+	"FarSync T4P",
+	"FarSync T1U",
+	"FarSync T2U",
+	"FarSync T4U",
+	"FarSync TE1"
 };
 
 static void __devinit
-fst_init_card ( struct fst_card_info *card )
+fst_init_card(struct fst_card_info *card)
 {
-        int i;
-        int err;
+	int i;
+	int err;
 
-        /* We're working on a number of ports based on the card ID. If the
-         * firmware detects something different later (should never happen)
-         * we'll have to revise it in some way then.
-         */
-        for ( i = 0 ; i < card->nports ; i++ ) {
+	/* We're working on a number of ports based on the card ID. If the
+	 * firmware detects something different later (should never happen)
+	 * we'll have to revise it in some way then.
+	 */
+	for (i = 0; i < card->nports; i++) {
                 err = register_hdlc_device(card->ports[i].dev);
                 if (err < 0) {
 			int j;
@@ -1468,62 +2431,120 @@
                         card->nports = i;
                         break;
                 }
-        }
+	}
 
-        printk ( KERN_INFO "%s-%s: %s IRQ%d, %d ports\n",
-                        port_to_dev(&card->ports[0])->name,
-                        port_to_dev(&card->ports[card->nports-1])->name,
-                        type_strings[card->type], card->irq, card->nports );
+	printk_info("%s-%s: %s IRQ%d, %d ports\n",
+	       port_to_dev(&card->ports[0])->name,
+	       port_to_dev(&card->ports[card->nports - 1])->name,
+	       type_strings[card->type], card->irq, card->nports);
 }
 
-
 /*
  *      Initialise card when detected.
  *      Returns 0 to indicate success, or errno otherwise.
  */
 static int __devinit
-fst_add_one ( struct pci_dev *pdev, const struct pci_device_id *ent )
+fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-        static int firsttime_done = 0;
-        struct fst_card_info *card;
-        int err = 0;
+	static int firsttime_done = 0;
+	static int no_of_cards_added = 0;
+	struct fst_card_info *card;
+	int err = 0;
 	int i;
 
-        if ( ! firsttime_done )
-        {
-                printk ( KERN_INFO "FarSync X21 driver " FST_USER_VERSION
-                                " (c) 2001 FarSite Communications Ltd.\n");
-                firsttime_done = 1;
-        }
-
-        /* Allocate driver private data */
-        card = kmalloc ( sizeof ( struct fst_card_info ),  GFP_KERNEL);
-        if (card == NULL)
-        {
-                printk_err ("FarSync card found but insufficient memory for"
-                                " driver storage\n");
-                return -ENOMEM;
-        }
-        memset ( card, 0, sizeof ( struct fst_card_info ));
-
-        /* Try to enable the device */
-        if (( err = pci_enable_device ( pdev )) != 0 )
-        {
-                printk_err ("Failed to enable card. Err %d\n", -err );
-                goto error_free_card;
-        }
-
-        /* Record info we need*/
-        card->irq         = pdev->irq;
-        card->pci_conf    = pci_resource_start ( pdev, 1 );
-        card->phys_mem    = pci_resource_start ( pdev, 2 );
-        card->phys_ctlmem = pci_resource_start ( pdev, 3 );
+	if (!firsttime_done) {
+		printk_info("FarSync WAN driver " FST_USER_VERSION
+		       " (c) 2001-2004 FarSite Communications Ltd.\n");
+		firsttime_done = 1;
+		dbg(DBG_ASS, "The value of debug mask is %x\n", fst_debug_mask);
+	}
+
+	/*
+	 * We are going to be clever and allow certain cards not to be
+	 * configured.  An exclude list can be provided in /etc/modules.conf
+	 */
+	if (fst_excluded_cards != 0) {
+		/*
+		 * There are cards to exclude
+		 *
+		 */
+		for (i = 0; i < fst_excluded_cards; i++) {
+			if ((pdev->devfn) >> 3 == fst_excluded_list[i]) {
+				printk_info("FarSync PCI device %d not assigned\n",
+				       (pdev->devfn) >> 3);
+				return -EBUSY;
+			}
+		}
+	}
+
+	/* Allocate driver private data */
+	card = kmalloc(sizeof (struct fst_card_info), GFP_KERNEL);
+	if (card == NULL) {
+		printk_err("FarSync card found but insufficient memory for"
+			   " driver storage\n");
+		return -ENOMEM;
+	}
+	memset(card, 0, sizeof (struct fst_card_info));
+
+	/* Try to enable the device */
+	if ((err = pci_enable_device(pdev)) != 0) {
+		printk_err("Failed to enable card. Err %d\n", -err);
+		kfree(card);
+		return err;
+	}
+
+	if ((err = pci_request_regions(pdev, "FarSync")) !=0) {
+	        printk_err("Failed to allocate regions. Err %d\n", -err);
+		pci_disable_device(pdev);
+		kfree(card);
+	        return err;
+	}
+
+	/* Get virtual addresses of memory regions */
+	card->pci_conf = pci_resource_start(pdev, 1);
+	card->phys_mem = pci_resource_start(pdev, 2);
+	card->phys_ctlmem = pci_resource_start(pdev, 3);
+	if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) {
+		printk_err("Physical memory remap failed\n");
+		pci_release_regions(pdev);
+		pci_disable_device(pdev);
+		kfree(card);
+		return -ENODEV;
+	}
+	if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) {
+		printk_err("Control memory remap failed\n");
+		pci_release_regions(pdev);
+		pci_disable_device(pdev);
+		kfree(card);
+		return -ENODEV;
+	}
+	dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem);
 
-        card->type        = ent->driver_data;
-        card->nports      = ( ent->driver_data == FST_TYPE_T2P ) ? 2 : 4;
+	/* Register the interrupt handler */
+	if (request_irq(pdev->irq, fst_intr, SA_SHIRQ, FST_DEV_NAME, card)) {
+		printk_err("Unable to register interrupt %d\n", card->irq);
+		pci_release_regions(pdev);
+		pci_disable_device(pdev);
+		iounmap(card->ctlmem);
+		iounmap(card->mem);
+		kfree(card);
+		return -ENODEV;
+	}
 
-        card->state       = FST_UNINIT;
+	/* Record info we need */
+	card->irq = pdev->irq;
+	card->type = ent->driver_data;
+	card->family = ((ent->driver_data == FST_TYPE_T2P) ||
+			(ent->driver_data == FST_TYPE_T4P))
+	    ? FST_FAMILY_TXP : FST_FAMILY_TXU;
+	if ((ent->driver_data == FST_TYPE_T1U) ||
+	    (ent->driver_data == FST_TYPE_TE1))
+		card->nports = 1;
+	else
+		card->nports = ((ent->driver_data == FST_TYPE_T2P) ||
+				(ent->driver_data == FST_TYPE_T2U)) ? 2 : 4;
 
+	card->state = FST_UNINIT;
         spin_lock_init ( &card->card_lock );
 
         for ( i = 0 ; i < card->nports ; i++ ) {
@@ -1533,7 +2554,13 @@
 			while (i--)
 				free_netdev(card->ports[i].dev);
 			printk_err ("FarSync: out of memory\n");
-			goto error_free_card;
+                        free_irq(card->irq, card);
+                        pci_release_regions(pdev);
+                        pci_disable_device(pdev);
+                        iounmap(card->ctlmem);
+                        iounmap(card->mem);
+                        kfree(card);
+                        return -ENODEV;
 		}
 		card->ports[i].dev    = dev;
                 card->ports[i].card   = card;
@@ -1564,128 +2591,95 @@
                 hdlc->xmit   = fst_start_xmit;
 	}
 
-        dbg ( DBG_PCI,"type %d nports %d irq %d\n", card->type,
-                        card->nports, card->irq );
-        dbg ( DBG_PCI,"conf %04x mem %08x ctlmem %08x\n",
-                        card->pci_conf, card->phys_mem, card->phys_ctlmem );
-
-        /* Check we can get access to the memory and I/O regions */
-        if ( ! request_region ( card->pci_conf, 0x80,"PLX config regs"))
-        {
-                printk_err ("Unable to get config I/O @ 0x%04X\n",
-                                                card->pci_conf );
-                err = -ENODEV;
-                goto error_free_ports;
-        }
-        if ( ! request_mem_region ( card->phys_mem, FST_MEMSIZE,"Shared RAM"))
-        {
-                printk_err ("Unable to get main memory @ 0x%08X\n",
-                                                card->phys_mem );
-                err = -ENODEV;
-                goto error_release_io;
-        }
-        if ( ! request_mem_region ( card->phys_ctlmem, 0x10,"Control memory"))
-        {
-                printk_err ("Unable to get control memory @ 0x%08X\n",
-                                                card->phys_ctlmem );
-                err = -ENODEV;
-                goto error_release_mem;
-        }
-
-
-        /* Get virtual addresses of memory regions */
-        if (( card->mem = ioremap ( card->phys_mem, FST_MEMSIZE )) == NULL )
-        {
-                printk_err ("Physical memory remap failed\n");
-                err = -ENODEV;
-                goto error_release_ctlmem;
-        }
-        if (( card->ctlmem = ioremap ( card->phys_ctlmem, 0x10 )) == NULL )
-        {
-                printk_err ("Control memory remap failed\n");
-                err = -ENODEV;
-                goto error_unmap_mem;
-        }
-        dbg ( DBG_PCI,"kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem);
-
-        /* Reset the card's processor */
-        fst_cpureset ( card );
-        card->state = FST_RESET;
-
-        /* Register the interrupt handler */
-        if ( request_irq ( card->irq, fst_intr, SA_SHIRQ, FST_DEV_NAME, card ))
-        {
-
-                printk_err ("Unable to register interrupt %d\n", card->irq );
-                err = -ENODEV;
-                goto error_unmap_ctlmem;
-        }
-
-        /* Record driver data for later use */
-        pci_set_drvdata(pdev, card);
-
-        /* Remainder of card setup */
-        fst_init_card ( card );
-
-        return 0;                       /* Success */
-
-
-                                        /* Failure. Release resources */
-error_unmap_ctlmem:
-        iounmap ( card->ctlmem );
-
-error_unmap_mem:
-        iounmap ( card->mem );
-
-error_release_ctlmem:
-        release_mem_region ( card->phys_ctlmem, 0x10 );
-
-error_release_mem:
-        release_mem_region ( card->phys_mem, FST_MEMSIZE );
-
-error_release_io:
-        release_region ( card->pci_conf, 0x80 );
-
-error_free_ports:
-	for (i = 0; i < card->nports; i++)
-		free_netdev(card->ports[i].dev);
-error_free_card:
-        kfree ( card );
-        return err;
-}
+	card->device = pdev;
 
+	dbg(DBG_PCI, "type %d nports %d irq %d\n", card->type,
+	    card->nports, card->irq);
+	dbg(DBG_PCI, "conf %04x mem %08x ctlmem %08x\n",
+	    card->pci_conf, card->phys_mem, card->phys_ctlmem);
+
+	/* Reset the card's processor */
+	fst_cpureset(card);
+	card->state = FST_RESET;
+
+	/* Initialise DMA (if required) */
+	fst_init_dma(card);
+
+	/* Record driver data for later use */
+	pci_set_drvdata(pdev, card);
+
+	/* Remainder of card setup */
+	fst_card_array[no_of_cards_added] = card;
+	card->card_no = no_of_cards_added++;	/* Record instance and bump it */
+	fst_init_card(card);
+	if (card->family == FST_FAMILY_TXU) {
+		/*
+		 * Allocate a dma buffer for transmit and receives
+		 */
+		card->rx_dma_handle_host =
+		    pci_alloc_consistent(card->device, FST_MAX_MTU,
+					 &card->rx_dma_handle_card);
+		if (card->rx_dma_handle_host == NULL) {
+			printk_err("Could not allocate rx dma buffer\n");
+			fst_disable_intr(card);
+			pci_release_regions(pdev);
+			pci_disable_device(pdev);
+			iounmap(card->ctlmem);
+			iounmap(card->mem);
+			kfree(card);
+			return -ENOMEM;
+		}
+		card->tx_dma_handle_host =
+		    pci_alloc_consistent(card->device, FST_MAX_MTU,
+					 &card->tx_dma_handle_card);
+		if (card->tx_dma_handle_host == NULL) {
+			printk_err("Could not allocate tx dma buffer\n");
+			fst_disable_intr(card);
+			pci_release_regions(pdev);
+			pci_disable_device(pdev);
+			iounmap(card->ctlmem);
+			iounmap(card->mem);
+			kfree(card);
+			return -ENOMEM;
+		}
+	}
+	return 0;		/* Success */
+}
 
 /*
  *      Cleanup and close down a card
  */
 static void __devexit
-fst_remove_one ( struct pci_dev *pdev )
+fst_remove_one(struct pci_dev *pdev)
 {
-        struct fst_card_info *card;
-        int i;
+	struct fst_card_info *card;
+	int i;
 
-        card = pci_get_drvdata(pdev);
+	card = pci_get_drvdata(pdev);
 
-        for ( i = 0 ; i < card->nports ; i++ )
-        {
+	for (i = 0; i < card->nports; i++) {
 		struct net_device *dev = port_to_dev(&card->ports[i]);
-                unregister_hdlc_device(dev);
-        }
-
-        fst_disable_intr ( card );
-        free_irq ( card->irq, card );
-
-        iounmap ( card->ctlmem );
-        iounmap ( card->mem );
-
-        release_mem_region ( card->phys_ctlmem, 0x10 );
-        release_mem_region ( card->phys_mem, FST_MEMSIZE );
-        release_region ( card->pci_conf, 0x80 );
+		unregister_hdlc_device(dev);
+	}
 
-	for (i = 0; i < card->nports; i++)
-		free_netdev(card->ports[i].dev);
+	fst_disable_intr(card);
+	free_irq(card->irq, card);
 
-        kfree ( card );
+	iounmap(card->ctlmem);
+	iounmap(card->mem);
+	pci_release_regions(pdev);
+	if (card->family == FST_FAMILY_TXU) {
+		/*
+		 * Free dma buffers
+		 */
+		pci_free_consistent(card->device, FST_MAX_MTU,
+				    card->rx_dma_handle_host,
+				    card->rx_dma_handle_card);
+		pci_free_consistent(card->device, FST_MAX_MTU,
+				    card->tx_dma_handle_host,
+				    card->tx_dma_handle_card);
+	}
+	fst_card_array[card->card_no] = NULL;
 }
 
 static struct pci_driver fst_driver = {
@@ -1700,15 +2694,20 @@
 static int __init
 fst_init(void)
 {
-        return pci_module_init ( &fst_driver );
+	int i;
+
+	for (i = 0; i < FST_MAX_CARDS; i++)
+		fst_card_array[i] = NULL;
+	spin_lock_init(&fst_work_q_lock);
+	return pci_module_init(&fst_driver);
 }
 
 static void __exit
 fst_cleanup_module(void)
 {
-        pci_unregister_driver ( &fst_driver );
+	printk_info("FarSync WAN driver unloading\n");
+	pci_unregister_driver(&fst_driver);
 }
 
-module_init ( fst_init );
-module_exit ( fst_cleanup_module );
-
+module_init(fst_init);
+module_exit(fst_cleanup_module);
diff -Nru a/drivers/net/wan/farsync.h b/drivers/net/wan/farsync.h
--- a/drivers/net/wan/farsync.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/wan/farsync.h	Tue Jun 15 22:20:41 2004
@@ -32,8 +32,13 @@
  *      A short common prefix is useful for routines within the driver to avoid
  *      conflict with other similar drivers and I chosen to use "fst_" for this
  *      purpose (FarSite T-series).
+ *
+ *      Finally the device driver needs a short network interface name. Since
+ *      "hdlc" is already in use I've chosen the even less informative "sync"
+ *      for the present.
  */
 #define FST_NAME                "fst"           /* In debug/info etc */
+#define FST_NDEV_NAME           "sync"          /* For net interface */
 #define FST_DEV_NAME            "farsync"       /* For misc interfaces */
 
 
@@ -45,7 +50,7 @@
  *      have individual versions (or IDs) that move much faster than the
  *      the release version as individual updates are tracked.
  */
-#define FST_USER_VERSION        "0.09"
+#define FST_USER_VERSION        "1.04"
 
 
 /*      Ioctl call command values
@@ -100,6 +105,7 @@
         unsigned int   state;           /* State of card */
         unsigned int   index;           /* Index of port ioctl was issued on */
         unsigned int   smcFirmwareVersion;
+        unsigned long  kernelVersion;   /* What Kernel version we are working with */
         unsigned short lineInterface;   /* Physical interface type */
         unsigned char  proto;           /* Line protocol */
         unsigned char  internalClock;   /* 1 => internal clock, 0 => external */
@@ -110,6 +116,31 @@
         unsigned short cableStatus;     /* lsb: 0=> present, 1=> absent */
         unsigned short cardMode;        /* lsb: LED id mode */
         unsigned short debug;           /* Debug flags */
+        unsigned char  transparentMode; /* Not used always 0 */
+        unsigned char  invertClock;     /* Invert clock feature for syncing */
+        unsigned char  startingSlot;    /* Time slot to use for start of tx */
+        unsigned char  clockSource;     /* External or internal */
+        unsigned char  framing;         /* E1, T1 or J1 */
+        unsigned char  structure;       /* unframed, double, crc4, f4, f12, */
+                                        /* f24 f72 */
+        unsigned char  interface;       /* rj48c or bnc */
+        unsigned char  coding;          /* hdb3 b8zs */
+        unsigned char  lineBuildOut;    /* 0, -7.5, -15, -22 */
+        unsigned char  equalizer;       /* short or lon haul settings */
+        unsigned char  loopMode;        /* various loopbacks */
+        unsigned char  range;           /* cable lengths */
+        unsigned char  txBufferMode;    /* tx elastic buffer depth */
+        unsigned char  rxBufferMode;    /* rx elastic buffer depth */
+        unsigned char  losThreshold;    /* Attenuation on LOS signal */
+        unsigned char  idleCode;        /* Value to send as idle timeslot */
+        unsigned int   receiveBufferDelay; /* delay thro rx buffer timeslots */
+        unsigned int   framingErrorCount; /* framing errors */
+        unsigned int   codeViolationCount; /* code violations */
+        unsigned int   crcErrorCount;   /* CRC errors */
+        int            lineAttenuation; /* in dB*/
+        unsigned short lossOfSignal;
+        unsigned short receiveRemoteAlarm;
+        unsigned short alarmIndicationSignal;
 };
 
 /* "valid" bitmask */
@@ -131,13 +162,23 @@
                                          */
 #define FSTVAL_PROTO    0x00000200      /* proto */
 #define FSTVAL_MODE     0x00000400      /* cardMode */
+#define FSTVAL_PHASE    0x00000800      /* Clock phase */
+#define FSTVAL_TE1      0x00001000      /* T1E1 Configuration */
 #define FSTVAL_DEBUG    0x80000000      /* debug */
-#define FSTVAL_ALL      0x000007FF      /* Note: does not include DEBUG flag */
+#define FSTVAL_ALL      0x00001FFF      /* Note: does not include DEBUG flag */
 
 /* "type" */
 #define FST_TYPE_NONE   0               /* Probably should never happen */
 #define FST_TYPE_T2P    1               /* T2P X21 2 port card */
 #define FST_TYPE_T4P    2               /* T4P X21 4 port card */
+#define FST_TYPE_T1U    3               /* T1U X21 1 port card */
+#define FST_TYPE_T2U    4               /* T2U X21 2 port card */
+#define FST_TYPE_T4U    5               /* T4U X21 4 port card */
+#define FST_TYPE_TE1    6               /* T1E1 X21 1 port card */
+
+/* "family" */
+#define FST_FAMILY_TXP  0               /* T2P or T4P */
+#define FST_FAMILY_TXU  1               /* T1U or T2U or T4U */
 
 /* "state" */
 #define FST_UNINIT      0               /* Raw uninitialised state following
@@ -155,6 +196,10 @@
 #define V24             1
 #define X21             2
 #define V35             3
+#define X21D            4
+#define T1              5
+#define E1              6
+#define J1              7
 
 /* "proto" */
 #define FST_HDLC        1               /* Cisco compatible HDLC */
@@ -187,6 +232,97 @@
 /* "cardMode" bitmask */
 #define CARD_MODE_IDENTIFY      0x0001
 
+/* 
+ * Constants for T1/E1 configuration
+ */
+
+/*
+ * Clock source
+ */
+#define CLOCKING_SLAVE       0
+#define CLOCKING_MASTER      1
+
+/*
+ * Framing
+ */
+#define FRAMING_E1           0
+#define FRAMING_J1           1
+#define FRAMING_T1           2
+
+/*
+ * Structure
+ */
+#define STRUCTURE_UNFRAMED   0
+#define STRUCTURE_E1_DOUBLE  1
+#define STRUCTURE_E1_CRC4    2
+#define STRUCTURE_E1_CRC4M   3
+#define STRUCTURE_T1_4       4
+#define STRUCTURE_T1_12      5
+#define STRUCTURE_T1_24      6
+#define STRUCTURE_T1_72      7
+
+/*
+ * Interface
+ */
+#define INTERFACE_RJ48C      0
+#define INTERFACE_BNC        1
+
+/*
+ * Coding
+ */
+
+#define CODING_HDB3          0
+#define CODING_NRZ           1
+#define CODING_CMI           2
+#define CODING_CMI_HDB3      3
+#define CODING_CMI_B8ZS      4
+#define CODING_AMI           5
+#define CODING_AMI_ZCS       6
+#define CODING_B8ZS          7
+
+/*
+ * Line Build Out
+ */
+#define LBO_0dB              0
+#define LBO_7dB5             1
+#define LBO_15dB             2
+#define LBO_22dB5            3
+
+/*
+ * Range for long haul t1 > 655ft
+ */
+#define RANGE_0_133_FT       0
+#define RANGE_0_40_M         RANGE_0_133_FT
+#define RANGE_133_266_FT     1
+#define RANGE_40_81_M        RANGE_133_266_FT
+#define RANGE_266_399_FT     2
+#define RANGE_81_122_M       RANGE_266_399_FT
+#define RANGE_399_533_FT     3
+#define RANGE_122_162_M       RANGE_399_533_FT
+#define RANGE_533_655_FT     4
+#define RANGE_162_200_M      RANGE_533_655_FT
+/*
+ * Receive Equaliser
+ */
+#define EQUALIZER_SHORT      0
+#define EQUALIZER_LONG       1
+
+/*
+ * Loop modes
+ */
+#define LOOP_NONE            0
+#define LOOP_LOCAL           1
+#define LOOP_PAYLOAD_EXC_TS0 2
+#define LOOP_PAYLOAD_INC_TS0 3
+#define LOOP_REMOTE          4
+
+/*
+ * Buffer modes
+ */
+#define BUFFER_2_FRAME       0
+#define BUFFER_1_FRAME       1
+#define BUFFER_96_BIT        2
+#define BUFFER_NONE          3
 
 /*      Debug support
  *
diff -Nru a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c
--- a/drivers/net/wan/hd6457x.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/wan/hd6457x.c	Tue Jun 15 22:20:37 2004
@@ -610,7 +610,6 @@
 	card_t* card = port_to_card(port);
 
 	/* reset channel */
-	netif_stop_queue(dev);
 	sca_out(CMD_RESET, get_msci(port) + CMD, port_to_card(port));
 #ifdef __HD64570_H
 	/* disable MSCI interrupts */
@@ -624,6 +623,7 @@
 	sca_outl(sca_inl(IER0, card) &
 		 (phy_node(port) ? 0x00FF00FF : 0xFF00FF00), IER0, card);
 #endif
+	netif_stop_queue(dev);
 }
 
 
diff -Nru a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
--- a/drivers/net/wan/hdlc_cisco.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/wan/hdlc_cisco.c	Tue Jun 15 22:20:38 2004
@@ -180,7 +180,8 @@
 
 		case CISCO_KEEPALIVE_REQ:
 			hdlc->state.cisco.rxseq = ntohl(cisco_data->par1);
-			if (ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) {
+			if (hdlc->state.cisco.request_sent &&
+			    ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) {
 				hdlc->state.cisco.last_poll = jiffies;
 				if (!hdlc->state.cisco.up) {
 					u32 sec, min, hrs, days;
@@ -192,8 +193,9 @@
 					       "uptime %ud%uh%um%us)\n",
 					       dev->name, days, hrs,
 					       min, sec);
+					netif_carrier_on(dev);
+					hdlc->state.cisco.up = 1;
 				}
-				hdlc->state.cisco.up = 1;
 			}
 
 			dev_kfree_skb_any(skb);
@@ -219,17 +221,18 @@
 	struct net_device *dev = (struct net_device *)arg;
 	hdlc_device *hdlc = dev_to_hdlc(dev);
 
-	if (hdlc->state.cisco.up && jiffies - hdlc->state.cisco.last_poll >=
-	    hdlc->state.cisco.settings.timeout * HZ) {
+	if (hdlc->state.cisco.up &&
+	    time_after(jiffies, hdlc->state.cisco.last_poll +
+		       hdlc->state.cisco.settings.timeout * HZ)) {
 		hdlc->state.cisco.up = 0;
 		printk(KERN_INFO "%s: Link down\n", dev->name);
-		if (netif_carrier_ok(dev))
-			netif_carrier_off(dev);
+		netif_carrier_off(dev);
 	}
 
 	cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ,
 			     ++hdlc->state.cisco.txseq,
 			     hdlc->state.cisco.rxseq);
+	hdlc->state.cisco.request_sent = 1;
 	hdlc->state.cisco.timer.expires = jiffies +
 		hdlc->state.cisco.settings.interval * HZ;
 	hdlc->state.cisco.timer.function = cisco_timer;
@@ -242,8 +245,8 @@
 static void cisco_start(struct net_device *dev)
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
-	hdlc->state.cisco.last_poll = 0;
 	hdlc->state.cisco.up = 0;
+	hdlc->state.cisco.request_sent = 0;
 	hdlc->state.cisco.txseq = hdlc->state.cisco.rxseq = 0;
 
 	init_timer(&hdlc->state.cisco.timer);
@@ -257,9 +260,12 @@
 
 static void cisco_stop(struct net_device *dev)
 {
-	del_timer_sync(&dev_to_hdlc(dev)->state.cisco.timer);
+	hdlc_device *hdlc = dev_to_hdlc(dev);
+	del_timer_sync(&hdlc->state.cisco.timer);
 	if (netif_carrier_ok(dev))
 		netif_carrier_off(dev);
+	hdlc->state.cisco.up = 0;
+	hdlc->state.cisco.request_sent = 0;
 }
 
 
diff -Nru a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
--- a/drivers/net/wan/hdlc_fr.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/net/wan/hdlc_fr.c	Tue Jun 15 22:20:44 2004
@@ -584,8 +584,9 @@
 	u32 list;
 
 	if (hdlc->state.fr.settings.dce)
-		reliable = (jiffies - hdlc->state.fr.last_poll <
-			    hdlc->state.fr.settings.t392 * HZ);
+		reliable = hdlc->state.fr.request &&
+			time_before(jiffies, hdlc->state.fr.last_poll +
+				    hdlc->state.fr.settings.t392 * HZ);
 	else {
 		hdlc->state.fr.last_errors <<= 1; /* Shift the list */
 		if (hdlc->state.fr.request) {
@@ -617,6 +618,7 @@
 
 		fr_lmi_send(dev, hdlc->state.fr.n391cnt == 0);
 
+		hdlc->state.fr.last_poll = jiffies;
 		hdlc->state.fr.request = 1;
 		hdlc->state.fr.timer.expires = jiffies +
 			hdlc->state.fr.settings.t391 * HZ;
@@ -689,6 +691,7 @@
 			       dev->name, reptype);
 			return 1;
 		}
+		hdlc->state.fr.last_poll = jiffies;
 	}
 
 	error = 0;
@@ -728,7 +731,12 @@
 
 	/* DTE */
 
-	if (reptype != LMI_FULLREP || error)
+	hdlc->state.fr.request = 0; /* got response, no request pending */
+
+	if (error)
+		return 0;
+
+	if (reptype != LMI_FULLREP)
 		return 0;
 
 	stat_len = 3;
@@ -829,9 +837,6 @@
 			if (fr_lmi_recv(ndev, skb))
 				goto rx_error;
 			else {
-				/* No request pending */
-				hdlc->state.fr.request = 0;
-				hdlc->state.fr.last_poll = jiffies;
 				dev_kfree_skb_any(skb);
 				return NET_RX_SUCCESS;
 			}
@@ -946,9 +951,6 @@
 	printk(KERN_DEBUG "fr_start\n");
 #endif
 	if (hdlc->state.fr.settings.lmi != LMI_NONE) {
-		if (netif_carrier_ok(dev))
-			netif_carrier_off(dev);
-		hdlc->state.fr.last_poll = 0;
 		hdlc->state.fr.reliable = 0;
 		hdlc->state.fr.dce_changed = 1;
 		hdlc->state.fr.request = 0;
diff -Nru a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c
--- a/drivers/net/wan/hdlc_generic.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/wan/hdlc_generic.c	Tue Jun 15 22:20:37 2004
@@ -15,6 +15,11 @@
  *	* X.25
  *
  * Use sethdlc utility to set line parameters, protocol and PVCs
+ *
+ * How does it work:
+ * - proto.open(), close(), start(), stop() calls are serialized.
+ *   The order is: open, [ start, stop ... ] close ...
+ * - proto.start() and stop() are called with spin_lock_irq held.
  */
 
 #include <linux/config.h>
@@ -33,7 +38,7 @@
 #include <linux/hdlc.h>
 
 
-static const char* version = "HDLC support module revision 1.16";
+static const char* version = "HDLC support module revision 1.17";
 
 #undef DEBUG_LINK
 
@@ -69,51 +74,75 @@
 
 
 
+static void __hdlc_set_carrier_on(struct net_device *dev)
+{
+	hdlc_device *hdlc = dev_to_hdlc(dev);
+	if (hdlc->proto.start)
+		return hdlc->proto.start(dev);
+#ifdef DEBUG_LINK
+	if (netif_carrier_ok(dev))
+		printk(KERN_ERR "hdlc_set_carrier_on(): already on\n");
+#endif
+	netif_carrier_on(dev);
+}
+
+
+
+static void __hdlc_set_carrier_off(struct net_device *dev)
+{
+	hdlc_device *hdlc = dev_to_hdlc(dev);
+	if (hdlc->proto.stop)
+		return hdlc->proto.stop(dev);
+
+#ifdef DEBUG_LINK
+	if (!netif_carrier_ok(dev))
+		printk(KERN_ERR "hdlc_set_carrier_off(): already off\n");
+#endif
+	netif_carrier_off(dev);
+}
+
+
+
 void hdlc_set_carrier(int on, struct net_device *dev)
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
+	unsigned long flags;
 	on = on ? 1 : 0;
 
 #ifdef DEBUG_LINK
 	printk(KERN_DEBUG "hdlc_set_carrier %i\n", on);
 #endif
 
-	spin_lock_irq(&hdlc->state_lock);
+	spin_lock_irqsave(&hdlc->state_lock, flags);
 
 	if (hdlc->carrier == on)
 		goto carrier_exit; /* no change in DCD line level */
 
-	printk(KERN_INFO "%s: carrier %s\n", dev->name,
-	       on ? "ON" : "off");
+#ifdef DEBUG_LINK
+	printk(KERN_INFO "%s: carrier %s\n", dev->name, on ? "ON" : "off");
+#endif
 	hdlc->carrier = on;
 
 	if (!hdlc->open)
 		goto carrier_exit;
 
-	if (hdlc->carrier) {
-		if (hdlc->proto.start)
-			hdlc->proto.start(dev);
-		else if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
-
-	} else { /* no carrier */
-		if (hdlc->proto.stop)
-			hdlc->proto.stop(dev);
-		else if (netif_carrier_ok(dev))
-			netif_carrier_off(dev);
-	}
+	if (hdlc->carrier)
+		__hdlc_set_carrier_on(dev);
+	else
+		__hdlc_set_carrier_off(dev);
 
- carrier_exit:
-	spin_unlock_irq(&hdlc->state_lock);
+carrier_exit:
+	spin_unlock_irqrestore(&hdlc->state_lock, flags);
 }
 
 
+
 /* Must be called by hardware driver when HDLC device is being opened */
 int hdlc_open(struct net_device *dev)
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
 #ifdef DEBUG_LINK
-	printk(KERN_DEBUG "hdlc_open carrier %i open %i\n",
+	printk(KERN_DEBUG "hdlc_open() carrier %i open %i\n",
 	       hdlc->carrier, hdlc->open);
 #endif
 
@@ -128,14 +157,8 @@
 
 	spin_lock_irq(&hdlc->state_lock);
 
-	if (hdlc->carrier) {
-		if (hdlc->proto.start)
-			hdlc->proto.start(dev);
-		else if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
-
-	} else if (netif_carrier_ok(dev))
-		netif_carrier_off(dev);
+	if (hdlc->carrier)
+		__hdlc_set_carrier_on(dev);
 
 	hdlc->open = 1;
 
@@ -150,15 +173,15 @@
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
 #ifdef DEBUG_LINK
-	printk(KERN_DEBUG "hdlc_close carrier %i open %i\n",
+	printk(KERN_DEBUG "hdlc_close() carrier %i open %i\n",
 	       hdlc->carrier, hdlc->open);
 #endif
 
 	spin_lock_irq(&hdlc->state_lock);
 
 	hdlc->open = 0;
-	if (hdlc->carrier && hdlc->proto.stop)
-		hdlc->proto.stop(dev);
+	if (hdlc->carrier)
+		__hdlc_set_carrier_off(dev);
 
 	spin_unlock_irq(&hdlc->state_lock);
 
@@ -185,7 +208,7 @@
 #endif
 
 #ifndef CONFIG_HDLC_FR
-#define hdlc_fr_ioctl(dev, ifr)	-ENOSYS
+#define hdlc_fr_ioctl(dev, ifr)		-ENOSYS
 #endif
 
 #ifndef CONFIG_HDLC_X25
@@ -257,31 +280,16 @@
 
 int register_hdlc_device(struct net_device *dev)
 {
-	int result;
-	hdlc_device *hdlc = dev_to_hdlc(dev);
-
-	dev->get_stats = hdlc_get_stats;
-	dev->change_mtu = hdlc_change_mtu;
-	dev->mtu = HDLC_MAX_MTU;
-
-	dev->type = ARPHRD_RAWHDLC;
-	dev->hard_header_len = 16;
-
-	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
-
-	hdlc->proto.id = -1;
-	hdlc->proto.detach = NULL;
-	hdlc->carrier = 1;
-	hdlc->open = 0;
-	spin_lock_init(&hdlc->state_lock);
-
-	result = dev_alloc_name(dev, "hdlc%d");
+	int result = dev_alloc_name(dev, "hdlc%d");
 	if (result < 0)
 		return result;
 
 	result = register_netdev(dev);
 	if (result != 0)
 		return -EIO;
+
+	if (netif_carrier_ok(dev))
+		netif_carrier_off(dev); /* no carrier until DCD goes up */
 
 	return 0;
 }
diff -Nru a/drivers/net/wan/hscx.h b/drivers/net/wan/hscx.h
--- a/drivers/net/wan/hscx.h	Tue Jun 15 22:21:04 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,103 +0,0 @@
-#define	HSCX_MTU	1600
-
-#define	HSCX_ISTA	0x00
-#define HSCX_MASK	0x00
-#define HSCX_STAR	0x01
-#define HSCX_CMDR	0x01
-#define HSCX_MODE	0x02
-#define HSCX_TIMR	0x03
-#define HSCX_EXIR	0x04
-#define HSCX_XAD1	0x04
-#define HSCX_RBCL	0x05
-#define HSCX_SAD2	0x05
-#define HSCX_RAH1	0x06
-#define HSCX_RSTA	0x07
-#define HSCX_RAH2	0x07
-#define HSCX_RAL1	0x08
-#define HSCX_RCHR	0x09
-#define HSCX_RAL2	0x09
-#define HSCX_XBCL	0x0a
-#define HSCX_BGR	0x0b
-#define HSCX_CCR2	0x0c
-#define HSCX_RBCH	0x0d
-#define HSCX_XBCH	0x0d
-#define HSCX_VSTR	0x0e
-#define HSCX_RLCR	0x0e
-#define HSCX_CCR1	0x0f
-#define HSCX_FIFO	0x1e
-
-#define HSCX_HSCX_CHOFFS	0x400
-#define HSCX_SEROFFS	0x1000
-
-#define HSCX_RME	0x80
-#define HSCX_RPF	0x40
-#define HSCX_RSC	0x20
-#define HSCX_XPR	0x10
-#define HSCX_TIN	0x08
-#define HSCX_ICA	0x04
-#define HSCX_EXA	0x02
-#define HSCX_EXB	0x01
-
-#define HSCX_XMR	0x80
-#define HSCX_XDU	0x40
-#define HSCX_EXE	0x40
-#define HSCX_PCE	0x20
-#define HSCX_RFO	0x10
-#define HSCX_CSC	0x08
-#define HSCX_RFS	0x04
-
-#define HSCX_XDOV	0x80
-#define HSCX_XFW	0x40
-#define HSCX_XRNR	0x20
-#define HSCX_RRNR	0x10
-#define HSCX_RLI	0x08
-#define HSCX_CEC	0x04
-#define HSCX_CTS	0x02
-#define HSCX_WFA	0x01
-
-#define HSCX_RMC	0x80
-#define HSCX_RHR	0x40
-#define HSCX_RNR	0x20
-#define HSCX_XREP	0x20
-#define HSCX_STI	0x10
-#define HSCX_XTF	0x08
-#define HSCX_XIF	0x04
-#define HSCX_XME	0x02
-#define HSCX_XRES	0x01
-
-#define HSCX_AUTO	0x00
-#define HSCX_NONAUTO	0x40
-#define HSCX_TRANS	0x80
-#define HSCX_XTRANS	0xc0
-#define HSCX_ADM16	0x20
-#define HSCX_ADM8	0x00
-#define HSCX_TMD_EXT	0x00
-#define HSCX_TMD_INT	0x10
-#define HSCX_RAC	0x08
-#define HSCX_RTS	0x04
-#define HSCX_TLP	0x01
-
-#define HSCX_VFR	0x80
-#define HSCX_RDO	0x40
-#define HSCX_CRC	0x20
-#define HSCX_RAB	0x10
-
-#define HSCX_CIE	0x04
-#define HSCX_RIE	0x02
-
-#define HSCX_DMA	0x80
-#define HSCX_NRM	0x40
-#define HSCX_CAS	0x20
-#define HSCX_XC	0x10
-
-#define HSCX_OV	0x10
-
-#define HSCX_CD	0x80
-
-#define HSCX_RC	0x80
-
-#define HSCX_PU	0x80
-#define HSCX_NRZ	0x00
-#define HSCX_NRZI	0x40
-#define HSCX_ODS	0x10
-#define HSCX_ITF	0x08
diff -Nru a/drivers/net/wan/mixcom.h b/drivers/net/wan/mixcom.h
--- a/drivers/net/wan/mixcom.h	Tue Jun 15 22:20:58 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,35 +0,0 @@
-/*
- * Defines for the mixcom board
- *
- * Author: Gergely Madarasz <gorgo@itc.hu>
- *
- * Copyright (C) 1999 ITConsult-Pro Co. <info@itc.hu>
- *
- * 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.
- *
- */
-
-#define	MIXCOM_IO_EXTENT	0x20
-
-#define	MIXCOM_DEFAULT_IO	0x180
-#define	MIXCOM_DEFAULT_IRQ	5
-
-#define MIXCOM_ID		0x11
-#define MIXCOM_SERIAL_OFFSET	0x1000
-#define MIXCOM_CHANNEL_OFFSET	0x400
-#define MIXCOM_IT_OFFSET	0xc14
-#define MIXCOM_STATUS_OFFSET	0xc14
-#define MIXCOM_ID_OFFSET	0xc10
-#define MIXCOM_ON		0x1
-#define MIXCOM_OFF		0x0
-
-/* Status register bits */
-
-#define MIXCOM_CTSB		0x1
-#define MIXCOM_CTSA		0x2
-#define MIXCOM_CHANNELNO	0x20
-#define MIXCOM_POWERFAIL	0x40
-#define MIXCOM_BOOT		0x80
diff -Nru a/drivers/net/wan/munich32x.h b/drivers/net/wan/munich32x.h
--- a/drivers/net/wan/munich32x.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,191 +0,0 @@
-/*
- *	Defines for comx-hw-slicecom.c - MUNICH32X specific
- *
- *	Author:        Bartok Istvan <bartoki@itc.hu>
- *	Last modified: Tue Jan 11 14:27:36 CET 2000
- *
- *	:set tabstop=6
- */
-
-#define TXBUFFER_SIZE	1536			/* Max mennyit tud a kartya hardver atvenni				*/
-#define RXBUFFER_SIZE	(TXBUFFER_SIZE+4)	/* For Rx reasons it must be a multiple of 4, and =>4 (page 265)	*/
-							/* +4 .. see page 265, bit FE							*/
-							/* TOD: a MODE1-be nem is ezt teszem, hanem a TXBUFFER-t, lehet hogy nem is kell? */
-
-//#define PCI_VENDOR_ID_SIEMENS			0x110a
-#define PCI_DEVICE_ID_SIEMENS_MUNICH32X	0x2101
-
-/*
- *	PCI config space registers (page 120)
- */
-
-#define MUNICH_PCI_PCIRES	0x4c		/* 0xe0000 resets	the chip	*/
-
-
-/*
- *	MUNICH slave register offsets relative to base_address[0] (PCI BAR1) (page 181):
- *	offsets are in bytes, registers are u32's, so we need a >>2 for indexing
- *	the int[] by byte offsets. Use it like:
- *
- *	bar1[ STAT ] = ~0L;  or
- *	x = bar1[ STAT ];
- */
-
-#define CONF	(0x00 >> 2)
-#define CMD		(0x04 >> 2)
-#define STAT	(0x08 >> 2)
-#define STACK	(0x08 >> 2)
-#define IMASK	(0x0c >> 2)
-#define PIQBA	(0x14 >> 2)
-#define PIQL	(0x18 >> 2)
-#define MODE1	(0x20 >> 2)
-#define MODE2	(0x24 >> 2)
-#define CCBA	(0x28 >> 2)
-#define TXPOLL	(0x2c >> 2)
-#define TIQBA	(0x30 >> 2)
-#define TIQL	(0x34 >> 2)
-#define RIQBA	(0x38 >> 2)
-#define RIQL	(0x3c >> 2)
-#define LCONF	(0x40 >> 2)		/* LBI Configuration Register		*/
-#define LCCBA	(0x44 >> 2)		/* LBI Configuration Control Block	*/	/* DE: lehet hogy nem is kell? */
-#define LTIQBA	(0x50 >> 2)		/* DE: lehet hogy nem is kell? page 210: LBI DMA Controller intq - nem hasznalunk DMA-t.. */
-#define LTIQL	(0x54 >> 2)		/* DE: lehet hogy nem is kell? */
-#define LRIQBA	(0x58 >> 2)		/* DE: lehet hogy nem is kell? */
-#define LRIQL	(0x5c >> 2)		/* DE: lehet hogy nem is kell? */
-#define LREG0	(0x60 >> 2)		/* LBI Indirect External Configuration register 0	*/
-#define LREG1	(0x64 >> 2)
-#define LREG2	(0x68 >> 2)
-#define LREG3	(0x6c >> 2)
-#define LREG4	(0x70 >> 2)
-#define LREG5	(0x74 >> 2)
-#define LREG6	(0x78 >> 2)		/* LBI Indirect External Configuration register 6		*/
-#define LSTAT	(0x7c >> 2)		/* LBI Status Register							*/
-#define GPDIR	(0x80 >> 2)		/* General Purpose Bus DIRection - 0..input, 1..output	*/
-#define GPDATA	(0x84 >> 2)		/* General Purpose Bus DATA						*/
-
-
-/*
- *	MUNICH commands: (they go into register CMD)
- */
-
-#define CMD_ARPCM	0x01			/* Action Request Serial PCM Core	*/
-#define CMD_ARLBI	0x02			/* Action Request LBI			*/
-
-
-/*
- *	MUNICH event bits in the STAT, STACK, IMASK registers (page 188,189)
- */
-
-#define STAT_PTI	(1 << 15)
-#define STAT_PRI	(1 << 14)
-#define STAT_LTI	(1 << 13)
-#define STAT_LRI	(1 << 12)
-#define STAT_IOMI	(1 << 11)
-#define STAT_SSCI	(1 << 10)
-#define STAT_LBII	(1 << 9)
-#define STAT_MBI	(1 << 8)
-
-#define STAT_TI	(1 << 6)
-#define STAT_TSPA	(1 << 5)
-#define STAT_RSPA	(1 << 4)
-#define STAT_LBIF	(1 << 3)
-#define STAT_LBIA	(1 << 2)
-#define STAT_PCMF	(1 << 1)
-#define STAT_PCMA	(1) 
-
-/*
- *	We do not handle these (and do not touch their STAT bits) in the interrupt loop
- */
-
-#define STAT_NOT_HANDLED_BY_INTERRUPT	(STAT_PCMF | STAT_PCMA)
-
-
-/*
- *	MUNICH MODE1/MODE2 slave register fields (page 193,196)
- *	these are not all masks, MODE1_XX_YY are my magic values!
- */
-
-#define MODE1_PCM_E1	(1 << 31)		/* E1, 2.048 Mbit/sec		*/
-#define MODE1_TBS_4	(1 << 24)		/* TBS = 4 .. no Tx bit shift	*/
-#define MODE1_RBS_4	(1 << 18)		/* RBS = 4 .. no Rx bit shift	*/
-#define MODE1_REN		(1 << 15)		/* Rx Enable			*/
-#define MODE1_MFL_MY	TXBUFFER_SIZE	/* Maximum Frame Length		*/
-#define MODE1_MAGIC	(MODE1_PCM_E1 | MODE1_TBS_4 | MODE1_RBS_4 | MODE1_REN | MODE1_MFL_MY)
-
-#define MODE2_HPOLL	(1 << 8)		/* Hold Poll			*/
-#define MODE2_SPOLL	(1 << 7)		/* Slow Poll			*/
-#define MODE2_TSF		(1)			/* real magic - discovered by probing :)	*/
-// #define MODE2_MAGIC	(MODE2_TSF)
-#define MODE2_MAGIC	(MODE2_SPOLL | MODE2_TSF)
-
-
-/*
- *	LCONF bits (page 205)
- *	these are not all masks, LCONF_XX_YY are my magic values!
- */
-
-#define LCONF_IPA			(1 << 31)	/* Interrupt Pass. Use 1 for FALC54							*/
-#define LCONF_DCA			(1 << 30)	/* Disregard the int's for Channel A - DMSM does not try to handle them	*/
-#define LCONF_DCB			(1 << 29)	/* Disregard the int's for Channel B						*/
-#define LCONF_EBCRES		(1 << 22)	/* Reset LBI External Bus Controller, 0..reset, 1..normal operation	*/
-#define LCONF_LBIRES		(1 << 21)	/* Reset LBI DMSM, 0..reset, 1..normal operation				*/
-#define LCONF_BTYP_16DEMUX	(1 << 7)	/* 16-bit demultiplexed bus	*/
-#define LCONF_ABM			(1 << 4)	/* Arbitration Master		*/
-
-/* writing LCONF_MAGIC1 followed by a LCONF_MAGIC2 into LCONF resets the EBC and DMSM: */
-
-#define LCONF_MAGIC1		(LCONF_BTYP_16DEMUX | LCONF_ABM | LCONF_IPA | LCONF_DCA | LCONF_DCB)
-#define LCONF_MAGIC2		(LCONF_MAGIC1 | LCONF_EBCRES | LCONF_LBIRES)
-
-
-/*
- *	LREGx magic values if a FALC54 is on the LBI (page 217)
- */
-
-#define LREG0_MAGIC	0x00000264
-#define LREG1_MAGIC	0x6e6a6b66
-#define LREG2_MAGIC	0x00000264
-#define LREG3_MAGIC	0x6e686966
-#define LREG4_MAGIC	0x00000000
-#define LREG5_MAGIC	( (7<<27) | (3<<24) | (1<<21) | (7<<3) | (2<<9) )
-
-
-/*
- *	PCM Action Specification fields (munich_ccb_t.action_spec)
- */
-
-#define CCB_ACTIONSPEC_IN			(1 << 15)	/* init				*/
-#define CCB_ACTIONSPEC_ICO			(1 << 14)	/* init only this channel	*/
-#define CCB_ACTIONSPEC_RES			(1 << 6)	/* reset all channels		*/
-#define CCB_ACTIONSPEC_LOC			(1 << 5)
-#define CCB_ACTIONSPEC_LOOP			(1 << 4)
-#define CCB_ACTIONSPEC_LOOPI			(1 << 3)
-#define CCB_ACTIONSPEC_IA			(1 << 2)
-
-
-/*
- *	Interrupt Information bits in the TIQ, RIQ
- */
-
-#define PCM_INT_HI	(1 << 12)
-#define PCM_INT_FI	(1 << 11)
-#define PCM_INT_IFC	(1 << 10)
-#define PCM_INT_SF	(1 << 9)
-#define PCM_INT_ERR	(1 << 8)
-#define PCM_INT_FO	(1 << 7)
-#define PCM_INT_FE2	(1 << 6)
-
-#define PCM_INT_CHANNEL( info )	(info & 0x1F)
-
-
-/*
- *	Rx status info in the rx_desc_t.status
- */
-
-#define RX_STATUS_SF	(1 << 6)
-#define RX_STATUS_LOSS	(1 << 5)
-#define RX_STATUS_CRCO	(1 << 4)
-#define RX_STATUS_NOB	(1 << 3)
-#define RX_STATUS_LFD	(1 << 2)
-#define RX_STATUS_RA	(1 << 1)
-#define RX_STATUS_ROF	1 
diff -Nru a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
--- a/drivers/net/wan/pc300_drv.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/wan/pc300_drv.c	Tue Jun 15 22:21:03 2004
@@ -2542,7 +2542,7 @@
 	pc300conf_t conf_aux;
 	pc300chconf_t *conf = (pc300chconf_t *) & chan->conf;
 	int ch = chan->channel;
-	void *arg = (void *) ifr->ifr_data;
+	void __user *arg = ifr->ifr_data;
 	struct if_settings *settings = &ifr->ifr_settings;
 	uclong scabase = card->hw.scabase;
 
diff -Nru a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
--- a/drivers/net/wan/sbni.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/wan/sbni.c	Tue Jun 15 22:20:39 2004
@@ -1342,7 +1342,7 @@
 			return  -EPERM;
 
 		spin_lock( &nl->lock );
-		flags = *(struct sbni_flags*) &ifr->ifr_data;
+		flags = *(struct sbni_flags*) &ifr->ifr_ifru;
 		if( flags.fixed_rxl )
 			nl->delta_rxl = 0,
 			nl->cur_rxl_index = flags.rxl;
diff -Nru a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
--- a/drivers/net/wan/sdla.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/wan/sdla.c	Tue Jun 15 22:21:05 2004
@@ -1095,7 +1095,7 @@
 	return(0);
 }
 
-static int sdla_config(struct net_device *dev, struct frad_conf *conf, int get)
+static int sdla_config(struct net_device *dev, struct frad_conf __user *conf, int get)
 {
 	struct frad_local *flp;
 	struct conf_data  data;
@@ -1193,7 +1193,7 @@
 	return(0);
 }
 
-static int sdla_xfer(struct net_device *dev, struct sdla_mem *info, int read)
+static int sdla_xfer(struct net_device *dev, struct sdla_mem __user *info, int read)
 {
 	struct sdla_mem mem;
 	char	*temp;
@@ -1271,7 +1271,7 @@
 	{
 		case FRAD_GET_CONF:
 		case FRAD_SET_CONF:
-			return(sdla_config(dev, (struct frad_conf *)ifr->ifr_data, cmd == FRAD_GET_CONF));
+			return(sdla_config(dev, ifr->ifr_data, cmd == FRAD_GET_CONF));
 
 		case SDLA_IDENTIFY:
 			ifr->ifr_flags = flp->type;
@@ -1306,7 +1306,7 @@
 
 		case SDLA_WRITEMEM:
 		case SDLA_READMEM:
-			return(sdla_xfer(dev, (struct sdla_mem *)ifr->ifr_data, cmd == SDLA_READMEM));
+			return(sdla_xfer(dev, ifr->ifr_data, cmd == SDLA_READMEM));
 
 		case SDLA_START:
 			sdla_start(dev);
diff -Nru a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c
--- a/drivers/net/wan/sealevel.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/wan/sealevel.c	Tue Jun 15 22:20:42 2004
@@ -20,6 +20,7 @@
 #include <linux/if_arp.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
+#include <linux/init.h>
 #include <net/arp.h>
 
 #include <asm/io.h>
diff -Nru a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
--- a/drivers/net/wan/wanxl.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/net/wan/wanxl.c	Tue Jun 15 22:21:02 2004
@@ -418,8 +418,10 @@
 
 	timeout = jiffies + HZ;
 	do
-		if (get_status(port)->open)
+		if (get_status(port)->open) {
+			netif_start_queue(dev);
 			return 0;
+		}
 	while (time_after(timeout, jiffies));
 
 	printk(KERN_ERR "%s: unable to open port\n", dev->name);
@@ -449,6 +451,8 @@
 
 	if (get_status(port)->open)
 		printk(KERN_ERR "%s: unable to close port\n", dev->name);
+
+	netif_stop_queue(dev);
 
 	for (i = 0; i < TX_BUFFERS; i++) {
 		desc_t *desc = &get_status(port)->tx_descs[i];
diff -Nru a/drivers/net/wan/wanxlfw.inc b/drivers/net/wan/wanxlfw.inc
--- a/drivers/net/wan/wanxlfw.inc	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,158 +0,0 @@
-static u8 firmware[]={
-0x60,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xB9,0x40,0x00,0x00,0x00,0x00,0x00,
-0x10,0x14,0x42,0x80,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x67,0x00,0x00,0x0E,
-0x06,0xB0,0x40,0x00,0x00,0x00,0x09,0xB0,0x00,0x00,0x10,0x04,0x58,0x80,0x0C,0x80,
-0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xDE,0x21,0xFC,0x00,0x00,0x16,0xBC,0x00,0x6C,
-0x21,0xFC,0x00,0x00,0x17,0x5E,0x01,0x00,0x21,0xFC,0x00,0x00,0x16,0xDE,0x01,0x78,
-0x21,0xFC,0x00,0x00,0x16,0xFE,0x01,0x74,0x21,0xFC,0x00,0x00,0x17,0x1E,0x01,0x70,
-0x21,0xFC,0x00,0x00,0x17,0x3E,0x01,0x6C,0x21,0xFC,0x00,0x00,0x18,0x4C,0x02,0x00,
-0x23,0xFC,0x78,0x00,0x00,0x00,0xFF,0xFC,0x15,0x48,0x33,0xFC,0x04,0x80,0xFF,0xFC,
-0x10,0x26,0x33,0xFC,0x01,0x10,0xFF,0xFC,0x10,0x2A,0x23,0xFC,0x00,0xD4,0x9F,0x40,
-0xFF,0xFC,0x15,0x40,0x23,0xFC,0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x00,0x23,0xFC,
-0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x14,0x23,0xFC,0x00,0x00,0x00,0x00,0xFF,0xF9,
-0x01,0x10,0x23,0xFC,0x00,0x00,0x00,0x08,0xFF,0xF9,0x01,0x24,0x23,0xFC,0x00,0x00,
-0x01,0x01,0xFF,0xF9,0x01,0x28,0x00,0xB9,0x00,0x0F,0x03,0x00,0xFF,0xF9,0x00,0xE8,
-0x23,0xFC,0x00,0x00,0x00,0x01,0xFF,0xF9,0x00,0xD4,0x61,0x00,0x06,0x74,0x33,0xFC,
-0xFF,0xFF,0xFF,0xFC,0x15,0x52,0x42,0x79,0xFF,0xFC,0x15,0x50,0x42,0x79,0xFF,0xFC,
-0x15,0x64,0x2E,0x3A,0x08,0x50,0x42,0xB9,0x00,0x00,0x19,0x54,0x4A,0x87,0x66,0x00,
-0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE6,0x42,0x80,
-0x42,0x86,0x08,0x07,0x00,0x04,0x67,0x00,0x00,0x0A,0x08,0x87,0x00,0x00,0x61,0x00,
-0x02,0xA0,0x08,0x07,0x00,0x00,0x67,0x00,0x00,0x06,0x61,0x00,0x00,0x36,0x08,0x07,
-0x00,0x08,0x67,0x00,0x00,0x06,0x61,0x00,0x02,0xB8,0x08,0x07,0x00,0x0C,0x67,0x00,
-0x00,0x0A,0x61,0x00,0x04,0x94,0x61,0x00,0x03,0x60,0xE2,0x8F,0x58,0x80,0x0C,0x80,
-0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xBC,0x23,0xC6,0xFF,0xF9,0x00,0xE4,0x60,0x00,
-0xFF,0x92,0x20,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0x4A,0xA8,0x00,0x00,0x66,0x00,
-0x02,0x4E,0x21,0x7C,0x00,0x00,0x00,0x01,0x00,0x00,0x42,0xB0,0x09,0xB0,0x00,0x00,
-0x19,0x58,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x68,0x42,0xB0,0x09,0xB0,0x00,0x00,
-0x19,0x78,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x88,0x22,0x39,0xFF,0xFC,0x16,0xEC,
-0xC2,0xB0,0x09,0xB0,0x00,0x00,0x18,0xF2,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x18,
-0x66,0x00,0x00,0x0E,0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xE2,0x60,0x00,0x00,0x0A,
-0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xD2,0x23,0xC1,0xFF,0xFC,0x16,0xEC,0x00,0x70,
-0x10,0x00,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,0x05,0x76,0x22,0x30,0x09,0xB0,
-0x00,0x00,0x18,0x92,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x72,0x74,0x08,0x26,0x3C,
-0x18,0x00,0x00,0x00,0x0C,0xA8,0x00,0x00,0x00,0x01,0x00,0x10,0x67,0x00,0x00,0x06,
-0x08,0xC3,0x00,0x1A,0x22,0xC3,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,
-0xFF,0xF4,0x08,0xC3,0x00,0x1D,0x22,0xC3,0x22,0xC1,0x74,0x1C,0x22,0xFC,0x90,0x00,
-0x00,0x00,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,0xFF,0xF0,0x22,0xFC,
-0xB0,0x00,0x00,0x00,0x22,0xC1,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x62,0x24,0x70,
-0x09,0xB0,0x00,0x00,0x18,0x52,0x25,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x10,0x25,0x7C,
-0x00,0x00,0x00,0x00,0x00,0x14,0x22,0x30,0x09,0xB0,0x00,0x00,0x18,0x72,0x33,0x41,
-0x00,0x02,0x06,0x81,0x00,0x00,0x00,0x50,0x33,0x41,0x00,0x00,0x13,0x7C,0x00,0x08,
-0x00,0x04,0x13,0x7C,0x00,0x08,0x00,0x05,0x0C,0xA8,0x00,0x00,0x00,0x05,0x00,0x10,
-0x66,0x00,0x00,0x2A,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,
-0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xFA,0x00,0x46,0x31,0xBC,
-0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,0x00,0xBC,0x0C,0xA8,0x00,0x00,
-0x00,0x07,0x00,0x10,0x66,0x00,0x00,0x2C,0x35,0x7C,0x08,0x00,0x00,0x08,0x23,0x7C,
-0xDE,0xBB,0x20,0xE3,0x00,0x34,0x23,0x7C,0xFF,0xFF,0xFF,0xFF,0x00,0x38,0x33,0x7C,
-0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,
-0x00,0x86,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x10,0x66,0x00,0x00,0x26,0x42,0x6A,
-0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,0x42,0xA9,0x00,0x38,0x33,0x7C,
-0x05,0xFA,0x00,0x46,0x31,0xBC,0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,
-0x00,0x56,0x0C,0xA8,0x00,0x00,0x00,0x06,0x00,0x10,0x66,0x00,0x00,0x28,0x35,0x7C,
-0x08,0x00,0x00,0x08,0x23,0x7C,0xDE,0xBB,0x20,0xE3,0x00,0x34,0x42,0xA9,0x00,0x38,
-0x33,0x7C,0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,
-0x60,0x00,0x00,0x24,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,
-0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xF8,0x00,0x46,0x42,0x70,
-0x09,0xB0,0x00,0x00,0x19,0x9C,0x25,0x7C,0x00,0x00,0x00,0x03,0x00,0x04,0x0C,0xA8,
-0x00,0x00,0x00,0x02,0x00,0x14,0x66,0x00,0x00,0x0E,0x25,0x7C,0x10,0x04,0x09,0x00,
-0x00,0x00,0x60,0x00,0x00,0x0A,0x25,0x7C,0x10,0x04,0x00,0x00,0x00,0x00,0x33,0x7C,
-0x05,0xFC,0x00,0x06,0x22,0x00,0xE9,0x89,0x00,0x81,0x00,0x00,0x00,0x01,0x33,0xC1,
-0xFF,0xFC,0x15,0xC0,0x08,0x39,0x00,0x00,0xFF,0xFC,0x15,0xC0,0x66,0x00,0xFF,0xF6,
-0x35,0x7C,0x00,0x1F,0x00,0x14,0x00,0xAA,0x00,0x00,0x00,0x30,0x00,0x00,0x4E,0x75,
-0x20,0x70,0x09,0xB0,0x00,0x00,0x18,0x52,0x42,0x68,0x00,0x14,0x02,0xA8,0xFF,0xFF,
-0xFF,0xCF,0x00,0x00,0x02,0x70,0xEF,0xFF,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,
-0x03,0x70,0x22,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x42,0xB0,0x19,0x90,0x4E,0x75,
-0x0C,0xB0,0x00,0x00,0x00,0x0A,0x09,0xB0,0x00,0x00,0x19,0x78,0x67,0x00,0x00,0xA8,
-0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x68,0x24,0x01,0x4C,0x3C,0x20,0x00,0x00,0x00,
-0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,
-0x0C,0xB0,0x00,0x00,0x00,0x10,0x29,0x90,0x66,0x00,0x00,0x7C,0x20,0x70,0x29,0xA0,
-0x00,0x04,0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x22,0x70,0x19,0xA0,
-0x00,0x04,0x24,0x30,0x29,0xA0,0x00,0x08,0x31,0x82,0x19,0xA0,0x00,0x02,0x56,0x82,
-0x02,0x82,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,0xFF,0xF9,0x01,0x04,0x23,0xC9,0xFF,0xF9,
-0x01,0x08,0x23,0xC2,0xFF,0xF9,0x01,0x0C,0x23,0xFC,0x00,0x00,0x01,0x03,0xFF,0xF9,
-0x01,0x28,0x61,0x00,0x01,0xF6,0x08,0xF0,0x00,0x1F,0x19,0x90,0x22,0x30,0x09,0xB0,
-0x00,0x00,0x19,0x68,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,
-0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x68,0x52,0xB0,0x09,0xB0,0x00,0x00,
-0x19,0x78,0x60,0x00,0xFF,0x4C,0x4E,0x75,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,
-0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x82,0x34,0x30,0x19,0x90,0x08,0x02,
-0x00,0x0F,0x66,0x00,0x01,0x12,0x08,0x02,0x00,0x01,0x66,0x00,0x00,0xE6,0x4A,0x70,
-0x09,0xB0,0x00,0x00,0x19,0x9C,0x66,0x00,0x00,0x06,0x08,0x82,0x00,0x02,0x02,0x42,
-0x0C,0xBC,0x0C,0x42,0x0C,0x00,0x66,0x00,0x00,0xDC,0x42,0x83,0x36,0x30,0x19,0xA0,
-0x00,0x02,0x96,0x70,0x09,0xB0,0x00,0x00,0x19,0x9C,0x0C,0x43,0x05,0xF8,0x6E,0x00,
-0x00,0xC4,0x24,0x3A,0x04,0x84,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xBA,
-0xFA,0xF4,0x0C,0xB0,0x00,0x00,0x00,0x00,0x29,0x90,0x66,0x00,0x00,0x96,0x21,0x83,
-0x29,0xA0,0x00,0x08,0x20,0x70,0x19,0xA0,0x00,0x04,0x22,0x70,0x29,0xA0,0x00,0x04,
-0x4A,0x89,0x67,0x00,0x00,0x2A,0x56,0x83,0x02,0x83,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,
-0xFF,0xF9,0x01,0x1C,0x23,0xC9,0xFF,0xF9,0x01,0x18,0x23,0xC3,0xFF,0xF9,0x01,0x20,
-0x23,0xFC,0x00,0x00,0x03,0x01,0xFF,0xF9,0x01,0x28,0x61,0x00,0x01,0x2C,0x21,0xB0,
-0x09,0xB0,0x00,0x00,0x18,0xC2,0x29,0x90,0x08,0xC6,0x00,0x04,0x24,0x3A,0x04,0x1A,
-0x52,0x82,0x0C,0x82,0x00,0x00,0x00,0x28,0x66,0x00,0x00,0x04,0x42,0x82,0x23,0xC2,
-0x00,0x00,0x19,0x98,0x02,0x70,0xF0,0x00,0x19,0x90,0x08,0xF0,0x00,0x1F,0x19,0x90,
-0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x1E,
-0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x88,0x60,0x00,
-0xFE,0xF8,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,0x00,0x08,
-0x60,0x00,0xFF,0xC2,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,
-0x00,0x0C,0x60,0x00,0xFF,0xB0,0x4E,0x75,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x19,0x78,
-0x67,0x00,0x00,0x86,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x24,0x01,0xE7,0x89,
-0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x36,0x30,0x19,0x90,0x08,0x03,0x00,0x0F,
-0x66,0x00,0x00,0x66,0x8C,0xB0,0x09,0xB0,0x00,0x00,0x18,0xA2,0x53,0xB0,0x09,0xB0,
-0x00,0x00,0x19,0x78,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x52,0x81,0x0C,0x81,
-0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,
-0x19,0x58,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,
-0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,0x08,0x03,0x00,0x01,0x66,0x00,0x00,0x0E,
-0x21,0xBC,0x00,0x00,0x00,0x20,0x29,0x90,0x60,0x00,0xFF,0x7E,0x21,0xBC,0x00,0x00,
-0x00,0x30,0x29,0x90,0x60,0x00,0xFF,0x72,0x4E,0x75,0x2F,0x00,0x40,0xE7,0x20,0x39,
-0xFF,0xF9,0x01,0x28,0x08,0x00,0x00,0x04,0x66,0x00,0x00,0x2C,0x4E,0x72,0x22,0x00,
-0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE8,0x2F,0x00,0x40,0xE7,0x20,0x39,0xFF,0xF9,
-0x01,0x28,0x08,0x00,0x00,0x0C,0x66,0x00,0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,
-0x27,0x00,0x60,0x00,0xFF,0xE8,0x46,0xDF,0x20,0x1F,0x4E,0x75,0x2F,0x00,0x20,0x39,
-0xFF,0xF9,0x00,0xE0,0x23,0xC0,0xFF,0xF9,0x00,0xE0,0x81,0xB9,0x00,0x00,0x19,0x54,
-0x23,0xFC,0x00,0x00,0x09,0x09,0xFF,0xF9,0x01,0x28,0x20,0x1F,0x4E,0x73,0x00,0xB9,
-0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x10,0x00,0xB9,0x00,0x00,0x10,0x00,0x00,0x00,
-0x19,0x54,0x23,0xFC,0x40,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
-0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x30,0x00,0xB9,0x00,0x00,0x20,0x00,0x00,0x00,
-0x19,0x54,0x23,0xFC,0x20,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
-0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x50,0x00,0xB9,0x00,0x00,0x40,0x00,0x00,0x00,
-0x19,0x54,0x23,0xFC,0x10,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
-0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x70,0x00,0xB9,0x00,0x00,0x80,0x00,0x00,0x00,
-0x19,0x54,0x23,0xFC,0x08,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x4E,0x73,
-0x2F,0x00,0x2F,0x01,0x2F,0x02,0x2F,0x08,0x2F,0x09,0x42,0x80,0x20,0x7C,0xFF,0xFB,
-0x00,0x00,0x32,0x10,0x02,0x81,0x00,0x00,0x00,0xE7,0x0C,0x41,0x00,0x42,0x66,0x00,
-0x00,0x0A,0x32,0x3C,0x0E,0x08,0x60,0x00,0x00,0x3E,0x0C,0x41,0x00,0x63,0x66,0x00,
-0x00,0x0A,0x32,0x3C,0x04,0x08,0x60,0x00,0x00,0x2E,0x0C,0x41,0x00,0x84,0x66,0x00,
-0x00,0x0A,0x32,0x3C,0x02,0x08,0x60,0x00,0x00,0x1E,0x0C,0x41,0x00,0xA5,0x66,0x00,
-0x00,0x0A,0x32,0x3C,0x0D,0x08,0x60,0x00,0x00,0x0E,0x32,0x3C,0x00,0x08,0x34,0x3C,
-0x80,0xE7,0x60,0x00,0x00,0x14,0x34,0x30,0x09,0xB0,0x00,0x00,0x19,0xAA,0x02,0x42,
-0x30,0x00,0x82,0x42,0x34,0x3C,0x80,0xFF,0xB2,0x70,0x09,0xB0,0x00,0x00,0x19,0xAC,
-0x67,0x00,0x00,0x0C,0x31,0x81,0x09,0xB0,0x00,0x00,0x19,0xAC,0x30,0x81,0x32,0x39,
-0xFF,0xFC,0x15,0x66,0xC2,0x70,0x09,0xB0,0x00,0x00,0x19,0x02,0x67,0x00,0x00,0x0C,
-0x32,0x10,0x02,0x41,0xFF,0xF7,0x60,0x00,0x00,0x08,0x32,0x10,0x00,0x41,0x00,0x08,
-0xC2,0x42,0x22,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0xB2,0xA9,0x00,0x04,0x67,0x00,
-0x00,0x12,0x23,0x41,0x00,0x04,0x23,0xF0,0x09,0xB0,0x00,0x00,0x18,0xB2,0xFF,0xF9,
-0x00,0xE4,0x54,0x88,0x58,0x80,0x0C,0x80,0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0x34,
-0x22,0x5F,0x20,0x5F,0x24,0x1F,0x22,0x1F,0x20,0x1F,0x4E,0x75,0x61,0x00,0xFF,0x12,
-0x4E,0x73,0xFF,0xFC,0x16,0x00,0xFF,0xFC,0x16,0x20,0xFF,0xFC,0x16,0x40,0xFF,0xFC,
-0x16,0x60,0xFF,0xFC,0x0C,0x00,0xFF,0xFC,0x0D,0x00,0xFF,0xFC,0x0E,0x00,0xFF,0xFC,
-0x0F,0x00,0xFF,0xFC,0x00,0x00,0xFF,0xFC,0x01,0x40,0xFF,0xFC,0x02,0x80,0xFF,0xFC,
-0x03,0xC0,0xFF,0xFC,0x00,0x50,0xFF,0xFC,0x01,0x90,0xFF,0xFC,0x02,0xD0,0xFF,0xFC,
-0x04,0x10,0x00,0x00,0x40,0x00,0x00,0x01,0x2F,0x60,0x00,0x02,0x1E,0xC0,0x00,0x03,
-0x0E,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,
-0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x00,0x00,
-0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,
-0x00,0x13,0x00,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,
-0x00,0x00,0x00,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,
-0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,
-0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x80,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00,
-0x77,0x61,0x6E,0x58,0x4C,0x20,0x66,0x69,0x72,0x6D,0x77,0x61,0x72,0x65,0x0A,0x43,
-0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x32,0x30,0x30,
-0x33,0x20,0x4B,0x72,0x7A,0x79,0x73,0x7A,0x74,0x6F,0x66,0x20,0x48,0x61,0x6C,0x61,
-0x73,0x61,0x20,0x3C,0x6B,0x68,0x63,0x40,0x70,0x6D,0x2E,0x77,0x61,0x77,0x2E,0x70,
-0x6C,0x3E,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
-};
diff -Nru a/drivers/net/wan/wanxlfw.inc_shipped b/drivers/net/wan/wanxlfw.inc_shipped
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/net/wan/wanxlfw.inc_shipped	Tue Jun 15 22:20:40 2004
@@ -0,0 +1,158 @@
+static u8 firmware[]={
+0x60,0x00,0x00,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xB9,0x40,0x00,0x00,0x00,0x00,0x00,
+0x10,0x14,0x42,0x80,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x67,0x00,0x00,0x0E,
+0x06,0xB0,0x40,0x00,0x00,0x00,0x09,0xB0,0x00,0x00,0x10,0x04,0x58,0x80,0x0C,0x80,
+0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xDE,0x21,0xFC,0x00,0x00,0x16,0xBC,0x00,0x6C,
+0x21,0xFC,0x00,0x00,0x17,0x5E,0x01,0x00,0x21,0xFC,0x00,0x00,0x16,0xDE,0x01,0x78,
+0x21,0xFC,0x00,0x00,0x16,0xFE,0x01,0x74,0x21,0xFC,0x00,0x00,0x17,0x1E,0x01,0x70,
+0x21,0xFC,0x00,0x00,0x17,0x3E,0x01,0x6C,0x21,0xFC,0x00,0x00,0x18,0x4C,0x02,0x00,
+0x23,0xFC,0x78,0x00,0x00,0x00,0xFF,0xFC,0x15,0x48,0x33,0xFC,0x04,0x80,0xFF,0xFC,
+0x10,0x26,0x33,0xFC,0x01,0x10,0xFF,0xFC,0x10,0x2A,0x23,0xFC,0x00,0xD4,0x9F,0x40,
+0xFF,0xFC,0x15,0x40,0x23,0xFC,0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x00,0x23,0xFC,
+0x00,0x00,0x05,0x43,0xFF,0xF9,0x01,0x14,0x23,0xFC,0x00,0x00,0x00,0x00,0xFF,0xF9,
+0x01,0x10,0x23,0xFC,0x00,0x00,0x00,0x08,0xFF,0xF9,0x01,0x24,0x23,0xFC,0x00,0x00,
+0x01,0x01,0xFF,0xF9,0x01,0x28,0x00,0xB9,0x00,0x0F,0x03,0x00,0xFF,0xF9,0x00,0xE8,
+0x23,0xFC,0x00,0x00,0x00,0x01,0xFF,0xF9,0x00,0xD4,0x61,0x00,0x06,0x74,0x33,0xFC,
+0xFF,0xFF,0xFF,0xFC,0x15,0x52,0x42,0x79,0xFF,0xFC,0x15,0x50,0x42,0x79,0xFF,0xFC,
+0x15,0x64,0x2E,0x3A,0x08,0x50,0x42,0xB9,0x00,0x00,0x19,0x54,0x4A,0x87,0x66,0x00,
+0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE6,0x42,0x80,
+0x42,0x86,0x08,0x07,0x00,0x04,0x67,0x00,0x00,0x0A,0x08,0x87,0x00,0x00,0x61,0x00,
+0x02,0xA0,0x08,0x07,0x00,0x00,0x67,0x00,0x00,0x06,0x61,0x00,0x00,0x36,0x08,0x07,
+0x00,0x08,0x67,0x00,0x00,0x06,0x61,0x00,0x02,0xB8,0x08,0x07,0x00,0x0C,0x67,0x00,
+0x00,0x0A,0x61,0x00,0x04,0x94,0x61,0x00,0x03,0x60,0xE2,0x8F,0x58,0x80,0x0C,0x80,
+0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0xBC,0x23,0xC6,0xFF,0xF9,0x00,0xE4,0x60,0x00,
+0xFF,0x92,0x20,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0x4A,0xA8,0x00,0x00,0x66,0x00,
+0x02,0x4E,0x21,0x7C,0x00,0x00,0x00,0x01,0x00,0x00,0x42,0xB0,0x09,0xB0,0x00,0x00,
+0x19,0x58,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x68,0x42,0xB0,0x09,0xB0,0x00,0x00,
+0x19,0x78,0x42,0xB0,0x09,0xB0,0x00,0x00,0x19,0x88,0x22,0x39,0xFF,0xFC,0x16,0xEC,
+0xC2,0xB0,0x09,0xB0,0x00,0x00,0x18,0xF2,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x18,
+0x66,0x00,0x00,0x0E,0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xE2,0x60,0x00,0x00,0x0A,
+0x82,0xB0,0x09,0xB0,0x00,0x00,0x18,0xD2,0x23,0xC1,0xFF,0xFC,0x16,0xEC,0x00,0x70,
+0x10,0x00,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,0x05,0x76,0x22,0x30,0x09,0xB0,
+0x00,0x00,0x18,0x92,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x72,0x74,0x08,0x26,0x3C,
+0x18,0x00,0x00,0x00,0x0C,0xA8,0x00,0x00,0x00,0x01,0x00,0x10,0x67,0x00,0x00,0x06,
+0x08,0xC3,0x00,0x1A,0x22,0xC3,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,
+0xFF,0xF4,0x08,0xC3,0x00,0x1D,0x22,0xC3,0x22,0xC1,0x74,0x1C,0x22,0xFC,0x90,0x00,
+0x00,0x00,0x22,0xC1,0x06,0x81,0x00,0x00,0x05,0xFC,0x51,0xCA,0xFF,0xF0,0x22,0xFC,
+0xB0,0x00,0x00,0x00,0x22,0xC1,0x22,0x70,0x09,0xB0,0x00,0x00,0x18,0x62,0x24,0x70,
+0x09,0xB0,0x00,0x00,0x18,0x52,0x25,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x10,0x25,0x7C,
+0x00,0x00,0x00,0x00,0x00,0x14,0x22,0x30,0x09,0xB0,0x00,0x00,0x18,0x72,0x33,0x41,
+0x00,0x02,0x06,0x81,0x00,0x00,0x00,0x50,0x33,0x41,0x00,0x00,0x13,0x7C,0x00,0x08,
+0x00,0x04,0x13,0x7C,0x00,0x08,0x00,0x05,0x0C,0xA8,0x00,0x00,0x00,0x05,0x00,0x10,
+0x66,0x00,0x00,0x2A,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,
+0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xFA,0x00,0x46,0x31,0xBC,
+0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,0x00,0xBC,0x0C,0xA8,0x00,0x00,
+0x00,0x07,0x00,0x10,0x66,0x00,0x00,0x2C,0x35,0x7C,0x08,0x00,0x00,0x08,0x23,0x7C,
+0xDE,0xBB,0x20,0xE3,0x00,0x34,0x23,0x7C,0xFF,0xFF,0xFF,0xFF,0x00,0x38,0x33,0x7C,
+0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,
+0x00,0x86,0x0C,0xA8,0x00,0x00,0x00,0x04,0x00,0x10,0x66,0x00,0x00,0x26,0x42,0x6A,
+0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,0x42,0xA9,0x00,0x38,0x33,0x7C,
+0x05,0xFA,0x00,0x46,0x31,0xBC,0x00,0x02,0x09,0xB0,0x00,0x00,0x19,0x9C,0x60,0x00,
+0x00,0x56,0x0C,0xA8,0x00,0x00,0x00,0x06,0x00,0x10,0x66,0x00,0x00,0x28,0x35,0x7C,
+0x08,0x00,0x00,0x08,0x23,0x7C,0xDE,0xBB,0x20,0xE3,0x00,0x34,0x42,0xA9,0x00,0x38,
+0x33,0x7C,0x05,0xFC,0x00,0x46,0x31,0xBC,0x00,0x04,0x09,0xB0,0x00,0x00,0x19,0x9C,
+0x60,0x00,0x00,0x24,0x42,0x6A,0x00,0x08,0x23,0x7C,0x00,0x00,0xF0,0xB8,0x00,0x34,
+0x23,0x7C,0x00,0x00,0xFF,0xFF,0x00,0x38,0x33,0x7C,0x05,0xF8,0x00,0x46,0x42,0x70,
+0x09,0xB0,0x00,0x00,0x19,0x9C,0x25,0x7C,0x00,0x00,0x00,0x03,0x00,0x04,0x0C,0xA8,
+0x00,0x00,0x00,0x02,0x00,0x14,0x66,0x00,0x00,0x0E,0x25,0x7C,0x10,0x04,0x09,0x00,
+0x00,0x00,0x60,0x00,0x00,0x0A,0x25,0x7C,0x10,0x04,0x00,0x00,0x00,0x00,0x33,0x7C,
+0x05,0xFC,0x00,0x06,0x22,0x00,0xE9,0x89,0x00,0x81,0x00,0x00,0x00,0x01,0x33,0xC1,
+0xFF,0xFC,0x15,0xC0,0x08,0x39,0x00,0x00,0xFF,0xFC,0x15,0xC0,0x66,0x00,0xFF,0xF6,
+0x35,0x7C,0x00,0x1F,0x00,0x14,0x00,0xAA,0x00,0x00,0x00,0x30,0x00,0x00,0x4E,0x75,
+0x20,0x70,0x09,0xB0,0x00,0x00,0x18,0x52,0x42,0x68,0x00,0x14,0x02,0xA8,0xFF,0xFF,
+0xFF,0xCF,0x00,0x00,0x02,0x70,0xEF,0xFF,0x09,0xB0,0x00,0x00,0x19,0xAA,0x61,0x00,
+0x03,0x70,0x22,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x42,0xB0,0x19,0x90,0x4E,0x75,
+0x0C,0xB0,0x00,0x00,0x00,0x0A,0x09,0xB0,0x00,0x00,0x19,0x78,0x67,0x00,0x00,0xA8,
+0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x68,0x24,0x01,0x4C,0x3C,0x20,0x00,0x00,0x00,
+0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,
+0x0C,0xB0,0x00,0x00,0x00,0x10,0x29,0x90,0x66,0x00,0x00,0x7C,0x20,0x70,0x29,0xA0,
+0x00,0x04,0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x22,0x70,0x19,0xA0,
+0x00,0x04,0x24,0x30,0x29,0xA0,0x00,0x08,0x31,0x82,0x19,0xA0,0x00,0x02,0x56,0x82,
+0x02,0x82,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,0xFF,0xF9,0x01,0x04,0x23,0xC9,0xFF,0xF9,
+0x01,0x08,0x23,0xC2,0xFF,0xF9,0x01,0x0C,0x23,0xFC,0x00,0x00,0x01,0x03,0xFF,0xF9,
+0x01,0x28,0x61,0x00,0x01,0xF6,0x08,0xF0,0x00,0x1F,0x19,0x90,0x22,0x30,0x09,0xB0,
+0x00,0x00,0x19,0x68,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,
+0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x68,0x52,0xB0,0x09,0xB0,0x00,0x00,
+0x19,0x78,0x60,0x00,0xFF,0x4C,0x4E,0x75,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,
+0xE7,0x89,0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x82,0x34,0x30,0x19,0x90,0x08,0x02,
+0x00,0x0F,0x66,0x00,0x01,0x12,0x08,0x02,0x00,0x01,0x66,0x00,0x00,0xE6,0x4A,0x70,
+0x09,0xB0,0x00,0x00,0x19,0x9C,0x66,0x00,0x00,0x06,0x08,0x82,0x00,0x02,0x02,0x42,
+0x0C,0xBC,0x0C,0x42,0x0C,0x00,0x66,0x00,0x00,0xDC,0x42,0x83,0x36,0x30,0x19,0xA0,
+0x00,0x02,0x96,0x70,0x09,0xB0,0x00,0x00,0x19,0x9C,0x0C,0x43,0x05,0xF8,0x6E,0x00,
+0x00,0xC4,0x24,0x3A,0x04,0x84,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xBA,
+0xFA,0xF4,0x0C,0xB0,0x00,0x00,0x00,0x00,0x29,0x90,0x66,0x00,0x00,0x96,0x21,0x83,
+0x29,0xA0,0x00,0x08,0x20,0x70,0x19,0xA0,0x00,0x04,0x22,0x70,0x29,0xA0,0x00,0x04,
+0x4A,0x89,0x67,0x00,0x00,0x2A,0x56,0x83,0x02,0x83,0xFF,0xFF,0xFF,0xFC,0x23,0xC8,
+0xFF,0xF9,0x01,0x1C,0x23,0xC9,0xFF,0xF9,0x01,0x18,0x23,0xC3,0xFF,0xF9,0x01,0x20,
+0x23,0xFC,0x00,0x00,0x03,0x01,0xFF,0xF9,0x01,0x28,0x61,0x00,0x01,0x2C,0x21,0xB0,
+0x09,0xB0,0x00,0x00,0x18,0xC2,0x29,0x90,0x08,0xC6,0x00,0x04,0x24,0x3A,0x04,0x1A,
+0x52,0x82,0x0C,0x82,0x00,0x00,0x00,0x28,0x66,0x00,0x00,0x04,0x42,0x82,0x23,0xC2,
+0x00,0x00,0x19,0x98,0x02,0x70,0xF0,0x00,0x19,0x90,0x08,0xF0,0x00,0x1F,0x19,0x90,
+0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x88,0x52,0x81,0x0C,0x81,0x00,0x00,0x00,0x1E,
+0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,0x19,0x88,0x60,0x00,
+0xFE,0xF8,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,0x00,0x08,
+0x60,0x00,0xFF,0xC2,0x24,0x30,0x09,0xB0,0x00,0x00,0x10,0x04,0x52,0xB0,0x29,0xA0,
+0x00,0x0C,0x60,0x00,0xFF,0xB0,0x4E,0x75,0x4A,0xB0,0x09,0xB0,0x00,0x00,0x19,0x78,
+0x67,0x00,0x00,0x86,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x24,0x01,0xE7,0x89,
+0xD2,0xB0,0x09,0xB0,0x00,0x00,0x18,0x72,0x36,0x30,0x19,0x90,0x08,0x03,0x00,0x0F,
+0x66,0x00,0x00,0x66,0x8C,0xB0,0x09,0xB0,0x00,0x00,0x18,0xA2,0x53,0xB0,0x09,0xB0,
+0x00,0x00,0x19,0x78,0x22,0x30,0x09,0xB0,0x00,0x00,0x19,0x58,0x52,0x81,0x0C,0x81,
+0x00,0x00,0x00,0x0A,0x66,0x00,0x00,0x04,0x42,0x81,0x21,0x81,0x09,0xB0,0x00,0x00,
+0x19,0x58,0x4C,0x3C,0x20,0x00,0x00,0x00,0x00,0x0C,0xD4,0xB0,0x09,0xB0,0x00,0x00,
+0x10,0x04,0x06,0x82,0x00,0x00,0x00,0x1C,0x08,0x03,0x00,0x01,0x66,0x00,0x00,0x0E,
+0x21,0xBC,0x00,0x00,0x00,0x20,0x29,0x90,0x60,0x00,0xFF,0x7E,0x21,0xBC,0x00,0x00,
+0x00,0x30,0x29,0x90,0x60,0x00,0xFF,0x72,0x4E,0x75,0x2F,0x00,0x40,0xE7,0x20,0x39,
+0xFF,0xF9,0x01,0x28,0x08,0x00,0x00,0x04,0x66,0x00,0x00,0x2C,0x4E,0x72,0x22,0x00,
+0x46,0xFC,0x27,0x00,0x60,0x00,0xFF,0xE8,0x2F,0x00,0x40,0xE7,0x20,0x39,0xFF,0xF9,
+0x01,0x28,0x08,0x00,0x00,0x0C,0x66,0x00,0x00,0x0E,0x4E,0x72,0x22,0x00,0x46,0xFC,
+0x27,0x00,0x60,0x00,0xFF,0xE8,0x46,0xDF,0x20,0x1F,0x4E,0x75,0x2F,0x00,0x20,0x39,
+0xFF,0xF9,0x00,0xE0,0x23,0xC0,0xFF,0xF9,0x00,0xE0,0x81,0xB9,0x00,0x00,0x19,0x54,
+0x23,0xFC,0x00,0x00,0x09,0x09,0xFF,0xF9,0x01,0x28,0x20,0x1F,0x4E,0x73,0x00,0xB9,
+0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x10,0x00,0xB9,0x00,0x00,0x10,0x00,0x00,0x00,
+0x19,0x54,0x23,0xFC,0x40,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
+0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x30,0x00,0xB9,0x00,0x00,0x20,0x00,0x00,0x00,
+0x19,0x54,0x23,0xFC,0x20,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
+0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x50,0x00,0xB9,0x00,0x00,0x40,0x00,0x00,0x00,
+0x19,0x54,0x23,0xFC,0x10,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x00,0xB9,
+0x00,0x00,0x00,0x00,0xFF,0xFC,0x16,0x70,0x00,0xB9,0x00,0x00,0x80,0x00,0x00,0x00,
+0x19,0x54,0x23,0xFC,0x08,0x00,0x00,0x00,0xFF,0xFC,0x15,0x4C,0x4E,0x73,0x4E,0x73,
+0x2F,0x00,0x2F,0x01,0x2F,0x02,0x2F,0x08,0x2F,0x09,0x42,0x80,0x20,0x7C,0xFF,0xFB,
+0x00,0x00,0x32,0x10,0x02,0x81,0x00,0x00,0x00,0xE7,0x0C,0x41,0x00,0x42,0x66,0x00,
+0x00,0x0A,0x32,0x3C,0x0E,0x08,0x60,0x00,0x00,0x3E,0x0C,0x41,0x00,0x63,0x66,0x00,
+0x00,0x0A,0x32,0x3C,0x04,0x08,0x60,0x00,0x00,0x2E,0x0C,0x41,0x00,0x84,0x66,0x00,
+0x00,0x0A,0x32,0x3C,0x02,0x08,0x60,0x00,0x00,0x1E,0x0C,0x41,0x00,0xA5,0x66,0x00,
+0x00,0x0A,0x32,0x3C,0x0D,0x08,0x60,0x00,0x00,0x0E,0x32,0x3C,0x00,0x08,0x34,0x3C,
+0x80,0xE7,0x60,0x00,0x00,0x14,0x34,0x30,0x09,0xB0,0x00,0x00,0x19,0xAA,0x02,0x42,
+0x30,0x00,0x82,0x42,0x34,0x3C,0x80,0xFF,0xB2,0x70,0x09,0xB0,0x00,0x00,0x19,0xAC,
+0x67,0x00,0x00,0x0C,0x31,0x81,0x09,0xB0,0x00,0x00,0x19,0xAC,0x30,0x81,0x32,0x39,
+0xFF,0xFC,0x15,0x66,0xC2,0x70,0x09,0xB0,0x00,0x00,0x19,0x02,0x67,0x00,0x00,0x0C,
+0x32,0x10,0x02,0x41,0xFF,0xF7,0x60,0x00,0x00,0x08,0x32,0x10,0x00,0x41,0x00,0x08,
+0xC2,0x42,0x22,0x70,0x09,0xB0,0x00,0x00,0x10,0x04,0xB2,0xA9,0x00,0x04,0x67,0x00,
+0x00,0x12,0x23,0x41,0x00,0x04,0x23,0xF0,0x09,0xB0,0x00,0x00,0x18,0xB2,0xFF,0xF9,
+0x00,0xE4,0x54,0x88,0x58,0x80,0x0C,0x80,0x00,0x00,0x00,0x10,0x66,0x00,0xFF,0x34,
+0x22,0x5F,0x20,0x5F,0x24,0x1F,0x22,0x1F,0x20,0x1F,0x4E,0x75,0x61,0x00,0xFF,0x12,
+0x4E,0x73,0xFF,0xFC,0x16,0x00,0xFF,0xFC,0x16,0x20,0xFF,0xFC,0x16,0x40,0xFF,0xFC,
+0x16,0x60,0xFF,0xFC,0x0C,0x00,0xFF,0xFC,0x0D,0x00,0xFF,0xFC,0x0E,0x00,0xFF,0xFC,
+0x0F,0x00,0xFF,0xFC,0x00,0x00,0xFF,0xFC,0x01,0x40,0xFF,0xFC,0x02,0x80,0xFF,0xFC,
+0x03,0xC0,0xFF,0xFC,0x00,0x50,0xFF,0xFC,0x01,0x90,0xFF,0xFC,0x02,0xD0,0xFF,0xFC,
+0x04,0x10,0x00,0x00,0x40,0x00,0x00,0x01,0x2F,0x60,0x00,0x02,0x1E,0xC0,0x00,0x03,
+0x0E,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,
+0x00,0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x80,0x00,0x00,
+0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x12,0x00,0x00,
+0x00,0x13,0x00,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,0x00,0x2C,0x00,0x00,0x3E,0x00,
+0x00,0x00,0x00,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,0x00,0x2D,0x00,0x00,0x3F,0x00,
+0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,
+0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x80,0x00,0x00,0x02,0x00,0x00,0x00,0x08,0x00,
+0x77,0x61,0x6E,0x58,0x4C,0x20,0x66,0x69,0x72,0x6D,0x77,0x61,0x72,0x65,0x0A,0x43,
+0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,0x20,0x28,0x43,0x29,0x20,0x32,0x30,0x30,
+0x33,0x20,0x4B,0x72,0x7A,0x79,0x73,0x7A,0x74,0x6F,0x66,0x20,0x48,0x61,0x6C,0x61,
+0x73,0x61,0x20,0x3C,0x6B,0x68,0x63,0x40,0x70,0x6D,0x2E,0x77,0x61,0x77,0x2E,0x70,
+0x6C,0x3E,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
diff -Nru a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
--- a/drivers/net/wireless/airo.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/wireless/airo.c	Tue Jun 15 22:20:37 2004
@@ -861,7 +861,9 @@
 #define AIROGMICRID		11
 #define AIROGMICSTATS		12
 #define AIROGFLAGS		13
+#define AIROGID			14
 #define AIRORRID		15
+#define AIRORSWVERSION		17
 
 /* Leave gap of 40 commands after AIROGSTATSD32 for future */
 
@@ -892,10 +894,13 @@
 #define AUXMEMSIZE	(256 * 1024)
 
 typedef struct aironet_ioctl {
-	unsigned short command;	// What to do
+	unsigned short command;		// What to do
 	unsigned short len;		// Len of data
-	unsigned char *data;		// d-data
+	unsigned short ridnum;		// rid number
+	unsigned char __user *data;	// d-data
 } aironet_ioctl;
+
+static char *swversion = "2.1";
 #endif /* CISCO_EXT */
 
 #define NUM_MODULES       2
@@ -1097,6 +1102,7 @@
 static int mpi_send_packet (struct net_device *dev);
 static void mpi_unmap_card(struct pci_dev *pci);
 static void mpi_receive_802_3(struct airo_info *ai);
+static void mpi_receive_802_11(struct airo_info *ai);
 static int waitbusy (struct airo_info *ai);
 
 static irqreturn_t airo_interrupt( int irq, void* dev_id, struct pt_regs
@@ -2451,17 +2457,19 @@
 	cmd.parm0 = FID_TX;
 	cmd.parm1 = (ai->txfids[0].card_ram_off - ai->pciaux);
 	cmd.parm2 = MPI_MAX_FIDS;
-	rc=issuecommand(ai, &cmd, &rsp);
-	if (rc != SUCCESS) {
-		printk(KERN_ERR "airo:  Couldn't allocate TX FID\n");
-		return rc;
-	}
 
 	for (i=0; i<MPI_MAX_FIDS; i++) {
 		ai->txfids[i].tx_desc.valid = 1;
 		memcpy((char *)ai->txfids[i].card_ram_off,
 			&ai->txfids[i].tx_desc, sizeof(TxFid));
 	}
+	ai->txfids[i-1].tx_desc.eoc = 1; /* Last descriptor has EOC set */
+
+	rc=issuecommand(ai, &cmd, &rsp);
+	if (rc != SUCCESS) {
+		printk(KERN_ERR "airo:  Couldn't allocate TX FID\n");
+		return rc;
+	}
 
 	/* Alloc card Rid descriptor */
 	memset(&rsp,0,sizeof(rsp));
@@ -2653,7 +2661,7 @@
 	return dev;
 }
 
-int reset_mpi_card( struct net_device *dev , int lock) {
+int reset_card( struct net_device *dev , int lock) {
 	struct airo_info *ai = dev->priv;
 
 	if (lock && down_interruptible(&ai->sem))
@@ -2737,9 +2745,6 @@
 		SET_NETDEV_DEV(dev, &pci->dev);
 	}
 
-	if (test_bit(FLAG_MPI,&ai->flags))
-		reset_mpi_card (dev, 1);
-
 	rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev );
 	if (rc) {
 		printk(KERN_ERR "airo: register interrupt %d failed, rc %d\n", irq, rc );
@@ -2776,8 +2781,7 @@
 		printk(KERN_ERR "airo: Couldn't register_netdev\n");
 		goto err_out_map;
 	}
-	if (!test_bit(FLAG_MPI,&ai->flags))
-		ai->wifidev = init_wifidev(ai, dev);
+	ai->wifidev = init_wifidev(ai, dev);
 
 	set_bit(FLAG_REGISTERED,&ai->flags);
 	printk( KERN_INFO "airo: MAC enabled %s %x:%x:%x:%x:%x:%x\n",
@@ -2840,7 +2844,7 @@
 	int i;
 	struct airo_info *ai = dev->priv;
 
-	if (reset_mpi_card (dev, 1))
+	if (reset_card (dev, 1))
 		return -1;
 
 	if ( setup_card(ai, dev->dev_addr, 1 ) != SUCCESS ) {
@@ -3101,7 +3105,10 @@
 			u16 *buffer;
 
 			if (test_bit(FLAG_MPI,&apriv->flags)) {
-				mpi_receive_802_3(apriv);
+				if (test_bit(FLAG_802_11, &apriv->flags))
+					mpi_receive_802_11(apriv);
+				else
+					mpi_receive_802_3(apriv);
 				OUT4500(apriv, EVACK, EV_RX);
 				goto exitrx;
 			}
@@ -3483,6 +3490,112 @@
 	}
 }
 
+void mpi_receive_802_11 (struct airo_info *ai)
+{
+	RxFid rxd;
+	struct sk_buff *skb = NULL;
+	u16 fc, len, hdrlen = 0;
+#pragma pack(1)
+	struct {
+		u16 status, len;
+		u8 rssi[2];
+		u8 rate;
+		u8 freq;
+		u16 tmp[4];
+	} hdr;
+#pragma pack()
+	u16 gap;
+	u16 *buffer;
+	char *ptr = ai->rxfids[0].virtual_host_addr+4;
+
+	memcpy ((char *)&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd));
+	memcpy ((char *)&hdr, ptr, sizeof(hdr));
+	ptr += sizeof(hdr);
+	/* Bad CRC. Ignore packet */
+	if (le16_to_cpu(hdr.status) & 2)
+		hdr.len = 0;
+	if (ai->wifidev == NULL)
+		hdr.len = 0;
+	len = le16_to_cpu(hdr.len);
+	if (len > 2312) {
+		printk( KERN_ERR "airo: Bad size %d\n", len );
+		goto badrx;
+	}
+	if (len == 0)
+		goto badrx;
+
+	memcpy ((char *)&fc, ptr, sizeof(fc));
+	fc = le16_to_cpu(fc);
+	switch (fc & 0xc) {
+		case 4:
+			if ((fc & 0xe0) == 0xc0)
+				hdrlen = 10;
+			else
+				hdrlen = 16;
+			break;
+		case 8:
+			if ((fc&0x300)==0x300){
+				hdrlen = 30;
+				break;
+			}
+		default:
+			hdrlen = 24;
+	}
+
+	skb = dev_alloc_skb( len + hdrlen + 2 );
+	if ( !skb ) {
+		ai->stats.rx_dropped++;
+		goto badrx;
+	}
+	buffer = (u16*)skb_put (skb, len + hdrlen);
+	memcpy ((char *)buffer, ptr, hdrlen);
+	ptr += hdrlen;
+	if (hdrlen == 24)
+		ptr += 6;
+	memcpy ((char *)&gap, ptr, sizeof(gap));
+	ptr += sizeof(gap);
+	gap = le16_to_cpu(gap);
+	if (gap) {
+		if (gap <= 8)
+			ptr += gap;
+		else
+			printk(KERN_ERR
+			    "airo: gaplen too big. Problems will follow...\n");
+	}
+	memcpy ((char *)buffer + hdrlen, ptr, len);
+	ptr += len;
+#ifdef IW_WIRELESS_SPY	  /* defined in iw_handler.h */
+	if (ai->spy_data.spy_number > 0) {
+		char *sa;
+		struct iw_quality wstats;
+		/* Prepare spy data : addr + qual */
+		sa = (char*)buffer + 10;
+		wstats.qual = hdr.rssi[0];
+		if (ai->rssi)
+			wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm;
+		else
+			wstats.level = (hdr.rssi[1] + 321) / 2;
+		wstats.updated = 3;
+		/* Update spy records */
+		wireless_spy_update(ai->dev, sa, &wstats);
+	}
+#endif /* IW_WIRELESS_SPY */
+	skb->mac.raw = skb->data;
+	skb->pkt_type = PACKET_OTHERHOST;
+	skb->dev = ai->wifidev;
+	skb->protocol = htons(ETH_P_802_2);
+	skb->dev->last_rx = jiffies;
+	skb->ip_summed = CHECKSUM_NONE;
+	netif_rx( skb );
+badrx:
+	if (rxd.valid == 0) {
+		rxd.valid = 1;
+		rxd.rdy = 0;
+		rxd.len = PKTSIZE;
+		memcpy (ai->rxfids[0].card_ram_off, (char *)&rxd, sizeof(rxd));
+	}
+}
+
 static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
 {
 	Cmd cmd;
@@ -3550,10 +3663,16 @@
 		status = readCapabilityRid(ai, &cap_rid, lock);
 		if ( status != SUCCESS ) return ERROR;
 
+		/*
+		 * This driver supports MPI350 firmwares up to, and
+		 * including 5.30.17
+		 */
 		if (test_bit(FLAG_MPI, &ai->flags) &&
-		    strcmp (cap_rid.prodVer, "5.00.01") &&
-		    strcmp (cap_rid.prodVer, "5.00.03") &&
-		    strcmp (cap_rid.prodVer, "5b00.08"))
+		    strncmp (cap_rid.prodVer, "5.00.", 5) &&
+		    strncmp (cap_rid.prodVer, "5b00.", 5) &&
+		    strncmp (cap_rid.prodVer, "5.02.", 5) &&
+		    strncmp (cap_rid.prodVer, "5.20.", 5) &&
+		    strncmp (cap_rid.prodVer, "5.30.", 5))
 			printk(KERN_ERR "airo: Firmware version %s is not supported. Use it at your own risk!\n", cap_rid.prodVer);
 
 		status = PC4500_readrid(ai,RID_RSSI,&rssi_rid,sizeof(rssi_rid),lock);
@@ -3934,7 +4053,7 @@
 		memset(&rsp, 0, sizeof(rsp));
 
 		ai->config_desc.rid_desc.valid = 1;
-		ai->config_desc.rid_desc.len = RIDSIZE;
+		ai->config_desc.rid_desc.len = *((u16 *)pBuf);
 		ai->config_desc.rid_desc.rid = 0;
 
 		cmd.cmd = CMD_WRITERID;
@@ -4153,12 +4272,12 @@
  */
 
 static ssize_t proc_read( struct file *file,
-			  char *buffer,
+			  char __user *buffer,
 			  size_t len,
 			  loff_t *offset);
 
 static ssize_t proc_write( struct file *file,
-			   const char *buffer,
+			   const char __user *buffer,
 			   size_t len,
 			   loff_t *offset );
 static int proc_close( struct inode *inode, struct file *file );
@@ -4363,23 +4482,26 @@
  *  to supply the data.
  */
 static ssize_t proc_read( struct file *file,
-			  char *buffer,
+			  char __user *buffer,
 			  size_t len,
 			  loff_t *offset )
 {
-	int i;
-	int pos;
+	loff_t pos = *offset;
 	struct proc_data *priv = (struct proc_data*)file->private_data;
 
-	if( !priv->rbuffer ) return -EINVAL;
+	if (!priv->rbuffer)
+		return -EINVAL;
 
-	pos = *offset;
-	for( i = 0; i+pos < priv->readlen && i < len; i++ ) {
-		if (put_user( priv->rbuffer[i+pos], buffer+i ))
-			return -EFAULT;
-	}
-	*offset += i;
-	return i;
+	if (pos < 0)
+		return -EINVAL;
+	if (pos >= priv->readlen)
+		return 0;
+	if (len > priv->readlen - pos)
+		len = priv->readlen - pos;
+	if (copy_to_user(buffer, priv->rbuffer + pos, len))
+		return -EFAULT;
+	*offset = pos + len;
+	return len;
 }
 
 /*
@@ -4387,28 +4509,26 @@
  *  to supply the data.
  */
 static ssize_t proc_write( struct file *file,
-			   const char *buffer,
+			   const char __user *buffer,
 			   size_t len,
 			   loff_t *offset )
 {
-	int i;
-	int pos;
+	loff_t pos = *offset;
 	struct proc_data *priv = (struct proc_data*)file->private_data;
 
-	if ( !priv->wbuffer ) {
+	if (!priv->wbuffer)
 		return -EINVAL;
-	}
-
-	pos = *offset;
 
-	for( i = 0; i + pos <  priv->maxwritelen &&
-		     i < len; i++ ) {
-		if (get_user( priv->wbuffer[i+pos], buffer + i ))
-			return -EFAULT;
-	}
-	if ( i+pos > priv->writelen ) priv->writelen = i+file->f_pos;
-	*offset += i;
-	return i;
+	if (pos < 0)
+		return -EINVAL;
+	if (pos >= priv->maxwritelen)
+		return 0;
+	if (len > priv->maxwritelen - pos)
+		len = priv->maxwritelen - pos;
+	if (copy_from_user(priv->wbuffer + pos, buffer, len))
+		return -EFAULT;
+	*offset = pos + len;
+	return len;
 }
 
 static int proc_status_open( struct inode *inode, struct file *file ) {
@@ -5378,7 +5498,6 @@
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct airo_info *ai = dev->priv;
 	Resp rsp;
-	int err;
 
 	printk(KERN_DEBUG "%s: airo_mpi waking up\n", dev->name);
 
@@ -5386,13 +5505,6 @@
 		return 0;
 
 	if (ai->power > 1) {
-		err = reset_mpi_card(dev, 0);
-		if (err) {
-			printk(KERN_ERR "%s: Error %d resetting on %s()\n",
-			       dev->name, err, __FUNCTION__);
-			return err;
-		}
-		schedule_timeout (HZ/2);
 		mpi_init_descriptors(ai);
 		setup_card(ai, dev->dev_addr, 0);
 		clear_bit(FLAG_RADIO_OFF, &ai->flags);
@@ -6786,7 +6898,10 @@
 
 		readAPListRid(local, &APList_rid);
 		readSsidRid(local, &SSID_rid);
-		reset_airo_card(dev);
+		if (test_bit(FLAG_MPI,&local->flags))
+			setup_card(local, dev->dev_addr, 1 );
+		else
+			reset_airo_card(dev);
 		disable_MAC(local, 1);
 		writeSsidRid(local, &SSID_rid, 1);
 		writeAPListRid(local, &APList_rid, 1);
@@ -6946,9 +7061,15 @@
 
 		/* Separate R/W functions bracket legality here
 		 */
-		if ( com.command <= AIRORRID )
+		if ( com.command == AIRORSWVERSION ) {
+			if (copy_to_user(com.data, swversion, sizeof(swversion)))
+				rc = -EFAULT;
+			else
+				rc = 0;
+		}
+		else if ( com.command <= AIRORRID)
 			rc = readrids(dev,&com);
-		else if ( com.command >= AIROPCAP && com.command <= AIROPLEAPUSR )
+		else if ( com.command >= AIROPCAP && com.command <= (AIROPLEAPUSR+2) )
 			rc = writerids(dev,&com);
 		else if ( com.command >= AIROFLSHRST && com.command <= AIRORESTART )
 			rc = flashcard(dev,&com);
@@ -7078,7 +7199,7 @@
 			return -EFAULT;
 		return 0;
 #endif
-	case AIRORRID:      ridcode = comp->len;        break;
+	case AIRORRID:      ridcode = comp->ridnum;     break;
 	default:
 		return -EINVAL;
 		break;
@@ -7092,10 +7213,7 @@
 	 * then return it to the user
 	 * 9/22/2000 Honor user given length
 	 */
-	if (comp->command == AIRORRID)
-		len = le16_to_cpu(*(unsigned short *)iobuf); /* Yuck! */
-	else
-		len = comp->len;
+	len = comp->len;
 
 	if (copy_to_user(comp->data, iobuf, min(len, (int)RIDSIZE))) {
 		kfree (iobuf);
@@ -7141,6 +7259,8 @@
 	case AIROPLEAPPWD:  ridcode = RID_LEAPPASSWORD; break;
 	case AIROPWEPKEY:   ridcode = RID_WEP_TEMP; writer = PC4500_writerid;
 		break;
+	case AIROPLEAPUSR+1: ridcode = 0xFF2A;          break;
+	case AIROPLEAPUSR+2: ridcode = 0xFF2B;          break;
 
 		/* this is not really a rid but a command given to the card
 		 * same with MAC off
diff -Nru a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h
--- a/drivers/net/wireless/hermes.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/wireless/hermes.h	Tue Jun 15 22:20:36 2004
@@ -384,7 +384,7 @@
 
 static inline void hermes_write_words(struct hermes *hw, int off, const void *buf, unsigned count)
 {
-	off = off << hw->reg_spacing;;
+	off = off << hw->reg_spacing;
 
 	if (hw->io_space) {
 		outsw(hw->iobase + off, buf, count);
@@ -406,7 +406,7 @@
 {
 	unsigned i;
 
-	off = off << hw->reg_spacing;;
+	off = off << hw->reg_spacing;
 
 	if (hw->io_space) {
 		for (i = 0; i < count; i++)
diff -Nru a/drivers/net/wireless/orinoco_pci.c b/drivers/net/wireless/orinoco_pci.c
--- a/drivers/net/wireless/orinoco_pci.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/wireless/orinoco_pci.c	Tue Jun 15 22:20:42 2004
@@ -102,7 +102,6 @@
 #include <linux/wireless.h>
 #include <linux/list.h>
 #include <linux/pci.h>
-#include <linux/wireless.h>
 #include <linux/fcntl.h>
 
 #include <asm/uaccess.h>
diff -Nru a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c
--- a/drivers/net/wireless/orinoco_plx.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/wireless/orinoco_plx.c	Tue Jun 15 22:21:03 2004
@@ -125,7 +125,6 @@
 #include <linux/wireless.h>
 #include <linux/list.h>
 #include <linux/pci.h>
-#include <linux/wireless.h>
 #include <linux/fcntl.h>
 
 #include <pcmcia/cisreg.h>
diff -Nru a/drivers/net/wireless/orinoco_tmd.c b/drivers/net/wireless/orinoco_tmd.c
--- a/drivers/net/wireless/orinoco_tmd.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/wireless/orinoco_tmd.c	Tue Jun 15 22:20:37 2004
@@ -69,7 +69,6 @@
 #include <linux/wireless.h>
 #include <linux/list.h>
 #include <linux/pci.h>
-#include <linux/wireless.h>
 #include <linux/fcntl.h>
 
 #include <pcmcia/cisreg.h>
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	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/wireless/prism54/isl_38xx.c	Tue Jun 15 22:20:40 2004
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_38xx.c,v 1.22 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003-2004 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>_
diff -Nru a/drivers/net/wireless/prism54/isl_38xx.h b/drivers/net/wireless/prism54/isl_38xx.h
--- a/drivers/net/wireless/prism54/isl_38xx.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/net/wireless/prism54/isl_38xx.h	Tue Jun 15 22:21:05 2004
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_38xx.h,v 1.22 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *
diff -Nru a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
--- a/drivers/net/wireless/prism54/isl_ioctl.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/net/wireless/prism54/isl_ioctl.c	Tue Jun 15 22:20:38 2004
@@ -1,7 +1,7 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.c,v 1.140 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
- *            (C) 2003 Aurelien Alleaume <slts@free.fr>
+ *            (C) 2003,2004 Aurelien Alleaume <slts@free.fr>
  *            (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
  *            (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
  *
@@ -87,9 +87,9 @@
 
 	/* For now, just catch early the Repeater and Secondary modes here */
 	if (iw_mode == IW_MODE_REPEAT || iw_mode == IW_MODE_SECOND) {
-		printk(KERN_DEBUG "%s(): Sorry, Repeater mode and Secondary mode "
-				"are not yet supported by this driver.\n",
-		       __FUNCTION__);
+		printk(KERN_DEBUG
+		       "%s(): Sorry, Repeater mode and Secondary mode "
+		       "are not yet supported by this driver.\n", __FUNCTION__);
 		return -EINVAL;
 	}
 
@@ -143,8 +143,8 @@
 {
 	u32 t;
 	struct obj_buffer psm_buffer = {
-		.size = cpu_to_le32(PSM_BUFFER_SIZE),
-		.addr = cpu_to_le32(priv->device_psm_buffer)
+		.size = PSM_BUFFER_SIZE,
+		.addr = priv->device_psm_buffer
 	};
 
 	mgt_set(priv, DOT11_OID_CHANNEL, &init_channel);
@@ -285,7 +285,7 @@
 	/* Commit in Monitor mode is not necessary, also setting essid
 	 * in Monitor mode does not make sense and isn't allowed for this
 	 * device's firmware */
-	if(priv->iw_mode != IW_MODE_MONITOR)
+	if (priv->iw_mode != IW_MODE_MONITOR)
 		return mgt_set_request(priv, DOT11_OID_SSID, 0, NULL);
 	return 0;
 }
@@ -327,34 +327,15 @@
 {
 	islpci_private *priv = netdev_priv(ndev);
 	int rvalue;
-	u32 c = 0;
+	u32 c;
 
-	/* prepare the structure for the set object */
 	if (fwrq->m < 1000)
-		/* structure value contains a channel indication */
+		/* we have a channel number */
 		c = fwrq->m;
-	else {
-		/* structure contains a frequency indication and fwrq->e = 1 */
-		int f = fwrq->m / 100000;
-
-		if (fwrq->e != 1)
-			return -EINVAL;
-		if ((f >= 2412) && (f <= 2484)) {
-			while ((c < 14) && (f != frequency_list_bg[c]))
-				c++;
-			if (c >= 14)
-				return -EINVAL;
-		} else if ((f >= (int) 5170) && (f <= (int) 5320)) {
-			while ((c < 12) && (f != frequency_list_a[c]))
-				c++;
-			if (c >= 12)
-				return -EINVAL;
-		} else
-			return -EINVAL;
-		c++;
-	}
+	else
+		c = (fwrq->e == 1) ? channel_of_freq(fwrq->m / 100000) : 0;
 
-	rvalue = mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c);
+	rvalue = c ? mgt_set_request(priv, DOT11_OID_CHANNEL, 0, &c) : -EINVAL;
 
 	/* Call commit handler */
 	return (rvalue ? rvalue : -EINPROGRESS);
@@ -410,7 +391,7 @@
 
 	mgt_commit(priv);
 	priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR)
-	    ? ARPHRD_IEEE80211 : ARPHRD_ETHER;
+	    ? priv->monitor_type : ARPHRD_ETHER;
 	up_write(&priv->mib_sem);
 
 	return 0;
@@ -531,20 +512,20 @@
 	    mgt_get_request(priv, DOT11_OID_SUPPORTEDFREQUENCIES, 0, NULL, &r);
 	freq = r.ptr;
 
-	range->num_channels = le16_to_cpu(freq->nr);
-	range->num_frequency = le16_to_cpu(freq->nr);
+	range->num_channels = freq->nr;
+	range->num_frequency = freq->nr;
 
 	/* Frequencies are not listed in the right order. The reordering is probably
 	 * firmware dependant and thus should work for everyone.
 	 */
-	m = min(IW_MAX_FREQUENCIES, (int) le16_to_cpu(freq->nr));
+	m = min(IW_MAX_FREQUENCIES, (int) freq->nr);
 	for (i = 0; i < m - 12; i++) {
-		range->freq[i].m = le16_to_cpu(freq->mhz[12 + i]);
+		range->freq[i].m = freq->mhz[12 + i];
 		range->freq[i].e = 6;
 		range->freq[i].i = i + 1;
 	}
 	for (i = m - 12; i < m; i++) {
-		range->freq[i].m = le16_to_cpu(freq->mhz[i - m + 12]);
+		range->freq[i].m = freq->mhz[i - m + 12];
 		range->freq[i].e = 6;
 		range->freq[i].i = i + 23;
 	}
@@ -655,7 +636,7 @@
 #define CAP_CRYPT 0x10
 
 	/* Mode */
-	cap = le16_to_cpu(bss->capinfo);
+	cap = bss->capinfo;
 	iwe.u.mode = 0;
 	if (cap & CAP_ESS)
 		iwe.u.mode = IW_MODE_MASTER;
@@ -747,7 +728,7 @@
 	bsslist = r.ptr;
 
 	/* ok now, scan the list and translate its info */
-	for (i = 0; i < min(IW_MAX_AP, (int) le32_to_cpu(bsslist->nr)); i++)
+	for (i = 0; i < min(IW_MAX_AP, (int) bsslist->nr); i++)
 		current_ev = prism54_translate_bss(ndev, current_ev,
 						   extra + IW_SCAN_MAX_DATA,
 						   &(bsslist->bsslist[i]),
@@ -869,25 +850,26 @@
 		return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
 	}
 	
-	if((ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r)))
+	if ((ret =
+	     mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r)))
 		return ret;
 		
 	rate = (u32) (vwrq->value / 500000);
 	data = r.ptr;
 	i = 0;
 	
-	while(data[i]) {
-		if(rate && (data[i] == rate)) {
+	while (data[i]) {
+		if (rate && (data[i] == rate)) {
 			break;
 		}
-		if(vwrq->value == i) {
+		if (vwrq->value == i) {
 			break;
 		}
 		data[i] |= 0x80;
 		i++;
 	}
 		
-	if(!data[i]) {
+	if (!data[i]) {
 		return -EINVAL;
 	}
 	
@@ -931,12 +913,12 @@
 	union oid_res_t r;
 
 	/* Get the current bit rate */
-	if((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r)))
+	if ((rvalue = mgt_get_request(priv, GEN_OID_LINKSTATE, 0, NULL, &r)))
 		return rvalue;
 	vwrq->value = r.u * 500000;
 
 	/* request the device for the enabled rates */
-	if((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r)))
+	if ((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r)))
 		return rvalue;
 	data = r.ptr;
 	vwrq->fixed = (data[0] != 0) && (data[1] == 0);
@@ -1225,7 +1207,7 @@
 
 	rvalue = mgt_get_request(priv, OID_INL_OUTPUTPOWER, 0, NULL, &r);
 	/* intersil firmware operates in 0.25 dBm (1/4 dBm) */
-	vwrq->value = (s32)r.u / 4;
+	vwrq->value = (s32) r.u / 4;
 	vwrq->fixed = 1;
 	/* radio is not turned of
 	 * btw: how is possible to turn off only the radio 
@@ -1271,28 +1253,41 @@
 }
 
 static int
-prism54_set_beacon(struct net_device *ndev, struct iw_request_info *info,
-		   __u32 * uwrq, char *extra)
+prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
+		struct iw_point *dwrq, char *extra)
 {
-	int rvalue = mgt_set_request((islpci_private *) netdev_priv(ndev),
-				     DOT11_OID_BEACONPERIOD, 0, uwrq);
+	union oid_res_t r;
+	int rvalue;
+	enum oid_num_t n = dwrq->flags;
 
-	return (rvalue ? rvalue : -EINPROGRESS);
+	rvalue = mgt_get_request((islpci_private *) ndev->priv, n, 0, NULL, &r);
+	dwrq->length = mgt_response_to_str(n, &r, extra);
+	if ((isl_oid[n].flags & OID_FLAG_TYPE) != OID_TYPE_U32)
+		kfree(r.ptr);
+	return rvalue;
 }
 
 static int
-prism54_get_beacon(struct net_device *ndev, struct iw_request_info *info,
+prism54_set_u32(struct net_device *ndev, struct iw_request_info *info,
 		   __u32 * uwrq, char *extra)
 {
-	union oid_res_t r;
-	int rvalue;
+	/*
+	   u32 *i = (int *) extra;
+	   int param = *i;
+	   int u = *(i + 1);
+	 */
+	u32 oid = uwrq[0], u = uwrq[1];
 
-	rvalue =
-	    mgt_get_request((islpci_private *) netdev_priv(ndev),
-			    DOT11_OID_BEACONPERIOD, 0, NULL, &r);
-	*uwrq = r.u;
+	return mgt_set_request((islpci_private *) ndev->priv, oid, 0, &u);
+}
 
-	return rvalue;
+static int
+prism54_set_raw(struct net_device *ndev, struct iw_request_info *info,
+		struct iw_point *dwrq, char *extra)
+{
+	u32 oid = dwrq->flags;
+
+	return mgt_set_request((islpci_private *) ndev->priv, oid, 0, extra);
 }
 
 void
@@ -1511,8 +1506,9 @@
 		return -ENOMEM;
 
 	/* Tell the card to kick every client */
-	mlme->id = cpu_to_le16(0);
-	rvalue = mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
+	mlme->id = 0;
+	rvalue =
+	    mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
 	kfree(mlme);
 
 	return rvalue;
@@ -1535,8 +1531,9 @@
 
 	/* Tell the card to only kick the corresponding bastard */
 	memcpy(mlme->address, addr->sa_data, ETH_ALEN);
-	mlme->id = cpu_to_le16(-1);
-	rvalue = mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
+	mlme->id = -1;
+	rvalue =
+	    mgt_set_request(netdev_priv(ndev), DOT11_OID_DISASSOCIATE, 0, mlme);
 
 	kfree(mlme);
 
@@ -1551,12 +1548,12 @@
 {
 	const u8 *a = mlme->address;
 	int n = snprintf(dest, IW_CUSTOM_MAX,
-			 "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s",
+			 "%s %s %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X %s (%2.2X)",
 			 str,
-			 ((priv->iw_mode == IW_MODE_MASTER) ? "to" : "from"),
+			 ((priv->iw_mode == IW_MODE_MASTER) ? "from" : "to"),
 			 a[0], a[1], a[2], a[3], a[4], a[5],
 			 (error ? (mlme->code ? " : REJECTED " : " : ACCEPTED ")
-			  : ""));
+			  : ""), mlme->code);
 	BUG_ON(n > IW_CUSTOM_MAX);
 	*length = n;
 }
@@ -1598,14 +1595,15 @@
 {
 	islpci_private *priv = netdev_priv(ndev);
 
-	if (le32_to_cpu(bitrate)) {
+	if (bitrate) {
 		if (priv->iw_mode == IW_MODE_INFRA) {
 			union iwreq_data uwrq;
 			prism54_get_wap(ndev, NULL, (struct sockaddr *) &uwrq,
 					NULL);
 			wireless_send_event(ndev, SIOCGIWAP, &uwrq, NULL);
 		} else
-			send_simple_event(netdev_priv(ndev), "Link established");
+			send_simple_event(netdev_priv(ndev),
+					  "Link established");
 	} else
 		send_simple_event(netdev_priv(ndev), "Link lost");
 }
@@ -1765,15 +1763,14 @@
 static void
 handle_request(islpci_private *priv, struct obj_mlme *mlme, enum oid_num_t oid)
 {
-	if (((le16_to_cpu(mlme->state) == DOT11_STATE_AUTHING) ||
-	     (le16_to_cpu(mlme->state) == DOT11_STATE_ASSOCING))
+	if (((mlme->state == DOT11_STATE_AUTHING) ||
+	     (mlme->state == DOT11_STATE_ASSOCING))
 	    && mgt_mlme_answer(priv)) {
 		/* Someone is requesting auth and we must respond. Just send back
 		 * the trap with error code set accordingly.
 		 */
-		mlme->code = cpu_to_le16(prism54_mac_accept(&priv->acl,
-							    mlme->
-							    address) ? 0 : 1);
+		mlme->code = prism54_mac_accept(&priv->acl,
+						mlme->address) ? 0 : 1;
 		mgt_set_request(priv, oid, 0, mlme);
 	}
 }
@@ -1797,6 +1794,13 @@
 	 * suited. We use the more flexible custom event facility.
 	 */
 
+	/* I fear prism54_process_bss_data won't work with big endian data */
+	if ((oid == DOT11_OID_BEACON) || (oid == DOT11_OID_PROBE))
+		prism54_process_bss_data(priv, oid, mlme->address,
+					 payload, len);
+
+	mgt_le_to_cpu(isl_oid[oid].flags & OID_FLAG_TYPE, (void *) mlme);
+
 	switch (oid) {
 
 	case GEN_OID_LINKSTATE:
@@ -1831,8 +1835,6 @@
 		break;
 
 	case DOT11_OID_BEACON:
-		prism54_process_bss_data(priv, oid, mlme->address,
-					 payload, len);
 		send_formatted_event(priv,
 				     "Received a beacon from an unkown AP",
 				     mlme, 0);
@@ -1840,8 +1842,6 @@
 
 	case DOT11_OID_PROBE:
 		/* we received a probe from a client. */
-		prism54_process_bss_data(priv, oid, mlme->address,
-					 payload, len);
 		send_formatted_event(priv, "Received a probe from client", mlme,
 				     0);
 		break;
@@ -1915,13 +1915,6 @@
 }
 
 int
-prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
-{
-	/* should we really support this old stuff ? */
-	return -EOPNOTSUPP;
-}
-
-int
 prism54_set_wpa(struct net_device *ndev, struct iw_request_info *info,
 		__u32 * uwrq, char *extra)
 {
@@ -1951,8 +1944,30 @@
 }
 
 int
+prism54_set_prismhdr(struct net_device *ndev, struct iw_request_info *info,
+		     __u32 * uwrq, char *extra)
+{
+	islpci_private *priv = netdev_priv(ndev);
+	priv->monitor_type =
+	    (*uwrq ? ARPHRD_IEEE80211_PRISM : ARPHRD_IEEE80211);
+	if (priv->iw_mode == IW_MODE_MONITOR)
+		priv->ndev->type = priv->monitor_type;
+
+	return 0;
+}
+
+int
+prism54_get_prismhdr(struct net_device *ndev, struct iw_request_info *info,
+		     __u32 * uwrq, char *extra)
+{
+	islpci_private *priv = netdev_priv(ndev);
+	*uwrq = (priv->monitor_type == ARPHRD_IEEE80211_PRISM);
+	return 0;
+}
+
+int
 prism54_set_maxframeburst(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+			  __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	u32 max_burst;
@@ -1965,7 +1980,7 @@
 
 int
 prism54_get_maxframeburst(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+			  __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	union oid_res_t r;
@@ -1979,7 +1994,7 @@
 
 int
 prism54_set_profile(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+		    __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	u32 profile;
@@ -1992,7 +2007,7 @@
 
 int
 prism54_get_profile(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+		    __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	union oid_res_t r;
@@ -2005,8 +2020,8 @@
 }
 
 int
-prism54_oid(struct net_device *ndev, struct iw_request_info *info,
-		__u32 *uwrq, char *extra)
+prism54_debug_oid(struct net_device *ndev, struct iw_request_info *info,
+		  __u32 * uwrq, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	
@@ -2017,7 +2032,7 @@
 }
 
 int
-prism54_get_oid(struct net_device *ndev, struct iw_request_info *info,
+prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info,
 		struct iw_point *data, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
@@ -2028,11 +2043,15 @@
 	data->length = 0;
 	
 	if (islpci_get_state(priv) >= PRV_STATE_INIT) {
-		ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET, priv->priv_oid, extra, 256, &response);
+		ret =
+		    islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET,
+					   priv->priv_oid, extra, 256,
+					   &response);
 		response_op = response->header->operation;
 		printk("%s: ret: %i\n", ndev->name, ret);
 		printk("%s: response_op: %i\n", ndev->name, response_op);
-		if (ret || !response || response->header->operation == PIMFOR_OP_ERROR) {
+		if (ret || !response
+		    || response->header->operation == PIMFOR_OP_ERROR) {
 			if (response) {
 				islpci_mgt_release(response);
 			}
@@ -2051,21 +2070,26 @@
 }
 
 int
-prism54_set_oid(struct net_device *ndev, struct iw_request_info *info,
+prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info,
 		struct iw_point *data, char *extra)
 {
 	islpci_private *priv = netdev_priv(ndev);
 	struct islpci_mgmtframe *response = NULL;
 	int ret = 0, response_op = PIMFOR_OP_ERROR;
 	
-	printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid, data->length);
+	printk("%s: set_oid 0x%08X\tlen: %d\n", ndev->name, priv->priv_oid,
+	       data->length);
 	
 	if (islpci_get_state(priv) >= PRV_STATE_INIT) {
-		ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET, priv->priv_oid, extra, data->length, &response);
+		ret =
+		    islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET,
+					   priv->priv_oid, extra, data->length,
+					   &response);
 		printk("%s: ret: %i\n", ndev->name, ret);
 		if (!ret) {
 			response_op = response->header->operation;
-			printk("%s: response_op: %i\n", ndev->name, response_op);
+			printk("%s: response_op: %i\n", ndev->name,
+			       response_op);
 			islpci_mgt_release(response);
 		}
 		if (ret || response_op == PIMFOR_OP_ERROR) {
@@ -2077,6 +2101,31 @@
 	return ret;
 }
 
+static int
+prism54_set_spy(struct net_device *ndev,
+		struct iw_request_info *info,
+		union iwreq_data *uwrq, char *extra)
+{
+	islpci_private *priv = netdev_priv(ndev);
+	u32 u, oid = OID_INL_CONFIG;
+
+	down_write(&priv->mib_sem);
+	mgt_get(priv, OID_INL_CONFIG, &u);
+
+	if ((uwrq->data.length == 0) && (priv->spy_data.spy_number > 0))
+		/* disable spy */
+		u &= ~INL_CONFIG_RXANNEX;
+	else if ((uwrq->data.length > 0) && (priv->spy_data.spy_number == 0))
+		/* enable spy */
+		u |= INL_CONFIG_RXANNEX;
+
+	mgt_set(priv, OID_INL_CONFIG, &u);
+	mgt_commit_list(priv, &oid, 1);
+	up_write(&priv->mib_sem);
+
+	return iw_handler_set_spy(ndev, info, uwrq, extra);
+}
+
 static const iw_handler prism54_handler[] = {
 	(iw_handler) prism54_commit,	/* SIOCSIWCOMMIT */
 	(iw_handler) prism54_get_name,	/* SIOCGIWNAME */
@@ -2094,7 +2143,7 @@
 	(iw_handler) NULL,	/* SIOCGIWPRIV */
 	(iw_handler) NULL,	/* SIOCSIWSTATS */
 	(iw_handler) NULL,	/* SIOCGIWSTATS */
-	iw_handler_set_spy,	/* SIOCSIWSPY */
+	prism54_set_spy,	/* SIOCSIWSPY */
 	iw_handler_get_spy,	/* SIOCGIWSPY */
 	iw_handler_set_thrspy,	/* SIOCSIWTHRSPY */
 	iw_handler_get_thrspy,	/* SIOCGIWTHRSPY */
@@ -2129,33 +2178,50 @@
 /* The low order bit identify a SET (0) or a GET (1) ioctl.  */
 
 #define PRISM54_RESET		SIOCIWFIRSTPRIV
-#define PRISM54_GET_BEACON	SIOCIWFIRSTPRIV+1
-#define PRISM54_SET_BEACON	SIOCIWFIRSTPRIV+2
-#define PRISM54_GET_POLICY SIOCIWFIRSTPRIV+3
-#define PRISM54_SET_POLICY SIOCIWFIRSTPRIV+4
-#define PRISM54_GET_MAC 	   SIOCIWFIRSTPRIV+5
-#define PRISM54_ADD_MAC 	   SIOCIWFIRSTPRIV+6
+#define PRISM54_GET_POLICY	SIOCIWFIRSTPRIV+1
+#define PRISM54_SET_POLICY	SIOCIWFIRSTPRIV+2
+#define PRISM54_GET_MAC		SIOCIWFIRSTPRIV+3
+#define PRISM54_ADD_MAC		SIOCIWFIRSTPRIV+4
 
-#define PRISM54_DEL_MAC    SIOCIWFIRSTPRIV+8
+#define PRISM54_DEL_MAC		SIOCIWFIRSTPRIV+6
 
-#define PRISM54_KICK_MAC   SIOCIWFIRSTPRIV+10
+#define PRISM54_KICK_MAC	SIOCIWFIRSTPRIV+8
 
-#define PRISM54_KICK_ALL   SIOCIWFIRSTPRIV+12
+#define PRISM54_KICK_ALL	SIOCIWFIRSTPRIV+10
 
-#define PRISM54_GET_WPA	   SIOCIWFIRSTPRIV+13
-#define PRISM54_SET_WPA	   SIOCIWFIRSTPRIV+14
+#define PRISM54_GET_WPA		SIOCIWFIRSTPRIV+11
+#define PRISM54_SET_WPA		SIOCIWFIRSTPRIV+12
+
+#define PRISM54_DBG_OID		SIOCIWFIRSTPRIV+14
+#define PRISM54_DBG_GET_OID	SIOCIWFIRSTPRIV+15
+#define PRISM54_DBG_SET_OID	SIOCIWFIRSTPRIV+16
 
-#define PRISM54_OID	   SIOCIWFIRSTPRIV+16
 #define PRISM54_GET_OID	   SIOCIWFIRSTPRIV+17
-#define PRISM54_SET_OID	   SIOCIWFIRSTPRIV+18
+#define PRISM54_SET_OID_U32	SIOCIWFIRSTPRIV+18
+#define	PRISM54_SET_OID_STR	SIOCIWFIRSTPRIV+20
+#define	PRISM54_SET_OID_ADDR	SIOCIWFIRSTPRIV+22
+
+#define PRISM54_GET_PRISMHDR	SIOCIWFIRSTPRIV+23
+#define PRISM54_SET_PRISMHDR	SIOCIWFIRSTPRIV+24
+
+#define IWPRIV_SET_U32(n,x)	{ n, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
+#define IWPRIV_SET_SSID(n,x)	{ n, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
+#define IWPRIV_SET_ADDR(n,x)	{ n, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, "set_"x }
+#define IWPRIV_GET(n,x)	{ n, 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, "get_"x }
+
+#define IWPRIV_U32(n,x)		IWPRIV_SET_U32(n,x), IWPRIV_GET(n,x)
+#define IWPRIV_SSID(n,x)	IWPRIV_SET_SSID(n,x), IWPRIV_GET(n,x)
+#define IWPRIV_ADDR(n,x)	IWPRIV_SET_ADDR(n,x), IWPRIV_GET(n,x)
+
+/* Note : limited to 128 private ioctls */
 
 static const struct iw_priv_args prism54_private_args[] = {
 /*{ cmd, set_args, get_args, name } */
 	{PRISM54_RESET, 0, 0, "reset"},
-	{PRISM54_GET_BEACON, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-	 "getBeaconPeriod"},
-	{PRISM54_SET_BEACON, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
-	 "setBeaconPeriod"},
+	{PRISM54_GET_PRISMHDR, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+	 "get_prismhdr"},
+	{PRISM54_SET_PRISMHDR, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
+	 "set_prismhdr"},
 	{PRISM54_GET_POLICY, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
 	 "getPolicy"},
 	{PRISM54_SET_POLICY, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
@@ -2172,15 +2238,77 @@
 	 "get_wpa"},
 	{PRISM54_SET_WPA, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
 	 "set_wpa"},
-	{PRISM54_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "oid"},
-	{PRISM54_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "get_oid"},
-	{PRISM54_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "set_oid"},
+	{PRISM54_DBG_OID, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
+	 "dbg_oid"},
+	{PRISM54_DBG_GET_OID, 0, IW_PRIV_TYPE_BYTE | 256, "dbg_get_oid"},
+	{PRISM54_DBG_SET_OID, IW_PRIV_TYPE_BYTE | 256, 0, "dbg_get_oid"},
+	/* --- sub-ioctls handlers --- */
+	{PRISM54_GET_OID,
+	 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | PRIV_STR_SIZE, ""},
+	{PRISM54_SET_OID_U32,
+	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, ""},
+	{PRISM54_SET_OID_STR,
+	 IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
+	{PRISM54_SET_OID_ADDR,
+	 IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, 0, ""},
+	/* --- sub-ioctls definitions --- */
+	IWPRIV_ADDR(GEN_OID_MACADDRESS, "addr"),
+	IWPRIV_GET(GEN_OID_LINKSTATE, "linkstate"),
+	IWPRIV_U32(DOT11_OID_BSSTYPE, "bsstype"),
+	IWPRIV_ADDR(DOT11_OID_BSSID, "bssid"),
+	IWPRIV_U32(DOT11_OID_STATE, "state"),
+	IWPRIV_U32(DOT11_OID_AID, "aid"),
+
+	IWPRIV_SSID(DOT11_OID_SSIDOVERRIDE, "ssidoverride"),
+
+	IWPRIV_U32(DOT11_OID_MEDIUMLIMIT, "medlimit"),
+	IWPRIV_U32(DOT11_OID_BEACONPERIOD, "beacon"),
+	IWPRIV_U32(DOT11_OID_DTIMPERIOD, "dtimperiod"),
+
+	IWPRIV_U32(DOT11_OID_AUTHENABLE, "authenable"),
+	IWPRIV_U32(DOT11_OID_PRIVACYINVOKED, "privinvok"),
+	IWPRIV_U32(DOT11_OID_EXUNENCRYPTED, "exunencrypt"),
+	
+	IWPRIV_U32(DOT11_OID_REKEYTHRESHOLD, "rekeythresh"),
+
+	IWPRIV_U32(DOT11_OID_MAXTXLIFETIME, "maxtxlife"),
+	IWPRIV_U32(DOT11_OID_MAXRXLIFETIME, "maxrxlife"),
+	IWPRIV_U32(DOT11_OID_ALOFT_FIXEDRATE, "fixedrate"),
+	IWPRIV_U32(DOT11_OID_MAXFRAMEBURST, "frameburst"),
+	IWPRIV_U32(DOT11_OID_PSM, "psm"),
+
+	IWPRIV_U32(DOT11_OID_BRIDGELOCAL, "bridge"),
+	IWPRIV_U32(DOT11_OID_CLIENTS, "clients"),
+	IWPRIV_U32(DOT11_OID_CLIENTSASSOCIATED, "clientassoc"),
+	IWPRIV_U32(DOT11_OID_DOT1XENABLE, "dot1xenable"),
+	IWPRIV_U32(DOT11_OID_ANTENNARX, "rxant"),
+	IWPRIV_U32(DOT11_OID_ANTENNATX, "txant"),
+	IWPRIV_U32(DOT11_OID_ANTENNADIVERSITY, "antdivers"),
+	IWPRIV_U32(DOT11_OID_EDTHRESHOLD, "edthresh"),
+	IWPRIV_U32(DOT11_OID_PREAMBLESETTINGS, "preamble"),
+	IWPRIV_GET(DOT11_OID_RATES, "rates"),
+	IWPRIV_U32(DOT11_OID_OUTPUTPOWER, ".11outpower"),
+	IWPRIV_GET(DOT11_OID_SUPPORTEDRATES, "supprates"),
+	IWPRIV_GET(DOT11_OID_SUPPORTEDFREQUENCIES, "suppfreq"),
+
+	IWPRIV_U32(DOT11_OID_NOISEFLOOR, "noisefloor"),
+	IWPRIV_GET(DOT11_OID_FREQUENCYACTIVITY, "freqactivity"),
+	IWPRIV_U32(DOT11_OID_NONERPPROTECTION, "nonerpprotec"),
+	IWPRIV_U32(DOT11_OID_PROFILES, "profile"),
+	IWPRIV_GET(DOT11_OID_EXTENDEDRATES, "extrates"),
+	IWPRIV_U32(DOT11_OID_MLMEAUTOLEVEL, "mlmelevel"),
+
+	IWPRIV_GET(DOT11_OID_BSSS, "bsss"),
+	IWPRIV_GET(DOT11_OID_BSSLIST, "bsslist"),
+	IWPRIV_U32(OID_INL_MODE, "mode"),
+	IWPRIV_U32(OID_INL_CONFIG, "config"),
+	IWPRIV_U32(OID_INL_DOT11D_CONFORMANCE, ".11dconform"),
+	IWPRIV_GET(OID_INL_PHYCAPABILITIES, "phycapa"),
+	IWPRIV_U32(OID_INL_OUTPUTPOWER, "outpower"),
 };
 
 static const iw_handler prism54_private_handler[] = {
 	(iw_handler) prism54_reset,
-	(iw_handler) prism54_get_beacon,
-	(iw_handler) prism54_set_beacon,
 	(iw_handler) prism54_get_policy,
 	(iw_handler) prism54_set_policy,
 	(iw_handler) prism54_get_mac,
@@ -2194,9 +2322,17 @@
 	(iw_handler) prism54_get_wpa,
 	(iw_handler) prism54_set_wpa,
 	(iw_handler) NULL,
-	(iw_handler) prism54_oid,
+	(iw_handler) prism54_debug_oid,
+	(iw_handler) prism54_debug_get_oid,
+	(iw_handler) prism54_debug_set_oid,
 	(iw_handler) prism54_get_oid,
-	(iw_handler) prism54_set_oid,
+	(iw_handler) prism54_set_u32,
+	(iw_handler) NULL,
+	(iw_handler) prism54_set_raw,
+	(iw_handler) NULL,
+	(iw_handler) prism54_set_raw,
+	(iw_handler) prism54_get_prismhdr,
+	(iw_handler) prism54_set_prismhdr,
 };
 
 const struct iw_handler_def prism54_handler_def = {
@@ -2207,5 +2343,13 @@
 	.standard = (iw_handler *) prism54_handler,
 	.private = (iw_handler *) prism54_private_handler,
 	.private_args = (struct iw_priv_args *) prism54_private_args,
+	.spy_offset = offsetof(islpci_private, spy_data),
 };
 
+/* For ioctls that don't work with the new API */
+
+int
+prism54_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
+{
+	return -EOPNOTSUPP;
+}
diff -Nru a/drivers/net/wireless/prism54/isl_ioctl.h b/drivers/net/wireless/prism54/isl_ioctl.h
--- a/drivers/net/wireless/prism54/isl_ioctl.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/wireless/prism54/isl_ioctl.h	Tue Jun 15 22:20:41 2004
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/isl_ioctl.h,v 1.30 2004/01/30 16:24:00 ajfa Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *            (C) 2003 Aurelien Alleaume <slts@free.fr>
diff -Nru a/drivers/net/wireless/prism54/isl_oid.h b/drivers/net/wireless/prism54/isl_oid.h
--- a/drivers/net/wireless/prism54/isl_oid.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/wireless/prism54/isl_oid.h	Tue Jun 15 22:20:41 2004
@@ -1,8 +1,9 @@
 /*
- *  $Id: isl_oid.h,v 1.3 2004/03/09 09:05:27 mcgrof Exp $
+ *
  *  
  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
  *  Copyright (C) 2004 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
+ *  Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -457,16 +458,29 @@
 	OID_NUM_LAST
 };
 
-/* We  could add more flags. eg: in which mode are they allowed, ro, rw, ...*/
-#define OID_FLAG_CACHED	0x01
-#define OID_FLAG_U32	0x02
-#define OID_FLAG_MLMEEX	0x04	/* this type is special because of a variable
-				   size field when sending. Not yet implemented (not used in driver). */
+#define OID_FLAG_CACHED		0x80
+#define OID_FLAG_TYPE		0x7f
+
+#define OID_TYPE_U32		0x01
+#define OID_TYPE_SSID		0x02
+#define OID_TYPE_KEY		0x03
+#define OID_TYPE_BUFFER		0x04
+#define OID_TYPE_BSS		0x05
+#define OID_TYPE_BSSLIST	0x06
+#define OID_TYPE_FREQUENCIES	0x07
+#define OID_TYPE_MLME		0x08
+#define OID_TYPE_MLMEEX		0x09
+#define OID_TYPE_ADDR		0x0A
+#define OID_TYPE_RAW		0x0B
+
+/* OID_TYPE_MLMEEX is special because of a variable size field when sending.
+ * Not yet implemented (not used in driver anyway).
+ */
 
 struct oid_t {
 	enum oid_num_t oid;
 	short range;		/* to define a range of oid */
-	short size;		/* size of the associated data */
+	short size;		/* max size of the associated data */
 	char flags;
 };
 
@@ -478,6 +492,7 @@
 #define	IWMAX_BITRATES	20
 #define	IWMAX_BSS	24
 #define IWMAX_FREQ	30
+#define PRIV_STR_SIZE	1024
 
 #endif				/* !defined(_ISL_OID_H) */
 /* EOF */
diff -Nru a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c
--- a/drivers/net/wireless/prism54/islpci_dev.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/wireless/prism54/islpci_dev.c	Tue Jun 15 22:20:36 2004
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.c,v 1.68 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
@@ -715,9 +715,9 @@
 	priv = netdev_priv(ndev);
 	priv->ndev = ndev;
 	priv->pdev = pdev;
-
+	priv->monitor_type = ARPHRD_IEEE80211;
 	priv->ndev->type = (priv->iw_mode == IW_MODE_MONITOR) ?
-		ARPHRD_IEEE80211: ARPHRD_ETHER;
+		priv->monitor_type : ARPHRD_ETHER;
 
 	/* save the start and end address of the PCI memory area */
 	ndev->mem_start = (unsigned long) priv->device_base;
@@ -743,8 +743,10 @@
 	/* initialize workqueue's */
 	INIT_WORK(&priv->stats_work,
 		  (void (*)(void *)) prism54_update_stats, priv);
-
 	priv->stats_timestamp = 0;
+
+	INIT_WORK(&priv->reset_task, islpci_do_reset_and_wake, priv);
+	priv->reset_task_pending = 0;
 
 	/* allocate various memory areas */
 	if (islpci_alloc_memory(priv))
diff -Nru a/drivers/net/wireless/prism54/islpci_dev.h b/drivers/net/wireless/prism54/islpci_dev.h
--- a/drivers/net/wireless/prism54/islpci_dev.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/wireless/prism54/islpci_dev.h	Tue Jun 15 22:20:39 2004
@@ -1,8 +1,9 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_dev.h,v 1.53 2004/02/28 03:06:07 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc. 
  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
  *  Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
+ *  Copyright (C) 2003 Aurelien Alleaume <slts@free.fr>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -25,6 +26,7 @@
 #include <linux/version.h>
 #include <linux/netdevice.h>
 #include <linux/wireless.h>
+#include <net/iw_handler.h>
 #include <linux/list.h>
 
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
@@ -110,6 +112,10 @@
 	struct iw_statistics local_iwstatistics;
 	struct iw_statistics iwstatistics;
 
+	struct iw_spy_data spy_data; /* iwspy support */
+
+	int monitor_type; /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_PRISM */
+
 	struct islpci_acl acl;
 
 	/* PCI bus allocation & configuration members */
@@ -187,6 +193,9 @@
 	struct list_head bss_wpa_list;
 	int num_bss_wpa;
 	struct semaphore wpa_sem;
+
+	struct work_struct reset_task;
+	int reset_task_pending;
 } islpci_private;
 
 static inline islpci_state_t
diff -Nru a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c
--- a/drivers/net/wireless/prism54/islpci_eth.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/net/wireless/prism54/islpci_eth.c	Tue Jun 15 22:20:36 2004
@@ -1,7 +1,7 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.c,v 1.27 2004/01/30 16:24:00 ajfa Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
- *
+ *  Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License
@@ -24,10 +24,12 @@
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/if_arp.h>
 
 #include "isl_38xx.h"
 #include "islpci_eth.h"
 #include "islpci_mgt.h"
+#include "oid_mgt.h"
 
 /******************************************************************************
     Network Interface functions
@@ -246,6 +248,69 @@
 	return err;
 }
 
+static inline int
+islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb)
+{
+	/* The card reports full 802.11 packets but with a 20 bytes
+	 * header and without the FCS. But there a is a bit that
+	 * indicates if the packet is corrupted :-) */
+	struct rfmon_header *hdr = (struct rfmon_header *) (*skb)->data;
+	if (hdr->flags & 0x01)
+		/* This one is bad. Drop it ! */
+		return -1;
+	if (priv->ndev->type == ARPHRD_IEEE80211_PRISM) {
+		struct avs_80211_1_header *avs;
+		/* extract the relevant data from the header */
+		u32 clock = hdr->clock;
+		u8 rate = hdr->rate;
+		u16 freq = be16_to_cpu(hdr->freq);
+		u8 rssi = hdr->rssi;
+
+		skb_pull(*skb, sizeof (struct rfmon_header));
+
+		if (skb_headroom(*skb) < sizeof (struct avs_80211_1_header)) {
+			struct sk_buff *newskb = skb_copy_expand(*skb,
+								 sizeof (struct
+									 avs_80211_1_header),
+								 0, GFP_ATOMIC);
+			if (newskb) {
+				kfree_skb(*skb);
+				*skb = newskb;
+			} else
+				return -1;
+			/* This behavior is not very subtile... */
+		}
+
+		/* make room for the new header and fill it. */
+		avs =
+		    (struct avs_80211_1_header *) skb_push(*skb,
+							   sizeof (struct
+								   avs_80211_1_header));
+
+		avs->version = htonl(P80211CAPTURE_VERSION);
+		avs->length = htonl(sizeof (struct avs_80211_1_header));
+		avs->mactime = __cpu_to_be64(clock);
+		avs->hosttime = __cpu_to_be64(jiffies);
+		avs->phytype = htonl(6);	/*OFDM: 6 for (g), 8 for (a) */
+		avs->channel = htonl(channel_of_freq(freq));
+		avs->datarate = htonl(rate * 5);
+		avs->antenna = htonl(0);	/*unknown */
+		avs->priority = htonl(0);	/*unknown */
+		avs->ssi_type = htonl(2);	/*2: dBm, 3: raw RSSI */
+		avs->ssi_signal = htonl(rssi);
+		avs->ssi_noise = htonl(priv->local_iwstatistics.qual.noise);	/*better than 'undefined', I assume */
+		avs->preamble = htonl(0);	/*unknown */
+		avs->encoding = htonl(0);	/*unknown */
+	} else
+		skb_pull(*skb, sizeof (struct rfmon_header));
+
+	(*skb)->protocol = htons(ETH_P_802_2);
+	(*skb)->mac.raw = (*skb)->data;
+	(*skb)->pkt_type = PACKET_OTHERHOST;
+
+	return 0;
+}
+
 int
 islpci_eth_receive(islpci_private *priv)
 {
@@ -266,7 +331,8 @@
 	index = priv->free_data_rx % ISL38XX_CB_RX_QSIZE;
 	size = le16_to_cpu(control_block->rx_data_low[index].size);
 	skb = priv->data_low_rx[index];
-	offset = ((unsigned long) le32_to_cpu(control_block->rx_data_low[index].address) -
+	offset = ((unsigned long)
+		  le32_to_cpu(control_block->rx_data_low[index].address) -
 		  (unsigned long) skb->data) & 3;
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
@@ -314,29 +380,32 @@
 	/* do some additional sk_buff and network layer parameters */
 	skb->dev = ndev;
 
-	/* take care of monitor mode */
-	if (priv->iw_mode == IW_MODE_MONITOR) {
-		/* The card reports full 802.11 packets but with a 20 bytes
-		 * header and without the FCS. But there a is a bit that
-		 * indicates if the packet is corrupted :-) */
-		/* int i; */
-		if (skb->data[8] & 0x01){
-			/* This one is bad. Drop it !*/
-			discard = 1;
-			/* printk("BAD\n");*/
+	/* take care of monitor mode and spy monitoring. */
+	if (priv->iw_mode == IW_MODE_MONITOR)
+		discard = islpci_monitor_rx(priv, &skb);
+	else {
+		if (skb->data[2 * ETH_ALEN] == 0) {
+			/* The packet has a rx_annex. Read it for spy monitoring, Then
+			 * remove it, while keeping the 2 leading MAC addr.
+			 */
+			struct iw_quality wstats;
+			struct rx_annex_header *annex =
+			    (struct rx_annex_header *) skb->data;
+			wstats.level = annex->rfmon.rssi;
+			/* The noise value can be a bit outdated if nobody's 
+			 * reading wireless stats... */
+			wstats.noise = priv->local_iwstatistics.qual.noise;
+			wstats.qual = wstats.level - wstats.noise;
+			wstats.updated = 0x07;
+			/* Update spy records */
+			wireless_spy_update(ndev, annex->addr2, &wstats);
+
+			memcpy(skb->data + sizeof (struct rfmon_header),
+			       skb->data, 2 * ETH_ALEN);
+			skb_pull(skb, sizeof (struct rfmon_header));
 		}
-		/*
-		for(i=0;i<50;i++)
-			printk("%2.2X:",skb->data[i]);
-		printk("\n");
-		*/		
-		skb_pull(skb, 20);
-		skb->protocol = htons(ETH_P_802_2);
-		skb->mac.raw = skb->data;
-		skb->pkt_type = PACKET_OTHERHOST;
-	} else
 		skb->protocol = eth_type_trans(skb, ndev);
-
+	}
 	skb->ip_summed = CHECKSUM_NONE;
 	priv->statistics.rx_packets++;
 	priv->statistics.rx_bytes += size;
@@ -351,8 +420,7 @@
 	if (discard) {
 		dev_kfree_skb(skb);
 		skb = NULL;
-	}
-	else
+	} else
 		netif_rx(skb);
 
 	/* increment the read index for the rx data low queue */
@@ -403,7 +471,7 @@
 		wmb();
 
 		/* increment the driver read pointer */
-		add_le32p((u32 *) & control_block->
+		add_le32p((u32 *) &control_block->
 			  driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1);
 	}
 
@@ -414,6 +482,15 @@
 }
 
 void
+islpci_do_reset_and_wake(void *data)
+{
+       islpci_private *priv = (islpci_private *) data;
+       islpci_reset(priv, 1);
+       netif_wake_queue(priv->ndev);
+       priv->reset_task_pending = 0;
+}
+
+void
 islpci_eth_tx_timeout(struct net_device *ndev)
 {
 	islpci_private *priv = netdev_priv(ndev);
@@ -422,13 +499,11 @@
 	/* increment the transmit error counter */
 	statistics->tx_errors++;
 
-#if 0
-	/* don't do this here! we are not allowed to sleep since we are in interrupt context */
-	if (islpci_reset(priv))
-		printk(KERN_ERR "%s: error on TX timeout card reset!\n",
-		       ndev->name);
-#endif
+	if (!priv->reset_task_pending) {
+		priv->reset_task_pending = 1;
+		netif_stop_queue(ndev);
+		schedule_work(&priv->reset_task);
+	}
 
-	/* netif_wake_queue(ndev); */
 	return;
 }
diff -Nru a/drivers/net/wireless/prism54/islpci_eth.h b/drivers/net/wireless/prism54/islpci_eth.h
--- a/drivers/net/wireless/prism54/islpci_eth.h	Tue Jun 15 22:20:58 2004
+++ b/drivers/net/wireless/prism54/islpci_eth.h	Tue Jun 15 22:20:58 2004
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_eth.h,v 1.5 2004/01/12 22:16:32 jmaurer Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *
@@ -23,9 +23,51 @@
 #include "isl_38xx.h"
 #include "islpci_dev.h"
 
+struct rfmon_header {
+	u16 unk0;		/* = 0x0000 */
+	u16 length;		/* = 0x1400 */
+	u32 clock;		/* 1MHz clock */
+	u8 flags;
+	u8 unk1;
+	u8 rate;
+	u8 unk2;
+	u16 freq;
+	u16 unk3;
+	u8 rssi;
+	u8 padding[3];
+} __attribute__ ((packed));
+
+struct rx_annex_header {
+	u8 addr1[ETH_ALEN];
+	u8 addr2[ETH_ALEN];
+	struct rfmon_header rfmon;
+} __attribute__ ((packed));
+
+/* wlan-ng (and hopefully others) AVS header, version one.  Fields in
+ * network byte order. */
+#define P80211CAPTURE_VERSION 0x80211001
+
+struct avs_80211_1_header {
+	uint32_t version;
+	uint32_t length;
+	uint64_t mactime;
+	uint64_t hosttime;
+	uint32_t phytype;
+	uint32_t channel;
+	uint32_t datarate;
+	uint32_t antenna;
+	uint32_t priority;
+	uint32_t ssi_type;
+	int32_t ssi_signal;
+	int32_t ssi_noise;
+	uint32_t preamble;
+	uint32_t encoding;
+};
+
 void islpci_eth_cleanup_transmit(islpci_private *, isl38xx_control_block *);
 int islpci_eth_transmit(struct sk_buff *, struct net_device *);
 int islpci_eth_receive(islpci_private *);
 void islpci_eth_tx_timeout(struct net_device *);
+void islpci_do_reset_and_wake(void *data);
 
 #endif				/* _ISL_GEN_H */
diff -Nru a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c
--- a/drivers/net/wireless/prism54/islpci_hotplug.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/net/wireless/prism54/islpci_hotplug.c	Tue Jun 15 22:20:40 2004
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_hotplug.c,v 1.56 2004/02/26 23:33:02 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
diff -Nru a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c
--- a/drivers/net/wireless/prism54/islpci_mgt.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/net/wireless/prism54/islpci_mgt.c	Tue Jun 15 22:20:42 2004
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.c,v 1.40 2004/02/01 10:57:23 mcgrof Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright 2004 Jens Maurer <Jens.Maurer@gmx.net>
diff -Nru a/drivers/net/wireless/prism54/islpci_mgt.h b/drivers/net/wireless/prism54/islpci_mgt.h
--- a/drivers/net/wireless/prism54/islpci_mgt.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/net/wireless/prism54/islpci_mgt.h	Tue Jun 15 22:20:37 2004
@@ -1,4 +1,4 @@
-/*  $Header: /var/lib/cvs/prism54-ng/ksrc/islpci_mgt.h,v 1.22 2004/01/30 16:24:00 ajfa Exp $
+/*
  *  
  *  Copyright (C) 2002 Intersil Americas Inc.
  *  Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
diff -Nru a/drivers/net/wireless/prism54/oid_mgt.c b/drivers/net/wireless/prism54/oid_mgt.c
--- a/drivers/net/wireless/prism54/oid_mgt.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/wireless/prism54/oid_mgt.c	Tue Jun 15 22:21:03 2004
@@ -1,5 +1,5 @@
 /*   
- *  Copyright (C) 2003 Aurelien Alleaume <slts@free.fr>
+ *  Copyright (C) 2003,2004 Aurelien Alleaume <slts@free.fr>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -31,182 +31,210 @@
 	5240, 5260, 5280, 5300, 5320
 };
 
-#define OID_U32(x) {x, 0, sizeof(u32), OID_FLAG_U32}
-#define OID_U32_C(x) {x, 0, sizeof(u32), OID_FLAG_U32 | OID_FLAG_CACHED}
-#define OID_STRUCT(x,s) {x, 0, sizeof(s), 0}
-#define OID_STRUCT_C(x,s) {x, 0, sizeof(s), OID_FLAG_CACHED}
-#define OID_STRUCT_MLME(x){x, 0, sizeof(struct obj_mlme), 0}
-#define OID_STRUCT_MLMEEX(x){x, 0, sizeof(struct obj_mlmeex), OID_FLAG_MLMEEX}
+int
+channel_of_freq(int f)
+{
+	int c = 0;
+
+	if ((f >= 2412) && (f <= 2484)) {
+		while ((c < 14) && (f != frequency_list_bg[c]))
+			c++;
+		if (c >= 14)
+			return 0;
+	} else if ((f >= (int) 5170) && (f <= (int) 5320)) {
+		while ((c < 12) && (f != frequency_list_a[c]))
+			c++;
+		if (c >= 12)
+			return 0;
+	} else
+		return 0;
+
+	return ++c;
+}
+
+#define OID_STRUCT(name,oid,s,t) [name] = {oid, 0, sizeof(s), t}
+#define OID_STRUCT_C(name,oid,s,t) OID_STRUCT(name,oid,s,t | OID_FLAG_CACHED)
+#define OID_U32(name,oid) OID_STRUCT(name,oid,u32,OID_TYPE_U32)
+#define OID_U32_C(name,oid) OID_STRUCT_C(name,oid,u32,OID_TYPE_U32)
+#define OID_STRUCT_MLME(name,oid) OID_STRUCT(name,oid,struct obj_mlme,OID_TYPE_MLME)
+#define OID_STRUCT_MLMEEX(name,oid) OID_STRUCT(name,oid,struct obj_mlmeex,OID_TYPE_MLMEEX)
 
-#define OID_UNKNOWN(x) {x, 0, 0, 0}
+#define OID_UNKNOWN(name,oid) OID_STRUCT(name,oid,0,0)
 
 struct oid_t isl_oid[] = {
-	[GEN_OID_MACADDRESS] = OID_STRUCT(0x00000000, u8[6]),
-	[GEN_OID_LINKSTATE] = OID_U32(0x00000001),
-	[GEN_OID_WATCHDOG] = OID_UNKNOWN(0x00000002),
-	[GEN_OID_MIBOP] = OID_UNKNOWN(0x00000003),
-	[GEN_OID_OPTIONS] = OID_UNKNOWN(0x00000004),
-	[GEN_OID_LEDCONFIG] = OID_UNKNOWN(0x00000005),
+	OID_STRUCT(GEN_OID_MACADDRESS, 0x00000000, u8[6], OID_TYPE_ADDR),
+	OID_U32(GEN_OID_LINKSTATE, 0x00000001),
+	OID_UNKNOWN(GEN_OID_WATCHDOG, 0x00000002),
+	OID_UNKNOWN(GEN_OID_MIBOP, 0x00000003),
+	OID_UNKNOWN(GEN_OID_OPTIONS, 0x00000004),
+	OID_UNKNOWN(GEN_OID_LEDCONFIG, 0x00000005),
 
 	/* 802.11 */
-	[DOT11_OID_BSSTYPE] = OID_U32_C(0x10000000),
-	[DOT11_OID_BSSID] = OID_STRUCT_C(0x10000001, u8[6]),
-	[DOT11_OID_SSID] = OID_STRUCT_C(0x10000002, struct obj_ssid),
-	[DOT11_OID_STATE] = OID_U32(0x10000003),
-	[DOT11_OID_AID] = OID_U32(0x10000004),
-	[DOT11_OID_COUNTRYSTRING] = OID_STRUCT(0x10000005, u8[4]),
-	[DOT11_OID_SSIDOVERRIDE] = OID_STRUCT_C(0x10000006, struct obj_ssid),
-
-	[DOT11_OID_MEDIUMLIMIT] = OID_U32(0x11000000),
-	[DOT11_OID_BEACONPERIOD] = OID_U32_C(0x11000001),
-	[DOT11_OID_DTIMPERIOD] = OID_U32(0x11000002),
-	[DOT11_OID_ATIMWINDOW] = OID_U32(0x11000003),
-	[DOT11_OID_LISTENINTERVAL] = OID_U32(0x11000004),
-	[DOT11_OID_CFPPERIOD] = OID_U32(0x11000005),
-	[DOT11_OID_CFPDURATION] = OID_U32(0x11000006),
-
-	[DOT11_OID_AUTHENABLE] = OID_U32_C(0x12000000),
-	[DOT11_OID_PRIVACYINVOKED] = OID_U32_C(0x12000001),
-	[DOT11_OID_EXUNENCRYPTED] = OID_U32_C(0x12000002),
-	[DOT11_OID_DEFKEYID] = OID_U32_C(0x12000003),
-	[DOT11_OID_DEFKEYX] = {0x12000004, 3, sizeof (struct obj_key), OID_FLAG_CACHED},	/* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */
-	[DOT11_OID_STAKEY] = OID_UNKNOWN(0x12000008),
-	[DOT11_OID_REKEYTHRESHOLD] = OID_U32(0x12000009),
-	[DOT11_OID_STASC] = OID_UNKNOWN(0x1200000a),
-
-	[DOT11_OID_PRIVTXREJECTED] = OID_U32(0x1a000000),
-	[DOT11_OID_PRIVRXPLAIN] = OID_U32(0x1a000001),
-	[DOT11_OID_PRIVRXFAILED] = OID_U32(0x1a000002),
-	[DOT11_OID_PRIVRXNOKEY] = OID_U32(0x1a000003),
-
-	[DOT11_OID_RTSTHRESH] = OID_U32_C(0x13000000),
-	[DOT11_OID_FRAGTHRESH] = OID_U32_C(0x13000001),
-	[DOT11_OID_SHORTRETRIES] = OID_U32_C(0x13000002),
-	[DOT11_OID_LONGRETRIES] = OID_U32_C(0x13000003),
-	[DOT11_OID_MAXTXLIFETIME] = OID_U32_C(0x13000004),
-	[DOT11_OID_MAXRXLIFETIME] = OID_U32(0x13000005),
-	[DOT11_OID_AUTHRESPTIMEOUT] = OID_U32(0x13000006),
-	[DOT11_OID_ASSOCRESPTIMEOUT] = OID_U32(0x13000007),
-
-	[DOT11_OID_ALOFT_TABLE] = OID_UNKNOWN(0x1d000000),
-	[DOT11_OID_ALOFT_CTRL_TABLE] = OID_UNKNOWN(0x1d000001),
-	[DOT11_OID_ALOFT_RETREAT] = OID_UNKNOWN(0x1d000002),
-	[DOT11_OID_ALOFT_PROGRESS] = OID_UNKNOWN(0x1d000003),
-	[DOT11_OID_ALOFT_FIXEDRATE] = OID_U32(0x1d000004),
-	[DOT11_OID_ALOFT_RSSIGRAPH] = OID_UNKNOWN(0x1d000005),
-	[DOT11_OID_ALOFT_CONFIG] = OID_UNKNOWN(0x1d000006),
+	OID_U32_C(DOT11_OID_BSSTYPE, 0x10000000),
+	OID_STRUCT_C(DOT11_OID_BSSID, 0x10000001, u8[6], OID_TYPE_SSID),
+	OID_STRUCT_C(DOT11_OID_SSID, 0x10000002, struct obj_ssid,
+		     OID_TYPE_SSID),
+	OID_U32(DOT11_OID_STATE, 0x10000003),
+	OID_U32(DOT11_OID_AID, 0x10000004),
+	OID_STRUCT(DOT11_OID_COUNTRYSTRING, 0x10000005, u8[4], OID_TYPE_RAW),
+	OID_STRUCT_C(DOT11_OID_SSIDOVERRIDE, 0x10000006, struct obj_ssid,
+		     OID_TYPE_SSID),
+
+	OID_U32(DOT11_OID_MEDIUMLIMIT, 0x11000000),
+	OID_U32_C(DOT11_OID_BEACONPERIOD, 0x11000001),
+	OID_U32(DOT11_OID_DTIMPERIOD, 0x11000002),
+	OID_U32(DOT11_OID_ATIMWINDOW, 0x11000003),
+	OID_U32(DOT11_OID_LISTENINTERVAL, 0x11000004),
+	OID_U32(DOT11_OID_CFPPERIOD, 0x11000005),
+	OID_U32(DOT11_OID_CFPDURATION, 0x11000006),
+
+	OID_U32_C(DOT11_OID_AUTHENABLE, 0x12000000),
+	OID_U32_C(DOT11_OID_PRIVACYINVOKED, 0x12000001),
+	OID_U32_C(DOT11_OID_EXUNENCRYPTED, 0x12000002),
+	OID_U32_C(DOT11_OID_DEFKEYID, 0x12000003),
+	[DOT11_OID_DEFKEYX] = {0x12000004, 3, sizeof (struct obj_key),
+			       OID_FLAG_CACHED | OID_TYPE_KEY},	/* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */
+	OID_UNKNOWN(DOT11_OID_STAKEY, 0x12000008),
+	OID_U32(DOT11_OID_REKEYTHRESHOLD, 0x12000009),
+	OID_UNKNOWN(DOT11_OID_STASC, 0x1200000a),
+
+	OID_U32(DOT11_OID_PRIVTXREJECTED, 0x1a000000),
+	OID_U32(DOT11_OID_PRIVRXPLAIN, 0x1a000001),
+	OID_U32(DOT11_OID_PRIVRXFAILED, 0x1a000002),
+	OID_U32(DOT11_OID_PRIVRXNOKEY, 0x1a000003),
+
+	OID_U32_C(DOT11_OID_RTSTHRESH, 0x13000000),
+	OID_U32_C(DOT11_OID_FRAGTHRESH, 0x13000001),
+	OID_U32_C(DOT11_OID_SHORTRETRIES, 0x13000002),
+	OID_U32_C(DOT11_OID_LONGRETRIES, 0x13000003),
+	OID_U32_C(DOT11_OID_MAXTXLIFETIME, 0x13000004),
+	OID_U32(DOT11_OID_MAXRXLIFETIME, 0x13000005),
+	OID_U32(DOT11_OID_AUTHRESPTIMEOUT, 0x13000006),
+	OID_U32(DOT11_OID_ASSOCRESPTIMEOUT, 0x13000007),
+
+	OID_UNKNOWN(DOT11_OID_ALOFT_TABLE, 0x1d000000),
+	OID_UNKNOWN(DOT11_OID_ALOFT_CTRL_TABLE, 0x1d000001),
+	OID_UNKNOWN(DOT11_OID_ALOFT_RETREAT, 0x1d000002),
+	OID_UNKNOWN(DOT11_OID_ALOFT_PROGRESS, 0x1d000003),
+	OID_U32(DOT11_OID_ALOFT_FIXEDRATE, 0x1d000004),
+	OID_UNKNOWN(DOT11_OID_ALOFT_RSSIGRAPH, 0x1d000005),
+	OID_UNKNOWN(DOT11_OID_ALOFT_CONFIG, 0x1d000006),
 
 	[DOT11_OID_VDCFX] = {0x1b000000, 7, 0, 0},
-	[DOT11_OID_MAXFRAMEBURST] = OID_U32(0x1b000008), /* in microseconds */
+	OID_U32(DOT11_OID_MAXFRAMEBURST, 0x1b000008),
 
-	[DOT11_OID_PSM] = OID_U32(0x14000000),
-	[DOT11_OID_CAMTIMEOUT] = OID_U32(0x14000001),
-	[DOT11_OID_RECEIVEDTIMS] = OID_U32(0x14000002),
-	[DOT11_OID_ROAMPREFERENCE] = OID_U32(0x14000003),
-
-	[DOT11_OID_BRIDGELOCAL] = OID_U32(0x15000000),
-	[DOT11_OID_CLIENTS] = OID_U32(0x15000001),
-	[DOT11_OID_CLIENTSASSOCIATED] = OID_U32(0x15000002),
+	OID_U32(DOT11_OID_PSM, 0x14000000),
+	OID_U32(DOT11_OID_CAMTIMEOUT, 0x14000001),
+	OID_U32(DOT11_OID_RECEIVEDTIMS, 0x14000002),
+	OID_U32(DOT11_OID_ROAMPREFERENCE, 0x14000003),
+
+	OID_U32(DOT11_OID_BRIDGELOCAL, 0x15000000),
+	OID_U32(DOT11_OID_CLIENTS, 0x15000001),
+	OID_U32(DOT11_OID_CLIENTSASSOCIATED, 0x15000002),
 	[DOT11_OID_CLIENTX] = {0x15000003, 2006, 0, 0},	/* DOT11_OID_CLIENTX,...DOT11_OID_CLIENT2007 */
 
-	[DOT11_OID_CLIENTFIND] = OID_STRUCT(0x150007DB, u8[6]),
-	[DOT11_OID_WDSLINKADD] = OID_STRUCT(0x150007DC, u8[6]),
-	[DOT11_OID_WDSLINKREMOVE] = OID_STRUCT(0x150007DD, u8[6]),
-	[DOT11_OID_EAPAUTHSTA] = OID_STRUCT(0x150007DE, u8[6]),
-	[DOT11_OID_EAPUNAUTHSTA] = OID_STRUCT(0x150007DF, u8[6]),
-	[DOT11_OID_DOT1XENABLE] = OID_U32_C(0x150007E0),
-	[DOT11_OID_MICFAILURE] = OID_UNKNOWN(0x150007E1),
-	[DOT11_OID_REKEYINDICATE] = OID_UNKNOWN(0x150007E2),
-
-	[DOT11_OID_MPDUTXSUCCESSFUL] = OID_U32(0x16000000),
-	[DOT11_OID_MPDUTXONERETRY] = OID_U32(0x16000001),
-	[DOT11_OID_MPDUTXMULTIPLERETRIES] = OID_U32(0x16000002),
-	[DOT11_OID_MPDUTXFAILED] = OID_U32(0x16000003),
-	[DOT11_OID_MPDURXSUCCESSFUL] = OID_U32(0x16000004),
-	[DOT11_OID_MPDURXDUPS] = OID_U32(0x16000005),
-	[DOT11_OID_RTSSUCCESSFUL] = OID_U32(0x16000006),
-	[DOT11_OID_RTSFAILED] = OID_U32(0x16000007),
-	[DOT11_OID_ACKFAILED] = OID_U32(0x16000008),
-	[DOT11_OID_FRAMERECEIVES] = OID_U32(0x16000009),
-	[DOT11_OID_FRAMEERRORS] = OID_U32(0x1600000A),
-	[DOT11_OID_FRAMEABORTS] = OID_U32(0x1600000B),
-	[DOT11_OID_FRAMEABORTSPHY] = OID_U32(0x1600000C),
-
-	[DOT11_OID_SLOTTIME] = OID_U32(0x17000000),
-	[DOT11_OID_CWMIN] = OID_U32(0x17000001),
-	[DOT11_OID_CWMAX] = OID_U32(0x17000002),
-	[DOT11_OID_ACKWINDOW] = OID_U32(0x17000003),
-	[DOT11_OID_ANTENNARX] = OID_U32(0x17000004),
-	[DOT11_OID_ANTENNATX] = OID_U32(0x17000005),
-	[DOT11_OID_ANTENNADIVERSITY] = OID_U32(0x17000006),
-	[DOT11_OID_CHANNEL] = OID_U32_C(0x17000007),
-	[DOT11_OID_EDTHRESHOLD] = OID_U32_C(0x17000008),
-	[DOT11_OID_PREAMBLESETTINGS] = OID_U32(0x17000009),
-	[DOT11_OID_RATES] = OID_STRUCT(0x1700000A, u8[IWMAX_BITRATES + 1]),
-	[DOT11_OID_CCAMODESUPPORTED] = OID_U32(0x1700000B),
-	[DOT11_OID_CCAMODE] = OID_U32(0x1700000C),
-	[DOT11_OID_RSSIVECTOR] = OID_U32(0x1700000D),
-	[DOT11_OID_OUTPUTPOWERTABLE] = OID_U32(0x1700000E),
-	[DOT11_OID_OUTPUTPOWER] = OID_U32_C(0x1700000F),
-	[DOT11_OID_SUPPORTEDRATES] =
-	    OID_STRUCT(0x17000010, u8[IWMAX_BITRATES + 1]),
-	[DOT11_OID_FREQUENCY] = OID_U32_C(0x17000011),
-	[DOT11_OID_SUPPORTEDFREQUENCIES] = {0x17000012, 0, sizeof (struct
-								   obj_frequencies)
-					    + sizeof (u16) * IWMAX_FREQ, 0},
-
-	[DOT11_OID_NOISEFLOOR] = OID_U32(0x17000013),
-	[DOT11_OID_FREQUENCYACTIVITY] =
-	    OID_STRUCT(0x17000014, u8[IWMAX_FREQ + 1]),
-	[DOT11_OID_IQCALIBRATIONTABLE] = OID_UNKNOWN(0x17000015),
-	[DOT11_OID_NONERPPROTECTION] = OID_U32(0x17000016),
-	[DOT11_OID_SLOTSETTINGS] = OID_U32(0x17000017),
-	[DOT11_OID_NONERPTIMEOUT] = OID_U32(0x17000018),
-	[DOT11_OID_PROFILES] = OID_U32(0x17000019),
-	[DOT11_OID_EXTENDEDRATES] =
-	    OID_STRUCT(0x17000020, u8[IWMAX_BITRATES + 1]),
-
-	[DOT11_OID_DEAUTHENTICATE] = OID_STRUCT_MLME(0x18000000),
-	[DOT11_OID_AUTHENTICATE] = OID_STRUCT_MLME(0x18000001),
-	[DOT11_OID_DISASSOCIATE] = OID_STRUCT_MLME(0x18000002),
-	[DOT11_OID_ASSOCIATE] = OID_STRUCT_MLME(0x18000003),
-	[DOT11_OID_SCAN] = OID_UNKNOWN(0x18000004),
-	[DOT11_OID_BEACON] = OID_STRUCT_MLMEEX(0x18000005),
-	[DOT11_OID_PROBE] = OID_STRUCT_MLMEEX(0x18000006),
-	[DOT11_OID_DEAUTHENTICATEEX] = OID_STRUCT_MLMEEX(0x18000007),
-	[DOT11_OID_AUTHENTICATEEX] = OID_STRUCT_MLMEEX(0x18000008),
-	[DOT11_OID_DISASSOCIATEEX] = OID_STRUCT_MLMEEX(0x18000009),
-	[DOT11_OID_ASSOCIATEEX] = OID_STRUCT_MLMEEX(0x1800000A),
-	[DOT11_OID_REASSOCIATE] = OID_STRUCT_MLMEEX(0x1800000B),
-	[DOT11_OID_REASSOCIATEEX] = OID_STRUCT_MLMEEX(0x1800000C),
-
-	[DOT11_OID_NONERPSTATUS] = OID_U32(0x1E000000),
-
-	[DOT11_OID_STATIMEOUT] = OID_U32(0x19000000),
-	[DOT11_OID_MLMEAUTOLEVEL] = OID_U32_C(0x19000001),
-	[DOT11_OID_BSSTIMEOUT] = OID_U32(0x19000002),
-	[DOT11_OID_ATTACHMENT] = OID_UNKNOWN(0x19000003),
-	[DOT11_OID_PSMBUFFER] = OID_STRUCT_C(0x19000004, struct obj_buffer),
-
-	[DOT11_OID_BSSS] = OID_U32(0x1C000000),
-	[DOT11_OID_BSSX] = {0x1C000001, 63, sizeof (struct obj_bss), 0},	/*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */
-	[DOT11_OID_BSSFIND] = OID_STRUCT(0x1C000042, struct obj_bss),
+	OID_STRUCT(DOT11_OID_CLIENTFIND, 0x150007DB, u8[6], OID_TYPE_ADDR),
+	OID_STRUCT(DOT11_OID_WDSLINKADD, 0x150007DC, u8[6], OID_TYPE_ADDR),
+	OID_STRUCT(DOT11_OID_WDSLINKREMOVE, 0x150007DD, u8[6], OID_TYPE_ADDR),
+	OID_STRUCT(DOT11_OID_EAPAUTHSTA, 0x150007DE, u8[6], OID_TYPE_ADDR),
+	OID_STRUCT(DOT11_OID_EAPUNAUTHSTA, 0x150007DF, u8[6], OID_TYPE_ADDR),
+	OID_U32_C(DOT11_OID_DOT1XENABLE, 0x150007E0),
+	OID_UNKNOWN(DOT11_OID_MICFAILURE, 0x150007E1),
+	OID_UNKNOWN(DOT11_OID_REKEYINDICATE, 0x150007E2),
+
+	OID_U32(DOT11_OID_MPDUTXSUCCESSFUL, 0x16000000),
+	OID_U32(DOT11_OID_MPDUTXONERETRY, 0x16000001),
+	OID_U32(DOT11_OID_MPDUTXMULTIPLERETRIES, 0x16000002),
+	OID_U32(DOT11_OID_MPDUTXFAILED, 0x16000003),
+	OID_U32(DOT11_OID_MPDURXSUCCESSFUL, 0x16000004),
+	OID_U32(DOT11_OID_MPDURXDUPS, 0x16000005),
+	OID_U32(DOT11_OID_RTSSUCCESSFUL, 0x16000006),
+	OID_U32(DOT11_OID_RTSFAILED, 0x16000007),
+	OID_U32(DOT11_OID_ACKFAILED, 0x16000008),
+	OID_U32(DOT11_OID_FRAMERECEIVES, 0x16000009),
+	OID_U32(DOT11_OID_FRAMEERRORS, 0x1600000A),
+	OID_U32(DOT11_OID_FRAMEABORTS, 0x1600000B),
+	OID_U32(DOT11_OID_FRAMEABORTSPHY, 0x1600000C),
+
+	OID_U32(DOT11_OID_SLOTTIME, 0x17000000),
+	OID_U32(DOT11_OID_CWMIN, 0x17000001),
+	OID_U32(DOT11_OID_CWMAX, 0x17000002),
+	OID_U32(DOT11_OID_ACKWINDOW, 0x17000003),
+	OID_U32(DOT11_OID_ANTENNARX, 0x17000004),
+	OID_U32(DOT11_OID_ANTENNATX, 0x17000005),
+	OID_U32(DOT11_OID_ANTENNADIVERSITY, 0x17000006),
+	OID_U32_C(DOT11_OID_CHANNEL, 0x17000007),
+	OID_U32_C(DOT11_OID_EDTHRESHOLD, 0x17000008),
+	OID_U32(DOT11_OID_PREAMBLESETTINGS, 0x17000009),
+	OID_STRUCT(DOT11_OID_RATES, 0x1700000A, u8[IWMAX_BITRATES + 1],
+		   OID_TYPE_RAW),
+	OID_U32(DOT11_OID_CCAMODESUPPORTED, 0x1700000B),
+	OID_U32(DOT11_OID_CCAMODE, 0x1700000C),
+	OID_UNKNOWN(DOT11_OID_RSSIVECTOR, 0x1700000D),
+	OID_UNKNOWN(DOT11_OID_OUTPUTPOWERTABLE, 0x1700000E),
+	OID_U32(DOT11_OID_OUTPUTPOWER, 0x1700000F),
+	OID_STRUCT(DOT11_OID_SUPPORTEDRATES, 0x17000010,
+		   u8[IWMAX_BITRATES + 1], OID_TYPE_RAW),
+	OID_U32_C(DOT11_OID_FREQUENCY, 0x17000011),
+	[DOT11_OID_SUPPORTEDFREQUENCIES] =
+	    {0x17000012, 0, sizeof (struct obj_frequencies)
+	     + sizeof (u16) * IWMAX_FREQ, OID_TYPE_FREQUENCIES},
+
+	OID_U32(DOT11_OID_NOISEFLOOR, 0x17000013),
+	OID_STRUCT(DOT11_OID_FREQUENCYACTIVITY, 0x17000014, u8[IWMAX_FREQ + 1],
+		   OID_TYPE_RAW),
+	OID_UNKNOWN(DOT11_OID_IQCALIBRATIONTABLE, 0x17000015),
+	OID_U32(DOT11_OID_NONERPPROTECTION, 0x17000016),
+	OID_U32(DOT11_OID_SLOTSETTINGS, 0x17000017),
+	OID_U32(DOT11_OID_NONERPTIMEOUT, 0x17000018),
+	OID_U32(DOT11_OID_PROFILES, 0x17000019),
+	OID_STRUCT(DOT11_OID_EXTENDEDRATES, 0x17000020,
+		   u8[IWMAX_BITRATES + 1], OID_TYPE_RAW),
+
+	OID_STRUCT_MLME(DOT11_OID_DEAUTHENTICATE, 0x18000000),
+	OID_STRUCT_MLME(DOT11_OID_AUTHENTICATE, 0x18000001),
+	OID_STRUCT_MLME(DOT11_OID_DISASSOCIATE, 0x18000002),
+	OID_STRUCT_MLME(DOT11_OID_ASSOCIATE, 0x18000003),
+	OID_UNKNOWN(DOT11_OID_SCAN, 0x18000004),
+	OID_STRUCT_MLMEEX(DOT11_OID_BEACON, 0x18000005),
+	OID_STRUCT_MLMEEX(DOT11_OID_PROBE, 0x18000006),
+	OID_STRUCT_MLMEEX(DOT11_OID_DEAUTHENTICATEEX, 0x18000007),
+	OID_STRUCT_MLMEEX(DOT11_OID_AUTHENTICATEEX, 0x18000008),
+	OID_STRUCT_MLMEEX(DOT11_OID_DISASSOCIATEEX, 0x18000009),
+	OID_STRUCT_MLMEEX(DOT11_OID_ASSOCIATEEX, 0x1800000A),
+	OID_STRUCT_MLMEEX(DOT11_OID_REASSOCIATE, 0x1800000B),
+	OID_STRUCT_MLMEEX(DOT11_OID_REASSOCIATEEX, 0x1800000C),
+
+	OID_U32(DOT11_OID_NONERPSTATUS, 0x1E000000),
+
+	OID_U32(DOT11_OID_STATIMEOUT, 0x19000000),
+	OID_U32_C(DOT11_OID_MLMEAUTOLEVEL, 0x19000001),
+	OID_U32(DOT11_OID_BSSTIMEOUT, 0x19000002),
+	OID_UNKNOWN(DOT11_OID_ATTACHMENT, 0x19000003),
+	OID_STRUCT_C(DOT11_OID_PSMBUFFER, 0x19000004, struct obj_buffer,
+		     OID_TYPE_BUFFER),
+
+	OID_U32(DOT11_OID_BSSS, 0x1C000000),
+	[DOT11_OID_BSSX] = {0x1C000001, 63, sizeof (struct obj_bss),
+			    OID_TYPE_BSS},	/*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */
+	OID_STRUCT(DOT11_OID_BSSFIND, 0x1C000042, struct obj_bss, OID_TYPE_BSS),
 	[DOT11_OID_BSSLIST] = {0x1C000043, 0, sizeof (struct
 						      obj_bsslist) +
-			       sizeof (struct obj_bss[IWMAX_BSS]), 0},
+			       sizeof (struct obj_bss[IWMAX_BSS]),
+			       OID_TYPE_BSSLIST},
 
-	[OID_INL_TUNNEL] = OID_UNKNOWN(0xFF020000),
-	[OID_INL_MEMADDR] = OID_UNKNOWN(0xFF020001),
-	[OID_INL_MEMORY] = OID_UNKNOWN(0xFF020002),
-	[OID_INL_MODE] = OID_U32_C(0xFF020003),
-	[OID_INL_COMPONENT_NR] = OID_UNKNOWN(0xFF020004),
-	[OID_INL_VERSION] = OID_UNKNOWN(0xFF020005),
-	[OID_INL_INTERFACE_ID] = OID_UNKNOWN(0xFF020006),
-	[OID_INL_COMPONENT_ID] = OID_UNKNOWN(0xFF020007),
-	[OID_INL_CONFIG] = OID_U32_C(0xFF020008),
-	[OID_INL_DOT11D_CONFORMANCE] = OID_U32_C(0xFF02000C),
-	[OID_INL_PHYCAPABILITIES] = OID_U32(0xFF02000D),
-	[OID_INL_OUTPUTPOWER] = OID_U32_C(0xFF02000F),
+	OID_UNKNOWN(OID_INL_TUNNEL, 0xFF020000),
+	OID_UNKNOWN(OID_INL_MEMADDR, 0xFF020001),
+	OID_UNKNOWN(OID_INL_MEMORY, 0xFF020002),
+	OID_U32_C(OID_INL_MODE, 0xFF020003),
+	OID_UNKNOWN(OID_INL_COMPONENT_NR, 0xFF020004),
+	OID_UNKNOWN(OID_INL_VERSION, 0xFF020005),
+	OID_UNKNOWN(OID_INL_INTERFACE_ID, 0xFF020006),
+	OID_UNKNOWN(OID_INL_COMPONENT_ID, 0xFF020007),
+	OID_U32_C(OID_INL_CONFIG, 0xFF020008),
+	OID_U32_C(OID_INL_DOT11D_CONFORMANCE, 0xFF02000C),
+	OID_U32(OID_INL_PHYCAPABILITIES, 0xFF02000D),
+	OID_U32_C(OID_INL_OUTPUTPOWER, 0xFF02000F),
 
 };
 
@@ -257,6 +285,134 @@
 	priv->mib = NULL;
 }
 
+void
+mgt_le_to_cpu(int type, void *data)
+{
+	switch (type) {
+	case OID_TYPE_U32:
+		*(u32 *) data = le32_to_cpu(*(u32 *) data);
+		break;
+	case OID_TYPE_BUFFER:{
+			struct obj_buffer *buff = data;
+			buff->size = le32_to_cpu(buff->size);
+			buff->addr = le32_to_cpu(buff->addr);
+			break;
+		}
+	case OID_TYPE_BSS:{
+			struct obj_bss *bss = data;
+			bss->age = le16_to_cpu(bss->age);
+			bss->channel = le16_to_cpu(bss->channel);
+			bss->capinfo = le16_to_cpu(bss->capinfo);
+			bss->rates = le16_to_cpu(bss->rates);
+			bss->basic_rates = le16_to_cpu(bss->basic_rates);
+			break;
+		}
+	case OID_TYPE_BSSLIST:{
+			struct obj_bsslist *list = data;
+			int i;
+			list->nr = le32_to_cpu(list->nr);
+			for (i = 0; i < list->nr; i++)
+				mgt_le_to_cpu(OID_TYPE_BSS, &list->bsslist[i]);
+			break;
+		}
+	case OID_TYPE_FREQUENCIES:{
+			struct obj_frequencies *freq = data;
+			int i;
+			freq->nr = le16_to_cpu(freq->nr);
+			for (i = 0; i < freq->nr; i++)
+				freq->mhz[i] = le16_to_cpu(freq->mhz[i]);
+			break;
+		}
+	case OID_TYPE_MLME:{
+			struct obj_mlme *mlme = data;
+			mlme->id = le16_to_cpu(mlme->id);
+			mlme->state = le16_to_cpu(mlme->state);
+			mlme->code = le16_to_cpu(mlme->code);
+			break;
+		}
+	case OID_TYPE_MLMEEX:{
+			struct obj_mlmeex *mlme = data;
+			mlme->id = le16_to_cpu(mlme->id);
+			mlme->state = le16_to_cpu(mlme->state);
+			mlme->code = le16_to_cpu(mlme->code);
+			mlme->size = le16_to_cpu(mlme->size);
+			break;
+		}
+	case OID_TYPE_SSID:
+	case OID_TYPE_KEY:
+	case OID_TYPE_ADDR:
+	case OID_TYPE_RAW:
+		break;
+	default:
+		BUG();
+	}
+}
+
+static void
+mgt_cpu_to_le(int type, void *data)
+{
+	switch (type) {
+	case OID_TYPE_U32:
+		*(u32 *) data = cpu_to_le32(*(u32 *) data);
+		break;
+	case OID_TYPE_BUFFER:{
+			struct obj_buffer *buff = data;
+			buff->size = cpu_to_le32(buff->size);
+			buff->addr = cpu_to_le32(buff->addr);
+			break;
+		}
+	case OID_TYPE_BSS:{
+			struct obj_bss *bss = data;
+			bss->age = cpu_to_le16(bss->age);
+			bss->channel = cpu_to_le16(bss->channel);
+			bss->capinfo = cpu_to_le16(bss->capinfo);
+			bss->rates = cpu_to_le16(bss->rates);
+			bss->basic_rates = cpu_to_le16(bss->basic_rates);
+			break;
+		}
+	case OID_TYPE_BSSLIST:{
+			struct obj_bsslist *list = data;
+			int i;
+			list->nr = cpu_to_le32(list->nr);
+			for (i = 0; i < list->nr; i++)
+				mgt_cpu_to_le(OID_TYPE_BSS, &list->bsslist[i]);
+			break;
+		}
+	case OID_TYPE_FREQUENCIES:{
+			struct obj_frequencies *freq = data;
+			int i;
+			freq->nr = cpu_to_le16(freq->nr);
+			for (i = 0; i < freq->nr; i++)
+				freq->mhz[i] = cpu_to_le16(freq->mhz[i]);
+			break;
+		}
+	case OID_TYPE_MLME:{
+			struct obj_mlme *mlme = data;
+			mlme->id = cpu_to_le16(mlme->id);
+			mlme->state = cpu_to_le16(mlme->state);
+			mlme->code = cpu_to_le16(mlme->code);
+			break;
+		}
+	case OID_TYPE_MLMEEX:{
+			struct obj_mlmeex *mlme = data;
+			mlme->id = cpu_to_le16(mlme->id);
+			mlme->state = cpu_to_le16(mlme->state);
+			mlme->code = cpu_to_le16(mlme->code);
+			mlme->size = cpu_to_le16(mlme->size);
+			break;
+		}
+	case OID_TYPE_SSID:
+	case OID_TYPE_KEY:
+	case OID_TYPE_ADDR:
+	case OID_TYPE_RAW:
+		break;
+	default:
+		BUG();
+	}
+}
+
+/* Note : data is modified during this function */
+
 int
 mgt_set_request(islpci_private *priv, enum oid_num_t n, int extra, void *data)
 {
@@ -265,7 +421,7 @@
 	int response_op = PIMFOR_OP_ERROR;
 	int dlen;
 	void *cache, *_data = data;
-	u32 oid, u;
+	u32 oid;
 
 	BUG_ON(OID_NUM_LAST <= n);
 	BUG_ON(extra > isl_oid[n].range);
@@ -279,13 +435,11 @@
 	cache += (cache ? extra * dlen : 0);
 	oid = isl_oid[n].oid + extra;
 
-	if (data == NULL)
+	if (_data == NULL)
 		/* we are requested to re-set a cached value */
 		_data = cache;
-	if ((isl_oid[n].flags & OID_FLAG_U32) && data) {
-		u = cpu_to_le32(*(u32 *) data);
-		_data = &u;
-	}
+	else
+		mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, _data);
 	/* If we are going to write to the cache, we don't want anyone to read
 	 * it -> acquire write lock.
 	 * Else we could acquire a read lock to be sure we don't bother the
@@ -313,6 +467,10 @@
 		up_write(&priv->mib_sem);
 	}
 
+	/* re-set given data to what it was */
+	if (data)
+		mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, data);
+
 	return ret;
 }
 
@@ -326,7 +484,7 @@
 	struct islpci_mgmtframe *response = NULL;
 	
 	int dlen;
-	void *cache, *_res=NULL;
+	void *cache, *_res = NULL;
 	u32 oid;
 
 	BUG_ON(OID_NUM_LAST <= n);
@@ -362,20 +520,19 @@
 		_res = cache;
 		ret = 0;
 	}
-	if (isl_oid[n].flags & OID_FLAG_U32) {
-		if (ret)
-			res->u = 0;
-		else
-			res->u = le32_to_cpu(*(u32 *) _res);
-	} else {
+	if ((isl_oid[n].flags & OID_FLAG_TYPE) == OID_TYPE_U32)
+		res->u = ret ? 0 : le32_to_cpu(*(u32 *) _res);
+	else {
 		res->ptr = kmalloc(reslen, GFP_KERNEL);
 		BUG_ON(res->ptr == NULL);
 		if (ret)
 			memset(res->ptr, 0, reslen);
-		else
+		else {
 			memcpy(res->ptr, _res, reslen);
+			mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE,
+				      res->ptr);
+		}
 	}
-
 	if (cache)
 		up_read(&priv->mib_sem);
 
@@ -404,7 +561,7 @@
 		int j = 0;
 		u32 oid = t->oid;
 		BUG_ON(data == NULL);
-		while (j <= t->range){
+		while (j <= t->range) {
 			response = NULL;
 			ret |= islpci_mgt_transaction(priv->ndev, PIMFOR_OP_SET,
 			                              oid, data, t->size,
@@ -431,13 +588,21 @@
 	BUG_ON(priv->mib[n] == NULL);
 
 	memcpy(priv->mib[n], data, isl_oid[n].size);
-	if (isl_oid[n].flags & OID_FLAG_U32)
-		*(u32 *) priv->mib[n] = cpu_to_le32(*(u32 *) priv->mib[n]);
+	mgt_cpu_to_le(isl_oid[n].flags & OID_FLAG_TYPE, priv->mib[n]);
 }
 
-/* Commits the cache. If something goes wrong, it restarts the device. Lock
- * outside
- */
+void
+mgt_get(islpci_private *priv, enum oid_num_t n, void *res)
+{
+	BUG_ON(OID_NUM_LAST <= n);
+	BUG_ON(priv->mib[n] == NULL);
+	BUG_ON(res == NULL);
+
+	memcpy(res, priv->mib[n], isl_oid[n].size);
+	mgt_le_to_cpu(isl_oid[n].flags & OID_FLAG_TYPE, res);
+}
+
+/* Commits the cache. Lock outside. */
 
 static enum oid_num_t commit_part1[] = {
 	OID_INL_CONFIG,
@@ -528,5 +693,104 @@
 
 	printk(KERN_DEBUG "looking for an unknown oid 0x%x", oid);
 
+	return 0;
+}
+
+int
+mgt_response_to_str(enum oid_num_t n, union oid_res_t *r, char *str)
+{
+	switch (isl_oid[n].flags & OID_FLAG_TYPE) {
+	case OID_TYPE_U32:
+		return snprintf(str, PRIV_STR_SIZE, "%u\n", r->u);
+		break;
+	case OID_TYPE_BUFFER:{
+			struct obj_buffer *buff = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE,
+					"size=%u\naddr=0x%X\n", buff->size,
+					buff->addr);
+		}
+		break;
+	case OID_TYPE_BSS:{
+			struct obj_bss *bss = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE,
+					"age=%u\nchannel=%u\n\
+				        capinfo=0x%X\nrates=0x%X\nbasic_rates=0x%X\n", bss->age, bss->channel, bss->capinfo, bss->rates, bss->basic_rates);
+		}
+		break;
+	case OID_TYPE_BSSLIST:{
+			struct obj_bsslist *list = r->ptr;
+			int i, k;
+			k = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", list->nr);
+			for (i = 0; i < list->nr; i++)
+				k += snprintf(str + k, PRIV_STR_SIZE - k,
+					      "bss[%u] : \nage=%u\nchannel=%u\ncapinfo=0x%X\nrates=0x%X\nbasic_rates=0x%X\n",
+					      i, list->bsslist[i].age,
+					      list->bsslist[i].channel,
+					      list->bsslist[i].capinfo,
+					      list->bsslist[i].rates,
+					      list->bsslist[i].basic_rates);
+			return k;
+		}
+		break;
+	case OID_TYPE_FREQUENCIES:{
+			struct obj_frequencies *freq = r->ptr;
+			int i, t;
+			printk("nr : %u\n", freq->nr);
+			t = snprintf(str, PRIV_STR_SIZE, "nr=%u\n", freq->nr);
+			for (i = 0; i < freq->nr; i++)
+				t += snprintf(str + t, PRIV_STR_SIZE - t,
+					      "mhz[%u]=%u\n", i, freq->mhz[i]);
+			return t;
+		}
+		break;
+	case OID_TYPE_MLME:{
+			struct obj_mlme *mlme = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE, "id=0x%X\nstate=0x%X\n\
+			         code=0x%X\n", mlme->id, mlme->state,
+					mlme->code);
+		}
+		break;
+	case OID_TYPE_MLMEEX:{
+			struct obj_mlmeex *mlme = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE, "id=0x%X\nstate=0x%X\n\
+			         code=0x%X\nsize=0x%X\n", mlme->id, mlme->state,
+					mlme->code, mlme->size);
+		}
+		break;
+	case OID_TYPE_SSID:{
+			struct obj_ssid *ssid = r->ptr;
+			return snprintf(str, PRIV_STR_SIZE,
+					"length=%u\noctets=%s\n",
+					ssid->length, ssid->octets);
+		}
+		break;
+	case OID_TYPE_KEY:{
+			struct obj_key *key = r->ptr;
+			int t, i;
+			t = snprintf(str, PRIV_STR_SIZE,
+				     "type=0x%X\nlength=0x%X\nkey=0x",
+				     key->type, key->length);
+			for (i = 0; i < key->length; i++)
+				t += snprintf(str + t, PRIV_STR_SIZE - t,
+					      "%02X:", key->key[i]);
+			t += snprintf(str + t, PRIV_STR_SIZE - t, "\n");
+			return t;
+		}
+		break;
+	case OID_TYPE_RAW:
+	case OID_TYPE_ADDR:{
+			unsigned char *buff = r->ptr;
+			int t, i;
+			t = snprintf(str, PRIV_STR_SIZE, "hex data=");
+			for (i = 0; i < isl_oid[n].size; i++)
+				t += snprintf(str + t, PRIV_STR_SIZE - t,
+					      "%02X:", buff[i]);
+			t += snprintf(str + t, PRIV_STR_SIZE - t, "\n");
+			return t;
+		}
+		break;
+	default:
+		BUG();
+	}
 	return 0;
 }
diff -Nru a/drivers/net/wireless/prism54/oid_mgt.h b/drivers/net/wireless/prism54/oid_mgt.h
--- a/drivers/net/wireless/prism54/oid_mgt.h	Tue Jun 15 22:21:03 2004
+++ b/drivers/net/wireless/prism54/oid_mgt.h	Tue Jun 15 22:21:03 2004
@@ -1,4 +1,4 @@
-/*   
+/*
  *  Copyright (C) 2003 Aurelien Alleaume <slts@free.fr>
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -28,9 +28,12 @@
 
 void mgt_clean(islpci_private *);
 
+/* I don't know where to put these 3 */
 extern const int frequency_list_bg[];
-
 extern const int frequency_list_a[];
+int channel_of_freq(int);
+
+void mgt_le_to_cpu(int, void *);
 
 int mgt_set_request(islpci_private *, enum oid_num_t, int, void *);
 
@@ -41,11 +44,15 @@
 
 void mgt_set(islpci_private *, enum oid_num_t, void *);
 
+void mgt_get(islpci_private *, enum oid_num_t, void *);
+
 void mgt_commit(islpci_private *);
 
 int mgt_mlme_answer(islpci_private *);
 
 enum oid_num_t mgt_oidtonum(u32 oid);
+
+int mgt_response_to_str(enum oid_num_t, union oid_res_t *, char *);
 
 #endif				/* !defined(_OID_MGT_H) */
 /* EOF */
diff -Nru a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
--- a/drivers/net/wireless/wavelan_cs.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/net/wireless/wavelan_cs.c	Tue Jun 15 22:20:41 2004
@@ -1841,7 +1841,7 @@
 #endif	/* HISTOGRAM */
 
 static inline int
-wl_netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+wl_netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	u32 ethcmd;
 
@@ -2764,7 +2764,7 @@
   switch(cmd)
     {
     case SIOCETHTOOL:
-      ret = wl_netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+      ret = wl_netdev_ethtool_ioctl(dev, rq->ifr_data);
       break;
 
       /* ------------------- OTHER IOCTL ------------------- */
diff -Nru a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
--- a/drivers/net/wireless/wl3501_cs.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/net/wireless/wl3501_cs.c	Tue Jun 15 22:20:35 2004
@@ -1487,7 +1487,7 @@
 	return wstats;
 }
 
-static inline int wl3501_ethtool_ioctl(struct net_device *dev, void *uaddr)
+static inline int wl3501_ethtool_ioctl(struct net_device *dev, void __user *uaddr)
 {
 	u32 ethcmd;
 	int rc = -EFAULT;
@@ -1532,7 +1532,7 @@
 	if (netif_device_present(dev)) {
 		rc = -EOPNOTSUPP;
 		if (cmd == SIOCETHTOOL)
-			rc = wl3501_ethtool_ioctl(dev, (void *)rq->ifr_data);
+			rc = wl3501_ethtool_ioctl(dev, rq->ifr_data);
 	}
 	return rc;
 }
diff -Nru a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
--- a/drivers/net/yellowfin.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/net/yellowfin.c	Tue Jun 15 22:20:39 2004
@@ -1405,7 +1405,7 @@
 	outw(cfg_value | 0x1000, ioaddr + Cnfg);
 }
 
-static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	struct yellowfin_private *np = dev->priv;
 	u32 ethcmd;
@@ -1433,11 +1433,11 @@
 {
 	struct yellowfin_private *np = dev->priv;
 	long ioaddr = dev->base_addr;
-	struct mii_ioctl_data *data = (struct mii_ioctl_data *)&rq->ifr_data;
+	struct mii_ioctl_data *data = if_mii(rq);
 
 	switch(cmd) {
 	case SIOCETHTOOL:
-		return netdev_ethtool_ioctl(dev, (void *) rq->ifr_data);
+		return netdev_ethtool_ioctl(dev, rq->ifr_data);
 	case SIOCGMIIPHY:		/* Get address of MII PHY in use. */
 		data->phy_id = np->phys[0] & 0x1f;
 		/* Fall Through */
diff -Nru a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
--- a/drivers/oprofile/event_buffer.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/oprofile/event_buffer.c	Tue Jun 15 22:20:36 2004
@@ -142,7 +142,7 @@
 }
 
 
-ssize_t event_buffer_read(struct file * file, char * buf, size_t count, loff_t * offset)
+ssize_t event_buffer_read(struct file * file, char __user * buf, size_t count, loff_t * offset)
 {
 	int retval = -EINVAL;
 	size_t const max = buffer_size * sizeof(unsigned long);
diff -Nru a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c
--- a/drivers/oprofile/oprofile_files.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/oprofile/oprofile_files.c	Tue Jun 15 22:20:40 2004
@@ -19,9 +19,9 @@
 unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
 
  
-static ssize_t pointer_size_read(struct file * file, char * buf, size_t count, loff_t * offset)
+static ssize_t pointer_size_read(struct file * file, char __user * buf, size_t count, loff_t * offset)
 {
-	return oprofilefs_ulong_to_user((unsigned long)sizeof(void *), buf, count, offset);
+	return oprofilefs_ulong_to_user(sizeof(void *), buf, count, offset);
 }
 
 
@@ -30,7 +30,7 @@
 };
 
 
-static ssize_t cpu_type_read(struct file * file, char * buf, size_t count, loff_t * offset)
+static ssize_t cpu_type_read(struct file * file, char __user * buf, size_t count, loff_t * offset)
 {
 	return oprofilefs_str_to_user(oprofile_ops->cpu_type, buf, count, offset);
 }
@@ -41,13 +41,13 @@
 };
  
  
-static ssize_t enable_read(struct file * file, char * buf, size_t count, loff_t * offset)
+static ssize_t enable_read(struct file * file, char __user * buf, size_t count, loff_t * offset)
 {
 	return oprofilefs_ulong_to_user(oprofile_started, buf, count, offset);
 }
 
 
-static ssize_t enable_write(struct file *file, char const * buf, size_t count, loff_t * offset)
+static ssize_t enable_write(struct file *file, char const __user * buf, size_t count, loff_t * offset)
 {
 	unsigned long val;
 	int retval;
@@ -76,7 +76,7 @@
 };
 
 
-static ssize_t dump_write(struct file *file, char const * buf, size_t count, loff_t * offset)
+static ssize_t dump_write(struct file *file, char const __user * buf, size_t count, loff_t * offset)
 {
 	wake_up_buffer_waiter();
 	return count;
diff -Nru a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
--- a/drivers/oprofile/oprofilefs.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/oprofile/oprofilefs.c	Tue Jun 15 22:20:39 2004
@@ -45,7 +45,7 @@
 };
 
 
-ssize_t oprofilefs_str_to_user(char const * str, char * buf, size_t count, loff_t * offset)
+ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count, loff_t * offset)
 {
 	size_t len = strlen(str);
 
@@ -69,7 +69,7 @@
 
 #define TMPBUFSIZE 50
 
-ssize_t oprofilefs_ulong_to_user(unsigned long val, char * buf, size_t count, loff_t * offset)
+ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t count, loff_t * offset)
 {
 	char tmpbuf[TMPBUFSIZE];
 	size_t maxlen;
@@ -98,7 +98,7 @@
 }
 
 
-int oprofilefs_ulong_from_user(unsigned long * val, char const * buf, size_t count)
+int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count)
 {
 	char tmpbuf[TMPBUFSIZE];
 
@@ -120,14 +120,14 @@
 }
 
 
-static ssize_t ulong_read_file(struct file * file, char * buf, size_t count, loff_t * offset)
+static ssize_t ulong_read_file(struct file * file, char __user * buf, size_t count, loff_t * offset)
 {
 	unsigned long * val = file->private_data;
 	return oprofilefs_ulong_to_user(*val, buf, count, offset);
 }
 
 
-static ssize_t ulong_write_file(struct file * file, char const * buf, size_t count, loff_t * offset)
+static ssize_t ulong_write_file(struct file * file, char const __user * buf, size_t count, loff_t * offset)
 {
 	unsigned long * value = file->private_data;
 	int retval;
@@ -211,7 +211,7 @@
 }
 
 
-static ssize_t atomic_read_file(struct file * file, char * buf, size_t count, loff_t * offset)
+static ssize_t atomic_read_file(struct file * file, char __user * buf, size_t count, loff_t * offset)
 {
 	atomic_t * val = file->private_data;
 	return oprofilefs_ulong_to_user(atomic_read(val), buf, count, offset);
diff -Nru a/drivers/parisc/superio.c b/drivers/parisc/superio.c
--- a/drivers/parisc/superio.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/parisc/superio.c	Tue Jun 15 22:20:42 2004
@@ -63,7 +63,6 @@
 #include <linux/ioport.h>
 #include <linux/serial.h>
 #include <linux/pci.h>
-#include <linux/ioport.h>
 #include <linux/parport.h>
 #include <linux/parport_pc.h>
 #include <linux/termios.h>
@@ -71,6 +70,7 @@
 #include <linux/serial_core.h>
 #include <linux/delay.h>
 #include <linux/ide.h>
+
 #include <asm/io.h>
 #include <asm/hardware.h>
 #include <asm/irq.h>
diff -Nru a/drivers/parisc/wax.c b/drivers/parisc/wax.c
--- a/drivers/parisc/wax.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/parisc/wax.c	Tue Jun 15 22:20:43 2004
@@ -17,7 +17,6 @@
 #include <linux/ioport.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/slab.h>
 #include <linux/types.h>
 
 #include <asm/io.h>
diff -Nru a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
--- a/drivers/parport/parport_pc.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/parport/parport_pc.c	Tue Jun 15 22:21:04 2004
@@ -2699,7 +2699,7 @@
 	 * and 840 locks up if you write 1 to bit 2! */
 	/* oxsemi_954 */		{ 1, { { 0, -1 }, } },
 	/* oxsemi_840 */		{ 1, { { 0, -1 }, } },
-	/* aks_0100 */			{ 1, { { 0, 1 }, } },
+	/* aks_0100 */                  { 1, { { 0, -1 }, } },
 	/* mobility_pp */		{ 1, { { 0, 1 }, } },
 };
 
diff -Nru a/drivers/parport/procfs.c b/drivers/parport/procfs.c
--- a/drivers/parport/procfs.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/parport/procfs.c	Tue Jun 15 22:20:38 2004
@@ -33,7 +33,7 @@
 #define PARPORT_MAX_SPINTIME_VALUE 1000
 
 static int do_active_device(ctl_table *table, int write, struct file *filp,
-		      void *result, size_t *lenp)
+		      void __user *result, size_t *lenp)
 {
 	struct parport *port = (struct parport *)table->extra1;
 	char buffer[256];
@@ -70,7 +70,7 @@
 
 #ifdef CONFIG_PARPORT_1284
 static int do_autoprobe(ctl_table *table, int write, struct file *filp,
-			void *result, size_t *lenp)
+			void __user *result, size_t *lenp)
 {
 	struct parport_device_info *info = table->extra2;
 	const char *str;
@@ -112,7 +112,7 @@
 #endif /* IEEE1284.3 support. */
 
 static int do_hardware_base_addr (ctl_table *table, int write,
-				  struct file *filp, void *result,
+				  struct file *filp, void __user *result,
 				  size_t *lenp)
 {
 	struct parport *port = (struct parport *)table->extra1;
@@ -140,7 +140,7 @@
 }
 
 static int do_hardware_irq (ctl_table *table, int write,
-			    struct file *filp, void *result,
+			    struct file *filp, void __user *result,
 			    size_t *lenp)
 {
 	struct parport *port = (struct parport *)table->extra1;
@@ -168,7 +168,7 @@
 }
 
 static int do_hardware_dma (ctl_table *table, int write,
-			    struct file *filp, void *result,
+			    struct file *filp, void __user *result,
 			    size_t *lenp)
 {
 	struct parport *port = (struct parport *)table->extra1;
@@ -196,7 +196,7 @@
 }
 
 static int do_hardware_modes (ctl_table *table, int write,
-			      struct file *filp, void *result,
+			      struct file *filp, void __user *result,
 			      size_t *lenp)
 {
 	struct parport *port = (struct parport *)table->extra1;
diff -Nru a/drivers/parport/share.c b/drivers/parport/share.c
--- a/drivers/parport/share.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/parport/share.c	Tue Jun 15 22:20:40 2004
@@ -169,7 +169,7 @@
 
 /**
  *	parport_unregister_driver - deregister a parallel port device driver
- *	@arg: structure describing the driver that was given to
+ *	@drv: structure describing the driver that was given to
  *	      parport_register_driver()
  *
  *	This should be called by a parallel port device driver that
diff -Nru a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h
--- a/drivers/pci/hotplug/acpiphp.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/pci/hotplug/acpiphp.h	Tue Jun 15 22:21:05 2004
@@ -47,7 +47,6 @@
 #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
 #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
 
-#define SLOT_MAGIC	0x67267322
 /* name size which is used for entries in pcihpfs */
 #define SLOT_NAME_SIZE	KOBJ_NAME_LEN		/* {_SUN} */
 
@@ -59,7 +58,6 @@
  * struct slot - slot information for each *physical* slot
  */
 struct slot {
-	u32 magic;
 	u8 number;
 	struct hotplug_slot	*hotplug_slot;
 	struct list_head	slot_list;
@@ -220,9 +218,7 @@
 extern int acpiphp_get_num_slots (void);
 extern struct acpiphp_slot *get_slot_from_id (int id);
 typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
-extern int acpiphp_for_each_slot (acpiphp_callback fn, void *data);
 
-extern int acpiphp_check_bridge (struct acpiphp_bridge *bridge);
 extern int acpiphp_enable_slot (struct acpiphp_slot *slot);
 extern int acpiphp_disable_slot (struct acpiphp_slot *slot);
 extern u8 acpiphp_get_power_status (struct acpiphp_slot *slot);
@@ -241,7 +237,6 @@
 
 /* acpiphp_res.c */
 extern struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 size);
-extern struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 size);
 extern struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size);
 extern struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head, u64 base, u32 size);
 extern int acpiphp_resource_sort_and_combine (struct pci_resource **head);
diff -Nru a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
--- a/drivers/pci/hotplug/acpiphp_core.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/pci/hotplug/acpiphp_core.c	Tue Jun 15 22:20:42 2004
@@ -32,6 +32,7 @@
 
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 
 #include <linux/kernel.h>
 #include <linux/pci.h>
@@ -43,11 +44,7 @@
 
 static LIST_HEAD(slot_list);
 
-#if !defined(CONFIG_HOTPLUG_PCI_ACPI_MODULE)
-	#define MY_NAME	"acpiphp"
-#else
-	#define MY_NAME	THIS_MODULE->name
-#endif
+#define MY_NAME	"acpiphp"
 
 static int debug;
 int acpiphp_debug;
@@ -62,72 +59,28 @@
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
 MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
+module_param(debug, bool, 644);
 
 static int enable_slot		(struct hotplug_slot *slot);
 static int disable_slot		(struct hotplug_slot *slot);
 static int set_attention_status (struct hotplug_slot *slot, u8 value);
-static int hardware_test	(struct hotplug_slot *slot, u32 value);
 static int get_power_status	(struct hotplug_slot *slot, u8 *value);
-static int get_attention_status	(struct hotplug_slot *slot, u8 *value);
 static int get_address		(struct hotplug_slot *slot, u32 *value);
 static int get_latch_status	(struct hotplug_slot *slot, u8 *value);
 static int get_adapter_status	(struct hotplug_slot *slot, u8 *value);
-static int get_max_bus_speed	(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value);
-static int get_cur_bus_speed	(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value);
 
 static struct hotplug_slot_ops acpi_hotplug_slot_ops = {
 	.owner			= THIS_MODULE,
 	.enable_slot		= enable_slot,
 	.disable_slot		= disable_slot,
 	.set_attention_status	= set_attention_status,
-	.hardware_test		= hardware_test,
 	.get_power_status	= get_power_status,
-	.get_attention_status	= get_attention_status,
 	.get_latch_status	= get_latch_status,
 	.get_adapter_status	= get_adapter_status,
 	.get_address		= get_address,
-	.get_max_bus_speed	= get_max_bus_speed,
-	.get_cur_bus_speed	= get_cur_bus_speed,
 };
 
-
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int slot_paranoia_check (struct slot *slot, const char *function)
-{
-	if (!slot) {
-		dbg("%s - slot == NULL\n", function);
-		return -1;
-	}
-	if (slot->magic != SLOT_MAGIC) {
-		dbg("%s - bad magic number for slot\n", function);
-		return -1;
-	}
-	if (!slot->hotplug_slot) {
-		dbg("%s - slot->hotplug_slot == NULL!\n", function);
-		return -1;
-	}
-	return 0;
-}
-
-
-static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function)
-{
-	struct slot *slot;
-
-	if (!hotplug_slot) {
-		dbg("%s - hotplug_slot == NULL\n", function);
-		return NULL;
-	}
-
-	slot = (struct slot *)hotplug_slot->private;
-	if (slot_paranoia_check(slot, function))
-                return NULL;
-	return slot;
-}
-
-
 /**
  * enable_slot - power on and enable a slot
  * @hotplug_slot: slot to enable
@@ -135,20 +88,14 @@
  * Actual tasks are done in acpiphp_enable_slot()
  *
  */
-static int enable_slot (struct hotplug_slot *hotplug_slot)
+static int enable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-	int retval = 0;
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	/* enable the specified slot */
-	retval = acpiphp_enable_slot(slot->acpi_slot);
-
-	return retval;
+	return acpiphp_enable_slot(slot->acpi_slot);
 }
 
 
@@ -159,20 +106,14 @@
  * Actual tasks are done in acpiphp_disable_slot()
  *
  */
-static int disable_slot (struct hotplug_slot *hotplug_slot)
+static int disable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-	int retval = 0;
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	/* disable the specified slot */
-	retval = acpiphp_disable_slot(slot->acpi_slot);
-
-	return retval;
+	return acpiphp_disable_slot(slot->acpi_slot);
 }
 
 
@@ -184,10 +125,8 @@
  * attention status LED.
  *
  */
-static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
+static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
 {
-	int retval = 0;
-
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	switch (status) {
@@ -203,33 +142,9 @@
 			break;
 	}
 
-	return retval;
-}
-
-
-/**
- * hardware_test - hardware test
- *
- * We have nothing to do for now...
- *
- */
-static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
-{
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-	int retval = 0;
-
-	if (slot == NULL)
-		return -ENODEV;
-
-	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
-
-	err("No hardware tests are defined for this driver\n");
-	retval = -ENODEV;
-
-	return retval;
+	return 0;
 }
 
-
 /**
  * get_power_status - get power status of a slot
  * @hotplug_slot: slot to get status
@@ -239,41 +154,17 @@
  * In that case, the value returned may not be reliable.
  *
  */
-static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-	int retval = 0;
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	*value = acpiphp_get_power_status(slot->acpi_slot);
 
-	return retval;
-}
-
-
-/**
- * get_attention_status - get attention LED status
- *
- * TBD:
- * ACPI doesn't provide any formal means to access attention LED status.
- *
- */
-static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
-{
-	int retval = 0;
-
-	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
-
-	*value = hotplug_slot->info->attention_status;
-
-	return retval;
+	return 0;
 }
 
-
 /**
  * get_latch_status - get latch status of a slot
  * @hotplug_slot: slot to get status
@@ -283,19 +174,15 @@
  * Instead, we fake latch status from _STA
  *
  */
-static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-	int retval = 0;
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	*value = acpiphp_get_latch_status(slot->acpi_slot);
 
-	return retval;
+	return 0;
 }
 
 
@@ -308,19 +195,15 @@
  * Instead, we fake adapter status from _STA
  *
  */
-static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-	int retval = 0;
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	*value = acpiphp_get_adapter_status(slot->acpi_slot);
 
-	return retval;
+	return 0;
 }
 
 
@@ -330,51 +213,18 @@
  * @busdev: pointer to struct pci_busdev (seg, bus, dev)
  *
  */
-static int get_address (struct hotplug_slot *hotplug_slot, u32 *value)
+static int get_address(struct hotplug_slot *hotplug_slot, u32 *value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-	int retval = 0;
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	*value = acpiphp_get_address(slot->acpi_slot);
 
-	return retval;
-}
-
-
-/* return dummy value because ACPI doesn't provide any method... */
-static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
-{
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
-
-	*value = PCI_SPEED_UNKNOWN;
-
-	return 0;
-}
-
-
-/* return dummy value because ACPI doesn't provide any method... */
-static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
-{
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
-
-	*value = PCI_SPEED_UNKNOWN;
-
 	return 0;
 }
 
-
-static int __init init_acpi (void)
+static int __init init_acpi(void)
 {
 	int retval;
 
@@ -397,7 +247,7 @@
  * @slot: slot to name
  *
  */
-static void make_slot_name (struct slot *slot)
+static void make_slot_name(struct slot *slot)
 {
 	snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%u",
 		 slot->acpi_slot->sun);
@@ -409,10 +259,7 @@
  */
 static void release_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
@@ -426,42 +273,32 @@
  * init_slots - initialize 'struct slot' structures for each slot
  *
  */
-static int __init init_slots (void)
+static int __init init_slots(void)
 {
 	struct slot *slot;
-	int retval = 0;
+	int retval = -ENOMEM;
 	int i;
 
 	for (i = 0; i < num_slots; ++i) {
 		slot = kmalloc(sizeof(struct slot), GFP_KERNEL);
 		if (!slot)
-			return -ENOMEM;
+			goto error;
 		memset(slot, 0, sizeof(struct slot));
 
 		slot->hotplug_slot = kmalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
-		if (!slot->hotplug_slot) {
-			kfree(slot);
-			return -ENOMEM;
-		}
+		if (!slot->hotplug_slot)
+			goto error_slot;
 		memset(slot->hotplug_slot, 0, sizeof(struct hotplug_slot));
 
 		slot->hotplug_slot->info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
-		if (!slot->hotplug_slot->info) {
-			kfree(slot->hotplug_slot);
-			kfree(slot);
-			return -ENOMEM;
-		}
+		if (!slot->hotplug_slot->info)
+			goto error_hpslot;
 		memset(slot->hotplug_slot->info, 0, sizeof(struct hotplug_slot_info));
 
 		slot->hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
-		if (!slot->hotplug_slot->name) {
-			kfree(slot->hotplug_slot->info);
-			kfree(slot->hotplug_slot);
-			kfree(slot);
-			return -ENOMEM;
-		}
+		if (!slot->hotplug_slot->name)
+			goto error_info;
 
-		slot->magic = SLOT_MAGIC;
 		slot->number = i;
 
 		slot->hotplug_slot->private = slot;
@@ -473,14 +310,15 @@
 		slot->hotplug_slot->info->attention_status = acpiphp_get_attention_status(slot->acpi_slot);
 		slot->hotplug_slot->info->latch_status = acpiphp_get_latch_status(slot->acpi_slot);
 		slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot);
+		slot->hotplug_slot->info->max_bus_speed = PCI_SPEED_UNKNOWN;
+		slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
 
 		make_slot_name(slot);
 
 		retval = pci_hp_register(slot->hotplug_slot);
 		if (retval) {
 			err("pci_hp_register failed with error %d\n", retval);
-			release_slot(slot->hotplug_slot);
-			return retval;
+			goto error_name;
 		}
 
 		/* add slot to our internal list */
@@ -488,6 +326,16 @@
 		info("Slot [%s] registered\n", slot->hotplug_slot->name);
 	}
 
+	return 0;
+error_name:
+	kfree(slot->hotplug_slot->name);
+error_info:
+	kfree(slot->hotplug_slot->info);
+error_hpslot:
+	kfree(slot->hotplug_slot);
+error_slot:
+	kfree(slot);
+error:
 	return retval;
 }
 
@@ -503,8 +351,6 @@
 		list_del(&slot->slot_list);
 		pci_hp_deregister(slot->hotplug_slot);
 	}
-
-	return;
 }
 
 
@@ -521,11 +367,7 @@
 	if (retval)
 		return retval;
 
-	retval = init_slots();
-	if (retval)
-		return retval;
-
-	return 0;
+	return init_slots();
 }
 
 
diff -Nru a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
--- a/drivers/pci/hotplug/acpiphp_glue.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/pci/hotplug/acpiphp_glue.c	Tue Jun 15 22:20:38 2004
@@ -66,7 +66,7 @@
  *  4. ..
  *
  */
-static int is_ejectable (acpi_handle handle)
+static int is_ejectable(acpi_handle handle)
 {
 	acpi_status status;
 	acpi_handle tmp;
@@ -326,10 +326,10 @@
 	bridge->hpp.enable_PERR = package->package.elements[3].integer.value;
 
 	dbg("_HPP parameter = (%02x, %02x, %02x, %02x)\n",
-	    bridge->hpp.cache_line_size,
-	    bridge->hpp.latency_timer,
-	    bridge->hpp.enable_SERR,
-	    bridge->hpp.enable_PERR);
+		bridge->hpp.cache_line_size,
+		bridge->hpp.latency_timer,
+		bridge->hpp.enable_SERR,
+		bridge->hpp.enable_PERR);
 
 	bridge->flags |= BRIDGE_HAS_HPP;
 
@@ -919,6 +919,48 @@
 	return (unsigned int)sta;
 }
 
+/**
+ * acpiphp_check_bridge - re-enumerate devices
+ *
+ * Iterate over all slots under this bridge and make sure that if a
+ * card is present they are enabled, and if not they are disabled.
+ */
+static int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
+{
+	struct acpiphp_slot *slot;
+	int retval = 0;
+	int enabled, disabled;
+
+	enabled = disabled = 0;
+
+	for (slot = bridge->slots; slot; slot = slot->next) {
+		unsigned int status = get_slot_status(slot);
+		if (slot->flags & SLOT_ENABLED) {
+			if (status == ACPI_STA_ALL)
+				continue;
+			retval = acpiphp_disable_slot(slot);
+			if (retval) {
+				err("Error occurred in disabling\n");
+				goto err_exit;
+			}
+			disabled++;
+		} else {
+			if (status != ACPI_STA_ALL)
+				continue;
+			retval = acpiphp_enable_slot(slot);
+			if (retval) {
+				err("Error occurred in enabling\n");
+				goto err_exit;
+			}
+			enabled++;
+		}
+	}
+
+	dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled);
+
+ err_exit:
+	return retval;
+}
 
 /*
  * ACPI event handlers
@@ -1113,6 +1155,8 @@
 
 		kfree(bridge);
 	}
+
+	acpi_pci_unregister_driver(&acpi_pci_hp_driver);
 }
 
 
@@ -1138,13 +1182,14 @@
 }
 
 
+#if 0
 /**
  * acpiphp_for_each_slot - call function for each slot
  * @fn: callback function
  * @data: context to be passed to callback function
  *
  */
-int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
+static int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
 {
 	struct list_head *node;
 	struct acpiphp_bridge *bridge;
@@ -1163,7 +1208,7 @@
  err_exit:
 	return retval;
 }
-
+#endif
 
 /* search matching slot from id  */
 struct acpiphp_slot *get_slot_from_id(int id)
@@ -1180,7 +1225,8 @@
 	}
 
 	/* should never happen! */
-	err("%s: no object for id %d\n",__FUNCTION__, id);
+	err("%s: no object for id %d\n", __FUNCTION__, id);
+	WARN_ON(1);
 	return 0;
 }
 
@@ -1237,50 +1283,6 @@
 
  err_exit:
 	up(&slot->crit_sect);
-	return retval;
-}
-
-
-/**
- * acpiphp_check_bridge - re-enumerate devices
- *
- * Iterate over all slots under this bridge and make sure that if a
- * card is present they are enabled, and if not they are disabled.
- */
-int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
-{
-	struct acpiphp_slot *slot;
-	int retval = 0;
-	int enabled, disabled;
-
-	enabled = disabled = 0;
-
-	for (slot = bridge->slots; slot; slot = slot->next) {
-		unsigned int status = get_slot_status(slot);
-		if (slot->flags & SLOT_ENABLED) {
-			if (status == ACPI_STA_ALL)
-				continue;
-			retval = acpiphp_disable_slot(slot);
-			if (retval) {
-				err("Error occurred in disabling\n");
-				goto err_exit;
-			}
-			disabled++;
-		} else {
-			if (status != ACPI_STA_ALL)
-				continue;
-			retval = acpiphp_enable_slot(slot);
-			if (retval) {
-				err("Error occurred in enabling\n");
-				goto err_exit;
-			}
-			enabled++;
-		}
-	}
-
-	dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled);
-
- err_exit:
 	return retval;
 }
 
diff -Nru a/drivers/pci/hotplug/acpiphp_res.c b/drivers/pci/hotplug/acpiphp_res.c
--- a/drivers/pci/hotplug/acpiphp_res.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pci/hotplug/acpiphp_res.c	Tue Jun 15 22:20:39 2004
@@ -105,7 +105,7 @@
 	return 0;
 }
 
-
+#if 0
 /*
  * sort_by_max_size - sort nodes by their length, largest first
  */
@@ -151,6 +151,7 @@
 
 	return 0;
 }
+#endif
 
 /**
  * get_io_resource - get resource for I/O ports
@@ -247,6 +248,7 @@
 }
 
 
+#if 0
 /**
  * get_max_resource - get the largest resource
  *
@@ -254,7 +256,7 @@
  * list pointed to by head.  It aligns the node on top and bottom
  * to "size" alignment before returning it.
  */
-struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 size)
+static struct pci_resource *acpiphp_get_max_resource (struct pci_resource **head, u32 size)
 {
 	struct pci_resource *max;
 	struct pci_resource *temp;
@@ -340,7 +342,7 @@
 	/* If we get here, we couldn't find one */
 	return NULL;
 }
-
+#endif
 
 /**
  * get_resource - get resource (mem, pfmem)
diff -Nru a/drivers/pci/hotplug/cpci_hotplug.h b/drivers/pci/hotplug/cpci_hotplug.h
--- a/drivers/pci/hotplug/cpci_hotplug.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/pci/hotplug/cpci_hotplug.h	Tue Jun 15 22:20:37 2004
@@ -40,9 +40,7 @@
 #define HS_CSR_EIM	0x0002
 #define HS_CSR_DHA	0x0001
 
-#define SLOT_MAGIC	0x67267322
 struct slot {
-	u32 magic;
 	u8 number;
 	unsigned int devfn;
 	struct pci_bus *bus;
@@ -86,7 +84,6 @@
 extern u8 cpci_get_latch_status(struct slot *slot);
 extern u8 cpci_get_adapter_status(struct slot *slot);
 extern u16 cpci_get_hs_csr(struct slot * slot);
-extern u16 cpci_set_hs_csr(struct slot * slot, u16 hs_csr);
 extern int cpci_set_attention_status(struct slot *slot, int status);
 extern int cpci_check_and_clear_ins(struct slot * slot);
 extern int cpci_check_ext(struct slot * slot);
diff -Nru a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
--- a/drivers/pci/hotplug/cpci_hotplug_core.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c	Tue Jun 15 22:20:39 2004
@@ -40,11 +40,7 @@
 #define DRIVER_AUTHOR	"Scott Murray <scottm@somanetworks.com>"
 #define DRIVER_DESC	"CompactPCI Hot Plug Core"
 
-#if !defined(CONFIG_HOTPLUG_CPCI_MODULE)
 #define MY_NAME	"cpci_hotplug"
-#else
-#define MY_NAME	THIS_MODULE->name
-#endif
 
 #define dbg(format, arg...)					\
 	do {							\
@@ -71,63 +67,21 @@
 static int set_attention_status(struct hotplug_slot *slot, u8 value);
 static int get_power_status(struct hotplug_slot *slot, u8 * value);
 static int get_attention_status(struct hotplug_slot *slot, u8 * value);
-static int get_latch_status(struct hotplug_slot *slot, u8 * value);
-static int get_adapter_status(struct hotplug_slot *slot, u8 * value);
 
 static struct hotplug_slot_ops cpci_hotplug_slot_ops = {
 	.owner = THIS_MODULE,
 	.enable_slot = enable_slot,
 	.disable_slot = disable_slot,
 	.set_attention_status = set_attention_status,
-	.hardware_test = NULL,
 	.get_power_status = get_power_status,
 	.get_attention_status = get_attention_status,
-	.get_latch_status = get_latch_status,
-	.get_adapter_status = get_adapter_status,
 };
 
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int
-slot_paranoia_check(struct slot *slot, const char *function)
-{
-	if(!slot) {
-		dbg("%s - slot == NULL", function);
-		return -1;
-	}
-	if(slot->magic != SLOT_MAGIC) {
-		dbg("%s - bad magic number for slot", function);
-		return -1;
-	}
-	if(!slot->hotplug_slot) {
-		dbg("%s - slot->hotplug_slot == NULL!", function);
-		return -1;
-	}
-	return 0;
-}
-
-static inline struct slot *
-get_slot(struct hotplug_slot *hotplug_slot, const char *function)
-{
-	struct slot *slot;
-
-	if(!hotplug_slot) {
-		dbg("%s - hotplug_slot == NULL", function);
-		return NULL;
-	}
-
-	slot = (struct slot *) hotplug_slot->private;
-	if(slot_paranoia_check(slot, function))
-		return NULL;
-	return slot;
-}
-
 static int
 update_latch_status(struct hotplug_slot *hotplug_slot, u8 value)
 {
 	struct hotplug_slot_info info;
 
-	if(!(hotplug_slot && hotplug_slot->info))
-		return -EINVAL;
 	memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
 	info.latch_status = value;
 	return pci_hp_change_slot_info(hotplug_slot, &info);
@@ -138,8 +92,6 @@
 {
 	struct hotplug_slot_info info;
 
-	if(!(hotplug_slot && hotplug_slot->info))
-		return -EINVAL;
 	memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
 	info.adapter_status = value;
 	return pci_hp_change_slot_info(hotplug_slot, &info);
@@ -148,12 +100,9 @@
 static int
 enable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
 
-	if(slot == NULL)
-		return -ENODEV;
-
 	dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
 
 	if(controller->ops->set_power) {
@@ -166,12 +115,9 @@
 static int
 disable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
 
-	if(slot == NULL)
-		return -ENODEV;
-
 	dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name);
 
 	/* Unconfigure device */
@@ -220,10 +166,8 @@
 static int
 get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 
-	if(slot == NULL)
-		return -ENODEV;
 	*value = cpci_get_power_status(slot);
 	return 0;
 }
@@ -231,10 +175,8 @@
 static int
 get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 
-	if(slot == NULL)
-		return -ENODEV;
 	*value = cpci_get_attention_status(slot);
 	return 0;
 }
@@ -242,48 +184,12 @@
 static int
 set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if(slot == NULL)
-		return -ENODEV;
-	switch (status) {
-	case 0:
-		cpci_set_attention_status(slot, 0);
-		break;
-
-	case 1:
-	default:
-		cpci_set_attention_status(slot, 1);
-		break;
-	}
-
-	return 0;
-}
-
-static int
-get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value)
-{
-	if(hotplug_slot == NULL || hotplug_slot->info == NULL)
-		return -ENODEV;
-	*value = hotplug_slot->info->latch_status;
-	return 0;
-}
-
-static int
-get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
-{
-	if(hotplug_slot == NULL || hotplug_slot->info == NULL)
-		return -ENODEV;
-	*value = hotplug_slot->info->adapter_status;
-	return 0;
+	return cpci_set_attention_status(hotplug_slot->private, status);
 }
 
 static void release_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if(slot == NULL)
-		return;
+	struct slot *slot = hotplug_slot->private;
 
 	kfree(slot->hotplug_slot->info);
 	kfree(slot->hotplug_slot->name);
@@ -306,15 +212,12 @@
 	struct hotplug_slot *hotplug_slot;
 	struct hotplug_slot_info *info;
 	char *name;
-	int status = 0;
+	int status = -ENOMEM;
 	int i;
 
 	if(!(controller && bus)) {
 		return -ENODEV;
 	}
-	if(last < first) {
-		return -EINVAL;
-	}
 
 	/*
 	 * Create a structure for each slot, and register that slot
@@ -322,38 +225,28 @@
 	 */
 	for (i = first; i <= last; ++i) {
 		slot = kmalloc(sizeof (struct slot), GFP_KERNEL);
-		if(!slot)
-			return -ENOMEM;
+		if (!slot)
+			goto error;
 		memset(slot, 0, sizeof (struct slot));
 
 		hotplug_slot =
 		    kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
-		if(!hotplug_slot) {
-			kfree(slot);
-			return -ENOMEM;
-		}
+		if (!hotplug_slot)
+			goto error_slot;
 		memset(hotplug_slot, 0, sizeof (struct hotplug_slot));
 		slot->hotplug_slot = hotplug_slot;
 
 		info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL);
-		if(!info) {
-			kfree(hotplug_slot);
-			kfree(slot);
-			return -ENOMEM;
-		}
+		if (!info)
+			goto error_hpslot;
 		memset(info, 0, sizeof (struct hotplug_slot_info));
 		hotplug_slot->info = info;
 
 		name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
-		if(!name) {
-			kfree(info);
-			kfree(hotplug_slot);
-			kfree(slot);
-			return -ENOMEM;
-		}
+		if (!name)
+			goto error_info;
 		hotplug_slot->name = name;
 
-		slot->magic = SLOT_MAGIC;
 		slot->bus = bus;
 		slot->number = i;
 		slot->devfn = PCI_DEVFN(i, 0);
@@ -373,13 +266,9 @@
 
 		dbg("registering slot %s", slot->hotplug_slot->name);
 		status = pci_hp_register(slot->hotplug_slot);
-		if(status) {
+		if (status) {
 			err("pci_hp_register failed with error %d", status);
-			kfree(info);
-			kfree(name);
-			kfree(hotplug_slot);
-			kfree(slot);
-			return status;
+			goto error_name;
 		}
 
 		/* Add slot to our internal list */
@@ -388,6 +277,16 @@
 		slots++;
 		spin_unlock(&list_lock);
 	}
+	return 0;
+error_name:
+	kfree(name);
+error_info:
+	kfree(info);
+error_hpslot:
+	kfree(hotplug_slot);
+error_slot:
+	kfree(slot);
+error:
 	return status;
 }
 
@@ -399,10 +298,6 @@
 	struct list_head *next;
 	int status;
 
-	if(!bus) {
-		return -ENODEV;
-	}
-
 	spin_lock(&list_lock);
 	if(!slots) {
 		spin_unlock(&list_lock);
@@ -428,7 +323,7 @@
 }
 
 /* This is the interrupt mode interrupt handler */
-irqreturn_t
+static irqreturn_t
 cpci_hp_intr(int irq, void *data, struct pt_regs *regs)
 {
 	dbg("entered cpci_hp_intr");
@@ -890,7 +785,6 @@
 	 */
 	cleanup_slots();
 }
-
 
 EXPORT_SYMBOL_GPL(cpci_hp_register_controller);
 EXPORT_SYMBOL_GPL(cpci_hp_unregister_controller);
diff -Nru a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c	Tue Jun 15 22:20:42 2004
@@ -127,6 +127,7 @@
 	return hs_csr;
 }
 
+#if 0
 u16 cpci_set_hs_csr(struct slot* slot, u16 hs_csr)
 {
 	int hs_cap;
@@ -156,6 +157,7 @@
 	}
 	return new_hs_csr;
 }
+#endif
 
 int cpci_check_and_clear_ins(struct slot* slot)
 {
diff -Nru a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c
--- a/drivers/pci/hotplug/cpcihp_generic.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/pci/hotplug/cpcihp_generic.c	Tue Jun 15 22:20:40 2004
@@ -76,73 +76,6 @@
 static struct cpci_hp_controller_ops generic_hpc_ops;
 static struct cpci_hp_controller generic_hpc;
 
-/* The following allows configuring the driver when it's compiled into the kernel */
-#ifndef MODULE
-static int __init cpcihp_generic_setup(char* str)
-{
-	char* p;
-	unsigned long tmp;
-
-	if(!str)
-		return -EINVAL;
-	bridge = str;
-
-	p = strchr(str, ',');
-	str = p + 1;
-	if(!(p && *str && *p == ','))
-		goto setup_error;
-	tmp = simple_strtoul(str, &p, 0);
-	if(p == str || tmp > 0xff) {
-		err("hotplug bus first slot number out of range");
-		goto setup_error;
-	}
-	first_slot = (u8) tmp;
-
-	str = p + 1;		
-	if(!(*str && *p == ','))
-		return -EINVAL;
-	tmp = simple_strtoul(str, &p, 0);
-	if(p == str || tmp > 0xff) {
-		err("hotplug bus last slot number out of range");
-		goto setup_error;
-	}
-	last_slot = (u8) tmp;
-
-	str = p + 1;
-	if(!(*str && *p == ','))
-		goto setup_error;
-	tmp = simple_strtoul(str, &p, 0);
-	if(p == str || tmp > 0xffff) {
-		err("port number out of range");
-		goto setup_error;
-	}
-	port = (u16) tmp;
-
-	str = p + 1;
-	if(!(*str && *p == ','))
-		goto setup_error;
-	tmp = simple_strtoul(str, &p, 0);
-	if(p == str) {
-		err("invalid #ENUM bit number");
-		goto setup_error;
-	}
-	enum_bit = (u8) tmp;
-
-	str = p + 1;
-	if(*str && *p == ',') {
-		tmp = simple_strtoul(str, &p, 0);
-		if(p != str)
-			debug = (int) tmp;
-	}
-	return 0;
-setup_error:
-	bridge = NULL;
-	return -EINVAL;
-}
-
-__setup("cpcihp_generic=", cpcihp_generic_setup);
-#endif
-
 static int __init validate_parameters(void)
 {
 	char* str;
diff -Nru a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c
--- a/drivers/pci/hotplug/cpcihp_zt5550.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pci/hotplug/cpcihp_zt5550.c	Tue Jun 15 22:20:41 2004
@@ -32,6 +32,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/pci.h>
@@ -42,11 +43,7 @@
 #define DRIVER_AUTHOR	"Scott Murray <scottm@somanetworks.com>"
 #define DRIVER_DESC	"ZT5550 CompactPCI Hot Plug Driver"
 
-#if !defined(CONFIG_HOTPLUG_PCI_CPCI_ZT5550_MODULE)
 #define MY_NAME	"cpcihp_zt5550"
-#else
-#define MY_NAME	THIS_MODULE->name
-#endif
 
 #define dbg(format, arg...)					\
 	do {							\
@@ -175,7 +172,7 @@
 	return 0;
 }
 
-int zt5550_hc_disable_irq(void)
+static int zt5550_hc_disable_irq(void)
 {
 	u8 reg;
 
@@ -301,7 +298,7 @@
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
+module_param(debug, bool, 644);
 MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
-MODULE_PARM(poll, "i");
+module_param(poll, bool, 644);
 MODULE_PARM_DESC(poll, "#ENUM polling mode enabled or not");
diff -Nru a/drivers/pci/hotplug/cpqphp.h b/drivers/pci/hotplug/cpqphp.h
--- a/drivers/pci/hotplug/cpqphp.h	Tue Jun 15 22:20:44 2004
+++ b/drivers/pci/hotplug/cpqphp.h	Tue Jun 15 22:20:44 2004
@@ -33,11 +33,7 @@
 #include <asm/io.h>		/* for read? and write? functions */
 #include <linux/delay.h>	/* for delays */
 
-#if !defined(CONFIG_HOTPLUG_PCI_COMPAQ_MODULE)
-	#define MY_NAME	"cpqphp.o"
-#else
-	#define MY_NAME	THIS_MODULE->name
-#endif
+#define MY_NAME	"cpqphp"
 
 #define dbg(fmt, arg...) do { if (cpqhp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
 #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
@@ -257,9 +253,7 @@
 	struct pci_dev* pci_dev;
 };
 
-#define SLOT_MAGIC	0x67267321
 struct slot {
-	u32 magic;
 	struct slot *next;
 	u8 bus;
 	u8 device;
@@ -377,11 +371,8 @@
 #define PCISLOT_66_MHZ_SUPPORTED	0x00000100
 #define PCISLOT_64_BIT_SUPPORTED	0x00000200
 
-
-
 #define PCI_TO_PCI_BRIDGE_CLASS		0x00060400
 
-
 #define INTERLOCK_OPEN			0x00000002
 #define ADD_NOT_SUPPORTED		0x00000003
 #define CARD_FUNCTIONING		0x00000005
@@ -440,7 +431,6 @@
 extern void	cpqhp_destroy_resource_list	(struct resource_lists * resources);
 extern int	cpqhp_configure_device		(struct controller* ctrl, struct pci_func* func);
 extern int	cpqhp_unconfigure_device	(struct pci_func* func);
-extern struct slot *cpqhp_find_slot		(struct controller *ctrl, u8 device);
 
 /* Global variables */
 extern int cpqhp_debug;
@@ -453,50 +443,15 @@
 extern u8 cpqhp_disk_irq;
 
 
-
 /* inline functions */
 
-
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int slot_paranoia_check (struct slot *slot, const char *function)
-{
-	if (!slot) {
-		dbg("%s - slot == NULL", function);
-		return -1;
-	}
-	if (slot->magic != SLOT_MAGIC) {
-		dbg("%s - bad magic number for slot", function);
-		return -1;
-	}
-	if (!slot->hotplug_slot) {
-		dbg("%s - slot->hotplug_slot == NULL!", function);
-		return -1;
-	}
-	return 0;
-}
-
-static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function)
-{ 
-	struct slot *slot;
-
-	if (!hotplug_slot) {
-		dbg("%s - hotplug_slot == NULL\n", function);
-		return NULL;
-	}
-
-	slot = (struct slot *)hotplug_slot->private;
-	if (slot_paranoia_check (slot, function))
-                return NULL;
-	return slot;
-}               
-
 /*
  * return_resource
  *
  * Puts node back in the resource list pointed to by head
  *
  */
-static inline void return_resource (struct pci_resource **head, struct pci_resource *node)
+static inline void return_resource(struct pci_resource **head, struct pci_resource *node)
 {
 	if (!node || !head)
 		return;
@@ -504,7 +459,7 @@
 	*head = node;
 }
 
-static inline void set_SOGO (struct controller *ctrl)
+static inline void set_SOGO(struct controller *ctrl)
 {
 	u16 misc;
 	
@@ -514,7 +469,7 @@
 }
 
 
-static inline void amber_LED_on (struct controller *ctrl, u8 slot)
+static inline void amber_LED_on(struct controller *ctrl, u8 slot)
 {
 	u32 led_control;
 	
@@ -524,7 +479,7 @@
 }
 
 
-static inline void amber_LED_off (struct controller *ctrl, u8 slot)
+static inline void amber_LED_off(struct controller *ctrl, u8 slot)
 {
 	u32 led_control;
 	
@@ -534,7 +489,7 @@
 }
 
 
-static inline int read_amber_LED (struct controller *ctrl, u8 slot)
+static inline int read_amber_LED(struct controller *ctrl, u8 slot)
 {
 	u32 led_control;
 
@@ -545,7 +500,7 @@
 }
 
 
-static inline void green_LED_on (struct controller *ctrl, u8 slot)
+static inline void green_LED_on(struct controller *ctrl, u8 slot)
 {
 	u32 led_control;
 	
@@ -554,7 +509,7 @@
 	writel(led_control, ctrl->hpc_reg + LED_CONTROL);
 }
 
-static inline void green_LED_off (struct controller *ctrl, u8 slot)
+static inline void green_LED_off(struct controller *ctrl, u8 slot)
 {
 	u32 led_control;
 	
@@ -564,7 +519,7 @@
 }
 
 
-static inline void green_LED_blink (struct controller *ctrl, u8 slot)
+static inline void green_LED_blink(struct controller *ctrl, u8 slot)
 {
 	u32 led_control;
 	
@@ -575,7 +530,7 @@
 }
 
 
-static inline void slot_disable (struct controller *ctrl, u8 slot)
+static inline void slot_disable(struct controller *ctrl, u8 slot)
 {
 	u8 slot_enable;
 
@@ -585,7 +540,7 @@
 }
 
 
-static inline void slot_enable (struct controller *ctrl, u8 slot)
+static inline void slot_enable(struct controller *ctrl, u8 slot)
 {
 	u8 slot_enable;
 
@@ -595,7 +550,7 @@
 }
 
 
-static inline u8 is_slot_enabled (struct controller *ctrl, u8 slot)
+static inline u8 is_slot_enabled(struct controller *ctrl, u8 slot)
 {
 	u8 slot_enable;
 
@@ -605,7 +560,7 @@
 }
 
 
-static inline u8 read_slot_enable (struct controller *ctrl)
+static inline u8 read_slot_enable(struct controller *ctrl)
 {
 	return readb(ctrl->hpc_reg + SLOT_ENABLE);
 }
@@ -619,7 +574,7 @@
  * Returns controller speed.
  *
  */
-static inline u8 get_controller_speed (struct controller *ctrl)
+static inline u8 get_controller_speed(struct controller *ctrl)
 {
 	u8 curr_freq;
  	u16 misc;
@@ -652,7 +607,7 @@
  * Returns adapter speed.
  *
  */
-static inline u8 get_adapter_speed (struct controller *ctrl, u8 hp_slot)
+static inline u8 get_adapter_speed(struct controller *ctrl, u8 hp_slot)
 {
 	u32 temp_dword = readl(ctrl->hpc_reg + NON_INT_INPUT);
 	dbg("slot: %d, PCIXCAP: %8x\n", hp_slot, temp_dword);
@@ -669,7 +624,7 @@
 	return PCI_SPEED_33MHz;
 }
 
-static inline void enable_slot_power (struct controller *ctrl, u8 slot)
+static inline void enable_slot_power(struct controller *ctrl, u8 slot)
 {
 	u8 slot_power;
 
@@ -678,7 +633,7 @@
 	writeb(slot_power, ctrl->hpc_reg + SLOT_POWER);
 }
 
-static inline void disable_slot_power (struct controller *ctrl, u8 slot)
+static inline void disable_slot_power(struct controller *ctrl, u8 slot)
 {
 	u8 slot_power;
 
@@ -688,40 +643,31 @@
 }
 
 
-static inline int cpq_get_attention_status (struct controller *ctrl, struct slot *slot)
+static inline int cpq_get_attention_status(struct controller *ctrl, struct slot *slot)
 {
 	u8 hp_slot;
 
-	if (slot == NULL)
-		return 1;
-
 	hp_slot = slot->device - ctrl->slot_device_offset;
 
-	return read_amber_LED (ctrl, hp_slot);
+	return read_amber_LED(ctrl, hp_slot);
 }
 
 
-static inline int get_slot_enabled (struct controller *ctrl, struct slot *slot)
+static inline int get_slot_enabled(struct controller *ctrl, struct slot *slot)
 {
 	u8 hp_slot;
 
-	if (slot == NULL)
-		return 1;
-
 	hp_slot = slot->device - ctrl->slot_device_offset;
 
-	return is_slot_enabled (ctrl, hp_slot);
+	return is_slot_enabled(ctrl, hp_slot);
 }
 
 
-static inline int cpq_get_latch_status (struct controller *ctrl, struct slot *slot)
+static inline int cpq_get_latch_status(struct controller *ctrl, struct slot *slot)
 {
 	u32 status;
 	u8 hp_slot;
 
-	if (slot == NULL)
-		return 1;
-
 	hp_slot = slot->device - ctrl->slot_device_offset;
 	dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d \n",
 	    __FUNCTION__, slot->device, ctrl->slot_device_offset);
@@ -732,15 +678,12 @@
 }
 
 
-static inline int get_presence_status (struct controller *ctrl, struct slot *slot)
+static inline int get_presence_status(struct controller *ctrl, struct slot *slot)
 {
 	int presence_save = 0;
 	u8 hp_slot;
 	u32 tempdword;
 
-	if (slot == NULL)
-		return 0;
-
 	hp_slot = slot->device - ctrl->slot_device_offset;
 
 	tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
@@ -751,13 +694,13 @@
 
 #define SLOT_NAME_SIZE 10
 
-static inline void make_slot_name (char *buffer, int buffer_size, struct slot *slot)
+static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot)
 {
-	snprintf (buffer, buffer_size, "%d", slot->number);
+	snprintf(buffer, buffer_size, "%d", slot->number);
 }
 
 
-static inline int wait_for_ctrl_irq (struct controller *ctrl)
+static inline int wait_for_ctrl_irq(struct controller *ctrl)
 {
         DECLARE_WAITQUEUE(wait, current);
 	int retval = 0;
@@ -773,139 +716,6 @@
 
 	dbg("%s - end\n", __FUNCTION__);
 	return retval;
-}
-
-
-/**
- * set_controller_speed - set the frequency and/or mode of a specific
- * controller segment.
- *
- * @ctrl: controller to change frequency/mode for.
- * @adapter_speed: the speed of the adapter we want to match.
- * @hp_slot: the slot number where the adapter is installed.
- *
- * Returns 0 if we successfully change frequency and/or mode to match the
- * adapter speed.
- * 
- */
-static inline u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot)
-{
-	struct slot *slot;
-	u8 reg;
-	u8 slot_power = readb(ctrl->hpc_reg + SLOT_POWER);
-	u16 reg16;
-	u32 leds = readl(ctrl->hpc_reg + LED_CONTROL);
-	
-	if (ctrl->speed == adapter_speed)
-		return 0;
-	
-	/* We don't allow freq/mode changes if we find another adapter running
-	 * in another slot on this controller */
-	for(slot = ctrl->slot; slot; slot = slot->next) {
-		if (slot->device == (hp_slot + ctrl->slot_device_offset)) 
-			continue;
-		if (!slot->hotplug_slot && !slot->hotplug_slot->info) 
-			continue;
-		if (slot->hotplug_slot->info->adapter_status == 0) 
-			continue;
-		/* If another adapter is running on the same segment but at a
-		 * lower speed/mode, we allow the new adapter to function at
-		 * this rate if supported */
-		if (ctrl->speed < adapter_speed) 
-			return 0;
-
-		return 1;
-	}
-	
-	/* If the controller doesn't support freq/mode changes and the
-	 * controller is running at a higher mode, we bail */
-	if ((ctrl->speed > adapter_speed) && (!ctrl->pcix_speed_capability))
-		return 1;
-	
-	/* But we allow the adapter to run at a lower rate if possible */
-	if ((ctrl->speed < adapter_speed) && (!ctrl->pcix_speed_capability))
-		return 0;
-
-	/* We try to set the max speed supported by both the adapter and
-	 * controller */
-	if (ctrl->speed_capability < adapter_speed) {
-		if (ctrl->speed == ctrl->speed_capability)
-			return 0;
-		adapter_speed = ctrl->speed_capability;
-	}
-
-	writel(0x0L, ctrl->hpc_reg + LED_CONTROL);
-	writeb(0x00, ctrl->hpc_reg + SLOT_ENABLE);
-	
-	set_SOGO(ctrl); 
-	wait_for_ctrl_irq(ctrl);
-	
-	if (adapter_speed != PCI_SPEED_133MHz_PCIX)
-		reg = 0xF5;
-	else
-		reg = 0xF4;	
-	pci_write_config_byte(ctrl->pci_dev, 0x41, reg);
-	
-	reg16 = readw(ctrl->hpc_reg + NEXT_CURR_FREQ);
-	reg16 &= ~0x000F;
-	switch(adapter_speed) {
-		case(PCI_SPEED_133MHz_PCIX): 
-			reg = 0x75;
-			reg16 |= 0xB; 
-			break;
-		case(PCI_SPEED_100MHz_PCIX):
-			reg = 0x74;
-			reg16 |= 0xA;
-			break;
-		case(PCI_SPEED_66MHz_PCIX):
-			reg = 0x73;
-			reg16 |= 0x9;
-			break;
-		case(PCI_SPEED_66MHz):
-			reg = 0x73;
-			reg16 |= 0x1;
-			break;
-		default: /* 33MHz PCI 2.2 */
-			reg = 0x71;
-			break;
-			
-	}
-	reg16 |= 0xB << 12;
-	writew(reg16, ctrl->hpc_reg + NEXT_CURR_FREQ);
-	
-	mdelay(5); 
-	
-	/* Reenable interrupts */
-	writel(0, ctrl->hpc_reg + INT_MASK);
-
-	pci_write_config_byte(ctrl->pci_dev, 0x41, reg); 
-	
-	/* Restart state machine */
-	reg = ~0xF;
-	pci_read_config_byte(ctrl->pci_dev, 0x43, &reg);
-	pci_write_config_byte(ctrl->pci_dev, 0x43, reg);
-	
-	/* Only if mode change...*/
-	if (((ctrl->speed == PCI_SPEED_66MHz) && (adapter_speed == PCI_SPEED_66MHz_PCIX)) ||
-		((ctrl->speed == PCI_SPEED_66MHz_PCIX) && (adapter_speed == PCI_SPEED_66MHz))) 
-			set_SOGO(ctrl);
-	
-	wait_for_ctrl_irq(ctrl);
-	mdelay(1100);
-	
-	/* Restore LED/Slot state */
-	writel(leds, ctrl->hpc_reg + LED_CONTROL);
-	writeb(slot_power, ctrl->hpc_reg + SLOT_ENABLE);
-	
-	set_SOGO(ctrl);
-	wait_for_ctrl_irq(ctrl);
-
-	ctrl->speed = adapter_speed;
-	slot = cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
-
-	info("Successfully changed frequency/mode for adapter in slot %d\n", 
-			slot->number);
-	return 0;
 }
 
 #endif
diff -Nru a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
--- a/drivers/pci/hotplug/cpqphp_core.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/pci/hotplug/cpqphp_core.c	Tue Jun 15 22:20:35 2004
@@ -2,7 +2,7 @@
  * Compaq Hot Plug Controller Driver
  *
  * Copyright (C) 1995,2001 Compaq Computer Corporation
- * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
+ * Copyright (C) 2001 Greg Kroah-Hartman <greg@kroah.com>
  * Copyright (C) 2001 IBM Corp.
  *
  * All rights reserved.
@@ -31,6 +31,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/proc_fs.h>
@@ -57,10 +58,10 @@
 static void *smbios_table;
 static void *smbios_start;
 static void *cpqhp_rom_start;
-static u8 power_mode;
+static int power_mode;
 static int debug;
 
-#define DRIVER_VERSION	"0.9.7"
+#define DRIVER_VERSION	"0.9.8"
 #define DRIVER_AUTHOR	"Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>"
 #define DRIVER_DESC	"Compaq Hot Plug PCI Controller Driver"
 
@@ -68,16 +69,16 @@
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(power_mode, "b");
+module_param(power_mode, bool, 644);
 MODULE_PARM_DESC(power_mode, "Power mode enabled or not");
 
-MODULE_PARM(debug, "i");
+module_param(debug, bool, 644);
 MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
 
 #define CPQHPC_MODULE_MINOR 208
 
-static int one_time_init (void);
-static int set_attention_status (struct hotplug_slot *slot, u8 value);
+static int one_time_init	(void);
+static int set_attention_status	(struct hotplug_slot *slot, u8 value);
 static int process_SI		(struct hotplug_slot *slot);
 static int process_SS		(struct hotplug_slot *slot);
 static int hardware_test	(struct hotplug_slot *slot, u32 value);
@@ -103,30 +104,18 @@
 };
 
 
-static inline int is_slot64bit (struct slot *slot)
+static inline int is_slot64bit(struct slot *slot)
 {
-	if (!slot || !slot->p_sm_slot)
-		return 0;
-
-	if (readb(slot->p_sm_slot + SMBIOS_SLOT_WIDTH) == 0x06)
-		return 1;
-
-	return 0;
+	return (readb(slot->p_sm_slot + SMBIOS_SLOT_WIDTH) == 0x06) ? 1 : 0;
 }
 
-static inline int is_slot66mhz (struct slot *slot)
+static inline int is_slot66mhz(struct slot *slot)
 {
-	if (!slot || !slot->p_sm_slot)
-		return 0;
-
-	if (readb(slot->p_sm_slot + SMBIOS_SLOT_TYPE) == 0x0E)
-		return 1;
-
-	return 0;
+	return (readb(slot->p_sm_slot + SMBIOS_SLOT_TYPE) == 0x0E) ? 1 : 0;
 }
 
 /**
- * detect_SMBIOS_pointer - find the system Management BIOS Table in the specified region of memory.
+ * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region.
  *
  * @begin: begin pointer for region to be scanned.
  * @end: end pointer for region to be scanned.
@@ -210,7 +199,8 @@
 		return -ENOMEM;
 	}
 
-	len = (routing_table->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info);
+	len = (routing_table->size - sizeof(struct irq_routing_table)) /
+			sizeof(struct irq_info);
 	// Make sure I got at least one entry
 	if (len == 0) {
 		kfree(routing_table);
@@ -231,8 +221,8 @@
 }
 
 
-/*
- * get_subsequent_smbios_entry
+/**
+ * get_subsequent_smbios_entry: get the next entry from bios table.
  *
  * Gets the first entry if previous == NULL
  * Otherwise, returns the next entry
@@ -242,7 +232,8 @@
  *
  * returns a pointer to an SMBIOS structure or NULL if none found
  */
-static void * get_subsequent_smbios_entry(void *smbios_start, void *smbios_table, void *curr)
+static void *get_subsequent_smbios_entry(void *smbios_start,
+			void *smbios_table, void *curr)
 {
 	u8 bail = 0;
 	u8 previous_byte = 1;
@@ -259,8 +250,9 @@
 	p_temp += readb(curr + SMBIOS_GENERIC_LENGTH);
 
 	while ((p_temp < p_max) && !bail) {
-		// Look for the double NULL terminator
-		// The first condition is the previous byte and the second is the curr
+		/* Look for the double NULL terminator
+		 * The first condition is the previous byte
+		 * and the second is the curr */
 		if (!previous_byte && !(readb(p_temp))) {
 			bail = 1;
 		}
@@ -290,7 +282,8 @@
  *
  * returns a pointer to an SMBIOS structure or %NULL if none found
  */
-static void *get_SMBIOS_entry (void *smbios_start, void *smbios_table, u8 type, void * previous)
+static void *get_SMBIOS_entry(void *smbios_start, void *smbios_table, u8 type,
+			void * previous)
 {
 	if (!smbios_table)
 		return NULL;
@@ -298,12 +291,14 @@
 	if (!previous) {		  
 		previous = smbios_start;
 	} else {
-		previous = get_subsequent_smbios_entry(smbios_start, smbios_table, previous);
+		previous = get_subsequent_smbios_entry(smbios_start,
+					smbios_table, previous);
 	}
 
 	while (previous) {
 	       	if (readb(previous + SMBIOS_GENERIC_TYPE) != type) {
-			previous = get_subsequent_smbios_entry(smbios_start, smbios_table, previous);
+			previous = get_subsequent_smbios_entry(smbios_start,
+						smbios_table, previous);
 		} else {
 			break;
 		}
@@ -314,11 +309,8 @@
 
 static void release_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	
-	if (slot == NULL)
-		return;
-	
+	struct slot *slot = hotplug_slot->private;
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	kfree(slot->hotplug_slot->info);
@@ -327,7 +319,8 @@
 	kfree(slot);
 }
 
-static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *smbios_table)
+static int ctrl_slot_setup(struct controller * ctrl, void *smbios_start,
+			void *smbios_table)
 {
 	struct slot *new_slot;
 	u8 number_of_slots;
@@ -336,7 +329,7 @@
 	u8 ctrl_slot;
 	u32 tempdword;
 	void *slot_entry= NULL;
-	int result;
+	int result = -ENOMEM;
 
 	dbg("%s\n", __FUNCTION__);
 
@@ -347,44 +340,40 @@
 	slot_number = ctrl->first_slot;
 
 	while (number_of_slots) {
-		new_slot = (struct slot *) kmalloc(sizeof(struct slot), GFP_KERNEL);
+		new_slot = kmalloc(sizeof(*new_slot), GFP_KERNEL);
 		if (!new_slot)
-			return -ENOMEM;
+			goto error;
 
 		memset(new_slot, 0, sizeof(struct slot));
-		new_slot->hotplug_slot = kmalloc (sizeof (struct hotplug_slot), GFP_KERNEL);
-		if (!new_slot->hotplug_slot) {
-			kfree (new_slot);
-			return -ENOMEM;
-		}
-		memset(new_slot->hotplug_slot, 0, sizeof (struct hotplug_slot));
+		new_slot->hotplug_slot = kmalloc(sizeof(*(new_slot->hotplug_slot)),
+						GFP_KERNEL);
+		if (!new_slot->hotplug_slot)
+			goto error_slot;
+		memset(new_slot->hotplug_slot, 0, sizeof(struct hotplug_slot));
+
+		new_slot->hotplug_slot->info =
+				kmalloc(sizeof(*(new_slot->hotplug_slot->info)),
+							GFP_KERNEL);
+		if (!new_slot->hotplug_slot->info)
+			goto error_hpslot;
+		memset(new_slot->hotplug_slot->info, 0,
+				sizeof(struct hotplug_slot_info));
+		new_slot->hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
+		if (!new_slot->hotplug_slot->name)
+			goto error_info;
 
-		new_slot->hotplug_slot->info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
-		if (!new_slot->hotplug_slot->info) {
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return -ENOMEM;
-		}
-		memset(new_slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info));
-		new_slot->hotplug_slot->name = kmalloc (SLOT_NAME_SIZE, GFP_KERNEL);
-		if (!new_slot->hotplug_slot->name) {
-			kfree (new_slot->hotplug_slot->info);
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return -ENOMEM;
-		}
-
-		new_slot->magic = SLOT_MAGIC;
 		new_slot->ctrl = ctrl;
 		new_slot->bus = ctrl->bus;
 		new_slot->device = slot_device;
 		new_slot->number = slot_number;
 		dbg("slot->number = %d\n",new_slot->number);
 
-		slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9, slot_entry);
+		slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9,
+					slot_entry);
 
 		while (slot_entry && (readw(slot_entry + SMBIOS_SLOT_NUMBER) != new_slot->number)) {
-			slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9, slot_entry);
+			slot_entry = get_SMBIOS_entry(smbios_start,
+						smbios_table, 9, slot_entry);
 		}
 
 		new_slot->p_sm_slot = slot_entry;
@@ -417,7 +406,7 @@
 		/* register this slot with the hotplug pci core */
 		new_slot->hotplug_slot->release = &release_slot;
 		new_slot->hotplug_slot->private = new_slot;
-		make_slot_name (new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot);
+		make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot);
 		new_slot->hotplug_slot->ops = &cpqphp_hotplug_slot_ops;
 		
 		new_slot->hotplug_slot->info->power_status = get_slot_enabled(ctrl, new_slot);
@@ -425,13 +414,15 @@
 		new_slot->hotplug_slot->info->latch_status = cpq_get_latch_status(ctrl, new_slot);
 		new_slot->hotplug_slot->info->adapter_status = get_presence_status(ctrl, new_slot);
 		
-		dbg ("registering bus %d, dev %d, number %d, ctrl->slot_device_offset %d, slot %d\n", 
-		     new_slot->bus, new_slot->device, new_slot->number, ctrl->slot_device_offset, slot_number);
+		dbg ("registering bus %d, dev %d, number %d, "
+				"ctrl->slot_device_offset %d, slot %d\n",
+				new_slot->bus, new_slot->device,
+				new_slot->number, ctrl->slot_device_offset,
+				slot_number);
 		result = pci_hp_register (new_slot->hotplug_slot);
 		if (result) {
 			err ("pci_hp_register failed with error %d\n", result);
-			release_slot(new_slot->hotplug_slot);
-			return result;
+			goto error_name;
 		}
 		
 		new_slot->next = ctrl->slot;
@@ -443,6 +434,17 @@
 	}
 
 	return 0;
+
+error_name:
+	kfree(new_slot->hotplug_slot->name);
+error_info:
+	kfree(new_slot->hotplug_slot->info);
+error_hpslot:
+	kfree(new_slot->hotplug_slot);
+error_slot:
+	kfree(new_slot);
+error:
+	return result;
 }
 
 static int ctrl_slot_cleanup (struct controller * ctrl)
@@ -485,7 +487,8 @@
 //
 // Output:	SUCCESS or FAILURE
 //=============================================================================
-static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)
+static int
+get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)
 {
 	struct irq_routing_table *PCIIRQRoutingInfoLength;
 	u32 work;
@@ -520,17 +523,22 @@
 			kfree(PCIIRQRoutingInfoLength);
 			return 0;
 		} else {
-			// Didn't get a match on the target PCI device. Check if the
-			// current IRQ table entry is a PCI-to-PCI bridge device.  If so,
-			// and it's secondary bus matches the bus number for the target 
-			// device, I need to save the bridge's slot number.  If I can't 
-			// find an entry for the target device, I will have to assume it's 
-			// on the other side of the bridge, and assign it the bridge's slot.
+			/* Did not get a match on the target PCI device. Check
+			 * if the current IRQ table entry is a PCI-to-PCI bridge
+			 * device.  If so, and it's secondary bus matches the
+			 * bus number for the target device, I need to save the
+			 * bridge's slot number.  If I can not find an entry for
+			 * the target device, I will have to assume it's on the
+			 * other side of the bridge, and assign it the bridge's
+			 * slot. */
 			bus->number = tbus;
-			pci_bus_read_config_dword (bus, PCI_DEVFN(tdevice, 0), PCI_REVISION_ID, &work);
+			pci_bus_read_config_dword(bus, PCI_DEVFN(tdevice, 0),
+						PCI_REVISION_ID, &work);
 
 			if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) {
-				pci_bus_read_config_dword (bus, PCI_DEVFN(tdevice, 0), PCI_PRIMARY_BUS, &work);
+				pci_bus_read_config_dword(bus,
+							PCI_DEVFN(tdevice, 0),
+							PCI_PRIMARY_BUS, &work);
 				// See if bridge's secondary bus matches target bus.
 				if (((work >> 8) & 0x000000FF) == (long) bus_num) {
 					bridgeSlot = tslot;
@@ -559,7 +567,9 @@
  * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off
  *
  */
-static int cpqhp_set_attention_status (struct controller *ctrl, struct pci_func *func, u32 status)
+static int
+cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func,
+				u32 status)
 {
 	u8 hp_slot;
 
@@ -600,22 +610,15 @@
 static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
 {
 	struct pci_func *slot_func;
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
 	u8 bus;
 	u8 devfn;
 	u8 device;
 	u8 function;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
 	if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
 		return -ENODEV;
 
@@ -624,33 +627,25 @@
 	dbg("bus, dev, fn = %d, %d, %d\n", bus, device, function);
 
 	slot_func = cpqhp_slot_find(bus, device, function);
-	if (!slot_func) {
+	if (!slot_func)
 		return -ENODEV;
-	}
 
 	return cpqhp_set_attention_status(ctrl, slot_func, status);
 }
 
 
-static int process_SI (struct hotplug_slot *hotplug_slot)
+static int process_SI(struct hotplug_slot *hotplug_slot)
 {
 	struct pci_func *slot_func;
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
 	u8 bus;
 	u8 devfn;
 	u8 device;
 	u8 function;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
 	if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
 		return -ENODEV;
 
@@ -659,9 +654,8 @@
 	dbg("bus, dev, fn = %d, %d, %d\n", bus, device, function);
 
 	slot_func = cpqhp_slot_find(bus, device, function);
-	if (!slot_func) {
+	if (!slot_func)
 		return -ENODEV;
-	}
 
 	slot_func->bus = bus;
 	slot_func->device = device;
@@ -672,25 +666,18 @@
 }
 
 
-static int process_SS (struct hotplug_slot *hotplug_slot)
+static int process_SS(struct hotplug_slot *hotplug_slot)
 {
 	struct pci_func *slot_func;
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
 	u8 bus;
 	u8 devfn;
 	u8 device;
 	u8 function;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
 	if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
 		return -ENODEV;
 
@@ -699,121 +686,78 @@
 	dbg("bus, dev, fn = %d, %d, %d\n", bus, device, function);
 
 	slot_func = cpqhp_slot_find(bus, device, function);
-	if (!slot_func) {
+	if (!slot_func)
 		return -ENODEV;
-	}
-	
-	dbg("In power_down_board, slot_func = %p, ctrl = %p\n", slot_func, ctrl);
+
+	dbg("In %s, slot_func = %p, ctrl = %p\n", __FUNCTION__, slot_func, ctrl);
 	return cpqhp_process_SS(ctrl, slot_func);
 }
 
 
-static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
+static int hardware_test(struct hotplug_slot *hotplug_slot, u32 value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	if (slot == NULL)
-		return -ENODEV;
-
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-
-	return cpqhp_hardware_test (ctrl, value);	
+	return cpqhp_hardware_test(ctrl, value);	
 }
 
 
-static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
 	*value = get_slot_enabled(ctrl, slot);
 	return 0;
 }
 
-static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
-	
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
 	
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
 	*value = cpq_get_attention_status(ctrl, slot);
 	return 0;
 }
 
-static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
-	*value = cpq_get_latch_status (ctrl, slot);
+	*value = cpq_get_latch_status(ctrl, slot);
 
 	return 0;
 }
 
-static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
-	
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
-	*value = get_presence_status (ctrl, slot);
+	*value = get_presence_status(ctrl, slot);
 
 	return 0;
 }
 
 static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
-	
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
 	*value = ctrl->speed_capability;
 
 	return 0;
@@ -821,18 +765,11 @@
 
 static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	struct controller *ctrl;
-	
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
+	struct controller *ctrl = slot->ctrl;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	ctrl = slot->ctrl;
-	if (ctrl == NULL)
-		return -ENODEV;
-	
 	*value = ctrl->speed;
 
 	return 0;
@@ -908,11 +845,11 @@
 			case PCI_VENDOR_ID_COMPAQ:
 				if (rev >= 0x13) { /* CIOBX */
 					ctrl->push_flag = 1;
-					ctrl->slot_switch_type = 1;		// Switch is present
-					ctrl->push_button = 1;			// Pushbutton is present
-					ctrl->pci_config_space = 1;		// Index/data access to working registers 0 = not supported, 1 = supported
-					ctrl->defeature_PHP = 1;		// PHP is supported
-					ctrl->pcix_support = 1;			// PCI-X supported
+					ctrl->slot_switch_type = 1;
+					ctrl->push_button = 1;
+					ctrl->pci_config_space = 1;
+					ctrl->defeature_PHP = 1;
+					ctrl->pcix_support = 1;
 					ctrl->pcix_speed_capability = 1;
 					pci_read_config_byte(pdev, 0x41, &bus_cap);
 					if (bus_cap & 0x80) {
@@ -942,55 +879,55 @@
 				switch (subsystem_deviceid) {
 					case PCI_SUB_HPC_ID:
 						/* Original 6500/7000 implementation */
-						ctrl->slot_switch_type = 1;		// Switch is present
+						ctrl->slot_switch_type = 1;
 						ctrl->speed_capability = PCI_SPEED_33MHz;
-						ctrl->push_button = 0;			// No pushbutton
-						ctrl->pci_config_space = 1;		// Index/data access to working registers 0 = not supported, 1 = supported
-						ctrl->defeature_PHP = 1;		// PHP is supported
-						ctrl->pcix_support = 0;			// PCI-X not supported
-						ctrl->pcix_speed_capability = 0;	// N/A since PCI-X not supported
+						ctrl->push_button = 0;
+						ctrl->pci_config_space = 1;
+						ctrl->defeature_PHP = 1;
+						ctrl->pcix_support = 0;
+						ctrl->pcix_speed_capability = 0;
 						break;
 					case PCI_SUB_HPC_ID2:
 						/* First Pushbutton implementation */
 						ctrl->push_flag = 1;
-						ctrl->slot_switch_type = 1;		// Switch is present
+						ctrl->slot_switch_type = 1;
 						ctrl->speed_capability = PCI_SPEED_33MHz;
-						ctrl->push_button = 1;			// Pushbutton is present
-						ctrl->pci_config_space = 1;		// Index/data access to working registers 0 = not supported, 1 = supported
-						ctrl->defeature_PHP = 1;		// PHP is supported
-						ctrl->pcix_support = 0;			// PCI-X not supported
-						ctrl->pcix_speed_capability = 0;	// N/A since PCI-X not supported
+						ctrl->push_button = 1;
+						ctrl->pci_config_space = 1;
+						ctrl->defeature_PHP = 1;
+						ctrl->pcix_support = 0;
+						ctrl->pcix_speed_capability = 0;
 						break;
 					case PCI_SUB_HPC_ID_INTC:
 						/* Third party (6500/7000) */
-						ctrl->slot_switch_type = 1;		// Switch is present
+						ctrl->slot_switch_type = 1;
 						ctrl->speed_capability = PCI_SPEED_33MHz;
-						ctrl->push_button = 0;			// No pushbutton
-						ctrl->pci_config_space = 1;		// Index/data access to working registers 0 = not supported, 1 = supported
-						ctrl->defeature_PHP = 1;			// PHP is supported
-						ctrl->pcix_support = 0;			// PCI-X not supported
-						ctrl->pcix_speed_capability = 0;		// N/A since PCI-X not supported
+						ctrl->push_button = 0;
+						ctrl->pci_config_space = 1;
+						ctrl->defeature_PHP = 1;
+						ctrl->pcix_support = 0;
+						ctrl->pcix_speed_capability = 0;
 						break;
 					case PCI_SUB_HPC_ID3:
 						/* First 66 Mhz implementation */
 						ctrl->push_flag = 1;
-						ctrl->slot_switch_type = 1;		// Switch is present
+						ctrl->slot_switch_type = 1;
 						ctrl->speed_capability = PCI_SPEED_66MHz;
-						ctrl->push_button = 1;			// Pushbutton is present
-						ctrl->pci_config_space = 1;		// Index/data access to working registers 0 = not supported, 1 = supported
-						ctrl->defeature_PHP = 1;		// PHP is supported
-						ctrl->pcix_support = 0;			// PCI-X not supported
-						ctrl->pcix_speed_capability = 0;	// N/A since PCI-X not supported
+						ctrl->push_button = 1;
+						ctrl->pci_config_space = 1;
+						ctrl->defeature_PHP = 1;
+						ctrl->pcix_support = 0;
+						ctrl->pcix_speed_capability = 0;
 						break;
 					case PCI_SUB_HPC_ID4:
 						/* First PCI-X implementation, 100MHz */
 						ctrl->push_flag = 1;
-						ctrl->slot_switch_type = 1;		// Switch is present
+						ctrl->slot_switch_type = 1;
 						ctrl->speed_capability = PCI_SPEED_100MHz_PCIX;
-						ctrl->push_button = 1;			// Pushbutton is present
-						ctrl->pci_config_space = 1;		// Index/data access to working registers 0 = not supported, 1 = supported
-						ctrl->defeature_PHP = 1;		// PHP is supported
-						ctrl->pcix_support = 1;			// PCI-X supported
+						ctrl->push_button = 1;
+						ctrl->pci_config_space = 1;
+						ctrl->defeature_PHP = 1;
+						ctrl->pcix_support = 1;
 						ctrl->pcix_speed_capability = 0;	
 						break;
 					default:
@@ -1079,33 +1016,41 @@
 	}
 
 	// Tell the user that we found one.
-	info("Initializing the PCI hot plug controller residing on PCI bus %d\n", pdev->bus->number);
+	info("Initializing the PCI hot plug controller residing on PCI bus %d\n",
+					pdev->bus->number);
 
-	dbg ("Hotplug controller capabilities:\n");
-	dbg ("    speed_capability       %d\n", ctrl->speed_capability);
-	dbg ("    slot_switch_type       %s\n", ctrl->slot_switch_type == 0 ? "no switch" : "switch present");
-	dbg ("    defeature_PHP          %s\n", ctrl->defeature_PHP == 0 ? "PHP not supported" : "PHP supported");
-	dbg ("    alternate_base_address %s\n", ctrl->alternate_base_address == 0 ? "not supported" : "supported");
-	dbg ("    pci_config_space       %s\n", ctrl->pci_config_space == 0 ? "not supported" : "supported");
-	dbg ("    pcix_speed_capability  %s\n", ctrl->pcix_speed_capability == 0 ? "not supported" : "supported");
-	dbg ("    pcix_support           %s\n", ctrl->pcix_support == 0 ? "not supported" : "supported");
+	dbg("Hotplug controller capabilities:\n");
+	dbg("    speed_capability       %d\n", ctrl->speed_capability);
+	dbg("    slot_switch_type       %s\n", ctrl->slot_switch_type ?
+					"switch present" : "no switch");
+	dbg("    defeature_PHP          %s\n", ctrl->defeature_PHP ?
+					"PHP supported" : "PHP not supported");
+	dbg("    alternate_base_address %s\n", ctrl->alternate_base_address ?
+					"supported" : "not supported");
+	dbg("    pci_config_space       %s\n", ctrl->pci_config_space ?
+					"supported" : "not supported");
+	dbg("    pcix_speed_capability  %s\n", ctrl->pcix_speed_capability ?
+					"supported" : "not supported");
+	dbg("    pcix_support           %s\n", ctrl->pcix_support ?
+					"supported" : "not supported");
 
 	ctrl->pci_dev = pdev;
 	pci_set_drvdata(pdev, ctrl);
 
-	/* make our own copy of the pci bus structure, as we like tweaking it a lot */
-	ctrl->pci_bus = kmalloc (sizeof (*ctrl->pci_bus), GFP_KERNEL);
+	/* make our own copy of the pci bus structure,
+	 * as we like tweaking it a lot */
+	ctrl->pci_bus = kmalloc(sizeof(*ctrl->pci_bus), GFP_KERNEL);
 	if (!ctrl->pci_bus) {
 		err("out of memory\n");
 		rc = -ENOMEM;
 		goto err_free_ctrl;
 	}
-	memcpy (ctrl->pci_bus, pdev->bus, sizeof (*ctrl->pci_bus));
+	memcpy(ctrl->pci_bus, pdev->bus, sizeof(*ctrl->pci_bus));
 
 	ctrl->bus = pdev->bus->number;
 	ctrl->rev = rev;
 	dbg("bus device function rev: %d %d %d %d\n", ctrl->bus,
-	     PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev);
+		PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev);
 
 	init_MUTEX(&ctrl->crit_sect);
 	init_waitqueue_head(&ctrl->queue);
@@ -1127,9 +1072,12 @@
 		goto err_free_bus;
 	}
 
-	ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
+	ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0),
+					pci_resource_len(pdev, 0));
 	if (!ctrl->hpc_reg) {
-		err("cannot remap MMIO region %lx @ %lx\n", pci_resource_len(pdev, 0), pci_resource_start(pdev, 0));
+		err("cannot remap MMIO region %lx @ %lx\n",
+				pci_resource_len(pdev, 0),
+				pci_resource_start(pdev, 0));
 		rc = -ENODEV;
 		goto err_free_mem_region;
 	}
@@ -1138,21 +1086,25 @@
 	ctrl->speed = get_controller_speed(ctrl);
 
 
-	//**************************************************
-	//
-	//              Save configuration headers for this and
-	//              subordinate PCI buses
-	//
-	//**************************************************
+	/********************************************************
+	 *
+	 *              Save configuration headers for this and
+	 *              subordinate PCI buses
+	 *
+	 ********************************************************/
 
 	// find the physical slot number of the first hot plug slot
 
-	// Get slot won't work for devices behind bridges, but
-	// in this case it will always be called for the "base"
-	// bus/dev/func of a slot.
-	// CS: this is leveraging the PCIIRQ routing code from the kernel (pci-pc.c: get_irq_routing_table)
-	rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number, (readb(ctrl->hpc_reg + SLOT_MASK) >> 4), &(ctrl->first_slot));
-	dbg("get_slot_mapping: first_slot = %d, returned = %d\n", ctrl->first_slot, rc);
+	/* Get slot won't work for devices behind bridges, but
+	 * in this case it will always be called for the "base"
+	 * bus/dev/func of a slot.
+	 * CS: this is leveraging the PCIIRQ routing code from the kernel
+	 * (pci-pc.c: get_irq_routing_table) */
+	rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number,
+				(readb(ctrl->hpc_reg + SLOT_MASK) >> 4),
+				&(ctrl->first_slot));
+	dbg("get_slot_mapping: first_slot = %d, returned = %d\n",
+				ctrl->first_slot, rc);
 	if (rc) {
 		err(msg_initialization_err, rc);
 		goto err_iounmap;
@@ -1161,7 +1113,8 @@
 	// Store PCI Config Space for all devices on this bus
 	rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK));
 	if (rc) {
-		err("%s: unable to save PCI configuration data, error %d\n", __FUNCTION__, rc);
+		err("%s: unable to save PCI configuration data, error %d\n",
+				__FUNCTION__, rc);
 		goto err_iounmap;
 	}
 
@@ -1198,7 +1151,8 @@
 	rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table);
 	if (rc) {
 		err(msg_initialization_err, 6);
-		err("%s: unable to save PCI configuration data, error %d\n", __FUNCTION__, rc);
+		err("%s: unable to save PCI configuration data, error %d\n",
+			__FUNCTION__, rc);
 		goto err_iounmap;
 	}
 	
@@ -1209,7 +1163,8 @@
 	dbg("HPC interrupt = %d \n", ctrl->interrupt);
 	if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr,
 			SA_SHIRQ, MY_NAME, ctrl)) {
-		err("Can't get irq %d for the hotplug pci controller\n", ctrl->interrupt);
+		err("Can't get irq %d for the hotplug pci controller\n",
+			ctrl->interrupt);
 		rc = -ENODEV;
 		goto err_iounmap;
 	}
@@ -1265,8 +1220,8 @@
 
 		if (!power_mode) {
 			if (!func->is_a_board) {
-				green_LED_off (ctrl, hp_slot);
-				slot_disable (ctrl, hp_slot);
+				green_LED_off(ctrl, hp_slot);
+				slot_disable(ctrl, hp_slot);
 			}
 		}
 
@@ -1277,7 +1232,7 @@
 	if (!power_mode) {
 		set_SOGO(ctrl);
 		// Wait for SOBS to be unset
-		wait_for_ctrl_irq (ctrl);
+		wait_for_ctrl_irq(ctrl);
 	}
 
 	rc = init_SERR(ctrl);
@@ -1290,7 +1245,7 @@
 	// Done with exclusive hardware access
 	up(&ctrl->crit_sect);
 
-	cpqhp_create_ctrl_files (ctrl);
+	cpqhp_create_ctrl_files(ctrl);
 
 	return 0;
 
@@ -1350,35 +1305,36 @@
 	compaq_nvram_init(cpqhp_rom_start);
 	
 	/* Map smbios table entry point structure */
-	smbios_table = detect_SMBIOS_pointer(cpqhp_rom_start, cpqhp_rom_start + ROM_PHY_LEN);
+	smbios_table = detect_SMBIOS_pointer(cpqhp_rom_start,
+					cpqhp_rom_start + ROM_PHY_LEN);
 	if (!smbios_table) {
 		err ("Could not find the SMBIOS pointer in memory\n");
 		retval = -EIO;
-		goto error;
+		goto error_rom_start;
 	}
 
-	smbios_start = ioremap(readl(smbios_table + ST_ADDRESS), readw(smbios_table + ST_LENGTH));
+	smbios_start = ioremap(readl(smbios_table + ST_ADDRESS),
+					readw(smbios_table + ST_LENGTH));
 	if (!smbios_start) {
 		err ("Could not ioremap memory region taken from SMBIOS values\n");
 		retval = -EIO;
-		goto error;
+		goto error_smbios_start;
 	}
 
 	initialized = 1;
 
 	return retval;
 
+error_smbios_start:
+	iounmap(smbios_start);
+error_rom_start:
+	iounmap(cpqhp_rom_start);
 error:
-	if (cpqhp_rom_start)
-		iounmap(cpqhp_rom_start);
-	if (smbios_start)
-		iounmap(smbios_start);
-	
 	return retval;
 }
 
 
-static void unload_cpqphpd(void)
+static void __exit unload_cpqphpd(void)
 {
 	struct pci_func *next;
 	struct pci_func *TempSlot;
@@ -1512,7 +1468,7 @@
 
 
 static struct pci_driver cpqhpc_driver = {
-	.name =		"pci_hotplug",
+	.name =		"compaq_pci_hotplug",
 	.id_table =	hpcd_pci_tbl,
 	.probe =	cpqhpc_probe,
 	/* remove:	cpqhpc_remove_one, */
@@ -1526,12 +1482,10 @@
 
 	cpqhp_debug = debug;
 
+	info (DRIVER_DESC " version: " DRIVER_VERSION "\n");
 	result = pci_module_init(&cpqhpc_driver);
 	dbg("pci_module_init = %d\n", result);
-	if (result)
-		return result;
-	info (DRIVER_DESC " version: " DRIVER_VERSION "\n");
-	return 0;
+	return result;
 }
 
 
diff -Nru a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
--- a/drivers/pci/hotplug/cpqphp_ctrl.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c	Tue Jun 15 22:20:39 2004
@@ -39,8 +39,10 @@
 #include <linux/pci.h>
 #include "cpqphp.h"
 
-static u32 configure_new_device(struct controller* ctrl, struct pci_func *func,u8 behind_bridge, struct resource_lists *resources);
-static int configure_new_function(struct controller* ctrl, struct pci_func *func,u8 behind_bridge, struct resource_lists *resources);
+static u32 configure_new_device(struct controller* ctrl, struct pci_func *func,
+			u8 behind_bridge, struct resource_lists *resources);
+static int configure_new_function(struct controller* ctrl, struct pci_func *func,
+			u8 behind_bridge, struct resource_lists *resources);
 static void interrupt_event_handler(struct controller *ctrl);
 
 static struct semaphore event_semaphore;	/* mutex for process loop (up if something to process) */
@@ -53,7 +55,7 @@
 static wait_queue_head_t	delay_wait;
 
 /* delay is in jiffies to wait for */
-static void long_delay (int delay)
+static void long_delay(int delay)
 {
 	DECLARE_WAITQUEUE(wait, current);
 	
@@ -64,7 +66,7 @@
 	 */
 	down (&delay_sem);
 
-	init_waitqueue_head (&delay_wait);
+	init_waitqueue_head(&delay_wait);
 
 	add_wait_queue(&delay_wait, &wait);
 	set_current_state(TASK_INTERRUPTIBLE);
@@ -72,11 +74,11 @@
 	remove_wait_queue(&delay_wait, &wait);
 	set_current_state(TASK_RUNNING);
 	
-	up (&delay_sem);
+	up(&delay_sem);
 }
 
 
-//FIXME: The following line needs to be somewhere else...
+/* FIXME: The following line needs to be somewhere else... */
 #define WRONG_BUS_FREQUENCY 0x07
 static u8 handle_switch_change(u8 change, struct controller * ctrl)
 {
@@ -89,18 +91,19 @@
 	if (!change)
 		return 0;
 
-	// Switch Change
+	/* Switch Change */
 	dbg("cpqsbd:  Switch interrupt received.\n");
 
 	for (hp_slot = 0; hp_slot < 6; hp_slot++) {
 		if (change & (0x1L << hp_slot)) {
-			//*********************************
-			// this one changed.
-			//*********************************
-			func = cpqhp_slot_find(ctrl->bus, (hp_slot + ctrl->slot_device_offset), 0);
+			/**********************************
+			 * this one changed.
+			 **********************************/
+			func = cpqhp_slot_find(ctrl->bus,
+				(hp_slot + ctrl->slot_device_offset), 0);
 
-			//this is the structure that tells the worker thread
-			//what to do
+			/* this is the structure that tells the worker thread
+			 *what to do */
 			taskInfo = &(ctrl->event_queue[ctrl->next_event]);
 			ctrl->next_event = (ctrl->next_event + 1) % 10;
 			taskInfo->hp_slot = hp_slot;
@@ -112,17 +115,17 @@
 			func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;
 
 			if (ctrl->ctrl_int_comp & (0x1L << hp_slot)) {
-				//*********************************
-				// Switch opened
-				//*********************************
+				/**********************************
+				 * Switch opened
+				 **********************************/
 
 				func->switch_save = 0;
 
 				taskInfo->event_type = INT_SWITCH_OPEN;
 			} else {
-				//*********************************
-				// Switch closed
-				//*********************************
+				/**********************************
+				 * Switch closed
+				 **********************************/
 
 				func->switch_save = 0x10;
 
@@ -134,18 +137,14 @@
 	return rc;
 }
 
-
-/*
- * cpqhp_find_slot
+/**
+ * cpqhp_find_slot: find the struct slot of given device
+ * @ctrl: scan lots of this controller
+ * @device: the device id to find
  */
-struct slot *cpqhp_find_slot (struct controller * ctrl, u8 device)
+static struct slot *cpqhp_find_slot(struct controller *ctrl, u8 device)
 {
-	struct slot *slot;
-
-	if (!ctrl)
-		return NULL;
-
-	slot = ctrl->slot;
+	struct slot *slot = ctrl->slot;
 
 	while (slot && (slot->device != device)) {
 		slot = slot->next;
@@ -168,18 +167,19 @@
 	if (!change)
 		return 0;
 
-	//*********************************
-	// Presence Change
-	//*********************************
+	/**********************************
+	 * Presence Change
+	 **********************************/
 	dbg("cpqsbd:  Presence/Notify input change.\n");
 	dbg("         Changed bits are 0x%4.4x\n", change );
 
 	for (hp_slot = 0; hp_slot < 6; hp_slot++) {
 		if (change & (0x0101 << hp_slot)) {
-			//*********************************
-			// this one changed.
-			//*********************************
-			func = cpqhp_slot_find(ctrl->bus, (hp_slot + ctrl->slot_device_offset), 0);
+			/**********************************
+			 * this one changed.
+			 **********************************/
+			func = cpqhp_slot_find(ctrl->bus,
+				(hp_slot + ctrl->slot_device_offset), 0);
 
 			taskInfo = &(ctrl->event_queue[ctrl->next_event]);
 			ctrl->next_event = (ctrl->next_event + 1) % 10;
@@ -191,55 +191,51 @@
 			if (!p_slot)
 				return 0;
 
-			// If the switch closed, must be a button
-			// If not in button mode, nevermind
+			/* If the switch closed, must be a button
+			 * If not in button mode, nevermind */
 			if (func->switch_save && (ctrl->push_button == 1)) {
 				temp_word = ctrl->ctrl_int_comp >> 16;
 				temp_byte = (temp_word >> hp_slot) & 0x01;
 				temp_byte |= (temp_word >> (hp_slot + 7)) & 0x02;
 
 				if (temp_byte != func->presence_save) {
-					//*********************************
-					// button Pressed (doesn't do anything)
-					//*********************************
+					/**************************************
+					 * button Pressed (doesn't do anything)
+					 **************************************/
 					dbg("hp_slot %d button pressed\n", hp_slot);
 					taskInfo->event_type = INT_BUTTON_PRESS;
 				} else {
-					//*********************************
-					// button Released - TAKE ACTION!!!!
-					//*********************************
+					/**********************************
+					 * button Released - TAKE ACTION!!!!
+					 **********************************/
 					dbg("hp_slot %d button released\n", hp_slot);
 					taskInfo->event_type = INT_BUTTON_RELEASE;
 
-					// Cancel if we are still blinking
+					/* Cancel if we are still blinking */
 					if ((p_slot->state == BLINKINGON_STATE)
 					    || (p_slot->state == BLINKINGOFF_STATE)) {
 						taskInfo->event_type = INT_BUTTON_CANCEL;
 						dbg("hp_slot %d button cancel\n", hp_slot);
 					} else if ((p_slot->state == POWERON_STATE)
 						   || (p_slot->state == POWEROFF_STATE)) {
-						//info(msg_button_ignore, p_slot->number);
+						/* info(msg_button_ignore, p_slot->number); */
 						taskInfo->event_type = INT_BUTTON_IGNORE;
 						dbg("hp_slot %d button ignore\n", hp_slot);
 					}
 				}
 			} else {
-				// Switch is open, assume a presence change
-				// Save the presence state
+				/* Switch is open, assume a presence change
+				 * Save the presence state */
 				temp_word = ctrl->ctrl_int_comp >> 16;
 				func->presence_save = (temp_word >> hp_slot) & 0x01;
 				func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;
 
 				if ((!(ctrl->ctrl_int_comp & (0x010000 << hp_slot))) ||
 				    (!(ctrl->ctrl_int_comp & (0x01000000 << hp_slot)))) {
-					//*********************************
-					// Present
-					//*********************************
+					/* Present */
 					taskInfo->event_type = INT_PRESENCE_ON;
 				} else {
-					//*********************************
-					// Not Present
-					//*********************************
+					/* Not Present */
 					taskInfo->event_type = INT_PRESENCE_OFF;
 				}
 			}
@@ -260,18 +256,19 @@
 	if (!change)
 		return 0;
 
-	//*********************************
-	// power fault
-	//*********************************
+	/**********************************
+	 * power fault
+	 **********************************/
 
 	info("power fault interrupt\n");
 
 	for (hp_slot = 0; hp_slot < 6; hp_slot++) {
 		if (change & (0x01 << hp_slot)) {
-			//*********************************
-			// this one changed.
-			//*********************************
-			func = cpqhp_slot_find(ctrl->bus, (hp_slot + ctrl->slot_device_offset), 0);
+			/**********************************
+			 * this one changed.
+			 **********************************/
+			func = cpqhp_slot_find(ctrl->bus,
+				(hp_slot + ctrl->slot_device_offset), 0);
 
 			taskInfo = &(ctrl->event_queue[ctrl->next_event]);
 			ctrl->next_event = (ctrl->next_event + 1) % 10;
@@ -280,16 +277,16 @@
 			rc++;
 
 			if (ctrl->ctrl_int_comp & (0x00000100 << hp_slot)) {
-				//*********************************
-				// power fault Cleared
-				//*********************************
+				/**********************************
+				 * power fault Cleared
+				 **********************************/
 				func->status = 0x00;
 
 				taskInfo->event_type = INT_POWER_FAULT_CLEAR;
 			} else {
-				//*********************************
-				// power fault
-				//*********************************
+				/**********************************
+				 * power fault
+				 **********************************/
 				taskInfo->event_type = INT_POWER_FAULT;
 
 				if (ctrl->rev < 4) {
@@ -297,18 +294,20 @@
 					green_LED_off (ctrl, hp_slot);
 					set_SOGO (ctrl);
 
-					// this is a fatal condition, we want to crash the
-					// machine to protect from data corruption
-					// simulated_NMI shouldn't ever return
-					//FIXME
-					//simulated_NMI(hp_slot, ctrl);
-
-					//The following code causes a software crash just in
-					//case simulated_NMI did return
-					//FIXME
-					//panic(msg_power_fault);
+					/* this is a fatal condition, we want
+					 * to crash the machine to protect from
+					 * data corruption. simulated_NMI
+					 * shouldn't ever return */
+					/* FIXME
+					simulated_NMI(hp_slot, ctrl); */
+
+					/* The following code causes a software
+					 * crash just in case simulated_NMI did
+					 * return */
+					/*FIXME
+					panic(msg_power_fault); */
 				} else {
-					// set power fault status for this board
+					/* set power fault status for this board */
 					func->status = 0xFF;
 					info("power fault bit %x set\n", hp_slot);
 				}
@@ -320,11 +319,9 @@
 }
 
 
-/*
- * sort_by_size
- *
- * Sorts nodes on the list by their length.
- * Smallest first.
+/**
+ * sort_by_size: sort nodes on the list by their length, smallest first.
+ * @head: list to sort
  *
  */
 static int sort_by_size(struct pci_resource **head)
@@ -334,15 +331,15 @@
 	int out_of_order = 1;
 
 	if (!(*head))
-		return(1);
+		return 1;
 
 	if (!((*head)->next))
-		return(0);
+		return 0;
 
 	while (out_of_order) {
 		out_of_order = 0;
 
-		// Special case for swapping list head
+		/* Special case for swapping list head */
 		if (((*head)->next) &&
 		    ((*head)->length > (*head)->next->length)) {
 			out_of_order++;
@@ -365,17 +362,15 @@
 			} else
 				current_res = current_res->next;
 		}
-	}  // End of out_of_order loop
+	}  /* End of out_of_order loop */
 
-	return(0);
+	return 0;
 }
 
 
-/*
- * sort_by_max_size
- *
- * Sorts nodes on the list by their length.
- * Largest first.
+/**
+ * sort_by_max_size: sort nodes on the list by their length, largest first.
+ * @head: list to sort
  *
  */
 static int sort_by_max_size(struct pci_resource **head)
@@ -385,15 +380,15 @@
 	int out_of_order = 1;
 
 	if (!(*head))
-		return(1);
+		return 1;
 
 	if (!((*head)->next))
-		return(0);
+		return 0;
 
 	while (out_of_order) {
 		out_of_order = 0;
 
-		// Special case for swapping list head
+		/* Special case for swapping list head */
 		if (((*head)->next) &&
 		    ((*head)->length < (*head)->next->length)) {
 			out_of_order++;
@@ -416,19 +411,18 @@
 			} else
 				current_res = current_res->next;
 		}
-	}  // End of out_of_order loop
+	}  /* End of out_of_order loop */
 
-	return(0);
+	return 0;
 }
 
 
-/*
- * do_pre_bridge_resource_split
- *
- *	Returns zero or one node of resources that aren't in use
+/**
+ * do_pre_bridge_resource_split: find node of resources that are unused
  *
  */
-static struct pci_resource *do_pre_bridge_resource_split (struct pci_resource **head, struct pci_resource **orig_head, u32 alignment)
+static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head,
+				struct pci_resource **orig_head, u32 alignment)
 {
 	struct pci_resource *prevnode = NULL;
 	struct pci_resource *node;
@@ -438,32 +432,32 @@
 	dbg("do_pre_bridge_resource_split\n");
 
 	if (!(*head) || !(*orig_head))
-		return(NULL);
+		return NULL;
 
 	rc = cpqhp_resource_sort_and_combine(head);
 
 	if (rc)
-		return(NULL);
+		return NULL;
 
 	if ((*head)->base != (*orig_head)->base)
-		return(NULL);
+		return NULL;
 
 	if ((*head)->length == (*orig_head)->length)
-		return(NULL);
+		return NULL;
 
 
-	// If we got here, there the bridge requires some of the resource, but
-	// we may be able to split some off of the front
+	/* If we got here, there the bridge requires some of the resource, but
+	 * we may be able to split some off of the front */
 
 	node = *head;
 
 	if (node->length & (alignment -1)) {
-		// this one isn't an aligned length, so we'll make a new entry
-		// and split it up.
-		split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+		/* this one isn't an aligned length, so we'll make a new entry
+		 * and split it up. */
+		split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 		if (!split_node)
-			return(NULL);
+			return NULL;
 
 		temp_dword = (node->length | (alignment-1)) + 1 - alignment;
 
@@ -473,52 +467,45 @@
 		node->length -= temp_dword;
 		node->base += split_node->length;
 
-		// Put it in the list
+		/* Put it in the list */
 		*head = split_node;
 		split_node->next = node;
 	}
 
-	if (node->length < alignment) {
-		return(NULL);
-	}
+	if (node->length < alignment)
+		return NULL;
 
-	// Now unlink it
+	/* Now unlink it */
 	if (*head == node) {
 		*head = node->next;
-		node->next = NULL;
 	} else {
 		prevnode = *head;
 		while (prevnode->next != node)
 			prevnode = prevnode->next;
 
 		prevnode->next = node->next;
-		node->next = NULL;
 	}
+	node->next = NULL;
 
-	return(node);
+	return node;
 }
 
 
-/*
- * do_bridge_resource_split
- *
- *	Returns zero or one node of resources that aren't in use
+/**
+ * do_bridge_resource_split: find one node of resources that aren't in use
  *
  */
-static struct pci_resource *do_bridge_resource_split (struct pci_resource **head, u32 alignment)
+static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment)
 {
 	struct pci_resource *prevnode = NULL;
 	struct pci_resource *node;
 	u32 rc;
 	u32 temp_dword;
 
-	if (!(*head))
-		return(NULL);
-
 	rc = cpqhp_resource_sort_and_combine(head);
 
 	if (rc)
-		return(NULL);
+		return NULL;
 
 	node = *head;
 
@@ -528,44 +515,41 @@
 		kfree(prevnode);
 	}
 
-	if (node->length < alignment) {
-		kfree(node);
-		return(NULL);
-	}
+	if (node->length < alignment)
+		goto error;
 
 	if (node->base & (alignment - 1)) {
-		// Short circuit if adjusted size is too small
+		/* Short circuit if adjusted size is too small */
 		temp_dword = (node->base | (alignment-1)) + 1;
-		if ((node->length - (temp_dword - node->base)) < alignment) {
-			kfree(node);
-			return(NULL);
-		}
+		if ((node->length - (temp_dword - node->base)) < alignment)
+			goto error;
 
 		node->length -= (temp_dword - node->base);
 		node->base = temp_dword;
 	}
 
-	if (node->length & (alignment - 1)) {
-		// There's stuff in use after this node
-		kfree(node);
-		return(NULL);
-	}
-
-	return(node);
+	if (node->length & (alignment - 1))
+		/* There's stuff in use after this node */
+		goto error;
+
+	return node;
+error:
+	kfree(node);
+	return NULL;
 }
 
 
-/*
- * get_io_resource
+/**
+ * get_io_resource: find first node of given size not in ISA aliasing window.
+ * @head: list to search
+ * @size: size of node to find, must be a power of two.
  *
- * this function sorts the resource list by size and then
- * returns the first node of "size" length that is not in the
- * ISA aliasing window.  If it finds a node larger than "size"
- * it will split it up.
+ * Description: this function sorts the resource list by size and then returns
+ * returns the first node of "size" length that is not in the ISA aliasing
+ * window.  If it finds a node larger than "size" it will split it up.
  *
- * size must be a power of two.
  */
-static struct pci_resource *get_io_resource (struct pci_resource **head, u32 size)
+static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size)
 {
 	struct pci_resource *prevnode;
 	struct pci_resource *node;
@@ -573,66 +557,66 @@
 	u32 temp_dword;
 
 	if (!(*head))
-		return(NULL);
+		return NULL;
 
 	if ( cpqhp_resource_sort_and_combine(head) )
-		return(NULL);
+		return NULL;
 
 	if ( sort_by_size(head) )
-		return(NULL);
+		return NULL;
 
 	for (node = *head; node; node = node->next) {
 		if (node->length < size)
 			continue;
 
 		if (node->base & (size - 1)) {
-			// this one isn't base aligned properly
-			// so we'll make a new entry and split it up
+			/* this one isn't base aligned properly
+			 * so we'll make a new entry and split it up */
 			temp_dword = (node->base | (size-1)) + 1;
 
-			// Short circuit if adjusted size is too small
+			/* Short circuit if adjusted size is too small */
 			if ((node->length - (temp_dword - node->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = node->base;
 			split_node->length = temp_dword - node->base;
 			node->base = temp_dword;
 			node->length -= split_node->length;
 
-			// Put it in the list
+			/* Put it in the list */
 			split_node->next = node->next;
 			node->next = split_node;
-		} // End of non-aligned base
+		} /* End of non-aligned base */
 
-		// Don't need to check if too small since we already did
+		/* Don't need to check if too small since we already did */
 		if (node->length > size) {
-			// this one is longer than we need
-			// so we'll make a new entry and split it up
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			/* this one is longer than we need
+			 * so we'll make a new entry and split it up */
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = node->base + size;
 			split_node->length = node->length - size;
 			node->length = size;
 
-			// Put it in the list
+			/* Put it in the list */
 			split_node->next = node->next;
 			node->next = split_node;
-		}  // End of too big on top end
+		}  /* End of too big on top end */
 
-		// For IO make sure it's not in the ISA aliasing space
+		/* For IO make sure it's not in the ISA aliasing space */
 		if (node->base & 0x300L)
 			continue;
 
-		// If we got here, then it is the right size
-		// Now take it out of the list
+		/* If we got here, then it is the right size
+		 * Now take it out of the list and break */
 		if (*head == node) {
 			*head = node->next;
 		} else {
@@ -643,92 +627,87 @@
 			prevnode->next = node->next;
 		}
 		node->next = NULL;
-		// Stop looping
 		break;
 	}
 
-	return(node);
+	return node;
 }
 
 
-/*
- * get_max_resource
+/**
+ * get_max_resource: get largest node which has at least the given size.
+ * @head: the list to search the node in
+ * @size: the minimum size of the node to find
  *
- * Gets the largest node that is at least "size" big from the
+ * Description: Gets the largest node that is at least "size" big from the
  * list pointed to by head.  It aligns the node on top and bottom
  * to "size" alignment before returning it.
  */
-static struct pci_resource *get_max_resource (struct pci_resource **head, u32 size)
+static struct pci_resource *get_max_resource(struct pci_resource **head, u32 size)
 {
 	struct pci_resource *max;
 	struct pci_resource *temp;
 	struct pci_resource *split_node;
 	u32 temp_dword;
 
-	if (!(*head))
-		return(NULL);
-
 	if (cpqhp_resource_sort_and_combine(head))
-		return(NULL);
+		return NULL;
 
 	if (sort_by_max_size(head))
-		return(NULL);
-
-	for (max = *head;max; max = max->next) {
+		return NULL;
 
-		// If not big enough we could probably just bail, 
-		// instead we'll continue to the next.
+	for (max = *head; max; max = max->next) {
+		/* If not big enough we could probably just bail, 
+		 * instead we'll continue to the next. */
 		if (max->length < size)
 			continue;
 
 		if (max->base & (size - 1)) {
-			// this one isn't base aligned properly
-			// so we'll make a new entry and split it up
+			/* this one isn't base aligned properly
+			 * so we'll make a new entry and split it up */
 			temp_dword = (max->base | (size-1)) + 1;
 
-			// Short circuit if adjusted size is too small
+			/* Short circuit if adjusted size is too small */
 			if ((max->length - (temp_dword - max->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = max->base;
 			split_node->length = temp_dword - max->base;
 			max->base = temp_dword;
 			max->length -= split_node->length;
 
-			// Put it next in the list
 			split_node->next = max->next;
 			max->next = split_node;
 		}
 
 		if ((max->base + max->length) & (size - 1)) {
-			// this one isn't end aligned properly at the top
-			// so we'll make a new entry and split it up
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			/* this one isn't end aligned properly at the top
+			 * so we'll make a new entry and split it up */
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 			temp_dword = ((max->base + max->length) & ~(size - 1));
 			split_node->base = temp_dword;
 			split_node->length = max->length + max->base
 					     - split_node->base;
 			max->length -= split_node->length;
 
-			// Put it in the list
 			split_node->next = max->next;
 			max->next = split_node;
 		}
 
-		// Make sure it didn't shrink too much when we aligned it
+		/* Make sure it didn't shrink too much when we aligned it */
 		if (max->length < size)
 			continue;
 
-		// Now take it out of the list
-		temp = (struct pci_resource*) *head;
+		/* Now take it out of the list */
+		temp = *head;
 		if (temp == max) {
 			*head = max->next;
 		} else {
@@ -740,38 +719,36 @@
 		}
 
 		max->next = NULL;
-		return(max);
+		break;
 	}
 
-	// If we get here, we couldn't find one
-	return(NULL);
+	return max;
 }
 
 
-/*
- * get_resource
+/**
+ * get_resource: find resource of given size and split up larger ones.
+ * @head: the list to search for resources
+ * @size: the size limit to use
  *
- * this function sorts the resource list by size and then
+ * Description: This function sorts the resource list by size and then
  * returns the first node of "size" length.  If it finds a node
  * larger than "size" it will split it up.
  *
  * size must be a power of two.
  */
-static struct pci_resource *get_resource (struct pci_resource **head, u32 size)
+static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
 {
 	struct pci_resource *prevnode;
 	struct pci_resource *node;
 	struct pci_resource *split_node;
 	u32 temp_dword;
 
-	if (!(*head))
-		return(NULL);
-
-	if ( cpqhp_resource_sort_and_combine(head) )
-		return(NULL);
+	if (cpqhp_resource_sort_and_combine(head))
+		return NULL;
 
-	if ( sort_by_size(head) )
-		return(NULL);
+	if (sort_by_size(head))
+		return NULL;
 
 	for (node = *head; node; node = node->next) {
 		dbg("%s: req_size =%x node=%p, base=%x, length=%x\n",
@@ -781,51 +758,50 @@
 
 		if (node->base & (size - 1)) {
 			dbg("%s: not aligned\n", __FUNCTION__);
-			// this one isn't base aligned properly
-			// so we'll make a new entry and split it up
+			/* this one isn't base aligned properly
+			 * so we'll make a new entry and split it up */
 			temp_dword = (node->base | (size-1)) + 1;
 
-			// Short circuit if adjusted size is too small
+			/* Short circuit if adjusted size is too small */
 			if ((node->length - (temp_dword - node->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = node->base;
 			split_node->length = temp_dword - node->base;
 			node->base = temp_dword;
 			node->length -= split_node->length;
 
-			// Put it in the list
 			split_node->next = node->next;
 			node->next = split_node;
-		} // End of non-aligned base
+		} /* End of non-aligned base */
 
-		// Don't need to check if too small since we already did
+		/* Don't need to check if too small since we already did */
 		if (node->length > size) {
 			dbg("%s: too big\n", __FUNCTION__);
-			// this one is longer than we need
-			// so we'll make a new entry and split it up
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			/* this one is longer than we need
+			 * so we'll make a new entry and split it up */
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = node->base + size;
 			split_node->length = node->length - size;
 			node->length = size;
 
-			// Put it in the list
+			/* Put it in the list */
 			split_node->next = node->next;
 			node->next = split_node;
-		}  // End of too big on top end
+		}  /* End of too big on top end */
 
 		dbg("%s: got one!!!\n", __FUNCTION__);
-		// If we got here, then it is the right size
-		// Now take it out of the list
+		/* If we got here, then it is the right size
+		 * Now take it out of the list */
 		if (*head == node) {
 			*head = node->next;
 		} else {
@@ -836,17 +812,17 @@
 			prevnode->next = node->next;
 		}
 		node->next = NULL;
-		// Stop looping
 		break;
 	}
-	return(node);
+	return node;
 }
 
 
-/*
- * cpqhp_resource_sort_and_combine
+/**
+ * cpqhp_resource_sort_and_combine: sort nodes by base addresses and clean up.
+ * @head: the list to sort and clean up
  *
- * Sorts all of the nodes in the list in ascending order by
+ * Description: Sorts all of the nodes in the list in ascending order by
  * their base addresses.  Also does garbage collection by
  * combining adjacent nodes.
  *
@@ -861,19 +837,19 @@
 	dbg("%s: head = %p, *head = %p\n", __FUNCTION__, head, *head);
 
 	if (!(*head))
-		return(1);
+		return 1;
 
 	dbg("*head->next = %p\n",(*head)->next);
 
 	if (!(*head)->next)
-		return(0);	/* only one item on the list, already sorted! */
+		return 0;	/* only one item on the list, already sorted! */
 
 	dbg("*head->base = 0x%x\n",(*head)->base);
 	dbg("*head->next->base = 0x%x\n",(*head)->next->base);
 	while (out_of_order) {
 		out_of_order = 0;
 
-		// Special case for swapping list head
+		/* Special case for swapping list head */
 		if (((*head)->next) &&
 		    ((*head)->base > (*head)->next->base)) {
 			node1 = *head;
@@ -896,13 +872,13 @@
 			} else
 				node1 = node1->next;
 		}
-	}  // End of out_of_order loop
+	}  /* End of out_of_order loop */
 
 	node1 = *head;
 
 	while (node1 && node1->next) {
 		if ((node1->base + node1->length) == node1->next->base) {
-			// Combine
+			/* Combine */
 			dbg("8..\n");
 			node1->length += node1->next->length;
 			node2 = node1->next;
@@ -912,7 +888,7 @@
 			node1 = node1->next;
 	}
 
-	return(0);
+	return 0;
 }
 
 
@@ -927,23 +903,23 @@
 
 	
 	misc = readw(ctrl->hpc_reg + MISC);
-	//*********************************
-	// Check to see if it was our interrupt
-	//*********************************
+	/***************************************
+	 * Check to see if it was our interrupt
+	 ***************************************/
 	if (!(misc & 0x000C)) {
 		return IRQ_NONE;
 	}
 
 	if (misc & 0x0004) {
-		//*********************************
-		// Serial Output interrupt Pending
-		//*********************************
+		/**********************************
+		 * Serial Output interrupt Pending
+		 **********************************/
 
-		// Clear the interrupt
+		/* Clear the interrupt */
 		misc |= 0x0004;
 		writew(misc, ctrl->hpc_reg + MISC);
 
-		// Read to clear posted writes
+		/* Read to clear posted writes */
 		misc = readw(ctrl->hpc_reg + MISC);
 
 		dbg ("%s - waking up\n", __FUNCTION__);
@@ -951,21 +927,20 @@
 	}
 
 	if (misc & 0x0008) {
-		// General-interrupt-input interrupt Pending
+		/* General-interrupt-input interrupt Pending */
 		Diff = readl(ctrl->hpc_reg + INT_INPUT_CLEAR) ^ ctrl->ctrl_int_comp;
 
 		ctrl->ctrl_int_comp = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
 
-		// Clear the interrupt
+		/* Clear the interrupt */
 		writel(Diff, ctrl->hpc_reg + INT_INPUT_CLEAR);
 
-		// Read it back to clear any posted writes
+		/* Read it back to clear any posted writes */
 		temp_dword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
 
-		if (!Diff) {
-			// Clear all interrupts
+		if (!Diff)
+			/* Clear all interrupts */
 			writel(0xFFFFFFFF, ctrl->hpc_reg + INT_INPUT_CLEAR);
-		}
 
 		schedule_flag += handle_switch_change((u8)(Diff & 0xFFL), ctrl);
 		schedule_flag += handle_presence_change((u16)((Diff & 0xFFFF0000L) >> 16), ctrl);
@@ -1000,12 +975,12 @@
 	struct pci_func *new_slot;
 	struct pci_func *next;
 
-	new_slot = (struct pci_func *) kmalloc(sizeof(struct pci_func), GFP_KERNEL);
+	new_slot = kmalloc(sizeof(*new_slot), GFP_KERNEL);
 
 	if (new_slot == NULL) {
-		// I'm not dead yet!
-		// You will be.
-		return(new_slot);
+		/* I'm not dead yet!
+		 * You will be. */
+		return new_slot;
 	}
 
 	memset(new_slot, 0, sizeof(struct pci_func));
@@ -1021,11 +996,11 @@
 			next = next->next;
 		next->next = new_slot;
 	}
-	return(new_slot);
+	return new_slot;
 }
 
 
-/*
+/**
  * slot_remove - Removes a node from the linked list of slots.
  * @old_slot: slot to remove
  *
@@ -1036,19 +1011,19 @@
 	struct pci_func *next;
 
 	if (old_slot == NULL)
-		return(1);
+		return 1;
 
 	next = cpqhp_slot_list[old_slot->bus];
 
 	if (next == NULL) {
-		return(1);
+		return 1;
 	}
 
 	if (next == old_slot) {
 		cpqhp_slot_list[old_slot->bus] = old_slot->next;
 		cpqhp_destroy_board_resources(old_slot);
 		kfree(old_slot);
-		return(0);
+		return 0;
 	}
 
 	while ((next->next != old_slot) && (next->next != NULL)) {
@@ -1059,9 +1034,9 @@
 		next->next = old_slot->next;
 		cpqhp_destroy_board_resources(old_slot);
 		kfree(old_slot);
-		return(0);
+		return 0;
 	} else
-		return(2);
+		return 2;
 }
 
 
@@ -1077,9 +1052,6 @@
 	u8 tempBus;
 	struct pci_func *next;
 
-	if (bridge == NULL)
-		return(1);
-
 	secondaryBus = (bridge->config_space[0x06] >> 8) & 0xFF;
 	subordinateBus = (bridge->config_space[0x06] >> 16) & 0xFF;
 
@@ -1093,26 +1065,23 @@
 
 	next = cpqhp_slot_list[bridge->bus];
 
-	if (next == NULL) {
-		return(1);
-	}
+	if (next == NULL)
+		return 1;
 
 	if (next == bridge) {
 		cpqhp_slot_list[bridge->bus] = bridge->next;
-		kfree(bridge);
-		return(0);
+		goto out;
 	}
 
-	while ((next->next != bridge) && (next->next != NULL)) {
+	while ((next->next != bridge) && (next->next != NULL))
 		next = next->next;
-	}
 
-	if (next->next == bridge) {
-		next->next = bridge->next;
-		kfree(bridge);
-		return(0);
-	} else
-		return(2);
+	if (next->next != bridge)
+		return 2;
+	next->next = bridge->next;
+out:
+	kfree(bridge);
+	return 0;
 }
 
 
@@ -1132,7 +1101,7 @@
 	func = cpqhp_slot_list[bus];
 
 	if ((func == NULL) || ((func->device == device) && (index == 0)))
-		return(func);
+		return func;
 
 	if (func->device == device)
 		found++;
@@ -1144,18 +1113,18 @@
 			found++;
 
 		if (found == index)
-			return(func);
+			return func;
 	}
 
-	return(NULL);
+	return NULL;
 }
 
 
-// DJZ: I don't think is_bridge will work as is.
-//FIXME
+/* DJZ: I don't think is_bridge will work as is.
+ * FIXME */
 static int is_bridge(struct pci_func * func)
 {
-	// Check the header type
+	/* Check the header type */
 	if (((func->config_space[0x03] >> 16) & 0xFF) == 0x01)
 		return 1;
 	else
@@ -1163,6 +1132,138 @@
 }
 
 
+/**
+ * set_controller_speed - set the frequency and/or mode of a specific
+ * controller segment.
+ *
+ * @ctrl: controller to change frequency/mode for.
+ * @adapter_speed: the speed of the adapter we want to match.
+ * @hp_slot: the slot number where the adapter is installed.
+ *
+ * Returns 0 if we successfully change frequency and/or mode to match the
+ * adapter speed.
+ * 
+ */
+static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot)
+{
+	struct slot *slot;
+	u8 reg;
+	u8 slot_power = readb(ctrl->hpc_reg + SLOT_POWER);
+	u16 reg16;
+	u32 leds = readl(ctrl->hpc_reg + LED_CONTROL);
+	
+	if (ctrl->speed == adapter_speed)
+		return 0;
+	
+	/* We don't allow freq/mode changes if we find another adapter running
+	 * in another slot on this controller */
+	for(slot = ctrl->slot; slot; slot = slot->next) {
+		if (slot->device == (hp_slot + ctrl->slot_device_offset)) 
+			continue;
+		if (!slot->hotplug_slot && !slot->hotplug_slot->info) 
+			continue;
+		if (slot->hotplug_slot->info->adapter_status == 0) 
+			continue;
+		/* If another adapter is running on the same segment but at a
+		 * lower speed/mode, we allow the new adapter to function at
+		 * this rate if supported */
+		if (ctrl->speed < adapter_speed) 
+			return 0;
+
+		return 1;
+	}
+	
+	/* If the controller doesn't support freq/mode changes and the
+	 * controller is running at a higher mode, we bail */
+	if ((ctrl->speed > adapter_speed) && (!ctrl->pcix_speed_capability))
+		return 1;
+	
+	/* But we allow the adapter to run at a lower rate if possible */
+	if ((ctrl->speed < adapter_speed) && (!ctrl->pcix_speed_capability))
+		return 0;
+
+	/* We try to set the max speed supported by both the adapter and
+	 * controller */
+	if (ctrl->speed_capability < adapter_speed) {
+		if (ctrl->speed == ctrl->speed_capability)
+			return 0;
+		adapter_speed = ctrl->speed_capability;
+	}
+
+	writel(0x0L, ctrl->hpc_reg + LED_CONTROL);
+	writeb(0x00, ctrl->hpc_reg + SLOT_ENABLE);
+	
+	set_SOGO(ctrl); 
+	wait_for_ctrl_irq(ctrl);
+	
+	if (adapter_speed != PCI_SPEED_133MHz_PCIX)
+		reg = 0xF5;
+	else
+		reg = 0xF4;	
+	pci_write_config_byte(ctrl->pci_dev, 0x41, reg);
+	
+	reg16 = readw(ctrl->hpc_reg + NEXT_CURR_FREQ);
+	reg16 &= ~0x000F;
+	switch(adapter_speed) {
+		case(PCI_SPEED_133MHz_PCIX): 
+			reg = 0x75;
+			reg16 |= 0xB; 
+			break;
+		case(PCI_SPEED_100MHz_PCIX):
+			reg = 0x74;
+			reg16 |= 0xA;
+			break;
+		case(PCI_SPEED_66MHz_PCIX):
+			reg = 0x73;
+			reg16 |= 0x9;
+			break;
+		case(PCI_SPEED_66MHz):
+			reg = 0x73;
+			reg16 |= 0x1;
+			break;
+		default: /* 33MHz PCI 2.2 */
+			reg = 0x71;
+			break;
+			
+	}
+	reg16 |= 0xB << 12;
+	writew(reg16, ctrl->hpc_reg + NEXT_CURR_FREQ);
+	
+	mdelay(5); 
+	
+	/* Reenable interrupts */
+	writel(0, ctrl->hpc_reg + INT_MASK);
+
+	pci_write_config_byte(ctrl->pci_dev, 0x41, reg); 
+	
+	/* Restart state machine */
+	reg = ~0xF;
+	pci_read_config_byte(ctrl->pci_dev, 0x43, &reg);
+	pci_write_config_byte(ctrl->pci_dev, 0x43, reg);
+	
+	/* Only if mode change...*/
+	if (((ctrl->speed == PCI_SPEED_66MHz) && (adapter_speed == PCI_SPEED_66MHz_PCIX)) ||
+		((ctrl->speed == PCI_SPEED_66MHz_PCIX) && (adapter_speed == PCI_SPEED_66MHz))) 
+			set_SOGO(ctrl);
+	
+	wait_for_ctrl_irq(ctrl);
+	mdelay(1100);
+	
+	/* Restore LED/Slot state */
+	writel(leds, ctrl->hpc_reg + LED_CONTROL);
+	writeb(slot_power, ctrl->hpc_reg + SLOT_ENABLE);
+	
+	set_SOGO(ctrl);
+	wait_for_ctrl_irq(ctrl);
+
+	ctrl->speed = adapter_speed;
+	slot = cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
+
+	info("Successfully changed frequency/mode for adapter in slot %d\n", 
+			slot->number);
+	return 0;
+}
+
 /* the following routines constitute the bulk of the 
    hotplug controller logic
  */
@@ -1178,7 +1279,7 @@
  * If board isn't same, turns it back off.
  *
  */
-static u32 board_replaced(struct pci_func * func, struct controller * ctrl)
+static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
 {
 	u8 hp_slot;
 	u8 temp_byte;
@@ -1190,36 +1291,35 @@
 	hp_slot = func->device - ctrl->slot_device_offset;
 
 	if (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot)) {
-		//*********************************
-		// The switch is open.
-		//*********************************
+		/**********************************
+		 * The switch is open.
+		 **********************************/
 		rc = INTERLOCK_OPEN;
 	} else if (is_slot_enabled (ctrl, hp_slot)) {
-		//*********************************
-		// The board is already on
-		//*********************************
+		/**********************************
+		 * The board is already on
+		 **********************************/
 		rc = CARD_FUNCTIONING;
 	} else {
-		// Wait for exclusive access to hardware
 		down(&ctrl->crit_sect);
 
-		// turn on board without attaching to the bus
+		/* turn on board without attaching to the bus */
 		enable_slot_power (ctrl, hp_slot);
 
 		set_SOGO(ctrl);
 
-		// Wait for SOBS to be unset
+		/* Wait for SOBS to be unset */
 		wait_for_ctrl_irq (ctrl);
 
-		// Change bits in slot power register to force another shift out
-		// NOTE: this is to work around the timer bug
+		/* Change bits in slot power register to force another shift out
+		 * NOTE: this is to work around the timer bug */
 		temp_byte = readb(ctrl->hpc_reg + SLOT_POWER);
 		writeb(0x00, ctrl->hpc_reg + SLOT_POWER);
 		writeb(temp_byte, ctrl->hpc_reg + SLOT_POWER);
 
 		set_SOGO(ctrl);
 
-		// Wait for SOBS to be unset
+		/* Wait for SOBS to be unset */
 		wait_for_ctrl_irq (ctrl);
 		
 		adapter_speed = get_adapter_speed(ctrl, hp_slot);
@@ -1227,21 +1327,19 @@
 			if (set_controller_speed(ctrl, adapter_speed, hp_slot))
 				rc = WRONG_BUS_FREQUENCY;
 
-		// turn off board without attaching to the bus
+		/* turn off board without attaching to the bus */
 		disable_slot_power (ctrl, hp_slot);
 
 		set_SOGO(ctrl);
 
-		// Wait for SOBS to be unset
+		/* Wait for SOBS to be unset */
 		wait_for_ctrl_irq (ctrl);
 
-		// Done with exclusive hardware access
 		up(&ctrl->crit_sect);
 
 		if (rc)
-			return(rc);
+			return rc;
 
-		// Wait for exclusive access to hardware
 		down(&ctrl->crit_sect);
 
 		slot_enable (ctrl, hp_slot);
@@ -1251,35 +1349,34 @@
 
 		set_SOGO(ctrl);
 
-		// Wait for SOBS to be unset
+		/* Wait for SOBS to be unset */
 		wait_for_ctrl_irq (ctrl);
 
-		// Done with exclusive hardware access
 		up(&ctrl->crit_sect);
 
-		// Wait for ~1 second because of hot plug spec
+		/* Wait for ~1 second because of hot plug spec */
 		long_delay(1*HZ);
 
-		// Check for a power fault
+		/* Check for a power fault */
 		if (func->status == 0xFF) {
-			// power fault occurred, but it was benign
+			/* power fault occurred, but it was benign */
 			rc = POWER_FAILURE;
 			func->status = 0;
 		} else
 			rc = cpqhp_valid_replace(ctrl, func);
 
 		if (!rc) {
-			// It must be the same board
+			/* It must be the same board */
 
 			rc = cpqhp_configure_board(ctrl, func);
 
 			if (rc || src) {
-				// If configuration fails, turn it off
-				// Get slot won't work for devices behind bridges, but
-				// in this case it will always be called for the "base"
-				// bus/dev/func of an adapter.
+				/* If configuration fails, turn it off
+				 * Get slot won't work for devices behind
+				 * bridges, but in this case it will always be
+				 * called for the "base" bus/dev/func of an
+				 * adapter. */
 
-				// Wait for exclusive access to hardware
 				down(&ctrl->crit_sect);
 
 				amber_LED_on (ctrl, hp_slot);
@@ -1288,16 +1385,15 @@
 
 				set_SOGO(ctrl);
 
-				// Wait for SOBS to be unset
+				/* Wait for SOBS to be unset */
 				wait_for_ctrl_irq (ctrl);
 
-				// Done with exclusive hardware access
 				up(&ctrl->crit_sect);
 
 				if (rc)
-					return(rc);
+					return rc;
 				else
-					return(1);
+					return 1;
 			}
 
 			func->status = 0;
@@ -1310,12 +1406,12 @@
 			}
 
 			if (rc) {
-				// If configuration fails, turn it off
-				// Get slot won't work for devices behind bridges, but
-				// in this case it will always be called for the "base"
-				// bus/dev/func of an adapter.
+				/* If configuration fails, turn it off
+				 * Get slot won't work for devices behind
+				 * bridges, but in this case it will always be
+				 * called for the "base" bus/dev/func of an
+				 * adapter. */
 
-				// Wait for exclusive access to hardware
 				down(&ctrl->crit_sect);
 
 				amber_LED_on (ctrl, hp_slot);
@@ -1324,37 +1420,33 @@
 
 				set_SOGO(ctrl);
 
-				// Wait for SOBS to be unset
+				/* Wait for SOBS to be unset */
 				wait_for_ctrl_irq (ctrl);
 
-				// Done with exclusive hardware access
 				up(&ctrl->crit_sect);
 
-				return(rc);
+				return rc;
 			}
-			// Done configuring so turn LED on full time
+			/* Done configuring so turn LED on full time */
 
-			// Wait for exclusive access to hardware
 			down(&ctrl->crit_sect);
 
 			green_LED_on (ctrl, hp_slot);
 
 			set_SOGO(ctrl);
 
-			// Wait for SOBS to be unset
+			/* Wait for SOBS to be unset */
 			wait_for_ctrl_irq (ctrl);
 
-			// Done with exclusive hardware access
 			up(&ctrl->crit_sect);
 			rc = 0;
 		} else {
-			// Something is wrong
+			/* Something is wrong
 
-			// Get slot won't work for devices behind bridges, but
-			// in this case it will always be called for the "base"
-			// bus/dev/func of an adapter.
+			 * Get slot won't work for devices behind bridges, but
+			 * in this case it will always be called for the "base"
+			 * bus/dev/func of an adapter. */
 
-			// Wait for exclusive access to hardware
 			down(&ctrl->crit_sect);
 
 			amber_LED_on (ctrl, hp_slot);
@@ -1363,15 +1455,14 @@
 
 			set_SOGO(ctrl);
 
-			// Wait for SOBS to be unset
+			/* Wait for SOBS to be unset */
 			wait_for_ctrl_irq (ctrl);
 
-			// Done with exclusive hardware access
 			up(&ctrl->crit_sect);
 		}
 
 	}
-	return(rc);
+	return rc;
 
 }
 
@@ -1383,7 +1474,7 @@
  * Configures board
  *
  */
-static u32 board_added(struct pci_func * func, struct controller * ctrl)
+static u32 board_added(struct pci_func *func, struct controller *ctrl)
 {
 	u8 hp_slot;
 	u8 temp_byte;
@@ -1399,26 +1490,25 @@
 	dbg("%s: func->device, slot_offset, hp_slot = %d, %d ,%d\n",
 	    __FUNCTION__, func->device, ctrl->slot_device_offset, hp_slot);
 
-	// Wait for exclusive access to hardware
 	down(&ctrl->crit_sect);
 
-	// turn on board without attaching to the bus
-	enable_slot_power (ctrl, hp_slot);
+	/* turn on board without attaching to the bus */
+	enable_slot_power(ctrl, hp_slot);
 
 	set_SOGO(ctrl);
 
-	// Wait for SOBS to be unset
+	/* Wait for SOBS to be unset */
 	wait_for_ctrl_irq (ctrl);
 
-	// Change bits in slot power register to force another shift out
-	// NOTE: this is to work around the timer bug
+	/* Change bits in slot power register to force another shift out
+	 * NOTE: this is to work around the timer bug */
 	temp_byte = readb(ctrl->hpc_reg + SLOT_POWER);
 	writeb(0x00, ctrl->hpc_reg + SLOT_POWER);
 	writeb(temp_byte, ctrl->hpc_reg + SLOT_POWER);
 
 	set_SOGO(ctrl);
 
-	// Wait for SOBS to be unset
+	/* Wait for SOBS to be unset */
 	wait_for_ctrl_irq (ctrl);
 	
 	adapter_speed = get_adapter_speed(ctrl, hp_slot);
@@ -1426,25 +1516,23 @@
 		if (set_controller_speed(ctrl, adapter_speed, hp_slot))
 			rc = WRONG_BUS_FREQUENCY;
 	
-	// turn off board without attaching to the bus
+	/* turn off board without attaching to the bus */
 	disable_slot_power (ctrl, hp_slot);
 
 	set_SOGO(ctrl);
 
-	// Wait for SOBS to be unset
-	wait_for_ctrl_irq (ctrl);
+	/* Wait for SOBS to be unset */
+	wait_for_ctrl_irq(ctrl);
 
-	// Done with exclusive hardware access
 	up(&ctrl->crit_sect);
 
 	if (rc)
-		return(rc);
+		return rc;
 	
 	p_slot = cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
 
-	// turn on board and blink green LED
+	/* turn on board and blink green LED */
 
-	// Wait for exclusive access to hardware
 	dbg("%s: before down\n", __FUNCTION__);
 	down(&ctrl->crit_sect);
 	dbg("%s: after down\n", __FUNCTION__);
@@ -1461,47 +1549,46 @@
 	dbg("%s: before set_SOGO\n", __FUNCTION__);
 	set_SOGO(ctrl);
 
-	// Wait for SOBS to be unset
+	/* Wait for SOBS to be unset */
 	dbg("%s: before wait_for_ctrl_irq\n", __FUNCTION__);
 	wait_for_ctrl_irq (ctrl);
 	dbg("%s: after wait_for_ctrl_irq\n", __FUNCTION__);
 
-	// Done with exclusive hardware access
 	dbg("%s: before up\n", __FUNCTION__);
 	up(&ctrl->crit_sect);
 	dbg("%s: after up\n", __FUNCTION__);
 
-	// Wait for ~1 second because of hot plug spec
+	/* Wait for ~1 second because of hot plug spec */
 	dbg("%s: before long_delay\n", __FUNCTION__);
 	long_delay(1*HZ);
 	dbg("%s: after long_delay\n", __FUNCTION__);
 
 	dbg("%s: func status = %x\n", __FUNCTION__, func->status);
-	// Check for a power fault
+	/* Check for a power fault */
 	if (func->status == 0xFF) {
-		// power fault occurred, but it was benign
+		/* power fault occurred, but it was benign */
 		temp_register = 0xFFFFFFFF;
 		dbg("%s: temp register set to %x by power fault\n", __FUNCTION__, temp_register);
 		rc = POWER_FAILURE;
 		func->status = 0;
 	} else {
-		// Get vendor/device ID u32
+		/* Get vendor/device ID u32 */
 		ctrl->pci_bus->number = func->bus;
 		rc = pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), PCI_VENDOR_ID, &temp_register);
 		dbg("%s: pci_read_config_dword returns %d\n", __FUNCTION__, rc);
 		dbg("%s: temp_register is %x\n", __FUNCTION__, temp_register);
 
 		if (rc != 0) {
-			// Something's wrong here
+			/* Something's wrong here */
 			temp_register = 0xFFFFFFFF;
 			dbg("%s: temp register set to %x by error\n", __FUNCTION__, temp_register);
 		}
-		// Preset return code.  It will be changed later if things go okay.
+		/* Preset return code.  It will be changed later if things go okay. */
 		rc = NO_ADAPTER_PRESENT;
 	}
 
-	// All F's is an empty slot or an invalid board
-	if (temp_register != 0xFFFFFFFF) {	  // Check for a board in the slot
+	/* All F's is an empty slot or an invalid board */
+	if (temp_register != 0xFFFFFFFF) {	  /* Check for a board in the slot */
 		res_lists.io_head = ctrl->io_head;
 		res_lists.mem_head = ctrl->mem_head;
 		res_lists.p_mem_head = ctrl->p_mem_head;
@@ -1522,7 +1609,6 @@
 		cpqhp_resource_sort_and_combine(&(ctrl->bus_head));
 
 		if (rc) {
-			// Wait for exclusive access to hardware
 			down(&ctrl->crit_sect);
 
 			amber_LED_on (ctrl, hp_slot);
@@ -1531,12 +1617,11 @@
 
 			set_SOGO(ctrl);
 
-			// Wait for SOBS to be unset
+			/* Wait for SOBS to be unset */
 			wait_for_ctrl_irq (ctrl);
 
-			// Done with exclusive hardware access
 			up(&ctrl->crit_sect);
-			return(rc);
+			return rc;
 		} else {
 			cpqhp_save_slot_config(ctrl, func);
 		}
@@ -1546,7 +1631,8 @@
 		func->switch_save = 0x10;
 		func->is_a_board = 0x01;
 
-		//next, we will instantiate the linux pci_dev structures (with appropriate driver notification, if already present)
+		/* next, we will instantiate the linux pci_dev structures (with
+		 * appropriate driver notification, if already present) */
 		dbg("%s: configure linux pci_dev structure\n", __FUNCTION__);
 		index = 0;
 		do {
@@ -1556,20 +1642,17 @@
 			}
 		} while (new_slot);
 
-		// Wait for exclusive access to hardware
 		down(&ctrl->crit_sect);
 
 		green_LED_on (ctrl, hp_slot);
 
 		set_SOGO(ctrl);
 
-		// Wait for SOBS to be unset
+		/* Wait for SOBS to be unset */
 		wait_for_ctrl_irq (ctrl);
 
-		// Done with exclusive hardware access
 		up(&ctrl->crit_sect);
 	} else {
-		// Wait for exclusive access to hardware
 		down(&ctrl->crit_sect);
 
 		amber_LED_on (ctrl, hp_slot);
@@ -1578,13 +1661,12 @@
 
 		set_SOGO(ctrl);
 
-		// Wait for SOBS to be unset
+		/* Wait for SOBS to be unset */
 		wait_for_ctrl_irq (ctrl);
 
-		// Done with exclusive hardware access
 		up(&ctrl->crit_sect);
 
-		return(rc);
+		return rc;
 	}
 	return 0;
 }
@@ -1605,26 +1687,23 @@
 	struct resource_lists res_lists;
 	struct pci_func *temp_func;
 
-	if (func == NULL)
-		return(1);
-
 	if (cpqhp_unconfigure_device(func))
-		return(1);
+		return 1;
 
 	device = func->device;
 
 	hp_slot = func->device - ctrl->slot_device_offset;
 	dbg("In %s, hp_slot = %d\n", __FUNCTION__, hp_slot);
 
-	// When we get here, it is safe to change base Address Registers.
-	// We will attempt to save the base Address Register Lengths
+	/* When we get here, it is safe to change base address registers.
+	 * We will attempt to save the base address register lengths */
 	if (replace_flag || !ctrl->add_support)
 		rc = cpqhp_save_base_addr_length(ctrl, func);
 	else if (!func->bus_head && !func->mem_head &&
 		 !func->p_mem_head && !func->io_head) {
-		// Here we check to see if we've saved any of the board's
-		// resources already.  If so, we'll skip the attempt to
-		// determine what's being used.
+		/* Here we check to see if we've saved any of the board's
+		 * resources already.  If so, we'll skip the attempt to
+		 * determine what's being used. */
 		index = 0;
 		temp_func = cpqhp_slot_find(func->bus, func->device, index++);
 		while (temp_func) {
@@ -1639,12 +1718,11 @@
 		if (!skip)
 			rc = cpqhp_save_used_resources(ctrl, func);
 	}
-	// Change status to shutdown
+	/* Change status to shutdown */
 	if (func->is_a_board)
 		func->status = 0x01;
 	func->configured = 0;
 
-	// Wait for exclusive access to hardware
 	down(&ctrl->crit_sect);
 
 	green_LED_off (ctrl, hp_slot);
@@ -1652,15 +1730,14 @@
 
 	set_SOGO(ctrl);
 
-	// turn off SERR for slot
+	/* turn off SERR for slot */
 	temp_byte = readb(ctrl->hpc_reg + SLOT_SERR);
 	temp_byte &= ~(0x01 << hp_slot);
 	writeb(temp_byte, ctrl->hpc_reg + SLOT_SERR);
 
-	// Wait for SOBS to be unset
+	/* Wait for SOBS to be unset */
 	wait_for_ctrl_irq (ctrl);
 
-	// Done with exclusive hardware access
 	up(&ctrl->crit_sect);
 
 	if (!replace_flag && ctrl->add_support) {
@@ -1690,13 +1767,11 @@
 			func = cpqhp_slot_find(ctrl->bus, device, 0);
 		}
 
-		// Setup slot structure with entry for empty slot
+		/* Setup slot structure with entry for empty slot */
 		func = cpqhp_slot_create(ctrl->bus);
 
-		if (func == NULL) {
-			// Out of memory
-			return(1);
-		}
+		if (func == NULL)
+			return 1;
 
 		func->bus = ctrl->bus;
 		func->device = device;
@@ -1710,15 +1785,14 @@
 	return 0;
 }
 
-
-static void pushbutton_helper_thread (unsigned long data)
+static void pushbutton_helper_thread(unsigned long data)
 {
 	pushbutton_pending = data;
 	up(&event_semaphore);
 }
 
 
-// this is the main worker thread
+/* this is the main worker thread */
 static int event_thread(void* data)
 {
 	struct controller *ctrl;
@@ -1745,7 +1819,7 @@
 }
 
 
-int cpqhp_event_start_thread (void)
+int cpqhp_event_start_thread(void)
 {
 	int pid;
 
@@ -1765,7 +1839,7 @@
 }
 
 
-void cpqhp_event_stop_thread (void)
+void cpqhp_event_stop_thread(void)
 {
 	event_finished = 1;
 	dbg("event_thread finish command given\n");
@@ -1775,12 +1849,12 @@
 }
 
 
-static int update_slot_info (struct controller *ctrl, struct slot *slot)
+static int update_slot_info(struct controller *ctrl, struct slot *slot)
 {
 	struct hotplug_slot_info *info;
 	int result;
 
-	info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
+	info = kmalloc(sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
@@ -1805,7 +1879,7 @@
 		change = 0;
 
 		for (loop = 0; loop < 10; loop++) {
-			//dbg("loop %d\n", loop);
+			/* dbg("loop %d\n", loop); */
 			if (ctrl->event_queue[loop].event_type != 0) {
 				hp_slot = ctrl->event_queue[loop].hp_slot;
 
@@ -1827,17 +1901,14 @@
 					dbg("button cancel\n");
 					del_timer(&p_slot->task_event);
 
-					// Wait for exclusive access to hardware
 					down(&ctrl->crit_sect);
 
 					if (p_slot->state == BLINKINGOFF_STATE) {
-						// slot is on
-						// turn on green LED
+						/* slot is on */
 						dbg("turn on green LED\n");
 						green_LED_on (ctrl, hp_slot);
 					} else if (p_slot->state == BLINKINGON_STATE) {
-						// slot is off
-						// turn off green LED
+						/* slot is off */
 						dbg("turn off green LED\n");
 						green_LED_off (ctrl, hp_slot);
 					}
@@ -1850,28 +1921,24 @@
 
 					set_SOGO(ctrl);
 
-					// Wait for SOBS to be unset
+					/* Wait for SOBS to be unset */
 					wait_for_ctrl_irq (ctrl);
 
-					// Done with exclusive hardware access
 					up(&ctrl->crit_sect);
 				}
-				// ***********button Released (No action on press...)
+				/*** button Released (No action on press...) */
 				else if (ctrl->event_queue[loop].event_type == INT_BUTTON_RELEASE) {
 					dbg("button release\n");
 
 					if (is_slot_enabled (ctrl, hp_slot)) {
-						// slot is on
 						dbg("slot is on\n");
 						p_slot->state = BLINKINGOFF_STATE;
 						info(msg_button_off, p_slot->number);
 					} else {
-						// slot is off
 						dbg("slot is off\n");
 						p_slot->state = BLINKINGON_STATE;
 						info(msg_button_on, p_slot->number);
 					}
-					// Wait for exclusive access to hardware
 					down(&ctrl->crit_sect);
 					
 					dbg("blink green LED and turn off amber\n");
@@ -1881,23 +1948,22 @@
 					
 					set_SOGO(ctrl);
 
-					// Wait for SOBS to be unset
+					/* Wait for SOBS to be unset */
 					wait_for_ctrl_irq (ctrl);
 
-					// Done with exclusive hardware access
 					up(&ctrl->crit_sect);
 					init_timer(&p_slot->task_event);
 					p_slot->hp_slot = hp_slot;
 					p_slot->ctrl = ctrl;
-//					p_slot->physical_slot = physical_slot;
-					p_slot->task_event.expires = jiffies + 5 * HZ;   // 5 second delay
+/*					p_slot->physical_slot = physical_slot; */
+					p_slot->task_event.expires = jiffies + 5 * HZ;   /* 5 second delay */
 					p_slot->task_event.function = pushbutton_helper_thread;
 					p_slot->task_event.data = (u32) p_slot;
 
 					dbg("add_timer p_slot = %p\n", p_slot);
 					add_timer(&p_slot->task_event);
 				}
-				// ***********POWER FAULT
+				/***********POWER FAULT */
 				else if (ctrl->event_queue[loop].event_type == INT_POWER_FAULT) {
 					dbg("power fault\n");
 				} else {
@@ -1910,7 +1976,7 @@
 
 				change = 1;
 			}
-		}		// End of FOR loop
+		}		/* End of FOR loop */
 	}
 
 	return;
@@ -1924,7 +1990,7 @@
  * Handles all pending events and exits.
  *
  */
-void cpqhp_pushbutton_thread (unsigned long slot)
+void cpqhp_pushbutton_thread(unsigned long slot)
 {
 	u8 hp_slot;
 	u8 device;
@@ -1937,9 +2003,9 @@
 
 	device = p_slot->device;
 
-	if (is_slot_enabled (ctrl, hp_slot)) {
+	if (is_slot_enabled(ctrl, hp_slot)) {
 		p_slot->state = POWEROFF_STATE;
-		// power Down board
+		/* power Down board */
 		func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
 		dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl);
 		if (!func) {
@@ -1954,7 +2020,7 @@
 				
 				set_SOGO(ctrl);
 
-				// Wait for SOBS to be unset
+				/* Wait for SOBS to be unset */
 				wait_for_ctrl_irq (ctrl);
 			}
 		}
@@ -1962,7 +2028,7 @@
 		p_slot->state = STATIC_STATE;
 	} else {
 		p_slot->state = POWERON_STATE;
-		// slot is off
+		/* slot is off */
 
 		func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
 		dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl);
@@ -1973,12 +2039,12 @@
 
 		if (func != NULL && ctrl != NULL) {
 			if (cpqhp_process_SI(ctrl, func) != 0) {
-				amber_LED_on (ctrl, hp_slot);
-				green_LED_off (ctrl, hp_slot);
+				amber_LED_on(ctrl, hp_slot);
+				green_LED_off(ctrl, hp_slot);
 				
 				set_SOGO(ctrl);
 
-				// Wait for SOBS to be unset
+				/* Wait for SOBS to be unset */
 				wait_for_ctrl_irq (ctrl);
 			}
 		}
@@ -1990,7 +2056,7 @@
 }
 
 
-int cpqhp_process_SI (struct controller *ctrl, struct pci_func *func)
+int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func)
 {
 	u8 device, hp_slot;
 	u16 temp_word;
@@ -1999,35 +2065,30 @@
 	struct slot* p_slot;
 	int physical_slot = 0;
 
-	if (!ctrl)
-		return(1);
-
 	tempdword = 0;
 
 	device = func->device;
 	hp_slot = device - ctrl->slot_device_offset;
 	p_slot = cpqhp_find_slot(ctrl, device);
-	if (p_slot) {
+	if (p_slot)
 		physical_slot = p_slot->number;
-	}
 
-	// Check to see if the interlock is closed
+	/* Check to see if the interlock is closed */
 	tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
 
 	if (tempdword & (0x01 << hp_slot)) {
-		return(1);
+		return 1;
 	}
 
 	if (func->is_a_board) {
 		rc = board_replaced(func, ctrl);
 	} else {
-		// add board
+		/* add board */
 		slot_remove(func);
 
 		func = cpqhp_slot_create(ctrl->bus);
-		if (func == NULL) {
-			return(1);
-		}
+		if (func == NULL)
+			return 1;
 
 		func->bus = ctrl->bus;
 		func->device = device;
@@ -2035,7 +2096,7 @@
 		func->configured = 0;
 		func->is_a_board = 1;
 
-		// We have to save the presence info for these slots
+		/* We have to save the presence info for these slots */
 		temp_word = ctrl->ctrl_int_comp >> 16;
 		func->presence_save = (temp_word >> hp_slot) & 0x01;
 		func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;
@@ -2053,13 +2114,11 @@
 			} else
 				slot_remove(func);
 
-			// Setup slot structure with entry for empty slot
+			/* Setup slot structure with entry for empty slot */
 			func = cpqhp_slot_create(ctrl->bus);
 
-			if (func == NULL) {
-				// Out of memory
-				return(1);
-			}
+			if (func == NULL)
+				return 1;
 
 			func->bus = ctrl->bus;
 			func->device = device;
@@ -2067,7 +2126,7 @@
 			func->configured = 0;
 			func->is_a_board = 0;
 
-			// We have to save the presence info for these slots
+			/* We have to save the presence info for these slots */
 			temp_word = ctrl->ctrl_int_comp >> 16;
 			func->presence_save = (temp_word >> hp_slot) & 0x01;
 			func->presence_save |=
@@ -2092,7 +2151,7 @@
 }
 
 
-int cpqhp_process_SS (struct controller *ctrl, struct pci_func *func)
+int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
 {
 	u8 device, class_code, header_type, BCR;
 	u8 index = 0;
@@ -2110,12 +2169,12 @@
 		physical_slot = p_slot->number;
 	}
 
-	// Make sure there are no video controllers here
+	/* Make sure there are no video controllers here */
 	while (func && !rc) {
 		pci_bus->number = func->bus;
 		devfn = PCI_DEVFN(func->device, func->function);
 
-		// Check the Class Code
+		/* Check the Class Code */
 		rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code);
 		if (rc)
 			return rc;
@@ -2124,18 +2183,19 @@
 			/* Display/Video adapter (not supported) */
 			rc = REMOVE_NOT_SUPPORTED;
 		} else {
-			// See if it's a bridge
+			/* See if it's a bridge */
 			rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
 			if (rc)
 				return rc;
 
-			// If it's a bridge, check the VGA Enable bit
+			/* If it's a bridge, check the VGA Enable bit */
 			if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {
 				rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_BRIDGE_CONTROL, &BCR);
 				if (rc)
 					return rc;
 
-				// If the VGA Enable bit is set, remove isn't supported
+				/* If the VGA Enable bit is set, remove isn't
+				 * supported */
 				if (BCR & PCI_BRIDGE_CTL_VGA) {
 					rc = REMOVE_NOT_SUPPORTED;
 				}
@@ -2147,7 +2207,7 @@
 
 	func = cpqhp_slot_find(ctrl->bus, device, 0);
 	if ((func != NULL) && !rc) {
-		//FIXME: Replace flag should be passed into process_SS
+		/* FIXME: Replace flag should be passed into process_SS */
 		replace_flag = !(ctrl->add_support);
 		rc = remove_board(func, replace_flag, ctrl);
 	} else if (!rc) {
@@ -2157,16 +2217,42 @@
 	if (p_slot)
 		update_slot_info(ctrl, p_slot);
 
-	return(rc);
+	return rc;
 }
 
+/**
+ * switch_leds: switch the leds, go from one site to the other.
+ * @ctrl: controller to use
+ * @num_of_slots: number of slots to use
+ * @direction: 1 to start from the left side, 0 to start right.
+ */
+static void switch_leds(struct controller *ctrl, const int num_of_slots,
+			u32 *work_LED, const int direction)
+{
+	int loop;
 
+	for (loop = 0; loop < num_of_slots; loop++) {
+		if (direction)
+			*work_LED = *work_LED >> 1;
+		else
+			*work_LED = *work_LED << 1;
+		writel(*work_LED, ctrl->hpc_reg + LED_CONTROL);
+
+		set_SOGO(ctrl);
+
+		/* Wait for SOGO interrupt */
+		wait_for_ctrl_irq(ctrl);
+
+		/* Get ready for next iteration */
+		long_delay((2*HZ)/10);
+	}
+}
 
 /**
  * hardware_test - runs hardware tests
  *
  * For hot plug ctrl folks to play with.
- * test_num is the number entered in the GUI
+ * test_num is the number written to the "test" file in sysfs
  *
  */
 int cpqhp_hardware_test(struct controller *ctrl, int test_num)
@@ -2180,132 +2266,45 @@
 
 	switch (test_num) {
 		case 1:
-			// Do stuff here!
+			/* Do stuff here! */
 
-			// Do that funky LED thing
-			save_LED = readl(ctrl->hpc_reg + LED_CONTROL);	// so we can restore them later
+			/* Do that funky LED thing */
+			/* so we can restore them later */
+			save_LED = readl(ctrl->hpc_reg + LED_CONTROL);
 			work_LED = 0x01010101;
-			writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-			for (loop = 0; loop < num_of_slots; loop++) {
-				set_SOGO(ctrl);
-
-				// Wait for SOGO interrupt
-				wait_for_ctrl_irq (ctrl);
-
-				// Get ready for next iteration
-				work_LED = work_LED << 1;
-				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-				long_delay((2*HZ)/10);
-			}
-			for (loop = 0; loop < num_of_slots; loop++) {
-				work_LED = work_LED >> 1;
-				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-				
-				set_SOGO(ctrl);
-
-				// Wait for SOGO interrupt
-				wait_for_ctrl_irq (ctrl);
-
-				// Get ready for next iteration
-				long_delay((2*HZ)/10);
-			}
-			for (loop = 0; loop < num_of_slots; loop++) {
-				work_LED = work_LED << 1;
-				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-				
-				set_SOGO(ctrl);
-
-				// Wait for SOGO interrupt
-				wait_for_ctrl_irq (ctrl);
-
-				// Get ready for next iteration
-				long_delay((2*HZ)/10);
-			}
-			for (loop = 0; loop < num_of_slots; loop++) {
-				work_LED = work_LED >> 1;
-				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-				
-				set_SOGO(ctrl);
-
-				// Wait for SOGO interrupt
-				wait_for_ctrl_irq (ctrl);
-
-				// Get ready for next iteration
-				long_delay((2*HZ)/10);
-			}
+			switch_leds(ctrl, num_of_slots, &work_LED, 0);
+			switch_leds(ctrl, num_of_slots, &work_LED, 1);
+			switch_leds(ctrl, num_of_slots, &work_LED, 0);
+			switch_leds(ctrl, num_of_slots, &work_LED, 1);
 
 			work_LED = 0x01010000;
 			writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-			for (loop = 0; loop < num_of_slots; loop++) {
-				set_SOGO(ctrl);
-
-				// Wait for SOGO interrupt
-				wait_for_ctrl_irq (ctrl);
-
-				// Get ready for next iteration
-				work_LED = work_LED << 1;
-				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-				long_delay((2*HZ)/10);
-			}
-			for (loop = 0; loop < num_of_slots; loop++) {
-				work_LED = work_LED >> 1;
-				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-				
-				set_SOGO(ctrl);
-
-				// Wait for SOGO interrupt
-				wait_for_ctrl_irq (ctrl);
-
-				// Get ready for next iteration
-				long_delay((2*HZ)/10);
-			}
+			switch_leds(ctrl, num_of_slots, &work_LED, 0);
+			switch_leds(ctrl, num_of_slots, &work_LED, 1);
 			work_LED = 0x00000101;
 			writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-			for (loop = 0; loop < num_of_slots; loop++) {
-				work_LED = work_LED << 1;
-				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-				
-				set_SOGO(ctrl);
-
-				// Wait for SOGO interrupt
-				wait_for_ctrl_irq (ctrl);
-
-				// Get ready for next iteration
-				long_delay((2*HZ)/10);
-			}
-			for (loop = 0; loop < num_of_slots; loop++) {
-				work_LED = work_LED >> 1;
-				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
-				
-				set_SOGO(ctrl);
-
-				// Wait for SOGO interrupt
-				wait_for_ctrl_irq (ctrl);
-
-				// Get ready for next iteration
-				long_delay((2*HZ)/10);
-			}
-
+			switch_leds(ctrl, num_of_slots, &work_LED, 0);
+			switch_leds(ctrl, num_of_slots, &work_LED, 1);
 
 			work_LED = 0x01010000;
 			writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
 			for (loop = 0; loop < num_of_slots; loop++) {
 				set_SOGO(ctrl);
 
-				// Wait for SOGO interrupt
+				/* Wait for SOGO interrupt */
 				wait_for_ctrl_irq (ctrl);
 
-				// Get ready for next iteration
+				/* Get ready for next iteration */
 				long_delay((3*HZ)/10);
 				work_LED = work_LED >> 16;
 				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
 				
 				set_SOGO(ctrl);
 
-				// Wait for SOGO interrupt
+				/* Wait for SOGO interrupt */
 				wait_for_ctrl_irq (ctrl);
 
-				// Get ready for next iteration
+				/* Get ready for next iteration */
 				long_delay((3*HZ)/10);
 				work_LED = work_LED << 16;
 				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
@@ -2313,18 +2312,19 @@
 				writel(work_LED, ctrl->hpc_reg + LED_CONTROL);
 			}
 
-			writel (save_LED, ctrl->hpc_reg + LED_CONTROL);	// put it back the way it was
+			/* put it back the way it was */
+			writel(save_LED, ctrl->hpc_reg + LED_CONTROL);
 
 			set_SOGO(ctrl);
 
-			// Wait for SOBS to be unset
+			/* Wait for SOBS to be unset */
 			wait_for_ctrl_irq (ctrl);
 			break;
 		case 2:
-			// Do other stuff here!
+			/* Do other stuff here! */
 			break;
 		case 3:
-			// and more...
+			/* and more... */
 			break;
 	}
 	return 0;
@@ -2342,7 +2342,7 @@
  * Returns 0 if success
  *
  */
-static u32 configure_new_device (struct controller * ctrl, struct pci_func * func,
+static u32 configure_new_device(struct controller * ctrl, struct pci_func * func,
 				 u8 behind_bridge, struct resource_lists * resources)
 {
 	u8 temp_byte, function, max_functions, stop_it;
@@ -2354,7 +2354,7 @@
 	new_slot = func;
 
 	dbg("%s\n", __FUNCTION__);
-	// Check for Multi-function device
+	/* Check for Multi-function device */
 	ctrl->pci_bus->number = func->bus;
 	rc = pci_bus_read_config_byte (ctrl->pci_bus, PCI_DEVFN(func->device, func->function), 0x0E, &temp_byte);
 	if (rc) {
@@ -2362,7 +2362,7 @@
 		return rc;
 	}
 
-	if (temp_byte & 0x80)	// Multi-function device
+	if (temp_byte & 0x80)	/* Multi-function device */
 		max_functions = 8;
 	else
 		max_functions = 1;
@@ -2383,29 +2383,27 @@
 					cpqhp_return_board_resources(new_slot, resources);
 			}
 
-			return(rc);
+			return rc;
 		}
 
 		function++;
 
 		stop_it = 0;
 
-		//  The following loop skips to the next present function
-		//  and creates a board structure
+		/* The following loop skips to the next present function
+		 * and creates a board structure */
 
 		while ((function < max_functions) && (!stop_it)) {
 			pci_bus_read_config_dword (ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID);
 
-			if (ID == 0xFFFFFFFF) {	  // There's nothing there. 
+			if (ID == 0xFFFFFFFF) {	  /* There's nothing there. */
 				function++;
-			} else {  // There's something there
-				// Setup slot structure.
+			} else {  /* There's something there */
+				/* Setup slot structure. */
 				new_slot = cpqhp_slot_create(func->bus);
 
-				if (new_slot == NULL) {
-					// Out of memory
-					return(1);
-				}
+				if (new_slot == NULL)
+					return 1;
 
 				new_slot->bus = func->bus;
 				new_slot->device = func->device;
@@ -2442,8 +2440,9 @@
  * Returns 0 if success
  *
  */
-static int configure_new_function (struct controller * ctrl, struct pci_func * func,
-				   u8 behind_bridge, struct resource_lists * resources)
+static int configure_new_function(struct controller *ctrl, struct pci_func *func,
+				   u8 behind_bridge,
+				   struct resource_lists *resources)
 {
 	int cloop;
 	u8 IRQ = 0;
@@ -2475,57 +2474,56 @@
 	pci_bus->number = func->bus;
 	devfn = PCI_DEVFN(func->device, func->function);
 
-	// Check for Bridge
-	rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &temp_byte);
+	/* Check for Bridge */
+	rc = pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &temp_byte);
 	if (rc)
 		return rc;
 
-	if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { // PCI-PCI Bridge
-		// set Primary bus
+	if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { /* PCI-PCI Bridge */
+		/* set Primary bus */
 		dbg("set Primary bus = %d\n", func->bus);
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_PRIMARY_BUS, func->bus);
+		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_PRIMARY_BUS, func->bus);
 		if (rc)
 			return rc;
 
-		// find range of busses to use
+		/* find range of busses to use */
 		dbg("find ranges of buses to use\n");
-		bus_node = get_max_resource(&resources->bus_head, 1);
+		bus_node = get_max_resource(&(resources->bus_head), 1);
 
-		// If we don't have any busses to allocate, we can't continue
+		/* If we don't have any busses to allocate, we can't continue */
 		if (!bus_node)
 			return -ENOMEM;
 
-		// set Secondary bus
+		/* set Secondary bus */
 		temp_byte = bus_node->base;
 		dbg("set Secondary bus = %d\n", bus_node->base);
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, temp_byte);
+		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, temp_byte);
 		if (rc)
 			return rc;
 
-		// set subordinate bus
+		/* set subordinate bus */
 		temp_byte = bus_node->base + bus_node->length - 1;
 		dbg("set subordinate bus = %d\n", bus_node->base + bus_node->length - 1);
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte);
+		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte);
 		if (rc)
 			return rc;
 
-		// set subordinate Latency Timer and base Latency Timer
+		/* set subordinate Latency Timer and base Latency Timer */
 		temp_byte = 0x40;
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SEC_LATENCY_TIMER, temp_byte);
+		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SEC_LATENCY_TIMER, temp_byte);
 		if (rc)
 			return rc;
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_LATENCY_TIMER, temp_byte);
+		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_LATENCY_TIMER, temp_byte);
 		if (rc)
 			return rc;
 
-		// set Cache Line size
+		/* set Cache Line size */
 		temp_byte = 0x08;
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_CACHE_LINE_SIZE, temp_byte);
+		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_CACHE_LINE_SIZE, temp_byte);
 		if (rc)
 			return rc;
 
-		// Setup the IO, memory, and prefetchable windows
-
+		/* Setup the IO, memory, and prefetchable windows */
 		io_node = get_max_resource(&(resources->io_head), 0x1000);
 		if (!io_node)
 			return -ENOMEM;
@@ -2537,13 +2535,16 @@
 			return -ENOMEM;
 		dbg("Setup the IO, memory, and prefetchable windows\n");
 		dbg("io_node\n");
-		dbg("(base, len, next) (%x, %x, %p)\n", io_node->base, io_node->length, io_node->next);
+		dbg("(base, len, next) (%x, %x, %p)\n", io_node->base,
+					io_node->length, io_node->next);
 		dbg("mem_node\n");
-		dbg("(base, len, next) (%x, %x, %p)\n", mem_node->base, mem_node->length, mem_node->next);
+		dbg("(base, len, next) (%x, %x, %p)\n", mem_node->base,
+					mem_node->length, mem_node->next);
 		dbg("p_mem_node\n");
-		dbg("(base, len, next) (%x, %x, %p)\n", p_mem_node->base, p_mem_node->length, p_mem_node->next);
+		dbg("(base, len, next) (%x, %x, %p)\n", p_mem_node->base,
+					p_mem_node->length, p_mem_node->next);
 
-		// set up the IRQ info
+		/* set up the IRQ info */
 		if (!resources->irqs) {
 			irqs.barber_pole = 0;
 			irqs.interrupt[0] = 0;
@@ -2560,32 +2561,28 @@
 			irqs.valid_INT = resources->irqs->valid_INT;
 		}
 
-		// set up resource lists that are now aligned on top and bottom
-		// for anything behind the bridge.
+		/* set up resource lists that are now aligned on top and bottom
+		 * for anything behind the bridge. */
 		temp_resources.bus_head = bus_node;
 		temp_resources.io_head = io_node;
 		temp_resources.mem_head = mem_node;
 		temp_resources.p_mem_head = p_mem_node;
 		temp_resources.irqs = &irqs;
 
-		// Make copies of the nodes we are going to pass down so that
-		// if there is a problem,we can just use these to free resources
-		hold_bus_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_IO_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+		/* Make copies of the nodes we are going to pass down so that
+		 * if there is a problem,we can just use these to free resources */
+		hold_bus_node = kmalloc(sizeof(*hold_bus_node), GFP_KERNEL);
+		hold_IO_node = kmalloc(sizeof(*hold_IO_node), GFP_KERNEL);
+		hold_mem_node = kmalloc(sizeof(*hold_mem_node), GFP_KERNEL);
+		hold_p_mem_node = kmalloc(sizeof(*hold_p_mem_node), GFP_KERNEL);
 
 		if (!hold_bus_node || !hold_IO_node || !hold_mem_node || !hold_p_mem_node) {
-			if (hold_bus_node)
-				kfree(hold_bus_node);
-			if (hold_IO_node)
-				kfree(hold_IO_node);
-			if (hold_mem_node)
-				kfree(hold_mem_node);
-			if (hold_p_mem_node)
-				kfree(hold_p_mem_node);
+			kfree(hold_bus_node);
+			kfree(hold_IO_node);
+			kfree(hold_mem_node);
+			kfree(hold_p_mem_node);
 
-			return(1);
+			return 1;
 		}
 
 		memcpy(hold_bus_node, bus_node, sizeof(struct pci_resource));
@@ -2594,55 +2591,55 @@
 		bus_node->length -= 1;
 		bus_node->next = NULL;
 
-		// If we have IO resources copy them and fill in the bridge's
-		// IO range registers
+		/* If we have IO resources copy them and fill in the bridge's
+		 * IO range registers */
 		if (io_node) {
 			memcpy(hold_IO_node, io_node, sizeof(struct pci_resource));
 			io_node->next = NULL;
 
-			// set IO base and Limit registers
+			/* set IO base and Limit registers */
 			temp_byte = io_node->base >> 8;
-			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_BASE, temp_byte);
+			rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_BASE, temp_byte);
 
 			temp_byte = (io_node->base + io_node->length - 1) >> 8;
-			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
+			rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
 		} else {
 			kfree(hold_IO_node);
 			hold_IO_node = NULL;
 		}
 
-		// If we have memory resources copy them and fill in the bridge's
-		// memory range registers.  Otherwise, fill in the range
-		// registers with values that disable them.
+		/* If we have memory resources copy them and fill in the
+		 * bridge's memory range registers.  Otherwise, fill in the
+		 * range registers with values that disable them. */
 		if (mem_node) {
 			memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
 			mem_node->next = NULL;
 
-			// set Mem base and Limit registers
+			/* set Mem base and Limit registers */
 			temp_word = mem_node->base >> 16;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
 
 			temp_word = (mem_node->base + mem_node->length - 1) >> 16;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
 		} else {
 			temp_word = 0xFFFF;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
 
 			temp_word = 0x0000;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
 
 			kfree(hold_mem_node);
 			hold_mem_node = NULL;
 		}
 
-		// If we have prefetchable memory resources copy them and 
-		// fill in the bridge's memory range registers.  Otherwise,
-		// fill in the range registers with values that disable them.
+		/* If we have prefetchable memory resources copy them and 
+		 * fill in the bridge's memory range registers.  Otherwise,
+		 * fill in the range registers with values that disable them. */
 		if (p_mem_node) {
 			memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource));
 			p_mem_node->next = NULL;
 
-			// set Pre Mem base and Limit registers
+			/* set Pre Mem base and Limit registers */
 			temp_word = p_mem_node->base >> 16;
 			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
 
@@ -2659,12 +2656,12 @@
 			hold_p_mem_node = NULL;
 		}
 
-		// Adjust this to compensate for extra adjustment in first loop
+		/* Adjust this to compensate for extra adjustment in first loop */
 		irqs.barber_pole--;
 
 		rc = 0;
 
-		// Here we actually find the devices and configure them
+		/* Here we actually find the devices and configure them */
 		for (device = 0; (device <= 0x1F) && !rc; device++) {
 			irqs.barber_pole = (irqs.barber_pole + 1) & 0x03;
 
@@ -2673,12 +2670,11 @@
 			pci_bus_read_config_dword (pci_bus, PCI_DEVFN(device, 0), 0x00, &ID);
 			pci_bus->number = func->bus;
 
-			if (ID != 0xFFFFFFFF) {	  //  device Present
-				// Setup slot structure.
+			if (ID != 0xFFFFFFFF) {	  /*  device present */
+				/* Setup slot structure. */
 				new_slot = cpqhp_slot_create(hold_bus_node->base);
 
 				if (new_slot == NULL) {
-					// Out of memory
 					rc = -ENOMEM;
 					continue;
 				}
@@ -2691,19 +2687,12 @@
 
 				rc = configure_new_device(ctrl, new_slot, 1, &temp_resources);
 				dbg("configure_new_device rc=0x%x\n",rc);
-			}	// End of IF (device in slot?)
-		}		// End of FOR loop
-
-		if (rc) {
-			cpqhp_destroy_resource_list(&temp_resources);
+			}	/* End of IF (device in slot?) */
+		}		/* End of FOR loop */
 
-			return_resource(&(resources->bus_head), hold_bus_node);
-			return_resource(&(resources->io_head), hold_IO_node);
-			return_resource(&(resources->mem_head), hold_mem_node);
-			return_resource(&(resources->p_mem_head), hold_p_mem_node);
-			return(rc);
-		}
-		// save the interrupt routing information
+		if (rc)
+			goto free_and_out;
+		/* save the interrupt routing information */
 		if (resources->irqs) {
 			resources->irqs->interrupt[0] = irqs.interrupt[0];
 			resources->irqs->interrupt[1] = irqs.interrupt[1];
@@ -2711,25 +2700,19 @@
 			resources->irqs->interrupt[3] = irqs.interrupt[3];
 			resources->irqs->valid_INT = irqs.valid_INT;
 		} else if (!behind_bridge) {
-			// We need to hook up the interrupts here
+			/* We need to hook up the interrupts here */
 			for (cloop = 0; cloop < 4; cloop++) {
 				if (irqs.valid_INT & (0x01 << cloop)) {
 					rc = cpqhp_set_irq(func->bus, func->device,
 							   0x0A + cloop, irqs.interrupt[cloop]);
-					if (rc) {
-						cpqhp_destroy_resource_list (&temp_resources);
-
-						return_resource(&(resources-> bus_head), hold_bus_node);
-						return_resource(&(resources-> io_head), hold_IO_node);
-						return_resource(&(resources-> mem_head), hold_mem_node);
-						return_resource(&(resources-> p_mem_head), hold_p_mem_node);
-						return rc;
-					}
+					if (rc)
+						goto free_and_out;
 				}
-			}	// end of for loop
+			}	/* end of for loop */
 		}
-		// Return unused bus resources
-		// First use the temporary node to store information for the board
+		/* Return unused bus resources
+		 * First use the temporary node to store information for
+		 * the board */
 		if (hold_bus_node && bus_node && temp_resources.bus_head) {
 			hold_bus_node->length = bus_node->base - hold_bus_node->base;
 
@@ -2738,7 +2721,7 @@
 
 			temp_byte = temp_resources.bus_head->base - 1;
 
-			// set subordinate bus
+			/* set subordinate bus */
 			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte);
 
 			if (temp_resources.bus_head->length == 0) {
@@ -2749,13 +2732,13 @@
 			}
 		}
 
-		// If we have IO space available and there is some left,
-		// return the unused portion
+		/* If we have IO space available and there is some left,
+		 * return the unused portion */
 		if (hold_IO_node && temp_resources.io_head) {
 			io_node = do_pre_bridge_resource_split(&(temp_resources.io_head),
 							       &hold_IO_node, 0x1000);
 
-			// Check if we were able to split something off
+			/* Check if we were able to split something off */
 			if (io_node) {
 				hold_IO_node->base = io_node->base + io_node->length;
 
@@ -2767,12 +2750,13 @@
 
 			io_node = do_bridge_resource_split(&(temp_resources.io_head), 0x1000);
 
-			// Check if we were able to split something off
+			/* Check if we were able to split something off */
 			if (io_node) {
-				// First use the temporary node to store information for the board
+				/* First use the temporary node to store
+				 * information for the board */
 				hold_IO_node->length = io_node->base - hold_IO_node->base;
 
-				// If we used any, add it to the board's list
+				/* If we used any, add it to the board's list */
 				if (hold_IO_node->length) {
 					hold_IO_node->next = func->io_head;
 					func->io_head = hold_IO_node;
@@ -2782,7 +2766,7 @@
 
 					return_resource(&(resources->io_head), io_node);
 				} else {
-					// it doesn't need any IO
+					/* it doesn't need any IO */
 					temp_word = 0x0000;
 					rc = pci_bus_write_config_word (pci_bus, devfn, PCI_IO_LIMIT, temp_word);
 
@@ -2790,22 +2774,22 @@
 					kfree(hold_IO_node);
 				}
 			} else {
-				// it used most of the range
+				/* it used most of the range */
 				hold_IO_node->next = func->io_head;
 				func->io_head = hold_IO_node;
 			}
 		} else if (hold_IO_node) {
-			// it used the whole range
+			/* it used the whole range */
 			hold_IO_node->next = func->io_head;
 			func->io_head = hold_IO_node;
 		}
-		// If we have memory space available and there is some left,
-		// return the unused portion
+		/* If we have memory space available and there is some left,
+		 * return the unused portion */
 		if (hold_mem_node && temp_resources.mem_head) {
 			mem_node = do_pre_bridge_resource_split(&(temp_resources.  mem_head),
 								&hold_mem_node, 0x100000);
 
-			// Check if we were able to split something off
+			/* Check if we were able to split something off */
 			if (mem_node) {
 				hold_mem_node->base = mem_node->base + mem_node->length;
 
@@ -2817,23 +2801,24 @@
 
 			mem_node = do_bridge_resource_split(&(temp_resources.mem_head), 0x100000);
 
-			// Check if we were able to split something off
+			/* Check if we were able to split something off */
 			if (mem_node) {
-				// First use the temporary node to store information for the board
+				/* First use the temporary node to store
+				 * information for the board */
 				hold_mem_node->length = mem_node->base - hold_mem_node->base;
 
 				if (hold_mem_node->length) {
 					hold_mem_node->next = func->mem_head;
 					func->mem_head = hold_mem_node;
 
-					// configure end address
+					/* configure end address */
 					temp_word = (mem_node->base - 1) >> 16;
 					rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
 
-					// Return unused resources to the pool
+					/* Return unused resources to the pool */
 					return_resource(&(resources->mem_head), mem_node);
 				} else {
-					// it doesn't need any Mem
+					/* it doesn't need any Mem */
 					temp_word = 0x0000;
 					rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
 
@@ -2841,22 +2826,22 @@
 					kfree(hold_mem_node);
 				}
 			} else {
-				// it used most of the range
+				/* it used most of the range */
 				hold_mem_node->next = func->mem_head;
 				func->mem_head = hold_mem_node;
 			}
 		} else if (hold_mem_node) {
-			// it used the whole range
+			/* it used the whole range */
 			hold_mem_node->next = func->mem_head;
 			func->mem_head = hold_mem_node;
 		}
-		// If we have prefetchable memory space available and there is some 
-		// left at the end, return the unused portion
+		/* If we have prefetchable memory space available and there
+		 * is some left at the end, return the unused portion */
 		if (hold_p_mem_node && temp_resources.p_mem_head) {
 			p_mem_node = do_pre_bridge_resource_split(&(temp_resources.p_mem_head),
 								  &hold_p_mem_node, 0x100000);
 
-			// Check if we were able to split something off
+			/* Check if we were able to split something off */
 			if (p_mem_node) {
 				hold_p_mem_node->base = p_mem_node->base + p_mem_node->length;
 
@@ -2868,12 +2853,13 @@
 
 			p_mem_node = do_bridge_resource_split(&(temp_resources.p_mem_head), 0x100000);
 
-			// Check if we were able to split something off
+			/* Check if we were able to split something off */
 			if (p_mem_node) {
-				// First use the temporary node to store information for the board
+				/* First use the temporary node to store
+				 * information for the board */
 				hold_p_mem_node->length = p_mem_node->base - hold_p_mem_node->base;
 
-				// If we used any, add it to the board's list
+				/* If we used any, add it to the board's list */
 				if (hold_p_mem_node->length) {
 					hold_p_mem_node->next = func->p_mem_head;
 					func->p_mem_head = hold_p_mem_node;
@@ -2883,7 +2869,7 @@
 
 					return_resource(&(resources->p_mem_head), p_mem_node);
 				} else {
-					// it doesn't need any PMem
+					/* it doesn't need any PMem */
 					temp_word = 0x0000;
 					rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
 
@@ -2891,35 +2877,42 @@
 					kfree(hold_p_mem_node);
 				}
 			} else {
-				// it used the most of the range
+				/* it used the most of the range */
 				hold_p_mem_node->next = func->p_mem_head;
 				func->p_mem_head = hold_p_mem_node;
 			}
 		} else if (hold_p_mem_node) {
-			// it used the whole range
+			/* it used the whole range */
 			hold_p_mem_node->next = func->p_mem_head;
 			func->p_mem_head = hold_p_mem_node;
 		}
-		// We should be configuring an IRQ and the bridge's base address
-		// registers if it needs them.  Although we have never seen such
-		// a device
-
-		// enable card
-		command = 0x0157;	// = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |  PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY | PCI_COMMAND_SERR
+		/* We should be configuring an IRQ and the bridge's base address
+		 * registers if it needs them.  Although we have never seen such
+		 * a device */
+
+		/* enable card */
+		command = 0x0157;	/* = PCI_COMMAND_IO |
+					 *   PCI_COMMAND_MEMORY |
+					 *   PCI_COMMAND_MASTER |
+					 *   PCI_COMMAND_INVALIDATE |
+					 *   PCI_COMMAND_PARITY |
+					 *   PCI_COMMAND_SERR */
 		rc = pci_bus_write_config_word (pci_bus, devfn, PCI_COMMAND, command);
 
-		// set Bridge Control Register
-		command = 0x07;		// = PCI_BRIDGE_CTL_PARITY | PCI_BRIDGE_CTL_SERR | PCI_BRIDGE_CTL_NO_ISA
+		/* set Bridge Control Register */
+		command = 0x07;		/* = PCI_BRIDGE_CTL_PARITY |
+					 *   PCI_BRIDGE_CTL_SERR |
+					 *   PCI_BRIDGE_CTL_NO_ISA */
 		rc = pci_bus_write_config_word (pci_bus, devfn, PCI_BRIDGE_CONTROL, command);
 	} else if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_NORMAL) {
-		// Standard device
+		/* Standard device */
 		rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code);
 
 		if (class_code == PCI_BASE_CLASS_DISPLAY) {
-			// Display (video) adapter (not supported)
-			return(DEVICE_TYPE_NOT_SUPPORTED);
+			/* Display (video) adapter (not supported) */
+			return DEVICE_TYPE_NOT_SUPPORTED;
 		}
-		// Figure out IO and memory needs
+		/* Figure out IO and memory needs */
 		for (cloop = 0x10; cloop <= 0x24; cloop += 4) {
 			temp_register = 0xFFFFFFFF;
 
@@ -2929,11 +2922,11 @@
 			rc = pci_bus_read_config_dword (pci_bus, devfn, cloop, &temp_register);
 			dbg("CND: base = 0x%x\n", temp_register);
 
-			if (temp_register) {	  // If this register is implemented
+			if (temp_register) {	  /* If this register is implemented */
 				if ((temp_register & 0x03L) == 0x01) {
-					// Map IO
+					/* Map IO */
 
-					// set base = amount of IO space
+					/* set base = amount of IO space */
 					base = temp_register & 0xFFFFFFFC;
 					base = ~base + 1;
 
@@ -2943,7 +2936,7 @@
 					    io_node->base, io_node->length, io_node->next);
 					dbg("func (%p) io_head (%p)\n", func, func->io_head);
 
-					// allocate the resource to the board
+					/* allocate the resource to the board */
 					if (io_node) {
 						base = io_node->base;
 
@@ -2952,14 +2945,14 @@
 					} else
 						return -ENOMEM;
 				} else if ((temp_register & 0x0BL) == 0x08) {
-					// Map prefetchable memory
+					/* Map prefetchable memory */
 					base = temp_register & 0xFFFFFFF0;
 					base = ~base + 1;
 
 					dbg("CND:      length = 0x%x\n", base);
 					p_mem_node = get_resource(&(resources->p_mem_head), base);
 
-					// allocate the resource to the board
+					/* allocate the resource to the board */
 					if (p_mem_node) {
 						base = p_mem_node->base;
 
@@ -2968,14 +2961,14 @@
 					} else
 						return -ENOMEM;
 				} else if ((temp_register & 0x0BL) == 0x00) {
-					// Map memory
+					/* Map memory */
 					base = temp_register & 0xFFFFFFF0;
 					base = ~base + 1;
 
 					dbg("CND:      length = 0x%x\n", base);
 					mem_node = get_resource(&(resources->mem_head), base);
 
-					// allocate the resource to the board
+					/* allocate the resource to the board */
 					if (mem_node) {
 						base = mem_node->base;
 
@@ -2984,14 +2977,14 @@
 					} else
 						return -ENOMEM;
 				} else if ((temp_register & 0x0BL) == 0x04) {
-					// Map memory
+					/* Map memory */
 					base = temp_register & 0xFFFFFFF0;
 					base = ~base + 1;
 
 					dbg("CND:      length = 0x%x\n", base);
 					mem_node = get_resource(&(resources->mem_head), base);
 
-					// allocate the resource to the board
+					/* allocate the resource to the board */
 					if (mem_node) {
 						base = mem_node->base;
 
@@ -3000,42 +2993,44 @@
 					} else
 						return -ENOMEM;
 				} else if ((temp_register & 0x0BL) == 0x06) {
-					// Those bits are reserved, we can't handle this
-					return(1);
+					/* Those bits are reserved, we can't handle this */
+					return 1;
 				} else {
-					// Requesting space below 1M
-					return(NOT_ENOUGH_RESOURCES);
+					/* Requesting space below 1M */
+					return NOT_ENOUGH_RESOURCES;
 				}
 
-				rc = pci_bus_write_config_dword (pci_bus, devfn, cloop, base);
+				rc = pci_bus_write_config_dword(pci_bus, devfn, cloop, base);
 
-				// Check for 64-bit base
+				/* Check for 64-bit base */
 				if ((temp_register & 0x07L) == 0x04) {
 					cloop += 4;
 
-					// Upper 32 bits of address always zero on today's systems
-					// FIXME this is probably not true on Alpha and ia64???
+					/* Upper 32 bits of address always zero
+					 * on today's systems */
+					/* FIXME this is probably not true on
+					 * Alpha and ia64??? */
 					base = 0;
-					rc = pci_bus_write_config_dword (pci_bus, devfn, cloop, base);
+					rc = pci_bus_write_config_dword(pci_bus, devfn, cloop, base);
 				}
 			}
-		}		// End of base register loop
+		}		/* End of base register loop */
 		if (cpqhp_legacy_mode) {
-			// Figure out which interrupt pin this function uses
+			/* Figure out which interrupt pin this function uses */
 			rc = pci_bus_read_config_byte (pci_bus, devfn, 
 				PCI_INTERRUPT_PIN, &temp_byte);
 
-			// If this function needs an interrupt and we are behind a bridge
-			// and the pin is tied to something that's alread mapped,
-			// set this one the same
+			/* If this function needs an interrupt and we are behind
+			 * a bridge and the pin is tied to something that's
+			 * alread mapped, set this one the same */
 			if (temp_byte && resources->irqs && 
 			    (resources->irqs->valid_INT & 
 			     (0x01 << ((temp_byte + resources->irqs->barber_pole - 1) & 0x03)))) {
-				// We have to share with something already set up
+				/* We have to share with something already set up */
 				IRQ = resources->irqs->interrupt[(temp_byte + 
 					resources->irqs->barber_pole - 1) & 0x03];
 			} else {
-				// Program IRQ based on card type
+				/* Program IRQ based on card type */
 				rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code);
 
 				if (class_code == PCI_BASE_CLASS_STORAGE) {
@@ -3045,43 +3040,59 @@
 				}
 			}
 
-			// IRQ Line
+			/* IRQ Line */
 			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_INTERRUPT_LINE, IRQ);
 		}
 
 		if (!behind_bridge) {
 			rc = cpqhp_set_irq(func->bus, func->device, temp_byte + 0x09, IRQ);
 			if (rc)
-				return(1);
+				return 1;
 		} else {
-			//TBD - this code may also belong in the other clause of this If statement
+			/* TBD - this code may also belong in the other clause
+			 * of this If statement */
 			resources->irqs->interrupt[(temp_byte + resources->irqs->barber_pole - 1) & 0x03] = IRQ;
 			resources->irqs->valid_INT |= 0x01 << (temp_byte + resources->irqs->barber_pole - 1) & 0x03;
 		}
 
-		// Latency Timer
+		/* Latency Timer */
 		temp_byte = 0x40;
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_LATENCY_TIMER, temp_byte);
+		rc = pci_bus_write_config_byte(pci_bus, devfn,
+					PCI_LATENCY_TIMER, temp_byte);
 
-		// Cache Line size
+		/* Cache Line size */
 		temp_byte = 0x08;
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_CACHE_LINE_SIZE, temp_byte);
+		rc = pci_bus_write_config_byte(pci_bus, devfn,
+					PCI_CACHE_LINE_SIZE, temp_byte);
 
-		// disable ROM base Address
+		/* disable ROM base Address */
 		temp_dword = 0x00L;
-		rc = pci_bus_write_config_word (pci_bus, devfn, PCI_ROM_ADDRESS, temp_dword);
+		rc = pci_bus_write_config_word(pci_bus, devfn,
+					PCI_ROM_ADDRESS, temp_dword);
 
-		// enable card
-		temp_word = 0x0157;	// = PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |  PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY | PCI_COMMAND_SERR
-		rc = pci_bus_write_config_word (pci_bus, devfn, PCI_COMMAND, temp_word);
-	}			// End of Not-A-Bridge else
-	else {
-		// It's some strange type of PCI adapter (Cardbus?)
-		return(DEVICE_TYPE_NOT_SUPPORTED);
+		/* enable card */
+		temp_word = 0x0157;	/* = PCI_COMMAND_IO |
+					 *   PCI_COMMAND_MEMORY |
+					 *   PCI_COMMAND_MASTER |
+					 *   PCI_COMMAND_INVALIDATE |
+					 *   PCI_COMMAND_PARITY |
+					 *   PCI_COMMAND_SERR */
+		rc = pci_bus_write_config_word (pci_bus, devfn,
+					PCI_COMMAND, temp_word);
+	} else {		/* End of Not-A-Bridge else */
+		/* It's some strange type of PCI adapter (Cardbus?) */
+		return DEVICE_TYPE_NOT_SUPPORTED;
 	}
 
 	func->configured = 1;
 
 	return 0;
-}
+free_and_out:
+	cpqhp_destroy_resource_list (&temp_resources);
 
+	return_resource(&(resources-> bus_head), hold_bus_node);
+	return_resource(&(resources-> io_head), hold_IO_node);
+	return_resource(&(resources-> mem_head), hold_mem_node);
+	return_resource(&(resources-> p_mem_head), hold_p_mem_node);
+	return rc;
+}
diff -Nru a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
--- a/drivers/pci/hotplug/cpqphp_pci.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/pci/hotplug/cpqphp_pci.c	Tue Jun 15 22:21:03 2004
@@ -722,23 +722,23 @@
 		devfn = PCI_DEVFN(func->device, func->function);
 
 		// Save the command register
-		pci_bus_read_config_word (pci_bus, devfn, PCI_COMMAND, &save_command);
+		pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &save_command);
 
 		// disable card
 		command = 0x00;
-		pci_bus_write_config_word (pci_bus, devfn, PCI_COMMAND, command);
+		pci_bus_write_config_word(pci_bus, devfn, PCI_COMMAND, command);
 
 		// Check for Bridge
-		pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
+		pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
 
 		if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {	  // PCI-PCI Bridge
 			// Clear Bridge Control Register
 			command = 0x00;
-			pci_bus_write_config_word (pci_bus, devfn, PCI_BRIDGE_CONTROL, command);
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte);
+			pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, command);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte);
 
-			bus_node =(struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			bus_node = kmalloc(sizeof(*bus_node), GFP_KERNEL);
 			if (!bus_node)
 				return -ENOMEM;
 
@@ -749,11 +749,11 @@
 			func->bus_head = bus_node;
 
 			// Save IO base and Limit registers
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_IO_BASE, &b_base);
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_IO_LIMIT, &b_length);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_BASE, &b_base);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_LIMIT, &b_length);
 
 			if ((b_base <= b_length) && (save_command & 0x01)) {
-				io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				io_node = kmalloc(sizeof(*io_node), GFP_KERNEL);
 				if (!io_node)
 					return -ENOMEM;
 
@@ -765,11 +765,11 @@
 			}
 
 			// Save memory base and Limit registers
-			pci_bus_read_config_word (pci_bus, devfn, PCI_MEMORY_BASE, &w_base);
-			pci_bus_read_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_BASE, &w_base);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);
 
 			if ((w_base <= w_length) && (save_command & 0x02)) {
-				mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				mem_node = kmalloc(sizeof(*mem_node), GFP_KERNEL);
 				if (!mem_node)
 					return -ENOMEM;
 
@@ -781,11 +781,11 @@
 			}
 
 			// Save prefetchable memory base and Limit registers
-			pci_bus_read_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);
-			pci_bus_read_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);
 
 			if ((w_base <= w_length) && (save_command & 0x02)) {
-				p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				p_mem_node = kmalloc(sizeof(*p_mem_node), GFP_KERNEL);
 				if (!p_mem_node)
 					return -ENOMEM;
 
@@ -800,8 +800,8 @@
 				pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base);
 
 				temp_register = 0xFFFFFFFF;
-				pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);
-				pci_bus_read_config_dword (pci_bus, devfn, cloop, &base);
+				pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register);
+				pci_bus_read_config_dword(pci_bus, devfn, cloop, &base);
 
 				temp_register = base;
 
@@ -813,7 +813,8 @@
 						temp_register = base & 0xFFFFFFFE;
 						temp_register = (~temp_register) + 1;
 
-						io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+						io_node = kmalloc(sizeof(*io_node),
+								GFP_KERNEL);
 						if (!io_node)
 							return -ENOMEM;
 
@@ -830,7 +831,8 @@
 						temp_register = base & 0xFFFFFFF0;
 						temp_register = (~temp_register) + 1;
 
-						p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+						p_mem_node = kmalloc(sizeof(*p_mem_node),
+								GFP_KERNEL);
 						if (!p_mem_node)
 							return -ENOMEM;
 
@@ -846,7 +848,8 @@
 						temp_register = base & 0xFFFFFFF0;
 						temp_register = (~temp_register) + 1;
 
-						mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+						mem_node = kmalloc(sizeof(*mem_node),
+								GFP_KERNEL);
 						if (!mem_node)
 							return -ENOMEM;
 
@@ -862,11 +865,11 @@
 		} else if ((header_type & 0x7F) == 0x00) {	  // Standard header
 			// Figure out IO and memory base lengths
 			for (cloop = 0x10; cloop <= 0x24; cloop += 4) {
-				pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base);
+				pci_bus_read_config_dword(pci_bus, devfn, cloop, &save_base);
 
 				temp_register = 0xFFFFFFFF;
-				pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);
-				pci_bus_read_config_dword (pci_bus, devfn, cloop, &base);
+				pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register);
+				pci_bus_read_config_dword(pci_bus, devfn, cloop, &base);
 
 				temp_register = base;
 
@@ -878,7 +881,8 @@
 						temp_register = base & 0xFFFFFFFE;
 						temp_register = (~temp_register) + 1;
 
-						io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+						io_node = kmalloc(sizeof(*io_node),
+								GFP_KERNEL);
 						if (!io_node)
 							return -ENOMEM;
 
@@ -894,7 +898,8 @@
 						temp_register = base & 0xFFFFFFF0;
 						temp_register = (~temp_register) + 1;
 
-						p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+						p_mem_node = kmalloc(sizeof(*p_mem_node),
+								GFP_KERNEL);
 						if (!p_mem_node)
 							return -ENOMEM;
 
@@ -910,7 +915,8 @@
 						temp_register = base & 0xFFFFFFF0;
 						temp_register = (~temp_register) + 1;
 
-						mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+						mem_node = kmalloc(sizeof(*mem_node),
+								GFP_KERNEL);
 						if (!mem_node)
 							return -ENOMEM;
 
@@ -1293,14 +1299,15 @@
 		temp_dword = io_base + io_length;
 
 		if ((io_base) && (temp_dword < 0x10000)) {
-			io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			io_node = kmalloc(sizeof(*io_node), GFP_KERNEL);
 			if (!io_node)
 				return -ENOMEM;
 
 			io_node->base = io_base;
 			io_node->length = io_length;
 
-			dbg("found io_node(base, length) = %x, %x\n", io_node->base, io_node->length);
+			dbg("found io_node(base, length) = %x, %x\n",
+					io_node->base, io_node->length);
 			dbg("populated slot =%d \n", populated_slot);
 			if (!populated_slot) {
 				io_node->next = ctrl->io_head;
@@ -1314,7 +1321,7 @@
 		// If we've got a valid memory base, use it
 		temp_dword = mem_base + mem_length;
 		if ((mem_base) && (temp_dword < 0x10000)) {
-			mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			mem_node = kmalloc(sizeof(*mem_node), GFP_KERNEL);
 			if (!mem_node)
 				return -ENOMEM;
 
@@ -1322,7 +1329,8 @@
 
 			mem_node->length = mem_length << 16;
 
-			dbg("found mem_node(base, length) = %x, %x\n", mem_node->base, mem_node->length);
+			dbg("found mem_node(base, length) = %x, %x\n",
+					mem_node->base, mem_node->length);
 			dbg("populated slot =%d \n", populated_slot);
 			if (!populated_slot) {
 				mem_node->next = ctrl->mem_head;
@@ -1337,14 +1345,15 @@
 		// the base + length isn't greater than 0xFFFF
 		temp_dword = pre_mem_base + pre_mem_length;
 		if ((pre_mem_base) && (temp_dword < 0x10000)) {
-			p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			p_mem_node = kmalloc(sizeof(*p_mem_node), GFP_KERNEL);
 			if (!p_mem_node)
 				return -ENOMEM;
 
 			p_mem_node->base = pre_mem_base << 16;
 
 			p_mem_node->length = pre_mem_length << 16;
-			dbg("found p_mem_node(base, length) = %x, %x\n", p_mem_node->base, p_mem_node->length);
+			dbg("found p_mem_node(base, length) = %x, %x\n",
+					p_mem_node->base, p_mem_node->length);
 			dbg("populated slot =%d \n", populated_slot);
 
 			if (!populated_slot) {
@@ -1360,13 +1369,14 @@
 		// The second condition is to ignore bus numbers on
 		// populated slots that don't have PCI-PCI bridges
 		if (secondary_bus && (secondary_bus != primary_bus)) {
-			bus_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			bus_node = kmalloc(sizeof(*bus_node), GFP_KERNEL);
 			if (!bus_node)
 				return -ENOMEM;
 
 			bus_node->base = secondary_bus;
 			bus_node->length = max_bus - secondary_bus + 1;
-			dbg("found bus_node(base, length) = %x, %x\n", bus_node->base, bus_node->length);
+			dbg("found bus_node(base, length) = %x, %x\n",
+					bus_node->base, bus_node->length);
 			dbg("populated slot =%d \n", populated_slot);
 			if (!populated_slot) {
 				bus_node->next = ctrl->bus_head;
diff -Nru a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h
--- a/drivers/pci/hotplug/ibmphp.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/pci/hotplug/ibmphp.h	Tue Jun 15 22:20:37 2004
@@ -271,7 +271,6 @@
 ***********************************************************/
 extern struct list_head ibmphp_ebda_pci_rsrc_head;
 extern struct list_head ibmphp_slot_head;
-extern struct list_head ibmphp_res_head;
 /***********************************************************
 * FUNCTION PROTOTYPES                                      *
 ***********************************************************/
@@ -754,7 +753,6 @@
 /* Functions */
 
 extern int ibmphp_init_devno (struct slot **);	/* This function is called from EBDA, so we need it not be static */
-extern int ibmphp_disable_slot (struct hotplug_slot *);	/* This function is called from HPC, so we need it to not be static */
 extern int ibmphp_do_disable_slot (struct slot *slot_cur);
 extern int ibmphp_update_slot_info (struct slot *);	/* This function is called from HPC, so we need it to not be be static */
 extern int ibmphp_configure_card (struct pci_func *, u8);
diff -Nru a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
--- a/drivers/pci/hotplug/ibmphp_core.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/pci/hotplug/ibmphp_core.c	Tue Jun 15 22:21:05 2004
@@ -1146,7 +1146,7 @@
 * OUTPUT: SUCCESS 0 ; FAILURE: UNCONFIGURE , VALIDATE         *
           DISABLE POWER ,                                    *
 **************************************************************/
-int ibmphp_disable_slot (struct hotplug_slot *hotplug_slot)
+static int ibmphp_disable_slot (struct hotplug_slot *hotplug_slot)
 {
 	struct slot *slot = hotplug_slot->private;
 	int rc;
diff -Nru a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
--- a/drivers/pci/hotplug/ibmphp_res.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/pci/hotplug/ibmphp_res.c	Tue Jun 15 22:20:44 2004
@@ -45,7 +45,6 @@
 static struct bus_node *find_bus_wprev (u8, struct bus_node **, u8);
 
 static LIST_HEAD(gbuses);
-LIST_HEAD(ibmphp_res_head);
 
 static struct bus_node * __init alloc_error_bus (struct ebda_pci_rsrc * curr, u8 busno, int flag)
 {
diff -Nru a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
--- a/drivers/pci/hotplug/pci_hotplug_core.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/pci/hotplug/pci_hotplug_core.c	Tue Jun 15 22:20:44 2004
@@ -29,6 +29,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/list.h>
@@ -45,11 +46,7 @@
 #include "pci_hotplug.h"
 
 
-#if !defined(CONFIG_HOTPLUG_PCI_MODULE)
-	#define MY_NAME	"pci_hotplug"
-#else
-	#define MY_NAME	THIS_MODULE->name
-#endif
+#define MY_NAME	"pci_hotplug"
 
 #define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt , MY_NAME , __FUNCTION__ , ## arg); } while (0)
 #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
@@ -704,7 +701,7 @@
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
+module_param(debug, bool, 644);
 MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
 
 EXPORT_SYMBOL_GPL(pci_hotplug_slots_subsys);
diff -Nru a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
--- a/drivers/pci/hotplug/pciehp.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/pci/hotplug/pciehp.h	Tue Jun 15 22:20:42 2004
@@ -35,11 +35,7 @@
 #include <asm/io.h>		
 #include "pci_hotplug.h"
 
-#if !defined(CONFIG_HOTPLUG_PCI_PCIE_MODULE)
-	#define MY_NAME	"pciehp"
-#else
-	#define MY_NAME	THIS_MODULE->name
-#endif
+#define MY_NAME	"pciehp"
 
 extern int pciehp_poll_mode;
 extern int pciehp_poll_time;
@@ -72,9 +68,7 @@
 	struct pci_dev* pci_dev;
 };
 
-#define SLOT_MAGIC	0x67267321
 struct slot {
-	u32 magic;
 	struct slot *next;
 	u8 bus;
 	u8 device;
@@ -108,9 +102,9 @@
 struct controller {
 	struct controller *next;
 	struct semaphore crit_sect;	/* critical section semaphore */
-	void * hpc_ctlr_handle;		/* HPC controller handle */
+	void *hpc_ctlr_handle;		/* HPC controller handle */
 	int num_slots;			/* Number of slots on ctlr */
-	int slot_num_inc;			/* 1 or -1 */
+	int slot_num_inc;		/* 1 or -1 */
 	struct pci_resource *mem_head;
 	struct pci_resource *p_mem_head;
 	struct pci_resource *io_head;
@@ -191,7 +185,7 @@
 #define msg_initialization_err	"Initialization failure, error=%d\n"
 #define msg_HPC_rev_error	"Unsupported revision of the PCI hot plug controller found.\n"
 #define msg_HPC_non_pcie	"The PCI hot plug controller is not supported by this driver.\n"
-#define msg_HPC_not_supported	"This system is not supported by this version of pciephd mdoule. Upgrade to a newer version of pciehpd\n"
+#define msg_HPC_not_supported	"This system is not supported by this version of pciephd module. Upgrade to a newer version of pciehpd\n"
 #define msg_unable_to_save	"Unable to store PCI hot plug add resource information. This system must be rebooted before adding any PCI devices.\n"
 #define msg_button_on		"PCI slot #%d - powering on due to button press.\n"
 #define msg_button_off		"PCI slot #%d - powering off due to button press.\n"
@@ -202,7 +196,6 @@
 extern void pciehp_create_ctrl_files	(struct controller *ctrl);
 
 /* controller functions */
-extern void	pciehp_pushbutton_thread		(unsigned long event_pointer);
 extern int	pciehprm_find_available_resources	(struct controller *ctrl);
 extern int	pciehp_event_start_thread	(void);
 extern void	pciehp_event_stop_thread	(void);
@@ -239,47 +232,10 @@
 
 /* Inline functions */
 
-
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int slot_paranoia_check (struct slot *slot, const char *function)
-{
-	if (!slot) {
-		dbg("%s - slot == NULL", function);
-		return -1;
-	}
-	if (slot->magic != SLOT_MAGIC) {
-		dbg("%s - bad magic number for slot", function);
-		return -1;
-	}
-	if (!slot->hotplug_slot) {
-		dbg("%s - slot->hotplug_slot == NULL!", function);
-		return -1;
-	}
-	return 0;
-}
-
-static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function)
-{ 
-	struct slot *slot;
-
-	if (!hotplug_slot) {
-		dbg("%s - hotplug_slot == NULL\n", function);
-		return NULL;
-	}
-
-	slot = (struct slot *)hotplug_slot->private;
-	if (slot_paranoia_check (slot, function))
-                return NULL;
-	return slot;
-}
-
-static inline struct slot *pciehp_find_slot (struct controller *ctrl, u8 device)
+static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
 {
 	struct slot *p_slot, *tmp_slot = NULL;
 
-	if (!ctrl)
-		return NULL;
-
 	p_slot = ctrl->slot;
 
 	dbg("p_slot = %p\n", p_slot);
@@ -294,10 +250,10 @@
 		p_slot = tmp_slot;
 	}
 
-	return (p_slot);
+	return p_slot;
 }
 
-static inline int wait_for_ctrl_irq (struct controller *ctrl)
+static inline int wait_for_ctrl_irq(struct controller *ctrl)
 {
 	int retval = 0;
 
@@ -345,7 +301,7 @@
 
 typedef u8(*php_intr_callback_t) (unsigned int change_id, void *instance_id);
 
-int pcie_init( struct controller *ctrl, struct pci_dev *pdev,
+int pcie_init(struct controller *ctrl, struct pci_dev *pdev,
 		php_intr_callback_t attention_button_callback,
 		php_intr_callback_t switch_change_callback,
 		php_intr_callback_t presence_change_callback,
@@ -353,7 +309,7 @@
 
 
 /* This has no meaning for PCI Express, as there is only 1 slot per port */
-int pcie_get_ctlr_slot_config( struct controller *ctrl,
+int pcie_get_ctlr_slot_config(struct controller *ctrl,
 		int *num_ctlr_slots,
 		int *first_device_num,
 		int *physical_slot_num,
@@ -361,12 +317,12 @@
 		int *flags);
 
 struct hpc_ops {
-	int	(*power_on_slot )		(struct slot *slot);
-	int	(*power_off_slot )		(struct slot *slot);
-	int	(*get_power_status)		(struct slot *slot, u8 *status);
+	int	(*power_on_slot)	(struct slot *slot);
+	int	(*power_off_slot)	(struct slot *slot);
+	int	(*get_power_status)	(struct slot *slot, u8 *status);
 	int	(*get_attention_status)	(struct slot *slot, u8 *status);
 	int	(*set_attention_status)	(struct slot *slot, u8 status);
-	int	(*get_latch_status)		(struct slot *slot, u8 *status);
+	int	(*get_latch_status)	(struct slot *slot, u8 *status);
 	int	(*get_adapter_status)	(struct slot *slot, u8 *status);
 
 	int	(*get_max_bus_speed)	(struct slot *slot, enum pci_bus_speed *speed);
@@ -380,7 +336,7 @@
 	void	(*green_led_off)	(struct slot *slot);
 	void	(*green_led_blink)	(struct slot *slot);
 	void	(*release_ctlr)		(struct controller *ctrl);
-	int (*check_lnk_status)		(struct controller *ctrl);
+	int	(*check_lnk_status)	(struct controller *ctrl);
 };
 
 #endif				/* _PCIEHP_H */
diff -Nru a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
--- a/drivers/pci/hotplug/pciehp_core.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/pci/hotplug/pciehp_core.c	Tue Jun 15 22:20:35 2004
@@ -29,6 +29,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/proc_fs.h>
@@ -45,7 +46,7 @@
 int pciehp_debug;
 int pciehp_poll_mode;
 int pciehp_poll_time;
-struct controller *pciehp_ctrl_list;	/* = NULL */
+struct controller *pciehp_ctrl_list;
 struct pci_func *pciehp_slot_list[256];
 
 #define DRIVER_VERSION	"0.4"
@@ -56,9 +57,9 @@
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(pciehp_debug, "i");
-MODULE_PARM(pciehp_poll_mode, "i");
-MODULE_PARM(pciehp_poll_time, "i");
+module_param(pciehp_debug, bool, 644);
+module_param(pciehp_poll_mode, bool, 644);
+module_param(pciehp_poll_time, int, 644);
 MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not");
 MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not");
 MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds");
@@ -69,7 +70,6 @@
 static int set_attention_status (struct hotplug_slot *slot, u8 value);
 static int enable_slot		(struct hotplug_slot *slot);
 static int disable_slot		(struct hotplug_slot *slot);
-static int hardware_test	(struct hotplug_slot *slot, u32 value);
 static int get_power_status	(struct hotplug_slot *slot, u8 *value);
 static int get_attention_status	(struct hotplug_slot *slot, u8 *value);
 static int get_latch_status	(struct hotplug_slot *slot, u8 *value);
@@ -82,7 +82,6 @@
 	.set_attention_status =	set_attention_status,
 	.enable_slot =		enable_slot,
 	.disable_slot =		disable_slot,
-	.hardware_test =	hardware_test,
 	.get_power_status =	get_power_status,
 	.get_attention_status =	get_attention_status,
 	.get_latch_status =	get_latch_status,
@@ -97,7 +96,7 @@
 	u8 number_of_slots;
 	u8 slot_device;
 	u32 slot_number;
-	int result;
+	int result = -ENOMEM;
 
 	dbg("%s\n",__FUNCTION__);
 
@@ -106,34 +105,30 @@
 	slot_number = ctrl->first_slot;
 
 	while (number_of_slots) {
-		new_slot = (struct slot *) kmalloc(sizeof(struct slot), GFP_KERNEL);
+		new_slot = kmalloc(sizeof(*new_slot), GFP_KERNEL);
 		if (!new_slot)
-			return -ENOMEM;
+			goto error;
 
 		memset(new_slot, 0, sizeof(struct slot));
-		new_slot->hotplug_slot = kmalloc (sizeof (struct hotplug_slot), GFP_KERNEL);
-		if (!new_slot->hotplug_slot) {
-			kfree (new_slot);
-			return -ENOMEM;
-		}
-		memset(new_slot->hotplug_slot, 0, sizeof (struct hotplug_slot));
-
-		new_slot->hotplug_slot->info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
-		if (!new_slot->hotplug_slot->info) {
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return -ENOMEM;
-		}
-		memset(new_slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info));
-		new_slot->hotplug_slot->name = kmalloc (SLOT_NAME_SIZE, GFP_KERNEL);
-		if (!new_slot->hotplug_slot->name) {
-			kfree (new_slot->hotplug_slot->info);
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return -ENOMEM;
-		}
+		new_slot->hotplug_slot =
+				kmalloc(sizeof(*(new_slot->hotplug_slot)),
+						GFP_KERNEL);
+		if (!new_slot->hotplug_slot)
+			goto error_slot;
+		memset(new_slot->hotplug_slot, 0, sizeof(struct hotplug_slot));
+
+		new_slot->hotplug_slot->info =
+			kmalloc(sizeof(*(new_slot->hotplug_slot->info)),
+						GFP_KERNEL);
+		if (!new_slot->hotplug_slot->info)
+			goto error_hpslot;
+		memset(new_slot->hotplug_slot->info, 0,
+					sizeof(struct hotplug_slot_info));
+		new_slot->hotplug_slot->name = kmalloc(SLOT_NAME_SIZE,
+						GFP_KERNEL);
+		if (!new_slot->hotplug_slot->name)
+			goto error_info;
 
-		new_slot->magic = SLOT_MAGIC;
 		new_slot->ctrl = ctrl;
 		new_slot->bus = ctrl->slot_bus;
 		new_slot->device = slot_device;
@@ -157,11 +152,7 @@
 		result = pci_hp_register (new_slot->hotplug_slot);
 		if (result) {
 			err ("pci_hp_register failed with error %d\n", result);
-			kfree (new_slot->hotplug_slot->info);
-			kfree (new_slot->hotplug_slot->name);
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return result;
+			goto error_name;
 		}
 
 		new_slot->next = ctrl->slot;
@@ -172,7 +163,18 @@
 		slot_number += ctrl->slot_num_inc;
 	}
 
-	return(0);
+	return 0;
+
+error_name:
+	kfree(new_slot->hotplug_slot->name);
+error_info:
+	kfree(new_slot->hotplug_slot->info);
+error_hpslot:
+	kfree(new_slot->hotplug_slot);
+error_slot:
+	kfree(new_slot);
+error:
+	return result;
 }
 
 
@@ -228,13 +230,10 @@
 /*
  * set_attention_status - Turns the Amber LED for a slot on, off or blink
  */
-static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
+static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 
-	if (slot == NULL)
-		return -ENODEV;
-	
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	hotplug_slot->info->attention_status = status;
@@ -244,12 +243,9 @@
 }
 
 
-static int enable_slot (struct hotplug_slot *hotplug_slot)
+static int enable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
@@ -257,33 +253,20 @@
 }
 
 
-static int disable_slot (struct hotplug_slot *hotplug_slot)
+static int disable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	return pciehp_disable_slot(slot);
 }
 
-
-static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
+static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	return 0;
-}
-
-
-static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
-{
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	retval = slot->hpc_ops->get_power_status(slot, value);
@@ -293,14 +276,11 @@
 	return 0;
 }
 
-static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	retval = slot->hpc_ops->get_attention_status(slot, value);
@@ -310,14 +290,11 @@
 	return 0;
 }
 
-static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	retval = slot->hpc_ops->get_latch_status(slot, value);
@@ -327,31 +304,24 @@
 	return 0;
 }
 
-static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	retval = slot->hpc_ops->get_adapter_status(slot, value);
-
 	if (retval < 0)
 		*value = hotplug_slot->info->adapter_status;
 
 	return 0;
 }
 
-static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
+static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 	
@@ -362,13 +332,10 @@
 	return 0;
 }
 
-static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
+static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 	
@@ -388,7 +355,7 @@
 	int num_ctlr_slots;		/* number of slots supported by this HPC */
 	u8 value;
 
-	ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL);
+	ctrl = kmalloc(sizeof(*ctrl), GFP_KERNEL);
 	if (!ctrl) {
 		err("%s : out of memory\n", __FUNCTION__);
 		goto err_out_none;
@@ -411,7 +378,7 @@
 
 	pci_set_drvdata(pdev, ctrl);
 
-	ctrl->pci_bus = kmalloc (sizeof (*ctrl->pci_bus), GFP_KERNEL);
+	ctrl->pci_bus = kmalloc(sizeof(*ctrl->pci_bus), GFP_KERNEL);
 	if (!ctrl->pci_bus) {
 		err("%s: out of memory\n", __FUNCTION__);
 		rc = -ENOMEM;
@@ -535,49 +502,35 @@
 	return retval;
 }
 
+static inline void __exit
+free_pciehp_res(struct pci_resource *res)
+{
+	struct pci_resource *tres;
+
+	while (res) {
+		tres = res;
+		res = res->next;
+		kfree(tres);
+	}
+}
 
-static void unload_pciehpd(void)
+static void __exit unload_pciehpd(void)
 {
 	struct pci_func *next;
 	struct pci_func *TempSlot;
 	int loop;
 	struct controller *ctrl;
 	struct controller *tctrl;
-	struct pci_resource *res;
-	struct pci_resource *tres;
 
 	ctrl = pciehp_ctrl_list;
 
 	while (ctrl) {
 		cleanup_slots(ctrl);
 
-		res = ctrl->io_head;
-		while (res) {
-			tres = res;
-			res = res->next;
-			kfree(tres);
-		}
-
-		res = ctrl->mem_head;
-		while (res) {
-			tres = res;
-			res = res->next;
-			kfree(tres);
-		}
-
-		res = ctrl->p_mem_head;
-		while (res) {
-			tres = res;
-			res = res->next;
-			kfree(tres);
-		}
-
-		res = ctrl->bus_head;
-		while (res) {
-			tres = res;
-			res = res->next;
-			kfree(tres);
-		}
+		free_pciehp_res(ctrl->io_head);
+		free_pciehp_res(ctrl->mem_head);
+		free_pciehp_res(ctrl->p_mem_head);
+		free_pciehp_res(ctrl->bus_head);
 
 		kfree (ctrl->pci_bus);
 
@@ -592,33 +545,10 @@
 	for (loop = 0; loop < 256; loop++) {
 		next = pciehp_slot_list[loop];
 		while (next != NULL) {
-			res = next->io_head;
-			while (res) {
-				tres = res;
-				res = res->next;
-				kfree(tres);
-			}
-
-			res = next->mem_head;
-			while (res) {
-				tres = res;
-				res = res->next;
-				kfree(tres);
-			}
-
-			res = next->p_mem_head;
-			while (res) {
-				tres = res;
-				res = res->next;
-				kfree(tres);
-			}
-
-			res = next->bus_head;
-			while (res) {
-				tres = res;
-				res = res->next;
-				kfree(tres);
-			}
+			free_pciehp_res(next->io_head);
+			free_pciehp_res(next->mem_head);
+			free_pciehp_res(next->p_mem_head);
+			free_pciehp_res(next->bus_head);
 
 			TempSlot = next;
 			next = next->next;
@@ -700,8 +630,5 @@
 	info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
 }
 
-
 module_init(pcied_init);
 module_exit(pcied_cleanup);
-
-
diff -Nru a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
--- a/drivers/pci/hotplug/pciehp_ctrl.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/pci/hotplug/pciehp_ctrl.c	Tue Jun 15 22:20:37 2004
@@ -251,12 +251,10 @@
 }
 
 
-/*
- * sort_by_size
- *
- * Sorts nodes on the list by their length.
- * Smallest first.
+/**
+ * sort_by_size: sort nodes by their length, smallest first.
  *
+ * @head: list to sort
  */
 static int sort_by_size(struct pci_resource **head)
 {
@@ -265,10 +263,10 @@
 	int out_of_order = 1;
 
 	if (!(*head))
-		return(1);
+		return 1;
 
 	if (!((*head)->next))
-		return(0);
+		return 0;
 
 	while (out_of_order) {
 		out_of_order = 0;
@@ -298,7 +296,7 @@
 		}
 	}  /* End of out_of_order loop */
 
-	return(0);
+	return 0;
 }
 
 
@@ -316,10 +314,10 @@
 	int out_of_order = 1;
 
 	if (!(*head))
-		return(1);
+		return 1;
 
 	if (!((*head)->next))
-		return(0);
+		return 0;
 
 	while (out_of_order) {
 		out_of_order = 0;
@@ -349,17 +347,18 @@
 		}
 	}  /* End of out_of_order loop */
 
-	return(0);
+	return 0;
 }
 
 
-/*
- * do_pre_bridge_resource_split
- *
- *	Returns zero or one node of resources that aren't in use
+/**
+ * do_pre_bridge_resource_split: return one unused resource node
+ * @head: list to scan
  *
  */
-static struct pci_resource *do_pre_bridge_resource_split (struct pci_resource **head, struct pci_resource **orig_head, u32 alignment)
+static struct pci_resource *
+do_pre_bridge_resource_split(struct pci_resource **head,
+				struct pci_resource **orig_head, u32 alignment)
 {
 	struct pci_resource *prevnode = NULL;
 	struct pci_resource *node;
@@ -369,18 +368,18 @@
 	dbg("do_pre_bridge_resource_split\n");
 
 	if (!(*head) || !(*orig_head))
-		return(NULL);
+		return NULL;
 
 	rc = pciehp_resource_sort_and_combine(head);
 
 	if (rc)
-		return(NULL);
+		return NULL;
 
 	if ((*head)->base != (*orig_head)->base)
-		return(NULL);
+		return NULL;
 
 	if ((*head)->length == (*orig_head)->length)
-		return(NULL);
+		return NULL;
 
 
 	/* If we got here, there the bridge requires some of the resource, but
@@ -392,10 +391,10 @@
 		/* this one isn't an aligned length, so we'll make a new entry
 		 * and split it up.
 		 */
-		split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+		split_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
 
 		if (!split_node)
-			return(NULL);
+			return NULL;
 
 		temp_dword = (node->length | (alignment-1)) + 1 - alignment;
 
@@ -410,34 +409,32 @@
 		split_node->next = node;
 	}
 
-	if (node->length < alignment) {
-		return(NULL);
-	}
+	if (node->length < alignment)
+		return NULL;
 
 	/* Now unlink it */
 	if (*head == node) {
 		*head = node->next;
-		node->next = NULL;
 	} else {
 		prevnode = *head;
 		while (prevnode->next != node)
 			prevnode = prevnode->next;
 
 		prevnode->next = node->next;
-		node->next = NULL;
 	}
+	node->next = NULL;
 
-	return(node);
+	return node;
 }
 
 
-/*
- * do_bridge_resource_split
- *
- *	Returns zero or one node of resources that aren't in use
+/**
+ * do_bridge_resource_split: return one unused resource node
+ * @head: list to scan
  *
  */
-static struct pci_resource *do_bridge_resource_split (struct pci_resource **head, u32 alignment)
+static struct pci_resource *
+do_bridge_resource_split(struct pci_resource **head, u32 alignment)
 {
 	struct pci_resource *prevnode = NULL;
 	struct pci_resource *node;
@@ -445,12 +442,12 @@
 	u32 temp_dword;
 
 	if (!(*head))
-		return(NULL);
+		return NULL;
 
 	rc = pciehp_resource_sort_and_combine(head);
 
 	if (rc)
-		return(NULL);
+		return NULL;
 
 	node = *head;
 
@@ -462,7 +459,7 @@
 
 	if (node->length < alignment) {
 		kfree(node);
-		return(NULL);
+		return NULL;
 	}
 
 	if (node->base & (alignment - 1)) {
@@ -470,7 +467,7 @@
 		temp_dword = (node->base | (alignment-1)) + 1;
 		if ((node->length - (temp_dword - node->base)) < alignment) {
 			kfree(node);
-			return(NULL);
+			return NULL;
 		}
 
 		node->length -= (temp_dword - node->base);
@@ -480,10 +477,10 @@
 	if (node->length & (alignment - 1)) {
 		/* There's stuff in use after this node */
 		kfree(node);
-		return(NULL);
+		return NULL;
 	}
 
-	return(node);
+	return node;
 }
 
 
@@ -497,7 +494,7 @@
  *
  * size must be a power of two.
  */
-static struct pci_resource *get_io_resource (struct pci_resource **head, u32 size)
+static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size)
 {
 	struct pci_resource *prevnode;
 	struct pci_resource *node;
@@ -505,13 +502,13 @@
 	u32 temp_dword;
 
 	if (!(*head))
-		return(NULL);
+		return NULL;
 
 	if ( pciehp_resource_sort_and_combine(head) )
-		return(NULL);
+		return NULL;
 
 	if ( sort_by_size(head) )
-		return(NULL);
+		return NULL;
 
 	for (node = *head; node; node = node->next) {
 		if (node->length < size)
@@ -526,10 +523,11 @@
 			if ((node->length - (temp_dword - node->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = node->base;
 			split_node->length = temp_dword - node->base;
@@ -545,10 +543,11 @@
 		if (node->length > size) {
 			/* this one is longer than we need
 			   so we'll make a new entry and split it up */
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = node->base + size;
 			split_node->length = node->length - size;
@@ -579,7 +578,7 @@
 		break;
 	}
 
-	return(node);
+	return node;
 }
 
 
@@ -592,7 +591,7 @@
  * J.I. modified to put max size limits of; 64M->32M->16M->8M->4M->1M
  *  This is needed to avoid allocating entire ACPI _CRS res to one child bridge/slot.
  */
-static struct pci_resource *get_max_resource (struct pci_resource **head, u32 size)
+static struct pci_resource *get_max_resource(struct pci_resource **head, u32 size)
 {
 	struct pci_resource *max;
 	struct pci_resource *temp;
@@ -602,13 +601,13 @@
 	int i;
 
 	if (!(*head))
-		return(NULL);
+		return NULL;
 
 	if (pciehp_resource_sort_and_combine(head))
-		return(NULL);
+		return NULL;
 
 	if (sort_by_max_size(head))
-		return(NULL);
+		return NULL;
 
 	for (max = *head;max; max = max->next) {
 
@@ -626,10 +625,11 @@
 			if ((max->length - (temp_dword - max->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = max->base;
 			split_node->length = temp_dword - max->base;
@@ -644,10 +644,11 @@
 		if ((max->base + max->length) & (size - 1)) {
 			/* this one isn't end aligned properly at the top
 			   so we'll make a new entry and split it up */
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 			temp_dword = ((max->base + max->length) & ~(size - 1));
 			split_node->base = temp_dword;
 			split_node->length = max->length + max->base
@@ -665,9 +666,10 @@
 
 		for ( i = 0; max_size[i] > size; i++) {
 			if (max->length > max_size[i]) {
-				split_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				split_node = kmalloc(sizeof(struct pci_resource),
+							GFP_KERNEL);
 				if (!split_node)
-					break;	/* return (NULL); */
+					break;	/* return NULL; */
 				split_node->base = max->base + max_size[i];
 				split_node->length = max->length - max_size[i];
 				max->length = max_size[i];
@@ -691,11 +693,11 @@
 		}
 
 		max->next = NULL;
-		return(max);
+		return max;
 	}
 
 	/* If we get here, we couldn't find one */
-	return(NULL);
+	return NULL;
 }
 
 
@@ -708,7 +710,7 @@
  *
  * size must be a power of two.
  */
-static struct pci_resource *get_resource (struct pci_resource **head, u32 size)
+static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
 {
 	struct pci_resource *prevnode;
 	struct pci_resource *node;
@@ -716,13 +718,13 @@
 	u32 temp_dword;
 
 	if (!(*head))
-		return(NULL);
+		return NULL;
 
 	if ( pciehp_resource_sort_and_combine(head) )
-		return(NULL);
+		return NULL;
 
 	if ( sort_by_size(head) )
-		return(NULL);
+		return NULL;
 
 	for (node = *head; node; node = node->next) {
 		dbg("%s: req_size =0x%x node=%p, base=0x%x, length=0x%x\n",
@@ -740,10 +742,11 @@
 			if ((node->length - (temp_dword - node->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = node->base;
 			split_node->length = temp_dword - node->base;
@@ -760,10 +763,11 @@
 			dbg("%s: too big\n", __FUNCTION__);
 			/* this one is longer than we need
 			   so we'll make a new entry and split it up */
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 
 			if (!split_node)
-				return(NULL);
+				return NULL;
 
 			split_node->base = node->base + size;
 			split_node->length = node->length - size;
@@ -790,7 +794,7 @@
 		/* Stop looping */
 		break;
 	}
-	return(node);
+	return node;
 }
 
 
@@ -812,12 +816,12 @@
 	dbg("%s: head = %p, *head = %p\n", __FUNCTION__, head, *head);
 
 	if (!(*head))
-		return(1);
+		return 1;
 
 	dbg("*head->next = %p\n",(*head)->next);
 
 	if (!(*head)->next)
-		return(0);	/* only one item on the list, already sorted! */
+		return 0;	/* only one item on the list, already sorted! */
 
 	dbg("*head->base = 0x%x\n",(*head)->base);
 	dbg("*head->next->base = 0x%x\n",(*head)->next->base);
@@ -863,7 +867,7 @@
 			node1 = node1->next;
 	}
 
-	return(0);
+	return 0;
 }
 
 
@@ -878,11 +882,10 @@
 	struct pci_func *new_slot;
 	struct pci_func *next;
 	dbg("%s: busnumber %x\n", __FUNCTION__, busnumber);
-	new_slot = (struct pci_func *) kmalloc(sizeof(struct pci_func), GFP_KERNEL);
+	new_slot = kmalloc(sizeof(struct pci_func), GFP_KERNEL);
 
-	if (new_slot == NULL) {
-		return(new_slot);
-	}
+	if (new_slot == NULL)
+		return new_slot;
 
 	memset(new_slot, 0, sizeof(struct pci_func));
 
@@ -897,11 +900,11 @@
 			next = next->next;
 		next->next = new_slot;
 	}
-	return(new_slot);
+	return new_slot;
 }
 
 
-/*
+/**
  * slot_remove - Removes a node from the linked list of slots.
  * @old_slot: slot to remove
  *
@@ -912,19 +915,18 @@
 	struct pci_func *next;
 
 	if (old_slot == NULL)
-		return(1);
+		return 1;
 
 	next = pciehp_slot_list[old_slot->bus];
 
-	if (next == NULL) {
-		return(1);
-	}
+	if (next == NULL)
+		return 1;
 
 	if (next == old_slot) {
 		pciehp_slot_list[old_slot->bus] = old_slot->next;
 		pciehp_destroy_board_resources(old_slot);
 		kfree(old_slot);
-		return(0);
+		return 0;
 	}
 
 	while ((next->next != old_slot) && (next->next != NULL)) {
@@ -935,9 +937,9 @@
 		next->next = old_slot->next;
 		pciehp_destroy_board_resources(old_slot);
 		kfree(old_slot);
-		return(0);
+		return 0;
 	} else
-		return(2);
+		return 2;
 }
 
 
@@ -954,7 +956,7 @@
 	struct pci_func *next;
 
 	if (bridge == NULL)
-		return(1);
+		return 1;
 
 	secondaryBus = (bridge->config_space[0x06] >> 8) & 0xFF;
 	subordinateBus = (bridge->config_space[0x06] >> 16) & 0xFF;
@@ -970,13 +972,13 @@
 	next = pciehp_slot_list[bridge->bus];
 
 	if (next == NULL) {
-		return(1);
+		return 1;
 	}
 
 	if (next == bridge) {
 		pciehp_slot_list[bridge->bus] = bridge->next;
 		kfree(bridge);
-		return(0);
+		return 0;
 	}
 
 	while ((next->next != bridge) && (next->next != NULL)) {
@@ -986,9 +988,9 @@
 	if (next->next == bridge) {
 		next->next = bridge->next;
 		kfree(bridge);
-		return(0);
+		return 0;
 	} else
-		return(2);
+		return 2;
 }
 
 
@@ -1016,7 +1018,7 @@
 		dbg("%s: func == NULL\n", __FUNCTION__);
 
 	if ((func == NULL) || ((func->device == device) && (index == 0)))
-		return(func);
+		return func;
 
 	if (func->device == device)
 		found++;
@@ -1035,11 +1037,11 @@
 		if ((found == index) || (func->function == index)) {
 			dbg("%s: Found bus %x dev %x func %x\n", __FUNCTION__,
 					func->bus, func->device, func->function);
-			return(func);
+			return func;
 		}
 	}
 
-	return(NULL);
+	return NULL;
 }
 
 static int is_bridge(struct pci_func * func)
@@ -1187,7 +1189,7 @@
 			/* Done with exclusive hardware access */
 			up(&ctrl->crit_sect);
 
-			return(rc);
+			return rc;
 		}
 		pciehp_save_slot_config(ctrl, func);
 
@@ -1251,7 +1253,7 @@
 		/* Done with exclusive hardware access */
 		up(&ctrl->crit_sect);
 
-		return(rc);
+		return rc;
 	}
 	return 0;
 }
@@ -1273,10 +1275,10 @@
 	struct slot *p_slot;
 
 	if (func == NULL)
-		return(1);
+		return 1;
 
 	if (pciehp_unconfigure_device(func))
-		return(1);
+		return 1;
 
 	device = func->device;
 
@@ -1370,7 +1372,7 @@
 		func = pciehp_slot_create(ctrl->slot_bus);
 
 		if (func == NULL) {
-			return(1);
+			return 1;
 		}
 
 		func->bus = ctrl->slot_bus;
@@ -1385,7 +1387,7 @@
 }
 
 
-static void pushbutton_helper_thread (unsigned long data)
+static void pushbutton_helper_thread(unsigned long data)
 {
 	pushbutton_pending = data;
 
@@ -1393,6 +1395,81 @@
 }
 
 
+/**
+ * pciehp_pushbutton_thread
+ *
+ * Scheduled procedure to handle blocking stuff for the pushbuttons
+ * Handles all pending events and exits.
+ *
+ */
+static void pciehp_pushbutton_thread(unsigned long slot)
+{
+	struct slot *p_slot = (struct slot *) slot;
+	u8 getstatus;
+	int rc;
+	
+	pushbutton_pending = 0;
+
+	if (!p_slot) {
+		dbg("%s: Error! slot NULL\n", __FUNCTION__);
+		return;
+	}
+
+	p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
+	if (getstatus) {
+		p_slot->state = POWEROFF_STATE;
+		dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
+
+		if (pciehp_disable_slot(p_slot)) {
+			/* Wait for exclusive access to hardware */
+			down(&p_slot->ctrl->crit_sect);
+
+			/* Turn on the Attention LED */
+			rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
+			if (rc) {
+				err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
+				return;
+			}
+	
+			/* Wait for the command to complete */
+			wait_for_ctrl_irq (p_slot->ctrl);
+
+			/* Done with exclusive hardware access */
+			up(&p_slot->ctrl->crit_sect);
+		}
+		p_slot->state = STATIC_STATE;
+	} else {
+		p_slot->state = POWERON_STATE;
+		dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
+
+		if (pciehp_enable_slot(p_slot)) {
+			/* Wait for exclusive access to hardware */
+			down(&p_slot->ctrl->crit_sect);
+
+			/* Turn off the green LED */
+			rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
+			if (rc) {
+				err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
+				return;
+			}
+			/* Wait for the command to complete */
+			wait_for_ctrl_irq (p_slot->ctrl);
+			
+			p_slot->hpc_ops->green_led_off(p_slot);
+
+			/* Wait for the command to complete */
+			wait_for_ctrl_irq (p_slot->ctrl);
+
+			/* Done with exclusive hardware access */
+			up(&p_slot->ctrl->crit_sect);
+		}
+		p_slot->state = STATIC_STATE;
+	}
+
+	return;
+}
+
+
 /* this is the main worker thread */
 static int event_thread(void* data)
 {
@@ -1420,7 +1497,7 @@
 	return 0;
 }
 
-int pciehp_event_start_thread (void)
+int pciehp_event_start_thread(void)
 {
 	int pid;
 
@@ -1440,7 +1517,7 @@
 }
 
 
-void pciehp_event_stop_thread (void)
+void pciehp_event_stop_thread(void)
 {
 	event_finished = 1;
 	dbg("event_thread finish command given\n");
@@ -1450,13 +1527,13 @@
 }
 
 
-static int update_slot_info (struct slot *slot)
+static int update_slot_info(struct slot *slot)
 {
 	struct hotplug_slot_info *info;
 	/* char buffer[SLOT_NAME_SIZE]; */
 	int result;
 
-	info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
+	info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
@@ -1603,87 +1680,10 @@
 			}
 		}		/* End of FOR loop */
 	}
-
-	return;
 }
 
 
-/**
- * pciehp_pushbutton_thread
- *
- * Scheduled procedure to handle blocking stuff for the pushbuttons
- * Handles all pending events and exits.
- *
- */
-void pciehp_pushbutton_thread (unsigned long slot)
-{
-	struct slot *p_slot = (struct slot *) slot;
-	u8 getstatus;
-	int rc;
-	
-	pushbutton_pending = 0;
-
-	if (!p_slot) {
-		dbg("%s: Error! slot NULL\n", __FUNCTION__);
-		return;
-	}
-
-	p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
-	if (getstatus) {
-		p_slot->state = POWEROFF_STATE;
-		dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
-
-		if (pciehp_disable_slot(p_slot)) {
-			/* Wait for exclusive access to hardware */
-			down(&p_slot->ctrl->crit_sect);
-
-			/* Turn on the Attention LED */
-			rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
-			if (rc) {
-				err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
-				return;
-			}
-	
-			/* Wait for the command to complete */
-			wait_for_ctrl_irq (p_slot->ctrl);
-
-			/* Done with exclusive hardware access */
-			up(&p_slot->ctrl->crit_sect);
-		}
-		p_slot->state = STATIC_STATE;
-	} else {
-		p_slot->state = POWERON_STATE;
-		dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
-
-		if (pciehp_enable_slot(p_slot)) {
-			/* Wait for exclusive access to hardware */
-			down(&p_slot->ctrl->crit_sect);
-
-			/* Turn off the green LED */
-			rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
-			if (rc) {
-				err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
-				return;
-			}
-			/* Wait for the command to complete */
-			wait_for_ctrl_irq (p_slot->ctrl);
-			
-			p_slot->hpc_ops->green_led_off(p_slot);
-
-			/* Wait for the command to complete */
-			wait_for_ctrl_irq (p_slot->ctrl);
-
-			/* Done with exclusive hardware access */
-			up(&p_slot->ctrl->crit_sect);
-		}
-		p_slot->state = STATIC_STATE;
-	}
-
-	return;
-}
-
-
-int pciehp_enable_slot (struct slot *p_slot)
+int pciehp_enable_slot(struct slot *p_slot)
 {
 	u8 getstatus = 0;
 	int rc;
@@ -1692,7 +1692,7 @@
 	func = pciehp_slot_find(p_slot->bus, p_slot->device, 0);
 	if (!func) {
 		dbg("%s: Error! slot NULL\n", __FUNCTION__);
-		return (1);
+		return 1;
 	}
 
 	/* Check to see if (latch closed, card present, power off) */
@@ -1701,21 +1701,21 @@
 	if (rc || !getstatus) {
 		info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
-		return (0);
+		return 0;
 	}
 	
 	rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
 	if (rc || getstatus) {
 		info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
-		return (0);
+		return 0;
 	}
 	
 	rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
 	if (rc || getstatus) {
 		info("%s: already enabled on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
-		return (0);
+		return 0;
 	}
 	up(&p_slot->ctrl->crit_sect);
 
@@ -1723,7 +1723,7 @@
 
 	func = pciehp_slot_create(p_slot->bus);
 	if (func == NULL)
-		return (1);
+		return 1;
 
 	func->bus = p_slot->bus;
 	func->device = p_slot->device;
@@ -1746,7 +1746,7 @@
 		/* Setup slot structure with entry for empty slot */
 		func = pciehp_slot_create(p_slot->bus);
 		if (func == NULL)
-			return (1);	/* Out of memory */
+			return 1;	/* Out of memory */
 
 		func->bus = p_slot->bus;
 		func->device = p_slot->device;
@@ -1767,7 +1767,7 @@
 }
 
 
-int pciehp_disable_slot (struct slot *p_slot)
+int pciehp_disable_slot(struct slot *p_slot)
 {
 	u8 class_code, header_type, BCR;
 	u8 index = 0;
@@ -1779,7 +1779,7 @@
 	struct pci_func *func;
 
 	if (!p_slot->ctrl)
-		return (1);
+		return 1;
 
 	/* Check to see if (latch closed, card present, power on) */
 	down(&p_slot->ctrl->crit_sect);
@@ -1788,21 +1788,21 @@
 	if (ret || !getstatus) {
 		info("%s: no adapter on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
-		return (0);
+		return 0;
 	}
 
 	ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
 	if (ret || getstatus) {
 		info("%s: latch open on slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
-		return (0);
+		return 0;
 	}
 
 	ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
 	if (ret || !getstatus) {
 		info("%s: already disabled slot(%x)\n", __FUNCTION__, p_slot->number);
 		up(&p_slot->ctrl->crit_sect);
-		return (0);
+		return 0;
 	}
 	up(&p_slot->ctrl->crit_sect);
 
@@ -1854,7 +1854,7 @@
 	if (p_slot)
 		update_slot_info(p_slot);
 
-	return(rc);
+	return rc;
 }
 
 
@@ -1869,7 +1869,7 @@
  * Returns 0 if success
  *
  */
-static u32 configure_new_device (struct controller * ctrl, struct pci_func * func,
+static u32 configure_new_device(struct controller * ctrl, struct pci_func * func,
 	u8 behind_bridge, struct resource_lists * resources, u8 bridge_bus, u8 bridge_dev)
 {
 	u8 temp_byte, function, max_functions, stop_it;
@@ -1901,20 +1901,23 @@
 	function = 0;
 
 	do {
-		rc = configure_new_function(ctrl, new_slot, behind_bridge, resources, bridge_bus, bridge_dev);
+		rc = configure_new_function(ctrl, new_slot, behind_bridge,
+					resources, bridge_bus, bridge_dev);
 
 		if (rc) {
-			dbg("configure_new_function failed %d\n",rc);
+			dbg("configure_new_function failed: %d\n", rc);
 			index = 0;
 
 			while (new_slot) {
-				new_slot = pciehp_slot_find(new_slot->bus, new_slot->device, index++);
+				new_slot = pciehp_slot_find(new_slot->bus,
+						new_slot->device, index++);
 
 				if (new_slot)
-					pciehp_return_board_resources(new_slot, resources);
+					pciehp_return_board_resources(new_slot,
+						resources);
 			}
 
-			return(rc);
+			return rc;
 		}
 
 		function++;
@@ -1936,7 +1939,7 @@
 
 				if (new_slot == NULL) {
 					/* Out of memory */
-					return(1);
+					return 1;
 				}
 
 				new_slot->bus = func->bus;
@@ -1950,41 +1953,63 @@
 		}
 
 	} while (function < max_functions);
-	dbg("returning from configure_new_device\n");
+	dbg("returning from %s\n", __FUNCTION__);
 
 	return 0;
 }
 
-
 /*
  * Configuration logic that involves the hotplug data structures and 
  * their bookkeeping
  */
 
-
 /**
- * configure_new_function - Configures the PCI header information of one device
- *
- * @ctrl: pointer to controller structure
- * @func: pointer to function structure
- * @behind_bridge: 1 if this is a recursive call, 0 if not
- * @resources: pointer to set of resource lists
- *
- * Calls itself recursively for bridged devices.
- * Returns 0 if success
- *
+ * configure_bridge: fill bridge's registers, either configure or disable it.
  */
-static int configure_new_function (struct controller * ctrl, struct pci_func * func,
-	u8 behind_bridge, struct resource_lists *resources, u8 bridge_bus, u8 bridge_dev)
+static int
+configure_bridge(struct pci_bus *pci_bus, unsigned int devfn,
+			struct pci_resource *mem_node,
+			struct pci_resource **hold_mem_node,
+			int base_addr, int limit_addr)
+{
+	u16 temp_word;
+	u32 rc;
+
+	if (mem_node) {
+		memcpy(*hold_mem_node, mem_node, sizeof(struct pci_resource));
+		mem_node->next = NULL;
+
+		/* set Mem base and Limit registers */
+		RES_CHECK(mem_node->base, 16);
+		temp_word = (u16)(mem_node->base >> 16);
+		rc = pci_bus_write_config_word(pci_bus, devfn, base_addr, temp_word);
+
+		RES_CHECK(mem_node->base + mem_node->length - 1, 16);
+		temp_word = (u16)((mem_node->base + mem_node->length - 1) >> 16);
+		rc = pci_bus_write_config_word(pci_bus, devfn, limit_addr, temp_word);
+	} else {
+		temp_word = 0xFFFF;
+		rc = pci_bus_write_config_word(pci_bus, devfn, base_addr, temp_word);
+
+		temp_word = 0x0000;
+		rc = pci_bus_write_config_word(pci_bus, devfn, limit_addr, temp_word);
+
+		kfree(*hold_mem_node);
+		*hold_mem_node = NULL;
+	}
+	return rc;
+}
+
+static int
+configure_new_bridge(struct controller *ctrl, struct pci_func *func,
+		u8 behind_bridge, struct resource_lists *resources,
+		struct pci_bus *pci_bus)
 {
 	int cloop;
 	u8 temp_byte;
 	u8 device;
-	u8 class_code;
 	u16 temp_word;
 	u32 rc;
-	u32 temp_register;
-	u32 base;
 	u32 ID;
 	unsigned int devfn;
 	struct pci_resource *mem_node;
@@ -1997,486 +2022,483 @@
 	struct pci_resource *hold_bus_node;
 	struct irq_mapping irqs;
 	struct pci_func *new_slot;
-	struct pci_bus lpci_bus, *pci_bus;
 	struct resource_lists temp_resources;
 
-	memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus));
-	pci_bus = &lpci_bus;
-	pci_bus->number = func->bus;
 	devfn = PCI_DEVFN(func->device, func->function);
 
-	/* Check for Bridge */
-	rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &temp_byte);
+	/* set Primary bus */
+	dbg("set Primary bus = 0x%x\n", func->bus);
+	rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_PRIMARY_BUS, func->bus);
 	if (rc)
 		return rc;
-	dbg("%s: bus %x dev %x func %x temp_byte = %x\n", __FUNCTION__,
-		func->bus, func->device, func->function, temp_byte);
-
-	if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { /* PCI-PCI Bridge */
-		/* set Primary bus */
-		dbg("set Primary bus = 0x%x\n", func->bus);
-		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_PRIMARY_BUS, func->bus);
-		if (rc)
-			return rc;
 
-		/* find range of busses to use */
-		bus_node = get_max_resource(&resources->bus_head, 1L);
-
-		/* If we don't have any busses to allocate, we can't continue */
-		if (!bus_node) {
-			err("Got NO bus resource to use\n");
-			return -ENOMEM;
-		}
-		dbg("Got ranges of buses to use: base:len=0x%x:%x\n", bus_node->base, bus_node->length);
-
-		/* set Secondary bus */
-		dbg("set Secondary bus = 0x%x\n", temp_byte);
-		dbg("func->bus %x\n", func->bus);
-
-		temp_byte = (u8)bus_node->base;
-		dbg("set Secondary bus = 0x%x\n", temp_byte);
-		rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, temp_byte);
-		if (rc)
-			return rc;
-
-		/* set subordinate bus */
-		temp_byte = (u8)(bus_node->base + bus_node->length - 1);
-		dbg("set subordinate bus = 0x%x\n", temp_byte);
-		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte);
-		if (rc)
-			return rc;
+	/* find range of busses to use */
+	bus_node = get_max_resource(&resources->bus_head, 1L);
 
-		/* Set HP parameters (Cache Line Size, Latency Timer) */
-		rc = pciehprm_set_hpp(ctrl, func, PCI_HEADER_TYPE_BRIDGE);
-		if (rc)
-			return rc;
+	/* If we don't have any busses to allocate, we can't continue */
+	if (!bus_node) {
+		err("Got NO bus resource to use\n");
+		return -ENOMEM;
+	}
+	dbg("Got ranges of buses to use: base:len=0x%x:%x\n", bus_node->base, bus_node->length);
 
-		/* Setup the IO, memory, and prefetchable windows */
+	/* set Secondary bus */
+	temp_byte = (u8)bus_node->base;
+	dbg("set Secondary bus = 0x%x\n", temp_byte);
+	rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, temp_byte);
+	if (rc)
+		return rc;
 
-		io_node = get_max_resource(&(resources->io_head), 0x1000L);
-		if (io_node) {
-			dbg("io_node(base, len, next) (%x, %x, %p)\n", io_node->base, io_node->length, io_node->next);
-		}
+	/* set subordinate bus */
+	temp_byte = (u8)(bus_node->base + bus_node->length - 1);
+	dbg("set subordinate bus = 0x%x\n", temp_byte);
+	rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte);
+	if (rc)
+		return rc;
 
-		mem_node = get_max_resource(&(resources->mem_head), 0x100000L);
-		if (mem_node) {
-			dbg("mem_node(base, len, next) (%x, %x, %p)\n", mem_node->base, mem_node->length, mem_node->next);
-		}
+	/* Set HP parameters (Cache Line Size, Latency Timer) */
+	rc = pciehprm_set_hpp(ctrl, func, PCI_HEADER_TYPE_BRIDGE);
+	if (rc)
+		return rc;
 
-		if (resources->p_mem_head)
-			p_mem_node = get_max_resource(&(resources->p_mem_head), 0x100000L);
-		else {
-			/*
-			 * In some platform implementation, MEM and PMEM are not
-			 *  distinguished, and hence ACPI _CRS has only MEM entries
-			 *  for both MEM and PMEM.
-			 */
-			dbg("using MEM for PMEM\n");
-			p_mem_node = get_max_resource(&(resources->mem_head), 0x100000L);
-		}
-		if (p_mem_node) {
-			dbg("p_mem_node(base, len, next) (%x, %x, %p)\n", p_mem_node->base, p_mem_node->length, p_mem_node->next);
-		}
+	/* Setup the IO, memory, and prefetchable windows */
 
-		/* set up the IRQ info */
-		if (!resources->irqs) {
-			irqs.barber_pole = 0;
-			irqs.interrupt[0] = 0;
-			irqs.interrupt[1] = 0;
-			irqs.interrupt[2] = 0;
-			irqs.interrupt[3] = 0;
-			irqs.valid_INT = 0;
-		} else {
-			irqs.barber_pole = resources->irqs->barber_pole;
-			irqs.interrupt[0] = resources->irqs->interrupt[0];
-			irqs.interrupt[1] = resources->irqs->interrupt[1];
-			irqs.interrupt[2] = resources->irqs->interrupt[2];
-			irqs.interrupt[3] = resources->irqs->interrupt[3];
-			irqs.valid_INT = resources->irqs->valid_INT;
-		}
+	io_node = get_max_resource(&(resources->io_head), 0x1000L);
+	if (io_node) {
+		dbg("io_node(base, len, next) (%x, %x, %p)\n", io_node->base,
+				io_node->length, io_node->next);
+	}
 
-		/* set up resource lists that are now aligned on top and bottom
-		 * for anything behind the bridge.
-		 */
-		temp_resources.bus_head = bus_node;
-		temp_resources.io_head = io_node;
-		temp_resources.mem_head = mem_node;
-		temp_resources.p_mem_head = p_mem_node;
-		temp_resources.irqs = &irqs;
+	mem_node = get_max_resource(&(resources->mem_head), 0x100000L);
+	if (mem_node) {
+		dbg("mem_node(base, len, next) (%x, %x, %p)\n", mem_node->base,
+				mem_node->length, mem_node->next);
+	}
 
-		/* Make copies of the nodes we are going to pass down so that
-		 * if there is a problem,we can just use these to free resources
+	if (resources->p_mem_head)
+		p_mem_node = get_max_resource(&(resources->p_mem_head), 0x100000L);
+	else {
+		/*
+		 * In some platform implementation, MEM and PMEM are not
+		 *  distinguished, and hence ACPI _CRS has only MEM entries
+		 *  for both MEM and PMEM.
 		 */
-		hold_bus_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_IO_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-
-		if (!hold_bus_node || !hold_IO_node || !hold_mem_node || !hold_p_mem_node) {
-			if (hold_bus_node)
-				kfree(hold_bus_node);
-			if (hold_IO_node)
-				kfree(hold_IO_node);
-			if (hold_mem_node)
-				kfree(hold_mem_node);
-			if (hold_p_mem_node)
-				kfree(hold_p_mem_node);
+		dbg("using MEM for PMEM\n");
+		p_mem_node = get_max_resource(&(resources->mem_head), 0x100000L);
+	}
+	if (p_mem_node) {
+		dbg("p_mem_node(base, len, next) (%x, %x, %p)\n", p_mem_node->base,
+				p_mem_node->length, p_mem_node->next);
+	}
+
+	/* set up the IRQ info */
+	if (!resources->irqs) {
+		irqs.barber_pole = 0;
+		irqs.interrupt[0] = 0;
+		irqs.interrupt[1] = 0;
+		irqs.interrupt[2] = 0;
+		irqs.interrupt[3] = 0;
+		irqs.valid_INT = 0;
+	} else {
+		irqs.barber_pole = resources->irqs->barber_pole;
+		irqs.interrupt[0] = resources->irqs->interrupt[0];
+		irqs.interrupt[1] = resources->irqs->interrupt[1];
+		irqs.interrupt[2] = resources->irqs->interrupt[2];
+		irqs.interrupt[3] = resources->irqs->interrupt[3];
+		irqs.valid_INT = resources->irqs->valid_INT;
+	}
 
-			return(1);
-		}
+	/* set up resource lists that are now aligned on top and bottom
+	 * for anything behind the bridge.
+	 */
+	temp_resources.bus_head = bus_node;
+	temp_resources.io_head = io_node;
+	temp_resources.mem_head = mem_node;
+	temp_resources.p_mem_head = p_mem_node;
+	temp_resources.irqs = &irqs;
 
-		memcpy(hold_bus_node, bus_node, sizeof(struct pci_resource));
+	/* Make copies of the nodes we are going to pass down so that
+	 * if there is a problem,we can just use these to free resources
+	 */
+	hold_bus_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+	hold_IO_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+	hold_mem_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+	hold_p_mem_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+
+	if (!hold_bus_node || !hold_IO_node || !hold_mem_node || !hold_p_mem_node) {
+		kfree(hold_bus_node);
+		kfree(hold_IO_node);
+		kfree(hold_mem_node);
+		kfree(hold_p_mem_node);
 
-		bus_node->base += 1;
-		bus_node->length -= 1;
-		bus_node->next = NULL;
+		return 1;
+	}
 
-		/* If we have IO resources copy them and fill in the bridge's
-		 * IO range registers
-		 */
-		if (io_node) {
-			memcpy(hold_IO_node, io_node, sizeof(struct pci_resource));
-			io_node->next = NULL;
+	memcpy(hold_bus_node, bus_node, sizeof(struct pci_resource));
 
-			/* set IO base and Limit registers */
-			RES_CHECK(io_node->base, 8);
-			temp_byte = (u8)(io_node->base >> 8);
-			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_BASE, temp_byte);
+	bus_node->base += 1;
+	bus_node->length -= 1;
+	bus_node->next = NULL;
 
-			RES_CHECK(io_node->base + io_node->length - 1, 8);
-			temp_byte = (u8)((io_node->base + io_node->length - 1) >> 8);
-			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
-		} else {
-			kfree(hold_IO_node);
-			hold_IO_node = NULL;
-		}
+	/* If we have IO resources copy them and fill in the bridge's
+	 * IO range registers
+	 */
+	if (io_node) {
+		memcpy(hold_IO_node, io_node, sizeof(struct pci_resource));
+		io_node->next = NULL;
+
+		/* set IO base and Limit registers */
+		RES_CHECK(io_node->base, 8);
+		temp_byte = (u8)(io_node->base >> 8);
+		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_BASE, temp_byte);
+
+		RES_CHECK(io_node->base + io_node->length - 1, 8);
+		temp_byte = (u8)((io_node->base + io_node->length - 1) >> 8);
+		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
+	} else {
+		kfree(hold_IO_node);
+		hold_IO_node = NULL;
+	}
 
-		/* If we have memory resources copy them and fill in the bridge's
-		 * memory range registers.  Otherwise, fill in the range
-		 * registers with values that disable them.
-		 */
-		if (mem_node) {
-			memcpy(hold_mem_node, mem_node, sizeof(struct pci_resource));
-			mem_node->next = NULL;
+	/* If we have memory resources copy them and fill in the bridge's
+	 * memory range registers.  Otherwise, fill in the range
+	 * registers with values that disable them.
+	 */
+	rc = configure_bridge(pci_bus, devfn, mem_node, &hold_mem_node,
+				PCI_MEMORY_BASE, PCI_MEMORY_LIMIT);
 
-			/* set Mem base and Limit registers */
-			RES_CHECK(mem_node->base, 16);
-			temp_word = (u32)(mem_node->base >> 16);
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+	/* If we have prefetchable memory resources copy them and 
+	 * fill in the bridge's memory range registers.  Otherwise,
+	 * fill in the range registers with values that disable them.
+	 */
+	rc = configure_bridge(pci_bus, devfn, p_mem_node, &hold_p_mem_node,
+				PCI_PREF_MEMORY_BASE, PCI_PREF_MEMORY_LIMIT);
 
-			RES_CHECK(mem_node->base + mem_node->length - 1, 16);
-			temp_word = (u32)((mem_node->base + mem_node->length - 1) >> 16);
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
-		} else {
-			temp_word = 0xFFFF;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+	/* Adjust this to compensate for extra adjustment in first loop */
+	irqs.barber_pole--;
 
-			temp_word = 0x0000;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+	rc = 0;
 
-			kfree(hold_mem_node);
-			hold_mem_node = NULL;
-		}
+	/* Here we actually find the devices and configure them */
+	for (device = 0; (device <= 0x1F) && !rc; device++) {
+		irqs.barber_pole = (irqs.barber_pole + 1) & 0x03;
 
-		/* If we have prefetchable memory resources copy them and 
-		 * fill in the bridge's memory range registers.  Otherwise,
-		 * fill in the range registers with values that disable them.
-		 */
-		if (p_mem_node) {
-			memcpy(hold_p_mem_node, p_mem_node, sizeof(struct pci_resource));
-			p_mem_node->next = NULL;
+		ID = 0xFFFFFFFF;
+		pci_bus->number = hold_bus_node->base;
+		pci_bus_read_config_dword (pci_bus, PCI_DEVFN(device, 0), PCI_VENDOR_ID, &ID);
+		pci_bus->number = func->bus;
 
-			/* set Pre Mem base and Limit registers */
-			RES_CHECK(p_mem_node->base, 16);
-			temp_word = (u32)(p_mem_node->base >> 16);
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
+		if (ID != 0xFFFFFFFF) {	  /*  device Present */
+			/* Setup slot structure. */
+			new_slot = pciehp_slot_create(hold_bus_node->base);
+
+			if (new_slot == NULL) {
+				/* Out of memory */
+				rc = -ENOMEM;
+				continue;
+			}
 
-			RES_CHECK(p_mem_node->base + p_mem_node->length - 1, 16);
-			temp_word = (u32)((p_mem_node->base + p_mem_node->length - 1) >> 16);
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
-		} else {
-			temp_word = 0xFFFF;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
+			new_slot->bus = hold_bus_node->base;
+			new_slot->device = device;
+			new_slot->function = 0;
+			new_slot->is_a_board = 1;
+			new_slot->status = 0;
+
+			rc = configure_new_device(ctrl, new_slot, 1,
+					&temp_resources, func->bus,
+					func->device);
+			dbg("configure_new_device rc=0x%x\n",rc);
+		}	/* End of IF (device in slot?) */
+	}		/* End of FOR loop */
 
-			temp_word = 0x0000;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
+	if (rc) {
+		pciehp_destroy_resource_list(&temp_resources);
 
-			kfree(hold_p_mem_node);
-			hold_p_mem_node = NULL;
-		}
+		return_resource(&(resources->bus_head), hold_bus_node);
+		return_resource(&(resources->io_head), hold_IO_node);
+		return_resource(&(resources->mem_head), hold_mem_node);
+		return_resource(&(resources->p_mem_head), hold_p_mem_node);
+		return(rc);
+	}
 
-		/* Adjust this to compensate for extra adjustment in first loop */
-		irqs.barber_pole--;
+	/* save the interrupt routing information */
+	if (resources->irqs) {
+		resources->irqs->interrupt[0] = irqs.interrupt[0];
+		resources->irqs->interrupt[1] = irqs.interrupt[1];
+		resources->irqs->interrupt[2] = irqs.interrupt[2];
+		resources->irqs->interrupt[3] = irqs.interrupt[3];
+		resources->irqs->valid_INT = irqs.valid_INT;
+	} else if (!behind_bridge) {
+		/* We need to hook up the interrupts here */
+		for (cloop = 0; cloop < 4; cloop++) {
+			if (irqs.valid_INT & (0x01 << cloop)) {
+				rc = pciehp_set_irq(func->bus, func->device,
+							0x0A + cloop, irqs.interrupt[cloop]);
+				if (rc) {
+					pciehp_destroy_resource_list (&temp_resources);
+					return_resource(&(resources->bus_head), hold_bus_node);
+					return_resource(&(resources->io_head), hold_IO_node);
+					return_resource(&(resources->mem_head), hold_mem_node);
+					return_resource(&(resources->p_mem_head), hold_p_mem_node);
+					return rc;
+				}
+			}
+		}	/* end of for loop */
+	}
 
-		rc = 0;
+	/* Return unused bus resources
+	 * First use the temporary node to store information for the board
+	 */
+	if (hold_bus_node && bus_node && temp_resources.bus_head) {
+		hold_bus_node->length = bus_node->base - hold_bus_node->base;
 
-		/* Here we actually find the devices and configure them */
-		for (device = 0; (device <= 0x1F) && !rc; device++) {
-			irqs.barber_pole = (irqs.barber_pole + 1) & 0x03;
+		hold_bus_node->next = func->bus_head;
+		func->bus_head = hold_bus_node;
 
-			ID = 0xFFFFFFFF;
-			pci_bus->number = hold_bus_node->base;
-			pci_bus_read_config_dword (pci_bus, PCI_DEVFN(device, 0), PCI_VENDOR_ID, &ID);
-			pci_bus->number = func->bus;
+		temp_byte = (u8)(temp_resources.bus_head->base - 1);
 
-			if (ID != 0xFFFFFFFF) {	  /*  device Present */
-				/* Setup slot structure. */
-				new_slot = pciehp_slot_create(hold_bus_node->base);
+		/* set subordinate bus */
+		dbg("re-set subordinate bus = 0x%x\n", temp_byte);
+		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte);
 
-				if (new_slot == NULL) {
-					/* Out of memory */
-					rc = -ENOMEM;
-					continue;
-				}
+		if (temp_resources.bus_head->length == 0) {
+			kfree(temp_resources.bus_head);
+			temp_resources.bus_head = NULL;
+		} else {
+			dbg("return bus res of b:d(0x%x:%x) base:len(0x%x:%x)\n",
+				func->bus, func->device, temp_resources.bus_head->base, temp_resources.bus_head->length);
+			return_resource(&(resources->bus_head), temp_resources.bus_head);
+		}
+	}
 
-				new_slot->bus = hold_bus_node->base;
-				new_slot->device = device;
-				new_slot->function = 0;
-				new_slot->is_a_board = 1;
-				new_slot->status = 0;
+	/* If we have IO space available and there is some left,
+	 * return the unused portion
+	 */
+	if (hold_IO_node && temp_resources.io_head) {
+		io_node = do_pre_bridge_resource_split(&(temp_resources.io_head),
+							&hold_IO_node, 0x1000);
 
-				rc = configure_new_device(ctrl, new_slot, 1, &temp_resources, func->bus, func->device);
-				dbg("configure_new_device rc=0x%x\n",rc);
-			}	/* End of IF (device in slot?) */
-		}		/* End of FOR loop */
+		/* Check if we were able to split something off */
+		if (io_node) {
+			hold_IO_node->base = io_node->base + io_node->length;
 
-		if (rc) {
-			pciehp_destroy_resource_list(&temp_resources);
+			RES_CHECK(hold_IO_node->base, 8);
+			temp_byte = (u8)((hold_IO_node->base) >> 8);
+			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_BASE, temp_byte);
 
-			return_resource(&(resources->bus_head), hold_bus_node);
-			return_resource(&(resources->io_head), hold_IO_node);
-			return_resource(&(resources->mem_head), hold_mem_node);
-			return_resource(&(resources->p_mem_head), hold_p_mem_node);
-			return(rc);
-		}
-
-		/* save the interrupt routing information */
-		if (resources->irqs) {
-			resources->irqs->interrupt[0] = irqs.interrupt[0];
-			resources->irqs->interrupt[1] = irqs.interrupt[1];
-			resources->irqs->interrupt[2] = irqs.interrupt[2];
-			resources->irqs->interrupt[3] = irqs.interrupt[3];
-			resources->irqs->valid_INT = irqs.valid_INT;
-		} else if (!behind_bridge) {
-			/* We need to hook up the interrupts here */
-			for (cloop = 0; cloop < 4; cloop++) {
-				if (irqs.valid_INT & (0x01 << cloop)) {
-					rc = pciehp_set_irq(func->bus, func->device,
-							   0x0A + cloop, irqs.interrupt[cloop]);
-					if (rc) {
-						pciehp_destroy_resource_list (&temp_resources);
-						return_resource(&(resources->bus_head), hold_bus_node);
-						return_resource(&(resources->io_head), hold_IO_node);
-						return_resource(&(resources->mem_head), hold_mem_node);
-						return_resource(&(resources->p_mem_head), hold_p_mem_node);
-						return rc;
-					}
-				}
-			}	/* end of for loop */
+			return_resource(&(resources->io_head), io_node);
 		}
 
-		/* Return unused bus resources
-		 * First use the temporary node to store information for the board
-		 */
-		if (hold_bus_node && bus_node && temp_resources.bus_head) {
-			hold_bus_node->length = bus_node->base - hold_bus_node->base;
+		io_node = do_bridge_resource_split(&(temp_resources.io_head), 0x1000);
 
-			hold_bus_node->next = func->bus_head;
-			func->bus_head = hold_bus_node;
+		/*  Check if we were able to split something off */
+		if (io_node) {
+			/* First use the temporary node to store information for the board */
+			hold_IO_node->length = io_node->base - hold_IO_node->base;
 
-			temp_byte = (u8)(temp_resources.bus_head->base - 1);
+			/* If we used any, add it to the board's list */
+			if (hold_IO_node->length) {
+				hold_IO_node->next = func->io_head;
+				func->io_head = hold_IO_node;
 
-			/* set subordinate bus */
-			dbg("re-set subordinate bus = 0x%x\n", temp_byte);
-			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, temp_byte);
+				RES_CHECK(io_node->base - 1, 8);
+				temp_byte = (u8)((io_node->base - 1) >> 8);
+				rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
 
-			if (temp_resources.bus_head->length == 0) {
-				kfree(temp_resources.bus_head);
-				temp_resources.bus_head = NULL;
+				return_resource(&(resources->io_head), io_node);
 			} else {
-				dbg("return bus res of b:d(0x%x:%x) base:len(0x%x:%x)\n",
-					func->bus, func->device, temp_resources.bus_head->base, temp_resources.bus_head->length);
-				return_resource(&(resources->bus_head), temp_resources.bus_head);
-			}
-		}
-
-		/* If we have IO space available and there is some left,
-		 * return the unused portion
-		 */
-		if (hold_IO_node && temp_resources.io_head) {
-			io_node = do_pre_bridge_resource_split(&(temp_resources.io_head),
-							       &hold_IO_node, 0x1000);
-
-			/* Check if we were able to split something off */
-			if (io_node) {
-				hold_IO_node->base = io_node->base + io_node->length;
-
-				RES_CHECK(hold_IO_node->base, 8);
-				temp_byte = (u8)((hold_IO_node->base) >> 8);
-				rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_BASE, temp_byte);
+				/* it doesn't need any IO */
+				temp_byte = 0x00;
+				rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
 
 				return_resource(&(resources->io_head), io_node);
+				kfree(hold_IO_node);
 			}
-
-			io_node = do_bridge_resource_split(&(temp_resources.io_head), 0x1000);
-
-			/*  Check if we were able to split something off */
-			if (io_node) {
-				/* First use the temporary node to store information for the board */
-				hold_IO_node->length = io_node->base - hold_IO_node->base;
-
-				/* If we used any, add it to the board's list */
-				if (hold_IO_node->length) {
-					hold_IO_node->next = func->io_head;
-					func->io_head = hold_IO_node;
-
-					RES_CHECK(io_node->base - 1, 8);
-					temp_byte = (u8)((io_node->base - 1) >> 8);
-					rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
-
-					return_resource(&(resources->io_head), io_node);
-				} else {
-					/* it doesn't need any IO */
-					temp_byte = 0x00;
-					rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
-
-					return_resource(&(resources->io_head), io_node);
-					kfree(hold_IO_node);
-				}
-			} else {
-				/* it used most of the range */
-				hold_IO_node->next = func->io_head;
-				func->io_head = hold_IO_node;
-			}
-		} else if (hold_IO_node) {
-			/* it used the whole range */
+		} else {
+			/* it used most of the range */
 			hold_IO_node->next = func->io_head;
 			func->io_head = hold_IO_node;
 		}
+	} else if (hold_IO_node) {
+		/* it used the whole range */
+		hold_IO_node->next = func->io_head;
+		func->io_head = hold_IO_node;
+	}
 
-		/* If we have memory space available and there is some left,
-		 * return the unused portion
-		 */
-		if (hold_mem_node && temp_resources.mem_head) {
-			mem_node = do_pre_bridge_resource_split(&(temp_resources.mem_head), &hold_mem_node, 0x100000L);
+	/* If we have memory space available and there is some left,
+	 * return the unused portion
+	 */
+	if (hold_mem_node && temp_resources.mem_head) {
+		mem_node = do_pre_bridge_resource_split(&(temp_resources.mem_head), &hold_mem_node, 0x100000L);
 
-			/* Check if we were able to split something off */
-			if (mem_node) {
-				hold_mem_node->base = mem_node->base + mem_node->length;
-
-				RES_CHECK(hold_mem_node->base, 16);
-				temp_word = (u32)((hold_mem_node->base) >> 16);
-				rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+		/* Check if we were able to split something off */
+		if (mem_node) {
+			hold_mem_node->base = mem_node->base + mem_node->length;
 
-				return_resource(&(resources->mem_head), mem_node);
-			}
+			RES_CHECK(hold_mem_node->base, 16);
+			temp_word = (u16)((hold_mem_node->base) >> 16);
+			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
 
-			mem_node = do_bridge_resource_split(&(temp_resources.mem_head), 0x100000L);
+			return_resource(&(resources->mem_head), mem_node);
+		}
 
-			/* Check if we were able to split something off */
-			if (mem_node) {
-				/* First use the temporary node to store information for the board */
-				hold_mem_node->length = mem_node->base - hold_mem_node->base;
-
-				if (hold_mem_node->length) {
-					hold_mem_node->next = func->mem_head;
-					func->mem_head = hold_mem_node;
-
-					/* configure end address */
-					RES_CHECK(mem_node->base - 1, 16);
-					temp_word = (u32)((mem_node->base - 1) >> 16);
-					rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+		mem_node = do_bridge_resource_split(&(temp_resources.mem_head), 0x100000L);
 
-					/* Return unused resources to the pool */
-					return_resource(&(resources->mem_head), mem_node);
-				} else {
-					/* it doesn't need any Mem */
-					temp_word = 0x0000;
-					rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+		/* Check if we were able to split something off */
+		if (mem_node) {
+			/* First use the temporary node to store information for the board */
+			hold_mem_node->length = mem_node->base - hold_mem_node->base;
 
-					return_resource(&(resources->mem_head), mem_node);
-					kfree(hold_mem_node);
-				}
-			} else {
-				/* it used most of the range */
+			if (hold_mem_node->length) {
 				hold_mem_node->next = func->mem_head;
 				func->mem_head = hold_mem_node;
+
+				/* configure end address */
+				RES_CHECK(mem_node->base - 1, 16);
+				temp_word = (u16)((mem_node->base - 1) >> 16);
+				rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+
+				/* Return unused resources to the pool */
+				return_resource(&(resources->mem_head), mem_node);
+			} else {
+				/* it doesn't need any Mem */
+				temp_word = 0x0000;
+				rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+
+				return_resource(&(resources->mem_head), mem_node);
+				kfree(hold_mem_node);
 			}
-		} else if (hold_mem_node) {
-			/* it used the whole range */
+		} else {
+			/* it used most of the range */
 			hold_mem_node->next = func->mem_head;
 			func->mem_head = hold_mem_node;
 		}
+	} else if (hold_mem_node) {
+		/* it used the whole range */
+		hold_mem_node->next = func->mem_head;
+		func->mem_head = hold_mem_node;
+	}
 
-		/* If we have prefetchable memory space available and there is some 
-		 * left at the end, return the unused portion
-		 */
-		if (hold_p_mem_node && temp_resources.p_mem_head) {
-			p_mem_node = do_pre_bridge_resource_split(&(temp_resources.p_mem_head),
-								  &hold_p_mem_node, 0x100000L);
-
-			/* Check if we were able to split something off */
-			if (p_mem_node) {
-				hold_p_mem_node->base = p_mem_node->base + p_mem_node->length;
-
-				RES_CHECK(hold_p_mem_node->base, 16);
-				temp_word = (u32)((hold_p_mem_node->base) >> 16);
-				rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
+	/* If we have prefetchable memory space available and there is some 
+	 * left at the end, return the unused portion
+	 */
+	if (hold_p_mem_node && temp_resources.p_mem_head) {
+		p_mem_node = do_pre_bridge_resource_split(&(temp_resources.p_mem_head),
+								&hold_p_mem_node, 0x100000L);
 
-				return_resource(&(resources->p_mem_head), p_mem_node);
-			}
+		/* Check if we were able to split something off */
+		if (p_mem_node) {
+			hold_p_mem_node->base = p_mem_node->base + p_mem_node->length;
 
-			p_mem_node = do_bridge_resource_split(&(temp_resources.p_mem_head), 0x100000L);
+			RES_CHECK(hold_p_mem_node->base, 16);
+			temp_word = (u16)((hold_p_mem_node->base) >> 16);
+			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
 
-			/* Check if we were able to split something off */
-			if (p_mem_node) {
-				/* First use the temporary node to store information for the board */
-				hold_p_mem_node->length = p_mem_node->base - hold_p_mem_node->base;
-
-				/* If we used any, add it to the board's list */
-				if (hold_p_mem_node->length) {
-					hold_p_mem_node->next = func->p_mem_head;
-					func->p_mem_head = hold_p_mem_node;
-
-					RES_CHECK(p_mem_node->base - 1, 16);
-					temp_word = (u32)((p_mem_node->base - 1) >> 16);
-					rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
+			return_resource(&(resources->p_mem_head), p_mem_node);
+		}
 
-					return_resource(&(resources->p_mem_head), p_mem_node);
-				} else {
-					/* it doesn't need any PMem */
-					temp_word = 0x0000;
-					rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
+		p_mem_node = do_bridge_resource_split(&(temp_resources.p_mem_head), 0x100000L);
 
-					return_resource(&(resources->p_mem_head), p_mem_node);
-					kfree(hold_p_mem_node);
-				}
-			} else {
-				/* it used the most of the range */
+		/* Check if we were able to split something off */
+		if (p_mem_node) {
+			/* First use the temporary node to store information for the board */
+			hold_p_mem_node->length = p_mem_node->base - hold_p_mem_node->base;
+
+			/* If we used any, add it to the board's list */
+			if (hold_p_mem_node->length) {
 				hold_p_mem_node->next = func->p_mem_head;
 				func->p_mem_head = hold_p_mem_node;
+
+				RES_CHECK(p_mem_node->base - 1, 16);
+				temp_word = (u16)((p_mem_node->base - 1) >> 16);
+				rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
+
+				return_resource(&(resources->p_mem_head), p_mem_node);
+			} else {
+				/* it doesn't need any PMem */
+				temp_word = 0x0000;
+				rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
+
+				return_resource(&(resources->p_mem_head), p_mem_node);
+				kfree(hold_p_mem_node);
 			}
-		} else if (hold_p_mem_node) {
-			/* it used the whole range */
+		} else {
+			/* it used the most of the range */
 			hold_p_mem_node->next = func->p_mem_head;
 			func->p_mem_head = hold_p_mem_node;
 		}
+	} else if (hold_p_mem_node) {
+		/* it used the whole range */
+		hold_p_mem_node->next = func->p_mem_head;
+		func->p_mem_head = hold_p_mem_node;
+	}
 
-		/* We should be configuring an IRQ and the bridge's base address
-		 * registers if it needs them.  Although we have never seen such
-		 * a device
-		 */
+	/* We should be configuring an IRQ and the bridge's base address
+	 * registers if it needs them.  Although we have never seen such
+	 * a device
+	 */
+
+	pciehprm_enable_card(ctrl, func, PCI_HEADER_TYPE_BRIDGE);
 
-		pciehprm_enable_card(ctrl, func, PCI_HEADER_TYPE_BRIDGE);
+	dbg("PCI Bridge Hot-Added s:b:d:f(%02x:%02x:%02x:%02x)\n", ctrl->seg, func->bus, func->device, func->function);
 
-		dbg("PCI Bridge Hot-Added s:b:d:f(%02x:%02x:%02x:%02x)\n", ctrl->seg, func->bus, func->device, func->function);
+	return rc;
+}
+
+/**
+ * configure_new_function - Configures the PCI header information of one device
+ *
+ * @ctrl: pointer to controller structure
+ * @func: pointer to function structure
+ * @behind_bridge: 1 if this is a recursive call, 0 if not
+ * @resources: pointer to set of resource lists
+ *
+ * Calls itself recursively for bridged devices.
+ * Returns 0 if success
+ *
+ */
+static int
+configure_new_function(struct controller *ctrl, struct pci_func *func,
+		u8 behind_bridge, struct resource_lists *resources,
+		u8 bridge_bus, u8 bridge_dev)
+{
+	int cloop;
+	u8 temp_byte;
+	u8 class_code;
+	u16 temp_word;
+	u32 rc;
+	u32 temp_register;
+	u32 base;
+	unsigned int devfn;
+	struct pci_resource *mem_node;
+	struct pci_resource *io_node;
+	struct pci_bus lpci_bus, *pci_bus;
+
+	memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus));
+	pci_bus = &lpci_bus;
+	pci_bus->number = func->bus;
+	devfn = PCI_DEVFN(func->device, func->function);
+
+	/* Check for Bridge */
+	rc = pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &temp_byte);
+	if (rc)
+		return rc;
+	dbg("%s: bus %x dev %x func %x temp_byte = %x\n", __FUNCTION__,
+		func->bus, func->device, func->function, temp_byte);
+
+	if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { /* PCI-PCI Bridge */
+		rc = configure_new_bridge(ctrl, func, behind_bridge, resources,
+						pci_bus);
+
+		if (rc)
+			return rc;
 	} else if ((temp_byte & 0x7F) == PCI_HEADER_TYPE_NORMAL) {
 		/* Standard device */
 		u64	base64;
-		rc = pci_bus_read_config_byte (pci_bus, devfn, 0x0B, &class_code);
+		rc = pci_bus_read_config_byte(pci_bus, devfn, 0x0B, &class_code);
 
 		if (class_code == PCI_BASE_CLASS_DISPLAY)
-			return (DEVICE_TYPE_NOT_SUPPORTED);
+			return DEVICE_TYPE_NOT_SUPPORTED;
 
 		/* Figure out IO and memory needs */
 		for (cloop = PCI_BASE_ADDRESS_0; cloop <= PCI_BASE_ADDRESS_5; cloop += 4) {
@@ -2535,7 +2557,7 @@
 					else {
 						if (prefetchable)
 							dbg("using MEM for PMEM\n");
-						mem_node=get_resource(&(resources->mem_head), (ulong)base);
+						mem_node = get_resource(&(resources->mem_head), (ulong)base);
 					}
 
 					/* allocate the resource to the board */
@@ -2614,11 +2636,10 @@
 	}  /* End of Not-A-Bridge else */
 	else {
 		/* It's some strange type of PCI adapter (Cardbus?) */
-		return(DEVICE_TYPE_NOT_SUPPORTED);
+		return DEVICE_TYPE_NOT_SUPPORTED;
 	}
 
 	func->configured = 1;
 
 	return 0;
 }
-
diff -Nru a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
--- a/drivers/pci/hotplug/pciehp_hpc.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/pci/hotplug/pciehp_hpc.c	Tue Jun 15 22:20:42 2004
@@ -291,14 +291,14 @@
 
 static int pcie_write_cmd(struct slot *slot, u16 cmd)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	int retval = 0;
 	u16 slot_status;
 
 	DBG_ENTER_ROUTINE 
 	
 	dbg("%s : Enter\n", __FUNCTION__);
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -331,13 +331,13 @@
 
 static int hpc_check_lnk_status(struct controller *ctrl)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
 	u16 lnk_status;
 	int retval = 0;
 
 	DBG_ENTER_ROUTINE 
 
-	if (!ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -362,14 +362,14 @@
 
 static int hpc_get_attention_status(struct slot *slot, u8 *status)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_ctrl;
 	u8 atten_led_state;
 	int retval = 0;
 	
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -409,14 +409,14 @@
 
 static int hpc_get_power_status(struct slot * slot, u8 *status)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_ctrl;
 	u8 pwr_state;
 	int	retval = 0;
 	
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -450,13 +450,13 @@
 
 static int hpc_get_latch_status(struct slot *slot, u8 *status)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_status;
 	int retval = 0;
 
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -476,14 +476,14 @@
 
 static int hpc_get_adapter_status(struct slot *slot, u8 *status)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_status;
 	u8 card_state;
 	int retval = 0;
 
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -503,7 +503,7 @@
 
 static int hpc_query_power_fault(struct slot * slot)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_status;
 	u8 pwr_fault;
 	int retval = 0;
@@ -511,7 +511,7 @@
 
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -532,13 +532,13 @@
 
 static int hpc_set_attention_status(struct slot *slot, u8 value)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_cmd = 0;
 	u16 slot_ctrl;
 	int rc = 0;
 
 	dbg("%s: \n", __FUNCTION__);
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -580,13 +580,13 @@
 
 static void hpc_set_green_led_on(struct slot *slot)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_cmd;
 	u16 slot_ctrl;
 	int rc = 0;
        	
 	dbg("%s: \n", __FUNCTION__);	
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return ;
 	}
@@ -615,13 +615,13 @@
 
 static void hpc_set_green_led_off(struct slot *slot)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_cmd;
 	u16 slot_ctrl;
 	int rc = 0;
 
 	dbg("%s: \n", __FUNCTION__);	
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return ;
 	}
@@ -651,13 +651,13 @@
 
 static void hpc_set_green_led_blink(struct slot *slot)
 {
-	struct php_ctlr_state_s *php_ctlr =(struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_cmd;
 	u16 slot_ctrl;
 	int rc = 0; 
 	
 	dbg("%s: \n", __FUNCTION__);	
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return ;
 	}
@@ -692,13 +692,13 @@
 	int *updown,		/* physical_slot_num increament: 1 or -1	*/
 	int *flags)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
 	u32 slot_cap;
 	int rc = 0;
 	
 	DBG_ENTER_ROUTINE 
 
-	if (!ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -723,12 +723,12 @@
 
 static void hpc_release_ctlr(struct controller *ctrl)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = ctrl->hpc_ctlr_handle;
 	struct php_ctlr_state_s *p, *p_prev;
 
 	DBG_ENTER_ROUTINE 
 
-	if (!ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return ;
 	}
@@ -769,7 +769,7 @@
 
 static int hpc_power_on_slot(struct slot * slot)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_cmd;
 	u16 slot_ctrl;
 
@@ -778,7 +778,7 @@
 	DBG_ENTER_ROUTINE 
 	dbg("%s: \n", __FUNCTION__);	
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -818,7 +818,7 @@
 
 static int hpc_power_off_slot(struct slot * slot)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	u16 slot_cmd;
 	u16 slot_ctrl;
 
@@ -827,7 +827,7 @@
 	DBG_ENTER_ROUTINE 
 	dbg("%s: \n", __FUNCTION__);	
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -879,10 +879,10 @@
 		return IRQ_NONE;
 
 	if (!pciehp_poll_mode) { 
-		ctrl = (struct controller *)dev_id;
+		ctrl = dev_id;
 		php_ctlr = ctrl->hpc_ctlr_handle;
 	} else {
-		php_ctlr = (struct php_ctlr_state_s *) dev_id;
+		php_ctlr = dev_id;
 		ctrl = (struct controller *)php_ctlr->callback_instance_id;
 	}
 
@@ -1017,14 +1017,14 @@
 
 static int hpc_get_max_lnk_speed (struct slot *slot, enum pcie_link_speed *value)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	enum pcie_link_speed lnk_speed;
 	u32	lnk_cap;
 	int retval = 0;
 
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -1058,14 +1058,14 @@
 
 static int hpc_get_max_lnk_width (struct slot *slot, enum pcie_link_width *value)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	enum pcie_link_width lnk_wdth;
 	u32	lnk_cap;
 	int retval = 0;
 
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -1120,14 +1120,14 @@
 
 static int hpc_get_cur_lnk_speed (struct slot *slot, enum pcie_link_speed *value)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	enum pcie_link_speed lnk_speed = PCI_SPEED_UNKNOWN;
 	int retval = 0;
 	u16 lnk_status;
 
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -1161,14 +1161,14 @@
 
 static int hpc_get_cur_lnk_width (struct slot *slot, enum pcie_link_width *value)
 {
-	struct php_ctlr_state_s *php_ctlr = (struct php_ctlr_state_s *) slot->ctrl->hpc_ctlr_handle;
+	struct php_ctlr_state_s *php_ctlr = slot->ctrl->hpc_ctlr_handle;
 	enum pcie_link_width lnk_wdth = PCIE_LNK_WIDTH_UNKNOWN;
 	int retval = 0;
 	u16 lnk_status;
 
 	DBG_ENTER_ROUTINE 
 
-	if (!slot->ctrl->hpc_ctlr_handle) {
+	if (!php_ctlr) {
 		err("%s: Invalid HPC controller handle!\n", __FUNCTION__);
 		return -1;
 	}
@@ -1245,7 +1245,7 @@
 };
 
 int pcie_init(struct controller * ctrl,
-	struct pci_dev * pdev,
+	struct pci_dev *pdev,
 	php_intr_callback_t attention_button_callback,
 	php_intr_callback_t switch_change_callback,
 	php_intr_callback_t presence_change_callback,
diff -Nru a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
--- a/drivers/pci/hotplug/pciehp_pci.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/pci/hotplug/pciehp_pci.c	Tue Jun 15 22:20:43 2004
@@ -69,7 +69,7 @@
 
 	if (func->pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
 		pci_read_config_byte(func->pci_dev, PCI_SECONDARY_BUS, &bus);
-		child = (struct pci_bus*) pci_add_new_bus(func->pci_dev->bus, (func->pci_dev), bus);
+		child = pci_add_new_bus(func->pci_dev->bus, (func->pci_dev), bus);
 		pci_do_scan_bus(child);
 
 	}
@@ -83,10 +83,12 @@
 	int rc = 0;
 	int j;
 
-	dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus, func->device, func->function);
+	dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus,
+				func->device, func->function);
 
 	for (j=0; j<8 ; j++) {
-		struct pci_dev* temp = pci_find_slot(func->bus, (func->device << 3) | j);
+		struct pci_dev* temp = pci_find_slot(func->bus,
+				(func->device << 3) | j);
 		if (temp) {
 			pci_remove_bus_device(temp);
 		}
@@ -169,7 +171,8 @@
 	memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus));
 	pci_bus = &lpci_bus;
 
-	dbg("%s: num_ctlr_slots = %d, first_device_num = %d\n", __FUNCTION__, num_ctlr_slots, first_device_num);
+	dbg("%s: num_ctlr_slots = %d, first_device_num = %d\n", __FUNCTION__,
+				num_ctlr_slots, first_device_num);
 
 	/*   Decide which slots are supported */
 	if (is_hot_plug) {
@@ -183,7 +186,8 @@
 		LastSupported = 0x1F;
 	}
 
-	dbg("FirstSupported = %d, LastSupported = %d\n", FirstSupported, LastSupported);
+	dbg("FirstSupported = %d, LastSupported = %d\n", FirstSupported,
+					LastSupported);
 
 	/*   Save PCI configuration space for all devices in supported slots */
 	dbg("%s: pci_bus->number = %x\n", __FUNCTION__, pci_bus->number);
@@ -191,15 +195,18 @@
 	dbg("%s: bus = %x, dev = %x\n", __FUNCTION__, busnumber, device);
 	for (device = FirstSupported; device <= LastSupported; device++) {
 		ID = 0xFFFFFFFF;
-		rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0), PCI_VENDOR_ID, &ID);
+		rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0),
+					PCI_VENDOR_ID, &ID);
 
 		if (ID != 0xFFFFFFFF) {	  /*  device in slot */
 			dbg("%s: ID = %x\n", __FUNCTION__, ID);
-			rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0), 0x0B, &class_code);
+			rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0),
+					0x0B, &class_code);
 			if (rc)
 				return rc;
 
-			rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0), PCI_HEADER_TYPE, &header_type);
+			rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0),
+					PCI_HEADER_TYPE, &header_type);
 			if (rc)
 				return rc;
 
@@ -221,7 +228,8 @@
 					/* Recurse the subordinate bus
 					 * get the subordinate bus number
 					 */
-					rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, function), 
+					rc = pci_bus_read_config_byte(pci_bus,
+						PCI_DEVFN(device, function), 
 						PCI_SECONDARY_BUS, &secondary_bus);
 					if (rc) {
 						return rc;
@@ -263,13 +271,17 @@
 				new_slot->switch_save = 0x10;
 				/* In case of unsupported board */
 				new_slot->status = DevError;
-				new_slot->pci_dev = pci_find_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function);
+				new_slot->pci_dev = pci_find_slot(new_slot->bus,
+					(new_slot->device << 3) | new_slot->function);
 				dbg("new_slot->pci_dev = %p\n", new_slot->pci_dev);
 
 				for (cloop = 0; cloop < 0x20; cloop++) {
-					rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, function), cloop << 2, 
-						(u32 *) & (new_slot->config_space [cloop]));
-					/* dbg("new_slot->config_space[%x] = %x\n", cloop, new_slot->config_space[cloop]); */
+					rc = pci_bus_read_config_dword(pci_bus,
+						PCI_DEVFN(device, function),
+						cloop << 2, 
+						(u32 *) &(new_slot->config_space [cloop]));
+					/* dbg("new_slot->config_space[%x] = %x\n",
+						cloop, new_slot->config_space[cloop]); */
 					if (rc)
 						return rc;
 				}
@@ -284,19 +296,23 @@
 
 				while ((function < max_functions)&&(!stop_it)) {
 					dbg("%s: In while loop \n", __FUNCTION__);
-					rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, function), PCI_VENDOR_ID, &ID);
+					rc = pci_bus_read_config_dword(pci_bus,
+							PCI_DEVFN(device, function),
+							PCI_VENDOR_ID, &ID);
 
 					if (ID == 0xFFFFFFFF) {  /* nothing there. */
 						function++;
 						dbg("Nothing there\n");
 					} else {  /* Something there */
-						rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, function), 0x0B, 
-							&class_code);
+						rc = pci_bus_read_config_byte(pci_bus,
+							PCI_DEVFN(device, function),
+							0x0B, &class_code);
 						if (rc)
 							return rc;
 
-						rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, function), PCI_HEADER_TYPE, 
-							&header_type);
+						rc = pci_bus_read_config_byte(pci_bus,
+							PCI_DEVFN(device, function),
+							PCI_HEADER_TYPE, &header_type);
 						if (rc)
 							return rc;
 
@@ -306,8 +322,8 @@
 				}
 
 			} while (function < max_functions);
-		}		/* End of IF (device in slot?) */
-		else if (is_hot_plug) {
+			/* End of IF (device in slot?) */
+		} else if (is_hot_plug) {
 			/* Setup slot structure with entry for empty slot */
 			new_slot = pciehp_slot_create(busnumber);
 
@@ -339,7 +355,7 @@
  *
  * returns 0 if success
  */
-int pciehp_save_slot_config (struct controller *ctrl, struct pci_func * new_slot)
+int pciehp_save_slot_config(struct controller *ctrl, struct pci_func * new_slot)
 {
 	int rc;
 	u8 class_code;
@@ -358,12 +374,15 @@
 
 	ID = 0xFFFFFFFF;
 
-	pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_VENDOR_ID, &ID);
+	pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, 0),
+					PCI_VENDOR_ID, &ID);
 
 	if (ID != 0xFFFFFFFF) {	  /*  device in slot */
-		pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0), 0x0B, &class_code);
+		pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0),
+					0x0B, &class_code);
 
-		pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_HEADER_TYPE, &header_type);
+		pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0),
+					PCI_HEADER_TYPE, &header_type);
 
 		if (header_type & 0x80)	/* Multi-function device */
 			max_functions = 8;
@@ -375,7 +394,8 @@
 		do {
 			if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {	  /* PCI-PCI Bridge */
 				/*  Recurse the subordinate bus */
-				pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, function), 
+				pci_bus_read_config_byte(pci_bus,
+					PCI_DEVFN(new_slot->device, function), 
 					PCI_SECONDARY_BUS, &secondary_bus);
 
 				sub_bus = (int) secondary_bus;
@@ -384,15 +404,17 @@
 				rc = pciehp_save_config(ctrl, sub_bus, 0, 0);
 
 				if (rc)
-					return(rc);
+					return rc;
 
 			}	/* End of IF */
 
 			new_slot->status = 0;
 
 			for (cloop = 0; cloop < 0x20; cloop++) {
-				pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, function), 
-					cloop << 2, (u32 *) & (new_slot->config_space [cloop]));
+				pci_bus_read_config_dword(pci_bus,
+					PCI_DEVFN(new_slot->device, function), 
+					cloop << 2,
+					(u32 *) &(new_slot->config_space [cloop]));
 			}
 
 			function++;
@@ -404,15 +426,20 @@
 			 */
 
 			while ((function < max_functions) && (!stop_it)) {
-				pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, function), PCI_VENDOR_ID, &ID);
+				pci_bus_read_config_dword(pci_bus,
+					PCI_DEVFN(new_slot->device, function),
+					PCI_VENDOR_ID, &ID);
 
 				if (ID == 0xFFFFFFFF) {	 /* nothing there. */
 					function++;
 				} else {  /* Something there */
-					pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, function), 0x0B, &class_code);
-
-					pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, function), PCI_HEADER_TYPE, 
-						&header_type);
+					pci_bus_read_config_byte(pci_bus,
+						PCI_DEVFN(new_slot->device, function),
+						0x0B, &class_code);
+
+					pci_bus_read_config_byte(pci_bus,
+						PCI_DEVFN(new_slot->device, function),
+						PCI_HEADER_TYPE, &header_type);
 
 					stop_it++;
 				}
@@ -421,10 +448,10 @@
 		} while (function < max_functions);
 	}			/* End of IF (device in slot?) */
 	else {
-		return(2);
+		return 2;
 	}
 
-	return(0);
+	return 0;
 }
 
 
@@ -440,7 +467,7 @@
  *  it loops for all functions of the slot and disables them.
  * else, it just get resources of the function and return.
  */
-int pciehp_save_used_resources (struct controller *ctrl, struct pci_func *func, int disable)
+int pciehp_save_used_resources(struct controller *ctrl, struct pci_func *func, int disable)
 {
 	u8 cloop;
 	u8 header_type;
@@ -472,7 +499,7 @@
 		devfn = PCI_DEVFN(func->device, func->function);
 
 		/* Save the command register */
-		pci_bus_read_config_word (pci_bus, devfn, PCI_COMMAND, &save_command);
+		pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &save_command);
 
 		if (disable) {
 			/* disable card */
@@ -481,20 +508,22 @@
 		}
 
 		/* Check for Bridge */
-		pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
+		pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
 
 		if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {     /* PCI-PCI Bridge */
-			dbg("Save_used_res of PCI bridge b:d=0x%x:%x, sc=0x%x\n", func->bus, func->device, save_command);
+			dbg("Save_used_res of PCI bridge b:d=0x%x:%x, sc=0x%x\n",
+					func->bus, func->device, save_command);
 			if (disable) {
 				/* Clear Bridge Control Register */
 				command = 0x00;
 				pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, command);
 			}
 
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte);
 
-			bus_node =(struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			bus_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 			if (!bus_node)
 				return -ENOMEM;
 
@@ -505,13 +534,14 @@
 			func->bus_head = bus_node;
 
 			/* Save IO base and Limit registers */
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_IO_BASE, &temp_byte);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_BASE, &temp_byte);
 			base = temp_byte;
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_IO_LIMIT, &temp_byte);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_LIMIT, &temp_byte);
 			length = temp_byte;
 
 			if ((base <= length) && (!disable || (save_command & PCI_COMMAND_IO))) {
-				io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				io_node = kmalloc(sizeof(struct pci_resource),
+							GFP_KERNEL);
 				if (!io_node)
 					return -ENOMEM;
 
@@ -523,11 +553,12 @@
 			}
 
 			/* Save memory base and Limit registers */
-			pci_bus_read_config_word (pci_bus, devfn, PCI_MEMORY_BASE, &w_base);
-			pci_bus_read_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_BASE, &w_base);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);
 
 			if ((w_base <= w_length) && (!disable || (save_command & PCI_COMMAND_MEMORY))) {
-				mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				mem_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 				if (!mem_node)
 					return -ENOMEM;
 
@@ -538,11 +569,12 @@
 				func->mem_head = mem_node;
 			}
 			/* Save prefetchable memory base and Limit registers */
-			pci_bus_read_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);
-			pci_bus_read_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);
 
 			if ((w_base <= w_length) && (!disable || (save_command & PCI_COMMAND_MEMORY))) {
-				p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				p_mem_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 				if (!p_mem_node)
 					return -ENOMEM;
 
@@ -553,38 +585,41 @@
 				func->p_mem_head = p_mem_node;
 			}
 		} else if ((header_type & 0x7F) == PCI_HEADER_TYPE_NORMAL) {
-			dbg("Save_used_res of PCI adapter b:d=0x%x:%x, sc=0x%x\n", func->bus, func->device, save_command);
+			dbg("Save_used_res of PCI adapter b:d=0x%x:%x, sc=0x%x\n",
+					func->bus, func->device, save_command);
 
 			/* Figure out IO and memory base lengths */
 			for (cloop = PCI_BASE_ADDRESS_0; cloop <= PCI_BASE_ADDRESS_5; cloop += 4) {
-				pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base);
+				pci_bus_read_config_dword(pci_bus, devfn, cloop, &save_base);
 
 				temp_register = 0xFFFFFFFF;
-				pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);
-				pci_bus_read_config_dword (pci_bus, devfn, cloop, &temp_register);
+				pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register);
+				pci_bus_read_config_dword(pci_bus, devfn, cloop, &temp_register);
 
-				if (!disable) {
-					pci_bus_write_config_dword (pci_bus, devfn, cloop, save_base);
-				}
+				if (!disable)
+					pci_bus_write_config_dword(pci_bus, devfn, cloop, save_base);
 
 				if (!temp_register)
 					continue;
 
 				base = temp_register;
 
-				if ((base & PCI_BASE_ADDRESS_SPACE_IO) && (!disable || (save_command & PCI_COMMAND_IO))) {
+				if ((base & PCI_BASE_ADDRESS_SPACE_IO) &&
+						(!disable || (save_command & PCI_COMMAND_IO))) {
 					/* IO base */
 					/* set temp_register = amount of IO space requested */
 					base = base & 0xFFFFFFFCL;
 					base = (~base) + 1;
 
-					io_node = (struct pci_resource *) kmalloc(sizeof (struct pci_resource), GFP_KERNEL);
+					io_node = kmalloc(sizeof (struct pci_resource),
+								GFP_KERNEL);
 					if (!io_node)
 						return -ENOMEM;
 
 					io_node->base = (ulong)save_base & PCI_BASE_ADDRESS_IO_MASK;
 					io_node->length = (ulong)base;
-					dbg("sur adapter: IO bar=0x%x(length=0x%x)\n", io_node->base, io_node->length);
+					dbg("sur adapter: IO bar=0x%x(length=0x%x)\n",
+						io_node->base, io_node->length);
 
 					io_node->next = func->io_head;
 					func->io_head = io_node;
@@ -594,11 +629,13 @@
 					char *res_type_str = "PMEM";
 					u32 temp_register2;
 
-					t_mem_node = (struct pci_resource *) kmalloc(sizeof (struct pci_resource), GFP_KERNEL);
+					t_mem_node = kmalloc(sizeof (struct pci_resource),
+								GFP_KERNEL);
 					if (!t_mem_node)
 						return -ENOMEM;
 
-					if (!(base & PCI_BASE_ADDRESS_MEM_PREFETCH) && (!disable || (save_command & PCI_COMMAND_MEMORY))) {
+					if (!(base & PCI_BASE_ADDRESS_MEM_PREFETCH) &&
+							(!disable || (save_command & PCI_COMMAND_MEMORY))) {
 						prefetchable = 0;
 						mem_node = t_mem_node;
 						res_type_str++;
@@ -613,16 +650,20 @@
 						if (prefetchable) {
 							p_mem_node->base = (ulong)save_base & PCI_BASE_ADDRESS_MEM_MASK;
 							p_mem_node->length = (ulong)base;
-							dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n", res_type_str, 
-								p_mem_node->base, p_mem_node->length);
+							dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n",
+								res_type_str, 
+								p_mem_node->base,
+								p_mem_node->length);
 
 							p_mem_node->next = func->p_mem_head;
 							func->p_mem_head = p_mem_node;
 						} else {
 							mem_node->base = (ulong)save_base & PCI_BASE_ADDRESS_MEM_MASK;
 							mem_node->length = (ulong)base;
-							dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n", res_type_str, 
-								mem_node->base, mem_node->length);
+							dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n",
+								res_type_str, 
+								mem_node->base,
+								mem_node->length);
 
 							mem_node->next = func->mem_head;
 							func->mem_head = mem_node;
@@ -642,16 +683,20 @@
 						if (prefetchable) {
 							p_mem_node->base = base64 & PCI_BASE_ADDRESS_MEM_MASK;
 							p_mem_node->length = base;
-							dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n", res_type_str, 
-								p_mem_node->base, p_mem_node->length);
+							dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n",
+								res_type_str, 
+								p_mem_node->base,
+								p_mem_node->length);
 
 							p_mem_node->next = func->p_mem_head;
 							func->p_mem_head = p_mem_node;
 						} else {
 							mem_node->base = base64 & PCI_BASE_ADDRESS_MEM_MASK;
 							mem_node->length = base;
-							dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n", res_type_str, 
-								mem_node->base, mem_node->length);
+							dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n",
+								res_type_str, 
+								mem_node->base,
+								mem_node->length);
 
 							mem_node->next = func->mem_head;
 							func->mem_head = mem_node;
@@ -659,13 +704,15 @@
 						cloop += 4;
 						break;
 					default:
-						dbg("asur: reserved BAR type=0x%x\n", temp_register);
+						dbg("asur: reserved BAR type=0x%x\n",
+							temp_register);
 						break;
 					}
 				} 
 			}	/* End of base register loop */
 		} else {	/* Some other unknown header type */
-			dbg("Save_used_res of PCI unknown type b:d=0x%x:%x. skip.\n", func->bus, func->device);
+			dbg("Save_used_res of PCI unknown type b:d=0x%x:%x. skip.\n",
+					func->bus, func->device);
 		}
 
 		/* find the next device in this slot */
@@ -674,10 +721,29 @@
 		func = pciehp_slot_find(func->bus, func->device, index++);
 	}
 
-	return(0);
+	return 0;
 }
 
 
+/**
+ * kfree_resource_list: release memory of all list members
+ * @res: resource list to free
+ */
+static inline void
+return_resource_list(struct pci_resource **func, struct pci_resource **res)
+{
+	struct pci_resource *node;
+	struct pci_resource *t_node;
+
+	node = *func;
+	*func = NULL;
+	while (node) {
+		t_node = node->next;
+		return_resource(res, node);
+		node = t_node;
+	}
+}
+
 /*
  * pciehp_return_board_resources
  *
@@ -686,95 +752,40 @@
  *
  * returns 0 if success
  */
-int pciehp_return_board_resources(struct pci_func * func, struct resource_lists * resources)
+int pciehp_return_board_resources(struct pci_func * func,
+				struct resource_lists * resources)
 {
-	int rc = 0;
-	struct pci_resource *node;
-	struct pci_resource *t_node;
+	int rc;
+
 	dbg("%s\n", __FUNCTION__);
 
 	if (!func)
-		return(1);
+		return 1;
 
-	node = func->io_head;
-	func->io_head = NULL;
-	while (node) {
-		t_node = node->next;
-		return_resource(&(resources->io_head), node);
-		node = t_node;
-	}
+	return_resource_list(&(func->io_head),&(resources->io_head));
+	return_resource_list(&(func->mem_head),&(resources->mem_head));
+	return_resource_list(&(func->p_mem_head),&(resources->p_mem_head));
+	return_resource_list(&(func->bus_head),&(resources->bus_head));
 
-	node = func->mem_head;
-	func->mem_head = NULL;
-	while (node) {
-		t_node = node->next;
-		return_resource(&(resources->mem_head), node);
-		node = t_node;
-	}
-
-	node = func->p_mem_head;
-	func->p_mem_head = NULL;
-	while (node) {
-		t_node = node->next;
-		return_resource(&(resources->p_mem_head), node);
-		node = t_node;
-	}
-
-	node = func->bus_head;
-	func->bus_head = NULL;
-	while (node) {
-		t_node = node->next;
-		return_resource(&(resources->bus_head), node);
-		node = t_node;
-	}
-
-	rc |= pciehp_resource_sort_and_combine(&(resources->mem_head));
+	rc = pciehp_resource_sort_and_combine(&(resources->mem_head));
 	rc |= pciehp_resource_sort_and_combine(&(resources->p_mem_head));
 	rc |= pciehp_resource_sort_and_combine(&(resources->io_head));
 	rc |= pciehp_resource_sort_and_combine(&(resources->bus_head));
 
-	return(rc);
+	return rc;
 }
 
-
-/*
- * pciehp_destroy_resource_list
- *
- * Puts node back in the resource list pointed to by head
+/**
+ * kfree_resource_list: release memory of all list members
+ * @res: resource list to free
  */
-void pciehp_destroy_resource_list (struct resource_lists * resources)
+static inline void
+kfree_resource_list(struct pci_resource **r)
 {
 	struct pci_resource *res, *tres;
 
-	res = resources->io_head;
-	resources->io_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = resources->mem_head;
-	resources->mem_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = resources->p_mem_head;
-	resources->p_mem_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = resources->bus_head;
-	resources->bus_head = NULL;
+	res = *r;
+	*r = NULL;
 
 	while (res) {
 		tres = res;
@@ -783,50 +794,26 @@
 	}
 }
 
-
-/*
- * pciehp_destroy_board_resources
- *
- * Puts node back in the resource list pointed to by head
+/**
+ * pciehp_destroy_resource_list: put node back in the resource list
+ * @resources: list to put nodes back
  */
-void pciehp_destroy_board_resources (struct pci_func * func)
+void pciehp_destroy_resource_list(struct resource_lists * resources)
 {
-	struct pci_resource *res, *tres;
-
-	res = func->io_head;
-	func->io_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = func->mem_head;
-	func->mem_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = func->p_mem_head;
-	func->p_mem_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = func->bus_head;
-	func->bus_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
+	kfree_resource_list(&(resources->io_head));
+	kfree_resource_list(&(resources->mem_head));
+	kfree_resource_list(&(resources->p_mem_head));
+	kfree_resource_list(&(resources->bus_head));
 }
 
+/**
+ * pciehp_destroy_board_resources: put node back in the resource list
+ * @resources: list to put nodes back
+ */
+void pciehp_destroy_board_resources(struct pci_func * func)
+{
+	kfree_resource_list(&(func->io_head));
+	kfree_resource_list(&(func->mem_head));
+	kfree_resource_list(&(func->p_mem_head));
+	kfree_resource_list(&(func->bus_head));
+}
diff -Nru a/drivers/pci/hotplug/pciehprm.h b/drivers/pci/hotplug/pciehprm.h
--- a/drivers/pci/hotplug/pciehprm.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/pci/hotplug/pciehprm.h	Tue Jun 15 22:21:05 2004
@@ -37,7 +37,6 @@
 int pciehprm_init(enum php_ctlr_type ct);
 void pciehprm_cleanup(void);
 int pciehprm_print_pirt(void);
-void *pciehprm_get_slot(struct slot *slot);
 int pciehprm_find_available_resources(struct controller *ctrl);
 int pciehprm_set_hpp(struct controller *ctrl, struct pci_func *func, u8 card_type);
 void pciehprm_enable_card(struct controller *ctrl, struct pci_func *func, u8 card_type);
diff -Nru a/drivers/pci/hotplug/pciehprm_acpi.c b/drivers/pci/hotplug/pciehprm_acpi.c
--- a/drivers/pci/hotplug/pciehprm_acpi.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/pci/hotplug/pciehprm_acpi.c	Tue Jun 15 22:21:02 2004
@@ -1301,6 +1301,7 @@
 
 }
 
+#if 0
 void * pciehprm_get_slot(struct slot *slot)
 {
 	struct acpi_bridge	*ab = acpi_bridges_head;
@@ -1312,6 +1313,7 @@
 
 	return (void *)aps;
 }
+#endif
 
 static void pciehprm_dump_func_res( struct pci_func *fun)
 {
diff -Nru a/drivers/pci/hotplug/pciehprm_nonacpi.c b/drivers/pci/hotplug/pciehprm_nonacpi.c
--- a/drivers/pci/hotplug/pciehprm_nonacpi.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/pci/hotplug/pciehprm_nonacpi.c	Tue Jun 15 22:20:37 2004
@@ -52,11 +52,6 @@
 	return 0;
 }
 
-void * pciehprm_get_slot(struct slot *slot)
-{
-	return NULL;
-}
-
 int pciehprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
 {
 
diff -Nru a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c
--- a/drivers/pci/hotplug/pcihp_skeleton.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pci/hotplug/pcihp_skeleton.c	Tue Jun 15 22:20:41 2004
@@ -30,16 +30,14 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <linux/init.h>
 #include "pci_hotplug.h"
 
-
-#define SLOT_MAGIC	0x67267322
 struct slot {
-	u32 magic;
 	u8 number;
 	struct hotplug_slot *hotplug_slot;
 	struct list_head slot_list;
@@ -47,11 +45,7 @@
 
 static LIST_HEAD(slot_list);
 
-#if !defined(CONFIG_HOTPLUG_PCI_SKELETON_MODULE)
-	#define MY_NAME	"pcihp_skeleton"
-#else
-	#define MY_NAME	THIS_MODULE->name
-#endif
+#define MY_NAME	"pcihp_skeleton"
 
 #define dbg(format, arg...)					\
 	do {							\
@@ -69,14 +63,14 @@
 static int debug;
 static int num_slots;
 
-#define DRIVER_VERSION	"0.2"
+#define DRIVER_VERSION	"0.3"
 #define DRIVER_AUTHOR	"Greg Kroah-Hartman <greg@kroah.com>"
 #define DRIVER_DESC	"Hot Plug PCI Controller Skeleton Driver"
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
-MODULE_PARM(debug, "i");
+module_param(debug, bool, 644);
 MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
 
 static int enable_slot		(struct hotplug_slot *slot);
@@ -100,50 +94,12 @@
 	.get_adapter_status =	get_adapter_status,
 };
 
-
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int slot_paranoia_check (struct slot *slot, const char *function)
-{
-	if (!slot) {
-		dbg("%s - slot == NULL", function);
-		return -1;
-	}
-	if (slot->magic != SLOT_MAGIC) {
-		dbg("%s - bad magic number for slot", function);
-		return -1;
-	}
-	if (!slot->hotplug_slot) {
-		dbg("%s - slot->hotplug_slot == NULL!", function);
-		return -1;
-	}
-	return 0;
-}
-
-static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function)
-{ 
-	struct slot *slot;
-
-	if (!hotplug_slot) {
-		dbg("%s - hotplug_slot == NULL\n", function);
-		return NULL;
-	}
-
-	slot = (struct slot *)hotplug_slot->private;
-	if (slot_paranoia_check (slot, function))
-                return NULL;
-	return slot;
-}               
-
-
-static int enable_slot (struct hotplug_slot *hotplug_slot)
+static int enable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
-	dbg ("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	/*
 	 * Fill in code here to enable the specified slot
@@ -153,15 +109,12 @@
 }
 
 
-static int disable_slot (struct hotplug_slot *hotplug_slot)
+static int disable_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
-	dbg ("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	/*
 	 * Fill in code here to disable the specified slot
@@ -170,15 +123,12 @@
 	return retval;
 }
 
-static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
+static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
-	dbg ("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	switch (status) {
 		case 0:
@@ -198,32 +148,30 @@
 	return retval;
 }
 
-static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
+static int hardware_test(struct hotplug_slot *hotplug_slot, u32 value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
-	dbg ("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
-	err ("No hardware tests are defined for this driver");
-	retval = -ENODEV;
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+
+	switch (value) {
+		case 0:
+			/* Specify a test here */
+			break;
+		case 1:
+			/* Specify another test here */
+			break;
+	}
 
-	/* Or you can specify a test if you want to */
-	
 	return retval;
 }
 
-static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	/*
@@ -234,14 +182,11 @@
 	return retval;
 }
 
-static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	/*
@@ -252,14 +197,11 @@
 	return retval;
 }
 
-static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	/*
@@ -270,14 +212,11 @@
 	return retval;
 }
 
-static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
+static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
 {
-	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
+	struct slot *slot = hotplug_slot->private;
 	int retval = 0;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	/*
@@ -288,13 +227,9 @@
 	return retval;
 }
 
-static void release_slots(struct hotplug_slot *hotplug_slot)
+static void release_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-	int retval = 0;
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = hotplug_slot->private;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 	kfree(slot->hotplug_slot->info);
@@ -304,22 +239,26 @@
 }
 
 #define SLOT_NAME_SIZE	10
-static void make_slot_name (struct slot *slot)
+static void make_slot_name(struct slot *slot)
 {
 	/*
 	 * Stupid way to make a filename out of the slot name.
 	 * replace this if your hardware provides a better way to name slots.
 	 */
-	snprintf (slot->hotplug_slot->name, SLOT_NAME_SIZE, "%d", slot->number);
+	snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%d", slot->number);
 }
 
-static int init_slots (void)
+/**
+ * init_slots - initialize 'struct slot' structures for each slot
+ *
+ */
+static int __init init_slots(void)
 {
 	struct slot *slot;
 	struct hotplug_slot *hotplug_slot;
 	struct hotplug_slot_info *info;
 	char *name;
-	int retval = 0;
+	int retval = -ENOMEM;
 	int i;
 
 	/*
@@ -327,43 +266,34 @@
 	 * with the pci_hotplug subsystem.
 	 */
 	for (i = 0; i < num_slots; ++i) {
-		slot = kmalloc (sizeof (struct slot), GFP_KERNEL);
+		slot = kmalloc(sizeof(struct slot), GFP_KERNEL);
 		if (!slot)
-			return -ENOMEM;
+			goto error;
 		memset(slot, 0, sizeof(struct slot));
 
-		hotplug_slot = kmalloc (sizeof (struct hotplug_slot), GFP_KERNEL);
-		if (!hotplug_slot) {
-			kfree (slot);
-			return -ENOMEM;
-		}
+		hotplug_slot = kmalloc(sizeof(struct hotplug_slot),
+					GFP_KERNEL);
+		if (!hotplug_slot)
+			goto error_slot;
 		memset(hotplug_slot, 0, sizeof (struct hotplug_slot));
 		slot->hotplug_slot = hotplug_slot;
 
-		info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
-		if (!info) {
-			kfree (hotplug_slot);
-			kfree (slot);
-			return -ENOMEM;
-		}
+		info = kmalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
+		if (!info)
+			goto error_hpslot;
 		memset(info, 0, sizeof (struct hotplug_slot_info));
 		hotplug_slot->info = info;
 
-		name = kmalloc (SLOT_NAME_SIZE, GFP_KERNEL);
-		if (!name) {
-			kfree (info);
-			kfree (hotplug_slot);
-			kfree (slot);
-			return -ENOMEM;
-		}
+		name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
+		if (!name)
+			goto error_info;
 		hotplug_slot->name = name;
 
-		slot->magic = SLOT_MAGIC;
 		slot->number = i;
 
 		hotplug_slot->private = slot;
 		hotplug_slot->release = &release_slot;
-		make_slot_name (slot);
+		make_slot_name(slot);
 		hotplug_slot->ops = &skel_hotplug_slot_ops;
 		
 		/*
@@ -375,25 +305,31 @@
 		info->latch_status = get_latch_status(slot);
 		info->adapter_status = get_adapter_status(slot);
 		
-		dbg ("registering slot %d\n", i);
-		retval = pci_hp_register (slot->hotplug_slot);
+		dbg("registering slot %d\n", i);
+		retval = pci_hp_register(slot->hotplug_slot);
 		if (retval) {
-			err ("pci_hp_register failed with error %d\n", retval);
-			kfree (info);
-			kfree (name);
-			kfree (hotplug_slot);
-			kfree (slot);
-			return retval;
+			err("pci_hp_register failed with error %d\n", retval);
+			goto error_name;
 		}
 
 		/* add slot to our internal list */
-		list_add (&slot->slot_list, &slot_list);
+		list_add(&slot->slot_list, &slot_list);
 	}
 
+	return 0;
+error_name:
+	kfree(name);
+error_info:
+	kfree(info);
+error_hpslot:
+	kfree(hotplug_slot);
+error_slot:
+	kfree(slot);
+error:
 	return retval;
 }
 
-static void cleanup_slots(void)
+static void __exit cleanup_slots(void)
 {
 	struct list_head *tmp;
 	struct list_head *next;
@@ -404,10 +340,10 @@
 	 * Memory will be freed in release_slot() callback after slot's
 	 * lifespan is finished.
 	 */
-	list_for_each_safe (tmp, next, &slot_list) {
-		slot = list_entry (tmp, struct slot, slot_list);
-		list_del (&slot->slot_list);
-		pci_hp_deregister (slot->hotplug_slot);
+	list_for_each_safe(tmp, next, &slot_list) {
+		slot = list_entry(tmp, struct slot, slot_list);
+		list_del(&slot->slot_list);
+		pci_hp_deregister(slot->hotplug_slot);
 	}
 }
 		
@@ -415,20 +351,16 @@
 {
 	int retval;
 
+	info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
 	/*
 	 * Do specific initialization stuff for your driver here
-	 * Like initilizing your controller hardware (if any) and
+	 * Like initializing your controller hardware (if any) and
 	 * determining the number of slots you have in the system
 	 * right now.
 	 */
 	num_slots = 5;
 
-	retval = init_slots();
-	if (retval)
-		return retval;
-
-	info (DRIVER_DESC " version: " DRIVER_VERSION "\n");
-	return 0;
+	return init_slots();
 }
 
 static void __exit pcihp_skel_exit(void)
@@ -441,4 +373,3 @@
 
 module_init(pcihp_skel_init);
 module_exit(pcihp_skel_exit);
-
diff -Nru a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
--- a/drivers/pci/hotplug/rpadlpar_core.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pci/hotplug/rpadlpar_core.c	Tue Jun 15 22:20:41 2004
@@ -47,15 +47,13 @@
 {
 	struct device_node *child;
 	struct device_node *parent = of_find_node_by_name(NULL, "vdevice");
+	char *loc_code;
 
 	if (!parent)
 		return NULL;
 
-	for (child = of_get_next_child(parent, NULL);	
+	for (child = of_get_next_child(parent, NULL);
 	     child; child = of_get_next_child(parent, child)) {
-	
-		char *loc_code;
-	
 		loc_code = get_property(child, "ibm,loc-code", NULL);
 		if (loc_code && !strcmp(loc_code, drc_name))
 			return child;
@@ -309,12 +307,8 @@
  */
 int dlpar_remove_pci_slot(struct slot *slot, char *drc_name)
 {
-	struct device_node *dn = find_php_slot_pci_node(drc_name);
 	struct pci_dev *bridge_dev;
 
-	if (!dn)
-		return -ENODEV;
-
 	bridge_dev = slot->bridge;
 	if (!bridge_dev) {
 		printk(KERN_ERR "%s: unexpected null bridge device\n",
@@ -358,13 +352,19 @@
 
 	if (down_interruptible(&rpadlpar_sem))
 		return -ERESTARTSYS;
-	
+
+	if (!find_php_slot_vio_node(drc_name) &&
+	    !find_php_slot_pci_node(drc_name)) {
+		rc = -ENODEV;
+		goto exit;
+	}
+
 	slot = find_slot(drc_name);
 	if (!slot) {
 		rc = -EINVAL;
 		goto exit;
 	}
-	
+
 	switch (slot->dev_type) {
 		case PCI_DEV:
 			rc = dlpar_remove_pci_slot(slot, drc_name);
diff -Nru a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h
--- a/drivers/pci/hotplug/rpaphp.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/pci/hotplug/rpaphp.h	Tue Jun 15 22:20:39 2004
@@ -62,8 +62,6 @@
 #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
 #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
 
-#define SLOT_MAGIC	0x67267322
-
 /* slot types */
 #define VIO_DEV	1
 #define PCI_DEV	2
@@ -79,7 +77,6 @@
  * struct slot - slot information for each *physical* slot
  */
 struct slot {
-	u32 magic;
 	int state;
 	u32 index;
 	u32 type;
diff -Nru a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
--- a/drivers/pci/hotplug/rpaphp_core.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/pci/hotplug/rpaphp_core.c	Tue Jun 15 22:21:04 2004
@@ -54,7 +54,7 @@
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
-module_param(debug, int, 0644);
+module_param(debug, bool, 0644);
 
 static int enable_slot(struct hotplug_slot *slot);
 static int disable_slot(struct hotplug_slot *slot);
@@ -63,7 +63,6 @@
 static int get_attention_status(struct hotplug_slot *slot, u8 * value);
 static int get_adapter_status(struct hotplug_slot *slot, u8 * value);
 static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value);
-static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value);
 
 struct hotplug_slot_ops rpaphp_hotplug_slot_ops = {
 	.owner = THIS_MODULE,
@@ -74,18 +73,8 @@
 	.get_attention_status = get_attention_status,
 	.get_adapter_status = get_adapter_status,
 	.get_max_bus_speed = get_max_bus_speed,
-	.get_cur_bus_speed = get_cur_bus_speed,
 };
 
-static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function)
-{
-	if (!hotplug_slot) {
-		dbg("%s - hotplug_slot == NULL\n", function);
-		return NULL;
-	}
-	return (struct slot *)hotplug_slot->private;
-}
-
 static int rpaphp_get_attention_status(struct slot *slot)
 {
 	return slot->hotplug_slot->info->attention_status;
@@ -100,11 +89,8 @@
  */
 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
 {
-	int retval = 0;
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
+	int retval;
+	struct slot *slot = (struct slot *)hotplug_slot->private;
 
 	down(&rpaphp_sem);
 	switch (value) {
@@ -136,10 +122,7 @@
 static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
 {
 	int retval;
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = (struct slot *)hotplug_slot->private;
 
 	down(&rpaphp_sem);
 	retval = rpaphp_get_power_status(slot, value);
@@ -155,10 +138,7 @@
 static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
 {
 	int retval = 0;
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = (struct slot *)hotplug_slot->private;
 
 	down(&rpaphp_sem);
 	*value = rpaphp_get_attention_status(slot);
@@ -168,11 +148,9 @@
 
 static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
+	struct slot *slot = (struct slot *)hotplug_slot->private;
 	int retval = 0;
 
-	if (slot == NULL)
-		return -ENODEV;
 	down(&rpaphp_sem);
 	/*  have to go through this */
 	switch (slot->dev_type) {
@@ -191,10 +169,7 @@
 
 static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
 {
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = (struct slot *)hotplug_slot->private;
 
 	down(&rpaphp_sem);
 	switch (slot->type) {
@@ -231,18 +206,6 @@
 	return 0;
 }
 
-/* return dummy value because not sure if PRA provides any method... */
-static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
-{
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
-
-	*value = PCI_SPEED_UNKNOWN;
-	return 0;
-}
-
 int rpaphp_remove_slot(struct slot *slot)
 {
 	int retval = 0;
@@ -268,24 +231,24 @@
 {
 	*indexes = (int *) get_property(dn, "ibm,drc-indexes", NULL);
 	if (!*indexes)
-		return (0);
+		return 0;
 	/* &names[1] contains NULL terminated slot names */
 	*names = (int *) get_property(dn, "ibm,drc-names", NULL);
 	if (!*names)
-		return (0);
+		return 0;
 	/* &types[1] contains NULL terminated slot types */
 	*types = (int *) get_property(dn, "ibm,drc-types", NULL);
 	if (!*types)
-		return (0);
+		return 0;
 	/* power_domains[1...n] are the slot power domains */
 	*power_domains = (int *) get_property(dn,
 					      "ibm,drc-power-domains", NULL);
 	if (!*power_domains)
-		return (0);
+		return 0;
 	if (strcmp(dn->name, "pci") == 0 &&
-	    !get_property(dn, "ibm,fw-pci-hot-plug-ctrl", NULL))
-		return (0);
-	return (1);
+			!get_property(dn, "ibm,fw-pci-hot-plug-ctrl", NULL))
+		return 0;
+	return 1;
 }
 
 static inline int is_vdevice_root(struct device_node *dn)
@@ -293,10 +256,10 @@
 	return !strcmp(dn->name, "vdevice");
 }
 
-/*************************************
- * Add  Hot Plug slot(s) to sysfs
+/**
+ * rpaphp_add_slot: Add  Hot Plug slot(s) to sysfs
  *
- ************************************/
+ */
 int rpaphp_add_slot(struct device_node *dn)
 {
 	struct slot *slot;
@@ -320,8 +283,9 @@
 		name = (char *) &names[1];
 		type = (char *) &types[1];
 		for (i = 0; i < indexes[0];
-		     i++,
-		     name += (strlen(name) + 1), type += (strlen(type) + 1)) {
+					i++,
+					name += (strlen(name) + 1),
+					type += (strlen(type) + 1)) {
 			if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name,
 						       power_domains[i + 1]))) {
 				retval = -ENOMEM;
@@ -334,38 +298,28 @@
 
 		}		/* for indexes */
 	}			/* end of PCI device_node */
-      exit:
+exit:
 	dbg("%s - Exit: num_slots=%d rc[%d]\n",
 	    __FUNCTION__, num_slots, retval);
 	return retval;
 }
 
-/*
- * init_slots - initialize 'struct slot' structures for each slot
- *
- */
-static void init_slots(void)
+static int __init init_rpa(void)
 {
 	struct device_node *dn;
 
-	for (dn = find_all_nodes(); dn; dn = dn->next)
-		rpaphp_add_slot(dn);
-}
-
-static int init_rpa(void)
-{
-
 	init_MUTEX(&rpaphp_sem);
 
 	/* initialize internal data structure etc. */
-	init_slots();
+	for (dn = find_all_nodes(); dn; dn = dn->next)
+		rpaphp_add_slot(dn);
 	if (!num_slots)
 		return -ENODEV;
 
 	return 0;
 }
 
-static void cleanup_slots(void)
+static void __exit cleanup_slots(void)
 {
 	struct list_head *tmp, *n;
 	struct slot *slot;
@@ -400,10 +354,7 @@
 static int enable_slot(struct hotplug_slot *hotplug_slot)
 {
 	int retval = 0;
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = (struct slot *)hotplug_slot->private;
 
 	if (slot->state == CONFIGURED) {
 		dbg("%s: %s is already enabled\n", __FUNCTION__, slot->name);
@@ -431,10 +382,7 @@
 static int disable_slot(struct hotplug_slot *hotplug_slot)
 {
 	int retval;
-	struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
-
-	if (slot == NULL)
-		return -ENODEV;
+	struct slot *slot = (struct slot *)hotplug_slot->private;
 
 	dbg("%s - Entry: slot[%s]\n", __FUNCTION__, slot->name);
 
diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
--- a/drivers/pci/hotplug/rpaphp_pci.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/pci/hotplug/rpaphp_pci.c	Tue Jun 15 22:20:35 2004
@@ -30,7 +30,7 @@
 
 struct pci_dev *rpaphp_find_pci_dev(struct device_node *dn)
 {
-	struct pci_dev *retval_dev = NULL, *dev = NULL;
+	struct pci_dev *retval_dev = NULL, *dev;
 	char bus_id[BUS_ID_SIZE];
 
 	sprintf(bus_id, "%04x:%02x:%02x.%d",dn->phb->global_number,
@@ -57,9 +57,8 @@
 	struct resource *res = &dev->resource[resource];
 	struct resource *root = pci_find_parent_resource(dev, res);
 	char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
-	int err;
+	int err = -EINVAL;
 
-	err = -EINVAL;
 	if (root != NULL) {
 		err = request_resource(root, res);
 	}
@@ -117,8 +116,8 @@
 	return rc;
 }
 
-/*
- * get_pci_adapter_status - get  the status of a slot
+/**
+ * get_pci_adapter_status - get the status of a slot
  * 
  * 0-- slot is empty
  * 1-- adapter is configured
@@ -136,7 +135,7 @@
 	if (state == PRESENT) {
 		if (!is_init)
 			/* at run-time slot->state can be changed by */
-			/* config/unconfig adapter                        */
+			/* config/unconfig adapter */
 			*value = slot->state;
 		else {
 			if (!slot->dn->child)
@@ -154,7 +153,7 @@
 		*value = state;
 	}
 
-      exit:
+exit:
 	return rc;
 }
 
@@ -175,6 +174,7 @@
 			pci_read_irq_line(dev);
 			for (i = 0; i < PCI_NUM_RESOURCES; i++) {
 				struct resource *r = &dev->resource[i];
+
 				if (r->parent || !r->start || !r->flags)
 					continue;
 				rpaphp_claim_resource(dev, i);
@@ -183,7 +183,8 @@
 	}
 }
 
-static void rpaphp_pci_config_device(struct pci_bus *pci_bus, struct device_node *dn)
+static void
+rpaphp_pci_config_device(struct pci_bus *pci_bus, struct device_node *dn)
 {
 	int num;
 
@@ -192,7 +193,6 @@
 		rpaphp_fixup_new_pci_devices(pci_bus);
 		pci_bus_add_devices(pci_bus);
 	}
-	return;
 }
 
 static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn);
@@ -201,7 +201,8 @@
  rpaphp_pci_config_dn() will recursively configure all devices under the 
  given slot->dn and return the dn's pci_dev.
  *****************************************************************************/
-static struct pci_dev *rpaphp_pci_config_dn(struct device_node *dn, struct pci_bus *bus)
+static struct pci_dev *
+rpaphp_pci_config_dn(struct device_node *dn, struct pci_bus *bus)
 {
 	struct device_node *local;
 	struct pci_dev *dev;
@@ -256,16 +257,16 @@
 			goto exit;
 		}
 
+		eeh_add_device_early(slot->dn->child);
 		dev = rpaphp_pci_config_dn(slot->dn, pci_bus);
-		eeh_add_device(dev);
+		eeh_add_device_late(dev);
 	} else {
 		/* slot is not enabled */
 		err("slot doesn't have pci_dev structure\n");
 		dev = NULL;
-		goto exit;
 	}
 
-      exit:
+exit:
 	dbg("Exit %s: pci_dev %s\n", __FUNCTION__, dev ? "found" : "not found");
 	return dev;
 }
@@ -304,9 +305,9 @@
 	if (slot->hotplug_slot->info->adapter_status == NOT_VALID) {
 		dbg("%s: NOT_VALID: skip dn->full_name=%s\n",
 		    __FUNCTION__, slot->dn->full_name);
-		return (-1);
+		return -1;
 	}
-	return (0);
+	return 0;
 }
 
 static int setup_pci_slot(struct slot *slot)
@@ -317,7 +318,8 @@
 		dealloc_slot_struct(slot);
 		return 1;
 	}
-
+	
+	strcpy(slot->name, pci_name(slot->bridge));
 	/* find slot's pci_dev if it's not empty */
 	if (slot->hotplug_slot->info->adapter_status == EMPTY) {
 		slot->state = EMPTY;	/* slot is empty */
@@ -353,7 +355,7 @@
 	if (setup_pci_slot(slot))
 		goto exit_rc;
 	rc = register_slot(slot);
-      exit_rc:
+exit_rc:
 	if (rc)
 		dealloc_slot_struct(slot);
 	return rc;
@@ -389,7 +391,7 @@
 		slot->state = NOT_VALID;
 		retval = -EINVAL;
 	}
-      exit:
+exit:
 	if (slot->state != NOT_VALID)
 		rpaphp_set_attention_status(slot, LED_ON);
 	else
diff -Nru a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
--- a/drivers/pci/hotplug/rpaphp_slot.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/pci/hotplug/rpaphp_slot.c	Tue Jun 15 22:20:40 2004
@@ -58,13 +58,10 @@
 	sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_location.attr);
 }
 
-/* free up the memory user by a slot */
+/* free up the memory used by a slot */
 static void rpaphp_release_slot(struct hotplug_slot *hotplug_slot)
 {
-	struct slot *slot = hotplug_slot? (struct slot *) hotplug_slot->private:NULL;
-
-	if (slot == NULL)
-		return;
+	struct slot *slot = (struct slot *) hotplug_slot->private;
 
 	dealloc_slot_struct(slot);
 }
@@ -83,54 +80,47 @@
 {
 	struct slot *slot;
 	
-	dbg("Enter alloc_slot_struct(): dn->full_name=%s drc_index=0x%x drc_name=%s\n",
-		dn->full_name, drc_index, drc_name);
-
 	slot = kmalloc(sizeof (struct slot), GFP_KERNEL);
 	if (!slot)
-		return (NULL);
+		goto error_nomem;
 	memset(slot, 0, sizeof (struct slot));
 	slot->hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
-	if (!slot->hotplug_slot) {
-		kfree(slot);
-		return (NULL);
-	}
+	if (!slot->hotplug_slot)
+		goto error_slot;
 	memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot));
 	slot->hotplug_slot->info = kmalloc(sizeof (struct hotplug_slot_info),
 					   GFP_KERNEL);
-	if (!slot->hotplug_slot->info) {
-		kfree(slot->hotplug_slot);
-		kfree(slot);
-		return (NULL);
-	}
+	if (!slot->hotplug_slot->info)
+		goto error_hpslot;
 	memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info));
 	slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL);
-	if (!slot->hotplug_slot->name) {
-		kfree(slot->hotplug_slot->info);
-		kfree(slot->hotplug_slot);
-		kfree(slot);
-		return (NULL);
-	}
+	if (!slot->hotplug_slot->name)
+		goto error_info;
 	slot->location = kmalloc(strlen(drc_name) + 1, GFP_KERNEL);
-	if (!slot->location) {
-		kfree(slot->hotplug_slot->info);
-		kfree(slot->hotplug_slot->name);
-		kfree(slot->hotplug_slot);
-		kfree(slot);
-		return (NULL);
-	}
+	if (!slot->location)
+		goto error_name;
 	slot->name = slot->hotplug_slot->name;
 	slot->dn = dn;
 	slot->index = drc_index;
 	strcpy(slot->location, drc_name);
 	slot->power_domain = power_domain;
-	slot->magic = SLOT_MAGIC;
 	slot->hotplug_slot->private = slot;
 	slot->hotplug_slot->ops = &rpaphp_hotplug_slot_ops;
 	slot->hotplug_slot->release = &rpaphp_release_slot;
-	dbg("Exit alloc_slot_struct(): slot->dn->full_name=%s drc_index=0x%x drc_name=%s\n",
-		slot->dn->full_name, slot->index, slot->name);
-	return (slot);
+	slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
+
+	return slot;
+
+error_name:
+	kfree(slot->hotplug_slot->name);
+error_info:
+	kfree(slot->hotplug_slot->info);
+error_hpslot:
+	kfree(slot->hotplug_slot);
+error_slot:
+	kfree(slot);
+error_nomem:
+	return NULL;
 }
 
 int register_slot(struct slot *slot)
@@ -138,13 +128,15 @@
 	int retval;
 	char *vio_uni_addr = NULL;
 
-	dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", __FUNCTION__, slot->dn->full_name, slot->index, slot->name, slot->power_domain, slot->type);
+	dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n",
+		__FUNCTION__, slot->dn->full_name, slot->index, slot->name,
+		slot->power_domain, slot->type);
 
 	retval = pci_hp_register(slot->hotplug_slot);
 	if (retval) {
 		err("pci_hp_register failed with error %d\n", retval);
 		rpaphp_release_slot(slot->hotplug_slot);
-		return (retval);
+		return retval;
 	}
 	
 	/* create "phy_locatoin" file */
@@ -163,7 +155,7 @@
 		info("Slot [%s](bus_id=%s) registered\n",
 		     slot->name, pci_name(slot->bridge));
 	num_slots++;
-	return (0);
+	return 0;
 }
 
 int rpaphp_get_power_status(struct slot *slot, u8 * value)
diff -Nru a/drivers/pci/hotplug/rpaphp_vio.c b/drivers/pci/hotplug/rpaphp_vio.c
--- a/drivers/pci/hotplug/rpaphp_vio.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/pci/hotplug/rpaphp_vio.c	Tue Jun 15 22:20:42 2004
@@ -94,6 +94,7 @@
 		slot->state = NOT_CONFIGURED;
 	if (setup_vio_hotplug_slot_info(slot))
 		goto exit_rc;
+	strcpy(slot->name, slot->dev.vio_dev->dev.bus_id);
 	info("%s: registered VIO device[name=%s vio_dev=%p]\n",
 		__FUNCTION__, slot->name, slot->dev.vio_dev); 
 	rc = register_slot(slot);
diff -Nru a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
--- a/drivers/pci/hotplug/shpchp.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/pci/hotplug/shpchp.h	Tue Jun 15 22:20:43 2004
@@ -205,7 +205,6 @@
 extern void shpchp_create_ctrl_files	(struct controller *ctrl);
 
 /* controller functions */
-extern void	shpchp_pushbutton_thread(unsigned long event_pointer);
 extern int	shpchprm_find_available_resources(struct controller *ctrl);
 extern int	shpchp_event_start_thread(void);
 extern void	shpchp_event_stop_thread(void);
diff -Nru a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
--- a/drivers/pci/hotplug/shpchp_core.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/pci/hotplug/shpchp_core.c	Tue Jun 15 22:20:36 2004
@@ -29,6 +29,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/proc_fs.h>
@@ -56,9 +57,9 @@
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(shpchp_debug, "i");
-MODULE_PARM(shpchp_poll_mode, "i");
-MODULE_PARM(shpchp_poll_time, "i");
+module_param(shpchp_debug, bool, 644);
+module_param(shpchp_poll_mode, bool, 644);
+module_param(shpchp_poll_time, int, 644);
 MODULE_PARM_DESC(shpchp_debug, "Debugging mode enabled or not");
 MODULE_PARM_DESC(shpchp_poll_mode, "Using polling mechanism for hot-plug events or not");
 MODULE_PARM_DESC(shpchp_poll_time, "Polling mechanism frequency, in seconds");
@@ -69,7 +70,6 @@
 static int set_attention_status (struct hotplug_slot *slot, u8 value);
 static int enable_slot		(struct hotplug_slot *slot);
 static int disable_slot		(struct hotplug_slot *slot);
-static int hardware_test	(struct hotplug_slot *slot, u32 value);
 static int get_power_status	(struct hotplug_slot *slot, u8 *value);
 static int get_attention_status	(struct hotplug_slot *slot, u8 *value);
 static int get_latch_status	(struct hotplug_slot *slot, u8 *value);
@@ -82,22 +82,37 @@
 	.set_attention_status =	set_attention_status,
 	.enable_slot =		enable_slot,
 	.disable_slot =		disable_slot,
-	.hardware_test =	hardware_test,
 	.get_power_status =	get_power_status,
 	.get_attention_status =	get_attention_status,
-	.get_latch_status =		get_latch_status,
+	.get_latch_status =	get_latch_status,
 	.get_adapter_status =	get_adapter_status,
-  	.get_max_bus_speed =	get_max_bus_speed,
-  	.get_cur_bus_speed =	get_cur_bus_speed,
+	.get_max_bus_speed =	get_max_bus_speed,
+	.get_cur_bus_speed =	get_cur_bus_speed,
 };
 
+/**
+ * release_slot - free up the memory used by a slot
+ * @hotplug_slot: slot to free
+ */
+static void release_slot(struct hotplug_slot *hotplug_slot)
+{
+	struct slot *slot = (struct slot *)hotplug_slot->private;
+
+	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+
+	kfree(slot->hotplug_slot->info);
+	kfree(slot->hotplug_slot->name);
+	kfree(slot->hotplug_slot);
+	kfree(slot);
+}
+
 static int init_slots(struct controller *ctrl)
 {
 	struct slot *new_slot;
 	u8 number_of_slots;
 	u8 slot_device;
 	u32 slot_number, sun;
-	int result;
+	int result = -ENOMEM;
 
 	dbg("%s\n",__FUNCTION__);
 
@@ -108,30 +123,21 @@
 	while (number_of_slots) {
 		new_slot = (struct slot *) kmalloc(sizeof(struct slot), GFP_KERNEL);
 		if (!new_slot)
-			return -ENOMEM;
+			goto error;
 
 		memset(new_slot, 0, sizeof(struct slot));
 		new_slot->hotplug_slot = kmalloc (sizeof (struct hotplug_slot), GFP_KERNEL);
-		if (!new_slot->hotplug_slot) {
-			kfree (new_slot);
-			return -ENOMEM;
-		}
+		if (!new_slot->hotplug_slot)
+			goto error_slot;
 		memset(new_slot->hotplug_slot, 0, sizeof (struct hotplug_slot));
 
 		new_slot->hotplug_slot->info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
-		if (!new_slot->hotplug_slot->info) {
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return -ENOMEM;
-		}
+		if (!new_slot->hotplug_slot->info)
+			goto error_hpslot;
 		memset(new_slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info));
 		new_slot->hotplug_slot->name = kmalloc (SLOT_NAME_SIZE, GFP_KERNEL);
-		if (!new_slot->hotplug_slot->name) {
-			kfree (new_slot->hotplug_slot->info);
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return -ENOMEM;
-		}
+		if (!new_slot->hotplug_slot->name)
+			goto error_info;
 
 		new_slot->magic = SLOT_MAGIC;
 		new_slot->ctrl = ctrl;
@@ -139,19 +145,17 @@
 		new_slot->device = slot_device;
 		new_slot->hpc_ops = ctrl->hpc_ops;
 
-		if (shpchprm_get_physical_slot_number(ctrl, &sun, new_slot->bus, new_slot->device)) {
-			kfree (new_slot->hotplug_slot->info);
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return -ENOMEM;
-		}
+		if (shpchprm_get_physical_slot_number(ctrl, &sun,
+					new_slot->bus, new_slot->device))
+			goto error_name;
 
 		new_slot->number = sun;
 		new_slot->hp_slot = slot_device - ctrl->slot_device_offset;
 
 		/* register this slot with the hotplug pci core */
 		new_slot->hotplug_slot->private = new_slot;
-		make_slot_name (new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot);
+		new_slot->hotplug_slot->release = &release_slot;
+		make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot);
 		new_slot->hotplug_slot->ops = &shpchp_hotplug_slot_ops;
 
 		new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status));
@@ -164,11 +168,7 @@
 		result = pci_hp_register (new_slot->hotplug_slot);
 		if (result) {
 			err ("pci_hp_register failed with error %d\n", result);
-			kfree (new_slot->hotplug_slot->info);
-			kfree (new_slot->hotplug_slot->name);
-			kfree (new_slot->hotplug_slot);
-			kfree (new_slot);
-			return result;
+			goto error_name;
 		}
 
 		new_slot->next = ctrl->slot;
@@ -179,11 +179,21 @@
 		slot_number += ctrl->slot_num_inc;
 	}
 
-	return(0);
-}
+	return 0;
 
+error_name:
+	kfree(new_slot->hotplug_slot->name);
+error_info:
+	kfree(new_slot->hotplug_slot->info);
+error_hpslot:
+	kfree(new_slot->hotplug_slot);
+error_slot:
+	kfree(new_slot);
+error:
+	return result;
+}
 
-static int cleanup_slots (struct controller * ctrl)
+static void cleanup_slots(struct controller *ctrl)
 {
 	struct slot *old_slot, *next_slot;
 
@@ -192,16 +202,9 @@
 
 	while (old_slot) {
 		next_slot = old_slot->next;
-		pci_hp_deregister (old_slot->hotplug_slot);
-		kfree(old_slot->hotplug_slot->info);
-		kfree(old_slot->hotplug_slot->name);
-		kfree(old_slot->hotplug_slot);
-		kfree(old_slot);
+		pci_hp_deregister(old_slot->hotplug_slot);
 		old_slot = next_slot;
 	}
-
-
-	return(0);
 }
 
 static int get_ctlr_slot_config(struct controller *ctrl)
@@ -216,7 +219,7 @@
 	rc = shpc_get_ctlr_slot_config(ctrl, &num_ctlr_slots, &first_device_num, &physical_slot_num, &updown, &flags);
 	if (rc) {
 		err("%s: get_ctlr_slot_config fail for b:d (%x:%x)\n", __FUNCTION__, ctrl->bus, ctrl->device);
-		return (-1);
+		return -1;
 	}
 
 	ctrl->num_slots = num_ctlr_slots;
@@ -227,7 +230,7 @@
 	dbg("%s: num_slot(0x%x) 1st_dev(0x%x) psn(0x%x) updown(%d) for b:d (%x:%x)\n",
 		__FUNCTION__, num_ctlr_slots, first_device_num, physical_slot_num, updown, ctrl->bus, ctrl->device);
 
-	return (0);
+	return 0;
 }
 
 
@@ -238,15 +241,11 @@
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
 
-	if (slot == NULL)
-		return -ENODEV;
-	
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	hotplug_slot->info->attention_status = status;
 	slot->hpc_ops->set_attention_status(slot, status);
 
-
 	return 0;
 }
 
@@ -254,9 +253,6 @@
 static int enable_slot (struct hotplug_slot *hotplug_slot)
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	
-	if (slot == NULL)
-		return -ENODEV;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
@@ -267,30 +263,17 @@
 static int disable_slot (struct hotplug_slot *hotplug_slot)
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
-	
-	if (slot == NULL)
-		return -ENODEV;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	return shpchp_disable_slot(slot);
 }
 
-
-static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
-{
-	return 0;
-}
-
-
 static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	retval = slot->hpc_ops->get_power_status(slot, value);
@@ -304,10 +287,7 @@
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	retval = slot->hpc_ops->get_attention_status(slot, value);
@@ -321,10 +301,7 @@
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
-	
+
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	retval = slot->hpc_ops->get_latch_status(slot, value);
@@ -338,14 +315,10 @@
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 
 	retval = slot->hpc_ops->get_adapter_status(slot, value);
-
 	if (retval < 0)
 		*value = hotplug_slot->info->adapter_status;
 
@@ -356,9 +329,6 @@
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 	
@@ -373,9 +343,6 @@
 {
 	struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
 	int retval;
-	
-	if (slot == NULL)
-		return -ENODEV;
 
 	dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
 	
@@ -531,49 +498,35 @@
 	return retval;
 }
 
+static inline void __exit
+free_shpchp_res(struct pci_resource *res)
+{
+	struct pci_resource *tres;
+
+	while (res) {
+		tres = res;
+		res = res->next;
+		kfree(tres);
+	}
+}
 
-static void unload_shpchpd(void)
+static void __exit unload_shpchpd(void)
 {
 	struct pci_func *next;
 	struct pci_func *TempSlot;
 	int loop;
 	struct controller *ctrl;
 	struct controller *tctrl;
-	struct pci_resource *res;
-	struct pci_resource *tres;
 
 	ctrl = shpchp_ctrl_list;
 
 	while (ctrl) {
 		cleanup_slots(ctrl);
 
-		res = ctrl->io_head;
-		while (res) {
-			tres = res;
-			res = res->next;
-			kfree(tres);
-		}
-
-		res = ctrl->mem_head;
-		while (res) {
-			tres = res;
-			res = res->next;
-			kfree(tres);
-		}
-
-		res = ctrl->p_mem_head;
-		while (res) {
-			tres = res;
-			res = res->next;
-			kfree(tres);
-		}
-
-		res = ctrl->bus_head;
-		while (res) {
-			tres = res;
-			res = res->next;
-			kfree(tres);
-		}
+		free_shpchp_res(ctrl->io_head);
+		free_shpchp_res(ctrl->mem_head);
+		free_shpchp_res(ctrl->p_mem_head);
+		free_shpchp_res(ctrl->bus_head);
 
 		kfree (ctrl->pci_bus);
 
@@ -589,33 +542,10 @@
 	for (loop = 0; loop < 256; loop++) {
 		next = shpchp_slot_list[loop];
 		while (next != NULL) {
-			res = next->io_head;
-			while (res) {
-				tres = res;
-				res = res->next;
-				kfree(tres);
-			}
-
-			res = next->mem_head;
-			while (res) {
-				tres = res;
-				res = res->next;
-				kfree(tres);
-			}
-
-			res = next->p_mem_head;
-			while (res) {
-				tres = res;
-				res = res->next;
-				kfree(tres);
-			}
-
-			res = next->bus_head;
-			while (res) {
-				tres = res;
-				res = res->next;
-				kfree(tres);
-			}
+			free_shpchp_res(next->io_head);
+			free_shpchp_res(next->mem_head);
+			free_shpchp_res(next->p_mem_head);
+			free_shpchp_res(next->bus_head);
 
 			TempSlot = next;
 			next = next->next;
@@ -697,8 +627,5 @@
 	info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
 }
 
-
 module_init(shpcd_init);
 module_exit(shpcd_cleanup);
-
-
diff -Nru a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
--- a/drivers/pci/hotplug/shpchp_ctrl.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/pci/hotplug/shpchp_ctrl.c	Tue Jun 15 22:21:03 2004
@@ -396,7 +396,7 @@
 		/* This one isn't an aligned length, so we'll make a new entry
 		 * and split it up.
 		 */
-		split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+		split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 		if (!split_node)
 			return(NULL);
@@ -530,7 +530,7 @@
 			if ((node->length - (temp_dword - node->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
 				return(NULL);
@@ -549,7 +549,7 @@
 		if (node->length > size) {
 			/* This one is longer than we need
 			   so we'll make a new entry and split it up */
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
 				return(NULL);
@@ -630,7 +630,7 @@
 			if ((max->length - (temp_dword - max->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
 				return(NULL);
@@ -648,7 +648,7 @@
 		if ((max->base + max->length) & (size - 1)) {
 			/* This one isn't end aligned properly at the top
 			   so we'll make a new entry and split it up */
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
 				return(NULL);
@@ -669,7 +669,8 @@
 
 		for ( i = 0; max_size[i] > size; i++) {
 			if (max->length > max_size[i]) {
-				split_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				split_node = kmalloc(sizeof(*split_node),
+							GFP_KERNEL);
 				if (!split_node)
 					break;	/* return (NULL); */
 				split_node->base = max->base + max_size[i];
@@ -744,7 +745,7 @@
 			if ((node->length - (temp_dword - node->base)) < size)
 				continue;
 
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
 				return(NULL);
@@ -764,7 +765,7 @@
 			dbg("%s: too big\n", __FUNCTION__);
 			/* this one is longer than we need
 			   so we'll make a new entry and split it up */
-			split_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			split_node = kmalloc(sizeof(*split_node), GFP_KERNEL);
 
 			if (!split_node)
 				return(NULL);
@@ -882,7 +883,7 @@
 	struct pci_func *new_slot;
 	struct pci_func *next;
 
-	new_slot = (struct pci_func *) kmalloc(sizeof(struct pci_func), GFP_KERNEL);
+	new_slot = kmalloc(sizeof(*new_slot), GFP_KERNEL);
 
 	if (new_slot == NULL) {
 		return(new_slot);
@@ -1572,7 +1573,7 @@
 
 			retval = p_slot->hpc_ops->check_cmd_status(ctrl);
 			if (retval) {
-				err("%s: Failed to disable slot, error code(%d)\n", __FUNCTION__, rc);
+				err("%s: Failed to disable slot, error code(%d)\n", __FUNCTION__, retval);
 				/* Done with exclusive hardware access */
 				up(&ctrl->crit_sect);
 				return retval;  
@@ -1795,6 +1796,81 @@
 }
 
 
+/**
+ * shpchp_pushbutton_thread
+ *
+ * Scheduled procedure to handle blocking stuff for the pushbuttons
+ * Handles all pending events and exits.
+ *
+ */
+static void shpchp_pushbutton_thread (unsigned long slot)
+{
+	struct slot *p_slot = (struct slot *) slot;
+	u8 getstatus;
+	int rc;
+	
+	pushbutton_pending = 0;
+
+	if (!p_slot) {
+		dbg("%s: Error! slot NULL\n", __FUNCTION__);
+		return;
+	}
+
+	p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
+	if (getstatus) {
+		p_slot->state = POWEROFF_STATE;
+		dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
+
+		if (shpchp_disable_slot(p_slot)) {
+			/* Wait for exclusive access to hardware */
+			down(&p_slot->ctrl->crit_sect);
+
+			/* Turn on the Attention LED */
+			rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
+			if (rc) {
+				err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
+				return;
+			}
+	
+			/* Wait for the command to complete */
+			wait_for_ctrl_irq (p_slot->ctrl);
+
+			/* Done with exclusive hardware access */
+			up(&p_slot->ctrl->crit_sect);
+		}
+		p_slot->state = STATIC_STATE;
+	} else {
+		p_slot->state = POWERON_STATE;
+		dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
+
+		if (shpchp_enable_slot(p_slot)) {
+			/* Wait for exclusive access to hardware */
+			down(&p_slot->ctrl->crit_sect);
+
+			/* Turn off the green LED */
+			rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
+			if (rc) {
+				err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
+				return;
+			}
+			/* Wait for the command to complete */
+			wait_for_ctrl_irq (p_slot->ctrl);
+			
+			p_slot->hpc_ops->green_led_off(p_slot);
+
+			/* Wait for the command to complete */
+			wait_for_ctrl_irq (p_slot->ctrl);
+
+			/* Done with exclusive hardware access */
+			up(&p_slot->ctrl->crit_sect);
+		}
+		p_slot->state = STATIC_STATE;
+	}
+
+	return;
+}
+
+
 /* this is the main worker thread */
 static int event_thread(void* data)
 {
@@ -1856,7 +1932,7 @@
 	struct hotplug_slot_info *info;
 	int result;
 
-	info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
+	info = kmalloc(sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
@@ -2011,81 +2087,6 @@
 }
 
 
-/**
- * shpchp_pushbutton_thread
- *
- * Scheduled procedure to handle blocking stuff for the pushbuttons
- * Handles all pending events and exits.
- *
- */
-void shpchp_pushbutton_thread (unsigned long slot)
-{
-	struct slot *p_slot = (struct slot *) slot;
-	u8 getstatus;
-	int rc;
-	
-	pushbutton_pending = 0;
-
-	if (!p_slot) {
-		dbg("%s: Error! slot NULL\n", __FUNCTION__);
-		return;
-	}
-
-	p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
-	if (getstatus) {
-		p_slot->state = POWEROFF_STATE;
-		dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
-
-		if (shpchp_disable_slot(p_slot)) {
-			/* Wait for exclusive access to hardware */
-			down(&p_slot->ctrl->crit_sect);
-
-			/* Turn on the Attention LED */
-			rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
-			if (rc) {
-				err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
-				return;
-			}
-	
-			/* Wait for the command to complete */
-			wait_for_ctrl_irq (p_slot->ctrl);
-
-			/* Done with exclusive hardware access */
-			up(&p_slot->ctrl->crit_sect);
-		}
-		p_slot->state = STATIC_STATE;
-	} else {
-		p_slot->state = POWERON_STATE;
-		dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);
-
-		if (shpchp_enable_slot(p_slot)) {
-			/* Wait for exclusive access to hardware */
-			down(&p_slot->ctrl->crit_sect);
-
-			/* Turn off the green LED */
-			rc = p_slot->hpc_ops->set_attention_status(p_slot, 1);
-			if (rc) {
-				err("%s: Issue of Set Atten Indicator On command failed\n", __FUNCTION__);
-				return;
-			}
-			/* Wait for the command to complete */
-			wait_for_ctrl_irq (p_slot->ctrl);
-			
-			p_slot->hpc_ops->green_led_off(p_slot);
-
-			/* Wait for the command to complete */
-			wait_for_ctrl_irq (p_slot->ctrl);
-
-			/* Done with exclusive hardware access */
-			up(&p_slot->ctrl->crit_sect);
-		}
-		p_slot->state = STATIC_STATE;
-	}
-
-	return;
-}
-
-
 int shpchp_enable_slot (struct slot *p_slot)
 {
 	u8 getstatus = 0;
@@ -2504,22 +2505,18 @@
 		/* Make copies of the nodes we are going to pass down so that
 		 * if there is a problem,we can just use these to free resources
 		 */
-		hold_bus_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_IO_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
-		hold_p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+		hold_bus_node = kmalloc(sizeof(*hold_bus_node), GFP_KERNEL);
+		hold_IO_node = kmalloc(sizeof(*hold_IO_node), GFP_KERNEL);
+		hold_mem_node = kmalloc(sizeof(*hold_mem_node), GFP_KERNEL);
+		hold_p_mem_node = kmalloc(sizeof(*hold_p_mem_node), GFP_KERNEL);
 
 		if (!hold_bus_node || !hold_IO_node || !hold_mem_node || !hold_p_mem_node) {
-			if (hold_bus_node)
-				kfree(hold_bus_node);
-			if (hold_IO_node)
-				kfree(hold_IO_node);
-			if (hold_mem_node)
-				kfree(hold_mem_node);
-			if (hold_p_mem_node)
-				kfree(hold_p_mem_node);
+			kfree(hold_bus_node);
+			kfree(hold_IO_node);
+			kfree(hold_mem_node);
+			kfree(hold_p_mem_node);
 
-			return(1);
+			return 1;
 		}
 
 		memcpy(hold_bus_node, bus_node, sizeof(struct pci_resource));
@@ -2538,11 +2535,11 @@
 			/* set IO base and Limit registers */
 			RES_CHECK(io_node->base, 8);
 			temp_byte = (u8)(io_node->base >> 8);
-			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_BASE, temp_byte);
+			rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_BASE, temp_byte);
 
 			RES_CHECK(io_node->base + io_node->length - 1, 8);
 			temp_byte = (u8)((io_node->base + io_node->length - 1) >> 8);
-			rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
+			rc = pci_bus_write_config_byte(pci_bus, devfn, PCI_IO_LIMIT, temp_byte);
 		} else {
 			kfree(hold_IO_node);
 			hold_IO_node = NULL;
@@ -2559,17 +2556,17 @@
 			/* set Mem base and Limit registers */
 			RES_CHECK(mem_node->base, 16);
 			temp_word = (u32)(mem_node->base >> 16);
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
 
 			RES_CHECK(mem_node->base + mem_node->length - 1, 16);
 			temp_word = (u32)((mem_node->base + mem_node->length - 1) >> 16);
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
 		} else {
 			temp_word = 0xFFFF;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_BASE, temp_word);
 
 			temp_word = 0x0000;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, temp_word);
 
 			kfree(hold_mem_node);
 			hold_mem_node = NULL;
@@ -2586,17 +2583,17 @@
 			/* set Pre Mem base and Limit registers */
 			RES_CHECK(p_mem_node->base, 16);
 			temp_word = (u32)(p_mem_node->base >> 16);
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
 
 			RES_CHECK(p_mem_node->base + p_mem_node->length - 1, 16);
 			temp_word = (u32)((p_mem_node->base + p_mem_node->length - 1) >> 16);
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
 		} else {
 			temp_word = 0xFFFF;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, temp_word);
 
 			temp_word = 0x0000;
-			rc = pci_bus_write_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
+			rc = pci_bus_write_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, temp_word);
 
 			kfree(hold_p_mem_node);
 			hold_p_mem_node = NULL;
@@ -2613,7 +2610,8 @@
 
 			ID = 0xFFFFFFFF;
 			pci_bus->number = hold_bus_node->base;
-			pci_bus_read_config_dword (pci_bus, PCI_DEVFN(device, 0), PCI_VENDOR_ID, &ID);
+			pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0),
+					PCI_VENDOR_ID, &ID);
 			pci_bus->number = func->bus;
 
 			if (ID != 0xFFFFFFFF) {	  /*  device Present */
diff -Nru a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c
--- a/drivers/pci/hotplug/shpchp_pci.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pci/hotplug/shpchp_pci.c	Tue Jun 15 22:20:41 2004
@@ -53,10 +53,11 @@
 	/* Still NULL ? Well then scan for it ! */
 	if (func->pci_dev == NULL) {
 		num = pci_scan_slot(ctrl->pci_dev->subordinate, PCI_DEVFN(func->device, func->function));
-		if (num)
+		if (num) {
 			dbg("%s: subordiante %p number %x\n", __FUNCTION__, ctrl->pci_dev->subordinate,
 				ctrl->pci_dev->subordinate->number);
-			pci_bus_add_devices(ctrl->pci_dev->subordinate);		
+			pci_bus_add_devices(ctrl->pci_dev->subordinate);
+		}
 		
 		func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function));
 		if (func->pci_dev == NULL) {
@@ -67,7 +68,7 @@
 
 	if (func->pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
 		pci_read_config_byte(func->pci_dev, PCI_SECONDARY_BUS, &bus);
-		child = (struct pci_bus*) pci_add_new_bus(func->pci_dev->bus, (func->pci_dev), bus);
+		child = pci_add_new_bus(func->pci_dev->bus, (func->pci_dev), bus);
 		pci_do_scan_bus(child);
 
 	}
@@ -81,10 +82,12 @@
 	int rc = 0;
 	int j;
 	
-	dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus, func->device, func->function);
+	dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus,
+				func->device, func->function);
 
 	for (j=0; j<8 ; j++) {
-		struct pci_dev* temp = pci_find_slot(func->bus, (func->device << 3) | j);
+		struct pci_dev* temp = pci_find_slot(func->bus,
+				(func->device << 3) | j);
 		if (temp) {
 			pci_remove_bus_device(temp);
 		}
@@ -163,12 +166,14 @@
 	int is_hot_plug = num_ctlr_slots || first_device_num;
 	struct pci_bus lpci_bus, *pci_bus;
 
-	dbg("%s: num_ctlr_slots = %d, first_device_num = %d\n", __FUNCTION__, num_ctlr_slots, first_device_num);
+	dbg("%s: num_ctlr_slots = %d, first_device_num = %d\n", __FUNCTION__,
+				num_ctlr_slots, first_device_num);
 
 	memcpy(&lpci_bus, ctrl->pci_dev->subordinate, sizeof(lpci_bus));
 	pci_bus = &lpci_bus;
 
-	dbg("%s: num_ctlr_slots = %d, first_device_num = %d\n", __FUNCTION__, num_ctlr_slots, first_device_num);
+	dbg("%s: num_ctlr_slots = %d, first_device_num = %d\n", __FUNCTION__,
+				num_ctlr_slots, first_device_num);
 
 	/*   Decide which slots are supported */
 	if (is_hot_plug) {
@@ -182,20 +187,24 @@
 		LastSupported = 0x1F;
 	}
 
-	dbg("FirstSupported = %d, LastSupported = %d\n", FirstSupported, LastSupported);
+	dbg("FirstSupported = %d, LastSupported = %d\n", FirstSupported,
+					LastSupported);
 
 	/*   Save PCI configuration space for all devices in supported slots */
 	pci_bus->number = busnumber;
 	for (device = FirstSupported; device <= LastSupported; device++) {
 		ID = 0xFFFFFFFF;
-		rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0), PCI_VENDOR_ID, &ID);
+		rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0),
+					PCI_VENDOR_ID, &ID);
 
 		if (ID != 0xFFFFFFFF) {	  /*  device in slot */
-			rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0), 0x0B, &class_code);
+			rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0),
+					0x0B, &class_code);
 			if (rc)
 				return rc;
 
-			rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0), PCI_HEADER_TYPE, &header_type);
+			rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, 0),
+					PCI_HEADER_TYPE, &header_type);
 			if (rc)
 				return rc;
 
@@ -216,7 +225,8 @@
 					/* Recurse the subordinate bus
 					 * get the subordinate bus number
 					 */
-					rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, function), 
+					rc = pci_bus_read_config_byte(pci_bus,
+						PCI_DEVFN(device, function), 
 						PCI_SECONDARY_BUS, &secondary_bus);
 					if (rc) {
 						return rc;
@@ -255,13 +265,17 @@
 				new_slot->switch_save = 0x10;
 				/* In case of unsupported board */
 				new_slot->status = DevError;
-				new_slot->pci_dev = pci_find_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function);
+				new_slot->pci_dev = pci_find_slot(new_slot->bus,
+					(new_slot->device << 3) | new_slot->function);
 				dbg("new_slot->pci_dev = %p\n", new_slot->pci_dev);
 
 				for (cloop = 0; cloop < 0x20; cloop++) {
-					rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, function), 
-						cloop << 2, (u32 *) & (new_slot->config_space [cloop]));
-					/* dbg("new_slot->config_space[%x] = %x\n", cloop, new_slot->config_space[cloop]); */
+					rc = pci_bus_read_config_dword(pci_bus,
+						PCI_DEVFN(device, function), 
+						cloop << 2,
+						(u32 *) &(new_slot->config_space [cloop]));
+					/* dbg("new_slot->config_space[%x] = %x\n",
+						cloop, new_slot->config_space[cloop]); */
 					if (rc)
 						return rc;
 				}
@@ -275,23 +289,28 @@
 				 */
 
 				while ((function < max_functions)&&(!stop_it)) {
-					rc = pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, function), PCI_VENDOR_ID, &ID);
+					rc = pci_bus_read_config_dword(pci_bus,
+						PCI_DEVFN(device, function),
+						PCI_VENDOR_ID, &ID);
 
 					if (ID == 0xFFFFFFFF) {  /* nothing there. */
 						function++;
 						dbg("Nothing there\n");
 					} else {  /* Something there */
-						rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, function), 
+						rc = pci_bus_read_config_byte(pci_bus,
+							PCI_DEVFN(device, function), 
 							0x0B, &class_code);
 						if (rc)
 							return rc;
 
-						rc = pci_bus_read_config_byte(pci_bus, PCI_DEVFN(device, function), 
+						rc = pci_bus_read_config_byte(pci_bus,
+							PCI_DEVFN(device, function), 
 							PCI_HEADER_TYPE, &header_type);
 						if (rc)
 							return rc;
 
-						dbg("class_code = %x, header_type = %x\n", class_code, header_type);
+						dbg("class_code = %x, header_type = %x\n",
+							class_code, header_type);
 						stop_it++;
 					}
 				}
@@ -328,7 +347,7 @@
  *
  * returns 0 if success
  */
-int shpchp_save_slot_config (struct controller *ctrl, struct pci_func * new_slot)
+int shpchp_save_slot_config(struct controller *ctrl, struct pci_func * new_slot)
 {
 	int rc;
 	u8 class_code;
@@ -347,12 +366,15 @@
 
 	ID = 0xFFFFFFFF;
 
-	pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_VENDOR_ID, &ID);
+	pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, 0),
+					PCI_VENDOR_ID, &ID);
 
 	if (ID != 0xFFFFFFFF) {	  /*  device in slot */
-		pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0), 0x0B, &class_code);
+		pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0),
+					0x0B, &class_code);
 
-		pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0), PCI_HEADER_TYPE, &header_type);
+		pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, 0),
+					PCI_HEADER_TYPE, &header_type);
 
 		if (header_type & 0x80)	/* Multi-function device */
 			max_functions = 8;
@@ -364,7 +386,8 @@
 		do {
 			if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {	  /* PCI-PCI Bridge */
 				/*  Recurse the subordinate bus */
-				pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, function), 
+				pci_bus_read_config_byte(pci_bus,
+					PCI_DEVFN(new_slot->device, function), 
 					PCI_SECONDARY_BUS, &secondary_bus);
 
 				sub_bus = (int) secondary_bus;
@@ -373,15 +396,17 @@
 				rc = shpchp_save_config(ctrl, sub_bus, 0, 0);
 
 				if (rc)
-					return(rc);
+					return rc;
 
 			}	/* End of IF */
 
 			new_slot->status = 0;
 
 			for (cloop = 0; cloop < 0x20; cloop++) {
-				pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, function), 
-					cloop << 2, (u32 *) & (new_slot->config_space [cloop]));
+				pci_bus_read_config_dword(pci_bus,
+					PCI_DEVFN(new_slot->device, function), 
+					cloop << 2,
+					(u32 *) &(new_slot->config_space [cloop]));
 			}
 
 			function++;
@@ -393,15 +418,20 @@
 			 */
 
 			while ((function < max_functions) && (!stop_it)) {
-				pci_bus_read_config_dword(pci_bus, PCI_DEVFN(new_slot->device, function), PCI_VENDOR_ID, &ID);
+				pci_bus_read_config_dword(pci_bus,
+					PCI_DEVFN(new_slot->device, function),
+					PCI_VENDOR_ID, &ID);
 
 				if (ID == 0xFFFFFFFF) {	 /* nothing there. */
 					function++;
 				} else {  /* Something there */
-					pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, function), 0x0B, &class_code);
-
-					pci_bus_read_config_byte(pci_bus, PCI_DEVFN(new_slot->device, function), PCI_HEADER_TYPE, 
-						&header_type);
+					pci_bus_read_config_byte(pci_bus,
+						PCI_DEVFN(new_slot->device, function),
+						0x0B, &class_code);
+
+					pci_bus_read_config_byte(pci_bus,
+						PCI_DEVFN(new_slot->device, function),
+						PCI_HEADER_TYPE, &header_type);
 
 					stop_it++;
 				}
@@ -410,10 +440,10 @@
 		} while (function < max_functions);
 	}			/* End of IF (device in slot?) */
 	else {
-		return(2);
+		return 2;
 	}
 
-	return(0);
+	return 0;
 }
 
 
@@ -429,7 +459,7 @@
  *  it loops for all functions of the slot and disables them.
  * else, it just get resources of the function and return.
  */
-int shpchp_save_used_resources (struct controller *ctrl, struct pci_func *func, int disable)
+int shpchp_save_used_resources(struct controller *ctrl, struct pci_func *func, int disable)
 {
 	u8 cloop;
 	u8 header_type;
@@ -461,7 +491,7 @@
 		devfn = PCI_DEVFN(func->device, func->function);
 
 		/* Save the command register */
-		pci_bus_read_config_word (pci_bus, devfn, PCI_COMMAND, &save_command);
+		pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &save_command);
 
 		if (disable) {
 			/* disable card */
@@ -470,20 +500,22 @@
 		}
 
 		/* Check for Bridge */
-		pci_bus_read_config_byte (pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
+		pci_bus_read_config_byte(pci_bus, devfn, PCI_HEADER_TYPE, &header_type);
 
 		if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {     /* PCI-PCI Bridge */
-			dbg("Save_used_res of PCI bridge b:d=0x%x:%x, sc=0x%x\n", func->bus, func->device, save_command);
+			dbg("Save_used_res of PCI bridge b:d=0x%x:%x, sc=0x%x\n",
+					func->bus, func->device, save_command);
 			if (disable) {
 				/* Clear Bridge Control Register */
 				command = 0x00;
 				pci_bus_write_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, command);
 			}
 
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_SECONDARY_BUS, &secondary_bus);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_SUBORDINATE_BUS, &temp_byte);
 
-			bus_node =(struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+			bus_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 			if (!bus_node)
 				return -ENOMEM;
 
@@ -494,13 +526,14 @@
 			func->bus_head = bus_node;
 
 			/* Save IO base and Limit registers */
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_IO_BASE, &temp_byte);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_BASE, &temp_byte);
 			base = temp_byte;
-			pci_bus_read_config_byte (pci_bus, devfn, PCI_IO_LIMIT, &temp_byte);
+			pci_bus_read_config_byte(pci_bus, devfn, PCI_IO_LIMIT, &temp_byte);
 			length = temp_byte;
 
 			if ((base <= length) && (!disable || (save_command & PCI_COMMAND_IO))) {
-				io_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				io_node = kmalloc(sizeof(struct pci_resource),
+							GFP_KERNEL);
 				if (!io_node)
 					return -ENOMEM;
 
@@ -512,11 +545,12 @@
 			}
 
 			/* Save memory base and Limit registers */
-			pci_bus_read_config_word (pci_bus, devfn, PCI_MEMORY_BASE, &w_base);
-			pci_bus_read_config_word (pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_BASE, &w_base);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_MEMORY_LIMIT, &w_length);
 
 			if ((w_base <= w_length) && (!disable || (save_command & PCI_COMMAND_MEMORY))) {
-				mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				mem_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 				if (!mem_node)
 					return -ENOMEM;
 
@@ -527,11 +561,12 @@
 				func->mem_head = mem_node;
 			}
 			/* Save prefetchable memory base and Limit registers */
-			pci_bus_read_config_word (pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);
-			pci_bus_read_config_word (pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_BASE, &w_base);
+			pci_bus_read_config_word(pci_bus, devfn, PCI_PREF_MEMORY_LIMIT, &w_length);
 
 			if ((w_base <= w_length) && (!disable || (save_command & PCI_COMMAND_MEMORY))) {
-				p_mem_node = (struct pci_resource *) kmalloc(sizeof(struct pci_resource), GFP_KERNEL);
+				p_mem_node = kmalloc(sizeof(struct pci_resource),
+						GFP_KERNEL);
 				if (!p_mem_node)
 					return -ENOMEM;
 
@@ -542,38 +577,41 @@
 				func->p_mem_head = p_mem_node;
 			}
 		} else if ((header_type & 0x7F) == PCI_HEADER_TYPE_NORMAL) {
-			dbg("Save_used_res of PCI adapter b:d=0x%x:%x, sc=0x%x\n", func->bus, func->device, save_command);
+			dbg("Save_used_res of PCI adapter b:d=0x%x:%x, sc=0x%x\n",
+					func->bus, func->device, save_command);
 
 			/* Figure out IO and memory base lengths */
 			for (cloop = PCI_BASE_ADDRESS_0; cloop <= PCI_BASE_ADDRESS_5; cloop += 4) {
-				pci_bus_read_config_dword (pci_bus, devfn, cloop, &save_base);
+				pci_bus_read_config_dword(pci_bus, devfn, cloop, &save_base);
 
 				temp_register = 0xFFFFFFFF;
-				pci_bus_write_config_dword (pci_bus, devfn, cloop, temp_register);
-				pci_bus_read_config_dword (pci_bus, devfn, cloop, &temp_register);
+				pci_bus_write_config_dword(pci_bus, devfn, cloop, temp_register);
+				pci_bus_read_config_dword(pci_bus, devfn, cloop, &temp_register);
 
-				if (!disable) {
-					pci_bus_write_config_dword (pci_bus, devfn, cloop, save_base);
-				}
+				if (!disable)
+					pci_bus_write_config_dword(pci_bus, devfn, cloop, save_base);
 
 				if (!temp_register)
 					continue;
 
 				base = temp_register;
 
-				if ((base & PCI_BASE_ADDRESS_SPACE_IO) && (!disable || (save_command & PCI_COMMAND_IO))) {
+				if ((base & PCI_BASE_ADDRESS_SPACE_IO) &&
+						(!disable || (save_command & PCI_COMMAND_IO))) {
 					/* IO base */
 					/* set temp_register = amount of IO space requested */
 					base = base & 0xFFFFFFFCL;
 					base = (~base) + 1;
 
-					io_node = (struct pci_resource *) kmalloc(sizeof (struct pci_resource), GFP_KERNEL);
+					io_node =  kmalloc(sizeof (struct pci_resource),
+								GFP_KERNEL);
 					if (!io_node)
 						return -ENOMEM;
 
 					io_node->base = (ulong)save_base & PCI_BASE_ADDRESS_IO_MASK;
 					io_node->length = (ulong)base;
-					dbg("sur adapter: IO bar=0x%x(length=0x%x)\n", io_node->base, io_node->length);
+					dbg("sur adapter: IO bar=0x%x(length=0x%x)\n",
+						io_node->base, io_node->length);
 
 					io_node->next = func->io_head;
 					func->io_head = io_node;
@@ -583,11 +621,13 @@
 					char *res_type_str = "PMEM";
 					u32 temp_register2;
 
-					t_mem_node = (struct pci_resource *) kmalloc(sizeof (struct pci_resource), GFP_KERNEL);
+					t_mem_node = kmalloc(sizeof (struct pci_resource),
+								GFP_KERNEL);
 					if (!t_mem_node)
 						return -ENOMEM;
 
-					if (!(base & PCI_BASE_ADDRESS_MEM_PREFETCH) && (!disable || (save_command & PCI_COMMAND_MEMORY))) {
+					if (!(base & PCI_BASE_ADDRESS_MEM_PREFETCH) &&
+							(!disable || (save_command & PCI_COMMAND_MEMORY))) {
 						prefetchable = 0;
 						mem_node = t_mem_node;
 						res_type_str++;
@@ -602,16 +642,20 @@
 						if (prefetchable) {
 							p_mem_node->base = (ulong)save_base & PCI_BASE_ADDRESS_MEM_MASK;
 							p_mem_node->length = (ulong)base;
-							dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n", res_type_str, 
-								p_mem_node->base, p_mem_node->length);
+							dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n",
+								res_type_str, 
+								p_mem_node->base,
+								p_mem_node->length);
 
 							p_mem_node->next = func->p_mem_head;
 							func->p_mem_head = p_mem_node;
 						} else {
 							mem_node->base = (ulong)save_base & PCI_BASE_ADDRESS_MEM_MASK;
 							mem_node->length = (ulong)base;
-							dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n", res_type_str, 
-								mem_node->base, mem_node->length);
+							dbg("sur adapter: 32 %s bar=0x%x(length=0x%x)\n",
+								res_type_str, 
+								mem_node->base,
+								mem_node->length);
 
 							mem_node->next = func->mem_head;
 							func->mem_head = mem_node;
@@ -631,16 +675,20 @@
 						if (prefetchable) {
 							p_mem_node->base = base64 & PCI_BASE_ADDRESS_MEM_MASK;
 							p_mem_node->length = base;
-							dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n", res_type_str, 
-								p_mem_node->base, p_mem_node->length);
+							dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n",
+								res_type_str, 
+								p_mem_node->base,
+								p_mem_node->length);
 
 							p_mem_node->next = func->p_mem_head;
 							func->p_mem_head = p_mem_node;
 						} else {
 							mem_node->base = base64 & PCI_BASE_ADDRESS_MEM_MASK;
 							mem_node->length = base;
-							dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n", res_type_str, 
-								mem_node->base, mem_node->length);
+							dbg("sur adapter: 64 %s base=0x%x(len=0x%x)\n",
+								res_type_str, 
+								mem_node->base,
+								mem_node->length);
 
 							mem_node->next = func->mem_head;
 							func->mem_head = mem_node;
@@ -648,13 +696,15 @@
 						cloop += 4;
 						break;
 					default:
-						dbg("asur: reserved BAR type=0x%x\n", temp_register);
+						dbg("asur: reserved BAR type=0x%x\n",
+							temp_register);
 						break;
 					}
 				} 
 			}	/* End of base register loop */
 		} else {	/* Some other unknown header type */
-			dbg("Save_used_res of PCI unknown type b:d=0x%x:%x. skip.\n", func->bus, func->device);
+			dbg("Save_used_res of PCI unknown type b:d=0x%x:%x. skip.\n",
+					func->bus, func->device);
 		}
 
 		/* find the next device in this slot */
@@ -663,9 +713,27 @@
 		func = shpchp_slot_find(func->bus, func->device, index++);
 	}
 
-	return(0);
+	return 0;
 }
 
+/**
+ * kfree_resource_list: release memory of all list members
+ * @res: resource list to free
+ */
+static inline void
+return_resource_list(struct pci_resource **func, struct pci_resource **res)
+{
+	struct pci_resource *node;
+	struct pci_resource *t_node;
+
+	node = *func;
+	*func = NULL;
+	while (node) {
+		t_node = node->next;
+		return_resource(res, node);
+		node = t_node;
+	}
+}
 
 /*
  * shpchp_return_board_resources
@@ -675,95 +743,39 @@
  *
  * returns 0 if success
  */
-int shpchp_return_board_resources(struct pci_func * func, struct resource_lists * resources)
+int shpchp_return_board_resources(struct pci_func * func,
+					struct resource_lists * resources)
 {
-	int rc = 0;
-	struct pci_resource *node;
-	struct pci_resource *t_node;
+	int rc;
 	dbg("%s\n", __FUNCTION__);
 
 	if (!func)
-		return(1);
-
-	node = func->io_head;
-	func->io_head = NULL;
-	while (node) {
-		t_node = node->next;
-		return_resource(&(resources->io_head), node);
-		node = t_node;
-	}
+		return 1;
 
-	node = func->mem_head;
-	func->mem_head = NULL;
-	while (node) {
-		t_node = node->next;
-		return_resource(&(resources->mem_head), node);
-		node = t_node;
-	}
+	return_resource_list(&(func->io_head),&(resources->io_head));
+	return_resource_list(&(func->mem_head),&(resources->mem_head));
+	return_resource_list(&(func->p_mem_head),&(resources->p_mem_head));
+	return_resource_list(&(func->bus_head),&(resources->bus_head));
 
-	node = func->p_mem_head;
-	func->p_mem_head = NULL;
-	while (node) {
-		t_node = node->next;
-		return_resource(&(resources->p_mem_head), node);
-		node = t_node;
-	}
-
-	node = func->bus_head;
-	func->bus_head = NULL;
-	while (node) {
-		t_node = node->next;
-		return_resource(&(resources->bus_head), node);
-		node = t_node;
-	}
-
-	rc |= shpchp_resource_sort_and_combine(&(resources->mem_head));
+	rc = shpchp_resource_sort_and_combine(&(resources->mem_head));
 	rc |= shpchp_resource_sort_and_combine(&(resources->p_mem_head));
 	rc |= shpchp_resource_sort_and_combine(&(resources->io_head));
 	rc |= shpchp_resource_sort_and_combine(&(resources->bus_head));
 
-	return(rc);
+	return rc;
 }
 
-
-/*
- * shpchp_destroy_resource_list
- *
- * Puts node back in the resource list pointed to by head
+/**
+ * kfree_resource_list: release memory of all list members
+ * @res: resource list to free
  */
-void shpchp_destroy_resource_list (struct resource_lists * resources)
+static inline void
+kfree_resource_list(struct pci_resource **r)
 {
 	struct pci_resource *res, *tres;
 
-	res = resources->io_head;
-	resources->io_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = resources->mem_head;
-	resources->mem_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = resources->p_mem_head;
-	resources->p_mem_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = resources->bus_head;
-	resources->bus_head = NULL;
+	res = *r;
+	*r = NULL;
 
 	while (res) {
 		tres = res;
@@ -772,50 +784,26 @@
 	}
 }
 
-
-/*
- * shpchp_destroy_board_resources
- *
- * Puts node back in the resource list pointed to by head
+/**
+ * shpchp_destroy_resource_list: put node back in the resource list
+ * @resources: list to put nodes back
  */
-void shpchp_destroy_board_resources (struct pci_func * func)
+void shpchp_destroy_resource_list(struct resource_lists *resources)
 {
-	struct pci_resource *res, *tres;
-
-	res = func->io_head;
-	func->io_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = func->mem_head;
-	func->mem_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = func->p_mem_head;
-	func->p_mem_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
-
-	res = func->bus_head;
-	func->bus_head = NULL;
-
-	while (res) {
-		tres = res;
-		res = res->next;
-		kfree(tres);
-	}
+	kfree_resource_list(&(resources->io_head));
+	kfree_resource_list(&(resources->mem_head));
+	kfree_resource_list(&(resources->p_mem_head));
+	kfree_resource_list(&(resources->bus_head));
 }
 
+/**
+ * shpchp_destroy_board_resources: put node back in the resource list
+ * @resources: list to put nodes back
+ */
+void shpchp_destroy_board_resources(struct pci_func * func)
+{
+	kfree_resource_list(&(func->io_head));
+	kfree_resource_list(&(func->mem_head));
+	kfree_resource_list(&(func->p_mem_head));
+	kfree_resource_list(&(func->bus_head));
+}
diff -Nru a/drivers/pci/hotplug/shpchprm.h b/drivers/pci/hotplug/shpchprm.h
--- a/drivers/pci/hotplug/shpchprm.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/pci/hotplug/shpchprm.h	Tue Jun 15 22:20:37 2004
@@ -39,7 +39,6 @@
 int shpchprm_init(enum php_ctlr_type ct);
 void shpchprm_cleanup(void);
 int shpchprm_print_pirt(void);
-void *shpchprm_get_slot(struct slot *slot);
 int shpchprm_find_available_resources(struct controller *ctrl);
 int shpchprm_set_hpp(struct controller *ctrl, struct pci_func *func, u8 card_type);
 void shpchprm_enable_card(struct controller *ctrl, struct pci_func *func, u8 card_type);
diff -Nru a/drivers/pci/hotplug/shpchprm_acpi.c b/drivers/pci/hotplug/shpchprm_acpi.c
--- a/drivers/pci/hotplug/shpchprm_acpi.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pci/hotplug/shpchprm_acpi.c	Tue Jun 15 22:20:39 2004
@@ -1299,7 +1299,8 @@
 
 }
 
-void * shpchprm_get_slot(struct slot *slot)
+#if 0
+static void * shpchprm_get_slot(struct slot *slot)
 {
 	struct acpi_bridge	*ab = acpi_bridges_head;
 	struct acpi_php_slot	*aps = get_acpi_slot (ab, slot->number);
@@ -1310,6 +1311,7 @@
 
 	return (void *)aps;
 }
+#endif
 
 static void shpchprm_dump_func_res( struct pci_func *fun)
 {
diff -Nru a/drivers/pci/hotplug/shpchprm_legacy.c b/drivers/pci/hotplug/shpchprm_legacy.c
--- a/drivers/pci/hotplug/shpchprm_legacy.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pci/hotplug/shpchprm_legacy.c	Tue Jun 15 22:20:39 2004
@@ -55,11 +55,6 @@
 	return 0;
 }
 
-void * shpchprm_get_slot(struct slot *slot)
-{
-	return NULL;
-}
-
 int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
 {
 	int	offset = devnum - ctrl->slot_device_offset;
diff -Nru a/drivers/pci/hotplug/shpchprm_nonacpi.c b/drivers/pci/hotplug/shpchprm_nonacpi.c
--- a/drivers/pci/hotplug/shpchprm_nonacpi.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/pci/hotplug/shpchprm_nonacpi.c	Tue Jun 15 22:20:36 2004
@@ -51,11 +51,6 @@
 	return 0;
 }
 
-void * shpchprm_get_slot(struct slot *slot)
-{
-	return NULL;
-}
-
 int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)
 {
 	int	offset = devnum - ctrl->slot_device_offset;
diff -Nru a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
--- a/drivers/pci/pci-driver.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/pci/pci-driver.c	Tue Jun 15 22:20:42 2004
@@ -299,10 +299,30 @@
 {
 	struct pci_dev * pci_dev = to_pci_dev(dev);
 	struct pci_driver * drv = pci_dev->driver;
+	int i = 0;
 
 	if (drv && drv->suspend)
-		return drv->suspend(pci_dev,state);
-	return 0;
+		i = drv->suspend(pci_dev,state);
+		
+	pci_save_state(pci_dev, pci_dev->saved_config_space);
+	return i;
+}
+
+
+/* 
+ * Default resume method for devices that have no driver provided resume,
+ * or not even a driver at all.
+ */
+static void pci_default_resume(struct pci_dev *pci_dev)
+{
+	/* restore the PCI config space */
+	pci_restore_state(pci_dev, pci_dev->saved_config_space);
+	/* if the device was enabled before suspend, reenable */
+	if (pci_dev->is_enabled)
+		pci_enable_device(pci_dev);
+	/* if the device was busmaster before the suspend, make it busmaster again */
+	if (pci_dev->is_busmaster)
+		pci_set_master(pci_dev);
 }
 
 static int pci_device_resume(struct device * dev)
@@ -312,6 +332,8 @@
 
 	if (drv && drv->resume)
 		drv->resume(pci_dev);
+	else
+		pci_default_resume(pci_dev);
 	return 0;
 }
 
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/pci/pci.c	Tue Jun 15 22:20:38 2004
@@ -385,6 +385,7 @@
 int
 pci_enable_device(struct pci_dev *dev)
 {
+	dev->is_enabled = 1;
 	return pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1);
 }
 
@@ -399,6 +400,9 @@
 pci_disable_device(struct pci_dev *dev)
 {
 	u16 pci_command;
+	
+	dev->is_enabled = 0;
+	dev->is_busmaster = 0;
 
 	pci_read_config_word(dev, PCI_COMMAND, &pci_command);
 	if (pci_command & PCI_COMMAND_MASTER) {
@@ -601,6 +605,7 @@
 		cmd |= PCI_COMMAND_MASTER;
 		pci_write_config_word(dev, PCI_COMMAND, cmd);
 	}
+	dev->is_busmaster = 1;
 	pcibios_set_master(dev);
 }
 
@@ -640,7 +645,7 @@
 	if (cacheline_size == pci_cache_line_size)
 		return 0;
 
-	printk(KERN_WARNING "PCI: cache line size of %d is not supported "
+	printk(KERN_DEBUG "PCI: cache line size of %d is not supported "
 	       "by device %s\n", pci_cache_line_size << 2, pci_name(dev));
 
 	return -EINVAL;
diff -Nru a/drivers/pci/pci.ids b/drivers/pci/pci.ids
--- a/drivers/pci/pci.ids	Tue Jun 15 22:20:41 2004
+++ b/drivers/pci/pci.ids	Tue Jun 15 22:20:41 2004
@@ -7,7 +7,7 @@
 #	so if you have anything to contribute, please visit the home page or
 #	send a diff -u against the most recent pci.ids to pci-ids@ucw.cz.
 #
-#	Daily snapshot on Wed 2004-01-14 11:00:17
+#	Daily snapshot on Thu 2004-04-15 10:00:04
 #
 
 # Vendors, devices and subsystems. Please keep sorted.
@@ -24,7 +24,23 @@
 # Real TJN ID is e159, but they got it wrong several times --mj
 0059  Tiger Jet Network Inc. (Wrong ID)
 0070  Hauppauge computer works Inc.
+	4000  WinTV PVR-350
+	4001  WinTV PVR-250 (v1)
+	4009  WinTV PVR-250
+	4801  WinTV PVR-250 MCE
 0100  Ncipher Corp Ltd
+# 018a is not LevelOne but there is a board misprogrammed
+018a  LevelOne
+	0106  FPC-0106TX misprogrammed [RTL81xx]
+# 021b is not Compaq but there is a board misprogrammed
+021b  Compaq Computer Corporation
+	8139  HNE-300 (RealTek RTL8139c) [iPaq Networking]
+# http://www.davicom.com.tw/
+0291  Davicom Semiconductor, Inc.
+	8212  DM9102A(DM9102AE, SM9102AF) Ethernet 100/10 MBit(Rev 40)
+# SpeedStream is Efficient Networks, Inc, a Siemens Company
+02ac  SpeedStream
+	1012  1012 PCMCIA 10/100 Ethernet Card [RTL81xx]
 0675  Dynalink
 	1700  IS64PH ISDN Adapter
 	1702  IS64PH ISDN Adapter
@@ -36,8 +52,23 @@
 0e11  Compaq Computer Corporation
 	0001  PCI to EISA Bridge
 	0002  PCI to ISA Bridge
+	0046  Smart Array 64xx
+		0e11 409a  Smart Array 641
+		0e11 409b  Smart Array 642
+		0e11 409c  Smart Array 6400
+		0e11 409d  Smart Array 6400 EM
 	0049  NC7132 Gigabit Upgrade Module
 	004a  NC6136 Gigabit Server Adapter
+	007c  NC7770 1000BaseTX
+	007d  NC6770 1000BaseTX
+	0085  NC7780 1000BaseTX
+	00bb  NC7760
+	00ca  NC7771
+	00cb  NC7781
+	00cf  NC7772
+	00d0  NC7782
+	00d1  NC7783
+	00e3  NC7761
 	0508  Netelligent 4/16 Token Ring
 	1000  Triflex/Pentium Bridge, Model 1000
 	2000  Triflex/Pentium Bridge, Model 2000
@@ -45,6 +76,25 @@
 	3033  QVision 1280/p
 	3034  QVision 1280/p
 	4000  4000 [Triflex]
+	4030  SMART-2/P
+	4031  SMART-2SL
+	4032  Smart Array 3200
+	4033  Smart Array 3100ES
+	4034  Smart Array 221
+	4040  Integrated Array
+	4048  Compaq Raid LC2
+	4050  Smart Array 4200
+	4051  Smart Array 4250ES
+	4058  Smart Array 431
+	4070  Smart Array 5300
+	4080  Smart Array 5i
+	4082  Smart Array 532
+	4083  Smart Array 5312
+	4091  Smart Array 6i
+	409a  Smart Array 641
+	409b  Smart Array 642
+	409c  Smart Array 6400
+	409d  Smart Array 6400 EM
 	6010  HotPlug PCI Bridge 6010
 	7020  USB Controller
 	a0ec  Fibre Channel Host Controller
@@ -54,7 +104,7 @@
 		8086 002a  PCI Hotplug Controller A
 		8086 002b  PCI Hotplug Controller B
 	a0f8  ZFMicro Chipset USB
-	a0fc  Fibre Channel Host Controller
+	a0fc  FibreChannel HBA Tachyon
 	ae10  Smart-2/P RAID Controller
 		0e11 4030  Smart-2/P Array Controller
 		0e11 4031  Smart-2SL Array Controller
@@ -64,21 +114,21 @@
 	ae2a  MPC
 	ae2b  MIS-E
 	ae31  System Management Controller
-	ae32  Netelligent 10/100
+	ae32  Netelligent 10/100 TX PCI UTP
 	ae33  Triflex Dual EIDE Controller
-	ae34  Netelligent 10
+	ae34  Netelligent 10 T PCI UTP
 	ae35  Integrated NetFlex-3/P
-	ae40  Netelligent 10/100 Dual
-	ae43  ProLiant Integrated Netelligent 10/100
+	ae40  Netelligent Dual 10/100 TX PCI UTP
+	ae43  Netelligent Integrated 10/100 TX UTP
 	ae69  CETUS-L
 	ae6c  Northstar
 	ae6d  NorthStar CPU to PCI Bridge
-	b011  Integrated Netelligent 10/100
-	b012  Netelligent 10 T/2
+	b011  Netelligent 10/100 TX Embedded UTP
+	b012  Netelligent 10 T/2 PCI UTP/Coax
 	b01e  NC3120 Fast Ethernet NIC
 	b01f  NC3122 Fast Ethernet NIC
 	b02f  NC1120 Ethernet NIC
-	b030  Netelligent WS 5100
+	b030  Netelligent 10/100 TX UTP
 	b04a  10/100 TX PCI Intel WOL UTP Controller
 	b060  Smart Array 5300 Controller
 	b0c6  NC3161 Fast Ethernet NIC
@@ -96,6 +146,9 @@
 	b163  NC3134 Fast Ethernet NIC
 	b164  NC3165 Fast Ethernet Upgrade Module
 	b178  Smart Array 5i/532
+		0e11 4080  Smart Array 5i
+		0e11 4082  Smart Array 532
+		0e11 4083  Smart Array 5312
 	b1a4  NC7131 Gigabit Server Adapter
 	f130  NetFlex-3/P ThunderLAN 1.0
 	f150  NetFlex-3/P ThunderLAN 2.3
@@ -128,32 +181,59 @@
 	0020  53c1010 Ultra3 SCSI Adapter
 		1de1 1020  DC-390U3W
 	0021  53c1010 66MHz  Ultra3 SCSI Adapter
+		124b 1070  PMC-USCSI3
 		4c53 1080  CT8 mainboard
 		4c53 1300  P017 mezzanine (32-bit PMC)
 		4c53 1310  P017 mezzanine (64-bit PMC)
 	0030  53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI
+		1028 0123  PowerEdge 2600
+		1028 014a  PowerEdge 1750
 		1028 1010  LSI U320 SCSI Controller
-	0040  53c1035
+	0031  53c1030ZC PCI-X Fusion-MPT Dual Ultra320 SCSI
+	0032  53c1035 PCI-X Fusion-MPT Dual Ultra320 SCSI
+	0033  1030ZC_53c1035 PCI-X Fusion-MPT Dual Ultra320 SCSI
+	0040  53c1035 PCI-X Fusion-MPT Dual Ultra320 SCSI
+		1000 0033  MegaRAID SCSI 320-2XR
+		1000 0066  MegaRAID SCSI 320-2XRWS
+	0041  53C1035ZC PCI-X Fusion-MPT Dual Ultra320 SCSI
 	008f  53c875J
 		1092 8000  FirePort 40 SCSI Controller
 		1092 8760  FirePort 40 Dual SCSI Host Adapter
-	0621  FC909
-	0622  FC929
+	0407  MegaRAID
+		1000 0530  MegaRAID 530 SCSI 320-0X RAID Controller
+		1000 0531  MegaRAID 531 SCSI 320-4X RAID Controller
+		1000 0532  MegaRAID 532 SCSI 320-2X RAID Controller
+		1028 0533  PowerEgde Expandable RAID Controller 4/QC
+		8086 0532  Storage RAID Controller SRCU42X
+	0621  FC909 Fibre Channel Adapter
+	0622  FC929 Fibre Channel Adapter
+		1000 1020  44929 O Dual Fibre Channel card
 	0623  FC929 LAN
-	0624  FC919
+	0624  FC919 Fibre Channel Adapter
 	0625  FC919 LAN
-	0626  FC929X
+	0626  FC929X Fibre Channel Adapter
+		1000 1010  7202-XP-LC Dual Fibre Channel card
 	0627  FC929X LAN
-	0628  FC919X
+	0628  FC919X Fibre Channel Adapter
 	0629  FC919X LAN
 	0701  83C885 NT50 DigitalScape Fast Ethernet
 	0702  Yellowfin G-NIC gigabit ethernet
 		1318 0000  PEI100X
+	0804  SA2010
+	0805  SA2010ZC
+	0806  SA2020
+	0807  SA2020ZC
 	0901  61C102
 	1000  63C815
-	1960  PowerEdge Expandable RAID Controller 4
-		1028 0518  PowerEdge Expandable RAID Controller 4/DC
-		1028 0520  PowerEdge Expandable RAID Controller 4/SC
+	1960  MegaRAID
+		1000 0518  MegaRAID 518 SCSI 320-2 Controller
+		1000 0520  MegaRAID 520 SCSI 320-1 Controller
+		1000 0522  MegaRAID 522 i4133 RAID Controller
+		1000 0523  MegaRAID SATA 150-6 RAID Controller
+		1000 4523  MegaRAID SATA 150-4 RAID Controller
+		1000 a520  MegaRAID ZCR SCSI 320-0 Controller
+		1028 0518  MegaRAID 518 DELL PERC 4/DC RAID Controller
+		1028 0520  MegaRAID 520 DELL PERC 4/SC RAID Controller
 		1028 0531  PowerEdge Expandable RAID Controller 4/QC
 1001  Kolter Electronic
 	0010  PCI 1616 Measurement card with 32 digital I/O lines
@@ -167,16 +247,57 @@
 	9100  INI-9100/9100W SCSI Host
 1002  ATI Technologies Inc
 	4136  Radeon IGP 320 M
-	4144  Radeon R300 AD [Radeon 9500 Pro]
-	4145  Radeon R300 AE [Radeon 9500 Pro]
-	4146  Radeon R300 AF [Radeon 9500 Pro]
-	4147  Radeon R300 AG [FireGL Z1/X1]
+	4144  R300 AD [Radeon 9500 Pro]
+# New PCI ID provided by ATI developer relations (correction to above)
+	4145  R300 AE [Radeon 9700 Pro]
+# New PCI ID provided by ATI developer relations (oops, correction to above)
+	4146  R300 AF [Radeon 9700 Pro]
+	4147  R300 AG [FireGL Z1/X1]
+	4148  R350 AH [Radeon 9800]
+	4149  R350 AI [Radeon 9800]
+	414b  R350 AK [Fire GL ??]
+# New PCI ID provided by ATI developer relations
+	4150  RV350 AP [Radeon 9600]
+		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]
+		18bc 0101  GC-R9600PRO Primary
+# New PCI ID provided by ATI developer relations
+	4151  RV350 AQ [Radeon 9600]
+# New PCI ID provided by ATI developer relations
+	4152  RV350 AR [Radeon 9600]
+	4154  RV350 AT [Fire GL T2]
+	4155  RV350 AU [Fire GL T2]
+	4156  RV350 AV [Fire GL T2]
+	4157  RV350 AW [Fire GL T2]
 	4158  68800AX [Mach32]
-	4164  Radeon R300 Secondary (DVI) output
-	4242  Radeon R200 BB [Radeon All in Wonder 8500DV]
+# The PCI ID is unrelated to any DVI output.
+	4164  R300 AD [Radeon 9500 Pro] (Secondary)
+# New PCI ID info provided by ATI developer relations
+	4165  R300 AE [Radeon 9700 Pro] (Secondary)
+# New PCI ID info provided by ATI developer relations
+	4166  R300 AF [Radeon 9700 Pro] (Secondary)
+# New PCI ID provided by ATI developer relations
+	4168  Radeon R350 [Radeon 9800] (Secondary)
+# New PCI ID provided by ATI developer relations (correction to above)
+	4170  RV350 AP [Radeon 9600] (Secondary)
+		1458 4025  Giga-Byte GV-R96128D Secondary
+		148c 2067  PowerColor R96A-C3N (Secondary)
+		174b 7c28  GC-R9600PRO Secondary [Sapphire]
+		18bc 0100  GC-R9600PRO Secondary
+# New PCI ID provided by ATI developer relations (correction to above)
+	4171  RV350 AQ [Radeon 9600] (Secondary)
+# New PCI ID provided by ATI developer relations (correction to above)
+	4172  RV350 AR [Radeon 9600] (Secondary)
+	4242  R200 BB [Radeon All in Wonder 8500DV]
 		1002 02aa  Radeon 8500 AIW DV Edition
 	4336  Radeon Mobility U1
 	4337  Radeon IGP 340M
+	4341  IXP150 AC'97 Audio Controller
+# Radeon 9100 IGP integrated
+	4353  ATI SMBus
 	4354  215CT [Mach64 CT]
 	4358  210888CX [Mach64 CX]
 	4554  210888ET [Mach64 ET]
@@ -246,21 +367,22 @@
 	475a  3D Rage IIC AGP
 		1002 0087  Rage 3D IIC
 		1002 475a  Rage IIC AGP
-	4964  Radeon R250 Id [Radeon 9000]
-	4965  Radeon R250 Ie [Radeon 9000]
-	4966  Radeon R250 If [Radeon 9000]
-		10f1 0002  R250 If [Tachyon G9000 PRO]
-		148c 2039  R250 If [Radeon 9000 Pro "Evil Commando"]
-		1509 9a00  R250 If [Radeon 9000 "AT009"]
-# New subdevice - 3D Prophet 9000 PCI by Hercules.  AGP version probably would have same ID, so not specified.
-		1681 0040  R250 If [3D prophet 9000]
-		174b 7176  R250 If [Sapphire Radeon 9000 Pro]
-		174b 7192  R250 If [Radeon 9000 "Atlantis"]
-		17af 2005  R250 If [Excalibur Radeon 9000 Pro]
-		17af 2006  R250 If [Excalibur Radeon 9000]
-	4967  Radeon R250 Ig [Radeon 9000]
-	496e  Radeon R250 [Radeon 9000] (Secondary)
+	4964  Radeon RV250 Id [Radeon 9000]
+	4965  Radeon RV250 Ie [Radeon 9000]
+	4966  Radeon RV250 If [Radeon 9000]
+		10f1 0002  RV250 If [Tachyon G9000 PRO]
+		148c 2039  RV250 If [Radeon 9000 Pro "Evil Commando"]
+		1509 9a00  RV250 If [Radeon 9000 "AT009"]
+# New subdevice - 3D Prophet 9000 PCI by Hercules. AGP version probably would have same ID, so not specified.
+		1681 0040  RV250 If [3D prophet 9000]
+		174b 7176  RV250 If [Sapphire Radeon 9000 Pro]
+		174b 7192  RV250 If [Radeon 9000 "Atlantis"]
+		17af 2005  RV250 If [Excalibur Radeon 9000 Pro]
+		17af 2006  RV250 If [Excalibur Radeon 9000]
+	4967  Radeon RV250 Ig [Radeon 9000]
+	496e  Radeon RV250 [Radeon 9000] (Secondary)
 	4c42  3D Rage LT Pro AGP-133
+		0e11 b0e7  Rage LT Pro (Compaq Presario 5240)
 		0e11 b0e8  Rage 3D LT Pro
 		0e11 b10e  3D Rage LT Pro (Compaq Armada 1750)
 		1002 0040  Rage LT Pro AGP 2X
@@ -294,10 +416,11 @@
 	4c57  Radeon Mobility M7 LW [Radeon Mobility 7500]
 		1014 0517  ThinkPad T30
 		1028 00e6  Radeon Mobility M7 LW (Dell Inspiron 8100)
+		1028 012a  Latitude C640
 		144d c006  Radeon Mobility M7 LW in vpr Matrix 170B4
 	4c58  Radeon RV200 LX [Mobility FireGL 7800 M7]
 	4c59  Radeon Mobility M6 LY
-		1014 0235  ThinkPad A30p (2653-64G)
+		1014 0235  ThinkPad A30/A30p (2652/2653)
 		1014 0239  ThinkPad X22/X23/X24
 		104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
 	4c5a  Radeon Mobility M6 LZ
@@ -312,15 +435,29 @@
 	4e44  Radeon R300 ND [Radeon 9700 Pro]
 	4e45  Radeon R300 NE [Radeon 9500 Pro]
 		1002 0002  Radeon R300 NE [Radeon 9500 Pro]
-	4e46  Radeon R300 NF [Radeon 9700]
+# New PCI ID provided by ATI developer relations (correction to above)
+	4e46  RV350 NF [Radeon 9600]
 	4e47  Radeon R300 NG [FireGL X1]
 	4e48  Radeon R350 [Radeon 9800]
+# New PCI ID provided by ATI developer relations
+	4e49  Radeon R350 [Radeon 9800]
+	4e4a  RV350 NJ [Radeon 9800 XT]
+	4e4b  R350 NK [Fire GL X2]
+# New PCI ID provided by ATI developer relations
+	4e50  RV350 [Mobility Radeon 9600 M10]
+# New PCI ID provided by ATI developer relations
+	4e52  RV350 [Mobility Radeon 9600 M10]
+	4e54  M10 NT [FireGL Mobility T2]
 	4e64  Radeon R300 [Radeon 9700 Pro] (Secondary)
 	4e65  Radeon R300 [Radeon 9500 Pro] (Secondary)
 		1002 0003  Radeon R300 NE [Radeon 9500 Pro]
-	4e66  Radeon R300 [Radeon 9700] (Secondary)
+# New PCI ID provided by ATI developer relations (correction to above)
+	4e66  RV350 NF [Radeon 9600] (Secondary)
 	4e67  Radeon R300 [FireGL X1] (Secondary)
 	4e68  Radeon R350 [Radeon 9800] (Secondary)
+# New PCI ID provided by ATI developer relations
+	4e69  Radeon R350 [Radeon 9800] (Secondary)
+	4e6a  RV350 NJ [Radeon 9800 XT] (Secondary)
 	5041  Rage 128 PA/PRO
 	5042  Rage 128 PB/PRO AGP 2x
 	5043  Rage 128 PC/PRO AGP 4x
@@ -390,6 +527,8 @@
 	514d  Radeon R200 QM [Radeon 9100]
 	514e  Radeon R200 QN [Radeon 8500LE]
 	514f  Radeon R200 QO [Radeon 8500LE]
+	5154  R200 QT [Radeon 8500]
+	5155  R200 QU [Radeon 9100]
 	5157  Radeon RV200 QW [Radeon 7500]
 		1002 013a  Radeon 7500
 		1458 4000  RV200 QW [RADEON 7500 PRO MAYA AR]
@@ -469,7 +608,20 @@
 		1002 5654  Mach64VT Reference
 	5655  264VT3 [Mach64 VT3]
 	5656  264VT4 [Mach64 VT4]
-	5961  Radeon RV280 [Radeon 9200]
+	5941  RV280 [Radeon 9200] (Secondary)
+# http://www.hightech.com.hk/html/9200.htm
+		17af 200d  Excalibur Radeon 9200
+		18bc 0050  GeXcube GC-R9200-C3 (Secondary)
+	5960  RV280 [Radeon 9200 PRO]
+	5961  RV280 [Radeon 9200]
+# http://www.hightech.com.hk/html/9200.htm
+		17af 200c  Excalibur Radeon 9200
+		18bc 0051  GeXcube GC-R9200-C3
+	5964  RV280 [Radeon 9200 SE]
+		148c 2073  CN-AG92E
+	5c61  RV250 5c61 [Radeon Mobility 9200 M9+]
+	5c63  RV250 5c63 [Radeon Mobility 9200 M9+]
+	5d44  RV280 [Radeon 9200 SE] (Secondary)
 	700f  PCI Bridge [IGP 320M]
 	7010  PCI Bridge [IGP 340M]
 	cab0  AGP Bridge [IGP 320M]
@@ -610,6 +762,7 @@
 		1186 1100  DFE-500TX Fast Ethernet
 		1186 1101  DFE-500TX Fast Ethernet
 		1186 1102  DFE-500TX Fast Ethernet
+		1186 1112  DFE-570TX Quad Fast Ethernet
 		1259 2800  AT-2800Tx Fast Ethernet
 		1266 0004  Eagle Fast EtherMAX
 		12af 0019  NetFlyer Cardbus Fast Ethernet
@@ -621,7 +774,7 @@
 		1395 0001  10/100 Ethernet CardBus PC Card
 		13d1 ab01  EtherFast 10/100 Cardbus (PCMPC200)
 		8086 0001  EtherExpress PRO/100 Mobile CardBus 32
-	001a  Farallon PN9000SX
+	001a  Farallon PN9000SX Gigabit Ethernet
 	0021  DECchip 21052
 	0022  DECchip 21150
 	0023  DECchip 21150
@@ -639,7 +792,8 @@
 		12d9 000a  IP Telephony card
 		4c53 1050  CT7 mainboard
 		4c53 1051  CE7 mainboard
-		9005 0365  Adaptec 5400S
+		9005 0364  5400S (Mustang)
+		9005 0365  5400S (Mustang)
 		9005 1364  Dell PowerEdge RAID Controller 2
 		9005 1365  Dell PowerEdge RAID Controller 2
 		e4bf 1000  CC8-1-BLUES
@@ -818,8 +972,13 @@
 101e  American Megatrends Inc.
 	1960  MegaRAID
 		101e 0471  MegaRAID 471 Enterprise 1600 RAID Controller
-		101e 0475  MegaRAID 475 Express 500 RAID Controller
+		101e 0475  MegaRAID 475 Express 500/500LC RAID Controller
+		101e 0477  MegaRAID 477 Elite 3100 RAID Controller
 		101e 0493  MegaRAID 493 Elite 1600 RAID Controller
+		101e 0494  MegaRAID 494 Elite 1650 RAID Controller
+		101e 0503  MegaRAID 503 Enterprise 1650 RAID Controller
+		101e 0511  MegaRAID 511 i4 IDE RAID Controller
+		101e 0522  MegaRAID 522 i4133 RAID Controller
 		1028 0471  PowerEdge RAID Controller 3/QC
 		1028 0475  PowerEdge RAID Controller 3/SC
 		1028 0493  PowerEdge RAID Controller 3/DC
@@ -843,6 +1002,7 @@
 	1103  K8 NorthBridge
 	2000  79c970 [PCnet32 LANCE]
 		1014 2000  NetFinity 10/100 Fast Ethernet
+		1022 2000  PCnet - Fast 79C971
 		103c 104c  Ethernet with LAN remote power Adapter
 		103c 1064  Ethernet with LAN remote power Adapter
 		103c 1065  Ethernet with LAN remote power Adapter
@@ -913,6 +1073,7 @@
 	0194  82C194
 	2000  4DWave DX
 	2001  4DWave NX
+	2100  CyberBlade XP4m32
 	8400  CyberBlade/i7
 		1023 8400  CyberBlade i7 AGP
 	8420  CyberBlade/i7d
@@ -1029,7 +1190,6 @@
 		1028 0003  PowerEdge Expandable RAID Controller 3/Si
 	0004  PowerEdge Expandable RAID Controller 3/Si
 		1028 00d0  PowerEdge Expandable RAID Controller 3/Si
-	0005  PowerEdge Expandable RAID Controller 3/Di
 	0006  PowerEdge Expandable RAID Controller 3/Di
 	0007  Remote Access Controller:DRAC III
 	0008  Remote Access Controller
@@ -1040,12 +1200,26 @@
 		1028 0121  PowerEdge Expandable RAID Controller 3/Di
 	000c  Remote Access Controller:ERA or ERA/O
 	000d  BMC/SMIC device
-	000e  PowerEdge Expandable RAID Controller
-	000f  PowerEdge Expandable RAID Controller 4/Di
+	000e  PowerEdge Expandable RAID controller 4
+		1028 0123  PowerEdge Expandable RAID Controller 4/Di
+	000f  PowerEdge Expandable RAID controller 4
+		1028 013b  MegaRAID DELL PERC 4/Di RAID On Motherboard
+		1028 014a  PowerEdge Expandable RAID Controller 4/Di
+		1028 014c  MegaRAID DELL PERC 4/Di RAID On Motherboard
+		1028 014d  MegaRAID DELL PERC 4/Di RAID On Motherboard
 1029  Siemens Nixdorf IS
 102a  LSI Logic
 	0000  HYDRA
 	0010  ASPEN
+	001f  AHA-2940U2/U2W /7890/7891 SCSI Controllers
+		9005 000f  2940U2W SCSI Controller
+		9005 0106  2940U2W SCSI Controller
+		9005 a180  2940U2W SCSI Controller
+	00c5  AIC-7899 U160/m SCSI Controller
+		1028 00c5  PowerEdge 2550/2650/4600
+	00cf  AIC-7899P U160/m
+		1028 0106  PowerEdge 4600
+		1028 0121  PowerEdge 2650
 102b  Matrox Graphics, Inc.
 # DJ: I've a suspicion that 0010 is a duplicate of 0d10.
 	0010  MGA-I [Impression?]
@@ -1171,6 +1345,7 @@
 		102b 0f83  Millennium G550
 		102b 0f84  Millennium G550 Dual Head DDR 32Mb
 		102b 1e41  Millennium G550
+	2537  MGA G650 AGP
 	4536  VIA Framegrabber
 	6573  Shark 10/100 Multiport SwitchNIC
 102c  Chips and Technologies
@@ -1206,6 +1381,11 @@
 	0009  r4x00
 	0020  ATM Meteor 155
 		102f 00f8  ATM Meteor 155
+	0105  TC86C001 [goku-s] IDE
+	0106  TC86C001 [goku-s] USB 1.1 Host
+	0107  TC86C001 [goku-s] USB Device Controller
+	0108  TC86C001 [goku-s] I2C/SIO/GPIO Controller
+	0180  TX4927
 1030  TMC Research
 1031  Miro Computer Products AG
 	5601  DC20 ASIC
@@ -1235,6 +1415,7 @@
 		1179 0001  USB
 		12ee 7000  Root Hub
 		1799 0001  Root Hub
+		807d 0035  PCI-USB2 (OHCI subsystem)
 	003b  PCI to C-bus Bridge
 	003e  NAPCCARD Cardbus Controller
 	0046  PowerVR PCX2 [midas]
@@ -1252,14 +1433,21 @@
 	0074  56k Voice Modem
 		1033 8014  RCV56ACF 56k Voice Modem
 	009b  Vrc5476
+	00a5  VRC4173
 	00a6  VRC5477 AC97
 	00cd  IEEE 1394 [OrangeLink] Host Controller
 		12ee 8011  Root hub
+	00ce  IEEE 1394 Host Controller
 	00df  Vr4131
 	00e0  USB 2.0
+		0ee4 3383  Sitecom IEEE 1394 / USB2.0 Combo Card
 		12ee 7001  Root hub
 		1799 0002  Root Hub
+		807d 1043  PCI-USB2 (EHCI subsystem)
+	00e7  IEEE 1394 Host Controller
+	00f2  uPD72874 IEEE1394 OHCI 1.1 3-port PHY-Link Ctrlr
 	00f3  uPD6113x Multimedia Decoder/Processor [EMMA2]
+	010c  VR7701
 1034  Framatome Connectors USA Inc.
 1035  Comp. & Comm. Research Lab
 1036  Future Domain Corp.
@@ -1267,27 +1455,27 @@
 1037  Hitachi Micro Systems
 1038  AMP, Inc
 1039  Silicon Integrated Systems [SiS]
-# This is what all my tests report. I don't know if this is equivalent to "5591/5592 AGP".
-	0001  SiS 530 Virtual PCI-to-PCI bridge (AGP)
+	0001  Virtual PCI-to-PCI bridge (AGP)
 	0002  SG86C202
 	0006  85C501/2/3
-	0008  85C503/5513
+	0008  SiS85C503/5513 (LPC Bridge)
 	0009  ACPI
 	0018  SiS85C503/5513 (LPC Bridge)
 	0200  5597/5598/6326 VGA
 		1039 0000  SiS5597 SVGA (Shared RAM)
 	0204  82C204
 	0205  SG86C205
-	0300  SiS300/305 PCI/AGP VGA Display Adapter
+	0300  300/305 PCI/AGP VGA Display Adapter
 		107d 2720  Leadtek WinFast VR300
-	0310  SiS315H PCI/AGP VGA Display Adapter
-	0315  SiS315 PCI/AGP VGA Display Adapter
-	0325  SiS315PRO PCI/AGP VGA Display Adapter
-	0330  SiS330 [Xabre] PCI/AGP VGA Display Adapter
+	0310  315H PCI/AGP VGA Display Adapter
+	0315  315 PCI/AGP VGA Display Adapter
+	0325  315PRO PCI/AGP VGA Display Adapter
+	0330  330 [Xabre] PCI/AGP VGA Display Adapter
 	0406  85C501/2
 	0496  85C496
 	0530  530 Host
 	0540  540 Host
+	0550  550 Host
 	0597  5513C
 	0601  85C601
 	0620  620 Host
@@ -1297,24 +1485,32 @@
 	0645  SiS645 Host & Memory & AGP Controller
 	0646  SiS645DX Host & Memory & AGP Controller
 	0648  SiS 645xx
-	0650  650 Host
-	0651  SiS651 Host
+	0650  650/M650 Host
+	0651  651 Host
+	0655  655 Host
+	0660  660 Host
+	0661  661FX/M661FX/M661MX Host
 	0730  730 Host
 	0733  733 Host
 	0735  735 Host
 	0740  740 Host
+	0741  741/741GX/M741 Host
 	0745  745 Host
 	0746  746 Host
-	0755  SiS 755 Host Bridge
-	0900  SiS900 10/100 Ethernet
+	0755  755 Host
+	0760  760/M760 Host
+	0900  SiS900 PCI Fast Ethernet
 		1039 0900  SiS900 10/100 Ethernet Adapter
 		1043 8035  CUSI-FX motherboard
 	0961  SiS961 [MuTIOL Media IO]
 	0962  SiS962 [MuTIOL Media IO]
+	0963  SiS963 [MuTIOL Media IO]
+	0964  SiS964 [MuTIOL Media IO]
+	0965  SiS965 [MuTIOL Media IO]
 	3602  83C602
 	5107  5107
 	5300  SiS540 PCI Display Adapter
-	5315  SiS550 AGP/VGA VGA Display Adapter
+	5315  550 PCI/AGP VGA Display Adapter
 	5401  486 PCI Chipset
 	5511  5511/5512
 	5513  5513 [IDE]
@@ -1332,12 +1528,12 @@
 	6204  Video decoder & MPEG interface
 	6205  VGA Controller
 	6236  6236 3D-AGP
-	6300  SiS630 GUI Accelerator+3D
+	6300  630/730 PCI/AGP VGA Display Adapter
 		1019 0970  P6STP-FL motherboard
 		1043 8035  CUSI-FX motherboard
-	6306  SiS530 3D PCI/AGP
+	6306  530/620 PCI/AGP VGA Display Adapter
 		1039 6306  SiS530,620 GUI Accelerator+3D
-	6325  SiS650/651/M650/740 PCI/AGP VGA Display Adapter
+	6325  65x/M650/740 PCI/AGP VGA Display Adapter
 	6326  86C326 5598/6326
 		1039 6326  SiS6326 GUI Accelerator
 		1092 0a50  SpeedStar A50
@@ -1345,14 +1541,16 @@
 		1092 4910  SpeedStar A70
 		1092 4920  SpeedStar A70
 		1569 6326  SiS6326 GUI Accelerator
+	6330  661FX/M661FX/M661MX/741/M741/760/M760 PCI/AGP
 	7001  USB 1.0 Controller
 		1039 7000  Onboard USB Controller
 	7002  USB 2.0 Controller
 		1509 7002  Onboard USB Controller
 	7007  FireWire Controller
 	7012  Sound Controller
-	7013  Intel 537 [56k Winmodem]
-	7016  10/100 Ethernet Adapter
+# There are may be different modem codecs here (Intel537 compatible and incompatible)
+	7013  AC'97 Modem Controller
+	7016  SiS7016 PCI Fast Ethernet Adapter
 		1039 7016  SiS7016 10/100 Ethernet Adapter
 	7018  SiS PCI Audio Accelerator
 		1014 01b6  SiS PCI Audio Accelerator
@@ -1410,6 +1608,7 @@
 		103c 1226  Keystone SP2
 		103c 1227  Powerbar SP2
 		103c 1282  Everest SP2
+	1054  PCI Local Bus Adapter
 	1064  79C970 PCnet Ethernet Controller
 	108b  Visualize FXe
 	10c1  NetServer Smart IRQ Router
@@ -1422,6 +1621,7 @@
 	1229  zx1 System Bus Adapter
 	122a  zx1 I/O Controller
 	122e  zx1 Local Bus Adapter
+	127c  sx1000 I/O Controller
 	1290  Auxiliary Diva Serial Port
 	2910  E2910A PCIBus Exerciser
 	2925  E2925A 32 Bit, 33 MHzPCI Exerciser & Analyzer
@@ -1437,8 +1637,11 @@
 	3020  Samurai_IDE
 1043  Asustek Computer, Inc.
 	0675  ISDNLink P-IN100-ST-D
+	4015  v7100 SDRAM [GeForce2 MX]
 	4021  v7100 Combo Deluxe [GeForce2 MX + TV tuner]
 	4057  v8200 GeForce 3
+	8043  v8240 PAL 128M [P4T] Motherboard
+	807b  v9280/TD [Geforce4 TI4200 8X With TV-Out and DVI]
 1044  Distributed Processing Technology
 	1012  Domino RAID Engine
 	a400  SmartCache/Raid I-IV Controller
@@ -1523,9 +1726,9 @@
 	021b  STPC Consumer IIA Southbridge
 	0500  ST70137 [Unicorn] ADSL DMT Transceiver
 	0564  STPC Client Northbridge
-	0981  DEC-Tulip compatible 10/100 Ethernet
+	0981  21x4x DEC-Tulip compatible 10/100 Ethernet
 	1746  STG 1764X
-	2774  DEC-Tulip compatible 10/100 Ethernet
+	2774  21x4x DEC-Tulip compatible 10/100 Ethernet
 	3520  MPEG-II decoder card
 	55cc  STPC Client Southbridge
 104b  BusLogic
@@ -1577,24 +1780,33 @@
 	8022  TSB43AB22 IEEE-1394a-2000 Controller (PHY/Link)
 	8023  TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link)
 	8024  TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link)
+	8025  TSB82AA2 IEEE-1394b Link Layer Controller
 	8026  TSB43AB21 IEEE-1394a-2000 Controller (PHY/Link)
 	8027  PCI4451 IEEE-1394 Controller
 		1028 00e6  PCI4451 IEEE-1394 Controller (Dell Inspiron 8100)
 	8029  PCI4510 IEEE-1394 Controller
+		1071 8160  MIM2900
 	8400  ACX 100 22Mbps Wireless Interface
+		00fc 16ec  U.S. Robotics 22 Mbps Wireless PC Card (model 2210)
+		00fd 16ec  U.S. Robotics 22Mbps Wireless PCI Adapter (model 2216)
+		1186 3b01  DWL-520+ 22Mbps PCI Wireless Adapter
 	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. More info requested from reporter (whi
 	9000  Wireless Interface (of unknown type)
+	9066  ACX 111 54Mbps Wireless Interface
 	a001  TDC1570
 	a100  TDC1561
 	a102  TNETA1575 HyperSAR Plus w/PCI Host i/f & UTOPIA i/f
-	a106  TMS320C6205
+	a106  TMS320C6205 Fixed Point DSP
+		175c 5000  ASI50xx Audio Adapter
+		175c 8700  ASI87xx Radio Tuner card
 	ac10  PCI1050
 	ac11  PCI1053
 	ac12  PCI1130
 	ac13  PCI1031
 	ac15  PCI1131
 	ac16  PCI1250
+		1014 0092  ThinkPad 600
 	ac17  PCI1220
 	ac18  PCI1260
 	ac19  PCI1221
@@ -1603,6 +1815,7 @@
 		0e11 b113  Armada M700
 	ac1c  PCI1225
 		0e11 b121  Armada E500
+		1028 0088  Dell  Computer Corporation  Latitude CPi A400XT
 	ac1d  PCI1251A
 	ac1e  PCI1211
 	ac1f  PCI1251B
@@ -1617,18 +1830,27 @@
 	ac42  PCI4451 PC card Cardbus Controller
 		1028 00e6  PCI4451 PC card CardBus Controller (Dell Inspiron 8100)
 	ac44  PCI4510 PC card Cardbus Controller
+		1071 8160  MIM2000
+	ac46  PCI4520 PC card Cardbus Controller
 	ac50  PCI1410 PC card Cardbus Controller
 	ac51  PCI1420
 		1014 023b  ThinkPad T23 (2647-4MG)
 		1028 00b1  Latitude C600
+		1028 012a  Latitude C640
 		10cf 1095  Lifebook C6155
 		e4bf 1000  CP2-2-HIPHOP
 	ac52  PCI1451 PC card Cardbus Controller
 	ac53  PCI1421 PC card Cardbus Controller
-	ac55  PCI1250 PC card Cardbus Controller
-		1014 0512  ThinkPad T30
+	ac55  PCI1520 PC card Cardbus Controller
+		1014 0512  ThinkPad T30/T40
 	ac56  PCI1510 PC card Cardbus Controller
 	ac60  PCI2040 PCI to DSP Bridge Controller
+		175c 5100  ASI51xx Audio Adapter
+		175c 6100  ASI61xx Audio Adapter
+		175c 6200  ASI62xx Audio Adapter
+	ac8d  PCI 7620
+	ac8e  PCI7420 CardBus Controller
+	ac8f  PCI7420 Flash Media Controller
 	fe00  FireWire Host Controller
 	fe03  12C01A FireWire Host Controller
 104d  Sony Corporation
@@ -1674,7 +1896,20 @@
 	0006  MPC8245 [Unity]
 	0100  MC145575 [HFC-PCI]
 	0431  KTI829c 100VG
-	1801  Audio I/O Controller (MIDI)
+	1801  DSP56301 Digital Signal Processor
+		14fb 0101  Transas Radar Imitator Board [RIM]
+		14fb 0102  Transas Radar Imitator Board [RIM-2]
+		14fb 0202  Transas Radar Integrator Board [RIB-2]
+		14fb 0611  1 channel CAN bus Controller [CanPci-1]
+		14fb 0612  2 channels CAN bus Controller [CanPci-2]
+		14fb 0613  3 channels CAN bus Controller [CanPci-3]
+		14fb 0614  4 channels CAN bus Controller [CanPci-4]
+		14fb 0621  1 channel CAN bus Controller [CanPci2-1]
+		14fb 0622  2 channels CAN bus Controller [CanPci2-2]
+		14fb 0810  Transas VTS Radar Integrator Board [RIB-4]
+		175c 4200  ASI4215 Audio Adapter
+		175c 4300  ASI43xx Audio Adapter
+		175c 4400  ASI4401 Audio Adapter
 		ecc0 0030  Layla
 	18c0  MPC8265A/MPC8266
 	4801  Raven
@@ -1710,6 +1945,10 @@
 		105a 4d39  Fasttrak66
 	1275  20275
 	3318  PDC20318 (SATA150 TX4)
+	3319  PDC20319 (SATA150 TX4)
+	3373  PDC20378 (SATA150 TX)
+		1462 702e  K8T NEO FIS2R motherboard
+	3375  PDC20375 (SATA150 TX2plus)
 	3376  PDC20376
 		1043 809e  A7V8X motherboard
 	4d30  20267
@@ -1727,11 +1966,15 @@
 		105a 4d68  Ultra133TX2
 	5275  PDC20276 IDE
 		105a 0275  SuperTrak SX6000 IDE
+		105a 1275  MBFastTrak133 Lite (tm) Controller (RAID mode)
+		1458 b001  MBUltra 133
 	5300  DC5300
 	6268  20268R
 	6269  PDC20271
 		105a 6269  FastTrak TX2/TX2000
 	6621  PDC20621 [SX4000] 4 Channel IDE RAID Controller
+	6622  PDC20621 [SATA150 SX4] 4 Channel IDE RAID Controller
+	6626  PDC20618 Ultra 618
 	6629  PDC20619 FastTrak TX4000 RAID
 	7275  PDC20277
 105b  Foxconn International, Inc.
@@ -1812,14 +2055,21 @@
 	0005  National PC87550 System Controller
 	8002  PT86C523 [Vesuvius v3] PCI-ISA Bridge Slave
 1067  Mitsubishi Electric
+	0301  AccelGraphics AccelECLIPSE
+	0304  AccelGALAXY A2100 [OEM Evans & Sutherland]
+	0308  Tornado 3000 [OEM Evans & Sutherland]
 	1002  VG500 [VolumePro Volume Rendering Accelerator]
 1068  Diversified Technology
 1069  Mylex Corporation
 	0001  DAC960P
 	0002  DAC960PD
-	0010  DAC960PX
+	0010  DAC960PG
+	0020  DAC960LA
 	0050  AcceleRAID 352/170/160 support Device
 	b166  Gemstone chipset SCSI controller
+		1014 0242  iSeries 2872 DASD IOA
+		1014 0266  Dual Channel PCI-X U320 SCSI Adapter
+		1014 0278  Dual Channel PCI-X U320 SCSI RAID Adapter
 	ba55  eXtremeRAID 1100 support Device
 	ba56  eXtremeRAID 2000/3000 support Device
 106a  Aten Research Inc
@@ -1853,6 +2103,22 @@
 	0032  UniNorth 2 GMAC (Sun GEM)
 	0033  UniNorth 2 ATA/100
 	0034  UniNorth 2 AGP
+	0035  UniNorth 2 PCI
+	0036  UniNorth 2 Internal PCI
+	003b  UniNorth/Intrepid ATA/100
+	003e  KeyLargo/Intrepid Mac I/O
+	003f  KeyLargo/Intrepid USB
+	0040  K2 KeyLargo USB
+	0041  K2 KeyLargo Mac/IO
+	0042  K2 FireWire
+	0043  K2 ATA/100
+	0045  K2 HT-PCI Bridge
+	0046  K2 HT-PCI Bridge
+	0047  K2 HT-PCI Bridge
+	0048  K2 HT-PCI Bridge
+	0049  K2 HT-PCI Bridge
+	004b  U3 AGP
+	004c  K2 GMAC (Sun GEM)
 	1645  Tigon3 Gigabit Ethernet NIC (BCM5701)
 106c  Hyundai Electronics America
 	8801  Dual Pentium ISA/PCI Motherboard
@@ -1865,6 +2131,7 @@
 106f  City Gate Development Ltd
 1070  Daewoo Telecom Ltd
 1071  Mitac
+	8160  Mitac 8060B Mobile Platform
 1072  GIT Co Ltd
 1073  Yamaha Corporation
 	0001  3D GUI Accelerator
@@ -1905,13 +2172,13 @@
 		101e 8471  QLA12160 on AMI MegaRAID
 		101e 8493  QLA12160 on AMI MegaRAID
 	1240  ISP1240 SCSI Host Adapter
-	1280  ISP1280
+	1280  ISP1280 SCSI Host Adapter
 	2020  ISP2020A Fast!SCSI Basic Adapter
 	2100  QLA2100 64-bit Fibre Channel Adapter
 		1077 0001  QLA2100 64-bit Fibre Channel Adapter
-	2200  QLA2200
+	2200  QLA2200 64-bit Fibre Channel Adapter
 		1077 0002  QLA2200
-	2300  QLA2300 64-bit FC-AL Adapter
+	2300  QLA2300 64-bit Fibre Channel Adapter
 	2312  QLA2312 Fibre Channel Adapter
 1078  Cyrix Corporation
 	0000  5510 [Grappa]
@@ -2008,6 +2275,7 @@
 	8001  Schizo PCI Bus Module
 	a000  Ultra IIi
 	a001  Ultra IIe
+	a801  Tomatillo PCI Bus Module
 108f  Systemsoft
 1090  Encore Computer Corporation
 1091  Intergraph Corporation
@@ -2063,8 +2331,8 @@
 	c801  PCI-GPIB
 	c831  PCI-GPIB bridge
 1094  First International Computers [FIC]
-1095  CMD Technology Inc
-	0240  Adaptec AAR-1210SA SATA HostRAID Controller
+1095  Silicon Image, Inc. (formerly CMD Technology Inc)
+	0240  Adaptec AAR-1210SA SATA HostRAID
 	0640  PCI0640
 	0643  PCI0643
 	0646  PCI0646
@@ -2078,8 +2346,12 @@
 	0670  USB0670
 		1095 0670  USB0670
 	0673  USB0673
-	0680  PCI0680
-	3112  Silicon Image SiI 3112 SATARaid Controller
+	0680  PCI0680 Ultra ATA-133 Host Controller
+		1095 3680  Winic W-680 (Silicon Image 680 based)
+	3112  Silicon Image Serial ATARaid Controller [ CMD/Sil 3112/3112A ]
+		1095 6112  Asus A7N8X
+	3114  Silicon Image SiI 3114 SATARaid
+	3512  Silicon Image Serial ATARaid Controller [ CMD/Sil 3512 ]
 1096  Alacron
 1097  Appian Technology
 1098  Quantum Designs (H.K.) Ltd
@@ -2109,11 +2381,13 @@
 		127a 0003  Bt878a Mediastream Controller PAL BG
 		127a 0048  Bt878/832 Mediastream Controller
 		144f 3000  MagicTView CPH060 - Video
+		1461 0002  TV98 Series (TV/No FM/Remote)
 		1461 0004  AVerTV WDM Video Capture
 		14f1 0001  Bt878 Mediastream Controller NTSC
 		14f1 0002  Bt878 Mediastream Controller PAL BG
 		14f1 0003  Bt878a Mediastream Controller PAL BG
 		14f1 0048  Bt878/832 Mediastream Controller
+		1822 0001  VisionPlus DVB card
 		1851 1850  FlyVideo'98 - Video
 		1851 1851  FlyVideo II
 		1852 1852  FlyVideo'98 - Video (with FM Tuner)
@@ -2170,6 +2444,7 @@
 		14f1 0002  Bt878 Video Capture (Audio Section)
 		14f1 0003  Bt878 Video Capture (Audio Section)
 		14f1 0048  Bt878 Video Capture (Audio Section)
+		1822 0001  VisionPlus DVB Card
 		bd11 1200  PCTV pro (TV + FM stereo receiver, audio section)
 	0879  Bt879 Audio Capture
 		127a 0044  Bt879 Video Capture (Audio Section)
@@ -2228,8 +2503,8 @@
 	0006  HPCEX
 	0007  RPCEX
 	0008  DiVO VIP
-	0009  Alteon Gigabit Ethernet
-		10a9 8002  Acenic Gigabit Ethernet
+	0009  AceNIC Gigabit Ethernet
+		10a9 8002  AceNIC Gigabit Ethernet
 	0010  AMP Video I/O
 	0011  GRIP
 	0012  SGH PSHAC GSN
@@ -2278,12 +2553,18 @@
 	1147  VScom 020 2 port parallel adaptor
 	2724  Thales PCSM Security Card
 	9030  PCI <-> IOBus Bridge Hot Swap
+		10b5 2862  Alpermann+Velte PCL PCI LV (3V/5V): Timecode Reader Board
+		10b5 2906  Alpermann+Velte PCI TS (3V/5V): Time Synchronisation Board
+		10b5 2940  Alpermann+Velte PCL PCI D (3V/5V): Timecode Reader Board
 		15ed 1002  MCCS 8-port Serial Hot Swap
 		15ed 1003  MCCS 16-port Serial Hot Swap
 	9036  9036
 	9050  PCI <-> IOBus Bridge
 		10b5 2036  SatPak GPS
+		10b5 2221  Alpermann+Velte PCL PCI LV: Timecode Reader Board
 		10b5 2273  SH-ARC SoHard ARCnet card
+		10b5 2431  Alpermann+Velte PCL PCI D: Timecode Reader Board
+		10b5 2905  Alpermann+Velte PCI TS: Time Synchronisation Board
 		10b5 9050  MP9050
 		1522 0001  RockForce 4 Port V.90 Data/Fax/Voice Modem
 		1522 0002  RockForce 2 Port V.90 Data/Fax/Voice Modem
@@ -2295,6 +2576,10 @@
 		15ed 1001  Macrolink MCCS 16-port Serial
 		15ed 1002  Macrolink MCCS 8-port Serial Hot Swap
 		15ed 1003  Macrolink MCCS 16-port Serial Hot Swap
+# Sorry, there was a typo
+		5654 2036  OpenSwitch 6 Telephony card
+# Sorry, there was a typo
+		5654 3132  OpenSwitch 12 Telephony card
 		5654 5634  OpenLine4 Telephony Card
 		d531 c002  PCIntelliCAN 2xSJA1000 CAN bus
 		d84d 4006  EX-4006 1P
@@ -2317,7 +2602,17 @@
 	9054  PCI <-> IOBus Bridge
 		10b5 2455  Wessex Techology PHIL-PCI
 		10b5 2696  Innes Corp AM Radcap card
+		10b5 2717  Innes Corp Auricon card
+		10b5 2844  Innes Corp TVS Encoder card
 		12d9 0002  PCI Prosody Card rev 1.5
+		16df 0011  PIKA PrimeNet MM PCI
+		16df 0012  PIKA PrimeNet MM cPCI 8
+		16df 0013  PIKA PrimeNet MM cPCI 8 (without CAS Signaling Option)
+		16df 0014  PIKA PrimeNet MM cPCI 4
+		16df 0015  PIKA Daytona MM
+		16df 0016  PIKA InLine MM
+	9056  Francois
+		10b5 2979  CellinkBlade 11 - CPCI board VoATM AAL1
 	9060  9060
 	906d  9060SD
 		125c 0640  Aries 16000P
@@ -2326,6 +2621,7 @@
 		10b5 9080  9080 [real subsystem ID not set]
 		129d 0002  Aculab PCI Prosidy card
 		12d9 0002  PCI Prosody Card
+		12df 4422  4422PCI ["Do-All" Telemetry Data Aquisition System]
 	bb04  B&B 3PCIOSD1A Isolated PCI Serial
 10b6  Madge Networks
 	0001  Smart 16/4 PCI Ringnode
@@ -2358,17 +2654,22 @@
 	1006  MINI PCI type 3B Data Fax Modem
 	1007  Mini PCI 56k Winmodem
 		10b7 615c  Mini PCI 56K Modem
-	1700  3c940 1000Base?
+	1201  3c982-TXM 10/100baseTX Dual Port A [Hydra]
+	1202  3c982-TXM 10/100baseTX Dual Port B [Hydra]
+	1700  3c940 10/100/1000Base-T [Marvell]
+		1043 80eb  P4P800 Mainboard
+		10b7 0010  3C940 Gigabit LOM Ethernet Adapter
+		10b7 0020  3C941 Gigabit LOM Ethernet Adapter
 	3390  3c339 TokenLink Velocity
 	3590  3c359 TokenLink Velocity XL
 		10b7 3590  TokenLink Velocity XL Adapter (3C359/359B)
-	4500  3c450 Cyclone/unknown
+	4500  3c450 HomePNA [Tornado]
 	5055  3c555 Laptop Hurricane
-	5057  3c575 [Megahertz] 10/100 LAN CardBus
+	5057  3c575 Megahertz 10/100 LAN CardBus [Boomerang]
 		10b7 5a57  3C575 Megahertz 10/100 LAN Cardbus PC Card
-	5157  3c575 [Megahertz] 10/100 LAN CardBus
+	5157  3cCFE575BT Megahertz 10/100 LAN CardBus [Cyclone]
 		10b7 5b57  3C575 Megahertz 10/100 LAN Cardbus PC Card
-	5257  3CCFE575CT Cyclone CardBus
+	5257  3cCFE575CT CardBus [Cyclone]
 		10b7 5c57  FE575C-3Com 10/100 LAN CardBus-Fast Ethernet
 	5900  3c590 10BaseT [Vortex]
 	5920  3c592 EISA 10mbps Demon/Vortex
@@ -2376,20 +2677,22 @@
 	5951  3c595 100BaseT4 [Vortex]
 	5952  3c595 100Base-MII [Vortex]
 	5970  3c597 EISA Fast Demon/Vortex
-	5b57  3c595 [Megahertz] 10/100 LAN CardBus
+	5b57  3c595 Megahertz 10/100 LAN CardBus [Boomerang]
 		10b7 5b57  3C575 Megahertz 10/100 LAN Cardbus PC Card
-	6055  3c556 Hurricane CardBus
-	6056  3c556B Hurricane CardBus
+	6000  3CRSHPW796 [OfficeConnect Wireless CardBus]
+	6001  3com 3CRWE154G72 [Office Connect Wireless LAN Adapter]
+	6055  3c556 Hurricane CardBus [Cyclone]
+	6056  3c556B CardBus [Tornado]
 		10b7 6556  10/100 Mini PCI Ethernet Adapter
-	6560  3CCFE656 Cyclone CardBus
+	6560  3cCFE656 CardBus [Cyclone]
 		10b7 656a  3CCFEM656 10/100 LAN+56K Modem CardBus
-	6561  3CCFEM656 10/100 LAN+56K Modem CardBus
+	6561  3cCFEM656 10/100 LAN+56K Modem CardBus
 		10b7 656b  3CCFEM656 10/100 LAN+56K Modem CardBus
-	6562  3CCFEM656 [id 6562] Cyclone CardBus
+	6562  3cCFEM656B 10/100 LAN+Winmodem CardBus [Cyclone]
 		10b7 656b  3CCFEM656B 10/100 LAN+56K Modem CardBus
-	6563  3CCFEM656B 10/100 LAN+56K Modem CardBus
+	6563  3cCFEM656B 10/100 LAN+56K Modem CardBus
 		10b7 656b  3CCFEM656 10/100 LAN+56K Modem CardBus
-	6564  3CCFEM656 [id 6564] Cyclone CardBus
+	6564  3cXFEM656C 10/100 LAN+Winmodem CardBus [Tornado]
 	7646  3cSOHO100-TX Hurricane
 	7770  3CRWE777 PCI(PLX) Wireless Adaptor [Airconnect]
 	7940  3c803 FDDILink UTP Controller
@@ -2397,13 +2700,13 @@
 	7990  3c805 FDDILink DAS Controller
 	8811  Token ring
 	9000  3c900 10BaseT [Boomerang]
-	9001  3c900 Combo [Boomerang]
-	9004  3c900B-TPO [Etherlink XL TPO]
+	9001  3c900 10Mbps Combo [Boomerang]
+	9004  3c900B-TPO Etherlink XL [Cyclone]
 		10b7 9004  3C900B-TPO Etherlink XL TPO 10Mb
-	9005  3c900B-Combo [Etherlink XL Combo]
+	9005  3c900B-Combo Etherlink XL [Cyclone]
 		10b7 9005  3C900B-Combo Etherlink XL Combo
-	9006  3c900B-TPC [Etherlink XL TPC]
-	900a  3c900B-FL [Etherlink XL FL]
+	9006  3c900B-TPC Etherlink XL [Cyclone]
+	900a  3c900B-FL 10base-FL [Cyclone]
 	9050  3c905 100BaseTX [Boomerang]
 	9051  3c905 100BaseT4 [Boomerang]
 	9055  3c905B 100BaseTX [Cyclone]
@@ -2428,21 +2731,23 @@
 		1028 0098  3C905B Fast Etherlink XL 10/100
 		1028 0099  3C905B Fast Etherlink XL 10/100
 		10b7 9055  3C905B Fast Etherlink XL 10/100
-	9056  3c905B-T4 [Fast EtherLink XL 10/100]
-	9058  3c905B-Combo [Deluxe Etherlink XL 10/100]
-	905a  3c905B-FX [Fast Etherlink XL FX 10/100]
+	9056  3c905B-T4 Fast EtherLink XL [Cyclone]
+	9058  3c905B Deluxe Etherlink 10/100/BNC [Cyclone]
+	905a  3c905B-FX Fast Etherlink XL FX 100baseFx [Cyclone]
 	9200  3c905C-TX/TX-M [Tornado]
 		1028 0095  3C920 Integrated Fast Ethernet Controller
 		1028 0097  3C920 Integrated Fast Ethernet Controller
+		1028 012a  3C920 Integrated Fast Ethernet Controller [Latitude C640]
 		10b7 1000  3C905C-TX Fast Etherlink for PC Management NIC
 		10b7 7000  10/100 Mini PCI Ethernet Adapter
-	9201  3C920B-EMB Integrated Fast Ethernet Controller
-	9300  3CSOHO100B-TX  [910-A01]
-	9800  3c980-TX [Fast Etherlink XL Server Adapter]
+		10f1 2466  Tiger MPX S2466 (3C920 Integrated Fast Ethernet Controller)
+	9201  3C920B-EMB Integrated Fast Ethernet Controller [Tornado]
+	9202  3Com 3C920B-EMB-WNM Integrated Fast Ethernet Controller
+	9210  3C920B-EMB-WNM Integrated Fast Ethernet Controller
+	9300  3CSOHO100B-TX 910-A01 [tulip]
+	9800  3c980-TX Fast Etherlink XL Server Adapter [Cyclone]
 		10b7 9800  3c980-TX Fast Etherlink XL Server Adapter
-	9805  3c980-TX 10/100baseTX NIC [Python-T]
-		10b7 1201  3c982-TXM 10/100baseTX Dual Port A [Hydra]
-		10b7 1202  3c982-TXM 10/100baseTX Dual Port B [Hydra]
+	9805  3c980-C 10/100baseTX NIC [Python-T]
 		10b7 9805  3c980 10/100baseTX NIC [Python-T]
 		10f1 2462  Thunder K7 S2462
 	9900  3C990-TX [Typhoon]
@@ -2458,9 +2763,10 @@
 		10b7 2102  3CR990-FX-97 Server [Typhoon Fiber 168-bit]
 	9908  3CR990SVR95 [Typhoon Server 56-bit]
 	9909  3CR990SVR97 [Typhoon Server 168-bit]
+	990a  3C990SVR [Typhoon Server]
 	990b  3C990SVR [Typhoon Server]
 10b8  Standard Microsystems Corp [SMC]
-	0005  83C170QF
+	0005  83c170 EPIC/100 Fast Ethernet Adapter
 		1055 e000  LANEPIC 10/100 [EVB171Q-PCI]
 		1055 e002  LANEPIC 10/100 [EVB171G-PCI]
 		10b8 a011  EtherPower II 10/100
@@ -2468,7 +2774,7 @@
 		10b8 a015  EtherPower II 10/100
 		10b8 a016  EtherPower II 10/100
 		10b8 a017  EtherPower II 10/100
-	0006  LANEPIC
+	0006  83c175 EPIC/100 Fast Ethernet Adapter
 		1055 e100  LANEPIC Cardbus Fast Ethernet Adapter
 		1055 e102  LANEPIC Cardbus Fast Ethernet Adapter
 		1055 e300  LANEPIC Cardbus Fast Ethernet Adapter
@@ -2478,6 +2784,8 @@
 		13a2 8006  LANEPIC Cardbus Fast Ethernet Adapter
 	1000  FDC 37c665
 	1001  FDC 37C922
+# 802.11g card
+	2802  SMC2802W [EZ Connect g]
 	a011  83C170QF
 	b106  SMC34C90
 10b9  ALi Corporation
@@ -2522,6 +2830,7 @@
 	3151  M3151
 	3307  M3307
 	3309  M3309
+	3323  M3325 Video/Audio Decoder
 	5212  M4803
 	5215  MS4803
 	5217  M5217H
@@ -2543,7 +2852,7 @@
 		1014 0506  ThinkPad R30
 	5453  M5453 PCI AC-Link Controller Modem Device
 	5455  M5455 PCI AC-Link Controller Audio Device
-	5457  Intel 537 [M5457 AC-Link Modem]
+	5457  M5457 AC'97 Modem Controller
 # Same but more usefull for driver's lookup
 	5459  SmartLink SmartPCI561 56K Modem
 # SmartLink PCI SoftModem
@@ -2554,6 +2863,9 @@
 		10b9 7101  ALI M7101 Power Management Controller
 10ba  Mitsubishi Electric Corp.
 	0301  AccelGraphics AccelECLIPSE
+	0304  AccelGALAXY A2100 [OEM Evans & Sutherland]
+	0308  Tornado 3000 [OEM Evans & Sutherland]
+	1002  VG500 [VolumePro Volume Rendering Accelerator]
 10bb  Dapha Electronics Corporation
 10bc  Advanced Logic Research
 10bd  Surecom Technology
@@ -2594,6 +2906,7 @@
 		10f7 8312  MagicGraph 128XD
 	0005  NM2200 [MagicGraph 256AV]
 		1014 00dd  ThinkPad 570
+		1028 0088  Latitude CPi A400XT
 	0006  NM2360 [MagicMedia 256ZX]
 	0016  NM2380 [MagicMedia 256XL+]
 		10c8 0016  MagicMedia 256XL+
@@ -2725,7 +3038,7 @@
 		1102 1024  CT6932 RIVA TNT2 Value 32Mb
 		1102 102c  CT6931 RIVA TNT2 Value [Jumper]
 		1462 8808  MSI-8808
-		1554 1041  PixelView RIVA TNT2 M64 32MB
+		1554 1041  Pixelview RIVA TNT2 M64
 	002e  NV6 [Vanta]
 	002f  NV6 [Vanta]
 	0060  nForce2 ISA Bridge
@@ -2781,9 +3094,11 @@
 	0150  NV15 [GeForce2 GTS/Pro]
 		1043 4016  V7700 AGP Video Card
 		107d 2840  WinFast GeForce2 GTS with TV output
+		107d 2842  WinFast GeForce 2 Pro
 		1462 8831  Creative GeForce2 Pro
 	0151  NV15DDR [GeForce2 Ti]
 		1043 405f  V7700Ti
+		1462 5506  Creative 3D Blaster Geforce2 Titanium
 	0152  NV15BR [GeForce2 Ultra, Bladerunner]
 		1048 0c56  GLADIAC Ultra
 	0153  NV15GL [Quadro2 Pro]
@@ -2798,16 +3113,23 @@
 	0174  NV17 [GeForce4 440 Go]
 	0175  NV17 [GeForce4 420 Go]
 	0176  NV17 [GeForce4 420 Go 32M]
+		4c53 1090  Cx9 / Vx9 mainboard
+	0177  NV17 [GeForce4 460 Go]
 	0178  NV17GL [Quadro4 550 XGL]
 	0179  NV17 [GeForce4 440 Go 64M]
+		10de 0179  GeForce4 MX (Mac)
 	017a  NV17GL [Quadro4 200/400 NVS]
 	017b  NV17GL [Quadro4 550 XGL]
 	017c  NV17GL [Quadro4 550 GoGL]
 	0181  NV18 [GeForce4 MX 440 AGP 8x]
 		1043 806f  V9180 Magic
 		1462 8880  MS-StarForce GeForce4 MX 440 with AGP8X
+		1462 8900  MS-8890 GeForce 4 MX440 AGP8X
+		1462 9350  MSI Geforce4 MX T8X with AGP8X
+		147b 8f0d  Siluro GF4 MX-8X
 	0182  NV18 [GeForce4 MX 440SE AGP 8x]
 	0183  NV18 [GeForce4 MX 420 AGP 8x]
+	0185  NV18 [GeForce4 MX 4000 AGP 8x]
 	0188  NV18GL [Quadro4 580 XGL]
 	018a  NV18GL [Quadro4 NVS AGP 8x]
 	018b  NV18GL [Quadro4 380 XGL]
@@ -2822,7 +3144,7 @@
 	01b7  nForce AGP to PCI Bridge
 	01b8  nForce PCI-to-PCI bridge
 	01bc  nForce IDE
-	01c1  Intel 537 [nForce MC97 Modem]
+	01c1  nForce AC'97 Modem Controller
 	01c2  nForce USB Controller
 	01c3  nForce Ethernet Controller
 	01e0  nForce2 AGP (different version?)
@@ -2863,21 +3185,42 @@
 	0309  NV30GL [Quadro FX 1000]
 	0311  NV31 [GeForce FX 5600 Ultra]
 	0312  NV31 [GeForce FX 5600]
+	0314  NV31 [GeForce FX 5600XT]
+	031a  NV31M [GeForce FX Go 5600]
+	031c  NVIDIA Quadro FX 700 Go
 	0321  NV34 [GeForce FX 5200 Ultra]
 	0322  NV34 [GeForce FX 5200]
+		1462 9171  MS-8917 (FX5200-T128)
+	0324  NV34M [GeForce FX Go 5200]
+		1071 8160  MIM2000
+	0328  NV34M [GeForce FX Go 5200]
+	0329  NV34M [GeForce FX Go5200]
 	032b  NV34GL [Quadro FX 500]
+	032c  NV34GLM [GeForce FX Go 5300]
 	0330  NV35 [GeForce FX 5900 Ultra]
 	0331  NV35 [GeForce FX 5900]
+	0332  NV35 [GeForce FX 5900XT]
+	0333  NV38 [GeForce FX 5950 Ultra]
 	0338  NV35GL [Quadro FX 3000]
+	0341  NV 36 [GeForce 5700 Ultra]
+	0342  NV 36 [GeForce 5700]
 10df  Emulex Corporation
 	1ae5  LP6000 Fibre Channel Host Adapter
+	1ae6  LP 8000 Fibre Channel Host Adapter Alternate ID (JX1:2-3, JX2:1-2)
+	1ae7  LP 8000 Fibre Channel Host Adapter Alternate ID (JX1:2-3, JX2:2-3)
 	f085  LP850 Fibre Channel Adapter
 	f095  LP952 Fibre Channel Adapter
 	f098  LP982 Fibre Channel Adapter
 	f700  LP7000 Fibre Channel Host Adapter
+	f701  LP 7000EFibre Channel Host Adapter Alternate ID (JX1:2-3, JX2:1-2)
 	f800  LP8000 Fibre Channel Host Adapter
+	f801  LP 8000 Fibre Channel Host Adapter Alternate ID (JX1:2-3, JX2:1-2)
 	f900  LP9000 Fibre Channel Host Adapter
+	f901  LP 9000 Fibre Channel Host Adapter Alternate ID (JX1:2-3, JX2:1-2)
 	f980  LP9802 Fibre Channel Adapter
+	f981  LP 9802 Fibre Channel Host Adapter Alternate ID
+	f982  LP 9802 Fibre Channel Host Adapter Alternate ID
+	fa00  LP10000 Fibre Channel Host Adapter
 10e0  Integrated Micro Solutions Inc.
 	5026  IMS5026/27/28
 	5027  IMS5027
@@ -2900,6 +3243,7 @@
 10e6  Gainbery Computer Products Inc.
 10e7  Vadem
 10e8  Applied Micro Circuits Corp.
+	1072  INES GPIB-PCI (AMCC5920 based)
 	2011  Q-Motion Video Capture/Edit board
 	4750  S5930 [Matchmaker]
 	5920  S5920
@@ -2926,6 +3270,8 @@
 	5000  CyberPro 5000
 	5050  CyberPro 5050
 	5202  CyberPro 5202
+# CyberPro5202 Audio Function
+	5252  CyberPro5252
 10eb  Artists Graphics
 	0101  3GA
 	8111  Twist3 Frame Grabber
@@ -2943,6 +3289,7 @@
 	8139  RTL-8139/8139C/8139C+
 		1025 8920  ALN-325
 		1025 8921  ALN-325
+		1071 8160  MIM2000
 		10bd 0320  EP-320X-R
 		10ec 8139  RT8139
 		1186 1300  DFE-538TX
@@ -2954,17 +3301,20 @@
 		1429 d010  ND010
 		1432 9130  EN-9130TX
 		1436 8139  RT8139
+		1458 e000  GA-7VM400M Motherboard
 		146c 1439  FE-1439TX
 		1489 6001  GF100TXRII
 		1489 6002  GF100TXRA
 		149c 139a  LFE-8139ATX
 		149c 8139  LFE-8139TX
+		1799 5000  F5D5000 PCI Card/Desktop Network PCI Card
 		2646 0001  EtheRx
 		8e2e 7000  KF-230TX
 		8e2e 7100  KF-230TX/2
 		a0a0 0007  ALN-325C
-	8169  RTL-8169
+	8169  RTL-8169 Gigabit Ethernet
 		1371 434e  ProG-2000L
+	8180  RTL8180L 802.11b MAC
 	8197  SmartLAN56 56K Modem
 10ed  Ascii Corporation
 	7310  V7310
@@ -2975,6 +3325,7 @@
 	3fc3  RME Digi96/8 Pad
 	3fc4  RME Digi9652 (Hammerfall)
 	3fc5  RME Hammerfall DSP
+	3fc6  RME Hammerfall DSP MADI
 	8381  Ellips Santos Frame Grabber
 10ef  Racore Computer Products, Inc.
 	8154  M815x Token Ring Adapter
@@ -2991,7 +3342,7 @@
 10f9  PC Direct
 10fa  Truevision
 	000c  TARGA 1000
-10fb  Thesys Gesellschaft für Mikroelektronik mbH
+10fb  Thesys Gesellschaft fÃ¼r Mikroelektronik mbH
 	186f  TH 6255
 10fc  I-O Data Device, Inc.
 # What's in the cardbus end of a Sony ACR-A01 card, comes with newer Vaio CD-RW drives
@@ -3029,7 +3380,10 @@
 	0004  SB Audigy
 		1102 0051  SB0090 Audigy Player
 		1102 0053  SB0090 Audigy Player/OEM
+		1102 0058  SB0090 Audigy Player/OEM
+		1102 2002  SB Audigy 2 ZS (SB0350)
 	0006  [SB Live! Value] EMU10k1X
+	0007  SB Audigy LS
 	4001  SB Audigy FireWire Port
 		1102 0010  SB Audigy FireWire Port
 	7002  SB Live! MIDI/Game Port
@@ -3037,6 +3391,7 @@
 	7003  SB Audigy MIDI/Game port
 		1102 0040  SB Audigy MIDI/Game Port
 	7004  [SB Live! Value] Input device controller
+	7005  SB Audigy LS MIDI/Game port
 	8064  SB0100 [SBLive! 5.1 OEM]
 	8938  Ectiva EV1938
 1103  Triones Technologies, Inc.
@@ -3055,6 +3410,13 @@
 	1105  REALmagic Xcard MPEG 1/2/3/4 DVD Decoder
 	8300  REALmagic Hollywood Plus DVD Decoder
 	8400  EM840x REALmagic DVD/MPEG-2 Audio/Video Decoder
+	8401  EM8401 REALmagic DVD/MPEG-2 A/V Decoder
+	8470  EM8470 REALmagic DVD/MPEG-4 A/V Decoder
+	8471  EM8471 REALmagic DVD/MPEG-4 A/V Decoder
+	8475  EM8475 REALmagic DVD/MPEG-4 A/V Decoder
+	8476  EM8476 REALmagic DVD/MPEG-4 A/V Decoder
+	8485  EM8485 REALmagic DVD/MPEG-4 A/V Decoder
+	8486  EM8486 REALmagic DVD/MPEG-4 A/V Decoder
 1106  VIA Technologies, Inc.
 	0102  Embedded VIA Ethernet Controller
 	0130  VT6305 1394.A Controller
@@ -3068,10 +3430,13 @@
 	0505  VT82C505
 # Shares chip with :0576. The VT82C576M has :1571 instead of :0561.
 	0561  VT82C576MV
-	0571  VT82C586A/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE
+	0571  VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE
 		1019 0985  P6VXA Motherboard
+		1019 0a81  L7VTA v1.0 Motherboard (KT400-8235)
 		1043 8052  VT8233A Bus Master ATA100/66/33 IDE
 		1043 808c  A7V8X motherboard
+		1043 80a1  A7V8X-X motherboard rev. 1.01
+		1043 80ed  A7V600 motherboard
 		1106 0571  VT82C586/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE
 		1179 0001  Magnia Z310
 		1297 f641  FX41 motherboard
@@ -3112,10 +3477,14 @@
 	1106  VT82C570MV
 	1571  VT82C576M/VT82C586
 	1595  VT82C595/97 [Apollo VP2/97]
-	3038  USB
+# This is *not* USB 2.0 as the existing entry suggests
+	3038  VT82xxxxx UHCI USB 1.1 Controller
 		0925 1234  USB Controller
 		1019 0985  P6VXA Motherboard
-		1043 808c  A7V8X motherboard
+		1019 0a81  L7VTA v1.0 Motherboard (KT400-8235)
+		1043 808c  VT6202 USB2.0 4 port controller
+		1043 80a1  A7V8X-X motherboard
+		1043 80ed  A7V600 motherboard
 		1179 0001  Magnia Z310
 		1458 5004  GA-7VAX Mainboard
 	3040  VT82C586B ACPI
@@ -3126,6 +3495,7 @@
 	3044  IEEE 1394 Host Controller
 	3050  VT82C596 Power Management
 	3051  VT82C596 Power Management
+	3053  VT6105M [Rhine-III]
 	3057  VT82C686 [Apollo Super ACPI]
 		1019 0985  P6VXA Motherboard
 		1043 8033  A7V Mainboard
@@ -3134,17 +3504,23 @@
 		1043 8042  A7V133/A7V133-C Mainboard
 		1179 0001  Magnia Z310
 	3058  VT82C686 AC97 Audio Controller
+		0e11 0097  SoundMax Digital Integrated Audio
 		0e11 b194  Soundmax integrated digital audio
 		1019 0985  P6VXA Motherboard
 		1106 4511  Onboard Audio on EP7KXA
 		1458 7600  Onboard Audio
 		1462 3091  MS-6309 Onboard Audio
 		15dd 7609  Onboard Audio
-	3059  VT8233/A/8235 AC97 Audio Controller
+	3059  VT8233/A/8235/8237 AC97 Audio Controller
+		1019 0a81  L7VTA v1.0 Motherboard (KT400-8235)
 		1043 8095  A7V8X Motherboard (Realtek ALC650 codec)
+		1043 80b0  A7V600 motherboard (ADI AD1980 codec [SoundMAX])
+		1106 3059  L7VMM2 Motherboard
 		1297 c160  FX41 motherboard (Realtek ALC650 codec)
 		1458 a002  GA-7VAX Onboard Audio (Realtek ALC650)
+		1462 3800  KT266 onboard audio
 	3065  VT6102 [Rhine-II]
+		1043 80a1  A7V8X-X Motherboard
 		1106 0102  VT6102 [Rhine II] Embeded Ethernet Controller on VT8235
 		1186 1400  DFE-530TX rev A
 		1186 1401  DFE-530TX rev B
@@ -3160,10 +3536,14 @@
 	3102  VT8662 Host Bridge
 	3103  VT8615 Host Bridge
 	3104  USB 2.0
+		1019 0a81  L7VTA v1.0 Motherboard (KT400-8235)
 		1043 808c  A7V8X motherboard
+		1043 80a1  A7V8X-X motherboard rev 1.01
+		1043 80ed  A7V600 motherboard
 		1297 f641  FX41 motherboard
 		1458 5004  GA-7VAX Mainboard
 	3106  VT6105 [Rhine-III]
+		1186 1403  DFE-530TX rev C
 	3109  VT8233C PCI to ISA Bridge
 	3112  VT8361 [KLE133] Host Bridge
 	3116  VT8375 [KM266/KL266] Host Bridge
@@ -3176,17 +3556,33 @@
 	3133  VT3133 Host Bridge
 	3147  VT8233A ISA Bridge
 	3148  P4M266 Host Bridge
+	3149  VIA VT6420 SATA RAID Controller
+		1043 80ed  A7V600 motherboard
+		1462 7020  MSI Neo K8T FIS2R mainboard
 	3156  P/KN266 Host Bridge
+# on ASUS P4P800
+	3164  VT6410 ATA133 RAID controller
 	3168  VT8374 P4X400 Host Controller/AGP Bridge
 	3177  VT8235 ISA Bridge
+		1019 0a81  L7VTA v1.0 Motherboard (KT400-8235)
 		1043 808c  A7V8X motherboard
+		1043 80a1  A7V8X-X motherboard
 		1297 f641  FX41 motherboard
 		1458 5001  GA-7VAX Mainboard
-	3189  VT8377 [KT400 AGP] Host Bridge
+	3188  VT8385 [K8T800 AGP] Host Bridge
+	3189  VT8377 [KT400/KT600 AGP] Host Bridge
 		1043 807f  A7V8X motherboard
 		1458 5000  GA-7VAX Mainboard
+# Updated the entry to the proper "chip [name] desc" format
+	3205  VT8378 [KM400] Chipset Host Bridge
+		1458 5000  GA-7VM400M Motherboard
+	3227  VT8237 ISA bridge [K8T800 South]
+		1043 80ed  A7V600 motherboard
 	5030  VT82C596 ACPI [Apollo PRO]
 	6100  VT85C100A [Rhine II]
+# S3 Graphics UniChromeâ„¢ 2D/3D Graphics with motion compensation
+	7205  VT8378 [S3 UniChrome] Integrated Video
+		1458 d000  GA-7VM400M Motherboard
 	8231  VT8231 [PCI-to-ISA Bridge]
 	8235  VT8235 ACPI
 	8305  VT8363/8365 [KT133/KM133 AGP]
@@ -3207,7 +3603,10 @@
 	b103  VT8615 AGP Bridge
 	b112  VT8361 [KLE133] AGP Bridge
 	b168  VT8235 PCI Bridge
+	b188  VT8237 PCI bridge [K8T800 South]
 	b198  VT8237 PCI Bridge
+# 32-Bit PCI bus master Ethernet MAC with standard MII interface
+	d104  VT8237 Integrated Fast Ethernet Controller
 1107  Stratus Computers
 	0576  VIA VT82C570MV [Apollo] (Wrong vendor ID!)
 1108  Proteon, Inc.
@@ -3231,6 +3630,7 @@
 	007c  FSC Remote Service Controller, shared memory device
 	007d  FSC Remote Service Controller, SMIC device
 	2102  DSCC4 WAN adapter
+	2104  Eicon Diva 2.02 compatible passive ISDN card
 	4021  SIMATIC NET CP 5512 (Profibus and MPI Cardbus Adapter)
 	4942  FPGA I-Bus Tracer for MBD
 	6120  SZB6120
@@ -3256,13 +3656,15 @@
 		103c 1207  EN-1207D Fast Ethernet Adapter
 		1113 1211  EN-1207D Fast Ethernet Adapter
 	1216  EN-1216 Ethernet Adapter
+		1113 2242  EN2242 10/100 Ethernet Mini-PCI Card
 		111a 1020  SpeedStream 1020 PCI 10/100 Ethernet Adaptor [EN-1207F-TX ?]
 	1217  EN-1217 Ethernet Adapter
 	5105  10Mbps Network card
 	9211  EN-1207D Fast Ethernet Adapter
 		1113 9211  EN-1207D Fast Ethernet Adapter
-	9511  Fast Ethernet Adapter
+	9511  21x4x DEC-Tulip compatible Fast Ethernet
 1114  Atmel Corporation
+	0506  802.11b Wireless Network Adaptor (at76c506)
 1115  3D Labs
 1116  Data Translation
 	0022  DT3001
@@ -3283,14 +3685,18 @@
 	0003  GDT 6120/6520
 	0004  GDT 6530
 	0005  GDT 6550
-	0006  GDT 6x17
-	0007  GDT 6x27
+	0006  GDT 6117/6517
+	0007  GDT 6127/6527
 	0008  GDT 6537
-	0009  GDT 6557
+	0009  GDT 6557/6557-ECC
 	000a  GDT 6115/6515
 	000b  GDT 6125/6525
 	000c  GDT 6535
 	000d  GDT 6555
+	0010  GDT 6115/6515
+	0011  GDT 6125/6525
+	0012  GDT 6535
+	0013  GDT 6555/6555-ECC
 	0100  GDT 6117RP/6517RP
 	0101  GDT 6127RP/6527RP
 	0102  GDT 6537RP
@@ -3345,7 +3751,8 @@
 	0211  GDT 6529RD/6629RD
 	0260  GDT 7519RN/7619RN
 	0261  GDT 7529RN/7629RN
-	0300  GDT Raid Controller
+	02ff  GDT MAXRP
+	0300  GDT NEWRX
 111a  Efficient Networks, Inc
 	0000  155P-MF1 (FPGA)
 	0002  155P-MF1 (ASIC)
@@ -3361,6 +3768,7 @@
 		111a 0a09  ENI-3060 ADSL (VPI=<0..15>)
 	0007  SpeedStream ADSL
 		111a 1001  ENI-3061 ADSL [ASIC]
+	1203  SpeedStream 1023 Wireless PCI Adapter
 111b  Teledyne Electronic Systems
 111c  Tricord Systems Inc.
 	0001  Powerbis Bridge
@@ -3409,11 +3817,32 @@
 	7135  SAA7135 Audio+video broadcast decoder
 	7145  SAA7145
 	7146  SAA7146
+		110a 0000  Fujitsu/Siemens DVB-C card rev1.5
+		110a ffff  Fujitsu/Siemens DVB-C card rev1.5
+		1131 4f56  KNC1 DVB-S Budget
+		1131 4f61  Fujitsu-Siemens Activy DVB-S Budget
 		114b 2003  DVRaptor Video Edit/Capture Card
 		11bd 0006  DV500 Overlay
 		11bd 000a  DV500 Overlay
+		13c2 0000  Siemens/Technotrend/Hauppauge DVB card rev1.3
+		13c2 0001  Technotrend/Hauppauge DVB card rev1.3 or rev1.6
+		13c2 0002  Technotrend/Hauppauge DVB card rev2.1
+		13c2 0003  Technotrend/Hauppauge DVB card rev2.1
+		13c2 0004  Technotrend/Hauppauge DVB card rev2.1
+		13c2 0006  Technotrend/Hauppauge DVB card rev1.3 or rev1.6
+		13c2 0008  Technotrend/Hauppauge DVB-T
+		13c2 000a  Octal/Technotrend DVB-C for iTV
+		13c2 1003  Technotrend-Budget / Hauppauge WinTV-NOVA-S DVB card
+		13c2 1004  Technotrend-Budget / Hauppauge WinTV-NOVA-C DVB card
+		13c2 1005  Technotrend-Budget / Hauppauge WinTV-NOVA-T DVB card
+		13c2 100c  Technotrend-Budget / Hauppauge WinTV-NOVA-CI DVB card
+		13c2 100f  Technotrend-Budget / Hauppauge WinTV-NOVA-CI DVB card
+		13c2 1011  Technotrend-Budget / Hauppauge WinTV-NOVA-T DVB card
+		13c2 1013  SATELCO Multimedia DVB
+		13c2 1102  Technotrend/Hauppauge DVB card rev2.1
 1132  Mitel Corp.
-1133  Eicon Technology Corporation
+# This is the new official company name. See disclaimer on www.eicon.com for details!
+1133  Eicon Networks Corporation
 	7901  EiconCard S90
 	7902  EiconCard S90
 	7911  EiconCard S91
@@ -3478,6 +3907,8 @@
 		1133 1c0c  Diva Server V-PRI/E1-30 Cornet NQ 3
 	e01e  Diva Server 2PRI
 	e020  Diva Server 4PRI
+	e024  Diva Server Analog-4P
+	e028  Diva Server Analog-8P
 1134  Mercury Computer Systems
 	0001  Raceway Bridge
 1135  Fuji Xerox Co Ltd
@@ -3545,24 +3976,37 @@
 		1148 5843  FDDI SK-5843 (SK-NET FDDI-LP64)
 		1148 5844  FDDI SK-5844 (SK-NET FDDI-LP64 DAS)
 	4200  Token Ring adapter
-	4300  Gigabit Ethernet
-		1148 9821  SK-9821 (1000Base-T single link)
-		1148 9822  SK-9822 (1000Base-T dual link)
-		1148 9841  SK-9841 (1000Base-LX single link)
-		1148 9842  SK-9842 (1000Base-LX dual link)
-		1148 9843  SK-9843 (1000Base-SX single link)
-		1148 9844  SK-9844 (1000Base-SX dual link)
-		1148 9861  SK-9861 (1000Base-SX VF45 single link)
-		1148 9862  SK-9862 (1000Base-SX VF45 dual link)
-# Information got from SysKonnekt
-		1148 9871  SK-9871 (1000Base-ZX single link)
-# Information got from SysKonnekt
-		1148 9872  SK-9872 (1000Base-ZX dual link)
-		1259 2970  AT-2970SX [Allied Telesyn]
-		1259 2972  AT-2970T [Allied Telesyn]
-		1259 2975  AT-2970SX [Allied Telesyn]
-		1259 2977  AT-2970T [Allied Telesyn]
-	4320  SK-98xx Gigabit Ethernet Server Adapter
+	4300  SK-98xx Gigabit Ethernet Server Adapter
+		1148 9821  SK-9821 Gigabit Ethernet Server Adapter (SK-NET GE-T)
+		1148 9822  SK-9822 Gigabit Ethernet Server Adapter (SK-NET GE-T dual link)
+		1148 9841  SK-9841 Gigabit Ethernet Server Adapter (SK-NET GE-LX)
+		1148 9842  SK-9842 Gigabit Ethernet Server Adapter (SK-NET GE-LX dual link)
+		1148 9843  SK-9843 Gigabit Ethernet Server Adapter (SK-NET GE-SX)
+		1148 9844  SK-9844 Gigabit Ethernet Server Adapter (SK-NET GE-SX dual link)
+		1148 9861  SK-9861 Gigabit Ethernet Server Adapter (SK-NET GE-SX Volition)
+		1148 9862  SK-9862 Gigabit Ethernet Server Adapter (SK-NET GE-SX Volition dual link)
+		1148 9871  SK-9871 Gigabit Ethernet Server Adapter (SK-NET GE-ZX)
+		1148 9872  SK-9872 Gigabit Ethernet Server Adapter (SK-NET GE-ZX dual link)
+		1259 2970  AT-2970SX Gigabit Ethernet Adapter
+		1259 2971  AT-2970LX Gigabit Ethernet Adapter
+		1259 2972  AT-2970TX Gigabit Ethernet Adapter
+		1259 2973  AT-2971SX Gigabit Ethernet Adapter
+		1259 2974  AT-2971T Gigabit Ethernet Adapter
+		1259 2975  AT-2970SX/2SC Gigabit Ethernet Adapter
+		1259 2976  AT-2970LX/2SC Gigabit Ethernet Adapter
+		1259 2977  AT-2970TX/2TX Gigabit Ethernet Adapter
+	4320  SK-98xx V2.0 Gigabit Ethernet Adapter
+		1148 0121  Marvell RDK-8001 Adapter
+		1148 0221  Marvell RDK-8002 Adapter
+		1148 0321  Marvell RDK-8003 Adapter
+		1148 0421  Marvell RDK-8004 Adapter
+		1148 0621  Marvell RDK-8006 Adapter
+		1148 0721  Marvell RDK-8007 Adapter
+		1148 0821  Marvell RDK-8008 Adapter
+		1148 0921  Marvell RDK-8009 Adapter
+		1148 1121  Marvell RDK-8011 Adapter
+		1148 1221  Marvell RDK-8012 Adapter
+		1148 3221  SK-9521 V2.0 10/100/1000Base-T Adapter
 		1148 5021  SK-9821 V2.0 Gigabit Ethernet 10/100/1000Base-T Adapter
 		1148 5041  SK-9841 V2.0 Gigabit Ethernet 1000Base-LX Adapter
 		1148 5043  SK-9843 V2.0 Gigabit Ethernet 1000Base-SX Adapter
@@ -3570,7 +4014,8 @@
 		1148 5061  SK-9861 V2.0 Gigabit Ethernet 1000Base-SX Adapter
 		1148 5071  SK-9871 V2.0 Gigabit Ethernet 1000Base-ZX Adapter
 		1148 9521  SK-9521 10/100/1000Base-T Adapter
-	4400  Gigabit Ethernet
+	4400  SK-9Dxx Gigabit Ethernet Adapter
+	4500  SK-9Mxx Gigabit Ethernet Adapter
 1149  Win System Corporation
 114a  VMIC
 	5579  VMIPCI-5579 (Reflective Memory Card)
@@ -3611,14 +4056,28 @@
 		114f 0031  DataFire RAS BRI S/T Adapter
 	0026  AccelePort 4r 920
 	0027  AccelePort Xr 920
+	0028  ClassicBoard 4
+	0029  ClassicBoard 8
 	0034  AccelePort 2r 920
 	0035  DataFire DSP T1/E1/PRI cPCI
 	0040  AccelePort Xp
-	0042  AccelePort 2p PCI
+	0042  AccelePort 2p
+	0043  AccelePort 4p
+	0044  AccelePort 8p
+	0045  AccelePort 16p
+	004e  AccelePort 32p
 	0070  Datafire Micro V IOM2 (Europe)
 	0071  Datafire Micro V (Europe)
 	0072  Datafire Micro V IOM2 (North America)
 	0073  Datafire Micro V (North America)
+	00b0  Digi Neo 4
+	00b1  Digi Neo 8
+	00c8  Digi Neo 2 DB9
+	00c9  Digi Neo 2 DB9 PRI
+	00ca  Digi Neo 2 RJ45
+	00cb  Digi Neo 2 RJ45 PRI
+	00d0  ClassicBoard 4 422
+	00d1  ClassicBoard 8 422
 	6001  Avanstar
 1150  Thinking Machines Corp
 1151  JAE Electronics Inc.
@@ -3665,6 +4124,7 @@
 	000f  Cardbus Ethernet 10/100
 		1014 0183  10/100 EtherJet Cardbus Adapter
 		115d 0183  Cardbus Ethernet 10/100
+	00d4  Mini-PCI K56Flex Modem
 	0101  Cardbus 56k modem
 		115d 1081  Cardbus 56k Modem
 	0103  Cardbus Ethernet + 56k Modem
@@ -3698,6 +4158,8 @@
 	0015  CMIC-GC Host Bridge
 	0016  CMIC-GC Host Bridge
 	0017  GCNB-LE Host Bridge
+	0101  CIOB-X2
+	0110  CIOB-E I/O Bridge with Gigabit Ethernet
 	0200  OSB4 South Bridge
 	0201  CSB5 South Bridge
 		4c53 1080  CT8 mainboard
@@ -3709,10 +4171,11 @@
 	0220  OSB4/CSB5 OHCI USB Controller
 		4c53 1080  CT8 mainboard
 	0221  CSB6 OHCI USB Controller
-	0225  GCLE Host Bridge
+	0225  CSB5 LPC bridge
 # cancelled
 		4c53 1080  CT8 mainboard
 	0227  GCLE-2 Host Bridge
+	0230  CSB5 LPC bridge
 		4c53 1080  CT8 mainboard
 1167  Mutoh Industries Inc
 1168  Thine Electronics Inc
@@ -3769,6 +4232,7 @@
 		1014 0185  ThinkPad A/T/X Series
 		104d 80df  Vaio PCG-FX403
 		104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
+		14ef 0220  PCD-RP-220S
 	0477  RL5c477
 	0478  RL5c478
 		1014 0184  ThinkPad A30p (2653-64G)
@@ -3792,7 +4256,11 @@
 		1186 1301  DFE-530TX+ 10/100 Ethernet Adapter
 	1340  DFE-690TXD CardBus PC Card
 	1561  DRP-32TXD Cardbus PC Card
-	4000  DL2K Ethernet
+	3300  DWL-510 2.4GHz Wireless PCI Adapter
+	3b05  DWL-G650+ CardBus PC Card
+	4000  DL2000-based Gigabit Ethernet
+	4c00  Gigabit Ethernet Adapter
+	8400  D-Link DWL-650+ CardBus PC Card
 1187  Advanced Technology Laboratories, Inc.
 1188  Shima Seiki Manufacturing Ltd.
 1189  Matsushita Electronics Co Ltd
@@ -3845,6 +4313,7 @@
 1195  Ratoc System Inc
 1196  Hytec Electronics Ltd
 1197  Gage Applied Sciences, Inc.
+	010c  CompuScope 82G 8bit 2GS/s Analog Input Card
 1198  Lambda Systems Inc
 1199  Attachmate Corporation
 119a  Mind Share, Inc.
@@ -3868,11 +4337,20 @@
 11a9  InnoSys Inc.
 	4240  AMCC S933Q Intelligent Serial Card
 11aa  Actel
-11ab  Galileo Technology Ltd.
+# (formerly Galileo technologies)
+11ab  Marvell
 	0146  GT-64010/64010A System Controller
+	4320  Yukon Gigabit Ethernet 10/100/1000Base-T Adapter
 	4611  GT-64115 System Controller
 	4620  GT-64120/64120A/64121A System Controller
 	4801  GT-48001
+	5040  MV88SX5040 4-port SATA I PCI-X Controller
+	5041  MV88SX5041 4-port SATA I PCI-X Controller
+	5080  MV88SX5080 8-port SATA I PCI-X Controller
+	5081  MV88SX5081 8-port SATA I PCI-X Controller
+	6041  MV88SX6041 4-port SATA II PCI-X Controller
+	6081  MV88SX6081 8-port SATA II PCI-X Controller
+	6460  MV64360/64361/64362 System Controller
 	f003  GT-64010 Primary Image Piranha Image Generator
 11ac  Canon Information Systems Research Aust.
 11ad  Lite-On Communications Inc
@@ -3886,6 +4364,7 @@
 		11ad c001  LNE100TX [ver 2.0]
 11ae  Aztech System Ltd
 11af  Avid Technology Inc.
+	0001  [Cinema]
 11b0  V3 Semiconductor Inc.
 	0002  V300PSC
 	0292  V292PBC [Am29030/40 Bridge]
@@ -3966,6 +4445,7 @@
 	0444  LT WinModem
 	0445  LT WinModem
 		8086 2203  PRO/100+ MiniPCI (probably an Ambit U98.003.C.00 combo card)
+		8086 2204  PRO/100+ MiniPCI on Armada E500
 	0446  LT WinModem
 	0447  LT WinModem
 	0448  WinModem 56k
@@ -4011,6 +4491,7 @@
 	0461  V90 WildWire Modem
 	0462  V90 WildWire Modem
 	0480  Venus Modem (V90, 56KFlex)
+	048c  V.92 56K WinModem
 	5801  USB
 	5802  USS-312 USB Controller
 # 4 port PCI USB Controller made by Agere (formely Lucent)
@@ -4047,6 +4528,7 @@
 11d2  Intercom Inc.
 11d3  Trancell Systems Inc
 11d4  Analog Devices
+	1535  Blackfin BF535 processor
 	1805  SM56 PCI modem
 	1889  AD1889 sound chip
 11d5  Ikon Corporation
@@ -4107,7 +4589,7 @@
 		11f6 2011  RL100-ATX
 	2201  ReadyLink 100TX (Winbond W89C840)
 		11f6 2011  ReadyLink 100TX
-	9881  RL100TX
+	9881  RL100TX Fast Ethernet
 11f7  Scientific Atlanta
 11f8  PMC-Sierra Inc.
 	7375  PM7375 [LASAR-155 ATM SAR]
@@ -4117,18 +4599,28 @@
 11fc  Silicon Magic
 11fd  High Street Consultants
 11fe  Comtrol Corporation
-	0001  RocketPort 8 Oct
-	0002  RocketPort 8 Intf
-	0003  RocketPort 16 Intf
-	0004  RocketPort 32 Intf
-	0005  RocketPort Octacable
-	0006  RocketPort 8J
-	0007  RocketPort 4-port
-	0008  RocketPort 8-port
-	0009  RocketPort 16-port
-	000a  RocketPort Plus Quadcable
-	000b  RocketPort Plus Octacable
-	000c  RocketPort 8-port Modem
+	0001  RocketPort 32 port w/external I/F
+	0002  RocketPort 8 port w/external I/F
+	0003  RocketPort 16 port w/external I/F
+	0004  RocketPort 4 port w/quad cable
+	0005  RocketPort 8 port w/octa cable
+	0006  RocketPort 8 port w/RJ11 connectors
+	0007  RocketPort 4 port w/RJ11 connectors
+	0008  RocketPort 8 port w/ DB78 SNI (Siemens) connector
+	0009  RocketPort 16 port w/ DB78 SNI (Siemens) connector
+	000a  RocketPort Plus 4 port
+	000b  RocketPort Plus 8 port
+	000c  RocketModem 6 port
+	000d  RocketModem 4-port
+	000e  RocketPort Plus 2 port RS232
+	000f  RocketPort Plus 2 port RS422
+	0801  RocketPort UPCI 32 port w/external I/F
+	0802  RocketPort UPCI 8 port w/external I/F
+	0803  RocketPort UPCI 16 port w/external I/F
+	0805  RocketPort UPCI 8 port w/octa cable
+	080c  RocketModem III 8 port
+	080d  RocketModem III 4 port
+	0903  RocketPort Compact PCI 16 port w/external I/F
 	8015  RocketPort 4-port UART 16954
 11ff  Scion Corporation
 1200  CSS Corporation
@@ -4186,6 +4678,14 @@
 		1025 1016  Travelmate 612 TX
 	6972  OZ6912 Cardbus Controller
 		1179 0001  Magnia Z310
+	7110  OZ711Mx MultiMediaBay Accelerator
+	7112  OZ711EC1/M1 SmartCardBus MultiMediaBay Controller
+	7113  OZ711EC1 SmartCardBus Controller
+	7114  OZ711M1 SmartCardBus MultiMediaBay Controller
+	71e2  OZ711E2 SmartCardBus Controller
+	7212  OZ711M2 SmartCardBus MultiMediaBay Controller
+	7213  OZ6933E CardBus Controller
+	7223  OZ711M3 SmartCardBus MultiMediaBay Controller
 1218  Hybricon Corp.
 1219  First Virtual Corporation
 121a  3Dfx Interactive, Inc.
@@ -4228,6 +4728,7 @@
 		121a 0061  Voodoo3 3500 TV (PAL)
 		121a 0062  Voodoo3 3500 TV (SECAM)
 	0009  Voodoo 4 / Voodoo 5
+		121a 0003  Voodoo5 PCI 5500
 		121a 0009  Voodoo5 AGP 5500/6000
 	0057  Voodoo 3/3000 [Avenger]
 121b  Advanced Telecommunications Modules
@@ -4253,6 +4754,7 @@
 1224  Interactive Images
 1225  Power I/O, Inc.
 1227  Tech-Source
+	0006  Raptor GFX 8P
 1228  Norsk Elektro Optikk A/S
 1229  Data Kinesis Inc.
 122a  Integrated Telecom
@@ -4314,6 +4816,7 @@
 	0e00  Fritz!PCI v2.0 ISDN
 	1100  C2 ISDN
 	1200  T1 ISDN
+	2700  Fritz!Card DSL SL
 1245  A.P.D., S.A.
 1246  Dipix Technologies, Inc.
 1247  Xylon Research, Inc.
@@ -4350,10 +4853,13 @@
 1258  Gilbarco, Inc.
 1259  Allied Telesyn International
 	2560  AT-2560 Fast Ethernet Adapter (i82557B)
+	a117  RTL81xx Fast Ethernet
+	a120  21x4x DEC-Tulip compatible 10/100 Ethernet
 125a  ABB Power Systems
 125b  Asix Electronics Corporation
-	1400  ALFA GFC2204
+	1400  ALFA GFC2204 Fast Ethernet
 125c  Aurora Technologies, Inc.
+	0101  Saturn 4520P
 	0640  Aries 16000P
 125d  ESS Technology
 	0000  ES336H Fax Modem (Early Model)
@@ -4395,13 +4901,16 @@
 		14fe 0429  ES56-PI Data Fax Modem
 125e  Specialvideo Engineering SRL
 125f  Concurrent Technologies, Inc.
-1260  Harris Semiconductor
+1260  Intersil Corporation
 	3873  Prism 2.5 Wavelan chipset
 		1186 3501  DWL-520 Wireless PCI Adapter
+		1186 3700  DWL-520 Wireless PCI Adapter, Rev E1
 		1668 0414  HWP01170-01 802.11b PCI Wireless Adapter
+		16a5 1601  AIR.mate PC-400 PCI Wireless LAN Adapter
 		1737 3874  WMP11 Wireless 802.11b PCI Adapter
 		8086 2513  Wireless 802.11b MiniPCI Adapter
-	3890  D-Links DWL-g650 A1
+	3890  Intersil ISL3890 [Prism GT/Prism Duette]
+		17cf 0014  Ovislink WL-5400PCM, Prism GT
 	8130  HMP8130 NTSC/PAL Video Decoder
 	8131  HMP8131 NTSC/PAL Video Decoder
 1261  Matsushita-Kotobuki Electronics Industries, Ltd.
@@ -4421,9 +4930,12 @@
 126a  Lexmark International, Inc.
 126b  Adax, Inc.
 126c  Northern Telecom
+	1211  10/100BaseTX [RTL81xx]
+	126c  802.11b Wireless Ethernet Adapter
 126d  Splash Technology, Inc.
 126e  Sumitomo Metal Industries, Ltd.
 126f  Silicon Motion, Inc.
+	0501  SM501 VoyagerGX
 	0710  SM710 LynxEM
 	0712  SM712 LynxEM+
 	0720  SM720 Lynx3DM
@@ -4498,6 +5010,7 @@
 		1274 2000  Creative Sound Blaster AudioPCI128
 		1274 2003  Creative SoundBlaster AudioPCI 128
 		1274 5880  Creative Sound Blaster AudioPCI128
+		1274 8001  Sound Blaster 16PCI 4.1ch
 		1458 a000  5880 AudioPCI On Motherboard 6OXET
 		1462 6880  5880 AudioPCI On Motherboard MS-6188 1.00
 		270f 2001  5880 AudioPCI On Motherboard 6CTR
@@ -4637,12 +5150,14 @@
 1281  Yokogawa Electric Corporation
 1282  Davicom Semiconductor, Inc.
 	9009  Ethernet 100/10 MBit
-	9100  Ethernet 100/10 MBit
-	9102  Ethernet 100/10 MBit
+	9100  21x4x DEC-Tulip compatible 10/100 Ethernet
+	9102  21x4x DEC-Tulip compatible 10/100 Ethernet
 	9132  Ethernet 100/10 MBit
 1283  Integrated Technology Express, Inc.
 	673a  IT8330G
+	8212  IT/ITE8212 Dual channel ATA RAID
 	8330  IT8330G
+	8872  IT8874F PCI Dual Serial Port Controller
 	8888  IT8888F PCI to ISA Bridge with SMB
 	8889  IT8889F PCI to ISA Bridge
 	e886  IT8330G
@@ -4688,6 +5203,7 @@
 12a1  Simpact Associates, Inc.
 12a2  Newgen Systems Corporation
 12a3  Lucent Technologies
+	8105  T8105 H100 Digital Switch
 12a4  NTT Electronics Technology Company
 12a5  Vision Dynamics Ltd.
 12a6  Scalable Networks, Inc.
@@ -4706,6 +5222,7 @@
 	0002  AceNIC Gigabit Ethernet (Copper)
 		10a9 8002  Acenic Gigabit Ethernet
 		12ae 0002  Gigabit Ethernet-T (3C986-T)
+	00fa  Farallon PN9100-T Gigabit Ethernet
 12af  TDK USA Corp
 12b0  Jorge Scientific Corp
 12b1  GammaLink
@@ -4807,6 +5324,7 @@
 12d9  Aculab PLC
 	0002  PCI Prosody
 	0004  cPCI Prosody
+	0005  Aculab E1/T1 PCI card
 12da  True Time Inc.
 12db  Annapolis Micro Systems, Inc
 12dc  Symicron Computer Communication Ltd.
@@ -4889,7 +5407,8 @@
 1304  Juniper Networks
 1305  Netphone, Inc
 1306  Duet Technologies
-1307  Computer Boards
+# Formerly ComputerBoards
+1307  Measurement Computing
 	0001  PCI-DAS1602/16
 	000b  PCI-DIO48H
 	000c  PCI-PDISO8
@@ -4926,6 +5445,7 @@
 	0037  PCI-DAS64/M3/16
 	004c  PCI-DAS1000
 	004d  PCI-QUAD04
+	0052  PCI-DAS4020/12
 1308  Jato Technologies Inc.
 	0001  NetCelerator Adapter
 		1308 0001  NetCelerator Adapter
@@ -4942,11 +5462,15 @@
 1313  Yaskawa Electric Co.
 1316  Teradyne Inc
 1317  Linksys
-	0981  Fast Ethernet 10/100
-	0985  Network Everywhere Fast Ethernet 10/100 model NC100
-	1985  Fast Ethernet 10/100
+	0981  21x4x DEC-Tulip compatible 10/100 Ethernet
+	0985  NC100 Network Everywhere Fast Ethernet 10/100
+	1985  21x4x DEC-Tulip compatible 10/100 Ethernet
+	2850  HSP MicroModem 56
+	8201  [ADMtek] SP906B_V2 Wireless LAN adapter
+		1317 8201  SMC2635W 802.11b (11mbps) wireless lan pcmcia (cardbus) card
+	9511  21x4x DEC-Tulip compatible 10/100 Ethernet
 1318  Packet Engines Inc.
-	0911  PCI Ethernet Adapter
+	0911  GNIC-II PCI Gigabit Ethernet [Hamachi]
 1319  Fortemedia, Inc
 	0801  Xwave QS3000A [FM801]
 	0802  Xwave QS3000A [FM801 game port]
@@ -5083,6 +5607,7 @@
 	01c0  SSCLP-200/300
 135d  ABB Network Partner AB
 135e  Sealevel Systems Inc
+	5101  Route 56.PCI - Multi-Protocol Serial Interface (Zilog Z16C32)
 	7101  Single Port RS-232/422/485/530
 	7201  Dual Port RS-232/422/485 Interface
 	7202  Dual Port RS-232 Interface
@@ -5109,6 +5634,7 @@
 136f  Applied Magic Inc
 1370  ATL Products
 1371  CNet Technology Inc
+	434e  GigaCard Network Adapter
 1373  Silicon Vision Inc
 1374  Silicom Ltd
 1375  Argosystems Inc
@@ -5117,6 +5643,7 @@
 1378  Telemann Co. Ltd
 1379  Asahi Kasei Microsystems Co Ltd
 137a  Mark of the Unicorn Inc
+	0001  PCI-324 Audiowire Interface
 137b  PPT Vision
 137c  Iwatsu Electric Co Ltd
 137d  Dynachip Corporation
@@ -5125,15 +5652,15 @@
 1380  Sanritz Automation Co Ltd
 1381  Brains Co. Ltd
 1382  Marian - Electronic & Software
+	2088  Marc-8 MIDI 8 channel audio card
 1383  Controlnet Inc
 1384  Reality Simulation Systems Inc
 1385  Netgear
 	4100  802.11b Wireless Adapter (MA301)
 	4105  MA311 802.11b wireless adapter
-	620a  GA620
+	620a  GA620 Gigabit Ethernet
 	622a  GA622
-	630a  GA630
-	f311  FA311
+	630a  GA630 Gigabit Ethernet
 1386  Video Domain Technologies
 1387  Systran Corp
 1388  Hitachi Information Technology Co Ltd
@@ -5150,6 +5677,7 @@
 1392  Medialight Inc
 1393  Moxa Technologies Co Ltd
 	1040  Smartio C104H/PCI
+	1141  Industrio CP-114
 	1680  Smartio C168H/PCI
 	2040  Intellio CP-204J
 	2180  Intellio C218 Turbo PCI
@@ -5229,6 +5757,9 @@
 13c4  Phase Metrics
 13c5  Alphi Technology Corp
 13c6  Condor Engineering Inc
+	0520  CEI-520 A429 Card
+	0620  CEI-620 A429 Card
+	0820  CEI-820 A429 Card
 13c7  Blue Chip Technology Ltd
 13c8  Apptech Inc
 13c9  Eaton Corporation
@@ -5239,11 +5770,13 @@
 13ce  Cocom A/S
 13cf  Studio Audio & Video Ltd
 13d0  Techsan Electronics Co Ltd
-# http://www.b2c2inc.com/products/pc-specs.html
-	2103  B2C2 Sky2PC PCI [SkyStar2]
+	2103  B2C2 FlexCopII DVB chip / Technisat SkyStar2 DVB card
+	2200  B2C2 FlexCopIII DVB chip / Technisat SkyStar2 DVB card
 13d1  Abocom Systems Inc
 	ab02  ADMtek Centaur-C rev 17 [D-Link DFE-680TX] CardBus Fast Ethernet Adapter
+	ab03  21x4x DEC-Tulip compatible 10/100 Ethernet
 	ab06  RTL8139 [FE2000VX] CardBus Fast Ethernet Attached Port Adapter
+	ab08  21x4x DEC-Tulip compatible 10/100 Ethernet
 13d2  Shark Multimedia Inc
 13d3  IMC Networks
 13d4  Graphics Microsystems Inc
@@ -5285,6 +5818,7 @@
 	1401  Zentai Fibre Channel Adapter
 13f5  Kansai Electric Co. Ltd
 13f6  C-Media Electronics Inc
+	0011  CMI8738
 	0100  CM8338A
 		13f6 ffff  CMI8338/C3DX PCI Audio Device
 	0101  CM8338B
@@ -5305,6 +5839,9 @@
 13fc  Computer Peripherals International
 13fd  Micro Science Inc
 13fe  Advantech Co. Ltd
+	1600  PCI-1612 4-port RS-232/422/485 PCI Communication Card
+	1752  PCI-1752
+	1754  PCI-1754
 	1756  PCI-1756
 13ff  Silicon Spice Inc
 1400  Artx Inc
@@ -5319,9 +5856,15 @@
 	0100  Lava Dual Serial
 	0101  Lava Quatro A
 	0102  Lava Quatro B
+	0120  Quattro-PCI A
+	0121  Quattro-PCI B
+	0180  Lava Octo A
+	0181  Lava Octo B
 	0200  Lava Port Plus
 	0201  Lava Quad A
 	0202  Lava Quad B
+	0220  Lava Quattro PCI Ports A/B
+	0221  Lava Quattro PCI Ports C/D
 	0500  Lava Single Serial
 	0600  Lava Port 650
 	8000  Lava Parallel
@@ -5342,6 +5885,7 @@
 1411  Ikos Systems Inc
 1412  IC Ensemble Inc
 	1712  ICE1712 [Envy24]
+		1412 d638  M-Audio Delta 410
 	1724  ICE1724 [Envy24HT]
 1413  Addonics
 1414  Microsoft Corporation
@@ -5382,10 +5926,12 @@
 142c  Minton Optic Industry Co Ltd
 142d  Pix stream Inc
 142e  Vitec Multimedia
+	4020  VM2-2 [Video Maker 2] MPEG1/2 Encoder
 142f  Radicom Research Inc
 1430  ITT Aerospace/Communications Division
 1431  Gilat Satellite Networks
 1432  Edimax Computer Co.
+	9130  RTL81xx Fast Ethernet
 1433  Eltec Elektronik GmbH
 1435  Real Time Devices US Inc.
 1436  CIS Technology Inc
@@ -5443,6 +5989,10 @@
 1460  DYNARC INC
 1461  Avermedia Technologies Inc
 1462  Micro-Star International Co., Ltd.
+	8725  NVIDIA NV25 [GeForce4 Ti 4600] VGA Adapter
+# MSI G4Ti4800, 128MB DDR SDRAM, TV-Out, DVI-I
+	9000  NVIDIA NV28 [GeForce4 Ti 4800] VGA Adapter
+	9119  NVIDIA NV31 [GeForce FX 5600XT] VGA Adapter
 1463  Fast Corporation
 1464  Interactive Circuits & Systems Ltd
 1465  GN NETTEST Telecom DIV.
@@ -5533,7 +6083,7 @@
 14b5  Creamware GmBH
 	0200  Scope
 	0300  Pulsar
-	0400  Pulsar2
+	0400  PulsarSRB
 	0600  Pulsar2
 	0800  DSP-Board
 	0900  DSP-Board
@@ -5548,8 +6098,9 @@
 	0340  PC4800
 	0350  PC4800
 	4500  PC4500
-	4800  PC4800
+	4800  Cisco Aironet 340 802.11b WLAN Adapter/Aironet PC4800
 	a504  Cisco Aironet Wireless 802.11b
+	a505  Cisco Aironet CB20a 802.11a Wireless LAN Adapter
 14ba  INTERNIX Inc.
 14bb  SEMTECH Corporation
 14bc  Globespan Semiconductor Inc.
@@ -5558,6 +6109,7 @@
 14bf  SPIDER Communications Inc.
 14c0  COMPAL Electronics Inc
 14c1  MYRICOM Inc.
+	8043  Myrinet 2000 Scalable Cluster Interconnect
 14c2  DTK Computer
 14c3  MEDIATEK Corp.
 14c4  IWASAKI Information Systems Co Ltd
@@ -5598,11 +6150,10 @@
 14d7  Hirakawa Hewtech Corp
 14d8  HOPF Elektronik GmBH
 14d9  Alpha Processor Inc
+	0010  AP1011 HyperTransport-PCI Bridge [Sturgeon]
 14da  National Aerospace Laboratories
 14db  AFAVLAB Technology Inc
 	2120  TK9902
-	2180  P028
-	2182  P030
 14dc  Amplicon Liveline Ltd
 	0000  PCI230
 	0001  PCI242
@@ -5649,6 +6200,10 @@
 		0e11 009a  NC7770 Gigabit Server Adapter (PCI-X, 10/100/1000-T)
 		0e11 00c1  NC6770 Gigabit Server Adapter (PCI-X, 1000-SX)
 		1028 0121  Broadcom BCM5701 1000Base-T
+		103c 128a  HP 1000Base-T (PCI) [A7061A]
+		103c 128b  HP 1000Base-SX (PCI) [A7073A]
+		103c 12a4  HP Core Lan 1000Base-T
+		103c 12c1  HP IOX Core Lan 1000Base-T [A7109AX]
 		10a9 8010  SGI IO9 Gigabit Ethernet (Copper)
 		10a9 8011  SGI Gigabit Ethernet (Copper)
 		10a9 8012  SGI Gigabit Ethernet (Fiber)
@@ -5684,16 +6239,28 @@
 		1166 1648  NetXtreme CIOB-E 1000Base-T
 	164d  NetXtreme BCM5702FE Gigabit Ethernet
 	1653  NetXtreme BCM5705 Gigabit Ethernet
+	1654  NetXtreme BCM5705_2 Gigabit Ethernet
+	1658  NetXtreme BCM5720 Gigabit Ethernet
+	1659  NetXtreme BCM5721 Gigabit Ethernet
 	165d  NetXtreme BCM5705M Gigabit Ethernet
+	165e  NetXtreme BCM5705M_2 Gigabit Ethernet
+	166e  NetXtreme BCM5705F Gigabit Ethernet
+	1676  NetXtreme BCM5750 Gigabit Ethernet
+	1677  NetXtreme BCM5751 Gigabit Ethernet
+	167c  NetXtreme BCM5750M Gigabit Ethernet
+	167d  NetXtreme BCM5751M Gigabit Ethernet
+	167e  NetXtreme BCM5751F Gigabit Ethernet
 	1696  NetXtreme BCM5782 Gigabit Ethernet
+		103c 12bc  HP d530 CMT (DG746A)
 		14e4 000d  NetXtreme BCM5782 1000Base-T
 	169c  NetXtreme BCM5788 Gigabit Ethernet
-	16a6  NetXtreme BCM5702 Gigabit Ethernet
+	169d  NetXtreme BCM5789 Gigabit Ethernet
+	16a6  NetXtreme BCM5702X Gigabit Ethernet
 		0e11 00bb  NC7760 Gigabit Server Adapter (PCI-X, 10/100/1000-T)
 		1028 0126  BCM5702 1000Base-T
 		14e4 000c  BCM5702 1000Base-T
 		14e4 8009  BCM5702 1000Base-T
-	16a7  NetXtreme BCM5703 Gigabit Ethernet
+	16a7  NetXtreme BCM5703X Gigabit Ethernet
 		0e11 00ca  NC7771 Gigabit Server Adapter (PCI-X, 10,100,1000-T)
 		0e11 00cb  NC7781 Gigabit Server Adapter (PCI-X, 10,100,1000-T)
 		14e4 0009  NetXtreme BCM5703 1000Base-T
@@ -5702,25 +6269,33 @@
 		14e4 800a  NetXtreme BCM5703 1000Base-T
 	16a8  NetXtreme BCM5704S Gigabit Ethernet
 		10b7 2001  3C998-SX Dual Port 1000-SX PCI-X
-	16c6  NetXtreme BCM5702 Gigabit Ethernet
+	16c6  NetXtreme BCM5702A3 Gigabit Ethernet
 		10b7 1100  3C1000B-T 10/100/1000 PCI
 		14e4 000c  BCM5702 1000Base-T
 		14e4 8009  BCM5702 1000Base-T
 	16c7  NetXtreme BCM5703 Gigabit Ethernet
+		103c 12c3  HP Combo FC/GigE-SX [A9782A]
+		103c 12ca  HP Combo FC/GigE-T [A9784A]
 		14e4 0009  NetXtreme BCM5703 1000Base-T
 		14e4 000a  NetXtreme BCM5703 1000Base-SX
+	170d  NetXtreme BCM5901 Gigabit Ethernet
+	170e  NetXtreme BCM5901_2 Gigabit Ethernet
 	4210  BCM4210 iLine10 HomePNA 2.0
 	4211  BCM4211 iLine10 HomePNA 2.0 + V.90 56k modem
 	4212  BCM4212 v.90 56k modem
 	4301  BCM4301 802.11b
 	4320  BCM94306 802.11g
+		1028 0001  TrueMobile 1300 WLAN Mini-PCI Card
 		1737 4320  WPC54G
+	4324  BCM4309 802.11a/b/g
+		1028 0001  Truemobile 1400
 	4401  BCM4401 100Base-T
 		1043 80a8  A7V8X motherboard
 	4402  BCM4402 Integrated 10/100BaseT
 	4410  BCM4413 iLine32 HomePNA 2.0
 	4411  BCM4413 V.90 56k modem
 	4412  BCM4413 10/100BaseT
+	5690  BCM5690 12-port Multi-Layer Gigabit Ethernet Switch
 	5820  BCM5820 Crypto Accelerator
 	5821  BCM5821 Crypto Accelerator
 14e5  Pixelfusion Ltd
@@ -5730,6 +6305,7 @@
 14e9  GARNETS System CO Ltd
 14ea  Planex Communications, Inc
 	ab06  FNW-3603-TX CardBus Fast Ethernet
+	ab07  RTL81xx RealTek Ethernet
 14eb  SEIKO EPSON Corp
 14ec  ACQIRIS
 14ed  DATAKINETICS Ltd
@@ -5872,6 +6448,7 @@
 		13e0 8d85  Compaq Stinger
 		14f1 2004  Dynalink 56PMi
 	8234  RS8234 ATM SAR Controller [ServiceSAR Plus]
+	8800  Winfast TV2000 XP
 14f2  MOBILITY Electronics
 	0120  EV1000 bridge
 	0121  EV1000 Parallel port
@@ -5894,6 +6471,7 @@
 14fe  ARCHTEK TELECOM Corp
 14ff  TWINHEAD INTERNATIONAL Corp
 1500  DELTA Electronics, Inc
+	1360  RTL81xx RealTek Ethernet
 1501  BANKSOFT CANADA Ltd
 1502  MITSUBISHI ELECTRIC LOGISTICS SUPPORT Co Ltd
 1503  KAWASAKI LSI USA Inc
@@ -5926,8 +6504,10 @@
 1514  TFL LAN Inc
 1515  Advent design
 1516  MYSON Technology Inc
+	0800  MTD-8xx 100/10M Ethernet PCI Adapter
 	0803  SURECOM EP-320X-S 100/10M Ethernet PCI Adapter
 		1320 10bd  SURECOM EP-320X-S 100/10M Ethernet PCI Adapter
+	0891  MTD-8xx 100/10M Ethernet PCI Adapter
 1517  ECHOTEK Corp
 1518  PEP MODULAR Computers GmbH
 1519  TELEFON AKTIEBOLAGET LM Ericsson
@@ -5952,12 +6532,19 @@
 		1522 0600  RockForce+ 2 Port V.90 Data/Fax/Voice Modem
 		1522 0700  RockForce+ 4 Port V.90 Data/Fax/Voice Modem
 		1522 0800  RockForceOCTO+ 8 Port V.92/V.44 Data/Fax/Voice Modem
+		1522 0c00  RockForceDUO+ 2 Port V.92/V.44 Data, V.34 Super-G3 Fax, Voice Modem
+		1522 0d00  RockForceQUATRO+ 4 Port V.92/V.44 Data, V.34 Super-G3 Fax, Voice Modem
+# this is a correction to a recent entry. 1522:0E00 should be 1522:1D00
+		1522 1d00  RockForceOCTO+ 8 Port V.92/V.44 Data, V.34 Super-G3 Fax, Voice Modem
 1523  MUSIC Semiconductors
 1524  ENE Technology Inc
+	0510  CB710 Memory Card Reader Controller
 	1211  CB1211 Cardbus Controller
 	1225  CB1225 Cardbus Controller
 	1410  CB1410 Cardbus Controller
+	1411  CB710 Cardbus Controller
 	1420  CB1420 Cardbus Controller
+	1421  CB720 Cardbus Controller
 1525  IMPACT Technologies
 1526  ISS, Inc
 1527  SOLECTRON
@@ -5977,9 +6564,11 @@
 1535  EVERGREEN Technologies Inc
 1537  DATALEX COMMUNCATIONS
 1538  ARALION Inc
+	0303  ARS106S Ultra ATA 133/100/66 Host Controller
 1539  ATELIER INFORMATIQUES et ELECTRONIQUE ETUDES S.A.
 153a  ONO SOKKI
 153b  TERRATEC Electronic GmbH
+	1144  Aureon 5.1
 153c  ANTAL Electronic
 153d  FILANET Corp
 153e  TECHWELL Inc
@@ -6123,6 +6712,7 @@
 15ab  Bluesteel Networks Inc
 15ac  North Atlantic Instruments
 15ad  VMWare Inc
+	0405  [VMWare SVGA II] PCI Display Adapter
 	0710  Virtual SVGA
 15ae  Amersham Pharmacia Biotech
 15b0  Zoltrix International Ltd
@@ -6130,6 +6720,9 @@
 15b2  Mosaid Technologies Inc
 15b3  Mellanox Technology
 	5274  MT21108 InfiniBridge
+	5a44  MT23108 InfiniHost
+	5a45  MT23108 InfiniHost (Tavor)
+	5a46  MT23108 PCI Bridge
 15b4  CCI/TRIAD
 15b5  Cimetrics Inc
 15b6  Texas Memory Systems Inc
@@ -6139,7 +6732,9 @@
 15ba  Impacct Technology Corp
 15bb  Portwell Inc
 15bc  Agilent Technologies
-	2929  E2929A PCI/PCI-X Bus Analyzer
+	2922  64 Bit, 133MHz PCI-X Exerciser & Protocol Checker
+	2928  64 Bit, 66MHz PCI Exerciser & Analyzer
+	2929  64 Bit, 133MHz PCI-X Analyzer & Exerciser
 15bd  DFI Inc
 15be  Sola Electronics
 15bf  High Tech Computer Corp (HTC)
@@ -6149,6 +6744,7 @@
 15c3  Taiwan Mycomp Co Ltd
 15c4  EVSX Inc
 15c5  Procomp Informatics Ltd
+	8010  1394b - 1394 Firewire 3-Port Host Adapter Card
 15c6  Technical University of Budapest
 15c7  Tateyama System Laboratory Co Ltd
 	0349  Tateyama C-PCI PLC/NC card Rev.01A
@@ -6187,9 +6783,12 @@
 15e8  National Datacomm Corp
 	0130  Wireless PCI Card
 15e9  Pacific Digital Corp
+	1841  ADMA-100 DiscStaQ ATA Controller
 15ea  Tokyo Denshi Sekei K.K.
 15eb  Drsearch GmbH
 15ec  Beckhoff GmbH
+	3101  FC3101 Profibus DP 1 Channel PCI
+	5102  FC5102
 15ed  Macrolink Inc
 15ee  In Win Development Inc
 15ef  Intelligent Paradigm Inc
@@ -6223,11 +6822,13 @@
 1619  FarSite Communications Ltd
 	0400  FarSync T2P (2 port X.21/V.35/V.24)
 	0440  FarSync T4P (4 port X.21/V.35/V.24)
+1626  TDK Semiconductor Corp.
+	8410  RTL81xx Fast Ethernet
 1629  Kongsberg Spacetec AS
 	1003  Format synchronizer v3.0
 	2002  Fast Universal Data Output
 1638  Standard Microsystems Corp [SMC]
-	1100  SMC2602W EZConnect / Addtron AWA-100
+	1100  SMC2602W EZConnect/Addtron AWA-100/Eumitcom WL11000
 163c  Smart Link Ltd.
 	3052  SmartLink SmartPCI562 56K Modem
 	5449  SmartPCI561 Modem
@@ -6239,27 +6840,69 @@
 165d  Hsing Tech. Enterprise Co., Ltd.
 1661  Worldspace Corp.
 1668  Actiontec Electronics Inc
+	0100  Mini-PCI bridge
+# Formerly SiByte, Inc.
+166d  Broadcom Corporation
+	0001  SiByte BCM1125/1125H/1250 System-on-a-Chip PCI
+	0002  SiByte BCM1125H/1250 System-on-a-Chip HyperTransport
 1681  Hercules
+# More specs, more accurate desc.
+	0010  Hercules 3d Prophet II Ultra 64MB [ 350 MHz NV15BR core, 128-bit DDR @ 460 MHz, 1.5v AGP4x  ]
+1688  CastleNet Technology Inc.
+	1170  WLAN 802.11b card
+168c  Atheros Communications, Inc.
+	0007  AR5000 802.11a Wireless Adapter
+	0011  AR5210 802.11a NIC
+	0012  AR5211 802.11ab NIC
+	0013  AR5212 802.11abg NIC
+		1186 3202  D-link DWL-G650 B3 Wireless cardbus adapter
+		1186 3203  DWL-G520 Wireless PCI Adapter
+		1186 3a94  C54C Wireless 801.11g cardbus
+		168c 0013  WG511T Wireless CardBus Adapter
+		168c 1025  DWL-G650B2 Wireless CardBus Adapter
+	1014  AR5212 802.11abg NIC
 16ab  Global Sun Technology Inc
+	1100  GL24110P
+	1101  PLX9052 PCMCIA-to-PCI Wireless LAN
 	1102  PCMCIA-to-PCI Wireless Network Bridge
+16ae  Safenet Inc
+	1141  SafeXcel-1141
 16be  Creatix Polymedia GmbH
 16ca  CENATEK Inc
 	0001  Rocket Drive DL
+16cd  Densitron Technologies
+# www.pikatechnologies.com
+16df  PIKA Technologies Inc.
 16ec  U.S. Robotics
+	00ff  USR997900 10/100 Mbps PCI Network Card
 	3685  Wireless Access PCI Adapter Model 022415
 16f6  VideoTele.com, Inc.
+# www.internetmachines.com
+1702  Internet Machines Corporation (IMC)
 1705  Digital First, Inc.
-170b  NetOctave Inc
+170b  NetOctave
+	0100  NSP2000-SSL crypto accelerator
 170c  YottaYotta Inc.
 172a  Accelerated Encryption
 1737  Linksys
+	1032  Gigabit Network Adapter
+		1737 0015  EG1032 v2 Instant Gigabit Network Adapter
+	1064  Gigabit Network Adapter
+		1737 0016  EG1064 v2 Instant Gigabit Network Adapter
+	ab08  21x4x DEC-Tulip compatible 10/100 Ethernet
+	ab09  21x4x DEC-Tulip compatible 10/100 Ethernet
 173b  Altima (nee Broadcom)
 	03e8  AC1000 Gigabit Ethernet
+	03e9  AC1001 Gigabit Ethernet
 	03ea  AC9100 Gigabit Ethernet
 		173b 0001  AC1002
+	03eb  AC1003 Gigabit Ethernet
 1743  Peppercon AG
 	8139  ROL/F-100 Fast Ethernet Adapter with ROL
+1749  RLX Technologies
 174b  PC Partner Limited
+174d  WellX Telecom SA
+175c  AudioScience Inc
 175e  Sanera Systems, Inc.
 1787  Hightech Information System Ltd.
 # also used by Struck Innovative Systeme for joint developments
@@ -6271,21 +6914,48 @@
 	0005  PROFIBUS
 	0006  AMCC HOTlink
 1799  Belkin
+	6001  Wireless PCI Card - F5D6001
+	6020  Wireless PCMCIA Card - F5D6020
+	6060  Wireless PDA Card - F5D6060
 17af  Hightech Information System Ltd.
+17b3  Hawking Technologies
+	ab08  PN672TX 10/100 Ethernet
+17b4  Indra Networks, Inc.
+	0011  WebEnhance 100 GZIP Compression Card
+17c0  Wistron Corp.
+17c2  Newisys, Inc.
 17cc  NetChip Technology, Inc
 	2280  USB 2.0
+# S2io ships 10Gb PCI-X Ethernet adapters www.s2io.com
+17d5  S2io Inc.
 1813  Ambient Technologies Inc
 	4000  HaM controllerless modem
 		16be 0001  V9x HAM Data Fax Modem
 	4100  HaM plus Data Fax Modem
 		16be 0002  V9x HAM 1394
+1814  RaLink
+	0101  Wireless PCI Adpator RT2400 / RT2460
+	0201  Ralink RT2500 802.11 Cardbus Reference Card
+1830  Credence Systems Corporation
 1851  Microtune, Inc.
 1852  Anritsu Corp.
+1867  Topspin Communications
+	5a44  MT23108 PCI-X HCA
+	5a45  MT23108 PCI-X HCA flash recovery
+	5a46  MT23108 PCI-X HCA bridge
 1888  Varisys Ltd
 	0301  VMFX1 FPGA PMC module
 	0601  VSM2 dual PMC carrier
 	0710  VS14x series PowerPC PCI board
 	0720  VS24x series PowerPC PCI board
+# found e.g. on KNC DVB-S card
+1894  KNC One
+18a1  Astute Networks Inc.
+18ca  XGI - Xabre Graphics Inc
+	0040  Volari V8
+18e6  MPL AG
+	0001  OSCI [Octal Serial Communication Interface]
+18fb  Resilience Corporation
 1a08  Sierra semiconductor
 	0000  SC15064
 1b13  Jaton Corp
@@ -6321,7 +6991,10 @@
 	0021  HB6 Universal PCI-PCI bridge (non-transparent mode)
 		4c53 1050  CT7 mainboard
 		4c53 1080  CT8 mainboard
+		4c53 10a0  CA3/CR3 mainboard
 		4c53 3010  PPCI mezzanine (32-bit PMC)
+		4c53 3011  PPCI mezzanine (64-bit PMC)
+	0026  HB2 PCI-PCI Bridge
 	101a  E.Band [AudioTrak Inca88]
 	101b  E.Band [AudioTrak Inca88]
 	8011  VXPro II Chipset
@@ -6356,7 +7029,17 @@
 		3d3d 0121  Oxygen VX1
 	000c  GLINT R3 [Oxygen VX1]
 		3d3d 0144  Oxygen VX1-4X AGP [Permedia 4]
+	000d  GLint R4 rev A
+	0011  GLint R4 rev B
+	0012  GLint R5 rev A
+	0013  GLint R5 rev B
+	0020  VP10 visual processor
+# P10 generic II
+	0022  VP10 visual processor
+	0024  VP9 visual processor
 	0100  Permedia II 2D+3D
+	07a1  Wildcat III 6210
+	07a3  Wildcat IV 7210
 	1004  Permedia
 	3d04  Permedia
 	ffff  Glint VGA
@@ -6379,11 +7062,16 @@
 4033  Addtron Technology Co, Inc.
 	1360  RTL8139 Ethernet
 4143  Digital Equipment Corp
+4144  Alpha Data
 416c  Aladdin Knowledge Systems
 	0100  AladdinCARD
 	0200  CPC
 4444  Internext Compression Inc
+	0016  iTVC16 (CX23416) MPEG-2 Encoder
+		0070 4009  WinTV PVR 250
 	0803  iTVC15 MPEG-2 Encoder
+		0070 4000  WinTV PVR-350
+		0070 4001  WinTV PVR-250
 4468  Bridgeport machines
 4594  Cogetec Informatique Inc
 45fb  Baldor Electric Company
@@ -6399,6 +7087,11 @@
 4b10  Buslogic Inc.
 4c48  LUNG HWA Electronics
 4c53  SBS Technologies
+	0000  PLUSTEST device
+		4c53 3000  PLUSTEST card (PC104+)
+		4c53 3001  PLUSTEST card (PMC)
+	0001  PLUSTEST-MM device
+		4c53 3002  PLUSTEST-MM card (PMC)
 4ca1  Seanix Technology Inc
 4d51  MediaQ Inc.
 	0200  MQ-200
@@ -6576,8 +7269,9 @@
 	0003  TURBOstor HFP-832 [HiPPI NIC]
 5654  VoiceTronix Pty Ltd
 5700  Netpower
+5851  Exacq Technologies
 6356  UltraStor
-6374  c't Magazin für Computertechnik
+6374  c't Magazin fÃ¼r Computertechnik
 	6773  GPPCI
 6409  Logitec Corp.
 6666  Decision Computer International Co.
@@ -6589,11 +7283,37 @@
 8008  Quancom Electronic GmbH
 	0010  WDOG1 [PCI-Watchdog 1]
 	0011  PWDOG2 [PCI-Watchdog 2]
+# Wrong ID used in subsystem ID of AsusTek PCI-USB2 PCI card.
+807d  Asustek Computer, Inc.
 8086  Intel Corp.
 	0007  82379AB
 	0008  Extended Express System Support Controller
-	0039  21145
+		0008 1000  WorldMark 4300 INCA ASIC
+	0039  21145 Fast Ethernet
 	0122  82437FX
+	0326  PCI Bridge Hub I/OxAPIC Interrupt Controller A
+	0327  PCI Bridge Hub I/OxAPIC Interrupt Controller B
+	0329  PCI Bridge Hub A
+	032a  PCI Bridge Hub B
+	032c  PCI Bridge Hub
+# A-segment bridge
+	0330  80332 [Dobson] I/O processor
+# A-segment IOAPIC
+	0331  80332 [Dobson] I/O processor
+# B-segment bridge
+	0332  80332 [Dobson] I/O processor
+# B-segment IOAPIC
+	0333  80332 [Dobson] I/O processor
+# Address Translation Unit (ATU)
+	0334  80332 [Dobson] I/O processor
+# PCI-X bridge
+	0335  80331 [Lindsay] I/O processor
+# Address Translation Unit (ATU)
+	0336  80331 [Lindsay] I/O processor
+# A-segment bridge
+	0340  41210 [Lanai] Serial to Parallel PCI Bridge
+# B-segment bridge
+	0341  41210 [Lanai] Serial to Parallel PCI Bridge
 	0482  82375EB
 	0483  82424ZX [Saturn]
 	0484  82378IB [SIO ISA Bridge]
@@ -6625,28 +7345,84 @@
 		8086 1004  PRO/1000 T Server Adapter
 		8086 2004  PRO/1000 T Server Adapter
 	1008  82544EI Gigabit Ethernet Controller (Copper)
+		1014 0269  iSeries 1000/100/10 Ethernet Adapter
+		1028 011c  PRO/1000 XT Network Connection
 		8086 1107  PRO/1000 XT Server Adapter
 		8086 2107  PRO/1000 XT Server Adapter
 		8086 2110  PRO/1000 XT Server Adapter
+		8086 3108  PRO/1000 XT Network Connection
 	1009  82544EI Gigabit Ethernet Controller (Fiber)
+		1014 0268  iSeries Gigabit Ethernet Adapter
 		8086 1109  PRO/1000 XF Server Adapter
 		8086 2109  PRO/1000 XF Server Adapter
 	100c  82544GC Gigabit Ethernet Controller (Copper)
 		8086 1112  PRO/1000 T Desktop Adapter
 		8086 2112  PRO/1000 T Desktop Adapter
 	100d  82544GC Gigabit Ethernet Controller (LOM)
+		1028 0123  PRO/1000 XT Network Connection
+		1079 891f  82544GC Based Network Connection
+		4c53 1080  CT8 mainboard
+		8086 110d  82544GC Based Network Connection
 	100e  82540EM Gigabit Ethernet Controller
+		1014 0265  PRO/1000 MT Network Connection
+		1014 0267  PRO/1000 MT Network Connection
+		1014 026a  PRO/1000 MT Network Connection
+		107b 8920  PRO/1000 MT Desktop Adapter
 		8086 001e  PRO/1000 MT Desktop Adapter
 		8086 002e  PRO/1000 MT Desktop Adapter
 	100f  82545EM Gigabit Ethernet Controller (Copper)
+		1014 0269  iSeries 1000/100/10 Ethernet Adapter
+		1014 028e  PRO/1000 MT Network Connection
+		8086 1000  PRO/1000 MT Network Connection
 		8086 1001  PRO/1000 MT Server Adapter
 	1010  82546EB Gigabit Ethernet Controller (Copper)
+		1014 027c  PRO/1000 MT Dual Port Network Adapter
+		18fb 7872  RESlink-X
+		4c53 1080  CT8 mainboard
+		4c53 10a0  CA3/CR3 mainboard
 		8086 1011  PRO/1000 MT Dual Port Server Adapter
+		8086 101a  PRO/1000 MT Dual Port Network Adapter
 	1011  82545EM Gigabit Ethernet Controller (Fiber)
+		1014 0268  iSeries Gigabit Ethernet Adapter
 		8086 1002  PRO/1000 MF Server Adapter
+		8086 1003  PRO/1000 MF Server Adapter (LX)
 	1012  82546EB Gigabit Ethernet Controller (Fiber)
 		8086 1012  PRO/1000 MF Dual Port Server Adapter
+	1013  82541EI Gigabit Ethernet Controller (Copper)
+		8086 0013  PRO/1000 MT Network Connection
+		8086 1113  PRO/1000 MT Desktop Adapter
+	1014  82541ER Gigabit Ethernet Controller
 	1015  82540EM Gigabit Ethernet Controller (LOM)
+	1016  82540EP Gigabit Ethernet Controller (LOM)
+		1014 052c  PRO/1000 MT Mobile Connection
+		1179 0001  PRO/1000 MT Mobile Connection
+		8086 1016  PRO/1000 MT Mobile Connection
+	1017  82540EP Gigabit Ethernet Controller (LOM)
+		8086 1017  PR0/1000 MT Desktop Connection
+# Update controller name from 82541EP to 82541EI
+	1018  82541EI Gigabit Ethernet Controller
+		8086 1018  PRO/1000 MT Desktop Adapter
+	1019  82547EI Gigabit Ethernet Controller (LOM)
+		1458 1019  GA-8IPE1000 Pro2 motherboard (865PE)
+		8086 1019  PRO/1000 CT Desktop Connection
+	101d  82546EB Gigabit Ethernet Controller
+		8086 1000  PRO/1000 MT Quad Port Server Adapter
+	101e  82540EP Gigabit Ethernet Controller (Mobile)
+		1014 0549  PRO/1000 MT Mobile Connection
+		1179 0001  PRO/1000 MT Mobile Connection
+		8086 101e  PRO/1000 MT Mobile Connection
+	1026  82545GM Gigabit Ethernet Controller
+		8086 1000  PRO/1000 MT Server Connection
+		8086 1001  PRO/1000 MT Server Adapter
+		8086 1002  PRO/1000 MT Server Adapter
+		8086 1026  PRO/1000 MT Server Connection
+	1027  82545GM Gigabit Ethernet Controller
+		8086 1001  PRO/1000 MF Server Adapter(LX)
+		8086 1002  PRO/1000 MF Server Adapter(LX)
+		8086 1003  PRO/1000 MF Server Adapter(LX)
+		8086 1027  PRO/1000 MF Server Adapter
+	1028  82545GM Gigabit Ethernet Controller
+		8086 1028  PRO/1000 MB Server Adapter
 	1029  82559 Ethernet Controller
 	1030  82559 InBusiness 10/100
 	1031  82801CAM (ICH3) PRO/100 VE (LOM) Ethernet Controller
@@ -6666,6 +7442,7 @@
 	1037  82801CAM (ICH3) Chipset Ethernet Controller
 	1038  82801CAM (ICH3) PRO/100 VM (KM) Ethernet Controller
 	1039  82801BD PRO/100 VE (LOM) Ethernet Controller
+		1014 0267  NetVista A30p
 	103a  82801BD PRO/100 VE (CNR) Ethernet Controller
 	103b  82801BD PRO/100 VM (LOM) Ethernet Controller
 	103c  82801BD PRO/100 VM (CNR) Ethernet Controller
@@ -6674,10 +7451,49 @@
 	1040  536EP Data Fax Modem
 		16be 1040  V.9X DSP Data Fax Modem
 	1043  PRO/Wireless LAN 2100 3B Mini PCI Adapter
-	1048  82597EX 10GbE Ethernet Controller
+		8086 2527  MIM2000/Centrino
+	1048  Intel(R) PRO/10GbE LR Server Adapter
 		8086 a01f  PRO/10GbE LR Server Adapter
 		8086 a11f  PRO/10GbE LR Server Adapter
+	1050  82562EZ 10/100 Ethernet Controller
+		1462 728c  865PE Neo2 (MS-6728)
+	1051  82801EB/ER (ICH5/ICH5R) integrated LAN Controller
 	1059  82551QM Ethernet Controller
+# Updated controller name from 82547EI to 82547GI
+	1075  82547GI Gigabit Ethernet Controller
+		8086 0075  PRO/1000 CT Network Connection
+		8086 1075  PRO/1000 CT Network Connection
+# Added PI to part name.  Previous part name was 82541GI
+	1076  82541GI/PI Gigabit Ethernet Controller
+		8086 0076  PRO/1000 MT Network Connection
+		8086 1076  PRO/1000 MT Network Connection
+		8086 1176  PRO/1000 MT Desktop Adapter
+		8086 1276  PRO/1000 MT Desktop Adapter
+# Update controller name from 82541EI to 82541GI
+	1077  82541GI Gigabit Ethernet Controller
+		1179 0001  PRO/1000 MT Mobile Connection
+		8086 0077  PRO/1000 MT Mobile Connection
+		8086 1077  PRO/1000 MT Mobile Connection
+	1078  82541EI Gigabit Ethernet Controller
+		8086 1078  PRO/1000 MT Network Connection
+# Update from mistaken ID of 82546EB
+	1079  82546GB Gigabit Ethernet Controller
+		103c 12a6  HP Dual Port 1000Base-T [A9900A]
+		103c 12cf  HP Core Dual Port 1000Base-T [AB352A]
+		4c53 1090  Cx9 / Vx9 mainboard
+		8086 0079  PRO/1000 MT Dual Port Network Connection
+		8086 1079  PRO/1000 MT Dual Port Network Connection
+		8086 1179  PRO/1000 MT Dual Port Network Connection
+		8086 117a  PRO/1000 MT Dual Port Server Adapter
+# Update from mistaken ID of 82546EB
+	107a  82546GB Gigabit Ethernet Controller
+		103c 12a8  HP Dual Port 1000base-SX [A9899A]
+		8086 107a  PRO/1000 MF Dual Port Server Adapter
+		8086 127a  PRO/1000 MF Dual Port Server Adapter
+# Update from mistaken ID of 82546EB
+	107b  82546GB Gigabit Ethernet Controller
+		8086 007b  PRO/1000 MB Dual Port Server Connection
+		8086 107b  PRO/1000 MB Dual Port Server Connection
 	1130  82815 815 Chipset Host Bridge and Memory Controller Hub
 		1025 1016  Travelmate 612 TX
 		1043 8027  TUSL2-C Mainboard
@@ -6696,6 +7512,9 @@
 	1200  Intel IXP1200 Network Processor
 		172a 0000  AEP SSL Accelerator
 	1209  82559ER
+		4c53 1050  CT7 mainboard
+		4c53 1051  CE7 mainboard
+		4c53 1070  PC6 mainboard
 	1221  82092AA_0
 	1222  82092AA_1
 	1223  SAA7116
@@ -6744,6 +7563,7 @@
 		1014 705c  10/100 Netfinity 10/100 Ethernet Security Adapter
 		1014 805c  10/100 Netfinity 10/100 Ethernet Security Adapter
 		1028 009b  PowerEdge 2550
+		1028 00ce  PowerEdge 1400
 		1033 8000  PC-9821X-B06
 		1033 8016  PK-UG-X006
 		1033 801f  PK-UG-X006
@@ -6769,6 +7589,7 @@
 		144d 2501  SEM-2000 MiniPCI LAN Adapter
 		144d 2502  SEM-2100IL MiniPCI LAN Adapter
 		1668 1100  EtherExpress PRO/100B (TX) (MiniPCI Ethernet+Modem)
+		4c53 1080  CT8 mainboard
 		8086 0001  EtherExpress PRO/100B (TX)
 		8086 0002  EtherExpress PRO/100B (T4)
 		8086 0003  EtherExpress PRO/10+
@@ -6875,6 +7696,7 @@
 	1460  82870P2 P64H2 Hub PCI Bridge
 	1461  82870P2 P64H2 I/OxAPIC
 		15d9 3480  P4DP6
+		4c53 1090  Cx9 / Vx9 mainboard
 	1462  82870P2 P64H2 Hot Plug Controller
 	1960  80960RP [i960RP Microprocessor]
 		101e 0431  MegaRAID 431 RAID Controller
@@ -6897,6 +7719,10 @@
 		1111 1111  MegaRAID 466, PowerEdge Expandable RAID Controller 2/SC
 		1111 1112  PowerEdge Expandable RAID Controller 2/SC
 		113c 03a2  MegaRAID
+		e4bf 1010  CG1-RADIO
+		e4bf 1020  CU2-QUARTET
+		e4bf 1040  CU1-CHORUS
+		e4bf 3100  CX1-BAND
 	1962  80960RM [i960RM Microprocessor]
 		105a 0000  SuperTrak SX6000 I2O CPU
 	1a21  82840 840 (Carmel) Chipset Host Bridge (Hub A)
@@ -6997,7 +7823,8 @@
 		8086 4532  D815EEA2 mainboard
 		8086 4557  D815EGEW Mainboard
 	244c  82801BAM ISA Bridge (LPC)
-	244e  82801BA/CA/DB/EB PCI Bridge
+	244e  82801BA/CA/DB/EB/ER Hub interface to PCI Bridge
+		1014 0267  NetVista A30p
 	2450  82801E ISA Bridge (LPC)
 	2452  82801E USB
 	2453  82801E SMBus
@@ -7011,6 +7838,7 @@
 		104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
 		15d9 3480  P4DP6
 		8086 1958  vpr Matrix 170B4
+		8086 4541  Latitude C640
 	2483  82801CA/CAM SMBus Controller
 		1014 0220  ThinkPad A/T/X Series
 		104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
@@ -7022,7 +7850,7 @@
 		15d9 3480  P4DP6
 		8086 1958  vpr Matrix 170B4
 	2485  82801CA/CAM AC'97 Audio Controller
-		1014 0222  ThinkPad T23 (2647-4MG) or A30p (2653-64G)
+		1014 0222  ThinkPad T23 (2647-4MG) or A30/A30p (2652/2653)
 		1014 0508  ThinkPad T30
 		1014 051c  ThinkPad A/T/X Series
 		104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
@@ -7031,6 +7859,7 @@
 		1014 0223  ThinkPad A/T/X Series
 		1014 0503  ThinkPad R31 2656BBG
 		1014 051a  ThinkPad A/T/X Series
+		101f 1025  Acer 620 Series
 		104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
 		1179 0001  Toshiba Satellite 1110 Z15 internal Modem
 		134d 4c21  Dell Inspiron 2100 internal modem
@@ -7045,40 +7874,98 @@
 		1014 0220  ThinkPad A/T/X Series
 		104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MP
 		8086 1958  vpr Matrix 170B4
+		8086 4541  Latitude C640
 	248b  82801CA Ultra ATA Storage Controller
 		15d9 3480  P4DP6
 	248c  82801CAM ISA Bridge (LPC)
-	24c0  82801DB LPC Interface Controller
+	24c0  82801DB (ICH4) LPC Bridge
+		1014 0267  NetVista A30p
 		1462 5800  845PE Max (MS-6580)
-	24c2  82801DB USB (Hub #1)
+	24c2  82801DB (ICH4) USB UHCI #1
+		1014 0267  NetVista A30p
+		1071 8160  MIM2000
 		1462 5800  845PE Max (MS-6580)
-	24c3  82801DB/DBM SMBus Controller
+	24c3  82801DB/DBM (ICH4) SMBus Controller
+		1014 0267  NetVista A30p
+		1071 8160  MIM2000
+		1458 24c2  GA-8PE667 Ultra
 		1462 5800  845PE Max (MS-6580)
-	24c4  82801DB USB (Hub #2)
+		4c53 1090  Cx9 / Vx9 mainboard
+	24c4  82801DB (ICH4) USB UHCI #2
+		1014 0267  NetVista A30p
+		1071 8160  MIM2000
 		1462 5800  845PE Max (MS-6580)
-	24c5  82801DB AC'97 Audio Controller
+		4c53 1090  Cx9 / Vx9 mainboard
+	24c5  82801DB (ICH4) AC'97 Audio Controller
+		0e11 00b8  Analog Devices Inc. codec [SoundMAX]
+		1014 0267  NetVista A30p
+		1071 8160  MIM2000
+		1458 a002  GA-8PE667 Ultra
 		1462 5800  845PE Max (MS-6580)
-	24c6  82801DB AC'97 Modem Controller
-	24c7  82801DB USB (Hub #3)
+	24c6  82801DB (ICH4) AC'97 Modem Controller
+		1071 8160  MIM2000
+	24c7  82801DB (ICH4) USB UHCI #3
+		1014 0267  NetVista A30p
+		1071 8160  MIM2000
 		1462 5800  845PE Max (MS-6580)
-	24ca  82801DBM Ultra ATA Storage Controller
-	24cb  82801DB Ultra ATA Storage Controller
+	24ca  82801DBM (ICH4) Ultra ATA Storage Controller
+		1071 8160  MIM2000
+	24cb  82801DB (ICH4) Ultra ATA 100 Storage Controller
+		1014 0267  NetVista A30p
+		1458 24c2  GA-8PE667 Ultra
 		1462 5800  845PE Max (MS-6580)
+		4c53 1090  Cx9 / Vx9 mainboard
 	24cc  82801DBM LPC Interface Controller
-	24cd  82801DB USB2
-		1462 3981  845PE Max (MS-6580) Onboard USB EHCI Controller
-	24d0  82801EB LPC Interface Controller
-	24d1  82801EB Ultra ATA Storage Controller
-	24d2  82801EB USB
-	24d3  82801EB SMBus Controller
-	24d4  82801EB USB
-	24d5  82801EB AC'97 Audio Controller
-	24d6  82801EB AC'97 Modem Controller
-	24d7  82801EB USB
-	24db  82801EB Ultra ATA Storage Controller
+	24cd  82801DB (ICH4) USB2 EHCI Controller
+		1014 0267  NetVista A30p
+		1071 8160  MIM2000
+		1462 3981  845PE Max (MS-6580)
+		4c53 1090  Cx9 / Vx9 mainboard
+	24d0  82801EB/ER (ICH5/ICH5R) LPC Bridge
+	24d1  82801EB (ICH5) Serial ATA 150 Storage Controller
+		103c 12bc  d530 CMT (DG746A)
+		1458 24d1  GA-8IPE1000 Pro2 motherboard (865PE)
+		1462 7280  865PE Neo2 (MS-6728)
+	24d2  82801EB/ER (ICH5/ICH5R) USB UHCI #1
+		103c 12bc  d530 CMT (DG746A)
+		1043 80a6  P4P800 Mainboard
+		1462 7280  865PE Neo2 (MS-6728)
+	24d3  82801EB/ER (ICH5/ICH5R) SMBus Controller
+		1043 80a6  P4P800 Mainboard
+		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)
+		1462 7280  865PE Neo2 (MS-6728)
+	24d4  82801EB/ER (ICH5/ICH5R) USB UHCI #2
+		103c 12bc  d530 CMT (DG746A)
+		1043 80a6  P4P800 Mainboard
+		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)
+		1462 7280  865PE Neo2 (MS-6728)
+	24d5  82801EB/ER (ICH5/ICH5R) AC'97 Audio Controller
+		103c 12bc  Analog Devices codec [SoundMAX Integrated Digital Audio]
+		1043 80f3  P4P800 Mainboard
+		1462 7280  865PE Neo2 (MS-6728)
+	24d6  82801EB/ER (ICH5/ICH5R) AC'97 Modem Controller
+	24d7  82801EB/ER (ICH5/ICH5R) USB UHCI #3
+		103c 12bc  d530 CMT (DG746A)
+		1043 80a6  P4P800 Mainboard
+		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)
+		1462 7280  865PE Neo2 (MS-6728)
+	24db  82801EB/ER (ICH5/ICH5R) Ultra ATA 100 Storage Controller
+		103c 12bc  d530 CMT (DG746A)
+		1043 80a6  P4P800 Mainboard
+		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)
+		1462 7280  865PE Neo2 (MS-6728)
+		1462 7580  MSI 875P
 	24dc  82801EB LPC Interface Controller
-	24dd  82801EB USB2
-	24de  82801EB USB
+	24dd  82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller
+		103c 12bc  d530 CMT (DG746A)
+		1043 80a6  P4P800 Mainboard
+		1458 5006  GA-8IPE1000 Pro2 motherboard (865PE)
+		1462 7280  865PE Neo2 (MS-6728)
+	24de  82801EB/ER (ICH5/ICH5R) USB UHCI #4
+		1043 80a6  P4P800 Mainboard
+		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)
+		1462 7280  865PE Neo2 (MS-6728)
+	24df  82801EB (ICH5R) SATA (cc=RAID)
 	2500  82820 820 (Camino) Chipset Host Bridge (MCH)
 		1028 0095  Precision Workstation 220 Chipset
 		1043 801c  P3C-2000 system chipset
@@ -7098,33 +7985,85 @@
 		15d9 3480  P4DP6
 	2541  E7000 Series Host RASUM Controller
 		15d9 3480  P4DP6
+		4c53 1090  Cx9 / Vx9 mainboard
 	2543  E7000 Series Hub Interface B PCI-to-PCI Bridge
 	2544  E7000 Series Hub Interface B RASUM Controller
+		4c53 1090  Cx9 / Vx9 mainboard
 	2545  E7000 Series Hub Interface C PCI-to-PCI Bridge
 	2546  E7000 Series Hub Interface C RASUM Controller
 	2547  E7000 Series Hub Interface D PCI-to-PCI Bridge
 	2548  E7000 Series Hub Interface D RASUM Controller
 	254c  E7501 Memory Controller Hub
+		4c53 1090  Cx9 / Vx9 mainboard
 	2550  E7505 Memory Controller Hub
 	2551  E7000 Series RAS Controller
 	2552  E7000 Series Processor to AGP Controller
 	2553  E7000 Series Hub Interface B PCI-to-PCI Bridge
 	2554  E7000 Series Hub Interface B PCI-to-PCI Bridge RAS Controller
 	255d  E7205 Memory Controller Hub
-	2560  82845G/GL [Brookdale-G] Chipset Host Bridge
+	2560  82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interface
+		1458 2560  GA-8PE667 Ultra
 		1462 5800  845PE Max (MS-6580)
-	2561  82845G/GL [Brookdale-G] Chipset AGP Bridge
-	2562  82845G/GL [Brookdale-G] Chipset Integrated Graphics Device
-	2570  82865G/PE/P Processor to I/O Controller
-	2571  82865G/PE/P Processor to AGP Controller
+	2561  82845G/GL[Brookdale-G]/GE/PE Host-to-AGP Bridge
+	2562  82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device
+		1014 0267  NetVista A30p
+	2570  82865G/PE/P DRAM Controller/Host-Hub Interface
+		1043 80f2  P4P800 Mainboard
+		1458 2570  GA-8IPE1000 Pro2 motherboard (865PE)
+	2571  82865G/PE/P PCI to AGP Controller
 	2572  82865G Integrated Graphics Device
-	2573  82865G/PE/P Processor to PCI to CSA Bridge
-	2576  82864G/PE/P Processor to I/O Memory Interface
+	2573  82865G/PE/P PCI to CSA Bridge
+	2576  82865G/PE/P Processor to I/O Memory Interface
 	2578  82875P Memory Controller Hub
+		1462 7580  MS-6758 (875P Neo)
+# Motherboard P4SCE
+		15d9 4580  Super Micro Computer Inc. P4SCE
 	2579  82875P Processor to AGP Controller
 	257b  82875P Processor to PCI to CSA Bridge
 	257e  82875P Processor to I/O Memory Interface
+	2580  Memory Controller Hub
+	2581  Memory Controller Hub PCI Express Port
+	2582  Graphics Controller
+	2584  Workstation Memory Controller Hub
+	2585  Workstation Memory Controller Hub PCI Express Port
+	2588  Server Memory Controller Hub
+	2589  Server Memory Controller Hub PCI Express Port
+	258a  Graphics Controller
+	25a1  6300ESB LPC Interface Controller
+	25a2  6300ESB PATA Storage Controller
+	25a3  6300ESB SATA Storage Controller
+	25a4  6300ESB SMBus Controller
+	25a6  6300ESB AC'97 Audio Controller
+	25a7  6300ESB AC'97 Modem Controller
+	25a9  6300ESB USB Universal Host Controller
+	25aa  6300ESB USB Universal Host Controller
+	25ab  6300ESB Watchdog Timer
+	25ac  6300ESB I/O Advanced Programmable Interrupt Controller
+	25ad  6300ESB USB2 Enhanced Host Controller
+	25ae  6300ESB 64-bit PCI-X Bridge
+	25b0  6300ESB SATA RAID Controller
+	2640  I/O Controller Hub LPC
+	2641  I/O Controller Hub LPC
+	2642  I/O Controller Hub LPC
+	2651  I/O Controller Hub SATA cc=ide
+	2652  I/O Controller Hub SATA cc=raid
+	2658  I/O Controller Hub USB
+	2659  I/O Controller Hub USB
+	265a  I/O Controller Hub USB
+	265b  I/O Controller Hub USB
+	265c  I/O Controller Hub USB2
+	2660  I/O Controller Hub PCI Express Port 0
+	2662  I/O Controller Hub PCI Express Port 1
+	2664  I/O Controller Hub PCI Express Port 2
+	2666  I/O Controller Hub PCI Express Port 3
+	2668  I/O Controller Hub Audio
+	266a  I/O Controller Hub SMBus
+	266d  I/O Controller Hub Modem
+	266e  I/O Controller Hub Audio
+	266f  I/O Controller Hub PATA
+	2782  Graphics Controller
 	3092  Integrated RAID
+	3200  GD31244 PCI-X SATA HBA
 	3340  82855PM Processor to I/O Controller
 	3341  82855PM Processor to AGP Controller
 	3575  82830 830 Chipset Host Bridge
@@ -7135,7 +8074,24 @@
 		1014 0513  ThinkPad A/T/X Series
 	3578  82830 830 Chipset Host Bridge
 	3580  82852/855GM Host Bridge
+	3581  855GME GMCH Host-to-AGP Bridge (Virtual PCI-to-PCI)
 	3582  82852/855GM Integrated Graphics Device
+	3584  855GM/GME GMCH Memory I/O Control Registers
+	3585  855GM/GME GMCH Configuration Process Registers
+	3590  Server Memory Controller Hub
+	3591  Memory Controller Hub Error Reporting Register
+	3592  Server Memory Controller Hub
+	3593  Memory Controller Hub Error Reporting Register
+	3594  Memory Controller Hub DMA Controller
+	3595  Memory Controller Hub PCI Express Port A0
+	3596  Memory Controller Hub PCI Express Port A1
+	3597  Memory Controller Hub PCI Express Port B0
+	3598  Memory Controller Hub PCI Express Port B1
+	3599  Memory Controller Hub PCI Express Port C0
+	359a  Memory Controller Hub PCI Express Port C1
+	359b  Memory Controller Hub Extended Configuration Registers
+	359e  Workstation Memory Controller Hub
+	4220  Intel(R) PRO/Wireless 2200BG
 	5200  EtherExpress PRO/100 Intelligent Server
 	5201  EtherExpress PRO/100 Intelligent Server
 		8086 0001  EtherExpress PRO/100 Server Ethernet Adapter
@@ -7144,13 +8100,18 @@
 	7010  82371SB PIIX3 IDE [Natoma/Triton II]
 	7020  82371SB PIIX3 USB [Natoma/Triton II]
 	7030  430VX - 82437VX TVX [Triton VX]
+	7050  Intel Intercast Video Capture Card
 	7100  430TX - 82439TX MTXC
 	7110  82371AB/EB/MB PIIX4 ISA
 	7111  82371AB/EB/MB PIIX4 IDE
 	7112  82371AB/EB/MB PIIX4 USB
 	7113  82371AB/EB/MB PIIX4 ACPI
 	7120  82810 GMCH [Graphics Memory Controller Hub]
+		4c53 1040  CL7 mainboard
+		4c53 1060  PC7 mainboard
 	7121  82810 CGC [Chipset Graphics Controller]
+		4c53 1040  CL7 mainboard
+		4c53 1060  PC7 mainboard
 		8086 4341  Cayman (CA810) Mainboard
 	7122  82810 DC-100 GMCH [Graphics Memory Controller Hub]
 	7123  82810 DC-100 CGC [Chipset Graphics Controller]
@@ -7163,12 +8124,17 @@
 	7181  440LX/EX - 82443LX/EX AGP bridge
 	7190  440BX/ZX/DX - 82443BX/ZX/DX Host bridge
 		0e11 0500  Armada 1750 Laptop System Chipset
-		0e11 b110  Armada M700
+		0e11 b110  Armada M700/E500
 		1179 0001  Toshiba Tecra 8100 Laptop System Chipset
+		4c53 1050  CT7 mainboard
+		4c53 1051  CE7 mainboard
 	7191  440BX/ZX/DX - 82443BX/ZX/DX AGP bridge
 	7192  440BX/ZX/DX - 82443BX/ZX/DX Host bridge (AGP disabled)
 		0e11 0460  Armada 1700 Laptop System Chipset
+		4c53 1000  CC7/CR7/CP7/VC7/VP7/VR7 mainboard
 	7194  82440MX Host Bridge
+		1033 0000  Versa Note Vxi
+		4c53 10a0  CA3/CR3 mainboard
 	7195  82440MX AC'97 Audio Controller
 		10cf 1099  QSound_SigmaTel Stac97 PCI Audio
 		11d4 0040  SoundMAX Integrated Digital Audio
@@ -7179,8 +8145,11 @@
 	719a  82440MX USB Universal Host Controller
 	719b  82440MX Power Management Controller
 	71a0  440GX - 82443GX Host bridge
+		4c53 1050  CT7 mainboard
+		4c53 1051  CE7 mainboard
 	71a1  440GX - 82443GX AGP bridge
 	71a2  440GX - 82443GX Host bridge (AGP disabled)
+		4c53 1000  CC7/CR7/CP7/VC7/VP7/VR7 mainboard
 	7600  82372FB PIIX5 ISA
 	7601  82372FB PIIX5 IDE
 	7602  82372FB PIIX5 USB
@@ -7204,6 +8173,8 @@
 	84e4  460GX - 84460GX Memory Data Controller (MDC)
 	84e6  460GX - 82466GX Wide and fast PCI eXpander Bridge (WXB)
 	84ea  460GX - 84460GX AGP Bridge (GXB function 1)
+	8500  IXP4xx Family  Network Processor (IXP420, 421, 422, 425 and IXC1100)
+	9000  Intel IXP2000 Familly Network Processor
 	9621  Integrated RAID
 	9622  Integrated RAID
 	9641  Integrated RAID
@@ -7212,16 +8183,22 @@
 # observed, and documented in Intel revision note; new mask of 1011:0026
 	b154  21154 PCI-to-PCI Bridge
 	b555  21555 Non transparent PCI-to-PCI Bridge
+		4c53 1050  CT7 mainboard
+		4c53 1051  CE7 mainboard
 		e4bf 1000  CC8-1-BLUES
 	ffff  450NX/GX [Orion] - 82453KX/GX Memory controller [BUG]
 8800  Trigem Computer Inc.
 	2008  Video assistent component
 8866  T-Square Design Inc.
 8888  Silicon Magic
+# 8c4a is not Winbond but there is a board misprogrammed
+8c4a  Winbond
+	1980  W89C940 misprogrammed [ne2k]
 8e0e  Computone Corporation
 8e2e  KTI
 	3000  ET32P2
 9004  Adaptec
+	0078  AHA-2940U_CN
 	1078  AIC-7810
 	1160  AIC-1160 [Family Fibre Channel Adapter]
 	2178  AIC-7821
@@ -7240,6 +8217,9 @@
 	5478  AIC-7850
 	5575  AVA-2930
 	5578  AIC-7855
+	5647  ANA-7711 TCP Offload Engine
+		9004 7710  ANA-7711F TCP Offload Engine - Optical
+		9004 7711  ANA-7711LP TCP Offload Engine - Copper
 	5675  AIC-755x
 	5678  AIC-7856
 	5775  AIC-755x
@@ -7331,11 +8311,13 @@
 	0010  AHA-2940U2/U2W
 		9005 2180  AHA-2940U2 SCSI Controller
 		9005 8100  AHA-2940U2B SCSI Controller
+		9005 a100  AHA-2940U2B SCSI Controller
 		9005 a180  AHA-2940U2W SCSI Controller
 		9005 e100  AHA-2950U2B SCSI Controller
 	0011  AHA-2930U2
 	0013  78902
 		9005 0003  AAA-131U2 Array1000 1 Channel RAID Controller
+		9005 000f  AIC7890_ARO
 	001f  AHA-2940U2/U2W / 7890/7891
 		9005 000f  2940U2W SCSI Controller
 		9005 a180  2940U2W SCSI Controller
@@ -7345,6 +8327,7 @@
 	003f  AIC-7890
 	0050  AHA-3940U2x/395U2x
 		9005 f500  AHA-3950U2B
+		9005 ffff  AHA-3950U2B
 	0051  AHA-3950U2D
 		9005 b500  AHA-3950U2D
 	0053  AIC-7896 SCSI Controller
@@ -7352,6 +8335,7 @@
 	005f  AIC-7896U2/7897U2
 	0080  AIC-7892A U160/m
 		0e11 e2a0  Compaq 64-Bit/66MHz Wide Ultra3 SCSI Adapter
+		9005 6220  AHA-29160C
 		9005 62a0  29160N Ultra160 SCSI Controller
 		9005 e220  29160LP Low Profile Ultra160 SCSI Controller
 		9005 e2a0  29160 Ultra160 SCSI Controller
@@ -7369,23 +8353,50 @@
 	00c5  RAID subsystem HBA
 		1028 00c5  PowerEdge 2550
 	00cf  AIC-7899P U160/m
+		1028 00ce  PowerEdge 1400
 		1028 00d1  PowerEdge 2550
 		10f1 2462  Thunder K7 S2462
 		15d9 9005  Onboard SCSI Host Adapter
 	0250  ServeRAID Controller
 		1014 0279  ServeRAID-xx
 		1014 028c  ServeRAID-xx
+	0283  AAC-RAID
+		9005 0283  Catapult
+	0284  AAC-RAID
+		9005 0284  Tomcat
 	0285  AAC-RAID
+		0e11 0295  SATA 6Ch (Bearcat)
 		1028 0287  PowerEdge Expandable RAID Controller 320/DC
+		1028 0291  CERC SATA RAID 2 PCI SATA 6ch (DellCorsair)
+		17aa 0286  Legend S220 (Legend Crusader)
+		17aa 0287  Legend S230 (Legend Vulcan)
+		9005 0285  2200S (Vulcan)
+		9005 0286  2120S (Crusader)
+		9005 0287  2200S (Vulcan-2m)
+		9005 0288  3230S (Harrier)
+		9005 0289  3240S (Tornado)
+		9005 028a  ASR-2020S PCI-X ZCR (Skyhawk)
+		9005 028b  ASR-2020S SO-DIMM PCI-X ZCR (Terminator)
+		9005 0290  AAR-2410SA PCI SATA 4ch (Jaguar II)
+		9005 0292  AAR-2810SA PCI SATA 8ch (Corsair-8)
+		9005 0293  AAR-21610SA PCI SATA 16ch (Corsair-16)
+		9005 0294  ESD SO-DIMM PCI-X SATA ZCR (Prowler)
+	0286  AAC-RAID (Rocket)
+		9005 028c  ASR-2230S + ASR-2230SLP PCI-X (Lancer)
 	8000  ASC-29320A U320
 	800f  AIC-7901 U320
 	8010  ASC-39320 U320
 	8011  ASC-32320D U320
-		0e11 00ac  U320
+		0e11 00ac  ASC-39320D U320
 		9005 0041  ASC-39320D U320
 	8012  ASC-29320 U320
 	8013  ASC-29320B U320
 	8014  ASC-29320LP U320
+	8015  ASC-39320B U320
+	8016  ASC-39320A U320
+	8017  ASC-29320ALP U320
+	801c  ASC-39320D U320
+	801d  AIC-7902B U320
 	801e  AIC-7901A U320
 	801f  AIC-7902 U320
 	8080  ASC-29320A U320 w/HostRAID
@@ -7410,8 +8421,19 @@
 9699  Omni Media Technology Inc
 	6565  6565
 9710  NetMos Technology
-	9815  VScom 021H-EP2 2 port parallel adaptor
-	9835  222N-2 I/O Card (2S+1P)
+	9815  PCI 9815 Multi-I/O Controller
+		1000 0020  2P0S (2 port parallel adaptor)
+	9835  PCI 9835 Multi-I/O Controller
+		1000 0002  2S (16C550 UART)
+		1000 0012  1P2S
+	9845  PCI 9845 Multi-I/O Controller
+		1000 0006  0P6S (6 port 16550a serial card)
+	9855  PCI 9855 Multi-I/O Controller 4 Serial 1 Parallel
+		1000 0014  1P4S
+9902  Stargen Inc.
+	0001  SG2010 PCI over Starfabric Bridge
+	0002  SG2010 PCI to Starfabric Gateway
+	0003  SG1010 Starfabric Switch and PCI Bridge
 a0a0  AOPEN Inc.
 a0f1  UNISYS Corporation
 a200  NEC Corporation
@@ -7441,12 +8463,15 @@
 dead  Indigita Corporation
 e000  Winbond
 	e000  W89C940
-e159  Tiger Jet Network Inc.
+# see : http://www.schoenfeld.de/inside/Inside_CWMK3.txt
+e159  Individual Computers - Jens Schoenfeld
 	0001  Intel 537
 		0059 0001  128k ISDN-S/T Adapter
 		0059 0003  128k ISDN-U Adapter
 	0002  Tiger100APC ISDN chipset
 e4bf  EKF Elektronik GmbH
+# Innovative and scalable network IC vendor
+e55e  Essence Technology, Inc.
 ea01  Eagle Technology
 # The main chip of all these devices is by Xilinx -> It could also be a Xilinx ID.
 ea60  RME
@@ -7486,12 +8511,17 @@
 	cafe  KONA SD SMPTE 259M I/O
 	efac  KONA SD SMPTE 259M I/O
 	facd  KONA HD SMPTE 292M I/O
-fa57  Fast Search & Transfer ASA
+fa57  Interagon AS
+	0001  PMC [Pattern Matching Chip]
 febd  Ultraview Corp.
 feda  Broadcom Inc (nee Epigram)
 	a0fa  BCM4210 iLine10 HomePNA 2.0
 	a10e  BCM4230 iLine10 HomePNA 2.0
+# IT & Telecom company, develops PCI Trunk cards <www.fedetec.es>
+fede  Fedetec Inc.
+	0003  TABIC PCI v3
 fffe  VMWare Inc
+	0405  Virtual SVGA 4.0
 	0710  Virtual SVGA
 ffff  Illegal Vendor ID
 
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/pci/probe.c	Tue Jun 15 22:20:42 2004
@@ -193,7 +193,7 @@
 		return;
 
 	if (dev->transparent) {
-		printk("Transparent bridge - %s\n", pci_name(dev));
+		printk(KERN_INFO "PCI: Transparent bridge - %s\n", pci_name(dev));
 		for(i = 0; i < PCI_BUS_NUM_RESOURCES; i++)
 			child->resource[i] = child->parent->resource[i];
 		return;
@@ -366,6 +366,8 @@
 			return max;
 		busnr = (buses >> 8) & 0xFF;
 		child = pci_alloc_child_bus(bus, dev, busnr);
+		if (!child)
+			return max;
 		child->primary = buses & 0xFF;
 		child->subordinate = (buses >> 16) & 0xFF;
 		child->bridge_ctl = bctl;
diff -Nru a/drivers/pci/proc.c b/drivers/pci/proc.c
--- a/drivers/pci/proc.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pci/proc.c	Tue Jun 15 22:20:41 2004
@@ -89,7 +89,7 @@
 	if ((pos & 3) && cnt > 2) {
 		unsigned short val;
 		pci_read_config_word(dev, pos, &val);
-		__put_user(cpu_to_le16(val), (unsigned short *) buf);
+		__put_user(cpu_to_le16(val), (unsigned short __user *) buf);
 		buf += 2;
 		pos += 2;
 		cnt -= 2;
@@ -98,7 +98,7 @@
 	while (cnt >= 4) {
 		unsigned int val;
 		pci_read_config_dword(dev, pos, &val);
-		__put_user(cpu_to_le32(val), (unsigned int *) buf);
+		__put_user(cpu_to_le32(val), (unsigned int __user *) buf);
 		buf += 4;
 		pos += 4;
 		cnt -= 4;
@@ -107,7 +107,7 @@
 	if (cnt >= 2) {
 		unsigned short val;
 		pci_read_config_word(dev, pos, &val);
-		__put_user(cpu_to_le16(val), (unsigned short *) buf);
+		__put_user(cpu_to_le16(val), (unsigned short __user *) buf);
 		buf += 2;
 		pos += 2;
 		cnt -= 2;
@@ -158,7 +158,7 @@
 
 	if ((pos & 3) && cnt > 2) {
 		unsigned short val;
-		__get_user(val, (unsigned short *) buf);
+		__get_user(val, (unsigned short __user *) buf);
 		pci_write_config_word(dev, pos, le16_to_cpu(val));
 		buf += 2;
 		pos += 2;
@@ -167,7 +167,7 @@
 
 	while (cnt >= 4) {
 		unsigned int val;
-		__get_user(val, (unsigned int *) buf);
+		__get_user(val, (unsigned int __user *) buf);
 		pci_write_config_dword(dev, pos, le32_to_cpu(val));
 		buf += 4;
 		pos += 4;
@@ -176,7 +176,7 @@
 
 	if (cnt >= 2) {
 		unsigned short val;
-		__get_user(val, (unsigned short *) buf);
+		__get_user(val, (unsigned short __user *) buf);
 		pci_write_config_word(dev, pos, le16_to_cpu(val));
 		buf += 2;
 		pos += 2;
diff -Nru a/drivers/pci/syscall.c b/drivers/pci/syscall.c
--- a/drivers/pci/syscall.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/pci/syscall.c	Tue Jun 15 22:20:37 2004
@@ -57,13 +57,13 @@
 
 	switch (len) {
 	case 1:
-		err = put_user(byte, (unsigned char *)buf);
+		err = put_user(byte, (unsigned char __user *)buf);
 		break;
 	case 2:
-		err = put_user(word, (unsigned short *)buf);
+		err = put_user(word, (unsigned short __user *)buf);
 		break;
 	case 4:
-		err = put_user(dword, (unsigned int *)buf);
+		err = put_user(dword, (unsigned int __user *)buf);
 		break;
 	};
 	return err;
@@ -74,13 +74,13 @@
 	   they get instead of a machine check on x86.  */
 	switch (len) {
 	case 1:
-		put_user(-1, (unsigned char *)buf);
+		put_user(-1, (unsigned char __user *)buf);
 		break;
 	case 2:
-		put_user(-1, (unsigned short *)buf);
+		put_user(-1, (unsigned short __user *)buf);
 		break;
 	case 4:
-		put_user(-1, (unsigned int *)buf);
+		put_user(-1, (unsigned int __user *)buf);
 		break;
 	};
 	return err;
@@ -106,7 +106,7 @@
 	lock_kernel();
 	switch(len) {
 	case 1:
-		err = get_user(byte, (u8 *)buf);
+		err = get_user(byte, (u8 __user *)buf);
 		if (err)
 			break;
 		err = pci_write_config_byte(dev, off, byte);
@@ -115,7 +115,7 @@
 		break;
 
 	case 2:
-		err = get_user(word, (u16 *)buf);
+		err = get_user(word, (u16 __user *)buf);
 		if (err)
 			break;
 		err = pci_write_config_word(dev, off, word);
@@ -124,7 +124,7 @@
 		break;
 
 	case 4:
-		err = get_user(dword, (u32 *)buf);
+		err = get_user(dword, (u32 __user *)buf);
 		if (err)
 			break;
 		err = pci_write_config_dword(dev, off, dword);
diff -Nru a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
--- a/drivers/pcmcia/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/drivers/pcmcia/Kconfig	Tue Jun 15 22:20:43 2004
@@ -120,6 +120,13 @@
 
 	  This driver is also available as a module called sa1111_cs.
 
+config PCMCIA_PXA2XX
+	tristate "PXA2xx support"
+	depends on ARM && ARCH_PXA && PCMCIA
+	help
+	  Say Y here to include support for the PXA2xx PCMCIA controller
+
+
 config PCMCIA_PROBE
 	bool
 	default y if ISA && !ARCH_SA1100 && !ARCH_CLPS711X
diff -Nru a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile
--- a/drivers/pcmcia/Makefile	Tue Jun 15 22:20:43 2004
+++ b/drivers/pcmcia/Makefile	Tue Jun 15 22:20:43 2004
@@ -15,10 +15,14 @@
 obj-$(CONFIG_HD64465_PCMCIA)			+= hd64465_ss.o
 obj-$(CONFIG_PCMCIA_SA1100)			+= sa11xx_core.o sa1100_cs.o
 obj-$(CONFIG_PCMCIA_SA1111)			+= sa11xx_core.o sa1111_cs.o
+obj-$(CONFIG_PCMCIA_PXA2XX)                     += pxa2xx_core.o pxa2xx_cs.o
 
 pcmcia_core-y					+= cistpl.o rsrc_mgr.o bulkmem.o cs.o
 pcmcia_core-$(CONFIG_CARDBUS)			+= cardbus.o
 
+sa11xx_core-y					+= soc_common.o sa11xx_base.o
+pxa2xx_core-y					+= soc_common.o pxa2xx_base.o
+
 sa1111_cs-y					+= sa1111_generic.o
 sa1111_cs-$(CONFIG_SA1100_ADSBITSY)		+= sa1100_adsbitsy.o
 sa1111_cs-$(CONFIG_ASSABET_NEPONSET)		+= sa1100_neponset.o
@@ -42,3 +46,7 @@
 sa1100_cs-$(CONFIG_SA1100_STORK)		+= sa1100_stork.o
 sa1100_cs-$(CONFIG_SA1100_TRIZEPS) 		+= sa1100_trizeps.o
 sa1100_cs-$(CONFIG_SA1100_YOPY)			+= sa1100_yopy.o
+
+pxa2xx_cs-$(CONFIG_ARCH_LUBBOCK)		+= pxa2xx_lubbock.o sa1111_generic.o
+pxa2xx_cs-$(CONFIG_MACH_MAINSTONE)		+= pxa2xx_mainstone.o
+
diff -Nru a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
--- a/drivers/pcmcia/cs.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/pcmcia/cs.c	Tue Jun 15 22:20:38 2004
@@ -789,9 +789,10 @@
 	    return 1;
     for (i = 0; i < MAX_IO_WIN; i++) {
 	if (s->io[i].NumPorts == 0) {
-	    if (find_io_region(base, num, align, name, s) == 0) {
+	    s->io[i].res = find_io_region(*base, num, align, name, s);
+	    if (s->io[i].res) {
 		s->io[i].Attributes = attr;
-		s->io[i].BasePort = *base;
+		s->io[i].BasePort = *base = s->io[i].res->start;
 		s->io[i].NumPorts = s->io[i].InUse = num;
 		break;
 	    } else
@@ -801,7 +802,8 @@
 	/* Try to extend top of window */
 	try = s->io[i].BasePort + s->io[i].NumPorts;
 	if ((*base == 0) || (*base == try))
-	    if (find_io_region(&try, num, 0, name, s) == 0) {
+	    if (adjust_io_region(s->io[i].res, s->io[i].res->start,
+				 s->io[i].res->end + num, s) == 0) {
 		*base = try;
 		s->io[i].NumPorts += num;
 		s->io[i].InUse += num;
@@ -810,7 +812,8 @@
 	/* Try to extend bottom of window */
 	try = s->io[i].BasePort - num;
 	if ((*base == 0) || (*base == try))
-	    if (find_io_region(&try, num, 0, name, s) == 0) {
+	    if (adjust_io_region(s->io[i].res, s->io[i].res->start - num,
+				 s->io[i].res->end, s) == 0) {
 		s->io[i].BasePort = *base = try;
 		s->io[i].NumPorts += num;
 		s->io[i].InUse += num;
@@ -824,15 +827,18 @@
 			     ioaddr_t num)
 {
     int i;
-    if(!(s->features & SS_CAP_STATIC_MAP))
-	release_region(base, num);
+
     for (i = 0; i < MAX_IO_WIN; i++) {
 	if ((s->io[i].BasePort <= base) &&
 	    (s->io[i].BasePort+s->io[i].NumPorts >= base+num)) {
 	    s->io[i].InUse -= num;
 	    /* Free the window if no one else is using it */
-	    if (s->io[i].InUse == 0)
+	    if (s->io[i].InUse == 0) {
 		s->io[i].NumPorts = 0;
+		release_resource(s->io[i].res);
+		kfree(s->io[i].res);
+		s->io[i].res = NULL;
+	    }
 	}
     }
 }
diff -Nru a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
--- a/drivers/pcmcia/cs_internal.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/pcmcia/cs_internal.h	Tue Jun 15 22:21:05 2004
@@ -181,8 +181,10 @@
 
 /* In rsrc_mgr */
 void validate_mem(struct pcmcia_socket *s);
-int find_io_region(ioaddr_t *base, ioaddr_t num, unsigned long align,
+struct resource *find_io_region(unsigned long base, int num, unsigned long align,
 		   char *name, struct pcmcia_socket *s);
+int adjust_io_region(struct resource *res, unsigned long r_start,
+		     unsigned long r_end, struct pcmcia_socket *s);
 int find_mem_region(u_long *base, u_long num, u_long align,
 		    int low, char *name, struct pcmcia_socket *s);
 int try_irq(u_int Attributes, int irq, int specific);
diff -Nru a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
--- a/drivers/pcmcia/ds.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/pcmcia/ds.c	Tue Jun 15 22:20:43 2004
@@ -797,7 +797,7 @@
 
 /*====================================================================*/
 
-static ssize_t ds_read(struct file *file, char *buf,
+static ssize_t ds_read(struct file *file, char __user *buf,
 		       size_t count, loff_t *ppos)
 {
     struct pcmcia_bus_socket *s;
@@ -819,14 +819,14 @@
 
     ret = wait_event_interruptible(s->queue, !queue_empty(user));
     if (ret == 0)
-	ret = put_user(get_queued_event(user), (int *)buf) ? -EFAULT : 4;
+	ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4;
 
     return ret;
 } /* ds_read */
 
 /*====================================================================*/
 
-static ssize_t ds_write(struct file *file, const char *buf,
+static ssize_t ds_write(struct file *file, const char __user *buf,
 			size_t count, loff_t *ppos)
 {
     struct pcmcia_bus_socket *s;
@@ -849,7 +849,7 @@
 
     if (s->req_pending) {
 	s->req_pending--;
-	get_user(s->req_result, (int *)buf);
+	get_user(s->req_result, (int __user *)buf);
 	if ((s->req_result != 0) || (s->req_pending == 0))
 	    wake_up_interruptible(&s->request);
     } else
@@ -888,6 +888,7 @@
 		    u_int cmd, u_long arg)
 {
     struct pcmcia_bus_socket *s;
+    void __user *uarg = (char __user *)arg;
     u_int size;
     int ret, err;
     ds_ioctl_arg_t buf;
@@ -911,14 +912,14 @@
 	return -EPERM;
 	
     if (cmd & IOC_IN) {
-	err = verify_area(VERIFY_READ, (char *)arg, size);
+	err = verify_area(VERIFY_READ, uarg, size);
 	if (err) {
 	    ds_dbg(3, "ds_ioctl(): verify_read = %d\n", err);
 	    return err;
 	}
     }
     if (cmd & IOC_OUT) {
-	err = verify_area(VERIFY_WRITE, (char *)arg, size);
+	err = verify_area(VERIFY_WRITE, uarg, size);
 	if (err) {
 	    ds_dbg(3, "ds_ioctl(): verify_write = %d\n", err);
 	    return err;
@@ -927,7 +928,7 @@
     
     err = ret = 0;
     
-    if (cmd & IOC_IN) __copy_from_user((char *)&buf, (char *)arg, size);
+    if (cmd & IOC_IN) __copy_from_user((char *)&buf, uarg, size);
     
     switch (cmd) {
     case DS_ADJUST_RESOURCE_INFO:
@@ -1042,7 +1043,7 @@
 	}
     }
 
-    if (cmd & IOC_OUT) __copy_to_user((char *)arg, (char *)&buf, size);
+    if (cmd & IOC_OUT) __copy_to_user(uarg, (char *)&buf, size);
 
     return err;
 } /* ds_ioctl */
diff -Nru a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
--- a/drivers/pcmcia/i82365.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/pcmcia/i82365.c	Tue Jun 15 22:20:58 2004
@@ -68,7 +68,7 @@
 #include "o2micro.h"
 
 #ifdef DEBUG
-static const char *version =
+static const char version[] =
 "i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)";
 
 static int pc_debug;
diff -Nru a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pcmcia/pxa2xx_base.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,280 @@
+/*======================================================================
+
+  Device driver for the PCMCIA control functionality of PXA2xx
+  microprocessors.
+
+    The contents of this file may be used under the
+    terms of the GNU Public License version 2 (the "GPL")
+
+    (c) Ian Molton (spyro@f2s.com) 2003
+    (c) Stefan Eletzhofer (stefan.eletzhofer@inquant.de) 2003,4
+
+    derived from sa11xx_base.c
+
+     Portions created by John G. Dorsey are
+     Copyright (C) 1999 John G. Dorsey.
+
+  ======================================================================*/
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/config.h>
+#include <linux/cpufreq.h>
+#include <linux/ioport.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/system.h>
+
+#include <pcmcia/cs_types.h>
+#include <pcmcia/ss.h>
+#include <pcmcia/bulkmem.h>
+#include <pcmcia/cistpl.h>
+
+#include "cs_internal.h"
+#include "soc_common.h"
+#include "pxa2xx_base.h"
+
+
+#define MCXX_SETUP_MASK     (0x7f)
+#define MCXX_ASST_MASK      (0x1f)
+#define MCXX_HOLD_MASK      (0x3f)
+#define MCXX_SETUP_SHIFT    (0)
+#define MCXX_ASST_SHIFT     (7)
+#define MCXX_HOLD_SHIFT     (14)
+
+static inline u_int pxa2xx_mcxx_hold(u_int pcmcia_cycle_ns,
+				     u_int mem_clk_10khz)
+{
+	u_int code = pcmcia_cycle_ns * mem_clk_10khz;
+	return (code / 300000) + ((code % 300000) ? 1 : 0) - 1;
+}
+
+static inline u_int pxa2xx_mcxx_asst(u_int pcmcia_cycle_ns,
+				     u_int mem_clk_10khz)
+{
+	u_int code = pcmcia_cycle_ns * mem_clk_10khz;
+	return (code / 300000) + ((code % 300000) ? 1 : 0) - 1;
+}
+
+static inline u_int pxa2xx_mcxx_setup(u_int pcmcia_cycle_ns,
+				      u_int mem_clk_10khz)
+{
+	u_int code = pcmcia_cycle_ns * mem_clk_10khz;
+	return (code / 100000) + ((code % 100000) ? 1 : 0) - 1;
+}
+
+/* This function returns the (approximate) command assertion period, in
+ * nanoseconds, for a given CPU clock frequency and MCXX_ASST value:
+ */
+static inline u_int pxa2xx_pcmcia_cmd_time(u_int mem_clk_10khz,
+					   u_int pcmcia_mcxx_asst)
+{
+	return (300000 * (pcmcia_mcxx_asst + 1) / mem_clk_10khz);
+}
+
+static int pxa2xx_pcmcia_set_mcmem( int sock, int speed, int clock )
+{
+	MCMEM(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+		& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
+		| ((pxa2xx_mcxx_asst(speed, clock)
+		& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
+		| ((pxa2xx_mcxx_hold(speed, clock)
+		& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
+
+	return 0;
+}
+
+static int pxa2xx_pcmcia_set_mcio( int sock, int speed, int clock )
+{
+	MCIO(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+		& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
+		| ((pxa2xx_mcxx_asst(speed, clock)
+		& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
+		| ((pxa2xx_mcxx_hold(speed, clock)
+		& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
+
+	return 0;
+}
+
+static int pxa2xx_pcmcia_set_mcatt( int sock, int speed, int clock )
+{
+	MCATT(sock) = ((pxa2xx_mcxx_setup(speed, clock)
+		& MCXX_SETUP_MASK) << MCXX_SETUP_SHIFT)
+		| ((pxa2xx_mcxx_asst(speed, clock)
+		& MCXX_ASST_MASK) << MCXX_ASST_SHIFT)
+		| ((pxa2xx_mcxx_hold(speed, clock)
+		& MCXX_HOLD_MASK) << MCXX_HOLD_SHIFT);
+
+	return 0;
+}
+
+static int pxa2xx_pcmcia_set_mcxx(struct soc_pcmcia_socket *skt, unsigned int clk)
+{
+	struct soc_pcmcia_timing timing;
+	int sock = skt->nr;
+
+	soc_common_pcmcia_get_timing(skt, &timing);
+
+	pxa2xx_pcmcia_set_mcmem(sock, timing.mem, clk);
+	pxa2xx_pcmcia_set_mcatt(sock, timing.attr, clk);
+	pxa2xx_pcmcia_set_mcio(sock, timing.io, clk);
+
+	return 0;
+}
+
+static int pxa2xx_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
+{
+	unsigned int clk = get_memclk_frequency_10khz();
+	return pxa2xx_pcmcia_set_mcxx(skt, clk);
+}
+
+#ifdef CONFIG_CPU_FREQ
+
+static int
+pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
+			       unsigned long val,
+			       struct cpufreq_freqs *freqs)
+{
+#warning "it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock"
+	switch (val) {
+	case CPUFREQ_PRECHANGE:
+		if (freqs->new > freqs->old) {
+			debug(skt, 2, "new frequency %u.%uMHz > %u.%uMHz, "
+			       "pre-updating\n",
+			       freqs->new / 1000, (freqs->new / 100) % 10,
+			       freqs->old / 1000, (freqs->old / 100) % 10);
+			pxa2xx_pcmcia_set_mcxx(skt, freqs->new);
+		}
+		break;
+
+	case CPUFREQ_POSTCHANGE:
+		if (freqs->new < freqs->old) {
+			debug(skt, 2, "new frequency %u.%uMHz < %u.%uMHz, "
+			       "post-updating\n",
+			       freqs->new / 1000, (freqs->new / 100) % 10,
+			       freqs->old / 1000, (freqs->old / 100) % 10);
+			pxa2xx_pcmcia_set_mcxx(skt, freqs->new);
+		}
+		break;
+	}
+	return 0;
+}
+#endif
+
+int pxa2xx_drv_pcmcia_probe(struct device *dev)
+{
+	int ret;
+	struct pcmcia_low_level *ops;
+	int first, nr;
+
+	if (!dev || !dev->platform_data)
+		return -ENODEV;
+
+	ops = (struct pcmcia_low_level *)dev->platform_data;
+	first = ops->first;
+	nr = ops->nr;
+
+	/* Setup GPIOs for PCMCIA/CF alternate function mode.
+	 *
+	 * It would be nice if set_GPIO_mode included support
+	 * for driving GPIO outputs to default high/low state
+	 * before programming GPIOs as outputs. Setting GPIO
+	 * outputs to default high/low state via GPSR/GPCR
+	 * before defining them as outputs should reduce
+	 * the possibility of glitching outputs during GPIO
+	 * setup. This of course assumes external terminators
+	 * are present to hold GPIOs in a defined state.
+	 *
+	 * In the meantime, setup default state of GPIO
+	 * outputs before we enable them as outputs.
+	 */
+
+	GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
+		GPIO_bit(GPIO49_nPWE) |
+		GPIO_bit(GPIO50_nPIOR) |
+		GPIO_bit(GPIO51_nPIOW) |
+		GPIO_bit(GPIO52_nPCE_1) |
+		GPIO_bit(GPIO53_nPCE_2);
+
+	pxa_gpio_mode(GPIO48_nPOE_MD);
+	pxa_gpio_mode(GPIO49_nPWE_MD);
+	pxa_gpio_mode(GPIO50_nPIOR_MD);
+	pxa_gpio_mode(GPIO51_nPIOW_MD);
+	pxa_gpio_mode(GPIO52_nPCE_1_MD);
+	pxa_gpio_mode(GPIO53_nPCE_2_MD);
+	pxa_gpio_mode(GPIO54_pSKTSEL_MD); /* REVISIT: s/b dependent on num sockets */
+	pxa_gpio_mode(GPIO55_nPREG_MD);
+	pxa_gpio_mode(GPIO56_nPWAIT_MD);
+	pxa_gpio_mode(GPIO57_nIOIS16_MD);
+
+	/* Provide our PXA2xx specific timing routines. */
+	ops->set_timing  = pxa2xx_pcmcia_set_timing;
+#ifdef CONFIG_CPU_FREQ
+	ops->frequency_change = pxa2xx_pcmcia_frequency_change;
+#endif
+
+	ret = soc_common_drv_pcmcia_probe(dev, ops, first, nr);
+
+	if (ret == 0) {
+		/*
+		 * We have at least one socket, so set MECR:CIT
+		 * (Card Is There)
+		 */
+		MECR |= MECR_CIT;
+
+		/* Set MECR:NOS (Number Of Sockets) */
+		if (nr > 1)
+			MECR |= MECR_NOS;
+		else
+			MECR &= ~MECR_NOS;
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(pxa2xx_drv_pcmcia_probe);
+
+static int pxa2xx_drv_pcmcia_suspend(struct device *dev, u32 state, u32 level)
+{
+	int ret = 0;
+	if (level == SUSPEND_SAVE_STATE)
+		ret = pcmcia_socket_dev_suspend(dev, state);
+	return ret;
+}
+
+static int pxa2xx_drv_pcmcia_resume(struct device *dev, u32 level)
+{
+	int ret = 0;
+	if (level == RESUME_RESTORE_STATE)
+		ret = pcmcia_socket_dev_resume(dev);
+	return ret;
+}
+
+static struct device_driver pxa2xx_pcmcia_driver = {
+	.probe		= pxa2xx_drv_pcmcia_probe,
+	.remove		= soc_common_drv_pcmcia_remove,
+	.suspend 	= pxa2xx_drv_pcmcia_suspend,
+	.resume 	= pxa2xx_drv_pcmcia_resume,
+	.name		= "pxa2xx-pcmcia",
+	.bus		= &platform_bus_type,
+};
+
+static int __init pxa2xx_pcmcia_init(void)
+{
+	return driver_register(&pxa2xx_pcmcia_driver);
+}
+
+static void __exit pxa2xx_pcmcia_exit(void)
+{
+	driver_unregister(&pxa2xx_pcmcia_driver);
+}
+
+module_init(pxa2xx_pcmcia_init);
+module_exit(pxa2xx_pcmcia_exit);
+
+MODULE_AUTHOR("Stefan Eletzhofer <stefan.eletzhofer@inquant.de> and Ian Molton <spyro@f2s.com>");
+MODULE_DESCRIPTION("Linux PCMCIA Card Services: PXA2xx core socket driver");
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pcmcia/pxa2xx_base.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,3 @@
+/* temporary measure */
+extern int pxa2xx_drv_pcmcia_probe(struct device *);
+
diff -Nru a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pcmcia/pxa2xx_lubbock.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,237 @@
+/*
+ * linux/drivers/pcmcia/pxa2xx_lubbock.c
+ *
+ * Author:	George Davis
+ * Created:	Jan 10, 2002
+ * Copyright:	MontaVista Software Inc.
+ *
+ * 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.
+ *
+ * Originally based upon linux/drivers/pcmcia/sa1100_neponset.c
+ *
+ * Lubbock PCMCIA specific routines.
+ *
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+
+#include <asm/hardware.h>
+#include <asm/hardware/sa1111.h>
+#include <asm/mach-types.h>
+#include <asm/arch/lubbock.h>
+
+#include "sa1111_generic.h"
+
+static int
+lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
+				const socket_state_t *state)
+{
+	unsigned int pa_dwr_mask, pa_dwr_set, misc_mask, misc_set;
+	int ret = 0;
+
+	pa_dwr_mask = pa_dwr_set = misc_mask = misc_set = 0;
+
+	/* Lubbock uses the Maxim MAX1602, with the following connections:
+	 *
+	 * Socket 0 (PCMCIA):
+	 *	MAX1602	Lubbock		Register
+	 *	Pin	Signal
+	 *	-----	-------		----------------------
+	 *	A0VPP	S0_PWR0		SA-1111 GPIO A<0>
+	 *	A1VPP	S0_PWR1		SA-1111 GPIO A<1>
+	 *	A0VCC	S0_PWR2		SA-1111 GPIO A<2>
+	 *	A1VCC	S0_PWR3		SA-1111 GPIO A<3>
+	 *	VX	VCC
+	 *	VY	+3.3V
+	 *	12IN	+12V
+	 *	CODE	+3.3V		Cirrus  Code, CODE = High (VY)
+	 *
+	 * Socket 1 (CF):
+	 *	MAX1602	Lubbock		Register
+	 *	Pin	Signal
+	 *	-----	-------		----------------------
+	 *	A0VPP	GND		VPP is not connected
+	 *	A1VPP	GND		VPP is not connected
+	 *	A0VCC	S1_PWR0		MISC_WR<14>
+	 *	A1VCC	S1_PWR1		MISC_WR<15>
+	 *	VX	VCC
+	 *	VY	+3.3V
+	 *	12IN	GND		VPP is not connected
+	 *	CODE	+3.3V		Cirrus  Code, CODE = High (VY)
+	 *
+	 */
+
+ again:
+	switch (skt->nr) {
+	case 0:
+		pa_dwr_mask = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3;
+
+		switch (state->Vcc) {
+		case 0: /* Hi-Z */
+			break;
+
+		case 33: /* VY */
+			pa_dwr_set |= GPIO_A3;
+			break;
+
+		case 50: /* VX */
+			pa_dwr_set |= GPIO_A2;
+			break;
+
+		default:
+			printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
+			       __FUNCTION__, state->Vcc);
+			ret = -1;
+		}
+
+		switch (state->Vpp) {
+		case 0: /* Hi-Z */
+			break;
+
+		case 120: /* 12IN */
+			pa_dwr_set |= GPIO_A1;
+			break;
+
+		default: /* VCC */
+			if (state->Vpp == state->Vcc)
+				pa_dwr_set |= GPIO_A0;
+			else {
+				printk(KERN_ERR "%s(): unrecognized Vpp %u\n",
+				       __FUNCTION__, state->Vpp);
+				ret = -1;
+				break;
+			}
+		}
+		break;
+
+	case 1:
+		misc_mask = (1 << 15) | (1 << 14);
+
+		switch (state->Vcc) {
+		case 0: /* Hi-Z */
+			break;
+
+		case 33: /* VY */
+			misc_set |= 1 << 15;
+			break;
+
+		case 50: /* VX */
+			misc_set |= 1 << 14;
+			break;
+
+		default:
+			printk(KERN_ERR "%s(): unrecognized Vcc %u\n",
+			       __FUNCTION__, state->Vcc);
+			ret = -1;
+			break;
+		}
+
+		if (state->Vpp != state->Vcc && state->Vpp != 0) {
+			printk(KERN_ERR "%s(): CF slot cannot support Vpp %u\n",
+			       __FUNCTION__, state->Vpp);
+			ret = -1;
+			break;
+		}
+		break;
+
+	default:
+		ret = -1;
+	}
+
+	if (ret == 0)
+		ret = sa1111_pcmcia_configure_socket(skt, state);
+
+	if (ret == 0) {
+		lubbock_set_misc_wr(misc_mask, misc_set);
+		sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set);
+	}
+
+#if 1
+	if (ret == 0 && state->Vcc == 33) {
+		struct pcmcia_state new_state;
+
+		/*
+		 * HACK ALERT:
+		 * We can't sense the voltage properly on Lubbock before
+		 * actually applying some power to the socket (catch 22).
+		 * Resense the socket Voltage Sense pins after applying
+		 * socket power.
+		 *
+		 * Note: It takes about 2.5ms for the MAX1602 VCC output
+		 * to rise.
+		 */
+		mdelay(3);
+
+		sa1111_pcmcia_socket_state(skt, &new_state);
+
+		if (!new_state.vs_3v && !new_state.vs_Xv) {
+			/*
+			 * Switch to 5V,  Configure socket with 5V voltage
+			 */
+			lubbock_set_misc_wr(misc_mask, 0);
+			sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, 0);
+
+			/*
+			 * It takes about 100ms to turn off Vcc.
+			 */
+			mdelay(100);
+
+			/*
+			 * We need to hack around the const qualifier as
+			 * well to keep this ugly workaround localized and
+			 * not force it to the rest of the code. Barf bags
+			 * avaliable in the seat pocket in front of you!
+			 */
+			((socket_state_t *)state)->Vcc = 50;
+			((socket_state_t *)state)->Vpp = 50;
+			goto again;
+		}
+	}
+#endif
+
+	return ret;
+}
+
+static struct pcmcia_low_level lubbock_pcmcia_ops = {
+	.owner			= THIS_MODULE,
+	.hw_init		= sa1111_pcmcia_hw_init,
+	.hw_shutdown		= sa1111_pcmcia_hw_shutdown,
+	.socket_state		= sa1111_pcmcia_socket_state,
+	.configure_socket	= lubbock_pcmcia_configure_socket,
+	.socket_init		= sa1111_pcmcia_socket_init,
+	.socket_suspend		= sa1111_pcmcia_socket_suspend,
+	.first			= 0,
+	.nr			= 2,
+};
+
+#include "pxa2xx_base.h"
+
+int __init pcmcia_lubbock_init(struct sa1111_dev *sadev)
+{
+	int ret = -ENODEV;
+
+	if (machine_is_lubbock()) {
+		/*
+		 * Set GPIO_A<3:0> to be outputs for the MAX1600,
+		 * and switch to standby mode.
+		 */
+		sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0);
+		sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0);
+		sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0);
+
+		/* Set CF Socket 1 power to standby mode. */
+		lubbock_set_misc_wr((1 << 15) | (1 << 14), 0);
+
+		sadev->dev.platform_data = &lubbock_pcmcia_ops;
+		ret = pxa2xx_drv_pcmcia_probe(&sadev->dev);
+	}
+
+	return ret;
+}
diff -Nru a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pcmcia/pxa2xx_mainstone.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,178 @@
+/*
+ * linux/drivers/pcmcia/pxa2xx_mainstone.c
+ *
+ * Mainstone PCMCIA specific routines.
+ *
+ * Created:	May 12, 2004
+ * Author:	Nicolas Pitre
+ * Copyright:	MontaVista Software Inc.
+ *
+ * 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/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+
+#include <pcmcia/ss.h>
+
+#include <asm/hardware.h>
+#include <asm/irq.h>
+
+#include <asm/arch/mainstone.h>
+
+#include "soc_common.h"
+
+
+static struct pcmcia_irqs irqs[] = {
+	{ 0, MAINSTONE_S0_CD_IRQ, "PCMCIA0 CD" },
+	{ 1, MAINSTONE_S1_CD_IRQ, "PCMCIA1 CD" },
+	{ 0, MAINSTONE_S0_STSCHG_IRQ, "PCMCIA0 STSCHG" },
+	{ 1, MAINSTONE_S1_STSCHG_IRQ, "PCMCIA1 STSCHG" },
+};
+
+static int mst_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
+{
+	skt->irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ;
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+}
+
+static void mst_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
+{
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+}
+
+static unsigned long mst_pcmcia_status[2];
+
+static void mst_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+				    struct pcmcia_state *state)
+{
+	unsigned long status, flip;
+
+	status = (skt->nr == 0) ? MST_PCMCIA0 : MST_PCMCIA1;
+	flip = (status ^ mst_pcmcia_status[skt->nr]) & MST_PCMCIA_nSTSCHG_BVD1;
+
+	/*
+	 * Workaround for STSCHG which can't be deasserted:
+	 * We therefore disable/enable corresponding IRQs
+	 * as needed to avoid IRQ locks.
+	 */
+	if (flip) {
+		mst_pcmcia_status[skt->nr] = status;
+		if (status & MST_PCMCIA_nSTSCHG_BVD1)
+			enable_irq( (skt->nr == 0) ? MAINSTONE_S0_STSCHG_IRQ
+						   : MAINSTONE_S1_STSCHG_IRQ );
+		else
+			disable_irq( (skt->nr == 0) ? MAINSTONE_S0_STSCHG_IRQ
+						    : MAINSTONE_S1_STSCHG_IRQ );
+	}
+
+	state->detect = (status & MST_PCMCIA_nCD) ? 0 : 1;
+	state->ready  = (status & MST_PCMCIA_nIRQ) ? 1 : 0;
+	state->bvd1   = (status & MST_PCMCIA_nSTSCHG_BVD1) ? 1 : 0;
+	state->bvd2   = (status & MST_PCMCIA_nSPKR_BVD2) ? 1 : 0;
+	state->vs_3v  = (status & MST_PCMCIA_nVS1) ? 0 : 1;
+	state->vs_Xv  = (status & MST_PCMCIA_nVS2) ? 0 : 1;
+	state->wrprot = 0;  /* not available */
+}
+
+static int mst_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
+				       const socket_state_t *state)
+{
+	unsigned long power = 0;
+	int ret = 0;
+
+	switch (state->Vcc) {
+	case 0:  power |= MST_PCMCIA_PWR_VCC_0;  break;
+	case 33: power |= MST_PCMCIA_PWR_VCC_33; break;
+	case 50: power |= MST_PCMCIA_PWR_VCC_50; break;
+	default:
+		 printk(KERN_ERR "%s(): bad Vcc %u\n",
+				 __FUNCTION__, state->Vcc);
+		 ret = -1;
+	}
+
+	switch (state->Vpp) {
+	case 0:   power |= MST_PCMCIA_PWR_VPP_0;   break;
+	case 120: power |= MST_PCMCIA_PWR_VPP_120; break;
+	default:
+		  if(state->Vpp == state->Vcc) {
+			  power |= MST_PCMCIA_PWR_VPP_VCC;
+		  } else {
+			  printk(KERN_ERR "%s(): bad Vpp %u\n",
+					  __FUNCTION__, state->Vpp);
+			  ret = -1;
+		  }
+	}
+
+	if (state->flags & SS_RESET)
+	       power |= MST_PCMCIA_RESET;
+
+	switch (skt->nr) {
+	case 0:  MST_PCMCIA0 = power; break;
+	case 1:  MST_PCMCIA1 = power; break;
+	default: ret = -1;
+	}
+
+	return ret;
+}
+
+static void mst_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
+{
+}
+
+static void mst_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
+{
+}
+
+static struct pcmcia_low_level mst_pcmcia_ops = {
+	.owner			= THIS_MODULE,
+	.hw_init		= mst_pcmcia_hw_init,
+	.hw_shutdown		= mst_pcmcia_hw_shutdown,
+	.socket_state		= mst_pcmcia_socket_state,
+	.configure_socket	= mst_pcmcia_configure_socket,
+	.socket_init		= mst_pcmcia_socket_init,
+	.socket_suspend		= mst_pcmcia_socket_suspend,
+	.nr			= 2,
+};
+
+static struct platform_device *mst_pcmcia_device;
+
+static int __init mst_pcmcia_init(void)
+{
+	int ret;
+
+	mst_pcmcia_device = kmalloc(sizeof(*mst_pcmcia_device), GFP_KERNEL);
+	if (!mst_pcmcia_device)
+		return -ENOMEM;
+	memset(mst_pcmcia_device, 0, sizeof(*mst_pcmcia_device));
+	mst_pcmcia_device->name = "pxa2xx-pcmcia";
+	mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops;
+
+	ret = platform_device_register(mst_pcmcia_device);
+	if (ret)
+		kfree(mst_pcmcia_device);
+
+	return ret;
+}
+
+static void __exit mst_pcmcia_exit(void)
+{
+	/*
+	 * This call is supposed to free our mst_pcmcia_device.
+	 * Unfortunately platform_device don't have a free method, and
+	 * we can't assume it's free of any reference at this point so we
+	 * can't free it either.
+	 */
+	platform_device_unregister(mst_pcmcia_device);
+}
+
+module_init(mst_pcmcia_init);
+module_exit(mst_pcmcia_exit);
+
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c
--- a/drivers/pcmcia/rsrc_mgr.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pcmcia/rsrc_mgr.c	Tue Jun 15 22:20:41 2004
@@ -550,7 +550,7 @@
 
 	for (m = data->map->next; m != data->map; m = m->next) {
 		unsigned long start = m->base;
-		unsigned long end = m->base + m->num;
+		unsigned long end = m->base + m->num - 1;
 
 		/*
 		 * If the lower resources are not available, try aligning
@@ -569,7 +569,7 @@
 		if (res->start >= res->end)
 			break;
 
-		if ((res->start + size) <= end)
+		if ((res->start + size - 1) <= end)
 			break;
 	}
 
@@ -580,6 +580,32 @@
 		res->start = res->end;
 }
 
+/*
+ * Adjust an existing IO region allocation, but making sure that we don't
+ * encroach outside the resources which the user supplied.
+ */
+int adjust_io_region(struct resource *res, unsigned long r_start,
+		     unsigned long r_end, struct pcmcia_socket *s)
+{
+	resource_map_t *m;
+	int ret = -ENOMEM;
+
+	down(&rsrc_sem);
+	for (m = io_db.next; m != &io_db; m = m->next) {
+		unsigned long start = m->base;
+		unsigned long end = m->base + m->num - 1;
+
+		if (start > r_start || r_end > end)
+			continue;
+
+		ret = adjust_resource(res, r_start, r_end - r_start + 1);
+		break;
+	}
+	up(&rsrc_sem);
+
+	return ret;
+}
+
 /*======================================================================
 
     These find ranges of I/O ports or memory addresses that are not
@@ -593,40 +619,37 @@
     
 ======================================================================*/
 
-int find_io_region(ioaddr_t *base, ioaddr_t num, unsigned long align,
-		   char *name, struct pcmcia_socket *s)
+struct resource *find_io_region(unsigned long base, int num,
+		   unsigned long align, char *name, struct pcmcia_socket *s)
 {
 	struct resource *res = make_resource(0, num, IORESOURCE_IO, name);
 	struct pcmcia_align_data data;
-	unsigned long min = *base;
+	unsigned long min = base;
 	int ret;
 
 	if (align == 0)
 		align = 0x10000;
 
 	data.mask = align - 1;
-	data.offset = *base & data.mask;
+	data.offset = base & data.mask;
 	data.map = &io_db;
 
+	down(&rsrc_sem);
 #ifdef CONFIG_PCI
 	if (s->cb_dev) {
 		ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num, 1,
 					     min, 0, pcmcia_align, &data);
 	} else
 #endif
-	{
-		down(&rsrc_sem);
 		ret = allocate_resource(&ioport_resource, res, num, min, ~0UL, 0,
 					pcmcia_align, &data);
-		up(&rsrc_sem);
-	}
+	up(&rsrc_sem);
 
 	if (ret != 0) {
 		kfree(res);
-	} else {
-		*base = res->start;
+		res = NULL;
 	}
-	return ret;
+	return res;
 }
 
 int find_mem_region(u_long *base, u_long num, u_long align,
@@ -652,6 +675,7 @@
 			min = 0x100000UL + *base;
 		}
 
+		down(&rsrc_sem);
 #ifdef CONFIG_PCI
 		if (s->cb_dev) {
 			ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num,
@@ -659,12 +683,9 @@
 						     pcmcia_align, &data);
 		} else
 #endif
-		{
-			down(&rsrc_sem);
 			ret = allocate_resource(&iomem_resource, res, num, min,
 						max, 0, pcmcia_align, &data);
-			up(&rsrc_sem);
-		}
+		up(&rsrc_sem);
 		if (ret == 0 || low)
 			break;
 		low = 1;
diff -Nru a/drivers/pcmcia/sa1100.h b/drivers/pcmcia/sa1100.h
--- a/drivers/pcmcia/sa1100.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,164 +0,0 @@
-/*======================================================================
-
-    Device driver for the PCMCIA control functionality of StrongARM
-    SA-1100 microprocessors.
-
-    The contents of this file are subject to the Mozilla Public
-    License Version 1.1 (the "License"); you may not use this file
-    except in compliance with the License. You may obtain a copy of
-    the License at http://www.mozilla.org/MPL/
-
-    Software distributed under the License is distributed on an "AS
-    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-    implied. See the License for the specific language governing
-    rights and limitations under the License.
-
-    The initial developer of the original code is John G. Dorsey
-    <john+@cs.cmu.edu>.  Portions created by John G. Dorsey are
-    Copyright (C) 1999 John G. Dorsey.  All Rights Reserved.
-
-    Alternatively, the contents of this file may be used under the
-    terms of the GNU Public License version 2 (the "GPL"), in which
-    case the provisions of the GPL are applicable instead of the
-    above.  If you wish to allow the use of your version of this file
-    only under the terms of the GPL and not to allow others to use
-    your version of this file under the MPL, indicate your decision
-    by deleting the provisions above and replace them with the notice
-    and other provisions required by the GPL.  If you do not delete
-    the provisions above, a recipient may use your version of this
-    file under either the MPL or the GPL.
-    
-======================================================================*/
-
-#if !defined(_PCMCIA_SA1100_H)
-# define _PCMCIA_SA1100_H
-
-#include <pcmcia/cs_types.h>
-#include <pcmcia/ss.h>
-#include <pcmcia/bulkmem.h>
-#include <pcmcia/cistpl.h>
-#include "cs_internal.h"
-#include "sa1100_generic.h"
-
-/* MECR: Expansion Memory Configuration Register
- * (SA-1100 Developers Manual, p.10-13; SA-1110 Developers Manual, p.10-24)
- *
- * MECR layout is:  
- *
- *   FAST1 BSM1<4:0> BSA1<4:0> BSIO1<4:0> FAST0 BSM0<4:0> BSA0<4:0> BSIO0<4:0>
- *
- * (This layout is actually true only for the SA-1110; the FASTn bits are
- * reserved on the SA-1100.)
- */
-
-#define MECR_SOCKET_0_SHIFT (0)
-#define MECR_SOCKET_1_SHIFT (16)
-
-#define MECR_BS_MASK        (0x1f)
-#define MECR_FAST_MODE_MASK (0x01)
-
-#define MECR_BSIO_SHIFT (0)
-#define MECR_BSA_SHIFT  (5)
-#define MECR_BSM_SHIFT  (10)
-#define MECR_FAST_SHIFT (15)
-
-#define MECR_SET(mecr, sock, shift, mask, bs) \
-((mecr)=((mecr)&~(((mask)<<(shift))<<\
-                  ((sock)==0?MECR_SOCKET_0_SHIFT:MECR_SOCKET_1_SHIFT)))|\
-        (((bs)<<(shift))<<((sock)==0?MECR_SOCKET_0_SHIFT:MECR_SOCKET_1_SHIFT)))
-
-#define MECR_GET(mecr, sock, shift, mask) \
-((((mecr)>>(((sock)==0)?MECR_SOCKET_0_SHIFT:MECR_SOCKET_1_SHIFT))>>\
- (shift))&(mask))
-
-#define MECR_BSIO_SET(mecr, sock, bs) \
-MECR_SET((mecr), (sock), MECR_BSIO_SHIFT, MECR_BS_MASK, (bs))
-
-#define MECR_BSIO_GET(mecr, sock) \
-MECR_GET((mecr), (sock), MECR_BSIO_SHIFT, MECR_BS_MASK)
-
-#define MECR_BSA_SET(mecr, sock, bs) \
-MECR_SET((mecr), (sock), MECR_BSA_SHIFT, MECR_BS_MASK, (bs))
-
-#define MECR_BSA_GET(mecr, sock) \
-MECR_GET((mecr), (sock), MECR_BSA_SHIFT, MECR_BS_MASK)
-
-#define MECR_BSM_SET(mecr, sock, bs) \
-MECR_SET((mecr), (sock), MECR_BSM_SHIFT, MECR_BS_MASK, (bs))
-
-#define MECR_BSM_GET(mecr, sock) \
-MECR_GET((mecr), (sock), MECR_BSM_SHIFT, MECR_BS_MASK)
-
-#define MECR_FAST_SET(mecr, sock, fast) \
-MECR_SET((mecr), (sock), MECR_FAST_SHIFT, MECR_FAST_MODE_MASK, (fast))
-
-#define MECR_FAST_GET(mecr, sock) \
-MECR_GET((mecr), (sock), MECR_FAST_SHIFT, MECR_FAST_MODE_MASK)
-
-
-/* This function implements the BS value calculation for setting the MECR
- * using integer arithmetic:
- */
-static inline unsigned int sa1100_pcmcia_mecr_bs(unsigned int pcmcia_cycle_ns,
-						 unsigned int cpu_clock_khz){
-  unsigned int t = ((pcmcia_cycle_ns * cpu_clock_khz) / 6) - 1000000;
-  return (t / 1000000) + (((t % 1000000) == 0) ? 0 : 1);
-}
-
-/* This function returns the (approxmiate) command assertion period, in
- * nanoseconds, for a given CPU clock frequency and MECR BS value:
- */
-static inline unsigned int sa1100_pcmcia_cmd_time(unsigned int cpu_clock_khz,
-						  unsigned int pcmcia_mecr_bs){
-  return (((10000000 * 2) / cpu_clock_khz) * (3 * (pcmcia_mecr_bs + 1))) / 10;
-}
-
-
-/* SA-1100 PCMCIA Memory and I/O timing
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- * The SA-1110 Developer's Manual, section 10.2.5, says the following:
- *
- *  "To calculate the recommended BS_xx value for each address space:
- *   divide the command width time (the greater of twIOWR and twIORD,
- *   or the greater of twWE and twOE) by processor cycle time; divide
- *   by 2; divide again by 3 (number of BCLK's per command assertion);
- *   round up to the next whole number; and subtract 1."
- *
- * The PC Card Standard, Release 7, section 4.13.4, says that twIORD
- * has a minimum value of 165ns. Section 4.13.5 says that twIOWR has
- * a minimum value of 165ns, as well. Section 4.7.2 (describing
- * common and attribute memory write timing) says that twWE has a
- * minimum value of 150ns for a 250ns cycle time (for 5V operation;
- * see section 4.7.4), or 300ns for a 600ns cycle time (for 3.3V
- * operation, also section 4.7.4). Section 4.7.3 says that taOE
- * has a maximum value of 150ns for a 300ns cycle time (for 5V
- * operation), or 300ns for a 600ns cycle time (for 3.3V operation).
- *
- * When configuring memory maps, Card Services appears to adopt the policy
- * that a memory access time of "0" means "use the default." The default
- * PCMCIA I/O command width time is 165ns. The default PCMCIA 5V attribute
- * and memory command width time is 150ns; the PCMCIA 3.3V attribute and
- * memory command width time is 300ns.
- */
-#define SA1100_PCMCIA_IO_ACCESS      (165)
-#define SA1100_PCMCIA_5V_MEM_ACCESS  (150)
-#define SA1100_PCMCIA_3V_MEM_ACCESS  (300)
-
-
-/* The socket driver actually works nicely in interrupt-driven form,
- * so the (relatively infrequent) polling is "just to be sure."
- */
-#define SA1100_PCMCIA_POLL_PERIOD    (2*HZ)
-
-struct pcmcia_low_level;
-
-/* I/O pins replacing memory pins
- * (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75)
- *
- * These signals change meaning when going from memory-only to 
- * memory-or-I/O interface:
- */
-#define iostschg bvd1
-#define iospkr   bvd2
-
-#endif  /* !defined(_PCMCIA_SA1100_H) */
diff -Nru a/drivers/pcmcia/sa1100_adsbitsy.c b/drivers/pcmcia/sa1100_adsbitsy.c
--- a/drivers/pcmcia/sa1100_adsbitsy.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/pcmcia/sa1100_adsbitsy.c	Tue Jun 15 22:21:05 2004
@@ -20,7 +20,7 @@
 
 #include "sa1111_generic.h"
 
-static int adsbitsy_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int adsbitsy_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	/* Set GPIO_A<3:0> to be outputs for PCMCIA/CF power controller: */
 	PA_DDR &= ~(GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3);
@@ -35,7 +35,7 @@
 }
 
 static int
-adsbitsy_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
+adsbitsy_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
 {
 	unsigned int pa_dwr_mask, pa_dwr_set;
 	int ret;
diff -Nru a/drivers/pcmcia/sa1100_assabet.c b/drivers/pcmcia/sa1100_assabet.c
--- a/drivers/pcmcia/sa1100_assabet.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/pcmcia/sa1100_assabet.c	Tue Jun 15 22:20:43 2004
@@ -25,23 +25,23 @@
 	{ 1, ASSABET_IRQ_GPIO_CF_BVD1, "CF BVD1" },
 };
 
-static int assabet_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	skt->irq = ASSABET_IRQ_GPIO_CF_IRQ;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 /*
  * Release all resources.
  */
-static void assabet_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void assabet_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static void
-assabet_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
+assabet_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
 {
 	unsigned long levels = GPLR;
 
@@ -55,7 +55,7 @@
 }
 
 static int
-assabet_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
+assabet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
 {
 	unsigned int mask;
 
@@ -93,22 +93,22 @@
  * be called at initialisation, power management event, or
  * pcmcia event.
  */
-static void assabet_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void assabet_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
 	/*
 	 * Enable CF bus
 	 */
 	ASSABET_BCR_clear(ASSABET_BCR_CF_BUS_OFF);
 
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 /*
  * Disable card status IRQs on suspend.
  */
-static void assabet_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 
 	/*
 	 * Tristate the CF bus signals.  Also assert CF
diff -Nru a/drivers/pcmcia/sa1100_badge4.c b/drivers/pcmcia/sa1100_badge4.c
--- a/drivers/pcmcia/sa1100_badge4.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/pcmcia/sa1100_badge4.c	Tue Jun 15 22:20:37 2004
@@ -75,7 +75,7 @@
 }
 
 static int
-badge4_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
+badge4_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
 {
 	int ret;
 
diff -Nru a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c
--- a/drivers/pcmcia/sa1100_cerf.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/pcmcia/sa1100_cerf.c	Tue Jun 15 22:21:02 2004
@@ -27,20 +27,20 @@
 	{ CERF_SOCKET, CERF_IRQ_GPIO_CF_BVD1, "CF_BVD1" }
 };
 
-static int cerf_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	skt->irq = CERF_IRQ_GPIO_CF_IRQ;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void cerf_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static void
-cerf_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
+cerf_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
 {
 	unsigned long levels = GPLR;
 
@@ -54,7 +54,7 @@
 }
 
 static int
-cerf_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 			     const socket_state_t *state)
 {
 	switch (state->Vcc) {
@@ -78,14 +78,14 @@
 	return 0;
 }
 
-static void cerf_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void cerf_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void cerf_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void cerf_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static struct pcmcia_low_level cerf_pcmcia_ops = { 
diff -Nru a/drivers/pcmcia/sa1100_flexanet.c b/drivers/pcmcia/sa1100_flexanet.c
--- a/drivers/pcmcia/sa1100_flexanet.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/pcmcia/sa1100_flexanet.c	Tue Jun 15 22:20:40 2004
@@ -28,20 +28,20 @@
  *
  * Called by sa1100_pcmcia_driver_init on startup.
  */
-static int flexanet_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int flexanet_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	skt->irq = skt->nr ? IRQ_GPIO_CF2_IRQ : IRQ_GPIO_CF1_IRQ;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 
 /*
  * Socket shutdown
  */
-static void flexanet_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void flexanet_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 
@@ -52,7 +52,7 @@
  *
  */
 static void
-flexanet_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
+flexanet_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 			     struct pcmcia_state *state)
 {
 	unsigned long levels = GPLR; /* Sense the GPIOs, asynchronously */
@@ -85,7 +85,7 @@
  *
  */
 static int
-flexanet_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+flexanet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 				 const socket_state_t *state)
 {
 	unsigned long value, flags, mask;
@@ -133,14 +133,14 @@
 	return 0;
 }
 
-static void flexanet_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void flexanet_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void flexanet_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void flexanet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 /*
diff -Nru a/drivers/pcmcia/sa1100_freebird.c b/drivers/pcmcia/sa1100_freebird.c
--- a/drivers/pcmcia/sa1100_freebird.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/pcmcia/sa1100_freebird.c	Tue Jun 15 22:20:36 2004
@@ -20,7 +20,7 @@
 	{ 0, IRQ_GPIO_FREEBIRD_CF_BVD, "CF_BVD1" },
 };
 
-static int freebird_pcmcia_init(struct sa1100_pcmcia_socket *skt)
+static int freebird_pcmcia_init(struct soc_pcmcia_socket *skt)
 {
 	/* Enable Linkup CF card */
 	LINKUP_PRC = 0xc0;
@@ -35,12 +35,12 @@
 
 	skt->irq = IRQ_GPIO_FREEBIRD_CF_IRQ;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void freebird_pcmcia_shutdown(struct sa1100_pcmcia_socket *skt)
+static void freebird_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs);
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs);
 
 	/* Disable CF card */
 	LINKUP_PRC = 0x40;  /* SSP=1   SOE=0 */
@@ -48,7 +48,7 @@
 }
 
 static void
-freebird_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
+freebird_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
 {
 	unsigned long levels = LINKUP_PRS;
 //	printk("LINKUP_PRS=%x\n",levels);
@@ -63,7 +63,7 @@
 }
 
 static int
-freebird_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+freebird_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 				 socket_state_t *state)
 {
 	unsigned long value, flags;
@@ -103,14 +103,14 @@
 	return 0;
 }
 
-static void freebird_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void freebird_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void freebird_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void freebird_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static struct pcmcia_low_level freebird_pcmcia_ops = {
diff -Nru a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
--- a/drivers/pcmcia/sa1100_generic.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pcmcia/sa1100_generic.c	Tue Jun 15 22:20:41 2004
@@ -43,7 +43,7 @@
 #include <pcmcia/cs.h>
 #include <pcmcia/ss.h>
 
-#include "sa1100.h"
+#include "sa1100_generic.h"
 
 static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = {
 #ifdef CONFIG_SA1100_ASSABET
@@ -118,7 +118,7 @@
 
 static struct device_driver sa11x0_pcmcia_driver = {
 	.probe		= sa11x0_drv_pcmcia_probe,
-	.remove		= sa11xx_drv_pcmcia_remove,
+	.remove		= soc_common_drv_pcmcia_remove,
 	.name		= "sa11x0-pcmcia",
 	.bus		= &platform_bus_type,
 	.suspend 	= sa11x0_drv_pcmcia_suspend,
diff -Nru a/drivers/pcmcia/sa1100_generic.h b/drivers/pcmcia/sa1100_generic.h
--- a/drivers/pcmcia/sa1100_generic.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/pcmcia/sa1100_generic.h	Tue Jun 15 22:20:41 2004
@@ -1,4 +1,5 @@
-#include "sa11xx_core.h"
+#include "soc_common.h"
+#include "sa11xx_base.h"
 
 /*
  * Declaration for all machine specific init/exit functions.
diff -Nru a/drivers/pcmcia/sa1100_graphicsclient.c b/drivers/pcmcia/sa1100_graphicsclient.c
--- a/drivers/pcmcia/sa1100_graphicsclient.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/pcmcia/sa1100_graphicsclient.c	Tue Jun 15 22:20:36 2004
@@ -38,7 +38,7 @@
 	{ 0, S0_CD_IRQ, "PCMCIA 0 CD" },
 };
 
-static int gcplus_pcmcia_init(struct sa1100_pcmcia_socket *skt)
+static int gcplus_pcmcia_init(struct soc_pcmcia_socket *skt)
 {
 	// Reset PCMCIA
 	// Reset Timing for CPLD(U2) version 8001E or later
@@ -54,10 +54,10 @@
 	skt->irq = S0_STS_IRQ;
 
 	/* Register interrupts */
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void gcplus_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void gcplus_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
 	/* disable IRQs */
 	free_irq(S0_CD_IRQ, skt);
@@ -68,7 +68,7 @@
 }
 
 static void
-gcplus_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
+gcplus_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
 {
 	unsigned long levels = *PCMCIA_Status;
 
@@ -82,7 +82,7 @@
 }
 
 static int
-gcplus_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+gcplus_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 			       const socket_state_t *state)
 {
 	unsigned long flags;
@@ -125,11 +125,11 @@
 	return 0;
 }
 
-static void gcplus_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void gcplus_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
 }
 
-static void gcplus_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void gcplus_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
 }
 
diff -Nru a/drivers/pcmcia/sa1100_graphicsmaster.c b/drivers/pcmcia/sa1100_graphicsmaster.c
--- a/drivers/pcmcia/sa1100_graphicsmaster.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/pcmcia/sa1100_graphicsmaster.c	Tue Jun 15 22:20:43 2004
@@ -19,7 +19,7 @@
 
 #include "sa1111_generic.h"
 
-static int graphicsmaster_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int graphicsmaster_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
   int return_val=0;
 
@@ -36,7 +36,7 @@
 }
 
 static int
-graphicsmaster_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+graphicsmaster_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 				       const socket_state_t *state)
 {
 	unsigned int pa_dwr_mask, pa_dwr_set;
diff -Nru a/drivers/pcmcia/sa1100_h3600.c b/drivers/pcmcia/sa1100_h3600.c
--- a/drivers/pcmcia/sa1100_h3600.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/pcmcia/sa1100_h3600.c	Tue Jun 15 22:20:43 2004
@@ -23,18 +23,18 @@
 	{ 1, IRQ_GPIO_H3600_PCMCIA_CD1, "PCMCIA CD1" }
 };
 
-static int h3600_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int h3600_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	skt->irq = skt->nr ? IRQ_GPIO_H3600_PCMCIA_IRQ1
 			   : IRQ_GPIO_H3600_PCMCIA_IRQ0;
 
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void h3600_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void h3600_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
   
 	/* Disable CF bus: */
 	clr_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON);
@@ -43,7 +43,7 @@
 }
 
 static void
-h3600_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
+h3600_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
 {
 	unsigned long levels = GPLR;
 
@@ -71,7 +71,7 @@
 }
 
 static int
-h3600_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
+h3600_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
 {
 	if (state->Vcc != 0 && state->Vcc != 33 && state->Vcc != 50) {
 		printk(KERN_ERR "h3600_pcmcia: unrecognized Vcc %u.%uV\n",
@@ -89,7 +89,7 @@
 	return 0;
 }
 
-static void h3600_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void h3600_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
 	/* Enable CF bus: */
 	set_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON);
@@ -99,12 +99,12 @@
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	schedule_timeout(10*HZ / 1000);
 
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void h3600_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void h3600_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 
 	/*
 	 * FIXME:  This doesn't fit well.  We don't have the mechanism in
diff -Nru a/drivers/pcmcia/sa1100_jornada720.c b/drivers/pcmcia/sa1100_jornada720.c
--- a/drivers/pcmcia/sa1100_jornada720.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pcmcia/sa1100_jornada720.c	Tue Jun 15 22:20:39 2004
@@ -23,7 +23,7 @@
 #warning *** Does SOCKET1_3V actually do anything?
 #define SOCKET1_3V	GPIO_GPIO3
 
-static int jornada720_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
   /*
    * What is all this crap for?
@@ -49,7 +49,7 @@
 }
 
 static int
-jornada720_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
+jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
 {
   unsigned int pa_dwr_mask, pa_dwr_set;
   int ret;
diff -Nru a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c
--- a/drivers/pcmcia/sa1100_neponset.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/pcmcia/sa1100_neponset.c	Tue Jun 15 22:21:02 2004
@@ -42,7 +42,7 @@
  */
 
 static int
-neponset_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
+neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
 {
 	unsigned int ncr_mask, ncr_set, pa_dwr_mask, pa_dwr_set;
 	int ret;
@@ -106,7 +106,7 @@
 	return 0;
 }
 
-static void neponset_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void neponset_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
 	if (skt->nr == 0)
 		NCR_0 &= ~(NCR_A0VPP | NCR_A1VPP);
diff -Nru a/drivers/pcmcia/sa1100_pangolin.c b/drivers/pcmcia/sa1100_pangolin.c
--- a/drivers/pcmcia/sa1100_pangolin.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/pcmcia/sa1100_pangolin.c	Tue Jun 15 22:20:36 2004
@@ -26,7 +26,7 @@
 	{ PANGOLIN_SOCK, IRQ_PCMCIA_CD, "PCMCIA CD" },
 };
 
-static int pangolin_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int pangolin_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	int res;
 
@@ -37,12 +37,12 @@
 
 	skt->irq = IRQ_PCMCIA_IRQ;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void pangolin_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void pangolin_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 
 #ifndef CONFIG_SA1100_PANGOLIN_PCMCIA_IDE
 	/* Disable PCMCIA bus: */
@@ -51,7 +51,7 @@
 }
 
 static void
-pangolin_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
+pangolin_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 			     struct pcmcia_state *state)
 {
 	unsigned long levels = GPLR;
@@ -66,7 +66,7 @@
 }
 
 static int
-pangolin_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+pangolin_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 				 const socket_state_t *state)
 {
 	unsigned long value, flags;
@@ -115,14 +115,14 @@
 	return 0;
 }
 
-static void pangolin_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void pangolin_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void pangolin_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void pangolin_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static struct pcmcia_low_level pangolin_pcmcia_ops = { 
diff -Nru a/drivers/pcmcia/sa1100_pfs168.c b/drivers/pcmcia/sa1100_pfs168.c
--- a/drivers/pcmcia/sa1100_pfs168.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pcmcia/sa1100_pfs168.c	Tue Jun 15 22:20:39 2004
@@ -18,7 +18,7 @@
 
 #include "sa1111_generic.h"
 
-static int pfs168_pcmcia_init(struct sa1100_pcmcia_socket *skt)
+static int pfs168_pcmcia_init(struct soc_pcmcia_socket *skt)
 {
   /* TPS2211 to standby mode: */
   PA_DWR &= ~(GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3);
@@ -30,7 +30,7 @@
 }
 
 static int
-pfs168_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+pfs168_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 			       const socket_state_t *state)
 {
   unsigned int pa_dwr_mask = 0, pa_dwr_set = 0;
diff -Nru a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c
--- a/drivers/pcmcia/sa1100_shannon.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/pcmcia/sa1100_shannon.c	Tue Jun 15 22:21:02 2004
@@ -21,7 +21,7 @@
 	{ 1, SHANNON_IRQ_GPIO_EJECT_1, "PCMCIA_CD_1" },
 };
 
-static int shannon_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int shannon_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	/* All those are inputs */
 	GPDR &= ~(SHANNON_GPIO_EJECT_0 | SHANNON_GPIO_EJECT_1 | 
@@ -31,16 +31,16 @@
 
 	skt->irq = skt->nr ? SHANNON_IRQ_GPIO_RDY_1 : SHANNON_IRQ_GPIO_RDY_0;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void shannon_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void shannon_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static void
-shannon_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
+shannon_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 			    struct pcmcia_state *state)
 {
 	unsigned long levels = GPLR;
@@ -69,7 +69,7 @@
 }
 
 static int
-shannon_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+shannon_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 				const socket_state_t *state)
 {
 	switch (state->Vcc) {
@@ -93,14 +93,14 @@
 	return 0;
 }
 
-static void shannon_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void shannon_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void shannon_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void shannon_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static struct pcmcia_low_level shannon_pcmcia_ops = {
diff -Nru a/drivers/pcmcia/sa1100_simpad.c b/drivers/pcmcia/sa1100_simpad.c
--- a/drivers/pcmcia/sa1100_simpad.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/pcmcia/sa1100_simpad.c	Tue Jun 15 22:21:04 2004
@@ -24,19 +24,19 @@
 	{ 1, IRQ_GPIO_CF_CD, "CF_CD" },
 };
 
-static int simpad_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int simpad_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 
 	clear_cs3_bit(VCC_3V_EN|VCC_5V_EN|EN0|EN1);
 
 	skt->irq = IRQ_GPIO_CF_IRQ;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void simpad_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void simpad_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 
 	/* Disable CF bus: */
 	//set_cs3_bit(PCMCIA_BUFF_DIS);
@@ -44,7 +44,7 @@
 }
 
 static void
-simpad_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
+simpad_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 			   struct pcmcia_state *state)
 {
 	unsigned long levels = GPLR;
@@ -66,7 +66,7 @@
 }
 
 static int
-simpad_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+simpad_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 			       const socket_state_t *state)
 {
 	unsigned long flags;
@@ -103,14 +103,14 @@
 	return 0;
 }
 
-static void simpad_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void simpad_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void simpad_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void simpad_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 	set_cs3_bit(PCMCIA_RESET);
 }
 
diff -Nru a/drivers/pcmcia/sa1100_stork.c b/drivers/pcmcia/sa1100_stork.c
--- a/drivers/pcmcia/sa1100_stork.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/pcmcia/sa1100_stork.c	Tue Jun 15 22:20:40 2004
@@ -36,24 +36,24 @@
 	{ 1, IRQ_GPIO_STORK_PCMCIA_B_CARD_DETECT, "PCMCIA_CD1" },
 };
 
-static int stork_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int stork_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	printk("in stork_pcmcia_init\n");
 
 	skt->irq = skt->nr ? IRQ_GPIO_STORK_PCMCIA_B_RDY
 			   : IRQ_GPIO_STORK_PCMCIA_A_RDY;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void stork_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void stork_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
 	int i;
 
         printk("%s\n", __FUNCTION__);
 
         /* disable IRQs */
-        sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+        soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
   
         /* Disable CF bus: */
         storkClearLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON);
@@ -62,7 +62,7 @@
 }
 
 static void
-stork_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
+stork_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 			  struct pcmcia_state *state)
 {
         unsigned long levels = GPLR;
@@ -95,7 +95,7 @@
 }
 
 static int
-stork_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+stork_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 			      const socket_state_t *state)
 {
 	unsigned long flags;
@@ -156,16 +156,16 @@
         return 0;
 }
 
-static void stork_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void stork_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
         storkSetLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON);
 
-        sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+        soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void stork_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void stork_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 
 	/*
 	 * Hack!
diff -Nru a/drivers/pcmcia/sa1100_system3.c b/drivers/pcmcia/sa1100_system3.c
--- a/drivers/pcmcia/sa1100_system3.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/pcmcia/sa1100_system3.c	Tue Jun 15 22:21:05 2004
@@ -47,7 +47,7 @@
 #	define DPRINTK( x, args... )	/* nix */
 #endif
 
-static int system3_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int system3_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	skt->irq = skt->nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT;
 
@@ -55,12 +55,12 @@
 	return 0;
 }
 
-void system3_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+void system3_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
 }
 
 static void
-system3_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
+system3_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
 {
 	unsigned long status = PCSR;
 
diff -Nru a/drivers/pcmcia/sa1100_trizeps.c b/drivers/pcmcia/sa1100_trizeps.c
--- a/drivers/pcmcia/sa1100_trizeps.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pcmcia/sa1100_trizeps.c	Tue Jun 15 22:20:41 2004
@@ -32,7 +32,7 @@
  *
  *
  ******************************************************/
-static int trizeps_pcmcia_init(struct sa1100_pcmcia_socket *skt)
+static int trizeps_pcmcia_init(struct soc_pcmcia_socket *skt)
 {
 	skt->irq = TRIZEPS_IRQ_PCMCIA_IRQ0;
 
@@ -43,18 +43,18 @@
 	GPDR &= ~((GPIO_GPIO(TRIZEPS_GPIO_PCMCIA_CD0))
 		    | (GPIO_GPIO(TRIZEPS_GPIO_PCMCIA_IRQ0)));
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 /**
  *
  *
  ******************************************************/
-static void trizeps_pcmcia_shutdown(struct sa1100_pcmcia_socket *skt)
+static void trizeps_pcmcia_shutdown(struct soc_pcmcia_socket *skt)
 {
 	printk(">>>>>PCMCIA TRIZEPS shutdown\n");
 
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 
 	/* Disable CF bus: */
 	TRIZEPS_BCR_set(TRIZEPS_BCR1, TRIZEPS_nPCM_ENA_REG);
@@ -64,7 +64,7 @@
  *
  ******************************************************/
 static void
-trizeps_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
+trizeps_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 			    struct pcmcia_state *state_array)
 {
 	unsigned long levels = GPLR;
@@ -83,7 +83,7 @@
  *
  ******************************************************/
 static int
-trizeps_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+trizeps_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 				const socket_state_t *state)
 {
 	unsigned long flags;
@@ -129,14 +129,14 @@
 	return 0;
 }
 
-static void trizeps_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void trizeps_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void trizeps_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void trizeps_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 /**
diff -Nru a/drivers/pcmcia/sa1100_xp860.c b/drivers/pcmcia/sa1100_xp860.c
--- a/drivers/pcmcia/sa1100_xp860.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pcmcia/sa1100_xp860.c	Tue Jun 15 22:20:39 2004
@@ -19,7 +19,7 @@
 #define NCR_A0VPP	(1<<16)
 #define NCR_A1VPP	(1<<17)
 
-static int xp860_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int xp860_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
   /* Set GPIO_A<3:0> to be outputs for PCMCIA/CF power controller: */
   PA_DDR &= ~(GPIO_GPIO0 | GPIO_GPIO1 | GPIO_GPIO2 | GPIO_GPIO3);
@@ -42,7 +42,7 @@
 }
 
 static int
-xp860_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
+xp860_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
 {
   unsigned int gpio_mask, pa_dwr_mask;
   unsigned int gpio_set, pa_dwr_set;
diff -Nru a/drivers/pcmcia/sa1100_yopy.c b/drivers/pcmcia/sa1100_yopy.c
--- a/drivers/pcmcia/sa1100_yopy.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/pcmcia/sa1100_yopy.c	Tue Jun 15 22:20:43 2004
@@ -33,19 +33,19 @@
 	{ 0, IRQ_CF_BVD1, "CF_BVD1" },
 };
 
-static int yopy_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+static int yopy_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	skt->irq = IRQ_CF_IREQ;
 
 	pcmcia_power(0);
 	pcmcia_reset(1);
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void yopy_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+static void yopy_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 
 	/* Disable CF */
 	pcmcia_reset(1);
@@ -53,7 +53,7 @@
 }
 
 static void
-yopy_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt,
+yopy_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
 			 struct pcmcia_state_array *state)
 {
 	unsigned long levels = GPLR;
@@ -68,7 +68,7 @@
 }
 
 static int
-yopy_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt,
+yopy_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 			     const socket_state_t *state)
 {
 	switch (state->Vcc) {
@@ -93,14 +93,14 @@
 	return 0;
 }
 
-static void yopy_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+static void yopy_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-static void yopy_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+static void yopy_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static struct pcmcia_low_level yopy_pcmcia_ops = {
diff -Nru a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
--- a/drivers/pcmcia/sa1111_generic.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/pcmcia/sa1111_generic.c	Tue Jun 15 22:20:38 2004
@@ -29,20 +29,20 @@
 	{ 1, IRQ_S1_BVD1_STSCHG, "SA1111 CF BVD1"            },
 };
 
-int sa1111_pcmcia_hw_init(struct sa1100_pcmcia_socket *skt)
+int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
 	if (skt->irq == NO_IRQ)
 		skt->irq = skt->nr ? IRQ_S1_READY_NINT : IRQ_S0_READY_NINT;
 
-	return sa11xx_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-void sa1111_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *skt)
+void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-void sa1111_pcmcia_socket_state(struct sa1100_pcmcia_socket *skt, struct pcmcia_state *state)
+void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
 {
 	struct sa1111_dev *sadev = SA1111_DEV(skt->dev);
 	unsigned long status = sa1111_readl(sadev->mapbase + SA1111_PCSR);
@@ -70,7 +70,7 @@
 	}
 }
 
-int sa1111_pcmcia_configure_socket(struct sa1100_pcmcia_socket *skt, const socket_state_t *state)
+int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
 {
 	struct sa1111_dev *sadev = SA1111_DEV(skt->dev);
 	unsigned int pccr_skt_mask, pccr_set_mask, val;
@@ -110,14 +110,14 @@
 	return 0;
 }
 
-void sa1111_pcmcia_socket_init(struct sa1100_pcmcia_socket *skt)
+void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_enable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
-void sa1111_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *skt)
+void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-	sa11xx_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
+	soc_pcmcia_disable_irqs(skt, irqs, ARRAY_SIZE(irqs));
 }
 
 static int pcmcia_probe(struct sa1111_dev *dev)
@@ -148,6 +148,9 @@
 #ifdef CONFIG_SA1100_JORNADA720
 	pcmcia_jornada720_init(&dev->dev);
 #endif
+#ifdef CONFIG_ARCH_LUBBOCK
+	pcmcia_lubbock_init(dev);
+#endif
 #ifdef CONFIG_ASSABET_NEPONSET
 	pcmcia_neponset_init(dev);
 #endif
@@ -165,7 +168,7 @@
 
 static int __devexit pcmcia_remove(struct sa1111_dev *dev)
 {
-	sa11xx_drv_pcmcia_remove(&dev->dev);
+	soc_common_drv_pcmcia_remove(&dev->dev);
 	release_mem_region(dev->res.start, 512);
 	return 0;
 }
diff -Nru a/drivers/pcmcia/sa1111_generic.h b/drivers/pcmcia/sa1111_generic.h
--- a/drivers/pcmcia/sa1111_generic.h	Tue Jun 15 22:21:03 2004
+++ b/drivers/pcmcia/sa1111_generic.h	Tue Jun 15 22:21:03 2004
@@ -1,13 +1,15 @@
-#include "sa11xx_core.h"
+#include "soc_common.h"
+#include "sa11xx_base.h"
 
-extern int sa1111_pcmcia_hw_init(struct sa1100_pcmcia_socket *);
-extern void sa1111_pcmcia_hw_shutdown(struct sa1100_pcmcia_socket *);
-extern void sa1111_pcmcia_socket_state(struct sa1100_pcmcia_socket *, struct pcmcia_state *);
-extern int sa1111_pcmcia_configure_socket(struct sa1100_pcmcia_socket *, const socket_state_t *);
-extern void sa1111_pcmcia_socket_init(struct sa1100_pcmcia_socket *);
-extern void sa1111_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *);
+extern int sa1111_pcmcia_hw_init(struct soc_pcmcia_socket *);
+extern void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *);
+extern void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *, struct pcmcia_state *);
+extern int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *, const socket_state_t *);
+extern void sa1111_pcmcia_socket_init(struct soc_pcmcia_socket *);
+extern void sa1111_pcmcia_socket_suspend(struct soc_pcmcia_socket *);
 
 extern int pcmcia_badge4_init(struct device *);
 extern int pcmcia_jornada720_init(struct device *);
+extern int pcmcia_lubbock_init(struct sa1111_dev *);
 extern int pcmcia_neponset_init(struct sa1111_dev *);
 
diff -Nru a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pcmcia/sa11xx_base.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,200 @@
+/*======================================================================
+
+    Device driver for the PCMCIA control functionality of StrongARM
+    SA-1100 microprocessors.
+
+    The contents of this file are subject to the Mozilla Public
+    License Version 1.1 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a copy of
+    the License at http://www.mozilla.org/MPL/
+
+    Software distributed under the License is distributed on an "AS
+    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+    implied. See the License for the specific language governing
+    rights and limitations under the License.
+
+    The initial developer of the original code is John G. Dorsey
+    <john+@cs.cmu.edu>.  Portions created by John G. Dorsey are
+    Copyright (C) 1999 John G. Dorsey.  All Rights Reserved.
+
+    Alternatively, the contents of this file may be used under the
+    terms of the GNU Public License version 2 (the "GPL"), in which
+    case the provisions of the GPL are applicable instead of the
+    above.  If you wish to allow the use of your version of this file
+    only under the terms of the GPL and not to allow others to use
+    your version of this file under the MPL, indicate your decision
+    by deleting the provisions above and replace them with the notice
+    and other provisions required by the GPL.  If you do not delete
+    the provisions above, a recipient may use your version of this
+    file under either the MPL or the GPL.
+
+======================================================================*/
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/config.h>
+#include <linux/cpufreq.h>
+#include <linux/ioport.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/system.h>
+
+#include "soc_common.h"
+#include "sa11xx_base.h"
+
+
+/*
+ * sa1100_pcmcia_default_mecr_timing
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ *
+ * Calculate MECR clock wait states for given CPU clock
+ * speed and command wait state. This function can be over-
+ * written by a board specific version.
+ *
+ * The default is to simply calculate the BS values as specified in
+ * the INTEL SA1100 development manual
+ * "Expansion Memory (PCMCIA) Configuration Register (MECR)"
+ * that's section 10.2.5 in _my_ version of the manual ;)
+ */
+static unsigned int
+sa1100_pcmcia_default_mecr_timing(struct soc_pcmcia_socket *skt,
+				  unsigned int cpu_speed,
+				  unsigned int cmd_time)
+{
+	return sa1100_pcmcia_mecr_bs(cmd_time, cpu_speed);
+}
+
+/* sa1100_pcmcia_set_mecr()
+ * ^^^^^^^^^^^^^^^^^^^^^^^^
+ *
+ * set MECR value for socket <sock> based on this sockets
+ * io, mem and attribute space access speed.
+ * Call board specific BS value calculation to allow boards
+ * to tweak the BS values.
+ */
+static int
+sa1100_pcmcia_set_mecr(struct soc_pcmcia_socket *skt, unsigned int cpu_clock)
+{
+	struct soc_pcmcia_timing timing;
+	u32 mecr, old_mecr;
+	unsigned long flags;
+	unsigned int bs_io, bs_mem, bs_attr;
+
+	soc_common_pcmcia_get_timing(skt, &timing);
+
+	bs_io = skt->ops->get_timing(skt, cpu_clock, timing.io);
+	bs_mem = skt->ops->get_timing(skt, cpu_clock, timing.mem);
+	bs_attr = skt->ops->get_timing(skt, cpu_clock, timing.attr);
+
+	local_irq_save(flags);
+
+	old_mecr = mecr = MECR;
+	MECR_FAST_SET(mecr, skt->nr, 0);
+	MECR_BSIO_SET(mecr, skt->nr, bs_io);
+	MECR_BSA_SET(mecr, skt->nr, bs_attr);
+	MECR_BSM_SET(mecr, skt->nr, bs_mem);
+	if (old_mecr != mecr)
+		MECR = mecr;
+
+	local_irq_restore(flags);
+
+	debug(skt, 2, "FAST %X  BSM %X  BSA %X  BSIO %X\n",
+	      MECR_FAST_GET(mecr, skt->nr),
+	      MECR_BSM_GET(mecr, skt->nr), MECR_BSA_GET(mecr, skt->nr),
+	      MECR_BSIO_GET(mecr, skt->nr));
+
+	return 0;
+}
+
+#ifdef CONFIG_CPU_FREQ
+static int
+sa1100_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
+			       unsigned long val,
+			       struct cpufreq_freqs *freqs)
+{
+	switch (val) {
+	case CPUFREQ_PRECHANGE:
+		if (freqs->new > freqs->old)
+			sa1100_pcmcia_set_mecr(skt, freqs->new);
+		break;
+
+	case CPUFREQ_POSTCHANGE:
+		if (freqs->new < freqs->old)
+			sa1100_pcmcia_set_mecr(skt, freqs->new);
+		break;
+	case CPUFREQ_RESUMECHANGE:
+		sa1100_pcmcia_set_mecr(skt, freqs->new);
+		break;
+	}
+
+	return 0;
+}
+
+#endif
+
+static int
+sa1100_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
+{
+	return sa1100_pcmcia_set_mecr(skt, cpufreq_get(0));
+}
+
+static int
+sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf)
+{
+	struct soc_pcmcia_timing timing;
+	unsigned int clock = cpufreq_get(0);
+	unsigned long mecr = MECR;
+	char *p = buf;
+
+	soc_common_pcmcia_get_timing(skt, &timing);
+
+	p+=sprintf(p, "I/O      : %u (%u)\n", timing.io,
+		   sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr)));
+
+	p+=sprintf(p, "attribute: %u (%u)\n", timing.attr,
+		   sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr)));
+
+	p+=sprintf(p, "common   : %u (%u)\n", timing.mem,
+		   sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr)));
+
+	return p - buf;
+}
+
+int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
+			    int first, int nr)
+{
+	/*
+	 * set default MECR calculation if the board specific
+	 * code did not specify one...
+	 */
+	if (!ops->get_timing)
+		ops->get_timing = sa1100_pcmcia_default_mecr_timing;
+
+	/* Provide our SA11x0 specific timing routines. */
+	ops->set_timing  = sa1100_pcmcia_set_timing;
+	ops->show_timing = sa1100_pcmcia_show_timing;
+#ifdef CONFIG_CPU_FREQ
+	ops->frequency_change = sa1100_pcmcia_frequency_change;
+#endif
+
+	return soc_common_drv_pcmcia_probe(dev, ops, first, nr);
+}
+EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe);
+
+static int __init sa11xx_pcmcia_init(void)
+{
+	return 0;
+}
+module_init(sa11xx_pcmcia_init);
+
+static void __exit sa11xx_pcmcia_exit(void) {}
+
+module_exit(sa11xx_pcmcia_exit);
+
+MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
+MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver");
+MODULE_LICENSE("Dual MPL/GPL");
diff -Nru a/drivers/pcmcia/sa11xx_base.h b/drivers/pcmcia/sa11xx_base.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pcmcia/sa11xx_base.h	Tue Jun 15 22:20:41 2004
@@ -0,0 +1,123 @@
+/*======================================================================
+
+    Device driver for the PCMCIA control functionality of StrongARM
+    SA-1100 microprocessors.
+
+    The contents of this file are subject to the Mozilla Public
+    License Version 1.1 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a copy of
+    the License at http://www.mozilla.org/MPL/
+
+    Software distributed under the License is distributed on an "AS
+    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+    implied. See the License for the specific language governing
+    rights and limitations under the License.
+
+    The initial developer of the original code is John G. Dorsey
+    <john+@cs.cmu.edu>.  Portions created by John G. Dorsey are
+    Copyright (C) 1999 John G. Dorsey.  All Rights Reserved.
+
+    Alternatively, the contents of this file may be used under the
+    terms of the GNU Public License version 2 (the "GPL"), in which
+    case the provisions of the GPL are applicable instead of the
+    above.  If you wish to allow the use of your version of this file
+    only under the terms of the GPL and not to allow others to use
+    your version of this file under the MPL, indicate your decision
+    by deleting the provisions above and replace them with the notice
+    and other provisions required by the GPL.  If you do not delete
+    the provisions above, a recipient may use your version of this
+    file under either the MPL or the GPL.
+
+======================================================================*/
+
+#if !defined(_PCMCIA_SA1100_H)
+# define _PCMCIA_SA1100_H
+
+/* SA-1100 PCMCIA Memory and I/O timing
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ * The SA-1110 Developer's Manual, section 10.2.5, says the following:
+ *
+ *  "To calculate the recommended BS_xx value for each address space:
+ *   divide the command width time (the greater of twIOWR and twIORD,
+ *   or the greater of twWE and twOE) by processor cycle time; divide
+ *   by 2; divide again by 3 (number of BCLK's per command assertion);
+ *   round up to the next whole number; and subtract 1."
+ */
+
+/* MECR: Expansion Memory Configuration Register
+ * (SA-1100 Developers Manual, p.10-13; SA-1110 Developers Manual, p.10-24)
+ *
+ * MECR layout is:
+ *
+ *   FAST1 BSM1<4:0> BSA1<4:0> BSIO1<4:0> FAST0 BSM0<4:0> BSA0<4:0> BSIO0<4:0>
+ *
+ * (This layout is actually true only for the SA-1110; the FASTn bits are
+ * reserved on the SA-1100.)
+ */
+
+#define MECR_SOCKET_0_SHIFT (0)
+#define MECR_SOCKET_1_SHIFT (16)
+
+#define MECR_BS_MASK        (0x1f)
+#define MECR_FAST_MODE_MASK (0x01)
+
+#define MECR_BSIO_SHIFT (0)
+#define MECR_BSA_SHIFT  (5)
+#define MECR_BSM_SHIFT  (10)
+#define MECR_FAST_SHIFT (15)
+
+#define MECR_SET(mecr, sock, shift, mask, bs) \
+((mecr)=((mecr)&~(((mask)<<(shift))<<\
+                  ((sock)==0?MECR_SOCKET_0_SHIFT:MECR_SOCKET_1_SHIFT)))|\
+        (((bs)<<(shift))<<((sock)==0?MECR_SOCKET_0_SHIFT:MECR_SOCKET_1_SHIFT)))
+
+#define MECR_GET(mecr, sock, shift, mask) \
+((((mecr)>>(((sock)==0)?MECR_SOCKET_0_SHIFT:MECR_SOCKET_1_SHIFT))>>\
+ (shift))&(mask))
+
+#define MECR_BSIO_SET(mecr, sock, bs) \
+MECR_SET((mecr), (sock), MECR_BSIO_SHIFT, MECR_BS_MASK, (bs))
+
+#define MECR_BSIO_GET(mecr, sock) \
+MECR_GET((mecr), (sock), MECR_BSIO_SHIFT, MECR_BS_MASK)
+
+#define MECR_BSA_SET(mecr, sock, bs) \
+MECR_SET((mecr), (sock), MECR_BSA_SHIFT, MECR_BS_MASK, (bs))
+
+#define MECR_BSA_GET(mecr, sock) \
+MECR_GET((mecr), (sock), MECR_BSA_SHIFT, MECR_BS_MASK)
+
+#define MECR_BSM_SET(mecr, sock, bs) \
+MECR_SET((mecr), (sock), MECR_BSM_SHIFT, MECR_BS_MASK, (bs))
+
+#define MECR_BSM_GET(mecr, sock) \
+MECR_GET((mecr), (sock), MECR_BSM_SHIFT, MECR_BS_MASK)
+
+#define MECR_FAST_SET(mecr, sock, fast) \
+MECR_SET((mecr), (sock), MECR_FAST_SHIFT, MECR_FAST_MODE_MASK, (fast))
+
+#define MECR_FAST_GET(mecr, sock) \
+MECR_GET((mecr), (sock), MECR_FAST_SHIFT, MECR_FAST_MODE_MASK)
+
+
+/* This function implements the BS value calculation for setting the MECR
+ * using integer arithmetic:
+ */
+static inline unsigned int sa1100_pcmcia_mecr_bs(unsigned int pcmcia_cycle_ns,
+						 unsigned int cpu_clock_khz){
+  unsigned int t = ((pcmcia_cycle_ns * cpu_clock_khz) / 6) - 1000000;
+  return (t / 1000000) + (((t % 1000000) == 0) ? 0 : 1);
+}
+
+/* This function returns the (approximate) command assertion period, in
+ * nanoseconds, for a given CPU clock frequency and MECR BS value:
+ */
+static inline unsigned int sa1100_pcmcia_cmd_time(unsigned int cpu_clock_khz,
+						  unsigned int pcmcia_mecr_bs){
+  return (((10000000 * 2) / cpu_clock_khz) * (3 * (pcmcia_mecr_bs + 1))) / 10;
+}
+
+
+extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr);
+
+#endif  /* !defined(_PCMCIA_SA1100_H) */
diff -Nru a/drivers/pcmcia/sa11xx_core.c b/drivers/pcmcia/sa11xx_core.c
--- a/drivers/pcmcia/sa11xx_core.c	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,971 +0,0 @@
-/*======================================================================
-
-    Device driver for the PCMCIA control functionality of StrongARM
-    SA-1100 microprocessors.
-
-    The contents of this file are subject to the Mozilla Public
-    License Version 1.1 (the "License"); you may not use this file
-    except in compliance with the License. You may obtain a copy of
-    the License at http://www.mozilla.org/MPL/
-
-    Software distributed under the License is distributed on an "AS
-    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-    implied. See the License for the specific language governing
-    rights and limitations under the License.
-
-    The initial developer of the original code is John G. Dorsey
-    <john+@cs.cmu.edu>.  Portions created by John G. Dorsey are
-    Copyright (C) 1999 John G. Dorsey.  All Rights Reserved.
-
-    Alternatively, the contents of this file may be used under the
-    terms of the GNU Public License version 2 (the "GPL"), in which
-    case the provisions of the GPL are applicable instead of the
-    above.  If you wish to allow the use of your version of this file
-    only under the terms of the GPL and not to allow others to use
-    your version of this file under the MPL, indicate your decision
-    by deleting the provisions above and replace them with the notice
-    and other provisions required by the GPL.  If you do not delete
-    the provisions above, a recipient may use your version of this
-    file under either the MPL or the GPL.
-    
-======================================================================*/
-/*
- * Please see linux/Documentation/arm/SA1100/PCMCIA for more information
- * on the low-level kernel interface.
- */
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/init.h>
-#include <linux/config.h>
-#include <linux/cpufreq.h>
-#include <linux/ioport.h>
-#include <linux/kernel.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
-#include <linux/notifier.h>
-#include <linux/interrupt.h>
-#include <linux/spinlock.h>
-
-#include <asm/hardware.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/system.h>
-
-#include "sa11xx_core.h"
-#include "sa1100.h"
-
-#ifdef DEBUG
-static int pc_debug;
-
-module_param(pc_debug, int, 0644);
-
-#define debug(skt, lvl, fmt, arg...) do {			\
-	if (pc_debug > (lvl))					\
-		printk(KERN_DEBUG "skt%u: %s: " fmt,		\
-		       (skt)->nr, __func__ , ## arg);		\
-} while (0)
-
-#else
-#define debug(skt, lvl, fmt, arg...) do { } while (0)
-#endif
-
-#define to_sa1100_socket(x)	container_of(x, struct sa1100_pcmcia_socket, socket)
-
-/*
- * sa1100_pcmcia_default_mecr_timing
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- *
- * Calculate MECR clock wait states for given CPU clock
- * speed and command wait state. This function can be over-
- * written by a board specific version.
- *
- * The default is to simply calculate the BS values as specified in
- * the INTEL SA1100 development manual
- * "Expansion Memory (PCMCIA) Configuration Register (MECR)"
- * that's section 10.2.5 in _my_ version of the manual ;)
- */
-static unsigned int
-sa1100_pcmcia_default_mecr_timing(struct sa1100_pcmcia_socket *skt,
-				  unsigned int cpu_speed,
-				  unsigned int cmd_time)
-{
-	return sa1100_pcmcia_mecr_bs(cmd_time, cpu_speed);
-}
-
-static unsigned short
-calc_speed(unsigned short *spds, int num, unsigned short dflt)
-{
-	unsigned short speed = 0;
-	int i;
-
-	for (i = 0; i < num; i++)
-		if (speed < spds[i])
-			speed = spds[i];
-	if (speed == 0)
-		speed = dflt;
-
-	return speed;
-}
-
-/* sa1100_pcmcia_set_mecr()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- *
- * set MECR value for socket <sock> based on this sockets
- * io, mem and attribute space access speed.
- * Call board specific BS value calculation to allow boards
- * to tweak the BS values.
- */
-static int
-sa1100_pcmcia_set_mecr(struct sa1100_pcmcia_socket *skt, unsigned int cpu_clock)
-{
-	u32 mecr, old_mecr;
-	unsigned long flags;
-	unsigned short speed;
-	unsigned int bs_io, bs_mem, bs_attr;
-
-	speed = calc_speed(skt->spd_io, MAX_IO_WIN, SA1100_PCMCIA_IO_ACCESS);
-	bs_io = skt->ops->socket_get_timing(skt, cpu_clock, speed);
-
-	speed = calc_speed(skt->spd_mem, MAX_WIN, SA1100_PCMCIA_3V_MEM_ACCESS);
-	bs_mem = skt->ops->socket_get_timing(skt, cpu_clock, speed);
-
-	speed = calc_speed(skt->spd_attr, MAX_WIN, SA1100_PCMCIA_3V_MEM_ACCESS);
-	bs_attr = skt->ops->socket_get_timing(skt, cpu_clock, speed);
-
-	local_irq_save(flags);
-
-	old_mecr = mecr = MECR;
-	MECR_FAST_SET(mecr, skt->nr, 0);
-	MECR_BSIO_SET(mecr, skt->nr, bs_io);
-	MECR_BSA_SET(mecr, skt->nr, bs_attr);
-	MECR_BSM_SET(mecr, skt->nr, bs_mem);
-	if (old_mecr != mecr)
-		MECR = mecr;
-
-	local_irq_restore(flags);
-
-	debug(skt, 2, "FAST %X  BSM %X  BSA %X  BSIO %X\n",
-	      MECR_FAST_GET(mecr, skt->nr),
-	      MECR_BSM_GET(mecr, skt->nr), MECR_BSA_GET(mecr, skt->nr),
-	      MECR_BSIO_GET(mecr, skt->nr));
-
-	return 0;
-}
-
-static unsigned int sa1100_pcmcia_skt_state(struct sa1100_pcmcia_socket *skt)
-{
-	struct pcmcia_state state;
-	unsigned int stat;
-
-	memset(&state, 0, sizeof(struct pcmcia_state));
-
-	skt->ops->socket_state(skt, &state);
-
-	stat = state.detect  ? SS_DETECT : 0;
-	stat |= state.ready  ? SS_READY  : 0;
-	stat |= state.wrprot ? SS_WRPROT : 0;
-	stat |= state.vs_3v  ? SS_3VCARD : 0;
-	stat |= state.vs_Xv  ? SS_XVCARD : 0;
-
-	/* The power status of individual sockets is not available
-	 * explicitly from the hardware, so we just remember the state
-	 * and regurgitate it upon request:
-	 */
-	stat |= skt->cs_state.Vcc ? SS_POWERON : 0;
-
-	if (skt->cs_state.flags & SS_IOCARD)
-		stat |= state.bvd1 ? SS_STSCHG : 0;
-	else {
-		if (state.bvd1 == 0)
-			stat |= SS_BATDEAD;
-		else if (state.bvd2 == 0)
-			stat |= SS_BATWARN;
-	}
-	return stat;
-}
-
-/*
- * sa1100_pcmcia_config_skt
- * ^^^^^^^^^^^^^^^^^^^^^^^^
- *
- * Convert PCMCIA socket state to our socket configure structure.
- */
-static int
-sa1100_pcmcia_config_skt(struct sa1100_pcmcia_socket *skt, socket_state_t *state)
-{
-	int ret;
-
-	ret = skt->ops->configure_socket(skt, state);
-	if (ret == 0) {
-		/*
-		 * This really needs a better solution.  The IRQ
-		 * may or may not be claimed by the driver.
-		 */
-		if (skt->irq_state != 1 && state->io_irq) {
-			skt->irq_state = 1;
-			set_irq_type(skt->irq, IRQT_FALLING);
-		} else if (skt->irq_state == 1 && state->io_irq == 0) {
-			skt->irq_state = 0;
-			set_irq_type(skt->irq, IRQT_NOEDGE);
-		}
-
-		skt->cs_state = *state;
-	}
-
-	if (ret < 0)
-		printk(KERN_ERR "sa1100_pcmcia: unable to configure "
-		       "socket %d\n", skt->nr);
-
-	return ret;
-}
-
-/* sa1100_pcmcia_sock_init()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^
- *
- * (Re-)Initialise the socket, turning on status interrupts
- * and PCMCIA bus.  This must wait for power to stabilise
- * so that the card status signals report correctly.
- *
- * Returns: 0
- */
-static int sa1100_pcmcia_sock_init(struct pcmcia_socket *sock)
-{
-	struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
-
-	debug(skt, 2, "initializing socket\n");
-
-	skt->ops->socket_init(skt);
-	return 0;
-}
-
-
-/*
- * sa1100_pcmcia_suspend()
- * ^^^^^^^^^^^^^^^^^^^^^^^
- *
- * Remove power on the socket, disable IRQs from the card.
- * Turn off status interrupts, and disable the PCMCIA bus.
- *
- * Returns: 0
- */
-static int sa1100_pcmcia_suspend(struct pcmcia_socket *sock)
-{
-	struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
-	int ret;
-
-	debug(skt, 2, "suspending socket\n");
-
-	ret = sa1100_pcmcia_config_skt(skt, &dead_socket);
-	if (ret == 0)
-		skt->ops->socket_suspend(skt);
-
-	return ret;
-}
-
-static spinlock_t status_lock = SPIN_LOCK_UNLOCKED;
-
-/* sa1100_check_status()
- * ^^^^^^^^^^^^^^^^^^^^^
- */
-static void sa1100_check_status(struct sa1100_pcmcia_socket *skt)
-{
-	unsigned int events;
-
-	debug(skt, 4, "entering PCMCIA monitoring thread\n");
-
-	do {
-		unsigned int status;
-		unsigned long flags;
-
-		status = sa1100_pcmcia_skt_state(skt);
-
-		spin_lock_irqsave(&status_lock, flags);
-		events = (status ^ skt->status) & skt->cs_state.csc_mask;
-		skt->status = status;
-		spin_unlock_irqrestore(&status_lock, flags);
-
-		debug(skt, 4, "events: %s%s%s%s%s%s\n",
-			events == 0         ? "<NONE>"   : "",
-			events & SS_DETECT  ? "DETECT "  : "",
-			events & SS_READY   ? "READY "   : "",
-			events & SS_BATDEAD ? "BATDEAD " : "",
-			events & SS_BATWARN ? "BATWARN " : "",
-			events & SS_STSCHG  ? "STSCHG "  : "");
-
-		if (events)
-			pcmcia_parse_events(&skt->socket, events);
-	} while (events);
-}
-
-/* sa1100_pcmcia_poll_event()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Let's poll for events in addition to IRQs since IRQ only is unreliable...
- */
-static void sa1100_pcmcia_poll_event(unsigned long dummy)
-{
-	struct sa1100_pcmcia_socket *skt = (struct sa1100_pcmcia_socket *)dummy;
-	debug(skt, 4, "polling for events\n");
-
-	mod_timer(&skt->poll_timer, jiffies + SA1100_PCMCIA_POLL_PERIOD);
-
-	sa1100_check_status(skt);
-}
-
-
-/* sa1100_pcmcia_interrupt()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^
- * Service routine for socket driver interrupts (requested by the
- * low-level PCMCIA init() operation via sa1100_pcmcia_thread()).
- * The actual interrupt-servicing work is performed by
- * sa1100_pcmcia_thread(), largely because the Card Services event-
- * handling code performs scheduling operations which cannot be
- * executed from within an interrupt context.
- */
-static irqreturn_t sa1100_pcmcia_interrupt(int irq, void *dev, struct pt_regs *regs)
-{
-	struct sa1100_pcmcia_socket *skt = dev;
-
-	debug(skt, 3, "servicing IRQ %d\n", irq);
-
-	sa1100_check_status(skt);
-
-	return IRQ_HANDLED;
-}
-
-
-/* sa1100_pcmcia_get_status()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the get_status() operation for the in-kernel PCMCIA
- * service (formerly SS_GetStatus in Card Services). Essentially just
- * fills in bits in `status' according to internal driver state or
- * the value of the voltage detect chipselect register.
- *
- * As a debugging note, during card startup, the PCMCIA core issues
- * three set_socket() commands in a row the first with RESET deasserted,
- * the second with RESET asserted, and the last with RESET deasserted
- * again. Following the third set_socket(), a get_status() command will
- * be issued. The kernel is looking for the SS_READY flag (see
- * setup_socket(), reset_socket(), and unreset_socket() in cs.c).
- *
- * Returns: 0
- */
-static int
-sa1100_pcmcia_get_status(struct pcmcia_socket *sock, unsigned int *status)
-{
-	struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
-
-	skt->status = sa1100_pcmcia_skt_state(skt);
-	*status = skt->status;
-
-	return 0;
-}
-
-
-/* sa1100_pcmcia_get_socket()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the get_socket() operation for the in-kernel PCMCIA
- * service (formerly SS_GetSocket in Card Services). Not a very 
- * exciting routine.
- *
- * Returns: 0
- */
-static int
-sa1100_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
-{
-  struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
-
-  debug(skt, 2, "\n");
-
-  *state = skt->cs_state;
-
-  return 0;
-}
-
-/* sa1100_pcmcia_set_socket()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the set_socket() operation for the in-kernel PCMCIA
- * service (formerly SS_SetSocket in Card Services). We more or
- * less punt all of this work and let the kernel handle the details
- * of power configuration, reset, &c. We also record the value of
- * `state' in order to regurgitate it to the PCMCIA core later.
- *
- * Returns: 0
- */
-static int
-sa1100_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
-{
-  struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
-
-  debug(skt, 2, "mask: %s%s%s%s%s%sflags: %s%s%s%s%s%sVcc %d Vpp %d irq %d\n",
-	(state->csc_mask==0)?"<NONE> ":"",
-	(state->csc_mask&SS_DETECT)?"DETECT ":"",
-	(state->csc_mask&SS_READY)?"READY ":"",
-	(state->csc_mask&SS_BATDEAD)?"BATDEAD ":"",
-	(state->csc_mask&SS_BATWARN)?"BATWARN ":"",
-	(state->csc_mask&SS_STSCHG)?"STSCHG ":"",
-	(state->flags==0)?"<NONE> ":"",
-	(state->flags&SS_PWR_AUTO)?"PWR_AUTO ":"",
-	(state->flags&SS_IOCARD)?"IOCARD ":"",
-	(state->flags&SS_RESET)?"RESET ":"",
-	(state->flags&SS_SPKR_ENA)?"SPKR_ENA ":"",
-	(state->flags&SS_OUTPUT_ENA)?"OUTPUT_ENA ":"",
-	state->Vcc, state->Vpp, state->io_irq);
-
-  return sa1100_pcmcia_config_skt(skt, state);
-}  /* sa1100_pcmcia_set_socket() */
-
-
-/* sa1100_pcmcia_set_io_map()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the set_io_map() operation for the in-kernel PCMCIA
- * service (formerly SS_SetIOMap in Card Services). We configure
- * the map speed as requested, but override the address ranges
- * supplied by Card Services.
- *
- * Returns: 0 on success, -1 on error
- */
-static int
-sa1100_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *map)
-{
-	struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
-	unsigned short speed = map->speed;
-
-	debug(skt, 2, "map %u  speed %u start 0x%08x stop 0x%08x\n",
-		map->map, map->speed, map->start, map->stop);
-	debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n",
-		(map->flags==0)?"<NONE>":"",
-		(map->flags&MAP_ACTIVE)?"ACTIVE ":"",
-		(map->flags&MAP_16BIT)?"16BIT ":"",
-		(map->flags&MAP_AUTOSZ)?"AUTOSZ ":"",
-		(map->flags&MAP_0WS)?"0WS ":"",
-		(map->flags&MAP_WRPROT)?"WRPROT ":"",
-		(map->flags&MAP_USE_WAIT)?"USE_WAIT ":"",
-		(map->flags&MAP_PREFETCH)?"PREFETCH ":"");
-
-	if (map->map >= MAX_IO_WIN) {
-		printk(KERN_ERR "%s(): map (%d) out of range\n", __FUNCTION__,
-		       map->map);
-		return -1;
-	}
-
-	if (map->flags & MAP_ACTIVE) {
-		if (speed == 0)
-			speed = SA1100_PCMCIA_IO_ACCESS;
-	} else {
-		speed = 0;
-	}
-
-	skt->spd_io[map->map] = speed;
-	sa1100_pcmcia_set_mecr(skt, cpufreq_get(0));
-
-	if (map->stop == 1)
-		map->stop = PAGE_SIZE-1;
-
-	map->stop -= map->start;
-	map->stop += (unsigned long)skt->virt_io;
-	map->start = (unsigned long)skt->virt_io;
-
-	return 0;
-}  /* sa1100_pcmcia_set_io_map() */
-
-
-/* sa1100_pcmcia_set_mem_map()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the set_mem_map() operation for the in-kernel PCMCIA
- * service (formerly SS_SetMemMap in Card Services). We configure
- * the map speed as requested, but override the address ranges
- * supplied by Card Services.
- *
- * Returns: 0 on success, -1 on error
- */
-static int
-sa1100_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map)
-{
-	struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
-	struct resource *res;
-	unsigned short speed = map->speed;
-
-	debug(skt, 2, "map %u speed %u card_start %08x\n",
-		map->map, map->speed, map->card_start);
-	debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n",
-		(map->flags==0)?"<NONE>":"",
-		(map->flags&MAP_ACTIVE)?"ACTIVE ":"",
-		(map->flags&MAP_16BIT)?"16BIT ":"",
-		(map->flags&MAP_AUTOSZ)?"AUTOSZ ":"",
-		(map->flags&MAP_0WS)?"0WS ":"",
-		(map->flags&MAP_WRPROT)?"WRPROT ":"",
-		(map->flags&MAP_ATTRIB)?"ATTRIB ":"",
-		(map->flags&MAP_USE_WAIT)?"USE_WAIT ":"");
-
-	if (map->map >= MAX_WIN)
-		return -EINVAL;
-
-	if (map->flags & MAP_ACTIVE) {
-		if (speed == 0)
-			speed = 300;
-	} else {
-		speed = 0;
-	}
-
-	if (map->flags & MAP_ATTRIB) {
-		res = &skt->res_attr;
-		skt->spd_attr[map->map] = speed;
-		skt->spd_mem[map->map] = 0;
-	} else {
-		res = &skt->res_mem;
-		skt->spd_attr[map->map] = 0;
-		skt->spd_mem[map->map] = speed;
-	}
-
-	sa1100_pcmcia_set_mecr(skt, cpufreq_get(0));
-
-	map->sys_stop -= map->sys_start;
-	map->sys_stop += res->start + map->card_start;
-	map->sys_start = res->start + map->card_start;
-
-	return 0;
-}
-
-struct bittbl {
-	unsigned int mask;
-	const char *name;
-};
-
-static struct bittbl status_bits[] = {
-	{ SS_WRPROT,		"SS_WRPROT"	},
-	{ SS_BATDEAD,		"SS_BATDEAD"	},
-	{ SS_BATWARN,		"SS_BATWARN"	},
-	{ SS_READY,		"SS_READY"	},
-	{ SS_DETECT,		"SS_DETECT"	},
-	{ SS_POWERON,		"SS_POWERON"	},
-	{ SS_STSCHG,		"SS_STSCHG"	},
-	{ SS_3VCARD,		"SS_3VCARD"	},
-	{ SS_XVCARD,		"SS_XVCARD"	},
-};
-
-static struct bittbl conf_bits[] = {
-	{ SS_PWR_AUTO,		"SS_PWR_AUTO"	},
-	{ SS_IOCARD,		"SS_IOCARD"	},
-	{ SS_RESET,		"SS_RESET"	},
-	{ SS_DMA_MODE,		"SS_DMA_MODE"	},
-	{ SS_SPKR_ENA,		"SS_SPKR_ENA"	},
-	{ SS_OUTPUT_ENA,	"SS_OUTPUT_ENA"	},
-};
-
-static void
-dump_bits(char **p, const char *prefix, unsigned int val, struct bittbl *bits, int sz)
-{
-	char *b = *p;
-	int i;
-
-	b += sprintf(b, "%-9s:", prefix);
-	for (i = 0; i < sz; i++)
-		if (val & bits[i].mask)
-			b += sprintf(b, " %s", bits[i].name);
-	*b++ = '\n';
-	*p = b;
-}
-
-/* show_status()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the /sys/class/pcmcia_socket/??/status file.
- *
- * Returns: the number of characters added to the buffer
- */
-static ssize_t show_status(struct class_device *class_dev, char *buf)
-{
-	struct sa1100_pcmcia_socket *skt = container_of(class_dev, 
-				struct sa1100_pcmcia_socket, socket.dev);
-	unsigned int clock = cpufreq_get(0);
-	unsigned long mecr = MECR;
-	char *p = buf;
-
-	p+=sprintf(p, "slot     : %d\n", skt->nr);
-
-	dump_bits(&p, "status", skt->status,
-		  status_bits, ARRAY_SIZE(status_bits));
-	dump_bits(&p, "csc_mask", skt->cs_state.csc_mask,
-		  status_bits, ARRAY_SIZE(status_bits));
-	dump_bits(&p, "cs_flags", skt->cs_state.flags,
-		  conf_bits, ARRAY_SIZE(conf_bits));
-
-	p+=sprintf(p, "Vcc      : %d\n", skt->cs_state.Vcc);
-	p+=sprintf(p, "Vpp      : %d\n", skt->cs_state.Vpp);
-	p+=sprintf(p, "IRQ      : %d (%d)\n", skt->cs_state.io_irq, skt->irq);
-
-	p+=sprintf(p, "I/O      : %u (%u)\n",
-		calc_speed(skt->spd_io, MAX_IO_WIN, SA1100_PCMCIA_IO_ACCESS),
-		sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr)));
-
-	p+=sprintf(p, "attribute: %u (%u)\n",
-		calc_speed(skt->spd_attr, MAX_WIN, SA1100_PCMCIA_3V_MEM_ACCESS),
-		sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr)));
-
-	p+=sprintf(p, "common   : %u (%u)\n",
-		calc_speed(skt->spd_mem, MAX_WIN, SA1100_PCMCIA_3V_MEM_ACCESS),
-		sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr)));
-
-	return p-buf;
-}
-static CLASS_DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
-
-
-static struct pccard_operations sa11xx_pcmcia_operations = {
-	.init			= sa1100_pcmcia_sock_init,
-	.suspend		= sa1100_pcmcia_suspend,
-	.get_status		= sa1100_pcmcia_get_status,
-	.get_socket		= sa1100_pcmcia_get_socket,
-	.set_socket		= sa1100_pcmcia_set_socket,
-	.set_io_map		= sa1100_pcmcia_set_io_map,
-	.set_mem_map		= sa1100_pcmcia_set_mem_map,
-};
-
-int sa11xx_request_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr)
-{
-	int i, res = 0;
-
-	for (i = 0; i < nr; i++) {
-		if (irqs[i].sock != skt->nr)
-			continue;
-		res = request_irq(irqs[i].irq, sa1100_pcmcia_interrupt,
-				  SA_INTERRUPT, irqs[i].str, skt);
-		if (res)
-			break;
-		set_irq_type(irqs[i].irq, IRQT_NOEDGE);
-	}
-
-	if (res) {
-		printk(KERN_ERR "PCMCIA: request for IRQ%d failed (%d)\n",
-			irqs[i].irq, res);
-
-		while (i--)
-			if (irqs[i].sock == skt->nr)
-				free_irq(irqs[i].irq, skt);
-	}
-	return res;
-}
-EXPORT_SYMBOL(sa11xx_request_irqs);
-
-void sa11xx_free_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr)
-{
-	int i;
-
-	for (i = 0; i < nr; i++)
-		if (irqs[i].sock == skt->nr)
-			free_irq(irqs[i].irq, skt);
-}
-EXPORT_SYMBOL(sa11xx_free_irqs);
-
-void sa11xx_disable_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr)
-{
-	int i;
-
-	for (i = 0; i < nr; i++)
-		if (irqs[i].sock == skt->nr)
-			set_irq_type(irqs[i].irq, IRQT_NOEDGE);
-}
-EXPORT_SYMBOL(sa11xx_disable_irqs);
-
-void sa11xx_enable_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr)
-{
-	int i;
-
-	for (i = 0; i < nr; i++)
-		if (irqs[i].sock == skt->nr) {
-			set_irq_type(irqs[i].irq, IRQT_RISING);
-			set_irq_type(irqs[i].irq, IRQT_BOTHEDGE);
-		}
-}
-EXPORT_SYMBOL(sa11xx_enable_irqs);
-
-static LIST_HEAD(sa1100_sockets);
-static DECLARE_MUTEX(sa1100_sockets_lock);
-
-static const char *skt_names[] = {
-	"PCMCIA socket 0",
-	"PCMCIA socket 1",
-};
-
-struct skt_dev_info {
-	int nskt;
-	struct sa1100_pcmcia_socket skt[0];
-};
-
-#define SKT_DEV_INFO_SIZE(n) \
-	(sizeof(struct skt_dev_info) + (n)*sizeof(struct sa1100_pcmcia_socket))
-
-int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
-{
-	struct skt_dev_info *sinfo;
-	unsigned int cpu_clock;
-	int ret, i;
-
-	/*
-	 * set default MECR calculation if the board specific
-	 * code did not specify one...
-	 */
-	if (!ops->socket_get_timing)
-		ops->socket_get_timing = sa1100_pcmcia_default_mecr_timing;
-
-	down(&sa1100_sockets_lock);
-
-	sinfo = kmalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
-	if (!sinfo) {
-		ret = -ENOMEM;
-		goto out;
-	}
-
-	memset(sinfo, 0, SKT_DEV_INFO_SIZE(nr));
-	sinfo->nskt = nr;
-
-	cpu_clock = cpufreq_get(0);
-
-	/*
-	 * Initialise the per-socket structure.
-	 */
-	for (i = 0; i < nr; i++) {
-		struct sa1100_pcmcia_socket *skt = &sinfo->skt[i];
-
-		skt->socket.ops = &sa11xx_pcmcia_operations;
-		skt->socket.owner = ops->owner;
-		skt->socket.dev.dev = dev;
-
-		init_timer(&skt->poll_timer);
-		skt->poll_timer.function = sa1100_pcmcia_poll_event;
-		skt->poll_timer.data = (unsigned long)skt;
-		skt->poll_timer.expires = jiffies + SA1100_PCMCIA_POLL_PERIOD;
-
-		skt->nr		= first + i;
-		skt->irq	= NO_IRQ;
-		skt->dev	= dev;
-		skt->ops	= ops;
-
-		skt->res_skt.start	= _PCMCIA(skt->nr);
-		skt->res_skt.end	= _PCMCIA(skt->nr) + PCMCIASp - 1;
-		skt->res_skt.name	= skt_names[skt->nr];
-		skt->res_skt.flags	= IORESOURCE_MEM;
-
-		ret = request_resource(&iomem_resource, &skt->res_skt);
-		if (ret)
-			goto out_err_1;
-
-		skt->res_io.start	= _PCMCIAIO(skt->nr);
-		skt->res_io.end		= _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1;
-		skt->res_io.name	= "io";
-		skt->res_io.flags	= IORESOURCE_MEM | IORESOURCE_BUSY;
-
-		ret = request_resource(&skt->res_skt, &skt->res_io);
-		if (ret)
-			goto out_err_2;
-
-		skt->res_mem.start	= _PCMCIAMem(skt->nr);
-		skt->res_mem.end	= _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1;
-		skt->res_mem.name	= "memory";
-		skt->res_mem.flags	= IORESOURCE_MEM;
-
-		ret = request_resource(&skt->res_skt, &skt->res_mem);
-		if (ret)
-			goto out_err_3;
-
-		skt->res_attr.start	= _PCMCIAAttr(skt->nr);
-		skt->res_attr.end	= _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1;
-		skt->res_attr.name	= "attribute";
-		skt->res_attr.flags	= IORESOURCE_MEM;
-		
-		ret = request_resource(&skt->res_skt, &skt->res_attr);
-		if (ret)
-			goto out_err_4;
-
-		skt->virt_io = ioremap(skt->res_io.start, 0x10000);
-		if (skt->virt_io == NULL) {
-			ret = -ENOMEM;
-			goto out_err_5;
-		}
-
-		list_add(&skt->node, &sa1100_sockets);
-
-		/*
-		 * We initialize the MECR to default values here, because
-		 * we are not guaranteed to see a SetIOMap operation at
-		 * runtime.
-		 */
-		sa1100_pcmcia_set_mecr(skt, cpu_clock);
-
-		ret = ops->hw_init(skt);
-		if (ret)
-			goto out_err_6;
-
-		skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD;
-		skt->socket.irq_mask = 0;
-		skt->socket.map_size = PAGE_SIZE;
-		skt->socket.pci_irq = skt->irq;
-		skt->socket.io_offset = (unsigned long)skt->virt_io;
-
-		skt->status = sa1100_pcmcia_skt_state(skt);
-
-		ret = pcmcia_register_socket(&skt->socket);
-		if (ret)
-			goto out_err_7;
-
-		WARN_ON(skt->socket.sock != i);
-
-		add_timer(&skt->poll_timer);
-
-		class_device_create_file(&skt->socket.dev, &class_device_attr_status);
-	}
-
-	dev_set_drvdata(dev, sinfo);
-	ret = 0;
-	goto out;
-
-	do {
-		struct sa1100_pcmcia_socket *skt = &sinfo->skt[i];
-
-		del_timer_sync(&skt->poll_timer);
-		pcmcia_unregister_socket(&skt->socket);
-
- out_err_7:
-		flush_scheduled_work();
-
-		ops->hw_shutdown(skt);
- out_err_6:
- 		list_del(&skt->node);
-		iounmap(skt->virt_io);
- out_err_5:
-		release_resource(&skt->res_attr);
- out_err_4:
-		release_resource(&skt->res_mem);
- out_err_3:
-		release_resource(&skt->res_io);
- out_err_2:
-		release_resource(&skt->res_skt);
- out_err_1:
-		i--;
-	} while (i > 0);
-
-	kfree(sinfo);
-
- out:
-	up(&sa1100_sockets_lock);
-	return ret;
-}
-EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe);
-
-int sa11xx_drv_pcmcia_remove(struct device *dev)
-{
-	struct skt_dev_info *sinfo = dev_get_drvdata(dev);
-	int i;
-
-	dev_set_drvdata(dev, NULL);
-
-	down(&sa1100_sockets_lock);
-	for (i = 0; i < sinfo->nskt; i++) {
-		struct sa1100_pcmcia_socket *skt = &sinfo->skt[i];
-
-		del_timer_sync(&skt->poll_timer);
-
-		pcmcia_unregister_socket(&skt->socket);
-
-		flush_scheduled_work();
-
-		skt->ops->hw_shutdown(skt);
-
-		sa1100_pcmcia_config_skt(skt, &dead_socket);
-
-		list_del(&skt->node);
-		iounmap(skt->virt_io);
-		skt->virt_io = NULL;
-		release_resource(&skt->res_attr);
-		release_resource(&skt->res_mem);
-		release_resource(&skt->res_io);
-		release_resource(&skt->res_skt);
-	}
-	up(&sa1100_sockets_lock);
-
-	kfree(sinfo);
-
-	return 0;
-}
-EXPORT_SYMBOL(sa11xx_drv_pcmcia_remove);
-
-#ifdef CONFIG_CPU_FREQ
-
-/* sa1100_pcmcia_update_mecr()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- * When sa1100_pcmcia_notifier() decides that a MECR adjustment (due
- * to a core clock frequency change) is needed, this routine establishes
- * new BS_xx values consistent with the clock speed `clock'.
- */
-static void sa1100_pcmcia_update_mecr(unsigned int clock)
-{
-	struct sa1100_pcmcia_socket *skt;
-
-	down(&sa1100_sockets_lock);
-	list_for_each_entry(skt, &sa1100_sockets, node)
-		sa1100_pcmcia_set_mecr(skt, clock);
-	up(&sa1100_sockets_lock);
-}
-
-/* sa1100_pcmcia_notifier()
- * ^^^^^^^^^^^^^^^^^^^^^^^^
- * When changing the processor core clock frequency, it is necessary
- * to adjust the MECR timings accordingly. We've recorded the timings
- * requested by Card Services, so this is just a matter of finding
- * out what our current speed is, and then recomputing the new MECR
- * values.
- *
- * Returns: 0 on success, -1 on error
- */
-static int
-sa1100_pcmcia_notifier(struct notifier_block *nb, unsigned long val,
-		       void *data)
-{
-	struct cpufreq_freqs *freqs = data;
-
-	switch (val) {
-	case CPUFREQ_PRECHANGE:
-		if (freqs->new > freqs->old)
-			sa1100_pcmcia_update_mecr(freqs->new);
-		break;
-
-	case CPUFREQ_POSTCHANGE:
-		if (freqs->new < freqs->old)
-			sa1100_pcmcia_update_mecr(freqs->new);
-		break;
-	}
-
-	return 0;
-}
-
-static struct notifier_block sa1100_pcmcia_notifier_block = {
-	.notifier_call	= sa1100_pcmcia_notifier
-};
-
-static int __init sa11xx_pcmcia_init(void)
-{
-	int ret;
-
-	printk(KERN_INFO "SA11xx PCMCIA\n");
-
-	ret = cpufreq_register_notifier(&sa1100_pcmcia_notifier_block,
-					CPUFREQ_TRANSITION_NOTIFIER);
-	if (ret < 0)
-		printk(KERN_ERR "Unable to register CPU frequency change "
-			"notifier (%d)\n", ret);
-
-	return ret;
-}
-module_init(sa11xx_pcmcia_init);
-
-static void __exit sa11xx_pcmcia_exit(void)
-{
-	cpufreq_unregister_notifier(&sa1100_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
-}
-
-module_exit(sa11xx_pcmcia_exit);
-#endif
-
-MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>");
-MODULE_DESCRIPTION("Linux PCMCIA Card Services: SA-11xx core socket driver");
-MODULE_LICENSE("Dual MPL/GPL");
diff -Nru a/drivers/pcmcia/sa11xx_core.h b/drivers/pcmcia/sa11xx_core.h
--- a/drivers/pcmcia/sa11xx_core.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,121 +0,0 @@
-/*
- * linux/include/asm/arch/pcmcia.h
- *
- * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
- *
- * This file contains definitions for the low-level SA-1100 kernel PCMCIA
- * interface. Please see linux/Documentation/arm/SA1100/PCMCIA for details.
- */
-#ifndef _ASM_ARCH_PCMCIA
-#define _ASM_ARCH_PCMCIA
-
-/* include the world */
-#include <pcmcia/version.h>
-#include <pcmcia/cs_types.h>
-#include <pcmcia/cs.h>
-#include <pcmcia/ss.h>
-#include <pcmcia/bulkmem.h>
-#include <pcmcia/cistpl.h>
-#include "cs_internal.h"
-
-struct device;
-
-/* Ideally, we'd support up to MAX_SOCK sockets, but the SA-1100 only
- * has support for two. This shows up in lots of hardwired ways, such
- * as the fact that MECR only has enough bits to configure two sockets.
- * Since it's so entrenched in the hardware, limiting the software
- * in this way doesn't seem too terrible.
- */
-#define SA1100_PCMCIA_MAX_SOCK   (2)
-
-struct pcmcia_state {
-  unsigned detect: 1,
-            ready: 1,
-             bvd1: 1,
-             bvd2: 1,
-           wrprot: 1,
-            vs_3v: 1,
-            vs_Xv: 1;
-};
-
-/*
- * This structure encapsulates per-socket state which we might need to
- * use when responding to a Card Services query of some kind.
- */
-struct sa1100_pcmcia_socket {
-	struct pcmcia_socket	socket;
-
-	/*
-	 * Info from low level handler
-	 */
-	struct device		*dev;
-	unsigned int		nr;
-	unsigned int		irq;
-
-	/*
-	 * Core PCMCIA state
-	 */
-	struct pcmcia_low_level *ops;
-
-	unsigned int		status;
-	socket_state_t		cs_state;
-
-	unsigned short		spd_io[MAX_IO_WIN];
-	unsigned short		spd_mem[MAX_WIN];
-	unsigned short		spd_attr[MAX_WIN];
-
-	struct resource		res_skt;
-	struct resource		res_io;
-	struct resource		res_mem;
-	struct resource		res_attr;
-	void			*virt_io;
-
-	unsigned int		irq_state;
-
-	struct timer_list	poll_timer;
-	struct list_head	node;
-};
-
-struct pcmcia_low_level {
-	struct module *owner;
-
-	int (*hw_init)(struct sa1100_pcmcia_socket *);
-	void (*hw_shutdown)(struct sa1100_pcmcia_socket *);
-
-	void (*socket_state)(struct sa1100_pcmcia_socket *, struct pcmcia_state *);
-	int (*configure_socket)(struct sa1100_pcmcia_socket *, const socket_state_t *);
-
-	/*
-	 * Enable card status IRQs on (re-)initialisation.  This can
-	 * be called at initialisation, power management event, or
-	 * pcmcia event.
-	 */
-	void (*socket_init)(struct sa1100_pcmcia_socket *);
-
-	/*
-	 * Disable card status IRQs and PCMCIA bus on suspend.
-	 */
-	void (*socket_suspend)(struct sa1100_pcmcia_socket *);
-
-	/*
-	 * Calculate MECR timing clock wait states
-	 */
-	unsigned int (*socket_get_timing)(struct sa1100_pcmcia_socket *,
-			unsigned int cpu_speed, unsigned int cmd_time);
-};
-
-struct pcmcia_irqs {
-	int sock;
-	int irq;
-	const char *str;
-};
-
-int sa11xx_request_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
-void sa11xx_free_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
-void sa11xx_disable_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
-void sa11xx_enable_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
-
-extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr);
-extern int sa11xx_drv_pcmcia_remove(struct device *dev);
-
-#endif
diff -Nru a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pcmcia/soc_common.c	Tue Jun 15 22:20:37 2004
@@ -0,0 +1,848 @@
+/*======================================================================
+
+    Common support code for the PCMCIA control functionality of
+    integrated SOCs like the SA-11x0 and PXA2xx microprocessors.
+
+    The contents of this file are subject to the Mozilla Public
+    License Version 1.1 (the "License"); you may not use this file
+    except in compliance with the License. You may obtain a copy of
+    the License at http://www.mozilla.org/MPL/
+
+    Software distributed under the License is distributed on an "AS
+    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+    implied. See the License for the specific language governing
+    rights and limitations under the License.
+
+    The initial developer of the original code is John G. Dorsey
+    <john+@cs.cmu.edu>.  Portions created by John G. Dorsey are
+    Copyright (C) 1999 John G. Dorsey.  All Rights Reserved.
+
+    Alternatively, the contents of this file may be used under the
+    terms of the GNU Public License version 2 (the "GPL"), in which
+    case the provisions of the GPL are applicable instead of the
+    above.  If you wish to allow the use of your version of this file
+    only under the terms of the GPL and not to allow others to use
+    your version of this file under the MPL, indicate your decision
+    by deleting the provisions above and replace them with the notice
+    and other provisions required by the GPL.  If you do not delete
+    the provisions above, a recipient may use your version of this
+    file under either the MPL or the GPL.
+
+======================================================================*/
+
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/spinlock.h>
+#include <linux/cpufreq.h>
+
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/system.h>
+
+#include "soc_common.h"
+
+#ifdef DEBUG
+
+static int pc_debug;
+module_param(pc_debug, int, 0644);
+
+void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
+		      int lvl, const char *fmt, ...)
+{
+	va_list args;
+	if (pc_debug > lvl) {
+		printk(KERN_DEBUG "skt%u: %s: ", skt->nr, func);
+		va_start(args, fmt);
+		printk(fmt, args);
+		va_end(args);
+	}
+}
+
+#endif
+
+#define to_soc_pcmcia_socket(x)	container_of(x, struct soc_pcmcia_socket, socket)
+
+static unsigned short
+calc_speed(unsigned short *spds, int num, unsigned short dflt)
+{
+	unsigned short speed = 0;
+	int i;
+
+	for (i = 0; i < num; i++)
+		if (speed < spds[i])
+			speed = spds[i];
+	if (speed == 0)
+		speed = dflt;
+
+	return speed;
+}
+
+void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *skt, struct soc_pcmcia_timing *timing)
+{
+	timing->io = calc_speed(skt->spd_io, MAX_IO_WIN, SOC_PCMCIA_IO_ACCESS);
+	timing->mem = calc_speed(skt->spd_mem, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
+	timing->attr = calc_speed(skt->spd_attr, MAX_WIN, SOC_PCMCIA_3V_MEM_ACCESS);
+}
+EXPORT_SYMBOL(soc_common_pcmcia_get_timing);
+
+static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt)
+{
+	struct pcmcia_state state;
+	unsigned int stat;
+
+	memset(&state, 0, sizeof(struct pcmcia_state));
+
+	skt->ops->socket_state(skt, &state);
+
+	stat = state.detect  ? SS_DETECT : 0;
+	stat |= state.ready  ? SS_READY  : 0;
+	stat |= state.wrprot ? SS_WRPROT : 0;
+	stat |= state.vs_3v  ? SS_3VCARD : 0;
+	stat |= state.vs_Xv  ? SS_XVCARD : 0;
+
+	/* The power status of individual sockets is not available
+	 * explicitly from the hardware, so we just remember the state
+	 * and regurgitate it upon request:
+	 */
+	stat |= skt->cs_state.Vcc ? SS_POWERON : 0;
+
+	if (skt->cs_state.flags & SS_IOCARD)
+		stat |= state.bvd1 ? SS_STSCHG : 0;
+	else {
+		if (state.bvd1 == 0)
+			stat |= SS_BATDEAD;
+		else if (state.bvd2 == 0)
+			stat |= SS_BATWARN;
+	}
+	return stat;
+}
+
+/*
+ * soc_common_pcmcia_config_skt
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ *
+ * Convert PCMCIA socket state to our socket configure structure.
+ */
+static int
+soc_common_pcmcia_config_skt(struct soc_pcmcia_socket *skt, socket_state_t *state)
+{
+	int ret;
+
+	ret = skt->ops->configure_socket(skt, state);
+	if (ret == 0) {
+		/*
+		 * This really needs a better solution.  The IRQ
+		 * may or may not be claimed by the driver.
+		 */
+		if (skt->irq_state != 1 && state->io_irq) {
+			skt->irq_state = 1;
+			set_irq_type(skt->irq, IRQT_FALLING);
+		} else if (skt->irq_state == 1 && state->io_irq == 0) {
+			skt->irq_state = 0;
+			set_irq_type(skt->irq, IRQT_NOEDGE);
+		}
+
+		skt->cs_state = *state;
+	}
+
+	if (ret < 0)
+		printk(KERN_ERR "soc_common_pcmcia: unable to configure "
+		       "socket %d\n", skt->nr);
+
+	return ret;
+}
+
+/* soc_common_pcmcia_sock_init()
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ *
+ * (Re-)Initialise the socket, turning on status interrupts
+ * and PCMCIA bus.  This must wait for power to stabilise
+ * so that the card status signals report correctly.
+ *
+ * Returns: 0
+ */
+static int soc_common_pcmcia_sock_init(struct pcmcia_socket *sock)
+{
+	struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
+
+	debug(skt, 2, "initializing socket\n");
+
+	skt->ops->socket_init(skt);
+	return 0;
+}
+
+
+/*
+ * soc_common_pcmcia_suspend()
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ *
+ * Remove power on the socket, disable IRQs from the card.
+ * Turn off status interrupts, and disable the PCMCIA bus.
+ *
+ * Returns: 0
+ */
+static int soc_common_pcmcia_suspend(struct pcmcia_socket *sock)
+{
+	struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
+	int ret;
+
+	debug(skt, 2, "suspending socket\n");
+
+	ret = soc_common_pcmcia_config_skt(skt, &dead_socket);
+	if (ret == 0)
+		skt->ops->socket_suspend(skt);
+
+	return ret;
+}
+
+static spinlock_t status_lock = SPIN_LOCK_UNLOCKED;
+
+static void soc_common_check_status(struct soc_pcmcia_socket *skt)
+{
+	unsigned int events;
+
+	debug(skt, 4, "entering PCMCIA monitoring thread\n");
+
+	do {
+		unsigned int status;
+		unsigned long flags;
+
+		status = soc_common_pcmcia_skt_state(skt);
+
+		spin_lock_irqsave(&status_lock, flags);
+		events = (status ^ skt->status) & skt->cs_state.csc_mask;
+		skt->status = status;
+		spin_unlock_irqrestore(&status_lock, flags);
+
+		debug(skt, 4, "events: %s%s%s%s%s%s\n",
+			events == 0         ? "<NONE>"   : "",
+			events & SS_DETECT  ? "DETECT "  : "",
+			events & SS_READY   ? "READY "   : "",
+			events & SS_BATDEAD ? "BATDEAD " : "",
+			events & SS_BATWARN ? "BATWARN " : "",
+			events & SS_STSCHG  ? "STSCHG "  : "");
+
+		if (events)
+			pcmcia_parse_events(&skt->socket, events);
+	} while (events);
+}
+
+/* Let's poll for events in addition to IRQs since IRQ only is unreliable... */
+static void soc_common_pcmcia_poll_event(unsigned long dummy)
+{
+	struct soc_pcmcia_socket *skt = (struct soc_pcmcia_socket *)dummy;
+	debug(skt, 4, "polling for events\n");
+
+	mod_timer(&skt->poll_timer, jiffies + SOC_PCMCIA_POLL_PERIOD);
+
+	soc_common_check_status(skt);
+}
+
+
+/*
+ * Service routine for socket driver interrupts (requested by the
+ * low-level PCMCIA init() operation via soc_common_pcmcia_thread()).
+ * The actual interrupt-servicing work is performed by
+ * soc_common_pcmcia_thread(), largely because the Card Services event-
+ * handling code performs scheduling operations which cannot be
+ * executed from within an interrupt context.
+ */
+static irqreturn_t soc_common_pcmcia_interrupt(int irq, void *dev, struct pt_regs *regs)
+{
+	struct soc_pcmcia_socket *skt = dev;
+
+	debug(skt, 3, "servicing IRQ %d\n", irq);
+
+	soc_common_check_status(skt);
+
+	return IRQ_HANDLED;
+}
+
+
+/*
+ *  Implements the get_status() operation for the in-kernel PCMCIA
+ * service (formerly SS_GetStatus in Card Services). Essentially just
+ * fills in bits in `status' according to internal driver state or
+ * the value of the voltage detect chipselect register.
+ *
+ * As a debugging note, during card startup, the PCMCIA core issues
+ * three set_socket() commands in a row the first with RESET deasserted,
+ * the second with RESET asserted, and the last with RESET deasserted
+ * again. Following the third set_socket(), a get_status() command will
+ * be issued. The kernel is looking for the SS_READY flag (see
+ * setup_socket(), reset_socket(), and unreset_socket() in cs.c).
+ *
+ * Returns: 0
+ */
+static int
+soc_common_pcmcia_get_status(struct pcmcia_socket *sock, unsigned int *status)
+{
+	struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
+
+	skt->status = soc_common_pcmcia_skt_state(skt);
+	*status = skt->status;
+
+	return 0;
+}
+
+
+/*
+ * Implements the get_socket() operation for the in-kernel PCMCIA
+ * service (formerly SS_GetSocket in Card Services). Not a very
+ * exciting routine.
+ *
+ * Returns: 0
+ */
+static int
+soc_common_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
+{
+	struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
+
+	debug(skt, 2, "\n");
+
+	*state = skt->cs_state;
+
+	return 0;
+}
+
+/*
+ * Implements the set_socket() operation for the in-kernel PCMCIA
+ * service (formerly SS_SetSocket in Card Services). We more or
+ * less punt all of this work and let the kernel handle the details
+ * of power configuration, reset, &c. We also record the value of
+ * `state' in order to regurgitate it to the PCMCIA core later.
+ *
+ * Returns: 0
+ */
+static int
+soc_common_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
+{
+	struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
+
+	debug(skt, 2, "mask: %s%s%s%s%s%sflags: %s%s%s%s%s%sVcc %d Vpp %d irq %d\n",
+			(state->csc_mask==0)?"<NONE> ":"",
+			(state->csc_mask&SS_DETECT)?"DETECT ":"",
+			(state->csc_mask&SS_READY)?"READY ":"",
+			(state->csc_mask&SS_BATDEAD)?"BATDEAD ":"",
+			(state->csc_mask&SS_BATWARN)?"BATWARN ":"",
+			(state->csc_mask&SS_STSCHG)?"STSCHG ":"",
+			(state->flags==0)?"<NONE> ":"",
+			(state->flags&SS_PWR_AUTO)?"PWR_AUTO ":"",
+			(state->flags&SS_IOCARD)?"IOCARD ":"",
+			(state->flags&SS_RESET)?"RESET ":"",
+			(state->flags&SS_SPKR_ENA)?"SPKR_ENA ":"",
+			(state->flags&SS_OUTPUT_ENA)?"OUTPUT_ENA ":"",
+			state->Vcc, state->Vpp, state->io_irq);
+
+	return soc_common_pcmcia_config_skt(skt, state);
+}
+
+
+/*
+ * Implements the set_io_map() operation for the in-kernel PCMCIA
+ * service (formerly SS_SetIOMap in Card Services). We configure
+ * the map speed as requested, but override the address ranges
+ * supplied by Card Services.
+ *
+ * Returns: 0 on success, -1 on error
+ */
+static int
+soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *map)
+{
+	struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
+	unsigned short speed = map->speed;
+
+	debug(skt, 2, "map %u  speed %u start 0x%08x stop 0x%08x\n",
+		map->map, map->speed, map->start, map->stop);
+	debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n",
+		(map->flags==0)?"<NONE>":"",
+		(map->flags&MAP_ACTIVE)?"ACTIVE ":"",
+		(map->flags&MAP_16BIT)?"16BIT ":"",
+		(map->flags&MAP_AUTOSZ)?"AUTOSZ ":"",
+		(map->flags&MAP_0WS)?"0WS ":"",
+		(map->flags&MAP_WRPROT)?"WRPROT ":"",
+		(map->flags&MAP_USE_WAIT)?"USE_WAIT ":"",
+		(map->flags&MAP_PREFETCH)?"PREFETCH ":"");
+
+	if (map->map >= MAX_IO_WIN) {
+		printk(KERN_ERR "%s(): map (%d) out of range\n", __FUNCTION__,
+		       map->map);
+		return -1;
+	}
+
+	if (map->flags & MAP_ACTIVE) {
+		if (speed == 0)
+			speed = SOC_PCMCIA_IO_ACCESS;
+	} else {
+		speed = 0;
+	}
+
+	skt->spd_io[map->map] = speed;
+	skt->ops->set_timing(skt);
+
+	if (map->stop == 1)
+		map->stop = PAGE_SIZE-1;
+
+	map->stop -= map->start;
+	map->stop += (unsigned long)skt->virt_io;
+	map->start = (unsigned long)skt->virt_io;
+
+	return 0;
+}
+
+
+/*
+ * Implements the set_mem_map() operation for the in-kernel PCMCIA
+ * service (formerly SS_SetMemMap in Card Services). We configure
+ * the map speed as requested, but override the address ranges
+ * supplied by Card Services.
+ *
+ * Returns: 0 on success, -1 on error
+ */
+static int
+soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map)
+{
+	struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
+	struct resource *res;
+	unsigned short speed = map->speed;
+
+	debug(skt, 2, "map %u speed %u card_start %08x\n",
+		map->map, map->speed, map->card_start);
+	debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n",
+		(map->flags==0)?"<NONE>":"",
+		(map->flags&MAP_ACTIVE)?"ACTIVE ":"",
+		(map->flags&MAP_16BIT)?"16BIT ":"",
+		(map->flags&MAP_AUTOSZ)?"AUTOSZ ":"",
+		(map->flags&MAP_0WS)?"0WS ":"",
+		(map->flags&MAP_WRPROT)?"WRPROT ":"",
+		(map->flags&MAP_ATTRIB)?"ATTRIB ":"",
+		(map->flags&MAP_USE_WAIT)?"USE_WAIT ":"");
+
+	if (map->map >= MAX_WIN)
+		return -EINVAL;
+
+	if (map->flags & MAP_ACTIVE) {
+		if (speed == 0)
+			speed = 300;
+	} else {
+		speed = 0;
+	}
+
+	if (map->flags & MAP_ATTRIB) {
+		res = &skt->res_attr;
+		skt->spd_attr[map->map] = speed;
+		skt->spd_mem[map->map] = 0;
+	} else {
+		res = &skt->res_mem;
+		skt->spd_attr[map->map] = 0;
+		skt->spd_mem[map->map] = speed;
+	}
+
+	skt->ops->set_timing(skt);
+
+	map->sys_stop -= map->sys_start;
+	map->sys_stop += res->start + map->card_start;
+	map->sys_start = res->start + map->card_start;
+
+	return 0;
+}
+
+struct bittbl {
+	unsigned int mask;
+	const char *name;
+};
+
+static struct bittbl status_bits[] = {
+	{ SS_WRPROT,		"SS_WRPROT"	},
+	{ SS_BATDEAD,		"SS_BATDEAD"	},
+	{ SS_BATWARN,		"SS_BATWARN"	},
+	{ SS_READY,		"SS_READY"	},
+	{ SS_DETECT,		"SS_DETECT"	},
+	{ SS_POWERON,		"SS_POWERON"	},
+	{ SS_STSCHG,		"SS_STSCHG"	},
+	{ SS_3VCARD,		"SS_3VCARD"	},
+	{ SS_XVCARD,		"SS_XVCARD"	},
+};
+
+static struct bittbl conf_bits[] = {
+	{ SS_PWR_AUTO,		"SS_PWR_AUTO"	},
+	{ SS_IOCARD,		"SS_IOCARD"	},
+	{ SS_RESET,		"SS_RESET"	},
+	{ SS_DMA_MODE,		"SS_DMA_MODE"	},
+	{ SS_SPKR_ENA,		"SS_SPKR_ENA"	},
+	{ SS_OUTPUT_ENA,	"SS_OUTPUT_ENA"	},
+};
+
+static void
+dump_bits(char **p, const char *prefix, unsigned int val, struct bittbl *bits, int sz)
+{
+	char *b = *p;
+	int i;
+
+	b += sprintf(b, "%-9s:", prefix);
+	for (i = 0; i < sz; i++)
+		if (val & bits[i].mask)
+			b += sprintf(b, " %s", bits[i].name);
+	*b++ = '\n';
+	*p = b;
+}
+
+/*
+ * Implements the /sys/class/pcmcia_socket/??/status file.
+ *
+ * Returns: the number of characters added to the buffer
+ */
+static ssize_t show_status(struct class_device *class_dev, char *buf)
+{
+	struct soc_pcmcia_socket *skt =
+		container_of(class_dev, struct soc_pcmcia_socket, socket.dev);
+	char *p = buf;
+
+	p+=sprintf(p, "slot     : %d\n", skt->nr);
+
+	dump_bits(&p, "status", skt->status,
+		  status_bits, ARRAY_SIZE(status_bits));
+	dump_bits(&p, "csc_mask", skt->cs_state.csc_mask,
+		  status_bits, ARRAY_SIZE(status_bits));
+	dump_bits(&p, "cs_flags", skt->cs_state.flags,
+		  conf_bits, ARRAY_SIZE(conf_bits));
+
+	p+=sprintf(p, "Vcc      : %d\n", skt->cs_state.Vcc);
+	p+=sprintf(p, "Vpp      : %d\n", skt->cs_state.Vpp);
+	p+=sprintf(p, "IRQ      : %d (%d)\n", skt->cs_state.io_irq, skt->irq);
+	if (skt->ops->show_timing)
+		p+=skt->ops->show_timing(skt, p);
+
+	return p-buf;
+}
+static CLASS_DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
+
+
+static struct pccard_operations soc_common_pcmcia_operations = {
+	.init			= soc_common_pcmcia_sock_init,
+	.suspend		= soc_common_pcmcia_suspend,
+	.get_status		= soc_common_pcmcia_get_status,
+	.get_socket		= soc_common_pcmcia_get_socket,
+	.set_socket		= soc_common_pcmcia_set_socket,
+	.set_io_map		= soc_common_pcmcia_set_io_map,
+	.set_mem_map		= soc_common_pcmcia_set_mem_map,
+};
+
+
+int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt,
+			    struct pcmcia_irqs *irqs, int nr)
+{
+	int i, res = 0;
+
+	for (i = 0; i < nr; i++) {
+		if (irqs[i].sock != skt->nr)
+			continue;
+		res = request_irq(irqs[i].irq, soc_common_pcmcia_interrupt,
+				  SA_INTERRUPT, irqs[i].str, skt);
+		if (res)
+			break;
+		set_irq_type(irqs[i].irq, IRQT_NOEDGE);
+	}
+
+	if (res) {
+		printk(KERN_ERR "PCMCIA: request for IRQ%d failed (%d)\n",
+			irqs[i].irq, res);
+
+		while (i--)
+			if (irqs[i].sock == skt->nr)
+				free_irq(irqs[i].irq, skt);
+	}
+	return res;
+}
+EXPORT_SYMBOL(soc_pcmcia_request_irqs);
+
+void soc_pcmcia_free_irqs(struct soc_pcmcia_socket *skt,
+			  struct pcmcia_irqs *irqs, int nr)
+{
+	int i;
+
+	for (i = 0; i < nr; i++)
+		if (irqs[i].sock == skt->nr)
+			free_irq(irqs[i].irq, skt);
+}
+EXPORT_SYMBOL(soc_pcmcia_free_irqs);
+
+void soc_pcmcia_disable_irqs(struct soc_pcmcia_socket *skt,
+			     struct pcmcia_irqs *irqs, int nr)
+{
+	int i;
+
+	for (i = 0; i < nr; i++)
+		if (irqs[i].sock == skt->nr)
+			set_irq_type(irqs[i].irq, IRQT_NOEDGE);
+}
+EXPORT_SYMBOL(soc_pcmcia_disable_irqs);
+
+void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt,
+			    struct pcmcia_irqs *irqs, int nr)
+{
+	int i;
+
+	for (i = 0; i < nr; i++)
+		if (irqs[i].sock == skt->nr) {
+			set_irq_type(irqs[i].irq, IRQT_RISING);
+			set_irq_type(irqs[i].irq, IRQT_BOTHEDGE);
+		}
+}
+EXPORT_SYMBOL(soc_pcmcia_enable_irqs);
+
+
+LIST_HEAD(soc_pcmcia_sockets);
+DECLARE_MUTEX(soc_pcmcia_sockets_lock);
+
+static const char *skt_names[] = {
+	"PCMCIA socket 0",
+	"PCMCIA socket 1",
+};
+
+struct skt_dev_info {
+	int nskt;
+	struct soc_pcmcia_socket skt[0];
+};
+
+#define SKT_DEV_INFO_SIZE(n) \
+	(sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket))
+
+#ifdef CONFIG_CPU_FREQ
+static int
+soc_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data)
+{
+	struct soc_pcmcia_socket *skt;
+	struct cpufreq_freqs *freqs = data;
+	int ret = 0;
+
+	down(&soc_pcmcia_sockets_lock);
+	list_for_each_entry(skt, &soc_pcmcia_sockets, node)
+		if ( skt->ops->frequency_change )
+			ret += skt->ops->frequency_change(skt, val, freqs);
+	up(&soc_pcmcia_sockets_lock);
+
+	return ret;
+}
+
+static struct notifier_block soc_pcmcia_notifier_block = {
+	.notifier_call	= soc_pcmcia_notifier
+};
+
+static int soc_pcmcia_cpufreq_register(void)
+{
+	int ret;
+
+	ret = cpufreq_register_notifier(&soc_pcmcia_notifier_block,
+					CPUFREQ_TRANSITION_NOTIFIER);
+	if (ret < 0)
+		printk(KERN_ERR "Unable to register CPU frequency change "
+				"notifier for PCMCIA (%d)\n", ret);
+	return ret;
+}
+
+static void soc_pcmcia_cpufreq_unregister(void)
+{
+	cpufreq_unregister_notifier(&soc_pcmcia_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
+}
+
+#else
+#define soc_pcmcia_cpufreq_register()
+#define soc_pcmcia_cpufreq_unregister()
+#endif
+
+int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
+{
+	struct skt_dev_info *sinfo;
+	int ret, i;
+
+	down(&soc_pcmcia_sockets_lock);
+
+	sinfo = kmalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
+	if (!sinfo) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	memset(sinfo, 0, SKT_DEV_INFO_SIZE(nr));
+	sinfo->nskt = nr;
+
+	/*
+	 * Initialise the per-socket structure.
+	 */
+	for (i = 0; i < nr; i++) {
+		struct soc_pcmcia_socket *skt = &sinfo->skt[i];
+
+		skt->socket.ops = &soc_common_pcmcia_operations;
+		skt->socket.owner = ops->owner;
+		skt->socket.dev.dev = dev;
+
+		init_timer(&skt->poll_timer);
+		skt->poll_timer.function = soc_common_pcmcia_poll_event;
+		skt->poll_timer.data = (unsigned long)skt;
+		skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD;
+
+		skt->nr		= first + i;
+		skt->irq	= NO_IRQ;
+		skt->dev	= dev;
+		skt->ops	= ops;
+
+		skt->res_skt.start	= _PCMCIA(skt->nr);
+		skt->res_skt.end	= _PCMCIA(skt->nr) + PCMCIASp - 1;
+		skt->res_skt.name	= skt_names[skt->nr];
+		skt->res_skt.flags	= IORESOURCE_MEM;
+
+		ret = request_resource(&iomem_resource, &skt->res_skt);
+		if (ret)
+			goto out_err_1;
+
+		skt->res_io.start	= _PCMCIAIO(skt->nr);
+		skt->res_io.end		= _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1;
+		skt->res_io.name	= "io";
+		skt->res_io.flags	= IORESOURCE_MEM | IORESOURCE_BUSY;
+
+		ret = request_resource(&skt->res_skt, &skt->res_io);
+		if (ret)
+			goto out_err_2;
+
+		skt->res_mem.start	= _PCMCIAMem(skt->nr);
+		skt->res_mem.end	= _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1;
+		skt->res_mem.name	= "memory";
+		skt->res_mem.flags	= IORESOURCE_MEM;
+
+		ret = request_resource(&skt->res_skt, &skt->res_mem);
+		if (ret)
+			goto out_err_3;
+
+		skt->res_attr.start	= _PCMCIAAttr(skt->nr);
+		skt->res_attr.end	= _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1;
+		skt->res_attr.name	= "attribute";
+		skt->res_attr.flags	= IORESOURCE_MEM;
+
+		ret = request_resource(&skt->res_skt, &skt->res_attr);
+		if (ret)
+			goto out_err_4;
+
+		skt->virt_io = ioremap(skt->res_io.start, 0x10000);
+		if (skt->virt_io == NULL) {
+			ret = -ENOMEM;
+			goto out_err_5;
+		}
+
+		if ( list_empty(&soc_pcmcia_sockets) )
+			soc_pcmcia_cpufreq_register();
+
+		list_add(&skt->node, &soc_pcmcia_sockets);
+
+		/*
+		 * We initialize default socket timing here, because
+		 * we are not guaranteed to see a SetIOMap operation at
+		 * runtime.
+		 */
+		ops->set_timing(skt);
+
+		ret = ops->hw_init(skt);
+		if (ret)
+			goto out_err_6;
+
+		skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD;
+		skt->socket.irq_mask = 0;
+		skt->socket.map_size = PAGE_SIZE;
+		skt->socket.pci_irq = skt->irq;
+		skt->socket.io_offset = (unsigned long)skt->virt_io;
+
+		skt->status = soc_common_pcmcia_skt_state(skt);
+
+		ret = pcmcia_register_socket(&skt->socket);
+		if (ret)
+			goto out_err_7;
+
+		WARN_ON(skt->socket.sock != i);
+
+		add_timer(&skt->poll_timer);
+
+		class_device_create_file(&skt->socket.dev, &class_device_attr_status);
+	}
+
+	dev_set_drvdata(dev, sinfo);
+	ret = 0;
+	goto out;
+
+	do {
+		struct soc_pcmcia_socket *skt = &sinfo->skt[i];
+
+		del_timer_sync(&skt->poll_timer);
+		pcmcia_unregister_socket(&skt->socket);
+
+ out_err_7:
+		flush_scheduled_work();
+
+		ops->hw_shutdown(skt);
+ out_err_6:
+ 		list_del(&skt->node);
+		iounmap(skt->virt_io);
+ out_err_5:
+		release_resource(&skt->res_attr);
+ out_err_4:
+		release_resource(&skt->res_mem);
+ out_err_3:
+		release_resource(&skt->res_io);
+ out_err_2:
+		release_resource(&skt->res_skt);
+ out_err_1:
+		i--;
+	} while (i > 0);
+
+	kfree(sinfo);
+
+ out:
+	up(&soc_pcmcia_sockets_lock);
+	return ret;
+}
+
+int soc_common_drv_pcmcia_remove(struct device *dev)
+{
+	struct skt_dev_info *sinfo = dev_get_drvdata(dev);
+	int i;
+
+	dev_set_drvdata(dev, NULL);
+
+	down(&soc_pcmcia_sockets_lock);
+	for (i = 0; i < sinfo->nskt; i++) {
+		struct soc_pcmcia_socket *skt = &sinfo->skt[i];
+
+		del_timer_sync(&skt->poll_timer);
+
+		pcmcia_unregister_socket(&skt->socket);
+
+		flush_scheduled_work();
+
+		skt->ops->hw_shutdown(skt);
+
+		soc_common_pcmcia_config_skt(skt, &dead_socket);
+
+		list_del(&skt->node);
+		iounmap(skt->virt_io);
+		skt->virt_io = NULL;
+		release_resource(&skt->res_attr);
+		release_resource(&skt->res_mem);
+		release_resource(&skt->res_io);
+		release_resource(&skt->res_skt);
+	}
+	if ( list_empty(&soc_pcmcia_sockets) )
+		soc_pcmcia_cpufreq_unregister();
+
+	up(&soc_pcmcia_sockets_lock);
+
+	kfree(sinfo);
+
+	return 0;
+}
diff -Nru a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pcmcia/soc_common.h	Tue Jun 15 22:20:42 2004
@@ -0,0 +1,194 @@
+/*
+ * linux/drivers/pcmcia/soc_common.h
+ *
+ * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
+ *
+ * This file contains definitions for the PCMCIA support code common to
+ * integrated SOCs like the SA-11x0 and PXA2xx microprocessors.
+ */
+#ifndef _ASM_ARCH_PCMCIA
+#define _ASM_ARCH_PCMCIA
+
+/* include the world */
+#include <linux/cpufreq.h>
+#include <pcmcia/version.h>
+#include <pcmcia/cs_types.h>
+#include <pcmcia/cs.h>
+#include <pcmcia/ss.h>
+#include <pcmcia/bulkmem.h>
+#include <pcmcia/cistpl.h>
+#include "cs_internal.h"
+
+
+struct device;
+struct pcmcia_low_level;
+
+/*
+ * This structure encapsulates per-socket state which we might need to
+ * use when responding to a Card Services query of some kind.
+ */
+struct soc_pcmcia_socket {
+	struct pcmcia_socket	socket;
+
+	/*
+	 * Info from low level handler
+	 */
+	struct device		*dev;
+	unsigned int		nr;
+	unsigned int		irq;
+
+	/*
+	 * Core PCMCIA state
+	 */
+	struct pcmcia_low_level *ops;
+
+	unsigned int		status;
+	socket_state_t		cs_state;
+
+	unsigned short		spd_io[MAX_IO_WIN];
+	unsigned short		spd_mem[MAX_WIN];
+	unsigned short		spd_attr[MAX_WIN];
+
+	struct resource		res_skt;
+	struct resource		res_io;
+	struct resource		res_mem;
+	struct resource		res_attr;
+	void			*virt_io;
+
+	unsigned int		irq_state;
+
+	struct timer_list	poll_timer;
+	struct list_head	node;
+};
+
+struct pcmcia_state {
+  unsigned detect: 1,
+            ready: 1,
+             bvd1: 1,
+             bvd2: 1,
+           wrprot: 1,
+            vs_3v: 1,
+            vs_Xv: 1;
+};
+
+struct pcmcia_low_level {
+	struct module *owner;
+
+	/* first socket in system */
+	int first;
+	/* nr of sockets */
+	int nr;
+
+	int (*hw_init)(struct soc_pcmcia_socket *);
+	void (*hw_shutdown)(struct soc_pcmcia_socket *);
+
+	void (*socket_state)(struct soc_pcmcia_socket *, struct pcmcia_state *);
+	int (*configure_socket)(struct soc_pcmcia_socket *, const socket_state_t *);
+
+	/*
+	 * Enable card status IRQs on (re-)initialisation.  This can
+	 * be called at initialisation, power management event, or
+	 * pcmcia event.
+	 */
+	void (*socket_init)(struct soc_pcmcia_socket *);
+
+	/*
+	 * Disable card status IRQs and PCMCIA bus on suspend.
+	 */
+	void (*socket_suspend)(struct soc_pcmcia_socket *);
+
+	/*
+	 * Hardware specific timing routines.
+	 * If provided, the get_timing routine overrides the SOC default.
+	 */
+	unsigned int (*get_timing)(struct soc_pcmcia_socket *, unsigned int, unsigned int);
+	int (*set_timing)(struct soc_pcmcia_socket *);
+	int (*show_timing)(struct soc_pcmcia_socket *, char *);
+
+#ifdef CONFIG_CPU_FREQ
+	/*
+	 * CPUFREQ support.
+	 */
+	int (*frequency_change)(struct soc_pcmcia_socket *, unsigned long, struct cpufreq_freqs *);
+#endif
+};
+
+
+struct pcmcia_irqs {
+	int sock;
+	int irq;
+	const char *str;
+};
+
+struct soc_pcmcia_timing {
+	unsigned short io;
+	unsigned short mem;
+	unsigned short attr;
+};
+
+extern int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
+extern void soc_pcmcia_free_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
+extern void soc_pcmcia_disable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
+extern void soc_pcmcia_enable_irqs(struct soc_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
+extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *);
+
+
+extern struct list_head soc_pcmcia_sockets;
+extern struct semaphore soc_pcmcia_sockets_lock;
+
+extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr);
+extern int soc_common_drv_pcmcia_remove(struct device *dev);
+
+
+#ifdef DEBUG
+
+extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
+			     int lvl, const char *fmt, ...);
+
+#define debug(skt, lvl, fmt, arg...) \
+	soc_pcmcia_debug(skt, __func__, lvl, fmt , ## arg)
+
+#else
+#define debug(skt, lvl, fmt, arg...) do { } while (0)
+#endif
+
+
+/*
+ * The PC Card Standard, Release 7, section 4.13.4, says that twIORD
+ * has a minimum value of 165ns. Section 4.13.5 says that twIOWR has
+ * a minimum value of 165ns, as well. Section 4.7.2 (describing
+ * common and attribute memory write timing) says that twWE has a
+ * minimum value of 150ns for a 250ns cycle time (for 5V operation;
+ * see section 4.7.4), or 300ns for a 600ns cycle time (for 3.3V
+ * operation, also section 4.7.4). Section 4.7.3 says that taOE
+ * has a maximum value of 150ns for a 300ns cycle time (for 5V
+ * operation), or 300ns for a 600ns cycle time (for 3.3V operation).
+ *
+ * When configuring memory maps, Card Services appears to adopt the policy
+ * that a memory access time of "0" means "use the default." The default
+ * PCMCIA I/O command width time is 165ns. The default PCMCIA 5V attribute
+ * and memory command width time is 150ns; the PCMCIA 3.3V attribute and
+ * memory command width time is 300ns.
+ */
+#define SOC_PCMCIA_IO_ACCESS		(165)
+#define SOC_PCMCIA_5V_MEM_ACCESS	(150)
+#define SOC_PCMCIA_3V_MEM_ACCESS	(300)
+#define SOC_PCMCIA_ATTR_MEM_ACCESS	(300)
+
+/*
+ * The socket driver actually works nicely in interrupt-driven form,
+ * so the (relatively infrequent) polling is "just to be sure."
+ */
+#define SOC_PCMCIA_POLL_PERIOD    (2*HZ)
+
+
+/* I/O pins replacing memory pins
+ * (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75)
+ *
+ * These signals change meaning when going from memory-only to
+ * memory-or-I/O interface:
+ */
+#define iostschg bvd1
+#define iospkr   bvd2
+
+#endif
diff -Nru a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
--- a/drivers/pcmcia/tcic.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pcmcia/tcic.c	Tue Jun 15 22:20:41 2004
@@ -60,7 +60,7 @@
 static int pc_debug;
 
 module_param(pc_debug, int, 0644);
-static const char *version =
+static const char version[] =
 "tcic.c 1.111 2000/02/15 04:13:12 (David Hinds)";
 
 #define debug(lvl, fmt, arg...) do {				\
diff -Nru a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
--- a/drivers/pcmcia/yenta_socket.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/pcmcia/yenta_socket.c	Tue Jun 15 22:20:41 2004
@@ -1078,6 +1078,7 @@
 	CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1451A, TI12XX),
 	CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1510, TI12XX),
 	CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, TI12XX),
+	CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1620, TI12XX),
 	CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4410, TI12XX),
 	CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4450, TI12XX),
 	CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_4451, TI12XX),
diff -Nru a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
--- a/drivers/pnp/isapnp/proc.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/pnp/isapnp/proc.c	Tue Jun 15 22:20:39 2004
@@ -55,7 +55,7 @@
 	return (file->f_pos = new);
 }
 
-static ssize_t isapnp_proc_bus_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
+static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
 	struct inode *ino = file->f_dentry->d_inode;
 	struct proc_dir_entry *dp = PDE(ino);
diff -Nru a/drivers/pnp/pnpbios/Kconfig b/drivers/pnp/pnpbios/Kconfig
--- a/drivers/pnp/pnpbios/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/drivers/pnp/pnpbios/Kconfig	Tue Jun 15 22:20:43 2004
@@ -3,7 +3,7 @@
 #
 config PNPBIOS
 	bool "Plug and Play BIOS support (EXPERIMENTAL)"
-	depends on PNP && EXPERIMENTAL
+	depends on PNP && X86 && EXPERIMENTAL
 	---help---
 	  Linux uses the PNPBIOS as defined in "Plug and Play BIOS
 	  Specification Version 1.0A May 5, 1994" to autodetect built-in
diff -Nru a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
--- a/drivers/pnp/pnpbios/bioscalls.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/pnp/pnpbios/bioscalls.c	Tue Jun 15 22:20:42 2004
@@ -11,15 +11,15 @@
 #include <linux/pnpbios.h>
 #include <linux/device.h>
 #include <linux/pnp.h>
-#include <asm/page.h>
-#include <asm/system.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
-#include <asm/desc.h>
 #include <linux/slab.h>
 #include <linux/kmod.h>
 #include <linux/completion.h>
 #include <linux/spinlock.h>
+
+#include <asm/page.h>
+#include <asm/desc.h>
 #include <asm/system.h>
 #include <asm/byteorder.h>
 
diff -Nru a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
--- a/drivers/pnp/pnpbios/core.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/pnp/pnpbios/core.c	Tue Jun 15 22:20:36 2004
@@ -53,15 +53,15 @@
 #include <linux/pnpbios.h>
 #include <linux/device.h>
 #include <linux/pnp.h>
-#include <asm/page.h>
-#include <asm/system.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
-#include <asm/desc.h>
 #include <linux/slab.h>
 #include <linux/kmod.h>
 #include <linux/completion.h>
 #include <linux/spinlock.h>
+
+#include <asm/page.h>
+#include <asm/desc.h>
 #include <asm/system.h>
 #include <asm/byteorder.h>
 
diff -Nru a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
--- a/drivers/pnp/pnpbios/proc.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/pnp/pnpbios/proc.c	Tue Jun 15 22:21:03 2004
@@ -176,7 +176,7 @@
 	return len;
 }
 
-static int proc_write_node(struct file *file, const char *buf,
+static int proc_write_node(struct file *file, const char __user *buf,
                            unsigned long count, void *data)
 {
 	struct pnp_bios_node *node;
diff -Nru a/drivers/s390/Kconfig b/drivers/s390/Kconfig
--- a/drivers/s390/Kconfig	Tue Jun 15 22:20:44 2004
+++ b/drivers/s390/Kconfig	Tue Jun 15 22:20:44 2004
@@ -54,17 +54,28 @@
 comment "S/390 character device drivers"
 
 config TN3270
-	tristate "Support for locally attached 3270 tubes"
+	tristate "Support for locally attached 3270 terminals"
 	help
-	  Include support for IBM 3270 line-mode terminals.
+	  Include support for IBM 3270 terminals.
+
+config TN3270_TTY
+	tristate "Support for tty input/output on 3270 terminals"
+	depends on TN3270
+	help
+	  Include support for using an IBM 3270 terminal as a Linux tty.
+
+config TN3270_FS
+	tristate "Support for fullscreen applications on 3270 terminals"
+	depends on TN3270
+	help
+	  Include support for fullscreen applications on an IBM 3270 terminal.
 
 config TN3270_CONSOLE
-	bool "Support for console on 3270 line mode terminal"
-	depends on TN3270=y
+	bool "Support for console on 3270 terminal"
+	depends on TN3270=y && TN3270_TTY=y
 	help
-	  Include support for using an IBM 3270 line-mode terminal as a Linux
-	  system console.  Available only if 3270 support is compiled in
-	  statically.
+	  Include support for using an IBM 3270 terminal as a Linux system
+	  console.  Available only if 3270 support is compiled in statically.
 
 config TN3215
 	bool "Support for 3215 line mode terminal"
diff -Nru a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
--- a/drivers/s390/block/dasd.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/s390/block/dasd.c	Tue Jun 15 22:20:40 2004
@@ -7,7 +7,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
  *
- * $Revision: 1.139 $
+ * $Revision: 1.142 $
  */
 
 #include <linux/config.h>
@@ -37,6 +37,7 @@
  * SECTION: exported variables of dasd.c
  */
 debug_info_t *dasd_debug_area;
+struct dasd_discipline *dasd_diag_discipline_pointer;
 
 MODULE_AUTHOR("Holger Smolinski <Holger.Smolinski@de.ibm.com>");
 MODULE_DESCRIPTION("Linux on S/390 DASD device driver,"
@@ -751,16 +752,16 @@
 		break;
 	case -EBUSY:
 		DBF_DEV_EVENT(DBF_ERR, device, "%s",
-			      "device busy, retry later");
+			      "start_IO: device busy, retry later");
 		break;
 	case -ETIMEDOUT:
 		DBF_DEV_EVENT(DBF_ERR, device, "%s",
-			      "request timeout - terminated");
+			      "start_IO: request timeout, retry later");
+		break;
 	case -ENODEV:
 	case -EIO:
-		cqr->status = DASD_CQR_FAILED;
-		cqr->stopclk = cqr->startclk;
-		dasd_schedule_bh(device);
+		DBF_DEV_EVENT(DBF_ERR, device, "%s",
+			      "start_IO: device gone, retry");
 		break;
 	default:
 		DEV_MESSAGE(KERN_ERR, device,
@@ -1008,8 +1009,9 @@
 				if (device->discipline->start_IO(next) == 0)
 					expires = next->expires;
 				else
-					MESSAGE(KERN_WARNING, "%s",
-						"Interrupt fastpath failed!");
+					DEV_MESSAGE(KERN_DEBUG, device, "%s",
+						    "Interrupt fastpath "
+						    "failed!");
 			}
 		}
 	} else {		/* error */
@@ -1018,8 +1020,8 @@
 		if (cqr->dstat)
 			memcpy(cqr->dstat, irb, sizeof (struct irb));
 		else
-			MESSAGE(KERN_ERR, "%s",
-				"no memory for dstat...ignoring");
+			DEV_MESSAGE(KERN_ERR, device, "%s",
+				    "no memory for dstat...ignoring");
 #ifdef ERP_DEBUG
 		/* dump sense data */
 		dasd_log_sense(cqr, irb);
@@ -1989,6 +1991,8 @@
 
 	DBF_EVENT(DBF_EMERG, "%s", "debug area created");
 
+	dasd_diag_discipline_pointer = NULL;
+
 	rc = devfs_mk_dir("dasd");
 	if (rc)
 		goto failed;
@@ -2021,6 +2025,7 @@
 module_exit(dasd_exit);
 
 EXPORT_SYMBOL(dasd_debug_area);
+EXPORT_SYMBOL(dasd_diag_discipline_pointer);
 
 EXPORT_SYMBOL(dasd_add_request_head);
 EXPORT_SYMBOL(dasd_add_request_tail);
diff -Nru a/drivers/s390/block/dasd_cmb.c b/drivers/s390/block/dasd_cmb.c
--- a/drivers/s390/block/dasd_cmb.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/block/dasd_cmb.c	Tue Jun 15 22:20:41 2004
@@ -58,7 +58,7 @@
 dasd_ioctl_readall_cmb(struct block_device *bdev, int no, long args)
 {
 	struct dasd_device *device;
-	struct cmbdata * __user udata;
+	struct cmbdata __user *udata;
 	struct cmbdata data;
 	size_t size;
 	int ret;
@@ -66,7 +66,7 @@
 	device = bdev->bd_disk->private_data;
 	if (!device)
 		return -EINVAL;
-	udata = (void *) args;
+	udata = (void __user *) args;
 	size = _IOC_SIZE(no);
 
 	if (!access_ok(VERIFY_WRITE, udata, size))
diff -Nru a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
--- a/drivers/s390/block/dasd_devmap.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/s390/block/dasd_devmap.c	Tue Jun 15 22:20:40 2004
@@ -11,7 +11,7 @@
  * functions may not be called from interrupt context. In particular
  * dasd_get_device is a no-no from interrupt context.
  *
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
  */
 
 #include <linux/config.h>
@@ -525,6 +525,9 @@
 	/* Disconnect dasd_device structure from ccw_device structure. */
 	cdev = device->cdev;
 	device->cdev = NULL;
+
+	/* Disconnect dasd_devmap structure from ccw_device structure. */
+	cdev->dev.driver_data = NULL;
 
 	/* Put ccw_device structure. */
 	put_device(&cdev->dev);
diff -Nru a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
--- a/drivers/s390/block/dasd_diag.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/s390/block/dasd_diag.c	Tue Jun 15 22:20:36 2004
@@ -6,7 +6,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.34 $
+ * $Revision: 1.36 $
  */
 
 #include <linux/config.h>
@@ -35,6 +35,8 @@
 
 MODULE_LICENSE("GPL");
 
+struct dasd_discipline dasd_diag_discipline;
+
 struct dasd_diag_private {
 	struct dasd_diag_characteristics rdc_data;
 	struct dasd_diag_rw_io iob;
@@ -292,7 +294,7 @@
 		mdsk_term_io(device);
 	}
 	if (bsize <= PAGE_SIZE && label[3] == bsize &&
-	    label[0] == 0xc3d4e2f1 && label[13] != 0) {
+	    label[0] == 0xc3d4e2f1) {
 		device->blocks = label[7];
 		device->bp_block = bsize;
 		device->s2b_shift = 0;	/* bits to shift 512 to get a block */
@@ -489,6 +491,7 @@
 
 	ctl_set_bit(0, 9);
 	register_external_interrupt(0x2603, dasd_ext_handler);
+	dasd_diag_discipline_pointer = &dasd_diag_discipline;
 	return 0;
 }
 
@@ -503,6 +506,7 @@
 	}
 	unregister_external_interrupt(0x2603, dasd_ext_handler);
 	ctl_clear_bit(0, 9);
+	dasd_diag_discipline_pointer = NULL;
 }
 
 module_init(dasd_diag_init);
diff -Nru a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
--- a/drivers/s390/block/dasd_eckd.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/s390/block/dasd_eckd.c	Tue Jun 15 22:20:35 2004
@@ -7,7 +7,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.54 $
+ * $Revision: 1.55 $
  */
 
 #include <linux/config.h>
@@ -1070,7 +1070,7 @@
 	cqr->device = device;
 	cqr->expires = 5 * 60 * HZ;	/* 5 minutes */
 	cqr->lpm = LPM_ANYPATH;
-	cqr->retries = 2;
+	cqr->retries = 256;
 	cqr->buildclk = get_clock();
 	cqr->status = DASD_CQR_FILLED;
 	return cqr;
@@ -1289,7 +1289,7 @@
 		/* Prepare for Read Subsystem Data */
 		prssdp = (struct dasd_psf_prssd_data *) cqr->data;
 		stats = (struct dasd_rssd_perf_stats_t *) (prssdp + 1);
-		rc = copy_to_user((long *) args, (long *) stats,
+		rc = copy_to_user((long __user *) args, (long *) stats,
 				  sizeof(struct dasd_rssd_perf_stats_t));
 	}
 	dasd_sfree_request(cqr, cqr->device);
@@ -1319,10 +1319,10 @@
 
         private = (struct dasd_eckd_private *) device->private;
         attrib = private->attrib;
-	
-        rc = copy_to_user((long *) args, (long *) &attrib,
+
+        rc = copy_to_user((long __user *) args, (long *) &attrib,
 			  sizeof (struct attrib_data_t));
-	
+
 	return rc;
 }
 
@@ -1346,7 +1346,7 @@
 	if (device == NULL)
 		return -ENODEV;
 
-	if (copy_from_user(&attrib, (void *) args,
+	if (copy_from_user(&attrib, (void __user *) args,
 			   sizeof (struct attrib_data_t))) {
 		return -EFAULT;
 	}
diff -Nru a/drivers/s390/block/dasd_erp.c b/drivers/s390/block/dasd_erp.c
--- a/drivers/s390/block/dasd_erp.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/s390/block/dasd_erp.c	Tue Jun 15 22:20:37 2004
@@ -7,7 +7,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
  *
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
  */
 
 #include <linux/config.h>
@@ -67,7 +67,8 @@
 	}
 	strncpy((char *) &cqr->magic, magic, 4);
 	ASCEBC((char *) &cqr->magic, 4);
-	atomic_inc(&device->ref_count);
+	set_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
+	dasd_get_device(device);
 	return cqr;
 }
 
diff -Nru a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
--- a/drivers/s390/block/dasd_int.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/block/dasd_int.h	Tue Jun 15 22:20:43 2004
@@ -6,7 +6,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.57 $
+ * $Revision: 1.58 $
  */
 
 #ifndef DASD_INT_H
@@ -260,12 +260,7 @@
 	int (*fill_info) (struct dasd_device *, struct dasd_information2_t *);
 };
 
-extern struct dasd_discipline dasd_diag_discipline;
-#ifdef CONFIG_DASD_DIAG
-#define dasd_diag_discipline_pointer (&dasd_diag_discipline)
-#else
-#define dasd_diag_discipline_pointer (0)
-#endif
+extern struct dasd_discipline *dasd_diag_discipline_pointer;
 
 struct dasd_device {
 	/* Block device stuff. */
diff -Nru a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
--- a/drivers/s390/block/dasd_ioctl.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/block/dasd_ioctl.c	Tue Jun 15 22:20:41 2004
@@ -120,7 +120,7 @@
 dasd_ioctl_api_version(struct block_device *bdev, int no, long args)
 {
 	int ver = DASD_API_VERSION;
-	return put_user(ver, (int *) args);
+	return put_user(ver, (int __user *) args);
 }
 
 /*
@@ -305,7 +305,7 @@
 		return -ENODEV;
 	if (test_bit(DASD_FLAG_RO, &device->flags))
 		return -EROFS;
-	if (copy_from_user(&fdata, (void *) args,
+	if (copy_from_user(&fdata, (void __user *) args,
 			   sizeof (struct format_data_t)))
 		return -EFAULT;
 	if (bdev != bdev->bd_contains) {
@@ -348,7 +348,7 @@
 	if (device == NULL)
 		return -ENODEV;
 
-	if (copy_to_user((long *) args, (long *) &device->profile,
+	if (copy_to_user((long __user *) args, (long *) &device->profile,
 			 sizeof (struct dasd_profile_info_t)))
 		return -EFAULT;
 	return 0;
@@ -441,9 +441,9 @@
 		spin_unlock_irqrestore(get_ccwdev_lock(device->cdev),
 				       flags);
 	}
-	
+
 	rc = 0;
-	if (copy_to_user((long *) args, (long *) dasd_info,
+	if (copy_to_user((long __user *) args, (long *) dasd_info,
 			 ((no == (unsigned int) BIODASDINFO2) ?
 			  sizeof (struct dasd_information2_t) :
 			  sizeof (struct dasd_information_t))))
@@ -466,7 +466,7 @@
 	if (bdev != bdev->bd_contains)
 		// ro setting is not allowed for partitions
 		return -EINVAL;
-	if (get_user(intval, (int *) args))
+	if (get_user(intval, (int __user *) args))
 		return -EFAULT;
 	device =  bdev->bd_disk->private_data;
 	if (device == NULL)
@@ -499,7 +499,7 @@
 	geo = (struct hd_geometry) {};
 	device->discipline->fill_geometry(device, &geo);
 	geo.start = get_start_sect(bdev) >> device->s2b_shift;
-	if (copy_to_user((struct hd_geometry *) args, &geo,
+	if (copy_to_user((struct hd_geometry __user *) args, &geo,
 			 sizeof (struct hd_geometry)))
 		return -EFAULT;
 
diff -Nru a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c
--- a/drivers/s390/block/dasd_proc.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/s390/block/dasd_proc.c	Tue Jun 15 22:20:37 2004
@@ -30,7 +30,7 @@
 static struct proc_dir_entry *dasd_statistics_entry = NULL;
 
 static inline char *
-dasd_get_user_string(const char *user_buf, size_t user_len)
+dasd_get_user_string(const char __user *user_buf, size_t user_len)
 {
 	char *buffer;
 
@@ -239,7 +239,7 @@
 }
 
 static int
-dasd_statistics_write(struct file *file, const char *user_buf,
+dasd_statistics_write(struct file *file, const char __user *user_buf,
 		      unsigned long user_len, void *data)
 {
 #ifdef CONFIG_DASD_PROFILE
diff -Nru a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
--- a/drivers/s390/block/dcssblk.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/s390/block/dcssblk.c	Tue Jun 15 22:20:37 2004
@@ -76,8 +76,7 @@
 };
 
 static struct list_head dcssblk_devices = LIST_HEAD_INIT(dcssblk_devices);
-static rwlock_t dcssblk_devices_lock = RW_LOCK_UNLOCKED;
-
+static struct rw_semaphore dcssblk_devices_sem;
 
 /*
  * release function for segment device.
@@ -92,8 +91,8 @@
 
 /*
  * get a minor number. needs to be called with
- * write_lock(&dcssblk_devices_lock) and the
- * device needs to be enqueued before the lock is
+ * down_write(&dcssblk_devices_sem) and the
+ * device needs to be enqueued before the semaphore is
  * freed.
  */
 static inline int
@@ -121,7 +120,7 @@
 /*
  * get the struct dcssblk_dev_info from dcssblk_devices
  * for the given name.
- * read_lock(&dcssblk_devices_lock) must be held.
+ * down_read(&dcssblk_devices_sem) must be held.
  */
 static struct dcssblk_dev_info *
 dcssblk_get_device_by_name(char *name)
@@ -137,31 +136,6 @@
 }
 
 /*
- * register the device that represents a segment in sysfs,
- * also add the attributes for the device
- */
-static inline int
-dcssblk_register_segment_device(struct device *dev)
-{
-	int rc;
-
-	rc = device_register(dev);
-	if (rc)
-		return rc;
-	rc = device_create_file(dev, &dev_attr_shared);
-	if (rc)
-		goto unregister_dev;
-	rc = device_create_file(dev, &dev_attr_save);
-	if (rc)
-		goto unregister_dev;
-	return rc;
-
-unregister_dev:
-	device_unregister(dev);
-	return rc;
-}
-
-/*
  * device attribute for switching shared/nonshared (exclusive)
  * operation (show + store)
  */
@@ -184,24 +158,24 @@
 		PRINT_WARN("Invalid value, must be 0 or 1\n");
 		return -EINVAL;
 	}
-	write_lock(&dcssblk_devices_lock);
+	down_write(&dcssblk_devices_sem);
 	dev_info = container_of(dev, struct dcssblk_dev_info, dev);
 	if (atomic_read(&dev_info->use_count)) {
 		PRINT_ERR("share: segment %s is busy!\n",
 			  dev_info->segment_name);
-		write_unlock(&dcssblk_devices_lock);
+		up_write(&dcssblk_devices_sem);
 		return -EBUSY;
 	}
 	if ((inbuf[0] == '1') && (dev_info->is_shared == 1)) {
 		PRINT_WARN("Segment %s already loaded in shared mode!\n",
 			   dev_info->segment_name);
-		write_unlock(&dcssblk_devices_lock);
+		up_write(&dcssblk_devices_sem);
 		return count;
 	}
 	if ((inbuf[0] == '0') && (dev_info->is_shared == 0)) {
 		PRINT_WARN("Segment %s already loaded in exclusive mode!\n",
 			   dev_info->segment_name);
-		write_unlock(&dcssblk_devices_lock);
+		up_write(&dcssblk_devices_sem);
 		return count;
 	}
 	if (inbuf[0] == '1') {
@@ -231,7 +205,7 @@
 		PRINT_INFO("Segment %s reloaded, exclusive (read-write) mode.\n",
 			   dev_info->segment_name);
 	} else {
-		write_unlock(&dcssblk_devices_lock);
+		up_write(&dcssblk_devices_sem);
 		PRINT_WARN("Invalid value, must be 0 or 1\n");
 		return -EINVAL;
 	}
@@ -262,14 +236,13 @@
 				dev_info->segment_name);
 		rc = -EPERM;
 	}
-	write_unlock(&dcssblk_devices_lock);
+	up_write(&dcssblk_devices_sem);
 	goto out;
 
 removeseg:
 	PRINT_ERR("Could not reload segment %s, removing it now!\n",
 			dev_info->segment_name);
 	list_del(&dev_info->lh);
-	write_unlock(&dcssblk_devices_lock);
 
 	del_gendisk(dev_info->gd);
 	blk_put_queue(dev_info->dcssblk_queue);
@@ -277,6 +250,7 @@
 	put_disk(dev_info->gd);
 	device_unregister(dev);
 	put_device(dev);
+	up_write(&dcssblk_devices_sem);
 out:
 	return rc;
 }
@@ -308,7 +282,7 @@
 	}
 	dev_info = container_of(dev, struct dcssblk_dev_info, dev);
 
-	write_lock(&dcssblk_devices_lock);
+	down_write(&dcssblk_devices_sem);
 	if (inbuf[0] == '1') {
 		if (atomic_read(&dev_info->use_count) == 0) {
 			// device is idle => we save immediately
@@ -332,11 +306,11 @@
 					dev_info->segment_name);
 		}
 	} else {
-		write_unlock(&dcssblk_devices_lock);
+		up_write(&dcssblk_devices_sem);
 		PRINT_WARN("Invalid value, must be 0 or 1\n");
 		return -EINVAL;
 	}
-	write_unlock(&dcssblk_devices_lock);
+	up_write(&dcssblk_devices_sem);
 	return count;
 }
 
@@ -375,9 +349,9 @@
 	/*
 	 * already loaded?
 	 */
-	read_lock(&dcssblk_devices_lock);
+	down_read(&dcssblk_devices_sem);
 	dev_info = dcssblk_get_device_by_name(local_buf);
-	read_unlock(&dcssblk_devices_lock);
+	up_read(&dcssblk_devices_sem);
 	if (dev_info != NULL) {
 		PRINT_WARN("Segment %s already loaded!\n", local_buf);
 		rc = -EEXIST;
@@ -433,10 +407,10 @@
 	/*
 	 * get minor, add to list
 	 */
-	write_lock(&dcssblk_devices_lock);
+	down_write(&dcssblk_devices_sem);
 	rc = dcssblk_assign_free_minor(dev_info);
 	if (rc) {
-		write_unlock(&dcssblk_devices_lock);
+		up_write(&dcssblk_devices_sem);
 		PRINT_ERR("No free minor number available! "
 			  "Unloading segment...\n");
 		goto unload_seg;
@@ -444,22 +418,29 @@
 	sprintf(dev_info->gd->disk_name, "dcssblk%d",
 		dev_info->gd->first_minor);
 	list_add_tail(&dev_info->lh, &dcssblk_devices);
+
+	if (!try_module_get(THIS_MODULE)) {
+		rc = -ENODEV;
+		goto list_del;
+	}
 	/*
 	 * register the device
 	 */
-	rc = dcssblk_register_segment_device(&dev_info->dev);
+	rc = device_register(&dev_info->dev);
 	if (rc) {
 		PRINT_ERR("Segment %s could not be registered RC=%d\n",
 				local_buf, rc);
+		module_put(THIS_MODULE);
 		goto list_del;
 	}
-
-	if (!try_module_get(THIS_MODULE)) {
-		rc = -ENODEV;
-		goto list_del;
-	}
-
 	get_device(&dev_info->dev);
+	rc = device_create_file(&dev_info->dev, &dev_attr_shared);
+	if (rc)
+		goto unregister_dev;
+	rc = device_create_file(&dev_info->dev, &dev_attr_save);
+	if (rc)
+		goto unregister_dev;
+
 	add_disk(dev_info->gd);
 
 	blk_queue_make_request(dev_info->dcssblk_queue, dcssblk_make_request);
@@ -476,13 +457,24 @@
 			break;
 	}
 	PRINT_DEBUG("Segment %s loaded successfully\n", local_buf);
-	write_unlock(&dcssblk_devices_lock);
+	up_write(&dcssblk_devices_sem);
 	rc = count;
 	goto out;
 
+unregister_dev:
+	PRINT_ERR("device_create_file() failed!\n");
+	list_del(&dev_info->lh);
+	blk_put_queue(dev_info->dcssblk_queue);
+	dev_info->gd->queue = NULL;
+	put_disk(dev_info->gd);
+	device_unregister(&dev_info->dev);
+	segment_unload(dev_info->segment_name);
+	put_device(&dev_info->dev);
+	up_write(&dcssblk_devices_sem);
+	goto out;
 list_del:
 	list_del(&dev_info->lh);
-	write_unlock(&dcssblk_devices_lock);
+	up_write(&dcssblk_devices_sem);
 unload_seg:
 	segment_unload(local_buf);
 dealloc_gendisk:
@@ -526,22 +518,21 @@
 		goto out_buf;
 	}
 
-	write_lock(&dcssblk_devices_lock);
+	down_write(&dcssblk_devices_sem);
 	dev_info = dcssblk_get_device_by_name(local_buf);
 	if (dev_info == NULL) {
-		write_unlock(&dcssblk_devices_lock);
+		up_write(&dcssblk_devices_sem);
 		PRINT_WARN("Segment %s is not loaded!\n", local_buf);
 		rc = -ENODEV;
 		goto out_buf;
 	}
 	if (atomic_read(&dev_info->use_count) != 0) {
-		write_unlock(&dcssblk_devices_lock);
+		up_write(&dcssblk_devices_sem);
 		PRINT_WARN("Segment %s is in use!\n", local_buf);
 		rc = -EBUSY;
 		goto out_buf;
 	}
 	list_del(&dev_info->lh);
-	write_unlock(&dcssblk_devices_lock);
 
 	del_gendisk(dev_info->gd);
 	blk_put_queue(dev_info->dcssblk_queue);
@@ -552,6 +543,8 @@
 	PRINT_DEBUG("Segment %s unloaded successfully\n",
 			dev_info->segment_name);
 	put_device(&dev_info->dev);
+	up_write(&dcssblk_devices_sem);
+
 	rc = count;
 out_buf:
 	kfree(local_buf);
@@ -587,7 +580,7 @@
 		rc = -ENODEV;
 		goto out;
 	}
-	write_lock(&dcssblk_devices_lock);
+	down_write(&dcssblk_devices_sem);
 	if (atomic_dec_and_test(&dev_info->use_count)
 	    && (dev_info->save_pending)) {
 		PRINT_INFO("Segment %s became idle and is being saved now\n",
@@ -595,7 +588,7 @@
 		segment_replace(dev_info->segment_name);
 		dev_info->save_pending = 0;
 	}
-	write_unlock(&dcssblk_devices_lock);
+	up_write(&dcssblk_devices_sem);
 	rc = 0;
 out:
 	return rc;
@@ -616,7 +609,7 @@
 	dev_info = bio->bi_bdev->bd_disk->private_data;
 	if (dev_info == NULL)
 		goto fail;
-	if ((bio->bi_sector & 3) != 0 || (bio->bi_size & 4095) != 0)
+	if ((bio->bi_sector & 7) != 0 || (bio->bi_size & 4095) != 0)
 		/* Request is not page-aligned. */
 		goto fail;
 	if (((bio->bi_size >> 9) + bio->bi_sector)
@@ -695,6 +688,7 @@
 		return rc;
 	}
 	dcssblk_major = rc;
+	init_rwsem(&dcssblk_devices_sem);
 	PRINT_DEBUG("...finished!\n");
 	return 0;
 }
diff -Nru a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
--- a/drivers/s390/block/xpram.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/block/xpram.c	Tue Jun 15 22:20:43 2004
@@ -155,7 +155,7 @@
 {
 	int cc;
 
-	__asm__ __volatile(
+	__asm__ __volatile__ (
 		"   lhi   %0,2\n"  /* return unused cc 2 if pgin traps */
 		"   .insn rre,0xb22e0000,%1,%2\n"  /* pgin %1,%2 */
                 "0: ipm   %0\n"
@@ -203,7 +203,7 @@
 {
 	int cc;
 
-	__asm__ __volatile(
+	__asm__ __volatile__ (
 		"   lhi   %0,2\n"  /* return unused cc 2 if pgout traps */
 		"   .insn rre,0xb22f0000,%1,%2\n"  /* pgout %1,%2 */
                 "0: ipm   %0\n"
@@ -290,7 +290,7 @@
 	unsigned long bytes;
 	int i;
 
-	if ((bio->bi_sector & 3) != 0 || (bio->bi_size & 4095) != 0)
+	if ((bio->bi_sector & 7) != 0 || (bio->bi_size & 4095) != 0)
 		/* Request is not page-aligned. */
 		goto fail;
 	if ((bio->bi_size >> 12) > xdev->size)
@@ -332,16 +332,16 @@
 static int xpram_ioctl (struct inode *inode, struct file *filp,
 		 unsigned int cmd, unsigned long arg)
 {
-	struct hd_geometry *geo;
+	struct hd_geometry __user *geo;
 	unsigned long size;
- 	if (cmd != HDIO_GETGEO)
+	if (cmd != HDIO_GETGEO)
 		return -EINVAL;
 	/*
 	 * get geometry: we have to fake one...  trim the size to a
 	 * multiple of 64 (32k): tell we have 16 sectors, 4 heads,
 	 * whatever cylinders. Tell also that data starts at sector. 4.
 	 */
-	geo = (struct hd_geometry *) arg;
+	geo = (struct hd_geometry __user *) arg;
 	size = (xpram_pages * 8) & ~0x3f;
 	put_user(size >> 6, &geo->cylinders);
 	put_user(4, &geo->heads);
@@ -423,7 +423,7 @@
 	return 0;
 }
 
-static struct request_queue xpram_queue;
+static struct request_queue *xpram_queue;
 
 static int __init xpram_setup_blkdev(void)
 {
@@ -450,8 +450,13 @@
 	 * Assign the other needed values: make request function, sizes and
 	 * hardsect size. All the minor devices feature the same value.
 	 */
-	blk_queue_make_request(&xpram_queue, xpram_make_request);
-	blk_queue_hardsect_size(&xpram_queue, 4096);
+	xpram_queue = blk_alloc_queue(GFP_KERNEL);
+	if (!xpram_queue) {
+		rc = -ENOMEM;
+		goto out_unreg;
+	}
+	blk_queue_make_request(xpram_queue, xpram_make_request);
+	blk_queue_hardsect_size(xpram_queue, 4096);
 
 	/*
 	 * Setup device structures.
@@ -467,7 +472,7 @@
 		disk->first_minor = i;
 		disk->fops = &xpram_devops;
 		disk->private_data = &xpram_devices[i];
-		disk->queue = &xpram_queue;
+		disk->queue = xpram_queue;
 		sprintf(disk->disk_name, "slram%d", i);
 		sprintf(disk->devfs_name, "slram/%d", i);
 		set_capacity(disk, xpram_sizes[i] << 1);
@@ -475,6 +480,9 @@
 	}
 
 	return 0;
+out_unreg:
+	devfs_remove("slram");
+	unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
 out:
 	while (i--)
 		put_disk(xpram_disks[i]);
@@ -493,6 +501,7 @@
 	}
 	unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
 	devfs_remove("slram");
+	blk_cleanup_queue(xpram_queue);
 	sysdev_unregister(&xpram_sys_device);
 	sysdev_class_unregister(&xpram_sysclass);
 }
diff -Nru a/drivers/s390/char/Makefile b/drivers/s390/char/Makefile
--- a/drivers/s390/char/Makefile	Tue Jun 15 22:20:40 2004
+++ b/drivers/s390/char/Makefile	Tue Jun 15 22:20:40 2004
@@ -4,9 +4,10 @@
 
 obj-y += ctrlchar.o keyboard.o defkeymap.o
 
-tub3270-objs := raw3270.o tty3270.o fs3270.o
-obj-$(CONFIG_TN3270) += tub3270.o
+obj-$(CONFIG_TN3270) += raw3270.o
 obj-$(CONFIG_TN3270_CONSOLE) += con3270.o
+obj-$(CONFIG_TN3270_TTY) += tty3270.o
+obj-$(CONFIG_TN3270_FS) += fs3270.o
 
 obj-$(CONFIG_TN3215) += con3215.o
 
diff -Nru a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
--- a/drivers/s390/char/con3215.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/s390/char/con3215.c	Tue Jun 15 22:20:42 2004
@@ -1002,7 +1002,8 @@
 	ret = 0;
 	while (count > 0) {
 		length = count < 80 ? count : 80;
-		length -= copy_from_user(raw->ubuffer, buf, length);
+		length -= copy_from_user(raw->ubuffer,
+				(const unsigned char __user *)buf, length);
 		if (length == 0) {
 			if (!ret)
 				ret = -EFAULT;
diff -Nru a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c
--- a/drivers/s390/char/keyboard.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/s390/char/keyboard.c	Tue Jun 15 22:20:39 2004
@@ -338,7 +338,7 @@
  * Ioctl stuff.
  */
 static int
-do_kdsk_ioctl(struct kbd_data *kbd, struct kbentry *user_kbe,
+do_kdsk_ioctl(struct kbd_data *kbd, struct kbentry __user *user_kbe,
 	      int cmd, int perm)
 {
 	struct kbentry tmp;
@@ -410,7 +410,7 @@
 }
 
 static int
-do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry *u_kbs,
+do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry __user *u_kbs,
 	       int cmd, int perm)
 {
 	unsigned char kb_func;
@@ -464,9 +464,12 @@
 kbd_ioctl(struct kbd_data *kbd, struct file *file,
 	  unsigned int cmd, unsigned long arg)
 {
-	struct kbdiacrs *a;
+	struct kbdiacrs __user *a;
+	void __user *argp;
 	int ct, perm;
 
+	argp = (void __user *)arg;
+
 	/*
 	 * To have permissions to do most of the vt ioctls, we either have
 	 * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
@@ -474,15 +477,15 @@
 	perm = current->signal->tty == kbd->tty || capable(CAP_SYS_TTY_CONFIG);
 	switch (cmd) {
 	case KDGKBTYPE:
-		return put_user(KB_101, (char*) arg);
+		return put_user(KB_101, (char __user *)argp);
 	case KDGKBENT:
 	case KDSKBENT:
-		return do_kdsk_ioctl(kbd, (struct kbentry *)arg, cmd, perm);
+		return do_kdsk_ioctl(kbd, argp, cmd, perm);
 	case KDGKBSENT:
 	case KDSKBSENT:
-		return do_kdgkb_ioctl(kbd, (struct kbsentry *)arg, cmd, perm);
+		return do_kdgkb_ioctl(kbd, argp, cmd, perm);
 	case KDGKBDIACR:
-		a = (struct kbdiacrs *) arg;
+		a = argp;
 
 		if (put_user(kbd->accent_table_size, &a->kb_cnt))
 			return -EFAULT;
@@ -492,7 +495,7 @@
 			return -EFAULT;
 		return 0;
 	case KDSKBDIACR:
-		a = (struct kbdiacrs *) arg;
+		a = argp;
 		if (!perm)
 			return -EPERM;
 		if (get_user(ct, &a->kb_cnt))
diff -Nru a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
--- a/drivers/s390/char/raw3270.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/s390/char/raw3270.c	Tue Jun 15 22:20:44 2004
@@ -47,11 +47,11 @@
 #define RAW3270_FLAGS_14BITADDR	0	/* 14-bit buffer addresses */
 #define RAW3270_FLAGS_BUSY	1	/* Device busy, leave it alone */
 #define RAW3270_FLAGS_ATTN	2	/* Device sent an ATTN interrupt */
-#define RAW3270_FLAGS_SHUTDOWN	4	/* Device is in offline processing */
+#define RAW3270_FLAGS_READY	4	/* Device is useable by views */
 #define RAW3270_FLAGS_CONSOLE	8	/* Device is the console. */
 
-/* Lock to protect global data of raw3270 (devices, views, etc). */
-static spinlock_t raw3270_lock = SPIN_LOCK_UNLOCKED;
+/* Semaphore to protect global data of raw3270 (devices, views, etc). */
+static DECLARE_MUTEX(raw3270_sem);
 
 /* List of 3270 devices. */
 static struct list_head raw3270_devices = LIST_HEAD_INIT(raw3270_devices);
@@ -308,7 +308,7 @@
 	rp = view->dev;
 	if (!rp || rp->view != view)
 		rc = -EACCES;
-	else if (test_bit(RAW3270_FLAGS_SHUTDOWN, &rp->flags))
+	else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags))
 		rc = -ENODEV;
 	else
 		rc =  __raw3270_start(rp, view, rq);
@@ -603,7 +603,6 @@
 {
 	static const unsigned char wbuf[] =
 		{ 0x00, 0x07, 0x01, 0xff, 0x03, 0x00, 0x81 };
-	unsigned long flags;
 	struct raw3270_ua *uap;
 	unsigned short count;
 	int rc;
@@ -638,6 +637,8 @@
 	/* Wait for attention interrupt. */
 #ifdef CONFIG_TN3270_CONSOLE
 	if (raw3270_registered == 0) {
+		unsigned long flags;
+
 		spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
 		while (!test_and_clear_bit(RAW3270_FLAGS_ATTN, &rp->flags))
 			wait_cons_dev();
@@ -764,7 +765,7 @@
 	 * Add device to list and find the smallest unused minor
 	 * number for it.
 	 */
-	spin_lock(&raw3270_lock);
+	down(&raw3270_sem);
 	/* Keep the list sorted. */
 	minor = 0;
 	rp->minor = -1;
@@ -781,7 +782,7 @@
 		rp->minor = minor;
 		list_add_tail(&rp->list, &raw3270_devices);
 	}
-	spin_unlock(&raw3270_lock);
+	up(&raw3270_sem);
 	/* No free minor number? Then give up. */
 	if (rp->minor == -1)
 		return -EUSERS;
@@ -811,6 +812,7 @@
 	raw3270_reset_device(rp);
 	raw3270_size_device(rp);
 	raw3270_reset_device(rp);
+	set_bit(RAW3270_FLAGS_READY, &rp->flags);
 	return rp;
 }
 
@@ -872,7 +874,7 @@
 	spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
 	if (rp->view == view)
 		rc = 0;
-	else if (test_bit(RAW3270_FLAGS_SHUTDOWN, &rp->flags))
+	else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags))
 		rc = -ENODEV;
 	else {
 		oldview = 0;
@@ -921,7 +923,7 @@
 		list_del_init(&view->list);
 		list_add_tail(&view->list, &rp->view_list);
 		/* Try to activate another view. */
-		if (!test_bit(RAW3270_FLAGS_SHUTDOWN, &rp->flags)) {
+		if (test_bit(RAW3270_FLAGS_READY, &rp->flags)) {
 			list_for_each_entry(view, &rp->view_list, list)
 				if (view->fn->activate(view) == 0) {
 					rp->view = view;
@@ -942,13 +944,13 @@
 	struct raw3270 *rp;
 	int rc;
 
-	spin_lock(&raw3270_lock);
+	down(&raw3270_sem);
 	rc = -ENODEV;
 	list_for_each_entry(rp, &raw3270_devices, list) {
 		if (rp->minor != minor)
 			continue;
 		spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
-		if (!test_bit(RAW3270_FLAGS_SHUTDOWN, &rp->flags)) {
+		if (test_bit(RAW3270_FLAGS_READY, &rp->flags)) {
 			atomic_set(&view->ref_count, 2);
 			view->dev = rp;
 			view->fn = fn;
@@ -963,7 +965,7 @@
 		spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
 		break;
 	}
-	spin_unlock(&raw3270_lock);
+	up(&raw3270_sem);
 	return rc;
 }
 
@@ -977,25 +979,26 @@
 	struct raw3270_view *view, *tmp;
 	unsigned long flags;
 
-	spin_lock(&raw3270_lock);
+	down(&raw3270_sem);
 	view = ERR_PTR(-ENODEV);
 	list_for_each_entry(rp, &raw3270_devices, list) {
 		if (rp->minor != minor)
 			continue;
 		spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
-		if (!test_bit(RAW3270_FLAGS_SHUTDOWN, &rp->flags)) {
+		if (test_bit(RAW3270_FLAGS_READY, &rp->flags)) {
+			view = ERR_PTR(-ENOENT);
 			list_for_each_entry(tmp, &rp->view_list, list) {
 				if (tmp->fn == fn) {
 					raw3270_get_view(tmp);
 					view = tmp;
+					break;
 				}
 			}
-		} else
-			view = ERR_PTR(-ENOENT);
+		}
 		spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
 		break;
 	}
-	spin_unlock(&raw3270_lock);
+	up(&raw3270_sem);
 	return view;
 }
 
@@ -1007,6 +1010,7 @@
 {
 	unsigned long flags;
 	struct raw3270 *rp;
+	struct raw3270_view *nv;
 
 	rp = view->dev;
 	spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
@@ -1015,17 +1019,18 @@
 		rp->view = 0;
 	}
 	list_del_init(&view->list);
-	if (!rp->view && !test_bit(RAW3270_FLAGS_SHUTDOWN, &rp->flags)) {
+	if (!rp->view && test_bit(RAW3270_FLAGS_READY, &rp->flags)) {
 		/* Try to activate another view. */
-		list_for_each_entry(view, &rp->view_list, list)
-			if (view->fn->activate(view) == 0) {
-				rp->view = view;
+		list_for_each_entry(nv, &rp->view_list, list) {
+			if (nv->fn->activate(view) == 0) {
+				rp->view = nv;
 				break;
 			}
+		}
 	}
 	spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
 	/* Wait for reference counter to drop to zero. */
-	atomic_dec(&view->ref_count);
+	atomic_sub(2, &view->ref_count);
 	wait_event(raw3270_wait_queue, atomic_read(&view->ref_count) == 0);
 	if (view->fn->free)
 		view->fn->free(view);
@@ -1040,9 +1045,9 @@
 	struct ccw_device *cdev;
 
 	/* Remove from device chain. */
-	spin_lock(&raw3270_lock);
+	down(&raw3270_sem);
 	list_del_init(&rp->list);
-	spin_unlock(&raw3270_lock);
+	up(&raw3270_sem);
 
 	/* Disconnect from ccw_device. */
 	cdev = rp->cdev;
@@ -1109,8 +1114,48 @@
 	sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group);
 }
 
-/* Hackish. A notifier chain would be cleaner. */
-extern void tty3270_notifier(int index, int active);
+/*
+ * Notifier for device addition/removal
+ */
+struct raw3270_notifier {
+	struct list_head list;
+	void (*notifier)(int, int);
+};
+
+static struct list_head raw3270_notifier = LIST_HEAD_INIT(raw3270_notifier);
+
+int raw3270_register_notifier(void (*notifier)(int, int))
+{
+	struct raw3270_notifier *np;
+	struct raw3270 *rp;
+
+	np = kmalloc(sizeof(struct raw3270_notifier), GFP_KERNEL);
+	if (!np)
+		return -ENOMEM;
+	np->notifier = notifier;
+	down(&raw3270_sem);
+	list_add_tail(&np->list, &raw3270_notifier);
+	list_for_each_entry(rp, &raw3270_devices, list) {
+		get_device(&rp->cdev->dev);
+		notifier(rp->minor, 1);
+	}
+	up(&raw3270_sem);
+	return 0;
+}
+
+void raw3270_unregister_notifier(void (*notifier)(int, int))
+{
+	struct raw3270_notifier *np;
+
+	down(&raw3270_sem);
+	list_for_each_entry(np, &raw3270_notifier, list)
+		if (np->notifier == notifier) {
+			list_del(&np->list);
+			kfree(np);
+			break;
+		}
+	up(&raw3270_sem);
+}
 
 /*
  * Set 3270 device online.
@@ -1119,6 +1164,7 @@
 raw3270_set_online (struct ccw_device *cdev)
 {
 	struct raw3270 *rp;
+	struct raw3270_notifier *np;
 
 	rp = raw3270_create_device(cdev);
 	if (IS_ERR(rp))
@@ -1127,7 +1173,11 @@
 	raw3270_size_device(rp);
 	raw3270_reset_device(rp);
 	raw3270_create_attributes(rp);
-	tty3270_notifier(rp->minor, 1);
+	set_bit(RAW3270_FLAGS_READY, &rp->flags);
+	down(&raw3270_sem);
+	list_for_each_entry(np, &raw3270_notifier, list)
+		np->notifier(rp->minor, 1);
+	up(&raw3270_sem);
 	return 0;
 }
 
@@ -1140,9 +1190,10 @@
 	unsigned long flags;
 	struct raw3270 *rp;
 	struct raw3270_view *v;
+	struct raw3270_notifier *np;
 
 	rp = cdev->dev.driver_data;
-	set_bit(RAW3270_FLAGS_SHUTDOWN, &rp->flags);
+	clear_bit(RAW3270_FLAGS_READY, &rp->flags);
 
 	sysfs_remove_group(&cdev->dev.kobj, &raw3270_attr_group);
 
@@ -1162,7 +1213,10 @@
 	}
 	spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
 
-	tty3270_notifier(rp->minor, 0);
+	down(&raw3270_sem);
+	list_for_each_entry(np, &raw3270_notifier, list)
+		np->notifier(rp->minor, 0);
+	up(&raw3270_sem);
 
 	/* Reset 3270 device. */
 	raw3270_reset_device(rp);
@@ -1210,7 +1264,7 @@
 	.set_offline	= &raw3270_set_offline,
 };
 
-int
+static int
 raw3270_init(void)
 {
 	struct raw3270 *rp;
@@ -1222,18 +1276,17 @@
 	rc = ccw_driver_register(&raw3270_ccw_driver);
 	if (rc == 0) {
 		/* Create attributes for early (= console) device. */
-		spin_lock(&raw3270_lock);
+		down(&raw3270_sem);
 		list_for_each_entry(rp, &raw3270_devices, list) {
 			get_device(&rp->cdev->dev);
 			raw3270_create_attributes(rp);
-			tty3270_notifier(rp->minor, 1);
 		}
-		spin_unlock(&raw3270_lock);
+		up(&raw3270_sem);
 	}
 	return rc;
 }
 
-void
+static void
 raw3270_exit(void)
 {
 	ccw_driver_unregister(&raw3270_ccw_driver);
@@ -1241,8 +1294,9 @@
 
 MODULE_LICENSE("GPL");
 
-EXPORT_SYMBOL(raw3270_init);
-EXPORT_SYMBOL(raw3270_exit);
+module_init(raw3270_init);
+module_exit(raw3270_exit);
+
 EXPORT_SYMBOL(raw3270_request_alloc);
 EXPORT_SYMBOL(raw3270_request_free);
 EXPORT_SYMBOL(raw3270_request_reset);
@@ -1258,3 +1312,6 @@
 EXPORT_SYMBOL(raw3270_deactivate_view);
 EXPORT_SYMBOL(raw3270_start);
 EXPORT_SYMBOL(raw3270_start_irq);
+EXPORT_SYMBOL(raw3270_register_notifier);
+EXPORT_SYMBOL(raw3270_unregister_notifier);
+EXPORT_SYMBOL(raw3270_wait_queue);
diff -Nru a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h
--- a/drivers/s390/char/raw3270.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/s390/char/raw3270.h	Tue Jun 15 22:20:42 2004
@@ -78,9 +78,6 @@
 
 #define RAW3270_MAXDEVS	256
 
-int raw3270_init(void);
-void raw3270_exit(void);
-
 /* For TUBGETMOD and TUBSETMOD. Should include. */
 struct raw3270_iocb {
 	short model;
@@ -189,6 +186,10 @@
 
 struct raw3270 *raw3270_setup_console(struct ccw_device *cdev);
 void raw3270_wait_cons_dev(struct raw3270 *);
+
+/* Notifier for device addition/removal */
+int raw3270_register_notifier(void (*notifier)(int, int));
+void raw3270_unregister_notifier(void (*notifier)(int, int));
 
 /*
  * Little memory allocator for string objects. 
diff -Nru a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c
--- a/drivers/s390/char/sclp_tty.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/s390/char/sclp_tty.c	Tue Jun 15 22:20:37 2004
@@ -112,46 +112,46 @@
 	switch (cmd) {
 	case TIOCSCLPSHTAB:
 		/* set width of horizontal tab	*/
-		if (get_user(sclp_ioctls.htab, (unsigned short *) arg))
+		if (get_user(sclp_ioctls.htab, (unsigned short __user *) arg))
 			rc = -EFAULT;
 		else
 			check = 1;
 		break;
 	case TIOCSCLPGHTAB:
 		/* get width of horizontal tab	*/
-		if (put_user(sclp_ioctls.htab, (unsigned short *) arg))
+		if (put_user(sclp_ioctls.htab, (unsigned short __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPSECHO:
 		/* enable/disable echo of input */
-		if (get_user(sclp_ioctls.echo, (unsigned char *) arg))
+		if (get_user(sclp_ioctls.echo, (unsigned char __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPGECHO:
 		/* Is echo of input enabled ?  */
-		if (put_user(sclp_ioctls.echo, (unsigned char *) arg))
+		if (put_user(sclp_ioctls.echo, (unsigned char __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPSCOLS:
 		/* set number of columns for output  */
-		if (get_user(sclp_ioctls.columns, (unsigned short *) arg))
+		if (get_user(sclp_ioctls.columns, (unsigned short __user *) arg))
 			rc = -EFAULT;
 		else
 			check = 1;
 		break;
 	case TIOCSCLPGCOLS:
 		/* get number of columns for output  */
-		if (put_user(sclp_ioctls.columns, (unsigned short *) arg))
+		if (put_user(sclp_ioctls.columns, (unsigned short __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPSNL:
 		/* enable/disable writing without final new line character  */
-		if (get_user(sclp_ioctls.final_nl, (signed char *) arg))
+		if (get_user(sclp_ioctls.final_nl, (signed char __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPGNL:
 		/* Is writing without final new line character enabled ?  */
-		if (put_user(sclp_ioctls.final_nl, (signed char *) arg))
+		if (put_user(sclp_ioctls.final_nl, (signed char __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPSOBUF:
@@ -160,7 +160,7 @@
 		 * up to next 4kB boundary and stored as number of SCCBs
 		 * (4kB Buffers) limitation: 256 x 4kB
 		 */
-		if (get_user(obuf, (unsigned int *) arg) == 0) {
+		if (get_user(obuf, (unsigned int __user *) arg) == 0) {
 			if (obuf & 0xFFF)
 				sclp_ioctls.max_sccb = (obuf >> 12) + 1;
 			else
@@ -171,22 +171,22 @@
 	case TIOCSCLPGOBUF:
 		/* get the maximum buffers size for output  */
 		obuf = sclp_ioctls.max_sccb << 12;
-		if (put_user(obuf, (unsigned int *) arg))
+		if (put_user(obuf, (unsigned int __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPGKBUF:
 		/* get the number of buffers got from kernel at startup */
-		if (put_user(sclp_ioctls.kmem_sccb, (unsigned short *) arg))
+		if (put_user(sclp_ioctls.kmem_sccb, (unsigned short __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPSCASE:
 		/* enable/disable conversion from upper to lower case */
-		if (get_user(sclp_ioctls.tolower, (unsigned char *) arg))
+		if (get_user(sclp_ioctls.tolower, (unsigned char __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPGCASE:
 		/* Is conversion from upper to lower case of input enabled? */
-		if (put_user(sclp_ioctls.tolower, (unsigned char *) arg))
+		if (put_user(sclp_ioctls.tolower, (unsigned char __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPSDELIM:
@@ -194,7 +194,7 @@
 		 * set special character used for separating upper and
 		 * lower case, 0x00 disables this feature
 		 */
-		if (get_user(sclp_ioctls.delim, (unsigned char *) arg))
+		if (get_user(sclp_ioctls.delim, (unsigned char __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPGDELIM:
@@ -202,7 +202,7 @@
 		 * get special character used for separating upper and
 		 * lower case, 0x00 disables this feature
 		 */
-		if (put_user(sclp_ioctls.delim, (unsigned char *) arg))
+		if (put_user(sclp_ioctls.delim, (unsigned char __user *) arg))
 			rc = -EFAULT;
 		break;
 	case TIOCSCLPSINIT:
@@ -415,7 +415,8 @@
 	while (count > 0) {
 		length = count < SCLP_TTY_BUF_SIZE ?
 			count : SCLP_TTY_BUF_SIZE;
-		length -= copy_from_user(sclp_tty_chars, buf, length);
+		length -= copy_from_user(sclp_tty_chars,
+				(const unsigned char __user *)buf, length);
 		if (length == 0) {
 			if (!ret)
 				ret = -EFAULT;
diff -Nru a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
--- a/drivers/s390/char/sclp_vt220.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/s390/char/sclp_vt220.c	Tue Jun 15 22:20:38 2004
@@ -490,7 +490,8 @@
 	while (count > 0) {
 		length = count < SCLP_VT220_BUF_SIZE ?
 			 count : SCLP_VT220_BUF_SIZE;
-		length -= copy_from_user(tty->driver_data, buf, length);
+		length -= copy_from_user(tty->driver_data,
+				(const unsigned char __user *)buf, length);
 		if (length == 0) {
 			if (!ret)
 				return -EFAULT;
diff -Nru a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
--- a/drivers/s390/char/tape.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/s390/char/tape.h	Tue Jun 15 22:20:42 2004
@@ -32,7 +32,7 @@
 #ifdef  DBF_LIKE_HELL
 #define DBF_LH(level, str, ...) \
 do { \
-	debug_sprintf_event(tape_dbf_area, level, str, ## __VA_ARGS__); \
+	debug_sprintf_event(TAPE_DBF_AREA, level, str, ## __VA_ARGS__); \
 } while (0)
 #else
 #define DBF_LH(level, str, ...) do {} while(0)
@@ -43,12 +43,12 @@
  */
 #define DBF_EVENT(d_level, d_str...) \
 do { \
-	debug_sprintf_event(tape_dbf_area, d_level, d_str); \
+	debug_sprintf_event(TAPE_DBF_AREA, d_level, d_str); \
 } while (0)
 
 #define DBF_EXCEPTION(d_level, d_str...) \
 do { \
-	debug_sprintf_exception(tape_dbf_area, d_level, d_str); \
+	debug_sprintf_exception(TAPE_DBF_AREA, d_level, d_str); \
 } while (0)
 
 #define TAPE_VERSION_MAJOR 2
@@ -313,7 +313,7 @@
 extern void tape_med_state_set(struct tape_device *, enum tape_medium_state);
 
 /* The debug area */
-extern debug_info_t *tape_dbf_area;
+extern debug_info_t *TAPE_DBF_AREA;
 
 /* functions for building ccws */
 static inline struct ccw1 *
diff -Nru a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c
--- a/drivers/s390/char/tape_34xx.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/s390/char/tape_34xx.c	Tue Jun 15 22:20:39 2004
@@ -15,11 +15,19 @@
 #include <linux/bio.h>
 #include <linux/workqueue.h>
 
+#define TAPE_DBF_AREA	tape_34xx_dbf
+
 #include "tape.h"
 #include "tape_std.h"
 
 #define PRINTK_HEADER "TAPE_34XX: "
 
+/*
+ * Pointer to debug area.
+ */
+debug_info_t *TAPE_DBF_AREA = NULL;
+EXPORT_SYMBOL(TAPE_DBF_AREA);
+
 enum tape_34xx_type {
 	tape_3480,
 	tape_3490,
@@ -885,7 +893,7 @@
 	if (cmd == TAPE390_DISPLAY) {
 		struct display_struct disp;
 
-		if (copy_from_user(&disp, (char *) arg, sizeof(disp)) != 0)
+		if (copy_from_user(&disp, (char __user *) arg, sizeof(disp)) != 0)
 			return -EFAULT;
 
 		return tape_std_display(device, &disp);
@@ -1343,7 +1351,13 @@
 {
 	int rc;
 
-	DBF_EVENT(3, "34xx init: $Revision: 1.20 $\n");
+	TAPE_DBF_AREA = debug_register ( "tape_34xx", 1, 2, 4*sizeof(long));
+	debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view);
+#ifdef DBF_LIKE_HELL
+	debug_set_level(TAPE_DBF_AREA, 6);
+#endif
+
+	DBF_EVENT(3, "34xx init: $Revision: 1.21 $\n");
 	/* Register driver for 3480/3490 tapes. */
 	rc = ccw_driver_register(&tape_34xx_driver);
 	if (rc)
@@ -1357,12 +1371,14 @@
 tape_34xx_exit(void)
 {
 	ccw_driver_unregister(&tape_34xx_driver);
+
+	debug_unregister(TAPE_DBF_AREA);
 }
 
 MODULE_DEVICE_TABLE(ccw, tape_34xx_ids);
 MODULE_AUTHOR("(C) 2001-2002 IBM Deutschland Entwicklung GmbH");
 MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape "
-		   "device driver ($Revision: 1.20 $)");
+		   "device driver ($Revision: 1.21 $)");
 MODULE_LICENSE("GPL");
 
 module_init(tape_34xx_init);
diff -Nru a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
--- a/drivers/s390/char/tape_block.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/char/tape_block.c	Tue Jun 15 22:20:43 2004
@@ -19,6 +19,8 @@
 
 #include <asm/debug.h>
 
+#define TAPE_DBF_AREA	tape_core_dbf
+
 #include "tape.h"
 
 #define PRINTK_HEADER "TAPE_BLOCK: "
diff -Nru a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c
--- a/drivers/s390/char/tape_char.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/char/tape_char.c	Tue Jun 15 22:20:43 2004
@@ -18,6 +18,8 @@
 
 #include <asm/uaccess.h>
 
+#define TAPE_DBF_AREA	tape_core_dbf
+
 #include "tape.h"
 #include "tape_std.h"
 #include "tape_class.h"
@@ -29,8 +31,8 @@
 /*
  * file operation structure for tape character frontend
  */
-static ssize_t tapechar_read(struct file *, char *, size_t, loff_t *);
-static ssize_t tapechar_write(struct file *, const char *, size_t, loff_t *);
+static ssize_t tapechar_read(struct file *, char __user *, size_t, loff_t *);
+static ssize_t tapechar_write(struct file *, const char __user *, size_t, loff_t *);
 static int tapechar_open(struct inode *,struct file *);
 static int tapechar_release(struct inode *,struct file *);
 static int tapechar_ioctl(struct inode *, struct file *, unsigned int,
@@ -134,7 +136,7 @@
  * Tape device read function
  */
 ssize_t
-tapechar_read (struct file *filp, char *data, size_t count, loff_t *ppos)
+tapechar_read(struct file *filp, char __user *data, size_t count, loff_t *ppos)
 {
 	struct tape_device *device;
 	struct tape_request *request;
@@ -208,7 +210,7 @@
  * Tape device write function
  */
 ssize_t
-tapechar_write(struct file *filp, const char *data, size_t count, loff_t *ppos)
+tapechar_write(struct file *filp, const char __user *data, size_t count, loff_t *ppos)
 {
 	struct tape_device *device;
 	struct tape_request *request;
@@ -389,7 +391,7 @@
 	if (no == MTIOCTOP) {
 		struct mtop op;
 
-		if (copy_from_user(&op, (char *) data, sizeof(op)) != 0)
+		if (copy_from_user(&op, (char __user *) data, sizeof(op)) != 0)
 			return -EFAULT;
 		if (op.mt_count < 0)
 			return -EINVAL;
@@ -436,7 +438,7 @@
 		if (rc < 0)
 			return rc;
 		pos.mt_blkno = rc;
-		if (copy_to_user((char *) data, &pos, sizeof(pos)) != 0)
+		if (copy_to_user((char __user *) data, &pos, sizeof(pos)) != 0)
 			return -EFAULT;
 		return 0;
 	}
@@ -466,7 +468,7 @@
 			get.mt_blkno = rc;
 		}
 
-		if (copy_to_user((char *) data, &get, sizeof(get)) != 0)
+		if (copy_to_user((char __user *) data, &get, sizeof(get)) != 0)
 			return -EFAULT;
 
 		return 0;
diff -Nru a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
--- a/drivers/s390/char/tape_core.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/s390/char/tape_core.c	Tue Jun 15 22:20:38 2004
@@ -20,6 +20,8 @@
 
 #include <asm/types.h>	     // for variable types
 
+#define TAPE_DBF_AREA	tape_core_dbf
+
 #include "tape.h"
 #include "tape_std.h"
 
@@ -39,7 +41,8 @@
 /*
  * Pointer to debug area.
  */
-debug_info_t *tape_dbf_area = NULL;
+debug_info_t *TAPE_DBF_AREA = NULL;
+EXPORT_SYMBOL(TAPE_DBF_AREA);
 
 /*
  * Printable strings for tape enumerations.
@@ -1176,12 +1179,12 @@
 static int
 tape_init (void)
 {
-	tape_dbf_area = debug_register ( "tape", 1, 2, 4*sizeof(long));
-	debug_register_view(tape_dbf_area, &debug_sprintf_view);
+	TAPE_DBF_AREA = debug_register ( "tape", 1, 2, 4*sizeof(long));
+	debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view);
 #ifdef DBF_LIKE_HELL
-	debug_set_level(tape_dbf_area, 6);
+	debug_set_level(TAPE_DBF_AREA, 6);
 #endif
-	DBF_EVENT(3, "tape init: ($Revision: 1.49 $)\n");
+	DBF_EVENT(3, "tape init: ($Revision: 1.50 $)\n");
 	tape_proc_init();
 	tapechar_init ();
 	tapeblock_init ();
@@ -1200,19 +1203,18 @@
 	tapechar_exit();
 	tapeblock_exit();
 	tape_proc_cleanup();
-	debug_unregister (tape_dbf_area);
+	debug_unregister (TAPE_DBF_AREA);
 }
 
 MODULE_AUTHOR("(C) 2001 IBM Deutschland Entwicklung GmbH by Carsten Otte and "
 	      "Michael Holzheu (cotte@de.ibm.com,holzheu@de.ibm.com)");
 MODULE_DESCRIPTION("Linux on zSeries channel attached "
-		   "tape device driver ($Revision: 1.49 $)");
+		   "tape device driver ($Revision: 1.50 $)");
 MODULE_LICENSE("GPL");
 
 module_init(tape_init);
 module_exit(tape_exit);
 
-EXPORT_SYMBOL(tape_dbf_area);
 EXPORT_SYMBOL(tape_generic_remove);
 EXPORT_SYMBOL(tape_generic_probe);
 EXPORT_SYMBOL(tape_generic_online);
diff -Nru a/drivers/s390/char/tape_proc.c b/drivers/s390/char/tape_proc.c
--- a/drivers/s390/char/tape_proc.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/s390/char/tape_proc.c	Tue Jun 15 22:20:39 2004
@@ -16,6 +16,8 @@
 #include <linux/vmalloc.h>
 #include <linux/seq_file.h>
 
+#define TAPE_DBF_AREA	tape_core_dbf
+
 #include "tape.h"
 
 #define PRINTK_HEADER "TAPE_PROC: "
diff -Nru a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
--- a/drivers/s390/char/tape_std.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/s390/char/tape_std.c	Tue Jun 15 22:20:35 2004
@@ -22,6 +22,8 @@
 #include <asm/ebcdic.h>
 #include <asm/tape390.h>
 
+#define TAPE_DBF_AREA	tape_core_dbf
+
 #include "tape.h"
 #include "tape_std.h"
 
diff -Nru a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
--- a/drivers/s390/char/tty3270.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/s390/char/tty3270.c	Tue Jun 15 22:20:38 2004
@@ -35,6 +35,7 @@
 #define TTY3270_STRING_PAGES 5
 
 struct tty_driver *tty3270_driver;
+static int tty3270_max_index;
 
 struct raw3270_fn tty3270_fn;
 
@@ -836,6 +837,22 @@
 	tty3270_free_view((struct tty3270 *) view);
 }
 
+/*
+ * Delayed freeing of tty3270 views.
+ */
+static void
+tty3270_del_views(void)
+{
+	struct tty3270 *tp;
+	int i;
+
+	for (i = 0; i < tty3270_max_index; i++) {
+		tp = (struct tty3270 *) raw3270_find_view(&tty3270_fn, i);
+		if (!IS_ERR(tp))
+			raw3270_del_view(&tp->view);
+	}
+}
+
 struct raw3270_fn tty3270_fn = {
 	.activate = tty3270_activate,
 	.deactivate = tty3270_deactivate,
@@ -867,6 +884,12 @@
 		tp->inattr = TF_INPUT;
 		return 0;
 	}
+	if (tty3270_max_index < tty->index + 1)
+		tty3270_max_index = tty->index + 1;
+
+	/* Quick exit if there is no device for tty->index. */
+	if (PTR_ERR(tp) == -ENODEV)
+		return -ENODEV;
 
 	/* Allocate tty3270 structure on first open. */
 	tp = tty3270_alloc_view();
@@ -1778,9 +1801,6 @@
 	struct tty_driver *driver;
 	int ret;
 
-	ret = raw3270_init();
-	if (ret)
-		return ret;
 	driver = alloc_tty_driver(256);
 	if (!driver)
 		return -ENOMEM;
@@ -1807,6 +1827,14 @@
 		return ret;
 	}
 	tty3270_driver = driver;
+	ret = raw3270_register_notifier(tty3270_notifier);
+	if (ret) {
+		printk(KERN_ERR "tty3270 notifier registration failed "
+		       "with %d\n", ret);
+		put_tty_driver(driver);
+		return ret;
+
+	}
 	return 0;
 }
 
@@ -1815,10 +1843,11 @@
 {
 	struct tty_driver *driver;
 
+	raw3270_unregister_notifier(tty3270_notifier);
 	driver = tty3270_driver;
 	tty3270_driver = 0;
 	tty_unregister_driver(driver);
-	raw3270_exit();
+	tty3270_del_views();
 }
 
 MODULE_LICENSE("GPL");
diff -Nru a/drivers/s390/cio/airq.c b/drivers/s390/cio/airq.c
--- a/drivers/s390/cio/airq.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/cio/airq.c	Tue Jun 15 22:20:43 2004
@@ -2,7 +2,7 @@
  *  drivers/s390/cio/airq.c
  *   S/390 common I/O routines -- support for adapter interruptions
  *
- *   $Revision: 1.11 $
+ *   $Revision: 1.12 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -14,11 +14,11 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/rcupdate.h>
 
 #include "cio_debug.h"
 #include "airq.h"
 
-static spinlock_t adapter_lock = SPIN_LOCK_UNLOCKED;
 static adapter_int_handler_t adapter_handler;
 
 /*
@@ -40,23 +40,17 @@
 
 	CIO_TRACE_EVENT (4, "rgaint");
 
-	spin_lock (&adapter_lock);
-
 	if (handler == NULL)
 		ret = -EINVAL;
-	else if (adapter_handler)
-		ret = -EBUSY;
-	else {
-		adapter_handler = handler;
-		ret = 0;
-	}
-
-	spin_unlock (&adapter_lock);
+	else
+		ret = (cmpxchg(&adapter_handler, NULL, handler) ? -EBUSY : 0);
+	if (!ret)
+		synchronize_kernel();
 
 	sprintf (dbf_txt, "ret:%d", ret);
 	CIO_TRACE_EVENT (4, dbf_txt);
 
-	return (ret);
+	return ret;
 }
 
 int
@@ -67,38 +61,26 @@
 
 	CIO_TRACE_EVENT (4, "urgaint");
 
-	spin_lock (&adapter_lock);
-
 	if (handler == NULL)
 		ret = -EINVAL;
-	else if (handler != adapter_handler)
-		ret = -EINVAL;
 	else {
 		adapter_handler = NULL;
+		synchronize_kernel();
 		ret = 0;
 	}
-
-	spin_unlock (&adapter_lock);
-
 	sprintf (dbf_txt, "ret:%d", ret);
 	CIO_TRACE_EVENT (4, dbf_txt);
 
-	return (ret);
+	return ret;
 }
 
 void
 do_adapter_IO (void)
 {
-	CIO_TRACE_EVENT (4, "doaio");
-
-	spin_lock (&adapter_lock);
+	CIO_TRACE_EVENT (6, "doaio");
 
 	if (adapter_handler)
 		(*adapter_handler) ();
-
-	spin_unlock (&adapter_lock);
-
-	return;
 }
 
 EXPORT_SYMBOL (s390_register_adapter_interrupt);
diff -Nru a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
--- a/drivers/s390/cio/blacklist.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/s390/cio/blacklist.c	Tue Jun 15 22:20:38 2004
@@ -308,7 +308,7 @@
 	return len;
 }
 
-static int cio_ignore_write (struct file *file, const char *user_buf,
+static int cio_ignore_write(struct file *file, const char __user *user_buf,
 			     unsigned long user_len, void *data)
 {
 	char *buf;
diff -Nru a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
--- a/drivers/s390/cio/ccwgroup.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/cio/ccwgroup.c	Tue Jun 15 22:20:41 2004
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/ccwgroup.c
  *  bus driver for ccwgroup
- *   $Revision: 1.27 $
+ *   $Revision: 1.28 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *                       IBM Corporation
@@ -179,12 +179,12 @@
 		    || gdev->cdev[i]->id.driver_info !=
 		    gdev->cdev[0]->id.driver_info) {
 			rc = -EINVAL;
-			goto error;
+			goto free_dev;
 		}
 		/* Don't allow a device to belong to more than one group. */
 		if (gdev->cdev[i]->dev.driver_data) {
 			rc = -EINVAL;
-			goto error;
+			goto free_dev;
 		}
 	}
 	for (i = 0; i < argc; i++)
@@ -207,8 +207,8 @@
 	rc = device_register(&gdev->dev);
 	
 	if (rc)
-		goto error;
-
+		goto free_dev;
+	get_device(&gdev->dev);
 	rc = device_create_file(&gdev->dev, &dev_attr_ungroup);
 
 	if (rc) {
@@ -217,20 +217,28 @@
 	}
 
 	rc = __ccwgroup_create_symlinks(gdev);
-	if (!rc)
+	if (!rc) {
+		put_device(&gdev->dev);
 		return 0;
-
+	}
 	device_remove_file(&gdev->dev, &dev_attr_ungroup);
 	device_unregister(&gdev->dev);
 error:
 	for (i = 0; i < argc; i++)
 		if (gdev->cdev[i]) {
 			put_device(&gdev->cdev[i]->dev);
+			gdev->cdev[i]->dev.driver_data = NULL;
+		}
+	put_device(&gdev->dev);
+	return rc;
+free_dev:
+	for (i = 0; i < argc; i++)
+		if (gdev->cdev[i]) {
+			put_device(&gdev->cdev[i]->dev);
 			if (del_drvdata)
 				gdev->cdev[i]->dev.driver_data = NULL;
 		}
 	kfree(gdev);
-
 	return rc;
 }
 
diff -Nru a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
--- a/drivers/s390/cio/chsc.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/cio/chsc.c	Tue Jun 15 22:20:41 2004
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/chsc.c
  *   S/390 common I/O routines -- channel subsystem call
- *   $Revision: 1.110 $
+ *   $Revision: 1.112 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -24,7 +24,6 @@
 #include "ioasm.h"
 #include "chsc.h"
 
-#define CHPID_LONGS (256 / (8 * sizeof(long))) /* 256 chpids */
 static struct channel_path *chps[NR_CHPIDS];
 
 static void *sei_page;
@@ -62,11 +61,11 @@
 	int state;
 
 	state = get_chp_status(chp);
-	if (state < 0)
-		new_channel_path(chp);
-	else
+	if (state < 0) {
+		need_rescan = 1;
+		queue_work(slow_path_wq, &slow_path_work);
+	} else
 		WARN_ON(!state);
-	/* FIXME: should notify other subchannels here */
 }
 
 /* FIXME: this is _always_ called for every subchannel. shouldn't we
@@ -285,8 +284,10 @@
 out_unreg:
 	spin_unlock(&sch->lock);
 	sch->lpm = 0;
-	/* We can't block here. */
-	device_call_nopath_notify(sch);
+	if (css_enqueue_subchannel_slow(sch->irq)) {
+		css_clear_subchannel_slow_list();
+		need_rescan = 1;
+	}
 	return 0;
 }
 
@@ -303,6 +304,9 @@
 
 	bus_for_each_dev(&css_bus_type, NULL, &chpid,
 			 s390_subchannel_remove_chpid);
+
+	if (need_rescan || css_slow_subchannels_exist())
+		queue_work(slow_path_wq, &slow_path_work);
 }
 
 static int
@@ -737,10 +741,12 @@
 			 * can successfully terminate, even using the
 			 * just varied off path. Then kill it.
 			 */
-			if (!__check_for_io_and_kill(sch, chp) && !sch->lpm)
-				/* Get over with it now. */
-				device_call_nopath_notify(sch);
-			else if (sch->driver && sch->driver->verify)
+			if (!__check_for_io_and_kill(sch, chp) && !sch->lpm) {
+				if (css_enqueue_subchannel_slow(sch->irq)) {
+					css_clear_subchannel_slow_list();
+					need_rescan = 1;
+				}
+			} else if (sch->driver && sch->driver->verify)
 				sch->driver->verify(&sch->dev);
 		}
 		break;
@@ -773,11 +779,6 @@
 	return 0;
 }
 
-extern void css_trigger_slow_path(void);
-typedef void (*workfunc)(void *);
-static DECLARE_WORK(varyonoff_work, (workfunc)css_trigger_slow_path,
-		    NULL);
-
 /*
  * Function: s390_vary_chpid
  * Varies the specified chpid online or offline
@@ -813,7 +814,7 @@
 			 s390_subchannel_vary_chpid_on :
 			 s390_subchannel_vary_chpid_off);
 	if (!on)
-		return 0;
+		goto out;
 	/* Scan for new devices on varied on path. */
 	for (irq = 0; irq < __MAX_SUBCHANNELS; irq++) {
 		struct schib schib;
@@ -835,8 +836,9 @@
 			need_rescan = 1;
 		}
 	}
+out:
 	if (need_rescan || css_slow_subchannels_exist())
-		schedule_work(&varyonoff_work);
+		queue_work(slow_path_wq, &slow_path_work);
 	return 0;
 }
 
diff -Nru a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h
--- a/drivers/s390/cio/chsc.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/cio/chsc.h	Tue Jun 15 22:20:43 2004
@@ -23,5 +23,4 @@
 extern void s390_process_css( void );
 extern void chsc_validate_chpids(struct subchannel *);
 extern void chpid_is_actually_online(int);
-extern int is_chpid_online(int);
 #endif
diff -Nru a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
--- a/drivers/s390/cio/cio.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/s390/cio/cio.c	Tue Jun 15 22:21:04 2004
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/cio.c
  *   S/390 common I/O routines -- low level i/o calls
- *   $Revision: 1.121 $
+ *   $Revision: 1.123 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -67,17 +67,17 @@
 	if (!cio_debug_msg_id)
 		goto out_unregister;
 	debug_register_view (cio_debug_msg_id, &debug_sprintf_view);
-	debug_set_level (cio_debug_msg_id, 6);
+	debug_set_level (cio_debug_msg_id, 2);
 	cio_debug_trace_id = debug_register ("cio_trace", 4, 4, 8);
 	if (!cio_debug_trace_id)
 		goto out_unregister;
 	debug_register_view (cio_debug_trace_id, &debug_hex_ascii_view);
-	debug_set_level (cio_debug_trace_id, 6);
+	debug_set_level (cio_debug_trace_id, 2);
 	cio_debug_crw_id = debug_register ("cio_crw", 2, 4, 16*sizeof (long));
 	if (!cio_debug_crw_id)
 		goto out_unregister;
 	debug_register_view (cio_debug_crw_id, &debug_sprintf_view);
-	debug_set_level (cio_debug_crw_id, 6);
+	debug_set_level (cio_debug_crw_id, 2);
 	pr_debug("debugging initialized\n");
 	return 0;
 
diff -Nru a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
--- a/drivers/s390/cio/css.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/s390/cio/css.c	Tue Jun 15 22:20:37 2004
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/css.c
  *  driver for channel subsystem
- *   $Revision: 1.73 $
+ *   $Revision: 1.77 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *			 IBM Corporation
@@ -166,10 +166,12 @@
 	if (sch && sch->schib.pmcw.dnv &&
 	    (schib.pmcw.dev != sch->schib.pmcw.dev))
 		return CIO_REVALIDATE;
+	if (sch && !sch->lpm)
+		return CIO_NO_PATH;
 	return CIO_OPER;
 }
 	
-static inline int
+static int
 css_evaluate_subchannel(int irq, int slow)
 {
 	int event, ret, disc;
@@ -188,7 +190,11 @@
 		return -EAGAIN; /* Will be done on the slow path. */
 	}
 	event = css_get_subchannel_status(sch, irq);
+	CIO_MSG_EVENT(4, "Evaluating schid %04x, event %d, %s, %s path.\n",
+		      irq, event, sch?(disc?"disconnected":"normal"):"unknown",
+		      slow?"slow":"fast");
 	switch (event) {
+	case CIO_NO_PATH:
 	case CIO_GONE:
 		if (!sch) {
 			/* Never used this subchannel. Ignore. */
@@ -196,7 +202,8 @@
 			break;
 		}
 		if (sch->driver && sch->driver->notify &&
-		    sch->driver->notify(&sch->dev, CIO_GONE)) {
+		    sch->driver->notify(&sch->dev, event)) {
+			cio_disable_subchannel(sch);
 			device_set_disconnected(sch);
 			ret = 0;
 			break;
@@ -205,6 +212,7 @@
 		 * Unregister subchannel.
 		 * The device will be killed automatically.
 		 */
+		cio_disable_subchannel(sch);
 		device_unregister(&sch->dev);
 		/* Reset intparm to zeroes. */
 		sch->schib.pmcw.intparm = 0;
@@ -218,12 +226,21 @@
 		 * We don't notify the driver since we have to throw the device
 		 * away in any case.
 		 */
-		device_unregister(&sch->dev);
-		/* Reset intparm to zeroes. */
-		sch->schib.pmcw.intparm = 0;
-		cio_modify(sch);
-		put_device(&sch->dev);
-		ret = css_probe_device(irq);
+		if (!disc) {
+			device_unregister(&sch->dev);
+			/* Reset intparm to zeroes. */
+			sch->schib.pmcw.intparm = 0;
+			cio_modify(sch);
+			put_device(&sch->dev);
+			ret = css_probe_device(irq);
+		} else {
+			/*
+			 * We can't immediately deregister the disconnected
+			 * device since it might block.
+			 */
+			device_trigger_reprobe(sch);
+			ret = 0;
+		}
 		break;
 	case CIO_OPER:
 		if (disc)
@@ -257,23 +274,44 @@
 	}
 }
 
-static void
-css_evaluate_slow_subchannel(unsigned long schid)
-{
-	css_evaluate_subchannel(schid, 1);
-}
+struct slow_subchannel {
+	struct list_head slow_list;
+	unsigned long schid;
+};
 
-void
+static LIST_HEAD(slow_subchannels_head);
+static spinlock_t slow_subchannel_lock = SPIN_LOCK_UNLOCKED;
+
+static void
 css_trigger_slow_path(void)
 {
+	CIO_TRACE_EVENT(4, "slowpath");
+
 	if (need_rescan) {
 		need_rescan = 0;
 		css_rescan_devices();
 		return;
 	}
-	css_walk_subchannel_slow_list(css_evaluate_slow_subchannel);
+
+	spin_lock_irq(&slow_subchannel_lock);
+	while (!list_empty(&slow_subchannels_head)) {
+		struct slow_subchannel *slow_sch =
+			list_entry(slow_subchannels_head.next,
+				   struct slow_subchannel, slow_list);
+
+		list_del_init(slow_subchannels_head.next);
+		spin_unlock_irq(&slow_subchannel_lock);
+		css_evaluate_subchannel(slow_sch->schid, 1);
+		spin_lock_irq(&slow_subchannel_lock);
+		kfree(slow_sch);
+	}
+	spin_unlock_irq(&slow_subchannel_lock);
 }
 
+typedef void (*workfunc)(void *);
+DECLARE_WORK(slow_path_work, (workfunc)css_trigger_slow_path, NULL);
+struct workqueue_struct *slow_path_wq;
+
 /*
  * Rescan for new devices. FIXME: This is slow.
  * This function is called when we have lost CRWs due to overflows and we have
@@ -434,14 +472,6 @@
 		device_unregister(dev);
 }
 
-struct slow_subchannel {
-	struct list_head slow_list;
-	unsigned long schid;
-};
-
-static LIST_HEAD(slow_subchannels_head);
-static spinlock_t slow_subchannel_lock = SPIN_LOCK_UNLOCKED;
-
 int
 css_enqueue_subchannel_slow(unsigned long schid)
 {
@@ -475,25 +505,7 @@
 	spin_unlock_irqrestore(&slow_subchannel_lock, flags);
 }
 
-void
-css_walk_subchannel_slow_list(void (*fn)(unsigned long))
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&slow_subchannel_lock, flags);
-	while (!list_empty(&slow_subchannels_head)) {
-		struct slow_subchannel *slow_sch =
-			list_entry(slow_subchannels_head.next,
-				   struct slow_subchannel, slow_list);
 
-		list_del_init(slow_subchannels_head.next);
-		spin_unlock_irqrestore(&slow_subchannel_lock, flags);
-		fn(slow_sch->schid);
-		spin_lock_irqsave(&slow_subchannel_lock, flags);
-		kfree(slow_sch);
-	}
-	spin_unlock_irqrestore(&slow_subchannel_lock, flags);
-}
 
 int
 css_slow_subchannels_exist(void)
diff -Nru a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h
--- a/drivers/s390/cio/css.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/s390/cio/css.h	Tue Jun 15 22:21:05 2004
@@ -136,7 +136,6 @@
 
 /* Helper functions for vary on/off. */
 void device_set_waiting(struct subchannel *);
-void device_call_nopath_notify(struct subchannel *);
 
 /* Helper functions to build lists for the slow path. */
 int css_enqueue_subchannel_slow(unsigned long schid);
@@ -144,4 +143,7 @@
 void css_clear_subchannel_slow_list(void);
 int css_slow_subchannels_exist(void);
 extern int need_rescan;
+
+extern struct workqueue_struct *slow_path_wq;
+extern struct work_struct slow_path_work;
 #endif
diff -Nru a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
--- a/drivers/s390/cio/device.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/cio/device.c	Tue Jun 15 22:20:43 2004
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/device.c
  *  bus driver for ccw devices
- *   $Revision: 1.115 $
+ *   $Revision: 1.120 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *			 IBM Corporation
@@ -26,6 +26,7 @@
 #include "cio.h"
 #include "css.h"
 #include "device.h"
+#include "ioasm.h"
 
 /******************* bus type handling ***********************/
 
@@ -158,6 +159,11 @@
 		ret = -ENOMEM; /* FIXME: better errno ? */
 		goto out_err;
 	}
+	slow_path_wq = create_singlethread_workqueue("kslowcrw");
+	if (!slow_path_wq) {
+		ret = -ENOMEM; /* FIXME: better errno ? */
+		goto out_err;
+	}
 	if ((ret = bus_register (&ccw_bus_type)))
 		goto out_err;
 
@@ -173,6 +179,8 @@
 		destroy_workqueue(ccw_device_work);
 	if (ccw_device_notify_work)
 		destroy_workqueue(ccw_device_notify_work);
+	if (slow_path_wq)
+		destroy_workqueue(slow_path_wq);
 	return ret;
 }
 
@@ -499,20 +507,94 @@
 	return ret;
 }
 
-void
-ccw_device_do_unreg_rereg(void *data)
+static struct ccw_device *
+get_disc_ccwdev_by_devno(unsigned int devno, struct ccw_device *sibling)
 {
+	struct ccw_device *cdev;
+	struct list_head *entry;
 	struct device *dev;
 
-	dev = (struct device *)data;
-	device_remove_files(dev);
-	device_del(dev);
-	if (device_add(dev)) {
+	if (!get_bus(&ccw_bus_type))
+		return NULL;
+	down_read(&ccw_bus_type.subsys.rwsem);
+	cdev = NULL;
+	list_for_each(entry, &ccw_bus_type.devices.list) {
+		dev = get_device(container_of(entry,
+					      struct device, bus_list));
+		if (!dev)
+			continue;
+		cdev = to_ccwdev(dev);
+		if ((cdev->private->state == DEV_STATE_DISCONNECTED) &&
+		    (cdev->private->devno == devno) &&
+		    (!strncmp(cdev->dev.bus_id, sibling->dev.bus_id,
+			      BUS_ID_SIZE))) {
+			cdev->private->state = DEV_STATE_NOT_OPER;
+			break;
+		}
 		put_device(dev);
+		cdev = NULL;
+	}
+	up_read(&ccw_bus_type.subsys.rwsem);
+	put_bus(&ccw_bus_type);
+
+	return cdev;
+}
+
+void
+ccw_device_do_unreg_rereg(void *data)
+{
+	struct ccw_device *cdev;
+	struct subchannel *sch;
+	int need_rename;
+
+	cdev = (struct ccw_device *)data;
+	sch = to_subchannel(cdev->dev.parent);
+	if (cdev->private->devno != sch->schib.pmcw.dev) {
+		/*
+		 * The device number has changed. This is usually only when
+		 * a device has been detached under VM and then re-appeared
+		 * on another subchannel because of a different attachment
+		 * order than before. Ideally, we should should just switch
+		 * subchannels, but unfortunately, this is not possible with
+		 * the current implementation.
+		 * Instead, we search for the old subchannel for this device
+		 * number and deregister so there are no collisions with the
+		 * newly registered ccw_device.
+		 * FIXME: Find another solution so the block layer doesn't
+		 *        get possibly sick...
+		 */
+		struct ccw_device *other_cdev;
+
+		need_rename = 1;
+		other_cdev = get_disc_ccwdev_by_devno(sch->schib.pmcw.dev,
+						      cdev);
+		if (other_cdev) {
+			struct subchannel *other_sch;
+
+			other_sch = to_subchannel(other_cdev->dev.parent);
+			if (get_device(&other_sch->dev)) {
+				stsch(other_sch->irq, &other_sch->schib);
+				if (other_sch->schib.pmcw.dnv) {
+					other_sch->schib.pmcw.intparm = 0;
+					cio_modify(other_sch);
+				}
+				device_unregister(&other_sch->dev);
+			}
+		}
+		cdev->private->devno = sch->schib.pmcw.dev;
+	} else
+		need_rename = 0;
+	device_remove_files(&cdev->dev);
+	device_del(&cdev->dev);
+	if (need_rename)
+		snprintf (cdev->dev.bus_id, BUS_ID_SIZE, "0.0.%04x",
+			  sch->schib.pmcw.dev);
+	if (device_add(&cdev->dev)) {
+		put_device(&cdev->dev);
 		return;
 	}
-	if (device_add_files(dev))
-		device_unregister(dev);
+	if (device_add_files(&cdev->dev))
+		device_unregister(&cdev->dev);
 }
 
 static void
@@ -572,9 +654,7 @@
 	struct subchannel *sch;
 
 	sch = to_subchannel(cdev->dev.parent);
-	/* Check if device is registered. */
-	if (!list_empty(&sch->dev.node))
-		device_unregister(&sch->dev);
+	device_unregister(&sch->dev);
 	/* Reset intparm to zeroes. */
 	sch->schib.pmcw.intparm = 0;
 	cio_modify(sch);
@@ -603,7 +683,7 @@
 		sch = to_subchannel(cdev->dev.parent);
 		INIT_WORK(&cdev->private->kick_work,
 			  ccw_device_call_sch_unregister, (void *) cdev);
-		queue_work(ccw_device_work, &cdev->private->kick_work);
+		queue_work(slow_path_wq, &cdev->private->kick_work);
 		break;
 	case DEV_STATE_BOXED:
 		/* Device did not respond in time. */
diff -Nru a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
--- a/drivers/s390/cio/device_fsm.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/s390/cio/device_fsm.c	Tue Jun 15 22:20:40 2004
@@ -152,14 +152,15 @@
 	/*
 	 * Check if cu type and device type still match. If
 	 * not, it is certainly another device and we have to
-	 * de- and re-register.
+	 * de- and re-register. Also check here for non-matching devno.
 	 */
 	if (cdev->id.cu_type != cdev->private->senseid.cu_type ||
 	    cdev->id.cu_model != cdev->private->senseid.cu_model ||
 	    cdev->id.dev_type != cdev->private->senseid.dev_type ||
-	    cdev->id.dev_model != cdev->private->senseid.dev_model) {
+	    cdev->id.dev_model != cdev->private->senseid.dev_model ||
+	    cdev->private->devno != sch->schib.pmcw.dev) {
 		PREPARE_WORK(&cdev->private->kick_work,
-			     ccw_device_do_unreg_rereg, (void *)&cdev->dev);
+			     ccw_device_do_unreg_rereg, (void *)cdev);
 		queue_work(ccw_device_work, &cdev->private->kick_work);
 		return;
 	}
@@ -295,7 +296,7 @@
 		sch->driver->notify(&sch->dev, CIO_OPER) : 0;
 	if (!ret)
 		/* Driver doesn't want device back. */
-		ccw_device_do_unreg_rereg((void *)&cdev->dev);
+		ccw_device_do_unreg_rereg((void *)cdev);
 	else
 		wake_up(&cdev->private->wait_q);
 }
@@ -458,24 +459,12 @@
 }
 
 void
-device_call_nopath_notify(struct subchannel *sch)
-{
-	struct ccw_device *cdev;
-
-	if (!sch->dev.driver_data)
-		return;
-	cdev = sch->dev.driver_data;
-	PREPARE_WORK(&cdev->private->kick_work,
-		     ccw_device_nopath_notify, (void *)cdev);
-	queue_work(ccw_device_notify_work, &cdev->private->kick_work);
-}
-
-
-void
 ccw_device_verify_done(struct ccw_device *cdev, int err)
 {
 	cdev->private->flags.doverify = 0;
 	switch (err) {
+	case -EOPNOTSUPP: /* path grouping not supported, just set online. */
+		cdev->private->options.pgroup = 0;
 	case 0:
 		ccw_device_done(cdev, DEV_STATE_ONLINE);
 		break;
@@ -1082,103 +1071,103 @@
  * device statemachine
  */
 fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = {
-	[DEV_STATE_NOT_OPER] {
-		[DEV_EVENT_NOTOPER]	ccw_device_nop,
-		[DEV_EVENT_INTERRUPT]	ccw_device_bug,
-		[DEV_EVENT_TIMEOUT]	ccw_device_nop,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_SENSE_PGID] {
-		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_sense_pgid_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_onoff_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_SENSE_ID] {
-		[DEV_EVENT_NOTOPER]	ccw_device_recog_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_sense_id_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_recog_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_OFFLINE] {
-		[DEV_EVENT_NOTOPER]	ccw_device_offline_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_offline_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_nop,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_VERIFY] {
-		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_verify_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_onoff_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_ONLINE] {
-		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_online_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_online_verify,
-	},
-	[DEV_STATE_W4SENSE] {
-		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_w4sense,
-		[DEV_EVENT_TIMEOUT]	ccw_device_nop,
-		[DEV_EVENT_VERIFY]	ccw_device_online_verify,
-	},
-	[DEV_STATE_DISBAND_PGID] {
-		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_disband_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_onoff_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_BOXED] {
-		[DEV_EVENT_NOTOPER]	ccw_device_offline_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_stlck_done,
-		[DEV_EVENT_TIMEOUT]	ccw_device_stlck_done,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
+	[DEV_STATE_NOT_OPER] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_nop,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_bug,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_nop,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_SENSE_PGID] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_online_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_sense_pgid_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_onoff_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_SENSE_ID] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_recog_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_sense_id_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_recog_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_OFFLINE] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_offline_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_offline_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_nop,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_VERIFY] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_online_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_verify_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_onoff_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_ONLINE] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_online_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_online_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_online_verify,
+	},
+	[DEV_STATE_W4SENSE] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_online_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_w4sense,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_nop,
+		[DEV_EVENT_VERIFY]	= ccw_device_online_verify,
+	},
+	[DEV_STATE_DISBAND_PGID] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_online_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_disband_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_onoff_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_BOXED] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_offline_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_stlck_done,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_stlck_done,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
 	},
 	/* states to wait for i/o completion before doing something */
-	[DEV_STATE_CLEAR_VERIFY] {
-		[DEV_EVENT_NOTOPER]     ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]   ccw_device_clear_verify,
-		[DEV_EVENT_TIMEOUT]	ccw_device_nop,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_TIMEOUT_KILL] {
-		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_killing_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_killing_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_nop, //FIXME
-	},
-	[DEV_STATE_WAIT4IO] {
-		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_wait4io_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_wait4io_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_wait4io_verify,
-	},
-	[DEV_STATE_QUIESCE] {
-		[DEV_EVENT_NOTOPER]	ccw_device_quiesce_done,
-		[DEV_EVENT_INTERRUPT]	ccw_device_quiesce_done,
-		[DEV_EVENT_TIMEOUT]	ccw_device_quiesce_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
+	[DEV_STATE_CLEAR_VERIFY] = {
+		[DEV_EVENT_NOTOPER]     = ccw_device_online_notoper,
+		[DEV_EVENT_INTERRUPT]   = ccw_device_clear_verify,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_nop,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_TIMEOUT_KILL] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_online_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_killing_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_killing_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop, //FIXME
+	},
+	[DEV_STATE_WAIT4IO] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_online_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_wait4io_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_wait4io_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_wait4io_verify,
+	},
+	[DEV_STATE_QUIESCE] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_quiesce_done,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_quiesce_done,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_quiesce_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
 	},
 	/* special states for devices gone not operational */
-	[DEV_STATE_DISCONNECTED] {
-		[DEV_EVENT_NOTOPER]	ccw_device_nop,
-		[DEV_EVENT_INTERRUPT]	ccw_device_start_id,
-		[DEV_EVENT_TIMEOUT]	ccw_device_bug,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_DISCONNECTED_SENSE_ID] {
-		[DEV_EVENT_NOTOPER]	ccw_device_recog_notoper,
-		[DEV_EVENT_INTERRUPT]	ccw_device_sense_id_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_recog_timeout,
-		[DEV_EVENT_VERIFY]	ccw_device_nop,
-	},
-	[DEV_STATE_CMFCHANGE] {
-		[DEV_EVENT_NOTOPER]	ccw_device_change_cmfstate,
-		[DEV_EVENT_INTERRUPT]	ccw_device_change_cmfstate,
-		[DEV_EVENT_TIMEOUT]	ccw_device_change_cmfstate,
-		[DEV_EVENT_VERIFY]	ccw_device_change_cmfstate,
+	[DEV_STATE_DISCONNECTED] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_nop,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_start_id,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_bug,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_DISCONNECTED_SENSE_ID] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_recog_notoper,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_sense_id_irq,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_recog_timeout,
+		[DEV_EVENT_VERIFY]	= ccw_device_nop,
+	},
+	[DEV_STATE_CMFCHANGE] = {
+		[DEV_EVENT_NOTOPER]	= ccw_device_change_cmfstate,
+		[DEV_EVENT_INTERRUPT]	= ccw_device_change_cmfstate,
+		[DEV_EVENT_TIMEOUT]	= ccw_device_change_cmfstate,
+		[DEV_EVENT_VERIFY]	= ccw_device_change_cmfstate,
 	},
 };
 
diff -Nru a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
--- a/drivers/s390/cio/device_pgid.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/cio/device_pgid.c	Tue Jun 15 22:20:41 2004
@@ -338,6 +338,10 @@
 		 * One of those strange devices which claim to be able
 		 * to do multipathing but not for Set Path Group ID.
 		 */
+		if (cdev->private->flags.pgid_single) {
+			ccw_device_verify_done(cdev, -EOPNOTSUPP);
+			break;
+		}
 		cdev->private->flags.pgid_single = 1;
 		/* fall through. */
 	case -EAGAIN:		/* Try again. */
diff -Nru a/drivers/s390/cio/requestirq.c b/drivers/s390/cio/requestirq.c
--- a/drivers/s390/cio/requestirq.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/cio/requestirq.c	Tue Jun 15 22:20:43 2004
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/requestirq.c
  *   S/390 common I/O routines -- enabling and disabling of devices
- *   $Revision: 1.45 $
+ *   $Revision: 1.46 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -17,21 +17,6 @@
 #include <asm/lowcore.h>
 
 #include "css.h"
-
-/* for compatiblity only... */
-int
-request_irq (unsigned int irq,
-	     void (*handler) (int, void *, struct pt_regs *),
-	     unsigned long irqflags, const char *devname, void *dev_id)
-{
-	return -EINVAL;
-}
-
-/* for compatiblity only... */
-void
-free_irq (unsigned int irq, void *dev_id)
-{
-}
 
 struct pgid global_pgid;
 EXPORT_SYMBOL_GPL(global_pgid);
diff -Nru a/drivers/s390/crypto/z90crypt.h b/drivers/s390/crypto/z90crypt.h
--- a/drivers/s390/crypto/z90crypt.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/s390/crypto/z90crypt.h	Tue Jun 15 22:20:38 2004
@@ -46,12 +46,12 @@
  * - length(n_modulus) = inputdatalength
  */
 struct ica_rsa_modexpo {
-	char *		inputdata;
+	char __user *	inputdata;
 	unsigned int	inputdatalength;
-	char *		outputdata;
+	char __user *	outputdata;
 	unsigned int	outputdatalength;
-	char *		b_key;
-	char *		n_modulus;
+	char __user *	b_key;
+	char __user *	n_modulus;
 };
 
 /**
@@ -69,15 +69,15 @@
  * - length(u_mult_inv) = inputdatalength/2 + 8
  */
 struct ica_rsa_modexpo_crt {
-	char *		inputdata;
+	char __user *	inputdata;
 	unsigned int	inputdatalength;
-	char *		outputdata;
+	char __user *	outputdata;
 	unsigned int	outputdatalength;
-	char *		bp_key;
-	char *		bq_key;
-	char *		np_prime;
-	char *		nq_prime;
-	char *		u_mult_inv;
+	char __user *	bp_key;
+	char __user *	bq_key;
+	char __user *	np_prime;
+	char __user *	nq_prime;
+	char __user *	u_mult_inv;
 };
 
 #define Z90_IOCTL_MAGIC 'z'  // NOTE:  Need to allocate from linux folks
diff -Nru a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c
--- a/drivers/s390/crypto/z90main.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/s390/crypto/z90main.c	Tue Jun 15 22:20:36 2004
@@ -361,7 +361,7 @@
 	int		  buff_size;	  // size of the buffer for the request
 	char		  resp_buff[RESPBUFFSIZE];
 	int		  resp_buff_size;
-	char *		  resp_addr;	  // address of response in user space
+	char __user *	  resp_addr;	  // address of response in user space
 	unsigned int	  funccode;	  // function code of request
 	wait_queue_head_t waitq;
 	unsigned long	  requestsent;	  // time at which the request was sent
@@ -378,8 +378,9 @@
  */
 static int z90crypt_open(struct inode *, struct file *);
 static int z90crypt_release(struct inode *, struct file *);
-static ssize_t z90crypt_read(struct file *, char *, size_t, loff_t *);
-static ssize_t z90crypt_write(struct file *, const char *, size_t, loff_t *);
+static ssize_t z90crypt_read(struct file *, char __user *, size_t, loff_t *);
+static ssize_t z90crypt_write(struct file *, const char __user *,
+							size_t, loff_t *);
 static int z90crypt_ioctl(struct inode *, struct file *,
 			  unsigned int, unsigned long);
 
@@ -389,7 +390,7 @@
 static void z90crypt_cleanup_task(unsigned long);
 
 static int z90crypt_status(char *, char **, off_t, int, int *, void *);
-static int z90crypt_status_write(struct file *, const char *,
+static int z90crypt_status_write(struct file *, const char __user *,
 				 unsigned long, void *);
 
 /**
@@ -473,9 +474,9 @@
 trans_modexpo32(unsigned int fd, unsigned int cmd, unsigned long arg,
 		struct file *file)
 {
-	struct ica_rsa_modexpo_32 *mex32u = compat_ptr(arg);
+	struct ica_rsa_modexpo_32 __user *mex32u = compat_ptr(arg);
 	struct ica_rsa_modexpo_32  mex32k;
-	struct ica_rsa_modexpo    *mex64;
+	struct ica_rsa_modexpo __user *mex64;
 	int ret = 0;
 	unsigned int i;
 
@@ -517,9 +518,9 @@
 trans_modexpo_crt32(unsigned int fd, unsigned int cmd, unsigned long arg,
 		    struct file *file)
 {
-	struct ica_rsa_modexpo_crt_32 *crt32u = compat_ptr(arg);
+	struct ica_rsa_modexpo_crt_32 __user *crt32u = compat_ptr(arg);
 	struct ica_rsa_modexpo_crt_32  crt32k;
-	struct ica_rsa_modexpo_crt    *crt64;
+	struct ica_rsa_modexpo_crt __user *crt64;
 	int ret = 0;
 	unsigned int i;
 
@@ -841,7 +842,7 @@
  * z90crypt_read will not be supported beyond z90crypt 1.3.1
  */
 static ssize_t
-z90crypt_read(struct file *filp, char *buf, size_t count, loff_t *f_pos)
+z90crypt_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
 {
 	PDEBUG("filp %p (PID %d)\n", filp, PID());
 	return -EPERM;
@@ -854,7 +855,7 @@
  */
 #include <linux/random.h>
 static ssize_t
-z90crypt_read(struct file *filp, char *buf, size_t count, loff_t *f_pos)
+z90crypt_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
 {
 	unsigned char *temp_buff;
 
@@ -892,7 +893,7 @@
  * Write is is not allowed
  */
 static ssize_t
-z90crypt_write(struct file *filp, const char *buf, size_t count, loff_t *f_pos)
+z90crypt_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos)
 {
 	PDEBUG("filp %p (PID %d)\n", filp, PID());
 	return -EPERM;
@@ -1258,7 +1259,7 @@
  * process_results copies the user's work from kernel space.
  */
 static inline int
-z90crypt_process_results(struct work_element *we_p, char *buf)
+z90crypt_process_results(struct work_element *we_p, char __user *buf)
 {
 	int rv;
 
@@ -1556,7 +1557,7 @@
 
 static inline int
 z90crypt_prepare(struct work_element *we_p, unsigned int funccode,
-		 const char *buffer)
+		 const char __user *buffer)
 {
 	int rv;
 
@@ -1641,7 +1642,7 @@
 		PDEBUG("PID %d: allocate_work_element returned ENOMEM\n", pid);
 		return rv;
 	}
-	if ((rv = z90crypt_prepare(we_p, cmd, (const char *)arg)))
+	if ((rv = z90crypt_prepare(we_p, cmd, (const char __user *)arg)))
 		PDEBUG("PID %d: rv = %d from z90crypt_prepare\n", pid, rv);
 	if (!rv)
 		if ((rv = z90crypt_send(we_p, (const char *)arg)))
@@ -1653,7 +1654,7 @@
 		rv = we_p->retcode;
 	}
 	if (!rv)
-		rv = z90crypt_process_results(we_p, (char *)arg);
+		rv = z90crypt_process_results(we_p, (char __user *)arg);
 
 	if ((we_p->status[0] & STAT_FAILED)) {
 		switch (rv) {
@@ -1748,49 +1749,49 @@
 
 	case Z90STAT_TOTALCOUNT:
 		tempstat = get_status_totalcount();
-		if (copy_to_user((int *)arg, &tempstat,sizeof(int)) != 0)
+		if (copy_to_user((int __user *)arg, &tempstat,sizeof(int)) != 0)
 			ret = -EFAULT;
 		break;
 
 	case Z90STAT_PCICACOUNT:
 		tempstat = get_status_PCICAcount();
-		if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+		if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
 			ret = -EFAULT;
 		break;
 
 	case Z90STAT_PCICCCOUNT:
 		tempstat = get_status_PCICCcount();
-		if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+		if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
 			ret = -EFAULT;
 		break;
 
 	case Z90STAT_PCIXCCCOUNT:
 		tempstat = get_status_PCIXCCcount();
-		if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+		if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
 			ret = -EFAULT;
 		break;
 
 	case Z90STAT_REQUESTQ_COUNT:
 		tempstat = get_status_requestq_count();
-		if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+		if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
 			ret = -EFAULT;
 		break;
 
 	case Z90STAT_PENDINGQ_COUNT:
 		tempstat = get_status_pendingq_count();
-		if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+		if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
 			ret = -EFAULT;
 		break;
 
 	case Z90STAT_TOTALOPEN_COUNT:
 		tempstat = get_status_totalopen_count();
-		if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+		if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
 			ret = -EFAULT;
 		break;
 
 	case Z90STAT_DOMAIN_INDEX:
 		tempstat = get_status_domain_index();
-		if (copy_to_user((int *)arg, &tempstat, sizeof(int)) != 0)
+		if (copy_to_user((int __user *)arg, &tempstat, sizeof(int)) != 0)
 			ret = -EFAULT;
 		break;
 
@@ -1802,7 +1803,8 @@
 			break;
 		}
 		get_status_status_mask(status);
-		if (copy_to_user((char *) arg, status, Z90CRYPT_NUM_APS) != 0)
+		if (copy_to_user((char __user *) arg, status, Z90CRYPT_NUM_APS)
+									!= 0)
 			ret = -EFAULT;
 		kfree(status);
 		break;
@@ -1815,7 +1817,7 @@
 			break;
 		}
 		get_status_qdepth_mask(qdepth);
-		if (copy_to_user((char *) arg, qdepth, Z90CRYPT_NUM_APS) != 0)
+		if (copy_to_user((char __user *) arg, qdepth, Z90CRYPT_NUM_APS) != 0)
 			ret = -EFAULT;
 		kfree(qdepth);
 		break;
@@ -1828,7 +1830,7 @@
 			break;
 		}
 		get_status_perdevice_reqcnt(reqcnt);
-		if (copy_to_user((char *) arg, reqcnt,
+		if (copy_to_user((char __user *) arg, reqcnt,
 				 Z90CRYPT_NUM_APS * sizeof(int)) != 0)
 			ret = -EFAULT;
 		kfree(reqcnt);
@@ -1861,7 +1863,7 @@
 		get_status_status_mask(pstat->status);
 		get_status_qdepth_mask(pstat->qdepth);
 
-		if (copy_to_user((struct ica_z90_status *) arg, pstat,
+		if (copy_to_user((struct ica_z90_status __user *) arg, pstat,
 				 sizeof(struct ica_z90_status)) != 0)
 			ret = -EFAULT;
 		kfree(pstat);
@@ -2104,7 +2106,7 @@
 }
 
 static int
-z90crypt_status_write(struct file *file, const char *buffer,
+z90crypt_status_write(struct file *file, const char __user *buffer,
 		      unsigned long count, void *data)
 {
 	int i, j, len, offs, found, eof;
@@ -2209,7 +2211,7 @@
  */
 static inline int
 receive_from_crypto_device(int index, unsigned char *psmid, int *buff_len_p,
-			   unsigned char *buff, unsigned char **dest_p_p)
+			   unsigned char *buff, unsigned char __user **dest_p_p)
 {
 	int dv, rv;
 	struct device *dev_ptr;
@@ -2397,7 +2399,7 @@
 static inline void
 helper_handle_work_element(int index, unsigned char psmid[8], int rc,
 			   int buff_len, unsigned char *buff,
-			   unsigned char *resp_addr)
+			   unsigned char __user *resp_addr)
 {
 	struct work_element *pq_p;
 	struct list_head *lptr, *tptr;
@@ -2502,7 +2504,8 @@
 z90crypt_reader_task(unsigned long ptr)
 {
 	int workavail, remaining, index, rc, buff_len;
-	unsigned char	psmid[8], *resp_addr;
+	unsigned char	psmid[8];
+	unsigned char __user *resp_addr;
 	static unsigned char buff[1024];
 
 	PDEBUG("jiffies %ld\n", jiffies);
diff -Nru a/drivers/s390/net/ctctty.c b/drivers/s390/net/ctctty.c
--- a/drivers/s390/net/ctctty.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/net/ctctty.c	Tue Jun 15 22:20:41 2004
@@ -515,7 +515,8 @@
 		}
 		skb_reserve(skb, skb_res);
 		if (from_user)
-			copy_from_user(skb_put(skb, c), buf, c);
+			copy_from_user(skb_put(skb, c),
+					(const u_char __user *)buf, c);
 		else
 			memcpy(skb_put(skb, c), buf, c);
 		skb_queue_tail(&info->tx_queue, skb);
@@ -640,7 +641,7 @@
  *          allows RS485 driver to be written in user space.
  */
 static int
-ctc_tty_get_lsr_info(ctc_tty_info * info, uint * value)
+ctc_tty_get_lsr_info(ctc_tty_info * info, uint __user *value)
 {
 	u_char status;
 	uint result;
@@ -650,7 +651,7 @@
 	status = info->lsr;
 	spin_unlock_irqrestore(&ctc_tty_lock, flags);
 	result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0);
-	put_user(result, (uint *) value);
+	put_user(result, value);
 	return 0;
 }
 
@@ -743,14 +744,14 @@
 			printk(KERN_DEBUG "%s%d ioctl TIOCGSOFTCAR\n", CTC_TTY_NAME,
 			       info->line);
 #endif
-			error = put_user(C_CLOCAL(tty) ? 1 : 0, (ulong *) arg);
+			error = put_user(C_CLOCAL(tty) ? 1 : 0, (ulong __user *) arg);
 			return error;
 		case TIOCSSOFTCAR:
 #ifdef CTC_DEBUG_MODEM_IOCTL
 			printk(KERN_DEBUG "%s%d ioctl TIOCSSOFTCAR\n", CTC_TTY_NAME,
 			       info->line);
 #endif
-			error = get_user(arg, (ulong *) arg);
+			error = get_user(arg, (ulong __user *) arg);
 			if (error)
 				return error;
 			tty->termios->c_cflag =
@@ -762,11 +763,11 @@
 			printk(KERN_DEBUG "%s%d ioctl TIOCSERGETLSR\n", CTC_TTY_NAME,
 			       info->line);
 #endif
-			error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(uint));
+			error = verify_area(VERIFY_WRITE, (void __user *) arg, sizeof(uint));
 			if (error)
 				return error;
 			else
-				return ctc_tty_get_lsr_info(info, (uint *) arg);
+				return ctc_tty_get_lsr_info(info, (uint __user *) arg);
 		default:
 #ifdef CTC_DEBUG_MODEM_IOCTL
 			printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on %s%d\n", cmd,
diff -Nru a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c
--- a/drivers/s390/net/iucv.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/s390/net/iucv.c	Tue Jun 15 22:20:36 2004
@@ -1,5 +1,5 @@
 /* 
- * $Id: iucv.c,v 1.28 2004/04/15 06:34:58 braunu Exp $
+ * $Id: iucv.c,v 1.33 2004/05/24 10:19:18 braunu Exp $
  *
  * IUCV network driver
  *
@@ -29,7 +29,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.28 $
+ * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.33 $
  *
  */
 
@@ -98,7 +98,7 @@
 	__u8  res3[24];
 } iucv_GeneralInterrupt;
 
-static iucv_GeneralInterrupt *iucv_external_int_buffer;
+static iucv_GeneralInterrupt *iucv_external_int_buffer = NULL;
 
 /* Spin Lock declaration */
 
@@ -285,6 +285,7 @@
 		iparml_set_mask p_set_mask;
 	} param;
 	atomic_t in_use;
+	__u32    res;
 }  __attribute__ ((aligned(8))) iucv_param;
 #define PARAM_POOL_SIZE (PAGE_SIZE / sizeof(iucv_param))
 
@@ -351,7 +352,7 @@
 static void
 iucv_banner(void)
 {
-	char vbuf[] = "$Revision: 1.28 $";
+	char vbuf[] = "$Revision: 1.33 $";
 	char *version = vbuf;
 
 	if ((version = strchr(version, ':'))) {
@@ -403,6 +404,7 @@
 		       "%s: Could not allocate external interrupt buffer\n",
 		       __FUNCTION__);
 		s390_root_dev_unregister(iucv_root);
+		bus_unregister(&iucv_bus);
 		return -ENOMEM;
 	}
 	memset(iucv_external_int_buffer, 0, sizeof(iucv_GeneralInterrupt));
@@ -416,6 +418,7 @@
 		kfree(iucv_external_int_buffer);
 		iucv_external_int_buffer = NULL;
 		s390_root_dev_unregister(iucv_root);
+		bus_unregister(&iucv_bus);
 		return -ENOMEM;
 	}
 	memset(iucv_param_pool, 0, sizeof(iucv_param) * PARAM_POOL_SIZE);
@@ -441,10 +444,14 @@
 iucv_exit(void)
 {
 	iucv_retrieve_buffer();
-      	if (iucv_external_int_buffer)
+      	if (iucv_external_int_buffer) {
 		kfree(iucv_external_int_buffer);
-	if (iucv_param_pool)
+		iucv_external_int_buffer = NULL;
+	}
+	if (iucv_param_pool) {
 		kfree(iucv_param_pool);
+		iucv_param_pool = NULL;
+	}
 	s390_root_dev_unregister(iucv_root);
 	bus_unregister(&iucv_bus);
 	printk(KERN_INFO "IUCV lowlevel driver unloaded\n");
@@ -463,17 +470,19 @@
 static __inline__ iucv_param *
 grab_param(void)
 {
-	iucv_param *ret;
-	static int i = 0;
+	iucv_param *ptr;
+        static int hint = 0;
+
+	ptr = iucv_param_pool + hint;
+	do {
+		ptr++;
+		if (ptr >= iucv_param_pool + PARAM_POOL_SIZE)
+			ptr = iucv_param_pool;
+	} while (atomic_compare_and_swap(0, 1, &ptr->in_use));
+	hint = ptr - iucv_param_pool;
 
-	while (atomic_compare_and_swap(0, 1, &iucv_param_pool[i].in_use)) {
-		i++;
-		if (i >= PARAM_POOL_SIZE)
-			i = 0;
-	}
-	ret = &iucv_param_pool[i];
-	memset(&ret->param, 0, sizeof(ret->param));
-	return ret;
+	memset(&ptr->param, 0, sizeof(ptr->param));
+	return ptr;
 }
 
 /**
@@ -2359,7 +2368,8 @@
 					iucv_debug(2,
 						   "found a matching handler");
 					break;
-				}
+				} else
+					h = NULL;
 			}
 			spin_unlock_irqrestore (&iucv_lock, flags);
 			if (h) {
diff -Nru a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
--- a/drivers/s390/net/lcs.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/s390/net/lcs.c	Tue Jun 15 22:20:37 2004
@@ -11,7 +11,7 @@
  *			  Frank Pavlic (pavlic@de.ibm.com) and
  *		 	  Martin Schwidefsky <schwidefsky@de.ibm.com>
  *
- *    $Revision: 1.74 $	 $Date: 2004/04/05 00:01:04 $
+ *    $Revision: 1.81 $	 $Date: 2004/05/14 13:54:33 $
  *
  * 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
@@ -58,7 +58,7 @@
 /**
  * initialization string for output
  */
-#define VERSION_LCS_C  "$Revision: 1.74 $"
+#define VERSION_LCS_C  "$Revision: 1.81 $"
 
 static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")";
 static char debug_buffer[255];
@@ -99,9 +99,9 @@
 		return -ENOMEM;
 	}
 	debug_register_view(lcs_dbf_setup, &debug_hex_ascii_view);
-	debug_set_level(lcs_dbf_setup, 5);
+	debug_set_level(lcs_dbf_setup, 2);
 	debug_register_view(lcs_dbf_trace, &debug_hex_ascii_view);
-	debug_set_level(lcs_dbf_trace, 5);
+	debug_set_level(lcs_dbf_trace, 2);
 	return 0;
 }
 
@@ -338,6 +338,7 @@
 		  (void *)lcs_start_kernel_thread,card);
 	card->thread_mask = 0;
 	spin_lock_init(&card->lock);
+	spin_lock_init(&card->ipm_lock);
 #ifdef CONFIG_IP_MULTICAST
 	INIT_LIST_HEAD(&card->ipm_list);
 #endif
@@ -935,18 +936,14 @@
 /**
  * set or del multicast address on LCS card
  */
-static int
-lcs_fix_multicast_list(void *data)
+static void
+lcs_fix_multicast_list(struct lcs_card *card)
 {
 	struct list_head *l, *n;
 	struct lcs_ipm_list *ipm;
-	struct lcs_card *card;
 
-	card = (struct lcs_card *) data;
-
-	daemonize("fixipm");
 	LCS_DBF_TEXT(4,trace, "fixipm");
-	spin_lock(&card->lock);
+	spin_lock(&card->ipm_lock);
 	list_for_each_safe(l, n, &card->ipm_list) {
 		ipm = list_entry(l, struct lcs_ipm_list, list);
 		switch (ipm->ipm_state) {
@@ -968,8 +965,7 @@
 	}
 	if (card->state == DEV_STATE_UP)
 		netif_wake_queue(card->dev);
-	spin_unlock(&card->lock);
-	return 0;
+	spin_unlock(&card->ipm_lock);
 }
 
 /**
@@ -988,28 +984,30 @@
 /**
  * function called by net device to handle multicast address relevant things
  */
-static void
-lcs_set_multicast_list(struct net_device *dev)
+static int
+lcs_register_mc_addresses(void *data)
 {
+	struct lcs_card *card;
 	char buf[MAX_ADDR_LEN];
 	struct list_head *l;
 	struct ip_mc_list *im4;
 	struct in_device *in4_dev;
 	struct lcs_ipm_list *ipm, *tmp;
-	struct lcs_card *card;
 
-	LCS_DBF_TEXT(4, trace, "setmulti");
-	in4_dev = in_dev_get(dev);
+	daemonize("regipm");
+	LCS_DBF_TEXT(4, trace, "regmulti");
+
+	card = (struct lcs_card *) data;
+	in4_dev = in_dev_get(card->dev);
 	if (in4_dev == NULL)
-		return;
+		return 0;
 	read_lock(&in4_dev->lock);
-	card = (struct lcs_card *) dev->priv;
-	spin_lock(&card->lock);
+	spin_lock(&card->ipm_lock);
 	/* Check for multicast addresses to be removed. */
 	list_for_each(l, &card->ipm_list) {
 		ipm = list_entry(l, struct lcs_ipm_list, list);
 		for (im4 = in4_dev->mc_list; im4 != NULL; im4 = im4->next) {
-			lcs_get_mac_for_ipm(im4->multiaddr, buf, dev);
+			lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev);
 			if (memcmp(buf, &ipm->ipm.mac_addr,
 				   LCS_MAC_LENGTH) == 0 &&
 			    ipm->ipm.ip_addr == im4->multiaddr)
@@ -1020,7 +1018,7 @@
 	}
 	/* Check for multicast addresses to be added. */
 	for (im4 = in4_dev->mc_list; im4; im4 = im4->next) {
-		lcs_get_mac_for_ipm(im4->multiaddr, buf, dev);
+		lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev);
 		ipm = NULL;
 		list_for_each(l, &card->ipm_list) {
 			tmp = list_entry(l, struct lcs_ipm_list, list);
@@ -1046,14 +1044,56 @@
 		ipm->ipm_state = LCS_IPM_STATE_SET_REQUIRED;
 		list_add(&ipm->list, &card->ipm_list);
 	}
-	spin_unlock(&card->lock);
+	spin_unlock(&card->ipm_lock);
 	read_unlock(&in4_dev->lock);
-	set_bit(3, &card->thread_mask);
-	schedule_work(&card->kernel_thread_starter);
+	lcs_fix_multicast_list(card);
+	in_dev_put(in4_dev);
+	return 0;
+}
+/**
+ * function called by net device to
+ * handle multicast address relevant things
+ */
+static void
+lcs_set_multicast_list(struct net_device *dev)
+{
+        struct lcs_card *card;
+
+        LCS_DBF_TEXT(4, trace, "setmulti");
+        card = (struct lcs_card *) dev->priv;
+        set_bit(3, &card->thread_mask);
+        schedule_work(&card->kernel_thread_starter);
 }
 
 #endif /* CONFIG_IP_MULTICAST */
 
+static long
+lcs_check_irb_error(struct ccw_device *cdev, struct irb *irb)
+{
+	if (!IS_ERR(irb))
+		return 0;
+
+	switch (PTR_ERR(irb)) {
+	case -EIO:
+		PRINT_WARN("i/o-error on device %s\n", cdev->dev.bus_id);
+		LCS_DBF_TEXT(2, trace, "ckirberr");
+		LCS_DBF_TEXT_(2, trace, "  rc%d", -EIO);
+		break;
+	case -ETIMEDOUT:
+		PRINT_WARN("timeout on device %s\n", cdev->dev.bus_id);
+		LCS_DBF_TEXT(2, trace, "ckirberr");
+		LCS_DBF_TEXT_(2, trace, "  rc%d", -ETIMEDOUT);
+		break;
+	default:
+		PRINT_WARN("unknown error %ld on device %s\n", PTR_ERR(irb),
+			   cdev->dev.bus_id);
+		LCS_DBF_TEXT(2, trace, "ckirberr");
+		LCS_DBF_TEXT(2, trace, "  rc???");
+	}
+	return PTR_ERR(irb);
+}
+
+
 /**
  * IRQ Handler for LCS channels
  */
@@ -1064,6 +1104,9 @@
 	struct lcs_channel *channel;
 	int index;
 
+	if (lcs_check_irb_error(cdev, irb))
+		return;
+
 	card = CARD_FROM_DEV(cdev);
 	if (card->read.ccwdev == cdev)
 		channel = &card->read;
@@ -1513,7 +1556,7 @@
 		kernel_thread(lcs_lgw_stoplan_thread, (void *) card, SIGCHLD);
 #ifdef CONFIG_IP_MULTICAST
 	if (test_and_clear_bit(3, &card->thread_mask))
-		kernel_thread(lcs_fix_multicast_list, (void *) card, SIGCHLD);
+		kernel_thread(lcs_register_mc_addresses, (void *) card, SIGCHLD);
 #endif
 }
 
@@ -1855,8 +1898,10 @@
 	lcs_setup_card(card);
 	rc = lcs_detect(card);
 	if (rc) {
+		LCS_DBF_TEXT(2, setup, "dtctfail");
+		PRINT_WARN("Detection of LCS card failed with return code "
+			   "%d (0x%x)\n", rc, rc);
 		lcs_stopcard(card);
-		lcs_cleanup_card(card);
 		goto out;
 	}
 	if (card->dev) {
@@ -1903,7 +1948,7 @@
 		goto out;
 	memcpy(card->dev->dev_addr, card->mac, LCS_MAC_LENGTH);
 #ifdef CONFIG_IP_MULTICAST
-	if (lcs_check_multicast_support(card))
+	if (!lcs_check_multicast_support(card))
 		card->dev->set_multicast_list = lcs_set_multicast_list;
 #endif
 	netif_stop_queue(card->dev);
@@ -1919,7 +1964,6 @@
 
 	ccw_device_set_offline(card->read.ccwdev);
 	ccw_device_set_offline(card->write.ccwdev);
-	lcs_cleanup_card(card);
 	return -ENODEV;
 }
 
diff -Nru a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h
--- a/drivers/s390/net/lcs.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/s390/net/lcs.h	Tue Jun 15 22:20:43 2004
@@ -6,7 +6,7 @@
 #include <linux/workqueue.h>
 #include <asm/ccwdev.h>
 
-#define VERSION_LCS_H "$Revision: 1.15 $"
+#define VERSION_LCS_H "$Revision: 1.16 $"
 
 #define LCS_DBF_TEXT(level, name, text) \
 	do { \
@@ -273,6 +273,7 @@
  */
 struct lcs_card {
 	spinlock_t lock;
+	spinlock_t ipm_lock;
 	enum lcs_dev_states state;
 	struct net_device *dev;
 	struct net_device_stats stats;
diff -Nru a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
--- a/drivers/s390/net/netiucv.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/net/netiucv.c	Tue Jun 15 22:20:41 2004
@@ -1,5 +1,5 @@
 /*
- * $Id: netiucv.c,v 1.51 2004/04/23 08:11:21 mschwide Exp $
+ * $Id: netiucv.c,v 1.54 2004/05/28 08:04:14 braunu Exp $
  *
  * IUCV network driver
  *
@@ -30,7 +30,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: IUCV network driver $Revision: 1.51 $
+ * RELEASE-TAG: IUCV network driver $Revision: 1.54 $
  *
  */
 
@@ -113,9 +113,6 @@
  */
 static struct iucv_connection *connections;
 
-/* Keep track of interfaces. */
-static int ifno;
-
 /**
  * Representation of event-data for the
  * connection state machine.
@@ -169,10 +166,10 @@
 }
 
 static __u8 iucv_host[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-//static __u8 iucvMagic[16] = {
-//	0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
-//	0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40
-//};
+static __u8 iucvMagic[16] = {
+	0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+	0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40
+};
 
 /**
  * This mask means the 16-byte IUCV "magic" and the origin userid must
@@ -549,7 +546,7 @@
 	iucv_MessagePending *eib = (iucv_MessagePending *)ev->data;
 	struct netiucv_priv *privptr = (struct netiucv_priv *)conn->netdev->priv;
 
-	__u16 msglen = eib->ln1msg2.ipbfln1f;
+	__u32 msglen = eib->ln1msg2.ipbfln1f;
 	int rc;
 
 	pr_debug("%s() called\n", __FUNCTION__);
@@ -571,6 +568,7 @@
 			  conn->rx_buff->data, msglen, NULL, NULL, NULL);
 	if (rc != 0 || msglen < 5) {
 		privptr->stats.rx_errors++;
+		printk(KERN_INFO "iucv_receive returned %08x\n", rc);
 		return;
 	}
 	netiucv_unpack_skb(conn, conn->rx_buff);
@@ -647,7 +645,7 @@
 			fsm_newstate(fi, CONN_STATE_IDLE);
 			if (privptr)
 				privptr->stats.tx_errors += txpackets;
-			printk(KERN_DEBUG "iucv_send returned %08x\n",
+			printk(KERN_INFO "iucv_send returned %08x\n",
 				rc);
 		} else {
 			if (privptr) {
@@ -771,14 +769,9 @@
 	struct iucv_connection *conn = ev->conn;
 	__u16 msglimit;
 	int rc;
-	__u8 iucvMagic[16] = {
-	0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
-        0xF0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40
-	};
 
 	pr_debug("%s() called\n", __FUNCTION__);
 
-	memcpy(iucvMagic, conn->netdev->name, IFNAMSIZ);
 	if (conn->handle == 0) {
 		conn->handle =
 			iucv_register_program(iucvMagic, conn->userid, mask,
@@ -992,6 +985,7 @@
 dev_action_connup(fsm_instance *fi, int event, void *arg)
 {
 	struct net_device   *dev = (struct net_device *)arg;
+	struct netiucv_priv *privptr = dev->priv;
 
 	pr_debug("%s() called\n", __FUNCTION__);
 
@@ -999,8 +993,8 @@
 		case DEV_STATE_STARTWAIT:
 			fsm_newstate(fi, DEV_STATE_RUNNING);
 			printk(KERN_INFO
-			       "%s: connected with remote side\n",
-			       dev->name);
+			       "%s: connected with remote side %s\n",
+			       dev->name, privptr->conn->userid);
 			break;
 		case DEV_STATE_STOPWAIT:
 			printk(KERN_INFO
@@ -1140,7 +1134,7 @@
 				skb_pull(skb, NETIUCV_HDRLEN);
 				skb_trim(skb, skb->len - NETIUCV_HDRLEN);
 			}
-			printk(KERN_DEBUG "iucv_send returned %08x\n",
+			printk(KERN_INFO "iucv_send returned %08x\n",
 				rc);
 		} else {
 			if (copied)
@@ -1612,7 +1606,7 @@
 }
 
 static int
-netiucv_register_device(struct net_device *ndev, int ifno)
+netiucv_register_device(struct net_device *ndev)
 {
 	struct netiucv_priv *priv = ndev->priv;
 	struct device *dev = kmalloc(sizeof(struct device), GFP_KERNEL);
@@ -1623,7 +1617,7 @@
 
 	if (dev) {
 		memset(dev, 0, sizeof(struct device));
-		snprintf(dev->bus_id, BUS_ID_SIZE, "netiucv%x", ifno);
+		snprintf(dev->bus_id, BUS_ID_SIZE, "net%s", ndev->name);
 		dev->bus = &iucv_bus;
 		dev->parent = iucv_root;
 		/*
@@ -1801,16 +1795,15 @@
  * Allocate and initialize everything of a net device.
  */
 static struct net_device *
-netiucv_init_netdevice(int ifno, char *username)
+netiucv_init_netdevice(char *username)
 {
 	struct netiucv_priv *privptr;
 	struct net_device *dev;
 
-	dev = alloc_netdev(sizeof(struct netiucv_priv), "",
+	dev = alloc_netdev(sizeof(struct netiucv_priv), "iucv%d",
 			   netiucv_setup_netdevice);
 	if (!dev)
 		return NULL;
-	sprintf(dev->name, "iucv%d", ifno);
 
         privptr = (struct netiucv_priv *)dev->priv;
 	privptr->fsm = init_fsm("netiucvdev", dev_state_names,
@@ -1861,7 +1854,7 @@
 	while (i<9)
 		username[i++] = ' ';
 	username[9] = '\0';
-	dev = netiucv_init_netdevice(ifno, username);
+	dev = netiucv_init_netdevice(username);
 	if (!dev) {
 		printk(KERN_WARNING
 		       "netiucv: Could not allocate network device structure "
@@ -1869,16 +1862,18 @@
 		return -ENODEV;
 	}
 	
-	if ((ret = netiucv_register_device(dev, ifno)))
-		goto out_free_ndev;
-	/* sysfs magic */
-	SET_NETDEV_DEV(dev, (struct device*)((struct netiucv_priv*)dev->priv)->dev);
 	if ((ret = register_netdev(dev))) {
-		netiucv_unregister_device((struct device*)((struct netiucv_priv*)dev->priv)->dev);
 		goto out_free_ndev;
 	}
+
+	if ((ret = netiucv_register_device(dev))) {
+		unregister_netdev(dev);
+		goto out_free_ndev;
+	}
+
+	/* sysfs magic */
+	SET_NETDEV_DEV(dev, (struct device*)((struct netiucv_priv*)dev->priv)->dev);
 	printk(KERN_INFO "%s: '%s'\n", dev->name, netiucv_printname(username));
-	ifno++;
 	
 	return count;
 
@@ -1891,6 +1886,61 @@
 
 DRIVER_ATTR(connection, 0200, NULL, conn_write);
 
+static ssize_t
+remove_write (struct device_driver *drv, const char *buf, size_t count)
+{
+	struct iucv_connection **clist = &connections;
+        struct net_device *ndev;
+        struct netiucv_priv *priv;
+        struct device *dev;
+        char name[IFNAMSIZ];
+        char *p;
+        int i;
+
+        pr_debug("%s() called\n", __FUNCTION__);
+
+        if (count >= IFNAMSIZ)
+                count = IFNAMSIZ-1;
+
+        for (i=0, p=(char *)buf; i<count && *p; i++, p++) {
+                if ((*p == '\n') | (*p == ' ')) {
+                        /* trailing lf, grr */
+                        break;
+                } else {
+                        name[i]=*p;
+                }
+        }
+        name[i] = '\0';
+
+        while (*clist) {
+                ndev = (*clist)->netdev;
+                priv = (struct netiucv_priv*)ndev->priv;
+                dev = priv->dev;
+
+                if (strncmp(name, ndev->name, count)) {
+                        clist = &((*clist)->next);
+                        continue;
+                }
+                if (ndev->flags & (IFF_UP | IFF_RUNNING)) {
+                        printk(KERN_WARNING
+                                "netiucv: net device %s active with peer %s\n",
+                                ndev->name, priv->conn->userid);
+                        printk(KERN_WARNING
+                                "netiucv: %s cannot be removed\n",
+                                ndev->name);
+                        return -EBUSY;
+                }
+                unregister_netdev(ndev);
+                netiucv_unregister_device(dev);
+                return count;
+        }
+        printk(KERN_WARNING
+                "netiucv: net device %s unknown\n", name);
+        return -EINVAL;
+}
+
+DRIVER_ATTR(remove, 0200, NULL, remove_write);
+
 static struct device_driver netiucv_driver = {
 	.name = "netiucv",
 	.bus  = &iucv_bus,
@@ -1899,7 +1949,7 @@
 static void
 netiucv_banner(void)
 {
-	char vbuf[] = "$Revision: 1.51 $";
+	char vbuf[] = "$Revision: 1.54 $";
 	char *version = vbuf;
 
 	if ((version = strchr(version, ':'))) {
@@ -1924,6 +1974,7 @@
 	}
 
 	driver_remove_file(&netiucv_driver, &driver_attr_connection);
+	driver_remove_file(&netiucv_driver, &driver_attr_remove);
 	driver_unregister(&netiucv_driver);
 
 	printk(KERN_INFO "NETIUCV driver unloaded\n");
@@ -1943,10 +1994,10 @@
 
 	/* Add entry for specifying connections. */
 	ret = driver_create_file(&netiucv_driver, &driver_attr_connection);
-
-	if (ret == 0)
+	if (ret == 0) {
+		ret = driver_create_file(&netiucv_driver, &driver_attr_remove);
 		netiucv_banner();
-	else {
+	} else {
 		printk(KERN_ERR "NETIUCV: failed to add driver attribute.\n");
 		driver_unregister(&netiucv_driver);
 	}
diff -Nru a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h
--- a/drivers/s390/net/qeth.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/s390/net/qeth.h	Tue Jun 15 22:20:36 2004
@@ -23,7 +23,7 @@
 
 #include "qeth_mpc.h"
 
-#define VERSION_QETH_H 		"$Revision: 1.102 $"
+#define VERSION_QETH_H 		"$Revision: 1.110 $"
 
 #ifdef CONFIG_QETH_IPV6
 #define QETH_VERSION_IPV6 	":IPv6"
@@ -91,10 +91,14 @@
 		debug_event(qeth_dbf_##name,level,(void*)(addr),len); \
 	} while (0)
 
-#define QETH_DBF_TEXT_(name,level,text...)				  \
-	do {								  \
-		sprintf(qeth_dbf_text_buf, text);			  \
-		debug_text_event(qeth_dbf_##name,level,qeth_dbf_text_buf);\
+extern DEFINE_PER_CPU(char[256], qeth_dbf_txt_buf);
+
+#define QETH_DBF_TEXT_(name,level,text...)				\
+	do {								\
+		char* dbf_txt_buf = get_cpu_var(qeth_dbf_txt_buf);	\
+		sprintf(dbf_txt_buf, text);			  	\
+		debug_text_event(qeth_dbf_##name,level,dbf_txt_buf);	\
+		put_cpu_var(qeth_dbf_txt_buf);				\
 	} while (0)
 
 #define QETH_DBF_SPRINTF(name,level,text...) \
@@ -179,13 +183,26 @@
 
 	unsigned int sc_dp_p;
 	unsigned int sc_p_dp;
-
+	/* qdio_input_handler: number of times called, time spent in */
 	__u64 inbound_start_time;
 	unsigned int inbound_cnt;
 	unsigned int inbound_time;
+	/* qeth_send_packet: number of times called, time spent in */
 	__u64 outbound_start_time;
 	unsigned int outbound_cnt;
 	unsigned int outbound_time;
+	/* qdio_output_handler: number of times called, time spent in */
+	__u64 outbound_handler_start_time;
+	unsigned int outbound_handler_cnt;
+	unsigned int outbound_handler_time;
+	/* number of calls to and time spent in do_QDIO for inbound queue */
+	__u64 inbound_do_qdio_start_time;
+	unsigned int inbound_do_qdio_cnt;
+	unsigned int inbound_do_qdio_time;
+	/* number of calls to and time spent in do_QDIO for outbound queues */
+	__u64 outbound_do_qdio_start_time;
+	unsigned int outbound_do_qdio_cnt;
+	unsigned int outbound_do_qdio_time;
 };
 #endif /* CONFIG_QETH_PERF_STATS */
 
@@ -279,7 +296,7 @@
 #define QETH_IN_BUF_COUNT_MAX 128
 #define QETH_MAX_BUFFER_ELEMENTS(card) ((card)->qdio.in_buf_size >> 12)
 #define QETH_IN_BUF_REQUEUE_THRESHOLD(card) \
-		((card)->qdio.in_buf_pool.buf_count / 4)
+		((card)->qdio.in_buf_pool.buf_count / 2)
 
 /* buffers we have to be behind before we get a PCI */
 #define QETH_PCI_THRESHOLD_A(card) ((card)->qdio.in_buf_pool.buf_count+1)
@@ -363,11 +380,6 @@
 	 * outbound: filled by driver; owned by hardware in order to be sent
 	 */
 	QETH_QDIO_BUF_PRIMED,
-	/*
-	 * inbound only: an error condition has been detected for a buffer
-	 *     the buffer will be discarded (not read out)
-	 */
-	QETH_QDIO_BUF_ERROR,
 };
 
 enum qeth_qdio_info_states {
@@ -406,7 +418,7 @@
 
 struct qeth_qdio_out_buffer {
 	struct qdio_buffer *buffer;
-	volatile enum qeth_qdio_buffer_states state;
+	atomic_t state;
 	volatile int next_element_to_fill;
 	struct sk_buff_head skb_list;
 };
@@ -606,6 +618,7 @@
 	wait_queue_head_t wait_q;
 	int (*callback)(struct qeth_card *,struct qeth_reply *,unsigned long);
  	int seqno;
+	unsigned long offset;
 	int received;
 	int rc;
 	void *param;
@@ -613,8 +626,10 @@
 	atomic_t refcnt;
 };
 
-struct qeth_card_info {
+#define QETH_BROADCAST_WITH_ECHO    1
+#define QETH_BROADCAST_WITHOUT_ECHO 2
 
+struct qeth_card_info {
 	char if_name[IF_NAME_LEN];
 	unsigned short unit_addr2;
 	unsigned short cula;
@@ -646,7 +661,6 @@
 	enum qeth_checksum_types checksum_type;
 	int broadcast_mode;
 	int macaddr_mode;
-	int enable_takeover;
 	int fake_broadcast;
 	int add_hhlen;
 	int fake_ll;
@@ -710,6 +724,15 @@
 
 extern struct qeth_card_list_struct qeth_card_list;
 
+/*notifier list */
+struct qeth_notify_list_struct {
+	struct list_head list;
+	struct task_struct *task;
+	int signum;
+};
+extern spinlock_t qeth_notify_lock;
+extern struct list_head qeth_notify_list;
+
 /*some helper functions*/
 
 inline static __u8
@@ -992,6 +1015,12 @@
 
 extern void
 qeth_del_rxip(struct qeth_card *, enum qeth_prot_versions, const u8 *);
+
+extern int
+qeth_notifier_register(struct task_struct *, int );
+
+extern int
+qeth_notifier_unregister(struct task_struct * );
 
 extern void
 qeth_schedule_recovery(struct qeth_card *);
diff -Nru a/drivers/s390/net/qeth_fs.h b/drivers/s390/net/qeth_fs.h
--- a/drivers/s390/net/qeth_fs.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/s390/net/qeth_fs.h	Tue Jun 15 22:20:39 2004
@@ -12,6 +12,11 @@
 #ifndef __QETH_FS_H__
 #define __QETH_FS_H__
 
+#define VERSION_QETH_FS_H "$Revision: 1.8 $"
+
+extern const char *VERSION_QETH_PROC_C;
+extern const char *VERSION_QETH_SYS_C;
+
 #ifdef CONFIG_PROC_FS
 extern int
 qeth_create_procfs_entries(void);
diff -Nru a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
--- a/drivers/s390/net/qeth_main.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/s390/net/qeth_main.c	Tue Jun 15 22:20:40 2004
@@ -1,6 +1,6 @@
 /*
  *
- * linux/drivers/s390/net/qeth_main.c ($Revision: 1.89 $)
+ * linux/drivers/s390/net/qeth_main.c ($Revision: 1.121 $)
  *
  * Linux on zSeries OSA Express and HiperSockets support
  *
@@ -12,7 +12,7 @@
  *			  Frank Pavlic (pavlic@de.ibm.com) and
  *		 	  Thomas Spatzier <tspat@de.ibm.com>
  *
- *    $Revision: 1.89 $	 $Date: 2004/04/27 16:27:26 $
+ *    $Revision: 1.121 $	 $Date: 2004/06/11 16:32:15 $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -78,10 +78,9 @@
 #include "qeth_mpc.h"
 #include "qeth_fs.h"
 
-#define VERSION_QETH_C "$Revision: 1.89 $"
-static const char *version = "qeth S/390 OSA-Express driver ("
-	VERSION_QETH_C "/" VERSION_QETH_H "/" VERSION_QETH_MPC_H
-	QETH_VERSION_IPV6 QETH_VERSION_VLAN ")";
+#define VERSION_QETH_C "$Revision: 1.121 $"
+static const char *version = "qeth S/390 OSA-Express driver";
+
 /**
  * Debug Facility Stuff
  */
@@ -92,7 +91,8 @@
 static debug_info_t *qeth_dbf_trace = NULL;
 static debug_info_t *qeth_dbf_sense = NULL;
 static debug_info_t *qeth_dbf_qerr = NULL;
-static char qeth_dbf_text_buf[255];
+
+DEFINE_PER_CPU(char[256], qeth_dbf_txt_buf);
 
 /**
  * some more definitions and declarations
@@ -101,12 +101,13 @@
 
 /* list of our cards */
 struct qeth_card_list_struct qeth_card_list;
+/*process list want to be notified*/
+spinlock_t qeth_notify_lock;
+struct list_head qeth_notify_list;
 
 static void qeth_send_control_data_cb(struct qeth_channel *,
 				      struct qeth_cmd_buffer *);
 
-static atomic_t qeth_hsi_count;
-
 /**
  * here we go with function implementation
  */
@@ -154,6 +155,72 @@
 
 static int
 qeth_set_online(struct ccwgroup_device *);
+
+static struct qeth_ipaddr *
+qeth_get_addr_buffer(enum qeth_prot_versions);
+
+static void
+qeth_notify_processes(void)
+{
+	/*notify all  registered processes */
+	struct qeth_notify_list_struct *n_entry;
+
+	QETH_DBF_TEXT(trace,3,"procnoti");
+	spin_lock(&qeth_notify_lock);
+	list_for_each_entry(n_entry, &qeth_notify_list, list) {
+		send_sig(n_entry->signum, n_entry->task, 1);
+	}
+	spin_unlock(&qeth_notify_lock);
+
+}
+int
+qeth_notifier_unregister(struct task_struct *p)
+{
+	struct qeth_notify_list_struct *n_entry, *tmp;
+
+	QETH_DBF_TEXT(trace, 2, "notunreg");
+	spin_lock(&qeth_notify_lock);
+	list_for_each_entry_safe(n_entry, tmp, &qeth_notify_list, list) {
+		if (n_entry->task == p) {
+			list_del(&n_entry->list);
+			kfree(n_entry);
+			goto out;
+		}
+	}
+out:
+	spin_unlock(&qeth_notify_lock);
+	return 0;
+}
+int
+qeth_notifier_register(struct task_struct *p, int signum)
+{
+	struct qeth_notify_list_struct *n_entry;
+
+	QETH_DBF_TEXT(trace, 2, "notreg");
+	/*check first if entry already exists*/
+	spin_lock(&qeth_notify_lock);
+	list_for_each_entry(n_entry, &qeth_notify_list, list) {
+		if (n_entry->task == p) {
+			n_entry->signum = signum;
+			spin_unlock(&qeth_notify_lock);
+			return 0;
+		}
+	}
+	spin_unlock(&qeth_notify_lock);
+
+	n_entry = (struct qeth_notify_list_struct *)
+		kmalloc(sizeof(struct qeth_notify_list_struct),GFP_KERNEL);
+	if (!n_entry)
+		return -ENOMEM;
+	n_entry->task = p;
+	n_entry->signum = signum;
+	spin_lock(&qeth_notify_lock);
+	list_add(&n_entry->list,&qeth_notify_list);
+	spin_unlock(&qeth_notify_lock);
+	return 0;
+}
+
+
 /**
  * free channel command buffers
  */
@@ -459,6 +526,7 @@
 	ccw_device_set_offline(CARD_RDEV(card));
 	if (recover_flag == CARD_STATE_UP)
 		card->state = CARD_STATE_RECOVER;
+	qeth_notify_processes();
 	return 0;
 }
 
@@ -478,8 +546,6 @@
 		card->use_hard_stop = 1;
 		qeth_set_offline(cgdev);
 	}
-	if (card->info.type == QETH_CARD_TYPE_IQD)
-		atomic_dec(&qeth_hsi_count);
 	/* remove form our internal list */
 	write_lock_irqsave(&qeth_card_list.rwlock, flags);
 	list_del(&card->list);
@@ -700,7 +766,7 @@
 qeth_set_ip_addr_list(struct qeth_card *card)
 {
 	struct list_head failed_todos;
-	struct qeth_ipaddr *todo, *addr, *tmp;
+	struct qeth_ipaddr *todo, *addr;
 	unsigned long flags;
 	int rc;
 
@@ -709,9 +775,10 @@
 
 	INIT_LIST_HEAD(&failed_todos);
 
-process_todos:
 	spin_lock_irqsave(&card->ip_lock, flags);
-	list_for_each_entry_safe(todo, tmp, &card->ip_tbd_list, entry) {
+	while (!list_empty(&card->ip_tbd_list)) {
+		todo = list_entry(card->ip_tbd_list.next,
+				  struct qeth_ipaddr, entry);
 		list_del_init(&todo->entry);
 		rc = __qeth_ref_ip_on_card(card, todo, &addr);
 		if (rc == 0) {
@@ -721,28 +788,24 @@
 			/* new entry to be added to on-card list */
 			spin_unlock_irqrestore(&card->ip_lock, flags);
 			rc = qeth_register_addr_entry(card, todo);
-			if (!rc){
-				spin_lock_irqsave(&card->ip_lock, flags);
+			spin_lock_irqsave(&card->ip_lock, flags);
+			if (!rc)
 				list_add_tail(&todo->entry, &card->ip_list);
-				spin_unlock_irqrestore(&card->ip_lock, flags);
-			} else
+			else
 				list_add_tail(&todo->entry, &failed_todos);
-			goto process_todos;
 		} else if (rc == -1) {
 			/* on-card entry to be removed */
 			list_del_init(&addr->entry);
 			spin_unlock_irqrestore(&card->ip_lock, flags);
 			rc = qeth_deregister_addr_entry(card, addr);
+			spin_lock_irqsave(&card->ip_lock, flags);
 			if (!rc) {
 				kfree(addr);
 				kfree(todo);
 			} else {
-				spin_lock_irqsave(&card->ip_lock, flags);
 				list_add_tail(&addr->entry, &card->ip_list);
 				list_add_tail(&todo->entry, &failed_todos);
-				spin_unlock_irqrestore(&card->ip_lock, flags);
 			}
-			goto process_todos;
 		}
 	}
 	spin_unlock_irqrestore(&card->ip_lock, flags);
@@ -937,7 +1000,6 @@
 	card->options.checksum_type = QETH_CHECKSUM_DEFAULT;
 	card->options.broadcast_mode = QETH_TR_BROADCAST_ALLRINGS;
 	card->options.macaddr_mode = QETH_TR_MACADDR_NONCANONICAL;
-	card->options.enable_takeover = 1;
 	card->options.fake_broadcast = 0;
 	card->options.add_hhlen = DEFAULT_ADD_HHLEN;
 	card->options.fake_ll = 0;
@@ -998,10 +1060,6 @@
 		if ((CARD_RDEV(card)->id.dev_type == known_devices[i][2]) &&
 		    (CARD_RDEV(card)->id.dev_model == known_devices[i][3])) {
 			card->info.type = known_devices[i][4];
-			if (card->options.enable_takeover)
-				card->info.func_level = known_devices[i][6];
-			else
-				card->info.func_level = known_devices[i][7];
 			card->qdio.no_out_queues = known_devices[i][8];
 			card->info.is_multicast_different = known_devices[i][9];
 			return 0;
@@ -1456,7 +1514,7 @@
 {
 	struct qeth_reply *reply;
 
-	reply = kmalloc(sizeof(struct qeth_reply), GFP_KERNEL|GFP_ATOMIC);
+	reply = kmalloc(sizeof(struct qeth_reply), GFP_ATOMIC);
 	if (reply){
 		memset(reply, 0, sizeof(struct qeth_reply));
 		atomic_set(&reply->refcnt, 1);
@@ -1627,17 +1685,20 @@
 			spin_unlock_irqrestore(&card->lock, flags);
 			keep_reply = 0;
 			if (reply->callback != NULL) {
-				if (cmd)
+				if (cmd) {
+					reply->offset = (__u16)((char*)cmd -
+								(char *)iob->data);
 					keep_reply = reply->callback(card,
 							reply,
 							(unsigned long)cmd);
+				}
 				else
 					keep_reply = reply->callback(card,
 							reply,
 							(unsigned long)iob);
 			}
 			if (cmd)
-				reply->rc = cmd->hdr.return_code;
+				reply->rc = (s16) cmd->hdr.return_code;
 			else if (iob->rc)
 				reply->rc = iob->rc;
 			if (keep_reply) {
@@ -1703,7 +1764,10 @@
 	init_timer(&timer);
 	timer.function = qeth_cmd_timeout;
 	timer.data = (unsigned long) reply;
-	timer.expires = jiffies + QETH_TIMEOUT;
+	if (IS_IPA(iob->data))
+		timer.expires = jiffies + QETH_IPA_TIMEOUT;
+	else
+		timer.expires = jiffies + QETH_TIMEOUT;
 	init_waitqueue_head(&reply->wait_q);
 	spin_lock_irqsave(&card->lock, flags);
 	list_add_tail(&reply->list, &card->cmd_waiter_list);
@@ -1743,12 +1807,10 @@
 		  (struct qeth_card *,struct qeth_reply*, unsigned long),
 		  void *reply_param)
 {
-	struct qeth_ipa_cmd *cmd;
 	int rc;
 
 	QETH_DBF_TEXT(trace,4,"sendipa");
 
-	cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
 	memcpy(iob->data, IPA_PDU_HEADER, IPA_PDU_HEADER_SIZE);
 	memcpy(QETH_IPA_CMD_DEST_ADDR(iob->data),
 	       &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH);
@@ -2227,12 +2289,11 @@
 	while((skb = qeth_get_next_skb(card, buf->buffer, &element,
 				       &offset, &hdr))){
 		qeth_rebuild_skb(card, skb, hdr);
-
-#ifdef CONFIG_QETH_PERF_STATS
-		card->perf_stats.inbound_time += qeth_get_micros() -
-			card->perf_stats.inbound_start_time;
-		card->perf_stats.inbound_cnt++;
-#endif
+		/* is device UP ? */
+		if (!(card->dev->flags & IFF_UP)){
+			dev_kfree_skb_irq(skb);
+			continue;
+		}
 		skb->dev = card->dev;
 		rxrc = netif_rx(skb);
 		card->dev->last_rx = jiffies;
@@ -2284,13 +2345,17 @@
 }
 
 static inline void
-qeth_clear_output_buffer(struct qeth_card *card,
+qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
 			 struct qeth_qdio_out_buffer *buf)
 {
 	int i;
 	struct sk_buff *skb;
 
-	for(i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i){
+	/* is PCI flag set on buffer? */
+	if (buf->buffer->element[0].flags & 0x40)
+		atomic_dec(&queue->set_pci_flags_count);
+
+	for(i = 0; i < QETH_MAX_BUFFER_ELEMENTS(queue->card); ++i){
 		buf->buffer->element[i].length = 0;
 		buf->buffer->element[i].addr = NULL;
 		buf->buffer->element[i].flags = 0;
@@ -2300,7 +2365,7 @@
 		}
 	}
 	buf->next_element_to_fill = 0;
-	buf->state = QETH_QDIO_BUF_EMPTY;
+	atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY);
 }
 
 static inline void
@@ -2330,9 +2395,17 @@
 		 * 'index') un-requeued -> this buffer is the first buffer that
 		 * will be requeued the next time
 		 */
+#ifdef CONFIG_QETH_PERF_STATS
+		card->perf_stats.inbound_do_qdio_cnt++;
+		card->perf_stats.inbound_do_qdio_start_time = qeth_get_micros();
+#endif
 		rc = do_QDIO(CARD_DDEV(card),
-			     QDIO_FLAG_SYNC_INPUT,
+			     QDIO_FLAG_SYNC_INPUT | QDIO_FLAG_UNDER_INTERRUPT,
 			     0, queue->next_buf_to_init, count, NULL);
+#ifdef CONFIG_QETH_PERF_STATS
+		card->perf_stats.inbound_do_qdio_time += qeth_get_micros() -
+			card->perf_stats.inbound_do_qdio_start_time;
+#endif
 		if (rc){
 			PRINT_WARN("qeth_queue_input_buffer's do_QDIO "
 				   "return %i (device %s).\n",
@@ -2369,6 +2442,7 @@
 	card = (struct qeth_card *) card_ptr;
 	net_dev = card->dev;
 #ifdef CONFIG_QETH_PERF_STATS
+	card->perf_stats.inbound_cnt++;
 	card->perf_stats.inbound_start_time = qeth_get_micros();
 #endif
 	if (status & QDIO_STATUS_LOOK_FOR_ERROR) {
@@ -2391,6 +2465,10 @@
 		qeth_put_buffer_pool_entry(card, buffer->pool_entry);
 		qeth_queue_input_buffer(card, index);
 	}
+#ifdef CONFIG_QETH_PERF_STATS
+	card->perf_stats.inbound_time += qeth_get_micros() -
+		card->perf_stats.inbound_start_time;
+#endif
 }
 
 static inline int
@@ -2449,6 +2527,9 @@
 		buf->buffer->element[buf->next_element_to_fill - 1].flags |=
 				SBAL_FLAGS_LAST_ENTRY;
 
+		if (queue->card->info.type == QETH_CARD_TYPE_IQD)
+			continue;
+
 		if (!queue->do_pack){
 			if ((atomic_read(&queue->used_buffers) >=
 		    		(QETH_HIGH_WATERMARK_PACK -
@@ -2479,6 +2560,10 @@
 	}
 
 	queue->card->dev->trans_start = jiffies;
+#ifdef CONFIG_QETH_PERF_STATS
+	queue->card->perf_stats.outbound_do_qdio_cnt++;
+	queue->card->perf_stats.outbound_do_qdio_start_time = qeth_get_micros();
+#endif
 	if (under_int)
 		rc = do_QDIO(CARD_DDEV(queue->card),
 			     QDIO_FLAG_SYNC_OUTPUT | QDIO_FLAG_UNDER_INTERRUPT,
@@ -2486,6 +2571,10 @@
 	else
 		rc = do_QDIO(CARD_DDEV(queue->card), QDIO_FLAG_SYNC_OUTPUT,
 			     queue->queue_no, index, count, NULL);
+#ifdef CONFIG_QETH_PERF_STATS
+	queue->card->perf_stats.outbound_do_qdio_time += qeth_get_micros() -
+		queue->card->perf_stats.outbound_do_qdio_start_time;
+#endif
 	if (rc){
 		QETH_DBF_SPRINTF(trace, 0, "qeth_flush_buffers: do_QDIO "
 				 "returned error (%i) on device %s.",
@@ -2493,11 +2582,19 @@
 		QETH_DBF_TEXT(trace, 2, "flushbuf");
 		QETH_DBF_TEXT_(trace, 2, " err%d", rc);
 		queue->card->stats.tx_errors += count;
+		/* ok, since do_QDIO went wrong the buffers have not been given
+		 * to the hardware. they still belong to us, so we can clear
+		 * them and reuse then, i.e. set back next_buf_to_fill*/
+		for (i = index; i < index + count; ++i) {
+			buf = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q];
+			qeth_clear_output_buffer(queue, buf);
+		}
+		queue->next_buf_to_fill = index;
 		return;
 	}
+	atomic_add(count, &queue->used_buffers);
 #ifdef CONFIG_QETH_PERF_STATS
 	queue->card->perf_stats.bufs_sent += count;
-	queue->card->perf_stats.outbound_cnt++;
 #endif
 }
 
@@ -2533,11 +2630,11 @@
 			queue->do_pack = 0;
 			/* flush packing buffers */
 			buffer = &queue->bufs[queue->next_buf_to_fill];
-			BUG_ON(buffer->state == QETH_QDIO_BUF_PRIMED);
-			if (buffer->next_element_to_fill > 0) {
-				buffer->state = QETH_QDIO_BUF_PRIMED;
+			if ((atomic_read(&buffer->state) ==
+						QETH_QDIO_BUF_EMPTY) &&
+			    (buffer->next_element_to_fill > 0)) {
+				atomic_set(&buffer->state,QETH_QDIO_BUF_PRIMED);
 				flush_count++;
-				atomic_inc(&queue->used_buffers);
 				queue->next_buf_to_fill =
 					(queue->next_buf_to_fill + 1) %
 					QDIO_MAX_BUFFERS_PER_Q;
@@ -2551,17 +2648,17 @@
 qeth_flush_buffers_on_no_pci(struct qeth_qdio_out_q *queue, int under_int)
 {
 	struct qeth_qdio_out_buffer *buffer;
+	int index;
 
-	buffer = &queue->bufs[queue->next_buf_to_fill];
-	BUG_ON(buffer->state == QETH_QDIO_BUF_PRIMED);
-	if (buffer->next_element_to_fill > 0){
+	index = queue->next_buf_to_fill;
+	buffer = &queue->bufs[index];
+	if((atomic_read(&buffer->state) == QETH_QDIO_BUF_EMPTY) &&
+	   (buffer->next_element_to_fill > 0)){
 		/* it's a packing buffer */
-		buffer->state = QETH_QDIO_BUF_PRIMED;
-		atomic_inc(&queue->used_buffers);
-		qeth_flush_buffers(queue, under_int, queue->next_buf_to_fill,
-				   1);
+		atomic_set(&buffer->state, QETH_QDIO_BUF_PRIMED);
 		queue->next_buf_to_fill =
 			(queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q;
+		qeth_flush_buffers(queue, under_int, index, 1);
 	}
 }
 
@@ -2591,6 +2688,10 @@
 		}
 	}
 
+#ifdef CONFIG_QETH_PERF_STATS
+	card->perf_stats.outbound_handler_cnt++;
+	card->perf_stats.outbound_handler_start_time = qeth_get_micros();
+#endif
 	for(i = first_element; i < (first_element + count); ++i){
 		buffer = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q];
 		/*we only handle the KICK_IT error by doing a recovery */
@@ -2600,15 +2701,15 @@
 			qeth_schedule_recovery(card);
 			return;
 		}
-		/* is PCI flag set on buffer? */
-		if (buffer->buffer->element[0].flags & 0x40)
-			atomic_dec(&queue->set_pci_flags_count);
-
-		qeth_clear_output_buffer(card, buffer);
-		atomic_dec(&queue->used_buffers);
+		qeth_clear_output_buffer(queue, buffer);
 	}
+	atomic_sub(count, &queue->used_buffers);
 
 	netif_wake_queue(card->dev);
+#ifdef CONFIG_QETH_PERF_STATS
+	card->perf_stats.outbound_handler_time += qeth_get_micros() -
+		card->perf_stats.outbound_handler_start_time;
+#endif
 }
 
 static char*
@@ -2795,8 +2896,8 @@
 	/* free outbound qdio_qs */
 	for (i = 0; i < card->qdio.no_out_queues; ++i){
 		for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j)
-			qeth_clear_output_buffer(card, &card->qdio.
-						out_qs[i]->bufs[j]);
+			qeth_clear_output_buffer(card->qdio.out_qs[i],
+					&card->qdio.out_qs[i]->bufs[j]);
 		kfree(card->qdio.out_qs[i]);
 	}
 	kfree(card->qdio.out_qs);
@@ -2813,8 +2914,8 @@
 	for (i = 0; i < card->qdio.no_out_queues; ++i)
 		if (card->qdio.out_qs[i]){
 			for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j)
-				qeth_clear_output_buffer(card, &card->qdio.
-						out_qs[i]->bufs[j]);
+				qeth_clear_output_buffer(card->qdio.out_qs[i],
+						&card->qdio.out_qs[i]->bufs[j]);
 		}
 }
 
@@ -2866,8 +2967,8 @@
 		memset(card->qdio.out_qs[i]->qdio_bufs, 0,
 		       QDIO_MAX_BUFFERS_PER_Q * sizeof(struct qdio_buffer));
 		for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j){
-			qeth_clear_output_buffer(card, &card->qdio.
-						 out_qs[i]->bufs[j]);
+			qeth_clear_output_buffer(card->qdio.out_qs[i],
+					&card->qdio.out_qs[i]->bufs[j]);
 		}
 		card->qdio.out_qs[i]->card = card;
 		card->qdio.out_qs[i]->next_buf_to_fill = 0;
@@ -3134,20 +3235,6 @@
 	return rc;
 }
 
-static void
-qeth_set_device_name(struct qeth_card *card)
-{
-	char buf[IF_NAME_LEN];
-
-	memset(buf, 0, IF_NAME_LEN);
-	if (card->info.type == QETH_CARD_TYPE_IQD) {
-		sprintf(buf,"hsi%d", atomic_read(&qeth_hsi_count));
-		atomic_inc(&qeth_hsi_count);
-		memcpy(card->dev->name,buf,IF_NAME_LEN);
-	}
-
-}
-
 static struct net_device *
 qeth_get_netdevice(enum qeth_card_types type, enum qeth_link_types linktype)
 {
@@ -3167,6 +3254,8 @@
 		}
 		break;
 	case QETH_CARD_TYPE_IQD:
+		dev = alloc_netdev(0, "hsi%d", ether_setup);
+		break;
 	default:
 		dev = alloc_etherdev(0);
 	}
@@ -3195,11 +3284,8 @@
 		card->stats.tx_carrier_errors++;
 		return -EIO;
 	}
-	if (netif_queue_stopped(dev) ) {
-		card->stats.tx_dropped++;
-		return -EBUSY;
-	}
 #ifdef CONFIG_QETH_PERF_STATS
+	card->perf_stats.outbound_cnt++;
 	card->perf_stats.outbound_start_time = qeth_get_micros();
 #endif
 	/*
@@ -3210,6 +3296,10 @@
 	if (!(rc = qeth_send_packet(card, skb)))
 		netif_wake_queue(dev);
 
+#ifdef CONFIG_QETH_PERF_STATS
+	card->perf_stats.outbound_time += qeth_get_micros() -
+		card->perf_stats.outbound_start_time;
+#endif
 	return rc;
 }
 
@@ -3556,7 +3646,6 @@
 	int first_lap = 1;
 
 	QETH_DBF_TEXT(trace, 6, "qdfillbf");
-
 	buffer = buf->buffer;
 	atomic_inc(&skb->users);
 	skb_queue_tail(&buf->skb_list, skb);
@@ -3591,7 +3680,7 @@
 	if (!queue->do_pack) {
 		QETH_DBF_TEXT(trace, 6, "fillbfnp");
 		/* set state to PRIMED -> will be flushed */
-		buf->state = QETH_QDIO_BUF_PRIMED;
+		atomic_set(&buf->state, QETH_QDIO_BUF_PRIMED);
 	} else {
 		QETH_DBF_TEXT(trace, 6, "fillbfpa");
 #ifdef CONFIG_QETH_PERF_STATS
@@ -3603,73 +3692,97 @@
 			 * packed buffer if full -> set state PRIMED
 			 * -> will be flushed
 			 */
-			buf->state = QETH_QDIO_BUF_PRIMED;
+			atomic_set(&buf->state, QETH_QDIO_BUF_PRIMED);
 		}
 	}
 	return 0;
 }
 
 static inline int
-qeth_do_send_packet(struct qeth_card *card, struct sk_buff *skb,
-		    struct qeth_qdio_out_q *queue, int ipv,
-		    int cast_type)
+qeth_do_send_packet_fast(struct qeth_card *card, struct qeth_qdio_out_q *queue,
+			 struct sk_buff *skb, struct qeth_hdr *hdr,
+			 int elements_needed)
+{
+	struct qeth_qdio_out_buffer *buffer;
+	int index;
+
+	QETH_DBF_TEXT(trace, 6, "dosndpfa");
+
+	spin_lock(&queue->lock);
+	index = queue->next_buf_to_fill;
+	buffer = &queue->bufs[queue->next_buf_to_fill];
+	/*
+	 * check if buffer is empty to make sure that we do not 'overtake'
+	 * ourselves and try to fill a buffer that is already primed
+	 */
+	if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY) {
+		card->stats.tx_dropped++;
+		spin_unlock(&queue->lock);
+		return -EBUSY;
+	}
+	queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) %
+				  QDIO_MAX_BUFFERS_PER_Q;
+	qeth_fill_buffer(queue, buffer, (char *)hdr, skb);
+	qeth_flush_buffers(queue, 0, index, 1);
+	spin_unlock(&queue->lock);
+	return 0;
+}
+
+static inline int
+qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
+		    struct sk_buff *skb, struct qeth_hdr *hdr,
+		    int elements_needed)
 {
-	struct qeth_hdr *hdr;
 	struct qeth_qdio_out_buffer *buffer;
-	int elements_needed;
 	int start_index;
 	int flush_count = 0;
-	int rc;
+	int rc = 0;
 
 	QETH_DBF_TEXT(trace, 6, "dosndpkt");
 
-	if ((rc = qeth_prepare_skb(card, &skb, &hdr, ipv))){
-		QETH_DBF_TEXT_(trace, 4, "1err%d", rc);
-		return rc;
-	}
-	qeth_fill_header(card, hdr, skb, ipv, cast_type);
-	elements_needed = 1 + (((((unsigned long) hdr) % PAGE_SIZE) + skb->len)
-				>> PAGE_SHIFT);
-	if (elements_needed > QETH_MAX_BUFFER_ELEMENTS(card)){
-		PRINT_ERR("qeth_do_send_packet: invalid size of "
-				 "IP packet. Discarded.");
-		return -EINVAL;
-	}
-
 	spin_lock(&queue->lock);
 	start_index = queue->next_buf_to_fill;
 	buffer = &queue->bufs[queue->next_buf_to_fill];
-	BUG_ON(buffer->state == QETH_QDIO_BUF_PRIMED);
+	/*
+	 * check if buffer is empty to make sure that we do not 'overtake'
+	 * ourselves and try to fill a buffer that is already primed
+	 */
+	if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY){
+		card->stats.tx_dropped++;
+		spin_unlock(&queue->lock);
+		return -EBUSY;
+	}
 	if (queue->do_pack){
 		/* does packet fit in current buffer? */
-		if((QETH_MAX_BUFFER_ELEMENTS(card) - buffer->next_element_to_fill)
-				< elements_needed){
+		if((QETH_MAX_BUFFER_ELEMENTS(card) -
+		    buffer->next_element_to_fill) < elements_needed){
 			/* ... no -> set state PRIMED */
-			buffer->state = QETH_QDIO_BUF_PRIMED;
+			atomic_set(&buffer->state, QETH_QDIO_BUF_PRIMED);
 			flush_count++;
-			atomic_inc(&queue->used_buffers);
 			queue->next_buf_to_fill =
 				(queue->next_buf_to_fill + 1) %
 				QDIO_MAX_BUFFERS_PER_Q;
 			buffer = &queue->bufs[queue->next_buf_to_fill];
+			/* we did a step forward, so check buffer state again */
+			if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY){
+				card->stats.tx_dropped++;
+				qeth_flush_buffers(queue, 0, start_index, 1);
+				spin_unlock(&queue->lock);
+				/* return EBUSY because we sent old packet, not
+				 * the current one */
+				return -EBUSY;
+			}
 		}
 	}
-
-	rc = qeth_fill_buffer(queue, buffer, (char *)hdr, skb);
-	if (rc) {
-		PRINT_WARN("qeth_do_send_packet: error during "
-			      "qeth_fill_buffer.");
-		card->stats.tx_dropped++;
-	} else if (buffer->state == QETH_QDIO_BUF_PRIMED){
+	qeth_fill_buffer(queue, buffer, (char *)hdr, skb);
+	if (atomic_read(&buffer->state) == QETH_QDIO_BUF_PRIMED){
 		/* next time fill the next buffer */
 		flush_count++;
-		atomic_inc(&queue->used_buffers);
 		queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) %
 			QDIO_MAX_BUFFERS_PER_Q;
 	}
 	/* check if we need to switch packing state of this queue */
-	if (card->info.type != QETH_CARD_TYPE_IQD)
-		flush_count += qeth_switch_packing_state(queue);
+	flush_count += qeth_switch_packing_state(queue);
 
 	if (flush_count)
 		qeth_flush_buffers(queue, 0, start_index, flush_count);
@@ -3678,7 +3791,6 @@
 		qeth_flush_buffers_on_no_pci(queue, 0);
 
 	spin_unlock(&queue->lock);
-
 	return rc;
 }
 
@@ -3688,6 +3800,8 @@
 	int ipv;
 	int cast_type;
 	struct qeth_qdio_out_q *queue;
+	struct qeth_hdr *hdr;
+	int elements_needed;
 	int rc;
 
 	QETH_DBF_TEXT(trace, 6, "sendpkt");
@@ -3696,24 +3810,30 @@
 	cast_type = qeth_get_cast_type(card, skb);
 	queue = card->qdio.out_qs
 		[qeth_get_priority_queue(card, skb, ipv, cast_type)];
-	/* do we have empty buffers? */
-	rc = (atomic_read(&queue->used_buffers) >=
-	      QDIO_MAX_BUFFERS_PER_Q - 1) ? -EBUSY : 0;
-	if (rc) {
-		card->stats.tx_dropped++;
+
+	if ((rc = qeth_prepare_skb(card, &skb, &hdr, ipv))){
 		QETH_DBF_TEXT_(trace, 4, "1err%d", rc);
 		return rc;
 	}
+	qeth_fill_header(card, hdr, skb, ipv, cast_type);
+	elements_needed = 1 + (((((unsigned long) hdr) % PAGE_SIZE) + skb->len)
+				>> PAGE_SHIFT);
+	if (elements_needed > QETH_MAX_BUFFER_ELEMENTS(card)){
+		PRINT_ERR("qeth_do_send_packet: invalid size of "
+				 "IP packet. Discarded.");
+		return -EINVAL;
+	}
 
-	rc = qeth_do_send_packet(card, skb, queue, ipv, cast_type);
+	if (card->info.type != QETH_CARD_TYPE_IQD)
+		rc = qeth_do_send_packet(card, queue, skb, hdr,
+					 elements_needed);
+	else
+		rc = qeth_do_send_packet_fast(card, queue, skb, hdr,
+					      elements_needed);
 
 	if (!rc){
 		card->stats.tx_packets++;
 		card->stats.tx_bytes += skb->len;
-#ifdef CONFIG_QETH_PERF_STATS
-		card->perf_stats.outbound_time += qeth_get_micros() -
-			card->perf_stats.outbound_start_time;
-#endif
 	}
 	return rc;
 }
@@ -3859,69 +3979,107 @@
 	if (rc) {
 		tmp = rc;
 		PRINT_WARN("Could not set number of ARP entries on %s: "
-			   "%s (0x%x)\n",
+			   "%s (0x%x/%d)\n",
 			   card->info.if_name, qeth_arp_get_error_cause(&rc),
-			   tmp);
+			   tmp, tmp);
 	}
 	return rc;
 }
 
+static inline void
+qeth_copy_arp_entries_stripped(struct qeth_arp_query_info *qinfo,
+		               struct qeth_arp_query_data *qdata,
+			       int entry_size, int uentry_size)
+{
+	char *entry_ptr;
+	char *uentry_ptr;
+	int i;
+
+	entry_ptr = (char *)&qdata->data;
+	uentry_ptr = (char *)(qinfo->udata + qinfo->udata_offset);
+	for (i = 0; i < qdata->no_entries; ++i){
+		/* strip off 32 bytes "media specific information" */
+		memcpy(uentry_ptr, (entry_ptr + 32), entry_size - 32);
+		entry_ptr += entry_size;
+		uentry_ptr += uentry_size;
+	}
+}
+
 static int
 qeth_arp_query_cb(struct qeth_card *card, struct qeth_reply *reply,
 		  unsigned long data)
 {
-	struct qeth_ipa_arp_cmd *cmd;
+	struct qeth_ipa_cmd *cmd;
 	struct qeth_arp_query_data *qdata;
 	struct qeth_arp_query_info *qinfo;
 	int entry_size;
+	int uentry_size;
 	int i;
 
 	QETH_DBF_TEXT(trace,4,"arpquecb");
 
 	qinfo = (struct qeth_arp_query_info *) reply->param;
-	cmd = (struct qeth_ipa_arp_cmd *) data;
-	if (cmd->ihdr.return_code) {
-		QETH_DBF_TEXT_(trace,4,"qaer1%i", cmd->ihdr.return_code);
+	cmd = (struct qeth_ipa_cmd *) data;
+	if (cmd->hdr.return_code) {
+		QETH_DBF_TEXT_(trace,4,"qaer1%i", cmd->hdr.return_code);
 		return 0;
 	}
-	if (cmd->shdr.return_code) {
-		cmd->ihdr.return_code = cmd->shdr.return_code;
-		QETH_DBF_TEXT_(trace,4,"qaer2%i", cmd->ihdr.return_code);
+	if (cmd->data.setassparms.hdr.return_code) {
+		cmd->hdr.return_code = cmd->data.setassparms.hdr.return_code;
+		QETH_DBF_TEXT_(trace,4,"qaer2%i", cmd->hdr.return_code);
 		return 0;
 	}
-	qdata = &cmd->data.query_arp;
+	qdata = &cmd->data.setassparms.data.query_arp;
 	switch(qdata->reply_bits){
 	case 5:
-		entry_size = sizeof(struct qeth_arp_qi_entry5);
+		uentry_size = entry_size = sizeof(struct qeth_arp_qi_entry5);
+		if (qinfo->mask_bits & QETH_QARP_STRIP_ENTRIES)
+			uentry_size = sizeof(struct qeth_arp_qi_entry5_short);
 		break;
 	case 7:
-		entry_size = sizeof(struct qeth_arp_qi_entry7);
-		break;
+		/* fall through to default */
 	default:
 		/* tr is the same as eth -> entry7 */
-		entry_size = sizeof(struct qeth_arp_qi_entry7);
+		uentry_size = entry_size = sizeof(struct qeth_arp_qi_entry7);
+		if (qinfo->mask_bits & QETH_QARP_STRIP_ENTRIES)
+			uentry_size = sizeof(struct qeth_arp_qi_entry7_short);
 		break;
 	}
 	/* check if there is enough room in userspace */
 	if ((qinfo->udata_len - qinfo->udata_offset) <
-			qdata->no_entries * entry_size){
+			qdata->no_entries * uentry_size){
 		QETH_DBF_TEXT_(trace, 4, "qaer3%i", -ENOMEM);
-		cmd->ihdr.return_code = -ENOMEM;
+		cmd->hdr.return_code = -ENOMEM;
+		PRINT_WARN("query ARP user space buffer is too small for "
+			   "the returned number of ARP entries. "
+			   "Aborting query!\n");
 		goto out_error;
 	}
-	QETH_DBF_TEXT_(trace, 4, "anore%i", cmd->shdr.number_of_replies);
-	QETH_DBF_TEXT_(trace, 4, "aseqn%i", cmd->shdr.seq_no);
+	QETH_DBF_TEXT_(trace, 4, "anore%i",
+		       cmd->data.setassparms.hdr.number_of_replies);
+	QETH_DBF_TEXT_(trace, 4, "aseqn%i", cmd->data.setassparms.hdr.seq_no);
 	QETH_DBF_TEXT_(trace, 4, "anoen%i", qdata->no_entries);
-	for (i = 0; i < qdata->no_entries; ++i){
+
+	if (qinfo->mask_bits & QETH_QARP_STRIP_ENTRIES) {
+		/* strip off "media specific information" */
+		qeth_copy_arp_entries_stripped(qinfo, qdata, entry_size,
+					       uentry_size);
+	} else
+		/*copy entries to user buffer*/
 		memcpy(qinfo->udata + qinfo->udata_offset,
-		       qdata->data + i*entry_size, entry_size);
-		qinfo->no_entries++;
-		qinfo->udata_offset += entry_size;
-	}
+		       (char *)&qdata->data, qdata->no_entries*uentry_size);
+
+	qinfo->no_entries += qdata->no_entries;
+	qinfo->udata_offset += (qdata->no_entries*uentry_size);
 	/* check if all replies received ... */
-	if (cmd->shdr.seq_no < cmd->shdr.number_of_replies)
+	if (cmd->data.setassparms.hdr.seq_no <
+	    cmd->data.setassparms.hdr.number_of_replies)
 		return 1;
 	memcpy(qinfo->udata, &qinfo->no_entries, 4);
+	/* keep STRIP_ENTRIES flag so the user program can distinguish
+	 * stripped entries from normal ones */
+	if (qinfo->mask_bits & QETH_QARP_STRIP_ENTRIES)
+		qdata->reply_bits |= QETH_QARP_STRIP_ENTRIES;
 	memcpy(qinfo->udata + QETH_QARP_MASK_OFFSET,&qdata->reply_bits,2);
 	return 0;
 out_error:
@@ -3930,70 +4088,54 @@
 	return 0;
 }
 
-static struct qeth_cmd_buffer *
-qeth_get_ipacmd_buffer(struct qeth_card *, enum qeth_ipa_cmds,
-		       enum qeth_prot_versions);
-
-struct qeth_cmd_buffer *
-qeth_get_ipa_arp_cmd_buffer(struct qeth_card *card, u16 cmd_code,
-			    u32 data_len, enum qeth_prot_versions proto)
+static int
+qeth_send_ipa_arp_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
+		      int len, int (*reply_cb)(struct qeth_card *,
+					       struct qeth_reply *,
+					       unsigned long),
+		      void *reply_param)
 {
-	struct qeth_cmd_buffer *iob;
-	struct qeth_ipa_arp_cmd *cmd;
-	u16 s1, s2;
-
-	QETH_DBF_TEXT(trace,4,"getarpcm");
-	iob = qeth_get_ipacmd_buffer(card, IPA_CMD_SETASSPARMS, proto);
+	QETH_DBF_TEXT(trace,4,"sendarp");
 
 	memcpy(iob->data, IPA_PDU_HEADER, IPA_PDU_HEADER_SIZE);
-
-	if ((IPA_PDU_HEADER_SIZE + QETH_ARP_CMD_BASE_LEN + data_len) > 256) {
-		/* adjust sizes in IPA_PDU_HEADER */
-		s1 = (u32) IPA_PDU_HEADER_SIZE + QETH_ARP_CMD_BASE_LEN +
-			   data_len;
-		s2 = (u32) QETH_ARP_CMD_BASE_LEN + data_len;
-		memcpy(QETH_IPA_PDU_LEN_TOTAL(iob->data), &s1, 2);
-		memcpy(QETH_IPA_PDU_LEN_PDU1(iob->data), &s2, 2);
-		memcpy(QETH_IPA_PDU_LEN_PDU2(iob->data), &s2, 2);
-		memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2);
-	}
-
-	cmd = (struct qeth_ipa_arp_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
-	cmd->shdr.assist_no = IPA_ARP_PROCESSING;
-	cmd->shdr.length = 8 + data_len;
-	cmd->shdr.command_code = cmd_code;
-	cmd->shdr.return_code = 0;
-	cmd->shdr.seq_no = 0;
-
-	return iob;
+	memcpy(QETH_IPA_CMD_DEST_ADDR(iob->data),
+	       &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH);
+	return qeth_send_control_data(card, IPA_PDU_HEADER_SIZE + len, iob,
+				      reply_cb, reply_param);
 }
 
 static int
-qeth_send_ipa_arp_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
-		      char *data, int data_len,
-		      int (*reply_cb)
-		      (struct qeth_card *,struct qeth_reply*, unsigned long),
+qeth_send_ipa_snmp_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
+		      int len, int (*reply_cb)(struct qeth_card *,
+					       struct qeth_reply *,
+					       unsigned long),
 		      void *reply_param)
 {
-	int rc;
+	u16 s1, s2;
 
-	QETH_DBF_TEXT(trace,4,"sendarp");
+	QETH_DBF_TEXT(trace,4,"sendsnmp");
 
-	memcpy(QETH_IPA_ARP_DATA_POS(iob->data), data, data_len);
+	memcpy(iob->data, IPA_PDU_HEADER, IPA_PDU_HEADER_SIZE);
 	memcpy(QETH_IPA_CMD_DEST_ADDR(iob->data),
 	       &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH);
-
-	rc = qeth_send_control_data(card, IPA_PDU_HEADER_SIZE +
-				    QETH_ARP_CMD_BASE_LEN + data_len, iob,
-				    reply_cb, reply_param);
-	return rc;
+	/* adjust PDU length fields in IPA_PDU_HEADER */
+	s1 = (u32) IPA_PDU_HEADER_SIZE + len;
+	s2 = (u32) len;
+	memcpy(QETH_IPA_PDU_LEN_TOTAL(iob->data), &s1, 2);
+	memcpy(QETH_IPA_PDU_LEN_PDU1(iob->data), &s2, 2);
+	memcpy(QETH_IPA_PDU_LEN_PDU2(iob->data), &s2, 2);
+	memcpy(QETH_IPA_PDU_LEN_PDU3(iob->data), &s2, 2);
+	return qeth_send_control_data(card, IPA_PDU_HEADER_SIZE + len, iob,
+				      reply_cb, reply_param);
 }
 
+static struct qeth_cmd_buffer *
+qeth_get_setassparms_cmd(struct qeth_card *, enum qeth_ipa_funcs,
+			 __u16, __u16, enum qeth_prot_versions);
 static int
 qeth_arp_query(struct qeth_card *card, char *udata)
 {
 	struct qeth_cmd_buffer *iob;
-	struct qeth_arp_query_data *qdata;
 	struct qeth_arp_query_info qinfo = {0, };
 	int tmp;
 	int rc;
@@ -4008,40 +4150,32 @@
 	 */
 	if (card->info.guestlan)
 		return -EOPNOTSUPP;
-	if (!qeth_is_supported(card,IPA_ARP_PROCESSING)) {
+	if (!qeth_is_supported(card,/*IPA_QUERY_ARP_ADDR_INFO*/
+			       IPA_ARP_PROCESSING)) {
 		PRINT_WARN("ARP processing not supported "
 			   "on %s!\n", card->info.if_name);
 		return -EOPNOTSUPP;
 	}
-	/* get size of userspace mem area */
-	if (copy_from_user(&qinfo.udata_len, udata, 4))
+	/* get size of userspace buffer and mask_bits -> 6 bytes */
+	if (copy_from_user(&qinfo, udata, 6))
 		return -EFAULT;
 	if (!(qinfo.udata = kmalloc(qinfo.udata_len, GFP_KERNEL)))
 		return -ENOMEM;
 	memset(qinfo.udata, 0, qinfo.udata_len);
 	qinfo.udata_offset = QETH_QARP_ENTRIES_OFFSET;
-	/* alloc mem area for the actual query */
-	if (!(qdata = kmalloc(sizeof(struct qeth_arp_query_data),
-			      GFP_KERNEL))){
-		kfree(qinfo.udata);
-		return -ENOMEM;
-	}
-	memset(qdata, 0, sizeof(struct qeth_arp_query_data));
-	/* do not give sizeof(struct qeth_arp_query_data) to next command;
-	 * this would cause the IPA PDU size to be set to a value of > 256
-	 * and this is to much for HiperSockets */
-	iob = qeth_get_ipa_arp_cmd_buffer(card, IPA_CMD_ASS_ARP_QUERY_INFO,
-					  0, QETH_PROT_IPV4);
+	iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING,
+				       IPA_CMD_ASS_ARP_QUERY_INFO,
+				       sizeof(int),QETH_PROT_IPV4);
+
 	rc = qeth_send_ipa_arp_cmd(card, iob,
-				   (char *) qdata,
-				   sizeof(struct qeth_arp_query_data),
-				   qeth_arp_query_cb,
-				   (void *)&qinfo);
+				   QETH_SETASS_BASE_LEN+QETH_ARP_CMD_LEN,
+				   qeth_arp_query_cb, (void *)&qinfo);
 	if (rc) {
 		tmp = rc;
-		PRINT_WARN("Error while querying ARP cache on %s: %s (0x%x)\n",
+		PRINT_WARN("Error while querying ARP cache on %s: %s "
+			   "(0x%x/%d)\n",
 			   card->info.if_name, qeth_arp_get_error_cause(&rc),
-			   tmp);
+			   tmp, tmp);
 		copy_to_user(udata, qinfo.udata, 4);
 	} else {
 		copy_to_user(udata, qinfo.udata, qinfo.udata_len);
@@ -4050,13 +4184,155 @@
 	return rc;
 }
 
+/**
+ * SNMP command callback
+ */
 static int
-qeth_default_setassparms_cb(struct qeth_card *, struct qeth_reply *,
-			    unsigned long);
+qeth_snmp_command_cb(struct qeth_card *card, struct qeth_reply *reply,
+		     unsigned long sdata)
+{
+	struct qeth_ipa_cmd *cmd;
+	struct qeth_arp_query_info *qinfo;
+	struct qeth_snmp_cmd *snmp;
+	unsigned char *data;
+	__u16 data_len;
+
+	QETH_DBF_TEXT(trace,3,"snpcmdcb");
+
+	cmd = (struct qeth_ipa_cmd *) sdata;
+	data = (unsigned char *)((char *)cmd - reply->offset);
+	qinfo = (struct qeth_arp_query_info *) reply->param;
+	snmp = &cmd->data.setadapterparms.data.snmp;
+
+	if (cmd->hdr.return_code) {
+		QETH_DBF_TEXT_(trace,4,"scer1%i", cmd->hdr.return_code);
+		return 0;
+	}
+	if (cmd->data.setadapterparms.hdr.return_code) {
+		cmd->hdr.return_code = cmd->data.setadapterparms.hdr.return_code;
+		QETH_DBF_TEXT_(trace,4,"scer2%i", cmd->hdr.return_code);
+		return 0;
+	}
+	data_len = *((__u16*)QETH_IPA_PDU_LEN_PDU1(data));
+	if (cmd->data.setadapterparms.hdr.seq_no == 1)
+		data_len -= (__u16)((char *)&snmp->data - (char *)cmd);
+	else
+		data_len -= (__u16)((char*)&snmp->request - (char *)cmd);
+
+	/* check if there is enough room in userspace */
+	if ((qinfo->udata_len - qinfo->udata_offset) < data_len) {
+		QETH_DBF_TEXT_(trace, 4, "scer3%i", -ENOMEM);
+		cmd->hdr.return_code = -ENOMEM;
+		return 0;
+	}
+	QETH_DBF_TEXT_(trace, 4, "snore%i",
+		       cmd->data.setadapterparms.hdr.used_total);
+	QETH_DBF_TEXT_(trace, 4, "sseqn%i", cmd->data.setadapterparms.hdr.seq_no);
+	/*copy entries to user buffer*/
+	if (cmd->data.setadapterparms.hdr.seq_no == 1) {
+		memcpy(qinfo->udata + qinfo->udata_offset,
+		       (char *)snmp,
+		       data_len + offsetof(struct qeth_snmp_cmd,data));
+		qinfo->udata_offset += offsetof(struct qeth_snmp_cmd, data);
+	} else {
+		memcpy(qinfo->udata + qinfo->udata_offset,
+		       (char *)&snmp->request, data_len);
+	}
+	qinfo->udata_offset += data_len;
+	/* check if all replies received ... */
+		QETH_DBF_TEXT_(trace, 4, "srtot%i",
+			       cmd->data.setadapterparms.hdr.used_total);
+		QETH_DBF_TEXT_(trace, 4, "srseq%i",
+			       cmd->data.setadapterparms.hdr.seq_no);
+	if (cmd->data.setadapterparms.hdr.seq_no <
+	    cmd->data.setadapterparms.hdr.used_total)
+		return 1;
+	return 0;
+}
 
 static struct qeth_cmd_buffer *
-qeth_get_setassparms_cmd(struct qeth_card *, enum qeth_ipa_funcs,
-			 __u16, __u16, enum qeth_prot_versions);
+qeth_get_ipacmd_buffer(struct qeth_card *, enum qeth_ipa_cmds,
+		       enum qeth_prot_versions );
+
+static struct qeth_cmd_buffer *
+qeth_get_adapter_cmd(struct qeth_card *card, __u32 command, __u32 cmdlen)
+{
+	struct qeth_cmd_buffer *iob;
+	struct qeth_ipa_cmd *cmd;
+
+	iob = qeth_get_ipacmd_buffer(card,IPA_CMD_SETADAPTERPARMS,
+				     QETH_PROT_IPV4);
+	cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
+	cmd->data.setadapterparms.hdr.cmdlength = cmdlen;
+	cmd->data.setadapterparms.hdr.command_code = command;
+	cmd->data.setadapterparms.hdr.used_total = 1;
+	cmd->data.setadapterparms.hdr.seq_no = 1;
+
+	return iob;
+}
+
+/**
+ * function to send SNMP commands to OSA-E card
+ */
+static int
+qeth_snmp_command(struct qeth_card *card, char *udata)
+{
+	struct qeth_cmd_buffer *iob;
+	struct qeth_ipa_cmd *cmd;
+	struct qeth_snmp_ureq *ureq;
+	int req_len;
+	struct qeth_arp_query_info qinfo = {0, };
+	int rc = 0;
+
+	QETH_DBF_TEXT(trace,3,"snmpcmd");
+
+	if (card->info.guestlan)
+		return -EOPNOTSUPP;
+	if (!qeth_adp_supported(card,IPA_SETADP_SET_SNMP_CONTROL)) {
+		PRINT_WARN("SNMP Query MIBS not supported "
+			   "on %s!\n", card->info.if_name);
+		return -EOPNOTSUPP;
+	}
+	/* skip 4 bytes (data_len struct member) to get req_len */
+	if (copy_from_user(&req_len, udata + sizeof(int), sizeof(int)))
+		return -EFAULT;
+	ureq = kmalloc(req_len, GFP_KERNEL);
+	if (!ureq) {
+		QETH_DBF_TEXT(trace, 2, "snmpnome");
+		return -ENOMEM;
+	}
+	if (copy_from_user(ureq, udata, req_len)){
+		kfree(ureq);
+		return -EFAULT;
+	}
+	qinfo.udata_len = ureq->hdr.data_len;
+	if (!(qinfo.udata = kmalloc(qinfo.udata_len, GFP_KERNEL))){
+		kfree(ureq);
+		return -ENOMEM;
+	}
+	memset(qinfo.udata, 0, qinfo.udata_len);
+	qinfo.udata_offset = sizeof(struct qeth_snmp_ureq_hdr);
+
+	iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL,
+				   QETH_SNMP_SETADP_CMDLENGTH + req_len);
+	cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
+	memcpy(&cmd->data.setadapterparms.data.snmp, &ureq->cmd, req_len);
+	rc = qeth_send_ipa_snmp_cmd(card, iob, QETH_SETADP_BASE_LEN + req_len,
+				    qeth_snmp_command_cb, (void *)&qinfo);
+	if (rc)
+		PRINT_WARN("SNMP command failed on %s: (0x%x)\n",
+			   card->info.if_name, rc);
+	 else
+		copy_to_user(udata, qinfo.udata, qinfo.udata_len);
+
+	kfree(ureq);
+	kfree(qinfo.udata);
+	return rc;
+}
+
+static int
+qeth_default_setassparms_cb(struct qeth_card *, struct qeth_reply *,
+			    unsigned long);
 
 static int
 qeth_send_setassparms(struct qeth_card *, struct qeth_cmd_buffer *,
@@ -4101,9 +4377,9 @@
 		tmp = rc;
 		qeth_ipaddr4_to_string((u8 *)entry->ipaddr, buf);
 		PRINT_WARN("Could not add ARP entry for address %s on %s: "
-			   "%s (0x%x)\n",
+			   "%s (0x%x/%d)\n",
 			   buf, card->info.if_name,
-			   qeth_arp_get_error_cause(&rc), tmp);
+			   qeth_arp_get_error_cause(&rc), tmp, tmp);
 	}
 	return rc;
 }
@@ -4144,9 +4420,9 @@
 		memset(buf, 0, 16);
 		qeth_ipaddr4_to_string((u8 *)entry->ipaddr, buf);
 		PRINT_WARN("Could not delete ARP entry for address %s on %s: "
-			   "%s (0x%x)\n",
+			   "%s (0x%x/%d)\n",
 			   buf, card->info.if_name,
-			   qeth_arp_get_error_cause(&rc), tmp);
+			   qeth_arp_get_error_cause(&rc), tmp, tmp);
 	}
 	return rc;
 }
@@ -4165,7 +4441,7 @@
 	 * funcs flags); since all zeros is no valueable information,
 	 * we say EOPNOTSUPP for all ARP functions
 	 */
-	if (card->info.guestlan)
+	if (card->info.guestlan || (card->info.type == QETH_CARD_TYPE_IQD))
 		return -EOPNOTSUPP;
 	if (!qeth_is_supported(card,IPA_ARP_PROCESSING)) {
 		PRINT_WARN("ARP processing not supported "
@@ -4176,9 +4452,9 @@
 					  IPA_CMD_ASS_ARP_FLUSH_CACHE, 0);
 	if (rc){
 		tmp = rc;
-		PRINT_WARN("Could not flush ARP cache on %s: %s (0x%x)\n",
+		PRINT_WARN("Could not flush ARP cache on %s: %s (0x%x/%d)\n",
 			   card->info.if_name, qeth_arp_get_error_cause(&rc),
-			   tmp);
+			   tmp, tmp);
 	}
 	return rc;
 }
@@ -4198,7 +4474,6 @@
 		return -ENODEV;
 
 	switch (cmd){
-	case SIOCDEVPRIVATE:
 	case SIOC_QETH_ARP_SET_NO_ENTRIES:
 		if (!capable(CAP_NET_ADMIN)){
 			rc = -EPERM;
@@ -4206,7 +4481,6 @@
 		}
 		rc = qeth_arp_set_no_entries(card, rq->ifr_ifru.ifru_ivalue);
 		break;
-	case SIOCDEVPRIVATE+1:
 	case SIOC_QETH_ARP_QUERY_INFO:
 		if (!capable(CAP_NET_ADMIN)){
 			rc = -EPERM;
@@ -4214,7 +4488,6 @@
 		}
 		rc = qeth_arp_query(card, rq->ifr_ifru.ifru_data);
 		break;
-	case SIOCDEVPRIVATE+2:
 	case SIOC_QETH_ARP_ADD_ENTRY:
 		if (!capable(CAP_NET_ADMIN)){
 			rc = -EPERM;
@@ -4226,7 +4499,6 @@
 		else
 			rc = qeth_arp_add_entry(card, &arp_entry);
 		break;
-	case SIOCDEVPRIVATE+3:
 	case SIOC_QETH_ARP_REMOVE_ENTRY:
 		if (!capable(CAP_NET_ADMIN)){
 			rc = -EPERM;
@@ -4238,7 +4510,6 @@
 		else
 			rc = qeth_arp_remove_entry(card, &arp_entry);
 		break;
-	case SIOCDEVPRIVATE+4:
 	case SIOC_QETH_ARP_FLUSH_CACHE:
 		if (!capable(CAP_NET_ADMIN)){
 			rc = -EPERM;
@@ -4246,18 +4517,21 @@
 		}
 		rc = qeth_arp_flush_cache(card);
 		break;
-	case SIOCDEVPRIVATE+5:
 	case SIOC_QETH_ADP_SET_SNMP_CONTROL:
+		rc = qeth_snmp_command(card, rq->ifr_ifru.ifru_data);
 		break;
-	case SIOCDEVPRIVATE+6:
 	case SIOC_QETH_GET_CARD_TYPE:
+		if ((card->info.type == QETH_CARD_TYPE_OSAE) &&
+		    !card->info.guestlan)
+			return 1;
+		return 0;
 		break;
 	case SIOCGMIIPHY:
-		mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data;
+		mii_data = if_mii(rq);
 		mii_data->phy_id = 0;
 		break;
 	case SIOCGMIIREG:
-		mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data;
+		mii_data = if_mii(rq);
 		if (mii_data->phy_id != 0)
 			rc = -EINVAL;
 		else
@@ -4272,7 +4546,7 @@
 			rc = -EPERM;
 			break;
 		}
-		mii_data = (struct mii_ioctl_data *) &rq->ifr_ifru.ifru_data;
+		mii_data = if_mii(rq);
 		if (mii_data->phy_id != 0)
 			rc = -EINVAL;
 		else
@@ -4282,6 +4556,8 @@
 	default:
 		rc = -EOPNOTSUPP;
 	}
+	if (rc)
+		QETH_DBF_TEXT_(trace, 2, "ioce%d", rc);
 	return rc;
 }
 
@@ -4325,27 +4601,124 @@
 qeth_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 {
 	struct qeth_card *card;
+	unsigned long flags;
 
 	QETH_DBF_TEXT(trace,4,"vlanreg");
 
 	card = (struct qeth_card *) dev->priv;
-	spin_lock_irq(&card->vlanlock);
+	spin_lock_irqsave(&card->vlanlock, flags);
 	card->vlangrp = grp;
-	spin_unlock_irq(&card->vlanlock);
+	spin_unlock_irqrestore(&card->vlanlock, flags);
+}
+
+static inline void
+qeth_free_vlan_buffer(struct qeth_card *card, struct qeth_qdio_out_buffer *buf,
+		      unsigned short vid)
+{
+	int i;
+	struct sk_buff *skb;
+	struct sk_buff_head tmp_list;
+
+	skb_queue_head_init(&tmp_list);
+	for(i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i){
+		while ((skb = skb_dequeue(&buf->skb_list))){
+			if (vlan_tx_tag_present(skb) &&
+			    (vlan_tx_tag_get(skb) == vid)) {
+				atomic_dec(&skb->users);
+				dev_kfree_skb(skb);
+			} else
+				skb_queue_tail(&tmp_list, skb);
+		}
+	}
+	while ((skb = skb_dequeue(&tmp_list)))
+		skb_queue_tail(&buf->skb_list, skb);
+}
+
+static void
+qeth_free_vlan_skbs(struct qeth_card *card, unsigned short vid)
+{
+	int i, j;
+
+	QETH_DBF_TEXT(trace, 4, "frvlskbs");
+	for (i = 0; i < card->qdio.no_out_queues; ++i){
+		for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; ++j)
+			qeth_free_vlan_buffer(card, &card->qdio.
+					      out_qs[i]->bufs[j], vid);
+	}
+}
+
+static void
+qeth_free_vlan_addresses4(struct qeth_card *card, unsigned short vid)
+{
+	struct in_device *in_dev;
+	struct in_ifaddr *ifa;
+	struct qeth_ipaddr *addr;
+
+	QETH_DBF_TEXT(trace, 4, "frvaddr4");
+	if (!card->vlangrp)
+		return;
+	in_dev = in_dev_get(card->vlangrp->vlan_devices[vid]);
+	if (!in_dev)
+		return;
+	for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next){
+		addr = qeth_get_addr_buffer(QETH_PROT_IPV4);
+		if (addr){
+			addr->u.a4.addr = ifa->ifa_address;
+			addr->u.a4.mask = ifa->ifa_mask;
+			addr->type = QETH_IP_TYPE_NORMAL;
+			if (!qeth_delete_ip(card, addr))
+				kfree(addr);
+		}
+	}
+	in_dev_put(in_dev);
+}
+
+static void
+qeth_free_vlan_addresses6(struct qeth_card *card, unsigned short vid)
+{
+	struct inet6_dev *in6_dev;
+	struct inet6_ifaddr *ifa;
+	struct qeth_ipaddr *addr;
+
+	QETH_DBF_TEXT(trace, 4, "frvaddr6");
+	if (!card->vlangrp)
+		return;
+	in6_dev = in6_dev_get(card->vlangrp->vlan_devices[vid]);
+	if (!in6_dev)
+		return;
+	for (ifa = in6_dev->addr_list; ifa; ifa = ifa->lst_next){
+		addr = qeth_get_addr_buffer(QETH_PROT_IPV6);
+		if (addr){
+			memcpy(&addr->u.a6.addr, &ifa->addr,
+			       sizeof(struct in6_addr));
+			addr->u.a6.pfxlen = ifa->prefix_len;
+			addr->type = QETH_IP_TYPE_NORMAL;
+			if (!qeth_delete_ip(card, addr))
+				kfree(addr);
+		}
+	}
+	in6_dev_put(in6_dev);
 }
 
 static void
 qeth_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
 {
 	struct qeth_card *card;
+	unsigned long flags;
 
 	QETH_DBF_TEXT(trace,4,"vlkilvid");
 
 	card = (struct qeth_card *) dev->priv;
-	spin_lock_irq(&card->vlanlock);
+	/* free all skbs for the vlan device */
+	qeth_free_vlan_skbs(card, vid);
+	spin_lock_irqsave(&card->vlanlock, flags);
+	/* unregister IP addresses of vlan device */
+	qeth_free_vlan_addresses4(card, vid);
+	qeth_free_vlan_addresses6(card, vid);
 	if (card->vlangrp)
 		card->vlangrp->vlan_devices[vid] = NULL;
-	spin_unlock_irq(&card->vlanlock);
+	spin_unlock_irqrestore(&card->vlanlock, flags);
+	qeth_set_thread_start_bit(card, QETH_SET_IP_THREAD);
 	/* delete mc addresses for this vlan dev */
 	qeth_set_thread_start_bit(card, QETH_SET_MC_THREAD);
 	schedule_work(&card->kernel_thread_starter);
@@ -4401,10 +4774,6 @@
 	memset(addr,0,sizeof(struct qeth_ipaddr));
 	addr->type = QETH_IP_TYPE_NORMAL;
 	addr->proto = prot;
-	addr->is_multicast = 0;
-	addr->users = 0;
-	addr->set_flags = 0;
-	addr->del_flags = 0;
 	return addr;
 }
 
@@ -4811,6 +5180,26 @@
 	return 0;
 }
 
+static void
+qeth_init_func_level(struct qeth_card *card)
+{
+	if (card->ipato.enabled) {
+		if (card->info.type == QETH_CARD_TYPE_IQD)
+				card->info.func_level =
+					QETH_IDX_FUNC_LEVEL_IQD_ENA_IPAT;
+		else
+				card->info.func_level =
+					QETH_IDX_FUNC_LEVEL_OSAE_ENA_IPAT;
+	} else {
+		if (card->info.type == QETH_CARD_TYPE_IQD)
+			card->info.func_level =
+				QETH_IDX_FUNC_LEVEL_IQD_DIS_IPAT;
+		else
+			card->info.func_level =
+				QETH_IDX_FUNC_LEVEL_OSAE_DIS_IPAT;
+	}
+}
+
 /**
  * hardsetup card, initialize MPC and QDIO stuff
  */
@@ -4848,6 +5237,7 @@
 		return rc;
 	}
 	qeth_init_tokens(card);
+	qeth_init_func_level(card);
 	rc = qeth_idx_activate_channel(&card->read, qeth_idx_read_cb);
 	if (rc == -ERESTARTSYS) {
 		QETH_DBF_TEXT(setup, 2, "break2");
@@ -4885,7 +5275,6 @@
 			QETH_DBF_TEXT_(setup, 2, "6err%d", rc);
 			goto out;
 		}
-		qeth_set_device_name(card);
 		card->dev->priv = card;
 		card->dev->type = qeth_get_arphdr_type(card->info.type,
 						       card->info.link_type);
@@ -4897,24 +5286,6 @@
 	return rc;
 }
 
-static struct qeth_cmd_buffer *
-qeth_get_adapter_cmd(struct qeth_card *card, __u32 command)
-{
-	struct qeth_cmd_buffer *iob;
-	struct qeth_ipa_cmd *cmd;
-
-	iob = qeth_get_ipacmd_buffer(card,IPA_CMD_SETADAPTERPARMS,
-				     QETH_PROT_IPV4);
-	cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
-	cmd->data.setadapterparms.cmdlength =
-				sizeof(struct qeth_ipacmd_setadpparms);
-	cmd->data.setadapterparms.command_code = command;
-	cmd->data.setadapterparms.frames_used_total = 1;
-	cmd->data.setadapterparms.frame_seq_no = 1;
-
-	return iob;
-}
-
 static int
 qeth_default_setassparms_cb(struct qeth_card *card, struct qeth_reply *reply,
 			    unsigned long data)
@@ -4952,7 +5323,7 @@
 
 	cmd = (struct qeth_ipa_cmd *) data;
 	if (cmd->hdr.return_code == 0)
-		cmd->hdr.return_code = cmd->data.setadapterparms.return_code;
+		cmd->hdr.return_code = cmd->data.setadapterparms.hdr.return_code;
 	return 0;
 }
 
@@ -4980,7 +5351,8 @@
 	struct qeth_cmd_buffer *iob;
 
 	QETH_DBF_TEXT(trace,3,"queryadp");
-	iob = qeth_get_adapter_cmd(card,IPA_SETADP_QUERY_COMMANDS_SUPPORTED);
+	iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_COMMANDS_SUPPORTED,
+				   sizeof(struct qeth_ipacmd_setadpparms));
 	rc = qeth_send_ipa_cmd(card, iob, qeth_query_setadapterparms_cb, NULL);
 	return rc;
 }
@@ -5010,7 +5382,8 @@
 
 	QETH_DBF_TEXT(trace,4,"chgmac");
 
-	iob = qeth_get_adapter_cmd(card,IPA_SETADP_ALTER_MAC_ADDRESS);
+	iob = qeth_get_adapter_cmd(card,IPA_SETADP_ALTER_MAC_ADDRESS,
+				   sizeof(struct qeth_ipacmd_setadpparms));
 	cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
 	cmd->data.setadapterparms.data.change_addr.cmd = CHANGE_ADDR_READ_MAC;
 	cmd->data.setadapterparms.data.change_addr.addr_size = OSA_ADDR_LEN;
@@ -5030,7 +5403,8 @@
 
 	QETH_DBF_TEXT(trace,4,"adpmode");
 
-	iob = qeth_get_adapter_cmd(card, command);
+	iob = qeth_get_adapter_cmd(card, command,
+				   sizeof(struct qeth_ipacmd_setadpparms));
 	cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
 	cmd->data.setadapterparms.data.mode = mode;
 	rc = qeth_send_ipa_cmd(card, iob, qeth_default_setadapterparms_cb,
@@ -5459,18 +5833,20 @@
 	int rc;
 
 	QETH_DBF_TEXT(trace,3,"stbrdcst");
+	card->info.broadcast_capable = 0;
 	if (!qeth_is_supported(card, IPA_FILTERING)) {
 		PRINT_WARN("Broadcast not supported on %s\n",
 			   card->info.if_name);
-		return -EOPNOTSUPP;
+		rc = -EOPNOTSUPP;
+		goto out;
 	}
 	rc = qeth_send_simple_setassparms(card, IPA_FILTERING,
 					  IPA_CMD_ASS_START, 0);
 	if (rc) {
-		PRINT_WARN("Could not enable broadcasting "
+		PRINT_WARN("Could not enable broadcasting filtering "
 			   "on %s: 0x%x\n",
 			   card->info.if_name, rc);
-		return rc;
+		goto out;
 	}
 
 	rc = qeth_send_simple_setassparms(card, IPA_FILTERING,
@@ -5478,12 +5854,24 @@
 	if (rc) {
 		PRINT_WARN("Could not set up broadcast filtering on %s: 0x%x\n",
 			   card->info.if_name, rc);
-		return rc;
+		goto out;
 	}
+	card->info.broadcast_capable = QETH_BROADCAST_WITH_ECHO;
 	PRINT_INFO("Broadcast enabled \n");
-	card->dev->flags |= IFF_BROADCAST;
-	card->info.broadcast_capable = 1;
-	return 0;
+	rc = qeth_send_simple_setassparms(card, IPA_FILTERING,
+					  IPA_CMD_ASS_ENABLE, 1);
+	if (rc) {
+		PRINT_WARN("Could not set up broadcast echo filtering on "
+			   "%s: 0x%x\n", card->info.if_name, rc);
+		goto out;
+	}
+	card->info.broadcast_capable = QETH_BROADCAST_WITHOUT_ECHO;
+out:
+	if (card->info.broadcast_capable)
+		card->dev->flags |= IFF_BROADCAST;
+	else
+		card->dev->flags &= ~IFF_BROADCAST;
+	return rc;
 }
 
 static int
@@ -5781,7 +6169,6 @@
 qeth_clear_ip_list(struct qeth_card *card, int clean, int recover)
 {
 	struct qeth_ipaddr *addr, *tmp;
-	int first_run = 1;
 	unsigned long flags;
 
 	QETH_DBF_TEXT(trace,4,"clearip");
@@ -5791,29 +6178,21 @@
 		list_del(&addr->entry);
 		kfree(addr);
 	}
-again:
-	if (first_run)
-		first_run = 0;
-	else
-		spin_lock_irqsave(&card->ip_lock, flags);
 
-	list_for_each_entry_safe(addr, tmp, &card->ip_list, entry) {
+	while (!list_empty(&card->ip_list)) {
+		addr = list_entry(card->ip_list.next,
+				  struct qeth_ipaddr, entry);
 		list_del_init(&addr->entry);
-		if (clean){
+		if (clean) {
 			spin_unlock_irqrestore(&card->ip_lock, flags);
 			qeth_deregister_addr_entry(card, addr);
+			spin_lock_irqsave(&card->ip_lock, flags);
 		}
-		if (!recover || addr->is_multicast)
+		if (!recover || addr->is_multicast) {
 			kfree(addr);
-		else {
-			if (clean)
-				spin_lock_irqsave(&card->ip_lock, flags);
-			list_add_tail(&addr->entry, &card->ip_tbd_list);
-			if (clean) {
-				spin_unlock_irqrestore(&card->ip_lock, flags);
-				goto again;
-			}
+			continue;
 		}
+		list_add_tail(&addr->entry, &card->ip_tbd_list);
 	}
 	spin_unlock_irqrestore(&card->ip_lock, flags);
 }
@@ -6109,7 +6488,7 @@
 	qeth_set_allowed_threads(card, 0xffffffff, 0);
 	if (recover_flag == CARD_STATE_RECOVER)
 		qeth_start_again(card);
-
+	qeth_notify_processes();
 	return 0;
 out_remove:
 	card->use_hard_stop = 1;
@@ -6775,12 +7154,18 @@
 	int rc=0;
 
 	qeth_eyecatcher();
-	printk(KERN_INFO "qeth: loading %s\n",version);
+	PRINT_INFO("loading %s (%s/%s/%s/%s/%s/%s/%s %s %s)\n",
+		   version, VERSION_QETH_C, VERSION_QETH_H,
+		   VERSION_QETH_MPC_H, VERSION_QETH_MPC_C,
+		   VERSION_QETH_FS_H, VERSION_QETH_PROC_C,
+		   VERSION_QETH_SYS_C, QETH_VERSION_IPV6,
+		   QETH_VERSION_VLAN);
 
 	INIT_LIST_HEAD(&qeth_card_list.list);
+	INIT_LIST_HEAD(&qeth_notify_list);
+	spin_lock_init(&qeth_notify_lock);
 	rwlock_init(&qeth_card_list.rwlock);
 
-	atomic_set(&qeth_hsi_count, 0);
 	if (qeth_register_dbf_views())
 		goto out_err;
 	if (qeth_sysfs_register())
diff -Nru a/drivers/s390/net/qeth_mpc.c b/drivers/s390/net/qeth_mpc.c
--- a/drivers/s390/net/qeth_mpc.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/net/qeth_mpc.c	Tue Jun 15 22:20:41 2004
@@ -11,6 +11,8 @@
 #include <asm/cio.h>
 #include "qeth_mpc.h"
 
+const char *VERSION_QETH_MPC_C = "$Revision: 1.11 $";
+
 unsigned char IDX_ACTIVATE_READ[]={
 	0x00,0x00,0x80,0x00, 0x00,0x00,0x00,0x00,
 	0x19,0x01,0x01,0x80, 0x00,0x00,0x00,0x00,
@@ -129,8 +131,7 @@
 	0x00,0x00,0x00,0x14, 0x00,0x00,
 		(IPA_PDU_HEADER_SIZE+sizeof(struct qeth_ipa_cmd))/256,
 		(IPA_PDU_HEADER_SIZE+sizeof(struct qeth_ipa_cmd))%256,
-	0x10,0x00,0x00,0x01,
-	0x00,0x00,0x00,0x00,
+	0x10,0x00,0x00,0x01, 0x00,0x00,0x00,0x00,
 	0xc1,0x03,0x00,0x01, 0x00,0x00,0x00,0x00,
 	0x00,0x00,0x00,0x00, 0x00,0x24,
 		sizeof(struct qeth_ipa_cmd)/256,
diff -Nru a/drivers/s390/net/qeth_mpc.h b/drivers/s390/net/qeth_mpc.h
--- a/drivers/s390/net/qeth_mpc.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/s390/net/qeth_mpc.h	Tue Jun 15 22:20:40 2004
@@ -14,7 +14,9 @@
 
 #include <asm/qeth.h>
 
-#define VERSION_QETH_MPC_H "$Revision: 1.27 $"
+#define VERSION_QETH_MPC_H "$Revision: 1.35 $"
+
+extern const char *VERSION_QETH_MPC_C;
 
 #define IPA_PDU_HEADER_SIZE	0x40
 #define QETH_IPA_PDU_LEN_TOTAL(buffer) (buffer+0x0e)
@@ -33,6 +35,7 @@
 #define OSA_ADDR_LEN		6
 
 #define QETH_TIMEOUT 		(10 * HZ)
+#define QETH_IPA_TIMEOUT 	(45 * HZ)
 #define QETH_IDX_COMMAND_SEQNO 	-1
 #define SR_INFO_LEN		16
 
@@ -245,12 +248,29 @@
 	__u8 seq_no;
 } __attribute__((packed));
 
+struct qeth_arp_query_data {
+	__u16 request_bits;
+	__u16 reply_bits;
+	__u32 no_entries;
+	char data;
+} __attribute__((packed));
+
+/* used as parameter for arp_query reply */
+struct qeth_arp_query_info {
+	__u32 udata_len;
+	__u16 mask_bits;
+	__u32 udata_offset;
+	__u32 no_entries;
+	char *udata;
+};
+
 /* SETASSPARMS IPA Command: */
 struct qeth_ipacmd_setassparms {
 	struct qeth_ipacmd_setassparms_hdr hdr;
 	union {
 		__u32 flags_32bit;
 		struct qeth_arp_cache_entry add_arp_entry;
+		struct qeth_arp_query_data query_arp;
 		__u8 ip[16];
 	} data;
 } __attribute__ ((packed));
@@ -277,19 +297,47 @@
 	__u8 addr[OSA_ADDR_LEN];
 } __attribute__ ((packed));
 
-struct qeth_ipacmd_setadpparms {
+
+struct qeth_snmp_cmd {
+	__u8  token[16];
+	__u32 request;
+	__u32 interface;
+	__u32 returncode;
+	__u32 firmwarelevel;
+	__u32 seqno;
+	__u8  data;
+} __attribute__ ((packed));
+
+struct qeth_snmp_ureq_hdr {
+	__u32   data_len;
+	__u32   req_len;
+	__u32   reserved1;
+	__u32   reserved2;
+} __attribute__ ((packed));
+
+struct qeth_snmp_ureq {
+	struct qeth_snmp_ureq_hdr hdr;
+	struct qeth_snmp_cmd cmd;
+} __attribute__((packed));
+
+struct qeth_ipacmd_setadpparms_hdr {
 	__u32 supp_hw_cmds;
 	__u32 reserved1;
 	__u16 cmdlength;
 	__u16 reserved2;
 	__u32 command_code;
 	__u16 return_code;
-	__u8 frames_used_total;
-	__u8 frame_seq_no;
+	__u8  used_total;
+	__u8  seq_no;
 	__u32 reserved3;
+} __attribute__ ((packed));
+
+struct qeth_ipacmd_setadpparms {
+	struct qeth_ipacmd_setadpparms_hdr hdr;
 	union {
 		struct qeth_query_cmds_supp query_cmds_supp;
 		struct qeth_change_addr change_addr;
+		struct qeth_snmp_cmd snmp;
 		__u32 mode;
 	} data;
 } __attribute__ ((packed));
@@ -357,36 +405,16 @@
 	QETH_IPA_ARP_RC_Q_NO_DATA    = 0x0008,
 };
 
-#define QETH_QARP_DATA_SIZE 3968
-struct qeth_arp_query_data {
-	__u16 request_bits;
-	__u16 reply_bits;
-	__u32 no_entries;
-	char data[QETH_QARP_DATA_SIZE];
-} __attribute__((packed));
-
-/* used as parameter for arp_query reply */
-struct qeth_arp_query_info {
-	__u32 udata_len;
-	__u32 udata_offset;
-	__u32 no_entries;
-	char *udata;
-};
-
-#define IPA_ARP_CMD_LEN (IPA_PDU_HEADER_SIZE+sizeof(struct qeth_ipa_arp_cmd))
-#define QETH_ARP_CMD_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
+#define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
 			       sizeof(struct qeth_ipacmd_setassparms_hdr))
 #define QETH_IPA_ARP_DATA_POS(buffer) (buffer + IPA_PDU_HEADER_SIZE + \
-				       QETH_ARP_CMD_BASE_LEN)
-struct qeth_ipa_arp_cmd {
-	struct qeth_ipacmd_hdr ihdr;
-	struct qeth_ipacmd_setassparms_hdr shdr;
-	union {
-		struct qeth_arp_query_data query_arp;
-	} data;
-} __attribute__((packed));
-
+				       QETH_SETASS_BASE_LEN)
+#define QETH_SETADP_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \
+			      sizeof(struct qeth_ipacmd_setadpparms_hdr))
+#define QETH_SNMP_SETADP_CMDLENGTH 16
 
+#define QETH_ARP_DATA_SIZE 3968
+#define QETH_ARP_CMD_LEN (QETH_ARP_DATA_SIZE + 8)
 /* Helper functions */
 #define IS_IPA_REPLY(cmd) (cmd->hdr.initiator == IPA_CMD_INITIATOR_HOST)
 
diff -Nru a/drivers/s390/net/qeth_proc.c b/drivers/s390/net/qeth_proc.c
--- a/drivers/s390/net/qeth_proc.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/net/qeth_proc.c	Tue Jun 15 22:20:41 2004
@@ -1,6 +1,6 @@
 /*
  *
- * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.5 $)
+ * linux/drivers/s390/net/qeth_fs.c ($Revision: 1.10 $)
  *
  * Linux on zSeries OSA Express and HiperSockets support
  * This file contains code related to procfs.
@@ -21,6 +21,8 @@
 #include "qeth_mpc.h"
 #include "qeth_fs.h"
 
+const char *VERSION_QETH_PROC_C = "$Revision: 1.10 $";
+
 /***** /proc/qeth *****/
 #define QETH_PROCFILE_NAME "qeth"
 static struct proc_dir_entry *qeth_procfile;
@@ -91,13 +93,19 @@
 		return "pri";
 	else if (routing_type == SECONDARY_ROUTER)
 		return "sec";
-	else if (routing_type == MULTICAST_ROUTER)
+	else if (routing_type == MULTICAST_ROUTER) {
+		if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
+			return "mc+";
 		return "mc";
-	else if (routing_type == PRIMARY_CONNECTOR)
+	} else if (routing_type == PRIMARY_CONNECTOR) {
+		if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
+			return "p+c";
 		return "p.c";
-	else if (routing_type == SECONDARY_CONNECTOR)
+	} else if (routing_type == SECONDARY_CONNECTOR) {
+		if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
+			return "s+c";
 		return "s.c";
-	else if (routing_type == NO_ROUTER)
+	} else if (routing_type == NO_ROUTER)
 		return "no";
 	else
 		return "unk";
@@ -229,9 +237,11 @@
 		   card->perf_stats.bufs_sent_pack
 		  );
 	seq_printf(s, "  Packing state changes no pkg.->packing : %i/%i\n"
+		      "  Watermarks L/H                         : %i/%i\n"
 		      "  Current buffer usage (outbound q's)    : "
 		      "%i/%i/%i/%i\n\n",
 		        card->perf_stats.sc_dp_p, card->perf_stats.sc_p_dp,
+			QETH_LOW_WATERMARK_PACK, QETH_HIGH_WATERMARK_PACK,
 			atomic_read(&card->qdio.out_qs[0]->used_buffers),
 			(card->qdio.no_out_queues > 1)?
 				atomic_read(&card->qdio.out_qs[1]->used_buffers)
@@ -243,16 +253,26 @@
 				atomic_read(&card->qdio.out_qs[3]->used_buffers)
 				: 0
 		  );
-	seq_printf(s, "  Inbound time (in us)                   : %i\n"
-		      "  Inbound cnt                            : %i\n"
+	seq_printf(s, "  Inbound handler time (in us)           : %i\n"
+		      "  Inbound handler count                  : %i\n"
+		      "  Inbound do_QDIO time (in us)           : %i\n"
+		      "  Inbound do_QDIO count                  : %i\n\n"
+		      "  Outbound handler time (in us)          : %i\n"
+		      "  Outbound handler count                 : %i\n\n"
 		      "  Outbound time (in us, incl QDIO)       : %i\n"
-		      "  Outbound cnt                           : %i\n"
-		      "  Watermarks L/H                         : %i/%i\n\n",
+		      "  Outbound count                         : %i\n"
+		      "  Outbound do_QDIO time (in us)          : %i\n"
+		      "  Outbound do_QDIO count                 : %i\n",
 		        card->perf_stats.inbound_time,
 			card->perf_stats.inbound_cnt,
+		        card->perf_stats.inbound_do_qdio_time,
+			card->perf_stats.inbound_do_qdio_cnt,
+			card->perf_stats.outbound_handler_time,
+			card->perf_stats.outbound_handler_cnt,
 			card->perf_stats.outbound_time,
 			card->perf_stats.outbound_cnt,
-			QETH_LOW_WATERMARK_PACK, QETH_HIGH_WATERMARK_PACK
+		        card->perf_stats.outbound_do_qdio_time,
+			card->perf_stats.outbound_do_qdio_cnt
 		  );
 
 	return 0;
diff -Nru a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c
--- a/drivers/s390/net/qeth_sys.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/net/qeth_sys.c	Tue Jun 15 22:20:41 2004
@@ -1,6 +1,6 @@
 /*
  *
- * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.24 $)
+ * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.32 $)
  *
  * Linux on zSeries OSA Express and HiperSockets support
  * This file contains code related to sysfs.
@@ -20,6 +20,8 @@
 #include "qeth_mpc.h"
 #include "qeth_fs.h"
 
+const char *VERSION_QETH_SYS_C = "$Revision: 1.32 $";
+
 /*****************************************************************************/
 /*                                                                           */
 /*          /sys-fs stuff UNDER DEVELOPMENT !!!                              */
@@ -320,7 +322,8 @@
 		qeth_dev_bufcnt_store);
 
 static inline ssize_t
-qeth_dev_route_show(struct qeth_routing_info *route, char *buf)
+qeth_dev_route_show(struct qeth_card *card, struct qeth_routing_info *route,
+		    char *buf)
 {
 	switch (route->type) {
 	case PRIMARY_ROUTER:
@@ -328,11 +331,20 @@
 	case SECONDARY_ROUTER:
 		return sprintf(buf, "%s\n", "secondary router");
 	case MULTICAST_ROUTER:
-		return sprintf(buf, "%s\n", "multicast router");
+		if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
+			return sprintf(buf, "%s\n", "multicast router+");
+		else
+			return sprintf(buf, "%s\n", "multicast router");
 	case PRIMARY_CONNECTOR:
-		return sprintf(buf, "%s\n", "primary connector");
+		if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
+			return sprintf(buf, "%s\n", "primary connector+");
+		else
+			return sprintf(buf, "%s\n", "primary connector");
 	case SECONDARY_CONNECTOR:
-		return sprintf(buf, "%s\n", "secondary connector");
+		if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
+			return sprintf(buf, "%s\n", "secondary connector+");
+		else
+			return sprintf(buf, "%s\n", "secondary connector");
 	default:
 		return sprintf(buf, "%s\n", "no");
 	}
@@ -346,7 +358,7 @@
 	if (!card)
 		return -EINVAL;
 
-	return qeth_dev_route_show(&card->options.route4, buf);
+	return qeth_dev_route_show(card, &card->options.route4, buf);
 }
 
 static inline ssize_t
@@ -414,7 +426,7 @@
 	if (!qeth_is_supported(card, IPA_IPV6))
 		return sprintf(buf, "%s\n", "n/a");
 
-	return qeth_dev_route_show(&card->options.route6, buf);
+	return qeth_dev_route_show(card, &card->options.route6, buf);
 }
 
 static ssize_t
@@ -737,6 +749,10 @@
 	if (!card)
 		return -EINVAL;
 
+	if ((card->state != CARD_STATE_DOWN) &&
+	    (card->state != CARD_STATE_RECOVER))
+		return -EPERM;
+
 	tmp = strsep((char **) &buf, "\n");
 	if (!strcmp(tmp, "toggle")){
 		card->ipato.enabled = (card->ipato.enabled)? 0 : 1;
@@ -1426,22 +1442,33 @@
 static DRIVER_ATTR(group, 0200, 0, qeth_driver_group_store);
 
 static ssize_t
-qeth_driver_snmp_register_show(struct device_driver *ddrv, char *buf)
-{
-	/* TODO */
-	return 0;
-}
-
-static ssize_t
-qeth_driver_snmp_register_store(struct device_driver *ddrv, const char *buf,
+qeth_driver_notifier_register_store(struct device_driver *ddrv, const char *buf,
 				size_t count)
 {
-	/* TODO */
+	int rc;
+	int signum;
+	char *tmp, *tmp2;
+
+	tmp = strsep((char **) &buf, "\n");
+	if (!strncmp(tmp, "unregister", 10)){
+		if ((rc = qeth_notifier_unregister(current)))
+			return rc;
+		return count;
+	}
+
+	signum = simple_strtoul(tmp, &tmp2, 10);
+	if ((signum < 0) || (signum > 32)){
+		PRINT_WARN("Signal number %d is out of range\n", signum);
+		return -EINVAL;
+	}
+	if ((rc = qeth_notifier_register(current, signum)))
+		return rc;
+
 	return count;
 }
 
-static DRIVER_ATTR(snmp_register, 0644, qeth_driver_snmp_register_show,
-		   qeth_driver_snmp_register_store);
+static DRIVER_ATTR(notifier_register, 0200, 0,
+		   qeth_driver_notifier_register_store);
 
 int
 qeth_create_driver_attributes(void)
@@ -1452,7 +1479,7 @@
 				     &driver_attr_group)))
 		return rc;
 	return driver_create_file(&qeth_ccwgroup_driver.driver,
-				  &driver_attr_snmp_register);
+				  &driver_attr_notifier_register);
 }
 
 void
@@ -1461,5 +1488,5 @@
 	driver_remove_file(&qeth_ccwgroup_driver.driver,
 			&driver_attr_group);
 	driver_remove_file(&qeth_ccwgroup_driver.driver,
-			&driver_attr_snmp_register);
+			&driver_attr_notifier_register);
 }
diff -Nru a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c
--- a/drivers/s390/s390mach.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/s390/s390mach.c	Tue Jun 15 22:21:05 2004
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
+#include <linux/workqueue.h>
 
 #include <asm/lowcore.h>
 
@@ -21,13 +22,14 @@
 // #define DBG(args,...) do {} while (0);
 
 static struct semaphore m_sem;
-static struct semaphore s_sem;
 
 extern int css_process_crw(int);
 extern int chsc_process_crw(void);
 extern int chp_process_crw(int, int);
 extern void css_reiterate_subchannels(void);
-extern void css_trigger_slow_path(void);
+
+extern struct workqueue_struct *slow_path_wq;
+extern struct work_struct slow_path_work;
 
 static void
 s390_handle_damage(char *msg)
@@ -39,21 +41,6 @@
 	disabled_wait((unsigned long) __builtin_return_address(0));
 }
 
-static int
-s390_mchk_slow_path(void *param)
-{
-	struct semaphore *sem;
-
-	sem = (struct semaphore *)param;
-	/* Set a nice name. */
-	daemonize("kslowcrw");
-repeat:
-	down_interruptible(sem);
-	css_trigger_slow_path();
-	goto repeat;
-	return 0;
-}
-
 /*
  * Retrieve CRWs and call function to handle event.
  *
@@ -130,7 +117,7 @@
 		}
 	}
 	if (slow)
-		up(&s_sem);
+		queue_work(slow_path_wq, &slow_path_work);
 	goto repeat;
 	return 0;
 }
@@ -202,7 +189,6 @@
 machine_check_init(void)
 {
 	init_MUTEX_LOCKED(&m_sem);
-	init_MUTEX_LOCKED( &s_sem );
 	ctl_clear_bit(14, 25);	/* disable damage MCH */
 	ctl_set_bit(14, 26);	/* enable degradation MCH */
 	ctl_set_bit(14, 27);	/* enable system recovery MCH */
@@ -226,7 +212,6 @@
 machine_check_crw_init (void)
 {
 	kernel_thread(s390_collect_crw_info, &m_sem, CLONE_FS|CLONE_FILES);
-	kernel_thread(s390_mchk_slow_path, &s_sem, CLONE_FS|CLONE_FILES);
 	ctl_set_bit(14, 28);	/* enable channel report MCH */
 	return 0;
 }
diff -Nru a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
--- a/drivers/s390/scsi/zfcp_aux.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/s390/scsi/zfcp_aux.c	Tue Jun 15 22:21:05 2004
@@ -29,7 +29,7 @@
  */
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_AUX_REVISION "$Revision: 1.107 $"
+#define ZFCP_AUX_REVISION "$Revision: 1.108 $"
 
 #include "zfcp_ext.h"
 
@@ -47,12 +47,6 @@
 static void zfcp_ns_gid_pn_handler(unsigned long);
 
 /* miscellaneous */
-#ifdef ZFCP_STAT_REQSIZES
-static int zfcp_statistics_init_all(void);
-static int zfcp_statistics_clear_all(void);
-static int zfcp_statistics_clear(struct list_head *);
-static int zfcp_statistics_new(struct list_head *, u32);
-#endif
 
 static inline int zfcp_sg_list_alloc(struct zfcp_sg_list *, size_t);
 static inline int zfcp_sg_list_free(struct zfcp_sg_list *);
@@ -136,96 +130,6 @@
 
 #define ZFCP_LOG_AREA			ZFCP_LOG_AREA_OTHER
 
-#ifdef ZFCP_STAT_REQSIZES
-
-static int
-zfcp_statistics_clear(struct list_head *head)
-{
-	int retval = 0;
-	unsigned long flags;
-	struct zfcp_statistics *stat, *tmp;
-
-	write_lock_irqsave(&zfcp_data.stat_lock, flags);
-	list_for_each_entry_safe(stat, tmp, head, list) {
-		list_del(&stat->list);
-		kfree(stat);
-	}
-	write_unlock_irqrestore(&zfcp_data.stat_lock, flags);
-
-	return retval;
-}
-
-/* Add new statistics entry */
-static int
-zfcp_statistics_new(struct list_head *head, u32 num)
-{
-	int retval = 0;
-	struct zfcp_statistics *stat;
-
-	stat = kmalloc(sizeof (struct zfcp_statistics), GFP_ATOMIC);
-	if (stat) {
-		memset(stat, 0, sizeof (struct zfcp_statistics));
-		stat->num = num;
-		stat->occurrence = 1;
-		list_add_tail(&stat->list, head);
-	} else
-		zfcp_data.stat_errors++;
-
-	return retval;
-}
-
-int
-zfcp_statistics_inc(struct list_head *head, u32 num)
-{
-	int retval = 0;
-	unsigned long flags;
-	struct zfcp_statistics *stat;
-
-	write_lock_irqsave(&zfcp_data.stat_lock, flags);
-	list_for_each_entry(stat, head, list) {
-		if (stat->num == num) {
-			stat->occurrence++;
-			goto unlock;
-		}
-	}
-	/* occurrence must be initialized to 1 */
-	zfcp_statistics_new(head, num);
- unlock:
-	write_unlock_irqrestore(&zfcp_data.stat_lock, flags);
-	return retval;
-}
-
-static int
-zfcp_statistics_init_all(void)
-{
-	int retval = 0;
-
-	rwlock_init(&zfcp_data.stat_lock);
-	INIT_LIST_HEAD(&zfcp_data.read_req_head);
-	INIT_LIST_HEAD(&zfcp_data.write_req_head);
-	INIT_LIST_HEAD(&zfcp_data.read_sg_head);
-	INIT_LIST_HEAD(&zfcp_data.write_sg_head);
-	INIT_LIST_HEAD(&zfcp_data.read_sguse_head);
-	INIT_LIST_HEAD(&zfcp_data.write_sguse_head);
-	return retval;
-}
-
-static int
-zfcp_statistics_clear_all(void)
-{
-	int retval = 0;
-
-	zfcp_statistics_clear(&zfcp_data.read_req_head);
-	zfcp_statistics_clear(&zfcp_data.write_req_head);
-	zfcp_statistics_clear(&zfcp_data.read_sg_head);
-	zfcp_statistics_clear(&zfcp_data.write_sg_head);
-	zfcp_statistics_clear(&zfcp_data.read_sguse_head);
-	zfcp_statistics_clear(&zfcp_data.write_sguse_head);
-	return retval;
-}
-
-#endif /* ZFCP_STAT_REQSIZES */
-
 static inline int
 zfcp_fsf_req_is_scsi_cmnd(struct zfcp_fsf_req *fsf_req)
 {
@@ -406,10 +310,6 @@
 	/* initialize adapters to be removed list head */
 	INIT_LIST_HEAD(&zfcp_data.adapter_remove_lh);
 
-#ifdef ZFCP_STAT_REQSIZES
-	zfcp_statistics_init_all();
-#endif
-
 #ifdef CONFIG_S390_SUPPORT
 	retval = register_ioctl32_conversion(zfcp_ioctl_trans.cmd,
 					     zfcp_ioctl_trans.handler);
@@ -459,9 +359,6 @@
 #ifdef CONFIG_S390_SUPPORT
 	unregister_ioctl32_conversion(zfcp_ioctl_trans.cmd);
  out_ioctl32:
-#endif
-#ifdef ZFCP_STAT_REQSIZES
-	zfcp_statistics_clear_all();
 #endif
 
  out:
diff -Nru a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
--- a/drivers/s390/scsi/zfcp_ccw.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/s390/scsi/zfcp_ccw.c	Tue Jun 15 22:20:38 2004
@@ -26,13 +26,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_CCW_C_REVISION "$Revision: 1.52 $"
+#define ZFCP_CCW_C_REVISION "$Revision: 1.55 $"
 
-#include <linux/init.h>
-#include <linux/module.h>
-#include <asm/ccwdev.h>
 #include "zfcp_ext.h"
-#include "zfcp_def.h"
 
 #define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_CONFIG
 
@@ -232,14 +228,19 @@
 	case CIO_GONE:
 		ZFCP_LOG_NORMAL("adapter %s: device gone\n",
 				zfcp_get_busid_by_adapter(adapter));
+		debug_text_event(adapter->erp_dbf,1,"dev_gone");
+		zfcp_erp_adapter_shutdown(adapter, 0);
 		break;
 	case CIO_NO_PATH:
 		ZFCP_LOG_NORMAL("adapter %s: no path\n",
 				zfcp_get_busid_by_adapter(adapter));
+		debug_text_event(adapter->erp_dbf,1,"no_path");
+		zfcp_erp_adapter_shutdown(adapter, 0);
 		break;
 	case CIO_OPER:
 		ZFCP_LOG_NORMAL("adapter %s: operational again\n",
 				zfcp_get_busid_by_adapter(adapter));
+		debug_text_event(adapter->erp_dbf,1,"dev_oper");
 		zfcp_erp_modify_adapter_status(adapter,
 					       ZFCP_STATUS_COMMON_RUNNING,
 					       ZFCP_SET);
@@ -247,6 +248,7 @@
 					ZFCP_STATUS_COMMON_ERP_FAILED);
 		break;
 	}
+	zfcp_erp_wait(adapter);
 	up(&zfcp_data.config_sema);
 	return 1;
 }
diff -Nru a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
--- a/drivers/s390/scsi/zfcp_def.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/s390/scsi/zfcp_def.h	Tue Jun 15 22:20:41 2004
@@ -33,7 +33,7 @@
 #define ZFCP_DEF_H
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_DEF_REVISION "$Revision: 1.72 $"
+#define ZFCP_DEF_REVISION "$Revision: 1.73 $"
 
 /*************************** INCLUDES *****************************************/
 
@@ -64,8 +64,6 @@
 /************************ DEBUG FLAGS *****************************************/
 
 #define	ZFCP_PRINT_FLAGS
-#define	ZFCP_STAT_REQSIZES
-#define	ZFCP_STAT_QUEUES
 
 /********************* GENERAL DEFINES *********************************/
 
@@ -1080,30 +1078,7 @@
 	char                    init_busid[BUS_ID_SIZE];
 	wwn_t                   init_wwpn;
 	fcp_lun_t               init_fcp_lun;
-#ifdef ZFCP_STAT_REQSIZES                            /* Statistical accounting
-							of processed data */
-	struct list_head	read_req_head;
-	struct list_head	write_req_head;
-	struct list_head	read_sg_head;
-	struct list_head	write_sg_head;
-	struct list_head	read_sguse_head;
-	struct list_head	write_sguse_head;
-	unsigned long		stat_errors;
-	rwlock_t		stat_lock;
-#endif
-#ifdef ZFCP_STAT_QUEUES
-        atomic_t                outbound_queue_full;
-	atomic_t		outbound_total;
-#endif
 };
-
-#ifdef ZFCP_STAT_REQSIZES
-struct zfcp_statistics {
-        struct list_head list;
-        u32 num;
-        u32 occurrence;
-};
-#endif
 
 struct zfcp_sg_list {
 	struct scatterlist *sg;
diff -Nru a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
--- a/drivers/s390/scsi/zfcp_erp.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/s390/scsi/zfcp_erp.c	Tue Jun 15 22:20:37 2004
@@ -31,7 +31,7 @@
 #define ZFCP_LOG_AREA			ZFCP_LOG_AREA_ERP
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_ERP_REVISION "$Revision: 1.51 $"
+#define ZFCP_ERP_REVISION "$Revision: 1.54 $"
 
 #include "zfcp_ext.h"
 
@@ -126,37 +126,6 @@
 static void zfcp_erp_timeout_handler(unsigned long);
 static inline void zfcp_erp_timeout_init(struct zfcp_erp_action *);
 
-/*
- * function:	zfcp_erp_adapter_shutdown_all
- *
- * purpose:	recursively calls zfcp_erp_adapter_shutdown to stop all
- *              IO on each adapter, return all outstanding packets and 
- *              relinquish all IRQs
- *              Note: This function waits for completion of all shutdowns
- *
- * returns:     0 in all cases
- */
-int
-zfcp_erp_adapter_shutdown_all(void)
-{
-	int retval = 0;
-	unsigned long flags;
-	struct zfcp_adapter *adapter;
-
-	read_lock_irqsave(&zfcp_data.config_lock, flags);
-	list_for_each_entry(adapter, &zfcp_data.adapter_list_head, list)
-	    zfcp_erp_adapter_shutdown(adapter, 0);
-	read_unlock_irqrestore(&zfcp_data.config_lock, flags);
-
-	/*
-	 * FIXME : need to take config_lock but cannot, since we schedule here.
-	 */
-	/* start all shutdowns first before any waiting to allow for concurreny */
-	list_for_each_entry(adapter, &zfcp_data.adapter_list_head, list)
-	    zfcp_erp_wait(adapter);
-
-	return retval;
-}
 
 /*
  * function:	zfcp_fsf_scsi_er_timeout_handler
@@ -2328,7 +2297,7 @@
 
 	if (qdio_establish(&adapter->qdio_init_data) != 0) {
 		ZFCP_LOG_INFO("error: establishment of QDIO queues failed "
-			      "on adapter %s\n.",
+			      "on adapter %s\n",
 			      zfcp_get_busid_by_adapter(adapter));
 		goto failed_qdio_establish;
 	}
@@ -2540,6 +2509,7 @@
 		atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
 				  &adapter->status);
 		ZFCP_LOG_DEBUG("Doing exchange config data\n");
+		zfcp_erp_action_to_running(erp_action);
 		zfcp_erp_timeout_init(erp_action);
 		if (zfcp_fsf_exchange_config_data(erp_action)) {
 			retval = ZFCP_ERP_FAILED;
@@ -2566,7 +2536,7 @@
 		 * _must_ be the one belonging to the 'exchange config
 		 * data' request.
 		 */
-		down_interruptible(&adapter->erp_ready_sem);
+		down(&adapter->erp_ready_sem);
 		if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) {
 			ZFCP_LOG_INFO("error: exchange of configuration data "
 				      "for adapter %s timed out\n",
diff -Nru a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
--- a/drivers/s390/scsi/zfcp_ext.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/s390/scsi/zfcp_ext.h	Tue Jun 15 22:20:38 2004
@@ -31,7 +31,7 @@
 #ifndef ZFCP_EXT_H
 #define ZFCP_EXT_H
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_EXT_REVISION "$Revision: 1.49 $"
+#define ZFCP_EXT_REVISION "$Revision: 1.50 $"
 
 #include "zfcp_def.h"
 
@@ -141,7 +141,6 @@
 extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u32, int);
 extern int  zfcp_erp_adapter_reopen(struct zfcp_adapter *, int);
 extern int  zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int);
-extern int  zfcp_erp_adapter_shutdown_all(void);
 extern void zfcp_erp_adapter_failed(struct zfcp_adapter *);
 
 extern void zfcp_erp_modify_port_status(struct zfcp_port *, u32, int);
@@ -169,7 +168,4 @@
 extern void zfcp_cmd_dbf_event_scsi(const char *, struct scsi_cmnd *);
 extern void zfcp_in_els_dbf_event(struct zfcp_adapter *, const char *,
 				  struct fsf_status_read_buffer *, int);
-#ifdef ZFCP_STAT_REQSIZES
-extern int  zfcp_statistics_inc(struct list_head *, u32);
-#endif
 #endif	/* ZFCP_EXT_H */
diff -Nru a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
--- a/drivers/s390/scsi/zfcp_fsf.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/s390/scsi/zfcp_fsf.c	Tue Jun 15 22:20:42 2004
@@ -29,7 +29,7 @@
  */
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_FSF_C_REVISION "$Revision: 1.45 $"
+#define ZFCP_FSF_C_REVISION "$Revision: 1.47 $"
 
 #include "zfcp_ext.h"
 
@@ -412,7 +412,7 @@
 		fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
 		atomic_set_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
 				&(adapter->status));
-		debug_text_event(adapter->erp_dbf, 4, "prot_con_init");
+		debug_text_event(adapter->erp_dbf, 3, "prot_con_init");
 		break;
 
 	case FSF_PROT_DUPLICATE_REQUEST_ID:
@@ -4809,9 +4809,6 @@
 	goto success;
 
  failed_sbals:
-#ifdef ZFCP_STAT_QUEUES
-	atomic_inc(&zfcp_data.outbound_queue_full);
-#endif
 /* dequeue new FSF request previously enqueued */
 	zfcp_fsf_req_free(fsf_req);
 	fsf_req = NULL;
@@ -4948,9 +4945,6 @@
 		}
 		/* count FSF requests pending */
 		atomic_inc(&adapter->fsf_reqs_active);
-#ifdef ZFCP_STAT_QUEUES
-		atomic_inc(&zfcp_data.outbound_total);
-#endif
 	}
 	return retval;
 }
diff -Nru a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
--- a/drivers/s390/scsi/zfcp_qdio.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/s390/scsi/zfcp_qdio.c	Tue Jun 15 22:20:37 2004
@@ -28,7 +28,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_QDIO_C_REVISION "$Revision: 1.18 $"
+#define ZFCP_QDIO_C_REVISION "$Revision: 1.19 $"
 
 #include "zfcp_ext.h"
 
@@ -682,12 +682,6 @@
 	sbale = zfcp_qdio_sbale_curr(fsf_req);
 	sbale->addr = addr;
 	sbale->length = length;
-
-#ifdef ZFCP_STAT_REQSIZES
-        if (sbtype == SBAL_FLAGS0_TYPE_READ)
-                zfcp_statistics_inc(&zfcp_data.read_sg_head, length);
-        else    zfcp_statistics_inc(&zfcp_data.write_sg_head, length);
-#endif
 }
 
 /**
@@ -770,18 +764,7 @@
 	/* assume that no other SBALEs are to follow in the same SBAL */
 	sbale = zfcp_qdio_sbale_curr(fsf_req);
 	sbale->flags |= SBAL_FLAGS_LAST_ENTRY;
-
 out:
-#ifdef ZFCP_STAT_REQSIZES
-	if (sbtype == SBAL_FLAGS0_TYPE_READ) {
-		zfcp_statistics_inc(&zfcp_data.read_sguse_head, sg_count);
-		zfcp_statistics_inc(&zfcp_data.read_req_head, bytes);
-	} else	{
-		zfcp_statistics_inc(&zfcp_data.write_sguse_head, sg_count);
-        	zfcp_statistics_inc(&zfcp_data.write_req_head, bytes);
-	}
-#endif
-
 	return bytes;
 }
 
diff -Nru a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
--- a/drivers/s390/scsi/zfcp_scsi.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/s390/scsi/zfcp_scsi.c	Tue Jun 15 22:20:39 2004
@@ -31,9 +31,7 @@
 #define ZFCP_LOG_AREA			ZFCP_LOG_AREA_SCSI
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_SCSI_REVISION "$Revision: 1.61 $"
-
-#include <linux/blkdev.h>
+#define ZFCP_SCSI_REVISION "$Revision: 1.62 $"
 
 #include "zfcp_ext.h"
 
diff -Nru a/drivers/s390/scsi/zfcp_sysfs_adapter.c b/drivers/s390/scsi/zfcp_sysfs_adapter.c
--- a/drivers/s390/scsi/zfcp_sysfs_adapter.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/s390/scsi/zfcp_sysfs_adapter.c	Tue Jun 15 22:20:36 2004
@@ -26,11 +26,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.32 $"
+#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.33 $"
 
-#include <asm/ccwdev.h>
 #include "zfcp_ext.h"
-#include "zfcp_def.h"
 
 #define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_CONFIG
 
diff -Nru a/drivers/s390/scsi/zfcp_sysfs_driver.c b/drivers/s390/scsi/zfcp_sysfs_driver.c
--- a/drivers/s390/scsi/zfcp_sysfs_driver.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/s390/scsi/zfcp_sysfs_driver.c	Tue Jun 15 22:20:44 2004
@@ -26,11 +26,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_SYSFS_DRIVER_C_REVISION "$Revision: 1.12 $"
+#define ZFCP_SYSFS_DRIVER_C_REVISION "$Revision: 1.14 $"
 
-#include <asm/ccwdev.h>
 #include "zfcp_ext.h"
-#include "zfcp_def.h"
 
 #define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_CONFIG
 
diff -Nru a/drivers/s390/scsi/zfcp_sysfs_port.c b/drivers/s390/scsi/zfcp_sysfs_port.c
--- a/drivers/s390/scsi/zfcp_sysfs_port.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/s390/scsi/zfcp_sysfs_port.c	Tue Jun 15 22:21:03 2004
@@ -26,13 +26,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.39 $"
+#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.40 $"
 
-#include <linux/init.h>
-#include <linux/module.h>
-#include <asm/ccwdev.h>
 #include "zfcp_ext.h"
-#include "zfcp_def.h"
 
 #define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_CONFIG
 
diff -Nru a/drivers/s390/scsi/zfcp_sysfs_unit.c b/drivers/s390/scsi/zfcp_sysfs_unit.c
--- a/drivers/s390/scsi/zfcp_sysfs_unit.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/s390/scsi/zfcp_sysfs_unit.c	Tue Jun 15 22:21:05 2004
@@ -26,13 +26,9 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_SYSFS_UNIT_C_REVISION "$Revision: 1.24 $"
+#define ZFCP_SYSFS_UNIT_C_REVISION "$Revision: 1.25 $"
 
-#include <linux/init.h>
-#include <linux/module.h>
-#include <asm/ccwdev.h>
 #include "zfcp_ext.h"
-#include "zfcp_def.h"
 
 #define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_CONFIG
 
diff -Nru a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
--- a/drivers/scsi/3w-xxxx.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/scsi/3w-xxxx.c	Tue Jun 15 22:21:03 2004
@@ -1,12 +1,12 @@
 /* 
    3w-xxxx.c -- 3ware Storage Controller device driver for Linux.
 
-   Written By: Adam Radford <linux@3ware.com>
+   Written By: Adam Radford <linuxraid@amcc.com>
    Modifications By: Joel Jacobson <linux@3ware.com>
    		     Arnaldo Carvalho de Melo <acme@conectiva.com.br>
                      Brad Strand <linux@3ware.com>
 
-   Copyright (C) 1999-2003 3ware Inc.
+   Copyright (C) 1999-2004 3ware Inc.
 
    Kernel compatiblity By: 	Andre Hedrick <andre@suse.com>
    Non-Copyright (C) 2000	Andre Hedrick <andre@suse.com>
@@ -47,10 +47,10 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
    Bugs/Comments/Suggestions should be mailed to:                            
-   linux@3ware.com
+   linuxraid@amcc.com
 
    For more information, goto:
-   http://www.3ware.com
+   http://www.amcc.com
 
    History
    -------
@@ -179,6 +179,11 @@
    1.02.00.036 - Increase character ioctl timeout to 60 seconds.
    1.02.00.037 - Fix tw_ioctl() to handle all non-data ATA passthru cmds
                  for 'smartmontools' support.
+   1.26.00.038 - Roll driver minor version to 26 to denote kernel 2.6.
+                 Add support for cmds_per_lun module parameter.
+   1.26.00.039 - Fix bug in tw_chrdev_ioctl() polling code.
+                 Fix data_buffer_length usage in tw_chrdev_ioctl().
+                 Update contact information.
 */
 
 #include <linux/module.h>
@@ -205,6 +210,7 @@
 #include <linux/reboot.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
+#include <linux/moduleparam.h>
 
 #include <asm/errno.h>
 #include <asm/io.h>
@@ -242,10 +248,15 @@
 };
 
 /* Globals */
-char *tw_driver_version="1.02.00.037";
+char *tw_driver_version="1.26.00.039";
 TW_Device_Extension *tw_device_extension_list[TW_MAX_SLOT];
 int tw_device_extension_count = 0;
 static int twe_major = -1;
+static int cmds_per_lun;
+
+/* Module parameters */
+module_param(cmds_per_lun, int, 0);
+MODULE_PARM_DESC(cmds_per_lun, "Maximum commands per LUN");
 
 /* Functions */
 
@@ -683,7 +694,7 @@
 			break;
 		case TW_OP_AEN_LISTEN:
 			dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl(): caught TW_AEN_LISTEN.\n");
-			memset(tw_ioctl->data_buffer, 0, tw_ioctl->data_buffer_length);
+			memset(tw_ioctl->data_buffer, 0, data_buffer_length);
 
 			spin_lock_irqsave(tw_dev->host->host_lock, flags);
 			if (tw_dev->aen_head == tw_dev->aen_tail) {
@@ -738,7 +749,7 @@
 			timeout = TW_IOCTL_CHRDEV_TIMEOUT*HZ;
 
 			/* Now wait for the command to complete */
-			wait_event_interruptible_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout);
+			timeout = wait_event_interruptible_timeout(tw_dev->ioctl_wqueue, tw_dev->chrdev_request_id == TW_IOCTL_CHRDEV_FREE, timeout);
 
 			/* Check if we timed out, got a signal, or didn't get
 			   an interrupt */
@@ -777,7 +788,7 @@
 	}
 
 	/* Now copy the response to userspace */
-	error = copy_to_user((void *)arg, tw_ioctl, sizeof(TW_New_Ioctl) + tw_ioctl->data_buffer_length - 1);
+	error = copy_to_user((void *)arg, tw_ioctl, sizeof(TW_New_Ioctl) + data_buffer_length - 1);
 	if (error == 0)
 		retval = 0;
 out2:
@@ -1141,14 +1152,6 @@
 			/* Set card status as online */
 			tw_dev->online = 1;
 
-#ifdef CONFIG_3W_XXXX_CMD_PER_LUN
-			tw_host->cmd_per_lun = CONFIG_3W_XXXX_CMD_PER_LUN;
-			if (tw_host->cmd_per_lun > TW_MAX_CMDS_PER_LUN)
-				tw_host->cmd_per_lun = TW_MAX_CMDS_PER_LUN;
-#else
-			/* Use SHT cmd_per_lun here */
-			tw_host->cmd_per_lun = TW_MAX_CMDS_PER_LUN;
-#endif
 			tw_dev->free_head = TW_Q_START;
 			tw_dev->free_tail = TW_Q_START;
 			tw_dev->free_wrap = TW_Q_LENGTH - 1;
@@ -3386,13 +3389,13 @@
 
 	dprintk(KERN_WARNING "3w-xxxx: tw_slave_configure()\n");
 
-#ifdef CONFIG_3W_XXXX_CMD_PER_LUN
-	max_cmds = CONFIG_3W_XXXX_CMD_PER_LUN;
-	if (max_cmds > TW_MAX_CMDS_PER_LUN)
+	if (cmds_per_lun) {
+		max_cmds = cmds_per_lun;
+		if (max_cmds > TW_MAX_CMDS_PER_LUN)
+			max_cmds = TW_MAX_CMDS_PER_LUN;
+	} else {
 		max_cmds = TW_MAX_CMDS_PER_LUN;
-#else
-	max_cmds = TW_MAX_CMDS_PER_LUN;
-#endif
+	}
 	scsi_adjust_queue_depth(SDptr, MSG_ORDERED_TAG, max_cmds);
 
 	return 0;
@@ -3488,6 +3491,7 @@
 	.eh_abort_handler	= tw_scsi_eh_abort,
 	.eh_host_reset_handler	= tw_scsi_eh_reset,
 	.bios_param		= tw_scsi_biosparam,
+	.slave_configure	= tw_slave_configure,
 	.can_queue		= TW_Q_LENGTH-2,
 	.this_id		= -1,
 	.sg_tablesize		= TW_MAX_SGL_LENGTH,
diff -Nru a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h
--- a/drivers/scsi/3w-xxxx.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/scsi/3w-xxxx.h	Tue Jun 15 22:20:38 2004
@@ -1,12 +1,12 @@
 /* 
    3w-xxxx.h -- 3ware Storage Controller device driver for Linux.
    
-   Written By: Adam Radford <linux@3ware.com>
+   Written By: Adam Radford <linuxraid@amcc.com>
    Modifications By: Joel Jacobson <linux@3ware.com>
    		     Arnaldo Carvalho de Melo <acme@conectiva.com.br>
                      Brad Strand <linux@3ware.com>
 
-   Copyright (C) 1999-2003 3ware Inc.
+   Copyright (C) 1999-2004 3ware Inc.
 
    Kernel compatiblity By:	Andre Hedrick <andre@suse.com>
    Non-Copyright (C) 2000	Andre Hedrick <andre@suse.com>
@@ -45,10 +45,10 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
    Bugs/Comments/Suggestions should be mailed to:                            
-   linux@3ware.com
+   linuxraid@amcc.com
    
    For more information, goto:
-   http://www.3ware.com
+   http://www.amcc.com
 */
 
 #ifndef _3W_XXXX_H
diff -Nru a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
--- a/drivers/scsi/Kconfig	Tue Jun 15 22:20:58 2004
+++ b/drivers/scsi/Kconfig	Tue Jun 15 22:20:58 2004
@@ -149,19 +149,8 @@
 	  can say Y here to force the SCSI driver to probe for multiple LUNs.
 	  A SCSI device with multiple LUNs acts logically like multiple SCSI
 	  devices. The vast majority of SCSI devices have only one LUN, and
-	  so most people can say N here and should in fact do so, because it
-	  is safer.
-
-config SCSI_REPORT_LUNS
-	bool "Build with SCSI REPORT LUNS support"
-	depends on SCSI
-	default y
-	help
-	  If you want support for SCSI REPORT LUNS, say Y here.
-	  The REPORT LUNS command is useful for devices (such as disk arrays)
-	  with large numbers of LUNs where the LUN values are not contiguous
-	  (sparse LUN).  REPORT LUNS scanning is done only for SCSI-3 devices.
-	  Most users can safely answer N here.
+	  so most people can say N here. The max_luns boot/module parameter 
+	  allows to override this setting.
 
 config SCSI_CONSTANTS
 	bool "Verbose SCSI error reporting (kernel size +=12K)"
@@ -363,7 +352,7 @@
 # All the I2O code and drivers do not seem to be 64bit safe.
 config SCSI_DPT_I2O
 	tristate "Adaptec I2O RAID support "
-	depends on !64BIT && SCSI && BROKEN
+	depends on !64BIT && SCSI && PCI
 	help
 	  This driver supports all of Adaptec's I2O based RAID controllers as 
 	  well as the DPT SmartRaid V cards.  This is an Adaptec maintained
@@ -434,10 +423,18 @@
 	  If unsure, say N.
 
 config SCSI_SATA_PROMISE
-	tristate "Promise SATA support"
+	tristate "Promise SATA TX2/TX4 support"
+	depends on SCSI_SATA && PCI
+	help
+	  This option enables support for Promise Serial ATA TX2/TX4.
+
+	  If unsure, say N.
+
+config SCSI_SATA_SX4
+	tristate "Promise SATA SX4 support"
 	depends on SCSI_SATA && PCI && EXPERIMENTAL
 	help
-	  This option enables support for Promise Serial ATA.
+	  This option enables support for Promise Serial ATA SX4.
 
 	  If unsure, say N.
 
@@ -497,9 +494,15 @@
 	  substantial, so users of MultiMaster Host Adapters may wish to omit
 	  it.
 
+#
+# This is marked broken because it uses over 4kB of stack in
+# just two routines:
+#     2076  CpqTsProcessIMQEntry
+#     2052  PeekIMQEntry
+#
 config SCSI_CPQFCTS
 	tristate "Compaq Fibre Channel 64-bit/66Mhz HBA support"
-	depends on PCI && SCSI
+	depends on PCI && SCSI && BROKEN
 	help
 	  Say Y here to compile in support for the Compaq StorageWorks Fibre
 	  Channel 64-bit/66Mhz Host Bus Adapter.
@@ -979,6 +982,31 @@
 	  the card.  This is significantly slower then using memory
 	  mapped IO.  Most people should answer N.
 
+config SCSI_IPR
+	tristate "IBM Power Linux RAID adapter support"
+	depends on PCI && SCSI
+	select FW_LOADER
+	---help---
+	  This driver supports the IBM Power Linux family RAID adapters.
+	  This includes IBM pSeries 5712, 5703, 5709, and 570A, as well
+	  as IBM iSeries 5702, 5703, 5709, and 570A.
+
+config SCSI_IPR_TRACE
+	bool "enable driver internal trace"
+	depends on SCSI_IPR
+	help
+	  If you say Y here, the driver will trace all commands issued
+	  to the adapter. Performance impact is minimal. Trace can be
+	  dumped using /sys/bus/class/scsi_host/hostXX/trace.
+
+config SCSI_IPR_DUMP
+	bool "enable adapter dump support"
+	depends on SCSI_IPR
+	help
+	  If you say Y here, the driver will support adapter crash dump.
+	  If you enable this support, the iprdump daemon can be used
+	  to capture adapter failure analysis information.
+
 config SCSI_ZALON
 	tristate "Zalon SCSI support"
 	depends on GSC && SCSI
@@ -1100,7 +1128,7 @@
 
 config SCSI_MCA_53C9X
 	tristate "NCR MCA 53C9x SCSI support"
-	depends on MCA && SCSI && BROKEN_ON_SMP
+	depends on MCA_LEGACY && SCSI && BROKEN_ON_SMP
 	help
 	  Some MicroChannel machines, notably the NCR 35xx line, use a SCSI
 	  controller based on the NCR 53C94.  This driver will allow use of
@@ -1703,8 +1731,17 @@
 #      bool 'Cyberstorm Mk III SCSI support (EXPERIMENTAL)' CONFIG_CYBERSTORMIII_SCSI
 
 config ZFCP
-	tristate "IBM z900 OpenFCP/SCSI support"
+	tristate "FCP host bus adapter driver for IBM eServer zSeries"
 	depends on ARCH_S390 && SCSI
+	help
+          If you want to access SCSI devices attached to your IBM eServer
+          zSeries by means of Fibre Channel interfaces say Y.
+          For details please refer to the documentation provided by IBM at
+          <http://oss.software.ibm.com/developerworks/opensource/linux390>
+
+          This driver is also available as a module. This module will be
+          called zfcp. If you want to compile it as a module, say M here
+          and read Documentation/modules.txt.
 
 endmenu
 
diff -Nru a/drivers/scsi/Makefile b/drivers/scsi/Makefile
--- a/drivers/scsi/Makefile	Tue Jun 15 22:20:43 2004
+++ b/drivers/scsi/Makefile	Tue Jun 15 22:20:43 2004
@@ -75,7 +75,8 @@
 obj-$(CONFIG_SCSI_NCR_D700)	+= 53c700.o NCR_D700.o
 obj-$(CONFIG_SCSI_NCR_Q720)	+= NCR_Q720_mod.o
 obj-$(CONFIG_SCSI_SYM53C416)	+= sym53c416.o
-obj-$(CONFIG_SCSI_QLOGIC_FAS)	+= qlogicfas.o
+obj-$(CONFIG_SCSI_QLOGIC_FAS)	+= qlogicfas408.o	qlogicfas.o
+obj-$(CONFIG_PCMCIA_QLOGIC)	+= qlogicfas408.o
 obj-$(CONFIG_SCSI_QLOGIC_ISP)	+= qlogicisp.o 
 obj-$(CONFIG_SCSI_QLOGIC_FC)	+= qlogicfc.o 
 obj-$(CONFIG_SCSI_QLOGIC_1280)	+= qla1280.o 
@@ -117,6 +118,7 @@
 obj-$(CONFIG_SCSI_CPQFCTS)	+= cpqfc.o
 obj-$(CONFIG_SCSI_LASI700)	+= 53c700.o lasi700.o
 obj-$(CONFIG_SCSI_NSP32)	+= nsp32.o
+obj-$(CONFIG_SCSI_IPR)		+= ipr.o
 obj-$(CONFIG_SCSI_SATA_SVW)	+= libata.o sata_svw.o
 obj-$(CONFIG_SCSI_ATA_PIIX)	+= libata.o ata_piix.o
 obj-$(CONFIG_SCSI_SATA_PROMISE)	+= libata.o sata_promise.o
@@ -124,6 +126,7 @@
 obj-$(CONFIG_SCSI_SATA_VIA)	+= libata.o sata_via.o
 obj-$(CONFIG_SCSI_SATA_VITESSE)	+= libata.o sata_vsc.o
 obj-$(CONFIG_SCSI_SATA_SIS)	+= libata.o sata_sis.o
+obj-$(CONFIG_SCSI_SATA_SX4)	+= libata.o sata_sx4.o
 
 obj-$(CONFIG_ARM)		+= arm/
 
diff -Nru a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
--- a/drivers/scsi/NCR53c406a.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/NCR53c406a.c	Tue Jun 15 22:20:40 2004
@@ -170,7 +170,6 @@
 /* Static function prototypes */
 static void NCR53c406a_intr(int, void *, struct pt_regs *);
 static irqreturn_t do_NCR53c406a_intr(int, void *, struct pt_regs *);
-static void wait_intr(void);
 static void chip_init(void);
 static void calc_port_addr(void);
 #ifndef IRQ_LEV
@@ -665,6 +664,7 @@
 	return (info_msg);
 }
 
+#if 0
 static void wait_intr(void)
 {
 	unsigned long i = jiffies + WATCHDOG;
@@ -684,6 +684,7 @@
 
 	NCR53c406a_intr(0, NULL, NULL);
 }
+#endif
 
 static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
 {
diff -Nru a/drivers/scsi/aacraid/README b/drivers/scsi/aacraid/README
--- a/drivers/scsi/aacraid/README	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/aacraid/README	Tue Jun 15 22:20:36 2004
@@ -38,15 +38,19 @@
 					(fixed 64bit and 64G memory model, changed confusing naming convention
 					 where fibs that go to the hardware are consistently called hw_fibs and
 					 not just fibs like the name of the driver tracking structure)
+Mark Salyzyn <Mark_Salyzyn@adaptec.com> Fixed panic issues and added some new product ids for upcoming hbas.
+
 Original Driver
 -------------------------
 Adaptec Unix OEM Product Group
 
 Mailing List
 -------------------------
-None currently. Also note this is very different to Brian's original driver
+linux-aacraid-devel@dell.com (Interested parties troll here)
+http://mbserver.adaptec.com/ (Currently more Community Support than Devel Support)
+Also note this is very different to Brian's original driver
 so don't expect him to support it.
-Adaptec does support this driver.  Contact either tech support or deanna bonds.
+Adaptec does support this driver.  Contact either tech support or Mark Salyzyn.
 
 Original by Brian Boerner February 2001
 Rewritten by Alan Cox, November 2001
diff -Nru a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
--- a/drivers/scsi/aacraid/aacraid.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/scsi/aacraid/aacraid.h	Tue Jun 15 22:20:38 2004
@@ -1,18 +1,20 @@
-//#define dprintk(x) printk x
-#define dprintk(x)
+#if (!defined(dprintk))
+# define dprintk(x)
+#endif
 
 /*------------------------------------------------------------------------------
  *              D E F I N E S
  *----------------------------------------------------------------------------*/
+
 #define MAXIMUM_NUM_CONTAINERS	31
 #define MAXIMUM_NUM_ADAPTERS	8
 
-#define AAC_NUM_FIB	578
+#define AAC_NUM_FIB		578
 //#define AAC_NUM_IO_FIB	512
-#define AAC_NUM_IO_FIB	100
+#define AAC_NUM_IO_FIB		100
 
-#define AAC_MAX_TARGET (MAXIMUM_NUM_CONTAINERS+1)
-#define AAC_MAX_LUN	(8)
+#define AAC_MAX_TARGET 		(MAXIMUM_NUM_CONTAINERS+1)
+#define AAC_MAX_LUN		(8)
 
 #define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
 
@@ -241,92 +243,6 @@
 };
 
 /*
- * Implement our own version of these so we have 64 bit compatability
- * The adapter uses these and can only handle 32 bit addresses
- */
-
-struct aac_list_head {
-	u32 next;
-	u32 prev;
-};
-
-#define AAC_INIT_LIST_HEAD(ptr) do { \
-	(ptr)->next = (u32)(ulong)(ptr); \
-	(ptr)->prev = (u32)(ulong)(ptr); \
-} while (0)
-/**
- * aac_list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static __inline__ int aac_list_empty(struct aac_list_head *head)
-{
-	return head->next == ((u32)(ulong)head);
-}
-
-/*
- * Insert a new entry between two known consecutive entries. 
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void aac_list_add(struct aac_list_head * n,
-	struct aac_list_head * prev,
-	struct aac_list_head * next)
-{
-	next->prev = (u32)(ulong)n;
-	n->next = (u32)(ulong)next;
-	n->prev = (u32)(ulong)prev;
-	prev->next = (u32)(ulong)n;
-}
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static __inline__ void aac_list_add_tail(struct aac_list_head *n, struct aac_list_head *head)
-{
-	aac_list_add(n, (struct aac_list_head*)(ulong)(head->prev), head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __aac_list_del(struct aac_list_head * p,
-				  struct aac_list_head * n)
-{
-	n->prev = (u32)(ulong)p;
-	p->next = (u32)(ulong)n;
-}
-
-/**
- * aac_list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
- */
-static __inline__ void aac_list_del(struct aac_list_head *entry)
-{
-	__aac_list_del((struct aac_list_head*)(ulong)entry->prev,(struct aac_list_head*)(ulong) entry->next);
-	entry->next = entry->prev = 0;
-}
-
-/**
- * aac_list_entry - get the struct for this entry
- * @ptr:	the &struct list_head pointer.
- * @type:	the type of the struct this is embedded in.
- * @member:	the name of the list_struct within the struct.
- */
-#define aac_list_entry(ptr, type, member) \
-	((type *)((char *)(ptr)-(ulong)(&((type *)0)->member)))
-
-/*
  *	Assign type values to the FSA communication data structures
  */
 
@@ -339,11 +255,11 @@
 #define		FsaNormal	1
 #define		FsaHigh		2
 
-
 /*
  * Define the FIB. The FIB is the where all the requested data and
  * command information are put to the application on the FSA adapter.
  */
+
 struct aac_fibhdr {
 	u32 XferState;			// Current transfer state for this CCB
 	u16 Command;			// Routing information for the destination
@@ -359,13 +275,9 @@
 		    u32 _ReceiverTimeStart; 	// Timestamp for receipt of fib
 		    u32 _ReceiverTimeDone;	// Timestamp for completion of fib
 		} _s;
-		struct aac_list_head _FibLinks;	// Used to link Adapter Initiated Fibs on the host
-//		struct list_head _FibLinks;	// Used to link Adapter Initiated Fibs on the host
 	} _u;
 };
 
-#define FibLinks			_u._FibLinks
-
 #define FIB_DATA_SIZE_IN_BYTES (512 - sizeof(struct aac_fibhdr))
 
 
@@ -558,12 +470,11 @@
 	spinlock_t		lockdata;	/* Actual lock (used only on one side of the lock) */
 	unsigned long		SavedIrql;     	/* Previous IRQL when the spin lock is taken */
 	u32			padding;	/* Padding - FIXME - can remove I believe */
-	struct aac_list_head 	cmdq;	   	/* A queue of FIBs which need to be prcessed by the FS thread. This is */
-//	struct list_head 	cmdq;	   	/* A queue of FIBs which need to be prcessed by the FS thread. This is */
-                                		        /* only valid for command queues which receive entries from the adapter. */
-	struct list_head	pendingq;		/* A queue of outstanding fib's to the adapter. */
-	u32			numpending;		/* Number of entries on outstanding queue. */
-	struct aac_dev *	dev;			/* Back pointer to adapter structure */
+	struct list_head 	cmdq;	   	/* A queue of FIBs which need to be prcessed by the FS thread. This is */
+                                		/* only valid for command queues which receive entries from the adapter. */
+	struct list_head	pendingq;	/* A queue of outstanding fib's to the adapter. */
+	u32			numpending;	/* Number of entries on outstanding queue. */
+	struct aac_dev *	dev;		/* Back pointer to adapter structure */
 };
 
 /*
@@ -744,7 +655,7 @@
 	struct semaphore 	wait_sem;	// this is used to wait for the next fib to arrive.
 	int			wait;		// Set to true when thread is in WaitForSingleObject
 	unsigned long		count;		// total number of FIBs on FibList
-	struct aac_list_head	hw_fib_list;	// this holds hw_fibs which should be 32 bit addresses
+	struct list_head	fib_list;	// this holds fibs and their attachd hw_fibs
 };
 
 struct fsa_scsi_hba {
@@ -781,7 +692,11 @@
 	 *	Outstanding I/O queue.
 	 */
 	struct list_head	queue;
-
+	/*
+	 *	And for the internal issue/reply queues (we may be able
+	 *	to merge these two)
+	 */
+	struct list_head	fiblink;
 	void 			*data;
 	struct hw_fib		*hw_fib;		/* Actual shared object */
 	dma_addr_t		hw_fib_pa;		/* physical address of hw_fib*/
@@ -836,19 +751,19 @@
 /*
  * Supported Options
  */
-#define AAC_OPT_SNAPSHOT	cpu_to_le32(1)
-#define AAC_OPT_CLUSTERS	cpu_to_le32(1<<1)
-#define AAC_OPT_WRITE_CACHE	cpu_to_le32(1<<2)
-#define AAC_OPT_64BIT_DATA	cpu_to_le32(1<<3)
-#define AAC_OPT_HOST_TIME_FIB	cpu_to_le32(1<<4)
-#define AAC_OPT_RAID50		cpu_to_le32(1<<5)
-#define AAC_OPT_4GB_WINDOW	cpu_to_le32(1<<6)
-#define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7)
-#define AAC_OPT_SOFT_ERR_REPORT	cpu_to_le32(1<<8)
-#define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9)
-#define AAC_OPT_SGMAP_HOST64	cpu_to_le32(1<<10)
-#define AAC_OPT_ALARM		cpu_to_le32(1<<11)
-#define AAC_OPT_NONDASD		cpu_to_le32(1<<12)
+#define AAC_OPT_SNAPSHOT		cpu_to_le32(1)
+#define AAC_OPT_CLUSTERS		cpu_to_le32(1<<1)
+#define AAC_OPT_WRITE_CACHE		cpu_to_le32(1<<2)
+#define AAC_OPT_64BIT_DATA		cpu_to_le32(1<<3)
+#define AAC_OPT_HOST_TIME_FIB		cpu_to_le32(1<<4)
+#define AAC_OPT_RAID50			cpu_to_le32(1<<5)
+#define AAC_OPT_4GB_WINDOW		cpu_to_le32(1<<6)
+#define AAC_OPT_SCSI_UPGRADEABLE 	cpu_to_le32(1<<7)
+#define AAC_OPT_SOFT_ERR_REPORT		cpu_to_le32(1<<8)
+#define AAC_OPT_SUPPORTED_RECONDITION 	cpu_to_le32(1<<9)
+#define AAC_OPT_SGMAP_HOST64		cpu_to_le32(1<<10)
+#define AAC_OPT_ALARM			cpu_to_le32(1<<11)
+#define AAC_OPT_NONDASD			cpu_to_le32(1<<12)
 
 struct aac_dev
 {
@@ -862,11 +777,10 @@
 	 */	
 	dma_addr_t		hw_fib_pa;
 	struct hw_fib		*hw_fib_va;
-	ulong			fib_base_va;
+	struct hw_fib		*aif_base_va;
 	/*
 	 *	Fib Headers
 	 */
-// dmb	struct fib              fibs[AAC_NUM_FIB]; /* Doing it here takes up too much from the scsi pool*/
 	struct fib              *fibs;
 
 	struct fib		*free_fib;
@@ -887,7 +801,6 @@
 	unsigned long		fsrev;		/* Main driver's revision number */
 	
 	struct aac_init		*init;		/* Holds initialization info to communicate with adapter */
-//	void *			init_pa; 	/* Holds physical address of the init struct */
 	dma_addr_t		init_pa; 	/* Holds physical address of the init struct */
 	
 	struct pci_dev		*pdev;		/* Our PCI interface */
@@ -898,7 +811,7 @@
 
 	struct Scsi_Host	*scsi_host_ptr;
 	struct fsa_scsi_hba	fsa_dev;
-	int			thread_pid;
+	pid_t			thread_pid;
 	int			cardtype;
 	
 	/*
diff -Nru a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
--- a/drivers/scsi/aacraid/commctrl.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/aacraid/commctrl.c	Tue Jun 15 22:20:39 2004
@@ -148,7 +148,7 @@
 		 *	the list to 0.
 		 */
 		fibctx->count = 0;
-		AAC_INIT_LIST_HEAD(&fibctx->hw_fib_list);
+		INIT_LIST_HEAD(&fibctx->fib_list);
 		fibctx->jiffies = jiffies/HZ;
 		/*
 		 *	Now add this context onto the adapter's 
@@ -179,7 +179,7 @@
 {
 	struct fib_ioctl f;
 	struct aac_fib_context *fibctx, *aifcp;
-	struct hw_fib * hw_fib;
+	struct fib *fib;
 	int status;
 	struct list_head * entry;
 	int found;
@@ -222,25 +222,27 @@
 	 *	-EAGAIN
 	 */
 return_fib:
-	if (!aac_list_empty(&fibctx->hw_fib_list)) {
-		struct aac_list_head * entry;
+	if (!list_empty(&fibctx->fib_list)) {
+		struct list_head * entry;
 		/*
 		 *	Pull the next fib from the fibs
 		 */
-		entry = (struct aac_list_head*)(ulong)fibctx->hw_fib_list.next;
-		aac_list_del(entry);
+		entry = fibctx->fib_list.next;
+		list_del(entry);
 		
-		hw_fib = aac_list_entry(entry, struct hw_fib, header.FibLinks);
+		fib = list_entry(entry, struct fib, fiblink);
 		fibctx->count--;
 		spin_unlock_irqrestore(&dev->fib_lock, flags);
-		if (copy_to_user(f.fib, hw_fib, sizeof(struct hw_fib))) {
-			kfree(hw_fib);
+		if (copy_to_user(f.fib, fib->hw_fib, sizeof(struct hw_fib))) {
+			kfree(fib->hw_fib);
+			kfree(fib);
 			return -EFAULT;
 		}	
 		/*
 		 *	Free the space occupied by this copy of the fib.
 		 */
-		kfree(hw_fib);
+		kfree(fib->hw_fib);
+		kfree(fib);
 		status = 0;
 		fibctx->jiffies = jiffies/HZ;
 	} else {
@@ -262,24 +264,25 @@
 
 int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx)
 {
-	struct hw_fib *hw_fib;
+	struct fib *fib;
 
 	/*
 	 *	First free any FIBs that have not been consumed.
 	 */
-	while (!aac_list_empty(&fibctx->hw_fib_list)) {
-		struct aac_list_head * entry;
+	while (!list_empty(&fibctx->fib_list)) {
+		struct list_head * entry;
 		/*
 		 *	Pull the next fib from the fibs
 		 */
-		entry = (struct aac_list_head*)(ulong)(fibctx->hw_fib_list.next);
-		aac_list_del(entry);
-		hw_fib = aac_list_entry(entry, struct hw_fib, header.FibLinks);
+		entry = fibctx->fib_list.next;
+		list_del(entry);
+		fib = list_entry(entry, struct fib, fiblink);
 		fibctx->count--;
 		/*
 		 *	Free the space occupied by this copy of the fib.
 		 */
-		kfree(hw_fib);
+		kfree(fib->hw_fib);
+		kfree(fib);
 	}
 	/*
 	 *	Remove the Context from the AdapterFibContext List
diff -Nru a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
--- a/drivers/scsi/aacraid/comminit.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/aacraid/comminit.c	Tue Jun 15 22:20:36 2004
@@ -81,9 +81,9 @@
 	 *	Adapter Fibs are the first thing allocated so that they
 	 *	start page aligned
 	 */
-	dev->fib_base_va = (ulong)base;
+	dev->aif_base_va = (struct hw_fib *)base;
 	
-	init->AdapterFibsVirtualAddress = cpu_to_le32((u32)(ulong)phys);
+	init->AdapterFibsVirtualAddress = cpu_to_le32(0);
 	init->AdapterFibsPhysicalAddress = cpu_to_le32((u32)phys);
 	init->AdapterFibsSize = cpu_to_le32(fibsize);
 	init->AdapterFibAlign = cpu_to_le32(sizeof(struct hw_fib));
@@ -94,6 +94,9 @@
 	 * mapping system, but older Firmware did, and had *troubles* dealing
 	 * with the math overloading past 32 bits, thus we must limit this
 	 * field.
+	 *
+	 * FIXME: this assumes the memory is mapped zero->n, which isnt
+	 * always true on real computers.
 	 */
 	if ((num_physpages << (PAGE_SHIFT - 12)) <= AAC_MAX_HOSTPHYSMEMPAGES) {
 		init->HostPhysMemPages = 
@@ -140,7 +143,7 @@
 	q->dev = dev;
 	INIT_LIST_HEAD(&q->pendingq);
 	init_waitqueue_head(&q->cmdready);
-	AAC_INIT_LIST_HEAD(&q->cmdq);
+	INIT_LIST_HEAD(&q->cmdq);
 	init_waitqueue_head(&q->qfull);
 	spin_lock_init(&q->lockdata);
 	q->lock = &q->lockdata;
diff -Nru a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
--- a/drivers/scsi/aacraid/commsup.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/scsi/aacraid/commsup.c	Tue Jun 15 22:20:43 2004
@@ -133,13 +133,10 @@
 	unsigned long flags;
 	spin_lock_irqsave(&dev->fib_lock, flags);
 	fibptr = dev->free_fib;	
-	while(!fibptr){
-		spin_unlock_irqrestore(&dev->fib_lock, flags);
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(1);
-		spin_lock_irqsave(&dev->fib_lock, flags);
-		fibptr = dev->free_fib;	
-	}
+	/* Cannot sleep here or you get hangs. Instead we did the
+	   maths at compile time. */
+	if(!fibptr)
+		BUG();
 	dev->free_fib = fibptr->next;
 	spin_unlock_irqrestore(&dev->fib_lock, flags);
 	/*
@@ -290,7 +287,7 @@
 	}
 }   
 
-/*Command thread: *
+/**
  *	aac_queue_get		-	get the next free QE
  *	@dev: Adapter
  *	@index: Returned index
@@ -450,8 +447,7 @@
 	 *	Map the fib into 32bits by using the fib number
 	 */
 
-//	hw_fib->header.SenderFibAddress = ((u32)(fibptr-dev->fibs)) << 1;
-	hw_fib->header.SenderFibAddress = cpu_to_le32((u32)(ulong)fibptr->hw_fib_pa);
+	hw_fib->header.SenderFibAddress = cpu_to_le32(((u32)(fibptr-dev->fibs)) << 1);
 	hw_fib->header.SenderData = (u32)(fibptr - dev->fibs);
 	/*
 	 *	Set FIB state to indicate where it came from and if we want a
@@ -492,7 +488,7 @@
 	dprintk((KERN_DEBUG "  Command =               %d.\n", hw_fib->header.Command));
 	dprintk((KERN_DEBUG "  XferState  =            %x.\n", hw_fib->header.XferState));
 	dprintk((KERN_DEBUG "  hw_fib va being sent=%p\n",fibptr->hw_fib));
-	dprintk((KERN_DEBUG "  hw_fib pa being sent=%xl\n",(ulong)fibptr->hw_fib_pa));
+	dprintk((KERN_DEBUG "  hw_fib pa being sent=%lx\n",(ulong)fibptr->hw_fib_pa));
 	dprintk((KERN_DEBUG "  fib being sent=%p\n",fibptr));
 	/*
 	 *	Fill in the Callback and CallbackContext if we are not
@@ -806,8 +802,8 @@
  
 int aac_command_thread(struct aac_dev * dev)
 {
-	struct hw_fib *hw_fib, *newfib;
-	struct fib fibptr; /* for error logging */
+	struct hw_fib *hw_fib, *hw_newfib;
+	struct fib *fib, *newfib;
 	struct aac_queue_block *queues = dev->queues;
 	struct aac_fib_context *fibctx;
 	unsigned long flags;
@@ -828,42 +824,44 @@
 	 *	Let the DPC know it has a place to send the AIF's to.
 	 */
 	dev->aif_thread = 1;
-	memset(&fibptr, 0, sizeof(struct fib));
 	add_wait_queue(&queues->queue[HostNormCmdQueue].cmdready, &wait);
 	set_current_state(TASK_INTERRUPTIBLE);
 	while(1) 
 	{
 		spin_lock_irqsave(queues->queue[HostNormCmdQueue].lock, flags);
-		while(!aac_list_empty(&(queues->queue[HostNormCmdQueue].cmdq))) {
-			struct aac_list_head *entry;
+		while(!list_empty(&(queues->queue[HostNormCmdQueue].cmdq))) {
+			struct list_head *entry;
 			struct aac_aifcmd * aifcmd;
 
 			set_current_state(TASK_RUNNING);
 		
-			entry = (struct aac_list_head*)(ulong)(queues->queue[HostNormCmdQueue].cmdq.next);
-			dprintk(("aacraid: Command thread: removing fib from cmdq (%p)\n",entry));
-			aac_list_del(entry);
+			entry = queues->queue[HostNormCmdQueue].cmdq.next;
+			list_del(entry);
 			
 			spin_unlock_irqrestore(queues->queue[HostNormCmdQueue].lock, flags);
-			hw_fib = aac_list_entry(entry, struct hw_fib, header.FibLinks);
+			fib = list_entry(entry, struct fib, fiblink);
 			/*
 			 *	We will process the FIB here or pass it to a 
 			 *	worker thread that is TBD. We Really can't 
 			 *	do anything at this point since we don't have
 			 *	anything defined for this thread to do.
 			 */
-			memset(&fibptr, 0, sizeof(struct fib));
-			fibptr.type = FSAFS_NTC_FIB_CONTEXT;
-			fibptr.size = sizeof( struct fib );
-			fibptr.hw_fib = hw_fib;
-			fibptr.data = hw_fib->data;
-			fibptr.dev = dev;
+			hw_fib = fib->hw_fib;
+			memset(fib, 0, sizeof(struct fib));
+			fib->type = FSAFS_NTC_FIB_CONTEXT;
+			fib->size = sizeof( struct fib );
+			fib->hw_fib = hw_fib;
+			fib->data = hw_fib->data;
+			fib->dev = dev;
 			/*
 			 *	We only handle AifRequest fibs from the adapter.
 			 */
 			aifcmd = (struct aac_aifcmd *) hw_fib->data;
-			if (aifcmd->command == le16_to_cpu(AifCmdDriverNotify)) {
-				aac_handle_aif(dev, &fibptr);
+			if (aifcmd->command == cpu_to_le32(AifCmdDriverNotify)) {
+				/* Handle Driver Notify Events */
+				aac_handle_aif(dev, fib);
+				*(u32 *)hw_fib->data = cpu_to_le32(ST_OK);
+				fib_adapter_complete(fib, sizeof(u32));
 			} else {
 				struct list_head *entry;
 				/* The u32 here is important and intended. We are using
@@ -872,6 +870,10 @@
 				u32 time_now, time_last;
 				unsigned long flagv;
 				
+				/* Sniff events */
+				if (aifcmd->command == cpu_to_le32(AifCmdEventNotify))
+					aac_handle_aif(dev, fib);
+				
 				time_now = jiffies/HZ;
 
 				spin_lock_irqsave(&dev->fib_lock, flagv);
@@ -893,6 +895,11 @@
 					 */
 					if (fibctx->count > 20)
 					{
+						/*
+						 * It's *not* jiffies folks,
+						 * but jiffies / HZ so do not
+						 * panic ...
+						 */
 						time_last = fibctx->jiffies;
 						/*
 						 * Has it been > 2 minutes 
@@ -909,17 +916,20 @@
 					 * Warning: no sleep allowed while
 					 * holding spinlock
 					 */
-					newfib = kmalloc(sizeof(struct hw_fib), GFP_ATOMIC);
-					if (newfib) {
+					hw_newfib = kmalloc(sizeof(struct hw_fib), GFP_ATOMIC);
+					newfib = kmalloc(sizeof(struct fib), GFP_ATOMIC);
+					if (newfib && hw_newfib) {
 						/*
 						 * Make the copy of the FIB
 						 */
-						memcpy(newfib, hw_fib, sizeof(struct hw_fib));
+						memcpy(hw_newfib, hw_fib, sizeof(struct hw_fib));
+						memcpy(newfib, fib, sizeof(struct fib));
+						newfib->hw_fib = hw_newfib;
 						/*
 						 * Put the FIB onto the
 						 * fibctx's fibs
 						 */
-						aac_list_add_tail(&newfib->header.FibLinks, &fibctx->hw_fib_list);
+						list_add_tail(&newfib->fiblink, &fibctx->fib_list);
 						fibctx->count++;
 						/* 
 						 * Set the event to wake up the
@@ -928,6 +938,10 @@
 						up(&fibctx->wait_sem);
 					} else {
 						printk(KERN_WARNING "aifd: didn't allocate NewFib.\n");
+						if(newfib)
+							kfree(newfib);
+						if(hw_newfib)
+							kfree(hw_newfib);
 					}
 					entry = entry->next;
 				}
@@ -935,10 +949,11 @@
 				 *	Set the status of this FIB
 				 */
 				*(u32 *)hw_fib->data = cpu_to_le32(ST_OK);
-				fib_adapter_complete(&fibptr, sizeof(u32));
+				fib_adapter_complete(fib, sizeof(u32));
 				spin_unlock_irqrestore(&dev->fib_lock, flagv);
 			}
 			spin_lock_irqsave(queues->queue[HostNormCmdQueue].lock, flags);
+			kfree(fib);
 		}
 		/*
 		 *	There are no more AIF's
diff -Nru a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c
--- a/drivers/scsi/aacraid/dpcsup.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/aacraid/dpcsup.c	Tue Jun 15 22:20:40 2004
@@ -70,12 +70,12 @@
 	 */
 	while(aac_consumer_get(dev, q, &entry))
 	{
-		u32 fast ;
-		fast = (entry->addr & cpu_to_le32(0x01));
-		hwfib = (struct hw_fib *)((char *)dev->hw_fib_va + 
-				((entry->addr & ~0x01) - dev->hw_fib_pa));
-		fib = &dev->fibs[hwfib->header.SenderData];
-
+		int fast;
+		u32 index = le32_to_cpu(entry->addr);
+		fast = index & 0x01;
+		fib = &dev->fibs[index >> 1];
+		hwfib = fib->hw_fib;
+		
 		aac_consumer_free(dev, q, HostNormRespQueue);
 		/*
 		 *	Remove this fib from the Outstanding I/O queue.
@@ -169,29 +169,44 @@
 	 */
 	while(aac_consumer_get(dev, q, &entry))
 	{
+		struct fib fibctx;
 		struct hw_fib * hw_fib;
-		hw_fib = (struct hw_fib *)((char *)dev->hw_fib_va + 
-				((entry->addr & ~0x01) - dev->hw_fib_pa));
-
-		if (dev->aif_thread) {
-		        aac_list_add_tail(&hw_fib->header.FibLinks, &q->cmdq);
+		u32 index;
+		struct fib *fib = &fibctx;
+		
+		index = le32_to_cpu(entry->addr) / sizeof(struct hw_fib);
+		hw_fib = &dev->aif_base_va[index];
+		
+		/*
+		 *	Allocate a FIB at all costs. For non queued stuff
+		 *	we can just use the stack so we are happy. We need
+		 *	a fib object in order to manage the linked lists
+		 */
+		if (dev->aif_thread)
+			if((fib = kmalloc(sizeof(struct fib), GFP_ATOMIC)) == NULL)
+				fib = &fibctx;
+		
+		memset(fib, 0, sizeof(struct fib));
+		INIT_LIST_HEAD(&fib->fiblink);
+		fib->type = FSAFS_NTC_FIB_CONTEXT;
+		fib->size = sizeof(struct fib);
+		fib->hw_fib = hw_fib;
+		fib->data = hw_fib->data;
+		fib->dev = dev;
+		
+				
+		if (dev->aif_thread && fib != &fibctx) {
+		        list_add_tail(&fib->fiblink, &q->cmdq);
 	 	        aac_consumer_free(dev, q, HostNormCmdQueue);
 		        wake_up_interruptible(&q->cmdready);
 		} else {
-			struct fib fibctx;
 	 	        aac_consumer_free(dev, q, HostNormCmdQueue);
 			spin_unlock_irqrestore(q->lock, flags);
-			memset(&fibctx, 0, sizeof(struct fib));
-			fibctx.type = FSAFS_NTC_FIB_CONTEXT;
-			fibctx.size = sizeof(struct fib);
-			fibctx.hw_fib = hw_fib;
-			fibctx.data = hw_fib->data;
-			fibctx.dev = dev;
 			/*
 			 *	Set the status of this FIB
 			 */
 			*(u32 *)hw_fib->data = cpu_to_le32(ST_OK);
-			fib_adapter_complete(&fibctx, sizeof(u32));
+			fib_adapter_complete(fib, sizeof(u32));
 			spin_lock_irqsave(q->lock, flags);
 		}		
 	}
diff -Nru a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
--- a/drivers/scsi/aacraid/linit.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/aacraid/linit.c	Tue Jun 15 22:20:39 2004
@@ -381,13 +381,15 @@
 				}
 			}
 			spin_unlock_irqrestore(&dev->list_lock, flags);
+			if (active)
+				break;
 
-			/*
-			 * We can exit If all the commands are complete
-			 */
-			if (active == 0)
-				return SUCCESS;
 		}
+		/*
+		 * We can exit If all the commands are complete
+		 */
+		if (active == 0)
+			return SUCCESS;
 		spin_unlock_irq(host->host_lock);
 		scsi_sleep(HZ);
 		spin_lock_irq(host->host_lock);
diff -Nru a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
--- a/drivers/scsi/aacraid/sa.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/aacraid/sa.c	Tue Jun 15 22:20:41 2004
@@ -419,6 +419,11 @@
 	 *	Start any kernel threads needed
 	 */
 	dev->thread_pid = kernel_thread((int (*)(void *))aac_command_thread, dev, 0);
+	if (dev->thread_pid < 0) {
+		printk(KERN_ERR "aacraid: Unable to create command thread.\n");
+		return -1;
+	}
+
 	/*
 	 *	Tell the adapter that all is configure, and it can start 
 	 *	accepting requests
diff -Nru a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
--- a/drivers/scsi/aha152x.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/aha152x.c	Tue Jun 15 22:20:36 2004
@@ -240,8 +240,6 @@
 #include <asm/irq.h>
 #include <asm/io.h>
 #include <linux/blkdev.h>
-#include "scsi.h"
-#include "hosts.h"
 #include <asm/system.h>
 #include <linux/errno.h>
 #include <linux/string.h>
@@ -259,6 +257,7 @@
 #include <scsi/scsicam.h>
 
 #include "scsi.h"
+#include "hosts.h"
 #include "aha152x.h"
 
 
@@ -578,11 +577,11 @@
 #define MSGO(i)			(HOSTDATA(shpnt)->msgo[i])
 #define MSGO_I			(HOSTDATA(shpnt)->msgo_i)
 #define MSGOLEN			(HOSTDATA(shpnt)->msgo_len)
-#define ADDMSGO(x)		(MSGOLEN<256 ? MSGO(MSGOLEN++)=x : aha152x_error(shpnt,"MSGO overflow"))
+#define ADDMSGO(x)		(MSGOLEN<256 ? (void)(MSGO(MSGOLEN++)=x) : aha152x_error(shpnt,"MSGO overflow"))
 
 #define MSGI(i)			(HOSTDATA(shpnt)->msgi[i])
 #define MSGILEN			(HOSTDATA(shpnt)->msgi_len)
-#define ADDMSGI(x)		(MSGILEN<256 ? MSGI(MSGILEN++)=x : aha152x_error(shpnt,"MSGI overflow"))
+#define ADDMSGI(x)		(MSGILEN<256 ? (void)(MSGI(MSGILEN++)=x) : aha152x_error(shpnt,"MSGI overflow"))
 
 #define DATA_LEN		(HOSTDATA(shpnt)->data_len)
 
diff -Nru a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c
--- a/drivers/scsi/aic7xxx/aic7770_osm.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/aic7xxx/aic7770_osm.c	Tue Jun 15 22:20:42 2004
@@ -73,7 +73,7 @@
 static int aic7770_linux_config(struct aic7770_identity *entry,
 				aic7770_dev_t dev, u_int eisaBase);
 
-void
+int
 ahc_linux_eisa_init(void)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
@@ -82,7 +82,7 @@
 	int i;
 
 	if (aic7xxx_probe_eisa_vl == 0)
-		return;
+		return -ENODEV;
 
 	/*
 	 * Linux requires the EISA IDs to be specified in
@@ -93,7 +93,7 @@
 					 (ahc_num_aic7770_devs + 1),
 					 M_DEVBUF, M_NOWAIT);
 	if (aic7770_driver.id_table == NULL)
-		return;
+		return -ENOMEM;
 
 	for (eid = (struct eisa_device_id *)aic7770_driver.id_table,
 	     id = aic7770_ident_table, i = 0;
@@ -109,15 +109,16 @@
 	}
 	eid->sig[0] = 0;
 
-	eisa_driver_register(&aic7770_driver);
+	return eisa_driver_register(&aic7770_driver);
 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
 	struct aic7770_identity *entry;
 	u_int  slot;
 	u_int  eisaBase;
 	u_int  i;
+	int ret = -ENODEV;
 
 	if (aic7xxx_probe_eisa_vl == 0)
-		return;
+		return ret;
 
 	eisaBase = 0x1000 + AHC_EISA_SLOT_OFFSET;
 	for (slot = 1; slot < NUMSLOTS; eisaBase+=0x1000, slot++) {
@@ -146,24 +147,22 @@
 			continue;  /* no EISA card in slot */
 
 		entry = aic7770_find_device(eisa_id);
-		if (entry != NULL)
+		if (entry != NULL) {
 			aic7770_linux_config(entry, NULL, eisaBase);
+			ret = 0;
+		}
 	}
+	return ret;
 #endif
 }
 
 void
 ahc_linux_eisa_exit(void)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	if (aic7xxx_probe_eisa_vl == 0)
-		return;
-
-	if (aic7770_driver.id_table != NULL) {
+	if(aic7xxx_probe_eisa_vl != 0 && aic7770_driver.id_table != NULL) {
 		eisa_driver_unregister(&aic7770_driver);
 		free(aic7770_driver.id_table, M_DEVBUF);
 	}
-#endif
 }
 
 static int
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c	Tue Jun 15 22:20:41 2004
@@ -2591,6 +2591,7 @@
 	sprintf(current->comm, "ahd_dv_%d", ahd->unit);
 #else
 	daemonize("ahd_dv_%d", ahd->unit);
+	current->flags |= PF_FREEZE;
 #endif
 	unlock_kernel();
 
diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c	Tue Jun 15 22:20:36 2004
@@ -843,7 +843,8 @@
 ahc_linux_detect(Scsi_Host_Template *template)
 {
 	struct	ahc_softc *ahc;
-	int     found;
+	int     found = 0;
+	int	eisa_err, pci_err;
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	/*
@@ -891,28 +892,29 @@
 	 */
 	ahc_list_lockinit();
 
-#ifdef CONFIG_PCI
-	ahc_linux_pci_init();
-#endif
+	pci_err = ahc_linux_pci_init();
+	eisa_err = ahc_linux_eisa_init();
+
+	if(pci_err && eisa_err)
+		goto out;
 
-#ifdef CONFIG_EISA
-	ahc_linux_eisa_init();
-#endif
 
 	/*
 	 * Register with the SCSI layer all
 	 * controllers we've found.
 	 */
-	found = 0;
 	TAILQ_FOREACH(ahc, &ahc_tailq, links) {
 
 		if (ahc_linux_register_host(ahc, template) == 0)
 			found++;
 	}
+out:
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	spin_lock_irq(&io_request_lock);
 #endif
 	aic7xxx_detect_complete++;
+
 	return (found);
 }
 
@@ -1534,6 +1536,7 @@
 
 	/* Still equal.  Sort by BIOS address, ioport, or bus/slot/func. */
 	switch (rvalue) {
+#ifdef CONFIG_PCI
 	case AHC_PCI:
 	{
 		char primary_channel;
@@ -1566,6 +1569,7 @@
 			value = 1;
 		break;
 	}
+#endif
 	case AHC_EISA:
 		if ((rahc->flags & AHC_BIOS_ENABLED) != 0) {
 			value = rahc->platform_data->bios_address
@@ -2296,6 +2300,7 @@
 	sprintf(current->comm, "ahc_dv_%d", ahc->unit);
 #else
 	daemonize("ahc_dv_%d", ahc->unit);
+	current->flags |= PF_FREEZE;
 #endif
 	unlock_kernel();
 
@@ -3969,11 +3974,10 @@
 }
 
 static void
-ahc_linux_free_device(struct ahc_softc *ahc, struct ahc_linux_device *dev)
+__ahc_linux_free_device(struct ahc_softc *ahc, struct ahc_linux_device *dev)
 {
 	struct ahc_linux_target *targ;
 
-	del_timer_sync(&dev->timer);
 	targ = dev->target;
 	targ->devices[dev->lun] = NULL;
 	free(dev, M_DEVBUF);
@@ -3983,6 +3987,13 @@
 		ahc_linux_free_target(ahc, targ);
 }
 
+static void
+ahc_linux_free_device(struct ahc_softc *ahc, struct ahc_linux_device *dev)
+{
+	del_timer_sync(&dev->timer);
+	__ahc_linux_free_device(ahc, dev);
+}
+
 void
 ahc_send_async(struct ahc_softc *ahc, char channel,
 	       u_int target, u_int lun, ac_code code, void *arg)
@@ -4693,7 +4704,7 @@
 		ahc_linux_run_device_queue(ahc, dev);
 	if (TAILQ_EMPTY(&dev->busyq)
 	 && dev->active == 0)
-		ahc_linux_free_device(ahc, dev);
+		__ahc_linux_free_device(ahc, dev);
 	ahc_unlock(ahc, &s);
 }
 
@@ -5067,11 +5078,17 @@
 	}
 }
 
+static void ahc_linux_exit(void);
+
 static int __init
 ahc_linux_init(void)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	return (ahc_linux_detect(&aic7xxx_driver_template) ? 0 : -ENODEV);
+	int rc = ahc_linux_detect(&aic7xxx_driver_template);
+	if (rc)
+		return rc;
+	ahc_linux_exit();
+	return -ENODEV;
 #else
 	scsi_register_module(MODULE_SCSI_HA, &aic7xxx_driver_template);
 	if (aic7xxx_driver_template.present == 0) {
@@ -5084,7 +5101,7 @@
 #endif
 }
 
-static void __exit
+static void
 ahc_linux_exit(void)
 {
 	struct ahc_softc *ahc;
@@ -5111,12 +5128,8 @@
 	 */
 	scsi_unregister_module(MODULE_SCSI_HA, &aic7xxx_driver_template);
 #endif
-#ifdef CONFIG_PCI
 	ahc_linux_pci_exit();
-#endif
-#ifdef CONFIG_EISA
 	ahc_linux_eisa_exit();
-#endif
 }
 
 module_init(ahc_linux_init);
diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h	Tue Jun 15 22:20:39 2004
@@ -840,11 +840,17 @@
 
 #ifdef CONFIG_EISA
 extern uint32_t aic7xxx_probe_eisa_vl;
-void			 ahc_linux_eisa_init(void);
+int			 ahc_linux_eisa_init(void);
 void			 ahc_linux_eisa_exit(void);
 int			 aic7770_map_registers(struct ahc_softc *ahc,
 					       u_int port);
 int			 aic7770_map_int(struct ahc_softc *ahc, u_int irq);
+#else
+static inline int	ahc_linux_eisa_init(void) {
+	return -ENODEV;
+}
+static inline void	ahc_linux_eisa_exit(void) {
+}
 #endif
 
 /******************************* PCI Routines *********************************/
@@ -931,6 +937,12 @@
 ahc_get_pci_bus(ahc_dev_softc_t pci)
 {
 	return (pci->bus->number);
+}
+#else
+static inline int ahc_linux_pci_init(void) {
+	return -ENODEV;
+}
+static inline void ahc_linux_pci_exit(void) {
 }
 #endif
 
diff -Nru a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
--- a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c	Tue Jun 15 22:20:58 2004
@@ -319,13 +319,13 @@
         aic_dev->r_total+aic_dev->w_total, aic_dev->r_total, aic_dev->w_total);
     size += sprintf(BLS, "%s\n", HDRB);
     size += sprintf(BLS, "   Reads:");
-    for (i = 0; i < NUMBER(aic_dev->r_bins); i++)
+    for (i = 0; i < ARRAY_SIZE(aic_dev->r_bins); i++)
     {
       size += sprintf(BLS, " %10ld", aic_dev->r_bins[i]);
     }
     size += sprintf(BLS, "\n");
     size += sprintf(BLS, "  Writes:");
-    for (i = 0; i < NUMBER(aic_dev->w_bins); i++)
+    for (i = 0; i < ARRAY_SIZE(aic_dev->w_bins); i++)
     {
       size += sprintf(BLS, " %10ld", aic_dev->w_bins[i]);
     }
@@ -347,7 +347,7 @@
   else
   {
     *start = buffer;
-    length = MIN(length, size - offset);
+    length = min_t(int, length, size - offset);
     memcpy(buffer, &aic7xxx_buffer[offset], length);
   }
 
diff -Nru a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
--- a/drivers/scsi/aic7xxx_old.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/aic7xxx_old.c	Tue Jun 15 22:20:39 2004
@@ -254,9 +254,6 @@
 
 #define AIC7XXX_C_VERSION  "5.2.6"
 
-#define NUMBER(arr)     (sizeof(arr) / sizeof(arr[0]))
-#define MIN(a,b)        (((a) < (b)) ? (a) : (b))
-#define MAX(a,b)        (((a) > (b)) ? (a) : (b))
 #define ALL_TARGETS -1
 #define ALL_CHANNELS -1
 #define ALL_LUNS -1
@@ -1376,7 +1373,7 @@
 
   while ((p = strsep(&s, ",.")) != NULL)
   {
-    for (i = 0; i < NUMBER(options); i++)
+    for (i = 0; i < ARRAY_SIZE(options); i++)
     {
       n = strlen(options[i].name);
       if (!strncmp(options[i].name, p, n))
@@ -1423,7 +1420,7 @@
                   else if (instance >= 0)
                     instance++;
                   if ( (device >= MAX_TARGETS) || 
-                       (instance >= NUMBER(aic7xxx_tag_info)) )
+                       (instance >= ARRAY_SIZE(aic7xxx_tag_info)) )
                     done = TRUE;
                   tok++;
                   if (!done)
@@ -1447,7 +1444,7 @@
                     }
                   }
                   if ( (instance >= 0) && (device >= 0) &&
-                       (instance < NUMBER(aic7xxx_tag_info)) &&
+                       (instance < ARRAY_SIZE(aic7xxx_tag_info)) &&
                        (device < MAX_TARGETS) )
                     aic7xxx_tag_info[instance].tag_commands[device] =
                       simple_strtoul(tok, NULL, 0) & 0xff;
@@ -1658,7 +1655,7 @@
         {
           int end_addr;
 
-          end_addr = MIN(address, skip_addr);
+          end_addr = min_t(int, address, skip_addr);
           address_offset += end_addr - i;
           i = skip_addr;
         }
@@ -1884,7 +1881,7 @@
       if(!(p->features & AHC_ULTRA3))
       {
         *options = 0;
-        maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2);
+        maxsync = max_t(unsigned int, maxsync, AHC_SYNCRATE_ULTRA2);
       }
       break;
     case MSG_EXT_PPR_OPTION_DT_CRC_QUICK:
@@ -1892,7 +1889,7 @@
       if(!(p->features & AHC_ULTRA3))
       {
         *options = 0;
-        maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2);
+        maxsync = max_t(unsigned int, maxsync, AHC_SYNCRATE_ULTRA2);
       }
       else
       {
@@ -1916,7 +1913,7 @@
       break;
     default:
       *options = 0;
-      maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2);
+      maxsync = max_t(unsigned int, maxsync, AHC_SYNCRATE_ULTRA2);
       break;
   }
   syncrate = &aic7xxx_syncrates[maxsync];
@@ -2057,7 +2054,7 @@
     else
       maxoffset = MAX_OFFSET_8BIT;
   }
-  *offset = MIN(*offset, maxoffset);
+  *offset = min(*offset, maxoffset);
 }
 
 /*+F*************************************************************************
@@ -2570,7 +2567,7 @@
         break;
       }
     }
-    scb_count = MIN( (i-1), p->scb_data->maxscbs - p->scb_data->numscbs);
+    scb_count = min( (i-1), p->scb_data->maxscbs - p->scb_data->numscbs);
     scb_ap = (struct aic7xxx_scb *)kmalloc(sizeof (struct aic7xxx_scb) * scb_count
 					   + sizeof(struct aic7xxx_scb_dma), GFP_ATOMIC);
     if (scb_ap == NULL)
@@ -5042,7 +5039,7 @@
             if(p->user[tindex].offset)
             {
               aic_dev->needsdtr_copy = 1;
-              aic_dev->goal.period = MAX(10,p->user[tindex].period);
+              aic_dev->goal.period = max_t(unsigned char, 10,p->user[tindex].period);
               if(p->features & AHC_ULTRA2)
               {
                 aic_dev->goal.offset = MAX_OFFSET_ULTRA2;
@@ -5086,8 +5083,8 @@
            * the device isn't allowed to send values greater than the ones
            * we first sent to it.
            */
-          new_period = MAX(period, aic_dev->goal.period);
-          new_offset = MIN(offset, aic_dev->goal.offset);
+          new_period = max_t(unsigned int, period, aic_dev->goal.period);
+          new_offset = min_t(unsigned int, offset, aic_dev->goal.offset);
         }
  
         /*
@@ -5208,7 +5205,7 @@
             if(p->user[tindex].offset)
             {
               aic_dev->needsdtr_copy = 1;
-              aic_dev->goal.period = MAX(10,p->user[tindex].period);
+              aic_dev->goal.period = max_t(unsigned char, 10, p->user[tindex].period);
               if(p->features & AHC_ULTRA2)
               {
                 aic_dev->goal.offset = MAX_OFFSET_ULTRA2;
@@ -6413,7 +6410,7 @@
     unsigned char errno = aic_inb(p, ERROR);
 
     printk(KERN_ERR "(scsi%d) BRKADRINT error(0x%x):\n", p->host_no, errno);
-    for (i = 0; i < NUMBER(hard_error); i++)
+    for (i = 0; i < ARRAY_SIZE(hard_error); i++)
     {
       if (errno & hard_error[i].errno)
       {
@@ -6562,7 +6559,7 @@
       else
       {
         aic_dev->needsdtr = aic_dev->needsdtr_copy = 1;
-        aic_dev->goal.period = MAX(10, aic_dev->goal.period);
+        aic_dev->goal.period = max_t(unsigned char, 10, aic_dev->goal.period);
         aic_dev->goal.options = 0;
       }
     }
@@ -6673,7 +6670,7 @@
     }
     else
     {
-      if (p->instance >= NUMBER(aic7xxx_tag_info))
+      if (p->instance >= ARRAY_SIZE(aic7xxx_tag_info))
       {
         static int print_warning = TRUE;
         if(print_warning)
@@ -6850,7 +6847,7 @@
     buf[i] = inb(base + i);
   }
 
-  for (i = 0; i < NUMBER(AIC7xxx); i++)
+  for (i = 0; i < ARRAY_SIZE(AIC7xxx); i++)
   {
     /*
      * Signature match on enabled card?
@@ -9199,7 +9196,7 @@
     unsigned int  devconfig, i, oldverbose;
     struct pci_dev *pdev = NULL;
 
-    for (i = 0; i < NUMBER(aic_pdevs); i++)
+    for (i = 0; i < ARRAY_SIZE(aic_pdevs); i++)
     {
       pdev = NULL;
       while ((pdev = pci_find_device(aic_pdevs[i].vendor_id,
@@ -9678,7 +9675,9 @@
           found++;
 	  continue;
 skip_pci_controller:
+#ifdef CONFIG_PCI
 	  pci_release_regions(temp_p->pdev);
+#endif
 	  kfree(temp_p);
         }  /* Found an Adaptec PCI device. */
         else /* Well, we found one, but we couldn't get any memory */
@@ -9698,7 +9697,7 @@
    * EISA/VL-bus card signature probe.
    */
   slot = MINSLOT;
-  while ( (slot <= MAXSLOT) && 
+  while ( (slot <= MAXSLOT) &&
          !(aic7xxx_no_probe) )
   {
     base = SLOTBASE(slot) + MINREG;
@@ -10097,7 +10096,7 @@
       int i;
       
       left = found;
-      for (i=0; i<NUMBER(sort_list); i++)
+      for (i=0; i<ARRAY_SIZE(sort_list); i++)
       {
         temp_p = sort_list[i];
         while(temp_p != NULL)
@@ -10970,8 +10969,10 @@
 #endif /* MMAPIO */
   if(!p->pdev)
     release_region(p->base, MAXREG - MINREG);
+#ifdef CONFIG_PCI
   else
     pci_release_regions(p->pdev);
+#endif
   prev = NULL;
   next = first_aic7xxx;
   while(next != NULL)
diff -Nru a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
--- a/drivers/scsi/ata_piix.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/ata_piix.c	Tue Jun 15 22:20:40 2004
@@ -2,6 +2,10 @@
 
     ata_piix.c - Intel PATA/SATA controllers
 
+    Maintained by:  Jeff Garzik <jgarzik@pobox.com>
+    		    Please ALWAYS copy linux-ide@vger.kernel.org
+		    on emails.
+
 
 	Copyright 2003-2004 Red Hat Inc
 	Copyright 2003-2004 Jeff Garzik
@@ -24,7 +28,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME	"ata_piix"
@@ -132,6 +136,7 @@
 
 	.phy_reset		= piix_pata_phy_reset,
 
+	.bmdma_setup		= ata_bmdma_setup_pio,
 	.bmdma_start		= ata_bmdma_start_pio,
 	.fill_sg		= ata_fill_sg,
 	.eng_timeout		= ata_eng_timeout,
@@ -154,6 +159,7 @@
 
 	.phy_reset		= piix_sata_phy_reset,
 
+	.bmdma_setup		= ata_bmdma_setup_pio,
 	.bmdma_start		= ata_bmdma_start_pio,
 	.fill_sg		= ata_fill_sg,
 	.eng_timeout		= ata_eng_timeout,
@@ -266,7 +272,7 @@
 
 /**
  *	piix_sata_probe - Probe PCI device for present SATA devices
- *	@pdev: PCI device to probe
+ *	@ap: Port associated with the PCI device we wish to probe
  *
  *	Reads SATA PCI device's PCI config register Port Configuration
  *	and Status (PCS) to determine port and device availability.
@@ -418,16 +424,15 @@
 	int w_flag		= 0x10 << drive_dn;
 	int u_speed		= 0;
 	int			sitre;
-	u16			reg4042, reg44, reg48, reg4a, reg54;
-	u8			reg55;
+	u16			reg4042, reg4a;
+	u8			reg48, reg54, reg55;
 
 	pci_read_config_word(dev, maslave, &reg4042);
 	DPRINTK("reg4042 = 0x%04x\n", reg4042);
 	sitre = (reg4042 & 0x4000) ? 1 : 0;
-	pci_read_config_word(dev, 0x44, &reg44);
-	pci_read_config_word(dev, 0x48, &reg48);
+	pci_read_config_byte(dev, 0x48, &reg48);
 	pci_read_config_word(dev, 0x4a, &reg4a);
-	pci_read_config_word(dev, 0x54, &reg54);
+	pci_read_config_byte(dev, 0x54, &reg54);
 	pci_read_config_byte(dev, 0x55, &reg55);
 
 	switch(speed) {
@@ -444,23 +449,19 @@
 	}
 
 	if (!(reg48 & u_flag))
-		pci_write_config_word(dev, 0x48, reg48|u_flag);
+		pci_write_config_byte(dev, 0x48, reg48 | u_flag);
 	if (speed == XFER_UDMA_5) {
 		pci_write_config_byte(dev, 0x55, (u8) reg55|w_flag);
 	} else {
 		pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
 	}
-	if (!(reg4a & u_speed)) {
-		pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
-		pci_write_config_word(dev, 0x4a, reg4a|u_speed);
-	}
+	if ((reg4a & a_speed) != u_speed)
+		pci_write_config_word(dev, 0x4a, (reg4a & ~a_speed) | u_speed);
 	if (speed > XFER_UDMA_2) {
-		if (!(reg54 & v_flag)) {
-			pci_write_config_word(dev, 0x54, reg54|v_flag);
-		}
-	} else {
-		pci_write_config_word(dev, 0x54, reg54 & ~v_flag);
-	}
+		if (!(reg54 & v_flag))
+			pci_write_config_byte(dev, 0x54, reg54 | v_flag);
+	} else
+		pci_write_config_byte(dev, 0x54, reg54 & ~v_flag);
 }
 
 /* move to PCI layer, integrate w/ MSI stuff */
diff -Nru a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
--- a/drivers/scsi/atp870u.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/atp870u.c	Tue Jun 15 22:20:39 2004
@@ -4,6 +4,7 @@
  *  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>
+ *  2.6.x update (C) 2004  Red Hat <alan@redhat.com>
  *
  * Marcelo Tosatti <marcelo@conectiva.com.br> : SMP fixes
  *
@@ -126,9 +127,11 @@
 			/*
 			 *      Issue more commands
 			 */
+			spin_lock_irqsave(dev->host->host_lock, flags);
 			if (((dev->quhdu != dev->quendu) || (dev->last_cmd != 0xff)) && (dev->in_snd == 0)) {
 				send_s870(host);
 			}
+			spin_unlock_irqrestore(dev->host->host_lock, flags);
 			/*
 			 *      Done
 			 */
@@ -371,9 +374,11 @@
 			/*
 			 *      If there is stuff to send and nothing going then send it
 			 */
+			spin_lock_irqsave(dev->host->host_lock, flags);
 			if (((dev->last_cmd != 0xff) || (dev->quhdu != dev->quendu)) && (dev->in_snd == 0)) {
 				send_s870(host);
 			}
+			spin_unlock_irqrestore(dev->host->host_lock, flags);
 			dev->in_int = 0;
 			goto out;
 		}
@@ -443,9 +448,16 @@
 	return IRQ_HANDLED;
 }
 
+/**
+ *	atp870u_queuecommand	-	Queue SCSI command
+ *	@req_p: request block
+ *	@done: completion function
+ *
+ *	Queue a command to the ATP queue. Called with the host lock held.
+ */
+ 
 static int atp870u_queuecommand(Scsi_Cmnd * req_p, void (*done) (Scsi_Cmnd *))
 {
-	unsigned long flags;
 	unsigned short int m;
 	unsigned int tmport;
 	struct Scsi_Host *host;
@@ -484,7 +496,6 @@
 	 *      Count new command
 	 */
 
-	spin_lock_irqsave(host->host_lock, flags);
 	dev->quendu++;
 	if (dev->quendu >= qcnt) {
 		dev->quendu = 0;
@@ -498,24 +509,31 @@
 		}
 		dev->quendu--;
 		req_p->result = 0x00020000;
-		spin_unlock_irqrestore(host->host_lock, flags);
 		done(req_p);
 		return 0;
 	}
 	dev->querequ[dev->quendu] = req_p;
 	tmport = dev->ioport + 0x1c;
-	spin_unlock_irqrestore(host->host_lock, flags);
 	if ((inb(tmport) == 0) && (dev->in_int == 0) && (dev->in_snd == 0)) {
 		send_s870(host);
 	}
 	return 0;
 }
 
+/**
+ *	send_s870	-	send a command to the controller
+ *	@host: host
+ *
+ *	On entry there is work queued to be done. We move some of that work to the
+ *	controller itself. 
+ *
+ *	Caller holds the host lock.
+ */
+ 
 static void send_s870(struct Scsi_Host *host)
 {
 	unsigned int tmport;
 	Scsi_Cmnd *workrequ;
-	unsigned long flags;
 	unsigned int i;
 	unsigned char j, target_id;
 	unsigned char *prd;
@@ -527,10 +545,7 @@
 	struct atp_unit *dev = (struct atp_unit *)&host->hostdata;
 	int sg_count;
 
-	spin_lock_irqsave(host->host_lock, flags);
-	
 	if (dev->in_snd != 0) {
-		spin_unlock_irqrestore(host->host_lock, flags);
 		return;
 	}
 	dev->in_snd = 1;
@@ -543,13 +558,11 @@
 		dev->last_cmd = 0xff;
 		if (dev->quhdu == dev->quendu) {
 			dev->in_snd = 0;
-			spin_unlock_irqrestore(dev->host->host_lock, flags);
 			return;
 		}
 	}
 	if ((dev->last_cmd != 0xff) && (dev->working != 0)) {
 		dev->in_snd = 0;
-		spin_unlock_irqrestore(dev->host->host_lock, flags);
 		return;
 	}
 	dev->working++;
@@ -567,7 +580,6 @@
 	dev->quhdu = j;
 	dev->working--;
 	dev->in_snd = 0;
-	spin_unlock_irqrestore(host->host_lock, flags);
 	return;
 cmd_subp:
 	workportu = dev->ioport;
@@ -582,7 +594,6 @@
 abortsnd:
 	dev->last_cmd |= 0x40;
 	dev->in_snd = 0;
-	spin_unlock_irqrestore(dev->host->host_lock, flags);
 	return;
 oktosend:
 	memcpy(&dev->ata_cdbu[0], &workrequ->cmnd[0], workrequ->cmd_len);
@@ -684,7 +695,6 @@
 			dev->last_cmd |= 0x40;
 		}
 		dev->in_snd = 0;
-		spin_unlock_irqrestore(host->host_lock, flags);
 		return;
 	}
 	tmpcip = dev->pciport;
@@ -770,7 +780,6 @@
 			dev->last_cmd |= 0x40;
 		}
 		dev->in_snd = 0;
-		spin_unlock_irqrestore(host->host_lock, flags);
 		return;
 	}
 	if (inb(tmport) == 0) {
@@ -781,9 +790,6 @@
 		dev->last_cmd |= 0x40;
 	}
 	dev->in_snd = 0;
-	spin_unlock_irqrestore(host->host_lock, flags);
-	return;
-
 }
 
 static unsigned char fun_scam(struct atp_unit *dev, unsigned short int *val)
diff -Nru a/drivers/scsi/constants.c b/drivers/scsi/constants.c
--- a/drivers/scsi/constants.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/scsi/constants.c	Tue Jun 15 22:20:43 2004
@@ -31,6 +31,8 @@
 #endif
 #define CONSTANTS (CONST_COMMAND | CONST_STATUS | CONST_SENSE | CONST_XSENSE \
 		   | CONST_CMND | CONST_MSG | CONST_HOST | CONST_DRIVER)
+#else
+#define CONSTANTS 0
 #endif
 
 #if (CONSTANTS & CONST_COMMAND)
diff -Nru a/drivers/scsi/cpqfcTScontrol.c b/drivers/scsi/cpqfcTScontrol.c
--- a/drivers/scsi/cpqfcTScontrol.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/cpqfcTScontrol.c	Tue Jun 15 22:20:36 2004
@@ -607,6 +607,7 @@
         if( (fcChip->IMQ->QEntry[CI].type & 0x1FF) == 0x104 )
         { 
           TachFCHDR_GCMND* fchs;
+#error This is too much stack
           ULONG ulFibreFrame[2048/4];  // max DWORDS in incoming FC Frame
 	  USHORT SFQpi = (USHORT)(fcChip->IMQ->QEntry[CI].word[0] & 0x0fffL);
 
@@ -718,6 +719,7 @@
   ULONG x_ID;
   ULONG ulBuff, dwStatus;
   TachFCHDR_GCMND* fchs;
+#error This is too much stack
   ULONG ulFibreFrame[2048/4];  // max number of DWORDS in incoming Fibre Frame
   UCHAR ucInboundMessageType;  // Inbound CM, dword 3 "type" field
 
diff -Nru a/drivers/scsi/dc390.h b/drivers/scsi/dc390.h
--- a/drivers/scsi/dc390.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/scsi/dc390.h	Tue Jun 15 22:20:37 2004
@@ -19,7 +19,7 @@
 #endif
 
 #define DC390_BANNER "Tekram DC390/AM53C974"
-#define DC390_VERSION "2.0f 2000-12-20"
+#define DC390_VERSION "2.1b 2004-04-13"
 
 /* We don't have eh_abort_handler, eh_device_reset_handler, 
  * eh_bus_reset_handler, eh_host_reset_handler yet! 
@@ -33,11 +33,11 @@
 # define USE_NEW_EH
 #endif
 
-extern int DC390_detect(Scsi_Host_Template *psht);
-extern int DC390_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *));
-extern int DC390_abort(Scsi_Cmnd *cmd);
-extern int DC390_reset(Scsi_Cmnd *cmd);
-extern int DC390_bios_param(struct scsi_device *sdev, struct block_device *dev,
+static int DC390_detect(Scsi_Host_Template *psht);
+static int DC390_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *));
+static int DC390_abort(Scsi_Cmnd *cmd);
+static int DC390_reset(Scsi_Cmnd *cmd);
+static int DC390_bios_param(struct scsi_device *sdev, struct block_device *dev,
 		sector_t capacity, int geom[]);
 
 static int DC390_release(struct Scsi_Host *);
diff -Nru a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
--- a/drivers/scsi/dpt_i2o.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/scsi/dpt_i2o.c	Tue Jun 15 22:20:44 2004
@@ -20,17 +20,21 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  ***************************************************************************/
+/***************************************************************************
+ * Sat Dec 20 2003 Go Taniguchi <go@turbolinux.co.jp>
+ - Support 2.6 kernel and DMA-mapping
+ - ioctl fix for raid tools
+ - use schedule_timeout in long long loop
+ **************************************************************************/
 
-//#define DEBUG 1
-//#define UARTDELAY 1
+/*#define DEBUG 1 */
+/*#define UARTDELAY 1 */
 
-// On the real kernel ADDR32 should always be zero for 2.4. GFP_HIGH allocates
-// high pages. Keep the macro around because of the broken unmerged ia64 tree
+/* On the real kernel ADDR32 should always be zero for 2.4. GFP_HIGH allocates
+   high pages. Keep the macro around because of the broken unmerged ia64 tree */
 
 #define ADDR32 (0)
 
-#error Please convert me to Documentation/DMA-mapping.txt
-
 #include <linux/version.h>
 #include <linux/module.h>
 
@@ -53,12 +57,12 @@
 #include <linux/kernel.h>	/* for printk */
 #include <linux/sched.h>
 #include <linux/reboot.h>
+#include <linux/spinlock.h>
 #include <linux/smp_lock.h>
 
 #include <linux/timer.h>
 #include <linux/string.h>
 #include <linux/ioport.h>
-#include <linux/stat.h>
 
 #include <asm/processor.h>	/* for boot_cpu_data */
 #include <asm/pgtable.h>
@@ -86,7 +90,7 @@
 #elif defined(__alpha__)
 	PROC_ALPHA ,
 #else
-	(-1),(-1)
+	(-1),(-1),
 #endif
 	 FT_HBADRVR, 0, OEM_DPT, OS_LINUX, CAP_OVERLAP, DEV_ALL,
 	ADF_ALL_SC5, 0, 0, DPT_VERSION, DPT_REVISION, DPT_SUBREVISION,
@@ -227,7 +231,7 @@
 	/* Active IOPs now in OPERATIONAL state */
 	PDEBUG("HBA's in OPERATIONAL state\n");
 
-	printk(KERN_INFO"dpti: If you have a lot of devices this could take a few minutes.\n");
+	printk("dpti: If you have a lot of devices this could take a few minutes.\n");
 	for (pHba = hba_chain; pHba; pHba = pHba->next) {
 		printk(KERN_INFO"%s: Reading the hardware resource table.\n", pHba->name);
 		if (adpt_i2o_lct_get(pHba) < 0){
@@ -270,6 +274,7 @@
 	adpt_hba* pHba = (adpt_hba*) host->hostdata[0];
 //	adpt_i2o_quiesce_hba(pHba);
 	adpt_i2o_delete_hba(pHba);
+	scsi_unregister(host);
 	return 0;
 }
 
@@ -340,6 +345,8 @@
 	if (rcode != 0) {
 		sprintf(pHba->detail, "Adaptec I2O RAID");
 		printk(KERN_INFO "%s: Inquiry Error (%d)\n",pHba->name,rcode);
+		if (rcode != -ETIME && rcode != -EINTR)
+			kfree(buf);
 	} else {
 		memset(pHba->detail, 0, sizeof(pHba->detail));
 		memcpy(&(pHba->detail), "Vendor: Adaptec ", 16);
@@ -348,8 +355,8 @@
 		memcpy(&(pHba->detail[40]), " FW: ", 4);
 		memcpy(&(pHba->detail[44]), (u8*) &buf[32], 4);
 		pHba->detail[48] = '\0';	/* precautionary */
+		kfree(buf);
 	}
-	kfree(buf);
 	adpt_i2o_status_get(pHba);
 	return ;
 }
@@ -431,7 +438,7 @@
 			cmd->scsi_done(cmd);
 			return 0;
 		}
-		(struct adpt_device*)(cmd->device->hostdata) = pDev;
+		cmd->device->hostdata = pDev;
 	}
 	pDev->pScsi_dev = cmd->device;
 
@@ -479,7 +486,7 @@
 		heads = 255;
 		sectors = 63;
 	}
-	cylinders = capacity / (heads * sectors);
+	cylinders = sector_div(capacity, heads * sectors);
 
 	// Special case if CDROM
 	if(sdev->type == 5) {  // CDROM
@@ -872,6 +879,9 @@
 		return -EINVAL;
 	}
 	pci_set_master(pDev);
+	if (pci_set_dma_mask(pDev, 0xffffffffffffffffULL) &&
+	    pci_set_dma_mask(pDev, 0xffffffffULL))
+		return -EINVAL;
 
 	base_addr0_phys = pci_resource_start(pDev,0);
 	hba_map0_area_size = pci_resource_len(pDev,0);
@@ -964,6 +974,7 @@
 
 	// Initializing the spinlocks
 	spin_lock_init(&pHba->state_lock);
+	spin_lock_init(&adpt_post_wait_lock);
 
 	if(raptorFlag == 0){
 		printk(KERN_INFO"Adaptec I2O RAID controller %d at %lx size=%x irq=%d\n", 
@@ -1065,7 +1076,7 @@
 {
 	int i;
 
-	printk(KERN_INFO"Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
+	printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
 	for (i = 0; i < DPTI_MAX_HBA; i++) {
 		hbas[i] = NULL;
 	}
@@ -1153,12 +1164,22 @@
 	timeout *= HZ;
 	if((status = adpt_i2o_post_this(pHba, msg, len)) == 0){
 		set_current_state(TASK_INTERRUPTIBLE);
-		spin_unlock_irq(pHba->host->host_lock);
+		if(pHba->host)
+			spin_unlock_irq(pHba->host->host_lock);
 		if (!timeout)
 			schedule();
-		else
+		else{
+			timeout = schedule_timeout(timeout);
+			if (timeout == 0) {
+				// I/O issued, but cannot get result in
+				// specified time. Freeing resorces is
+				// dangerous.
+				status = -ETIME;
+			}
 			schedule_timeout(timeout*HZ);
-		spin_lock_irq(pHba->host->host_lock);
+		}
+		if(pHba->host)
+			spin_lock_irq(pHba->host->host_lock);
 	}
 	spin_lock_irq(&adpt_wq_i2o_post.lock);
 	__remove_wait_queue(&adpt_wq_i2o_post, &wait);
@@ -1210,6 +1231,8 @@
 			printk(KERN_WARNING"dpti%d: Timeout waiting for message frame!\n", pHba->unit);
 			return -ETIMEDOUT;
 		}
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(1);
 	} while(m == EMPTY_QUEUE);
 		
 	msg = (u32*) (pHba->msg_addr_virt + m);
@@ -1284,6 +1307,8 @@
 			printk(KERN_WARNING"Timeout waiting for message!\n");
 			return -ETIMEDOUT;
 		}
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(1);
 	} while (m == EMPTY_QUEUE);
 
 	status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32);
@@ -1315,6 +1340,8 @@
 			return -ETIMEDOUT;
 		}
 		rmb();
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(1);
 	}
 
 	if(*status == 0x01 /*I2O_EXEC_IOP_RESET_IN_PROGRESS*/) {
@@ -1331,6 +1358,8 @@
 				printk(KERN_ERR "%s:Timeout waiting for IOP Reset.\n",pHba->name);
 				return -ETIMEDOUT;
 			}
+			set_current_state(TASK_UNINTERRUPTIBLE);
+			schedule_timeout(1);
 		} while (m == EMPTY_QUEUE);
 		// Flush the offset
 		adpt_send_nop(pHba, m);
@@ -1696,15 +1725,20 @@
 	}
 
 	do {
-		spin_lock_irqsave(pHba->host->host_lock, flags);
+		if(pHba->host)
+			spin_lock_irqsave(pHba->host->host_lock, flags);
 		// This state stops any new commands from enterring the
 		// controller while processing the ioctl
 //		pHba->state |= DPTI_STATE_IOCTL;
 //		We can't set this now - The scsi subsystem sets host_blocked and
 //		the queue empties and stops.  We need a way to restart the queue
 		rcode = adpt_i2o_post_wait(pHba, msg, size, FOREVER);
+		if (rcode != 0)
+			printk("adpt_i2o_passthru: post wait failed %d %p\n",
+					rcode, reply);
 //		pHba->state &= ~DPTI_STATE_IOCTL;
-		spin_unlock_irqrestore(pHba->host->host_lock, flags);
+		if(pHba->host)
+			spin_unlock_irqrestore(pHba->host->host_lock, flags);
 	} while(rcode == -ETIMEDOUT);  
 
 	if(rcode){
@@ -1765,10 +1799,12 @@
 
 
 cleanup:
-	kfree (reply);
+	if (rcode != -ETIME && rcode != -EINTR)
+		kfree (reply);
 	while(sg_index) {
 		if(sg_list[--sg_index]) {
-			kfree((void*)(sg_list[sg_index]));
+			if (rcode != -ETIME && rcode != -EINTR)
+				kfree((void*)(sg_list[sg_index]));
 		}
 	}
 	return rcode;
@@ -1876,7 +1912,7 @@
 	int minor;
 	int error = 0;
 	adpt_hba* pHba;
-	ulong flags;
+	ulong flags = 0;
 
 	minor = iminor(inode);
 	if (minor >= DPTI_MAX_HBA){
@@ -1942,9 +1978,11 @@
 		break;
 		}
 	case I2ORESETCMD:
-		spin_lock_irqsave(pHba->host->host_lock, flags);
+		if(pHba->host)
+			spin_lock_irqsave(pHba->host->host_lock, flags);
 		adpt_hba_reset(pHba);
-		spin_unlock_irqrestore(pHba->host->host_lock, flags);
+		if(pHba->host)
+			spin_unlock_irqrestore(pHba->host->host_lock, flags);
 		break;
 	case I2ORESCANCMD:
 		adpt_rescan(pHba);
@@ -1957,7 +1995,7 @@
 }
 
 
-static void adpt_isr(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs)
 {
 	Scsi_Cmnd* cmd;
 	adpt_hba* pHba = dev_id;
@@ -1966,12 +2004,15 @@
 	u32 status=0;
 	u32 context;
 	ulong flags = 0;
+	int handled = 0;
 
-	if (pHba == NULL ){
+	if (pHba == NULL){
 		printk(KERN_WARNING"adpt_isr: NULL dev_id\n");
-		return;
+		return IRQ_NONE;
 	}
-	spin_lock_irqsave(pHba->host->host_lock, flags);
+	if(pHba->host)
+		spin_lock_irqsave(pHba->host->host_lock, flags);
+
 	while( readl(pHba->irq_mask) & I2O_INTERRUPT_PENDING_B) {
 		m = readl(pHba->reply_port);
 		if(m == EMPTY_QUEUE){
@@ -2036,7 +2077,10 @@
 		wmb();
 		rmb();
 	}
-out:	spin_unlock_irqrestore(pHba->host->host_lock, flags);
+	handled = 1;
+out:	if(pHba->host)
+		spin_unlock_irqrestore(pHba->host->host_lock, flags);
+	return IRQ_RETVAL(handled);
 }
 
 static s32 adpt_scsi_to_i2o(adpt_hba* pHba, Scsi_Cmnd* cmd, struct adpt_device* d)
@@ -2111,15 +2155,19 @@
 	/* Now fill in the SGList and command */
 	if(cmd->use_sg) {
 		struct scatterlist *sg = (struct scatterlist *)cmd->request_buffer;
+		int sg_count = pci_map_sg(pHba->pDev, sg, cmd->use_sg,
+                        scsi_to_pci_dma_dir(cmd->sc_data_direction));
+
+
 		len = 0;
-		for(i = 0 ; i < cmd->use_sg; i++) {
-			*mptr++ = direction|0x10000000|sg->length;
-			len+=sg->length;
-			*mptr++ = virt_to_bus(sg->address);
+		for(i = 0 ; i < sg_count; i++) {
+			*mptr++ = direction|0x10000000|sg_dma_len(sg);
+			len+=sg_dma_len(sg);
+			*mptr++ = sg_dma_address(sg);
 			sg++;
 		}
 		/* Make this an end of list */
-		mptr[-2] = direction|0xD0000000|(sg-1)->length;
+		mptr[-2] = direction|0xD0000000|sg_dma_len(sg-1);
 		reqlen = mptr - msg;
 		*lenptr = len;
 		
@@ -2133,7 +2181,10 @@
 			reqlen = 12;
 		} else {
 			*mptr++ = 0xD0000000|direction|cmd->request_bufflen;
-			*mptr++ = virt_to_bus(cmd->request_buffer);
+			*mptr++ = pci_map_single(pHba->pDev,
+				cmd->request_buffer,
+				cmd->request_bufflen,
+				scsi_to_pci_dma_dir(cmd->sc_data_direction));
 		}
 	}
 	
@@ -2158,7 +2209,7 @@
 		printk ("%s: scsi_register returned NULL\n",pHba->name);
 		return -1;
 	}
-	(adpt_hba*)(host->hostdata[0]) = pHba;
+	host->hostdata[0] = (unsigned long)pHba;
 	pHba->host = host;
 
 	host->irq = pHba->pDev->irq;
@@ -2306,15 +2357,17 @@
 static s32 adpt_rescan(adpt_hba* pHba)
 {
 	s32 rcode;
-	ulong flags;
+	ulong flags = 0;
 
-	spin_lock_irqsave(pHba->host->host_lock, flags);
+	if(pHba->host)
+		spin_lock_irqsave(pHba->host->host_lock, flags);
 	if ((rcode=adpt_i2o_lct_get(pHba)) < 0)
 		goto out;
 	if ((rcode=adpt_i2o_reparse_lct(pHba)) < 0)
 		goto out;
 	rcode = 0;
-out:	spin_unlock_irqrestore(pHba->host->host_lock, flags);
+out:	if(pHba->host)
+		spin_unlock_irqrestore(pHba->host->host_lock, flags);
 	return rcode;
 }
 
@@ -2596,6 +2649,8 @@
 			printk(KERN_ERR "%s: Timeout waiting for message frame!\n",pHba->name);
 			return 2;
 		}
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(1);
 	}
 	msg = (u32*)(pHba->msg_addr_virt + m);
 	writel( THREE_WORD_MSG_SIZE | SGL_OFFSET_0,&msg[0]);
@@ -2629,6 +2684,8 @@
 			printk(KERN_WARNING"%s: Timeout waiting for message frame\n",pHba->name);
 			return -ETIMEDOUT;
 		}
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(1);
 	} while(m == EMPTY_QUEUE);
 
 	msg=(u32 *)(pHba->msg_addr_virt+m);
@@ -2664,9 +2721,10 @@
 		rmb();
 		if(time_after(jiffies,timeout)){
 			printk(KERN_WARNING"%s: Timeout Initializing\n",pHba->name);
-			kfree((void*)status);
 			return -ETIMEDOUT;
 		}
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(1);
 	} while (1);
 
 	// If the command was successful, fill the fifo with our reply
@@ -2744,6 +2802,8 @@
 					pHba->name);
 			return -ETIMEDOUT;
 		}
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(1);
 	} while(m==EMPTY_QUEUE);
 
 	
@@ -2770,6 +2830,8 @@
 			return -ETIMEDOUT;
 		}
 		rmb();
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(1);
 	}
 
 	// Set up our number of outbound and inbound messages
@@ -3095,17 +3157,33 @@
 			int group, int field, void *buf, int buflen)
 {
 	u16 opblk[] = { 1, 0, I2O_PARAMS_FIELD_GET, group, 1, field };
-	u8  resblk[8+buflen]; /* 8 bytes for header */
+	u8 *resblk;
+
 	int size;
 
+	/* 8 bytes for header */
+	resblk = kmalloc(sizeof(u8) * (8+buflen), GFP_KERNEL|ADDR32);
+	if (resblk == NULL) {
+		printk(KERN_CRIT "%s: query scalar failed; Out of memory.\n", pHba->name);
+		return -ENOMEM;
+	}
+
 	if (field == -1)  		/* whole group */
 			opblk[4] = -1;
 
 	size = adpt_i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET, pHba, tid, 
-		opblk, sizeof(opblk), resblk, sizeof(resblk));
+		opblk, sizeof(opblk), resblk, sizeof(u8)*(8+buflen));
+	if (size == -ETIME) {
+		printk(KERN_WARNING "%s: issue params failed; Timed out.\n", pHba->name);
+		return -ETIME;
+	} else if (size == -EINTR) {
+		printk(KERN_WARNING "%s: issue params failed; Interrupted.\n", pHba->name);
+		return -EINTR;
+	}
 			
 	memcpy(buf, resblk+8, buflen);  /* cut off header */
 
+	kfree(resblk);
 	if (size < 0)
 		return size;	
 
@@ -3139,6 +3217,7 @@
 	msg[8] = virt_to_bus(resblk);
 
 	if ((wait_status = adpt_i2o_post_wait(pHba, msg, sizeof(msg), 20))) {
+		printk("adpt_i2o_issue_params: post_wait failed (%p)\n", resblk);
    		return wait_status; 	/* -DetailedStatus */
 	}
 
diff -Nru a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
--- a/drivers/scsi/dpti.h	Tue Jun 15 22:20:35 2004
+++ b/drivers/scsi/dpti.h	Tue Jun 15 22:20:35 2004
@@ -65,7 +65,7 @@
 #include "dpt/dpti_i2o.h"
 #include "dpt/dpti_ioctl.h"
 
-#define DPT_I2O_VERSION "2.4 Build 5"
+#define DPT_I2O_VERSION "2.4 Build 5go"
 #define DPT_VERSION     2
 #define DPT_REVISION    '4'
 #define DPT_SUBREVISION '5'
@@ -272,7 +272,7 @@
 static void adpt_i2o_sys_shutdown(void);
 static int adpt_init(void);
 static int adpt_i2o_build_sys_table(void);
-static void adpt_isr(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t adpt_isr(int irq, void *dev_id, struct pt_regs *regs);
 #ifdef REBOOT_NOTIFIER
 static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p);
 #endif
diff -Nru a/drivers/scsi/esp.c b/drivers/scsi/esp.c
--- a/drivers/scsi/esp.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/scsi/esp.c	Tue Jun 15 22:21:04 2004
@@ -25,9 +25,8 @@
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
+#include <linux/module.h>
 
-#include "scsi.h"
-#include "hosts.h"
 #include "esp.h"
 
 #include <asm/sbus.h>
@@ -38,13 +37,17 @@
 #include <asm/oplib.h>
 #include <asm/io.h>
 #include <asm/irq.h>
-
 #ifndef __sparc_v9__
 #include <asm/machines.h>
 #include <asm/idprom.h>
 #endif
 
-#include <linux/module.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_eh.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_tcq.h>
 
 #define DEBUG_ESP
 /* #define DEBUG_ESP_HME */
@@ -366,7 +369,7 @@
 }
 
 #ifdef DEBUG_STATE_MACHINE
-static inline void esp_advance_phase(Scsi_Cmnd *s, int newphase)
+static inline void esp_advance_phase(struct scsi_cmnd *s, int newphase)
 {
 	ESPLOG(("<%s>", phase_string(newphase)));
 	s->SCp.sent_command = s->SCp.phase;
@@ -419,48 +422,48 @@
  * Note that these are per-ESP queues, not global queues like
  * the aha152x driver uses.
  */
-static inline void append_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC)
+static inline void append_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC)
 {
-	Scsi_Cmnd *end;
+	struct scsi_cmnd *end;
 
 	new_SC->host_scribble = (unsigned char *) NULL;
 	if (!*SC)
 		*SC = new_SC;
 	else {
-		for (end=*SC;end->host_scribble;end=(Scsi_Cmnd *)end->host_scribble)
+		for (end=*SC;end->host_scribble;end=(struct scsi_cmnd *)end->host_scribble)
 			;
 		end->host_scribble = (unsigned char *) new_SC;
 	}
 }
 
-static inline void prepend_SC(Scsi_Cmnd **SC, Scsi_Cmnd *new_SC)
+static inline void prepend_SC(struct scsi_cmnd **SC, struct scsi_cmnd *new_SC)
 {
 	new_SC->host_scribble = (unsigned char *) *SC;
 	*SC = new_SC;
 }
 
-static inline Scsi_Cmnd *remove_first_SC(Scsi_Cmnd **SC)
+static inline struct scsi_cmnd *remove_first_SC(struct scsi_cmnd **SC)
 {
-	Scsi_Cmnd *ptr;
+	struct scsi_cmnd *ptr;
 	ptr = *SC;
 	if (ptr)
-		*SC = (Scsi_Cmnd *) (*SC)->host_scribble;
+		*SC = (struct scsi_cmnd *) (*SC)->host_scribble;
 	return ptr;
 }
 
-static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, int target, int lun)
+static inline struct scsi_cmnd *remove_SC(struct scsi_cmnd **SC, int target, int lun)
 {
-	Scsi_Cmnd *ptr, *prev;
+	struct scsi_cmnd *ptr, *prev;
 
 	for (ptr = *SC, prev = NULL;
 	     ptr && ((ptr->device->id != target) || (ptr->device->lun != lun));
-	     prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble)
+	     prev = ptr, ptr = (struct scsi_cmnd *) ptr->host_scribble)
 		;
 	if (ptr) {
 		if (prev)
 			prev->host_scribble=ptr->host_scribble;
 		else
-			*SC=(Scsi_Cmnd *)ptr->host_scribble;
+			*SC=(struct scsi_cmnd *)ptr->host_scribble;
 	}
 	return ptr;
 }
@@ -1062,7 +1065,7 @@
 	esp->prev_hme_dmacsr = 0xffffffff;
 }
 
-static int __init detect_one_esp(Scsi_Host_Template *tpnt, struct sbus_dev *esp_dev,
+static int __init detect_one_esp(struct scsi_host_template *tpnt, struct sbus_dev *esp_dev,
 				 struct sbus_dev *espdma, struct sbus_bus *sbus,
 				 int id, int hme)
 {
@@ -1137,7 +1140,7 @@
 
 #include <asm/sun4paddr.h>
 
-static int __init esp_detect(Scsi_Host_Template *tpnt)
+static int __init esp_detect(struct scsi_host_template *tpnt)
 {
 	static struct sbus_dev esp_dev;
 	int esps_in_use = 0;
@@ -1162,7 +1165,7 @@
 
 #else /* !CONFIG_SUN4 */
 
-static int __init esp_detect(Scsi_Host_Template *tpnt)
+static int __init esp_detect(struct scsi_host_template *tpnt)
 {
 	struct sbus_bus *sbus;
 	struct sbus_dev *esp_dev, *sbdev_iter;
@@ -1428,7 +1431,7 @@
 	return esp_host_info(esp, buffer, offset, length);
 }
 
-static void esp_get_dmabufs(struct esp *esp, Scsi_Cmnd *sp)
+static void esp_get_dmabufs(struct esp *esp, struct scsi_cmnd *sp)
 {
 	if (sp->use_sg == 0) {
 		sp->SCp.this_residual = sp->request_bufflen;
@@ -1437,7 +1440,7 @@
 		if (sp->request_bufflen) {
 			sp->SCp.have_data_in = sbus_map_single(esp->sdev, sp->SCp.buffer,
 							       sp->SCp.this_residual,
-							       scsi_to_sbus_dma_dir(sp->sc_data_direction));
+							       sp->sc_data_direction);
 			sp->SCp.ptr = (char *) ((unsigned long)sp->SCp.have_data_in);
 		} else {
 			sp->SCp.ptr = NULL;
@@ -1447,26 +1450,26 @@
 		sp->SCp.buffers_residual = sbus_map_sg(esp->sdev,
 						       sp->SCp.buffer,
 						       sp->use_sg,
-						       scsi_to_sbus_dma_dir(sp->sc_data_direction));
+						       sp->sc_data_direction);
 		sp->SCp.this_residual = sg_dma_len(sp->SCp.buffer);
 		sp->SCp.ptr = (char *) ((unsigned long)sg_dma_address(sp->SCp.buffer));
 	}
 }
 
-static void esp_release_dmabufs(struct esp *esp, Scsi_Cmnd *sp)
+static void esp_release_dmabufs(struct esp *esp, struct scsi_cmnd *sp)
 {
 	if (sp->use_sg) {
 		sbus_unmap_sg(esp->sdev, sp->buffer, sp->use_sg,
-			      scsi_to_sbus_dma_dir(sp->sc_data_direction));
+			      sp->sc_data_direction);
 	} else if (sp->request_bufflen) {
 		sbus_unmap_single(esp->sdev,
 				  sp->SCp.have_data_in,
 				  sp->request_bufflen,
-				  scsi_to_sbus_dma_dir(sp->sc_data_direction));
+				  sp->sc_data_direction);
 	}
 }
 
-static void esp_restore_pointers(struct esp *esp, Scsi_Cmnd *sp)
+static void esp_restore_pointers(struct esp *esp, struct scsi_cmnd *sp)
 {
 	struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
 
@@ -1476,7 +1479,7 @@
 	sp->SCp.buffers_residual = ep->saved_buffers_residual;
 }
 
-static void esp_save_pointers(struct esp *esp, Scsi_Cmnd *sp)
+static void esp_save_pointers(struct esp *esp, struct scsi_cmnd *sp)
 {
 	struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
 
@@ -1506,7 +1509,7 @@
  * case where we could see an interrupt is where we have disconnected
  * commands active and they are trying to reselect us.
  */
-static inline void esp_check_cmd(struct esp *esp, Scsi_Cmnd *sp)
+static inline void esp_check_cmd(struct esp *esp, struct scsi_cmnd *sp)
 {
 	switch (sp->cmd_len) {
 	case 6:
@@ -1557,8 +1560,8 @@
 
 static void esp_exec_cmd(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr;
-	Scsi_Device *SDptr;
+	struct scsi_cmnd *SCptr;
+	struct scsi_device *SDptr;
 	struct esp_device *esp_dev;
 	volatile u8 *cmdp = esp->esp_command;
 	u8 the_esp_command;
@@ -1834,7 +1837,7 @@
 }
 
 /* Queue a SCSI command delivered from the mid-level Linux SCSI code. */
-static int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
+static int esp_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
 {
 	struct esp *esp;
 
@@ -1871,7 +1874,7 @@
 }
 
 /* Dump driver state. */
-static void esp_dump_cmd(Scsi_Cmnd *SCptr)
+static void esp_dump_cmd(struct scsi_cmnd *SCptr)
 {
 	ESPLOG(("[tgt<%02x> lun<%02x> "
 		"pphase<%s> cphase<%s>]",
@@ -1882,7 +1885,7 @@
 
 static void esp_dump_state(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 #ifdef DEBUG_ESP_CMDS
 	int i;
 #endif
@@ -1921,13 +1924,13 @@
 	ESPLOG(("esp%d: disconnected ", esp->esp_id));
 	while (SCptr) {
 		esp_dump_cmd(SCptr);
-		SCptr = (Scsi_Cmnd *) SCptr->host_scribble;
+		SCptr = (struct scsi_cmnd *) SCptr->host_scribble;
 	}
 	ESPLOG(("\n"));
 }
 
 /* Abort a command.  The host_lock is acquired by caller. */
-static int esp_abort(Scsi_Cmnd *SCptr)
+static int esp_abort(struct scsi_cmnd *SCptr)
 {
 	struct esp *esp = (struct esp *) SCptr->device->host->hostdata;
 	int don;
@@ -1957,14 +1960,14 @@
 		ESP_INTSOFF(esp->dregs);
 	}
 	if (esp->issue_SC) {
-		Scsi_Cmnd **prev, *this;
+		struct scsi_cmnd **prev, *this;
 		for (prev = (&esp->issue_SC), this = esp->issue_SC;
 		     this != NULL;
-		     prev = (Scsi_Cmnd **) &(this->host_scribble),
-			     this = (Scsi_Cmnd *) this->host_scribble) {
+		     prev = (struct scsi_cmnd **) &(this->host_scribble),
+			     this = (struct scsi_cmnd *) this->host_scribble) {
 
 			if (this == SCptr) {
-				*prev = (Scsi_Cmnd *) this->host_scribble;
+				*prev = (struct scsi_cmnd *) this->host_scribble;
 				this->host_scribble = NULL;
 
 				esp_release_dmabufs(esp, this);
@@ -2010,7 +2013,7 @@
  */
 static int esp_finish_reset(struct esp *esp)
 {
-	Scsi_Cmnd *sp = esp->current_SC;
+	struct scsi_cmnd *sp = esp->current_SC;
 
 	/* Clean up currently executing command, if any. */
 	if (sp != NULL) {
@@ -2059,7 +2062,7 @@
  *
  * The host_lock is acquired by caller.
  */
-static int esp_reset(Scsi_Cmnd *SCptr)
+static int esp_reset(struct scsi_cmnd *SCptr)
 {
 	struct esp *esp = (struct esp *) SCptr->device->host->hostdata;
 
@@ -2077,7 +2080,7 @@
 /* Internal ESP done function. */
 static void esp_done(struct esp *esp, int error)
 {
-	Scsi_Cmnd *done_SC = esp->current_SC;
+	struct scsi_cmnd *done_SC = esp->current_SC;
 
 	esp->current_SC = NULL;
 
@@ -2168,7 +2171,7 @@
 /* We try to avoid some interrupts by jumping ahead and see if the ESP
  * has gotten far enough yet.  Hence the following.
  */
-static inline int skipahead1(struct esp *esp, Scsi_Cmnd *scp,
+static inline int skipahead1(struct esp *esp, struct scsi_cmnd *scp,
 			     int prev_phase, int new_phase)
 {
 	if (scp->SCp.sent_command != prev_phase)
@@ -2202,7 +2205,7 @@
 	return do_intr_end;
 }
 
-static inline int skipahead2(struct esp *esp, Scsi_Cmnd *scp,
+static inline int skipahead2(struct esp *esp, struct scsi_cmnd *scp,
 			     int prev_phase1, int prev_phase2, int new_phase)
 {
 	if (scp->SCp.sent_command != prev_phase1 &&
@@ -2318,7 +2321,7 @@
 	dma_invalidate(esp);
 }
 
-static int dma_can_transfer(struct esp *esp, Scsi_Cmnd *sp)
+static int dma_can_transfer(struct esp *esp, struct scsi_cmnd *sp)
 {
 	__u32 base, end, sz;
 
@@ -2379,7 +2382,7 @@
  * tell the ESP to eat the extraneous byte so that we can proceed
  * to the next phase.
  */
-static int esp100_sync_hwbug(struct esp *esp, Scsi_Cmnd *sp, int fifocnt)
+static int esp100_sync_hwbug(struct esp *esp, struct scsi_cmnd *sp, int fifocnt)
 {
 	/* Do not touch this piece of code. */
 	if ((!(esp->erev == esp100)) ||
@@ -2479,7 +2482,7 @@
 /* This puts the driver in a state where it can revitalize a command that
  * is being continued due to reselection.
  */
-static inline void esp_connect(struct esp *esp, Scsi_Cmnd *sp)
+static inline void esp_connect(struct esp *esp, struct scsi_cmnd *sp)
 {
 	struct esp_device *esp_dev = sp->device->hostdata;
 
@@ -2502,7 +2505,7 @@
 /* This will place the current working command back into the issue queue
  * if we are to receive a reselection amidst a selection attempt.
  */
-static inline void esp_reconnect(struct esp *esp, Scsi_Cmnd *sp)
+static inline void esp_reconnect(struct esp *esp, struct scsi_cmnd *sp)
 {
 	if (!esp->disconnected_SC)
 		ESPLOG(("esp%d: Weird, being reselected but disconnected "
@@ -2540,7 +2543,7 @@
 	return rval - fifo_count;
 }
 
-static inline void advance_sg(Scsi_Cmnd *sp)
+static inline void advance_sg(struct scsi_cmnd *sp)
 {
 	++sp->SCp.buffer;
 	--sp->SCp.buffers_residual;
@@ -2568,7 +2571,7 @@
  */
 static int esp_do_data(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 	int thisphase, hmuch;
 
 	ESPDATA(("esp_do_data: "));
@@ -2619,7 +2622,7 @@
 /* See how successful the data transfer was. */
 static int esp_do_data_finale(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 	struct esp_device *esp_dev = SCptr->device->hostdata;
 	int bogus_data = 0, bytes_sent = 0, fifocnt, ecount = 0;
 
@@ -2800,7 +2803,7 @@
  * a tape, we don't want to go into a loop re-negotiating
  * synchronous capabilities over and over.
  */
-static int esp_should_clear_sync(Scsi_Cmnd *sp)
+static int esp_should_clear_sync(struct scsi_cmnd *sp)
 {
 	u8 cmd1 = sp->cmnd[0];
 	u8 cmd2 = sp->data_cmnd[0];
@@ -2834,7 +2837,7 @@
  */
 static int esp_do_freebus(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 	struct esp_device *esp_dev = SCptr->device->hostdata;
 	int rval;
 
@@ -2905,7 +2908,7 @@
  */
 static int esp_bad_reconnect(struct esp *esp)
 {
-	Scsi_Cmnd *sp;
+	struct scsi_cmnd *sp;
 
 	ESPLOG(("esp%d: Eieeee, reconnecting unknown command!\n",
 		esp->esp_id));
@@ -2914,7 +2917,7 @@
 	ESPLOG(("esp%d: issue_SC[", esp->esp_id));
 	while (sp) {
 		ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun));
-		sp = (Scsi_Cmnd *) sp->host_scribble;
+		sp = (struct scsi_cmnd *) sp->host_scribble;
 	}
 	ESPLOG(("]\n"));
 	sp = esp->current_SC;
@@ -2928,7 +2931,7 @@
 	ESPLOG(("esp%d: disconnected_SC[", esp->esp_id));
 	while (sp) {
 		ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun));
-		sp = (Scsi_Cmnd *) sp->host_scribble;
+		sp = (struct scsi_cmnd *) sp->host_scribble;
 	}
 	ESPLOG(("]\n"));
 	return do_reset_bus;
@@ -2938,7 +2941,7 @@
 static int esp_do_reconnect(struct esp *esp)
 {
 	int lun, target;
-	Scsi_Cmnd *SCptr;
+	struct scsi_cmnd *SCptr;
 
 	/* Check for all bogus conditions first. */
 	target = reconnect_target(esp);
@@ -2988,7 +2991,7 @@
  */
 static int esp_do_status(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 	int intr, rval;
 
 	rval = skipahead1(esp, SCptr, in_the_dark, in_status);
@@ -3133,7 +3136,7 @@
 
 static int esp_disconnect_amidst_phases(struct esp *esp)
 {
-	Scsi_Cmnd *sp = esp->current_SC;
+	struct scsi_cmnd *sp = esp->current_SC;
 	struct esp_device *esp_dev = sp->device->hostdata;
 
 	/* This means real problems if we see this
@@ -3226,7 +3229,7 @@
 /* First interrupt after exec'ing a cmd comes here. */
 static int esp_select_complete(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 	struct esp_device *esp_dev = SCptr->device->hostdata;
 	int cmd_bytes_sent, fcnt;
 
@@ -3582,7 +3585,7 @@
  * this because so many initiators cannot cope with this occurring.
  */
 static int target_with_ants_in_pants(struct esp *esp,
-				     Scsi_Cmnd *SCptr,
+				     struct scsi_cmnd *SCptr,
 				     struct esp_device *esp_dev)
 {
 	if (esp_dev->sync || SCptr->device->borken) {
@@ -3641,7 +3644,7 @@
 
 static int check_multibyte_msg(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 	struct esp_device *esp_dev = SCptr->device->hostdata;
 	u8 regval = 0;
 	int message_out = 0;
@@ -3822,7 +3825,7 @@
 
 static int esp_do_msgindone(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 	int message_out = 0, it = 0, rval;
 
 	rval = skipahead1(esp, SCptr, in_msgin, in_msgindone);
@@ -3904,7 +3907,7 @@
 
 static int esp_do_cmdbegin(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 
 	esp_advance_phase(SCptr, in_cmdend);
 	if (esp->erev == fashme) {
@@ -4125,7 +4128,7 @@
 /* This is the second tier in our dual-level SCSI state machine. */
 static int esp_work_bus(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr = esp->current_SC;
+	struct scsi_cmnd *SCptr = esp->current_SC;
 	unsigned int phase;
 
 	ESPBUS(("esp_work_bus: "));
@@ -4153,7 +4156,7 @@
 /* Main interrupt handler for an esp adapter. */
 static void esp_handle(struct esp *esp)
 {
-	Scsi_Cmnd *SCptr;
+	struct scsi_cmnd *SCptr;
 	int what_next = do_intr_end;
 
 	SCptr = esp->current_SC;
@@ -4353,7 +4356,7 @@
 	return IRQ_HANDLED;
 }
 
-static int esp_slave_alloc(Scsi_Device *SDptr)
+static int esp_slave_alloc(struct scsi_device *SDptr)
 {
 	struct esp_device *esp_dev =
 		kmalloc(sizeof(struct esp_device), GFP_ATOMIC);
@@ -4365,7 +4368,7 @@
 	return 0;
 }
 
-static void esp_slave_destroy(Scsi_Device *SDptr)
+static void esp_slave_destroy(struct scsi_device *SDptr)
 {
 	struct esp *esp = (struct esp *) SDptr->host->hostdata;
 
@@ -4374,7 +4377,7 @@
 	SDptr->hostdata = NULL;
 }
 
-static Scsi_Host_Template driver_template = {
+static struct scsi_host_template driver_template = {
 	.proc_name		= "esp",
 	.proc_info		= esp_proc_info,
 	.name			= "Sun ESP 100/100a/200",
diff -Nru a/drivers/scsi/esp.h b/drivers/scsi/esp.h
--- a/drivers/scsi/esp.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/esp.h	Tue Jun 15 22:20:36 2004
@@ -8,8 +8,6 @@
 #ifndef _SPARC_ESP_H
 #define _SPARC_ESP_H
 
-#include <linux/config.h>
-
 /* For dvma controller register definitions. */
 #include <asm/dma.h>
 
@@ -75,6 +73,8 @@
   unsigned disconnect:1;
 };
 
+struct scsi_cmnd;
+
 /* We get one of these for each ESP probed. */
 struct esp {
 	unsigned long		eregs;		/* ESP controller registers */
@@ -181,9 +181,9 @@
 	int			bursts;		/* Burst sizes our DVMA supports */
 
 	/* Our command queues, only one cmd lives in the current_SC queue. */
-	Scsi_Cmnd		*issue_SC;	/* Commands to be issued */
-	Scsi_Cmnd		*current_SC;	/* Who is currently working the bus */
-	Scsi_Cmnd		*disconnected_SC;/* Commands disconnected from the bus */
+	struct scsi_cmnd	*issue_SC;	/* Commands to be issued */
+	struct scsi_cmnd	*current_SC;	/* Who is currently working the bus */
+	struct scsi_cmnd	*disconnected_SC;/* Commands disconnected from the bus */
 
 	/* Message goo */
 	u8			cur_msgout[16];
diff -Nru a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/gdth.c	Tue Jun 15 22:20:42 2004
@@ -4,9 +4,9 @@
  * Intel Corporation:  Storage RAID Controllers                         *
  *                                                                      *
  * gdth.c                                                               *
- * Copyright (C) 1995-03 ICP vortex GmbH, Achim Leubner                 *
- * Copyright (C) 2002-03 Intel Corporation                              *
- * Copyright (C) 2003    Adaptec Inc.                                   *
+ * Copyright (C) 1995-04 ICP vortex GmbH, Achim Leubner                 *
+ * Copyright (C) 2002-04 Intel Corporation                              *
+ * Copyright (C) 2003-04 Adaptec Inc.                                   *
  * <achim_leubner@adaptec.com>                                          *
  *                                                                      *
  * Additions/Fixes:                                                     *
@@ -27,9 +27,42 @@
  * along with this kernel; if not, write to the Free Software           *
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            *
  *                                                                      *
- * Tested with Linux 1.2.13, ..., 2.2.20, ..., 2.4.22                   *
+ * Linux kernel 2.2.x, 2.4.x, 2.6.x supported                           *
  *                                                                      *
  * $Log: gdth.c,v $
+ * Revision 1.73  2004/03/31 13:33:03  achim
+ * Special command 0xfd implemented to detect 64-bit DMA support
+ *
+ * Revision 1.72  2004/03/17 08:56:04  achim
+ * 64-bit DMA only enabled if FW >= x.43
+ *
+ * Revision 1.71  2004/03/05 15:51:29  achim
+ * Screen service: separate message buffer, bugfixes
+ *
+ * Revision 1.70  2004/02/27 12:19:07  achim
+ * Bugfix: Reset bit in config (0xfe) call removed
+ *
+ * Revision 1.69  2004/02/20 09:50:24  achim
+ * Compatibility changes for kernels < 2.4.20
+ * Bugfix screen service command size
+ * pci_set_dma_mask() error handling added
+ *
+ * Revision 1.68  2004/02/19 15:46:54  achim
+ * 64-bit DMA bugfixes
+ * Drive size bugfix for drives > 1TB
+ *
+ * Revision 1.67  2004/01/14 13:11:57  achim
+ * Tool access over /proc no longer supported
+ * Bugfixes IOCTLs
+ *
+ * Revision 1.66  2003/12/19 15:04:06  achim
+ * Bugfixes support for drives > 2TB
+ *
+ * Revision 1.65  2003/12/15 11:21:56  achim
+ * 64-bit DMA support added
+ * Support for drives > 2 TB implemented
+ * Kernels 2.2.x, 2.4.x, 2.6.x supported
+ *
  * Revision 1.64  2003/09/17 08:30:26  achim
  * EISA/ISA controller scan disabled
  * Command line switch probe_eisa_isa added
@@ -299,10 +332,12 @@
  * shared_access:N              enable driver reserve/release protocol
  * probe_eisa_isa:Y             scan for EISA/ISA controllers
  * probe_eisa_isa:N             do not scan for EISA/ISA controllers
+ * force_dma32:Y                use only 32 bit DMA mode
+ * force_dma32:N                use 64 bit DMA mode, if supported
  *
  * The default values are: "gdth=disable:N,reserve_mode:1,reverse_scan:N,
  *                          max_ids:127,rescan:N,virt_ctr:N,hdr_channel:0,
- *                          shared_access:Y,probe_eisa_isa:N".
+ *                          shared_access:Y,probe_eisa_isa:N,force_dma32:N".
  * Here is another example: "gdth=reserve_list:0,1,2,0,0,1,3,0,rescan:Y".
  * 
  * When loading the gdth driver as a module, the same options are available. 
@@ -313,7 +348,7 @@
  * 
  * Default: "modprobe gdth disable=0 reserve_mode=1 reverse_scan=0
  *           max_ids=127 rescan=0 virt_ctr=0 hdr_channel=0 shared_access=0 
- *           probe_eisa_isa=0"
+ *           probe_eisa_isa=0 force_dma32=0"
  * The other example: "modprobe gdth reserve_list=0,1,2,0,0,1,3,0 rescan=1".
  */
 
@@ -330,9 +365,12 @@
  * phase:                   Service/parameter/return code special command
  */
 
-/* default: activate /proc and character device IOCTL interface */
-#define GDTH_IOCTL_PROC
-#define GDTH_IOCTL_CHRDEV
+
+/* interrupt coalescing */
+/* #define INT_COAL */
+
+/* statistics */
+#define GDTH_STATISTICS
 
 #include <linux/module.h>
 
@@ -353,35 +391,35 @@
 #ifdef GDTH_RTC
 #include <linux/mc146818rtc.h>
 #endif
-#if LINUX_VERSION_CODE >= 0x020100
 #include <linux/reboot.h>
-#else
-#include <linux/bios32.h>
-#endif
 
 #include <asm/dma.h>
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
-#if LINUX_VERSION_CODE >= 0x020322
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 #include <linux/spinlock.h>
-#elif LINUX_VERSION_CODE >= 0x02015F
+#else
 #include <asm/spinlock.h>
 #endif
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #include <linux/blkdev.h>
-
-#include "scsi.h"
-#include "hosts.h"
-#if LINUX_VERSION_CODE < 0x020503
+#else
+#include <linux/blk.h>
 #include "sd.h"
 #endif
 
+#include "scsi.h"
+#include "hosts.h"
 #include "gdth.h"
 
 static void gdth_delay(int milliseconds);
-static void gdth_eval_mapping(ulong32 size, int *cyls, int *heads, int *secs);
+static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static irqreturn_t gdth_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+#else
+static void gdth_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+#endif
 static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp);
 static int gdth_async_event(int hanum);
 static void gdth_log_event(gdth_evt_data *dvr, char *buffer);
@@ -419,31 +457,19 @@
 static void gdth_release_event(int hanum);
 static int gdth_wait(int hanum,int index,ulong32 time);
 static int gdth_internal_cmd(int hanum,unchar service,ushort opcode,ulong32 p1,
-                             ulong32 p2,ulong32 p3);
+                             ulong64 p2,ulong64 p3);
 static int gdth_search_drives(int hanum);
 static int gdth_analyse_hdrive(int hanum, ushort hdrive);
 
-static void *gdth_mmap(ulong paddr, ulong size);
-static void gdth_munmap(void *addr);
-
 static const char *gdth_ctr_name(int hanum);
 
-#ifdef GDTH_IOCTL_CHRDEV
 static int gdth_open(struct inode *inode, struct file *filep);
 static int gdth_close(struct inode *inode, struct file *filep);
 static int gdth_ioctl(struct inode *inode, struct file *filep,
                       unsigned int cmd, unsigned long arg);
-#endif
 
-#if LINUX_VERSION_CODE >= 0x010300
 static void gdth_flush(int hanum);
-#if LINUX_VERSION_CODE >= 0x020100
 static int gdth_halt(struct notifier_block *nb, ulong event, void *buf);
-#else
-static int halt_called = FALSE;
-void gdth_halt(void);
-#endif
-#endif
 
 #ifdef DEBUG_GDTH
 static unchar   DebugState = DEBUG_GDTH;
@@ -528,6 +554,9 @@
 
 #ifdef GDTH_STATISTICS
 static ulong32 max_rq=0, max_index=0, max_sg=0;
+#ifdef INT_COAL
+static ulong32 max_int_coal=0;
+#endif
 static ulong32 act_ints=0, act_ios=0, act_stats=0, act_rq=0;
 static struct timer_list gdth_timer;
 #endif
@@ -542,56 +571,6 @@
 
 #define BUS_L2P(a,b)    ((b)>(a)->virt_bus ? (b-1):(b))
 
-#if LINUX_VERSION_CODE < 0x010300
-static void *gdth_mmap(ulong paddr, ulong size) 
-{
-    if (paddr >= high_memory)
-        return NULL; 
-    else
-        return (void *)paddr;
-}
-static void gdth_munmap(void *addr) 
-{
-}
-inline ulong32 virt_to_phys(volatile void *addr)
-{
-    return (ulong32)addr;
-}
-inline void *phys_to_virt(ulong32 addr)
-{
-    return (void *)addr;
-}
-#define virt_to_bus             virt_to_phys
-#define bus_to_virt             phys_to_virt
-#define gdth_readb(addr)        (*(volatile unchar *)(addr))
-#define gdth_readw(addr)        (*(volatile ushort *)(addr))
-#define gdth_readl(addr)        (*(volatile ulong32 *)(addr))
-#define gdth_writeb(b,addr)     (*(volatile unchar *)(addr) = (b))
-#define gdth_writew(b,addr)     (*(volatile ushort *)(addr) = (b))
-#define gdth_writel(b,addr)     (*(volatile ulong32 *)(addr) = (b))
-#define memset_io(a,b,c)        memset((void *)(a),(b),(c))
-#define memcpy_fromio(a,b,c)    memcpy((a),(void *)(b),(c))
-#define memcpy_toio(a,b,c)      memcpy((void *)(a),(b),(c))
-
-#define PCI_SLOT(devfn)         ((devfn >> 3) & 0x1f)
-
-#elif LINUX_VERSION_CODE < 0x020100
-static int remapped = FALSE;
-static void *gdth_mmap(ulong paddr, ulong size) 
-{
-    if ( paddr >= high_memory) {
-        remapped = TRUE;
-        return vremap(paddr, size);
-    } else {
-        return (void *)paddr; 
-    }
-}
-static void gdth_munmap(void *addr) 
-{
-    if (remapped)
-        vfree(addr);
-    remapped = FALSE;
-}
 #define gdth_readb(addr)        readb((ulong)(addr))
 #define gdth_readw(addr)        readw((ulong)(addr))
 #define gdth_readl(addr)        (ulong32)readl((ulong)(addr))
@@ -599,24 +578,6 @@
 #define gdth_writew(b,addr)     writew((b),(ulong)(addr))
 #define gdth_writel(b,addr)     writel((ulong32)(b),(ulong)(addr))
 
-#else
-static void *gdth_mmap(ulong paddr, ulong size) 
-{ 
-    return ioremap(paddr, size); 
-}
-static void gdth_munmap(void *addr) 
-{
-    return iounmap(addr);
-}
-#define gdth_readb(addr)        readb((ulong)(addr))
-#define gdth_readw(addr)        readw((ulong)(addr))
-#define gdth_readl(addr)        (ulong32)readl((ulong)(addr))
-#define gdth_writeb(b,addr)     writeb((b),(ulong)(addr))
-#define gdth_writew(b,addr)     writew((b),(ulong)(addr))
-#define gdth_writel(b,addr)     writel((ulong32)(b),(ulong)(addr))
-#endif
-
-
 static unchar   gdth_drq_tab[4] = {5,6,7,7};            /* DRQ table */
 static unchar   gdth_irq_tab[6] = {0,10,11,12,14,0};    /* IRQ table */
 static unchar   gdth_polling;                           /* polling if TRUE */
@@ -631,9 +592,7 @@
 static gdth_evt_str ebuffer[MAX_EVENTS];                /* event buffer */
 static int elastidx;
 static int eoldidx;
-#ifdef GDTH_IOCTL_CHRDEV
 static int major;
-#endif
 
 #define DIN     1                               /* IN data direction */
 #define DOU     2                               /* OUT data direction */
@@ -648,8 +607,8 @@
     DUN,DUN,DUN,DUN,DUN,DOU,DUN,DUN,DUN,DUN,DIN,DUN,DUN,DUN,DUN,DUN,
     DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,
     DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,
-    DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,
-    DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,
+    DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DIN,DUN,DOU,DUN,DUN,DUN,DUN,DUN,
+    DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DIN,DUN,
     DUN,DUN,DUN,DUN,DUN,DNO,DNO,DUN,DIN,DNO,DOU,DUN,DNO,DUN,DOU,DOU,
     DOU,DOU,DOU,DNO,DUN,DIN,DOU,DIN,DIN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,
     DUN,DUN,DOU,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,
@@ -659,47 +618,32 @@
 };
 
 /* __initfunc, __initdata macros */
-#if LINUX_VERSION_CODE >= 0x020322
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#define __devinitdata
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 #define GDTH_INITFUNC(type, func)       type __init func 
 #include <linux/init.h>
-#elif LINUX_VERSION_CODE >= 0x020126
+#else
 #define GDTH_INITFUNC(type, func)       __initfunc(type func)
 #include <linux/init.h>
-#else
-#define GDTH_INITFUNC(type, func)       type func
-#define __initdata
-#define __init
 #endif
 
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #define GDTH_INIT_LOCK_HA(ha)           spin_lock_init(&(ha)->smp_lock)
 #define GDTH_LOCK_HA(ha,flags)          spin_lock_irqsave(&(ha)->smp_lock,flags)
 #define GDTH_UNLOCK_HA(ha,flags)        spin_unlock_irqrestore(&(ha)->smp_lock,flags)
 
 #define GDTH_LOCK_SCSI_DONE(dev, flags) spin_lock_irqsave(dev->host_lock,flags)
 #define GDTH_UNLOCK_SCSI_DONE(dev, flags) spin_unlock_irqrestore(dev->host_lock,flags)
-#define GDTH_LOCK_SCSI_DOCMD(dev)       spin_lock_irq(dev->host_lock)
-#define GDTH_UNLOCK_SCSI_DOCMD(dev)     spin_unlock_irq(dev->host_lock)
 
-#elif LINUX_VERSION_CODE >= 0x02015F
+#else
 #define GDTH_INIT_LOCK_HA(ha)           spin_lock_init(&(ha)->smp_lock)
 #define GDTH_LOCK_HA(ha,flags)          spin_lock_irqsave(&(ha)->smp_lock,flags)
 #define GDTH_UNLOCK_HA(ha,flags)        spin_unlock_irqrestore(&(ha)->smp_lock,flags)
 
 #define GDTH_LOCK_SCSI_DONE(flags)      spin_lock_irqsave(&io_request_lock,flags)
 #define GDTH_UNLOCK_SCSI_DONE(flags)    spin_unlock_irqrestore(&io_request_lock,flags)
-#define GDTH_LOCK_SCSI_DOCMD()          spin_lock_irq(&io_request_lock)
-#define GDTH_UNLOCK_SCSI_DOCMD()        spin_unlock_irq(&io_request_lock)
-
-#else
-#define GDTH_INIT_LOCK_HA(ha)           do {} while (0)
-#define GDTH_LOCK_HA(ha,flags)          do {save_flags(flags); cli();} while (0)
-#define GDTH_UNLOCK_HA(ha,flags)        do {restore_flags(flags);} while (0)
-
-#define GDTH_LOCK_SCSI_DONE(flags)      do {} while (0)
-#define GDTH_UNLOCK_SCSI_DONE(flags)    do {} while (0)
-#define GDTH_LOCK_SCSI_DOCMD()          do {} while (0)
-#define GDTH_UNLOCK_SCSI_DOCMD()        do {} while (0)
 #endif
 
 /* LILO and modprobe/insmod parameters */
@@ -730,9 +674,10 @@
 static int shared_access = 1;
 /* enable support for EISA and ISA controllers */
 static int probe_eisa_isa = 0;
+/* 64 bit DMA mode, support for drives > 2 TB, if force_dma32 = 0 */
+static int force_dma32 = 0;
 
 #ifdef MODULE
-#if LINUX_VERSION_CODE >= 0x02011A
 /* parameters for modprobe/insmod */
 MODULE_PARM(irq, "i");
 MODULE_PARM(disable, "i");
@@ -745,41 +690,42 @@
 MODULE_PARM(virt_ctr, "i");
 MODULE_PARM(shared_access, "i");
 MODULE_PARM(probe_eisa_isa, "i");
+MODULE_PARM(force_dma32, "i");
 MODULE_AUTHOR("Achim Leubner");
-#endif
-#if LINUX_VERSION_CODE >= 0x02040B
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,11)
 MODULE_LICENSE("GPL");
 #endif
 #endif
 
-#ifdef GDTH_IOCTL_CHRDEV
 /* ioctl interface */
 static struct file_operations gdth_fops = {
-	.ioctl		= gdth_ioctl,
-	.open		= gdth_open,
-	.release	= gdth_close,
-};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    .ioctl   = gdth_ioctl,
+    .open    = gdth_open,
+    .release = gdth_close,
+#else
+    ioctl:gdth_ioctl,
+    open:gdth_open,
+    release:gdth_close,
 #endif
+};
 
 /* /proc support */
-#if LINUX_VERSION_CODE >= 0x010300
 #include <linux/stat.h> 
-#if LINUX_VERSION_CODE < 0x020322
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
 struct proc_dir_entry proc_scsi_gdth = {
     PROC_SCSI_GDTH, 4, "gdth",
     S_IFDIR | S_IRUGO | S_IXUGO, 2
 };
 #endif
+
 #include "gdth_proc.h"
 #include "gdth_proc.c"
-#endif
 
-#if LINUX_VERSION_CODE >= 0x020100
 /* notifier block to get a notify on system shutdown/halt/reboot */
 static struct notifier_block gdth_notifier = {
     gdth_halt, NULL, 0
 };
-#endif
 
 
 static void gdth_delay(int milliseconds)
@@ -787,17 +733,11 @@
     if (milliseconds == 0) {
         udelay(1);
     } else {
-#if LINUX_VERSION_CODE >= 0x020168
         mdelay(milliseconds);
-#else
-        int i;
-        for (i = 0; i < milliseconds; ++i) 
-            udelay(1000);
-#endif
     }
 }
 
-static void gdth_eval_mapping(ulong32 size, int *cyls, int *heads, int *secs)
+static void gdth_eval_mapping(ulong32 size, ulong32 *cyls, int *heads, int *secs)
 {
     *cyls = size /HEADS/SECS;
     if (*cyls <= MAXCYLS) {
@@ -842,9 +782,9 @@
     ulong32 id;
 
     TRACE(("gdth_search_isa() bios adr. %x\n",bios_adr));
-    if ((addr = gdth_mmap(bios_adr+BIOS_ID_OFFS, sizeof(ulong32))) != NULL) {
+    if ((addr = ioremap(bios_adr+BIOS_ID_OFFS, sizeof(ulong32))) != NULL) {
         id = gdth_readl(addr);
-        gdth_munmap(addr);
+        iounmap(addr);
         if (id == GDT2_ID)                          /* GDT2000 */
             return 1;
     }
@@ -866,6 +806,8 @@
         gdth_search_dev(pcistr, &cnt, PCI_VENDOR_ID_VORTEX, device);
     gdth_search_dev(pcistr, &cnt, PCI_VENDOR_ID_VORTEX, 
                     PCI_DEVICE_ID_VORTEX_GDTNEWRX);
+    gdth_search_dev(pcistr, &cnt, PCI_VENDOR_ID_VORTEX, 
+                    PCI_DEVICE_ID_VORTEX_GDTNEWRX2);
     gdth_search_dev(pcistr, &cnt, PCI_VENDOR_ID_INTEL,
                     PCI_DEVICE_ID_INTEL_SRC);
     gdth_search_dev(pcistr, &cnt, PCI_VENDOR_ID_INTEL,
@@ -873,11 +815,11 @@
     return cnt;
 }
 
-#if LINUX_VERSION_CODE >= 0x20363
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 /* Vortex only makes RAID controllers.
  * We do not really want to specify all 550 ids here, so wildcard match.
  */
-static struct pci_device_id gdthtable[] = {
+static struct pci_device_id gdthtable[] __devinitdata = {
     {PCI_VENDOR_ID_VORTEX,PCI_ANY_ID,PCI_ANY_ID, PCI_ANY_ID},
     {PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_SRC,PCI_ANY_ID,PCI_ANY_ID}, 
     {PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_SRC_XSCALE,PCI_ANY_ID,PCI_ANY_ID}, 
@@ -890,17 +832,12 @@
                                            ushort vendor, ushort device))
 {
     ulong base0, base1, base2;
-#if LINUX_VERSION_CODE >= 0x2015C
     struct pci_dev *pdev;
-#else
-    int error;
-    ushort idx;
-#endif
     
     TRACE(("gdth_search_dev() cnt %d vendor %x device %x\n",
           *cnt, vendor, device));
 
-#if LINUX_VERSION_CODE >= 0x20363
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     pdev = NULL;
     while ((pdev = pci_find_device(vendor, device, pdev)) 
            != NULL) {
@@ -938,7 +875,7 @@
                 pcistr[*cnt].irq, pcistr[*cnt].dpmem));
         (*cnt)++;
     }       
-#elif LINUX_VERSION_CODE >= 0x2015C
+#else
     pdev = NULL;
     while ((pdev = pci_find_device(vendor, device, pdev)) 
            != NULL) {
@@ -979,66 +916,6 @@
                 pcistr[*cnt].irq, pcistr[*cnt].dpmem));
         (*cnt)++;
     }       
-#else   
-    idx = 0;
-    while (!pcibios_find_device(vendor, device, idx++,
-                                &pcistr[*cnt].bus,&pcistr[*cnt].device_fn)) {
-        if (*cnt >= MAXHA)
-            return;
-        /* GDT PCI ctr. found, now read resources from config space */
-#if LINUX_VERSION_CODE >= 0x010300
-#define GDTH_BASEP      (int *)
-#else
-#define GDTH_BASEP
-#endif
-        if ((error = pcibios_read_config_dword(pcistr[*cnt].bus,
-                                               pcistr[*cnt].device_fn,
-                                               PCI_BASE_ADDRESS_0,
-                                               GDTH_BASEP&base0)) ||
-            (error = pcibios_read_config_dword(pcistr[*cnt].bus,
-                                               pcistr[*cnt].device_fn,
-                                               PCI_BASE_ADDRESS_1,
-                                               GDTH_BASEP&base1)) ||
-            (error = pcibios_read_config_dword(pcistr[*cnt].bus,
-                                               pcistr[*cnt].device_fn,
-                                               PCI_BASE_ADDRESS_2,
-                                               GDTH_BASEP&base2)) ||
-            (error = pcibios_read_config_word(pcistr[*cnt].bus,
-                                              pcistr[*cnt].device_fn,
-                                              PCI_SUBSYSTEM_ID,
-                                              &pcistr[*cnt].subdevice_id)) ||
-            (error = pcibios_read_config_byte(pcistr[*cnt].bus,
-                                              pcistr[*cnt].device_fn,
-                                              PCI_INTERRUPT_LINE,
-                                              &pcistr[*cnt].irq))) {
-            printk("GDT-PCI: error %d reading configuration space", error);
-            continue;
-        }
-        pcistr[*cnt].vendor_id = vendor;
-        pcistr[*cnt].device_id = device;
-        if (device <= PCI_DEVICE_ID_VORTEX_GDT6000B ||   /* GDT6000/B */
-            device >= PCI_DEVICE_ID_VORTEX_GDT6x17RP) {  /* MPR */
-            if ((base0 & PCI_BASE_ADDRESS_SPACE) !=
-                PCI_BASE_ADDRESS_SPACE_MEMORY)
-                continue;
-            pcistr[*cnt].dpmem = base0 & PCI_BASE_ADDRESS_MEM_MASK;
-        } else {                                    /* GDT6110, GDT6120, .. */
-            if ((base0 & PCI_BASE_ADDRESS_SPACE) !=
-                PCI_BASE_ADDRESS_SPACE_MEMORY ||
-                (base2 & PCI_BASE_ADDRESS_SPACE) !=
-                PCI_BASE_ADDRESS_SPACE_MEMORY ||
-                (base1 & PCI_BASE_ADDRESS_SPACE) !=
-                PCI_BASE_ADDRESS_SPACE_IO)
-                continue;
-            pcistr[*cnt].dpmem = base2 & PCI_BASE_ADDRESS_MEM_MASK;
-            pcistr[*cnt].io_mm = base0 & PCI_BASE_ADDRESS_MEM_MASK;
-            pcistr[*cnt].io    = base1 & PCI_BASE_ADDRESS_IO_MASK;
-        }
-        TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n",
-                pcistr[*cnt].bus, PCI_SLOT(pcistr[*cnt].device_fn), 
-                pcistr[*cnt].irq, pcistr[*cnt].dpmem));
-        (*cnt)++;
-    }
 #endif
 }   
 
@@ -1168,6 +1045,8 @@
         ha->type = GDT_EISA;
         ha->stype = id;
     }
+
+    ha->dma64_support = 0;
     return 1;
 }
 
@@ -1181,7 +1060,7 @@
 
     TRACE(("gdth_init_isa() bios adr. %x\n",bios_adr));
 
-    ha->brd = gdth_mmap(bios_adr, sizeof(gdt2_dpram_str));
+    ha->brd = ioremap(bios_adr, sizeof(gdt2_dpram_str));
     if (ha->brd == NULL) {
         printk("GDT-ISA: Initialization error (DPMEM remap error)\n");
         return 0;
@@ -1191,8 +1070,8 @@
     /* reset interface area */
     memset_io((char *)&dp2_ptr->u,0,sizeof(dp2_ptr->u));
     if (gdth_readl(&dp2_ptr->u) != 0) {
-        printk("GDT-PCI: Initialization error (DPMEM write error)\n");
-        gdth_munmap(ha->brd);
+        printk("GDT-ISA: Initialization error (DPMEM write error)\n");
+        iounmap(ha->brd);
         return 0;
     }
 
@@ -1227,7 +1106,7 @@
     while (gdth_readb(&dp2_ptr->u.ic.S_Status) != 0xff) {
         if (--retries == 0) {
             printk("GDT-ISA: Initialization error (DEINIT failed)\n");
-            gdth_munmap(ha->brd);
+            iounmap(ha->brd);
             return 0;
         }
         gdth_delay(1);
@@ -1237,7 +1116,7 @@
     gdth_writeb(0xff, &dp2_ptr->io.irqdel);
     if (prot_ver != PROTOCOL_VERSION) {
         printk("GDT-ISA: Illegal protocol version\n");
-        gdth_munmap(ha->brd);
+        iounmap(ha->brd);
         return 0;
     }
 
@@ -1259,13 +1138,15 @@
     while (gdth_readb(&dp2_ptr->u.ic.S_Status) != 0xfe) {
         if (--retries == 0) {
             printk("GDT-ISA: Initialization error\n");
-            gdth_munmap(ha->brd);
+            iounmap(ha->brd);
             return 0;
         }
         gdth_delay(1);
     }
     gdth_writeb(0, &dp2_ptr->u.ic.Status);
     gdth_writeb(0xff, &dp2_ptr->io.irqdel);
+
+    ha->dma64_support = 0;
     return 1;
 }
 
@@ -1279,9 +1160,6 @@
     unchar prot_ver;
     ushort command;
     int i, found = FALSE;
-#if LINUX_VERSION_CODE < 0x2015C
-    int rom_addr;
-#endif
 
     TRACE(("gdth_init_pci()\n"));
 
@@ -1293,13 +1171,13 @@
     ha->stype = (ulong32)pcistr->device_id;
     ha->subdevice_id = pcistr->subdevice_id;
     ha->irq = pcistr->irq;
-#if LINUX_VERSION_CODE >= 0x20400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     ha->pdev = pcistr->pdev;
 #endif
     
     if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6000B) {  /* GDT6000/B */
         TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq));
-        ha->brd = gdth_mmap(pcistr->dpmem, sizeof(gdt6_dpram_str));
+        ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str));
         if (ha->brd == NULL) {
             printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
             return 0;
@@ -1312,8 +1190,8 @@
                    pcistr->dpmem);
             found = FALSE;
             for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
-                gdth_munmap(ha->brd);
-                ha->brd = gdth_mmap(i, sizeof(ushort)); 
+                iounmap(ha->brd);
+                ha->brd = ioremap(i, sizeof(ushort)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -1322,15 +1200,10 @@
                     TRACE2(("init_pci_old() address 0x%x busy\n", i));
                     continue;
                 }
-                gdth_munmap(ha->brd);
-#if LINUX_VERSION_CODE >= 0x2015C
+                iounmap(ha->brd);
                 pci_write_config_dword(pcistr->pdev, 
                                        PCI_BASE_ADDRESS_0, i);
-#else
-                pcibios_write_config_dword(pcistr->bus, pcistr->device_fn,
-                                           PCI_BASE_ADDRESS_0, i);
-#endif
-                ha->brd = gdth_mmap(i, sizeof(gdt6_dpram_str)); 
+                ha->brd = ioremap(i, sizeof(gdt6_dpram_str)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -1345,14 +1218,14 @@
             }   
             if (!found) {
                 printk("GDT-PCI: No free address found!\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
         }
         memset_io((char *)&dp6_ptr->u,0,sizeof(dp6_ptr->u));
         if (gdth_readl(&dp6_ptr->u) != 0) {
             printk("GDT-PCI: Initialization error (DPMEM write error)\n");
-            gdth_munmap(ha->brd);
+            iounmap(ha->brd);
             return 0;
         }
         
@@ -1370,7 +1243,7 @@
         while (gdth_readb(&dp6_ptr->u.ic.S_Status) != 0xff) {
             if (--retries == 0) {
                 printk("GDT-PCI: Initialization error (DEINIT failed)\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
             gdth_delay(1);
@@ -1380,7 +1253,7 @@
         gdth_writeb(0xff, &dp6_ptr->io.irqdel);
         if (prot_ver != PROTOCOL_VERSION) {
             printk("GDT-PCI: Illegal protocol version\n");
-            gdth_munmap(ha->brd);
+            iounmap(ha->brd);
             return 0;
         }
 
@@ -1390,7 +1263,7 @@
         /* special command to controller BIOS */
         gdth_writel(0x00, &dp6_ptr->u.ic.S_Info[0]);
         gdth_writel(0x00, &dp6_ptr->u.ic.S_Info[1]);
-        gdth_writel(0x01, &dp6_ptr->u.ic.S_Info[2]);
+        gdth_writel(0x00, &dp6_ptr->u.ic.S_Info[2]);
         gdth_writel(0x00, &dp6_ptr->u.ic.S_Info[3]);
         gdth_writeb(0xfe, &dp6_ptr->u.ic.S_Cmd_Indx);
         gdth_writeb(0, &dp6_ptr->io.event);
@@ -1399,7 +1272,7 @@
         while (gdth_readb(&dp6_ptr->u.ic.S_Status) != 0xfe) {
             if (--retries == 0) {
                 printk("GDT-PCI: Initialization error\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
             gdth_delay(1);
@@ -1407,14 +1280,16 @@
         gdth_writeb(0, &dp6_ptr->u.ic.S_Status);
         gdth_writeb(0xff, &dp6_ptr->io.irqdel);
 
+        ha->dma64_support = 0;
+
     } else if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */
         ha->plx = (gdt6c_plx_regs *)pcistr->io;
         TRACE2(("init_pci_new() dpmem %lx irq %d\n",
             pcistr->dpmem,ha->irq));
-        ha->brd = gdth_mmap(pcistr->dpmem, sizeof(gdt6c_dpram_str));
+        ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6c_dpram_str));
         if (ha->brd == NULL) {
             printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
-            gdth_munmap(ha->brd);
+            iounmap(ha->brd);
             return 0;
         }
         /* check and reset interface area */
@@ -1425,8 +1300,8 @@
                    pcistr->dpmem);
             found = FALSE;
             for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
-                gdth_munmap(ha->brd);
-                ha->brd = gdth_mmap(i, sizeof(ushort)); 
+                iounmap(ha->brd);
+                ha->brd = ioremap(i, sizeof(ushort)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -1435,15 +1310,10 @@
                     TRACE2(("init_pci_plx() address 0x%x busy\n", i));
                     continue;
                 }
-                gdth_munmap(ha->brd);
-#if LINUX_VERSION_CODE >= 0x2015C
+                iounmap(ha->brd);
                 pci_write_config_dword(pcistr->pdev, 
                                        PCI_BASE_ADDRESS_2, i);
-#else
-                pcibios_write_config_dword(pcistr->bus, pcistr->device_fn,
-                                           PCI_BASE_ADDRESS_2, i);
-#endif
-                ha->brd = gdth_mmap(i, sizeof(gdt6c_dpram_str)); 
+                ha->brd = ioremap(i, sizeof(gdt6c_dpram_str)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -1458,14 +1328,14 @@
             }   
             if (!found) {
                 printk("GDT-PCI: No free address found!\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
         }
         memset_io((char *)&dp6c_ptr->u,0,sizeof(dp6c_ptr->u));
         if (gdth_readl(&dp6c_ptr->u) != 0) {
             printk("GDT-PCI: Initialization error (DPMEM write error)\n");
-            gdth_munmap(ha->brd);
+            iounmap(ha->brd);
             return 0;
         }
         
@@ -1486,7 +1356,7 @@
         while (gdth_readb(&dp6c_ptr->u.ic.S_Status) != 0xff) {
             if (--retries == 0) {
                 printk("GDT-PCI: Initialization error (DEINIT failed)\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
             gdth_delay(1);
@@ -1495,7 +1365,7 @@
         gdth_writeb(0, &dp6c_ptr->u.ic.Status);
         if (prot_ver != PROTOCOL_VERSION) {
             printk("GDT-PCI: Illegal protocol version\n");
-            gdth_munmap(ha->brd);
+            iounmap(ha->brd);
             return 0;
         }
 
@@ -1505,7 +1375,7 @@
         /* special command to controller BIOS */
         gdth_writel(0x00, &dp6c_ptr->u.ic.S_Info[0]);
         gdth_writel(0x00, &dp6c_ptr->u.ic.S_Info[1]);
-        gdth_writel(0x01, &dp6c_ptr->u.ic.S_Info[2]);
+        gdth_writel(0x00, &dp6c_ptr->u.ic.S_Info[2]);
         gdth_writel(0x00, &dp6c_ptr->u.ic.S_Info[3]);
         gdth_writeb(0xfe, &dp6c_ptr->u.ic.S_Cmd_Indx);
         
@@ -1516,23 +1386,25 @@
         while (gdth_readb(&dp6c_ptr->u.ic.S_Status) != 0xfe) {
             if (--retries == 0) {
                 printk("GDT-PCI: Initialization error\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
             gdth_delay(1);
         }
         gdth_writeb(0, &dp6c_ptr->u.ic.S_Status);
 
+        ha->dma64_support = 0;
+
     } else {                                            /* MPR */
         TRACE2(("init_pci_mpr() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq));
-        ha->brd = gdth_mmap(pcistr->dpmem, sizeof(gdt6m_dpram_str));
+        ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6m_dpram_str));
         if (ha->brd == NULL) {
             printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
             return 0;
         }
 
         /* manipulate config. space to enable DPMEM, start RP controller */
-#if LINUX_VERSION_CODE >= 0x20363
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
         pci_read_config_word(pcistr->pdev, PCI_COMMAND, &command);
         command |= 6;
         pci_write_config_word(pcistr->pdev, PCI_COMMAND, command);
@@ -1543,7 +1415,7 @@
         gdth_delay(1);
         pci_write_config_dword(pcistr->pdev, PCI_ROM_ADDRESS,
                                pci_resource_start(pcistr->pdev, 8));
-#elif LINUX_VERSION_CODE >= 0x2015C
+#else
         pci_read_config_word(pcistr->pdev, PCI_COMMAND, &command);
         command |= 6;
         pci_write_config_word(pcistr->pdev, PCI_COMMAND, command);
@@ -1554,22 +1426,6 @@
         gdth_delay(1);
         pci_write_config_dword(pcistr->pdev, PCI_ROM_ADDRESS,
                                pcistr->pdev->rom_address);
-#else
-        pcibios_read_config_word(pcistr->bus, pcistr->device_fn,
-                                 PCI_COMMAND, &command);
-        command |= 6;
-        pcibios_write_config_word(pcistr->bus, pcistr->device_fn, 
-                                  PCI_COMMAND, command);
-        pcibios_read_config_dword(pcistr->bus, pcistr->device_fn,
-                                  PCI_ROM_ADDRESS, &rom_addr);
-        if (rom_addr == 1UL)
-            rom_addr = 0UL;
-        i = 0xFEFF0001UL;
-        pcibios_write_config_dword(pcistr->bus, pcistr->device_fn,
-                                   PCI_ROM_ADDRESS, i);
-        gdth_delay(1);
-        pcibios_write_config_dword(pcistr->bus, pcistr->device_fn,
-                                   PCI_ROM_ADDRESS, rom_addr);
 #endif
         
         /* Ensure that it is safe to access the non HW portions of DPMEM.
@@ -1585,8 +1441,8 @@
                    pcistr->dpmem);
             found = FALSE;
             for (i = 0xC8000; i < 0xE8000; i += 0x4000) {
-                gdth_munmap(ha->brd);
-                ha->brd = gdth_mmap(i, sizeof(ushort)); 
+                iounmap(ha->brd);
+                ha->brd = ioremap(i, sizeof(ushort)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -1595,15 +1451,10 @@
                     TRACE2(("init_pci_mpr() address 0x%x busy\n", i));
                     continue;
                 }
-                gdth_munmap(ha->brd);
-#if LINUX_VERSION_CODE >= 0x2015C
+                iounmap(ha->brd);
                 pci_write_config_dword(pcistr->pdev, 
                                        PCI_BASE_ADDRESS_0, i);
-#else
-                pcibios_write_config_dword(pcistr->bus, pcistr->device_fn,
-                                           PCI_BASE_ADDRESS_0, i);
-#endif
-                ha->brd = gdth_mmap(i, sizeof(gdt6m_dpram_str)); 
+                ha->brd = ioremap(i, sizeof(gdt6m_dpram_str)); 
                 if (ha->brd == NULL) {
                     printk("GDT-PCI: Initialization error (DPMEM remap error)\n");
                     return 0;
@@ -1618,7 +1469,7 @@
             }   
             if (!found) {
                 printk("GDT-PCI: No free address found!\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
         }
@@ -1639,7 +1490,7 @@
         while (gdth_readb(&dp6m_ptr->u.ic.S_Status) != 0xff) {
             if (--retries == 0) {
                 printk("GDT-PCI: Initialization error (DEINIT failed)\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
             gdth_delay(1);
@@ -1648,7 +1499,7 @@
         gdth_writeb(0, &dp6m_ptr->u.ic.S_Status);
         if (prot_ver != PROTOCOL_VERSION) {
             printk("GDT-PCI: Illegal protocol version\n");
-            gdth_munmap(ha->brd);
+            iounmap(ha->brd);
             return 0;
         }
 
@@ -1658,7 +1509,7 @@
         /* special command to controller BIOS */
         gdth_writel(0x00, &dp6m_ptr->u.ic.S_Info[0]);
         gdth_writel(0x00, &dp6m_ptr->u.ic.S_Info[1]);
-        gdth_writel(0x01, &dp6m_ptr->u.ic.S_Info[2]);
+        gdth_writel(0x00, &dp6m_ptr->u.ic.S_Info[2]);
         gdth_writel(0x00, &dp6m_ptr->u.ic.S_Info[3]);
         gdth_writeb(0xfe, &dp6m_ptr->u.ic.S_Cmd_Indx);
         gdth_writeb(1, &dp6m_ptr->i960r.ldoor_reg);
@@ -1667,12 +1518,32 @@
         while (gdth_readb(&dp6m_ptr->u.ic.S_Status) != 0xfe) {
             if (--retries == 0) {
                 printk("GDT-PCI: Initialization error\n");
-                gdth_munmap(ha->brd);
+                iounmap(ha->brd);
                 return 0;
             }
             gdth_delay(1);
         }
         gdth_writeb(0, &dp6m_ptr->u.ic.S_Status);
+
+        /* read FW version to detect 64-bit DMA support */
+        gdth_writeb(0xfd, &dp6m_ptr->u.ic.S_Cmd_Indx);
+        gdth_writeb(1, &dp6m_ptr->i960r.ldoor_reg);
+        retries = INIT_RETRIES;
+        gdth_delay(20);
+        while (gdth_readb(&dp6m_ptr->u.ic.S_Status) != 0xfd) {
+            if (--retries == 0) {
+                printk("GDT-PCI: Initialization error (DEINIT failed)\n");
+                iounmap(ha->brd);
+                return 0;
+            }
+            gdth_delay(1);
+        }
+        prot_ver = (unchar)(gdth_readl(&dp6m_ptr->u.ic.S_Info[0]) >> 16);
+        gdth_writeb(0, &dp6m_ptr->u.ic.S_Status);
+        if (prot_ver < 0x2b)      /* FW < x.43: no 64-bit DMA support */
+            ha->dma64_support = 0;
+        else 
+            ha->dma64_support = 1;
     }
 
     return 1;
@@ -1950,7 +1821,7 @@
 
 
 static int gdth_internal_cmd(int hanum,unchar service,ushort opcode,ulong32 p1,
-                             ulong32 p2,ulong32 p3)
+                             ulong64 p2,ulong64 p3)
 {
     register gdth_ha_str *ha;
     register gdth_cmd_str *cmd_ptr;
@@ -1976,23 +1847,35 @@
         if (service == CACHESERVICE) {
             if (opcode == GDT_IOCTL) {
                 cmd_ptr->u.ioctl.subfunc = p1;
-                cmd_ptr->u.ioctl.channel = p2;
+                cmd_ptr->u.ioctl.channel = (ulong32)p2;
                 cmd_ptr->u.ioctl.param_size = (ushort)p3;
                 cmd_ptr->u.ioctl.p_param = ha->scratch_phys;
             } else {
-                cmd_ptr->u.cache.DeviceNo = (ushort)p1;
-                cmd_ptr->u.cache.BlockNo  = p2;
+                if (ha->cache_feat & GDT_64BIT) {
+                    cmd_ptr->u.cache64.DeviceNo = (ushort)p1;
+                    cmd_ptr->u.cache64.BlockNo  = p2;
+                } else {
+                    cmd_ptr->u.cache.DeviceNo = (ushort)p1;
+                    cmd_ptr->u.cache.BlockNo  = (ulong32)p2;
+                }
             }
         } else if (service == SCSIRAWSERVICE) {
-            cmd_ptr->u.raw.direction  = p1;
-            cmd_ptr->u.raw.bus        = (unchar)p2;
-            cmd_ptr->u.raw.target     = (unchar)p3;
-            cmd_ptr->u.raw.lun        = (unchar)(p3 >> 8);
+            if (ha->raw_feat & GDT_64BIT) {
+                cmd_ptr->u.raw64.direction  = p1;
+                cmd_ptr->u.raw64.bus        = (unchar)p2;
+                cmd_ptr->u.raw64.target     = (unchar)p3;
+                cmd_ptr->u.raw64.lun        = (unchar)(p3 >> 8);
+            } else {
+                cmd_ptr->u.raw.direction  = p1;
+                cmd_ptr->u.raw.bus        = (unchar)p2;
+                cmd_ptr->u.raw.target     = (unchar)p3;
+                cmd_ptr->u.raw.lun        = (unchar)(p3 >> 8);
+            }
         } else if (service == SCREENSERVICE) {
             if (opcode == GDT_REALTIME) {
                 *(ulong32 *)&cmd_ptr->u.screen.su.data[0] = p1;
-                *(ulong32 *)&cmd_ptr->u.screen.su.data[4] = p2;
-                *(ulong32 *)&cmd_ptr->u.screen.su.data[8] = p3;
+                *(ulong32 *)&cmd_ptr->u.screen.su.data[4] = (ulong32)p2;
+                *(ulong32 *)&cmd_ptr->u.screen.su.data[8] = (ulong32)p3;
             }
         }
         ha->cmd_len          = sizeof(gdth_cmd_str);
@@ -2020,6 +1903,7 @@
 {
     register gdth_ha_str *ha;
     ushort cdev_cnt, i;
+    int ok;
     ulong32 bus_no, drv_cnt, drv_no, j;
     gdth_getch_str *chn;
     gdth_drlist_str *drl;
@@ -2028,6 +1912,9 @@
     gdth_arcdl_str *alst;
     gdth_alist_str *alst2;
     gdth_oem_str_ioctl *oemstr;
+#ifdef INT_COAL
+    gdth_perf_modes *pmod;
+#endif
 
 #ifdef GDTH_RTC
     unchar rtc[12];
@@ -2036,11 +1923,20 @@
    
     TRACE(("gdth_search_drives() hanum %d\n",hanum));
     ha = HADATA(gdth_ctr_tab[hanum]);
+    ok = 0;
 
     /* initialize controller services, at first: screen service */
-    if (!gdth_internal_cmd(hanum,SCREENSERVICE,GDT_INIT,0,0,0)) {
-        printk("GDT: Initialization error screen service (code %d)\n",
-               ha->status);
+    ha->screen_feat = 0;
+    if (!force_dma32) {
+        ok = gdth_internal_cmd(hanum,SCREENSERVICE,GDT_X_INIT_SCR,0,0,0);
+        if (ok)
+            ha->screen_feat = GDT_64BIT;
+    }
+    if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC))
+        ok = gdth_internal_cmd(hanum,SCREENSERVICE,GDT_INIT,0,0,0);
+    if (!ok) {
+        printk("GDT-HA %d: Initialization error screen service (code %d)\n",
+               hanum, ha->status);
         return 0;
     }
     TRACE2(("gdth_search_drives(): SCREENSERVICE initialized\n"));
@@ -2060,7 +1956,7 @@
         for (j = 0; j < 12; ++j) 
             rtc[j] = CMOS_READ(j);
     } while (rtc[0] != CMOS_READ(0));
-    spin_unlock_irqrestore(&rtc_lock, flags);
+    spin_lock_irqrestore(&rtc_lock, flags);
     TRACE2(("gdth_search_drives(): RTC: %x/%x/%x\n",*(ulong32 *)&rtc[0],
             *(ulong32 *)&rtc[4], *(ulong32 *)&rtc[8]));
     /* 3. send to controller firmware */
@@ -2072,15 +1968,52 @@
     gdth_internal_cmd(hanum,CACHESERVICE,GDT_UNFREEZE_IO,0,0,0);
  
     /* initialize cache service */
-    if (!gdth_internal_cmd(hanum,CACHESERVICE,GDT_INIT,LINUX_OS,0,0)) {
-        printk("GDT: Initialization error cache service (code %d)\n",
-               ha->status);
+    ha->cache_feat = 0;
+    if (!force_dma32) {
+        ok = gdth_internal_cmd(hanum,CACHESERVICE,GDT_X_INIT_HOST,LINUX_OS,0,0);
+        if (ok)
+            ha->cache_feat = GDT_64BIT;
+    }
+    if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC))
+        ok = gdth_internal_cmd(hanum,CACHESERVICE,GDT_INIT,LINUX_OS,0,0);
+    if (!ok) {
+        printk("GDT-HA %d: Initialization error cache service (code %d)\n",
+               hanum, ha->status);
         return 0;
     }
     TRACE2(("gdth_search_drives(): CACHESERVICE initialized\n"));
     cdev_cnt = (ushort)ha->info;
     ha->fw_vers = ha->service;
 
+#ifdef INT_COAL
+    if (ha->type == GDT_PCIMPR) {
+        /* set perf. modes */
+        pmod = (gdth_perf_modes *)ha->pscratch;
+        pmod->version          = 1;
+        pmod->st_mode          = 1;    /* enable one status buffer */
+        *((ulong64 *)&pmod->st_buff_addr1) = ha->coal_stat_phys;
+        pmod->st_buff_indx1    = COALINDEX;
+        pmod->st_buff_addr2    = 0;
+        pmod->st_buff_u_addr2  = 0;
+        pmod->st_buff_indx2    = 0;
+        pmod->st_buff_size     = sizeof(gdth_coal_status) * MAXOFFSETS;
+        pmod->cmd_mode         = 0;    // disable all cmd buffers
+        pmod->cmd_buff_addr1   = 0;
+        pmod->cmd_buff_u_addr1 = 0;
+        pmod->cmd_buff_indx1   = 0;
+        pmod->cmd_buff_addr2   = 0;
+        pmod->cmd_buff_u_addr2 = 0;
+        pmod->cmd_buff_indx2   = 0;
+        pmod->cmd_buff_size    = 0;
+        pmod->reserved1        = 0;            
+        pmod->reserved2        = 0;            
+        if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,SET_PERF_MODES,
+                              INVALID_CHANNEL,sizeof(gdth_perf_modes))) {
+            printk("GDT-HA %d: Interrupt coalescing activated\n", hanum);
+        }
+    }
+#endif
+
     /* detect number of buses - try new IOCTL */
     iocr = (gdth_raw_iochan_str *)ha->pscratch;
     iocr->hdr.version        = 0xffffffff;
@@ -2108,8 +2041,8 @@
                                    IO_CHANNEL | INVALID_CHANNEL,
                                    sizeof(gdth_getch_str))) {
                 if (bus_no == 0) {
-                    printk("GDT: Error detecting channel count (0x%x)\n",
-                           ha->status);
+                    printk("GDT-HA %d: Error detecting channel count (0x%x)\n",
+                           hanum, ha->status);
                     return 0;
                 }
                 break;
@@ -2126,8 +2059,8 @@
     /* read cache configuration */
     if (!gdth_internal_cmd(hanum,CACHESERVICE,GDT_IOCTL,CACHE_INFO,
                            INVALID_CHANNEL,sizeof(gdth_cinfo_str))) {
-        printk("GDT: Initialization error cache service (code %d)\n",
-               ha->status);
+        printk("GDT-HA %d: Initialization error cache service (code %d)\n",
+               hanum, ha->status);
         return 0;
     }
     ha->cpar = ((gdth_cinfo_str *)ha->pscratch)->cpar;
@@ -2246,9 +2179,17 @@
     }       
                                   
     /* initialize raw service */
-    if (!gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_INIT,0,0,0)) {
-        printk("GDT: Initialization error raw service (code %d)\n",
-               ha->status);
+    ha->raw_feat = 0;
+    if (!force_dma32) {
+        ok = gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_X_INIT_RAW,0,0,0);
+        if (ok)
+            ha->raw_feat = GDT_64BIT;
+    }
+    if (force_dma32 || (!ok && ha->status == (ushort)S_NOFUNC))
+        ok = gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_INIT,0,0,0);
+    if (!ok) {
+        printk("GDT-HA %d: Initialization error raw service (code %d)\n",
+               hanum, ha->status);
         return 0;
     }
     TRACE2(("gdth_search_drives(): RAWSERVICE initialized\n"));
@@ -2260,7 +2201,7 @@
         if (gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_GET_FEAT,0,0,0)) {
             TRACE2(("gdth_search_dr(): get feat RAWSERVICE %d\n",
                     ha->info));
-            ha->raw_feat = (ushort)ha->info;
+            ha->raw_feat |= (ushort)ha->info;
         }
     } 
 
@@ -2271,7 +2212,7 @@
         if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_GET_FEAT,0,0,0)) {
             TRACE2(("gdth_search_dr(): get feat CACHESERV. %d\n",
                     ha->info));
-            ha->cache_feat = (ushort)ha->info;
+            ha->cache_feat |= (ushort)ha->info;
         }
     }
 
@@ -2291,8 +2232,8 @@
             if (!gdth_internal_cmd(hanum,SCSIRAWSERVICE,GDT_RESERVE,0,
                                    reserve_list[i+1], reserve_list[i+2] | 
                                    (reserve_list[i+3] << 8))) {
-                printk("GDT: Error raw service (RESERVE, code %d)\n",
-                       ha->status);
+                printk("GDT-HA %d: Error raw service (RESERVE, code %d)\n",
+                       hanum, ha->status);
              }
         }
     }
@@ -2305,17 +2246,32 @@
                           CACHE_READ_OEM_STRING_RECORD,INVALID_CHANNEL,
                           sizeof(gdth_oem_str_ioctl))) {
         TRACE2(("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD OK\n"));
-        printk("GDT CTR%d Vendor: %s\n",hanum,oemstr->text.oem_company_name);
+        printk("GDT-HA %d: Vendor: %s Name: %s\n",
+               hanum,oemstr->text.oem_company_name,ha->binfo.type_string);
         /* Save the Host Drive inquiry data */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         strlcpy(ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id,
-		sizeof(ha->oem_name));
+                sizeof(ha->oem_name));
+#else
+        strncpy(ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id,7);
+        ha->oem_name[7] = '\0';
+#endif
     } else {
         /* Old method, based on PCI ID */
         TRACE2(("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD failed\n"));
+        printk("GDT-HA %d: Name: %s\n",
+               hanum,ha->binfo.type_string);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         if (ha->oem_id == OEM_ID_INTEL)
             strlcpy(ha->oem_name,"Intel  ", sizeof(ha->oem_name));
         else
             strlcpy(ha->oem_name,"ICP    ", sizeof(ha->oem_name));
+#else 
+        if (ha->oem_id == OEM_ID_INTEL)
+            strcpy(ha->oem_name,"Intel  ");
+        else
+            strcpy(ha->oem_name,"ICP    ");
+#endif
     }
 
     /* scanning for host drives */
@@ -2329,7 +2285,8 @@
 static int gdth_analyse_hdrive(int hanum,ushort hdrive)
 {
     register gdth_ha_str *ha;
-    int drv_cyls, drv_hds, drv_secs;
+    ulong32 drv_cyls;
+    int drv_hds, drv_secs;
 
     TRACE(("gdth_analyse_hdrive() hanum %d drive %d\n",hanum,hdrive));
     if (hdrive >= MAX_HDRIVES)
@@ -2340,7 +2297,7 @@
         return 0;
     ha->hdr[hdrive].present = TRUE;
     ha->hdr[hdrive].size = ha->info;
-
+   
     /* evaluate mapping (sectors per head, heads per cylinder) */
     ha->hdr[hdrive].size &= ~SECS32;
     if (ha->info2 == 0) {
@@ -2348,15 +2305,22 @@
     } else {
         drv_hds = ha->info2 & 0xff;
         drv_secs = (ha->info2 >> 8) & 0xff;
-        drv_cyls = ha->hdr[hdrive].size /drv_hds/drv_secs;
+        drv_cyls = (ulong32)ha->hdr[hdrive].size / drv_hds / drv_secs;
     }
     ha->hdr[hdrive].heads = (unchar)drv_hds;
     ha->hdr[hdrive].secs  = (unchar)drv_secs;
     /* round size */
     ha->hdr[hdrive].size  = drv_cyls * drv_hds * drv_secs;
+    
+    if (ha->cache_feat & GDT_64BIT) {
+        if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_X_INFO,hdrive,0,0)
+            && ha->info2 != 0) {
+            ha->hdr[hdrive].size = ((ulong64)ha->info2 << 32) | ha->info;
+        }
+    }
     TRACE2(("gdth_search_dr() cdr. %d size %d hds %d scs %d\n",
             hdrive,ha->hdr[hdrive].size,drv_hds,drv_secs));
-            
+
     /* get informations about device */
     if (gdth_internal_cmd(hanum,CACHESERVICE,GDT_DEVTYPE,hdrive,0,0)) {
         TRACE2(("gdth_search_dr() cache drive %d devtype %d\n",
@@ -2398,14 +2362,13 @@
     GDTH_LOCK_HA(ha, flags);
 
     scp->SCp.this_residual = (int)priority;
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
     t = scp->device->id;
 #else
     b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel;
     t = scp->target;
 #endif
-#if LINUX_VERSION_CODE >= 0x010300
     if (priority >= DEFAULT_PRI) {
         if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) ||
             (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) {
@@ -2413,7 +2376,6 @@
             scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0);
         }
     }
-#endif
 
     if (ha->req_first==NULL) {
         ha->req_first = scp;                    /* queue was empty */
@@ -2465,7 +2427,7 @@
     for (nscp = pscp = ha->req_first; nscp; nscp = (Scsi_Cmnd *)nscp->SCp.ptr) {
         if (nscp != pscp && nscp != (Scsi_Cmnd *)pscp->SCp.ptr)
             pscp = (Scsi_Cmnd *)pscp->SCp.ptr;
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         b = virt_ctr ? NUMDATA(nscp->device->host)->busnum : nscp->device->channel;
         t = nscp->device->id;
         l = nscp->device->lun;
@@ -2493,10 +2455,7 @@
             firsttime = FALSE;
         }
 
-#if LINUX_VERSION_CODE >= 0x010300
-        if (nscp->done != gdth_scsi_done || nscp->cmnd[0] != 0xff) 
-#endif
-        {
+        if (nscp->done != gdth_scsi_done || nscp->cmnd[0] != 0xff) {        
         if (nscp->SCp.phase == -1) {
             nscp->SCp.phase = CACHESERVICE;           /* default: cache svc. */ 
             if (nscp->cmnd[0] == TEST_UNIT_READY) {
@@ -2565,16 +2524,11 @@
                         GDTH_LOCK_HA(ha,flags);
                 }
             }
-        } else
-
-#if LINUX_VERSION_CODE >= 0x010300
-        if (nscp->done == gdth_scsi_done && nscp->cmnd[0] == 0xff) {
+        } else if (nscp->done == gdth_scsi_done && nscp->cmnd[0] == 0xff) {
             if (!(cmd_index=gdth_special_cmd(hanum,nscp)))
                 this_cmd = FALSE;
             next_cmd = FALSE;
-        } else
-#endif
-        if (b != ha->virt_bus) {
+        } else if (b != ha->virt_bus) {
             if (ha->raw[BUS_L2P(ha,b)].io_cnt[t] >= GDTH_MAX_RAW ||
                 !(cmd_index=gdth_fill_raw_cmd(hanum,nscp,BUS_L2P(ha,b)))) 
                 this_cmd = FALSE;
@@ -2603,6 +2557,9 @@
               case VERIFY:
               case START_STOP:
               case MODE_SENSE:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+              case SERVICE_ACTION_IN:
+#endif
                 TRACE(("cache cmd %x/%x/%x/%x/%x/%x\n",nscp->cmnd[0],
                        nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3],
                        nscp->cmnd[4],nscp->cmnd[5]));
@@ -2674,6 +2631,10 @@
               case WRITE_6:
               case READ_10:
               case WRITE_10:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+              case READ_16:
+              case WRITE_16:
+#endif
                 if (ha->hdr[t].media_changed) {
                     /* return UNIT_ATTENTION */
                     TRACE2(("cmd 0x%x target %d: UNIT_ATTENTION\n",
@@ -2701,8 +2662,8 @@
                 TRACE2(("cache cmd %x/%x/%x/%x/%x/%x unknown\n",nscp->cmnd[0],
                         nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3],
                         nscp->cmnd[4],nscp->cmnd[5]));
-                printk("GDT: Unknown SCSI command 0x%x to cache service !\n",
-                       nscp->cmnd[0]);
+                printk("GDT-HA %d: Unknown SCSI command 0x%x to cache service !\n",
+                       hanum, nscp->cmnd[0]);
                 nscp->result = DID_ABORT << 16;
                 if (!nscp->SCp.have_data_in)
                     nscp->SCp.have_data_in++;
@@ -2737,11 +2698,11 @@
 
     if (gdth_polling && ha->cmd_cnt > 0) {
         if (!gdth_wait(hanum,cmd_index,POLL_TIMEOUT))
-            printk("GDT: Controller %d: Command %d timed out !\n",
+            printk("GDT-HA %d: Command %d timed out !\n",
                    hanum,cmd_index);
     }
 }
-    
+   
 static void gdth_copy_internal_data(int hanum,Scsi_Cmnd *scp,
                                     char *buffer,ushort count)
 {
@@ -2757,7 +2718,7 @@
 
     if (scp->use_sg) {
         sl = (struct scatterlist *)scp->request_buffer;
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
         sgcnt = pci_map_sg(ha->pdev,sl,scp->use_sg,PCI_DMA_FROMDEVICE);
         for (i=0,cpsum=0; i<sgcnt; ++i,++sl) {
             cpnow = (ushort)sg_dma_len(sl);
@@ -2766,7 +2727,12 @@
             if (cpsum+cpnow > cpcount) 
                 cpnow = cpcount - cpsum;
             cpsum += cpnow;
-            address = (char *)phys_to_virt(sg_dma_address(sl));
+            if (!sl->page) {
+                printk("GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data()\n",
+                       hanum);
+                return;
+            }
+            address = (char *)(page_address(sl->page) + sl->offset);
             memcpy(address,buffer,cpnow);
             if (cpsum == cpcount)
                 break;
@@ -2806,7 +2772,7 @@
     gdth_modep_data mpd;
 
     ha = HADATA(gdth_ctr_tab[hanum]);
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     t  = scp->device->id;
 #else
     t  = scp->target;
@@ -2814,6 +2780,9 @@
     TRACE(("gdth_internal_cache_cmd() cmd 0x%x hdrive %d\n",
            scp->cmnd[0],t));
 
+    scp->result = DID_OK << 16;
+    scp->sense_buffer[0] = 0;
+
     switch (scp->cmnd[0]) {
       case TEST_UNIT_READY:
       case VERIFY:
@@ -2864,19 +2833,35 @@
 
       case READ_CAPACITY:
         TRACE2(("Read capacity hdrive %d\n",t));
-        rdc.last_block_no = ntohl(ha->hdr[t].size-1);
-        rdc.block_length  = ntohl(SECTOR_SIZE);
+        if (ha->hdr[t].size > (ulong64)0xffffffff)
+            rdc.last_block_no = 0xffffffff;
+        else
+            rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1);
+        rdc.block_length  = cpu_to_be32(SECTOR_SIZE);
         gdth_copy_internal_data(hanum,scp,(char*)&rdc,sizeof(gdth_rdcap_data));
         break;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+      case SERVICE_ACTION_IN:
+        if ((scp->cmnd[1] & 0x1f) == SAI_READ_CAPACITY_16 &&
+            (ha->cache_feat & GDT_64BIT)) {
+            gdth_rdcap16_data rdc16;
+
+            TRACE2(("Read capacity (16) hdrive %d\n",t));
+            rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1);
+            rdc16.block_length  = cpu_to_be32(SECTOR_SIZE);
+            gdth_copy_internal_data(hanum,scp,(char*)&rdc16,sizeof(gdth_rdcap16_data));
+        } else { 
+            scp->result = DID_ABORT << 16;
+        }
+        break;
+#endif
+
       default:
         TRACE2(("Internal cache cmd 0x%x unknown\n",scp->cmnd[0]));
         break;
     }
 
-    scp->result = DID_OK << 16;
-    scp->sense_buffer[0] = 0;
-
     if (!scp->SCp.have_data_in)
         scp->SCp.have_data_in++;
     else 
@@ -2890,9 +2875,14 @@
     register gdth_ha_str *ha;
     register gdth_cmd_str *cmdp;
     struct scatterlist *sl;
-    ushort i, cnt;
-    ulong32 no, phys_addr;
-    int cmd_index, read_write, sgcnt;
+    ulong32 cnt, blockcnt;
+    ulong64 no, blockno;
+    dma_addr_t phys_addr;
+    int i, cmd_index, read_write, sgcnt, mode64;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
+    struct page *page;
+    ulong offset;
+#endif
 
     ha = HADATA(gdth_ctr_tab[hanum]);
     cmdp = ha->pccb;
@@ -2902,6 +2892,11 @@
     if (ha->type==GDT_EISA && ha->cmd_cnt>0) 
         return 0;
 
+    mode64 = (ha->cache_feat & GDT_64BIT) ? TRUE : FALSE;
+    /* test for READ_16, WRITE_16 if !mode64 ? ---
+       not required, should not occur due to error return on 
+       READ_CAPACITY_16 */
+
     cmdp->Service = CACHESERVICE;
     cmdp->RequestBuffer = scp;
     /* search free command index */
@@ -2929,7 +2924,11 @@
         else
             cmdp->OpCode = GDT_FLUSH;
     } else if (scp->cmnd[0] == WRITE_6 || scp->cmnd[0] == WRITE_10 ||
-               scp->cmnd[0] == WRITE_12) {
+               scp->cmnd[0] == WRITE_12 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+               || scp->cmnd[0] == WRITE_16
+#endif
+    ) {
         read_write = 1;
         if (gdth_write_through || ((ha->hdr[hdrive].rw_attribs & 1) && 
                                    (ha->cache_feat & GDT_WR_THROUGH)))
@@ -2940,86 +2939,157 @@
         read_write = 2;
         cmdp->OpCode = GDT_READ;
     }
-    
-    cmdp->BoardNode        = LOCALBOARD;
-    cmdp->u.cache.DeviceNo = hdrive;
-    cmdp->u.cache.BlockNo  = 1;
-    cmdp->u.cache.sg_canz  = 0;
+
+    cmdp->BoardNode = LOCALBOARD;
+    if (mode64) {
+        cmdp->u.cache64.DeviceNo = hdrive;
+        cmdp->u.cache64.BlockNo  = 1;
+        cmdp->u.cache64.sg_canz  = 0;
+    } else {
+        cmdp->u.cache.DeviceNo = hdrive;
+        cmdp->u.cache.BlockNo  = 1;
+        cmdp->u.cache.sg_canz  = 0;
+    }
 
     if (read_write) {
-        if (scp->cmd_len != 6) {
+        if (scp->cmd_len == 16) {
+            memcpy(&no, &scp->cmnd[2], sizeof(ulong64));
+            blockno = be64_to_cpu(no);
+            memcpy(&cnt, &scp->cmnd[10], sizeof(ulong32));
+            blockcnt = be32_to_cpu(cnt);
+        } else if (scp->cmd_len == 10) {
             memcpy(&no, &scp->cmnd[2], sizeof(ulong32));
-            cmdp->u.cache.BlockNo = ntohl(no);
+            blockno = be32_to_cpu(no);
             memcpy(&cnt, &scp->cmnd[7], sizeof(ushort));
-            cmdp->u.cache.BlockCnt = (ulong32)ntohs(cnt);
+            blockcnt = be16_to_cpu(cnt);
         } else {
             memcpy(&no, &scp->cmnd[0], sizeof(ulong32));
-            cmdp->u.cache.BlockNo = ntohl(no) & 0x001fffffUL;
-            cmdp->u.cache.BlockCnt= scp->cmnd[4]==0 ? 0x100 : scp->cmnd[4];
+            blockno = be32_to_cpu(no) & 0x001fffffUL;
+            blockcnt= scp->cmnd[4]==0 ? 0x100 : scp->cmnd[4];
+        }
+        if (mode64) {
+            cmdp->u.cache64.BlockNo = blockno;
+            cmdp->u.cache64.BlockCnt = blockcnt;
+        } else {
+            cmdp->u.cache.BlockNo = (ulong32)blockno;
+            cmdp->u.cache.BlockCnt = blockcnt;
         }
 
         if (scp->use_sg) {
-            cmdp->u.cache.DestAddr= 0xffffffff;
             sl = (struct scatterlist *)scp->request_buffer;
             sgcnt = scp->use_sg;
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
             scp->SCp.Status = GDTH_MAP_SG;
             scp->SCp.Message = (read_write == 1 ? 
                 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);   
             sgcnt = pci_map_sg(ha->pdev,sl,scp->use_sg,scp->SCp.Message);
-            for (i=0; i<sgcnt; ++i,++sl) {
-                cmdp->u.cache.sg_lst[i].sg_ptr = sg_dma_address(sl);
-                cmdp->u.cache.sg_lst[i].sg_len = sg_dma_len(sl);
+            if (mode64) {
+                cmdp->u.cache64.DestAddr= (ulong64)-1;
+                cmdp->u.cache64.sg_canz = sgcnt;
+                for (i=0; i<sgcnt; ++i,++sl) {
+                    cmdp->u.cache64.sg_lst[i].sg_ptr = sg_dma_address(sl);
+#ifdef GDTH_DMA_STATISTICS
+                    if (cmdp->u.cache64.sg_lst[i].sg_ptr > (ulong64)0xffffffff)
+                        ha->dma64_cnt++;
+                    else
+                        ha->dma32_cnt++;
+#endif
+                    cmdp->u.cache64.sg_lst[i].sg_len = sg_dma_len(sl);
+                }
+            } else {
+                cmdp->u.cache.DestAddr= 0xffffffff;
+                cmdp->u.cache.sg_canz = sgcnt;
+                for (i=0; i<sgcnt; ++i,++sl) {
+                    cmdp->u.cache.sg_lst[i].sg_ptr = sg_dma_address(sl);
+#ifdef GDTH_DMA_STATISTICS
+                    ha->dma32_cnt++;
+#endif
+                    cmdp->u.cache.sg_lst[i].sg_len = sg_dma_len(sl);
+                }
             }
 #else
-            for (i=0; i<sgcnt; ++i,++sl) {
-                cmdp->u.cache.sg_lst[i].sg_ptr = virt_to_bus(sl->address);
-                cmdp->u.cache.sg_lst[i].sg_len = (ulong32)sl->length;
+            if (mode64) {
+                cmdp->u.cache64.DestAddr= (ulong64)-1;
+                cmdp->u.cache64.sg_canz = sgcnt;
+                for (i=0; i<sgcnt; ++i,++sl) {
+                    cmdp->u.cache64.sg_lst[i].sg_ptr = virt_to_bus(sl->address);
+                    cmdp->u.cache64.sg_lst[i].sg_len = (ulong32)sl->length;
+                }
+            } else {
+                cmdp->u.cache.DestAddr= 0xffffffff;
+                cmdp->u.cache.sg_canz = sgcnt;
+                for (i=0; i<sgcnt; ++i,++sl) {
+                    cmdp->u.cache.sg_lst[i].sg_ptr = virt_to_bus(sl->address);
+                    cmdp->u.cache.sg_lst[i].sg_len = (ulong32)sl->length;
+                }
             }
 #endif
-            cmdp->u.cache.sg_canz = (ulong32)i;
 
 #ifdef GDTH_STATISTICS
-            if (max_sg < (ulong32)i) {
-                max_sg = (ulong32)i;
-                TRACE3(("GDT: max_sg = %d\n",i));
+            if (max_sg < (ulong32)sgcnt) {
+                max_sg = (ulong32)sgcnt;
+                TRACE3(("GDT: max_sg = %d\n",max_sg));
             }
 #endif
-            if (i<GDTH_MAXSG)
-                cmdp->u.cache.sg_lst[i].sg_len = 0;
+
         } else {
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
             scp->SCp.Status = GDTH_MAP_SINGLE;
             scp->SCp.Message = (read_write == 1 ? 
-                PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);   
-            phys_addr = pci_map_single(ha->pdev,scp->request_buffer,
-                                       scp->request_bufflen,scp->SCp.Message);
+                PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
+            page = virt_to_page(scp->request_buffer);
+            offset = (ulong)scp->request_buffer & ~PAGE_MASK;
+            phys_addr = pci_map_page(ha->pdev,page,offset,
+                                     scp->request_bufflen,scp->SCp.Message);
             scp->SCp.dma_handle = phys_addr;
 #else
             phys_addr = virt_to_bus(scp->request_buffer);
 #endif
-            if (ha->cache_feat & SCATTER_GATHER) {
-                cmdp->u.cache.DestAddr = 0xffffffff;
-                cmdp->u.cache.sg_canz = 1;
-                cmdp->u.cache.sg_lst[0].sg_ptr = phys_addr;
-                cmdp->u.cache.sg_lst[0].sg_len = scp->request_bufflen;
-                cmdp->u.cache.sg_lst[1].sg_len = 0;
+            if (mode64) {
+                if (ha->cache_feat & SCATTER_GATHER) {
+                    cmdp->u.cache64.DestAddr = (ulong64)-1;
+                    cmdp->u.cache64.sg_canz = 1;
+                    cmdp->u.cache64.sg_lst[0].sg_ptr = phys_addr;
+                    cmdp->u.cache64.sg_lst[0].sg_len = scp->request_bufflen;
+                    cmdp->u.cache64.sg_lst[1].sg_len = 0;
+                } else {
+                    cmdp->u.cache64.DestAddr  = phys_addr;
+                    cmdp->u.cache64.sg_canz= 0;
+                }
             } else {
-                cmdp->u.cache.DestAddr  = phys_addr;
-                cmdp->u.cache.sg_canz= 0;
+                if (ha->cache_feat & SCATTER_GATHER) {
+                    cmdp->u.cache.DestAddr = 0xffffffff;
+                    cmdp->u.cache.sg_canz = 1;
+                    cmdp->u.cache.sg_lst[0].sg_ptr = phys_addr;
+                    cmdp->u.cache.sg_lst[0].sg_len = scp->request_bufflen;
+                    cmdp->u.cache.sg_lst[1].sg_len = 0;
+                } else {
+                    cmdp->u.cache.DestAddr  = phys_addr;
+                    cmdp->u.cache.sg_canz= 0;
+                }
             }
         }
     }
-    TRACE(("cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
-           cmdp->u.cache.DestAddr,cmdp->u.cache.sg_canz,
-           cmdp->u.cache.sg_lst[0].sg_ptr,
-           cmdp->u.cache.sg_lst[0].sg_len));
-    TRACE(("cache cmd: cmd %d blockno. %d, blockcnt %d\n",
-           cmdp->OpCode,cmdp->u.cache.BlockNo,cmdp->u.cache.BlockCnt));
-
     /* evaluate command size, check space */
-    ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) +
-        (ushort)cmdp->u.cache.sg_canz * sizeof(gdth_sg_str);
+    if (mode64) {
+        TRACE(("cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
+               cmdp->u.cache64.DestAddr,cmdp->u.cache64.sg_canz,
+               cmdp->u.cache64.sg_lst[0].sg_ptr,
+               cmdp->u.cache64.sg_lst[0].sg_len));
+        TRACE(("cache cmd: cmd %d blockno. %d, blockcnt %d\n",
+               cmdp->OpCode,cmdp->u.cache64.BlockNo,cmdp->u.cache64.BlockCnt));
+        ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache64.sg_lst) +
+            (ushort)cmdp->u.cache64.sg_canz * sizeof(gdth_sg64_str);
+    } else {
+        TRACE(("cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
+               cmdp->u.cache.DestAddr,cmdp->u.cache.sg_canz,
+               cmdp->u.cache.sg_lst[0].sg_ptr,
+               cmdp->u.cache.sg_lst[0].sg_len));
+        TRACE(("cache cmd: cmd %d blockno. %d, blockcnt %d\n",
+               cmdp->OpCode,cmdp->u.cache.BlockNo,cmdp->u.cache.BlockCnt));
+        ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) +
+            (ushort)cmdp->u.cache.sg_canz * sizeof(gdth_sg_str);
+    }
     if (ha->cmd_len & 3)
         ha->cmd_len += (4 - (ha->cmd_len & 3));
 
@@ -3043,12 +3113,16 @@
     register gdth_cmd_str *cmdp;
     struct scatterlist *sl;
     ushort i;
-    ulong32 phys_addr, sense_paddr;
-    int cmd_index, sgcnt;
+    dma_addr_t phys_addr, sense_paddr;
+    int cmd_index, sgcnt, mode64;
     unchar t,l;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
+    struct page *page;
+    ulong offset;
+#endif
 
     ha = HADATA(gdth_ctr_tab[hanum]);
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     t = scp->device->id;
     l = scp->device->lun;
 #else
@@ -3062,6 +3136,8 @@
     if (ha->type==GDT_EISA && ha->cmd_cnt>0) 
         return 0;
 
+    mode64 = (ha->raw_feat & GDT_64BIT) ? TRUE : FALSE;
+
     cmdp->Service = SCSIRAWSERVICE;
     cmdp->RequestBuffer = scp;
     /* search free command index */
@@ -3077,95 +3153,176 @@
     if (scp->SCp.sent_command != -1) {
         cmdp->OpCode           = scp->SCp.sent_command; /* special raw cmd. */
         cmdp->BoardNode        = LOCALBOARD;
-        cmdp->u.raw.direction  = (scp->SCp.phase >> 8);
-        TRACE2(("special raw cmd 0x%x param 0x%x\n", 
-                cmdp->OpCode, cmdp->u.raw.direction));
+        if (mode64) {
+            cmdp->u.raw64.direction = (scp->SCp.phase >> 8);
+            TRACE2(("special raw cmd 0x%x param 0x%x\n", 
+                    cmdp->OpCode, cmdp->u.raw64.direction));
+            /* evaluate command size */
+            ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst);
+        } else {
+            cmdp->u.raw.direction  = (scp->SCp.phase >> 8);
+            TRACE2(("special raw cmd 0x%x param 0x%x\n", 
+                    cmdp->OpCode, cmdp->u.raw.direction));
+            /* evaluate command size */
+            ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst);
+        }
 
-        /* evaluate command size */
-        ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst);
     } else {
-#if LINUX_VERSION_CODE >= 0x020400
-        sense_paddr = pci_map_single(ha->pdev,scp->sense_buffer,
-                                     16,PCI_DMA_FROMDEVICE);
-        scp->SCp.buffer = (struct scatterlist *)sense_paddr;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
+        page = virt_to_page(scp->sense_buffer);
+        offset = (ulong)scp->sense_buffer & ~PAGE_MASK;
+        sense_paddr = pci_map_page(ha->pdev,page,offset,
+                                   16,PCI_DMA_FROMDEVICE);
+        scp->SCp.buffer = (struct scatterlist *)((ulong32)sense_paddr);
+        /* high part, if 64bit */
+        scp->host_scribble = (char *)(ulong32)((ulong64)sense_paddr >> 32);
 #else
         sense_paddr = virt_to_bus(scp->sense_buffer);
 #endif
         cmdp->OpCode           = GDT_WRITE;             /* always */
         cmdp->BoardNode        = LOCALBOARD;
-        cmdp->u.raw.reserved   = 0;
-        cmdp->u.raw.mdisc_time = 0;
-        cmdp->u.raw.mcon_time  = 0;
-        cmdp->u.raw.clen       = scp->cmd_len;
-        cmdp->u.raw.target     = t;
-        cmdp->u.raw.lun        = l;
-        cmdp->u.raw.bus        = b;
-        cmdp->u.raw.priority   = 0;
-        cmdp->u.raw.link_p     = 0;
-        cmdp->u.raw.sdlen      = scp->request_bufflen;
-        cmdp->u.raw.sense_len  = 16;
-        cmdp->u.raw.sense_data = sense_paddr;
-        cmdp->u.raw.direction  = 
-            gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
-        memcpy(cmdp->u.raw.cmd,scp->cmnd,12);
+        if (mode64) { 
+            cmdp->u.raw64.reserved   = 0;
+            cmdp->u.raw64.mdisc_time = 0;
+            cmdp->u.raw64.mcon_time  = 0;
+            cmdp->u.raw64.clen       = scp->cmd_len;
+            cmdp->u.raw64.target     = t;
+            cmdp->u.raw64.lun        = l;
+            cmdp->u.raw64.bus        = b;
+            cmdp->u.raw64.priority   = 0;
+            cmdp->u.raw64.sdlen      = scp->request_bufflen;
+            cmdp->u.raw64.sense_len  = 16;
+            cmdp->u.raw64.sense_data = sense_paddr;
+            cmdp->u.raw64.direction  = 
+                gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
+            memcpy(cmdp->u.raw64.cmd,scp->cmnd,16);
+        } else {
+            cmdp->u.raw.reserved   = 0;
+            cmdp->u.raw.mdisc_time = 0;
+            cmdp->u.raw.mcon_time  = 0;
+            cmdp->u.raw.clen       = scp->cmd_len;
+            cmdp->u.raw.target     = t;
+            cmdp->u.raw.lun        = l;
+            cmdp->u.raw.bus        = b;
+            cmdp->u.raw.priority   = 0;
+            cmdp->u.raw.link_p     = 0;
+            cmdp->u.raw.sdlen      = scp->request_bufflen;
+            cmdp->u.raw.sense_len  = 16;
+            cmdp->u.raw.sense_data = sense_paddr;
+            cmdp->u.raw.direction  = 
+                gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
+            memcpy(cmdp->u.raw.cmd,scp->cmnd,12);
+        }
 
         if (scp->use_sg) {
-            cmdp->u.raw.sdata  = 0xffffffff;
             sl = (struct scatterlist *)scp->request_buffer;
             sgcnt = scp->use_sg;
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
             scp->SCp.Status = GDTH_MAP_SG;
             scp->SCp.Message = PCI_DMA_BIDIRECTIONAL; 
             sgcnt = pci_map_sg(ha->pdev,sl,scp->use_sg,scp->SCp.Message);
-            for (i=0; i<sgcnt; ++i,++sl) {
-                cmdp->u.raw.sg_lst[i].sg_ptr = sg_dma_address(sl);
-                cmdp->u.raw.sg_lst[i].sg_len = sg_dma_len(sl);
+            if (mode64) {
+                cmdp->u.raw64.sdata = (ulong64)-1;
+                cmdp->u.raw64.sg_ranz = sgcnt;
+                for (i=0; i<sgcnt; ++i,++sl) {
+                    cmdp->u.raw64.sg_lst[i].sg_ptr = sg_dma_address(sl);
+#ifdef GDTH_DMA_STATISTICS
+                    if (cmdp->u.raw64.sg_lst[i].sg_ptr > (ulong64)0xffffffff)
+                        ha->dma64_cnt++;
+                    else
+                        ha->dma32_cnt++;
+#endif
+                    cmdp->u.raw64.sg_lst[i].sg_len = sg_dma_len(sl);
+                }
+            } else {
+                cmdp->u.raw.sdata = 0xffffffff;
+                cmdp->u.raw.sg_ranz = sgcnt;
+                for (i=0; i<sgcnt; ++i,++sl) {
+                    cmdp->u.raw.sg_lst[i].sg_ptr = sg_dma_address(sl);
+#ifdef GDTH_DMA_STATISTICS
+                    ha->dma32_cnt++;
+#endif
+                    cmdp->u.raw.sg_lst[i].sg_len = sg_dma_len(sl);
+                }
             }
 #else
-            for (i=0; i<sgcnt; ++i,++sl) {
-                cmdp->u.raw.sg_lst[i].sg_ptr = virt_to_bus(sl->address);
-                cmdp->u.raw.sg_lst[i].sg_len = (ulong32)sl->length;
+            if (mode64) {
+                cmdp->u.raw64.sdata = (ulong64)-1;
+                cmdp->u.raw64.sg_ranz = sgcnt;
+                for (i=0; i<sgcnt; ++i,++sl) {
+                    cmdp->u.raw64.sg_lst[i].sg_ptr = virt_to_bus(sl->address);
+                    cmdp->u.raw64.sg_lst[i].sg_len = (ulong32)sl->length;
+                }
+            } else {
+                cmdp->u.raw.sdata = 0xffffffff;
+                cmdp->u.raw.sg_ranz = sgcnt;
+                for (i=0; i<sgcnt; ++i,++sl) {
+                    cmdp->u.raw.sg_lst[i].sg_ptr = virt_to_bus(sl->address);
+                    cmdp->u.raw.sg_lst[i].sg_len = (ulong32)sl->length;
+                }
             }
 #endif
-            cmdp->u.raw.sg_ranz = (ulong32)i;
 
 #ifdef GDTH_STATISTICS
-            if (max_sg < (ulong32)i) {
-                max_sg = (ulong32)i;
-                TRACE3(("GDT: max_sg = %d\n",i));
+            if (max_sg < sgcnt) {
+                max_sg = sgcnt;
+                TRACE3(("GDT: max_sg = %d\n",sgcnt));
             }
 #endif
-            if (i<GDTH_MAXSG)
-                cmdp->u.raw.sg_lst[i].sg_len = 0;
+
         } else {
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
             scp->SCp.Status = GDTH_MAP_SINGLE;
             scp->SCp.Message = PCI_DMA_BIDIRECTIONAL; 
-            phys_addr = pci_map_single(ha->pdev,scp->request_buffer,
-                                       scp->request_bufflen,scp->SCp.Message);
+            page = virt_to_page(scp->request_buffer);
+            offset = (ulong)scp->request_buffer & ~PAGE_MASK;
+            phys_addr = pci_map_page(ha->pdev,page,offset,
+                                     scp->request_bufflen,scp->SCp.Message);
             scp->SCp.dma_handle = phys_addr;
 #else
             phys_addr = virt_to_bus(scp->request_buffer);
 #endif
-            if (ha->raw_feat & SCATTER_GATHER) {
-                cmdp->u.raw.sdata  = 0xffffffff;
-                cmdp->u.raw.sg_ranz= 1;
-                cmdp->u.raw.sg_lst[0].sg_ptr = phys_addr;
-                cmdp->u.raw.sg_lst[0].sg_len = scp->request_bufflen;
-                cmdp->u.raw.sg_lst[1].sg_len = 0;
+            if (mode64) {
+                if (ha->raw_feat & SCATTER_GATHER) {
+                    cmdp->u.raw64.sdata  = (ulong64)-1;
+                    cmdp->u.raw64.sg_ranz= 1;
+                    cmdp->u.raw64.sg_lst[0].sg_ptr = phys_addr;
+                    cmdp->u.raw64.sg_lst[0].sg_len = scp->request_bufflen;
+                    cmdp->u.raw64.sg_lst[1].sg_len = 0;
+                } else {
+                    cmdp->u.raw64.sdata  = phys_addr;
+                    cmdp->u.raw64.sg_ranz= 0;
+                }
             } else {
-                cmdp->u.raw.sdata  = phys_addr;
-                cmdp->u.raw.sg_ranz= 0;
+                if (ha->raw_feat & SCATTER_GATHER) {
+                    cmdp->u.raw.sdata  = 0xffffffff;
+                    cmdp->u.raw.sg_ranz= 1;
+                    cmdp->u.raw.sg_lst[0].sg_ptr = phys_addr;
+                    cmdp->u.raw.sg_lst[0].sg_len = scp->request_bufflen;
+                    cmdp->u.raw.sg_lst[1].sg_len = 0;
+                } else {
+                    cmdp->u.raw.sdata  = phys_addr;
+                    cmdp->u.raw.sg_ranz= 0;
+                }
             }
         }
-        TRACE(("raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
-               cmdp->u.raw.sdata,cmdp->u.raw.sg_ranz,
-               cmdp->u.raw.sg_lst[0].sg_ptr,
-               cmdp->u.raw.sg_lst[0].sg_len));
-
-        /* evaluate command size */
-        ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) +
-            (ushort)cmdp->u.raw.sg_ranz * sizeof(gdth_sg_str);
+        if (mode64) {
+            TRACE(("raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
+                   cmdp->u.raw64.sdata,cmdp->u.raw64.sg_ranz,
+                   cmdp->u.raw64.sg_lst[0].sg_ptr,
+                   cmdp->u.raw64.sg_lst[0].sg_len));
+            /* evaluate command size */
+            ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst) +
+                (ushort)cmdp->u.raw64.sg_ranz * sizeof(gdth_sg64_str);
+        } else {
+            TRACE(("raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x\n",
+                   cmdp->u.raw.sdata,cmdp->u.raw.sg_ranz,
+                   cmdp->u.raw.sg_lst[0].sg_ptr,
+                   cmdp->u.raw.sg_lst[0].sg_len));
+            /* evaluate command size */
+            ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) +
+                (ushort)cmdp->u.raw.sg_ranz * sizeof(gdth_sg_str);
+        }
     }
     /* check space */
     if (ha->cmd_len & 3)
@@ -3215,15 +3372,23 @@
     if (cmdp->OpCode == GDT_IOCTL) {
         TRACE2(("IOCTL\n"));
         ha->cmd_len = 
-            GDTOFFSOF(gdth_cmd_str,u.ioctl.p_param) + sizeof(ulong32);
+            GDTOFFSOF(gdth_cmd_str,u.ioctl.p_param) + sizeof(ulong64);
     } else if (cmdp->Service == CACHESERVICE) {
         TRACE2(("cache command %d\n",cmdp->OpCode));
-        ha->cmd_len = 
-            GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) + sizeof(gdth_sg_str);
+        if (ha->cache_feat & GDT_64BIT)
+            ha->cmd_len = 
+                GDTOFFSOF(gdth_cmd_str,u.cache64.sg_lst) + sizeof(gdth_sg64_str);
+        else
+            ha->cmd_len = 
+                GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) + sizeof(gdth_sg_str);
     } else if (cmdp->Service == SCSIRAWSERVICE) {
-        TRACE2(("raw command %d/%d\n",cmdp->OpCode,cmdp->u.raw.cmd[0]));
-        ha->cmd_len = 
-            GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) + sizeof(gdth_sg_str);
+        TRACE2(("raw command %d\n",cmdp->OpCode));
+        if (ha->raw_feat & GDT_64BIT)
+            ha->cmd_len = 
+                GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst) + sizeof(gdth_sg64_str);
+        else
+            ha->cmd_len = 
+                GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) + sizeof(gdth_sg_str);
     }
 
     if (ha->cmd_len & 3)
@@ -3355,7 +3520,7 @@
     GDTH_UNLOCK_HA(ha, flags);
 }
 
-static void gdth_clear_events()
+static void gdth_clear_events(void)
 {
     TRACE(("gdth_clear_events()"));
 
@@ -3366,10 +3531,14 @@
 
 /* SCSI interface functions */
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static irqreturn_t gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs)
+#else
+static void gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs)
+#endif
 {
     register gdth_ha_str *ha;
-    gdt6m_dpram_str *dp6m_ptr;
+    gdt6m_dpram_str *dp6m_ptr = NULL;
     gdt6_dpram_str *dp6_ptr;
     gdt2_dpram_str *dp2_ptr;
     Scsi_Cmnd *scp;
@@ -3377,13 +3546,23 @@
     unchar IStatus;
     ushort Service;
     ulong flags = 0;
+#ifdef INT_COAL
+    int coalesced = FALSE;
+    int next = FALSE;
+    gdth_coal_status *pcs = NULL;
+    int act_int_coal = 0;       
+#endif
 
     TRACE(("gdth_interrupt() IRQ %d\n",irq));
 
     /* if polling and not from gdth_wait() -> return */
     if (gdth_polling) {
         if (!gdth_from_wait) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
             return IRQ_HANDLED;
+#else
+            return;             
+#endif
         }
     }
 
@@ -3396,174 +3575,261 @@
         /* spurious interrupt */
         if (!gdth_polling)
             GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
-        return IRQ_HANDLED;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            return IRQ_HANDLED;
+#else
+            return;             
+#endif
     }
+    ha = HADATA(gdth_ctr_tab[hanum]);
 
 #ifdef GDTH_STATISTICS
     ++act_ints;
 #endif
-    
-    ha = HADATA(gdth_ctr_tab[hanum]);
-    if (ha->type == GDT_EISA) {
-        if (IStatus & 0x80) {                       /* error flag */
-            IStatus &= ~0x80;
-            ha->status = inw(ha->bmic + MAILBOXREG+8);
-            TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
-        } else                                      /* no error */
-            ha->status = S_OK;
-        ha->info = inl(ha->bmic + MAILBOXREG+12);
-        ha->service = inw(ha->bmic + MAILBOXREG+10);
-        ha->info2 = inl(ha->bmic + MAILBOXREG+4);
 
-        outb(0xff, ha->bmic + EDOORREG);            /* acknowledge interrupt */
-        outb(0x00, ha->bmic + SEMA1REG);            /* reset status semaphore */
-    } else if (ha->type == GDT_ISA) {
-        dp2_ptr = (gdt2_dpram_str *)ha->brd;
-        if (IStatus & 0x80) {                       /* error flag */
-            IStatus &= ~0x80;
-            ha->status = gdth_readw(&dp2_ptr->u.ic.Status);
-            TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
-        } else                                      /* no error */
-            ha->status = S_OK;
-        ha->info = gdth_readl(&dp2_ptr->u.ic.Info[0]);
-        ha->service = gdth_readw(&dp2_ptr->u.ic.Service);
-        ha->info2 = gdth_readl(&dp2_ptr->u.ic.Info[1]);
-
-        gdth_writeb(0xff, &dp2_ptr->io.irqdel);     /* acknowledge interrupt */
-        gdth_writeb(0, &dp2_ptr->u.ic.Cmd_Index);   /* reset command index */
-        gdth_writeb(0, &dp2_ptr->io.Sema1);         /* reset status semaphore */
-    } else if (ha->type == GDT_PCI) {
-        dp6_ptr = (gdt6_dpram_str *)ha->brd;
-        if (IStatus & 0x80) {                       /* error flag */
-            IStatus &= ~0x80;
-            ha->status = gdth_readw(&dp6_ptr->u.ic.Status);
-            TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
-        } else                                      /* no error */
-            ha->status = S_OK;
-        ha->info = gdth_readl(&dp6_ptr->u.ic.Info[0]);
-        ha->service = gdth_readw(&dp6_ptr->u.ic.Service);
-        ha->info2 = gdth_readl(&dp6_ptr->u.ic.Info[1]);
-
-        gdth_writeb(0xff, &dp6_ptr->io.irqdel);     /* acknowledge interrupt */
-        gdth_writeb(0, &dp6_ptr->u.ic.Cmd_Index);   /* reset command index */
-        gdth_writeb(0, &dp6_ptr->io.Sema1);         /* reset status semaphore */
-    } else if (ha->type == GDT_PCINEW) {
-        if (IStatus & 0x80) {                       /* error flag */
-            IStatus &= ~0x80;
-            ha->status = inw(PTR2USHORT(&ha->plx->status));
-            TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
-        } else
-            ha->status = S_OK;
-        ha->info = inl(PTR2USHORT(&ha->plx->info[0]));
-        ha->service = inw(PTR2USHORT(&ha->plx->service));
-        ha->info2 = inl(PTR2USHORT(&ha->plx->info[1]));
-
-        outb(0xff, PTR2USHORT(&ha->plx->edoor_reg)); 
-        outb(0x00, PTR2USHORT(&ha->plx->sema1_reg)); 
-    } else if (ha->type == GDT_PCIMPR) {
-        dp6m_ptr = (gdt6m_dpram_str *)ha->brd;
-        if (IStatus & 0x80) {                       /* error flag */
-            IStatus &= ~0x80;
-            ha->status = gdth_readw(&dp6m_ptr->i960r.status);
-            TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
-        } else                                      /* no error */
-            ha->status = S_OK;
-        ha->info = gdth_readl(&dp6m_ptr->i960r.info[0]);
-        ha->service = gdth_readw(&dp6m_ptr->i960r.service);
-        ha->info2 = gdth_readl(&dp6m_ptr->i960r.info[1]);
+#ifdef INT_COAL
+    /* See if the fw is returning coalesced status */
+    if (IStatus == COALINDEX) {
+        /* Coalesced status.  Setup the initial status 
+           buffer pointer and flags */
+        pcs = ha->coal_stat;
+        coalesced = TRUE;        
+        next = TRUE;
+    }
 
-        /* event string */
-        if (IStatus == ASYNCINDEX) {
-            if (ha->service != SCREENSERVICE &&
-                (ha->fw_vers & 0xff) >= 0x1a) {
-                ha->dvr.severity =   
-                    gdth_readb(&((gdt6m_dpram_str *)ha->brd)->i960r.severity);
-                for (i = 0; i < 256; ++i) {
-                    ha->dvr.event_string[i] = gdth_readb
-                        (&((gdt6m_dpram_str *)ha->brd)->i960r.evt_str[i]);
-                    if (ha->dvr.event_string[i] == 0)
-                        break;
+    do {
+        if (coalesced) {
+            /* For coalesced requests all status
+               information is found in the status buffer */
+            IStatus = (unchar)(pcs->status & 0xff);
+        }
+#endif
+    
+        if (ha->type == GDT_EISA) {
+            if (IStatus & 0x80) {                       /* error flag */
+                IStatus &= ~0x80;
+                ha->status = inw(ha->bmic + MAILBOXREG+8);
+                TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
+            } else                                      /* no error */
+                ha->status = S_OK;
+            ha->info = inl(ha->bmic + MAILBOXREG+12);
+            ha->service = inw(ha->bmic + MAILBOXREG+10);
+            ha->info2 = inl(ha->bmic + MAILBOXREG+4);
+
+            outb(0xff, ha->bmic + EDOORREG);    /* acknowledge interrupt */
+            outb(0x00, ha->bmic + SEMA1REG);    /* reset status semaphore */
+        } else if (ha->type == GDT_ISA) {
+            dp2_ptr = (gdt2_dpram_str *)ha->brd;
+            if (IStatus & 0x80) {                       /* error flag */
+                IStatus &= ~0x80;
+                ha->status = gdth_readw(&dp2_ptr->u.ic.Status);
+                TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
+            } else                                      /* no error */
+                ha->status = S_OK;
+            ha->info = gdth_readl(&dp2_ptr->u.ic.Info[0]);
+            ha->service = gdth_readw(&dp2_ptr->u.ic.Service);
+            ha->info2 = gdth_readl(&dp2_ptr->u.ic.Info[1]);
+
+            gdth_writeb(0xff, &dp2_ptr->io.irqdel); /* acknowledge interrupt */
+            gdth_writeb(0, &dp2_ptr->u.ic.Cmd_Index);/* reset command index */
+            gdth_writeb(0, &dp2_ptr->io.Sema1);     /* reset status semaphore */
+        } else if (ha->type == GDT_PCI) {
+            dp6_ptr = (gdt6_dpram_str *)ha->brd;
+            if (IStatus & 0x80) {                       /* error flag */
+                IStatus &= ~0x80;
+                ha->status = gdth_readw(&dp6_ptr->u.ic.Status);
+                TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
+            } else                                      /* no error */
+                ha->status = S_OK;
+            ha->info = gdth_readl(&dp6_ptr->u.ic.Info[0]);
+            ha->service = gdth_readw(&dp6_ptr->u.ic.Service);
+            ha->info2 = gdth_readl(&dp6_ptr->u.ic.Info[1]);
+
+            gdth_writeb(0xff, &dp6_ptr->io.irqdel); /* acknowledge interrupt */
+            gdth_writeb(0, &dp6_ptr->u.ic.Cmd_Index);/* reset command index */
+            gdth_writeb(0, &dp6_ptr->io.Sema1);     /* reset status semaphore */
+        } else if (ha->type == GDT_PCINEW) {
+            if (IStatus & 0x80) {                       /* error flag */
+                IStatus &= ~0x80;
+                ha->status = inw(PTR2USHORT(&ha->plx->status));
+                TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
+            } else
+                ha->status = S_OK;
+            ha->info = inl(PTR2USHORT(&ha->plx->info[0]));
+            ha->service = inw(PTR2USHORT(&ha->plx->service));
+            ha->info2 = inl(PTR2USHORT(&ha->plx->info[1]));
+
+            outb(0xff, PTR2USHORT(&ha->plx->edoor_reg)); 
+            outb(0x00, PTR2USHORT(&ha->plx->sema1_reg)); 
+        } else if (ha->type == GDT_PCIMPR) {
+            dp6m_ptr = (gdt6m_dpram_str *)ha->brd;
+            if (IStatus & 0x80) {                       /* error flag */
+                IStatus &= ~0x80;
+#ifdef INT_COAL
+                if (coalesced)
+                    ha->status = pcs->ext_status && 0xffff;
+                else 
+#endif
+                    ha->status = gdth_readw(&dp6m_ptr->i960r.status);
+                TRACE2(("gdth_interrupt() error %d/%d\n",IStatus,ha->status));
+            } else                                      /* no error */
+                ha->status = S_OK;
+#ifdef INT_COAL
+            /* get information */
+            if (coalesced) {    
+                ha->info = pcs->info0;
+                ha->info2 = pcs->info1;
+                ha->service = (pcs->ext_status >> 16) && 0xffff;
+            } else
+#endif
+            {
+                ha->info = gdth_readl(&dp6m_ptr->i960r.info[0]);
+                ha->service = gdth_readw(&dp6m_ptr->i960r.service);
+                ha->info2 = gdth_readl(&dp6m_ptr->i960r.info[1]);
+            }
+            /* event string */
+            if (IStatus == ASYNCINDEX) {
+                if (ha->service != SCREENSERVICE &&
+                    (ha->fw_vers & 0xff) >= 0x1a) {
+                    ha->dvr.severity = gdth_readb
+                        (&((gdt6m_dpram_str *)ha->brd)->i960r.severity);
+                    for (i = 0; i < 256; ++i) {
+                        ha->dvr.event_string[i] = gdth_readb
+                            (&((gdt6m_dpram_str *)ha->brd)->i960r.evt_str[i]);
+                        if (ha->dvr.event_string[i] == 0)
+                            break;
+                    }
                 }
             }
+#ifdef INT_COAL
+            /* Make sure that non coalesced interrupts get cleared
+               before being handled by gdth_async_event/gdth_sync_event */
+            if (!coalesced)
+#endif                          
+            {
+                gdth_writeb(0xff, &dp6m_ptr->i960r.edoor_reg);
+                gdth_writeb(0, &dp6m_ptr->i960r.sema1_reg);
+            }
+        } else {
+            TRACE2(("gdth_interrupt() unknown controller type\n"));
+            if (!gdth_polling)
+                GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            return IRQ_HANDLED;
+#else
+            return;             
+#endif
         }
-        gdth_writeb(0xff, &dp6m_ptr->i960r.edoor_reg);
-        gdth_writeb(0, &dp6m_ptr->i960r.sema1_reg);
-    } else {
-        TRACE2(("gdth_interrupt() unknown controller type\n"));
-        if (!gdth_polling)
-            GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
-        return IRQ_HANDLED;
-    }
 
-    TRACE(("gdth_interrupt() index %d stat %d info %d\n",
-           IStatus,ha->status,ha->info));
+        TRACE(("gdth_interrupt() index %d stat %d info %d\n",
+               IStatus,ha->status,ha->info));
 
-    if (gdth_from_wait) {
-        wait_hanum = hanum;
-        wait_index = (int)IStatus;
-    }
+        if (gdth_from_wait) {
+            wait_hanum = hanum;
+            wait_index = (int)IStatus;
+        }
 
-    if (IStatus == ASYNCINDEX) {
-        TRACE2(("gdth_interrupt() async. event\n"));
-        gdth_async_event(hanum);
-        if (!gdth_polling)
-            GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
-        gdth_next(hanum);
-        return IRQ_HANDLED;
-    } 
+        if (IStatus == ASYNCINDEX) {
+            TRACE2(("gdth_interrupt() async. event\n"));
+            gdth_async_event(hanum);
+            if (!gdth_polling)
+                GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
+            gdth_next(hanum);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            return IRQ_HANDLED;
+#else
+            return;             
+#endif
+        } 
 
-    if (IStatus == SPEZINDEX) {
-        TRACE2(("Service unknown or not initialized !\n"));
-        ha->dvr.size = sizeof(ha->dvr.eu.driver);
-        ha->dvr.eu.driver.ionode = hanum;
-        gdth_store_event(ha, ES_DRIVER, 4, &ha->dvr);
-        if (!gdth_polling)
-            GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
-        return IRQ_HANDLED;
-    }
-    scp     = ha->cmd_tab[IStatus-2].cmnd;
-    Service = ha->cmd_tab[IStatus-2].service;
-    ha->cmd_tab[IStatus-2].cmnd = UNUSED_CMND;
-    if (scp == UNUSED_CMND) {
-        TRACE2(("gdth_interrupt() index to unused command (%d)\n",IStatus));
-        ha->dvr.size = sizeof(ha->dvr.eu.driver);
-        ha->dvr.eu.driver.ionode = hanum;
-        ha->dvr.eu.driver.index = IStatus;
-        gdth_store_event(ha, ES_DRIVER, 1, &ha->dvr);
-        if (!gdth_polling)
-            GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
-        return IRQ_HANDLED;
-    }
-    if (scp == INTERNAL_CMND) {
-        TRACE(("gdth_interrupt() answer to internal command\n"));
+        if (IStatus == SPEZINDEX) {
+            TRACE2(("Service unknown or not initialized !\n"));
+            ha->dvr.size = sizeof(ha->dvr.eu.driver);
+            ha->dvr.eu.driver.ionode = hanum;
+            gdth_store_event(ha, ES_DRIVER, 4, &ha->dvr);
+            if (!gdth_polling)
+                GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            return IRQ_HANDLED;
+#else
+            return;             
+#endif
+        }
+        scp     = ha->cmd_tab[IStatus-2].cmnd;
+        Service = ha->cmd_tab[IStatus-2].service;
+        ha->cmd_tab[IStatus-2].cmnd = UNUSED_CMND;
+        if (scp == UNUSED_CMND) {
+            TRACE2(("gdth_interrupt() index to unused command (%d)\n",IStatus));
+            ha->dvr.size = sizeof(ha->dvr.eu.driver);
+            ha->dvr.eu.driver.ionode = hanum;
+            ha->dvr.eu.driver.index = IStatus;
+            gdth_store_event(ha, ES_DRIVER, 1, &ha->dvr);
+            if (!gdth_polling)
+                GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            return IRQ_HANDLED;
+#else
+            return;             
+#endif
+        }
+        if (scp == INTERNAL_CMND) {
+            TRACE(("gdth_interrupt() answer to internal command\n"));
+            if (!gdth_polling)
+                GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            return IRQ_HANDLED;
+#else
+            return;             
+#endif
+        }
+
+        TRACE(("gdth_interrupt() sync. status\n"));
+        rval = gdth_sync_event(hanum,Service,IStatus,scp);
         if (!gdth_polling)
             GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
-        return IRQ_HANDLED;
-    }
-
-    TRACE(("gdth_interrupt() sync. status\n"));
-    rval = gdth_sync_event(hanum,Service,IStatus,scp);
-    if (!gdth_polling)
-        GDTH_UNLOCK_HA((gdth_ha_str *)dev_id,flags);
-    if (rval == 2) {
-        gdth_putq(hanum,scp,scp->SCp.this_residual);
-    } else if (rval == 1) {
-#if LINUX_VERSION_CODE >= 0x02053C
-        GDTH_LOCK_SCSI_DONE(scp->device->host, flags);
-        scp->scsi_done(scp);
-        GDTH_UNLOCK_SCSI_DONE(scp->device->host, flags);
-#elif LINUX_VERSION_CODE >= 0x020503
-        GDTH_LOCK_SCSI_DONE(scp->host, flags);
-        scp->scsi_done(scp);
-        GDTH_UNLOCK_SCSI_DONE(scp->host, flags);
-#else
-        GDTH_LOCK_SCSI_DONE(flags);
-        scp->scsi_done(scp);
-        GDTH_UNLOCK_SCSI_DONE(flags);
+        if (rval == 2) {
+            gdth_putq(hanum,scp,scp->SCp.this_residual);
+        } else if (rval == 1) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            GDTH_LOCK_SCSI_DONE(scp->device->host, flags);
+            scp->scsi_done(scp);
+            GDTH_UNLOCK_SCSI_DONE(scp->device->host, flags);
+#else
+            GDTH_LOCK_SCSI_DONE(flags);
+            scp->scsi_done(scp);
+            GDTH_UNLOCK_SCSI_DONE(flags);
 #endif
+        }
+
+#ifdef INT_COAL
+        if (coalesced) {
+            /* go to the next status in the status buffer */
+            ++pcs;
+#ifdef GDTH_STATISTICS
+            ++act_int_coal;
+            if (act_int_coal > max_int_coal) {
+                max_int_coal = act_int_coal;
+                printk("GDT: max_int_coal = %d\n",(ushort)max_int_coal);
+            }
+#endif      
+            /* see if there is another status */
+            if (pcs->status == 0)    
+                /* Stop the coalesce loop */
+                next = FALSE;
+        }
+    } while (next);
+
+    /* coalescing only for new GDT_PCIMPR controllers available */      
+    if (ha->type == GDT_PCIMPR && coalesced) {
+        gdth_writeb(0xff, &dp6m_ptr->i960r.edoor_reg);
+        gdth_writeb(0, &dp6m_ptr->i960r.sema1_reg);
     }
+#endif
+
     gdth_next(hanum);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     return IRQ_HANDLED;
+#endif
 }
 
 static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp)
@@ -3579,10 +3845,11 @@
            service,ha->status));
 
     if (service == SCREENSERVICE) {
-        msg  = (gdth_msg_str *)ha->pscratch;
-        ha->scratch_busy = FALSE;
+        msg  = ha->pmsg;
         TRACE(("len: %d, answer: %d, ext: %d, alen: %d\n",
                msg->msg_len,msg->msg_answer,msg->msg_ext,msg->msg_alen));
+        if (msg->msg_len > MSGLEN+1)
+            msg->msg_len = MSGLEN+1;
         if (msg->msg_len)
             if (!(msg->msg_answer && msg->msg_ext)) {
                 msg->msg_text[msg->msg_len] = '\0';
@@ -3600,11 +3867,10 @@
             cmdp->BoardNode     = LOCALBOARD;
             cmdp->u.screen.reserved  = 0;
             cmdp->u.screen.su.msg.msg_handle= msg->msg_handle;
-            cmdp->u.screen.su.msg.msg_addr  = ha->scratch_phys;
-            ha->scratch_busy = TRUE;
+            cmdp->u.screen.su.msg.msg_addr  = ha->msg_phys;
             ha->cmd_offs_dpmem = 0;
             ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) 
-                + sizeof(ulong32);
+                + sizeof(ulong64);
             ha->cmd_cnt = 0;
             gdth_copy_command(hanum);
             gdth_release_event(hanum);
@@ -3635,11 +3901,10 @@
             cmdp->BoardNode     = LOCALBOARD;
             cmdp->u.screen.reserved  = 0;
             cmdp->u.screen.su.msg.msg_handle= msg->msg_handle;
-            cmdp->u.screen.su.msg.msg_addr  = ha->scratch_phys;
-            ha->scratch_busy = TRUE;
+            cmdp->u.screen.su.msg.msg_addr  = ha->msg_phys;
             ha->cmd_offs_dpmem = 0;
             ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) 
-                + sizeof(ulong32);
+                + sizeof(ulong64);
             ha->cmd_cnt = 0;
             gdth_copy_command(hanum);
             gdth_release_event(hanum);
@@ -3648,7 +3913,7 @@
         printk("\n");
 
     } else {
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
         t = scp->device->id;
 #else
@@ -3666,16 +3931,20 @@
             /* retry */
             return 2;
         }
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
         if (scp->SCp.Status == GDTH_MAP_SG) 
             pci_unmap_sg(ha->pdev,scp->request_buffer,
                          scp->use_sg,scp->SCp.Message);
         else if (scp->SCp.Status == GDTH_MAP_SINGLE) 
-            pci_unmap_single(ha->pdev,scp->SCp.dma_handle,
-                         scp->request_bufflen,scp->SCp.Message);
-        if (scp->SCp.buffer) 
-            pci_unmap_single(ha->pdev,(dma_addr_t)scp->SCp.buffer,
-						16,PCI_DMA_FROMDEVICE);
+            pci_unmap_page(ha->pdev,scp->SCp.dma_handle,
+                           scp->request_bufflen,scp->SCp.Message);
+        if (scp->SCp.buffer) {
+            dma_addr_t addr;
+            addr = (dma_addr_t)(ulong32)scp->SCp.buffer;
+            if (scp->host_scribble)
+                addr += (dma_addr_t)((ulong64)(ulong32)scp->host_scribble << 32);               
+            pci_unmap_page(ha->pdev,addr,16,PCI_DMA_FROMDEVICE);
+        }
 #endif
         if (ha->status == S_OK) {
             scp->SCp.Status = S_OK;
@@ -3754,10 +4023,7 @@
                     scp->sense_buffer[2] = NOT_READY;
                     scp->result = (DID_OK << 16) | (CHECK_CONDITION << 1);
                 }
-#if LINUX_VERSION_CODE >= 0x010300
-                if (scp->done != gdth_scsi_done)
-#endif  
-                {
+                if (scp->done != gdth_scsi_done) {
                     ha->dvr.size = sizeof(ha->dvr.eu.sync);
                     ha->dvr.eu.sync.ionode  = hanum;
                     ha->dvr.eu.sync.service = service;
@@ -3946,13 +4212,11 @@
 static int gdth_async_event(int hanum)
 {
     gdth_ha_str *ha;
-    gdth_msg_str *msg;
     gdth_cmd_str *cmdp;
     int cmd_index;
 
     ha  = HADATA(gdth_ctr_tab[hanum]);
     cmdp= ha->pccb;
-    msg = (gdth_msg_str *)ha->pscratch;
     TRACE2(("gdth_async_event() ha %d serv %d\n",
             hanum,ha->service));
 
@@ -3968,11 +4232,10 @@
             cmdp->BoardNode     = LOCALBOARD;
             cmdp->u.screen.reserved  = 0;
             cmdp->u.screen.su.msg.msg_handle= MSG_INV_HANDLE;
-            cmdp->u.screen.su.msg.msg_addr  = ha->scratch_phys;
-            ha->scratch_busy = TRUE;
+            cmdp->u.screen.su.msg.msg_addr  = ha->msg_phys;
             ha->cmd_offs_dpmem = 0;
             ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) 
-                + sizeof(ulong32);
+                + sizeof(ulong64);
             ha->cmd_cnt = 0;
             gdth_copy_command(hanum);
             if (ha->type == GDT_EISA)
@@ -4192,10 +4455,11 @@
 GDTH_INITFUNC(int, gdth_detect(Scsi_Host_Template *shtp))
 {
     struct Scsi_Host *shp;
+    gdth_pci_str pcistr[MAXHA];
     gdth_ha_str *ha;
     ulong32 isa_bios;
     ushort eisa_slot;
-    int i,hanum,cnt,ctr;
+    int i,hanum,cnt,ctr,err;
     unchar b;
     
  
@@ -4218,11 +4482,11 @@
     TRACE(("gdth_detect()\n"));
 
     if (disable) {
-        printk("GDT: Controller driver disabled from command line !\n");
+        printk("GDT-HA: Controller driver disabled from command line !\n");
         return 0;
     }
 
-    printk("GDT: Storage RAID Controller Driver. Version: %s \n",GDTH_VERSION_STR);
+    printk("GDT-HA: Storage RAID Controller Driver. Version: %s \n",GDTH_VERSION_STR);
     /* initializations */
     gdth_polling = TRUE; b = 0;
     gdth_clear_events();
@@ -4232,6 +4496,7 @@
         /* scanning for controllers, at first: ISA controller */
         for (isa_bios=0xc8000UL; isa_bios<=0xd8000UL; isa_bios+=0x8000UL) {
             dma_addr_t scratch_dma_handle;
+            scratch_dma_handle = 0;
 
             if (gdth_ctr_count >= MAXHA) 
                 break;
@@ -4252,23 +4517,14 @@
                 printk("Configuring GDT-ISA HA at BIOS 0x%05X IRQ %u DRQ %u\n",
                        isa_bios,ha->irq,ha->drq);
 
-#if LINUX_VERSION_CODE >= 0x010346 
-                if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth",ha))
-#else
-                if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth")) 
-#endif
-                {
+                if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth",ha)) {
                     printk("GDT-ISA: Unable to allocate IRQ\n");
                     scsi_unregister(shp);
                     continue;
                 }
                 if (request_dma(ha->drq,"gdth")) {
                     printk("GDT-ISA: Unable to allocate DMA channel\n");
-#if LINUX_VERSION_CODE >= 0x010346 
                     free_irq(ha->irq,ha);
-#else
-                    free_irq(ha->irq);
-#endif
                     scsi_unregister(shp);
                     continue;
                 }
@@ -4286,15 +4542,34 @@
 
                 ha->pccb = CMDDATA(shp);
                 ha->ccb_phys = 0L;
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
                 ha->pdev = NULL;
                 ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, 
                                                     &scratch_dma_handle);
-                ha->scratch_phys = (ulong32)scratch_dma_handle;
+                ha->scratch_phys = scratch_dma_handle;
+                ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), 
+                                                &scratch_dma_handle);
+                ha->msg_phys = scratch_dma_handle;
+#ifdef INT_COAL
+                ha->coal_stat = (gdth_coal_status *)
+                    pci_alloc_consistent(ha->pdev, sizeof(gdth_coal_status) *
+                        MAXOFFSETS, &scratch_dma_handle);
+                ha->coal_stat_phys = scratch_dma_handle;
+#endif
 #else
                 ha->pscratch = scsi_init_malloc(GDTH_SCRATCH, GFP_ATOMIC | GFP_DMA);
                 if (ha->pscratch)
                     ha->scratch_phys = virt_to_bus(ha->pscratch);
+                ha->pmsg = scsi_init_malloc(sizeof(gdth_msg_str), GFP_ATOMIC | GFP_DMA);
+                if (ha->pmsg)
+                    ha->msg_phys = virt_to_bus(ha->pmsg);
+#ifdef INT_COAL
+                ha->coal_stat = 
+                    scsi_init_malloc(sizeof(gdth_coal_status) * MAXOFFSETS, 
+                                     GFP_ATOMIC | GFP_DMA);
+                if (ha->coal_stat)
+                    ha->coal_stat_phys = virt_to_bus(ha->coal_stat);
+#endif
 #endif
                 ha->scratch_busy = FALSE;
                 ha->req_first = NULL;
@@ -4305,23 +4580,36 @@
                     ha->cmd_tab[i].cmnd = UNUSED_CMND;
                 ha->scan_mode = rescan ? 0x10 : 0;
 
-                if (ha->pscratch == NULL || !gdth_search_drives(hanum)) {
+                if (ha->pscratch == NULL || ha->pmsg == NULL || 
+                    !gdth_search_drives(hanum)) {
                     printk("GDT-ISA: Error during device scan\n");
                     --gdth_ctr_count;
                     --gdth_ctr_vcount;
-                    if (ha->pscratch != NULL) {
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+#ifdef INT_COAL
+                    if (ha->coal_stat)
+                        pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) *
+                                            MAXOFFSETS, ha->coal_stat,
+                                            ha->coal_stat_phys);
+#endif
+                    if (ha->pscratch)
                         pci_free_consistent(ha->pdev, GDTH_SCRATCH, 
                                             ha->pscratch, ha->scratch_phys);
-#else
+                    if (ha->pmsg)
+                        pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), 
+                                            ha->pmsg, ha->msg_phys);
+#else
+#ifdef INT_COAL
+                    if (ha->coal_stat)
+                        scsi_init_free((void *)ha->coal_stat, 
+                                       sizeof(gdth_coal_status) * MAXOFFSETS);
+#endif
+                    if (ha->pscratch)
                         scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH);
+                    if (ha->pmsg)
+                        scsi_init_free((void *)ha->pmsg, sizeof(gdth_msg_str));
 #endif
-                    }
-#if LINUX_VERSION_CODE >= 0x010346 
                     free_irq(ha->irq,ha);
-#else
-                    free_irq(ha->irq);
-#endif
                     scsi_unregister(shp);
                     continue;
                 }
@@ -4329,13 +4617,18 @@
                     hdr_channel = ha->bus_cnt;
                 ha->virt_bus = hdr_channel;
 
-#if LINUX_VERSION_CODE >= 0x020000
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) && \
+    LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+                shp->highmem_io  = 0;
+#endif
+                if (ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) 
+                    shp->max_cmd_len = 16;
+#endif
                 shp->max_id      = ha->tid_cnt;
                 shp->max_lun     = MAXLUN;
                 shp->max_channel = virt_ctr ? 0 : ha->bus_cnt;
-                if (virt_ctr)  
-#endif
-                {
+                if (virt_ctr) {
                     virt_ctr = 1;
                     /* register addit. SCSI channels as virtual controllers */
                     for (b = 1; b < ha->bus_cnt + 1; ++b) {
@@ -4358,6 +4651,7 @@
         /* scanning for EISA controllers */
         for (eisa_slot=0x1000; eisa_slot<=0x8000; eisa_slot+=0x1000) {
             dma_addr_t scratch_dma_handle;
+            scratch_dma_handle = 0;
 
             if (gdth_ctr_count >= MAXHA) 
                 break;
@@ -4373,14 +4667,9 @@
                 }
                 /* controller found and initialized */
                 printk("Configuring GDT-EISA HA at Slot %d IRQ %u\n",
-                        eisa_slot>>12,ha->irq);
+                       eisa_slot>>12,ha->irq);
 
-#if LINUX_VERSION_CODE >= 0x010346 
-                if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth",ha))
-#else
-                if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth")) 
-#endif
-                {
+                if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth",ha)) {
                     printk("GDT-EISA: Unable to allocate IRQ\n");
                     scsi_unregister(shp);
                     continue;
@@ -4399,11 +4688,20 @@
 
                 ha->pccb = CMDDATA(shp);
                 ha->ccb_phys = 0L; 
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
                 ha->pdev = NULL;
                 ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, 
                                                     &scratch_dma_handle);
-                ha->scratch_phys = (ulong32) scratch_dma_handle;
+                ha->scratch_phys = scratch_dma_handle;
+                ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), 
+                                                &scratch_dma_handle);
+                ha->msg_phys = scratch_dma_handle;
+#ifdef INT_COAL
+                ha->coal_stat = (gdth_coal_status *)
+                    pci_alloc_consistent(ha->pdev, sizeof(gdth_coal_status) *
+                                         MAXOFFSETS, &scratch_dma_handle);
+                ha->coal_stat_phys = scratch_dma_handle;
+#endif
                 ha->ccb_phys = 
                     pci_map_single(ha->pdev,ha->pccb,
                                    sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL);
@@ -4411,6 +4709,16 @@
                 ha->pscratch = scsi_init_malloc(GDTH_SCRATCH, GFP_ATOMIC | GFP_DMA);
                 if (ha->pscratch)
                     ha->scratch_phys = virt_to_bus(ha->pscratch);
+                ha->pmsg = scsi_init_malloc(sizeof(gdth_msg_str), GFP_ATOMIC | GFP_DMA);
+                if (ha->pmsg)
+                    ha->msg_phys = virt_to_bus(ha->pmsg);
+#ifdef INT_COAL
+                ha->coal_stat = 
+                    scsi_init_malloc(sizeof(gdth_coal_status) * MAXOFFSETS, 
+                                     GFP_ATOMIC | GFP_DMA);
+                if (ha->coal_stat)
+                    ha->coal_stat_phys = virt_to_bus(ha->coal_stat);
+#endif
                 ha->ccb_phys = virt_to_bus(ha->pccb);
 #endif
                 ha->scratch_busy = FALSE;
@@ -4419,28 +4727,42 @@
                 if (max_ids > 0 && max_ids < ha->tid_cnt)
                     ha->tid_cnt = max_ids;
                 for (i=0; i<GDTH_MAXCMDS; ++i)
-                     ha->cmd_tab[i].cmnd = UNUSED_CMND;
+                    ha->cmd_tab[i].cmnd = UNUSED_CMND;
                 ha->scan_mode = rescan ? 0x10 : 0;
 
-                if (ha->pscratch == NULL || !gdth_search_drives(hanum)) {
+                if (ha->pscratch == NULL || ha->pmsg == NULL || 
+                    !gdth_search_drives(hanum)) {
                     printk("GDT-EISA: Error during device scan\n");
                     --gdth_ctr_count;
                     --gdth_ctr_vcount;
-                    if (ha->pscratch != NULL) {
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+#ifdef INT_COAL
+                    if (ha->coal_stat)
+                        pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) *
+                                            MAXOFFSETS, ha->coal_stat,
+                                            ha->coal_stat_phys);
+#endif
+                    if (ha->pscratch)
                         pci_free_consistent(ha->pdev, GDTH_SCRATCH, 
                                             ha->pscratch, ha->scratch_phys);
+                    if (ha->pmsg)
+                        pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), 
+                                            ha->pmsg, ha->msg_phys);
+                    if (ha->ccb_phys)
                         pci_unmap_single(ha->pdev,ha->ccb_phys,
-                                         sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL);
+                                        sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL);
 #else
+#ifdef INT_COAL
+                    if (ha->coal_stat)
+                        scsi_init_free((void *)ha->coal_stat, 
+                                       sizeof(gdth_coal_status) * MAXOFFSETS);
+#endif
+                    if (ha->pscratch)
                         scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH);
+                    if (ha->pmsg)
+                        scsi_init_free((void *)ha->pmsg, sizeof(gdth_msg_str));
 #endif
-                    }
-#if LINUX_VERSION_CODE >= 0x010346 
                     free_irq(ha->irq,ha);
-#else
-                    free_irq(ha->irq);
-#endif
                     scsi_unregister(shp);
                     continue;
                 }
@@ -4448,13 +4770,18 @@
                     hdr_channel = ha->bus_cnt;
                 ha->virt_bus = hdr_channel;
 
-#if LINUX_VERSION_CODE >= 0x020000
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) && \
+    LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+                shp->highmem_io  = 0;
+#endif
+                if (ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) 
+                    shp->max_cmd_len = 16;
+#endif
                 shp->max_id      = ha->tid_cnt;
                 shp->max_lun     = MAXLUN;
                 shp->max_channel = virt_ctr ? 0 : ha->bus_cnt;
-                if (virt_ctr)  
-#endif
-                {
+                if (virt_ctr) {
                     virt_ctr = 1;
                     /* register addit. SCSI channels as virtual controllers */
                     for (b = 1; b < ha->bus_cnt + 1; ++b) {
@@ -4475,124 +4802,173 @@
     }
 
     /* scanning for PCI controllers */
-#if LINUX_VERSION_CODE < 0x2015C
-    if (pcibios_present())
-#endif
-    {
-        gdth_pci_str pcistr[MAXHA];
+    cnt = gdth_search_pci(pcistr);
+    printk("GDT-HA: Found %d PCI Storage RAID Controllers\n",cnt);
+    gdth_sort_pci(pcistr,cnt);
+    for (ctr = 0; ctr < cnt; ++ctr) {
+        dma_addr_t scratch_dma_handle;
+        scratch_dma_handle = 0;
 
-        cnt = gdth_search_pci(pcistr);
-        printk("GDT: Found %d PCI Storage RAID Controllers\n",cnt);
-        gdth_sort_pci(pcistr,cnt);
-        for (ctr = 0; ctr < cnt; ++ctr) {
-            dma_addr_t scratch_dma_handle;
+        if (gdth_ctr_count >= MAXHA)
+            break;
+        shp = scsi_register(shtp,sizeof(gdth_ext_str));
+        if (shp == NULL)
+            continue;  
+
+        ha = HADATA(shp);
+        if (!gdth_init_pci(&pcistr[ctr],ha)) {
+            scsi_unregister(shp);
+            continue;
+        }
+        /* controller found and initialized */
+        printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n",
+               pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq);
 
-            if (gdth_ctr_count >= MAXHA)
-                break;
-            shp = scsi_register(shtp,sizeof(gdth_ext_str));
-            if (shp == NULL)
-                continue;  
-
-            ha = HADATA(shp);
-            if (!gdth_init_pci(&pcistr[ctr],ha)) {
-                scsi_unregister(shp);
-                continue;
-            }
-            /* controller found and initialized */
-            printk("GDT CTR%d: Configuring GDT-PCI HA at %d/%d IRQ %u\n",
-                   ctr,pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq);
-
-#if LINUX_VERSION_CODE >= 0x010346 
-            if (request_irq(ha->irq, gdth_interrupt,
-                            SA_INTERRUPT|SA_SHIRQ, "gdth", ha))
-#else
-            if (request_irq(ha->irq, gdth_interrupt,
-                            SA_INTERRUPT|SA_SHIRQ, "gdth")) 
-#endif
-            {
-                printk("GDT-PCI: Unable to allocate IRQ\n");
-                scsi_unregister(shp);
-                continue;
-            }
-            shp->unchecked_isa_dma = 0;
-            shp->irq = ha->irq;
-            shp->dma_channel = 0xff;
-            hanum = gdth_ctr_count;
-            gdth_ctr_tab[gdth_ctr_count++] = shp;
-            gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
-
-            NUMDATA(shp)->hanum = (ushort)hanum;
-            NUMDATA(shp)->busnum= 0;
-
-            ha->pccb = CMDDATA(shp);
-            ha->ccb_phys = 0L;
-#if LINUX_VERSION_CODE >= 0x020400
-            ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, 
-                                                &scratch_dma_handle);
-            ha->scratch_phys = (ulong32)scratch_dma_handle;
-#else
-            ha->pscratch = scsi_init_malloc(GDTH_SCRATCH, GFP_ATOMIC | GFP_DMA);
-            if (ha->pscratch)
-                ha->scratch_phys = virt_to_bus(ha->pscratch);
-#endif
-            ha->scratch_busy = FALSE;
-            ha->req_first = NULL;
-            ha->tid_cnt = pcistr[ctr].device_id >= 0x200 ? MAXID : MAX_HDRIVES;
-            if (max_ids > 0 && max_ids < ha->tid_cnt)
-                ha->tid_cnt = max_ids;
-            for (i=0; i<GDTH_MAXCMDS; ++i)
-                ha->cmd_tab[i].cmnd = UNUSED_CMND;
-            ha->scan_mode = rescan ? 0x10 : 0;
-
-            if (ha->pscratch == NULL || !gdth_search_drives(hanum)) {
-                printk("GDT-PCI: Error during device scan\n");
-                --gdth_ctr_count;
-                --gdth_ctr_vcount;
-                if (ha->pscratch != NULL) {
-#if LINUX_VERSION_CODE >= 0x020400
-                    pci_free_consistent(ha->pdev, GDTH_SCRATCH, 
-                                        ha->pscratch, ha->scratch_phys);
-#else
-                    scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH);
+        if (request_irq(ha->irq, gdth_interrupt,
+                        SA_INTERRUPT|SA_SHIRQ, "gdth", ha))
+        {
+            printk("GDT-PCI: Unable to allocate IRQ\n");
+            scsi_unregister(shp);
+            continue;
+        }
+        shp->unchecked_isa_dma = 0;
+        shp->irq = ha->irq;
+        shp->dma_channel = 0xff;
+        hanum = gdth_ctr_count;
+        gdth_ctr_tab[gdth_ctr_count++] = shp;
+        gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
+
+        NUMDATA(shp)->hanum = (ushort)hanum;
+        NUMDATA(shp)->busnum= 0;
+
+        ha->pccb = CMDDATA(shp);
+        ha->ccb_phys = 0L;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, 
+                                            &scratch_dma_handle);
+        ha->scratch_phys = scratch_dma_handle;
+        ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), 
+                                        &scratch_dma_handle);
+        ha->msg_phys = scratch_dma_handle;
+#ifdef INT_COAL
+        ha->coal_stat = (gdth_coal_status *)
+            pci_alloc_consistent(ha->pdev, sizeof(gdth_coal_status) *
+                                 MAXOFFSETS, &scratch_dma_handle);
+        ha->coal_stat_phys = scratch_dma_handle;
+#endif
+#else
+        ha->pscratch = scsi_init_malloc(GDTH_SCRATCH, GFP_ATOMIC | GFP_DMA);
+        if (ha->pscratch)
+            ha->scratch_phys = virt_to_bus(ha->pscratch);
+        ha->pmsg = scsi_init_malloc(sizeof(gdth_msg_str), GFP_ATOMIC | GFP_DMA);
+        if (ha->pmsg)
+            ha->msg_phys = virt_to_bus(ha->pmsg);
+#ifdef INT_COAL
+        ha->coal_stat = 
+            scsi_init_malloc(sizeof(gdth_coal_status) * MAXOFFSETS, 
+                             GFP_ATOMIC | GFP_DMA);
+        if (ha->coal_stat)
+            ha->coal_stat_phys = virt_to_bus(ha->coal_stat);
 #endif
-                }
-#if LINUX_VERSION_CODE >= 0x010346 
-                free_irq(ha->irq,ha);
-#else
-                free_irq(ha->irq);
 #endif
-                scsi_unregister(shp);
-                continue;
-            }
+        ha->scratch_busy = FALSE;
+        ha->req_first = NULL;
+        ha->tid_cnt = pcistr[ctr].device_id >= 0x200 ? MAXID : MAX_HDRIVES;
+        if (max_ids > 0 && max_ids < ha->tid_cnt)
+            ha->tid_cnt = max_ids;
+        for (i=0; i<GDTH_MAXCMDS; ++i)
+            ha->cmd_tab[i].cmnd = UNUSED_CMND;
+        ha->scan_mode = rescan ? 0x10 : 0;
+
+        err = FALSE;
+        if (ha->pscratch == NULL || ha->pmsg == NULL || 
+            !gdth_search_drives(hanum)) {
+            err = TRUE;
+        } else {
             if (hdr_channel < 0 || hdr_channel > ha->bus_cnt)
                 hdr_channel = ha->bus_cnt;
             ha->virt_bus = hdr_channel;
 
-#if LINUX_VERSION_CODE >= 0x020000
-            shp->max_id      = ha->tid_cnt;
-            shp->max_lun     = MAXLUN;
-            shp->max_channel = virt_ctr ? 0 : ha->bus_cnt;
-            if (virt_ctr)  
-#endif
-            {
-                virt_ctr = 1;
-                /* register addit. SCSI channels as virtual controllers */
-                for (b = 1; b < ha->bus_cnt + 1; ++b) {
-                    shp = scsi_register(shtp,sizeof(gdth_num_str));
-                    shp->unchecked_isa_dma = 0;
-                    shp->irq = ha->irq;
-                    shp->dma_channel = 0xff;
-                    gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
-                    NUMDATA(shp)->hanum = (ushort)hanum;
-                    NUMDATA(shp)->busnum = b;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            scsi_set_device(shp, &pcistr[ctr].pdev->dev);
+#else
+            scsi_set_pci_device(shp, pcistr[ctr].pdev);
+#endif
+            if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat &GDT_64BIT)||
+                /* 64-bit DMA only supported from FW >= x.43 */
+                (!ha->dma64_support)) {
+                if (pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffff)) {
+                    printk(KERN_WARNING "GDT-PCI %d: Unable to set 32-bit DMA\n", hanum);
+                    err = TRUE;
                 }
-            }  
+            } else {
+                shp->max_cmd_len = 16;
+                if (!pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffffffffffffULL)) {
+                    printk("GDT-PCI %d: 64-bit DMA enabled\n", hanum);
+                } else if (pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffff)) {
+                    printk(KERN_WARNING "GDT-PCI %d: Unable to set 64/32-bit DMA\n", hanum);
+                    err = TRUE;
+                }
+            }
+#endif
+        }
 
-            GDTH_INIT_LOCK_HA(ha);
-            gdth_enable_int(hanum);
+        if (err) {
+            printk("GDT-PCI %d: Error during device scan\n", hanum);
+            --gdth_ctr_count;
+            --gdth_ctr_vcount;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+#ifdef INT_COAL
+            if (ha->coal_stat)
+                pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) *
+                                    MAXOFFSETS, ha->coal_stat,
+                                    ha->coal_stat_phys);
+#endif
+            if (ha->pscratch)
+                pci_free_consistent(ha->pdev, GDTH_SCRATCH, 
+                                    ha->pscratch, ha->scratch_phys);
+            if (ha->pmsg)
+                pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), 
+                                    ha->pmsg, ha->msg_phys);
+#else
+#ifdef INT_COAL
+            if (ha->coal_stat)
+                scsi_init_free((void *)ha->coal_stat, 
+                               sizeof(gdth_coal_status) * MAXOFFSETS);
+#endif
+            if (ha->pscratch)
+                scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH);
+            if (ha->pmsg)
+                scsi_init_free((void *)ha->pmsg, sizeof(gdth_msg_str));
+#endif
+            free_irq(ha->irq,ha);
+            scsi_unregister(shp);
+            continue;
         }
-    }
 
+        shp->max_id      = ha->tid_cnt;
+        shp->max_lun     = MAXLUN;
+        shp->max_channel = virt_ctr ? 0 : ha->bus_cnt;
+        if (virt_ctr) {
+            virt_ctr = 1;
+            /* register addit. SCSI channels as virtual controllers */
+            for (b = 1; b < ha->bus_cnt + 1; ++b) {
+                shp = scsi_register(shtp,sizeof(gdth_num_str));
+                shp->unchecked_isa_dma = 0;
+                shp->irq = ha->irq;
+                shp->dma_channel = 0xff;
+                gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
+                NUMDATA(shp)->hanum = (ushort)hanum;
+                NUMDATA(shp)->busnum = b;
+            }
+        }  
+
+
+        GDTH_INIT_LOCK_HA(ha);
+        gdth_enable_int(hanum);
+    }
+    
     TRACE2(("gdth_detect() %d controller detected\n",gdth_ctr_count));
     if (gdth_ctr_count > 0) {
 #ifdef GDTH_STATISTICS
@@ -4603,12 +4979,8 @@
         gdth_timer.function = gdth_timeout;
         add_timer(&gdth_timer);
 #endif
-#ifdef GDTH_IOCTL_CHRDEV
         major = register_chrdev(0,"gdth",&gdth_fops);
-#endif
-#if LINUX_VERSION_CODE >= 0x020100
         register_reboot_notifier(&gdth_notifier);
-#endif
     }
     gdth_polling = FALSE;
     return gdth_ctr_vcount;
@@ -4624,30 +4996,47 @@
     if (NUMDATA(shp)->busnum == 0) {
         hanum = NUMDATA(shp)->hanum;
         ha    = HADATA(gdth_ctr_tab[hanum]);
-#if LINUX_VERSION_CODE >= 0x010300
-        gdth_flush(hanum);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        if (ha->sdev) {
+            scsi_free_host_dev(ha->sdev);
+            ha->sdev = NULL;
+        }
 #endif
+        gdth_flush(hanum);
 
         if (shp->irq) {
-#if LINUX_VERSION_CODE >= 0x010346
             free_irq(shp->irq,ha);
-#else
-            free_irq(shp->irq);
-#endif
         }
 #ifndef __ia64__
         if (shp->dma_channel != 0xff) {
             free_dma(shp->dma_channel);
         }
 #endif
-#if LINUX_VERSION_CODE >= 0x020400
-        pci_free_consistent(ha->pdev, GDTH_SCRATCH, 
-            ha->pscratch, ha->scratch_phys);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+#ifdef INT_COAL
+        if (ha->coal_stat)
+            pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) *
+                                MAXOFFSETS, ha->coal_stat, ha->coal_stat_phys);
+#endif
+        if (ha->pscratch)
+            pci_free_consistent(ha->pdev, GDTH_SCRATCH, 
+                                ha->pscratch, ha->scratch_phys);
+        if (ha->pmsg)
+            pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), 
+                                ha->pmsg, ha->msg_phys);
         if (ha->ccb_phys)
             pci_unmap_single(ha->pdev,ha->ccb_phys,
                              sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL);
 #else
-        scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH);
+#ifdef INT_COAL
+        if (ha->coal_stat)
+            scsi_init_free((void *)ha->coal_stat, 
+                           sizeof(gdth_coal_status) * MAXOFFSETS);
+#endif
+        if (ha->pscratch)
+            scsi_init_free((void *)ha->pscratch, GDTH_SCRATCH);
+        if (ha->pmsg)
+            scsi_init_free((void *)ha->pmsg, sizeof(gdth_msg_str));
 #endif
         gdth_ctr_released++;
         TRACE2(("gdth_release(): HA %d of %d\n", 
@@ -4657,12 +5046,8 @@
 #ifdef GDTH_STATISTICS
             del_timer(&gdth_timer);
 #endif
-#ifdef GDTH_IOCTL_CHRDEV
             unregister_chrdev(major,"gdth");
-#endif
-#if LINUX_VERSION_CODE >= 0x020100
             unregister_reboot_notifier(&gdth_notifier);
-#endif
         }
     }
 
@@ -4715,6 +5100,7 @@
     return ((const char *)ha->binfo.type_string);
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
 /* old error handling */
 int gdth_abort(Scsi_Cmnd *scp)
 {
@@ -4722,17 +5108,13 @@
     return SCSI_ABORT_SNOOZE;
 }
 
-#if LINUX_VERSION_CODE >= 0x010346
 int gdth_reset(Scsi_Cmnd *scp, unsigned int reset_flags)
-#else
-int gdth_reset(Scsi_Cmnd *scp)
-#endif
 {
     TRACE2(("gdth_reset()\n"));
     return SCSI_RESET_PUNT;
 }
+#endif
 
-#if LINUX_VERSION_CODE >= 0x02015F
 /* new error handling */
 int gdth_eh_abort(Scsi_Cmnd *scp)
 {
@@ -4755,7 +5137,7 @@
     unchar b;
 
     TRACE2(("gdth_eh_bus_reset()\n"));
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     hanum = NUMDATA(scp->device->host)->hanum;
     b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
 #else
@@ -4768,7 +5150,7 @@
     GDTH_LOCK_HA(ha, flags);
     for (i = 0; i < GDTH_MAXCMDS; ++i) {
         cmnd = ha->cmd_tab[i].cmnd;
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         if (!SPECIAL_SCP(cmnd) && cmnd->device->channel == b)
 #else
         if (!SPECIAL_SCP(cmnd) && cmnd->channel == b)
@@ -4813,15 +5195,12 @@
     TRACE2(("gdth_eh_host_reset()\n"));
     return FAILED;
 }
-#endif
 
 
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,sector_t cap,int *ip)
-#elif LINUX_VERSION_CODE >= 0x010300
-int gdth_bios_param(Disk *disk,kdev_t dev,int *ip)
 #else
-int gdth_bios_param(Disk *disk,int dev,int *ip)
+int gdth_bios_param(Disk *disk,kdev_t dev,int *ip)
 #endif
 {
     unchar b, t;
@@ -4830,7 +5209,7 @@
     struct scsi_device *sd;
     unsigned capacity;
 
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     sd = sdev;
     capacity = cap;
 #else
@@ -4872,7 +5251,7 @@
     scp->SCp.sent_command = -1;
     scp->SCp.Status = GDTH_MAP_NONE;
     scp->SCp.buffer = (struct scatterlist *)NULL;
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     hanum = NUMDATA(scp->device->host)->hanum;
 #else
     hanum = NUMDATA(scp->host)->hanum;
@@ -4882,19 +5261,28 @@
 #endif
 
     priority = DEFAULT_PRI;
-#if LINUX_VERSION_CODE >= 0x010300
     if (scp->done == gdth_scsi_done)
         priority = scp->SCp.this_residual;
-#endif
     gdth_update_timeout(hanum, scp, scp->timeout_per_command * 6);
     gdth_putq( hanum, scp, priority );
     gdth_next( hanum );
     return 0;
 }
 
-#ifdef GDTH_IOCTL_CHRDEV
+
 static int gdth_open(struct inode *inode, struct file *filep)
 {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    gdth_ha_str *ha;
+    int i;
+
+    for (i = 0; i < gdth_ctr_count; i++) {
+        ha = HADATA(gdth_ctr_tab[i]);
+        if (!ha->sdev)
+            ha->sdev = scsi_get_host_dev(gdth_ctr_tab[i]);
+    }
+#endif
+
     TRACE(("gdth_open()\n"));
     return 0;
 }
@@ -4905,542 +5293,584 @@
     return 0;
 }
 
-static int ioc_event(unsigned long arg)
+static int ioc_event(void __user *arg)
 {
-        gdth_ioctl_event evt;
-        gdth_ha_str *ha;
-        ulong flags;
-
-        if (copy_from_user(&evt, (char *)arg, sizeof(gdth_ioctl_event)) ||
-            evt.ionode >= gdth_ctr_count)
-            return -EFAULT;
-        ha = HADATA(gdth_ctr_tab[evt.ionode]);
+    gdth_ioctl_event evt;
+    gdth_ha_str *ha;
+    ulong flags;
 
-        if (evt.erase == 0xff) {
-            if (evt.event.event_source == ES_TEST)
-                evt.event.event_data.size=sizeof(evt.event.event_data.eu.test); 
-            else if (evt.event.event_source == ES_DRIVER)
-                evt.event.event_data.size=sizeof(evt.event.event_data.eu.driver); 
-            else if (evt.event.event_source == ES_SYNC)
-                evt.event.event_data.size=sizeof(evt.event.event_data.eu.sync); 
-            else
-                evt.event.event_data.size=sizeof(evt.event.event_data.eu.async);
-            GDTH_LOCK_HA(ha, flags);
-            gdth_store_event(ha, evt.event.event_source, evt.event.event_idx,
-                             &evt.event.event_data);
-            GDTH_UNLOCK_HA(ha, flags);
-        } else if (evt.erase == 0xfe) {
-            gdth_clear_events();
-        } else if (evt.erase == 0) {
-            evt.handle = gdth_read_event(ha, evt.handle, &evt.event);
-        } else {
-            gdth_readapp_event(ha, evt.erase, &evt.event);
-        }     
-        if (copy_to_user((char *)arg, &evt, sizeof(gdth_ioctl_event)))
-            return -EFAULT;
-        return 0;
+    if (copy_from_user(&evt, arg, sizeof(gdth_ioctl_event)) ||
+        evt.ionode >= gdth_ctr_count)
+        return -EFAULT;
+    ha = HADATA(gdth_ctr_tab[evt.ionode]);
+
+    if (evt.erase == 0xff) {
+        if (evt.event.event_source == ES_TEST)
+            evt.event.event_data.size=sizeof(evt.event.event_data.eu.test); 
+        else if (evt.event.event_source == ES_DRIVER)
+            evt.event.event_data.size=sizeof(evt.event.event_data.eu.driver); 
+        else if (evt.event.event_source == ES_SYNC)
+            evt.event.event_data.size=sizeof(evt.event.event_data.eu.sync); 
+        else
+            evt.event.event_data.size=sizeof(evt.event.event_data.eu.async);
+        GDTH_LOCK_HA(ha, flags);
+        gdth_store_event(ha, evt.event.event_source, evt.event.event_idx,
+                         &evt.event.event_data);
+        GDTH_UNLOCK_HA(ha, flags);
+    } else if (evt.erase == 0xfe) {
+        gdth_clear_events();
+    } else if (evt.erase == 0) {
+        evt.handle = gdth_read_event(ha, evt.handle, &evt.event);
+    } else {
+        gdth_readapp_event(ha, evt.erase, &evt.event);
+    }     
+    if (copy_to_user(arg, &evt, sizeof(gdth_ioctl_event)))
+        return -EFAULT;
+    return 0;
 }
 
-static int ioc_lockdrv(unsigned long arg)
+static int ioc_lockdrv(void __user *arg)
 {
-        gdth_ioctl_lockdrv ldrv;
-        unchar i, j;
-        ulong flags;
-        gdth_ha_str *ha;
+    gdth_ioctl_lockdrv ldrv;
+    unchar i, j;
+    ulong flags;
+    gdth_ha_str *ha;
 
-        if (copy_from_user(&ldrv, (char *)arg, sizeof(gdth_ioctl_lockdrv)) ||
-            ldrv.ionode >= gdth_ctr_count)
-            return -EFAULT;
-        ha = HADATA(gdth_ctr_tab[ldrv.ionode]);
+    if (copy_from_user(&ldrv, arg, sizeof(gdth_ioctl_lockdrv)) ||
+        ldrv.ionode >= gdth_ctr_count)
+        return -EFAULT;
+    ha = HADATA(gdth_ctr_tab[ldrv.ionode]);
  
-        for (i = 0; i < ldrv.drive_cnt && i < MAX_HDRIVES; ++i) {
-            j = ldrv.drives[i];
-            if (j >= MAX_HDRIVES || !ha->hdr[j].present)
-                continue;
-            if (ldrv.lock) {
-                GDTH_LOCK_HA(ha, flags);
-                ha->hdr[j].lock = 1;
-                GDTH_UNLOCK_HA(ha, flags);
-                gdth_wait_completion(ldrv.ionode, ha->bus_cnt, j); 
-                gdth_stop_timeout(ldrv.ionode, ha->bus_cnt, j); 
-            } else {
-                GDTH_LOCK_HA(ha, flags);
-                ha->hdr[j].lock = 0;
-                GDTH_UNLOCK_HA(ha, flags);
-                gdth_start_timeout(ldrv.ionode, ha->bus_cnt, j); 
-                gdth_next(ldrv.ionode); 
-            }
-        } 
-        return 0;
+    for (i = 0; i < ldrv.drive_cnt && i < MAX_HDRIVES; ++i) {
+        j = ldrv.drives[i];
+        if (j >= MAX_HDRIVES || !ha->hdr[j].present)
+            continue;
+        if (ldrv.lock) {
+            GDTH_LOCK_HA(ha, flags);
+            ha->hdr[j].lock = 1;
+            GDTH_UNLOCK_HA(ha, flags);
+            gdth_wait_completion(ldrv.ionode, ha->bus_cnt, j); 
+            gdth_stop_timeout(ldrv.ionode, ha->bus_cnt, j); 
+        } else {
+            GDTH_LOCK_HA(ha, flags);
+            ha->hdr[j].lock = 0;
+            GDTH_UNLOCK_HA(ha, flags);
+            gdth_start_timeout(ldrv.ionode, ha->bus_cnt, j); 
+            gdth_next(ldrv.ionode); 
+        }
+    } 
+    return 0;
 }
 
-static int ioc_resetdrv(unsigned long arg, char *cmnd)
+static int ioc_resetdrv(void __user *arg, char *cmnd)
 {
-        gdth_ioctl_reset res;
-        gdth_cmd_str cmd;
-        int hanum;
-        gdth_ha_str *ha;
-#if LINUX_VERSION_CODE >= 0x020503
-	Scsi_Request *srp;
-	Scsi_Device *sdev;
-#elif LINUX_VERSION_CODE >= 0x020322
-	Scsi_Cmnd *scp;
-	Scsi_Device *sdev;
-#else
-	Scsi_Cmnd scp;
-	Scsi_Device sdev;
+    gdth_ioctl_reset res;
+    gdth_cmd_str cmd;
+    int hanum;
+    gdth_ha_str *ha;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+        Scsi_Request *srp;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        Scsi_Cmnd *scp;
+#else
+        Scsi_Cmnd scp;
 #endif
 
-        if (copy_from_user(&res, (char *)arg, sizeof(gdth_ioctl_reset)) ||
-            res.ionode >= gdth_ctr_count || res.number >= MAX_HDRIVES)
-            return -EFAULT;
-        hanum = res.ionode;
-        ha = HADATA(gdth_ctr_tab[hanum]);
+    if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) ||
+        res.ionode >= gdth_ctr_count || res.number >= MAX_HDRIVES)
+        return -EFAULT;
+    hanum = res.ionode;
+    ha = HADATA(gdth_ctr_tab[hanum]);
  
-        if (!ha->hdr[res.number].present)
-            return 0;
-        cmd.Service = CACHESERVICE;
-        cmd.OpCode = GDT_CLUST_RESET;
+    if (!ha->hdr[res.number].present)
+        return 0;
+    memset(&cmd, 0, sizeof(gdth_cmd_str));
+    cmd.Service = CACHESERVICE;
+    cmd.OpCode = GDT_CLUST_RESET;
+    if (ha->cache_feat & GDT_64BIT)
+        cmd.u.cache64.DeviceNo = res.number;
+    else
         cmd.u.cache.DeviceNo = res.number;
-#if LINUX_VERSION_CODE >= 0x020503
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        srp  = scsi_allocate_request(sdev, GFP_KERNEL);
-        if (!srp)
-            return -ENOMEM;
-        srp->sr_cmd_len = 12;
-        srp->sr_use_sg = 0;
-        gdth_do_req(srp, &cmd, cmnd, 30);
-        res.status = (ushort)srp->sr_command->SCp.Status;
-        scsi_release_request(srp);
-        scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        scp  = scsi_allocate_device(sdev, 1, FALSE);
-        if (!scp)
-            return -ENOMEM;
-        scp->cmd_len = 12;
-        scp->use_sg = 0;
-        gdth_do_cmd(scp, &cmd, cmnd, 30);
-        res.status = (ushort)scp->SCp.Status;
-        scsi_release_command(scp);
-        scsi_free_host_dev(sdev);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    srp  = scsi_allocate_request(ha->sdev, GFP_KERNEL);
+    if (!srp)
+        return -ENOMEM;
+    srp->sr_cmd_len = 12;
+    srp->sr_use_sg = 0;
+    gdth_do_req(srp, &cmd, cmnd, 30);
+    res.status = (ushort)srp->sr_command->SCp.Status;
+    scsi_release_request(srp);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    scp  = scsi_allocate_device(ha->sdev, 1, FALSE);
+    if (!scp)
+        return -ENOMEM;
+    scp->cmd_len = 12;
+    scp->use_sg = 0;
+    gdth_do_cmd(scp, &cmd, cmnd, 30);
+    res.status = (ushort)scp->SCp.Status;
+    scsi_release_command(scp);
 #else
-        memset(&sdev,0,sizeof(Scsi_Device));
-        memset(&scp, 0,sizeof(Scsi_Cmnd));
-        sdev.host = scp.host = gdth_ctr_tab[hanum];
-        sdev.id = scp.target = sdev.host->this_id;
-        scp.device = &sdev;
-        gdth_do_cmd(&scp, &cmd, cmnd, 30);
-        res.status = (ushort)scp.SCp.Status;
+    memset(&ha->sdev,0,sizeof(Scsi_Device));
+    memset(&scp, 0,sizeof(Scsi_Cmnd));
+    ha->sdev.host = scp.host = gdth_ctr_tab[hanum];
+    ha->sdev.id = scp.target = ha->sdev.host->this_id;
+    scp.device = &ha->sdev;
+    gdth_do_cmd(&scp, &cmd, cmnd, 30);
+    res.status = (ushort)scp.SCp.Status;
 #endif
-        if (copy_to_user((char *)arg, &res, sizeof(gdth_ioctl_reset)))
-            return -EFAULT;
-        return 0;
+    if (copy_to_user(arg, &res, sizeof(gdth_ioctl_reset)))
+        return -EFAULT;
+    return 0;
 }
 
-static int ioc_general(unsigned long arg, char *cmnd)
+static int ioc_general(void __user *arg, char *cmnd)
 {
-        gdth_ioctl_general gen;
-        char *buf = NULL;
-        ulong32 paddr; 
-        int hanum;
-	gdth_ha_str *ha; 
-#if LINUX_VERSION_CODE >= 0x020503
-	Scsi_Request *srp;
-	Scsi_Device *sdev;
-#elif LINUX_VERSION_CODE >= 0x020322
-	Scsi_Cmnd *scp;
-	Scsi_Device *sdev;
+    gdth_ioctl_general gen;
+    char *buf = NULL;
+    ulong64 paddr; 
+    int hanum;
+        gdth_ha_str *ha; 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+        Scsi_Request *srp;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        Scsi_Cmnd *scp;
 #else
-	Scsi_Cmnd scp;
-	Scsi_Device sdev;
+        Scsi_Cmnd scp;
 #endif
         
-        if (copy_from_user(&gen, (char *)arg, sizeof(gdth_ioctl_general)) ||
-            gen.ionode >= gdth_ctr_count)
+    if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general)) ||
+        gen.ionode >= gdth_ctr_count)
+        return -EFAULT;
+    hanum = gen.ionode; 
+    ha = HADATA(gdth_ctr_tab[hanum]);
+    if (gen.data_len + gen.sense_len != 0) {
+        if (!(buf = gdth_ioctl_alloc(hanum, gen.data_len + gen.sense_len, 
+                                     FALSE, &paddr)))
             return -EFAULT;
-        hanum = gen.ionode; 
-        ha = HADATA(gdth_ctr_tab[hanum]);
-        if (gen.data_len + gen.sense_len != 0) {
-            if (!(buf = gdth_ioctl_alloc(hanum, gen.data_len + gen.sense_len, 
-                                         FALSE, &paddr)))
-                return -EFAULT;
-            if (copy_from_user(buf, (char *)arg + sizeof(gdth_ioctl_general),  
-                               gen.data_len + gen.sense_len)) {
-                gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
-                return -EFAULT;
-            }
+        if (copy_from_user(buf, arg + sizeof(gdth_ioctl_general),  
+                           gen.data_len + gen.sense_len)) {
+            gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
+            return -EFAULT;
+        }
 
-            if (gen.command.OpCode == GDT_IOCTL) {
-                gen.command.u.ioctl.p_param = paddr;
-            } else if (gen.command.Service == CACHESERVICE) {
+        if (gen.command.OpCode == GDT_IOCTL) {
+            gen.command.u.ioctl.p_param = paddr;
+        } else if (gen.command.Service == CACHESERVICE) {
+            if (ha->cache_feat & GDT_64BIT) {
+                /* copy elements from 32-bit IOCTL structure */
+                gen.command.u.cache64.BlockCnt = gen.command.u.cache.BlockCnt;
+                gen.command.u.cache64.BlockNo = gen.command.u.cache.BlockNo;
+                gen.command.u.cache64.DeviceNo = gen.command.u.cache.DeviceNo;
+                /* addresses */
+                if (ha->cache_feat & SCATTER_GATHER) {
+                    gen.command.u.cache64.DestAddr = (ulong64)-1;
+                    gen.command.u.cache64.sg_canz = 1;
+                    gen.command.u.cache64.sg_lst[0].sg_ptr = paddr;
+                    gen.command.u.cache64.sg_lst[0].sg_len = gen.data_len;
+                    gen.command.u.cache64.sg_lst[1].sg_len = 0;
+                } else {
+                    gen.command.u.cache64.DestAddr = paddr;
+                    gen.command.u.cache64.sg_canz = 0;
+                }
+            } else {
                 if (ha->cache_feat & SCATTER_GATHER) {
                     gen.command.u.cache.DestAddr = 0xffffffff;
                     gen.command.u.cache.sg_canz = 1;
-                    gen.command.u.cache.sg_lst[0].sg_ptr = paddr;
+                    gen.command.u.cache.sg_lst[0].sg_ptr = (ulong32)paddr;
                     gen.command.u.cache.sg_lst[0].sg_len = gen.data_len;
                     gen.command.u.cache.sg_lst[1].sg_len = 0;
                 } else {
                     gen.command.u.cache.DestAddr = paddr;
                     gen.command.u.cache.sg_canz = 0;
                 }
-            } else if (gen.command.Service == SCSIRAWSERVICE) {
+            }
+        } else if (gen.command.Service == SCSIRAWSERVICE) {
+            if (ha->raw_feat & GDT_64BIT) {
+                /* copy elements from 32-bit IOCTL structure */
+                char cmd[16];
+                gen.command.u.raw64.sense_len = gen.command.u.raw.sense_len;
+                gen.command.u.raw64.bus = gen.command.u.raw.bus;
+                gen.command.u.raw64.lun = gen.command.u.raw.lun;
+                gen.command.u.raw64.target = gen.command.u.raw.target;
+                memcpy(cmd, gen.command.u.raw.cmd, 16);
+                memcpy(gen.command.u.raw64.cmd, cmd, 16);
+                gen.command.u.raw64.clen = gen.command.u.raw.clen;
+                gen.command.u.raw64.sdlen = gen.command.u.raw.sdlen;
+                gen.command.u.raw64.direction = gen.command.u.raw.direction;
+                /* addresses */
+                if (ha->raw_feat & SCATTER_GATHER) {
+                    gen.command.u.raw64.sdata = (ulong64)-1;
+                    gen.command.u.raw64.sg_ranz = 1;
+                    gen.command.u.raw64.sg_lst[0].sg_ptr = paddr;
+                    gen.command.u.raw64.sg_lst[0].sg_len = gen.data_len;
+                    gen.command.u.raw64.sg_lst[1].sg_len = 0;
+                } else {
+                    gen.command.u.raw64.sdata = paddr;
+                    gen.command.u.raw64.sg_ranz = 0;
+                }
+                gen.command.u.raw64.sense_data = paddr + gen.data_len;
+            } else {
                 if (ha->raw_feat & SCATTER_GATHER) {
                     gen.command.u.raw.sdata = 0xffffffff;
                     gen.command.u.raw.sg_ranz = 1;
-                    gen.command.u.raw.sg_lst[0].sg_ptr = paddr;
+                    gen.command.u.raw.sg_lst[0].sg_ptr = (ulong32)paddr;
                     gen.command.u.raw.sg_lst[0].sg_len = gen.data_len;
                     gen.command.u.raw.sg_lst[1].sg_len = 0;
                 } else {
                     gen.command.u.raw.sdata = paddr;
                     gen.command.u.raw.sg_ranz = 0;
                 }
-                gen.command.u.raw.sense_data = paddr + gen.data_len;
-
-            } else {
-                gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
-                return -EFAULT;
+                gen.command.u.raw.sense_data = (ulong32)paddr + gen.data_len;
             }
+        } else {
+            gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
+            return -EFAULT;
         }
+    }
 
-#if LINUX_VERSION_CODE >= 0x020503
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        srp  = scsi_allocate_request(sdev, GFP_KERNEL);
-        if (!srp)
-            return -ENOMEM;
-        srp->sr_cmd_len = 12;
-        srp->sr_use_sg = 0;
-        gdth_do_req(srp, &gen.command, cmnd, gen.timeout);
-        gen.status = srp->sr_command->SCp.Status;
-        gen.info = srp->sr_command->SCp.Message;
-        scsi_release_request(srp);
-        scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        scp  = scsi_allocate_device(sdev, 1, FALSE);
-        if (!scp)
-            return -ENOMEM;
-        scp->cmd_len = 12;
-        scp->use_sg = 0;
-        gdth_do_cmd(scp, &gen.command, cmnd, gen.timeout);
-        gen.status = scp->SCp.Status;
-        gen.info = scp->SCp.Message;
-        scsi_release_command(scp);
-        scsi_free_host_dev(sdev);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    srp  = scsi_allocate_request(ha->sdev, GFP_KERNEL);
+    if (!srp)
+        return -ENOMEM;
+    srp->sr_cmd_len = 12;
+    srp->sr_use_sg = 0;
+    gdth_do_req(srp, &gen.command, cmnd, gen.timeout);
+    gen.status = srp->sr_command->SCp.Status;
+    gen.info = srp->sr_command->SCp.Message;
+    scsi_release_request(srp);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    scp  = scsi_allocate_device(ha->sdev, 1, FALSE);
+    if (!scp)
+        return -ENOMEM;
+    scp->cmd_len = 12;
+    scp->use_sg = 0;
+    gdth_do_cmd(scp, &gen.command, cmnd, gen.timeout);
+    gen.status = scp->SCp.Status;
+    gen.info = scp->SCp.Message;
+    scsi_release_command(scp);
 #else
-        memset(&sdev,0,sizeof(Scsi_Device));
-        memset(&scp, 0,sizeof(Scsi_Cmnd));
-        sdev.host = scp.host = gdth_ctr_tab[hanum];
-        sdev.id = scp.target = sdev.host->this_id;
-        scp.device = &sdev;
-        gdth_do_cmd(&scp, &gen.command, cmnd, gen.timeout);
-        gen.status = scp.SCp.Status;
-        gen.info = scp.SCp.Message;
+    memset(&ha->sdev,0,sizeof(Scsi_Device));
+    memset(&scp, 0,sizeof(Scsi_Cmnd));
+    ha->sdev.host = scp.host = gdth_ctr_tab[hanum];
+    ha->sdev.id = scp.target = ha->sdev.host->this_id;
+    scp.device = &ha->sdev;
+    gdth_do_cmd(&scp, &gen.command, cmnd, gen.timeout);
+    gen.status = scp.SCp.Status;
+    gen.info = scp.SCp.Message;
 #endif
 
-        if (copy_to_user((char *)arg + sizeof(gdth_ioctl_general), buf, 
-                         gen.data_len + gen.sense_len)) {
-            gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
-            return -EFAULT; 
-        } 
-        if (copy_to_user((char *)arg, &gen, 
-            sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) {
-            gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
-            return -EFAULT;
-        }
+    if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, 
+                     gen.data_len + gen.sense_len)) {
         gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
-        return 0;
+        return -EFAULT; 
+    } 
+    if (copy_to_user(arg, &gen, 
+        sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) {
+        gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
+        return -EFAULT;
+    }
+    gdth_ioctl_free(hanum, gen.data_len+gen.sense_len, buf, paddr);
+    return 0;
 }
  
-static int ioc_hdrlist(unsigned long arg, char *cmnd)
+static int ioc_hdrlist(void __user *arg, char *cmnd)
 {
-        gdth_ioctl_rescan rsc;
-        gdth_cmd_str cmd;
-        gdth_ha_str *ha;
-        unchar i;
-        int hanum;
-#if LINUX_VERSION_CODE >= 0x020503
-	Scsi_Request *srp;
-	Scsi_Device *sdev;
-#elif LINUX_VERSION_CODE >= 0x020322
-	Scsi_Cmnd *scp;
-	Scsi_Device *sdev;
+    gdth_ioctl_rescan rsc;
+    gdth_cmd_str cmd;
+    gdth_ha_str *ha;
+    unchar i;
+    int hanum;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    Scsi_Request *srp;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    Scsi_Cmnd *scp;
 #else
-	Scsi_Cmnd scp;
-	Scsi_Device sdev;
+    Scsi_Cmnd scp;
 #endif
         
-        if (copy_from_user(&rsc, (char *)arg, sizeof(gdth_ioctl_rescan)) ||
-            rsc.ionode >= gdth_ctr_count)
-            return -EFAULT;
-        hanum = rsc.ionode;
-        ha = HADATA(gdth_ctr_tab[hanum]);
+    if (copy_from_user(&rsc, arg, sizeof(gdth_ioctl_rescan)) ||
+        rsc.ionode >= gdth_ctr_count)
+        return -EFAULT;
+    hanum = rsc.ionode;
+    ha = HADATA(gdth_ctr_tab[hanum]);
+    memset(&cmd, 0, sizeof(gdth_cmd_str));
    
-#if LINUX_VERSION_CODE >= 0x020503
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        srp  = scsi_allocate_request(sdev, GFP_KERNEL);
-        if (!srp)
-            return -ENOMEM;
-        srp->sr_cmd_len = 12;
-        srp->sr_use_sg = 0;
-#elif LINUX_VERSION_CODE >= 0x020322
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        scp  = scsi_allocate_device(sdev, 1, FALSE);
-        if (!scp)
-            return -ENOMEM;
-        scp->cmd_len = 12;
-        scp->use_sg = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    srp  = scsi_allocate_request(ha->sdev, GFP_KERNEL);
+    if (!srp)
+        return -ENOMEM;
+    srp->sr_cmd_len = 12;
+    srp->sr_use_sg = 0;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    scp  = scsi_allocate_device(ha->sdev, 1, FALSE);
+    if (!scp)
+        return -ENOMEM;
+    scp->cmd_len = 12;
+    scp->use_sg = 0;
 #else
-        memset(&sdev,0,sizeof(Scsi_Device));
-        memset(&scp, 0,sizeof(Scsi_Cmnd));
-        sdev.host = scp.host = gdth_ctr_tab[hanum];
-        sdev.id = scp.target = sdev.host->this_id;
-        scp.device = &sdev;
+    memset(&ha->sdev,0,sizeof(Scsi_Device));
+    memset(&scp, 0,sizeof(Scsi_Cmnd));
+    ha->sdev.host = scp.host = gdth_ctr_tab[hanum];
+    ha->sdev.id = scp.target = ha->sdev.host->this_id;
+    scp.device = &ha->sdev;
 #endif
 
-        for (i = 0; i < MAX_HDRIVES; ++i) { 
-            if (!ha->hdr[i].present) {
-                rsc.hdr_list[i].bus = 0xff; 
-                continue;
-            } 
-            rsc.hdr_list[i].bus = ha->virt_bus;
-            rsc.hdr_list[i].target = i;
-            rsc.hdr_list[i].lun = 0;
-            rsc.hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
-            if (ha->hdr[i].cluster_type & CLUSTER_DRIVE) { 
-                cmd.Service = CACHESERVICE;
-                cmd.OpCode = GDT_CLUST_INFO;
+    for (i = 0; i < MAX_HDRIVES; ++i) { 
+        if (!ha->hdr[i].present) {
+            rsc.hdr_list[i].bus = 0xff; 
+            continue;
+        } 
+        rsc.hdr_list[i].bus = ha->virt_bus;
+        rsc.hdr_list[i].target = i;
+        rsc.hdr_list[i].lun = 0;
+        rsc.hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
+        if (ha->hdr[i].cluster_type & CLUSTER_DRIVE) { 
+            cmd.Service = CACHESERVICE;
+            cmd.OpCode = GDT_CLUST_INFO;
+            if (ha->cache_feat & GDT_64BIT)
+                cmd.u.cache64.DeviceNo = i;
+            else
                 cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
-                gdth_do_req(srp, &cmd, cmnd, 30);
-                if (srp->sr_command->SCp.Status == S_OK)
-                    rsc.hdr_list[i].cluster_type = srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-                gdth_do_cmd(scp, &cmd, cmnd, 30);
-                if (scp->SCp.Status == S_OK)
-                    rsc.hdr_list[i].cluster_type = scp->SCp.Message;
-#else
-                gdth_do_cmd(&scp, &cmd, cmnd, 30);
-                if (scp.SCp.Status == S_OK)
-                    rsc.hdr_list[i].cluster_type = scp.SCp.Message;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            gdth_do_req(srp, &cmd, cmnd, 30);
+            if (srp->sr_command->SCp.Status == S_OK)
+                rsc.hdr_list[i].cluster_type = srp->sr_command->SCp.Message;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+            gdth_do_cmd(scp, &cmd, cmnd, 30);
+            if (scp->SCp.Status == S_OK)
+                rsc.hdr_list[i].cluster_type = scp->SCp.Message;
+#else
+            gdth_do_cmd(&scp, &cmd, cmnd, 30);
+            if (scp.SCp.Status == S_OK)
+                rsc.hdr_list[i].cluster_type = scp.SCp.Message;
 #endif
-            }
-        } 
-#if LINUX_VERSION_CODE >= 0x020503
-        scsi_release_request(srp);
-        scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
-        scsi_release_command(scp);
-        scsi_free_host_dev(sdev);
+        }
+    } 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    scsi_release_request(srp);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    scsi_release_command(scp);
 #endif       
  
-        if (copy_to_user((char *)arg, &rsc, sizeof(gdth_ioctl_rescan)))
-            return -EFAULT;
-        return 0;
+    if (copy_to_user(arg, &rsc, sizeof(gdth_ioctl_rescan)))
+        return -EFAULT;
+    return 0;
 }
 
-static int ioc_rescan(unsigned long arg, char *cmnd)
+static int ioc_rescan(void __user *arg, char *cmnd)
 {
-        gdth_ioctl_rescan rsc;
-        gdth_cmd_str cmd;
-        ushort i, status, hdr_cnt;
-        ulong32 info;
-        int hanum, cyls, hds, secs;
-	ulong flags;
-	gdth_ha_str *ha; 
-#if LINUX_VERSION_CODE >= 0x020503
-	Scsi_Request *srp;
-	Scsi_Device *sdev;
-#elif LINUX_VERSION_CODE >= 0x020322
-	Scsi_Cmnd *scp;
-	Scsi_Device *sdev;
+    gdth_ioctl_rescan rsc;
+    gdth_cmd_str cmd;
+    ushort i, status, hdr_cnt;
+    ulong32 info;
+    int hanum, cyls, hds, secs;
+    ulong flags;
+    gdth_ha_str *ha; 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    Scsi_Request *srp;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    Scsi_Cmnd *scp;
 #else
-	Scsi_Cmnd scp;
-	Scsi_Device sdev;
+    Scsi_Cmnd scp;
 #endif
         
-        if (copy_from_user(&rsc, (char *)arg, sizeof(gdth_ioctl_rescan)) ||
-            rsc.ionode >= gdth_ctr_count)
-            return -EFAULT;
-        hanum = rsc.ionode;
-        ha = HADATA(gdth_ctr_tab[hanum]);
+    if (copy_from_user(&rsc, arg, sizeof(gdth_ioctl_rescan)) ||
+        rsc.ionode >= gdth_ctr_count)
+        return -EFAULT;
+    hanum = rsc.ionode;
+    ha = HADATA(gdth_ctr_tab[hanum]);
+    memset(&cmd, 0, sizeof(gdth_cmd_str));
 
-#if LINUX_VERSION_CODE >= 0x020503
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        srp  = scsi_allocate_request(sdev, GFP_KERNEL);
-        if (!srp)
-            return -ENOMEM;
-        srp->sr_cmd_len = 12;
-        srp->sr_use_sg = 0;
-#elif LINUX_VERSION_CODE >= 0x020322
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        scp  = scsi_allocate_device(sdev, 1, FALSE);
-        if (!scp)
-            return -ENOMEM;
-        scp->cmd_len = 12;
-        scp->use_sg = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    srp  = scsi_allocate_request(ha->sdev, GFP_KERNEL);
+    if (!srp)
+        return -ENOMEM;
+    srp->sr_cmd_len = 12;
+    srp->sr_use_sg = 0;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    scp  = scsi_allocate_device(ha->sdev, 1, FALSE);
+    if (!scp)
+        return -ENOMEM;
+    scp->cmd_len = 12;
+    scp->use_sg = 0;
 #else
-        memset(&sdev,0,sizeof(Scsi_Device));
-        memset(&scp, 0,sizeof(Scsi_Cmnd));
-        sdev.host = scp.host = gdth_ctr_tab[hanum];
-        sdev.id = scp.target = sdev.host->this_id;
-        scp.device = &sdev;
+    memset(&ha->sdev,0,sizeof(Scsi_Device));
+    memset(&scp, 0,sizeof(Scsi_Cmnd));
+    ha->sdev.host = scp.host = gdth_ctr_tab[hanum];
+    ha->sdev.id = scp.target = ha->sdev.host->this_id;
+    scp.device = &ha->sdev;
 #endif
      
-        if (rsc.flag == 0) {
-            /* old method: re-init. cache service */
-            cmd.Service = CACHESERVICE;
+    if (rsc.flag == 0) {
+        /* old method: re-init. cache service */
+        cmd.Service = CACHESERVICE;
+        if (ha->cache_feat & GDT_64BIT) {
+            cmd.OpCode = GDT_X_INIT_HOST;
+            cmd.u.cache64.DeviceNo = LINUX_OS;
+        } else {
             cmd.OpCode = GDT_INIT;
             cmd.u.cache.DeviceNo = LINUX_OS;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(srp, &cmd, cmnd, 30);
-            status = (ushort)srp->sr_command->SCp.Status;
-            info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &cmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status;
-            info = (ulong32)scp->SCp.Message;
+        }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+        gdth_do_req(srp, &cmd, cmnd, 30);
+        status = (ushort)srp->sr_command->SCp.Status;
+        info = (ulong32)srp->sr_command->SCp.Message;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        gdth_do_cmd(scp, &cmd, cmnd, 30);
+        status = (ushort)scp->SCp.Status;
+        info = (ulong32)scp->SCp.Message;
 #else
-            gdth_do_cmd(&scp, &cmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
+        gdth_do_cmd(&scp, &cmd, cmnd, 30);
+        status = (ushort)scp.SCp.Status;
+        info = (ulong32)scp.SCp.Message;
 #endif
-            i = 0;
-            hdr_cnt = (status == S_OK ? (ushort)info : 0);
-        } else {
-            i = rsc.hdr_no;
-            hdr_cnt = i + 1;
-        }
-        for (; i < hdr_cnt && i < MAX_HDRIVES; ++i) {
-            cmd.Service = CACHESERVICE;
-            cmd.OpCode = GDT_INFO;
+        i = 0;
+        hdr_cnt = (status == S_OK ? (ushort)info : 0);
+    } else {
+        i = rsc.hdr_no;
+        hdr_cnt = i + 1;
+    }
+    for (; i < hdr_cnt && i < MAX_HDRIVES; ++i) {
+        cmd.Service = CACHESERVICE;
+        cmd.OpCode = GDT_INFO;
+        if (ha->cache_feat & GDT_64BIT) 
+            cmd.u.cache64.DeviceNo = i;
+        else 
             cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(srp, &cmd, cmnd, 30);
-            status = (ushort)srp->sr_command->SCp.Status;
-            info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &cmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status;
-            info = (ulong32)scp->SCp.Message;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+        gdth_do_req(srp, &cmd, cmnd, 30);
+        status = (ushort)srp->sr_command->SCp.Status;
+        info = (ulong32)srp->sr_command->SCp.Message;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        gdth_do_cmd(scp, &cmd, cmnd, 30);
+        status = (ushort)scp->SCp.Status;
+        info = (ulong32)scp->SCp.Message;
 #else
-            gdth_do_cmd(&scp, &cmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
+        gdth_do_cmd(&scp, &cmd, cmnd, 30);
+        status = (ushort)scp.SCp.Status;
+        info = (ulong32)scp.SCp.Message;
 #endif
-            GDTH_LOCK_HA(ha, flags);
-            rsc.hdr_list[i].bus = ha->virt_bus;
-            rsc.hdr_list[i].target = i;
-            rsc.hdr_list[i].lun = 0;
-            if (status != S_OK) {
-                ha->hdr[i].present = FALSE;
-            } else {
-                ha->hdr[i].present = TRUE;
-                ha->hdr[i].size = info;
-                /* evaluate mapping */
-                ha->hdr[i].size &= ~SECS32;
-                gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs); 
-                ha->hdr[i].heads = hds;
-                ha->hdr[i].secs = secs;
-                /* round size */
-                ha->hdr[i].size = cyls * hds * secs;
-            }
-            GDTH_UNLOCK_HA(ha, flags);
-            if (status != S_OK)
-                continue; 
+        GDTH_LOCK_HA(ha, flags);
+        rsc.hdr_list[i].bus = ha->virt_bus;
+        rsc.hdr_list[i].target = i;
+        rsc.hdr_list[i].lun = 0;
+        if (status != S_OK) {
+            ha->hdr[i].present = FALSE;
+        } else {
+            ha->hdr[i].present = TRUE;
+            ha->hdr[i].size = info;
+            /* evaluate mapping */
+            ha->hdr[i].size &= ~SECS32;
+            gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs); 
+            ha->hdr[i].heads = hds;
+            ha->hdr[i].secs = secs;
+            /* round size */
+            ha->hdr[i].size = cyls * hds * secs;
+        }
+        GDTH_UNLOCK_HA(ha, flags);
+        if (status != S_OK)
+            continue; 
+        
+        /* extended info, if GDT_64BIT, for drives > 2 TB */
+        /* but we need ha->info2, not yet stored in scp->SCp */
 
-            /* devtype, cluster info, R/W attribs */
-            cmd.Service = CACHESERVICE;
-            cmd.OpCode = GDT_DEVTYPE;
+        /* devtype, cluster info, R/W attribs */
+        cmd.Service = CACHESERVICE;
+        cmd.OpCode = GDT_DEVTYPE;
+        if (ha->cache_feat & GDT_64BIT) 
+            cmd.u.cache64.DeviceNo = i;
+        else
             cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(srp, &cmd, cmnd, 30);
-            status = (ushort)srp->sr_command->SCp.Status;
-            info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &cmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status;
-            info = (ulong32)scp->SCp.Message;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+        gdth_do_req(srp, &cmd, cmnd, 30);
+        status = (ushort)srp->sr_command->SCp.Status;
+        info = (ulong32)srp->sr_command->SCp.Message;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        gdth_do_cmd(scp, &cmd, cmnd, 30);
+        status = (ushort)scp->SCp.Status;
+        info = (ulong32)scp->SCp.Message;
 #else
-            gdth_do_cmd(&scp, &cmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
+        gdth_do_cmd(&scp, &cmd, cmnd, 30);
+        status = (ushort)scp.SCp.Status;
+        info = (ulong32)scp.SCp.Message;
 #endif
-            GDTH_LOCK_HA(ha, flags);
-            ha->hdr[i].devtype = (status == S_OK ? (ushort)info : 0);
-            GDTH_UNLOCK_HA(ha, flags);
+        GDTH_LOCK_HA(ha, flags);
+        ha->hdr[i].devtype = (status == S_OK ? (ushort)info : 0);
+        GDTH_UNLOCK_HA(ha, flags);
 
-            cmd.Service = CACHESERVICE;
-            cmd.OpCode = GDT_CLUST_INFO;
+        cmd.Service = CACHESERVICE;
+        cmd.OpCode = GDT_CLUST_INFO;
+        if (ha->cache_feat & GDT_64BIT) 
+            cmd.u.cache64.DeviceNo = i;
+        else
             cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(srp, &cmd, cmnd, 30);
-            status = (ushort)srp->sr_command->SCp.Status;
-            info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &cmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status;
-            info = (ulong32)scp->SCp.Message;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+        gdth_do_req(srp, &cmd, cmnd, 30);
+        status = (ushort)srp->sr_command->SCp.Status;
+        info = (ulong32)srp->sr_command->SCp.Message;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        gdth_do_cmd(scp, &cmd, cmnd, 30);
+        status = (ushort)scp->SCp.Status;
+        info = (ulong32)scp->SCp.Message;
 #else
-            gdth_do_cmd(&scp, &cmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
+        gdth_do_cmd(&scp, &cmd, cmnd, 30);
+        status = (ushort)scp.SCp.Status;
+        info = (ulong32)scp.SCp.Message;
 #endif
-            GDTH_LOCK_HA(ha, flags);
-            ha->hdr[i].cluster_type = 
-                ((status == S_OK && !shared_access) ? (ushort)info : 0);
-            GDTH_UNLOCK_HA(ha, flags);
-            rsc.hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
+        GDTH_LOCK_HA(ha, flags);
+        ha->hdr[i].cluster_type = 
+            ((status == S_OK && !shared_access) ? (ushort)info : 0);
+        GDTH_UNLOCK_HA(ha, flags);
+        rsc.hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
 
-            cmd.Service = CACHESERVICE;
-            cmd.OpCode = GDT_RW_ATTRIBS;
+        cmd.Service = CACHESERVICE;
+        cmd.OpCode = GDT_RW_ATTRIBS;
+        if (ha->cache_feat & GDT_64BIT) 
+            cmd.u.cache64.DeviceNo = i;
+        else
             cmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(srp, &cmd, cmnd, 30);
-            status = (ushort)srp->sr_command->SCp.Status;
-            info = (ulong32)srp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &cmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status;
-            info = (ulong32)scp->SCp.Message;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+        gdth_do_req(srp, &cmd, cmnd, 30);
+        status = (ushort)srp->sr_command->SCp.Status;
+        info = (ulong32)srp->sr_command->SCp.Message;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        gdth_do_cmd(scp, &cmd, cmnd, 30);
+        status = (ushort)scp->SCp.Status;
+        info = (ulong32)scp->SCp.Message;
 #else
-            gdth_do_cmd(&scp, &cmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
+        gdth_do_cmd(&scp, &cmd, cmnd, 30);
+        status = (ushort)scp.SCp.Status;
+        info = (ulong32)scp.SCp.Message;
 #endif
-            GDTH_LOCK_HA(ha, flags);
-            ha->hdr[i].rw_attribs = (status == S_OK ? (ushort)info : 0);
-            GDTH_UNLOCK_HA(ha, flags);
-        }
-#if LINUX_VERSION_CODE >= 0x020503
-        scsi_release_request(srp);
-        scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
-        scsi_release_command(scp);
-        scsi_free_host_dev(sdev);
+        GDTH_LOCK_HA(ha, flags);
+        ha->hdr[i].rw_attribs = (status == S_OK ? (ushort)info : 0);
+        GDTH_UNLOCK_HA(ha, flags);
+    }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    scsi_release_request(srp);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    scsi_release_command(scp);
 #endif       
  
-        if (copy_to_user((char *)arg, &rsc, sizeof(gdth_ioctl_rescan)))
-            return -EFAULT;
-        return 0;
+    if (copy_to_user(arg, &rsc, sizeof(gdth_ioctl_rescan)))
+        return -EFAULT;
+    return 0;
 }
   
 static int gdth_ioctl(struct inode *inode, struct file *filep,
                       unsigned int cmd, unsigned long arg)
 {
     gdth_ha_str *ha; 
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     Scsi_Cmnd *scp;
-    Scsi_Device *sdev;
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     Scsi_Cmnd *scp;
-    Scsi_Device *sdev;
 #else
     Scsi_Cmnd scp;
-    Scsi_Device sdev;
 #endif
     ulong flags;
     char cmnd[MAX_COMMAND_SIZE];   
+    void __user *argp = (void __user *)arg;
 
     memset(cmnd, 0xff, 12);
     
@@ -5450,16 +5880,16 @@
       case GDTIOCTL_CTRCNT:
       { 
         int cnt = gdth_ctr_count;
-        if (put_user(cnt, (int *)arg))
-		return -EFAULT;
+        if (put_user(cnt, (int __user *)argp))
+                return -EFAULT;
         break;
       }
 
       case GDTIOCTL_DRVERS:
       { 
         int ver = (GDTH_VERSION<<8) | GDTH_SUBVERSION;
-        if (put_user(ver, (int *)arg))
-		return -EFAULT;
+        if (put_user(ver, (int __user *)argp))
+                return -EFAULT;
         break;
       }
       
@@ -5470,8 +5900,8 @@
         osv.version = (unchar)(LINUX_VERSION_CODE >> 16);
         osv.subversion = (unchar)(LINUX_VERSION_CODE >> 8);
         osv.revision = (ushort)(LINUX_VERSION_CODE & 0xff);
-        if (copy_to_user((char *)arg, &osv, sizeof(gdth_ioctl_osvers)))
-		return -EFAULT;
+        if (copy_to_user(argp, &osv, sizeof(gdth_ioctl_osvers)))
+                return -EFAULT;
         break;
       }
 
@@ -5479,7 +5909,7 @@
       { 
         gdth_ioctl_ctrtype ctrt;
         
-        if (copy_from_user(&ctrt, (char *)arg, sizeof(gdth_ioctl_ctrtype)) ||
+        if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) ||
             ctrt.ionode >= gdth_ctr_count)
             return -EFAULT;
         ha = HADATA(gdth_ctr_tab[ctrt.ionode]);
@@ -5501,26 +5931,26 @@
         }
         ctrt.info = ha->brd_phys;
         ctrt.oem_id = ha->oem_id;
-        if (copy_to_user((char *)arg, &ctrt, sizeof(gdth_ioctl_ctrtype)))
+        if (copy_to_user(argp, &ctrt, sizeof(gdth_ioctl_ctrtype)))
             return -EFAULT;
         break;
       }
         
       case GDTIOCTL_GENERAL:
-	return ioc_general(arg, cmnd);
+        return ioc_general(argp, cmnd);
 
       case GDTIOCTL_EVENT:
-	return ioc_event(arg);
+        return ioc_event(argp);
 
       case GDTIOCTL_LOCKDRV:
-	return ioc_lockdrv(arg);
+        return ioc_lockdrv(argp);
 
       case GDTIOCTL_LOCKCHN:
       {
         gdth_ioctl_lockchn lchn;
         unchar i, j;
 
-        if (copy_from_user(&lchn, (char *)arg, sizeof(gdth_ioctl_lockchn)) ||
+        if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) ||
             lchn.ionode >= gdth_ctr_count)
             return -EFAULT;
         ha = HADATA(gdth_ctr_tab[lchn.ionode]);
@@ -5549,25 +5979,25 @@
       }
 
       case GDTIOCTL_RESCAN:
-	return ioc_rescan(arg, cmnd);
+        return ioc_rescan(argp, cmnd);
 
       case GDTIOCTL_HDRLIST:
-	return ioc_hdrlist(arg, cmnd);
+        return ioc_hdrlist(argp, cmnd);
 
       case GDTIOCTL_RESET_BUS:
       {
         gdth_ioctl_reset res;
         int hanum, rval;
 
-        if (copy_from_user(&res, (char *)arg, sizeof(gdth_ioctl_reset)) ||
+        if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) ||
             res.ionode >= gdth_ctr_count)
             return -EFAULT;
         hanum = res.ionode; 
+        ha = HADATA(gdth_ctr_tab[hanum]);
 
-        /* Because we need a Scsi_Cmnd struct., we make a scsi_allocate device also for kernels >=2.5.x */        
-#if LINUX_VERSION_CODE >= 0x02053C
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-        scp  = scsi_get_command(sdev, GFP_KERNEL);
+        /* Because we need a Scsi_Cmnd struct., we make a scsi_allocate device also for kernels >=2.6.x */        
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+        scp  = scsi_get_command(ha->sdev, GFP_KERNEL);
         if (!scp)
             return -ENOMEM;
         scp->cmd_len = 12;
@@ -5576,14 +6006,8 @@
         rval = gdth_eh_bus_reset(scp);
         res.status = (rval == SUCCESS ? S_OK : S_GENERR);
         scsi_put_command(scp);
-        scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
-        sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-#if LINUX_VERSION_CODE >= 0x020503
-        scp  = scsi_allocate_device(sdev, 1);
-#else
-        scp  = scsi_allocate_device(sdev, 1, FALSE);
-#endif
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        scp  = scsi_allocate_device(ha->sdev, 1, FALSE);
         if (!scp)
             return -ENOMEM;
         scp->cmd_len = 12;
@@ -5592,45 +6016,41 @@
         rval = gdth_eh_bus_reset(scp);
         res.status = (rval == SUCCESS ? S_OK : S_GENERR);
         scsi_release_command(scp);
-        scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x02015F
-        memset(&sdev,0,sizeof(Scsi_Device));
+#else 
+        memset(&ha->sdev,0,sizeof(Scsi_Device));
         memset(&scp, 0,sizeof(Scsi_Cmnd));
-        sdev.host = scp.host = gdth_ctr_tab[hanum];
-        sdev.id = scp.target = sdev.host->this_id;
-        scp.device = &sdev;
+        ha->sdev.host = scp.host = gdth_ctr_tab[hanum];
+        ha->sdev.id = scp.target = ha->sdev.host->this_id;
+        scp.device = &ha->sdev;
         scp.channel = virt_ctr ? 0 : res.number;
         rval = gdth_eh_bus_reset(&scp);
         res.status = (rval == SUCCESS ? S_OK : S_GENERR);
-#else
-        res.status = S_OK;
 #endif
-        if (copy_to_user((char *)arg, &res, sizeof(gdth_ioctl_reset)))
+        if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset)))
             return -EFAULT;
         break;
       }
 
       case GDTIOCTL_RESET_DRV:
-	return ioc_resetdrv(arg, cmnd);
+        return ioc_resetdrv(argp, cmnd);
 
       default:
         break; 
     }
     return 0;
 }
-#endif
 
-#if LINUX_VERSION_CODE >= 0x010300
+
 /* flush routine */
 static void gdth_flush(int hanum)
 {
     int             i;
     gdth_ha_str     *ha;
     gdth_cmd_str    gdtcmd;
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     Scsi_Request    *srp;
     Scsi_Device     *sdev;
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     Scsi_Cmnd       *scp;
     Scsi_Device     *sdev;
 #else
@@ -5643,14 +6063,14 @@
     TRACE2(("gdth_flush() hanum %d\n",hanum));
     ha = HADATA(gdth_ctr_tab[hanum]);
 
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
     srp  = scsi_allocate_request(sdev, GFP_KERNEL);
     if (!srp)
         return;
     srp->sr_cmd_len = 12;
     srp->sr_use_sg = 0;
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
     scp  = scsi_allocate_device(sdev, 1, FALSE);
     if (!scp)
@@ -5670,42 +6090,44 @@
             gdtcmd.BoardNode = LOCALBOARD;
             gdtcmd.Service = CACHESERVICE;
             gdtcmd.OpCode = GDT_FLUSH;
-            gdtcmd.u.cache.DeviceNo = i;
-            gdtcmd.u.cache.BlockNo = 1;
-            gdtcmd.u.cache.sg_canz = 0;
+            if (ha->cache_feat & GDT_64BIT) { 
+                gdtcmd.u.cache64.DeviceNo = i;
+                gdtcmd.u.cache64.BlockNo = 1;
+                gdtcmd.u.cache64.sg_canz = 0;
+            } else {
+                gdtcmd.u.cache.DeviceNo = i;
+                gdtcmd.u.cache.BlockNo = 1;
+                gdtcmd.u.cache.sg_canz = 0;
+            }
             TRACE2(("gdth_flush(): flush ha %d drive %d\n", hanum, i));
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
             gdth_do_req(srp, &gdtcmd, cmnd, 30);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
             gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
 #else
             gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
 #endif
         }
     }
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     scsi_release_request(srp);
     scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     scsi_release_command(scp);
     scsi_free_host_dev(sdev);
 #endif
 }
 
 /* shutdown routine */
-#if LINUX_VERSION_CODE >= 0x020100
 static int gdth_halt(struct notifier_block *nb, ulong event, void *buf)
-#else
-void gdth_halt(void)
-#endif
 {
     int             hanum;
 #ifndef __alpha__
     gdth_cmd_str    gdtcmd;
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     Scsi_Request    *srp;
     Scsi_Device     *sdev;
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     Scsi_Cmnd       *scp;
     Scsi_Device     *sdev;
 #else
@@ -5715,20 +6137,11 @@
     char            cmnd[MAX_COMMAND_SIZE];   
 #endif
 
-#if LINUX_VERSION_CODE >= 0x020100
     TRACE2(("gdth_halt() event %d\n",(int)event));
     if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF)
         return NOTIFY_DONE;
-#else
-    TRACE2(("gdth_halt()\n"));
-    if (halt_called) {
-        TRACE2(("already called\n"));
-        return;
-    }
-    halt_called = TRUE;
-#endif
 
-    printk("GDT: Flushing all host drives .. ");
+    printk("GDT-HA: Flushing all host drives .. ");
     for (hanum = 0; hanum < gdth_ctr_count; ++hanum) {
         gdth_flush(hanum);
 
@@ -5739,32 +6152,24 @@
         gdtcmd.Service = CACHESERVICE;
         gdtcmd.OpCode = GDT_RESET;
         TRACE2(("gdth_halt(): reset controller %d\n", hanum));
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
         srp  = scsi_allocate_request(sdev, GFP_KERNEL);
         if (!srp) {
-#if LINUX_VERSION_CODE >= 0x020100
             unregister_reboot_notifier(&gdth_notifier);
             return NOTIFY_OK;
-#else
-            return;
-#endif
         }
         srp->sr_cmd_len = 12;
         srp->sr_use_sg = 0;
         gdth_do_req(srp, &gdtcmd, cmnd, 10);
         scsi_release_request(srp);
         scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
         sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
         scp  = scsi_allocate_device(sdev, 1, FALSE);
         if (!scp) {
-#if LINUX_VERSION_CODE >= 0x020100
             unregister_reboot_notifier(&gdth_notifier);
             return NOTIFY_OK;
-#else
-            return;
-#endif
         }
         scp->cmd_len = 12;
         scp->use_sg = 0;
@@ -5786,15 +6191,12 @@
 #ifdef GDTH_STATISTICS
     del_timer(&gdth_timer);
 #endif
-#if LINUX_VERSION_CODE >= 0x020100
     unregister_reboot_notifier(&gdth_notifier);
     return NOTIFY_OK;
-#endif
 }
-#endif
 
 
-#if LINUX_VERSION_CODE < 0x020400 && !defined(MODULE)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) && !defined(MODULE)
 
 GDTH_INITFUNC(void, gdth_setup(char *str,int *ints)) 
 {    
@@ -5805,33 +6207,36 @@
 
 #else
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 static Scsi_Host_Template driver_template = {
-#if LINUX_VERSION_CODE >= 0x02015F
-	.proc_name		= "gdth", 
-#else
-	.proc_dir		= &proc_scsi_gdth,
+        .proc_name              = "gdth", 
+        .proc_info              = gdth_proc_info,
+        .name                   = "GDT SCSI Disk Array Controller",
+        .detect                 = gdth_detect, 
+        .release                = gdth_release,
+        .info                   = gdth_info, 
+        .queuecommand           = gdth_queuecommand,
+        .eh_abort_handler       = gdth_eh_abort, 
+        .eh_device_reset_handler = gdth_eh_device_reset,
+        .eh_bus_reset_handler   = gdth_eh_bus_reset,
+        .eh_host_reset_handler  = gdth_eh_host_reset,
+        .bios_param             = gdth_bios_param,
+        .can_queue              = GDTH_MAXCMDS,
+        .this_id                = -1,
+        .sg_tablesize           = GDTH_MAXSG,
+        .cmd_per_lun            = GDTH_MAXC_P_L,
+        .unchecked_isa_dma      = 1,
+        .use_clustering         = ENABLE_CLUSTERING,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+        .use_new_eh_code        = 1,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+        .highmem_io             = 1,
 #endif
-	.proc_info		= gdth_proc_info,
-	.name			= "GDT SCSI Disk Array Controller",
-	.detect			= gdth_detect, 
-	.release		= gdth_release,
-	.info			= gdth_info, 
-	.queuecommand		= gdth_queuecommand,
-	.eh_abort_handler	= gdth_eh_abort, 
-	.eh_device_reset_handler = gdth_eh_device_reset,
-	.eh_bus_reset_handler	= gdth_eh_bus_reset,
-	.eh_host_reset_handler	= gdth_eh_host_reset,
-	.bios_param		= gdth_bios_param,
-	.can_queue		= GDTH_MAXCMDS,
-	.this_id		= -1,
-	.sg_tablesize		= GDTH_MAXSG,
-	.cmd_per_lun		= GDTH_MAXC_P_L,
-	.unchecked_isa_dma	= 1,
-	.use_clustering		= ENABLE_CLUSTERING,
-#if LINUX_VERSION_CODE < 0x020501
-	.use_new_eh_code	= 1,
 #endif
 };
+#else
+static Scsi_Host_Template driver_template = GDTH;
+#endif
 
 #include "scsi_module.c"
 #ifndef MODULE
diff -Nru a/drivers/scsi/gdth.h b/drivers/scsi/gdth.h
--- a/drivers/scsi/gdth.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/gdth.h	Tue Jun 15 22:20:39 2004
@@ -10,7 +10,7 @@
  *
  * <achim_leubner@adaptec.com>
  *
- * $Id: gdth.h,v 1.50 2003/09/17 08:29:58 achim Exp $
+ * $Id: gdth.h,v 1.57 2004/03/31 11:52:09 achim Exp $
  */
 
 #include <linux/version.h>
@@ -26,9 +26,9 @@
 /* defines, macros */
 
 /* driver version */
-#define GDTH_VERSION_STR        "2.08"
-#define GDTH_VERSION            2
-#define GDTH_SUBVERSION         8
+#define GDTH_VERSION_STR        "3.04"
+#define GDTH_VERSION            3
+#define GDTH_SUBVERSION         4
 
 /* protocol version */
 #define PROTOCOL_VERSION        1
@@ -133,7 +133,12 @@
 /* new GDT Rx Controller */
 #define PCI_DEVICE_ID_VORTEX_GDTNEWRX   0x300
 #endif
-        
+
+#ifndef PCI_DEVICE_ID_VORTEX_GDTNEWRX2
+/* new(2) GDT Rx Controller */
+#define PCI_DEVICE_ID_VORTEX_GDTNEWRX2  0x301
+#endif        
+
 #ifndef PCI_DEVICE_ID_INTEL_SRC
 /* Intel Storage RAID Controller */
 #define PCI_DEVICE_ID_INTEL_SRC         0x600
@@ -146,8 +151,7 @@
 
 /* limits */
 #define GDTH_SCRATCH    PAGE_SIZE               /* 4KB scratch buffer */
-#define GDTH_SCRATCH_ORD 0                      /* order 0 means 1 page */
-#define GDTH_MAXCMDS    124
+#define GDTH_MAXCMDS    120
 #define GDTH_MAXC_P_L   16                      /* max. cmds per lun */
 #define GDTH_MAX_RAW    2                       /* max. cmds per raw device */
 #define MAXOFFSETS      128
@@ -221,6 +225,8 @@
 #define GDT_CLUST_RESET 24                      /* releases the cluster drives*/
 #define GDT_FREEZE_IO   25                      /* freezes all IOs */
 #define GDT_UNFREEZE_IO 26                      /* unfreezes all IOs */
+#define GDT_X_INIT_HOST 29                      /* ext. init: 64 bit support */
+#define GDT_X_INFO      30                      /* ext. info for drives>2TB */
 
 /* raw service commands */
 #define GDT_RESERVE     14                      /* reserve dev. to raw serv. */
@@ -230,9 +236,11 @@
 #define GDT_RESET_BUS   18                      /* reset bus */
 #define GDT_SCAN_START  19                      /* start device scan */
 #define GDT_SCAN_END    20                      /* stop device scan */  
+#define GDT_X_INIT_RAW  21                      /* ext. init: 64 bit support */
 
 /* screen service commands */
 #define GDT_REALTIME    3                       /* realtime clock to screens. */
+#define GDT_X_INIT_SCR  4                       /* ext. init: 64 bit support */
 
 /* IOCTL command defines */
 #define SCSI_DR_INFO    0x00                    /* SCSI drive info */                   
@@ -254,6 +262,8 @@
 #define CACHE_DRV_INFO  0x07                    /* cache drive info */
 #define BOARD_FEATURES  0x15                    /* controller features */
 #define BOARD_INFO      0x28                    /* controller info */
+#define SET_PERF_MODES  0x82                    /* set mode (coalescing,..) */
+#define GET_PERF_MODES  0x83                    /* get mode */
 #define CACHE_READ_OEM_STRING_RECORD 0x84       /* read OEM string record */ 
 #define HOST_GET        0x10001L                /* get host drive list */
 #define IO_CHANNEL      0x00020000L             /* default IO channel */
@@ -266,6 +276,7 @@
 #define S_CACHE_UNKNOWN 12                      /* cache serv.: drive unknown */
 #define S_RAW_SCSI      12                      /* raw serv.: target error */
 #define S_RAW_ILL       0xff                    /* raw serv.: illegal */
+#define S_NOFUNC        -2                      /* unknown function */
 #define S_CACHE_RESERV  -24                     /* cache: reserv. conflict */   
 
 /* timeout values */
@@ -307,7 +318,12 @@
 #define LOCALBOARD      0                       /* board node always 0 */
 #define ASYNCINDEX      0                       /* cmd index async. event */
 #define SPEZINDEX       1                       /* cmd index unknown service */
+#define COALINDEX       (GDTH_MAXCMDS + 2)
+
+/* features */
+#define SCATTER_GATHER  1                       /* s/g feature */
 #define GDT_WR_THROUGH  0x100                   /* WRITE_THROUGH supported */
+#define GDT_64BIT       0x200                   /* 64bit / drv>2TB support */
 
 #include "gdth_ioctl.h"
 
@@ -322,7 +338,40 @@
     char        msg_text[MSGLEN+2];             /* the message text */
 } PACKED gdth_msg_str;
 
+
 /* IOCTL data structures */
+
+/* Status coalescing buffer for returning multiple requests per interrupt */
+typedef struct {
+    ulong32     status;
+    ulong32     ext_status;
+    ulong32     info0;
+    ulong32     info1;
+} PACKED gdth_coal_status;
+
+/* performance mode data structure */
+typedef struct {
+    ulong32     version;            /* The version of this IOCTL structure. */
+    ulong32     st_mode;            /* 0=dis., 1=st_buf_addr1 valid, 2=both  */
+    ulong32     st_buff_addr1;      /* physical address of status buffer 1 */
+    ulong32     st_buff_u_addr1;    /* reserved for 64 bit addressing */
+    ulong32     st_buff_indx1;      /* reserved command idx. for this buffer */
+    ulong32     st_buff_addr2;      /* physical address of status buffer 1 */
+    ulong32     st_buff_u_addr2;    /* reserved for 64 bit addressing */
+    ulong32     st_buff_indx2;      /* reserved command idx. for this buffer */
+    ulong32     st_buff_size;       /* size of each buffer in bytes */
+    ulong32     cmd_mode;           /* 0 = mode disabled, 1 = cmd_buff_addr1 */ 
+    ulong32     cmd_buff_addr1;     /* physical address of cmd buffer 1 */   
+    ulong32     cmd_buff_u_addr1;   /* reserved for 64 bit addressing */
+    ulong32     cmd_buff_indx1;     /* cmd buf addr1 unique identifier */
+    ulong32     cmd_buff_addr2;     /* physical address of cmd buffer 1 */   
+    ulong32     cmd_buff_u_addr2;   /* reserved for 64 bit addressing */
+    ulong32     cmd_buff_indx2;     /* cmd buf addr1 unique identifier */
+    ulong32     cmd_buff_size;      /* size of each cmd bufer in bytes */
+    ulong32     reserved1;
+    ulong32     reserved2;
+} PACKED gdth_perf_modes;
+
 /* SCSI drive info */
 typedef struct {
     unchar      vendor[8];                      /* vendor string */
@@ -795,9 +844,7 @@
 
 /* PCI resources */
 typedef struct {
-#if LINUX_VERSION_CODE >= 0x02015C
     struct pci_dev      *pdev;
-#endif
     ushort              vendor_id;              /* vendor (ICP, Intel, ..) */
     ushort              device_id;              /* device ID (0,..,9) */
     ushort              subdevice_id;           /* sub device ID */
@@ -814,20 +861,28 @@
 typedef struct {
     ushort              oem_id;                 /* OEM */
     ushort              type;                   /* controller class */
-    ushort              raw_feat;               /* feat. raw service (s/g,..) */
     ulong32             stype;                  /* subtype (PCI: device ID) */
     ushort              subdevice_id;           /* sub device ID (PCI) */
     ushort              fw_vers;                /* firmware version */
-    ushort              cache_feat;             /* feat. cache serv. (s/g,..) */
+    ushort              cache_feat;             /* feat. cache serv. (s/g,..)*/
+    ushort              raw_feat;               /* feat. raw service (s/g,..)*/
+    ushort              screen_feat;            /* feat. raw service (s/g,..)*/
     ushort              bmic;                   /* BMIC address (EISA) */
     void                *brd;                   /* DPRAM address */
     ulong32             brd_phys;               /* slot number/BIOS address */
     gdt6c_plx_regs      *plx;                   /* PLX regs (new PCI contr.) */
     gdth_cmd_str        *pccb;                  /* address command structure */
     ulong32             ccb_phys;               /* phys. address */
+#ifdef INT_COAL
+    gdth_coal_status    *coal_stat;             /* buffer for coalescing int.*/
+    ulong64             coal_stat_phys;         /* phys. address */
+#endif
     char                *pscratch;              /* scratch (DMA) buffer */
-    ulong32             scratch_phys;           /* phys. address */
+    ulong64             scratch_phys;           /* phys. address */
     unchar              scratch_busy;           /* in use? */
+    unchar              dma64_support;          /* 64-bit DMA supported? */
+    gdth_msg_str        *pmsg;                  /* message buffer */
+    ulong64             msg_phys;               /* phys. address */
     unchar              scan_mode;              /* current scan mode */
     unchar              irq;                    /* IRQ */
     unchar              drq;                    /* DRQ (ISA controllers) */
@@ -848,11 +903,11 @@
         unchar          heads;                  /* mapping */
         unchar          secs;
         ushort          devtype;                /* further information */
-        ulong32         size;                   /* capacity */
+        ulong64         size;                   /* capacity */
         unchar          ldr_no;                 /* log. drive no. */
         unchar          rw_attribs;             /* r/w attributes */
         unchar          cluster_type;           /* cluster properties */
-        unchar          media_changed;          /* Flag:MOUNT/UNMOUNT occurred*/
+        unchar          media_changed;          /* Flag:MOUNT/UNMOUNT occured */
         ulong32         start_sec;              /* start sector */
     } hdr[MAX_LDRIVES];                         /* host drives */
     struct {
@@ -880,13 +935,19 @@
     gdth_bfeat_str      bfeat;                  /* controller features */
     gdth_binfo_str      binfo;                  /* controller info */
     gdth_evt_data       dvr;                    /* event structure */
-#if LINUX_VERSION_CODE >= 0x02015F
     spinlock_t          smp_lock;
-#endif
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     struct pci_dev      *pdev;
 #endif
     char                oem_name[8];
+#ifdef GDTH_DMA_STATISTICS
+    ulong               dma32_cnt, dma64_cnt;   /* statistics: DMA buffer */
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    Scsi_Device         *sdev;
+#else
+    Scsi_Device         sdev;
+#endif
 } gdth_ha_str;
 
 /* structure for scsi_register(), SCSI bus != 0 */
@@ -924,6 +985,12 @@
     ulong32     block_length;
 } PACKED gdth_rdcap_data;
 
+/* READ_CAPACITY (16) data format */
+typedef struct {
+    ulong64     last_block_no;
+    ulong32     block_length;
+} PACKED gdth_rdcap16_data;
+
 /* REQUEST_SENSE data format */
 typedef struct {
     unchar      errorcode;
@@ -965,42 +1032,48 @@
 int gdth_detect(Scsi_Host_Template *);
 int gdth_release(struct Scsi_Host *);
 int gdth_queuecommand(Scsi_Cmnd *,void (*done)(Scsi_Cmnd *));
-int gdth_abort(Scsi_Cmnd *);
-#if LINUX_VERSION_CODE >= 0x010346
-int gdth_reset(Scsi_Cmnd *, unsigned int reset_flags);
-#else
-int gdth_reset(Scsi_Cmnd *);
-#endif
 const char *gdth_info(struct Scsi_Host *);
 
-#if LINUX_VERSION_CODE >= 0x020501
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 int gdth_bios_param(struct scsi_device *,struct block_device *,sector_t,int *);
 int gdth_proc_info(struct Scsi_Host *, char *,char **,off_t,int,int);
-int gdth_eh_abort(Scsi_Cmnd *scp);
-int gdth_eh_device_reset(Scsi_Cmnd *scp);
-int gdth_eh_bus_reset(Scsi_Cmnd *scp);
-int gdth_eh_host_reset(Scsi_Cmnd *scp);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 int gdth_bios_param(Disk *,kdev_t,int *);
 int gdth_proc_info(char *,char **,off_t,int,int,int);
-int gdth_eh_abort(Scsi_Cmnd *scp);
-int gdth_eh_device_reset(Scsi_Cmnd *scp);
-int gdth_eh_bus_reset(Scsi_Cmnd *scp);
-int gdth_eh_host_reset(Scsi_Cmnd *scp);
-#elif LINUX_VERSION_CODE >= 0x02015F
+#else
 int gdth_bios_param(Disk *,kdev_t,int *);
 extern struct proc_dir_entry proc_scsi_gdth;
 int gdth_proc_info(char *,char **,off_t,int,int,int);
+int gdth_abort(Scsi_Cmnd *);
+int gdth_reset(Scsi_Cmnd *,unsigned int); 
+#define GDTH { proc_dir:        &proc_scsi_gdth,                 \
+               proc_info:       gdth_proc_info,                  \
+               name:            "GDT SCSI Disk Array Controller",\
+               detect:          gdth_detect,                     \
+               release:         gdth_release,                    \
+               info:            gdth_info,                       \
+               command:         NULL,                            \
+               queuecommand:    gdth_queuecommand,               \
+               eh_abort_handler: gdth_eh_abort,                  \
+               eh_device_reset_handler: gdth_eh_device_reset,    \
+               eh_bus_reset_handler: gdth_eh_bus_reset,          \
+               eh_host_reset_handler: gdth_eh_host_reset,        \
+               abort:           gdth_abort,                      \
+               reset:           gdth_reset,                      \
+               bios_param:      gdth_bios_param,                 \
+               can_queue:       GDTH_MAXCMDS,                    \
+               this_id:         -1,                              \
+               sg_tablesize:    GDTH_MAXSG,                      \
+               cmd_per_lun:     GDTH_MAXC_P_L,                   \
+               present:         0,                               \
+               unchecked_isa_dma: 1,                             \
+               use_clustering:  ENABLE_CLUSTERING,               \
+               use_new_eh_code: 1       /* use new error code */ }    
+#endif
+
 int gdth_eh_abort(Scsi_Cmnd *scp);
 int gdth_eh_device_reset(Scsi_Cmnd *scp);
 int gdth_eh_bus_reset(Scsi_Cmnd *scp);
 int gdth_eh_host_reset(Scsi_Cmnd *scp);
-#elif LINUX_VERSION_CODE >= 0x010300
-int gdth_bios_param(Disk *,kdev_t,int *);
-extern struct proc_dir_entry proc_scsi_gdth;
-int gdth_proc_info(char *,char **,off_t,int,int,int);
-#else
-int gdth_bios_param(Disk *,int,int *);
-#endif
-#endif
 
+#endif
diff -Nru a/drivers/scsi/gdth_ioctl.h b/drivers/scsi/gdth_ioctl.h
--- a/drivers/scsi/gdth_ioctl.h	Tue Jun 15 22:21:02 2004
+++ b/drivers/scsi/gdth_ioctl.h	Tue Jun 15 22:21:02 2004
@@ -2,7 +2,7 @@
 #define _GDTH_IOCTL_H
 
 /* gdth_ioctl.h
- * $Id: gdth_ioctl.h,v 1.11 2003/02/27 14:59:03 achim Exp $
+ * $Id: gdth_ioctl.h,v 1.14 2004/02/19 15:43:15 achim Exp $
  */
 
 /* IOCTLs */
@@ -21,8 +21,8 @@
 #define GDTIOCTL_RESCAN     (GDTIOCTL_MASK |11) /* rescan host drives */
 #define GDTIOCTL_RESET_DRV  (GDTIOCTL_MASK |12) /* reset (remote) drv. res. */
 
-#define GDTIOCTL_MAGIC      0xaffe0004
-#define EVENT_SIZE          294 
+#define GDTIOCTL_MAGIC  0xaffe0004
+#define EVENT_SIZE      294 
 #define GDTH_MAXSG      32                      /* max. s/g elements */
 
 #define MAX_LDRIVES     255                     /* max. log. drive count */
@@ -35,7 +35,9 @@
 /* typedefs */
 #ifdef __KERNEL__
 typedef u32     ulong32;
+typedef u64     ulong64;
 #endif
+
 #define PACKED  __attribute__((packed))
 
 /* scatter/gather element */
@@ -44,6 +46,12 @@
     ulong32     sg_len;                         /* length */
 } PACKED gdth_sg_str;
 
+/* scatter/gather element - 64bit addresses */
+typedef struct {
+    ulong64     sg_ptr;                         /* address */
+    ulong32     sg_len;                         /* length */
+} PACKED gdth_sg64_str;
+
 /* command structure */
 typedef struct {
     ulong32     BoardNode;                      /* board node (always 0) */
@@ -59,17 +67,25 @@
             gdth_sg_str sg_lst[GDTH_MAXSG];     /* s/g list */
         } PACKED cache;                         /* cache service cmd. str. */
         struct {
+            ushort      DeviceNo;               /* number of cache drive */
+            ulong64     BlockNo;                /* block number */
+            ulong32     BlockCnt;               /* block count */
+            ulong64     DestAddr;               /* dest. addr. (if s/g: -1) */
+            ulong32     sg_canz;                /* s/g element count */
+            gdth_sg64_str sg_lst[GDTH_MAXSG];   /* s/g list */
+        } PACKED cache64;                       /* cache service cmd. str. */
+        struct {
             ushort      param_size;             /* size of p_param buffer */
             ulong32     subfunc;                /* IOCTL function */
             ulong32     channel;                /* device */
-            ulong32     p_param;                /* buffer */
+            ulong64     p_param;                /* buffer */
         } PACKED ioctl;                         /* IOCTL command structure */
         struct {
             ushort      reserved;
             union {
                 struct {
                     ulong32  msg_handle;        /* message handle */
-                    ulong32  msg_addr;          /* message buffer address */
+                    ulong64  msg_addr;          /* message buffer address */
                 } PACKED msg;
                 unchar       data[12];          /* buffer for rtc data, ... */
             } su;
@@ -93,6 +109,24 @@
             ulong32     sg_ranz;                /* s/g element count */
             gdth_sg_str sg_lst[GDTH_MAXSG];     /* s/g list */
         } PACKED raw;                           /* raw service cmd. struct. */
+        struct {
+            ushort      reserved;
+            ulong32     direction;              /* data direction */
+            ulong32     mdisc_time;             /* disc. time (0: no timeout)*/
+            ulong32     mcon_time;              /* connect time(0: no to.) */
+            ulong64     sdata;                  /* dest. addr. (if s/g: -1) */
+            ulong32     sdlen;                  /* data length (bytes) */
+            ulong32     clen;                   /* SCSI cmd. length(6,..,16) */
+            unchar      cmd[16];                /* SCSI command */
+            unchar      target;                 /* target ID */
+            unchar      lun;                    /* LUN */
+            unchar      bus;                    /* SCSI bus number */
+            unchar      priority;               /* only 0 used */
+            ulong32     sense_len;              /* sense data length */
+            ulong64     sense_data;             /* sense data addr. */
+            ulong32     sg_ranz;                /* s/g element count */
+            gdth_sg64_str sg_lst[GDTH_MAXSG];   /* s/g list */
+        } PACKED raw64;                         /* raw service cmd. struct. */
     } u;
     /* additional variables */
     unchar      Service;                        /* controller service */
@@ -236,7 +270,6 @@
 } gdth_iord_str;
 #endif
 
-#ifdef GDTH_IOCTL_CHRDEV
 /* GDTIOCTL_GENERAL */
 typedef struct {
     ushort ionode;                              /* controller number */
@@ -244,8 +277,8 @@
     ulong32 info;                               /* error info */ 
     ushort status;                              /* status */
     ulong data_len;                             /* data buffer size */
-    ulong sense_len;	                        /* sense buffer size */
-    gdth_cmd_str command;                       /* command */			
+    ulong sense_len;                            /* sense buffer size */
+    gdth_cmd_str command;                       /* command */                   
 } gdth_ioctl_general;
 
 /* GDTIOCTL_LOCKDRV */
@@ -310,6 +343,5 @@
     ushort number;                              /* bus/host drive number */
     ushort status;                              /* status */
 } gdth_ioctl_reset;
-#endif
 
 #endif
diff -Nru a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
--- a/drivers/scsi/gdth_proc.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/gdth_proc.c	Tue Jun 15 22:20:40 2004
@@ -1,56 +1,80 @@
 /* gdth_proc.c 
- * $Id: gdth_proc.c,v 1.37 2003/09/17 08:31:53 achim Exp $
+ * $Id: gdth_proc.c,v 1.42 2004/03/05 15:50:20 achim Exp $
  */
 
-#if LINUX_VERSION_CODE >= 0x020407
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
 #include <linux/completion.h>
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length,   
                    int inout)
 {
     int hanum,busnum;
 
-    TRACE2(("gdth_proc_info() length %d ha %d offs %d inout %d\n",
-            length,hostno,(int)offset,inout));
+    TRACE2(("gdth_proc_info() length %d offs %d inout %d\n",
+            length,(int)offset,inout));
 
     hanum = NUMDATA(host)->hanum;
     busnum= NUMDATA(host)->busnum;
 
     if (inout)
-        return(gdth_set_info(buffer,length,hanum,busnum));
+        return(gdth_set_info(buffer,length,host,hanum,busnum));
     else
-        return(gdth_get_info(buffer,start,offset,length,hanum,busnum));
+        return(gdth_get_info(buffer,start,offset,length,host,hanum,busnum));
 }
+#else
+int gdth_proc_info(char *buffer,char **start,off_t offset,int length,int hostno,   
+                   int inout)
+{
+    int hanum,busnum,i;
+
+    TRACE2(("gdth_proc_info() length %d offs %d inout %d\n",
+            length,(int)offset,inout));
+
+    for (i = 0; i < gdth_ctr_vcount; ++i) {
+        if (gdth_ctr_vtab[i]->host_no == hostno)
+            break;
+    }
+    if (i == gdth_ctr_vcount)
+        return(-EINVAL);
+
+    hanum = NUMDATA(gdth_ctr_vtab[i])->hanum;
+    busnum= NUMDATA(gdth_ctr_vtab[i])->busnum;
+
+    if (inout)
+        return(gdth_set_info(buffer,length,gdth_ctr_vtab[i],hanum,busnum));
+    else
+        return(gdth_get_info(buffer,start,offset,length,
+                             gdth_ctr_vtab[i],hanum,busnum));
+}
+#endif
 
-static int gdth_set_info(char *buffer,int length,int hanum,int busnum)
+static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host,
+                         int hanum,int busnum)
 {
     int             ret_val = -EINVAL;
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     Scsi_Request    *scp;
     Scsi_Device     *sdev;
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     Scsi_Cmnd       *scp;
     Scsi_Device     *sdev;
 #else
     Scsi_Cmnd       scp;
     Scsi_Device     sdev;
 #endif
-#ifdef GDTH_IOCTL_PROC
-    gdth_iowr_str   *piowr;
-    piowr = (gdth_iowr_str *)buffer;
-#endif
     TRACE2(("gdth_set_info() ha %d bus %d\n",hanum,busnum));
 
-#if LINUX_VERSION_CODE >= 0x020503
-    sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    sdev = scsi_get_host_dev(host);
     scp  = scsi_allocate_request(sdev, GFP_KERNEL);
     if (!scp)
         return -ENOMEM;
     scp->sr_cmd_len = 12;
     scp->sr_use_sg = 0;
-#elif LINUX_VERSION_CODE >= 0x020322
-    sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    sdev = scsi_get_host_dev(host);
     scp  = scsi_allocate_device(sdev, 1, FALSE);
     if (!scp)
         return -ENOMEM;
@@ -59,7 +83,7 @@
 #else
     memset(&sdev,0,sizeof(Scsi_Device));
     memset(&scp, 0,sizeof(Scsi_Cmnd));
-    sdev.host = scp.host = gdth_ctr_tab[hanum];
+    sdev.host = scp.host = host;
     sdev.id = scp.target = sdev.host->this_id;
     scp.device = &sdev;
 #endif
@@ -69,32 +93,21 @@
             buffer += 5;
             length -= 5;
             ret_val = gdth_set_asc_info( buffer, length, hanum, scp );
-#ifdef GDTH_IOCTL_PROC
-        } else if (piowr->magic == GDTIOCTL_MAGIC) {
-            ret_val = gdth_set_bin_info( buffer, length, hanum, scp );
-        } else {
-            printk("GDT: Wrong signature %x (%x required)!\n",
-                   piowr->magic, GDTIOCTL_MAGIC);
-            if (piowr->magic > GDTIOCTL_MAGIC)
-                printk("GDT: Please update your driver.\n");
-            else
-                printk("GDT: Please update your tool.\n");
-#endif
         }
     }
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     scsi_release_request(scp);
     scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     scsi_release_command(scp);
     scsi_free_host_dev(sdev);
 #endif
     return ret_val;
 }
          
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Request *scp)
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp)
 #else
 static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd scp)
@@ -105,7 +118,7 @@
     gdth_ha_str     *ha;
     gdth_cmd_str    gdtcmd;
     gdth_cpar_str   *pcpar;
-    ulong32         paddr;
+    ulong64         paddr;
 
     char            cmnd[MAX_COMMAND_SIZE];
     memset(cmnd, 0xff, 12);
@@ -139,11 +152,16 @@
                 found = TRUE;
                 gdtcmd.Service = CACHESERVICE;
                 gdtcmd.OpCode = GDT_FLUSH;
-                gdtcmd.u.cache.DeviceNo = i;
-                gdtcmd.u.cache.BlockNo = 1;
-#if LINUX_VERSION_CODE >= 0x020503
+                if (ha->cache_feat & GDT_64BIT) {
+                    gdtcmd.u.cache64.DeviceNo = i;
+                    gdtcmd.u.cache64.BlockNo = 1;
+                } else {
+                    gdtcmd.u.cache.DeviceNo = i;
+                    gdtcmd.u.cache.BlockNo = 1;
+                }
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
                 gdth_do_req(scp, &gdtcmd, cmnd, 30);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
                 gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
 #else
                 gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
@@ -199,9 +217,9 @@
         gdtcmd.u.ioctl.subfunc = CACHE_CONFIG;
         gdtcmd.u.ioctl.channel = INVALID_CHANNEL;
         pcpar->write_back = wb_mode==1 ? 0:1;
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         gdth_do_req(scp, &gdtcmd, cmnd, 30);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
         gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
 #else
         gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
@@ -215,562 +233,23 @@
     return(-EINVAL);
 }
 
-#ifdef GDTH_IOCTL_PROC
-#if LINUX_VERSION_CODE >= 0x020503
-static int gdth_set_bin_info(char *buffer,int length,int hanum,Scsi_Request *scp)
-#elif LINUX_VERSION_CODE >= 0x020322
-static int gdth_set_bin_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp)
-#else
-static int gdth_set_bin_info(char *buffer,int length,int hanum,Scsi_Cmnd scp)
-#endif
-{
-    unchar          i, j;
-    ushort          k, hdr_cnt, status;
-    gdth_ha_str     *ha;
-    gdth_iowr_str   *piowr;
-    gdth_iord_str   *piord;
-    gdth_cmd_str    *pcmd;
-    gdth_evt_str    *pevt;
-    ulong32         *ppadd, add_size, *ppadd2, add_size2, info, paddr;
-    ulong           flags;
-    gdth_cmd_str    gdtcmd;
-    int             drv_cyls, drv_hds, drv_secs;
- 
-    char            cmnd[MAX_COMMAND_SIZE];   
-    memset(cmnd, 0xff, 12);
-    memset(&gdtcmd, 0, sizeof(gdth_cmd_str));
-
-    TRACE2(("gdth_set_bin_info() ha %d\n",hanum));
-    ha = HADATA(gdth_ctr_tab[hanum]);
-    piowr = (gdth_iowr_str *)buffer;
-    piord = NULL;
-    pcmd = NULL;
-    ppadd = ppadd2 = NULL;
-    add_size = add_size2 = 0;
-
-    if (length < GDTOFFSOF(gdth_iowr_str,iu))
-        return(-EINVAL);
-
-    switch (piowr->ioctl) {
-      case GDTIOCTL_GENERAL:
-        if (length < GDTOFFSOF(gdth_iowr_str,iu.general.data[0]))
-            return(-EINVAL);
-        pcmd = (gdth_cmd_str *)piowr->iu.general.command;
-        pcmd->Service = piowr->service;
-        if (pcmd->OpCode == GDT_IOCTL) {
-            ppadd = &pcmd->u.ioctl.p_param;
-            add_size = pcmd->u.ioctl.param_size;
-        } else if (piowr->service == CACHESERVICE) {
-            add_size = pcmd->u.cache.BlockCnt * SECTOR_SIZE;
-            if (ha->cache_feat & SCATTER_GATHER) {
-                ppadd = &pcmd->u.cache.sg_lst[0].sg_ptr;
-                pcmd->u.cache.DestAddr = 0xffffffff;
-                pcmd->u.cache.sg_lst[0].sg_len = add_size;
-                pcmd->u.cache.sg_canz = 1;
-            } else {
-                ppadd = &pcmd->u.cache.DestAddr;
-                pcmd->u.cache.sg_canz = 0;
-            }
-        } else if (piowr->service == SCSIRAWSERVICE) {
-            add_size = pcmd->u.raw.sdlen;
-            add_size2 = pcmd->u.raw.sense_len;
-            if (ha->raw_feat & SCATTER_GATHER) {
-                ppadd = &pcmd->u.raw.sg_lst[0].sg_ptr;
-                pcmd->u.raw.sdata = 0xffffffff;
-                pcmd->u.raw.sg_lst[0].sg_len = add_size;
-                pcmd->u.raw.sg_ranz = 1;
-            } else {
-                ppadd = &pcmd->u.raw.sdata;
-                pcmd->u.raw.sg_ranz = 0;
-            }
-            ppadd2 = &pcmd->u.raw.sense_data;
-        } else {
-            return(-EINVAL);
-        }
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str)+add_size+add_size2,
-                               TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str) + add_size + add_size2;
-        if (add_size > 0) {
-            memcpy(piord->iu.general.data, piowr->iu.general.data, add_size);
-            *ppadd = paddr + GDTOFFSOF(gdth_iord_str, iu.general.data[0]);
-        }
-        if (add_size2 > 0) {
-            memcpy(piord->iu.general.data+add_size, piowr->iu.general.data, add_size2);
-            *ppadd2 = paddr + GDTOFFSOF(gdth_iord_str, iu.general.data[0]) + add_size2;
-        }
-        
-        /* do IOCTL */
-#if LINUX_VERSION_CODE >= 0x020503
-        gdth_do_req(scp, pcmd, cmnd, piowr->timeout);
-        piord->status = (scp->sr_command->SCp.Message << 16) |
-            scp->sr_command->SCp.Status;
-#elif LINUX_VERSION_CODE >= 0x020322
-        gdth_do_cmd(scp, pcmd, cmnd, piowr->timeout);
-        piord->status = (scp->SCp.Message<<16)|scp->SCp.Status;
-#else
-        gdth_do_cmd(&scp, pcmd, cmnd, piowr->timeout);
-        piord->status = (scp.SCp.Message<<16)|scp.SCp.Status;
-#endif
-        break;
-
-      case GDTIOCTL_DRVERS:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        piord->iu.drvers.version = (GDTH_VERSION<<8) | GDTH_SUBVERSION;
-        break;
-
-      case GDTIOCTL_CTRTYPE:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        if (ha->type == GDT_ISA || ha->type == GDT_EISA) {
-            piord->iu.ctrtype.type = (unchar)((ha->stype>>20) - 0x10);
-        } else {
-            if (ha->type != GDT_PCIMPR) {
-                piord->iu.ctrtype.type = (unchar)((ha->stype<<4) + 6);
-            } else {
-                piord->iu.ctrtype.type = 
-                    (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe);
-                if (ha->stype >= 0x300)
-                    piord->iu.ctrtype.ext_type = 0x6000 | ha->subdevice_id;
-                else 
-                    piord->iu.ctrtype.ext_type = 0x6000 | ha->stype;
-            }
-            piord->iu.ctrtype.device_id = ha->stype;
-            piord->iu.ctrtype.sub_device_id = ha->subdevice_id;
-        }
-        piord->iu.ctrtype.info = ha->brd_phys;
-        piord->iu.ctrtype.oem_id = ha->oem_id;
-        break;
-
-      case GDTIOCTL_CTRCNT:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        piord->iu.ctrcnt.count = (ushort)gdth_ctr_count;
-        break;
-
-      case GDTIOCTL_OSVERS:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        piord->iu.osvers.version = (unchar)(LINUX_VERSION_CODE >> 16);
-        piord->iu.osvers.subversion = (unchar)(LINUX_VERSION_CODE >> 8);
-        piord->iu.osvers.revision = (ushort)(LINUX_VERSION_CODE & 0xff);
-        break;
-
-      case GDTIOCTL_LOCKDRV:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        for (i = 0; i < piowr->iu.lockdrv.drive_cnt; ++i) {
-            j = piowr->iu.lockdrv.drives[i];
-            if (j >= MAX_HDRIVES || !ha->hdr[j].present) 
-                continue;
-            if (piowr->iu.lockdrv.lock) {
-                GDTH_LOCK_HA(ha, flags);
-                ha->hdr[j].lock = 1;
-                GDTH_UNLOCK_HA(ha, flags);
-                gdth_wait_completion( hanum, ha->bus_cnt, j );
-                gdth_stop_timeout( hanum, ha->bus_cnt, j );
-            } else {
-                GDTH_LOCK_HA(ha, flags);
-                ha->hdr[j].lock = 0;
-                GDTH_UNLOCK_HA(ha, flags);
-                gdth_start_timeout( hanum, ha->bus_cnt, j );
-                gdth_next( hanum );
-            }
-        }
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        break;
-
-      case GDTIOCTL_LOCKCHN:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        i = piowr->iu.lockchn.channel;
-        if (i < ha->bus_cnt) {
-            if (piowr->iu.lockchn.lock) {
-                GDTH_LOCK_HA(ha, flags);
-                ha->raw[i].lock = 1;
-                GDTH_UNLOCK_HA(ha, flags);
-                for (j = 0; j < ha->tid_cnt; ++j) {
-                    gdth_wait_completion( hanum, i, j );
-                    gdth_stop_timeout( hanum, i, j );
-                }
-            } else {
-                GDTH_LOCK_HA(ha, flags);
-                ha->raw[i].lock = 0;
-                GDTH_UNLOCK_HA(ha, flags);
-                for (j = 0; j < ha->tid_cnt; ++j) {
-                    gdth_start_timeout( hanum, i, j );
-                    gdth_next( hanum );
-                }
-            }
-        }
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        break;
-
-      case GDTIOCTL_EVENT:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        if (piowr->iu.event.erase == 0xff) {
-            pevt = (gdth_evt_str *)piowr->iu.event.evt;
-            if (pevt->event_source == ES_TEST) 
-                pevt->event_data.size = sizeof(pevt->event_data.eu.test);
-            else if (pevt->event_source == ES_DRIVER) 
-                pevt->event_data.size = sizeof(pevt->event_data.eu.driver);
-            else if (pevt->event_source == ES_SYNC) 
-                pevt->event_data.size = sizeof(pevt->event_data.eu.sync);
-            else {
-                pevt->event_data.size = sizeof(pevt->event_data.eu.async);
-                gdth_log_event(&pevt->event_data, NULL);
-            }
-            GDTH_LOCK_HA(ha, flags);
-            gdth_store_event(ha, pevt->event_source, pevt->event_idx,
-                             &pevt->event_data);
-            GDTH_UNLOCK_HA(ha, flags);
-        } else if (piowr->iu.event.erase == 0xfe) {
-            gdth_clear_events();
-        } else if (piowr->iu.event.erase == 0) {
-            piord->iu.event.handle = 
-                gdth_read_event(ha,piowr->iu.event.handle,
-                                (gdth_evt_str *)piord->iu.event.evt);
-        } else {
-            piord->iu.event.handle = piowr->iu.event.handle;
-            gdth_readapp_event(ha, (unchar)piowr->iu.event.erase,
-                               (gdth_evt_str *)piord->iu.event.evt);
-        }
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        break;
-      
-      case GDTIOCTL_SCSI:
-#if LINUX_VERSION_CODE >= 0x020503
-        return(-EINVAL);
-#else
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        memcpy(cmnd, piowr->iu.scsi.cmd, 12);
-#if LINUX_VERSION_CODE >= 0x020322
-        scp->target = piowr->iu.scsi.target;
-        scp->channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
-        scp->cmd_len = piowr->iu.scsi.cmd_len;
-        gdth_do_cmd(scp, pcmd, cmnd, piowr->timeout);
-        piord->status = (scp->SCp.Message<<16)|scp->SCp.Status;
-#else
-        scp.target = piowr->iu.scsi.target;
-        scp.channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
-        scp.cmd_len = piowr->iu.scsi.cmd_len;
-        gdth_do_cmd(&scp, pcmd, cmnd, piowr->timeout);
-        piord->status = (scp.SCp.Message<<16)|scp.SCp.Status;
-#endif
-#endif
-        break;
-
-      case GDTIOCTL_RESET_BUS:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-#if LINUX_VERSION_CODE >= 0x02053C
-        {
-            Scsi_Device     *sdev;
-            Scsi_Cmnd       *scmnd;
-
-            sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
-            scmnd= scsi_get_command(sdev, GFP_KERNEL);
-            if (!scmnd)
-                return(-ENOMEM);
-            scmnd->device->host = scp->sr_host; 
-            scmnd->device->channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
-            piord->status = (ulong32)gdth_eh_bus_reset( scmnd );
-            if (piord->status == SUCCESS)
-                piord->status = S_OK;
-            else
-                piord->status = S_GENERR;
-            scsi_put_command(scmnd);
-            scsi_free_host_dev(sdev);
-        }
-#elif LINUX_VERSION_CODE >= 0x020503
-        {
-            Scsi_Cmnd scmnd;
-             
-            scmnd.host = scp->sr_host; 
-            scmnd.channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
-            piord->status = (ulong32)gdth_eh_bus_reset( &scmnd );
-            if (piord->status == SUCCESS)
-                piord->status = S_OK;
-            else
-                piord->status = S_GENERR;
-        }
-#elif LINUX_VERSION_CODE >= 0x020322
-        scp->channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
-        piord->status = (ulong32)gdth_eh_bus_reset( scp );
-        if (piord->status == SUCCESS)
-            piord->status = S_OK;
-        else
-            piord->status = S_GENERR;
-#elif LINUX_VERSION_CODE >= 0x02015F
-        scp.channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
-        piord->status = (ulong32)gdth_eh_bus_reset( &scp );
-        if (piord->status == SUCCESS)
-            piord->status = S_OK;
-        else
-            piord->status = S_GENERR;
-#else
-        piord->status = S_OK;
-#endif
-        break;
-
-      case GDTIOCTL_HDRLIST:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        for (i = 0; i < MAX_HDRIVES; ++i) {
-            if (ha->hdr[i].present) {
-                piord->iu.hdr_list[i].bus = ha->virt_bus;
-                piord->iu.hdr_list[i].target = i;
-                piord->iu.hdr_list[i].lun = 0;
-                piord->iu.hdr_list[i].cluster_type = ha->hdr[i].cluster_type;
-                if (ha->hdr[i].cluster_type & CLUSTER_DRIVE) {  
-                    gdtcmd.Service = CACHESERVICE;
-                    gdtcmd.OpCode = GDT_CLUST_INFO;
-                    gdtcmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
-                    gdth_do_req(scp, &gdtcmd, cmnd, 30);
-                    if (scp->sr_command->SCp.Status == S_OK)
-                        piord->iu.hdr_list[i].cluster_type = 
-                            (unchar)scp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-                    gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-                    if (scp->SCp.Status == S_OK)
-                        piord->iu.hdr_list[i].cluster_type = 
-                            (unchar)scp->SCp.Message;
-#else
-                    gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-                    if (scp.SCp.Status == S_OK)
-                        piord->iu.hdr_list[i].cluster_type = 
-                            (unchar)scp.SCp.Message;
-#endif
-                }
-            } else {
-                piord->iu.hdr_list[i].bus = 0xff;
-            }
-        }
-        break;
-
-      case GDTIOCTL_RESCAN:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        if (piowr->iu.rescan.flag == 0) {
-            /* old method: scan all host drives 
-               re-initialize cache service to get host drive count
-            */
-            gdtcmd.Service = CACHESERVICE;
-            gdtcmd.OpCode = GDT_INIT;
-            gdtcmd.u.cache.DeviceNo = LINUX_OS;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->sr_command->SCp.Status; 
-            info = (ulong32)scp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status; 
-            info = (ulong32)scp->SCp.Message;
-#else
-            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
-#endif
-            if (status != S_OK)
-                break;
-            k = 0;
-            hdr_cnt = (ushort)info;
-        } else {
-            k = piowr->iu.rescan.hdr_no;
-            hdr_cnt = k + 1;
-        }
-        if (hdr_cnt > MAX_HDRIVES)
-            hdr_cnt = MAX_HDRIVES;
-        /* scanning for host drives */
-        for (; k < hdr_cnt; ++k) {
-            /* info about host drive */
-            gdtcmd.Service = CACHESERVICE;
-            gdtcmd.OpCode = GDT_INFO;
-            gdtcmd.u.cache.DeviceNo = k;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->sr_command->SCp.Status; 
-            info = (ulong32)scp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status; 
-            info = (ulong32)scp->SCp.Message;
-#else
-            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
-#endif
-            GDTH_LOCK_HA(ha, flags);
-            piord->iu.hdr_list[k].bus = ha->virt_bus;
-            piord->iu.hdr_list[k].target = k;
-            piord->iu.hdr_list[k].lun = 0;
-            if (status != S_OK) {
-                ha->hdr[k].present = FALSE;
-            } else {
-                ha->hdr[k].present = TRUE;
-                ha->hdr[k].size = info;
-                /* evaluate mapping (sectors per head, heads per cylinder) */
-                ha->hdr[k].size &= ~SECS32;
-                gdth_eval_mapping(ha->hdr[k].size,&drv_cyls,&drv_hds,&drv_secs);
-                ha->hdr[k].heads = (unchar)drv_hds;
-                ha->hdr[k].secs = (unchar)drv_secs;
-                /* round size */
-                ha->hdr[k].size = drv_cyls * drv_hds * drv_secs;
-            }
-            GDTH_UNLOCK_HA(ha, flags);
-            if (status != S_OK)
-                continue;       /* next host drive */
-
-            /* devtype, cluster info, R/W attributes */
-            gdtcmd.Service = CACHESERVICE;
-            gdtcmd.OpCode = GDT_DEVTYPE;
-            gdtcmd.u.cache.DeviceNo = k;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->sr_command->SCp.Status; 
-            info = (ulong32)scp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status; 
-            info = (ulong32)scp->SCp.Message;
-#else
-            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
-#endif
-            GDTH_LOCK_HA(ha, flags);
-            ha->hdr[k].devtype = 0;
-            if (status == S_OK)
-                ha->hdr[k].devtype = (ushort)info;
-            GDTH_UNLOCK_HA(ha, flags);
-
-            gdtcmd.Service = CACHESERVICE;
-            gdtcmd.OpCode = GDT_CLUST_INFO;
-            gdtcmd.u.cache.DeviceNo = k;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->sr_command->SCp.Status; 
-            info = (ulong32)scp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status; 
-            info = (ulong32)scp->SCp.Message;
-#else
-            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
-#endif
-            GDTH_LOCK_HA(ha, flags);
-            ha->hdr[k].cluster_type = 0;
-            if (status == S_OK && !shared_access)
-                ha->hdr[k].cluster_type = (ushort)info;
-            GDTH_UNLOCK_HA(ha, flags);
-            piord->iu.hdr_list[k].cluster_type = ha->hdr[k].cluster_type;
-
-            gdtcmd.Service = CACHESERVICE;
-            gdtcmd.OpCode = GDT_RW_ATTRIBS;
-            gdtcmd.u.cache.DeviceNo = k;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->sr_command->SCp.Status; 
-            info = (ulong32)scp->sr_command->SCp.Message;
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp->SCp.Status; 
-            info = (ulong32)scp->SCp.Message;
-#else
-            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-            status = (ushort)scp.SCp.Status;
-            info = (ulong32)scp.SCp.Message;
-#endif
-            GDTH_LOCK_HA(ha, flags);
-            ha->hdr[k].rw_attribs = 0;
-            if (status == S_OK)
-                ha->hdr[k].rw_attribs = (ushort)info;
-            GDTH_UNLOCK_HA(ha, flags);
-        }
-        break;
-
-      case GDTIOCTL_RESET_DRV:
-        if (!gdth_ioctl_alloc( hanum, sizeof(gdth_iord_str), TRUE, &paddr ))
-            return(-EBUSY);
-        piord = (gdth_iord_str *)ha->pscratch;
-        piord->size = sizeof(gdth_iord_str);
-        piord->status = S_OK;
-        i = piowr->iu.scsi.target;
-        if (ha->hdr[i].present) {
-            gdtcmd.Service = CACHESERVICE;
-            gdtcmd.OpCode = GDT_CLUST_RESET;
-            gdtcmd.u.cache.DeviceNo = i;
-#if LINUX_VERSION_CODE >= 0x020503
-            gdth_do_req(scp, &gdtcmd, cmnd, 30);
-            piord->status = (ushort)scp->sr_command->SCp.Status; 
-#elif LINUX_VERSION_CODE >= 0x020322
-            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-            piord->status = (scp->SCp.Message<<16)|scp->SCp.Status;
-#else
-            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-            piord->status = (scp.SCp.Message<<16)|scp.SCp.Status;
-#endif
-        }
-        break;
-
-      default:
-        return(-EINVAL);
-    }
-    return length;
-}
-#endif
-
-static int gdth_get_info(char *buffer,char **start,off_t offset,
-                         int length,int hanum,int busnum)
+static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
+                         struct Scsi_Host *host,int hanum,int busnum)
 {
     int size = 0,len = 0;
     off_t begin = 0,pos = 0;
     gdth_ha_str *ha;
     int id, i, j, k, sec, flag;
     int no_mdrv = 0, drv_no, is_mirr;
-    ulong32 cnt, paddr;
+    ulong32 cnt;
+    ulong64 paddr;
 
     gdth_cmd_str gdtcmd;
     gdth_evt_str estr;
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     Scsi_Request *scp;
     Scsi_Device *sdev; 
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     Scsi_Cmnd *scp;
     Scsi_Device *sdev;
 #else
@@ -795,15 +274,15 @@
     TRACE2(("gdth_get_info() ha %d bus %d\n",hanum,busnum));
     ha = HADATA(gdth_ctr_tab[hanum]);
 
-#if LINUX_VERSION_CODE >= 0x020503
-    sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+    sdev = scsi_get_host_dev(host);
     scp  = scsi_allocate_request(sdev, GFP_KERNEL);
     if (!scp)
         return -ENOMEM;
     scp->sr_cmd_len = 12;
     scp->sr_use_sg = 0;
-#elif LINUX_VERSION_CODE >= 0x020322
-    sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+    sdev = scsi_get_host_dev(host);
     scp  = scsi_allocate_device(sdev, 1, FALSE);
     if (!scp)
         return -ENOMEM;
@@ -812,485 +291,415 @@
 #else
     memset(&sdev,0,sizeof(Scsi_Device));
     memset(&scp, 0,sizeof(Scsi_Cmnd));
-    sdev.host = scp.host = gdth_ctr_tab[hanum];
+    sdev.host = scp.host = host;
     sdev.id = scp.target = sdev.host->this_id;
     scp.device = &sdev;
 #endif
-
-#ifdef GDTH_IOCTL_PROC
-    /* ioctl from tool? */
-    if (!gdth_ioctl_check_bin(hanum, (ushort)length)) {
-#endif
-        /* request is i.e. "cat /proc/scsi/gdth/0" */ 
-        /* format: %-15s\t%-10s\t%-15s\t%s */
-        /* driver parameters */
-        size = sprintf(buffer+len,"Driver Parameters:\n");
-        len += size;  pos = begin + len;
-        if (reserve_list[0] == 0xff)
-            strcpy(hrec, "--");
-        else {
-            sprintf(hrec, "%d", reserve_list[0]);
-            for (i = 1;  i < MAX_RES_ARGS; i++) {
-                if (reserve_list[i] == 0xff) 
-                    break;
-                sprintf(hrec,"%s,%d", hrec, reserve_list[i]);
-            }
+    
+    
+    /* request is i.e. "cat /proc/scsi/gdth/0" */ 
+    /* format: %-15s\t%-10s\t%-15s\t%s */
+    /* driver parameters */
+    size = sprintf(buffer+len,"Driver Parameters:\n");
+    len += size;  pos = begin + len;
+    if (reserve_list[0] == 0xff)
+        strcpy(hrec, "--");
+    else {
+        sprintf(hrec, "%d", reserve_list[0]);
+        for (i = 1;  i < MAX_RES_ARGS; i++) {
+            if (reserve_list[i] == 0xff) 
+                break;
+            sprintf(hrec,"%s,%d", hrec, reserve_list[i]);
         }
-        size = sprintf(buffer+len,
-                       " reserve_mode: \t%d         \treserve_list:  \t%s\n",
-                       reserve_mode, hrec);
-        len += size;  pos = begin + len;
-        size = sprintf(buffer+len,
-                       " max_ids:      \t%-3d       \thdr_channel:   \t%d\n",
-                       max_ids, hdr_channel);
-        len += size;  pos = begin + len;
+    }
+    size = sprintf(buffer+len,
+                   " reserve_mode: \t%d         \treserve_list:  \t%s\n",
+                   reserve_mode, hrec);
+    len += size;  pos = begin + len;
+    size = sprintf(buffer+len,
+                   " max_ids:      \t%-3d       \thdr_channel:   \t%d\n",
+                   max_ids, hdr_channel);
+    len += size;  pos = begin + len;
+
+    /* controller information */
+    size = sprintf(buffer+len,"\nDisk Array Controller Information:\n");
+    len += size;  pos = begin + len;
+    if (virt_ctr)
+        sprintf(hrec, "%s (Bus %d)", ha->binfo.type_string, busnum);
+    else
+        strcpy(hrec, ha->binfo.type_string);
+    size = sprintf(buffer+len,
+                   " Number:       \t%d         \tName:          \t%s\n",
+                   hanum, hrec);
+    len += size;  pos = begin + len;
+
+    if (ha->more_proc)
+        sprintf(hrec, "%d.%02d.%02d-%c%03X", 
+                (unchar)(ha->binfo.upd_fw_ver>>24),
+                (unchar)(ha->binfo.upd_fw_ver>>16),
+                (unchar)(ha->binfo.upd_fw_ver),
+                ha->bfeat.raid ? 'R':'N',
+                ha->binfo.upd_revision);
+    else
+        sprintf(hrec, "%d.%02d", (unchar)(ha->cpar.version>>8),
+                (unchar)(ha->cpar.version));
 
-        /* controller information */
-        size = sprintf(buffer+len,"\nDisk Array Controller Information:\n");
-        len += size;  pos = begin + len;
-        if (virt_ctr)
-            sprintf(hrec, "%s (Bus %d)", ha->binfo.type_string, busnum);
-        else
-            strcpy(hrec, ha->binfo.type_string);
+    size = sprintf(buffer+len,
+                   " Driver Ver.:  \t%-10s\tFirmware Ver.: \t%s\n",
+                   GDTH_VERSION_STR, hrec);
+    len += size;  pos = begin + len;
+ 
+    if (ha->more_proc) {
+        /* more information: 1. about controller */
         size = sprintf(buffer+len,
-                       " Number:       \t%d         \tName:          \t%s\n",
-                       hanum, hrec);
+                       " Serial No.:   \t0x%8X\tCache RAM size:\t%d KB\n",
+                       ha->binfo.ser_no, ha->binfo.memsize / 1024);
         len += size;  pos = begin + len;
+    }
 
-        if (ha->more_proc)
-            sprintf(hrec, "%d.%02d.%02d-%c%03X", 
-                    (unchar)(ha->binfo.upd_fw_ver>>24),
-                    (unchar)(ha->binfo.upd_fw_ver>>16),
-                    (unchar)(ha->binfo.upd_fw_ver),
-                    ha->bfeat.raid ? 'R':'N',
-                    ha->binfo.upd_revision);
-        else
-            sprintf(hrec, "%d.%02d", (unchar)(ha->cpar.version>>8),
-                    (unchar)(ha->cpar.version));
+#ifdef GDTH_DMA_STATISTICS
+    /* controller statistics */
+    size = sprintf(buffer+len,"\nController Statistics:\n");
+    len += size;  pos = begin + len;
+    size = sprintf(buffer+len,
+                   " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n",
+                   ha->dma32_cnt, ha->dma64_cnt);
+    len += size;  pos = begin + len;
+#endif
 
-        size = sprintf(buffer+len,
-                       " Driver Ver.:  \t%-10s\tFirmware Ver.: \t%s\n",
-                       GDTH_VERSION_STR, hrec);
+    if (pos < offset) {
+        len = 0;
+        begin = pos;
+    }
+    if (pos > offset + length)
+        goto stop_output;
+
+    if (ha->more_proc) {
+        /* more information: 2. about physical devices */
+        size = sprintf(buffer+len,"\nPhysical Devices:");
         len += size;  pos = begin + len;
- 
-        if (pos < offset) {
-            len = 0;
-            begin = pos;
-        }
-        if (pos > offset + length)
+        flag = FALSE;
+            
+        buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr);
+        if (!buf) 
             goto stop_output;
+        for (i = 0; i < ha->bus_cnt; ++i) {
+            /* 2.a statistics (and retries/reassigns) */
+            TRACE2(("pdr_statistics() chn %d\n",i));                
+            pds = (gdth_dskstat_str *)(buf + GDTH_SCRATCH/4);
+            gdtcmd.Service = CACHESERVICE;
+            gdtcmd.OpCode = GDT_IOCTL;
+            gdtcmd.u.ioctl.p_param = paddr + GDTH_SCRATCH/4;
+            gdtcmd.u.ioctl.param_size = 3*GDTH_SCRATCH/4;
+            gdtcmd.u.ioctl.subfunc = DSK_STATISTICS | L_CTRL_PATTERN;
+            gdtcmd.u.ioctl.channel = ha->raw[i].address | INVALID_CHANNEL;
+            pds->bid = ha->raw[i].local_no;
+            pds->first = 0;
+            pds->entries = ha->raw[i].pdev_cnt;
+            cnt = (3*GDTH_SCRATCH/4 - 5 * sizeof(ulong32)) /
+                sizeof(pds->list[0]);
+            if (pds->entries > cnt)
+                pds->entries = cnt;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            gdth_do_req(scp, &gdtcmd, cmnd, 30);
+            if (scp->sr_command->SCp.Status != S_OK) 
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
+            if (scp->SCp.Status != S_OK) 
+#else
+            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
+            if (scp.SCp.Status != S_OK) 
+#endif
+            { 
+                pds->count = 0;
+            }
 
-        if (ha->more_proc) {
-            /* more information: 1. about controller */
-            size = sprintf(buffer+len,
-                           " Serial No.:   \t0x%8X\tCache RAM size:\t%d KB\n",
-                           ha->binfo.ser_no, ha->binfo.memsize / 1024);
-            len += size;  pos = begin + len;
-
-            /* 2. about physical devices */
-            size = sprintf(buffer+len,"\nPhysical Devices:");
-            len += size;  pos = begin + len;
-            flag = FALSE;
-            
-            buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr);
-            if (!buf) 
-                goto stop_output;
-            for (i = 0; i < ha->bus_cnt; ++i) {
-                /* 2.a statistics (and retries/reassigns) */
-                TRACE2(("pdr_statistics() chn %d\n",i));                
-                pds = (gdth_dskstat_str *)(buf + GDTH_SCRATCH/4);
+            /* other IOCTLs must fit into area GDTH_SCRATCH/4 */
+            for (j = 0; j < ha->raw[i].pdev_cnt; ++j) {
+                /* 2.b drive info */
+                TRACE2(("scsi_drv_info() chn %d dev %d\n",
+                    i, ha->raw[i].id_list[j]));             
+                pdi = (gdth_diskinfo_str *)buf;
                 gdtcmd.Service = CACHESERVICE;
                 gdtcmd.OpCode = GDT_IOCTL;
-                gdtcmd.u.ioctl.p_param = paddr + GDTH_SCRATCH/4;
-                gdtcmd.u.ioctl.param_size = 3*GDTH_SCRATCH/4;
-                gdtcmd.u.ioctl.subfunc = DSK_STATISTICS | L_CTRL_PATTERN;
-                gdtcmd.u.ioctl.channel = ha->raw[i].address | INVALID_CHANNEL;
-                pds->bid = ha->raw[i].local_no;
-                pds->first = 0;
-                pds->entries = ha->raw[i].pdev_cnt;
-                cnt = (3*GDTH_SCRATCH/4 - 5 * sizeof(ulong32)) /
-                    sizeof(pds->list[0]);
-                if (pds->entries > cnt)
-                    pds->entries = cnt;
-#if LINUX_VERSION_CODE >= 0x020503
+                gdtcmd.u.ioctl.p_param = paddr;
+                gdtcmd.u.ioctl.param_size = sizeof(gdth_diskinfo_str);
+                gdtcmd.u.ioctl.subfunc = SCSI_DR_INFO | L_CTRL_PATTERN;
+                gdtcmd.u.ioctl.channel = 
+                    ha->raw[i].address | ha->raw[i].id_list[j];
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
                 gdth_do_req(scp, &gdtcmd, cmnd, 30);
-                if (scp->sr_command->SCp.Status != S_OK) 
-#elif LINUX_VERSION_CODE >= 0x020322
+                if (scp->sr_command->SCp.Status == S_OK) 
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
                 gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-                if (scp->SCp.Status != S_OK) 
+                if (scp->SCp.Status == S_OK) 
 #else
                 gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-                if (scp.SCp.Status != S_OK) 
+                if (scp.SCp.Status == S_OK) 
 #endif
-                { 
-                    pds->count = 0;
+                {
+                    strncpy(hrec,pdi->vendor,8);
+                    strncpy(hrec+8,pdi->product,16);
+                    strncpy(hrec+24,pdi->revision,4);
+                    hrec[28] = 0;
+                    size = sprintf(buffer+len,
+                                   "\n Chn/ID/LUN:   \t%c/%02d/%d    \tName:          \t%s\n",
+                                   'A'+i,pdi->target_id,pdi->lun,hrec);
+                    len += size;  pos = begin + len;
+                    flag = TRUE;
+                    pdi->no_ldrive &= 0xffff;
+                    if (pdi->no_ldrive == 0xffff)
+                        strcpy(hrec,"--");
+                    else
+                        sprintf(hrec,"%d",pdi->no_ldrive);
+                    size = sprintf(buffer+len,
+                                   " Capacity [MB]:\t%-6d    \tTo Log. Drive: \t%s\n",
+                                   pdi->blkcnt/(1024*1024/pdi->blksize),
+                                   hrec);
+                    len += size;  pos = begin + len;
+                } else {
+                    pdi->devtype = 0xff;
                 }
-
-                /* other IOCTLs must fit into area GDTH_SCRATCH/4 */
-                for (j = 0; j < ha->raw[i].pdev_cnt; ++j) {
-                    /* 2.b drive info */
-                    TRACE2(("scsi_drv_info() chn %d dev %d\n",
-                        i, ha->raw[i].id_list[j]));             
-                    pdi = (gdth_diskinfo_str *)buf;
-                    gdtcmd.Service = CACHESERVICE;
-                    gdtcmd.OpCode = GDT_IOCTL;
-                    gdtcmd.u.ioctl.p_param = paddr;
-                    gdtcmd.u.ioctl.param_size = sizeof(gdth_diskinfo_str);
-                    gdtcmd.u.ioctl.subfunc = SCSI_DR_INFO | L_CTRL_PATTERN;
-                    gdtcmd.u.ioctl.channel = 
-                        ha->raw[i].address | ha->raw[i].id_list[j];
-#if LINUX_VERSION_CODE >= 0x020503
-                    gdth_do_req(scp, &gdtcmd, cmnd, 30);
-                    if (scp->sr_command->SCp.Status == S_OK) 
-#elif LINUX_VERSION_CODE >= 0x020322
-                    gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-                    if (scp->SCp.Status == S_OK) 
-#else
-                    gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-                    if (scp.SCp.Status == S_OK) 
-#endif
-                    {
-                        strncpy(hrec,pdi->vendor,8);
-                        strncpy(hrec+8,pdi->product,16);
-                        strncpy(hrec+24,pdi->revision,4);
-                        hrec[28] = 0;
-                        size = sprintf(buffer+len,
-                                       "\n Chn/ID/LUN:   \t%c/%02d/%d    \tName:          \t%s\n",
-                                       'A'+i,pdi->target_id,pdi->lun,hrec);
-                        len += size;  pos = begin + len;
-                        flag = TRUE;
-                        pdi->no_ldrive &= 0xffff;
-                        if (pdi->no_ldrive == 0xffff)
-                            strcpy(hrec,"--");
-                        else
-                            sprintf(hrec,"%d",pdi->no_ldrive);
-                        size = sprintf(buffer+len,
-                                       " Capacity [MB]:\t%-6d    \tTo Log. Drive: \t%s\n",
-                                       pdi->blkcnt/(1024*1024/pdi->blksize),
-                                       hrec);
-                        len += size;  pos = begin + len;
-                    } else {
-                        pdi->devtype = 0xff;
-                    }
                     
-                    if (pdi->devtype == 0) {
-                        /* search retries/reassigns */
-                        for (k = 0; k < pds->count; ++k) {
-                            if (pds->list[k].tid == pdi->target_id &&
-                                pds->list[k].lun == pdi->lun) {
-                                size = sprintf(buffer+len,
-                                               " Retries:      \t%-6d    \tReassigns:     \t%d\n",
-                                               pds->list[k].retries,
-                                               pds->list[k].reassigns);
-                                len += size;  pos = begin + len;
-                                break;
-                            }
-                        }
-                        /* 2.c grown defects */
-                        TRACE2(("scsi_drv_defcnt() chn %d dev %d\n",
-                                i, ha->raw[i].id_list[j]));             
-                        pdef = (gdth_defcnt_str *)buf;
-                        gdtcmd.Service = CACHESERVICE;
-                        gdtcmd.OpCode = GDT_IOCTL;
-                        gdtcmd.u.ioctl.p_param = paddr;
-                        gdtcmd.u.ioctl.param_size = sizeof(gdth_defcnt_str);
-                        gdtcmd.u.ioctl.subfunc = SCSI_DEF_CNT | L_CTRL_PATTERN;
-                        gdtcmd.u.ioctl.channel = 
-                            ha->raw[i].address | ha->raw[i].id_list[j];
-                        pdef->sddc_type = 0x08;
-#if LINUX_VERSION_CODE >= 0x020503
-                        gdth_do_req(scp, &gdtcmd, cmnd, 30);
-                        if (scp->sr_command->SCp.Status == S_OK) 
-#elif LINUX_VERSION_CODE >= 0x020322
-                        gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-                        if (scp->SCp.Status == S_OK) 
-#else
-                        gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-                        if (scp.SCp.Status == S_OK) 
-#endif
-                        {
+                if (pdi->devtype == 0) {
+                    /* search retries/reassigns */
+                    for (k = 0; k < pds->count; ++k) {
+                        if (pds->list[k].tid == pdi->target_id &&
+                            pds->list[k].lun == pdi->lun) {
                             size = sprintf(buffer+len,
-                                           " Grown Defects:\t%d\n",
-                                           pdef->sddc_cnt);
+                                           " Retries:      \t%-6d    \tReassigns:     \t%d\n",
+                                           pds->list[k].retries,
+                                           pds->list[k].reassigns);
                             len += size;  pos = begin + len;
+                            break;
                         }
                     }
-                    if (pos < offset) {
-                        len = 0;
-                        begin = pos;
-                    }
-                    if (pos > offset + length)
-                        goto stop_output;
-                }
-            }
-            gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr);
-
-            if (!flag) {
-                size = sprintf(buffer+len, "\n --\n");
-                len += size;  pos = begin + len;
-            }
-
-            /* 3. about logical drives */
-            size = sprintf(buffer+len,"\nLogical Drives:");
-            len += size;  pos = begin + len;
-            flag = FALSE;
-
-            buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr);
-            if (!buf) 
-                goto stop_output;
-            for (i = 0; i < MAX_LDRIVES; ++i) {
-                if (!ha->hdr[i].is_logdrv)
-                    continue;
-                drv_no = i;
-                j = k = 0;
-                is_mirr = FALSE;
-                do {
-                    /* 3.a log. drive info */
-                    TRACE2(("cache_drv_info() drive no %d\n",drv_no));
-                    pcdi = (gdth_cdrinfo_str *)buf;
+                    /* 2.c grown defects */
+                    TRACE2(("scsi_drv_defcnt() chn %d dev %d\n",
+                            i, ha->raw[i].id_list[j]));             
+                    pdef = (gdth_defcnt_str *)buf;
                     gdtcmd.Service = CACHESERVICE;
                     gdtcmd.OpCode = GDT_IOCTL;
                     gdtcmd.u.ioctl.p_param = paddr;
-                    gdtcmd.u.ioctl.param_size = sizeof(gdth_cdrinfo_str);
-                    gdtcmd.u.ioctl.subfunc = CACHE_DRV_INFO;
-                    gdtcmd.u.ioctl.channel = drv_no;
-#if LINUX_VERSION_CODE >= 0x020503
+                    gdtcmd.u.ioctl.param_size = sizeof(gdth_defcnt_str);
+                    gdtcmd.u.ioctl.subfunc = SCSI_DEF_CNT | L_CTRL_PATTERN;
+                    gdtcmd.u.ioctl.channel = 
+                        ha->raw[i].address | ha->raw[i].id_list[j];
+                    pdef->sddc_type = 0x08;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
                     gdth_do_req(scp, &gdtcmd, cmnd, 30);
-                    if (scp->sr_command->SCp.Status != S_OK) 
-#elif LINUX_VERSION_CODE >= 0x020322
+                    if (scp->sr_command->SCp.Status == S_OK) 
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
                     gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-                    if (scp->SCp.Status != S_OK)
+                    if (scp->SCp.Status == S_OK) 
 #else
                     gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-                    if (scp.SCp.Status != S_OK)
+                    if (scp.SCp.Status == S_OK) 
 #endif
                     {
-                        break;
-                    }
-                    pcdi->ld_dtype >>= 16;
-                    j++;
-                    if (pcdi->ld_dtype > 2) {
-                        strcpy(hrec, "missing");
-                    } else if (pcdi->ld_error & 1) {
-                        strcpy(hrec, "fault");
-                    } else if (pcdi->ld_error & 2) {
-                        strcpy(hrec, "invalid");
-                        k++; j--;
-                    } else {
-                        strcpy(hrec, "ok");
-                    }
-                    
-                    if (drv_no == i) {
-                        size = sprintf(buffer+len,
-                                       "\n Number:       \t%-2d        \tStatus:        \t%s\n",
-                                       drv_no, hrec);
-                        len += size;  pos = begin + len;
-                        flag = TRUE;
-                        no_mdrv = pcdi->cd_ldcnt;
-                        if (no_mdrv > 1 || pcdi->ld_slave != -1) {
-                            is_mirr = TRUE;
-                            strcpy(hrec, "RAID-1");
-                        } else if (pcdi->ld_dtype == 0) {
-                            strcpy(hrec, "Disk");
-                        } else if (pcdi->ld_dtype == 1) {
-                            strcpy(hrec, "RAID-0");
-                        } else if (pcdi->ld_dtype == 2) {
-                            strcpy(hrec, "Chain");
-                        } else {
-                            strcpy(hrec, "???");
-                        }
-                        size = sprintf(buffer+len,
-                                       " Capacity [MB]:\t%-6d    \tType:          \t%s\n",
-                                       pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize),
-                                       hrec);
-                        len += size;  pos = begin + len;
-                    } else {
                         size = sprintf(buffer+len,
-                                       " Slave Number: \t%-2d        \tStatus:        \t%s\n",
-                                       drv_no & 0x7fff, hrec);
+                                       " Grown Defects:\t%d\n",
+                                       pdef->sddc_cnt);
                         len += size;  pos = begin + len;
                     }
-                    drv_no = pcdi->ld_slave;
-                    if (pos < offset) {
-                        len = 0;
-                        begin = pos;
-                    }
-                    if (pos > offset + length)
-                        goto stop_output;
-                } while (drv_no != -1);
-                
-                if (is_mirr) {
-                    size = sprintf(buffer+len,
-                                   " Missing Drv.: \t%-2d        \tInvalid Drv.:  \t%d\n",
-                                   no_mdrv - j - k, k);
-                    len += size;  pos = begin + len;
                 }
-                
-                if (!ha->hdr[i].is_arraydrv)
-                    strcpy(hrec, "--");
-                else
-                    sprintf(hrec, "%d", ha->hdr[i].master_no);
-                size = sprintf(buffer+len,
-                               " To Array Drv.:\t%s\n", hrec);
-                len += size;  pos = begin + len;
                 if (pos < offset) {
                     len = 0;
                     begin = pos;
                 }
                 if (pos > offset + length)
                     goto stop_output;
-            }       
-            gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr);
-        
-            if (!flag) {
-                size = sprintf(buffer+len, "\n --\n");
-                len += size;  pos = begin + len;
-            }   
+            }
+        }
+        gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr);
 
-            /* 4. about array drives */
-            size = sprintf(buffer+len,"\nArray Drives:");
+        if (!flag) {
+            size = sprintf(buffer+len, "\n --\n");
             len += size;  pos = begin + len;
-            flag = FALSE;
+        }
 
-            buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr);
-            if (!buf) 
-                goto stop_output;
-            for (i = 0; i < MAX_LDRIVES; ++i) {
-                if (!(ha->hdr[i].is_arraydrv && ha->hdr[i].is_master))
-                    continue;
-                /* 4.a array drive info */
-                TRACE2(("array_info() drive no %d\n",i));
-                pai = (gdth_arrayinf_str *)buf;
+        /* 3. about logical drives */
+        size = sprintf(buffer+len,"\nLogical Drives:");
+        len += size;  pos = begin + len;
+        flag = FALSE;
+
+        buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr);
+        if (!buf) 
+            goto stop_output;
+        for (i = 0; i < MAX_LDRIVES; ++i) {
+            if (!ha->hdr[i].is_logdrv)
+                continue;
+            drv_no = i;
+            j = k = 0;
+            is_mirr = FALSE;
+            do {
+                /* 3.a log. drive info */
+                TRACE2(("cache_drv_info() drive no %d\n",drv_no));
+                pcdi = (gdth_cdrinfo_str *)buf;
                 gdtcmd.Service = CACHESERVICE;
                 gdtcmd.OpCode = GDT_IOCTL;
                 gdtcmd.u.ioctl.p_param = paddr;
-                gdtcmd.u.ioctl.param_size = sizeof(gdth_arrayinf_str);
-                gdtcmd.u.ioctl.subfunc = ARRAY_INFO | LA_CTRL_PATTERN;
-                gdtcmd.u.ioctl.channel = i;
-#if LINUX_VERSION_CODE >= 0x020503
+                gdtcmd.u.ioctl.param_size = sizeof(gdth_cdrinfo_str);
+                gdtcmd.u.ioctl.subfunc = CACHE_DRV_INFO;
+                gdtcmd.u.ioctl.channel = drv_no;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
                 gdth_do_req(scp, &gdtcmd, cmnd, 30);
-                if (scp->sr_command->SCp.Status == S_OK) 
-#elif LINUX_VERSION_CODE >= 0x020322
+                if (scp->sr_command->SCp.Status != S_OK) 
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
                 gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-                if (scp->SCp.Status == S_OK) 
+                if (scp->SCp.Status != S_OK)
 #else
                 gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-                if (scp.SCp.Status == S_OK) 
+                if (scp.SCp.Status != S_OK)
 #endif
                 {
-                    if (pai->ai_state == 0)
-                        strcpy(hrec, "idle");
-                    else if (pai->ai_state == 2)
-                        strcpy(hrec, "build");
-                    else if (pai->ai_state == 4)
-                        strcpy(hrec, "ready");
-                    else if (pai->ai_state == 6)
-                        strcpy(hrec, "fail");
-                    else if (pai->ai_state == 8 || pai->ai_state == 10)
-                        strcpy(hrec, "rebuild");
-                    else
-                        strcpy(hrec, "error");
-                    if (pai->ai_ext_state & 0x10)
-                        strcat(hrec, "/expand");
-                    else if (pai->ai_ext_state & 0x1)
-                        strcat(hrec, "/patch");
+                    break;
+                }
+                pcdi->ld_dtype >>= 16;
+                j++;
+                if (pcdi->ld_dtype > 2) {
+                    strcpy(hrec, "missing");
+                } else if (pcdi->ld_error & 1) {
+                    strcpy(hrec, "fault");
+                } else if (pcdi->ld_error & 2) {
+                    strcpy(hrec, "invalid");
+                    k++; j--;
+                } else {
+                    strcpy(hrec, "ok");
+                }
+                    
+                if (drv_no == i) {
                     size = sprintf(buffer+len,
                                    "\n Number:       \t%-2d        \tStatus:        \t%s\n",
-                                   i,hrec);
+                                   drv_no, hrec);
                     len += size;  pos = begin + len;
                     flag = TRUE;
-
-                    if (pai->ai_type == 0)
+                    no_mdrv = pcdi->cd_ldcnt;
+                    if (no_mdrv > 1 || pcdi->ld_slave != -1) {
+                        is_mirr = TRUE;
+                        strcpy(hrec, "RAID-1");
+                    } else if (pcdi->ld_dtype == 0) {
+                        strcpy(hrec, "Disk");
+                    } else if (pcdi->ld_dtype == 1) {
                         strcpy(hrec, "RAID-0");
-                    else if (pai->ai_type == 4)
-                        strcpy(hrec, "RAID-4");
-                    else if (pai->ai_type == 5)
-                        strcpy(hrec, "RAID-5");
-                    else 
-                        strcpy(hrec, "RAID-10");
+                    } else if (pcdi->ld_dtype == 2) {
+                        strcpy(hrec, "Chain");
+                    } else {
+                        strcpy(hrec, "???");
+                    }
                     size = sprintf(buffer+len,
                                    " Capacity [MB]:\t%-6d    \tType:          \t%s\n",
-                                   pai->ai_size/(1024*1024/pai->ai_secsize),
+                                   pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize),
                                    hrec);
                     len += size;  pos = begin + len;
-                    if (pos < offset) {
-                        len = 0;
-                        begin = pos;
-                    }
-                    if (pos > offset + length)
-                        goto stop_output;
+                } else {
+                    size = sprintf(buffer+len,
+                                   " Slave Number: \t%-2d        \tStatus:        \t%s\n",
+                                   drv_no & 0x7fff, hrec);
+                    len += size;  pos = begin + len;
                 }
-            }
-            gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr);
-        
-            if (!flag) {
-                size = sprintf(buffer+len, "\n --\n");
+                drv_no = pcdi->ld_slave;
+                if (pos < offset) {
+                    len = 0;
+                    begin = pos;
+                }
+                if (pos > offset + length)
+                    goto stop_output;
+            } while (drv_no != -1);
+             
+            if (is_mirr) {
+                size = sprintf(buffer+len,
+                               " Missing Drv.: \t%-2d        \tInvalid Drv.:  \t%d\n",
+                               no_mdrv - j - k, k);
                 len += size;  pos = begin + len;
             }
-
-            /* 5. about host drives */
-            size = sprintf(buffer+len,"\nHost Drives:");
+              
+            if (!ha->hdr[i].is_arraydrv)
+                strcpy(hrec, "--");
+            else
+                sprintf(hrec, "%d", ha->hdr[i].master_no);
+            size = sprintf(buffer+len,
+                           " To Array Drv.:\t%s\n", hrec);
             len += size;  pos = begin + len;
-            flag = FALSE;
-
-            buf = gdth_ioctl_alloc(hanum, sizeof(gdth_hget_str), FALSE, &paddr);
-            if (!buf) 
+            if (pos < offset) {
+                len = 0;
+                begin = pos;
+            }
+            if (pos > offset + length)
                 goto stop_output;
-            for (i = 0; i < MAX_LDRIVES; ++i) {
-                if (!ha->hdr[i].is_logdrv || 
-                    (ha->hdr[i].is_arraydrv && !ha->hdr[i].is_master))
-                    continue;
-                /* 5.a get host drive list */
-                TRACE2(("host_get() drv_no %d\n",i));           
-                phg = (gdth_hget_str *)buf;
-                gdtcmd.Service = CACHESERVICE;
-                gdtcmd.OpCode = GDT_IOCTL;
-                gdtcmd.u.ioctl.p_param = paddr;
-                gdtcmd.u.ioctl.param_size = sizeof(gdth_hget_str);
-                gdtcmd.u.ioctl.subfunc = HOST_GET | LA_CTRL_PATTERN;
-                gdtcmd.u.ioctl.channel = i;
-                phg->entries = MAX_HDRIVES;
-                phg->offset = GDTOFFSOF(gdth_hget_str, entry[0]); 
-#if LINUX_VERSION_CODE >= 0x020503
-                gdth_do_req(scp, &gdtcmd, cmnd, 30);
-                if (scp->sr_command->SCp.Status != S_OK) 
-#elif LINUX_VERSION_CODE >= 0x020322
-                gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
-                if (scp->SCp.Status != S_OK) 
+        }       
+        gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr);
+        
+        if (!flag) {
+            size = sprintf(buffer+len, "\n --\n");
+            len += size;  pos = begin + len;
+        }   
+
+        /* 4. about array drives */
+        size = sprintf(buffer+len,"\nArray Drives:");
+        len += size;  pos = begin + len;
+        flag = FALSE;
+
+        buf = gdth_ioctl_alloc(hanum, GDTH_SCRATCH, FALSE, &paddr);
+        if (!buf) 
+            goto stop_output;
+        for (i = 0; i < MAX_LDRIVES; ++i) {
+            if (!(ha->hdr[i].is_arraydrv && ha->hdr[i].is_master))
+                continue;
+            /* 4.a array drive info */
+            TRACE2(("array_info() drive no %d\n",i));
+            pai = (gdth_arrayinf_str *)buf;
+            gdtcmd.Service = CACHESERVICE;
+            gdtcmd.OpCode = GDT_IOCTL;
+            gdtcmd.u.ioctl.p_param = paddr;
+            gdtcmd.u.ioctl.param_size = sizeof(gdth_arrayinf_str);
+            gdtcmd.u.ioctl.subfunc = ARRAY_INFO | LA_CTRL_PATTERN;
+            gdtcmd.u.ioctl.channel = i;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            gdth_do_req(scp, &gdtcmd, cmnd, 30);
+            if (scp->sr_command->SCp.Status == S_OK) 
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
+            if (scp->SCp.Status == S_OK) 
 #else
-                gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
-                if (scp.SCp.Status != S_OK) 
+            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
+            if (scp.SCp.Status == S_OK) 
 #endif
-                {
-                    ha->hdr[i].ldr_no = i;
-                    ha->hdr[i].rw_attribs = 0;
-                    ha->hdr[i].start_sec = 0;
-                } else {
-                    for (j = 0; j < phg->entries; ++j) {
-                        k = phg->entry[j].host_drive;
-                        if (k >= MAX_LDRIVES)
-                            continue;
-                        ha->hdr[k].ldr_no = phg->entry[j].log_drive;
-                        ha->hdr[k].rw_attribs = phg->entry[j].rw_attribs;
-                        ha->hdr[k].start_sec = phg->entry[j].start_sec;
-                    }
-                }
-            }
-            gdth_ioctl_free(hanum, sizeof(gdth_hget_str), buf, paddr);
-
-            for (i = 0; i < MAX_HDRIVES; ++i) {
-                if (!(ha->hdr[i].present))
-                    continue;
-                
+            {
+                if (pai->ai_state == 0)
+                    strcpy(hrec, "idle");
+                else if (pai->ai_state == 2)
+                    strcpy(hrec, "build");
+                else if (pai->ai_state == 4)
+                    strcpy(hrec, "ready");
+                else if (pai->ai_state == 6)
+                    strcpy(hrec, "fail");
+                else if (pai->ai_state == 8 || pai->ai_state == 10)
+                    strcpy(hrec, "rebuild");
+                else
+                    strcpy(hrec, "error");
+                if (pai->ai_ext_state & 0x10)
+                    strcat(hrec, "/expand");
+                else if (pai->ai_ext_state & 0x1)
+                    strcat(hrec, "/patch");
                 size = sprintf(buffer+len,
-                               "\n Number:       \t%-2d        \tArr/Log. Drive:\t%d\n",
-                               i, ha->hdr[i].ldr_no);
+                               "\n Number:       \t%-2d        \tStatus:        \t%s\n",
+                               i,hrec);
                 len += size;  pos = begin + len;
                 flag = TRUE;
 
+                if (pai->ai_type == 0)
+                    strcpy(hrec, "RAID-0");
+                else if (pai->ai_type == 4)
+                    strcpy(hrec, "RAID-4");
+                else if (pai->ai_type == 5)
+                    strcpy(hrec, "RAID-5");
+                else 
+                    strcpy(hrec, "RAID-10");
                 size = sprintf(buffer+len,
-                               " Capacity [MB]:\t%-6d    \tStart Sector:  \t%d\n",
-                               ha->hdr[i].size/2048, ha->hdr[i].start_sec);
+                               " Capacity [MB]:\t%-6d    \tType:          \t%s\n",
+                               pai->ai_size/(1024*1024/pai->ai_secsize),
+                               hrec);
                 len += size;  pos = begin + len;
                 if (pos < offset) {
                     len = 0;
@@ -1299,60 +708,125 @@
                 if (pos > offset + length)
                     goto stop_output;
             }
+        }
+        gdth_ioctl_free(hanum, GDTH_SCRATCH, buf, paddr);
         
-            if (!flag) {
-                size = sprintf(buffer+len, "\n --\n");
-                len += size;  pos = begin + len;
-            }
+        if (!flag) {
+            size = sprintf(buffer+len, "\n --\n");
+            len += size;  pos = begin + len;
         }
 
-        /* controller events */
-        size = sprintf(buffer+len,"\nController Events:\n");
+        /* 5. about host drives */
+        size = sprintf(buffer+len,"\nHost Drives:");
         len += size;  pos = begin + len;
+        flag = FALSE;
 
-        for (id = -1;;) {
-            id = gdth_read_event(ha, id, &estr);
-            if (estr.event_source == 0)
-                break;
-            if (estr.event_data.eu.driver.ionode == hanum &&
-                estr.event_source == ES_ASYNC) { 
-                gdth_log_event(&estr.event_data, hrec);
-                do_gettimeofday(&tv);
-                sec = (int)(tv.tv_sec - estr.first_stamp);
-                if (sec < 0) sec = 0;
-                size = sprintf(buffer+len," date- %02d:%02d:%02d\t%s\n",
-                               sec/3600, sec%3600/60, sec%60, hrec);
-                len += size;  pos = begin + len;
-                if (pos < offset) {
-                    len = 0;
-                    begin = pos;
+        buf = gdth_ioctl_alloc(hanum, sizeof(gdth_hget_str), FALSE, &paddr);
+        if (!buf) 
+            goto stop_output;
+        for (i = 0; i < MAX_LDRIVES; ++i) {
+            if (!ha->hdr[i].is_logdrv || 
+                (ha->hdr[i].is_arraydrv && !ha->hdr[i].is_master))
+                continue;
+            /* 5.a get host drive list */
+            TRACE2(("host_get() drv_no %d\n",i));           
+            phg = (gdth_hget_str *)buf;
+            gdtcmd.Service = CACHESERVICE;
+            gdtcmd.OpCode = GDT_IOCTL;
+            gdtcmd.u.ioctl.p_param = paddr;
+            gdtcmd.u.ioctl.param_size = sizeof(gdth_hget_str);
+            gdtcmd.u.ioctl.subfunc = HOST_GET | LA_CTRL_PATTERN;
+            gdtcmd.u.ioctl.channel = i;
+            phg->entries = MAX_HDRIVES;
+            phg->offset = GDTOFFSOF(gdth_hget_str, entry[0]); 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+            gdth_do_req(scp, &gdtcmd, cmnd, 30);
+            if (scp->sr_command->SCp.Status != S_OK) 
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+            gdth_do_cmd(scp, &gdtcmd, cmnd, 30);
+            if (scp->SCp.Status != S_OK) 
+#else
+            gdth_do_cmd(&scp, &gdtcmd, cmnd, 30);
+            if (scp.SCp.Status != S_OK) 
+#endif
+            {
+                ha->hdr[i].ldr_no = i;
+                ha->hdr[i].rw_attribs = 0;
+                ha->hdr[i].start_sec = 0;
+            } else {
+                for (j = 0; j < phg->entries; ++j) {
+                    k = phg->entry[j].host_drive;
+                    if (k >= MAX_LDRIVES)
+                        continue;
+                    ha->hdr[k].ldr_no = phg->entry[j].log_drive;
+                    ha->hdr[k].rw_attribs = phg->entry[j].rw_attribs;
+                    ha->hdr[k].start_sec = phg->entry[j].start_sec;
                 }
-                if (pos > offset + length)
-                    goto stop_output;
             }
-            if (id == -1)
-                break;
         }
-#ifdef GDTH_IOCTL_PROC
-    } else {
-        gdth_iord_str *piord;
+        gdth_ioctl_free(hanum, sizeof(gdth_hget_str), buf, paddr);
 
-        /* request from tool (GDTMON,..) */
-        piord = (gdth_iord_str *)ha->pscratch;
-        if (piord == NULL)
-            goto stop_output;
-        length = piord->size;
-        memcpy(buffer+len, (char *)piord, length);
-        gdth_ioctl_free(hanum, GDTH_SCRATCH, ha->pscratch, paddr);
-        len = length; 
+        for (i = 0; i < MAX_HDRIVES; ++i) {
+            if (!(ha->hdr[i].present))
+                continue;
+              
+            size = sprintf(buffer+len,
+                           "\n Number:       \t%-2d        \tArr/Log. Drive:\t%d\n",
+                           i, ha->hdr[i].ldr_no);
+            len += size;  pos = begin + len;
+            flag = TRUE;
+
+            size = sprintf(buffer+len,
+                           " Capacity [MB]:\t%-6d    \tStart Sector:  \t%d\n",
+                           (ulong32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec);
+            len += size;  pos = begin + len;
+            if (pos < offset) {
+                len = 0;
+                begin = pos;
+            }
+            if (pos > offset + length)
+                goto stop_output;
+        }
+        
+        if (!flag) {
+            size = sprintf(buffer+len, "\n --\n");
+            len += size;  pos = begin + len;
+        }
+    }
+
+    /* controller events */
+    size = sprintf(buffer+len,"\nController Events:\n");
+    len += size;  pos = begin + len;
+
+    for (id = -1;;) {
+        id = gdth_read_event(ha, id, &estr);
+        if (estr.event_source == 0)
+            break;
+        if (estr.event_data.eu.driver.ionode == hanum &&
+            estr.event_source == ES_ASYNC) { 
+            gdth_log_event(&estr.event_data, hrec);
+            do_gettimeofday(&tv);
+            sec = (int)(tv.tv_sec - estr.first_stamp);
+            if (sec < 0) sec = 0;
+            size = sprintf(buffer+len," date- %02d:%02d:%02d\t%s\n",
+                           sec/3600, sec%3600/60, sec%60, hrec);
+            len += size;  pos = begin + len;
+            if (pos < offset) {
+                len = 0;
+                begin = pos;
+            }
+            if (pos > offset + length)
+                goto stop_output;
+        }
+        if (id == -1)
+            break;
     }
-#endif
 
 stop_output:
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     scsi_release_request(scp);
     scsi_free_host_dev(sdev);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     scsi_release_command(scp);
     scsi_free_host_dev(sdev);
 #endif
@@ -1365,7 +839,8 @@
     return(len);
 }
 
-#if LINUX_VERSION_CODE >= 0x020503
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static void gdth_do_req(Scsi_Request *scp, gdth_cmd_str *gdtcmd, 
                         char *cmnd, int timeout)
 {
@@ -1389,9 +864,9 @@
                         char *cmnd, int timeout)
 {
     unsigned bufflen;
-#if LINUX_VERSION_CODE >= 0x020407
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
     DECLARE_COMPLETION(wait);
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     DECLARE_MUTEX_LOCKED(sem);
 #else
     struct semaphore sem = MUTEX_LOCKED;
@@ -1405,19 +880,19 @@
         scp->SCp.this_residual = DEFAULT_PRI;
         bufflen = 0;
     }
-#if LINUX_VERSION_CODE >= 0x020407
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
     scp->request.rq_status = RQ_SCSI_BUSY;
     scp->request.waiting = &wait;
     scsi_do_cmd(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1);
     wait_for_completion(&wait);
 #else
     scp->request.sem = &sem;
-#if LINUX_VERSION_CODE >= 0x020322
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
     scsi_do_cmd(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1);
 #else
-    GDTH_LOCK_SCSI_DOCMD();
+    spin_lock_irq(&io_request_lock);
     scsi_do_cmd(scp, cmnd, gdtcmd, bufflen, gdth_scsi_done, timeout*HZ, 1);
-    GDTH_UNLOCK_SCSI_DOCMD();
+    spin_unlock_irq(&io_request_lock);
 #endif
     down(&sem);
 #endif
@@ -1428,11 +903,11 @@
 {
     TRACE2(("gdth_scsi_done()\n"));
 
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     scp->request->rq_status = RQ_SCSI_DONE;
     if (scp->request->waiting != NULL)
         complete(scp->request->waiting);
-#elif LINUX_VERSION_CODE >= 0x020407
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
     scp->request.rq_status = RQ_SCSI_DONE;
     if (scp->request.waiting != NULL)
         complete(scp->request.waiting);
@@ -1444,7 +919,7 @@
 }
 
 static char *gdth_ioctl_alloc(int hanum, int size, int scratch, 
-                              ulong32 *paddr)
+                              ulong64 *paddr)
 {
     gdth_ha_str *ha;
     ulong flags;
@@ -1463,11 +938,11 @@
     } else if (scratch) {
         ret_val = NULL;
     } else {
-#if LINUX_VERSION_CODE >= 0x020400
-	dma_addr_t dma_addr;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+        dma_addr_t dma_addr;
 
         ret_val = pci_alloc_consistent(ha->pdev, size, &dma_addr);
-	*paddr = (ulong32)dma_addr;
+        *paddr = dma_addr;
 #else
         ret_val = scsi_init_malloc(size, GFP_ATOMIC | GFP_DMA);
         if (ret_val)
@@ -1479,7 +954,7 @@
     return ret_val;
 }
 
-static void gdth_ioctl_free(int hanum, int size, char *buf, ulong32 paddr)
+static void gdth_ioctl_free(int hanum, int size, char *buf, ulong64 paddr)
 {
     gdth_ha_str *ha;
     ulong flags;
@@ -1490,7 +965,7 @@
     if (buf == ha->pscratch) {
         ha->scratch_busy = FALSE;
     } else {
-#if LINUX_VERSION_CODE >= 0x020400
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
         pci_free_consistent(ha->pdev, size, buf, paddr);
 #else
         scsi_init_free((void *)buf, size);
@@ -1533,7 +1008,7 @@
 
     for (i = 0; i < GDTH_MAXCMDS; ++i) {
         scp = ha->cmd_tab[i].cmnd;
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
         t = scp->device->id;
 #else
@@ -1546,14 +1021,10 @@
             GDTH_UNLOCK_HA(ha, flags);
             while (!scp->SCp.have_data_in)
                 barrier();
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
             GDTH_LOCK_SCSI_DONE(scp->device->host, flags);
             scp->scsi_done(scp);
             GDTH_UNLOCK_SCSI_DONE(scp->device->host, flags);
-#elif LINUX_VERSION_CODE >= 0x020503
-            GDTH_LOCK_SCSI_DONE(scp->host, flags);
-            scp->scsi_done(scp);
-            GDTH_UNLOCK_SCSI_DONE(scp->host, flags);
 #else
             GDTH_LOCK_SCSI_DONE(flags);
             scp->scsi_done(scp);
@@ -1576,7 +1047,7 @@
     GDTH_LOCK_HA(ha, flags);
 
     for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
         t = scp->device->id;
 #else
@@ -1602,7 +1073,7 @@
     GDTH_LOCK_HA(ha, flags);
 
     for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
-#if LINUX_VERSION_CODE >= 0x02053C
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
         t = scp->device->id;
 #else
@@ -1624,7 +1095,6 @@
     oldto = scp->timeout_per_command;
     scp->timeout_per_command = timeout;
 
-#if LINUX_VERSION_CODE >= 0x02014B
     if (timeout == 0) {
         del_timer(&scp->eh_timeout);
         scp->eh_timeout.data = (unsigned long) NULL;
@@ -1636,17 +1106,6 @@
         scp->eh_timeout.expires = jiffies + timeout;
         add_timer(&scp->eh_timeout);
     }
-#else
-    if (timeout > 0) {
-        if (timer_table[SCSI_TIMER].expires == 0) {
-            timer_table[SCSI_TIMER].expires = jiffies + timeout;
-            timer_active |= 1 << SCSI_TIMER;
-        } else {
-            if (jiffies + timeout < timer_table[SCSI_TIMER].expires)
-                timer_table[SCSI_TIMER].expires = jiffies + timeout;
-        }
-    }
-#endif
 
     return oldto;
 }
diff -Nru a/drivers/scsi/gdth_proc.h b/drivers/scsi/gdth_proc.h
--- a/drivers/scsi/gdth_proc.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/gdth_proc.h	Tue Jun 15 22:20:42 2004
@@ -2,42 +2,31 @@
 #define _GDTH_PROC_H
 
 /* gdth_proc.h 
- * $Id: gdth_proc.h,v 1.14 2003/08/27 11:37:35 achim Exp $
+ * $Id: gdth_proc.h,v 1.16 2004/01/14 13:09:01 achim Exp $
  */
 
-static int gdth_set_info(char *buffer,int length,int hanum,int busnum);
-static int gdth_get_info(char *buffer,char **start,off_t offset,
-                         int length,int hanum,int busnum);
+static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host,
+                         int hanum,int busnum);
+static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
+                         struct Scsi_Host *host,int hanum,int busnum);
 
-#if LINUX_VERSION_CODE >= 0x020503
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static void gdth_do_req(Scsi_Request *srp, gdth_cmd_str *cmd, 
                         char *cmnd, int timeout);
 static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Request *scp);
-#ifdef GDTH_IOCTL_PROC
-static int gdth_set_bin_info(char *buffer,int length,int hanum,Scsi_Request *scp);
-#endif
-#elif LINUX_VERSION_CODE >= 0x020322
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 static void gdth_do_cmd(Scsi_Cmnd *scp, gdth_cmd_str *cmd, 
                         char *cmnd, int timeout);
 static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp);
-#ifdef GDTH_IOCTL_PROC
-static int gdth_set_bin_info(char *buffer,int length,int hanum,Scsi_Cmnd *scp);
-#endif
 #else 
 static void gdth_do_cmd(Scsi_Cmnd *scp, gdth_cmd_str *cmd, 
                         char *cmnd, int timeout);
 static int gdth_set_asc_info(char *buffer,int length,int hanum,Scsi_Cmnd scp);
-#ifdef GDTH_IOCTL_PROC
-static int gdth_set_bin_info(char *buffer,int length,int hanum,Scsi_Cmnd scp);
-#endif
 #endif
 
 static char *gdth_ioctl_alloc(int hanum, int size, int scratch,
-                              ulong32 *paddr);  
-static void gdth_ioctl_free(int hanum, int size, char *buf, ulong32 paddr);
-#ifdef GDTH_IOCTL_PROC
-static int gdth_ioctl_check_bin(int hanum, ushort size);
-#endif
+                              ulong64 *paddr);  
+static void gdth_ioctl_free(int hanum, int size, char *buf, ulong64 paddr);
 static void gdth_wait_completion(int hanum, int busnum, int id);
 static void gdth_stop_timeout(int hanum, int busnum, int id);
 static void gdth_start_timeout(int hanum, int busnum, int id);
diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
--- a/drivers/scsi/hosts.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/hosts.c	Tue Jun 15 22:20:36 2004
@@ -345,7 +345,7 @@
 }
 
 /**
- * *scsi_host_get - inc a Scsi_Host ref count
+ * scsi_host_get - inc a Scsi_Host ref count
  * @shost:	Pointer to Scsi_Host to inc.
  **/
 struct Scsi_Host *scsi_host_get(struct Scsi_Host *shost)
@@ -357,7 +357,7 @@
 }
 
 /**
- * *scsi_host_put - dec a Scsi_Host ref count
+ * scsi_host_put - dec a Scsi_Host ref count
  * @shost:	Pointer to Scsi_Host to dec.
  **/
 void scsi_host_put(struct Scsi_Host *shost)
diff -Nru a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
--- a/drivers/scsi/ide-scsi.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/ide-scsi.c	Tue Jun 15 22:20:42 2004
@@ -318,6 +318,13 @@
 	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
 		return ide_stopped;
 
+	/* retry only "normal" I/O: */
+	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
+		rq->errors = 1;
+		ide_end_drive_cmd(drive, stat, err);
+		return ide_stopped;
+	}
+
 	if (HWIF(drive)->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
 		/* force an abort */
 		HWIF(drive)->OUTB(WIN_IDLEIMMEDIATE,IDE_COMMAND_REG);
@@ -334,6 +341,13 @@
 	if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
 	       return ide_stopped;
 
+	/* retry only "normal" I/O: */
+	if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) {
+		rq->errors = 1;
+		ide_end_drive_cmd(drive, BUSY_STAT, 0);
+		return ide_stopped;
+	}
+
 #if IDESCSI_DEBUG_LOG
 	printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n",
 			((idescsi_pc_t *) rq->special)->scsi_cmd->serial_number);
@@ -745,7 +759,7 @@
 	return "SCSI host adapter emulation for IDE ATAPI devices";
 }
 
-static int idescsi_ioctl (Scsi_Device *dev, int cmd, void *arg)
+static int idescsi_ioctl (Scsi_Device *dev, int cmd, void __user *arg)
 {
 	idescsi_scsi_t *scsi = scsihost_to_idescsi(dev->host);
 
@@ -756,7 +770,7 @@
 			clear_bit(IDESCSI_SG_TRANSFORM, &scsi->transform);
 		return 0;
 	} else if (cmd == SG_GET_TRANSFORM)
-		return put_user(test_bit(IDESCSI_SG_TRANSFORM, &scsi->transform), (int *) arg);
+		return put_user(test_bit(IDESCSI_SG_TRANSFORM, &scsi->transform), (int __user *) arg);
 	return -EINVAL;
 }
 
diff -Nru a/drivers/scsi/imm.c b/drivers/scsi/imm.c
--- a/drivers/scsi/imm.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/scsi/imm.c	Tue Jun 15 22:21:05 2004
@@ -12,6 +12,18 @@
  */
 
 #include <linux/config.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/blkdev.h>
+#include <linux/parport.h>
+#include <linux/workqueue.h>
+#include <asm/io.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_host.h>
 
 /* The following #define is to avoid a clash with hosts.c */
 #define IMM_PROBE_SPP   0x0001
@@ -20,22 +32,13 @@
 #define IMM_PROBE_EPP17 0x0100
 #define IMM_PROBE_EPP19 0x0200
 
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/blkdev.h>
-#include <asm/io.h>
-#include <linux/parport.h>
-#include <linux/workqueue.h>
-#include "scsi.h"
-#include "hosts.h"
 
 typedef struct {
 	struct pardevice *dev;	/* Parport device entry         */
 	int base;		/* Actual port address          */
 	int base_hi;		/* Hi Base address for ECP-ISA chipset */
 	int mode;		/* Transfer mode                */
-	Scsi_Cmnd *cur_cmd;	/* Current queued command       */
+	struct scsi_cmnd *cur_cmd;	/* Current queued command       */
 	struct work_struct imm_tq;	/* Polling interrupt stuff       */
 	unsigned long jstart;	/* Jiffies at start             */
 	unsigned failed:1;	/* Failure flag                 */
@@ -613,7 +616,7 @@
 	return device_check(dev);
 }
 
-static inline int imm_send_command(Scsi_Cmnd *cmd)
+static inline int imm_send_command(struct scsi_cmnd *cmd)
 {
 	imm_struct *dev = imm_dev(cmd->device->host);
 	int k;
@@ -633,7 +636,7 @@
  * The driver appears to remain stable if we speed up the parallel port
  * i/o in this function, but not elsewhere.
  */
-static int imm_completion(Scsi_Cmnd *cmd)
+static int imm_completion(struct scsi_cmnd *cmd)
 {
 	/* Return codes:
 	 * -1     Error
@@ -736,7 +739,7 @@
 static void imm_interrupt(void *data)
 {
 	imm_struct *dev = (imm_struct *) data;
-	Scsi_Cmnd *cmd = dev->cur_cmd;
+	struct scsi_cmnd *cmd = dev->cur_cmd;
 	struct Scsi_Host *host = cmd->device->host;
 	unsigned long flags;
 
@@ -796,7 +799,7 @@
 	return;
 }
 
-static int imm_engine(imm_struct *dev, Scsi_Cmnd *cmd)
+static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
 {
 	unsigned short ppb = dev->base;
 	unsigned char l = 0, h = 0;
@@ -937,7 +940,8 @@
 	return 0;
 }
 
-static int imm_queuecommand(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
+static int imm_queuecommand(struct scsi_cmnd *cmd,
+		void (*done)(struct scsi_cmnd *))
 {
 	imm_struct *dev = imm_dev(cmd->device->host);
 
@@ -980,7 +984,7 @@
 	return 0;
 }
 
-static int imm_abort(Scsi_Cmnd *cmd)
+static int imm_abort(struct scsi_cmnd *cmd)
 {
 	imm_struct *dev = imm_dev(cmd->device->host);
 	/*
@@ -1012,7 +1016,7 @@
 	w_ctr(base, 0x04);
 }
 
-static int imm_reset(Scsi_Cmnd *cmd)
+static int imm_reset(struct scsi_cmnd *cmd)
 {
 	imm_struct *dev = imm_dev(cmd->device->host);
 
@@ -1114,7 +1118,7 @@
 	return -ENODEV;
 }
 
-static Scsi_Host_Template imm_template = {
+static struct scsi_host_template imm_template = {
 	.module			= THIS_MODULE,
 	.proc_name		= "imm",
 	.proc_info		= imm_proc_info,
diff -Nru a/drivers/scsi/imm.h b/drivers/scsi/imm.h
--- a/drivers/scsi/imm.h	Tue Jun 15 22:20:35 2004
+++ b/drivers/scsi/imm.h	Tue Jun 15 22:20:35 2004
@@ -139,6 +139,6 @@
 #define w_ctr(x,y)      outb(y, (x)+2)
 #endif
 
-static int imm_engine(imm_struct *, Scsi_Cmnd *);
+static int imm_engine(imm_struct *, struct scsi_cmnd *);
 
 #endif				/* _IMM_H */
diff -Nru a/drivers/scsi/ini9100u.c b/drivers/scsi/ini9100u.c
--- a/drivers/scsi/ini9100u.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/scsi/ini9100u.c	Tue Jun 15 22:20:38 2004
@@ -106,6 +106,8 @@
  *		- Changed the assumption that HZ = 100
  * 10/17/03 mc	- v1.04
  *		- added new DMA API support
+ * 06/01/04 jmd	- v1.04a
+ *		- Re-add reset_bus support
  **************************************************************************/
 
 #define CVT_LINUX_VERSION(V,P,S)        (V * 65536 + P * 256 + S)
@@ -149,6 +151,7 @@
 	.queuecommand	= i91u_queue,
 //	.abort		= i91u_abort,
 //	.reset		= i91u_reset,
+	.eh_bus_reset_handler = i91u_bus_reset,
 	.bios_param	= i91u_biosparam,
 	.can_queue	= 1,
 	.this_id	= 1,
@@ -161,7 +164,7 @@
 char *i91uCopyright = "Copyright (C) 1996-98";
 char *i91uInitioName = "by Initio Corporation";
 char *i91uProductName = "INI-9X00U/UW";
-char *i91uVersion = "v1.04";
+char *i91uVersion = "v1.04a";
 
 #define TULSZ(sz)     (sizeof(sz) / sizeof(sz[0]))
 #define TUL_RDWORD(x,y)         (short)(inl((int)((ULONG)((ULONG)x+(UCHAR)y)) ))
@@ -548,6 +551,15 @@
 		return tul_reset_scsi_bus(pHCB);
 	else
 		return tul_device_reset(pHCB, (ULONG) SCpnt, SCpnt->device->id, reset_flags);
+}
+
+int i91u_bus_reset(Scsi_Cmnd * SCpnt)
+{
+	HCS *pHCB;
+
+	pHCB = (HCS *) SCpnt->device->host->base;
+	tul_reset_scsi(pHCB, 0);
+	return SUCCESS;
 }
 
 /*
diff -Nru a/drivers/scsi/ini9100u.h b/drivers/scsi/ini9100u.h
--- a/drivers/scsi/ini9100u.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/ini9100u.h	Tue Jun 15 22:20:41 2004
@@ -82,10 +82,11 @@
 extern int i91u_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
 extern int i91u_abort(Scsi_Cmnd *);
 extern int i91u_reset(Scsi_Cmnd *, unsigned int);
+extern int i91u_bus_reset(Scsi_Cmnd *);
 extern int i91u_biosparam(struct scsi_device *, struct block_device *,
 		sector_t, int *);
 
-#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.03g"
+#define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.04a"
 
 #define VIRT_TO_BUS(i)  (unsigned int) virt_to_bus((void *)(i))
 #define ULONG   unsigned long
diff -Nru a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/ipr.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,6021 @@
+/*
+ * ipr.c -- driver for IBM Power Linux RAID adapters
+ *
+ * Written By: Brian King, IBM Corporation
+ *
+ * Copyright (C) 2003, 2004 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
+ *
+ */
+
+/*
+ * Notes:
+ *
+ * This driver is used to control the following SCSI adapters:
+ *
+ * IBM iSeries: 5702, 5703, 2780, 5709, 570A, 570B
+ *
+ * IBM pSeries: PCI-X Dual Channel Ultra 320 SCSI RAID Adapter
+ *              PCI-X Dual Channel Ultra 320 SCSI Adapter
+ *              PCI-X Dual Channel Ultra 320 SCSI RAID Enablement Card
+ *              Embedded SCSI adapter on p615 and p655 systems
+ *
+ * Supported Hardware Features:
+ *	- Ultra 320 SCSI controller
+ *	- PCI-X host interface
+ *	- Embedded PowerPC RISC Processor and Hardware XOR DMA Engine
+ *	- Non-Volatile Write Cache
+ *	- Supports attachment of non-RAID disks, tape, and optical devices
+ *	- RAID Levels 0, 5, 10
+ *	- Hot spare
+ *	- Background Parity Checking
+ *	- Background Data Scrubbing
+ *	- Ability to increase the capacity of an existing RAID 5 disk array
+ *		by adding disks
+ *
+ * Driver Features:
+ *	- Tagged command queuing
+ *	- Adapter microcode download
+ *	- PCI hot plug
+ *	- SCSI device hot plug
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/ioport.h>
+#include <linux/delay.h>
+#include <linux/pci.h>
+#include <linux/wait.h>
+#include <linux/spinlock.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+#include <linux/blkdev.h>
+#include <linux/firmware.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/processor.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_tcq.h>
+#include <scsi/scsi_eh.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_request.h>
+#include "ipr.h"
+
+/*
+ *   Global Data
+ */
+static struct list_head ipr_ioa_head = LIST_HEAD_INIT(ipr_ioa_head);
+static unsigned int ipr_log_level = IPR_DEFAULT_LOG_LEVEL;
+static unsigned int ipr_max_speed = 1;
+static int ipr_testmode = 0;
+static spinlock_t ipr_driver_lock = SPIN_LOCK_UNLOCKED;
+
+/* This table describes the differences between DMA controller chips */
+static const struct ipr_chip_cfg_t ipr_chip_cfg[] = {
+	{ /* Gemstone */
+		.mailbox = 0x0042C,
+		.cache_line_size = 0x20,
+		{
+			.set_interrupt_mask_reg = 0x0022C,
+			.clr_interrupt_mask_reg = 0x00230,
+			.sense_interrupt_mask_reg = 0x0022C,
+			.clr_interrupt_reg = 0x00228,
+			.sense_interrupt_reg = 0x00224,
+			.ioarrin_reg = 0x00404,
+			.sense_uproc_interrupt_reg = 0x00214,
+			.set_uproc_interrupt_reg = 0x00214,
+			.clr_uproc_interrupt_reg = 0x00218
+		}
+	},
+	{ /* Snipe */
+		.mailbox = 0x0052C,
+		.cache_line_size = 0x20,
+		{
+			.set_interrupt_mask_reg = 0x00288,
+			.clr_interrupt_mask_reg = 0x0028C,
+			.sense_interrupt_mask_reg = 0x00288,
+			.clr_interrupt_reg = 0x00284,
+			.sense_interrupt_reg = 0x00280,
+			.ioarrin_reg = 0x00504,
+			.sense_uproc_interrupt_reg = 0x00290,
+			.set_uproc_interrupt_reg = 0x00290,
+			.clr_uproc_interrupt_reg = 0x00294
+		}
+	},
+};
+
+static int ipr_max_bus_speeds [] = {
+	IPR_80MBs_SCSI_RATE, IPR_U160_SCSI_RATE, IPR_U320_SCSI_RATE
+};
+
+MODULE_AUTHOR("Brian King <brking@us.ibm.com>");
+MODULE_DESCRIPTION("IBM Power RAID SCSI Adapter Driver");
+module_param_named(max_speed, ipr_max_speed, uint, 0);
+MODULE_PARM_DESC(max_speed, "Maximum bus speed (0-2). Default: 1=U160. Speeds: 0=80 MB/s, 1=U160, 2=U320");
+module_param_named(log_level, ipr_log_level, uint, 0);
+MODULE_PARM_DESC(log_level, "Set to 0 - 4 for increasing verbosity of device driver");
+module_param_named(testmode, ipr_testmode, int, 0);
+MODULE_PARM_DESC(testmode, "DANGEROUS!!! Allows unsupported configurations");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(IPR_DRIVER_VERSION);
+
+static const char *ipr_gpdd_dev_end_states[] = {
+	"Command complete",
+	"Terminated by host",
+	"Terminated by device reset",
+	"Terminated by bus reset",
+	"Unknown",
+	"Command not started"
+};
+
+static const char *ipr_gpdd_dev_bus_phases[] = {
+	"Bus free",
+	"Arbitration",
+	"Selection",
+	"Message out",
+	"Command",
+	"Message in",
+	"Data out",
+	"Data in",
+	"Status",
+	"Reselection",
+	"Unknown"
+};
+
+/*  A constant array of IOASCs/URCs/Error Messages */
+static const
+struct ipr_error_table_t ipr_error_table[] = {
+	{0x00000000, 1, 1,
+	"8155: An unknown error was received"},
+	{0x00330000, 0, 0,
+	"Soft underlength error"},
+	{0x005A0000, 0, 0,
+	"Command to be cancelled not found"},
+	{0x00808000, 0, 0,
+	"Qualified success"},
+	{0x01080000, 1, 1,
+	"FFFE: Soft device bus error recovered by the IOA"},
+	{0x01170600, 0, 1,
+	"FFF9: Device sector reassign successful"},
+	{0x01170900, 0, 1,
+	"FFF7: Media error recovered by device rewrite procedures"},
+	{0x01180200, 0, 1,
+	"7001: IOA sector reassignment successful"},
+	{0x01180500, 0, 1,
+	"FFF9: Soft media error. Sector reassignment recommended"},
+	{0x01180600, 0, 1,
+	"FFF7: Media error recovered by IOA rewrite procedures"},
+	{0x01418000, 0, 1,
+	"FF3D: Soft PCI bus error recovered by the IOA"},
+	{0x01440000, 1, 1,
+	"FFF6: Device hardware error recovered by the IOA"},
+	{0x01448100, 0, 1,
+	"FFF6: Device hardware error recovered by the device"},
+	{0x01448200, 1, 1,
+	"FF3D: Soft IOA error recovered by the IOA"},
+	{0x01448300, 0, 1,
+	"FFFA: Undefined device response recovered by the IOA"},
+	{0x014A0000, 1, 1,
+	"FFF6: Device bus error, message or command phase"},
+	{0x015D0000, 0, 1,
+	"FFF6: Failure prediction threshold exceeded"},
+	{0x015D9200, 0, 1,
+	"8009: Impending cache battery pack failure"},
+	{0x02040400, 0, 0,
+	"34FF: Disk device format in progress"},
+	{0x023F0000, 0, 0,
+	"Synchronization required"},
+	{0x024E0000, 0, 0,
+	"No ready, IOA shutdown"},
+	{0x02670100, 0, 1,
+	"3020: Storage subsystem configuration error"},
+	{0x03110B00, 0, 0,
+	"FFF5: Medium error, data unreadable, recommend reassign"},
+	{0x03110C00, 0, 0,
+	"7000: Medium error, data unreadable, do not reassign"},
+	{0x03310000, 0, 1,
+	"FFF3: Disk media format bad"},
+	{0x04050000, 0, 1,
+	"3002: Addressed device failed to respond to selection"},
+	{0x04080000, 1, 1,
+	"3100: Device bus error"},
+	{0x04080100, 0, 1,
+	"3109: IOA timed out a device command"},
+	{0x04088000, 0, 0,
+	"3120: SCSI bus is not operational"},
+	{0x04118000, 0, 1,
+	"9000: IOA reserved area data check"},
+	{0x04118100, 0, 1,
+	"9001: IOA reserved area invalid data pattern"},
+	{0x04118200, 0, 1,
+	"9002: IOA reserved area LRC error"},
+	{0x04320000, 0, 1,
+	"102E: Out of alternate sectors for disk storage"},
+	{0x04330000, 1, 1,
+	"FFF4: Data transfer underlength error"},
+	{0x04338000, 1, 1,
+	"FFF4: Data transfer overlength error"},
+	{0x043E0100, 0, 1,
+	"3400: Logical unit failure"},
+	{0x04408500, 0, 1,
+	"FFF4: Device microcode is corrupt"},
+	{0x04418000, 1, 1,
+	"8150: PCI bus error"},
+	{0x04430000, 1, 0,
+	"Unsupported device bus message received"},
+	{0x04440000, 1, 1,
+	"FFF4: Disk device problem"},
+	{0x04448200, 1, 1,
+	"8150: Permanent IOA failure"},
+	{0x04448300, 0, 1,
+	"3010: Disk device returned wrong response to IOA"},
+	{0x04448400, 0, 1,
+	"8151: IOA microcode error"},
+	{0x04448500, 0, 0,
+	"Device bus status error"},
+	{0x04448600, 0, 1,
+	"8157: IOA error requiring IOA reset to recover"},
+	{0x04490000, 0, 0,
+	"Message reject received from the device"},
+	{0x04449200, 0, 1,
+	"8008: A permanent cache battery pack failure occurred"},
+	{0x0444A000, 0, 1,
+	"9090: Disk unit has been modified after the last known status"},
+	{0x0444A200, 0, 1,
+	"9081: IOA detected device error"},
+	{0x0444A300, 0, 1,
+	"9082: IOA detected device error"},
+	{0x044A0000, 1, 1,
+	"3110: Device bus error, message or command phase"},
+	{0x04670400, 0, 1,
+	"9091: Incorrect hardware configuration change has been detected"},
+	{0x046E0000, 0, 1,
+	"FFF4: Command to logical unit failed"},
+	{0x05240000, 1, 0,
+	"Illegal request, invalid request type or request packet"},
+	{0x05250000, 0, 0,
+	"Illegal request, invalid resource handle"},
+	{0x05260000, 0, 0,
+	"Illegal request, invalid field in parameter list"},
+	{0x05260100, 0, 0,
+	"Illegal request, parameter not supported"},
+	{0x05260200, 0, 0,
+	"Illegal request, parameter value invalid"},
+	{0x052C0000, 0, 0,
+	"Illegal request, command sequence error"},
+	{0x06040500, 0, 1,
+	"9031: Array protection temporarily suspended, protection resuming"},
+	{0x06040600, 0, 1,
+	"9040: Array protection temporarily suspended, protection resuming"},
+	{0x06290000, 0, 1,
+	"FFFB: SCSI bus was reset"},
+	{0x06290500, 0, 0,
+	"FFFE: SCSI bus transition to single ended"},
+	{0x06290600, 0, 0,
+	"FFFE: SCSI bus transition to LVD"},
+	{0x06298000, 0, 1,
+	"FFFB: SCSI bus was reset by another initiator"},
+	{0x063F0300, 0, 1,
+	"3029: A device replacement has occurred"},
+	{0x064C8000, 0, 1,
+	"9051: IOA cache data exists for a missing or failed device"},
+	{0x06670100, 0, 1,
+	"9025: Disk unit is not supported at its physical location"},
+	{0x06670600, 0, 1,
+	"3020: IOA detected a SCSI bus configuration error"},
+	{0x06678000, 0, 1,
+	"3150: SCSI bus configuration error"},
+	{0x06690200, 0, 1,
+	"9041: Array protection temporarily suspended"},
+	{0x066B0200, 0, 1,
+	"9030: Array no longer protected due to missing or failed disk unit"},
+	{0x07270000, 0, 0,
+	"Failure due to other device"},
+	{0x07278000, 0, 1,
+	"9008: IOA does not support functions expected by devices"},
+	{0x07278100, 0, 1,
+	"9010: Cache data associated with attached devices cannot be found"},
+	{0x07278200, 0, 1,
+	"9011: Cache data belongs to devices other than those attached"},
+	{0x07278400, 0, 1,
+	"9020: Array missing 2 or more devices with only 1 device present"},
+	{0x07278500, 0, 1,
+	"9021: Array missing 2 or more devices with 2 or more devices present"},
+	{0x07278600, 0, 1,
+	"9022: Exposed array is missing a required device"},
+	{0x07278700, 0, 1,
+	"9023: Array member(s) not at required physical locations"},
+	{0x07278800, 0, 1,
+	"9024: Array not functional due to present hardware configuration"},
+	{0x07278900, 0, 1,
+	"9026: Array not functional due to present hardware configuration"},
+	{0x07278A00, 0, 1,
+	"9027: Array is missing a device and parity is out of sync"},
+	{0x07278B00, 0, 1,
+	"9028: Maximum number of arrays already exist"},
+	{0x07278C00, 0, 1,
+	"9050: Required cache data cannot be located for a disk unit"},
+	{0x07278D00, 0, 1,
+	"9052: Cache data exists for a device that has been modified"},
+	{0x07278F00, 0, 1,
+	"9054: IOA resources not available due to previous problems"},
+	{0x07279100, 0, 1,
+	"9092: Disk unit requires initialization before use"},
+	{0x07279200, 0, 1,
+	"9029: Incorrect hardware configuration change has been detected"},
+	{0x07279600, 0, 1,
+	"9060: One or more disk pairs are missing from an array"},
+	{0x07279700, 0, 1,
+	"9061: One or more disks are missing from an array"},
+	{0x07279800, 0, 1,
+	"9062: One or more disks are missing from an array"},
+	{0x07279900, 0, 1,
+	"9063: Maximum number of functional arrays has been exceeded"},
+	{0x0B260000, 0, 0,
+	"Aborted command, invalid descriptor"},
+	{0x0B5A0000, 0, 0,
+	"Command terminated by host"}
+};
+
+static const struct ipr_ses_table_entry ipr_ses_table[] = {
+	{ "2104-DL1        ", "XXXXXXXXXXXXXXXX", 80 },
+	{ "2104-TL1        ", "XXXXXXXXXXXXXXXX", 80 },
+	{ "HSBP07M P U2SCSI", "XXXXXXXXXXXXXXXX", 80 }, /* Hidive 7 slot */
+	{ "HSBP05M P U2SCSI", "XXXXXXXXXXXXXXXX", 80 }, /* Hidive 5 slot */
+	{ "HSBP05M S U2SCSI", "XXXXXXXXXXXXXXXX", 80 }, /* Bowtie */
+	{ "HSBP06E ASU2SCSI", "XXXXXXXXXXXXXXXX", 80 }, /* MartinFenning */
+	{ "2104-DU3        ", "XXXXXXXXXXXXXXXX", 160 },
+	{ "2104-TU3        ", "XXXXXXXXXXXXXXXX", 160 },
+	{ "HSBP04C RSU2SCSI", "XXXXXXX*XXXXXXXX", 160 },
+	{ "HSBP06E RSU2SCSI", "XXXXXXX*XXXXXXXX", 160 },
+	{ "St  V1S2        ", "XXXXXXXXXXXXXXXX", 160 },
+	{ "HSBPD4M  PU3SCSI", "XXXXXXX*XXXXXXXX", 160 },
+	{ "VSBPD1H   U3SCSI", "XXXXXXX*XXXXXXXX", 160 }
+};
+
+/*
+ *  Function Prototypes
+ */
+static int ipr_reset_alert(struct ipr_cmnd *);
+static void ipr_process_ccn(struct ipr_cmnd *);
+static void ipr_process_error(struct ipr_cmnd *);
+static void ipr_reset_ioa_job(struct ipr_cmnd *);
+static void ipr_initiate_ioa_reset(struct ipr_ioa_cfg *,
+				   enum ipr_shutdown_type);
+
+#ifdef CONFIG_SCSI_IPR_TRACE
+/**
+ * ipr_trc_hook - Add a trace entry to the driver trace
+ * @ipr_cmd:	ipr command struct
+ * @type:		trace type
+ * @add_data:	additional data
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_trc_hook(struct ipr_cmnd *ipr_cmd,
+			 u8 type, u32 add_data)
+{
+	struct ipr_trace_entry *trace_entry;
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	trace_entry = &ioa_cfg->trace[ioa_cfg->trace_index++];
+	trace_entry->time = jiffies;
+	trace_entry->op_code = ipr_cmd->ioarcb.cmd_pkt.cdb[0];
+	trace_entry->type = type;
+	trace_entry->cmd_index = ipr_cmd->cmd_index;
+	trace_entry->res_handle = ipr_cmd->ioarcb.res_handle;
+	trace_entry->u.add_data = add_data;
+}
+#else
+#define ipr_trc_hook(ipr_cmd, type, add_data) do { } while(0)
+#endif
+
+/**
+ * ipr_reinit_ipr_cmnd - Re-initialize an IPR Cmnd block for reuse
+ * @ipr_cmd:	ipr command struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_reinit_ipr_cmnd(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+	struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
+
+	memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt));
+	ioarcb->write_data_transfer_length = 0;
+	ioarcb->read_data_transfer_length = 0;
+	ioarcb->write_ioadl_len = 0;
+	ioarcb->read_ioadl_len = 0;
+	ioasa->ioasc = 0;
+	ioasa->residual_data_len = 0;
+
+	ipr_cmd->scsi_cmd = NULL;
+	ipr_cmd->sense_buffer[0] = 0;
+	ipr_cmd->dma_use_sg = 0;
+}
+
+/**
+ * ipr_init_ipr_cmnd - Initialize an IPR Cmnd block
+ * @ipr_cmd:	ipr command struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_init_ipr_cmnd(struct ipr_cmnd *ipr_cmd)
+{
+	ipr_reinit_ipr_cmnd(ipr_cmd);
+	ipr_cmd->u.scratch = 0;
+	init_timer(&ipr_cmd->timer);
+}
+
+/**
+ * ipr_get_free_ipr_cmnd - Get a free IPR Cmnd block
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ * 	pointer to ipr command struct
+ **/
+static
+struct ipr_cmnd *ipr_get_free_ipr_cmnd(struct ipr_ioa_cfg *ioa_cfg)
+{
+	struct ipr_cmnd *ipr_cmd;
+
+	ipr_cmd = list_entry(ioa_cfg->free_q.next, struct ipr_cmnd, queue);
+	list_del(&ipr_cmd->queue);
+	ipr_init_ipr_cmnd(ipr_cmd);
+
+	return ipr_cmd;
+}
+
+/**
+ * ipr_unmap_sglist - Unmap scatterlist if mapped
+ * @ioa_cfg:	ioa config struct
+ * @ipr_cmd:	ipr command struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_unmap_sglist(struct ipr_ioa_cfg *ioa_cfg,
+			     struct ipr_cmnd *ipr_cmd)
+{
+	struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
+
+	if (ipr_cmd->dma_use_sg) {
+		if (scsi_cmd->use_sg > 0) {
+			pci_unmap_sg(ioa_cfg->pdev, scsi_cmd->request_buffer,
+				     scsi_cmd->use_sg,
+				     scsi_cmd->sc_data_direction);
+		} else {
+			pci_unmap_single(ioa_cfg->pdev, ipr_cmd->dma_handle,
+					 scsi_cmd->request_bufflen,
+					 scsi_cmd->sc_data_direction);
+		}
+	}
+}
+
+/**
+ * ipr_mask_and_clear_interrupts - Mask all and clear specified interrupts
+ * @ioa_cfg:	ioa config struct
+ * @clr_ints:     interrupts to clear
+ *
+ * This function masks all interrupts on the adapter, then clears the
+ * interrupts specified in the mask
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_mask_and_clear_interrupts(struct ipr_ioa_cfg *ioa_cfg,
+					  u32 clr_ints)
+{
+	volatile u32 int_reg;
+
+	/* Stop new interrupts */
+	ioa_cfg->allow_interrupts = 0;
+
+	/* Set interrupt mask to stop all new interrupts */
+	writel(~0, ioa_cfg->regs.set_interrupt_mask_reg);
+
+	/* Clear any pending interrupts */
+	writel(clr_ints, ioa_cfg->regs.clr_interrupt_reg);
+	int_reg = readl(ioa_cfg->regs.sense_interrupt_reg);
+}
+
+/**
+ * ipr_save_pcix_cmd_reg - Save PCI-X command register
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ * 	0 on success / -EIO on failure
+ **/
+static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
+{
+	int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+
+	if (pcix_cmd_reg == 0) {
+		dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n");
+		return -EIO;
+	}
+
+	if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg,
+				 &ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+		dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n");
+		return -EIO;
+	}
+
+	ioa_cfg->saved_pcix_cmd_reg |= PCI_X_CMD_DPERR_E | PCI_X_CMD_ERO;
+	return 0;
+}
+
+/**
+ * ipr_set_pcix_cmd_reg - Setup PCI-X command register
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ * 	0 on success / -EIO on failure
+ **/
+static int ipr_set_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
+{
+	int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+
+	if (pcix_cmd_reg) {
+		if (pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg,
+					  ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+			dev_err(&ioa_cfg->pdev->dev, "Failed to setup PCI-X command register\n");
+			return -EIO;
+		}
+	} else {
+		dev_err(&ioa_cfg->pdev->dev,
+			"Failed to setup PCI-X command register\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
+/**
+ * ipr_scsi_eh_done - mid-layer done function for aborted ops
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function is invoked by the interrupt handler for
+ * ops generated by the SCSI mid-layer which are being aborted.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_scsi_eh_done(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
+
+	scsi_cmd->result |= (DID_ERROR << 16);
+
+	ipr_unmap_sglist(ioa_cfg, ipr_cmd);
+	scsi_cmd->scsi_done(scsi_cmd);
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+}
+
+/**
+ * ipr_fail_all_ops - Fails all outstanding ops.
+ * @ioa_cfg:	ioa config struct
+ *
+ * This function fails all outstanding ops.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_fail_all_ops(struct ipr_ioa_cfg *ioa_cfg)
+{
+	struct ipr_cmnd *ipr_cmd, *temp;
+
+	ENTER;
+	list_for_each_entry_safe(ipr_cmd, temp, &ioa_cfg->pending_q, queue) {
+		list_del(&ipr_cmd->queue);
+
+		ipr_cmd->ioasa.ioasc = cpu_to_be32(IPR_IOASC_IOA_WAS_RESET);
+		ipr_cmd->ioasa.ilid = cpu_to_be32(IPR_DRIVER_ILID);
+
+		if (ipr_cmd->scsi_cmd)
+			ipr_cmd->done = ipr_scsi_eh_done;
+
+		ipr_trc_hook(ipr_cmd, IPR_TRACE_FINISH, IPR_IOASC_IOA_WAS_RESET);
+		del_timer(&ipr_cmd->timer);
+		ipr_cmd->done(ipr_cmd);
+	}
+
+	LEAVE;
+}
+
+/**
+ * ipr_do_req -  Send driver initiated requests.
+ * @ipr_cmd:		ipr command struct
+ * @done:			done function
+ * @timeout_func:	timeout function
+ * @timeout:		timeout value
+ *
+ * This function sends the specified command to the adapter with the
+ * timeout given. The done function is invoked on command completion.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_do_req(struct ipr_cmnd *ipr_cmd,
+		       void (*done) (struct ipr_cmnd *),
+		       void (*timeout_func) (struct ipr_cmnd *), u32 timeout)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->pending_q);
+
+	ipr_cmd->done = done;
+
+	ipr_cmd->timer.data = (unsigned long) ipr_cmd;
+	ipr_cmd->timer.expires = jiffies + timeout;
+	ipr_cmd->timer.function = (void (*)(unsigned long))timeout_func;
+
+	add_timer(&ipr_cmd->timer);
+
+	ipr_trc_hook(ipr_cmd, IPR_TRACE_START, 0);
+
+	mb();
+	writel(be32_to_cpu(ipr_cmd->ioarcb.ioarcb_host_pci_addr),
+	       ioa_cfg->regs.ioarrin_reg);
+}
+
+/**
+ * ipr_internal_cmd_done - Op done function for an internally generated op.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function is the op done function for an internally generated,
+ * blocking op. It simply wakes the sleeping thread.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_internal_cmd_done(struct ipr_cmnd *ipr_cmd)
+{
+	if (ipr_cmd->u.sibling)
+		ipr_cmd->u.sibling = NULL;
+	else
+		complete(&ipr_cmd->completion);
+}
+
+/**
+ * ipr_send_blocking_cmd - Send command and sleep on its completion.
+ * @ipr_cmd:	ipr command struct
+ * @timeout_func:	function to invoke if command times out
+ * @timeout:	timeout
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_send_blocking_cmd(struct ipr_cmnd *ipr_cmd,
+				  void (*timeout_func) (struct ipr_cmnd *ipr_cmd),
+				  u32 timeout)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	init_completion(&ipr_cmd->completion);
+	ipr_do_req(ipr_cmd, ipr_internal_cmd_done, timeout_func, timeout);
+
+	spin_unlock_irq(ioa_cfg->host->host_lock);
+	wait_for_completion(&ipr_cmd->completion);
+	spin_lock_irq(ioa_cfg->host->host_lock);
+}
+
+/**
+ * ipr_send_hcam - Send an HCAM to the adapter.
+ * @ioa_cfg:	ioa config struct
+ * @type:		HCAM type
+ * @hostrcb:	hostrcb struct
+ *
+ * This function will send a Host Controlled Async command to the adapter.
+ * If HCAMs are currently not allowed to be issued to the adapter, it will
+ * place the hostrcb on the free queue.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_send_hcam(struct ipr_ioa_cfg *ioa_cfg, u8 type,
+			  struct ipr_hostrcb *hostrcb)
+{
+	struct ipr_cmnd *ipr_cmd;
+	struct ipr_ioarcb *ioarcb;
+
+	if (ioa_cfg->allow_cmds) {
+		ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
+		list_add_tail(&ipr_cmd->queue, &ioa_cfg->pending_q);
+		list_add_tail(&hostrcb->queue, &ioa_cfg->hostrcb_pending_q);
+
+		ipr_cmd->u.hostrcb = hostrcb;
+		ioarcb = &ipr_cmd->ioarcb;
+
+		ioarcb->res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
+		ioarcb->cmd_pkt.request_type = IPR_RQTYPE_HCAM;
+		ioarcb->cmd_pkt.cdb[0] = IPR_HOST_CONTROLLED_ASYNC;
+		ioarcb->cmd_pkt.cdb[1] = type;
+		ioarcb->cmd_pkt.cdb[7] = (sizeof(hostrcb->hcam) >> 8) & 0xff;
+		ioarcb->cmd_pkt.cdb[8] = sizeof(hostrcb->hcam) & 0xff;
+
+		ioarcb->read_data_transfer_length = cpu_to_be32(sizeof(hostrcb->hcam));
+		ioarcb->read_ioadl_len = cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+		ipr_cmd->ioadl[0].flags_and_data_len =
+			cpu_to_be32(IPR_IOADL_FLAGS_READ_LAST | sizeof(hostrcb->hcam));
+		ipr_cmd->ioadl[0].address = cpu_to_be32(hostrcb->hostrcb_dma);
+
+		if (type == IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE)
+			ipr_cmd->done = ipr_process_ccn;
+		else
+			ipr_cmd->done = ipr_process_error;
+
+		ipr_trc_hook(ipr_cmd, IPR_TRACE_START, IPR_IOA_RES_ADDR);
+
+		mb();
+		writel(be32_to_cpu(ipr_cmd->ioarcb.ioarcb_host_pci_addr),
+		       ioa_cfg->regs.ioarrin_reg);
+	} else {
+		list_add_tail(&hostrcb->queue, &ioa_cfg->hostrcb_free_q);
+	}
+}
+
+/**
+ * ipr_init_res_entry - Initialize a resource entry struct.
+ * @res:	resource entry struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_init_res_entry(struct ipr_resource_entry *res)
+{
+	res->needs_sync_complete = 1;
+	res->in_erp = 0;
+	res->add_to_ml = 0;
+	res->del_from_ml = 0;
+	res->resetting_device = 0;
+	res->tcq_active = 0;
+	res->qdepth = IPR_MAX_CMD_PER_LUN;
+	res->sdev = NULL;
+}
+
+/**
+ * ipr_handle_config_change - Handle a config change from the adapter
+ * @ioa_cfg:	ioa config struct
+ * @hostrcb:	hostrcb
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_handle_config_change(struct ipr_ioa_cfg *ioa_cfg,
+			      struct ipr_hostrcb *hostrcb)
+{
+	struct ipr_resource_entry *res = NULL;
+	struct ipr_config_table_entry *cfgte;
+	u32 is_ndn = 1;
+
+	cfgte = &hostrcb->hcam.u.ccn.cfgte;
+
+	list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
+		if (!memcmp(&res->cfgte.res_addr, &cfgte->res_addr,
+			    sizeof(cfgte->res_addr))) {
+			is_ndn = 0;
+			break;
+		}
+	}
+
+	if (is_ndn) {
+		if (list_empty(&ioa_cfg->free_res_q)) {
+			ipr_send_hcam(ioa_cfg,
+				      IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE,
+				      hostrcb);
+			return;
+		}
+
+		res = list_entry(ioa_cfg->free_res_q.next,
+				 struct ipr_resource_entry, queue);
+
+		list_del(&res->queue);
+		ipr_init_res_entry(res);
+		list_add_tail(&res->queue, &ioa_cfg->used_res_q);
+	}
+
+	memcpy(&res->cfgte, cfgte, sizeof(struct ipr_config_table_entry));
+
+	if (hostrcb->hcam.notify_type == IPR_HOST_RCB_NOTIF_TYPE_REM_ENTRY) {
+		if (res->sdev) {
+			res->sdev->hostdata = NULL;
+			res->del_from_ml = 1;
+			if (ioa_cfg->allow_ml_add_del)
+				schedule_work(&ioa_cfg->work_q);
+		} else
+			list_move_tail(&res->queue, &ioa_cfg->free_res_q);
+	} else if (!res->sdev) {
+		res->add_to_ml = 1;
+		if (ioa_cfg->allow_ml_add_del)
+			schedule_work(&ioa_cfg->work_q);
+	}
+
+	ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb);
+}
+
+/**
+ * ipr_process_ccn - Op done function for a CCN.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function is the op done function for a configuration
+ * change notification host controlled async from the adapter.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_hostrcb *hostrcb = ipr_cmd->u.hostrcb;
+	u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+	list_del(&hostrcb->queue);
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+
+	if (ioasc) {
+		if (ioasc != IPR_IOASC_IOA_WAS_RESET)
+			dev_err(&ioa_cfg->pdev->dev,
+				"Host RCB failed with IOASC: 0x%08X\n", ioasc);
+
+		ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb);
+	} else {
+		ipr_handle_config_change(ioa_cfg, hostrcb);
+	}
+}
+
+/**
+ * ipr_log_vpd - Log the passed VPD to the error log.
+ * @vpids:			vendor/product id struct
+ * @serial_num:		serial number string
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_log_vpd(struct ipr_std_inq_vpids *vpids, u8 *serial_num)
+{
+	char buffer[max_t(int, sizeof(struct ipr_std_inq_vpids),
+			  IPR_SERIAL_NUM_LEN) + 1];
+
+	memcpy(buffer, vpids, sizeof(struct ipr_std_inq_vpids));
+	buffer[sizeof(struct ipr_std_inq_vpids)] = '\0';
+	ipr_err("Vendor/Product ID: %s\n", buffer);
+
+	memcpy(buffer, serial_num, IPR_SERIAL_NUM_LEN);
+	buffer[IPR_SERIAL_NUM_LEN] = '\0';
+	ipr_err("    Serial Number: %s\n", buffer);
+}
+
+/**
+ * ipr_log_cache_error - Log a cache error.
+ * @ioa_cfg:	ioa config struct
+ * @hostrcb:	hostrcb struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_log_cache_error(struct ipr_ioa_cfg *ioa_cfg,
+				struct ipr_hostrcb *hostrcb)
+{
+	struct ipr_hostrcb_type_02_error *error =
+		&hostrcb->hcam.u.error.u.type_02_error;
+
+	ipr_err("-----Current Configuration-----\n");
+	ipr_err("Cache Directory Card Information:\n");
+	ipr_log_vpd(&error->ioa_vpids, error->ioa_sn);
+	ipr_err("Adapter Card Information:\n");
+	ipr_log_vpd(&error->cfc_vpids, error->cfc_sn);
+
+	ipr_err("-----Expected Configuration-----\n");
+	ipr_err("Cache Directory Card Information:\n");
+	ipr_log_vpd(&error->ioa_last_attached_to_cfc_vpids,
+		    error->ioa_last_attached_to_cfc_sn);
+	ipr_err("Adapter Card Information:\n");
+	ipr_log_vpd(&error->cfc_last_attached_to_ioa_vpids,
+		    error->cfc_last_attached_to_ioa_sn);
+
+	ipr_err("Additional IOA Data: %08X %08X %08X\n",
+		     be32_to_cpu(error->ioa_data[0]),
+		     be32_to_cpu(error->ioa_data[1]),
+		     be32_to_cpu(error->ioa_data[2]));
+}
+
+/**
+ * ipr_log_config_error - Log a configuration error.
+ * @ioa_cfg:	ioa config struct
+ * @hostrcb:	hostrcb struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_log_config_error(struct ipr_ioa_cfg *ioa_cfg,
+				 struct ipr_hostrcb *hostrcb)
+{
+	int errors_logged, i;
+	struct ipr_hostrcb_device_data_entry *dev_entry;
+	struct ipr_hostrcb_type_03_error *error;
+
+	error = &hostrcb->hcam.u.error.u.type_03_error;
+	errors_logged = be32_to_cpu(error->errors_logged);
+
+	ipr_err("Device Errors Detected/Logged: %d/%d\n",
+		be32_to_cpu(error->errors_detected), errors_logged);
+
+	dev_entry = error->dev_entry;
+
+	for (i = 0; i < errors_logged; i++, dev_entry++) {
+		ipr_err_separator;
+
+		if (dev_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) {
+			ipr_err("Device %d: missing\n", i + 1);
+		} else {
+			ipr_err("Device %d: %d:%d:%d:%d\n", i + 1,
+				ioa_cfg->host->host_no, dev_entry->dev_res_addr.bus,
+				dev_entry->dev_res_addr.target, dev_entry->dev_res_addr.lun);
+		}
+		ipr_log_vpd(&dev_entry->dev_vpids, dev_entry->dev_sn);
+
+		ipr_err("-----New Device Information-----\n");
+		ipr_log_vpd(&dev_entry->new_dev_vpids, dev_entry->new_dev_sn);
+
+		ipr_err("Cache Directory Card Information:\n");
+		ipr_log_vpd(&dev_entry->ioa_last_with_dev_vpids,
+			    dev_entry->ioa_last_with_dev_sn);
+
+		ipr_err("Adapter Card Information:\n");
+		ipr_log_vpd(&dev_entry->cfc_last_with_dev_vpids,
+			    dev_entry->cfc_last_with_dev_sn);
+
+		ipr_err("Additional IOA Data: %08X %08X %08X %08X %08X\n",
+			be32_to_cpu(dev_entry->ioa_data[0]),
+			be32_to_cpu(dev_entry->ioa_data[1]),
+			be32_to_cpu(dev_entry->ioa_data[2]),
+			be32_to_cpu(dev_entry->ioa_data[3]),
+			be32_to_cpu(dev_entry->ioa_data[4]));
+	}
+}
+
+/**
+ * ipr_log_array_error - Log an array configuration error.
+ * @ioa_cfg:	ioa config struct
+ * @hostrcb:	hostrcb struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_log_array_error(struct ipr_ioa_cfg *ioa_cfg,
+				struct ipr_hostrcb *hostrcb)
+{
+	int i;
+	struct ipr_hostrcb_type_04_error *error;
+	struct ipr_hostrcb_array_data_entry *array_entry;
+	u8 zero_sn[IPR_SERIAL_NUM_LEN];
+
+	memset(zero_sn, '0', IPR_SERIAL_NUM_LEN);
+
+	error = &hostrcb->hcam.u.error.u.type_04_error;
+
+	ipr_err_separator;
+
+	ipr_err("RAID %s Array Configuration: %d:%d:%d:%d\n",
+		error->protection_level,
+		ioa_cfg->host->host_no,
+		error->last_func_vset_res_addr.bus,
+		error->last_func_vset_res_addr.target,
+		error->last_func_vset_res_addr.lun);
+
+	ipr_err_separator;
+
+	array_entry = error->array_member;
+
+	for (i = 0; i < 18; i++) {
+		if (!memcmp(array_entry->serial_num, zero_sn, IPR_SERIAL_NUM_LEN))
+			continue;
+
+		if (error->exposed_mode_adn == i) {
+			ipr_err("Exposed Array Member %d:\n", i);
+		} else {
+			ipr_err("Array Member %d:\n", i);
+		}
+
+		ipr_log_vpd(&array_entry->vpids, array_entry->serial_num);
+
+		if (array_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) {
+			ipr_err("Current Location: unknown\n");
+		} else {
+			ipr_err("Current Location: %d:%d:%d:%d\n",
+				ioa_cfg->host->host_no,
+				array_entry->dev_res_addr.bus,
+				array_entry->dev_res_addr.target,
+				array_entry->dev_res_addr.lun);
+		}
+
+		if (array_entry->dev_res_addr.bus >= IPR_MAX_NUM_BUSES) {
+			ipr_err("Expected Location: unknown\n");
+		} else {
+			ipr_err("Expected Location: %d:%d:%d:%d\n",
+				ioa_cfg->host->host_no,
+				array_entry->expected_dev_res_addr.bus,
+				array_entry->expected_dev_res_addr.target,
+				array_entry->expected_dev_res_addr.lun);
+		}
+
+		ipr_err_separator;
+
+		if (i == 9)
+			array_entry = error->array_member2;
+		else
+			array_entry++;
+	}
+}
+
+/**
+ * ipr_log_generic_error - Log an adapter error.
+ * @ioa_cfg:	ioa config struct
+ * @hostrcb:	hostrcb struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_log_generic_error(struct ipr_ioa_cfg *ioa_cfg,
+				  struct ipr_hostrcb *hostrcb)
+{
+	int i;
+	int ioa_data_len = be32_to_cpu(hostrcb->hcam.length);
+
+	if (ioa_data_len == 0)
+		return;
+
+	ipr_err("IOA Error Data:\n");
+	ipr_err("Offset    0 1 2 3  4 5 6 7  8 9 A B  C D E F\n");
+
+	for (i = 0; i < ioa_data_len / 4; i += 4) {
+		ipr_err("%08X: %08X %08X %08X %08X\n", i*4,
+			be32_to_cpu(hostrcb->hcam.u.raw.data[i]),
+			be32_to_cpu(hostrcb->hcam.u.raw.data[i+1]),
+			be32_to_cpu(hostrcb->hcam.u.raw.data[i+2]),
+			be32_to_cpu(hostrcb->hcam.u.raw.data[i+3]));
+	}
+}
+
+/**
+ * ipr_get_error - Find the specfied IOASC in the ipr_error_table.
+ * @ioasc:	IOASC
+ *
+ * This function will return the index of into the ipr_error_table
+ * for the specified IOASC. If the IOASC is not in the table,
+ * 0 will be returned, which points to the entry used for unknown errors.
+ *
+ * Return value:
+ * 	index into the ipr_error_table
+ **/
+static u32 ipr_get_error(u32 ioasc)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(ipr_error_table); i++)
+		if (ipr_error_table[i].ioasc == ioasc)
+			return i;
+
+	return 0;
+}
+
+/**
+ * ipr_handle_log_data - Log an adapter error.
+ * @ioa_cfg:	ioa config struct
+ * @hostrcb:	hostrcb struct
+ *
+ * This function logs an adapter error to the system.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_handle_log_data(struct ipr_ioa_cfg *ioa_cfg,
+				struct ipr_hostrcb *hostrcb)
+{
+	u32 ioasc;
+	int error_index;
+
+	if (hostrcb->hcam.notify_type != IPR_HOST_RCB_NOTIF_TYPE_ERROR_LOG_ENTRY)
+		return;
+
+	if (hostrcb->hcam.notifications_lost == IPR_HOST_RCB_NOTIFICATIONS_LOST)
+		dev_err(&ioa_cfg->pdev->dev, "Error notifications lost\n");
+
+	ioasc = be32_to_cpu(hostrcb->hcam.u.error.failing_dev_ioasc);
+
+	if (ioasc == IPR_IOASC_BUS_WAS_RESET ||
+	    ioasc == IPR_IOASC_BUS_WAS_RESET_BY_OTHER) {
+		/* Tell the midlayer we had a bus reset so it will handle the UA properly */
+		scsi_report_bus_reset(ioa_cfg->host,
+				      hostrcb->hcam.u.error.failing_dev_res_addr.bus);
+	}
+
+	error_index = ipr_get_error(ioasc);
+
+	if (!ipr_error_table[error_index].log_hcam)
+		return;
+
+	if (ipr_is_device(&hostrcb->hcam.u.error.failing_dev_res_addr)) {
+		ipr_res_err(ioa_cfg, hostrcb->hcam.u.error.failing_dev_res_addr,
+			    "%s\n", ipr_error_table[error_index].error);
+	} else {
+		dev_err(&ioa_cfg->pdev->dev, "%s\n",
+			ipr_error_table[error_index].error);
+	}
+
+	/* Set indication we have logged an error */
+	ioa_cfg->errors_logged++;
+
+	if (ioa_cfg->log_level < IPR_DEFAULT_LOG_LEVEL)
+		return;
+
+	switch (hostrcb->hcam.overlay_id) {
+	case IPR_HOST_RCB_OVERLAY_ID_1:
+		ipr_log_generic_error(ioa_cfg, hostrcb);
+		break;
+	case IPR_HOST_RCB_OVERLAY_ID_2:
+		ipr_log_cache_error(ioa_cfg, hostrcb);
+		break;
+	case IPR_HOST_RCB_OVERLAY_ID_3:
+		ipr_log_config_error(ioa_cfg, hostrcb);
+		break;
+	case IPR_HOST_RCB_OVERLAY_ID_4:
+	case IPR_HOST_RCB_OVERLAY_ID_6:
+		ipr_log_array_error(ioa_cfg, hostrcb);
+		break;
+	case IPR_HOST_RCB_OVERLAY_ID_DEFAULT:
+		ipr_log_generic_error(ioa_cfg, hostrcb);
+		break;
+	default:
+		dev_err(&ioa_cfg->pdev->dev,
+			"Unknown error received. Overlay ID: %d\n",
+			hostrcb->hcam.overlay_id);
+		break;
+	}
+}
+
+/**
+ * ipr_process_error - Op done function for an adapter error log.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function is the op done function for an error log host
+ * controlled async from the adapter. It will log the error and
+ * send the HCAM back to the adapter.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_process_error(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_hostrcb *hostrcb = ipr_cmd->u.hostrcb;
+	u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+	list_del(&hostrcb->queue);
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+
+	if (!ioasc) {
+		ipr_handle_log_data(ioa_cfg, hostrcb);
+	} else if (ioasc != IPR_IOASC_IOA_WAS_RESET) {
+		dev_err(&ioa_cfg->pdev->dev,
+			"Host RCB failed with IOASC: 0x%08X\n", ioasc);
+	}
+
+	ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_LOG_DATA, hostrcb);
+}
+
+/**
+ * ipr_timeout -  An internally generated op has timed out.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function blocks host requests and initiates an
+ * adapter reset.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_timeout(struct ipr_cmnd *ipr_cmd)
+{
+	unsigned long lock_flags = 0;
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	ENTER;
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	ioa_cfg->errors_logged++;
+	dev_err(&ioa_cfg->pdev->dev,
+		"Adapter being reset due to command timeout.\n");
+
+	if (WAIT_FOR_DUMP == ioa_cfg->sdt_state)
+		ioa_cfg->sdt_state = GET_DUMP;
+
+	if (!ioa_cfg->in_reset_reload || ioa_cfg->reset_cmd == ipr_cmd)
+		ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	LEAVE;
+}
+
+/**
+ * ipr_reset_reload - Reset/Reload the IOA
+ * @ioa_cfg:		ioa config struct
+ * @shutdown_type:	shutdown type
+ *
+ * This function resets the adapter and re-initializes it.
+ * This function assumes that all new host commands have been stopped.
+ * Return value:
+ * 	SUCCESS / FAILED
+ **/
+static int ipr_reset_reload(struct ipr_ioa_cfg *ioa_cfg,
+			    enum ipr_shutdown_type shutdown_type)
+{
+	if (!ioa_cfg->in_reset_reload)
+		ipr_initiate_ioa_reset(ioa_cfg, shutdown_type);
+
+	spin_unlock_irq(ioa_cfg->host->host_lock);
+	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+	spin_lock_irq(ioa_cfg->host->host_lock);
+
+	/* If we got hit with a host reset while we were already resetting
+	 the adapter for some reason, and the reset failed. */
+	if (ioa_cfg->ioa_is_dead) {
+		ipr_trace;
+		return FAILED;
+	}
+
+	return SUCCESS;
+}
+
+/**
+ * ipr_find_ses_entry - Find matching SES in SES table
+ * @res:	resource entry struct of SES
+ *
+ * Return value:
+ * 	pointer to SES table entry / NULL on failure
+ **/
+static const struct ipr_ses_table_entry *
+ipr_find_ses_entry(struct ipr_resource_entry *res)
+{
+	int i, j, matches;
+	const struct ipr_ses_table_entry *ste = ipr_ses_table;
+
+	for (i = 0; i < ARRAY_SIZE(ipr_ses_table); i++, ste++) {
+		for (j = 0, matches = 0; j < IPR_PROD_ID_LEN; j++) {
+			if (ste->compare_product_id_byte[j] == 'X') {
+				if (res->cfgte.std_inq_data.vpids.product_id[j] == ste->product_id[j])
+					matches++;
+				else
+					break;
+			} else
+				matches++;
+		}
+
+		if (matches == IPR_PROD_ID_LEN)
+			return ste;
+	}
+
+	return NULL;
+}
+
+/**
+ * ipr_get_max_scsi_speed - Determine max SCSI speed for a given bus
+ * @ioa_cfg:	ioa config struct
+ * @bus:		SCSI bus
+ * @bus_width:	bus width
+ *
+ * Return value:
+ *	SCSI bus speed in units of 100KHz, 1600 is 160 MHz
+ *	For a 2-byte wide SCSI bus, the maximum transfer speed is
+ *	twice the maximum transfer rate (e.g. for a wide enabled bus,
+ *	max 160MHz = max 320MB/sec).
+ **/
+static u32 ipr_get_max_scsi_speed(struct ipr_ioa_cfg *ioa_cfg, u8 bus, u8 bus_width)
+{
+	struct ipr_resource_entry *res;
+	const struct ipr_ses_table_entry *ste;
+	u32 max_xfer_rate = IPR_MAX_SCSI_RATE(bus_width);
+
+	/* Loop through each config table entry in the config table buffer */
+	list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
+		if (!(IPR_IS_SES_DEVICE(res->cfgte.std_inq_data)))
+			continue;
+
+		if (bus != res->cfgte.res_addr.bus)
+			continue;
+
+		if (!(ste = ipr_find_ses_entry(res)))
+			continue;
+
+		max_xfer_rate = (ste->max_bus_speed_limit * 10) / (bus_width / 8);
+	}
+
+	return max_xfer_rate;
+}
+
+/**
+ * ipr_wait_iodbg_ack - Wait for an IODEBUG ACK from the IOA
+ * @ioa_cfg:		ioa config struct
+ * @max_delay:		max delay in micro-seconds to wait
+ *
+ * Waits for an IODEBUG ACK from the IOA, doing busy looping.
+ *
+ * Return value:
+ * 	0 on success / other on failure
+ **/
+static int ipr_wait_iodbg_ack(struct ipr_ioa_cfg *ioa_cfg, int max_delay)
+{
+	volatile u32 pcii_reg;
+	int delay = 1;
+
+	/* Read interrupt reg until IOA signals IO Debug Acknowledge */
+	while (delay < max_delay) {
+		pcii_reg = readl(ioa_cfg->regs.sense_interrupt_reg);
+
+		if (pcii_reg & IPR_PCII_IO_DEBUG_ACKNOWLEDGE)
+			return 0;
+
+		/* udelay cannot be used if delay is more than a few milliseconds */
+		if ((delay / 1000) > MAX_UDELAY_MS)
+			mdelay(delay / 1000);
+		else
+			udelay(delay);
+
+		delay += delay;
+	}
+	return -EIO;
+}
+
+/**
+ * ipr_get_ldump_data_section - Dump IOA memory
+ * @ioa_cfg:			ioa config struct
+ * @start_addr:			adapter address to dump
+ * @dest:				destination kernel buffer
+ * @length_in_words:	length to dump in 4 byte words
+ *
+ * Return value:
+ * 	0 on success / -EIO on failure
+ **/
+static int ipr_get_ldump_data_section(struct ipr_ioa_cfg *ioa_cfg,
+				      u32 start_addr,
+				      u32 *dest, u32 length_in_words)
+{
+	volatile u32 temp_pcii_reg;
+	int i, delay = 0;
+
+	/* Write IOA interrupt reg starting LDUMP state  */
+	writel((IPR_UPROCI_RESET_ALERT | IPR_UPROCI_IO_DEBUG_ALERT),
+	       ioa_cfg->regs.set_uproc_interrupt_reg);
+
+	/* Wait for IO debug acknowledge */
+	if (ipr_wait_iodbg_ack(ioa_cfg,
+			       IPR_LDUMP_MAX_LONG_ACK_DELAY_IN_USEC)) {
+		dev_err(&ioa_cfg->pdev->dev,
+			"IOA dump long data transfer timeout\n");
+		return -EIO;
+	}
+
+	/* Signal LDUMP interlocked - clear IO debug ack */
+	writel(IPR_PCII_IO_DEBUG_ACKNOWLEDGE,
+	       ioa_cfg->regs.clr_interrupt_reg);
+
+	/* Write Mailbox with starting address */
+	writel(start_addr, ioa_cfg->ioa_mailbox);
+
+	/* Signal address valid - clear IOA Reset alert */
+	writel(IPR_UPROCI_RESET_ALERT,
+	       ioa_cfg->regs.clr_uproc_interrupt_reg);
+
+	for (i = 0; i < length_in_words; i++) {
+		/* Wait for IO debug acknowledge */
+		if (ipr_wait_iodbg_ack(ioa_cfg,
+				       IPR_LDUMP_MAX_SHORT_ACK_DELAY_IN_USEC)) {
+			dev_err(&ioa_cfg->pdev->dev,
+				"IOA dump short data transfer timeout\n");
+			return -EIO;
+		}
+
+		/* Read data from mailbox and increment destination pointer */
+		*dest = cpu_to_be32(readl(ioa_cfg->ioa_mailbox));
+		dest++;
+
+		/* For all but the last word of data, signal data received */
+		if (i < (length_in_words - 1)) {
+			/* Signal dump data received - Clear IO debug Ack */
+			writel(IPR_PCII_IO_DEBUG_ACKNOWLEDGE,
+			       ioa_cfg->regs.clr_interrupt_reg);
+		}
+	}
+
+	/* Signal end of block transfer. Set reset alert then clear IO debug ack */
+	writel(IPR_UPROCI_RESET_ALERT,
+	       ioa_cfg->regs.set_uproc_interrupt_reg);
+
+	writel(IPR_UPROCI_IO_DEBUG_ALERT,
+	       ioa_cfg->regs.clr_uproc_interrupt_reg);
+
+	/* Signal dump data received - Clear IO debug Ack */
+	writel(IPR_PCII_IO_DEBUG_ACKNOWLEDGE,
+	       ioa_cfg->regs.clr_interrupt_reg);
+
+	/* Wait for IOA to signal LDUMP exit - IOA reset alert will be cleared */
+	while (delay < IPR_LDUMP_MAX_SHORT_ACK_DELAY_IN_USEC) {
+		temp_pcii_reg =
+		    readl(ioa_cfg->regs.sense_uproc_interrupt_reg);
+
+		if (!(temp_pcii_reg & IPR_UPROCI_RESET_ALERT))
+			return 0;
+
+		udelay(10);
+		delay += 10;
+	}
+
+	return 0;
+}
+
+#ifdef CONFIG_SCSI_IPR_DUMP
+/**
+ * ipr_sdt_copy - Copy Smart Dump Table to kernel buffer
+ * @ioa_cfg:		ioa config struct
+ * @pci_address:	adapter address
+ * @length:			length of data to copy
+ *
+ * Copy data from PCI adapter to kernel buffer.
+ * Note: length MUST be a 4 byte multiple
+ * Return value:
+ * 	0 on success / other on failure
+ **/
+static int ipr_sdt_copy(struct ipr_ioa_cfg *ioa_cfg,
+			unsigned long pci_address, u32 length)
+{
+	int bytes_copied = 0;
+	int cur_len, rc, rem_len, rem_page_len;
+	u32 *page;
+	unsigned long lock_flags = 0;
+	struct ipr_ioa_dump *ioa_dump = &ioa_cfg->dump->ioa_dump;
+
+	while (bytes_copied < length &&
+	       (ioa_dump->hdr.len + bytes_copied) < IPR_MAX_IOA_DUMP_SIZE) {
+		if (ioa_dump->page_offset >= PAGE_SIZE ||
+		    ioa_dump->page_offset == 0) {
+			page = (u32 *)__get_free_page(GFP_ATOMIC);
+
+			if (!page) {
+				ipr_trace;
+				return bytes_copied;
+			}
+
+			ioa_dump->page_offset = 0;
+			ioa_dump->ioa_data[ioa_dump->next_page_index] = page;
+			ioa_dump->next_page_index++;
+		} else
+			page = ioa_dump->ioa_data[ioa_dump->next_page_index - 1];
+
+		rem_len = length - bytes_copied;
+		rem_page_len = PAGE_SIZE - ioa_dump->page_offset;
+		cur_len = min(rem_len, rem_page_len);
+
+		spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+		if (ioa_cfg->sdt_state == ABORT_DUMP) {
+			rc = -EIO;
+		} else {
+			rc = ipr_get_ldump_data_section(ioa_cfg,
+							pci_address + bytes_copied,
+							&page[ioa_dump->page_offset / 4],
+							(cur_len / sizeof(u32)));
+		}
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+		if (!rc) {
+			ioa_dump->page_offset += cur_len;
+			bytes_copied += cur_len;
+		} else {
+			ipr_trace;
+			break;
+		}
+		schedule();
+	}
+
+	return bytes_copied;
+}
+
+/**
+ * ipr_init_dump_entry_hdr - Initialize a dump entry header.
+ * @hdr:	dump entry header struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_init_dump_entry_hdr(struct ipr_dump_entry_header *hdr)
+{
+	hdr->eye_catcher = IPR_DUMP_EYE_CATCHER;
+	hdr->num_elems = 1;
+	hdr->offset = sizeof(*hdr);
+	hdr->status = IPR_DUMP_STATUS_SUCCESS;
+}
+
+/**
+ * ipr_dump_ioa_type_data - Fill in the adapter type in the dump.
+ * @ioa_cfg:	ioa config struct
+ * @driver_dump:	driver dump struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_dump_ioa_type_data(struct ipr_ioa_cfg *ioa_cfg,
+				   struct ipr_driver_dump *driver_dump)
+{
+	struct ipr_inquiry_page3 *ucode_vpd = &ioa_cfg->vpd_cbs->page3_data;
+
+	ipr_init_dump_entry_hdr(&driver_dump->ioa_type_entry.hdr);
+	driver_dump->ioa_type_entry.hdr.len =
+		sizeof(struct ipr_dump_ioa_type_entry) -
+		sizeof(struct ipr_dump_entry_header);
+	driver_dump->ioa_type_entry.hdr.data_type = IPR_DUMP_DATA_TYPE_BINARY;
+	driver_dump->ioa_type_entry.hdr.id = IPR_DUMP_DRIVER_TYPE_ID;
+	driver_dump->ioa_type_entry.type = ioa_cfg->type;
+	driver_dump->ioa_type_entry.fw_version = (ucode_vpd->major_release << 24) |
+		(ucode_vpd->card_type << 16) | (ucode_vpd->minor_release[0] << 8) |
+		ucode_vpd->minor_release[1];
+	driver_dump->hdr.num_entries++;
+}
+
+/**
+ * ipr_dump_version_data - Fill in the driver version in the dump.
+ * @ioa_cfg:	ioa config struct
+ * @driver_dump:	driver dump struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_dump_version_data(struct ipr_ioa_cfg *ioa_cfg,
+				  struct ipr_driver_dump *driver_dump)
+{
+	ipr_init_dump_entry_hdr(&driver_dump->version_entry.hdr);
+	driver_dump->version_entry.hdr.len =
+		sizeof(struct ipr_dump_version_entry) -
+		sizeof(struct ipr_dump_entry_header);
+	driver_dump->version_entry.hdr.data_type = IPR_DUMP_DATA_TYPE_ASCII;
+	driver_dump->version_entry.hdr.id = IPR_DUMP_DRIVER_VERSION_ID;
+	strcpy(driver_dump->version_entry.version, IPR_DRIVER_VERSION);
+	driver_dump->hdr.num_entries++;
+}
+
+/**
+ * ipr_dump_trace_data - Fill in the IOA trace in the dump.
+ * @ioa_cfg:	ioa config struct
+ * @driver_dump:	driver dump struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_dump_trace_data(struct ipr_ioa_cfg *ioa_cfg,
+				   struct ipr_driver_dump *driver_dump)
+{
+	ipr_init_dump_entry_hdr(&driver_dump->trace_entry.hdr);
+	driver_dump->trace_entry.hdr.len =
+		sizeof(struct ipr_dump_trace_entry) -
+		sizeof(struct ipr_dump_entry_header);
+	driver_dump->trace_entry.hdr.data_type = IPR_DUMP_DATA_TYPE_BINARY;
+	driver_dump->trace_entry.hdr.id = IPR_DUMP_TRACE_ID;
+	memcpy(driver_dump->trace_entry.trace, ioa_cfg->trace, IPR_TRACE_SIZE);
+	driver_dump->hdr.num_entries++;
+}
+
+/**
+ * ipr_dump_location_data - Fill in the IOA location in the dump.
+ * @ioa_cfg:	ioa config struct
+ * @driver_dump:	driver dump struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_dump_location_data(struct ipr_ioa_cfg *ioa_cfg,
+				   struct ipr_driver_dump *driver_dump)
+{
+	ipr_init_dump_entry_hdr(&driver_dump->location_entry.hdr);
+	driver_dump->location_entry.hdr.len =
+		sizeof(struct ipr_dump_location_entry) -
+		sizeof(struct ipr_dump_entry_header);
+	driver_dump->location_entry.hdr.data_type = IPR_DUMP_DATA_TYPE_ASCII;
+	driver_dump->location_entry.hdr.id = IPR_DUMP_LOCATION_ID;
+	strcpy(driver_dump->location_entry.location, ioa_cfg->pdev->dev.bus_id);
+	driver_dump->hdr.num_entries++;
+}
+
+/**
+ * ipr_get_ioa_dump - Perform a dump of the driver and adapter.
+ * @ioa_cfg:	ioa config struct
+ * @dump:		dump struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_get_ioa_dump(struct ipr_ioa_cfg *ioa_cfg, struct ipr_dump *dump)
+{
+	unsigned long start_addr, sdt_word;
+	unsigned long lock_flags = 0;
+	struct ipr_driver_dump *driver_dump = &dump->driver_dump;
+	struct ipr_ioa_dump *ioa_dump = &dump->ioa_dump;
+	u32 num_entries, start_off, end_off;
+	u32 bytes_to_copy, bytes_copied, rc;
+	struct ipr_sdt *sdt;
+	int i;
+
+	ENTER;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	if (ioa_cfg->sdt_state != GET_DUMP) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return;
+	}
+
+	start_addr = readl(ioa_cfg->ioa_mailbox);
+
+	if (!ipr_sdt_is_fmt2(start_addr)) {
+		dev_err(&ioa_cfg->pdev->dev,
+			"Invalid dump table format: %lx\n", start_addr);
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return;
+	}
+
+	dev_err(&ioa_cfg->pdev->dev, "Dump of IOA initiated\n");
+
+	driver_dump->hdr.eye_catcher = IPR_DUMP_EYE_CATCHER;
+
+	/* Initialize the overall dump header */
+	driver_dump->hdr.len = sizeof(struct ipr_driver_dump);
+	driver_dump->hdr.num_entries = 1;
+	driver_dump->hdr.first_entry_offset = sizeof(struct ipr_dump_header);
+	driver_dump->hdr.status = IPR_DUMP_STATUS_SUCCESS;
+	driver_dump->hdr.os = IPR_DUMP_OS_LINUX;
+	driver_dump->hdr.driver_name = IPR_DUMP_DRIVER_NAME;
+
+	ipr_dump_version_data(ioa_cfg, driver_dump);
+	ipr_dump_location_data(ioa_cfg, driver_dump);
+	ipr_dump_ioa_type_data(ioa_cfg, driver_dump);
+	ipr_dump_trace_data(ioa_cfg, driver_dump);
+
+	/* Update dump_header */
+	driver_dump->hdr.len += sizeof(struct ipr_dump_entry_header);
+
+	/* IOA Dump entry */
+	ipr_init_dump_entry_hdr(&ioa_dump->hdr);
+	ioa_dump->format = IPR_SDT_FMT2;
+	ioa_dump->hdr.len = 0;
+	ioa_dump->hdr.data_type = IPR_DUMP_DATA_TYPE_BINARY;
+	ioa_dump->hdr.id = IPR_DUMP_IOA_DUMP_ID;
+
+	/* First entries in sdt are actually a list of dump addresses and
+	 lengths to gather the real dump data.  sdt represents the pointer
+	 to the ioa generated dump table.  Dump data will be extracted based
+	 on entries in this table */
+	sdt = &ioa_dump->sdt;
+
+	rc = ipr_get_ldump_data_section(ioa_cfg, start_addr, (u32 *)sdt,
+					sizeof(struct ipr_sdt) / sizeof(u32));
+
+	/* Smart Dump table is ready to use and the first entry is valid */
+	if (rc || (be32_to_cpu(sdt->hdr.state) != IPR_FMT2_SDT_READY_TO_USE)) {
+		dev_err(&ioa_cfg->pdev->dev,
+			"Dump of IOA failed. Dump table not valid: %d, %X.\n",
+			rc, be32_to_cpu(sdt->hdr.state));
+		driver_dump->hdr.status = IPR_DUMP_STATUS_FAILED;
+		ioa_cfg->sdt_state = DUMP_OBTAINED;
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return;
+	}
+
+	num_entries = be32_to_cpu(sdt->hdr.num_entries_used);
+
+	if (num_entries > IPR_NUM_SDT_ENTRIES)
+		num_entries = IPR_NUM_SDT_ENTRIES;
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+	for (i = 0; i < num_entries; i++) {
+		if (ioa_dump->hdr.len > IPR_MAX_IOA_DUMP_SIZE) {
+			driver_dump->hdr.status = IPR_DUMP_STATUS_QUAL_SUCCESS;
+			break;
+		}
+
+		if (sdt->entry[i].flags & IPR_SDT_VALID_ENTRY) {
+			sdt_word = be32_to_cpu(sdt->entry[i].bar_str_offset);
+			start_off = sdt_word & IPR_FMT2_MBX_ADDR_MASK;
+			end_off = be32_to_cpu(sdt->entry[i].end_offset);
+
+			if (ipr_sdt_is_fmt2(sdt_word) && sdt_word) {
+				bytes_to_copy = end_off - start_off;
+				if (bytes_to_copy > IPR_MAX_IOA_DUMP_SIZE) {
+					sdt->entry[i].flags &= ~IPR_SDT_VALID_ENTRY;
+					continue;
+				}
+
+				/* Copy data from adapter to driver buffers */
+				bytes_copied = ipr_sdt_copy(ioa_cfg, sdt_word,
+							    bytes_to_copy);
+
+				ioa_dump->hdr.len += bytes_copied;
+
+				if (bytes_copied != bytes_to_copy) {
+					driver_dump->hdr.status = IPR_DUMP_STATUS_QUAL_SUCCESS;
+					break;
+				}
+			}
+		}
+	}
+
+	dev_err(&ioa_cfg->pdev->dev, "Dump of IOA completed.\n");
+
+	/* Update dump_header */
+	driver_dump->hdr.len += ioa_dump->hdr.len;
+	wmb();
+	ioa_cfg->sdt_state = DUMP_OBTAINED;
+	LEAVE;
+}
+
+#else
+#define ipr_get_ioa_dump(ioa_cfg, dump) do { } while(0)
+#endif
+
+/**
+ * ipr_worker_thread - Worker thread
+ * @data:		ioa config struct
+ *
+ * Called at task level from a work thread. This function takes care
+ * of adding and removing device from the mid-layer as configuration
+ * changes are detected by the adapter.
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_worker_thread(void *data)
+{
+	unsigned long lock_flags;
+	struct ipr_resource_entry *res;
+	struct scsi_device *sdev;
+	struct ipr_dump *dump;
+	struct ipr_ioa_cfg *ioa_cfg = data;
+	u8 bus, target, lun;
+	int did_work;
+
+	ENTER;
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	if (ioa_cfg->sdt_state == GET_DUMP) {
+		dump = ioa_cfg->dump;
+		if (!dump || !kobject_get(&dump->kobj)) {
+			spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+			return;
+		}
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		ipr_get_ioa_dump(ioa_cfg, dump);
+		kobject_put(&dump->kobj);
+
+		spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+		if (ioa_cfg->sdt_state == DUMP_OBTAINED)
+			ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return;
+	}
+
+restart:
+	do {
+		did_work = 0;
+		if (!ioa_cfg->allow_cmds || !ioa_cfg->allow_ml_add_del) {
+			spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+			return;
+		}
+
+		list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
+			if (res->del_from_ml && res->sdev) {
+				did_work = 1;
+				sdev = res->sdev;
+				if (!scsi_device_get(sdev)) {
+					res->sdev = NULL;
+					list_move_tail(&res->queue, &ioa_cfg->free_res_q);
+					spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+					scsi_remove_device(sdev);
+					scsi_device_put(sdev);
+					spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+				}
+				break;
+			}
+		}
+	} while(did_work);
+
+	list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
+		if (res->add_to_ml) {
+			bus = res->cfgte.res_addr.bus;
+			target = res->cfgte.res_addr.target;
+			lun = res->cfgte.res_addr.lun;
+			spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+			scsi_add_device(ioa_cfg->host, bus, target, lun);
+			spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+			goto restart;
+		}
+	}
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	LEAVE;
+}
+
+#ifdef CONFIG_SCSI_IPR_TRACE
+/**
+ * ipr_read_trace - Dump the adapter trace
+ * @kobj:		kobject struct
+ * @buf:		buffer
+ * @off:		offset
+ * @count:		buffer size
+ *
+ * Return value:
+ *	number of bytes printed to buffer
+ **/
+static ssize_t ipr_read_trace(struct kobject *kobj, char *buf,
+			      loff_t off, size_t count)
+{
+	struct class_device *cdev = container_of(kobj,struct class_device,kobj);
+	struct Scsi_Host *shost = class_to_shost(cdev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	unsigned long lock_flags = 0;
+	int size = IPR_TRACE_SIZE;
+	char *src = (char *)ioa_cfg->trace;
+
+	if (off > size)
+		return 0;
+	if (off + count > size) {
+		size -= off;
+		count = size;
+	}
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	memcpy(buf, &src[off], count);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	return count;
+}
+
+static struct bin_attribute ipr_trace_attr = {
+	.attr =	{
+		.name = "trace",
+		.mode = S_IRUGO,
+	},
+	.size = 0,
+	.read = ipr_read_trace,
+};
+#endif
+
+/**
+ * ipr_show_fw_version - Show the firmware version
+ * @class_dev:	class device struct
+ * @buf:		buffer
+ *
+ * Return value:
+ *	number of bytes printed to buffer
+ **/
+static ssize_t ipr_show_fw_version(struct class_device *class_dev, char *buf)
+{
+	struct Scsi_Host *shost = class_to_shost(class_dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	struct ipr_inquiry_page3 *ucode_vpd = &ioa_cfg->vpd_cbs->page3_data;
+	unsigned long lock_flags = 0;
+	int len;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	len = snprintf(buf, PAGE_SIZE, "%02X%02X%02X%02X\n",
+		       ucode_vpd->major_release, ucode_vpd->card_type,
+		       ucode_vpd->minor_release[0],
+		       ucode_vpd->minor_release[1]);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	return len;
+}
+
+static struct class_device_attribute ipr_fw_version_attr = {
+	.attr = {
+		.name =		"fw_version",
+		.mode =		S_IRUGO,
+	},
+	.show = ipr_show_fw_version,
+};
+
+/**
+ * ipr_show_log_level - Show the adapter's error logging level
+ * @class_dev:	class device struct
+ * @buf:		buffer
+ *
+ * Return value:
+ * 	number of bytes printed to buffer
+ **/
+static ssize_t ipr_show_log_level(struct class_device *class_dev, char *buf)
+{
+	struct Scsi_Host *shost = class_to_shost(class_dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	unsigned long lock_flags = 0;
+	int len;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	len = snprintf(buf, PAGE_SIZE, "%d\n", ioa_cfg->log_level);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	return len;
+}
+
+/**
+ * ipr_store_log_level - Change the adapter's error logging level
+ * @class_dev:	class device struct
+ * @buf:		buffer
+ *
+ * Return value:
+ * 	number of bytes printed to buffer
+ **/
+static ssize_t ipr_store_log_level(struct class_device *class_dev,
+				   const char *buf, size_t count)
+{
+	struct Scsi_Host *shost = class_to_shost(class_dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	unsigned long lock_flags = 0;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	ioa_cfg->log_level = simple_strtoul(buf, NULL, 10);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	return strlen(buf);
+}
+
+static struct class_device_attribute ipr_log_level_attr = {
+	.attr = {
+		.name =		"log_level",
+		.mode =		S_IRUGO | S_IWUSR,
+	},
+	.show = ipr_show_log_level,
+	.store = ipr_store_log_level
+};
+
+/**
+ * ipr_store_diagnostics - IOA Diagnostics interface
+ * @class_dev:	class_device struct
+ * @buf:		buffer
+ * @count:		buffer size
+ *
+ * This function will reset the adapter and wait a reasonable
+ * amount of time for any errors that the adapter might log.
+ *
+ * Return value:
+ * 	count on success / other on failure
+ **/
+static ssize_t ipr_store_diagnostics(struct class_device *class_dev,
+				     const char *buf, size_t count)
+{
+	struct Scsi_Host *shost = class_to_shost(class_dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	unsigned long lock_flags = 0;
+	int rc = count;
+
+	if (!capable(CAP_SYS_ADMIN))
+		return -EACCES;
+
+	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	ioa_cfg->errors_logged = 0;
+	ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL);
+
+	if (ioa_cfg->in_reset_reload) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+
+		/* Wait for a second for any errors to be logged */
+		schedule_timeout(HZ);
+	} else {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return -EIO;
+	}
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	if (ioa_cfg->in_reset_reload || ioa_cfg->errors_logged)
+		rc = -EIO;
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+	return rc;
+}
+
+static struct class_device_attribute ipr_diagnostics_attr = {
+	.attr = {
+		.name =		"run_diagnostics",
+		.mode =		S_IWUSR,
+	},
+	.store = ipr_store_diagnostics
+};
+
+/**
+ * ipr_store_reset_adapter - Reset the adapter
+ * @class_dev:	class_device struct
+ * @buf:		buffer
+ * @count:		buffer size
+ *
+ * This function will reset the adapter.
+ *
+ * Return value:
+ * 	count on success / other on failure
+ **/
+static ssize_t ipr_store_reset_adapter(struct class_device *class_dev,
+				       const char *buf, size_t count)
+{
+	struct Scsi_Host *shost = class_to_shost(class_dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	unsigned long lock_flags;
+	int result = count;
+
+	if (!capable(CAP_SYS_ADMIN))
+		return -EACCES;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	if (!ioa_cfg->in_reset_reload)
+		ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+
+	return result;
+}
+
+static struct class_device_attribute ipr_ioa_reset_attr = {
+	.attr = {
+		.name =		"reset_host",
+		.mode =		S_IWUSR,
+	},
+	.store = ipr_store_reset_adapter
+};
+
+/**
+ * ipr_alloc_ucode_buffer - Allocates a microcode download buffer
+ * @buf_len:		buffer length
+ *
+ * Allocates a DMA'able buffer in chunks and assembles a scatter/gather
+ * list to use for microcode download
+ *
+ * Return value:
+ * 	pointer to sglist / NULL on failure
+ **/
+static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len)
+{
+	int sg_size, order, bsize_elem, num_elem, i, j;
+	struct ipr_sglist *sglist;
+	struct scatterlist *scatterlist;
+	struct page *page;
+
+	/* Get the minimum size per scatter/gather element */
+	sg_size = buf_len / (IPR_MAX_SGLIST - 1);
+
+	/* Get the actual size per element */
+	order = get_order(sg_size);
+
+	/* Determine the actual number of bytes per element */
+	bsize_elem = PAGE_SIZE * (1 << order);
+
+	/* Determine the actual number of sg entries needed */
+	if (buf_len % bsize_elem)
+		num_elem = (buf_len / bsize_elem) + 1;
+	else
+		num_elem = buf_len / bsize_elem;
+
+	/* Allocate a scatter/gather list for the DMA */
+	sglist = kmalloc(sizeof(struct ipr_sglist) +
+			 (sizeof(struct scatterlist) * (num_elem - 1)),
+			 GFP_KERNEL);
+
+	if (sglist == NULL) {
+		ipr_trace;
+		return NULL;
+	}
+
+	memset(sglist, 0, sizeof(struct ipr_sglist) +
+	       (sizeof(struct scatterlist) * (num_elem - 1)));
+
+	scatterlist = sglist->scatterlist;
+
+	sglist->order = order;
+	sglist->num_sg = num_elem;
+
+	/* Allocate a bunch of sg elements */
+	for (i = 0; i < num_elem; i++) {
+		page = alloc_pages(GFP_KERNEL, order);
+		if (!page) {
+			ipr_trace;
+
+			/* Free up what we already allocated */
+			for (j = i - 1; j >= 0; j--)
+				__free_pages(scatterlist[j].page, order);
+			kfree(sglist);
+			return NULL;
+		}
+
+		scatterlist[i].page = page;
+	}
+
+	return sglist;
+}
+
+/**
+ * ipr_free_ucode_buffer - Frees a microcode download buffer
+ * @p_dnld:		scatter/gather list pointer
+ *
+ * Free a DMA'able ucode download buffer previously allocated with
+ * ipr_alloc_ucode_buffer
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_free_ucode_buffer(struct ipr_sglist *sglist)
+{
+	int i;
+
+	for (i = 0; i < sglist->num_sg; i++)
+		__free_pages(sglist->scatterlist[i].page, sglist->order);
+
+	kfree(sglist);
+}
+
+/**
+ * ipr_copy_ucode_buffer - Copy user buffer to kernel buffer
+ * @sglist:		scatter/gather list pointer
+ * @buffer:		buffer pointer
+ * @len:		buffer length
+ *
+ * Copy a microcode image from a user buffer into a buffer allocated by
+ * ipr_alloc_ucode_buffer
+ *
+ * Return value:
+ * 	0 on success / other on failure
+ **/
+static int ipr_copy_ucode_buffer(struct ipr_sglist *sglist,
+				 u8 *buffer, u32 len)
+{
+	int bsize_elem, i, result = 0;
+	struct scatterlist *scatterlist;
+	void *kaddr;
+
+	/* Determine the actual number of bytes per element */
+	bsize_elem = PAGE_SIZE * (1 << sglist->order);
+
+	scatterlist = sglist->scatterlist;
+
+	for (i = 0; i < (len / bsize_elem); i++, buffer += bsize_elem) {
+		kaddr = kmap(scatterlist[i].page);
+		memcpy(kaddr, buffer, bsize_elem);
+		kunmap(scatterlist[i].page);
+
+		scatterlist[i].length = bsize_elem;
+
+		if (result != 0) {
+			ipr_trace;
+			return result;
+		}
+	}
+
+	if (len % bsize_elem) {
+		kaddr = kmap(scatterlist[i].page);
+		memcpy(kaddr, buffer, len % bsize_elem);
+		kunmap(scatterlist[i].page);
+
+		scatterlist[i].length = len % bsize_elem;
+	}
+
+	sglist->buffer_len = len;
+	return result;
+}
+
+/**
+ * ipr_map_ucode_buffer - Map a microcode download buffer
+ * @ipr_cmd:	ipr command struct
+ * @sglist:		scatter/gather list
+ * @len:		total length of download buffer
+ *
+ * Maps a microcode download scatter/gather list for DMA and
+ * builds the IOADL.
+ *
+ * Return value:
+ * 	0 on success / -EIO on failure
+ **/
+static int ipr_map_ucode_buffer(struct ipr_cmnd *ipr_cmd,
+				struct ipr_sglist *sglist, int len)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+	struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
+	struct scatterlist *scatterlist = sglist->scatterlist;
+	int i;
+
+	ipr_cmd->dma_use_sg = pci_map_sg(ioa_cfg->pdev, scatterlist,
+					 sglist->num_sg, DMA_TO_DEVICE);
+
+	ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_WRITE_NOT_READ;
+	ioarcb->write_data_transfer_length = cpu_to_be32(len);
+	ioarcb->write_ioadl_len =
+		cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg);
+
+	for (i = 0; i < ipr_cmd->dma_use_sg; i++) {
+		ioadl[i].flags_and_data_len =
+			cpu_to_be32(IPR_IOADL_FLAGS_WRITE | sg_dma_len(&scatterlist[i]));
+		ioadl[i].address =
+			cpu_to_be32(sg_dma_address(&scatterlist[i]));
+	}
+
+	if (likely(ipr_cmd->dma_use_sg)) {
+		ioadl[i-1].flags_and_data_len |=
+			cpu_to_be32(IPR_IOADL_FLAGS_LAST);
+	}
+	else {
+		dev_err(&ioa_cfg->pdev->dev, "pci_map_sg failed!\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
+/**
+ * ipr_store_update_fw - Update the firmware on the adapter
+ * @class_dev:	class_device struct
+ * @buf:		buffer
+ * @count:		buffer size
+ *
+ * This function will update the firmware on the adapter.
+ *
+ * Return value:
+ * 	count on success / other on failure
+ **/
+static ssize_t ipr_store_update_fw(struct class_device *class_dev,
+				       const char *buf, size_t count)
+{
+	struct Scsi_Host *shost = class_to_shost(class_dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	struct ipr_ucode_image_header *image_hdr;
+	const struct firmware *fw_entry;
+	struct ipr_sglist *sglist;
+	unsigned long lock_flags;
+	char fname[100];
+	char *src;
+	int len, result, dnld_size;
+
+	if (!capable(CAP_SYS_ADMIN))
+		return -EACCES;
+
+	len = snprintf(fname, 99, "%s", buf);
+	fname[len-1] = '\0';
+
+	if(request_firmware(&fw_entry, fname, &ioa_cfg->pdev->dev)) {
+		dev_err(&ioa_cfg->pdev->dev, "Firmware file %s not found\n", fname);
+		return -EIO;
+	}
+
+	image_hdr = (struct ipr_ucode_image_header *)fw_entry->data;
+
+	if (be32_to_cpu(image_hdr->header_length) > fw_entry->size ||
+	    (ioa_cfg->vpd_cbs->page3_data.card_type &&
+	     ioa_cfg->vpd_cbs->page3_data.card_type != image_hdr->card_type)) {
+		dev_err(&ioa_cfg->pdev->dev, "Invalid microcode buffer\n");
+		release_firmware(fw_entry);
+		return -EINVAL;
+	}
+
+	src = (u8 *)image_hdr + be32_to_cpu(image_hdr->header_length);
+	dnld_size = fw_entry->size - be32_to_cpu(image_hdr->header_length);
+	sglist = ipr_alloc_ucode_buffer(dnld_size);
+
+	if (!sglist) {
+		dev_err(&ioa_cfg->pdev->dev, "Microcode buffer allocation failed\n");
+		release_firmware(fw_entry);
+		return -ENOMEM;
+	}
+
+	result = ipr_copy_ucode_buffer(sglist, src, dnld_size);
+
+	if (result) {
+		dev_err(&ioa_cfg->pdev->dev,
+			"Microcode buffer copy to DMA buffer failed\n");
+		ipr_free_ucode_buffer(sglist);
+		release_firmware(fw_entry);
+		return result;
+	}
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	if (ioa_cfg->ucode_sglist) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		dev_err(&ioa_cfg->pdev->dev,
+			"Microcode download already in progress\n");
+		ipr_free_ucode_buffer(sglist);
+		release_firmware(fw_entry);
+		return -EIO;
+	}
+
+	ioa_cfg->ucode_sglist = sglist;
+	ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	ioa_cfg->ucode_sglist = NULL;
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+	ipr_free_ucode_buffer(sglist);
+	release_firmware(fw_entry);
+
+	return count;
+}
+
+static struct class_device_attribute ipr_update_fw_attr = {
+	.attr = {
+		.name =		"update_fw",
+		.mode =		S_IWUSR,
+	},
+	.store = ipr_store_update_fw
+};
+
+static struct class_device_attribute *ipr_ioa_attrs[] = {
+	&ipr_fw_version_attr,
+	&ipr_log_level_attr,
+	&ipr_diagnostics_attr,
+	&ipr_ioa_reset_attr,
+	&ipr_update_fw_attr,
+	NULL,
+};
+
+#ifdef CONFIG_SCSI_IPR_DUMP
+/**
+ * ipr_read_dump - Dump the adapter
+ * @kobj:		kobject struct
+ * @buf:		buffer
+ * @off:		offset
+ * @count:		buffer size
+ *
+ * Return value:
+ *	number of bytes printed to buffer
+ **/
+static ssize_t ipr_read_dump(struct kobject *kobj, char *buf,
+			      loff_t off, size_t count)
+{
+	struct class_device *cdev = container_of(kobj,struct class_device,kobj);
+	struct Scsi_Host *shost = class_to_shost(cdev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	struct ipr_dump *dump;
+	unsigned long lock_flags = 0;
+	char *src;
+	int len;
+	size_t rc = count;
+
+	if (!capable(CAP_SYS_ADMIN))
+		return -EACCES;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	dump = ioa_cfg->dump;
+
+	if (ioa_cfg->sdt_state != DUMP_OBTAINED || !dump || !kobject_get(&dump->kobj)) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return 0;
+	}
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+	if (off > dump->driver_dump.hdr.len) {
+		kobject_put(&dump->kobj);
+		return 0;
+	}
+
+	if (off + count > dump->driver_dump.hdr.len) {
+		count = dump->driver_dump.hdr.len - off;
+		rc = count;
+	}
+
+	if (count && off < sizeof(dump->driver_dump)) {
+		if (off + count > sizeof(dump->driver_dump))
+			len = sizeof(dump->driver_dump) - off;
+		else
+			len = count;
+		src = (u8 *)&dump->driver_dump + off;
+		memcpy(buf, src, len);
+		buf += len;
+		off += len;
+		count -= len;
+	}
+
+	off -= sizeof(dump->driver_dump);
+
+	if (count && off < offsetof(struct ipr_ioa_dump, ioa_data)) {
+		if (off + count > offsetof(struct ipr_ioa_dump, ioa_data))
+			len = offsetof(struct ipr_ioa_dump, ioa_data) - off;
+		else
+			len = count;
+		src = (u8 *)&dump->ioa_dump + off;
+		memcpy(buf, src, len);
+		buf += len;
+		off += len;
+		count -= len;
+	}
+
+	off -= offsetof(struct ipr_ioa_dump, ioa_data);
+
+	while (count) {
+		if ((off & PAGE_MASK) != ((off + count) & PAGE_MASK))
+			len = PAGE_ALIGN(off) - off;
+		else
+			len = count;
+		src = (u8 *)dump->ioa_dump.ioa_data[(off & PAGE_MASK) >> PAGE_SHIFT];
+		src += off & ~PAGE_MASK;
+		memcpy(buf, src, len);
+		buf += len;
+		off += len;
+		count -= len;
+	}
+
+	kobject_put(&dump->kobj);
+	return rc;
+}
+
+/**
+ * ipr_release_dump - Free adapter dump memory
+ * @kobj:	kobject struct
+ *
+ * Return value:
+ *	nothing
+ **/
+static void ipr_release_dump(struct kobject *kobj)
+{
+	struct ipr_dump *dump = container_of(kobj,struct ipr_dump,kobj);
+	struct ipr_ioa_cfg *ioa_cfg = dump->ioa_cfg;
+	unsigned long lock_flags = 0;
+	int i;
+
+	ENTER;
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	ioa_cfg->dump = NULL;
+	ioa_cfg->sdt_state = INACTIVE;
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+	for (i = 0; i < dump->ioa_dump.next_page_index; i++)
+		free_page((unsigned long) dump->ioa_dump.ioa_data[i]);
+
+	kfree(dump);
+	LEAVE;
+}
+
+static struct kobj_type ipr_dump_kobj_type = {
+	.release = ipr_release_dump,
+};
+
+/**
+ * ipr_alloc_dump - Prepare for adapter dump
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ *	0 on success / other on failure
+ **/
+static int ipr_alloc_dump(struct ipr_ioa_cfg *ioa_cfg)
+{
+	struct ipr_dump *dump;
+	unsigned long lock_flags = 0;
+
+	ENTER;
+	dump = kmalloc(sizeof(struct ipr_dump), GFP_KERNEL);
+
+	if (!dump) {
+		ipr_err("Dump memory allocation failed\n");
+		return -ENOMEM;
+	}
+
+	memset(dump, 0, sizeof(struct ipr_dump));
+	kobject_init(&dump->kobj);
+	dump->kobj.ktype = &ipr_dump_kobj_type;
+	dump->ioa_cfg = ioa_cfg;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	if (INACTIVE != ioa_cfg->sdt_state) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		kfree(dump);
+		return 0;
+	}
+
+	ioa_cfg->dump = dump;
+	ioa_cfg->sdt_state = WAIT_FOR_DUMP;
+	if (ioa_cfg->ioa_is_dead && !ioa_cfg->dump_taken) {
+		ioa_cfg->dump_taken = 1;
+		schedule_work(&ioa_cfg->work_q);
+	}
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+	LEAVE;
+	return 0;
+}
+
+/**
+ * ipr_free_dump - Free adapter dump memory
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ *	0 on success / other on failure
+ **/
+static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg)
+{
+	struct ipr_dump *dump;
+	unsigned long lock_flags = 0;
+
+	ENTER;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	dump = ioa_cfg->dump;
+	if (!dump) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return 0;
+	}
+
+	ioa_cfg->dump = NULL;
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+	kobject_put(&dump->kobj);
+
+	LEAVE;
+	return 0;
+}
+
+/**
+ * ipr_write_dump - Setup dump state of adapter
+ * @kobj:		kobject struct
+ * @buf:		buffer
+ * @off:		offset
+ * @count:		buffer size
+ *
+ * Return value:
+ *	number of bytes printed to buffer
+ **/
+static ssize_t ipr_write_dump(struct kobject *kobj, char *buf,
+			      loff_t off, size_t count)
+{
+	struct class_device *cdev = container_of(kobj,struct class_device,kobj);
+	struct Scsi_Host *shost = class_to_shost(cdev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
+	int rc;
+
+	if (!capable(CAP_SYS_ADMIN))
+		return -EACCES;
+
+	if (buf[0] == '1')
+		rc = ipr_alloc_dump(ioa_cfg);
+	else if (buf[0] == '0')
+		rc = ipr_free_dump(ioa_cfg);
+	else
+		return -EINVAL;
+
+	if (rc)
+		return rc;
+	else
+		return count;
+}
+
+static struct bin_attribute ipr_dump_attr = {
+	.attr =	{
+		.name = "dump",
+		.mode = S_IRUSR | S_IWUSR,
+	},
+	.size = 0,
+	.read = ipr_read_dump,
+	.write = ipr_write_dump
+};
+#else
+static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) { return 0; };
+#endif
+
+/**
+ * ipr_store_queue_depth - Change the device's queue depth
+ * @dev:	device struct
+ * @buf:	buffer
+ *
+ * Return value:
+ * 	number of bytes printed to buffer
+ **/
+static ssize_t ipr_store_queue_depth(struct device *dev,
+				    const char *buf, size_t count)
+{
+	struct scsi_device *sdev = to_scsi_device(dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
+	struct ipr_resource_entry *res;
+	int qdepth = simple_strtoul(buf, NULL, 10);
+	int tagged = 0;
+	unsigned long lock_flags = 0;
+	ssize_t len = -ENXIO;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	res = (struct ipr_resource_entry *)sdev->hostdata;
+	if (res) {
+		res->qdepth = qdepth;
+
+		if (ipr_is_gscsi(res) && res->tcq_active)
+			tagged = MSG_ORDERED_TAG;
+
+		len = strlen(buf);
+	}
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	scsi_adjust_queue_depth(sdev, tagged, qdepth);
+	return len;
+}
+
+static struct device_attribute ipr_queue_depth_attr = {
+	.attr = {
+		.name = 	"queue_depth",
+		.mode =		S_IRUSR | S_IWUSR,
+	},
+	.store = ipr_store_queue_depth
+};
+
+/**
+ * ipr_show_tcq_enable - Show if the device is enabled for tcqing
+ * @dev:	device struct
+ * @buf:	buffer
+ *
+ * Return value:
+ * 	number of bytes printed to buffer
+ **/
+static ssize_t ipr_show_tcq_enable(struct device *dev, char *buf)
+{
+	struct scsi_device *sdev = to_scsi_device(dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
+	struct ipr_resource_entry *res;
+	unsigned long lock_flags = 0;
+	ssize_t len = -ENXIO;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	res = (struct ipr_resource_entry *)sdev->hostdata;
+	if (res)
+		len = snprintf(buf, PAGE_SIZE, "%d\n", res->tcq_active);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	return len;
+}
+
+/**
+ * ipr_store_tcq_enable - Change the device's TCQing state
+ * @dev:	device struct
+ * @buf:	buffer
+ *
+ * Return value:
+ * 	number of bytes printed to buffer
+ **/
+static ssize_t ipr_store_tcq_enable(struct device *dev,
+				    const char *buf, size_t count)
+{
+	struct scsi_device *sdev = to_scsi_device(dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
+	struct ipr_resource_entry *res;
+	unsigned long lock_flags = 0;
+	int tcq_active = simple_strtoul(buf, NULL, 10);
+	int qdepth = IPR_MAX_CMD_PER_LUN;
+	int tagged = 0;
+	ssize_t len = -ENXIO;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	res = (struct ipr_resource_entry *)sdev->hostdata;
+
+	if (res) {
+		res->tcq_active = 0;
+		qdepth = res->qdepth;
+
+		if (ipr_is_gscsi(res) && sdev->tagged_supported) {
+			if (tcq_active) {
+				tagged = MSG_ORDERED_TAG;
+				res->tcq_active = 1;
+			}
+
+			len = strlen(buf);
+		} else if (tcq_active) {
+			len = -EINVAL;
+		}
+	}
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	scsi_adjust_queue_depth(sdev, tagged, qdepth);
+	return len;
+}
+
+static struct device_attribute ipr_tcqing_attr = {
+	.attr = {
+		.name = 	"tcq_enable",
+		.mode =		S_IRUSR | S_IWUSR,
+	},
+	.store = ipr_store_tcq_enable,
+	.show = ipr_show_tcq_enable
+};
+
+/**
+ * ipr_show_adapter_handle - Show the adapter's resource handle for this device
+ * @dev:	device struct
+ * @buf:	buffer
+ *
+ * Return value:
+ * 	number of bytes printed to buffer
+ **/
+static ssize_t ipr_show_adapter_handle(struct device *dev, char *buf)
+{
+	struct scsi_device *sdev = to_scsi_device(dev);
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
+	struct ipr_resource_entry *res;
+	unsigned long lock_flags = 0;
+	ssize_t len = -ENXIO;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	res = (struct ipr_resource_entry *)sdev->hostdata;
+	if (res)
+		len = snprintf(buf, PAGE_SIZE, "%08X\n", res->cfgte.res_handle);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	return len;
+}
+
+static struct device_attribute ipr_adapter_handle_attr = {
+	.attr = {
+		.name = 	"adapter_handle",
+		.mode =		S_IRUSR,
+	},
+	.show = ipr_show_adapter_handle
+};
+
+static struct device_attribute *ipr_dev_attrs[] = {
+	&ipr_queue_depth_attr,
+	&ipr_tcqing_attr,
+	&ipr_adapter_handle_attr,
+	NULL,
+};
+
+/**
+ * ipr_biosparam - Return the HSC mapping
+ * @sdev:			scsi device struct
+ * @block_device:	block device pointer
+ * @capacity:		capacity of the device
+ * @parm:			Array containing returned HSC values.
+ *
+ * This function generates the HSC parms that fdisk uses.
+ * We want to make sure we return something that places partitions
+ * on 4k boundaries for best performance with the IOA.
+ *
+ * Return value:
+ * 	0 on success
+ **/
+static int ipr_biosparam(struct scsi_device *sdev,
+			 struct block_device *block_device,
+			 sector_t capacity, int *parm)
+{
+	int heads, sectors, cylinders;
+
+	heads = 128;
+	sectors = 32;
+
+	cylinders = capacity;
+	sector_div(cylinders, (128 * 32));
+
+	/* return result */
+	parm[0] = heads;
+	parm[1] = sectors;
+	parm[2] = cylinders;
+
+	return 0;
+}
+
+/**
+ * ipr_slave_destroy - Unconfigure a SCSI device
+ * @sdev:	scsi device struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_slave_destroy(struct scsi_device *sdev)
+{
+	struct ipr_resource_entry *res;
+	struct ipr_ioa_cfg *ioa_cfg;
+	unsigned long lock_flags = 0;
+
+	ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	res = (struct ipr_resource_entry *) sdev->hostdata;
+	if (res) {
+		sdev->hostdata = NULL;
+		res->sdev = NULL;
+	}
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+}
+
+/**
+ * ipr_slave_configure - Configure a SCSI device
+ * @sdev:	scsi device struct
+ *
+ * This function configures the specified scsi device.
+ *
+ * Return value:
+ * 	0 on success
+ **/
+static int ipr_slave_configure(struct scsi_device *sdev)
+{
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata;
+	struct ipr_resource_entry *res;
+	unsigned long lock_flags = 0;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	res = sdev->hostdata;
+	if (res) {
+		if (ipr_is_af_dasd_device(res))
+			sdev->type = TYPE_RAID;
+		if (ipr_is_af_dasd_device(res) || ipr_is_ioa_resource(res))
+			sdev->scsi_level = 4;
+		if (ipr_is_vset_device(res))
+			sdev->timeout = IPR_VSET_RW_TIMEOUT;
+
+		sdev->allow_restart = 1;
+		scsi_adjust_queue_depth(sdev, 0, res->qdepth);
+	}
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	return 0;
+}
+
+/**
+ * ipr_slave_alloc - Prepare for commands to a device.
+ * @sdev:	scsi device struct
+ *
+ * This function saves a pointer to the resource entry
+ * in the scsi device struct if the device exists. We
+ * can then use this pointer in ipr_queuecommand when
+ * handling new commands.
+ *
+ * Return value:
+ * 	0 on success
+ **/
+static int ipr_slave_alloc(struct scsi_device *sdev)
+{
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata;
+	struct ipr_resource_entry *res;
+	unsigned long lock_flags;
+
+	sdev->hostdata = NULL;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
+		if ((res->cfgte.res_addr.bus == sdev->channel) &&
+		    (res->cfgte.res_addr.target == sdev->id) &&
+		    (res->cfgte.res_addr.lun == sdev->lun)) {
+			res->sdev = sdev;
+			res->add_to_ml = 0;
+			sdev->hostdata = res;
+			res->needs_sync_complete = 1;
+			break;
+		}
+	}
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+
+	return 0;
+}
+
+/**
+ * ipr_eh_host_reset - Reset the host adapter
+ * @scsi_cmd:	scsi command struct
+ *
+ * Return value:
+ * 	SUCCESS / FAILED
+ **/
+static int ipr_eh_host_reset(struct scsi_cmnd * scsi_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg;
+	int rc;
+
+	ENTER;
+	ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata;
+
+	dev_err(&ioa_cfg->pdev->dev,
+		"Adapter being reset as a result of error recovery.\n");
+
+	if (WAIT_FOR_DUMP == ioa_cfg->sdt_state)
+		ioa_cfg->sdt_state = GET_DUMP;
+
+	rc = ipr_reset_reload(ioa_cfg, IPR_SHUTDOWN_ABBREV);
+
+	LEAVE;
+	return rc;
+}
+
+/**
+ * ipr_eh_dev_reset - Reset the device
+ * @scsi_cmd:	scsi command struct
+ *
+ * This function issues a device reset to the affected device.
+ * A LUN reset will be sent to the device first. If that does
+ * not work, a target reset will be sent.
+ *
+ * Return value:
+ *	SUCCESS / FAILED
+ **/
+static int ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd)
+{
+	struct ipr_cmnd *ipr_cmd;
+	struct ipr_ioa_cfg *ioa_cfg;
+	struct ipr_resource_entry *res;
+	struct ipr_cmd_pkt *cmd_pkt;
+	u32 ioasc;
+
+	ENTER;
+	ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata;
+	res = scsi_cmd->device->hostdata;
+
+	if (!res || (!ipr_is_gscsi(res) && !ipr_is_vset_device(res)))
+		return FAILED;
+
+	/*
+	 * If we are currently going through reset/reload, return failed. This will force the
+	 * mid-layer to call ipr_eh_host_reset, which will then go to sleep and wait for the
+	 * reset to complete
+	 */
+	if (ioa_cfg->in_reset_reload)
+		return FAILED;
+	if (ioa_cfg->ioa_is_dead)
+		return FAILED;
+
+	list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) {
+		if (ipr_cmd->ioarcb.res_handle == res->cfgte.res_handle) {
+			if (ipr_cmd->scsi_cmd)
+				ipr_cmd->done = ipr_scsi_eh_done;
+		}
+	}
+
+	res->resetting_device = 1;
+
+	ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
+
+	ipr_cmd->ioarcb.res_handle = res->cfgte.res_handle;
+	cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt;
+	cmd_pkt->request_type = IPR_RQTYPE_IOACMD;
+	cmd_pkt->cdb[0] = IPR_RESET_DEVICE;
+
+	ipr_sdev_err(scsi_cmd->device, "Resetting device\n");
+	ipr_send_blocking_cmd(ipr_cmd, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT);
+
+	ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+	res->resetting_device = 0;
+
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+
+	LEAVE;
+	return (IPR_IOASC_SENSE_KEY(ioasc) ? FAILED : SUCCESS);
+}
+
+/**
+ * ipr_bus_reset_done - Op done function for bus reset.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function is the op done function for a bus reset
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_bus_reset_done(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_resource_entry *res;
+
+	ENTER;
+	list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
+		if (!memcmp(&res->cfgte.res_handle, &ipr_cmd->ioarcb.res_handle,
+			    sizeof(res->cfgte.res_handle))) {
+			scsi_report_bus_reset(ioa_cfg->host, res->cfgte.res_addr.bus);
+			break;
+		}
+	}
+
+	/*
+	 * If abort has not completed, indicate the reset has, else call the
+	 * abort's done function to wake the sleeping eh thread
+	 */
+	if (ipr_cmd->u.sibling->u.sibling)
+		ipr_cmd->u.sibling->u.sibling = NULL;
+	else
+		ipr_cmd->u.sibling->done(ipr_cmd->u.sibling);
+
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+	LEAVE;
+}
+
+/**
+ * ipr_abort_timeout - An abort task has timed out
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function handles when an abort task times out. If this
+ * happens we issue a bus reset since we have resources tied
+ * up that must be freed before returning to the midlayer.
+ *
+ * Return value:
+ *	none
+ **/
+static void ipr_abort_timeout(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_cmnd *reset_cmd;
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_cmd_pkt *cmd_pkt;
+	unsigned long lock_flags = 0;
+
+	ENTER;
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	if (ipr_cmd->completion.done || ioa_cfg->in_reset_reload) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return;
+	}
+
+	ipr_sdev_err(ipr_cmd->u.sdev, "Abort timed out. Resetting bus\n");
+	reset_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
+	ipr_cmd->u.sibling = reset_cmd;
+	reset_cmd->u.sibling = ipr_cmd;
+	reset_cmd->ioarcb.res_handle = ipr_cmd->ioarcb.res_handle;
+	cmd_pkt = &reset_cmd->ioarcb.cmd_pkt;
+	cmd_pkt->request_type = IPR_RQTYPE_IOACMD;
+	cmd_pkt->cdb[0] = IPR_RESET_DEVICE;
+	cmd_pkt->cdb[2] = IPR_RESET_TYPE_SELECT | IPR_BUS_RESET;
+
+	ipr_do_req(reset_cmd, ipr_bus_reset_done, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	LEAVE;
+}
+
+/**
+ * ipr_cancel_op - Cancel specified op
+ * @scsi_cmd:	scsi command struct
+ *
+ * This function cancels specified op.
+ *
+ * Return value:
+ *	SUCCESS / FAILED
+ **/
+static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd)
+{
+	struct ipr_cmnd *ipr_cmd;
+	struct ipr_ioa_cfg *ioa_cfg;
+	struct ipr_resource_entry *res;
+	struct ipr_cmd_pkt *cmd_pkt;
+	u32 ioasc, ioarcb_addr;
+	int op_found = 0;
+
+	ENTER;
+	ioa_cfg = (struct ipr_ioa_cfg *)scsi_cmd->device->host->hostdata;
+	res = scsi_cmd->device->hostdata;
+
+	if (!res || (!ipr_is_gscsi(res) && !ipr_is_vset_device(res)))
+		return FAILED;
+
+	list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) {
+		if (ipr_cmd->scsi_cmd == scsi_cmd) {
+			ipr_cmd->done = ipr_scsi_eh_done;
+			op_found = 1;
+			break;
+		}
+	}
+
+	if (!op_found)
+		return SUCCESS;
+
+	ioarcb_addr = be32_to_cpu(ipr_cmd->ioarcb.ioarcb_host_pci_addr);
+
+	ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
+	ipr_cmd->ioarcb.res_handle = res->cfgte.res_handle;
+	cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt;
+	cmd_pkt->request_type = IPR_RQTYPE_IOACMD;
+	cmd_pkt->cdb[0] = IPR_ABORT_TASK;
+	cmd_pkt->cdb[2] = (ioarcb_addr >> 24) & 0xff;
+	cmd_pkt->cdb[3] = (ioarcb_addr >> 16) & 0xff;
+	cmd_pkt->cdb[4] = (ioarcb_addr >> 8) & 0xff;
+	cmd_pkt->cdb[5] = ioarcb_addr & 0xff;
+	ipr_cmd->u.sdev = scsi_cmd->device;
+
+	ipr_sdev_err(scsi_cmd->device, "Aborting command: %02X\n", scsi_cmd->cmnd[0]);
+	ipr_send_blocking_cmd(ipr_cmd, ipr_abort_timeout, IPR_ABORT_TASK_TIMEOUT);
+	ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+	/*
+	 * If the abort task timed out and we sent a bus reset, we will get
+	 * one the following responses to the abort
+	 */
+	if (ioasc == IPR_IOASC_BUS_WAS_RESET || ioasc == IPR_IOASC_SYNC_REQUIRED) {
+		ioasc = 0;
+		ipr_trace;
+	}
+
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+	res->needs_sync_complete = 1;
+
+	LEAVE;
+	return (IPR_IOASC_SENSE_KEY(ioasc) ? FAILED : SUCCESS);
+}
+
+/**
+ * ipr_eh_abort - Abort a single op
+ * @scsi_cmd:	scsi command struct
+ *
+ * Return value:
+ * 	SUCCESS / FAILED
+ **/
+static int ipr_eh_abort(struct scsi_cmnd * scsi_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg;
+
+	ENTER;
+	ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata;
+
+	/* If we are currently going through reset/reload, return failed. This will force the
+	   mid-layer to call ipr_eh_host_reset, which will then go to sleep and wait for the
+	   reset to complete */
+	if (ioa_cfg->in_reset_reload)
+		return FAILED;
+	if (ioa_cfg->ioa_is_dead)
+		return FAILED;
+	if (!scsi_cmd->device->hostdata)
+		return FAILED;
+
+	LEAVE;
+	return ipr_cancel_op(scsi_cmd);
+}
+
+/**
+ * ipr_handle_other_interrupt - Handle "other" interrupts
+ * @ioa_cfg:	ioa config struct
+ * @int_reg:	interrupt register
+ *
+ * Return value:
+ * 	IRQ_NONE / IRQ_HANDLED
+ **/
+static irqreturn_t ipr_handle_other_interrupt(struct ipr_ioa_cfg *ioa_cfg,
+					      volatile u32 int_reg)
+{
+	irqreturn_t rc = IRQ_HANDLED;
+
+	if (int_reg & IPR_PCII_IOA_TRANS_TO_OPER) {
+		/* Mask the interrupt */
+		writel(IPR_PCII_IOA_TRANS_TO_OPER, ioa_cfg->regs.set_interrupt_mask_reg);
+
+		/* Clear the interrupt */
+		writel(IPR_PCII_IOA_TRANS_TO_OPER, ioa_cfg->regs.clr_interrupt_reg);
+		int_reg = readl(ioa_cfg->regs.sense_interrupt_reg);
+
+		list_del(&ioa_cfg->reset_cmd->queue);
+		del_timer(&ioa_cfg->reset_cmd->timer);
+		ipr_reset_ioa_job(ioa_cfg->reset_cmd);
+	} else {
+		if (int_reg & IPR_PCII_IOA_UNIT_CHECKED)
+			ioa_cfg->ioa_unit_checked = 1;
+		else
+			dev_err(&ioa_cfg->pdev->dev,
+				"Permanent IOA failure. 0x%08X\n", int_reg);
+
+		if (WAIT_FOR_DUMP == ioa_cfg->sdt_state)
+			ioa_cfg->sdt_state = GET_DUMP;
+
+		ipr_mask_and_clear_interrupts(ioa_cfg, ~0);
+		ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
+	}
+
+	return rc;
+}
+
+/**
+ * ipr_isr - Interrupt service routine
+ * @irq:	irq number
+ * @devp:	pointer to ioa config struct
+ * @regs:	pt_regs struct
+ *
+ * Return value:
+ * 	IRQ_NONE / IRQ_HANDLED
+ **/
+static irqreturn_t ipr_isr(int irq, void *devp, struct pt_regs *regs)
+{
+	struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)devp;
+	unsigned long lock_flags = 0;
+	volatile u32 int_reg, int_mask_reg;
+	u32 ioasc;
+	u16 cmd_index;
+	struct ipr_cmnd *ipr_cmd;
+	irqreturn_t rc = IRQ_NONE;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	/* If interrupts are disabled, ignore the interrupt */
+	if (!ioa_cfg->allow_interrupts) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return IRQ_NONE;
+	}
+
+	int_mask_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
+	int_reg = readl(ioa_cfg->regs.sense_interrupt_reg) & ~int_mask_reg;
+
+	/* If an interrupt on the adapter did not occur, ignore it */
+	if (unlikely((int_reg & IPR_PCII_OPER_INTERRUPTS) == 0)) {
+		spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+		return IRQ_NONE;
+	}
+
+	while (1) {
+		ipr_cmd = NULL;
+
+		while ((be32_to_cpu(*ioa_cfg->hrrq_curr) & IPR_HRRQ_TOGGLE_BIT) ==
+		       ioa_cfg->toggle_bit) {
+
+			cmd_index = (be32_to_cpu(*ioa_cfg->hrrq_curr) &
+				     IPR_HRRQ_REQ_RESP_HANDLE_MASK) >> IPR_HRRQ_REQ_RESP_HANDLE_SHIFT;
+
+			if (unlikely(cmd_index >= IPR_NUM_CMD_BLKS)) {
+				ioa_cfg->errors_logged++;
+				dev_err(&ioa_cfg->pdev->dev, "Invalid response handle from IOA\n");
+
+				if (WAIT_FOR_DUMP == ioa_cfg->sdt_state)
+					ioa_cfg->sdt_state = GET_DUMP;
+
+				ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
+				spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+				return IRQ_HANDLED;
+			}
+
+			ipr_cmd = ioa_cfg->ipr_cmnd_list[cmd_index];
+
+			ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+			ipr_trc_hook(ipr_cmd, IPR_TRACE_FINISH, ioasc);
+
+			list_del(&ipr_cmd->queue);
+			del_timer(&ipr_cmd->timer);
+			ipr_cmd->done(ipr_cmd);
+
+			rc = IRQ_HANDLED;
+
+			if (ioa_cfg->hrrq_curr < ioa_cfg->hrrq_end) {
+				ioa_cfg->hrrq_curr++;
+			} else {
+				ioa_cfg->hrrq_curr = ioa_cfg->hrrq_start;
+				ioa_cfg->toggle_bit ^= 1u;
+			}
+		}
+
+		if (ipr_cmd != NULL) {
+			/* Clear the PCI interrupt */
+			writel(IPR_PCII_HRRQ_UPDATED, ioa_cfg->regs.clr_interrupt_reg);
+			int_reg = readl(ioa_cfg->regs.sense_interrupt_reg) & ~int_mask_reg;
+		} else
+			break;
+	}
+
+	if (unlikely(rc == IRQ_NONE))
+		rc = ipr_handle_other_interrupt(ioa_cfg, int_reg);
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	return rc;
+}
+
+/**
+ * ipr_build_ioadl - Build a scatter/gather list and map the buffer
+ * @ioa_cfg:	ioa config struct
+ * @ipr_cmd:	ipr command struct
+ *
+ * Return value:
+ * 	0 on success / -1 on failure
+ **/
+static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
+			   struct ipr_cmnd *ipr_cmd)
+{
+	int i;
+	struct scatterlist *sglist;
+	u32 length;
+	u32 ioadl_flags = 0;
+	struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+	struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
+
+	length = scsi_cmd->request_bufflen;
+
+	if (length == 0)
+		return 0;
+
+	if (scsi_cmd->use_sg) {
+		ipr_cmd->dma_use_sg = pci_map_sg(ioa_cfg->pdev,
+						 scsi_cmd->request_buffer,
+						 scsi_cmd->use_sg,
+						 scsi_cmd->sc_data_direction);
+
+		if (scsi_cmd->sc_data_direction == DMA_TO_DEVICE) {
+			ioadl_flags = IPR_IOADL_FLAGS_WRITE;
+			ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_WRITE_NOT_READ;
+			ioarcb->write_data_transfer_length = cpu_to_be32(length);
+			ioarcb->write_ioadl_len =
+				cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg);
+		} else if (scsi_cmd->sc_data_direction == DMA_FROM_DEVICE) {
+			ioadl_flags = IPR_IOADL_FLAGS_READ;
+			ioarcb->read_data_transfer_length = cpu_to_be32(length);
+			ioarcb->read_ioadl_len =
+				cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg);
+		}
+
+		sglist = scsi_cmd->request_buffer;
+
+		for (i = 0; i < ipr_cmd->dma_use_sg; i++) {
+			ioadl[i].flags_and_data_len =
+				cpu_to_be32(ioadl_flags | sg_dma_len(&sglist[i]));
+			ioadl[i].address =
+				cpu_to_be32(sg_dma_address(&sglist[i]));
+		}
+
+		if (likely(ipr_cmd->dma_use_sg)) {
+			ioadl[i-1].flags_and_data_len |=
+				cpu_to_be32(IPR_IOADL_FLAGS_LAST);
+			return 0;
+		} else
+			dev_err(&ioa_cfg->pdev->dev, "pci_map_sg failed!\n");
+	} else {
+		if (scsi_cmd->sc_data_direction == DMA_TO_DEVICE) {
+			ioadl_flags = IPR_IOADL_FLAGS_WRITE;
+			ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_WRITE_NOT_READ;
+			ioarcb->write_data_transfer_length = cpu_to_be32(length);
+			ioarcb->write_ioadl_len = cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+		} else if (scsi_cmd->sc_data_direction == DMA_FROM_DEVICE) {
+			ioadl_flags = IPR_IOADL_FLAGS_READ;
+			ioarcb->read_data_transfer_length = cpu_to_be32(length);
+			ioarcb->read_ioadl_len = cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+		}
+
+		ipr_cmd->dma_handle = pci_map_single(ioa_cfg->pdev,
+						     scsi_cmd->request_buffer, length,
+						     scsi_cmd->sc_data_direction);
+
+		if (likely(!pci_dma_mapping_error(ipr_cmd->dma_handle))) {
+			ipr_cmd->dma_use_sg = 1;
+			ioadl[0].flags_and_data_len =
+				cpu_to_be32(ioadl_flags | length | IPR_IOADL_FLAGS_LAST);
+			ioadl[0].address = cpu_to_be32(ipr_cmd->dma_handle);
+			return 0;
+		} else
+			dev_err(&ioa_cfg->pdev->dev, "pci_map_single failed!\n");
+	}
+
+	return -1;
+}
+
+/**
+ * ipr_get_task_attributes - Translate SPI Q-Tag to task attributes
+ * @scsi_cmd:	scsi command struct
+ *
+ * Return value:
+ * 	task attributes
+ **/
+static u8 ipr_get_task_attributes(struct scsi_cmnd *scsi_cmd)
+{
+	u8 tag[2];
+	u8 rc = IPR_FLAGS_LO_UNTAGGED_TASK;
+
+	if (scsi_populate_tag_msg(scsi_cmd, tag)) {
+		switch (tag[0]) {
+		case MSG_SIMPLE_TAG:
+			rc = IPR_FLAGS_LO_SIMPLE_TASK;
+			break;
+		case MSG_HEAD_TAG:
+			rc = IPR_FLAGS_LO_HEAD_OF_Q_TASK;
+			break;
+		case MSG_ORDERED_TAG:
+			rc = IPR_FLAGS_LO_ORDERED_TASK;
+			break;
+		};
+	}
+
+	return rc;
+}
+
+/**
+ * ipr_erp_done - Process completion of ERP for a device
+ * @ipr_cmd:		ipr command struct
+ *
+ * This function copies the sense buffer into the scsi_cmd
+ * struct and pushes the scsi_done function.
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_erp_done(struct ipr_cmnd *ipr_cmd)
+{
+	struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
+	struct ipr_resource_entry *res = scsi_cmd->device->hostdata;
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+	if (IPR_IOASC_SENSE_KEY(ioasc) > 0) {
+		scsi_cmd->result |= (DID_ERROR << 16);
+		ipr_sdev_err(scsi_cmd->device,
+			     "Request Sense failed with IOASC: 0x%08X\n", ioasc);
+	} else {
+		memcpy(scsi_cmd->sense_buffer, ipr_cmd->sense_buffer,
+		       SCSI_SENSE_BUFFERSIZE);
+	}
+
+	if (res)
+		res->needs_sync_complete = 1;
+	ipr_unmap_sglist(ioa_cfg, ipr_cmd);
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+	scsi_cmd->scsi_done(scsi_cmd);
+}
+
+/**
+ * ipr_reinit_ipr_cmnd_for_erp - Re-initialize a cmnd block to be used for ERP
+ * @ipr_cmd:	ipr command struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioarcb *ioarcb;
+	struct ipr_ioasa *ioasa;
+
+	ioarcb = &ipr_cmd->ioarcb;
+	ioasa = &ipr_cmd->ioasa;
+
+	memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt));
+	ioarcb->write_data_transfer_length = 0;
+	ioarcb->read_data_transfer_length = 0;
+	ioarcb->write_ioadl_len = 0;
+	ioarcb->read_ioadl_len = 0;
+	ioasa->ioasc = 0;
+	ioasa->residual_data_len = 0;
+}
+
+/**
+ * ipr_erp_request_sense - Send request sense to a device
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function sends a request sense to a device as a result
+ * of a check condition.
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_erp_request_sense(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_cmd_pkt *cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt;
+
+	ipr_reinit_ipr_cmnd_for_erp(ipr_cmd);
+
+	cmd_pkt->request_type = IPR_RQTYPE_SCSICDB;
+	cmd_pkt->cdb[0] = REQUEST_SENSE;
+	cmd_pkt->cdb[4] = SCSI_SENSE_BUFFERSIZE;
+	cmd_pkt->flags_hi |= IPR_FLAGS_HI_SYNC_OVERRIDE;
+	cmd_pkt->flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK;
+	cmd_pkt->timeout = cpu_to_be16(IPR_REQUEST_SENSE_TIMEOUT / HZ);
+
+	ipr_cmd->ioadl[0].flags_and_data_len =
+		cpu_to_be32(IPR_IOADL_FLAGS_READ_LAST | SCSI_SENSE_BUFFERSIZE);
+	ipr_cmd->ioadl[0].address =
+		cpu_to_be32(ipr_cmd->sense_buffer_dma);
+
+	ipr_cmd->ioarcb.read_ioadl_len =
+		cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+	ipr_cmd->ioarcb.read_data_transfer_length =
+		cpu_to_be32(SCSI_SENSE_BUFFERSIZE);
+
+	ipr_do_req(ipr_cmd, ipr_erp_done, ipr_timeout,
+		   IPR_REQUEST_SENSE_TIMEOUT * 2);
+}
+
+/**
+ * ipr_erp_cancel_all - Send cancel all to a device
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function sends a cancel all to a device to clear the
+ * queue. If we are running TCQ on the device, QERR is set to 1,
+ * which means all outstanding ops have been dropped on the floor.
+ * Cancel all will return them to us.
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_erp_cancel_all(struct ipr_cmnd *ipr_cmd)
+{
+	struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
+	struct ipr_resource_entry *res = scsi_cmd->device->hostdata;
+	struct ipr_cmd_pkt *cmd_pkt;
+
+	res->in_erp = 1;
+
+	ipr_reinit_ipr_cmnd_for_erp(ipr_cmd);
+
+	cmd_pkt = &ipr_cmd->ioarcb.cmd_pkt;
+	cmd_pkt->request_type = IPR_RQTYPE_IOACMD;
+	cmd_pkt->cdb[0] = IPR_CANCEL_ALL_REQUESTS;
+
+	ipr_do_req(ipr_cmd, ipr_erp_request_sense, ipr_timeout,
+		   IPR_CANCEL_ALL_TIMEOUT);
+}
+
+/**
+ * ipr_dump_ioasa - Dump contents of IOASA
+ * @ioa_cfg:	ioa config struct
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function is invoked by the interrupt handler when ops
+ * fail. It will log the IOASA if appropriate. Only called
+ * for GPDD ops.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_dump_ioasa(struct ipr_ioa_cfg *ioa_cfg,
+			   struct ipr_cmnd *ipr_cmd)
+{
+	int i;
+	u16 data_len;
+	u32 ioasc;
+	struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
+	u32 *ioasa_data = (u32 *)ioasa;
+	int error_index;
+
+	ioasc = be32_to_cpu(ioasa->ioasc) & IPR_IOASC_IOASC_MASK;
+
+	if (0 == ioasc)
+		return;
+
+	if (ioa_cfg->log_level < IPR_DEFAULT_LOG_LEVEL)
+		return;
+
+	error_index = ipr_get_error(ioasc);
+
+	if (ioa_cfg->log_level < IPR_MAX_LOG_LEVEL) {
+		/* Don't log an error if the IOA already logged one */
+		if (ioasa->ilid != 0)
+			return;
+
+		if (ipr_error_table[error_index].log_ioasa == 0)
+			return;
+	}
+
+	ipr_sdev_err(ipr_cmd->scsi_cmd->device, "%s\n",
+		     ipr_error_table[error_index].error);
+
+	if ((ioasa->u.gpdd.end_state <= ARRAY_SIZE(ipr_gpdd_dev_end_states)) &&
+	    (ioasa->u.gpdd.bus_phase <=  ARRAY_SIZE(ipr_gpdd_dev_bus_phases))) {
+		ipr_sdev_err(ipr_cmd->scsi_cmd->device,
+			     "Device End state: %s Phase: %s\n",
+			     ipr_gpdd_dev_end_states[ioasa->u.gpdd.end_state],
+			     ipr_gpdd_dev_bus_phases[ioasa->u.gpdd.bus_phase]);
+	}
+
+	if (sizeof(struct ipr_ioasa) < be16_to_cpu(ioasa->ret_stat_len))
+		data_len = sizeof(struct ipr_ioasa);
+	else
+		data_len = be16_to_cpu(ioasa->ret_stat_len);
+
+	ipr_err("IOASA Dump:\n");
+
+	for (i = 0; i < data_len / 4; i += 4) {
+		ipr_err("%08X: %08X %08X %08X %08X\n", i*4,
+			be32_to_cpu(ioasa_data[i]),
+			be32_to_cpu(ioasa_data[i+1]),
+			be32_to_cpu(ioasa_data[i+2]),
+			be32_to_cpu(ioasa_data[i+3]));
+	}
+}
+
+/**
+ * ipr_gen_sense - Generate SCSI sense data from an IOASA
+ * @ioasa:		IOASA
+ * @sense_buf:	sense data buffer
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_gen_sense(struct ipr_cmnd *ipr_cmd)
+{
+	u32 failing_lba;
+	u8 *sense_buf = ipr_cmd->scsi_cmd->sense_buffer;
+	struct ipr_resource_entry *res = ipr_cmd->scsi_cmd->device->hostdata;
+	struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
+	u32 ioasc = be32_to_cpu(ioasa->ioasc);
+
+	memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
+
+	if (ioasc >= IPR_FIRST_DRIVER_IOASC)
+		return;
+
+	ipr_cmd->scsi_cmd->result = SAM_STAT_CHECK_CONDITION;
+
+	if (ipr_is_vset_device(res) &&
+	    ioasc == IPR_IOASC_MED_DO_NOT_REALLOC &&
+	    ioasa->u.vset.failing_lba_hi != 0) {
+		sense_buf[0] = 0x72;
+		sense_buf[1] = IPR_IOASC_SENSE_KEY(ioasc);
+		sense_buf[2] = IPR_IOASC_SENSE_CODE(ioasc);
+		sense_buf[3] = IPR_IOASC_SENSE_QUAL(ioasc);
+
+		sense_buf[7] = 12;
+		sense_buf[8] = 0;
+		sense_buf[9] = 0x0A;
+		sense_buf[10] = 0x80;
+
+		failing_lba = be32_to_cpu(ioasa->u.vset.failing_lba_hi);
+
+		sense_buf[12] = (failing_lba & 0xff000000) >> 24;
+		sense_buf[13] = (failing_lba & 0x00ff0000) >> 16;
+		sense_buf[14] = (failing_lba & 0x0000ff00) >> 8;
+		sense_buf[15] = failing_lba & 0x000000ff;
+
+		failing_lba = be32_to_cpu(ioasa->u.vset.failing_lba_lo);
+
+		sense_buf[16] = (failing_lba & 0xff000000) >> 24;
+		sense_buf[17] = (failing_lba & 0x00ff0000) >> 16;
+		sense_buf[18] = (failing_lba & 0x0000ff00) >> 8;
+		sense_buf[19] = failing_lba & 0x000000ff;
+	} else {
+		sense_buf[0] = 0x70;
+		sense_buf[2] = IPR_IOASC_SENSE_KEY(ioasc);
+		sense_buf[12] = IPR_IOASC_SENSE_CODE(ioasc);
+		sense_buf[13] = IPR_IOASC_SENSE_QUAL(ioasc);
+
+		/* Illegal request */
+		if ((IPR_IOASC_SENSE_KEY(ioasc) == 0x05) &&
+		    (be32_to_cpu(ioasa->ioasc_specific) & IPR_FIELD_POINTER_VALID)) {
+			sense_buf[7] = 10;	/* additional length */
+
+			/* IOARCB was in error */
+			if (IPR_IOASC_SENSE_CODE(ioasc) == 0x24)
+				sense_buf[15] = 0xC0;
+			else	/* Parameter data was invalid */
+				sense_buf[15] = 0x80;
+
+			sense_buf[16] =
+			    ((IPR_FIELD_POINTER_MASK &
+			      be32_to_cpu(ioasa->ioasc_specific)) >> 8) & 0xff;
+			sense_buf[17] =
+			    (IPR_FIELD_POINTER_MASK &
+			     be32_to_cpu(ioasa->ioasc_specific)) & 0xff;
+		} else {
+			if (ioasc == IPR_IOASC_MED_DO_NOT_REALLOC) {
+				if (ipr_is_vset_device(res))
+					failing_lba = be32_to_cpu(ioasa->u.vset.failing_lba_lo);
+				else
+					failing_lba = be32_to_cpu(ioasa->u.dasd.failing_lba);
+
+				sense_buf[0] |= 0x80;	/* Or in the Valid bit */
+				sense_buf[3] = (failing_lba & 0xff000000) >> 24;
+				sense_buf[4] = (failing_lba & 0x00ff0000) >> 16;
+				sense_buf[5] = (failing_lba & 0x0000ff00) >> 8;
+				sense_buf[6] = failing_lba & 0x000000ff;
+			}
+
+			sense_buf[7] = 6;	/* additional length */
+		}
+	}
+}
+
+/**
+ * ipr_erp_start - Process an error response for a SCSI op
+ * @ioa_cfg:	ioa config struct
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function determines whether or not to initiate ERP
+ * on the affected device.
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
+			      struct ipr_cmnd *ipr_cmd)
+{
+	struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
+	struct ipr_resource_entry *res = scsi_cmd->device->hostdata;
+	u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+	if (!res) {
+		ipr_scsi_eh_done(ipr_cmd);
+		return;
+	}
+
+	if (ipr_is_gscsi(res))
+		ipr_dump_ioasa(ioa_cfg, ipr_cmd);
+	else
+		ipr_gen_sense(ipr_cmd);
+
+	switch (ioasc & IPR_IOASC_IOASC_MASK) {
+	case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST:
+		scsi_cmd->result |= (DID_ERROR << 16);
+		break;
+	case IPR_IOASC_IR_RESOURCE_HANDLE:
+		scsi_cmd->result |= (DID_NO_CONNECT << 16);
+		break;
+	case IPR_IOASC_HW_SEL_TIMEOUT:
+		scsi_cmd->result |= (DID_NO_CONNECT << 16);
+		res->needs_sync_complete = 1;
+		break;
+	case IPR_IOASC_SYNC_REQUIRED:
+		if (!res->in_erp)
+			res->needs_sync_complete = 1;
+		scsi_cmd->result |= (DID_IMM_RETRY << 16);
+		break;
+	case IPR_IOASC_MED_DO_NOT_REALLOC: /* prevent retries */
+		scsi_cmd->result |= (DID_PASSTHROUGH << 16);
+		break;
+	case IPR_IOASC_BUS_WAS_RESET:
+	case IPR_IOASC_BUS_WAS_RESET_BY_OTHER:
+		/*
+		 * Report the bus reset and ask for a retry. The device
+		 * will give CC/UA the next command.
+		 */
+		if (!res->resetting_device)
+			scsi_report_bus_reset(ioa_cfg->host, scsi_cmd->device->channel);
+		scsi_cmd->result |= (DID_ERROR << 16);
+		res->needs_sync_complete = 1;
+		break;
+	case IPR_IOASC_HW_DEV_BUS_STATUS:
+		scsi_cmd->result |= IPR_IOASC_SENSE_STATUS(ioasc);
+		if (IPR_IOASC_SENSE_STATUS(ioasc) == SAM_STAT_CHECK_CONDITION) {
+			ipr_erp_cancel_all(ipr_cmd);
+			return;
+		}
+		break;
+	case IPR_IOASC_NR_INIT_CMD_REQUIRED:
+		break;
+	default:
+		scsi_cmd->result |= (DID_ERROR << 16);
+		if (!ipr_is_vset_device(res))
+			res->needs_sync_complete = 1;
+		break;
+	}
+
+	ipr_unmap_sglist(ioa_cfg, ipr_cmd);
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+	scsi_cmd->scsi_done(scsi_cmd);
+}
+
+/**
+ * ipr_scsi_done - mid-layer done function
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function is invoked by the interrupt handler for
+ * ops generated by the SCSI mid-layer
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
+	u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+	scsi_cmd->resid = be32_to_cpu(ipr_cmd->ioasa.residual_data_len);
+
+	if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) {
+		ipr_unmap_sglist(ioa_cfg, ipr_cmd);
+		list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+		scsi_cmd->scsi_done(scsi_cmd);
+	} else
+		ipr_erp_start(ioa_cfg, ipr_cmd);
+}
+
+/**
+ * ipr_save_ioafp_mode_select - Save adapters mode select data
+ * @ioa_cfg:	ioa config struct
+ * @scsi_cmd:	scsi command struct
+ *
+ * This function saves mode select data for the adapter to
+ * use following an adapter reset.
+ *
+ * Return value:
+ *	0 on success / SCSI_MLQUEUE_HOST_BUSY on failure
+ **/
+static int ipr_save_ioafp_mode_select(struct ipr_ioa_cfg *ioa_cfg,
+				       struct scsi_cmnd *scsi_cmd)
+{
+	if (!ioa_cfg->saved_mode_pages) {
+		ioa_cfg->saved_mode_pages  = kmalloc(sizeof(struct ipr_mode_pages),
+						     GFP_ATOMIC);
+		if (!ioa_cfg->saved_mode_pages) {
+			dev_err(&ioa_cfg->pdev->dev,
+				"IOA mode select buffer allocation failed\n");
+			return SCSI_MLQUEUE_HOST_BUSY;
+		}
+	}
+
+	memcpy(ioa_cfg->saved_mode_pages, scsi_cmd->buffer, scsi_cmd->cmnd[4]);
+	ioa_cfg->saved_mode_page_len = scsi_cmd->cmnd[4];
+	return 0;
+}
+
+/**
+ * ipr_queuecommand - Queue a mid-layer request
+ * @scsi_cmd:	scsi command struct
+ * @done:		done function
+ *
+ * This function queues a request generated by the mid-layer.
+ *
+ * Return value:
+ *	0 on success
+ *	SCSI_MLQUEUE_DEVICE_BUSY if device is busy
+ *	SCSI_MLQUEUE_HOST_BUSY if host is busy
+ **/
+static int ipr_queuecommand(struct scsi_cmnd *scsi_cmd,
+			    void (*done) (struct scsi_cmnd *))
+{
+	struct ipr_ioa_cfg *ioa_cfg;
+	struct ipr_resource_entry *res;
+	struct ipr_ioarcb *ioarcb;
+	struct ipr_cmnd *ipr_cmd;
+	int rc = 0;
+
+	scsi_cmd->scsi_done = done;
+	ioa_cfg = (struct ipr_ioa_cfg *)scsi_cmd->device->host->hostdata;
+	res = scsi_cmd->device->hostdata;
+	scsi_cmd->result = (DID_OK << 16);
+
+	/*
+	 * We are currently blocking all devices due to a host reset
+	 * We have told the host to stop giving us new requests, but
+	 * ERP ops don't count. FIXME
+	 */
+	if (unlikely(!ioa_cfg->allow_cmds))
+		return SCSI_MLQUEUE_HOST_BUSY;
+
+	/*
+	 * FIXME - Create scsi_set_host_offline interface
+	 *  and the ioa_is_dead check can be removed
+	 */
+	if (unlikely(ioa_cfg->ioa_is_dead || !res)) {
+		memset(scsi_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
+		scsi_cmd->result = (DID_NO_CONNECT << 16);
+		scsi_cmd->scsi_done(scsi_cmd);
+		return 0;
+	}
+
+	ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
+	ioarcb = &ipr_cmd->ioarcb;
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->pending_q);
+
+	memcpy(ioarcb->cmd_pkt.cdb, scsi_cmd->cmnd, scsi_cmd->cmd_len);
+	ipr_cmd->scsi_cmd = scsi_cmd;
+	ioarcb->res_handle = res->cfgte.res_handle;
+	ipr_cmd->done = ipr_scsi_done;
+	ipr_trc_hook(ipr_cmd, IPR_TRACE_START, IPR_GET_PHYS_LOC(res->cfgte.res_addr));
+
+	if (ipr_is_gscsi(res) || ipr_is_vset_device(res)) {
+		if (scsi_cmd->underflow == 0)
+			ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK;
+
+		if (res->needs_sync_complete) {
+			ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_SYNC_COMPLETE;
+			res->needs_sync_complete = 0;
+		}
+
+		ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_LINK_DESC;
+		ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_DELAY_AFTER_RST;
+		ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_ALIGNED_BFR;
+		ioarcb->cmd_pkt.flags_lo |= ipr_get_task_attributes(scsi_cmd);
+	}
+
+	if (!ipr_is_gscsi(res) && scsi_cmd->cmnd[0] >= 0xC0)
+		ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD;
+
+	if (ipr_is_ioa_resource(res) && scsi_cmd->cmnd[0] == MODE_SELECT)
+		rc = ipr_save_ioafp_mode_select(ioa_cfg, scsi_cmd);
+
+	if (likely(rc == 0))
+		rc = ipr_build_ioadl(ioa_cfg, ipr_cmd);
+
+	if (likely(rc == 0)) {
+		mb();
+		writel(be32_to_cpu(ipr_cmd->ioarcb.ioarcb_host_pci_addr),
+		       ioa_cfg->regs.ioarrin_reg);
+	} else {
+		 list_move_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+		 return SCSI_MLQUEUE_HOST_BUSY;
+	}
+
+	return 0;
+}
+
+/**
+ * ipr_info - Get information about the card/driver
+ * @scsi_host:	scsi host struct
+ *
+ * Return value:
+ * 	pointer to buffer with description string
+ **/
+static const char * ipr_ioa_info(struct Scsi_Host *host)
+{
+	static char buffer[512];
+	struct ipr_ioa_cfg *ioa_cfg;
+	unsigned long lock_flags = 0;
+
+	ioa_cfg = (struct ipr_ioa_cfg *) host->hostdata;
+
+	spin_lock_irqsave(host->host_lock, lock_flags);
+	sprintf(buffer, "IBM %X Storage Adapter", ioa_cfg->type);
+	spin_unlock_irqrestore(host->host_lock, lock_flags);
+
+	return buffer;
+}
+
+static struct scsi_host_template driver_template = {
+	.module = THIS_MODULE,
+	.name = "IPR",
+	.info = ipr_ioa_info,
+	.queuecommand = ipr_queuecommand,
+	.eh_abort_handler = ipr_eh_abort,
+	.eh_device_reset_handler = ipr_eh_dev_reset,
+	.eh_host_reset_handler = ipr_eh_host_reset,
+	.slave_alloc = ipr_slave_alloc,
+	.slave_configure = ipr_slave_configure,
+	.slave_destroy = ipr_slave_destroy,
+	.bios_param = ipr_biosparam,
+	.can_queue = IPR_MAX_COMMANDS,
+	.this_id = -1,
+	.sg_tablesize = IPR_MAX_SGLIST,
+	.max_sectors = IPR_MAX_SECTORS,
+	.cmd_per_lun = IPR_MAX_CMD_PER_LUN,
+	.use_clustering = ENABLE_CLUSTERING,
+	.shost_attrs = ipr_ioa_attrs,
+	.sdev_attrs = ipr_dev_attrs,
+	.proc_name = IPR_NAME
+};
+
+#ifdef CONFIG_PPC_PSERIES
+static const u16 ipr_blocked_processors[] = {
+	PV_NORTHSTAR,
+	PV_PULSAR,
+	PV_POWER4,
+	PV_ICESTAR,
+	PV_SSTAR,
+	PV_POWER4p,
+	PV_630,
+	PV_630p
+};
+
+/**
+ * ipr_invalid_adapter - Determine if this adapter is supported on this hardware
+ * @ioa_cfg:	ioa cfg struct
+ *
+ * Adapters that use Gemstone revision < 3.1 do not work reliably on
+ * certain pSeries hardware. This function determines if the given
+ * adapter is in one of these confgurations or not.
+ *
+ * Return value:
+ * 	1 if adapter is not supported / 0 if adapter is supported
+ **/
+static int ipr_invalid_adapter(struct ipr_ioa_cfg *ioa_cfg)
+{
+	u8 rev_id;
+	int i;
+
+	if (ioa_cfg->type == 0x5702) {
+		if (pci_read_config_byte(ioa_cfg->pdev, PCI_REVISION_ID,
+					 &rev_id) == PCIBIOS_SUCCESSFUL) {
+			if (rev_id < 4) {
+				for (i = 0; i < ARRAY_SIZE(ipr_blocked_processors); i++){
+					if (__is_processor(ipr_blocked_processors[i]))
+						return 1;
+				}
+			}
+		}
+	}
+	return 0;
+}
+#else
+#define ipr_invalid_adapter(ioa_cfg) 0
+#endif
+
+/**
+ * ipr_ioa_bringdown_done - IOA bring down completion.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function processes the completion of an adapter bring down.
+ * It wakes any reset sleepers.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_ioa_bringdown_done(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	ENTER;
+	ioa_cfg->in_reset_reload = 0;
+	ioa_cfg->reset_retries = 0;
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+	wake_up_all(&ioa_cfg->reset_wait_q);
+
+	spin_unlock_irq(ioa_cfg->host->host_lock);
+	scsi_unblock_requests(ioa_cfg->host);
+	spin_lock_irq(ioa_cfg->host->host_lock);
+	LEAVE;
+
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_ioa_reset_done - IOA reset completion.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function processes the completion of an adapter reset.
+ * It schedules any necessary mid-layer add/removes and
+ * wakes any reset sleepers.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_ioa_reset_done(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_resource_entry *res;
+	struct ipr_hostrcb *hostrcb, *temp;
+	int i = 0;
+
+	ENTER;
+	ioa_cfg->in_reset_reload = 0;
+	ioa_cfg->allow_cmds = 1;
+	ioa_cfg->reset_cmd = NULL;
+
+	list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
+		if (ioa_cfg->allow_ml_add_del && (res->add_to_ml || res->del_from_ml)) {
+			ipr_trace;
+			schedule_work(&ioa_cfg->work_q);
+			break;
+		}
+	}
+
+	list_for_each_entry_safe(hostrcb, temp, &ioa_cfg->hostrcb_free_q, queue) {
+		list_del(&hostrcb->queue);
+		if (i++ < IPR_NUM_LOG_HCAMS)
+			ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_LOG_DATA, hostrcb);
+		else
+			ipr_send_hcam(ioa_cfg, IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE, hostrcb);
+	}
+
+	dev_info(&ioa_cfg->pdev->dev, "IOA initialized.\n");
+
+	ioa_cfg->reset_retries = 0;
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+	wake_up_all(&ioa_cfg->reset_wait_q);
+
+	spin_unlock_irq(ioa_cfg->host->host_lock);
+	scsi_unblock_requests(ioa_cfg->host);
+	spin_lock_irq(ioa_cfg->host->host_lock);
+
+	if (!ioa_cfg->allow_cmds)
+		scsi_block_requests(ioa_cfg->host);
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_set_sup_dev_dflt - Initialize a Set Supported Device buffer
+ * @supported_dev:	supported device struct
+ * @vpids:			vendor product id struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_set_sup_dev_dflt(struct ipr_supported_device *supported_dev,
+				 struct ipr_std_inq_vpids *vpids)
+{
+	memset(supported_dev, 0, sizeof(struct ipr_supported_device));
+	memcpy(&supported_dev->vpids, vpids, sizeof(struct ipr_std_inq_vpids));
+	supported_dev->num_records = 1;
+	supported_dev->data_length =
+		cpu_to_be16(sizeof(struct ipr_supported_device));
+	supported_dev->reserved = 0;
+}
+
+/**
+ * ipr_set_supported_devs - Send Set Supported Devices for a device
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function send a Set Supported Devices to the adapter
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
+ **/
+static int ipr_set_supported_devs(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_supported_device *supp_dev = &ioa_cfg->vpd_cbs->supp_dev;
+	struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+	struct ipr_resource_entry *res = ipr_cmd->u.res;
+
+	ipr_cmd->job_step = ipr_ioa_reset_done;
+
+	list_for_each_entry_continue(res, &ioa_cfg->used_res_q, queue) {
+		if (!ipr_is_af_dasd_device(res))
+			continue;
+
+		ipr_cmd->u.res = res;
+		ipr_set_sup_dev_dflt(supp_dev, &res->cfgte.std_inq_data.vpids);
+
+		ioarcb->res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
+		ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_WRITE_NOT_READ;
+		ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD;
+
+		ioarcb->cmd_pkt.cdb[0] = IPR_SET_SUPPORTED_DEVICES;
+		ioarcb->cmd_pkt.cdb[7] = (sizeof(struct ipr_supported_device) >> 8) & 0xff;
+		ioarcb->cmd_pkt.cdb[8] = sizeof(struct ipr_supported_device) & 0xff;
+
+		ioadl->flags_and_data_len = cpu_to_be32(IPR_IOADL_FLAGS_WRITE_LAST |
+							sizeof(struct ipr_supported_device));
+		ioadl->address = cpu_to_be32(ioa_cfg->vpd_cbs_dma +
+					     offsetof(struct ipr_misc_cbs, supp_dev));
+		ioarcb->write_ioadl_len = cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+		ioarcb->write_data_transfer_length =
+			cpu_to_be32(sizeof(struct ipr_supported_device));
+
+		ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout,
+			   IPR_SET_SUP_DEVICE_TIMEOUT);
+
+		ipr_cmd->job_step = ipr_set_supported_devs;
+		return IPR_RC_JOB_RETURN;
+	}
+
+	return IPR_RC_JOB_CONTINUE;
+}
+
+/**
+ * ipr_get_mode_page - Locate specified mode page
+ * @mode_pages:	mode page buffer
+ * @page_code:	page code to find
+ * @len:		minimum required length for mode page
+ *
+ * Return value:
+ * 	pointer to mode page / NULL on failure
+ **/
+static void *ipr_get_mode_page(struct ipr_mode_pages *mode_pages,
+			       u32 page_code, u32 len)
+{
+	struct ipr_mode_page_hdr *mode_hdr;
+	u32 page_length;
+	u32 length;
+
+	if (!mode_pages || (mode_pages->hdr.length == 0))
+		return NULL;
+
+	length = (mode_pages->hdr.length + 1) - 4 - mode_pages->hdr.block_desc_len;
+	mode_hdr = (struct ipr_mode_page_hdr *)
+		(mode_pages->data + mode_pages->hdr.block_desc_len);
+
+	while (length) {
+		if (IPR_GET_MODE_PAGE_CODE(mode_hdr) == page_code) {
+			if (mode_hdr->page_length >= (len - sizeof(struct ipr_mode_page_hdr)))
+				return mode_hdr;
+			break;
+		} else {
+			page_length = (sizeof(struct ipr_mode_page_hdr) +
+				       mode_hdr->page_length);
+			length -= page_length;
+			mode_hdr = (struct ipr_mode_page_hdr *)
+				((unsigned long)mode_hdr + page_length);
+		}
+	}
+	return NULL;
+}
+
+/**
+ * ipr_check_term_power - Check for term power errors
+ * @ioa_cfg:	ioa config struct
+ * @mode_pages:	IOAFP mode pages buffer
+ *
+ * Check the IOAFP's mode page 28 for term power errors
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_check_term_power(struct ipr_ioa_cfg *ioa_cfg,
+				 struct ipr_mode_pages *mode_pages)
+{
+	int i;
+	int entry_length;
+	struct ipr_dev_bus_entry *bus;
+	struct ipr_mode_page28 *mode_page;
+
+	mode_page = ipr_get_mode_page(mode_pages, 0x28,
+				      sizeof(struct ipr_mode_page28));
+
+	entry_length = mode_page->entry_length;
+
+	bus = mode_page->bus;
+
+	for (i = 0; i < mode_page->num_entries; i++) {
+		if (bus->flags & IPR_SCSI_ATTR_NO_TERM_PWR) {
+			dev_err(&ioa_cfg->pdev->dev,
+				"Term power is absent on scsi bus %d\n",
+				bus->res_addr.bus);
+		}
+
+		bus = (struct ipr_dev_bus_entry *)((char *)bus + entry_length);
+	}
+}
+
+/**
+ * ipr_scsi_bus_speed_limit - Limit the SCSI speed based on SES table
+ * @ioa_cfg:	ioa config struct
+ *
+ * Looks through the config table checking for SES devices. If
+ * the SES device is in the SES table indicating a maximum SCSI
+ * bus speed, the speed is limited for the bus.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_scsi_bus_speed_limit(struct ipr_ioa_cfg *ioa_cfg)
+{
+	u32 max_xfer_rate;
+	int i;
+
+	for (i = 0; i < IPR_MAX_NUM_BUSES; i++) {
+		max_xfer_rate = ipr_get_max_scsi_speed(ioa_cfg, i,
+						       ioa_cfg->bus_attr[i].bus_width);
+
+		if (max_xfer_rate < ioa_cfg->bus_attr[i].max_xfer_rate)
+			ioa_cfg->bus_attr[i].max_xfer_rate = max_xfer_rate;
+	}
+}
+
+/**
+ * ipr_modify_ioafp_mode_page_28 - Modify IOAFP Mode Page 28
+ * @ioa_cfg:	ioa config struct
+ * @mode_pages:	mode page 28 buffer
+ *
+ * Updates mode page 28 based on driver configuration
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_modify_ioafp_mode_page_28(struct ipr_ioa_cfg *ioa_cfg,
+					  	struct ipr_mode_pages *mode_pages)
+{
+	int i, entry_length;
+	struct ipr_dev_bus_entry *bus;
+	struct ipr_bus_attributes *bus_attr;
+	struct ipr_mode_page28 *mode_page;
+
+	mode_page = ipr_get_mode_page(mode_pages, 0x28,
+				      sizeof(struct ipr_mode_page28));
+
+	entry_length = mode_page->entry_length;
+
+	/* Loop for each device bus entry */
+	for (i = 0, bus = mode_page->bus;
+	     i < mode_page->num_entries;
+	     i++, bus = (struct ipr_dev_bus_entry *)((u8 *)bus + entry_length)) {
+		if (bus->res_addr.bus > IPR_MAX_NUM_BUSES) {
+			dev_err(&ioa_cfg->pdev->dev,
+				"Invalid resource address reported: 0x%08X\n",
+				IPR_GET_PHYS_LOC(bus->res_addr));
+			continue;
+		}
+
+		bus_attr = &ioa_cfg->bus_attr[i];
+		bus->extended_reset_delay = IPR_EXTENDED_RESET_DELAY;
+		bus->bus_width = bus_attr->bus_width;
+		bus->max_xfer_rate = cpu_to_be32(bus_attr->max_xfer_rate);
+		bus->flags &= ~IPR_SCSI_ATTR_QAS_MASK;
+		if (bus_attr->qas_enabled)
+			bus->flags |= IPR_SCSI_ATTR_ENABLE_QAS;
+		else
+			bus->flags |= IPR_SCSI_ATTR_DISABLE_QAS;
+	}
+}
+
+/**
+ * ipr_build_mode_select - Build a mode select command
+ * @ipr_cmd:	ipr command struct
+ * @res_handle:	resource handle to send command to
+ * @parm:		Byte 2 of Mode Sense command
+ * @dma_addr:	DMA buffer address
+ * @xfer_len:	data transfer length
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_build_mode_select(struct ipr_cmnd *ipr_cmd,
+				  u32 res_handle, u8 parm, u32 dma_addr,
+				  u8 xfer_len)
+{
+	struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+
+	ioarcb->res_handle = res_handle;
+	ioarcb->cmd_pkt.request_type = IPR_RQTYPE_SCSICDB;
+	ioarcb->cmd_pkt.flags_hi |= IPR_FLAGS_HI_WRITE_NOT_READ;
+	ioarcb->cmd_pkt.cdb[0] = MODE_SELECT;
+	ioarcb->cmd_pkt.cdb[1] = parm;
+	ioarcb->cmd_pkt.cdb[4] = xfer_len;
+
+	ioadl->flags_and_data_len =
+		cpu_to_be32(IPR_IOADL_FLAGS_WRITE_LAST | xfer_len);
+	ioadl->address = cpu_to_be32(dma_addr);
+	ioarcb->write_ioadl_len = cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+	ioarcb->write_data_transfer_length = cpu_to_be32(xfer_len);
+}
+
+/**
+ * ipr_ioafp_mode_select_page28 - Issue Mode Select Page 28 to IOA
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function sets up the SCSI bus attributes and sends
+ * a Mode Select for Page 28 to activate them.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_ioafp_mode_select_page28(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_mode_pages *mode_pages = &ioa_cfg->vpd_cbs->mode_pages;
+	int length;
+
+	ENTER;
+	if (ioa_cfg->saved_mode_pages) {
+		memcpy(mode_pages, ioa_cfg->saved_mode_pages,
+		       ioa_cfg->saved_mode_page_len);
+		length = ioa_cfg->saved_mode_page_len;
+	} else {
+		ipr_scsi_bus_speed_limit(ioa_cfg);
+		ipr_check_term_power(ioa_cfg, mode_pages);
+		ipr_modify_ioafp_mode_page_28(ioa_cfg, mode_pages);
+		length = mode_pages->hdr.length + 1;
+		mode_pages->hdr.length = 0;
+	}
+
+	ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11,
+			      ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages),
+			      length);
+
+	ipr_cmd->job_step = ipr_set_supported_devs;
+	ipr_cmd->u.res = list_entry(ioa_cfg->used_res_q.next,
+				    struct ipr_resource_entry, queue);
+
+	ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT);
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_build_mode_sense - Builds a mode sense command
+ * @ipr_cmd:	ipr command struct
+ * @res:		resource entry struct
+ * @parm:		Byte 2 of mode sense command
+ * @dma_addr:	DMA address of mode sense buffer
+ * @xfer_len:	Size of DMA buffer
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_build_mode_sense(struct ipr_cmnd *ipr_cmd,
+				 u32 res_handle,
+				 u8 parm, u32 dma_addr, u8 xfer_len)
+{
+	struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+
+	ioarcb->res_handle = res_handle;
+	ioarcb->cmd_pkt.cdb[0] = MODE_SENSE;
+	ioarcb->cmd_pkt.cdb[2] = parm;
+	ioarcb->cmd_pkt.cdb[4] = xfer_len;
+	ioarcb->cmd_pkt.request_type = IPR_RQTYPE_SCSICDB;
+
+	ioadl->flags_and_data_len =
+		cpu_to_be32(IPR_IOADL_FLAGS_READ_LAST | xfer_len);
+	ioadl->address = cpu_to_be32(dma_addr);
+	ioarcb->read_ioadl_len = cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+	ioarcb->read_data_transfer_length = cpu_to_be32(xfer_len);
+}
+
+/**
+ * ipr_ioafp_mode_sense_page28 - Issue Mode Sense Page 28 to IOA
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function send a Page 28 mode sense to the IOA to
+ * retrieve SCSI bus attributes.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_ioafp_mode_sense_page28(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	ENTER;
+	ipr_build_mode_sense(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE),
+			     0x28, ioa_cfg->vpd_cbs_dma +
+			     offsetof(struct ipr_misc_cbs, mode_pages),
+			     sizeof(struct ipr_mode_pages));
+
+	ipr_cmd->job_step = ipr_ioafp_mode_select_page28;
+
+	ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT);
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_init_res_table - Initialize the resource table
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function looks through the existing resource table, comparing
+ * it with the config table. This function will take care of old/new
+ * devices and schedule adding/removing them from the mid-layer
+ * as appropriate.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE
+ **/
+static int ipr_init_res_table(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_resource_entry *res, *temp;
+	struct ipr_config_table_entry *cfgte;
+	int found, i;
+	LIST_HEAD(old_res);
+
+	ENTER;
+	if (ioa_cfg->cfg_table->hdr.flags & IPR_UCODE_DOWNLOAD_REQ)
+		dev_err(&ioa_cfg->pdev->dev, "Microcode download required\n");
+
+	list_for_each_entry_safe(res, temp, &ioa_cfg->used_res_q, queue)
+		list_move_tail(&res->queue, &old_res);
+
+	for (i = 0; i < ioa_cfg->cfg_table->hdr.num_entries; i++) {
+		cfgte = &ioa_cfg->cfg_table->dev[i];
+		found = 0;
+
+		list_for_each_entry_safe(res, temp, &old_res, queue) {
+			if (!memcmp(&res->cfgte.res_addr,
+				    &cfgte->res_addr, sizeof(cfgte->res_addr))) {
+				list_move_tail(&res->queue, &ioa_cfg->used_res_q);
+				found = 1;
+				break;
+			}
+		}
+
+		if (!found) {
+			if (list_empty(&ioa_cfg->free_res_q)) {
+				dev_err(&ioa_cfg->pdev->dev, "Too many devices attached\n");
+				break;
+			}
+
+			found = 1;
+			res = list_entry(ioa_cfg->free_res_q.next,
+					 struct ipr_resource_entry, queue);
+			list_move_tail(&res->queue, &ioa_cfg->used_res_q);
+			ipr_init_res_entry(res);
+			res->add_to_ml = 1;
+		}
+
+		if (found)
+			memcpy(&res->cfgte, cfgte, sizeof(struct ipr_config_table_entry));
+	}
+
+	list_for_each_entry_safe(res, temp, &old_res, queue) {
+		if (res->sdev) {
+			res->del_from_ml = 1;
+			list_move_tail(&res->queue, &ioa_cfg->used_res_q);
+		} else {
+			list_move_tail(&res->queue, &ioa_cfg->free_res_q);
+		}
+	}
+
+	ipr_cmd->job_step = ipr_ioafp_mode_sense_page28;
+
+	LEAVE;
+	return IPR_RC_JOB_CONTINUE;
+}
+
+/**
+ * ipr_ioafp_query_ioa_cfg - Send a Query IOA Config to the adapter.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function sends a Query IOA Configuration command
+ * to the adapter to retrieve the IOA configuration table.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_ioafp_query_ioa_cfg(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+	struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
+	struct ipr_inquiry_page3 *ucode_vpd = &ioa_cfg->vpd_cbs->page3_data;
+
+	ENTER;
+	dev_info(&ioa_cfg->pdev->dev, "Adapter firmware version: %02X%02X%02X%02X\n",
+		 ucode_vpd->major_release, ucode_vpd->card_type,
+		 ucode_vpd->minor_release[0], ucode_vpd->minor_release[1]);
+	ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD;
+	ioarcb->res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
+
+	ioarcb->cmd_pkt.cdb[0] = IPR_QUERY_IOA_CONFIG;
+	ioarcb->cmd_pkt.cdb[7] = (sizeof(struct ipr_config_table) >> 8) & 0xff;
+	ioarcb->cmd_pkt.cdb[8] = sizeof(struct ipr_config_table) & 0xff;
+
+	ioarcb->read_ioadl_len = cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+	ioarcb->read_data_transfer_length =
+		cpu_to_be32(sizeof(struct ipr_config_table));
+
+	ioadl->address = cpu_to_be32(ioa_cfg->cfg_table_dma);
+	ioadl->flags_and_data_len =
+		cpu_to_be32(IPR_IOADL_FLAGS_READ_LAST | sizeof(struct ipr_config_table));
+
+	ipr_cmd->job_step = ipr_init_res_table;
+
+	ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT);
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_ioafp_inquiry - Send an Inquiry to the adapter.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This utility function sends an inquiry to the adapter.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_ioafp_inquiry(struct ipr_cmnd *ipr_cmd, u8 flags, u8 page,
+			      u32 dma_addr, u8 xfer_len)
+{
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+	struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
+
+	ENTER;
+	ioarcb->cmd_pkt.request_type = IPR_RQTYPE_SCSICDB;
+	ioarcb->res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
+
+	ioarcb->cmd_pkt.cdb[0] = INQUIRY;
+	ioarcb->cmd_pkt.cdb[1] = flags;
+	ioarcb->cmd_pkt.cdb[2] = page;
+	ioarcb->cmd_pkt.cdb[4] = xfer_len;
+
+	ioarcb->read_ioadl_len = cpu_to_be32(sizeof(struct ipr_ioadl_desc));
+	ioarcb->read_data_transfer_length = cpu_to_be32(xfer_len);
+
+	ioadl->address = cpu_to_be32(dma_addr);
+	ioadl->flags_and_data_len =
+		cpu_to_be32(IPR_IOADL_FLAGS_READ_LAST | xfer_len);
+
+	ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT);
+	LEAVE;
+}
+
+/**
+ * ipr_ioafp_page3_inquiry - Send a Page 3 Inquiry to the adapter.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function sends a Page 3 inquiry to the adapter
+ * to retrieve software VPD information.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
+ **/
+static int ipr_ioafp_page3_inquiry(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	char type[5];
+
+	ENTER;
+
+	/* Grab the type out of the VPD and store it away */
+	memcpy(type, ioa_cfg->vpd_cbs->ioa_vpd.std_inq_data.vpids.product_id, 4);
+	type[4] = '\0';
+	ioa_cfg->type = simple_strtoul((char *)type, NULL, 16);
+
+	ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg;
+
+	ipr_ioafp_inquiry(ipr_cmd, 1, 3,
+			  ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, page3_data),
+			  sizeof(struct ipr_inquiry_page3));
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_ioafp_std_inquiry - Send a Standard Inquiry to the adapter.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function sends a standard inquiry to the adapter.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_ioafp_std_inquiry(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	ENTER;
+	ipr_cmd->job_step = ipr_ioafp_page3_inquiry;
+
+	ipr_ioafp_inquiry(ipr_cmd, 0, 0,
+			  ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, ioa_vpd),
+			  sizeof(struct ipr_ioa_vpd));
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_ioafp_indentify_hrrq - Send Identify Host RRQ.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function send an Identify Host Request Response Queue
+ * command to establish the HRRQ with the adapter.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_ioafp_indentify_hrrq(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
+
+	ENTER;
+	dev_info(&ioa_cfg->pdev->dev, "Starting IOA initialization sequence.\n");
+
+	ioarcb->cmd_pkt.cdb[0] = IPR_ID_HOST_RR_Q;
+	ioarcb->res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
+
+	ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD;
+	ioarcb->cmd_pkt.cdb[2] =
+		((u32) ioa_cfg->host_rrq_dma >> 24) & 0xff;
+	ioarcb->cmd_pkt.cdb[3] =
+		((u32) ioa_cfg->host_rrq_dma >> 16) & 0xff;
+	ioarcb->cmd_pkt.cdb[4] =
+		((u32) ioa_cfg->host_rrq_dma >> 8) & 0xff;
+	ioarcb->cmd_pkt.cdb[5] =
+		((u32) ioa_cfg->host_rrq_dma) & 0xff;
+	ioarcb->cmd_pkt.cdb[7] =
+		((sizeof(u32) * IPR_NUM_CMD_BLKS) >> 8) & 0xff;
+	ioarcb->cmd_pkt.cdb[8] =
+		(sizeof(u32) * IPR_NUM_CMD_BLKS) & 0xff;
+
+	ipr_cmd->job_step = ipr_ioafp_std_inquiry;
+
+	ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, IPR_INTERNAL_TIMEOUT);
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_reset_timer_done - Adapter reset timer function
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function is used in adapter reset processing
+ * for timing events. If the reset_cmd pointer in the IOA
+ * config struct is not this adapter's we are doing nested
+ * resets and fail_all_ops will take care of freeing the
+ * command block.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_reset_timer_done(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	unsigned long lock_flags = 0;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	if (ioa_cfg->reset_cmd == ipr_cmd) {
+		list_del(&ipr_cmd->queue);
+		ipr_cmd->done(ipr_cmd);
+	}
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+}
+
+/**
+ * ipr_reset_start_timer - Start a timer for adapter reset job
+ * @ipr_cmd:	ipr command struct
+ * @timeout:	timeout value
+ *
+ * Description: This function is used in adapter reset processing
+ * for timing events. If the reset_cmd pointer in the IOA
+ * config struct is not this adapter's we are doing nested
+ * resets and fail_all_ops will take care of freeing the
+ * command block.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_reset_start_timer(struct ipr_cmnd *ipr_cmd,
+				  unsigned long timeout)
+{
+	list_add_tail(&ipr_cmd->queue, &ipr_cmd->ioa_cfg->pending_q);
+	ipr_cmd->done = ipr_reset_ioa_job;
+
+	ipr_cmd->timer.data = (unsigned long) ipr_cmd;
+	ipr_cmd->timer.expires = jiffies + timeout;
+	ipr_cmd->timer.function = (void (*)(unsigned long))ipr_reset_timer_done;
+	add_timer(&ipr_cmd->timer);
+}
+
+/**
+ * ipr_init_ioa_mem - Initialize ioa_cfg control block
+ * @ioa_cfg:	ioa cfg struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_init_ioa_mem(struct ipr_ioa_cfg *ioa_cfg)
+{
+	memset(ioa_cfg->host_rrq, 0, sizeof(u32) * IPR_NUM_CMD_BLKS);
+
+	/* Initialize Host RRQ pointers */
+	ioa_cfg->hrrq_start = ioa_cfg->host_rrq;
+	ioa_cfg->hrrq_end = &ioa_cfg->host_rrq[IPR_NUM_CMD_BLKS - 1];
+	ioa_cfg->hrrq_curr = ioa_cfg->hrrq_start;
+	ioa_cfg->toggle_bit = 1;
+
+	/* Zero out config table */
+	memset(ioa_cfg->cfg_table, 0, sizeof(struct ipr_config_table));
+}
+
+/**
+ * ipr_reset_enable_ioa - Enable the IOA following a reset.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function reinitializes some control blocks and
+ * enables destructive diagnostics on the adapter.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_reset_enable_ioa(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	volatile u32 int_reg;
+
+	ENTER;
+	ipr_cmd->job_step = ipr_ioafp_indentify_hrrq;
+	ipr_init_ioa_mem(ioa_cfg);
+
+	ioa_cfg->allow_interrupts = 1;
+	int_reg = readl(ioa_cfg->regs.sense_interrupt_reg);
+
+	if (int_reg & IPR_PCII_IOA_TRANS_TO_OPER) {
+		writel((IPR_PCII_ERROR_INTERRUPTS | IPR_PCII_HRRQ_UPDATED),
+		       ioa_cfg->regs.clr_interrupt_mask_reg);
+		int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
+		return IPR_RC_JOB_CONTINUE;
+	}
+
+	/* Enable destructive diagnostics on IOA */
+	writel(IPR_DOORBELL, ioa_cfg->regs.set_uproc_interrupt_reg);
+
+	writel(IPR_PCII_OPER_INTERRUPTS, ioa_cfg->regs.clr_interrupt_mask_reg);
+	int_reg = readl(ioa_cfg->regs.sense_interrupt_mask_reg);
+
+	dev_info(&ioa_cfg->pdev->dev, "Initializing IOA.\n");
+
+	ipr_cmd->timer.data = (unsigned long) ipr_cmd;
+	ipr_cmd->timer.expires = jiffies + IPR_OPERATIONAL_TIMEOUT;
+	ipr_cmd->timer.function = (void (*)(unsigned long))ipr_timeout;
+	add_timer(&ipr_cmd->timer);
+	list_add_tail(&ipr_cmd->queue, &ioa_cfg->pending_q);
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_reset_wait_for_dump - Wait for a dump to timeout.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function is invoked when an adapter dump has run out
+ * of processing time.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE
+ **/
+static int ipr_reset_wait_for_dump(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	if (ioa_cfg->sdt_state == GET_DUMP)
+		ioa_cfg->sdt_state = ABORT_DUMP;
+
+	ipr_cmd->job_step = ipr_reset_alert;
+
+	return IPR_RC_JOB_CONTINUE;
+}
+
+/**
+ * ipr_unit_check_no_data - Log a unit check/no data error log
+ * @ioa_cfg:		ioa config struct
+ *
+ * Logs an error indicating the adapter unit checked, but for some
+ * reason, we were unable to fetch the unit check buffer.
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_unit_check_no_data(struct ipr_ioa_cfg *ioa_cfg)
+{
+	ioa_cfg->errors_logged++;
+	dev_err(&ioa_cfg->pdev->dev, "IOA unit check with no data\n");
+}
+
+/**
+ * ipr_get_unit_check_buffer - Get the unit check buffer from the IOA
+ * @ioa_cfg:		ioa config struct
+ *
+ * Fetches the unit check buffer from the adapter by clocking the data
+ * through the mailbox register.
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_get_unit_check_buffer(struct ipr_ioa_cfg *ioa_cfg)
+{
+	unsigned long mailbox;
+	struct ipr_hostrcb *hostrcb;
+	struct ipr_uc_sdt sdt;
+	int rc, length;
+
+	mailbox = readl(ioa_cfg->ioa_mailbox);
+
+	if (!ipr_sdt_is_fmt2(mailbox)) {
+		ipr_unit_check_no_data(ioa_cfg);
+		return;
+	}
+
+	memset(&sdt, 0, sizeof(struct ipr_uc_sdt));
+	rc = ipr_get_ldump_data_section(ioa_cfg, mailbox, (u32 *) &sdt,
+					(sizeof(struct ipr_uc_sdt)) / sizeof(u32));
+
+	if (rc || (be32_to_cpu(sdt.hdr.state) != IPR_FMT2_SDT_READY_TO_USE) ||
+	    !(sdt.entry[0].flags & IPR_SDT_VALID_ENTRY)) {
+		ipr_unit_check_no_data(ioa_cfg);
+		return;
+	}
+
+	/* Find length of the first sdt entry (UC buffer) */
+	length = (be32_to_cpu(sdt.entry[0].end_offset) -
+		  be32_to_cpu(sdt.entry[0].bar_str_offset)) & IPR_FMT2_MBX_ADDR_MASK;
+
+	hostrcb = list_entry(ioa_cfg->hostrcb_free_q.next,
+			     struct ipr_hostrcb, queue);
+	list_del(&hostrcb->queue);
+	memset(&hostrcb->hcam, 0, sizeof(hostrcb->hcam));
+
+	rc = ipr_get_ldump_data_section(ioa_cfg,
+					be32_to_cpu(sdt.entry[0].bar_str_offset),
+					(u32 *)&hostrcb->hcam,
+					min(length, (int)sizeof(hostrcb->hcam)) / sizeof(u32));
+
+	if (!rc)
+		ipr_handle_log_data(ioa_cfg, hostrcb);
+	else
+		ipr_unit_check_no_data(ioa_cfg);
+
+	list_add_tail(&hostrcb->queue, &ioa_cfg->hostrcb_free_q);
+}
+
+/**
+ * ipr_reset_restore_cfg_space - Restore PCI config space.
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function restores the saved PCI config space of
+ * the adapter, fails all outstanding ops back to the callers, and
+ * fetches the dump/unit check if applicable to this reset.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
+ **/
+static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	int rc;
+
+	ENTER;
+	rc = pci_restore_state(ioa_cfg->pdev, ioa_cfg->pci_cfg_buf);
+
+	if (rc != PCIBIOS_SUCCESSFUL) {
+		ipr_cmd->ioasa.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
+		return IPR_RC_JOB_CONTINUE;
+	}
+
+	if (ipr_set_pcix_cmd_reg(ioa_cfg)) {
+		ipr_cmd->ioasa.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
+		return IPR_RC_JOB_CONTINUE;
+	}
+
+	ipr_fail_all_ops(ioa_cfg);
+
+	if (ioa_cfg->ioa_unit_checked) {
+		ioa_cfg->ioa_unit_checked = 0;
+		ipr_get_unit_check_buffer(ioa_cfg);
+		ipr_cmd->job_step = ipr_reset_alert;
+		ipr_reset_start_timer(ipr_cmd, 0);
+		return IPR_RC_JOB_RETURN;
+	}
+
+	if (ioa_cfg->in_ioa_bringdown) {
+		ipr_cmd->job_step = ipr_ioa_bringdown_done;
+	} else {
+		ipr_cmd->job_step = ipr_reset_enable_ioa;
+
+		if (GET_DUMP == ioa_cfg->sdt_state) {
+			ipr_reset_start_timer(ipr_cmd, IPR_DUMP_TIMEOUT);
+			ipr_cmd->job_step = ipr_reset_wait_for_dump;
+			schedule_work(&ioa_cfg->work_q);
+			return IPR_RC_JOB_RETURN;
+		}
+	}
+
+	ENTER;
+	return IPR_RC_JOB_CONTINUE;
+}
+
+/**
+ * ipr_reset_start_bist - Run BIST on the adapter.
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function runs BIST on the adapter, then delays 2 seconds.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
+ **/
+static int ipr_reset_start_bist(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	int rc;
+
+	ENTER;
+	rc = pci_write_config_byte(ioa_cfg->pdev, PCI_BIST, PCI_BIST_START);
+
+	if (rc != PCIBIOS_SUCCESSFUL) {
+		ipr_cmd->ioasa.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
+		rc = IPR_RC_JOB_CONTINUE;
+	} else {
+		ipr_cmd->job_step = ipr_reset_restore_cfg_space;
+		ipr_reset_start_timer(ipr_cmd, IPR_WAIT_FOR_BIST_TIMEOUT);
+		rc = IPR_RC_JOB_RETURN;
+	}
+
+	LEAVE;
+	return rc;
+}
+
+/**
+ * ipr_reset_allowed - Query whether or not IOA can be reset
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ * 	0 if reset not allowed / non-zero if reset is allowed
+ **/
+static int ipr_reset_allowed(struct ipr_ioa_cfg *ioa_cfg)
+{
+	volatile u32 temp_reg;
+
+	temp_reg = readl(ioa_cfg->regs.sense_interrupt_reg);
+	return ((temp_reg & IPR_PCII_CRITICAL_OPERATION) == 0);
+}
+
+/**
+ * ipr_reset_wait_to_start_bist - Wait for permission to reset IOA.
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function waits for adapter permission to run BIST,
+ * then runs BIST. If the adapter does not give permission after a
+ * reasonable time, we will reset the adapter anyway. The impact of
+ * resetting the adapter without warning the adapter is the risk of
+ * losing the persistent error log on the adapter. If the adapter is
+ * reset while it is writing to the flash on the adapter, the flash
+ * segment will have bad ECC and be zeroed.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
+ **/
+static int ipr_reset_wait_to_start_bist(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	int rc = IPR_RC_JOB_RETURN;
+
+	if (!ipr_reset_allowed(ioa_cfg) && ipr_cmd->u.time_left) {
+		ipr_cmd->u.time_left -= IPR_CHECK_FOR_RESET_TIMEOUT;
+		ipr_reset_start_timer(ipr_cmd, IPR_CHECK_FOR_RESET_TIMEOUT);
+	} else {
+		ipr_cmd->job_step = ipr_reset_start_bist;
+		rc = IPR_RC_JOB_CONTINUE;
+	}
+
+	return rc;
+}
+
+/**
+ * ipr_reset_alert_part2 - Alert the adapter of a pending reset
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function alerts the adapter that it will be reset.
+ * If memory space is not currently enabled, proceed directly
+ * to running BIST on the adapter. The timer must always be started
+ * so we guarantee we do not run BIST from ipr_isr.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_RETURN
+ **/
+static int ipr_reset_alert(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	u16 cmd_reg;
+	int rc;
+
+	ENTER;
+	rc = pci_read_config_word(ioa_cfg->pdev, PCI_COMMAND, &cmd_reg);
+
+	if ((rc == PCIBIOS_SUCCESSFUL) && (cmd_reg & PCI_COMMAND_MEMORY)) {
+		ipr_mask_and_clear_interrupts(ioa_cfg, ~0);
+		writel(IPR_UPROCI_RESET_ALERT, ioa_cfg->regs.set_uproc_interrupt_reg);
+		ipr_cmd->job_step = ipr_reset_wait_to_start_bist;
+	} else {
+		ipr_cmd->job_step = ipr_reset_start_bist;
+	}
+
+	ipr_cmd->u.time_left = IPR_WAIT_FOR_RESET_TIMEOUT;
+	ipr_reset_start_timer(ipr_cmd, IPR_CHECK_FOR_RESET_TIMEOUT);
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_reset_ucode_download_done - Microcode download completion
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function unmaps the microcode download buffer.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE
+ **/
+static int ipr_reset_ucode_download_done(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_sglist *sglist = ioa_cfg->ucode_sglist;
+
+	pci_unmap_sg(ioa_cfg->pdev, sglist->scatterlist,
+		     sglist->num_sg, DMA_TO_DEVICE);
+
+	ipr_cmd->job_step = ipr_reset_alert;
+	return IPR_RC_JOB_CONTINUE;
+}
+
+/**
+ * ipr_reset_ucode_download - Download microcode to the adapter
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function checks to see if it there is microcode
+ * to download to the adapter. If there is, a download is performed.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
+ **/
+static int ipr_reset_ucode_download(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	struct ipr_sglist *sglist = ioa_cfg->ucode_sglist;
+
+	ENTER;
+	ipr_cmd->job_step = ipr_reset_alert;
+
+	if (!sglist)
+		return IPR_RC_JOB_CONTINUE;
+
+	ipr_cmd->ioarcb.res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
+	ipr_cmd->ioarcb.cmd_pkt.request_type = IPR_RQTYPE_SCSICDB;
+	ipr_cmd->ioarcb.cmd_pkt.cdb[0] = WRITE_BUFFER;
+	ipr_cmd->ioarcb.cmd_pkt.cdb[1] = IPR_WR_BUF_DOWNLOAD_AND_SAVE;
+	ipr_cmd->ioarcb.cmd_pkt.cdb[6] = (sglist->buffer_len & 0xff0000) >> 16;
+	ipr_cmd->ioarcb.cmd_pkt.cdb[7] = (sglist->buffer_len & 0x00ff00) >> 8;
+	ipr_cmd->ioarcb.cmd_pkt.cdb[8] = sglist->buffer_len & 0x0000ff;
+
+	if (ipr_map_ucode_buffer(ipr_cmd, sglist, sglist->buffer_len)) {
+		dev_err(&ioa_cfg->pdev->dev,
+			"Failed to map microcode download buffer\n");
+		return IPR_RC_JOB_CONTINUE;
+	}
+
+	ipr_cmd->job_step = ipr_reset_ucode_download_done;
+
+	ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout,
+		   IPR_WRITE_BUFFER_TIMEOUT);
+
+	LEAVE;
+	return IPR_RC_JOB_RETURN;
+}
+
+/**
+ * ipr_reset_shutdown_ioa - Shutdown the adapter
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function issues an adapter shutdown of the
+ * specified type to the specified adapter as part of the
+ * adapter reset job.
+ *
+ * Return value:
+ * 	IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN
+ **/
+static int ipr_reset_shutdown_ioa(struct ipr_cmnd *ipr_cmd)
+{
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+	enum ipr_shutdown_type shutdown_type = ipr_cmd->u.shutdown_type;
+	unsigned long timeout;
+	int rc = IPR_RC_JOB_CONTINUE;
+
+	ENTER;
+	if (shutdown_type != IPR_SHUTDOWN_NONE && !ioa_cfg->ioa_is_dead) {
+		ipr_cmd->ioarcb.res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
+		ipr_cmd->ioarcb.cmd_pkt.request_type = IPR_RQTYPE_IOACMD;
+		ipr_cmd->ioarcb.cmd_pkt.cdb[0] = IPR_IOA_SHUTDOWN;
+		ipr_cmd->ioarcb.cmd_pkt.cdb[1] = shutdown_type;
+
+		if (shutdown_type == IPR_SHUTDOWN_ABBREV)
+			timeout = IPR_ABBREV_SHUTDOWN_TIMEOUT;
+		else if (shutdown_type == IPR_SHUTDOWN_PREPARE_FOR_NORMAL)
+			timeout = IPR_INTERNAL_TIMEOUT;
+		else
+			timeout = IPR_SHUTDOWN_TIMEOUT;
+
+		ipr_do_req(ipr_cmd, ipr_reset_ioa_job, ipr_timeout, timeout);
+
+		rc = IPR_RC_JOB_RETURN;
+		ipr_cmd->job_step = ipr_reset_ucode_download;
+	} else
+		ipr_cmd->job_step = ipr_reset_alert;
+
+	LEAVE;
+	return rc;
+}
+
+/**
+ * ipr_reset_ioa_job - Adapter reset job
+ * @ipr_cmd:	ipr command struct
+ *
+ * Description: This function is the job router for the adapter reset job.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_reset_ioa_job(struct ipr_cmnd *ipr_cmd)
+{
+	u32 rc, ioasc;
+	unsigned long scratch = ipr_cmd->u.scratch;
+	struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
+
+	do {
+		ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
+
+		if (ioa_cfg->reset_cmd != ipr_cmd) {
+			/*
+			 * We are doing nested adapter resets and this is
+			 * not the current reset job.
+			 */
+			list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+			return;
+		}
+
+		if (IPR_IOASC_SENSE_KEY(ioasc)) {
+			dev_err(&ioa_cfg->pdev->dev,
+				"0x%02X failed with IOASC: 0x%08X\n",
+				ipr_cmd->ioarcb.cmd_pkt.cdb[0], ioasc);
+
+			ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
+			list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+			return;
+		}
+
+		ipr_reinit_ipr_cmnd(ipr_cmd);
+		ipr_cmd->u.scratch = scratch;
+		rc = ipr_cmd->job_step(ipr_cmd);
+	} while(rc == IPR_RC_JOB_CONTINUE);
+}
+
+/**
+ * _ipr_initiate_ioa_reset - Initiate an adapter reset
+ * @ioa_cfg:		ioa config struct
+ * @job_step:		first job step of reset job
+ * @shutdown_type:	shutdown type
+ *
+ * Description: This function will initiate the reset of the given adapter
+ * starting at the selected job step.
+ * If the caller needs to wait on the completion of the reset,
+ * the caller must sleep on the reset_wait_q.
+ *
+ * Return value:
+ * 	none
+ **/
+static void _ipr_initiate_ioa_reset(struct ipr_ioa_cfg *ioa_cfg,
+				    int (*job_step) (struct ipr_cmnd *),
+				    enum ipr_shutdown_type shutdown_type)
+{
+	struct ipr_cmnd *ipr_cmd;
+
+	ioa_cfg->in_reset_reload = 1;
+	ioa_cfg->allow_cmds = 0;
+	scsi_block_requests(ioa_cfg->host);
+
+	ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
+	ioa_cfg->reset_cmd = ipr_cmd;
+	ipr_cmd->job_step = job_step;
+	ipr_cmd->u.shutdown_type = shutdown_type;
+
+	ipr_reset_ioa_job(ipr_cmd);
+}
+
+/**
+ * ipr_initiate_ioa_reset - Initiate an adapter reset
+ * @ioa_cfg:		ioa config struct
+ * @shutdown_type:	shutdown type
+ *
+ * Description: This function will initiate the reset of the given adapter.
+ * If the caller needs to wait on the completion of the reset,
+ * the caller must sleep on the reset_wait_q.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_initiate_ioa_reset(struct ipr_ioa_cfg *ioa_cfg,
+				   enum ipr_shutdown_type shutdown_type)
+{
+	if (ioa_cfg->ioa_is_dead)
+		return;
+
+	if (ioa_cfg->in_reset_reload && ioa_cfg->sdt_state == GET_DUMP)
+		ioa_cfg->sdt_state = ABORT_DUMP;
+
+	if (ioa_cfg->reset_retries++ > IPR_NUM_RESET_RELOAD_RETRIES) {
+		dev_err(&ioa_cfg->pdev->dev,
+			"IOA taken offline - error recovery failed\n");
+
+		ioa_cfg->reset_retries = 0;
+		ioa_cfg->ioa_is_dead = 1;
+
+		if (ioa_cfg->in_ioa_bringdown) {
+			ioa_cfg->reset_cmd = NULL;
+			ioa_cfg->in_reset_reload = 0;
+			ipr_fail_all_ops(ioa_cfg);
+			wake_up_all(&ioa_cfg->reset_wait_q);
+
+			spin_unlock_irq(ioa_cfg->host->host_lock);
+			scsi_unblock_requests(ioa_cfg->host);
+			spin_lock_irq(ioa_cfg->host->host_lock);
+			return;
+		} else {
+			ioa_cfg->in_ioa_bringdown = 1;
+			shutdown_type = IPR_SHUTDOWN_NONE;
+		}
+	}
+
+	_ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_shutdown_ioa,
+				shutdown_type);
+}
+
+/**
+ * ipr_probe_ioa_part2 - Initializes IOAs found in ipr_probe_ioa(..)
+ * @ioa_cfg:	ioa cfg struct
+ *
+ * Description: This is the second phase of adapter intialization
+ * This function takes care of initilizing the adapter to the point
+ * where it can accept new commands.
+
+ * Return value:
+ * 	0 on sucess / -EIO on failure
+ **/
+static int __devinit ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
+{
+	int rc = 0;
+	unsigned long host_lock_flags = 0;
+
+	ENTER;
+	spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags);
+	dev_dbg(&ioa_cfg->pdev->dev, "ioa_cfg adx: 0x%p\n", ioa_cfg);
+	_ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_enable_ioa, IPR_SHUTDOWN_NONE);
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
+	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+	spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags);
+
+	if (ioa_cfg->ioa_is_dead) {
+		rc = -EIO;
+	} else if (ipr_invalid_adapter(ioa_cfg)) {
+		if (!ipr_testmode)
+			rc = -EIO;
+
+		dev_err(&ioa_cfg->pdev->dev,
+			"Adapter not supported in this hardware configuration.\n");
+	}
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
+
+	LEAVE;
+	return rc;
+}
+
+/**
+ * ipr_free_cmd_blks - Frees command blocks allocated for an adapter
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_free_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
+{
+	int i;
+
+	for (i = 0; i < IPR_NUM_CMD_BLKS; i++) {
+		if (ioa_cfg->ipr_cmnd_list[i])
+			pci_pool_free(ioa_cfg->ipr_cmd_pool,
+				      ioa_cfg->ipr_cmnd_list[i],
+				      ioa_cfg->ipr_cmnd_list_dma[i]);
+
+		ioa_cfg->ipr_cmnd_list[i] = NULL;
+	}
+
+	if (ioa_cfg->ipr_cmd_pool)
+		pci_pool_destroy (ioa_cfg->ipr_cmd_pool);
+
+	ioa_cfg->ipr_cmd_pool = NULL;
+}
+
+/**
+ * ipr_free_mem - Frees memory allocated for an adapter
+ * @ioa_cfg:	ioa cfg struct
+ *
+ * Return value:
+ * 	nothing
+ **/
+static void ipr_free_mem(struct ipr_ioa_cfg *ioa_cfg)
+{
+	int i;
+
+	kfree(ioa_cfg->res_entries);
+	pci_free_consistent(ioa_cfg->pdev, sizeof(struct ipr_misc_cbs),
+			    ioa_cfg->vpd_cbs, ioa_cfg->vpd_cbs_dma);
+	ipr_free_cmd_blks(ioa_cfg);
+	pci_free_consistent(ioa_cfg->pdev, sizeof(u32) * IPR_NUM_CMD_BLKS,
+			    ioa_cfg->host_rrq, ioa_cfg->host_rrq_dma);
+	pci_free_consistent(ioa_cfg->pdev, sizeof(struct ipr_config_table),
+			    ioa_cfg->cfg_table,
+			    ioa_cfg->cfg_table_dma);
+
+	for (i = 0; i < IPR_NUM_HCAMS; i++) {
+		pci_free_consistent(ioa_cfg->pdev,
+				    sizeof(struct ipr_hostrcb),
+				    ioa_cfg->hostrcb[i],
+				    ioa_cfg->hostrcb_dma[i]);
+	}
+
+	ipr_free_dump(ioa_cfg);
+	kfree(ioa_cfg->saved_mode_pages);
+	kfree(ioa_cfg->trace);
+}
+
+/**
+ * ipr_free_all_resources - Free all allocated resources for an adapter.
+ * @ipr_cmd:	ipr command struct
+ *
+ * This function frees all allocated resources for the
+ * specified adapter.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_free_all_resources(struct ipr_ioa_cfg *ioa_cfg)
+{
+	ENTER;
+	free_irq(ioa_cfg->pdev->irq, ioa_cfg);
+	iounmap((void *) ioa_cfg->hdw_dma_regs);
+	release_mem_region(ioa_cfg->hdw_dma_regs_pci,
+			   pci_resource_len(ioa_cfg->pdev, 0));
+	ipr_free_mem(ioa_cfg);
+	scsi_host_put(ioa_cfg->host);
+	LEAVE;
+}
+
+/**
+ * ipr_alloc_cmd_blks - Allocate command blocks for an adapter
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ * 	0 on success / -ENOMEM on allocation failure
+ **/
+static int __devinit ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
+{
+	struct ipr_cmnd *ipr_cmd;
+	struct ipr_ioarcb *ioarcb;
+	u32 dma_addr;
+	int i;
+
+	ioa_cfg->ipr_cmd_pool = pci_pool_create (IPR_NAME, ioa_cfg->pdev,
+						 sizeof(struct ipr_cmnd), 8, 0);
+
+	if (!ioa_cfg->ipr_cmd_pool)
+		return -ENOMEM;
+
+	for (i = 0; i < IPR_NUM_CMD_BLKS; i++) {
+		ipr_cmd = pci_pool_alloc (ioa_cfg->ipr_cmd_pool, SLAB_KERNEL, &dma_addr);
+
+		if (!ipr_cmd) {
+			ipr_free_cmd_blks(ioa_cfg);
+			return -ENOMEM;
+		}
+
+		memset(ipr_cmd, 0, sizeof(*ipr_cmd));
+		ioa_cfg->ipr_cmnd_list[i] = ipr_cmd;
+		ioa_cfg->ipr_cmnd_list_dma[i] = dma_addr;
+
+		ioarcb = &ipr_cmd->ioarcb;
+		ioarcb->ioarcb_host_pci_addr = cpu_to_be32(dma_addr);
+		ioarcb->host_response_handle = cpu_to_be32(i << 2);
+		ioarcb->write_ioadl_addr =
+			cpu_to_be32(dma_addr + offsetof(struct ipr_cmnd, ioadl));
+		ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
+		ioarcb->ioasa_host_pci_addr =
+			cpu_to_be32(dma_addr + offsetof(struct ipr_cmnd, ioasa));
+		ioarcb->ioasa_len = cpu_to_be16(sizeof(struct ipr_ioasa));
+		ipr_cmd->cmd_index = i;
+		ipr_cmd->ioa_cfg = ioa_cfg;
+		ipr_cmd->sense_buffer_dma = dma_addr +
+			offsetof(struct ipr_cmnd, sense_buffer);
+
+		list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
+	}
+
+	return 0;
+}
+
+/**
+ * ipr_alloc_mem - Allocate memory for an adapter
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ * 	0 on success / non-zero for error
+ **/
+static int __devinit ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
+{
+	int i;
+
+	ENTER;
+	ioa_cfg->res_entries = kmalloc(sizeof(struct ipr_resource_entry) *
+				       IPR_MAX_PHYSICAL_DEVS, GFP_KERNEL);
+
+	if (!ioa_cfg->res_entries)
+		goto cleanup;
+
+	memset(ioa_cfg->res_entries, 0,
+	       sizeof(struct ipr_resource_entry) * IPR_MAX_PHYSICAL_DEVS);
+
+	for (i = 0; i < IPR_MAX_PHYSICAL_DEVS; i++)
+		list_add_tail(&ioa_cfg->res_entries[i].queue, &ioa_cfg->free_res_q);
+
+	ioa_cfg->vpd_cbs = pci_alloc_consistent(ioa_cfg->pdev,
+						sizeof(struct ipr_misc_cbs),
+						&ioa_cfg->vpd_cbs_dma);
+
+	if (!ioa_cfg->vpd_cbs)
+		goto cleanup;
+
+	if (ipr_alloc_cmd_blks(ioa_cfg))
+		goto cleanup;
+
+	ioa_cfg->host_rrq = pci_alloc_consistent(ioa_cfg->pdev,
+						 sizeof(u32) * IPR_NUM_CMD_BLKS,
+						 &ioa_cfg->host_rrq_dma);
+
+	if (!ioa_cfg->host_rrq)
+		goto cleanup;
+
+	ioa_cfg->cfg_table = pci_alloc_consistent(ioa_cfg->pdev,
+						  sizeof(struct ipr_config_table),
+						  &ioa_cfg->cfg_table_dma);
+
+	if (!ioa_cfg->cfg_table)
+		goto cleanup;
+
+	for (i = 0; i < IPR_NUM_HCAMS; i++) {
+		ioa_cfg->hostrcb[i] = pci_alloc_consistent(ioa_cfg->pdev,
+							   sizeof(struct ipr_hostrcb),
+							   &ioa_cfg->hostrcb_dma[i]);
+
+		if (!ioa_cfg->hostrcb[i])
+			goto cleanup;
+
+		memset(ioa_cfg->hostrcb[i], 0, sizeof(struct ipr_hostrcb));
+		ioa_cfg->hostrcb[i]->hostrcb_dma =
+			ioa_cfg->hostrcb_dma[i] + offsetof(struct ipr_hostrcb, hcam);
+		list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q);
+	}
+
+	ioa_cfg->trace = kmalloc(sizeof(struct ipr_trace_entry) *
+				 IPR_NUM_TRACE_ENTRIES, GFP_KERNEL);
+
+	if (!ioa_cfg->trace)
+		goto cleanup;
+
+	memset(ioa_cfg->trace, 0,
+	       sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES);
+
+	LEAVE;
+	return 0;
+
+cleanup:
+	ipr_free_mem(ioa_cfg);
+
+	LEAVE;
+	return -ENOMEM;
+}
+
+/**
+ * ipr_initialize_bus_attr - Initialize SCSI bus attributes to default values
+ * @ioa_cfg:	ioa config struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void __devinit ipr_initialize_bus_attr(struct ipr_ioa_cfg *ioa_cfg)
+{
+	int i;
+
+	for (i = 0; i < IPR_MAX_NUM_BUSES; i++) {
+		ioa_cfg->bus_attr[i].bus = i;
+		ioa_cfg->bus_attr[i].qas_enabled = 0;
+		ioa_cfg->bus_attr[i].bus_width = IPR_DEFAULT_BUS_WIDTH;
+		if (ipr_max_speed < ARRAY_SIZE(ipr_max_bus_speeds))
+			ioa_cfg->bus_attr[i].max_xfer_rate = ipr_max_bus_speeds[ipr_max_speed];
+		else
+			ioa_cfg->bus_attr[i].max_xfer_rate = IPR_U160_SCSI_RATE;
+	}
+}
+
+/**
+ * ipr_init_ioa_cfg - Initialize IOA config struct
+ * @ioa_cfg:	ioa config struct
+ * @host:		scsi host struct
+ * @pdev:		PCI dev struct
+ *
+ * Return value:
+ * 	none
+ **/
+static void __devinit ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
+				       struct Scsi_Host *host, struct pci_dev *pdev)
+{
+	ioa_cfg->host = host;
+	ioa_cfg->pdev = pdev;
+	ioa_cfg->log_level = ipr_log_level;
+	sprintf(ioa_cfg->eye_catcher, IPR_EYECATCHER);
+	sprintf(ioa_cfg->trace_start, IPR_TRACE_START_LABEL);
+	sprintf(ioa_cfg->ipr_free_label, IPR_FREEQ_LABEL);
+	sprintf(ioa_cfg->ipr_pending_label, IPR_PENDQ_LABEL);
+	sprintf(ioa_cfg->cfg_table_start, IPR_CFG_TBL_START);
+	sprintf(ioa_cfg->resource_table_label, IPR_RES_TABLE_LABEL);
+	sprintf(ioa_cfg->ipr_hcam_label, IPR_HCAM_LABEL);
+	sprintf(ioa_cfg->ipr_cmd_label, IPR_CMD_LABEL);
+
+	INIT_LIST_HEAD(&ioa_cfg->free_q);
+	INIT_LIST_HEAD(&ioa_cfg->pending_q);
+	INIT_LIST_HEAD(&ioa_cfg->hostrcb_free_q);
+	INIT_LIST_HEAD(&ioa_cfg->hostrcb_pending_q);
+	INIT_LIST_HEAD(&ioa_cfg->free_res_q);
+	INIT_LIST_HEAD(&ioa_cfg->used_res_q);
+	INIT_WORK(&ioa_cfg->work_q, ipr_worker_thread, ioa_cfg);
+	init_waitqueue_head(&ioa_cfg->reset_wait_q);
+	ioa_cfg->sdt_state = INACTIVE;
+
+	ipr_initialize_bus_attr(ioa_cfg);
+
+	host->max_id = IPR_MAX_NUM_TARGETS_PER_BUS;
+	host->max_lun = IPR_MAX_NUM_LUNS_PER_TARGET;
+	host->max_channel = IPR_MAX_BUS_TO_SCAN;
+	host->unique_id = host->host_no;
+	host->max_cmd_len = IPR_MAX_CDB_LEN;
+	pci_set_drvdata(pdev, ioa_cfg);
+
+	memcpy(&ioa_cfg->regs, &ioa_cfg->chip_cfg->regs, sizeof(ioa_cfg->regs));
+
+	ioa_cfg->regs.set_interrupt_mask_reg += ioa_cfg->hdw_dma_regs;
+	ioa_cfg->regs.clr_interrupt_mask_reg += ioa_cfg->hdw_dma_regs;
+	ioa_cfg->regs.sense_interrupt_mask_reg += ioa_cfg->hdw_dma_regs;
+	ioa_cfg->regs.clr_interrupt_reg += ioa_cfg->hdw_dma_regs;
+	ioa_cfg->regs.sense_interrupt_reg += ioa_cfg->hdw_dma_regs;
+	ioa_cfg->regs.ioarrin_reg += ioa_cfg->hdw_dma_regs;
+	ioa_cfg->regs.sense_uproc_interrupt_reg += ioa_cfg->hdw_dma_regs;
+	ioa_cfg->regs.set_uproc_interrupt_reg += ioa_cfg->hdw_dma_regs;
+	ioa_cfg->regs.clr_uproc_interrupt_reg += ioa_cfg->hdw_dma_regs;
+}
+
+/**
+ * ipr_probe_ioa - Allocates memory and does first stage of initialization
+ * @pdev:		PCI device struct
+ * @dev_id:		PCI device id struct
+ *
+ * Return value:
+ * 	0 on success / non-zero on failure
+ **/
+static int __devinit ipr_probe_ioa(struct pci_dev *pdev,
+				   const struct pci_device_id *dev_id)
+{
+	struct ipr_ioa_cfg *ioa_cfg;
+	struct Scsi_Host *host;
+	unsigned long ipr_regs, ipr_regs_pci;
+	u32 rc = PCIBIOS_SUCCESSFUL;
+
+	ENTER;
+
+	if ((rc = pci_enable_device(pdev))) {
+		dev_err(&pdev->dev, "Cannot enable adapter\n");
+		return rc;
+	}
+
+	dev_info(&pdev->dev, "Found IOA with IRQ: %d\n", pdev->irq);
+
+	host = scsi_host_alloc(&driver_template, sizeof(*ioa_cfg));
+
+	if (!host) {
+		dev_err(&pdev->dev, "call to scsi_host_alloc failed!\n");
+		return -ENOMEM;
+	}
+
+	ioa_cfg = (struct ipr_ioa_cfg *)host->hostdata;
+	memset(ioa_cfg, 0, sizeof(struct ipr_ioa_cfg));
+
+	ioa_cfg->chip_cfg = (const struct ipr_chip_cfg_t *)dev_id->driver_data;
+
+	ipr_regs_pci = pci_resource_start(pdev, 0);
+
+	if (!request_mem_region(ipr_regs_pci,
+				pci_resource_len(pdev, 0), IPR_NAME)) {
+		dev_err(&pdev->dev,
+			"Couldn't register memory range of registers\n");
+		scsi_host_put(host);
+		return -ENOMEM;
+	}
+
+	ipr_regs = (unsigned long)ioremap(ipr_regs_pci,
+					  pci_resource_len(pdev, 0));
+
+	if (!ipr_regs) {
+		dev_err(&pdev->dev,
+			"Couldn't map memory range of registers\n");
+		release_mem_region(ipr_regs_pci, pci_resource_len(pdev, 0));
+		scsi_host_put(host);
+		return -ENOMEM;
+	}
+
+	ioa_cfg->hdw_dma_regs = ipr_regs;
+	ioa_cfg->hdw_dma_regs_pci = ipr_regs_pci;
+	ioa_cfg->ioa_mailbox = ioa_cfg->chip_cfg->mailbox + ipr_regs;
+
+	ipr_init_ioa_cfg(ioa_cfg, host, pdev);
+
+	pci_set_master(pdev);
+	rc = pci_set_dma_mask(pdev, 0xffffffff);
+
+	if (rc != PCIBIOS_SUCCESSFUL) {
+		dev_err(&pdev->dev, "Failed to set PCI DMA mask\n");
+		rc = -EIO;
+		goto cleanup_nomem;
+	}
+
+	rc = pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE,
+				   ioa_cfg->chip_cfg->cache_line_size);
+
+	if (rc != PCIBIOS_SUCCESSFUL) {
+		dev_err(&pdev->dev, "Write of cache line size failed\n");
+		rc = -EIO;
+		goto cleanup_nomem;
+	}
+
+	/* Save away PCI config space for use following IOA reset */
+	rc = pci_save_state(pdev, ioa_cfg->pci_cfg_buf);
+
+	if (rc != PCIBIOS_SUCCESSFUL) {
+		dev_err(&pdev->dev, "Failed to save PCI config space\n");
+		rc = -EIO;
+		goto cleanup_nomem;
+	}
+
+	if ((rc = ipr_save_pcix_cmd_reg(ioa_cfg)))
+		goto cleanup_nomem;
+
+	if ((rc = ipr_set_pcix_cmd_reg(ioa_cfg)))
+		goto cleanup_nomem;
+
+	if ((rc = ipr_alloc_mem(ioa_cfg)))
+		goto cleanup;
+
+	ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER);
+	rc = request_irq(pdev->irq, ipr_isr, SA_SHIRQ, IPR_NAME, ioa_cfg);
+
+	if (rc) {
+		dev_err(&pdev->dev, "Couldn't register IRQ %d! rc=%d\n",
+			pdev->irq, rc);
+		goto cleanup_nolog;
+	}
+
+	spin_lock(&ipr_driver_lock);
+	list_add_tail(&ioa_cfg->queue, &ipr_ioa_head);
+	spin_unlock(&ipr_driver_lock);
+
+	LEAVE;
+	return 0;
+
+cleanup:
+	dev_err(&pdev->dev, "Couldn't allocate enough memory for device driver!\n");
+cleanup_nolog:
+	ipr_free_mem(ioa_cfg);
+cleanup_nomem:
+	iounmap((void *) ipr_regs);
+	release_mem_region(ipr_regs_pci, pci_resource_len(pdev, 0));
+	scsi_host_put(host);
+
+	return rc;
+}
+
+/**
+ * ipr_scan_vsets - Scans for VSET devices
+ * @ioa_cfg:	ioa config struct
+ *
+ * Description: Since the VSET resources do not follow SAM in that we can have
+ * sparse LUNs with no LUN 0, we have to scan for these ourselves.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_scan_vsets(struct ipr_ioa_cfg *ioa_cfg)
+{
+	int target, lun;
+
+	for (target = 0; target < IPR_MAX_NUM_TARGETS_PER_BUS; target++)
+		for (lun = 0; lun < IPR_MAX_NUM_VSET_LUNS_PER_TARGET; lun++ )
+			scsi_add_device(ioa_cfg->host, IPR_VSET_BUS, target, lun);
+}
+
+/**
+ * ipr_initiate_ioa_bringdown - Bring down an adapter
+ * @ioa_cfg:		ioa config struct
+ * @shutdown_type:	shutdown type
+ *
+ * Description: This function will initiate bringing down the adapter.
+ * This consists of issuing an IOA shutdown to the adapter
+ * to flush the cache, and running BIST.
+ * If the caller needs to wait on the completion of the reset,
+ * the caller must sleep on the reset_wait_q.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_initiate_ioa_bringdown(struct ipr_ioa_cfg *ioa_cfg,
+				       enum ipr_shutdown_type shutdown_type)
+{
+	ENTER;
+	if (ioa_cfg->sdt_state == WAIT_FOR_DUMP)
+		ioa_cfg->sdt_state = ABORT_DUMP;
+	ioa_cfg->reset_retries = 0;
+	ioa_cfg->in_ioa_bringdown = 1;
+	ipr_initiate_ioa_reset(ioa_cfg, shutdown_type);
+	LEAVE;
+}
+
+/**
+ * __ipr_remove - Remove a single adapter
+ * @pdev:	pci device struct
+ *
+ * Adapter hot plug remove entry point.
+ *
+ * Return value:
+ * 	none
+ **/
+static void __ipr_remove(struct pci_dev *pdev)
+{
+	unsigned long host_lock_flags = 0;
+	struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev);
+	ENTER;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags);
+	ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL);
+
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
+	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+	spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags);
+
+	spin_lock(&ipr_driver_lock);
+	list_del(&ioa_cfg->queue);
+	spin_unlock(&ipr_driver_lock);
+
+	if (ioa_cfg->sdt_state == ABORT_DUMP)
+		ioa_cfg->sdt_state = WAIT_FOR_DUMP;
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
+
+	ipr_free_all_resources(ioa_cfg);
+
+	LEAVE;
+}
+
+/**
+ * ipr_remove - IOA hot plug remove entry point
+ * @pdev:	pci device struct
+ *
+ * Adapter hot plug remove entry point.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_remove(struct pci_dev *pdev)
+{
+	struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev);
+
+	ENTER;
+
+	ioa_cfg->allow_cmds = 0;
+	flush_scheduled_work();
+	ipr_remove_trace_file(&ioa_cfg->host->shost_classdev.kobj,
+			      &ipr_trace_attr);
+	ipr_remove_dump_file(&ioa_cfg->host->shost_classdev.kobj,
+			     &ipr_dump_attr);
+	scsi_remove_host(ioa_cfg->host);
+
+	__ipr_remove(pdev);
+
+	LEAVE;
+}
+
+/**
+ * ipr_probe - Adapter hot plug add entry point
+ *
+ * Return value:
+ * 	0 on success / non-zero on failure
+ **/
+static int __devinit ipr_probe(struct pci_dev *pdev,
+			       const struct pci_device_id *dev_id)
+{
+	struct ipr_ioa_cfg *ioa_cfg;
+	int rc;
+
+	rc = ipr_probe_ioa(pdev, dev_id);
+
+	if (rc)
+		return rc;
+
+	ioa_cfg = pci_get_drvdata(pdev);
+	rc = ipr_probe_ioa_part2(ioa_cfg);
+
+	if (rc) {
+		__ipr_remove(pdev);
+		return rc;
+	}
+
+	rc = scsi_add_host(ioa_cfg->host, &pdev->dev);
+
+	if (rc) {
+		__ipr_remove(pdev);
+		return rc;
+	}
+
+	rc = ipr_create_trace_file(&ioa_cfg->host->shost_classdev.kobj,
+				   &ipr_trace_attr);
+
+	if (rc) {
+		scsi_remove_host(ioa_cfg->host);
+		__ipr_remove(pdev);
+		return rc;
+	}
+
+	rc = ipr_create_dump_file(&ioa_cfg->host->shost_classdev.kobj,
+				   &ipr_dump_attr);
+
+	if (rc) {
+		ipr_remove_trace_file(&ioa_cfg->host->shost_classdev.kobj,
+				      &ipr_trace_attr);
+		scsi_remove_host(ioa_cfg->host);
+		__ipr_remove(pdev);
+		return rc;
+	}
+
+	scsi_scan_host(ioa_cfg->host);
+	ipr_scan_vsets(ioa_cfg);
+	scsi_add_device(ioa_cfg->host, IPR_IOA_BUS, IPR_IOA_TARGET, IPR_IOA_LUN);
+	ioa_cfg->allow_ml_add_del = 1;
+	schedule_work(&ioa_cfg->work_q);
+	return 0;
+}
+
+/**
+ * ipr_shutdown - Shutdown handler.
+ * @dev:	device struct
+ *
+ * This function is invoked upon system shutdown/reboot. It will issue
+ * an adapter shutdown to the adapter to flush the write cache.
+ *
+ * Return value:
+ * 	none
+ **/
+static void ipr_shutdown(struct device *dev)
+{
+	struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(to_pci_dev(dev));
+	unsigned long lock_flags = 0;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+	ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL);
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+}
+
+static struct pci_device_id ipr_pci_table[] __devinitdata = {
+	{ PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
+		PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5702,
+		0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+	{ PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
+		PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_572E,
+		0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+	{ PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
+		PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5703,
+	      0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+	{ PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
+		PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_573D,
+	      0, 0, (kernel_ulong_t)&ipr_chip_cfg[0] },
+	{ PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_SNIPE,
+		PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2780,
+		0, 0, (kernel_ulong_t)&ipr_chip_cfg[1] },
+	{ }
+};
+MODULE_DEVICE_TABLE(pci, ipr_pci_table);
+
+static struct pci_driver ipr_driver = {
+	.name = IPR_NAME,
+	.id_table = ipr_pci_table,
+	.probe = ipr_probe,
+	.remove = ipr_remove,
+	.driver = {
+		.shutdown = ipr_shutdown,
+	},
+};
+
+/**
+ * ipr_init - Module entry point
+ *
+ * Return value:
+ * 	0 on success / non-zero on failure
+ **/
+static int __init ipr_init(void)
+{
+	ipr_info("IBM Power RAID SCSI Device Driver version: %s %s\n",
+		 IPR_DRIVER_VERSION, IPR_DRIVER_DATE);
+
+	pci_register_driver(&ipr_driver);
+
+	return 0;
+}
+
+/**
+ * ipr_exit - Module unload
+ *
+ * Module unload entry point.
+ *
+ * Return value:
+ * 	none
+ **/
+static void __exit ipr_exit(void)
+{
+	pci_unregister_driver(&ipr_driver);
+}
+
+module_init(ipr_init);
+module_exit(ipr_exit);
diff -Nru a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/ipr.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1252 @@
+/*
+ * ipr.h -- driver for IBM Power Linux RAID adapters
+ *
+ * Written By: Brian King, IBM Corporation
+ *
+ * Copyright (C) 2003, 2004 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 _IPR_H
+#define _IPR_H
+
+#include <linux/types.h>
+#include <linux/completion.h>
+#include <linux/list.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#ifdef CONFIG_KDB
+#include <linux/kdb.h>
+#endif
+
+/*
+ * Literals
+ */
+#define IPR_DRIVER_VERSION "2.0.7"
+#define IPR_DRIVER_DATE "(May 21, 2004)"
+
+/*
+ * IPR_DBG_TRACE: Setting this to 1 will turn on some general function tracing
+ *			resulting in a bunch of extra debugging printks to the console
+ *
+ * IPR_DEBUG:	Setting this to 1 will turn on some error path tracing.
+ *			Enables the ipr_trace macro.
+ */
+#ifdef IPR_DEBUG_ALL
+#define IPR_DEBUG				1
+#define IPR_DBG_TRACE			1
+#else
+#define IPR_DEBUG				0
+#define IPR_DBG_TRACE			0
+#endif
+
+/*
+ * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
+ *	ops per device for devices not running tagged command queuing.
+ *	This can be adjusted at runtime through sysfs device attributes.
+ */
+#define IPR_MAX_CMD_PER_LUN				6
+
+/*
+ * IPR_NUM_BASE_CMD_BLKS: This defines the maximum number of
+ *	ops the mid-layer can send to the adapter.
+ */
+#define IPR_NUM_BASE_CMD_BLKS				100
+
+#define IPR_SUBS_DEV_ID_2780	0x0264
+#define IPR_SUBS_DEV_ID_5702	0x0266
+#define IPR_SUBS_DEV_ID_5703	0x0278
+#define IPR_SUBS_DEV_ID_572E  0x02D3
+#define IPR_SUBS_DEV_ID_573D  0x02D4
+
+#define IPR_NAME				"ipr"
+
+/*
+ * Return codes
+ */
+#define IPR_RC_JOB_CONTINUE		1
+#define IPR_RC_JOB_RETURN		2
+
+/*
+ * IOASCs
+ */
+#define IPR_IOASC_NR_INIT_CMD_REQUIRED		0x02040200
+#define IPR_IOASC_SYNC_REQUIRED			0x023f0000
+#define IPR_IOASC_MED_DO_NOT_REALLOC		0x03110C00
+#define IPR_IOASC_HW_SEL_TIMEOUT			0x04050000
+#define IPR_IOASC_HW_DEV_BUS_STATUS			0x04448500
+#define	IPR_IOASC_IOASC_MASK			0xFFFFFF00
+#define	IPR_IOASC_SCSI_STATUS_MASK		0x000000FF
+#define IPR_IOASC_IR_RESOURCE_HANDLE		0x05250000
+#define IPR_IOASC_BUS_WAS_RESET			0x06290000
+#define IPR_IOASC_BUS_WAS_RESET_BY_OTHER		0x06298000
+#define IPR_IOASC_ABORTED_CMD_TERM_BY_HOST	0x0B5A0000
+
+#define IPR_FIRST_DRIVER_IOASC			0x10000000
+#define IPR_IOASC_IOA_WAS_RESET			0x10000001
+#define IPR_IOASC_PCI_ACCESS_ERROR			0x10000002
+
+#define IPR_NUM_LOG_HCAMS				2
+#define IPR_NUM_CFG_CHG_HCAMS				2
+#define IPR_NUM_HCAMS	(IPR_NUM_LOG_HCAMS + IPR_NUM_CFG_CHG_HCAMS)
+#define IPR_MAX_NUM_TARGETS_PER_BUS			0x10
+#define IPR_MAX_NUM_LUNS_PER_TARGET			256
+#define IPR_MAX_NUM_VSET_LUNS_PER_TARGET	8
+#define IPR_VSET_BUS					0xff
+#define IPR_IOA_BUS						0xff
+#define IPR_IOA_TARGET					0xff
+#define IPR_IOA_LUN						0xff
+#define IPR_MAX_NUM_BUSES				4
+#define IPR_MAX_BUS_TO_SCAN				IPR_MAX_NUM_BUSES
+
+#define IPR_NUM_RESET_RELOAD_RETRIES		3
+
+/* We need resources for HCAMS, IOA reset, IOA bringdown, and ERP */
+#define IPR_NUM_INTERNAL_CMD_BLKS	(IPR_NUM_HCAMS + \
+                                     ((IPR_NUM_RESET_RELOAD_RETRIES + 1) * 2) + 3)
+
+#define IPR_MAX_COMMANDS		IPR_NUM_BASE_CMD_BLKS
+#define IPR_NUM_CMD_BLKS		(IPR_NUM_BASE_CMD_BLKS + \
+						IPR_NUM_INTERNAL_CMD_BLKS)
+
+#define IPR_MAX_PHYSICAL_DEVS				192
+
+#define IPR_MAX_SGLIST					64
+#define IPR_MAX_SECTORS					512
+#define IPR_MAX_CDB_LEN					16
+
+#define IPR_DEFAULT_BUS_WIDTH				16
+#define IPR_80MBs_SCSI_RATE		((80 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))
+#define IPR_U160_SCSI_RATE	((160 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))
+#define IPR_U320_SCSI_RATE	((320 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))
+#define IPR_MAX_SCSI_RATE(width) ((320 * 10) / ((width) / 8))
+
+#define IPR_IOA_RES_HANDLE				0xffffffff
+#define IPR_IOA_RES_ADDR				0x00ffffff
+
+/*
+ * Adapter Commands
+ */
+#define IPR_RESET_DEVICE				0xC3
+#define	IPR_RESET_TYPE_SELECT				0x80
+#define	IPR_LUN_RESET					0x40
+#define	IPR_TARGET_RESET					0x20
+#define	IPR_BUS_RESET					0x10
+#define IPR_ID_HOST_RR_Q				0xC4
+#define IPR_QUERY_IOA_CONFIG				0xC5
+#define IPR_ABORT_TASK					0xC7
+#define IPR_CANCEL_ALL_REQUESTS			0xCE
+#define IPR_HOST_CONTROLLED_ASYNC			0xCF
+#define	IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE	0x01
+#define	IPR_HCAM_CDB_OP_CODE_LOG_DATA		0x02
+#define IPR_SET_SUPPORTED_DEVICES			0xFB
+#define IPR_IOA_SHUTDOWN				0xF7
+#define	IPR_WR_BUF_DOWNLOAD_AND_SAVE			0x05
+
+/*
+ * Timeouts
+ */
+#define IPR_SHUTDOWN_TIMEOUT			(10 * 60 * HZ)
+#define IPR_VSET_RW_TIMEOUT			(2 * 60 * HZ)
+#define IPR_ABBREV_SHUTDOWN_TIMEOUT		(10 * HZ)
+#define IPR_DEVICE_RESET_TIMEOUT		(30 * HZ)
+#define IPR_CANCEL_ALL_TIMEOUT		(30 * HZ)
+#define IPR_ABORT_TASK_TIMEOUT		(30 * HZ)
+#define IPR_INTERNAL_TIMEOUT			(30 * HZ)
+#define IPR_WRITE_BUFFER_TIMEOUT		(10 * 60 * HZ)
+#define IPR_SET_SUP_DEVICE_TIMEOUT		(2 * 60 * HZ)
+#define IPR_REQUEST_SENSE_TIMEOUT		(10 * HZ)
+#define IPR_OPERATIONAL_TIMEOUT		(5 * 60 * HZ)
+#define IPR_WAIT_FOR_RESET_TIMEOUT		(2 * HZ)
+#define IPR_CHECK_FOR_RESET_TIMEOUT		(HZ / 10)
+#define IPR_WAIT_FOR_BIST_TIMEOUT		(2 * HZ)
+#define IPR_DUMP_TIMEOUT			(15 * HZ)
+
+/*
+ * SCSI Literals
+ */
+#define IPR_VENDOR_ID_LEN			8
+#define IPR_PROD_ID_LEN				16
+#define IPR_SERIAL_NUM_LEN			8
+
+/*
+ * Hardware literals
+ */
+#define IPR_FMT2_MBX_ADDR_MASK				0x0fffffff
+#define IPR_FMT2_MBX_BAR_SEL_MASK			0xf0000000
+#define IPR_FMT2_MKR_BAR_SEL_SHIFT			28
+#define IPR_GET_FMT2_BAR_SEL(mbx) \
+(((mbx) & IPR_FMT2_MBX_BAR_SEL_MASK) >> IPR_FMT2_MKR_BAR_SEL_SHIFT)
+#define IPR_SDT_FMT2_BAR0_SEL				0x0
+#define IPR_SDT_FMT2_BAR1_SEL				0x1
+#define IPR_SDT_FMT2_BAR2_SEL				0x2
+#define IPR_SDT_FMT2_BAR3_SEL				0x3
+#define IPR_SDT_FMT2_BAR4_SEL				0x4
+#define IPR_SDT_FMT2_BAR5_SEL				0x5
+#define IPR_SDT_FMT2_EXP_ROM_SEL			0x8
+#define IPR_FMT2_SDT_READY_TO_USE			0xC4D4E3F2
+#define IPR_DOORBELL					0x82800000
+
+#define IPR_PCII_IOA_TRANS_TO_OPER			(0x80000000 >> 0)
+#define IPR_PCII_IOARCB_XFER_FAILED			(0x80000000 >> 3)
+#define IPR_PCII_IOA_UNIT_CHECKED			(0x80000000 >> 4)
+#define IPR_PCII_NO_HOST_RRQ				(0x80000000 >> 5)
+#define IPR_PCII_CRITICAL_OPERATION			(0x80000000 >> 6)
+#define IPR_PCII_IO_DEBUG_ACKNOWLEDGE		(0x80000000 >> 7)
+#define IPR_PCII_IOARRIN_LOST				(0x80000000 >> 27)
+#define IPR_PCII_MMIO_ERROR				(0x80000000 >> 28)
+#define IPR_PCII_PROC_ERR_STATE			(0x80000000 >> 29)
+#define IPR_PCII_HRRQ_UPDATED				(0x80000000 >> 30)
+#define IPR_PCII_CORE_ISSUED_RST_REQ		(0x80000000 >> 31)
+
+#define IPR_PCII_ERROR_INTERRUPTS \
+(IPR_PCII_IOARCB_XFER_FAILED | IPR_PCII_IOA_UNIT_CHECKED | \
+IPR_PCII_NO_HOST_RRQ | IPR_PCII_IOARRIN_LOST | IPR_PCII_MMIO_ERROR)
+
+#define IPR_PCII_OPER_INTERRUPTS \
+(IPR_PCII_ERROR_INTERRUPTS | IPR_PCII_HRRQ_UPDATED | IPR_PCII_IOA_TRANS_TO_OPER)
+
+#define IPR_UPROCI_RESET_ALERT			(0x80000000 >> 7)
+#define IPR_UPROCI_IO_DEBUG_ALERT			(0x80000000 >> 9)
+
+#define IPR_LDUMP_MAX_LONG_ACK_DELAY_IN_USEC		200000	/* 200 ms */
+#define IPR_LDUMP_MAX_SHORT_ACK_DELAY_IN_USEC		200000	/* 200 ms */
+
+/*
+ * Dump literals
+ */
+#define IPR_MAX_IOA_DUMP_SIZE				(4 * 1024 * 1024)
+#define IPR_NUM_SDT_ENTRIES				511
+#define IPR_MAX_NUM_DUMP_PAGES	((IPR_MAX_IOA_DUMP_SIZE / PAGE_SIZE) + 1)
+
+/*
+ * Misc literals
+ */
+#define IPR_NUM_IOADL_ENTRIES			IPR_MAX_SGLIST
+
+/*
+ * Adapter interface types
+ */
+
+struct ipr_res_addr {
+	u8 reserved;
+	u8 bus;
+	u8 target;
+	u8 lun;
+#define IPR_GET_PHYS_LOC(res_addr) \
+	(((res_addr).bus << 16) | ((res_addr).target << 8) | (res_addr).lun)
+}__attribute__((packed, aligned (4)));
+
+struct ipr_std_inq_vpids {
+	u8 vendor_id[IPR_VENDOR_ID_LEN];
+	u8 product_id[IPR_PROD_ID_LEN];
+}__attribute__((packed));
+
+struct ipr_std_inq_data {
+	u8 peri_qual_dev_type;
+#define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5)
+#define IPR_STD_INQ_PERI_DEV_TYPE(peri) ((peri) & 0x1F)
+
+	u8 removeable_medium_rsvd;
+#define IPR_STD_INQ_REMOVEABLE_MEDIUM 0x80
+
+#define IPR_IS_DASD_DEVICE(std_inq) \
+((IPR_STD_INQ_PERI_DEV_TYPE((std_inq).peri_qual_dev_type) == TYPE_DISK) && \
+!(((std_inq).removeable_medium_rsvd) & IPR_STD_INQ_REMOVEABLE_MEDIUM))
+
+#define IPR_IS_SES_DEVICE(std_inq) \
+(IPR_STD_INQ_PERI_DEV_TYPE((std_inq).peri_qual_dev_type) == TYPE_ENCLOSURE)
+
+	u8 version;
+	u8 aen_naca_fmt;
+	u8 additional_len;
+	u8 sccs_rsvd;
+	u8 bq_enc_multi;
+	u8 sync_cmdq_flags;
+
+	struct ipr_std_inq_vpids vpids;
+
+	u8 ros_rsvd_ram_rsvd[4];
+
+	u8 serial_num[IPR_SERIAL_NUM_LEN];
+}__attribute__ ((packed));
+
+struct ipr_config_table_entry {
+	u8 service_level;
+	u8 array_id;
+	u8 flags;
+#define IPR_IS_IOA_RESOURCE	0x80
+#define IPR_IS_ARRAY_MEMBER 0x20
+#define IPR_IS_HOT_SPARE	0x10
+
+	u8 rsvd_subtype;
+#define IPR_RES_SUBTYPE(res) (((res)->cfgte.rsvd_subtype) & 0x0f)
+#define IPR_SUBTYPE_AF_DASD			0
+#define IPR_SUBTYPE_GENERIC_SCSI	1
+#define IPR_SUBTYPE_VOLUME_SET		2
+
+	struct ipr_res_addr res_addr;
+	u32 res_handle;
+	u32 reserved4[2];
+	struct ipr_std_inq_data std_inq_data;
+}__attribute__ ((packed, aligned (4)));
+
+struct ipr_config_table_hdr {
+	u8 num_entries;
+	u8 flags;
+#define IPR_UCODE_DOWNLOAD_REQ	0x10
+	u16 reserved;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_config_table {
+	struct ipr_config_table_hdr hdr;
+	struct ipr_config_table_entry dev[IPR_MAX_PHYSICAL_DEVS];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_cfg_ch_not {
+	struct ipr_config_table_entry cfgte;
+	u8 reserved[936];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_supported_device {
+	u16 data_length;
+	u8 reserved;
+	u8 num_records;
+	struct ipr_std_inq_vpids vpids;
+	u8 reserved2[16];
+}__attribute__((packed, aligned (4)));
+
+/* Command packet structure */
+struct ipr_cmd_pkt {
+	u16 reserved;		/* Reserved by IOA */
+	u8 request_type;
+#define IPR_RQTYPE_SCSICDB		0x00
+#define IPR_RQTYPE_IOACMD		0x01
+#define IPR_RQTYPE_HCAM			0x02
+
+	u8 luntar_luntrn;
+
+	u8 flags_hi;
+#define IPR_FLAGS_HI_WRITE_NOT_READ		0x80
+#define IPR_FLAGS_HI_NO_ULEN_CHK		0x20
+#define IPR_FLAGS_HI_SYNC_OVERRIDE		0x10
+#define IPR_FLAGS_HI_SYNC_COMPLETE		0x08
+#define IPR_FLAGS_HI_NO_LINK_DESC		0x04
+
+	u8 flags_lo;
+#define IPR_FLAGS_LO_ALIGNED_BFR		0x20
+#define IPR_FLAGS_LO_DELAY_AFTER_RST	0x10
+#define IPR_FLAGS_LO_UNTAGGED_TASK		0x00
+#define IPR_FLAGS_LO_SIMPLE_TASK		0x02
+#define IPR_FLAGS_LO_ORDERED_TASK		0x04
+#define IPR_FLAGS_LO_HEAD_OF_Q_TASK		0x06
+#define IPR_FLAGS_LO_ACA_TASK			0x08
+
+	u8 cdb[16];
+	u16 timeout;
+}__attribute__ ((packed, aligned(4)));
+
+/* IOA Request Control Block    128 bytes  */
+struct ipr_ioarcb {
+	u32 ioarcb_host_pci_addr;
+	u32 reserved;
+	u32 res_handle;
+	u32 host_response_handle;
+	u32 reserved1;
+	u32 reserved2;
+	u32 reserved3;
+
+	u32 write_data_transfer_length;
+	u32 read_data_transfer_length;
+	u32 write_ioadl_addr;
+	u32 write_ioadl_len;
+	u32 read_ioadl_addr;
+	u32 read_ioadl_len;
+
+	u32 ioasa_host_pci_addr;
+	u16 ioasa_len;
+	u16 reserved4;
+
+	struct ipr_cmd_pkt cmd_pkt;
+
+	u32 add_cmd_parms_len;
+	u32 add_cmd_parms[10];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_ioadl_desc {
+	u32 flags_and_data_len;
+#define IPR_IOADL_FLAGS_MASK		0xff000000
+#define IPR_IOADL_GET_FLAGS(x) (be32_to_cpu(x) & IPR_IOADL_FLAGS_MASK)
+#define IPR_IOADL_DATA_LEN_MASK		0x00ffffff
+#define IPR_IOADL_GET_DATA_LEN(x) (be32_to_cpu(x) & IPR_IOADL_DATA_LEN_MASK)
+#define IPR_IOADL_FLAGS_READ		0x48000000
+#define IPR_IOADL_FLAGS_READ_LAST	0x49000000
+#define IPR_IOADL_FLAGS_WRITE		0x68000000
+#define IPR_IOADL_FLAGS_WRITE_LAST	0x69000000
+#define IPR_IOADL_FLAGS_LAST		0x01000000
+
+	u32 address;
+}__attribute__((packed, aligned (8)));
+
+struct ipr_ioasa_vset {
+	u32 failing_lba_hi;
+	u32 failing_lba_lo;
+	u32 ioa_data[22];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_ioasa_af_dasd {
+	u32 failing_lba;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_ioasa_gpdd {
+	u8 end_state;
+	u8 bus_phase;
+	u16 reserved;
+	u32 ioa_data[23];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_ioasa_raw {
+	u32 ioa_data[24];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_ioasa {
+	u32 ioasc;
+#define IPR_IOASC_SENSE_KEY(ioasc) ((ioasc) >> 24)
+#define IPR_IOASC_SENSE_CODE(ioasc) (((ioasc) & 0x00ff0000) >> 16)
+#define IPR_IOASC_SENSE_QUAL(ioasc) (((ioasc) & 0x0000ff00) >> 8)
+#define IPR_IOASC_SENSE_STATUS(ioasc) ((ioasc) & 0x000000ff)
+
+	u16 ret_stat_len;	/* Length of the returned IOASA */
+
+	u16 avail_stat_len;	/* Total Length of status available. */
+
+	u32 residual_data_len;	/* number of bytes in the host data */
+	/* buffers that were not used by the IOARCB command. */
+
+	u32 ilid;
+#define IPR_NO_ILID			0
+#define IPR_DRIVER_ILID		0xffffffff
+
+	u32 fd_ioasc;
+
+	u32 fd_phys_locator;
+
+	u32 fd_res_handle;
+
+	u32 ioasc_specific;	/* status code specific field */
+#define IPR_IOASC_SPECIFIC_MASK		0x00ffffff
+#define IPR_FIELD_POINTER_VALID		(0x80000000 >> 8)
+#define IPR_FIELD_POINTER_MASK		0x0000ffff
+
+	union {
+		struct ipr_ioasa_vset vset;
+		struct ipr_ioasa_af_dasd dasd;
+		struct ipr_ioasa_gpdd gpdd;
+		struct ipr_ioasa_raw raw;
+	} u;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_mode_parm_hdr {
+	u8 length;
+	u8 medium_type;
+	u8 device_spec_parms;
+	u8 block_desc_len;
+}__attribute__((packed));
+
+struct ipr_mode_pages {
+	struct ipr_mode_parm_hdr hdr;
+	u8 data[255 - sizeof(struct ipr_mode_parm_hdr)];
+}__attribute__((packed));
+
+struct ipr_mode_page_hdr {
+	u8 ps_page_code;
+#define IPR_MODE_PAGE_PS	0x80
+#define IPR_GET_MODE_PAGE_CODE(hdr) ((hdr)->ps_page_code & 0x3F)
+	u8 page_length;
+}__attribute__ ((packed));
+
+struct ipr_dev_bus_entry {
+	struct ipr_res_addr res_addr;
+	u8 flags;
+#define IPR_SCSI_ATTR_ENABLE_QAS			0x80
+#define IPR_SCSI_ATTR_DISABLE_QAS			0x40
+#define IPR_SCSI_ATTR_QAS_MASK				0xC0
+#define IPR_SCSI_ATTR_ENABLE_TM				0x20
+#define IPR_SCSI_ATTR_NO_TERM_PWR			0x10
+#define IPR_SCSI_ATTR_TM_SUPPORTED			0x08
+#define IPR_SCSI_ATTR_LVD_TO_SE_NOT_ALLOWED	0x04
+
+	u8 scsi_id;
+	u8 bus_width;
+	u8 extended_reset_delay;
+#define IPR_EXTENDED_RESET_DELAY	7
+
+	u32 max_xfer_rate;
+
+	u8 spinup_delay;
+	u8 reserved3;
+	u16 reserved4;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_mode_page28 {
+	struct ipr_mode_page_hdr hdr;
+	u8 num_entries;
+	u8 entry_length;
+	struct ipr_dev_bus_entry bus[0];
+}__attribute__((packed));
+
+struct ipr_ioa_vpd {
+	struct ipr_std_inq_data std_inq_data;
+	u8 ascii_part_num[12];
+	u8 reserved[40];
+	u8 ascii_plant_code[4];
+}__attribute__((packed));
+
+struct ipr_inquiry_page3 {
+	u8 peri_qual_dev_type;
+	u8 page_code;
+	u8 reserved1;
+	u8 page_length;
+	u8 ascii_len;
+	u8 reserved2[3];
+	u8 load_id[4];
+	u8 major_release;
+	u8 card_type;
+	u8 minor_release[2];
+	u8 ptf_number[4];
+	u8 patch_number[4];
+}__attribute__((packed));
+
+struct ipr_hostrcb_device_data_entry {
+	struct ipr_std_inq_vpids dev_vpids;
+	u8 dev_sn[IPR_SERIAL_NUM_LEN];
+	struct ipr_res_addr dev_res_addr;
+	struct ipr_std_inq_vpids new_dev_vpids;
+	u8 new_dev_sn[IPR_SERIAL_NUM_LEN];
+	struct ipr_std_inq_vpids ioa_last_with_dev_vpids;
+	u8 ioa_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
+	struct ipr_std_inq_vpids cfc_last_with_dev_vpids;
+	u8 cfc_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
+	u32 ioa_data[5];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_array_data_entry {
+	struct ipr_std_inq_vpids vpids;
+	u8 serial_num[IPR_SERIAL_NUM_LEN];
+	struct ipr_res_addr expected_dev_res_addr;
+	struct ipr_res_addr dev_res_addr;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_ff_error {
+	u32 ioa_data[246];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_01_error {
+	u32 seek_counter;
+	u32 read_counter;
+	u8 sense_data[32];
+	u32 ioa_data[236];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_02_error {
+	struct ipr_std_inq_vpids ioa_vpids;
+	u8 ioa_sn[IPR_SERIAL_NUM_LEN];
+	struct ipr_std_inq_vpids cfc_vpids;
+	u8 cfc_sn[IPR_SERIAL_NUM_LEN];
+	struct ipr_std_inq_vpids ioa_last_attached_to_cfc_vpids;
+	u8 ioa_last_attached_to_cfc_sn[IPR_SERIAL_NUM_LEN];
+	struct ipr_std_inq_vpids cfc_last_attached_to_ioa_vpids;
+	u8 cfc_last_attached_to_ioa_sn[IPR_SERIAL_NUM_LEN];
+	u32 ioa_data[3];
+	u8 reserved[844];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_03_error {
+	struct ipr_std_inq_vpids ioa_vpids;
+	u8 ioa_sn[IPR_SERIAL_NUM_LEN];
+	struct ipr_std_inq_vpids cfc_vpids;
+	u8 cfc_sn[IPR_SERIAL_NUM_LEN];
+	u32 errors_detected;
+	u32 errors_logged;
+	u8 ioa_data[12];
+	struct ipr_hostrcb_device_data_entry dev_entry[3];
+	u8 reserved[444];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_04_error {
+	struct ipr_std_inq_vpids ioa_vpids;
+	u8 ioa_sn[IPR_SERIAL_NUM_LEN];
+	struct ipr_std_inq_vpids cfc_vpids;
+	u8 cfc_sn[IPR_SERIAL_NUM_LEN];
+	u8 ioa_data[12];
+	struct ipr_hostrcb_array_data_entry array_member[10];
+	u32 exposed_mode_adn;
+	u32 array_id;
+	struct ipr_std_inq_vpids incomp_dev_vpids;
+	u8 incomp_dev_sn[IPR_SERIAL_NUM_LEN];
+	u32 ioa_data2;
+	struct ipr_hostrcb_array_data_entry array_member2[8];
+	struct ipr_res_addr last_func_vset_res_addr;
+	u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
+	u8 protection_level[8];
+	u8 reserved[124];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_error {
+	u32 failing_dev_ioasc;
+	struct ipr_res_addr failing_dev_res_addr;
+	u32 failing_dev_res_handle;
+	u32 prc;
+	union {
+		struct ipr_hostrcb_type_ff_error type_ff_error;
+		struct ipr_hostrcb_type_01_error type_01_error;
+		struct ipr_hostrcb_type_02_error type_02_error;
+		struct ipr_hostrcb_type_03_error type_03_error;
+		struct ipr_hostrcb_type_04_error type_04_error;
+	} u;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_raw {
+	u32 data[sizeof(struct ipr_hostrcb_error)/sizeof(u32)];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hcam {
+	u8 op_code;
+#define IPR_HOST_RCB_OP_CODE_CONFIG_CHANGE			0xE1
+#define IPR_HOST_RCB_OP_CODE_LOG_DATA				0xE2
+
+	u8 notify_type;
+#define IPR_HOST_RCB_NOTIF_TYPE_EXISTING_CHANGED	0x00
+#define IPR_HOST_RCB_NOTIF_TYPE_NEW_ENTRY			0x01
+#define IPR_HOST_RCB_NOTIF_TYPE_REM_ENTRY			0x02
+#define IPR_HOST_RCB_NOTIF_TYPE_ERROR_LOG_ENTRY		0x10
+#define IPR_HOST_RCB_NOTIF_TYPE_INFORMATION_ENTRY	0x11
+
+	u8 notifications_lost;
+#define IPR_HOST_RCB_NO_NOTIFICATIONS_LOST			0
+#define IPR_HOST_RCB_NOTIFICATIONS_LOST				0x80
+
+	u8 flags;
+#define IPR_HOSTRCB_INTERNAL_OPER	0x80
+#define IPR_HOSTRCB_ERR_RESP_SENT	0x40
+
+	u8 overlay_id;
+#define IPR_HOST_RCB_OVERLAY_ID_1				0x01
+#define IPR_HOST_RCB_OVERLAY_ID_2				0x02
+#define IPR_HOST_RCB_OVERLAY_ID_3				0x03
+#define IPR_HOST_RCB_OVERLAY_ID_4				0x04
+#define IPR_HOST_RCB_OVERLAY_ID_6				0x06
+#define IPR_HOST_RCB_OVERLAY_ID_DEFAULT			0xFF
+
+	u8 reserved1[3];
+	u32 ilid;
+	u32 time_since_last_ioa_reset;
+	u32 reserved2;
+	u32 length;
+
+	union {
+		struct ipr_hostrcb_error error;
+		struct ipr_hostrcb_cfg_ch_not ccn;
+		struct ipr_hostrcb_raw raw;
+	} u;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb {
+	struct ipr_hcam hcam;
+	u32 hostrcb_dma;
+	struct list_head queue;
+};
+
+/* IPR smart dump table structures */
+struct ipr_sdt_entry {
+	u32 bar_str_offset;
+	u32 end_offset;
+	u8 entry_byte;
+	u8 reserved[3];
+
+	u8 flags;
+#define IPR_SDT_ENDIAN		0x80
+#define IPR_SDT_VALID_ENTRY	0x20
+
+	u8 resv;
+	u16 priority;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_sdt_header {
+	u32 state;
+	u32 num_entries;
+	u32 num_entries_used;
+	u32 dump_size;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_sdt {
+	struct ipr_sdt_header hdr;
+	struct ipr_sdt_entry entry[IPR_NUM_SDT_ENTRIES];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_uc_sdt {
+	struct ipr_sdt_header hdr;
+	struct ipr_sdt_entry entry[1];
+}__attribute__((packed, aligned (4)));
+
+/*
+ * Driver types
+ */
+struct ipr_bus_attributes {
+	u8 bus;
+	u8 qas_enabled;
+	u8 bus_width;
+	u8 reserved;
+	u32 max_xfer_rate;
+};
+
+struct ipr_resource_entry {
+	struct ipr_config_table_entry cfgte;
+	u8 needs_sync_complete:1;
+	u8 in_erp:1;
+	u8 add_to_ml:1;
+	u8 del_from_ml:1;
+	u8 resetting_device:1;
+	u8 tcq_active:1;
+
+	int qdepth;
+	struct scsi_device *sdev;
+	struct list_head queue;
+};
+
+struct ipr_resource_hdr {
+	u16 num_entries;
+	u16 reserved;
+};
+
+struct ipr_resource_table {
+	struct ipr_resource_hdr hdr;
+	struct ipr_resource_entry dev[IPR_MAX_PHYSICAL_DEVS];
+};
+
+struct ipr_misc_cbs {
+	struct ipr_ioa_vpd ioa_vpd;
+	struct ipr_inquiry_page3 page3_data;
+	struct ipr_mode_pages mode_pages;
+	struct ipr_supported_device supp_dev;
+};
+
+struct ipr_interrupts {
+	unsigned long set_interrupt_mask_reg;
+	unsigned long clr_interrupt_mask_reg;
+	unsigned long sense_interrupt_mask_reg;
+	unsigned long clr_interrupt_reg;
+
+	unsigned long sense_interrupt_reg;
+	unsigned long ioarrin_reg;
+	unsigned long sense_uproc_interrupt_reg;
+	unsigned long set_uproc_interrupt_reg;
+	unsigned long clr_uproc_interrupt_reg;
+};
+
+struct ipr_chip_cfg_t {
+	u32 mailbox;
+	u8 cache_line_size;
+	struct ipr_interrupts regs;
+};
+
+enum ipr_shutdown_type {
+	IPR_SHUTDOWN_NORMAL = 0x00,
+	IPR_SHUTDOWN_PREPARE_FOR_NORMAL = 0x40,
+	IPR_SHUTDOWN_ABBREV = 0x80,
+	IPR_SHUTDOWN_NONE = 0x100
+};
+
+struct ipr_trace_entry {
+	u32 time;
+
+	u8 op_code;
+	u8 type;
+#define IPR_TRACE_START			0x00
+#define IPR_TRACE_FINISH		0xff
+	u16 cmd_index;
+
+	u32 res_handle;
+	union {
+		u32 ioasc;
+		u32 add_data;
+		u32 res_addr;
+	} u;
+};
+
+struct ipr_sglist {
+	u32 order;
+	u32 num_sg;
+	u32 buffer_len;
+	struct scatterlist scatterlist[1];
+};
+
+enum ipr_sdt_state {
+	INACTIVE,
+	WAIT_FOR_DUMP,
+	GET_DUMP,
+	ABORT_DUMP,
+	DUMP_OBTAINED
+};
+
+/* Per-controller data */
+struct ipr_ioa_cfg {
+	char eye_catcher[8];
+#define IPR_EYECATCHER			"iprcfg"
+
+	struct list_head queue;
+
+	u8 allow_interrupts:1;
+	u8 in_reset_reload:1;
+	u8 in_ioa_bringdown:1;
+	u8 ioa_unit_checked:1;
+	u8 ioa_is_dead:1;
+	u8 dump_taken:1;
+	u8 allow_cmds:1;
+	u8 allow_ml_add_del:1;
+
+	u16 type; /* CCIN of the card */
+
+	u8 log_level;
+#define IPR_MAX_LOG_LEVEL			4
+#define IPR_DEFAULT_LOG_LEVEL		2
+
+#define IPR_NUM_TRACE_INDEX_BITS	8
+#define IPR_NUM_TRACE_ENTRIES		(1 << IPR_NUM_TRACE_INDEX_BITS)
+#define IPR_TRACE_SIZE	(sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES)
+	char trace_start[8];
+#define IPR_TRACE_START_LABEL			"trace"
+	struct ipr_trace_entry *trace;
+	u32 trace_index:IPR_NUM_TRACE_INDEX_BITS;
+
+	/*
+	 * Queue for free command blocks
+	 */
+	char ipr_free_label[8];
+#define IPR_FREEQ_LABEL			"free-q"
+	struct list_head free_q;
+
+	/*
+	 * Queue for command blocks outstanding to the adapter
+	 */
+	char ipr_pending_label[8];
+#define IPR_PENDQ_LABEL			"pend-q"
+	struct list_head pending_q;
+
+	char cfg_table_start[8];
+#define IPR_CFG_TBL_START		"cfg"
+	struct ipr_config_table *cfg_table;
+	u32 cfg_table_dma;
+
+	char resource_table_label[8];
+#define IPR_RES_TABLE_LABEL		"res_tbl"
+	struct ipr_resource_entry *res_entries;
+	struct list_head free_res_q;
+	struct list_head used_res_q;
+
+	char ipr_hcam_label[8];
+#define IPR_HCAM_LABEL			"hcams"
+	struct ipr_hostrcb *hostrcb[IPR_NUM_HCAMS];
+	u32 hostrcb_dma[IPR_NUM_HCAMS];
+	struct list_head hostrcb_free_q;
+	struct list_head hostrcb_pending_q;
+
+	u32 *host_rrq;
+	u32 host_rrq_dma;
+#define IPR_HRRQ_REQ_RESP_HANDLE_MASK	0xfffffffc
+#define IPR_HRRQ_RESP_BIT_SET			0x00000002
+#define IPR_HRRQ_TOGGLE_BIT				0x00000001
+#define IPR_HRRQ_REQ_RESP_HANDLE_SHIFT	2
+	volatile u32 *hrrq_start;
+	volatile u32 *hrrq_end;
+	volatile u32 *hrrq_curr;
+	volatile u32 toggle_bit;
+
+	struct ipr_bus_attributes bus_attr[IPR_MAX_NUM_BUSES];
+
+	const struct ipr_chip_cfg_t *chip_cfg;
+
+	unsigned long hdw_dma_regs;	/* iomapped PCI memory space */
+	unsigned long hdw_dma_regs_pci;	/* raw PCI memory space */
+	unsigned long ioa_mailbox;
+	struct ipr_interrupts regs;
+
+	u32 pci_cfg_buf[64];
+	u16 saved_pcix_cmd_reg;
+	u16 reset_retries;
+
+	u32 errors_logged;
+
+	struct Scsi_Host *host;
+	struct pci_dev *pdev;
+	struct ipr_sglist *ucode_sglist;
+	struct ipr_mode_pages *saved_mode_pages;
+	u8 saved_mode_page_len;
+
+	struct work_struct work_q;
+
+	wait_queue_head_t reset_wait_q;
+
+	struct ipr_dump *dump;
+	enum ipr_sdt_state sdt_state;
+
+	struct ipr_misc_cbs *vpd_cbs;
+	u32 vpd_cbs_dma;
+
+	struct pci_pool *ipr_cmd_pool;
+
+	struct ipr_cmnd *reset_cmd;
+
+	char ipr_cmd_label[8];
+#define IPR_CMD_LABEL		"ipr_cmnd"
+	struct ipr_cmnd *ipr_cmnd_list[IPR_NUM_CMD_BLKS];
+	u32 ipr_cmnd_list_dma[IPR_NUM_CMD_BLKS];
+};
+
+struct ipr_cmnd {
+	struct ipr_ioarcb ioarcb;
+	struct ipr_ioasa ioasa;
+	struct ipr_ioadl_desc ioadl[IPR_NUM_IOADL_ENTRIES];
+	struct list_head queue;
+	struct scsi_cmnd *scsi_cmd;
+	struct completion completion;
+	struct timer_list timer;
+	void (*done) (struct ipr_cmnd *);
+	int (*job_step) (struct ipr_cmnd *);
+	u16 cmd_index;
+	u8 sense_buffer[SCSI_SENSE_BUFFERSIZE];
+	dma_addr_t sense_buffer_dma;
+	unsigned short dma_use_sg;
+	dma_addr_t dma_handle;
+	union {
+		enum ipr_shutdown_type shutdown_type;
+		struct ipr_hostrcb *hostrcb;
+		unsigned long time_left;
+		unsigned long scratch;
+		struct ipr_resource_entry *res;
+		struct ipr_cmnd *sibling;
+		struct scsi_device *sdev;
+	} u;
+
+	struct ipr_ioa_cfg *ioa_cfg;
+};
+
+struct ipr_ses_table_entry {
+	char product_id[17];
+	char compare_product_id_byte[17];
+	u32 max_bus_speed_limit;	/* MB/sec limit for this backplane */
+};
+
+struct ipr_dump_header {
+	u32 eye_catcher;
+#define IPR_DUMP_EYE_CATCHER		0xC5D4E3F2
+	u32 len;
+	u32 num_entries;
+	u32 first_entry_offset;
+	u32 status;
+#define IPR_DUMP_STATUS_SUCCESS			0
+#define IPR_DUMP_STATUS_QUAL_SUCCESS		2
+#define IPR_DUMP_STATUS_FAILED			0xffffffff
+	u32 os;
+#define IPR_DUMP_OS_LINUX	0x4C4E5558
+	u32 driver_name;
+#define IPR_DUMP_DRIVER_NAME	0x49505232
+}__attribute__((packed, aligned (4)));
+
+struct ipr_dump_entry_header {
+	u32 eye_catcher;
+#define IPR_DUMP_EYE_CATCHER		0xC5D4E3F2
+	u32 len;
+	u32 num_elems;
+	u32 offset;
+	u32 data_type;
+#define IPR_DUMP_DATA_TYPE_ASCII	0x41534349
+#define IPR_DUMP_DATA_TYPE_BINARY	0x42494E41
+	u32 id;
+#define IPR_DUMP_IOA_DUMP_ID		0x494F4131
+#define IPR_DUMP_LOCATION_ID		0x4C4F4341
+#define IPR_DUMP_TRACE_ID		0x54524143
+#define IPR_DUMP_DRIVER_VERSION_ID	0x44525652
+#define IPR_DUMP_DRIVER_TYPE_ID	0x54595045
+#define IPR_DUMP_IOA_CTRL_BLK		0x494F4342
+#define IPR_DUMP_PEND_OPS		0x414F5053
+	u32 status;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_dump_location_entry {
+	struct ipr_dump_entry_header hdr;
+	u8 location[BUS_ID_SIZE];
+}__attribute__((packed));
+
+struct ipr_dump_trace_entry {
+	struct ipr_dump_entry_header hdr;
+	u32 trace[IPR_TRACE_SIZE / sizeof(u32)];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_dump_version_entry {
+	struct ipr_dump_entry_header hdr;
+	u8 version[sizeof(IPR_DRIVER_VERSION)];
+};
+
+struct ipr_dump_ioa_type_entry {
+	struct ipr_dump_entry_header hdr;
+	u32 type;
+	u32 fw_version;
+};
+
+struct ipr_driver_dump {
+	struct ipr_dump_header hdr;
+	struct ipr_dump_version_entry version_entry;
+	struct ipr_dump_location_entry location_entry;
+	struct ipr_dump_ioa_type_entry ioa_type_entry;
+	struct ipr_dump_trace_entry trace_entry;
+}__attribute__((packed));
+
+struct ipr_ioa_dump {
+	struct ipr_dump_entry_header hdr;
+	struct ipr_sdt sdt;
+	u32 *ioa_data[IPR_MAX_NUM_DUMP_PAGES];
+	u32 reserved;
+	u32 next_page_index;
+	u32 page_offset;
+	u32 format;
+#define IPR_SDT_FMT2		2
+#define IPR_SDT_UNKNOWN		3
+}__attribute__((packed, aligned (4)));
+
+struct ipr_dump {
+	struct kobject kobj;
+	struct ipr_ioa_cfg *ioa_cfg;
+	struct ipr_driver_dump driver_dump;
+	struct ipr_ioa_dump ioa_dump;
+};
+
+struct ipr_error_table_t {
+	u32 ioasc;
+	int log_ioasa;
+	int log_hcam;
+	char *error;
+};
+
+struct ipr_software_inq_lid_info {
+    u32  load_id;
+    u32  timestamp[3];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_ucode_image_header {
+    u32 header_length;
+    u32 lid_table_offset;
+    u8 major_release;
+    u8 card_type;
+    u8 minor_release[2];
+    u8 reserved[20];
+    char eyecatcher[16];
+    u32 num_lids;
+    struct ipr_software_inq_lid_info lid[1];
+}__attribute__((packed, aligned (4)));
+
+/*
+ * Macros
+ */
+#if IPR_DEBUG
+#define IPR_DBG_CMD(CMD) do { CMD; } while (0)
+#else
+#define IPR_DBG_CMD(CMD)
+#endif
+
+#define ipr_breakpoint_data KERN_ERR IPR_NAME\
+": %s: %s: Line: %d ioa_cfg: %p\n", __FILE__, \
+__FUNCTION__, __LINE__, ioa_cfg
+
+#if defined(CONFIG_KDB) && !defined(CONFIG_PPC_ISERIES)
+#define ipr_breakpoint {printk(ipr_breakpoint_data); KDB_ENTER();}
+#define ipr_breakpoint_or_die {printk(ipr_breakpoint_data); KDB_ENTER();}
+#else
+#define ipr_breakpoint
+#define ipr_breakpoint_or_die panic(ipr_breakpoint_data)
+#endif
+
+#ifdef CONFIG_SCSI_IPR_TRACE
+#define ipr_create_trace_file(kobj, attr) sysfs_create_bin_file(kobj, attr)
+#define ipr_remove_trace_file(kobj, attr) sysfs_remove_bin_file(kobj, attr)
+#else
+#define ipr_create_trace_file(kobj, attr) 0
+#define ipr_remove_trace_file(kobj, attr) do { } while(0)
+#endif
+
+#ifdef CONFIG_SCSI_IPR_DUMP
+#define ipr_create_dump_file(kobj, attr) sysfs_create_bin_file(kobj, attr)
+#define ipr_remove_dump_file(kobj, attr) sysfs_remove_bin_file(kobj, attr)
+#else
+#define ipr_create_dump_file(kobj, attr) 0
+#define ipr_remove_dump_file(kobj, attr) do { } while(0)
+#endif
+
+/*
+ * Error logging macros
+ */
+#define ipr_err(...) printk(KERN_ERR IPR_NAME ": "__VA_ARGS__)
+#define ipr_info(...) printk(KERN_INFO IPR_NAME ": "__VA_ARGS__)
+#define ipr_crit(...) printk(KERN_CRIT IPR_NAME ": "__VA_ARGS__)
+#define ipr_warn(...) printk(KERN_WARNING IPR_NAME": "__VA_ARGS__)
+#define ipr_dbg(...) IPR_DBG_CMD(printk(KERN_INFO IPR_NAME ": "__VA_ARGS__))
+
+#define ipr_sdev_printk(level, sdev, fmt, ...) \
+	printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, sdev->host->host_no, \
+		sdev->channel, sdev->id, sdev->lun, ##__VA_ARGS__)
+
+#define ipr_sdev_err(sdev, fmt, ...) \
+	ipr_sdev_printk(KERN_ERR, sdev, fmt, ##__VA_ARGS__)
+
+#define ipr_sdev_info(sdev, fmt, ...) \
+	ipr_sdev_printk(KERN_INFO, sdev, fmt, ##__VA_ARGS__)
+
+#define ipr_sdev_dbg(sdev, fmt, ...) \
+	IPR_DBG_CMD(ipr_sdev_printk(KERN_INFO, sdev, fmt, ##__VA_ARGS__))
+
+#define ipr_res_printk(level, ioa_cfg, res, fmt, ...) \
+	printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, ioa_cfg->host->host_no, \
+		res.bus, res.target, res.lun, ##__VA_ARGS__)
+
+#define ipr_res_err(ioa_cfg, res, fmt, ...) \
+	ipr_res_printk(KERN_ERR, ioa_cfg, res, fmt, ##__VA_ARGS__)
+#define ipr_res_dbg(ioa_cfg, res, fmt, ...) \
+	IPR_DBG_CMD(ipr_res_printk(KERN_INFO, ioa_cfg, res, fmt, ##__VA_ARGS__))
+
+#define ipr_trace ipr_dbg("%s: %s: Line: %d\n",\
+	__FILE__, __FUNCTION__, __LINE__)
+
+#if IPR_DBG_TRACE
+#define ENTER printk(KERN_INFO IPR_NAME": Entering %s\n", __FUNCTION__)
+#define LEAVE printk(KERN_INFO IPR_NAME": Leaving %s\n", __FUNCTION__)
+#else
+#define ENTER
+#define LEAVE
+#endif
+
+#define ipr_err_separator \
+ipr_err("----------------------------------------------------------\n")
+
+
+/*
+ * Inlines
+ */
+
+/**
+ * ipr_is_ioa_resource - Determine if a resource is the IOA
+ * @res:	resource entry struct
+ *
+ * Return value:
+ * 	1 if IOA / 0 if not IOA
+ **/
+static inline int ipr_is_ioa_resource(struct ipr_resource_entry *res)
+{
+	return (res->cfgte.flags & IPR_IS_IOA_RESOURCE) ? 1 : 0;
+}
+
+/**
+ * ipr_is_af_dasd_device - Determine if a resource is an AF DASD
+ * @res:	resource entry struct
+ *
+ * Return value:
+ * 	1 if AF DASD / 0 if not AF DASD
+ **/
+static inline int ipr_is_af_dasd_device(struct ipr_resource_entry *res)
+{
+	if (IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data) &&
+	    !ipr_is_ioa_resource(res) &&
+	    IPR_RES_SUBTYPE(res) == IPR_SUBTYPE_AF_DASD)
+		return 1;
+	else
+		return 0;
+}
+
+/**
+ * ipr_is_vset_device - Determine if a resource is a VSET
+ * @res:	resource entry struct
+ *
+ * Return value:
+ * 	1 if VSET / 0 if not VSET
+ **/
+static inline int ipr_is_vset_device(struct ipr_resource_entry *res)
+{
+	if (IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data) &&
+	    !ipr_is_ioa_resource(res) &&
+	    IPR_RES_SUBTYPE(res) == IPR_SUBTYPE_VOLUME_SET)
+		return 1;
+	else
+		return 0;
+}
+
+/**
+ * ipr_is_gscsi - Determine if a resource is a generic scsi resource
+ * @res:	resource entry struct
+ *
+ * Return value:
+ * 	1 if GSCSI / 0 if not GSCSI
+ **/
+static inline int ipr_is_gscsi(struct ipr_resource_entry *res)
+{
+	if (!ipr_is_ioa_resource(res) &&
+	    IPR_RES_SUBTYPE(res) == IPR_SUBTYPE_GENERIC_SCSI)
+		return 1;
+	else
+		return 0;
+}
+
+/**
+ * ipr_is_device - Determine if resource address is that of a device
+ * @res_addr:	resource address struct
+ *
+ * Return value:
+ * 	1 if AF / 0 if not AF
+ **/
+static inline int ipr_is_device(struct ipr_res_addr *res_addr)
+{
+	if ((res_addr->bus < IPR_MAX_NUM_BUSES) &&
+	    (res_addr->target < IPR_MAX_NUM_TARGETS_PER_BUS))
+		return 1;
+
+	return 0;
+}
+
+/**
+ * ipr_sdt_is_fmt2 - Determine if a SDT address is in format 2
+ * @sdt_word:	SDT address
+ *
+ * Return value:
+ * 	1 if format 2 / 0 if not
+ **/
+static inline int ipr_sdt_is_fmt2(u32 sdt_word)
+{
+	u32 bar_sel = IPR_GET_FMT2_BAR_SEL(sdt_word);
+
+	switch (bar_sel) {
+	case IPR_SDT_FMT2_BAR0_SEL:
+	case IPR_SDT_FMT2_BAR1_SEL:
+	case IPR_SDT_FMT2_BAR2_SEL:
+	case IPR_SDT_FMT2_BAR3_SEL:
+	case IPR_SDT_FMT2_BAR4_SEL:
+	case IPR_SDT_FMT2_BAR5_SEL:
+	case IPR_SDT_FMT2_EXP_ROM_SEL:
+		return 1;
+	};
+
+	return 0;
+}
+
+#endif
diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/scsi/libata-core.c	Tue Jun 15 22:20:35 2004
@@ -34,33 +34,32 @@
 #include <linux/delay.h>
 #include <linux/timer.h>
 #include <linux/interrupt.h>
+#include <linux/completion.h>
 #include <linux/suspend.h>
+#include <linux/workqueue.h>
 #include <scsi/scsi.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 #include <asm/io.h>
 #include <asm/semaphore.h>
 
 #include "libata.h"
 
-static void atapi_cdb_send(struct ata_port *ap);
 static unsigned int ata_busy_sleep (struct ata_port *ap,
 				    unsigned long tmout_pat,
 			    	    unsigned long tmout);
 static void __ata_dev_select (struct ata_port *ap, unsigned int device);
-#if 0 /* to be used eventually */
-static void ata_qc_push (struct ata_queued_cmd *qc, unsigned int append);
-#endif
-static void ata_dma_complete(struct ata_port *ap, u8 host_stat,
-			     unsigned int done_late);
+static void ata_dma_complete(struct ata_queued_cmd *qc, u8 host_stat);
 static void ata_host_set_pio(struct ata_port *ap);
 static void ata_host_set_udma(struct ata_port *ap);
 static void ata_dev_set_pio(struct ata_port *ap, unsigned int device);
 static void ata_dev_set_udma(struct ata_port *ap, unsigned int device);
 static void ata_set_mode(struct ata_port *ap);
+static int ata_qc_issue_prot(struct ata_queued_cmd *qc);
 
 static unsigned int ata_unique_id = 1;
+static struct workqueue_struct *ata_wq;
 
 MODULE_AUTHOR("Jeff Garzik");
 MODULE_DESCRIPTION("Library module for ATA devices");
@@ -74,13 +73,6 @@
 	"THR_IDLE",
 	"THR_PROBE_SUCCESS",
 	"THR_PROBE_START",
-	"THR_PIO_POLL",
-	"THR_PIO_TMOUT",
-	"THR_PIO",
-	"THR_PIO_LAST",
-	"THR_PIO_LAST_POLL",
-	"THR_PIO_ERR",
-	"THR_PACKET",
 };
 
 /**
@@ -105,25 +97,8 @@
 }
 
 /**
- *	msleep - sleep for a number of milliseconds
- *	@msecs: number of milliseconds to sleep
- *
- *	Issues schedule_timeout call for the specified number
- *	of milliseconds.
- *
- *	LOCKING:
- *	None.
- */
-
-static void msleep(unsigned long msecs)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(msecs) + 1);
-}
-
-/**
  *	ata_tf_load_pio - send taskfile registers to host controller
- *	@ioaddr: set of IO ports to which output is sent
+ *	@ap: Port to which output is sent
  *	@tf: ATA taskfile register set
  *
  *	Outputs ATA taskfile to standard ATA host controller using PIO.
@@ -181,7 +156,7 @@
 
 /**
  *	ata_tf_load_mmio - send taskfile registers to host controller
- *	@ioaddr: set of IO ports to which output is sent
+ *	@ap: Port to which output is sent
  *	@tf: ATA taskfile register set
  *
  *	Outputs ATA taskfile to standard ATA host controller using MMIO.
@@ -315,8 +290,6 @@
 
 static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf)
 {
-	init_MUTEX_LOCKED(&ap->sem);
-
 	ap->ops->tf_load(ap, tf);
 
 	ata_exec(ap, tf);
@@ -337,15 +310,13 @@
 
 void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf)
 {
-	init_MUTEX_LOCKED(&ap->sem);
-
 	ap->ops->tf_load(ap, tf);
 	ap->ops->exec_command(ap, tf);
 }
 
 /**
  *	ata_tf_read_pio - input device's ATA taskfile shadow registers
- *	@ioaddr: set of IO ports from which input is read
+ *	@ap: Port from which input is read
  *	@tf: ATA taskfile register set for storing input
  *
  *	Reads ATA taskfile registers for currently-selected device
@@ -377,7 +348,7 @@
 
 /**
  *	ata_tf_read_mmio - input device's ATA taskfile shadow registers
- *	@ioaddr: set of IO ports from which input is read
+ *	@ap: Port from which input is read
  *	@tf: ATA taskfile register set for storing input
  *
  *	Reads ATA taskfile registers for currently-selected device
@@ -440,6 +411,78 @@
 }
 
 /**
+ *	ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure
+ *	@tf: Taskfile to convert
+ *	@fis: Buffer into which data will output
+ *	@pmp: Port multiplier port
+ *
+ *	Converts a standard ATA taskfile to a Serial ATA
+ *	FIS structure (Register - Host to Device).
+ *
+ *	LOCKING:
+ *	Inherited from caller.
+ */
+
+void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp)
+{
+	fis[0] = 0x27;	/* Register - Host to Device FIS */
+	fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number,
+					    bit 7 indicates Command FIS */
+	fis[2] = tf->command;
+	fis[3] = tf->feature;
+
+	fis[4] = tf->lbal;
+	fis[5] = tf->lbam;
+	fis[6] = tf->lbah;
+	fis[7] = tf->device;
+
+	fis[8] = tf->hob_lbal;
+	fis[9] = tf->hob_lbam;
+	fis[10] = tf->hob_lbah;
+	fis[11] = tf->hob_feature;
+
+	fis[12] = tf->nsect;
+	fis[13] = tf->hob_nsect;
+	fis[14] = 0;
+	fis[15] = tf->ctl;
+
+	fis[16] = 0;
+	fis[17] = 0;
+	fis[18] = 0;
+	fis[19] = 0;
+}
+
+/**
+ *	ata_tf_from_fis - Convert SATA FIS to ATA taskfile
+ *	@fis: Buffer from which data will be input
+ *	@tf: Taskfile to output
+ *
+ *	Converts a standard ATA taskfile to a Serial ATA
+ *	FIS structure (Register - Host to Device).
+ *
+ *	LOCKING:
+ *	Inherited from caller.
+ */
+
+void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf)
+{
+	tf->command	= fis[2];	/* status */
+	tf->feature	= fis[3];	/* error */
+
+	tf->lbal	= fis[4];
+	tf->lbam	= fis[5];
+	tf->lbah	= fis[6];
+	tf->device	= fis[7];
+
+	tf->hob_lbal	= fis[8];
+	tf->hob_lbam	= fis[9];
+	tf->hob_lbah	= fis[10];
+
+	tf->nsect	= fis[12];
+	tf->hob_nsect	= fis[13];
+}
+
+/**
  *	ata_prot_to_cmd - determine which read/write opcodes to use
  *	@protocol: ATA_PROT_xxx taskfile protocol
  *	@lba48: true is lba48 is present
@@ -759,7 +802,7 @@
  *	@dev: Device whose IDENTIFY DEVICE results we will examine
  *	@s: string into which data is output
  *	@ofs: offset into identify device page
- *	@len: length of string to return
+ *	@len: length of string to return. must be an even number.
  *
  *	The strings in the IDENTIFY DEVICE page are broken up into
  *	16-bit chunks.  Run through the string, and output each
@@ -789,29 +832,6 @@
 }
 
 /**
- *	ata_dev_parse_strings - Store useful IDENTIFY DEVICE page strings
- *	@dev: Device whose IDENTIFY DEVICE page info we use
- *
- *	We store 'vendor' and 'product' strings read from the device,
- *	for later use in the SCSI simulator's INQUIRY data.
- *
- *	Set these strings here, in the case of 'product', using
- *	data read from the ATA IDENTIFY DEVICE page.
- *
- *	LOCKING:
- *	caller.
- */
-
-static void ata_dev_parse_strings(struct ata_device *dev)
-{
-	assert (dev->class == ATA_DEV_ATA);
-	memcpy(dev->vendor, "ATA     ", 8);
-
-	ata_dev_id_string(dev, dev->product, ATA_ID_PROD_OFS,
-			  sizeof(dev->product));
-}
-
-/**
  *	__ata_dev_select - Select device 0/1 on ATA bus
  *	@ap: ATA channel to manipulate
  *	@device: ATA device (numbered from zero) to select
@@ -1068,8 +1088,6 @@
 
 	ata_dump_id(dev);
 
-	ata_dev_parse_strings(dev);
-
 	/* ATA-specific feature tests */
 	if (dev->class == ATA_DEV_ATA) {
 		if (!ata_id_is_ata(dev))	/* sanity check */
@@ -1096,11 +1114,11 @@
 		ap->host->max_cmd_len = 16;
 
 		/* print device info to dmesg */
-		printk(KERN_INFO "ata%u: dev %u ATA, max %s, %Lu sectors%s\n",
+		printk(KERN_INFO "ata%u: dev %u ATA, max %s, %Lu sectors:%s\n",
 		       ap->id, device,
 		       ata_udma_string(udma_modes),
 		       (unsigned long long)dev->n_sectors,
-		       dev->flags & ATA_DFLAG_LBA48 ? " (lba48)" : "");
+		       dev->flags & ATA_DFLAG_LBA48 ? " lba48" : "");
 	}
 
 	/* ATAPI-specific feature tests */
@@ -1663,9 +1681,9 @@
 }
 
 /**
- *	ata_dev_set_xfermode -
- *	@ap:
- *	@dev:
+ *	ata_dev_set_xfermode - Issue SET FEATURES - XFER MODE command
+ *	@ap: Port associated with device @dev
+ *	@dev: Device to which command will be sent
  *
  *	LOCKING:
  */
@@ -1704,9 +1722,9 @@
 }
 
 /**
- *	ata_dev_set_udma -
- *	@ap:
- *	@device:
+ *	ata_dev_set_udma - Set ATA device's transfer mode to Ultra DMA
+ *	@ap: Port associated with device @dev
+ *	@device: Device whose mode will be set
  *
  *	LOCKING:
  */
@@ -1728,9 +1746,9 @@
 }
 
 /**
- *	ata_dev_set_pio -
- *	@ap:
- *	@device:
+ *	ata_dev_set_pio - Set ATA device's transfer mode to PIO
+ *	@ap: Port associated with device @dev
+ *	@device: Device whose mode will be set
  *
  *	LOCKING:
  */
@@ -1928,20 +1946,20 @@
 static unsigned long ata_pio_poll(struct ata_port *ap)
 {
 	u8 status;
-	unsigned int poll_state = THR_UNKNOWN;
-	unsigned int reg_state = THR_UNKNOWN;
-	const unsigned int tmout_state = THR_PIO_TMOUT;
-
-	switch (ap->thr_state) {
-	case THR_PIO:
-	case THR_PIO_POLL:
-		poll_state = THR_PIO_POLL;
-		reg_state = THR_PIO;
-		break;
-	case THR_PIO_LAST:
-	case THR_PIO_LAST_POLL:
-		poll_state = THR_PIO_LAST_POLL;
-		reg_state = THR_PIO_LAST;
+	unsigned int poll_state = PIO_ST_UNKNOWN;
+	unsigned int reg_state = PIO_ST_UNKNOWN;
+	const unsigned int tmout_state = PIO_ST_TMOUT;
+
+	switch (ap->pio_task_state) {
+	case PIO_ST:
+	case PIO_ST_POLL:
+		poll_state = PIO_ST_POLL;
+		reg_state = PIO_ST;
+		break;
+	case PIO_ST_LAST:
+	case PIO_ST_LAST_POLL:
+		poll_state = PIO_ST_LAST_POLL;
+		reg_state = PIO_ST_LAST;
 		break;
 	default:
 		BUG();
@@ -1950,39 +1968,19 @@
 
 	status = ata_chk_status(ap);
 	if (status & ATA_BUSY) {
-		if (time_after(jiffies, ap->thr_timeout)) {
-			ap->thr_state = tmout_state;
+		if (time_after(jiffies, ap->pio_task_timeout)) {
+			ap->pio_task_state = tmout_state;
 			return 0;
 		}
-		ap->thr_state = poll_state;
+		ap->pio_task_state = poll_state;
 		return ATA_SHORT_PAUSE;
 	}
 
-	ap->thr_state = reg_state;
+	ap->pio_task_state = reg_state;
 	return 0;
 }
 
 /**
- *	ata_pio_start -
- *	@qc:
- *
- *	LOCKING:
- *	spin_lock_irqsave(host_set lock)
- */
-
-static void ata_pio_start (struct ata_queued_cmd *qc)
-{
-	struct ata_port *ap = qc->ap;
-
-	assert(qc->tf.protocol == ATA_PROT_PIO);
-
-	qc->flags |= ATA_QCFLAG_POLL;
-	qc->tf.ctl |= ATA_NIEN;	/* disable interrupts */
-	ata_tf_to_host_nolock(ap, &qc->tf);
-	ata_thread_wake(ap, THR_PIO);
-}
-
-/**
  *	ata_pio_complete -
  *	@ap:
  *
@@ -1992,7 +1990,6 @@
 static void ata_pio_complete (struct ata_port *ap)
 {
 	struct ata_queued_cmd *qc;
-	unsigned long flags;
 	u8 drv_stat;
 
 	/*
@@ -2001,35 +1998,33 @@
 	 * a chk-status or two.  If not, the drive is probably seeking
 	 * or something.  Snooze for a couple msecs, then
 	 * chk-status again.  If still busy, fall back to
-	 * THR_PIO_POLL state.
+	 * PIO_ST_POLL state.
 	 */
 	drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);
 	if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
 		msleep(2);
 		drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);
 		if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
-			ap->thr_state = THR_PIO_LAST_POLL;
-			ap->thr_timeout = jiffies + ATA_TMOUT_PIO;
+			ap->pio_task_state = PIO_ST_LAST_POLL;
+			ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
 			return;
 		}
 	}
 
 	drv_stat = ata_wait_idle(ap);
 	if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
-		ap->thr_state = THR_PIO_ERR;
+		ap->pio_task_state = PIO_ST_ERR;
 		return;
 	}
 
 	qc = ata_qc_from_tag(ap, ap->active_tag);
 	assert(qc != NULL);
 
-	spin_lock_irqsave(&ap->host_set->lock, flags);
-	ap->thr_state = THR_IDLE;
-	spin_unlock_irqrestore(&ap->host_set->lock, flags);
+	ap->pio_task_state = PIO_ST_IDLE;
 
 	ata_irq_on(ap);
 
-	ata_qc_complete(qc, drv_stat, 0);
+	ata_qc_complete(qc, drv_stat);
 }
 
 /**
@@ -2053,22 +2048,22 @@
 	 * a chk-status or two.  If not, the drive is probably seeking
 	 * or something.  Snooze for a couple msecs, then
 	 * chk-status again.  If still busy, fall back to
-	 * THR_PIO_POLL state.
+	 * PIO_ST_POLL state.
 	 */
 	status = ata_busy_wait(ap, ATA_BUSY, 5);
 	if (status & ATA_BUSY) {
 		msleep(2);
 		status = ata_busy_wait(ap, ATA_BUSY, 10);
 		if (status & ATA_BUSY) {
-			ap->thr_state = THR_PIO_POLL;
-			ap->thr_timeout = jiffies + ATA_TMOUT_PIO;
+			ap->pio_task_state = PIO_ST_POLL;
+			ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
 			return;
 		}
 	}
 
 	/* handle BSY=0, DRQ=0 as error */
 	if ((status & ATA_DRQ) == 0) {
-		ap->thr_state = THR_PIO_ERR;
+		ap->pio_task_state = PIO_ST_ERR;
 		return;
 	}
 
@@ -2079,7 +2074,7 @@
 	sg = qc->sg;
 
 	if (qc->cursect == (qc->nsect - 1))
-		ap->thr_state = THR_PIO_LAST;
+		ap->pio_task_state = PIO_ST_LAST;
 
 	buf = kmap(sg[qc->cursg].page) +
 	      sg[qc->cursg].offset + (qc->cursg_ofs * ATA_SECT_SIZE);
@@ -2107,20 +2102,48 @@
 	kunmap(sg[qc->cursg].page);
 }
 
-#if 0 /* to be used eventually */
-/**
- *	ata_eng_schedule - run an iteration of the pio/dma/whatever engine
- *	@ap: port on which activity will occur
- *	@eng: instance of engine
- *
- *	LOCKING:
- *	spin_lock_irqsave(host_set lock)
- */
-static void ata_eng_schedule (struct ata_port *ap, struct ata_engine *eng)
+static void ata_pio_task(void *_data)
 {
-	/* FIXME */
+	struct ata_port *ap = _data;
+	unsigned long timeout = 0;
+
+	switch (ap->pio_task_state) {
+	case PIO_ST:
+		ata_pio_sector(ap);
+		break;
+
+	case PIO_ST_LAST:
+		ata_pio_complete(ap);
+		break;
+
+	case PIO_ST_POLL:
+	case PIO_ST_LAST_POLL:
+		timeout = ata_pio_poll(ap);
+		break;
+
+	case PIO_ST_TMOUT:
+		printk(KERN_ERR "ata%d: FIXME: PIO_ST_TMOUT\n", /* FIXME */
+		       ap->id);
+		timeout = 11 * HZ;
+		break;
+
+	case PIO_ST_ERR:
+		printk(KERN_ERR "ata%d: FIXME: PIO_ST_ERR\n", /* FIXME */
+		       ap->id);
+		timeout = 11 * HZ;
+		break;
+	}
+
+	if ((ap->pio_task_state != PIO_ST_IDLE) &&
+	    (ap->pio_task_state != PIO_ST_TMOUT) &&
+	    (ap->pio_task_state != PIO_ST_ERR)) {
+		if (timeout)
+			queue_delayed_work(ata_wq, &ap->pio_task,
+					   timeout);
+		else
+			queue_work(ata_wq, &ap->pio_task);
+	}
 }
-#endif
 
 /**
  *	ata_eng_timeout - Handle timeout of queued command
@@ -2174,7 +2197,7 @@
 		printk(KERN_ERR "ata%u: DMA timeout, stat 0x%x\n",
 		       ap->id, host_stat);
 
-		ata_dma_complete(ap, host_stat, 1);
+		ata_dma_complete(qc, host_stat);
 		break;
 
 	case ATA_PROT_NODATA:
@@ -2183,7 +2206,7 @@
 		printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n",
 		       ap->id, qc->tf.command, drv_stat);
 
-		ata_qc_complete(qc, drv_stat, 1);
+		ata_qc_complete(qc, drv_stat);
 		break;
 
 	default:
@@ -2192,7 +2215,7 @@
 		printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
 		       ap->id, qc->tf.command, drv_stat);
 
-		ata_qc_complete(qc, drv_stat, 1);
+		ata_qc_complete(qc, drv_stat);
 		break;
 	}
 
@@ -2201,9 +2224,9 @@
 }
 
 /**
- *	ata_qc_new -
- *	@ap:
- *	@dev:
+ *	ata_qc_new - Request an available ATA command, for queueing
+ *	@ap: Port associated with device @dev
+ *	@dev: Device from whom we request an available command structure
  *
  *	LOCKING:
  */
@@ -2226,9 +2249,9 @@
 }
 
 /**
- *	ata_qc_new_init -
- *	@ap:
- *	@dev:
+ *	ata_qc_new_init - Request an available ATA command, and initialize it
+ *	@ap: Port associated with device @dev
+ *	@dev: Device from whom we request an available command structure
  *
  *	LOCKING:
  */
@@ -2246,8 +2269,7 @@
 		qc->ap = ap;
 		qc->dev = dev;
 		qc->cursect = qc->cursg = qc->cursg_ofs = 0;
-		INIT_LIST_HEAD(&qc->node);
-		init_MUTEX_LOCKED(&qc->sem);
+		qc->nsect = 0;
 
 		ata_tf_init(ap, &qc->tf, dev->devno);
 
@@ -2261,16 +2283,15 @@
 }
 
 /**
- *	ata_qc_complete -
- *	@qc:
- *	@drv_stat:
- *	@done_late:
+ *	ata_qc_complete - Complete an active ATA command
+ *	@qc: Command to complete
+ *	@drv_stat: ATA status register contents
  *
  *	LOCKING:
  *
  */
 
-void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat, unsigned int done_late)
+void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
 {
 	struct ata_port *ap = qc->ap;
 	struct scsi_cmnd *cmd = qc->scsicmd;
@@ -2284,7 +2305,7 @@
 
 	if (cmd) {
 		if (unlikely(drv_stat & (ATA_ERR | ATA_BUSY | ATA_DRQ))) {
-			if (qc->flags & ATA_QCFLAG_ATAPI)
+			if (is_atapi_taskfile(&qc->tf))
 				cmd->result = SAM_STAT_CHECK_CONDITION;
 			else
 				ata_to_sense_error(qc);
@@ -2304,89 +2325,124 @@
 		do_clear = 1;
 	}
 
-	up(&qc->sem);
+	if (qc->waiting)
+		complete(qc->waiting);
 
 	if (likely(do_clear))
 		clear_bit(tag, &ap->qactive);
 }
 
-#if 0 /* to be used eventually */
 /**
- *	ata_qc_push -
- *	@qc:
- *	@append:
+ *	ata_qc_issue - issue taskfile to device
+ *	@qc: command to issue to device
+ *
+ *	Prepare an ATA command to submission to device.
+ *	This includes mapping the data into a DMA-able
+ *	area, filling in the S/G table, and finally
+ *	writing the taskfile to hardware, starting the command.
  *
  *	LOCKING:
  *	spin_lock_irqsave(host_set lock)
+ *
+ *	RETURNS:
+ *	Zero on success, negative on error.
  */
-static void ata_qc_push (struct ata_queued_cmd *qc, unsigned int append)
+
+int ata_qc_issue(struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
-	struct ata_engine *eng = &ap->eng;
+	struct scsi_cmnd *cmd = qc->scsicmd;
 
-	if (likely(append))
-		list_add_tail(&qc->node, &eng->q);
-	else
-		list_add(&qc->node, &eng->q);
+	if (qc->flags & ATA_QCFLAG_SG) {
+		/* set up SG table */
+		if (cmd->use_sg) {
+			if (ata_sg_setup(qc))
+				goto err_out;
+		} else {
+			if (ata_sg_setup_one(qc))
+				goto err_out;
+		}
+
+		ap->ops->fill_sg(qc);
+	}
 
-	if (!test_and_set_bit(ATA_EFLG_ACTIVE, &eng->flags))
-		ata_eng_schedule(ap, eng);
+	qc->ap->active_tag = qc->tag;
+	qc->flags |= ATA_QCFLAG_ACTIVE;
+
+	return ata_qc_issue_prot(qc);
+
+err_out:
+	return -1;
 }
-#endif
 
 /**
- *	ata_qc_issue -
- *	@qc:
+ *	ata_qc_issue_prot - issue taskfile to device in proto-dependent manner
+ *	@qc: command to issue to device
+ *
+ *	Using various libata functions and hooks, this function
+ *	starts an ATA command.  ATA commands are grouped into
+ *	classes called "protocols", and issuing each type of protocol
+ *	is slightly different.
  *
  *	LOCKING:
+ *	spin_lock_irqsave(host_set lock)
  *
  *	RETURNS:
- *
+ *	Zero on success, negative on error.
  */
-int ata_qc_issue(struct ata_queued_cmd *qc)
+
+static int ata_qc_issue_prot(struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
-	struct scsi_cmnd *cmd = qc->scsicmd;
-	unsigned int dma = qc->flags & ATA_QCFLAG_DMA;
 
 	ata_dev_select(ap, qc->dev->devno, 1, 0);
 
-	/* set up SG table */
-	if (cmd->use_sg) {
-		if (ata_sg_setup(qc))
-			goto err_out;
-	} else {
-		if (ata_sg_setup_one(qc))
-			goto err_out;
-	}
+	switch (qc->tf.protocol) {
+	case ATA_PROT_NODATA:
+		ata_tf_to_host_nolock(ap, &qc->tf);
+		break;
 
-	ap->ops->fill_sg(qc);
+	case ATA_PROT_DMA:
+		ap->ops->tf_load(ap, &qc->tf);	 /* load tf registers */
+		ap->ops->bmdma_setup(qc);	    /* set up bmdma */
+		ap->ops->bmdma_start(qc);	    /* initiate bmdma */
+		break;
 
-	qc->ap->active_tag = qc->tag;
-	qc->flags |= ATA_QCFLAG_ACTIVE;
+	case ATA_PROT_PIO: /* load tf registers, initiate polling pio */
+		ata_qc_set_polling(qc);
+		ata_tf_to_host_nolock(ap, &qc->tf);
+		ap->pio_task_state = PIO_ST;
+		queue_work(ata_wq, &ap->pio_task);
+		break;
 
-	if (likely(dma)) {
-		ap->ops->tf_load(ap, &qc->tf);	/* load tf registers */
-		ap->ops->bmdma_start(qc);	/* initiate bmdma */
-	} else
-		/* load tf registers, initiate polling pio */
-		ata_pio_start(qc);
+	case ATA_PROT_ATAPI:
+		ata_tf_to_host_nolock(ap, &qc->tf);
+		queue_work(ata_wq, &ap->packet_task);
+		break;
 
-	return 0;
+	case ATA_PROT_ATAPI_DMA:
+		ap->ops->tf_load(ap, &qc->tf);	 /* load tf registers */
+		ap->ops->bmdma_setup(qc);	    /* set up bmdma */
+		queue_work(ata_wq, &ap->packet_task);
+		break;
 
-err_out:
-	return -1;
+	default:
+		WARN_ON(1);
+		return -1;
+	}
+
+	return 0;
 }
 
 /**
- *	ata_bmdma_start_mmio -
- *	@qc:
+ *	ata_bmdma_setup_mmio - Set up PCI IDE BMDMA transaction (MMIO)
+ *	@qc: Info associated with this ATA transaction.
  *
  *	LOCKING:
  *	spin_lock_irqsave(host_set lock)
  */
 
-void ata_bmdma_start_mmio (struct ata_queued_cmd *qc)
+void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
 	unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
@@ -2410,8 +2466,24 @@
 
 	/* issue r/w command */
 	ap->ops->exec_command(ap, &qc->tf);
+}
+
+/**
+ *	ata_bmdma_start_mmio - Start a PCI IDE BMDMA transaction (MMIO)
+ *	@qc: Info associated with this ATA transaction.
+ *
+ *	LOCKING:
+ *	spin_lock_irqsave(host_set lock)
+ */
+
+void ata_bmdma_start_mmio (struct ata_queued_cmd *qc)
+{
+	struct ata_port *ap = qc->ap;
+	void *mmio = (void *) ap->ioaddr.bmdma_addr;
+	u8 dmactl;
 
 	/* start host DMA transaction */
+	dmactl = readb(mmio + ATA_DMA_CMD);
 	writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD);
 
 	/* Strictly, one may wish to issue a readb() here, to
@@ -2428,14 +2500,14 @@
 }
 
 /**
- *	ata_bmdma_start_pio -
- *	@qc:
+ *	ata_bmdma_setup_pio - Set up PCI IDE BMDMA transaction (PIO)
+ *	@qc: Info associated with this ATA transaction.
  *
  *	LOCKING:
  *	spin_lock_irqsave(host_set lock)
  */
 
-void ata_bmdma_start_pio (struct ata_queued_cmd *qc)
+void ata_bmdma_setup_pio (struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
 	unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
@@ -2458,24 +2530,38 @@
 
 	/* issue r/w command */
 	ap->ops->exec_command(ap, &qc->tf);
+}
+
+/**
+ *	ata_bmdma_start_pio - Start a PCI IDE BMDMA transaction (PIO)
+ *	@qc: Info associated with this ATA transaction.
+ *
+ *	LOCKING:
+ *	spin_lock_irqsave(host_set lock)
+ */
+
+void ata_bmdma_start_pio (struct ata_queued_cmd *qc)
+{
+	struct ata_port *ap = qc->ap;
+	u8 dmactl;
 
 	/* start host DMA transaction */
+	dmactl = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
 	outb(dmactl | ATA_DMA_START,
 	     ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
 }
 
 /**
- *	ata_dma_complete -
- *	@ap:
- *	@host_stat:
- *	@done_late:
+ *	ata_dma_complete - Complete an active ATA BMDMA command
+ *	@qc: Command to complete
+ *	@host_stat: BMDMA status register contents
  *
  *	LOCKING:
  */
 
-static void ata_dma_complete(struct ata_port *ap, u8 host_stat,
-			     unsigned int done_late)
+static void ata_dma_complete(struct ata_queued_cmd *qc, u8 host_stat)
 {
+	struct ata_port *ap = qc->ap;
 	VPRINTK("ENTER\n");
 
 	if (ap->flags & ATA_FLAG_MMIO) {
@@ -2506,8 +2592,7 @@
 		ap->id, (u32) host_stat, (u32) ata_chk_status(ap));
 
 	/* get drive status; clear intr; complete txn */
-	ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag),
-			ata_wait_idle(ap), done_late);
+	ata_qc_complete(qc, ata_wait_idle(ap));
 }
 
 /**
@@ -2533,7 +2618,10 @@
 	unsigned int handled = 0;
 
 	switch (qc->tf.protocol) {
+
+	/* BMDMA completion */
 	case ATA_PROT_DMA:
+	case ATA_PROT_ATAPI_DMA:
 		if (ap->flags & ATA_FLAG_MMIO) {
 			void *mmio = (void *) ap->ioaddr.bmdma_addr;
 			host_stat = readb(mmio + ATA_DMA_STATUS);
@@ -2546,14 +2634,23 @@
 			break;
 		}
 
-		ata_dma_complete(ap, host_stat, 0);
+		ata_dma_complete(qc, host_stat);
 		handled = 1;
 		break;
 
-	case ATA_PROT_NODATA:	/* command completion, but no data xfer */
+	/* command completion, but no data xfer */
+	/* FIXME: a shared interrupt _will_ cause a non-data command
+	 * to be completed prematurely, with an error.
+	 *
+	 * This doesn't matter right now, since we aren't sending
+	 * non-data commands down this pipe except in development
+	 * situations.
+	 */
+	case ATA_PROT_ATAPI:
+	case ATA_PROT_NODATA:
 		status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
 		DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
-		ata_qc_complete(qc, status, 0);
+		ata_qc_complete(qc, status);
 		handled = 1;
 		break;
 
@@ -2574,10 +2671,10 @@
 }
 
 /**
- *	ata_interrupt -
- *	@irq:
- *	@dev_instance:
- *	@regs:
+ *	ata_interrupt - Default ATA host interrupt handler
+ *	@irq: irq line
+ *	@dev_instance: pointer to our host information structure
+ *	@regs: unused
  *
  *	LOCKING:
  *
@@ -2603,7 +2700,7 @@
 			struct ata_queued_cmd *qc;
 
 			qc = ata_qc_from_tag(ap, ap->active_tag);
-			if (qc && ((qc->flags & ATA_QCFLAG_POLL) == 0))
+			if (qc && (!(qc->tf.ctl & ATA_NIEN)))
 				handled += ata_host_intr(ap, qc);
 		}
 	}
@@ -2614,36 +2711,6 @@
 }
 
 /**
- *	ata_thread_wake -
- *	@ap:
- *	@thr_state:
- *
- *	LOCKING:
- *	spin_lock_irqsave(host_set lock)
- */
-
-void ata_thread_wake(struct ata_port *ap, unsigned int thr_state)
-{
-	assert(ap->thr_state == THR_IDLE);
-	ap->thr_state = thr_state;
-	up(&ap->thr_sem);
-}
-
-/**
- *	ata_thread_timer -
- *	@opaque:
- *
- *	LOCKING:
- */
-
-static void ata_thread_timer(unsigned long opaque)
-{
-	struct ata_port *ap = (struct ata_port *) opaque;
-
-	up(&ap->thr_sem);
-}
-
-/**
  *	ata_thread_iter -
  *	@ap:
  *
@@ -2666,7 +2733,6 @@
 		break;
 
 	case THR_PROBE_START:
-		down(&ap->sem);
 		ap->thr_state = THR_PORT_RESET;
 		break;
 
@@ -2685,40 +2751,8 @@
 		break;
 
 	case THR_AWAIT_DEATH:
-		timeout = -1;
-		break;
-
 	case THR_IDLE:
-		timeout = 30 * HZ;
-		break;
-
-	case THR_PIO:
-		ata_pio_sector(ap);
-		break;
-
-	case THR_PIO_LAST:
-		ata_pio_complete(ap);
-		break;
-
-	case THR_PIO_POLL:
-	case THR_PIO_LAST_POLL:
-		timeout = ata_pio_poll(ap);
-		break;
-
-	case THR_PIO_TMOUT:
-		printk(KERN_ERR "ata%d: FIXME: THR_PIO_TMOUT\n", /* FIXME */
-		       ap->id);
-		timeout = 11 * HZ;
-		break;
-
-	case THR_PIO_ERR:
-		printk(KERN_ERR "ata%d: FIXME: THR_PIO_ERR\n", /* FIXME */
-		       ap->id);
-		timeout = 11 * HZ;
-		break;
-
-	case THR_PACKET:
-		atapi_cdb_send(ap);
+		timeout = -1;
 		break;
 
 	default:
@@ -2733,86 +2767,8 @@
 }
 
 /**
- *	ata_thread -
- *	@data:
- *
- *	LOCKING:
- *
- *	RETURNS:
- *
- */
-
-static int ata_thread (void *data)
-{
-        struct ata_port *ap = data;
-	long timeout;
-
-	daemonize ("katad-%u", ap->id);
-	allow_signal(SIGTERM);
-
-        while (1) {
-		cond_resched();
-
-		timeout = ata_thread_iter(ap);
-
-                if (signal_pending (current))
-                        flush_signals(current);
-                        
-                if (current->flags & PF_FREEZE)
-			refrigerator(PF_FREEZE);
-                                                        
-
-                if ((timeout < 0) || (ap->time_to_die))
-                        break;
-
- 		/* note sleeping for full timeout not guaranteed (that's ok) */
-		if (timeout) {
-			mod_timer(&ap->thr_timer, jiffies + timeout);
-			down_interruptible(&ap->thr_sem);
-
-                	if (signal_pending (current))
-                        	flush_signals(current);
-
-                	if (ap->time_to_die)
-                        	break;
-		}
-        }
-
-	printk(KERN_DEBUG "ata%u: thread exiting\n", ap->id);
-	ap->thr_pid = -1;
-	del_timer_sync(&ap->thr_timer);
-	complete_and_exit (&ap->thr_exited, 0);
-}
-
-/**
- *	ata_thread_kill - kill per-port kernel thread
- *	@ap: port those thread is to be killed
- *
- *	LOCKING:
- *
- */
-
-static int ata_thread_kill(struct ata_port *ap)
-{
-	int ret = 0;
-
-	if (ap->thr_pid >= 0) {
-		ap->time_to_die = 1;
-		wmb();
-		ret = kill_proc(ap->thr_pid, SIGTERM, 1);
-		if (ret)
-			printk(KERN_ERR "ata%d: unable to kill kernel thread\n",
-			       ap->id);
-		else
-			wait_for_completion(&ap->thr_exited);
-	}
-
-	return ret;
-}
-
-/**
- *	atapi_cdb_send - Write CDB bytes to hardware
- *	@ap: Port to which ATAPI device is attached.
+ *	atapi_packet_task - Write CDB bytes to hardware
+ *	@_data: Port to which ATAPI device is attached.
  *
  *	When device has indicated its readiness to accept
  *	a CDB, this function is called.  Send the CDB.
@@ -2824,8 +2780,9 @@
  *	Kernel thread context (may sleep)
  */
 
-static void atapi_cdb_send(struct ata_port *ap)
+static void atapi_packet_task(void *_data)
 {
+	struct ata_port *ap = _data;
 	struct ata_queued_cmd *qc;
 	u8 status;
 
@@ -2850,30 +2807,24 @@
 	      qc->scsicmd->cmnd, ap->host->max_cmd_len / 4);
 
 	/* if we are DMA'ing, irq handler takes over from here */
-	if (qc->tf.feature == ATAPI_PKT_DMA)
-		goto out;
-
-	/* sleep-wait for BSY to clear */
-	DPRINTK("busy wait 2\n");
-	if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB))
-		goto err_out;
+	if (qc->tf.protocol == ATA_PROT_ATAPI_DMA)
+		ap->ops->bmdma_start(qc);	    /* initiate bmdma */
 
-	/* wait for BSY,DRQ to clear */
-	status = ata_wait_idle(ap);
-	if (status & (ATA_BUSY | ATA_DRQ))
-		goto err_out;
+	/* non-data commands are also handled via irq */
+	else if (qc->scsicmd->sc_data_direction == SCSI_DATA_NONE) {
+		/* do nothing */
+	}
 
-	/* transaction completed, indicate such to scsi stack */
-	ata_qc_complete(qc, status, 0);
-	ata_irq_on(ap);
+	/* PIO commands are handled by polling */
+	else {
+		ap->pio_task_state = PIO_ST;
+		queue_work(ata_wq, &ap->pio_task);
+	}
 
-out:
-	ap->thr_state = THR_IDLE;
 	return;
 
 err_out:
-	ata_qc_complete(qc, ATA_ERR, 0);
-	goto out;
+	ata_qc_complete(qc, ATA_ERR);
 }
 
 int ata_port_start (struct ata_port *ap)
@@ -2883,7 +2834,7 @@
 	ap->prd = pci_alloc_consistent(pdev, ATA_PRD_TBL_SZ, &ap->prd_dma);
 	if (!ap->prd)
 		return -ENOMEM;
-	
+
 	DPRINTK("prd alloc, virt %p, dma %llx\n", ap->prd, (unsigned long long) ap->prd_dma);
 
 	return 0;
@@ -2896,10 +2847,25 @@
 	pci_free_consistent(pdev, ATA_PRD_TBL_SZ, ap->prd, ap->prd_dma);
 }
 
+static void ata_probe_task(void *_data)
+{
+	struct ata_port *ap = _data;
+	long timeout;
+
+	timeout = ata_thread_iter(ap);
+	if (timeout < 0)
+		return;
+
+	if (timeout > 0)
+		queue_delayed_work(ata_wq, &ap->probe_task, timeout);
+	else
+		queue_work(ata_wq, &ap->probe_task);
+}
+
 /**
- *	ata_host_remove -
- *	@ap:
- *	@do_unregister:
+ *	ata_host_remove - Unregister SCSI host structure with upper layers
+ *	@ap: Port to unregister
+ *	@do_unregister: 1 if we fully unregister, 0 to just stop the port
  *
  *	LOCKING:
  */
@@ -2913,16 +2879,16 @@
 	if (do_unregister)
 		scsi_remove_host(sh);
 
-	ata_thread_kill(ap);	/* FIXME: check return val */
-
 	ap->ops->port_stop(ap);
 }
 
 /**
- *	ata_host_init -
- *	@host:
- *	@ent:
- *	@port_no:
+ *	ata_host_init - Initialize an ata_port structure
+ *	@ap: Structure to initialize
+ *	@host: associated SCSI mid-layer structure
+ *	@host_set: Collection of hosts to which @ap belongs
+ *	@ent: Probe information provided by low-level driver
+ *	@port_no: Port number associated with this ata_port
  *
  *	LOCKING:
  *
@@ -2958,21 +2924,14 @@
 	ap->active_tag = ATA_TAG_POISON;
 	ap->last_ctl = 0xFF;
 
-	/* ata_engine init */
-	ap->eng.flags = 0;
-	INIT_LIST_HEAD(&ap->eng.q);
+	INIT_WORK(&ap->packet_task, atapi_packet_task, ap);
+	INIT_WORK(&ap->pio_task, ata_pio_task, ap);
+	INIT_WORK(&ap->probe_task, ata_probe_task, ap);
 
 	for (i = 0; i < ATA_MAX_DEVICES; i++)
 		ap->device[i].devno = i;
 
-	init_completion(&ap->thr_exited);
 	init_MUTEX_LOCKED(&ap->probe_sem);
-	init_MUTEX_LOCKED(&ap->sem);
-	init_MUTEX_LOCKED(&ap->thr_sem);
-
-	init_timer(&ap->thr_timer);
-	ap->thr_timer.function = ata_thread_timer;
-	ap->thr_timer.data = (unsigned long) ap;
 
 #ifdef ATA_IRQ_TRAP
 	ap->stats.unhandled_irq = 1;
@@ -2983,10 +2942,10 @@
 }
 
 /**
- *	ata_host_add -
- *	@ent:
- *	@host_set:
- *	@port_no:
+ *	ata_host_add - Attach low-level ATA driver to system
+ *	@ent: Information provided by low-level driver
+ *	@host_set: Collections of ports to which we add
+ *	@port_no: Port number associated with this host
  *
  *	LOCKING:
  *
@@ -3015,18 +2974,8 @@
 	if (rc)
 		goto err_out;
 
-	ap->thr_pid = kernel_thread(ata_thread, ap, CLONE_FS | CLONE_FILES);
-	if (ap->thr_pid < 0) {
-		printk(KERN_ERR "ata%d: unable to start kernel thread\n",
-		       ap->id);
-		goto err_out_free;
-	}
-
 	return ap;
 
-err_out_free:
-	ap->ops->port_stop(ap);
-
 err_out:
 	scsi_host_put(host);
 	return NULL;
@@ -3106,7 +3055,7 @@
 		ap = host_set->ports[i];
 
 		DPRINTK("ata%u: probe begin\n", ap->id);
-		up(&ap->sem);		/* start probe */
+		queue_work(ata_wq, &ap->probe_task);	/* start probe */
 
 		DPRINTK("ata%u: probe-wait begin\n", ap->id);
 		down(&ap->probe_sem);	/* wait for end */
@@ -3152,7 +3101,7 @@
  *	ata_scsi_release - SCSI layer callback hook for host unload
  *	@host: libata host to be unloaded
  *
- *	Performs all duties necessary to shut down a libata port:
+ *	Performs all duties necessary to shut down a libata port...
  *	Kill port kthread, disable port, and release resources.
  *
  *	LOCKING:
@@ -3177,7 +3126,7 @@
 
 /**
  *	ata_std_ports - initialize ioaddr with standard port offsets.
- *	@ioaddr:
+ *	@ioaddr: IO address structure to be initialized
  */
 void ata_std_ports(struct ata_ioports *ioaddr)
 {
@@ -3194,10 +3143,10 @@
 }
 
 /**
- *	ata_pci_init_one -
- *	@pdev:
- *	@port_info:
- *	@n_ports:
+ *	ata_pci_init_one - Initialize/register PCI IDE host controller
+ *	@pdev: Controller to be initialized
+ *	@port_info: Information from low-level host driver
+ *	@n_ports: Number of ports attached to host controller
  *
  *	LOCKING:
  *	Inherited from PCI layer (may sleep).
@@ -3489,11 +3438,21 @@
 
 static int __init ata_init(void)
 {
+	ata_wq = create_workqueue("ata");
+	if (!ata_wq)
+		return -ENOMEM;
+
 	printk(KERN_DEBUG "libata version " DRV_VERSION " loaded.\n");
 	return 0;
 }
 
+static void __exit ata_exit(void)
+{
+	destroy_workqueue(ata_wq);
+}
+
 module_init(ata_init);
+module_exit(ata_exit);
 
 /*
  * libata is essentially a library of internal helper functions for
@@ -3512,6 +3471,8 @@
 EXPORT_SYMBOL_GPL(ata_tf_load_mmio);
 EXPORT_SYMBOL_GPL(ata_tf_read_pio);
 EXPORT_SYMBOL_GPL(ata_tf_read_mmio);
+EXPORT_SYMBOL_GPL(ata_tf_to_fis);
+EXPORT_SYMBOL_GPL(ata_tf_from_fis);
 EXPORT_SYMBOL_GPL(ata_check_status_pio);
 EXPORT_SYMBOL_GPL(ata_check_status_mmio);
 EXPORT_SYMBOL_GPL(ata_exec_command_pio);
@@ -3520,7 +3481,9 @@
 EXPORT_SYMBOL_GPL(ata_port_stop);
 EXPORT_SYMBOL_GPL(ata_interrupt);
 EXPORT_SYMBOL_GPL(ata_fill_sg);
+EXPORT_SYMBOL_GPL(ata_bmdma_setup_pio);
 EXPORT_SYMBOL_GPL(ata_bmdma_start_pio);
+EXPORT_SYMBOL_GPL(ata_bmdma_setup_mmio);
 EXPORT_SYMBOL_GPL(ata_bmdma_start_mmio);
 EXPORT_SYMBOL_GPL(ata_port_probe);
 EXPORT_SYMBOL_GPL(sata_phy_reset);
@@ -3533,3 +3496,4 @@
 EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
 EXPORT_SYMBOL_GPL(ata_scsi_release);
 EXPORT_SYMBOL_GPL(ata_host_intr);
+EXPORT_SYMBOL_GPL(ata_dev_id_string);
diff -Nru a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
--- a/drivers/scsi/libata-scsi.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/libata-scsi.c	Tue Jun 15 22:20:39 2004
@@ -27,7 +27,7 @@
 #include <linux/spinlock.h>
 #include <scsi/scsi.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #include "libata.h"
@@ -46,8 +46,8 @@
  *	@geom: location to which geometry will be output
  *
  *	Generic bios head/sector/cylinder calculator
- *	used by sd. Most BIOSes nowadays expect a XXX/255/16  (CHS) 
- *	mapping. Some situations may arise where the disk is not 
+ *	used by sd. Most BIOSes nowadays expect a XXX/255/16  (CHS)
+ *	mapping. Some situations may arise where the disk is not
  *	bootable if this is not used.
  *
  *	LOCKING:
@@ -57,7 +57,7 @@
  *	Zero.
  */
 int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
-		       sector_t capacity, int geom[]) 
+		       sector_t capacity, int geom[])
 {
 	geom[0] = 255;
 	geom[1] = 63;
@@ -167,8 +167,27 @@
 {
 	sdev->use_10_for_rw = 1;
 	sdev->use_10_for_ms = 1;
+
 	blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD);
 
+	if (sdev->id < ATA_MAX_DEVICES) {
+		struct ata_port *ap;
+		struct ata_device *dev;
+
+		ap = (struct ata_port *) &sdev->host->hostdata[0];
+		dev = &ap->device[sdev->id];
+
+		/* TODO: 1024 is an arbitrary number, not the
+		 * hardware maximum.  This should be increased to
+		 * 65534 when Jens Axboe's patch for dynamically
+		 * determining max_sectors is merged.
+		 */
+		if (dev->flags & ATA_DFLAG_LBA48) {
+			sdev->host->max_sectors = 2048;
+			blk_queue_max_sectors(sdev->request_queue, 2048);
+		}
+	}
+
 	return 0;	/* scsi layer doesn't check return value, sigh */
 }
 
@@ -321,6 +340,7 @@
  *	@dev: ATA device to which the command is addressed
  *	@cmd: SCSI command to execute
  *	@done: SCSI command completion function
+ *	@xlat_func: Actor which translates @cmd to an ATA taskfile
  *
  *	Our ->queuecommand() function has decided that the SCSI
  *	command issued can be directly translated into an ATA
@@ -343,19 +363,20 @@
 
 	VPRINTK("ENTER\n");
 
-	if (unlikely(cmd->request_bufflen < 1)) {
-		printk(KERN_WARNING "ata%u(%u): empty request buffer\n",
-		       ap->id, dev->devno);
-		goto err_out;
-	}
-
 	qc = ata_scsi_qc_new(ap, dev, cmd, done);
 	if (!qc)
 		return;
 
 	if (cmd->sc_data_direction == SCSI_DATA_READ ||
-	    cmd->sc_data_direction == SCSI_DATA_WRITE)
+	    cmd->sc_data_direction == SCSI_DATA_WRITE) {
+		if (unlikely(cmd->request_bufflen < 1)) {
+			printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n",
+			       ap->id, dev->devno);
+			goto err_out;
+		}
+
 		qc->flags |= ATA_QCFLAG_SG; /* data is present; dma-map it */
+	}
 
 	if (xlat_func(qc, scsicmd))
 		goto err_out;
@@ -478,7 +499,9 @@
 unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
 			       unsigned int buflen)
 {
-	const u8 hdr[] = {
+	struct ata_device *dev = args->dev;
+
+	u8 hdr[] = {
 		TYPE_DISK,
 		0,
 		0x5,	/* claim SPC-3 version compatibility */
@@ -486,14 +509,20 @@
 		96 - 4
 	};
 
+	/* set scsi removeable (RMB) bit per ata bit */
+	if (ata_id_removeable(dev))
+		hdr[1] |= (1 << 7);
+
 	VPRINTK("ENTER\n");
 
 	memcpy(rbuf, hdr, sizeof(hdr));
 
 	if (buflen > 36) {
-		memcpy(&rbuf[8], args->dev->vendor, 8);
-		memcpy(&rbuf[16], args->dev->product, 16);
-		memcpy(&rbuf[32], DRV_VERSION, 4);
+		memcpy(&rbuf[8], "ATA     ", 8);
+		ata_dev_id_string(dev, &rbuf[16], ATA_ID_PROD_OFS, 16);
+		ata_dev_id_string(dev, &rbuf[32], ATA_ID_FW_REV_OFS, 4);
+		if (rbuf[32] == 0 || rbuf[32] == ' ')
+			memcpy(&rbuf[32], "n/a ", 4);
 	}
 
 	if (buflen > 63) {
@@ -667,9 +696,17 @@
 static unsigned int ata_msense_caching(struct ata_device *dev, u8 **ptr_io,
 				       const u8 *last)
 {
-	u8 page[7] = { 0xf, 0, 0x10, 0, 0x8, 0xa, 0 };
-	if (dev->flags & ATA_DFLAG_WCACHE)
-		page[6] = 0x4;
+	u8 page[] = {
+		0x8,				/* page code */
+		0x12,				/* page length */
+		0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 10 zeroes */
+		0, 0, 0, 0, 0, 0, 0, 0		/* 8 zeroes */
+	};
+
+	if (ata_id_wcache_enabled(dev))
+		page[2] |= (1 << 2);	/* write cache enable */
+	if (!ata_id_rahead_enabled(dev))
+		page[12] |= (1 << 5);	/* disable read ahead */
 
 	ata_msense_push(ptr_io, last, page, sizeof(page));
 	return sizeof(page);
@@ -696,6 +733,31 @@
 }
 
 /**
+ *	ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page
+ *	@dev: Device associated with this MODE SENSE command
+ *	@ptr_io: (input/output) Location to store more output data
+ *	@last: End of output data buffer
+ *
+ *	Generate a generic MODE SENSE r/w error recovery page.
+ *
+ *	LOCKING:
+ *	None.
+ */
+
+static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last)
+{
+	const u8 page[] = {
+		0x1,			  /* page code */
+		0xa,			  /* page length */
+		(1 << 7) | (1 << 6),	  /* note auto r/w reallocation */
+		0, 0, 0, 0, 0, 0, 0, 0, 0 /* 9 zeroes */
+	};
+
+	ata_msense_push(ptr_io, last, page, sizeof(page));
+	return sizeof(page);
+}
+
+/**
  *	ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands
  *	@args: Port / device / SCSI command of interest.
  *	@rbuf: Response buffer, to which simulated SCSI cmd output is sent.
@@ -734,6 +796,10 @@
 	last = rbuf + buflen - 1;
 
 	switch(scsicmd[2] & 0x3f) {
+	case 0x01:		/* r/w error recovery */
+		output_len += ata_msense_rw_recovery(&p, last);
+		break;
+
 	case 0x08:		/* caching */
 		output_len += ata_msense_caching(dev, &p, last);
 		break;
@@ -744,6 +810,7 @@
 		}
 
 	case 0x3f:		/* all pages */
+		output_len += ata_msense_rw_recovery(&p, last);
 		output_len += ata_msense_caching(dev, &p, last);
 		output_len += ata_msense_ctl_mode(&p, last);
 		break;
@@ -784,20 +851,23 @@
 
 	VPRINTK("ENTER\n");
 
-	n_sectors--;		/* one off */
+	n_sectors--;		/* ATA TotalUserSectors - 1 */
 
 	tmp = n_sectors;	/* note: truncates, if lba48 */
 	if (args->cmd->cmnd[0] == READ_CAPACITY) {
+		/* sector count, 32-bit */
 		rbuf[0] = tmp >> (8 * 3);
 		rbuf[1] = tmp >> (8 * 2);
 		rbuf[2] = tmp >> (8 * 1);
 		rbuf[3] = tmp;
 
+		/* sector size */
 		tmp = ATA_SECT_SIZE;
 		rbuf[6] = tmp >> 8;
 		rbuf[7] = tmp;
 
 	} else {
+		/* sector count, 64-bit */
 		rbuf[2] = n_sectors >> (8 * 7);
 		rbuf[3] = n_sectors >> (8 * 6);
 		rbuf[4] = n_sectors >> (8 * 5);
@@ -807,6 +877,7 @@
 		rbuf[8] = tmp >> (8 * 1);
 		rbuf[9] = tmp;
 
+		/* sector size */
 		tmp = ATA_SECT_SIZE;
 		rbuf[12] = tmp >> 8;
 		rbuf[13] = tmp;
@@ -866,56 +937,20 @@
 }
 
 /**
- *	atapi_scsi_queuecmd - Send CDB to ATAPI device
- *	@ap: Port to which ATAPI device is attached.
- *	@dev: Target device for CDB.
- *	@cmd: SCSI command being sent to device.
- *	@done: SCSI command completion function.
- *
- *	Sends CDB to ATAPI device.  If the Linux SCSI layer sends a
- *	non-data command, then this function handles the command
- *	directly, via polling.  Otherwise, the bmdma engine is started.
+ *	atapi_xlat - Initialize PACKET taskfile
+ *	@qc: command structure to be initialized
+ *	@scsicmd: SCSI CDB associated with this PACKET command
  *
  *	LOCKING:
  *	spin_lock_irqsave(host_set lock)
+ *
+ *	RETURNS:
+ *	Zero on success, non-zero on failure.
  */
 
-static void atapi_scsi_queuecmd(struct ata_port *ap, struct ata_device *dev,
-			       struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
+static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
 {
-	struct ata_queued_cmd *qc;
-	u8 *scsicmd = cmd->cmnd, status;
-	unsigned int doing_dma = 0;
-
-	VPRINTK("ENTER, drv_stat = 0x%x\n", ata_chk_status(ap));
-
-	if (cmd->sc_data_direction == SCSI_DATA_UNKNOWN) {
-		DPRINTK("unknown data, scsicmd 0x%x\n", scsicmd[0]);
-		ata_bad_cdb(cmd, done);
-		return;
-	}
-
-	switch(scsicmd[0]) {
-	case READ_6:
-	case WRITE_6:
-	case MODE_SELECT:
-	case MODE_SENSE:
-		DPRINTK("read6/write6/modesel/modesense trap\n");
-		ata_bad_scsiop(cmd, done);
-		return;
-
-	default:
-		/* do nothing */
-		break;
-	}
-
-	qc = ata_scsi_qc_new(ap, dev, cmd, done);
-	if (!qc) {
-		printk(KERN_ERR "ata%u: command queue empty\n", ap->id);
-		return;
-	}
-
-	qc->flags |= ATA_QCFLAG_ATAPI;
+	struct scsi_cmnd *cmd = qc->scsicmd;
 
 	qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
 	if (cmd->sc_data_direction == SCSI_DATA_WRITE) {
@@ -925,52 +960,30 @@
 
 	qc->tf.command = ATA_CMD_PACKET;
 
-	/* set up SG table */
-	if (cmd->sc_data_direction == SCSI_DATA_NONE) {
-		ap->active_tag = qc->tag;
-		qc->flags |= ATA_QCFLAG_ACTIVE | ATA_QCFLAG_POLL;
+	/* no data - interrupt-driven */
+	if (cmd->sc_data_direction == SCSI_DATA_NONE)
 		qc->tf.protocol = ATA_PROT_ATAPI;
 
-		ata_dev_select(ap, dev->devno, 1, 0);
+	/* PIO data xfer - polling */
+	else if ((qc->flags & ATA_QCFLAG_DMA) == 0) {
+		ata_qc_set_polling(qc);
+		qc->tf.protocol = ATA_PROT_ATAPI;
+		qc->tf.lbam = (8 * 1024) & 0xff;
+		qc->tf.lbah = (8 * 1024) >> 8;
 
-		DPRINTK("direction: none\n");
-		qc->tf.ctl |= ATA_NIEN;	/* disable interrupts */
-		ata_tf_to_host_nolock(ap, &qc->tf);
+	/* DMA data xfer - interrupt-driven */
 	} else {
-		qc->flags |= ATA_QCFLAG_SG; /* data is present; dma-map it */
-		qc->tf.feature = ATAPI_PKT_DMA;
 		qc->tf.protocol = ATA_PROT_ATAPI_DMA;
+		qc->tf.feature |= ATAPI_PKT_DMA;
 
-		doing_dma = 1;
-
-		/* select device, send command to hardware */
-		if (ata_qc_issue(qc))
-			goto err_out;
-	}
-
-	status = ata_busy_wait(ap, ATA_BUSY, 1000);
-	if (status & ATA_BUSY) {
-		ata_thread_wake(ap, THR_PACKET);
-		return;
+#ifdef ATAPI_ENABLE_DMADIR
+		/* some SATA bridges need us to indicate data xfer direction */
+		if (cmd->sc_data_direction != SCSI_DATA_WRITE)
+			qc->tf.feature |= ATAPI_DMADIR;
+#endif
 	}
-	if ((status & ATA_DRQ) == 0)
-		goto err_out;
 
-	/* FIXME: mmio-ize */
-	DPRINTK("writing cdb\n");
-	outsl(ap->ioaddr.data_addr, scsicmd, ap->host->max_cmd_len / 4);
-
-	if (!doing_dma)
-		ata_thread_wake(ap, THR_PACKET);
-
-	VPRINTK("EXIT\n");
-	return;
-
-err_out:
-	if (!doing_dma)
-		ata_irq_on(ap);	/* re-enable interrupts */
-	ata_bad_cdb(cmd, done);
-	DPRINTK("EXIT - badcmd\n");
+	return 0;
 }
 
 /**
@@ -1109,7 +1122,7 @@
 		else
 			ata_scsi_simulate(ap, dev, cmd, done);
 	} else
-		atapi_scsi_queuecmd(ap, dev, cmd, done);
+		ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);
 
 out_unlock:
 	return 0;
@@ -1142,7 +1155,12 @@
 	args.done = done;
 
 	switch(scsicmd[0]) {
-		case TEST_UNIT_READY:		/* FIXME: correct? */
+		/* no-op's, complete with success */
+		case SYNCHRONIZE_CACHE:		/* FIXME: temporary */
+		case REZERO_UNIT:
+		case SEEK_6:
+		case SEEK_10:
+		case TEST_UNIT_READY:
 		case FORMAT_UNIT:		/* FIXME: correct? */
 		case SEND_DIAGNOSTIC:		/* FIXME: correct? */
 			ata_scsi_rbuf_fill(&args, ata_scsiop_noop);
diff -Nru a/drivers/scsi/libata.h b/drivers/scsi/libata.h
--- a/drivers/scsi/libata.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/scsi/libata.h	Tue Jun 15 22:20:37 2004
@@ -35,17 +35,13 @@
 	void			(*done)(struct scsi_cmnd *);
 };
 
-
 /* libata-core.c */
-extern void ata_dev_id_string(struct ata_device *dev, unsigned char *s,
-			      unsigned int ofs, unsigned int len);
 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
 				      struct ata_device *dev);
 extern int ata_qc_issue(struct ata_queued_cmd *qc);
 extern void ata_dev_select(struct ata_port *ap, unsigned int device,
                            unsigned int wait, unsigned int can_sleep);
 extern void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf);
-extern void ata_thread_wake(struct ata_port *ap, unsigned int thr_state);
 
 
 /* libata-scsi.c */
diff -Nru a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
--- a/drivers/scsi/megaraid.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/scsi/megaraid.c	Tue Jun 15 22:20:35 2004
@@ -4606,6 +4606,7 @@
 
 	if (pci_enable_device(pdev))
 		goto out;
+	pci_set_master(pdev);
 
 	pci_bus = pdev->bus->number;
 	pci_dev_func = pdev->devfn;
diff -Nru a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
--- a/drivers/scsi/ncr53c8xx.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/scsi/ncr53c8xx.c	Tue Jun 15 22:20:38 2004
@@ -307,7 +307,7 @@
 **    The maximum number of segments a transfer is split into.
 **    We support up to 127 segments for both read and write.
 **    The data scripts are broken into 2 sub-scripts.
-**    80 (MAX_SCATTERL) segments are moved from a sub-script 
+**    80 (MAX_SCATTERL) segments are moved from a sub-script
 **    in on-chip RAM. This makes data transfers shorter than 
 **    80k (assuming 1k fs) as fast as possible.
 */
@@ -4542,7 +4542,7 @@
 	/*
 	**	command
 	*/
-	memcpy(cp->cdb_buf, cmd->cmnd, MIN(cmd->cmd_len, sizeof(cp->cdb_buf)));
+	memcpy(cp->cdb_buf, cmd->cmnd, min_t(int, cmd->cmd_len, sizeof(cp->cdb_buf)));
 	cp->phys.cmd.addr		= cpu_to_scr(CCB_PHYS (cp, cdb_buf[0]));
 	cp->phys.cmd.size		= cpu_to_scr(cmd->cmd_len);
 
@@ -5172,7 +5172,7 @@
 		**	Copy back sense data to caller's buffer.
 		*/
 		memcpy(cmd->sense_buffer, cp->sense_buf,
-		       MIN(sizeof(cmd->sense_buffer), sizeof(cp->sense_buf)));
+		       min(sizeof(cmd->sense_buffer), sizeof(cp->sense_buf)));
 
 		if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) {
 			u_char * p = (u_char*) & cmd->sense_buffer;
diff -Nru a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
--- a/drivers/scsi/nsp32.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/nsp32.c	Tue Jun 15 22:20:39 2004
@@ -38,7 +38,6 @@
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/ctype.h>
-#include <linux/interrupt.h>
 
 #include <asm/dma.h>
 #include <asm/system.h>
@@ -859,7 +858,7 @@
 	 * or current nexus is not existed, unexpected
 	 * reselection is occurred. Send reject message.
 	 */
-	if (newid >= NUMBER(data->lunt) || newlun >= NUMBER(data->lunt[0])) {
+	if (newid >= ARRAY_SIZE(data->lunt) || newlun >= ARRAY_SIZE(data->lunt[0])) {
 		nsp32_msg(KERN_WARNING, "unknown id/lun");
 		return FALSE;
 	} else if(data->lunt[newid][newlun].SCpnt == NULL) {
@@ -1568,7 +1567,7 @@
 
 
 	SPRINTF("SDTR status\n");
-	for(id = 0; id < NUMBER(data->target); id++) {
+	for (id = 0; id < ARRAY_SIZE(data->target); id++) {
 
                 SPRINTF("id %d: ", id);
 
@@ -1610,7 +1609,7 @@
         }
 
 
-	thislength = MIN(thislength, length);
+	thislength = min(thislength, length);
 	*start = buffer + offset;
 
 	return thislength;
@@ -2753,17 +2752,17 @@
 	case CLOCK_4:
 		/* If data->clock is CLOCK_4, then select 40M sync table. */
 		data->synct   = nsp32_sync_table_40M;
-		data->syncnum = NUMBER(nsp32_sync_table_40M);
+		data->syncnum = ARRAY_SIZE(nsp32_sync_table_40M);
 		break;
 	case CLOCK_2:
 		/* If data->clock is CLOCK_2, then select 20M sync table. */
 		data->synct   = nsp32_sync_table_20M;
-		data->syncnum = NUMBER(nsp32_sync_table_20M);
+		data->syncnum = ARRAY_SIZE(nsp32_sync_table_20M);
 		break;
 	case PCICLK:
 		/* If data->clock is PCICLK, then select pci sync table. */
 		data->synct   = nsp32_sync_table_pci;
-		data->syncnum = NUMBER(nsp32_sync_table_pci);
+		data->syncnum = ARRAY_SIZE(nsp32_sync_table_pci);
 		break;
 	default:
 		nsp32_msg(KERN_WARNING,
@@ -2771,7 +2770,7 @@
 		/* Use default value CLOCK_4 */
 		data->clock   = CLOCK_4;
 		data->synct   = nsp32_sync_table_40M;
-		data->syncnum = NUMBER(nsp32_sync_table_40M);
+		data->syncnum = ARRAY_SIZE(nsp32_sync_table_40M);
 	}
 
 	/*
@@ -2805,9 +2804,9 @@
 		goto free_autoparam;
 	}
 
-	for (i = 0; i < NUMBER(data->lunt); i++) {
-		for (j = 0; j < NUMBER(data->lunt[0]); j++) {
-			int offset = i * NUMBER(data->lunt[0]) + j;
+	for (i = 0; i < ARRAY_SIZE(data->lunt); i++) {
+		for (j = 0; j < ARRAY_SIZE(data->lunt[0]); j++) {
+			int offset = i * ARRAY_SIZE(data->lunt[0]) + j;
 			nsp32_lunt tmp = {
 				.SCpnt       = NULL,
 				.save_datp   = 0,
@@ -2825,7 +2824,7 @@
 	/*
 	 * setup target
 	 */
-	for (i = 0; i < NUMBER(data->target); i++) {
+	for (i = 0; i < ARRAY_SIZE(data->target); i++) {
 		nsp32_target *target = &(data->target[i]);
 
 		target->limit_entry  = 0;
@@ -3021,7 +3020,7 @@
 	 * fall back to asynchronous transfer mode
 	 * initialize SDTR negotiation flag
 	 */
-	for (i = 0; i < NUMBER(data->target); i++) {
+	for (i = 0; i < ARRAY_SIZE(data->target); i++) {
 		nsp32_target *target = &data->target[i];
 
 		target->sync_flag = 0;
diff -Nru a/drivers/scsi/nsp32.h b/drivers/scsi/nsp32.h
--- a/drivers/scsi/nsp32.h	Tue Jun 15 22:20:35 2004
+++ b/drivers/scsi/nsp32.h	Tue Jun 15 22:20:35 2004
@@ -70,11 +70,7 @@
 /*
  * MACRO
  */
-#define NUMBER(arr) ((int) (sizeof(arr) / sizeof(arr[0])))
 #define BIT(x)      (1UL << (x))
-#ifndef MIN
-# define MIN(a,b)   ((a) > (b) ? (b) : (a))
-#endif
 
 /*
  * BASIC Definitions
diff -Nru a/drivers/scsi/osst.c b/drivers/scsi/osst.c
--- a/drivers/scsi/osst.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/osst.c	Tue Jun 15 22:20:40 2004
@@ -154,8 +154,8 @@
 static OSST_buffer *new_tape_buffer(int, int, int);
 static int enlarge_buffer(OSST_buffer *, int);
 static void normalize_buffer(OSST_buffer *);
-static int append_to_buffer(const char *, OSST_buffer *, int);
-static int from_buffer(OSST_buffer *, char *, int);
+static int append_to_buffer(const char __user *, OSST_buffer *, int);
+static int from_buffer(OSST_buffer *, char __user *, int);
 static int osst_zero_buffer_tail(OSST_buffer *);
 static int osst_copy_to_buffer(OSST_buffer *, unsigned char *);
 static int osst_copy_from_buffer(OSST_buffer *, unsigned char *);
@@ -3157,13 +3157,13 @@
 /* Entry points to osst */
 
 /* Write command */
-static ssize_t osst_write(struct file * filp, const char * buf, size_t count, loff_t *ppos)
+static ssize_t osst_write(struct file * filp, const char __user * buf, size_t count, loff_t *ppos)
 {
 	ssize_t        total, retval = 0;
 	ssize_t        i, do_count, blks, transfer;
 	int            write_threshold;
 	int            doing_write = 0;
-	const char   * b_point;
+	const char   __user * b_point;
 	Scsi_Request * SRpnt = NULL;
 	ST_mode      * STm;
 	ST_partstat  * STps;
@@ -3486,7 +3486,7 @@
 
 
 /* Read command */
-static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
+static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, loff_t *ppos)
 {
 	ssize_t        total, retval = 0;
 	ssize_t        i, transfer;
@@ -4725,6 +4725,7 @@
 	Scsi_Request * SRpnt = NULL;
 	OS_Scsi_Tape * STp   = file->private_data;
 	char         * name  = tape_name(STp);
+	void __user *p = (void __user *)arg;
 
 	if (down_interruptible(&STp->lock))
 		return -ERESTARTSYS;
@@ -4765,7 +4766,7 @@
 			goto out;
 		}
 
-		i = copy_from_user((char *) &mtc, (char *)arg, sizeof(struct mtop));
+		i = copy_from_user((char *) &mtc, p, sizeof(struct mtop));
 		if (i) {
 			retval = (-EFAULT);
 			goto out;
@@ -5003,8 +5004,7 @@
 		    STp->drv_buffer != 0)
 			mt_status.mt_gstat |= GMT_IM_REP_EN(0xffffffff);
 
-		i = copy_to_user((char *)arg, (char *)&mt_status,
-		      sizeof(struct mtget));
+		i = copy_to_user(p, &mt_status, sizeof(struct mtget));
 		if (i) {
 			retval = (-EFAULT);
 			goto out;
@@ -5031,7 +5031,7 @@
 			goto out;
 		}
 		mt_pos.mt_blkno = blk;
-		i = copy_to_user((char *)arg, (char *) (&mt_pos), sizeof(struct mtpos));
+		i = copy_to_user(p, &mt_pos, sizeof(struct mtpos));
 		if (i)
 			retval = -EFAULT;
 		goto out;
@@ -5040,7 +5040,7 @@
 
 	up(&STp->lock);
 
-	return scsi_ioctl(STp->device, cmd_in, (void *) arg);
+	return scsi_ioctl(STp->device, cmd_in, p);
 
 out:
 	if (SRpnt) scsi_release_request(SRpnt);
@@ -5189,7 +5189,7 @@
 
 /* Move data from the user buffer to the tape buffer. Returns zero (success) or
    negative error code. */
-static int append_to_buffer(const char *ubp, OSST_buffer *st_bp, int do_count)
+static int append_to_buffer(const char __user *ubp, OSST_buffer *st_bp, int do_count)
 {
 	int i, cnt, res, offset;
 
@@ -5222,7 +5222,7 @@
 
 /* Move data from the tape buffer to the user buffer. Returns zero (success) or
    negative error code. */
-static int from_buffer(OSST_buffer *st_bp, char *ubp, int do_count)
+static int from_buffer(OSST_buffer *st_bp, char __user *ubp, int do_count)
 {
 	int i, cnt, res, offset;
 
diff -Nru a/drivers/scsi/pci2000.c b/drivers/scsi/pci2000.c
--- a/drivers/scsi/pci2000.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/pci2000.c	Tue Jun 15 22:20:42 2004
@@ -353,7 +353,7 @@
 		if ( WaitReady (padapter) )
 			{
 			OpDone (SCpnt, DID_TIME_OUT << 16);
-			goto irq_return;;
+			goto irq_return;
 			}
 
 		outb_p (tag0, padapter->mb0);										// get real error code
@@ -361,7 +361,7 @@
 		if ( WaitReady (padapter) )											// wait for controller to suck up the op
 			{
 			OpDone (SCpnt, DID_TIME_OUT << 16);
-			goto irq_return;;
+			goto irq_return;
 			}
 
 		error = inl (padapter->mb0);										// get error data
@@ -374,16 +374,16 @@
 			if ( bus )														// are we doint SCSI commands?
 				{
 				OpDone (SCpnt, (DID_OK << 16) | 2);
-				goto irq_return;;
+				goto irq_return;
 				}
 			if ( *SCpnt->cmnd == SCSIOP_TEST_UNIT_READY )
 				OpDone (SCpnt, (DRIVER_SENSE << 24) | (DID_OK << 16) | 2);	// test caller we have sense data too
 			else
 				OpDone (SCpnt, DID_ERROR << 16);
-			goto irq_return;;
+			goto irq_return;
 			}
 		OpDone (SCpnt, DID_ERROR << 16);
-		goto irq_return;;
+		goto irq_return;
 		}
 
 	outb_p (0xFF, padapter->tag);											// clear the op interrupt
diff -Nru a/drivers/scsi/pcmcia/Kconfig b/drivers/scsi/pcmcia/Kconfig
--- a/drivers/scsi/pcmcia/Kconfig	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/pcmcia/Kconfig	Tue Jun 15 22:20:42 2004
@@ -69,4 +69,14 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called qlogic_cs.
 
+config PCMCIA_SYM53C500
+	tristate "Symbios 53c500 PCMCIA support"
+	depends on m
+	help
+	  Say Y here if you have a New Media Bus Toaster or other PCMCIA
+	  SCSI adapter based on the Symbios 53c500 controller.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called sym53c500_cs.
+
 endmenu
diff -Nru a/drivers/scsi/pcmcia/Makefile b/drivers/scsi/pcmcia/Makefile
--- a/drivers/scsi/pcmcia/Makefile	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/pcmcia/Makefile	Tue Jun 15 22:20:40 2004
@@ -6,7 +6,8 @@
 obj-$(CONFIG_PCMCIA_FDOMAIN)	+= fdomain_cs.o
 obj-$(CONFIG_PCMCIA_AHA152X)	+= aha152x_cs.o
 obj-$(CONFIG_PCMCIA_NINJA_SCSI)	+= nsp_cs.o
+obj-$(CONFIG_PCMCIA_SYM53C500)	+= sym53c500_cs.o
 
 aha152x_cs-objs	:= aha152x_stub.o aha152x_core.o
 fdomain_cs-objs	:= fdomain_stub.o fdomain_core.o
-qlogic_cs-objs	:= qlogic_stub.o qlogic_core.o
+qlogic_cs-objs	:= qlogic_stub.o
diff -Nru a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
--- a/drivers/scsi/pcmcia/nsp_cs.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/scsi/pcmcia/nsp_cs.c	Tue Jun 15 22:21:04 2004
@@ -38,7 +38,6 @@
 #include <linux/ioport.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
 #include <linux/major.h>
 #include <linux/blkdev.h>
 #include <linux/stat.h>
@@ -315,7 +314,7 @@
 	int i;
 
 	/* setup sync data */
-	for ( i = 0; i < NUMBER(data->Sync); i++ ) {
+	for ( i = 0; i < ARRAY_SIZE(data->Sync); i++ ) {
 		data->Sync[i] = tmp_sync;
 	}
 }
@@ -600,7 +599,7 @@
 	unsigned int  base = SCpnt->device->host->io_port;
 	nsp_hw_data  *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
 	char	     *buf  = data->MsgBuffer;
-	int	      len  = MIN(MSGBUF_SIZE, data->MsgLen);
+	int	      len  = min(MSGBUF_SIZE, data->MsgLen);
 	int	      ptr;
 	int	      ret;
 
@@ -774,7 +773,7 @@
 			continue;
 		}
 
-		res = MIN(res, SCpnt->SCp.this_residual);
+		res = min(res, SCpnt->SCp.this_residual);
 
 		switch (data->TransferMode) {
 		case MODE_IO32:
@@ -868,7 +867,7 @@
 			continue;
 		}
 
-		res = MIN(SCpnt->SCp.this_residual, WFIFO_CRIT);
+		res = min(SCpnt->SCp.this_residual, WFIFO_CRIT);
 
 		//nsp_dbg(NSP_DEBUG_DATA_IO, "ptr=0x%p this=0x%x res=0x%x", SCpnt->SCp.ptr, SCpnt->SCp.this_residual, res);
 		switch (data->TransferMode) {
@@ -1490,7 +1489,7 @@
 	spin_unlock_irqrestore(&(data->Lock), flags);
 
 	SPRINTF("SDTR status\n");
-	for(id = 0; id < NUMBER(data->Sync); id++) {
+	for(id = 0; id < ARRAY_SIZE(data->Sync); id++) {
 
 		SPRINTF("id %d: ", id);
 
@@ -1534,7 +1533,7 @@
         }
 
 
-	thislength = MIN(thislength, length);
+	thislength = min(thislength, length);
 	*start = buffer + offset;
 
 	return thislength;
diff -Nru a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
--- a/drivers/scsi/pcmcia/nsp_cs.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/pcmcia/nsp_cs.h	Tue Jun 15 22:20:39 2004
@@ -26,9 +26,7 @@
 /************************************
  * Some useful macros...
  */
-#define NUMBER(arr) ((int) (sizeof(arr) / sizeof(arr[0]))) /* from XtNumber() in /usr/X11R6/include/X11/Intrinsic.h */
 #define BIT(x)      (1L << (x))
-#define MIN(a,b)    ((a) > (b) ? (b) : (a))
 
 /* SCSI initiator must be ID 7 */
 #define NSP_INITIATOR_ID  7
diff -Nru a/drivers/scsi/pcmcia/qlogic_core.c b/drivers/scsi/pcmcia/qlogic_core.c
--- a/drivers/scsi/pcmcia/qlogic_core.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2 +0,0 @@
-#define PCMCIA 1
-#include "qlogicfas.c"
diff -Nru a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
--- a/drivers/scsi/pcmcia/qlogic_stub.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/pcmcia/qlogic_stub.c	Tue Jun 15 22:20:41 2004
@@ -47,7 +47,7 @@
 
 #include "scsi.h"
 #include "hosts.h"
-#include "../qlogicfas.h"
+#include "../qlogicfas408.h"
 
 #include <pcmcia/version.h>
 #include <pcmcia/cs_types.h>
@@ -56,13 +56,13 @@
 #include <pcmcia/ds.h>
 #include <pcmcia/ciscode.h>
 
+/* Set the following to 2 to use normal interrupt (active high/totempole-
+ * tristate), otherwise use 0 (REQUIRED FOR PCMCIA) for active low, open
+ * drain
+ */
+#define INT_TYPE	0
 
-extern Scsi_Host_Template qlogicfas_driver_template;
-extern void qlogicfas_preset(int port, int irq);
-extern int qlogicfas_bus_reset(Scsi_Cmnd *);
-extern irqreturn_t do_ql_ihandl(int irq, void *dev_id, struct pt_regs *regs);
-
-static char *qlogic_name = "qlogic_cs";
+static char qlogic_name[] = "qlogic_cs";
 
 #ifdef PCMCIA_DEBUG
 static int pc_debug = PCMCIA_DEBUG;
@@ -73,6 +73,24 @@
 #define DEBUG(n, args...)
 #endif
 
+static Scsi_Host_Template qlogicfas_driver_template = {
+	.module			= THIS_MODULE,
+	.name			= qlogic_name,
+	.proc_name		= qlogic_name,
+	.info			= qlogicfas408_info,
+	.queuecommand		= qlogicfas408_queuecommand,
+	.eh_abort_handler	= qlogicfas408_abort,
+	.eh_bus_reset_handler	= qlogicfas408_bus_reset,
+	.eh_device_reset_handler= qlogicfas408_device_reset,
+	.eh_host_reset_handler	= qlogicfas408_host_reset,
+	.bios_param		= qlogicfas408_biosparam,
+	.can_queue		= 1,
+	.this_id		= -1,
+	.sg_tablesize		= SG_ALL,
+	.cmd_per_lun		= 1,
+	.use_clustering		= DISABLE_CLUSTERING,
+};
+
 /*====================================================================*/
 
 /* Parameters that can be set with 'insmod' */
@@ -110,29 +128,17 @@
 	int qltyp;		/* type of chip */
 	int qinitid;
 	struct Scsi_Host *shost;	/* registered host structure */
-	qlogicfas_priv_t priv;
+	struct qlogicfas408_priv *priv;
 
-	qltyp = inb(qbase + 0xe) & 0xf8;
+	qltyp = qlogicfas408_get_chip_type(qbase, INT_TYPE);
 	qinitid = host->this_id;
 	if (qinitid < 0)
 		qinitid = 7;	/* if no ID, use 7 */
-	outb(1, qbase + 8);	/* set for PIO pseudo DMA */
-	REG0;
-	outb(0x40 | qlcfg8 | qinitid, qbase + 8);	/* (ini) bus id, disable scsi rst */
-	outb(qlcfg5, qbase + 5);	/* select timer */
-	outb(qlcfg9, qbase + 9);	/* prescaler */
-
-#if QL_RESET_AT_START
-	outb(3, qbase + 3);
-	REG1;
-	/* FIXME: timeout */
-	while (inb(qbase + 0xf) & 4)
-		cpu_relax();
-	REG0;
-#endif
+
+	qlogicfas408_setup(qbase, qinitid, INT_TYPE);
 
 	host->name = qlogic_name;
-	shost = scsi_host_alloc(host, sizeof(struct qlogicfas_priv));
+	shost = scsi_host_alloc(host, sizeof(struct qlogicfas408_priv));
 	if (!shost)
 		goto err;
 	shost->io_port = qbase;
@@ -141,12 +147,14 @@
 	if (qlirq != -1)
 		shost->irq = qlirq;
 
-	priv = (qlogicfas_priv_t)&(shost->hostdata[0]);
+	priv = get_priv_by_host(shost);
 	priv->qlirq = qlirq;
 	priv->qbase = qbase;
 	priv->qinitid = qinitid;
+	priv->shost = shost;
+	priv->int_type = INT_TYPE;					
 
-	if (request_irq(qlirq, do_ql_ihandl, 0, qlogic_name, shost))
+	if (request_irq(qlirq, qlogicfas408_ihandl, 0, qlogic_name, shost))
 		goto free_scsi_host;
 
 	sprintf(priv->qinfo,
@@ -307,9 +315,6 @@
 		outb(0x04, link->io.BasePort1 + 0xd);
 	}
 
-	qlogicfas_driver_template.name = qlogic_name;
-	qlogicfas_driver_template.proc_name = qlogic_name;
-
 	/* The KXL-810AN has a bigger IO port window */
 	if (link->io.NumPorts1 == 32)
 		host = qlogic_detect(&qlogicfas_driver_template, link,
@@ -402,7 +407,7 @@
 				outb(0x04, link->io.BasePort1 + 0xd);
 			}
 			/* Ugggglllyyyy!!! */
-			qlogicfas_bus_reset(NULL);
+			qlogicfas408_bus_reset(NULL);
 		}
 		break;
 	}
diff -Nru a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1042 @@
+/*
+*  sym53c500_cs.c	Bob Tracy (rct@frus.com)
+*
+*  A rewrite of the pcmcia-cs add-on driver for newer (circa 1997)
+*  New Media Bus Toaster PCMCIA SCSI cards using the Symbios Logic
+*  53c500 controller: intended for use with 2.6 and later kernels.
+*  The pcmcia-cs add-on version of this driver is not supported
+*  beyond 2.4.  It consisted of three files with history/copyright
+*  information as follows:
+*
+*  SYM53C500.h
+*	Bob Tracy (rct@frus.com)
+*	Original by Tom Corner (tcorner@via.at).
+*	Adapted from NCR53c406a.h which is Copyrighted (C) 1994
+*	Normunds Saumanis (normunds@rx.tech.swh.lv)
+*
+*  SYM53C500.c
+*	Bob Tracy (rct@frus.com)
+*	Original driver by Tom Corner (tcorner@via.at) was adapted
+*	from NCR53c406a.c which is Copyrighted (C) 1994, 1995, 1996 
+*	Normunds Saumanis (normunds@fi.ibm.com)
+*
+*  sym53c500.c
+*	Bob Tracy (rct@frus.com)
+*	Original by Tom Corner (tcorner@via.at) was adapted from a
+*	driver for the Qlogic SCSI card written by
+*	David Hinds (dhinds@allegro.stanford.edu).
+* 
+*  This program is free software; you can redistribute it and/or modify it
+*  under the terms of the GNU General Public License as published by the
+*  Free Software Foundation; either version 2, or (at your option) any
+*  later version.
+*
+*  This program is distributed in the hope that it will be useful, but
+*  WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+*  General Public License for more details.
+*/
+
+#define SYM53C500_DEBUG 0
+#define VERBOSE_SYM53C500_DEBUG 0
+
+/*
+*  Set this to 0 if you encounter kernel lockups while transferring 
+*  data in PIO mode.  Note this can be changed via "sysfs".
+*/
+#define USE_FAST_PIO 1
+
+/* =============== End of user configurable parameters ============== */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/ioport.h>
+#include <linux/blkdev.h>
+#include <linux/spinlock.h>
+#include <linux/bitops.h>
+
+#include <asm/io.h>
+#include <asm/dma.h>
+#include <asm/irq.h>
+
+#include <scsi/scsi_ioctl.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_host.h>
+
+#include <pcmcia/cs_types.h>
+#include <pcmcia/cs.h>
+#include <pcmcia/cistpl.h>
+#include <pcmcia/ds.h>
+#include <pcmcia/ciscode.h>
+
+/* ================================================================== */
+
+#ifdef PCMCIA_DEBUG
+static int pc_debug = PCMCIA_DEBUG;
+module_param(pc_debug, int, 0);
+#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
+static char *version =
+"sym53c500_cs.c 0.9b 2004/05/10 (Bob Tracy)";
+#else
+#define DEBUG(n, args...)
+#endif
+
+/* ================================================================== */
+
+/* Parameters that can be set with 'insmod' */
+
+/* Bit map of interrupts to choose from */
+static unsigned int irq_mask = 0xdeb8;	/* 3, 6, 7, 9-12, 14, 15 */
+static int irq_list[4] = { -1 };
+static int num_irqs = 1;
+
+module_param(irq_mask, int, 0);
+MODULE_PARM_DESC(irq_mask, "IRQ mask bits (default: 0xdeb8)");
+module_param_array(irq_list, int, num_irqs, 0);
+MODULE_PARM_DESC(irq_list, "Comma-separated list of up to 4 IRQs to try (default: auto select).");
+
+/* ================================================================== */
+
+#define SYNC_MODE 0 		/* Synchronous transfer mode */
+
+/* Default configuration */
+#define C1_IMG   0x07		/* ID=7 */
+#define C2_IMG   0x48		/* FE SCSI2 */
+#define C3_IMG   0x20		/* CDB */
+#define C4_IMG   0x04		/* ANE */
+#define C5_IMG   0xa4		/* ? changed from b6= AA PI SIE POL */
+#define C7_IMG   0x80		/* added for SYM53C500 t. corner */
+
+/* Hardware Registers: offsets from io_port (base) */
+
+/* Control Register Set 0 */
+#define TC_LSB		0x00		/* transfer counter lsb */
+#define TC_MSB		0x01		/* transfer counter msb */
+#define SCSI_FIFO	0x02		/* scsi fifo register */
+#define CMD_REG		0x03		/* command register */
+#define STAT_REG	0x04		/* status register */
+#define DEST_ID		0x04		/* selection/reselection bus id */
+#define INT_REG		0x05		/* interrupt status register */
+#define SRTIMOUT	0x05		/* select/reselect timeout reg */
+#define SEQ_REG		0x06		/* sequence step register */
+#define SYNCPRD		0x06		/* synchronous transfer period */
+#define FIFO_FLAGS	0x07		/* indicates # of bytes in fifo */
+#define SYNCOFF		0x07		/* synchronous offset register */
+#define CONFIG1		0x08		/* configuration register */
+#define CLKCONV		0x09		/* clock conversion register */
+/* #define TESTREG	0x0A */		/* test mode register */
+#define CONFIG2		0x0B		/* configuration 2 register */
+#define CONFIG3		0x0C		/* configuration 3 register */
+#define CONFIG4		0x0D		/* configuration 4 register */
+#define TC_HIGH		0x0E		/* transfer counter high */
+/* #define FIFO_BOTTOM	0x0F */		/* reserve FIFO byte register */
+
+/* Control Register Set 1 */
+/* #define JUMPER_SENSE	0x00 */		/* jumper sense port reg (r/w) */
+/* #define SRAM_PTR	0x01 */		/* SRAM address pointer reg (r/w) */
+/* #define SRAM_DATA	0x02 */		/* SRAM data register (r/w) */
+#define PIO_FIFO	0x04		/* PIO FIFO registers (r/w) */
+/* #define PIO_FIFO1	0x05 */		/*  */
+/* #define PIO_FIFO2	0x06 */		/*  */
+/* #define PIO_FIFO3	0x07 */		/*  */
+#define PIO_STATUS	0x08		/* PIO status (r/w) */
+/* #define ATA_CMD	0x09 */		/* ATA command/status reg (r/w) */
+/* #define ATA_ERR	0x0A */		/* ATA features/error reg (r/w) */
+#define PIO_FLAG	0x0B		/* PIO flag interrupt enable (r/w) */
+#define CONFIG5		0x09		/* configuration 5 register */
+/* #define SIGNATURE	0x0E */		/* signature register (r) */
+/* #define CONFIG6	0x0F */		/* configuration 6 register (r) */
+#define CONFIG7		0x0d
+
+/* select register set 0 */
+#define REG0(x)		(outb(C4_IMG, (x) + CONFIG4))
+/* select register set 1 */
+#define REG1(x)		outb(C7_IMG, (x) + CONFIG7); outb(C5_IMG, (x) + CONFIG5)
+
+#if SYM53C500_DEBUG
+#define DEB(x) x
+#else
+#define DEB(x)
+#endif
+
+#if VERBOSE_SYM53C500_DEBUG
+#define VDEB(x) x
+#else
+#define VDEB(x)
+#endif
+
+#define LOAD_DMA_COUNT(x, count) \
+  outb(count & 0xff, (x) + TC_LSB); \
+  outb((count >> 8) & 0xff, (x) + TC_MSB); \
+  outb((count >> 16) & 0xff, (x) + TC_HIGH);
+
+/* Chip commands */
+#define DMA_OP               0x80
+
+#define SCSI_NOP             0x00
+#define FLUSH_FIFO           0x01
+#define CHIP_RESET           0x02
+#define SCSI_RESET           0x03
+#define RESELECT             0x40
+#define SELECT_NO_ATN        0x41
+#define SELECT_ATN           0x42
+#define SELECT_ATN_STOP      0x43
+#define ENABLE_SEL           0x44
+#define DISABLE_SEL          0x45
+#define SELECT_ATN3          0x46
+#define RESELECT3            0x47
+#define TRANSFER_INFO        0x10
+#define INIT_CMD_COMPLETE    0x11
+#define MSG_ACCEPT           0x12
+#define TRANSFER_PAD         0x18
+#define SET_ATN              0x1a
+#define RESET_ATN            0x1b
+#define SEND_MSG             0x20
+#define SEND_STATUS          0x21
+#define SEND_DATA            0x22
+#define DISCONN_SEQ          0x23
+#define TERMINATE_SEQ        0x24
+#define TARG_CMD_COMPLETE    0x25
+#define DISCONN              0x27
+#define RECV_MSG             0x28
+#define RECV_CMD             0x29
+#define RECV_DATA            0x2a
+#define RECV_CMD_SEQ         0x2b
+#define TARGET_ABORT_DMA     0x04
+
+/* ================================================================== */
+
+struct scsi_info_t {
+	dev_link_t link;
+	dev_node_t node;
+	struct Scsi_Host *host;
+	unsigned short manf_id;
+};
+
+/*
+*  Repository for per-instance host data.
+*/
+struct sym53c500_data {
+	struct scsi_cmnd *current_SC;
+	int fast_pio;
+};
+
+enum Phase {
+    idle,
+    data_out,
+    data_in,
+    command_ph,
+    status_ph,
+    message_out,
+    message_in
+};
+
+/* ================================================================== */
+
+/*
+*  Global (within this module) variables other than
+*  sym53c500_driver_template (the scsi_host_template).
+*/
+static dev_link_t *dev_list;
+static dev_info_t dev_info = "sym53c500_cs";
+
+/* ================================================================== */
+
+static void
+chip_init(int io_port)
+{
+	REG1(io_port);
+	outb(0x01, io_port + PIO_STATUS);
+	outb(0x00, io_port + PIO_FLAG);
+
+	outb(C4_IMG, io_port + CONFIG4);	/* REG0(io_port); */
+	outb(C3_IMG, io_port + CONFIG3);
+	outb(C2_IMG, io_port + CONFIG2);
+	outb(C1_IMG, io_port + CONFIG1);
+
+	outb(0x05, io_port + CLKCONV);	/* clock conversion factor */
+	outb(0x9C, io_port + SRTIMOUT);	/* Selection timeout */
+	outb(0x05, io_port + SYNCPRD);	/* Synchronous transfer period */
+	outb(SYNC_MODE, io_port + SYNCOFF);	/* synchronous mode */  
+}
+
+static void
+SYM53C500_int_host_reset(int io_port)
+{
+	outb(C4_IMG, io_port + CONFIG4);	/* REG0(io_port); */
+	outb(CHIP_RESET, io_port + CMD_REG);
+	outb(SCSI_NOP, io_port + CMD_REG);	/* required after reset */
+	outb(SCSI_RESET, io_port + CMD_REG);
+	chip_init(io_port);
+}
+
+static __inline__ int
+SYM53C500_pio_read(int fast_pio, int base, unsigned char *request, unsigned int reqlen)
+{
+	int i;
+	int len;	/* current scsi fifo size */
+
+	REG1(base);
+	while (reqlen) {
+		i = inb(base + PIO_STATUS);
+		/* VDEB(printk("pio_status=%x\n", i)); */
+		if (i & 0x80) 
+			return 0;
+
+		switch (i & 0x1e) {
+		default:
+		case 0x10:	/* fifo empty */
+			len = 0;
+			break;
+		case 0x0:
+			len = 1;
+			break; 
+		case 0x8:	/* fifo 1/3 full */
+			len = 42;
+			break;
+		case 0xc:	/* fifo 2/3 full */
+			len = 84;
+			break;
+		case 0xe:	/* fifo full */
+			len = 128;
+			break;
+		}
+
+		if ((i & 0x40) && len == 0) { /* fifo empty and interrupt occurred */
+			return 0;
+		}
+
+		if (len) {
+			if (len > reqlen) 
+				len = reqlen;
+
+			if (fast_pio && len > 3) {
+				insl(base + PIO_FIFO, request, len >> 2);
+				request += len & 0xfc; 
+				reqlen -= len & 0xfc; 
+			} else {
+				while (len--) {
+					*request++ = inb(base + PIO_FIFO);
+					reqlen--;
+				}
+			} 
+		}
+	}
+	return 0;
+}
+
+static __inline__ int
+SYM53C500_pio_write(int fast_pio, int base, unsigned char *request, unsigned int reqlen)
+{
+	int i = 0;
+	int len;	/* current scsi fifo size */
+
+	REG1(base);
+	while (reqlen && !(i & 0x40)) {
+		i = inb(base + PIO_STATUS);
+		/* VDEB(printk("pio_status=%x\n", i)); */
+		if (i & 0x80)	/* error */
+			return 0;
+
+		switch (i & 0x1e) {
+		case 0x10:
+			len = 128;
+			break;
+		case 0x0:
+			len = 84;
+			break;
+		case 0x8:
+			len = 42;
+			break;
+		case 0xc:
+			len = 1;
+			break;
+		default:
+		case 0xe:
+			len = 0;
+			break;
+		}
+
+		if (len) {
+			if (len > reqlen)
+				len = reqlen;
+
+			if (fast_pio && len > 3) {
+				outsl(base + PIO_FIFO, request, len >> 2);
+				request += len & 0xfc;
+				reqlen -= len & 0xfc;
+			} else {
+				while (len--) {
+					outb(*request++, base + PIO_FIFO);
+					reqlen--;
+				}
+			}
+		}
+	}
+	return 0;
+}
+
+static irqreturn_t
+SYM53C500_intr(int irq, void *dev_id, struct pt_regs *regs)
+{
+	unsigned long flags;
+	struct Scsi_Host *dev = dev_id;
+	DEB(unsigned char fifo_size;)
+	DEB(unsigned char seq_reg;)
+	unsigned char status, int_reg;
+	unsigned char pio_status;
+	struct scatterlist *sglist;
+	unsigned int sgcount;
+	int port_base = dev->io_port;
+	struct sym53c500_data *data =
+	    (struct sym53c500_data *)dev->hostdata;
+	struct scsi_cmnd *curSC = data->current_SC;
+	int fast_pio = data->fast_pio;
+
+	spin_lock_irqsave(dev->host_lock, flags);
+
+	VDEB(printk("SYM53C500_intr called\n"));
+
+	REG1(port_base);
+	pio_status = inb(port_base + PIO_STATUS);
+	REG0(port_base);
+	status = inb(port_base + STAT_REG);
+	DEB(seq_reg = inb(port_base + SEQ_REG));
+	int_reg = inb(port_base + INT_REG);
+	DEB(fifo_size = inb(port_base + FIFO_FLAGS) & 0x1f);
+
+#if SYM53C500_DEBUG
+	printk("status=%02x, seq_reg=%02x, int_reg=%02x, fifo_size=%02x", 
+	    status, seq_reg, int_reg, fifo_size);
+	printk(", pio=%02x\n", pio_status);
+#endif /* SYM53C500_DEBUG */
+
+	if (int_reg & 0x80) {	/* SCSI reset intr */
+		DEB(printk("SYM53C500: reset intr received\n"));
+		curSC->result = DID_RESET << 16;
+		goto idle_out;
+	}
+
+	if (pio_status & 0x80) {
+		printk("SYM53C500: Warning: PIO error!\n");
+		curSC->result = DID_ERROR << 16;
+		goto idle_out;
+	}
+
+	if (status & 0x20) {		/* Parity error */
+		printk("SYM53C500: Warning: parity error!\n");
+		curSC->result = DID_PARITY << 16;
+		goto idle_out;
+	}
+
+	if (status & 0x40) {		/* Gross error */
+		printk("SYM53C500: Warning: gross error!\n");
+		curSC->result = DID_ERROR << 16;
+		goto idle_out;
+	}
+
+	if (int_reg & 0x20) {		/* Disconnect */
+		DEB(printk("SYM53C500: disconnect intr received\n"));
+		if (curSC->SCp.phase != message_in) {	/* Unexpected disconnect */
+			curSC->result = DID_NO_CONNECT << 16;
+		} else {	/* Command complete, return status and message */
+			curSC->result = (curSC->SCp.Status & 0xff)
+			    | ((curSC->SCp.Message & 0xff) << 8) | (DID_OK << 16);
+		}
+		goto idle_out;
+	}
+
+	switch (status & 0x07) {	/* scsi phase */
+	case 0x00:			/* DATA-OUT */
+		if (int_reg & 0x10) {	/* Target requesting info transfer */
+			curSC->SCp.phase = data_out;
+			VDEB(printk("SYM53C500: Data-Out phase\n"));
+			outb(FLUSH_FIFO, port_base + CMD_REG);
+			LOAD_DMA_COUNT(port_base, curSC->request_bufflen);	/* Max transfer size */
+			outb(TRANSFER_INFO | DMA_OP, port_base + CMD_REG);
+			if (!curSC->use_sg)	/* Don't use scatter-gather */
+				SYM53C500_pio_write(fast_pio, port_base, curSC->request_buffer, curSC->request_bufflen);
+			else {	/* use scatter-gather */
+				sgcount = curSC->use_sg;
+				sglist = curSC->request_buffer;
+				while (sgcount--) {
+					SYM53C500_pio_write(fast_pio, port_base, page_address(sglist->page) + sglist->offset, sglist->length);
+					sglist++;
+				}
+			}
+			REG0(port_base);
+		}
+		break;
+
+	case 0x01:		/* DATA-IN */
+		if (int_reg & 0x10) {	/* Target requesting info transfer */
+			curSC->SCp.phase = data_in;
+			VDEB(printk("SYM53C500: Data-In phase\n"));
+			outb(FLUSH_FIFO, port_base + CMD_REG);
+			LOAD_DMA_COUNT(port_base, curSC->request_bufflen);	/* Max transfer size */
+			outb(TRANSFER_INFO | DMA_OP, port_base + CMD_REG);
+			if (!curSC->use_sg)	/* Don't use scatter-gather */
+				SYM53C500_pio_read(fast_pio, port_base, curSC->request_buffer, curSC->request_bufflen);
+			else {	/* Use scatter-gather */
+				sgcount = curSC->use_sg;
+				sglist = curSC->request_buffer;
+				while (sgcount--) {
+					SYM53C500_pio_read(fast_pio, port_base, page_address(sglist->page) + sglist->offset, sglist->length);
+					sglist++;
+				}
+			}
+			REG0(port_base);
+		}
+		break;
+
+	case 0x02:		/* COMMAND */
+		curSC->SCp.phase = command_ph;
+		printk("SYM53C500: Warning: Unknown interrupt occurred in command phase!\n");
+		break;
+
+	case 0x03:		/* STATUS */
+		curSC->SCp.phase = status_ph;
+		VDEB(printk("SYM53C500: Status phase\n"));
+		outb(FLUSH_FIFO, port_base + CMD_REG);
+		outb(INIT_CMD_COMPLETE, port_base + CMD_REG);
+		break;
+
+	case 0x04:		/* Reserved */
+	case 0x05:		/* Reserved */
+		printk("SYM53C500: WARNING: Reserved phase!!!\n");
+		break;
+
+	case 0x06:		/* MESSAGE-OUT */
+		DEB(printk("SYM53C500: Message-Out phase\n"));
+		curSC->SCp.phase = message_out;
+		outb(SET_ATN, port_base + CMD_REG);	/* Reject the message */
+		outb(MSG_ACCEPT, port_base + CMD_REG);
+		break;
+
+	case 0x07:		/* MESSAGE-IN */
+		VDEB(printk("SYM53C500: Message-In phase\n"));
+		curSC->SCp.phase = message_in;
+
+		curSC->SCp.Status = inb(port_base + SCSI_FIFO);
+		curSC->SCp.Message = inb(port_base + SCSI_FIFO);
+
+		VDEB(printk("SCSI FIFO size=%d\n", inb(port_base + FIFO_FLAGS) & 0x1f));
+		DEB(printk("Status = %02x  Message = %02x\n", curSC->SCp.Status, curSC->SCp.Message));
+
+		if (curSC->SCp.Message == SAVE_POINTERS || curSC->SCp.Message == DISCONNECT) {
+			outb(SET_ATN, port_base + CMD_REG);	/* Reject message */
+			DEB(printk("Discarding SAVE_POINTERS message\n"));
+		}
+		outb(MSG_ACCEPT, port_base + CMD_REG);
+		break;
+	}
+out:
+	spin_unlock_irqrestore(dev->host_lock, flags);
+	return IRQ_HANDLED;
+
+idle_out:
+	curSC->SCp.phase = idle;
+	curSC->scsi_done(curSC);
+	goto out;
+}
+
+static void
+SYM53C500_release(dev_link_t *link)
+{
+	struct scsi_info_t *info = link->priv;
+	struct Scsi_Host *shost = info->host;
+
+	DEBUG(0, "SYM53C500_release(0x%p)\n", link);
+
+	/*
+	*  Do this before releasing/freeing resources.
+	*/
+	scsi_remove_host(shost);
+
+	/*
+	*  Interrupts getting hosed on card removal.  Try
+	*  the following code, mostly from qlogicfas.c.
+	*/
+	if (shost->irq)
+		free_irq(shost->irq, shost);
+	if (shost->dma_channel != 0xff)
+		free_dma(shost->dma_channel);
+	if (shost->io_port && shost->n_io_port)
+		release_region(shost->io_port, shost->n_io_port);
+
+	link->dev = NULL;
+
+	pcmcia_release_configuration(link->handle);
+	pcmcia_release_io(link->handle, &link->io);
+	pcmcia_release_irq(link->handle, &link->irq);
+
+	link->state &= ~DEV_CONFIG;
+
+	scsi_host_put(shost);
+} /* SYM53C500_release */
+
+static const char*
+SYM53C500_info(struct Scsi_Host *SChost)
+{
+	static char info_msg[256];
+	struct sym53c500_data *data =
+	    (struct sym53c500_data *)SChost->hostdata;
+
+	DEB(printk("SYM53C500_info called\n"));
+	(void)snprintf(info_msg, sizeof(info_msg),
+	    "SYM53C500 at 0x%lx, IRQ %d, %s PIO mode.", 
+	    SChost->io_port, SChost->irq, data->fast_pio ? "fast" : "slow");
+	return (info_msg);
+}
+
+static int 
+SYM53C500_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
+{
+	int i;
+	int port_base = SCpnt->device->host->io_port;
+	struct sym53c500_data *data =
+	    (struct sym53c500_data *)SCpnt->device->host->hostdata;
+
+	VDEB(printk("SYM53C500_queue called\n"));
+
+	DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n", 
+	    SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->device->id, 
+	    SCpnt->device->lun,  SCpnt->request_bufflen));
+
+	VDEB(for (i = 0; i < SCpnt->cmd_len; i++)
+	    printk("cmd[%d]=%02x  ", i, SCpnt->cmnd[i]));
+	VDEB(printk("\n"));
+
+	data->current_SC = SCpnt;
+	data->current_SC->scsi_done = done;
+	data->current_SC->SCp.phase = command_ph;
+	data->current_SC->SCp.Status = 0;
+	data->current_SC->SCp.Message = 0;
+
+	/* We are locked here already by the mid layer */
+	REG0(port_base);
+	outb(SCpnt->device->id, port_base + DEST_ID);	/* set destination */
+	outb(FLUSH_FIFO, port_base + CMD_REG);	/* reset the fifos */
+
+	for (i = 0; i < SCpnt->cmd_len; i++) {
+		outb(SCpnt->cmnd[i], port_base + SCSI_FIFO);
+	}
+	outb(SELECT_NO_ATN, port_base + CMD_REG);
+
+	return 0;
+}
+
+static int 
+SYM53C500_host_reset(struct scsi_cmnd *SCpnt)
+{
+	int port_base = SCpnt->device->host->io_port;
+
+	DEB(printk("SYM53C500_host_reset called\n"));
+	SYM53C500_int_host_reset(port_base);
+
+	return SUCCESS;
+}
+
+static int 
+SYM53C500_biosparm(struct scsi_device *disk,
+    struct block_device *dev,
+    sector_t capacity, int *info_array)
+{
+	int size;
+
+	DEB(printk("SYM53C500_biosparm called\n"));
+
+	size = capacity;
+	info_array[0] = 64;		/* heads */
+	info_array[1] = 32;		/* sectors */
+	info_array[2] = size >> 11;	/* cylinders */
+	if (info_array[2] > 1024) {	/* big disk */
+		info_array[0] = 255;
+		info_array[1] = 63;
+		info_array[2] = size / (255 * 63);
+	}
+	return 0;
+}
+
+static ssize_t
+SYM53C500_show_pio(struct class_device *cdev, char *buf)
+{
+	struct Scsi_Host *SHp = class_to_shost(cdev);
+	struct sym53c500_data *data =
+	    (struct sym53c500_data *)SHp->hostdata;
+
+	return snprintf(buf, 4, "%d\n", data->fast_pio);
+}
+
+static ssize_t
+SYM53C500_store_pio(struct class_device *cdev, const char *buf, size_t count)
+{
+	int pio;
+	struct Scsi_Host *SHp = class_to_shost(cdev);
+	struct sym53c500_data *data =
+	    (struct sym53c500_data *)SHp->hostdata;
+
+	pio = simple_strtoul(buf, NULL, 0);
+	if (pio == 0 || pio == 1) {
+		data->fast_pio = pio;
+		return count;
+	}
+	else
+		return -EINVAL;
+}
+
+/*
+*  SCSI HBA device attributes we want to
+*  make available via sysfs.
+*/
+static struct class_device_attribute SYM53C500_pio_attr = {
+	.attr = {
+		.name = "fast_pio",
+		.mode = (S_IRUGO | S_IWUSR),
+	},
+	.show = SYM53C500_show_pio,
+	.store = SYM53C500_store_pio,
+};
+
+static struct class_device_attribute *SYM53C500_shost_attrs[] = {
+	&SYM53C500_pio_attr,
+	NULL,
+};
+
+/*
+*  scsi_host_template initializer
+*/
+static struct scsi_host_template sym53c500_driver_template = {
+     .module			= THIS_MODULE,
+     .name			= "SYM53C500",
+     .info			= SYM53C500_info,
+     .queuecommand		= SYM53C500_queue,
+     .eh_host_reset_handler	= SYM53C500_host_reset,
+     .bios_param		= SYM53C500_biosparm,
+     .proc_name			= "SYM53C500",
+     .can_queue			= 1,
+     .this_id			= 7,
+     .sg_tablesize		= 32,
+     .cmd_per_lun		= 1,
+     .use_clustering		= ENABLE_CLUSTERING,
+     .shost_attrs		= SYM53C500_shost_attrs
+};
+
+#define CS_CHECK(fn, ret) \
+do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
+
+static void
+SYM53C500_config(dev_link_t *link)
+{
+	client_handle_t handle = link->handle;
+	struct scsi_info_t *info = link->priv;
+	tuple_t tuple;
+	cisparse_t parse;
+	int i, last_ret, last_fn;
+	int irq_level, port_base;
+	unsigned short tuple_data[32];
+	struct Scsi_Host *host;
+	struct scsi_host_template *tpnt = &sym53c500_driver_template;
+	struct sym53c500_data *data;
+
+	DEBUG(0, "SYM53C500_config(0x%p)\n", link);
+
+	tuple.TupleData = (cisdata_t *)tuple_data;
+	tuple.TupleDataMax = 64;
+	tuple.TupleOffset = 0;
+	tuple.DesiredTuple = CISTPL_CONFIG;
+	CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
+	CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
+	CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
+	link->conf.ConfigBase = parse.config.base;
+
+	tuple.DesiredTuple = CISTPL_MANFID;
+	if ((pcmcia_get_first_tuple(handle, &tuple) == CS_SUCCESS) &&
+	    (pcmcia_get_tuple_data(handle, &tuple) == CS_SUCCESS))
+		info->manf_id = le16_to_cpu(tuple.TupleData[0]);
+
+	/* Configure card */
+	link->state |= DEV_CONFIG;
+
+	tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
+	CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
+	while (1) {
+		if (pcmcia_get_tuple_data(handle, &tuple) != 0 ||
+		    pcmcia_parse_tuple(handle, &tuple, &parse) != 0)
+			goto next_entry;
+		link->conf.ConfigIndex = parse.cftable_entry.index;
+		link->io.BasePort1 = parse.cftable_entry.io.win[0].base;
+		link->io.NumPorts1 = parse.cftable_entry.io.win[0].len;
+
+		if (link->io.BasePort1 != 0) {
+			i = pcmcia_request_io(handle, &link->io);
+			if (i == CS_SUCCESS)
+				break;
+		}
+next_entry:
+		CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple));
+	}
+
+	CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq));
+	CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf));
+
+	/*
+	*  That's the trouble with copying liberally from another driver.
+	*  Some things probably aren't relevant, and I suspect this entire
+	*  section dealing with manufacturer IDs can be scrapped.	--rct
+	*/
+	if ((info->manf_id == MANFID_MACNICA) ||
+	    (info->manf_id == MANFID_PIONEER) ||
+	    (info->manf_id == 0x0098)) {
+		/* set ATAcmd */
+		outb(0xb4, link->io.BasePort1 + 0xd);
+		outb(0x24, link->io.BasePort1 + 0x9);
+		outb(0x04, link->io.BasePort1 + 0xd);
+	}
+
+	/*
+	*  irq_level == 0 implies tpnt->can_queue == 0, which
+	*  is not supported in 2.6.  Thus, only irq_level > 0
+	*  will be allowed.
+	*
+	*  Possible port_base values are as follows:
+	*
+	*	0x130, 0x230, 0x280, 0x290,
+	*	0x320, 0x330, 0x340, 0x350
+	*/
+	port_base = link->io.BasePort1;
+	irq_level = link->irq.AssignedIRQ;
+
+	DEB(printk("SYM53C500: port_base=0x%x, irq=%d, fast_pio=%d\n",
+	    port_base, irq_level, USE_FAST_PIO);)
+
+	chip_init(port_base);
+
+	host = scsi_host_alloc(tpnt, sizeof(struct sym53c500_data));
+	if (!host) {
+		printk("SYM53C500: Unable to register host, giving up.\n");
+		goto err_release;
+	}
+
+	data = (struct sym53c500_data *)host->hostdata;
+
+	if (irq_level > 0) {
+		if (request_irq(irq_level, SYM53C500_intr, 0, "SYM53C500", host)) {
+			printk("SYM53C500: unable to allocate IRQ %d\n", irq_level);
+			goto err_free_scsi;
+		}
+		DEB(printk("SYM53C500: allocated IRQ %d\n", irq_level));
+	} else if (irq_level == 0) {
+		DEB(printk("SYM53C500: No interrupts detected\n"));
+		goto err_free_scsi;
+	} else {
+		DEB(printk("SYM53C500: Shouldn't get here!\n"));
+		goto err_free_scsi;
+	}
+
+	host->unique_id = port_base;
+	host->irq = irq_level;
+	host->io_port = port_base;
+	host->n_io_port = 0x10;
+	host->dma_channel = -1;
+
+	/*
+	*  Note fast_pio is set to USE_FAST_PIO by
+	*  default, but can be changed via "sysfs".
+	*/
+	data->fast_pio = USE_FAST_PIO;
+
+	sprintf(info->node.dev_name, "scsi%d", host->host_no);
+	link->dev = &info->node;
+	info->host = host;
+
+	if (scsi_add_host(host, NULL))
+		goto err_free_irq;
+
+	scsi_scan_host(host);
+
+	goto out;	/* SUCCESS */
+
+err_free_irq:
+	free_irq(irq_level, host);
+err_free_scsi:
+	scsi_host_put(host);
+err_release:
+	release_region(port_base, 0x10);
+	printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n");
+
+out:
+	link->state &= ~DEV_CONFIG_PENDING;
+	return;
+
+cs_failed:
+	cs_error(link->handle, last_fn, last_ret);
+	SYM53C500_release(link);
+	return;
+} /* SYM53C500_config */
+
+static int
+SYM53C500_event(event_t event, int priority, event_callback_args_t *args)
+{
+	dev_link_t *link = args->client_data;
+	struct scsi_info_t *info = link->priv;
+
+	DEBUG(1, "SYM53C500_event(0x%06x)\n", event);
+
+	switch (event) {
+	case CS_EVENT_CARD_REMOVAL:
+		link->state &= ~DEV_PRESENT;
+		if (link->state & DEV_CONFIG)
+			SYM53C500_release(link);
+		break;
+	case CS_EVENT_CARD_INSERTION:
+		link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+		SYM53C500_config(link);
+		break;
+	case CS_EVENT_PM_SUSPEND:
+		link->state |= DEV_SUSPEND;
+		/* Fall through... */
+	case CS_EVENT_RESET_PHYSICAL:
+		if (link->state & DEV_CONFIG)
+			pcmcia_release_configuration(link->handle);
+		break;
+	case CS_EVENT_PM_RESUME:
+		link->state &= ~DEV_SUSPEND;
+		/* Fall through... */
+	case CS_EVENT_CARD_RESET:
+		if (link->state & DEV_CONFIG) {
+			pcmcia_request_configuration(link->handle, &link->conf);
+			/* See earlier comment about manufacturer IDs. */
+			if ((info->manf_id == MANFID_MACNICA) ||
+			    (info->manf_id == MANFID_PIONEER) ||
+			    (info->manf_id == 0x0098)) {
+				outb(0x80, link->io.BasePort1 + 0xd);
+				outb(0x24, link->io.BasePort1 + 0x9);
+				outb(0x04, link->io.BasePort1 + 0xd);
+			}
+			/*
+			*  If things don't work after a "resume",
+			*  this is a good place to start looking.
+			*/
+			SYM53C500_int_host_reset(link->io.BasePort1);
+		}
+		break;
+	}
+	return 0;
+} /* SYM53C500_event */
+
+static void
+SYM53C500_detach(dev_link_t *link)
+{
+	dev_link_t **linkp;
+
+	DEBUG(0, "SYM53C500_detach(0x%p)\n", link);
+
+	/* Locate device structure */
+	for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
+		if (*linkp == link)
+			break;
+	if (*linkp == NULL)
+		return;
+
+	if (link->state & DEV_CONFIG)
+		SYM53C500_release(link);
+
+	if (link->handle)
+		pcmcia_deregister_client(link->handle);
+
+	/* Unlink device structure, free bits. */
+	*linkp = link->next;
+	kfree(link->priv);
+	link->priv = NULL;
+} /* SYM53C500_detach */
+
+static dev_link_t *
+SYM53C500_attach(void)
+{
+	struct scsi_info_t *info;
+	client_reg_t client_reg;
+	dev_link_t *link;
+	int i, ret;
+
+	DEBUG(0, "SYM53C500_attach()\n");
+
+	/* Create new SCSI device */
+	info = kmalloc(sizeof(*info), GFP_KERNEL);
+	if (!info)
+		return NULL;
+	memset(info, 0, sizeof(*info));
+	link = &info->link;
+	link->priv = info;
+	link->io.NumPorts1 = 16;
+	link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
+	link->io.IOAddrLines = 10;
+	link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
+	link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
+	if (irq_list[0] == -1)
+		link->irq.IRQInfo2 = irq_mask;
+	else
+		for (i = 0; i < 4; i++)
+			link->irq.IRQInfo2 |= 1 << irq_list[i];
+	link->conf.Attributes = CONF_ENABLE_IRQ;
+	link->conf.Vcc = 50;
+	link->conf.IntType = INT_MEMORY_AND_IO;
+	link->conf.Present = PRESENT_OPTION;
+
+	/* Register with Card Services */
+	link->next = dev_list;
+	dev_list = link;
+	client_reg.dev_info = &dev_info;
+	client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
+	client_reg.event_handler = &SYM53C500_event;
+	client_reg.EventMask = CS_EVENT_RESET_REQUEST | CS_EVENT_CARD_RESET |
+	    CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
+	    CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME;
+	client_reg.Version = 0x0210;
+	client_reg.event_callback_args.client_data = link;
+	ret = pcmcia_register_client(&link->handle, &client_reg);
+	if (ret != 0) {
+		cs_error(link->handle, RegisterClient, ret);
+		SYM53C500_detach(link);
+		return NULL;
+	}
+
+	return link;
+} /* SYM53C500_attach */
+
+MODULE_AUTHOR("Bob Tracy <rct@frus.com>");
+MODULE_DESCRIPTION("SYM53C500 PCMCIA SCSI driver");
+MODULE_LICENSE("GPL");
+
+static struct pcmcia_driver sym53c500_cs_driver = {
+	.owner		= THIS_MODULE,
+	.drv		= {
+		.name	= "sym53c500_cs",
+	},
+	.attach		= SYM53C500_attach,
+	.detach		= SYM53C500_detach,
+};
+
+static int __init
+init_sym53c500_cs(void)
+{
+	return pcmcia_register_driver(&sym53c500_cs_driver);
+}
+
+static void __exit
+exit_sym53c500_cs(void)
+{
+	pcmcia_unregister_driver(&sym53c500_cs_driver);
+}
+
+module_init(init_sym53c500_cs);
+module_exit(exit_sym53c500_cs);
diff -Nru a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
--- a/drivers/scsi/ppa.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/ppa.c	Tue Jun 15 22:20:41 2004
@@ -15,18 +15,23 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/blkdev.h>
-#include <asm/io.h>
 #include <linux/parport.h>
 #include <linux/workqueue.h>
-#include "scsi.h"
-#include "hosts.h"
+#include <asm/io.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_host.h>
+
+
 static void ppa_reset_pulse(unsigned int base);
 
 typedef struct {
 	struct pardevice *dev;	/* Parport device entry         */
 	int base;		/* Actual port address          */
 	int mode;		/* Transfer mode                */
-	Scsi_Cmnd *cur_cmd;	/* Current queued command       */
+	struct scsi_cmnd *cur_cmd;	/* Current queued command       */
 	struct work_struct ppa_tq;	/* Polling interrupt stuff       */
 	unsigned long jstart;	/* Jiffies at start             */
 	unsigned long recon_tmo;	/* How many usecs to wait for reconnection (6th bit) */
@@ -501,7 +506,7 @@
 	return device_check(dev);
 }
 
-static inline int ppa_send_command(Scsi_Cmnd *cmd)
+static inline int ppa_send_command(struct scsi_cmnd *cmd)
 {
 	ppa_struct *dev = ppa_dev(cmd->device->host);
 	int k;
@@ -522,7 +527,7 @@
  * The driver appears to remain stable if we speed up the parallel port
  * i/o in this function, but not elsewhere.
  */
-static int ppa_completion(Scsi_Cmnd *cmd)
+static int ppa_completion(struct scsi_cmnd *cmd)
 {
 	/* Return codes:
 	 * -1     Error
@@ -626,7 +631,7 @@
 static void ppa_interrupt(void *data)
 {
 	ppa_struct *dev = (ppa_struct *) data;
-	Scsi_Cmnd *cmd = dev->cur_cmd;
+	struct scsi_cmnd *cmd = dev->cur_cmd;
 
 	if (!cmd) {
 		printk("PPA: bug in ppa_interrupt\n");
@@ -682,7 +687,7 @@
 	cmd->scsi_done(cmd);
 }
 
-static int ppa_engine(ppa_struct *dev, Scsi_Cmnd *cmd)
+static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
 {
 	unsigned short ppb = dev->base;
 	unsigned char l = 0, h = 0;
@@ -802,7 +807,8 @@
 	return 0;
 }
 
-static int ppa_queuecommand(Scsi_Cmnd *cmd, void (*done) (Scsi_Cmnd *))
+static int ppa_queuecommand(struct scsi_cmnd *cmd,
+		void (*done) (struct scsi_cmnd *))
 {
 	ppa_struct *dev = ppa_dev(cmd->device->host);
 
@@ -847,7 +853,7 @@
 	return 0;
 }
 
-static int ppa_abort(Scsi_Cmnd *cmd)
+static int ppa_abort(struct scsi_cmnd *cmd)
 {
 	ppa_struct *dev = ppa_dev(cmd->device->host);
 	/*
@@ -875,7 +881,7 @@
 	w_ctr(base, 0xc);
 }
 
-static int ppa_reset(Scsi_Cmnd *cmd)
+static int ppa_reset(struct scsi_cmnd *cmd)
 {
 	ppa_struct *dev = ppa_dev(cmd->device->host);
 
@@ -974,7 +980,7 @@
 	return -ENODEV;
 }
 
-static Scsi_Host_Template ppa_template = {
+static struct scsi_host_template ppa_template = {
 	.module			= THIS_MODULE,
 	.proc_name		= "ppa",
 	.proc_info		= ppa_proc_info,
diff -Nru a/drivers/scsi/ppa.h b/drivers/scsi/ppa.h
--- a/drivers/scsi/ppa.h	Tue Jun 15 22:20:44 2004
+++ b/drivers/scsi/ppa.h	Tue Jun 15 22:20:44 2004
@@ -146,6 +146,6 @@
 #define w_ctr(x,y)      outb(y, (x)+2)
 #endif
 
-static int ppa_engine(ppa_struct *, Scsi_Cmnd *);
+static int ppa_engine(ppa_struct *, struct scsi_cmnd *);
 
 #endif				/* _PPA_H */
diff -Nru a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
--- a/drivers/scsi/qla1280.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/scsi/qla1280.c	Tue Jun 15 22:21:05 2004
@@ -3371,6 +3371,7 @@
 	sp->flags |= SRB_SENT;
 	ha->actthreads++;
 	WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
+	(void) RD_REG_WORD(&reg->mailbox4); /* PCI posted write flush */
 
  out:
 	if (status)
@@ -3639,6 +3640,7 @@
 	sp->flags |= SRB_SENT;
 	ha->actthreads++;
 	WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
+	(void) RD_REG_WORD(&reg->mailbox4); /* PCI posted write flush */
 
 out:
 	if (status)
@@ -3750,6 +3752,7 @@
 
 	/* Set chip new ring index. */
 	WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index);
+	(void) RD_REG_WORD(&reg->mailbox4); /* PCI posted write flush */
 
 	LEAVE("qla1280_isp_cmd");
 }
@@ -3788,7 +3791,7 @@
 
 	/* Check for mailbox interrupt. */
 
-	mailbox[0] = RD_REG_WORD(&reg->semaphore);
+	mailbox[0] = RD_REG_WORD_dmasync(&reg->semaphore);
 
 	if (mailbox[0] & BIT_0) {
 		/* Get mailbox data. */
diff -Nru a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
--- a/drivers/scsi/qla1280.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/scsi/qla1280.h	Tue Jun 15 22:21:05 2004
@@ -57,7 +57,8 @@
 #define BIT_31	0x80000000
 
 #if MEMORY_MAPPED_IO
-#define RD_REG_WORD(addr)		readw(addr)
+#define RD_REG_WORD(addr)		readw_relaxed(addr)
+#define RD_REG_WORD_dmasync(addr)	readw(addr)
 #define WRT_REG_WORD(addr, data)	writew(data, addr)
 #else				/* MEMORY_MAPPED_IO */
 #define RD_REG_WORD(addr)		inw((unsigned long)addr)
diff -Nru a/drivers/scsi/qla2xxx/ql2300_fw.c b/drivers/scsi/qla2xxx/ql2300_fw.c
--- a/drivers/scsi/qla2xxx/ql2300_fw.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/qla2xxx/ql2300_fw.c	Tue Jun 15 22:20:40 2004
@@ -18,7 +18,7 @@
  *************************************************************************/
 
 /*
- *	Firmware Version 3.02.26 (08:42 Mar 11, 2004)
+ *	Firmware Version 3.02.28 (13:56 Apr 03, 2004)
  */
 
 #ifdef UNIQUE_FW_NAME
@@ -28,15 +28,15 @@
 #endif
 
 #ifdef UNIQUE_FW_NAME
-unsigned char fw2300ipx_version_str[] = {3, 2,26};
+unsigned char fw2300ipx_version_str[] = {3, 2,28};
 #else
-unsigned char firmware_version[] = {3, 2,26};
+unsigned char firmware_version[] = {3, 2,28};
 #endif
 
 #ifdef UNIQUE_FW_NAME
-#define fw2300ipx_VERSION_STRING "3.02.26"
+#define fw2300ipx_VERSION_STRING "3.02.28"
 #else
-#define FW_VERSION_STRING "3.02.26"
+#define FW_VERSION_STRING "3.02.28"
 #endif
 
 #ifdef UNIQUE_FW_NAME
@@ -50,12 +50,12 @@
 #else
 unsigned short risc_code01[] = { 
 #endif
-	0x0470, 0x0000, 0x0000, 0xe9a6, 0x0000, 0x0003, 0x0002, 0x001a,
+	0x0470, 0x0000, 0x0000, 0xe9c7, 0x0000, 0x0003, 0x0002, 0x001c,
 	0x0137, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2032, 0x3030,
 	0x3120, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241,
 	0x5449, 0x4f4e, 0x2049, 0x5350, 0x3233, 0x3030, 0x2046, 0x6972,
 	0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030,
-	0x332e, 0x3032, 0x2e32, 0x3620, 0x2020, 0x2020, 0x2400, 0x20a9,
+	0x332e, 0x3032, 0x2e32, 0x3820, 0x2020, 0x2020, 0x2400, 0x20a9,
 	0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2200, 0x20a9, 0x000f,
 	0x2001, 0x0000, 0x400f, 0x2091, 0x2400, 0x20a9, 0x000f, 0x2001,
 	0x0000, 0x400f, 0x2091, 0x2600, 0x20a9, 0x000f, 0x2001, 0x0000,
@@ -78,98 +78,98 @@
 	0x1800, 0x810d, 0x810d, 0x810d, 0x810d, 0x810d, 0x918c, 0x001f,
 	0x2001, 0x0001, 0x9112, 0x20e9, 0x0001, 0x20a1, 0x0800, 0x900e,
 	0x20a9, 0x0800, 0x4104, 0x8211, 0x1dd8, 0x080c, 0x0f17, 0x080c,
-	0x6029, 0x080c, 0xaddd, 0x080c, 0x10ce, 0x080c, 0x12ed, 0x080c,
-	0x1ba4, 0x080c, 0x0d69, 0x080c, 0x1053, 0x080c, 0x341e, 0x080c,
-	0x76ac, 0x080c, 0x698e, 0x080c, 0x86cd, 0x080c, 0x8401, 0x080c,
-	0x2478, 0x080c, 0x8f6f, 0x080c, 0x7d76, 0x080c, 0x22b1, 0x080c,
+	0x6028, 0x080c, 0xadf7, 0x080c, 0x10ce, 0x080c, 0x12ed, 0x080c,
+	0x1ba4, 0x080c, 0x0d69, 0x080c, 0x1053, 0x080c, 0x3425, 0x080c,
+	0x76b8, 0x080c, 0x6996, 0x080c, 0x86f6, 0x080c, 0x842a, 0x080c,
+	0x2478, 0x080c, 0x8f98, 0x080c, 0x7d82, 0x080c, 0x22b1, 0x080c,
 	0x23e5, 0x080c, 0x246d, 0x2091, 0x3009, 0x7883, 0x0000, 0x1004,
 	0x091f, 0x7880, 0x9086, 0x0002, 0x1190, 0x7883, 0x4000, 0x7837,
 	0x4000, 0x7833, 0x0010, 0x0e04, 0x0913, 0x2091, 0x5000, 0x2091,
 	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x2071,
 	0x1800, 0x7003, 0x0000, 0x2071, 0x1800, 0x7000, 0x908e, 0x0003,
-	0x1178, 0x080c, 0x4bca, 0x080c, 0x3445, 0x080c, 0x771d, 0x080c,
-	0x6ecf, 0x080c, 0x87ab, 0x080c, 0x842a, 0x080c, 0x2c93, 0x0c58,
+	0x1178, 0x080c, 0x4bc9, 0x080c, 0x344c, 0x080c, 0x7729, 0x080c,
+	0x6ed7, 0x080c, 0x87d4, 0x080c, 0x8453, 0x080c, 0x2c93, 0x0c58,
 	0x000b, 0x0c78, 0x0944, 0x0945, 0x0ae7, 0x0942, 0x0bae, 0x0d68,
 	0x0d68, 0x0d68, 0x080c, 0x0dd5, 0x0005, 0x0126, 0x00f6, 0x2091,
-	0x8000, 0x7000, 0x9086, 0x0001, 0x1904, 0x0aba, 0x080c, 0x56df,
+	0x8000, 0x7000, 0x9086, 0x0001, 0x1904, 0x0aba, 0x080c, 0x56de,
 	0x1130, 0x0026, 0x2011, 0x0080, 0x080c, 0x0edf, 0x002e, 0x080c,
-	0x73b0, 0x0150, 0x080c, 0x73d3, 0x15a0, 0x2079, 0x0100, 0x7828,
-	0x9085, 0x1800, 0x782a, 0x0468, 0x080c, 0x72e2, 0x7000, 0x9086,
+	0x73bc, 0x0150, 0x080c, 0x73df, 0x15a0, 0x2079, 0x0100, 0x7828,
+	0x9085, 0x1800, 0x782a, 0x0468, 0x080c, 0x72ee, 0x7000, 0x9086,
 	0x0001, 0x1904, 0x0aba, 0x7098, 0x9086, 0x0028, 0x1904, 0x0aba,
-	0x080c, 0x83f9, 0x080c, 0x83eb, 0x2001, 0x0161, 0x2003, 0x0001,
+	0x080c, 0x8422, 0x080c, 0x8414, 0x2001, 0x0161, 0x2003, 0x0001,
 	0x2079, 0x0100, 0x7827, 0xffff, 0x7a28, 0x9295, 0x5e2f, 0x7a2a,
-	0x2011, 0x7246, 0x080c, 0x84ca, 0x2011, 0x7239, 0x080c, 0x85a4,
-	0x2011, 0x5e84, 0x080c, 0x84ca, 0x2011, 0x8030, 0x901e, 0x7396,
-	0x04d0, 0x080c, 0x5731, 0x2079, 0x0100, 0x7844, 0x9005, 0x1904,
-	0x0aba, 0x2011, 0x5e84, 0x080c, 0x84ca, 0x2011, 0x7246, 0x080c,
-	0x84ca, 0x2011, 0x7239, 0x080c, 0x85a4, 0x2001, 0x0265, 0x2001,
+	0x2011, 0x7252, 0x080c, 0x84f3, 0x2011, 0x7245, 0x080c, 0x85cd,
+	0x2011, 0x5e83, 0x080c, 0x84f3, 0x2011, 0x8030, 0x901e, 0x7396,
+	0x04d0, 0x080c, 0x5730, 0x2079, 0x0100, 0x7844, 0x9005, 0x1904,
+	0x0aba, 0x2011, 0x5e83, 0x080c, 0x84f3, 0x2011, 0x7252, 0x080c,
+	0x84f3, 0x2011, 0x7245, 0x080c, 0x85cd, 0x2001, 0x0265, 0x2001,
 	0x0205, 0x2003, 0x0000, 0x7840, 0x9084, 0xfffb, 0x7842, 0x2001,
 	0x19a6, 0x2004, 0x9005, 0x1140, 0x00c6, 0x2061, 0x0100, 0x080c,
-	0x5fd1, 0x00ce, 0x0804, 0x0aba, 0x780f, 0x006b, 0x7a28, 0x080c,
-	0x73b8, 0x0118, 0x9295, 0x5e2f, 0x0010, 0x9295, 0x402f, 0x7a2a,
+	0x5fd0, 0x00ce, 0x0804, 0x0aba, 0x780f, 0x006b, 0x7a28, 0x080c,
+	0x73c4, 0x0118, 0x9295, 0x5e2f, 0x0010, 0x9295, 0x402f, 0x7a2a,
 	0x2011, 0x8010, 0x73d8, 0x2001, 0x19a7, 0x2003, 0x0001, 0x080c,
-	0x2b59, 0x080c, 0x4b05, 0x7248, 0xc284, 0x724a, 0x2001, 0x180c,
-	0x200c, 0xc1ac, 0xc1cc, 0x2102, 0x080c, 0xa503, 0x2011, 0x0004,
-	0x080c, 0xcb2b, 0x080c, 0x6823, 0x080c, 0x73b0, 0x1120, 0x080c,
-	0x2b9d, 0x02e0, 0x0400, 0x080c, 0x5fd8, 0x0140, 0x7097, 0x0001,
-	0x70d3, 0x0000, 0x080c, 0x58fe, 0x0804, 0x0aba, 0x080c, 0x56d0,
+	0x2b59, 0x080c, 0x4b04, 0x7248, 0xc284, 0x724a, 0x2001, 0x180c,
+	0x200c, 0xc1ac, 0xc1cc, 0x2102, 0x080c, 0xa51d, 0x2011, 0x0004,
+	0x080c, 0xcb45, 0x080c, 0x6822, 0x080c, 0x73bc, 0x1120, 0x080c,
+	0x2b9d, 0x02e0, 0x0400, 0x080c, 0x5fd7, 0x0140, 0x7097, 0x0001,
+	0x70d3, 0x0000, 0x080c, 0x58fd, 0x0804, 0x0aba, 0x080c, 0x56cf,
 	0xd094, 0x0188, 0x2011, 0x180c, 0x2204, 0xc0cd, 0x2012, 0x080c,
-	0x56d4, 0xd0d4, 0x1118, 0x080c, 0x2b9d, 0x1270, 0x2011, 0x180c,
-	0x2204, 0xc0bc, 0x00a8, 0x080c, 0x56d4, 0xd0d4, 0x1db8, 0x2011,
+	0x56d3, 0xd0d4, 0x1118, 0x080c, 0x2b9d, 0x1270, 0x2011, 0x180c,
+	0x2204, 0xc0bc, 0x00a8, 0x080c, 0x56d3, 0xd0d4, 0x1db8, 0x2011,
 	0x180c, 0x2204, 0xc0bd, 0x0060, 0x2011, 0x180c, 0x2204, 0xc0bd,
-	0x2012, 0x080c, 0x6962, 0x1128, 0xd0a4, 0x0118, 0x2204, 0xc0fd,
-	0x2012, 0x080c, 0x6928, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e, 0x00a8,
-	0x707f, 0x0000, 0x080c, 0x73b0, 0x1130, 0x70b0, 0x9005, 0x1168,
-	0x080c, 0xcf67, 0x0050, 0x080c, 0xcf67, 0x70dc, 0xd09c, 0x1128,
-	0x70b0, 0x9005, 0x0110, 0x080c, 0x5fae, 0x70e7, 0x0000, 0x70e3,
+	0x2012, 0x080c, 0x696a, 0x1128, 0xd0a4, 0x0118, 0x2204, 0xc0fd,
+	0x2012, 0x080c, 0x6930, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e, 0x00a8,
+	0x707f, 0x0000, 0x080c, 0x73bc, 0x1130, 0x70b0, 0x9005, 0x1168,
+	0x080c, 0xcf81, 0x0050, 0x080c, 0xcf81, 0x70dc, 0xd09c, 0x1128,
+	0x70b0, 0x9005, 0x0110, 0x080c, 0x5fad, 0x70e7, 0x0000, 0x70e3,
 	0x0000, 0x70a7, 0x0000, 0x080c, 0x2ba5, 0x0228, 0x2011, 0x0101,
-	0x2204, 0xc0c4, 0x2012, 0x72dc, 0x080c, 0x73b0, 0x1178, 0x9016,
+	0x2204, 0xc0c4, 0x2012, 0x72dc, 0x080c, 0x73bc, 0x1178, 0x9016,
 	0x0016, 0x080c, 0x2956, 0x2019, 0x196d, 0x211a, 0x001e, 0x705f,
 	0xffff, 0x7063, 0x00ef, 0x7083, 0x0000, 0x0020, 0x2019, 0x196d,
 	0x201b, 0x0000, 0x2079, 0x1847, 0x7804, 0xd0ac, 0x0108, 0xc295,
-	0x72de, 0x080c, 0x73b0, 0x0118, 0x9296, 0x0004, 0x0548, 0x2011,
-	0x0001, 0x080c, 0xcb2b, 0x70ab, 0x0000, 0x70af, 0xffff, 0x7003,
+	0x72de, 0x080c, 0x73bc, 0x0118, 0x9296, 0x0004, 0x0548, 0x2011,
+	0x0001, 0x080c, 0xcb45, 0x70ab, 0x0000, 0x70af, 0xffff, 0x7003,
 	0x0002, 0x2079, 0x0100, 0x7827, 0x0003, 0x7828, 0x9085, 0x0003,
-	0x782a, 0x00fe, 0x080c, 0x2f96, 0x2011, 0x0005, 0x080c, 0xa639,
-	0x080c, 0x9664, 0x080c, 0x73b0, 0x0148, 0x00c6, 0x2061, 0x0100,
+	0x782a, 0x00fe, 0x080c, 0x2f96, 0x2011, 0x0005, 0x080c, 0xa653,
+	0x080c, 0x968d, 0x080c, 0x73bc, 0x0148, 0x00c6, 0x2061, 0x0100,
 	0x0016, 0x080c, 0x2956, 0x61e2, 0x001e, 0x00ce, 0x012e, 0x0420,
 	0x70ab, 0x0000, 0x70af, 0xffff, 0x7003, 0x0002, 0x00f6, 0x2079,
 	0x0100, 0x7827, 0x0003, 0x7828, 0x9085, 0x0003, 0x782a, 0x00fe,
-	0x2011, 0x0005, 0x080c, 0xa639, 0x080c, 0x9664, 0x080c, 0x73b0,
+	0x2011, 0x0005, 0x080c, 0xa653, 0x080c, 0x968d, 0x080c, 0x73bc,
 	0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c, 0x2956, 0x61e2,
 	0x001e, 0x00ce, 0x00fe, 0x012e, 0x0005, 0x00c6, 0x00b6, 0x080c,
-	0x73b0, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782, 0x080c,
-	0x73b0, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x86ff, 0x0138,
+	0x73bc, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782, 0x080c,
+	0x73bc, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x86ff, 0x0138,
 	0x9180, 0x1000, 0x2004, 0x905d, 0x0110, 0xb800, 0xd0bc, 0x090c,
-	0x32b4, 0x8108, 0x1f04, 0x0ace, 0x707f, 0x0000, 0x7080, 0x9084,
+	0x32bb, 0x8108, 0x1f04, 0x0ace, 0x707f, 0x0000, 0x7080, 0x9084,
 	0x00ff, 0x7082, 0x70b3, 0x0000, 0x00be, 0x00ce, 0x0005, 0x00b6,
 	0x0126, 0x2091, 0x8000, 0x7000, 0x9086, 0x0002, 0x1904, 0x0bab,
-	0x70ac, 0x9086, 0xffff, 0x0130, 0x080c, 0x2f96, 0x080c, 0x9664,
+	0x70ac, 0x9086, 0xffff, 0x0130, 0x080c, 0x2f96, 0x080c, 0x968d,
 	0x0804, 0x0bab, 0x70dc, 0xd0ac, 0x1110, 0xd09c, 0x0558, 0xd084,
 	0x0548, 0x0006, 0x2001, 0x0103, 0x2003, 0x002b, 0x000e, 0xd08c,
-	0x0508, 0x080c, 0x3317, 0x11d0, 0x70e0, 0x9086, 0xffff, 0x01b0,
-	0x080c, 0x3128, 0x080c, 0x9664, 0x70dc, 0xd094, 0x1904, 0x0bab,
-	0x2011, 0x0001, 0x080c, 0xd216, 0x0110, 0x2011, 0x0003, 0x901e,
-	0x080c, 0x3162, 0x080c, 0x9664, 0x0804, 0x0bab, 0x70e4, 0x9005,
+	0x0508, 0x080c, 0x331e, 0x11d0, 0x70e0, 0x9086, 0xffff, 0x01b0,
+	0x080c, 0x312b, 0x080c, 0x968d, 0x70dc, 0xd094, 0x1904, 0x0bab,
+	0x2011, 0x0001, 0x080c, 0xd230, 0x0110, 0x2011, 0x0003, 0x901e,
+	0x080c, 0x3165, 0x080c, 0x968d, 0x0804, 0x0bab, 0x70e4, 0x9005,
 	0x1904, 0x0bab, 0x70a8, 0x9005, 0x1904, 0x0bab, 0x70dc, 0xd0a4,
-	0x0118, 0xd0b4, 0x0904, 0x0bab, 0x080c, 0x6928, 0x1904, 0x0bab,
-	0x080c, 0x697b, 0x1904, 0x0bab, 0x080c, 0x6962, 0x01c0, 0x0156,
-	0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6600, 0x1118,
+	0x0118, 0xd0b4, 0x0904, 0x0bab, 0x080c, 0x6930, 0x1904, 0x0bab,
+	0x080c, 0x6983, 0x1904, 0x0bab, 0x080c, 0x696a, 0x01c0, 0x0156,
+	0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x65ff, 0x1118,
 	0xb800, 0xd0ec, 0x1138, 0x001e, 0x8108, 0x1f04, 0x0b44, 0x00ce,
 	0x015e, 0x0028, 0x001e, 0x00ce, 0x015e, 0x0804, 0x0bab, 0x0006,
 	0x2001, 0x0103, 0x2003, 0x002b, 0x000e, 0x2011, 0x19b3, 0x080c,
 	0x0f87, 0x2011, 0x19cd, 0x080c, 0x0f87, 0x7030, 0xc08c, 0x7032,
-	0x7003, 0x0003, 0x70af, 0xffff, 0x080c, 0x56df, 0x1130, 0x0026,
+	0x7003, 0x0003, 0x70af, 0xffff, 0x080c, 0x56de, 0x1130, 0x0026,
 	0x2011, 0x0040, 0x080c, 0x0edf, 0x002e, 0x9006, 0x080c, 0x27ea,
-	0x080c, 0x3317, 0x0118, 0x080c, 0x4ca2, 0x0050, 0x0036, 0x0046,
-	0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4cbc, 0x004e, 0x003e,
-	0x00f6, 0x2079, 0x0100, 0x080c, 0x73d3, 0x0150, 0x080c, 0x73b0,
+	0x080c, 0x331e, 0x0118, 0x080c, 0x4ca1, 0x0050, 0x0036, 0x0046,
+	0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4cbb, 0x004e, 0x003e,
+	0x00f6, 0x2079, 0x0100, 0x080c, 0x73df, 0x0150, 0x080c, 0x73bc,
 	0x7828, 0x0118, 0x9084, 0xe1ff, 0x0010, 0x9084, 0xffdf, 0x782a,
 	0x00fe, 0x2001, 0x19e8, 0x2004, 0x9086, 0x0005, 0x1120, 0x2011,
-	0x0000, 0x080c, 0xa639, 0x2011, 0x0000, 0x080c, 0xa643, 0x080c,
-	0x9664, 0x080c, 0x9790, 0x012e, 0x00be, 0x0005, 0x0016, 0x0046,
+	0x0000, 0x080c, 0xa653, 0x2011, 0x0000, 0x080c, 0xa65d, 0x080c,
+	0x968d, 0x080c, 0x97b9, 0x012e, 0x00be, 0x0005, 0x0016, 0x0046,
 	0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100, 0x7904, 0x918c,
-	0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x5f97, 0x7940, 0x918c,
+	0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x5f96, 0x7940, 0x918c,
 	0x0010, 0x7942, 0x7924, 0xd1b4, 0x0110, 0x7827, 0x0040, 0xd19c,
 	0x0110, 0x7827, 0x0008, 0x0006, 0x0036, 0x0156, 0x7954, 0xd1ac,
 	0x1904, 0x0c3b, 0x2001, 0x19a7, 0x2004, 0x9005, 0x1518, 0x080c,
@@ -177,13 +177,13 @@
 	0x080c, 0x2b6b, 0x00b8, 0x080c, 0x2c28, 0x1138, 0x9006, 0x080c,
 	0x2b88, 0x9006, 0x080c, 0x2b6b, 0x0068, 0x080c, 0x2c30, 0x1d50,
 	0x2001, 0x1998, 0x2004, 0xd0fc, 0x0108, 0x0020, 0x080c, 0x2982,
-	0x0804, 0x0d1a, 0x080c, 0x73c1, 0x0148, 0x080c, 0x73d3, 0x1118,
-	0x080c, 0x76a7, 0x0050, 0x080c, 0x73b8, 0x0dd0, 0x080c, 0x76a2,
-	0x080c, 0x7698, 0x080c, 0x72e2, 0x0058, 0x080c, 0x73b0, 0x0140,
-	0x2009, 0x00f8, 0x080c, 0x5f97, 0x7843, 0x0090, 0x7843, 0x0010,
-	0x20a9, 0x09c4, 0x7820, 0xd09c, 0x1138, 0x080c, 0x73b0, 0x0138,
+	0x0804, 0x0d1a, 0x080c, 0x73cd, 0x0148, 0x080c, 0x73df, 0x1118,
+	0x080c, 0x76b3, 0x0050, 0x080c, 0x73c4, 0x0dd0, 0x080c, 0x76ae,
+	0x080c, 0x76a4, 0x080c, 0x72ee, 0x0058, 0x080c, 0x73bc, 0x0140,
+	0x2009, 0x00f8, 0x080c, 0x5f96, 0x7843, 0x0090, 0x7843, 0x0010,
+	0x20a9, 0x09c4, 0x7820, 0xd09c, 0x1138, 0x080c, 0x73bc, 0x0138,
 	0x7824, 0xd0ac, 0x1904, 0x0d1f, 0x1f04, 0x0c1a, 0x0070, 0x7824,
-	0x080c, 0x73ca, 0x0118, 0xd0ac, 0x1904, 0x0d1f, 0x9084, 0x1800,
+	0x080c, 0x73d6, 0x0118, 0xd0ac, 0x1904, 0x0d1f, 0x9084, 0x1800,
 	0x0d98, 0x7003, 0x0001, 0x0804, 0x0d1f, 0x2001, 0x0001, 0x080c,
 	0x27ea, 0x0804, 0x0d32, 0x2001, 0x19a7, 0x2004, 0x9005, 0x1518,
 	0x080c, 0x2c20, 0x1148, 0x2001, 0x0001, 0x080c, 0x2b88, 0x2001,
@@ -192,47 +192,47 @@
 	0x1d50, 0x2001, 0x1998, 0x2004, 0xd0fc, 0x0108, 0x0020, 0x080c,
 	0x2982, 0x0804, 0x0d1a, 0x7850, 0x9085, 0x0040, 0x7852, 0x7938,
 	0x7850, 0x9084, 0xfbcf, 0x7852, 0x080c, 0x2c38, 0x9085, 0x2000,
-	0x7852, 0x793a, 0x20a9, 0x0046, 0x1d04, 0x0c74, 0x080c, 0x8584,
+	0x7852, 0x793a, 0x20a9, 0x0046, 0x1d04, 0x0c74, 0x080c, 0x85ad,
 	0x1f04, 0x0c74, 0x7850, 0x9085, 0x0400, 0x9084, 0xdfbf, 0x7852,
-	0x793a, 0x080c, 0x73c1, 0x0148, 0x080c, 0x73d3, 0x1118, 0x080c,
-	0x76a7, 0x0050, 0x080c, 0x73b8, 0x0dd0, 0x080c, 0x76a2, 0x080c,
-	0x7698, 0x080c, 0x72e2, 0x0020, 0x2009, 0x00f8, 0x080c, 0x5f97,
+	0x793a, 0x080c, 0x73cd, 0x0148, 0x080c, 0x73df, 0x1118, 0x080c,
+	0x76b3, 0x0050, 0x080c, 0x73c4, 0x0dd0, 0x080c, 0x76ae, 0x080c,
+	0x76a4, 0x080c, 0x72ee, 0x0020, 0x2009, 0x00f8, 0x080c, 0x5f96,
 	0x20a9, 0x0028, 0xa001, 0x1f04, 0x0c9a, 0x7850, 0x9085, 0x1400,
-	0x7852, 0x080c, 0x73b0, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010,
-	0x2021, 0xe678, 0x2019, 0xea60, 0x0d0c, 0x8584, 0x7820, 0xd09c,
-	0x1580, 0x080c, 0x73b0, 0x0904, 0x0cff, 0x7824, 0xd0ac, 0x1904,
-	0x0d1f, 0x080c, 0x73d3, 0x1528, 0x0046, 0x2021, 0x0320, 0x8421,
+	0x7852, 0x080c, 0x73bc, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010,
+	0x2021, 0xe678, 0x2019, 0xea60, 0x0d0c, 0x85ad, 0x7820, 0xd09c,
+	0x1580, 0x080c, 0x73bc, 0x0904, 0x0cff, 0x7824, 0xd0ac, 0x1904,
+	0x0d1f, 0x080c, 0x73df, 0x1528, 0x0046, 0x2021, 0x0320, 0x8421,
 	0x1df0, 0x004e, 0x7827, 0x1800, 0x080c, 0x2c38, 0x7824, 0x9084,
 	0x1800, 0x1160, 0x9484, 0x0fff, 0x1138, 0x2001, 0x1810, 0x2004,
 	0xd0fc, 0x0110, 0x080c, 0x0d45, 0x8421, 0x1158, 0x1d04, 0x0cda,
-	0x080c, 0x8584, 0x080c, 0x76a2, 0x080c, 0x7698, 0x7003, 0x0001,
-	0x04f0, 0x8319, 0x1948, 0x1d04, 0x0ce7, 0x080c, 0x8584, 0x2009,
+	0x080c, 0x85ad, 0x080c, 0x76ae, 0x080c, 0x76a4, 0x7003, 0x0001,
+	0x04f0, 0x8319, 0x1948, 0x1d04, 0x0ce7, 0x080c, 0x85ad, 0x2009,
 	0x199b, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a, 0x1178, 0x200b,
 	0x000a, 0x7827, 0x0048, 0x20a9, 0x0002, 0x080c, 0x2c19, 0x7924,
 	0x080c, 0x2c38, 0xd19c, 0x0110, 0x080c, 0x2b59, 0x00d8, 0x080c,
-	0x73c1, 0x1140, 0x94a2, 0x03e8, 0x1128, 0x080c, 0x7388, 0x7003,
+	0x73cd, 0x1140, 0x94a2, 0x03e8, 0x1128, 0x080c, 0x7394, 0x7003,
 	0x0001, 0x00a8, 0x7827, 0x1800, 0x080c, 0x2c38, 0x7824, 0x080c,
-	0x73ca, 0x0110, 0xd0ac, 0x1158, 0x9084, 0x1800, 0x0950, 0x7003,
+	0x73d6, 0x0110, 0xd0ac, 0x1158, 0x9084, 0x1800, 0x0950, 0x7003,
 	0x0001, 0x0028, 0x2001, 0x0001, 0x080c, 0x27ea, 0x0078, 0x2009,
 	0x180c, 0x210c, 0xd19c, 0x1120, 0x7904, 0x918d, 0x0002, 0x7906,
 	0x7827, 0x0048, 0x7828, 0x9085, 0x0028, 0x782a, 0x7850, 0x9085,
 	0x0400, 0x7852, 0x2001, 0x19a7, 0x2003, 0x0000, 0x9006, 0x78f2,
-	0x015e, 0x003e, 0x000e, 0x080c, 0x56df, 0x1110, 0x080c, 0x0e62,
+	0x015e, 0x003e, 0x000e, 0x080c, 0x56de, 0x1110, 0x080c, 0x0e62,
 	0x012e, 0x00fe, 0x004e, 0x001e, 0x0005, 0x0006, 0x0016, 0x0036,
 	0x0046, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0069,
-	0x0d0c, 0x8584, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
+	0x0d0c, 0x85ad, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
 	0x004e, 0x003e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x189e,
-	0x7004, 0x9086, 0x0001, 0x1110, 0x080c, 0x3445, 0x00ee, 0x0005,
+	0x7004, 0x9086, 0x0001, 0x1110, 0x080c, 0x344c, 0x00ee, 0x0005,
 	0x0005, 0x2a70, 0x2061, 0x19ab, 0x2063, 0x0003, 0x6007, 0x0002,
-	0x600b, 0x001a, 0x600f, 0x0137, 0x2001, 0x197c, 0x900e, 0x2102,
+	0x600b, 0x001c, 0x600f, 0x0137, 0x2001, 0x197c, 0x900e, 0x2102,
 	0x7196, 0x2001, 0x0100, 0x2004, 0x9082, 0x0002, 0x0218, 0x705f,
 	0xffff, 0x0008, 0x715e, 0x7067, 0xffff, 0x717e, 0x7182, 0x080c,
-	0xcf67, 0x2061, 0x196c, 0x6003, 0x0909, 0x6106, 0x600b, 0x8800,
+	0xcf81, 0x2061, 0x196c, 0x6003, 0x0909, 0x6106, 0x600b, 0x8800,
 	0x600f, 0x0200, 0x6013, 0x00ff, 0x6017, 0x001f, 0x611a, 0x601f,
 	0x07d0, 0x2061, 0x1974, 0x6003, 0x8000, 0x6106, 0x610a, 0x600f,
 	0x0200, 0x6013, 0x00ff, 0x6116, 0x601b, 0x0001, 0x611e, 0x2061,
 	0x1989, 0x6003, 0x514c, 0x6007, 0x4f47, 0x600b, 0x4943, 0x600f,
-	0x2020, 0x2001, 0x182c, 0x2102, 0x0005, 0x9016, 0x080c, 0x6600,
+	0x2020, 0x2001, 0x182c, 0x2102, 0x0005, 0x9016, 0x080c, 0x65ff,
 	0x1178, 0xb804, 0x90c4, 0x00ff, 0x98c6, 0x0006, 0x0128, 0x90c4,
 	0xff00, 0x98c6, 0x0600, 0x1120, 0x9186, 0x0080, 0x0108, 0x8210,
 	0x8108, 0x9186, 0x0800, 0x1d50, 0x2208, 0x0005, 0x2091, 0x8000,
@@ -251,7 +251,7 @@
 	0x1800, 0x7803, 0x0005, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
 	0xd084, 0x0180, 0x2001, 0x1a19, 0x2004, 0x9005, 0x0128, 0x2001,
 	0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002,
-	0x2003, 0x1001, 0x080c, 0x56df, 0x1110, 0x080c, 0x0e99, 0x0cd0,
+	0x2003, 0x1001, 0x080c, 0x56de, 0x1110, 0x080c, 0x0e99, 0x0cd0,
 	0x0005, 0x918c, 0x03ff, 0x2001, 0x0003, 0x2004, 0x9084, 0x0600,
 	0x1118, 0x918d, 0x2800, 0x0010, 0x918d, 0x2000, 0x2001, 0x017f,
 	0x2102, 0x0005, 0x00f6, 0x0006, 0x2079, 0x1827, 0x2f04, 0x8000,
@@ -315,7 +315,7 @@
 	0x0cd8, 0x00e6, 0x0126, 0x2091, 0x8000, 0x0016, 0x890e, 0x810e,
 	0x810f, 0x9184, 0x003f, 0xa862, 0x9184, 0xffc0, 0xa85e, 0x001e,
 	0x0020, 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1800, 0x702c,
-	0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x83eb,
+	0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8414,
 	0x012e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9026, 0x2009, 0x0000,
 	0x2049, 0x0400, 0x2900, 0x702e, 0x8940, 0x2800, 0xa802, 0xa95e,
 	0xa863, 0x0001, 0x8420, 0x9886, 0x0440, 0x0120, 0x2848, 0x9188,
@@ -380,15 +380,15 @@
 	0x080c, 0x1108, 0x0005, 0x00de, 0x009e, 0x080c, 0x1108, 0x0005,
 	0xa8a8, 0xd08c, 0x0005, 0x0096, 0xa0a0, 0x904d, 0x090c, 0x0dd5,
 	0xa06c, 0x908e, 0x0100, 0x0130, 0xa87b, 0x0030, 0xa883, 0x0000,
-	0xa897, 0x4002, 0x080c, 0x6c6d, 0xa09f, 0x0000, 0xa0a3, 0x0000,
+	0xa897, 0x4002, 0x080c, 0x6c75, 0xa09f, 0x0000, 0xa0a3, 0x0000,
 	0x2848, 0x080c, 0x1031, 0x009e, 0x0005, 0x00a6, 0xa0a0, 0x904d,
 	0x090c, 0x0dd5, 0xa06c, 0x908e, 0x0100, 0x0128, 0xa87b, 0x0001,
 	0xa883, 0x0000, 0x00c0, 0xa80c, 0x2050, 0xb004, 0x9005, 0x0198,
 	0xa80e, 0x2050, 0x8006, 0x8006, 0x8007, 0x908c, 0x003f, 0x9084,
 	0xffc0, 0x9080, 0x0002, 0xa076, 0xa172, 0xb000, 0xa07a, 0x2810,
 	0x080c, 0x10e9, 0x00e8, 0xa97c, 0xa894, 0x0016, 0x0006, 0x080c,
-	0x6c6d, 0x000e, 0x001e, 0xd1fc, 0x1138, 0xd1f4, 0x0128, 0x00c6,
-	0x2060, 0x080c, 0xae47, 0x00ce, 0x7008, 0x2048, 0xa89f, 0x0000,
+	0x6c75, 0x000e, 0x001e, 0xd1fc, 0x1138, 0xd1f4, 0x0128, 0x00c6,
+	0x2060, 0x080c, 0xae61, 0x00ce, 0x7008, 0x2048, 0xa89f, 0x0000,
 	0xa8a3, 0x0000, 0x080c, 0x1031, 0x7007, 0x0000, 0x080c, 0x1108,
 	0x00ae, 0x0005, 0x0126, 0x2091, 0x8000, 0x782b, 0x1001, 0x7007,
 	0x0005, 0x7000, 0xc094, 0x7002, 0x012e, 0x0005, 0x0096, 0x2001,
@@ -397,12 +397,12 @@
 	0x8000, 0x782b, 0x0041, 0x7007, 0x0003, 0x7000, 0xc084, 0x7002,
 	0x2900, 0x700a, 0x012e, 0x009e, 0x0005, 0x20e1, 0x0000, 0x2099,
 	0x0088, 0x782b, 0x0040, 0x0096, 0x2001, 0x192e, 0x204c, 0xaa7c,
-	0x009e, 0x080c, 0x89e3, 0x2009, 0x188c, 0x2104, 0x9084, 0xfffc,
-	0x200a, 0x080c, 0x8856, 0x7007, 0x0000, 0x080c, 0x1119, 0x0005,
+	0x009e, 0x080c, 0x8a0c, 0x2009, 0x188c, 0x2104, 0x9084, 0xfffc,
+	0x200a, 0x080c, 0x887f, 0x7007, 0x0000, 0x080c, 0x1119, 0x0005,
 	0x7007, 0x0000, 0x080c, 0x1119, 0x0005, 0x0126, 0x2091, 0x2200,
 	0x2079, 0x0300, 0x2071, 0x1a62, 0x7003, 0x0000, 0x78bf, 0x00f6,
 	0x781b, 0x4800, 0x00c1, 0x7803, 0x0003, 0x780f, 0x0000, 0x20a9,
-	0x03d0, 0x2061, 0xe9f7, 0x2c0d, 0x7912, 0xe104, 0x9ce0, 0x0002,
+	0x03d0, 0x2061, 0xea18, 0x2c0d, 0x7912, 0xe104, 0x9ce0, 0x0002,
 	0x7916, 0x1f04, 0x1303, 0x7807, 0x0007, 0x7803, 0x0000, 0x7803,
 	0x0001, 0x012e, 0x0005, 0x00c6, 0x7803, 0x0000, 0x7808, 0xd09c,
 	0x0120, 0x7820, 0x080c, 0x1362, 0x0cc8, 0x2001, 0x1a63, 0x2003,
@@ -411,13 +411,13 @@
 	0x782b, 0x1a82, 0x781f, 0xff00, 0x781b, 0xb700, 0x2001, 0x0200,
 	0x2004, 0xd0dc, 0x0110, 0x781f, 0x0303, 0x2061, 0x1a82, 0x602f,
 	0x1cd0, 0x2001, 0x181a, 0x2004, 0x9082, 0x1cd0, 0x6032, 0x603b,
-	0x2090, 0x604f, 0x193c, 0x2001, 0x331e, 0xd0fc, 0x190c, 0x0dd5,
-	0x2001, 0x0003, 0x2004, 0xd0d4, 0x1118, 0x783f, 0x331e, 0x0020,
-	0x9084, 0xc000, 0x783f, 0xb31e, 0x2001, 0x1927, 0x2004, 0x6042,
+	0x2090, 0x2001, 0x3325, 0xd0fc, 0x190c, 0x0dd5, 0x2001, 0x0003,
+	0x2004, 0xd0d4, 0x1118, 0x783f, 0x3325, 0x0020, 0x9084, 0xc000,
+	0x783f, 0xb325, 0x604f, 0x193c, 0x2001, 0x1927, 0x2004, 0x6042,
 	0x00ce, 0x0005, 0x9086, 0x000d, 0x11d0, 0x7808, 0xd09c, 0x01b8,
-	0x7820, 0x0026, 0x2010, 0x080c, 0xcb09, 0x0180, 0x2260, 0x6000,
+	0x7820, 0x0026, 0x2010, 0x080c, 0xcb23, 0x0180, 0x2260, 0x6000,
 	0x9086, 0x0004, 0x1158, 0x0016, 0x6120, 0x9186, 0x0009, 0x0108,
-	0x0020, 0x2009, 0x004c, 0x080c, 0xaec2, 0x001e, 0x002e, 0x0005,
+	0x0020, 0x2009, 0x004c, 0x080c, 0xaedc, 0x001e, 0x002e, 0x0005,
 	0x0126, 0x2091, 0x2200, 0x7908, 0x9184, 0x0070, 0x190c, 0x0dce,
 	0xd19c, 0x0158, 0x7820, 0x908c, 0xf000, 0x15e8, 0x908a, 0x0024,
 	0x1a0c, 0x0dd5, 0x0023, 0x012e, 0x0005, 0x012e, 0x0005, 0x13bb,
@@ -426,18 +426,18 @@
 	0x155b, 0x1566, 0x156d, 0x13bb, 0x13bb, 0x13bb, 0x13bb, 0x13bb,
 	0x13bb, 0x13bb, 0x13e2, 0x13bb, 0x13bb, 0x13bb, 0x13bb, 0x13bb,
 	0x13bb, 0x13bf, 0x13bd, 0x080c, 0x0dd5, 0x080c, 0x0dce, 0x080c,
-	0x1578, 0x2009, 0x1a7b, 0x2104, 0x8000, 0x200a, 0x080c, 0x7e4a,
-	0x080c, 0x1aa9, 0x0005, 0x2009, 0x0048, 0x2060, 0x080c, 0xaec2,
+	0x1578, 0x2009, 0x1a7b, 0x2104, 0x8000, 0x200a, 0x080c, 0x7e56,
+	0x080c, 0x1aa9, 0x0005, 0x2009, 0x0048, 0x2060, 0x080c, 0xaedc,
 	0x012e, 0x0005, 0x7004, 0xc085, 0xc0b5, 0x7006, 0x0005, 0x7004,
 	0xc085, 0x7006, 0x0005, 0x080c, 0x1578, 0x080c, 0x16bb, 0x0005,
 	0x080c, 0x0dd5, 0x080c, 0x1578, 0x2060, 0x6014, 0x0096, 0x2048,
-	0xa83b, 0xffff, 0x009e, 0x2009, 0x0048, 0x080c, 0xaec2, 0x2001,
+	0xa83b, 0xffff, 0x009e, 0x2009, 0x0048, 0x080c, 0xaedc, 0x2001,
 	0x015d, 0x2003, 0x0000, 0x2009, 0x03e8, 0x8109, 0x0160, 0x2001,
 	0x0201, 0x2004, 0x9005, 0x0dc8, 0x2001, 0x0218, 0x2004, 0xd0ec,
 	0x1110, 0x080c, 0x157d, 0x2001, 0x0307, 0x2003, 0x8000, 0x0005,
 	0x7004, 0xc095, 0x7006, 0x0005, 0x080c, 0x1578, 0x2060, 0x6014,
 	0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, 0x2009, 0x0048, 0x080c,
-	0xaec2, 0x0005, 0x080c, 0x1578, 0x080c, 0x0dd5, 0x080c, 0x1578,
+	0xaedc, 0x0005, 0x080c, 0x1578, 0x080c, 0x0dd5, 0x080c, 0x1578,
 	0x080c, 0x14d4, 0x7827, 0x0018, 0x79ac, 0xd1dc, 0x0904, 0x1487,
 	0x7827, 0x0015, 0x7828, 0x782b, 0x0000, 0x9065, 0x0140, 0x2001,
 	0x020d, 0x2003, 0x0050, 0x2003, 0x0020, 0x0804, 0x148d, 0x7004,
@@ -452,14 +452,14 @@
 	0x0810, 0x7004, 0xc09d, 0x7006, 0x78ab, 0x0004, 0x7803, 0x0001,
 	0x080c, 0x14ed, 0x2001, 0x020d, 0x2003, 0x0020, 0x0005, 0x7828,
 	0x782b, 0x0000, 0x9065, 0x090c, 0x0dd5, 0x6014, 0x2048, 0x78ab,
-	0x0004, 0x918c, 0x0700, 0x0198, 0x080c, 0x7e4a, 0x080c, 0x1aa9,
-	0x080c, 0xcb1b, 0x0158, 0xa9ac, 0xa936, 0xa9b0, 0xa93a, 0xa83f,
+	0x0004, 0x918c, 0x0700, 0x0198, 0x080c, 0x7e56, 0x080c, 0x1aa9,
+	0x080c, 0xcb35, 0x0158, 0xa9ac, 0xa936, 0xa9b0, 0xa93a, 0xa83f,
 	0xffff, 0xa843, 0xffff, 0xa880, 0xc0bd, 0xa882, 0x0005, 0x6020,
-	0x9086, 0x0009, 0x1128, 0x2009, 0x004c, 0x080c, 0xaec2, 0x0048,
+	0x9086, 0x0009, 0x1128, 0x2009, 0x004c, 0x080c, 0xaedc, 0x0048,
 	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x6024, 0x190c,
-	0xcf00, 0x2029, 0x00c8, 0x8529, 0x0128, 0x2001, 0x0201, 0x2004,
-	0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xe9a0, 0xd5a4, 0x1118, 0x080c,
-	0x157d, 0x0005, 0x080c, 0x7e4a, 0x080c, 0x1aa9, 0x0005, 0x781f,
+	0xcf1a, 0x2029, 0x00c8, 0x8529, 0x0128, 0x2001, 0x0201, 0x2004,
+	0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xe9c1, 0xd5a4, 0x1118, 0x080c,
+	0x157d, 0x0005, 0x080c, 0x7e56, 0x080c, 0x1aa9, 0x0005, 0x781f,
 	0x0300, 0x7803, 0x0001, 0x0005, 0x0016, 0x0066, 0x0076, 0x00f6,
 	0x2079, 0x0300, 0x7908, 0x918c, 0x0007, 0x9186, 0x0003, 0x0120,
 	0x2001, 0x0016, 0x080c, 0x15ee, 0x00fe, 0x007e, 0x006e, 0x001e,
@@ -476,10 +476,10 @@
 	0x0218, 0x2004, 0xd0ec, 0x1118, 0x080c, 0x157d, 0x0040, 0x2001,
 	0x020d, 0x2003, 0x0020, 0x080c, 0x1313, 0x7803, 0x0001, 0x00ee,
 	0x001e, 0x0005, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003, 0x0020,
-	0x0461, 0x0ca8, 0x0429, 0x2060, 0x2009, 0x0053, 0x080c, 0xaec2,
+	0x0461, 0x0ca8, 0x0429, 0x2060, 0x2009, 0x0053, 0x080c, 0xaedc,
 	0x0005, 0x0005, 0x0005, 0x00e1, 0x2008, 0x00d1, 0x0006, 0x7004,
-	0xc09d, 0x7006, 0x000e, 0x080c, 0x8d40, 0x0005, 0x0089, 0x9005,
-	0x0118, 0x080c, 0x8943, 0x0cd0, 0x0005, 0x2001, 0x0036, 0x2009,
+	0xc09d, 0x7006, 0x000e, 0x080c, 0x8d69, 0x0005, 0x0089, 0x9005,
+	0x0118, 0x080c, 0x896c, 0x0cd0, 0x0005, 0x2001, 0x0036, 0x2009,
 	0x1820, 0x210c, 0x2011, 0x181f, 0x2214, 0x080c, 0x15ee, 0x0005,
 	0x7808, 0xd09c, 0x0de8, 0x7820, 0x0005, 0x080c, 0x14d4, 0x00d6,
 	0x2069, 0x0200, 0x2009, 0x01f4, 0x8109, 0x0510, 0x6804, 0x9005,
@@ -488,7 +488,7 @@
 	0x0007, 0x918c, 0x0ff8, 0x810c, 0x810c, 0x810c, 0x080c, 0x15e0,
 	0x6827, 0x0001, 0x8109, 0x1dd0, 0x04d9, 0x6827, 0x0002, 0x04c1,
 	0x6804, 0x9005, 0x1130, 0x682c, 0xd0e4, 0x1500, 0x6804, 0x9005,
-	0x0de8, 0x79b8, 0xd1ec, 0x1130, 0x08c0, 0x080c, 0x7e4a, 0x080c,
+	0x0de8, 0x79b8, 0xd1ec, 0x1130, 0x08c0, 0x080c, 0x7e56, 0x080c,
 	0x1aa9, 0x0090, 0x7827, 0x0015, 0x782b, 0x0000, 0x7827, 0x0018,
 	0x782b, 0x0000, 0x2001, 0x020d, 0x2003, 0x0020, 0x2001, 0x0307,
 	0x2003, 0x0300, 0x7803, 0x0001, 0x00de, 0x0005, 0x682c, 0x9084,
@@ -505,7 +505,7 @@
 	0x0048, 0x9086, 0x0008, 0x1904, 0x1667, 0x2001, 0x0109, 0x2004,
 	0xd08c, 0x01f0, 0x0006, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
 	0x0126, 0x2091, 0x2800, 0x00f6, 0x0026, 0x0016, 0x2009, 0x1a7d,
-	0x2104, 0x8000, 0x0208, 0x200a, 0x080c, 0x9079, 0x001e, 0x002e,
+	0x2104, 0x8000, 0x0208, 0x200a, 0x080c, 0x90a2, 0x001e, 0x002e,
 	0x00fe, 0x012e, 0x015e, 0x014e, 0x013e, 0x01de, 0x01ce, 0x000e,
 	0x2001, 0x009b, 0x2004, 0xd0fc, 0x01d0, 0x0006, 0x0126, 0x01c6,
 	0x01d6, 0x0136, 0x0146, 0x0156, 0x00f6, 0x0016, 0x2009, 0x1a7e,
@@ -515,7 +515,7 @@
 	0x1528, 0x7a18, 0x9284, 0x0030, 0x0508, 0x9284, 0x0048, 0x9086,
 	0x0008, 0x11e0, 0x2001, 0x19f6, 0x2004, 0x9005, 0x01b8, 0x2001,
 	0x1a66, 0x2004, 0x9086, 0x0000, 0x0188, 0x2009, 0x1a7c, 0x2104,
-	0x8000, 0x0208, 0x200a, 0x080c, 0xa2dd, 0x2009, 0x180c, 0x2104,
+	0x8000, 0x0208, 0x200a, 0x080c, 0xa2f7, 0x2009, 0x180c, 0x2104,
 	0xc0f5, 0x200a, 0x2009, 0xff00, 0x0804, 0x1617, 0x9085, 0x0001,
 	0x0005, 0x7832, 0x7936, 0x7a3a, 0x781b, 0x8080, 0x080c, 0x1610,
 	0x1108, 0x0005, 0x792c, 0x3900, 0x8000, 0x2004, 0x080c, 0x0dd5,
@@ -526,8 +526,8 @@
 	0x0000, 0x2001, 0x0264, 0x2004, 0xd0bc, 0x0904, 0x171a, 0x2001,
 	0x0268, 0x00c6, 0x2064, 0x6104, 0x6038, 0x00ce, 0x918e, 0x0039,
 	0x1904, 0x171a, 0x9c06, 0x15f0, 0x0126, 0x2091, 0x2600, 0x080c,
-	0x7d91, 0x012e, 0x7358, 0x745c, 0x6014, 0x905d, 0x0598, 0x2b48,
-	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x190c, 0xcedb,
+	0x7d9d, 0x012e, 0x7358, 0x745c, 0x6014, 0x905d, 0x0598, 0x2b48,
+	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x190c, 0xcef5,
 	0xab42, 0xac3e, 0x2001, 0x1869, 0x2004, 0xd0b4, 0x1170, 0x601c,
 	0xd0e4, 0x1158, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
 	0x1120, 0xa83b, 0x7fff, 0xa837, 0xffff, 0x080c, 0x20b0, 0x1190,
@@ -543,7 +543,7 @@
 	0x9085, 0x0001, 0x0804, 0x18a1, 0xa87c, 0xd0ac, 0x0dc8, 0x0804,
 	0x17c5, 0xa87c, 0xd0ac, 0x0da0, 0x0804, 0x1830, 0xa898, 0x901d,
 	0x1108, 0xab9c, 0x9016, 0xaab2, 0xaa3e, 0xaa42, 0x3e00, 0x9080,
-	0x0008, 0x2004, 0x9080, 0x8f07, 0x2005, 0x9005, 0x090c, 0x0dd5,
+	0x0008, 0x2004, 0x9080, 0x8f30, 0x2005, 0x9005, 0x090c, 0x0dd5,
 	0x2004, 0xa8ae, 0x0804, 0x1889, 0xa87c, 0xd0bc, 0x09c8, 0xa890,
 	0xa842, 0xa88c, 0xa83e, 0xa888, 0x0804, 0x17c5, 0xa87c, 0xd0bc,
 	0x0978, 0xa890, 0xa842, 0xa88c, 0xa83e, 0xa888, 0x0804, 0x1830,
@@ -637,7 +637,7 @@
 	0x810c, 0x810c, 0x81ff, 0x1118, 0xa887, 0x0001, 0x0008, 0xa986,
 	0x601b, 0x0002, 0xa974, 0xd1dc, 0x1108, 0x0005, 0xa934, 0xa88c,
 	0x9106, 0x1158, 0xa938, 0xa890, 0x9106, 0x1138, 0x601c, 0xc084,
-	0x601e, 0x2009, 0x0048, 0x0804, 0xaec2, 0x0005, 0x0126, 0x00c6,
+	0x601e, 0x2009, 0x0048, 0x0804, 0xaedc, 0x0005, 0x0126, 0x00c6,
 	0x2091, 0x2200, 0x00ce, 0x7908, 0x918c, 0x0007, 0x9186, 0x0000,
 	0x05b0, 0x9186, 0x0003, 0x0598, 0x6020, 0x6023, 0x0000, 0x0006,
 	0x2031, 0x0008, 0x00c6, 0x781f, 0x0808, 0x7808, 0xd09c, 0x0120,
@@ -648,17 +648,17 @@
 	0x1d40, 0x080c, 0x1b45, 0x000e, 0x6022, 0x012e, 0x0005, 0x080c,
 	0x1b32, 0x7827, 0x0015, 0x7828, 0x9c06, 0x1db8, 0x782b, 0x0000,
 	0x0ca0, 0x00f6, 0x2079, 0x0300, 0x7803, 0x0000, 0x78ab, 0x0004,
-	0x00fe, 0x080c, 0x73b0, 0x11b0, 0x2001, 0x0138, 0x2003, 0x0000,
+	0x00fe, 0x080c, 0x73bc, 0x11b0, 0x2001, 0x0138, 0x2003, 0x0000,
 	0x2001, 0x0160, 0x2003, 0x0000, 0x2011, 0x012c, 0xa001, 0xa001,
-	0x8211, 0x1de0, 0x0081, 0x0066, 0x2031, 0x0000, 0x080c, 0x7460,
+	0x8211, 0x1de0, 0x0081, 0x0066, 0x2031, 0x0000, 0x080c, 0x746c,
 	0x006e, 0x0005, 0x0479, 0x0039, 0x2001, 0x0160, 0x2502, 0x2001,
 	0x0138, 0x2202, 0x0005, 0x00e6, 0x2071, 0x0200, 0x080c, 0x2c44,
 	0x2009, 0x003c, 0x080c, 0x23d2, 0x2001, 0x015d, 0x2003, 0x0000,
-	0x7000, 0x9084, 0x003c, 0x1de0, 0x080c, 0x83eb, 0x70a0, 0x70a2,
+	0x7000, 0x9084, 0x003c, 0x1de0, 0x080c, 0x8414, 0x70a0, 0x70a2,
 	0x7098, 0x709a, 0x709c, 0x709e, 0x2001, 0x020d, 0x2003, 0x0020,
 	0x00f6, 0x2079, 0x0300, 0x080c, 0x1313, 0x7803, 0x0001, 0x00fe,
 	0x00ee, 0x0005, 0x2001, 0x0138, 0x2014, 0x2003, 0x0000, 0x2001,
-	0x0160, 0x202c, 0x2003, 0x0000, 0x080c, 0x73b0, 0x1108, 0x0005,
+	0x0160, 0x202c, 0x2003, 0x0000, 0x080c, 0x73bc, 0x1108, 0x0005,
 	0x2021, 0x0260, 0x2001, 0x0141, 0x201c, 0xd3dc, 0x1168, 0x2001,
 	0x0109, 0x201c, 0x939c, 0x0048, 0x1160, 0x2001, 0x0111, 0x201c,
 	0x83ff, 0x1110, 0x8421, 0x1d70, 0x2001, 0x015d, 0x2003, 0x0000,
@@ -770,13 +770,13 @@
 	0x002e, 0x003e, 0x004e, 0x005e, 0x006e, 0x007e, 0x0005, 0x080c,
 	0x0dd5, 0x0026, 0x2001, 0x0105, 0x2003, 0x0010, 0x782b, 0x0004,
 	0x7003, 0x0000, 0x7004, 0x0016, 0x080c, 0x1cbe, 0x001e, 0x2060,
-	0x6014, 0x2048, 0x080c, 0xcb1b, 0x0118, 0xa880, 0xc0bd, 0xa882,
+	0x6014, 0x2048, 0x080c, 0xcb35, 0x0118, 0xa880, 0xc0bd, 0xa882,
 	0x6020, 0x9086, 0x0006, 0x1180, 0x2061, 0x0100, 0x62c8, 0x2001,
 	0x00fa, 0x8001, 0x1df0, 0x60c8, 0x9206, 0x1dc0, 0x60c4, 0xa89a,
-	0x60c8, 0xa896, 0x7004, 0x2060, 0x00c6, 0x080c, 0xc74e, 0x00ce,
+	0x60c8, 0xa896, 0x7004, 0x2060, 0x00c6, 0x080c, 0xc768, 0x00ce,
 	0x2001, 0x19f6, 0x2004, 0x9c06, 0x1160, 0x2009, 0x0040, 0x080c,
-	0x23d2, 0x080c, 0xa7b2, 0x2011, 0x0000, 0x080c, 0xa643, 0x080c,
-	0x9790, 0x002e, 0x0804, 0x1ff8, 0x0126, 0x2091, 0x2400, 0xa858,
+	0x23d2, 0x080c, 0xa7cc, 0x2011, 0x0000, 0x080c, 0xa65d, 0x080c,
+	0x97b9, 0x002e, 0x0804, 0x1ff8, 0x0126, 0x2091, 0x2400, 0xa858,
 	0x2040, 0x792c, 0x782b, 0x0002, 0x9184, 0x0700, 0x1904, 0x1e71,
 	0x7000, 0x0002, 0x1ff8, 0x1ec6, 0x1f46, 0x1ff6, 0x8001, 0x7002,
 	0x7027, 0x0000, 0xd19c, 0x1158, 0x8aff, 0x0904, 0x1f13, 0x080c,
@@ -820,7 +820,7 @@
 	0x012e, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a66, 0x7000, 0x9086,
 	0x0000, 0x0904, 0x2043, 0x2079, 0x0090, 0x2009, 0x0207, 0x210c,
 	0xd194, 0x01b8, 0x2009, 0x020c, 0x210c, 0x9184, 0x0003, 0x0188,
-	0x080c, 0xe9e9, 0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0dd5,
+	0x080c, 0xea0a, 0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0dd5,
 	0x0016, 0x2009, 0x0040, 0x080c, 0x23d2, 0x001e, 0x2001, 0x020c,
 	0x2102, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106,
 	0x1120, 0x2009, 0x0040, 0x080c, 0x23d2, 0x782c, 0xd0fc, 0x09a8,
@@ -910,16 +910,16 @@
 	0x783b, 0x001f, 0x7837, 0x0020, 0x7803, 0x1600, 0x012e, 0x0005,
 	0x2091, 0x2600, 0x781c, 0xd0a4, 0x190c, 0x23cf, 0x7900, 0xd1dc,
 	0x1118, 0x9084, 0x0006, 0x001a, 0x9084, 0x000e, 0x0002, 0x22f7,
-	0x22ef, 0x7d91, 0x22ef, 0x22f1, 0x22f1, 0x22f1, 0x22f1, 0x7d77,
+	0x22ef, 0x7d9d, 0x22ef, 0x22f1, 0x22f1, 0x22f1, 0x22f1, 0x7d83,
 	0x22ef, 0x22f3, 0x22ef, 0x22f1, 0x22ef, 0x22f1, 0x22ef, 0x080c,
-	0x0dd5, 0x0031, 0x0020, 0x080c, 0x7d77, 0x080c, 0x7d91, 0x0005,
-	0x0006, 0x0016, 0x0026, 0x080c, 0xe9e9, 0x7930, 0x9184, 0x0003,
+	0x0dd5, 0x0031, 0x0020, 0x080c, 0x7d83, 0x080c, 0x7d9d, 0x0005,
+	0x0006, 0x0016, 0x0026, 0x080c, 0xea0a, 0x7930, 0x9184, 0x0003,
 	0x01c0, 0x2001, 0x19f6, 0x2004, 0x9005, 0x0170, 0x2001, 0x0133,
 	0x2004, 0x9005, 0x090c, 0x0dd5, 0x00c6, 0x2001, 0x19f6, 0x2064,
-	0x080c, 0xc74e, 0x00ce, 0x00f8, 0x2009, 0x0040, 0x080c, 0x23d2,
+	0x080c, 0xc768, 0x00ce, 0x00f8, 0x2009, 0x0040, 0x080c, 0x23d2,
 	0x00d0, 0x9184, 0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160,
-	0x080c, 0x73b0, 0x1138, 0x080c, 0x7698, 0x080c, 0x601b, 0x080c,
-	0x72e2, 0x0010, 0x080c, 0x5eda, 0x080c, 0x7e40, 0x0041, 0x0018,
+	0x080c, 0x73bc, 0x1138, 0x080c, 0x76a4, 0x080c, 0x601a, 0x080c,
+	0x72ee, 0x0010, 0x080c, 0x5ed9, 0x080c, 0x7e4c, 0x0041, 0x0018,
 	0x9184, 0x9540, 0x1dc8, 0x002e, 0x001e, 0x000e, 0x0005, 0x00e6,
 	0x0036, 0x0046, 0x0056, 0x2071, 0x1a62, 0x080c, 0x1aa9, 0x005e,
 	0x004e, 0x003e, 0x00ee, 0x0005, 0x0126, 0x2091, 0x2e00, 0x2071,
@@ -969,99 +969,99 @@
 	0x0007, 0x0082, 0x0016, 0x2001, 0x188b, 0x200c, 0xd184, 0x001e,
 	0x0d70, 0x0c98, 0x0016, 0x2001, 0x188b, 0x200c, 0xd194, 0x001e,
 	0x0d30, 0x0c58, 0x24d4, 0x24ba, 0x24bd, 0x24c0, 0x24c5, 0x24c7,
-	0x24cb, 0x24cf, 0x080c, 0x8fac, 0x00b8, 0x080c, 0x9079, 0x00a0,
-	0x080c, 0x9079, 0x080c, 0x8fac, 0x0078, 0x0099, 0x0068, 0x080c,
-	0x8fac, 0x0079, 0x0048, 0x080c, 0x9079, 0x0059, 0x0028, 0x080c,
-	0x9079, 0x080c, 0x8fac, 0x0029, 0x002e, 0x001e, 0x000e, 0x012e,
+	0x24cb, 0x24cf, 0x080c, 0x8fd5, 0x00b8, 0x080c, 0x90a2, 0x00a0,
+	0x080c, 0x90a2, 0x080c, 0x8fd5, 0x0078, 0x0099, 0x0068, 0x080c,
+	0x8fd5, 0x0079, 0x0048, 0x080c, 0x90a2, 0x0059, 0x0028, 0x080c,
+	0x90a2, 0x080c, 0x8fd5, 0x0029, 0x002e, 0x001e, 0x000e, 0x012e,
 	0x0005, 0x00a6, 0x6124, 0x6028, 0xd09c, 0x0118, 0xd19c, 0x1904,
-	0x273c, 0xd1f4, 0x190c, 0x0dce, 0x080c, 0x73b0, 0x0904, 0x252f,
-	0x080c, 0xd216, 0x1120, 0x7000, 0x9086, 0x0003, 0x0570, 0x6024,
-	0x9084, 0x1800, 0x0550, 0x080c, 0x73d3, 0x0118, 0x080c, 0x73c1,
-	0x1520, 0x6027, 0x0020, 0x6043, 0x0000, 0x080c, 0xd216, 0x0168,
-	0x080c, 0x73d3, 0x1150, 0x2001, 0x19a7, 0x2003, 0x0001, 0x6027,
-	0x1800, 0x080c, 0x7246, 0x0804, 0x273f, 0x70a4, 0x9005, 0x1150,
-	0x70a7, 0x0001, 0x00d6, 0x2069, 0x0140, 0x080c, 0x7407, 0x00de,
-	0x1904, 0x273f, 0x080c, 0x76a2, 0x0428, 0x080c, 0x73d3, 0x1590,
-	0x6024, 0x9084, 0x1800, 0x1108, 0x0468, 0x080c, 0x76a2, 0x080c,
-	0x7698, 0x080c, 0x601b, 0x080c, 0x72e2, 0x0804, 0x273c, 0xd1ac,
+	0x273c, 0xd1f4, 0x190c, 0x0dce, 0x080c, 0x73bc, 0x0904, 0x252f,
+	0x080c, 0xd230, 0x1120, 0x7000, 0x9086, 0x0003, 0x0570, 0x6024,
+	0x9084, 0x1800, 0x0550, 0x080c, 0x73df, 0x0118, 0x080c, 0x73cd,
+	0x1520, 0x6027, 0x0020, 0x6043, 0x0000, 0x080c, 0xd230, 0x0168,
+	0x080c, 0x73df, 0x1150, 0x2001, 0x19a7, 0x2003, 0x0001, 0x6027,
+	0x1800, 0x080c, 0x7252, 0x0804, 0x273f, 0x70a4, 0x9005, 0x1150,
+	0x70a7, 0x0001, 0x00d6, 0x2069, 0x0140, 0x080c, 0x7413, 0x00de,
+	0x1904, 0x273f, 0x080c, 0x76ae, 0x0428, 0x080c, 0x73df, 0x1590,
+	0x6024, 0x9084, 0x1800, 0x1108, 0x0468, 0x080c, 0x76ae, 0x080c,
+	0x76a4, 0x080c, 0x601a, 0x080c, 0x72ee, 0x0804, 0x273c, 0xd1ac,
 	0x1508, 0x6024, 0xd0dc, 0x1170, 0xd0e4, 0x1178, 0xd0d4, 0x1190,
-	0xd0cc, 0x0130, 0x7098, 0x9086, 0x0028, 0x1110, 0x080c, 0x7585,
-	0x0804, 0x273c, 0x080c, 0x769d, 0x0048, 0x2001, 0x197d, 0x2003,
-	0x0002, 0x0020, 0x080c, 0x74ea, 0x0804, 0x273c, 0x080c, 0x7620,
+	0xd0cc, 0x0130, 0x7098, 0x9086, 0x0028, 0x1110, 0x080c, 0x7591,
+	0x0804, 0x273c, 0x080c, 0x76a9, 0x0048, 0x2001, 0x197d, 0x2003,
+	0x0002, 0x0020, 0x080c, 0x74f6, 0x0804, 0x273c, 0x080c, 0x762c,
 	0x0804, 0x273c, 0x6220, 0xd1bc, 0x0138, 0xd2bc, 0x1904, 0x27af,
 	0xd2b4, 0x1904, 0x27c2, 0x0000, 0xd1ac, 0x0904, 0x2651, 0x0036,
-	0x6328, 0xc3bc, 0x632a, 0x003e, 0x080c, 0x73b0, 0x11c0, 0x6027,
-	0x0020, 0x0006, 0x0026, 0x0036, 0x080c, 0x73ca, 0x1158, 0x080c,
-	0x7698, 0x080c, 0x601b, 0x080c, 0x72e2, 0x003e, 0x002e, 0x000e,
-	0x00ae, 0x0005, 0x003e, 0x002e, 0x000e, 0x080c, 0x7388, 0x0016,
+	0x6328, 0xc3bc, 0x632a, 0x003e, 0x080c, 0x73bc, 0x11c0, 0x6027,
+	0x0020, 0x0006, 0x0026, 0x0036, 0x080c, 0x73d6, 0x1158, 0x080c,
+	0x76a4, 0x080c, 0x601a, 0x080c, 0x72ee, 0x003e, 0x002e, 0x000e,
+	0x00ae, 0x0005, 0x003e, 0x002e, 0x000e, 0x080c, 0x7394, 0x0016,
 	0x0046, 0x00c6, 0x644c, 0x9486, 0xf0f0, 0x1138, 0x2061, 0x0100,
 	0x644a, 0x6043, 0x0090, 0x6043, 0x0010, 0x74da, 0x948c, 0xff00,
 	0x7038, 0xd084, 0x0178, 0x9186, 0xf800, 0x1160, 0x7048, 0xd084,
 	0x1148, 0xc085, 0x704a, 0x0036, 0x2418, 0x2011, 0x8016, 0x080c,
-	0x4b05, 0x003e, 0x080c, 0xd20f, 0x1904, 0x262e, 0x9196, 0xff00,
+	0x4b04, 0x003e, 0x080c, 0xd229, 0x1904, 0x262e, 0x9196, 0xff00,
 	0x05a8, 0x7060, 0x9084, 0x00ff, 0x810f, 0x81ff, 0x0110, 0x9116,
-	0x0568, 0x7130, 0xd184, 0x1550, 0x080c, 0x3312, 0x0128, 0xc18d,
-	0x7132, 0x080c, 0x6962, 0x1510, 0x6240, 0x9294, 0x0010, 0x0130,
+	0x0568, 0x7130, 0xd184, 0x1550, 0x080c, 0x3319, 0x0128, 0xc18d,
+	0x7132, 0x080c, 0x696a, 0x1510, 0x6240, 0x9294, 0x0010, 0x0130,
 	0x6248, 0x9294, 0xff00, 0x9296, 0xff00, 0x01c0, 0x7030, 0xd08c,
 	0x0904, 0x262e, 0x7038, 0xd08c, 0x1140, 0x2001, 0x180c, 0x200c,
 	0xd1ac, 0x1904, 0x262e, 0xc1ad, 0x2102, 0x0036, 0x73d8, 0x2011,
-	0x8013, 0x080c, 0x4b05, 0x003e, 0x0804, 0x262e, 0x7038, 0xd08c,
+	0x8013, 0x080c, 0x4b04, 0x003e, 0x0804, 0x262e, 0x7038, 0xd08c,
 	0x1140, 0x2001, 0x180c, 0x200c, 0xd1ac, 0x1904, 0x262e, 0xc1ad,
-	0x2102, 0x0036, 0x73d8, 0x2011, 0x8013, 0x080c, 0x4b05, 0x003e,
+	0x2102, 0x0036, 0x73d8, 0x2011, 0x8013, 0x080c, 0x4b04, 0x003e,
 	0x7130, 0xc185, 0x7132, 0x2011, 0x1848, 0x220c, 0xd1a4, 0x01f0,
-	0x0016, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x86b4, 0x2019,
-	0x000e, 0x00c6, 0x2061, 0x0000, 0x080c, 0xe501, 0x00ce, 0x9484,
-	0x00ff, 0x9080, 0x331e, 0x200d, 0x918c, 0xff00, 0x810f, 0x2120,
-	0x9006, 0x2009, 0x000e, 0x080c, 0xe58d, 0x001e, 0x0016, 0x2009,
-	0x0002, 0x2019, 0x0004, 0x080c, 0x3187, 0x001e, 0x0078, 0x0156,
-	0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x6600, 0x1110, 0x080c,
-	0x6035, 0x8108, 0x1f04, 0x2624, 0x00be, 0x015e, 0x00ce, 0x004e,
-	0x080c, 0xadb8, 0x60e3, 0x0000, 0x001e, 0x2001, 0x1800, 0x2014,
+	0x0016, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x86dd, 0x2019,
+	0x000e, 0x00c6, 0x2061, 0x0000, 0x080c, 0xe522, 0x00ce, 0x9484,
+	0x00ff, 0x9080, 0x3325, 0x200d, 0x918c, 0xff00, 0x810f, 0x2120,
+	0x9006, 0x2009, 0x000e, 0x080c, 0xe5ae, 0x001e, 0x0016, 0x2009,
+	0x0002, 0x2019, 0x0004, 0x080c, 0x318a, 0x001e, 0x0078, 0x0156,
+	0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x65ff, 0x1110, 0x080c,
+	0x6034, 0x8108, 0x1f04, 0x2624, 0x00be, 0x015e, 0x00ce, 0x004e,
+	0x080c, 0xadd2, 0x60e3, 0x0000, 0x001e, 0x2001, 0x1800, 0x2014,
 	0x9296, 0x0004, 0x1170, 0xd19c, 0x11a0, 0x2011, 0x180c, 0x2214,
 	0xd29c, 0x1120, 0x6204, 0x9295, 0x0002, 0x6206, 0x6228, 0xc29d,
 	0x622a, 0x2003, 0x0001, 0x2001, 0x1826, 0x2003, 0x0000, 0x6027,
 	0x0020, 0xd194, 0x0904, 0x273c, 0x0016, 0x6220, 0xd2b4, 0x0904,
-	0x26d9, 0x080c, 0x8550, 0x080c, 0xa259, 0x6027, 0x0004, 0x00f6,
+	0x26d9, 0x080c, 0x8579, 0x080c, 0xa273, 0x6027, 0x0004, 0x00f6,
 	0x2019, 0x19f0, 0x2304, 0x907d, 0x0904, 0x26a8, 0x7804, 0x9086,
 	0x0032, 0x15f0, 0x00d6, 0x00c6, 0x00e6, 0x0096, 0x2069, 0x0140,
 	0x782c, 0x685e, 0x7808, 0x685a, 0x6043, 0x0002, 0x2001, 0x0003,
 	0x8001, 0x1df0, 0x6043, 0x0000, 0x2001, 0x003c, 0x8001, 0x1df0,
 	0x080c, 0x2cff, 0x2001, 0x001e, 0x8001, 0x0240, 0x20a9, 0x0009,
 	0x080c, 0x2c19, 0x6904, 0xd1dc, 0x1140, 0x0cb0, 0x2001, 0x0100,
-	0x080c, 0x2cef, 0x9006, 0x080c, 0x2cef, 0x080c, 0x955f, 0x080c,
-	0x9664, 0x7814, 0x2048, 0xa867, 0x0103, 0x2f60, 0x080c, 0xae47,
+	0x080c, 0x2cef, 0x9006, 0x080c, 0x2cef, 0x080c, 0x9588, 0x080c,
+	0x968d, 0x7814, 0x2048, 0xa867, 0x0103, 0x2f60, 0x080c, 0xae61,
 	0x009e, 0x00ee, 0x00ce, 0x00de, 0x00fe, 0x001e, 0x00ae, 0x0005,
 	0x00fe, 0x00d6, 0x2069, 0x0140, 0x6804, 0x9084, 0x4000, 0x0110,
 	0x080c, 0x2cff, 0x00de, 0x00c6, 0x2061, 0x19e7, 0x6028, 0x080c,
-	0xd216, 0x0120, 0x909a, 0x0003, 0x1258, 0x0018, 0x909a, 0x00c8,
-	0x1238, 0x8000, 0x602a, 0x00ce, 0x080c, 0xa235, 0x0804, 0x273b,
-	0x2061, 0x0100, 0x62c0, 0x080c, 0xac43, 0x2019, 0x19f0, 0x2304,
-	0x9065, 0x0120, 0x2009, 0x0027, 0x080c, 0xaec2, 0x00ce, 0x0804,
-	0x273b, 0xd2bc, 0x0904, 0x2722, 0x080c, 0x855d, 0x6014, 0x9084,
+	0xd230, 0x0120, 0x909a, 0x0003, 0x1258, 0x0018, 0x909a, 0x00c8,
+	0x1238, 0x8000, 0x602a, 0x00ce, 0x080c, 0xa24f, 0x0804, 0x273b,
+	0x2061, 0x0100, 0x62c0, 0x080c, 0xac5d, 0x2019, 0x19f0, 0x2304,
+	0x9065, 0x0120, 0x2009, 0x0027, 0x080c, 0xaedc, 0x00ce, 0x0804,
+	0x273b, 0xd2bc, 0x0904, 0x2722, 0x080c, 0x8586, 0x6014, 0x9084,
 	0x1984, 0x9085, 0x0010, 0x6016, 0x6027, 0x0004, 0x00d6, 0x2069,
 	0x0140, 0x6804, 0x9084, 0x4000, 0x0110, 0x080c, 0x2cff, 0x00de,
-	0x00c6, 0x2061, 0x19e7, 0x6044, 0x080c, 0xd216, 0x0120, 0x909a,
+	0x00c6, 0x2061, 0x19e7, 0x6044, 0x080c, 0xd230, 0x0120, 0x909a,
 	0x0003, 0x1658, 0x0018, 0x909a, 0x00c8, 0x1638, 0x8000, 0x6046,
-	0x603c, 0x00ce, 0x9005, 0x05b8, 0x2009, 0x07d0, 0x080c, 0x8555,
+	0x603c, 0x00ce, 0x9005, 0x05b8, 0x2009, 0x07d0, 0x080c, 0x857e,
 	0x9080, 0x0008, 0x2004, 0x9086, 0x0006, 0x1138, 0x6114, 0x918c,
 	0x1984, 0x918d, 0x0012, 0x6116, 0x0430, 0x9080, 0x0008, 0x2004,
 	0x9086, 0x0009, 0x0d98, 0x6114, 0x918c, 0x1984, 0x918d, 0x0016,
 	0x6116, 0x00c8, 0x6027, 0x0004, 0x00b0, 0x0036, 0x2019, 0x0001,
-	0x080c, 0xa59c, 0x003e, 0x2019, 0x19f6, 0x2304, 0x9065, 0x0150,
+	0x080c, 0xa5b6, 0x003e, 0x2019, 0x19f6, 0x2304, 0x9065, 0x0150,
 	0x2009, 0x004f, 0x6020, 0x9086, 0x0009, 0x1110, 0x2009, 0x004f,
-	0x080c, 0xaec2, 0x00ce, 0x001e, 0xd19c, 0x0904, 0x27aa, 0x7038,
+	0x080c, 0xaedc, 0x00ce, 0x001e, 0xd19c, 0x0904, 0x27aa, 0x7038,
 	0xd0ac, 0x1904, 0x2783, 0x0016, 0x0156, 0x6027, 0x0008, 0x6050,
 	0x9085, 0x0040, 0x6052, 0x6050, 0x9084, 0xfbcf, 0x6052, 0x080c,
 	0x2c38, 0x9085, 0x2000, 0x6052, 0x20a9, 0x0012, 0x1d04, 0x2756,
-	0x080c, 0x8584, 0x1f04, 0x2756, 0x6050, 0x9085, 0x0400, 0x9084,
+	0x080c, 0x85ad, 0x1f04, 0x2756, 0x6050, 0x9085, 0x0400, 0x9084,
 	0xdfbf, 0x6052, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x2764, 0x6150,
 	0x9185, 0x1400, 0x6052, 0x20a9, 0x0366, 0x1d04, 0x276d, 0x080c,
-	0x8584, 0x6020, 0xd09c, 0x1130, 0x015e, 0x6152, 0x001e, 0x6027,
+	0x85ad, 0x6020, 0xd09c, 0x1130, 0x015e, 0x6152, 0x001e, 0x6027,
 	0x0008, 0x0480, 0x080c, 0x2c00, 0x1f04, 0x276d, 0x015e, 0x6152,
 	0x001e, 0x6027, 0x0008, 0x0016, 0x6028, 0xc09c, 0x602a, 0x080c,
-	0xadb8, 0x60e3, 0x0000, 0x080c, 0xe9c8, 0x080c, 0xe9e3, 0x080c,
-	0x56d4, 0xd0fc, 0x1138, 0x080c, 0xd20f, 0x1120, 0x9085, 0x0001,
-	0x080c, 0x73f7, 0x9006, 0x080c, 0x2cef, 0x2009, 0x0002, 0x080c,
+	0xadd2, 0x60e3, 0x0000, 0x080c, 0xe9e9, 0x080c, 0xea04, 0x080c,
+	0x56d3, 0xd0fc, 0x1138, 0x080c, 0xd229, 0x1120, 0x9085, 0x0001,
+	0x080c, 0x7403, 0x9006, 0x080c, 0x2cef, 0x2009, 0x0002, 0x080c,
 	0x2c3e, 0x2001, 0x1800, 0x2003, 0x0004, 0x6027, 0x0008, 0x080c,
 	0x0bae, 0x001e, 0x918c, 0xffd0, 0x6126, 0x00ae, 0x0005, 0x0016,
 	0x2001, 0x188b, 0x200c, 0xd184, 0x001e, 0x0904, 0x255c, 0x0016,
@@ -1075,33 +1075,33 @@
 	0x0126, 0x2091, 0x8000, 0x2071, 0x1800, 0x71d0, 0x70d2, 0x9116,
 	0x05e8, 0x81ff, 0x01a0, 0x2009, 0x0000, 0x080c, 0x2c3e, 0x2011,
 	0x8011, 0x2019, 0x010e, 0x231c, 0x939e, 0x0007, 0x1118, 0x2019,
-	0x0001, 0x0010, 0x2019, 0x0000, 0x080c, 0x4b05, 0x0438, 0x2001,
+	0x0001, 0x0010, 0x2019, 0x0000, 0x080c, 0x4b04, 0x0438, 0x2001,
 	0x19a8, 0x200c, 0x81ff, 0x1140, 0x2001, 0x0109, 0x2004, 0xd0b4,
 	0x0118, 0x2019, 0x0003, 0x0008, 0x2118, 0x2011, 0x8012, 0x080c,
-	0x4b05, 0x080c, 0x56d4, 0xd0fc, 0x1188, 0x080c, 0xd20f, 0x1170,
-	0x00c6, 0x080c, 0x28d2, 0x080c, 0xa503, 0x2061, 0x0100, 0x2019,
-	0x0028, 0x2009, 0x0002, 0x080c, 0x3187, 0x00ce, 0x012e, 0x00fe,
+	0x4b04, 0x080c, 0x56d3, 0xd0fc, 0x1188, 0x080c, 0xd229, 0x1170,
+	0x00c6, 0x080c, 0x28d2, 0x080c, 0xa51d, 0x2061, 0x0100, 0x2019,
+	0x0028, 0x2009, 0x0002, 0x080c, 0x318a, 0x00ce, 0x012e, 0x00fe,
 	0x00ee, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x2028, 0x918c,
 	0x00ff, 0x2130, 0x9094, 0xff00, 0x11f0, 0x2011, 0x1837, 0x2214,
 	0xd2ac, 0x11c8, 0x81ff, 0x01e8, 0x2011, 0x181f, 0x2204, 0x9106,
 	0x1190, 0x2011, 0x1820, 0x2214, 0x9294, 0xff00, 0x9584, 0xff00,
 	0x9206, 0x1148, 0x2011, 0x1820, 0x2214, 0x9294, 0x00ff, 0x9584,
-	0x00ff, 0x9206, 0x1120, 0x2500, 0x080c, 0x8095, 0x0048, 0x9584,
-	0x00ff, 0x9080, 0x331e, 0x200d, 0x918c, 0xff00, 0x810f, 0x9006,
-	0x0005, 0x9080, 0x331e, 0x200d, 0x918c, 0x00ff, 0x0005, 0x00d6,
+	0x00ff, 0x9206, 0x1120, 0x2500, 0x080c, 0x80be, 0x0048, 0x9584,
+	0x00ff, 0x9080, 0x3325, 0x200d, 0x918c, 0xff00, 0x810f, 0x9006,
+	0x0005, 0x9080, 0x3325, 0x200d, 0x918c, 0x00ff, 0x0005, 0x00d6,
 	0x2069, 0x0140, 0x2001, 0x1818, 0x2003, 0x00ef, 0x20a9, 0x0010,
 	0x9006, 0x6852, 0x6856, 0x1f04, 0x2882, 0x00de, 0x0005, 0x0006,
 	0x00d6, 0x0026, 0x2069, 0x0140, 0x2001, 0x1818, 0x2102, 0x8114,
 	0x8214, 0x8214, 0x8214, 0x20a9, 0x0010, 0x6853, 0x0000, 0x9006,
-	0x82ff, 0x1128, 0x9184, 0x000f, 0x9080, 0xf195, 0x2005, 0x6856,
+	0x82ff, 0x1128, 0x9184, 0x000f, 0x9080, 0xf1b6, 0x2005, 0x6856,
 	0x8211, 0x1f04, 0x2897, 0x002e, 0x00de, 0x000e, 0x0005, 0x00c6,
 	0x2061, 0x1800, 0x6030, 0x0110, 0xc09d, 0x0008, 0xc09c, 0x6032,
 	0x00ce, 0x0005, 0x0156, 0x00d6, 0x0026, 0x0016, 0x0006, 0x2069,
 	0x0140, 0x6980, 0x9116, 0x0180, 0x9112, 0x1230, 0x8212, 0x8210,
 	0x22a8, 0x2001, 0x0402, 0x0018, 0x22a8, 0x2001, 0x0404, 0x680e,
 	0x1f04, 0x28c7, 0x680f, 0x0000, 0x000e, 0x001e, 0x002e, 0x00de,
-	0x015e, 0x0005, 0x080c, 0x56d0, 0xd0c4, 0x0150, 0xd0a4, 0x0140,
-	0x9006, 0x0046, 0x2020, 0x2009, 0x002e, 0x080c, 0xe58d, 0x004e,
+	0x015e, 0x0005, 0x080c, 0x56cf, 0xd0c4, 0x0150, 0xd0a4, 0x0140,
+	0x9006, 0x0046, 0x2020, 0x2009, 0x002e, 0x080c, 0xe5ae, 0x004e,
 	0x0005, 0x00f6, 0x0016, 0x0026, 0x2079, 0x0140, 0x78c4, 0xd0dc,
 	0x0904, 0x293e, 0x080c, 0x2b9d, 0x0660, 0x9084, 0x0700, 0x908e,
 	0x0600, 0x1120, 0x2011, 0x4000, 0x900e, 0x0458, 0x908e, 0x0500,
@@ -1110,9 +1110,9 @@
 	0x2009, 0x0002, 0x00b0, 0x908e, 0x0200, 0x1120, 0x9016, 0x2009,
 	0x0004, 0x0078, 0x908e, 0x0100, 0x1548, 0x9016, 0x2009, 0x0008,
 	0x0040, 0x9084, 0x0700, 0x908e, 0x0300, 0x1500, 0x2011, 0x0030,
-	0x0058, 0x2300, 0x9080, 0x0020, 0x2018, 0x080c, 0x8f3f, 0x928c,
+	0x0058, 0x2300, 0x9080, 0x0020, 0x2018, 0x080c, 0x8f68, 0x928c,
 	0xff00, 0x0110, 0x2011, 0x00ff, 0x2200, 0x8007, 0x9085, 0x004c,
-	0x78c2, 0x2009, 0x0138, 0x220a, 0x080c, 0x73b0, 0x1118, 0x2009,
+	0x78c2, 0x2009, 0x0138, 0x220a, 0x080c, 0x73bc, 0x1118, 0x2009,
 	0x196d, 0x220a, 0x002e, 0x001e, 0x00fe, 0x0005, 0x78c3, 0x0000,
 	0x0cc8, 0x0126, 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x2001,
 	0x0170, 0x200c, 0x8000, 0x2014, 0x9184, 0x0003, 0x0110, 0x080c,
@@ -1129,16 +1129,16 @@
 	0x080c, 0x2bfb, 0x2001, 0x1992, 0x2003, 0x0000, 0x7828, 0x9084,
 	0xe1d7, 0x782a, 0x9006, 0x20a9, 0x0009, 0x080c, 0x2bb9, 0x2001,
 	0x1990, 0x2003, 0x0006, 0x2009, 0x001e, 0x2011, 0x2a0e, 0x080c,
-	0x8562, 0x0005, 0x2009, 0x1995, 0x200b, 0x0000, 0x2001, 0x199a,
+	0x858b, 0x0005, 0x2009, 0x1995, 0x200b, 0x0000, 0x2001, 0x199a,
 	0x2003, 0x0036, 0x2001, 0x1999, 0x2003, 0x002a, 0x2001, 0x1992,
 	0x2003, 0x0001, 0x9006, 0x080c, 0x2b6b, 0x2001, 0xffff, 0x20a9,
 	0x0009, 0x080c, 0x2bb9, 0x2001, 0x1990, 0x2003, 0x0006, 0x2009,
-	0x001e, 0x2011, 0x2a0e, 0x080c, 0x8562, 0x0005, 0x080c, 0x0dd5,
+	0x001e, 0x2011, 0x2a0e, 0x080c, 0x858b, 0x0005, 0x080c, 0x0dd5,
 	0x2001, 0x199a, 0x2003, 0x0036, 0x2001, 0x1992, 0x2003, 0x0003,
 	0x7a38, 0x9294, 0x0005, 0x9296, 0x0004, 0x0110, 0x9006, 0x0010,
 	0x2001, 0x0001, 0x080c, 0x2b6b, 0x2001, 0x1996, 0x2003, 0x0000,
 	0x2001, 0xffff, 0x20a9, 0x0009, 0x080c, 0x2bb9, 0x2001, 0x1990,
-	0x2003, 0x0006, 0x2009, 0x001e, 0x2011, 0x2a0e, 0x080c, 0x8562,
+	0x2003, 0x0006, 0x2009, 0x001e, 0x2011, 0x2a0e, 0x080c, 0x858b,
 	0x0005, 0x080c, 0x0dd5, 0x080c, 0x0dd5, 0x0005, 0x0006, 0x0016,
 	0x0026, 0x00e6, 0x00f6, 0x0156, 0x0126, 0x2091, 0x8000, 0x2079,
 	0x0100, 0x2001, 0x1992, 0x2004, 0x908a, 0x0007, 0x1a0c, 0x0dd5,
@@ -1199,13 +1199,13 @@
 	0x783b, 0x0007, 0x0090, 0x9186, 0x0001, 0x1118, 0x783b, 0x0006,
 	0x0060, 0x9186, 0x0002, 0x1118, 0x783b, 0x0005, 0x0030, 0x9186,
 	0x0003, 0x1118, 0x783b, 0x0004, 0x0000, 0x0006, 0x1d04, 0x2be6,
-	0x080c, 0x8584, 0x1f04, 0x2be6, 0x7850, 0x9085, 0x0400, 0x9084,
+	0x080c, 0x85ad, 0x1f04, 0x2be6, 0x7850, 0x9085, 0x0400, 0x9084,
 	0xdfbf, 0x7852, 0x080c, 0x2c38, 0x9085, 0x1000, 0x7852, 0x000e,
 	0x001e, 0x012e, 0x0005, 0x7850, 0x9084, 0xffcf, 0x7852, 0x0005,
 	0x0006, 0x0156, 0x00f6, 0x2079, 0x0100, 0x20a9, 0x000a, 0x7854,
 	0xd0ac, 0x1130, 0x7820, 0xd0e4, 0x1140, 0x1f04, 0x2c0a, 0x0028,
 	0x7854, 0xd08c, 0x1110, 0x1f04, 0x2c10, 0x00fe, 0x015e, 0x000e,
-	0x0005, 0x1d04, 0x2c19, 0x080c, 0x8584, 0x1f04, 0x2c19, 0x0005,
+	0x0005, 0x1d04, 0x2c19, 0x080c, 0x85ad, 0x1f04, 0x2c19, 0x0005,
 	0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0000, 0x000e, 0x0005,
 	0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0001, 0x000e, 0x0005,
 	0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0002, 0x000e, 0x0005,
@@ -1232,13 +1232,13 @@
 	0x001e, 0x919c, 0xffe4, 0x9184, 0x0001, 0x0118, 0x9385, 0x0009,
 	0x6016, 0x9184, 0x0002, 0x0118, 0x9385, 0x0012, 0x6016, 0x003e,
 	0x2001, 0x180c, 0x200c, 0xc1dc, 0x2102, 0x00ce, 0x0005, 0x0016,
-	0x0026, 0x080c, 0x73ca, 0x0108, 0xc0bc, 0x2009, 0x0140, 0x2114,
+	0x0026, 0x080c, 0x73d6, 0x0108, 0xc0bc, 0x2009, 0x0140, 0x2114,
 	0x9294, 0x0001, 0x9215, 0x220a, 0x002e, 0x001e, 0x0005, 0x0016,
 	0x0026, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001, 0x9285, 0x1000,
 	0x200a, 0x220a, 0x002e, 0x001e, 0x0005, 0x0016, 0x0026, 0x2009,
 	0x0140, 0x2114, 0x9294, 0x0001, 0x9215, 0x220a, 0x002e, 0x001e,
 	0x0005, 0x0006, 0x0016, 0x2009, 0x0140, 0x2104, 0x1128, 0x080c,
-	0x73ca, 0x0110, 0xc0bc, 0x0008, 0xc0bd, 0x200a, 0x001e, 0x000e,
+	0x73d6, 0x0110, 0xc0bc, 0x0008, 0xc0bd, 0x200a, 0x001e, 0x000e,
 	0x0005, 0x2f95, 0x2f95, 0x2db9, 0x2db9, 0x2dc5, 0x2dc5, 0x2dd1,
 	0x2dd1, 0x2ddf, 0x2ddf, 0x2deb, 0x2deb, 0x2df9, 0x2df9, 0x2e07,
 	0x2e07, 0x2e19, 0x2e19, 0x2e25, 0x2e25, 0x2e33, 0x2e33, 0x2e51,
@@ -1317,1840 +1317,1841 @@
 	0x0146, 0x0156, 0x080c, 0x2941, 0x080c, 0x2295, 0x080c, 0x2481,
 	0x080c, 0x1380, 0x080c, 0x22d0, 0x0000, 0x015e, 0x014e, 0x013e,
 	0x01de, 0x01ce, 0x012e, 0x000e, 0x010e, 0x000d, 0x00b6, 0x00c6,
-	0x0026, 0x0046, 0x9026, 0x080c, 0x6928, 0x1904, 0x30a3, 0x72dc,
+	0x0026, 0x0046, 0x9026, 0x080c, 0x6930, 0x1904, 0x30a6, 0x72dc,
 	0x2001, 0x197c, 0x2004, 0x9005, 0x1110, 0xd29c, 0x0148, 0xd284,
-	0x1138, 0xd2bc, 0x1904, 0x30a3, 0x080c, 0x30a8, 0x0804, 0x30a3,
-	0xd2cc, 0x1904, 0x30a3, 0x080c, 0x73b0, 0x1120, 0x70af, 0xffff,
-	0x0804, 0x30a3, 0xd294, 0x0120, 0x70af, 0xffff, 0x0804, 0x30a3,
-	0x080c, 0x330d, 0x0160, 0x080c, 0xd216, 0x0128, 0x2001, 0x1818,
-	0x203c, 0x0804, 0x3030, 0x70af, 0xffff, 0x0804, 0x30a3, 0x2001,
-	0x1818, 0x203c, 0x7294, 0xd284, 0x0904, 0x3030, 0xd28c, 0x1904,
-	0x3030, 0x0036, 0x73ac, 0x938e, 0xffff, 0x1110, 0x2019, 0x0001,
+	0x1138, 0xd2bc, 0x1904, 0x30a6, 0x080c, 0x30ab, 0x0804, 0x30a6,
+	0xd2cc, 0x1904, 0x30a6, 0x080c, 0x73bc, 0x1120, 0x70af, 0xffff,
+	0x0804, 0x30a6, 0xd294, 0x0120, 0x70af, 0xffff, 0x0804, 0x30a6,
+	0x080c, 0x3314, 0x0160, 0x080c, 0xd230, 0x0128, 0x2001, 0x1818,
+	0x203c, 0x0804, 0x3033, 0x70af, 0xffff, 0x0804, 0x30a6, 0x2001,
+	0x1818, 0x203c, 0x7294, 0xd284, 0x0904, 0x3033, 0xd28c, 0x1904,
+	0x3033, 0x0036, 0x73ac, 0x938e, 0xffff, 0x1110, 0x2019, 0x0001,
 	0x8314, 0x92e0, 0x1c80, 0x2c04, 0x938c, 0x0001, 0x0120, 0x9084,
-	0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x970e, 0x05b8, 0x908e,
-	0x0000, 0x05a0, 0x908e, 0x00ff, 0x1150, 0x7230, 0xd284, 0x1598,
-	0x7294, 0xc28d, 0x7296, 0x70af, 0xffff, 0x003e, 0x0488, 0x900e,
-	0x080c, 0x283e, 0x080c, 0x659f, 0x1520, 0x9006, 0xb8bb, 0x0520,
-	0xb8ac, 0x9005, 0x0148, 0x00c6, 0x2060, 0x080c, 0x8958, 0x00ce,
-	0x090c, 0x8cfc, 0xb8af, 0x0000, 0x080c, 0x696a, 0x1150, 0x7030,
-	0xd08c, 0x0118, 0xb800, 0xd0bc, 0x0120, 0x080c, 0x30c1, 0x0148,
-	0x0028, 0x080c, 0x31fd, 0x080c, 0x30ed, 0x0118, 0x8318, 0x0804,
-	0x2fe0, 0x73ae, 0x0010, 0x70af, 0xffff, 0x003e, 0x0804, 0x30a3,
-	0x9780, 0x331e, 0x203d, 0x97bc, 0xff00, 0x873f, 0x2041, 0x007e,
-	0x70ac, 0x9096, 0xffff, 0x1118, 0x900e, 0x28a8, 0x0050, 0x9812,
-	0x0220, 0x2008, 0x9802, 0x20a8, 0x0020, 0x70af, 0xffff, 0x0804,
-	0x30a3, 0x2700, 0x0156, 0x0016, 0x9106, 0x0904, 0x3098, 0xc484,
-	0x080c, 0x6600, 0x0148, 0x080c, 0xd216, 0x1904, 0x3098, 0x080c,
-	0x659f, 0x1904, 0x30a0, 0x0008, 0xc485, 0xb8bb, 0x0520, 0xb8ac,
-	0x9005, 0x0148, 0x00c6, 0x2060, 0x080c, 0x8958, 0x00ce, 0x090c,
-	0x8cfc, 0xb8af, 0x0000, 0x080c, 0x696a, 0x1130, 0x7030, 0xd08c,
-	0x01f8, 0xb800, 0xd0bc, 0x11e0, 0x7294, 0xd28c, 0x0180, 0x080c,
-	0x696a, 0x9082, 0x0006, 0x02e0, 0xd484, 0x1118, 0x080c, 0x65c4,
-	0x0028, 0x080c, 0x3289, 0x01a0, 0x080c, 0x32b4, 0x0088, 0x080c,
-	0x31fd, 0x080c, 0xd216, 0x1160, 0x080c, 0x30ed, 0x0188, 0x0040,
-	0x080c, 0xd216, 0x1118, 0x080c, 0x3289, 0x0110, 0x0451, 0x0140,
-	0x001e, 0x8108, 0x015e, 0x1f04, 0x3049, 0x70af, 0xffff, 0x0018,
-	0x001e, 0x015e, 0x71ae, 0x004e, 0x002e, 0x00ce, 0x00be, 0x0005,
-	0x00c6, 0x0016, 0x70af, 0x0001, 0x2009, 0x007e, 0x080c, 0x659f,
-	0x1168, 0xb813, 0x00ff, 0xb817, 0xfffe, 0x080c, 0x31fd, 0x04a9,
-	0x0128, 0x70dc, 0xc0bd, 0x70de, 0x080c, 0xcf67, 0x001e, 0x00ce,
-	0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001, 0x184c, 0x2004,
-	0x9084, 0x00ff, 0xb842, 0x080c, 0xae95, 0x01d0, 0x2b00, 0x6012,
-	0x080c, 0xcf90, 0x6023, 0x0001, 0x9006, 0x080c, 0x653c, 0x2001,
-	0x0000, 0x080c, 0x6550, 0x0126, 0x2091, 0x8000, 0x70a8, 0x8000,
-	0x70aa, 0x012e, 0x2009, 0x0004, 0x080c, 0xaec2, 0x9085, 0x0001,
-	0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x0016, 0x0076, 0x00d6,
-	0x00c6, 0x2001, 0x184c, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c,
-	0xae95, 0x0548, 0x2b00, 0x6012, 0xb800, 0xc0c4, 0xb802, 0xb8a0,
-	0x9086, 0x007e, 0x0140, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006,
-	0x1110, 0x080c, 0x31bc, 0x080c, 0xcf90, 0x6023, 0x0001, 0x9006,
-	0x080c, 0x653c, 0x2001, 0x0002, 0x080c, 0x6550, 0x0126, 0x2091,
-	0x8000, 0x70a8, 0x8000, 0x70aa, 0x012e, 0x2009, 0x0002, 0x080c,
-	0xaec2, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005,
-	0x00b6, 0x00c6, 0x0026, 0x2009, 0x0080, 0x080c, 0x659f, 0x1140,
-	0xb813, 0x00ff, 0xb817, 0xfffc, 0x0039, 0x0110, 0x70e3, 0xffff,
-	0x002e, 0x00ce, 0x00be, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6,
-	0x080c, 0xadf1, 0x01d0, 0x2b00, 0x6012, 0x080c, 0xcf90, 0x6023,
-	0x0001, 0x9006, 0x080c, 0x653c, 0x2001, 0x0002, 0x080c, 0x6550,
-	0x0126, 0x2091, 0x8000, 0x70e4, 0x8000, 0x70e6, 0x012e, 0x2009,
-	0x0002, 0x080c, 0xaec2, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e,
-	0x001e, 0x0005, 0x00c6, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2009,
-	0x007f, 0x080c, 0x659f, 0x11b8, 0xb813, 0x00ff, 0xb817, 0xfffd,
-	0xb8cf, 0x0004, 0x080c, 0xadf1, 0x0170, 0x2b00, 0x6012, 0x6316,
-	0x6023, 0x0001, 0x620a, 0x080c, 0xcf90, 0x2009, 0x0022, 0x080c,
-	0xaec2, 0x9085, 0x0001, 0x012e, 0x00de, 0x00ce, 0x0005, 0x00e6,
-	0x00c6, 0x0066, 0x0036, 0x0026, 0x00b6, 0x21f0, 0x080c, 0x926d,
-	0x080c, 0x91f2, 0x080c, 0xac8a, 0x080c, 0xbd5d, 0x3e08, 0x2130,
-	0x81ff, 0x0120, 0x20a9, 0x007e, 0x900e, 0x0018, 0x20a9, 0x007f,
-	0x900e, 0x0016, 0x080c, 0x6600, 0x1140, 0x9686, 0x0002, 0x1118,
-	0xb800, 0xd0bc, 0x1110, 0x080c, 0x6035, 0x001e, 0x8108, 0x1f04,
-	0x31a1, 0x9686, 0x0001, 0x190c, 0x32e1, 0x00be, 0x002e, 0x003e,
-	0x006e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0026,
-	0x0016, 0x00b6, 0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029,
-	0x080c, 0x9262, 0x0076, 0x2039, 0x0000, 0x080c, 0x913f, 0x2c08,
-	0x080c, 0xe2ca, 0x007e, 0x001e, 0xba10, 0xbb14, 0x080c, 0x6035,
-	0xba12, 0xbb16, 0x00be, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee,
-	0x0005, 0x00e6, 0x0006, 0x00b6, 0x6010, 0x2058, 0xb8a0, 0x00be,
-	0x9086, 0x0080, 0x0150, 0x2071, 0x1800, 0x70a8, 0x9005, 0x0110,
-	0x8001, 0x70aa, 0x000e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x70e4,
-	0x9005, 0x0dc0, 0x8001, 0x70e6, 0x0ca8, 0xb800, 0xc08c, 0xb802,
-	0x0005, 0x00f6, 0x00e6, 0x00c6, 0x00b6, 0x0036, 0x0026, 0x0016,
-	0x0156, 0x2178, 0x81ff, 0x1118, 0x20a9, 0x0001, 0x0088, 0x080c,
-	0x56d0, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046, 0x2020,
-	0x2009, 0x002d, 0x080c, 0xe58d, 0x004e, 0x20a9, 0x0800, 0x9016,
-	0x0026, 0x928e, 0x007e, 0x0904, 0x3269, 0x928e, 0x007f, 0x0904,
-	0x3269, 0x928e, 0x0080, 0x05e8, 0x9288, 0x1000, 0x210c, 0x81ff,
-	0x05c0, 0x8fff, 0x1148, 0x2001, 0x198e, 0x0006, 0x2003, 0x0001,
-	0x04e9, 0x000e, 0x2003, 0x0000, 0x00b6, 0x00c6, 0x2158, 0x2001,
-	0x0001, 0x080c, 0x6934, 0x00ce, 0x00be, 0x2019, 0x0029, 0x080c,
-	0x9262, 0x0076, 0x2039, 0x0000, 0x080c, 0x913f, 0x00b6, 0x00c6,
-	0x0026, 0x2158, 0xba04, 0x9294, 0x00ff, 0x9286, 0x0006, 0x1118,
-	0xb807, 0x0404, 0x0028, 0x2001, 0x0004, 0x8007, 0x9215, 0xba06,
-	0x002e, 0x00ce, 0x00be, 0x0016, 0x2c08, 0x080c, 0xe2ca, 0x001e,
-	0x007e, 0x002e, 0x8210, 0x1f04, 0x3220, 0x015e, 0x001e, 0x002e,
-	0x003e, 0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046, 0x0026,
-	0x0016, 0x080c, 0x56d0, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006,
-	0x2220, 0x2009, 0x0029, 0x080c, 0xe58d, 0x001e, 0x002e, 0x004e,
-	0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x7294, 0x82ff, 0x01e8,
-	0x080c, 0x6962, 0x11d0, 0x2100, 0x080c, 0x2871, 0x81ff, 0x01b8,
-	0x2019, 0x0001, 0x8314, 0x92e0, 0x1c80, 0x2c04, 0xd384, 0x0120,
-	0x9084, 0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x9116, 0x0138,
-	0x9096, 0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085, 0x0001, 0x00ce,
-	0x003e, 0x002e, 0x001e, 0x0005, 0x0016, 0x00c6, 0x0126, 0x2091,
-	0x8000, 0x0036, 0x2019, 0x0029, 0x00a9, 0x003e, 0x9180, 0x1000,
-	0x2004, 0x9065, 0x0158, 0x0016, 0x00c6, 0x2061, 0x1ab0, 0x001e,
-	0x6112, 0x080c, 0x31bc, 0x001e, 0x080c, 0x65c4, 0x012e, 0x00ce,
-	0x001e, 0x0005, 0x0016, 0x0026, 0x2110, 0x080c, 0xa7ee, 0x080c,
-	0xe8f6, 0x002e, 0x001e, 0x0005, 0x2001, 0x1837, 0x2004, 0xd0cc,
-	0x0005, 0x00c6, 0x00b6, 0x080c, 0x73b0, 0x1118, 0x20a9, 0x0800,
-	0x0010, 0x20a9, 0x0782, 0x080c, 0x73b0, 0x1110, 0x900e, 0x0010,
-	0x2009, 0x007e, 0x9180, 0x1000, 0x2004, 0x905d, 0x0130, 0x86ff,
-	0x0110, 0xb800, 0xd0bc, 0x090c, 0x65c4, 0x8108, 0x1f04, 0x32f2,
-	0x2061, 0x1800, 0x607f, 0x0000, 0x6080, 0x9084, 0x00ff, 0x6082,
-	0x60b3, 0x0000, 0x00be, 0x00ce, 0x0005, 0x2001, 0x1869, 0x2004,
-	0xd0bc, 0x0005, 0x2011, 0x1848, 0x2214, 0xd2ec, 0x0005, 0x0026,
-	0x2011, 0x1867, 0x2214, 0xd2dc, 0x002e, 0x0005, 0x7eef, 0x7de8,
-	0x7ce4, 0x80e2, 0x7be1, 0x80e0, 0x80dc, 0x80da, 0x7ad9, 0x80d6,
-	0x80d5, 0x80d4, 0x80d3, 0x80d2, 0x80d1, 0x79ce, 0x78cd, 0x80cc,
-	0x80cb, 0x80ca, 0x80c9, 0x80c7, 0x80c6, 0x77c5, 0x76c3, 0x80bc,
-	0x80ba, 0x75b9, 0x80b6, 0x74b5, 0x73b4, 0x72b3, 0x80b2, 0x80b1,
-	0x80ae, 0x71ad, 0x80ac, 0x70ab, 0x6faa, 0x6ea9, 0x80a7, 0x6da6,
-	0x6ca5, 0x6ba3, 0x6a9f, 0x699e, 0x689d, 0x809b, 0x8098, 0x6797,
-	0x6690, 0x658f, 0x6488, 0x6384, 0x6282, 0x8081, 0x8080, 0x617c,
-	0x607a, 0x8079, 0x5f76, 0x8075, 0x8074, 0x8073, 0x8072, 0x8071,
-	0x806e, 0x5e6d, 0x806c, 0x5d6b, 0x5c6a, 0x5b69, 0x8067, 0x5a66,
-	0x5965, 0x5863, 0x575c, 0x565a, 0x5559, 0x8056, 0x8055, 0x5454,
-	0x5353, 0x5252, 0x5151, 0x504e, 0x4f4d, 0x804c, 0x804b, 0x4e4a,
-	0x4d49, 0x8047, 0x4c46, 0x8045, 0x8043, 0x803c, 0x803a, 0x8039,
-	0x8036, 0x4b35, 0x8034, 0x4a33, 0x4932, 0x4831, 0x802e, 0x472d,
-	0x462c, 0x452b, 0x442a, 0x4329, 0x4227, 0x8026, 0x8025, 0x4123,
-	0x401f, 0x3f1e, 0x3e1d, 0x3d1b, 0x3c18, 0x8017, 0x8010, 0x3b0f,
-	0x3a08, 0x8004, 0x3902, 0x8001, 0x8000, 0x8000, 0x3800, 0x3700,
-	0x3600, 0x8000, 0x3500, 0x8000, 0x8000, 0x8000, 0x3400, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x3300, 0x3200, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x3100, 0x3000, 0x8000,
-	0x8000, 0x2f00, 0x8000, 0x2e00, 0x2d00, 0x2c00, 0x8000, 0x8000,
-	0x8000, 0x2b00, 0x8000, 0x2a00, 0x2900, 0x2800, 0x8000, 0x2700,
-	0x2600, 0x2500, 0x2400, 0x2300, 0x2200, 0x8000, 0x8000, 0x2100,
-	0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x8000, 0x8000, 0x1b00,
-	0x1a00, 0x8000, 0x1900, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x8000, 0x1800, 0x8000, 0x1700, 0x1600, 0x1500, 0x8000, 0x1400,
-	0x1300, 0x1200, 0x1100, 0x1000, 0x0f00, 0x8000, 0x8000, 0x0e00,
-	0x0d00, 0x0c00, 0x0b00, 0x0a00, 0x0900, 0x8000, 0x8000, 0x0800,
-	0x0700, 0x8000, 0x0600, 0x8000, 0x8000, 0x8000, 0x0500, 0x0400,
-	0x0300, 0x8000, 0x0200, 0x8000, 0x8000, 0x8000, 0x0100, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x8000, 0x8000,
+	0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x970e, 0x05d0, 0x908e,
+	0x0000, 0x05b8, 0x908e, 0x00ff, 0x1150, 0x7230, 0xd284, 0x15b0,
+	0x7294, 0xc28d, 0x7296, 0x70af, 0xffff, 0x003e, 0x04a0, 0x900e,
+	0x080c, 0x283e, 0x080c, 0x659e, 0x1538, 0x9006, 0xb8bb, 0x0520,
+	0xb8ac, 0x9005, 0x0148, 0x00c6, 0x2060, 0x080c, 0x8981, 0x00ce,
+	0x090c, 0x8d25, 0xb8af, 0x0000, 0x080c, 0x6972, 0x1168, 0x7030,
+	0xd08c, 0x0130, 0xb800, 0xd0bc, 0x0138, 0x080c, 0x681f, 0x0120,
+	0x080c, 0x30c4, 0x0148, 0x0028, 0x080c, 0x3204, 0x080c, 0x30f0,
+	0x0118, 0x8318, 0x0804, 0x2fe0, 0x73ae, 0x0010, 0x70af, 0xffff,
+	0x003e, 0x0804, 0x30a6, 0x9780, 0x3325, 0x203d, 0x97bc, 0xff00,
+	0x873f, 0x2041, 0x007e, 0x70ac, 0x9096, 0xffff, 0x1118, 0x900e,
+	0x28a8, 0x0050, 0x9812, 0x0220, 0x2008, 0x9802, 0x20a8, 0x0020,
+	0x70af, 0xffff, 0x0804, 0x30a6, 0x2700, 0x0156, 0x0016, 0x9106,
+	0x0904, 0x309b, 0xc484, 0x080c, 0x65ff, 0x0148, 0x080c, 0xd230,
+	0x1904, 0x309b, 0x080c, 0x659e, 0x1904, 0x30a3, 0x0008, 0xc485,
+	0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148, 0x00c6, 0x2060, 0x080c,
+	0x8981, 0x00ce, 0x090c, 0x8d25, 0xb8af, 0x0000, 0x080c, 0x6972,
+	0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800, 0xd0bc, 0x11e0, 0x7294,
+	0xd28c, 0x0180, 0x080c, 0x6972, 0x9082, 0x0006, 0x02e0, 0xd484,
+	0x1118, 0x080c, 0x65c3, 0x0028, 0x080c, 0x3290, 0x01a0, 0x080c,
+	0x32bb, 0x0088, 0x080c, 0x3204, 0x080c, 0xd230, 0x1160, 0x080c,
+	0x30f0, 0x0188, 0x0040, 0x080c, 0xd230, 0x1118, 0x080c, 0x3290,
+	0x0110, 0x0451, 0x0140, 0x001e, 0x8108, 0x015e, 0x1f04, 0x304c,
+	0x70af, 0xffff, 0x0018, 0x001e, 0x015e, 0x71ae, 0x004e, 0x002e,
+	0x00ce, 0x00be, 0x0005, 0x00c6, 0x0016, 0x70af, 0x0001, 0x2009,
+	0x007e, 0x080c, 0x659e, 0x1168, 0xb813, 0x00ff, 0xb817, 0xfffe,
+	0x080c, 0x3204, 0x04a9, 0x0128, 0x70dc, 0xc0bd, 0x70de, 0x080c,
+	0xcf81, 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6,
+	0x2001, 0x184c, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c, 0xaeaf,
+	0x01d0, 0x2b00, 0x6012, 0x080c, 0xcfaa, 0x6023, 0x0001, 0x9006,
+	0x080c, 0x653b, 0x2001, 0x0000, 0x080c, 0x654f, 0x0126, 0x2091,
+	0x8000, 0x70a8, 0x8000, 0x70aa, 0x012e, 0x2009, 0x0004, 0x080c,
+	0xaedc, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005,
+	0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001, 0x184c, 0x2004, 0x9084,
+	0x00ff, 0xb842, 0x080c, 0xaeaf, 0x0548, 0x2b00, 0x6012, 0xb800,
+	0xc0c4, 0xb802, 0xb8a0, 0x9086, 0x007e, 0x0140, 0xb804, 0x9084,
+	0x00ff, 0x9086, 0x0006, 0x1110, 0x080c, 0x31bf, 0x080c, 0xcfaa,
+	0x6023, 0x0001, 0x9006, 0x080c, 0x653b, 0x2001, 0x0002, 0x080c,
+	0x654f, 0x0126, 0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa, 0x012e,
+	0x2009, 0x0002, 0x080c, 0xaedc, 0x9085, 0x0001, 0x00ce, 0x00de,
+	0x007e, 0x001e, 0x0005, 0x00b6, 0x00c6, 0x0026, 0x2009, 0x0080,
+	0x080c, 0x659e, 0x1140, 0xb813, 0x00ff, 0xb817, 0xfffc, 0x0039,
+	0x0110, 0x70e3, 0xffff, 0x002e, 0x00ce, 0x00be, 0x0005, 0x0016,
+	0x0076, 0x00d6, 0x00c6, 0x080c, 0xae0b, 0x01d0, 0x2b00, 0x6012,
+	0x080c, 0xcfaa, 0x6023, 0x0001, 0x9006, 0x080c, 0x653b, 0x2001,
+	0x0002, 0x080c, 0x654f, 0x0126, 0x2091, 0x8000, 0x70e4, 0x8000,
+	0x70e6, 0x012e, 0x2009, 0x0002, 0x080c, 0xaedc, 0x9085, 0x0001,
+	0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00c6, 0x00d6, 0x0126,
+	0x2091, 0x8000, 0x2009, 0x007f, 0x080c, 0x659e, 0x11b8, 0xb813,
+	0x00ff, 0xb817, 0xfffd, 0xb8cf, 0x0004, 0x080c, 0xae0b, 0x0170,
+	0x2b00, 0x6012, 0x6316, 0x6023, 0x0001, 0x620a, 0x080c, 0xcfaa,
+	0x2009, 0x0022, 0x080c, 0xaedc, 0x9085, 0x0001, 0x012e, 0x00de,
+	0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066, 0x0036, 0x0026, 0x00b6,
+	0x21f0, 0x080c, 0x9296, 0x080c, 0x921b, 0x080c, 0xaca4, 0x080c,
+	0xbd77, 0x3e08, 0x2130, 0x81ff, 0x0120, 0x20a9, 0x007e, 0x900e,
+	0x0018, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x65ff, 0x1140,
+	0x9686, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c, 0x6034,
+	0x001e, 0x8108, 0x1f04, 0x31a4, 0x9686, 0x0001, 0x190c, 0x32e8,
+	0x00be, 0x002e, 0x003e, 0x006e, 0x00ce, 0x00ee, 0x0005, 0x00e6,
+	0x00c6, 0x0046, 0x0036, 0x0026, 0x0016, 0x00b6, 0x6210, 0x2258,
+	0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x928b, 0x0076, 0x2039,
+	0x0000, 0x080c, 0x9168, 0x2c08, 0x080c, 0xe2eb, 0x007e, 0x001e,
+	0xba10, 0xbb14, 0xbcc0, 0x080c, 0x6034, 0xba12, 0xbb16, 0xbcc2,
+	0x00be, 0x001e, 0x002e, 0x003e, 0x004e, 0x00ce, 0x00ee, 0x0005,
+	0x00e6, 0x0006, 0x00b6, 0x6010, 0x2058, 0xb8a0, 0x00be, 0x9086,
+	0x0080, 0x0150, 0x2071, 0x1800, 0x70a8, 0x9005, 0x0110, 0x8001,
+	0x70aa, 0x000e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x70e4, 0x9005,
+	0x0dc0, 0x8001, 0x70e6, 0x0ca8, 0xb800, 0xc08c, 0xb802, 0x0005,
+	0x00f6, 0x00e6, 0x00c6, 0x00b6, 0x0046, 0x0036, 0x0026, 0x0016,
+	0x0156, 0x2178, 0x81ff, 0x1118, 0x20a9, 0x0001, 0x0078, 0x080c,
+	0x56cf, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006, 0x2020, 0x2009,
+	0x002d, 0x080c, 0xe5ae, 0x20a9, 0x0800, 0x9016, 0x0026, 0x928e,
+	0x007e, 0x0904, 0x326f, 0x928e, 0x007f, 0x0904, 0x326f, 0x928e,
+	0x0080, 0x05e8, 0x9288, 0x1000, 0x210c, 0x81ff, 0x05c0, 0x8fff,
+	0x1148, 0x2001, 0x198e, 0x0006, 0x2003, 0x0001, 0x04f1, 0x000e,
+	0x2003, 0x0000, 0x00b6, 0x00c6, 0x2158, 0x2001, 0x0001, 0x080c,
+	0x693c, 0x00ce, 0x00be, 0x2019, 0x0029, 0x080c, 0x928b, 0x0076,
+	0x2039, 0x0000, 0x080c, 0x9168, 0x00b6, 0x00c6, 0x0026, 0x2158,
+	0xba04, 0x9294, 0x00ff, 0x9286, 0x0006, 0x1118, 0xb807, 0x0404,
+	0x0028, 0x2001, 0x0004, 0x8007, 0x9215, 0xba06, 0x002e, 0x00ce,
+	0x00be, 0x0016, 0x2c08, 0x080c, 0xe2eb, 0x001e, 0x007e, 0x002e,
+	0x8210, 0x1f04, 0x3226, 0x015e, 0x001e, 0x002e, 0x003e, 0x004e,
+	0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046, 0x0026, 0x0016,
+	0x080c, 0x56cf, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006, 0x2220,
+	0x2009, 0x0029, 0x080c, 0xe5ae, 0x001e, 0x002e, 0x004e, 0x0005,
+	0x0016, 0x0026, 0x0036, 0x00c6, 0x7294, 0x82ff, 0x01e8, 0x080c,
+	0x696a, 0x11d0, 0x2100, 0x080c, 0x2871, 0x81ff, 0x01b8, 0x2019,
+	0x0001, 0x8314, 0x92e0, 0x1c80, 0x2c04, 0xd384, 0x0120, 0x9084,
+	0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x9116, 0x0138, 0x9096,
+	0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085, 0x0001, 0x00ce, 0x003e,
+	0x002e, 0x001e, 0x0005, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000,
+	0x0036, 0x2019, 0x0029, 0x00a9, 0x003e, 0x9180, 0x1000, 0x2004,
+	0x9065, 0x0158, 0x0016, 0x00c6, 0x2061, 0x1ab0, 0x001e, 0x6112,
+	0x080c, 0x31bf, 0x001e, 0x080c, 0x65c3, 0x012e, 0x00ce, 0x001e,
+	0x0005, 0x0016, 0x0026, 0x2110, 0x080c, 0xa808, 0x080c, 0xe917,
+	0x002e, 0x001e, 0x0005, 0x2001, 0x1837, 0x2004, 0xd0cc, 0x0005,
+	0x00c6, 0x00b6, 0x080c, 0x73bc, 0x1118, 0x20a9, 0x0800, 0x0010,
+	0x20a9, 0x0782, 0x080c, 0x73bc, 0x1110, 0x900e, 0x0010, 0x2009,
+	0x007e, 0x9180, 0x1000, 0x2004, 0x905d, 0x0130, 0x86ff, 0x0110,
+	0xb800, 0xd0bc, 0x090c, 0x65c3, 0x8108, 0x1f04, 0x32f9, 0x2061,
+	0x1800, 0x607f, 0x0000, 0x6080, 0x9084, 0x00ff, 0x6082, 0x60b3,
+	0x0000, 0x00be, 0x00ce, 0x0005, 0x2001, 0x1869, 0x2004, 0xd0bc,
+	0x0005, 0x2011, 0x1848, 0x2214, 0xd2ec, 0x0005, 0x0026, 0x2011,
+	0x1867, 0x2214, 0xd2dc, 0x002e, 0x0005, 0x7eef, 0x7de8, 0x7ce4,
+	0x80e2, 0x7be1, 0x80e0, 0x80dc, 0x80da, 0x7ad9, 0x80d6, 0x80d5,
+	0x80d4, 0x80d3, 0x80d2, 0x80d1, 0x79ce, 0x78cd, 0x80cc, 0x80cb,
+	0x80ca, 0x80c9, 0x80c7, 0x80c6, 0x77c5, 0x76c3, 0x80bc, 0x80ba,
+	0x75b9, 0x80b6, 0x74b5, 0x73b4, 0x72b3, 0x80b2, 0x80b1, 0x80ae,
+	0x71ad, 0x80ac, 0x70ab, 0x6faa, 0x6ea9, 0x80a7, 0x6da6, 0x6ca5,
+	0x6ba3, 0x6a9f, 0x699e, 0x689d, 0x809b, 0x8098, 0x6797, 0x6690,
+	0x658f, 0x6488, 0x6384, 0x6282, 0x8081, 0x8080, 0x617c, 0x607a,
+	0x8079, 0x5f76, 0x8075, 0x8074, 0x8073, 0x8072, 0x8071, 0x806e,
+	0x5e6d, 0x806c, 0x5d6b, 0x5c6a, 0x5b69, 0x8067, 0x5a66, 0x5965,
+	0x5863, 0x575c, 0x565a, 0x5559, 0x8056, 0x8055, 0x5454, 0x5353,
+	0x5252, 0x5151, 0x504e, 0x4f4d, 0x804c, 0x804b, 0x4e4a, 0x4d49,
+	0x8047, 0x4c46, 0x8045, 0x8043, 0x803c, 0x803a, 0x8039, 0x8036,
+	0x4b35, 0x8034, 0x4a33, 0x4932, 0x4831, 0x802e, 0x472d, 0x462c,
+	0x452b, 0x442a, 0x4329, 0x4227, 0x8026, 0x8025, 0x4123, 0x401f,
+	0x3f1e, 0x3e1d, 0x3d1b, 0x3c18, 0x8017, 0x8010, 0x3b0f, 0x3a08,
+	0x8004, 0x3902, 0x8001, 0x8000, 0x8000, 0x3800, 0x3700, 0x3600,
+	0x8000, 0x3500, 0x8000, 0x8000, 0x8000, 0x3400, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x8000, 0x8000, 0x3300, 0x3200, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x8000, 0x8000, 0x3100, 0x3000, 0x8000, 0x8000,
+	0x2f00, 0x8000, 0x2e00, 0x2d00, 0x2c00, 0x8000, 0x8000, 0x8000,
+	0x2b00, 0x8000, 0x2a00, 0x2900, 0x2800, 0x8000, 0x2700, 0x2600,
+	0x2500, 0x2400, 0x2300, 0x2200, 0x8000, 0x8000, 0x2100, 0x2000,
+	0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x8000, 0x8000, 0x1b00, 0x1a00,
+	0x8000, 0x1900, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
+	0x1800, 0x8000, 0x1700, 0x1600, 0x1500, 0x8000, 0x1400, 0x1300,
+	0x1200, 0x1100, 0x1000, 0x0f00, 0x8000, 0x8000, 0x0e00, 0x0d00,
+	0x0c00, 0x0b00, 0x0a00, 0x0900, 0x8000, 0x8000, 0x0800, 0x0700,
+	0x8000, 0x0600, 0x8000, 0x8000, 0x8000, 0x0500, 0x0400, 0x0300,
+	0x8000, 0x0200, 0x8000, 0x8000, 0x8000, 0x0100, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
 	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x2071, 0x189e,
-	0x7003, 0x0002, 0x9006, 0x7016, 0x701a, 0x704a, 0x704e, 0x700e,
-	0x7042, 0x7046, 0x703b, 0x18ba, 0x703f, 0x18ba, 0x7007, 0x0001,
-	0x080c, 0x1018, 0x090c, 0x0dd5, 0x2900, 0x706a, 0xa867, 0x0002,
-	0xa8ab, 0xdcb0, 0x080c, 0x1018, 0x090c, 0x0dd5, 0x2900, 0x706e,
-	0xa867, 0x0002, 0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x189e, 0x7004,
-	0x0002, 0x344d, 0x344e, 0x3461, 0x3475, 0x0005, 0x1004, 0x345e,
-	0x0e04, 0x345e, 0x2079, 0x0000, 0x0126, 0x2091, 0x8000, 0x700c,
-	0x9005, 0x1128, 0x700f, 0x0001, 0x012e, 0x0468, 0x0005, 0x012e,
-	0x0ce8, 0x2079, 0x0000, 0x2061, 0x18b8, 0x2c4c, 0xa86c, 0x908e,
-	0x0100, 0x0128, 0x9086, 0x0200, 0x0904, 0x3549, 0x0005, 0x7018,
-	0x2048, 0x2061, 0x1800, 0x701c, 0x0807, 0x7014, 0x2048, 0xa864,
-	0x9094, 0x00ff, 0x9296, 0x0029, 0x1120, 0xaa78, 0xd2fc, 0x0128,
-	0x0005, 0x9086, 0x0103, 0x0108, 0x0005, 0x2079, 0x0000, 0x2061,
-	0x1800, 0x701c, 0x0807, 0x2061, 0x1800, 0x7880, 0x908a, 0x0040,
-	0x1210, 0x61d0, 0x0042, 0x2100, 0x908a, 0x003f, 0x1a04, 0x3546,
-	0x61d0, 0x0804, 0x34db, 0x351d, 0x3555, 0x355f, 0x3563, 0x356d,
-	0x3573, 0x3577, 0x3587, 0x358a, 0x3594, 0x3599, 0x359e, 0x35a9,
-	0x35b4, 0x35c3, 0x35d2, 0x35e0, 0x35f7, 0x3612, 0x3546, 0x36bb,
-	0x36f9, 0x379f, 0x37b0, 0x37d3, 0x3546, 0x3546, 0x3546, 0x380b,
-	0x3827, 0x3830, 0x385f, 0x3865, 0x3546, 0x38ab, 0x3546, 0x3546,
-	0x3546, 0x3546, 0x3546, 0x38b6, 0x38bf, 0x38c7, 0x38c9, 0x3546,
-	0x3546, 0x3546, 0x3546, 0x3546, 0x3546, 0x38f5, 0x3546, 0x3546,
-	0x3546, 0x3546, 0x3546, 0x3912, 0x3973, 0x3546, 0x3546, 0x3546,
-	0x3546, 0x3546, 0x3546, 0x0002, 0x399d, 0x39a0, 0x39ff, 0x3a18,
-	0x3a48, 0x3ce6, 0x3546, 0x52a9, 0x3546, 0x3546, 0x3546, 0x3546,
-	0x3546, 0x3546, 0x3546, 0x3546, 0x3594, 0x3599, 0x4207, 0x56f4,
-	0x4225, 0x5338, 0x5389, 0x548c, 0x3546, 0x54ee, 0x552a, 0x555b,
-	0x565f, 0x5588, 0x55df, 0x3546, 0x4229, 0x43f2, 0x4408, 0x442d,
-	0x4492, 0x4506, 0x4526, 0x459d, 0x45f9, 0x4655, 0x4658, 0x467d,
-	0x471a, 0x4780, 0x4788, 0x48ba, 0x4a2f, 0x4a63, 0x4cc7, 0x3546,
-	0x4ce5, 0x4d91, 0x4e73, 0x4ecd, 0x3546, 0x4f82, 0x3546, 0x4fe8,
-	0x5003, 0x4788, 0x5249, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c,
-	0x4ae1, 0x0126, 0x2091, 0x8000, 0x0e04, 0x3527, 0x0010, 0x012e,
-	0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010,
-	0x7833, 0x0010, 0x7c82, 0x7986, 0x7a8a, 0x7b8e, 0x2091, 0x4080,
-	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x7007, 0x0001,
-	0x2091, 0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x2021, 0x4001,
-	0x08b0, 0x2021, 0x4002, 0x0898, 0x2021, 0x4003, 0x0880, 0x2021,
-	0x4005, 0x0868, 0x2021, 0x4006, 0x0850, 0x2039, 0x0001, 0x902e,
-	0x2520, 0x7b88, 0x7a8c, 0x7884, 0x7990, 0x0804, 0x4aee, 0x7883,
-	0x0004, 0x7884, 0x0807, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88,
-	0x7a8c, 0x7884, 0x7990, 0x0804, 0x4af1, 0x7984, 0x7888, 0x2114,
-	0x200a, 0x0804, 0x351d, 0x7984, 0x2114, 0x0804, 0x351d, 0x20e1,
-	0x0000, 0x2099, 0x0021, 0x20e9, 0x0000, 0x20a1, 0x0021, 0x20a9,
-	0x001f, 0x4003, 0x7984, 0x7a88, 0x7b8c, 0x0804, 0x351d, 0x7884,
-	0x2060, 0x04d8, 0x2009, 0x0003, 0x2011, 0x0002, 0x2019, 0x001a,
-	0x789b, 0x0137, 0x0804, 0x351d, 0x2039, 0x0001, 0x7d98, 0x7c9c,
-	0x0800, 0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0848, 0x79a0, 0x9182,
-	0x0040, 0x0210, 0x0804, 0x3552, 0x2138, 0x7d98, 0x7c9c, 0x0804,
-	0x3559, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x3552, 0x2138,
-	0x7d98, 0x7c9c, 0x0804, 0x3567, 0x79a0, 0x9182, 0x0040, 0x0210,
-	0x0804, 0x3552, 0x21e8, 0x7984, 0x7888, 0x20a9, 0x0001, 0x21a0,
-	0x4004, 0x0804, 0x351d, 0x2061, 0x0800, 0xe10c, 0x9006, 0x2c15,
-	0x9200, 0x8c60, 0x8109, 0x1dd8, 0x2010, 0x9005, 0x0904, 0x351d,
-	0x0804, 0x354c, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x3552,
-	0x21e0, 0x20a9, 0x0001, 0x7984, 0x2198, 0x4012, 0x0804, 0x351d,
-	0x2069, 0x1847, 0x7884, 0x7990, 0x911a, 0x1a04, 0x3552, 0x8019,
-	0x0904, 0x3552, 0x684a, 0x6942, 0x788c, 0x6852, 0x7888, 0x6856,
-	0x9006, 0x685a, 0x685e, 0x080c, 0x76c9, 0x0804, 0x351d, 0x2069,
-	0x1847, 0x7884, 0x7994, 0x911a, 0x1a04, 0x3552, 0x8019, 0x0904,
-	0x3552, 0x684e, 0x6946, 0x788c, 0x6862, 0x7888, 0x6866, 0x9006,
-	0x686a, 0x686e, 0x0126, 0x2091, 0x8000, 0x080c, 0x69d4, 0x012e,
-	0x0804, 0x351d, 0x902e, 0x2520, 0x81ff, 0x0120, 0x2009, 0x0001,
-	0x0804, 0x354f, 0x7984, 0x7b88, 0x7a8c, 0x20a9, 0x0005, 0x20e9,
-	0x0001, 0x20a1, 0x18a6, 0x4101, 0x080c, 0x4aa5, 0x1120, 0x2009,
-	0x0002, 0x0804, 0x354f, 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019,
-	0xaf60, 0x080c, 0x4aee, 0x701f, 0x3636, 0x0005, 0xa864, 0x2008,
-	0x9084, 0x00ff, 0x9096, 0x0011, 0x0168, 0x9096, 0x0019, 0x0150,
-	0x9096, 0x0015, 0x0138, 0x9096, 0x0048, 0x0120, 0x9096, 0x0029,
-	0x1904, 0x354f, 0x810f, 0x918c, 0x00ff, 0x0904, 0x354f, 0x7112,
-	0x7010, 0x8001, 0x0560, 0x7012, 0x080c, 0x4aa5, 0x1120, 0x2009,
-	0x0002, 0x0804, 0x354f, 0x2009, 0x0020, 0x7068, 0x2040, 0xa28c,
-	0xa390, 0xa494, 0xa598, 0x9290, 0x0040, 0x9399, 0x0000, 0x94a1,
-	0x0000, 0x95a9, 0x0000, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c,
-	0x4aee, 0x701f, 0x3674, 0x0005, 0xa864, 0x9084, 0x00ff, 0x9096,
-	0x0002, 0x0120, 0x9096, 0x000a, 0x1904, 0x354f, 0x0888, 0x7014,
-	0x2048, 0xa868, 0xc0fd, 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096,
-	0x0029, 0x1160, 0xc2fd, 0xaa7a, 0x080c, 0x618c, 0x0150, 0x0126,
-	0x2091, 0x8000, 0xa87a, 0xa982, 0x012e, 0x0050, 0x080c, 0x64b5,
-	0x1128, 0x7007, 0x0003, 0x701f, 0x36a0, 0x0005, 0x080c, 0x6eb8,
-	0x0126, 0x2091, 0x8000, 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099,
-	0x18a6, 0x400a, 0x2100, 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000,
-	0x95a9, 0x0000, 0xa85c, 0x9080, 0x0019, 0x2009, 0x0020, 0x012e,
-	0xaf60, 0x0804, 0x4af1, 0x2091, 0x8000, 0x7837, 0x4000, 0x7833,
-	0x0010, 0x7883, 0x4000, 0x7887, 0x4953, 0x788b, 0x5020, 0x788f,
-	0x2020, 0x2009, 0x017f, 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061,
-	0x0100, 0x6200, 0x2061, 0x0200, 0x603c, 0x8007, 0x9205, 0x789a,
-	0x2009, 0x04fd, 0x2104, 0x789e, 0x2091, 0x5000, 0x2091, 0x4080,
-	0x2001, 0x0089, 0x2004, 0xd084, 0x0180, 0x2001, 0x1a19, 0x2004,
-	0x9005, 0x0128, 0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001,
-	0x008a, 0x2003, 0x0002, 0x2003, 0x1001, 0x2071, 0x0080, 0x0804,
-	0x0427, 0x81ff, 0x1904, 0x354f, 0x7984, 0x080c, 0x6600, 0x1904,
-	0x3552, 0x7e98, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x3552,
-	0x7c88, 0x7d8c, 0x080c, 0x6763, 0x080c, 0x6732, 0x0000, 0x1518,
-	0x2061, 0x1cd0, 0x0126, 0x2091, 0x8000, 0x6000, 0x9086, 0x0000,
-	0x0148, 0x6014, 0x904d, 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870,
-	0x9506, 0x0150, 0x012e, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004,
-	0x9c02, 0x1a04, 0x354f, 0x0c30, 0x080c, 0xc74e, 0x012e, 0x0904,
-	0x354f, 0x0804, 0x351d, 0x900e, 0x2001, 0x0005, 0x080c, 0x6eb8,
-	0x0126, 0x2091, 0x8000, 0x080c, 0xce10, 0x080c, 0x6c79, 0x012e,
-	0x0804, 0x351d, 0x00a6, 0x2950, 0xb198, 0x080c, 0x6600, 0x1904,
-	0x378c, 0xb6a4, 0x9684, 0x3fff, 0x9082, 0x4000, 0x16e8, 0xb49c,
-	0xb5a0, 0x080c, 0x6763, 0x080c, 0x6732, 0x1520, 0x2061, 0x1cd0,
-	0x0126, 0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014,
-	0x904d, 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0158,
-	0x012e, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x2009,
-	0x000d, 0x12b0, 0x0c28, 0x080c, 0xc74e, 0x012e, 0x2009, 0x0003,
-	0x0178, 0x00e0, 0x900e, 0x2001, 0x0005, 0x080c, 0x6eb8, 0x0126,
-	0x2091, 0x8000, 0x080c, 0xce10, 0x080c, 0x6c6d, 0x012e, 0x0070,
-	0xb097, 0x4005, 0xb19a, 0x0010, 0xb097, 0x4006, 0x900e, 0x9085,
-	0x0001, 0x2001, 0x0030, 0x2a48, 0x00ae, 0x0005, 0xb097, 0x4000,
-	0x9006, 0x918d, 0x0001, 0x2008, 0x2a48, 0x00ae, 0x0005, 0x81ff,
-	0x1904, 0x354f, 0x080c, 0x4abc, 0x0904, 0x3552, 0x080c, 0x66c7,
-	0x0904, 0x354f, 0x080c, 0x6769, 0x0904, 0x354f, 0x0804, 0x451d,
-	0x81ff, 0x1904, 0x354f, 0x080c, 0x4ad8, 0x0904, 0x3552, 0x080c,
-	0x67f7, 0x0904, 0x354f, 0x2019, 0x0005, 0x79a8, 0x080c, 0x6784,
-	0x0904, 0x354f, 0x7888, 0x908a, 0x1000, 0x1a04, 0x3552, 0x8003,
-	0x800b, 0x810b, 0x9108, 0x080c, 0x84d8, 0x7984, 0xd184, 0x1904,
-	0x351d, 0x0804, 0x451d, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0118,
-	0x2009, 0x0001, 0x0450, 0x2029, 0x07ff, 0x645c, 0x2400, 0x9506,
-	0x01f8, 0x2508, 0x080c, 0x6600, 0x11d8, 0x080c, 0x67f7, 0x1128,
-	0x2009, 0x0002, 0x62c0, 0x2518, 0x00c0, 0x2019, 0x0004, 0x900e,
-	0x080c, 0x6784, 0x1118, 0x2009, 0x0006, 0x0078, 0x7884, 0x908a,
-	0x1000, 0x1270, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x84d8,
-	0x8529, 0x1ae0, 0x012e, 0x0804, 0x351d, 0x012e, 0x0804, 0x354f,
-	0x012e, 0x0804, 0x3552, 0x080c, 0x4abc, 0x0904, 0x3552, 0x080c,
-	0x66c7, 0x0904, 0x354f, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066,
-	0x080c, 0x9262, 0x0076, 0x903e, 0x080c, 0x913f, 0x900e, 0x080c,
-	0xe2ca, 0x007e, 0x00ce, 0x080c, 0x6763, 0x0804, 0x351d, 0x080c,
-	0x4abc, 0x0904, 0x3552, 0x080c, 0x6763, 0x2208, 0x0804, 0x351d,
-	0x0156, 0x00d6, 0x00e6, 0x2069, 0x1910, 0x6810, 0x6914, 0x910a,
-	0x1208, 0x900e, 0x6816, 0x9016, 0x901e, 0x20a9, 0x007e, 0x2069,
-	0x1000, 0x2d04, 0x905d, 0x0118, 0xb84c, 0x0059, 0x9210, 0x8d68,
-	0x1f04, 0x3841, 0x2300, 0x9218, 0x00ee, 0x00de, 0x015e, 0x0804,
-	0x351d, 0x00f6, 0x0016, 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c,
-	0x81ff, 0x0110, 0x2178, 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069,
-	0x1910, 0x6910, 0x62bc, 0x0804, 0x351d, 0x81ff, 0x0120, 0x2009,
-	0x0001, 0x0804, 0x354f, 0x0126, 0x2091, 0x8000, 0x080c, 0x56e4,
-	0x0128, 0x2009, 0x0007, 0x012e, 0x0804, 0x354f, 0x012e, 0x615c,
-	0x9190, 0x331e, 0x2215, 0x9294, 0x00ff, 0x637c, 0x83ff, 0x0108,
-	0x6280, 0x67dc, 0x97c4, 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031,
-	0x0001, 0x00e8, 0x97c4, 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031,
-	0x0003, 0x00a8, 0x97c4, 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031,
-	0x0002, 0x0068, 0x080c, 0x73b0, 0x1118, 0x2031, 0x0004, 0x0038,
-	0xd79c, 0x0120, 0x2009, 0x0005, 0x0804, 0x354f, 0x9036, 0x7e9a,
-	0x7f9e, 0x0804, 0x351d, 0x614c, 0x6250, 0x2019, 0x1986, 0x231c,
-	0x2001, 0x1987, 0x2004, 0x789a, 0x0804, 0x351d, 0x0126, 0x2091,
-	0x8000, 0x6138, 0x623c, 0x6340, 0x012e, 0x0804, 0x351d, 0x080c,
-	0x4ad8, 0x0904, 0x3552, 0xba44, 0xbb38, 0x0804, 0x351d, 0x080c,
-	0x0dd5, 0x080c, 0x4ad8, 0x2110, 0x0904, 0x3552, 0xb804, 0x908c,
-	0x00ff, 0x918e, 0x0006, 0x0140, 0x9084, 0xff00, 0x9086, 0x0600,
-	0x2009, 0x0009, 0x1904, 0x354f, 0x0126, 0x2091, 0x8000, 0x2019,
-	0x0005, 0x00c6, 0x9066, 0x080c, 0xa7ee, 0x080c, 0x9262, 0x0076,
-	0x903e, 0x080c, 0x913f, 0x900e, 0x080c, 0xe2ca, 0x007e, 0x00ce,
-	0xb807, 0x0407, 0x012e, 0x0804, 0x351d, 0x614c, 0x6250, 0x7884,
-	0x604e, 0x7b88, 0x6352, 0x2069, 0x1847, 0x831f, 0x9305, 0x6816,
-	0x788c, 0x2069, 0x1986, 0x2d1c, 0x206a, 0x7e98, 0x9682, 0x0014,
-	0x1210, 0x2031, 0x07d0, 0x2069, 0x1987, 0x2d04, 0x266a, 0x789a,
-	0x0804, 0x351d, 0x0126, 0x2091, 0x8000, 0x7884, 0x603a, 0xd0c4,
-	0x01a8, 0x00d6, 0x78a8, 0x2009, 0x199d, 0x200a, 0x78ac, 0x2011,
-	0x199e, 0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118,
-	0x2214, 0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7884, 0xd0b4,
-	0x0120, 0x3b00, 0x9084, 0xff3f, 0x20d8, 0x7888, 0x603e, 0x2011,
-	0x0114, 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0080, 0x0010,
-	0x918c, 0xff7f, 0x2112, 0x788c, 0x6042, 0x9084, 0x0020, 0x0130,
-	0x78b4, 0x6046, 0x9084, 0x0001, 0x090c, 0x4207, 0x6040, 0xd0cc,
-	0x0120, 0x78b0, 0x2011, 0x0114, 0x2012, 0x012e, 0x0804, 0x351d,
-	0x00f6, 0x2079, 0x1800, 0x7a38, 0xa898, 0x9084, 0xfebf, 0x9215,
-	0xa89c, 0x9084, 0xfebf, 0x8002, 0x9214, 0x7838, 0x9084, 0x0140,
-	0x9215, 0x7a3a, 0xa897, 0x4000, 0x900e, 0x9085, 0x0001, 0x2001,
-	0x0000, 0x00fe, 0x0005, 0x7898, 0x9005, 0x01a8, 0x7888, 0x9025,
-	0x0904, 0x3552, 0x788c, 0x902d, 0x0904, 0x3552, 0x900e, 0x080c,
-	0x6600, 0x1120, 0xba44, 0xbb38, 0xbc46, 0xbd3a, 0x9186, 0x07ff,
-	0x0190, 0x8108, 0x0ca0, 0x080c, 0x4ad8, 0x0904, 0x3552, 0x7888,
-	0x900d, 0x0904, 0x3552, 0x788c, 0x9005, 0x0904, 0x3552, 0xba44,
-	0xb946, 0xbb38, 0xb83a, 0x0804, 0x351d, 0x2011, 0xbc09, 0x0010,
-	0x2011, 0xbc05, 0x080c, 0x56e4, 0x1904, 0x354f, 0x00c6, 0x2061,
-	0x0100, 0x7984, 0x9186, 0x00ff, 0x1130, 0x2001, 0x1818, 0x2004,
-	0x9085, 0xff00, 0x0088, 0x9182, 0x007f, 0x16e0, 0x9188, 0x331e,
-	0x210d, 0x918c, 0x00ff, 0x2001, 0x1818, 0x2004, 0x0026, 0x9116,
-	0x002e, 0x0580, 0x810f, 0x9105, 0x0126, 0x2091, 0x8000, 0x0006,
-	0x080c, 0xadf1, 0x000e, 0x0510, 0x602e, 0x620a, 0x7984, 0x00b6,
-	0x080c, 0x65a5, 0x2b08, 0x00be, 0x1500, 0x6112, 0x6023, 0x0001,
-	0x080c, 0x4aa5, 0x01d0, 0x9006, 0xa866, 0x7007, 0x0003, 0xa832,
-	0xa868, 0xc0fd, 0xa86a, 0x701f, 0x39f8, 0x2900, 0x6016, 0x2009,
-	0x0032, 0x080c, 0xaec2, 0x012e, 0x00ce, 0x0005, 0x012e, 0x00ce,
-	0x0804, 0x354f, 0x00ce, 0x0804, 0x3552, 0x080c, 0xae47, 0x0cb0,
-	0xa830, 0x9086, 0x0100, 0x0904, 0x354f, 0x0804, 0x351d, 0x2061,
-	0x1a71, 0x0126, 0x2091, 0x8000, 0x6000, 0xd084, 0x0170, 0x6104,
-	0x6208, 0x2061, 0x1800, 0x6354, 0x6074, 0x789a, 0x60c0, 0x789e,
-	0x60bc, 0x78aa, 0x012e, 0x0804, 0x351d, 0x900e, 0x2110, 0x0c88,
-	0x81ff, 0x1904, 0x354f, 0x080c, 0x73b0, 0x0904, 0x354f, 0x0126,
-	0x2091, 0x8000, 0x6254, 0x6074, 0x9202, 0x0248, 0x9085, 0x0001,
-	0x080c, 0x28a7, 0x080c, 0x58fe, 0x012e, 0x0804, 0x351d, 0x012e,
-	0x0804, 0x3552, 0x0006, 0x0016, 0x00c6, 0x00e6, 0x2001, 0x19a9,
-	0x2070, 0x2061, 0x1847, 0x6008, 0x2072, 0x900e, 0x2011, 0x1400,
-	0x080c, 0x8f3f, 0x7206, 0x00ee, 0x00ce, 0x001e, 0x000e, 0x0005,
-	0x0126, 0x2091, 0x8000, 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b,
-	0x0804, 0x351f, 0x7884, 0xd0fc, 0x0148, 0x2001, 0x002a, 0x2004,
-	0x9082, 0x00e1, 0x0288, 0x012e, 0x0804, 0x3552, 0x2001, 0x002a,
-	0x2004, 0x2069, 0x1847, 0x6908, 0x9102, 0x1230, 0x012e, 0x0804,
-	0x3552, 0x012e, 0x0804, 0x354f, 0x080c, 0xadb1, 0x0dd0, 0x7884,
-	0xd0fc, 0x0904, 0x3ac3, 0x00c6, 0x080c, 0x4aa5, 0x00ce, 0x0d88,
-	0xa867, 0x0000, 0x7884, 0xa80a, 0x7898, 0xa80e, 0x789c, 0xa812,
-	0x2001, 0x002e, 0x2004, 0xa81a, 0x2001, 0x002f, 0x2004, 0xa81e,
-	0x2001, 0x0030, 0x2004, 0xa822, 0x2001, 0x0031, 0x2004, 0xa826,
-	0x2001, 0x0034, 0x2004, 0xa82a, 0x2001, 0x0035, 0x2004, 0xa82e,
-	0x2001, 0x002a, 0x2004, 0x9080, 0x0003, 0x9084, 0x00fc, 0x8004,
-	0xa816, 0x080c, 0x3c49, 0x0928, 0x7014, 0x2048, 0xad2c, 0xac28,
-	0xab1c, 0xaa18, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000,
-	0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x001b, 0x080c, 0x4aee, 0x701f, 0x3b86, 0x7023,
-	0x0001, 0x012e, 0x0005, 0x0046, 0x0086, 0x0096, 0x00a6, 0x00b6,
-	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3a32, 0x2001, 0x199f,
-	0x2003, 0x0000, 0x2021, 0x000a, 0x2061, 0x0100, 0x6104, 0x0016,
-	0x60bb, 0x0000, 0x60bf, 0x32e1, 0x60bf, 0x0012, 0x080c, 0x3cb8,
-	0x080c, 0x3c77, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x1a66,
-	0x2079, 0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0140,
-	0x2001, 0x0035, 0x2004, 0x780e, 0x2001, 0x0034, 0x2004, 0x780a,
-	0x00de, 0x2011, 0x0001, 0x080c, 0x404b, 0x008e, 0x00ee, 0x00fe,
-	0x080c, 0x3f78, 0x080c, 0x3e7d, 0x05b8, 0x2001, 0x020b, 0x2004,
-	0x9084, 0x0140, 0x1db8, 0x080c, 0x40bf, 0x00f6, 0x2079, 0x0300,
-	0x78bc, 0x00fe, 0x908c, 0x0070, 0x1560, 0x2071, 0x0200, 0x7037,
-	0x0000, 0x7050, 0x9084, 0xff00, 0x9086, 0x3200, 0x1510, 0x7037,
-	0x0001, 0x7050, 0x9084, 0xff00, 0x9086, 0xe100, 0x11d0, 0x7037,
-	0x0000, 0x7054, 0x7037, 0x0000, 0x715c, 0x9106, 0x1190, 0x2001,
-	0x1820, 0x2004, 0x9106, 0x1168, 0x00c6, 0x2061, 0x0100, 0x6024,
-	0x9084, 0x1e00, 0x00ce, 0x0138, 0x080c, 0x3e87, 0x080c, 0x3c72,
-	0x0058, 0x080c, 0x3c72, 0x080c, 0x3fe3, 0x080c, 0x3f6e, 0x2001,
-	0x020b, 0x2004, 0xd0e4, 0x0dd8, 0x2001, 0x032a, 0x2003, 0x0004,
-	0x2061, 0x0100, 0x6027, 0x0002, 0x001e, 0x6106, 0x2011, 0x020d,
-	0x2013, 0x0020, 0x60bb, 0x0000, 0x60bf, 0x0108, 0x60bf, 0x0012,
-	0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x12ed,
-	0x2009, 0x0028, 0x080c, 0x23d2, 0x2001, 0x0227, 0x200c, 0x2102,
-	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e,
-	0x004e, 0x2001, 0x199f, 0x2004, 0x9005, 0x1118, 0x012e, 0x0804,
-	0x351d, 0x012e, 0x2021, 0x400c, 0x0804, 0x351f, 0x0016, 0x0026,
-	0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156,
-	0x7014, 0x2048, 0x7020, 0x20a8, 0x8000, 0x7022, 0xa804, 0x9005,
-	0x0904, 0x3be2, 0x2048, 0x1f04, 0x3b96, 0x7068, 0x2040, 0xa28c,
-	0xa390, 0xa494, 0xa598, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029,
-	0x0000, 0x2021, 0x0000, 0x0096, 0x7014, 0x2048, 0xa864, 0x009e,
-	0x9086, 0x0103, 0x0170, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
-	0x9084, 0xffc0, 0x9080, 0x001b, 0x080c, 0x4aee, 0x701f, 0x3b86,
-	0x00b0, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-	0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006,
-	0x080c, 0x0f7c, 0x000e, 0x080c, 0x4af1, 0x701f, 0x3b86, 0x015e,
-	0x00de, 0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e,
-	0x001e, 0x0005, 0x7014, 0x2048, 0xa864, 0x9086, 0x0103, 0x1118,
-	0x701f, 0x3c47, 0x0450, 0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a,
-	0x2009, 0x007f, 0x080c, 0x659f, 0x0110, 0x9006, 0x0030, 0xb813,
-	0x00ff, 0xb817, 0xfffd, 0x080c, 0xcfdf, 0x015e, 0x00de, 0x009e,
-	0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0904,
-	0x354f, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086,
-	0x0096, 0x00d6, 0x0156, 0x701f, 0x3c19, 0x7007, 0x0003, 0x0804,
-	0x3bd7, 0xa830, 0x9086, 0x0100, 0x2021, 0x400c, 0x0904, 0x351f,
-	0x0076, 0xad10, 0xac0c, 0xab24, 0xaa20, 0xa930, 0xa808, 0xd0b4,
-	0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006, 0x8007,
-	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0,
-	0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0f7c, 0x000e, 0x080c,
-	0x4af1, 0x007e, 0x701f, 0x3b86, 0x7023, 0x0001, 0x0005, 0x0804,
-	0x351d, 0x0156, 0x00c6, 0xa814, 0x908a, 0x001e, 0x0218, 0xa833,
-	0x001e, 0x0010, 0xa832, 0x0078, 0x81ff, 0x0168, 0x0016, 0x080c,
-	0x4aa5, 0x001e, 0x0130, 0xa800, 0x2040, 0xa008, 0xa80a, 0x2100,
-	0x0c58, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x015e, 0x0005,
-	0x0006, 0x00f6, 0x2079, 0x0000, 0x7880, 0x9086, 0x0044, 0x00fe,
-	0x000e, 0x0005, 0x2001, 0x199f, 0x2003, 0x0001, 0x0005, 0x00f6,
-	0x00e6, 0x00c6, 0x2061, 0x0200, 0x2001, 0x19aa, 0x2004, 0x601a,
-	0x2061, 0x0100, 0x2001, 0x19a9, 0x2004, 0x60ce, 0x6104, 0xc1ac,
-	0x6106, 0x080c, 0x4aa5, 0xa813, 0x0019, 0xa817, 0x0001, 0x2900,
-	0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f, 0x2004,
-	0xa86a, 0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x19a9, 0x2004,
-	0x6036, 0x2009, 0x0040, 0x080c, 0x23d2, 0x2001, 0x002a, 0x2004,
-	0x9084, 0xfff8, 0xa86e, 0x601a, 0xa873, 0x0000, 0x601f, 0x0000,
-	0x78ca, 0x9006, 0x600a, 0x600e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
-	0x00e6, 0x080c, 0x4aa5, 0x2940, 0xa013, 0x0019, 0xa017, 0x0001,
-	0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa866, 0x2001, 0x0031,
-	0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e,
-	0xa873, 0x0000, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x0300,
-	0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004,
-	0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091,
-	0x8000, 0x81ff, 0x0148, 0x080c, 0x2c30, 0x1130, 0x9006, 0x080c,
-	0x2b88, 0x9006, 0x080c, 0x2b6b, 0x7884, 0x9084, 0x0007, 0x0002,
-	0x3d03, 0x3d0c, 0x3d15, 0x3d00, 0x3d00, 0x3d00, 0x3d00, 0x3d00,
-	0x012e, 0x0804, 0x3552, 0x2009, 0x0114, 0x2104, 0x9085, 0x0800,
-	0x200a, 0x080c, 0x3ed1, 0x00c0, 0x2009, 0x0114, 0x2104, 0x9085,
-	0x4000, 0x200a, 0x080c, 0x3ed1, 0x0078, 0x080c, 0x73b0, 0x1128,
-	0x012e, 0x2009, 0x0016, 0x0804, 0x354f, 0x81ff, 0x0128, 0x012e,
-	0x2021, 0x400b, 0x0804, 0x351f, 0x0086, 0x0096, 0x00a6, 0x00b6,
-	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3a32, 0x2009, 0x0101,
-	0x210c, 0x0016, 0x7ec8, 0x7dcc, 0x9006, 0x2068, 0x2060, 0x2058,
-	0x080c, 0x419a, 0x080c, 0x40ea, 0x903e, 0x2720, 0x00f6, 0x00e6,
-	0x0086, 0x2940, 0x2071, 0x1a66, 0x2079, 0x0090, 0x00d6, 0x2069,
-	0x0000, 0x6884, 0xd0b4, 0x0120, 0x68d4, 0x780e, 0x68d0, 0x780a,
-	0x00de, 0x2011, 0x0001, 0x080c, 0x404b, 0x080c, 0x2c38, 0x080c,
-	0x2c38, 0x080c, 0x2c38, 0x080c, 0x2c38, 0x080c, 0x404b, 0x008e,
-	0x00ee, 0x00fe, 0x080c, 0x3f78, 0x2009, 0x9c40, 0x8109, 0x11b0,
-	0x080c, 0x3e87, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102,
-	0x001e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
-	0x008e, 0x2009, 0x0017, 0x080c, 0x354f, 0x0cf8, 0x2001, 0x020b,
-	0x2004, 0x9084, 0x0140, 0x1d10, 0x00f6, 0x2079, 0x0000, 0x7884,
-	0x00fe, 0xd0bc, 0x0178, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0150,
-	0x080c, 0x3f56, 0x2d00, 0x9c05, 0x9b05, 0x0120, 0x080c, 0x3e87,
-	0x0804, 0x3e34, 0x080c, 0x40bf, 0x080c, 0x3fe3, 0x080c, 0x3f39,
-	0x080c, 0x3f6e, 0x00f6, 0x2079, 0x0100, 0x7824, 0xd0ac, 0x0130,
-	0x8b58, 0x080c, 0x3e87, 0x00fe, 0x0804, 0x3e34, 0x00fe, 0x080c,
-	0x3e7d, 0x1150, 0x8d68, 0x2001, 0x0032, 0x2602, 0x2001, 0x0033,
-	0x2502, 0x080c, 0x3e87, 0x0080, 0x87ff, 0x0138, 0x2001, 0x0201,
-	0x2004, 0x9005, 0x1908, 0x8739, 0x0038, 0x2001, 0x1a62, 0x2004,
-	0x9086, 0x0000, 0x1904, 0x3d84, 0x2001, 0x032f, 0x2003, 0x00f6,
-	0x8631, 0x1208, 0x8529, 0x2500, 0x9605, 0x0904, 0x3e34, 0x7884,
-	0xd0bc, 0x0128, 0x2d00, 0x9c05, 0x9b05, 0x1904, 0x3e34, 0xa013,
-	0x0019, 0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1148,
-	0x2001, 0x1a62, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009,
-	0x0030, 0xa017, 0x0001, 0x78b4, 0x9005, 0x0108, 0xa016, 0x2800,
-	0xa05a, 0x2009, 0x0040, 0x080c, 0x23d2, 0x2900, 0xa85a, 0xa813,
-	0x0019, 0x7884, 0xd0a4, 0x1180, 0xa817, 0x0000, 0x00c6, 0x20a9,
-	0x0004, 0x2061, 0x0090, 0x602b, 0x0008, 0x2001, 0x0203, 0x2004,
-	0x1f04, 0x3e0b, 0x00ce, 0x0030, 0xa817, 0x0001, 0x78b0, 0x9005,
-	0x0108, 0xa816, 0x00f6, 0x00c6, 0x2079, 0x0100, 0x2061, 0x0090,
-	0x7827, 0x0002, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a,
-	0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca,
-	0x00ce, 0x00fe, 0x0804, 0x3d3e, 0x001e, 0x00c6, 0x2001, 0x032a,
-	0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002, 0x6106, 0x2011,
-	0x020d, 0x2013, 0x0020, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd,
-	0x2102, 0x080c, 0x12ed, 0x7884, 0x9084, 0x0003, 0x9086, 0x0002,
-	0x01a0, 0x2009, 0x0028, 0x080c, 0x23d2, 0x2001, 0x0227, 0x200c,
-	0x2102, 0x6050, 0x9084, 0xb7ef, 0x6052, 0x602f, 0x0000, 0x604b,
-	0xf7f7, 0x6043, 0x0090, 0x6043, 0x0010, 0x00ce, 0x2d08, 0x2c10,
-	0x2b18, 0x2b00, 0x9c05, 0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-	0x00be, 0x00ae, 0x009e, 0x008e, 0x1118, 0x012e, 0x0804, 0x351d,
-	0x012e, 0x2021, 0x400c, 0x0804, 0x351f, 0x9085, 0x0001, 0x1d04,
-	0x3e86, 0x2091, 0x6000, 0x8420, 0x9486, 0x0064, 0x0005, 0x2001,
-	0x0105, 0x2003, 0x0010, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001,
-	0x1a62, 0x2003, 0x0000, 0x0071, 0x2009, 0x0048, 0x080c, 0x23d2,
-	0x2001, 0x0227, 0x2024, 0x2402, 0x2001, 0x0109, 0x2003, 0x4000,
-	0x9026, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a66, 0x7000, 0x9086,
-	0x0000, 0x0520, 0x2079, 0x0090, 0x2009, 0x0206, 0x2104, 0x2009,
-	0x0203, 0x210c, 0x9106, 0x1120, 0x2009, 0x0040, 0x080c, 0x23d2,
-	0x782c, 0xd0fc, 0x0d88, 0x080c, 0x40bf, 0x7000, 0x9086, 0x0000,
-	0x1d58, 0x782b, 0x0004, 0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040,
-	0x080c, 0x23d2, 0x782b, 0x0002, 0x7003, 0x0000, 0x00ee, 0x00fe,
-	0x0005, 0x00f6, 0x2079, 0x0100, 0x2001, 0x1818, 0x200c, 0x7932,
-	0x7936, 0x080c, 0x2887, 0x7850, 0x9084, 0xfbff, 0x9085, 0x0030,
-	0x7852, 0x2019, 0x01f4, 0x8319, 0x1df0, 0x9084, 0xffcf, 0x9085,
-	0x2000, 0x7852, 0x20a9, 0x0046, 0x1d04, 0x3eec, 0x2091, 0x6000,
-	0x1f04, 0x3eec, 0x7850, 0x9085, 0x0400, 0x9084, 0xdfff, 0x7852,
-	0x2001, 0x0021, 0x2004, 0x9084, 0x0003, 0x9086, 0x0001, 0x1120,
-	0x7850, 0x9084, 0xdfff, 0x7852, 0x784b, 0xf7f7, 0x7843, 0x0090,
-	0x7843, 0x0010, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x3f0c, 0x7850,
-	0x9085, 0x1400, 0x7852, 0x2019, 0x61a8, 0x7854, 0xa001, 0xa001,
-	0xd08c, 0x1110, 0x8319, 0x1dc8, 0x7827, 0x0048, 0x7850, 0x9085,
-	0x0400, 0x7852, 0x7843, 0x0040, 0x2019, 0x01f4, 0xa001, 0xa001,
-	0x8319, 0x1de0, 0x2001, 0x0100, 0x080c, 0x2cef, 0x7827, 0x0020,
-	0x7843, 0x0000, 0x9006, 0x080c, 0x2cef, 0x7827, 0x0048, 0x00fe,
-	0x0005, 0x7884, 0xd0ac, 0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a62,
-	0x2079, 0x0320, 0x2001, 0x0201, 0x2004, 0x9005, 0x0160, 0x7000,
-	0x9086, 0x0000, 0x1140, 0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003,
-	0x0003, 0x782b, 0x0019, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079,
-	0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070, 0x0178, 0x2009, 0x0032,
-	0x260a, 0x2009, 0x0033, 0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac,
-	0x0108, 0x8d68, 0xd0a4, 0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079,
-	0x0200, 0x781c, 0xd084, 0x0110, 0x7837, 0x0050, 0x00fe, 0x0005,
-	0x00e6, 0x2071, 0x0100, 0x2001, 0x19aa, 0x2004, 0x70e2, 0x080c,
-	0x3c68, 0x1188, 0x2001, 0x1820, 0x2004, 0x2009, 0x181f, 0x210c,
-	0x918c, 0x00ff, 0x706e, 0x716a, 0x7066, 0x918d, 0x3200, 0x7162,
-	0x7073, 0xe109, 0x0080, 0x702c, 0x9085, 0x0002, 0x702e, 0x2009,
-	0x1818, 0x210c, 0x716e, 0x7063, 0x0100, 0x7166, 0x719e, 0x706b,
-	0x0000, 0x7073, 0x0809, 0x7077, 0x0008, 0x7078, 0x9080, 0x0100,
-	0x707a, 0x7080, 0x8000, 0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a,
-	0x708e, 0x707e, 0x70d6, 0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014,
-	0x9084, 0x1984, 0x9085, 0x0092, 0x7016, 0x080c, 0x40bf, 0x00f6,
-	0x2071, 0x1a62, 0x2079, 0x0320, 0x00d6, 0x2069, 0x0000, 0x6884,
-	0xd0b4, 0x0120, 0x689c, 0x780e, 0x6898, 0x780a, 0x00de, 0x2009,
-	0x03e8, 0x8109, 0x1df0, 0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004,
-	0x2011, 0x0011, 0x080c, 0x404b, 0x2011, 0x0001, 0x080c, 0x404b,
-	0x00fe, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a62, 0x2079,
-	0x0320, 0x792c, 0xd1fc, 0x0904, 0x4048, 0x782b, 0x0002, 0x9026,
-	0xd19c, 0x1904, 0x4044, 0x7000, 0x0002, 0x4048, 0x3ff9, 0x4029,
-	0x4044, 0xd1bc, 0x1170, 0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011,
-	0x0001, 0x080c, 0x404b, 0x0904, 0x4048, 0x080c, 0x404b, 0x0804,
-	0x4048, 0x00f6, 0x2079, 0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810,
-	0x7914, 0x782b, 0x0004, 0x7812, 0x7916, 0x2001, 0x0201, 0x200c,
-	0x81ff, 0x0de8, 0x080c, 0x3f56, 0x2009, 0x0001, 0x00f6, 0x2079,
-	0x0300, 0x78b8, 0x00fe, 0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a,
-	0x00f8, 0x8001, 0x7002, 0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc,
-	0x1904, 0x3fed, 0x2011, 0x0001, 0x00b1, 0x0090, 0xa010, 0x9092,
-	0x0004, 0x9086, 0x0015, 0x1120, 0xa000, 0xa05a, 0x2011, 0x0031,
-	0xa212, 0xd1dc, 0x1960, 0x0828, 0x782b, 0x0004, 0x7003, 0x0000,
-	0x00ee, 0x00fe, 0x0005, 0xa014, 0x9005, 0x0550, 0x8001, 0x0036,
-	0x0096, 0xa016, 0xa058, 0x2048, 0xa010, 0x2009, 0x0031, 0x911a,
-	0x831c, 0x831c, 0x938a, 0x0007, 0x1a0c, 0x0dd5, 0x9398, 0x4079,
-	0x231d, 0x083f, 0x9080, 0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102,
-	0x009e, 0x003e, 0x908a, 0x0035, 0x1140, 0x0096, 0xa058, 0x2048,
-	0xa804, 0xa05a, 0x2001, 0x0019, 0x009e, 0xa012, 0x9085, 0x0001,
-	0x0005, 0x40b6, 0x40ad, 0x40a4, 0x409b, 0x4092, 0x4089, 0x4080,
-	0xa964, 0x7902, 0xa968, 0x7906, 0xa96c, 0x7912, 0xa970, 0x7916,
-	0x0005, 0xa974, 0x7902, 0xa978, 0x7906, 0xa97c, 0x7912, 0xa980,
-	0x7916, 0x0005, 0xa984, 0x7902, 0xa988, 0x7906, 0xa98c, 0x7912,
-	0xa990, 0x7916, 0x0005, 0xa994, 0x7902, 0xa998, 0x7906, 0xa99c,
-	0x7912, 0xa9a0, 0x7916, 0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906,
-	0xa9ac, 0x7912, 0xa9b0, 0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8,
-	0x7906, 0xa9bc, 0x7912, 0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902,
-	0xa9c8, 0x7906, 0xa9cc, 0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6,
-	0x00e6, 0x0086, 0x2071, 0x1a66, 0x2079, 0x0090, 0x792c, 0xd1fc,
-	0x01e8, 0x782b, 0x0002, 0x2940, 0x9026, 0x7000, 0x0002, 0x40e6,
-	0x40d2, 0x40dd, 0x8001, 0x7002, 0xd19c, 0x1180, 0x2011, 0x0001,
-	0x080c, 0x404b, 0x190c, 0x404b, 0x0048, 0x8001, 0x7002, 0x782c,
-	0xd0fc, 0x1d38, 0x2011, 0x0001, 0x080c, 0x404b, 0x008e, 0x00ee,
-	0x00fe, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200,
-	0x2001, 0x19aa, 0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x19a9,
-	0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004,
-	0x9005, 0x0520, 0x2038, 0x2001, 0x002e, 0x2024, 0x2001, 0x002f,
-	0x201c, 0x080c, 0x4aa5, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a,
-	0x978a, 0x0007, 0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708,
-	0x903e, 0x0096, 0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e,
-	0x080c, 0x4162, 0x1d68, 0x2900, 0xa85a, 0x00d0, 0x080c, 0x4aa5,
-	0xa813, 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e,
-	0x2004, 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2001, 0x002a,
-	0x2004, 0x9084, 0xfff8, 0xa86e, 0x2001, 0x002b, 0x2004, 0xa872,
+	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x2071, 0x189e, 0x7003,
+	0x0002, 0x9006, 0x7016, 0x701a, 0x704a, 0x704e, 0x700e, 0x7042,
+	0x7046, 0x703b, 0x18ba, 0x703f, 0x18ba, 0x7007, 0x0001, 0x080c,
+	0x1018, 0x090c, 0x0dd5, 0x2900, 0x706a, 0xa867, 0x0002, 0xa8ab,
+	0xdcb0, 0x080c, 0x1018, 0x090c, 0x0dd5, 0x2900, 0x706e, 0xa867,
+	0x0002, 0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x189e, 0x7004, 0x0002,
+	0x3454, 0x3455, 0x3468, 0x347c, 0x0005, 0x1004, 0x3465, 0x0e04,
+	0x3465, 0x2079, 0x0000, 0x0126, 0x2091, 0x8000, 0x700c, 0x9005,
+	0x1128, 0x700f, 0x0001, 0x012e, 0x0468, 0x0005, 0x012e, 0x0ce8,
+	0x2079, 0x0000, 0x2061, 0x18b8, 0x2c4c, 0xa86c, 0x908e, 0x0100,
+	0x0128, 0x9086, 0x0200, 0x0904, 0x3550, 0x0005, 0x7018, 0x2048,
+	0x2061, 0x1800, 0x701c, 0x0807, 0x7014, 0x2048, 0xa864, 0x9094,
+	0x00ff, 0x9296, 0x0029, 0x1120, 0xaa78, 0xd2fc, 0x0128, 0x0005,
+	0x9086, 0x0103, 0x0108, 0x0005, 0x2079, 0x0000, 0x2061, 0x1800,
+	0x701c, 0x0807, 0x2061, 0x1800, 0x7880, 0x908a, 0x0040, 0x1210,
+	0x61d0, 0x0042, 0x2100, 0x908a, 0x003f, 0x1a04, 0x354d, 0x61d0,
+	0x0804, 0x34e2, 0x3524, 0x355c, 0x3566, 0x356a, 0x3574, 0x357a,
+	0x357e, 0x358e, 0x3591, 0x359b, 0x35a0, 0x35a5, 0x35b0, 0x35bb,
+	0x35ca, 0x35d9, 0x35e7, 0x35fe, 0x3619, 0x354d, 0x36c2, 0x3700,
+	0x37a6, 0x37b7, 0x37da, 0x354d, 0x354d, 0x354d, 0x3812, 0x382e,
+	0x3837, 0x3866, 0x386c, 0x354d, 0x38b2, 0x354d, 0x354d, 0x354d,
+	0x354d, 0x354d, 0x38bd, 0x38c6, 0x38ce, 0x38d0, 0x354d, 0x354d,
+	0x354d, 0x354d, 0x354d, 0x354d, 0x38fc, 0x354d, 0x354d, 0x354d,
+	0x354d, 0x354d, 0x3919, 0x397a, 0x354d, 0x354d, 0x354d, 0x354d,
+	0x354d, 0x354d, 0x0002, 0x39a4, 0x39a7, 0x3a06, 0x3a1f, 0x3a4f,
+	0x3ced, 0x354d, 0x52a8, 0x354d, 0x354d, 0x354d, 0x354d, 0x354d,
+	0x354d, 0x354d, 0x354d, 0x359b, 0x35a0, 0x420e, 0x56f3, 0x422c,
+	0x5337, 0x5388, 0x548b, 0x354d, 0x54ed, 0x5529, 0x555a, 0x565e,
+	0x5587, 0x55de, 0x354d, 0x4230, 0x43f1, 0x4407, 0x442c, 0x4491,
+	0x4505, 0x4525, 0x459c, 0x45f8, 0x4654, 0x4657, 0x467c, 0x4719,
+	0x477f, 0x4787, 0x48b9, 0x4a2e, 0x4a62, 0x4cc6, 0x354d, 0x4ce4,
+	0x4d90, 0x4e72, 0x4ecc, 0x354d, 0x4f81, 0x354d, 0x4fe7, 0x5002,
+	0x4787, 0x5248, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c, 0x4ae0,
+	0x0126, 0x2091, 0x8000, 0x0e04, 0x352e, 0x0010, 0x012e, 0x0cc0,
+	0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833,
+	0x0010, 0x7c82, 0x7986, 0x7a8a, 0x7b8e, 0x2091, 0x4080, 0x2001,
+	0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x7007, 0x0001, 0x2091,
+	0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x2021, 0x4001, 0x08b0,
+	0x2021, 0x4002, 0x0898, 0x2021, 0x4003, 0x0880, 0x2021, 0x4005,
+	0x0868, 0x2021, 0x4006, 0x0850, 0x2039, 0x0001, 0x902e, 0x2520,
+	0x7b88, 0x7a8c, 0x7884, 0x7990, 0x0804, 0x4aed, 0x7883, 0x0004,
+	0x7884, 0x0807, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c,
+	0x7884, 0x7990, 0x0804, 0x4af0, 0x7984, 0x7888, 0x2114, 0x200a,
+	0x0804, 0x3524, 0x7984, 0x2114, 0x0804, 0x3524, 0x20e1, 0x0000,
+	0x2099, 0x0021, 0x20e9, 0x0000, 0x20a1, 0x0021, 0x20a9, 0x001f,
+	0x4003, 0x7984, 0x7a88, 0x7b8c, 0x0804, 0x3524, 0x7884, 0x2060,
+	0x04d8, 0x2009, 0x0003, 0x2011, 0x0002, 0x2019, 0x001c, 0x789b,
+	0x0137, 0x0804, 0x3524, 0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0800,
+	0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0848, 0x79a0, 0x9182, 0x0040,
+	0x0210, 0x0804, 0x3559, 0x2138, 0x7d98, 0x7c9c, 0x0804, 0x3560,
+	0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x3559, 0x2138, 0x7d98,
+	0x7c9c, 0x0804, 0x356e, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804,
+	0x3559, 0x21e8, 0x7984, 0x7888, 0x20a9, 0x0001, 0x21a0, 0x4004,
+	0x0804, 0x3524, 0x2061, 0x0800, 0xe10c, 0x9006, 0x2c15, 0x9200,
+	0x8c60, 0x8109, 0x1dd8, 0x2010, 0x9005, 0x0904, 0x3524, 0x0804,
+	0x3553, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x3559, 0x21e0,
+	0x20a9, 0x0001, 0x7984, 0x2198, 0x4012, 0x0804, 0x3524, 0x2069,
+	0x1847, 0x7884, 0x7990, 0x911a, 0x1a04, 0x3559, 0x8019, 0x0904,
+	0x3559, 0x684a, 0x6942, 0x788c, 0x6852, 0x7888, 0x6856, 0x9006,
+	0x685a, 0x685e, 0x080c, 0x76d5, 0x0804, 0x3524, 0x2069, 0x1847,
+	0x7884, 0x7994, 0x911a, 0x1a04, 0x3559, 0x8019, 0x0904, 0x3559,
+	0x684e, 0x6946, 0x788c, 0x6862, 0x7888, 0x6866, 0x9006, 0x686a,
+	0x686e, 0x0126, 0x2091, 0x8000, 0x080c, 0x69dc, 0x012e, 0x0804,
+	0x3524, 0x902e, 0x2520, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
+	0x3556, 0x7984, 0x7b88, 0x7a8c, 0x20a9, 0x0005, 0x20e9, 0x0001,
+	0x20a1, 0x18a6, 0x4101, 0x080c, 0x4aa4, 0x1120, 0x2009, 0x0002,
+	0x0804, 0x3556, 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60,
+	0x080c, 0x4aed, 0x701f, 0x363d, 0x0005, 0xa864, 0x2008, 0x9084,
+	0x00ff, 0x9096, 0x0011, 0x0168, 0x9096, 0x0019, 0x0150, 0x9096,
+	0x0015, 0x0138, 0x9096, 0x0048, 0x0120, 0x9096, 0x0029, 0x1904,
+	0x3556, 0x810f, 0x918c, 0x00ff, 0x0904, 0x3556, 0x7112, 0x7010,
+	0x8001, 0x0560, 0x7012, 0x080c, 0x4aa4, 0x1120, 0x2009, 0x0002,
+	0x0804, 0x3556, 0x2009, 0x0020, 0x7068, 0x2040, 0xa28c, 0xa390,
+	0xa494, 0xa598, 0x9290, 0x0040, 0x9399, 0x0000, 0x94a1, 0x0000,
+	0x95a9, 0x0000, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4aed,
+	0x701f, 0x367b, 0x0005, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0002,
+	0x0120, 0x9096, 0x000a, 0x1904, 0x3556, 0x0888, 0x7014, 0x2048,
+	0xa868, 0xc0fd, 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0029,
+	0x1160, 0xc2fd, 0xaa7a, 0x080c, 0x618b, 0x0150, 0x0126, 0x2091,
+	0x8000, 0xa87a, 0xa982, 0x012e, 0x0050, 0x080c, 0x64b4, 0x1128,
+	0x7007, 0x0003, 0x701f, 0x36a7, 0x0005, 0x080c, 0x6ec0, 0x0126,
+	0x2091, 0x8000, 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x18a6,
+	0x400a, 0x2100, 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9,
+	0x0000, 0xa85c, 0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60,
+	0x0804, 0x4af0, 0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010,
+	0x7883, 0x4000, 0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020,
+	0x2009, 0x017f, 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100,
+	0x6200, 0x2061, 0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009,
+	0x04fd, 0x2104, 0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001,
+	0x0089, 0x2004, 0xd084, 0x0180, 0x2001, 0x1a19, 0x2004, 0x9005,
+	0x0128, 0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a,
+	0x2003, 0x0002, 0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427,
+	0x81ff, 0x1904, 0x3556, 0x7984, 0x080c, 0x65ff, 0x1904, 0x3559,
+	0x7e98, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x3559, 0x7c88,
+	0x7d8c, 0x080c, 0x6762, 0x080c, 0x6731, 0x0000, 0x1518, 0x2061,
+	0x1cd0, 0x0126, 0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148,
+	0x6014, 0x904d, 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506,
+	0x0150, 0x012e, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02,
+	0x1a04, 0x3556, 0x0c30, 0x080c, 0xc768, 0x012e, 0x0904, 0x3556,
+	0x0804, 0x3524, 0x900e, 0x2001, 0x0005, 0x080c, 0x6ec0, 0x0126,
+	0x2091, 0x8000, 0x080c, 0xce2a, 0x080c, 0x6c81, 0x012e, 0x0804,
+	0x3524, 0x00a6, 0x2950, 0xb198, 0x080c, 0x65ff, 0x1904, 0x3793,
+	0xb6a4, 0x9684, 0x3fff, 0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0,
+	0x080c, 0x6762, 0x080c, 0x6731, 0x1520, 0x2061, 0x1cd0, 0x0126,
+	0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d,
+	0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0158, 0x012e,
+	0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x2009, 0x000d,
+	0x12b0, 0x0c28, 0x080c, 0xc768, 0x012e, 0x2009, 0x0003, 0x0178,
+	0x00e0, 0x900e, 0x2001, 0x0005, 0x080c, 0x6ec0, 0x0126, 0x2091,
+	0x8000, 0x080c, 0xce2a, 0x080c, 0x6c75, 0x012e, 0x0070, 0xb097,
+	0x4005, 0xb19a, 0x0010, 0xb097, 0x4006, 0x900e, 0x9085, 0x0001,
+	0x2001, 0x0030, 0x2a48, 0x00ae, 0x0005, 0xb097, 0x4000, 0x9006,
+	0x918d, 0x0001, 0x2008, 0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904,
+	0x3556, 0x080c, 0x4abb, 0x0904, 0x3559, 0x080c, 0x66c6, 0x0904,
+	0x3556, 0x080c, 0x6768, 0x0904, 0x3556, 0x0804, 0x451c, 0x81ff,
+	0x1904, 0x3556, 0x080c, 0x4ad7, 0x0904, 0x3559, 0x080c, 0x67f6,
+	0x0904, 0x3556, 0x2019, 0x0005, 0x79a8, 0x080c, 0x6783, 0x0904,
+	0x3556, 0x7888, 0x908a, 0x1000, 0x1a04, 0x3559, 0x8003, 0x800b,
+	0x810b, 0x9108, 0x080c, 0x8501, 0x7984, 0xd184, 0x1904, 0x3524,
+	0x0804, 0x451c, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0118, 0x2009,
+	0x0001, 0x0450, 0x2029, 0x07ff, 0x645c, 0x2400, 0x9506, 0x01f8,
+	0x2508, 0x080c, 0x65ff, 0x11d8, 0x080c, 0x67f6, 0x1128, 0x2009,
+	0x0002, 0x62c0, 0x2518, 0x00c0, 0x2019, 0x0004, 0x900e, 0x080c,
+	0x6783, 0x1118, 0x2009, 0x0006, 0x0078, 0x7884, 0x908a, 0x1000,
+	0x1270, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x8501, 0x8529,
+	0x1ae0, 0x012e, 0x0804, 0x3524, 0x012e, 0x0804, 0x3556, 0x012e,
+	0x0804, 0x3559, 0x080c, 0x4abb, 0x0904, 0x3559, 0x080c, 0x66c6,
+	0x0904, 0x3556, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c,
+	0x928b, 0x0076, 0x903e, 0x080c, 0x9168, 0x900e, 0x080c, 0xe2eb,
+	0x007e, 0x00ce, 0x080c, 0x6762, 0x0804, 0x3524, 0x080c, 0x4abb,
+	0x0904, 0x3559, 0x080c, 0x6762, 0x2208, 0x0804, 0x3524, 0x0156,
+	0x00d6, 0x00e6, 0x2069, 0x1910, 0x6810, 0x6914, 0x910a, 0x1208,
+	0x900e, 0x6816, 0x9016, 0x901e, 0x20a9, 0x007e, 0x2069, 0x1000,
+	0x2d04, 0x905d, 0x0118, 0xb84c, 0x0059, 0x9210, 0x8d68, 0x1f04,
+	0x3848, 0x2300, 0x9218, 0x00ee, 0x00de, 0x015e, 0x0804, 0x3524,
+	0x00f6, 0x0016, 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff,
+	0x0110, 0x2178, 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1910,
+	0x6910, 0x62bc, 0x0804, 0x3524, 0x81ff, 0x0120, 0x2009, 0x0001,
+	0x0804, 0x3556, 0x0126, 0x2091, 0x8000, 0x080c, 0x56e3, 0x0128,
+	0x2009, 0x0007, 0x012e, 0x0804, 0x3556, 0x012e, 0x615c, 0x9190,
+	0x3325, 0x2215, 0x9294, 0x00ff, 0x637c, 0x83ff, 0x0108, 0x6280,
+	0x67dc, 0x97c4, 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001,
+	0x00e8, 0x97c4, 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003,
+	0x00a8, 0x97c4, 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002,
+	0x0068, 0x080c, 0x73bc, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c,
+	0x0120, 0x2009, 0x0005, 0x0804, 0x3556, 0x9036, 0x7e9a, 0x7f9e,
+	0x0804, 0x3524, 0x614c, 0x6250, 0x2019, 0x1986, 0x231c, 0x2001,
+	0x1987, 0x2004, 0x789a, 0x0804, 0x3524, 0x0126, 0x2091, 0x8000,
+	0x6138, 0x623c, 0x6340, 0x012e, 0x0804, 0x3524, 0x080c, 0x4ad7,
+	0x0904, 0x3559, 0xba44, 0xbb38, 0x0804, 0x3524, 0x080c, 0x0dd5,
+	0x080c, 0x4ad7, 0x2110, 0x0904, 0x3559, 0xb804, 0x908c, 0x00ff,
+	0x918e, 0x0006, 0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009,
+	0x0009, 0x1904, 0x3556, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005,
+	0x00c6, 0x9066, 0x080c, 0xa808, 0x080c, 0x928b, 0x0076, 0x903e,
+	0x080c, 0x9168, 0x900e, 0x080c, 0xe2eb, 0x007e, 0x00ce, 0xb807,
+	0x0407, 0x012e, 0x0804, 0x3524, 0x614c, 0x6250, 0x7884, 0x604e,
+	0x7b88, 0x6352, 0x2069, 0x1847, 0x831f, 0x9305, 0x6816, 0x788c,
+	0x2069, 0x1986, 0x2d1c, 0x206a, 0x7e98, 0x9682, 0x0014, 0x1210,
+	0x2031, 0x07d0, 0x2069, 0x1987, 0x2d04, 0x266a, 0x789a, 0x0804,
+	0x3524, 0x0126, 0x2091, 0x8000, 0x7884, 0x603a, 0xd0c4, 0x01a8,
+	0x00d6, 0x78a8, 0x2009, 0x199d, 0x200a, 0x78ac, 0x2011, 0x199e,
+	0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118, 0x2214,
+	0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7884, 0xd0b4, 0x0120,
+	0x3b00, 0x9084, 0xff3f, 0x20d8, 0x7888, 0x603e, 0x2011, 0x0114,
+	0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0080, 0x0010, 0x918c,
+	0xff7f, 0x2112, 0x788c, 0x6042, 0x9084, 0x0020, 0x0130, 0x78b4,
+	0x6046, 0x9084, 0x0001, 0x090c, 0x420e, 0x6040, 0xd0cc, 0x0120,
+	0x78b0, 0x2011, 0x0114, 0x2012, 0x012e, 0x0804, 0x3524, 0x00f6,
+	0x2079, 0x1800, 0x7a38, 0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c,
+	0x9084, 0xfebf, 0x8002, 0x9214, 0x7838, 0x9084, 0x0140, 0x9215,
+	0x7a3a, 0xa897, 0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000,
+	0x00fe, 0x0005, 0x7898, 0x9005, 0x01a8, 0x7888, 0x9025, 0x0904,
+	0x3559, 0x788c, 0x902d, 0x0904, 0x3559, 0x900e, 0x080c, 0x65ff,
+	0x1120, 0xba44, 0xbb38, 0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190,
+	0x8108, 0x0ca0, 0x080c, 0x4ad7, 0x0904, 0x3559, 0x7888, 0x900d,
+	0x0904, 0x3559, 0x788c, 0x9005, 0x0904, 0x3559, 0xba44, 0xb946,
+	0xbb38, 0xb83a, 0x0804, 0x3524, 0x2011, 0xbc09, 0x0010, 0x2011,
+	0xbc05, 0x080c, 0x56e3, 0x1904, 0x3556, 0x00c6, 0x2061, 0x0100,
+	0x7984, 0x9186, 0x00ff, 0x1130, 0x2001, 0x1818, 0x2004, 0x9085,
+	0xff00, 0x0088, 0x9182, 0x007f, 0x16e0, 0x9188, 0x3325, 0x210d,
+	0x918c, 0x00ff, 0x2001, 0x1818, 0x2004, 0x0026, 0x9116, 0x002e,
+	0x0580, 0x810f, 0x9105, 0x0126, 0x2091, 0x8000, 0x0006, 0x080c,
+	0xae0b, 0x000e, 0x0510, 0x602e, 0x620a, 0x7984, 0x00b6, 0x080c,
+	0x65a4, 0x2b08, 0x00be, 0x1500, 0x6112, 0x6023, 0x0001, 0x080c,
+	0x4aa4, 0x01d0, 0x9006, 0xa866, 0x7007, 0x0003, 0xa832, 0xa868,
+	0xc0fd, 0xa86a, 0x701f, 0x39ff, 0x2900, 0x6016, 0x2009, 0x0032,
+	0x080c, 0xaedc, 0x012e, 0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804,
+	0x3556, 0x00ce, 0x0804, 0x3559, 0x080c, 0xae61, 0x0cb0, 0xa830,
+	0x9086, 0x0100, 0x0904, 0x3556, 0x0804, 0x3524, 0x2061, 0x1a71,
+	0x0126, 0x2091, 0x8000, 0x6000, 0xd084, 0x0170, 0x6104, 0x6208,
+	0x2061, 0x1800, 0x6354, 0x6074, 0x789a, 0x60c0, 0x789e, 0x60bc,
+	0x78aa, 0x012e, 0x0804, 0x3524, 0x900e, 0x2110, 0x0c88, 0x81ff,
+	0x1904, 0x3556, 0x080c, 0x73bc, 0x0904, 0x3556, 0x0126, 0x2091,
+	0x8000, 0x6254, 0x6074, 0x9202, 0x0248, 0x9085, 0x0001, 0x080c,
+	0x28a7, 0x080c, 0x58fd, 0x012e, 0x0804, 0x3524, 0x012e, 0x0804,
+	0x3559, 0x0006, 0x0016, 0x00c6, 0x00e6, 0x2001, 0x19a9, 0x2070,
+	0x2061, 0x1847, 0x6008, 0x2072, 0x900e, 0x2011, 0x1400, 0x080c,
+	0x8f68, 0x7206, 0x00ee, 0x00ce, 0x001e, 0x000e, 0x0005, 0x0126,
+	0x2091, 0x8000, 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804,
+	0x3526, 0x7884, 0xd0fc, 0x0148, 0x2001, 0x002a, 0x2004, 0x9082,
+	0x00e1, 0x0288, 0x012e, 0x0804, 0x3559, 0x2001, 0x002a, 0x2004,
+	0x2069, 0x1847, 0x6908, 0x9102, 0x1230, 0x012e, 0x0804, 0x3559,
+	0x012e, 0x0804, 0x3556, 0x080c, 0xadcb, 0x0dd0, 0x7884, 0xd0fc,
+	0x0904, 0x3aca, 0x00c6, 0x080c, 0x4aa4, 0x00ce, 0x0d88, 0xa867,
+	0x0000, 0x7884, 0xa80a, 0x7898, 0xa80e, 0x789c, 0xa812, 0x2001,
+	0x002e, 0x2004, 0xa81a, 0x2001, 0x002f, 0x2004, 0xa81e, 0x2001,
+	0x0030, 0x2004, 0xa822, 0x2001, 0x0031, 0x2004, 0xa826, 0x2001,
+	0x0034, 0x2004, 0xa82a, 0x2001, 0x0035, 0x2004, 0xa82e, 0x2001,
+	0x002a, 0x2004, 0x9080, 0x0003, 0x9084, 0x00fc, 0x8004, 0xa816,
+	0x080c, 0x3c50, 0x0928, 0x7014, 0x2048, 0xad2c, 0xac28, 0xab1c,
+	0xaa18, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021,
+	0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x001b, 0x080c, 0x4aed, 0x701f, 0x3b8d, 0x7023, 0x0001,
+	0x012e, 0x0005, 0x0046, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6,
+	0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3a39, 0x2001, 0x199f, 0x2003,
+	0x0000, 0x2021, 0x000a, 0x2061, 0x0100, 0x6104, 0x0016, 0x60bb,
+	0x0000, 0x60bf, 0x32e1, 0x60bf, 0x0012, 0x080c, 0x3cbf, 0x080c,
+	0x3c7e, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x1a66, 0x2079,
+	0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0140, 0x2001,
+	0x0035, 0x2004, 0x780e, 0x2001, 0x0034, 0x2004, 0x780a, 0x00de,
+	0x2011, 0x0001, 0x080c, 0x4052, 0x008e, 0x00ee, 0x00fe, 0x080c,
+	0x3f7f, 0x080c, 0x3e84, 0x05b8, 0x2001, 0x020b, 0x2004, 0x9084,
+	0x0140, 0x1db8, 0x080c, 0x40c6, 0x00f6, 0x2079, 0x0300, 0x78bc,
+	0x00fe, 0x908c, 0x0070, 0x1560, 0x2071, 0x0200, 0x7037, 0x0000,
+	0x7050, 0x9084, 0xff00, 0x9086, 0x3200, 0x1510, 0x7037, 0x0001,
+	0x7050, 0x9084, 0xff00, 0x9086, 0xe100, 0x11d0, 0x7037, 0x0000,
+	0x7054, 0x7037, 0x0000, 0x715c, 0x9106, 0x1190, 0x2001, 0x1820,
+	0x2004, 0x9106, 0x1168, 0x00c6, 0x2061, 0x0100, 0x6024, 0x9084,
+	0x1e00, 0x00ce, 0x0138, 0x080c, 0x3e8e, 0x080c, 0x3c79, 0x0058,
+	0x080c, 0x3c79, 0x080c, 0x3fea, 0x080c, 0x3f75, 0x2001, 0x020b,
+	0x2004, 0xd0e4, 0x0dd8, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061,
+	0x0100, 0x6027, 0x0002, 0x001e, 0x6106, 0x2011, 0x020d, 0x2013,
+	0x0020, 0x60bb, 0x0000, 0x60bf, 0x0108, 0x60bf, 0x0012, 0x2001,
+	0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x12ed, 0x2009,
+	0x0028, 0x080c, 0x23d2, 0x2001, 0x0227, 0x200c, 0x2102, 0x00fe,
+	0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x004e,
+	0x2001, 0x199f, 0x2004, 0x9005, 0x1118, 0x012e, 0x0804, 0x3524,
+	0x012e, 0x2021, 0x400c, 0x0804, 0x3526, 0x0016, 0x0026, 0x0036,
+	0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156, 0x7014,
+	0x2048, 0x7020, 0x20a8, 0x8000, 0x7022, 0xa804, 0x9005, 0x0904,
+	0x3be9, 0x2048, 0x1f04, 0x3b9d, 0x7068, 0x2040, 0xa28c, 0xa390,
+	0xa494, 0xa598, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000,
+	0x2021, 0x0000, 0x0096, 0x7014, 0x2048, 0xa864, 0x009e, 0x9086,
+	0x0103, 0x0170, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
+	0xffc0, 0x9080, 0x001b, 0x080c, 0x4aed, 0x701f, 0x3b8d, 0x00b0,
+	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
+	0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c,
+	0x0f7c, 0x000e, 0x080c, 0x4af0, 0x701f, 0x3b8d, 0x015e, 0x00de,
+	0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e,
+	0x0005, 0x7014, 0x2048, 0xa864, 0x9086, 0x0103, 0x1118, 0x701f,
+	0x3c4e, 0x0450, 0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a, 0x2009,
+	0x007f, 0x080c, 0x659e, 0x0110, 0x9006, 0x0030, 0xb813, 0x00ff,
+	0xb817, 0xfffd, 0x080c, 0xcff9, 0x015e, 0x00de, 0x009e, 0x008e,
+	0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0904, 0x3556,
+	0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096,
+	0x00d6, 0x0156, 0x701f, 0x3c20, 0x7007, 0x0003, 0x0804, 0x3bde,
+	0xa830, 0x9086, 0x0100, 0x2021, 0x400c, 0x0904, 0x3526, 0x0076,
+	0xad10, 0xac0c, 0xab24, 0xaa20, 0xa930, 0xa808, 0xd0b4, 0x1120,
+	0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc,
+	0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098,
+	0x27e8, 0x20a0, 0x0006, 0x080c, 0x0f7c, 0x000e, 0x080c, 0x4af0,
+	0x007e, 0x701f, 0x3b8d, 0x7023, 0x0001, 0x0005, 0x0804, 0x3524,
+	0x0156, 0x00c6, 0xa814, 0x908a, 0x001e, 0x0218, 0xa833, 0x001e,
+	0x0010, 0xa832, 0x0078, 0x81ff, 0x0168, 0x0016, 0x080c, 0x4aa4,
+	0x001e, 0x0130, 0xa800, 0x2040, 0xa008, 0xa80a, 0x2100, 0x0c58,
+	0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x015e, 0x0005, 0x0006,
+	0x00f6, 0x2079, 0x0000, 0x7880, 0x9086, 0x0044, 0x00fe, 0x000e,
+	0x0005, 0x2001, 0x199f, 0x2003, 0x0001, 0x0005, 0x00f6, 0x00e6,
+	0x00c6, 0x2061, 0x0200, 0x2001, 0x19aa, 0x2004, 0x601a, 0x2061,
+	0x0100, 0x2001, 0x19a9, 0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106,
+	0x080c, 0x4aa4, 0xa813, 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a,
+	0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a,
 	0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x19a9, 0x2004, 0x6036,
 	0x2009, 0x0040, 0x080c, 0x23d2, 0x2001, 0x002a, 0x2004, 0x9084,
-	0xfff8, 0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6,
-	0x000e, 0x78ca, 0x9006, 0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee,
-	0x00fe, 0x0005, 0x00e6, 0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0,
-	0x20e1, 0x0000, 0x2099, 0x0088, 0x702b, 0x0026, 0x7402, 0x7306,
-	0x9006, 0x700a, 0x700e, 0x810b, 0x810b, 0x21a8, 0x810b, 0x7112,
-	0x702b, 0x0041, 0x702c, 0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b,
-	0x0040, 0x4005, 0x7400, 0x7304, 0x87ff, 0x0190, 0x0086, 0x0096,
-	0x2940, 0x0086, 0x080c, 0x4aa5, 0x008e, 0xa058, 0x00a6, 0x2050,
-	0x2900, 0xb006, 0xa05a, 0x00ae, 0x009e, 0x008e, 0x9085, 0x0001,
-	0x00ee, 0x0005, 0x00e6, 0x2001, 0x002d, 0x2004, 0x9005, 0x0528,
-	0x2038, 0x2001, 0x0030, 0x2024, 0x2001, 0x0031, 0x201c, 0x080c,
-	0x4aa5, 0x2940, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a,
+	0xfff8, 0xa86e, 0x601a, 0xa873, 0x0000, 0x601f, 0x0000, 0x78ca,
+	0x9006, 0x600a, 0x600e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6,
+	0x080c, 0x4aa4, 0x2940, 0xa013, 0x0019, 0xa017, 0x0001, 0x2800,
+	0xa05a, 0x2001, 0x0030, 0x2004, 0xa866, 0x2001, 0x0031, 0x2004,
+	0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0xa873,
+	0x0000, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x0300, 0x2003,
+	0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c,
+	0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000,
+	0x81ff, 0x0148, 0x080c, 0x2c30, 0x1130, 0x9006, 0x080c, 0x2b88,
+	0x9006, 0x080c, 0x2b6b, 0x7884, 0x9084, 0x0007, 0x0002, 0x3d0a,
+	0x3d13, 0x3d1c, 0x3d07, 0x3d07, 0x3d07, 0x3d07, 0x3d07, 0x012e,
+	0x0804, 0x3559, 0x2009, 0x0114, 0x2104, 0x9085, 0x0800, 0x200a,
+	0x080c, 0x3ed8, 0x00c0, 0x2009, 0x0114, 0x2104, 0x9085, 0x4000,
+	0x200a, 0x080c, 0x3ed8, 0x0078, 0x080c, 0x73bc, 0x1128, 0x012e,
+	0x2009, 0x0016, 0x0804, 0x3556, 0x81ff, 0x0128, 0x012e, 0x2021,
+	0x400b, 0x0804, 0x3526, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6,
+	0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3a39, 0x2009, 0x0101, 0x210c,
+	0x0016, 0x7ec8, 0x7dcc, 0x9006, 0x2068, 0x2060, 0x2058, 0x080c,
+	0x41a1, 0x080c, 0x40f1, 0x903e, 0x2720, 0x00f6, 0x00e6, 0x0086,
+	0x2940, 0x2071, 0x1a66, 0x2079, 0x0090, 0x00d6, 0x2069, 0x0000,
+	0x6884, 0xd0b4, 0x0120, 0x68d4, 0x780e, 0x68d0, 0x780a, 0x00de,
+	0x2011, 0x0001, 0x080c, 0x4052, 0x080c, 0x2c38, 0x080c, 0x2c38,
+	0x080c, 0x2c38, 0x080c, 0x2c38, 0x080c, 0x4052, 0x008e, 0x00ee,
+	0x00fe, 0x080c, 0x3f7f, 0x2009, 0x9c40, 0x8109, 0x11b0, 0x080c,
+	0x3e8e, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x001e,
+	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e,
+	0x2009, 0x0017, 0x080c, 0x3556, 0x0cf8, 0x2001, 0x020b, 0x2004,
+	0x9084, 0x0140, 0x1d10, 0x00f6, 0x2079, 0x0000, 0x7884, 0x00fe,
+	0xd0bc, 0x0178, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0150, 0x080c,
+	0x3f5d, 0x2d00, 0x9c05, 0x9b05, 0x0120, 0x080c, 0x3e8e, 0x0804,
+	0x3e3b, 0x080c, 0x40c6, 0x080c, 0x3fea, 0x080c, 0x3f40, 0x080c,
+	0x3f75, 0x00f6, 0x2079, 0x0100, 0x7824, 0xd0ac, 0x0130, 0x8b58,
+	0x080c, 0x3e8e, 0x00fe, 0x0804, 0x3e3b, 0x00fe, 0x080c, 0x3e84,
+	0x1150, 0x8d68, 0x2001, 0x0032, 0x2602, 0x2001, 0x0033, 0x2502,
+	0x080c, 0x3e8e, 0x0080, 0x87ff, 0x0138, 0x2001, 0x0201, 0x2004,
+	0x9005, 0x1908, 0x8739, 0x0038, 0x2001, 0x1a62, 0x2004, 0x9086,
+	0x0000, 0x1904, 0x3d8b, 0x2001, 0x032f, 0x2003, 0x00f6, 0x8631,
+	0x1208, 0x8529, 0x2500, 0x9605, 0x0904, 0x3e3b, 0x7884, 0xd0bc,
+	0x0128, 0x2d00, 0x9c05, 0x9b05, 0x1904, 0x3e3b, 0xa013, 0x0019,
+	0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1148, 0x2001,
+	0x1a62, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x0030,
+	0xa017, 0x0001, 0x78b4, 0x9005, 0x0108, 0xa016, 0x2800, 0xa05a,
+	0x2009, 0x0040, 0x080c, 0x23d2, 0x2900, 0xa85a, 0xa813, 0x0019,
+	0x7884, 0xd0a4, 0x1180, 0xa817, 0x0000, 0x00c6, 0x20a9, 0x0004,
+	0x2061, 0x0090, 0x602b, 0x0008, 0x2001, 0x0203, 0x2004, 0x1f04,
+	0x3e12, 0x00ce, 0x0030, 0xa817, 0x0001, 0x78b0, 0x9005, 0x0108,
+	0xa816, 0x00f6, 0x00c6, 0x2079, 0x0100, 0x2061, 0x0090, 0x7827,
+	0x0002, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a, 0x0006,
+	0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca, 0x00ce,
+	0x00fe, 0x0804, 0x3d45, 0x001e, 0x00c6, 0x2001, 0x032a, 0x2003,
+	0x0004, 0x2061, 0x0100, 0x6027, 0x0002, 0x6106, 0x2011, 0x020d,
+	0x2013, 0x0020, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102,
+	0x080c, 0x12ed, 0x7884, 0x9084, 0x0003, 0x9086, 0x0002, 0x01a0,
+	0x2009, 0x0028, 0x080c, 0x23d2, 0x2001, 0x0227, 0x200c, 0x2102,
+	0x6050, 0x9084, 0xb7ef, 0x6052, 0x602f, 0x0000, 0x604b, 0xf7f7,
+	0x6043, 0x0090, 0x6043, 0x0010, 0x00ce, 0x2d08, 0x2c10, 0x2b18,
+	0x2b00, 0x9c05, 0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
+	0x00ae, 0x009e, 0x008e, 0x1118, 0x012e, 0x0804, 0x3524, 0x012e,
+	0x2021, 0x400c, 0x0804, 0x3526, 0x9085, 0x0001, 0x1d04, 0x3e8d,
+	0x2091, 0x6000, 0x8420, 0x9486, 0x0064, 0x0005, 0x2001, 0x0105,
+	0x2003, 0x0010, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x1a62,
+	0x2003, 0x0000, 0x0071, 0x2009, 0x0048, 0x080c, 0x23d2, 0x2001,
+	0x0227, 0x2024, 0x2402, 0x2001, 0x0109, 0x2003, 0x4000, 0x9026,
+	0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a66, 0x7000, 0x9086, 0x0000,
+	0x0520, 0x2079, 0x0090, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203,
+	0x210c, 0x9106, 0x1120, 0x2009, 0x0040, 0x080c, 0x23d2, 0x782c,
+	0xd0fc, 0x0d88, 0x080c, 0x40c6, 0x7000, 0x9086, 0x0000, 0x1d58,
+	0x782b, 0x0004, 0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040, 0x080c,
+	0x23d2, 0x782b, 0x0002, 0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005,
+	0x00f6, 0x2079, 0x0100, 0x2001, 0x1818, 0x200c, 0x7932, 0x7936,
+	0x080c, 0x2887, 0x7850, 0x9084, 0xfbff, 0x9085, 0x0030, 0x7852,
+	0x2019, 0x01f4, 0x8319, 0x1df0, 0x9084, 0xffcf, 0x9085, 0x2000,
+	0x7852, 0x20a9, 0x0046, 0x1d04, 0x3ef3, 0x2091, 0x6000, 0x1f04,
+	0x3ef3, 0x7850, 0x9085, 0x0400, 0x9084, 0xdfff, 0x7852, 0x2001,
+	0x0021, 0x2004, 0x9084, 0x0003, 0x9086, 0x0001, 0x1120, 0x7850,
+	0x9084, 0xdfff, 0x7852, 0x784b, 0xf7f7, 0x7843, 0x0090, 0x7843,
+	0x0010, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x3f13, 0x7850, 0x9085,
+	0x1400, 0x7852, 0x2019, 0x61a8, 0x7854, 0xa001, 0xa001, 0xd08c,
+	0x1110, 0x8319, 0x1dc8, 0x7827, 0x0048, 0x7850, 0x9085, 0x0400,
+	0x7852, 0x7843, 0x0040, 0x2019, 0x01f4, 0xa001, 0xa001, 0x8319,
+	0x1de0, 0x2001, 0x0100, 0x080c, 0x2cef, 0x7827, 0x0020, 0x7843,
+	0x0000, 0x9006, 0x080c, 0x2cef, 0x7827, 0x0048, 0x00fe, 0x0005,
+	0x7884, 0xd0ac, 0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a62, 0x2079,
+	0x0320, 0x2001, 0x0201, 0x2004, 0x9005, 0x0160, 0x7000, 0x9086,
+	0x0000, 0x1140, 0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003, 0x0003,
+	0x782b, 0x0019, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0300,
+	0x78bc, 0x00fe, 0x908c, 0x0070, 0x0178, 0x2009, 0x0032, 0x260a,
+	0x2009, 0x0033, 0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac, 0x0108,
+	0x8d68, 0xd0a4, 0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079, 0x0200,
+	0x781c, 0xd084, 0x0110, 0x7837, 0x0050, 0x00fe, 0x0005, 0x00e6,
+	0x2071, 0x0100, 0x2001, 0x19aa, 0x2004, 0x70e2, 0x080c, 0x3c6f,
+	0x1188, 0x2001, 0x1820, 0x2004, 0x2009, 0x181f, 0x210c, 0x918c,
+	0x00ff, 0x706e, 0x716a, 0x7066, 0x918d, 0x3200, 0x7162, 0x7073,
+	0xe109, 0x0080, 0x702c, 0x9085, 0x0002, 0x702e, 0x2009, 0x1818,
+	0x210c, 0x716e, 0x7063, 0x0100, 0x7166, 0x719e, 0x706b, 0x0000,
+	0x7073, 0x0809, 0x7077, 0x0008, 0x7078, 0x9080, 0x0100, 0x707a,
+	0x7080, 0x8000, 0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a, 0x708e,
+	0x707e, 0x70d6, 0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014, 0x9084,
+	0x1984, 0x9085, 0x0092, 0x7016, 0x080c, 0x40c6, 0x00f6, 0x2071,
+	0x1a62, 0x2079, 0x0320, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4,
+	0x0120, 0x689c, 0x780e, 0x6898, 0x780a, 0x00de, 0x2009, 0x03e8,
+	0x8109, 0x1df0, 0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004, 0x2011,
+	0x0011, 0x080c, 0x4052, 0x2011, 0x0001, 0x080c, 0x4052, 0x00fe,
+	0x00ee, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a62, 0x2079, 0x0320,
+	0x792c, 0xd1fc, 0x0904, 0x404f, 0x782b, 0x0002, 0x9026, 0xd19c,
+	0x1904, 0x404b, 0x7000, 0x0002, 0x404f, 0x4000, 0x4030, 0x404b,
+	0xd1bc, 0x1170, 0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011, 0x0001,
+	0x080c, 0x4052, 0x0904, 0x404f, 0x080c, 0x4052, 0x0804, 0x404f,
+	0x00f6, 0x2079, 0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810, 0x7914,
+	0x782b, 0x0004, 0x7812, 0x7916, 0x2001, 0x0201, 0x200c, 0x81ff,
+	0x0de8, 0x080c, 0x3f5d, 0x2009, 0x0001, 0x00f6, 0x2079, 0x0300,
+	0x78b8, 0x00fe, 0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a, 0x00f8,
+	0x8001, 0x7002, 0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc, 0x1904,
+	0x3ff4, 0x2011, 0x0001, 0x00b1, 0x0090, 0xa010, 0x9092, 0x0004,
+	0x9086, 0x0015, 0x1120, 0xa000, 0xa05a, 0x2011, 0x0031, 0xa212,
+	0xd1dc, 0x1960, 0x0828, 0x782b, 0x0004, 0x7003, 0x0000, 0x00ee,
+	0x00fe, 0x0005, 0xa014, 0x9005, 0x0550, 0x8001, 0x0036, 0x0096,
+	0xa016, 0xa058, 0x2048, 0xa010, 0x2009, 0x0031, 0x911a, 0x831c,
+	0x831c, 0x938a, 0x0007, 0x1a0c, 0x0dd5, 0x9398, 0x4080, 0x231d,
+	0x083f, 0x9080, 0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102, 0x009e,
+	0x003e, 0x908a, 0x0035, 0x1140, 0x0096, 0xa058, 0x2048, 0xa804,
+	0xa05a, 0x2001, 0x0019, 0x009e, 0xa012, 0x9085, 0x0001, 0x0005,
+	0x40bd, 0x40b4, 0x40ab, 0x40a2, 0x4099, 0x4090, 0x4087, 0xa964,
+	0x7902, 0xa968, 0x7906, 0xa96c, 0x7912, 0xa970, 0x7916, 0x0005,
+	0xa974, 0x7902, 0xa978, 0x7906, 0xa97c, 0x7912, 0xa980, 0x7916,
+	0x0005, 0xa984, 0x7902, 0xa988, 0x7906, 0xa98c, 0x7912, 0xa990,
+	0x7916, 0x0005, 0xa994, 0x7902, 0xa998, 0x7906, 0xa99c, 0x7912,
+	0xa9a0, 0x7916, 0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906, 0xa9ac,
+	0x7912, 0xa9b0, 0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8, 0x7906,
+	0xa9bc, 0x7912, 0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902, 0xa9c8,
+	0x7906, 0xa9cc, 0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6, 0x00e6,
+	0x0086, 0x2071, 0x1a66, 0x2079, 0x0090, 0x792c, 0xd1fc, 0x01e8,
+	0x782b, 0x0002, 0x2940, 0x9026, 0x7000, 0x0002, 0x40ed, 0x40d9,
+	0x40e4, 0x8001, 0x7002, 0xd19c, 0x1180, 0x2011, 0x0001, 0x080c,
+	0x4052, 0x190c, 0x4052, 0x0048, 0x8001, 0x7002, 0x782c, 0xd0fc,
+	0x1d38, 0x2011, 0x0001, 0x080c, 0x4052, 0x008e, 0x00ee, 0x00fe,
+	0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200, 0x2001,
+	0x19aa, 0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x19a9, 0x2004,
+	0x60ce, 0x6104, 0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004, 0x9005,
+	0x0520, 0x2038, 0x2001, 0x002e, 0x2024, 0x2001, 0x002f, 0x201c,
+	0x080c, 0x4aa4, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a,
 	0x0007, 0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e,
 	0x0096, 0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c,
-	0x4162, 0x1d68, 0x2900, 0xa85a, 0x00d8, 0x080c, 0x4aa5, 0x2940,
-	0xa013, 0x0019, 0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030,
-	0x2004, 0xa066, 0x2001, 0x0031, 0x2004, 0xa06a, 0x2001, 0x002a,
-	0x2004, 0x9084, 0xfff8, 0xa06e, 0x2001, 0x002b, 0x2004, 0xa072,
-	0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001,
-	0x0101, 0x200c, 0x918d, 0x0200, 0x2102, 0xa017, 0x0000, 0x2001,
-	0x1a62, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x2001,
-	0x0300, 0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001,
-	0x0004, 0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126,
-	0x2091, 0x8000, 0x20a9, 0x0007, 0x20a1, 0x1840, 0x20e9, 0x0001,
-	0x9006, 0x4004, 0x20a9, 0x000c, 0x20a1, 0xfff4, 0x20e9, 0x0000,
-	0x9006, 0x4004, 0x2009, 0x013c, 0x200a, 0x012e, 0x7880, 0x9086,
-	0x0052, 0x0108, 0x0005, 0x0804, 0x351d, 0x7d98, 0x7c9c, 0x0804,
-	0x3614, 0x080c, 0x56df, 0x1128, 0x3a00, 0x9084, 0x0010, 0x0904,
-	0x3552, 0x080c, 0x73b0, 0x190c, 0x5fe0, 0x6040, 0x9084, 0x0020,
-	0x0971, 0x2069, 0x1847, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88,
-	0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x4aee, 0x701f, 0x4249,
-	0x0005, 0x080c, 0x56df, 0x1130, 0x3b00, 0x3a08, 0xc194, 0xc095,
-	0x20d8, 0x21d0, 0x2069, 0x1847, 0x6800, 0x9005, 0x0904, 0x3552,
-	0x6804, 0xd0ac, 0x0118, 0xd0a4, 0x0904, 0x3552, 0xd094, 0x00c6,
-	0x2061, 0x0100, 0x6104, 0x0138, 0x6200, 0x9292, 0x0005, 0x0218,
-	0x918c, 0xffdf, 0x0010, 0x918d, 0x0020, 0x6106, 0x00ce, 0xd08c,
-	0x00c6, 0x2061, 0x0100, 0x6104, 0x0118, 0x918d, 0x0010, 0x0010,
-	0x918c, 0xffef, 0x6106, 0x00ce, 0xd084, 0x0158, 0x6a28, 0x928a,
-	0x007f, 0x1a04, 0x3552, 0x9288, 0x331e, 0x210d, 0x918c, 0x00ff,
-	0x6166, 0xd0dc, 0x0130, 0x6828, 0x908a, 0x007f, 0x1a04, 0x3552,
-	0x605e, 0x6888, 0x9084, 0x0030, 0x8004, 0x8004, 0x8004, 0x8004,
-	0x0006, 0x2009, 0x19b1, 0x9080, 0x297a, 0x2005, 0x200a, 0x000e,
-	0x2009, 0x19b2, 0x9080, 0x297e, 0x2005, 0x200a, 0x6808, 0x908a,
-	0x0100, 0x0a04, 0x3552, 0x908a, 0x0841, 0x1a04, 0x3552, 0x9084,
-	0x0007, 0x1904, 0x3552, 0x680c, 0x9005, 0x0904, 0x3552, 0x6810,
-	0x9005, 0x0904, 0x3552, 0x6848, 0x6940, 0x910a, 0x1a04, 0x3552,
-	0x8001, 0x0904, 0x3552, 0x684c, 0x6944, 0x910a, 0x1a04, 0x3552,
-	0x8001, 0x0904, 0x3552, 0x2009, 0x1981, 0x200b, 0x0000, 0x2001,
-	0x1869, 0x2004, 0xd0c4, 0x0140, 0x7884, 0x200a, 0x2009, 0x017f,
-	0x200a, 0x3b00, 0xc085, 0x20d8, 0x6814, 0x908c, 0x00ff, 0x614e,
-	0x8007, 0x9084, 0x00ff, 0x6052, 0x080c, 0x76c9, 0x080c, 0x69a0,
-	0x080c, 0x69d4, 0x6808, 0x602a, 0x080c, 0x2344, 0x2009, 0x0170,
-	0x200b, 0x0080, 0xa001, 0xa001, 0x200b, 0x0000, 0x0036, 0x6b08,
-	0x080c, 0x28e1, 0x003e, 0x6000, 0x9086, 0x0000, 0x1904, 0x43e0,
-	0x6818, 0x691c, 0x6a20, 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f,
-	0x6016, 0x611a, 0x621e, 0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830,
-	0x6934, 0x6a38, 0x6b3c, 0x8007, 0x810f, 0x8217, 0x831f, 0x0010,
-	0x9084, 0xf0ff, 0x6006, 0x610a, 0x620e, 0x6312, 0x8007, 0x810f,
-	0x8217, 0x831f, 0x20a9, 0x0004, 0x20a1, 0x19b3, 0x20e9, 0x0001,
-	0x4001, 0x20a9, 0x0004, 0x20a1, 0x19cd, 0x20e9, 0x0001, 0x4001,
-	0x080c, 0x85c6, 0x00c6, 0x900e, 0x20a9, 0x0001, 0x6b70, 0xd384,
-	0x0510, 0x0068, 0x2009, 0x0100, 0x210c, 0x918e, 0x0008, 0x1110,
-	0x839d, 0x0010, 0x83f5, 0x3e18, 0x12b0, 0x3508, 0x8109, 0x080c,
-	0x7c7f, 0x6878, 0x6016, 0x6874, 0x2008, 0x9084, 0xff00, 0x8007,
-	0x600a, 0x9184, 0x00ff, 0x6006, 0x8108, 0x1118, 0x6003, 0x0003,
-	0x0010, 0x6003, 0x0001, 0x1f04, 0x433a, 0x00ce, 0x00c6, 0x2061,
-	0x199c, 0x6a88, 0x9284, 0xc000, 0x2010, 0x9286, 0x0000, 0x1158,
-	0x2063, 0x0000, 0x2001, 0x0001, 0x080c, 0x2b88, 0x2001, 0x0001,
-	0x080c, 0x2b6b, 0x0088, 0x9286, 0x4000, 0x1148, 0x2063, 0x0001,
-	0x9006, 0x080c, 0x2b88, 0x9006, 0x080c, 0x2b6b, 0x0028, 0x9286,
-	0x8000, 0x1d30, 0x2063, 0x0002, 0x00ce, 0x6888, 0xd0ec, 0x0130,
-	0x2011, 0x0114, 0x2204, 0x9085, 0x0100, 0x2012, 0x6a80, 0x9284,
-	0x0030, 0x9086, 0x0030, 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020,
-	0x6a82, 0x2001, 0x197c, 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000,
-	0x0170, 0x928e, 0x0010, 0x0118, 0x928e, 0x0020, 0x0140, 0x2003,
-	0xaaaa, 0x080c, 0x2956, 0x2001, 0x196d, 0x2102, 0x0008, 0x2102,
-	0x00c6, 0x2061, 0x0100, 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce,
-	0x080c, 0x73b0, 0x0128, 0x080c, 0x4fdc, 0x0110, 0x080c, 0x28a7,
-	0x60d4, 0x9005, 0x01c0, 0x6003, 0x0001, 0x2009, 0x43c8, 0x00e0,
-	0x080c, 0x73b0, 0x1168, 0x2011, 0x7246, 0x080c, 0x84ca, 0x2011,
-	0x7239, 0x080c, 0x85a4, 0x080c, 0x769d, 0x080c, 0x72e2, 0x0040,
-	0x080c, 0x5eda, 0x0028, 0x6003, 0x0004, 0x2009, 0x43e0, 0x0020,
-	0x080c, 0x68d5, 0x0804, 0x351d, 0x2001, 0x0170, 0x2004, 0x9084,
-	0x00ff, 0x9086, 0x004c, 0x1118, 0x2091, 0x30bd, 0x0817, 0x2091,
-	0x303d, 0x0817, 0x6000, 0x9086, 0x0000, 0x0904, 0x354f, 0x2069,
-	0x1847, 0x7890, 0x6842, 0x7894, 0x6846, 0x2d00, 0x2009, 0x0030,
-	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x0804, 0x4af1,
-	0x9006, 0x080c, 0x28a7, 0x81ff, 0x1904, 0x354f, 0x080c, 0x73b0,
-	0x11b0, 0x080c, 0x7698, 0x080c, 0x601b, 0x080c, 0x3312, 0x0118,
-	0x6130, 0xc18d, 0x6132, 0x080c, 0xd216, 0x0130, 0x080c, 0x73d3,
-	0x1118, 0x080c, 0x7388, 0x0038, 0x080c, 0x72e2, 0x0020, 0x080c,
-	0x5fe0, 0x080c, 0x5eda, 0x0804, 0x351d, 0x81ff, 0x1904, 0x354f,
-	0x080c, 0x73b0, 0x1110, 0x0804, 0x354f, 0x6194, 0x81ff, 0x01a8,
-	0x704f, 0x0000, 0x2001, 0x1c80, 0x2009, 0x0040, 0x7a8c, 0x7b88,
-	0x7c9c, 0x7d98, 0x0126, 0x2091, 0x8000, 0x2039, 0x0001, 0x080c,
-	0x4af1, 0x701f, 0x351b, 0x012e, 0x0005, 0x704f, 0x0001, 0x00d6,
-	0x2069, 0x1c80, 0x20a9, 0x0040, 0x20e9, 0x0001, 0x20a1, 0x1c80,
-	0x2019, 0xffff, 0x4304, 0x655c, 0x9588, 0x331e, 0x210d, 0x918c,
-	0x00ff, 0x216a, 0x900e, 0x2011, 0x0002, 0x2100, 0x9506, 0x01a8,
-	0x080c, 0x6600, 0x1190, 0xb814, 0x821c, 0x0238, 0x9398, 0x1c80,
-	0x9085, 0xff00, 0x8007, 0x201a, 0x0038, 0x9398, 0x1c80, 0x2324,
-	0x94a4, 0xff00, 0x9405, 0x201a, 0x8210, 0x8108, 0x9182, 0x0080,
-	0x1208, 0x0c18, 0x8201, 0x8007, 0x2d0c, 0x9105, 0x206a, 0x00de,
-	0x20a9, 0x0040, 0x20a1, 0x1c80, 0x2099, 0x1c80, 0x080c, 0x5f6b,
-	0x0804, 0x443a, 0x080c, 0x4ad8, 0x0904, 0x3552, 0x080c, 0x4aa5,
-	0x1120, 0x2009, 0x0002, 0x0804, 0x354f, 0x080c, 0x56d0, 0xd0b4,
-	0x0558, 0x7884, 0x908e, 0x007e, 0x0538, 0x908e, 0x007f, 0x0520,
-	0x908e, 0x0080, 0x0508, 0x080c, 0x330d, 0x1148, 0xb800, 0xd08c,
-	0x11d8, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x11a8, 0xa867,
-	0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xcce4, 0x1120, 0x2009,
-	0x0003, 0x0804, 0x354f, 0x7007, 0x0003, 0x701f, 0x44c8, 0x0005,
-	0x080c, 0x4ad8, 0x0904, 0x3552, 0x20a9, 0x002b, 0xb8c4, 0x20e0,
-	0xb8c8, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0,
-	0x4003, 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xb8c4, 0x20e0,
-	0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0f7c, 0x0070, 0x20a9,
-	0x0004, 0xa85c, 0x9080, 0x000a, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8,
-	0x9080, 0x000a, 0x2098, 0x080c, 0x0f7c, 0x8906, 0x8006, 0x8007,
-	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b,
-	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x4af1, 0x81ff, 0x1904,
-	0x354f, 0x080c, 0x4abc, 0x0904, 0x3552, 0x080c, 0x6772, 0x0904,
-	0x354f, 0x0058, 0xa878, 0x9005, 0x0120, 0x2009, 0x0004, 0x0804,
-	0x354f, 0xa974, 0xaa94, 0x0804, 0x351d, 0x080c, 0x56d8, 0x0904,
-	0x351d, 0x701f, 0x4512, 0x7007, 0x0003, 0x0005, 0x81ff, 0x1904,
-	0x354f, 0x7888, 0x908a, 0x1000, 0x1a04, 0x3552, 0x080c, 0x4ad8,
-	0x0904, 0x3552, 0x080c, 0x696a, 0x0120, 0x080c, 0x6972, 0x1904,
-	0x3552, 0x080c, 0x67f7, 0x0904, 0x354f, 0x2019, 0x0004, 0x900e,
-	0x080c, 0x6784, 0x0904, 0x354f, 0x7984, 0x7a88, 0x04c9, 0x08a8,
-	0xa89c, 0x908a, 0x1000, 0x12f8, 0x080c, 0x4ad6, 0x01e0, 0x080c,
-	0x696a, 0x0118, 0x080c, 0x6972, 0x11b0, 0x080c, 0x67f7, 0x2009,
-	0x0002, 0x0168, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x6784,
-	0x2009, 0x0003, 0x0120, 0xa998, 0xaa9c, 0x00d1, 0x0060, 0xa897,
-	0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001,
-	0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x080c, 0x56d8, 0x0110,
+	0x4169, 0x1d68, 0x2900, 0xa85a, 0x00d0, 0x080c, 0x4aa4, 0xa813,
+	0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004,
+	0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004,
+	0x9084, 0xfff8, 0xa86e, 0x2001, 0x002b, 0x2004, 0xa872, 0x2061,
+	0x0090, 0x2079, 0x0100, 0x2001, 0x19a9, 0x2004, 0x6036, 0x2009,
+	0x0040, 0x080c, 0x23d2, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
+	0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e,
+	0x78ca, 0x9006, 0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee, 0x00fe,
+	0x0005, 0x00e6, 0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0, 0x20e1,
+	0x0000, 0x2099, 0x0088, 0x702b, 0x0026, 0x7402, 0x7306, 0x9006,
+	0x700a, 0x700e, 0x810b, 0x810b, 0x21a8, 0x810b, 0x7112, 0x702b,
+	0x0041, 0x702c, 0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b, 0x0040,
+	0x4005, 0x7400, 0x7304, 0x87ff, 0x0190, 0x0086, 0x0096, 0x2940,
+	0x0086, 0x080c, 0x4aa4, 0x008e, 0xa058, 0x00a6, 0x2050, 0x2900,
+	0xb006, 0xa05a, 0x00ae, 0x009e, 0x008e, 0x9085, 0x0001, 0x00ee,
+	0x0005, 0x00e6, 0x2001, 0x002d, 0x2004, 0x9005, 0x0528, 0x2038,
+	0x2001, 0x0030, 0x2024, 0x2001, 0x0031, 0x201c, 0x080c, 0x4aa4,
+	0x2940, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007,
+	0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096,
+	0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x4169,
+	0x1d68, 0x2900, 0xa85a, 0x00d8, 0x080c, 0x4aa4, 0x2940, 0xa013,
+	0x0019, 0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004,
+	0xa066, 0x2001, 0x0031, 0x2004, 0xa06a, 0x2001, 0x002a, 0x2004,
+	0x9084, 0xfff8, 0xa06e, 0x2001, 0x002b, 0x2004, 0xa072, 0x2001,
+	0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001, 0x0101,
+	0x200c, 0x918d, 0x0200, 0x2102, 0xa017, 0x0000, 0x2001, 0x1a62,
+	0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x2001, 0x0300,
+	0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004,
+	0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091,
+	0x8000, 0x20a9, 0x0007, 0x20a1, 0x1840, 0x20e9, 0x0001, 0x9006,
+	0x4004, 0x20a9, 0x000c, 0x20a1, 0xfff4, 0x20e9, 0x0000, 0x9006,
+	0x4004, 0x2009, 0x013c, 0x200a, 0x012e, 0x7880, 0x9086, 0x0052,
+	0x0108, 0x0005, 0x0804, 0x3524, 0x7d98, 0x7c9c, 0x0804, 0x361b,
+	0x080c, 0x73bc, 0x190c, 0x5fdf, 0x6040, 0x9084, 0x0020, 0x09b1,
+	0x2069, 0x1847, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c,
+	0x7d98, 0x2039, 0x0001, 0x080c, 0x4aed, 0x701f, 0x4248, 0x0005,
+	0x080c, 0x56de, 0x1130, 0x3b00, 0x3a08, 0xc194, 0xc095, 0x20d8,
+	0x21d0, 0x2069, 0x1847, 0x6800, 0x9005, 0x0904, 0x3559, 0x6804,
+	0xd0ac, 0x0118, 0xd0a4, 0x0904, 0x3559, 0xd094, 0x00c6, 0x2061,
+	0x0100, 0x6104, 0x0138, 0x6200, 0x9292, 0x0005, 0x0218, 0x918c,
+	0xffdf, 0x0010, 0x918d, 0x0020, 0x6106, 0x00ce, 0xd08c, 0x00c6,
+	0x2061, 0x0100, 0x6104, 0x0118, 0x918d, 0x0010, 0x0010, 0x918c,
+	0xffef, 0x6106, 0x00ce, 0xd084, 0x0158, 0x6a28, 0x928a, 0x007f,
+	0x1a04, 0x3559, 0x9288, 0x3325, 0x210d, 0x918c, 0x00ff, 0x6166,
+	0xd0dc, 0x0130, 0x6828, 0x908a, 0x007f, 0x1a04, 0x3559, 0x605e,
+	0x6888, 0x9084, 0x0030, 0x8004, 0x8004, 0x8004, 0x8004, 0x0006,
+	0x2009, 0x19b1, 0x9080, 0x297a, 0x2005, 0x200a, 0x000e, 0x2009,
+	0x19b2, 0x9080, 0x297e, 0x2005, 0x200a, 0x6808, 0x908a, 0x0100,
+	0x0a04, 0x3559, 0x908a, 0x0841, 0x1a04, 0x3559, 0x9084, 0x0007,
+	0x1904, 0x3559, 0x680c, 0x9005, 0x0904, 0x3559, 0x6810, 0x9005,
+	0x0904, 0x3559, 0x6848, 0x6940, 0x910a, 0x1a04, 0x3559, 0x8001,
+	0x0904, 0x3559, 0x684c, 0x6944, 0x910a, 0x1a04, 0x3559, 0x8001,
+	0x0904, 0x3559, 0x2009, 0x1981, 0x200b, 0x0000, 0x2001, 0x1869,
+	0x2004, 0xd0c4, 0x0140, 0x7884, 0x200a, 0x2009, 0x017f, 0x200a,
+	0x3b00, 0xc085, 0x20d8, 0x6814, 0x908c, 0x00ff, 0x614e, 0x8007,
+	0x9084, 0x00ff, 0x6052, 0x080c, 0x76d5, 0x080c, 0x69a8, 0x080c,
+	0x69dc, 0x6808, 0x602a, 0x080c, 0x2344, 0x2009, 0x0170, 0x200b,
+	0x0080, 0xa001, 0xa001, 0x200b, 0x0000, 0x0036, 0x6b08, 0x080c,
+	0x28e1, 0x003e, 0x6000, 0x9086, 0x0000, 0x1904, 0x43df, 0x6818,
+	0x691c, 0x6a20, 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f, 0x6016,
+	0x611a, 0x621e, 0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830, 0x6934,
+	0x6a38, 0x6b3c, 0x8007, 0x810f, 0x8217, 0x831f, 0x0010, 0x9084,
+	0xf0ff, 0x6006, 0x610a, 0x620e, 0x6312, 0x8007, 0x810f, 0x8217,
+	0x831f, 0x20a9, 0x0004, 0x20a1, 0x19b3, 0x20e9, 0x0001, 0x4001,
+	0x20a9, 0x0004, 0x20a1, 0x19cd, 0x20e9, 0x0001, 0x4001, 0x080c,
+	0x85ef, 0x00c6, 0x900e, 0x20a9, 0x0001, 0x6b70, 0xd384, 0x0510,
+	0x0068, 0x2009, 0x0100, 0x210c, 0x918e, 0x0008, 0x1110, 0x839d,
+	0x0010, 0x83f5, 0x3e18, 0x12b0, 0x3508, 0x8109, 0x080c, 0x7c8b,
+	0x6878, 0x6016, 0x6874, 0x2008, 0x9084, 0xff00, 0x8007, 0x600a,
+	0x9184, 0x00ff, 0x6006, 0x8108, 0x1118, 0x6003, 0x0003, 0x0010,
+	0x6003, 0x0001, 0x1f04, 0x4339, 0x00ce, 0x00c6, 0x2061, 0x199c,
+	0x6a88, 0x9284, 0xc000, 0x2010, 0x9286, 0x0000, 0x1158, 0x2063,
+	0x0000, 0x2001, 0x0001, 0x080c, 0x2b88, 0x2001, 0x0001, 0x080c,
+	0x2b6b, 0x0088, 0x9286, 0x4000, 0x1148, 0x2063, 0x0001, 0x9006,
+	0x080c, 0x2b88, 0x9006, 0x080c, 0x2b6b, 0x0028, 0x9286, 0x8000,
+	0x1d30, 0x2063, 0x0002, 0x00ce, 0x6888, 0xd0ec, 0x0130, 0x2011,
+	0x0114, 0x2204, 0x9085, 0x0100, 0x2012, 0x6a80, 0x9284, 0x0030,
+	0x9086, 0x0030, 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82,
+	0x2001, 0x197c, 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000, 0x0170,
+	0x928e, 0x0010, 0x0118, 0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa,
+	0x080c, 0x2956, 0x2001, 0x196d, 0x2102, 0x0008, 0x2102, 0x00c6,
+	0x2061, 0x0100, 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c,
+	0x73bc, 0x0128, 0x080c, 0x4fdb, 0x0110, 0x080c, 0x28a7, 0x60d4,
+	0x9005, 0x01c0, 0x6003, 0x0001, 0x2009, 0x43c7, 0x00e0, 0x080c,
+	0x73bc, 0x1168, 0x2011, 0x7252, 0x080c, 0x84f3, 0x2011, 0x7245,
+	0x080c, 0x85cd, 0x080c, 0x76a9, 0x080c, 0x72ee, 0x0040, 0x080c,
+	0x5ed9, 0x0028, 0x6003, 0x0004, 0x2009, 0x43df, 0x0020, 0x080c,
+	0x68d4, 0x0804, 0x3524, 0x2001, 0x0170, 0x2004, 0x9084, 0x00ff,
+	0x9086, 0x004c, 0x1118, 0x2091, 0x30bd, 0x0817, 0x2091, 0x303d,
+	0x0817, 0x6000, 0x9086, 0x0000, 0x0904, 0x3556, 0x2069, 0x1847,
+	0x7890, 0x6842, 0x7894, 0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c,
+	0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x0804, 0x4af0, 0x9006,
+	0x080c, 0x28a7, 0x81ff, 0x1904, 0x3556, 0x080c, 0x73bc, 0x11b0,
+	0x080c, 0x76a4, 0x080c, 0x601a, 0x080c, 0x3319, 0x0118, 0x6130,
+	0xc18d, 0x6132, 0x080c, 0xd230, 0x0130, 0x080c, 0x73df, 0x1118,
+	0x080c, 0x7394, 0x0038, 0x080c, 0x72ee, 0x0020, 0x080c, 0x5fdf,
+	0x080c, 0x5ed9, 0x0804, 0x3524, 0x81ff, 0x1904, 0x3556, 0x080c,
+	0x73bc, 0x1110, 0x0804, 0x3556, 0x6194, 0x81ff, 0x01a8, 0x704f,
+	0x0000, 0x2001, 0x1c80, 0x2009, 0x0040, 0x7a8c, 0x7b88, 0x7c9c,
+	0x7d98, 0x0126, 0x2091, 0x8000, 0x2039, 0x0001, 0x080c, 0x4af0,
+	0x701f, 0x3522, 0x012e, 0x0005, 0x704f, 0x0001, 0x00d6, 0x2069,
+	0x1c80, 0x20a9, 0x0040, 0x20e9, 0x0001, 0x20a1, 0x1c80, 0x2019,
+	0xffff, 0x4304, 0x655c, 0x9588, 0x3325, 0x210d, 0x918c, 0x00ff,
+	0x216a, 0x900e, 0x2011, 0x0002, 0x2100, 0x9506, 0x01a8, 0x080c,
+	0x65ff, 0x1190, 0xb814, 0x821c, 0x0238, 0x9398, 0x1c80, 0x9085,
+	0xff00, 0x8007, 0x201a, 0x0038, 0x9398, 0x1c80, 0x2324, 0x94a4,
+	0xff00, 0x9405, 0x201a, 0x8210, 0x8108, 0x9182, 0x0080, 0x1208,
+	0x0c18, 0x8201, 0x8007, 0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9,
+	0x0040, 0x20a1, 0x1c80, 0x2099, 0x1c80, 0x080c, 0x5f6a, 0x0804,
+	0x4439, 0x080c, 0x4ad7, 0x0904, 0x3559, 0x080c, 0x4aa4, 0x1120,
+	0x2009, 0x0002, 0x0804, 0x3556, 0x080c, 0x56cf, 0xd0b4, 0x0558,
+	0x7884, 0x908e, 0x007e, 0x0538, 0x908e, 0x007f, 0x0520, 0x908e,
+	0x0080, 0x0508, 0x080c, 0x3314, 0x1148, 0xb800, 0xd08c, 0x11d8,
+	0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x11a8, 0xa867, 0x0000,
+	0xa868, 0xc0fd, 0xa86a, 0x080c, 0xccfe, 0x1120, 0x2009, 0x0003,
+	0x0804, 0x3556, 0x7007, 0x0003, 0x701f, 0x44c7, 0x0005, 0x080c,
+	0x4ad7, 0x0904, 0x3559, 0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8,
+	0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003,
+	0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8,
+	0x9080, 0x0006, 0x2098, 0x080c, 0x0f7c, 0x0070, 0x20a9, 0x0004,
+	0xa85c, 0x9080, 0x000a, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
+	0x000a, 0x2098, 0x080c, 0x0f7c, 0x8906, 0x8006, 0x8007, 0x90bc,
+	0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c,
+	0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x4af0, 0x81ff, 0x1904, 0x3556,
+	0x080c, 0x4abb, 0x0904, 0x3559, 0x080c, 0x6771, 0x0904, 0x3556,
+	0x0058, 0xa878, 0x9005, 0x0120, 0x2009, 0x0004, 0x0804, 0x3556,
+	0xa974, 0xaa94, 0x0804, 0x3524, 0x080c, 0x56d7, 0x0904, 0x3524,
+	0x701f, 0x4511, 0x7007, 0x0003, 0x0005, 0x81ff, 0x1904, 0x3556,
+	0x7888, 0x908a, 0x1000, 0x1a04, 0x3559, 0x080c, 0x4ad7, 0x0904,
+	0x3559, 0x080c, 0x6972, 0x0120, 0x080c, 0x697a, 0x1904, 0x3559,
+	0x080c, 0x67f6, 0x0904, 0x3556, 0x2019, 0x0004, 0x900e, 0x080c,
+	0x6783, 0x0904, 0x3556, 0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c,
+	0x908a, 0x1000, 0x12f8, 0x080c, 0x4ad5, 0x01e0, 0x080c, 0x6972,
+	0x0118, 0x080c, 0x697a, 0x11b0, 0x080c, 0x67f6, 0x2009, 0x0002,
+	0x0168, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x6783, 0x2009,
+	0x0003, 0x0120, 0xa998, 0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005,
+	0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
+	0x0030, 0x0005, 0xa897, 0x4000, 0x080c, 0x56d7, 0x0110, 0x9006,
+	0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x9186,
+	0x00ff, 0x0110, 0x0071, 0x0060, 0x2029, 0x007e, 0x2061, 0x1800,
+	0x645c, 0x2400, 0x9506, 0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8,
+	0x0005, 0x080c, 0x65ff, 0x1138, 0x2200, 0x8003, 0x800b, 0x810b,
+	0x9108, 0x080c, 0x8501, 0x0005, 0x81ff, 0x1904, 0x3556, 0x798c,
+	0x2001, 0x1980, 0x918c, 0x8000, 0x2102, 0x080c, 0x4abb, 0x0904,
+	0x3559, 0x080c, 0x6972, 0x0120, 0x080c, 0x697a, 0x1904, 0x3559,
+	0x080c, 0x66c6, 0x0904, 0x3556, 0x080c, 0x677a, 0x0904, 0x3556,
+	0x2001, 0x1980, 0x2004, 0xd0fc, 0x1904, 0x3524, 0x0804, 0x451c,
+	0xa9a0, 0x2001, 0x1980, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c,
+	0x4ac8, 0x01a0, 0x080c, 0x6972, 0x0118, 0x080c, 0x697a, 0x1170,
+	0x080c, 0x66c6, 0x2009, 0x0002, 0x0128, 0x080c, 0x677a, 0x1170,
+	0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
+	0x2001, 0x1980, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x56d7, 0x0110,
 	0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005,
-	0x9186, 0x00ff, 0x0110, 0x0071, 0x0060, 0x2029, 0x007e, 0x2061,
-	0x1800, 0x645c, 0x2400, 0x9506, 0x0110, 0x2508, 0x0019, 0x8529,
-	0x1ec8, 0x0005, 0x080c, 0x6600, 0x1138, 0x2200, 0x8003, 0x800b,
-	0x810b, 0x9108, 0x080c, 0x84d8, 0x0005, 0x81ff, 0x1904, 0x354f,
-	0x798c, 0x2001, 0x1980, 0x918c, 0x8000, 0x2102, 0x080c, 0x4abc,
-	0x0904, 0x3552, 0x080c, 0x696a, 0x0120, 0x080c, 0x6972, 0x1904,
-	0x3552, 0x080c, 0x66c7, 0x0904, 0x354f, 0x080c, 0x677b, 0x0904,
-	0x354f, 0x2001, 0x1980, 0x2004, 0xd0fc, 0x1904, 0x351d, 0x0804,
-	0x451d, 0xa9a0, 0x2001, 0x1980, 0x918c, 0x8000, 0xc18d, 0x2102,
-	0x080c, 0x4ac9, 0x01a0, 0x080c, 0x696a, 0x0118, 0x080c, 0x6972,
-	0x1170, 0x080c, 0x66c7, 0x2009, 0x0002, 0x0128, 0x080c, 0x677b,
-	0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
-	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
-	0x4000, 0x2001, 0x1980, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x56d8,
-	0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000,
-	0x0005, 0x81ff, 0x1904, 0x354f, 0x798c, 0x2001, 0x197f, 0x918c,
-	0x8000, 0x2102, 0x080c, 0x4abc, 0x0904, 0x3552, 0x080c, 0x696a,
-	0x0120, 0x080c, 0x6972, 0x1904, 0x3552, 0x080c, 0x66c7, 0x0904,
-	0x354f, 0x080c, 0x6769, 0x0904, 0x354f, 0x2001, 0x197f, 0x2004,
-	0xd0fc, 0x1904, 0x351d, 0x0804, 0x451d, 0xa9a0, 0x2001, 0x197f,
-	0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4ac9, 0x01a0, 0x080c,
-	0x696a, 0x0118, 0x080c, 0x6972, 0x1170, 0x080c, 0x66c7, 0x2009,
-	0x0002, 0x0128, 0x080c, 0x6769, 0x1170, 0x2009, 0x0003, 0xa897,
-	0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001,
-	0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x197f, 0x2004,
-	0xd0fc, 0x1128, 0x080c, 0x56d8, 0x0110, 0x9006, 0x0018, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x6100, 0x0804, 0x351d,
-	0x080c, 0x4ad8, 0x0904, 0x3552, 0x080c, 0x56e4, 0x1904, 0x354f,
-	0x79a8, 0xd184, 0x1158, 0xb834, 0x8007, 0x789e, 0xb830, 0x8007,
-	0x789a, 0xbb2c, 0x831f, 0xba28, 0x8217, 0x0050, 0xb824, 0x8007,
-	0x789e, 0xb820, 0x8007, 0x789a, 0xbb1c, 0x831f, 0xba18, 0x8217,
-	0xb900, 0x918c, 0x0200, 0x0804, 0x351d, 0x78a8, 0x909c, 0x0003,
-	0xd0b4, 0x1148, 0x939a, 0x0003, 0x1a04, 0x354f, 0x625c, 0x7884,
-	0x9206, 0x1904, 0x46ca, 0x080c, 0x85b0, 0x2001, 0xfff4, 0x2009,
-	0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0000, 0x0006,
-	0x78a8, 0x9084, 0x0080, 0x11c8, 0x0006, 0x0036, 0x2001, 0x1a7f,
-	0x201c, 0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a80, 0x201c, 0x7b9e,
-	0x2003, 0x0000, 0x2001, 0x1a81, 0x201c, 0x7ba2, 0x2003, 0x0000,
-	0x003e, 0x000e, 0x000e, 0x0804, 0x4af1, 0x000e, 0x2031, 0x0000,
-	0x2061, 0x18b8, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e,
-	0xa392, 0xa496, 0xa59a, 0x080c, 0x10e9, 0x7007, 0x0002, 0x701f,
-	0x46ea, 0x0005, 0x81ff, 0x1904, 0x354f, 0x080c, 0x4ad8, 0x0904,
-	0x3552, 0x080c, 0x696a, 0x1904, 0x354f, 0x00c6, 0x080c, 0x4aa5,
-	0x00ce, 0x0904, 0x354f, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
-	0x7ea8, 0x080c, 0xcc8a, 0x0904, 0x354f, 0x7007, 0x0003, 0x701f,
-	0x4704, 0x0005, 0x080c, 0x4207, 0x0006, 0x0036, 0x2001, 0x1a7f,
-	0x201c, 0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a80, 0x201c, 0x7b9e,
-	0x2003, 0x0000, 0x2001, 0x1a81, 0x201c, 0x7ba2, 0x2003, 0x0000,
-	0x003e, 0x000e, 0x0804, 0x351d, 0xa830, 0x9086, 0x0100, 0x0904,
-	0x354f, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-	0x9080, 0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0x0804, 0x4af1, 0x9006, 0x080c, 0x28a7, 0x78a8, 0x9084, 0x00ff,
-	0x9086, 0x00ff, 0x0118, 0x81ff, 0x1904, 0x354f, 0x080c, 0x73b0,
-	0x0110, 0x080c, 0x5fe0, 0x7888, 0x908a, 0x1000, 0x1a04, 0x3552,
-	0x7984, 0x9186, 0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04, 0x3552,
-	0x2100, 0x080c, 0x2871, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x2061, 0x19fa, 0x601b, 0x0000, 0x601f, 0x0000, 0x6073, 0x0000,
-	0x6077, 0x0000, 0x080c, 0x73b0, 0x1158, 0x080c, 0x7698, 0x080c,
-	0x601b, 0x9085, 0x0001, 0x080c, 0x73f7, 0x080c, 0x72e2, 0x00d0,
-	0x080c, 0xadb8, 0x2061, 0x0100, 0x2001, 0x1818, 0x2004, 0x9084,
-	0x00ff, 0x810f, 0x9105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010,
-	0x2009, 0x1999, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5f06,
-	0x080c, 0x8562, 0x7984, 0x080c, 0x73b0, 0x1110, 0x2009, 0x00ff,
-	0x7a88, 0x080c, 0x4580, 0x012e, 0x00ce, 0x002e, 0x0804, 0x351d,
-	0x7984, 0x080c, 0x659f, 0x2b08, 0x1904, 0x3552, 0x0804, 0x351d,
-	0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x354f, 0x60dc, 0xd0ac,
-	0x1130, 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x354f, 0x080c,
-	0x4aa5, 0x1120, 0x2009, 0x0002, 0x0804, 0x354f, 0x7984, 0x9192,
-	0x0021, 0x1a04, 0x3552, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c,
-	0x9080, 0x0019, 0x702a, 0xaf60, 0x7736, 0x080c, 0x4aee, 0x701f,
-	0x47b8, 0x7880, 0x9086, 0x006e, 0x0110, 0x701f, 0x518e, 0x0005,
-	0x2009, 0x0080, 0x080c, 0x6600, 0x1118, 0x080c, 0x696a, 0x0120,
-	0x2021, 0x400a, 0x0804, 0x351f, 0x00d6, 0x0096, 0xa964, 0xaa6c,
-	0xab70, 0xac74, 0xad78, 0xae7c, 0xa884, 0x90be, 0x0100, 0x0904,
-	0x4851, 0x90be, 0x0112, 0x0904, 0x4851, 0x90be, 0x0113, 0x0904,
-	0x4851, 0x90be, 0x0114, 0x0904, 0x4851, 0x90be, 0x0117, 0x0904,
-	0x4851, 0x90be, 0x011a, 0x0904, 0x4851, 0x90be, 0x011c, 0x0904,
-	0x4851, 0x90be, 0x0121, 0x0904, 0x4838, 0x90be, 0x0131, 0x0904,
-	0x4838, 0x90be, 0x0171, 0x0904, 0x4851, 0x90be, 0x0173, 0x0904,
-	0x4851, 0x90be, 0x01a1, 0x1128, 0xa894, 0x8007, 0xa896, 0x0804,
-	0x485c, 0x90be, 0x0212, 0x0904, 0x4845, 0x90be, 0x0213, 0x05e8,
-	0x90be, 0x0214, 0x0500, 0x90be, 0x0217, 0x0188, 0x90be, 0x021a,
-	0x1120, 0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be, 0x021f, 0x05c8,
-	0x90be, 0x0300, 0x05b0, 0x009e, 0x00de, 0x0804, 0x3552, 0x7028,
-	0x9080, 0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9,
-	0x0007, 0x080c, 0x489a, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0,
-	0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x489a, 0x00c8,
-	0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8,
-	0x20a9, 0x0001, 0x080c, 0x48a7, 0x00b8, 0x7028, 0x9080, 0x000e,
-	0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c,
-	0x48a7, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0,
-	0x20e8, 0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c, 0x4aa5, 0x0550,
-	0xa868, 0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006, 0xa882, 0xa87f,
-	0x0020, 0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2, 0xaab6, 0xabba,
-	0xacbe, 0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e, 0x00de, 0xa866,
-	0xa822, 0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048, 0x080c, 0xcca5,
-	0x1120, 0x2009, 0x0003, 0x0804, 0x354f, 0x7007, 0x0003, 0x701f,
-	0x4891, 0x0005, 0x00ce, 0x009e, 0x00de, 0x2009, 0x0002, 0x0804,
-	0x354f, 0xa820, 0x9086, 0x8001, 0x1904, 0x351d, 0x2009, 0x0004,
-	0x0804, 0x354f, 0x0016, 0x0026, 0x3510, 0x20a9, 0x0002, 0x4002,
-	0x4104, 0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e, 0x0005, 0x0016,
-	0x0026, 0x0036, 0x0046, 0x3520, 0x20a9, 0x0004, 0x4002, 0x4304,
-	0x4204, 0x4104, 0x4004, 0x8421, 0x1db8, 0x004e, 0x003e, 0x002e,
-	0x001e, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x354f,
-	0x60dc, 0xd0ac, 0x1130, 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804,
-	0x354f, 0x7984, 0x78a8, 0x2040, 0x080c, 0xadb1, 0x1120, 0x9182,
-	0x007f, 0x0a04, 0x3552, 0x9186, 0x00ff, 0x0904, 0x3552, 0x9182,
-	0x0800, 0x1a04, 0x3552, 0x7a8c, 0x7b88, 0x607c, 0x9306, 0x1140,
-	0x6080, 0x924e, 0x0904, 0x3552, 0x99cc, 0xff00, 0x0904, 0x3552,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x49b8, 0x0904, 0x4938, 0x0086,
-	0x90c6, 0x4000, 0x008e, 0x1538, 0x00c6, 0x0006, 0x0036, 0xb818,
-	0xbb1c, 0x9305, 0xbb20, 0x9305, 0xbb24, 0x9305, 0xbb28, 0x9305,
-	0xbb2c, 0x9305, 0xbb30, 0x9305, 0xbb34, 0x9305, 0x003e, 0x0570,
-	0xd88c, 0x1128, 0x080c, 0x696a, 0x0110, 0xc89d, 0x0438, 0x900e,
-	0x080c, 0x6820, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
-	0x000e, 0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x0090,
-	0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0060, 0x90c6, 0x4009,
-	0x1108, 0x0040, 0x90c6, 0x4006, 0x1108, 0x0020, 0x2001, 0x4005,
-	0x2009, 0x000a, 0x2020, 0x012e, 0x0804, 0x351f, 0x000e, 0x00ce,
-	0x2b00, 0x7026, 0x0016, 0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c,
-	0xae95, 0x0904, 0x498d, 0x2b00, 0x6012, 0x080c, 0xcf90, 0x2e58,
-	0x00ee, 0x00e6, 0x00c6, 0x080c, 0x4aa5, 0x00ce, 0x2b70, 0x1158,
-	0x080c, 0xae47, 0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x2009,
-	0x0002, 0x0804, 0x354f, 0x900e, 0xa966, 0xa96a, 0x2900, 0x6016,
-	0xa932, 0xa868, 0xc0fd, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0xd89c,
-	0x1110, 0x080c, 0x31bc, 0x6023, 0x0001, 0x9006, 0x080c, 0x653c,
-	0xd89c, 0x0138, 0x2001, 0x0004, 0x080c, 0x6550, 0x2009, 0x0003,
-	0x0030, 0x2001, 0x0002, 0x080c, 0x6550, 0x2009, 0x0002, 0x080c,
-	0xaec2, 0x78a8, 0xd094, 0x0138, 0x00ee, 0x7024, 0x00e6, 0x2058,
-	0xb8cc, 0xc08d, 0xb8ce, 0x9085, 0x0001, 0x00ee, 0x00ce, 0x00be,
-	0x001e, 0x012e, 0x1120, 0x2009, 0x0003, 0x0804, 0x354f, 0x7007,
-	0x0003, 0x701f, 0x499c, 0x0005, 0xa830, 0x9086, 0x0100, 0x7024,
-	0x2058, 0x1138, 0x2009, 0x0004, 0xba04, 0x9294, 0x00ff, 0x0804,
-	0x562d, 0x900e, 0xa868, 0xd0f4, 0x1904, 0x351d, 0x080c, 0x6820,
-	0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x351d,
-	0x00e6, 0x00d6, 0x0096, 0x83ff, 0x0904, 0x4a07, 0x902e, 0x080c,
-	0xadb1, 0x0130, 0x9026, 0x20a9, 0x0800, 0x2071, 0x1000, 0x0030,
-	0x2021, 0x007f, 0x20a9, 0x0781, 0x2071, 0x107f, 0x2e04, 0x9005,
-	0x11b8, 0x2100, 0x9406, 0x1904, 0x4a18, 0x2428, 0x94ce, 0x007f,
-	0x1120, 0x92ce, 0xfffd, 0x1558, 0x0030, 0x94ce, 0x0080, 0x1130,
-	0x92ce, 0xfffc, 0x1520, 0x93ce, 0x00ff, 0x1508, 0xc5fd, 0x0480,
-	0x2058, 0xbf10, 0x2700, 0x9306, 0x11e8, 0xbe14, 0x2600, 0x9206,
-	0x11c8, 0x2400, 0x9106, 0x1180, 0xd884, 0x0598, 0xd894, 0x1588,
-	0x080c, 0x690a, 0x1570, 0x2001, 0x4000, 0x0460, 0x080c, 0x696a,
-	0x1540, 0x2001, 0x4000, 0x0430, 0x2001, 0x4007, 0x0418, 0x2001,
-	0x4006, 0x0400, 0x2400, 0x9106, 0x1158, 0xbe14, 0x87ff, 0x1128,
-	0x86ff, 0x0918, 0x080c, 0xadb1, 0x1900, 0x2001, 0x4008, 0x0090,
-	0x8420, 0x8e70, 0x1f04, 0x49ce, 0x85ff, 0x1130, 0x2001, 0x4009,
-	0x0048, 0x2001, 0x0001, 0x0030, 0x080c, 0x659f, 0x1dd0, 0xbb12,
-	0xba16, 0x9006, 0x9005, 0x009e, 0x00de, 0x00ee, 0x0005, 0x81ff,
-	0x0120, 0x2009, 0x0001, 0x0804, 0x354f, 0x080c, 0x4aa5, 0x1120,
-	0x2009, 0x0002, 0x0804, 0x354f, 0xa867, 0x0000, 0xa868, 0xc0fd,
-	0xa86a, 0x7884, 0x9005, 0x0904, 0x3552, 0x9096, 0x00ff, 0x0120,
-	0x9092, 0x0004, 0x1a04, 0x3552, 0x2010, 0x2918, 0x080c, 0x3162,
-	0x1120, 0x2009, 0x0003, 0x0804, 0x354f, 0x7007, 0x0003, 0x701f,
-	0x4a5a, 0x0005, 0xa830, 0x9086, 0x0100, 0x1904, 0x351d, 0x2009,
-	0x0004, 0x0804, 0x354f, 0x7984, 0x080c, 0xadb1, 0x1120, 0x9182,
-	0x007f, 0x0a04, 0x3552, 0x9186, 0x00ff, 0x0904, 0x3552, 0x9182,
-	0x0800, 0x1a04, 0x3552, 0x2001, 0x9000, 0x080c, 0x5688, 0x1904,
-	0x354f, 0x0804, 0x351d, 0xa998, 0x080c, 0xadb1, 0x1118, 0x9182,
-	0x007f, 0x0280, 0x9186, 0x00ff, 0x0168, 0x9182, 0x0800, 0x1250,
-	0x2001, 0x9000, 0x080c, 0x5688, 0x11a8, 0x0060, 0xa897, 0x4005,
+	0x81ff, 0x1904, 0x3556, 0x798c, 0x2001, 0x197f, 0x918c, 0x8000,
+	0x2102, 0x080c, 0x4abb, 0x0904, 0x3559, 0x080c, 0x6972, 0x0120,
+	0x080c, 0x697a, 0x1904, 0x3559, 0x080c, 0x66c6, 0x0904, 0x3556,
+	0x080c, 0x6768, 0x0904, 0x3556, 0x2001, 0x197f, 0x2004, 0xd0fc,
+	0x1904, 0x3524, 0x0804, 0x451c, 0xa9a0, 0x2001, 0x197f, 0x918c,
+	0x8000, 0xc18d, 0x2102, 0x080c, 0x4ac8, 0x01a0, 0x080c, 0x6972,
+	0x0118, 0x080c, 0x697a, 0x1170, 0x080c, 0x66c6, 0x2009, 0x0002,
+	0x0128, 0x080c, 0x6768, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005,
 	0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
-	0x0030, 0x0005, 0xa897, 0x4000, 0x900e, 0x9085, 0x0001, 0x2001,
-	0x0000, 0x0005, 0x2009, 0x000a, 0x0c48, 0x080c, 0x0fff, 0x0198,
-	0x9006, 0xa802, 0x7014, 0x9005, 0x1120, 0x2900, 0x7016, 0x701a,
-	0x0040, 0x7018, 0xa802, 0x0086, 0x2040, 0x2900, 0xa006, 0x701a,
-	0x008e, 0x9085, 0x0001, 0x0005, 0x7984, 0x080c, 0x6600, 0x1130,
-	0x7e88, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e, 0x8bff,
-	0x0005, 0xa998, 0x080c, 0x6600, 0x1130, 0xae9c, 0x9684, 0x3fff,
-	0x9082, 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005, 0xae98, 0x0008,
-	0x7e84, 0x2608, 0x080c, 0x6600, 0x1108, 0x0008, 0x905e, 0x8bff,
-	0x0005, 0x0016, 0x7114, 0x81ff, 0x0128, 0x2148, 0xa904, 0x080c,
-	0x1031, 0x0cc8, 0x7116, 0x711a, 0x001e, 0x0005, 0x2031, 0x0001,
-	0x0010, 0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44, 0xa66a, 0xa17a,
-	0xa772, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x10e9,
-	0x7007, 0x0002, 0x701f, 0x351d, 0x0005, 0x00f6, 0x0126, 0x2091,
-	0x8000, 0x2079, 0x0000, 0x2001, 0x18b0, 0x2004, 0x9005, 0x1190,
-	0x0e04, 0x4b22, 0x7a36, 0x7833, 0x0012, 0x7a82, 0x7b86, 0x7c8a,
-	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b,
-	0x0804, 0x4b88, 0x0016, 0x0086, 0x0096, 0x00c6, 0x00e6, 0x2071,
-	0x189e, 0x7044, 0x9005, 0x1540, 0x7148, 0x9182, 0x0010, 0x0288,
-	0x7038, 0x2060, 0x080c, 0x0fff, 0x0904, 0x4b80, 0xa84b, 0x0000,
-	0x2900, 0x7046, 0x2001, 0x0002, 0x9080, 0x2090, 0x2005, 0xa846,
-	0x0098, 0x7038, 0x90e0, 0x0004, 0x2001, 0x18ba, 0x9c82, 0x18fa,
-	0x0210, 0x2061, 0x18ba, 0x2c00, 0x703a, 0x7148, 0x81ff, 0x1108,
-	0x703e, 0x8108, 0x714a, 0x0460, 0x7148, 0x8108, 0x714a, 0x7044,
-	0x2040, 0xa144, 0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0dd5,
-	0x2060, 0x001e, 0x8108, 0x2105, 0x9005, 0xa146, 0x1520, 0x080c,
-	0x0fff, 0x1130, 0x8109, 0xa946, 0x7148, 0x8109, 0x714a, 0x00d8,
-	0x9006, 0xa806, 0xa84a, 0xa046, 0x2800, 0xa802, 0x2900, 0xa006,
-	0x7046, 0x2001, 0x0002, 0x9080, 0x2090, 0x2005, 0xa846, 0x0058,
-	0x2262, 0x6306, 0x640a, 0x00ee, 0x00ce, 0x009e, 0x008e, 0x001e,
-	0x012e, 0x00fe, 0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4baa,
-	0x4baa, 0x4bac, 0x4baa, 0x4baa, 0x4baa, 0x4bb0, 0x4baa, 0x4baa,
-	0x4baa, 0x4bb4, 0x4baa, 0x4baa, 0x4baa, 0x4bb8, 0x4baa, 0x4baa,
-	0x4baa, 0x4bbc, 0x4baa, 0x4baa, 0x4baa, 0x4bc0, 0x4baa, 0x4baa,
-	0x4baa, 0x4bc5, 0x080c, 0x0dd5, 0xa276, 0xa37a, 0xa47e, 0x0898,
-	0xa286, 0xa38a, 0xa48e, 0x0878, 0xa296, 0xa39a, 0xa49e, 0x0858,
-	0xa2a6, 0xa3aa, 0xa4ae, 0x0838, 0xa2b6, 0xa3ba, 0xa4be, 0x0818,
-	0xa2c6, 0xa3ca, 0xa4ce, 0x0804, 0x4b83, 0xa2d6, 0xa3da, 0xa4de,
-	0x0804, 0x4b83, 0x00e6, 0x2071, 0x189e, 0x7048, 0x9005, 0x0904,
-	0x4c5c, 0x0126, 0x2091, 0x8000, 0x0e04, 0x4c5b, 0x00f6, 0x2079,
-	0x0000, 0x00c6, 0x0096, 0x0086, 0x0076, 0x9006, 0x2038, 0x7040,
-	0x2048, 0x9005, 0x0500, 0xa948, 0x2105, 0x0016, 0x908a, 0x0036,
-	0x1a0c, 0x0dd5, 0x2060, 0x001e, 0x8108, 0x2105, 0x9005, 0xa94a,
-	0x1904, 0x4c5e, 0xa804, 0x9005, 0x090c, 0x0dd5, 0x7042, 0x2938,
-	0x2040, 0xa003, 0x0000, 0x2001, 0x0002, 0x9080, 0x2090, 0x2005,
-	0xa04a, 0x0804, 0x4c5e, 0x703c, 0x2060, 0x2c14, 0x6304, 0x6408,
-	0x650c, 0x2200, 0x7836, 0x7833, 0x0012, 0x7882, 0x2300, 0x7886,
-	0x2400, 0x788a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-	0x190c, 0x119b, 0x87ff, 0x0118, 0x2748, 0x080c, 0x1031, 0x7048,
-	0x8001, 0x704a, 0x9005, 0x1170, 0x7040, 0x2048, 0x9005, 0x0128,
-	0x080c, 0x1031, 0x9006, 0x7042, 0x7046, 0x703b, 0x18ba, 0x703f,
-	0x18ba, 0x0420, 0x7040, 0x9005, 0x1508, 0x7238, 0x2c00, 0x9206,
-	0x0148, 0x9c80, 0x0004, 0x90fa, 0x18fa, 0x0210, 0x2001, 0x18ba,
-	0x703e, 0x00a0, 0x9006, 0x703e, 0x703a, 0x7044, 0x9005, 0x090c,
-	0x0dd5, 0x2048, 0xa800, 0x9005, 0x1de0, 0x2900, 0x7042, 0x2001,
-	0x0002, 0x9080, 0x2090, 0x2005, 0xa84a, 0x0000, 0x007e, 0x008e,
-	0x009e, 0x00ce, 0x00fe, 0x012e, 0x00ee, 0x0005, 0x2c00, 0x9082,
-	0x001b, 0x0002, 0x4c7d, 0x4c7d, 0x4c7f, 0x4c7d, 0x4c7d, 0x4c7d,
-	0x4c84, 0x4c7d, 0x4c7d, 0x4c7d, 0x4c89, 0x4c7d, 0x4c7d, 0x4c7d,
-	0x4c8e, 0x4c7d, 0x4c7d, 0x4c7d, 0x4c93, 0x4c7d, 0x4c7d, 0x4c7d,
-	0x4c98, 0x4c7d, 0x4c7d, 0x4c7d, 0x4c9d, 0x080c, 0x0dd5, 0xaa74,
-	0xab78, 0xac7c, 0x0804, 0x4c09, 0xaa84, 0xab88, 0xac8c, 0x0804,
-	0x4c09, 0xaa94, 0xab98, 0xac9c, 0x0804, 0x4c09, 0xaaa4, 0xaba8,
-	0xacac, 0x0804, 0x4c09, 0xaab4, 0xabb8, 0xacbc, 0x0804, 0x4c09,
-	0xaac4, 0xabc8, 0xaccc, 0x0804, 0x4c09, 0xaad4, 0xabd8, 0xacdc,
-	0x0804, 0x4c09, 0x0016, 0x0026, 0x0036, 0x00b6, 0x00c6, 0x2009,
-	0x007e, 0x080c, 0x6600, 0x2019, 0x0001, 0xb85c, 0xd0ac, 0x0110,
-	0x2019, 0x0000, 0x2011, 0x801b, 0x080c, 0x4b05, 0x00ce, 0x00be,
-	0x003e, 0x002e, 0x001e, 0x0005, 0x0026, 0x080c, 0x56d0, 0xd0c4,
-	0x0120, 0x2011, 0x8014, 0x080c, 0x4b05, 0x002e, 0x0005, 0x81ff,
-	0x1904, 0x354f, 0x0126, 0x2091, 0x8000, 0x6030, 0xc08d, 0xc085,
-	0xc0ac, 0x6032, 0x080c, 0x73b0, 0x1158, 0x080c, 0x7698, 0x080c,
-	0x601b, 0x9085, 0x0001, 0x080c, 0x73f7, 0x080c, 0x72e2, 0x0010,
-	0x080c, 0x5eda, 0x012e, 0x0804, 0x351d, 0x81ff, 0x0120, 0x2009,
-	0x0001, 0x0804, 0x354f, 0x080c, 0x56e4, 0x0120, 0x2009, 0x0007,
-	0x0804, 0x354f, 0x080c, 0x6962, 0x0120, 0x2009, 0x0008, 0x0804,
-	0x354f, 0x080c, 0x330d, 0x0128, 0x7984, 0x080c, 0x659f, 0x1904,
-	0x3552, 0x080c, 0x4ad8, 0x0904, 0x3552, 0x2b00, 0x7026, 0x080c,
-	0x696a, 0x7888, 0x1170, 0x9084, 0x0005, 0x1158, 0x900e, 0x080c,
-	0x6820, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804,
-	0x351d, 0x080c, 0x4aa5, 0x0904, 0x354f, 0x9006, 0xa866, 0xa832,
-	0xa868, 0xc0fd, 0xa86a, 0x080c, 0xcd3e, 0x0904, 0x354f, 0x7888,
-	0xd094, 0x0118, 0xb8cc, 0xc08d, 0xb8ce, 0x7007, 0x0003, 0x701f,
-	0x4d7e, 0x0005, 0x2061, 0x1800, 0x080c, 0x56e4, 0x2009, 0x0007,
-	0x1578, 0x080c, 0x6962, 0x0118, 0x2009, 0x0008, 0x0448, 0x080c,
-	0x330d, 0x0120, 0xa998, 0x080c, 0x659f, 0x1530, 0x080c, 0x4ad6,
-	0x0518, 0x080c, 0x696a, 0xa89c, 0x1168, 0x9084, 0x0005, 0x1150,
-	0x900e, 0x080c, 0x6820, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c, 0xcd3e, 0x11e0,
-	0xa89c, 0xd094, 0x0118, 0xb8cc, 0xc08d, 0xb8ce, 0x2009, 0x0003,
-	0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-	0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0xa99a, 0x9006,
-	0x918d, 0x0001, 0x2008, 0x0005, 0x9006, 0x0005, 0xa830, 0x9086,
-	0x0100, 0x7024, 0x2058, 0x1110, 0x0804, 0x562d, 0x900e, 0x080c,
-	0x6820, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804,
-	0x351d, 0x080c, 0x56e4, 0x0120, 0x2009, 0x0007, 0x0804, 0x354f,
-	0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4aa5, 0x1120,
-	0x2009, 0x0002, 0x0804, 0x354f, 0x900e, 0x2130, 0x7126, 0x7132,
-	0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005, 0x702a, 0x20a0,
-	0x080c, 0x6600, 0x1904, 0x4e20, 0x080c, 0x696a, 0x0138, 0x080c,
-	0x6972, 0x0120, 0x080c, 0x690a, 0x1904, 0x4e20, 0xd794, 0x1110,
-	0xd784, 0x01a8, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098,
-	0x3400, 0xd794, 0x0160, 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0,
-	0x3d00, 0x20e0, 0x20a9, 0x0002, 0x080c, 0x48a7, 0x0048, 0x20a9,
-	0x0004, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x48a7,
-	0x9186, 0x007e, 0x0170, 0x9186, 0x0080, 0x0158, 0x080c, 0x696a,
-	0x90c2, 0x0006, 0x1210, 0xc1fd, 0x0020, 0x080c, 0x6820, 0x1108,
-	0xc1fd, 0x4104, 0xc1fc, 0xd794, 0x0528, 0xb8c4, 0x20e0, 0xb8c8,
-	0x2060, 0x9c80, 0x0000, 0x2098, 0x20a9, 0x0002, 0x4003, 0x9c80,
-	0x0003, 0x2098, 0x20a9, 0x0001, 0x4005, 0x9c80, 0x0004, 0x2098,
-	0x3400, 0x20a9, 0x0002, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0,
-	0x080c, 0x489a, 0x9c80, 0x0026, 0x2098, 0xb8c4, 0x20e0, 0x20a9,
-	0x0002, 0x4003, 0xd794, 0x0110, 0x96b0, 0x000b, 0x96b0, 0x0005,
-	0x8108, 0x080c, 0xadb1, 0x0118, 0x9186, 0x0800, 0x0040, 0xd78c,
-	0x0120, 0x9186, 0x0800, 0x0170, 0x0018, 0x9186, 0x007e, 0x0150,
-	0xd794, 0x0118, 0x9686, 0x0020, 0x0010, 0x9686, 0x0028, 0x0150,
-	0x0804, 0x4db0, 0x86ff, 0x1120, 0x7124, 0x810b, 0x0804, 0x351d,
-	0x7033, 0x0001, 0x7122, 0x7024, 0x9600, 0x7026, 0x772e, 0x2061,
-	0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa67a, 0x7034, 0xa072, 0x7028,
+	0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x197f, 0x2004, 0xd0fc,
+	0x1128, 0x080c, 0x56d7, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0000, 0x0005, 0x6100, 0x0804, 0x3524, 0x080c,
+	0x4ad7, 0x0904, 0x3559, 0x080c, 0x56e3, 0x1904, 0x3556, 0x79a8,
+	0xd184, 0x1158, 0xb834, 0x8007, 0x789e, 0xb830, 0x8007, 0x789a,
+	0xbb2c, 0x831f, 0xba28, 0x8217, 0x0050, 0xb824, 0x8007, 0x789e,
+	0xb820, 0x8007, 0x789a, 0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900,
+	0x918c, 0x0200, 0x0804, 0x3524, 0x78a8, 0x909c, 0x0003, 0xd0b4,
+	0x1148, 0x939a, 0x0003, 0x1a04, 0x3556, 0x625c, 0x7884, 0x9206,
+	0x1904, 0x46c9, 0x080c, 0x85d9, 0x2001, 0xfff4, 0x2009, 0x000c,
+	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0000, 0x0006, 0x78a8,
+	0x9084, 0x0080, 0x11c8, 0x0006, 0x0036, 0x2001, 0x1a7f, 0x201c,
+	0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a80, 0x201c, 0x7b9e, 0x2003,
+	0x0000, 0x2001, 0x1a81, 0x201c, 0x7ba2, 0x2003, 0x0000, 0x003e,
+	0x000e, 0x000e, 0x0804, 0x4af0, 0x000e, 0x2031, 0x0000, 0x2061,
+	0x18b8, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392,
+	0xa496, 0xa59a, 0x080c, 0x10e9, 0x7007, 0x0002, 0x701f, 0x46e9,
+	0x0005, 0x81ff, 0x1904, 0x3556, 0x080c, 0x4ad7, 0x0904, 0x3559,
+	0x080c, 0x6972, 0x1904, 0x3556, 0x00c6, 0x080c, 0x4aa4, 0x00ce,
+	0x0904, 0x3556, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7ea8,
+	0x080c, 0xcca4, 0x0904, 0x3556, 0x7007, 0x0003, 0x701f, 0x4703,
+	0x0005, 0x080c, 0x420e, 0x0006, 0x0036, 0x2001, 0x1a7f, 0x201c,
+	0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a80, 0x201c, 0x7b9e, 0x2003,
+	0x0000, 0x2001, 0x1a81, 0x201c, 0x7ba2, 0x2003, 0x0000, 0x003e,
+	0x000e, 0x0804, 0x3524, 0xa830, 0x9086, 0x0100, 0x0904, 0x3556,
+	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
+	0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804,
+	0x4af0, 0x9006, 0x080c, 0x28a7, 0x78a8, 0x9084, 0x00ff, 0x9086,
+	0x00ff, 0x0118, 0x81ff, 0x1904, 0x3556, 0x080c, 0x73bc, 0x0110,
+	0x080c, 0x5fdf, 0x7888, 0x908a, 0x1000, 0x1a04, 0x3559, 0x7984,
+	0x9186, 0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04, 0x3559, 0x2100,
+	0x080c, 0x2871, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x2061,
+	0x19fa, 0x601b, 0x0000, 0x601f, 0x0000, 0x6073, 0x0000, 0x6077,
+	0x0000, 0x080c, 0x73bc, 0x1158, 0x080c, 0x76a4, 0x080c, 0x601a,
+	0x9085, 0x0001, 0x080c, 0x7403, 0x080c, 0x72ee, 0x00d0, 0x080c,
+	0xadd2, 0x2061, 0x0100, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff,
+	0x810f, 0x9105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009,
+	0x1999, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5f05, 0x080c,
+	0x858b, 0x7984, 0x080c, 0x73bc, 0x1110, 0x2009, 0x00ff, 0x7a88,
+	0x080c, 0x457f, 0x012e, 0x00ce, 0x002e, 0x0804, 0x3524, 0x7984,
+	0x080c, 0x659e, 0x2b08, 0x1904, 0x3559, 0x0804, 0x3524, 0x81ff,
+	0x0120, 0x2009, 0x0001, 0x0804, 0x3556, 0x60dc, 0xd0ac, 0x1130,
+	0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x3556, 0x080c, 0x4aa4,
+	0x1120, 0x2009, 0x0002, 0x0804, 0x3556, 0x7984, 0x9192, 0x0021,
+	0x1a04, 0x3559, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080,
+	0x0019, 0x702a, 0xaf60, 0x7736, 0x080c, 0x4aed, 0x701f, 0x47b7,
+	0x7880, 0x9086, 0x006e, 0x0110, 0x701f, 0x518d, 0x0005, 0x2009,
+	0x0080, 0x080c, 0x65ff, 0x1118, 0x080c, 0x6972, 0x0120, 0x2021,
+	0x400a, 0x0804, 0x3526, 0x00d6, 0x0096, 0xa964, 0xaa6c, 0xab70,
+	0xac74, 0xad78, 0xae7c, 0xa884, 0x90be, 0x0100, 0x0904, 0x4850,
+	0x90be, 0x0112, 0x0904, 0x4850, 0x90be, 0x0113, 0x0904, 0x4850,
+	0x90be, 0x0114, 0x0904, 0x4850, 0x90be, 0x0117, 0x0904, 0x4850,
+	0x90be, 0x011a, 0x0904, 0x4850, 0x90be, 0x011c, 0x0904, 0x4850,
+	0x90be, 0x0121, 0x0904, 0x4837, 0x90be, 0x0131, 0x0904, 0x4837,
+	0x90be, 0x0171, 0x0904, 0x4850, 0x90be, 0x0173, 0x0904, 0x4850,
+	0x90be, 0x01a1, 0x1128, 0xa894, 0x8007, 0xa896, 0x0804, 0x485b,
+	0x90be, 0x0212, 0x0904, 0x4844, 0x90be, 0x0213, 0x05e8, 0x90be,
+	0x0214, 0x0500, 0x90be, 0x0217, 0x0188, 0x90be, 0x021a, 0x1120,
+	0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be, 0x021f, 0x05c8, 0x90be,
+	0x0300, 0x05b0, 0x009e, 0x00de, 0x0804, 0x3559, 0x7028, 0x9080,
+	0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0007,
+	0x080c, 0x4899, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0, 0x7034,
+	0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x4899, 0x00c8, 0x7028,
+	0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9,
+	0x0001, 0x080c, 0x48a6, 0x00b8, 0x7028, 0x9080, 0x000e, 0x2098,
+	0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x48a6,
+	0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8,
+	0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c, 0x4aa4, 0x0550, 0xa868,
+	0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006, 0xa882, 0xa87f, 0x0020,
+	0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2, 0xaab6, 0xabba, 0xacbe,
+	0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e, 0x00de, 0xa866, 0xa822,
+	0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048, 0x080c, 0xccbf, 0x1120,
+	0x2009, 0x0003, 0x0804, 0x3556, 0x7007, 0x0003, 0x701f, 0x4890,
+	0x0005, 0x00ce, 0x009e, 0x00de, 0x2009, 0x0002, 0x0804, 0x3556,
+	0xa820, 0x9086, 0x8001, 0x1904, 0x3524, 0x2009, 0x0004, 0x0804,
+	0x3556, 0x0016, 0x0026, 0x3510, 0x20a9, 0x0002, 0x4002, 0x4104,
+	0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e, 0x0005, 0x0016, 0x0026,
+	0x0036, 0x0046, 0x3520, 0x20a9, 0x0004, 0x4002, 0x4304, 0x4204,
+	0x4104, 0x4004, 0x8421, 0x1db8, 0x004e, 0x003e, 0x002e, 0x001e,
+	0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x3556, 0x60dc,
+	0xd0ac, 0x1130, 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x3556,
+	0x7984, 0x78a8, 0x2040, 0x080c, 0xadcb, 0x1120, 0x9182, 0x007f,
+	0x0a04, 0x3559, 0x9186, 0x00ff, 0x0904, 0x3559, 0x9182, 0x0800,
+	0x1a04, 0x3559, 0x7a8c, 0x7b88, 0x607c, 0x9306, 0x1140, 0x6080,
+	0x924e, 0x0904, 0x3559, 0x99cc, 0xff00, 0x0904, 0x3559, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x49b7, 0x0904, 0x4937, 0x0086, 0x90c6,
+	0x4000, 0x008e, 0x1538, 0x00c6, 0x0006, 0x0036, 0xb818, 0xbb1c,
+	0x9305, 0xbb20, 0x9305, 0xbb24, 0x9305, 0xbb28, 0x9305, 0xbb2c,
+	0x9305, 0xbb30, 0x9305, 0xbb34, 0x9305, 0x003e, 0x0570, 0xd88c,
+	0x1128, 0x080c, 0x6972, 0x0110, 0xc89d, 0x0438, 0x900e, 0x080c,
+	0x681f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x000e,
+	0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x0090, 0x90c6,
+	0x4008, 0x1118, 0x2708, 0x2610, 0x0060, 0x90c6, 0x4009, 0x1108,
+	0x0040, 0x90c6, 0x4006, 0x1108, 0x0020, 0x2001, 0x4005, 0x2009,
+	0x000a, 0x2020, 0x012e, 0x0804, 0x3526, 0x000e, 0x00ce, 0x2b00,
+	0x7026, 0x0016, 0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c, 0xaeaf,
+	0x0904, 0x498c, 0x2b00, 0x6012, 0x080c, 0xcfaa, 0x2e58, 0x00ee,
+	0x00e6, 0x00c6, 0x080c, 0x4aa4, 0x00ce, 0x2b70, 0x1158, 0x080c,
+	0xae61, 0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x2009, 0x0002,
+	0x0804, 0x3556, 0x900e, 0xa966, 0xa96a, 0x2900, 0x6016, 0xa932,
+	0xa868, 0xc0fd, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0xd89c, 0x1110,
+	0x080c, 0x31bf, 0x6023, 0x0001, 0x9006, 0x080c, 0x653b, 0xd89c,
+	0x0138, 0x2001, 0x0004, 0x080c, 0x654f, 0x2009, 0x0003, 0x0030,
+	0x2001, 0x0002, 0x080c, 0x654f, 0x2009, 0x0002, 0x080c, 0xaedc,
+	0x78a8, 0xd094, 0x0138, 0x00ee, 0x7024, 0x00e6, 0x2058, 0xb8cc,
+	0xc08d, 0xb8ce, 0x9085, 0x0001, 0x00ee, 0x00ce, 0x00be, 0x001e,
+	0x012e, 0x1120, 0x2009, 0x0003, 0x0804, 0x3556, 0x7007, 0x0003,
+	0x701f, 0x499b, 0x0005, 0xa830, 0x9086, 0x0100, 0x7024, 0x2058,
+	0x1138, 0x2009, 0x0004, 0xba04, 0x9294, 0x00ff, 0x0804, 0x562c,
+	0x900e, 0xa868, 0xd0f4, 0x1904, 0x3524, 0x080c, 0x681f, 0x1108,
+	0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x3524, 0x00e6,
+	0x00d6, 0x0096, 0x83ff, 0x0904, 0x4a06, 0x902e, 0x080c, 0xadcb,
+	0x0130, 0x9026, 0x20a9, 0x0800, 0x2071, 0x1000, 0x0030, 0x2021,
+	0x007f, 0x20a9, 0x0781, 0x2071, 0x107f, 0x2e04, 0x9005, 0x11b8,
+	0x2100, 0x9406, 0x1904, 0x4a17, 0x2428, 0x94ce, 0x007f, 0x1120,
+	0x92ce, 0xfffd, 0x1558, 0x0030, 0x94ce, 0x0080, 0x1130, 0x92ce,
+	0xfffc, 0x1520, 0x93ce, 0x00ff, 0x1508, 0xc5fd, 0x0480, 0x2058,
+	0xbf10, 0x2700, 0x9306, 0x11e8, 0xbe14, 0x2600, 0x9206, 0x11c8,
+	0x2400, 0x9106, 0x1180, 0xd884, 0x0598, 0xd894, 0x1588, 0x080c,
+	0x6912, 0x1570, 0x2001, 0x4000, 0x0460, 0x080c, 0x6972, 0x1540,
+	0x2001, 0x4000, 0x0430, 0x2001, 0x4007, 0x0418, 0x2001, 0x4006,
+	0x0400, 0x2400, 0x9106, 0x1158, 0xbe14, 0x87ff, 0x1128, 0x86ff,
+	0x0918, 0x080c, 0xadcb, 0x1900, 0x2001, 0x4008, 0x0090, 0x8420,
+	0x8e70, 0x1f04, 0x49cd, 0x85ff, 0x1130, 0x2001, 0x4009, 0x0048,
+	0x2001, 0x0001, 0x0030, 0x080c, 0x659e, 0x1dd0, 0xbb12, 0xba16,
+	0x9006, 0x9005, 0x009e, 0x00de, 0x00ee, 0x0005, 0x81ff, 0x0120,
+	0x2009, 0x0001, 0x0804, 0x3556, 0x080c, 0x4aa4, 0x1120, 0x2009,
+	0x0002, 0x0804, 0x3556, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
+	0x7884, 0x9005, 0x0904, 0x3559, 0x9096, 0x00ff, 0x0120, 0x9092,
+	0x0004, 0x1a04, 0x3559, 0x2010, 0x2918, 0x080c, 0x3165, 0x1120,
+	0x2009, 0x0003, 0x0804, 0x3556, 0x7007, 0x0003, 0x701f, 0x4a59,
+	0x0005, 0xa830, 0x9086, 0x0100, 0x1904, 0x3524, 0x2009, 0x0004,
+	0x0804, 0x3556, 0x7984, 0x080c, 0xadcb, 0x1120, 0x9182, 0x007f,
+	0x0a04, 0x3559, 0x9186, 0x00ff, 0x0904, 0x3559, 0x9182, 0x0800,
+	0x1a04, 0x3559, 0x2001, 0x9000, 0x080c, 0x5687, 0x1904, 0x3556,
+	0x0804, 0x3524, 0xa998, 0x080c, 0xadcb, 0x1118, 0x9182, 0x007f,
+	0x0280, 0x9186, 0x00ff, 0x0168, 0x9182, 0x0800, 0x1250, 0x2001,
+	0x9000, 0x080c, 0x5687, 0x11a8, 0x0060, 0xa897, 0x4005, 0xa99a,
+	0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
+	0x0005, 0xa897, 0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000,
+	0x0005, 0x2009, 0x000a, 0x0c48, 0x080c, 0x0fff, 0x0198, 0x9006,
+	0xa802, 0x7014, 0x9005, 0x1120, 0x2900, 0x7016, 0x701a, 0x0040,
+	0x7018, 0xa802, 0x0086, 0x2040, 0x2900, 0xa006, 0x701a, 0x008e,
+	0x9085, 0x0001, 0x0005, 0x7984, 0x080c, 0x65ff, 0x1130, 0x7e88,
+	0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005,
+	0xa998, 0x080c, 0x65ff, 0x1130, 0xae9c, 0x9684, 0x3fff, 0x9082,
+	0x4000, 0x0208, 0x905e, 0x8bff, 0x0005, 0xae98, 0x0008, 0x7e84,
+	0x2608, 0x080c, 0x65ff, 0x1108, 0x0008, 0x905e, 0x8bff, 0x0005,
+	0x0016, 0x7114, 0x81ff, 0x0128, 0x2148, 0xa904, 0x080c, 0x1031,
+	0x0cc8, 0x7116, 0x711a, 0x001e, 0x0005, 0x2031, 0x0001, 0x0010,
+	0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44, 0xa66a, 0xa17a, 0xa772,
 	0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x10e9, 0x7007,
-	0x0002, 0x701f, 0x4e5c, 0x0005, 0x7030, 0x9005, 0x1180, 0x7120,
-	0x7028, 0x20a0, 0x772c, 0x9036, 0x7034, 0x20e8, 0x2061, 0x18b8,
-	0x2c44, 0xa28c, 0xa390, 0xa494, 0xa598, 0x0804, 0x4db0, 0x7124,
-	0x810b, 0x0804, 0x351d, 0x2029, 0x007e, 0x7984, 0x7a88, 0x7b8c,
-	0x7c98, 0x9184, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x3552,
-	0x9502, 0x0a04, 0x3552, 0x9184, 0x00ff, 0x90e2, 0x0020, 0x0a04,
-	0x3552, 0x9502, 0x0a04, 0x3552, 0x9284, 0xff00, 0x8007, 0x90e2,
-	0x0020, 0x0a04, 0x3552, 0x9502, 0x0a04, 0x3552, 0x9284, 0x00ff,
-	0x90e2, 0x0020, 0x0a04, 0x3552, 0x9502, 0x0a04, 0x3552, 0x9384,
-	0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x3552, 0x9502, 0x0a04,
-	0x3552, 0x9384, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x3552, 0x9502,
-	0x0a04, 0x3552, 0x9484, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04,
-	0x3552, 0x9502, 0x0a04, 0x3552, 0x9484, 0x00ff, 0x90e2, 0x0020,
-	0x0a04, 0x3552, 0x9502, 0x0a04, 0x3552, 0x2061, 0x1989, 0x6102,
-	0x6206, 0x630a, 0x640e, 0x0804, 0x351d, 0x080c, 0x4aa5, 0x0904,
-	0x354f, 0x2009, 0x0016, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c,
-	0x9080, 0x0019, 0xaf60, 0x080c, 0x4aee, 0x701f, 0x4ee0, 0x0005,
-	0x2001, 0x0138, 0x2003, 0x0000, 0x00e6, 0x2071, 0x0300, 0x701c,
-	0xd0a4, 0x1de8, 0x00ee, 0x20a9, 0x0016, 0x896e, 0x8d6e, 0x8d6f,
-	0x9d84, 0xffc0, 0x9080, 0x0019, 0x2098, 0x9d84, 0x003f, 0x20e0,
-	0x2069, 0x1877, 0x20e9, 0x0001, 0x2da0, 0x4003, 0x6800, 0x9005,
-	0x0904, 0x4f61, 0x6804, 0x2008, 0x918c, 0xfff8, 0x1904, 0x4f61,
-	0x680c, 0x9005, 0x0904, 0x4f61, 0x9082, 0xff01, 0x1a04, 0x4f61,
-	0x6810, 0x9082, 0x005c, 0x0a04, 0x4f61, 0x6824, 0x2008, 0x9082,
-	0x0008, 0x0a04, 0x4f61, 0x9182, 0x0400, 0x1a04, 0x4f61, 0x0056,
-	0x2029, 0x0000, 0x080c, 0x8ad2, 0x005e, 0x6944, 0x6820, 0x9102,
-	0x06c0, 0x6820, 0x9082, 0x0019, 0x16a0, 0x6828, 0x6944, 0x810c,
-	0x9102, 0x0678, 0x6840, 0x9082, 0x000f, 0x1658, 0x080c, 0x1018,
-	0x2900, 0x0904, 0x4f7b, 0x684e, 0x00e6, 0x2071, 0x1930, 0x00b6,
-	0x2059, 0x0000, 0x080c, 0x898e, 0x00be, 0x00ee, 0x0558, 0x080c,
-	0x86e8, 0x080c, 0x872e, 0x11e0, 0x6857, 0x0000, 0x00c6, 0x2061,
-	0x0100, 0x6104, 0x918d, 0x2000, 0x6106, 0x6b10, 0x2061, 0x1a62,
-	0x630a, 0x00ce, 0x080c, 0x2956, 0x2001, 0x0138, 0x2102, 0x0804,
-	0x351d, 0x080c, 0x2956, 0x2001, 0x0138, 0x2102, 0x0804, 0x3552,
-	0x00e6, 0x2071, 0x1930, 0x080c, 0x8b63, 0x080c, 0x8b72, 0x080c,
-	0x897d, 0x00ee, 0x2001, 0x188a, 0x204c, 0x080c, 0x1031, 0x2001,
-	0x188a, 0x2003, 0x0000, 0x080c, 0x2956, 0x2001, 0x0138, 0x2102,
-	0x0804, 0x354f, 0x2001, 0x1924, 0x200c, 0x918e, 0x0000, 0x0904,
-	0x4fda, 0x080c, 0x8978, 0x0904, 0x4fda, 0x2001, 0x0101, 0x200c,
-	0x918c, 0xdfff, 0x2102, 0x2001, 0x0138, 0x2003, 0x0000, 0x00e6,
-	0x2071, 0x0300, 0x701c, 0xd0a4, 0x1de8, 0x00ee, 0x080c, 0x897d,
-	0x2001, 0x0035, 0x080c, 0x15ee, 0x00c6, 0x2061, 0x193c, 0x6004,
-	0x6100, 0x9106, 0x1de0, 0x00ce, 0x080c, 0x2956, 0x2001, 0x0138,
-	0x2102, 0x00e6, 0x00f6, 0x2071, 0x1923, 0x080c, 0x88b9, 0x0120,
-	0x2f00, 0x080c, 0x8943, 0x0cc8, 0x00fe, 0x00ee, 0x0126, 0x2091,
-	0x8000, 0x2001, 0x188a, 0x200c, 0x81ff, 0x0138, 0x2148, 0x080c,
-	0x1031, 0x2001, 0x188a, 0x2003, 0x0000, 0x2001, 0x183c, 0x2003,
-	0x0020, 0x00e6, 0x2071, 0x1930, 0x080c, 0x8b63, 0x080c, 0x8b72,
-	0x00ee, 0x012e, 0x0804, 0x351d, 0x0006, 0x080c, 0x56d0, 0xd0cc,
-	0x000e, 0x0005, 0x0006, 0x080c, 0x56d4, 0xd0bc, 0x000e, 0x0005,
-	0x6174, 0x7a84, 0x6300, 0x82ff, 0x1118, 0x7986, 0x0804, 0x351d,
-	0x83ff, 0x1904, 0x3552, 0x2001, 0xfff0, 0x9200, 0x1a04, 0x3552,
-	0x2019, 0xffff, 0x6078, 0x9302, 0x9200, 0x0a04, 0x3552, 0x7986,
-	0x6276, 0x0804, 0x351d, 0x080c, 0x56e4, 0x1904, 0x354f, 0x7c88,
-	0x7d84, 0x7e98, 0x7f8c, 0x080c, 0x4aa5, 0x0904, 0x354f, 0x900e,
-	0x901e, 0x7326, 0x7332, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080,
-	0x0003, 0x702a, 0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178,
-	0x080c, 0x696a, 0x0118, 0x080c, 0x6972, 0x1148, 0x20a9, 0x0001,
-	0xb814, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108,
-	0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x0170, 0x0c20, 0x83ff,
-	0x1148, 0x7224, 0x900e, 0x2001, 0x0003, 0x080c, 0x8f3f, 0x2208,
-	0x0804, 0x351d, 0x7033, 0x0001, 0x7122, 0x7024, 0x9300, 0x7026,
-	0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa37a, 0x7028, 0xa076,
-	0x7034, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x10e9,
-	0x7007, 0x0002, 0x701f, 0x505d, 0x0005, 0x7030, 0x9005, 0x1178,
-	0x7120, 0x7028, 0x20a0, 0x901e, 0x7034, 0x20e8, 0x2061, 0x18b8,
-	0x2c44, 0xa48c, 0xa590, 0xa694, 0xa798, 0x0804, 0x501b, 0x7224,
-	0x900e, 0x2001, 0x0003, 0x080c, 0x8f3f, 0x2208, 0x0804, 0x351d,
-	0x00f6, 0x00e6, 0x080c, 0x56e4, 0x2009, 0x0007, 0x1904, 0x50f0,
-	0x2071, 0x189e, 0x745c, 0x84ff, 0x2009, 0x000e, 0x1904, 0x50f0,
-	0xac9c, 0xad98, 0xaea4, 0xafa0, 0x0096, 0x080c, 0x1018, 0x2009,
-	0x0002, 0x0904, 0x50f0, 0x2900, 0x705e, 0x900e, 0x901e, 0x7356,
-	0x7362, 0xa860, 0x7066, 0xa85c, 0x9080, 0x0003, 0x705a, 0x20a0,
-	0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x696a, 0x0118,
-	0x080c, 0x6972, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810,
-	0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120,
-	0x9386, 0x003c, 0x01e8, 0x0c20, 0x83ff, 0x11c0, 0x7254, 0x900e,
-	0x2001, 0x0003, 0x080c, 0x8f3f, 0x2208, 0x009e, 0xa897, 0x4000,
-	0xa99a, 0x715c, 0x81ff, 0x090c, 0x0dd5, 0x2148, 0x080c, 0x1031,
-	0x9006, 0x705e, 0x918d, 0x0001, 0x2008, 0x0418, 0x7063, 0x0001,
-	0x7152, 0x7054, 0x9300, 0x7056, 0x2061, 0x18b9, 0x2c44, 0xa37a,
-	0x7058, 0xa076, 0x7064, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a,
-	0xa09f, 0x50fc, 0x000e, 0xa0a2, 0x080c, 0x10e9, 0x9006, 0x0048,
-	0x009e, 0xa897, 0x4005, 0xa99a, 0x900e, 0x9085, 0x0001, 0x2001,
-	0x0030, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0xa0a0, 0x904d, 0x090c,
-	0x0dd5, 0x00e6, 0x2071, 0x189e, 0xa06c, 0x908e, 0x0100, 0x0138,
-	0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x00d8, 0x7060,
-	0x9005, 0x1158, 0x7150, 0x7058, 0x20a0, 0x901e, 0x7064, 0x20e8,
-	0xa48c, 0xa590, 0xa694, 0xa798, 0x0428, 0xa87b, 0x0000, 0xa883,
-	0x0000, 0xa897, 0x4000, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c,
-	0x8f3f, 0xaa9a, 0x715c, 0x81ff, 0x090c, 0x0dd5, 0x2148, 0x080c,
-	0x1031, 0x705f, 0x0000, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x6c79, 0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x00ee,
-	0x00fe, 0x0005, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c,
-	0x696a, 0x0118, 0x080c, 0x6972, 0x1148, 0xb814, 0x20a9, 0x0001,
+	0x0002, 0x701f, 0x3524, 0x0005, 0x00f6, 0x0126, 0x2091, 0x8000,
+	0x2079, 0x0000, 0x2001, 0x18b0, 0x2004, 0x9005, 0x1190, 0x0e04,
+	0x4b21, 0x7a36, 0x7833, 0x0012, 0x7a82, 0x7b86, 0x7c8a, 0x2091,
+	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x0804,
+	0x4b87, 0x0016, 0x0086, 0x0096, 0x00c6, 0x00e6, 0x2071, 0x189e,
+	0x7044, 0x9005, 0x1540, 0x7148, 0x9182, 0x0010, 0x0288, 0x7038,
+	0x2060, 0x080c, 0x0fff, 0x0904, 0x4b7f, 0xa84b, 0x0000, 0x2900,
+	0x7046, 0x2001, 0x0002, 0x9080, 0x2090, 0x2005, 0xa846, 0x0098,
+	0x7038, 0x90e0, 0x0004, 0x2001, 0x18ba, 0x9c82, 0x18fa, 0x0210,
+	0x2061, 0x18ba, 0x2c00, 0x703a, 0x7148, 0x81ff, 0x1108, 0x703e,
+	0x8108, 0x714a, 0x0460, 0x7148, 0x8108, 0x714a, 0x7044, 0x2040,
+	0xa144, 0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0dd5, 0x2060,
+	0x001e, 0x8108, 0x2105, 0x9005, 0xa146, 0x1520, 0x080c, 0x0fff,
+	0x1130, 0x8109, 0xa946, 0x7148, 0x8109, 0x714a, 0x00d8, 0x9006,
+	0xa806, 0xa84a, 0xa046, 0x2800, 0xa802, 0x2900, 0xa006, 0x7046,
+	0x2001, 0x0002, 0x9080, 0x2090, 0x2005, 0xa846, 0x0058, 0x2262,
+	0x6306, 0x640a, 0x00ee, 0x00ce, 0x009e, 0x008e, 0x001e, 0x012e,
+	0x00fe, 0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4ba9, 0x4ba9,
+	0x4bab, 0x4ba9, 0x4ba9, 0x4ba9, 0x4baf, 0x4ba9, 0x4ba9, 0x4ba9,
+	0x4bb3, 0x4ba9, 0x4ba9, 0x4ba9, 0x4bb7, 0x4ba9, 0x4ba9, 0x4ba9,
+	0x4bbb, 0x4ba9, 0x4ba9, 0x4ba9, 0x4bbf, 0x4ba9, 0x4ba9, 0x4ba9,
+	0x4bc4, 0x080c, 0x0dd5, 0xa276, 0xa37a, 0xa47e, 0x0898, 0xa286,
+	0xa38a, 0xa48e, 0x0878, 0xa296, 0xa39a, 0xa49e, 0x0858, 0xa2a6,
+	0xa3aa, 0xa4ae, 0x0838, 0xa2b6, 0xa3ba, 0xa4be, 0x0818, 0xa2c6,
+	0xa3ca, 0xa4ce, 0x0804, 0x4b82, 0xa2d6, 0xa3da, 0xa4de, 0x0804,
+	0x4b82, 0x00e6, 0x2071, 0x189e, 0x7048, 0x9005, 0x0904, 0x4c5b,
+	0x0126, 0x2091, 0x8000, 0x0e04, 0x4c5a, 0x00f6, 0x2079, 0x0000,
+	0x00c6, 0x0096, 0x0086, 0x0076, 0x9006, 0x2038, 0x7040, 0x2048,
+	0x9005, 0x0500, 0xa948, 0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c,
+	0x0dd5, 0x2060, 0x001e, 0x8108, 0x2105, 0x9005, 0xa94a, 0x1904,
+	0x4c5d, 0xa804, 0x9005, 0x090c, 0x0dd5, 0x7042, 0x2938, 0x2040,
+	0xa003, 0x0000, 0x2001, 0x0002, 0x9080, 0x2090, 0x2005, 0xa04a,
+	0x0804, 0x4c5d, 0x703c, 0x2060, 0x2c14, 0x6304, 0x6408, 0x650c,
+	0x2200, 0x7836, 0x7833, 0x0012, 0x7882, 0x2300, 0x7886, 0x2400,
+	0x788a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
+	0x119b, 0x87ff, 0x0118, 0x2748, 0x080c, 0x1031, 0x7048, 0x8001,
+	0x704a, 0x9005, 0x1170, 0x7040, 0x2048, 0x9005, 0x0128, 0x080c,
+	0x1031, 0x9006, 0x7042, 0x7046, 0x703b, 0x18ba, 0x703f, 0x18ba,
+	0x0420, 0x7040, 0x9005, 0x1508, 0x7238, 0x2c00, 0x9206, 0x0148,
+	0x9c80, 0x0004, 0x90fa, 0x18fa, 0x0210, 0x2001, 0x18ba, 0x703e,
+	0x00a0, 0x9006, 0x703e, 0x703a, 0x7044, 0x9005, 0x090c, 0x0dd5,
+	0x2048, 0xa800, 0x9005, 0x1de0, 0x2900, 0x7042, 0x2001, 0x0002,
+	0x9080, 0x2090, 0x2005, 0xa84a, 0x0000, 0x007e, 0x008e, 0x009e,
+	0x00ce, 0x00fe, 0x012e, 0x00ee, 0x0005, 0x2c00, 0x9082, 0x001b,
+	0x0002, 0x4c7c, 0x4c7c, 0x4c7e, 0x4c7c, 0x4c7c, 0x4c7c, 0x4c83,
+	0x4c7c, 0x4c7c, 0x4c7c, 0x4c88, 0x4c7c, 0x4c7c, 0x4c7c, 0x4c8d,
+	0x4c7c, 0x4c7c, 0x4c7c, 0x4c92, 0x4c7c, 0x4c7c, 0x4c7c, 0x4c97,
+	0x4c7c, 0x4c7c, 0x4c7c, 0x4c9c, 0x080c, 0x0dd5, 0xaa74, 0xab78,
+	0xac7c, 0x0804, 0x4c08, 0xaa84, 0xab88, 0xac8c, 0x0804, 0x4c08,
+	0xaa94, 0xab98, 0xac9c, 0x0804, 0x4c08, 0xaaa4, 0xaba8, 0xacac,
+	0x0804, 0x4c08, 0xaab4, 0xabb8, 0xacbc, 0x0804, 0x4c08, 0xaac4,
+	0xabc8, 0xaccc, 0x0804, 0x4c08, 0xaad4, 0xabd8, 0xacdc, 0x0804,
+	0x4c08, 0x0016, 0x0026, 0x0036, 0x00b6, 0x00c6, 0x2009, 0x007e,
+	0x080c, 0x65ff, 0x2019, 0x0001, 0xb85c, 0xd0ac, 0x0110, 0x2019,
+	0x0000, 0x2011, 0x801b, 0x080c, 0x4b04, 0x00ce, 0x00be, 0x003e,
+	0x002e, 0x001e, 0x0005, 0x0026, 0x080c, 0x56cf, 0xd0c4, 0x0120,
+	0x2011, 0x8014, 0x080c, 0x4b04, 0x002e, 0x0005, 0x81ff, 0x1904,
+	0x3556, 0x0126, 0x2091, 0x8000, 0x6030, 0xc08d, 0xc085, 0xc0ac,
+	0x6032, 0x080c, 0x73bc, 0x1158, 0x080c, 0x76a4, 0x080c, 0x601a,
+	0x9085, 0x0001, 0x080c, 0x7403, 0x080c, 0x72ee, 0x0010, 0x080c,
+	0x5ed9, 0x012e, 0x0804, 0x3524, 0x81ff, 0x0120, 0x2009, 0x0001,
+	0x0804, 0x3556, 0x080c, 0x56e3, 0x0120, 0x2009, 0x0007, 0x0804,
+	0x3556, 0x080c, 0x696a, 0x0120, 0x2009, 0x0008, 0x0804, 0x3556,
+	0x080c, 0x3314, 0x0128, 0x7984, 0x080c, 0x659e, 0x1904, 0x3559,
+	0x080c, 0x4ad7, 0x0904, 0x3559, 0x2b00, 0x7026, 0x080c, 0x6972,
+	0x7888, 0x1170, 0x9084, 0x0005, 0x1158, 0x900e, 0x080c, 0x681f,
+	0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x3524,
+	0x080c, 0x4aa4, 0x0904, 0x3556, 0x9006, 0xa866, 0xa832, 0xa868,
+	0xc0fd, 0xa86a, 0x080c, 0xcd58, 0x0904, 0x3556, 0x7888, 0xd094,
+	0x0118, 0xb8cc, 0xc08d, 0xb8ce, 0x7007, 0x0003, 0x701f, 0x4d7d,
+	0x0005, 0x2061, 0x1800, 0x080c, 0x56e3, 0x2009, 0x0007, 0x1578,
+	0x080c, 0x696a, 0x0118, 0x2009, 0x0008, 0x0448, 0x080c, 0x3314,
+	0x0120, 0xa998, 0x080c, 0x659e, 0x1530, 0x080c, 0x4ad5, 0x0518,
+	0x080c, 0x6972, 0xa89c, 0x1168, 0x9084, 0x0005, 0x1150, 0x900e,
+	0x080c, 0x681f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c, 0xcd58, 0x11e0, 0xa89c,
+	0xd094, 0x0118, 0xb8cc, 0xc08d, 0xb8ce, 0x2009, 0x0003, 0xa897,
+	0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001,
+	0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0xa99a, 0x9006, 0x918d,
+	0x0001, 0x2008, 0x0005, 0x9006, 0x0005, 0xa830, 0x9086, 0x0100,
+	0x7024, 0x2058, 0x1110, 0x0804, 0x562c, 0x900e, 0x080c, 0x681f,
+	0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804, 0x3524,
+	0x080c, 0x56e3, 0x0120, 0x2009, 0x0007, 0x0804, 0x3556, 0x7f84,
+	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4aa4, 0x1120, 0x2009,
+	0x0002, 0x0804, 0x3556, 0x900e, 0x2130, 0x7126, 0x7132, 0xa860,
+	0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005, 0x702a, 0x20a0, 0x080c,
+	0x65ff, 0x1904, 0x4e1f, 0x080c, 0x6972, 0x0138, 0x080c, 0x697a,
+	0x0120, 0x080c, 0x6912, 0x1904, 0x4e1f, 0xd794, 0x1110, 0xd784,
+	0x01a8, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x3400,
+	0xd794, 0x0160, 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0, 0x3d00,
+	0x20e0, 0x20a9, 0x0002, 0x080c, 0x48a6, 0x0048, 0x20a9, 0x0004,
+	0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x48a6, 0x9186,
+	0x007e, 0x0170, 0x9186, 0x0080, 0x0158, 0x080c, 0x6972, 0x90c2,
+	0x0006, 0x1210, 0xc1fd, 0x0020, 0x080c, 0x681f, 0x1108, 0xc1fd,
+	0x4104, 0xc1fc, 0xd794, 0x0528, 0xb8c4, 0x20e0, 0xb8c8, 0x2060,
+	0x9c80, 0x0000, 0x2098, 0x20a9, 0x0002, 0x4003, 0x9c80, 0x0003,
+	0x2098, 0x20a9, 0x0001, 0x4005, 0x9c80, 0x0004, 0x2098, 0x3400,
+	0x20a9, 0x0002, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c,
+	0x4899, 0x9c80, 0x0026, 0x2098, 0xb8c4, 0x20e0, 0x20a9, 0x0002,
+	0x4003, 0xd794, 0x0110, 0x96b0, 0x000b, 0x96b0, 0x0005, 0x8108,
+	0x080c, 0xadcb, 0x0118, 0x9186, 0x0800, 0x0040, 0xd78c, 0x0120,
+	0x9186, 0x0800, 0x0170, 0x0018, 0x9186, 0x007e, 0x0150, 0xd794,
+	0x0118, 0x9686, 0x0020, 0x0010, 0x9686, 0x0028, 0x0150, 0x0804,
+	0x4daf, 0x86ff, 0x1120, 0x7124, 0x810b, 0x0804, 0x3524, 0x7033,
+	0x0001, 0x7122, 0x7024, 0x9600, 0x7026, 0x772e, 0x2061, 0x18b8,
+	0x2c44, 0xa06b, 0x0000, 0xa67a, 0x7034, 0xa072, 0x7028, 0xa076,
+	0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x10e9, 0x7007, 0x0002,
+	0x701f, 0x4e5b, 0x0005, 0x7030, 0x9005, 0x1180, 0x7120, 0x7028,
+	0x20a0, 0x772c, 0x9036, 0x7034, 0x20e8, 0x2061, 0x18b8, 0x2c44,
+	0xa28c, 0xa390, 0xa494, 0xa598, 0x0804, 0x4daf, 0x7124, 0x810b,
+	0x0804, 0x3524, 0x2029, 0x007e, 0x7984, 0x7a88, 0x7b8c, 0x7c98,
+	0x9184, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x3559, 0x9502,
+	0x0a04, 0x3559, 0x9184, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x3559,
+	0x9502, 0x0a04, 0x3559, 0x9284, 0xff00, 0x8007, 0x90e2, 0x0020,
+	0x0a04, 0x3559, 0x9502, 0x0a04, 0x3559, 0x9284, 0x00ff, 0x90e2,
+	0x0020, 0x0a04, 0x3559, 0x9502, 0x0a04, 0x3559, 0x9384, 0xff00,
+	0x8007, 0x90e2, 0x0020, 0x0a04, 0x3559, 0x9502, 0x0a04, 0x3559,
+	0x9384, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x3559, 0x9502, 0x0a04,
+	0x3559, 0x9484, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x3559,
+	0x9502, 0x0a04, 0x3559, 0x9484, 0x00ff, 0x90e2, 0x0020, 0x0a04,
+	0x3559, 0x9502, 0x0a04, 0x3559, 0x2061, 0x1989, 0x6102, 0x6206,
+	0x630a, 0x640e, 0x0804, 0x3524, 0x080c, 0x4aa4, 0x0904, 0x3556,
+	0x2009, 0x0016, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080,
+	0x0019, 0xaf60, 0x080c, 0x4aed, 0x701f, 0x4edf, 0x0005, 0x2001,
+	0x0138, 0x2003, 0x0000, 0x00e6, 0x2071, 0x0300, 0x701c, 0xd0a4,
+	0x1de8, 0x00ee, 0x20a9, 0x0016, 0x896e, 0x8d6e, 0x8d6f, 0x9d84,
+	0xffc0, 0x9080, 0x0019, 0x2098, 0x9d84, 0x003f, 0x20e0, 0x2069,
+	0x1877, 0x20e9, 0x0001, 0x2da0, 0x4003, 0x6800, 0x9005, 0x0904,
+	0x4f60, 0x6804, 0x2008, 0x918c, 0xfff8, 0x1904, 0x4f60, 0x680c,
+	0x9005, 0x0904, 0x4f60, 0x9082, 0xff01, 0x1a04, 0x4f60, 0x6810,
+	0x9082, 0x005c, 0x0a04, 0x4f60, 0x6824, 0x2008, 0x9082, 0x0008,
+	0x0a04, 0x4f60, 0x9182, 0x0400, 0x1a04, 0x4f60, 0x0056, 0x2029,
+	0x0000, 0x080c, 0x8afb, 0x005e, 0x6944, 0x6820, 0x9102, 0x06c0,
+	0x6820, 0x9082, 0x0019, 0x16a0, 0x6828, 0x6944, 0x810c, 0x9102,
+	0x0678, 0x6840, 0x9082, 0x000f, 0x1658, 0x080c, 0x1018, 0x2900,
+	0x0904, 0x4f7a, 0x684e, 0x00e6, 0x2071, 0x1930, 0x00b6, 0x2059,
+	0x0000, 0x080c, 0x89b7, 0x00be, 0x00ee, 0x0558, 0x080c, 0x8711,
+	0x080c, 0x8757, 0x11e0, 0x6857, 0x0000, 0x00c6, 0x2061, 0x0100,
+	0x6104, 0x918d, 0x2000, 0x6106, 0x6b10, 0x2061, 0x1a62, 0x630a,
+	0x00ce, 0x080c, 0x2956, 0x2001, 0x0138, 0x2102, 0x0804, 0x3524,
+	0x080c, 0x2956, 0x2001, 0x0138, 0x2102, 0x0804, 0x3559, 0x00e6,
+	0x2071, 0x1930, 0x080c, 0x8b8c, 0x080c, 0x8b9b, 0x080c, 0x89a6,
+	0x00ee, 0x2001, 0x188a, 0x204c, 0x080c, 0x1031, 0x2001, 0x188a,
+	0x2003, 0x0000, 0x080c, 0x2956, 0x2001, 0x0138, 0x2102, 0x0804,
+	0x3556, 0x2001, 0x1924, 0x200c, 0x918e, 0x0000, 0x0904, 0x4fd9,
+	0x080c, 0x89a1, 0x0904, 0x4fd9, 0x2001, 0x0101, 0x200c, 0x918c,
+	0xdfff, 0x2102, 0x2001, 0x0138, 0x2003, 0x0000, 0x00e6, 0x2071,
+	0x0300, 0x701c, 0xd0a4, 0x1de8, 0x00ee, 0x080c, 0x89a6, 0x2001,
+	0x0035, 0x080c, 0x15ee, 0x00c6, 0x2061, 0x193c, 0x6004, 0x6100,
+	0x9106, 0x1de0, 0x00ce, 0x080c, 0x2956, 0x2001, 0x0138, 0x2102,
+	0x00e6, 0x00f6, 0x2071, 0x1923, 0x080c, 0x88e2, 0x0120, 0x2f00,
+	0x080c, 0x896c, 0x0cc8, 0x00fe, 0x00ee, 0x0126, 0x2091, 0x8000,
+	0x2001, 0x188a, 0x200c, 0x81ff, 0x0138, 0x2148, 0x080c, 0x1031,
+	0x2001, 0x188a, 0x2003, 0x0000, 0x2001, 0x183c, 0x2003, 0x0020,
+	0x00e6, 0x2071, 0x1930, 0x080c, 0x8b8c, 0x080c, 0x8b9b, 0x00ee,
+	0x012e, 0x0804, 0x3524, 0x0006, 0x080c, 0x56cf, 0xd0cc, 0x000e,
+	0x0005, 0x0006, 0x080c, 0x56d3, 0xd0bc, 0x000e, 0x0005, 0x6174,
+	0x7a84, 0x6300, 0x82ff, 0x1118, 0x7986, 0x0804, 0x3524, 0x83ff,
+	0x1904, 0x3559, 0x2001, 0xfff0, 0x9200, 0x1a04, 0x3559, 0x2019,
+	0xffff, 0x6078, 0x9302, 0x9200, 0x0a04, 0x3559, 0x7986, 0x6276,
+	0x0804, 0x3524, 0x080c, 0x56e3, 0x1904, 0x3556, 0x7c88, 0x7d84,
+	0x7e98, 0x7f8c, 0x080c, 0x4aa4, 0x0904, 0x3556, 0x900e, 0x901e,
+	0x7326, 0x7332, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0003,
+	0x702a, 0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c,
+	0x6972, 0x0118, 0x080c, 0x697a, 0x1148, 0x20a9, 0x0001, 0xb814,
 	0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182,
-	0x0800, 0x0120, 0x9386, 0x003c, 0x0518, 0x0c20, 0x83ff, 0x11f0,
-	0x7154, 0x810c, 0xa99a, 0xa897, 0x4000, 0x715c, 0x81ff, 0x090c,
-	0x0dd5, 0x2148, 0x080c, 0x1031, 0x9006, 0x705e, 0x918d, 0x0001,
-	0x2008, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c79,
-	0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x0070, 0x7063, 0x0001,
-	0x7152, 0x7054, 0x9300, 0x7056, 0xa37a, 0xa48e, 0xa592, 0xa696,
-	0xa79a, 0x080c, 0x10e9, 0x9006, 0x00ee, 0x0005, 0x0096, 0xa88c,
-	0x90be, 0x7000, 0x0148, 0x90be, 0x7100, 0x0130, 0x90be, 0x7200,
-	0x0118, 0x009e, 0x0804, 0x3552, 0xa884, 0xa988, 0x080c, 0x283e,
-	0x1518, 0x080c, 0x659f, 0x1500, 0x7126, 0xbe12, 0xbd16, 0xae7c,
-	0x080c, 0x4aa5, 0x01c8, 0x080c, 0x4aa5, 0x01b0, 0x009e, 0xa867,
-	0x0000, 0xa868, 0xc0fd, 0xa86a, 0xa823, 0x0000, 0xa804, 0x2048,
-	0x080c, 0xccc5, 0x1120, 0x2009, 0x0003, 0x0804, 0x354f, 0x7007,
-	0x0003, 0x701f, 0x51c9, 0x0005, 0x009e, 0x2009, 0x0002, 0x0804,
-	0x354f, 0x7124, 0x080c, 0x32b4, 0xa820, 0x9086, 0x8001, 0x1120,
-	0x2009, 0x0004, 0x0804, 0x354f, 0x2900, 0x7022, 0xa804, 0x0096,
-	0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-	0x009e, 0x9080, 0x0002, 0x0076, 0x0006, 0x2098, 0x20a0, 0x27e0,
-	0x27e8, 0x20a9, 0x002a, 0x080c, 0x0f7c, 0xaa6c, 0xab70, 0xac74,
-	0xad78, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xae64, 0xaf8c,
-	0x97c6, 0x7000, 0x0118, 0x97c6, 0x7100, 0x1148, 0x96c2, 0x0004,
-	0x0600, 0x2009, 0x0004, 0x000e, 0x007e, 0x0804, 0x4af1, 0x97c6,
-	0x7200, 0x11b8, 0x96c2, 0x0054, 0x02a0, 0x000e, 0x007e, 0x2061,
-	0x18b8, 0x2c44, 0xa076, 0xa772, 0xa07b, 0x002a, 0xa28e, 0xa392,
-	0xa496, 0xa59a, 0x080c, 0x10e9, 0x7007, 0x0002, 0x701f, 0x5225,
-	0x0005, 0x000e, 0x007e, 0x0804, 0x3552, 0x7020, 0x2048, 0xa804,
-	0x2048, 0xa804, 0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
-	0x9084, 0xffc0, 0x9080, 0x0002, 0x2098, 0x20a0, 0x27e0, 0x27e8,
-	0x20a9, 0x002a, 0x080c, 0x0f7c, 0x2100, 0x2238, 0x2061, 0x18b8,
-	0x2c44, 0xa28c, 0xa390, 0xa494, 0xa598, 0x2009, 0x002a, 0x0804,
-	0x4af1, 0x81ff, 0x1904, 0x354f, 0x798c, 0x2001, 0x197e, 0x918c,
-	0x8000, 0x2102, 0x080c, 0x4abc, 0x0904, 0x3552, 0x080c, 0x696a,
-	0x0120, 0x080c, 0x6972, 0x1904, 0x3552, 0x080c, 0x66c7, 0x0904,
-	0x354f, 0x0126, 0x2091, 0x8000, 0x080c, 0x678d, 0x012e, 0x0904,
-	0x354f, 0x2001, 0x197e, 0x2004, 0xd0fc, 0x1904, 0x351d, 0x0804,
-	0x451d, 0xa9a0, 0x2001, 0x197e, 0x918c, 0x8000, 0xc18d, 0x2102,
-	0x080c, 0x4ac9, 0x01a0, 0x080c, 0x696a, 0x0118, 0x080c, 0x6972,
-	0x1170, 0x080c, 0x66c7, 0x2009, 0x0002, 0x0128, 0x080c, 0x678d,
-	0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
-	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
-	0x4000, 0x2001, 0x197e, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x56d8,
-	0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000,
-	0x0005, 0x78a8, 0xd08c, 0x1118, 0xd084, 0x0904, 0x4492, 0x080c,
-	0x4ad8, 0x0904, 0x3552, 0x080c, 0x4aa5, 0x1120, 0x2009, 0x0002,
-	0x0804, 0x354f, 0x080c, 0x696a, 0x0130, 0x908e, 0x0004, 0x0118,
-	0x908e, 0x0005, 0x15a0, 0x78a8, 0xd08c, 0x0120, 0xb800, 0xc08c,
-	0xb802, 0x0028, 0x080c, 0x56d0, 0xd0b4, 0x0904, 0x44cc, 0x7884,
-	0x908e, 0x007e, 0x0904, 0x44cc, 0x908e, 0x007f, 0x0904, 0x44cc,
-	0x908e, 0x0080, 0x0904, 0x44cc, 0xb800, 0xd08c, 0x1904, 0x44cc,
-	0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xcce4, 0x1120,
-	0x2009, 0x0003, 0x0804, 0x354f, 0x7007, 0x0003, 0x701f, 0x52f1,
-	0x0005, 0x080c, 0x4ad8, 0x0904, 0x3552, 0x0804, 0x44cc, 0x080c,
-	0x330d, 0x0108, 0x0005, 0x2009, 0x1834, 0x210c, 0x81ff, 0x0120,
-	0x2009, 0x0001, 0x0804, 0x354f, 0x080c, 0x56e4, 0x0120, 0x2009,
-	0x0007, 0x0804, 0x354f, 0x080c, 0x6962, 0x0120, 0x2009, 0x0008,
-	0x0804, 0x354f, 0xb89c, 0xd0a4, 0x1118, 0xd0ac, 0x1904, 0x44cc,
-	0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xcd3e,
-	0x1120, 0x2009, 0x0003, 0x0804, 0x354f, 0x7007, 0x0003, 0x701f,
-	0x532a, 0x0005, 0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004,
-	0x0804, 0x562d, 0x080c, 0x4ad8, 0x0904, 0x3552, 0x0804, 0x52c3,
-	0x81ff, 0x2009, 0x0001, 0x1904, 0x354f, 0x080c, 0x56e4, 0x2009,
-	0x0007, 0x1904, 0x354f, 0x080c, 0x6962, 0x0120, 0x2009, 0x0008,
-	0x0804, 0x354f, 0x080c, 0x4ad8, 0x0904, 0x3552, 0x080c, 0x696a,
-	0x2009, 0x0009, 0x1904, 0x354f, 0x080c, 0x4aa5, 0x2009, 0x0002,
-	0x0904, 0x354f, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a,
-	0x7988, 0x9194, 0xff00, 0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128,
-	0xc0ed, 0xa952, 0x798c, 0xa956, 0x0038, 0x928e, 0x0100, 0x1904,
-	0x3552, 0xc0e5, 0xa952, 0xa956, 0xa83e, 0x080c, 0xcf91, 0x2009,
-	0x0003, 0x0904, 0x354f, 0x7007, 0x0003, 0x701f, 0x5380, 0x0005,
-	0xa830, 0x9086, 0x0100, 0x2009, 0x0004, 0x0904, 0x354f, 0x0804,
-	0x351d, 0x7aa8, 0x9284, 0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c,
-	0x56e4, 0x1188, 0x2009, 0x0014, 0x0804, 0x354f, 0xd2dc, 0x1568,
-	0x81ff, 0x2009, 0x0001, 0x1904, 0x354f, 0x080c, 0x56e4, 0x2009,
-	0x0007, 0x1904, 0x354f, 0xd2f4, 0x0130, 0x9284, 0x5000, 0x080c,
-	0x56ab, 0x0804, 0x351d, 0xd2fc, 0x0158, 0x080c, 0x4ad8, 0x0904,
-	0x3552, 0x7984, 0x9284, 0x9000, 0x080c, 0x5688, 0x0804, 0x351d,
-	0x080c, 0x4ad8, 0x0904, 0x3552, 0xb804, 0x9084, 0x00ff, 0x9086,
-	0x0006, 0x2009, 0x0009, 0x1904, 0x5469, 0x080c, 0x4aa5, 0x2009,
-	0x0002, 0x0904, 0x5469, 0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009,
-	0x0008, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4aee, 0x701f,
-	0x53da, 0x0005, 0xa86c, 0x9086, 0x0500, 0x1138, 0xa870, 0x9005,
-	0x1120, 0xa874, 0x9084, 0xff00, 0x0110, 0x1904, 0x3552, 0xa866,
-	0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0x4ad8, 0x1110, 0x0804,
-	0x3552, 0x2009, 0x0043, 0x080c, 0xcff9, 0x2009, 0x0003, 0x0904,
-	0x5469, 0x7007, 0x0003, 0x701f, 0x53fe, 0x0005, 0xa830, 0x9086,
-	0x0100, 0x2009, 0x0004, 0x0904, 0x5469, 0x7984, 0x7aa8, 0x9284,
-	0x1000, 0x080c, 0x5688, 0x0804, 0x351d, 0x00c6, 0xaab0, 0x9284,
-	0xc000, 0x0140, 0xd2ec, 0x0168, 0x080c, 0x56e4, 0x1150, 0x2009,
-	0x0014, 0x04f0, 0x2061, 0x1800, 0x080c, 0x56e4, 0x2009, 0x0007,
-	0x15b8, 0xd2f4, 0x0128, 0x9284, 0x5000, 0x080c, 0x56ab, 0x0050,
-	0xd2fc, 0x0178, 0x080c, 0x4ad6, 0x0588, 0xa998, 0x9284, 0x9000,
-	0x080c, 0x5688, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
-	0x0438, 0x080c, 0x4ad6, 0x0510, 0x080c, 0x696a, 0x2009, 0x0009,
-	0x11b8, 0xa8c4, 0x9086, 0x0500, 0x11c8, 0xa8c8, 0x9005, 0x11b0,
-	0xa8cc, 0x9084, 0xff00, 0x1190, 0x080c, 0x4ad6, 0x1108, 0x0070,
-	0x2009, 0x004b, 0x080c, 0xcff9, 0x2009, 0x0003, 0x0108, 0x0078,
-	0x0429, 0x19c0, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
-	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x00ce, 0x0005, 0x9006,
-	0x0ce0, 0x7aa8, 0xd2dc, 0x0904, 0x354f, 0x0016, 0x7984, 0x9284,
-	0x1000, 0xc0fd, 0x080c, 0x5688, 0x001e, 0x1904, 0x354f, 0x0804,
-	0x351d, 0x00f6, 0x2d78, 0x0011, 0x00fe, 0x0005, 0xaab0, 0xd2dc,
-	0x0150, 0x0016, 0xa998, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5688,
-	0x001e, 0x9085, 0x0001, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001,
-	0x0804, 0x354f, 0x080c, 0x56e4, 0x0120, 0x2009, 0x0007, 0x0804,
-	0x354f, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x6600, 0x1904,
-	0x3552, 0x9186, 0x007f, 0x0138, 0x080c, 0x696a, 0x0120, 0x2009,
-	0x0009, 0x0804, 0x354f, 0x080c, 0x4aa5, 0x1120, 0x2009, 0x0002,
-	0x0804, 0x354f, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001,
-	0x0100, 0x8007, 0xa80a, 0x080c, 0xccfe, 0x1120, 0x2009, 0x0003,
-	0x0804, 0x354f, 0x7007, 0x0003, 0x701f, 0x54c7, 0x0005, 0xa808,
-	0x8007, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x354f,
-	0xa8e0, 0xa866, 0xa810, 0x8007, 0x9084, 0x00ff, 0x800c, 0xa814,
-	0x8007, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0002, 0x9108, 0x8906,
-	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0004,
-	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x4af1, 0x080c, 0x4aa5,
-	0x1120, 0x2009, 0x0002, 0x0804, 0x354f, 0x7984, 0x9194, 0xff00,
-	0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118, 0x7023, 0x19b3, 0x0040,
-	0x92c6, 0x0001, 0x1118, 0x7023, 0x19cd, 0x0010, 0x0804, 0x3552,
-	0x2009, 0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080,
-	0x0019, 0xaf60, 0x080c, 0x4aee, 0x701f, 0x5517, 0x0005, 0x2001,
-	0x182e, 0x2003, 0x0001, 0xa85c, 0x9080, 0x0019, 0x2098, 0xa860,
-	0x20e0, 0x20a9, 0x001a, 0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003,
-	0x0804, 0x351d, 0x080c, 0x4aa5, 0x1120, 0x2009, 0x0002, 0x0804,
-	0x354f, 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff,
-	0x1118, 0x2099, 0x19b3, 0x0040, 0x92c6, 0x0001, 0x1118, 0x2099,
-	0x19cd, 0x0010, 0x0804, 0x3552, 0xa85c, 0x9080, 0x0019, 0x20a0,
-	0xa860, 0x20e8, 0x20a9, 0x001a, 0x20e1, 0x0001, 0x4003, 0x2009,
+	0x0800, 0x0120, 0x9386, 0x003c, 0x0170, 0x0c20, 0x83ff, 0x1148,
+	0x7224, 0x900e, 0x2001, 0x0003, 0x080c, 0x8f68, 0x2208, 0x0804,
+	0x3524, 0x7033, 0x0001, 0x7122, 0x7024, 0x9300, 0x7026, 0x2061,
+	0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa37a, 0x7028, 0xa076, 0x7034,
+	0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x10e9, 0x7007,
+	0x0002, 0x701f, 0x505c, 0x0005, 0x7030, 0x9005, 0x1178, 0x7120,
+	0x7028, 0x20a0, 0x901e, 0x7034, 0x20e8, 0x2061, 0x18b8, 0x2c44,
+	0xa48c, 0xa590, 0xa694, 0xa798, 0x0804, 0x501a, 0x7224, 0x900e,
+	0x2001, 0x0003, 0x080c, 0x8f68, 0x2208, 0x0804, 0x3524, 0x00f6,
+	0x00e6, 0x080c, 0x56e3, 0x2009, 0x0007, 0x1904, 0x50ef, 0x2071,
+	0x189e, 0x745c, 0x84ff, 0x2009, 0x000e, 0x1904, 0x50ef, 0xac9c,
+	0xad98, 0xaea4, 0xafa0, 0x0096, 0x080c, 0x1018, 0x2009, 0x0002,
+	0x0904, 0x50ef, 0x2900, 0x705e, 0x900e, 0x901e, 0x7356, 0x7362,
+	0xa860, 0x7066, 0xa85c, 0x9080, 0x0003, 0x705a, 0x20a0, 0x91d8,
+	0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6972, 0x0118, 0x080c,
+	0x697a, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004,
+	0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386,
+	0x003c, 0x01e8, 0x0c20, 0x83ff, 0x11c0, 0x7254, 0x900e, 0x2001,
+	0x0003, 0x080c, 0x8f68, 0x2208, 0x009e, 0xa897, 0x4000, 0xa99a,
+	0x715c, 0x81ff, 0x090c, 0x0dd5, 0x2148, 0x080c, 0x1031, 0x9006,
+	0x705e, 0x918d, 0x0001, 0x2008, 0x0418, 0x7063, 0x0001, 0x7152,
+	0x7054, 0x9300, 0x7056, 0x2061, 0x18b9, 0x2c44, 0xa37a, 0x7058,
+	0xa076, 0x7064, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0xa09f,
+	0x50fb, 0x000e, 0xa0a2, 0x080c, 0x10e9, 0x9006, 0x0048, 0x009e,
+	0xa897, 0x4005, 0xa99a, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
+	0x00ee, 0x00fe, 0x0005, 0x00f6, 0xa0a0, 0x904d, 0x090c, 0x0dd5,
+	0x00e6, 0x2071, 0x189e, 0xa06c, 0x908e, 0x0100, 0x0138, 0xa87b,
+	0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x00d8, 0x7060, 0x9005,
+	0x1158, 0x7150, 0x7058, 0x20a0, 0x901e, 0x7064, 0x20e8, 0xa48c,
+	0xa590, 0xa694, 0xa798, 0x0428, 0xa87b, 0x0000, 0xa883, 0x0000,
+	0xa897, 0x4000, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x8f68,
+	0xaa9a, 0x715c, 0x81ff, 0x090c, 0x0dd5, 0x2148, 0x080c, 0x1031,
+	0x705f, 0x0000, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6c81, 0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x00ee, 0x00fe,
+	0x0005, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6972,
+	0x0118, 0x080c, 0x697a, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004,
+	0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800,
+	0x0120, 0x9386, 0x003c, 0x0518, 0x0c20, 0x83ff, 0x11f0, 0x7154,
+	0x810c, 0xa99a, 0xa897, 0x4000, 0x715c, 0x81ff, 0x090c, 0x0dd5,
+	0x2148, 0x080c, 0x1031, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008,
+	0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c81, 0x012e,
+	0xa09f, 0x0000, 0xa0a3, 0x0000, 0x0070, 0x7063, 0x0001, 0x7152,
+	0x7054, 0x9300, 0x7056, 0xa37a, 0xa48e, 0xa592, 0xa696, 0xa79a,
+	0x080c, 0x10e9, 0x9006, 0x00ee, 0x0005, 0x0096, 0xa88c, 0x90be,
+	0x7000, 0x0148, 0x90be, 0x7100, 0x0130, 0x90be, 0x7200, 0x0118,
+	0x009e, 0x0804, 0x3559, 0xa884, 0xa988, 0x080c, 0x283e, 0x1518,
+	0x080c, 0x659e, 0x1500, 0x7126, 0xbe12, 0xbd16, 0xae7c, 0x080c,
+	0x4aa4, 0x01c8, 0x080c, 0x4aa4, 0x01b0, 0x009e, 0xa867, 0x0000,
+	0xa868, 0xc0fd, 0xa86a, 0xa823, 0x0000, 0xa804, 0x2048, 0x080c,
+	0xccdf, 0x1120, 0x2009, 0x0003, 0x0804, 0x3556, 0x7007, 0x0003,
+	0x701f, 0x51c8, 0x0005, 0x009e, 0x2009, 0x0002, 0x0804, 0x3556,
+	0x7124, 0x080c, 0x32bb, 0xa820, 0x9086, 0x8001, 0x1120, 0x2009,
+	0x0004, 0x0804, 0x3556, 0x2900, 0x7022, 0xa804, 0x0096, 0x2048,
+	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x009e,
+	0x9080, 0x0002, 0x0076, 0x0006, 0x2098, 0x20a0, 0x27e0, 0x27e8,
+	0x20a9, 0x002a, 0x080c, 0x0f7c, 0xaa6c, 0xab70, 0xac74, 0xad78,
+	0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xae64, 0xaf8c, 0x97c6,
+	0x7000, 0x0118, 0x97c6, 0x7100, 0x1148, 0x96c2, 0x0004, 0x0600,
+	0x2009, 0x0004, 0x000e, 0x007e, 0x0804, 0x4af0, 0x97c6, 0x7200,
+	0x11b8, 0x96c2, 0x0054, 0x02a0, 0x000e, 0x007e, 0x2061, 0x18b8,
+	0x2c44, 0xa076, 0xa772, 0xa07b, 0x002a, 0xa28e, 0xa392, 0xa496,
+	0xa59a, 0x080c, 0x10e9, 0x7007, 0x0002, 0x701f, 0x5224, 0x0005,
+	0x000e, 0x007e, 0x0804, 0x3559, 0x7020, 0x2048, 0xa804, 0x2048,
+	0xa804, 0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
+	0xffc0, 0x9080, 0x0002, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9,
+	0x002a, 0x080c, 0x0f7c, 0x2100, 0x2238, 0x2061, 0x18b8, 0x2c44,
+	0xa28c, 0xa390, 0xa494, 0xa598, 0x2009, 0x002a, 0x0804, 0x4af0,
+	0x81ff, 0x1904, 0x3556, 0x798c, 0x2001, 0x197e, 0x918c, 0x8000,
+	0x2102, 0x080c, 0x4abb, 0x0904, 0x3559, 0x080c, 0x6972, 0x0120,
+	0x080c, 0x697a, 0x1904, 0x3559, 0x080c, 0x66c6, 0x0904, 0x3556,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x678c, 0x012e, 0x0904, 0x3556,
+	0x2001, 0x197e, 0x2004, 0xd0fc, 0x1904, 0x3524, 0x0804, 0x451c,
+	0xa9a0, 0x2001, 0x197e, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c,
+	0x4ac8, 0x01a0, 0x080c, 0x6972, 0x0118, 0x080c, 0x697a, 0x1170,
+	0x080c, 0x66c6, 0x2009, 0x0002, 0x0128, 0x080c, 0x678c, 0x1170,
+	0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
+	0x2001, 0x197e, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x56d7, 0x0110,
+	0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005,
+	0x78a8, 0xd08c, 0x1118, 0xd084, 0x0904, 0x4491, 0x080c, 0x4ad7,
+	0x0904, 0x3559, 0x080c, 0x4aa4, 0x1120, 0x2009, 0x0002, 0x0804,
+	0x3556, 0x080c, 0x6972, 0x0130, 0x908e, 0x0004, 0x0118, 0x908e,
+	0x0005, 0x15a0, 0x78a8, 0xd08c, 0x0120, 0xb800, 0xc08c, 0xb802,
+	0x0028, 0x080c, 0x56cf, 0xd0b4, 0x0904, 0x44cb, 0x7884, 0x908e,
+	0x007e, 0x0904, 0x44cb, 0x908e, 0x007f, 0x0904, 0x44cb, 0x908e,
+	0x0080, 0x0904, 0x44cb, 0xb800, 0xd08c, 0x1904, 0x44cb, 0xa867,
+	0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xccfe, 0x1120, 0x2009,
+	0x0003, 0x0804, 0x3556, 0x7007, 0x0003, 0x701f, 0x52f0, 0x0005,
+	0x080c, 0x4ad7, 0x0904, 0x3559, 0x0804, 0x44cb, 0x080c, 0x3314,
+	0x0108, 0x0005, 0x2009, 0x1834, 0x210c, 0x81ff, 0x0120, 0x2009,
+	0x0001, 0x0804, 0x3556, 0x080c, 0x56e3, 0x0120, 0x2009, 0x0007,
+	0x0804, 0x3556, 0x080c, 0x696a, 0x0120, 0x2009, 0x0008, 0x0804,
+	0x3556, 0xb89c, 0xd0a4, 0x1118, 0xd0ac, 0x1904, 0x44cb, 0x9006,
+	0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xcd58, 0x1120,
+	0x2009, 0x0003, 0x0804, 0x3556, 0x7007, 0x0003, 0x701f, 0x5329,
+	0x0005, 0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804,
+	0x562c, 0x080c, 0x4ad7, 0x0904, 0x3559, 0x0804, 0x52c2, 0x81ff,
+	0x2009, 0x0001, 0x1904, 0x3556, 0x080c, 0x56e3, 0x2009, 0x0007,
+	0x1904, 0x3556, 0x080c, 0x696a, 0x0120, 0x2009, 0x0008, 0x0804,
+	0x3556, 0x080c, 0x4ad7, 0x0904, 0x3559, 0x080c, 0x6972, 0x2009,
+	0x0009, 0x1904, 0x3556, 0x080c, 0x4aa4, 0x2009, 0x0002, 0x0904,
+	0x3556, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x7988,
+	0x9194, 0xff00, 0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128, 0xc0ed,
+	0xa952, 0x798c, 0xa956, 0x0038, 0x928e, 0x0100, 0x1904, 0x3559,
+	0xc0e5, 0xa952, 0xa956, 0xa83e, 0x080c, 0xcfab, 0x2009, 0x0003,
+	0x0904, 0x3556, 0x7007, 0x0003, 0x701f, 0x537f, 0x0005, 0xa830,
+	0x9086, 0x0100, 0x2009, 0x0004, 0x0904, 0x3556, 0x0804, 0x3524,
+	0x7aa8, 0x9284, 0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c, 0x56e3,
+	0x1188, 0x2009, 0x0014, 0x0804, 0x3556, 0xd2dc, 0x1568, 0x81ff,
+	0x2009, 0x0001, 0x1904, 0x3556, 0x080c, 0x56e3, 0x2009, 0x0007,
+	0x1904, 0x3556, 0xd2f4, 0x0130, 0x9284, 0x5000, 0x080c, 0x56aa,
+	0x0804, 0x3524, 0xd2fc, 0x0158, 0x080c, 0x4ad7, 0x0904, 0x3559,
+	0x7984, 0x9284, 0x9000, 0x080c, 0x5687, 0x0804, 0x3524, 0x080c,
+	0x4ad7, 0x0904, 0x3559, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006,
+	0x2009, 0x0009, 0x1904, 0x5468, 0x080c, 0x4aa4, 0x2009, 0x0002,
+	0x0904, 0x5468, 0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009, 0x0008,
+	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4aed, 0x701f, 0x53d9,
+	0x0005, 0xa86c, 0x9086, 0x0500, 0x1138, 0xa870, 0x9005, 0x1120,
+	0xa874, 0x9084, 0xff00, 0x0110, 0x1904, 0x3559, 0xa866, 0xa832,
+	0xa868, 0xc0fd, 0xa86a, 0x080c, 0x4ad7, 0x1110, 0x0804, 0x3559,
+	0x2009, 0x0043, 0x080c, 0xd013, 0x2009, 0x0003, 0x0904, 0x5468,
+	0x7007, 0x0003, 0x701f, 0x53fd, 0x0005, 0xa830, 0x9086, 0x0100,
+	0x2009, 0x0004, 0x0904, 0x5468, 0x7984, 0x7aa8, 0x9284, 0x1000,
+	0x080c, 0x5687, 0x0804, 0x3524, 0x00c6, 0xaab0, 0x9284, 0xc000,
+	0x0140, 0xd2ec, 0x0168, 0x080c, 0x56e3, 0x1150, 0x2009, 0x0014,
+	0x04f0, 0x2061, 0x1800, 0x080c, 0x56e3, 0x2009, 0x0007, 0x15b8,
+	0xd2f4, 0x0128, 0x9284, 0x5000, 0x080c, 0x56aa, 0x0050, 0xd2fc,
+	0x0178, 0x080c, 0x4ad5, 0x0588, 0xa998, 0x9284, 0x9000, 0x080c,
+	0x5687, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0438,
+	0x080c, 0x4ad5, 0x0510, 0x080c, 0x6972, 0x2009, 0x0009, 0x11b8,
+	0xa8c4, 0x9086, 0x0500, 0x11c8, 0xa8c8, 0x9005, 0x11b0, 0xa8cc,
+	0x9084, 0xff00, 0x1190, 0x080c, 0x4ad5, 0x1108, 0x0070, 0x2009,
+	0x004b, 0x080c, 0xd013, 0x2009, 0x0003, 0x0108, 0x0078, 0x0429,
+	0x19c0, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e,
+	0x9085, 0x0001, 0x2001, 0x0030, 0x00ce, 0x0005, 0x9006, 0x0ce0,
+	0x7aa8, 0xd2dc, 0x0904, 0x3556, 0x0016, 0x7984, 0x9284, 0x1000,
+	0xc0fd, 0x080c, 0x5687, 0x001e, 0x1904, 0x3556, 0x0804, 0x3524,
+	0x00f6, 0x2d78, 0x0011, 0x00fe, 0x0005, 0xaab0, 0xd2dc, 0x0150,
+	0x0016, 0xa998, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5687, 0x001e,
+	0x9085, 0x0001, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
+	0x3556, 0x080c, 0x56e3, 0x0120, 0x2009, 0x0007, 0x0804, 0x3556,
+	0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x65ff, 0x1904, 0x3559,
+	0x9186, 0x007f, 0x0138, 0x080c, 0x6972, 0x0120, 0x2009, 0x0009,
+	0x0804, 0x3556, 0x080c, 0x4aa4, 0x1120, 0x2009, 0x0002, 0x0804,
+	0x3556, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001, 0x0100,
+	0x8007, 0xa80a, 0x080c, 0xcd18, 0x1120, 0x2009, 0x0003, 0x0804,
+	0x3556, 0x7007, 0x0003, 0x701f, 0x54c6, 0x0005, 0xa808, 0x8007,
+	0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x3556, 0xa8e0,
+	0xa866, 0xa810, 0x8007, 0x9084, 0x00ff, 0x800c, 0xa814, 0x8007,
+	0x9084, 0x00ff, 0x8004, 0x9080, 0x0002, 0x9108, 0x8906, 0x8006,
+	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0004, 0x7a8c,
+	0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x4af0, 0x080c, 0x4aa4, 0x1120,
+	0x2009, 0x0002, 0x0804, 0x3556, 0x7984, 0x9194, 0xff00, 0x918c,
+	0x00ff, 0x8217, 0x82ff, 0x1118, 0x7023, 0x19b3, 0x0040, 0x92c6,
+	0x0001, 0x1118, 0x7023, 0x19cd, 0x0010, 0x0804, 0x3559, 0x2009,
 	0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019,
-	0xaf60, 0x0804, 0x4af1, 0x7884, 0x908a, 0x1000, 0x1a04, 0x3552,
-	0x0126, 0x2091, 0x8000, 0x8003, 0x800b, 0x810b, 0x9108, 0x00c6,
-	0x2061, 0x19fa, 0x6142, 0x00ce, 0x012e, 0x0804, 0x351d, 0x00c6,
-	0x080c, 0x73b0, 0x1160, 0x080c, 0x7698, 0x080c, 0x601b, 0x9085,
-	0x0001, 0x080c, 0x73f7, 0x080c, 0x72e2, 0x080c, 0x0dd5, 0x2061,
-	0x1800, 0x6030, 0xc09d, 0x6032, 0x080c, 0x5eda, 0x00ce, 0x0005,
-	0x00c6, 0x2001, 0x1800, 0x2004, 0x908e, 0x0000, 0x0904, 0x354f,
-	0x7884, 0x9005, 0x0188, 0x7888, 0x2061, 0x199c, 0x2c0c, 0x2062,
-	0x080c, 0x2c20, 0x01a0, 0x080c, 0x2c28, 0x0188, 0x080c, 0x2c30,
-	0x0170, 0x2162, 0x0804, 0x3552, 0x2061, 0x0100, 0x6038, 0x9086,
-	0x0007, 0x1118, 0x2009, 0x0001, 0x0010, 0x2009, 0x0000, 0x7884,
-	0x9086, 0x0002, 0x1548, 0x2061, 0x0100, 0x6028, 0xc09c, 0x602a,
-	0x0026, 0x2011, 0x0003, 0x080c, 0xa639, 0x2011, 0x0002, 0x080c,
-	0xa643, 0x002e, 0x080c, 0xa526, 0x0036, 0x901e, 0x080c, 0xa59c,
-	0x003e, 0x60e3, 0x0000, 0x080c, 0xe9c8, 0x080c, 0xe9e3, 0x9085,
-	0x0001, 0x080c, 0x73f7, 0x9006, 0x080c, 0x2cef, 0x2001, 0x1800,
-	0x2003, 0x0004, 0x6027, 0x0008, 0x00ce, 0x0804, 0x351d, 0x81ff,
-	0x0120, 0x2009, 0x0001, 0x0804, 0x354f, 0x080c, 0x56e4, 0x0120,
-	0x2009, 0x0007, 0x0804, 0x354f, 0x7984, 0x7ea8, 0x96b4, 0x00ff,
-	0x080c, 0x6600, 0x1904, 0x3552, 0x9186, 0x007f, 0x0138, 0x080c,
-	0x696a, 0x0120, 0x2009, 0x0009, 0x0804, 0x354f, 0x080c, 0x4aa5,
-	0x1120, 0x2009, 0x0002, 0x0804, 0x354f, 0xa867, 0x0000, 0xa868,
-	0xc0fd, 0xa86a, 0x080c, 0xcd01, 0x1120, 0x2009, 0x0003, 0x0804,
-	0x354f, 0x7007, 0x0003, 0x701f, 0x5616, 0x0005, 0xa830, 0x9086,
-	0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x354f, 0xa8e0, 0xa866,
-	0xa834, 0x8007, 0x800c, 0xa85c, 0x9080, 0x000c, 0x7a8c, 0x7b88,
-	0x7c9c, 0x7d98, 0xaf60, 0x0804, 0x4af1, 0xa898, 0x9086, 0x000d,
-	0x1904, 0x354f, 0x2021, 0x4005, 0x0126, 0x2091, 0x8000, 0x0e04,
-	0x563a, 0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118,
-	0x7833, 0x0011, 0x0010, 0x7833, 0x0010, 0x7883, 0x4005, 0xa998,
-	0x7986, 0xa9a4, 0x799a, 0xa9a8, 0x799e, 0x080c, 0x4ae1, 0x2091,
-	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x7007,
-	0x0001, 0x2091, 0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x0126,
-	0x2091, 0x8000, 0x00c6, 0x2061, 0x19fa, 0x7984, 0x6152, 0x614e,
-	0x6057, 0x0000, 0x604b, 0x0009, 0x7898, 0x606a, 0x789c, 0x6066,
-	0x7888, 0x6062, 0x788c, 0x605e, 0x2001, 0x1a08, 0x2044, 0x2001,
-	0x1a0f, 0xa076, 0xa060, 0xa072, 0xa07b, 0x0001, 0xa07f, 0x0002,
-	0xa06b, 0x0000, 0xa09f, 0x0000, 0x00ce, 0x012e, 0x0804, 0x351d,
-	0x0126, 0x2091, 0x8000, 0x00b6, 0x00c6, 0x90e4, 0xc000, 0x0128,
-	0x0006, 0x080c, 0xcb68, 0x000e, 0x1198, 0xd0e4, 0x0160, 0x9180,
-	0x1000, 0x2004, 0x905d, 0x0160, 0x080c, 0x6035, 0x080c, 0xadb1,
-	0x0110, 0xb817, 0x0000, 0x9006, 0x00ce, 0x00be, 0x012e, 0x0005,
-	0x9085, 0x0001, 0x0cc8, 0x0126, 0x2091, 0x8000, 0x0156, 0x2010,
-	0x900e, 0x20a9, 0x0800, 0x0016, 0x9180, 0x1000, 0x2004, 0x9005,
-	0x0180, 0x9186, 0x007e, 0x0168, 0x9186, 0x007f, 0x0150, 0x9186,
-	0x0080, 0x0138, 0x9186, 0x00ff, 0x0120, 0x0026, 0x2200, 0x0801,
-	0x002e, 0x001e, 0x8108, 0x1f04, 0x56b3, 0x015e, 0x012e, 0x0005,
-	0x2001, 0x1848, 0x2004, 0x0005, 0x2001, 0x1867, 0x2004, 0x0005,
-	0x0006, 0x2001, 0x1810, 0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001,
-	0x180e, 0x2004, 0xd0b4, 0x0005, 0x2001, 0x1800, 0x2004, 0x9086,
-	0x0003, 0x0005, 0x0016, 0x00e6, 0x2071, 0x189e, 0x7108, 0x910d,
-	0x710a, 0x00ee, 0x001e, 0x0005, 0x79a4, 0x9182, 0x0081, 0x1a04,
-	0x3552, 0x810c, 0x0016, 0x080c, 0x4aa5, 0x080c, 0x0f07, 0x2100,
-	0x2238, 0x7d84, 0x7c88, 0x7b8c, 0x7a90, 0x001e, 0x080c, 0x4aee,
-	0x701f, 0x570b, 0x0005, 0x2079, 0x0000, 0x7d94, 0x7c98, 0x7ba8,
-	0x7aac, 0x79a4, 0x810c, 0x2061, 0x18b8, 0x2c44, 0xa770, 0xa074,
-	0x2071, 0x189e, 0x080c, 0x4af1, 0x701f, 0x571f, 0x0005, 0x2061,
-	0x18b8, 0x2c44, 0x0016, 0x0026, 0xa270, 0xa174, 0x080c, 0x0f0f,
-	0x002e, 0x001e, 0x080c, 0x0fbc, 0x9006, 0xa802, 0xa806, 0x0804,
-	0x351d, 0x0126, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6,
-	0x00d6, 0x00e6, 0x00f6, 0x2061, 0x0100, 0x2069, 0x0200, 0x2071,
-	0x1800, 0x6044, 0xd0a4, 0x11e8, 0xd084, 0x0118, 0x080c, 0x58da,
-	0x0068, 0xd08c, 0x0118, 0x080c, 0x57e3, 0x0040, 0xd094, 0x0118,
-	0x080c, 0x57b3, 0x0018, 0xd09c, 0x0108, 0x0099, 0x00fe, 0x00ee,
-	0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x012e,
-	0x0005, 0x0016, 0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e,
-	0x0c68, 0x0006, 0x7098, 0x9005, 0x000e, 0x0120, 0x709b, 0x0000,
-	0x7093, 0x0000, 0x624c, 0x9286, 0xf0f0, 0x1150, 0x6048, 0x9086,
-	0xf0f0, 0x0130, 0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0490,
-	0x9294, 0xff00, 0x9296, 0xf700, 0x0178, 0x7138, 0xd1a4, 0x1160,
-	0x6240, 0x9295, 0x0100, 0x6242, 0x9294, 0x0010, 0x0128, 0x2009,
-	0x00f7, 0x080c, 0x5f97, 0x00f0, 0x6040, 0x9084, 0x0010, 0x9085,
-	0x0140, 0x6042, 0x6043, 0x0000, 0x7087, 0x0000, 0x70a3, 0x0001,
-	0x70c7, 0x0000, 0x70df, 0x0000, 0x2009, 0x1c80, 0x200b, 0x0000,
-	0x7097, 0x0000, 0x708b, 0x000f, 0x2009, 0x000f, 0x2011, 0x5e7d,
-	0x080c, 0x8562, 0x0005, 0x2001, 0x1869, 0x2004, 0xd08c, 0x0110,
-	0x705f, 0xffff, 0x7088, 0x9005, 0x1528, 0x2011, 0x5e7d, 0x080c,
-	0x84ca, 0x6040, 0x9094, 0x0010, 0x9285, 0x0020, 0x6042, 0x20a9,
-	0x00c8, 0x6044, 0xd08c, 0x1168, 0x1f04, 0x57c9, 0x6242, 0x709b,
-	0x0000, 0x6040, 0x9094, 0x0010, 0x9285, 0x0080, 0x6042, 0x6242,
-	0x0048, 0x6242, 0x709b, 0x0000, 0x708f, 0x0000, 0x9006, 0x080c,
-	0x6020, 0x0000, 0x0005, 0x708c, 0x908a, 0x0003, 0x1a0c, 0x0dd5,
-	0x000b, 0x0005, 0x57ed, 0x583e, 0x58d9, 0x00f6, 0x0016, 0x6900,
-	0x918c, 0x0800, 0x708f, 0x0001, 0x2001, 0x015d, 0x2003, 0x0000,
-	0x6803, 0x00fc, 0x20a9, 0x0004, 0x6800, 0x9084, 0x00fc, 0x0120,
-	0x1f04, 0x57fc, 0x080c, 0x0dd5, 0x68a0, 0x68a2, 0x689c, 0x689e,
-	0x6898, 0x689a, 0xa001, 0x918d, 0x1600, 0x6902, 0x001e, 0x6837,
-	0x0020, 0x080c, 0x5ffc, 0x2079, 0x1c00, 0x7833, 0x1101, 0x7837,
-	0x0000, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0001, 0x20a1,
-	0x1c0e, 0x20a9, 0x0004, 0x4003, 0x080c, 0xab07, 0x20e1, 0x0001,
+	0xaf60, 0x080c, 0x4aed, 0x701f, 0x5516, 0x0005, 0x2001, 0x182e,
+	0x2003, 0x0001, 0xa85c, 0x9080, 0x0019, 0x2098, 0xa860, 0x20e0,
+	0x20a9, 0x001a, 0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003, 0x0804,
+	0x3524, 0x080c, 0x4aa4, 0x1120, 0x2009, 0x0002, 0x0804, 0x3556,
+	0x7984, 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118,
+	0x2099, 0x19b3, 0x0040, 0x92c6, 0x0001, 0x1118, 0x2099, 0x19cd,
+	0x0010, 0x0804, 0x3559, 0xa85c, 0x9080, 0x0019, 0x20a0, 0xa860,
+	0x20e8, 0x20a9, 0x001a, 0x20e1, 0x0001, 0x4003, 0x2009, 0x001a,
+	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60,
+	0x0804, 0x4af0, 0x7884, 0x908a, 0x1000, 0x1a04, 0x3559, 0x0126,
+	0x2091, 0x8000, 0x8003, 0x800b, 0x810b, 0x9108, 0x00c6, 0x2061,
+	0x19fa, 0x6142, 0x00ce, 0x012e, 0x0804, 0x3524, 0x00c6, 0x080c,
+	0x73bc, 0x1160, 0x080c, 0x76a4, 0x080c, 0x601a, 0x9085, 0x0001,
+	0x080c, 0x7403, 0x080c, 0x72ee, 0x080c, 0x0dd5, 0x2061, 0x1800,
+	0x6030, 0xc09d, 0x6032, 0x080c, 0x5ed9, 0x00ce, 0x0005, 0x00c6,
+	0x2001, 0x1800, 0x2004, 0x908e, 0x0000, 0x0904, 0x3556, 0x7884,
+	0x9005, 0x0188, 0x7888, 0x2061, 0x199c, 0x2c0c, 0x2062, 0x080c,
+	0x2c20, 0x01a0, 0x080c, 0x2c28, 0x0188, 0x080c, 0x2c30, 0x0170,
+	0x2162, 0x0804, 0x3559, 0x2061, 0x0100, 0x6038, 0x9086, 0x0007,
+	0x1118, 0x2009, 0x0001, 0x0010, 0x2009, 0x0000, 0x7884, 0x9086,
+	0x0002, 0x1548, 0x2061, 0x0100, 0x6028, 0xc09c, 0x602a, 0x0026,
+	0x2011, 0x0003, 0x080c, 0xa653, 0x2011, 0x0002, 0x080c, 0xa65d,
+	0x002e, 0x080c, 0xa540, 0x0036, 0x901e, 0x080c, 0xa5b6, 0x003e,
+	0x60e3, 0x0000, 0x080c, 0xe9e9, 0x080c, 0xea04, 0x9085, 0x0001,
+	0x080c, 0x7403, 0x9006, 0x080c, 0x2cef, 0x2001, 0x1800, 0x2003,
+	0x0004, 0x6027, 0x0008, 0x00ce, 0x0804, 0x3524, 0x81ff, 0x0120,
+	0x2009, 0x0001, 0x0804, 0x3556, 0x080c, 0x56e3, 0x0120, 0x2009,
+	0x0007, 0x0804, 0x3556, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c,
+	0x65ff, 0x1904, 0x3559, 0x9186, 0x007f, 0x0138, 0x080c, 0x6972,
+	0x0120, 0x2009, 0x0009, 0x0804, 0x3556, 0x080c, 0x4aa4, 0x1120,
+	0x2009, 0x0002, 0x0804, 0x3556, 0xa867, 0x0000, 0xa868, 0xc0fd,
+	0xa86a, 0x080c, 0xcd1b, 0x1120, 0x2009, 0x0003, 0x0804, 0x3556,
+	0x7007, 0x0003, 0x701f, 0x5615, 0x0005, 0xa830, 0x9086, 0x0100,
+	0x1120, 0x2009, 0x0004, 0x0804, 0x3556, 0xa8e0, 0xa866, 0xa834,
+	0x8007, 0x800c, 0xa85c, 0x9080, 0x000c, 0x7a8c, 0x7b88, 0x7c9c,
+	0x7d98, 0xaf60, 0x0804, 0x4af0, 0xa898, 0x9086, 0x000d, 0x1904,
+	0x3556, 0x2021, 0x4005, 0x0126, 0x2091, 0x8000, 0x0e04, 0x5639,
+	0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833,
+	0x0011, 0x0010, 0x7833, 0x0010, 0x7883, 0x4005, 0xa998, 0x7986,
+	0xa9a4, 0x799a, 0xa9a8, 0x799e, 0x080c, 0x4ae0, 0x2091, 0x4080,
+	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x7007, 0x0001,
+	0x2091, 0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x0126, 0x2091,
+	0x8000, 0x00c6, 0x2061, 0x19fa, 0x7984, 0x6152, 0x614e, 0x6057,
+	0x0000, 0x604b, 0x0009, 0x7898, 0x606a, 0x789c, 0x6066, 0x7888,
+	0x6062, 0x788c, 0x605e, 0x2001, 0x1a08, 0x2044, 0x2001, 0x1a0f,
+	0xa076, 0xa060, 0xa072, 0xa07b, 0x0001, 0xa07f, 0x0002, 0xa06b,
+	0x0000, 0xa09f, 0x0000, 0x00ce, 0x012e, 0x0804, 0x3524, 0x0126,
+	0x2091, 0x8000, 0x00b6, 0x00c6, 0x90e4, 0xc000, 0x0128, 0x0006,
+	0x080c, 0xcb82, 0x000e, 0x1198, 0xd0e4, 0x0160, 0x9180, 0x1000,
+	0x2004, 0x905d, 0x0160, 0x080c, 0x6034, 0x080c, 0xadcb, 0x0110,
+	0xb817, 0x0000, 0x9006, 0x00ce, 0x00be, 0x012e, 0x0005, 0x9085,
+	0x0001, 0x0cc8, 0x0126, 0x2091, 0x8000, 0x0156, 0x2010, 0x900e,
+	0x20a9, 0x0800, 0x0016, 0x9180, 0x1000, 0x2004, 0x9005, 0x0180,
+	0x9186, 0x007e, 0x0168, 0x9186, 0x007f, 0x0150, 0x9186, 0x0080,
+	0x0138, 0x9186, 0x00ff, 0x0120, 0x0026, 0x2200, 0x0801, 0x002e,
+	0x001e, 0x8108, 0x1f04, 0x56b2, 0x015e, 0x012e, 0x0005, 0x2001,
+	0x1848, 0x2004, 0x0005, 0x2001, 0x1867, 0x2004, 0x0005, 0x0006,
+	0x2001, 0x1810, 0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001, 0x180e,
+	0x2004, 0xd0b4, 0x0005, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003,
+	0x0005, 0x0016, 0x00e6, 0x2071, 0x189e, 0x7108, 0x910d, 0x710a,
+	0x00ee, 0x001e, 0x0005, 0x79a4, 0x9182, 0x0081, 0x1a04, 0x3559,
+	0x810c, 0x0016, 0x080c, 0x4aa4, 0x080c, 0x0f07, 0x2100, 0x2238,
+	0x7d84, 0x7c88, 0x7b8c, 0x7a90, 0x001e, 0x080c, 0x4aed, 0x701f,
+	0x570a, 0x0005, 0x2079, 0x0000, 0x7d94, 0x7c98, 0x7ba8, 0x7aac,
+	0x79a4, 0x810c, 0x2061, 0x18b8, 0x2c44, 0xa770, 0xa074, 0x2071,
+	0x189e, 0x080c, 0x4af0, 0x701f, 0x571e, 0x0005, 0x2061, 0x18b8,
+	0x2c44, 0x0016, 0x0026, 0xa270, 0xa174, 0x080c, 0x0f0f, 0x002e,
+	0x001e, 0x080c, 0x0fbc, 0x9006, 0xa802, 0xa806, 0x0804, 0x3524,
+	0x0126, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6,
+	0x00e6, 0x00f6, 0x2061, 0x0100, 0x2069, 0x0200, 0x2071, 0x1800,
+	0x6044, 0xd0a4, 0x11e8, 0xd084, 0x0118, 0x080c, 0x58d9, 0x0068,
+	0xd08c, 0x0118, 0x080c, 0x57e2, 0x0040, 0xd094, 0x0118, 0x080c,
+	0x57b2, 0x0018, 0xd09c, 0x0108, 0x0099, 0x00fe, 0x00ee, 0x00de,
+	0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x012e, 0x0005,
+	0x0016, 0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e, 0x0c68,
+	0x0006, 0x7098, 0x9005, 0x000e, 0x0120, 0x709b, 0x0000, 0x7093,
+	0x0000, 0x624c, 0x9286, 0xf0f0, 0x1150, 0x6048, 0x9086, 0xf0f0,
+	0x0130, 0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0490, 0x9294,
+	0xff00, 0x9296, 0xf700, 0x0178, 0x7138, 0xd1a4, 0x1160, 0x6240,
+	0x9295, 0x0100, 0x6242, 0x9294, 0x0010, 0x0128, 0x2009, 0x00f7,
+	0x080c, 0x5f96, 0x00f0, 0x6040, 0x9084, 0x0010, 0x9085, 0x0140,
+	0x6042, 0x6043, 0x0000, 0x7087, 0x0000, 0x70a3, 0x0001, 0x70c7,
+	0x0000, 0x70df, 0x0000, 0x2009, 0x1c80, 0x200b, 0x0000, 0x7097,
+	0x0000, 0x708b, 0x000f, 0x2009, 0x000f, 0x2011, 0x5e7c, 0x080c,
+	0x858b, 0x0005, 0x2001, 0x1869, 0x2004, 0xd08c, 0x0110, 0x705f,
+	0xffff, 0x7088, 0x9005, 0x1528, 0x2011, 0x5e7c, 0x080c, 0x84f3,
+	0x6040, 0x9094, 0x0010, 0x9285, 0x0020, 0x6042, 0x20a9, 0x00c8,
+	0x6044, 0xd08c, 0x1168, 0x1f04, 0x57c8, 0x6242, 0x709b, 0x0000,
+	0x6040, 0x9094, 0x0010, 0x9285, 0x0080, 0x6042, 0x6242, 0x0048,
+	0x6242, 0x709b, 0x0000, 0x708f, 0x0000, 0x9006, 0x080c, 0x601f,
+	0x0000, 0x0005, 0x708c, 0x908a, 0x0003, 0x1a0c, 0x0dd5, 0x000b,
+	0x0005, 0x57ec, 0x583d, 0x58d8, 0x00f6, 0x0016, 0x6900, 0x918c,
+	0x0800, 0x708f, 0x0001, 0x2001, 0x015d, 0x2003, 0x0000, 0x6803,
+	0x00fc, 0x20a9, 0x0004, 0x6800, 0x9084, 0x00fc, 0x0120, 0x1f04,
+	0x57fb, 0x080c, 0x0dd5, 0x68a0, 0x68a2, 0x689c, 0x689e, 0x6898,
+	0x689a, 0xa001, 0x918d, 0x1600, 0x6902, 0x001e, 0x6837, 0x0020,
+	0x080c, 0x5ffb, 0x2079, 0x1c00, 0x7833, 0x1101, 0x7837, 0x0000,
+	0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0001, 0x20a1, 0x1c0e,
+	0x20a9, 0x0004, 0x4003, 0x080c, 0xab21, 0x20e1, 0x0001, 0x2099,
+	0x1c00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003,
+	0x60c3, 0x000c, 0x600f, 0x0000, 0x080c, 0x5ead, 0x00fe, 0x9006,
+	0x7092, 0x6043, 0x0008, 0x6042, 0x0005, 0x00f6, 0x7090, 0x7093,
+	0x0000, 0x9025, 0x0904, 0x58b5, 0x6020, 0xd0b4, 0x1904, 0x58b3,
+	0x71a0, 0x81ff, 0x0904, 0x58a1, 0x9486, 0x000c, 0x1904, 0x58ae,
+	0x9480, 0x0018, 0x8004, 0x20a8, 0x080c, 0x5ff4, 0x2011, 0x0260,
+	0x2019, 0x1c00, 0x220c, 0x2304, 0x9106, 0x11e8, 0x8210, 0x8318,
+	0x1f04, 0x585a, 0x6043, 0x0004, 0x2061, 0x0140, 0x605b, 0xbc94,
+	0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043, 0x0006, 0x708f, 0x0002,
+	0x709b, 0x0002, 0x2009, 0x07d0, 0x2011, 0x5e83, 0x080c, 0x858b,
+	0x080c, 0x5ffb, 0x04c0, 0x080c, 0x5ff4, 0x2079, 0x0260, 0x7930,
+	0x918e, 0x1101, 0x1558, 0x7834, 0x9005, 0x1540, 0x7900, 0x918c,
+	0x00ff, 0x1118, 0x7804, 0x9005, 0x0190, 0x080c, 0x5ff4, 0x2011,
+	0x026e, 0x2019, 0x1805, 0x20a9, 0x0004, 0x220c, 0x2304, 0x9102,
+	0x0230, 0x11a0, 0x8210, 0x8318, 0x1f04, 0x5895, 0x0078, 0x70a3,
+	0x0000, 0x080c, 0x5ff4, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9,
+	0x0001, 0x20a1, 0x1c00, 0x20a9, 0x0014, 0x4003, 0x6043, 0x0008,
+	0x6043, 0x0000, 0x0010, 0x00fe, 0x0005, 0x6040, 0x9085, 0x0100,
+	0x6042, 0x6020, 0xd0b4, 0x1db8, 0x080c, 0xab21, 0x20e1, 0x0001,
 	0x2099, 0x1c00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014,
-	0x4003, 0x60c3, 0x000c, 0x600f, 0x0000, 0x080c, 0x5eae, 0x00fe,
-	0x9006, 0x7092, 0x6043, 0x0008, 0x6042, 0x0005, 0x00f6, 0x7090,
-	0x7093, 0x0000, 0x9025, 0x0904, 0x58b6, 0x6020, 0xd0b4, 0x1904,
-	0x58b4, 0x71a0, 0x81ff, 0x0904, 0x58a2, 0x9486, 0x000c, 0x1904,
-	0x58af, 0x9480, 0x0018, 0x8004, 0x20a8, 0x080c, 0x5ff5, 0x2011,
-	0x0260, 0x2019, 0x1c00, 0x220c, 0x2304, 0x9106, 0x11e8, 0x8210,
-	0x8318, 0x1f04, 0x585b, 0x6043, 0x0004, 0x2061, 0x0140, 0x605b,
-	0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043, 0x0006, 0x708f,
-	0x0002, 0x709b, 0x0002, 0x2009, 0x07d0, 0x2011, 0x5e84, 0x080c,
-	0x8562, 0x080c, 0x5ffc, 0x04c0, 0x080c, 0x5ff5, 0x2079, 0x0260,
-	0x7930, 0x918e, 0x1101, 0x1558, 0x7834, 0x9005, 0x1540, 0x7900,
-	0x918c, 0x00ff, 0x1118, 0x7804, 0x9005, 0x0190, 0x080c, 0x5ff5,
-	0x2011, 0x026e, 0x2019, 0x1805, 0x20a9, 0x0004, 0x220c, 0x2304,
-	0x9102, 0x0230, 0x11a0, 0x8210, 0x8318, 0x1f04, 0x5896, 0x0078,
-	0x70a3, 0x0000, 0x080c, 0x5ff5, 0x20e1, 0x0000, 0x2099, 0x0260,
-	0x20e9, 0x0001, 0x20a1, 0x1c00, 0x20a9, 0x0014, 0x4003, 0x6043,
-	0x0008, 0x6043, 0x0000, 0x0010, 0x00fe, 0x0005, 0x6040, 0x9085,
-	0x0100, 0x6042, 0x6020, 0xd0b4, 0x1db8, 0x080c, 0xab07, 0x20e1,
-	0x0001, 0x2099, 0x1c00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9,
-	0x0014, 0x4003, 0x60c3, 0x000c, 0x2011, 0x19f1, 0x2013, 0x0000,
-	0x7093, 0x0000, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0xa250,
-	0x08d8, 0x0005, 0x7098, 0x908a, 0x001d, 0x1a0c, 0x0dd5, 0x000b,
-	0x0005, 0x590b, 0x591e, 0x5947, 0x5967, 0x598d, 0x59bc, 0x59e2,
-	0x5a1a, 0x5a40, 0x5a6e, 0x5aa9, 0x5ae1, 0x5aff, 0x5b2a, 0x5b4c,
-	0x5b67, 0x5b71, 0x5ba5, 0x5bcb, 0x5bfa, 0x5c20, 0x5c58, 0x5c9c,
-	0x5cd9, 0x5cfa, 0x5d53, 0x5d75, 0x5da3, 0x5da3, 0x00c6, 0x2061,
-	0x1800, 0x6003, 0x0007, 0x2061, 0x0100, 0x6004, 0x9084, 0xfff9,
-	0x6006, 0x00ce, 0x0005, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f,
-	0xf0f0, 0x2061, 0x0100, 0x6043, 0x0002, 0x709b, 0x0001, 0x2009,
-	0x07d0, 0x2011, 0x5e84, 0x080c, 0x8562, 0x0005, 0x00f6, 0x7090,
-	0x9086, 0x0014, 0x1510, 0x6042, 0x6020, 0xd0b4, 0x11f0, 0x080c,
-	0x5ff5, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x11a0, 0x7834,
-	0x9005, 0x1188, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
-	0x70c7, 0x0001, 0x2011, 0x5e84, 0x080c, 0x84ca, 0x709b, 0x0010,
-	0x080c, 0x5b71, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6,
-	0x709b, 0x0003, 0x6043, 0x0004, 0x2011, 0x5e84, 0x080c, 0x84ca,
-	0x080c, 0x5f79, 0x2079, 0x0240, 0x7833, 0x1102, 0x7837, 0x0000,
-	0x20a9, 0x0008, 0x9f88, 0x000e, 0x200b, 0x0000, 0x8108, 0x1f04,
-	0x595c, 0x60c3, 0x0014, 0x080c, 0x5eae, 0x00fe, 0x0005, 0x00f6,
-	0x7090, 0x9005, 0x0500, 0x2011, 0x5e84, 0x080c, 0x84ca, 0x9086,
-	0x0014, 0x11b8, 0x080c, 0x5ff5, 0x2079, 0x0260, 0x7a30, 0x9296,
-	0x1102, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128,
-	0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0004, 0x0029,
-	0x0010, 0x080c, 0x5fd1, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0005,
-	0x080c, 0x5f79, 0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000,
-	0x080c, 0x5ff5, 0x080c, 0x5fd8, 0x1170, 0x7084, 0x9005, 0x1158,
-	0x715c, 0x9186, 0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5e31,
-	0x0168, 0x080c, 0x5fae, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099,
-	0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014,
-	0x080c, 0x5eae, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500,
-	0x2011, 0x5e84, 0x080c, 0x84ca, 0x9086, 0x0014, 0x11b8, 0x080c,
-	0x5ff5, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834,
-	0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
-	0x70c7, 0x0001, 0x709b, 0x0006, 0x0029, 0x0010, 0x080c, 0x5fd1,
-	0x00fe, 0x0005, 0x00f6, 0x709b, 0x0007, 0x080c, 0x5f79, 0x2079,
-	0x0240, 0x7833, 0x1104, 0x7837, 0x0000, 0x080c, 0x5ff5, 0x080c,
-	0x5fd8, 0x11b8, 0x7084, 0x9005, 0x11a0, 0x7164, 0x9186, 0xffff,
-	0x0180, 0x9180, 0x331e, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011,
-	0x0008, 0x080c, 0x5e31, 0x0180, 0x080c, 0x4fe2, 0x0110, 0x080c,
-	0x28a7, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-	0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5eae,
-	0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5e84,
-	0x080c, 0x84ca, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ff5, 0x2079,
-	0x0260, 0x7a30, 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160,
-	0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
-	0x709b, 0x0008, 0x0029, 0x0010, 0x080c, 0x5fd1, 0x00fe, 0x0005,
-	0x00f6, 0x709b, 0x0009, 0x080c, 0x5f79, 0x2079, 0x0240, 0x7833,
-	0x1105, 0x7837, 0x0100, 0x080c, 0x5fd8, 0x1150, 0x7084, 0x9005,
-	0x1138, 0x080c, 0x5da4, 0x1188, 0x9085, 0x0001, 0x080c, 0x28a7,
-	0x20a9, 0x0008, 0x080c, 0x5ff5, 0x20e1, 0x0000, 0x2099, 0x026e,
+	0x4003, 0x60c3, 0x000c, 0x2011, 0x19f1, 0x2013, 0x0000, 0x7093,
+	0x0000, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0xa26a, 0x08d8,
+	0x0005, 0x7098, 0x908a, 0x001d, 0x1a0c, 0x0dd5, 0x000b, 0x0005,
+	0x590a, 0x591d, 0x5946, 0x5966, 0x598c, 0x59bb, 0x59e1, 0x5a19,
+	0x5a3f, 0x5a6d, 0x5aa8, 0x5ae0, 0x5afe, 0x5b29, 0x5b4b, 0x5b66,
+	0x5b70, 0x5ba4, 0x5bca, 0x5bf9, 0x5c1f, 0x5c57, 0x5c9b, 0x5cd8,
+	0x5cf9, 0x5d52, 0x5d74, 0x5da2, 0x5da2, 0x00c6, 0x2061, 0x1800,
+	0x6003, 0x0007, 0x2061, 0x0100, 0x6004, 0x9084, 0xfff9, 0x6006,
+	0x00ce, 0x0005, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0,
+	0x2061, 0x0100, 0x6043, 0x0002, 0x709b, 0x0001, 0x2009, 0x07d0,
+	0x2011, 0x5e83, 0x080c, 0x858b, 0x0005, 0x00f6, 0x7090, 0x9086,
+	0x0014, 0x1510, 0x6042, 0x6020, 0xd0b4, 0x11f0, 0x080c, 0x5ff4,
+	0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x11a0, 0x7834, 0x9005,
+	0x1188, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
+	0x0001, 0x2011, 0x5e83, 0x080c, 0x84f3, 0x709b, 0x0010, 0x080c,
+	0x5b70, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b,
+	0x0003, 0x6043, 0x0004, 0x2011, 0x5e83, 0x080c, 0x84f3, 0x080c,
+	0x5f78, 0x2079, 0x0240, 0x7833, 0x1102, 0x7837, 0x0000, 0x20a9,
+	0x0008, 0x9f88, 0x000e, 0x200b, 0x0000, 0x8108, 0x1f04, 0x595b,
+	0x60c3, 0x0014, 0x080c, 0x5ead, 0x00fe, 0x0005, 0x00f6, 0x7090,
+	0x9005, 0x0500, 0x2011, 0x5e83, 0x080c, 0x84f3, 0x9086, 0x0014,
+	0x11b8, 0x080c, 0x5ff4, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102,
+	0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
+	0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0004, 0x0029, 0x0010,
+	0x080c, 0x5fd0, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0005, 0x080c,
+	0x5f78, 0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c,
+	0x5ff4, 0x080c, 0x5fd7, 0x1170, 0x7084, 0x9005, 0x1158, 0x715c,
+	0x9186, 0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5e30, 0x0168,
+	0x080c, 0x5fad, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e,
 	0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c,
-	0x5eae, 0x0010, 0x080c, 0x58fe, 0x00fe, 0x0005, 0x00f6, 0x7090,
-	0x9005, 0x05a8, 0x2011, 0x5e84, 0x080c, 0x84ca, 0x9086, 0x0014,
-	0x1560, 0x080c, 0x5ff5, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105,
-	0x1520, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1160,
+	0x5ead, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011,
+	0x5e83, 0x080c, 0x84f3, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ff4,
+	0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005,
+	0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
+	0x0001, 0x709b, 0x0006, 0x0029, 0x0010, 0x080c, 0x5fd0, 0x00fe,
+	0x0005, 0x00f6, 0x709b, 0x0007, 0x080c, 0x5f78, 0x2079, 0x0240,
+	0x7833, 0x1104, 0x7837, 0x0000, 0x080c, 0x5ff4, 0x080c, 0x5fd7,
+	0x11b8, 0x7084, 0x9005, 0x11a0, 0x7164, 0x9186, 0xffff, 0x0180,
+	0x9180, 0x3325, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008,
+	0x080c, 0x5e30, 0x0180, 0x080c, 0x4fe1, 0x0110, 0x080c, 0x28a7,
+	0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
+	0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5ead, 0x00fe,
+	0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5e83, 0x080c,
+	0x84f3, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ff4, 0x2079, 0x0260,
+	0x7a30, 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
+	0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b,
+	0x0008, 0x0029, 0x0010, 0x080c, 0x5fd0, 0x00fe, 0x0005, 0x00f6,
+	0x709b, 0x0009, 0x080c, 0x5f78, 0x2079, 0x0240, 0x7833, 0x1105,
+	0x7837, 0x0100, 0x080c, 0x5fd7, 0x1150, 0x7084, 0x9005, 0x1138,
+	0x080c, 0x5da3, 0x1188, 0x9085, 0x0001, 0x080c, 0x28a7, 0x20a9,
+	0x0008, 0x080c, 0x5ff4, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
+	0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5ead,
+	0x0010, 0x080c, 0x58fd, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
+	0x05a8, 0x2011, 0x5e83, 0x080c, 0x84f3, 0x9086, 0x0014, 0x1560,
+	0x080c, 0x5ff4, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1520,
+	0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1160, 0x7a38,
+	0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b,
+	0x000a, 0x00b1, 0x0098, 0x9005, 0x1178, 0x7a38, 0xd2fc, 0x0128,
+	0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x7097, 0x0000, 0x709b,
+	0x000e, 0x080c, 0x5b4b, 0x0010, 0x080c, 0x5fd0, 0x00fe, 0x0005,
+	0x00f6, 0x709b, 0x000b, 0x2011, 0x1c0e, 0x20e9, 0x0001, 0x22a0,
+	0x20a9, 0x0040, 0x2019, 0xffff, 0x4304, 0x080c, 0x5f78, 0x2079,
+	0x0240, 0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x5fd7, 0x0118,
+	0x2013, 0x0000, 0x0020, 0x7060, 0x9085, 0x0100, 0x2012, 0x20a9,
+	0x0040, 0x2009, 0x024e, 0x2011, 0x1c0e, 0x220e, 0x8210, 0x8108,
+	0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240,
+	0x1f04, 0x5acd, 0x60c3, 0x0084, 0x080c, 0x5ead, 0x00fe, 0x0005,
+	0x00f6, 0x7090, 0x9005, 0x01c0, 0x2011, 0x5e83, 0x080c, 0x84f3,
+	0x9086, 0x0084, 0x1178, 0x080c, 0x5ff4, 0x2079, 0x0260, 0x7a30,
+	0x9296, 0x1106, 0x1138, 0x7834, 0x9005, 0x1120, 0x709b, 0x000c,
+	0x0029, 0x0010, 0x080c, 0x5fd0, 0x00fe, 0x0005, 0x00f6, 0x709b,
+	0x000d, 0x080c, 0x5f78, 0x2079, 0x0240, 0x7833, 0x1107, 0x7837,
+	0x0000, 0x080c, 0x5ff4, 0x20a9, 0x0040, 0x2011, 0x026e, 0x2009,
+	0x024e, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810,
+	0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011,
+	0x0260, 0x1f04, 0x5b11, 0x60c3, 0x0084, 0x080c, 0x5ead, 0x00fe,
+	0x0005, 0x00f6, 0x7090, 0x9005, 0x01e0, 0x2011, 0x5e83, 0x080c,
+	0x84f3, 0x9086, 0x0084, 0x1198, 0x080c, 0x5ff4, 0x2079, 0x0260,
+	0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7097,
+	0x0001, 0x080c, 0x5f4a, 0x709b, 0x000e, 0x0029, 0x0010, 0x080c,
+	0x5fd0, 0x00fe, 0x0005, 0x918d, 0x0001, 0x080c, 0x601f, 0x709b,
+	0x000f, 0x7093, 0x0000, 0x2061, 0x0140, 0x605b, 0xbc85, 0x605f,
+	0xb5b5, 0x2061, 0x0100, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009,
+	0x07d0, 0x2011, 0x5e83, 0x080c, 0x84e7, 0x0005, 0x7090, 0x9005,
+	0x0130, 0x2011, 0x5e83, 0x080c, 0x84f3, 0x709b, 0x0000, 0x0005,
+	0x709b, 0x0011, 0x080c, 0xab21, 0x080c, 0x5ff4, 0x20e1, 0x0000,
+	0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x7490, 0x9480,
+	0x0018, 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x4003,
+	0x080c, 0x5fd7, 0x11a0, 0x717c, 0x81ff, 0x0188, 0x900e, 0x7080,
+	0x9084, 0x00ff, 0x0160, 0x080c, 0x283e, 0x9186, 0x007e, 0x0138,
+	0x9186, 0x0080, 0x0120, 0x2011, 0x0008, 0x080c, 0x5e30, 0x60c3,
+	0x0014, 0x080c, 0x5ead, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500,
+	0x2011, 0x5e83, 0x080c, 0x84f3, 0x9086, 0x0014, 0x11b8, 0x080c,
+	0x5ff4, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834,
+	0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
+	0x70c7, 0x0001, 0x709b, 0x0012, 0x0029, 0x0010, 0x7093, 0x0000,
+	0x00fe, 0x0005, 0x00f6, 0x709b, 0x0013, 0x080c, 0x5f86, 0x2079,
+	0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x5ff4, 0x080c,
+	0x5fd7, 0x1170, 0x7084, 0x9005, 0x1158, 0x715c, 0x9186, 0xffff,
+	0x0138, 0x2011, 0x0008, 0x080c, 0x5e30, 0x0168, 0x080c, 0x5fad,
+	0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
+	0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5ead, 0x00fe,
+	0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5e83, 0x080c,
+	0x84f3, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ff4, 0x2079, 0x0260,
+	0x7a30, 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
+	0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b,
+	0x0014, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6,
+	0x709b, 0x0015, 0x080c, 0x5f86, 0x2079, 0x0240, 0x7833, 0x1104,
+	0x7837, 0x0000, 0x080c, 0x5ff4, 0x080c, 0x5fd7, 0x11b8, 0x7084,
+	0x9005, 0x11a0, 0x7164, 0x9186, 0xffff, 0x0180, 0x9180, 0x3325,
+	0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5e30,
+	0x0180, 0x080c, 0x4fe1, 0x0110, 0x080c, 0x28a7, 0x20a9, 0x0008,
+	0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e,
+	0x4003, 0x60c3, 0x0014, 0x080c, 0x5ead, 0x00fe, 0x0005, 0x00f6,
+	0x7090, 0x9005, 0x05f0, 0x2011, 0x5e83, 0x080c, 0x84f3, 0x9086,
+	0x0014, 0x15a8, 0x080c, 0x5ff4, 0x2079, 0x0260, 0x7a30, 0x9296,
+	0x1105, 0x1568, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e,
+	0x1168, 0x9085, 0x0001, 0x080c, 0x601f, 0x7a38, 0xd2fc, 0x0128,
+	0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x0080, 0x9005, 0x11b8,
 	0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
-	0x709b, 0x000a, 0x00b1, 0x0098, 0x9005, 0x1178, 0x7a38, 0xd2fc,
-	0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x7097, 0x0000,
-	0x709b, 0x000e, 0x080c, 0x5b4c, 0x0010, 0x080c, 0x5fd1, 0x00fe,
-	0x0005, 0x00f6, 0x709b, 0x000b, 0x2011, 0x1c0e, 0x20e9, 0x0001,
-	0x22a0, 0x20a9, 0x0040, 0x2019, 0xffff, 0x4304, 0x080c, 0x5f79,
-	0x2079, 0x0240, 0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x5fd8,
-	0x0118, 0x2013, 0x0000, 0x0020, 0x7060, 0x9085, 0x0100, 0x2012,
-	0x20a9, 0x0040, 0x2009, 0x024e, 0x2011, 0x1c0e, 0x220e, 0x8210,
-	0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009,
-	0x0240, 0x1f04, 0x5ace, 0x60c3, 0x0084, 0x080c, 0x5eae, 0x00fe,
-	0x0005, 0x00f6, 0x7090, 0x9005, 0x01c0, 0x2011, 0x5e84, 0x080c,
-	0x84ca, 0x9086, 0x0084, 0x1178, 0x080c, 0x5ff5, 0x2079, 0x0260,
-	0x7a30, 0x9296, 0x1106, 0x1138, 0x7834, 0x9005, 0x1120, 0x709b,
-	0x000c, 0x0029, 0x0010, 0x080c, 0x5fd1, 0x00fe, 0x0005, 0x00f6,
-	0x709b, 0x000d, 0x080c, 0x5f79, 0x2079, 0x0240, 0x7833, 0x1107,
-	0x7837, 0x0000, 0x080c, 0x5ff5, 0x20a9, 0x0040, 0x2011, 0x026e,
-	0x2009, 0x024e, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150,
-	0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816,
-	0x2011, 0x0260, 0x1f04, 0x5b12, 0x60c3, 0x0084, 0x080c, 0x5eae,
-	0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01e0, 0x2011, 0x5e84,
-	0x080c, 0x84ca, 0x9086, 0x0084, 0x1198, 0x080c, 0x5ff5, 0x2079,
+	0x9085, 0x0001, 0x080c, 0x601f, 0x7097, 0x0000, 0x7a38, 0xd2f4,
+	0x0110, 0x70df, 0x0008, 0x709b, 0x0016, 0x0029, 0x0010, 0x7093,
+	0x0000, 0x00fe, 0x0005, 0x080c, 0xab21, 0x080c, 0x5ff4, 0x20e1,
+	0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9,
+	0x000e, 0x4003, 0x2011, 0x026d, 0x2204, 0x9084, 0x0100, 0x2011,
+	0x024d, 0x2012, 0x2011, 0x026e, 0x709b, 0x0017, 0x080c, 0x5fd7,
+	0x1150, 0x7084, 0x9005, 0x1138, 0x080c, 0x5da3, 0x1188, 0x9085,
+	0x0001, 0x080c, 0x28a7, 0x20a9, 0x0008, 0x080c, 0x5ff4, 0x20e1,
+	0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003,
+	0x60c3, 0x0014, 0x080c, 0x5ead, 0x0010, 0x080c, 0x58fd, 0x0005,
+	0x00f6, 0x7090, 0x9005, 0x01d8, 0x2011, 0x5e83, 0x080c, 0x84f3,
+	0x9086, 0x0084, 0x1190, 0x080c, 0x5ff4, 0x2079, 0x0260, 0x7a30,
+	0x9296, 0x1106, 0x1150, 0x7834, 0x9005, 0x1138, 0x9006, 0x080c,
+	0x601f, 0x709b, 0x0018, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe,
+	0x0005, 0x00f6, 0x709b, 0x0019, 0x080c, 0x5f86, 0x2079, 0x0240,
+	0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x5ff4, 0x2009, 0x026e,
+	0x2039, 0x1c0e, 0x20a9, 0x0040, 0x213e, 0x8738, 0x8108, 0x9186,
+	0x0280, 0x1128, 0x6814, 0x8000, 0x6816, 0x2009, 0x0260, 0x1f04,
+	0x5d0c, 0x2039, 0x1c0e, 0x080c, 0x5fd7, 0x11e8, 0x2728, 0x2514,
+	0x8207, 0x9084, 0x00ff, 0x8000, 0x2018, 0x9294, 0x00ff, 0x8007,
+	0x9205, 0x202a, 0x7060, 0x2310, 0x8214, 0x92a0, 0x1c0e, 0x2414,
+	0x938c, 0x0001, 0x0118, 0x9294, 0xff00, 0x0018, 0x9294, 0x00ff,
+	0x8007, 0x9215, 0x2222, 0x20a9, 0x0040, 0x2009, 0x024e, 0x270e,
+	0x8738, 0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812,
+	0x2009, 0x0240, 0x1f04, 0x5d3f, 0x60c3, 0x0084, 0x080c, 0x5ead,
+	0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01e0, 0x2011, 0x5e83,
+	0x080c, 0x84f3, 0x9086, 0x0084, 0x1198, 0x080c, 0x5ff4, 0x2079,
 	0x0260, 0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140,
-	0x7097, 0x0001, 0x080c, 0x5f4b, 0x709b, 0x000e, 0x0029, 0x0010,
-	0x080c, 0x5fd1, 0x00fe, 0x0005, 0x918d, 0x0001, 0x080c, 0x6020,
-	0x709b, 0x000f, 0x7093, 0x0000, 0x2061, 0x0140, 0x605b, 0xbc85,
-	0x605f, 0xb5b5, 0x2061, 0x0100, 0x6043, 0x0005, 0x6043, 0x0004,
-	0x2009, 0x07d0, 0x2011, 0x5e84, 0x080c, 0x84be, 0x0005, 0x7090,
-	0x9005, 0x0130, 0x2011, 0x5e84, 0x080c, 0x84ca, 0x709b, 0x0000,
-	0x0005, 0x709b, 0x0011, 0x080c, 0xab07, 0x080c, 0x5ff5, 0x20e1,
-	0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x7490,
-	0x9480, 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8,
-	0x4003, 0x080c, 0x5fd8, 0x11a0, 0x717c, 0x81ff, 0x0188, 0x900e,
-	0x7080, 0x9084, 0x00ff, 0x0160, 0x080c, 0x283e, 0x9186, 0x007e,
-	0x0138, 0x9186, 0x0080, 0x0120, 0x2011, 0x0008, 0x080c, 0x5e31,
-	0x60c3, 0x0014, 0x080c, 0x5eae, 0x0005, 0x00f6, 0x7090, 0x9005,
-	0x0500, 0x2011, 0x5e84, 0x080c, 0x84ca, 0x9086, 0x0014, 0x11b8,
-	0x080c, 0x5ff5, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178,
-	0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
-	0x1110, 0x70c7, 0x0001, 0x709b, 0x0012, 0x0029, 0x0010, 0x7093,
-	0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0013, 0x080c, 0x5f87,
-	0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x5ff5,
-	0x080c, 0x5fd8, 0x1170, 0x7084, 0x9005, 0x1158, 0x715c, 0x9186,
-	0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5e31, 0x0168, 0x080c,
-	0x5fae, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-	0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5eae,
-	0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5e84,
-	0x080c, 0x84ca, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ff5, 0x2079,
-	0x0260, 0x7a30, 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160,
-	0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
-	0x709b, 0x0014, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005,
-	0x00f6, 0x709b, 0x0015, 0x080c, 0x5f87, 0x2079, 0x0240, 0x7833,
-	0x1104, 0x7837, 0x0000, 0x080c, 0x5ff5, 0x080c, 0x5fd8, 0x11b8,
-	0x7084, 0x9005, 0x11a0, 0x7164, 0x9186, 0xffff, 0x0180, 0x9180,
-	0x331e, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c,
-	0x5e31, 0x0180, 0x080c, 0x4fe2, 0x0110, 0x080c, 0x28a7, 0x20a9,
-	0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
-	0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5eae, 0x00fe, 0x0005,
-	0x00f6, 0x7090, 0x9005, 0x05f0, 0x2011, 0x5e84, 0x080c, 0x84ca,
-	0x9086, 0x0014, 0x15a8, 0x080c, 0x5ff5, 0x2079, 0x0260, 0x7a30,
-	0x9296, 0x1105, 0x1568, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100,
-	0x921e, 0x1168, 0x9085, 0x0001, 0x080c, 0x6020, 0x7a38, 0xd2fc,
-	0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x0080, 0x9005,
-	0x11b8, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
-	0x0001, 0x9085, 0x0001, 0x080c, 0x6020, 0x7097, 0x0000, 0x7a38,
-	0xd2f4, 0x0110, 0x70df, 0x0008, 0x709b, 0x0016, 0x0029, 0x0010,
-	0x7093, 0x0000, 0x00fe, 0x0005, 0x080c, 0xab07, 0x080c, 0x5ff5,
-	0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240,
-	0x20a9, 0x000e, 0x4003, 0x2011, 0x026d, 0x2204, 0x9084, 0x0100,
-	0x2011, 0x024d, 0x2012, 0x2011, 0x026e, 0x709b, 0x0017, 0x080c,
-	0x5fd8, 0x1150, 0x7084, 0x9005, 0x1138, 0x080c, 0x5da4, 0x1188,
-	0x9085, 0x0001, 0x080c, 0x28a7, 0x20a9, 0x0008, 0x080c, 0x5ff5,
-	0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e,
-	0x4003, 0x60c3, 0x0014, 0x080c, 0x5eae, 0x0010, 0x080c, 0x58fe,
-	0x0005, 0x00f6, 0x7090, 0x9005, 0x01d8, 0x2011, 0x5e84, 0x080c,
-	0x84ca, 0x9086, 0x0084, 0x1190, 0x080c, 0x5ff5, 0x2079, 0x0260,
-	0x7a30, 0x9296, 0x1106, 0x1150, 0x7834, 0x9005, 0x1138, 0x9006,
-	0x080c, 0x6020, 0x709b, 0x0018, 0x0029, 0x0010, 0x7093, 0x0000,
-	0x00fe, 0x0005, 0x00f6, 0x709b, 0x0019, 0x080c, 0x5f87, 0x2079,
-	0x0240, 0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x5ff5, 0x2009,
-	0x026e, 0x2039, 0x1c0e, 0x20a9, 0x0040, 0x213e, 0x8738, 0x8108,
-	0x9186, 0x0280, 0x1128, 0x6814, 0x8000, 0x6816, 0x2009, 0x0260,
-	0x1f04, 0x5d0d, 0x2039, 0x1c0e, 0x080c, 0x5fd8, 0x11e8, 0x2728,
-	0x2514, 0x8207, 0x9084, 0x00ff, 0x8000, 0x2018, 0x9294, 0x00ff,
-	0x8007, 0x9205, 0x202a, 0x7060, 0x2310, 0x8214, 0x92a0, 0x1c0e,
-	0x2414, 0x938c, 0x0001, 0x0118, 0x9294, 0xff00, 0x0018, 0x9294,
-	0x00ff, 0x8007, 0x9215, 0x2222, 0x20a9, 0x0040, 0x2009, 0x024e,
-	0x270e, 0x8738, 0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000,
-	0x6812, 0x2009, 0x0240, 0x1f04, 0x5d40, 0x60c3, 0x0084, 0x080c,
-	0x5eae, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01e0, 0x2011,
-	0x5e84, 0x080c, 0x84ca, 0x9086, 0x0084, 0x1198, 0x080c, 0x5ff5,
-	0x2079, 0x0260, 0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005,
-	0x1140, 0x7097, 0x0001, 0x080c, 0x5f4b, 0x709b, 0x001a, 0x0029,
-	0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x9085, 0x0001, 0x080c,
-	0x6020, 0x709b, 0x001b, 0x080c, 0xab07, 0x080c, 0x5ff5, 0x2011,
-	0x0260, 0x2009, 0x0240, 0x7490, 0x9480, 0x0018, 0x9080, 0x0007,
-	0x9084, 0x03f8, 0x8004, 0x20a8, 0x220e, 0x8210, 0x8108, 0x9186,
-	0x0260, 0x1150, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814,
-	0x8000, 0x6816, 0x2011, 0x0260, 0x1f04, 0x5d8c, 0x60c3, 0x0084,
-	0x080c, 0x5eae, 0x0005, 0x0005, 0x0086, 0x0096, 0x2029, 0x1848,
-	0x252c, 0x20a9, 0x0008, 0x2041, 0x1c0e, 0x20e9, 0x0001, 0x28a0,
-	0x080c, 0x5ff5, 0x20e1, 0x0000, 0x2099, 0x026e, 0x4003, 0x20a9,
-	0x0008, 0x2011, 0x0007, 0xd5d4, 0x0108, 0x9016, 0x2800, 0x9200,
-	0x200c, 0x91a6, 0xffff, 0x1148, 0xd5d4, 0x0110, 0x8210, 0x0008,
-	0x8211, 0x1f04, 0x5dbe, 0x0804, 0x5e2d, 0x82ff, 0x1160, 0xd5d4,
-	0x0120, 0x91a6, 0x3fff, 0x0d90, 0x0020, 0x91a6, 0x3fff, 0x0904,
-	0x5e2d, 0x918d, 0xc000, 0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4,
-	0x0110, 0x2019, 0x0010, 0x2120, 0xd5d4, 0x0110, 0x8423, 0x0008,
-	0x8424, 0x1240, 0xd5d4, 0x0110, 0x8319, 0x0008, 0x8318, 0x1f04,
-	0x5de4, 0x04d8, 0x23a8, 0x2021, 0x0001, 0x8426, 0x8425, 0x1f04,
-	0x5df6, 0x2328, 0x8529, 0x92be, 0x0007, 0x0158, 0x0006, 0x2039,
-	0x0007, 0x2200, 0x973a, 0x000e, 0x27a8, 0x95a8, 0x0010, 0x1f04,
-	0x5e05, 0x755e, 0x95c8, 0x331e, 0x292d, 0x95ac, 0x00ff, 0x7582,
-	0x6532, 0x6536, 0x0016, 0x2508, 0x080c, 0x2887, 0x001e, 0x60e7,
-	0x0000, 0x65ea, 0x2018, 0x2304, 0x9405, 0x201a, 0x7087, 0x0001,
-	0x20e9, 0x0000, 0x20a1, 0x024e, 0x20e1, 0x0001, 0x2898, 0x20a9,
-	0x0008, 0x4003, 0x9085, 0x0001, 0x0008, 0x9006, 0x009e, 0x008e,
-	0x0005, 0x0156, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x22a8, 0x20e1,
-	0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x2011, 0x024e, 0x22a0,
-	0x4003, 0x014e, 0x013e, 0x01de, 0x01ce, 0x015e, 0x2118, 0x9026,
-	0x2001, 0x0007, 0x939a, 0x0010, 0x0218, 0x8420, 0x8001, 0x0cd0,
-	0x2118, 0x84ff, 0x0120, 0x939a, 0x0010, 0x8421, 0x1de0, 0x2021,
-	0x0001, 0x83ff, 0x0118, 0x8423, 0x8319, 0x1de8, 0x9238, 0x2029,
-	0x026e, 0x9528, 0x2504, 0x942c, 0x11b8, 0x9405, 0x203a, 0x715e,
-	0x91a0, 0x331e, 0x242d, 0x95ac, 0x00ff, 0x7582, 0x6532, 0x6536,
-	0x0016, 0x2508, 0x080c, 0x2887, 0x001e, 0x60e7, 0x0000, 0x65ea,
-	0x7087, 0x0001, 0x9084, 0x0000, 0x0005, 0x00e6, 0x2071, 0x1800,
-	0x708b, 0x0000, 0x00ee, 0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100,
-	0x2071, 0x0140, 0x080c, 0x5f3a, 0x080c, 0xa259, 0x7004, 0x9084,
-	0x4000, 0x0110, 0x080c, 0x2cff, 0x0126, 0x2091, 0x8000, 0x2071,
-	0x1826, 0x2073, 0x0000, 0x7840, 0x0026, 0x0016, 0x2009, 0x00f7,
-	0x080c, 0x5f97, 0x001e, 0x9094, 0x0010, 0x9285, 0x0080, 0x7842,
-	0x7a42, 0x002e, 0x012e, 0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x2ba5, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5,
-	0x2012, 0x2011, 0x19f1, 0x2013, 0x0000, 0x7093, 0x0000, 0x012e,
-	0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0xa250, 0x6144, 0xd184,
-	0x0120, 0x7198, 0x918d, 0x2000, 0x0018, 0x718c, 0x918d, 0x1000,
-	0x2011, 0x1999, 0x2112, 0x2009, 0x07d0, 0x2011, 0x5e84, 0x080c,
-	0x8562, 0x0005, 0x0016, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x080c, 0xadb8, 0x2009, 0x00f7, 0x080c, 0x5f97, 0x2061, 0x19fa,
-	0x900e, 0x611a, 0x611e, 0x6172, 0x6176, 0x2061, 0x1800, 0x6003,
-	0x0001, 0x2061, 0x0100, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009,
-	0x1999, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5f06, 0x080c,
-	0x84be, 0x012e, 0x00ce, 0x002e, 0x001e, 0x0005, 0x00e6, 0x0006,
-	0x0126, 0x2091, 0x8000, 0x0471, 0x2071, 0x0100, 0x080c, 0xa259,
-	0x2071, 0x0140, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2cff,
-	0x080c, 0x73b8, 0x0188, 0x080c, 0x73d3, 0x1170, 0x080c, 0x76a2,
-	0x0016, 0x080c, 0x2956, 0x2001, 0x196d, 0x2102, 0x001e, 0x080c,
-	0x769d, 0x080c, 0x72e2, 0x0050, 0x2009, 0x0001, 0x080c, 0x2c3e,
-	0x2001, 0x0001, 0x080c, 0x27ea, 0x080c, 0x5eda, 0x012e, 0x000e,
-	0x00ee, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0bc, 0x0158, 0x0026,
-	0x0036, 0x2011, 0x8017, 0x2001, 0x1999, 0x201c, 0x080c, 0x4b05,
-	0x003e, 0x002e, 0x0005, 0x20a9, 0x0012, 0x20e9, 0x0001, 0x20a1,
-	0x1c80, 0x080c, 0x5ff5, 0x20e9, 0x0000, 0x2099, 0x026e, 0x0099,
-	0x20a9, 0x0020, 0x080c, 0x5fef, 0x2099, 0x0260, 0x20a1, 0x1c92,
-	0x0051, 0x20a9, 0x000e, 0x080c, 0x5ff2, 0x2099, 0x0260, 0x20a1,
-	0x1cb2, 0x0009, 0x0005, 0x0016, 0x0026, 0x3410, 0x3308, 0x2104,
-	0x8007, 0x2012, 0x8108, 0x8210, 0x1f04, 0x5f6f, 0x002e, 0x001e,
-	0x0005, 0x080c, 0xab07, 0x20e1, 0x0001, 0x2099, 0x1c00, 0x20e9,
-	0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x080c,
-	0xab07, 0x080c, 0x5ff5, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9,
-	0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x00c6,
-	0x0006, 0x2061, 0x0100, 0x810f, 0x2001, 0x1834, 0x2004, 0x9005,
-	0x1138, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x9105, 0x0010,
-	0x9185, 0x00f7, 0x604a, 0x000e, 0x00ce, 0x0005, 0x0016, 0x0046,
-	0x080c, 0x6966, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c,
-	0xe58d, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a,
-	0x900e, 0x080c, 0x3187, 0x080c, 0xd216, 0x0140, 0x0036, 0x2019,
-	0xffff, 0x2021, 0x0007, 0x080c, 0x4cbc, 0x003e, 0x004e, 0x001e,
-	0x0005, 0x080c, 0x5eda, 0x709b, 0x0000, 0x7093, 0x0000, 0x0005,
-	0x0006, 0x2001, 0x180c, 0x2004, 0xd09c, 0x0100, 0x000e, 0x0005,
-	0x0006, 0x0016, 0x0126, 0x2091, 0x8000, 0x2001, 0x0101, 0x200c,
-	0x918d, 0x0006, 0x2102, 0x012e, 0x001e, 0x000e, 0x0005, 0x2009,
-	0x0001, 0x0020, 0x2009, 0x0002, 0x0008, 0x900e, 0x6814, 0x9084,
-	0xffc0, 0x910d, 0x6916, 0x0005, 0x00f6, 0x0156, 0x0146, 0x01d6,
-	0x9006, 0x20a9, 0x0080, 0x20e9, 0x0001, 0x20a1, 0x1c00, 0x4004,
-	0x2079, 0x1c00, 0x7803, 0x2200, 0x7807, 0x00ef, 0x780f, 0x00ef,
-	0x7813, 0x0138, 0x7823, 0xffff, 0x7827, 0xffff, 0x01de, 0x014e,
-	0x015e, 0x00fe, 0x0005, 0x2001, 0x1800, 0x2003, 0x0001, 0x0005,
-	0x2001, 0x19a6, 0x0118, 0x2003, 0x0001, 0x0010, 0x2003, 0x0000,
-	0x0005, 0x0156, 0x20a9, 0x0800, 0x2009, 0x1000, 0x9006, 0x200a,
-	0x8108, 0x1f04, 0x602f, 0x015e, 0x0005, 0x00d6, 0x0036, 0x0156,
-	0x0136, 0x0146, 0x2069, 0x1847, 0x9006, 0xb802, 0xb8ce, 0xb807,
-	0x0707, 0xb80a, 0xb80e, 0xb812, 0x9198, 0x331e, 0x231d, 0x939c,
-	0x00ff, 0xbb16, 0x0016, 0x0026, 0xb8c2, 0x080c, 0xadb1, 0x1120,
-	0x9192, 0x007e, 0x1208, 0xbbc2, 0x20a9, 0x0004, 0xb8c4, 0x20e8,
-	0xb9c8, 0x9198, 0x0006, 0x9006, 0x23a0, 0x4004, 0x20a9, 0x0004,
-	0x9198, 0x000a, 0x23a0, 0x4004, 0x002e, 0x001e, 0xb83e, 0xb842,
-	0xb84e, 0xb852, 0xb856, 0xb85a, 0xb85e, 0xb862, 0xb866, 0xb86a,
-	0xb86f, 0x0100, 0xb872, 0xb876, 0xb87a, 0xb88a, 0xb88e, 0xb893,
-	0x0008, 0xb896, 0xb89a, 0xb89e, 0xb8be, 0xb9a2, 0x0096, 0xb8a4,
-	0x904d, 0x0110, 0x080c, 0x1031, 0xb8a7, 0x0000, 0x009e, 0x9006,
-	0xb84a, 0x6810, 0xb83a, 0x680c, 0xb846, 0xb8bb, 0x0520, 0xb8ac,
-	0x9005, 0x0198, 0x00c6, 0x2060, 0x9c82, 0x1cd0, 0x0a0c, 0x0dd5,
-	0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c, 0x0dd5, 0x080c, 0x8958,
-	0x00ce, 0x090c, 0x8cfc, 0xb8af, 0x0000, 0x6814, 0x9084, 0x00ff,
-	0xb842, 0x014e, 0x013e, 0x015e, 0x003e, 0x00de, 0x0005, 0x0126,
-	0x2091, 0x8000, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000,
-	0x1a04, 0x611d, 0x9182, 0x0800, 0x1a04, 0x6121, 0x2001, 0x180c,
-	0x2004, 0x9084, 0x0003, 0x1904, 0x6127, 0x9188, 0x1000, 0x2104,
-	0x905d, 0x0518, 0xb804, 0x9084, 0x00ff, 0x908e, 0x0006, 0x1508,
-	0xb8a4, 0x900d, 0x1904, 0x6139, 0xb850, 0x900d, 0x1148, 0xa802,
-	0x2900, 0xb852, 0xb84e, 0x080c, 0x90e4, 0x9006, 0x012e, 0x0005,
-	0x00a6, 0x2150, 0x2900, 0xb002, 0xa803, 0x0000, 0x00ae, 0xb852,
-	0x0c90, 0x2001, 0x0005, 0x900e, 0x04b8, 0x2001, 0x0028, 0x900e,
-	0x0498, 0x9082, 0x0006, 0x1290, 0x080c, 0xadb1, 0x1160, 0xb8a0,
-	0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0990, 0x2001, 0x0029,
-	0x2009, 0x1000, 0x0408, 0x2001, 0x0028, 0x00a8, 0x2009, 0x180c,
-	0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0068, 0xd184, 0x0118,
-	0x2001, 0x0004, 0x0040, 0x2001, 0x0029, 0xb900, 0xd1fc, 0x0118,
-	0x2009, 0x1000, 0x0048, 0x900e, 0x0038, 0x2001, 0x0029, 0x900e,
-	0x0018, 0x2001, 0x0029, 0x900e, 0x9005, 0x012e, 0x0005, 0x2001,
-	0x180c, 0x2004, 0xd084, 0x19d0, 0x9188, 0x1000, 0x2104, 0x905d,
-	0x09a8, 0x080c, 0x696a, 0x1990, 0xb800, 0xd0bc, 0x0978, 0x0804,
-	0x60d0, 0x080c, 0x679c, 0x0904, 0x60e9, 0x0804, 0x60d4, 0x00b6,
-	0x00e6, 0x0126, 0x2091, 0x8000, 0xa874, 0x908e, 0x00ff, 0x1120,
-	0x2001, 0x196b, 0x205c, 0x0060, 0xa974, 0x9182, 0x0800, 0x1690,
-	0x9188, 0x1000, 0x2104, 0x905d, 0x01d0, 0x080c, 0x690a, 0x11d0,
-	0x080c, 0xadf1, 0x0570, 0x2b00, 0x6012, 0x2900, 0x6016, 0x6023,
-	0x0009, 0x600b, 0x0000, 0xa874, 0x908e, 0x00ff, 0x1110, 0x600b,
-	0x8000, 0x2009, 0x0043, 0x080c, 0xaec2, 0x9006, 0x00b0, 0x2001,
-	0x0028, 0x0090, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001,
-	0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001,
-	0x0029, 0x0010, 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be,
-	0x0005, 0x2001, 0x002c, 0x0cc0, 0x00b6, 0x00e6, 0x0126, 0x2091,
-	0x8000, 0xa974, 0x9182, 0x0800, 0x1a04, 0x6207, 0x9188, 0x1000,
-	0x2104, 0x905d, 0x0904, 0x61df, 0xb8a0, 0x9086, 0x007f, 0x0178,
-	0x080c, 0x6972, 0x0160, 0xa994, 0x81ff, 0x0130, 0x908e, 0x0004,
-	0x0130, 0x908e, 0x0005, 0x0118, 0x080c, 0x696a, 0x1598, 0xa87c,
-	0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060, 0x0026, 0x2010,
-	0x080c, 0xcb09, 0x002e, 0x1120, 0x2001, 0x0008, 0x0804, 0x6209,
-	0x6020, 0x9086, 0x000a, 0x0120, 0x2001, 0x0008, 0x0804, 0x6209,
-	0x601a, 0x6003, 0x0008, 0x2900, 0x6016, 0x0058, 0x080c, 0xadf1,
-	0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023,
-	0x000a, 0x2009, 0x0003, 0x080c, 0xaec2, 0x9006, 0x0458, 0x2001,
-	0x0028, 0x0438, 0x9082, 0x0006, 0x1290, 0x080c, 0xadb1, 0x1160,
-	0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0900, 0x2001,
-	0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090, 0x2009,
-	0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050, 0xd184,
-	0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029, 0x0010, 0x2001,
-	0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001, 0x002c,
-	0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000, 0xa8e0, 0x9005,
-	0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8, 0x9005, 0x1518,
-	0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079, 0x1800, 0x9182,
-	0x0800, 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130, 0xaa98, 0xab94,
-	0xa878, 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c, 0x0118, 0x2001,
-	0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001,
-	0x0029, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001,
-	0x0029, 0x900e, 0x9006, 0x0008, 0x9005, 0x012e, 0x00be, 0x00fe,
-	0x0005, 0x629e, 0x6259, 0x6270, 0x629e, 0x629e, 0x629e, 0x629e,
-	0x629e, 0x2100, 0x9082, 0x007e, 0x1278, 0x080c, 0x659f, 0x0148,
-	0x9046, 0xb810, 0x9306, 0x1904, 0x62a6, 0xb814, 0x9206, 0x15f0,
-	0x0028, 0xbb12, 0xba16, 0x0010, 0x080c, 0x49b8, 0x0150, 0x04b0,
-	0x080c, 0x6600, 0x1598, 0xb810, 0x9306, 0x1580, 0xb814, 0x9206,
-	0x1568, 0x080c, 0xadf1, 0x0530, 0x2b00, 0x6012, 0x080c, 0xcf90,
-	0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a, 0xa878, 0x9086,
-	0x0001, 0x1170, 0x080c, 0x31bc, 0x9006, 0x080c, 0x653c, 0x2001,
-	0x0002, 0x080c, 0x6550, 0x2001, 0x0200, 0xb86e, 0xb893, 0x0002,
-	0x2009, 0x0003, 0x080c, 0xaec2, 0x9006, 0x0068, 0x2001, 0x0001,
-	0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001, 0x0028,
-	0x900e, 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe, 0x0005, 0x00b6,
-	0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894, 0x90c6, 0x0015,
-	0x0904, 0x648d, 0x90c6, 0x0056, 0x0904, 0x6491, 0x90c6, 0x0066,
-	0x0904, 0x6495, 0x90c6, 0x0067, 0x0904, 0x6499, 0x90c6, 0x0068,
-	0x0904, 0x649d, 0x90c6, 0x0071, 0x0904, 0x64a1, 0x90c6, 0x0074,
-	0x0904, 0x64a5, 0x90c6, 0x007c, 0x0904, 0x64a9, 0x90c6, 0x007e,
-	0x0904, 0x64ad, 0x90c6, 0x0037, 0x0904, 0x64b1, 0x9016, 0x2079,
-	0x1800, 0xa974, 0x9186, 0x00ff, 0x0904, 0x6488, 0x9182, 0x0800,
-	0x1a04, 0x6488, 0x080c, 0x6600, 0x1198, 0xb804, 0x9084, 0x00ff,
-	0x9082, 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f, 0x0148, 0x080c,
-	0xadb1, 0x1904, 0x6471, 0xb8a0, 0x9084, 0xff80, 0x1904, 0x6471,
-	0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e, 0x0904, 0x63d1,
-	0x90c6, 0x0064, 0x0904, 0x63fa, 0x2008, 0x0804, 0x6393, 0xa998,
-	0xa8b0, 0x2040, 0x080c, 0xadb1, 0x1120, 0x9182, 0x007f, 0x0a04,
-	0x6393, 0x9186, 0x00ff, 0x0904, 0x6393, 0x9182, 0x0800, 0x1a04,
-	0x6393, 0xaaa0, 0xab9c, 0x787c, 0x9306, 0x1188, 0x7880, 0x0096,
-	0x924e, 0x1128, 0x2208, 0x2310, 0x009e, 0x0804, 0x6393, 0x99cc,
-	0xff00, 0x009e, 0x1120, 0x2208, 0x2310, 0x0804, 0x6393, 0x080c,
-	0x49b8, 0x0904, 0x639d, 0x900e, 0x9016, 0x90c6, 0x4000, 0x15e0,
-	0x0006, 0x080c, 0x6820, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031,
-	0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c,
-	0x0f7c, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0035,
-	0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c,
-	0x0f7c, 0xa8c4, 0xabc8, 0x9305, 0xabcc, 0x9305, 0xabd0, 0x9305,
-	0xabd4, 0x9305, 0xabd8, 0x9305, 0xabdc, 0x9305, 0xabe0, 0x9305,
-	0x9005, 0x0510, 0x000e, 0x00c8, 0x90c6, 0x4007, 0x1110, 0x2408,
-	0x00a0, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0070, 0x90c6,
-	0x4009, 0x1108, 0x0050, 0x90c6, 0x4006, 0x0138, 0x2001, 0x4005,
-	0x2009, 0x000a, 0x0010, 0x2001, 0x4006, 0xa896, 0xa99a, 0xaa9e,
-	0x2001, 0x0030, 0x900e, 0x0478, 0x000e, 0x080c, 0xadf1, 0x1130,
-	0x2001, 0x4005, 0x2009, 0x0003, 0x9016, 0x0c78, 0x2b00, 0x6012,
-	0x080c, 0xcf90, 0x2900, 0x6016, 0x6023, 0x0001, 0xa868, 0xd88c,
-	0x0108, 0xc0f5, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x31bc,
-	0x012e, 0x9006, 0x080c, 0x653c, 0x2001, 0x0002, 0x080c, 0x6550,
-	0x2009, 0x0002, 0x080c, 0xaec2, 0xa8b0, 0xd094, 0x0118, 0xb8cc,
-	0xc08d, 0xb8ce, 0x9006, 0x9005, 0x012e, 0x00ee, 0x00fe, 0x00be,
-	0x0005, 0x080c, 0x56e4, 0x0118, 0x2009, 0x0007, 0x00f8, 0xa998,
-	0xaeb0, 0x080c, 0x6600, 0x1904, 0x638e, 0x9186, 0x007f, 0x0130,
-	0x080c, 0x696a, 0x0118, 0x2009, 0x0009, 0x0080, 0x0096, 0x080c,
-	0x0fff, 0x1120, 0x009e, 0x2009, 0x0002, 0x0040, 0x2900, 0x009e,
-	0xa806, 0x080c, 0xcd01, 0x19b0, 0x2009, 0x0003, 0x2001, 0x4005,
-	0x0804, 0x6395, 0xa998, 0xaeb0, 0x080c, 0x6600, 0x1904, 0x638e,
-	0x0096, 0x080c, 0x0fff, 0x1128, 0x009e, 0x2009, 0x0002, 0x0804,
-	0x644e, 0x2900, 0x009e, 0xa806, 0x0096, 0x2048, 0x20a9, 0x002b,
-	0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080,
-	0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0,
-	0xbbc8, 0x9398, 0x0006, 0x2398, 0x080c, 0x0f7c, 0x009e, 0xa87b,
-	0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xd684, 0x1168, 0x080c,
-	0x56d0, 0xd0b4, 0x1118, 0xa89b, 0x000b, 0x00e0, 0xb800, 0xd08c,
-	0x0118, 0xa89b, 0x000c, 0x00b0, 0x080c, 0x696a, 0x0118, 0xa89b,
-	0x0009, 0x0080, 0x080c, 0x56e4, 0x0118, 0xa89b, 0x0007, 0x0050,
-	0x080c, 0xcce4, 0x1904, 0x63ca, 0x2009, 0x0003, 0x2001, 0x4005,
-	0x0804, 0x6395, 0xa87b, 0x0030, 0xa897, 0x4005, 0xa804, 0x8006,
-	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
-	0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000,
-	0x2041, 0x1243, 0x080c, 0xb360, 0x1904, 0x63ca, 0x2009, 0x0002,
-	0x08e8, 0x2001, 0x0028, 0x900e, 0x0804, 0x63cb, 0x2009, 0x180c,
-	0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118,
-	0x2001, 0x0004, 0x0010, 0x2001, 0x0029, 0x900e, 0x0804, 0x63cb,
-	0x2001, 0x0029, 0x900e, 0x0804, 0x63cb, 0x080c, 0x3742, 0x0804,
-	0x63cc, 0x080c, 0x540d, 0x0804, 0x63cc, 0x080c, 0x4548, 0x0804,
-	0x63cc, 0x080c, 0x45c1, 0x0804, 0x63cc, 0x080c, 0x461d, 0x0804,
-	0x63cc, 0x080c, 0x4a7b, 0x0804, 0x63cc, 0x080c, 0x4d32, 0x0804,
-	0x63cc, 0x080c, 0x5078, 0x0804, 0x63cc, 0x080c, 0x5271, 0x0804,
-	0x63cc, 0x080c, 0x3958, 0x0804, 0x63cc, 0x00b6, 0xa974, 0xae78,
-	0x9684, 0x3fff, 0x9082, 0x4000, 0x1618, 0x9182, 0x0800, 0x1268,
-	0x9188, 0x1000, 0x2104, 0x905d, 0x0140, 0x080c, 0x696a, 0x1148,
-	0x00e9, 0x080c, 0x672b, 0x9006, 0x00b0, 0x2001, 0x0028, 0x900e,
-	0x0090, 0x9082, 0x0006, 0x1240, 0xb900, 0xd1fc, 0x0d88, 0x2001,
-	0x0029, 0x2009, 0x1000, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018,
-	0x2001, 0x0029, 0x900e, 0x9005, 0x00be, 0x0005, 0x0126, 0x2091,
-	0x8000, 0xb850, 0x900d, 0x0150, 0x2900, 0x0096, 0x2148, 0xa802,
-	0x009e, 0xa803, 0x0000, 0xb852, 0x012e, 0x0005, 0x2900, 0xb852,
-	0xb84e, 0xa803, 0x0000, 0x0cc0, 0x0126, 0x2091, 0x8000, 0xb84c,
-	0x9005, 0x0170, 0x00e6, 0x2071, 0x19e7, 0x7004, 0x9086, 0x0002,
-	0x0168, 0x00ee, 0xb84c, 0xa802, 0x2900, 0xb84e, 0x012e, 0x0005,
-	0x2900, 0xb852, 0xb84e, 0xa803, 0x0000, 0x0cc0, 0x701c, 0x9b06,
-	0x1d80, 0xb84c, 0x00a6, 0x2050, 0xb000, 0xa802, 0x2900, 0xb002,
-	0x00ae, 0x00ee, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0xb84c,
-	0x904d, 0x0130, 0xa800, 0x9005, 0x1108, 0xb852, 0xb84e, 0x9905,
-	0x012e, 0x0005, 0xb84c, 0x904d, 0x0130, 0xa800, 0x9005, 0x1108,
-	0xb852, 0xb84e, 0x9905, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x0026,
-	0x2091, 0x8000, 0x6210, 0x2258, 0xba00, 0x9005, 0x0110, 0xc285,
-	0x0008, 0xc284, 0xba02, 0x002e, 0x00ce, 0x012e, 0x00be, 0x0005,
-	0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04,
-	0x0006, 0x9086, 0x0006, 0x1170, 0xb89c, 0xd0ac, 0x0158, 0x080c,
-	0x6966, 0x0140, 0x9284, 0xff00, 0x8007, 0x9086, 0x0007, 0x1110,
-	0x2011, 0x0600, 0x000e, 0x9294, 0xff00, 0x9215, 0xba06, 0x0006,
-	0x9086, 0x0006, 0x1120, 0xba90, 0x82ff, 0x090c, 0x0dd5, 0x000e,
-	0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091,
-	0x8000, 0x6210, 0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1168,
-	0xb89c, 0xd0a4, 0x0150, 0x080c, 0x6962, 0x1138, 0x9284, 0x00ff,
-	0x9086, 0x0007, 0x1110, 0x2011, 0x0006, 0x000e, 0x9294, 0x00ff,
-	0x8007, 0x9215, 0xba06, 0x00ce, 0x012e, 0x00be, 0x0005, 0x9182,
-	0x0800, 0x0218, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0026, 0x9190,
-	0x1000, 0x2204, 0x905d, 0x1188, 0x0096, 0x080c, 0x0fff, 0x2958,
-	0x009e, 0x0168, 0x2b00, 0x2012, 0xb85c, 0xb8ca, 0xb860, 0xb8c6,
-	0x9006, 0xb8a6, 0xb8ae, 0x080c, 0x6035, 0x9006, 0x0010, 0x9085,
-	0x0001, 0x002e, 0x00de, 0x0005, 0x00b6, 0x0096, 0x0126, 0x2091,
-	0x8000, 0x0026, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0458,
-	0x00d6, 0x9190, 0x1000, 0x2204, 0x905d, 0x0518, 0x2013, 0x0000,
-	0xb8a4, 0x904d, 0x0110, 0x080c, 0x1031, 0x00d6, 0x00c6, 0xb8bc,
-	0x2060, 0x8cff, 0x0168, 0x600c, 0x0006, 0x6014, 0x2048, 0x080c,
-	0xcb1b, 0x0110, 0x080c, 0x0fb1, 0x080c, 0xae47, 0x00ce, 0x0c88,
-	0x00ce, 0x00de, 0x2b48, 0xb8c8, 0xb85e, 0xb8c4, 0xb862, 0x080c,
-	0x1041, 0x00de, 0x9006, 0x002e, 0x012e, 0x009e, 0x00be, 0x0005,
-	0x0016, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0030, 0x9188,
-	0x1000, 0x2104, 0x905d, 0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6,
-	0x0156, 0x0136, 0x0146, 0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c,
-	0xb802, 0x080c, 0x73b0, 0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120,
-	0x080c, 0xadb1, 0x11d8, 0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6,
-	0x2061, 0x1982, 0x7048, 0x2062, 0x704c, 0x6006, 0x7050, 0x600a,
-	0x7054, 0x600e, 0x00ce, 0x703c, 0x2069, 0x0140, 0x9005, 0x1110,
-	0x2001, 0x0001, 0x6886, 0x2069, 0x1800, 0x68b6, 0x7040, 0xb85e,
-	0x7048, 0xb862, 0x704c, 0xb866, 0x20e1, 0x0000, 0x2099, 0x0276,
-	0xb8c4, 0x20e8, 0xb8c8, 0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004,
-	0x4003, 0x2099, 0x027a, 0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004,
-	0x4003, 0x2069, 0x0200, 0x6817, 0x0001, 0x7040, 0xb86a, 0x7144,
-	0xb96e, 0x7048, 0xb872, 0x7050, 0xb876, 0x2069, 0x0200, 0x6817,
-	0x0000, 0xb8a0, 0x9086, 0x007e, 0x1110, 0x7144, 0xb96e, 0x9182,
-	0x0211, 0x1218, 0x2009, 0x0008, 0x0400, 0x9182, 0x0259, 0x1218,
-	0x2009, 0x0007, 0x00d0, 0x9182, 0x02c1, 0x1218, 0x2009, 0x0006,
-	0x00a0, 0x9182, 0x0349, 0x1218, 0x2009, 0x0005, 0x0070, 0x9182,
-	0x0421, 0x1218, 0x2009, 0x0004, 0x0040, 0x9182, 0x0581, 0x1218,
-	0x2009, 0x0003, 0x0010, 0x2009, 0x0002, 0xb992, 0x014e, 0x013e,
-	0x015e, 0x00de, 0x0005, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260,
-	0x7034, 0xb896, 0x703c, 0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbcc,
-	0xc384, 0xba00, 0x2009, 0x1867, 0x210c, 0xd0bc, 0x0120, 0xd1ec,
-	0x0110, 0xc2ad, 0x0008, 0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138,
-	0xc2bd, 0xd0cc, 0x0128, 0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc,
-	0xba02, 0xbbce, 0x003e, 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096,
-	0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff,
-	0x15c0, 0xaa04, 0x9282, 0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6,
-	0x01d6, 0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084,
-	0xffc0, 0x9080, 0x0004, 0x2098, 0x2009, 0x0010, 0x20a9, 0x0001,
-	0x4002, 0x9086, 0xffff, 0x0120, 0x8109, 0x1dd0, 0x080c, 0x0dd5,
-	0x3c00, 0x20e8, 0x3300, 0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06,
-	0x01de, 0x01ce, 0x014e, 0x013e, 0x0060, 0x080c, 0x0fff, 0x0170,
-	0x2900, 0xb8a6, 0xa803, 0x0000, 0x080c, 0x67bc, 0xa807, 0x0001,
-	0xae12, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8,
-	0x0126, 0x2091, 0x8000, 0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800,
-	0x9005, 0x1150, 0x080c, 0x67cb, 0x1158, 0xa804, 0x908a, 0x0002,
-	0x0218, 0x8001, 0xa806, 0x0020, 0x080c, 0x1031, 0xb8a7, 0x0000,
-	0x009e, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x90e4,
-	0x012e, 0x0005, 0x901e, 0x0010, 0x2019, 0x0001, 0x900e, 0x0126,
-	0x2091, 0x8000, 0xb84c, 0x2048, 0xb800, 0xd0dc, 0x1170, 0x89ff,
-	0x0500, 0x83ff, 0x0120, 0xa878, 0x9606, 0x0158, 0x0030, 0xa86c,
-	0x9406, 0x1118, 0xa870, 0x9506, 0x0120, 0x2908, 0xa800, 0x2048,
-	0x0c70, 0x080c, 0xa678, 0xaa00, 0xb84c, 0x9906, 0x1110, 0xba4e,
-	0x0020, 0x00a6, 0x2150, 0xb202, 0x00ae, 0x82ff, 0x1110, 0xb952,
-	0x89ff, 0x012e, 0x0005, 0x9016, 0x0489, 0x1110, 0x2011, 0x0001,
-	0x0005, 0x080c, 0x6820, 0x0128, 0x080c, 0xcbd8, 0x0010, 0x9085,
-	0x0001, 0x0005, 0x080c, 0x6820, 0x0128, 0x080c, 0xcb7d, 0x0010,
-	0x9085, 0x0001, 0x0005, 0x080c, 0x6820, 0x0128, 0x080c, 0xcbd5,
-	0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x6820, 0x0128, 0x080c,
-	0xcb9c, 0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x6820, 0x0128,
-	0x080c, 0xcc19, 0x0010, 0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d,
-	0x1118, 0x9085, 0x0001, 0x0005, 0x0136, 0x01c6, 0xa800, 0x9005,
-	0x11b8, 0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184,
-	0xffc0, 0x9080, 0x0004, 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010,
-	0x4002, 0x9606, 0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0008,
-	0x9006, 0x01ce, 0x013e, 0x0005, 0x0146, 0x01d6, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0004, 0x20a0, 0x20a9, 0x0010, 0x2009, 0xffff,
-	0x4104, 0x01de, 0x014e, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8,
+	0x7097, 0x0001, 0x080c, 0x5f4a, 0x709b, 0x001a, 0x0029, 0x0010,
+	0x7093, 0x0000, 0x00fe, 0x0005, 0x9085, 0x0001, 0x080c, 0x601f,
+	0x709b, 0x001b, 0x080c, 0xab21, 0x080c, 0x5ff4, 0x2011, 0x0260,
+	0x2009, 0x0240, 0x7490, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084,
+	0x03f8, 0x8004, 0x20a8, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260,
+	0x1150, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000,
+	0x6816, 0x2011, 0x0260, 0x1f04, 0x5d8b, 0x60c3, 0x0084, 0x080c,
+	0x5ead, 0x0005, 0x0005, 0x0086, 0x0096, 0x2029, 0x1848, 0x252c,
+	0x20a9, 0x0008, 0x2041, 0x1c0e, 0x20e9, 0x0001, 0x28a0, 0x080c,
+	0x5ff4, 0x20e1, 0x0000, 0x2099, 0x026e, 0x4003, 0x20a9, 0x0008,
+	0x2011, 0x0007, 0xd5d4, 0x0108, 0x9016, 0x2800, 0x9200, 0x200c,
+	0x91a6, 0xffff, 0x1148, 0xd5d4, 0x0110, 0x8210, 0x0008, 0x8211,
+	0x1f04, 0x5dbd, 0x0804, 0x5e2c, 0x82ff, 0x1160, 0xd5d4, 0x0120,
+	0x91a6, 0x3fff, 0x0d90, 0x0020, 0x91a6, 0x3fff, 0x0904, 0x5e2c,
+	0x918d, 0xc000, 0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4, 0x0110,
+	0x2019, 0x0010, 0x2120, 0xd5d4, 0x0110, 0x8423, 0x0008, 0x8424,
+	0x1240, 0xd5d4, 0x0110, 0x8319, 0x0008, 0x8318, 0x1f04, 0x5de3,
+	0x04d8, 0x23a8, 0x2021, 0x0001, 0x8426, 0x8425, 0x1f04, 0x5df5,
+	0x2328, 0x8529, 0x92be, 0x0007, 0x0158, 0x0006, 0x2039, 0x0007,
+	0x2200, 0x973a, 0x000e, 0x27a8, 0x95a8, 0x0010, 0x1f04, 0x5e04,
+	0x755e, 0x95c8, 0x3325, 0x292d, 0x95ac, 0x00ff, 0x7582, 0x6532,
+	0x6536, 0x0016, 0x2508, 0x080c, 0x2887, 0x001e, 0x60e7, 0x0000,
+	0x65ea, 0x2018, 0x2304, 0x9405, 0x201a, 0x7087, 0x0001, 0x20e9,
+	0x0000, 0x20a1, 0x024e, 0x20e1, 0x0001, 0x2898, 0x20a9, 0x0008,
+	0x4003, 0x9085, 0x0001, 0x0008, 0x9006, 0x009e, 0x008e, 0x0005,
+	0x0156, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x22a8, 0x20e1, 0x0000,
+	0x2099, 0x026e, 0x20e9, 0x0000, 0x2011, 0x024e, 0x22a0, 0x4003,
+	0x014e, 0x013e, 0x01de, 0x01ce, 0x015e, 0x2118, 0x9026, 0x2001,
+	0x0007, 0x939a, 0x0010, 0x0218, 0x8420, 0x8001, 0x0cd0, 0x2118,
+	0x84ff, 0x0120, 0x939a, 0x0010, 0x8421, 0x1de0, 0x2021, 0x0001,
+	0x83ff, 0x0118, 0x8423, 0x8319, 0x1de8, 0x9238, 0x2029, 0x026e,
+	0x9528, 0x2504, 0x942c, 0x11b8, 0x9405, 0x203a, 0x715e, 0x91a0,
+	0x3325, 0x242d, 0x95ac, 0x00ff, 0x7582, 0x6532, 0x6536, 0x0016,
+	0x2508, 0x080c, 0x2887, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7087,
+	0x0001, 0x9084, 0x0000, 0x0005, 0x00e6, 0x2071, 0x1800, 0x708b,
+	0x0000, 0x00ee, 0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071,
+	0x0140, 0x080c, 0x5f39, 0x080c, 0xa273, 0x7004, 0x9084, 0x4000,
+	0x0110, 0x080c, 0x2cff, 0x0126, 0x2091, 0x8000, 0x2071, 0x1826,
+	0x2073, 0x0000, 0x7840, 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c,
+	0x5f96, 0x001e, 0x9094, 0x0010, 0x9285, 0x0080, 0x7842, 0x7a42,
+	0x002e, 0x012e, 0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x2ba5, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012,
+	0x2011, 0x19f1, 0x2013, 0x0000, 0x7093, 0x0000, 0x012e, 0x60a3,
+	0x0056, 0x60a7, 0x9575, 0x080c, 0xa26a, 0x6144, 0xd184, 0x0120,
+	0x7198, 0x918d, 0x2000, 0x0018, 0x718c, 0x918d, 0x1000, 0x2011,
+	0x1999, 0x2112, 0x2009, 0x07d0, 0x2011, 0x5e83, 0x080c, 0x858b,
+	0x0005, 0x0016, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
+	0xadd2, 0x2009, 0x00f7, 0x080c, 0x5f96, 0x2061, 0x19fa, 0x900e,
+	0x611a, 0x611e, 0x6172, 0x6176, 0x2061, 0x1800, 0x6003, 0x0001,
+	0x2061, 0x0100, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009, 0x1999,
+	0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5f05, 0x080c, 0x84e7,
+	0x012e, 0x00ce, 0x002e, 0x001e, 0x0005, 0x00e6, 0x0006, 0x0126,
+	0x2091, 0x8000, 0x0471, 0x2071, 0x0100, 0x080c, 0xa273, 0x2071,
+	0x0140, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2cff, 0x080c,
+	0x73c4, 0x0188, 0x080c, 0x73df, 0x1170, 0x080c, 0x76ae, 0x0016,
+	0x080c, 0x2956, 0x2001, 0x196d, 0x2102, 0x001e, 0x080c, 0x76a9,
+	0x080c, 0x72ee, 0x0050, 0x2009, 0x0001, 0x080c, 0x2c3e, 0x2001,
+	0x0001, 0x080c, 0x27ea, 0x080c, 0x5ed9, 0x012e, 0x000e, 0x00ee,
+	0x0005, 0x2001, 0x180e, 0x2004, 0xd0bc, 0x0158, 0x0026, 0x0036,
+	0x2011, 0x8017, 0x2001, 0x1999, 0x201c, 0x080c, 0x4b04, 0x003e,
+	0x002e, 0x0005, 0x20a9, 0x0012, 0x20e9, 0x0001, 0x20a1, 0x1c80,
+	0x080c, 0x5ff4, 0x20e9, 0x0000, 0x2099, 0x026e, 0x0099, 0x20a9,
+	0x0020, 0x080c, 0x5fee, 0x2099, 0x0260, 0x20a1, 0x1c92, 0x0051,
+	0x20a9, 0x000e, 0x080c, 0x5ff1, 0x2099, 0x0260, 0x20a1, 0x1cb2,
+	0x0009, 0x0005, 0x0016, 0x0026, 0x3410, 0x3308, 0x2104, 0x8007,
+	0x2012, 0x8108, 0x8210, 0x1f04, 0x5f6e, 0x002e, 0x001e, 0x0005,
+	0x080c, 0xab21, 0x20e1, 0x0001, 0x2099, 0x1c00, 0x20e9, 0x0000,
+	0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x080c, 0xab21,
+	0x080c, 0x5ff4, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000,
+	0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x00c6, 0x0006,
+	0x2061, 0x0100, 0x810f, 0x2001, 0x1834, 0x2004, 0x9005, 0x1138,
+	0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x9105, 0x0010, 0x9185,
+	0x00f7, 0x604a, 0x000e, 0x00ce, 0x0005, 0x0016, 0x0046, 0x080c,
+	0x696e, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xe5ae,
+	0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x900e,
+	0x080c, 0x318a, 0x080c, 0xd230, 0x0140, 0x0036, 0x2019, 0xffff,
+	0x2021, 0x0007, 0x080c, 0x4cbb, 0x003e, 0x004e, 0x001e, 0x0005,
+	0x080c, 0x5ed9, 0x709b, 0x0000, 0x7093, 0x0000, 0x0005, 0x0006,
+	0x2001, 0x180c, 0x2004, 0xd09c, 0x0100, 0x000e, 0x0005, 0x0006,
+	0x0016, 0x0126, 0x2091, 0x8000, 0x2001, 0x0101, 0x200c, 0x918d,
+	0x0006, 0x2102, 0x012e, 0x001e, 0x000e, 0x0005, 0x2009, 0x0001,
+	0x0020, 0x2009, 0x0002, 0x0008, 0x900e, 0x6814, 0x9084, 0xffc0,
+	0x910d, 0x6916, 0x0005, 0x00f6, 0x0156, 0x0146, 0x01d6, 0x9006,
+	0x20a9, 0x0080, 0x20e9, 0x0001, 0x20a1, 0x1c00, 0x4004, 0x2079,
+	0x1c00, 0x7803, 0x2200, 0x7807, 0x00ef, 0x780f, 0x00ef, 0x7813,
+	0x0138, 0x7823, 0xffff, 0x7827, 0xffff, 0x01de, 0x014e, 0x015e,
+	0x00fe, 0x0005, 0x2001, 0x1800, 0x2003, 0x0001, 0x0005, 0x2001,
+	0x19a6, 0x0118, 0x2003, 0x0001, 0x0010, 0x2003, 0x0000, 0x0005,
+	0x0156, 0x20a9, 0x0800, 0x2009, 0x1000, 0x9006, 0x200a, 0x8108,
+	0x1f04, 0x602e, 0x015e, 0x0005, 0x00d6, 0x0036, 0x0156, 0x0136,
+	0x0146, 0x2069, 0x1847, 0x9006, 0xb802, 0xb8ce, 0xb807, 0x0707,
+	0xb80a, 0xb80e, 0xb812, 0x9198, 0x3325, 0x231d, 0x939c, 0x00ff,
+	0xbb16, 0x0016, 0x0026, 0xb8c2, 0x080c, 0xadcb, 0x1120, 0x9192,
+	0x007e, 0x1208, 0xbbc2, 0x20a9, 0x0004, 0xb8c4, 0x20e8, 0xb9c8,
+	0x9198, 0x0006, 0x9006, 0x23a0, 0x4004, 0x20a9, 0x0004, 0x9198,
+	0x000a, 0x23a0, 0x4004, 0x002e, 0x001e, 0xb83e, 0xb842, 0xb84e,
+	0xb852, 0xb856, 0xb85a, 0xb85e, 0xb862, 0xb866, 0xb86a, 0xb86f,
+	0x0100, 0xb872, 0xb876, 0xb87a, 0xb88a, 0xb88e, 0xb893, 0x0008,
+	0xb896, 0xb89a, 0xb89e, 0xb8be, 0xb9a2, 0x0096, 0xb8a4, 0x904d,
+	0x0110, 0x080c, 0x1031, 0xb8a7, 0x0000, 0x009e, 0x9006, 0xb84a,
+	0x6810, 0xb83a, 0x680c, 0xb846, 0xb8bb, 0x0520, 0xb8ac, 0x9005,
+	0x0198, 0x00c6, 0x2060, 0x9c82, 0x1cd0, 0x0a0c, 0x0dd5, 0x2001,
+	0x181a, 0x2004, 0x9c02, 0x1a0c, 0x0dd5, 0x080c, 0x8981, 0x00ce,
+	0x090c, 0x8d25, 0xb8af, 0x0000, 0x6814, 0x9084, 0x00ff, 0xb842,
+	0x014e, 0x013e, 0x015e, 0x003e, 0x00de, 0x0005, 0x0126, 0x2091,
+	0x8000, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04,
+	0x611c, 0x9182, 0x0800, 0x1a04, 0x6120, 0x2001, 0x180c, 0x2004,
+	0x9084, 0x0003, 0x1904, 0x6126, 0x9188, 0x1000, 0x2104, 0x905d,
+	0x0518, 0xb804, 0x9084, 0x00ff, 0x908e, 0x0006, 0x1508, 0xb8a4,
+	0x900d, 0x1904, 0x6138, 0xb850, 0x900d, 0x1148, 0xa802, 0x2900,
+	0xb852, 0xb84e, 0x080c, 0x910d, 0x9006, 0x012e, 0x0005, 0x00a6,
+	0x2150, 0x2900, 0xb002, 0xa803, 0x0000, 0x00ae, 0xb852, 0x0c90,
+	0x2001, 0x0005, 0x900e, 0x04b8, 0x2001, 0x0028, 0x900e, 0x0498,
+	0x9082, 0x0006, 0x1290, 0x080c, 0xadcb, 0x1160, 0xb8a0, 0x9084,
+	0xff80, 0x1140, 0xb900, 0xd1fc, 0x0990, 0x2001, 0x0029, 0x2009,
+	0x1000, 0x0408, 0x2001, 0x0028, 0x00a8, 0x2009, 0x180c, 0x210c,
+	0xd18c, 0x0118, 0x2001, 0x0004, 0x0068, 0xd184, 0x0118, 0x2001,
+	0x0004, 0x0040, 0x2001, 0x0029, 0xb900, 0xd1fc, 0x0118, 0x2009,
+	0x1000, 0x0048, 0x900e, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018,
+	0x2001, 0x0029, 0x900e, 0x9005, 0x012e, 0x0005, 0x2001, 0x180c,
+	0x2004, 0xd084, 0x19d0, 0x9188, 0x1000, 0x2104, 0x905d, 0x09a8,
+	0x080c, 0x6972, 0x1990, 0xb800, 0xd0bc, 0x0978, 0x0804, 0x60cf,
+	0x080c, 0x679b, 0x0904, 0x60e8, 0x0804, 0x60d3, 0x00b6, 0x00e6,
+	0x0126, 0x2091, 0x8000, 0xa874, 0x908e, 0x00ff, 0x1120, 0x2001,
+	0x196b, 0x205c, 0x0060, 0xa974, 0x9182, 0x0800, 0x1690, 0x9188,
+	0x1000, 0x2104, 0x905d, 0x01d0, 0x080c, 0x6912, 0x11d0, 0x080c,
+	0xae0b, 0x0570, 0x2b00, 0x6012, 0x2900, 0x6016, 0x6023, 0x0009,
+	0x600b, 0x0000, 0xa874, 0x908e, 0x00ff, 0x1110, 0x600b, 0x8000,
+	0x2009, 0x0043, 0x080c, 0xaedc, 0x9006, 0x00b0, 0x2001, 0x0028,
+	0x0090, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
+	0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029,
+	0x0010, 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005,
+	0x2001, 0x002c, 0x0cc0, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000,
+	0xa974, 0x9182, 0x0800, 0x1a04, 0x6206, 0x9188, 0x1000, 0x2104,
+	0x905d, 0x0904, 0x61de, 0xb8a0, 0x9086, 0x007f, 0x0178, 0x080c,
+	0x697a, 0x0160, 0xa994, 0x81ff, 0x0130, 0x908e, 0x0004, 0x0130,
+	0x908e, 0x0005, 0x0118, 0x080c, 0x6972, 0x1598, 0xa87c, 0xd0fc,
+	0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060, 0x0026, 0x2010, 0x080c,
+	0xcb23, 0x002e, 0x1120, 0x2001, 0x0008, 0x0804, 0x6208, 0x6020,
+	0x9086, 0x000a, 0x0120, 0x2001, 0x0008, 0x0804, 0x6208, 0x601a,
+	0x6003, 0x0008, 0x2900, 0x6016, 0x0058, 0x080c, 0xae0b, 0x05e8,
+	0x2b00, 0x6012, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a,
+	0x2009, 0x0003, 0x080c, 0xaedc, 0x9006, 0x0458, 0x2001, 0x0028,
+	0x0438, 0x9082, 0x0006, 0x1290, 0x080c, 0xadcb, 0x1160, 0xb8a0,
+	0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0900, 0x2001, 0x0029,
+	0x2009, 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090, 0x2009, 0x180c,
+	0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050, 0xd184, 0x0118,
+	0x2001, 0x0004, 0x0028, 0x2001, 0x0029, 0x0010, 0x2001, 0x0029,
+	0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001, 0x002c, 0x0cc0,
+	0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000, 0xa8e0, 0x9005, 0x1550,
+	0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8, 0x9005, 0x1518, 0xa8c4,
+	0x9082, 0x0101, 0x12f8, 0xa974, 0x2079, 0x1800, 0x9182, 0x0800,
+	0x12e8, 0x7830, 0x9084, 0x0003, 0x1130, 0xaa98, 0xab94, 0xa878,
+	0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c, 0x0118, 0x2001, 0x0004,
+	0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029,
+	0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001, 0x0029,
+	0x900e, 0x9006, 0x0008, 0x9005, 0x012e, 0x00be, 0x00fe, 0x0005,
+	0x629d, 0x6258, 0x626f, 0x629d, 0x629d, 0x629d, 0x629d, 0x629d,
+	0x2100, 0x9082, 0x007e, 0x1278, 0x080c, 0x659e, 0x0148, 0x9046,
+	0xb810, 0x9306, 0x1904, 0x62a5, 0xb814, 0x9206, 0x15f0, 0x0028,
+	0xbb12, 0xba16, 0x0010, 0x080c, 0x49b7, 0x0150, 0x04b0, 0x080c,
+	0x65ff, 0x1598, 0xb810, 0x9306, 0x1580, 0xb814, 0x9206, 0x1568,
+	0x080c, 0xae0b, 0x0530, 0x2b00, 0x6012, 0x080c, 0xcfaa, 0x2900,
+	0x6016, 0x600b, 0xffff, 0x6023, 0x000a, 0xa878, 0x9086, 0x0001,
+	0x1170, 0x080c, 0x31bf, 0x9006, 0x080c, 0x653b, 0x2001, 0x0002,
+	0x080c, 0x654f, 0x2001, 0x0200, 0xb86e, 0xb893, 0x0002, 0x2009,
+	0x0003, 0x080c, 0xaedc, 0x9006, 0x0068, 0x2001, 0x0001, 0x900e,
+	0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001, 0x0028, 0x900e,
+	0x9005, 0x0000, 0x012e, 0x00be, 0x00fe, 0x0005, 0x00b6, 0x00f6,
+	0x00e6, 0x0126, 0x2091, 0x8000, 0xa894, 0x90c6, 0x0015, 0x0904,
+	0x648c, 0x90c6, 0x0056, 0x0904, 0x6490, 0x90c6, 0x0066, 0x0904,
+	0x6494, 0x90c6, 0x0067, 0x0904, 0x6498, 0x90c6, 0x0068, 0x0904,
+	0x649c, 0x90c6, 0x0071, 0x0904, 0x64a0, 0x90c6, 0x0074, 0x0904,
+	0x64a4, 0x90c6, 0x007c, 0x0904, 0x64a8, 0x90c6, 0x007e, 0x0904,
+	0x64ac, 0x90c6, 0x0037, 0x0904, 0x64b0, 0x9016, 0x2079, 0x1800,
+	0xa974, 0x9186, 0x00ff, 0x0904, 0x6487, 0x9182, 0x0800, 0x1a04,
+	0x6487, 0x080c, 0x65ff, 0x1198, 0xb804, 0x9084, 0x00ff, 0x9082,
+	0x0006, 0x1268, 0xa894, 0x90c6, 0x006f, 0x0148, 0x080c, 0xadcb,
+	0x1904, 0x6470, 0xb8a0, 0x9084, 0xff80, 0x1904, 0x6470, 0xa894,
+	0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e, 0x0904, 0x63d0, 0x90c6,
+	0x0064, 0x0904, 0x63f9, 0x2008, 0x0804, 0x6392, 0xa998, 0xa8b0,
+	0x2040, 0x080c, 0xadcb, 0x1120, 0x9182, 0x007f, 0x0a04, 0x6392,
+	0x9186, 0x00ff, 0x0904, 0x6392, 0x9182, 0x0800, 0x1a04, 0x6392,
+	0xaaa0, 0xab9c, 0x787c, 0x9306, 0x1188, 0x7880, 0x0096, 0x924e,
+	0x1128, 0x2208, 0x2310, 0x009e, 0x0804, 0x6392, 0x99cc, 0xff00,
+	0x009e, 0x1120, 0x2208, 0x2310, 0x0804, 0x6392, 0x080c, 0x49b7,
+	0x0904, 0x639c, 0x900e, 0x9016, 0x90c6, 0x4000, 0x15e0, 0x0006,
+	0x080c, 0x681f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0,
+	0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0f7c,
+	0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0035, 0x20a0,
+	0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c, 0x0f7c,
+	0xa8c4, 0xabc8, 0x9305, 0xabcc, 0x9305, 0xabd0, 0x9305, 0xabd4,
+	0x9305, 0xabd8, 0x9305, 0xabdc, 0x9305, 0xabe0, 0x9305, 0x9005,
+	0x0510, 0x000e, 0x00c8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x00a0,
+	0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0070, 0x90c6, 0x4009,
+	0x1108, 0x0050, 0x90c6, 0x4006, 0x0138, 0x2001, 0x4005, 0x2009,
+	0x000a, 0x0010, 0x2001, 0x4006, 0xa896, 0xa99a, 0xaa9e, 0x2001,
+	0x0030, 0x900e, 0x0478, 0x000e, 0x080c, 0xae0b, 0x1130, 0x2001,
+	0x4005, 0x2009, 0x0003, 0x9016, 0x0c78, 0x2b00, 0x6012, 0x080c,
+	0xcfaa, 0x2900, 0x6016, 0x6023, 0x0001, 0xa868, 0xd88c, 0x0108,
+	0xc0f5, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x31bf, 0x012e,
+	0x9006, 0x080c, 0x653b, 0x2001, 0x0002, 0x080c, 0x654f, 0x2009,
+	0x0002, 0x080c, 0xaedc, 0xa8b0, 0xd094, 0x0118, 0xb8cc, 0xc08d,
+	0xb8ce, 0x9006, 0x9005, 0x012e, 0x00ee, 0x00fe, 0x00be, 0x0005,
+	0x080c, 0x56e3, 0x0118, 0x2009, 0x0007, 0x00f8, 0xa998, 0xaeb0,
+	0x080c, 0x65ff, 0x1904, 0x638d, 0x9186, 0x007f, 0x0130, 0x080c,
+	0x6972, 0x0118, 0x2009, 0x0009, 0x0080, 0x0096, 0x080c, 0x0fff,
+	0x1120, 0x009e, 0x2009, 0x0002, 0x0040, 0x2900, 0x009e, 0xa806,
+	0x080c, 0xcd1b, 0x19b0, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804,
+	0x6394, 0xa998, 0xaeb0, 0x080c, 0x65ff, 0x1904, 0x638d, 0x0096,
+	0x080c, 0x0fff, 0x1128, 0x009e, 0x2009, 0x0002, 0x0804, 0x644d,
+	0x2900, 0x009e, 0xa806, 0x0096, 0x2048, 0x20a9, 0x002b, 0xb8c4,
+	0x20e0, 0xb8c8, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
+	0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xbbc8,
+	0x9398, 0x0006, 0x2398, 0x080c, 0x0f7c, 0x009e, 0xa87b, 0x0000,
+	0xa883, 0x0000, 0xa897, 0x4000, 0xd684, 0x1168, 0x080c, 0x56cf,
+	0xd0b4, 0x1118, 0xa89b, 0x000b, 0x00e0, 0xb800, 0xd08c, 0x0118,
+	0xa89b, 0x000c, 0x00b0, 0x080c, 0x6972, 0x0118, 0xa89b, 0x0009,
+	0x0080, 0x080c, 0x56e3, 0x0118, 0xa89b, 0x0007, 0x0050, 0x080c,
+	0xccfe, 0x1904, 0x63c9, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804,
+	0x6394, 0xa87b, 0x0030, 0xa897, 0x4005, 0xa804, 0x8006, 0x8006,
+	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009,
+	0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041,
+	0x1243, 0x080c, 0xb37a, 0x1904, 0x63c9, 0x2009, 0x0002, 0x08e8,
+	0x2001, 0x0028, 0x900e, 0x0804, 0x63ca, 0x2009, 0x180c, 0x210c,
+	0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001,
+	0x0004, 0x0010, 0x2001, 0x0029, 0x900e, 0x0804, 0x63ca, 0x2001,
+	0x0029, 0x900e, 0x0804, 0x63ca, 0x080c, 0x3749, 0x0804, 0x63cb,
+	0x080c, 0x540c, 0x0804, 0x63cb, 0x080c, 0x4547, 0x0804, 0x63cb,
+	0x080c, 0x45c0, 0x0804, 0x63cb, 0x080c, 0x461c, 0x0804, 0x63cb,
+	0x080c, 0x4a7a, 0x0804, 0x63cb, 0x080c, 0x4d31, 0x0804, 0x63cb,
+	0x080c, 0x5077, 0x0804, 0x63cb, 0x080c, 0x5270, 0x0804, 0x63cb,
+	0x080c, 0x395f, 0x0804, 0x63cb, 0x00b6, 0xa974, 0xae78, 0x9684,
+	0x3fff, 0x9082, 0x4000, 0x1618, 0x9182, 0x0800, 0x1268, 0x9188,
+	0x1000, 0x2104, 0x905d, 0x0140, 0x080c, 0x6972, 0x1148, 0x00e9,
+	0x080c, 0x672a, 0x9006, 0x00b0, 0x2001, 0x0028, 0x900e, 0x0090,
+	0x9082, 0x0006, 0x1240, 0xb900, 0xd1fc, 0x0d88, 0x2001, 0x0029,
+	0x2009, 0x1000, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018, 0x2001,
+	0x0029, 0x900e, 0x9005, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000,
+	0xb850, 0x900d, 0x0150, 0x2900, 0x0096, 0x2148, 0xa802, 0x009e,
+	0xa803, 0x0000, 0xb852, 0x012e, 0x0005, 0x2900, 0xb852, 0xb84e,
+	0xa803, 0x0000, 0x0cc0, 0x0126, 0x2091, 0x8000, 0xb84c, 0x9005,
+	0x0170, 0x00e6, 0x2071, 0x19e7, 0x7004, 0x9086, 0x0002, 0x0168,
+	0x00ee, 0xb84c, 0xa802, 0x2900, 0xb84e, 0x012e, 0x0005, 0x2900,
+	0xb852, 0xb84e, 0xa803, 0x0000, 0x0cc0, 0x701c, 0x9b06, 0x1d80,
+	0xb84c, 0x00a6, 0x2050, 0xb000, 0xa802, 0x2900, 0xb002, 0x00ae,
+	0x00ee, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0xb84c, 0x904d,
+	0x0130, 0xa800, 0x9005, 0x1108, 0xb852, 0xb84e, 0x9905, 0x012e,
+	0x0005, 0xb84c, 0x904d, 0x0130, 0xa800, 0x9005, 0x1108, 0xb852,
+	0xb84e, 0x9905, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x0026, 0x2091,
+	0x8000, 0x6210, 0x2258, 0xba00, 0x9005, 0x0110, 0xc285, 0x0008,
+	0xc284, 0xba02, 0x002e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6,
+	0x0126, 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006,
+	0x9086, 0x0006, 0x1170, 0xb89c, 0xd0ac, 0x0158, 0x080c, 0x696e,
+	0x0140, 0x9284, 0xff00, 0x8007, 0x9086, 0x0007, 0x1110, 0x2011,
+	0x0600, 0x000e, 0x9294, 0xff00, 0x9215, 0xba06, 0x0006, 0x9086,
+	0x0006, 0x1120, 0xba90, 0x82ff, 0x090c, 0x0dd5, 0x000e, 0x00ce,
+	0x012e, 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000,
+	0x6210, 0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1168, 0xb89c,
+	0xd0a4, 0x0150, 0x080c, 0x696a, 0x1138, 0x9284, 0x00ff, 0x9086,
+	0x0007, 0x1110, 0x2011, 0x0006, 0x000e, 0x9294, 0x00ff, 0x8007,
+	0x9215, 0xba06, 0x00ce, 0x012e, 0x00be, 0x0005, 0x9182, 0x0800,
+	0x0218, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0026, 0x9190, 0x1000,
+	0x2204, 0x905d, 0x1188, 0x0096, 0x080c, 0x0fff, 0x2958, 0x009e,
+	0x0168, 0x2b00, 0x2012, 0xb85c, 0xb8ca, 0xb860, 0xb8c6, 0x9006,
+	0xb8a6, 0xb8ae, 0x080c, 0x6034, 0x9006, 0x0010, 0x9085, 0x0001,
+	0x002e, 0x00de, 0x0005, 0x00b6, 0x0096, 0x0126, 0x2091, 0x8000,
+	0x0026, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0458, 0x00d6,
+	0x9190, 0x1000, 0x2204, 0x905d, 0x0518, 0x2013, 0x0000, 0xb8a4,
+	0x904d, 0x0110, 0x080c, 0x1031, 0x00d6, 0x00c6, 0xb8bc, 0x2060,
+	0x8cff, 0x0168, 0x600c, 0x0006, 0x6014, 0x2048, 0x080c, 0xcb35,
+	0x0110, 0x080c, 0x0fb1, 0x080c, 0xae61, 0x00ce, 0x0c88, 0x00ce,
+	0x00de, 0x2b48, 0xb8c8, 0xb85e, 0xb8c4, 0xb862, 0x080c, 0x1041,
+	0x00de, 0x9006, 0x002e, 0x012e, 0x009e, 0x00be, 0x0005, 0x0016,
+	0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0030, 0x9188, 0x1000,
+	0x2104, 0x905d, 0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156,
+	0x0136, 0x0146, 0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802,
+	0x080c, 0x73bc, 0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c,
+	0xadcb, 0x11d8, 0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061,
+	0x1982, 0x7048, 0x2062, 0x704c, 0x6006, 0x7050, 0x600a, 0x7054,
+	0x600e, 0x00ce, 0x703c, 0x2069, 0x0140, 0x9005, 0x1110, 0x2001,
+	0x0001, 0x6886, 0x2069, 0x1800, 0x68b6, 0x7040, 0xb85e, 0x7048,
+	0xb862, 0x704c, 0xb866, 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8c4,
+	0x20e8, 0xb8c8, 0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003,
+	0x2099, 0x027a, 0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003,
+	0x2069, 0x0200, 0x6817, 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e,
+	0x7048, 0xb872, 0x7050, 0xb876, 0x2069, 0x0200, 0x6817, 0x0000,
+	0xb8a0, 0x9086, 0x007e, 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211,
+	0x1218, 0x2009, 0x0008, 0x0400, 0x9182, 0x0259, 0x1218, 0x2009,
+	0x0007, 0x00d0, 0x9182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0,
+	0x9182, 0x0349, 0x1218, 0x2009, 0x0005, 0x0070, 0x9182, 0x0421,
+	0x1218, 0x2009, 0x0004, 0x0040, 0x9182, 0x0581, 0x1218, 0x2009,
+	0x0003, 0x0010, 0x2009, 0x0002, 0xb992, 0x014e, 0x013e, 0x015e,
+	0x00de, 0x0005, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034,
+	0xb896, 0x703c, 0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbcc, 0xc384,
+	0xba00, 0x2009, 0x1867, 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110,
+	0xc2ad, 0x0008, 0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd,
+	0xd0cc, 0x0128, 0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02,
+	0xbbce, 0x003e, 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096, 0x0126,
+	0x2091, 0x8000, 0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0,
+	0xaa04, 0x9282, 0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6,
+	0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0,
+	0x9080, 0x0004, 0x2098, 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002,
+	0x9086, 0xffff, 0x0120, 0x8109, 0x1dd0, 0x080c, 0x0dd5, 0x3c00,
+	0x20e8, 0x3300, 0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de,
+	0x01ce, 0x014e, 0x013e, 0x0060, 0x080c, 0x0fff, 0x0170, 0x2900,
+	0xb8a6, 0xa803, 0x0000, 0x080c, 0x67bb, 0xa807, 0x0001, 0xae12,
+	0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126,
+	0x2091, 0x8000, 0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005,
+	0x1150, 0x080c, 0x67ca, 0x1158, 0xa804, 0x908a, 0x0002, 0x0218,
+	0x8001, 0xa806, 0x0020, 0x080c, 0x1031, 0xb8a7, 0x0000, 0x009e,
+	0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x910d, 0x012e,
+	0x0005, 0x901e, 0x0010, 0x2019, 0x0001, 0x900e, 0x0126, 0x2091,
+	0x8000, 0xb84c, 0x2048, 0xb800, 0xd0dc, 0x1170, 0x89ff, 0x0500,
+	0x83ff, 0x0120, 0xa878, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406,
+	0x1118, 0xa870, 0x9506, 0x0120, 0x2908, 0xa800, 0x2048, 0x0c70,
+	0x080c, 0xa692, 0xaa00, 0xb84c, 0x9906, 0x1110, 0xba4e, 0x0020,
+	0x00a6, 0x2150, 0xb202, 0x00ae, 0x82ff, 0x1110, 0xb952, 0x89ff,
+	0x012e, 0x0005, 0x9016, 0x0489, 0x1110, 0x2011, 0x0001, 0x0005,
+	0x080c, 0x681f, 0x0128, 0x080c, 0xcbf2, 0x0010, 0x9085, 0x0001,
+	0x0005, 0x080c, 0x681f, 0x0128, 0x080c, 0xcb97, 0x0010, 0x9085,
+	0x0001, 0x0005, 0x080c, 0x681f, 0x0128, 0x080c, 0xcbef, 0x0010,
+	0x9085, 0x0001, 0x0005, 0x080c, 0x681f, 0x0128, 0x080c, 0xcbb6,
+	0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x681f, 0x0128, 0x080c,
+	0xcc33, 0x0010, 0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118,
+	0x9085, 0x0001, 0x0005, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8,
 	0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0,
 	0x9080, 0x0004, 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002,
-	0x9606, 0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0068, 0x0146,
-	0x01d6, 0x3300, 0x8001, 0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff,
-	0x4004, 0x01de, 0x014e, 0x9006, 0x01ce, 0x013e, 0x0005, 0x0096,
-	0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x1128, 0x080c, 0x0fff,
-	0x0168, 0x2900, 0xb8a6, 0x080c, 0x67bc, 0xa803, 0x0001, 0xa807,
-	0x0000, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8,
-	0x0096, 0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7,
-	0x0000, 0x080c, 0x1031, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005,
-	0xb89c, 0xd0a4, 0x0005, 0x00b6, 0x00f6, 0x080c, 0x73b0, 0x01b0,
-	0x71c4, 0x81ff, 0x1198, 0x71dc, 0xd19c, 0x0180, 0x2001, 0x007e,
-	0x9080, 0x1000, 0x2004, 0x905d, 0x0148, 0xb804, 0x9084, 0x00ff,
-	0x9086, 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x2079, 0x1847,
-	0x7804, 0xd0a4, 0x01d0, 0x0156, 0x20a9, 0x007f, 0x900e, 0x0016,
-	0x080c, 0x6600, 0x1168, 0xb804, 0x9084, 0xff00, 0x8007, 0x9096,
-	0x0004, 0x0118, 0x9086, 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802,
-	0x001e, 0x8108, 0x1f04, 0x6847, 0x015e, 0x080c, 0x6928, 0x0120,
-	0x2001, 0x1985, 0x200c, 0x0038, 0x2079, 0x1847, 0x7804, 0xd0a4,
-	0x0130, 0x2009, 0x07d0, 0x2011, 0x6872, 0x080c, 0x8562, 0x00fe,
-	0x00be, 0x0005, 0x00b6, 0x2011, 0x6872, 0x080c, 0x84ca, 0x080c,
-	0x6928, 0x01d8, 0x2001, 0x107e, 0x2004, 0x2058, 0xb900, 0xc1ec,
-	0xb902, 0x080c, 0x6966, 0x0130, 0x2009, 0x07d0, 0x2011, 0x6872,
-	0x080c, 0x8562, 0x00e6, 0x2071, 0x1800, 0x9006, 0x707e, 0x7060,
-	0x7082, 0x080c, 0x2f96, 0x00ee, 0x04b0, 0x0156, 0x00c6, 0x20a9,
-	0x007f, 0x900e, 0x0016, 0x080c, 0x6600, 0x1538, 0xb800, 0xd0ec,
-	0x0520, 0x0046, 0xbaa0, 0x2220, 0x9006, 0x2009, 0x0029, 0x080c,
-	0xe58d, 0xb800, 0xc0e5, 0xc0ec, 0xb802, 0x080c, 0x6962, 0x2001,
-	0x0707, 0x1128, 0xb804, 0x9084, 0x00ff, 0x9085, 0x0700, 0xb806,
-	0x2019, 0x0029, 0x080c, 0x9262, 0x0076, 0x903e, 0x080c, 0x913f,
-	0x900e, 0x080c, 0xe2ca, 0x007e, 0x004e, 0x001e, 0x8108, 0x1f04,
-	0x689a, 0x00ce, 0x015e, 0x00be, 0x0005, 0x00b6, 0x6010, 0x2058,
-	0xb800, 0xc0ec, 0xb802, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x0096,
-	0x080c, 0x1018, 0x090c, 0x0dd5, 0x2958, 0x009e, 0x2001, 0x196b,
-	0x2b02, 0xb8af, 0x0000, 0x2009, 0x00ff, 0x080c, 0x6035, 0xb807,
+	0x9606, 0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0008, 0x9006,
+	0x01ce, 0x013e, 0x0005, 0x0146, 0x01d6, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0004, 0x20a0, 0x20a9, 0x0010, 0x2009, 0xffff, 0x4104,
+	0x01de, 0x014e, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e,
+	0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080,
+	0x0004, 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002, 0x9606,
+	0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0068, 0x0146, 0x01d6,
+	0x3300, 0x8001, 0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004,
+	0x01de, 0x014e, 0x9006, 0x01ce, 0x013e, 0x0005, 0x0096, 0x0126,
+	0x2091, 0x8000, 0xb8a4, 0x904d, 0x1128, 0x080c, 0x0fff, 0x0168,
+	0x2900, 0xb8a6, 0x080c, 0x67bb, 0xa803, 0x0001, 0xa807, 0x0000,
+	0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096,
+	0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000,
+	0x080c, 0x1031, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0xb89c,
+	0xd0a4, 0x0005, 0x00b6, 0x00f6, 0x080c, 0x73bc, 0x01b0, 0x71c4,
+	0x81ff, 0x1198, 0x71dc, 0xd19c, 0x0180, 0x2001, 0x007e, 0x9080,
+	0x1000, 0x2004, 0x905d, 0x0148, 0xb804, 0x9084, 0x00ff, 0x9086,
+	0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x2079, 0x1847, 0x7804,
+	0xd0a4, 0x01d0, 0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c,
+	0x65ff, 0x1168, 0xb804, 0x9084, 0xff00, 0x8007, 0x9096, 0x0004,
+	0x0118, 0x9086, 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e,
+	0x8108, 0x1f04, 0x6846, 0x015e, 0x080c, 0x6930, 0x0120, 0x2001,
+	0x1985, 0x200c, 0x0038, 0x2079, 0x1847, 0x7804, 0xd0a4, 0x0130,
+	0x2009, 0x07d0, 0x2011, 0x6871, 0x080c, 0x858b, 0x00fe, 0x00be,
+	0x0005, 0x00b6, 0x2011, 0x6871, 0x080c, 0x84f3, 0x080c, 0x6930,
+	0x01d8, 0x2001, 0x107e, 0x2004, 0x2058, 0xb900, 0xc1ec, 0xb902,
+	0x080c, 0x696e, 0x0130, 0x2009, 0x07d0, 0x2011, 0x6871, 0x080c,
+	0x858b, 0x00e6, 0x2071, 0x1800, 0x9006, 0x707e, 0x7060, 0x7082,
+	0x080c, 0x2f96, 0x00ee, 0x04b0, 0x0156, 0x00c6, 0x20a9, 0x007f,
+	0x900e, 0x0016, 0x080c, 0x65ff, 0x1538, 0xb800, 0xd0ec, 0x0520,
+	0x0046, 0xbaa0, 0x2220, 0x9006, 0x2009, 0x0029, 0x080c, 0xe5ae,
+	0xb800, 0xc0e5, 0xc0ec, 0xb802, 0x080c, 0x696a, 0x2001, 0x0707,
+	0x1128, 0xb804, 0x9084, 0x00ff, 0x9085, 0x0700, 0xb806, 0x2019,
+	0x0029, 0x080c, 0x928b, 0x0076, 0x903e, 0x080c, 0x9168, 0x900e,
+	0x080c, 0xe2eb, 0x007e, 0x004e, 0x001e, 0x8108, 0x1f04, 0x6899,
+	0x00ce, 0x015e, 0x00be, 0x0005, 0x00b6, 0x6010, 0x2058, 0xb800,
+	0xc0ec, 0xb802, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x0096, 0x080c,
+	0x1018, 0x090c, 0x0dd5, 0x2958, 0x009e, 0x2001, 0x196b, 0x2b02,
+	0x8b07, 0x8006, 0x8006, 0x908c, 0x003f, 0xb9c6, 0x908c, 0xffc0,
+	0xb9ca, 0xb8af, 0x0000, 0x2009, 0x00ff, 0x080c, 0x6034, 0xb807,
 	0x0006, 0xb813, 0x00ff, 0xb817, 0xffff, 0xb86f, 0x0200, 0xb86c,
 	0xb893, 0x0002, 0xb8bb, 0x0520, 0xb8a3, 0x00ff, 0xb8af, 0x0000,
 	0x00ce, 0x00be, 0x0005, 0x7810, 0x00b6, 0x2058, 0xb800, 0x00be,
@@ -3164,84 +3165,84 @@
 	0x0006, 0xbaa0, 0x9290, 0x1000, 0x2204, 0x9b06, 0x190c, 0x0dd5,
 	0x000e, 0xba00, 0x9005, 0x0110, 0xc2fd, 0x0008, 0xc2fc, 0xba02,
 	0x002e, 0x012e, 0x0005, 0x2011, 0x1837, 0x2204, 0xd0cc, 0x0138,
-	0x2001, 0x1983, 0x200c, 0x2011, 0x6958, 0x080c, 0x8562, 0x0005,
-	0x2011, 0x6958, 0x080c, 0x84ca, 0x2011, 0x1837, 0x2204, 0xc0cc,
-	0x2012, 0x0005, 0x080c, 0x56d0, 0xd0ac, 0x0005, 0x080c, 0x56d0,
+	0x2001, 0x1983, 0x200c, 0x2011, 0x6960, 0x080c, 0x858b, 0x0005,
+	0x2011, 0x6960, 0x080c, 0x84f3, 0x2011, 0x1837, 0x2204, 0xc0cc,
+	0x2012, 0x0005, 0x080c, 0x56cf, 0xd0ac, 0x0005, 0x080c, 0x56cf,
 	0xd0a4, 0x0005, 0x0016, 0xb904, 0x9184, 0x00ff, 0x908e, 0x0006,
 	0x001e, 0x0005, 0x0016, 0xb904, 0x9184, 0xff00, 0x8007, 0x908e,
-	0x0006, 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xd216, 0x0158,
+	0x0006, 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xd230, 0x0158,
 	0x70dc, 0x9084, 0x0028, 0x0138, 0x2001, 0x107f, 0x2004, 0x905d,
 	0x0110, 0xb8cc, 0xd094, 0x00fe, 0x00be, 0x0005, 0x2071, 0x1910,
 	0x7003, 0x0001, 0x7007, 0x0000, 0x9006, 0x7012, 0x7016, 0x701a,
 	0x701e, 0x700a, 0x7046, 0x2001, 0x1947, 0x2003, 0x0000, 0x0005,
-	0x0016, 0x00e6, 0x2071, 0x1948, 0x900e, 0x710a, 0x080c, 0x56d0,
-	0xd0fc, 0x1140, 0x080c, 0x56d0, 0x900e, 0xd09c, 0x0108, 0x8108,
+	0x0016, 0x00e6, 0x2071, 0x1948, 0x900e, 0x710a, 0x080c, 0x56cf,
+	0xd0fc, 0x1140, 0x080c, 0x56cf, 0x900e, 0xd09c, 0x0108, 0x8108,
 	0x7102, 0x00f8, 0x2001, 0x1867, 0x200c, 0x9184, 0x0007, 0x0002,
-	0x69aa, 0x69aa, 0x69aa, 0x69aa, 0x69aa, 0x69c0, 0x69ce, 0x69aa,
+	0x69b2, 0x69b2, 0x69b2, 0x69b2, 0x69b2, 0x69c8, 0x69d6, 0x69b2,
 	0x7003, 0x0003, 0x2009, 0x1868, 0x210c, 0x9184, 0xff00, 0x8007,
 	0x9005, 0x1110, 0x2001, 0x0002, 0x7006, 0x0018, 0x7003, 0x0005,
 	0x0c88, 0x00ee, 0x001e, 0x0005, 0x00e6, 0x2071, 0x0050, 0x684c,
 	0x9005, 0x1150, 0x00e6, 0x2071, 0x1910, 0x7028, 0xc085, 0x702a,
 	0x00ee, 0x9085, 0x0001, 0x0488, 0x6844, 0x9005, 0x0158, 0x080c,
-	0x770a, 0x6a60, 0x9200, 0x7002, 0x6864, 0x9101, 0x7006, 0x9006,
+	0x7716, 0x6a60, 0x9200, 0x7002, 0x6864, 0x9101, 0x7006, 0x9006,
 	0x7012, 0x7016, 0x6860, 0x7002, 0x6864, 0x7006, 0x6868, 0x700a,
 	0x686c, 0x700e, 0x6844, 0x9005, 0x1110, 0x7012, 0x7016, 0x684c,
 	0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x7037, 0x0019, 0x702b,
 	0x0001, 0x00e6, 0x2071, 0x1910, 0x7028, 0xc084, 0x702a, 0x7007,
 	0x0001, 0x700b, 0x0000, 0x00ee, 0x9006, 0x00ee, 0x0005, 0x00e6,
-	0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904, 0x6c7e, 0x9286,
-	0x0003, 0x0904, 0x6b14, 0x9286, 0x0005, 0x0904, 0x6b14, 0x2071,
-	0x1877, 0xa87c, 0x9005, 0x0904, 0x6a75, 0x7140, 0xa868, 0x9102,
-	0x0a04, 0x6c7e, 0xa878, 0xd084, 0x15d8, 0xa853, 0x0019, 0x2001,
-	0x8023, 0xa84e, 0x2071, 0x1910, 0x701c, 0x9005, 0x1904, 0x6e20,
-	0x0e04, 0x6e8e, 0x2071, 0x0000, 0xa850, 0x7032, 0xa84c, 0x7082,
+	0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904, 0x6c86, 0x9286,
+	0x0003, 0x0904, 0x6b1c, 0x9286, 0x0005, 0x0904, 0x6b1c, 0x2071,
+	0x1877, 0xa87c, 0x9005, 0x0904, 0x6a7d, 0x7140, 0xa868, 0x9102,
+	0x0a04, 0x6c86, 0xa878, 0xd084, 0x15d8, 0xa853, 0x0019, 0x2001,
+	0x8023, 0xa84e, 0x2071, 0x1910, 0x701c, 0x9005, 0x1904, 0x6e28,
+	0x0e04, 0x6e96, 0x2071, 0x0000, 0xa850, 0x7032, 0xa84c, 0x7082,
 	0xa870, 0x7086, 0xa86c, 0x708a, 0xa880, 0x708e, 0x7036, 0x0146,
 	0x01d6, 0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a,
 	0xa868, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098,
 	0x4003, 0x015e, 0x01ce, 0x013e, 0x01de, 0x014e, 0x2091, 0x4080,
-	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x0804, 0x6af7,
+	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x0804, 0x6aff,
 	0xa853, 0x001b, 0x2001, 0x8027, 0x0820, 0x7004, 0xd08c, 0x1904,
-	0x6c7e, 0xa853, 0x001a, 0x2001, 0x8024, 0x0804, 0x6a39, 0x00e6,
-	0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904, 0x6c7e, 0x9286,
-	0x0003, 0x0904, 0x6b14, 0x9286, 0x0005, 0x0904, 0x6b14, 0xa84f,
-	0x8022, 0xa853, 0x0018, 0x0804, 0x6adc, 0xa868, 0xd0fc, 0x11d8,
-	0x00e6, 0x0026, 0x2001, 0x1948, 0x2004, 0x9005, 0x0904, 0x6c7e,
-	0xa87c, 0xd0bc, 0x1904, 0x6c7e, 0xa978, 0xa874, 0x9105, 0x1904,
-	0x6c7e, 0x2001, 0x1948, 0x2004, 0x0002, 0x6c7e, 0x6ad8, 0x6b14,
-	0x6b14, 0x6c7e, 0x6b14, 0x0005, 0xa868, 0xd0fc, 0x1500, 0x00e6,
-	0x0026, 0x2009, 0x1948, 0x210c, 0x81ff, 0x0904, 0x6c7e, 0xa87c,
-	0xd0cc, 0x0904, 0x6c7e, 0xa880, 0x9084, 0x00ff, 0x9086, 0x0001,
-	0x1904, 0x6c7e, 0x9186, 0x0003, 0x0904, 0x6b14, 0x9186, 0x0005,
-	0x0904, 0x6b14, 0xa84f, 0x8021, 0xa853, 0x0017, 0x0028, 0x0005,
+	0x6c86, 0xa853, 0x001a, 0x2001, 0x8024, 0x0804, 0x6a41, 0x00e6,
+	0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904, 0x6c86, 0x9286,
+	0x0003, 0x0904, 0x6b1c, 0x9286, 0x0005, 0x0904, 0x6b1c, 0xa84f,
+	0x8022, 0xa853, 0x0018, 0x0804, 0x6ae4, 0xa868, 0xd0fc, 0x11d8,
+	0x00e6, 0x0026, 0x2001, 0x1948, 0x2004, 0x9005, 0x0904, 0x6c86,
+	0xa87c, 0xd0bc, 0x1904, 0x6c86, 0xa978, 0xa874, 0x9105, 0x1904,
+	0x6c86, 0x2001, 0x1948, 0x2004, 0x0002, 0x6c86, 0x6ae0, 0x6b1c,
+	0x6b1c, 0x6c86, 0x6b1c, 0x0005, 0xa868, 0xd0fc, 0x1500, 0x00e6,
+	0x0026, 0x2009, 0x1948, 0x210c, 0x81ff, 0x0904, 0x6c86, 0xa87c,
+	0xd0cc, 0x0904, 0x6c86, 0xa880, 0x9084, 0x00ff, 0x9086, 0x0001,
+	0x1904, 0x6c86, 0x9186, 0x0003, 0x0904, 0x6b1c, 0x9186, 0x0005,
+	0x0904, 0x6b1c, 0xa84f, 0x8021, 0xa853, 0x0017, 0x0028, 0x0005,
 	0xa84f, 0x8020, 0xa853, 0x0016, 0x2071, 0x1910, 0x701c, 0x9005,
-	0x1904, 0x6e20, 0x0e04, 0x6e8e, 0x2071, 0x0000, 0xa84c, 0x7082,
+	0x1904, 0x6e28, 0x0e04, 0x6e96, 0x2071, 0x0000, 0xa84c, 0x7082,
 	0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0x2091,
 	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x2071,
 	0x1800, 0x2011, 0x0001, 0xa804, 0x900d, 0x702c, 0x1158, 0xa802,
-	0x2900, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x002e,
+	0x2900, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x002e,
 	0x00ee, 0x0005, 0x0096, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
 	0x81ff, 0x1dc8, 0x009e, 0x0c58, 0xa84f, 0x0000, 0x00f6, 0x2079,
 	0x0050, 0x2071, 0x1910, 0xa803, 0x0000, 0x7010, 0x9005, 0x1904,
-	0x6c03, 0x782c, 0x908c, 0x0780, 0x190c, 0x6fda, 0x8004, 0x8004,
-	0x8004, 0x9084, 0x0003, 0x0002, 0x6b32, 0x6c03, 0x6b57, 0x6b9e,
+	0x6c0b, 0x782c, 0x908c, 0x0780, 0x190c, 0x6fe2, 0x8004, 0x8004,
+	0x8004, 0x9084, 0x0003, 0x0002, 0x6b3a, 0x6c0b, 0x6b5f, 0x6ba6,
 	0x080c, 0x0dd5, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d,
 	0x1170, 0x2071, 0x19fa, 0x703c, 0x9005, 0x1328, 0x2001, 0x1949,
 	0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016,
 	0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x0c10, 0x2071,
+	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x0c10, 0x2071,
 	0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1580, 0x7824, 0x00e6,
 	0x2071, 0x0040, 0x712c, 0xd19c, 0x1148, 0x2009, 0x1830, 0x210c,
 	0x918a, 0x0020, 0x0218, 0x7022, 0x00ee, 0x0058, 0x00ee, 0x2048,
 	0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c,
-	0x83eb, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fda, 0xd0a4, 0x19f0,
+	0x8414, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fe2, 0xd0a4, 0x19f0,
 	0x2071, 0x19fa, 0x703c, 0x9005, 0x1328, 0x2001, 0x1949, 0x2004,
 	0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016, 0x702c,
 	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x0800, 0x0096, 0x00e6,
+	0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x0800, 0x0096, 0x00e6,
 	0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e,
-	0x70c0, 0x8000, 0x70c2, 0x080c, 0x83eb, 0x782c, 0x9094, 0x0780,
-	0x190c, 0x6fda, 0xd0a4, 0x1d60, 0x00ee, 0x782c, 0x9094, 0x0780,
-	0x190c, 0x6fda, 0xd09c, 0x11a0, 0x009e, 0x2900, 0x7822, 0xa804,
+	0x70c0, 0x8000, 0x70c2, 0x080c, 0x8414, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6fe2, 0xd0a4, 0x1d60, 0x00ee, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6fe2, 0xd09c, 0x11a0, 0x009e, 0x2900, 0x7822, 0xa804,
 	0x900d, 0x1560, 0x2071, 0x19fa, 0x703c, 0x9005, 0x1328, 0x2001,
 	0x1949, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005,
 	0x009e, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a,
@@ -3249,85 +3250,85 @@
 	0x2071, 0x19fa, 0x703c, 0x9005, 0x1328, 0x2001, 0x1949, 0x2004,
 	0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800,
 	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x00fe,
+	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x00fe,
 	0x002e, 0x00ee, 0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018,
 	0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804,
-	0x900d, 0x1904, 0x6c58, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fda,
+	0x900d, 0x1904, 0x6c60, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fe2,
 	0xd09c, 0x1198, 0x701c, 0x904d, 0x0180, 0x7010, 0x8001, 0x7012,
 	0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x6fda, 0xd09c, 0x0d68, 0x782c, 0x9094, 0x0780,
-	0x190c, 0x6fda, 0xd0a4, 0x01b0, 0x00e6, 0x7824, 0x2048, 0x2071,
+	0x0780, 0x190c, 0x6fe2, 0xd09c, 0x0d68, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6fe2, 0xd0a4, 0x01b0, 0x00e6, 0x7824, 0x2048, 0x2071,
 	0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2,
-	0x080c, 0x83eb, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fda, 0xd0a4,
+	0x080c, 0x8414, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fe2, 0xd0a4,
 	0x1d60, 0x00ee, 0x2071, 0x19fa, 0x703c, 0x9005, 0x1328, 0x2001,
 	0x1949, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005,
 	0x00e6, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802,
 	0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2,
-	0x080c, 0x83eb, 0x00ee, 0x0804, 0x6c13, 0xa868, 0xd0fc, 0x1560,
+	0x080c, 0x8414, 0x00ee, 0x0804, 0x6c1b, 0xa868, 0xd0fc, 0x1560,
 	0x0096, 0xa804, 0xa807, 0x0000, 0x904d, 0x190c, 0x0fb1, 0x009e,
 	0x0018, 0xa868, 0xd0fc, 0x1500, 0x00e6, 0x0026, 0xa84f, 0x0000,
 	0x00f6, 0x2079, 0x0050, 0x2071, 0x1910, 0xa803, 0x0000, 0x7010,
-	0x9005, 0x1904, 0x6d9a, 0x782c, 0x908c, 0x0780, 0x190c, 0x6fda,
-	0x8004, 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6c9d, 0x6d9a,
-	0x6cb8, 0x6d29, 0x080c, 0x0dd5, 0x0005, 0x2071, 0x1800, 0x2900,
+	0x9005, 0x1904, 0x6da2, 0x782c, 0x908c, 0x0780, 0x190c, 0x6fe2,
+	0x8004, 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6ca5, 0x6da2,
+	0x6cc0, 0x6d31, 0x080c, 0x0dd5, 0x0005, 0x2071, 0x1800, 0x2900,
 	0x7822, 0xa804, 0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005,
 	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x0c60,
-	0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1904, 0x6d18,
+	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x0c60,
+	0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1904, 0x6d20,
 	0x7830, 0x8007, 0x9084, 0x001f, 0x9082, 0x0005, 0x1220, 0x00fe,
 	0x002e, 0x00ee, 0x0005, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c,
 	0xd19c, 0x1148, 0x2009, 0x1830, 0x210c, 0x918a, 0x0020, 0x0218,
 	0x7022, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900,
-	0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x83eb, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x6fda, 0xd0a4, 0x19f0, 0x0e04, 0x6d0f, 0x7838,
+	0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8414, 0x782c, 0x9094,
+	0x0780, 0x190c, 0x6fe2, 0xd0a4, 0x19f0, 0x0e04, 0x6d17, 0x7838,
 	0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833,
 	0x0013, 0x00de, 0x2001, 0x1921, 0x200c, 0xc184, 0x2102, 0x2091,
 	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x2009,
 	0x1947, 0x200b, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2001,
 	0x1921, 0x200c, 0xc185, 0x2102, 0x00fe, 0x002e, 0x00ee, 0x0005,
 	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x0804,
-	0x6ccb, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c,
-	0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x83eb,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6fda, 0xd0a4, 0x1d60, 0x00ee,
-	0x0e04, 0x6d6d, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069,
+	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x0804,
+	0x6cd3, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c,
+	0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8414,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x6fe2, 0xd0a4, 0x1d60, 0x00ee,
+	0x0e04, 0x6d75, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069,
 	0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044, 0xc084, 0x7046,
 	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b,
 	0x2009, 0x1947, 0x200b, 0x0000, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x6fda, 0xd09c, 0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d,
+	0x6fe2, 0xd09c, 0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d,
 	0x11e0, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046,
 	0x0c58, 0x009e, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
 	0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
 	0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016,
 	0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x00fe, 0x002e,
+	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x00fe, 0x002e,
 	0x00ee, 0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
 	0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
-	0x1904, 0x6e0b, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fda, 0xd09c,
+	0x1904, 0x6e13, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fe2, 0xd09c,
 	0x11b0, 0x701c, 0x904d, 0x0198, 0xa84c, 0x9005, 0x1180, 0x7010,
 	0x8001, 0x7012, 0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6fda, 0xd09c, 0x0d50, 0x782c,
-	0x9094, 0x0780, 0x190c, 0x6fda, 0xd0a4, 0x05c8, 0x00e6, 0x7824,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x6fe2, 0xd09c, 0x0d50, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x6fe2, 0xd0a4, 0x05c8, 0x00e6, 0x7824,
 	0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0,
-	0x8000, 0x70c2, 0x080c, 0x83eb, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x6fda, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x6e04, 0x7838, 0x7938,
+	0x8000, 0x70c2, 0x080c, 0x8414, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x6fe2, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x6e0c, 0x7838, 0x7938,
 	0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
 	0x00de, 0x7044, 0xc084, 0x7046, 0x2091, 0x4080, 0x2001, 0x0089,
 	0x2004, 0xd084, 0x190c, 0x119b, 0x2009, 0x1947, 0x200b, 0x0000,
 	0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x00fe,
 	0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800, 0x9016, 0x702c,
 	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x00ee, 0x0804, 0x6daa,
+	0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x00ee, 0x0804, 0x6db2,
 	0x2071, 0x1910, 0xa803, 0x0000, 0x2908, 0x7010, 0x8000, 0x7012,
 	0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148,
-	0xa804, 0x900d, 0x1128, 0x1e04, 0x6e4b, 0x002e, 0x00ee, 0x0005,
+	0xa804, 0x900d, 0x1128, 0x1e04, 0x6e53, 0x002e, 0x00ee, 0x0005,
 	0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
 	0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c,
-	0x83eb, 0x0e04, 0x6e35, 0x2071, 0x1910, 0x701c, 0x2048, 0xa84c,
+	0x8414, 0x0e04, 0x6e3d, 0x2071, 0x1910, 0x701c, 0x2048, 0xa84c,
 	0x900d, 0x0d18, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c,
 	0x7086, 0x7036, 0xa870, 0x708a, 0xa850, 0x9082, 0x0019, 0x1278,
 	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b,
-	0x2071, 0x1910, 0x080c, 0x6fc6, 0x002e, 0x00ee, 0x0005, 0xa850,
+	0x2071, 0x1910, 0x080c, 0x6fce, 0x002e, 0x00ee, 0x0005, 0xa850,
 	0x9082, 0x001c, 0x1e68, 0xa880, 0x708e, 0x7036, 0x0146, 0x01d6,
 	0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a, 0xa868,
 	0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x4003,
@@ -3336,23 +3337,23 @@
 	0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
 	0x1118, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c,
 	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70c0, 0x9200, 0x70c2, 0x080c, 0x83eb, 0x002e, 0x00ee, 0x0005,
+	0x70c0, 0x9200, 0x70c2, 0x080c, 0x8414, 0x002e, 0x00ee, 0x0005,
 	0x0006, 0xa87c, 0x0006, 0xa867, 0x0103, 0x20a9, 0x001c, 0xa860,
 	0x20e8, 0xa85c, 0x9080, 0x001d, 0x20a0, 0x9006, 0x4004, 0x000e,
 	0x9084, 0x00ff, 0xa87e, 0x000e, 0xa87a, 0xa982, 0x0005, 0x2071,
-	0x1910, 0x7004, 0x0002, 0x6ed9, 0x6eda, 0x6fc5, 0x6eda, 0x0dd5,
-	0x6fc5, 0x0005, 0x2001, 0x1948, 0x2004, 0x0002, 0x6ee4, 0x6ee4,
-	0x6f5e, 0x6f5f, 0x6ee4, 0x6f5f, 0x0126, 0x2091, 0x8000, 0x1e0c,
-	0x6fe5, 0x701c, 0x904d, 0x0508, 0xa84c, 0x9005, 0x0904, 0x6f2f,
-	0x0e04, 0x6f0d, 0xa94c, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032,
+	0x1910, 0x7004, 0x0002, 0x6ee1, 0x6ee2, 0x6fcd, 0x6ee2, 0x0dd5,
+	0x6fcd, 0x0005, 0x2001, 0x1948, 0x2004, 0x0002, 0x6eec, 0x6eec,
+	0x6f66, 0x6f67, 0x6eec, 0x6f67, 0x0126, 0x2091, 0x8000, 0x1e0c,
+	0x6fed, 0x701c, 0x904d, 0x0508, 0xa84c, 0x9005, 0x0904, 0x6f37,
+	0x0e04, 0x6f15, 0xa94c, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032,
 	0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0xa850, 0x9082, 0x0019,
 	0x1278, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-	0x119b, 0x2071, 0x1910, 0x080c, 0x6fc6, 0x012e, 0x0804, 0x6f5d,
+	0x119b, 0x2071, 0x1910, 0x080c, 0x6fce, 0x012e, 0x0804, 0x6f65,
 	0xa850, 0x9082, 0x001c, 0x1e68, 0xa880, 0x708e, 0x7036, 0x0146,
 	0x01d6, 0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a,
 	0xa868, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098,
 	0x4003, 0x015e, 0x01ce, 0x013e, 0x01de, 0x014e, 0x0890, 0x2001,
-	0x005b, 0x2004, 0x9094, 0x0780, 0x190c, 0x6fda, 0xd09c, 0x2071,
+	0x005b, 0x2004, 0x9094, 0x0780, 0x190c, 0x6fe2, 0xd09c, 0x2071,
 	0x1910, 0x1510, 0x2071, 0x1910, 0x700f, 0x0001, 0xa964, 0x9184,
 	0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101,
 	0x0108, 0x710e, 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de,
@@ -3361,10 +3362,10 @@
 	0x2008, 0x2069, 0x19fa, 0x683c, 0x9005, 0x0760, 0x0158, 0x9186,
 	0x0003, 0x0540, 0x2001, 0x1815, 0x2004, 0x2009, 0x1ac8, 0x210c,
 	0x9102, 0x1500, 0x0126, 0x2091, 0x8000, 0x2069, 0x0050, 0x693c,
-	0x6838, 0x9106, 0x0190, 0x0e04, 0x6f91, 0x2069, 0x0000, 0x6837,
+	0x6838, 0x9106, 0x0190, 0x0e04, 0x6f99, 0x2069, 0x0000, 0x6837,
 	0x8040, 0x6833, 0x0012, 0x6883, 0x8040, 0x2091, 0x4080, 0x2001,
 	0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x2069, 0x19fa, 0x683f,
-	0xffff, 0x012e, 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x7056,
+	0xffff, 0x012e, 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x705e,
 	0x701c, 0x904d, 0x0540, 0x2001, 0x005b, 0x2004, 0x9094, 0x0780,
 	0x15c9, 0xd09c, 0x1500, 0x2071, 0x1910, 0x700f, 0x0001, 0xa964,
 	0x9184, 0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff,
@@ -3373,7 +3374,7 @@
 	0x9005, 0x1108, 0x701a, 0x012e, 0x0005, 0x0005, 0x0126, 0x2091,
 	0x8000, 0x701c, 0x904d, 0x0160, 0x7010, 0x8001, 0x7012, 0xa800,
 	0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x080c, 0x1031, 0x0005,
-	0x012e, 0x0005, 0x2091, 0x8000, 0x0e04, 0x6fdc, 0x0006, 0x0016,
+	0x012e, 0x0005, 0x2091, 0x8000, 0x0e04, 0x6fe4, 0x0006, 0x0016,
 	0x2001, 0x8004, 0x0006, 0x0804, 0x0dde, 0x0096, 0x00f6, 0x2079,
 	0x0050, 0x7044, 0xd084, 0x01e0, 0xc084, 0x7046, 0x7838, 0x7938,
 	0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
@@ -3384,4153 +3385,4156 @@
 	0x1800, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1148,
 	0x2009, 0x1830, 0x210c, 0x918a, 0x0020, 0x0218, 0x7022, 0x00ee,
 	0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0,
-	0x8000, 0x70c2, 0x080c, 0x83eb, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x6fda, 0xd0a4, 0x19f0, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6,
+	0x8000, 0x70c2, 0x080c, 0x8414, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x6fe2, 0xd0a4, 0x19f0, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6,
 	0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x2091, 0x4080,
 	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x119b, 0x2009, 0x1947,
 	0x200b, 0x0000, 0x00ee, 0x00fe, 0x009e, 0x0005, 0x00f6, 0x2079,
 	0x0050, 0x7044, 0xd084, 0x01b8, 0xc084, 0x7046, 0x7838, 0x7938,
 	0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
 	0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-	0x119b, 0x00fe, 0x0005, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fda,
+	0x119b, 0x00fe, 0x0005, 0x782c, 0x9094, 0x0780, 0x190c, 0x6fe2,
 	0xd0a4, 0x0db8, 0x00e6, 0x2071, 0x1800, 0x7824, 0x2048, 0x702c,
-	0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x83eb,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6fda, 0xd0a4, 0x1d70, 0x00d6,
+	0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8414,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x6fe2, 0xd0a4, 0x1d70, 0x00d6,
 	0x2069, 0x0050, 0x693c, 0x2069, 0x1948, 0x6808, 0x690a, 0x2069,
 	0x19fa, 0x9102, 0x1118, 0x683c, 0x9005, 0x1328, 0x2001, 0x1949,
 	0x200c, 0x810d, 0x693e, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x7098,
 	0x908a, 0x0029, 0x1a0c, 0x0dd5, 0x9082, 0x001d, 0x001b, 0x6027,
-	0x1e00, 0x0005, 0x717a, 0x7104, 0x7120, 0x7148, 0x7169, 0x71a9,
-	0x71bb, 0x7120, 0x7191, 0x70bf, 0x70ed, 0x70be, 0x0005, 0x00d6,
+	0x1e00, 0x0005, 0x7186, 0x710c, 0x7128, 0x7152, 0x7175, 0x71b5,
+	0x71c7, 0x7128, 0x719d, 0x70c7, 0x70f5, 0x70c6, 0x0005, 0x00d6,
 	0x2069, 0x0200, 0x6804, 0x9005, 0x1180, 0x6808, 0x9005, 0x1518,
-	0x709b, 0x0028, 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x74ea,
+	0x709b, 0x0028, 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x74f6,
 	0x6028, 0x9085, 0x0600, 0x602a, 0x00b0, 0x709b, 0x0028, 0x2069,
 	0x198f, 0x2d04, 0x7002, 0x6028, 0x9085, 0x0600, 0x602a, 0x00e6,
 	0x0036, 0x0046, 0x0056, 0x2071, 0x1a62, 0x080c, 0x1aa9, 0x005e,
 	0x004e, 0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6, 0x2069, 0x0200,
 	0x6804, 0x9005, 0x1178, 0x6808, 0x9005, 0x1160, 0x709b, 0x0028,
-	0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x7585, 0x6028, 0x9085,
+	0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x7591, 0x6028, 0x9085,
 	0x0600, 0x602a, 0x00de, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c,
-	0x2cef, 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x7228, 0xd1d4,
+	0x2cef, 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x7234, 0xd1d4,
 	0x1160, 0xd1dc, 0x1138, 0xd1cc, 0x0150, 0x709b, 0x0020, 0x080c,
-	0x7228, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005,
-	0x2001, 0x0088, 0x080c, 0x2cef, 0x6124, 0xd1cc, 0x11d8, 0xd1dc,
-	0x11b0, 0xd1e4, 0x1188, 0x9184, 0x1e00, 0x11c8, 0x60e3, 0x0001,
-	0x600c, 0xc0b4, 0x600e, 0x080c, 0x73dc, 0x2001, 0x0080, 0x080c,
-	0x2cef, 0x709b, 0x0028, 0x0058, 0x709b, 0x001e, 0x0040, 0x709b,
-	0x001d, 0x0028, 0x709b, 0x0020, 0x0010, 0x709b, 0x001f, 0x0005,
-	0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x73dc, 0x2001,
-	0x0080, 0x080c, 0x2cef, 0x6124, 0xd1d4, 0x1180, 0xd1dc, 0x1158,
-	0xd1e4, 0x1130, 0x9184, 0x1e00, 0x1158, 0x709b, 0x0028, 0x0040,
-	0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f,
-	0x0005, 0x2001, 0x00a0, 0x080c, 0x2cef, 0x6124, 0xd1dc, 0x1138,
-	0xd1e4, 0x0138, 0x080c, 0x1ad3, 0x709b, 0x001e, 0x0010, 0x709b,
-	0x001d, 0x0005, 0x080c, 0x72ab, 0x6124, 0xd1dc, 0x1188, 0x080c,
-	0x7228, 0x0016, 0x080c, 0x1ad3, 0x001e, 0xd1d4, 0x1128, 0xd1e4,
-	0x0138, 0x709b, 0x001e, 0x0020, 0x709b, 0x001f, 0x080c, 0x7228,
-	0x0005, 0x0006, 0x2001, 0x00a0, 0x080c, 0x2cef, 0x000e, 0x6124,
-	0xd1d4, 0x1160, 0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140,
-	0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x0021,
-	0x0005, 0x080c, 0x72ab, 0x6124, 0xd1d4, 0x1150, 0xd1dc, 0x1128,
-	0xd1e4, 0x0140, 0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010,
-	0x709b, 0x001f, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c, 0x2cef,
-	0x000e, 0x6124, 0xd1d4, 0x1178, 0xd1cc, 0x1150, 0xd1dc, 0x1128,
-	0xd1e4, 0x0158, 0x709b, 0x001e, 0x0040, 0x709b, 0x001d, 0x0028,
-	0x709b, 0x0020, 0x0010, 0x709b, 0x001f, 0x0005, 0x0016, 0x00c6,
-	0x00d6, 0x00e6, 0x0126, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071,
-	0x1800, 0x2091, 0x8000, 0x080c, 0x73b0, 0x11d8, 0x2001, 0x180c,
-	0x200c, 0xd1b4, 0x01b0, 0xc1b4, 0x2102, 0x6027, 0x0200, 0x080c,
-	0x2c38, 0x6024, 0xd0cc, 0x0148, 0x2001, 0x00a0, 0x080c, 0x2cef,
-	0x080c, 0x7698, 0x080c, 0x601b, 0x0428, 0x6028, 0xc0cd, 0x602a,
-	0x0408, 0x080c, 0x73ca, 0x0150, 0x080c, 0x73c1, 0x1138, 0x2001,
-	0x0001, 0x080c, 0x27ea, 0x080c, 0x7388, 0x00a0, 0x080c, 0x72a8,
-	0x0178, 0x2001, 0x0001, 0x080c, 0x27ea, 0x7098, 0x9086, 0x001e,
-	0x0120, 0x7098, 0x9086, 0x0022, 0x1118, 0x709b, 0x0025, 0x0010,
-	0x709b, 0x0021, 0x012e, 0x00ee, 0x00de, 0x00ce, 0x001e, 0x0005,
-	0x0026, 0x2011, 0x7239, 0x080c, 0x85a4, 0x002e, 0x0016, 0x0026,
-	0x2009, 0x0064, 0x2011, 0x7239, 0x080c, 0x859b, 0x002e, 0x001e,
-	0x0005, 0x00e6, 0x00f6, 0x0016, 0x080c, 0xa259, 0x2071, 0x1800,
-	0x080c, 0x71d6, 0x001e, 0x00fe, 0x00ee, 0x0005, 0x0016, 0x0026,
-	0x0036, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0126, 0x080c, 0xa259,
-	0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2091, 0x8000,
-	0x6028, 0xc09c, 0x602a, 0x2011, 0x0003, 0x080c, 0xa639, 0x2011,
-	0x0002, 0x080c, 0xa643, 0x080c, 0xa526, 0x080c, 0x8550, 0x0036,
-	0x901e, 0x080c, 0xa59c, 0x003e, 0x60e3, 0x0000, 0x080c, 0xe9c8,
-	0x080c, 0xe9e3, 0x2009, 0x0004, 0x080c, 0x2c3e, 0x080c, 0x2b59,
-	0x2001, 0x1800, 0x2003, 0x0004, 0x6027, 0x0008, 0x2011, 0x7239,
-	0x080c, 0x85a4, 0x080c, 0x73ca, 0x0118, 0x9006, 0x080c, 0x2cef,
-	0x080c, 0x0bae, 0x2001, 0x0001, 0x080c, 0x27ea, 0x012e, 0x00fe,
-	0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x0005, 0x0026,
-	0x00e6, 0x2011, 0x7246, 0x2071, 0x19fa, 0x701c, 0x9206, 0x1118,
-	0x7018, 0x9005, 0x0110, 0x9085, 0x0001, 0x00ee, 0x002e, 0x0005,
-	0x6020, 0xd09c, 0x0005, 0x6800, 0x9084, 0xfffe, 0x9086, 0x00c0,
-	0x0170, 0x2001, 0x00c0, 0x080c, 0x2cef, 0x0156, 0x20a9, 0x002d,
-	0x1d04, 0x72b8, 0x2091, 0x6000, 0x1f04, 0x72b8, 0x015e, 0x0005,
-	0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071,
-	0x1800, 0x080c, 0x76a7, 0x2001, 0x196d, 0x2003, 0x0000, 0x9006,
+	0x7234, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005,
+	0x2001, 0x0088, 0x080c, 0x2cef, 0x6124, 0xd1cc, 0x11e8, 0xd1dc,
+	0x11c0, 0xd1e4, 0x1198, 0x9184, 0x1e00, 0x11d8, 0x080c, 0x1ad3,
+	0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x73e8, 0x2001,
+	0x0080, 0x080c, 0x2cef, 0x709b, 0x0028, 0x0058, 0x709b, 0x001e,
+	0x0040, 0x709b, 0x001d, 0x0028, 0x709b, 0x0020, 0x0010, 0x709b,
+	0x001f, 0x0005, 0x080c, 0x1ad3, 0x60e3, 0x0001, 0x600c, 0xc0b4,
+	0x600e, 0x080c, 0x73e8, 0x2001, 0x0080, 0x080c, 0x2cef, 0x6124,
+	0xd1d4, 0x1180, 0xd1dc, 0x1158, 0xd1e4, 0x1130, 0x9184, 0x1e00,
+	0x1158, 0x709b, 0x0028, 0x0040, 0x709b, 0x001e, 0x0028, 0x709b,
+	0x001d, 0x0010, 0x709b, 0x001f, 0x0005, 0x2001, 0x00a0, 0x080c,
+	0x2cef, 0x6124, 0xd1dc, 0x1138, 0xd1e4, 0x0138, 0x080c, 0x1ad3,
+	0x709b, 0x001e, 0x0010, 0x709b, 0x001d, 0x0005, 0x080c, 0x72b7,
+	0x6124, 0xd1dc, 0x1188, 0x080c, 0x7234, 0x0016, 0x080c, 0x1ad3,
+	0x001e, 0xd1d4, 0x1128, 0xd1e4, 0x0138, 0x709b, 0x001e, 0x0020,
+	0x709b, 0x001f, 0x080c, 0x7234, 0x0005, 0x0006, 0x2001, 0x00a0,
+	0x080c, 0x2cef, 0x000e, 0x6124, 0xd1d4, 0x1160, 0xd1cc, 0x1150,
+	0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x709b, 0x001e, 0x0028, 0x709b,
+	0x001d, 0x0010, 0x709b, 0x0021, 0x0005, 0x080c, 0x72b7, 0x6124,
+	0xd1d4, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x709b, 0x001e,
+	0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005, 0x0006,
+	0x2001, 0x0090, 0x080c, 0x2cef, 0x000e, 0x6124, 0xd1d4, 0x1178,
+	0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0158, 0x709b, 0x001e,
+	0x0040, 0x709b, 0x001d, 0x0028, 0x709b, 0x0020, 0x0010, 0x709b,
+	0x001f, 0x0005, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x0126, 0x2061,
+	0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2091, 0x8000, 0x080c,
+	0x73bc, 0x11d8, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x01b0, 0xc1b4,
+	0x2102, 0x6027, 0x0200, 0x080c, 0x2c38, 0x6024, 0xd0cc, 0x0148,
+	0x2001, 0x00a0, 0x080c, 0x2cef, 0x080c, 0x76a4, 0x080c, 0x601a,
+	0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x73d6, 0x0150,
+	0x080c, 0x73cd, 0x1138, 0x2001, 0x0001, 0x080c, 0x27ea, 0x080c,
+	0x7394, 0x00a0, 0x080c, 0x72b4, 0x0178, 0x2001, 0x0001, 0x080c,
+	0x27ea, 0x7098, 0x9086, 0x001e, 0x0120, 0x7098, 0x9086, 0x0022,
+	0x1118, 0x709b, 0x0025, 0x0010, 0x709b, 0x0021, 0x012e, 0x00ee,
+	0x00de, 0x00ce, 0x001e, 0x0005, 0x0026, 0x2011, 0x7245, 0x080c,
+	0x85cd, 0x002e, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011, 0x7245,
+	0x080c, 0x85c4, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6, 0x0016,
+	0x080c, 0xa273, 0x2071, 0x1800, 0x080c, 0x71e2, 0x001e, 0x00fe,
+	0x00ee, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6,
+	0x00f6, 0x0126, 0x080c, 0xa273, 0x2061, 0x0100, 0x2069, 0x0140,
+	0x2071, 0x1800, 0x2091, 0x8000, 0x6028, 0xc09c, 0x602a, 0x2011,
+	0x0003, 0x080c, 0xa653, 0x2011, 0x0002, 0x080c, 0xa65d, 0x080c,
+	0xa540, 0x080c, 0x8579, 0x0036, 0x901e, 0x080c, 0xa5b6, 0x003e,
+	0x60e3, 0x0000, 0x080c, 0xe9e9, 0x080c, 0xea04, 0x2009, 0x0004,
+	0x080c, 0x2c3e, 0x080c, 0x2b59, 0x2001, 0x1800, 0x2003, 0x0004,
+	0x6027, 0x0008, 0x2011, 0x7245, 0x080c, 0x85cd, 0x080c, 0x73d6,
+	0x0118, 0x9006, 0x080c, 0x2cef, 0x080c, 0x0bae, 0x2001, 0x0001,
+	0x080c, 0x27ea, 0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x003e,
+	0x002e, 0x001e, 0x0005, 0x0026, 0x00e6, 0x2011, 0x7252, 0x2071,
+	0x19fa, 0x701c, 0x9206, 0x1118, 0x7018, 0x9005, 0x0110, 0x9085,
+	0x0001, 0x00ee, 0x002e, 0x0005, 0x6020, 0xd09c, 0x0005, 0x6800,
+	0x9084, 0xfffe, 0x9086, 0x00c0, 0x0170, 0x2001, 0x00c0, 0x080c,
+	0x2cef, 0x0156, 0x20a9, 0x002d, 0x1d04, 0x72c4, 0x2091, 0x6000,
+	0x1f04, 0x72c4, 0x015e, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061,
+	0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x080c, 0x76b3, 0x2001,
+	0x196d, 0x2003, 0x0000, 0x9006, 0x709a, 0x60e2, 0x6886, 0x080c,
+	0x28b2, 0x9006, 0x080c, 0x2cef, 0x080c, 0x5ed9, 0x6027, 0xffff,
+	0x602b, 0x182f, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6,
+	0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2001,
+	0x197d, 0x200c, 0x9186, 0x0000, 0x0158, 0x9186, 0x0001, 0x0158,
+	0x9186, 0x0002, 0x0158, 0x9186, 0x0003, 0x0158, 0x0804, 0x7384,
+	0x709b, 0x0022, 0x0040, 0x709b, 0x0021, 0x0028, 0x709b, 0x0023,
+	0x0010, 0x709b, 0x0024, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001,
+	0x0001, 0x080c, 0x28b2, 0x0026, 0x080c, 0xadd2, 0x002e, 0x7000,
+	0x908e, 0x0004, 0x0118, 0x602b, 0x0028, 0x0010, 0x602b, 0x0020,
+	0x0156, 0x0126, 0x2091, 0x8000, 0x20a9, 0x0005, 0x6024, 0xd0ac,
+	0x0150, 0x012e, 0x015e, 0x080c, 0xd230, 0x0118, 0x9006, 0x080c,
+	0x2d19, 0x0804, 0x7390, 0x6800, 0x9084, 0x00a1, 0xc0bd, 0x6802,
+	0x080c, 0x2c38, 0x6904, 0xd1d4, 0x1140, 0x2001, 0x0100, 0x080c,
+	0x2cef, 0x1f04, 0x732e, 0x080c, 0x7413, 0x012e, 0x015e, 0x080c,
+	0x73cd, 0x01a8, 0x6044, 0x9005, 0x0168, 0x6050, 0x0006, 0x9085,
+	0x0020, 0x6052, 0x080c, 0x7413, 0x9006, 0x8001, 0x1df0, 0x000e,
+	0x6052, 0x0028, 0x6804, 0xd0d4, 0x1110, 0x080c, 0x7413, 0x080c,
+	0xd230, 0x0118, 0x9006, 0x080c, 0x2d19, 0x0016, 0x0026, 0x7000,
+	0x908e, 0x0004, 0x0130, 0x2009, 0x00c8, 0x2011, 0x7252, 0x080c,
+	0x858b, 0x002e, 0x001e, 0x080c, 0x840b, 0x7034, 0xc085, 0x7036,
+	0x2001, 0x197d, 0x2003, 0x0004, 0x080c, 0x70af, 0x080c, 0x73cd,
+	0x0138, 0x6804, 0xd0d4, 0x1120, 0xd0dc, 0x1100, 0x080c, 0x76a9,
+	0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061,
+	0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x080c, 0x8422, 0x080c,
+	0x8414, 0x080c, 0x76b3, 0x2001, 0x196d, 0x2003, 0x0000, 0x9006,
 	0x709a, 0x60e2, 0x6886, 0x080c, 0x28b2, 0x9006, 0x080c, 0x2cef,
-	0x080c, 0x5eda, 0x6027, 0xffff, 0x602b, 0x182f, 0x00ee, 0x00de,
-	0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
-	0x0140, 0x2071, 0x1800, 0x2001, 0x197d, 0x200c, 0x9186, 0x0000,
-	0x0158, 0x9186, 0x0001, 0x0158, 0x9186, 0x0002, 0x0158, 0x9186,
-	0x0003, 0x0158, 0x0804, 0x7378, 0x709b, 0x0022, 0x0040, 0x709b,
-	0x0021, 0x0028, 0x709b, 0x0023, 0x0010, 0x709b, 0x0024, 0x60e3,
-	0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x28b2, 0x0026,
-	0x080c, 0xadb8, 0x002e, 0x7000, 0x908e, 0x0004, 0x0118, 0x602b,
-	0x0028, 0x0010, 0x602b, 0x0020, 0x0156, 0x0126, 0x2091, 0x8000,
-	0x20a9, 0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e, 0x015e, 0x080c,
-	0xd216, 0x0118, 0x9006, 0x080c, 0x2d19, 0x0804, 0x7384, 0x6800,
-	0x9084, 0x00a1, 0xc0bd, 0x6802, 0x080c, 0x2c38, 0x6904, 0xd1d4,
-	0x1140, 0x2001, 0x0100, 0x080c, 0x2cef, 0x1f04, 0x7322, 0x080c,
-	0x7407, 0x012e, 0x015e, 0x080c, 0x73c1, 0x01a8, 0x6044, 0x9005,
-	0x0168, 0x6050, 0x0006, 0x9085, 0x0020, 0x6052, 0x080c, 0x7407,
-	0x9006, 0x8001, 0x1df0, 0x000e, 0x6052, 0x0028, 0x6804, 0xd0d4,
-	0x1110, 0x080c, 0x7407, 0x080c, 0xd216, 0x0118, 0x9006, 0x080c,
-	0x2d19, 0x0016, 0x0026, 0x7000, 0x908e, 0x0004, 0x0130, 0x2009,
-	0x00c8, 0x2011, 0x7246, 0x080c, 0x8562, 0x002e, 0x001e, 0x080c,
-	0x83e2, 0x7034, 0xc085, 0x7036, 0x2001, 0x197d, 0x2003, 0x0004,
-	0x080c, 0x70a7, 0x080c, 0x73c1, 0x0138, 0x6804, 0xd0d4, 0x1120,
-	0xd0dc, 0x1100, 0x080c, 0x769d, 0x00ee, 0x00de, 0x00ce, 0x0005,
+	0x6043, 0x0090, 0x6043, 0x0010, 0x6027, 0xffff, 0x602b, 0x182f,
+	0x00ee, 0x00de, 0x00ce, 0x0005, 0x0006, 0x2001, 0x197c, 0x2004,
+	0x9086, 0xaaaa, 0x000e, 0x0005, 0x0006, 0x080c, 0x56d3, 0x9084,
+	0x0030, 0x9086, 0x0000, 0x000e, 0x0005, 0x0006, 0x080c, 0x56d3,
+	0x9084, 0x0030, 0x9086, 0x0030, 0x000e, 0x0005, 0x0006, 0x080c,
+	0x56d3, 0x9084, 0x0030, 0x9086, 0x0010, 0x000e, 0x0005, 0x0006,
+	0x080c, 0x56d3, 0x9084, 0x0030, 0x9086, 0x0020, 0x000e, 0x0005,
+	0x0036, 0x0016, 0x2001, 0x180c, 0x2004, 0x908c, 0x0013, 0x0180,
+	0x0020, 0x080c, 0x28d2, 0x900e, 0x0028, 0x080c, 0x696a, 0x1dc8,
+	0x2009, 0x0002, 0x2019, 0x0028, 0x080c, 0x318a, 0x9006, 0x0019,
+	0x001e, 0x003e, 0x0005, 0x00e6, 0x2071, 0x180c, 0x2e04, 0x0130,
+	0x080c, 0xd229, 0x1128, 0x9085, 0x0010, 0x0010, 0x9084, 0xffef,
+	0x2072, 0x00ee, 0x0005, 0x6050, 0x0006, 0x60ec, 0x0006, 0x600c,
+	0x0006, 0x6004, 0x0006, 0x6028, 0x0006, 0x0016, 0x6138, 0x6050,
+	0x9084, 0xfbff, 0x9085, 0x2000, 0x6052, 0x613a, 0x20a9, 0x0012,
+	0x1d04, 0x7428, 0x2091, 0x6000, 0x1f04, 0x7428, 0x602f, 0x0100,
+	0x602f, 0x0000, 0x6050, 0x9085, 0x0400, 0x9084, 0xdfff, 0x6052,
+	0x613a, 0x001e, 0x602f, 0x0040, 0x602f, 0x0000, 0x000e, 0x602a,
+	0x000e, 0x6006, 0x000e, 0x600e, 0x000e, 0x60ee, 0x60e3, 0x0000,
+	0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x28b2, 0x2001, 0x00a0,
+	0x0006, 0x080c, 0xd230, 0x000e, 0x0130, 0x080c, 0x2d0d, 0x9006,
+	0x080c, 0x2d19, 0x0010, 0x080c, 0x2cef, 0x000e, 0x6052, 0x6050,
+	0x0006, 0xc0e5, 0x6052, 0x00f6, 0x2079, 0x0100, 0x080c, 0x2bad,
+	0x00fe, 0x000e, 0x6052, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036,
 	0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071,
-	0x1800, 0x080c, 0x83f9, 0x080c, 0x83eb, 0x080c, 0x76a7, 0x2001,
-	0x196d, 0x2003, 0x0000, 0x9006, 0x709a, 0x60e2, 0x6886, 0x080c,
-	0x28b2, 0x9006, 0x080c, 0x2cef, 0x6043, 0x0090, 0x6043, 0x0010,
-	0x6027, 0xffff, 0x602b, 0x182f, 0x00ee, 0x00de, 0x00ce, 0x0005,
-	0x0006, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x000e, 0x0005,
-	0x0006, 0x080c, 0x56d4, 0x9084, 0x0030, 0x9086, 0x0000, 0x000e,
-	0x0005, 0x0006, 0x080c, 0x56d4, 0x9084, 0x0030, 0x9086, 0x0030,
-	0x000e, 0x0005, 0x0006, 0x080c, 0x56d4, 0x9084, 0x0030, 0x9086,
-	0x0010, 0x000e, 0x0005, 0x0006, 0x080c, 0x56d4, 0x9084, 0x0030,
-	0x9086, 0x0020, 0x000e, 0x0005, 0x0036, 0x0016, 0x2001, 0x180c,
-	0x2004, 0x908c, 0x0013, 0x0180, 0x0020, 0x080c, 0x28d2, 0x900e,
-	0x0028, 0x080c, 0x6962, 0x1dc8, 0x2009, 0x0002, 0x2019, 0x0028,
-	0x080c, 0x3187, 0x9006, 0x0019, 0x001e, 0x003e, 0x0005, 0x00e6,
-	0x2071, 0x180c, 0x2e04, 0x0130, 0x080c, 0xd20f, 0x1128, 0x9085,
-	0x0010, 0x0010, 0x9084, 0xffef, 0x2072, 0x00ee, 0x0005, 0x6050,
-	0x0006, 0x60ec, 0x0006, 0x600c, 0x0006, 0x6004, 0x0006, 0x6028,
-	0x0006, 0x0016, 0x6138, 0x6050, 0x9084, 0xfbff, 0x9085, 0x2000,
-	0x6052, 0x613a, 0x20a9, 0x0012, 0x1d04, 0x741c, 0x2091, 0x6000,
-	0x1f04, 0x741c, 0x602f, 0x0100, 0x602f, 0x0000, 0x6050, 0x9085,
-	0x0400, 0x9084, 0xdfff, 0x6052, 0x613a, 0x001e, 0x602f, 0x0040,
-	0x602f, 0x0000, 0x000e, 0x602a, 0x000e, 0x6006, 0x000e, 0x600e,
-	0x000e, 0x60ee, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001,
-	0x080c, 0x28b2, 0x2001, 0x00a0, 0x0006, 0x080c, 0xd216, 0x000e,
-	0x0130, 0x080c, 0x2d0d, 0x9006, 0x080c, 0x2d19, 0x0010, 0x080c,
-	0x2cef, 0x000e, 0x6052, 0x6050, 0x0006, 0xc0e5, 0x6052, 0x00f6,
-	0x2079, 0x0100, 0x080c, 0x2bad, 0x00fe, 0x000e, 0x6052, 0x0005,
-	0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061,
-	0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x6020, 0x9084, 0x0080,
-	0x0138, 0x2001, 0x180c, 0x200c, 0xc1c5, 0x2102, 0x0804, 0x74dc,
-	0x2001, 0x180c, 0x200c, 0xc1c4, 0x2102, 0x6028, 0x9084, 0xe1ff,
-	0x602a, 0x6027, 0x0200, 0x2001, 0x0090, 0x080c, 0x2cef, 0x20a9,
-	0x0366, 0x6024, 0xd0cc, 0x1518, 0x1d04, 0x7489, 0x2091, 0x6000,
-	0x1f04, 0x7489, 0x2011, 0x0003, 0x080c, 0xa639, 0x2011, 0x0002,
-	0x080c, 0xa643, 0x080c, 0xa526, 0x901e, 0x080c, 0xa59c, 0x2001,
-	0x00a0, 0x080c, 0x2cef, 0x080c, 0x7698, 0x080c, 0x601b, 0x080c,
-	0xd216, 0x0110, 0x080c, 0x0d45, 0x9085, 0x0001, 0x0498, 0x86ff,
-	0x1110, 0x080c, 0x1ad3, 0x60e3, 0x0000, 0x2001, 0x196d, 0x2004,
-	0x080c, 0x28b2, 0x60e2, 0x2001, 0x0080, 0x080c, 0x2cef, 0x20a9,
-	0x0366, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2c38, 0x6024,
-	0x910c, 0x0138, 0x1d04, 0x74c1, 0x2091, 0x6000, 0x1f04, 0x74c1,
-	0x0808, 0x6028, 0x9085, 0x1e00, 0x602a, 0x70b4, 0x9005, 0x1118,
-	0x6887, 0x0001, 0x0008, 0x6886, 0x080c, 0xd216, 0x0110, 0x080c,
-	0x0d45, 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
-	0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
-	0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x7000, 0x9086, 0x0003,
-	0x1168, 0x2001, 0x020b, 0x2004, 0x9084, 0x5540, 0x9086, 0x5540,
-	0x1128, 0x2069, 0x1a79, 0x2d04, 0x8000, 0x206a, 0x2069, 0x0140,
-	0x6020, 0x9084, 0x00c0, 0x0120, 0x6884, 0x9005, 0x1904, 0x754f,
-	0x2001, 0x0088, 0x080c, 0x2cef, 0x9006, 0x60e2, 0x6886, 0x080c,
-	0x28b2, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118, 0x6808, 0x9005,
-	0x01c0, 0x6028, 0x9084, 0xfbff, 0x602a, 0x6027, 0x0400, 0x2069,
-	0x198f, 0x7000, 0x206a, 0x709b, 0x0026, 0x7003, 0x0001, 0x20a9,
-	0x0002, 0x1d04, 0x7531, 0x2091, 0x6000, 0x1f04, 0x7531, 0x0804,
-	0x757d, 0x2069, 0x0140, 0x20a9, 0x0384, 0x6027, 0x1e00, 0x2009,
-	0x1e00, 0x080c, 0x2c38, 0x6024, 0x910c, 0x0508, 0x9084, 0x1a00,
-	0x11f0, 0x1d04, 0x753d, 0x2091, 0x6000, 0x1f04, 0x753d, 0x2011,
-	0x0003, 0x080c, 0xa639, 0x2011, 0x0002, 0x080c, 0xa643, 0x080c,
-	0xa526, 0x901e, 0x080c, 0xa59c, 0x2001, 0x00a0, 0x080c, 0x2cef,
-	0x080c, 0x7698, 0x080c, 0x601b, 0x9085, 0x0001, 0x00b0, 0x2001,
-	0x0080, 0x080c, 0x2cef, 0x2069, 0x0140, 0x60e3, 0x0000, 0x70b4,
-	0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x2001, 0x196d,
-	0x2004, 0x080c, 0x28b2, 0x60e2, 0x9006, 0x00ee, 0x00de, 0x00ce,
-	0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026,
-	0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800,
-	0x6020, 0x9084, 0x00c0, 0x01c8, 0x2011, 0x0003, 0x080c, 0xa639,
-	0x2011, 0x0002, 0x080c, 0xa643, 0x080c, 0xa526, 0x901e, 0x080c,
-	0xa59c, 0x2069, 0x0140, 0x2001, 0x00a0, 0x080c, 0x2cef, 0x080c,
-	0x7698, 0x080c, 0x601b, 0x0804, 0x7618, 0x2001, 0x180c, 0x200c,
-	0xd1b4, 0x1160, 0xc1b5, 0x2102, 0x080c, 0x722e, 0x2069, 0x0140,
-	0x2001, 0x0080, 0x080c, 0x2cef, 0x60e3, 0x0000, 0x2069, 0x0200,
-	0x6804, 0x9005, 0x1118, 0x6808, 0x9005, 0x0180, 0x6028, 0x9084,
-	0xfdff, 0x602a, 0x6027, 0x0200, 0x2069, 0x198f, 0x7000, 0x206a,
-	0x709b, 0x0027, 0x7003, 0x0001, 0x0804, 0x7618, 0x6027, 0x1e00,
-	0x2009, 0x1e00, 0x080c, 0x2c38, 0x6024, 0x910c, 0x01c8, 0x9084,
-	0x1c00, 0x11b0, 0x1d04, 0x75d6, 0x0006, 0x0016, 0x00c6, 0x00d6,
-	0x00e6, 0x080c, 0x842a, 0x00ee, 0x00de, 0x00ce, 0x001e, 0x000e,
-	0x00e6, 0x2071, 0x19fa, 0x7018, 0x00ee, 0x9005, 0x19f8, 0x0500,
-	0x0026, 0x2011, 0x7246, 0x080c, 0x84ca, 0x2011, 0x7239, 0x080c,
-	0x85a4, 0x002e, 0x2069, 0x0140, 0x60e3, 0x0000, 0x70b4, 0x9005,
-	0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x2001, 0x196d, 0x2004,
-	0x080c, 0x28b2, 0x60e2, 0x2001, 0x180c, 0x200c, 0xc1b4, 0x2102,
-	0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005,
-	0x0156, 0x0016, 0x0026, 0x0036, 0x0046, 0x00c6, 0x00e6, 0x2061,
-	0x0100, 0x2071, 0x1800, 0x080c, 0xd20f, 0x1904, 0x7686, 0x7130,
-	0xd184, 0x1170, 0x080c, 0x3312, 0x0138, 0xc18d, 0x7132, 0x2011,
-	0x1848, 0x2214, 0xd2ac, 0x1120, 0x7030, 0xd08c, 0x0904, 0x7686,
-	0x2011, 0x1848, 0x220c, 0xd1a4, 0x0538, 0x0016, 0x2019, 0x000e,
-	0x080c, 0xe501, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x9186,
-	0x007e, 0x01a0, 0x9186, 0x0080, 0x0188, 0x080c, 0x6600, 0x1170,
-	0x2120, 0x9006, 0x0016, 0x2009, 0x000e, 0x080c, 0xe58d, 0x2009,
-	0x0001, 0x2011, 0x0100, 0x080c, 0x86b4, 0x001e, 0x8108, 0x1f04,
-	0x764f, 0x00be, 0x015e, 0x001e, 0xd1ac, 0x1148, 0x0016, 0x2009,
-	0x0002, 0x2019, 0x0004, 0x080c, 0x3187, 0x001e, 0x0078, 0x0156,
-	0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x6600, 0x1110, 0x080c,
-	0x6035, 0x8108, 0x1f04, 0x767c, 0x00be, 0x015e, 0x080c, 0x1ad3,
-	0x080c, 0xadb8, 0x60e3, 0x0000, 0x080c, 0x601b, 0x080c, 0x72e2,
-	0x00ee, 0x00ce, 0x004e, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005,
-	0x2001, 0x197d, 0x2003, 0x0001, 0x0005, 0x2001, 0x197d, 0x2003,
-	0x0000, 0x0005, 0x2001, 0x197c, 0x2003, 0xaaaa, 0x0005, 0x2001,
-	0x197c, 0x2003, 0x0000, 0x0005, 0x2071, 0x18fa, 0x7003, 0x0000,
-	0x7007, 0x0000, 0x080c, 0x1018, 0x090c, 0x0dd5, 0xa8ab, 0xdcb0,
-	0x2900, 0x704e, 0x080c, 0x1018, 0x090c, 0x0dd5, 0xa8ab, 0xdcb0,
-	0x2900, 0x7052, 0xa867, 0x0000, 0xa86b, 0x0001, 0xa89f, 0x0000,
-	0x0005, 0x00e6, 0x2071, 0x0040, 0x6848, 0x9005, 0x1118, 0x9085,
-	0x0001, 0x04b0, 0x6840, 0x9005, 0x0150, 0x04a1, 0x6a50, 0x9200,
-	0x7002, 0x6854, 0x9101, 0x7006, 0x9006, 0x7012, 0x7016, 0x6850,
-	0x7002, 0x6854, 0x7006, 0x6858, 0x700a, 0x685c, 0x700e, 0x6840,
-	0x9005, 0x1110, 0x7012, 0x7016, 0x6848, 0x701a, 0x701c, 0x9085,
-	0x0040, 0x701e, 0x2001, 0x0019, 0x7036, 0x702b, 0x0001, 0x2001,
-	0x0004, 0x200c, 0x918c, 0xfff7, 0x918d, 0x8000, 0x2102, 0x00d6,
-	0x2069, 0x18fa, 0x6807, 0x0001, 0x00de, 0x080c, 0x7c84, 0x9006,
-	0x00ee, 0x0005, 0x900e, 0x0156, 0x20a9, 0x0006, 0x8003, 0x2011,
-	0x0100, 0x2214, 0x9296, 0x0008, 0x1110, 0x818d, 0x0010, 0x81f5,
-	0x3e08, 0x1f04, 0x770e, 0x015e, 0x0005, 0x2079, 0x0040, 0x2071,
-	0x18fa, 0x7004, 0x0002, 0x772d, 0x772e, 0x7765, 0x77c0, 0x78d0,
-	0x772b, 0x772b, 0x78fa, 0x080c, 0x0dd5, 0x0005, 0x2079, 0x0040,
-	0x782c, 0x908c, 0x0780, 0x190c, 0x7d66, 0xd0a4, 0x01f0, 0x7824,
+	0x1800, 0x6020, 0x9084, 0x0080, 0x0138, 0x2001, 0x180c, 0x200c,
+	0xc1c5, 0x2102, 0x0804, 0x74e8, 0x2001, 0x180c, 0x200c, 0xc1c4,
+	0x2102, 0x6028, 0x9084, 0xe1ff, 0x602a, 0x6027, 0x0200, 0x2001,
+	0x0090, 0x080c, 0x2cef, 0x20a9, 0x0366, 0x6024, 0xd0cc, 0x1518,
+	0x1d04, 0x7495, 0x2091, 0x6000, 0x1f04, 0x7495, 0x2011, 0x0003,
+	0x080c, 0xa653, 0x2011, 0x0002, 0x080c, 0xa65d, 0x080c, 0xa540,
+	0x901e, 0x080c, 0xa5b6, 0x2001, 0x00a0, 0x080c, 0x2cef, 0x080c,
+	0x76a4, 0x080c, 0x601a, 0x080c, 0xd230, 0x0110, 0x080c, 0x0d45,
+	0x9085, 0x0001, 0x0498, 0x86ff, 0x1110, 0x080c, 0x1ad3, 0x60e3,
+	0x0000, 0x2001, 0x196d, 0x2004, 0x080c, 0x28b2, 0x60e2, 0x2001,
+	0x0080, 0x080c, 0x2cef, 0x20a9, 0x0366, 0x6027, 0x1e00, 0x2009,
+	0x1e00, 0x080c, 0x2c38, 0x6024, 0x910c, 0x0138, 0x1d04, 0x74cd,
+	0x2091, 0x6000, 0x1f04, 0x74cd, 0x0808, 0x6028, 0x9085, 0x1e00,
+	0x602a, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886,
+	0x080c, 0xd230, 0x0110, 0x080c, 0x0d45, 0x9006, 0x00ee, 0x00de,
+	0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016,
+	0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071,
+	0x1800, 0x7000, 0x9086, 0x0003, 0x1168, 0x2001, 0x020b, 0x2004,
+	0x9084, 0x5540, 0x9086, 0x5540, 0x1128, 0x2069, 0x1a79, 0x2d04,
+	0x8000, 0x206a, 0x2069, 0x0140, 0x6020, 0x9084, 0x00c0, 0x0120,
+	0x6884, 0x9005, 0x1904, 0x755b, 0x2001, 0x0088, 0x080c, 0x2cef,
+	0x9006, 0x60e2, 0x6886, 0x080c, 0x28b2, 0x2069, 0x0200, 0x6804,
+	0x9005, 0x1118, 0x6808, 0x9005, 0x01c0, 0x6028, 0x9084, 0xfbff,
+	0x602a, 0x6027, 0x0400, 0x2069, 0x198f, 0x7000, 0x206a, 0x709b,
+	0x0026, 0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04, 0x753d, 0x2091,
+	0x6000, 0x1f04, 0x753d, 0x0804, 0x7589, 0x2069, 0x0140, 0x20a9,
+	0x0384, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2c38, 0x6024,
+	0x910c, 0x0508, 0x9084, 0x1a00, 0x11f0, 0x1d04, 0x7549, 0x2091,
+	0x6000, 0x1f04, 0x7549, 0x2011, 0x0003, 0x080c, 0xa653, 0x2011,
+	0x0002, 0x080c, 0xa65d, 0x080c, 0xa540, 0x901e, 0x080c, 0xa5b6,
+	0x2001, 0x00a0, 0x080c, 0x2cef, 0x080c, 0x76a4, 0x080c, 0x601a,
+	0x9085, 0x0001, 0x00b0, 0x2001, 0x0080, 0x080c, 0x2cef, 0x2069,
+	0x0140, 0x60e3, 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001,
+	0x0008, 0x6886, 0x2001, 0x196d, 0x2004, 0x080c, 0x28b2, 0x60e2,
+	0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e,
+	0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6,
+	0x2061, 0x0100, 0x2071, 0x1800, 0x6020, 0x9084, 0x00c0, 0x01c8,
+	0x2011, 0x0003, 0x080c, 0xa653, 0x2011, 0x0002, 0x080c, 0xa65d,
+	0x080c, 0xa540, 0x901e, 0x080c, 0xa5b6, 0x2069, 0x0140, 0x2001,
+	0x00a0, 0x080c, 0x2cef, 0x080c, 0x76a4, 0x080c, 0x601a, 0x0804,
+	0x7624, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x1160, 0xc1b5, 0x2102,
+	0x080c, 0x723a, 0x2069, 0x0140, 0x2001, 0x0080, 0x080c, 0x2cef,
+	0x60e3, 0x0000, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118, 0x6808,
+	0x9005, 0x0180, 0x6028, 0x9084, 0xfdff, 0x602a, 0x6027, 0x0200,
+	0x2069, 0x198f, 0x7000, 0x206a, 0x709b, 0x0027, 0x7003, 0x0001,
+	0x0804, 0x7624, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2c38,
+	0x6024, 0x910c, 0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04, 0x75e2,
+	0x0006, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c, 0x8453, 0x00ee,
+	0x00de, 0x00ce, 0x001e, 0x000e, 0x00e6, 0x2071, 0x19fa, 0x7018,
+	0x00ee, 0x9005, 0x19f8, 0x0500, 0x0026, 0x2011, 0x7252, 0x080c,
+	0x84f3, 0x2011, 0x7245, 0x080c, 0x85cd, 0x002e, 0x2069, 0x0140,
+	0x60e3, 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008,
+	0x6886, 0x2001, 0x196d, 0x2004, 0x080c, 0x28b2, 0x60e2, 0x2001,
+	0x180c, 0x200c, 0xc1b4, 0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e,
+	0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036,
+	0x0046, 0x00c6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x080c,
+	0xd229, 0x1904, 0x7692, 0x7130, 0xd184, 0x1170, 0x080c, 0x3319,
+	0x0138, 0xc18d, 0x7132, 0x2011, 0x1848, 0x2214, 0xd2ac, 0x1120,
+	0x7030, 0xd08c, 0x0904, 0x7692, 0x2011, 0x1848, 0x220c, 0xd1a4,
+	0x0538, 0x0016, 0x2019, 0x000e, 0x080c, 0xe522, 0x0156, 0x00b6,
+	0x20a9, 0x007f, 0x900e, 0x9186, 0x007e, 0x01a0, 0x9186, 0x0080,
+	0x0188, 0x080c, 0x65ff, 0x1170, 0x2120, 0x9006, 0x0016, 0x2009,
+	0x000e, 0x080c, 0xe5ae, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c,
+	0x86dd, 0x001e, 0x8108, 0x1f04, 0x765b, 0x00be, 0x015e, 0x001e,
+	0xd1ac, 0x1148, 0x0016, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c,
+	0x318a, 0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e,
+	0x080c, 0x65ff, 0x1110, 0x080c, 0x6034, 0x8108, 0x1f04, 0x7688,
+	0x00be, 0x015e, 0x080c, 0x1ad3, 0x080c, 0xadd2, 0x60e3, 0x0000,
+	0x080c, 0x601a, 0x080c, 0x72ee, 0x00ee, 0x00ce, 0x004e, 0x003e,
+	0x002e, 0x001e, 0x015e, 0x0005, 0x2001, 0x197d, 0x2003, 0x0001,
+	0x0005, 0x2001, 0x197d, 0x2003, 0x0000, 0x0005, 0x2001, 0x197c,
+	0x2003, 0xaaaa, 0x0005, 0x2001, 0x197c, 0x2003, 0x0000, 0x0005,
+	0x2071, 0x18fa, 0x7003, 0x0000, 0x7007, 0x0000, 0x080c, 0x1018,
+	0x090c, 0x0dd5, 0xa8ab, 0xdcb0, 0x2900, 0x704e, 0x080c, 0x1018,
+	0x090c, 0x0dd5, 0xa8ab, 0xdcb0, 0x2900, 0x7052, 0xa867, 0x0000,
+	0xa86b, 0x0001, 0xa89f, 0x0000, 0x0005, 0x00e6, 0x2071, 0x0040,
+	0x6848, 0x9005, 0x1118, 0x9085, 0x0001, 0x04b0, 0x6840, 0x9005,
+	0x0150, 0x04a1, 0x6a50, 0x9200, 0x7002, 0x6854, 0x9101, 0x7006,
+	0x9006, 0x7012, 0x7016, 0x6850, 0x7002, 0x6854, 0x7006, 0x6858,
+	0x700a, 0x685c, 0x700e, 0x6840, 0x9005, 0x1110, 0x7012, 0x7016,
+	0x6848, 0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x2001, 0x0019,
+	0x7036, 0x702b, 0x0001, 0x2001, 0x0004, 0x200c, 0x918c, 0xfff7,
+	0x918d, 0x8000, 0x2102, 0x00d6, 0x2069, 0x18fa, 0x6807, 0x0001,
+	0x00de, 0x080c, 0x7c90, 0x9006, 0x00ee, 0x0005, 0x900e, 0x0156,
+	0x20a9, 0x0006, 0x8003, 0x2011, 0x0100, 0x2214, 0x9296, 0x0008,
+	0x1110, 0x818d, 0x0010, 0x81f5, 0x3e08, 0x1f04, 0x771a, 0x015e,
+	0x0005, 0x2079, 0x0040, 0x2071, 0x18fa, 0x7004, 0x0002, 0x7739,
+	0x773a, 0x7771, 0x77cc, 0x78dc, 0x7737, 0x7737, 0x7906, 0x080c,
+	0x0dd5, 0x0005, 0x2079, 0x0040, 0x782c, 0x908c, 0x0780, 0x190c,
+	0x7d72, 0xd0a4, 0x01f0, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806,
+	0xa864, 0x9084, 0x00ff, 0x908a, 0x0040, 0x0608, 0x00b8, 0x2001,
+	0x1800, 0x200c, 0x9186, 0x0003, 0x1160, 0x7104, 0x9186, 0x0004,
+	0x0140, 0x9186, 0x0007, 0x0128, 0x9186, 0x0003, 0x19e8, 0x080c,
+	0x77cc, 0x782c, 0xd09c, 0x090c, 0x7c90, 0x0005, 0x9082, 0x005a,
+	0x1218, 0x2100, 0x003b, 0x0c18, 0x080c, 0x7802, 0x0c90, 0x00e3,
+	0x08f0, 0x0005, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802,
+	0x7802, 0x7802, 0x7824, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802,
+	0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802,
+	0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x780e, 0x7802,
+	0x79f7, 0x7802, 0x7802, 0x7802, 0x7824, 0x7802, 0x780e, 0x7a38,
+	0x7a79, 0x7ac0, 0x7ad4, 0x7802, 0x7802, 0x7824, 0x780e, 0x7838,
+	0x7802, 0x78b0, 0x7b7f, 0x7b9a, 0x7802, 0x7824, 0x7802, 0x7838,
+	0x7802, 0x7802, 0x78a6, 0x7b9a, 0x7802, 0x7802, 0x7802, 0x7802,
+	0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x784c, 0x7802, 0x7802,
+	0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x7802, 0x7d16,
+	0x7802, 0x7cc0, 0x7802, 0x7cc0, 0x7802, 0x7861, 0x7802, 0x7802,
+	0x7802, 0x7802, 0x7802, 0x7802, 0x2079, 0x0040, 0x7004, 0x9086,
+	0x0003, 0x1198, 0x782c, 0x080c, 0x7cb9, 0xd0a4, 0x0170, 0x7824,
 	0x2048, 0x9006, 0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a,
-	0x0040, 0x0608, 0x00b8, 0x2001, 0x1800, 0x200c, 0x9186, 0x0003,
-	0x1160, 0x7104, 0x9186, 0x0004, 0x0140, 0x9186, 0x0007, 0x0128,
-	0x9186, 0x0003, 0x19e8, 0x080c, 0x77c0, 0x782c, 0xd09c, 0x090c,
-	0x7c84, 0x0005, 0x9082, 0x005a, 0x1218, 0x2100, 0x003b, 0x0c18,
-	0x080c, 0x77f6, 0x0c90, 0x00e3, 0x08f0, 0x0005, 0x77f6, 0x77f6,
-	0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x7818, 0x77f6,
-	0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6,
-	0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6,
-	0x77f6, 0x77f6, 0x7802, 0x77f6, 0x79eb, 0x77f6, 0x77f6, 0x77f6,
-	0x7818, 0x77f6, 0x7802, 0x7a2c, 0x7a6d, 0x7ab4, 0x7ac8, 0x77f6,
-	0x77f6, 0x7818, 0x7802, 0x782c, 0x77f6, 0x78a4, 0x7b73, 0x7b8e,
-	0x77f6, 0x7818, 0x77f6, 0x782c, 0x77f6, 0x77f6, 0x789a, 0x7b8e,
-	0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6,
-	0x77f6, 0x7840, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6,
-	0x77f6, 0x77f6, 0x77f6, 0x7d0a, 0x77f6, 0x7cb4, 0x77f6, 0x7cb4,
-	0x77f6, 0x7855, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6, 0x77f6,
-	0x2079, 0x0040, 0x7004, 0x9086, 0x0003, 0x1198, 0x782c, 0x080c,
-	0x7cad, 0xd0a4, 0x0170, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806,
-	0xa864, 0x9084, 0x00ff, 0x908a, 0x001a, 0x1210, 0x002b, 0x0c50,
-	0x00e9, 0x080c, 0x7c84, 0x0005, 0x77f6, 0x7802, 0x79d7, 0x77f6,
-	0x7802, 0x77f6, 0x7802, 0x7802, 0x77f6, 0x7802, 0x79d7, 0x7802,
-	0x7802, 0x7802, 0x7802, 0x7802, 0x77f6, 0x7802, 0x79d7, 0x77f6,
-	0x77f6, 0x7802, 0x77f6, 0x77f6, 0x77f6, 0x7802, 0x00e6, 0x2071,
-	0x18fa, 0x2009, 0x0400, 0x0071, 0x00ee, 0x0005, 0x2009, 0x1000,
-	0x0049, 0x0005, 0x2009, 0x2000, 0x0029, 0x0005, 0x2009, 0x0800,
-	0x0009, 0x0005, 0x7007, 0x0001, 0xa868, 0x9084, 0x00ff, 0x9105,
-	0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c79, 0x012e, 0x0005,
-	0xa864, 0x8007, 0x9084, 0x00ff, 0x0d08, 0x8001, 0x1120, 0x7007,
-	0x0001, 0x0804, 0x7979, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016,
-	0x701a, 0x704b, 0x7979, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff,
-	0x0968, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7994, 0x7007,
-	0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7994, 0x0005,
-	0xa864, 0x8007, 0x9084, 0x00ff, 0x0904, 0x77fe, 0x8001, 0x1120,
-	0x7007, 0x0001, 0x0804, 0x79b0, 0x7007, 0x0003, 0x7012, 0x2900,
-	0x7016, 0x701a, 0x704b, 0x79b0, 0x0005, 0xa864, 0x8007, 0x9084,
-	0x00ff, 0x9086, 0x0001, 0x1904, 0x77fe, 0x7007, 0x0001, 0x2009,
-	0x1834, 0x210c, 0x81ff, 0x11a8, 0xa868, 0x9084, 0x00ff, 0xa86a,
-	0xa883, 0x0000, 0x080c, 0x62af, 0x1108, 0x0005, 0x0126, 0x2091,
-	0x8000, 0xa867, 0x0139, 0xa87a, 0xa982, 0x080c, 0x6c79, 0x012e,
-	0x0ca0, 0xa994, 0x9186, 0x0071, 0x0d38, 0x9186, 0x0064, 0x0d20,
-	0x9186, 0x007c, 0x0d08, 0x9186, 0x0028, 0x09f0, 0x9186, 0x0038,
-	0x09d8, 0x9186, 0x0078, 0x09c0, 0x9186, 0x005f, 0x09a8, 0x9186,
-	0x0056, 0x0990, 0xa897, 0x4005, 0xa89b, 0x0001, 0x2001, 0x0030,
-	0x900e, 0x08a0, 0xa87c, 0x9084, 0x00c0, 0x9086, 0x00c0, 0x1120,
-	0x7007, 0x0001, 0x0804, 0x7ba5, 0x2900, 0x7016, 0x701a, 0x20a9,
-	0x0004, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0030, 0x2098, 0x7050,
-	0x2040, 0xa060, 0x20e8, 0xa05c, 0x9080, 0x0023, 0x20a0, 0x4003,
-	0xa888, 0x7012, 0x9082, 0x0401, 0x1a04, 0x7806, 0xaab4, 0x928a,
-	0x0002, 0x1a04, 0x7806, 0x82ff, 0x1138, 0xa8b8, 0xa9bc, 0x9105,
-	0x0118, 0x2001, 0x7937, 0x0018, 0x9280, 0x792d, 0x2005, 0x7056,
-	0x7010, 0x9015, 0x0904, 0x7918, 0x080c, 0x1018, 0x1118, 0x7007,
-	0x0004, 0x0005, 0x2900, 0x7022, 0x7054, 0x2060, 0xe000, 0xa866,
-	0x7050, 0x2040, 0xa95c, 0xe004, 0x9100, 0xa076, 0xa860, 0xa072,
-	0xe008, 0x920a, 0x1210, 0x900e, 0x2200, 0x7112, 0xe20c, 0x8003,
-	0x800b, 0x9296, 0x0004, 0x0108, 0x9108, 0xa17a, 0x810b, 0xa17e,
-	0x080c, 0x10e9, 0xa06c, 0x908e, 0x0100, 0x0170, 0x9086, 0x0200,
-	0x0118, 0x7007, 0x0007, 0x0005, 0x7020, 0x2048, 0x080c, 0x1031,
-	0x7014, 0x2048, 0x0804, 0x7806, 0x7020, 0x2048, 0x7018, 0xa802,
-	0xa807, 0x0000, 0x2908, 0x2048, 0xa906, 0x711a, 0x0804, 0x78d0,
-	0x7014, 0x2048, 0x7007, 0x0001, 0xa8b4, 0x9005, 0x1128, 0xa8b8,
-	0xa9bc, 0x9105, 0x0108, 0x00b9, 0xa864, 0x9084, 0x00ff, 0x9086,
-	0x001e, 0x0904, 0x7ba5, 0x0804, 0x7979, 0x792f, 0x7933, 0x0002,
-	0x001d, 0x0007, 0x0004, 0x000a, 0x001b, 0x0005, 0x0006, 0x000a,
-	0x001d, 0x0005, 0x0004, 0x0076, 0x0066, 0xafb8, 0xaebc, 0xa804,
-	0x2050, 0xb0c0, 0xb0e2, 0xb0bc, 0xb0de, 0xb0b8, 0xb0d2, 0xb0b4,
-	0xb0ce, 0xb6da, 0xb7d6, 0xb0b0, 0xb0ca, 0xb0ac, 0xb0c6, 0xb0a8,
-	0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2, 0xb7be, 0xb0a0, 0xb0b2, 0xb09c,
-	0xb0ae, 0xb098, 0xb0a2, 0xb094, 0xb09e, 0xb6aa, 0xb7a6, 0xb090,
-	0xb09a, 0xb08c, 0xb096, 0xb088, 0xb08a, 0xb084, 0xb086, 0xb692,
-	0xb78e, 0xb080, 0xb082, 0xb07c, 0xb07e, 0xb078, 0xb072, 0xb074,
-	0xb06e, 0xb67a, 0xb776, 0xb004, 0x9055, 0x1958, 0x006e, 0x007e,
-	0x0005, 0x2009, 0x1834, 0x210c, 0x81ff, 0x1178, 0x080c, 0x60af,
-	0x1108, 0x0005, 0x080c, 0x6eb8, 0x0126, 0x2091, 0x8000, 0x080c,
-	0xce0a, 0x080c, 0x6c79, 0x012e, 0x0ca0, 0x080c, 0xd20f, 0x1d70,
-	0x2001, 0x0028, 0x900e, 0x0c70, 0x2009, 0x1834, 0x210c, 0x81ff,
-	0x1188, 0xa888, 0x9005, 0x0188, 0xa883, 0x0000, 0x080c, 0x613f,
-	0x1108, 0x0005, 0xa87a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c79,
-	0x012e, 0x0cb8, 0x2001, 0x0028, 0x0ca8, 0x2001, 0x0000, 0x0c90,
-	0x2009, 0x1834, 0x210c, 0x81ff, 0x11d8, 0xa888, 0x9005, 0x01e0,
-	0xa883, 0x0000, 0xa87c, 0xd0f4, 0x0120, 0x080c, 0x6211, 0x1138,
-	0x0005, 0x9006, 0xa87a, 0x080c, 0x618c, 0x1108, 0x0005, 0x0126,
-	0x2091, 0x8000, 0xa87a, 0xa982, 0x080c, 0x6c79, 0x012e, 0x0cb0,
-	0x2001, 0x0028, 0x900e, 0x0c98, 0x2001, 0x0000, 0x0c80, 0x7018,
-	0xa802, 0x2908, 0x2048, 0xa906, 0x711a, 0x7010, 0x8001, 0x7012,
-	0x0118, 0x7007, 0x0003, 0x0030, 0x7014, 0x2048, 0x7007, 0x0001,
-	0x7048, 0x080f, 0x0005, 0x00b6, 0x7007, 0x0001, 0xa974, 0xa878,
-	0x9084, 0x00ff, 0x9096, 0x0004, 0x0540, 0x20a9, 0x0001, 0x9096,
-	0x0001, 0x0190, 0x900e, 0x20a9, 0x0800, 0x9096, 0x0002, 0x0160,
-	0x9005, 0x11d8, 0xa974, 0x080c, 0x6600, 0x11b8, 0x0066, 0xae80,
-	0x080c, 0x6710, 0x006e, 0x0088, 0x0046, 0x2011, 0x180c, 0x2224,
-	0xc484, 0x2412, 0x004e, 0x00c6, 0x080c, 0x6600, 0x1110, 0x080c,
-	0x6810, 0x8108, 0x1f04, 0x7a14, 0x00ce, 0xa87c, 0xd084, 0x1120,
-	0x080c, 0x1031, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6c79, 0x012e, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x7007,
-	0x0001, 0x080c, 0x6966, 0x0580, 0x2061, 0x1a71, 0x6100, 0xd184,
-	0x0178, 0xa888, 0x9084, 0x00ff, 0x1550, 0x6000, 0xd084, 0x0520,
-	0x6004, 0x9005, 0x1538, 0x6003, 0x0000, 0x600b, 0x0000, 0x00c8,
-	0x2011, 0x0001, 0xa890, 0x9005, 0x1110, 0x2001, 0x001e, 0x8000,
-	0x6016, 0xa888, 0x9084, 0x00ff, 0x0178, 0x6006, 0xa888, 0x8007,
-	0x9084, 0x00ff, 0x0148, 0x600a, 0xa888, 0x8000, 0x1108, 0xc28d,
-	0x6202, 0x012e, 0x0804, 0x7c6e, 0x012e, 0x0804, 0x7c68, 0x012e,
-	0x0804, 0x7c62, 0x012e, 0x0804, 0x7c65, 0x0126, 0x2091, 0x8000,
-	0x7007, 0x0001, 0x080c, 0x6966, 0x05e0, 0x2061, 0x1a71, 0x6000,
-	0xd084, 0x05b8, 0x6204, 0x6308, 0xd08c, 0x1530, 0xac78, 0x9484,
-	0x0003, 0x0170, 0xa988, 0x918c, 0x00ff, 0x8001, 0x1120, 0x2100,
-	0x9210, 0x0620, 0x0028, 0x8001, 0x1508, 0x2100, 0x9212, 0x02f0,
-	0x9484, 0x000c, 0x0188, 0xa988, 0x810f, 0x918c, 0x00ff, 0x9082,
-	0x0004, 0x1120, 0x2100, 0x9318, 0x0288, 0x0030, 0x9082, 0x0004,
-	0x1168, 0x2100, 0x931a, 0x0250, 0xa890, 0x9005, 0x0110, 0x8000,
-	0x6016, 0x6206, 0x630a, 0x012e, 0x0804, 0x7c6e, 0x012e, 0x0804,
-	0x7c6b, 0x012e, 0x0804, 0x7c68, 0x0126, 0x2091, 0x8000, 0x7007,
-	0x0001, 0x2061, 0x1a71, 0x6300, 0xd38c, 0x1120, 0x6308, 0x8318,
-	0x0220, 0x630a, 0x012e, 0x0804, 0x7c7c, 0x012e, 0x0804, 0x7c6b,
-	0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x7007, 0x0001, 0xa87c,
-	0xd0ac, 0x0148, 0x00c6, 0x2061, 0x1a71, 0x6000, 0x9084, 0xfcff,
-	0x6002, 0x00ce, 0x0440, 0xa888, 0x9005, 0x05d8, 0xa88c, 0x9065,
-	0x0598, 0x2001, 0x1834, 0x2004, 0x9005, 0x0118, 0x080c, 0xae78,
-	0x0068, 0x6017, 0xf400, 0x605b, 0x0000, 0xa97c, 0xd1a4, 0x0110,
-	0xa980, 0x615a, 0x2009, 0x0041, 0x080c, 0xaec2, 0xa988, 0x918c,
-	0xff00, 0x9186, 0x2000, 0x1138, 0x0026, 0x900e, 0x2011, 0xfdff,
-	0x080c, 0x86b4, 0x002e, 0xa87c, 0xd0c4, 0x0148, 0x2061, 0x1a71,
-	0x6000, 0xd08c, 0x1120, 0x6008, 0x8000, 0x0208, 0x600a, 0x00ce,
-	0x012e, 0x00be, 0x0804, 0x7c6e, 0x00ce, 0x012e, 0x00be, 0x0804,
-	0x7c68, 0xa984, 0x9186, 0x002e, 0x0d30, 0x9186, 0x002d, 0x0d18,
-	0x9186, 0x0045, 0x0510, 0x9186, 0x002a, 0x1130, 0x2001, 0x180c,
-	0x200c, 0xc194, 0x2102, 0x08b8, 0x9186, 0x0020, 0x0158, 0x9186,
-	0x0029, 0x1d10, 0xa974, 0x080c, 0x6600, 0x1968, 0xb800, 0xc0e4,
-	0xb802, 0x0848, 0xa88c, 0x9065, 0x09b8, 0x6007, 0x0024, 0x2001,
-	0x1986, 0x2004, 0x601a, 0x0804, 0x7b03, 0xa88c, 0x9065, 0x0960,
-	0x00e6, 0xa890, 0x9075, 0x2001, 0x1834, 0x2004, 0x9005, 0x0150,
-	0x080c, 0xae78, 0x8eff, 0x0118, 0x2e60, 0x080c, 0xae78, 0x00ee,
-	0x0804, 0x7b03, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60, 0x6007,
-	0x003a, 0xa8a0, 0x9005, 0x0130, 0x6007, 0x003b, 0xa8a4, 0x602e,
-	0xa8a8, 0x6016, 0x6003, 0x0001, 0x080c, 0x90c7, 0x080c, 0x9664,
-	0x00ee, 0x0804, 0x7b03, 0x2061, 0x1a71, 0x6000, 0xd084, 0x0190,
-	0xd08c, 0x1904, 0x7c7c, 0x0126, 0x2091, 0x8000, 0x6204, 0x8210,
-	0x0220, 0x6206, 0x012e, 0x0804, 0x7c7c, 0x012e, 0xa883, 0x0016,
-	0x0804, 0x7c75, 0xa883, 0x0007, 0x0804, 0x7c75, 0xa864, 0x8007,
-	0x9084, 0x00ff, 0x0130, 0x8001, 0x1138, 0x7007, 0x0001, 0x0069,
-	0x0005, 0x080c, 0x77fe, 0x0040, 0x7007, 0x0003, 0x7012, 0x2900,
-	0x7016, 0x701a, 0x704b, 0x7ba5, 0x0005, 0x00b6, 0x00e6, 0x0126,
-	0x2091, 0x8000, 0x903e, 0x2061, 0x1800, 0x61d0, 0x81ff, 0x1904,
-	0x7c27, 0x6130, 0xd194, 0x1904, 0x7c51, 0xa878, 0x2070, 0x9e82,
-	0x1cd0, 0x0a04, 0x7c1b, 0x6068, 0x9e02, 0x1a04, 0x7c1b, 0x7120,
-	0x9186, 0x0006, 0x1904, 0x7c0d, 0x7010, 0x905d, 0x0904, 0x7c27,
-	0xb800, 0xd0e4, 0x1904, 0x7c4b, 0x2061, 0x1a71, 0x6100, 0x9184,
-	0x0301, 0x9086, 0x0001, 0x15a0, 0x7024, 0xd0dc, 0x1904, 0x7c54,
-	0xa883, 0x0000, 0xa803, 0x0000, 0x2908, 0x7014, 0x9005, 0x1198,
-	0x7116, 0xa87c, 0xd0f4, 0x1904, 0x7c57, 0x080c, 0x56d0, 0xd09c,
-	0x1118, 0xa87c, 0xc0cc, 0xa87e, 0x2e60, 0x080c, 0x85d4, 0x012e,
-	0x00ee, 0x00be, 0x0005, 0x2048, 0xa800, 0x9005, 0x1de0, 0xa902,
-	0x2148, 0xa87c, 0xd0f4, 0x1904, 0x7c57, 0x012e, 0x00ee, 0x00be,
-	0x0005, 0x012e, 0x00ee, 0xa883, 0x0006, 0x00be, 0x0804, 0x7c75,
-	0xd184, 0x0db8, 0xd1c4, 0x1190, 0x00a0, 0xa974, 0x080c, 0x6600,
-	0x15d0, 0xb800, 0xd0e4, 0x15b8, 0x7120, 0x9186, 0x0007, 0x1118,
-	0xa883, 0x0002, 0x0490, 0xa883, 0x0008, 0x0478, 0xa883, 0x000e,
-	0x0460, 0xa883, 0x0017, 0x0448, 0xa883, 0x0035, 0x0430, 0x080c,
-	0x56d4, 0xd0fc, 0x01e8, 0xa878, 0x2070, 0x9e82, 0x1cd0, 0x02c0,
-	0x6068, 0x9e02, 0x12a8, 0x7120, 0x9186, 0x0006, 0x1188, 0x7010,
-	0x905d, 0x0170, 0xb800, 0xd0bc, 0x0158, 0x2039, 0x0001, 0x7000,
-	0x9086, 0x0007, 0x1904, 0x7bb1, 0x7003, 0x0002, 0x0804, 0x7bb1,
-	0xa883, 0x0028, 0x0010, 0xa883, 0x0029, 0x012e, 0x00ee, 0x00be,
-	0x0420, 0xa883, 0x002a, 0x0cc8, 0xa883, 0x0045, 0x0cb0, 0x2e60,
-	0x2019, 0x0002, 0x601b, 0x0014, 0x080c, 0xe115, 0x012e, 0x00ee,
-	0x00be, 0x0005, 0x2009, 0x003e, 0x0058, 0x2009, 0x0004, 0x0040,
-	0x2009, 0x0006, 0x0028, 0x2009, 0x0016, 0x0010, 0x2009, 0x0001,
-	0xa884, 0x9084, 0xff00, 0x9105, 0xa886, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x6c79, 0x012e, 0x0005, 0x080c, 0x1031, 0x0005, 0x00d6,
-	0x080c, 0x85cb, 0x00de, 0x0005, 0x00d6, 0x00e6, 0x0126, 0x2091,
-	0x8000, 0x2071, 0x0040, 0x702c, 0xd084, 0x01d8, 0x908c, 0x0780,
-	0x190c, 0x7d66, 0xd09c, 0x11a8, 0x2071, 0x1800, 0x70c0, 0x90ea,
-	0x0020, 0x0278, 0x8001, 0x70c2, 0x702c, 0x2048, 0xa800, 0x702e,
-	0x9006, 0xa802, 0xa806, 0x2071, 0x0040, 0x2900, 0x7022, 0x702c,
-	0x0c28, 0x012e, 0x00ee, 0x00de, 0x0005, 0x0006, 0x9084, 0x0780,
-	0x190c, 0x7d66, 0x000e, 0x0005, 0xa898, 0x9084, 0x0003, 0x05a8,
-	0x080c, 0xadf1, 0x05d8, 0x2900, 0x6016, 0xa864, 0x9084, 0x00ff,
-	0x9086, 0x0035, 0x1138, 0x6008, 0xc0fd, 0x600a, 0x2001, 0x196b,
-	0x2004, 0x0098, 0xa8a0, 0x9084, 0x00ff, 0xa99c, 0x918c, 0xff00,
-	0x9105, 0xa99c, 0x918c, 0x00ff, 0x080c, 0x283e, 0x1540, 0x00b6,
-	0x080c, 0x6600, 0x2b00, 0x00be, 0x1510, 0x6012, 0x6023, 0x0001,
-	0x2009, 0x0040, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0035, 0x0110,
-	0x2009, 0x0041, 0x080c, 0xaec2, 0x0005, 0xa87b, 0x0101, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x6c79, 0x012e, 0x0005, 0xa87b, 0x002c,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x6c79, 0x012e, 0x0005, 0xa87b,
-	0x0028, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c79, 0x012e, 0x080c,
-	0xae47, 0x0005, 0x00d6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x00b6,
-	0x7007, 0x0001, 0xaa74, 0x9282, 0x0004, 0x1a04, 0x7d57, 0xa97c,
-	0x9188, 0x1000, 0x2104, 0x905d, 0xb804, 0xd284, 0x0140, 0x05e8,
-	0x8007, 0x9084, 0x00ff, 0x9084, 0x0006, 0x1108, 0x04b0, 0x2b10,
-	0x080c, 0xadf1, 0x1118, 0x080c, 0xae95, 0x05a8, 0x6212, 0xa874,
-	0x0002, 0x7d35, 0x7d3a, 0x7d3d, 0x7d43, 0x2019, 0x0002, 0x080c,
-	0xe501, 0x0060, 0x080c, 0xe49d, 0x0048, 0x2019, 0x0002, 0xa980,
-	0x080c, 0xe4b8, 0x0018, 0xa980, 0x080c, 0xe49d, 0x080c, 0xae47,
-	0xa887, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c79, 0x012e,
-	0x00be, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00de, 0x0005, 0xa887,
-	0x0006, 0x0c80, 0xa887, 0x0002, 0x0c68, 0xa887, 0x0005, 0x0c50,
-	0xa887, 0x0004, 0x0c38, 0xa887, 0x0007, 0x0c20, 0x2091, 0x8000,
-	0x0e04, 0x7d68, 0x0006, 0x0016, 0x2001, 0x8003, 0x0006, 0x0804,
-	0x0dde, 0x2001, 0x1834, 0x2004, 0x9005, 0x0005, 0x0005, 0x00f6,
-	0x2079, 0x0300, 0x2001, 0x0200, 0x200c, 0xc1e5, 0xc1dc, 0x2102,
-	0x2009, 0x0218, 0x210c, 0xd1ec, 0x1120, 0x080c, 0x157d, 0x00fe,
-	0x0005, 0x2001, 0x020d, 0x2003, 0x0020, 0x781f, 0x0300, 0x00fe,
-	0x0005, 0x781c, 0xd08c, 0x0904, 0x7de8, 0x68c0, 0x90aa, 0x0005,
-	0x0a04, 0x83e2, 0x7d44, 0x7c40, 0x9584, 0x00f6, 0x1510, 0x9484,
-	0x7000, 0x0140, 0x908a, 0x2000, 0x1260, 0x9584, 0x0700, 0x8007,
-	0x0804, 0x7def, 0x7000, 0x9084, 0xff00, 0x9086, 0x8100, 0x0da8,
-	0x00b0, 0x9484, 0x0fff, 0x1130, 0x7000, 0x9084, 0xff00, 0x9086,
-	0x8100, 0x11c0, 0x080c, 0xe9a0, 0x080c, 0x82d7, 0x7817, 0x0140,
-	0x00a8, 0x9584, 0x0076, 0x1118, 0x080c, 0x8335, 0x19c0, 0xd5a4,
-	0x0148, 0x0046, 0x0056, 0x080c, 0x7e4a, 0x080c, 0x2337, 0x005e,
-	0x004e, 0x0020, 0x080c, 0xe9a0, 0x7817, 0x0140, 0x080c, 0x73b0,
-	0x0168, 0x2001, 0x0111, 0x2004, 0xd08c, 0x0140, 0x6893, 0x0000,
-	0x2001, 0x0110, 0x2003, 0x0008, 0x2003, 0x0000, 0x080c, 0x7e2b,
-	0x2001, 0x19f0, 0x2004, 0x9005, 0x090c, 0x9664, 0x0005, 0x0002,
-	0x7e01, 0x80f9, 0x7df8, 0x7df8, 0x7df8, 0x7df8, 0x7df8, 0x7df8,
-	0x7817, 0x0140, 0x2001, 0x19f0, 0x2004, 0x9005, 0x090c, 0x9664,
-	0x0005, 0x7000, 0x908c, 0xff00, 0x9194, 0xf000, 0x810f, 0x9484,
-	0x0fff, 0x6892, 0x9286, 0x2000, 0x1150, 0x6800, 0x9086, 0x0001,
-	0x1118, 0x080c, 0x5731, 0x0070, 0x080c, 0x7e6a, 0x0058, 0x9286,
-	0x3000, 0x1118, 0x080c, 0x8034, 0x0028, 0x9286, 0x8000, 0x1110,
-	0x080c, 0x8207, 0x7817, 0x0140, 0x2001, 0x19f0, 0x2004, 0x9005,
-	0x090c, 0x9664, 0x0005, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0178,
-	0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1148, 0x0026, 0x0036,
-	0x2011, 0x8048, 0x2518, 0x080c, 0x4b05, 0x003e, 0x002e, 0x0005,
-	0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x2019, 0xfffe,
-	0x7c30, 0x0050, 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200,
-	0x7d44, 0x7c40, 0x2019, 0xffff, 0x2001, 0x1810, 0x2004, 0xd08c,
-	0x0160, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1130, 0x0026,
-	0x2011, 0x8048, 0x080c, 0x4b05, 0x002e, 0x00fe, 0x005e, 0x004e,
-	0x003e, 0x0005, 0x00b6, 0x00c6, 0x7010, 0x9084, 0xff00, 0x8007,
-	0x9096, 0x0001, 0x0120, 0x9096, 0x0023, 0x1904, 0x8005, 0x9186,
-	0x0023, 0x15c0, 0x080c, 0x829c, 0x0904, 0x8005, 0x6120, 0x9186,
-	0x0001, 0x0150, 0x9186, 0x0004, 0x0138, 0x9186, 0x0008, 0x0120,
-	0x9186, 0x000a, 0x1904, 0x8005, 0x7124, 0x610a, 0x7030, 0x908e,
-	0x0200, 0x1130, 0x2009, 0x0015, 0x080c, 0xaec2, 0x0804, 0x8005,
-	0x908e, 0x0214, 0x0118, 0x908e, 0x0210, 0x1130, 0x2009, 0x0015,
-	0x080c, 0xaec2, 0x0804, 0x8005, 0x908e, 0x0100, 0x1904, 0x8005,
-	0x7034, 0x9005, 0x1904, 0x8005, 0x2009, 0x0016, 0x080c, 0xaec2,
-	0x0804, 0x8005, 0x9186, 0x0022, 0x1904, 0x8005, 0x7030, 0x908e,
-	0x0300, 0x1580, 0x68dc, 0xd0a4, 0x0528, 0xc0b5, 0x68de, 0x7100,
-	0x918c, 0x00ff, 0x697e, 0x7004, 0x6882, 0x00f6, 0x2079, 0x0100,
-	0x79e6, 0x78ea, 0x0006, 0x9084, 0x00ff, 0x0016, 0x2008, 0x080c,
-	0x2887, 0x7932, 0x7936, 0x001e, 0x000e, 0x00fe, 0x080c, 0x283e,
-	0x695e, 0x703c, 0x00e6, 0x2071, 0x0140, 0x7086, 0x2071, 0x1800,
-	0x70b6, 0x00ee, 0x7034, 0x9005, 0x1904, 0x8005, 0x2009, 0x0017,
-	0x0804, 0x7fd2, 0x908e, 0x0400, 0x1190, 0x7034, 0x9005, 0x1904,
-	0x8005, 0x080c, 0x73b0, 0x0120, 0x2009, 0x001d, 0x0804, 0x7fd2,
-	0x68dc, 0xc0a5, 0x68de, 0x2009, 0x0030, 0x0804, 0x7fd2, 0x908e,
-	0x0500, 0x1140, 0x7034, 0x9005, 0x1904, 0x8005, 0x2009, 0x0018,
-	0x0804, 0x7fd2, 0x908e, 0x2010, 0x1120, 0x2009, 0x0019, 0x0804,
-	0x7fd2, 0x908e, 0x2110, 0x1120, 0x2009, 0x001a, 0x0804, 0x7fd2,
-	0x908e, 0x5200, 0x1140, 0x7034, 0x9005, 0x1904, 0x8005, 0x2009,
-	0x001b, 0x0804, 0x7fd2, 0x908e, 0x5000, 0x1140, 0x7034, 0x9005,
-	0x1904, 0x8005, 0x2009, 0x001c, 0x0804, 0x7fd2, 0x908e, 0x1300,
-	0x1120, 0x2009, 0x0034, 0x0804, 0x7fd2, 0x908e, 0x1200, 0x1140,
-	0x7034, 0x9005, 0x1904, 0x8005, 0x2009, 0x0024, 0x0804, 0x7fd2,
-	0x908c, 0xff00, 0x918e, 0x2400, 0x1170, 0x2009, 0x002d, 0x2001,
-	0x1810, 0x2004, 0xd09c, 0x0904, 0x7fd2, 0x080c, 0xd8ea, 0x1904,
-	0x8005, 0x0804, 0x7fd0, 0x908c, 0xff00, 0x918e, 0x5300, 0x1120,
-	0x2009, 0x002a, 0x0804, 0x7fd2, 0x908e, 0x0f00, 0x1120, 0x2009,
-	0x0020, 0x0804, 0x7fd2, 0x908e, 0x6104, 0x1530, 0x2029, 0x0205,
-	0x2011, 0x026d, 0x8208, 0x2204, 0x9082, 0x0004, 0x8004, 0x8004,
-	0x20a8, 0x2011, 0x8015, 0x211c, 0x8108, 0x0046, 0x2124, 0x080c,
-	0x4b05, 0x004e, 0x8108, 0x0f04, 0x7f86, 0x9186, 0x0280, 0x1d88,
-	0x2504, 0x8000, 0x202a, 0x2009, 0x0260, 0x0c58, 0x202b, 0x0000,
-	0x2009, 0x0023, 0x0804, 0x7fd2, 0x908e, 0x6000, 0x1120, 0x2009,
-	0x003f, 0x0804, 0x7fd2, 0x908e, 0x5400, 0x1138, 0x080c, 0x8392,
-	0x1904, 0x8005, 0x2009, 0x0046, 0x04a8, 0x908e, 0x5500, 0x1148,
-	0x080c, 0x83ba, 0x1118, 0x2009, 0x0041, 0x0460, 0x2009, 0x0042,
-	0x0448, 0x908e, 0x7800, 0x1118, 0x2009, 0x0045, 0x0418, 0x908e,
-	0x1000, 0x1118, 0x2009, 0x004e, 0x00e8, 0x908e, 0x6300, 0x1118,
-	0x2009, 0x004a, 0x00b8, 0x908c, 0xff00, 0x918e, 0x5600, 0x1118,
-	0x2009, 0x004f, 0x0078, 0x908c, 0xff00, 0x918e, 0x5700, 0x1118,
-	0x2009, 0x0050, 0x0038, 0x2009, 0x001d, 0x6838, 0xd0d4, 0x0110,
-	0x2009, 0x004c, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
-	0x080c, 0x283e, 0x1568, 0x080c, 0x659f, 0x1550, 0xbe12, 0xbd16,
-	0x001e, 0x0016, 0xb8c0, 0x9005, 0x1168, 0x9186, 0x0046, 0x1150,
-	0x687c, 0x9606, 0x1138, 0x6880, 0x9506, 0x9084, 0xff00, 0x1110,
-	0x001e, 0x0098, 0x080c, 0xadf1, 0x01a8, 0x2b08, 0x6112, 0x6023,
-	0x0004, 0x7120, 0x610a, 0x001e, 0x9186, 0x004c, 0x1110, 0x6023,
-	0x000a, 0x0016, 0x001e, 0x080c, 0xaec2, 0x00ce, 0x00be, 0x0005,
-	0x001e, 0x0cd8, 0x2001, 0x180e, 0x2004, 0xd0ec, 0x0120, 0x2011,
-	0x8049, 0x080c, 0x4b05, 0x080c, 0xae95, 0x0d90, 0x2b08, 0x6112,
-	0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x0016, 0x9186, 0x0017,
-	0x0118, 0x9186, 0x0030, 0x1128, 0x6007, 0x0009, 0x6017, 0x2900,
-	0x0020, 0x6007, 0x0051, 0x6017, 0x0000, 0x602f, 0x0009, 0x6003,
-	0x0001, 0x080c, 0x910f, 0x08a0, 0x080c, 0x32dc, 0x1140, 0x7010,
-	0x9084, 0xff00, 0x8007, 0x908e, 0x0008, 0x1108, 0x0009, 0x0005,
-	0x00b6, 0x00c6, 0x0046, 0x7000, 0x908c, 0xff00, 0x810f, 0x9186,
-	0x0033, 0x11e8, 0x080c, 0x829c, 0x0904, 0x8091, 0x7124, 0x610a,
-	0x7030, 0x908e, 0x0200, 0x1140, 0x7034, 0x9005, 0x15d0, 0x2009,
-	0x0015, 0x080c, 0xaec2, 0x04a8, 0x908e, 0x0100, 0x1590, 0x7034,
-	0x9005, 0x1578, 0x2009, 0x0016, 0x080c, 0xaec2, 0x0450, 0x9186,
-	0x0032, 0x1538, 0x7030, 0x908e, 0x1400, 0x1518, 0x2009, 0x0038,
-	0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x283e,
-	0x11b8, 0x080c, 0x659f, 0x11a0, 0xbe12, 0xbd16, 0x080c, 0xadf1,
-	0x0178, 0x2b08, 0x6112, 0x080c, 0xcf90, 0x6023, 0x0004, 0x7120,
-	0x610a, 0x001e, 0x080c, 0xaec2, 0x080c, 0x9664, 0x0010, 0x00ce,
-	0x001e, 0x004e, 0x00ce, 0x00be, 0x0005, 0x00b6, 0x0046, 0x00e6,
-	0x00d6, 0x2028, 0x2130, 0x9696, 0x00ff, 0x11b8, 0x9592, 0xfffc,
-	0x02a0, 0x9596, 0xfffd, 0x1120, 0x2009, 0x007f, 0x0804, 0x80f3,
-	0x9596, 0xfffe, 0x1120, 0x2009, 0x007e, 0x0804, 0x80f3, 0x9596,
-	0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0, 0x2011, 0x0000, 0x2019,
-	0x1837, 0x231c, 0xd3ac, 0x0130, 0x9026, 0x20a9, 0x0800, 0x2071,
-	0x1000, 0x0030, 0x2021, 0x0081, 0x20a9, 0x077f, 0x2071, 0x1081,
-	0x2e1c, 0x93dd, 0x0000, 0x1140, 0x82ff, 0x11d0, 0x9496, 0x00ff,
-	0x01b8, 0x2410, 0xc2fd, 0x00a0, 0xbf10, 0x2600, 0x9706, 0xb814,
-	0x1120, 0x9546, 0x1110, 0x2408, 0x00b0, 0x9745, 0x1148, 0x94c6,
-	0x007e, 0x0130, 0x94c6, 0x007f, 0x0118, 0x94c6, 0x0080, 0x1d20,
-	0x8420, 0x8e70, 0x1f04, 0x80c8, 0x82ff, 0x1118, 0x9085, 0x0001,
-	0x0018, 0xc2fc, 0x2208, 0x9006, 0x00de, 0x00ee, 0x004e, 0x00be,
-	0x0005, 0x7000, 0x908c, 0xff00, 0x810f, 0x9184, 0x000f, 0x0002,
-	0x8110, 0x8110, 0x8110, 0x82ae, 0x8110, 0x8119, 0x8144, 0x81d2,
-	0x8110, 0x8110, 0x8110, 0x8110, 0x8110, 0x8110, 0x8110, 0x8110,
-	0x7817, 0x0140, 0x2001, 0x19f0, 0x2004, 0x9005, 0x090c, 0x9664,
-	0x0005, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7120, 0x2160, 0x9c8c,
-	0x0007, 0x11c0, 0x9c8a, 0x1cd0, 0x02a8, 0x6868, 0x9c02, 0x1290,
-	0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1150,
-	0x700c, 0xb914, 0x9106, 0x1130, 0x7124, 0x610a, 0x2009, 0x0046,
-	0x080c, 0xaec2, 0x7817, 0x0140, 0x2001, 0x19f0, 0x2004, 0x9005,
-	0x090c, 0x9664, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x9484, 0x0fff,
-	0x0904, 0x81a8, 0x7110, 0xd1bc, 0x1904, 0x81a8, 0x7108, 0x700c,
-	0x2028, 0x918c, 0x00ff, 0x2130, 0x9094, 0xff00, 0x15b0, 0x81ff,
-	0x15a0, 0x9080, 0x331e, 0x200d, 0x918c, 0xff00, 0x810f, 0x2001,
-	0x0080, 0x9106, 0x0904, 0x81a8, 0x080c, 0x659f, 0x1904, 0x81a8,
-	0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15d8, 0xba04, 0x9294, 0xff00,
-	0x9286, 0x0600, 0x11a0, 0x080c, 0xadf1, 0x05e8, 0x2b08, 0x7028,
-	0x604a, 0x702c, 0x6046, 0x6112, 0x6023, 0x0006, 0x7120, 0x610a,
-	0x7130, 0x6156, 0x2009, 0x0044, 0x080c, 0xdb44, 0x0408, 0x080c,
-	0x696a, 0x1138, 0xb807, 0x0606, 0x0c30, 0x190c, 0x8095, 0x11c0,
-	0x0898, 0x080c, 0xadf1, 0x2b08, 0x0198, 0x6112, 0x6023, 0x0004,
-	0x7120, 0x610a, 0x9286, 0x0400, 0x1118, 0x6007, 0x0005, 0x0010,
-	0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x910f, 0x080c, 0x9664,
-	0x7817, 0x0140, 0x2001, 0x19f0, 0x2004, 0x9005, 0x090c, 0x9664,
-	0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0ec, 0x0120,
-	0x2011, 0x8049, 0x080c, 0x4b05, 0x080c, 0xae95, 0x0d48, 0x2b08,
-	0x6112, 0x6023, 0x0006, 0x7120, 0x610a, 0x7130, 0x6156, 0x6017,
-	0xf300, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x90c7, 0x080c,
-	0x9664, 0x08b0, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7020, 0x2060,
-	0x9c84, 0x0007, 0x11c0, 0x9c82, 0x1cd0, 0x02a8, 0x6868, 0x9c02,
+	0x001a, 0x1210, 0x002b, 0x0c50, 0x00e9, 0x080c, 0x7c90, 0x0005,
+	0x7802, 0x780e, 0x79e3, 0x7802, 0x780e, 0x7802, 0x780e, 0x780e,
+	0x7802, 0x780e, 0x79e3, 0x780e, 0x780e, 0x780e, 0x780e, 0x780e,
+	0x7802, 0x780e, 0x79e3, 0x7802, 0x7802, 0x780e, 0x7802, 0x7802,
+	0x7802, 0x780e, 0x00e6, 0x2071, 0x18fa, 0x2009, 0x0400, 0x0071,
+	0x00ee, 0x0005, 0x2009, 0x1000, 0x0049, 0x0005, 0x2009, 0x2000,
+	0x0029, 0x0005, 0x2009, 0x0800, 0x0009, 0x0005, 0x7007, 0x0001,
+	0xa868, 0x9084, 0x00ff, 0x9105, 0xa86a, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x6c81, 0x012e, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff,
+	0x0d08, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7985, 0x7007,
+	0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7985, 0x0005,
+	0xa864, 0x8007, 0x9084, 0x00ff, 0x0968, 0x8001, 0x1120, 0x7007,
+	0x0001, 0x0804, 0x79a0, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016,
+	0x701a, 0x704b, 0x79a0, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff,
+	0x0904, 0x780a, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x79bc,
+	0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x79bc,
+	0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904,
+	0x780a, 0x7007, 0x0001, 0x2009, 0x1834, 0x210c, 0x81ff, 0x11a8,
+	0xa868, 0x9084, 0x00ff, 0xa86a, 0xa883, 0x0000, 0x080c, 0x62ae,
+	0x1108, 0x0005, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139, 0xa87a,
+	0xa982, 0x080c, 0x6c81, 0x012e, 0x0ca0, 0xa994, 0x9186, 0x0071,
+	0x0d38, 0x9186, 0x0064, 0x0d20, 0x9186, 0x007c, 0x0d08, 0x9186,
+	0x0028, 0x09f0, 0x9186, 0x0038, 0x09d8, 0x9186, 0x0078, 0x09c0,
+	0x9186, 0x005f, 0x09a8, 0x9186, 0x0056, 0x0990, 0xa897, 0x4005,
+	0xa89b, 0x0001, 0x2001, 0x0030, 0x900e, 0x08a0, 0xa87c, 0x9084,
+	0x00c0, 0x9086, 0x00c0, 0x1120, 0x7007, 0x0001, 0x0804, 0x7bb1,
+	0x2900, 0x7016, 0x701a, 0x20a9, 0x0004, 0xa860, 0x20e0, 0xa85c,
+	0x9080, 0x0030, 0x2098, 0x7050, 0x2040, 0xa060, 0x20e8, 0xa05c,
+	0x9080, 0x0023, 0x20a0, 0x4003, 0xa888, 0x7012, 0x9082, 0x0401,
+	0x1a04, 0x7812, 0xaab4, 0x928a, 0x0002, 0x1a04, 0x7812, 0x82ff,
+	0x1138, 0xa8b8, 0xa9bc, 0x9105, 0x0118, 0x2001, 0x7943, 0x0018,
+	0x9280, 0x7939, 0x2005, 0x7056, 0x7010, 0x9015, 0x0904, 0x7924,
+	0x080c, 0x1018, 0x1118, 0x7007, 0x0004, 0x0005, 0x2900, 0x7022,
+	0x7054, 0x2060, 0xe000, 0xa866, 0x7050, 0x2040, 0xa95c, 0xe004,
+	0x9100, 0xa076, 0xa860, 0xa072, 0xe008, 0x920a, 0x1210, 0x900e,
+	0x2200, 0x7112, 0xe20c, 0x8003, 0x800b, 0x9296, 0x0004, 0x0108,
+	0x9108, 0xa17a, 0x810b, 0xa17e, 0x080c, 0x10e9, 0xa06c, 0x908e,
+	0x0100, 0x0170, 0x9086, 0x0200, 0x0118, 0x7007, 0x0007, 0x0005,
+	0x7020, 0x2048, 0x080c, 0x1031, 0x7014, 0x2048, 0x0804, 0x7812,
+	0x7020, 0x2048, 0x7018, 0xa802, 0xa807, 0x0000, 0x2908, 0x2048,
+	0xa906, 0x711a, 0x0804, 0x78dc, 0x7014, 0x2048, 0x7007, 0x0001,
+	0xa8b4, 0x9005, 0x1128, 0xa8b8, 0xa9bc, 0x9105, 0x0108, 0x00b9,
+	0xa864, 0x9084, 0x00ff, 0x9086, 0x001e, 0x0904, 0x7bb1, 0x0804,
+	0x7985, 0x793b, 0x793f, 0x0002, 0x001d, 0x0007, 0x0004, 0x000a,
+	0x001b, 0x0005, 0x0006, 0x000a, 0x001d, 0x0005, 0x0004, 0x0076,
+	0x0066, 0xafb8, 0xaebc, 0xa804, 0x2050, 0xb0c0, 0xb0e2, 0xb0bc,
+	0xb0de, 0xb0b8, 0xb0d2, 0xb0b4, 0xb0ce, 0xb6da, 0xb7d6, 0xb0b0,
+	0xb0ca, 0xb0ac, 0xb0c6, 0xb0a8, 0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2,
+	0xb7be, 0xb0a0, 0xb0b2, 0xb09c, 0xb0ae, 0xb098, 0xb0a2, 0xb094,
+	0xb09e, 0xb6aa, 0xb7a6, 0xb090, 0xb09a, 0xb08c, 0xb096, 0xb088,
+	0xb08a, 0xb084, 0xb086, 0xb692, 0xb78e, 0xb080, 0xb082, 0xb07c,
+	0xb07e, 0xb078, 0xb072, 0xb074, 0xb06e, 0xb67a, 0xb776, 0xb004,
+	0x9055, 0x1958, 0x006e, 0x007e, 0x0005, 0x2009, 0x1834, 0x210c,
+	0x81ff, 0x1178, 0x080c, 0x60ae, 0x1108, 0x0005, 0x080c, 0x6ec0,
+	0x0126, 0x2091, 0x8000, 0x080c, 0xce24, 0x080c, 0x6c81, 0x012e,
+	0x0ca0, 0x080c, 0xd229, 0x1d70, 0x2001, 0x0028, 0x900e, 0x0c70,
+	0x2009, 0x1834, 0x210c, 0x81ff, 0x1188, 0xa888, 0x9005, 0x0188,
+	0xa883, 0x0000, 0x080c, 0x613e, 0x1108, 0x0005, 0xa87a, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x6c81, 0x012e, 0x0cb8, 0x2001, 0x0028,
+	0x0ca8, 0x2001, 0x0000, 0x0c90, 0x2009, 0x1834, 0x210c, 0x81ff,
+	0x11d8, 0xa888, 0x9005, 0x01e0, 0xa883, 0x0000, 0xa87c, 0xd0f4,
+	0x0120, 0x080c, 0x6210, 0x1138, 0x0005, 0x9006, 0xa87a, 0x080c,
+	0x618b, 0x1108, 0x0005, 0x0126, 0x2091, 0x8000, 0xa87a, 0xa982,
+	0x080c, 0x6c81, 0x012e, 0x0cb0, 0x2001, 0x0028, 0x900e, 0x0c98,
+	0x2001, 0x0000, 0x0c80, 0x7018, 0xa802, 0x2908, 0x2048, 0xa906,
+	0x711a, 0x7010, 0x8001, 0x7012, 0x0118, 0x7007, 0x0003, 0x0030,
+	0x7014, 0x2048, 0x7007, 0x0001, 0x7048, 0x080f, 0x0005, 0x00b6,
+	0x7007, 0x0001, 0xa974, 0xa878, 0x9084, 0x00ff, 0x9096, 0x0004,
+	0x0540, 0x20a9, 0x0001, 0x9096, 0x0001, 0x0190, 0x900e, 0x20a9,
+	0x0800, 0x9096, 0x0002, 0x0160, 0x9005, 0x11d8, 0xa974, 0x080c,
+	0x65ff, 0x11b8, 0x0066, 0xae80, 0x080c, 0x670f, 0x006e, 0x0088,
+	0x0046, 0x2011, 0x180c, 0x2224, 0xc484, 0x2412, 0x004e, 0x00c6,
+	0x080c, 0x65ff, 0x1110, 0x080c, 0x680f, 0x8108, 0x1f04, 0x7a20,
+	0x00ce, 0xa87c, 0xd084, 0x1120, 0x080c, 0x1031, 0x00be, 0x0005,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x6c81, 0x012e, 0x00be, 0x0005,
+	0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x080c, 0x696e, 0x0580,
+	0x2061, 0x1a71, 0x6100, 0xd184, 0x0178, 0xa888, 0x9084, 0x00ff,
+	0x1550, 0x6000, 0xd084, 0x0520, 0x6004, 0x9005, 0x1538, 0x6003,
+	0x0000, 0x600b, 0x0000, 0x00c8, 0x2011, 0x0001, 0xa890, 0x9005,
+	0x1110, 0x2001, 0x001e, 0x8000, 0x6016, 0xa888, 0x9084, 0x00ff,
+	0x0178, 0x6006, 0xa888, 0x8007, 0x9084, 0x00ff, 0x0148, 0x600a,
+	0xa888, 0x8000, 0x1108, 0xc28d, 0x6202, 0x012e, 0x0804, 0x7c7a,
+	0x012e, 0x0804, 0x7c74, 0x012e, 0x0804, 0x7c6e, 0x012e, 0x0804,
+	0x7c71, 0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x080c, 0x696e,
+	0x05e0, 0x2061, 0x1a71, 0x6000, 0xd084, 0x05b8, 0x6204, 0x6308,
+	0xd08c, 0x1530, 0xac78, 0x9484, 0x0003, 0x0170, 0xa988, 0x918c,
+	0x00ff, 0x8001, 0x1120, 0x2100, 0x9210, 0x0620, 0x0028, 0x8001,
+	0x1508, 0x2100, 0x9212, 0x02f0, 0x9484, 0x000c, 0x0188, 0xa988,
+	0x810f, 0x918c, 0x00ff, 0x9082, 0x0004, 0x1120, 0x2100, 0x9318,
+	0x0288, 0x0030, 0x9082, 0x0004, 0x1168, 0x2100, 0x931a, 0x0250,
+	0xa890, 0x9005, 0x0110, 0x8000, 0x6016, 0x6206, 0x630a, 0x012e,
+	0x0804, 0x7c7a, 0x012e, 0x0804, 0x7c77, 0x012e, 0x0804, 0x7c74,
+	0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x2061, 0x1a71, 0x6300,
+	0xd38c, 0x1120, 0x6308, 0x8318, 0x0220, 0x630a, 0x012e, 0x0804,
+	0x7c88, 0x012e, 0x0804, 0x7c77, 0x00b6, 0x0126, 0x00c6, 0x2091,
+	0x8000, 0x7007, 0x0001, 0xa87c, 0xd0ac, 0x0148, 0x00c6, 0x2061,
+	0x1a71, 0x6000, 0x9084, 0xfcff, 0x6002, 0x00ce, 0x0440, 0xa888,
+	0x9005, 0x05d8, 0xa88c, 0x9065, 0x0598, 0x2001, 0x1834, 0x2004,
+	0x9005, 0x0118, 0x080c, 0xae92, 0x0068, 0x6017, 0xf400, 0x605b,
+	0x0000, 0xa97c, 0xd1a4, 0x0110, 0xa980, 0x615a, 0x2009, 0x0041,
+	0x080c, 0xaedc, 0xa988, 0x918c, 0xff00, 0x9186, 0x2000, 0x1138,
+	0x0026, 0x900e, 0x2011, 0xfdff, 0x080c, 0x86dd, 0x002e, 0xa87c,
+	0xd0c4, 0x0148, 0x2061, 0x1a71, 0x6000, 0xd08c, 0x1120, 0x6008,
+	0x8000, 0x0208, 0x600a, 0x00ce, 0x012e, 0x00be, 0x0804, 0x7c7a,
+	0x00ce, 0x012e, 0x00be, 0x0804, 0x7c74, 0xa984, 0x9186, 0x002e,
+	0x0d30, 0x9186, 0x002d, 0x0d18, 0x9186, 0x0045, 0x0510, 0x9186,
+	0x002a, 0x1130, 0x2001, 0x180c, 0x200c, 0xc194, 0x2102, 0x08b8,
+	0x9186, 0x0020, 0x0158, 0x9186, 0x0029, 0x1d10, 0xa974, 0x080c,
+	0x65ff, 0x1968, 0xb800, 0xc0e4, 0xb802, 0x0848, 0xa88c, 0x9065,
+	0x09b8, 0x6007, 0x0024, 0x2001, 0x1986, 0x2004, 0x601a, 0x0804,
+	0x7b0f, 0xa88c, 0x9065, 0x0960, 0x00e6, 0xa890, 0x9075, 0x2001,
+	0x1834, 0x2004, 0x9005, 0x0150, 0x080c, 0xae92, 0x8eff, 0x0118,
+	0x2e60, 0x080c, 0xae92, 0x00ee, 0x0804, 0x7b0f, 0x6024, 0xc0dc,
+	0xc0d5, 0x6026, 0x2e60, 0x6007, 0x003a, 0xa8a0, 0x9005, 0x0130,
+	0x6007, 0x003b, 0xa8a4, 0x602e, 0xa8a8, 0x6016, 0x6003, 0x0001,
+	0x080c, 0x90f0, 0x080c, 0x968d, 0x00ee, 0x0804, 0x7b0f, 0x2061,
+	0x1a71, 0x6000, 0xd084, 0x0190, 0xd08c, 0x1904, 0x7c88, 0x0126,
+	0x2091, 0x8000, 0x6204, 0x8210, 0x0220, 0x6206, 0x012e, 0x0804,
+	0x7c88, 0x012e, 0xa883, 0x0016, 0x0804, 0x7c81, 0xa883, 0x0007,
+	0x0804, 0x7c81, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0130, 0x8001,
+	0x1138, 0x7007, 0x0001, 0x0069, 0x0005, 0x080c, 0x780a, 0x0040,
+	0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7bb1,
+	0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0x903e, 0x2061,
+	0x1800, 0x61d0, 0x81ff, 0x1904, 0x7c33, 0x6130, 0xd194, 0x1904,
+	0x7c5d, 0xa878, 0x2070, 0x9e82, 0x1cd0, 0x0a04, 0x7c27, 0x6068,
+	0x9e02, 0x1a04, 0x7c27, 0x7120, 0x9186, 0x0006, 0x1904, 0x7c19,
+	0x7010, 0x905d, 0x0904, 0x7c33, 0xb800, 0xd0e4, 0x1904, 0x7c57,
+	0x2061, 0x1a71, 0x6100, 0x9184, 0x0301, 0x9086, 0x0001, 0x15a0,
+	0x7024, 0xd0dc, 0x1904, 0x7c60, 0xa883, 0x0000, 0xa803, 0x0000,
+	0x2908, 0x7014, 0x9005, 0x1198, 0x7116, 0xa87c, 0xd0f4, 0x1904,
+	0x7c63, 0x080c, 0x56cf, 0xd09c, 0x1118, 0xa87c, 0xc0cc, 0xa87e,
+	0x2e60, 0x080c, 0x85fd, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2048,
+	0xa800, 0x9005, 0x1de0, 0xa902, 0x2148, 0xa87c, 0xd0f4, 0x1904,
+	0x7c63, 0x012e, 0x00ee, 0x00be, 0x0005, 0x012e, 0x00ee, 0xa883,
+	0x0006, 0x00be, 0x0804, 0x7c81, 0xd184, 0x0db8, 0xd1c4, 0x1190,
+	0x00a0, 0xa974, 0x080c, 0x65ff, 0x15d0, 0xb800, 0xd0e4, 0x15b8,
+	0x7120, 0x9186, 0x0007, 0x1118, 0xa883, 0x0002, 0x0490, 0xa883,
+	0x0008, 0x0478, 0xa883, 0x000e, 0x0460, 0xa883, 0x0017, 0x0448,
+	0xa883, 0x0035, 0x0430, 0x080c, 0x56d3, 0xd0fc, 0x01e8, 0xa878,
+	0x2070, 0x9e82, 0x1cd0, 0x02c0, 0x6068, 0x9e02, 0x12a8, 0x7120,
+	0x9186, 0x0006, 0x1188, 0x7010, 0x905d, 0x0170, 0xb800, 0xd0bc,
+	0x0158, 0x2039, 0x0001, 0x7000, 0x9086, 0x0007, 0x1904, 0x7bbd,
+	0x7003, 0x0002, 0x0804, 0x7bbd, 0xa883, 0x0028, 0x0010, 0xa883,
+	0x0029, 0x012e, 0x00ee, 0x00be, 0x0420, 0xa883, 0x002a, 0x0cc8,
+	0xa883, 0x0045, 0x0cb0, 0x2e60, 0x2019, 0x0002, 0x601b, 0x0014,
+	0x080c, 0xe134, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2009, 0x003e,
+	0x0058, 0x2009, 0x0004, 0x0040, 0x2009, 0x0006, 0x0028, 0x2009,
+	0x0016, 0x0010, 0x2009, 0x0001, 0xa884, 0x9084, 0xff00, 0x9105,
+	0xa886, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c81, 0x012e, 0x0005,
+	0x080c, 0x1031, 0x0005, 0x00d6, 0x080c, 0x85f4, 0x00de, 0x0005,
+	0x00d6, 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0x0040, 0x702c,
+	0xd084, 0x01d8, 0x908c, 0x0780, 0x190c, 0x7d72, 0xd09c, 0x11a8,
+	0x2071, 0x1800, 0x70c0, 0x90ea, 0x0020, 0x0278, 0x8001, 0x70c2,
+	0x702c, 0x2048, 0xa800, 0x702e, 0x9006, 0xa802, 0xa806, 0x2071,
+	0x0040, 0x2900, 0x7022, 0x702c, 0x0c28, 0x012e, 0x00ee, 0x00de,
+	0x0005, 0x0006, 0x9084, 0x0780, 0x190c, 0x7d72, 0x000e, 0x0005,
+	0xa898, 0x9084, 0x0003, 0x05a8, 0x080c, 0xae0b, 0x05d8, 0x2900,
+	0x6016, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0035, 0x1138, 0x6008,
+	0xc0fd, 0x600a, 0x2001, 0x196b, 0x2004, 0x0098, 0xa8a0, 0x9084,
+	0x00ff, 0xa99c, 0x918c, 0xff00, 0x9105, 0xa99c, 0x918c, 0x00ff,
+	0x080c, 0x283e, 0x1540, 0x00b6, 0x080c, 0x65ff, 0x2b00, 0x00be,
+	0x1510, 0x6012, 0x6023, 0x0001, 0x2009, 0x0040, 0xa864, 0x9084,
+	0x00ff, 0x9086, 0x0035, 0x0110, 0x2009, 0x0041, 0x080c, 0xaedc,
+	0x0005, 0xa87b, 0x0101, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c81,
+	0x012e, 0x0005, 0xa87b, 0x002c, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6c81, 0x012e, 0x0005, 0xa87b, 0x0028, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x6c81, 0x012e, 0x080c, 0xae61, 0x0005, 0x00d6, 0x00c6,
+	0x0036, 0x0026, 0x0016, 0x00b6, 0x7007, 0x0001, 0xaa74, 0x9282,
+	0x0004, 0x1a04, 0x7d63, 0xa97c, 0x9188, 0x1000, 0x2104, 0x905d,
+	0xb804, 0xd284, 0x0140, 0x05e8, 0x8007, 0x9084, 0x00ff, 0x9084,
+	0x0006, 0x1108, 0x04b0, 0x2b10, 0x080c, 0xae0b, 0x1118, 0x080c,
+	0xaeaf, 0x05a8, 0x6212, 0xa874, 0x0002, 0x7d41, 0x7d46, 0x7d49,
+	0x7d4f, 0x2019, 0x0002, 0x080c, 0xe522, 0x0060, 0x080c, 0xe4be,
+	0x0048, 0x2019, 0x0002, 0xa980, 0x080c, 0xe4d9, 0x0018, 0xa980,
+	0x080c, 0xe4be, 0x080c, 0xae61, 0xa887, 0x0000, 0x0126, 0x2091,
+	0x8000, 0x080c, 0x6c81, 0x012e, 0x00be, 0x001e, 0x002e, 0x003e,
+	0x00ce, 0x00de, 0x0005, 0xa887, 0x0006, 0x0c80, 0xa887, 0x0002,
+	0x0c68, 0xa887, 0x0005, 0x0c50, 0xa887, 0x0004, 0x0c38, 0xa887,
+	0x0007, 0x0c20, 0x2091, 0x8000, 0x0e04, 0x7d74, 0x0006, 0x0016,
+	0x2001, 0x8003, 0x0006, 0x0804, 0x0dde, 0x2001, 0x1834, 0x2004,
+	0x9005, 0x0005, 0x0005, 0x00f6, 0x2079, 0x0300, 0x2001, 0x0200,
+	0x200c, 0xc1e5, 0xc1dc, 0x2102, 0x2009, 0x0218, 0x210c, 0xd1ec,
+	0x1120, 0x080c, 0x157d, 0x00fe, 0x0005, 0x2001, 0x020d, 0x2003,
+	0x0020, 0x781f, 0x0300, 0x00fe, 0x0005, 0x781c, 0xd08c, 0x0904,
+	0x7df4, 0x68c0, 0x90aa, 0x0005, 0x0a04, 0x840b, 0x7d44, 0x7c40,
+	0x9584, 0x00f6, 0x1510, 0x9484, 0x7000, 0x0140, 0x908a, 0x2000,
+	0x1260, 0x9584, 0x0700, 0x8007, 0x0804, 0x7dfb, 0x7000, 0x9084,
+	0xff00, 0x9086, 0x8100, 0x0da8, 0x00b0, 0x9484, 0x0fff, 0x1130,
+	0x7000, 0x9084, 0xff00, 0x9086, 0x8100, 0x11c0, 0x080c, 0xe9c1,
+	0x080c, 0x8300, 0x7817, 0x0140, 0x00a8, 0x9584, 0x0076, 0x1118,
+	0x080c, 0x835e, 0x19c0, 0xd5a4, 0x0148, 0x0046, 0x0056, 0x080c,
+	0x7e56, 0x080c, 0x2337, 0x005e, 0x004e, 0x0020, 0x080c, 0xe9c1,
+	0x7817, 0x0140, 0x080c, 0x73bc, 0x0168, 0x2001, 0x0111, 0x2004,
+	0xd08c, 0x0140, 0x6893, 0x0000, 0x2001, 0x0110, 0x2003, 0x0008,
+	0x2003, 0x0000, 0x080c, 0x7e37, 0x2001, 0x19f0, 0x2004, 0x9005,
+	0x090c, 0x968d, 0x0005, 0x0002, 0x7e0d, 0x8122, 0x7e04, 0x7e04,
+	0x7e04, 0x7e04, 0x7e04, 0x7e04, 0x7817, 0x0140, 0x2001, 0x19f0,
+	0x2004, 0x9005, 0x090c, 0x968d, 0x0005, 0x7000, 0x908c, 0xff00,
+	0x9194, 0xf000, 0x810f, 0x9484, 0x0fff, 0x6892, 0x9286, 0x2000,
+	0x1150, 0x6800, 0x9086, 0x0001, 0x1118, 0x080c, 0x5730, 0x0070,
+	0x080c, 0x7e76, 0x0058, 0x9286, 0x3000, 0x1118, 0x080c, 0x805d,
+	0x0028, 0x9286, 0x8000, 0x1110, 0x080c, 0x8230, 0x7817, 0x0140,
+	0x2001, 0x19f0, 0x2004, 0x9005, 0x090c, 0x968d, 0x0005, 0x2001,
+	0x1810, 0x2004, 0xd08c, 0x0178, 0x2001, 0x1800, 0x2004, 0x9086,
+	0x0003, 0x1148, 0x0026, 0x0036, 0x2011, 0x8048, 0x2518, 0x080c,
+	0x4b04, 0x003e, 0x002e, 0x0005, 0x0036, 0x0046, 0x0056, 0x00f6,
+	0x2079, 0x0200, 0x2019, 0xfffe, 0x7c30, 0x0050, 0x0036, 0x0046,
+	0x0056, 0x00f6, 0x2079, 0x0200, 0x7d44, 0x7c40, 0x2019, 0xffff,
+	0x2001, 0x1810, 0x2004, 0xd08c, 0x0160, 0x2001, 0x1800, 0x2004,
+	0x9086, 0x0003, 0x1130, 0x0026, 0x2011, 0x8048, 0x080c, 0x4b04,
+	0x002e, 0x00fe, 0x005e, 0x004e, 0x003e, 0x0005, 0x00b6, 0x00c6,
+	0x7010, 0x9084, 0xff00, 0x8007, 0x9096, 0x0001, 0x0120, 0x9096,
+	0x0023, 0x1904, 0x802e, 0x9186, 0x0023, 0x15c0, 0x080c, 0x82c5,
+	0x0904, 0x802e, 0x6120, 0x9186, 0x0001, 0x0150, 0x9186, 0x0004,
+	0x0138, 0x9186, 0x0008, 0x0120, 0x9186, 0x000a, 0x1904, 0x802e,
+	0x7124, 0x610a, 0x7030, 0x908e, 0x0200, 0x1130, 0x2009, 0x0015,
+	0x080c, 0xaedc, 0x0804, 0x802e, 0x908e, 0x0214, 0x0118, 0x908e,
+	0x0210, 0x1130, 0x2009, 0x0015, 0x080c, 0xaedc, 0x0804, 0x802e,
+	0x908e, 0x0100, 0x1904, 0x802e, 0x7034, 0x9005, 0x1904, 0x802e,
+	0x2009, 0x0016, 0x080c, 0xaedc, 0x0804, 0x802e, 0x9186, 0x0022,
+	0x1904, 0x802e, 0x7030, 0x908e, 0x0300, 0x1580, 0x68dc, 0xd0a4,
+	0x0528, 0xc0b5, 0x68de, 0x7100, 0x918c, 0x00ff, 0x697e, 0x7004,
+	0x6882, 0x00f6, 0x2079, 0x0100, 0x79e6, 0x78ea, 0x0006, 0x9084,
+	0x00ff, 0x0016, 0x2008, 0x080c, 0x2887, 0x7932, 0x7936, 0x001e,
+	0x000e, 0x00fe, 0x080c, 0x283e, 0x695e, 0x703c, 0x00e6, 0x2071,
+	0x0140, 0x7086, 0x2071, 0x1800, 0x70b6, 0x00ee, 0x7034, 0x9005,
+	0x1904, 0x802e, 0x2009, 0x0017, 0x0804, 0x7fde, 0x908e, 0x0400,
+	0x1190, 0x7034, 0x9005, 0x1904, 0x802e, 0x080c, 0x73bc, 0x0120,
+	0x2009, 0x001d, 0x0804, 0x7fde, 0x68dc, 0xc0a5, 0x68de, 0x2009,
+	0x0030, 0x0804, 0x7fde, 0x908e, 0x0500, 0x1140, 0x7034, 0x9005,
+	0x1904, 0x802e, 0x2009, 0x0018, 0x0804, 0x7fde, 0x908e, 0x2010,
+	0x1120, 0x2009, 0x0019, 0x0804, 0x7fde, 0x908e, 0x2110, 0x1120,
+	0x2009, 0x001a, 0x0804, 0x7fde, 0x908e, 0x5200, 0x1140, 0x7034,
+	0x9005, 0x1904, 0x802e, 0x2009, 0x001b, 0x0804, 0x7fde, 0x908e,
+	0x5000, 0x1140, 0x7034, 0x9005, 0x1904, 0x802e, 0x2009, 0x001c,
+	0x0804, 0x7fde, 0x908e, 0x1300, 0x1120, 0x2009, 0x0034, 0x0804,
+	0x7fde, 0x908e, 0x1200, 0x1140, 0x7034, 0x9005, 0x1904, 0x802e,
+	0x2009, 0x0024, 0x0804, 0x7fde, 0x908c, 0xff00, 0x918e, 0x2400,
+	0x1170, 0x2009, 0x002d, 0x2001, 0x1810, 0x2004, 0xd09c, 0x0904,
+	0x7fde, 0x080c, 0xd905, 0x1904, 0x802e, 0x0804, 0x7fdc, 0x908c,
+	0xff00, 0x918e, 0x5300, 0x1120, 0x2009, 0x002a, 0x0804, 0x7fde,
+	0x908e, 0x0f00, 0x1120, 0x2009, 0x0020, 0x0804, 0x7fde, 0x908e,
+	0x6104, 0x1530, 0x2029, 0x0205, 0x2011, 0x026d, 0x8208, 0x2204,
+	0x9082, 0x0004, 0x8004, 0x8004, 0x20a8, 0x2011, 0x8015, 0x211c,
+	0x8108, 0x0046, 0x2124, 0x080c, 0x4b04, 0x004e, 0x8108, 0x0f04,
+	0x7f92, 0x9186, 0x0280, 0x1d88, 0x2504, 0x8000, 0x202a, 0x2009,
+	0x0260, 0x0c58, 0x202b, 0x0000, 0x2009, 0x0023, 0x0804, 0x7fde,
+	0x908e, 0x6000, 0x1120, 0x2009, 0x003f, 0x0804, 0x7fde, 0x908e,
+	0x5400, 0x1138, 0x080c, 0x83bb, 0x1904, 0x802e, 0x2009, 0x0046,
+	0x04a8, 0x908e, 0x5500, 0x1148, 0x080c, 0x83e3, 0x1118, 0x2009,
+	0x0041, 0x0460, 0x2009, 0x0042, 0x0448, 0x908e, 0x7800, 0x1118,
+	0x2009, 0x0045, 0x0418, 0x908e, 0x1000, 0x1118, 0x2009, 0x004e,
+	0x00e8, 0x908e, 0x6300, 0x1118, 0x2009, 0x004a, 0x00b8, 0x908c,
+	0xff00, 0x918e, 0x5600, 0x1118, 0x2009, 0x004f, 0x0078, 0x908c,
+	0xff00, 0x918e, 0x5700, 0x1118, 0x2009, 0x0050, 0x0038, 0x2009,
+	0x001d, 0x6838, 0xd0d4, 0x0110, 0x2009, 0x004c, 0x0016, 0x2011,
+	0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x283e, 0x1904, 0x8031,
+	0x080c, 0x659e, 0x1904, 0x8031, 0xbe12, 0xbd16, 0x001e, 0x0016,
+	0x080c, 0x73bc, 0x01c0, 0x68dc, 0xd08c, 0x1148, 0x7000, 0x9084,
+	0x00ff, 0x1188, 0x7004, 0x9084, 0xff00, 0x1168, 0x0040, 0x687c,
+	0x9606, 0x1148, 0x6880, 0x9506, 0x9084, 0xff00, 0x1120, 0x9584,
+	0x00ff, 0xb8c2, 0x0080, 0xb8c0, 0x9005, 0x1168, 0x9186, 0x0046,
+	0x1150, 0x687c, 0x9606, 0x1138, 0x6880, 0x9506, 0x9084, 0xff00,
+	0x1110, 0x001e, 0x0098, 0x080c, 0xae0b, 0x01a8, 0x2b08, 0x6112,
+	0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x9186, 0x004c, 0x1110,
+	0x6023, 0x000a, 0x0016, 0x001e, 0x080c, 0xaedc, 0x00ce, 0x00be,
+	0x0005, 0x001e, 0x0cd8, 0x2001, 0x180e, 0x2004, 0xd0ec, 0x0120,
+	0x2011, 0x8049, 0x080c, 0x4b04, 0x080c, 0xaeaf, 0x0d90, 0x2b08,
+	0x6112, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x0016, 0x9186,
+	0x0017, 0x0118, 0x9186, 0x0030, 0x1128, 0x6007, 0x0009, 0x6017,
+	0x2900, 0x0020, 0x6007, 0x0051, 0x6017, 0x0000, 0x602f, 0x0009,
+	0x6003, 0x0001, 0x080c, 0x9138, 0x08a0, 0x080c, 0x32e3, 0x1140,
+	0x7010, 0x9084, 0xff00, 0x8007, 0x908e, 0x0008, 0x1108, 0x0009,
+	0x0005, 0x00b6, 0x00c6, 0x0046, 0x7000, 0x908c, 0xff00, 0x810f,
+	0x9186, 0x0033, 0x11e8, 0x080c, 0x82c5, 0x0904, 0x80ba, 0x7124,
+	0x610a, 0x7030, 0x908e, 0x0200, 0x1140, 0x7034, 0x9005, 0x15d0,
+	0x2009, 0x0015, 0x080c, 0xaedc, 0x04a8, 0x908e, 0x0100, 0x1590,
+	0x7034, 0x9005, 0x1578, 0x2009, 0x0016, 0x080c, 0xaedc, 0x0450,
+	0x9186, 0x0032, 0x1538, 0x7030, 0x908e, 0x1400, 0x1518, 0x2009,
+	0x0038, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
+	0x283e, 0x11b8, 0x080c, 0x659e, 0x11a0, 0xbe12, 0xbd16, 0x080c,
+	0xae0b, 0x0178, 0x2b08, 0x6112, 0x080c, 0xcfaa, 0x6023, 0x0004,
+	0x7120, 0x610a, 0x001e, 0x080c, 0xaedc, 0x080c, 0x968d, 0x0010,
+	0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be, 0x0005, 0x00b6, 0x0046,
+	0x00e6, 0x00d6, 0x2028, 0x2130, 0x9696, 0x00ff, 0x11b8, 0x9592,
+	0xfffc, 0x02a0, 0x9596, 0xfffd, 0x1120, 0x2009, 0x007f, 0x0804,
+	0x811c, 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e, 0x0804, 0x811c,
+	0x9596, 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0, 0x2011, 0x0000,
+	0x2019, 0x1837, 0x231c, 0xd3ac, 0x0130, 0x9026, 0x20a9, 0x0800,
+	0x2071, 0x1000, 0x0030, 0x2021, 0x0081, 0x20a9, 0x077f, 0x2071,
+	0x1081, 0x2e1c, 0x93dd, 0x0000, 0x1140, 0x82ff, 0x11d0, 0x9496,
+	0x00ff, 0x01b8, 0x2410, 0xc2fd, 0x00a0, 0xbf10, 0x2600, 0x9706,
+	0xb814, 0x1120, 0x9546, 0x1110, 0x2408, 0x00b0, 0x9745, 0x1148,
+	0x94c6, 0x007e, 0x0130, 0x94c6, 0x007f, 0x0118, 0x94c6, 0x0080,
+	0x1d20, 0x8420, 0x8e70, 0x1f04, 0x80f1, 0x82ff, 0x1118, 0x9085,
+	0x0001, 0x0018, 0xc2fc, 0x2208, 0x9006, 0x00de, 0x00ee, 0x004e,
+	0x00be, 0x0005, 0x7000, 0x908c, 0xff00, 0x810f, 0x9184, 0x000f,
+	0x0002, 0x8139, 0x8139, 0x8139, 0x82d7, 0x8139, 0x8142, 0x816d,
+	0x81fb, 0x8139, 0x8139, 0x8139, 0x8139, 0x8139, 0x8139, 0x8139,
+	0x8139, 0x7817, 0x0140, 0x2001, 0x19f0, 0x2004, 0x9005, 0x090c,
+	0x968d, 0x0005, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7120, 0x2160,
+	0x9c8c, 0x0007, 0x11c0, 0x9c8a, 0x1cd0, 0x02a8, 0x6868, 0x9c02,
 	0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106,
 	0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124, 0x610a, 0x2009,
-	0x0045, 0x080c, 0xaec2, 0x7817, 0x0140, 0x2001, 0x19f0, 0x2004,
-	0x9005, 0x090c, 0x9664, 0x00be, 0x0005, 0x6120, 0x9186, 0x0002,
-	0x0128, 0x9186, 0x0005, 0x0110, 0x9085, 0x0001, 0x0005, 0x080c,
-	0x32dc, 0x1168, 0x7010, 0x9084, 0xff00, 0x8007, 0x9086, 0x0000,
-	0x1130, 0x9184, 0x000f, 0x908a, 0x0006, 0x1208, 0x000b, 0x0005,
-	0x821e, 0x821f, 0x821e, 0x821e, 0x827e, 0x828d, 0x0005, 0x00b6,
-	0x7110, 0xd1bc, 0x0120, 0x702c, 0xd084, 0x0904, 0x827c, 0x700c,
-	0x7108, 0x080c, 0x283e, 0x1904, 0x827c, 0x080c, 0x659f, 0x1904,
-	0x827c, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x01d8, 0x080c, 0x696a,
-	0x0118, 0x9086, 0x0004, 0x1588, 0x00c6, 0x080c, 0x829c, 0x00ce,
-	0x05d8, 0x080c, 0xadf1, 0x2b08, 0x05b8, 0x6112, 0x080c, 0xcf90,
-	0x6023, 0x0002, 0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0xaec2,
-	0x0458, 0x080c, 0x696a, 0x0148, 0x9086, 0x0004, 0x0130, 0x080c,
-	0x6972, 0x0118, 0x9086, 0x0004, 0x1180, 0x080c, 0xadf1, 0x2b08,
-	0x01d8, 0x6112, 0x080c, 0xcf90, 0x6023, 0x0005, 0x7120, 0x610a,
-	0x2009, 0x0088, 0x080c, 0xaec2, 0x0078, 0x080c, 0xadf1, 0x2b08,
-	0x0158, 0x6112, 0x080c, 0xcf90, 0x6023, 0x0004, 0x7120, 0x610a,
-	0x2009, 0x0001, 0x080c, 0xaec2, 0x00be, 0x0005, 0x7110, 0xd1bc,
-	0x0158, 0x00d1, 0x0148, 0x080c, 0x81fd, 0x1130, 0x7124, 0x610a,
-	0x2009, 0x0089, 0x080c, 0xaec2, 0x0005, 0x7110, 0xd1bc, 0x0158,
-	0x0059, 0x0148, 0x080c, 0x81fd, 0x1130, 0x7124, 0x610a, 0x2009,
-	0x008a, 0x080c, 0xaec2, 0x0005, 0x7020, 0x2060, 0x9c84, 0x0007,
-	0x1158, 0x9c82, 0x1cd0, 0x0240, 0x2001, 0x181a, 0x2004, 0x9c02,
-	0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x00b6, 0x7110,
-	0xd1bc, 0x11d8, 0x7024, 0x2060, 0x9c84, 0x0007, 0x11b0, 0x9c82,
-	0x1cd0, 0x0298, 0x6868, 0x9c02, 0x1280, 0x7008, 0x9084, 0x00ff,
-	0x6110, 0x2158, 0xb910, 0x9106, 0x1140, 0x700c, 0xb914, 0x9106,
-	0x1120, 0x2009, 0x0051, 0x080c, 0xaec2, 0x7817, 0x0140, 0x2001,
-	0x19f0, 0x2004, 0x9005, 0x090c, 0x9664, 0x00be, 0x0005, 0x2031,
-	0x0105, 0x0069, 0x0005, 0x2031, 0x0206, 0x0049, 0x0005, 0x2031,
-	0x0207, 0x0029, 0x0005, 0x2031, 0x0213, 0x0009, 0x0005, 0x00c6,
-	0x0096, 0x00f6, 0x7000, 0x9084, 0xf000, 0x9086, 0xc000, 0x05d0,
-	0x080c, 0xadf1, 0x05b8, 0x0066, 0x00c6, 0x0046, 0x2011, 0x0263,
-	0x2204, 0x8211, 0x220c, 0x080c, 0x283e, 0x15a0, 0x080c, 0x659f,
-	0x1588, 0xbe12, 0xbd16, 0x2b00, 0x004e, 0x00ce, 0x6012, 0x080c,
-	0xcf90, 0x080c, 0x0fff, 0x0510, 0x2900, 0x605a, 0x9006, 0xa802,
-	0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b, 0x20a9, 0x000e, 0xa860,
-	0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98, 0x4003, 0x006e, 0x6616,
-	0x6007, 0x003e, 0x6023, 0x0001, 0x6003, 0x0001, 0x080c, 0x910f,
-	0x080c, 0x9664, 0x00fe, 0x009e, 0x00ce, 0x0005, 0x080c, 0xae47,
-	0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6, 0x7000, 0x908c,
-	0xff00, 0x9184, 0xf000, 0x810f, 0x9086, 0x2000, 0x1904, 0x838c,
-	0x9186, 0x0022, 0x15f0, 0x2001, 0x0111, 0x2004, 0x9005, 0x1904,
-	0x838e, 0x7030, 0x908e, 0x0400, 0x0904, 0x838e, 0x908e, 0x6000,
-	0x05e8, 0x908e, 0x5400, 0x05d0, 0x908e, 0x0300, 0x11d8, 0x2009,
-	0x1837, 0x210c, 0xd18c, 0x1590, 0xd1a4, 0x1580, 0x080c, 0x6928,
-	0x0558, 0x68b0, 0x9084, 0x00ff, 0x7100, 0x918c, 0x00ff, 0x9106,
-	0x1518, 0x6880, 0x69b0, 0x918c, 0xff00, 0x9105, 0x7104, 0x9106,
-	0x11d8, 0x00e0, 0x2009, 0x0103, 0x210c, 0xd1b4, 0x11a8, 0x908e,
-	0x5200, 0x09e8, 0x908e, 0x0500, 0x09d0, 0x908e, 0x5000, 0x09b8,
-	0x0058, 0x9186, 0x0023, 0x1140, 0x080c, 0x829c, 0x0128, 0x6004,
-	0x9086, 0x0002, 0x0118, 0x0000, 0x9006, 0x0010, 0x9085, 0x0001,
-	0x00ce, 0x0005, 0x0156, 0x0046, 0x0016, 0x0036, 0x7038, 0x2020,
-	0x8427, 0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004, 0x2019,
-	0x1805, 0x2011, 0x027a, 0x080c, 0xbdef, 0x1178, 0xd48c, 0x0148,
-	0x20a9, 0x0004, 0x2019, 0x1801, 0x2011, 0x027e, 0x080c, 0xbdef,
-	0x1120, 0xd494, 0x0110, 0x9085, 0x0001, 0x003e, 0x001e, 0x004e,
-	0x015e, 0x0005, 0x0156, 0x0046, 0x0016, 0x0036, 0x7038, 0x2020,
-	0x8427, 0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004, 0x2019,
-	0x1805, 0x2011, 0x0272, 0x080c, 0xbdef, 0x1178, 0xd48c, 0x0148,
-	0x20a9, 0x0004, 0x2019, 0x1801, 0x2011, 0x0276, 0x080c, 0xbdef,
-	0x1120, 0xd494, 0x0110, 0x9085, 0x0001, 0x003e, 0x001e, 0x004e,
-	0x015e, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7800, 0xc0e5, 0xc0cc,
-	0x7802, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x1800, 0x7834, 0xd084,
-	0x1130, 0x2079, 0x0200, 0x7800, 0x9085, 0x1200, 0x7802, 0x00fe,
-	0x0005, 0x00e6, 0x2071, 0x1800, 0x7034, 0xc084, 0x7036, 0x00ee,
-	0x0005, 0x2071, 0x19fa, 0x7003, 0x0003, 0x700f, 0x0361, 0x9006,
-	0x701a, 0x7072, 0x7012, 0x7017, 0x1cd0, 0x7007, 0x0000, 0x7026,
-	0x702b, 0xa26f, 0x7032, 0x7037, 0xa2dd, 0x703f, 0xffff, 0x7042,
-	0x7047, 0x556f, 0x704a, 0x705b, 0x856b, 0x080c, 0x1018, 0x090c,
-	0x0dd5, 0x2900, 0x703a, 0xa867, 0x0003, 0xa86f, 0x0100, 0xa8ab,
-	0xdcb0, 0x0005, 0x2071, 0x19fa, 0x1d04, 0x84b9, 0x2091, 0x6000,
-	0x700c, 0x8001, 0x700e, 0x1530, 0x2001, 0x013c, 0x2004, 0x9005,
-	0x190c, 0x85b0, 0x2001, 0x1869, 0x2004, 0xd0c4, 0x0158, 0x3a00,
-	0xd08c, 0x1140, 0x20d1, 0x0000, 0x20d1, 0x0001, 0x20d1, 0x0000,
-	0x080c, 0x0dd5, 0x700f, 0x0361, 0x7007, 0x0001, 0x0126, 0x2091,
-	0x8000, 0x7040, 0x900d, 0x0148, 0x8109, 0x7142, 0x1130, 0x7044,
-	0x080f, 0x0018, 0x0126, 0x2091, 0x8000, 0x7024, 0x900d, 0x0188,
-	0x7020, 0x8001, 0x7022, 0x1168, 0x7023, 0x0009, 0x8109, 0x7126,
-	0x9186, 0x03e8, 0x1110, 0x7028, 0x080f, 0x81ff, 0x1110, 0x7028,
-	0x080f, 0x7030, 0x900d, 0x0180, 0x702c, 0x8001, 0x702e, 0x1160,
-	0x702f, 0x0009, 0x8109, 0x7132, 0x0128, 0x9184, 0x007f, 0x090c,
-	0xa3fe, 0x0010, 0x7034, 0x080f, 0x703c, 0x9005, 0x0118, 0x0310,
-	0x8001, 0x703e, 0x704c, 0x900d, 0x0168, 0x7048, 0x8001, 0x704a,
-	0x1148, 0x704b, 0x0009, 0x8109, 0x714e, 0x1120, 0x7150, 0x714e,
-	0x7058, 0x080f, 0x7018, 0x900d, 0x01d8, 0x0016, 0x7070, 0x900d,
-	0x0158, 0x706c, 0x8001, 0x706e, 0x1138, 0x706f, 0x0009, 0x8109,
-	0x7172, 0x1110, 0x7074, 0x080f, 0x001e, 0x7008, 0x8001, 0x700a,
-	0x1138, 0x700b, 0x0009, 0x8109, 0x711a, 0x1110, 0x701c, 0x080f,
-	0x012e, 0x7004, 0x0002, 0x84e1, 0x84e2, 0x84fe, 0x00e6, 0x2071,
-	0x19fa, 0x7018, 0x9005, 0x1120, 0x711a, 0x721e, 0x700b, 0x0009,
-	0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071, 0x19fa, 0x701c, 0x9206,
-	0x1120, 0x701a, 0x701e, 0x7072, 0x7076, 0x000e, 0x00ee, 0x0005,
-	0x00e6, 0x2071, 0x19fa, 0xb888, 0x9102, 0x0208, 0xb98a, 0x00ee,
-	0x0005, 0x0005, 0x00b6, 0x7110, 0x080c, 0x6600, 0x1168, 0xb888,
-	0x8001, 0x0250, 0xb88a, 0x1140, 0x0126, 0x2091, 0x8000, 0x0016,
-	0x080c, 0x9664, 0x001e, 0x012e, 0x8108, 0x9182, 0x0800, 0x0218,
-	0x900e, 0x7007, 0x0002, 0x7112, 0x00be, 0x0005, 0x7014, 0x2060,
-	0x0126, 0x2091, 0x8000, 0x6040, 0x9005, 0x0128, 0x8001, 0x6042,
-	0x1110, 0x080c, 0xce21, 0x6018, 0x9005, 0x0558, 0x8001, 0x601a,
-	0x1540, 0x6120, 0x9186, 0x0003, 0x0148, 0x9186, 0x0006, 0x0130,
-	0x9186, 0x0009, 0x11e0, 0x611c, 0xd1c4, 0x1100, 0x080c, 0xcb1b,
-	0x01b0, 0x6014, 0x2048, 0xa884, 0x908a, 0x199a, 0x0280, 0x9082,
-	0x1999, 0xa886, 0x908a, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003,
-	0x800b, 0x810b, 0x9108, 0x611a, 0xa87c, 0xd0e4, 0x0110, 0x080c,
-	0xc819, 0x012e, 0x9c88, 0x0018, 0x7116, 0x2001, 0x181a, 0x2004,
-	0x9102, 0x0220, 0x7017, 0x1cd0, 0x7007, 0x0000, 0x0005, 0x00e6,
-	0x2071, 0x19fa, 0x7027, 0x07d0, 0x7023, 0x0009, 0x00ee, 0x0005,
-	0x2001, 0x1a03, 0x2003, 0x0000, 0x0005, 0x00e6, 0x2071, 0x19fa,
-	0x7132, 0x702f, 0x0009, 0x00ee, 0x0005, 0x2011, 0x1a06, 0x2013,
-	0x0000, 0x0005, 0x00e6, 0x2071, 0x19fa, 0x711a, 0x721e, 0x700b,
-	0x0009, 0x00ee, 0x0005, 0x0086, 0x0026, 0x7054, 0x8000, 0x7056,
-	0x2001, 0x1a08, 0x2044, 0xa06c, 0x9086, 0x0000, 0x0150, 0x7068,
-	0xa09a, 0x7064, 0xa096, 0x7060, 0xa092, 0x705c, 0xa08e, 0x080c,
-	0x10e9, 0x002e, 0x008e, 0x0005, 0x0006, 0x0016, 0x0096, 0x00a6,
-	0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x080c, 0x842a,
-	0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
-	0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x19fa, 0x7172, 0x7276,
-	0x706f, 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071, 0x19fa,
-	0x7074, 0x9206, 0x1110, 0x7072, 0x7076, 0x000e, 0x00ee, 0x0005,
-	0x0016, 0x00c6, 0x2009, 0xfffc, 0x210d, 0x2061, 0x0100, 0x60f0,
-	0x9100, 0x60f3, 0x0000, 0x2009, 0xfffc, 0x200f, 0x1220, 0x8108,
-	0x2105, 0x8000, 0x200f, 0x00ce, 0x001e, 0x0005, 0x00c6, 0x2061,
-	0x1a71, 0x00ce, 0x0005, 0x9184, 0x000f, 0x8003, 0x8003, 0x8003,
-	0x9080, 0x1a71, 0x2060, 0x0005, 0xa884, 0x908a, 0x199a, 0x1638,
-	0x9005, 0x1150, 0x00c6, 0x2061, 0x1a71, 0x6014, 0x00ce, 0x9005,
-	0x1130, 0x2001, 0x001e, 0x0018, 0x908e, 0xffff, 0x01b0, 0x8003,
-	0x800b, 0x810b, 0x9108, 0x611a, 0xa87c, 0x908c, 0x00c0, 0x918e,
-	0x00c0, 0x0904, 0x865e, 0xd0b4, 0x1168, 0xd0bc, 0x1904, 0x8637,
-	0x2009, 0x0006, 0x080c, 0x868b, 0x0005, 0x900e, 0x0c60, 0x2001,
-	0x1999, 0x08b0, 0xd0fc, 0x0160, 0x908c, 0x0003, 0x0120, 0x918e,
-	0x0003, 0x1904, 0x8685, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8,
-	0x6024, 0xd0d4, 0x11e8, 0x2009, 0x1869, 0x2104, 0xd084, 0x1138,
-	0x87ff, 0x1120, 0x2009, 0x0043, 0x0804, 0xaec2, 0x0005, 0x87ff,
-	0x1de8, 0x2009, 0x0042, 0x0804, 0xaec2, 0x6110, 0x00b6, 0x2158,
-	0xb900, 0x00be, 0xd1ac, 0x0d20, 0x6024, 0xc0cd, 0x6026, 0x0c00,
-	0xc0d4, 0x6026, 0xa890, 0x602e, 0xa88c, 0x6032, 0x08e0, 0xd0fc,
-	0x0160, 0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x8685,
-	0x908c, 0x2020, 0x918e, 0x2020, 0x0170, 0x0076, 0x00f6, 0x2c78,
-	0x080c, 0x1725, 0x00fe, 0x007e, 0x87ff, 0x1120, 0x2009, 0x0042,
-	0x080c, 0xaec2, 0x0005, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be,
-	0xd1ac, 0x0d58, 0x6124, 0xc1cd, 0x6126, 0x0c38, 0xd0fc, 0x0188,
-	0x908c, 0x2020, 0x918e, 0x2020, 0x01a8, 0x9084, 0x0003, 0x908e,
-	0x0002, 0x0148, 0x87ff, 0x1120, 0x2009, 0x0041, 0x080c, 0xaec2,
-	0x0005, 0x00b9, 0x0ce8, 0x87ff, 0x1dd8, 0x2009, 0x0043, 0x080c,
-	0xaec2, 0x0cb0, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac,
-	0x0d20, 0x6124, 0xc1cd, 0x6126, 0x0c00, 0x2009, 0x0004, 0x0019,
-	0x0005, 0x2009, 0x0001, 0x0096, 0x080c, 0xcb1b, 0x0518, 0x6014,
-	0x2048, 0xa982, 0xa800, 0x6016, 0x9186, 0x0001, 0x1188, 0xa97c,
-	0x918c, 0x8100, 0x918e, 0x8100, 0x1158, 0x00c6, 0x2061, 0x1a71,
-	0x6200, 0xd28c, 0x1120, 0x6204, 0x8210, 0x0208, 0x6206, 0x00ce,
-	0x080c, 0x6ab4, 0x6014, 0x904d, 0x0076, 0x2039, 0x0000, 0x190c,
-	0x85d4, 0x007e, 0x009e, 0x0005, 0x0156, 0x00c6, 0x2061, 0x1a71,
-	0x6000, 0x81ff, 0x0110, 0x9205, 0x0008, 0x9204, 0x6002, 0x00ce,
-	0x015e, 0x0005, 0x6800, 0xd08c, 0x1138, 0x6808, 0x9005, 0x0120,
-	0x8001, 0x680a, 0x9085, 0x0001, 0x0005, 0x2071, 0x1923, 0x7003,
-	0x0006, 0x7007, 0x0000, 0x700f, 0x0000, 0x7013, 0x0001, 0x080c,
-	0x1018, 0x090c, 0x0dd5, 0xa867, 0x0006, 0xa86b, 0x0001, 0xa8ab,
-	0xdcb0, 0xa89f, 0x0000, 0x2900, 0x702e, 0x7033, 0x0000, 0x0005,
-	0x0096, 0x00e6, 0x2071, 0x1923, 0x702c, 0x2048, 0x6a2c, 0x721e,
-	0x6b30, 0x7322, 0x6834, 0x7026, 0xa896, 0x6838, 0x702a, 0xa89a,
-	0x6824, 0x7016, 0x683c, 0x701a, 0x2009, 0x0028, 0x200a, 0x9005,
-	0x0148, 0x900e, 0x9188, 0x000c, 0x8001, 0x1de0, 0x2100, 0x9210,
-	0x1208, 0x8318, 0xaa8e, 0xab92, 0x7010, 0xd084, 0x0178, 0xc084,
-	0x7007, 0x0001, 0x700f, 0x0000, 0x0006, 0x2009, 0x181d, 0x2104,
-	0x9082, 0x0007, 0x2009, 0x1ac8, 0x200a, 0x000e, 0xc095, 0x7012,
-	0x2008, 0x2001, 0x003b, 0x080c, 0x15ee, 0x9006, 0x2071, 0x193c,
-	0x7002, 0x7006, 0x702a, 0x00ee, 0x009e, 0x0005, 0x00e6, 0x0126,
-	0x0156, 0x2091, 0x8000, 0x2071, 0x1800, 0x7154, 0x2001, 0x0008,
-	0x910a, 0x0638, 0x2001, 0x187d, 0x20ac, 0x9006, 0x9080, 0x0008,
-	0x1f04, 0x873e, 0x71c0, 0x9102, 0x02e0, 0x2071, 0x1877, 0x20a9,
-	0x0007, 0x00c6, 0x080c, 0xadf1, 0x6023, 0x0009, 0x6003, 0x0004,
-	0x601f, 0x0101, 0x0089, 0x0126, 0x2091, 0x8000, 0x080c, 0x88c4,
-	0x012e, 0x1f04, 0x874a, 0x9006, 0x00ce, 0x015e, 0x012e, 0x00ee,
-	0x0005, 0x9085, 0x0001, 0x0cc8, 0x00e6, 0x00b6, 0x0096, 0x0086,
-	0x0056, 0x0046, 0x0026, 0x7118, 0x720c, 0x7620, 0x7004, 0xd084,
-	0x1128, 0x2021, 0x0024, 0x2029, 0x0002, 0x0020, 0x2021, 0x002c,
-	0x2029, 0x000a, 0x080c, 0x0fff, 0x090c, 0x0dd5, 0x2900, 0x6016,
-	0x2058, 0xac66, 0x9006, 0xa802, 0xa806, 0xa86a, 0xa87a, 0xa8aa,
-	0xa887, 0x0005, 0xa87f, 0x0020, 0x7008, 0xa89a, 0x7010, 0xa89e,
-	0xae8a, 0xa8af, 0xffff, 0xa8b3, 0x0000, 0x8109, 0x0160, 0x080c,
-	0x0fff, 0x090c, 0x0dd5, 0xad66, 0x2b00, 0xa802, 0x2900, 0xb806,
-	0x2058, 0x8109, 0x1da0, 0x002e, 0x004e, 0x005e, 0x008e, 0x009e,
-	0x00be, 0x00ee, 0x0005, 0x2079, 0x0000, 0x2071, 0x1923, 0x7004,
-	0x004b, 0x700c, 0x0002, 0x87b6, 0x87af, 0x87af, 0x0005, 0x87c0,
-	0x8821, 0x8821, 0x8821, 0x8822, 0x8833, 0x8833, 0x700c, 0x0cba,
-	0x0126, 0x2091, 0x8000, 0x78a0, 0x79a0, 0x9106, 0x0128, 0x78a0,
-	0x79a0, 0x9106, 0x1904, 0x8814, 0x2001, 0x0005, 0x2004, 0xd0bc,
-	0x0130, 0x2011, 0x0004, 0x2204, 0xc0c5, 0x2012, 0x0ca8, 0x012e,
-	0x7018, 0x910a, 0x1130, 0x7030, 0x9005, 0x05a8, 0x080c, 0x8862,
-	0x0490, 0x1210, 0x7114, 0x910a, 0x9192, 0x000a, 0x0210, 0x2009,
-	0x000a, 0x2001, 0x1888, 0x2014, 0x2001, 0x1935, 0x2004, 0x9100,
-	0x9202, 0x0e48, 0x080c, 0x89ae, 0x2200, 0x9102, 0x0208, 0x2208,
-	0x0096, 0x702c, 0x2048, 0xa873, 0x0001, 0xa976, 0x080c, 0x8ab7,
-	0x2100, 0xa87e, 0xa86f, 0x0000, 0x009e, 0x0126, 0x2091, 0x8000,
-	0x2009, 0x1a18, 0x2104, 0xc085, 0x200a, 0x700f, 0x0002, 0x012e,
-	0x080c, 0x1108, 0x1de8, 0x0005, 0x2001, 0x0005, 0x2004, 0xd0bc,
-	0x0130, 0x2011, 0x0004, 0x2204, 0xc0c5, 0x2012, 0x0ca8, 0x012e,
-	0x0005, 0x0005, 0x700c, 0x0002, 0x8827, 0x882a, 0x8829, 0x080c,
-	0x87be, 0x0005, 0x8001, 0x700e, 0x0096, 0x702c, 0x2048, 0xa974,
-	0x009e, 0x0011, 0x0ca0, 0x0005, 0x0096, 0x702c, 0x2048, 0x7018,
-	0x9100, 0x7214, 0x921a, 0x1130, 0x701c, 0xa88e, 0x7020, 0xa892,
-	0x9006, 0x0068, 0x0006, 0x080c, 0x8ab7, 0x2100, 0xaa8c, 0x9210,
-	0xaa8e, 0x1220, 0xa890, 0x9081, 0x0000, 0xa892, 0x000e, 0x009e,
-	0x2f08, 0x9188, 0x0028, 0x200a, 0x701a, 0x0005, 0x00e6, 0x2071,
-	0x1923, 0x700c, 0x0002, 0x8860, 0x8860, 0x885e, 0x700f, 0x0001,
-	0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x7030, 0x9005, 0x0508,
-	0x2078, 0x7814, 0x2048, 0xae88, 0x00b6, 0x2059, 0x0000, 0x080c,
-	0x88cd, 0x00be, 0x01b0, 0x00e6, 0x2071, 0x193c, 0x080c, 0x8914,
-	0x00ee, 0x0178, 0x0096, 0x080c, 0x1018, 0x2900, 0x009e, 0x0148,
-	0xa8aa, 0x04b9, 0x0041, 0x2001, 0x1946, 0x2003, 0x0000, 0x012e,
-	0x08c8, 0x012e, 0x0005, 0x00d6, 0x00c6, 0x0086, 0x00a6, 0x2940,
-	0x2650, 0x2600, 0x9005, 0x0180, 0xa864, 0x9084, 0x000f, 0x2068,
-	0x9d88, 0x2090, 0x2165, 0x0056, 0x2029, 0x0000, 0x080c, 0x8a3c,
-	0x080c, 0x2048, 0x1dd8, 0x005e, 0x00ae, 0x2001, 0x187f, 0x2004,
-	0xa88a, 0x080c, 0x1725, 0x781f, 0x0101, 0x7813, 0x0000, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x8923, 0x012e, 0x008e, 0x00ce, 0x00de,
-	0x0005, 0x7030, 0x9005, 0x0138, 0x2078, 0x780c, 0x7032, 0x2001,
-	0x1946, 0x2003, 0x0001, 0x0005, 0x00e6, 0x2071, 0x1923, 0x7030,
-	0x600e, 0x2c00, 0x7032, 0x00ee, 0x0005, 0x00d6, 0x00c6, 0x0026,
-	0x9b80, 0x8b96, 0x2005, 0x906d, 0x090c, 0x0dd5, 0x9b80, 0x8b8e,
-	0x2005, 0x9065, 0x090c, 0x0dd5, 0x6114, 0x2600, 0x9102, 0x0248,
-	0x6828, 0x9102, 0x02f0, 0x9085, 0x0001, 0x002e, 0x00ce, 0x00de,
-	0x0005, 0x6804, 0xd094, 0x0148, 0x6854, 0xd084, 0x1178, 0xc085,
-	0x6856, 0x2011, 0x8026, 0x080c, 0x4b05, 0x684c, 0x0096, 0x904d,
-	0x090c, 0x0dd5, 0xa804, 0x8000, 0xa806, 0x009e, 0x9006, 0x2030,
-	0x0c20, 0x6854, 0xd08c, 0x1d08, 0xc08d, 0x6856, 0x2011, 0x8025,
-	0x080c, 0x4b05, 0x684c, 0x0096, 0x904d, 0x090c, 0x0dd5, 0xa800,
-	0x8000, 0xa802, 0x009e, 0x0888, 0x7000, 0x2019, 0x0008, 0x8319,
-	0x7104, 0x9102, 0x1118, 0x2300, 0x9005, 0x0020, 0x0210, 0x9302,
-	0x0008, 0x8002, 0x0005, 0x00d6, 0x7814, 0x9005, 0x090c, 0x0dd5,
-	0x781c, 0x9084, 0x0101, 0x9086, 0x0101, 0x190c, 0x0dd5, 0x2069,
-	0x193c, 0x6804, 0x9080, 0x193e, 0x2f08, 0x2102, 0x6904, 0x8108,
-	0x9182, 0x0008, 0x0208, 0x900e, 0x6906, 0x9180, 0x193e, 0x2003,
-	0x0000, 0x00de, 0x0005, 0x0096, 0x00c6, 0x2060, 0x6014, 0x2048,
-	0xa8a8, 0x0096, 0x2048, 0x9005, 0x190c, 0x1031, 0x009e, 0xa8ab,
-	0x0000, 0x080c, 0x0fb1, 0x080c, 0xae47, 0x00ce, 0x009e, 0x0005,
-	0x6020, 0x9086, 0x0009, 0x1128, 0x601c, 0xd0c4, 0x0110, 0x9006,
-	0x0005, 0x9085, 0x0001, 0x0005, 0x6000, 0x9086, 0x0000, 0x0178,
-	0x6010, 0x9005, 0x0150, 0x00b6, 0x2058, 0x080c, 0x8cc9, 0x00be,
-	0x6013, 0x0000, 0x601b, 0x0000, 0x0010, 0x2c00, 0x0861, 0x0005,
-	0x2009, 0x1927, 0x210c, 0xd194, 0x0005, 0x00e6, 0x2071, 0x1923,
-	0x7110, 0xc194, 0xd19c, 0x1118, 0xc185, 0x7007, 0x0000, 0x7112,
-	0x2001, 0x003b, 0x080c, 0x15ee, 0x00ee, 0x0005, 0x0096, 0x00d6,
-	0x9006, 0x7006, 0x700e, 0x701a, 0x701e, 0x7022, 0x7016, 0x702a,
-	0x7026, 0x702f, 0x0000, 0x080c, 0x8b16, 0x0170, 0x080c, 0x8b4b,
-	0x0158, 0x2900, 0x7002, 0x700a, 0x701a, 0x7013, 0x0001, 0x701f,
-	0x000a, 0x00de, 0x009e, 0x0005, 0x900e, 0x0cd8, 0x00e6, 0x0096,
-	0x0086, 0x00d6, 0x00c6, 0x2071, 0x1930, 0x721c, 0x2100, 0x9202,
-	0x1618, 0x080c, 0x8b4b, 0x090c, 0x0dd5, 0x7018, 0x9005, 0x1160,
-	0x2900, 0x7002, 0x700a, 0x701a, 0x9006, 0x7006, 0x700e, 0xa806,
-	0xa802, 0x7012, 0x701e, 0x0038, 0x2040, 0xa806, 0x2900, 0xa002,
-	0x701a, 0xa803, 0x0000, 0x7010, 0x8000, 0x7012, 0x701c, 0x9080,
-	0x000a, 0x701e, 0x721c, 0x08d0, 0x721c, 0x00ce, 0x00de, 0x008e,
-	0x009e, 0x00ee, 0x0005, 0x0096, 0x0156, 0x0136, 0x0146, 0x00e6,
-	0x0126, 0x2091, 0x8000, 0x2071, 0x1930, 0x7300, 0x831f, 0x831e,
-	0x831e, 0x9384, 0x003f, 0x20e8, 0x939c, 0xffc0, 0x9398, 0x0003,
-	0x7104, 0x080c, 0x8ab7, 0x810c, 0x2100, 0x9318, 0x8003, 0x2228,
-	0x2021, 0x0078, 0x9402, 0x9532, 0x0208, 0x2028, 0x2500, 0x8004,
-	0x20a8, 0x23a0, 0xa001, 0xa001, 0x4005, 0x2508, 0x080c, 0x8ac0,
-	0x2130, 0x7014, 0x9600, 0x7016, 0x2600, 0x711c, 0x9102, 0x701e,
-	0x7004, 0x9600, 0x2008, 0x9082, 0x000a, 0x1190, 0x7000, 0x2048,
-	0xa800, 0x9005, 0x1148, 0x2009, 0x0001, 0x0026, 0x080c, 0x89ae,
-	0x002e, 0x7000, 0x2048, 0xa800, 0x7002, 0x7007, 0x0000, 0x0008,
-	0x7106, 0x2500, 0x9212, 0x1904, 0x89ed, 0x012e, 0x00ee, 0x014e,
-	0x013e, 0x015e, 0x009e, 0x0005, 0x0016, 0x0026, 0x00e6, 0x0126,
-	0x2091, 0x8000, 0x9580, 0x8b8e, 0x2005, 0x9075, 0x090c, 0x0dd5,
-	0x080c, 0x8a92, 0x012e, 0x9580, 0x8b8a, 0x2005, 0x9075, 0x090c,
-	0x0dd5, 0x0156, 0x0136, 0x01c6, 0x0146, 0x01d6, 0x831f, 0x831e,
-	0x831e, 0x9384, 0x003f, 0x20e0, 0x9384, 0xffc0, 0x9100, 0x2098,
-	0xa860, 0x20e8, 0xa95c, 0x2c05, 0x9100, 0x20a0, 0x20a9, 0x0002,
-	0x4003, 0x2e0c, 0x2d00, 0x0002, 0x8a7c, 0x8a7c, 0x8a7e, 0x8a7c,
-	0x8a7e, 0x8a7c, 0x8a7c, 0x8a7c, 0x8a7c, 0x8a7c, 0x8a84, 0x8a7c,
-	0x8a84, 0x8a7c, 0x8a7c, 0x8a7c, 0x080c, 0x0dd5, 0x4104, 0x20a9,
-	0x0002, 0x4002, 0x4003, 0x0028, 0x20a9, 0x0002, 0x4003, 0x4104,
-	0x4003, 0x01de, 0x014e, 0x01ce, 0x013e, 0x015e, 0x00ee, 0x002e,
-	0x001e, 0x0005, 0x0096, 0x7014, 0x8001, 0x7016, 0x710c, 0x2110,
-	0x00f1, 0x810c, 0x9188, 0x0003, 0x7308, 0x8210, 0x9282, 0x000a,
-	0x1198, 0x7008, 0x2048, 0xa800, 0x9005, 0x0158, 0x0006, 0x080c,
-	0x8b5a, 0x009e, 0xa807, 0x0000, 0x2900, 0x700a, 0x7010, 0x8001,
-	0x7012, 0x700f, 0x0000, 0x0008, 0x720e, 0x009e, 0x0005, 0x0006,
-	0x810b, 0x810b, 0x2100, 0x810b, 0x9100, 0x2008, 0x000e, 0x0005,
-	0x0006, 0x0026, 0x2100, 0x9005, 0x0158, 0x9092, 0x000c, 0x0240,
-	0x900e, 0x8108, 0x9082, 0x000c, 0x1de0, 0x002e, 0x000e, 0x0005,
-	0x900e, 0x0cd8, 0x2d00, 0x90b8, 0x0008, 0x690c, 0x6810, 0x2019,
-	0x0001, 0x2031, 0x8b00, 0x9112, 0x0220, 0x0118, 0x8318, 0x2208,
-	0x0cd0, 0x6808, 0x9005, 0x0108, 0x8318, 0x233a, 0x6804, 0xd084,
-	0x2300, 0x2021, 0x0001, 0x1150, 0x9082, 0x0003, 0x0967, 0x0a67,
-	0x8420, 0x9082, 0x0007, 0x0967, 0x0a67, 0x0cd0, 0x9082, 0x0002,
-	0x0967, 0x0a67, 0x8420, 0x9082, 0x0005, 0x0967, 0x0a67, 0x0cd0,
-	0x6c1a, 0x2d00, 0x90b8, 0x0007, 0x00e6, 0x2071, 0x1800, 0x7128,
-	0x6810, 0x2019, 0x0001, 0x910a, 0x0118, 0x0210, 0x8318, 0x0cd8,
-	0x2031, 0x8b13, 0x0870, 0x6c16, 0x00ee, 0x0005, 0x0096, 0x0046,
-	0x0126, 0x2091, 0x8000, 0x2b00, 0x9080, 0x8b92, 0x2005, 0x9005,
-	0x090c, 0x0dd5, 0x2004, 0x90a0, 0x000a, 0x080c, 0x1018, 0x01d0,
-	0x2900, 0x7026, 0xa803, 0x0000, 0xa807, 0x0000, 0x080c, 0x1018,
-	0x0188, 0x7024, 0xa802, 0xa807, 0x0000, 0x2900, 0x7026, 0x94a2,
-	0x000a, 0x0110, 0x0208, 0x0c90, 0x9085, 0x0001, 0x012e, 0x004e,
-	0x009e, 0x0005, 0x7024, 0x9005, 0x0dc8, 0x2048, 0xac00, 0x080c,
-	0x1031, 0x2400, 0x0cc0, 0x0126, 0x2091, 0x8000, 0x7024, 0x2048,
-	0x9005, 0x0130, 0xa800, 0x7026, 0xa803, 0x0000, 0xa807, 0x0000,
-	0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x7024, 0xa802, 0x2900,
-	0x7026, 0x012e, 0x0005, 0x0096, 0x9e80, 0x0009, 0x2004, 0x9005,
-	0x0138, 0x2048, 0xa800, 0x0006, 0x080c, 0x1031, 0x000e, 0x0cb8,
-	0x009e, 0x0005, 0x0096, 0x7008, 0x9005, 0x0138, 0x2048, 0xa800,
-	0x0006, 0x080c, 0x1031, 0x000e, 0x0cb8, 0x9006, 0x7002, 0x700a,
-	0x7006, 0x700e, 0x701a, 0x701e, 0x7022, 0x702a, 0x7026, 0x702e,
-	0x009e, 0x0005, 0x1a64, 0x0000, 0x0000, 0x0000, 0x1930, 0x0000,
-	0x0000, 0x0000, 0x1888, 0x0000, 0x0000, 0x0000, 0x1877, 0x0000,
-	0x0000, 0x0000, 0x00e6, 0x00c6, 0x00b6, 0x00a6, 0xa8a8, 0x2040,
-	0x2071, 0x1877, 0x080c, 0x8cb4, 0xa067, 0x0023, 0x6010, 0x905d,
-	0x0904, 0x8c89, 0xb814, 0xa06e, 0xb910, 0xa172, 0xb9a0, 0xa176,
-	0x2001, 0x0003, 0xa07e, 0xa834, 0xa082, 0xa07b, 0x0000, 0xa898,
-	0x9005, 0x0118, 0xa078, 0xc085, 0xa07a, 0x2858, 0x2031, 0x0018,
-	0xa068, 0x908a, 0x0019, 0x1a0c, 0x0dd5, 0x2020, 0x2050, 0x2940,
-	0xa864, 0x90bc, 0x00ff, 0x908c, 0x000f, 0x91e0, 0x2090, 0x2c65,
-	0x9786, 0x0024, 0x2c05, 0x1590, 0x908a, 0x0036, 0x1a0c, 0x0dd5,
-	0x9082, 0x001b, 0x0002, 0x8bf6, 0x8bf6, 0x8bf8, 0x8bf6, 0x8bf6,
-	0x8bf6, 0x8bfa, 0x8bf6, 0x8bf6, 0x8bf6, 0x8bfc, 0x8bf6, 0x8bf6,
-	0x8bf6, 0x8bfe, 0x8bf6, 0x8bf6, 0x8bf6, 0x8c00, 0x8bf6, 0x8bf6,
-	0x8bf6, 0x8c02, 0x8bf6, 0x8bf6, 0x8bf6, 0x8c04, 0x080c, 0x0dd5,
-	0xa180, 0x04b8, 0xa190, 0x04a8, 0xa1a0, 0x0498, 0xa1b0, 0x0488,
-	0xa1c0, 0x0478, 0xa1d0, 0x0468, 0xa1e0, 0x0458, 0x908a, 0x0034,
-	0x1a0c, 0x0dd5, 0x9082, 0x001b, 0x0002, 0x8c28, 0x8c26, 0x8c26,
-	0x8c26, 0x8c26, 0x8c26, 0x8c2a, 0x8c26, 0x8c26, 0x8c26, 0x8c26,
-	0x8c26, 0x8c2c, 0x8c26, 0x8c26, 0x8c26, 0x8c26, 0x8c26, 0x8c2e,
-	0x8c26, 0x8c26, 0x8c26, 0x8c26, 0x8c26, 0x8c30, 0x080c, 0x0dd5,
-	0xa180, 0x0038, 0xa198, 0x0028, 0xa1b0, 0x0018, 0xa1c8, 0x0008,
-	0xa1e0, 0x2600, 0x0002, 0x8c4c, 0x8c4e, 0x8c50, 0x8c52, 0x8c54,
-	0x8c56, 0x8c58, 0x8c5a, 0x8c5c, 0x8c5e, 0x8c60, 0x8c62, 0x8c64,
-	0x8c66, 0x8c68, 0x8c6a, 0x8c6c, 0x8c6e, 0x8c70, 0x8c72, 0x8c74,
-	0x8c76, 0x8c78, 0x8c7a, 0x8c7c, 0x080c, 0x0dd5, 0xb9e2, 0x0468,
-	0xb9de, 0x0458, 0xb9da, 0x0448, 0xb9d6, 0x0438, 0xb9d2, 0x0428,
-	0xb9ce, 0x0418, 0xb9ca, 0x0408, 0xb9c6, 0x00f8, 0xb9c2, 0x00e8,
-	0xb9be, 0x00d8, 0xb9ba, 0x00c8, 0xb9b6, 0x00b8, 0xb9b2, 0x00a8,
-	0xb9ae, 0x0098, 0xb9aa, 0x0088, 0xb9a6, 0x0078, 0xb9a2, 0x0068,
-	0xb99e, 0x0058, 0xb99a, 0x0048, 0xb996, 0x0038, 0xb992, 0x0028,
-	0xb98e, 0x0018, 0xb98a, 0x0008, 0xb986, 0x8631, 0x8421, 0x0120,
-	0x080c, 0x2048, 0x0804, 0x8bd0, 0x00ae, 0x00be, 0x00ce, 0x00ee,
-	0x0005, 0xa86c, 0xa06e, 0xa870, 0xa072, 0xa077, 0x00ff, 0x9006,
-	0x0804, 0x8bb2, 0x0006, 0x0016, 0x00b6, 0x6010, 0x2058, 0xb810,
-	0x9005, 0x01b0, 0x2001, 0x1924, 0x2004, 0x9005, 0x0188, 0x2001,
-	0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0xbba0,
-	0x2021, 0x0004, 0x2011, 0x8014, 0x080c, 0x4b05, 0x004e, 0x003e,
-	0x00be, 0x001e, 0x000e, 0x0005, 0x9016, 0x710c, 0xa834, 0x910a,
-	0xa936, 0x7008, 0x9005, 0x0120, 0x8210, 0x910a, 0x0238, 0x0130,
-	0x7010, 0x8210, 0x910a, 0x0210, 0x0108, 0x0cd8, 0xaa8a, 0xa26a,
-	0x0005, 0x00f6, 0x00d6, 0x0036, 0x2079, 0x0300, 0x781b, 0x0200,
-	0x7818, 0xd094, 0x1dd8, 0x781b, 0x0202, 0xa001, 0xa001, 0x7818,
-	0xd094, 0x1da0, 0xb8ac, 0x9005, 0x01b8, 0x2068, 0x2079, 0x0000,
-	0x2c08, 0x911e, 0x1118, 0x680c, 0xb8ae, 0x0060, 0x9106, 0x0140,
-	0x2d00, 0x2078, 0x680c, 0x9005, 0x090c, 0x0dd5, 0x2068, 0x0cb0,
-	0x6b0c, 0x7b0e, 0x600f, 0x0000, 0x2079, 0x0300, 0x781b, 0x0200,
-	0x003e, 0x00de, 0x00fe, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x00c6,
-	0x0036, 0x0126, 0x2091, 0x8000, 0x0156, 0x20a9, 0x01ff, 0x2071,
-	0x0300, 0x701b, 0x0200, 0x7018, 0xd094, 0x0110, 0x1f04, 0x8d09,
-	0x701b, 0x0202, 0xa001, 0xa001, 0x7018, 0xd094, 0x1d90, 0xb8ac,
-	0x9005, 0x01d0, 0x2060, 0x600c, 0xb8ae, 0x6003, 0x0004, 0x601b,
-	0x0000, 0x6013, 0x0000, 0x601f, 0x0101, 0x6014, 0x2048, 0xa88b,
-	0x0000, 0xa8a8, 0xa8ab, 0x0000, 0x904d, 0x090c, 0x0dd5, 0x080c,
-	0x1031, 0x080c, 0x88c4, 0x0c18, 0x2071, 0x0300, 0x701b, 0x0200,
-	0x015e, 0x012e, 0x003e, 0x00ce, 0x009e, 0x00de, 0x00ee, 0x0005,
-	0x00c6, 0x00b6, 0x0016, 0x0006, 0x0156, 0x080c, 0x283e, 0x015e,
-	0x11b0, 0x080c, 0x659f, 0x190c, 0x0dd5, 0x000e, 0x001e, 0xb912,
-	0xb816, 0x080c, 0xadf1, 0x0140, 0x2b00, 0x6012, 0x6023, 0x0001,
-	0x2009, 0x0001, 0x080c, 0xaec2, 0x00be, 0x00ce, 0x0005, 0x000e,
-	0x001e, 0x0cd0, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0dd5,
-	0x0013, 0x006e, 0x0005, 0x8d7b, 0x8d7b, 0x8d7b, 0x8d7d, 0x8dce,
-	0x8d7b, 0x8d7b, 0x8d7b, 0x8e31, 0x8d7b, 0x8e6e, 0x8d7b, 0x8d7b,
-	0x8d7b, 0x8d7b, 0x8d7b, 0x080c, 0x0dd5, 0x9182, 0x0040, 0x0002,
-	0x8d90, 0x8d90, 0x8d90, 0x8d90, 0x8d90, 0x8d90, 0x8d90, 0x8d90,
-	0x8d90, 0x8d92, 0x8da7, 0x8d90, 0x8d90, 0x8d90, 0x8d90, 0x8dba,
-	0x080c, 0x0dd5, 0x0096, 0x080c, 0x9614, 0x080c, 0x9790, 0x6114,
-	0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500,
-	0x00be, 0x080c, 0x6a7f, 0x080c, 0xae47, 0x009e, 0x0005, 0x080c,
-	0x9614, 0x00d6, 0x6114, 0x080c, 0xcb1b, 0x0130, 0x0096, 0x6114,
-	0x2148, 0x080c, 0x6c79, 0x009e, 0x00de, 0x080c, 0xae47, 0x080c,
-	0x9790, 0x0005, 0x080c, 0x9614, 0x080c, 0x31bc, 0x6114, 0x0096,
-	0x2148, 0x080c, 0xcb1b, 0x0120, 0xa87b, 0x0029, 0x080c, 0x6c79,
-	0x009e, 0x080c, 0xae47, 0x080c, 0x9790, 0x0005, 0x601b, 0x0000,
-	0x9182, 0x0040, 0x0096, 0x0002, 0x8de9, 0x8de9, 0x8de9, 0x8de9,
-	0x8de9, 0x8de9, 0x8de9, 0x8de9, 0x8deb, 0x8de9, 0x8de9, 0x8de9,
-	0x8e2d, 0x8de9, 0x8de9, 0x8de9, 0x8de9, 0x8de9, 0x8de9, 0x8df1,
-	0x8de9, 0x080c, 0x0dd5, 0x6114, 0x2148, 0xa938, 0x918e, 0xffff,
-	0x05e0, 0x00e6, 0x6114, 0x2148, 0x080c, 0x8b9a, 0x0096, 0xa8a8,
-	0x2048, 0x080c, 0x6a17, 0x009e, 0xa8ab, 0x0000, 0x6010, 0x9005,
-	0x0128, 0x00b6, 0x2058, 0x080c, 0x8cc9, 0x00be, 0xae88, 0x00b6,
-	0x2059, 0x0000, 0x080c, 0x88cd, 0x00be, 0x01e0, 0x2071, 0x193c,
-	0x080c, 0x8914, 0x01b8, 0x9086, 0x0001, 0x1128, 0x2001, 0x1946,
-	0x2004, 0x9005, 0x1178, 0x0096, 0x080c, 0x0fff, 0x2900, 0x009e,
-	0x0148, 0xa8aa, 0x00f6, 0x2c78, 0x080c, 0x888b, 0x00fe, 0x00ee,
-	0x009e, 0x0005, 0x080c, 0x88c4, 0x0cd0, 0x080c, 0x8edb, 0x009e,
-	0x0005, 0x9182, 0x0040, 0x0096, 0x0002, 0x8e45, 0x8e45, 0x8e45,
-	0x8e47, 0x8e45, 0x8e45, 0x8e45, 0x8e6c, 0x8e45, 0x8e45, 0x8e45,
-	0x8e45, 0x8e45, 0x8e45, 0x8e45, 0x8e45, 0x080c, 0x0dd5, 0x6003,
-	0x0003, 0x6106, 0x6014, 0x2048, 0xa8ac, 0xa846, 0xa8b0, 0xa84a,
-	0xa837, 0x0000, 0xa83b, 0x0000, 0xa884, 0x9092, 0x199a, 0x0210,
-	0x2001, 0x1999, 0x8003, 0x8013, 0x8213, 0x9210, 0x621a, 0x2c10,
-	0x080c, 0x1bad, 0x080c, 0x912c, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x9790, 0x012e, 0x009e, 0x0005, 0x080c, 0x0dd5, 0x080c, 0x9614,
-	0x080c, 0x9790, 0x6114, 0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6,
-	0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6c79, 0x080c, 0xae47,
-	0x009e, 0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x0096,
-	0x0013, 0x009e, 0x0005, 0x8e9b, 0x8e9b, 0x8e9b, 0x8e9d, 0x8eae,
-	0x8e9b, 0x8e9b, 0x8e9b, 0x8e9b, 0x8e9b, 0x8e9b, 0x8e9b, 0x8e9b,
-	0x8e9b, 0x8e9b, 0x8e9b, 0x080c, 0x0dd5, 0x080c, 0xa7b2, 0x6114,
-	0x2148, 0xa87b, 0x0006, 0x6010, 0x00b6, 0x2058, 0xb8bb, 0x0500,
-	0x00be, 0x080c, 0x6c79, 0x080c, 0xae47, 0x0005, 0x0461, 0x0005,
-	0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x0096, 0x0013, 0x009e,
-	0x0005, 0x8ec9, 0x8ec9, 0x8ec9, 0x8ecb, 0x8edb, 0x8ec9, 0x8ec9,
-	0x8ec9, 0x8ec9, 0x8ec9, 0x8ec9, 0x8ec9, 0x8ec9, 0x8ec9, 0x8ec9,
-	0x8ec9, 0x080c, 0x0dd5, 0x0036, 0x00e6, 0x2071, 0x19e7, 0x703c,
-	0x9c06, 0x1120, 0x2019, 0x0000, 0x080c, 0xa59c, 0x080c, 0xa7b2,
-	0x00ee, 0x003e, 0x0005, 0x00f6, 0x00e6, 0x601b, 0x0000, 0x6014,
-	0x2048, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058, 0x080c, 0x8cc9,
-	0x00be, 0x2071, 0x193c, 0x080c, 0x8914, 0x0160, 0x2001, 0x187f,
-	0x2004, 0xa88a, 0x2031, 0x0000, 0x2c78, 0x080c, 0x888b, 0x00ee,
-	0x00fe, 0x0005, 0x0096, 0xa88b, 0x0000, 0xa8a8, 0x2048, 0x080c,
-	0x1031, 0x009e, 0xa8ab, 0x0000, 0x080c, 0x88c4, 0x0c80, 0x0000,
+	0x0046, 0x080c, 0xaedc, 0x7817, 0x0140, 0x2001, 0x19f0, 0x2004,
+	0x9005, 0x090c, 0x968d, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x9484,
+	0x0fff, 0x0904, 0x81d1, 0x7110, 0xd1bc, 0x1904, 0x81d1, 0x7108,
+	0x700c, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094, 0xff00, 0x15b0,
+	0x81ff, 0x15a0, 0x9080, 0x3325, 0x200d, 0x918c, 0xff00, 0x810f,
+	0x2001, 0x0080, 0x9106, 0x0904, 0x81d1, 0x080c, 0x659e, 0x1904,
+	0x81d1, 0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15d8, 0xba04, 0x9294,
+	0xff00, 0x9286, 0x0600, 0x11a0, 0x080c, 0xae0b, 0x05e8, 0x2b08,
+	0x7028, 0x604a, 0x702c, 0x6046, 0x6112, 0x6023, 0x0006, 0x7120,
+	0x610a, 0x7130, 0x6156, 0x2009, 0x0044, 0x080c, 0xdb63, 0x0408,
+	0x080c, 0x6972, 0x1138, 0xb807, 0x0606, 0x0c30, 0x190c, 0x80be,
+	0x11c0, 0x0898, 0x080c, 0xae0b, 0x2b08, 0x0198, 0x6112, 0x6023,
+	0x0004, 0x7120, 0x610a, 0x9286, 0x0400, 0x1118, 0x6007, 0x0005,
+	0x0010, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9138, 0x080c,
+	0x968d, 0x7817, 0x0140, 0x2001, 0x19f0, 0x2004, 0x9005, 0x090c,
+	0x968d, 0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0ec,
+	0x0120, 0x2011, 0x8049, 0x080c, 0x4b04, 0x080c, 0xaeaf, 0x0d48,
+	0x2b08, 0x6112, 0x6023, 0x0006, 0x7120, 0x610a, 0x7130, 0x6156,
+	0x6017, 0xf300, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x08b0, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7020,
+	0x2060, 0x9c84, 0x0007, 0x11c0, 0x9c82, 0x1cd0, 0x02a8, 0x6868,
+	0x9c02, 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910,
+	0x9106, 0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124, 0x610a,
+	0x2009, 0x0045, 0x080c, 0xaedc, 0x7817, 0x0140, 0x2001, 0x19f0,
+	0x2004, 0x9005, 0x090c, 0x968d, 0x00be, 0x0005, 0x6120, 0x9186,
+	0x0002, 0x0128, 0x9186, 0x0005, 0x0110, 0x9085, 0x0001, 0x0005,
+	0x080c, 0x32e3, 0x1168, 0x7010, 0x9084, 0xff00, 0x8007, 0x9086,
+	0x0000, 0x1130, 0x9184, 0x000f, 0x908a, 0x0006, 0x1208, 0x000b,
+	0x0005, 0x8247, 0x8248, 0x8247, 0x8247, 0x82a7, 0x82b6, 0x0005,
+	0x00b6, 0x7110, 0xd1bc, 0x0120, 0x702c, 0xd084, 0x0904, 0x82a5,
+	0x700c, 0x7108, 0x080c, 0x283e, 0x1904, 0x82a5, 0x080c, 0x659e,
+	0x1904, 0x82a5, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x01d8, 0x080c,
+	0x6972, 0x0118, 0x9086, 0x0004, 0x1588, 0x00c6, 0x080c, 0x82c5,
+	0x00ce, 0x05d8, 0x080c, 0xae0b, 0x2b08, 0x05b8, 0x6112, 0x080c,
+	0xcfaa, 0x6023, 0x0002, 0x7120, 0x610a, 0x2009, 0x0088, 0x080c,
+	0xaedc, 0x0458, 0x080c, 0x6972, 0x0148, 0x9086, 0x0004, 0x0130,
+	0x080c, 0x697a, 0x0118, 0x9086, 0x0004, 0x1180, 0x080c, 0xae0b,
+	0x2b08, 0x01d8, 0x6112, 0x080c, 0xcfaa, 0x6023, 0x0005, 0x7120,
+	0x610a, 0x2009, 0x0088, 0x080c, 0xaedc, 0x0078, 0x080c, 0xae0b,
+	0x2b08, 0x0158, 0x6112, 0x080c, 0xcfaa, 0x6023, 0x0004, 0x7120,
+	0x610a, 0x2009, 0x0001, 0x080c, 0xaedc, 0x00be, 0x0005, 0x7110,
+	0xd1bc, 0x0158, 0x00d1, 0x0148, 0x080c, 0x8226, 0x1130, 0x7124,
+	0x610a, 0x2009, 0x0089, 0x080c, 0xaedc, 0x0005, 0x7110, 0xd1bc,
+	0x0158, 0x0059, 0x0148, 0x080c, 0x8226, 0x1130, 0x7124, 0x610a,
+	0x2009, 0x008a, 0x080c, 0xaedc, 0x0005, 0x7020, 0x2060, 0x9c84,
+	0x0007, 0x1158, 0x9c82, 0x1cd0, 0x0240, 0x2001, 0x181a, 0x2004,
+	0x9c02, 0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x00b6,
+	0x7110, 0xd1bc, 0x11d8, 0x7024, 0x2060, 0x9c84, 0x0007, 0x11b0,
+	0x9c82, 0x1cd0, 0x0298, 0x6868, 0x9c02, 0x1280, 0x7008, 0x9084,
+	0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1140, 0x700c, 0xb914,
+	0x9106, 0x1120, 0x2009, 0x0051, 0x080c, 0xaedc, 0x7817, 0x0140,
+	0x2001, 0x19f0, 0x2004, 0x9005, 0x090c, 0x968d, 0x00be, 0x0005,
+	0x2031, 0x0105, 0x0069, 0x0005, 0x2031, 0x0206, 0x0049, 0x0005,
+	0x2031, 0x0207, 0x0029, 0x0005, 0x2031, 0x0213, 0x0009, 0x0005,
+	0x00c6, 0x0096, 0x00f6, 0x7000, 0x9084, 0xf000, 0x9086, 0xc000,
+	0x05d0, 0x080c, 0xae0b, 0x05b8, 0x0066, 0x00c6, 0x0046, 0x2011,
+	0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x283e, 0x15a0, 0x080c,
+	0x659e, 0x1588, 0xbe12, 0xbd16, 0x2b00, 0x004e, 0x00ce, 0x6012,
+	0x080c, 0xcfaa, 0x080c, 0x0fff, 0x0510, 0x2900, 0x605a, 0x9006,
+	0xa802, 0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b, 0x20a9, 0x000e,
+	0xa860, 0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98, 0x4003, 0x006e,
+	0x6616, 0x6007, 0x003e, 0x6023, 0x0001, 0x6003, 0x0001, 0x080c,
+	0x9138, 0x080c, 0x968d, 0x00fe, 0x009e, 0x00ce, 0x0005, 0x080c,
+	0xae61, 0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6, 0x7000,
+	0x908c, 0xff00, 0x9184, 0xf000, 0x810f, 0x9086, 0x2000, 0x1904,
+	0x83b5, 0x9186, 0x0022, 0x15f0, 0x2001, 0x0111, 0x2004, 0x9005,
+	0x1904, 0x83b7, 0x7030, 0x908e, 0x0400, 0x0904, 0x83b7, 0x908e,
+	0x6000, 0x05e8, 0x908e, 0x5400, 0x05d0, 0x908e, 0x0300, 0x11d8,
+	0x2009, 0x1837, 0x210c, 0xd18c, 0x1590, 0xd1a4, 0x1580, 0x080c,
+	0x6930, 0x0558, 0x68b0, 0x9084, 0x00ff, 0x7100, 0x918c, 0x00ff,
+	0x9106, 0x1518, 0x6880, 0x69b0, 0x918c, 0xff00, 0x9105, 0x7104,
+	0x9106, 0x11d8, 0x00e0, 0x2009, 0x0103, 0x210c, 0xd1b4, 0x11a8,
+	0x908e, 0x5200, 0x09e8, 0x908e, 0x0500, 0x09d0, 0x908e, 0x5000,
+	0x09b8, 0x0058, 0x9186, 0x0023, 0x1140, 0x080c, 0x82c5, 0x0128,
+	0x6004, 0x9086, 0x0002, 0x0118, 0x0000, 0x9006, 0x0010, 0x9085,
+	0x0001, 0x00ce, 0x0005, 0x0156, 0x0046, 0x0016, 0x0036, 0x7038,
+	0x2020, 0x8427, 0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004,
+	0x2019, 0x1805, 0x2011, 0x027a, 0x080c, 0xbe09, 0x1178, 0xd48c,
+	0x0148, 0x20a9, 0x0004, 0x2019, 0x1801, 0x2011, 0x027e, 0x080c,
+	0xbe09, 0x1120, 0xd494, 0x0110, 0x9085, 0x0001, 0x003e, 0x001e,
+	0x004e, 0x015e, 0x0005, 0x0156, 0x0046, 0x0016, 0x0036, 0x7038,
+	0x2020, 0x8427, 0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004,
+	0x2019, 0x1805, 0x2011, 0x0272, 0x080c, 0xbe09, 0x1178, 0xd48c,
+	0x0148, 0x20a9, 0x0004, 0x2019, 0x1801, 0x2011, 0x0276, 0x080c,
+	0xbe09, 0x1120, 0xd494, 0x0110, 0x9085, 0x0001, 0x003e, 0x001e,
+	0x004e, 0x015e, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7800, 0xc0e5,
+	0xc0cc, 0x7802, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x1800, 0x7834,
+	0xd084, 0x1130, 0x2079, 0x0200, 0x7800, 0x9085, 0x1200, 0x7802,
+	0x00fe, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7034, 0xc084, 0x7036,
+	0x00ee, 0x0005, 0x2071, 0x19fa, 0x7003, 0x0003, 0x700f, 0x0361,
+	0x9006, 0x701a, 0x7072, 0x7012, 0x7017, 0x1cd0, 0x7007, 0x0000,
+	0x7026, 0x702b, 0xa289, 0x7032, 0x7037, 0xa2f7, 0x703f, 0xffff,
+	0x7042, 0x7047, 0x556e, 0x704a, 0x705b, 0x8594, 0x080c, 0x1018,
+	0x090c, 0x0dd5, 0x2900, 0x703a, 0xa867, 0x0003, 0xa86f, 0x0100,
+	0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x19fa, 0x1d04, 0x84e2, 0x2091,
+	0x6000, 0x700c, 0x8001, 0x700e, 0x1530, 0x2001, 0x013c, 0x2004,
+	0x9005, 0x190c, 0x85d9, 0x2001, 0x1869, 0x2004, 0xd0c4, 0x0158,
+	0x3a00, 0xd08c, 0x1140, 0x20d1, 0x0000, 0x20d1, 0x0001, 0x20d1,
+	0x0000, 0x080c, 0x0dd5, 0x700f, 0x0361, 0x7007, 0x0001, 0x0126,
+	0x2091, 0x8000, 0x7040, 0x900d, 0x0148, 0x8109, 0x7142, 0x1130,
+	0x7044, 0x080f, 0x0018, 0x0126, 0x2091, 0x8000, 0x7024, 0x900d,
+	0x0188, 0x7020, 0x8001, 0x7022, 0x1168, 0x7023, 0x0009, 0x8109,
+	0x7126, 0x9186, 0x03e8, 0x1110, 0x7028, 0x080f, 0x81ff, 0x1110,
+	0x7028, 0x080f, 0x7030, 0x900d, 0x0180, 0x702c, 0x8001, 0x702e,
+	0x1160, 0x702f, 0x0009, 0x8109, 0x7132, 0x0128, 0x9184, 0x007f,
+	0x090c, 0xa418, 0x0010, 0x7034, 0x080f, 0x703c, 0x9005, 0x0118,
+	0x0310, 0x8001, 0x703e, 0x704c, 0x900d, 0x0168, 0x7048, 0x8001,
+	0x704a, 0x1148, 0x704b, 0x0009, 0x8109, 0x714e, 0x1120, 0x7150,
+	0x714e, 0x7058, 0x080f, 0x7018, 0x900d, 0x01d8, 0x0016, 0x7070,
+	0x900d, 0x0158, 0x706c, 0x8001, 0x706e, 0x1138, 0x706f, 0x0009,
+	0x8109, 0x7172, 0x1110, 0x7074, 0x080f, 0x001e, 0x7008, 0x8001,
+	0x700a, 0x1138, 0x700b, 0x0009, 0x8109, 0x711a, 0x1110, 0x701c,
+	0x080f, 0x012e, 0x7004, 0x0002, 0x850a, 0x850b, 0x8527, 0x00e6,
+	0x2071, 0x19fa, 0x7018, 0x9005, 0x1120, 0x711a, 0x721e, 0x700b,
+	0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071, 0x19fa, 0x701c,
+	0x9206, 0x1120, 0x701a, 0x701e, 0x7072, 0x7076, 0x000e, 0x00ee,
+	0x0005, 0x00e6, 0x2071, 0x19fa, 0xb888, 0x9102, 0x0208, 0xb98a,
+	0x00ee, 0x0005, 0x0005, 0x00b6, 0x7110, 0x080c, 0x65ff, 0x1168,
+	0xb888, 0x8001, 0x0250, 0xb88a, 0x1140, 0x0126, 0x2091, 0x8000,
+	0x0016, 0x080c, 0x968d, 0x001e, 0x012e, 0x8108, 0x9182, 0x0800,
+	0x0218, 0x900e, 0x7007, 0x0002, 0x7112, 0x00be, 0x0005, 0x7014,
+	0x2060, 0x0126, 0x2091, 0x8000, 0x6040, 0x9005, 0x0128, 0x8001,
+	0x6042, 0x1110, 0x080c, 0xce3b, 0x6018, 0x9005, 0x0558, 0x8001,
+	0x601a, 0x1540, 0x6120, 0x9186, 0x0003, 0x0148, 0x9186, 0x0006,
+	0x0130, 0x9186, 0x0009, 0x11e0, 0x611c, 0xd1c4, 0x1100, 0x080c,
+	0xcb35, 0x01b0, 0x6014, 0x2048, 0xa884, 0x908a, 0x199a, 0x0280,
+	0x9082, 0x1999, 0xa886, 0x908a, 0x199a, 0x0210, 0x2001, 0x1999,
+	0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0xa87c, 0xd0e4, 0x0110,
+	0x080c, 0xc833, 0x012e, 0x9c88, 0x0018, 0x7116, 0x2001, 0x181a,
+	0x2004, 0x9102, 0x0220, 0x7017, 0x1cd0, 0x7007, 0x0000, 0x0005,
+	0x00e6, 0x2071, 0x19fa, 0x7027, 0x07d0, 0x7023, 0x0009, 0x00ee,
+	0x0005, 0x2001, 0x1a03, 0x2003, 0x0000, 0x0005, 0x00e6, 0x2071,
+	0x19fa, 0x7132, 0x702f, 0x0009, 0x00ee, 0x0005, 0x2011, 0x1a06,
+	0x2013, 0x0000, 0x0005, 0x00e6, 0x2071, 0x19fa, 0x711a, 0x721e,
+	0x700b, 0x0009, 0x00ee, 0x0005, 0x0086, 0x0026, 0x7054, 0x8000,
+	0x7056, 0x2001, 0x1a08, 0x2044, 0xa06c, 0x9086, 0x0000, 0x0150,
+	0x7068, 0xa09a, 0x7064, 0xa096, 0x7060, 0xa092, 0x705c, 0xa08e,
+	0x080c, 0x10e9, 0x002e, 0x008e, 0x0005, 0x0006, 0x0016, 0x0096,
+	0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x080c,
+	0x8453, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae,
+	0x009e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x19fa, 0x7172,
+	0x7276, 0x706f, 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071,
+	0x19fa, 0x7074, 0x9206, 0x1110, 0x7072, 0x7076, 0x000e, 0x00ee,
+	0x0005, 0x0016, 0x00c6, 0x2009, 0xfffc, 0x210d, 0x2061, 0x0100,
+	0x60f0, 0x9100, 0x60f3, 0x0000, 0x2009, 0xfffc, 0x200f, 0x1220,
+	0x8108, 0x2105, 0x8000, 0x200f, 0x00ce, 0x001e, 0x0005, 0x00c6,
+	0x2061, 0x1a71, 0x00ce, 0x0005, 0x9184, 0x000f, 0x8003, 0x8003,
+	0x8003, 0x9080, 0x1a71, 0x2060, 0x0005, 0xa884, 0x908a, 0x199a,
+	0x1638, 0x9005, 0x1150, 0x00c6, 0x2061, 0x1a71, 0x6014, 0x00ce,
+	0x9005, 0x1130, 0x2001, 0x001e, 0x0018, 0x908e, 0xffff, 0x01b0,
+	0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0xa87c, 0x908c, 0x00c0,
+	0x918e, 0x00c0, 0x0904, 0x8687, 0xd0b4, 0x1168, 0xd0bc, 0x1904,
+	0x8660, 0x2009, 0x0006, 0x080c, 0x86b4, 0x0005, 0x900e, 0x0c60,
+	0x2001, 0x1999, 0x08b0, 0xd0fc, 0x0160, 0x908c, 0x0003, 0x0120,
+	0x918e, 0x0003, 0x1904, 0x86ae, 0x908c, 0x2020, 0x918e, 0x2020,
+	0x01a8, 0x6024, 0xd0d4, 0x11e8, 0x2009, 0x1869, 0x2104, 0xd084,
+	0x1138, 0x87ff, 0x1120, 0x2009, 0x0043, 0x0804, 0xaedc, 0x0005,
+	0x87ff, 0x1de8, 0x2009, 0x0042, 0x0804, 0xaedc, 0x6110, 0x00b6,
+	0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d20, 0x6024, 0xc0cd, 0x6026,
+	0x0c00, 0xc0d4, 0x6026, 0xa890, 0x602e, 0xa88c, 0x6032, 0x08e0,
+	0xd0fc, 0x0160, 0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904,
+	0x86ae, 0x908c, 0x2020, 0x918e, 0x2020, 0x0170, 0x0076, 0x00f6,
+	0x2c78, 0x080c, 0x1725, 0x00fe, 0x007e, 0x87ff, 0x1120, 0x2009,
+	0x0042, 0x080c, 0xaedc, 0x0005, 0x6110, 0x00b6, 0x2158, 0xb900,
+	0x00be, 0xd1ac, 0x0d58, 0x6124, 0xc1cd, 0x6126, 0x0c38, 0xd0fc,
+	0x0188, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8, 0x9084, 0x0003,
+	0x908e, 0x0002, 0x0148, 0x87ff, 0x1120, 0x2009, 0x0041, 0x080c,
+	0xaedc, 0x0005, 0x00b9, 0x0ce8, 0x87ff, 0x1dd8, 0x2009, 0x0043,
+	0x080c, 0xaedc, 0x0cb0, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be,
+	0xd1ac, 0x0d20, 0x6124, 0xc1cd, 0x6126, 0x0c00, 0x2009, 0x0004,
+	0x0019, 0x0005, 0x2009, 0x0001, 0x0096, 0x080c, 0xcb35, 0x0518,
+	0x6014, 0x2048, 0xa982, 0xa800, 0x6016, 0x9186, 0x0001, 0x1188,
+	0xa97c, 0x918c, 0x8100, 0x918e, 0x8100, 0x1158, 0x00c6, 0x2061,
+	0x1a71, 0x6200, 0xd28c, 0x1120, 0x6204, 0x8210, 0x0208, 0x6206,
+	0x00ce, 0x080c, 0x6abc, 0x6014, 0x904d, 0x0076, 0x2039, 0x0000,
+	0x190c, 0x85fd, 0x007e, 0x009e, 0x0005, 0x0156, 0x00c6, 0x2061,
+	0x1a71, 0x6000, 0x81ff, 0x0110, 0x9205, 0x0008, 0x9204, 0x6002,
+	0x00ce, 0x015e, 0x0005, 0x6800, 0xd08c, 0x1138, 0x6808, 0x9005,
+	0x0120, 0x8001, 0x680a, 0x9085, 0x0001, 0x0005, 0x2071, 0x1923,
+	0x7003, 0x0006, 0x7007, 0x0000, 0x700f, 0x0000, 0x7013, 0x0001,
+	0x080c, 0x1018, 0x090c, 0x0dd5, 0xa867, 0x0006, 0xa86b, 0x0001,
+	0xa8ab, 0xdcb0, 0xa89f, 0x0000, 0x2900, 0x702e, 0x7033, 0x0000,
+	0x0005, 0x0096, 0x00e6, 0x2071, 0x1923, 0x702c, 0x2048, 0x6a2c,
+	0x721e, 0x6b30, 0x7322, 0x6834, 0x7026, 0xa896, 0x6838, 0x702a,
+	0xa89a, 0x6824, 0x7016, 0x683c, 0x701a, 0x2009, 0x0028, 0x200a,
+	0x9005, 0x0148, 0x900e, 0x9188, 0x000c, 0x8001, 0x1de0, 0x2100,
+	0x9210, 0x1208, 0x8318, 0xaa8e, 0xab92, 0x7010, 0xd084, 0x0178,
+	0xc084, 0x7007, 0x0001, 0x700f, 0x0000, 0x0006, 0x2009, 0x181d,
+	0x2104, 0x9082, 0x0007, 0x2009, 0x1ac8, 0x200a, 0x000e, 0xc095,
+	0x7012, 0x2008, 0x2001, 0x003b, 0x080c, 0x15ee, 0x9006, 0x2071,
+	0x193c, 0x7002, 0x7006, 0x702a, 0x00ee, 0x009e, 0x0005, 0x00e6,
+	0x0126, 0x0156, 0x2091, 0x8000, 0x2071, 0x1800, 0x7154, 0x2001,
+	0x0008, 0x910a, 0x0638, 0x2001, 0x187d, 0x20ac, 0x9006, 0x9080,
+	0x0008, 0x1f04, 0x8767, 0x71c0, 0x9102, 0x02e0, 0x2071, 0x1877,
+	0x20a9, 0x0007, 0x00c6, 0x080c, 0xae0b, 0x6023, 0x0009, 0x6003,
+	0x0004, 0x601f, 0x0101, 0x0089, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x88ed, 0x012e, 0x1f04, 0x8773, 0x9006, 0x00ce, 0x015e, 0x012e,
+	0x00ee, 0x0005, 0x9085, 0x0001, 0x0cc8, 0x00e6, 0x00b6, 0x0096,
+	0x0086, 0x0056, 0x0046, 0x0026, 0x7118, 0x720c, 0x7620, 0x7004,
+	0xd084, 0x1128, 0x2021, 0x0024, 0x2029, 0x0002, 0x0020, 0x2021,
+	0x002c, 0x2029, 0x000a, 0x080c, 0x0fff, 0x090c, 0x0dd5, 0x2900,
+	0x6016, 0x2058, 0xac66, 0x9006, 0xa802, 0xa806, 0xa86a, 0xa87a,
+	0xa8aa, 0xa887, 0x0005, 0xa87f, 0x0020, 0x7008, 0xa89a, 0x7010,
+	0xa89e, 0xae8a, 0xa8af, 0xffff, 0xa8b3, 0x0000, 0x8109, 0x0160,
+	0x080c, 0x0fff, 0x090c, 0x0dd5, 0xad66, 0x2b00, 0xa802, 0x2900,
+	0xb806, 0x2058, 0x8109, 0x1da0, 0x002e, 0x004e, 0x005e, 0x008e,
+	0x009e, 0x00be, 0x00ee, 0x0005, 0x2079, 0x0000, 0x2071, 0x1923,
+	0x7004, 0x004b, 0x700c, 0x0002, 0x87df, 0x87d8, 0x87d8, 0x0005,
+	0x87e9, 0x884a, 0x884a, 0x884a, 0x884b, 0x885c, 0x885c, 0x700c,
+	0x0cba, 0x0126, 0x2091, 0x8000, 0x78a0, 0x79a0, 0x9106, 0x0128,
+	0x78a0, 0x79a0, 0x9106, 0x1904, 0x883d, 0x2001, 0x0005, 0x2004,
+	0xd0bc, 0x0130, 0x2011, 0x0004, 0x2204, 0xc0c5, 0x2012, 0x0ca8,
+	0x012e, 0x7018, 0x910a, 0x1130, 0x7030, 0x9005, 0x05a8, 0x080c,
+	0x888b, 0x0490, 0x1210, 0x7114, 0x910a, 0x9192, 0x000a, 0x0210,
+	0x2009, 0x000a, 0x2001, 0x1888, 0x2014, 0x2001, 0x1935, 0x2004,
+	0x9100, 0x9202, 0x0e48, 0x080c, 0x89d7, 0x2200, 0x9102, 0x0208,
+	0x2208, 0x0096, 0x702c, 0x2048, 0xa873, 0x0001, 0xa976, 0x080c,
+	0x8ae0, 0x2100, 0xa87e, 0xa86f, 0x0000, 0x009e, 0x0126, 0x2091,
+	0x8000, 0x2009, 0x1a18, 0x2104, 0xc085, 0x200a, 0x700f, 0x0002,
+	0x012e, 0x080c, 0x1108, 0x1de8, 0x0005, 0x2001, 0x0005, 0x2004,
+	0xd0bc, 0x0130, 0x2011, 0x0004, 0x2204, 0xc0c5, 0x2012, 0x0ca8,
+	0x012e, 0x0005, 0x0005, 0x700c, 0x0002, 0x8850, 0x8853, 0x8852,
+	0x080c, 0x87e7, 0x0005, 0x8001, 0x700e, 0x0096, 0x702c, 0x2048,
+	0xa974, 0x009e, 0x0011, 0x0ca0, 0x0005, 0x0096, 0x702c, 0x2048,
+	0x7018, 0x9100, 0x7214, 0x921a, 0x1130, 0x701c, 0xa88e, 0x7020,
+	0xa892, 0x9006, 0x0068, 0x0006, 0x080c, 0x8ae0, 0x2100, 0xaa8c,
+	0x9210, 0xaa8e, 0x1220, 0xa890, 0x9081, 0x0000, 0xa892, 0x000e,
+	0x009e, 0x2f08, 0x9188, 0x0028, 0x200a, 0x701a, 0x0005, 0x00e6,
+	0x2071, 0x1923, 0x700c, 0x0002, 0x8889, 0x8889, 0x8887, 0x700f,
+	0x0001, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x7030, 0x9005,
+	0x0508, 0x2078, 0x7814, 0x2048, 0xae88, 0x00b6, 0x2059, 0x0000,
+	0x080c, 0x88f6, 0x00be, 0x01b0, 0x00e6, 0x2071, 0x193c, 0x080c,
+	0x893d, 0x00ee, 0x0178, 0x0096, 0x080c, 0x1018, 0x2900, 0x009e,
+	0x0148, 0xa8aa, 0x04b9, 0x0041, 0x2001, 0x1946, 0x2003, 0x0000,
+	0x012e, 0x08c8, 0x012e, 0x0005, 0x00d6, 0x00c6, 0x0086, 0x00a6,
+	0x2940, 0x2650, 0x2600, 0x9005, 0x0180, 0xa864, 0x9084, 0x000f,
+	0x2068, 0x9d88, 0x2090, 0x2165, 0x0056, 0x2029, 0x0000, 0x080c,
+	0x8a65, 0x080c, 0x2048, 0x1dd8, 0x005e, 0x00ae, 0x2001, 0x187f,
+	0x2004, 0xa88a, 0x080c, 0x1725, 0x781f, 0x0101, 0x7813, 0x0000,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x894c, 0x012e, 0x008e, 0x00ce,
+	0x00de, 0x0005, 0x7030, 0x9005, 0x0138, 0x2078, 0x780c, 0x7032,
+	0x2001, 0x1946, 0x2003, 0x0001, 0x0005, 0x00e6, 0x2071, 0x1923,
+	0x7030, 0x600e, 0x2c00, 0x7032, 0x00ee, 0x0005, 0x00d6, 0x00c6,
+	0x0026, 0x9b80, 0x8bbf, 0x2005, 0x906d, 0x090c, 0x0dd5, 0x9b80,
+	0x8bb7, 0x2005, 0x9065, 0x090c, 0x0dd5, 0x6114, 0x2600, 0x9102,
+	0x0248, 0x6828, 0x9102, 0x02f0, 0x9085, 0x0001, 0x002e, 0x00ce,
+	0x00de, 0x0005, 0x6804, 0xd094, 0x0148, 0x6854, 0xd084, 0x1178,
+	0xc085, 0x6856, 0x2011, 0x8026, 0x080c, 0x4b04, 0x684c, 0x0096,
+	0x904d, 0x090c, 0x0dd5, 0xa804, 0x8000, 0xa806, 0x009e, 0x9006,
+	0x2030, 0x0c20, 0x6854, 0xd08c, 0x1d08, 0xc08d, 0x6856, 0x2011,
+	0x8025, 0x080c, 0x4b04, 0x684c, 0x0096, 0x904d, 0x090c, 0x0dd5,
+	0xa800, 0x8000, 0xa802, 0x009e, 0x0888, 0x7000, 0x2019, 0x0008,
+	0x8319, 0x7104, 0x9102, 0x1118, 0x2300, 0x9005, 0x0020, 0x0210,
+	0x9302, 0x0008, 0x8002, 0x0005, 0x00d6, 0x7814, 0x9005, 0x090c,
+	0x0dd5, 0x781c, 0x9084, 0x0101, 0x9086, 0x0101, 0x190c, 0x0dd5,
+	0x2069, 0x193c, 0x6804, 0x9080, 0x193e, 0x2f08, 0x2102, 0x6904,
+	0x8108, 0x9182, 0x0008, 0x0208, 0x900e, 0x6906, 0x9180, 0x193e,
+	0x2003, 0x0000, 0x00de, 0x0005, 0x0096, 0x00c6, 0x2060, 0x6014,
+	0x2048, 0xa8a8, 0x0096, 0x2048, 0x9005, 0x190c, 0x1031, 0x009e,
+	0xa8ab, 0x0000, 0x080c, 0x0fb1, 0x080c, 0xae61, 0x00ce, 0x009e,
+	0x0005, 0x6020, 0x9086, 0x0009, 0x1128, 0x601c, 0xd0c4, 0x0110,
+	0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x6000, 0x9086, 0x0000,
+	0x0178, 0x6010, 0x9005, 0x0150, 0x00b6, 0x2058, 0x080c, 0x8cf2,
+	0x00be, 0x6013, 0x0000, 0x601b, 0x0000, 0x0010, 0x2c00, 0x0861,
+	0x0005, 0x2009, 0x1927, 0x210c, 0xd194, 0x0005, 0x00e6, 0x2071,
+	0x1923, 0x7110, 0xc194, 0xd19c, 0x1118, 0xc185, 0x7007, 0x0000,
+	0x7112, 0x2001, 0x003b, 0x080c, 0x15ee, 0x00ee, 0x0005, 0x0096,
+	0x00d6, 0x9006, 0x7006, 0x700e, 0x701a, 0x701e, 0x7022, 0x7016,
+	0x702a, 0x7026, 0x702f, 0x0000, 0x080c, 0x8b3f, 0x0170, 0x080c,
+	0x8b74, 0x0158, 0x2900, 0x7002, 0x700a, 0x701a, 0x7013, 0x0001,
+	0x701f, 0x000a, 0x00de, 0x009e, 0x0005, 0x900e, 0x0cd8, 0x00e6,
+	0x0096, 0x0086, 0x00d6, 0x00c6, 0x2071, 0x1930, 0x721c, 0x2100,
+	0x9202, 0x1618, 0x080c, 0x8b74, 0x090c, 0x0dd5, 0x7018, 0x9005,
+	0x1160, 0x2900, 0x7002, 0x700a, 0x701a, 0x9006, 0x7006, 0x700e,
+	0xa806, 0xa802, 0x7012, 0x701e, 0x0038, 0x2040, 0xa806, 0x2900,
+	0xa002, 0x701a, 0xa803, 0x0000, 0x7010, 0x8000, 0x7012, 0x701c,
+	0x9080, 0x000a, 0x701e, 0x721c, 0x08d0, 0x721c, 0x00ce, 0x00de,
+	0x008e, 0x009e, 0x00ee, 0x0005, 0x0096, 0x0156, 0x0136, 0x0146,
+	0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1930, 0x7300, 0x831f,
+	0x831e, 0x831e, 0x9384, 0x003f, 0x20e8, 0x939c, 0xffc0, 0x9398,
+	0x0003, 0x7104, 0x080c, 0x8ae0, 0x810c, 0x2100, 0x9318, 0x8003,
+	0x2228, 0x2021, 0x0078, 0x9402, 0x9532, 0x0208, 0x2028, 0x2500,
+	0x8004, 0x20a8, 0x23a0, 0xa001, 0xa001, 0x4005, 0x2508, 0x080c,
+	0x8ae9, 0x2130, 0x7014, 0x9600, 0x7016, 0x2600, 0x711c, 0x9102,
+	0x701e, 0x7004, 0x9600, 0x2008, 0x9082, 0x000a, 0x1190, 0x7000,
+	0x2048, 0xa800, 0x9005, 0x1148, 0x2009, 0x0001, 0x0026, 0x080c,
+	0x89d7, 0x002e, 0x7000, 0x2048, 0xa800, 0x7002, 0x7007, 0x0000,
+	0x0008, 0x7106, 0x2500, 0x9212, 0x1904, 0x8a16, 0x012e, 0x00ee,
+	0x014e, 0x013e, 0x015e, 0x009e, 0x0005, 0x0016, 0x0026, 0x00e6,
+	0x0126, 0x2091, 0x8000, 0x9580, 0x8bb7, 0x2005, 0x9075, 0x090c,
+	0x0dd5, 0x080c, 0x8abb, 0x012e, 0x9580, 0x8bb3, 0x2005, 0x9075,
+	0x090c, 0x0dd5, 0x0156, 0x0136, 0x01c6, 0x0146, 0x01d6, 0x831f,
+	0x831e, 0x831e, 0x9384, 0x003f, 0x20e0, 0x9384, 0xffc0, 0x9100,
+	0x2098, 0xa860, 0x20e8, 0xa95c, 0x2c05, 0x9100, 0x20a0, 0x20a9,
+	0x0002, 0x4003, 0x2e0c, 0x2d00, 0x0002, 0x8aa5, 0x8aa5, 0x8aa7,
+	0x8aa5, 0x8aa7, 0x8aa5, 0x8aa5, 0x8aa5, 0x8aa5, 0x8aa5, 0x8aad,
+	0x8aa5, 0x8aad, 0x8aa5, 0x8aa5, 0x8aa5, 0x080c, 0x0dd5, 0x4104,
+	0x20a9, 0x0002, 0x4002, 0x4003, 0x0028, 0x20a9, 0x0002, 0x4003,
+	0x4104, 0x4003, 0x01de, 0x014e, 0x01ce, 0x013e, 0x015e, 0x00ee,
+	0x002e, 0x001e, 0x0005, 0x0096, 0x7014, 0x8001, 0x7016, 0x710c,
+	0x2110, 0x00f1, 0x810c, 0x9188, 0x0003, 0x7308, 0x8210, 0x9282,
+	0x000a, 0x1198, 0x7008, 0x2048, 0xa800, 0x9005, 0x0158, 0x0006,
+	0x080c, 0x8b83, 0x009e, 0xa807, 0x0000, 0x2900, 0x700a, 0x7010,
+	0x8001, 0x7012, 0x700f, 0x0000, 0x0008, 0x720e, 0x009e, 0x0005,
+	0x0006, 0x810b, 0x810b, 0x2100, 0x810b, 0x9100, 0x2008, 0x000e,
+	0x0005, 0x0006, 0x0026, 0x2100, 0x9005, 0x0158, 0x9092, 0x000c,
+	0x0240, 0x900e, 0x8108, 0x9082, 0x000c, 0x1de0, 0x002e, 0x000e,
+	0x0005, 0x900e, 0x0cd8, 0x2d00, 0x90b8, 0x0008, 0x690c, 0x6810,
+	0x2019, 0x0001, 0x2031, 0x8b29, 0x9112, 0x0220, 0x0118, 0x8318,
+	0x2208, 0x0cd0, 0x6808, 0x9005, 0x0108, 0x8318, 0x233a, 0x6804,
+	0xd084, 0x2300, 0x2021, 0x0001, 0x1150, 0x9082, 0x0003, 0x0967,
+	0x0a67, 0x8420, 0x9082, 0x0007, 0x0967, 0x0a67, 0x0cd0, 0x9082,
+	0x0002, 0x0967, 0x0a67, 0x8420, 0x9082, 0x0005, 0x0967, 0x0a67,
+	0x0cd0, 0x6c1a, 0x2d00, 0x90b8, 0x0007, 0x00e6, 0x2071, 0x1800,
+	0x7128, 0x6810, 0x2019, 0x0001, 0x910a, 0x0118, 0x0210, 0x8318,
+	0x0cd8, 0x2031, 0x8b3c, 0x0870, 0x6c16, 0x00ee, 0x0005, 0x0096,
+	0x0046, 0x0126, 0x2091, 0x8000, 0x2b00, 0x9080, 0x8bbb, 0x2005,
+	0x9005, 0x090c, 0x0dd5, 0x2004, 0x90a0, 0x000a, 0x080c, 0x1018,
+	0x01d0, 0x2900, 0x7026, 0xa803, 0x0000, 0xa807, 0x0000, 0x080c,
+	0x1018, 0x0188, 0x7024, 0xa802, 0xa807, 0x0000, 0x2900, 0x7026,
+	0x94a2, 0x000a, 0x0110, 0x0208, 0x0c90, 0x9085, 0x0001, 0x012e,
+	0x004e, 0x009e, 0x0005, 0x7024, 0x9005, 0x0dc8, 0x2048, 0xac00,
+	0x080c, 0x1031, 0x2400, 0x0cc0, 0x0126, 0x2091, 0x8000, 0x7024,
+	0x2048, 0x9005, 0x0130, 0xa800, 0x7026, 0xa803, 0x0000, 0xa807,
+	0x0000, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x7024, 0xa802,
+	0x2900, 0x7026, 0x012e, 0x0005, 0x0096, 0x9e80, 0x0009, 0x2004,
+	0x9005, 0x0138, 0x2048, 0xa800, 0x0006, 0x080c, 0x1031, 0x000e,
+	0x0cb8, 0x009e, 0x0005, 0x0096, 0x7008, 0x9005, 0x0138, 0x2048,
+	0xa800, 0x0006, 0x080c, 0x1031, 0x000e, 0x0cb8, 0x9006, 0x7002,
+	0x700a, 0x7006, 0x700e, 0x701a, 0x701e, 0x7022, 0x702a, 0x7026,
+	0x702e, 0x009e, 0x0005, 0x1a64, 0x0000, 0x0000, 0x0000, 0x1930,
+	0x0000, 0x0000, 0x0000, 0x1888, 0x0000, 0x0000, 0x0000, 0x1877,
+	0x0000, 0x0000, 0x0000, 0x00e6, 0x00c6, 0x00b6, 0x00a6, 0xa8a8,
+	0x2040, 0x2071, 0x1877, 0x080c, 0x8cdd, 0xa067, 0x0023, 0x6010,
+	0x905d, 0x0904, 0x8cb2, 0xb814, 0xa06e, 0xb910, 0xa172, 0xb9a0,
+	0xa176, 0x2001, 0x0003, 0xa07e, 0xa834, 0xa082, 0xa07b, 0x0000,
+	0xa898, 0x9005, 0x0118, 0xa078, 0xc085, 0xa07a, 0x2858, 0x2031,
+	0x0018, 0xa068, 0x908a, 0x0019, 0x1a0c, 0x0dd5, 0x2020, 0x2050,
+	0x2940, 0xa864, 0x90bc, 0x00ff, 0x908c, 0x000f, 0x91e0, 0x2090,
+	0x2c65, 0x9786, 0x0024, 0x2c05, 0x1590, 0x908a, 0x0036, 0x1a0c,
+	0x0dd5, 0x9082, 0x001b, 0x0002, 0x8c1f, 0x8c1f, 0x8c21, 0x8c1f,
+	0x8c1f, 0x8c1f, 0x8c23, 0x8c1f, 0x8c1f, 0x8c1f, 0x8c25, 0x8c1f,
+	0x8c1f, 0x8c1f, 0x8c27, 0x8c1f, 0x8c1f, 0x8c1f, 0x8c29, 0x8c1f,
+	0x8c1f, 0x8c1f, 0x8c2b, 0x8c1f, 0x8c1f, 0x8c1f, 0x8c2d, 0x080c,
+	0x0dd5, 0xa180, 0x04b8, 0xa190, 0x04a8, 0xa1a0, 0x0498, 0xa1b0,
+	0x0488, 0xa1c0, 0x0478, 0xa1d0, 0x0468, 0xa1e0, 0x0458, 0x908a,
+	0x0034, 0x1a0c, 0x0dd5, 0x9082, 0x001b, 0x0002, 0x8c51, 0x8c4f,
+	0x8c4f, 0x8c4f, 0x8c4f, 0x8c4f, 0x8c53, 0x8c4f, 0x8c4f, 0x8c4f,
+	0x8c4f, 0x8c4f, 0x8c55, 0x8c4f, 0x8c4f, 0x8c4f, 0x8c4f, 0x8c4f,
+	0x8c57, 0x8c4f, 0x8c4f, 0x8c4f, 0x8c4f, 0x8c4f, 0x8c59, 0x080c,
+	0x0dd5, 0xa180, 0x0038, 0xa198, 0x0028, 0xa1b0, 0x0018, 0xa1c8,
+	0x0008, 0xa1e0, 0x2600, 0x0002, 0x8c75, 0x8c77, 0x8c79, 0x8c7b,
+	0x8c7d, 0x8c7f, 0x8c81, 0x8c83, 0x8c85, 0x8c87, 0x8c89, 0x8c8b,
+	0x8c8d, 0x8c8f, 0x8c91, 0x8c93, 0x8c95, 0x8c97, 0x8c99, 0x8c9b,
+	0x8c9d, 0x8c9f, 0x8ca1, 0x8ca3, 0x8ca5, 0x080c, 0x0dd5, 0xb9e2,
+	0x0468, 0xb9de, 0x0458, 0xb9da, 0x0448, 0xb9d6, 0x0438, 0xb9d2,
+	0x0428, 0xb9ce, 0x0418, 0xb9ca, 0x0408, 0xb9c6, 0x00f8, 0xb9c2,
+	0x00e8, 0xb9be, 0x00d8, 0xb9ba, 0x00c8, 0xb9b6, 0x00b8, 0xb9b2,
+	0x00a8, 0xb9ae, 0x0098, 0xb9aa, 0x0088, 0xb9a6, 0x0078, 0xb9a2,
+	0x0068, 0xb99e, 0x0058, 0xb99a, 0x0048, 0xb996, 0x0038, 0xb992,
+	0x0028, 0xb98e, 0x0018, 0xb98a, 0x0008, 0xb986, 0x8631, 0x8421,
+	0x0120, 0x080c, 0x2048, 0x0804, 0x8bf9, 0x00ae, 0x00be, 0x00ce,
+	0x00ee, 0x0005, 0xa86c, 0xa06e, 0xa870, 0xa072, 0xa077, 0x00ff,
+	0x9006, 0x0804, 0x8bdb, 0x0006, 0x0016, 0x00b6, 0x6010, 0x2058,
+	0xb810, 0x9005, 0x01b0, 0x2001, 0x1924, 0x2004, 0x9005, 0x0188,
+	0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046,
+	0xbba0, 0x2021, 0x0004, 0x2011, 0x8014, 0x080c, 0x4b04, 0x004e,
+	0x003e, 0x00be, 0x001e, 0x000e, 0x0005, 0x9016, 0x710c, 0xa834,
+	0x910a, 0xa936, 0x7008, 0x9005, 0x0120, 0x8210, 0x910a, 0x0238,
+	0x0130, 0x7010, 0x8210, 0x910a, 0x0210, 0x0108, 0x0cd8, 0xaa8a,
+	0xa26a, 0x0005, 0x00f6, 0x00d6, 0x0036, 0x2079, 0x0300, 0x781b,
+	0x0200, 0x7818, 0xd094, 0x1dd8, 0x781b, 0x0202, 0xa001, 0xa001,
+	0x7818, 0xd094, 0x1da0, 0xb8ac, 0x9005, 0x01b8, 0x2068, 0x2079,
+	0x0000, 0x2c08, 0x911e, 0x1118, 0x680c, 0xb8ae, 0x0060, 0x9106,
+	0x0140, 0x2d00, 0x2078, 0x680c, 0x9005, 0x090c, 0x0dd5, 0x2068,
+	0x0cb0, 0x6b0c, 0x7b0e, 0x600f, 0x0000, 0x2079, 0x0300, 0x781b,
+	0x0200, 0x003e, 0x00de, 0x00fe, 0x0005, 0x00e6, 0x00d6, 0x0096,
+	0x00c6, 0x0036, 0x0126, 0x2091, 0x8000, 0x0156, 0x20a9, 0x01ff,
+	0x2071, 0x0300, 0x701b, 0x0200, 0x7018, 0xd094, 0x0110, 0x1f04,
+	0x8d32, 0x701b, 0x0202, 0xa001, 0xa001, 0x7018, 0xd094, 0x1d90,
+	0xb8ac, 0x9005, 0x01d0, 0x2060, 0x600c, 0xb8ae, 0x6003, 0x0004,
+	0x601b, 0x0000, 0x6013, 0x0000, 0x601f, 0x0101, 0x6014, 0x2048,
+	0xa88b, 0x0000, 0xa8a8, 0xa8ab, 0x0000, 0x904d, 0x090c, 0x0dd5,
+	0x080c, 0x1031, 0x080c, 0x88ed, 0x0c18, 0x2071, 0x0300, 0x701b,
+	0x0200, 0x015e, 0x012e, 0x003e, 0x00ce, 0x009e, 0x00de, 0x00ee,
+	0x0005, 0x00c6, 0x00b6, 0x0016, 0x0006, 0x0156, 0x080c, 0x283e,
+	0x015e, 0x11b0, 0x080c, 0x659e, 0x190c, 0x0dd5, 0x000e, 0x001e,
+	0xb912, 0xb816, 0x080c, 0xae0b, 0x0140, 0x2b00, 0x6012, 0x6023,
+	0x0001, 0x2009, 0x0001, 0x080c, 0xaedc, 0x00be, 0x00ce, 0x0005,
+	0x000e, 0x001e, 0x0cd0, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c,
+	0x0dd5, 0x0013, 0x006e, 0x0005, 0x8da4, 0x8da4, 0x8da4, 0x8da6,
+	0x8df7, 0x8da4, 0x8da4, 0x8da4, 0x8e5a, 0x8da4, 0x8e97, 0x8da4,
+	0x8da4, 0x8da4, 0x8da4, 0x8da4, 0x080c, 0x0dd5, 0x9182, 0x0040,
+	0x0002, 0x8db9, 0x8db9, 0x8db9, 0x8db9, 0x8db9, 0x8db9, 0x8db9,
+	0x8db9, 0x8db9, 0x8dbb, 0x8dd0, 0x8db9, 0x8db9, 0x8db9, 0x8db9,
+	0x8de3, 0x080c, 0x0dd5, 0x0096, 0x080c, 0x963d, 0x080c, 0x97b9,
+	0x6114, 0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb8bb,
+	0x0500, 0x00be, 0x080c, 0x6a87, 0x080c, 0xae61, 0x009e, 0x0005,
+	0x080c, 0x963d, 0x00d6, 0x6114, 0x080c, 0xcb35, 0x0130, 0x0096,
+	0x6114, 0x2148, 0x080c, 0x6c81, 0x009e, 0x00de, 0x080c, 0xae61,
+	0x080c, 0x97b9, 0x0005, 0x080c, 0x963d, 0x080c, 0x31bf, 0x6114,
+	0x0096, 0x2148, 0x080c, 0xcb35, 0x0120, 0xa87b, 0x0029, 0x080c,
+	0x6c81, 0x009e, 0x080c, 0xae61, 0x080c, 0x97b9, 0x0005, 0x601b,
+	0x0000, 0x9182, 0x0040, 0x0096, 0x0002, 0x8e12, 0x8e12, 0x8e12,
+	0x8e12, 0x8e12, 0x8e12, 0x8e12, 0x8e12, 0x8e14, 0x8e12, 0x8e12,
+	0x8e12, 0x8e56, 0x8e12, 0x8e12, 0x8e12, 0x8e12, 0x8e12, 0x8e12,
+	0x8e1a, 0x8e12, 0x080c, 0x0dd5, 0x6114, 0x2148, 0xa938, 0x918e,
+	0xffff, 0x05e0, 0x00e6, 0x6114, 0x2148, 0x080c, 0x8bc3, 0x0096,
+	0xa8a8, 0x2048, 0x080c, 0x6a1f, 0x009e, 0xa8ab, 0x0000, 0x6010,
+	0x9005, 0x0128, 0x00b6, 0x2058, 0x080c, 0x8cf2, 0x00be, 0xae88,
+	0x00b6, 0x2059, 0x0000, 0x080c, 0x88f6, 0x00be, 0x01e0, 0x2071,
+	0x193c, 0x080c, 0x893d, 0x01b8, 0x9086, 0x0001, 0x1128, 0x2001,
+	0x1946, 0x2004, 0x9005, 0x1178, 0x0096, 0x080c, 0x0fff, 0x2900,
+	0x009e, 0x0148, 0xa8aa, 0x00f6, 0x2c78, 0x080c, 0x88b4, 0x00fe,
+	0x00ee, 0x009e, 0x0005, 0x080c, 0x88ed, 0x0cd0, 0x080c, 0x8f04,
+	0x009e, 0x0005, 0x9182, 0x0040, 0x0096, 0x0002, 0x8e6e, 0x8e6e,
+	0x8e6e, 0x8e70, 0x8e6e, 0x8e6e, 0x8e6e, 0x8e95, 0x8e6e, 0x8e6e,
+	0x8e6e, 0x8e6e, 0x8e6e, 0x8e6e, 0x8e6e, 0x8e6e, 0x080c, 0x0dd5,
+	0x6003, 0x0003, 0x6106, 0x6014, 0x2048, 0xa8ac, 0xa846, 0xa8b0,
+	0xa84a, 0xa837, 0x0000, 0xa83b, 0x0000, 0xa884, 0x9092, 0x199a,
+	0x0210, 0x2001, 0x1999, 0x8003, 0x8013, 0x8213, 0x9210, 0x621a,
+	0x2c10, 0x080c, 0x1bad, 0x080c, 0x9155, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x97b9, 0x012e, 0x009e, 0x0005, 0x080c, 0x0dd5, 0x080c,
+	0x963d, 0x080c, 0x97b9, 0x6114, 0x2148, 0xa87b, 0x0000, 0x6010,
+	0x00b6, 0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6c81, 0x080c,
+	0xae61, 0x009e, 0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5,
+	0x0096, 0x0013, 0x009e, 0x0005, 0x8ec4, 0x8ec4, 0x8ec4, 0x8ec6,
+	0x8ed7, 0x8ec4, 0x8ec4, 0x8ec4, 0x8ec4, 0x8ec4, 0x8ec4, 0x8ec4,
+	0x8ec4, 0x8ec4, 0x8ec4, 0x8ec4, 0x080c, 0x0dd5, 0x080c, 0xa7cc,
+	0x6114, 0x2148, 0xa87b, 0x0006, 0x6010, 0x00b6, 0x2058, 0xb8bb,
+	0x0500, 0x00be, 0x080c, 0x6c81, 0x080c, 0xae61, 0x0005, 0x0461,
+	0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x0096, 0x0013,
+	0x009e, 0x0005, 0x8ef2, 0x8ef2, 0x8ef2, 0x8ef4, 0x8f04, 0x8ef2,
+	0x8ef2, 0x8ef2, 0x8ef2, 0x8ef2, 0x8ef2, 0x8ef2, 0x8ef2, 0x8ef2,
+	0x8ef2, 0x8ef2, 0x080c, 0x0dd5, 0x0036, 0x00e6, 0x2071, 0x19e7,
+	0x703c, 0x9c06, 0x1120, 0x2019, 0x0000, 0x080c, 0xa5b6, 0x080c,
+	0xa7cc, 0x00ee, 0x003e, 0x0005, 0x00f6, 0x00e6, 0x601b, 0x0000,
+	0x6014, 0x2048, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058, 0x080c,
+	0x8cf2, 0x00be, 0x2071, 0x193c, 0x080c, 0x893d, 0x0160, 0x2001,
+	0x187f, 0x2004, 0xa88a, 0x2031, 0x0000, 0x2c78, 0x080c, 0x88b4,
+	0x00ee, 0x00fe, 0x0005, 0x0096, 0xa88b, 0x0000, 0xa8a8, 0x2048,
+	0x080c, 0x1031, 0x009e, 0xa8ab, 0x0000, 0x080c, 0x88ed, 0x0c80,
 	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-	0x187a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0126,
-	0x2091, 0x8000, 0x0036, 0x0046, 0x20a9, 0x0010, 0x9006, 0x8004,
-	0x2019, 0x0100, 0x231c, 0x93a6, 0x0008, 0x1118, 0x8086, 0x818e,
-	0x0020, 0x80f6, 0x3e00, 0x81f6, 0x3e08, 0x1208, 0x9200, 0x1f04,
-	0x8f20, 0x93a6, 0x0008, 0x1118, 0x8086, 0x818e, 0x0020, 0x80f6,
-	0x3e00, 0x81f6, 0x3e08, 0x004e, 0x003e, 0x012e, 0x0005, 0x0126,
-	0x2091, 0x8000, 0x0076, 0x0156, 0x20a9, 0x0010, 0x9005, 0x0510,
-	0x911a, 0x1600, 0x8213, 0x2039, 0x0100, 0x273c, 0x97be, 0x0008,
-	0x1110, 0x818d, 0x0010, 0x81f5, 0x3e08, 0x0228, 0x911a, 0x1220,
-	0x1f04, 0x8f4a, 0x0028, 0x911a, 0x2308, 0x8210, 0x1f04, 0x8f4a,
-	0x0006, 0x3200, 0x9084, 0xefff, 0x2080, 0x000e, 0x015e, 0x007e,
-	0x012e, 0x0005, 0x0006, 0x3200, 0x9085, 0x1000, 0x0ca8, 0x0126,
-	0x2091, 0x2800, 0x2079, 0x19e7, 0x012e, 0x00d6, 0x2069, 0x19e7,
-	0x6803, 0x0005, 0x0156, 0x0146, 0x01d6, 0x20e9, 0x0000, 0x2069,
-	0x0200, 0x080c, 0xab07, 0x0401, 0x080c, 0xaaf2, 0x00e9, 0x080c,
-	0xaaf5, 0x00d1, 0x080c, 0xaaf8, 0x00b9, 0x080c, 0xaafb, 0x00a1,
-	0x080c, 0xaafe, 0x0089, 0x080c, 0xab01, 0x0071, 0x080c, 0xab04,
-	0x0059, 0x01de, 0x014e, 0x015e, 0x2069, 0x0004, 0x2d04, 0x9085,
-	0x8001, 0x206a, 0x00de, 0x0005, 0x20a9, 0x0020, 0x20a1, 0x0240,
-	0x2001, 0x0000, 0x4004, 0x0005, 0x00c6, 0x6027, 0x0001, 0x7804,
-	0x9084, 0x0007, 0x0002, 0x8fbd, 0x8fe1, 0x9020, 0x8fc3, 0x8fe1,
-	0x8fbd, 0x8fbb, 0x8fbb, 0x080c, 0x0dd5, 0x080c, 0x8550, 0x080c,
-	0x9664, 0x00ce, 0x0005, 0x62c0, 0x82ff, 0x1110, 0x00ce, 0x0005,
-	0x2011, 0x5e84, 0x080c, 0x84ca, 0x7828, 0x9092, 0x00c8, 0x1228,
-	0x8000, 0x782a, 0x080c, 0x5ec4, 0x0c88, 0x62c0, 0x080c, 0xac43,
-	0x080c, 0x5e84, 0x7807, 0x0003, 0x7827, 0x0000, 0x782b, 0x0000,
-	0x0c28, 0x080c, 0x8550, 0x6220, 0xd2a4, 0x0160, 0x782b, 0x0000,
-	0x7824, 0x9065, 0x090c, 0x0dd5, 0x2009, 0x0013, 0x080c, 0xaec2,
-	0x00ce, 0x0005, 0x00c6, 0x7824, 0x9065, 0x090c, 0x0dd5, 0x7828,
-	0x9092, 0xc350, 0x12c0, 0x8000, 0x782a, 0x00ce, 0x080c, 0x2ba5,
-	0x0278, 0x00c6, 0x7924, 0x2160, 0x6010, 0x906d, 0x090c, 0x0dd5,
-	0x7807, 0x0000, 0x7827, 0x0000, 0x00ce, 0x080c, 0x9664, 0x0c00,
-	0x080c, 0xa235, 0x08e8, 0x2011, 0x0130, 0x2214, 0x080c, 0xac43,
-	0x080c, 0xe9dd, 0x2009, 0x0014, 0x080c, 0xaec2, 0x00ce, 0x0880,
-	0x2001, 0x1a03, 0x2003, 0x0000, 0x62c0, 0x82ff, 0x1160, 0x782b,
+	0x0000, 0x187a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+	0x0126, 0x2091, 0x8000, 0x0036, 0x0046, 0x20a9, 0x0010, 0x9006,
+	0x8004, 0x2019, 0x0100, 0x231c, 0x93a6, 0x0008, 0x1118, 0x8086,
+	0x818e, 0x0020, 0x80f6, 0x3e00, 0x81f6, 0x3e08, 0x1208, 0x9200,
+	0x1f04, 0x8f49, 0x93a6, 0x0008, 0x1118, 0x8086, 0x818e, 0x0020,
+	0x80f6, 0x3e00, 0x81f6, 0x3e08, 0x004e, 0x003e, 0x012e, 0x0005,
+	0x0126, 0x2091, 0x8000, 0x0076, 0x0156, 0x20a9, 0x0010, 0x9005,
+	0x0510, 0x911a, 0x1600, 0x8213, 0x2039, 0x0100, 0x273c, 0x97be,
+	0x0008, 0x1110, 0x818d, 0x0010, 0x81f5, 0x3e08, 0x0228, 0x911a,
+	0x1220, 0x1f04, 0x8f73, 0x0028, 0x911a, 0x2308, 0x8210, 0x1f04,
+	0x8f73, 0x0006, 0x3200, 0x9084, 0xefff, 0x2080, 0x000e, 0x015e,
+	0x007e, 0x012e, 0x0005, 0x0006, 0x3200, 0x9085, 0x1000, 0x0ca8,
+	0x0126, 0x2091, 0x2800, 0x2079, 0x19e7, 0x012e, 0x00d6, 0x2069,
+	0x19e7, 0x6803, 0x0005, 0x0156, 0x0146, 0x01d6, 0x20e9, 0x0000,
+	0x2069, 0x0200, 0x080c, 0xab21, 0x0401, 0x080c, 0xab0c, 0x00e9,
+	0x080c, 0xab0f, 0x00d1, 0x080c, 0xab12, 0x00b9, 0x080c, 0xab15,
+	0x00a1, 0x080c, 0xab18, 0x0089, 0x080c, 0xab1b, 0x0071, 0x080c,
+	0xab1e, 0x0059, 0x01de, 0x014e, 0x015e, 0x2069, 0x0004, 0x2d04,
+	0x9085, 0x8001, 0x206a, 0x00de, 0x0005, 0x20a9, 0x0020, 0x20a1,
+	0x0240, 0x2001, 0x0000, 0x4004, 0x0005, 0x00c6, 0x6027, 0x0001,
+	0x7804, 0x9084, 0x0007, 0x0002, 0x8fe6, 0x900a, 0x9049, 0x8fec,
+	0x900a, 0x8fe6, 0x8fe4, 0x8fe4, 0x080c, 0x0dd5, 0x080c, 0x8579,
+	0x080c, 0x968d, 0x00ce, 0x0005, 0x62c0, 0x82ff, 0x1110, 0x00ce,
+	0x0005, 0x2011, 0x5e83, 0x080c, 0x84f3, 0x7828, 0x9092, 0x00c8,
+	0x1228, 0x8000, 0x782a, 0x080c, 0x5ec3, 0x0c88, 0x62c0, 0x080c,
+	0xac5d, 0x080c, 0x5e83, 0x7807, 0x0003, 0x7827, 0x0000, 0x782b,
+	0x0000, 0x0c28, 0x080c, 0x8579, 0x6220, 0xd2a4, 0x0160, 0x782b,
 	0x0000, 0x7824, 0x9065, 0x090c, 0x0dd5, 0x2009, 0x0013, 0x080c,
-	0xaf14, 0x00ce, 0x0005, 0x00b6, 0x00c6, 0x00d6, 0x7824, 0x9005,
-	0x090c, 0x0dd5, 0x7828, 0x9092, 0xc350, 0x1648, 0x8000, 0x782a,
-	0x00de, 0x00ce, 0x00be, 0x080c, 0x2ba5, 0x02f0, 0x00b6, 0x00c6,
-	0x00d6, 0x781c, 0x905d, 0x090c, 0x0dd5, 0xb800, 0xc0dc, 0xb802,
-	0x7924, 0x2160, 0x080c, 0xae47, 0xb93c, 0x81ff, 0x090c, 0x0dd5,
-	0x8109, 0xb93e, 0x7807, 0x0000, 0x7827, 0x0000, 0x00de, 0x00ce,
-	0x00be, 0x080c, 0x9664, 0x0868, 0x080c, 0xa235, 0x0850, 0x2011,
-	0x0130, 0x2214, 0x080c, 0xac43, 0x080c, 0xe9dd, 0x7824, 0x9065,
-	0x2009, 0x0014, 0x080c, 0xaec2, 0x00de, 0x00ce, 0x00be, 0x0804,
-	0x9031, 0x00c6, 0x2001, 0x009b, 0x2004, 0xd0fc, 0x190c, 0x1eb4,
-	0x6024, 0x6027, 0x0002, 0xd0f4, 0x15b8, 0x62c8, 0x60c4, 0x9205,
-	0x1170, 0x783c, 0x9065, 0x0130, 0x2009, 0x0049, 0x080c, 0xaec2,
-	0x00ce, 0x0005, 0x2011, 0x1a06, 0x2013, 0x0000, 0x0cc8, 0x793c,
-	0x81ff, 0x0dc0, 0x7944, 0x9192, 0x7530, 0x1628, 0x8108, 0x7946,
-	0x793c, 0x9188, 0x0008, 0x210c, 0x918e, 0x0006, 0x1138, 0x6014,
-	0x9084, 0x1984, 0x9085, 0x0012, 0x6016, 0x0c10, 0x793c, 0x9188,
-	0x0008, 0x210c, 0x918e, 0x0009, 0x0d90, 0x6014, 0x9084, 0x1984,
-	0x9085, 0x0016, 0x6016, 0x08a0, 0x793c, 0x2160, 0x2009, 0x004a,
-	0x080c, 0xaec2, 0x0868, 0x7848, 0xc085, 0x784a, 0x0848, 0x0006,
-	0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000, 0x2c08,
-	0x2061, 0x19e7, 0x6020, 0x8000, 0x6022, 0x6010, 0x9005, 0x0148,
-	0x9080, 0x0003, 0x2102, 0x6112, 0x012e, 0x00ce, 0x001e, 0x000e,
-	0x0005, 0x6116, 0x6112, 0x0cc0, 0x00d6, 0x2069, 0x19e7, 0xb800,
-	0xd0d4, 0x0168, 0x6820, 0x8000, 0x6822, 0x9086, 0x0001, 0x1110,
-	0x2b00, 0x681e, 0x00de, 0x0804, 0x9664, 0x00de, 0x0005, 0xc0d5,
-	0xb802, 0x6818, 0x9005, 0x0168, 0xb856, 0xb85b, 0x0000, 0x0086,
-	0x0006, 0x2b00, 0x681a, 0x008e, 0xa05a, 0x008e, 0x2069, 0x19e7,
-	0x0c08, 0xb856, 0xb85a, 0x2b00, 0x681a, 0x681e, 0x08d8, 0x0006,
-	0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000, 0x2c08,
-	0x2061, 0x19e7, 0x6020, 0x8000, 0x6022, 0x6008, 0x9005, 0x0148,
-	0x9080, 0x0003, 0x2102, 0x610a, 0x012e, 0x00ce, 0x001e, 0x000e,
-	0x0005, 0x610e, 0x610a, 0x0cc0, 0x00c6, 0x600f, 0x0000, 0x2c08,
-	0x2061, 0x19e7, 0x6034, 0x9005, 0x0130, 0x9080, 0x0003, 0x2102,
-	0x6136, 0x00ce, 0x0005, 0x613a, 0x6136, 0x00ce, 0x0005, 0x00f6,
-	0x00e6, 0x00d6, 0x00c6, 0x00b6, 0x0096, 0x0076, 0x0066, 0x0056,
-	0x0036, 0x0026, 0x0016, 0x0006, 0x0126, 0x902e, 0x2071, 0x19e7,
-	0x7638, 0x2660, 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904, 0x91b6,
-	0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x91b1, 0x87ff, 0x0120,
-	0x6054, 0x9106, 0x1904, 0x91b1, 0x703c, 0x9c06, 0x1178, 0x0036,
-	0x2019, 0x0001, 0x080c, 0xa59c, 0x7033, 0x0000, 0x9006, 0x703e,
-	0x7042, 0x7046, 0x704a, 0x003e, 0x2029, 0x0001, 0x7038, 0x9c36,
-	0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36,
-	0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x0066,
-	0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
-	0x080c, 0xcb1b, 0x01c8, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003,
-	0x1590, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036,
-	0x0076, 0x080c, 0xce0a, 0x080c, 0xe8e7, 0x080c, 0x6c79, 0x007e,
-	0x003e, 0x001e, 0x080c, 0xcd04, 0x080c, 0xae78, 0x00ce, 0x0804,
-	0x9155, 0x2c78, 0x600c, 0x2060, 0x0804, 0x9155, 0x85ff, 0x0120,
-	0x0036, 0x080c, 0x9790, 0x003e, 0x012e, 0x000e, 0x001e, 0x002e,
-	0x003e, 0x005e, 0x006e, 0x007e, 0x009e, 0x00be, 0x00ce, 0x00de,
-	0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086, 0x0006, 0x1158, 0x0016,
-	0x0036, 0x0076, 0x080c, 0xe8e7, 0x080c, 0xe530, 0x007e, 0x003e,
-	0x001e, 0x0890, 0x6020, 0x9086, 0x0009, 0x1168, 0xa87b, 0x0006,
-	0x0016, 0x0036, 0x0076, 0x080c, 0x6c79, 0x080c, 0xae47, 0x007e,
-	0x003e, 0x001e, 0x0818, 0x6020, 0x9086, 0x000a, 0x0904, 0x919b,
-	0x0804, 0x9199, 0x0006, 0x0066, 0x0096, 0x00c6, 0x00d6, 0x00f6,
-	0x9036, 0x0126, 0x2091, 0x8000, 0x2079, 0x19e7, 0x7838, 0x9065,
-	0x0904, 0x9242, 0x600c, 0x0006, 0x600f, 0x0000, 0x783c, 0x9c06,
-	0x1168, 0x0036, 0x2019, 0x0001, 0x080c, 0xa59c, 0x7833, 0x0000,
-	0x901e, 0x7b3e, 0x7b42, 0x7b46, 0x7b4a, 0x003e, 0x080c, 0xcb1b,
-	0x0520, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1568, 0x3e08,
-	0x918e, 0x0002, 0x1188, 0x6010, 0x9005, 0x0170, 0x00b6, 0x2058,
-	0xb800, 0x00be, 0xd0bc, 0x0140, 0x6040, 0x9005, 0x1180, 0x2001,
-	0x1988, 0x2004, 0x6042, 0x0058, 0xa867, 0x0103, 0xab7a, 0xa877,
-	0x0000, 0x080c, 0x6c6d, 0x080c, 0xcd04, 0x080c, 0xae78, 0x000e,
-	0x0804, 0x91ff, 0x7e3a, 0x7e36, 0x012e, 0x00fe, 0x00de, 0x00ce,
-	0x009e, 0x006e, 0x000e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118,
-	0x080c, 0xe530, 0x0c50, 0x6020, 0x9086, 0x0009, 0x1130, 0xab7a,
-	0x080c, 0x6c79, 0x080c, 0xae47, 0x0c10, 0x6020, 0x9086, 0x000a,
-	0x09a8, 0x0890, 0x0016, 0x0026, 0x0086, 0x9046, 0x0099, 0x080c,
-	0x934b, 0x008e, 0x002e, 0x001e, 0x0005, 0x00f6, 0x0126, 0x2079,
-	0x19e7, 0x2091, 0x8000, 0x080c, 0x93e2, 0x080c, 0x9470, 0x012e,
-	0x00fe, 0x0005, 0x00b6, 0x0096, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
-	0x0066, 0x0016, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7,
-	0x7614, 0x2660, 0x2678, 0x8cff, 0x0904, 0x9310, 0x6010, 0x2058,
-	0xb8a0, 0x9206, 0x1904, 0x930b, 0x88ff, 0x0120, 0x6054, 0x9106,
-	0x1904, 0x930b, 0x7024, 0x9c06, 0x1558, 0x2069, 0x0100, 0x6820,
-	0xd0a4, 0x1508, 0x080c, 0x8550, 0x080c, 0xa259, 0x68c3, 0x0000,
-	0x080c, 0xa7a2, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04,
+	0xaedc, 0x00ce, 0x0005, 0x00c6, 0x7824, 0x9065, 0x090c, 0x0dd5,
+	0x7828, 0x9092, 0xc350, 0x12c0, 0x8000, 0x782a, 0x00ce, 0x080c,
+	0x2ba5, 0x0278, 0x00c6, 0x7924, 0x2160, 0x6010, 0x906d, 0x090c,
+	0x0dd5, 0x7807, 0x0000, 0x7827, 0x0000, 0x00ce, 0x080c, 0x968d,
+	0x0c00, 0x080c, 0xa24f, 0x08e8, 0x2011, 0x0130, 0x2214, 0x080c,
+	0xac5d, 0x080c, 0xe9fe, 0x2009, 0x0014, 0x080c, 0xaedc, 0x00ce,
+	0x0880, 0x2001, 0x1a03, 0x2003, 0x0000, 0x62c0, 0x82ff, 0x1160,
+	0x782b, 0x0000, 0x7824, 0x9065, 0x090c, 0x0dd5, 0x2009, 0x0013,
+	0x080c, 0xaf2e, 0x00ce, 0x0005, 0x00b6, 0x00c6, 0x00d6, 0x7824,
+	0x9005, 0x090c, 0x0dd5, 0x7828, 0x9092, 0xc350, 0x1648, 0x8000,
+	0x782a, 0x00de, 0x00ce, 0x00be, 0x080c, 0x2ba5, 0x02f0, 0x00b6,
+	0x00c6, 0x00d6, 0x781c, 0x905d, 0x090c, 0x0dd5, 0xb800, 0xc0dc,
+	0xb802, 0x7924, 0x2160, 0x080c, 0xae61, 0xb93c, 0x81ff, 0x090c,
+	0x0dd5, 0x8109, 0xb93e, 0x7807, 0x0000, 0x7827, 0x0000, 0x00de,
+	0x00ce, 0x00be, 0x080c, 0x968d, 0x0868, 0x080c, 0xa24f, 0x0850,
+	0x2011, 0x0130, 0x2214, 0x080c, 0xac5d, 0x080c, 0xe9fe, 0x7824,
+	0x9065, 0x2009, 0x0014, 0x080c, 0xaedc, 0x00de, 0x00ce, 0x00be,
+	0x0804, 0x905a, 0x00c6, 0x2001, 0x009b, 0x2004, 0xd0fc, 0x190c,
+	0x1eb4, 0x6024, 0x6027, 0x0002, 0xd0f4, 0x15b8, 0x62c8, 0x60c4,
+	0x9205, 0x1170, 0x783c, 0x9065, 0x0130, 0x2009, 0x0049, 0x080c,
+	0xaedc, 0x00ce, 0x0005, 0x2011, 0x1a06, 0x2013, 0x0000, 0x0cc8,
+	0x793c, 0x81ff, 0x0dc0, 0x7944, 0x9192, 0x7530, 0x1628, 0x8108,
+	0x7946, 0x793c, 0x9188, 0x0008, 0x210c, 0x918e, 0x0006, 0x1138,
+	0x6014, 0x9084, 0x1984, 0x9085, 0x0012, 0x6016, 0x0c10, 0x793c,
+	0x9188, 0x0008, 0x210c, 0x918e, 0x0009, 0x0d90, 0x6014, 0x9084,
+	0x1984, 0x9085, 0x0016, 0x6016, 0x08a0, 0x793c, 0x2160, 0x2009,
+	0x004a, 0x080c, 0xaedc, 0x0868, 0x7848, 0xc085, 0x784a, 0x0848,
+	0x0006, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000,
+	0x2c08, 0x2061, 0x19e7, 0x6020, 0x8000, 0x6022, 0x6010, 0x9005,
+	0x0148, 0x9080, 0x0003, 0x2102, 0x6112, 0x012e, 0x00ce, 0x001e,
+	0x000e, 0x0005, 0x6116, 0x6112, 0x0cc0, 0x00d6, 0x2069, 0x19e7,
+	0xb800, 0xd0d4, 0x0168, 0x6820, 0x8000, 0x6822, 0x9086, 0x0001,
+	0x1110, 0x2b00, 0x681e, 0x00de, 0x0804, 0x968d, 0x00de, 0x0005,
+	0xc0d5, 0xb802, 0x6818, 0x9005, 0x0168, 0xb856, 0xb85b, 0x0000,
+	0x0086, 0x0006, 0x2b00, 0x681a, 0x008e, 0xa05a, 0x008e, 0x2069,
+	0x19e7, 0x0c08, 0xb856, 0xb85a, 0x2b00, 0x681a, 0x681e, 0x08d8,
+	0x0006, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f, 0x0000,
+	0x2c08, 0x2061, 0x19e7, 0x6020, 0x8000, 0x6022, 0x6008, 0x9005,
+	0x0148, 0x9080, 0x0003, 0x2102, 0x610a, 0x012e, 0x00ce, 0x001e,
+	0x000e, 0x0005, 0x610e, 0x610a, 0x0cc0, 0x00c6, 0x600f, 0x0000,
+	0x2c08, 0x2061, 0x19e7, 0x6034, 0x9005, 0x0130, 0x9080, 0x0003,
+	0x2102, 0x6136, 0x00ce, 0x0005, 0x613a, 0x6136, 0x00ce, 0x0005,
+	0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00b6, 0x0096, 0x0076, 0x0066,
+	0x0056, 0x0036, 0x0026, 0x0016, 0x0006, 0x0126, 0x902e, 0x2071,
+	0x19e7, 0x7638, 0x2660, 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904,
+	0x91df, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x91da, 0x87ff,
+	0x0120, 0x6054, 0x9106, 0x1904, 0x91da, 0x703c, 0x9c06, 0x1178,
+	0x0036, 0x2019, 0x0001, 0x080c, 0xa5b6, 0x7033, 0x0000, 0x9006,
+	0x703e, 0x7042, 0x7046, 0x704a, 0x003e, 0x2029, 0x0001, 0x7038,
+	0x9c36, 0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00,
+	0x9f36, 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c,
+	0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
+	0x0000, 0x080c, 0xcb35, 0x01c8, 0x6014, 0x2048, 0x6020, 0x9086,
+	0x0003, 0x1590, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016,
+	0x0036, 0x0076, 0x080c, 0xce24, 0x080c, 0xe908, 0x080c, 0x6c81,
+	0x007e, 0x003e, 0x001e, 0x080c, 0xcd1e, 0x080c, 0xae92, 0x00ce,
+	0x0804, 0x917e, 0x2c78, 0x600c, 0x2060, 0x0804, 0x917e, 0x85ff,
+	0x0120, 0x0036, 0x080c, 0x97b9, 0x003e, 0x012e, 0x000e, 0x001e,
+	0x002e, 0x003e, 0x005e, 0x006e, 0x007e, 0x009e, 0x00be, 0x00ce,
+	0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086, 0x0006, 0x1158,
+	0x0016, 0x0036, 0x0076, 0x080c, 0xe908, 0x080c, 0xe551, 0x007e,
+	0x003e, 0x001e, 0x0890, 0x6020, 0x9086, 0x0009, 0x1168, 0xa87b,
+	0x0006, 0x0016, 0x0036, 0x0076, 0x080c, 0x6c81, 0x080c, 0xae61,
+	0x007e, 0x003e, 0x001e, 0x0818, 0x6020, 0x9086, 0x000a, 0x0904,
+	0x91c4, 0x0804, 0x91c2, 0x0006, 0x0066, 0x0096, 0x00c6, 0x00d6,
+	0x00f6, 0x9036, 0x0126, 0x2091, 0x8000, 0x2079, 0x19e7, 0x7838,
+	0x9065, 0x0904, 0x926b, 0x600c, 0x0006, 0x600f, 0x0000, 0x783c,
+	0x9c06, 0x1168, 0x0036, 0x2019, 0x0001, 0x080c, 0xa5b6, 0x7833,
+	0x0000, 0x901e, 0x7b3e, 0x7b42, 0x7b46, 0x7b4a, 0x003e, 0x080c,
+	0xcb35, 0x0520, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1568,
+	0x3e08, 0x918e, 0x0002, 0x1188, 0x6010, 0x9005, 0x0170, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0bc, 0x0140, 0x6040, 0x9005, 0x1180,
+	0x2001, 0x1988, 0x2004, 0x6042, 0x0058, 0xa867, 0x0103, 0xab7a,
+	0xa877, 0x0000, 0x080c, 0x6c75, 0x080c, 0xcd1e, 0x080c, 0xae92,
+	0x000e, 0x0804, 0x9228, 0x7e3a, 0x7e36, 0x012e, 0x00fe, 0x00de,
+	0x00ce, 0x009e, 0x006e, 0x000e, 0x0005, 0x6020, 0x9086, 0x0006,
+	0x1118, 0x080c, 0xe551, 0x0c50, 0x6020, 0x9086, 0x0009, 0x1130,
+	0xab7a, 0x080c, 0x6c81, 0x080c, 0xae61, 0x0c10, 0x6020, 0x9086,
+	0x000a, 0x09a8, 0x0890, 0x0016, 0x0026, 0x0086, 0x9046, 0x0099,
+	0x080c, 0x9374, 0x008e, 0x002e, 0x001e, 0x0005, 0x00f6, 0x0126,
+	0x2079, 0x19e7, 0x2091, 0x8000, 0x080c, 0x940b, 0x080c, 0x9499,
+	0x012e, 0x00fe, 0x0005, 0x00b6, 0x0096, 0x00f6, 0x00e6, 0x00d6,
+	0x00c6, 0x0066, 0x0016, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071,
+	0x19e7, 0x7614, 0x2660, 0x2678, 0x8cff, 0x0904, 0x9339, 0x6010,
+	0x2058, 0xb8a0, 0x9206, 0x1904, 0x9334, 0x88ff, 0x0120, 0x6054,
+	0x9106, 0x1904, 0x9334, 0x7024, 0x9c06, 0x1558, 0x2069, 0x0100,
+	0x6820, 0xd0a4, 0x1508, 0x080c, 0x8579, 0x080c, 0xa273, 0x68c3,
+	0x0000, 0x080c, 0xa7bc, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140,
+	0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2cef,
+	0x9006, 0x080c, 0x2cef, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110,
+	0x6827, 0x0001, 0x003e, 0x0028, 0x6003, 0x0009, 0x630a, 0x0804,
+	0x9334, 0x7014, 0x9c36, 0x1110, 0x660c, 0x7616, 0x7010, 0x9c36,
+	0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7012, 0x0010, 0x7013,
+	0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008,
+	0x2678, 0x600f, 0x0000, 0x6014, 0x2048, 0x080c, 0xcb35, 0x01e8,
+	0x6020, 0x9086, 0x0003, 0x1580, 0x080c, 0xcd3b, 0x1118, 0x080c,
+	0xb813, 0x0098, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016,
+	0x0036, 0x0086, 0x080c, 0xce24, 0x080c, 0xe908, 0x080c, 0x6c81,
+	0x008e, 0x003e, 0x001e, 0x080c, 0xcd1e, 0x080c, 0xae92, 0x080c,
+	0xa692, 0x00ce, 0x0804, 0x92b4, 0x2c78, 0x600c, 0x2060, 0x0804,
+	0x92b4, 0x012e, 0x000e, 0x001e, 0x006e, 0x00ce, 0x00de, 0x00ee,
+	0x00fe, 0x009e, 0x00be, 0x0005, 0x6020, 0x9086, 0x0006, 0x1158,
+	0x0016, 0x0036, 0x0086, 0x080c, 0xe908, 0x080c, 0xe551, 0x008e,
+	0x003e, 0x001e, 0x08d0, 0x080c, 0xb813, 0x6020, 0x9086, 0x0002,
+	0x1160, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0904, 0x931a,
+	0x9086, 0x008b, 0x0904, 0x931a, 0x0840, 0x6020, 0x9086, 0x0005,
+	0x1920, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x09c8, 0x9086,
+	0x008b, 0x09b0, 0x0804, 0x932d, 0x00b6, 0x00a6, 0x0096, 0x00c6,
+	0x0006, 0x0126, 0x2091, 0x8000, 0x9280, 0x1000, 0x2004, 0x905d,
+	0x0904, 0x9404, 0x00f6, 0x00e6, 0x00d6, 0x0066, 0x2071, 0x19e7,
+	0xbe54, 0x7018, 0x9b06, 0x1108, 0x761a, 0x701c, 0x9b06, 0x1130,
+	0x86ff, 0x1118, 0x7018, 0x701e, 0x0008, 0x761e, 0xb858, 0x904d,
+	0x0108, 0xae56, 0x96d5, 0x0000, 0x0110, 0x2900, 0xb05a, 0xb857,
+	0x0000, 0xb85b, 0x0000, 0xb800, 0xc0d4, 0xc0dc, 0xb802, 0x080c,
+	0x6531, 0x0904, 0x9400, 0x7624, 0x86ff, 0x0904, 0x93ef, 0x9680,
+	0x0005, 0x2004, 0x9906, 0x15d8, 0x00d6, 0x2069, 0x0100, 0x68c0,
+	0x9005, 0x0560, 0x080c, 0x8579, 0x080c, 0xa273, 0x68c3, 0x0000,
+	0x080c, 0xa7bc, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04,
 	0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2cef, 0x9006,
 	0x080c, 0x2cef, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827,
-	0x0001, 0x003e, 0x0028, 0x6003, 0x0009, 0x630a, 0x0804, 0x930b,
-	0x7014, 0x9c36, 0x1110, 0x660c, 0x7616, 0x7010, 0x9c36, 0x1140,
-	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7012, 0x0010, 0x7013, 0x0000,
-	0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678,
-	0x600f, 0x0000, 0x6014, 0x2048, 0x080c, 0xcb1b, 0x01e8, 0x6020,
-	0x9086, 0x0003, 0x1580, 0x080c, 0xcd21, 0x1118, 0x080c, 0xb7f9,
-	0x0098, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036,
-	0x0086, 0x080c, 0xce0a, 0x080c, 0xe8e7, 0x080c, 0x6c79, 0x008e,
-	0x003e, 0x001e, 0x080c, 0xcd04, 0x080c, 0xae78, 0x080c, 0xa678,
-	0x00ce, 0x0804, 0x928b, 0x2c78, 0x600c, 0x2060, 0x0804, 0x928b,
-	0x012e, 0x000e, 0x001e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
-	0x009e, 0x00be, 0x0005, 0x6020, 0x9086, 0x0006, 0x1158, 0x0016,
-	0x0036, 0x0086, 0x080c, 0xe8e7, 0x080c, 0xe530, 0x008e, 0x003e,
-	0x001e, 0x08d0, 0x080c, 0xb7f9, 0x6020, 0x9086, 0x0002, 0x1160,
-	0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0904, 0x92f1, 0x9086,
-	0x008b, 0x0904, 0x92f1, 0x0840, 0x6020, 0x9086, 0x0005, 0x1920,
-	0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x09c8, 0x9086, 0x008b,
-	0x09b0, 0x0804, 0x9304, 0x00b6, 0x00a6, 0x0096, 0x00c6, 0x0006,
-	0x0126, 0x2091, 0x8000, 0x9280, 0x1000, 0x2004, 0x905d, 0x0904,
-	0x93db, 0x00f6, 0x00e6, 0x00d6, 0x0066, 0x2071, 0x19e7, 0xbe54,
-	0x7018, 0x9b06, 0x1108, 0x761a, 0x701c, 0x9b06, 0x1130, 0x86ff,
-	0x1118, 0x7018, 0x701e, 0x0008, 0x761e, 0xb858, 0x904d, 0x0108,
-	0xae56, 0x96d5, 0x0000, 0x0110, 0x2900, 0xb05a, 0xb857, 0x0000,
-	0xb85b, 0x0000, 0xb800, 0xc0d4, 0xc0dc, 0xb802, 0x080c, 0x6532,
-	0x0904, 0x93d7, 0x7624, 0x86ff, 0x0904, 0x93c6, 0x9680, 0x0005,
-	0x2004, 0x9906, 0x15d8, 0x00d6, 0x2069, 0x0100, 0x68c0, 0x9005,
-	0x0560, 0x080c, 0x8550, 0x080c, 0xa259, 0x68c3, 0x0000, 0x080c,
-	0xa7a2, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384,
+	0x0001, 0x003e, 0x00de, 0x00c6, 0xb83c, 0x9005, 0x0110, 0x8001,
+	0xb83e, 0x2660, 0x080c, 0xae92, 0x00ce, 0x0048, 0x00de, 0x00c6,
+	0x2660, 0x6003, 0x0009, 0x630a, 0x00ce, 0x0804, 0x93a7, 0x89ff,
+	0x0158, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xce24,
+	0x080c, 0xe908, 0x080c, 0x6c81, 0x080c, 0xa692, 0x0804, 0x93a7,
+	0x006e, 0x00de, 0x00ee, 0x00fe, 0x012e, 0x000e, 0x00ce, 0x009e,
+	0x00ae, 0x00be, 0x0005, 0x0096, 0x0006, 0x0066, 0x00c6, 0x00d6,
+	0x9036, 0x7814, 0x9065, 0x0904, 0x946c, 0x600c, 0x0006, 0x600f,
+	0x0000, 0x7824, 0x9c06, 0x1570, 0x2069, 0x0100, 0x6820, 0xd0a4,
+	0x1508, 0x080c, 0x8579, 0x080c, 0xa273, 0x68c3, 0x0000, 0x080c,
+	0xa7bc, 0x7827, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384,
+	0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2cef, 0x9006, 0x080c,
+	0x2cef, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001,
+	0x003e, 0x0040, 0x080c, 0x690a, 0x1520, 0x6003, 0x0009, 0x630a,
+	0x2c30, 0x00f8, 0x6014, 0x2048, 0x080c, 0xcb33, 0x01b0, 0x6020,
+	0x9086, 0x0003, 0x1508, 0x080c, 0xcd3b, 0x1118, 0x080c, 0xb813,
+	0x0060, 0x080c, 0x690a, 0x1168, 0xa867, 0x0103, 0xab7a, 0xa877,
+	0x0000, 0x080c, 0x6c81, 0x080c, 0xcd1e, 0x080c, 0xae92, 0x080c,
+	0xa692, 0x000e, 0x0804, 0x9412, 0x7e16, 0x7e12, 0x00de, 0x00ce,
+	0x006e, 0x000e, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118,
+	0x080c, 0xe551, 0x0c50, 0x080c, 0xb813, 0x6020, 0x9086, 0x0002,
+	0x1150, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0990, 0x9086,
+	0x008b, 0x0978, 0x08d0, 0x6020, 0x9086, 0x0005, 0x19b0, 0x6004,
+	0x0006, 0x9086, 0x0085, 0x000e, 0x0d18, 0x9086, 0x008b, 0x0d00,
+	0x0860, 0x0006, 0x0066, 0x0096, 0x00b6, 0x00c6, 0x00d6, 0x7818,
+	0x905d, 0x0904, 0x9519, 0xb854, 0x0006, 0x9006, 0xb856, 0xb85a,
+	0xb800, 0xc0d4, 0xc0dc, 0xb802, 0x080c, 0x6531, 0x0904, 0x9516,
+	0x7e24, 0x86ff, 0x0904, 0x9509, 0x9680, 0x0005, 0x2004, 0x9906,
+	0x1904, 0x9509, 0x00d6, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904,
+	0x9500, 0x080c, 0x8579, 0x080c, 0xa273, 0x68c3, 0x0000, 0x080c,
+	0xa7bc, 0x7827, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384,
 	0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2cef, 0x9006, 0x080c,
 	0x2cef, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001,
-	0x003e, 0x00de, 0x00c6, 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e,
-	0x2660, 0x080c, 0xae78, 0x00ce, 0x0048, 0x00de, 0x00c6, 0x2660,
-	0x6003, 0x0009, 0x630a, 0x00ce, 0x0804, 0x937e, 0x89ff, 0x0158,
-	0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xce0a, 0x080c,
-	0xe8e7, 0x080c, 0x6c79, 0x080c, 0xa678, 0x0804, 0x937e, 0x006e,
-	0x00de, 0x00ee, 0x00fe, 0x012e, 0x000e, 0x00ce, 0x009e, 0x00ae,
-	0x00be, 0x0005, 0x0096, 0x0006, 0x0066, 0x00c6, 0x00d6, 0x9036,
-	0x7814, 0x9065, 0x0904, 0x9443, 0x600c, 0x0006, 0x600f, 0x0000,
-	0x7824, 0x9c06, 0x1570, 0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508,
-	0x080c, 0x8550, 0x080c, 0xa259, 0x68c3, 0x0000, 0x080c, 0xa7a2,
-	0x7827, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
-	0x0138, 0x2001, 0x0100, 0x080c, 0x2cef, 0x9006, 0x080c, 0x2cef,
-	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
-	0x0040, 0x080c, 0x6902, 0x1520, 0x6003, 0x0009, 0x630a, 0x2c30,
-	0x00f8, 0x6014, 0x2048, 0x080c, 0xcb19, 0x01b0, 0x6020, 0x9086,
-	0x0003, 0x1508, 0x080c, 0xcd21, 0x1118, 0x080c, 0xb7f9, 0x0060,
-	0x080c, 0x6902, 0x1168, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
-	0x080c, 0x6c79, 0x080c, 0xcd04, 0x080c, 0xae78, 0x080c, 0xa678,
-	0x000e, 0x0804, 0x93e9, 0x7e16, 0x7e12, 0x00de, 0x00ce, 0x006e,
-	0x000e, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118, 0x080c,
-	0xe530, 0x0c50, 0x080c, 0xb7f9, 0x6020, 0x9086, 0x0002, 0x1150,
-	0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0990, 0x9086, 0x008b,
-	0x0978, 0x08d0, 0x6020, 0x9086, 0x0005, 0x19b0, 0x6004, 0x0006,
-	0x9086, 0x0085, 0x000e, 0x0d18, 0x9086, 0x008b, 0x0d00, 0x0860,
-	0x0006, 0x0066, 0x0096, 0x00b6, 0x00c6, 0x00d6, 0x7818, 0x905d,
-	0x0904, 0x94f0, 0xb854, 0x0006, 0x9006, 0xb856, 0xb85a, 0xb800,
-	0xc0d4, 0xc0dc, 0xb802, 0x080c, 0x6532, 0x0904, 0x94ed, 0x7e24,
-	0x86ff, 0x0904, 0x94e0, 0x9680, 0x0005, 0x2004, 0x9906, 0x1904,
-	0x94e0, 0x00d6, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0x94d7,
-	0x080c, 0x8550, 0x080c, 0xa259, 0x68c3, 0x0000, 0x080c, 0xa7a2,
-	0x7827, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
-	0x0138, 0x2001, 0x0100, 0x080c, 0x2cef, 0x9006, 0x080c, 0x2cef,
-	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
-	0x00de, 0x00c6, 0x3e08, 0x918e, 0x0002, 0x1168, 0xb800, 0xd0bc,
-	0x0150, 0x9680, 0x0010, 0x200c, 0x81ff, 0x1518, 0x2009, 0x1988,
-	0x210c, 0x2102, 0x00f0, 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e,
-	0x2660, 0x600f, 0x0000, 0x080c, 0xae78, 0x00ce, 0x0048, 0x00de,
-	0x00c6, 0x2660, 0x6003, 0x0009, 0x630a, 0x00ce, 0x0804, 0x9483,
-	0x89ff, 0x0138, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
-	0x6c79, 0x080c, 0xa678, 0x0804, 0x9483, 0x000e, 0x0804, 0x9477,
-	0x781e, 0x781a, 0x00de, 0x00ce, 0x00be, 0x009e, 0x006e, 0x000e,
-	0x0005, 0x00e6, 0x00d6, 0x0096, 0x0066, 0xb800, 0xd0dc, 0x01a0,
-	0xb84c, 0x904d, 0x0188, 0xa878, 0x9606, 0x1170, 0x2071, 0x19e7,
-	0x7024, 0x9035, 0x0148, 0x9080, 0x0005, 0x2004, 0x9906, 0x1120,
-	0xb800, 0xc0dc, 0xb802, 0x0029, 0x006e, 0x009e, 0x00de, 0x00ee,
-	0x0005, 0x00f6, 0x2079, 0x0100, 0x78c0, 0x9005, 0x1138, 0x00c6,
-	0x2660, 0x6003, 0x0009, 0x630a, 0x00ce, 0x04b8, 0x080c, 0xa259,
-	0x78c3, 0x0000, 0x080c, 0xa7a2, 0x7027, 0x0000, 0x0036, 0x2079,
-	0x0140, 0x7b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
-	0x2cef, 0x9006, 0x080c, 0x2cef, 0x2079, 0x0100, 0x7824, 0xd084,
-	0x0110, 0x7827, 0x0001, 0x080c, 0xa7a2, 0x003e, 0x080c, 0x6532,
-	0x00c6, 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660, 0x080c,
-	0xae47, 0x00ce, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
-	0xce0a, 0x080c, 0x6c79, 0x080c, 0xa678, 0x00fe, 0x0005, 0x00b6,
-	0x00e6, 0x00c6, 0x2011, 0x0101, 0x2204, 0xc0c4, 0x2012, 0x2001,
-	0x180c, 0x2014, 0xc2e4, 0x2202, 0x2071, 0x19e7, 0x7004, 0x9084,
-	0x0007, 0x0002, 0x957c, 0x9580, 0x9597, 0x95c0, 0x95fe, 0x957c,
-	0x9597, 0x957a, 0x080c, 0x0dd5, 0x00ce, 0x00ee, 0x00be, 0x0005,
-	0x7024, 0x9065, 0x0148, 0x7020, 0x8001, 0x7022, 0x600c, 0x9015,
-	0x0158, 0x7216, 0x600f, 0x0000, 0x7007, 0x0000, 0x7027, 0x0000,
-	0x00ce, 0x00ee, 0x00be, 0x0005, 0x7216, 0x7212, 0x0ca8, 0x6010,
-	0x2058, 0x080c, 0x6532, 0xb800, 0xc0dc, 0xb802, 0x7007, 0x0000,
-	0x7027, 0x0000, 0x7020, 0x8001, 0x7022, 0x1148, 0x2001, 0x180c,
-	0x2014, 0xd2ec, 0x1180, 0x00ce, 0x00ee, 0x00be, 0x0005, 0xb854,
-	0x9015, 0x0120, 0x721e, 0x080c, 0x9664, 0x0ca8, 0x7218, 0x721e,
-	0x080c, 0x9664, 0x0c80, 0xc2ec, 0x2202, 0x080c, 0x9790, 0x0c58,
-	0x7024, 0x9065, 0x05b8, 0x700c, 0x9c06, 0x1160, 0x080c, 0xa678,
-	0x600c, 0x9015, 0x0120, 0x720e, 0x600f, 0x0000, 0x0448, 0x720e,
-	0x720a, 0x0430, 0x7014, 0x9c06, 0x1160, 0x080c, 0xa678, 0x600c,
-	0x9015, 0x0120, 0x7216, 0x600f, 0x0000, 0x00d0, 0x7216, 0x7212,
-	0x00b8, 0x6020, 0x9086, 0x0003, 0x1198, 0x6010, 0x2058, 0x080c,
-	0x6532, 0xb800, 0xc0dc, 0xb802, 0x080c, 0xa678, 0x701c, 0x9065,
-	0x0138, 0xb854, 0x9015, 0x0110, 0x721e, 0x0010, 0x7218, 0x721e,
-	0x7027, 0x0000, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7024, 0x9065,
-	0x0140, 0x080c, 0xa678, 0x600c, 0x9015, 0x0158, 0x720e, 0x600f,
-	0x0000, 0x080c, 0xa7a2, 0x7027, 0x0000, 0x00ce, 0x00ee, 0x00be,
-	0x0005, 0x720e, 0x720a, 0x0ca8, 0x00d6, 0x2069, 0x19e7, 0x6830,
-	0x9084, 0x0003, 0x0002, 0x9621, 0x9623, 0x9647, 0x961f, 0x080c,
-	0x0dd5, 0x00de, 0x0005, 0x00c6, 0x6840, 0x9086, 0x0001, 0x01b8,
-	0x683c, 0x9065, 0x0130, 0x600c, 0x9015, 0x0170, 0x6a3a, 0x600f,
-	0x0000, 0x6833, 0x0000, 0x683f, 0x0000, 0x2011, 0x1a06, 0x2013,
-	0x0000, 0x00ce, 0x00de, 0x0005, 0x683a, 0x6836, 0x0c90, 0x6843,
-	0x0000, 0x6838, 0x9065, 0x0d68, 0x6003, 0x0003, 0x0c50, 0x00c6,
-	0x9006, 0x6842, 0x6846, 0x684a, 0x683c, 0x9065, 0x0160, 0x600c,
-	0x9015, 0x0130, 0x6a3a, 0x600f, 0x0000, 0x683f, 0x0000, 0x0018,
-	0x683e, 0x683a, 0x6836, 0x00ce, 0x00de, 0x0005, 0x2001, 0x180c,
-	0x200c, 0xc1e5, 0x2102, 0x0005, 0x2001, 0x180c, 0x200c, 0xd1ec,
-	0x0120, 0xc1ec, 0x2102, 0x080c, 0x9790, 0x2001, 0x19f3, 0x2004,
-	0x9086, 0x0001, 0x0d58, 0x00d6, 0x2069, 0x19e7, 0x6804, 0x9084,
-	0x0007, 0x0006, 0x9005, 0x11c8, 0x2001, 0x1837, 0x2004, 0x9084,
-	0x0028, 0x1198, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x0168,
-	0x2001, 0x188b, 0x2004, 0xd08c, 0x1118, 0xd084, 0x1118, 0x0028,
-	0x080c, 0x9790, 0x000e, 0x00de, 0x0005, 0x000e, 0x0002, 0x96a1,
-	0x975e, 0x975e, 0x975e, 0x975e, 0x9760, 0x975e, 0x969f, 0x080c,
-	0x0dd5, 0x6820, 0x9005, 0x1110, 0x00de, 0x0005, 0x00c6, 0x680c,
-	0x9065, 0x0520, 0x6114, 0x0096, 0x2148, 0xa964, 0x009e, 0x918c,
-	0x00ff, 0x918e, 0x0035, 0x1180, 0x2009, 0x1837, 0x210c, 0x918c,
-	0x0028, 0x1150, 0x080c, 0x73b0, 0x0138, 0x0006, 0x2009, 0x188b,
-	0x2104, 0xc095, 0x200a, 0x000e, 0x6807, 0x0004, 0x6826, 0x682b,
-	0x0000, 0x080c, 0x9838, 0x00ce, 0x00de, 0x0005, 0x6814, 0x9065,
-	0x0150, 0x6807, 0x0001, 0x6826, 0x682b, 0x0000, 0x080c, 0x9838,
-	0x00ce, 0x00de, 0x0005, 0x00b6, 0x00e6, 0x6a1c, 0x92dd, 0x0000,
-	0x0904, 0x974a, 0xb84c, 0x900d, 0x0118, 0xb888, 0x9005, 0x01a0,
-	0xb854, 0x905d, 0x0120, 0x920e, 0x0904, 0x974a, 0x0028, 0x6818,
-	0x920e, 0x0904, 0x974a, 0x2058, 0xb84c, 0x900d, 0x0d88, 0xb888,
-	0x9005, 0x1d70, 0x2b00, 0x681e, 0xbb3c, 0xb838, 0x9302, 0x1e40,
-	0x080c, 0xae1e, 0x0904, 0x974a, 0x8318, 0xbb3e, 0x6116, 0x2b10,
-	0x6212, 0x0096, 0x2148, 0xa880, 0x9084, 0x00ff, 0x605e, 0xa883,
-	0x0000, 0xa884, 0x009e, 0x908a, 0x199a, 0x0210, 0x2001, 0x1999,
-	0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x6114, 0x0096, 0x2148,
-	0xa964, 0x009e, 0x918c, 0x00ff, 0x918e, 0x0048, 0x0538, 0x00f6,
-	0x2c78, 0x2061, 0x0100, 0xbac0, 0x629a, 0x2069, 0x0200, 0x2071,
-	0x0240, 0x080c, 0x9d85, 0x2069, 0x19e7, 0xbb00, 0xc3dd, 0xbb02,
-	0x6807, 0x0002, 0x2f18, 0x6b26, 0x682b, 0x0000, 0x7823, 0x0003,
-	0x7803, 0x0001, 0x7807, 0x0040, 0x00fe, 0x00ee, 0x00be, 0x00ce,
-	0x00de, 0x0005, 0x00ee, 0x00be, 0x00ce, 0x0cd0, 0xbb00, 0xc3dd,
-	0xbb02, 0x6807, 0x0006, 0x2f18, 0x6b26, 0x682b, 0x0000, 0x080c,
-	0xac63, 0x00ee, 0x00be, 0x00ce, 0x00de, 0x0005, 0x00de, 0x0005,
-	0x00c6, 0x680c, 0x9065, 0x0508, 0x6114, 0x0096, 0x2148, 0xa964,
-	0x009e, 0x918c, 0x00ff, 0x918e, 0x0035, 0x1180, 0x2009, 0x1837,
-	0x210c, 0x918c, 0x0028, 0x1150, 0x080c, 0x73b0, 0x0138, 0x0006,
-	0x2009, 0x188b, 0x2104, 0xc095, 0x200a, 0x000e, 0x6807, 0x0004,
-	0x6826, 0x682b, 0x0000, 0x080c, 0x9838, 0x00ce, 0x00de, 0x0005,
-	0x2001, 0x180c, 0x2014, 0xc2ed, 0x2202, 0x00de, 0x00fe, 0x0005,
-	0x00f6, 0x00d6, 0x2069, 0x19e7, 0x6830, 0x9086, 0x0000, 0x1570,
-	0x2001, 0x180c, 0x2014, 0xd2e4, 0x0130, 0xc2e4, 0x2202, 0x080c,
-	0x9673, 0x2069, 0x19e7, 0x2001, 0x180c, 0x200c, 0xd1c4, 0x1508,
-	0x6838, 0x907d, 0x01d8, 0x6a04, 0x9296, 0x0000, 0x1904, 0x9831,
-	0x7920, 0x918e, 0x0009, 0x0588, 0x6833, 0x0001, 0x683e, 0x6847,
+	0x003e, 0x00de, 0x00c6, 0x3e08, 0x918e, 0x0002, 0x1168, 0xb800,
+	0xd0bc, 0x0150, 0x9680, 0x0010, 0x200c, 0x81ff, 0x1518, 0x2009,
+	0x1988, 0x210c, 0x2102, 0x00f0, 0xb83c, 0x9005, 0x0110, 0x8001,
+	0xb83e, 0x2660, 0x600f, 0x0000, 0x080c, 0xae92, 0x00ce, 0x0048,
+	0x00de, 0x00c6, 0x2660, 0x6003, 0x0009, 0x630a, 0x00ce, 0x0804,
+	0x94ac, 0x89ff, 0x0138, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
+	0x080c, 0x6c81, 0x080c, 0xa692, 0x0804, 0x94ac, 0x000e, 0x0804,
+	0x94a0, 0x781e, 0x781a, 0x00de, 0x00ce, 0x00be, 0x009e, 0x006e,
+	0x000e, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x0066, 0xb800, 0xd0dc,
+	0x01a0, 0xb84c, 0x904d, 0x0188, 0xa878, 0x9606, 0x1170, 0x2071,
+	0x19e7, 0x7024, 0x9035, 0x0148, 0x9080, 0x0005, 0x2004, 0x9906,
+	0x1120, 0xb800, 0xc0dc, 0xb802, 0x0029, 0x006e, 0x009e, 0x00de,
+	0x00ee, 0x0005, 0x00f6, 0x2079, 0x0100, 0x78c0, 0x9005, 0x1138,
+	0x00c6, 0x2660, 0x6003, 0x0009, 0x630a, 0x00ce, 0x04b8, 0x080c,
+	0xa273, 0x78c3, 0x0000, 0x080c, 0xa7bc, 0x7027, 0x0000, 0x0036,
+	0x2079, 0x0140, 0x7b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100,
+	0x080c, 0x2cef, 0x9006, 0x080c, 0x2cef, 0x2079, 0x0100, 0x7824,
+	0xd084, 0x0110, 0x7827, 0x0001, 0x080c, 0xa7bc, 0x003e, 0x080c,
+	0x6531, 0x00c6, 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660,
+	0x080c, 0xae61, 0x00ce, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
+	0x080c, 0xce24, 0x080c, 0x6c81, 0x080c, 0xa692, 0x00fe, 0x0005,
+	0x00b6, 0x00e6, 0x00c6, 0x2011, 0x0101, 0x2204, 0xc0c4, 0x2012,
+	0x2001, 0x180c, 0x2014, 0xc2e4, 0x2202, 0x2071, 0x19e7, 0x7004,
+	0x9084, 0x0007, 0x0002, 0x95a5, 0x95a9, 0x95c0, 0x95e9, 0x9627,
+	0x95a5, 0x95c0, 0x95a3, 0x080c, 0x0dd5, 0x00ce, 0x00ee, 0x00be,
+	0x0005, 0x7024, 0x9065, 0x0148, 0x7020, 0x8001, 0x7022, 0x600c,
+	0x9015, 0x0158, 0x7216, 0x600f, 0x0000, 0x7007, 0x0000, 0x7027,
+	0x0000, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7216, 0x7212, 0x0ca8,
+	0x6010, 0x2058, 0x080c, 0x6531, 0xb800, 0xc0dc, 0xb802, 0x7007,
+	0x0000, 0x7027, 0x0000, 0x7020, 0x8001, 0x7022, 0x1148, 0x2001,
+	0x180c, 0x2014, 0xd2ec, 0x1180, 0x00ce, 0x00ee, 0x00be, 0x0005,
+	0xb854, 0x9015, 0x0120, 0x721e, 0x080c, 0x968d, 0x0ca8, 0x7218,
+	0x721e, 0x080c, 0x968d, 0x0c80, 0xc2ec, 0x2202, 0x080c, 0x97b9,
+	0x0c58, 0x7024, 0x9065, 0x05b8, 0x700c, 0x9c06, 0x1160, 0x080c,
+	0xa692, 0x600c, 0x9015, 0x0120, 0x720e, 0x600f, 0x0000, 0x0448,
+	0x720e, 0x720a, 0x0430, 0x7014, 0x9c06, 0x1160, 0x080c, 0xa692,
+	0x600c, 0x9015, 0x0120, 0x7216, 0x600f, 0x0000, 0x00d0, 0x7216,
+	0x7212, 0x00b8, 0x6020, 0x9086, 0x0003, 0x1198, 0x6010, 0x2058,
+	0x080c, 0x6531, 0xb800, 0xc0dc, 0xb802, 0x080c, 0xa692, 0x701c,
+	0x9065, 0x0138, 0xb854, 0x9015, 0x0110, 0x721e, 0x0010, 0x7218,
+	0x721e, 0x7027, 0x0000, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7024,
+	0x9065, 0x0140, 0x080c, 0xa692, 0x600c, 0x9015, 0x0158, 0x720e,
+	0x600f, 0x0000, 0x080c, 0xa7bc, 0x7027, 0x0000, 0x00ce, 0x00ee,
+	0x00be, 0x0005, 0x720e, 0x720a, 0x0ca8, 0x00d6, 0x2069, 0x19e7,
+	0x6830, 0x9084, 0x0003, 0x0002, 0x964a, 0x964c, 0x9670, 0x9648,
+	0x080c, 0x0dd5, 0x00de, 0x0005, 0x00c6, 0x6840, 0x9086, 0x0001,
+	0x01b8, 0x683c, 0x9065, 0x0130, 0x600c, 0x9015, 0x0170, 0x6a3a,
+	0x600f, 0x0000, 0x6833, 0x0000, 0x683f, 0x0000, 0x2011, 0x1a06,
+	0x2013, 0x0000, 0x00ce, 0x00de, 0x0005, 0x683a, 0x6836, 0x0c90,
+	0x6843, 0x0000, 0x6838, 0x9065, 0x0d68, 0x6003, 0x0003, 0x0c50,
+	0x00c6, 0x9006, 0x6842, 0x6846, 0x684a, 0x683c, 0x9065, 0x0160,
+	0x600c, 0x9015, 0x0130, 0x6a3a, 0x600f, 0x0000, 0x683f, 0x0000,
+	0x0018, 0x683e, 0x683a, 0x6836, 0x00ce, 0x00de, 0x0005, 0x2001,
+	0x180c, 0x200c, 0xc1e5, 0x2102, 0x0005, 0x2001, 0x180c, 0x200c,
+	0xd1ec, 0x0120, 0xc1ec, 0x2102, 0x080c, 0x97b9, 0x2001, 0x19f3,
+	0x2004, 0x9086, 0x0001, 0x0d58, 0x00d6, 0x2069, 0x19e7, 0x6804,
+	0x9084, 0x0007, 0x0006, 0x9005, 0x11c8, 0x2001, 0x1837, 0x2004,
+	0x9084, 0x0028, 0x1198, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa,
+	0x0168, 0x2001, 0x188b, 0x2004, 0xd08c, 0x1118, 0xd084, 0x1118,
+	0x0028, 0x080c, 0x97b9, 0x000e, 0x00de, 0x0005, 0x000e, 0x0002,
+	0x96ca, 0x9787, 0x9787, 0x9787, 0x9787, 0x9789, 0x9787, 0x96c8,
+	0x080c, 0x0dd5, 0x6820, 0x9005, 0x1110, 0x00de, 0x0005, 0x00c6,
+	0x680c, 0x9065, 0x0520, 0x6114, 0x0096, 0x2148, 0xa964, 0x009e,
+	0x918c, 0x00ff, 0x918e, 0x0035, 0x1180, 0x2009, 0x1837, 0x210c,
+	0x918c, 0x0028, 0x1150, 0x080c, 0x73bc, 0x0138, 0x0006, 0x2009,
+	0x188b, 0x2104, 0xc095, 0x200a, 0x000e, 0x6807, 0x0004, 0x6826,
+	0x682b, 0x0000, 0x080c, 0x9861, 0x00ce, 0x00de, 0x0005, 0x6814,
+	0x9065, 0x0150, 0x6807, 0x0001, 0x6826, 0x682b, 0x0000, 0x080c,
+	0x9861, 0x00ce, 0x00de, 0x0005, 0x00b6, 0x00e6, 0x6a1c, 0x92dd,
+	0x0000, 0x0904, 0x9773, 0xb84c, 0x900d, 0x0118, 0xb888, 0x9005,
+	0x01a0, 0xb854, 0x905d, 0x0120, 0x920e, 0x0904, 0x9773, 0x0028,
+	0x6818, 0x920e, 0x0904, 0x9773, 0x2058, 0xb84c, 0x900d, 0x0d88,
+	0xb888, 0x9005, 0x1d70, 0x2b00, 0x681e, 0xbb3c, 0xb838, 0x9302,
+	0x1e40, 0x080c, 0xae38, 0x0904, 0x9773, 0x8318, 0xbb3e, 0x6116,
+	0x2b10, 0x6212, 0x0096, 0x2148, 0xa880, 0x9084, 0x00ff, 0x605e,
+	0xa883, 0x0000, 0xa884, 0x009e, 0x908a, 0x199a, 0x0210, 0x2001,
+	0x1999, 0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x6114, 0x0096,
+	0x2148, 0xa964, 0x009e, 0x918c, 0x00ff, 0x918e, 0x0048, 0x0538,
+	0x00f6, 0x2c78, 0x2061, 0x0100, 0xbac0, 0x629a, 0x2069, 0x0200,
+	0x2071, 0x0240, 0x080c, 0x9dae, 0x2069, 0x19e7, 0xbb00, 0xc3dd,
+	0xbb02, 0x6807, 0x0002, 0x2f18, 0x6b26, 0x682b, 0x0000, 0x7823,
+	0x0003, 0x7803, 0x0001, 0x7807, 0x0040, 0x00fe, 0x00ee, 0x00be,
+	0x00ce, 0x00de, 0x0005, 0x00ee, 0x00be, 0x00ce, 0x0cd0, 0xbb00,
+	0xc3dd, 0xbb02, 0x6807, 0x0006, 0x2f18, 0x6b26, 0x682b, 0x0000,
+	0x080c, 0xac7d, 0x00ee, 0x00be, 0x00ce, 0x00de, 0x0005, 0x00de,
+	0x0005, 0x00c6, 0x680c, 0x9065, 0x0508, 0x6114, 0x0096, 0x2148,
+	0xa964, 0x009e, 0x918c, 0x00ff, 0x918e, 0x0035, 0x1180, 0x2009,
+	0x1837, 0x210c, 0x918c, 0x0028, 0x1150, 0x080c, 0x73bc, 0x0138,
+	0x0006, 0x2009, 0x188b, 0x2104, 0xc095, 0x200a, 0x000e, 0x6807,
+	0x0004, 0x6826, 0x682b, 0x0000, 0x080c, 0x9861, 0x00ce, 0x00de,
+	0x0005, 0x2001, 0x180c, 0x2014, 0xc2ed, 0x2202, 0x00de, 0x00fe,
+	0x0005, 0x00f6, 0x00d6, 0x2069, 0x19e7, 0x6830, 0x9086, 0x0000,
+	0x1570, 0x2001, 0x180c, 0x2014, 0xd2e4, 0x0130, 0xc2e4, 0x2202,
+	0x080c, 0x969c, 0x2069, 0x19e7, 0x2001, 0x180c, 0x200c, 0xd1c4,
+	0x1508, 0x6838, 0x907d, 0x01d8, 0x6a04, 0x9296, 0x0000, 0x1904,
+	0x985a, 0x7920, 0x918e, 0x0009, 0x0588, 0x6833, 0x0001, 0x683e,
+	0x6847, 0x0000, 0x684b, 0x0000, 0x0126, 0x00f6, 0x2091, 0x2400,
+	0x002e, 0x080c, 0x1c46, 0x1178, 0x012e, 0x080c, 0xa0d0, 0x00de,
+	0x00fe, 0x0005, 0xc1c4, 0x2102, 0x0066, 0x2031, 0x0001, 0x080c,
+	0x746c, 0x006e, 0x08b0, 0x012e, 0x6843, 0x0000, 0x7803, 0x0002,
+	0x780c, 0x9015, 0x0140, 0x6a3a, 0x780f, 0x0000, 0x6833, 0x0000,
+	0x683f, 0x0000, 0x0c20, 0x683a, 0x6836, 0x0cc0, 0x7908, 0xd1fc,
+	0x1198, 0x6833, 0x0001, 0x683e, 0x6847, 0x0000, 0x684b, 0x0000,
+	0x0126, 0x00f6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1c46, 0x19d8,
+	0x012e, 0x080c, 0xa051, 0x0858, 0x2001, 0x1837, 0x2004, 0x9084,
+	0x0028, 0x1188, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x0158,
+	0x2001, 0x19e8, 0x2004, 0x9005, 0x11f0, 0x2001, 0x188b, 0x200c,
+	0xc185, 0xc18c, 0x2102, 0x2f00, 0x6833, 0x0001, 0x683e, 0x6847,
 	0x0000, 0x684b, 0x0000, 0x0126, 0x00f6, 0x2091, 0x2400, 0x002e,
-	0x080c, 0x1c46, 0x1178, 0x012e, 0x080c, 0xa0a7, 0x00de, 0x00fe,
-	0x0005, 0xc1c4, 0x2102, 0x0066, 0x2031, 0x0001, 0x080c, 0x7460,
-	0x006e, 0x08b0, 0x012e, 0x6843, 0x0000, 0x7803, 0x0002, 0x780c,
-	0x9015, 0x0140, 0x6a3a, 0x780f, 0x0000, 0x6833, 0x0000, 0x683f,
-	0x0000, 0x0c20, 0x683a, 0x6836, 0x0cc0, 0x7908, 0xd1fc, 0x1198,
-	0x6833, 0x0001, 0x683e, 0x6847, 0x0000, 0x684b, 0x0000, 0x0126,
-	0x00f6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1c46, 0x19d8, 0x012e,
-	0x080c, 0xa028, 0x0858, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028,
-	0x1188, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x0158, 0x2001,
-	0x19e8, 0x2004, 0x9005, 0x11f0, 0x2001, 0x188b, 0x200c, 0xc185,
-	0xc18c, 0x2102, 0x2f00, 0x6833, 0x0001, 0x683e, 0x6847, 0x0000,
-	0x684b, 0x0000, 0x0126, 0x00f6, 0x2091, 0x2400, 0x002e, 0x080c,
-	0x1c46, 0x1904, 0x97d2, 0x012e, 0x6a3c, 0x2278, 0x080c, 0x9fb2,
-	0x0804, 0x97c6, 0x2011, 0x188b, 0x2204, 0xc08d, 0x2012, 0x0804,
-	0x97c6, 0x6a04, 0x9296, 0x0006, 0x0904, 0x97b0, 0x0804, 0x9788,
-	0x6020, 0x9084, 0x000f, 0x000b, 0x0005, 0x984c, 0x9851, 0x9cbf,
-	0x9d4e, 0x9851, 0x9cbf, 0x9d4e, 0x984c, 0x9851, 0x984c, 0x984c,
-	0x984c, 0x984c, 0x984c, 0x984c, 0x080c, 0x955f, 0x080c, 0x9664,
-	0x0005, 0x00b6, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6,
-	0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071, 0x0240, 0x6004,
-	0x908a, 0x0053, 0x1a0c, 0x0dd5, 0x6110, 0x2158, 0xb9c0, 0x2c78,
-	0x2061, 0x0100, 0x619a, 0x908a, 0x0040, 0x1a04, 0x98bd, 0x005b,
-	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e,
-	0x015e, 0x00be, 0x0005, 0x9a42, 0x9a7d, 0x9aa6, 0x9b4e, 0x9b70,
-	0x9b76, 0x9b83, 0x9b8b, 0x9b97, 0x9b9d, 0x9bae, 0x9b9d, 0x9c06,
-	0x9b8b, 0x9c12, 0x9c18, 0x9b97, 0x9c18, 0x9c24, 0x98bb, 0x98bb,
-	0x98bb, 0x98bb, 0x98bb, 0x98bb, 0x98bb, 0x98bb, 0x98bb, 0x98bb,
-	0x98bb, 0xa453, 0xa476, 0xa487, 0xa4a7, 0xa4d9, 0x9b83, 0x98bb,
-	0x9b83, 0x9b9d, 0x98bb, 0x9aa6, 0x9b4e, 0x98bb, 0xa88f, 0x9b9d,
-	0x98bb, 0xa8ab, 0x9b9d, 0x98bb, 0x9b97, 0x9a3c, 0x98de, 0x98bb,
-	0xa8c7, 0xa934, 0xaa0b, 0x98bb, 0xaa18, 0x9b80, 0xaa43, 0x98bb,
-	0xa4e3, 0xaa70, 0x98bb, 0x080c, 0x0dd5, 0x2100, 0x005b, 0x00fe,
-	0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e,
-	0x00be, 0x0005, 0xab0b, 0xabbd, 0x98dc, 0x9905, 0x99b1, 0x99bc,
-	0x98dc, 0x9b83, 0x98dc, 0x9a03, 0x9a0f, 0x9920, 0x98dc, 0x993b,
-	0x996f, 0xad25, 0xad6a, 0x9b9d, 0x080c, 0x0dd5, 0x00d6, 0x0096,
-	0x080c, 0x9c37, 0x7003, 0x2414, 0x7007, 0x0018, 0x700b, 0x0800,
-	0x7814, 0x2048, 0xa83c, 0x700e, 0xa850, 0x7022, 0xa854, 0x7026,
-	0x60c3, 0x0018, 0x080c, 0xa22d, 0x009e, 0x00de, 0x0005, 0x7810,
-	0x00b6, 0x2058, 0xb8a0, 0x00be, 0x080c, 0xadb1, 0x1118, 0x9084,
-	0xff80, 0x0110, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0096, 0x080c,
-	0x9c37, 0x7003, 0x0500, 0x7814, 0x2048, 0xa874, 0x700a, 0xa878,
-	0x700e, 0xa87c, 0x7012, 0xa880, 0x7016, 0xa884, 0x701a, 0xa888,
-	0x701e, 0x60c3, 0x0010, 0x080c, 0xa22d, 0x009e, 0x00de, 0x0005,
-	0x00d6, 0x0096, 0x080c, 0x9c37, 0x7003, 0x0500, 0x7814, 0x2048,
-	0xa8cc, 0x700a, 0xa8d0, 0x700e, 0xa8d4, 0x7012, 0xa8d8, 0x7016,
-	0xa8dc, 0x701a, 0xa8e0, 0x701e, 0x60c3, 0x0010, 0x080c, 0xa22d,
-	0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x9c37, 0x20e9, 0x0000, 0x2001, 0x19a3, 0x2003, 0x0000,
-	0x7814, 0x2048, 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860,
-	0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x2001, 0x19a3, 0x0016,
-	0x200c, 0x2001, 0x0001, 0x080c, 0x23b7, 0x080c, 0xd84c, 0x9006,
-	0x080c, 0x23b7, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c28,
-	0x04d9, 0x080c, 0xa22d, 0x012e, 0x009e, 0x00de, 0x0005, 0x00d6,
-	0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x9c82, 0x20e9, 0x0000,
-	0x2001, 0x19a3, 0x2003, 0x0000, 0x7814, 0x2048, 0xa86f, 0x0200,
-	0xa873, 0x0000, 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860,
-	0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x2001, 0x19a3, 0x0016,
-	0x200c, 0x080c, 0xd84c, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048,
-	0x0c60, 0x0051, 0x7814, 0x2048, 0x080c, 0x0fb1, 0x080c, 0xa22d,
-	0x012e, 0x009e, 0x00de, 0x0005, 0x60c0, 0x8004, 0x9084, 0x0003,
-	0x9005, 0x0130, 0x9082, 0x0004, 0x20a3, 0x0000, 0x8000, 0x1de0,
-	0x0005, 0x080c, 0x9c37, 0x7003, 0x7800, 0x7808, 0x8007, 0x700a,
-	0x60c3, 0x0008, 0x0804, 0xa22d, 0x00d6, 0x00e6, 0x080c, 0x9c82,
-	0x7814, 0x9084, 0xff00, 0x2073, 0x0200, 0x8e70, 0x8e70, 0x9095,
-	0x0010, 0x2272, 0x8e70, 0x2073, 0x0034, 0x8e70, 0x2069, 0x1805,
-	0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x99d2, 0x2069,
-	0x1801, 0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x99db,
-	0x2069, 0x19b3, 0x9086, 0xdf00, 0x0110, 0x2069, 0x19cd, 0x20a9,
-	0x001a, 0x9e86, 0x0260, 0x1148, 0x00c6, 0x2061, 0x0200, 0x6010,
-	0x8000, 0x6012, 0x00ce, 0x2071, 0x0240, 0x2d04, 0x8007, 0x2072,
-	0x8d68, 0x8e70, 0x1f04, 0x99e9, 0x60c3, 0x004c, 0x080c, 0xa22d,
-	0x00ee, 0x00de, 0x0005, 0x080c, 0x9c37, 0x7003, 0x6300, 0x7007,
-	0x0028, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa22d, 0x00d6,
-	0x0026, 0x0016, 0x080c, 0x9c82, 0x7003, 0x0200, 0x7814, 0x700e,
-	0x00e6, 0x9ef0, 0x0004, 0x2009, 0x0001, 0x2011, 0x000c, 0x2069,
-	0x1923, 0x6810, 0xd084, 0x1148, 0x2073, 0x0500, 0x8e70, 0x2073,
-	0x0000, 0x8e70, 0x8108, 0x9290, 0x0004, 0x2073, 0x0800, 0x8e70,
-	0x2073, 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0xa22d,
-	0x001e, 0x002e, 0x00de, 0x0005, 0x2001, 0x1818, 0x2004, 0x609a,
-	0x0804, 0xa22d, 0x080c, 0x9c37, 0x7003, 0x5200, 0x2069, 0x1847,
-	0x6804, 0xd084, 0x0130, 0x6828, 0x0016, 0x080c, 0x2871, 0x710e,
-	0x001e, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
-	0x0000, 0x20a1, 0x0250, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801,
-	0x20a1, 0x0254, 0x4003, 0x080c, 0xadb1, 0x1120, 0xb8a0, 0x9082,
-	0x007f, 0x0248, 0x2001, 0x181f, 0x2004, 0x7032, 0x2001, 0x1820,
-	0x2004, 0x7036, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff,
-	0x7036, 0x60c3, 0x001c, 0x0804, 0xa22d, 0x080c, 0x9c37, 0x7003,
-	0x0500, 0x080c, 0xadb1, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
-	0x2001, 0x181f, 0x2004, 0x700a, 0x2001, 0x1820, 0x2004, 0x700e,
-	0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x700e, 0x20a9,
-	0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1,
-	0x0250, 0x4003, 0x60c3, 0x0010, 0x0804, 0xa22d, 0x080c, 0x9c37,
-	0x9006, 0x080c, 0x6934, 0xb8a0, 0x9086, 0x007e, 0x1130, 0x7003,
-	0x0400, 0x620c, 0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096, 0x904d,
-	0x0120, 0x9006, 0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003, 0x0300,
-	0xb8a0, 0x9086, 0x007e, 0x1904, 0x9b15, 0x00d6, 0x2069, 0x196c,
-	0x2001, 0x1837, 0x2004, 0xd0a4, 0x0188, 0x6800, 0x700a, 0x6808,
-	0x9084, 0x2000, 0x7012, 0x080c, 0xadc8, 0x680c, 0x7016, 0x701f,
-	0x2710, 0x6818, 0x7022, 0x681c, 0x7026, 0x0090, 0x6800, 0x700a,
-	0x6804, 0x700e, 0x6808, 0x080c, 0x73b0, 0x1118, 0x9084, 0x37ff,
-	0x0010, 0x9084, 0x3fff, 0x7012, 0x080c, 0xadc8, 0x680c, 0x7016,
-	0x00de, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
-	0x0000, 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801,
-	0x20a1, 0x025a, 0x4003, 0x00d6, 0x080c, 0xaaf2, 0x2069, 0x1974,
-	0x2071, 0x024e, 0x6800, 0xc0dd, 0x7002, 0x080c, 0x56d4, 0xd0e4,
-	0x0110, 0x680c, 0x700e, 0x00de, 0x04a8, 0x2001, 0x1837, 0x2004,
-	0xd0a4, 0x0170, 0x0016, 0x2001, 0x196d, 0x200c, 0x60e0, 0x9106,
-	0x0130, 0x2100, 0x60e3, 0x0000, 0x080c, 0x28b2, 0x61e2, 0x001e,
-	0x20e1, 0x0001, 0x2099, 0x196c, 0x20e9, 0x0000, 0x20a1, 0x024e,
-	0x20a9, 0x0008, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1805, 0x20a1,
-	0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1, 0x025a,
-	0x4003, 0x080c, 0xaaf2, 0x20a1, 0x024e, 0x20a9, 0x0008, 0x2099,
-	0x1974, 0x4003, 0x60c3, 0x0074, 0x0804, 0xa22d, 0x080c, 0x9c37,
-	0x7003, 0x2010, 0x7007, 0x0014, 0x700b, 0x0800, 0x700f, 0x2000,
-	0x9006, 0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe, 0xd1ac, 0x1110,
-	0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010, 0x9085, 0x0002,
-	0x00d6, 0x0804, 0x9be7, 0x7026, 0x60c3, 0x0014, 0x0804, 0xa22d,
-	0x080c, 0x9c37, 0x7003, 0x5000, 0x0804, 0x9ac0, 0x080c, 0x9c37,
-	0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014, 0x0804, 0xa22d,
-	0x080c, 0x9c79, 0x0010, 0x080c, 0x9c82, 0x7003, 0x0200, 0x60c3,
-	0x0004, 0x0804, 0xa22d, 0x080c, 0x9c82, 0x7003, 0x0100, 0x700b,
-	0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0xa22d, 0x080c,
-	0x9c82, 0x7003, 0x0200, 0x0804, 0x9ac0, 0x080c, 0x9c82, 0x7003,
-	0x0100, 0x782c, 0x9005, 0x0110, 0x700a, 0x0010, 0x700b, 0x0003,
-	0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa22d, 0x00d6, 0x080c,
-	0x9c82, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b, 0x0800, 0xb894,
-	0x9086, 0x0014, 0x1198, 0xb99c, 0x9184, 0x0030, 0x0190, 0xb998,
-	0x9184, 0xc000, 0x1140, 0xd1ec, 0x0118, 0x700f, 0x2100, 0x0058,
-	0x700f, 0x0100, 0x0040, 0x700f, 0x0400, 0x0028, 0x700f, 0x0700,
-	0x0010, 0x700f, 0x0800, 0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe,
-	0xd1ac, 0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010,
-	0x2009, 0x1869, 0x210c, 0xd184, 0x1110, 0x9085, 0x0002, 0x0026,
-	0x2009, 0x1867, 0x210c, 0xd1e4, 0x0150, 0xc0c5, 0xbacc, 0xd28c,
-	0x1108, 0xc0cd, 0x9094, 0x0030, 0x9296, 0x0010, 0x0140, 0xd1ec,
-	0x0130, 0x9094, 0x0030, 0x9296, 0x0010, 0x0108, 0xc0bd, 0x002e,
-	0x7026, 0x60c3, 0x0014, 0x00de, 0x0804, 0xa22d, 0x080c, 0x9c82,
-	0x7003, 0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3, 0x0014,
-	0x0804, 0xa22d, 0x080c, 0x9c82, 0x7003, 0x0200, 0x0804, 0x9a46,
-	0x080c, 0x9c82, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f, 0x2a00,
-	0x60c3, 0x0008, 0x0804, 0xa22d, 0x080c, 0x9c82, 0x7003, 0x0100,
-	0x700b, 0x000b, 0x60c3, 0x0008, 0x0804, 0xa22d, 0x0026, 0x00d6,
-	0x0036, 0x0046, 0x2019, 0x3200, 0x2021, 0x0800, 0x0040, 0x0026,
-	0x00d6, 0x0036, 0x0046, 0x2019, 0x2200, 0x2021, 0x0100, 0x080c,
-	0xab07, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
-	0x687c, 0x700a, 0x6880, 0x700e, 0x9485, 0x0029, 0x7012, 0x004e,
-	0x003e, 0x00de, 0x080c, 0xa21b, 0x721a, 0x9f95, 0x0000, 0x7222,
-	0x7027, 0xffff, 0x2071, 0x024c, 0x002e, 0x0005, 0x0026, 0x080c,
-	0xab07, 0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069, 0x1800,
-	0x687c, 0x700a, 0x6880, 0x700e, 0x00de, 0x7013, 0x2029, 0x0c10,
-	0x7003, 0x0100, 0x7007, 0x0000, 0x700b, 0xfc02, 0x700f, 0x0000,
-	0x0005, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3300, 0x2021,
-	0x0800, 0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2300,
-	0x2021, 0x0100, 0x080c, 0xab07, 0xb810, 0x9305, 0x7002, 0xb814,
-	0x7006, 0x2069, 0x1800, 0xb810, 0x9005, 0x1140, 0xb814, 0x9005,
-	0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0020, 0x687c, 0x700a,
-	0x6880, 0x700e, 0x0000, 0x9485, 0x0098, 0x7012, 0x004e, 0x003e,
-	0x00de, 0x080c, 0xa21b, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226,
-	0x2071, 0x024c, 0x002e, 0x0005, 0x080c, 0xa21b, 0x721a, 0x7a08,
-	0x7222, 0x7814, 0x7026, 0x2071, 0x024c, 0x002e, 0x0005, 0x00b6,
+	0x080c, 0x1c46, 0x1904, 0x97fb, 0x012e, 0x6a3c, 0x2278, 0x080c,
+	0x9fdb, 0x0804, 0x97ef, 0x2011, 0x188b, 0x2204, 0xc08d, 0x2012,
+	0x0804, 0x97ef, 0x6a04, 0x9296, 0x0006, 0x0904, 0x97d9, 0x0804,
+	0x97b1, 0x6020, 0x9084, 0x000f, 0x000b, 0x0005, 0x9875, 0x987a,
+	0x9ce8, 0x9d77, 0x987a, 0x9ce8, 0x9d77, 0x9875, 0x987a, 0x9875,
+	0x9875, 0x9875, 0x9875, 0x9875, 0x9875, 0x080c, 0x9588, 0x080c,
+	0x968d, 0x0005, 0x00b6, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6,
 	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071, 0x0240,
-	0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dd5, 0x908a, 0x0092, 0x1a0c,
-	0x0dd5, 0x6110, 0x2158, 0xb9c0, 0x2c78, 0x2061, 0x0100, 0x619a,
-	0x9082, 0x0085, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
-	0x0005, 0x9cf0, 0x9cff, 0x9d0a, 0x9cee, 0x9cee, 0x9cee, 0x9cf0,
-	0x9cee, 0x9cee, 0x9cee, 0x9cee, 0x9cee, 0x9cee, 0x080c, 0x0dd5,
-	0x0411, 0x60c3, 0x0000, 0x0026, 0x080c, 0x2ba5, 0x0228, 0x2011,
-	0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0xa22d, 0x0431,
-	0x7808, 0x700a, 0x7814, 0x700e, 0x7017, 0xffff, 0x60c3, 0x000c,
-	0x0804, 0xa22d, 0x0479, 0x7003, 0x0003, 0x7007, 0x0300, 0x60c3,
-	0x0004, 0x0804, 0xa22d, 0x0026, 0x080c, 0xab07, 0xb810, 0x9085,
-	0x8100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a,
-	0x6880, 0x700e, 0x7013, 0x0009, 0x0804, 0x9c52, 0x0026, 0x080c,
-	0xab07, 0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006, 0x2069,
-	0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x2001, 0x0099, 0x7012,
-	0x0804, 0x9cb4, 0x0026, 0x080c, 0xab07, 0xb810, 0x9085, 0x8500,
+	0x6004, 0x908a, 0x0053, 0x1a0c, 0x0dd5, 0x6110, 0x2158, 0xb9c0,
+	0x2c78, 0x2061, 0x0100, 0x619a, 0x908a, 0x0040, 0x1a04, 0x98e6,
+	0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e,
+	0x013e, 0x015e, 0x00be, 0x0005, 0x9a6b, 0x9aa6, 0x9acf, 0x9b77,
+	0x9b99, 0x9b9f, 0x9bac, 0x9bb4, 0x9bc0, 0x9bc6, 0x9bd7, 0x9bc6,
+	0x9c2f, 0x9bb4, 0x9c3b, 0x9c41, 0x9bc0, 0x9c41, 0x9c4d, 0x98e4,
+	0x98e4, 0x98e4, 0x98e4, 0x98e4, 0x98e4, 0x98e4, 0x98e4, 0x98e4,
+	0x98e4, 0x98e4, 0xa46d, 0xa490, 0xa4a1, 0xa4c1, 0xa4f3, 0x9bac,
+	0x98e4, 0x9bac, 0x9bc6, 0x98e4, 0x9acf, 0x9b77, 0x98e4, 0xa8a9,
+	0x9bc6, 0x98e4, 0xa8c5, 0x9bc6, 0x98e4, 0x9bc0, 0x9a65, 0x9907,
+	0x98e4, 0xa8e1, 0xa94e, 0xaa25, 0x98e4, 0xaa32, 0x9ba9, 0xaa5d,
+	0x98e4, 0xa4fd, 0xaa8a, 0x98e4, 0x080c, 0x0dd5, 0x2100, 0x005b,
+	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e,
+	0x015e, 0x00be, 0x0005, 0xab25, 0xabd7, 0x9905, 0x992e, 0x99da,
+	0x99e5, 0x9905, 0x9bac, 0x9905, 0x9a2c, 0x9a38, 0x9949, 0x9905,
+	0x9964, 0x9998, 0xad3f, 0xad84, 0x9bc6, 0x080c, 0x0dd5, 0x00d6,
+	0x0096, 0x080c, 0x9c60, 0x7003, 0x2414, 0x7007, 0x0018, 0x700b,
+	0x0800, 0x7814, 0x2048, 0xa83c, 0x700e, 0xa850, 0x7022, 0xa854,
+	0x7026, 0x60c3, 0x0018, 0x080c, 0xa247, 0x009e, 0x00de, 0x0005,
+	0x7810, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x080c, 0xadcb, 0x1118,
+	0x9084, 0xff80, 0x0110, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0096,
+	0x080c, 0x9c60, 0x7003, 0x0500, 0x7814, 0x2048, 0xa874, 0x700a,
+	0xa878, 0x700e, 0xa87c, 0x7012, 0xa880, 0x7016, 0xa884, 0x701a,
+	0xa888, 0x701e, 0x60c3, 0x0010, 0x080c, 0xa247, 0x009e, 0x00de,
+	0x0005, 0x00d6, 0x0096, 0x080c, 0x9c60, 0x7003, 0x0500, 0x7814,
+	0x2048, 0xa8cc, 0x700a, 0xa8d0, 0x700e, 0xa8d4, 0x7012, 0xa8d8,
+	0x7016, 0xa8dc, 0x701a, 0xa8e0, 0x701e, 0x60c3, 0x0010, 0x080c,
+	0xa247, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126, 0x2091,
+	0x8000, 0x080c, 0x9c60, 0x20e9, 0x0000, 0x2001, 0x19a3, 0x2003,
+	0x0000, 0x7814, 0x2048, 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8,
+	0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x2001, 0x19a3,
+	0x0016, 0x200c, 0x2001, 0x0001, 0x080c, 0x23b7, 0x080c, 0xd867,
+	0x9006, 0x080c, 0x23b7, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048,
+	0x0c28, 0x04d9, 0x080c, 0xa247, 0x012e, 0x009e, 0x00de, 0x0005,
+	0x00d6, 0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x9cab, 0x20e9,
+	0x0000, 0x2001, 0x19a3, 0x2003, 0x0000, 0x7814, 0x2048, 0xa86f,
+	0x0200, 0xa873, 0x0000, 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8,
+	0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x2001, 0x19a3,
+	0x0016, 0x200c, 0x080c, 0xd867, 0x001e, 0xa804, 0x9005, 0x0110,
+	0x2048, 0x0c60, 0x0051, 0x7814, 0x2048, 0x080c, 0x0fb1, 0x080c,
+	0xa247, 0x012e, 0x009e, 0x00de, 0x0005, 0x60c0, 0x8004, 0x9084,
+	0x0003, 0x9005, 0x0130, 0x9082, 0x0004, 0x20a3, 0x0000, 0x8000,
+	0x1de0, 0x0005, 0x080c, 0x9c60, 0x7003, 0x7800, 0x7808, 0x8007,
+	0x700a, 0x60c3, 0x0008, 0x0804, 0xa247, 0x00d6, 0x00e6, 0x080c,
+	0x9cab, 0x7814, 0x9084, 0xff00, 0x2073, 0x0200, 0x8e70, 0x8e70,
+	0x9095, 0x0010, 0x2272, 0x8e70, 0x2073, 0x0034, 0x8e70, 0x2069,
+	0x1805, 0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x99fb,
+	0x2069, 0x1801, 0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04,
+	0x9a04, 0x2069, 0x19b3, 0x9086, 0xdf00, 0x0110, 0x2069, 0x19cd,
+	0x20a9, 0x001a, 0x9e86, 0x0260, 0x1148, 0x00c6, 0x2061, 0x0200,
+	0x6010, 0x8000, 0x6012, 0x00ce, 0x2071, 0x0240, 0x2d04, 0x8007,
+	0x2072, 0x8d68, 0x8e70, 0x1f04, 0x9a12, 0x60c3, 0x004c, 0x080c,
+	0xa247, 0x00ee, 0x00de, 0x0005, 0x080c, 0x9c60, 0x7003, 0x6300,
+	0x7007, 0x0028, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa247,
+	0x00d6, 0x0026, 0x0016, 0x080c, 0x9cab, 0x7003, 0x0200, 0x7814,
+	0x700e, 0x00e6, 0x9ef0, 0x0004, 0x2009, 0x0001, 0x2011, 0x000c,
+	0x2069, 0x1923, 0x6810, 0xd084, 0x1148, 0x2073, 0x0500, 0x8e70,
+	0x2073, 0x0000, 0x8e70, 0x8108, 0x9290, 0x0004, 0x2073, 0x0800,
+	0x8e70, 0x2073, 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c,
+	0xa247, 0x001e, 0x002e, 0x00de, 0x0005, 0x2001, 0x1818, 0x2004,
+	0x609a, 0x0804, 0xa247, 0x080c, 0x9c60, 0x7003, 0x5200, 0x2069,
+	0x1847, 0x6804, 0xd084, 0x0130, 0x6828, 0x0016, 0x080c, 0x2871,
+	0x710e, 0x001e, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805,
+	0x20e9, 0x0000, 0x20a1, 0x0250, 0x4003, 0x20a9, 0x0004, 0x2099,
+	0x1801, 0x20a1, 0x0254, 0x4003, 0x080c, 0xadcb, 0x1120, 0xb8a0,
+	0x9082, 0x007f, 0x0248, 0x2001, 0x181f, 0x2004, 0x7032, 0x2001,
+	0x1820, 0x2004, 0x7036, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084,
+	0x00ff, 0x7036, 0x60c3, 0x001c, 0x0804, 0xa247, 0x080c, 0x9c60,
+	0x7003, 0x0500, 0x080c, 0xadcb, 0x1120, 0xb8a0, 0x9082, 0x007f,
+	0x0248, 0x2001, 0x181f, 0x2004, 0x700a, 0x2001, 0x1820, 0x2004,
+	0x700e, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x700e,
+	0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000,
+	0x20a1, 0x0250, 0x4003, 0x60c3, 0x0010, 0x0804, 0xa247, 0x080c,
+	0x9c60, 0x9006, 0x080c, 0x693c, 0xb8a0, 0x9086, 0x007e, 0x1130,
+	0x7003, 0x0400, 0x620c, 0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096,
+	0x904d, 0x0120, 0x9006, 0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003,
+	0x0300, 0xb8a0, 0x9086, 0x007e, 0x1904, 0x9b3e, 0x00d6, 0x2069,
+	0x196c, 0x2001, 0x1837, 0x2004, 0xd0a4, 0x0188, 0x6800, 0x700a,
+	0x6808, 0x9084, 0x2000, 0x7012, 0x080c, 0xade2, 0x680c, 0x7016,
+	0x701f, 0x2710, 0x6818, 0x7022, 0x681c, 0x7026, 0x0090, 0x6800,
+	0x700a, 0x6804, 0x700e, 0x6808, 0x080c, 0x73bc, 0x1118, 0x9084,
+	0x37ff, 0x0010, 0x9084, 0x3fff, 0x7012, 0x080c, 0xade2, 0x680c,
+	0x7016, 0x00de, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805,
+	0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099,
+	0x1801, 0x20a1, 0x025a, 0x4003, 0x00d6, 0x080c, 0xab0c, 0x2069,
+	0x1974, 0x2071, 0x024e, 0x6800, 0xc0dd, 0x7002, 0x080c, 0x56d3,
+	0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de, 0x04a8, 0x2001, 0x1837,
+	0x2004, 0xd0a4, 0x0170, 0x0016, 0x2001, 0x196d, 0x200c, 0x60e0,
+	0x9106, 0x0130, 0x2100, 0x60e3, 0x0000, 0x080c, 0x28b2, 0x61e2,
+	0x001e, 0x20e1, 0x0001, 0x2099, 0x196c, 0x20e9, 0x0000, 0x20a1,
+	0x024e, 0x20a9, 0x0008, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1805,
+	0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1,
+	0x025a, 0x4003, 0x080c, 0xab0c, 0x20a1, 0x024e, 0x20a9, 0x0008,
+	0x2099, 0x1974, 0x4003, 0x60c3, 0x0074, 0x0804, 0xa247, 0x080c,
+	0x9c60, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b, 0x0800, 0x700f,
+	0x2000, 0x9006, 0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe, 0xd1ac,
+	0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010, 0x9085,
+	0x0002, 0x00d6, 0x0804, 0x9c10, 0x7026, 0x60c3, 0x0014, 0x0804,
+	0xa247, 0x080c, 0x9c60, 0x7003, 0x5000, 0x0804, 0x9ae9, 0x080c,
+	0x9c60, 0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014, 0x0804,
+	0xa247, 0x080c, 0x9ca2, 0x0010, 0x080c, 0x9cab, 0x7003, 0x0200,
+	0x60c3, 0x0004, 0x0804, 0xa247, 0x080c, 0x9cab, 0x7003, 0x0100,
+	0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0xa247,
+	0x080c, 0x9cab, 0x7003, 0x0200, 0x0804, 0x9ae9, 0x080c, 0x9cab,
+	0x7003, 0x0100, 0x782c, 0x9005, 0x0110, 0x700a, 0x0010, 0x700b,
+	0x0003, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa247, 0x00d6,
+	0x080c, 0x9cab, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b, 0x0800,
+	0xb894, 0x9086, 0x0014, 0x1198, 0xb99c, 0x9184, 0x0030, 0x0190,
+	0xb998, 0x9184, 0xc000, 0x1140, 0xd1ec, 0x0118, 0x700f, 0x2100,
+	0x0058, 0x700f, 0x0100, 0x0040, 0x700f, 0x0400, 0x0028, 0x700f,
+	0x0700, 0x0010, 0x700f, 0x0800, 0x00f6, 0x2079, 0x1847, 0x7904,
+	0x00fe, 0xd1ac, 0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085,
+	0x0010, 0x2009, 0x1869, 0x210c, 0xd184, 0x1110, 0x9085, 0x0002,
+	0x0026, 0x2009, 0x1867, 0x210c, 0xd1e4, 0x0150, 0xc0c5, 0xbacc,
+	0xd28c, 0x1108, 0xc0cd, 0x9094, 0x0030, 0x9296, 0x0010, 0x0140,
+	0xd1ec, 0x0130, 0x9094, 0x0030, 0x9296, 0x0010, 0x0108, 0xc0bd,
+	0x002e, 0x7026, 0x60c3, 0x0014, 0x00de, 0x0804, 0xa247, 0x080c,
+	0x9cab, 0x7003, 0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3,
+	0x0014, 0x0804, 0xa247, 0x080c, 0x9cab, 0x7003, 0x0200, 0x0804,
+	0x9a6f, 0x080c, 0x9cab, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f,
+	0x2a00, 0x60c3, 0x0008, 0x0804, 0xa247, 0x080c, 0x9cab, 0x7003,
+	0x0100, 0x700b, 0x000b, 0x60c3, 0x0008, 0x0804, 0xa247, 0x0026,
+	0x00d6, 0x0036, 0x0046, 0x2019, 0x3200, 0x2021, 0x0800, 0x0040,
+	0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2200, 0x2021, 0x0100,
+	0x080c, 0xab21, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069,
+	0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x9485, 0x0029, 0x7012,
+	0x004e, 0x003e, 0x00de, 0x080c, 0xa235, 0x721a, 0x9f95, 0x0000,
+	0x7222, 0x7027, 0xffff, 0x2071, 0x024c, 0x002e, 0x0005, 0x0026,
+	0x080c, 0xab21, 0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069,
+	0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x00de, 0x7013, 0x2029,
+	0x0c10, 0x7003, 0x0100, 0x7007, 0x0000, 0x700b, 0xfc02, 0x700f,
+	0x0000, 0x0005, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3300,
+	0x2021, 0x0800, 0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019,
+	0x2300, 0x2021, 0x0100, 0x080c, 0xab21, 0xb810, 0x9305, 0x7002,
+	0xb814, 0x7006, 0x2069, 0x1800, 0xb810, 0x9005, 0x1140, 0xb814,
+	0x9005, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0020, 0x687c,
+	0x700a, 0x6880, 0x700e, 0x0000, 0x9485, 0x0098, 0x7012, 0x004e,
+	0x003e, 0x00de, 0x080c, 0xa235, 0x721a, 0x7a08, 0x7222, 0x2f10,
+	0x7226, 0x2071, 0x024c, 0x002e, 0x0005, 0x080c, 0xa235, 0x721a,
+	0x7a08, 0x7222, 0x7814, 0x7026, 0x2071, 0x024c, 0x002e, 0x0005,
+	0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071,
+	0x0240, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dd5, 0x908a, 0x0092,
+	0x1a0c, 0x0dd5, 0x6110, 0x2158, 0xb9c0, 0x2c78, 0x2061, 0x0100,
+	0x619a, 0x9082, 0x0085, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce,
+	0x00be, 0x0005, 0x9d19, 0x9d28, 0x9d33, 0x9d17, 0x9d17, 0x9d17,
+	0x9d19, 0x9d17, 0x9d17, 0x9d17, 0x9d17, 0x9d17, 0x9d17, 0x080c,
+	0x0dd5, 0x0411, 0x60c3, 0x0000, 0x0026, 0x080c, 0x2ba5, 0x0228,
+	0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0xa247,
+	0x0431, 0x7808, 0x700a, 0x7814, 0x700e, 0x7017, 0xffff, 0x60c3,
+	0x000c, 0x0804, 0xa247, 0x0479, 0x7003, 0x0003, 0x7007, 0x0300,
+	0x60c3, 0x0004, 0x0804, 0xa247, 0x0026, 0x080c, 0xab21, 0xb810,
+	0x9085, 0x8100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c,
+	0x700a, 0x6880, 0x700e, 0x7013, 0x0009, 0x0804, 0x9c7b, 0x0026,
+	0x080c, 0xab21, 0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006,
+	0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x2001, 0x0099,
+	0x7012, 0x0804, 0x9cdd, 0x0026, 0x080c, 0xab21, 0xb810, 0x9085,
+	0x8500, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a,
+	0x6880, 0x700e, 0x2001, 0x0099, 0x7012, 0x0804, 0x9cdd, 0x00b6,
+	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2c78, 0x2069, 0x0200, 0x2071,
+	0x0240, 0x7804, 0x908a, 0x0040, 0x0a0c, 0x0dd5, 0x908a, 0x0054,
+	0x1a0c, 0x0dd5, 0x7910, 0x2158, 0xb9c0, 0x2061, 0x0100, 0x619a,
+	0x9082, 0x0040, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
+	0x0005, 0x9dae, 0x9e6a, 0x9e3d, 0x9f8c, 0x9dac, 0x9dac, 0x9dac,
+	0x9dac, 0x9dac, 0x9dac, 0x9dac, 0xa66f, 0xa677, 0xa67f, 0xa687,
+	0x9dac, 0xaa69, 0x9dac, 0xa667, 0x080c, 0x0dd5, 0x0096, 0x780b,
+	0xffff, 0x080c, 0x9e19, 0x7914, 0x2148, 0xa978, 0x7956, 0xae64,
+	0x96b4, 0x00ff, 0x9686, 0x0008, 0x1148, 0xa8b4, 0x7032, 0xa8b8,
+	0x7036, 0xa8bc, 0x703a, 0xa8c0, 0x703e, 0x0008, 0x7132, 0xa97c,
+	0x9184, 0x000f, 0x1118, 0x2001, 0x0005, 0x0040, 0xd184, 0x0118,
+	0x2001, 0x0004, 0x0018, 0x9084, 0x0006, 0x8004, 0x2010, 0x785c,
+	0x9084, 0x00ff, 0x8007, 0x9205, 0x7042, 0xd1ac, 0x0158, 0x7047,
+	0x0002, 0x9686, 0x0008, 0x1118, 0x080c, 0x18ac, 0x0010, 0x080c,
+	0x1725, 0x0050, 0xd1b4, 0x0118, 0x7047, 0x0001, 0x0028, 0x7047,
+	0x0000, 0x9016, 0x2230, 0x0010, 0xaab0, 0xaeac, 0x726a, 0x766e,
+	0x20a9, 0x0008, 0x20e9, 0x0000, 0xa860, 0x20e0, 0xa85c, 0x9080,
+	0x0023, 0x2098, 0x20a1, 0x0252, 0x2069, 0x0200, 0x6813, 0x0018,
+	0x4003, 0x6813, 0x0008, 0x60c3, 0x0020, 0x6017, 0x0009, 0x2001,
+	0x1a03, 0x2003, 0x07d0, 0x2001, 0x1a02, 0x2003, 0x0009, 0x009e,
+	0x0005, 0x6813, 0x0008, 0xba8c, 0x8210, 0xb8cc, 0xd084, 0x0128,
+	0x7a46, 0x7b14, 0x7b4a, 0x722e, 0x732a, 0x9294, 0x00ff, 0xba8e,
+	0x8217, 0x721a, 0xba10, 0x9295, 0x0600, 0x7202, 0xba14, 0x7206,
+	0x2069, 0x1800, 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013, 0x0829,
+	0x2f10, 0x7222, 0x7027, 0xffff, 0x0005, 0x00d6, 0x0096, 0x0081,
+	0x7814, 0x2048, 0xa890, 0x7002, 0xa88c, 0x7006, 0xa8b0, 0x700a,
+	0xa8ac, 0x700e, 0x60c3, 0x000c, 0x009e, 0x00de, 0x0804, 0xa247,
+	0x6813, 0x0008, 0xb810, 0x9085, 0x0500, 0x7002, 0xb814, 0x7006,
+	0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x7013, 0x0889,
+	0x080c, 0xa235, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071,
+	0x024c, 0x0005, 0x00d6, 0x0096, 0x080c, 0x9f6a, 0x7814, 0x2048,
+	0x080c, 0xcb33, 0x1130, 0x7814, 0x9084, 0x0700, 0x8007, 0x0033,
+	0x0010, 0x9006, 0x001b, 0x009e, 0x00de, 0x0005, 0x9e88, 0x9ef1,
+	0x9f01, 0x9f27, 0x9f33, 0x9f44, 0x9f4c, 0x9e86, 0x080c, 0x0dd5,
+	0x0016, 0x0036, 0xa97c, 0x918c, 0x0003, 0x0118, 0x9186, 0x0003,
+	0x1198, 0xaba8, 0x7824, 0xd0cc, 0x1168, 0x7316, 0xa898, 0x701a,
+	0xa894, 0x701e, 0x003e, 0x001e, 0x2001, 0x19b1, 0x2004, 0x60c2,
+	0x0804, 0xa247, 0xc3e5, 0x0c88, 0x9186, 0x0001, 0x190c, 0x0dd5,
+	0xaba8, 0x7824, 0xd0cc, 0x1904, 0x9eee, 0x7316, 0xa898, 0x701a,
+	0xa894, 0x701e, 0xa8a4, 0x7026, 0xa8ac, 0x702e, 0x2009, 0x0018,
+	0x9384, 0x0300, 0x0570, 0xd3c4, 0x0110, 0xa8ac, 0x9108, 0xd3cc,
+	0x0110, 0xa8a4, 0x9108, 0x6810, 0x9085, 0x0010, 0x6812, 0x2011,
+	0x0258, 0x20e9, 0x0000, 0x22a0, 0x0156, 0x20a9, 0x0008, 0xa860,
+	0x20e0, 0xa85c, 0x9080, 0x002c, 0x2098, 0x4003, 0x6810, 0x8000,
+	0x6812, 0x2011, 0x0240, 0x22a0, 0x20a9, 0x0005, 0x4003, 0x6810,
+	0xc084, 0x6812, 0x015e, 0x9184, 0x0003, 0x0118, 0x2019, 0x0245,
+	0x201a, 0x61c2, 0x003e, 0x001e, 0x0804, 0xa247, 0xc3e5, 0x0804,
+	0x9ead, 0x2011, 0x0008, 0x2001, 0x180f, 0x2004, 0xd0a4, 0x0110,
+	0x2011, 0x0028, 0x7824, 0xd0cc, 0x1110, 0x7216, 0x0470, 0x0ce8,
+	0xc2e5, 0x2011, 0x0302, 0x0016, 0x782c, 0x701a, 0x7930, 0x711e,
+	0x9105, 0x0108, 0xc2dd, 0x001e, 0x7824, 0xd0cc, 0x0108, 0xc2e5,
+	0x7216, 0x7027, 0x0012, 0x702f, 0x0008, 0x7043, 0x7000, 0x7047,
+	0x0500, 0x704f, 0x000a, 0x2069, 0x0200, 0x6813, 0x0009, 0x2071,
+	0x0240, 0x700b, 0x2500, 0x60c3, 0x0032, 0x0804, 0xa247, 0x2011,
+	0x0028, 0x7824, 0xd0cc, 0x1128, 0x7216, 0x60c3, 0x0018, 0x0804,
+	0xa247, 0x0cd0, 0xc2e5, 0x2011, 0x0100, 0x7824, 0xd0cc, 0x0108,
+	0xc2e5, 0x7216, 0x702f, 0x0008, 0x7858, 0x9084, 0x00ff, 0x7036,
+	0x60c3, 0x0020, 0x0804, 0xa247, 0x2011, 0x0008, 0x7824, 0xd0cc,
+	0x0108, 0xc2e5, 0x7216, 0x0c08, 0x0036, 0x7b14, 0x9384, 0xff00,
+	0x7816, 0x9384, 0x00ff, 0x8001, 0x1138, 0x7824, 0xd0cc, 0x0108,
+	0xc2e5, 0x7216, 0x003e, 0x0888, 0x0046, 0x2021, 0x0800, 0x0006,
+	0x7824, 0xd0cc, 0x000e, 0x0108, 0xc4e5, 0x7416, 0x004e, 0x701e,
+	0x003e, 0x0818, 0x00d6, 0x6813, 0x0008, 0xb810, 0x9085, 0x0700,
 	0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880,
-	0x700e, 0x2001, 0x0099, 0x7012, 0x0804, 0x9cb4, 0x00b6, 0x00c6,
-	0x00d6, 0x00e6, 0x00f6, 0x2c78, 0x2069, 0x0200, 0x2071, 0x0240,
-	0x7804, 0x908a, 0x0040, 0x0a0c, 0x0dd5, 0x908a, 0x0054, 0x1a0c,
-	0x0dd5, 0x7910, 0x2158, 0xb9c0, 0x2061, 0x0100, 0x619a, 0x9082,
-	0x0040, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x0005,
-	0x9d85, 0x9e41, 0x9e14, 0x9f63, 0x9d83, 0x9d83, 0x9d83, 0x9d83,
-	0x9d83, 0x9d83, 0x9d83, 0xa655, 0xa65d, 0xa665, 0xa66d, 0x9d83,
-	0xaa4f, 0x9d83, 0xa64d, 0x080c, 0x0dd5, 0x0096, 0x780b, 0xffff,
-	0x080c, 0x9df0, 0x7914, 0x2148, 0xa978, 0x7956, 0xae64, 0x96b4,
-	0x00ff, 0x9686, 0x0008, 0x1148, 0xa8b4, 0x7032, 0xa8b8, 0x7036,
-	0xa8bc, 0x703a, 0xa8c0, 0x703e, 0x0008, 0x7132, 0xa97c, 0x9184,
-	0x000f, 0x1118, 0x2001, 0x0005, 0x0040, 0xd184, 0x0118, 0x2001,
-	0x0004, 0x0018, 0x9084, 0x0006, 0x8004, 0x2010, 0x785c, 0x9084,
-	0x00ff, 0x8007, 0x9205, 0x7042, 0xd1ac, 0x0158, 0x7047, 0x0002,
-	0x9686, 0x0008, 0x1118, 0x080c, 0x18ac, 0x0010, 0x080c, 0x1725,
-	0x0050, 0xd1b4, 0x0118, 0x7047, 0x0001, 0x0028, 0x7047, 0x0000,
-	0x9016, 0x2230, 0x0010, 0xaab0, 0xaeac, 0x726a, 0x766e, 0x20a9,
-	0x0008, 0x20e9, 0x0000, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0023,
-	0x2098, 0x20a1, 0x0252, 0x2069, 0x0200, 0x6813, 0x0018, 0x4003,
-	0x6813, 0x0008, 0x60c3, 0x0020, 0x6017, 0x0009, 0x2001, 0x1a03,
-	0x2003, 0x07d0, 0x2001, 0x1a02, 0x2003, 0x0009, 0x009e, 0x0005,
-	0x6813, 0x0008, 0xba8c, 0x8210, 0xb8cc, 0xd084, 0x0128, 0x7a46,
-	0x7b14, 0x7b4a, 0x722e, 0x732a, 0x9294, 0x00ff, 0xba8e, 0x8217,
-	0x721a, 0xba10, 0x9295, 0x0600, 0x7202, 0xba14, 0x7206, 0x2069,
-	0x1800, 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013, 0x0829, 0x2f10,
-	0x7222, 0x7027, 0xffff, 0x0005, 0x00d6, 0x0096, 0x0081, 0x7814,
-	0x2048, 0xa890, 0x7002, 0xa88c, 0x7006, 0xa8b0, 0x700a, 0xa8ac,
-	0x700e, 0x60c3, 0x000c, 0x009e, 0x00de, 0x0804, 0xa22d, 0x6813,
-	0x0008, 0xb810, 0x9085, 0x0500, 0x7002, 0xb814, 0x7006, 0x2069,
-	0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x7013, 0x0889, 0x080c,
-	0xa21b, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c,
-	0x0005, 0x00d6, 0x0096, 0x080c, 0x9f41, 0x7814, 0x2048, 0x080c,
-	0xcb19, 0x1130, 0x7814, 0x9084, 0x0700, 0x8007, 0x0033, 0x0010,
-	0x9006, 0x001b, 0x009e, 0x00de, 0x0005, 0x9e5f, 0x9ec8, 0x9ed8,
-	0x9efe, 0x9f0a, 0x9f1b, 0x9f23, 0x9e5d, 0x080c, 0x0dd5, 0x0016,
-	0x0036, 0xa97c, 0x918c, 0x0003, 0x0118, 0x9186, 0x0003, 0x1198,
-	0xaba8, 0x7824, 0xd0cc, 0x1168, 0x7316, 0xa898, 0x701a, 0xa894,
-	0x701e, 0x003e, 0x001e, 0x2001, 0x19b1, 0x2004, 0x60c2, 0x0804,
-	0xa22d, 0xc3e5, 0x0c88, 0x9186, 0x0001, 0x190c, 0x0dd5, 0xaba8,
-	0x7824, 0xd0cc, 0x1904, 0x9ec5, 0x7316, 0xa898, 0x701a, 0xa894,
-	0x701e, 0xa8a4, 0x7026, 0xa8ac, 0x702e, 0x2009, 0x0018, 0x9384,
-	0x0300, 0x0570, 0xd3c4, 0x0110, 0xa8ac, 0x9108, 0xd3cc, 0x0110,
-	0xa8a4, 0x9108, 0x6810, 0x9085, 0x0010, 0x6812, 0x2011, 0x0258,
-	0x20e9, 0x0000, 0x22a0, 0x0156, 0x20a9, 0x0008, 0xa860, 0x20e0,
-	0xa85c, 0x9080, 0x002c, 0x2098, 0x4003, 0x6810, 0x8000, 0x6812,
-	0x2011, 0x0240, 0x22a0, 0x20a9, 0x0005, 0x4003, 0x6810, 0xc084,
-	0x6812, 0x015e, 0x9184, 0x0003, 0x0118, 0x2019, 0x0245, 0x201a,
-	0x61c2, 0x003e, 0x001e, 0x0804, 0xa22d, 0xc3e5, 0x0804, 0x9e84,
-	0x2011, 0x0008, 0x2001, 0x180f, 0x2004, 0xd0a4, 0x0110, 0x2011,
-	0x0028, 0x7824, 0xd0cc, 0x1110, 0x7216, 0x0470, 0x0ce8, 0xc2e5,
-	0x2011, 0x0302, 0x0016, 0x782c, 0x701a, 0x7930, 0x711e, 0x9105,
-	0x0108, 0xc2dd, 0x001e, 0x7824, 0xd0cc, 0x0108, 0xc2e5, 0x7216,
-	0x7027, 0x0012, 0x702f, 0x0008, 0x7043, 0x7000, 0x7047, 0x0500,
-	0x704f, 0x000a, 0x2069, 0x0200, 0x6813, 0x0009, 0x2071, 0x0240,
-	0x700b, 0x2500, 0x60c3, 0x0032, 0x0804, 0xa22d, 0x2011, 0x0028,
-	0x7824, 0xd0cc, 0x1128, 0x7216, 0x60c3, 0x0018, 0x0804, 0xa22d,
-	0x0cd0, 0xc2e5, 0x2011, 0x0100, 0x7824, 0xd0cc, 0x0108, 0xc2e5,
-	0x7216, 0x702f, 0x0008, 0x7858, 0x9084, 0x00ff, 0x7036, 0x60c3,
-	0x0020, 0x0804, 0xa22d, 0x2011, 0x0008, 0x7824, 0xd0cc, 0x0108,
-	0xc2e5, 0x7216, 0x0c08, 0x0036, 0x7b14, 0x9384, 0xff00, 0x7816,
-	0x9384, 0x00ff, 0x8001, 0x1138, 0x7824, 0xd0cc, 0x0108, 0xc2e5,
-	0x7216, 0x003e, 0x0888, 0x0046, 0x2021, 0x0800, 0x0006, 0x7824,
-	0xd0cc, 0x000e, 0x0108, 0xc4e5, 0x7416, 0x004e, 0x701e, 0x003e,
-	0x0818, 0x00d6, 0x6813, 0x0008, 0xb810, 0x9085, 0x0700, 0x7002,
-	0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e,
-	0x7824, 0xd0cc, 0x1168, 0x7013, 0x0898, 0x080c, 0xa21b, 0x721a,
-	0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005,
-	0x7013, 0x0889, 0x0c90, 0x0016, 0x7814, 0x9084, 0x0700, 0x8007,
-	0x0013, 0x001e, 0x0005, 0x9f73, 0x9f73, 0x9f75, 0x9f73, 0x9f73,
-	0x9f73, 0x9f8f, 0x9f73, 0x080c, 0x0dd5, 0x7914, 0x918c, 0x08ff,
-	0x918d, 0xf600, 0x7916, 0x2009, 0x0003, 0x00b9, 0x2069, 0x1847,
-	0x6804, 0xd0bc, 0x0130, 0x682c, 0x9084, 0x00ff, 0x8007, 0x7032,
-	0x0010, 0x7033, 0x3f00, 0x60c3, 0x0001, 0x0804, 0xa22d, 0x2009,
-	0x0003, 0x0019, 0x7033, 0x7f00, 0x0cb0, 0x0016, 0x080c, 0xab07,
-	0x001e, 0xb810, 0x9085, 0x0100, 0x7002, 0xb814, 0x7006, 0x2069,
-	0x1800, 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013, 0x0888, 0x918d,
-	0x0008, 0x7116, 0x080c, 0xa21b, 0x721a, 0x7a08, 0x7222, 0x2f10,
-	0x7226, 0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056,
-	0x0046, 0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810,
-	0x2058, 0x76dc, 0x96b4, 0x0028, 0x0110, 0x737c, 0x7480, 0x2500,
-	0x76dc, 0x96b4, 0x0028, 0x0140, 0x2001, 0x04ff, 0x6062, 0x6067,
-	0xffff, 0x636a, 0x646e, 0x0050, 0x2001, 0x00ff, 0x9085, 0x0400,
-	0x6062, 0x6067, 0xffff, 0x606b, 0x0000, 0x616e, 0xb8b8, 0x6073,
-	0x0530, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
-	0x8007, 0x9085, 0x0020, 0x607a, 0x607f, 0x0000, 0x2b00, 0x6082,
-	0x6087, 0xffff, 0x7814, 0x0096, 0x2048, 0xa838, 0x608a, 0xa834,
-	0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca, 0x009e, 0xb86c, 0x60ce,
-	0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000, 0x2001, 0x1837,
-	0x2004, 0x9084, 0x0028, 0x0128, 0x609f, 0x0000, 0x2001, 0x0092,
-	0x0048, 0x6028, 0xc0bd, 0x602a, 0x609f, 0x00ff, 0x6027, 0xffff,
-	0x2001, 0x00b2, 0x6016, 0x2009, 0x07d0, 0x080c, 0x8555, 0x003e,
-	0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005,
-	0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046, 0x0036,
-	0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810, 0x2058, 0xb8a0,
-	0x2028, 0x76dc, 0xd6ac, 0x1168, 0x9582, 0x007e, 0x1250, 0x2500,
-	0x9094, 0xff80, 0x1130, 0x9080, 0x331e, 0x2015, 0x9294, 0x00ff,
-	0x0020, 0xb910, 0xba14, 0x737c, 0x7480, 0x70dc, 0xd0ac, 0x1130,
-	0x9582, 0x007e, 0x1218, 0x9584, 0xff80, 0x0138, 0x9185, 0x0400,
-	0x6062, 0x6266, 0x636a, 0x646e, 0x0030, 0x6063, 0x0400, 0x6266,
-	0x606b, 0x0000, 0x616e, 0xb8b8, 0x6072, 0x6077, 0x0000, 0xb864,
-	0xd0a4, 0x0110, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff,
+	0x700e, 0x7824, 0xd0cc, 0x1168, 0x7013, 0x0898, 0x080c, 0xa235,
+	0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c, 0x00de,
+	0x0005, 0x7013, 0x0889, 0x0c90, 0x0016, 0x7814, 0x9084, 0x0700,
+	0x8007, 0x0013, 0x001e, 0x0005, 0x9f9c, 0x9f9c, 0x9f9e, 0x9f9c,
+	0x9f9c, 0x9f9c, 0x9fb8, 0x9f9c, 0x080c, 0x0dd5, 0x7914, 0x918c,
+	0x08ff, 0x918d, 0xf600, 0x7916, 0x2009, 0x0003, 0x00b9, 0x2069,
+	0x1847, 0x6804, 0xd0bc, 0x0130, 0x682c, 0x9084, 0x00ff, 0x8007,
+	0x7032, 0x0010, 0x7033, 0x3f00, 0x60c3, 0x0001, 0x0804, 0xa247,
+	0x2009, 0x0003, 0x0019, 0x7033, 0x7f00, 0x0cb0, 0x0016, 0x080c,
+	0xab21, 0x001e, 0xb810, 0x9085, 0x0100, 0x7002, 0xb814, 0x7006,
+	0x2069, 0x1800, 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013, 0x0888,
+	0x918d, 0x0008, 0x7116, 0x080c, 0xa235, 0x721a, 0x7a08, 0x7222,
+	0x2f10, 0x7226, 0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066,
+	0x0056, 0x0046, 0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7160,
+	0x7810, 0x2058, 0x76dc, 0x96b4, 0x0028, 0x0110, 0x737c, 0x7480,
+	0x2500, 0x76dc, 0x96b4, 0x0028, 0x0140, 0x2001, 0x04ff, 0x6062,
+	0x6067, 0xffff, 0x636a, 0x646e, 0x0050, 0x2001, 0x00ff, 0x9085,
+	0x0400, 0x6062, 0x6067, 0xffff, 0x606b, 0x0000, 0x616e, 0xb8b8,
+	0x6073, 0x0530, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff,
 	0xb88e, 0x8007, 0x9085, 0x0020, 0x607a, 0x607f, 0x0000, 0x2b00,
 	0x6082, 0x6087, 0xffff, 0x7814, 0x0096, 0x2048, 0xa838, 0x608a,
 	0xa834, 0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca, 0x009e, 0xb86c,
-	0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000, 0xbac0,
-	0x629e, 0x00f6, 0x2079, 0x0140, 0x7803, 0x0000, 0x00fe, 0x2009,
-	0x0092, 0x6116, 0x2009, 0x07d0, 0x080c, 0x8555, 0x003e, 0x004e,
-	0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005, 0x00b6,
-	0x0096, 0x00e6, 0x00d6, 0x00c6, 0x0056, 0x0046, 0x0036, 0x2061,
-	0x0100, 0x2071, 0x1800, 0x7810, 0x2058, 0xb8a0, 0x2028, 0xb910,
-	0xba14, 0x737c, 0x7480, 0x7820, 0x90be, 0x0006, 0x0904, 0xa18a,
-	0x90be, 0x000a, 0x1904, 0xa146, 0x609f, 0x0000, 0x7814, 0x2048,
-	0xa87c, 0xd0fc, 0x05d0, 0xaf90, 0x9784, 0xff00, 0x9105, 0x6062,
-	0x873f, 0x9784, 0xff00, 0x0006, 0x7814, 0x2048, 0xa878, 0xc0fc,
-	0x9005, 0x000e, 0x1160, 0xaf94, 0x87ff, 0x0510, 0x2039, 0x0098,
-	0x9705, 0x6072, 0x7808, 0x6082, 0x2f00, 0x6086, 0x0038, 0x9185,
-	0x2200, 0x6062, 0x6073, 0x0129, 0x6077, 0x0000, 0x609f, 0x0000,
-	0x2001, 0x1837, 0x2004, 0xd0ac, 0x11a8, 0xd09c, 0x0130, 0x7814,
-	0x2048, 0xa874, 0x9082, 0x0080, 0x1268, 0xb814, 0x609e, 0x0050,
-	0x2039, 0x0029, 0x9705, 0x6072, 0x0c48, 0x9185, 0x0200, 0x6062,
-	0x6073, 0x2029, 0xa87c, 0xd0fc, 0x0118, 0xaf94, 0x87ff, 0x1120,
-	0x2f00, 0x6082, 0x7808, 0x6086, 0x6266, 0x636a, 0x646e, 0x6077,
-	0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a,
-	0x607f, 0x0000, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6,
+	0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000, 0x2001,
+	0x1837, 0x2004, 0x9084, 0x0028, 0x0128, 0x609f, 0x0000, 0x2001,
+	0x0092, 0x0048, 0x6028, 0xc0bd, 0x602a, 0x609f, 0x00ff, 0x6027,
+	0xffff, 0x2001, 0x00b2, 0x6016, 0x2009, 0x07d0, 0x080c, 0x857e,
+	0x003e, 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be,
+	0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046,
+	0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810, 0x2058,
+	0xb8a0, 0x2028, 0x76dc, 0xd6ac, 0x1168, 0x9582, 0x007e, 0x1250,
+	0x2500, 0x9094, 0xff80, 0x1130, 0x9080, 0x3325, 0x2015, 0x9294,
+	0x00ff, 0x0020, 0xb910, 0xba14, 0x737c, 0x7480, 0x70dc, 0xd0ac,
+	0x1130, 0x9582, 0x007e, 0x1218, 0x9584, 0xff80, 0x0138, 0x9185,
+	0x0400, 0x6062, 0x6266, 0x636a, 0x646e, 0x0030, 0x6063, 0x0400,
+	0x6266, 0x606b, 0x0000, 0x616e, 0xb8b8, 0x6072, 0x6077, 0x0000,
+	0xb864, 0xd0a4, 0x0110, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084,
+	0x00ff, 0xb88e, 0x8007, 0x9085, 0x0020, 0x607a, 0x607f, 0x0000,
+	0x2b00, 0x6082, 0x6087, 0xffff, 0x7814, 0x0096, 0x2048, 0xa838,
+	0x608a, 0xa834, 0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca, 0x009e,
+	0xb86c, 0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000,
+	0xbac0, 0x629e, 0x00f6, 0x2079, 0x0140, 0x7803, 0x0000, 0x00fe,
+	0x2009, 0x0092, 0x6116, 0x2009, 0x07d0, 0x080c, 0x857e, 0x003e,
+	0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005,
+	0x00b6, 0x0096, 0x00e6, 0x00d6, 0x00c6, 0x0056, 0x0046, 0x0036,
+	0x2061, 0x0100, 0x2071, 0x1800, 0x7810, 0x2058, 0xb8a0, 0x2028,
+	0xb910, 0xba14, 0x737c, 0x7480, 0x7820, 0x90be, 0x0006, 0x0904,
+	0xa1a4, 0x90be, 0x000a, 0x1904, 0xa160, 0xb8c0, 0x609e, 0x7814,
+	0x2048, 0xa87c, 0xd0fc, 0x0558, 0xaf90, 0x9784, 0xff00, 0x9105,
+	0x6062, 0x873f, 0x9784, 0xff00, 0x0006, 0x7814, 0x2048, 0xa878,
+	0xc0fc, 0x9005, 0x000e, 0x1160, 0xaf94, 0x87ff, 0x0198, 0x2039,
+	0x0098, 0x9705, 0x6072, 0x7808, 0x6082, 0x2f00, 0x6086, 0x0038,
+	0x9185, 0x2200, 0x6062, 0x6073, 0x0129, 0x6077, 0x0000, 0xb8c0,
+	0x609e, 0x0050, 0x2039, 0x0029, 0x9705, 0x6072, 0x0cc0, 0x9185,
+	0x0200, 0x6062, 0x6073, 0x2029, 0xa87c, 0xd0fc, 0x0118, 0xaf94,
+	0x87ff, 0x1120, 0x2f00, 0x6082, 0x7808, 0x6086, 0x6266, 0x636a,
+	0x646e, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
+	0x8007, 0x607a, 0x607f, 0x0000, 0xa838, 0x608a, 0xa834, 0x608e,
+	0xa848, 0x60c6, 0xa844, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5,
+	0x60d7, 0x0000, 0x080c, 0xab06, 0x2009, 0x07d0, 0x60c4, 0x9084,
+	0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58, 0x080c, 0x857e, 0x003e,
+	0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x009e, 0x00be, 0x0005,
+	0x7804, 0x9086, 0x0040, 0x0904, 0xa1e0, 0x9185, 0x0100, 0x6062,
+	0x6266, 0x636a, 0x646e, 0x6073, 0x0809, 0x6077, 0x0008, 0x60af,
+	0x95d5, 0x60d7, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
+	0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6082, 0x7808, 0x6086,
+	0x7814, 0x2048, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6,
+	0xa844, 0x60ca, 0xb86c, 0x60ce, 0xbac0, 0x629e, 0x080c, 0xab06,
+	0x2009, 0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110, 0x2009,
+	0x1b58, 0x080c, 0x857e, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de,
+	0x00ee, 0x009e, 0x00be, 0x0005, 0x7814, 0x2048, 0xa87c, 0x9084,
+	0x0003, 0x9086, 0x0002, 0x0904, 0xa1fc, 0x9185, 0x0100, 0x6062,
+	0x6266, 0x636a, 0x646e, 0x6073, 0x0880, 0x6077, 0x0008, 0xb88c,
+	0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a, 0x7838, 0x607e,
+	0x2f00, 0x6086, 0x7808, 0x6082, 0xa890, 0x608a, 0xa88c, 0x608e,
+	0xa8b0, 0x60c6, 0xa8ac, 0x60ca, 0xa8ac, 0x7930, 0x9108, 0x7932,
+	0xa8b0, 0x792c, 0x9109, 0x792e, 0xb86c, 0x60ce, 0x60af, 0x95d5,
+	0x60d7, 0x0000, 0xbac0, 0x629e, 0x080c, 0xaae3, 0x0804, 0xa190,
+	0xb8cc, 0xd084, 0x0148, 0xb88c, 0x7814, 0x2048, 0xb88c, 0x7846,
+	0xa836, 0x2900, 0xa83a, 0xb04a, 0x9185, 0x0600, 0x6062, 0x6266,
+	0x636a, 0x646e, 0x6073, 0x0829, 0x6077, 0x0000, 0x60af, 0x9575,
+	0x60d7, 0x0000, 0x0804, 0xa173, 0x9185, 0x0700, 0x6062, 0x6266,
+	0x636a, 0x646e, 0x7824, 0xd0cc, 0x7826, 0x0118, 0x6073, 0x0889,
+	0x0010, 0x6073, 0x0898, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084,
+	0x00ff, 0xb88e, 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6086,
+	0x7808, 0x6082, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6,
 	0xa844, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
-	0x080c, 0xaaec, 0x2009, 0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005,
-	0x0110, 0x2009, 0x1b58, 0x080c, 0x8555, 0x003e, 0x004e, 0x005e,
-	0x00ce, 0x00de, 0x00ee, 0x009e, 0x00be, 0x0005, 0x7804, 0x9086,
-	0x0040, 0x0904, 0xa1c6, 0x9185, 0x0100, 0x6062, 0x6266, 0x636a,
-	0x646e, 0x6073, 0x0809, 0x6077, 0x0008, 0x60af, 0x95d5, 0x60d7,
-	0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a,
-	0x607f, 0x0000, 0x2f00, 0x6082, 0x7808, 0x6086, 0x7814, 0x2048,
-	0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca,
-	0xb86c, 0x60ce, 0xbac0, 0x629e, 0x080c, 0xaaec, 0x2009, 0x07d0,
-	0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58, 0x080c,
-	0x8555, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x009e,
-	0x00be, 0x0005, 0x7814, 0x2048, 0xa87c, 0x9084, 0x0003, 0x9086,
-	0x0002, 0x0904, 0xa1e2, 0x9185, 0x0100, 0x6062, 0x6266, 0x636a,
-	0x646e, 0x6073, 0x0880, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084,
-	0x00ff, 0xb88e, 0x8007, 0x607a, 0x7838, 0x607e, 0x2f00, 0x6086,
-	0x7808, 0x6082, 0xa890, 0x608a, 0xa88c, 0x608e, 0xa8b0, 0x60c6,
-	0xa8ac, 0x60ca, 0xa8ac, 0x7930, 0x9108, 0x7932, 0xa8b0, 0x792c,
-	0x9109, 0x792e, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
-	0xbac0, 0x629e, 0x080c, 0xaac9, 0x0804, 0xa176, 0xb8cc, 0xd084,
-	0x0148, 0xb88c, 0x7814, 0x2048, 0xb88c, 0x7846, 0xa836, 0x2900,
-	0xa83a, 0xb04a, 0x9185, 0x0600, 0x6062, 0x6266, 0x636a, 0x646e,
-	0x6073, 0x0829, 0x6077, 0x0000, 0x60af, 0x9575, 0x60d7, 0x0000,
-	0x0804, 0xa159, 0x9185, 0x0700, 0x6062, 0x6266, 0x636a, 0x646e,
-	0x7824, 0xd0cc, 0x7826, 0x0118, 0x6073, 0x0889, 0x0010, 0x6073,
-	0x0898, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
-	0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6086, 0x7808, 0x6082,
-	0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca,
-	0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000, 0xbac0, 0x629e,
-	0x7824, 0xd0cc, 0x0120, 0x080c, 0xaaec, 0x0804, 0xa176, 0x080c,
-	0xaac9, 0x0804, 0xa176, 0x7a10, 0x00b6, 0x2258, 0xba8c, 0x8210,
-	0x9294, 0x00ff, 0xba8e, 0x00be, 0x8217, 0x0005, 0x00d6, 0x2069,
-	0x19e7, 0x6843, 0x0001, 0x00de, 0x0005, 0x60a3, 0x0056, 0x60a7,
-	0x9575, 0x00f1, 0x080c, 0x8547, 0x0005, 0x0016, 0x2001, 0x180c,
-	0x200c, 0x9184, 0x0600, 0x9086, 0x0600, 0x0128, 0x0089, 0x080c,
-	0x8547, 0x001e, 0x0005, 0xc1e5, 0x2001, 0x180c, 0x2102, 0x2001,
-	0x19e8, 0x2003, 0x0000, 0x2001, 0x19f0, 0x2003, 0x0000, 0x0c88,
-	0x0006, 0x6014, 0x9084, 0x1804, 0x9085, 0x0009, 0x6016, 0x000e,
-	0x0005, 0x0016, 0x00c6, 0x0006, 0x2061, 0x0100, 0x61a4, 0x60a7,
-	0x95f5, 0x6014, 0x9084, 0x1804, 0x9085, 0x0008, 0x6016, 0x000e,
-	0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e, 0x0005, 0x00c6,
-	0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c,
-	0x73b0, 0x11e8, 0x2001, 0x1a03, 0x2004, 0x9005, 0x1904, 0xa2bf,
-	0x0066, 0x2031, 0x0001, 0x080c, 0x7460, 0x006e, 0x1160, 0x2061,
-	0x0100, 0x6020, 0xd0b4, 0x1120, 0x6024, 0xd084, 0x090c, 0x0dd5,
-	0x080c, 0x8547, 0x0460, 0x00c6, 0x2061, 0x19e7, 0x00d0, 0x6904,
-	0x9194, 0x4000, 0x0548, 0x080c, 0xa259, 0x080c, 0x2cff, 0x00c6,
-	0x2061, 0x19e7, 0x6128, 0x9192, 0x0008, 0x1258, 0x8108, 0x612a,
-	0x6124, 0x00ce, 0x81ff, 0x0198, 0x080c, 0x8547, 0x080c, 0xa250,
-	0x0070, 0x6124, 0x91e5, 0x0000, 0x0140, 0x080c, 0xe9dd, 0x080c,
-	0x8550, 0x2009, 0x0014, 0x080c, 0xaec2, 0x00ce, 0x0000, 0x002e,
-	0x001e, 0x00de, 0x00ce, 0x0005, 0x2001, 0x1a03, 0x2004, 0x9005,
-	0x1db0, 0x00c6, 0x2061, 0x19e7, 0x6128, 0x9192, 0x0003, 0x1e08,
-	0x8108, 0x612a, 0x00ce, 0x080c, 0x8547, 0x080c, 0x5eda, 0x2009,
-	0x1846, 0x2114, 0x8210, 0x220a, 0x0c10, 0x0096, 0x00c6, 0x00d6,
-	0x00e6, 0x0016, 0x0026, 0x080c, 0x855d, 0x2071, 0x19e7, 0x713c,
-	0x81ff, 0x0904, 0xa363, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c,
-	0x73b0, 0x1500, 0x0036, 0x2019, 0x0002, 0x080c, 0xa59c, 0x003e,
-	0x713c, 0x2160, 0x080c, 0xe9dd, 0x2009, 0x004a, 0x6220, 0x9296,
-	0x0009, 0x1130, 0x6114, 0x2148, 0xa87b, 0x0006, 0x2009, 0x004a,
-	0x080c, 0xaec2, 0x0066, 0x2031, 0x0001, 0x080c, 0x7460, 0x006e,
-	0x0804, 0xa363, 0x080c, 0xa36f, 0x0904, 0xa363, 0x6904, 0xd1f4,
-	0x0904, 0xa36a, 0x080c, 0x2cff, 0x00c6, 0x703c, 0x9065, 0x090c,
-	0x0dd5, 0x6020, 0x00ce, 0x9086, 0x0006, 0x1528, 0x61c8, 0x60c4,
-	0x9105, 0x1508, 0x2009, 0x180c, 0x2104, 0xd0d4, 0x01e0, 0x6214,
-	0x9294, 0x1800, 0x1128, 0x6224, 0x9294, 0x0002, 0x1560, 0x0030,
-	0xc0d4, 0x200a, 0xd0cc, 0x0110, 0x080c, 0x2c52, 0x6014, 0x9084,
-	0xe7fd, 0x9085, 0x0010, 0x6016, 0x703c, 0x2060, 0x2009, 0x0049,
-	0x080c, 0xaec2, 0x00c0, 0x0036, 0x2019, 0x0001, 0x080c, 0xa59c,
-	0x003e, 0x713c, 0x2160, 0x080c, 0xe9dd, 0x2009, 0x004a, 0x6220,
-	0x9296, 0x0009, 0x1130, 0x6114, 0x2148, 0xa87b, 0x0006, 0x2009,
-	0x004a, 0x080c, 0xaec2, 0x002e, 0x001e, 0x00ee, 0x00de, 0x00ce,
-	0x009e, 0x0005, 0xd1ec, 0x1904, 0xa31a, 0x0804, 0xa31c, 0x00d6,
-	0x00c6, 0x0096, 0x703c, 0x9065, 0x090c, 0x0dd5, 0x2001, 0x1837,
-	0x2004, 0xd09c, 0x1904, 0xa3fb, 0x2001, 0x0306, 0x200c, 0x9184,
-	0x0030, 0x0904, 0xa3fb, 0x9184, 0x0048, 0x9086, 0x0008, 0x1904,
-	0xa3fb, 0x2001, 0x020b, 0x2004, 0xd0fc, 0x0904, 0xa3fb, 0xd08c,
-	0x0904, 0xa3fb, 0x2009, 0x1a80, 0x2104, 0x8000, 0x0208, 0x200a,
-	0x2069, 0x0100, 0x6914, 0x918c, 0x0184, 0x918d, 0x0010, 0x6916,
-	0x69c8, 0x2011, 0x0020, 0x68c8, 0x9106, 0x1570, 0x8211, 0x1dd8,
-	0x2001, 0x0306, 0x2003, 0x4800, 0x2001, 0x009a, 0x2003, 0x0004,
-	0x2001, 0x1a66, 0x2003, 0x0000, 0x2001, 0x1a6f, 0x2003, 0x0000,
-	0x6a88, 0x698c, 0x2200, 0x9105, 0x1120, 0x2c10, 0x080c, 0x1bad,
-	0x0040, 0x6014, 0x2048, 0xaa3a, 0xa936, 0x6ac4, 0x69c8, 0xa946,
-	0xaa4a, 0x0126, 0x00c6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1c46,
-	0x190c, 0x0dd5, 0x012e, 0x0090, 0x2009, 0x1a81, 0x2104, 0x8000,
-	0x0208, 0x200a, 0x69c8, 0x2011, 0x0020, 0x8211, 0x1df0, 0x68c8,
-	0x9106, 0x1dc0, 0x69c4, 0x68c8, 0x9105, 0x0160, 0x6824, 0xd08c,
-	0x0110, 0x6827, 0x0002, 0x7048, 0xc085, 0x704a, 0x0079, 0x7048,
-	0xc084, 0x704a, 0x2009, 0x07d0, 0x080c, 0x8555, 0x9006, 0x009e,
-	0x00ce, 0x00de, 0x0005, 0x9085, 0x0001, 0x0cc8, 0x0026, 0x00e6,
-	0x2071, 0x19e7, 0x7048, 0xd084, 0x01d8, 0x713c, 0x81ff, 0x01c0,
-	0x2071, 0x0100, 0x9188, 0x0008, 0x2114, 0x928e, 0x0006, 0x1138,
-	0x7014, 0x9084, 0x1984, 0x9085, 0x0012, 0x7016, 0x0048, 0x928e,
-	0x0009, 0x0db0, 0x7014, 0x9084, 0x1984, 0x9085, 0x0016, 0x7016,
-	0x00ee, 0x002e, 0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066,
-	0x0056, 0x0046, 0x0006, 0x0126, 0x2091, 0x8000, 0x6010, 0x2058,
-	0xbca0, 0x2071, 0x19e7, 0x7018, 0x2058, 0x8bff, 0x0190, 0xb8a0,
-	0x9406, 0x0118, 0xb854, 0x2058, 0x0cc0, 0x6014, 0x0096, 0x2048,
-	0xac6c, 0xad70, 0xae78, 0x009e, 0x080c, 0x6732, 0x0110, 0x9085,
-	0x0001, 0x012e, 0x000e, 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de,
-	0x00ee, 0x00be, 0x0005, 0x080c, 0x9c37, 0x7003, 0x1200, 0x7838,
-	0x7012, 0x783c, 0x7016, 0x00c6, 0x7820, 0x9086, 0x0004, 0x1148,
-	0x7810, 0x9005, 0x0130, 0x00b6, 0x2058, 0xb810, 0xb914, 0x00be,
-	0x0020, 0x2061, 0x1800, 0x607c, 0x6180, 0x9084, 0x00ff, 0x700a,
-	0x710e, 0x00ce, 0x60c3, 0x002c, 0x0804, 0xa22d, 0x080c, 0x9c37,
-	0x7003, 0x0f00, 0x7808, 0xd09c, 0x0128, 0xb810, 0x9084, 0x00ff,
-	0x700a, 0xb814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa22d, 0x0156,
-	0x080c, 0x9c82, 0x7003, 0x0200, 0x080c, 0x85b0, 0x20a9, 0x0006,
-	0x2011, 0xfff4, 0x2019, 0xfff5, 0x9ef0, 0x0002, 0x2305, 0x2072,
-	0x8e70, 0x2205, 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002,
-	0x1f04, 0xa496, 0x60c3, 0x001c, 0x015e, 0x0804, 0xa22d, 0x0016,
-	0x0026, 0x080c, 0x9c5e, 0x080c, 0x9c70, 0x9e80, 0x0004, 0x20e9,
-	0x0000, 0x20a0, 0x7814, 0x0096, 0x2048, 0xa800, 0x2048, 0xa860,
-	0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x009e, 0x7808, 0x9088,
-	0x0002, 0x21a8, 0x9192, 0x0010, 0x1250, 0x4003, 0x9080, 0x0004,
-	0x8003, 0x60c2, 0x080c, 0xa22d, 0x002e, 0x001e, 0x0005, 0x20a9,
-	0x0010, 0x4003, 0x080c, 0xaaf2, 0x20a1, 0x0240, 0x22a8, 0x4003,
-	0x0c68, 0x080c, 0x9c37, 0x7003, 0x6200, 0x7808, 0x700e, 0x60c3,
-	0x0008, 0x0804, 0xa22d, 0x0016, 0x0026, 0x080c, 0x9c37, 0x20e9,
-	0x0000, 0x20a1, 0x024c, 0x7814, 0x0096, 0x2048, 0xa800, 0x2048,
-	0xa860, 0x20e0, 0xa85c, 0x9080, 0x0023, 0x2098, 0x009e, 0x7808,
-	0x9088, 0x0002, 0x21a8, 0x4003, 0x8003, 0x60c2, 0x080c, 0xa22d,
-	0x002e, 0x001e, 0x0005, 0x00e6, 0x00c6, 0x0006, 0x0126, 0x2091,
-	0x8000, 0x2071, 0x19e7, 0x700c, 0x2060, 0x8cff, 0x0178, 0x080c,
-	0xcd21, 0x1110, 0x080c, 0xb7f9, 0x600c, 0x0006, 0x080c, 0xcf88,
-	0x080c, 0xae47, 0x080c, 0xa678, 0x00ce, 0x0c78, 0x2c00, 0x700e,
-	0x700a, 0x012e, 0x000e, 0x00ce, 0x00ee, 0x0005, 0x0126, 0x0156,
+	0xbac0, 0x629e, 0x7824, 0xd0cc, 0x0120, 0x080c, 0xab06, 0x0804,
+	0xa190, 0x080c, 0xaae3, 0x0804, 0xa190, 0x7a10, 0x00b6, 0x2258,
+	0xba8c, 0x8210, 0x9294, 0x00ff, 0xba8e, 0x00be, 0x8217, 0x0005,
+	0x00d6, 0x2069, 0x19e7, 0x6843, 0x0001, 0x00de, 0x0005, 0x60a3,
+	0x0056, 0x60a7, 0x9575, 0x00f1, 0x080c, 0x8570, 0x0005, 0x0016,
+	0x2001, 0x180c, 0x200c, 0x9184, 0x0600, 0x9086, 0x0600, 0x0128,
+	0x0089, 0x080c, 0x8570, 0x001e, 0x0005, 0xc1e5, 0x2001, 0x180c,
+	0x2102, 0x2001, 0x19e8, 0x2003, 0x0000, 0x2001, 0x19f0, 0x2003,
+	0x0000, 0x0c88, 0x0006, 0x6014, 0x9084, 0x1804, 0x9085, 0x0009,
+	0x6016, 0x000e, 0x0005, 0x0016, 0x00c6, 0x0006, 0x2061, 0x0100,
+	0x61a4, 0x60a7, 0x95f5, 0x6014, 0x9084, 0x1804, 0x9085, 0x0008,
+	0x6016, 0x000e, 0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e,
+	0x0005, 0x00c6, 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x080c, 0x73bc, 0x11e8, 0x2001, 0x1a03, 0x2004, 0x9005,
+	0x1904, 0xa2d9, 0x0066, 0x2031, 0x0001, 0x080c, 0x746c, 0x006e,
+	0x1160, 0x2061, 0x0100, 0x6020, 0xd0b4, 0x1120, 0x6024, 0xd084,
+	0x090c, 0x0dd5, 0x080c, 0x8570, 0x0460, 0x00c6, 0x2061, 0x19e7,
+	0x00d0, 0x6904, 0x9194, 0x4000, 0x0548, 0x080c, 0xa273, 0x080c,
+	0x2cff, 0x00c6, 0x2061, 0x19e7, 0x6128, 0x9192, 0x0008, 0x1258,
+	0x8108, 0x612a, 0x6124, 0x00ce, 0x81ff, 0x0198, 0x080c, 0x8570,
+	0x080c, 0xa26a, 0x0070, 0x6124, 0x91e5, 0x0000, 0x0140, 0x080c,
+	0xe9fe, 0x080c, 0x8579, 0x2009, 0x0014, 0x080c, 0xaedc, 0x00ce,
+	0x0000, 0x002e, 0x001e, 0x00de, 0x00ce, 0x0005, 0x2001, 0x1a03,
+	0x2004, 0x9005, 0x1db0, 0x00c6, 0x2061, 0x19e7, 0x6128, 0x9192,
+	0x0003, 0x1e08, 0x8108, 0x612a, 0x00ce, 0x080c, 0x8570, 0x080c,
+	0x5ed9, 0x2009, 0x1846, 0x2114, 0x8210, 0x220a, 0x0c10, 0x0096,
+	0x00c6, 0x00d6, 0x00e6, 0x0016, 0x0026, 0x080c, 0x8586, 0x2071,
+	0x19e7, 0x713c, 0x81ff, 0x0904, 0xa37d, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x080c, 0x73bc, 0x1500, 0x0036, 0x2019, 0x0002, 0x080c,
+	0xa5b6, 0x003e, 0x713c, 0x2160, 0x080c, 0xe9fe, 0x2009, 0x004a,
+	0x6220, 0x9296, 0x0009, 0x1130, 0x6114, 0x2148, 0xa87b, 0x0006,
+	0x2009, 0x004a, 0x080c, 0xaedc, 0x0066, 0x2031, 0x0001, 0x080c,
+	0x746c, 0x006e, 0x0804, 0xa37d, 0x080c, 0xa389, 0x0904, 0xa37d,
+	0x6904, 0xd1f4, 0x0904, 0xa384, 0x080c, 0x2cff, 0x00c6, 0x703c,
+	0x9065, 0x090c, 0x0dd5, 0x6020, 0x00ce, 0x9086, 0x0006, 0x1528,
+	0x61c8, 0x60c4, 0x9105, 0x1508, 0x2009, 0x180c, 0x2104, 0xd0d4,
+	0x01e0, 0x6214, 0x9294, 0x1800, 0x1128, 0x6224, 0x9294, 0x0002,
+	0x1560, 0x0030, 0xc0d4, 0x200a, 0xd0cc, 0x0110, 0x080c, 0x2c52,
+	0x6014, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x6016, 0x703c, 0x2060,
+	0x2009, 0x0049, 0x080c, 0xaedc, 0x00c0, 0x0036, 0x2019, 0x0001,
+	0x080c, 0xa5b6, 0x003e, 0x713c, 0x2160, 0x080c, 0xe9fe, 0x2009,
+	0x004a, 0x6220, 0x9296, 0x0009, 0x1130, 0x6114, 0x2148, 0xa87b,
+	0x0006, 0x2009, 0x004a, 0x080c, 0xaedc, 0x002e, 0x001e, 0x00ee,
+	0x00de, 0x00ce, 0x009e, 0x0005, 0xd1ec, 0x1904, 0xa334, 0x0804,
+	0xa336, 0x00d6, 0x00c6, 0x0096, 0x703c, 0x9065, 0x090c, 0x0dd5,
+	0x2001, 0x1837, 0x2004, 0xd09c, 0x1904, 0xa415, 0x2001, 0x0306,
+	0x200c, 0x9184, 0x0030, 0x0904, 0xa415, 0x9184, 0x0048, 0x9086,
+	0x0008, 0x1904, 0xa415, 0x2001, 0x020b, 0x2004, 0xd0fc, 0x0904,
+	0xa415, 0xd08c, 0x0904, 0xa415, 0x2009, 0x1a80, 0x2104, 0x8000,
+	0x0208, 0x200a, 0x2069, 0x0100, 0x6914, 0x918c, 0x0184, 0x918d,
+	0x0010, 0x6916, 0x69c8, 0x2011, 0x0020, 0x68c8, 0x9106, 0x1570,
+	0x8211, 0x1dd8, 0x2001, 0x0306, 0x2003, 0x4800, 0x2001, 0x009a,
+	0x2003, 0x0004, 0x2001, 0x1a66, 0x2003, 0x0000, 0x2001, 0x1a6f,
+	0x2003, 0x0000, 0x6a88, 0x698c, 0x2200, 0x9105, 0x1120, 0x2c10,
+	0x080c, 0x1bad, 0x0040, 0x6014, 0x2048, 0xaa3a, 0xa936, 0x6ac4,
+	0x69c8, 0xa946, 0xaa4a, 0x0126, 0x00c6, 0x2091, 0x2400, 0x002e,
+	0x080c, 0x1c46, 0x190c, 0x0dd5, 0x012e, 0x0090, 0x2009, 0x1a81,
+	0x2104, 0x8000, 0x0208, 0x200a, 0x69c8, 0x2011, 0x0020, 0x8211,
+	0x1df0, 0x68c8, 0x9106, 0x1dc0, 0x69c4, 0x68c8, 0x9105, 0x0160,
+	0x6824, 0xd08c, 0x0110, 0x6827, 0x0002, 0x7048, 0xc085, 0x704a,
+	0x0079, 0x7048, 0xc084, 0x704a, 0x2009, 0x07d0, 0x080c, 0x857e,
+	0x9006, 0x009e, 0x00ce, 0x00de, 0x0005, 0x9085, 0x0001, 0x0cc8,
+	0x0026, 0x00e6, 0x2071, 0x19e7, 0x7048, 0xd084, 0x01d8, 0x713c,
+	0x81ff, 0x01c0, 0x2071, 0x0100, 0x9188, 0x0008, 0x2114, 0x928e,
+	0x0006, 0x1138, 0x7014, 0x9084, 0x1984, 0x9085, 0x0012, 0x7016,
+	0x0048, 0x928e, 0x0009, 0x0db0, 0x7014, 0x9084, 0x1984, 0x9085,
+	0x0016, 0x7016, 0x00ee, 0x002e, 0x0005, 0x00b6, 0x00e6, 0x00d6,
+	0x00c6, 0x0066, 0x0056, 0x0046, 0x0006, 0x0126, 0x2091, 0x8000,
+	0x6010, 0x2058, 0xbca0, 0x2071, 0x19e7, 0x7018, 0x2058, 0x8bff,
+	0x0190, 0xb8a0, 0x9406, 0x0118, 0xb854, 0x2058, 0x0cc0, 0x6014,
+	0x0096, 0x2048, 0xac6c, 0xad70, 0xae78, 0x009e, 0x080c, 0x6731,
+	0x0110, 0x9085, 0x0001, 0x012e, 0x000e, 0x004e, 0x005e, 0x006e,
+	0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005, 0x080c, 0x9c60, 0x7003,
+	0x1200, 0x7838, 0x7012, 0x783c, 0x7016, 0x00c6, 0x7820, 0x9086,
+	0x0004, 0x1148, 0x7810, 0x9005, 0x0130, 0x00b6, 0x2058, 0xb810,
+	0xb914, 0x00be, 0x0020, 0x2061, 0x1800, 0x607c, 0x6180, 0x9084,
+	0x00ff, 0x700a, 0x710e, 0x00ce, 0x60c3, 0x002c, 0x0804, 0xa247,
+	0x080c, 0x9c60, 0x7003, 0x0f00, 0x7808, 0xd09c, 0x0128, 0xb810,
+	0x9084, 0x00ff, 0x700a, 0xb814, 0x700e, 0x60c3, 0x0008, 0x0804,
+	0xa247, 0x0156, 0x080c, 0x9cab, 0x7003, 0x0200, 0x080c, 0x85d9,
+	0x20a9, 0x0006, 0x2011, 0xfff4, 0x2019, 0xfff5, 0x9ef0, 0x0002,
+	0x2305, 0x2072, 0x8e70, 0x2205, 0x2072, 0x8e70, 0x9398, 0x0002,
+	0x9290, 0x0002, 0x1f04, 0xa4b0, 0x60c3, 0x001c, 0x015e, 0x0804,
+	0xa247, 0x0016, 0x0026, 0x080c, 0x9c87, 0x080c, 0x9c99, 0x9e80,
+	0x0004, 0x20e9, 0x0000, 0x20a0, 0x7814, 0x0096, 0x2048, 0xa800,
+	0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x009e,
+	0x7808, 0x9088, 0x0002, 0x21a8, 0x9192, 0x0010, 0x1250, 0x4003,
+	0x9080, 0x0004, 0x8003, 0x60c2, 0x080c, 0xa247, 0x002e, 0x001e,
+	0x0005, 0x20a9, 0x0010, 0x4003, 0x080c, 0xab0c, 0x20a1, 0x0240,
+	0x22a8, 0x4003, 0x0c68, 0x080c, 0x9c60, 0x7003, 0x6200, 0x7808,
+	0x700e, 0x60c3, 0x0008, 0x0804, 0xa247, 0x0016, 0x0026, 0x080c,
+	0x9c60, 0x20e9, 0x0000, 0x20a1, 0x024c, 0x7814, 0x0096, 0x2048,
+	0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0023, 0x2098,
+	0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x4003, 0x8003, 0x60c2,
+	0x080c, 0xa247, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00c6, 0x0006,
+	0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x700c, 0x2060, 0x8cff,
+	0x0178, 0x080c, 0xcd3b, 0x1110, 0x080c, 0xb813, 0x600c, 0x0006,
+	0x080c, 0xcfa2, 0x080c, 0xae61, 0x080c, 0xa692, 0x00ce, 0x0c78,
+	0x2c00, 0x700e, 0x700a, 0x012e, 0x000e, 0x00ce, 0x00ee, 0x0005,
+	0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026,
+	0x0016, 0x0006, 0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c,
+	0xe7ff, 0x2102, 0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x19e7,
+	0x7024, 0x2060, 0x8cff, 0x01f8, 0x080c, 0xa273, 0x6ac0, 0x68c3,
+	0x0000, 0x080c, 0x8579, 0x00c6, 0x2061, 0x0100, 0x080c, 0xac5d,
+	0x00ce, 0x20a9, 0x01f4, 0x0461, 0x2009, 0x0013, 0x080c, 0xaedc,
+	0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
+	0x015e, 0x012e, 0x0005, 0x2001, 0x1800, 0x2004, 0x9096, 0x0001,
+	0x0d78, 0x9096, 0x0004, 0x0d60, 0x080c, 0x8579, 0x6814, 0x9084,
+	0x0001, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000,
+	0x2011, 0x5e83, 0x080c, 0x84f3, 0x20a9, 0x01f4, 0x0009, 0x08c0,
+	0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000,
+	0x190c, 0x2cff, 0x0090, 0xd084, 0x0118, 0x6827, 0x0001, 0x0010,
+	0x1f04, 0xa598, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100,
+	0x080c, 0x2cef, 0x9006, 0x080c, 0x2cef, 0x0005, 0x0126, 0x0156,
 	0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006,
-	0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c, 0xe7ff, 0x2102,
-	0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x19e7, 0x7024, 0x2060,
-	0x8cff, 0x01f8, 0x080c, 0xa259, 0x6ac0, 0x68c3, 0x0000, 0x080c,
-	0x8550, 0x00c6, 0x2061, 0x0100, 0x080c, 0xac43, 0x00ce, 0x20a9,
-	0x01f4, 0x0461, 0x2009, 0x0013, 0x080c, 0xaec2, 0x000e, 0x001e,
-	0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e,
-	0x0005, 0x2001, 0x1800, 0x2004, 0x9096, 0x0001, 0x0d78, 0x9096,
-	0x0004, 0x0d60, 0x080c, 0x8550, 0x6814, 0x9084, 0x0001, 0x0110,
-	0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000, 0x2011, 0x5e84,
-	0x080c, 0x84ca, 0x20a9, 0x01f4, 0x0009, 0x08c0, 0x6824, 0xd094,
+	0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c, 0xdbff, 0x2102,
+	0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x19e7, 0x703c, 0x2060,
+	0x8cff, 0x0904, 0xa648, 0x9386, 0x0002, 0x1128, 0x6814, 0x9084,
+	0x0002, 0x0904, 0xa648, 0x68af, 0x95f5, 0x6817, 0x0010, 0x2009,
+	0x00fa, 0x8109, 0x1df0, 0x69c6, 0x68cb, 0x0008, 0x080c, 0x8586,
+	0x080c, 0x1ffa, 0x0046, 0x2009, 0x00a5, 0x080c, 0x0e51, 0x2021,
+	0x0169, 0x2404, 0x9084, 0x000f, 0x9086, 0x0004, 0x11f8, 0x68af,
+	0x95f5, 0x68c6, 0x68cb, 0x0008, 0x00e6, 0x00f6, 0x2079, 0x0090,
+	0x2071, 0x1a66, 0x6814, 0x9084, 0x1984, 0x9085, 0x0012, 0x6816,
+	0x782b, 0x0008, 0x7003, 0x0000, 0x00fe, 0x00ee, 0x9386, 0x0002,
+	0x1128, 0x7884, 0x9005, 0x1110, 0x7887, 0x0001, 0x2001, 0x1981,
+	0x200c, 0x080c, 0x0e51, 0x004e, 0x20a9, 0x03e8, 0x6824, 0xd094,
 	0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000, 0x190c, 0x2cff,
-	0x0090, 0xd084, 0x0118, 0x6827, 0x0001, 0x0010, 0x1f04, 0xa57e,
+	0x0090, 0xd08c, 0x0118, 0x6827, 0x0002, 0x0010, 0x1f04, 0xa61e,
 	0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2cef,
-	0x9006, 0x080c, 0x2cef, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6,
-	0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000,
-	0x2001, 0x180c, 0x200c, 0x918c, 0xdbff, 0x2102, 0x2069, 0x0100,
-	0x2079, 0x0140, 0x2071, 0x19e7, 0x703c, 0x2060, 0x8cff, 0x0904,
-	0xa62e, 0x9386, 0x0002, 0x1128, 0x6814, 0x9084, 0x0002, 0x0904,
-	0xa62e, 0x68af, 0x95f5, 0x6817, 0x0010, 0x2009, 0x00fa, 0x8109,
-	0x1df0, 0x69c6, 0x68cb, 0x0008, 0x080c, 0x855d, 0x080c, 0x1ffa,
-	0x0046, 0x2009, 0x00a5, 0x080c, 0x0e51, 0x2021, 0x0169, 0x2404,
-	0x9084, 0x000f, 0x9086, 0x0004, 0x11f8, 0x68af, 0x95f5, 0x68c6,
-	0x68cb, 0x0008, 0x00e6, 0x00f6, 0x2079, 0x0090, 0x2071, 0x1a66,
-	0x6814, 0x9084, 0x1984, 0x9085, 0x0012, 0x6816, 0x782b, 0x0008,
-	0x7003, 0x0000, 0x00fe, 0x00ee, 0x9386, 0x0002, 0x1128, 0x7884,
-	0x9005, 0x1110, 0x7887, 0x0001, 0x2001, 0x1981, 0x200c, 0x080c,
-	0x0e51, 0x004e, 0x20a9, 0x03e8, 0x6824, 0xd094, 0x0140, 0x6827,
-	0x0004, 0x7804, 0x9084, 0x4000, 0x190c, 0x2cff, 0x0090, 0xd08c,
-	0x0118, 0x6827, 0x0002, 0x0010, 0x1f04, 0xa604, 0x7804, 0x9084,
-	0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2cef, 0x9006, 0x080c,
-	0x2cef, 0x6827, 0x4000, 0x6824, 0x83ff, 0x1140, 0x2009, 0x0049,
-	0x6020, 0x9086, 0x0009, 0x0110, 0x080c, 0xaec2, 0x000e, 0x001e,
-	0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e,
-	0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19e7, 0x6a06,
-	0x012e, 0x00de, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069,
-	0x19e7, 0x6a32, 0x012e, 0x00de, 0x0005, 0x080c, 0x9df0, 0x7854,
-	0x7032, 0x7042, 0x7047, 0x1000, 0x00f8, 0x080c, 0x9df0, 0x7854,
-	0x7032, 0x7042, 0x7047, 0x4000, 0x00b8, 0x080c, 0x9df0, 0x7854,
-	0x7032, 0x7042, 0x7047, 0x2000, 0x0078, 0x080c, 0x9df0, 0x7854,
-	0x7032, 0x7042, 0x7047, 0x0400, 0x0038, 0x080c, 0x9df0, 0x7854,
-	0x7032, 0x7042, 0x7047, 0x0200, 0x60c3, 0x0020, 0x0804, 0xa22d,
-	0x00e6, 0x2071, 0x19e7, 0x7020, 0x9005, 0x0110, 0x8001, 0x7022,
-	0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066,
-	0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x7614, 0x2660,
-	0x2678, 0x2039, 0x0001, 0x87ff, 0x0904, 0xa71d, 0x8cff, 0x0904,
-	0xa71d, 0x6020, 0x9086, 0x0006, 0x1904, 0xa718, 0x88ff, 0x0138,
-	0x2800, 0x9c06, 0x1904, 0xa718, 0x2039, 0x0000, 0x0050, 0x6010,
-	0x9b06, 0x1904, 0xa718, 0x85ff, 0x0120, 0x6054, 0x9106, 0x1904,
-	0xa718, 0x7024, 0x9c06, 0x15b0, 0x2069, 0x0100, 0x68c0, 0x9005,
-	0x1160, 0x6824, 0xd084, 0x0148, 0x6827, 0x0001, 0x080c, 0x8550,
-	0x080c, 0xa7a2, 0x7027, 0x0000, 0x0428, 0x080c, 0x8550, 0x6820,
-	0xd0b4, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000,
-	0x080c, 0xa7a2, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04,
+	0x9006, 0x080c, 0x2cef, 0x6827, 0x4000, 0x6824, 0x83ff, 0x1140,
+	0x2009, 0x0049, 0x6020, 0x9086, 0x0009, 0x0110, 0x080c, 0xaedc,
+	0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
+	0x015e, 0x012e, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069,
+	0x19e7, 0x6a06, 0x012e, 0x00de, 0x0005, 0x00d6, 0x0126, 0x2091,
+	0x8000, 0x2069, 0x19e7, 0x6a32, 0x012e, 0x00de, 0x0005, 0x080c,
+	0x9e19, 0x7854, 0x7032, 0x7042, 0x7047, 0x1000, 0x00f8, 0x080c,
+	0x9e19, 0x7854, 0x7032, 0x7042, 0x7047, 0x4000, 0x00b8, 0x080c,
+	0x9e19, 0x7854, 0x7032, 0x7042, 0x7047, 0x2000, 0x0078, 0x080c,
+	0x9e19, 0x7854, 0x7032, 0x7042, 0x7047, 0x0400, 0x0038, 0x080c,
+	0x9e19, 0x7854, 0x7032, 0x7042, 0x7047, 0x0200, 0x60c3, 0x0020,
+	0x0804, 0xa247, 0x00e6, 0x2071, 0x19e7, 0x7020, 0x9005, 0x0110,
+	0x8001, 0x7022, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
+	0x0076, 0x0066, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7,
+	0x7614, 0x2660, 0x2678, 0x2039, 0x0001, 0x87ff, 0x0904, 0xa737,
+	0x8cff, 0x0904, 0xa737, 0x6020, 0x9086, 0x0006, 0x1904, 0xa732,
+	0x88ff, 0x0138, 0x2800, 0x9c06, 0x1904, 0xa732, 0x2039, 0x0000,
+	0x0050, 0x6010, 0x9b06, 0x1904, 0xa732, 0x85ff, 0x0120, 0x6054,
+	0x9106, 0x1904, 0xa732, 0x7024, 0x9c06, 0x15b0, 0x2069, 0x0100,
+	0x68c0, 0x9005, 0x1160, 0x6824, 0xd084, 0x0148, 0x6827, 0x0001,
+	0x080c, 0x8579, 0x080c, 0xa7bc, 0x7027, 0x0000, 0x0428, 0x080c,
+	0x8579, 0x6820, 0xd0b4, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008,
+	0x68c3, 0x0000, 0x080c, 0xa7bc, 0x7027, 0x0000, 0x0036, 0x2069,
+	0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
+	0x2cef, 0x9006, 0x080c, 0x2cef, 0x2069, 0x0100, 0x6824, 0xd084,
+	0x0110, 0x6827, 0x0001, 0x003e, 0x7014, 0x9c36, 0x1110, 0x660c,
+	0x7616, 0x7010, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
+	0x7012, 0x0010, 0x7013, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
+	0x0110, 0x7e0e, 0x0008, 0x2678, 0x89ff, 0x1168, 0x600f, 0x0000,
+	0x6014, 0x0096, 0x2048, 0x080c, 0xcb33, 0x0110, 0x080c, 0xe551,
+	0x009e, 0x080c, 0xae92, 0x080c, 0xa692, 0x88ff, 0x1190, 0x00ce,
+	0x0804, 0xa6ad, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa6ad, 0x9006,
+	0x012e, 0x000e, 0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
+	0x0005, 0x601b, 0x0000, 0x00ce, 0x98c5, 0x0001, 0x0c88, 0x00f6,
+	0x00e6, 0x00d6, 0x0096, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126,
+	0x2091, 0x8000, 0x2071, 0x19e7, 0x7638, 0x2660, 0x2678, 0x8cff,
+	0x0904, 0xa7ab, 0x6020, 0x9086, 0x0006, 0x1904, 0xa7a6, 0x87ff,
+	0x0128, 0x2700, 0x9c06, 0x1904, 0xa7a6, 0x0040, 0x6010, 0x9b06,
+	0x15e8, 0x85ff, 0x0118, 0x6054, 0x9106, 0x15c0, 0x703c, 0x9c06,
+	0x1168, 0x0036, 0x2019, 0x0001, 0x080c, 0xa5b6, 0x7033, 0x0000,
+	0x9006, 0x703e, 0x7042, 0x7046, 0x704a, 0x003e, 0x7038, 0x9c36,
+	0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36,
+	0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x0066,
+	0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
+	0x6014, 0x2048, 0x080c, 0xcb33, 0x0110, 0x080c, 0xe551, 0x080c,
+	0xae92, 0x87ff, 0x1198, 0x00ce, 0x0804, 0xa757, 0x2c78, 0x600c,
+	0x2060, 0x0804, 0xa757, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e,
+	0x00ce, 0x009e, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000,
+	0x00ce, 0x97bd, 0x0001, 0x0c80, 0x00e6, 0x2071, 0x19e7, 0x2001,
+	0x1800, 0x2004, 0x9086, 0x0002, 0x1118, 0x7007, 0x0005, 0x0010,
+	0x7007, 0x0000, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0066,
+	0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x2c10,
+	0x7638, 0x2660, 0x2678, 0x8cff, 0x0518, 0x2200, 0x9c06, 0x11e0,
+	0x7038, 0x9c36, 0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140,
+	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000,
+	0x660c, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
+	0x0000, 0x9085, 0x0001, 0x0020, 0x2c78, 0x600c, 0x2060, 0x08d8,
+	0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
+	0x0096, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0006,
+	0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x760c, 0x2660, 0x2678,
+	0x8cff, 0x0904, 0xa898, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be,
+	0x9206, 0x1904, 0xa893, 0x7024, 0x9c06, 0x1520, 0x2069, 0x0100,
+	0x68c0, 0x9005, 0x0904, 0xa86f, 0x080c, 0xa273, 0x68c3, 0x0000,
+	0x080c, 0xa7bc, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04,
 	0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2cef, 0x9006,
 	0x080c, 0x2cef, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827,
-	0x0001, 0x003e, 0x7014, 0x9c36, 0x1110, 0x660c, 0x7616, 0x7010,
-	0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7012, 0x0010,
-	0x7013, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e,
-	0x0008, 0x2678, 0x89ff, 0x1168, 0x600f, 0x0000, 0x6014, 0x0096,
-	0x2048, 0x080c, 0xcb19, 0x0110, 0x080c, 0xe530, 0x009e, 0x080c,
-	0xae78, 0x080c, 0xa678, 0x88ff, 0x1190, 0x00ce, 0x0804, 0xa693,
-	0x2c78, 0x600c, 0x2060, 0x0804, 0xa693, 0x9006, 0x012e, 0x000e,
-	0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b,
-	0x0000, 0x00ce, 0x98c5, 0x0001, 0x0c88, 0x00f6, 0x00e6, 0x00d6,
-	0x0096, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000,
-	0x2071, 0x19e7, 0x7638, 0x2660, 0x2678, 0x8cff, 0x0904, 0xa791,
-	0x6020, 0x9086, 0x0006, 0x1904, 0xa78c, 0x87ff, 0x0128, 0x2700,
-	0x9c06, 0x1904, 0xa78c, 0x0040, 0x6010, 0x9b06, 0x15e8, 0x85ff,
-	0x0118, 0x6054, 0x9106, 0x15c0, 0x703c, 0x9c06, 0x1168, 0x0036,
-	0x2019, 0x0001, 0x080c, 0xa59c, 0x7033, 0x0000, 0x9006, 0x703e,
-	0x7042, 0x7046, 0x704a, 0x003e, 0x7038, 0x9c36, 0x1110, 0x660c,
-	0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
-	0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
-	0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6014, 0x2048,
-	0x080c, 0xcb19, 0x0110, 0x080c, 0xe530, 0x080c, 0xae78, 0x87ff,
-	0x1198, 0x00ce, 0x0804, 0xa73d, 0x2c78, 0x600c, 0x2060, 0x0804,
-	0xa73d, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x009e,
-	0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce, 0x97bd,
-	0x0001, 0x0c80, 0x00e6, 0x2071, 0x19e7, 0x2001, 0x1800, 0x2004,
-	0x9086, 0x0002, 0x1118, 0x7007, 0x0005, 0x0010, 0x7007, 0x0000,
-	0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0066, 0x0026, 0x0006,
-	0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x2c10, 0x7638, 0x2660,
-	0x2678, 0x8cff, 0x0518, 0x2200, 0x9c06, 0x11e0, 0x7038, 0x9c36,
-	0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36,
-	0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x2c00,
-	0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x9085,
-	0x0001, 0x0020, 0x2c78, 0x600c, 0x2060, 0x08d8, 0x012e, 0x000e,
-	0x002e, 0x006e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0096, 0x00f6,
-	0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091,
-	0x8000, 0x2071, 0x19e7, 0x760c, 0x2660, 0x2678, 0x8cff, 0x0904,
-	0xa87e, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x1904,
-	0xa879, 0x7024, 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005,
-	0x0904, 0xa855, 0x080c, 0xa259, 0x68c3, 0x0000, 0x080c, 0xa7a2,
-	0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
-	0x0138, 0x2001, 0x0100, 0x080c, 0x2cef, 0x9006, 0x080c, 0x2cef,
-	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
-	0x700c, 0x9c36, 0x1110, 0x660c, 0x760e, 0x7008, 0x9c36, 0x1140,
-	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700a, 0x0010, 0x700b, 0x0000,
-	0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678,
-	0x600f, 0x0000, 0x080c, 0xcd10, 0x1158, 0x080c, 0x31e1, 0x080c,
-	0xcd21, 0x11f0, 0x080c, 0xb7f9, 0x00d8, 0x080c, 0xa7a2, 0x08c0,
-	0x080c, 0xcd21, 0x1118, 0x080c, 0xb7f9, 0x0090, 0x6014, 0x2048,
-	0x080c, 0xcb19, 0x0168, 0x6020, 0x9086, 0x0003, 0x1508, 0xa867,
-	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6c6d, 0x080c, 0xcd04,
-	0x080c, 0xcf88, 0x080c, 0xae78, 0x080c, 0xa678, 0x00ce, 0x0804,
-	0xa7fe, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa7fe, 0x012e, 0x000e,
-	0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e, 0x0005,
-	0x6020, 0x9086, 0x0006, 0x1d20, 0x080c, 0xe530, 0x0c08, 0x00d6,
-	0x080c, 0x9c82, 0x7003, 0x0200, 0x7007, 0x0014, 0x60c3, 0x0014,
-	0x20e1, 0x0001, 0x2099, 0x1989, 0x20e9, 0x0000, 0x20a1, 0x0250,
-	0x20a9, 0x0004, 0x4003, 0x7023, 0x0004, 0x7027, 0x7878, 0x080c,
-	0xa22d, 0x00de, 0x0005, 0x080c, 0x9c82, 0x700b, 0x0800, 0x7814,
-	0x9084, 0xff00, 0x700e, 0x7814, 0x9084, 0x00ff, 0x7022, 0x782c,
-	0x7026, 0x7858, 0x9084, 0x00ff, 0x9085, 0x0200, 0x7002, 0x7858,
-	0x9084, 0xff00, 0x8007, 0x7006, 0x60c2, 0x0804, 0xa22d, 0x00b6,
-	0x00d6, 0x0016, 0x00d6, 0x2f68, 0x2009, 0x0035, 0x080c, 0xd18e,
-	0x00de, 0x1904, 0xa92c, 0x080c, 0x9c37, 0x7003, 0x1300, 0x782c,
-	0x080c, 0xaa2e, 0x2068, 0x6820, 0x9086, 0x0003, 0x0560, 0x7810,
-	0x2058, 0xbaa0, 0x080c, 0xadb1, 0x11d8, 0x9286, 0x007e, 0x1128,
-	0x700b, 0x00ff, 0x700f, 0xfffe, 0x0498, 0x9286, 0x007f, 0x1128,
-	0x700b, 0x00ff, 0x700f, 0xfffd, 0x0458, 0x9284, 0xff80, 0x0180,
-	0x9286, 0x0080, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffc, 0x0400,
-	0x92d8, 0x1000, 0x2b5c, 0xb810, 0x700a, 0xb814, 0x700e, 0x00c0,
-	0x6098, 0x700e, 0x00a8, 0x080c, 0xadb1, 0x1130, 0x7810, 0x2058,
-	0xb8a0, 0x9082, 0x007e, 0x0250, 0x00d6, 0x2069, 0x181f, 0x2d04,
-	0x700a, 0x8d68, 0x2d04, 0x700e, 0x00de, 0x0010, 0x6034, 0x700e,
-	0x7838, 0x7012, 0x783c, 0x7016, 0x60c3, 0x000c, 0x001e, 0x00de,
-	0x080c, 0xa22d, 0x00be, 0x0005, 0x781b, 0x0001, 0x7803, 0x0006,
-	0x001e, 0x00de, 0x00be, 0x0005, 0x792c, 0x9180, 0x0008, 0x200c,
-	0x9186, 0x0006, 0x01c0, 0x9186, 0x0003, 0x0904, 0xa9a6, 0x9186,
-	0x0005, 0x0904, 0xa98f, 0x9186, 0x0004, 0x05d8, 0x9186, 0x0008,
-	0x0904, 0xa997, 0x7807, 0x0037, 0x782f, 0x0003, 0x7817, 0x1700,
-	0x080c, 0xaa0b, 0x0005, 0x080c, 0xa9cc, 0x00d6, 0x0026, 0x792c,
-	0x2168, 0x2009, 0x4000, 0x6800, 0x0002, 0xa970, 0xa97b, 0xa972,
-	0xa97b, 0xa977, 0xa970, 0xa970, 0xa97b, 0xa97b, 0xa97b, 0xa97b,
-	0xa970, 0xa970, 0xa970, 0xa970, 0xa970, 0xa97b, 0xa970, 0xa97b,
-	0x080c, 0x0dd5, 0x6824, 0xd0e4, 0x0110, 0xd0cc, 0x0110, 0x900e,
-	0x0010, 0x2009, 0x2000, 0x682c, 0x7022, 0x6830, 0x7026, 0x0804,
-	0xa9c5, 0x080c, 0xa9cc, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009,
-	0x4000, 0x6a00, 0x9286, 0x0002, 0x1108, 0x900e, 0x04b0, 0x04e1,
-	0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x0470, 0x04a1,
-	0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x9286, 0x0005,
-	0x0118, 0x9286, 0x0002, 0x1108, 0x900e, 0x00f8, 0x0429, 0x00d6,
-	0x0026, 0x792c, 0x2168, 0x6814, 0x0096, 0x2048, 0xa9ac, 0xa834,
-	0x9112, 0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022, 0x7226, 0x792c,
-	0x9180, 0x0000, 0x2004, 0x908e, 0x0002, 0x0130, 0x908e, 0x0004,
-	0x0118, 0x2009, 0x4000, 0x0008, 0x900e, 0x712a, 0x60c3, 0x0018,
-	0x002e, 0x00de, 0x0804, 0xa22d, 0x00b6, 0x0036, 0x0046, 0x0056,
-	0x0066, 0x080c, 0x9c82, 0x9006, 0x7003, 0x0200, 0x7938, 0x710a,
-	0x793c, 0x710e, 0x7810, 0x2058, 0xb8a0, 0x080c, 0xadb1, 0x1118,
-	0x9092, 0x007e, 0x0268, 0x00d6, 0x2069, 0x181f, 0x2d2c, 0x8d68,
-	0x2d34, 0x90d8, 0x1000, 0x2b5c, 0xbb10, 0xbc14, 0x00de, 0x0028,
-	0x901e, 0x6498, 0x2029, 0x0000, 0x6634, 0x782c, 0x9080, 0x0008,
-	0x2004, 0x9086, 0x0003, 0x1128, 0x7512, 0x7616, 0x731a, 0x741e,
-	0x0020, 0x7312, 0x7416, 0x751a, 0x761e, 0x006e, 0x005e, 0x004e,
-	0x003e, 0x00be, 0x0005, 0x080c, 0x9c82, 0x7003, 0x0100, 0x782c,
-	0x700a, 0x7814, 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa22d,
-	0x080c, 0x9c2e, 0x7003, 0x1400, 0x7838, 0x700a, 0x0079, 0x783c,
-	0x700e, 0x782c, 0x7012, 0x7830, 0x7016, 0x7834, 0x9084, 0x00ff,
-	0x8007, 0x701a, 0x60c3, 0x0010, 0x0804, 0xa22d, 0x00e6, 0x2071,
-	0x0240, 0x0006, 0x00f6, 0x2078, 0x7810, 0x00b6, 0x2058, 0xb8cc,
-	0xd084, 0x0120, 0x7848, 0x702a, 0x7844, 0x702e, 0x00be, 0x00fe,
-	0x000e, 0x00ee, 0x0005, 0x080c, 0x9c79, 0x7003, 0x0100, 0x782c,
-	0x700a, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0xa22d, 0x0021,
-	0x60c3, 0x0000, 0x0804, 0xa22d, 0x00d6, 0x080c, 0xab07, 0xb810,
-	0x9085, 0x0300, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c,
-	0x700a, 0x6880, 0x700e, 0x7013, 0x0819, 0x080c, 0xa21b, 0x721a,
-	0x2f10, 0x7222, 0x7a08, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005,
-	0x00a9, 0x7914, 0x712a, 0x60c3, 0x0000, 0x60a7, 0x9575, 0x0026,
-	0x080c, 0x2ba5, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012,
-	0x002e, 0x080c, 0xa250, 0x080c, 0x8547, 0x0005, 0x0036, 0x0096,
-	0x00d6, 0x00e6, 0x7858, 0x2048, 0xaa7c, 0x9296, 0x00c0, 0x9294,
-	0xfffd, 0xaa7e, 0xaa80, 0x9294, 0x0300, 0xaa82, 0xa96c, 0x9194,
-	0x00ff, 0xab74, 0x9384, 0x00ff, 0x908d, 0xc200, 0xa96e, 0x9384,
-	0xff00, 0x9215, 0xaa76, 0xa870, 0xaa78, 0xa87a, 0xaa72, 0x00d6,
-	0x2069, 0x0200, 0x080c, 0xab07, 0x00de, 0x20e9, 0x0000, 0x20a1,
-	0x0240, 0x20a9, 0x000a, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b,
-	0x2098, 0x4003, 0x60a3, 0x0035, 0xaa68, 0x9294, 0x7000, 0x9286,
-	0x3000, 0x0110, 0x60a3, 0x0037, 0x00ee, 0x00de, 0x009e, 0x003e,
-	0x0005, 0x900e, 0x7814, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x01c0,
-	0x9084, 0x0003, 0x11a8, 0x2001, 0x180c, 0x2004, 0xd0bc, 0x0180,
-	0x7824, 0xd0cc, 0x1168, 0xd0c4, 0x1158, 0xa8a8, 0x9005, 0x1140,
-	0x2001, 0x180c, 0x200c, 0xc1d5, 0x2102, 0x2009, 0x19b2, 0x210c,
-	0x009e, 0x918d, 0x0092, 0x0010, 0x2009, 0x0096, 0x60ab, 0x0036,
-	0x6116, 0x0005, 0x2009, 0x0009, 0x00a0, 0x2009, 0x000a, 0x0088,
-	0x2009, 0x000b, 0x0070, 0x2009, 0x000c, 0x0058, 0x2009, 0x000d,
-	0x0040, 0x2009, 0x000e, 0x0028, 0x2009, 0x000f, 0x0010, 0x2009,
-	0x0008, 0x6912, 0x0005, 0x080c, 0x9c37, 0x0016, 0x0026, 0x0096,
-	0x00d6, 0x7814, 0x2048, 0x7013, 0x0138, 0x2001, 0x1837, 0x2004,
-	0x9084, 0x0028, 0x1138, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa,
-	0x1904, 0xabac, 0x7003, 0x5400, 0x00c6, 0x2061, 0x1800, 0x607c,
-	0x9084, 0x00ff, 0xa998, 0x810f, 0x918c, 0xff00, 0x9105, 0x700a,
-	0x6080, 0x700e, 0xa998, 0x918c, 0xff00, 0x7112, 0x20a9, 0x0004,
-	0x2009, 0x1805, 0x2e10, 0x9290, 0x0006, 0x2104, 0x2012, 0x8108,
-	0x8210, 0x1f04, 0xab3d, 0x20a9, 0x0004, 0x2009, 0x1801, 0x2104,
-	0x2012, 0x8108, 0x8210, 0x1f04, 0xab47, 0xa860, 0x20e0, 0xa85c,
-	0x9080, 0x0029, 0x2098, 0x2009, 0x0006, 0x20a9, 0x0001, 0x4002,
-	0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0x00d6, 0x2069, 0x0200,
-	0x080c, 0xaaf2, 0x00de, 0x2071, 0x0240, 0x2011, 0x0240, 0x2009,
-	0x0002, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109,
-	0x1dc0, 0x2009, 0x0008, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012,
-	0x8210, 0x8109, 0x1dc0, 0xa85c, 0x9080, 0x0031, 0x2098, 0x2009,
-	0x0008, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109,
-	0x1dc0, 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056, 0x60a7, 0x9575,
-	0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1168, 0x080c, 0x73b0,
-	0x0150, 0x6028, 0xc0bd, 0x602a, 0x6014, 0x9084, 0x1804, 0x9085,
-	0x0029, 0x6016, 0x0010, 0x080c, 0xa22d, 0x080c, 0x8547, 0x00de,
-	0x009e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x2071, 0x0240, 0x2001,
-	0x2200, 0x9085, 0x00ff, 0x7002, 0x7007, 0xffff, 0x2071, 0x0100,
-	0x709b, 0x00ff, 0x00ee, 0x0804, 0xab22, 0x080c, 0x9c37, 0x0016,
-	0x0026, 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013, 0x0138, 0x7003,
-	0x5500, 0x00c6, 0xa89c, 0x9084, 0x00ff, 0xa998, 0x810f, 0x918c,
-	0xff00, 0x9105, 0x700a, 0xa99c, 0x918c, 0xff00, 0xa8a0, 0x9084,
-	0x00ff, 0x9105, 0x700e, 0xa998, 0x918c, 0xff00, 0x2061, 0x1800,
-	0x607c, 0x9084, 0x00ff, 0x910d, 0x7112, 0x6180, 0x7116, 0x2009,
-	0x0008, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0029, 0x2098, 0x2e10,
-	0x9290, 0x0006, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210,
-	0x8109, 0x1dc0, 0x20a9, 0x0004, 0x2009, 0x1805, 0x2104, 0x2012,
-	0x8108, 0x8210, 0x1f04, 0xabfe, 0x20a9, 0x0002, 0x2009, 0x1801,
-	0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xac08, 0x00d6, 0x0016,
-	0x2069, 0x0200, 0x080c, 0xaaf2, 0x001e, 0x00de, 0x2071, 0x0240,
-	0x20a9, 0x0002, 0x2009, 0x1803, 0x2011, 0x0240, 0x2104, 0x2012,
-	0x8108, 0x8210, 0x1f04, 0xac1e, 0x2009, 0x0008, 0x4002, 0x8007,
-	0x2012, 0x8210, 0x8109, 0x1dd0, 0x9006, 0x20a9, 0x0008, 0x2012,
-	0x8210, 0x1f04, 0xac2f, 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056,
-	0x60a7, 0x9575, 0x080c, 0xa22d, 0x080c, 0x8547, 0x00de, 0x009e,
-	0x002e, 0x001e, 0x0005, 0x00d6, 0x9290, 0x0018, 0x8214, 0x20e9,
-	0x0000, 0x2069, 0x0200, 0x6813, 0x0000, 0x22a8, 0x9284, 0x00e0,
-	0x0128, 0x20a9, 0x0020, 0x9292, 0x0020, 0x0008, 0x9016, 0x20a1,
-	0x0240, 0x9006, 0x4004, 0x82ff, 0x0120, 0x6810, 0x8000, 0x6812,
-	0x0c60, 0x00de, 0x0005, 0x00d6, 0x0096, 0x6014, 0x2048, 0xa878,
-	0x6056, 0x9006, 0xa836, 0xa83a, 0xa99c, 0xa946, 0xa84a, 0x6023,
-	0x0003, 0x6007, 0x0040, 0x6003, 0x0003, 0x600b, 0xffff, 0xa817,
-	0x0001, 0xa842, 0xa83e, 0x2900, 0xa85a, 0xa813, 0x208e, 0x080c,
-	0x912c, 0x0126, 0x2091, 0x8000, 0x080c, 0x9790, 0x012e, 0x009e,
-	0x00de, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00a6, 0x0096,
-	0x0066, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x760c, 0x2660,
-	0x2678, 0x8cff, 0x0904, 0xad11, 0x7024, 0x9c06, 0x1520, 0x2069,
-	0x0100, 0x68c0, 0x9005, 0x0904, 0xace8, 0x080c, 0xa259, 0x68c3,
-	0x0000, 0x080c, 0xa7a2, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140,
-	0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2cef,
-	0x9006, 0x080c, 0x2cef, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110,
-	0x6827, 0x0001, 0x003e, 0x700c, 0x9c36, 0x1110, 0x660c, 0x760e,
-	0x7008, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700a,
-	0x0010, 0x700b, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110,
-	0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xcd10, 0x1158,
-	0x080c, 0x31e1, 0x080c, 0xcd21, 0x11f0, 0x080c, 0xb7f9, 0x00d8,
-	0x080c, 0xa7a2, 0x08c0, 0x080c, 0xcd21, 0x1118, 0x080c, 0xb7f9,
-	0x0090, 0x6014, 0x2048, 0x080c, 0xcb19, 0x0168, 0x6020, 0x9086,
-	0x0003, 0x1520, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
-	0x6c79, 0x080c, 0xcd04, 0x080c, 0xcf88, 0x080c, 0xae78, 0x080c,
-	0xa678, 0x00ce, 0x0804, 0xac99, 0x2c78, 0x600c, 0x2060, 0x0804,
-	0xac99, 0x700f, 0x0000, 0x700b, 0x0000, 0x012e, 0x006e, 0x009e,
-	0x00ae, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086,
-	0x0006, 0x1d08, 0x080c, 0xe530, 0x08f0, 0x00d6, 0x0156, 0x080c,
-	0x9c82, 0x7a14, 0x82ff, 0x0138, 0x7003, 0x0100, 0x700b, 0x0003,
-	0x60c3, 0x0008, 0x0490, 0x7003, 0x0200, 0x7007, 0x0000, 0x2069,
-	0x1800, 0x901e, 0x6800, 0x9086, 0x0004, 0x1110, 0xc38d, 0x0060,
-	0x080c, 0x73b0, 0x1110, 0xc3ad, 0x0008, 0xc3a5, 0x6adc, 0xd29c,
-	0x1110, 0xd2ac, 0x0108, 0xc39d, 0x730e, 0x080c, 0x85b0, 0x20a9,
-	0x0006, 0x2011, 0xfff4, 0x2019, 0xfff5, 0x2071, 0x0250, 0x2305,
-	0x2072, 0x8e70, 0x2205, 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290,
-	0x0002, 0x1f04, 0xad57, 0x60c3, 0x0020, 0x080c, 0xa22d, 0x015e,
-	0x00de, 0x0005, 0x0156, 0x080c, 0x9c82, 0x7a14, 0x82ff, 0x0168,
-	0x9286, 0xffff, 0x0118, 0x9282, 0x000e, 0x1238, 0x7003, 0x0100,
-	0x700b, 0x0003, 0x60c3, 0x0008, 0x0488, 0x7003, 0x0200, 0x7007,
-	0x001c, 0x700f, 0x0001, 0x2011, 0x19bd, 0x2204, 0x8007, 0x701a,
-	0x8210, 0x2204, 0x8007, 0x701e, 0x0421, 0x1120, 0xb8a0, 0x9082,
-	0x007f, 0x0248, 0x2001, 0x181f, 0x2004, 0x7022, 0x2001, 0x1820,
-	0x2004, 0x7026, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff,
-	0x7026, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
-	0x0000, 0x20a1, 0x0256, 0x4003, 0x60c3, 0x001c, 0x015e, 0x0804,
-	0xa22d, 0x0006, 0x2001, 0x1837, 0x2004, 0xd0ac, 0x000e, 0x0005,
-	0x2011, 0x0003, 0x080c, 0xa639, 0x2011, 0x0002, 0x080c, 0xa643,
-	0x080c, 0xa526, 0x0036, 0x901e, 0x080c, 0xa59c, 0x003e, 0x0005,
-	0x080c, 0x3317, 0x0188, 0x0016, 0x00b6, 0x00c6, 0x7010, 0x9085,
-	0x0020, 0x7012, 0x2009, 0x007e, 0x080c, 0x6600, 0xb85c, 0xc0ac,
-	0xb85e, 0x00ce, 0x00be, 0x001e, 0x0005, 0x2071, 0x188d, 0x7000,
-	0x9005, 0x0140, 0x2001, 0x0976, 0x2071, 0x1800, 0x7076, 0x707a,
-	0x706b, 0xffe0, 0x2071, 0x1800, 0x7074, 0x7056, 0x705b, 0x1cd0,
-	0x0005, 0x00e6, 0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7554,
-	0x9582, 0x0010, 0x0608, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000,
-	0x0148, 0x9ce0, 0x0018, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061,
-	0x1cd0, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x0018,
-	0x7068, 0x9502, 0x1230, 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee,
-	0x0005, 0x705b, 0x1cd0, 0x0cc0, 0x9006, 0x0cc0, 0x00e6, 0x2071,
-	0x1800, 0x7554, 0x9582, 0x0010, 0x0600, 0x7058, 0x2060, 0x6000,
+	0x0001, 0x003e, 0x700c, 0x9c36, 0x1110, 0x660c, 0x760e, 0x7008,
+	0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700a, 0x0010,
+	0x700b, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e,
+	0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xcd2a, 0x1158, 0x080c,
+	0x31e8, 0x080c, 0xcd3b, 0x11f0, 0x080c, 0xb813, 0x00d8, 0x080c,
+	0xa7bc, 0x08c0, 0x080c, 0xcd3b, 0x1118, 0x080c, 0xb813, 0x0090,
+	0x6014, 0x2048, 0x080c, 0xcb33, 0x0168, 0x6020, 0x9086, 0x0003,
+	0x1508, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6c75,
+	0x080c, 0xcd1e, 0x080c, 0xcfa2, 0x080c, 0xae92, 0x080c, 0xa692,
+	0x00ce, 0x0804, 0xa818, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa818,
+	0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
+	0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d20, 0x080c, 0xe551,
+	0x0c08, 0x00d6, 0x080c, 0x9cab, 0x7003, 0x0200, 0x7007, 0x0014,
+	0x60c3, 0x0014, 0x20e1, 0x0001, 0x2099, 0x1989, 0x20e9, 0x0000,
+	0x20a1, 0x0250, 0x20a9, 0x0004, 0x4003, 0x7023, 0x0004, 0x7027,
+	0x7878, 0x080c, 0xa247, 0x00de, 0x0005, 0x080c, 0x9cab, 0x700b,
+	0x0800, 0x7814, 0x9084, 0xff00, 0x700e, 0x7814, 0x9084, 0x00ff,
+	0x7022, 0x782c, 0x7026, 0x7858, 0x9084, 0x00ff, 0x9085, 0x0200,
+	0x7002, 0x7858, 0x9084, 0xff00, 0x8007, 0x7006, 0x60c2, 0x0804,
+	0xa247, 0x00b6, 0x00d6, 0x0016, 0x00d6, 0x2f68, 0x2009, 0x0035,
+	0x080c, 0xd1a8, 0x00de, 0x1904, 0xa946, 0x080c, 0x9c60, 0x7003,
+	0x1300, 0x782c, 0x080c, 0xaa48, 0x2068, 0x6820, 0x9086, 0x0003,
+	0x0560, 0x7810, 0x2058, 0xbaa0, 0x080c, 0xadcb, 0x11d8, 0x9286,
+	0x007e, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0498, 0x9286,
+	0x007f, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffd, 0x0458, 0x9284,
+	0xff80, 0x0180, 0x9286, 0x0080, 0x1128, 0x700b, 0x00ff, 0x700f,
+	0xfffc, 0x0400, 0x92d8, 0x1000, 0x2b5c, 0xb810, 0x700a, 0xb814,
+	0x700e, 0x00c0, 0x6098, 0x700e, 0x00a8, 0x080c, 0xadcb, 0x1130,
+	0x7810, 0x2058, 0xb8a0, 0x9082, 0x007e, 0x0250, 0x00d6, 0x2069,
+	0x181f, 0x2d04, 0x700a, 0x8d68, 0x2d04, 0x700e, 0x00de, 0x0010,
+	0x6034, 0x700e, 0x7838, 0x7012, 0x783c, 0x7016, 0x60c3, 0x000c,
+	0x001e, 0x00de, 0x080c, 0xa247, 0x00be, 0x0005, 0x781b, 0x0001,
+	0x7803, 0x0006, 0x001e, 0x00de, 0x00be, 0x0005, 0x792c, 0x9180,
+	0x0008, 0x200c, 0x9186, 0x0006, 0x01c0, 0x9186, 0x0003, 0x0904,
+	0xa9c0, 0x9186, 0x0005, 0x0904, 0xa9a9, 0x9186, 0x0004, 0x05d8,
+	0x9186, 0x0008, 0x0904, 0xa9b1, 0x7807, 0x0037, 0x782f, 0x0003,
+	0x7817, 0x1700, 0x080c, 0xaa25, 0x0005, 0x080c, 0xa9e6, 0x00d6,
+	0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x6800, 0x0002, 0xa98a,
+	0xa995, 0xa98c, 0xa995, 0xa991, 0xa98a, 0xa98a, 0xa995, 0xa995,
+	0xa995, 0xa995, 0xa98a, 0xa98a, 0xa98a, 0xa98a, 0xa98a, 0xa995,
+	0xa98a, 0xa995, 0x080c, 0x0dd5, 0x6824, 0xd0e4, 0x0110, 0xd0cc,
+	0x0110, 0x900e, 0x0010, 0x2009, 0x2000, 0x682c, 0x7022, 0x6830,
+	0x7026, 0x0804, 0xa9df, 0x080c, 0xa9e6, 0x00d6, 0x0026, 0x792c,
+	0x2168, 0x2009, 0x4000, 0x6a00, 0x9286, 0x0002, 0x1108, 0x900e,
+	0x04b0, 0x04e1, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000,
+	0x0470, 0x04a1, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000,
+	0x9286, 0x0005, 0x0118, 0x9286, 0x0002, 0x1108, 0x900e, 0x00f8,
+	0x0429, 0x00d6, 0x0026, 0x792c, 0x2168, 0x6814, 0x0096, 0x2048,
+	0xa9ac, 0xa834, 0x9112, 0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022,
+	0x7226, 0x792c, 0x9180, 0x0000, 0x2004, 0x908e, 0x0002, 0x0130,
+	0x908e, 0x0004, 0x0118, 0x2009, 0x4000, 0x0008, 0x900e, 0x712a,
+	0x60c3, 0x0018, 0x002e, 0x00de, 0x0804, 0xa247, 0x00b6, 0x0036,
+	0x0046, 0x0056, 0x0066, 0x080c, 0x9cab, 0x9006, 0x7003, 0x0200,
+	0x7938, 0x710a, 0x793c, 0x710e, 0x7810, 0x2058, 0xb8a0, 0x080c,
+	0xadcb, 0x1118, 0x9092, 0x007e, 0x0268, 0x00d6, 0x2069, 0x181f,
+	0x2d2c, 0x8d68, 0x2d34, 0x90d8, 0x1000, 0x2b5c, 0xbb10, 0xbc14,
+	0x00de, 0x0028, 0x901e, 0x6498, 0x2029, 0x0000, 0x6634, 0x782c,
+	0x9080, 0x0008, 0x2004, 0x9086, 0x0003, 0x1128, 0x7512, 0x7616,
+	0x731a, 0x741e, 0x0020, 0x7312, 0x7416, 0x751a, 0x761e, 0x006e,
+	0x005e, 0x004e, 0x003e, 0x00be, 0x0005, 0x080c, 0x9cab, 0x7003,
+	0x0100, 0x782c, 0x700a, 0x7814, 0x700e, 0x700e, 0x60c3, 0x0008,
+	0x0804, 0xa247, 0x080c, 0x9c57, 0x7003, 0x1400, 0x7838, 0x700a,
+	0x0079, 0x783c, 0x700e, 0x782c, 0x7012, 0x7830, 0x7016, 0x7834,
+	0x9084, 0x00ff, 0x8007, 0x701a, 0x60c3, 0x0010, 0x0804, 0xa247,
+	0x00e6, 0x2071, 0x0240, 0x0006, 0x00f6, 0x2078, 0x7810, 0x00b6,
+	0x2058, 0xb8cc, 0xd084, 0x0120, 0x7848, 0x702a, 0x7844, 0x702e,
+	0x00be, 0x00fe, 0x000e, 0x00ee, 0x0005, 0x080c, 0x9ca2, 0x7003,
+	0x0100, 0x782c, 0x700a, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804,
+	0xa247, 0x0021, 0x60c3, 0x0000, 0x0804, 0xa247, 0x00d6, 0x080c,
+	0xab21, 0xb810, 0x9085, 0x0300, 0x7002, 0xb814, 0x7006, 0x2069,
+	0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x7013, 0x0819, 0x080c,
+	0xa235, 0x721a, 0x2f10, 0x7222, 0x7a08, 0x7226, 0x2071, 0x024c,
+	0x00de, 0x0005, 0x00a9, 0x7914, 0x712a, 0x60c3, 0x0000, 0x60a7,
+	0x9575, 0x0026, 0x080c, 0x2ba5, 0x0228, 0x2011, 0x0101, 0x2204,
+	0xc0c5, 0x2012, 0x002e, 0x080c, 0xa26a, 0x080c, 0x8570, 0x0005,
+	0x0036, 0x0096, 0x00d6, 0x00e6, 0x7858, 0x2048, 0xaa7c, 0x9296,
+	0x00c0, 0x9294, 0xfffd, 0xaa7e, 0xaa80, 0x9294, 0x0300, 0xaa82,
+	0xa96c, 0x9194, 0x00ff, 0xab74, 0x9384, 0x00ff, 0x908d, 0xc200,
+	0xa96e, 0x9384, 0xff00, 0x9215, 0xaa76, 0xa870, 0xaa78, 0xa87a,
+	0xaa72, 0x00d6, 0x2069, 0x0200, 0x080c, 0xab21, 0x00de, 0x20e9,
+	0x0000, 0x20a1, 0x0240, 0x20a9, 0x000a, 0xa860, 0x20e0, 0xa85c,
+	0x9080, 0x001b, 0x2098, 0x4003, 0x60a3, 0x0035, 0xaa68, 0x9294,
+	0x7000, 0x9286, 0x3000, 0x0110, 0x60a3, 0x0037, 0x00ee, 0x00de,
+	0x009e, 0x003e, 0x0005, 0x900e, 0x7814, 0x0096, 0x2048, 0xa87c,
+	0xd0fc, 0x01c0, 0x9084, 0x0003, 0x11a8, 0x2001, 0x180c, 0x2004,
+	0xd0bc, 0x0180, 0x7824, 0xd0cc, 0x1168, 0xd0c4, 0x1158, 0xa8a8,
+	0x9005, 0x1140, 0x2001, 0x180c, 0x200c, 0xc1d5, 0x2102, 0x2009,
+	0x19b2, 0x210c, 0x009e, 0x918d, 0x0092, 0x0010, 0x2009, 0x0096,
+	0x60ab, 0x0036, 0x6116, 0x0005, 0x2009, 0x0009, 0x00a0, 0x2009,
+	0x000a, 0x0088, 0x2009, 0x000b, 0x0070, 0x2009, 0x000c, 0x0058,
+	0x2009, 0x000d, 0x0040, 0x2009, 0x000e, 0x0028, 0x2009, 0x000f,
+	0x0010, 0x2009, 0x0008, 0x6912, 0x0005, 0x080c, 0x9c60, 0x0016,
+	0x0026, 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013, 0x0138, 0x2001,
+	0x1837, 0x2004, 0x9084, 0x0028, 0x1138, 0x2001, 0x197c, 0x2004,
+	0x9086, 0xaaaa, 0x1904, 0xabc6, 0x7003, 0x5400, 0x00c6, 0x2061,
+	0x1800, 0x607c, 0x9084, 0x00ff, 0xa998, 0x810f, 0x918c, 0xff00,
+	0x9105, 0x700a, 0x6080, 0x700e, 0xa998, 0x918c, 0xff00, 0x7112,
+	0x20a9, 0x0004, 0x2009, 0x1805, 0x2e10, 0x9290, 0x0006, 0x2104,
+	0x2012, 0x8108, 0x8210, 0x1f04, 0xab57, 0x20a9, 0x0004, 0x2009,
+	0x1801, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xab61, 0xa860,
+	0x20e0, 0xa85c, 0x9080, 0x0029, 0x2098, 0x2009, 0x0006, 0x20a9,
+	0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0x00d6,
+	0x2069, 0x0200, 0x080c, 0xab0c, 0x00de, 0x2071, 0x0240, 0x2011,
+	0x0240, 0x2009, 0x0002, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012,
+	0x8210, 0x8109, 0x1dc0, 0x2009, 0x0008, 0x20a9, 0x0001, 0x4002,
+	0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0xa85c, 0x9080, 0x0031,
+	0x2098, 0x2009, 0x0008, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012,
+	0x8210, 0x8109, 0x1dc0, 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056,
+	0x60a7, 0x9575, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1168,
+	0x080c, 0x73bc, 0x0150, 0x6028, 0xc0bd, 0x602a, 0x6014, 0x9084,
+	0x1804, 0x9085, 0x0029, 0x6016, 0x0010, 0x080c, 0xa247, 0x080c,
+	0x8570, 0x00de, 0x009e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x2071,
+	0x0240, 0x2001, 0x2200, 0x9085, 0x00ff, 0x7002, 0x7007, 0xffff,
+	0x2071, 0x0100, 0x709b, 0x00ff, 0x00ee, 0x0804, 0xab3c, 0x080c,
+	0x9c60, 0x0016, 0x0026, 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013,
+	0x0138, 0x7003, 0x5500, 0x00c6, 0xa89c, 0x9084, 0x00ff, 0xa998,
+	0x810f, 0x918c, 0xff00, 0x9105, 0x700a, 0xa99c, 0x918c, 0xff00,
+	0xa8a0, 0x9084, 0x00ff, 0x9105, 0x700e, 0xa998, 0x918c, 0xff00,
+	0x2061, 0x1800, 0x607c, 0x9084, 0x00ff, 0x910d, 0x7112, 0x6180,
+	0x7116, 0x2009, 0x0008, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0029,
+	0x2098, 0x2e10, 0x9290, 0x0006, 0x20a9, 0x0001, 0x4002, 0x8007,
+	0x2012, 0x8210, 0x8109, 0x1dc0, 0x20a9, 0x0004, 0x2009, 0x1805,
+	0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xac18, 0x20a9, 0x0002,
+	0x2009, 0x1801, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xac22,
+	0x00d6, 0x0016, 0x2069, 0x0200, 0x080c, 0xab0c, 0x001e, 0x00de,
+	0x2071, 0x0240, 0x20a9, 0x0002, 0x2009, 0x1803, 0x2011, 0x0240,
+	0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xac38, 0x2009, 0x0008,
+	0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dd0, 0x9006, 0x20a9,
+	0x0008, 0x2012, 0x8210, 0x1f04, 0xac49, 0x00ce, 0x60c3, 0x004c,
+	0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0xa247, 0x080c, 0x8570,
+	0x00de, 0x009e, 0x002e, 0x001e, 0x0005, 0x00d6, 0x9290, 0x0018,
+	0x8214, 0x20e9, 0x0000, 0x2069, 0x0200, 0x6813, 0x0000, 0x22a8,
+	0x9284, 0x00e0, 0x0128, 0x20a9, 0x0020, 0x9292, 0x0020, 0x0008,
+	0x9016, 0x20a1, 0x0240, 0x9006, 0x4004, 0x82ff, 0x0120, 0x6810,
+	0x8000, 0x6812, 0x0c60, 0x00de, 0x0005, 0x00d6, 0x0096, 0x6014,
+	0x2048, 0xa878, 0x6056, 0x9006, 0xa836, 0xa83a, 0xa99c, 0xa946,
+	0xa84a, 0x6023, 0x0003, 0x6007, 0x0040, 0x6003, 0x0003, 0x600b,
+	0xffff, 0xa817, 0x0001, 0xa842, 0xa83e, 0x2900, 0xa85a, 0xa813,
+	0x208e, 0x080c, 0x9155, 0x0126, 0x2091, 0x8000, 0x080c, 0x97b9,
+	0x012e, 0x009e, 0x00de, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
+	0x00a6, 0x0096, 0x0066, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7,
+	0x760c, 0x2660, 0x2678, 0x8cff, 0x0904, 0xad2b, 0x7024, 0x9c06,
+	0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0xad02, 0x080c,
+	0xa273, 0x68c3, 0x0000, 0x080c, 0xa7bc, 0x7027, 0x0000, 0x0036,
+	0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100,
+	0x080c, 0x2cef, 0x9006, 0x080c, 0x2cef, 0x2069, 0x0100, 0x6824,
+	0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x700c, 0x9c36, 0x1110,
+	0x660c, 0x760e, 0x7008, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118,
+	0x2f00, 0x700a, 0x0010, 0x700b, 0x0000, 0x660c, 0x0066, 0x2c00,
+	0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c,
+	0xcd2a, 0x1158, 0x080c, 0x31e8, 0x080c, 0xcd3b, 0x11f0, 0x080c,
+	0xb813, 0x00d8, 0x080c, 0xa7bc, 0x08c0, 0x080c, 0xcd3b, 0x1118,
+	0x080c, 0xb813, 0x0090, 0x6014, 0x2048, 0x080c, 0xcb33, 0x0168,
+	0x6020, 0x9086, 0x0003, 0x1520, 0xa867, 0x0103, 0xab7a, 0xa877,
+	0x0000, 0x080c, 0x6c81, 0x080c, 0xcd1e, 0x080c, 0xcfa2, 0x080c,
+	0xae92, 0x080c, 0xa692, 0x00ce, 0x0804, 0xacb3, 0x2c78, 0x600c,
+	0x2060, 0x0804, 0xacb3, 0x700f, 0x0000, 0x700b, 0x0000, 0x012e,
+	0x006e, 0x009e, 0x00ae, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005,
+	0x6020, 0x9086, 0x0006, 0x1d08, 0x080c, 0xe551, 0x08f0, 0x00d6,
+	0x0156, 0x080c, 0x9cab, 0x7a14, 0x82ff, 0x0138, 0x7003, 0x0100,
+	0x700b, 0x0003, 0x60c3, 0x0008, 0x0490, 0x7003, 0x0200, 0x7007,
+	0x0000, 0x2069, 0x1800, 0x901e, 0x6800, 0x9086, 0x0004, 0x1110,
+	0xc38d, 0x0060, 0x080c, 0x73bc, 0x1110, 0xc3ad, 0x0008, 0xc3a5,
+	0x6adc, 0xd29c, 0x1110, 0xd2ac, 0x0108, 0xc39d, 0x730e, 0x080c,
+	0x85d9, 0x20a9, 0x0006, 0x2011, 0xfff4, 0x2019, 0xfff5, 0x2071,
+	0x0250, 0x2305, 0x2072, 0x8e70, 0x2205, 0x2072, 0x8e70, 0x9398,
+	0x0002, 0x9290, 0x0002, 0x1f04, 0xad71, 0x60c3, 0x0020, 0x080c,
+	0xa247, 0x015e, 0x00de, 0x0005, 0x0156, 0x080c, 0x9cab, 0x7a14,
+	0x82ff, 0x0168, 0x9286, 0xffff, 0x0118, 0x9282, 0x000e, 0x1238,
+	0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008, 0x0488, 0x7003,
+	0x0200, 0x7007, 0x001c, 0x700f, 0x0001, 0x2011, 0x19bd, 0x2204,
+	0x8007, 0x701a, 0x8210, 0x2204, 0x8007, 0x701e, 0x0421, 0x1120,
+	0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001, 0x181f, 0x2004, 0x7022,
+	0x2001, 0x1820, 0x2004, 0x7026, 0x0030, 0x2001, 0x1818, 0x2004,
+	0x9084, 0x00ff, 0x7026, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099,
+	0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003, 0x60c3, 0x001c,
+	0x015e, 0x0804, 0xa247, 0x0006, 0x2001, 0x1837, 0x2004, 0xd0ac,
+	0x000e, 0x0005, 0x2011, 0x0003, 0x080c, 0xa653, 0x2011, 0x0002,
+	0x080c, 0xa65d, 0x080c, 0xa540, 0x0036, 0x901e, 0x080c, 0xa5b6,
+	0x003e, 0x0005, 0x080c, 0x331e, 0x0188, 0x0016, 0x00b6, 0x00c6,
+	0x7010, 0x9085, 0x0020, 0x7012, 0x2009, 0x007e, 0x080c, 0x65ff,
+	0xb85c, 0xc0ac, 0xb85e, 0x00ce, 0x00be, 0x001e, 0x0005, 0x2071,
+	0x188d, 0x7000, 0x9005, 0x0140, 0x2001, 0x0976, 0x2071, 0x1800,
+	0x7076, 0x707a, 0x706b, 0xffe0, 0x2071, 0x1800, 0x7074, 0x7056,
+	0x705b, 0x1cd0, 0x0005, 0x00e6, 0x0126, 0x2071, 0x1800, 0x2091,
+	0x8000, 0x7554, 0x9582, 0x0010, 0x0608, 0x7058, 0x2060, 0x6000,
 	0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018, 0x7068, 0x9c02, 0x1208,
 	0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556,
-	0x9ca8, 0x0018, 0x7068, 0x9502, 0x1228, 0x755a, 0x9085, 0x0001,
-	0x00ee, 0x0005, 0x705b, 0x1cd0, 0x0cc8, 0x9006, 0x0cc8, 0x9c82,
-	0x1cd0, 0x0a0c, 0x0dd5, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c,
-	0x0dd5, 0x9006, 0x6006, 0x600a, 0x600e, 0x6016, 0x601a, 0x6012,
-	0x6023, 0x0000, 0x6003, 0x0000, 0x601e, 0x6056, 0x605a, 0x6026,
-	0x602a, 0x602e, 0x6032, 0x6036, 0x603a, 0x603e, 0x6042, 0x602a,
-	0x2061, 0x1800, 0x6054, 0x8000, 0x6056, 0x9086, 0x0001, 0x0108,
-	0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x9664, 0x012e, 0x0cc0,
-	0x0006, 0x6000, 0x9086, 0x0000, 0x01b0, 0x601c, 0xd084, 0x190c,
-	0x1a5e, 0x6017, 0x0000, 0x6023, 0x0007, 0x2001, 0x1986, 0x2004,
-	0x0006, 0x9082, 0x0051, 0x000e, 0x0208, 0x8004, 0x601a, 0x080c,
-	0xe7ea, 0x6043, 0x0000, 0x000e, 0x0005, 0x00e6, 0x0126, 0x2071,
-	0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0001, 0x0608, 0x7058,
+	0x9ca8, 0x0018, 0x7068, 0x9502, 0x1230, 0x755a, 0x9085, 0x0001,
+	0x012e, 0x00ee, 0x0005, 0x705b, 0x1cd0, 0x0cc0, 0x9006, 0x0cc0,
+	0x00e6, 0x2071, 0x1800, 0x7554, 0x9582, 0x0010, 0x0600, 0x7058,
 	0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018, 0x7068,
 	0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003, 0x0008,
-	0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068, 0x9502, 0x1230, 0x755a,
-	0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b, 0x1cd0, 0x0cc0,
-	0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002, 0xaed5, 0xaede,
-	0xaef9, 0xaf14, 0xd23c, 0xd259, 0xd274, 0xaed5, 0xaede, 0x8d62,
-	0xaf30, 0xaed5, 0xaed5, 0xaed5, 0xaed5, 0x9186, 0x0013, 0x1128,
-	0x080c, 0x955f, 0x080c, 0x9664, 0x0005, 0x0005, 0x0066, 0x6000,
-	0x90b2, 0x0016, 0x1a0c, 0x0dd5, 0x0013, 0x006e, 0x0005, 0xaef7,
-	0xb665, 0xb840, 0xaef7, 0xb8d6, 0xb213, 0xaef7, 0xaef7, 0xb5e7,
-	0xbe3b, 0xaef7, 0xaef7, 0xaef7, 0xaef7, 0xaef7, 0xaef7, 0x080c,
-	0x0dd5, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0dd5, 0x0013,
-	0x006e, 0x0005, 0xaf12, 0xc50f, 0xaf12, 0xaf12, 0xaf12, 0xaf12,
-	0xaf12, 0xaf12, 0xc4b4, 0xc691, 0xaf12, 0xc550, 0xc5cf, 0xc550,
-	0xc5cf, 0xaf12, 0x080c, 0x0dd5, 0x6000, 0x9082, 0x0016, 0x1a0c,
-	0x0dd5, 0x6000, 0x0002, 0xaf2e, 0xbe82, 0xbf67, 0xc097, 0xc242,
-	0xaf2e, 0xaf2e, 0xaf2e, 0xbe56, 0xc440, 0xc443, 0xaf2e, 0xaf2e,
-	0xaf2e, 0xaf2e, 0xc472, 0xaf2e, 0xaf2e, 0xaf2e, 0x080c, 0x0dd5,
+	0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068, 0x9502, 0x1228, 0x755a,
+	0x9085, 0x0001, 0x00ee, 0x0005, 0x705b, 0x1cd0, 0x0cc8, 0x9006,
+	0x0cc8, 0x9c82, 0x1cd0, 0x0a0c, 0x0dd5, 0x2001, 0x181a, 0x2004,
+	0x9c02, 0x1a0c, 0x0dd5, 0x9006, 0x6006, 0x600a, 0x600e, 0x6016,
+	0x601a, 0x6012, 0x6023, 0x0000, 0x6003, 0x0000, 0x601e, 0x6056,
+	0x605a, 0x6026, 0x602a, 0x602e, 0x6032, 0x6036, 0x603a, 0x603e,
+	0x6042, 0x602a, 0x2061, 0x1800, 0x6054, 0x8000, 0x6056, 0x9086,
+	0x0001, 0x0108, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x968d,
+	0x012e, 0x0cc0, 0x0006, 0x6000, 0x9086, 0x0000, 0x01b0, 0x601c,
+	0xd084, 0x190c, 0x1a5e, 0x6017, 0x0000, 0x6023, 0x0007, 0x2001,
+	0x1986, 0x2004, 0x0006, 0x9082, 0x0051, 0x000e, 0x0208, 0x8004,
+	0x601a, 0x080c, 0xe80b, 0x6043, 0x0000, 0x000e, 0x0005, 0x00e6,
+	0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0001,
+	0x0608, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0,
+	0x0018, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98,
+	0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x0018, 0x7068, 0x9502,
+	0x1230, 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b,
+	0x1cd0, 0x0cc0, 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002,
+	0xaeef, 0xaef8, 0xaf13, 0xaf2e, 0xd256, 0xd273, 0xd28e, 0xaeef,
+	0xaef8, 0x8d8b, 0xaf4a, 0xaeef, 0xaeef, 0xaeef, 0xaeef, 0x9186,
+	0x0013, 0x1128, 0x080c, 0x9588, 0x080c, 0x968d, 0x0005, 0x0005,
 	0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0dd5, 0x0013, 0x006e,
-	0x0005, 0xaf49, 0xaf49, 0xaf8c, 0xb02b, 0xb0c0, 0xaf49, 0xaf49,
-	0xaf49, 0xaf4b, 0xaf49, 0xaf49, 0xaf49, 0xaf49, 0xaf49, 0xaf49,
-	0xaf49, 0x080c, 0x0dd5, 0x9186, 0x004c, 0x0588, 0x9186, 0x0003,
-	0x190c, 0x0dd5, 0x0096, 0x601c, 0xc0ed, 0x601e, 0x6003, 0x0003,
-	0x6106, 0x6014, 0x2048, 0xa87c, 0x9084, 0xa000, 0xc0b5, 0xa87e,
-	0xa8ac, 0xa846, 0xa8b0, 0xa84a, 0x9006, 0xa836, 0xa83a, 0xa884,
-	0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003, 0x8013, 0x8213,
-	0x9210, 0x621a, 0x009e, 0x2c10, 0x080c, 0x1bad, 0x080c, 0x912c,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x9790, 0x012e, 0x0005, 0x6010,
-	0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x080c, 0xb0e2, 0x080c,
-	0xd22e, 0x6003, 0x0007, 0x0005, 0x00d6, 0x0096, 0x00f6, 0x2079,
-	0x1800, 0x7a90, 0x6014, 0x2048, 0xa87c, 0xd0ec, 0x1110, 0x9290,
-	0x0018, 0xac78, 0xc4fc, 0x0046, 0xa8e0, 0x9005, 0x1140, 0xa8dc,
-	0x921a, 0x0140, 0x0220, 0xa87b, 0x0007, 0x2010, 0x0028, 0xa87b,
-	0x0015, 0x0010, 0xa87b, 0x0000, 0x8214, 0xa883, 0x0000, 0xaa02,
-	0x0006, 0x0016, 0x0026, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2400,
-	0x9005, 0x1108, 0x009a, 0x2100, 0x9086, 0x0015, 0x1118, 0x2001,
-	0x0001, 0x0038, 0x2100, 0x9086, 0x0016, 0x0118, 0x2001, 0x0001,
-	0x002a, 0x94a4, 0x0007, 0x8423, 0x9405, 0x0002, 0xaff3, 0xaff3,
-	0xafee, 0xaff1, 0xaff3, 0xafeb, 0xafde, 0xafde, 0xafde, 0xafde,
-	0xafde, 0xafde, 0xafde, 0xafde, 0xafde, 0xafde, 0x00fe, 0x00ee,
-	0x00de, 0x00ce, 0x002e, 0x001e, 0x000e, 0x004e, 0x00fe, 0x009e,
-	0x00de, 0x080c, 0x0dd5, 0x080c, 0xba93, 0x0028, 0x080c, 0xbb78,
-	0x0010, 0x080c, 0xbc6e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e,
-	0x001e, 0x2c00, 0xa896, 0x000e, 0x080c, 0xb1a0, 0x0530, 0xa804,
-	0xa80e, 0x00a6, 0x2050, 0xb100, 0x00ae, 0x8006, 0x8006, 0x8007,
-	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0xaacc, 0xabd0,
-	0xacd4, 0xadd8, 0x2031, 0x0000, 0x2041, 0x125d, 0x080c, 0xb360,
-	0x0160, 0x000e, 0x9005, 0x0120, 0x00fe, 0x009e, 0x00de, 0x0005,
-	0x00fe, 0x009e, 0x00de, 0x0804, 0xae47, 0x2001, 0x002c, 0x900e,
-	0x080c, 0xb206, 0x0c70, 0x91b6, 0x0015, 0x0170, 0x91b6, 0x0016,
-	0x0158, 0x91b2, 0x0047, 0x0a0c, 0x0dd5, 0x91b2, 0x0050, 0x1a0c,
-	0x0dd5, 0x9182, 0x0047, 0x00ca, 0x2001, 0x0109, 0x2004, 0xd08c,
-	0x0198, 0x0126, 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x080c,
-	0x9079, 0x002e, 0x001e, 0x000e, 0x012e, 0xa001, 0x6000, 0x9086,
-	0x0002, 0x1110, 0x0804, 0xaf8c, 0x0005, 0xb05e, 0xb05e, 0xb060,
-	0xb096, 0xb05e, 0xb05e, 0xb05e, 0xb05e, 0xb0a9, 0x080c, 0x0dd5,
-	0x00d6, 0x0016, 0x0096, 0x080c, 0x9614, 0x080c, 0x9790, 0x6003,
-	0x0004, 0x6114, 0x2148, 0xa87c, 0xd0fc, 0x01c0, 0xa878, 0xc0fc,
-	0x9005, 0x1158, 0xa894, 0x9005, 0x0140, 0x2001, 0x0000, 0x900e,
-	0x080c, 0xb206, 0x080c, 0xae47, 0x00a8, 0x6003, 0x0002, 0xa8a4,
-	0xa9a8, 0x9105, 0x1178, 0xa8ae, 0xa8b2, 0x0c78, 0xa87f, 0x0020,
-	0xa88c, 0xa88a, 0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2, 0xa8c7, 0x0000,
-	0xa8cb, 0x0000, 0x009e, 0x001e, 0x00de, 0x0005, 0x080c, 0x9614,
-	0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xcb1b, 0x0120, 0xa87b,
-	0x0006, 0x080c, 0x6c79, 0x009e, 0x00de, 0x080c, 0xae47, 0x0804,
-	0x9790, 0x080c, 0x9614, 0x080c, 0x31bc, 0x080c, 0xd22b, 0x00d6,
-	0x0096, 0x6114, 0x2148, 0x080c, 0xcb1b, 0x0120, 0xa87b, 0x0029,
-	0x080c, 0x6c79, 0x009e, 0x00de, 0x080c, 0xae47, 0x0804, 0x9790,
-	0x9182, 0x0047, 0x0002, 0xb0d0, 0xb0d2, 0xb0d0, 0xb0d0, 0xb0d0,
-	0xb0d0, 0xb0d0, 0xb0d0, 0xb0d0, 0xb0d0, 0xb0d0, 0xb0d0, 0xb0d2,
-	0x080c, 0x0dd5, 0x00d6, 0x0096, 0x601f, 0x0000, 0x6114, 0x2148,
-	0xa87b, 0x0000, 0xa883, 0x0000, 0x080c, 0x6c79, 0x009e, 0x00de,
-	0x0804, 0xae47, 0x0026, 0x0036, 0x0056, 0x0066, 0x0096, 0x00a6,
-	0x00f6, 0x0006, 0x080c, 0x0fff, 0x000e, 0x090c, 0x0dd5, 0xa960,
-	0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020,
-	0x4104, 0xa87a, 0x2079, 0x1800, 0x7990, 0x9188, 0x0018, 0x918c,
-	0x0fff, 0xa972, 0xac76, 0x2950, 0x00a6, 0x2001, 0x0205, 0x2003,
-	0x0000, 0x901e, 0x2029, 0x0001, 0x9182, 0x0034, 0x1228, 0x2011,
-	0x001f, 0x080c, 0xc716, 0x04c0, 0x2130, 0x2009, 0x0034, 0x2011,
-	0x001f, 0x080c, 0xc716, 0x96b2, 0x0034, 0xb004, 0x904d, 0x0110,
-	0x080c, 0x0fb1, 0x080c, 0x0fff, 0x01d0, 0x8528, 0xa867, 0x0110,
-	0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1230, 0x2608,
-	0x2011, 0x001b, 0x080c, 0xc716, 0x00b8, 0x96b2, 0x003c, 0x2009,
-	0x003c, 0x2950, 0x2011, 0x001b, 0x080c, 0xc716, 0x0c18, 0x2001,
-	0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566,
-	0xb070, 0xc0fd, 0xb072, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000,
-	0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0x2a48, 0xa804, 0xa807,
-	0x0000, 0x0006, 0x080c, 0x6c79, 0x000e, 0x2048, 0x9005, 0x1db0,
-	0x00fe, 0x00ae, 0x009e, 0x006e, 0x005e, 0x003e, 0x002e, 0x0005,
-	0x00d6, 0x00f6, 0x0096, 0x0006, 0x080c, 0x0fff, 0x000e, 0x090c,
-	0x0dd5, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e,
-	0x20a9, 0x0020, 0x4104, 0xaa66, 0xa87a, 0x2079, 0x1800, 0x7990,
-	0x810c, 0x9188, 0x000c, 0x9182, 0x001a, 0x0210, 0x2009, 0x001a,
-	0x21a8, 0x810b, 0xa972, 0xac76, 0x2e98, 0xa85c, 0x9080, 0x001f,
-	0x20a0, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x4003,
-	0x2003, 0x0000, 0x080c, 0x6c79, 0x009e, 0x00fe, 0x00de, 0x0005,
-	0x0016, 0x00d6, 0x00f6, 0x0096, 0x0016, 0x2001, 0x0205, 0x200c,
-	0x918d, 0x0080, 0x2102, 0x001e, 0x2079, 0x0200, 0x2e98, 0xa87c,
-	0xd0ec, 0x0118, 0x9e80, 0x000c, 0x2098, 0x2021, 0x003e, 0x901e,
-	0x9282, 0x0020, 0x0218, 0x2011, 0x0020, 0x2018, 0x9486, 0x003e,
-	0x1170, 0x0096, 0x080c, 0x0fff, 0x2900, 0x009e, 0x05c0, 0xa806,
-	0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x3300,
-	0x908e, 0x0260, 0x0140, 0x2009, 0x0280, 0x9102, 0x920a, 0x0218,
-	0x2010, 0x2100, 0x9318, 0x2200, 0x9402, 0x1228, 0x2400, 0x9202,
-	0x2410, 0x9318, 0x9006, 0x2020, 0x22a8, 0xa800, 0x9200, 0xa802,
-	0x20e1, 0x0000, 0x4003, 0x83ff, 0x0180, 0x3300, 0x9086, 0x0280,
-	0x1130, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816, 0x2e98, 0x2310,
-	0x84ff, 0x0904, 0xb1b5, 0x0804, 0xb1b7, 0x9085, 0x0001, 0x7817,
-	0x0000, 0x009e, 0x00fe, 0x00de, 0x001e, 0x0005, 0x00d6, 0x0036,
-	0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x080c, 0x6c6d, 0x009e,
-	0x003e, 0x00de, 0x0005, 0x91b6, 0x0015, 0x1118, 0x080c, 0xae47,
-	0x0030, 0x91b6, 0x0016, 0x190c, 0x0dd5, 0x080c, 0xae47, 0x0005,
-	0x20a9, 0x000e, 0x20e1, 0x0000, 0x2e98, 0x6014, 0x0096, 0x2048,
-	0xa860, 0x20e8, 0xa85c, 0x20a0, 0x009e, 0x4003, 0x0136, 0x9080,
-	0x001b, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418, 0x8318, 0x23a0,
-	0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8, 0x2011, 0x0006,
-	0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003, 0x3418, 0x8318,
-	0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xcb1b, 0x0130, 0x6014,
-	0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e, 0x0804, 0xae47,
-	0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200, 0x11a8, 0x6010,
-	0x00b6, 0x2058, 0xb8cf, 0x0000, 0x00be, 0x6014, 0x9005, 0x0130,
-	0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32, 0x080c, 0xae47,
-	0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48, 0x0cc8, 0x0006,
-	0x0016, 0x080c, 0xd216, 0x0188, 0x6014, 0x9005, 0x1170, 0x600b,
-	0x0003, 0x601b, 0x0000, 0x6043, 0x0000, 0x2009, 0x0022, 0x080c,
-	0xb63d, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085, 0x0001, 0x0cd0,
-	0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c, 0x20e1, 0x0000,
-	0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
-	0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001, 0x2099, 0x0260,
-	0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804, 0x2048, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205,
-	0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020, 0x4003, 0x2003,
-	0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x080c,
-	0xae47, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016, 0x900e, 0x7030,
-	0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff, 0x800c, 0x703c,
-	0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108, 0x810b, 0x2011,
-	0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c, 0xc716, 0x080c,
-	0xcb1b, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000, 0xa864, 0xa8e2,
-	0xa867, 0x0103, 0x080c, 0xae47, 0x001e, 0x009e, 0x0005, 0x0016,
-	0x2009, 0x0000, 0x7030, 0x9086, 0x0200, 0x0110, 0x2009, 0x0001,
-	0x0096, 0x6014, 0x904d, 0x090c, 0x0dd5, 0xa97a, 0x080c, 0x6c79,
-	0x009e, 0x080c, 0xae47, 0x001e, 0x0005, 0x0016, 0x0096, 0x7030,
-	0x9086, 0x0100, 0x1118, 0x2009, 0x0004, 0x0010, 0x7034, 0x800c,
-	0x810b, 0x2011, 0x000c, 0x2019, 0x000c, 0x6014, 0x2048, 0xa804,
-	0x0096, 0x9005, 0x0108, 0x2048, 0x080c, 0xc716, 0x009e, 0x080c,
-	0xcb1b, 0x0148, 0xa804, 0x9005, 0x1158, 0xa807, 0x0000, 0xa864,
-	0xa8e2, 0xa867, 0x0103, 0x080c, 0xae47, 0x009e, 0x001e, 0x0005,
-	0x0086, 0x2040, 0xa030, 0x8007, 0x9086, 0x0100, 0x1118, 0x080c,
-	0xb7f9, 0x00e0, 0xa034, 0x8007, 0x800c, 0x8806, 0x8006, 0x8007,
-	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x000c, 0xa87b, 0x0000,
-	0xa883, 0x0000, 0xa897, 0x4000, 0xaaa0, 0xab9c, 0xaca8, 0xada4,
-	0x2031, 0x0000, 0x2041, 0x1243, 0x0019, 0x0d08, 0x008e, 0x0898,
-	0x0096, 0x0006, 0x080c, 0x0fff, 0x000e, 0x01b0, 0xa8ab, 0x0dcb,
-	0xa876, 0x000e, 0xa8a2, 0x0006, 0xae6a, 0x2800, 0xa89e, 0xa97a,
-	0xaf72, 0xaa8e, 0xab92, 0xac96, 0xad9a, 0x0086, 0x2940, 0x080c,
-	0x10e9, 0x008e, 0x9085, 0x0001, 0x009e, 0x0005, 0x00e6, 0x00d6,
-	0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258, 0xba10,
-	0x00be, 0x9206, 0x1520, 0x700c, 0x6210, 0x00b6, 0x2258, 0xba14,
-	0x00be, 0x9206, 0x11e0, 0x6043, 0x0000, 0x2c68, 0x0016, 0x2009,
-	0x0035, 0x080c, 0xd18e, 0x001e, 0x1158, 0x622c, 0x2268, 0x2071,
-	0x026c, 0x6b20, 0x9386, 0x0003, 0x0130, 0x9386, 0x0006, 0x0128,
-	0x080c, 0xae47, 0x0020, 0x0039, 0x0010, 0x080c, 0xb472, 0x002e,
-	0x00de, 0x00ee, 0x0005, 0x0096, 0x6814, 0x2048, 0x9186, 0x0015,
-	0x0904, 0xb45a, 0x918e, 0x0016, 0x1904, 0xb470, 0x700c, 0x908c,
-	0xff00, 0x9186, 0x1700, 0x0120, 0x9186, 0x0300, 0x1904, 0xb434,
-	0x89ff, 0x1138, 0x6800, 0x9086, 0x000f, 0x0904, 0xb417, 0x0804,
-	0xb46e, 0x6808, 0x9086, 0xffff, 0x1904, 0xb45c, 0xa87c, 0x9084,
-	0x0060, 0x9086, 0x0020, 0x1128, 0xa83c, 0xa940, 0x9105, 0x1904,
-	0xb45c, 0x6824, 0xd0b4, 0x1904, 0xb45c, 0x080c, 0xcd04, 0x685c,
-	0xa882, 0xa87c, 0xc0dc, 0xc0f4, 0xc0d4, 0xa87e, 0x0026, 0x900e,
-	0x6a18, 0x2001, 0x000a, 0x080c, 0x8f3f, 0xa884, 0x920a, 0x0208,
-	0x8011, 0xaa86, 0x82ff, 0x002e, 0x1138, 0x00c6, 0x2d60, 0x080c,
-	0xc840, 0x00ce, 0x0804, 0xb46e, 0x00c6, 0xa868, 0xd0fc, 0x1118,
-	0x080c, 0x60af, 0x0010, 0x080c, 0x64b5, 0x00ce, 0x1904, 0xb45c,
-	0x00c6, 0x2d60, 0x080c, 0xae47, 0x00ce, 0x0804, 0xb46e, 0x00c6,
-	0x080c, 0xae95, 0x0198, 0x6017, 0x0000, 0x6810, 0x6012, 0x080c,
-	0xcf90, 0x6023, 0x0003, 0x6904, 0x00c6, 0x2d60, 0x080c, 0xae47,
-	0x00ce, 0x080c, 0xaec2, 0x00ce, 0x0804, 0xb46e, 0x2001, 0x1988,
-	0x2004, 0x6842, 0x00ce, 0x04d0, 0x7008, 0x9086, 0x000b, 0x11c8,
-	0x6010, 0x00b6, 0x2058, 0xb900, 0xc1bc, 0xb902, 0x00be, 0x00c6,
-	0x2d60, 0xa87b, 0x0003, 0x080c, 0xd1d0, 0x6007, 0x0085, 0x6003,
-	0x000b, 0x6023, 0x0002, 0x080c, 0x90c7, 0x080c, 0x9664, 0x00ce,
-	0x00e8, 0x700c, 0x9086, 0x2a00, 0x1138, 0x2001, 0x1988, 0x2004,
-	0x6842, 0x00a0, 0x0479, 0x00a0, 0x89ff, 0x090c, 0x0dd5, 0x00c6,
-	0x00d6, 0x2d60, 0xa867, 0x0103, 0xa87b, 0x0003, 0x080c, 0x6a95,
-	0x080c, 0xcd04, 0x080c, 0xae78, 0x00de, 0x00ce, 0x080c, 0xae47,
-	0x009e, 0x0005, 0x9186, 0x0015, 0x1128, 0x2001, 0x1988, 0x2004,
-	0x6842, 0x0068, 0x918e, 0x0016, 0x1160, 0x00c6, 0x2d00, 0x2060,
-	0x080c, 0xe7ea, 0x080c, 0x8689, 0x080c, 0xae47, 0x00ce, 0x080c,
-	0xae47, 0x0005, 0x0026, 0x0036, 0x0046, 0x7228, 0xacb0, 0xabac,
-	0xd2f4, 0x0130, 0x2001, 0x1988, 0x2004, 0x6842, 0x0804, 0xb4ec,
-	0x00c6, 0x2d60, 0x080c, 0xc741, 0x00ce, 0x6804, 0x9086, 0x0050,
-	0x1168, 0x00c6, 0x2d00, 0x2060, 0x6003, 0x0001, 0x6007, 0x0050,
-	0x080c, 0x90c7, 0x080c, 0x9664, 0x00ce, 0x04f0, 0x6800, 0x9086,
-	0x000f, 0x01a8, 0x89ff, 0x090c, 0x0dd5, 0x6800, 0x9086, 0x0004,
-	0x1190, 0xa87c, 0xd0ac, 0x0178, 0xa843, 0x0fff, 0xa83f, 0x0fff,
-	0xa880, 0xc0fc, 0xa882, 0x2001, 0x0001, 0x6832, 0x0400, 0x2001,
-	0x0007, 0x6832, 0x00e0, 0xa87c, 0xd0b4, 0x1150, 0xd0ac, 0x0db8,
-	0x6824, 0xd0f4, 0x1d48, 0xa838, 0xa934, 0x9105, 0x0d80, 0x0c20,
-	0xd2ec, 0x1d68, 0x7024, 0x9306, 0x1118, 0x7020, 0x9406, 0x0d38,
-	0x7020, 0x683e, 0x7024, 0x683a, 0x2001, 0x0005, 0x6832, 0x080c,
-	0xce87, 0x080c, 0x9664, 0x0010, 0x080c, 0xae47, 0x004e, 0x003e,
-	0x002e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff,
-	0x6210, 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1904, 0xb557,
-	0x700c, 0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x1904,
-	0xb557, 0x6038, 0x2068, 0x6824, 0xc0dc, 0x6826, 0x6a20, 0x9286,
-	0x0007, 0x0904, 0xb557, 0x9286, 0x0002, 0x0904, 0xb557, 0x9286,
-	0x0000, 0x05e8, 0x6808, 0x633c, 0x9306, 0x15c8, 0x2071, 0x026c,
-	0x9186, 0x0015, 0x0570, 0x918e, 0x0016, 0x1100, 0x00c6, 0x6038,
-	0x2060, 0x6104, 0x9186, 0x004b, 0x01c0, 0x9186, 0x004c, 0x01a8,
-	0x9186, 0x004d, 0x0190, 0x9186, 0x004e, 0x0178, 0x9186, 0x0052,
-	0x0160, 0x6014, 0x0096, 0x2048, 0x080c, 0xcb1b, 0x090c, 0x0dd5,
-	0xa87b, 0x0003, 0x009e, 0x080c, 0xd1d0, 0x6007, 0x0085, 0x6003,
-	0x000b, 0x6023, 0x0002, 0x080c, 0x90c7, 0x080c, 0x9664, 0x00ce,
-	0x0030, 0x6038, 0x2070, 0x2001, 0x1988, 0x2004, 0x7042, 0x080c,
-	0xae47, 0x002e, 0x00de, 0x00ee, 0x0005, 0x00b6, 0x0096, 0x00f6,
-	0x6014, 0x2048, 0x6010, 0x2058, 0x91b6, 0x0015, 0x0130, 0xba08,
-	0xbb0c, 0xbc00, 0xc48c, 0xbc02, 0x0460, 0x0096, 0x0156, 0x0036,
-	0x0026, 0x2b48, 0x9e90, 0x0010, 0x2019, 0x000a, 0x20a9, 0x0004,
-	0x080c, 0xbe03, 0x002e, 0x003e, 0x015e, 0x009e, 0x1904, 0xb5c6,
-	0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0014, 0x2019,
-	0x0006, 0x20a9, 0x0004, 0x080c, 0xbe03, 0x002e, 0x003e, 0x015e,
-	0x009e, 0x15a0, 0x7238, 0xba0a, 0x733c, 0xbb0e, 0xbc00, 0xc48d,
-	0xbc02, 0xa804, 0x9005, 0x1128, 0x00fe, 0x009e, 0x00be, 0x0804,
-	0xb24b, 0x0096, 0x2048, 0xaa12, 0xab16, 0xac0a, 0x009e, 0x8006,
+	0x0005, 0xaf11, 0xb67f, 0xb85a, 0xaf11, 0xb8f0, 0xb22d, 0xaf11,
+	0xaf11, 0xb601, 0xbe55, 0xaf11, 0xaf11, 0xaf11, 0xaf11, 0xaf11,
+	0xaf11, 0x080c, 0x0dd5, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c,
+	0x0dd5, 0x0013, 0x006e, 0x0005, 0xaf2c, 0xc529, 0xaf2c, 0xaf2c,
+	0xaf2c, 0xaf2c, 0xaf2c, 0xaf2c, 0xc4ce, 0xc6ab, 0xaf2c, 0xc56a,
+	0xc5e9, 0xc56a, 0xc5e9, 0xaf2c, 0x080c, 0x0dd5, 0x6000, 0x9082,
+	0x0016, 0x1a0c, 0x0dd5, 0x6000, 0x0002, 0xaf48, 0xbe9c, 0xbf81,
+	0xc0b1, 0xc25c, 0xaf48, 0xaf48, 0xaf48, 0xbe70, 0xc45a, 0xc45d,
+	0xaf48, 0xaf48, 0xaf48, 0xaf48, 0xc48c, 0xaf48, 0xaf48, 0xaf48,
+	0x080c, 0x0dd5, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0dd5,
+	0x0013, 0x006e, 0x0005, 0xaf63, 0xaf63, 0xafa6, 0xb045, 0xb0da,
+	0xaf63, 0xaf63, 0xaf63, 0xaf65, 0xaf63, 0xaf63, 0xaf63, 0xaf63,
+	0xaf63, 0xaf63, 0xaf63, 0x080c, 0x0dd5, 0x9186, 0x004c, 0x0588,
+	0x9186, 0x0003, 0x190c, 0x0dd5, 0x0096, 0x601c, 0xc0ed, 0x601e,
+	0x6003, 0x0003, 0x6106, 0x6014, 0x2048, 0xa87c, 0x9084, 0xa000,
+	0xc0b5, 0xa87e, 0xa8ac, 0xa846, 0xa8b0, 0xa84a, 0x9006, 0xa836,
+	0xa83a, 0xa884, 0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003,
+	0x8013, 0x8213, 0x9210, 0x621a, 0x009e, 0x2c10, 0x080c, 0x1bad,
+	0x080c, 0x9155, 0x0126, 0x2091, 0x8000, 0x080c, 0x97b9, 0x012e,
+	0x0005, 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x080c,
+	0xb0fc, 0x080c, 0xd248, 0x6003, 0x0007, 0x0005, 0x00d6, 0x0096,
+	0x00f6, 0x2079, 0x1800, 0x7a90, 0x6014, 0x2048, 0xa87c, 0xd0ec,
+	0x1110, 0x9290, 0x0018, 0xac78, 0xc4fc, 0x0046, 0xa8e0, 0x9005,
+	0x1140, 0xa8dc, 0x921a, 0x0140, 0x0220, 0xa87b, 0x0007, 0x2010,
+	0x0028, 0xa87b, 0x0015, 0x0010, 0xa87b, 0x0000, 0x8214, 0xa883,
+	0x0000, 0xaa02, 0x0006, 0x0016, 0x0026, 0x00c6, 0x00d6, 0x00e6,
+	0x00f6, 0x2400, 0x9005, 0x1108, 0x009a, 0x2100, 0x9086, 0x0015,
+	0x1118, 0x2001, 0x0001, 0x0038, 0x2100, 0x9086, 0x0016, 0x0118,
+	0x2001, 0x0001, 0x002a, 0x94a4, 0x0007, 0x8423, 0x9405, 0x0002,
+	0xb00d, 0xb00d, 0xb008, 0xb00b, 0xb00d, 0xb005, 0xaff8, 0xaff8,
+	0xaff8, 0xaff8, 0xaff8, 0xaff8, 0xaff8, 0xaff8, 0xaff8, 0xaff8,
+	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x000e, 0x004e,
+	0x00fe, 0x009e, 0x00de, 0x080c, 0x0dd5, 0x080c, 0xbaad, 0x0028,
+	0x080c, 0xbb92, 0x0010, 0x080c, 0xbc88, 0x00fe, 0x00ee, 0x00de,
+	0x00ce, 0x002e, 0x001e, 0x2c00, 0xa896, 0x000e, 0x080c, 0xb1ba,
+	0x0530, 0xa804, 0xa80e, 0x00a6, 0x2050, 0xb100, 0x00ae, 0x8006,
 	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
-	0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000,
-	0x2041, 0x1243, 0x080c, 0xb360, 0x0130, 0x00fe, 0x009e, 0x080c,
-	0xae47, 0x00be, 0x0005, 0x080c, 0xb7f9, 0x0cb8, 0x2b78, 0x00f6,
-	0x080c, 0x31bc, 0x080c, 0xd22b, 0x00fe, 0x00c6, 0x080c, 0xadf1,
-	0x2f00, 0x6012, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001,
-	0x6003, 0x0001, 0x2001, 0x0007, 0x080c, 0x6550, 0x080c, 0x657c,
-	0x080c, 0x910f, 0x080c, 0x9664, 0x00ce, 0x0804, 0xb599, 0x2100,
-	0x91b2, 0x0053, 0x1a0c, 0x0dd5, 0x91b2, 0x0040, 0x1a04, 0xb64f,
-	0x0002, 0xb63d, 0xb63d, 0xb633, 0xb63d, 0xb63d, 0xb63d, 0xb631,
-	0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631,
-	0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631,
-	0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631,
-	0xb63d, 0xb631, 0xb63d, 0xb63d, 0xb631, 0xb631, 0xb631, 0xb631,
-	0xb631, 0xb633, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631,
-	0xb631, 0xb631, 0xb631, 0xb63d, 0xb63d, 0xb631, 0xb631, 0xb631,
-	0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb631, 0xb63d, 0xb631,
-	0xb631, 0x080c, 0x0dd5, 0x0066, 0x00b6, 0x6610, 0x2658, 0xb8cc,
-	0xc08c, 0xb8ce, 0x00be, 0x006e, 0x0000, 0x6003, 0x0001, 0x6106,
-	0x9186, 0x0032, 0x0118, 0x080c, 0x910f, 0x0010, 0x080c, 0x90c7,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x9664, 0x012e, 0x0005, 0x2600,
-	0x0002, 0xb63d, 0xb63d, 0xb663, 0xb63d, 0xb63d, 0xb663, 0xb663,
-	0xb663, 0xb663, 0xb63d, 0xb663, 0xb63d, 0xb663, 0xb63d, 0xb663,
-	0xb663, 0xb663, 0xb663, 0x080c, 0x0dd5, 0x6004, 0x90b2, 0x0053,
-	0x1a0c, 0x0dd5, 0x91b6, 0x0013, 0x0904, 0xb727, 0x91b6, 0x0027,
-	0x1904, 0xb6e2, 0x080c, 0x955f, 0x6004, 0x080c, 0xcd10, 0x01b0,
-	0x080c, 0xcd21, 0x01a8, 0x908e, 0x0021, 0x0904, 0xb6df, 0x908e,
-	0x0022, 0x1130, 0x080c, 0xb277, 0x0904, 0xb6db, 0x0804, 0xb6dc,
-	0x908e, 0x003d, 0x0904, 0xb6df, 0x0804, 0xb6d5, 0x080c, 0x31e1,
-	0x2001, 0x0007, 0x080c, 0x6550, 0x6010, 0x00b6, 0x2058, 0xb9a0,
-	0x00be, 0x080c, 0xb7f9, 0x9186, 0x007e, 0x1148, 0x2001, 0x1837,
-	0x2014, 0xc285, 0x080c, 0x73b0, 0x1108, 0xc2ad, 0x2202, 0x0036,
-	0x0026, 0x2019, 0x0028, 0x2110, 0x080c, 0xe8f6, 0x002e, 0x003e,
-	0x0016, 0x0026, 0x0036, 0x2110, 0x2019, 0x0028, 0x080c, 0x9262,
-	0x0076, 0x903e, 0x080c, 0x913f, 0x6010, 0x00b6, 0x905d, 0x0100,
-	0x00be, 0x2c08, 0x080c, 0xe2ca, 0x007e, 0x003e, 0x002e, 0x001e,
-	0x080c, 0xd22b, 0x0016, 0x080c, 0xcf88, 0x080c, 0xae47, 0x001e,
-	0x080c, 0x32b4, 0x080c, 0x9664, 0x0030, 0x080c, 0xcf88, 0x080c,
-	0xae47, 0x080c, 0x9664, 0x0005, 0x080c, 0xb7f9, 0x0cb0, 0x080c,
-	0xb835, 0x0c98, 0x9186, 0x0014, 0x1db0, 0x080c, 0x955f, 0x6004,
-	0x908e, 0x0022, 0x1118, 0x080c, 0xb277, 0x0d68, 0x080c, 0x31bc,
-	0x080c, 0xd22b, 0x080c, 0xcd10, 0x1190, 0x080c, 0x31e1, 0x6010,
-	0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xb7f9, 0x9186, 0x007e,
-	0x1128, 0x2001, 0x1837, 0x200c, 0xc185, 0x2102, 0x0870, 0x080c,
-	0xcd21, 0x1118, 0x080c, 0xb7f9, 0x0840, 0x6004, 0x908e, 0x0032,
-	0x1160, 0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079, 0x0000, 0x080c,
-	0x354f, 0x00fe, 0x00ee, 0x0804, 0xb6d5, 0x6004, 0x908e, 0x0021,
-	0x0d48, 0x908e, 0x0022, 0x090c, 0xb7f9, 0x0804, 0xb6d5, 0x90b2,
-	0x0040, 0x1a04, 0xb7d5, 0x2008, 0x0002, 0xb76f, 0xb770, 0xb773,
-	0xb776, 0xb779, 0xb77c, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d,
-	0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d,
-	0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d,
-	0xb76d, 0xb76d, 0xb76d, 0xb77f, 0xb78a, 0xb76d, 0xb78c, 0xb78a,
-	0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb78a, 0xb78a, 0xb76d,
-	0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb76d, 0xb7bc,
-	0xb78a, 0xb76d, 0xb786, 0xb76d, 0xb76d, 0xb76d, 0xb787, 0xb76d,
-	0xb76d, 0xb76d, 0xb78a, 0xb7b3, 0xb76d, 0x080c, 0x0dd5, 0x00d0,
-	0x2001, 0x000b, 0x0410, 0x2001, 0x0003, 0x00f8, 0x2001, 0x0005,
-	0x00e0, 0x2001, 0x0001, 0x00c8, 0x2001, 0x0009, 0x00b0, 0x080c,
-	0x955f, 0x6003, 0x0005, 0x080c, 0x9664, 0x0070, 0x0018, 0x0010,
-	0x080c, 0x6550, 0x0804, 0xb7cd, 0x080c, 0x955f, 0x080c, 0xd22e,
-	0x6003, 0x0004, 0x080c, 0x9664, 0x0005, 0x080c, 0x6550, 0x080c,
-	0x955f, 0x6003, 0x0002, 0x0036, 0x2019, 0x1852, 0x2304, 0x9084,
-	0xff00, 0x1120, 0x2001, 0x1986, 0x201c, 0x0040, 0x8007, 0x909a,
-	0x0004, 0x0ec0, 0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x003e,
-	0x080c, 0x9664, 0x0c08, 0x080c, 0x955f, 0x080c, 0xcf88, 0x080c,
-	0xae47, 0x080c, 0x9664, 0x08c0, 0x00e6, 0x00f6, 0x2071, 0x189e,
-	0x2079, 0x0000, 0x080c, 0x354f, 0x00fe, 0x00ee, 0x080c, 0x955f,
-	0x080c, 0xae47, 0x080c, 0x9664, 0x0838, 0x080c, 0x955f, 0x6003,
-	0x0002, 0x080c, 0xd22e, 0x0804, 0x9664, 0x2600, 0x2008, 0x0002,
-	0xb7ec, 0xb7cd, 0xb7ea, 0xb7cd, 0xb7cd, 0xb7ea, 0xb7ea, 0xb7ea,
-	0xb7ea, 0xb7cd, 0xb7ea, 0xb7cd, 0xb7ea, 0xb7cd, 0xb7ea, 0xb7ea,
-	0xb7ea, 0xb7ea, 0x080c, 0x0dd5, 0x080c, 0x955f, 0x0096, 0x6014,
-	0x2048, 0x080c, 0x6c79, 0x009e, 0x080c, 0xae47, 0x080c, 0x9664,
-	0x0005, 0x00e6, 0x0096, 0x0026, 0x0016, 0x080c, 0xcb1b, 0x0568,
-	0x6014, 0x2048, 0xa864, 0x9086, 0x0139, 0x11a8, 0xa894, 0x9086,
-	0x0056, 0x1148, 0x080c, 0x5479, 0x0130, 0x2001, 0x0000, 0x900e,
-	0x2011, 0x4000, 0x0028, 0x2001, 0x0030, 0x900e, 0x2011, 0x4005,
-	0x080c, 0xd0f5, 0x0090, 0xa868, 0xd0fc, 0x0178, 0xa807, 0x0000,
-	0x0016, 0x6004, 0x908e, 0x0021, 0x0168, 0x908e, 0x003d, 0x0150,
-	0x001e, 0xa867, 0x0103, 0xa833, 0x0100, 0x001e, 0x002e, 0x009e,
-	0x00ee, 0x0005, 0x001e, 0x0009, 0x0cc0, 0x0096, 0x6014, 0x2048,
-	0xa800, 0x2048, 0xa867, 0x0103, 0xa823, 0x8001, 0x009e, 0x0005,
-	0x00b6, 0x6610, 0x2658, 0xb804, 0x9084, 0x00ff, 0x90b2, 0x000c,
-	0x1a0c, 0x0dd5, 0x6604, 0x96b6, 0x004d, 0x1120, 0x080c, 0xd014,
-	0x0804, 0xb8c5, 0x6604, 0x96b6, 0x0043, 0x1120, 0x080c, 0xd05d,
-	0x0804, 0xb8c5, 0x6604, 0x96b6, 0x004b, 0x1120, 0x080c, 0xd089,
-	0x0804, 0xb8c5, 0x6604, 0x96b6, 0x0033, 0x1120, 0x080c, 0xcfaa,
-	0x0804, 0xb8c5, 0x6604, 0x96b6, 0x0028, 0x1120, 0x080c, 0xcd5a,
-	0x0804, 0xb8c5, 0x6604, 0x96b6, 0x0029, 0x1120, 0x080c, 0xcd9b,
-	0x0804, 0xb8c5, 0x6604, 0x96b6, 0x001f, 0x1120, 0x080c, 0xb220,
-	0x0804, 0xb8c5, 0x6604, 0x96b6, 0x0000, 0x1118, 0x080c, 0xb55d,
-	0x04e0, 0x6604, 0x96b6, 0x0022, 0x1118, 0x080c, 0xb258, 0x04a8,
-	0x6604, 0x96b6, 0x0035, 0x1118, 0x080c, 0xb37e, 0x0470, 0x6604,
-	0x96b6, 0x0039, 0x1118, 0x080c, 0xb4f2, 0x0438, 0x6604, 0x96b6,
-	0x003d, 0x1118, 0x080c, 0xb290, 0x0400, 0x6604, 0x96b6, 0x0044,
-	0x1118, 0x080c, 0xb2cc, 0x00c8, 0x6604, 0x96b6, 0x0049, 0x1118,
-	0x080c, 0xb30d, 0x0090, 0x6604, 0x96b6, 0x0041, 0x1118, 0x080c,
-	0xb2f7, 0x0058, 0x91b6, 0x0015, 0x1110, 0x0063, 0x0030, 0x91b6,
-	0x0016, 0x1128, 0x00be, 0x0804, 0xbb1f, 0x00be, 0x0005, 0x080c,
-	0xaedd, 0x0cd8, 0xb8e2, 0xb8e5, 0xb8e2, 0xb92c, 0xb8e2, 0xba93,
-	0xbb2c, 0xb8e2, 0xb8e2, 0xbaf5, 0xb8e2, 0xbb0b, 0x0096, 0x601f,
-	0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x009e,
-	0x0804, 0xae47, 0xa001, 0xa001, 0x0005, 0x00e6, 0x2071, 0x1800,
-	0x7090, 0x9086, 0x0074, 0x1540, 0x080c, 0xe29b, 0x11b0, 0x6010,
-	0x00b6, 0x2058, 0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc, 0x0110,
-	0xc0c5, 0xb802, 0x00f9, 0x00be, 0x2001, 0x0006, 0x080c, 0x6550,
-	0x080c, 0x31e1, 0x080c, 0xae47, 0x0098, 0x2001, 0x000a, 0x080c,
-	0x6550, 0x080c, 0x31e1, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
-	0x910f, 0x080c, 0x9664, 0x0020, 0x2001, 0x0001, 0x080c, 0xba63,
-	0x00ee, 0x0005, 0x00d6, 0xb800, 0xd084, 0x0160, 0x9006, 0x080c,
-	0x653c, 0x2069, 0x1847, 0x6804, 0xd0a4, 0x0120, 0x2001, 0x0006,
-	0x080c, 0x657c, 0x00de, 0x0005, 0x00b6, 0x0096, 0x00d6, 0x2011,
-	0x1824, 0x2204, 0x9086, 0x0074, 0x1904, 0xba3a, 0x6010, 0x2058,
-	0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c, 0xbc79, 0x0804, 0xb99e,
-	0x080c, 0xbc6e, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510,
-	0x6014, 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086,
-	0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c,
-	0xd0f5, 0x0030, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
-	0x2001, 0x0006, 0x080c, 0x6550, 0x080c, 0x31e1, 0x080c, 0xae47,
-	0x0804, 0xba3d, 0x080c, 0xba4b, 0x6014, 0x9005, 0x0190, 0x2048,
-	0xa868, 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-	0x1d08, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xd0f5,
-	0x08f8, 0x080c, 0xba41, 0x0160, 0x9006, 0x080c, 0x653c, 0x2001,
-	0x0004, 0x080c, 0x657c, 0x2001, 0x0007, 0x080c, 0x6550, 0x08a0,
-	0x2001, 0x0004, 0x080c, 0x6550, 0x6003, 0x0001, 0x6007, 0x0003,
-	0x080c, 0x910f, 0x080c, 0x9664, 0x0804, 0xba3d, 0xb85c, 0xd0e4,
-	0x01d8, 0x080c, 0xcf2a, 0x080c, 0x73b0, 0x0118, 0xd0dc, 0x1904,
-	0xb960, 0x2011, 0x1837, 0x2204, 0xc0ad, 0x2012, 0x2001, 0x196d,
-	0x2004, 0x00f6, 0x2079, 0x0100, 0x78e3, 0x0000, 0x080c, 0x28b2,
-	0x78e2, 0x00fe, 0x0804, 0xb960, 0x080c, 0xcf67, 0x2011, 0x1837,
-	0x2204, 0xc0a5, 0x2012, 0x0006, 0x080c, 0xe420, 0x000e, 0x1904,
-	0xb960, 0xc0b5, 0x2012, 0x2001, 0x0006, 0x080c, 0x6550, 0x9006,
-	0x080c, 0x653c, 0x00c6, 0x2001, 0x180f, 0x2004, 0xd09c, 0x0520,
-	0x00f6, 0x2079, 0x0100, 0x00e6, 0x2071, 0x1800, 0x700c, 0x9084,
-	0x00ff, 0x78e6, 0x707e, 0x7010, 0x78ea, 0x7082, 0x908c, 0x00ff,
-	0x00ee, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x2887, 0x00f6,
-	0x2100, 0x900e, 0x080c, 0x283e, 0x795e, 0x00fe, 0x9186, 0x0081,
-	0x01d8, 0x2009, 0x0081, 0x00c8, 0x2009, 0x00ef, 0x00f6, 0x2079,
-	0x0100, 0x79ea, 0x7932, 0x7936, 0x780c, 0xc0b5, 0x780e, 0x00fe,
-	0x080c, 0x2887, 0x00f6, 0x2079, 0x1800, 0x7982, 0x2100, 0x900e,
-	0x080c, 0x283e, 0x795e, 0x00fe, 0x8108, 0x080c, 0x659f, 0x2b00,
-	0x00ce, 0x1904, 0xb960, 0x6012, 0x2009, 0x180f, 0x210c, 0xd19c,
-	0x0150, 0x2009, 0x027c, 0x210c, 0x918c, 0x00ff, 0xb912, 0x2009,
-	0x027d, 0x210c, 0xb916, 0x2001, 0x0002, 0x080c, 0x6550, 0x6023,
-	0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x910f, 0x080c,
-	0x9664, 0x0018, 0x2001, 0x0001, 0x0431, 0x00de, 0x009e, 0x00be,
-	0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4, 0x0120, 0x2001, 0x1848,
-	0x2004, 0xd0ac, 0x0005, 0x00e6, 0x080c, 0xe94f, 0x0190, 0x2071,
-	0x0260, 0x7108, 0x720c, 0x918c, 0x00ff, 0x1118, 0x9284, 0xff00,
-	0x0140, 0x6010, 0x2058, 0xb8a0, 0x9084, 0xff80, 0x1110, 0xb912,
-	0xba16, 0x00ee, 0x0005, 0x2030, 0x9005, 0x0158, 0x2001, 0x0007,
-	0x080c, 0x6550, 0x080c, 0x56e4, 0x1120, 0x2001, 0x0007, 0x080c,
-	0x657c, 0x2600, 0x9005, 0x11b0, 0x6014, 0x0096, 0x2048, 0xa868,
-	0x009e, 0xd0fc, 0x1178, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058,
-	0xbba0, 0x00be, 0x2021, 0x0004, 0x2011, 0x8014, 0x080c, 0x4b05,
-	0x004e, 0x003e, 0x080c, 0x31e1, 0x6020, 0x9086, 0x000a, 0x1108,
-	0x0005, 0x0804, 0xae47, 0x00b6, 0x00e6, 0x0026, 0x0016, 0x2071,
-	0x1800, 0x7090, 0x9086, 0x0014, 0x1904, 0xbaeb, 0x080c, 0x56e4,
-	0x1170, 0x6014, 0x9005, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058,
-	0xbba0, 0x2021, 0x0006, 0x080c, 0x4cbc, 0x004e, 0x003e, 0x00d6,
-	0x6010, 0x2058, 0x080c, 0x669b, 0x080c, 0xb91a, 0x00de, 0x080c,
-	0xbd3f, 0x1588, 0x6010, 0x2058, 0xb890, 0x9005, 0x0560, 0x2001,
-	0x0006, 0x080c, 0x6550, 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864,
-	0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e,
-	0x2011, 0x4000, 0x080c, 0xd0f5, 0x0060, 0xa864, 0x9084, 0x00ff,
-	0x9086, 0x0029, 0x0130, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-	0x0200, 0x009e, 0x080c, 0x31e1, 0x6020, 0x9086, 0x000a, 0x0140,
-	0x080c, 0xae47, 0x0028, 0x080c, 0xb7f9, 0x9006, 0x080c, 0xba63,
-	0x001e, 0x002e, 0x00ee, 0x00be, 0x0005, 0x2011, 0x1824, 0x2204,
-	0x9086, 0x0014, 0x1160, 0x2001, 0x0002, 0x080c, 0x6550, 0x6003,
-	0x0001, 0x6007, 0x0001, 0x080c, 0x910f, 0x0804, 0x9664, 0x2001,
-	0x0001, 0x0804, 0xba63, 0x2030, 0x2011, 0x1824, 0x2204, 0x9086,
-	0x0004, 0x1148, 0x96b6, 0x000b, 0x1120, 0x2001, 0x0007, 0x080c,
-	0x6550, 0x0804, 0xae47, 0x2001, 0x0001, 0x0804, 0xba63, 0x0002,
-	0xb8e2, 0xbb37, 0xb8e2, 0xbb78, 0xb8e2, 0xbc25, 0xbb2c, 0xb8e2,
-	0xb8e2, 0xbc39, 0xb8e2, 0xbc4b, 0x6604, 0x9686, 0x0003, 0x0904,
-	0xba93, 0x96b6, 0x001e, 0x1110, 0x080c, 0xae47, 0x0005, 0x00b6,
-	0x00d6, 0x00c6, 0x080c, 0xbc5d, 0x11a0, 0x9006, 0x080c, 0x653c,
-	0x080c, 0x31bc, 0x080c, 0xd22b, 0x2001, 0x0002, 0x080c, 0x6550,
-	0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x910f, 0x080c, 0x9664,
-	0x0418, 0x2009, 0x026e, 0x2104, 0x9086, 0x0009, 0x1160, 0x6010,
-	0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0170, 0x8001, 0xb842,
-	0x601b, 0x000a, 0x0088, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00,
-	0x9086, 0x1900, 0x1108, 0x08a0, 0x080c, 0x31bc, 0x080c, 0xd22b,
-	0x2001, 0x0001, 0x080c, 0xba63, 0x00ce, 0x00de, 0x00be, 0x0005,
-	0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xbc6b, 0x00d6, 0x2069,
-	0x197c, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058, 0xb8a0, 0x9086,
-	0x007e, 0x1138, 0x2069, 0x1820, 0x2d04, 0x8000, 0x206a, 0x00de,
-	0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x653c, 0x2001, 0x0002,
-	0x080c, 0x6550, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x910f,
-	0x080c, 0x9664, 0x0804, 0xbbf5, 0x080c, 0xcb1b, 0x01b0, 0x6014,
-	0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138, 0x6007, 0x0016,
-	0x2001, 0x0002, 0x080c, 0xd14f, 0x00b0, 0x6014, 0x2048, 0xa864,
-	0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001, 0x180e, 0x2004,
-	0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005,
-	0x1110, 0x9006, 0x0c38, 0x080c, 0xb7f9, 0x2009, 0x026e, 0x2134,
-	0x96b4, 0x00ff, 0x9686, 0x0005, 0x0520, 0x9686, 0x000b, 0x01c8,
-	0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118, 0x9686, 0x0009,
-	0x01c0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009, 0x0190, 0x2001,
-	0x0004, 0x080c, 0x6550, 0x2001, 0x0028, 0x601a, 0x6007, 0x0052,
-	0x0020, 0x2001, 0x0001, 0x080c, 0xba63, 0x002e, 0x00be, 0x009e,
-	0x0005, 0x9286, 0x0139, 0x0160, 0x6014, 0x2048, 0x080c, 0xcb1b,
-	0x0140, 0xa864, 0x9086, 0x0139, 0x0118, 0xa868, 0xd0fc, 0x0108,
-	0x0c40, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0138,
-	0x8001, 0xb842, 0x601b, 0x000a, 0x6007, 0x0016, 0x08f0, 0xb8a0,
-	0x9086, 0x007e, 0x1138, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5fae,
-	0x00ee, 0x0010, 0x080c, 0x31bc, 0x0860, 0x080c, 0xbc6b, 0x1160,
-	0x2001, 0x0004, 0x080c, 0x6550, 0x6003, 0x0001, 0x6007, 0x0003,
-	0x080c, 0x910f, 0x0804, 0x9664, 0x080c, 0xb7f9, 0x9006, 0x0804,
-	0xba63, 0x0489, 0x1160, 0x2001, 0x0008, 0x080c, 0x6550, 0x6003,
-	0x0001, 0x6007, 0x0005, 0x080c, 0x910f, 0x0804, 0x9664, 0x2001,
-	0x0001, 0x0804, 0xba63, 0x00f9, 0x1160, 0x2001, 0x000a, 0x080c,
-	0x6550, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x910f, 0x0804,
-	0x9664, 0x2001, 0x0001, 0x0804, 0xba63, 0x2009, 0x026e, 0x2104,
-	0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00,
-	0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005, 0x00b6, 0x00c6,
-	0x0016, 0x6110, 0x2158, 0x080c, 0x660f, 0x001e, 0x00ce, 0x00be,
-	0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036, 0x0016, 0x6010,
-	0x2058, 0x2009, 0x1837, 0x2104, 0x9085, 0x0003, 0x200a, 0x080c,
-	0xbd11, 0x0560, 0x2009, 0x1837, 0x2104, 0xc0cd, 0x200a, 0x080c,
-	0x6966, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xe58d,
-	0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x2009,
-	0x0001, 0x080c, 0x3187, 0x00e6, 0x2071, 0x1800, 0x080c, 0x2f96,
-	0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009, 0x007f, 0x080c,
-	0x32b4, 0x8108, 0x1f04, 0xbcaf, 0x015e, 0x00ce, 0x080c, 0xbc6e,
-	0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001, 0x2001, 0x1837,
-	0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc, 0x0118, 0x7038,
-	0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001, 0x1837, 0x2102,
-	0x2079, 0x0100, 0x2e04, 0x9084, 0x00ff, 0x2069, 0x181f, 0x206a,
-	0x78e6, 0x0006, 0x8e70, 0x2e04, 0x2069, 0x1820, 0x206a, 0x78ea,
-	0x7832, 0x7836, 0x2010, 0x9084, 0xff00, 0x001e, 0x9105, 0x2009,
-	0x182c, 0x200a, 0x2200, 0x9084, 0x00ff, 0x2008, 0x080c, 0x2887,
-	0x080c, 0x73b0, 0x0170, 0x2071, 0x0260, 0x2069, 0x1982, 0x7048,
-	0x206a, 0x704c, 0x6806, 0x7050, 0x680a, 0x7054, 0x680e, 0x080c,
-	0xcf2a, 0x0040, 0x2001, 0x0006, 0x080c, 0x6550, 0x080c, 0x31e1,
-	0x080c, 0xae47, 0x001e, 0x003e, 0x00de, 0x00ee, 0x00fe, 0x00be,
-	0x0005, 0x0096, 0x0026, 0x0036, 0x00e6, 0x0156, 0x2019, 0x182c,
-	0x231c, 0x83ff, 0x01f0, 0x2071, 0x0260, 0x7200, 0x9294, 0x00ff,
-	0x7004, 0x9084, 0xff00, 0x9205, 0x9306, 0x1198, 0x2011, 0x0276,
-	0x20a9, 0x0004, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbe03, 0x1148,
-	0x2011, 0x027a, 0x20a9, 0x0004, 0x2019, 0x0006, 0x080c, 0xbe03,
-	0x1100, 0x015e, 0x00ee, 0x003e, 0x002e, 0x009e, 0x0005, 0x00e6,
-	0x2071, 0x0260, 0x7034, 0x9086, 0x0014, 0x11a8, 0x7038, 0x9086,
-	0x0800, 0x1188, 0x703c, 0xd0ec, 0x0160, 0x9084, 0x0f00, 0x9086,
-	0x0100, 0x1138, 0x7054, 0xd0a4, 0x1110, 0xd0ac, 0x0110, 0x9006,
-	0x0010, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x0096, 0x00c6,
-	0x0076, 0x0056, 0x0046, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000,
-	0x2029, 0x19f0, 0x252c, 0x2021, 0x19f6, 0x2424, 0x2061, 0x1cd0,
-	0x2071, 0x1800, 0x7254, 0x7074, 0x9202, 0x1a04, 0xbdcf, 0x080c,
-	0x8958, 0x0904, 0xbdc8, 0x080c, 0xe5be, 0x0904, 0xbdc8, 0x6720,
-	0x9786, 0x0007, 0x0904, 0xbdc8, 0x2500, 0x9c06, 0x0904, 0xbdc8,
-	0x2400, 0x9c06, 0x05e8, 0x3e08, 0x9186, 0x0002, 0x1148, 0x6010,
-	0x9005, 0x0130, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1580,
-	0x00c6, 0x6000, 0x9086, 0x0004, 0x1110, 0x080c, 0x1a5e, 0x9786,
-	0x000a, 0x0148, 0x080c, 0xcd21, 0x1130, 0x00ce, 0x080c, 0xb7f9,
-	0x080c, 0xae78, 0x00e8, 0x6014, 0x2048, 0x080c, 0xcb1b, 0x01a8,
-	0x9786, 0x0003, 0x1530, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130,
-	0x0096, 0xa878, 0x2048, 0x080c, 0x0fb1, 0x009e, 0xab7a, 0xa877,
-	0x0000, 0x080c, 0x6c6d, 0x080c, 0xcd04, 0x080c, 0xae78, 0x00ce,
-	0x9ce0, 0x0018, 0x7068, 0x9c02, 0x1210, 0x0804, 0xbd72, 0x012e,
-	0x000e, 0x002e, 0x004e, 0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee,
-	0x0005, 0x9786, 0x0006, 0x1118, 0x080c, 0xe530, 0x0c30, 0x9786,
-	0x0009, 0x1148, 0x6000, 0x9086, 0x0004, 0x0d08, 0x2009, 0x004c,
-	0x080c, 0xaec2, 0x08e0, 0x9786, 0x000a, 0x0938, 0x0820, 0x220c,
-	0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xbdef, 0x9006,
-	0x0005, 0x2304, 0x9102, 0x0218, 0x2001, 0x0001, 0x0008, 0x9006,
-	0x918d, 0x0001, 0x0005, 0x0136, 0x01c6, 0x0016, 0x8906, 0x8006,
-	0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9300, 0x2098,
-	0x3518, 0x20a9, 0x0001, 0x220c, 0x4002, 0x910e, 0x1140, 0x8210,
-	0x8319, 0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c,
-	0x9102, 0x0218, 0x2001, 0x0001, 0x0010, 0x2001, 0x0000, 0x918d,
-	0x0001, 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c, 0x810f, 0x2304,
-	0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xbe2d, 0x9006, 0x0005,
-	0x918d, 0x0001, 0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0dd5,
-	0x080c, 0xcd10, 0x0120, 0x080c, 0xcd21, 0x0168, 0x0028, 0x080c,
-	0x31e1, 0x080c, 0xcd21, 0x0138, 0x080c, 0x955f, 0x080c, 0xae47,
-	0x080c, 0x9664, 0x0005, 0x080c, 0xb7f9, 0x0cb0, 0x9182, 0x0054,
-	0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xbe72, 0xbe72,
-	0xbe72, 0xbe72, 0xbe72, 0xbe72, 0xbe72, 0xbe72, 0xbe72, 0xbe72,
-	0xbe72, 0xbe74, 0xbe74, 0xbe74, 0xbe74, 0xbe72, 0xbe72, 0xbe72,
-	0xbe74, 0xbe72, 0x080c, 0x0dd5, 0x600b, 0xffff, 0x6003, 0x0001,
-	0x6106, 0x080c, 0x90c7, 0x0126, 0x2091, 0x8000, 0x080c, 0x9664,
-	0x012e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0040,
-	0x0804, 0xbf29, 0x9186, 0x0027, 0x1520, 0x080c, 0x955f, 0x080c,
-	0x31bc, 0x080c, 0xd22b, 0x0096, 0x6114, 0x2148, 0x080c, 0xcb1b,
-	0x0198, 0x080c, 0xcd21, 0x1118, 0x080c, 0xb7f9, 0x0068, 0xa867,
-	0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0xa97c, 0xc1c5, 0xa97e,
-	0x080c, 0x6c79, 0x080c, 0xcd04, 0x009e, 0x080c, 0xae47, 0x0804,
-	0x9664, 0x9186, 0x0014, 0x1120, 0x6004, 0x9082, 0x0040, 0x04a0,
-	0x9186, 0x0046, 0x0150, 0x9186, 0x0045, 0x0138, 0x9186, 0x0053,
-	0x0120, 0x9186, 0x0048, 0x190c, 0x0dd5, 0x2001, 0x0109, 0x2004,
-	0xd084, 0x0508, 0x0126, 0x2091, 0x2800, 0x0006, 0x0016, 0x0026,
-	0x0036, 0x00f6, 0x00e6, 0x00c6, 0x2079, 0x19e7, 0x2071, 0x1800,
-	0x2061, 0x0100, 0x080c, 0x8fac, 0x00ce, 0x00ee, 0x00fe, 0x003e,
-	0x002e, 0x001e, 0x000e, 0x012e, 0xa001, 0x6000, 0x9086, 0x0002,
-	0x1110, 0x0804, 0xbf67, 0x0005, 0x0002, 0xbf03, 0xbf01, 0xbf01,
-	0xbf01, 0xbf01, 0xbf01, 0xbf01, 0xbf01, 0xbf01, 0xbf01, 0xbf01,
-	0xbf1e, 0xbf1e, 0xbf1e, 0xbf1e, 0xbf01, 0xbf1e, 0xbf01, 0xbf1e,
-	0xbf01, 0x080c, 0x0dd5, 0x080c, 0x955f, 0x0096, 0x6114, 0x2148,
-	0x080c, 0xcb1b, 0x0168, 0xa867, 0x0103, 0xa87b, 0x0006, 0xa877,
-	0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c, 0x6c79, 0x080c, 0xcd04,
-	0x009e, 0x080c, 0xae47, 0x080c, 0x9664, 0x0005, 0x080c, 0x955f,
-	0x080c, 0xcd21, 0x090c, 0xb7f9, 0x080c, 0xae47, 0x080c, 0x9664,
-	0x0005, 0x0002, 0xbf40, 0xbf3e, 0xbf3e, 0xbf3e, 0xbf3e, 0xbf3e,
-	0xbf3e, 0xbf3e, 0xbf3e, 0xbf3e, 0xbf3e, 0xbf57, 0xbf57, 0xbf57,
-	0xbf57, 0xbf3e, 0xbf61, 0xbf3e, 0xbf57, 0xbf3e, 0x080c, 0x0dd5,
-	0x0096, 0x080c, 0x955f, 0x6014, 0x2048, 0x2001, 0x1988, 0x2004,
-	0x6042, 0xa97c, 0xd1ac, 0x0140, 0x6003, 0x0004, 0xa87c, 0x9085,
-	0x0400, 0xa87e, 0x009e, 0x0005, 0x6003, 0x0002, 0x0cb8, 0x080c,
-	0x955f, 0x080c, 0xd22e, 0x080c, 0xd233, 0x6003, 0x000f, 0x0804,
-	0x9664, 0x080c, 0x955f, 0x080c, 0xae47, 0x0804, 0x9664, 0x9182,
-	0x0054, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xbf83,
-	0xbf83, 0xbf83, 0xbf83, 0xbf83, 0xbf85, 0xc062, 0xbf83, 0xc096,
-	0xbf83, 0xbf83, 0xbf83, 0xbf83, 0xbf83, 0xbf83, 0xbf83, 0xbf83,
-	0xbf83, 0xbf83, 0xc096, 0x080c, 0x0dd5, 0x00b6, 0x0096, 0x6114,
-	0x2148, 0x7644, 0x96b4, 0x0fff, 0x86ff, 0x1528, 0x6010, 0x2058,
-	0xb800, 0xd0bc, 0x1904, 0xc051, 0xa87b, 0x0000, 0xa867, 0x0103,
-	0xae76, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c,
-	0xc22b, 0x080c, 0x6a95, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110,
-	0x8211, 0xba3e, 0x7044, 0xd0e4, 0x1904, 0xc035, 0x080c, 0xae47,
-	0x009e, 0x00be, 0x0005, 0x968c, 0x0c00, 0x0150, 0x6010, 0x2058,
-	0xb800, 0xd0bc, 0x1904, 0xc039, 0x7348, 0xab92, 0x734c, 0xab8e,
-	0x968c, 0x00ff, 0x9186, 0x0002, 0x0508, 0x9186, 0x0028, 0x1118,
-	0xa87b, 0x001c, 0x00e8, 0xd6dc, 0x01a0, 0xa87b, 0x0015, 0xa87c,
-	0xd0ac, 0x0170, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0148, 0x7048,
-	0x9106, 0x1118, 0x704c, 0x9206, 0x0118, 0xa992, 0xaa8e, 0xc6dc,
-	0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000,
-	0xa867, 0x0103, 0xae76, 0x901e, 0xd6c4, 0x01d8, 0x9686, 0x0100,
-	0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0x0804, 0xbf8c, 0x735c,
+	0xaacc, 0xabd0, 0xacd4, 0xadd8, 0x2031, 0x0000, 0x2041, 0x125d,
+	0x080c, 0xb37a, 0x0160, 0x000e, 0x9005, 0x0120, 0x00fe, 0x009e,
+	0x00de, 0x0005, 0x00fe, 0x009e, 0x00de, 0x0804, 0xae61, 0x2001,
+	0x002c, 0x900e, 0x080c, 0xb220, 0x0c70, 0x91b6, 0x0015, 0x0170,
+	0x91b6, 0x0016, 0x0158, 0x91b2, 0x0047, 0x0a0c, 0x0dd5, 0x91b2,
+	0x0050, 0x1a0c, 0x0dd5, 0x9182, 0x0047, 0x00ca, 0x2001, 0x0109,
+	0x2004, 0xd08c, 0x0198, 0x0126, 0x2091, 0x2800, 0x0006, 0x0016,
+	0x0026, 0x080c, 0x90a2, 0x002e, 0x001e, 0x000e, 0x012e, 0xa001,
+	0x6000, 0x9086, 0x0002, 0x1110, 0x0804, 0xafa6, 0x0005, 0xb078,
+	0xb078, 0xb07a, 0xb0b0, 0xb078, 0xb078, 0xb078, 0xb078, 0xb0c3,
+	0x080c, 0x0dd5, 0x00d6, 0x0016, 0x0096, 0x080c, 0x963d, 0x080c,
+	0x97b9, 0x6003, 0x0004, 0x6114, 0x2148, 0xa87c, 0xd0fc, 0x01c0,
+	0xa878, 0xc0fc, 0x9005, 0x1158, 0xa894, 0x9005, 0x0140, 0x2001,
+	0x0000, 0x900e, 0x080c, 0xb220, 0x080c, 0xae61, 0x00a8, 0x6003,
+	0x0002, 0xa8a4, 0xa9a8, 0x9105, 0x1178, 0xa8ae, 0xa8b2, 0x0c78,
+	0xa87f, 0x0020, 0xa88c, 0xa88a, 0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2,
+	0xa8c7, 0x0000, 0xa8cb, 0x0000, 0x009e, 0x001e, 0x00de, 0x0005,
+	0x080c, 0x963d, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xcb35,
+	0x0120, 0xa87b, 0x0006, 0x080c, 0x6c81, 0x009e, 0x00de, 0x080c,
+	0xae61, 0x0804, 0x97b9, 0x080c, 0x963d, 0x080c, 0x31bf, 0x080c,
+	0xd245, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xcb35, 0x0120,
+	0xa87b, 0x0029, 0x080c, 0x6c81, 0x009e, 0x00de, 0x080c, 0xae61,
+	0x0804, 0x97b9, 0x9182, 0x0047, 0x0002, 0xb0ea, 0xb0ec, 0xb0ea,
+	0xb0ea, 0xb0ea, 0xb0ea, 0xb0ea, 0xb0ea, 0xb0ea, 0xb0ea, 0xb0ea,
+	0xb0ea, 0xb0ec, 0x080c, 0x0dd5, 0x00d6, 0x0096, 0x601f, 0x0000,
+	0x6114, 0x2148, 0xa87b, 0x0000, 0xa883, 0x0000, 0x080c, 0x6c81,
+	0x009e, 0x00de, 0x0804, 0xae61, 0x0026, 0x0036, 0x0056, 0x0066,
+	0x0096, 0x00a6, 0x00f6, 0x0006, 0x080c, 0x0fff, 0x000e, 0x090c,
+	0x0dd5, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e,
+	0x20a9, 0x0020, 0x4104, 0xa87a, 0x2079, 0x1800, 0x7990, 0x9188,
+	0x0018, 0x918c, 0x0fff, 0xa972, 0xac76, 0x2950, 0x00a6, 0x2001,
+	0x0205, 0x2003, 0x0000, 0x901e, 0x2029, 0x0001, 0x9182, 0x0034,
+	0x1228, 0x2011, 0x001f, 0x080c, 0xc730, 0x04c0, 0x2130, 0x2009,
+	0x0034, 0x2011, 0x001f, 0x080c, 0xc730, 0x96b2, 0x0034, 0xb004,
+	0x904d, 0x0110, 0x080c, 0x0fb1, 0x080c, 0x0fff, 0x01d0, 0x8528,
+	0xa867, 0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d,
+	0x1230, 0x2608, 0x2011, 0x001b, 0x080c, 0xc730, 0x00b8, 0x96b2,
+	0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x080c, 0xc730,
+	0x0c18, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
+	0x0050, 0xb566, 0xb070, 0xc0fd, 0xb072, 0x0048, 0x2001, 0x0205,
+	0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0x2a48,
+	0xa804, 0xa807, 0x0000, 0x0006, 0x080c, 0x6c81, 0x000e, 0x2048,
+	0x9005, 0x1db0, 0x00fe, 0x00ae, 0x009e, 0x006e, 0x005e, 0x003e,
+	0x002e, 0x0005, 0x00d6, 0x00f6, 0x0096, 0x0006, 0x080c, 0x0fff,
+	0x000e, 0x090c, 0x0dd5, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019,
+	0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104, 0xaa66, 0xa87a, 0x2079,
+	0x1800, 0x7990, 0x810c, 0x9188, 0x000c, 0x9182, 0x001a, 0x0210,
+	0x2009, 0x001a, 0x21a8, 0x810b, 0xa972, 0xac76, 0x2e98, 0xa85c,
+	0x9080, 0x001f, 0x20a0, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080,
+	0x2102, 0x4003, 0x2003, 0x0000, 0x080c, 0x6c81, 0x009e, 0x00fe,
+	0x00de, 0x0005, 0x0016, 0x00d6, 0x00f6, 0x0096, 0x0016, 0x2001,
+	0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x001e, 0x2079, 0x0200,
+	0x2e98, 0xa87c, 0xd0ec, 0x0118, 0x9e80, 0x000c, 0x2098, 0x2021,
+	0x003e, 0x901e, 0x9282, 0x0020, 0x0218, 0x2011, 0x0020, 0x2018,
+	0x9486, 0x003e, 0x1170, 0x0096, 0x080c, 0x0fff, 0x2900, 0x009e,
+	0x05c0, 0xa806, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
+	0x20a0, 0x3300, 0x908e, 0x0260, 0x0140, 0x2009, 0x0280, 0x9102,
+	0x920a, 0x0218, 0x2010, 0x2100, 0x9318, 0x2200, 0x9402, 0x1228,
+	0x2400, 0x9202, 0x2410, 0x9318, 0x9006, 0x2020, 0x22a8, 0xa800,
+	0x9200, 0xa802, 0x20e1, 0x0000, 0x4003, 0x83ff, 0x0180, 0x3300,
+	0x9086, 0x0280, 0x1130, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816,
+	0x2e98, 0x2310, 0x84ff, 0x0904, 0xb1cf, 0x0804, 0xb1d1, 0x9085,
+	0x0001, 0x7817, 0x0000, 0x009e, 0x00fe, 0x00de, 0x001e, 0x0005,
+	0x00d6, 0x0036, 0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x080c,
+	0x6c75, 0x009e, 0x003e, 0x00de, 0x0005, 0x91b6, 0x0015, 0x1118,
+	0x080c, 0xae61, 0x0030, 0x91b6, 0x0016, 0x190c, 0x0dd5, 0x080c,
+	0xae61, 0x0005, 0x20a9, 0x000e, 0x20e1, 0x0000, 0x2e98, 0x6014,
+	0x0096, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x20a0, 0x009e, 0x4003,
+	0x0136, 0x9080, 0x001b, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418,
+	0x8318, 0x23a0, 0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8,
+	0x2011, 0x0006, 0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003,
+	0x3418, 0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xcb35,
+	0x0130, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e,
+	0x0804, 0xae61, 0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200,
+	0x11a8, 0x6010, 0x00b6, 0x2058, 0xb8cf, 0x0000, 0x00be, 0x6014,
+	0x9005, 0x0130, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32,
+	0x080c, 0xae61, 0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48,
+	0x0cc8, 0x0006, 0x0016, 0x080c, 0xd230, 0x0188, 0x6014, 0x9005,
+	0x1170, 0x600b, 0x0003, 0x601b, 0x0000, 0x6043, 0x0000, 0x2009,
+	0x0022, 0x080c, 0xb657, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085,
+	0x0001, 0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c,
+	0x20e1, 0x0000, 0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001,
+	0x2099, 0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804,
+	0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003,
+	0x2001, 0x0205, 0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020,
+	0x4003, 0x2003, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867,
+	0x0103, 0x080c, 0xae61, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016,
+	0x900e, 0x7030, 0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff,
+	0x800c, 0x703c, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108,
+	0x810b, 0x2011, 0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c,
+	0xc730, 0x080c, 0xcb35, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000,
+	0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xae61, 0x001e, 0x009e,
+	0x0005, 0x0016, 0x2009, 0x0000, 0x7030, 0x9086, 0x0200, 0x0110,
+	0x2009, 0x0001, 0x0096, 0x6014, 0x904d, 0x090c, 0x0dd5, 0xa97a,
+	0x080c, 0x6c81, 0x009e, 0x080c, 0xae61, 0x001e, 0x0005, 0x0016,
+	0x0096, 0x7030, 0x9086, 0x0100, 0x1118, 0x2009, 0x0004, 0x0010,
+	0x7034, 0x800c, 0x810b, 0x2011, 0x000c, 0x2019, 0x000c, 0x6014,
+	0x2048, 0xa804, 0x0096, 0x9005, 0x0108, 0x2048, 0x080c, 0xc730,
+	0x009e, 0x080c, 0xcb35, 0x0148, 0xa804, 0x9005, 0x1158, 0xa807,
+	0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xae61, 0x009e,
+	0x001e, 0x0005, 0x0086, 0x2040, 0xa030, 0x8007, 0x9086, 0x0100,
+	0x1118, 0x080c, 0xb813, 0x00e0, 0xa034, 0x8007, 0x800c, 0x8806,
+	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x000c,
+	0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xaaa0, 0xab9c,
+	0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x1243, 0x0019, 0x0d08,
+	0x008e, 0x0898, 0x0096, 0x0006, 0x080c, 0x0fff, 0x000e, 0x01b0,
+	0xa8ab, 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006, 0xae6a, 0x2800,
+	0xa89e, 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96, 0xad9a, 0x0086,
+	0x2940, 0x080c, 0x10e9, 0x008e, 0x9085, 0x0001, 0x009e, 0x0005,
+	0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6,
+	0x2258, 0xba10, 0x00be, 0x9206, 0x1520, 0x700c, 0x6210, 0x00b6,
+	0x2258, 0xba14, 0x00be, 0x9206, 0x11e0, 0x6043, 0x0000, 0x2c68,
+	0x0016, 0x2009, 0x0035, 0x080c, 0xd1a8, 0x001e, 0x1158, 0x622c,
+	0x2268, 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003, 0x0130, 0x9386,
+	0x0006, 0x0128, 0x080c, 0xae61, 0x0020, 0x0039, 0x0010, 0x080c,
+	0xb48c, 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096, 0x6814, 0x2048,
+	0x9186, 0x0015, 0x0904, 0xb474, 0x918e, 0x0016, 0x1904, 0xb48a,
+	0x700c, 0x908c, 0xff00, 0x9186, 0x1700, 0x0120, 0x9186, 0x0300,
+	0x1904, 0xb44e, 0x89ff, 0x1138, 0x6800, 0x9086, 0x000f, 0x0904,
+	0xb431, 0x0804, 0xb488, 0x6808, 0x9086, 0xffff, 0x1904, 0xb476,
+	0xa87c, 0x9084, 0x0060, 0x9086, 0x0020, 0x1128, 0xa83c, 0xa940,
+	0x9105, 0x1904, 0xb476, 0x6824, 0xd0b4, 0x1904, 0xb476, 0x080c,
+	0xcd1e, 0x685c, 0xa882, 0xa87c, 0xc0dc, 0xc0f4, 0xc0d4, 0xa87e,
+	0x0026, 0x900e, 0x6a18, 0x2001, 0x000a, 0x080c, 0x8f68, 0xa884,
+	0x920a, 0x0208, 0x8011, 0xaa86, 0x82ff, 0x002e, 0x1138, 0x00c6,
+	0x2d60, 0x080c, 0xc85a, 0x00ce, 0x0804, 0xb488, 0x00c6, 0xa868,
+	0xd0fc, 0x1118, 0x080c, 0x60ae, 0x0010, 0x080c, 0x64b4, 0x00ce,
+	0x1904, 0xb476, 0x00c6, 0x2d60, 0x080c, 0xae61, 0x00ce, 0x0804,
+	0xb488, 0x00c6, 0x080c, 0xaeaf, 0x0198, 0x6017, 0x0000, 0x6810,
+	0x6012, 0x080c, 0xcfaa, 0x6023, 0x0003, 0x6904, 0x00c6, 0x2d60,
+	0x080c, 0xae61, 0x00ce, 0x080c, 0xaedc, 0x00ce, 0x0804, 0xb488,
+	0x2001, 0x1988, 0x2004, 0x6842, 0x00ce, 0x04d0, 0x7008, 0x9086,
+	0x000b, 0x11c8, 0x6010, 0x00b6, 0x2058, 0xb900, 0xc1bc, 0xb902,
+	0x00be, 0x00c6, 0x2d60, 0xa87b, 0x0003, 0x080c, 0xd1ea, 0x6007,
+	0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c, 0x90f0, 0x080c,
+	0x968d, 0x00ce, 0x00e8, 0x700c, 0x9086, 0x2a00, 0x1138, 0x2001,
+	0x1988, 0x2004, 0x6842, 0x00a0, 0x0479, 0x00a0, 0x89ff, 0x090c,
+	0x0dd5, 0x00c6, 0x00d6, 0x2d60, 0xa867, 0x0103, 0xa87b, 0x0003,
+	0x080c, 0x6a9d, 0x080c, 0xcd1e, 0x080c, 0xae92, 0x00de, 0x00ce,
+	0x080c, 0xae61, 0x009e, 0x0005, 0x9186, 0x0015, 0x1128, 0x2001,
+	0x1988, 0x2004, 0x6842, 0x0068, 0x918e, 0x0016, 0x1160, 0x00c6,
+	0x2d00, 0x2060, 0x080c, 0xe80b, 0x080c, 0x86b2, 0x080c, 0xae61,
+	0x00ce, 0x080c, 0xae61, 0x0005, 0x0026, 0x0036, 0x0046, 0x7228,
+	0xacb0, 0xabac, 0xd2f4, 0x0130, 0x2001, 0x1988, 0x2004, 0x6842,
+	0x0804, 0xb506, 0x00c6, 0x2d60, 0x080c, 0xc75b, 0x00ce, 0x6804,
+	0x9086, 0x0050, 0x1168, 0x00c6, 0x2d00, 0x2060, 0x6003, 0x0001,
+	0x6007, 0x0050, 0x080c, 0x90f0, 0x080c, 0x968d, 0x00ce, 0x04f0,
+	0x6800, 0x9086, 0x000f, 0x01a8, 0x89ff, 0x090c, 0x0dd5, 0x6800,
+	0x9086, 0x0004, 0x1190, 0xa87c, 0xd0ac, 0x0178, 0xa843, 0x0fff,
+	0xa83f, 0x0fff, 0xa880, 0xc0fc, 0xa882, 0x2001, 0x0001, 0x6832,
+	0x0400, 0x2001, 0x0007, 0x6832, 0x00e0, 0xa87c, 0xd0b4, 0x1150,
+	0xd0ac, 0x0db8, 0x6824, 0xd0f4, 0x1d48, 0xa838, 0xa934, 0x9105,
+	0x0d80, 0x0c20, 0xd2ec, 0x1d68, 0x7024, 0x9306, 0x1118, 0x7020,
+	0x9406, 0x0d38, 0x7020, 0x683e, 0x7024, 0x683a, 0x2001, 0x0005,
+	0x6832, 0x080c, 0xcea1, 0x080c, 0x968d, 0x0010, 0x080c, 0xae61,
+	0x004e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008,
+	0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206,
+	0x1904, 0xb571, 0x700c, 0x6210, 0x00b6, 0x2258, 0xba14, 0x00be,
+	0x9206, 0x1904, 0xb571, 0x6038, 0x2068, 0x6824, 0xc0dc, 0x6826,
+	0x6a20, 0x9286, 0x0007, 0x0904, 0xb571, 0x9286, 0x0002, 0x0904,
+	0xb571, 0x9286, 0x0000, 0x05e8, 0x6808, 0x633c, 0x9306, 0x15c8,
+	0x2071, 0x026c, 0x9186, 0x0015, 0x0570, 0x918e, 0x0016, 0x1100,
+	0x00c6, 0x6038, 0x2060, 0x6104, 0x9186, 0x004b, 0x01c0, 0x9186,
+	0x004c, 0x01a8, 0x9186, 0x004d, 0x0190, 0x9186, 0x004e, 0x0178,
+	0x9186, 0x0052, 0x0160, 0x6014, 0x0096, 0x2048, 0x080c, 0xcb35,
+	0x090c, 0x0dd5, 0xa87b, 0x0003, 0x009e, 0x080c, 0xd1ea, 0x6007,
+	0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c, 0x90f0, 0x080c,
+	0x968d, 0x00ce, 0x0030, 0x6038, 0x2070, 0x2001, 0x1988, 0x2004,
+	0x7042, 0x080c, 0xae61, 0x002e, 0x00de, 0x00ee, 0x0005, 0x00b6,
+	0x0096, 0x00f6, 0x6014, 0x2048, 0x6010, 0x2058, 0x91b6, 0x0015,
+	0x0130, 0xba08, 0xbb0c, 0xbc00, 0xc48c, 0xbc02, 0x0460, 0x0096,
+	0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0010, 0x2019, 0x000a,
+	0x20a9, 0x0004, 0x080c, 0xbe1d, 0x002e, 0x003e, 0x015e, 0x009e,
+	0x1904, 0xb5e0, 0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90,
+	0x0014, 0x2019, 0x0006, 0x20a9, 0x0004, 0x080c, 0xbe1d, 0x002e,
+	0x003e, 0x015e, 0x009e, 0x15a0, 0x7238, 0xba0a, 0x733c, 0xbb0e,
+	0xbc00, 0xc48d, 0xbc02, 0xa804, 0x9005, 0x1128, 0x00fe, 0x009e,
+	0x00be, 0x0804, 0xb265, 0x0096, 0x2048, 0xaa12, 0xab16, 0xac0a,
+	0x009e, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4,
+	0x2031, 0x0000, 0x2041, 0x1243, 0x080c, 0xb37a, 0x0130, 0x00fe,
+	0x009e, 0x080c, 0xae61, 0x00be, 0x0005, 0x080c, 0xb813, 0x0cb8,
+	0x2b78, 0x00f6, 0x080c, 0x31bf, 0x080c, 0xd245, 0x00fe, 0x00c6,
+	0x080c, 0xae0b, 0x2f00, 0x6012, 0x6017, 0x0000, 0x6023, 0x0001,
+	0x6007, 0x0001, 0x6003, 0x0001, 0x2001, 0x0007, 0x080c, 0x654f,
+	0x080c, 0x657b, 0x080c, 0x9138, 0x080c, 0x968d, 0x00ce, 0x0804,
+	0xb5b3, 0x2100, 0x91b2, 0x0053, 0x1a0c, 0x0dd5, 0x91b2, 0x0040,
+	0x1a04, 0xb669, 0x0002, 0xb657, 0xb657, 0xb64d, 0xb657, 0xb657,
+	0xb657, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b,
+	0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b,
+	0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b,
+	0xb64b, 0xb64b, 0xb657, 0xb64b, 0xb657, 0xb657, 0xb64b, 0xb64b,
+	0xb64b, 0xb64b, 0xb64b, 0xb64d, 0xb64b, 0xb64b, 0xb64b, 0xb64b,
+	0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb657, 0xb657, 0xb64b,
+	0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b, 0xb64b,
+	0xb657, 0xb64b, 0xb64b, 0x080c, 0x0dd5, 0x0066, 0x00b6, 0x6610,
+	0x2658, 0xb8cc, 0xc08c, 0xb8ce, 0x00be, 0x006e, 0x0000, 0x6003,
+	0x0001, 0x6106, 0x9186, 0x0032, 0x0118, 0x080c, 0x9138, 0x0010,
+	0x080c, 0x90f0, 0x0126, 0x2091, 0x8000, 0x080c, 0x968d, 0x012e,
+	0x0005, 0x2600, 0x0002, 0xb657, 0xb657, 0xb67d, 0xb657, 0xb657,
+	0xb67d, 0xb67d, 0xb67d, 0xb67d, 0xb657, 0xb67d, 0xb657, 0xb67d,
+	0xb657, 0xb67d, 0xb67d, 0xb67d, 0xb67d, 0x080c, 0x0dd5, 0x6004,
+	0x90b2, 0x0053, 0x1a0c, 0x0dd5, 0x91b6, 0x0013, 0x0904, 0xb741,
+	0x91b6, 0x0027, 0x1904, 0xb6fc, 0x080c, 0x9588, 0x6004, 0x080c,
+	0xcd2a, 0x01b0, 0x080c, 0xcd3b, 0x01a8, 0x908e, 0x0021, 0x0904,
+	0xb6f9, 0x908e, 0x0022, 0x1130, 0x080c, 0xb291, 0x0904, 0xb6f5,
+	0x0804, 0xb6f6, 0x908e, 0x003d, 0x0904, 0xb6f9, 0x0804, 0xb6ef,
+	0x080c, 0x31e8, 0x2001, 0x0007, 0x080c, 0x654f, 0x6010, 0x00b6,
+	0x2058, 0xb9a0, 0x00be, 0x080c, 0xb813, 0x9186, 0x007e, 0x1148,
+	0x2001, 0x1837, 0x2014, 0xc285, 0x080c, 0x73bc, 0x1108, 0xc2ad,
+	0x2202, 0x0036, 0x0026, 0x2019, 0x0028, 0x2110, 0x080c, 0xe917,
+	0x002e, 0x003e, 0x0016, 0x0026, 0x0036, 0x2110, 0x2019, 0x0028,
+	0x080c, 0x928b, 0x0076, 0x903e, 0x080c, 0x9168, 0x6010, 0x00b6,
+	0x905d, 0x0100, 0x00be, 0x2c08, 0x080c, 0xe2eb, 0x007e, 0x003e,
+	0x002e, 0x001e, 0x080c, 0xd245, 0x0016, 0x080c, 0xcfa2, 0x080c,
+	0xae61, 0x001e, 0x080c, 0x32bb, 0x080c, 0x968d, 0x0030, 0x080c,
+	0xcfa2, 0x080c, 0xae61, 0x080c, 0x968d, 0x0005, 0x080c, 0xb813,
+	0x0cb0, 0x080c, 0xb84f, 0x0c98, 0x9186, 0x0014, 0x1db0, 0x080c,
+	0x9588, 0x6004, 0x908e, 0x0022, 0x1118, 0x080c, 0xb291, 0x0d68,
+	0x080c, 0x31bf, 0x080c, 0xd245, 0x080c, 0xcd2a, 0x1190, 0x080c,
+	0x31e8, 0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xb813,
+	0x9186, 0x007e, 0x1128, 0x2001, 0x1837, 0x200c, 0xc185, 0x2102,
+	0x0870, 0x080c, 0xcd3b, 0x1118, 0x080c, 0xb813, 0x0840, 0x6004,
+	0x908e, 0x0032, 0x1160, 0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079,
+	0x0000, 0x080c, 0x3556, 0x00fe, 0x00ee, 0x0804, 0xb6ef, 0x6004,
+	0x908e, 0x0021, 0x0d48, 0x908e, 0x0022, 0x090c, 0xb813, 0x0804,
+	0xb6ef, 0x90b2, 0x0040, 0x1a04, 0xb7ef, 0x2008, 0x0002, 0xb789,
+	0xb78a, 0xb78d, 0xb790, 0xb793, 0xb796, 0xb787, 0xb787, 0xb787,
+	0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787,
+	0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787,
+	0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb799, 0xb7a4, 0xb787,
+	0xb7a6, 0xb7a4, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb7a4,
+	0xb7a4, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787, 0xb787,
+	0xb787, 0xb7d6, 0xb7a4, 0xb787, 0xb7a0, 0xb787, 0xb787, 0xb787,
+	0xb7a1, 0xb787, 0xb787, 0xb787, 0xb7a4, 0xb7cd, 0xb787, 0x080c,
+	0x0dd5, 0x00d0, 0x2001, 0x000b, 0x0410, 0x2001, 0x0003, 0x00f8,
+	0x2001, 0x0005, 0x00e0, 0x2001, 0x0001, 0x00c8, 0x2001, 0x0009,
+	0x00b0, 0x080c, 0x9588, 0x6003, 0x0005, 0x080c, 0x968d, 0x0070,
+	0x0018, 0x0010, 0x080c, 0x654f, 0x0804, 0xb7e7, 0x080c, 0x9588,
+	0x080c, 0xd248, 0x6003, 0x0004, 0x080c, 0x968d, 0x0005, 0x080c,
+	0x654f, 0x080c, 0x9588, 0x6003, 0x0002, 0x0036, 0x2019, 0x1852,
+	0x2304, 0x9084, 0xff00, 0x1120, 0x2001, 0x1986, 0x201c, 0x0040,
+	0x8007, 0x909a, 0x0004, 0x0ec0, 0x8003, 0x801b, 0x831b, 0x9318,
+	0x631a, 0x003e, 0x080c, 0x968d, 0x0c08, 0x080c, 0x9588, 0x080c,
+	0xcfa2, 0x080c, 0xae61, 0x080c, 0x968d, 0x08c0, 0x00e6, 0x00f6,
+	0x2071, 0x189e, 0x2079, 0x0000, 0x080c, 0x3556, 0x00fe, 0x00ee,
+	0x080c, 0x9588, 0x080c, 0xae61, 0x080c, 0x968d, 0x0838, 0x080c,
+	0x9588, 0x6003, 0x0002, 0x080c, 0xd248, 0x0804, 0x968d, 0x2600,
+	0x2008, 0x0002, 0xb806, 0xb7e7, 0xb804, 0xb7e7, 0xb7e7, 0xb804,
+	0xb804, 0xb804, 0xb804, 0xb7e7, 0xb804, 0xb7e7, 0xb804, 0xb7e7,
+	0xb804, 0xb804, 0xb804, 0xb804, 0x080c, 0x0dd5, 0x080c, 0x9588,
+	0x0096, 0x6014, 0x2048, 0x080c, 0x6c81, 0x009e, 0x080c, 0xae61,
+	0x080c, 0x968d, 0x0005, 0x00e6, 0x0096, 0x0026, 0x0016, 0x080c,
+	0xcb35, 0x0568, 0x6014, 0x2048, 0xa864, 0x9086, 0x0139, 0x11a8,
+	0xa894, 0x9086, 0x0056, 0x1148, 0x080c, 0x5478, 0x0130, 0x2001,
+	0x0000, 0x900e, 0x2011, 0x4000, 0x0028, 0x2001, 0x0030, 0x900e,
+	0x2011, 0x4005, 0x080c, 0xd10f, 0x0090, 0xa868, 0xd0fc, 0x0178,
+	0xa807, 0x0000, 0x0016, 0x6004, 0x908e, 0x0021, 0x0168, 0x908e,
+	0x003d, 0x0150, 0x001e, 0xa867, 0x0103, 0xa833, 0x0100, 0x001e,
+	0x002e, 0x009e, 0x00ee, 0x0005, 0x001e, 0x0009, 0x0cc0, 0x0096,
+	0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0xa823, 0x8001,
+	0x009e, 0x0005, 0x00b6, 0x6610, 0x2658, 0xb804, 0x9084, 0x00ff,
+	0x90b2, 0x000c, 0x1a0c, 0x0dd5, 0x6604, 0x96b6, 0x004d, 0x1120,
+	0x080c, 0xd02e, 0x0804, 0xb8df, 0x6604, 0x96b6, 0x0043, 0x1120,
+	0x080c, 0xd077, 0x0804, 0xb8df, 0x6604, 0x96b6, 0x004b, 0x1120,
+	0x080c, 0xd0a3, 0x0804, 0xb8df, 0x6604, 0x96b6, 0x0033, 0x1120,
+	0x080c, 0xcfc4, 0x0804, 0xb8df, 0x6604, 0x96b6, 0x0028, 0x1120,
+	0x080c, 0xcd74, 0x0804, 0xb8df, 0x6604, 0x96b6, 0x0029, 0x1120,
+	0x080c, 0xcdb5, 0x0804, 0xb8df, 0x6604, 0x96b6, 0x001f, 0x1120,
+	0x080c, 0xb23a, 0x0804, 0xb8df, 0x6604, 0x96b6, 0x0000, 0x1118,
+	0x080c, 0xb577, 0x04e0, 0x6604, 0x96b6, 0x0022, 0x1118, 0x080c,
+	0xb272, 0x04a8, 0x6604, 0x96b6, 0x0035, 0x1118, 0x080c, 0xb398,
+	0x0470, 0x6604, 0x96b6, 0x0039, 0x1118, 0x080c, 0xb50c, 0x0438,
+	0x6604, 0x96b6, 0x003d, 0x1118, 0x080c, 0xb2aa, 0x0400, 0x6604,
+	0x96b6, 0x0044, 0x1118, 0x080c, 0xb2e6, 0x00c8, 0x6604, 0x96b6,
+	0x0049, 0x1118, 0x080c, 0xb327, 0x0090, 0x6604, 0x96b6, 0x0041,
+	0x1118, 0x080c, 0xb311, 0x0058, 0x91b6, 0x0015, 0x1110, 0x0063,
+	0x0030, 0x91b6, 0x0016, 0x1128, 0x00be, 0x0804, 0xbb39, 0x00be,
+	0x0005, 0x080c, 0xaef7, 0x0cd8, 0xb8fc, 0xb8ff, 0xb8fc, 0xb946,
+	0xb8fc, 0xbaad, 0xbb46, 0xb8fc, 0xb8fc, 0xbb0f, 0xb8fc, 0xbb25,
+	0x0096, 0x601f, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867,
+	0x0103, 0x009e, 0x0804, 0xae61, 0xa001, 0xa001, 0x0005, 0x00e6,
+	0x2071, 0x1800, 0x7090, 0x9086, 0x0074, 0x1540, 0x080c, 0xe2bc,
+	0x11b0, 0x6010, 0x00b6, 0x2058, 0x7030, 0xd08c, 0x0128, 0xb800,
+	0xd0bc, 0x0110, 0xc0c5, 0xb802, 0x00f9, 0x00be, 0x2001, 0x0006,
+	0x080c, 0x654f, 0x080c, 0x31e8, 0x080c, 0xae61, 0x0098, 0x2001,
+	0x000a, 0x080c, 0x654f, 0x080c, 0x31e8, 0x6003, 0x0001, 0x6007,
+	0x0001, 0x080c, 0x9138, 0x080c, 0x968d, 0x0020, 0x2001, 0x0001,
+	0x080c, 0xba7d, 0x00ee, 0x0005, 0x00d6, 0xb800, 0xd084, 0x0160,
+	0x9006, 0x080c, 0x653b, 0x2069, 0x1847, 0x6804, 0xd0a4, 0x0120,
+	0x2001, 0x0006, 0x080c, 0x657b, 0x00de, 0x0005, 0x00b6, 0x0096,
+	0x00d6, 0x2011, 0x1824, 0x2204, 0x9086, 0x0074, 0x1904, 0xba54,
+	0x6010, 0x2058, 0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c, 0xbc93,
+	0x0804, 0xb9b8, 0x080c, 0xbc88, 0x6010, 0x2058, 0xbaa0, 0x9286,
+	0x0080, 0x1510, 0x6014, 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084,
+	0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011,
+	0x4000, 0x080c, 0xd10f, 0x0030, 0xa807, 0x0000, 0xa867, 0x0103,
+	0xa833, 0x0200, 0x2001, 0x0006, 0x080c, 0x654f, 0x080c, 0x31e8,
+	0x080c, 0xae61, 0x0804, 0xba57, 0x080c, 0xba65, 0x6014, 0x9005,
+	0x0190, 0x2048, 0xa868, 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff,
+	0x9086, 0x0039, 0x1d08, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000,
+	0x080c, 0xd10f, 0x08f8, 0x080c, 0xba5b, 0x0160, 0x9006, 0x080c,
+	0x653b, 0x2001, 0x0004, 0x080c, 0x657b, 0x2001, 0x0007, 0x080c,
+	0x654f, 0x08a0, 0x2001, 0x0004, 0x080c, 0x654f, 0x6003, 0x0001,
+	0x6007, 0x0003, 0x080c, 0x9138, 0x080c, 0x968d, 0x0804, 0xba57,
+	0xb85c, 0xd0e4, 0x01d8, 0x080c, 0xcf44, 0x080c, 0x73bc, 0x0118,
+	0xd0dc, 0x1904, 0xb97a, 0x2011, 0x1837, 0x2204, 0xc0ad, 0x2012,
+	0x2001, 0x196d, 0x2004, 0x00f6, 0x2079, 0x0100, 0x78e3, 0x0000,
+	0x080c, 0x28b2, 0x78e2, 0x00fe, 0x0804, 0xb97a, 0x080c, 0xcf81,
+	0x2011, 0x1837, 0x2204, 0xc0a5, 0x2012, 0x0006, 0x080c, 0xe441,
+	0x000e, 0x1904, 0xb97a, 0xc0b5, 0x2012, 0x2001, 0x0006, 0x080c,
+	0x654f, 0x9006, 0x080c, 0x653b, 0x00c6, 0x2001, 0x180f, 0x2004,
+	0xd09c, 0x0520, 0x00f6, 0x2079, 0x0100, 0x00e6, 0x2071, 0x1800,
+	0x700c, 0x9084, 0x00ff, 0x78e6, 0x707e, 0x7010, 0x78ea, 0x7082,
+	0x908c, 0x00ff, 0x00ee, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c,
+	0x2887, 0x00f6, 0x2100, 0x900e, 0x080c, 0x283e, 0x795e, 0x00fe,
+	0x9186, 0x0081, 0x01d8, 0x2009, 0x0081, 0x00c8, 0x2009, 0x00ef,
+	0x00f6, 0x2079, 0x0100, 0x79ea, 0x7932, 0x7936, 0x780c, 0xc0b5,
+	0x780e, 0x00fe, 0x080c, 0x2887, 0x00f6, 0x2079, 0x1800, 0x7982,
+	0x2100, 0x900e, 0x080c, 0x283e, 0x795e, 0x00fe, 0x8108, 0x080c,
+	0x659e, 0x2b00, 0x00ce, 0x1904, 0xb97a, 0x6012, 0x2009, 0x180f,
+	0x210c, 0xd19c, 0x0150, 0x2009, 0x027c, 0x210c, 0x918c, 0x00ff,
+	0xb912, 0x2009, 0x027d, 0x210c, 0xb916, 0x2001, 0x0002, 0x080c,
+	0x654f, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c,
+	0x9138, 0x080c, 0x968d, 0x0018, 0x2001, 0x0001, 0x0431, 0x00de,
+	0x009e, 0x00be, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4, 0x0120,
+	0x2001, 0x1848, 0x2004, 0xd0ac, 0x0005, 0x00e6, 0x080c, 0xe970,
+	0x0190, 0x2071, 0x0260, 0x7108, 0x720c, 0x918c, 0x00ff, 0x1118,
+	0x9284, 0xff00, 0x0140, 0x6010, 0x2058, 0xb8a0, 0x9084, 0xff80,
+	0x1110, 0xb912, 0xba16, 0x00ee, 0x0005, 0x2030, 0x9005, 0x0158,
+	0x2001, 0x0007, 0x080c, 0x654f, 0x080c, 0x56e3, 0x1120, 0x2001,
+	0x0007, 0x080c, 0x657b, 0x2600, 0x9005, 0x11b0, 0x6014, 0x0096,
+	0x2048, 0xa868, 0x009e, 0xd0fc, 0x1178, 0x0036, 0x0046, 0x6010,
+	0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x2011, 0x8014,
+	0x080c, 0x4b04, 0x004e, 0x003e, 0x080c, 0x31e8, 0x6020, 0x9086,
+	0x000a, 0x1108, 0x0005, 0x0804, 0xae61, 0x00b6, 0x00e6, 0x0026,
+	0x0016, 0x2071, 0x1800, 0x7090, 0x9086, 0x0014, 0x1904, 0xbb05,
+	0x080c, 0x56e3, 0x1170, 0x6014, 0x9005, 0x1158, 0x0036, 0x0046,
+	0x6010, 0x2058, 0xbba0, 0x2021, 0x0006, 0x080c, 0x4cbb, 0x004e,
+	0x003e, 0x00d6, 0x6010, 0x2058, 0x080c, 0x669a, 0x080c, 0xb934,
+	0x00de, 0x080c, 0xbd59, 0x1588, 0x6010, 0x2058, 0xb890, 0x9005,
+	0x0560, 0x2001, 0x0006, 0x080c, 0x654f, 0x0096, 0x6014, 0x904d,
+	0x01d0, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001,
+	0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xd10f, 0x0060, 0xa864,
+	0x9084, 0x00ff, 0x9086, 0x0029, 0x0130, 0xa807, 0x0000, 0xa867,
+	0x0103, 0xa833, 0x0200, 0x009e, 0x080c, 0x31e8, 0x6020, 0x9086,
+	0x000a, 0x0140, 0x080c, 0xae61, 0x0028, 0x080c, 0xb813, 0x9006,
+	0x080c, 0xba7d, 0x001e, 0x002e, 0x00ee, 0x00be, 0x0005, 0x2011,
+	0x1824, 0x2204, 0x9086, 0x0014, 0x1160, 0x2001, 0x0002, 0x080c,
+	0x654f, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x9138, 0x0804,
+	0x968d, 0x2001, 0x0001, 0x0804, 0xba7d, 0x2030, 0x2011, 0x1824,
+	0x2204, 0x9086, 0x0004, 0x1148, 0x96b6, 0x000b, 0x1120, 0x2001,
+	0x0007, 0x080c, 0x654f, 0x0804, 0xae61, 0x2001, 0x0001, 0x0804,
+	0xba7d, 0x0002, 0xb8fc, 0xbb51, 0xb8fc, 0xbb92, 0xb8fc, 0xbc3f,
+	0xbb46, 0xb8fc, 0xb8fc, 0xbc53, 0xb8fc, 0xbc65, 0x6604, 0x9686,
+	0x0003, 0x0904, 0xbaad, 0x96b6, 0x001e, 0x1110, 0x080c, 0xae61,
+	0x0005, 0x00b6, 0x00d6, 0x00c6, 0x080c, 0xbc77, 0x11a0, 0x9006,
+	0x080c, 0x653b, 0x080c, 0x31bf, 0x080c, 0xd245, 0x2001, 0x0002,
+	0x080c, 0x654f, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9138,
+	0x080c, 0x968d, 0x0418, 0x2009, 0x026e, 0x2104, 0x9086, 0x0009,
+	0x1160, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0170,
+	0x8001, 0xb842, 0x601b, 0x000a, 0x0088, 0x2009, 0x026f, 0x2104,
+	0x9084, 0xff00, 0x9086, 0x1900, 0x1108, 0x08a0, 0x080c, 0x31bf,
+	0x080c, 0xd245, 0x2001, 0x0001, 0x080c, 0xba7d, 0x00ce, 0x00de,
+	0x00be, 0x0005, 0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xbc85,
+	0x00d6, 0x2069, 0x197c, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058,
+	0xb8a0, 0x9086, 0x007e, 0x1138, 0x2069, 0x1820, 0x2d04, 0x8000,
+	0x206a, 0x00de, 0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x653b,
+	0x2001, 0x0002, 0x080c, 0x654f, 0x6003, 0x0001, 0x6007, 0x0002,
+	0x080c, 0x9138, 0x080c, 0x968d, 0x0804, 0xbc0f, 0x080c, 0xcb35,
+	0x01b0, 0x6014, 0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138,
+	0x6007, 0x0016, 0x2001, 0x0002, 0x080c, 0xd169, 0x00b0, 0x6014,
+	0x2048, 0xa864, 0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001,
+	0x180e, 0x2004, 0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084,
+	0x00ff, 0x9005, 0x1110, 0x9006, 0x0c38, 0x080c, 0xb813, 0x2009,
+	0x026e, 0x2134, 0x96b4, 0x00ff, 0x9686, 0x0005, 0x0520, 0x9686,
+	0x000b, 0x01c8, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118,
+	0x9686, 0x0009, 0x01c0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009,
+	0x0190, 0x2001, 0x0004, 0x080c, 0x654f, 0x2001, 0x0028, 0x601a,
+	0x6007, 0x0052, 0x0020, 0x2001, 0x0001, 0x080c, 0xba7d, 0x002e,
+	0x00be, 0x009e, 0x0005, 0x9286, 0x0139, 0x0160, 0x6014, 0x2048,
+	0x080c, 0xcb35, 0x0140, 0xa864, 0x9086, 0x0139, 0x0118, 0xa868,
+	0xd0fc, 0x0108, 0x0c40, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff,
+	0x9005, 0x0138, 0x8001, 0xb842, 0x601b, 0x000a, 0x6007, 0x0016,
+	0x08f0, 0xb8a0, 0x9086, 0x007e, 0x1138, 0x00e6, 0x2071, 0x1800,
+	0x080c, 0x5fad, 0x00ee, 0x0010, 0x080c, 0x31bf, 0x0860, 0x080c,
+	0xbc85, 0x1160, 0x2001, 0x0004, 0x080c, 0x654f, 0x6003, 0x0001,
+	0x6007, 0x0003, 0x080c, 0x9138, 0x0804, 0x968d, 0x080c, 0xb813,
+	0x9006, 0x0804, 0xba7d, 0x0489, 0x1160, 0x2001, 0x0008, 0x080c,
+	0x654f, 0x6003, 0x0001, 0x6007, 0x0005, 0x080c, 0x9138, 0x0804,
+	0x968d, 0x2001, 0x0001, 0x0804, 0xba7d, 0x00f9, 0x1160, 0x2001,
+	0x000a, 0x080c, 0x654f, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
+	0x9138, 0x0804, 0x968d, 0x2001, 0x0001, 0x0804, 0xba7d, 0x2009,
+	0x026e, 0x2104, 0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104,
+	0x9084, 0xff00, 0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005,
+	0x00b6, 0x00c6, 0x0016, 0x6110, 0x2158, 0x080c, 0x660e, 0x001e,
+	0x00ce, 0x00be, 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036,
+	0x0016, 0x6010, 0x2058, 0x2009, 0x1837, 0x2104, 0x9085, 0x0003,
+	0x200a, 0x080c, 0xbd2b, 0x0560, 0x2009, 0x1837, 0x2104, 0xc0cd,
+	0x200a, 0x080c, 0x696e, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a,
+	0x080c, 0xe5ae, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019,
+	0x002a, 0x2009, 0x0001, 0x080c, 0x318a, 0x00e6, 0x2071, 0x1800,
+	0x080c, 0x2f96, 0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009,
+	0x007f, 0x080c, 0x32bb, 0x8108, 0x1f04, 0xbcc9, 0x015e, 0x00ce,
+	0x080c, 0xbc88, 0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001,
+	0x2001, 0x1837, 0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc,
+	0x0118, 0x7038, 0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001,
+	0x1837, 0x2102, 0x2079, 0x0100, 0x2e04, 0x9084, 0x00ff, 0x2069,
+	0x181f, 0x206a, 0x78e6, 0x0006, 0x8e70, 0x2e04, 0x2069, 0x1820,
+	0x206a, 0x78ea, 0x7832, 0x7836, 0x2010, 0x9084, 0xff00, 0x001e,
+	0x9105, 0x2009, 0x182c, 0x200a, 0x2200, 0x9084, 0x00ff, 0x2008,
+	0x080c, 0x2887, 0x080c, 0x73bc, 0x0170, 0x2071, 0x0260, 0x2069,
+	0x1982, 0x7048, 0x206a, 0x704c, 0x6806, 0x7050, 0x680a, 0x7054,
+	0x680e, 0x080c, 0xcf44, 0x0040, 0x2001, 0x0006, 0x080c, 0x654f,
+	0x080c, 0x31e8, 0x080c, 0xae61, 0x001e, 0x003e, 0x00de, 0x00ee,
+	0x00fe, 0x00be, 0x0005, 0x0096, 0x0026, 0x0036, 0x00e6, 0x0156,
+	0x2019, 0x182c, 0x231c, 0x83ff, 0x01f0, 0x2071, 0x0260, 0x7200,
+	0x9294, 0x00ff, 0x7004, 0x9084, 0xff00, 0x9205, 0x9306, 0x1198,
+	0x2011, 0x0276, 0x20a9, 0x0004, 0x2b48, 0x2019, 0x000a, 0x080c,
+	0xbe1d, 0x1148, 0x2011, 0x027a, 0x20a9, 0x0004, 0x2019, 0x0006,
+	0x080c, 0xbe1d, 0x1100, 0x015e, 0x00ee, 0x003e, 0x002e, 0x009e,
+	0x0005, 0x00e6, 0x2071, 0x0260, 0x7034, 0x9086, 0x0014, 0x11a8,
+	0x7038, 0x9086, 0x0800, 0x1188, 0x703c, 0xd0ec, 0x0160, 0x9084,
+	0x0f00, 0x9086, 0x0100, 0x1138, 0x7054, 0xd0a4, 0x1110, 0xd0ac,
+	0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6,
+	0x0096, 0x00c6, 0x0076, 0x0056, 0x0046, 0x0026, 0x0006, 0x0126,
+	0x2091, 0x8000, 0x2029, 0x19f0, 0x252c, 0x2021, 0x19f6, 0x2424,
+	0x2061, 0x1cd0, 0x2071, 0x1800, 0x7254, 0x7074, 0x9202, 0x1a04,
+	0xbde9, 0x080c, 0x8981, 0x0904, 0xbde2, 0x080c, 0xe5df, 0x0904,
+	0xbde2, 0x6720, 0x9786, 0x0007, 0x0904, 0xbde2, 0x2500, 0x9c06,
+	0x0904, 0xbde2, 0x2400, 0x9c06, 0x05e8, 0x3e08, 0x9186, 0x0002,
+	0x1148, 0x6010, 0x9005, 0x0130, 0x00b6, 0x2058, 0xb800, 0x00be,
+	0xd0bc, 0x1580, 0x00c6, 0x6000, 0x9086, 0x0004, 0x1110, 0x080c,
+	0x1a5e, 0x9786, 0x000a, 0x0148, 0x080c, 0xcd3b, 0x1130, 0x00ce,
+	0x080c, 0xb813, 0x080c, 0xae92, 0x00e8, 0x6014, 0x2048, 0x080c,
+	0xcb35, 0x01a8, 0x9786, 0x0003, 0x1530, 0xa867, 0x0103, 0xa87c,
+	0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fb1, 0x009e,
+	0xab7a, 0xa877, 0x0000, 0x080c, 0x6c75, 0x080c, 0xcd1e, 0x080c,
+	0xae92, 0x00ce, 0x9ce0, 0x0018, 0x7068, 0x9c02, 0x1210, 0x0804,
+	0xbd8c, 0x012e, 0x000e, 0x002e, 0x004e, 0x005e, 0x007e, 0x00ce,
+	0x009e, 0x00ee, 0x0005, 0x9786, 0x0006, 0x1118, 0x080c, 0xe551,
+	0x0c30, 0x9786, 0x0009, 0x1148, 0x6000, 0x9086, 0x0004, 0x0d08,
+	0x2009, 0x004c, 0x080c, 0xaedc, 0x08e0, 0x9786, 0x000a, 0x0938,
+	0x0820, 0x220c, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04,
+	0xbe09, 0x9006, 0x0005, 0x2304, 0x9102, 0x0218, 0x2001, 0x0001,
+	0x0008, 0x9006, 0x918d, 0x0001, 0x0005, 0x0136, 0x01c6, 0x0016,
+	0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0,
+	0x9300, 0x2098, 0x3518, 0x20a9, 0x0001, 0x220c, 0x4002, 0x910e,
+	0x1140, 0x8210, 0x8319, 0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e,
+	0x0005, 0x220c, 0x9102, 0x0218, 0x2001, 0x0001, 0x0010, 0x2001,
+	0x0000, 0x918d, 0x0001, 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c,
+	0x810f, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xbe47,
+	0x9006, 0x0005, 0x918d, 0x0001, 0x0005, 0x6004, 0x908a, 0x0053,
+	0x1a0c, 0x0dd5, 0x080c, 0xcd2a, 0x0120, 0x080c, 0xcd3b, 0x0168,
+	0x0028, 0x080c, 0x31e8, 0x080c, 0xcd3b, 0x0138, 0x080c, 0x9588,
+	0x080c, 0xae61, 0x080c, 0x968d, 0x0005, 0x080c, 0xb813, 0x0cb0,
+	0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005,
+	0xbe8c, 0xbe8c, 0xbe8c, 0xbe8c, 0xbe8c, 0xbe8c, 0xbe8c, 0xbe8c,
+	0xbe8c, 0xbe8c, 0xbe8c, 0xbe8e, 0xbe8e, 0xbe8e, 0xbe8e, 0xbe8c,
+	0xbe8c, 0xbe8c, 0xbe8e, 0xbe8c, 0x080c, 0x0dd5, 0x600b, 0xffff,
+	0x6003, 0x0001, 0x6106, 0x080c, 0x90f0, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x968d, 0x012e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004,
+	0x9082, 0x0040, 0x0804, 0xbf43, 0x9186, 0x0027, 0x1520, 0x080c,
+	0x9588, 0x080c, 0x31bf, 0x080c, 0xd245, 0x0096, 0x6114, 0x2148,
+	0x080c, 0xcb35, 0x0198, 0x080c, 0xcd3b, 0x1118, 0x080c, 0xb813,
+	0x0068, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0xa97c,
+	0xc1c5, 0xa97e, 0x080c, 0x6c81, 0x080c, 0xcd1e, 0x009e, 0x080c,
+	0xae61, 0x0804, 0x968d, 0x9186, 0x0014, 0x1120, 0x6004, 0x9082,
+	0x0040, 0x04a0, 0x9186, 0x0046, 0x0150, 0x9186, 0x0045, 0x0138,
+	0x9186, 0x0053, 0x0120, 0x9186, 0x0048, 0x190c, 0x0dd5, 0x2001,
+	0x0109, 0x2004, 0xd084, 0x0508, 0x0126, 0x2091, 0x2800, 0x0006,
+	0x0016, 0x0026, 0x0036, 0x00f6, 0x00e6, 0x00c6, 0x2079, 0x19e7,
+	0x2071, 0x1800, 0x2061, 0x0100, 0x080c, 0x8fd5, 0x00ce, 0x00ee,
+	0x00fe, 0x003e, 0x002e, 0x001e, 0x000e, 0x012e, 0xa001, 0x6000,
+	0x9086, 0x0002, 0x1110, 0x0804, 0xbf81, 0x0005, 0x0002, 0xbf1d,
+	0xbf1b, 0xbf1b, 0xbf1b, 0xbf1b, 0xbf1b, 0xbf1b, 0xbf1b, 0xbf1b,
+	0xbf1b, 0xbf1b, 0xbf38, 0xbf38, 0xbf38, 0xbf38, 0xbf1b, 0xbf38,
+	0xbf1b, 0xbf38, 0xbf1b, 0x080c, 0x0dd5, 0x080c, 0x9588, 0x0096,
+	0x6114, 0x2148, 0x080c, 0xcb35, 0x0168, 0xa867, 0x0103, 0xa87b,
+	0x0006, 0xa877, 0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c, 0x6c81,
+	0x080c, 0xcd1e, 0x009e, 0x080c, 0xae61, 0x080c, 0x968d, 0x0005,
+	0x080c, 0x9588, 0x080c, 0xcd3b, 0x090c, 0xb813, 0x080c, 0xae61,
+	0x080c, 0x968d, 0x0005, 0x0002, 0xbf5a, 0xbf58, 0xbf58, 0xbf58,
+	0xbf58, 0xbf58, 0xbf58, 0xbf58, 0xbf58, 0xbf58, 0xbf58, 0xbf71,
+	0xbf71, 0xbf71, 0xbf71, 0xbf58, 0xbf7b, 0xbf58, 0xbf71, 0xbf58,
+	0x080c, 0x0dd5, 0x0096, 0x080c, 0x9588, 0x6014, 0x2048, 0x2001,
+	0x1988, 0x2004, 0x6042, 0xa97c, 0xd1ac, 0x0140, 0x6003, 0x0004,
+	0xa87c, 0x9085, 0x0400, 0xa87e, 0x009e, 0x0005, 0x6003, 0x0002,
+	0x0cb8, 0x080c, 0x9588, 0x080c, 0xd248, 0x080c, 0xd24d, 0x6003,
+	0x000f, 0x0804, 0x968d, 0x080c, 0x9588, 0x080c, 0xae61, 0x0804,
+	0x968d, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a,
+	0x0005, 0xbf9d, 0xbf9d, 0xbf9d, 0xbf9d, 0xbf9d, 0xbf9f, 0xc07c,
+	0xbf9d, 0xc0b0, 0xbf9d, 0xbf9d, 0xbf9d, 0xbf9d, 0xbf9d, 0xbf9d,
+	0xbf9d, 0xbf9d, 0xbf9d, 0xbf9d, 0xc0b0, 0x080c, 0x0dd5, 0x00b6,
+	0x0096, 0x6114, 0x2148, 0x7644, 0x96b4, 0x0fff, 0x86ff, 0x1528,
+	0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xc06b, 0xa87b, 0x0000,
+	0xa867, 0x0103, 0xae76, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
+	0x9115, 0x190c, 0xc245, 0x080c, 0x6a9d, 0x6210, 0x2258, 0xba3c,
+	0x82ff, 0x0110, 0x8211, 0xba3e, 0x7044, 0xd0e4, 0x1904, 0xc04f,
+	0x080c, 0xae61, 0x009e, 0x00be, 0x0005, 0x968c, 0x0c00, 0x0150,
+	0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xc053, 0x7348, 0xab92,
+	0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0508, 0x9186,
+	0x0028, 0x1118, 0xa87b, 0x001c, 0x00e8, 0xd6dc, 0x01a0, 0xa87b,
+	0x0015, 0xa87c, 0xd0ac, 0x0170, 0xa938, 0xaa34, 0x2100, 0x9205,
+	0x0148, 0x7048, 0x9106, 0x1118, 0x704c, 0x9206, 0x0118, 0xa992,
+	0xaa8e, 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010,
+	0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0x901e, 0xd6c4, 0x01d8,
+	0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0x0804,
+	0xbfa6, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210,
+	0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025,
+	0x080c, 0xc730, 0x003e, 0xd6cc, 0x0904, 0xbfbb, 0x7154, 0xa98a,
+	0x81ff, 0x0904, 0xbfbb, 0x9192, 0x0021, 0x1278, 0x8304, 0x9098,
+	0x0018, 0x2011, 0x0029, 0x080c, 0xc730, 0x2011, 0x0205, 0x2013,
+	0x0000, 0x080c, 0xd1d5, 0x0804, 0xbfbb, 0xa868, 0xd0fc, 0x0120,
+	0x2009, 0x0020, 0xa98a, 0x0c50, 0x00a6, 0x2950, 0x080c, 0xc6cf,
+	0x00ae, 0x080c, 0xd1d5, 0x080c, 0xc720, 0x0804, 0xbfbd, 0x080c,
+	0xce2e, 0x0804, 0xbfca, 0xa87c, 0xd0ac, 0x0904, 0xbfd6, 0xa880,
+	0xd0bc, 0x1904, 0xbfd6, 0x7348, 0xa838, 0x9306, 0x11c8, 0x734c,
+	0xa834, 0x931e, 0x0904, 0xbfd6, 0xd6d4, 0x0190, 0xab38, 0x9305,
+	0x0904, 0xbfd6, 0x0068, 0xa87c, 0xd0ac, 0x0904, 0xbfae, 0xa838,
+	0xa934, 0x9105, 0x0904, 0xbfae, 0xa880, 0xd0bc, 0x1904, 0xbfae,
+	0x080c, 0xce68, 0x0804, 0xbfca, 0x0096, 0x00f6, 0x6003, 0x0003,
+	0x6007, 0x0043, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08,
+	0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0140, 0x6003, 0x0002, 0x00fe,
+	0x009e, 0x0005, 0x2130, 0x2228, 0x0058, 0x2400, 0xa9ac, 0x910a,
+	0x2300, 0xaab0, 0x9213, 0x2600, 0x9102, 0x2500, 0x9203, 0x0e90,
+	0xac36, 0xab3a, 0xae46, 0xad4a, 0x00fe, 0x6043, 0x0000, 0x2c10,
+	0x080c, 0x1bad, 0x080c, 0x9155, 0x080c, 0x97b9, 0x009e, 0x0005,
+	0x0005, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a,
+	0x0005, 0xc0cd, 0xc0cd, 0xc0cd, 0xc0cd, 0xc0cd, 0xc0cf, 0xc165,
+	0xc0cd, 0xc0cd, 0xc17c, 0xc208, 0xc0cd, 0xc0cd, 0xc0cd, 0xc0cd,
+	0xc21d, 0xc0cd, 0xc0cd, 0xc0cd, 0xc0cd, 0x080c, 0x0dd5, 0x0076,
+	0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114, 0x2150, 0x7644,
+	0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e, 0x6210, 0x00b6,
+	0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be, 0x86ff,
+	0x0904, 0xc160, 0x9694, 0xff00, 0x9284, 0x0c00, 0x0120, 0x7048,
+	0xb092, 0x704c, 0xb08e, 0x9284, 0x0300, 0x0904, 0xc160, 0x080c,
+	0x0fff, 0x090c, 0x0dd5, 0x2900, 0xb07a, 0xb77c, 0xc7cd, 0xb77e,
+	0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c, 0xa86e, 0xb070, 0xa872,
+	0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c, 0xab8e,
+	0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028, 0x1118,
+	0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038,
+	0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e,
+	0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c,
 	0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008,
-	0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xc716,
-	0x003e, 0xd6cc, 0x0904, 0xbfa1, 0x7154, 0xa98a, 0x81ff, 0x0904,
-	0xbfa1, 0x9192, 0x0021, 0x1278, 0x8304, 0x9098, 0x0018, 0x2011,
-	0x0029, 0x080c, 0xc716, 0x2011, 0x0205, 0x2013, 0x0000, 0x080c,
-	0xd1bb, 0x0804, 0xbfa1, 0xa868, 0xd0fc, 0x0120, 0x2009, 0x0020,
-	0xa98a, 0x0c50, 0x00a6, 0x2950, 0x080c, 0xc6b5, 0x00ae, 0x080c,
-	0xd1bb, 0x080c, 0xc706, 0x0804, 0xbfa3, 0x080c, 0xce14, 0x0804,
-	0xbfb0, 0xa87c, 0xd0ac, 0x0904, 0xbfbc, 0xa880, 0xd0bc, 0x1904,
-	0xbfbc, 0x7348, 0xa838, 0x9306, 0x11c8, 0x734c, 0xa834, 0x931e,
-	0x0904, 0xbfbc, 0xd6d4, 0x0190, 0xab38, 0x9305, 0x0904, 0xbfbc,
-	0x0068, 0xa87c, 0xd0ac, 0x0904, 0xbf94, 0xa838, 0xa934, 0x9105,
-	0x0904, 0xbf94, 0xa880, 0xd0bc, 0x1904, 0xbf94, 0x080c, 0xce4e,
-	0x0804, 0xbfb0, 0x0096, 0x00f6, 0x6003, 0x0003, 0x6007, 0x0043,
-	0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08, 0x6014, 0x2048,
-	0xa87c, 0xd0ac, 0x0140, 0x6003, 0x0002, 0x00fe, 0x009e, 0x0005,
-	0x2130, 0x2228, 0x0058, 0x2400, 0xa9ac, 0x910a, 0x2300, 0xaab0,
-	0x9213, 0x2600, 0x9102, 0x2500, 0x9203, 0x0e90, 0xac36, 0xab3a,
-	0xae46, 0xad4a, 0x00fe, 0x6043, 0x0000, 0x2c10, 0x080c, 0x1bad,
-	0x080c, 0x912c, 0x080c, 0x9790, 0x009e, 0x0005, 0x0005, 0x9182,
-	0x0054, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xc0b3,
-	0xc0b3, 0xc0b3, 0xc0b3, 0xc0b3, 0xc0b5, 0xc14b, 0xc0b3, 0xc0b3,
-	0xc162, 0xc1ee, 0xc0b3, 0xc0b3, 0xc0b3, 0xc0b3, 0xc203, 0xc0b3,
-	0xc0b3, 0xc0b3, 0xc0b3, 0x080c, 0x0dd5, 0x0076, 0x00a6, 0x00e6,
-	0x0096, 0x2071, 0x0260, 0x6114, 0x2150, 0x7644, 0xb676, 0x96b4,
-	0x0fff, 0xb77c, 0xc7e5, 0xb77e, 0x6210, 0x00b6, 0x2258, 0xba3c,
-	0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be, 0x86ff, 0x0904, 0xc146,
-	0x9694, 0xff00, 0x9284, 0x0c00, 0x0120, 0x7048, 0xb092, 0x704c,
-	0xb08e, 0x9284, 0x0300, 0x0904, 0xc146, 0x080c, 0x0fff, 0x090c,
-	0x0dd5, 0x2900, 0xb07a, 0xb77c, 0xc7cd, 0xb77e, 0xa867, 0x0103,
-	0xb068, 0xa86a, 0xb06c, 0xa86e, 0xb070, 0xa872, 0xae76, 0x968c,
-	0x0c00, 0x0120, 0x7348, 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff,
-	0x9186, 0x0002, 0x0180, 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c,
-	0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038, 0xd6d4, 0x0118,
-	0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e, 0xb080, 0xa882,
-	0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c, 0xab86, 0x83ff,
-	0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308,
-	0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xc716, 0x003e, 0xd6cc,
-	0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192, 0x0021, 0x1260,
-	0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xc716, 0x2011,
-	0x0205, 0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc, 0x0120, 0x2009,
-	0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c, 0xc6b5, 0x009e, 0x00ee,
-	0x00ae, 0x007e, 0x0005, 0x00f6, 0x00a6, 0x6003, 0x0003, 0x2079,
-	0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08, 0x6014, 0x2050, 0xb436,
-	0xb33a, 0xb646, 0xb54a, 0x00ae, 0x00fe, 0x2c10, 0x080c, 0x1bad,
-	0x0804, 0xa226, 0x6003, 0x0002, 0x6004, 0x9086, 0x0040, 0x11c8,
-	0x0096, 0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0160, 0x601c, 0xd084,
-	0x1130, 0x00f6, 0x2c00, 0x2078, 0x080c, 0x1725, 0x00fe, 0x6003,
-	0x0004, 0x0010, 0x6003, 0x0002, 0x009e, 0x080c, 0x955f, 0x080c,
-	0x9664, 0x0096, 0x2001, 0x1988, 0x2004, 0x6042, 0x080c, 0x9614,
-	0x080c, 0x9790, 0x6114, 0x2148, 0xa97c, 0xd1e4, 0x0904, 0xc1e9,
-	0xd1cc, 0x05a8, 0xa978, 0xa868, 0xd0fc, 0x0538, 0x0016, 0xa87c,
-	0x0006, 0xa880, 0x0006, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0019,
-	0x20a0, 0x810e, 0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184,
-	0xffc0, 0x9080, 0x0019, 0x2098, 0x0156, 0x20a9, 0x0020, 0x4003,
-	0x015e, 0x000e, 0xa882, 0x000e, 0xa87e, 0x001e, 0xa874, 0x0006,
-	0x2148, 0x080c, 0x0fb1, 0x001e, 0x0440, 0x0016, 0x080c, 0x0fb1,
-	0x009e, 0xa974, 0x0016, 0x080c, 0xc706, 0x001e, 0x00f0, 0xa867,
-	0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x0180, 0x9086,
-	0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd1dc, 0x0118, 0xa87b,
-	0x0015, 0x0038, 0xd1d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b,
-	0x0000, 0x0016, 0x080c, 0x6a95, 0x001e, 0xd1e4, 0x1120, 0x080c,
-	0xae47, 0x009e, 0x0005, 0x080c, 0xce14, 0x0cd8, 0x6004, 0x9086,
-	0x0040, 0x1120, 0x080c, 0x955f, 0x080c, 0x9664, 0x2019, 0x0001,
-	0x080c, 0xa59c, 0x6003, 0x0002, 0x080c, 0xd233, 0x080c, 0x9614,
-	0x080c, 0x9790, 0x0005, 0x6004, 0x9086, 0x0040, 0x1120, 0x080c,
-	0x955f, 0x080c, 0x9664, 0x2019, 0x0001, 0x080c, 0xa59c, 0x080c,
-	0x9614, 0x080c, 0x31bc, 0x080c, 0xd22b, 0x0096, 0x6114, 0x2148,
-	0x080c, 0xcb1b, 0x0150, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877,
-	0x0000, 0x080c, 0x6c79, 0x080c, 0xcd04, 0x009e, 0x080c, 0xae47,
-	0x080c, 0x9790, 0x0005, 0xa87b, 0x0015, 0xd1fc, 0x0180, 0xa87b,
-	0x0007, 0x8002, 0x8000, 0x810a, 0x9189, 0x0000, 0x0006, 0x0016,
-	0x2009, 0x1a7a, 0x2104, 0x8000, 0x200a, 0x001e, 0x000e, 0xa992,
-	0xa88e, 0x0005, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208,
-	0x000a, 0x0005, 0xc25e, 0xc25e, 0xc25e, 0xc25e, 0xc25e, 0xc260,
-	0xc25e, 0xc25e, 0xc306, 0xc25e, 0xc25e, 0xc25e, 0xc25e, 0xc25e,
-	0xc25e, 0xc25e, 0xc25e, 0xc25e, 0xc25e, 0xc437, 0x080c, 0x0dd5,
-	0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114, 0x2150,
-	0x7644, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e, 0x6210,
-	0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be,
-	0x86ff, 0x0904, 0xc2ff, 0x9694, 0xff00, 0x9284, 0x0c00, 0x0120,
-	0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300, 0x0904, 0xc2ff,
-	0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0xb676,
-	0x0c38, 0x080c, 0x0fff, 0x090c, 0x0dd5, 0x2900, 0xb07a, 0xb77c,
-	0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c,
-	0xa86e, 0xb070, 0xa872, 0x7044, 0x9084, 0xf000, 0x9635, 0xae76,
-	0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c, 0xab8e, 0x968c,
-	0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028, 0x1118, 0xa87b,
-	0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038, 0xd6d4,
-	0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e, 0xb080,
-	0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c, 0xab86,
-	0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036,
-	0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xc716, 0x003e,
-	0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192, 0x0021,
-	0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xc716,
-	0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc, 0x0120,
-	0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c, 0xc6b5, 0x080c,
-	0x1a3c, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x2001, 0x1988,
-	0x2004, 0x6042, 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940, 0x9105,
-	0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003, 0x0002, 0xa97c, 0xd1e4,
-	0x0904, 0xc432, 0x6043, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb800,
-	0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904, 0xc401, 0xa978, 0xa868,
-	0xd0fc, 0x0904, 0xc3c2, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006,
-	0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x0904,
-	0xc390, 0x9086, 0x0028, 0x1904, 0xc37c, 0xa87b, 0x001c, 0xb07b,
-	0x001c, 0x0804, 0xc398, 0x6024, 0xd0f4, 0x11d0, 0xa838, 0xaa34,
-	0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206, 0x1120, 0xa88c, 0xaa34,
-	0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148, 0xa9ac, 0xa834, 0x9102,
-	0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e, 0x6024, 0xc0f5, 0x6026,
-	0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000, 0xb83e, 0x00be, 0x9006,
-	0xa876, 0xa892, 0xa88e, 0xa87c, 0xc0e4, 0xa87e, 0xd0cc, 0x0140,
-	0xc0cc, 0xa87e, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fb1, 0x009e,
-	0x080c, 0xce4e, 0x0804, 0xc432, 0xd1dc, 0x0158, 0xa87b, 0x0015,
-	0xb07b, 0x0015, 0x080c, 0xd0de, 0x0118, 0xb174, 0xc1dc, 0xb176,
-	0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040,
-	0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc22b,
-	0xa87c, 0xb07e, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0019, 0x20a0, 0x20a9, 0x0020, 0x8a06, 0x8006,
-	0x8007, 0x9094, 0x003f, 0x22e0, 0x9084, 0xffc0, 0x9080, 0x0019,
-	0x2098, 0x4003, 0x00ae, 0x000e, 0xa882, 0x000e, 0xa87e, 0x080c,
-	0xd1bb, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c, 0x0fb1, 0x001e,
-	0x0804, 0xc42e, 0x0016, 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff,
-	0x90b6, 0x0002, 0x01e0, 0x9086, 0x0028, 0x1128, 0xa87b, 0x001c,
-	0xb07b, 0x001c, 0x00e0, 0xd1dc, 0x0158, 0xa87b, 0x0015, 0xb07b,
-	0x0015, 0x080c, 0xd0de, 0x0118, 0xb174, 0xc1dc, 0xb176, 0x0078,
-	0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040, 0xa87c,
-	0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc22b, 0xa890,
-	0xb092, 0xa88c, 0xb08e, 0xa87c, 0xb07e, 0x00ae, 0x080c, 0x0fb1,
-	0x009e, 0x080c, 0xd1bb, 0xa974, 0x0016, 0x080c, 0xc706, 0x001e,
-	0x0468, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6, 0x0002,
-	0x01b0, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00d0, 0xd1dc,
-	0x0148, 0xa87b, 0x0015, 0x080c, 0xd0de, 0x0118, 0xa974, 0xc1dc,
-	0xa976, 0x0078, 0xd1d4, 0x0118, 0xa87b, 0x0007, 0x0050, 0xa87b,
-	0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c,
-	0xc22b, 0xa974, 0x0016, 0x080c, 0x6a95, 0x001e, 0xd1e4, 0x1120,
-	0x080c, 0xae47, 0x009e, 0x0005, 0x080c, 0xce14, 0x0cd8, 0x6114,
-	0x0096, 0x2148, 0xa97c, 0xd1e4, 0x190c, 0x1a4a, 0x009e, 0x0005,
-	0x080c, 0x955f, 0x0010, 0x080c, 0x9614, 0x080c, 0xcb1b, 0x01f0,
-	0x0096, 0x6114, 0x2148, 0x080c, 0xcd21, 0x1118, 0x080c, 0xb7f9,
-	0x00a0, 0xa867, 0x0103, 0x2009, 0x180c, 0x210c, 0xd18c, 0x11b8,
-	0xd184, 0x1190, 0x6108, 0xa97a, 0x918e, 0x0029, 0x1110, 0x080c,
-	0xe8e7, 0xa877, 0x0000, 0x080c, 0x6c79, 0x009e, 0x080c, 0xae47,
-	0x080c, 0x9664, 0x0804, 0x9790, 0xa87b, 0x0004, 0x0c90, 0xa87b,
-	0x0004, 0x0c78, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208,
-	0x000a, 0x0005, 0xc48e, 0xc48e, 0xc48e, 0xc48e, 0xc48e, 0xc490,
-	0xc48e, 0xc48e, 0xc48e, 0xc48e, 0xc48e, 0xc48e, 0xc48e, 0xc48e,
-	0xc48e, 0xc48e, 0xc48e, 0xc48e, 0xc48e, 0xc48e, 0x080c, 0x0dd5,
-	0x080c, 0x56d8, 0x01f8, 0x6014, 0x7144, 0x918c, 0x0fff, 0x9016,
-	0xd1c4, 0x0118, 0x7264, 0x9294, 0x00ff, 0x0096, 0x904d, 0x0188,
-	0xa87b, 0x0000, 0xa864, 0x9086, 0x0139, 0x0128, 0xa867, 0x0103,
-	0xa976, 0xaa96, 0x0030, 0xa897, 0x4000, 0xa99a, 0xaa9e, 0x080c,
-	0x6c79, 0x009e, 0x0804, 0xae47, 0x9182, 0x0085, 0x0002, 0xc4c6,
-	0xc4c4, 0xc4c4, 0xc4d2, 0xc4c4, 0xc4c4, 0xc4c4, 0xc4c4, 0xc4c4,
-	0xc4c4, 0xc4c4, 0xc4c4, 0xc4c4, 0x080c, 0x0dd5, 0x6003, 0x0001,
-	0x6106, 0x080c, 0x90c7, 0x0126, 0x2091, 0x8000, 0x080c, 0x9664,
-	0x012e, 0x0005, 0x0026, 0x0056, 0x00d6, 0x00e6, 0x2071, 0x0260,
-	0x7224, 0x6216, 0x7220, 0x080c, 0xcb09, 0x01a0, 0x2268, 0x6800,
-	0x9086, 0x0000, 0x0178, 0x6010, 0x6d10, 0x952e, 0x1158, 0x00c6,
-	0x2d60, 0x080c, 0xc741, 0x00ce, 0x0128, 0x6803, 0x0002, 0x6007,
-	0x0086, 0x0010, 0x6007, 0x0087, 0x6003, 0x0001, 0x080c, 0x90c7,
-	0x080c, 0x9664, 0x9280, 0x0004, 0x00b6, 0x2058, 0xb800, 0x00be,
-	0xd0bc, 0x0140, 0x6824, 0xd0ec, 0x0128, 0x00c6, 0x2260, 0x080c,
-	0xce4e, 0x00ce, 0x00ee, 0x00de, 0x005e, 0x002e, 0x0005, 0x9186,
-	0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dd5, 0x908a,
-	0x0092, 0x1a0c, 0x0dd5, 0x9082, 0x0085, 0x00e2, 0x9186, 0x0027,
-	0x0120, 0x9186, 0x0014, 0x190c, 0x0dd5, 0x080c, 0x955f, 0x0096,
-	0x6014, 0x2048, 0x080c, 0xcb1b, 0x0140, 0xa867, 0x0103, 0xa877,
-	0x0000, 0xa87b, 0x0029, 0x080c, 0x6c79, 0x009e, 0x080c, 0xae78,
-	0x0804, 0x9664, 0xc547, 0xc549, 0xc549, 0xc547, 0xc547, 0xc547,
-	0xc547, 0xc547, 0xc547, 0xc547, 0xc547, 0xc547, 0xc547, 0x080c,
-	0x0dd5, 0x080c, 0x955f, 0x080c, 0xae78, 0x080c, 0x9664, 0x0005,
-	0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0085, 0x2008, 0x04b8,
-	0x9186, 0x0027, 0x11f8, 0x080c, 0x955f, 0x080c, 0x31bc, 0x080c,
-	0xd22b, 0x0096, 0x6014, 0x2048, 0x080c, 0xcb1b, 0x0150, 0xa867,
-	0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x6c79, 0x080c,
-	0xcd04, 0x009e, 0x080c, 0xae47, 0x080c, 0x9664, 0x0005, 0x080c,
-	0xaedd, 0x0ce0, 0x9186, 0x0014, 0x1dd0, 0x080c, 0x955f, 0x0096,
-	0x6014, 0x2048, 0x080c, 0xcb1b, 0x0d60, 0xa867, 0x0103, 0xa877,
-	0x0000, 0xa87b, 0x0006, 0xa880, 0xc0ec, 0xa882, 0x08f0, 0x0002,
-	0xc59f, 0xc59d, 0xc59d, 0xc59d, 0xc59d, 0xc59d, 0xc5b7, 0xc59d,
-	0xc59d, 0xc59d, 0xc59d, 0xc59d, 0xc59d, 0x080c, 0x0dd5, 0x080c,
-	0x955f, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
-	0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001, 0x1987,
-	0x2004, 0x601a, 0x6003, 0x000c, 0x080c, 0x9664, 0x0005, 0x080c,
-	0x955f, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
-	0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001, 0x1987,
-	0x2004, 0x601a, 0x6003, 0x000e, 0x080c, 0x9664, 0x0005, 0x9182,
-	0x0092, 0x1220, 0x9182, 0x0085, 0x0208, 0x0012, 0x0804, 0xaedd,
-	0xc5e5, 0xc5e5, 0xc5e5, 0xc5e5, 0xc5e7, 0xc634, 0xc5e5, 0xc5e5,
-	0xc5e5, 0xc5e5, 0xc5e5, 0xc5e5, 0xc5e5, 0x080c, 0x0dd5, 0x0096,
-	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0168, 0x6034,
+	0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xc730,
+	0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192,
+	0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c,
+	0xc730, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc,
+	0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c, 0xc6cf,
+	0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x00f6, 0x00a6, 0x6003,
+	0x0003, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08, 0x6014,
+	0x2050, 0xb436, 0xb33a, 0xb646, 0xb54a, 0x00ae, 0x00fe, 0x2c10,
+	0x080c, 0x1bad, 0x0804, 0xa240, 0x6003, 0x0002, 0x6004, 0x9086,
+	0x0040, 0x11c8, 0x0096, 0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0160,
+	0x601c, 0xd084, 0x1130, 0x00f6, 0x2c00, 0x2078, 0x080c, 0x1725,
+	0x00fe, 0x6003, 0x0004, 0x0010, 0x6003, 0x0002, 0x009e, 0x080c,
+	0x9588, 0x080c, 0x968d, 0x0096, 0x2001, 0x1988, 0x2004, 0x6042,
+	0x080c, 0x963d, 0x080c, 0x97b9, 0x6114, 0x2148, 0xa97c, 0xd1e4,
+	0x0904, 0xc203, 0xd1cc, 0x05a8, 0xa978, 0xa868, 0xd0fc, 0x0538,
+	0x0016, 0xa87c, 0x0006, 0xa880, 0x0006, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0019, 0x20a0, 0x810e, 0x810e, 0x810f, 0x9184, 0x003f,
+	0x20e0, 0x9184, 0xffc0, 0x9080, 0x0019, 0x2098, 0x0156, 0x20a9,
+	0x0020, 0x4003, 0x015e, 0x000e, 0xa882, 0x000e, 0xa87e, 0x001e,
+	0xa874, 0x0006, 0x2148, 0x080c, 0x0fb1, 0x001e, 0x0440, 0x0016,
+	0x080c, 0x0fb1, 0x009e, 0xa974, 0x0016, 0x080c, 0xc720, 0x001e,
+	0x00f0, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6, 0x0002,
+	0x0180, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd1dc,
+	0x0118, 0xa87b, 0x0015, 0x0038, 0xd1d4, 0x0118, 0xa87b, 0x0007,
+	0x0010, 0xa87b, 0x0000, 0x0016, 0x080c, 0x6a9d, 0x001e, 0xd1e4,
+	0x1120, 0x080c, 0xae61, 0x009e, 0x0005, 0x080c, 0xce2e, 0x0cd8,
+	0x6004, 0x9086, 0x0040, 0x1120, 0x080c, 0x9588, 0x080c, 0x968d,
+	0x2019, 0x0001, 0x080c, 0xa5b6, 0x6003, 0x0002, 0x080c, 0xd24d,
+	0x080c, 0x963d, 0x080c, 0x97b9, 0x0005, 0x6004, 0x9086, 0x0040,
+	0x1120, 0x080c, 0x9588, 0x080c, 0x968d, 0x2019, 0x0001, 0x080c,
+	0xa5b6, 0x080c, 0x963d, 0x080c, 0x31bf, 0x080c, 0xd245, 0x0096,
+	0x6114, 0x2148, 0x080c, 0xcb35, 0x0150, 0xa867, 0x0103, 0xa87b,
+	0x0029, 0xa877, 0x0000, 0x080c, 0x6c81, 0x080c, 0xcd1e, 0x009e,
+	0x080c, 0xae61, 0x080c, 0x97b9, 0x0005, 0xa87b, 0x0015, 0xd1fc,
+	0x0180, 0xa87b, 0x0007, 0x8002, 0x8000, 0x810a, 0x9189, 0x0000,
+	0x0006, 0x0016, 0x2009, 0x1a7a, 0x2104, 0x8000, 0x200a, 0x001e,
+	0x000e, 0xa992, 0xa88e, 0x0005, 0x9182, 0x0054, 0x1220, 0x9182,
+	0x0040, 0x0208, 0x000a, 0x0005, 0xc278, 0xc278, 0xc278, 0xc278,
+	0xc278, 0xc27a, 0xc278, 0xc278, 0xc320, 0xc278, 0xc278, 0xc278,
+	0xc278, 0xc278, 0xc278, 0xc278, 0xc278, 0xc278, 0xc278, 0xc451,
+	0x080c, 0x0dd5, 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260,
+	0x6114, 0x2150, 0x7644, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5,
+	0xb77e, 0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211,
+	0xba3e, 0x00be, 0x86ff, 0x0904, 0xc319, 0x9694, 0xff00, 0x9284,
+	0x0c00, 0x0120, 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300,
+	0x0904, 0xc319, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118,
+	0xc6c4, 0xb676, 0x0c38, 0x080c, 0x0fff, 0x090c, 0x0dd5, 0x2900,
+	0xb07a, 0xb77c, 0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103, 0xb068,
+	0xa86a, 0xb06c, 0xa86e, 0xb070, 0xa872, 0x7044, 0x9084, 0xf000,
+	0x9635, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c,
+	0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028,
+	0x1118, 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015,
+	0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000,
+	0xaf7e, 0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190,
+	0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019,
+	0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c,
+	0xc730, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8,
+	0x9192, 0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029,
+	0x080c, 0xc730, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068,
+	0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c,
+	0xc6cf, 0x080c, 0x1a3c, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005,
+	0x2001, 0x1988, 0x2004, 0x6042, 0x0096, 0x6114, 0x2148, 0xa83c,
+	0xa940, 0x9105, 0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003, 0x0002,
+	0xa97c, 0xd1e4, 0x0904, 0xc44c, 0x6043, 0x0000, 0x6010, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904, 0xc41b,
+	0xa978, 0xa868, 0xd0fc, 0x0904, 0xc3dc, 0x0016, 0xa87c, 0x0006,
+	0xa880, 0x0006, 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6,
+	0x0002, 0x0904, 0xc3aa, 0x9086, 0x0028, 0x1904, 0xc396, 0xa87b,
+	0x001c, 0xb07b, 0x001c, 0x0804, 0xc3b2, 0x6024, 0xd0f4, 0x11d0,
+	0xa838, 0xaa34, 0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206, 0x1120,
+	0xa88c, 0xaa34, 0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148, 0xa9ac,
+	0xa834, 0x9102, 0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e, 0x6024,
+	0xc0f5, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000, 0xb83e,
+	0x00be, 0x9006, 0xa876, 0xa892, 0xa88e, 0xa87c, 0xc0e4, 0xa87e,
+	0xd0cc, 0x0140, 0xc0cc, 0xa87e, 0x0096, 0xa878, 0x2048, 0x080c,
+	0x0fb1, 0x009e, 0x080c, 0xce68, 0x0804, 0xc44c, 0xd1dc, 0x0158,
+	0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xd0f8, 0x0118, 0xb174,
+	0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b,
+	0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115,
+	0x190c, 0xc245, 0xa87c, 0xb07e, 0xa890, 0xb092, 0xa88c, 0xb08e,
+	0xa860, 0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x20a9, 0x0020,
+	0x8a06, 0x8006, 0x8007, 0x9094, 0x003f, 0x22e0, 0x9084, 0xffc0,
+	0x9080, 0x0019, 0x2098, 0x4003, 0x00ae, 0x000e, 0xa882, 0x000e,
+	0xa87e, 0x080c, 0xd1d5, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c,
+	0x0fb1, 0x001e, 0x0804, 0xc448, 0x0016, 0x00a6, 0x2150, 0xb174,
+	0x9184, 0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086, 0x0028, 0x1128,
+	0xa87b, 0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc, 0x0158, 0xa87b,
+	0x0015, 0xb07b, 0x0015, 0x080c, 0xd0f8, 0x0118, 0xb174, 0xc1dc,
+	0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007,
+	0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c,
+	0xc245, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c, 0xb07e, 0x00ae,
+	0x080c, 0x0fb1, 0x009e, 0x080c, 0xd1d5, 0xa974, 0x0016, 0x080c,
+	0xc720, 0x001e, 0x0468, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff,
+	0x90b6, 0x0002, 0x01b0, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c,
+	0x00d0, 0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c, 0xd0f8, 0x0118,
+	0xa974, 0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118, 0xa87b, 0x0007,
+	0x0050, 0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
+	0x9115, 0x190c, 0xc245, 0xa974, 0x0016, 0x080c, 0x6a9d, 0x001e,
+	0xd1e4, 0x1120, 0x080c, 0xae61, 0x009e, 0x0005, 0x080c, 0xce2e,
+	0x0cd8, 0x6114, 0x0096, 0x2148, 0xa97c, 0xd1e4, 0x190c, 0x1a4a,
+	0x009e, 0x0005, 0x080c, 0x9588, 0x0010, 0x080c, 0x963d, 0x080c,
+	0xcb35, 0x01f0, 0x0096, 0x6114, 0x2148, 0x080c, 0xcd3b, 0x1118,
+	0x080c, 0xb813, 0x00a0, 0xa867, 0x0103, 0x2009, 0x180c, 0x210c,
+	0xd18c, 0x11b8, 0xd184, 0x1190, 0x6108, 0xa97a, 0x918e, 0x0029,
+	0x1110, 0x080c, 0xe908, 0xa877, 0x0000, 0x080c, 0x6c81, 0x009e,
+	0x080c, 0xae61, 0x080c, 0x968d, 0x0804, 0x97b9, 0xa87b, 0x0004,
+	0x0c90, 0xa87b, 0x0004, 0x0c78, 0x9182, 0x0054, 0x1220, 0x9182,
+	0x0040, 0x0208, 0x000a, 0x0005, 0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8,
+	0xc4a8, 0xc4aa, 0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8,
+	0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8, 0xc4a8,
+	0x080c, 0x0dd5, 0x080c, 0x56d7, 0x01f8, 0x6014, 0x7144, 0x918c,
+	0x0fff, 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294, 0x00ff, 0x0096,
+	0x904d, 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086, 0x0139, 0x0128,
+	0xa867, 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897, 0x4000, 0xa99a,
+	0xaa9e, 0x080c, 0x6c81, 0x009e, 0x0804, 0xae61, 0x9182, 0x0085,
+	0x0002, 0xc4e0, 0xc4de, 0xc4de, 0xc4ec, 0xc4de, 0xc4de, 0xc4de,
+	0xc4de, 0xc4de, 0xc4de, 0xc4de, 0xc4de, 0xc4de, 0x080c, 0x0dd5,
+	0x6003, 0x0001, 0x6106, 0x080c, 0x90f0, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x968d, 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6, 0x00e6,
+	0x2071, 0x0260, 0x7224, 0x6216, 0x7220, 0x080c, 0xcb23, 0x01a0,
+	0x2268, 0x6800, 0x9086, 0x0000, 0x0178, 0x6010, 0x6d10, 0x952e,
+	0x1158, 0x00c6, 0x2d60, 0x080c, 0xc75b, 0x00ce, 0x0128, 0x6803,
+	0x0002, 0x6007, 0x0086, 0x0010, 0x6007, 0x0087, 0x6003, 0x0001,
+	0x080c, 0x90f0, 0x080c, 0x968d, 0x9280, 0x0004, 0x00b6, 0x2058,
+	0xb800, 0x00be, 0xd0bc, 0x0140, 0x6824, 0xd0ec, 0x0128, 0x00c6,
+	0x2260, 0x080c, 0xce68, 0x00ce, 0x00ee, 0x00de, 0x005e, 0x002e,
+	0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c,
+	0x0dd5, 0x908a, 0x0092, 0x1a0c, 0x0dd5, 0x9082, 0x0085, 0x00e2,
+	0x9186, 0x0027, 0x0120, 0x9186, 0x0014, 0x190c, 0x0dd5, 0x080c,
+	0x9588, 0x0096, 0x6014, 0x2048, 0x080c, 0xcb35, 0x0140, 0xa867,
+	0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x6c81, 0x009e,
+	0x080c, 0xae92, 0x0804, 0x968d, 0xc561, 0xc563, 0xc563, 0xc561,
+	0xc561, 0xc561, 0xc561, 0xc561, 0xc561, 0xc561, 0xc561, 0xc561,
+	0xc561, 0x080c, 0x0dd5, 0x080c, 0x9588, 0x080c, 0xae92, 0x080c,
+	0x968d, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0085,
+	0x2008, 0x04b8, 0x9186, 0x0027, 0x11f8, 0x080c, 0x9588, 0x080c,
+	0x31bf, 0x080c, 0xd245, 0x0096, 0x6014, 0x2048, 0x080c, 0xcb35,
+	0x0150, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c,
+	0x6c81, 0x080c, 0xcd1e, 0x009e, 0x080c, 0xae61, 0x080c, 0x968d,
+	0x0005, 0x080c, 0xaef7, 0x0ce0, 0x9186, 0x0014, 0x1dd0, 0x080c,
+	0x9588, 0x0096, 0x6014, 0x2048, 0x080c, 0xcb35, 0x0d60, 0xa867,
+	0x0103, 0xa877, 0x0000, 0xa87b, 0x0006, 0xa880, 0xc0ec, 0xa882,
+	0x08f0, 0x0002, 0xc5b9, 0xc5b7, 0xc5b7, 0xc5b7, 0xc5b7, 0xc5b7,
+	0xc5d1, 0xc5b7, 0xc5b7, 0xc5b7, 0xc5b7, 0xc5b7, 0xc5b7, 0x080c,
+	0x0dd5, 0x080c, 0x9588, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186,
+	0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010,
+	0x2001, 0x1987, 0x2004, 0x601a, 0x6003, 0x000c, 0x080c, 0x968d,
+	0x0005, 0x080c, 0x9588, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186,
+	0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010,
+	0x2001, 0x1987, 0x2004, 0x601a, 0x6003, 0x000e, 0x080c, 0x968d,
+	0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208, 0x0012,
+	0x0804, 0xaef7, 0xc5ff, 0xc5ff, 0xc5ff, 0xc5ff, 0xc601, 0xc64e,
+	0xc5ff, 0xc5ff, 0xc5ff, 0xc5ff, 0xc5ff, 0xc5ff, 0xc5ff, 0x080c,
+	0x0dd5, 0x0096, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
+	0x0168, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
+	0x9186, 0x0035, 0x1118, 0x009e, 0x0804, 0xc662, 0x080c, 0xcb35,
+	0x1118, 0x080c, 0xcd1e, 0x0068, 0x6014, 0x2048, 0xa87c, 0xd0e4,
+	0x1110, 0x080c, 0xcd1e, 0xa867, 0x0103, 0x080c, 0xd210, 0x080c,
+	0x6c81, 0x00d6, 0x2c68, 0x080c, 0xae0b, 0x01d0, 0x6003, 0x0001,
+	0x6007, 0x001e, 0x600b, 0xffff, 0x2009, 0x026e, 0x210c, 0x613a,
+	0x2009, 0x026f, 0x210c, 0x613e, 0x6910, 0x6112, 0x080c, 0xcfaa,
+	0x6954, 0x6156, 0x6023, 0x0001, 0x080c, 0x90f0, 0x080c, 0x968d,
+	0x2d60, 0x00de, 0x080c, 0xae61, 0x009e, 0x0005, 0x6010, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0bc, 0x05a0, 0x6034, 0x908c, 0xff00,
+	0x810f, 0x9186, 0x0035, 0x0130, 0x9186, 0x001e, 0x0118, 0x9186,
+	0x0039, 0x1538, 0x00d6, 0x2c68, 0x080c, 0xd1a8, 0x11f0, 0x080c,
+	0xae0b, 0x01d8, 0x6106, 0x6003, 0x0001, 0x6023, 0x0001, 0x6910,
+	0x6112, 0x692c, 0x612e, 0x6930, 0x6132, 0x6934, 0x918c, 0x00ff,
+	0x6136, 0x6938, 0x613a, 0x693c, 0x613e, 0x6954, 0x6156, 0x080c,
+	0xcfaa, 0x080c, 0x90f0, 0x080c, 0x968d, 0x2d60, 0x00de, 0x0804,
+	0xae61, 0x0096, 0x6014, 0x2048, 0x080c, 0xcb35, 0x01c8, 0xa867,
+	0x0103, 0xa880, 0xd0b4, 0x0128, 0xc0ec, 0xa882, 0xa87b, 0x0006,
+	0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005,
+	0x080c, 0xce2a, 0xa877, 0x0000, 0x080c, 0x6c81, 0x080c, 0xcd1e,
+	0x009e, 0x0804, 0xae61, 0x0016, 0x0096, 0x6014, 0x2048, 0x080c,
+	0xcb35, 0x0140, 0xa867, 0x0103, 0xa87b, 0x0028, 0xa877, 0x0000,
+	0x080c, 0x6c81, 0x009e, 0x001e, 0x9186, 0x0013, 0x0148, 0x9186,
+	0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xaef7, 0x0030,
+	0x080c, 0x9588, 0x080c, 0xae92, 0x080c, 0x968d, 0x0005, 0x0056,
+	0x0066, 0x0096, 0x00a6, 0x2029, 0x0001, 0x9182, 0x0101, 0x1208,
+	0x0010, 0x2009, 0x0100, 0x2130, 0x8304, 0x9098, 0x0018, 0x2009,
+	0x0020, 0x2011, 0x0029, 0x080c, 0xc730, 0x96b2, 0x0020, 0xb004,
+	0x904d, 0x0110, 0x080c, 0x0fb1, 0x080c, 0x0fff, 0x0520, 0x8528,
+	0xa867, 0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d,
+	0x1228, 0x2608, 0x2011, 0x001b, 0x0499, 0x00a8, 0x96b2, 0x003c,
+	0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x0451, 0x0c28, 0x2001,
+	0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566,
+	0x95ac, 0x0000, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae,
+	0x852f, 0x95ad, 0x0003, 0xb566, 0x009e, 0x006e, 0x005e, 0x0005,
+	0x00a6, 0x89ff, 0x0158, 0xa804, 0x9055, 0x0130, 0xa807, 0x0000,
+	0x080c, 0x6c81, 0x2a48, 0x0cb8, 0x080c, 0x6c81, 0x00ae, 0x0005,
+	0x00f6, 0x2079, 0x0200, 0x7814, 0x9085, 0x0080, 0x7816, 0xd184,
+	0x0108, 0x8108, 0x810c, 0x20a9, 0x0001, 0xa860, 0x20e8, 0xa85c,
+	0x9200, 0x20a0, 0x20e1, 0x0000, 0x2300, 0x9e00, 0x2098, 0x4003,
+	0x8318, 0x9386, 0x0020, 0x1148, 0x2018, 0x2300, 0x9e00, 0x2098,
+	0x7814, 0x8000, 0x9085, 0x0080, 0x7816, 0x8109, 0x1d80, 0x7817,
+	0x0000, 0x00fe, 0x0005, 0x0066, 0x0126, 0x2091, 0x8000, 0x2031,
+	0x0001, 0x6020, 0x9084, 0x000f, 0x0083, 0x012e, 0x006e, 0x0005,
+	0x0126, 0x2091, 0x8000, 0x0066, 0x2031, 0x0000, 0x6020, 0x9084,
+	0x000f, 0x001b, 0x006e, 0x012e, 0x0005, 0xc796, 0xc796, 0xc791,
+	0xc7b8, 0xc784, 0xc791, 0xc7b8, 0xc791, 0xc784, 0x8ed9, 0xc791,
+	0xc791, 0xc791, 0xc784, 0xc784, 0x080c, 0x0dd5, 0x0036, 0x2019,
+	0x0010, 0x080c, 0xe134, 0x6023, 0x0006, 0x6003, 0x0007, 0x003e,
+	0x0005, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x0096, 0x86ff,
+	0x11d8, 0x6014, 0x2048, 0x080c, 0xcb35, 0x01c0, 0xa864, 0x9086,
+	0x0139, 0x1128, 0xa87b, 0x0005, 0xa883, 0x0000, 0x0028, 0x900e,
+	0x2001, 0x0005, 0x080c, 0x6ec0, 0x080c, 0xce2a, 0x080c, 0x6c75,
+	0x080c, 0xae92, 0x9085, 0x0001, 0x009e, 0x0005, 0x9006, 0x0ce0,
+	0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x0002, 0xc7ce, 0xc7fc,
+	0xc7d0, 0xc81d, 0xc7f7, 0xc7ce, 0xc791, 0xc796, 0xc796, 0xc791,
+	0xc791, 0xc791, 0xc791, 0xc791, 0xc791, 0xc791, 0x080c, 0x0dd5,
+	0x86ff, 0x1510, 0x6020, 0x9086, 0x0006, 0x01f0, 0x0096, 0x6014,
+	0x2048, 0x080c, 0xcb35, 0x0158, 0xa87c, 0xd0cc, 0x0130, 0x0096,
+	0xa878, 0x2048, 0x080c, 0x0fb1, 0x009e, 0x080c, 0xce2a, 0x009e,
+	0x080c, 0xd1ea, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
+	0x080c, 0x90f0, 0x080c, 0x968d, 0x9085, 0x0001, 0x0005, 0x0066,
+	0x080c, 0x1a5e, 0x006e, 0x08a0, 0x00e6, 0x2071, 0x19e7, 0x7024,
+	0x9c06, 0x1120, 0x080c, 0xa540, 0x00ee, 0x0850, 0x6020, 0x9084,
+	0x000f, 0x9086, 0x0006, 0x1150, 0x0086, 0x0096, 0x2049, 0x0001,
+	0x2c40, 0x080c, 0xa69c, 0x009e, 0x008e, 0x0010, 0x080c, 0xa43d,
+	0x00ee, 0x1904, 0xc7d0, 0x0804, 0xc791, 0x0036, 0x00e6, 0x2071,
+	0x19e7, 0x703c, 0x9c06, 0x1138, 0x901e, 0x080c, 0xa5b6, 0x00ee,
+	0x003e, 0x0804, 0xc7d0, 0x080c, 0xa7cc, 0x00ee, 0x003e, 0x1904,
+	0xc7d0, 0x0804, 0xc791, 0x00c6, 0x6020, 0x9084, 0x000f, 0x0013,
+	0x00ce, 0x0005, 0xc850, 0xc919, 0xca80, 0xc85a, 0xae92, 0xc850,
+	0xe126, 0xd252, 0xc919, 0x8eab, 0xcaff, 0xc849, 0xc849, 0xc849,
+	0xc849, 0x080c, 0x0dd5, 0x080c, 0xcd3b, 0x1110, 0x080c, 0xb813,
+	0x0005, 0x080c, 0x9588, 0x080c, 0x968d, 0x0804, 0xae61, 0x601b,
+	0x0001, 0x0005, 0x080c, 0xcb35, 0x0130, 0x6014, 0x0096, 0x2048,
+	0x2c00, 0xa896, 0x009e, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5,
+	0x0002, 0xc879, 0xc87b, 0xc89f, 0xc8b3, 0xc8d7, 0xc879, 0xc850,
+	0xc850, 0xc850, 0xc8b3, 0xc8b3, 0xc879, 0xc879, 0xc879, 0xc879,
+	0xc8bd, 0x080c, 0x0dd5, 0x00e6, 0x6014, 0x0096, 0x2048, 0xa880,
+	0xc0b5, 0xa882, 0x009e, 0x2071, 0x19e7, 0x7024, 0x9c06, 0x01a0,
+	0x080c, 0xa43d, 0x080c, 0xd1ea, 0x6007, 0x0085, 0x6003, 0x000b,
+	0x6023, 0x0002, 0x2001, 0x1987, 0x2004, 0x601a, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x00ee, 0x0005, 0x601b, 0x0001, 0x0cd8, 0x0096,
+	0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x080c, 0xd1ea,
+	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x0005, 0x0096, 0x601b, 0x0001, 0x6014, 0x2048,
+	0xa880, 0xc0b5, 0xa882, 0x009e, 0x0005, 0x080c, 0x56d7, 0x01a8,
+	0x6014, 0x0096, 0x904d, 0x0180, 0xa864, 0xa867, 0x0103, 0xa87b,
+	0x0006, 0x9086, 0x0139, 0x1140, 0xa867, 0x0139, 0xa897, 0x4005,
+	0xa89b, 0x0004, 0x080c, 0x6c81, 0x009e, 0x0804, 0xae61, 0x6014,
+	0x0096, 0x904d, 0x05c8, 0xa97c, 0xd1e4, 0x05b0, 0x2001, 0x180f,
+	0x2004, 0xd0c4, 0x0110, 0x009e, 0x0005, 0xa884, 0x009e, 0x8003,
+	0x800b, 0x810b, 0x9108, 0x611a, 0x2001, 0x0030, 0x2c08, 0x080c,
+	0x15ee, 0x2001, 0x030c, 0x2004, 0x9086, 0x0041, 0x11a0, 0x6014,
+	0x0096, 0x904d, 0x090c, 0x0dd5, 0xa880, 0xd0f4, 0x1130, 0xc0f5,
+	0xa882, 0x009e, 0x601b, 0x0002, 0x0070, 0x009e, 0x2001, 0x0037,
+	0x2c08, 0x080c, 0x15ee, 0x6000, 0x9086, 0x0004, 0x1120, 0x2009,
+	0x0048, 0x080c, 0xaedc, 0x0005, 0x009e, 0x080c, 0x1a5e, 0x0804,
+	0xc89f, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x000b, 0x0005,
+	0xc930, 0xc857, 0xc932, 0xc930, 0xc932, 0xc932, 0xc851, 0xc930,
+	0xc84b, 0xc84b, 0xc930, 0xc930, 0xc930, 0xc930, 0xc930, 0xc930,
+	0x080c, 0x0dd5, 0x6010, 0x00b6, 0x2058, 0xb804, 0x9084, 0x00ff,
+	0x00be, 0x908a, 0x000c, 0x1a0c, 0x0dd5, 0x00b6, 0x0013, 0x00be,
+	0x0005, 0xc94d, 0xca1a, 0xc94f, 0xc98f, 0xc94f, 0xc98f, 0xc94f,
+	0xc95d, 0xc94d, 0xc98f, 0xc94d, 0xc97e, 0x080c, 0x0dd5, 0x6004,
+	0x908e, 0x0016, 0x05c0, 0x908e, 0x0004, 0x05a8, 0x908e, 0x0002,
+	0x0590, 0x908e, 0x0052, 0x0904, 0xca16, 0x6004, 0x080c, 0xcd3b,
+	0x0904, 0xca33, 0x908e, 0x0004, 0x1110, 0x080c, 0x31e8, 0x908e,
+	0x0021, 0x0904, 0xca37, 0x908e, 0x0022, 0x0904, 0xca7b, 0x908e,
+	0x003d, 0x0904, 0xca37, 0x908e, 0x0039, 0x0904, 0xca3b, 0x908e,
+	0x0035, 0x0904, 0xca3b, 0x908e, 0x001e, 0x0178, 0x908e, 0x0001,
+	0x1140, 0x6010, 0x2058, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006,
+	0x0110, 0x080c, 0x31bf, 0x080c, 0xb813, 0x0804, 0xae92, 0x00c6,
+	0x00d6, 0x6104, 0x9186, 0x0016, 0x0904, 0xca07, 0x9186, 0x0002,
+	0x1904, 0xc9dc, 0x2001, 0x1837, 0x2004, 0xd08c, 0x11c8, 0x080c,
+	0x73bc, 0x11b0, 0x080c, 0xd230, 0x0138, 0x080c, 0x73df, 0x1120,
+	0x080c, 0x72cc, 0x0804, 0xca64, 0x2001, 0x197d, 0x2003, 0x0001,
+	0x2001, 0x1800, 0x2003, 0x0001, 0x080c, 0x72ee, 0x0804, 0xca64,
+	0x6010, 0x2058, 0x2001, 0x1837, 0x2004, 0xd0ac, 0x1904, 0xca64,
+	0xb8a0, 0x9084, 0xff80, 0x1904, 0xca64, 0xb840, 0x9084, 0x00ff,
+	0x9005, 0x0190, 0x8001, 0xb842, 0x6017, 0x0000, 0x6023, 0x0007,
+	0x601b, 0x0398, 0x6043, 0x0000, 0x080c, 0xae0b, 0x0128, 0x2b00,
+	0x6012, 0x6023, 0x0001, 0x0458, 0x00de, 0x00ce, 0x6004, 0x908e,
+	0x0002, 0x11a0, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1170,
+	0x2009, 0x1837, 0x2104, 0xc085, 0x200a, 0x00e6, 0x2071, 0x1800,
+	0x080c, 0x5fad, 0x00ee, 0x080c, 0xb813, 0x0030, 0x080c, 0xb813,
+	0x080c, 0x31bf, 0x080c, 0xd245, 0x00e6, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x31e8, 0x012e, 0x00ee, 0x080c, 0xae92, 0x0005, 0x2001,
+	0x0002, 0x080c, 0x654f, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c,
+	0x9138, 0x080c, 0x968d, 0x00de, 0x00ce, 0x0c80, 0x080c, 0x31e8,
+	0x0804, 0xc98b, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0d38,
+	0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0904, 0xc9dc,
+	0x8001, 0xb842, 0x6003, 0x0001, 0x080c, 0x9138, 0x080c, 0x968d,
+	0x00de, 0x00ce, 0x0898, 0x080c, 0xb813, 0x0804, 0xc98d, 0x080c,
+	0xb84f, 0x0804, 0xc98d, 0x00d6, 0x2c68, 0x6104, 0x080c, 0xd1a8,
+	0x00de, 0x0118, 0x080c, 0xae61, 0x00f0, 0x6004, 0x8007, 0x6134,
+	0x918c, 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b,
+	0x6023, 0x0002, 0x603c, 0x600a, 0x2001, 0x1987, 0x2004, 0x601a,
+	0x602c, 0x2c08, 0x2060, 0x6024, 0xc0b5, 0x6026, 0x2160, 0x080c,
+	0x90f0, 0x080c, 0x968d, 0x0005, 0x00de, 0x00ce, 0x080c, 0xb813,
+	0x080c, 0x31bf, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x31e8,
+	0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398, 0x6043, 0x0000,
+	0x012e, 0x00ee, 0x0005, 0x080c, 0xb291, 0x1904, 0xca33, 0x0005,
+	0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x0096, 0x00d6, 0x001b,
+	0x00de, 0x009e, 0x0005, 0xca9b, 0xca9b, 0xca9b, 0xca9b, 0xca9b,
+	0xca9b, 0xca9b, 0xca9b, 0xca9b, 0xc850, 0xca9b, 0xc857, 0xca9d,
+	0xc857, 0xcaaa, 0xca9b, 0x080c, 0x0dd5, 0x6004, 0x9086, 0x008b,
+	0x0148, 0x6007, 0x008b, 0x6003, 0x000d, 0x080c, 0x90f0, 0x080c,
+	0x968d, 0x0005, 0x080c, 0xd224, 0x0118, 0x080c, 0xd237, 0x0010,
+	0x080c, 0xd245, 0x080c, 0xcd1e, 0x080c, 0xcb35, 0x0570, 0x080c,
+	0x31bf, 0x080c, 0xcb35, 0x0168, 0x6014, 0x2048, 0xa867, 0x0103,
+	0xa87b, 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ed, 0xa882, 0x080c,
+	0x6c81, 0x2c68, 0x080c, 0xae0b, 0x0150, 0x6810, 0x6012, 0x080c,
+	0xcfaa, 0x00c6, 0x2d60, 0x080c, 0xae92, 0x00ce, 0x0008, 0x2d60,
+	0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001,
+	0x080c, 0x9138, 0x080c, 0x968d, 0x00c8, 0x080c, 0xd224, 0x0138,
+	0x6034, 0x9086, 0x4000, 0x1118, 0x080c, 0x31bf, 0x08d0, 0x6034,
 	0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035,
-	0x1118, 0x009e, 0x0804, 0xc648, 0x080c, 0xcb1b, 0x1118, 0x080c,
-	0xcd04, 0x0068, 0x6014, 0x2048, 0xa87c, 0xd0e4, 0x1110, 0x080c,
-	0xcd04, 0xa867, 0x0103, 0x080c, 0xd1f6, 0x080c, 0x6c79, 0x00d6,
-	0x2c68, 0x080c, 0xadf1, 0x01d0, 0x6003, 0x0001, 0x6007, 0x001e,
-	0x600b, 0xffff, 0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f,
-	0x210c, 0x613e, 0x6910, 0x6112, 0x080c, 0xcf90, 0x6954, 0x6156,
-	0x6023, 0x0001, 0x080c, 0x90c7, 0x080c, 0x9664, 0x2d60, 0x00de,
-	0x080c, 0xae47, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800,
-	0x00be, 0xd0bc, 0x05a0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186,
-	0x0035, 0x0130, 0x9186, 0x001e, 0x0118, 0x9186, 0x0039, 0x1538,
-	0x00d6, 0x2c68, 0x080c, 0xd18e, 0x11f0, 0x080c, 0xadf1, 0x01d8,
-	0x6106, 0x6003, 0x0001, 0x6023, 0x0001, 0x6910, 0x6112, 0x692c,
-	0x612e, 0x6930, 0x6132, 0x6934, 0x918c, 0x00ff, 0x6136, 0x6938,
-	0x613a, 0x693c, 0x613e, 0x6954, 0x6156, 0x080c, 0xcf90, 0x080c,
-	0x90c7, 0x080c, 0x9664, 0x2d60, 0x00de, 0x0804, 0xae47, 0x0096,
-	0x6014, 0x2048, 0x080c, 0xcb1b, 0x01c8, 0xa867, 0x0103, 0xa880,
-	0xd0b4, 0x0128, 0xc0ec, 0xa882, 0xa87b, 0x0006, 0x0048, 0xd0bc,
-	0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xce10,
-	0xa877, 0x0000, 0x080c, 0x6c79, 0x080c, 0xcd04, 0x009e, 0x0804,
-	0xae47, 0x0016, 0x0096, 0x6014, 0x2048, 0x080c, 0xcb1b, 0x0140,
-	0xa867, 0x0103, 0xa87b, 0x0028, 0xa877, 0x0000, 0x080c, 0x6c79,
-	0x009e, 0x001e, 0x9186, 0x0013, 0x0148, 0x9186, 0x0014, 0x0130,
-	0x9186, 0x0027, 0x0118, 0x080c, 0xaedd, 0x0030, 0x080c, 0x955f,
-	0x080c, 0xae78, 0x080c, 0x9664, 0x0005, 0x0056, 0x0066, 0x0096,
-	0x00a6, 0x2029, 0x0001, 0x9182, 0x0101, 0x1208, 0x0010, 0x2009,
-	0x0100, 0x2130, 0x8304, 0x9098, 0x0018, 0x2009, 0x0020, 0x2011,
-	0x0029, 0x080c, 0xc716, 0x96b2, 0x0020, 0xb004, 0x904d, 0x0110,
-	0x080c, 0x0fb1, 0x080c, 0x0fff, 0x0520, 0x8528, 0xa867, 0x0110,
-	0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1228, 0x2608,
-	0x2011, 0x001b, 0x0499, 0x00a8, 0x96b2, 0x003c, 0x2009, 0x003c,
-	0x2950, 0x2011, 0x001b, 0x0451, 0x0c28, 0x2001, 0x0205, 0x2003,
-	0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x95ac, 0x0000,
-	0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
-	0x0003, 0xb566, 0x009e, 0x006e, 0x005e, 0x0005, 0x00a6, 0x89ff,
-	0x0158, 0xa804, 0x9055, 0x0130, 0xa807, 0x0000, 0x080c, 0x6c79,
-	0x2a48, 0x0cb8, 0x080c, 0x6c79, 0x00ae, 0x0005, 0x00f6, 0x2079,
-	0x0200, 0x7814, 0x9085, 0x0080, 0x7816, 0xd184, 0x0108, 0x8108,
-	0x810c, 0x20a9, 0x0001, 0xa860, 0x20e8, 0xa85c, 0x9200, 0x20a0,
-	0x20e1, 0x0000, 0x2300, 0x9e00, 0x2098, 0x4003, 0x8318, 0x9386,
-	0x0020, 0x1148, 0x2018, 0x2300, 0x9e00, 0x2098, 0x7814, 0x8000,
-	0x9085, 0x0080, 0x7816, 0x8109, 0x1d80, 0x7817, 0x0000, 0x00fe,
-	0x0005, 0x0066, 0x0126, 0x2091, 0x8000, 0x2031, 0x0001, 0x6020,
-	0x9084, 0x000f, 0x0083, 0x012e, 0x006e, 0x0005, 0x0126, 0x2091,
-	0x8000, 0x0066, 0x2031, 0x0000, 0x6020, 0x9084, 0x000f, 0x001b,
-	0x006e, 0x012e, 0x0005, 0xc77c, 0xc77c, 0xc777, 0xc79e, 0xc76a,
-	0xc777, 0xc79e, 0xc777, 0xc76a, 0x8eb0, 0xc777, 0xc777, 0xc777,
-	0xc76a, 0xc76a, 0x080c, 0x0dd5, 0x0036, 0x2019, 0x0010, 0x080c,
-	0xe115, 0x6023, 0x0006, 0x6003, 0x0007, 0x003e, 0x0005, 0x9006,
-	0x0005, 0x9085, 0x0001, 0x0005, 0x0096, 0x86ff, 0x11d8, 0x6014,
-	0x2048, 0x080c, 0xcb1b, 0x01c0, 0xa864, 0x9086, 0x0139, 0x1128,
-	0xa87b, 0x0005, 0xa883, 0x0000, 0x0028, 0x900e, 0x2001, 0x0005,
-	0x080c, 0x6eb8, 0x080c, 0xce10, 0x080c, 0x6c6d, 0x080c, 0xae78,
-	0x9085, 0x0001, 0x009e, 0x0005, 0x9006, 0x0ce0, 0x6000, 0x908a,
-	0x0016, 0x1a0c, 0x0dd5, 0x0002, 0xc7b4, 0xc7e2, 0xc7b6, 0xc803,
-	0xc7dd, 0xc7b4, 0xc777, 0xc77c, 0xc77c, 0xc777, 0xc777, 0xc777,
-	0xc777, 0xc777, 0xc777, 0xc777, 0x080c, 0x0dd5, 0x86ff, 0x1510,
-	0x6020, 0x9086, 0x0006, 0x01f0, 0x0096, 0x6014, 0x2048, 0x080c,
-	0xcb1b, 0x0158, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048,
-	0x080c, 0x0fb1, 0x009e, 0x080c, 0xce10, 0x009e, 0x080c, 0xd1d0,
-	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c, 0x90c7,
-	0x080c, 0x9664, 0x9085, 0x0001, 0x0005, 0x0066, 0x080c, 0x1a5e,
-	0x006e, 0x08a0, 0x00e6, 0x2071, 0x19e7, 0x7024, 0x9c06, 0x1120,
-	0x080c, 0xa526, 0x00ee, 0x0850, 0x6020, 0x9084, 0x000f, 0x9086,
-	0x0006, 0x1150, 0x0086, 0x0096, 0x2049, 0x0001, 0x2c40, 0x080c,
-	0xa682, 0x009e, 0x008e, 0x0010, 0x080c, 0xa423, 0x00ee, 0x1904,
-	0xc7b6, 0x0804, 0xc777, 0x0036, 0x00e6, 0x2071, 0x19e7, 0x703c,
-	0x9c06, 0x1138, 0x901e, 0x080c, 0xa59c, 0x00ee, 0x003e, 0x0804,
-	0xc7b6, 0x080c, 0xa7b2, 0x00ee, 0x003e, 0x1904, 0xc7b6, 0x0804,
-	0xc777, 0x00c6, 0x6020, 0x9084, 0x000f, 0x0013, 0x00ce, 0x0005,
-	0xc836, 0xc8ff, 0xca66, 0xc840, 0xae78, 0xc836, 0xe107, 0xd238,
-	0xc8ff, 0x8e82, 0xcae5, 0xc82f, 0xc82f, 0xc82f, 0xc82f, 0x080c,
-	0x0dd5, 0x080c, 0xcd21, 0x1110, 0x080c, 0xb7f9, 0x0005, 0x080c,
-	0x955f, 0x080c, 0x9664, 0x0804, 0xae47, 0x601b, 0x0001, 0x0005,
-	0x080c, 0xcb1b, 0x0130, 0x6014, 0x0096, 0x2048, 0x2c00, 0xa896,
-	0x009e, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x0002, 0xc85f,
-	0xc861, 0xc885, 0xc899, 0xc8bd, 0xc85f, 0xc836, 0xc836, 0xc836,
-	0xc899, 0xc899, 0xc85f, 0xc85f, 0xc85f, 0xc85f, 0xc8a3, 0x080c,
-	0x0dd5, 0x00e6, 0x6014, 0x0096, 0x2048, 0xa880, 0xc0b5, 0xa882,
-	0x009e, 0x2071, 0x19e7, 0x7024, 0x9c06, 0x01a0, 0x080c, 0xa423,
-	0x080c, 0xd1d0, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
-	0x2001, 0x1987, 0x2004, 0x601a, 0x080c, 0x90c7, 0x080c, 0x9664,
-	0x00ee, 0x0005, 0x601b, 0x0001, 0x0cd8, 0x0096, 0x6014, 0x2048,
-	0xa880, 0xc0b5, 0xa882, 0x009e, 0x080c, 0xd1d0, 0x6007, 0x0085,
-	0x6003, 0x000b, 0x6023, 0x0002, 0x080c, 0x90c7, 0x080c, 0x9664,
-	0x0005, 0x0096, 0x601b, 0x0001, 0x6014, 0x2048, 0xa880, 0xc0b5,
-	0xa882, 0x009e, 0x0005, 0x080c, 0x56d8, 0x01a8, 0x6014, 0x0096,
-	0x904d, 0x0180, 0xa864, 0xa867, 0x0103, 0xa87b, 0x0006, 0x9086,
-	0x0139, 0x1140, 0xa867, 0x0139, 0xa897, 0x4005, 0xa89b, 0x0004,
-	0x080c, 0x6c79, 0x009e, 0x0804, 0xae47, 0x6014, 0x0096, 0x904d,
-	0x05c8, 0xa97c, 0xd1e4, 0x05b0, 0x2001, 0x180f, 0x2004, 0xd0c4,
-	0x0110, 0x009e, 0x0005, 0xa884, 0x009e, 0x8003, 0x800b, 0x810b,
-	0x9108, 0x611a, 0x2001, 0x0030, 0x2c08, 0x080c, 0x15ee, 0x2001,
-	0x030c, 0x2004, 0x9086, 0x0041, 0x11a0, 0x6014, 0x0096, 0x904d,
-	0x090c, 0x0dd5, 0xa880, 0xd0f4, 0x1130, 0xc0f5, 0xa882, 0x009e,
-	0x601b, 0x0002, 0x0070, 0x009e, 0x2001, 0x0037, 0x2c08, 0x080c,
-	0x15ee, 0x6000, 0x9086, 0x0004, 0x1120, 0x2009, 0x0048, 0x080c,
-	0xaec2, 0x0005, 0x009e, 0x080c, 0x1a5e, 0x0804, 0xc885, 0x6000,
-	0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x000b, 0x0005, 0xc916, 0xc83d,
-	0xc918, 0xc916, 0xc918, 0xc918, 0xc837, 0xc916, 0xc831, 0xc831,
-	0xc916, 0xc916, 0xc916, 0xc916, 0xc916, 0xc916, 0x080c, 0x0dd5,
-	0x6010, 0x00b6, 0x2058, 0xb804, 0x9084, 0x00ff, 0x00be, 0x908a,
-	0x000c, 0x1a0c, 0x0dd5, 0x00b6, 0x0013, 0x00be, 0x0005, 0xc933,
-	0xca00, 0xc935, 0xc975, 0xc935, 0xc975, 0xc935, 0xc943, 0xc933,
-	0xc975, 0xc933, 0xc964, 0x080c, 0x0dd5, 0x6004, 0x908e, 0x0016,
-	0x05c0, 0x908e, 0x0004, 0x05a8, 0x908e, 0x0002, 0x0590, 0x908e,
-	0x0052, 0x0904, 0xc9fc, 0x6004, 0x080c, 0xcd21, 0x0904, 0xca19,
-	0x908e, 0x0004, 0x1110, 0x080c, 0x31e1, 0x908e, 0x0021, 0x0904,
-	0xca1d, 0x908e, 0x0022, 0x0904, 0xca61, 0x908e, 0x003d, 0x0904,
-	0xca1d, 0x908e, 0x0039, 0x0904, 0xca21, 0x908e, 0x0035, 0x0904,
-	0xca21, 0x908e, 0x001e, 0x0178, 0x908e, 0x0001, 0x1140, 0x6010,
-	0x2058, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x0110, 0x080c,
-	0x31bc, 0x080c, 0xb7f9, 0x0804, 0xae78, 0x00c6, 0x00d6, 0x6104,
-	0x9186, 0x0016, 0x0904, 0xc9ed, 0x9186, 0x0002, 0x1904, 0xc9c2,
-	0x2001, 0x1837, 0x2004, 0xd08c, 0x11c8, 0x080c, 0x73b0, 0x11b0,
-	0x080c, 0xd216, 0x0138, 0x080c, 0x73d3, 0x1120, 0x080c, 0x72c0,
-	0x0804, 0xca4a, 0x2001, 0x197d, 0x2003, 0x0001, 0x2001, 0x1800,
-	0x2003, 0x0001, 0x080c, 0x72e2, 0x0804, 0xca4a, 0x6010, 0x2058,
-	0x2001, 0x1837, 0x2004, 0xd0ac, 0x1904, 0xca4a, 0xb8a0, 0x9084,
-	0xff80, 0x1904, 0xca4a, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0190,
-	0x8001, 0xb842, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398,
-	0x6043, 0x0000, 0x080c, 0xadf1, 0x0128, 0x2b00, 0x6012, 0x6023,
-	0x0001, 0x0458, 0x00de, 0x00ce, 0x6004, 0x908e, 0x0002, 0x11a0,
-	0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2009, 0x1837,
-	0x2104, 0xc085, 0x200a, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5fae,
-	0x00ee, 0x080c, 0xb7f9, 0x0030, 0x080c, 0xb7f9, 0x080c, 0x31bc,
-	0x080c, 0xd22b, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x31e1,
-	0x012e, 0x00ee, 0x080c, 0xae78, 0x0005, 0x2001, 0x0002, 0x080c,
-	0x6550, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x910f, 0x080c,
-	0x9664, 0x00de, 0x00ce, 0x0c80, 0x080c, 0x31e1, 0x0804, 0xc971,
-	0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0d38, 0x6010, 0x2058,
-	0xb840, 0x9084, 0x00ff, 0x9005, 0x0904, 0xc9c2, 0x8001, 0xb842,
-	0x6003, 0x0001, 0x080c, 0x910f, 0x080c, 0x9664, 0x00de, 0x00ce,
-	0x0898, 0x080c, 0xb7f9, 0x0804, 0xc973, 0x080c, 0xb835, 0x0804,
-	0xc973, 0x00d6, 0x2c68, 0x6104, 0x080c, 0xd18e, 0x00de, 0x0118,
-	0x080c, 0xae47, 0x00f0, 0x6004, 0x8007, 0x6134, 0x918c, 0x00ff,
-	0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
-	0x603c, 0x600a, 0x2001, 0x1987, 0x2004, 0x601a, 0x602c, 0x2c08,
-	0x2060, 0x6024, 0xc0b5, 0x6026, 0x2160, 0x080c, 0x90c7, 0x080c,
-	0x9664, 0x0005, 0x00de, 0x00ce, 0x080c, 0xb7f9, 0x080c, 0x31bc,
-	0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x31e1, 0x6017, 0x0000,
-	0x6023, 0x0007, 0x601b, 0x0398, 0x6043, 0x0000, 0x012e, 0x00ee,
-	0x0005, 0x080c, 0xb277, 0x1904, 0xca19, 0x0005, 0x6000, 0x908a,
-	0x0016, 0x1a0c, 0x0dd5, 0x0096, 0x00d6, 0x001b, 0x00de, 0x009e,
-	0x0005, 0xca81, 0xca81, 0xca81, 0xca81, 0xca81, 0xca81, 0xca81,
-	0xca81, 0xca81, 0xc836, 0xca81, 0xc83d, 0xca83, 0xc83d, 0xca90,
-	0xca81, 0x080c, 0x0dd5, 0x6004, 0x9086, 0x008b, 0x0148, 0x6007,
-	0x008b, 0x6003, 0x000d, 0x080c, 0x90c7, 0x080c, 0x9664, 0x0005,
-	0x080c, 0xd20a, 0x0118, 0x080c, 0xd21d, 0x0010, 0x080c, 0xd22b,
-	0x080c, 0xcd04, 0x080c, 0xcb1b, 0x0570, 0x080c, 0x31bc, 0x080c,
-	0xcb1b, 0x0168, 0x6014, 0x2048, 0xa867, 0x0103, 0xa87b, 0x0006,
-	0xa877, 0x0000, 0xa880, 0xc0ed, 0xa882, 0x080c, 0x6c79, 0x2c68,
-	0x080c, 0xadf1, 0x0150, 0x6810, 0x6012, 0x080c, 0xcf90, 0x00c6,
-	0x2d60, 0x080c, 0xae78, 0x00ce, 0x0008, 0x2d60, 0x6017, 0x0000,
-	0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x910f,
-	0x080c, 0x9664, 0x00c8, 0x080c, 0xd20a, 0x0138, 0x6034, 0x9086,
-	0x4000, 0x1118, 0x080c, 0x31bc, 0x08d0, 0x6034, 0x908c, 0xff00,
-	0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x080c,
-	0x31bc, 0x0868, 0x080c, 0xae78, 0x0005, 0x6000, 0x908a, 0x0016,
-	0x1a0c, 0x0dd5, 0x0002, 0xcafb, 0xcafb, 0xcafd, 0xcafd, 0xcafd,
-	0xcafb, 0xcafb, 0xae78, 0xcafb, 0xcafb, 0xcafb, 0xcafb, 0xcafb,
-	0xcafb, 0xcafb, 0xcafb, 0x080c, 0x0dd5, 0x080c, 0xa7b2, 0x6114,
-	0x0096, 0x2148, 0xa87b, 0x0006, 0x080c, 0x6c79, 0x009e, 0x0804,
-	0xae47, 0x9284, 0x0007, 0x1158, 0x9282, 0x1cd0, 0x0240, 0x2001,
-	0x181a, 0x2004, 0x9202, 0x1218, 0x9085, 0x0001, 0x0005, 0x9006,
-	0x0ce8, 0x0096, 0x0028, 0x0096, 0x0006, 0x6014, 0x2048, 0x000e,
-	0x0006, 0x9984, 0xf000, 0x9086, 0xf000, 0x0110, 0x080c, 0x10aa,
-	0x000e, 0x009e, 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0006, 0x0126,
-	0x2091, 0x8000, 0x2061, 0x1cd0, 0x2071, 0x1800, 0x7354, 0x7074,
-	0x9302, 0x1640, 0x6020, 0x9206, 0x11f8, 0x080c, 0xd216, 0x0180,
-	0x9286, 0x0001, 0x1168, 0x6004, 0x9086, 0x0004, 0x1148, 0x080c,
-	0x31bc, 0x080c, 0xd22b, 0x00c6, 0x080c, 0xae78, 0x00ce, 0x0060,
-	0x080c, 0xcf0a, 0x0148, 0x080c, 0xcd21, 0x1110, 0x080c, 0xb7f9,
-	0x00c6, 0x080c, 0xae47, 0x00ce, 0x9ce0, 0x0018, 0x7068, 0x9c02,
-	0x1208, 0x08a0, 0x012e, 0x000e, 0x003e, 0x00ce, 0x00ee, 0x0005,
-	0x00e6, 0x00c6, 0x0016, 0x9188, 0x1000, 0x210c, 0x81ff, 0x0128,
-	0x2061, 0x1ab0, 0x6112, 0x080c, 0x31bc, 0x9006, 0x0010, 0x9085,
-	0x0001, 0x001e, 0x00ce, 0x00ee, 0x0005, 0x00c6, 0x0126, 0x2091,
-	0x8000, 0x080c, 0xadf1, 0x01b0, 0x6656, 0x2b00, 0x6012, 0x080c,
-	0x56d8, 0x0118, 0x080c, 0xcc48, 0x0168, 0x080c, 0xcf90, 0x6023,
-	0x0003, 0x2009, 0x004b, 0x080c, 0xaec2, 0x9085, 0x0001, 0x012e,
-	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0xbaa0, 0x080c, 0xae95, 0x0560, 0x6057, 0x0000, 0x2b00, 0x6012,
-	0x080c, 0xcf90, 0x6023, 0x0003, 0x0016, 0x080c, 0x9262, 0x0076,
-	0x903e, 0x080c, 0x913f, 0x2c08, 0x080c, 0xe2ca, 0x007e, 0x001e,
-	0xd184, 0x0128, 0x080c, 0xae47, 0x9085, 0x0001, 0x0070, 0x080c,
-	0x56d8, 0x0128, 0xd18c, 0x1170, 0x080c, 0xcc48, 0x0148, 0x2009,
-	0x004c, 0x080c, 0xaec2, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-	0x9006, 0x0cd8, 0x2900, 0x6016, 0x0c90, 0x2009, 0x004d, 0x0010,
-	0x2009, 0x004e, 0x00f6, 0x00c6, 0x0046, 0x0016, 0x080c, 0xadf1,
-	0x2c78, 0x0590, 0x7e56, 0x2b00, 0x7812, 0x7823, 0x0003, 0x2021,
-	0x0005, 0x080c, 0xcc5a, 0x9186, 0x004d, 0x0118, 0x9186, 0x004e,
-	0x0148, 0x2001, 0x1980, 0x200c, 0xd1fc, 0x0168, 0x2f60, 0x080c,
-	0xae47, 0x00d0, 0x2001, 0x197f, 0x200c, 0xd1fc, 0x0120, 0x2f60,
-	0x080c, 0xae47, 0x0088, 0x2f60, 0x080c, 0x56d8, 0x0138, 0xd18c,
-	0x1118, 0x04f1, 0x0148, 0x0010, 0x2900, 0x7816, 0x001e, 0x0016,
-	0x080c, 0xaec2, 0x9085, 0x0001, 0x001e, 0x004e, 0x00ce, 0x00fe,
-	0x0005, 0x00f6, 0x00c6, 0x0046, 0x080c, 0xadf1, 0x2c78, 0x0508,
-	0x7e56, 0x2b00, 0x7812, 0x7823, 0x0003, 0x0096, 0x2021, 0x0004,
-	0x0489, 0x009e, 0x2001, 0x197e, 0x200c, 0xd1fc, 0x0120, 0x2f60,
-	0x080c, 0xae47, 0x0060, 0x2f60, 0x080c, 0x56d8, 0x0120, 0xd18c,
-	0x1160, 0x0071, 0x0130, 0x2009, 0x0052, 0x080c, 0xaec2, 0x9085,
-	0x0001, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x2900, 0x7816, 0x0c98,
-	0x00c6, 0x080c, 0x4aa5, 0x00ce, 0x1120, 0x080c, 0xae47, 0x9006,
-	0x0005, 0xa867, 0x0000, 0xa86b, 0x8000, 0x2900, 0x6016, 0x9085,
-	0x0001, 0x0005, 0x0096, 0x0076, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6734, 0x0158, 0x2001, 0xcc5f, 0x0006, 0x900e, 0x2400, 0x080c,
-	0x6eb8, 0x080c, 0x6c79, 0x000e, 0x0807, 0x2418, 0x080c, 0x94f9,
-	0xbaa0, 0x0086, 0x2041, 0x0001, 0x2039, 0x0001, 0x2608, 0x080c,
-	0x927a, 0x008e, 0x080c, 0x913f, 0x2f08, 0x2648, 0x080c, 0xe2ca,
-	0xb93c, 0x81ff, 0x090c, 0x934b, 0x080c, 0x9664, 0x012e, 0x007e,
-	0x009e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xadf1,
-	0x0190, 0x660a, 0x2b08, 0x6112, 0x080c, 0xcf90, 0x6023, 0x0001,
-	0x2900, 0x6016, 0x2009, 0x001f, 0x080c, 0xaec2, 0x9085, 0x0001,
-	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091,
-	0x8000, 0x080c, 0xae95, 0x01b8, 0x660a, 0x2b08, 0x6112, 0x080c,
-	0xcf90, 0x6023, 0x0008, 0x2900, 0x6016, 0x00f6, 0x2c78, 0x080c,
-	0x1725, 0x00fe, 0x2009, 0x0021, 0x080c, 0xaec2, 0x9085, 0x0001,
-	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x003d, 0x00c6,
-	0x0126, 0x0016, 0x2091, 0x8000, 0x080c, 0xadf1, 0x0198, 0x660a,
-	0x2b08, 0x6112, 0x080c, 0xcf90, 0x6023, 0x0001, 0x2900, 0x6016,
-	0x001e, 0x0016, 0x080c, 0xaec2, 0x9085, 0x0001, 0x001e, 0x012e,
-	0x00ce, 0x0005, 0x9006, 0x0cd0, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x080c, 0xae95, 0x0188, 0x2b08, 0x6112, 0x080c, 0xcf90, 0x6023,
-	0x0001, 0x2900, 0x6016, 0x2009, 0x0000, 0x080c, 0xaec2, 0x9085,
-	0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x0044,
-	0x0830, 0x2009, 0x0049, 0x0818, 0x0026, 0x00b6, 0x6210, 0x2258,
-	0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be, 0x002e, 0x0005,
-	0x0006, 0x0016, 0x6004, 0x908e, 0x0002, 0x0140, 0x908e, 0x0003,
-	0x0128, 0x908e, 0x0004, 0x0110, 0x9085, 0x0001, 0x001e, 0x000e,
-	0x0005, 0x0006, 0x0096, 0x6020, 0x9086, 0x0004, 0x0190, 0x6014,
-	0x904d, 0x080c, 0xcb1b, 0x0168, 0xa864, 0x9086, 0x0139, 0x0158,
-	0x6020, 0x9086, 0x0003, 0x0128, 0xa868, 0xd0fc, 0x0110, 0x9006,
-	0x0010, 0x9085, 0x0001, 0x009e, 0x000e, 0x0005, 0x00c6, 0x0126,
-	0x2091, 0x8000, 0x080c, 0xae95, 0x0198, 0x2b08, 0x6112, 0x080c,
-	0xcf90, 0x6023, 0x0001, 0x2900, 0x6016, 0x080c, 0x31bc, 0x2009,
-	0x0028, 0x080c, 0xaec2, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-	0x9006, 0x0cd8, 0x9186, 0x0015, 0x11a8, 0x2011, 0x1824, 0x2204,
-	0x9086, 0x0074, 0x1178, 0x00b6, 0x080c, 0xba4b, 0x00be, 0x080c,
-	0xbc6e, 0x6003, 0x0001, 0x6007, 0x0029, 0x080c, 0x910f, 0x080c,
-	0x9664, 0x0078, 0x6014, 0x0096, 0x2048, 0xa868, 0x009e, 0xd0fc,
-	0x0148, 0x2001, 0x0001, 0x080c, 0xd14f, 0x080c, 0xb7f9, 0x080c,
-	0xae47, 0x0005, 0x0096, 0x6014, 0x904d, 0x090c, 0x0dd5, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867,
-	0x0139, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c79, 0x012e, 0x009e,
-	0x080c, 0xae47, 0x0c30, 0x0096, 0x9186, 0x0016, 0x1128, 0x2001,
-	0x0004, 0x080c, 0x6550, 0x00e8, 0x9186, 0x0015, 0x1510, 0x2011,
-	0x1824, 0x2204, 0x9086, 0x0014, 0x11e0, 0x6010, 0x00b6, 0x2058,
-	0x080c, 0x669b, 0x00be, 0x080c, 0xbd3f, 0x1198, 0x6010, 0x00b6,
-	0x2058, 0xb890, 0x00be, 0x9005, 0x0160, 0x2001, 0x0006, 0x080c,
-	0x6550, 0x6014, 0x2048, 0xa868, 0xd0fc, 0x0170, 0x080c, 0xb24b,
-	0x0048, 0x6014, 0x2048, 0xa868, 0xd0fc, 0x0528, 0x080c, 0xb7f9,
-	0x080c, 0xae47, 0x009e, 0x0005, 0x6014, 0x6310, 0x2358, 0x904d,
-	0x090c, 0x0dd5, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
-	0x900e, 0x080c, 0x6820, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0xa99a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c79, 0x012e,
-	0x080c, 0xae47, 0x08f8, 0x6014, 0x904d, 0x090c, 0x0dd5, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867,
-	0x0139, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c79, 0x012e, 0x080c,
-	0xae47, 0x0840, 0xa878, 0x9086, 0x0005, 0x1108, 0x0009, 0x0005,
-	0xa880, 0xc0ad, 0xa882, 0x0005, 0x6043, 0x0000, 0x6017, 0x0000,
-	0x6003, 0x0001, 0x6007, 0x0050, 0x080c, 0x90c7, 0x080c, 0x9664,
-	0x0005, 0x00c6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-	0x0120, 0x6020, 0x9084, 0x000f, 0x0013, 0x00ce, 0x0005, 0xc836,
-	0xce40, 0xce40, 0xce43, 0xe5dc, 0xe5f7, 0xe5fa, 0xc836, 0xc836,
-	0xc836, 0xc836, 0xc836, 0xc836, 0xc836, 0xc836, 0x080c, 0x0dd5,
-	0xa001, 0xa001, 0x0005, 0x0096, 0x6014, 0x904d, 0x0118, 0xa87c,
-	0xd0e4, 0x1110, 0x009e, 0x0010, 0x009e, 0x0005, 0x6010, 0x00b6,
-	0x2058, 0xb800, 0x00be, 0xd0bc, 0x0550, 0x2001, 0x1834, 0x2004,
-	0x9005, 0x1540, 0x00f6, 0x2c78, 0x080c, 0xadf1, 0x0508, 0x7810,
-	0x6012, 0x080c, 0xcf90, 0x7820, 0x9086, 0x0003, 0x0128, 0x7808,
-	0x603a, 0x2f00, 0x603e, 0x0020, 0x7808, 0x603e, 0x2f00, 0x603a,
-	0x602e, 0x6023, 0x0001, 0x6007, 0x0035, 0x6003, 0x0001, 0x7954,
-	0x6156, 0x080c, 0x90c7, 0x080c, 0x9664, 0x2f60, 0x00fe, 0x0005,
-	0x2f60, 0x00fe, 0x2001, 0x1988, 0x2004, 0x6042, 0x0005, 0x0016,
-	0x0096, 0x6814, 0x2048, 0xa87c, 0xd0e4, 0x0180, 0xc0e4, 0xa87e,
-	0xa877, 0x0000, 0xa893, 0x0000, 0xa88f, 0x0000, 0xd0cc, 0x0130,
-	0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c, 0x0fb1, 0x6830, 0x6036,
-	0x908e, 0x0001, 0x0148, 0x6803, 0x0002, 0x9086, 0x0005, 0x0170,
-	0x9006, 0x602e, 0x6032, 0x00d0, 0x681c, 0xc085, 0x681e, 0x6803,
-	0x0004, 0x6824, 0xc0f4, 0x9085, 0x0c00, 0x6826, 0x6814, 0x2048,
-	0xa8ac, 0x6938, 0x9102, 0xa8b0, 0x693c, 0x9103, 0x1e48, 0x683c,
-	0x602e, 0x6838, 0x9084, 0xfffc, 0x683a, 0x6032, 0x2d00, 0x603a,
-	0x6808, 0x603e, 0x6910, 0x6112, 0x6954, 0x6156, 0x6023, 0x0001,
-	0x6007, 0x0039, 0x6003, 0x0001, 0x080c, 0x90c7, 0x080c, 0x9664,
-	0x009e, 0x001e, 0x0005, 0x6024, 0xd0d4, 0x0510, 0xd0f4, 0x11f8,
-	0x6038, 0x940a, 0x603c, 0x9303, 0x0230, 0x9105, 0x0120, 0x6024,
-	0xc0d4, 0xc0f5, 0x0098, 0x643a, 0x633e, 0xac3e, 0xab42, 0x0046,
-	0x0036, 0x2400, 0xacac, 0x9402, 0xa836, 0x2300, 0xabb0, 0x9303,
-	0xa83a, 0x003e, 0x004e, 0x6024, 0xc0d4, 0x0000, 0x6026, 0x0005,
-	0xd0f4, 0x1138, 0xa83c, 0x603a, 0xa840, 0x603e, 0x6024, 0xc0f5,
-	0x6026, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e, 0x0034, 0x01b8,
-	0x908e, 0x0035, 0x01a0, 0x908e, 0x0036, 0x0188, 0x908e, 0x0037,
-	0x0170, 0x908e, 0x0038, 0x0158, 0x908e, 0x0039, 0x0140, 0x908e,
-	0x003a, 0x0128, 0x908e, 0x003b, 0x0110, 0x9085, 0x0001, 0x001e,
-	0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00e6, 0x2001,
-	0x1982, 0x200c, 0x8000, 0x2014, 0x2001, 0x0032, 0x080c, 0x8f3f,
-	0x2001, 0x1986, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001,
-	0x1984, 0x200c, 0x8000, 0x2014, 0x2071, 0x196c, 0x711a, 0x721e,
-	0x2001, 0x0064, 0x080c, 0x8f3f, 0x2001, 0x1987, 0x82ff, 0x1110,
-	0x2011, 0x0014, 0x2202, 0x2001, 0x1988, 0x9288, 0x000a, 0x2102,
-	0x2001, 0x1a91, 0x2102, 0x2001, 0x0032, 0x080c, 0x15ee, 0x080c,
-	0x694b, 0x00ee, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006,
-	0x0016, 0x00e6, 0x2001, 0x1986, 0x2003, 0x0028, 0x2001, 0x1987,
-	0x2003, 0x0014, 0x2071, 0x196c, 0x701b, 0x0000, 0x701f, 0x07d0,
-	0x2001, 0x1988, 0x2009, 0x001e, 0x2102, 0x2001, 0x1a91, 0x2102,
-	0x2001, 0x0032, 0x080c, 0x15ee, 0x00ee, 0x001e, 0x000e, 0x0005,
-	0x0096, 0x6058, 0x904d, 0x0110, 0x080c, 0x1031, 0x009e, 0x0005,
-	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xadf1, 0x0180,
-	0x2b08, 0x6112, 0x0ca9, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009,
-	0x0033, 0x080c, 0xaec2, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-	0x9006, 0x0cd8, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186,
-	0x0015, 0x1500, 0x7090, 0x9086, 0x0018, 0x11e0, 0x6014, 0x2048,
-	0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x98f7, 0x01d8, 0x707c,
-	0xaa50, 0x9206, 0x1160, 0x7080, 0xaa54, 0x9206, 0x1140, 0x6210,
-	0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e, 0x080c, 0x3201, 0x080c,
-	0xb24b, 0x0020, 0x080c, 0xb7f9, 0x080c, 0xae47, 0x00fe, 0x00ee,
-	0x009e, 0x0005, 0x7060, 0xaa54, 0x9206, 0x0d48, 0x0c80, 0x00c6,
-	0x0126, 0x2091, 0x8000, 0x080c, 0xadf1, 0x0188, 0x2b08, 0x6112,
-	0x080c, 0xcf90, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x004d,
-	0x080c, 0xaec2, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
-	0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x0016, 0x080c, 0xadf1,
-	0x0180, 0x2b08, 0x6112, 0x080c, 0xcf90, 0x6023, 0x0001, 0x2900,
-	0x6016, 0x001e, 0x080c, 0xaec2, 0x9085, 0x0001, 0x012e, 0x00ce,
-	0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016, 0x0026, 0x0036, 0x0046,
-	0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186,
-	0x0015, 0x1568, 0x7190, 0x6014, 0x2048, 0xa814, 0x8003, 0x9106,
-	0x1530, 0x20e1, 0x0000, 0x2001, 0x19a0, 0x2003, 0x0000, 0x6014,
-	0x2048, 0xa830, 0x20a8, 0x8906, 0x8006, 0x8007, 0x9094, 0x003f,
-	0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a0,
-	0x0016, 0x200c, 0x080c, 0xd800, 0x001e, 0xa804, 0x9005, 0x0110,
-	0x2048, 0x0c38, 0x6014, 0x2048, 0xa867, 0x0103, 0x0010, 0x080c,
-	0xb7f9, 0x080c, 0xae47, 0x00fe, 0x00ee, 0x009e, 0x006e, 0x005e,
-	0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x0096, 0x00e6, 0x00f6,
-	0x2071, 0x1800, 0x9186, 0x0015, 0x11b8, 0x7090, 0x9086, 0x0004,
-	0x1198, 0x6014, 0x2048, 0x2c78, 0x080c, 0x98f7, 0x01a8, 0x707c,
-	0xaa74, 0x9206, 0x1130, 0x7080, 0xaa78, 0x9206, 0x1110, 0x080c,
-	0x31bc, 0x080c, 0xb24b, 0x0020, 0x080c, 0xb7f9, 0x080c, 0xae47,
-	0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa78, 0x9206, 0x0d78,
-	0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015,
-	0x1550, 0x7090, 0x9086, 0x0004, 0x1530, 0x6014, 0x2048, 0x2c78,
-	0x080c, 0x98f7, 0x05f0, 0x707c, 0xaacc, 0x9206, 0x1180, 0x7080,
-	0xaad0, 0x9206, 0x1160, 0x080c, 0x31bc, 0x0016, 0xa998, 0xaab0,
-	0x9284, 0x1000, 0xc0fd, 0x080c, 0x5688, 0x001e, 0x0010, 0x080c,
-	0x5479, 0x080c, 0xcb1b, 0x0508, 0xa87b, 0x0000, 0xa883, 0x0000,
-	0xa897, 0x4000, 0x0080, 0x080c, 0xcb1b, 0x01b8, 0x6014, 0x2048,
-	0x080c, 0x5479, 0x1d70, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
-	0x4005, 0xa89b, 0x0004, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139,
-	0x080c, 0x6c79, 0x012e, 0x080c, 0xae47, 0x00fe, 0x00ee, 0x009e,
-	0x0005, 0x7060, 0xaad0, 0x9206, 0x0930, 0x0888, 0x0016, 0x0026,
-	0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0150,
-	0xa890, 0x9106, 0x1118, 0xa88c, 0x9206, 0x0120, 0xa992, 0xaa8e,
-	0x9085, 0x0001, 0x002e, 0x001e, 0x0005, 0x00b6, 0x00d6, 0x0036,
-	0x080c, 0xcb1b, 0x0904, 0xd14b, 0x0096, 0x6314, 0x2348, 0xa87a,
-	0xa982, 0x929e, 0x4000, 0x1580, 0x6310, 0x00c6, 0x2358, 0x2009,
-	0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c, 0x6820, 0x1108, 0xc185,
-	0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96, 0xa99a, 0x20a9, 0x0004,
-	0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0,
-	0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0f7c, 0x20a9, 0x0004,
-	0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c8, 0x9080, 0x000a, 0x2098,
-	0x080c, 0x0f7c, 0x00ce, 0x0090, 0xaa96, 0x3918, 0x9398, 0x0007,
-	0x231c, 0x6004, 0x9086, 0x0016, 0x0110, 0xa89b, 0x0004, 0xaba2,
-	0x6310, 0x2358, 0xb804, 0x9084, 0x00ff, 0xa89e, 0x080c, 0x6c6d,
-	0x6017, 0x0000, 0x009e, 0x003e, 0x00de, 0x00be, 0x0005, 0x0026,
-	0x0036, 0x0046, 0x00b6, 0x0096, 0x00f6, 0x6214, 0x2248, 0x6210,
-	0x2258, 0x2079, 0x0260, 0x9096, 0x0000, 0x11a0, 0xb814, 0x9084,
-	0x00ff, 0x900e, 0x080c, 0x283e, 0x2118, 0x831f, 0x939c, 0xff00,
-	0x7838, 0x9084, 0x00ff, 0x931d, 0x7c3c, 0x2011, 0x8018, 0x080c,
-	0x4b05, 0x00a8, 0x9096, 0x0001, 0x1148, 0x89ff, 0x0180, 0xa89b,
-	0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x0048, 0x9096, 0x0002,
-	0x1130, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x00fe,
-	0x009e, 0x00be, 0x004e, 0x003e, 0x002e, 0x0005, 0x00c6, 0x0026,
-	0x0016, 0x9186, 0x0035, 0x0110, 0x6a38, 0x0008, 0x6a2c, 0x080c,
-	0xcb09, 0x01f0, 0x2260, 0x6120, 0x9186, 0x0003, 0x0118, 0x9186,
-	0x0006, 0x1190, 0x6838, 0x9206, 0x0140, 0x683c, 0x9206, 0x1160,
-	0x6108, 0x6838, 0x9106, 0x1140, 0x0020, 0x6008, 0x693c, 0x9106,
-	0x1118, 0x6010, 0x6910, 0x9106, 0x001e, 0x002e, 0x00ce, 0x0005,
-	0x9085, 0x0001, 0x0cc8, 0xa974, 0xd1cc, 0x0188, 0x918c, 0x00ff,
-	0x918e, 0x0002, 0x1160, 0xa9a8, 0x918c, 0x0f00, 0x810f, 0x918e,
-	0x0001, 0x1128, 0xa834, 0xa938, 0x9115, 0x190c, 0xc22b, 0x0005,
-	0x0036, 0x2019, 0x0001, 0x0010, 0x0036, 0x901e, 0x0499, 0x01e0,
-	0x080c, 0xcb1b, 0x01c8, 0x080c, 0xcd04, 0x6037, 0x4000, 0x6014,
-	0x6017, 0x0000, 0x0096, 0x2048, 0xa87c, 0x080c, 0xcd21, 0x1118,
-	0x080c, 0xb7f9, 0x0040, 0xa867, 0x0103, 0xa877, 0x0000, 0x83ff,
-	0x1129, 0x080c, 0x6c79, 0x009e, 0x003e, 0x0005, 0xa880, 0xd0b4,
-	0x0128, 0xa87b, 0x0006, 0xc0ec, 0xa882, 0x0048, 0xd0bc, 0x0118,
-	0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xce10, 0xa877,
-	0x0000, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0ec, 0x0005, 0x0006,
-	0x2001, 0x1810, 0x2004, 0xd0f4, 0x000e, 0x0005, 0x0006, 0x2001,
-	0x1810, 0x2004, 0xd0e4, 0x000e, 0x0005, 0x0036, 0x0046, 0x6010,
-	0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0007, 0x080c, 0x4cbc,
-	0x004e, 0x003e, 0x0005, 0x0c51, 0x1d81, 0x0005, 0x2001, 0x1986,
-	0x2004, 0x601a, 0x0005, 0x2001, 0x1988, 0x2004, 0x6042, 0x0005,
-	0x080c, 0xae47, 0x0804, 0x9664, 0x00b6, 0x0066, 0x6000, 0x90b2,
-	0x0016, 0x1a0c, 0x0dd5, 0x001b, 0x006e, 0x00be, 0x0005, 0xd257,
-	0xd95d, 0xdaba, 0xd257, 0xd257, 0xd257, 0xd257, 0xd257, 0xd28e,
-	0xdb38, 0xd257, 0xd257, 0xd257, 0xd257, 0xd257, 0xd257, 0x080c,
-	0x0dd5, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0dd5, 0x0013,
-	0x006e, 0x0005, 0xd272, 0xe0a0, 0xd272, 0xd272, 0xd272, 0xd272,
-	0xd272, 0xd272, 0xe04d, 0xe0f4, 0xd272, 0xe717, 0xe74d, 0xe717,
-	0xe74d, 0xd272, 0x080c, 0x0dd5, 0x6000, 0x9082, 0x0016, 0x1a0c,
-	0x0dd5, 0x6000, 0x000a, 0x0005, 0xd28c, 0xdd15, 0xde05, 0xde27,
-	0xdee6, 0xd28c, 0xdfc4, 0xdf6e, 0xdb44, 0xe023, 0xe038, 0xd28c,
-	0xd28c, 0xd28c, 0xd28c, 0xd28c, 0x080c, 0x0dd5, 0x91b2, 0x0053,
-	0x1a0c, 0x0dd5, 0x2100, 0x91b2, 0x0040, 0x1a04, 0xd6d1, 0x0002,
-	0xd2d8, 0xd4c2, 0xd2d8, 0xd2d8, 0xd2d8, 0xd4cb, 0xd2d8, 0xd2d8,
-	0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8,
-	0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2da,
-	0xd33d, 0xd34c, 0xd3b0, 0xd3db, 0xd454, 0xd4ad, 0xd2d8, 0xd2d8,
-	0xd4ce, 0xd2d8, 0xd2d8, 0xd4e3, 0xd4f0, 0xd2d8, 0xd2d8, 0xd2d8,
-	0xd2d8, 0xd2d8, 0xd573, 0xd2d8, 0xd2d8, 0xd587, 0xd2d8, 0xd2d8,
-	0xd542, 0xd2d8, 0xd2d8, 0xd2d8, 0xd59f, 0xd2d8, 0xd2d8, 0xd2d8,
-	0xd61c, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd2d8, 0xd699,
-	0x080c, 0x0dd5, 0x080c, 0x6928, 0x1150, 0x2001, 0x1837, 0x2004,
-	0xd0cc, 0x1128, 0x9084, 0x0009, 0x9086, 0x0008, 0x1140, 0x6007,
-	0x0009, 0x602f, 0x0009, 0x6017, 0x0000, 0x0804, 0xd4bb, 0x080c,
-	0x68cd, 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x6210, 0x2258,
-	0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x9262, 0x0076, 0x903e,
-	0x080c, 0x913f, 0x2c08, 0x080c, 0xe2ca, 0x007e, 0x001e, 0x001e,
-	0x002e, 0x003e, 0x00ce, 0x00ee, 0x6610, 0x2658, 0x080c, 0x660f,
-	0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1268, 0x0016, 0x0026,
-	0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x2c08, 0x080c, 0xe976,
-	0x002e, 0x001e, 0x1178, 0x080c, 0xe1fc, 0x1904, 0xd3a8, 0x080c,
-	0xe198, 0x1120, 0x6007, 0x0008, 0x0804, 0xd4bb, 0x6007, 0x0009,
-	0x0804, 0xd4bb, 0x080c, 0xe420, 0x0128, 0x080c, 0xe1fc, 0x0d78,
-	0x0804, 0xd3a8, 0x6017, 0x1900, 0x0c88, 0x080c, 0x32dc, 0x1904,
-	0xd6ce, 0x6106, 0x080c, 0xe14f, 0x6007, 0x0006, 0x0804, 0xd4bb,
-	0x6007, 0x0007, 0x0804, 0xd4bb, 0x080c, 0xe789, 0x1904, 0xd6ce,
-	0x080c, 0x32dc, 0x1904, 0xd6ce, 0x00d6, 0x6610, 0x2658, 0xbe04,
-	0x9684, 0x00ff, 0x9082, 0x0006, 0x1220, 0x2001, 0x0001, 0x080c,
-	0x653c, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0188, 0x9686,
-	0x0004, 0x0170, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0140,
-	0x9686, 0x0004, 0x0128, 0x9686, 0x0005, 0x0110, 0x00de, 0x0480,
-	0x00e6, 0x2071, 0x0260, 0x7034, 0x9084, 0x0003, 0x1140, 0x7034,
-	0x9082, 0x0014, 0x0220, 0x7030, 0x9084, 0x0003, 0x0130, 0x00ee,
-	0x6017, 0x0000, 0x602f, 0x0007, 0x00b0, 0x00ee, 0x080c, 0xe260,
-	0x1190, 0x9686, 0x0006, 0x1140, 0x0026, 0x6210, 0x2258, 0xbaa0,
-	0x900e, 0x080c, 0x3201, 0x002e, 0x080c, 0x669b, 0x6007, 0x000a,
-	0x00de, 0x0804, 0xd4bb, 0x6007, 0x000b, 0x00de, 0x0804, 0xd4bb,
-	0x080c, 0x31bc, 0x080c, 0xd22b, 0x6007, 0x0001, 0x0804, 0xd4bb,
-	0x080c, 0xe789, 0x1904, 0xd6ce, 0x080c, 0x32dc, 0x1904, 0xd6ce,
-	0x2071, 0x0260, 0x7034, 0x90b4, 0x0003, 0x1948, 0x90b2, 0x0014,
-	0x0a30, 0x7030, 0x9084, 0x0003, 0x1910, 0x6610, 0x2658, 0xbe04,
-	0x9686, 0x0707, 0x09e8, 0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e,
-	0x080c, 0x3201, 0x002e, 0x6007, 0x000c, 0x2001, 0x0001, 0x080c,
-	0xe956, 0x0804, 0xd4bb, 0x080c, 0x6928, 0x1140, 0x2001, 0x1837,
-	0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804, 0xd2e7,
-	0x080c, 0x68cd, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082,
-	0x0006, 0x06c8, 0x1138, 0x0026, 0x2001, 0x0006, 0x080c, 0x657c,
-	0x002e, 0x0050, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120,
-	0x9686, 0x0006, 0x1904, 0xd3a8, 0x080c, 0xe26d, 0x1120, 0x6007,
-	0x000e, 0x0804, 0xd4bb, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046,
-	0x080c, 0x31bc, 0x080c, 0xd22b, 0x004e, 0x0016, 0x9006, 0x2009,
-	0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029, 0x080c, 0xe58d,
-	0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007,
-	0x0001, 0x0804, 0xd4bb, 0x2001, 0x0001, 0x080c, 0x653c, 0x0156,
-	0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011,
-	0x0270, 0x080c, 0xbdef, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005,
-	0x0168, 0x96b4, 0xff00, 0x8637, 0x9682, 0x0004, 0x0a04, 0xd3a8,
-	0x9682, 0x0007, 0x0a04, 0xd404, 0x0804, 0xd3a8, 0x6017, 0x1900,
-	0x6007, 0x0009, 0x0804, 0xd4bb, 0x080c, 0x6928, 0x1140, 0x2001,
-	0x1837, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804,
-	0xd2e7, 0x080c, 0x68cd, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff,
-	0x9082, 0x0006, 0x0690, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004,
-	0x0120, 0x9686, 0x0006, 0x1904, 0xd3a8, 0x080c, 0xe29b, 0x1130,
-	0x080c, 0xe198, 0x1118, 0x6007, 0x0010, 0x04e8, 0x0046, 0x6410,
-	0x2458, 0xbca0, 0x0046, 0x080c, 0x31bc, 0x080c, 0xd22b, 0x004e,
-	0x0016, 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009,
-	0x0029, 0x080c, 0xe58d, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802,
-	0x001e, 0x004e, 0x6007, 0x0001, 0x00f0, 0x080c, 0xe420, 0x0140,
-	0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0978, 0x0804, 0xd3a8,
-	0x6017, 0x1900, 0x6007, 0x0009, 0x0070, 0x080c, 0x32dc, 0x1904,
-	0xd6ce, 0x080c, 0xe789, 0x1904, 0xd6ce, 0x080c, 0xd89b, 0x1904,
-	0xd3a8, 0x6007, 0x0012, 0x6003, 0x0001, 0x080c, 0x910f, 0x080c,
-	0x9664, 0x0005, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x910f,
-	0x080c, 0x9664, 0x0cb0, 0x6007, 0x0005, 0x0c68, 0x080c, 0xe789,
-	0x1904, 0xd6ce, 0x080c, 0x32dc, 0x1904, 0xd6ce, 0x080c, 0xd89b,
-	0x1904, 0xd3a8, 0x6007, 0x0020, 0x6003, 0x0001, 0x080c, 0x910f,
-	0x080c, 0x9664, 0x0005, 0x080c, 0x32dc, 0x1904, 0xd6ce, 0x6007,
-	0x0023, 0x6003, 0x0001, 0x080c, 0x910f, 0x080c, 0x9664, 0x0005,
-	0x080c, 0xe789, 0x1904, 0xd6ce, 0x080c, 0x32dc, 0x1904, 0xd6ce,
-	0x080c, 0xd89b, 0x1904, 0xd3a8, 0x0016, 0x0026, 0x00e6, 0x2071,
-	0x0260, 0x7244, 0x9286, 0xffff, 0x0180, 0x2c08, 0x080c, 0xcb09,
-	0x01b0, 0x2260, 0x7240, 0x6008, 0x9206, 0x1188, 0x6010, 0x9190,
-	0x0004, 0x2214, 0x9206, 0x01b8, 0x0050, 0x7240, 0x2c08, 0x9006,
-	0x080c, 0xe557, 0x1180, 0x7244, 0x9286, 0xffff, 0x01b0, 0x2160,
-	0x6007, 0x0026, 0x6017, 0x1700, 0x7214, 0x9296, 0xffff, 0x1180,
-	0x6007, 0x0025, 0x0068, 0x6020, 0x9086, 0x0007, 0x1d80, 0x6004,
-	0x9086, 0x0024, 0x1110, 0x080c, 0xae47, 0x2160, 0x6007, 0x0025,
-	0x6003, 0x0001, 0x080c, 0x910f, 0x080c, 0x9664, 0x00ee, 0x002e,
-	0x001e, 0x0005, 0x2001, 0x0001, 0x080c, 0x653c, 0x0156, 0x0016,
-	0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276,
-	0x080c, 0xbdef, 0x003e, 0x002e, 0x001e, 0x015e, 0x0120, 0x6007,
-	0x0031, 0x0804, 0xd4bb, 0x080c, 0xba63, 0x080c, 0x73b0, 0x1190,
-	0x0006, 0x0026, 0x0036, 0x080c, 0x73ca, 0x1138, 0x080c, 0x7698,
-	0x080c, 0x601b, 0x080c, 0x72e2, 0x0010, 0x080c, 0x7388, 0x003e,
-	0x002e, 0x000e, 0x0005, 0x080c, 0x32dc, 0x1904, 0xd6ce, 0x080c,
-	0xd89b, 0x1904, 0xd3a8, 0x6106, 0x080c, 0xd8b7, 0x1120, 0x6007,
-	0x002b, 0x0804, 0xd4bb, 0x6007, 0x002c, 0x0804, 0xd4bb, 0x080c,
-	0xe789, 0x1904, 0xd6ce, 0x080c, 0x32dc, 0x1904, 0xd6ce, 0x080c,
-	0xd89b, 0x1904, 0xd3a8, 0x6106, 0x080c, 0xd8bc, 0x1120, 0x6007,
-	0x002e, 0x0804, 0xd4bb, 0x6007, 0x002f, 0x0804, 0xd4bb, 0x080c,
-	0x32dc, 0x1904, 0xd6ce, 0x00e6, 0x00d6, 0x00c6, 0x6010, 0x2058,
-	0xb904, 0x9184, 0x00ff, 0x9086, 0x0006, 0x0158, 0x9184, 0xff00,
-	0x8007, 0x9086, 0x0006, 0x0128, 0x00ce, 0x00de, 0x00ee, 0x0804,
-	0xd4c2, 0x080c, 0x56d4, 0xd0e4, 0x0904, 0xd619, 0x2071, 0x026c,
-	0x7010, 0x603a, 0x7014, 0x603e, 0x7108, 0x720c, 0x080c, 0x6966,
-	0x0140, 0x6010, 0x2058, 0xb810, 0x9106, 0x1118, 0xb814, 0x9206,
-	0x0510, 0x080c, 0x6962, 0x15b8, 0x2069, 0x1800, 0x6880, 0x9206,
-	0x1590, 0x687c, 0x9106, 0x1578, 0x7210, 0x080c, 0xcb09, 0x0590,
-	0x080c, 0xd786, 0x0578, 0x080c, 0xe609, 0x0560, 0x622e, 0x6007,
-	0x0036, 0x6003, 0x0001, 0x080c, 0x90c7, 0x080c, 0x9664, 0x00ce,
-	0x00de, 0x00ee, 0x0005, 0x7214, 0x9286, 0xffff, 0x0150, 0x080c,
-	0xcb09, 0x01c0, 0x9280, 0x0002, 0x2004, 0x7110, 0x9106, 0x1190,
-	0x08e0, 0x7210, 0x2c08, 0x9085, 0x0001, 0x080c, 0xe557, 0x2c10,
-	0x2160, 0x0140, 0x0890, 0x6007, 0x0037, 0x602f, 0x0009, 0x6017,
-	0x1500, 0x08b8, 0x6007, 0x0037, 0x602f, 0x0003, 0x6017, 0x1700,
-	0x0880, 0x6007, 0x0012, 0x0868, 0x080c, 0x32dc, 0x1904, 0xd6ce,
-	0x6010, 0x2058, 0xb804, 0x9084, 0xff00, 0x8007, 0x9086, 0x0006,
-	0x1904, 0xd4c2, 0x00e6, 0x00d6, 0x00c6, 0x080c, 0x56d4, 0xd0e4,
-	0x0904, 0xd691, 0x2069, 0x1800, 0x2071, 0x026c, 0x7008, 0x603a,
-	0x720c, 0x623e, 0x9286, 0xffff, 0x1150, 0x7208, 0x00c6, 0x2c08,
-	0x9085, 0x0001, 0x080c, 0xe557, 0x2c10, 0x00ce, 0x05e8, 0x080c,
-	0xcb09, 0x05d0, 0x7108, 0x9280, 0x0002, 0x2004, 0x9106, 0x15a0,
-	0x00c6, 0x0026, 0x2260, 0x080c, 0xc741, 0x002e, 0x00ce, 0x7118,
-	0x918c, 0xff00, 0x810f, 0x9186, 0x0001, 0x0178, 0x9186, 0x0005,
-	0x0118, 0x9186, 0x0007, 0x1198, 0x9280, 0x0005, 0x2004, 0x9005,
-	0x0170, 0x080c, 0xd786, 0x0904, 0xd612, 0x0056, 0x7510, 0x7614,
-	0x080c, 0xe622, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x6007,
-	0x003b, 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x080c,
-	0x90c7, 0x080c, 0x9664, 0x0c78, 0x6007, 0x003b, 0x602f, 0x0003,
-	0x6017, 0x0300, 0x6003, 0x0001, 0x080c, 0x90c7, 0x080c, 0x9664,
-	0x0c10, 0x6007, 0x003b, 0x602f, 0x000b, 0x6017, 0x0000, 0x0804,
-	0xd5e9, 0x00e6, 0x0026, 0x080c, 0x6928, 0x0550, 0x080c, 0x68cd,
-	0x080c, 0xe7fb, 0x1518, 0x2071, 0x1800, 0x70dc, 0x9085, 0x0003,
-	0x70de, 0x00f6, 0x2079, 0x0100, 0x72b0, 0x9284, 0x00ff, 0x707e,
-	0x78e6, 0x9284, 0xff00, 0x7280, 0x9205, 0x7082, 0x78ea, 0x00fe,
-	0x70e7, 0x0000, 0x080c, 0x6966, 0x0120, 0x2011, 0x1a00, 0x2013,
-	0x07d0, 0xd0ac, 0x1128, 0x080c, 0x2f96, 0x0010, 0x080c, 0xe82d,
-	0x002e, 0x00ee, 0x080c, 0xae47, 0x0804, 0xd4c1, 0x080c, 0xae47,
-	0x0005, 0x2600, 0x0002, 0xd6e5, 0xd716, 0xd727, 0xd6e5, 0xd6e5,
-	0xd6e7, 0xd738, 0xd6e5, 0xd6e5, 0xd6e5, 0xd704, 0xd6e5, 0xd6e5,
-	0xd6e5, 0xd743, 0xd750, 0xd781, 0xd6e5, 0x080c, 0x0dd5, 0x080c,
-	0xe789, 0x1d20, 0x080c, 0x32dc, 0x1d08, 0x080c, 0xd89b, 0x1148,
-	0x7038, 0x6016, 0x6007, 0x0045, 0x6003, 0x0001, 0x080c, 0x910f,
-	0x0005, 0x080c, 0x31bc, 0x080c, 0xd22b, 0x6007, 0x0001, 0x6003,
-	0x0001, 0x080c, 0x910f, 0x0005, 0x080c, 0xe789, 0x1938, 0x080c,
-	0x32dc, 0x1920, 0x080c, 0xd89b, 0x1d60, 0x703c, 0x6016, 0x6007,
-	0x004a, 0x6003, 0x0001, 0x080c, 0x910f, 0x0005, 0x080c, 0x32dc,
-	0x1904, 0xd6ce, 0x2009, 0x0041, 0x080c, 0xe836, 0x6007, 0x0047,
-	0x6003, 0x0001, 0x080c, 0x910f, 0x080c, 0x9664, 0x0005, 0x080c,
-	0x32dc, 0x1904, 0xd6ce, 0x2009, 0x0042, 0x080c, 0xe836, 0x6007,
-	0x0047, 0x6003, 0x0001, 0x080c, 0x910f, 0x080c, 0x9664, 0x0005,
-	0x080c, 0x32dc, 0x1904, 0xd6ce, 0x2009, 0x0046, 0x080c, 0xe836,
-	0x080c, 0xae47, 0x0005, 0x080c, 0xd7a3, 0x0904, 0xd6ce, 0x6007,
-	0x004e, 0x6003, 0x0001, 0x080c, 0x910f, 0x080c, 0x9664, 0x0005,
-	0x6007, 0x004f, 0x6017, 0x0000, 0x7134, 0x918c, 0x00ff, 0x81ff,
-	0x0508, 0x9186, 0x0001, 0x1160, 0x7140, 0x2001, 0x19bd, 0x2004,
-	0x9106, 0x11b0, 0x7144, 0x2001, 0x19be, 0x2004, 0x9106, 0x0190,
-	0x9186, 0x0002, 0x1168, 0x2011, 0x0276, 0x20a9, 0x0004, 0x6010,
-	0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xbe03, 0x009e, 0x0110,
-	0x6017, 0x0001, 0x6003, 0x0001, 0x080c, 0x910f, 0x080c, 0x9664,
-	0x0005, 0x6007, 0x0050, 0x703c, 0x6016, 0x0ca0, 0x0016, 0x00e6,
-	0x2071, 0x0260, 0x00b6, 0x00c6, 0x2260, 0x6010, 0x2058, 0xb8cc,
-	0xd084, 0x0150, 0x7128, 0x6048, 0x9106, 0x1120, 0x712c, 0x6044,
-	0x9106, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x00be,
-	0x00ee, 0x001e, 0x0005, 0x0016, 0x0096, 0x0086, 0x00e6, 0x01c6,
-	0x01d6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1800, 0x7090, 0x908a,
-	0x00f9, 0x16e8, 0x20e1, 0x0000, 0x2001, 0x19a0, 0x2003, 0x0000,
-	0x080c, 0x1018, 0x05a0, 0x2900, 0x6016, 0x7090, 0x8004, 0xa816,
-	0x908a, 0x001e, 0x02d0, 0xa833, 0x001e, 0x20a9, 0x001e, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a0, 0x0016,
-	0x200c, 0x0471, 0x001e, 0x2940, 0x080c, 0x1018, 0x01c0, 0x2900,
-	0xa006, 0x2100, 0x81ff, 0x0180, 0x0c18, 0xa832, 0x20a8, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a0, 0x0016,
-	0x200c, 0x00b1, 0x001e, 0x0000, 0x9085, 0x0001, 0x0048, 0x2071,
-	0x1800, 0x7093, 0x0000, 0x6014, 0x2048, 0x080c, 0x0fb1, 0x9006,
-	0x012e, 0x01de, 0x01ce, 0x00ee, 0x008e, 0x009e, 0x001e, 0x0005,
-	0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x918c, 0xffff, 0x11a8,
-	0x080c, 0x23ab, 0x2099, 0x026c, 0x2001, 0x0014, 0x3518, 0x9312,
-	0x1218, 0x23a8, 0x4003, 0x00f8, 0x20a8, 0x4003, 0x22a8, 0x8108,
-	0x080c, 0x23ab, 0x2099, 0x0260, 0x0ca8, 0x080c, 0x23ab, 0x2061,
-	0x19a0, 0x6004, 0x2098, 0x6008, 0x3518, 0x9312, 0x1218, 0x23a8,
-	0x4003, 0x0048, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x23ab,
-	0x2099, 0x0260, 0x0ca8, 0x2061, 0x19a0, 0x2019, 0x0280, 0x3300,
-	0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0260, 0x6006, 0x8108,
-	0x2162, 0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e,
-	0x002e, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036,
-	0x00c6, 0x81ff, 0x11b8, 0x080c, 0x23c3, 0x20a1, 0x024c, 0x2001,
-	0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0418, 0x20a8,
-	0x4003, 0x82ff, 0x01f8, 0x22a8, 0x8108, 0x080c, 0x23c3, 0x20a1,
-	0x0240, 0x0c98, 0x080c, 0x23c3, 0x2061, 0x19a3, 0x6004, 0x20a0,
-	0x6008, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0058, 0x20a8,
-	0x4003, 0x82ff, 0x0138, 0x22a8, 0x8108, 0x080c, 0x23c3, 0x20a1,
-	0x0240, 0x0c98, 0x2061, 0x19a3, 0x2019, 0x0260, 0x3400, 0x931e,
-	0x0110, 0x6006, 0x0020, 0x2001, 0x0240, 0x6006, 0x8108, 0x2162,
-	0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e,
-	0x001e, 0x000e, 0x0005, 0x00b6, 0x0066, 0x6610, 0x2658, 0xbe04,
-	0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0170, 0x9686, 0x0004,
-	0x0158, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0128, 0x9686,
-	0x0004, 0x0110, 0x9085, 0x0001, 0x006e, 0x00be, 0x0005, 0x00d6,
-	0x080c, 0xd933, 0x00de, 0x0005, 0x00d6, 0x080c, 0xd940, 0x1520,
-	0x680c, 0x908c, 0xff00, 0x6820, 0x9084, 0x00ff, 0x9115, 0x6216,
-	0x6824, 0x602e, 0xd1e4, 0x0130, 0x9006, 0x080c, 0xe956, 0x2009,
-	0x0001, 0x0078, 0xd1ec, 0x0180, 0x6920, 0x918c, 0x00ff, 0x6824,
-	0x080c, 0x283e, 0x1148, 0x2001, 0x0001, 0x080c, 0xe956, 0x2110,
-	0x900e, 0x080c, 0x3201, 0x0018, 0x9085, 0x0001, 0x0008, 0x9006,
-	0x00de, 0x0005, 0x00b6, 0x00c6, 0x080c, 0xae95, 0x05a8, 0x0016,
-	0x0026, 0x00c6, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
-	0x283e, 0x1578, 0x080c, 0x659f, 0x1560, 0xbe12, 0xbd16, 0x00ce,
-	0x002e, 0x001e, 0x2b00, 0x6012, 0x080c, 0xe789, 0x11d8, 0x080c,
-	0x32dc, 0x11c0, 0x080c, 0xd89b, 0x0510, 0x2001, 0x0007, 0x080c,
-	0x6550, 0x2001, 0x0007, 0x080c, 0x657c, 0x6017, 0x0000, 0x6023,
-	0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x910f, 0x080c,
-	0x9664, 0x0010, 0x080c, 0xae47, 0x9085, 0x0001, 0x00ce, 0x00be,
-	0x0005, 0x080c, 0xae47, 0x00ce, 0x002e, 0x001e, 0x0ca8, 0x080c,
-	0xae47, 0x9006, 0x0c98, 0x2069, 0x026d, 0x6800, 0x9082, 0x0010,
-	0x1228, 0x6017, 0x0000, 0x9085, 0x0001, 0x0008, 0x9006, 0x0005,
-	0x6017, 0x0000, 0x2069, 0x026c, 0x6808, 0x9084, 0xff00, 0x9086,
-	0x0800, 0x1190, 0x6904, 0x9186, 0x0018, 0x0118, 0x9186, 0x0014,
-	0x1158, 0x810f, 0x6800, 0x9084, 0x00ff, 0x910d, 0x615a, 0x908e,
-	0x0014, 0x0110, 0x908e, 0x0010, 0x0005, 0x6004, 0x90b2, 0x0053,
-	0x1a0c, 0x0dd5, 0x91b6, 0x0013, 0x1130, 0x2008, 0x91b2, 0x0040,
-	0x1a04, 0xda8a, 0x0092, 0x91b6, 0x0027, 0x0120, 0x91b6, 0x0014,
-	0x190c, 0x0dd5, 0x2001, 0x0007, 0x080c, 0x657c, 0x080c, 0x955f,
-	0x080c, 0xae78, 0x080c, 0x9664, 0x0005, 0xd9bd, 0xd9bf, 0xd9bd,
-	0xd9bd, 0xd9bd, 0xd9bf, 0xd9ce, 0xda83, 0xda20, 0xda83, 0xda34,
-	0xda83, 0xd9ce, 0xda83, 0xda7b, 0xda83, 0xda7b, 0xda83, 0xda83,
-	0xd9bd, 0xd9bd, 0xd9bd, 0xd9bd, 0xd9bd, 0xd9bd, 0xd9bd, 0xd9bd,
-	0xd9bd, 0xd9bd, 0xd9bd, 0xd9bf, 0xd9bd, 0xda83, 0xd9bd, 0xd9bd,
-	0xda83, 0xd9bd, 0xda80, 0xda83, 0xd9bd, 0xd9bd, 0xd9bd, 0xd9bd,
-	0xda83, 0xda83, 0xd9bd, 0xda83, 0xda83, 0xd9bd, 0xd9c9, 0xd9bd,
-	0xd9bd, 0xd9bd, 0xd9bd, 0xda7f, 0xda83, 0xd9bd, 0xd9bd, 0xda83,
-	0xda83, 0xd9bd, 0xd9bd, 0xd9bd, 0xd9bd, 0x080c, 0x0dd5, 0x080c,
-	0x955f, 0x080c, 0xd22e, 0x6003, 0x0002, 0x080c, 0x9664, 0x0804,
-	0xda89, 0x9006, 0x080c, 0x653c, 0x0804, 0xda83, 0x080c, 0x6962,
-	0x1904, 0xda83, 0x9006, 0x080c, 0x653c, 0x6010, 0x2058, 0xb810,
-	0x9086, 0x00ff, 0x1140, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000,
-	0x78aa, 0x00fe, 0x0428, 0x6010, 0x2058, 0xb8c0, 0x9005, 0x1178,
-	0x080c, 0xd216, 0x1904, 0xda83, 0x0036, 0x0046, 0xbba0, 0x2021,
-	0x0007, 0x080c, 0x4cbc, 0x004e, 0x003e, 0x0804, 0xda83, 0x080c,
-	0x330d, 0x1904, 0xda83, 0x2001, 0x1800, 0x2004, 0x9086, 0x0002,
-	0x1138, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe,
-	0x2001, 0x0002, 0x080c, 0x6550, 0x080c, 0x955f, 0x6023, 0x0001,
-	0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x910f, 0x080c, 0x9664,
-	0x6110, 0x2158, 0x2009, 0x0001, 0x080c, 0x84d8, 0x0804, 0xda89,
+	0x1118, 0x080c, 0x31bf, 0x0868, 0x080c, 0xae92, 0x0005, 0x6000,
+	0x908a, 0x0016, 0x1a0c, 0x0dd5, 0x0002, 0xcb15, 0xcb15, 0xcb17,
+	0xcb17, 0xcb17, 0xcb15, 0xcb15, 0xae92, 0xcb15, 0xcb15, 0xcb15,
+	0xcb15, 0xcb15, 0xcb15, 0xcb15, 0xcb15, 0x080c, 0x0dd5, 0x080c,
+	0xa7cc, 0x6114, 0x0096, 0x2148, 0xa87b, 0x0006, 0x080c, 0x6c81,
+	0x009e, 0x0804, 0xae61, 0x9284, 0x0007, 0x1158, 0x9282, 0x1cd0,
+	0x0240, 0x2001, 0x181a, 0x2004, 0x9202, 0x1218, 0x9085, 0x0001,
+	0x0005, 0x9006, 0x0ce8, 0x0096, 0x0028, 0x0096, 0x0006, 0x6014,
+	0x2048, 0x000e, 0x0006, 0x9984, 0xf000, 0x9086, 0xf000, 0x0110,
+	0x080c, 0x10aa, 0x000e, 0x009e, 0x0005, 0x00e6, 0x00c6, 0x0036,
+	0x0006, 0x0126, 0x2091, 0x8000, 0x2061, 0x1cd0, 0x2071, 0x1800,
+	0x7354, 0x7074, 0x9302, 0x1640, 0x6020, 0x9206, 0x11f8, 0x080c,
+	0xd230, 0x0180, 0x9286, 0x0001, 0x1168, 0x6004, 0x9086, 0x0004,
+	0x1148, 0x080c, 0x31bf, 0x080c, 0xd245, 0x00c6, 0x080c, 0xae92,
+	0x00ce, 0x0060, 0x080c, 0xcf24, 0x0148, 0x080c, 0xcd3b, 0x1110,
+	0x080c, 0xb813, 0x00c6, 0x080c, 0xae61, 0x00ce, 0x9ce0, 0x0018,
+	0x7068, 0x9c02, 0x1208, 0x08a0, 0x012e, 0x000e, 0x003e, 0x00ce,
+	0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0016, 0x9188, 0x1000, 0x210c,
+	0x81ff, 0x0128, 0x2061, 0x1ab0, 0x6112, 0x080c, 0x31bf, 0x9006,
+	0x0010, 0x9085, 0x0001, 0x001e, 0x00ce, 0x00ee, 0x0005, 0x00c6,
+	0x0126, 0x2091, 0x8000, 0x080c, 0xae0b, 0x01b0, 0x6656, 0x2b00,
+	0x6012, 0x080c, 0x56d7, 0x0118, 0x080c, 0xcc62, 0x0168, 0x080c,
+	0xcfaa, 0x6023, 0x0003, 0x2009, 0x004b, 0x080c, 0xaedc, 0x9085,
+	0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126,
+	0x2091, 0x8000, 0xbaa0, 0x080c, 0xaeaf, 0x0560, 0x6057, 0x0000,
+	0x2b00, 0x6012, 0x080c, 0xcfaa, 0x6023, 0x0003, 0x0016, 0x080c,
+	0x928b, 0x0076, 0x903e, 0x080c, 0x9168, 0x2c08, 0x080c, 0xe2eb,
+	0x007e, 0x001e, 0xd184, 0x0128, 0x080c, 0xae61, 0x9085, 0x0001,
+	0x0070, 0x080c, 0x56d7, 0x0128, 0xd18c, 0x1170, 0x080c, 0xcc62,
+	0x0148, 0x2009, 0x004c, 0x080c, 0xaedc, 0x9085, 0x0001, 0x012e,
+	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2900, 0x6016, 0x0c90, 0x2009,
+	0x004d, 0x0010, 0x2009, 0x004e, 0x00f6, 0x00c6, 0x0046, 0x0016,
+	0x080c, 0xae0b, 0x2c78, 0x0590, 0x7e56, 0x2b00, 0x7812, 0x7823,
+	0x0003, 0x2021, 0x0005, 0x080c, 0xcc74, 0x9186, 0x004d, 0x0118,
+	0x9186, 0x004e, 0x0148, 0x2001, 0x1980, 0x200c, 0xd1fc, 0x0168,
+	0x2f60, 0x080c, 0xae61, 0x00d0, 0x2001, 0x197f, 0x200c, 0xd1fc,
+	0x0120, 0x2f60, 0x080c, 0xae61, 0x0088, 0x2f60, 0x080c, 0x56d7,
+	0x0138, 0xd18c, 0x1118, 0x04f1, 0x0148, 0x0010, 0x2900, 0x7816,
+	0x001e, 0x0016, 0x080c, 0xaedc, 0x9085, 0x0001, 0x001e, 0x004e,
+	0x00ce, 0x00fe, 0x0005, 0x00f6, 0x00c6, 0x0046, 0x080c, 0xae0b,
+	0x2c78, 0x0508, 0x7e56, 0x2b00, 0x7812, 0x7823, 0x0003, 0x0096,
+	0x2021, 0x0004, 0x0489, 0x009e, 0x2001, 0x197e, 0x200c, 0xd1fc,
+	0x0120, 0x2f60, 0x080c, 0xae61, 0x0060, 0x2f60, 0x080c, 0x56d7,
+	0x0120, 0xd18c, 0x1160, 0x0071, 0x0130, 0x2009, 0x0052, 0x080c,
+	0xaedc, 0x9085, 0x0001, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x2900,
+	0x7816, 0x0c98, 0x00c6, 0x080c, 0x4aa4, 0x00ce, 0x1120, 0x080c,
+	0xae61, 0x9006, 0x0005, 0xa867, 0x0000, 0xa86b, 0x8000, 0x2900,
+	0x6016, 0x9085, 0x0001, 0x0005, 0x0096, 0x0076, 0x0126, 0x2091,
+	0x8000, 0x080c, 0x6733, 0x0158, 0x2001, 0xcc79, 0x0006, 0x900e,
+	0x2400, 0x080c, 0x6ec0, 0x080c, 0x6c81, 0x000e, 0x0807, 0x2418,
+	0x080c, 0x9522, 0xbaa0, 0x0086, 0x2041, 0x0001, 0x2039, 0x0001,
+	0x2608, 0x080c, 0x92a3, 0x008e, 0x080c, 0x9168, 0x2f08, 0x2648,
+	0x080c, 0xe2eb, 0xb93c, 0x81ff, 0x090c, 0x9374, 0x080c, 0x968d,
+	0x012e, 0x007e, 0x009e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000,
+	0x080c, 0xae0b, 0x0190, 0x660a, 0x2b08, 0x6112, 0x080c, 0xcfaa,
+	0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x001f, 0x080c, 0xaedc,
+	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6,
+	0x0126, 0x2091, 0x8000, 0x080c, 0xaeaf, 0x01b8, 0x660a, 0x2b08,
+	0x6112, 0x080c, 0xcfaa, 0x6023, 0x0008, 0x2900, 0x6016, 0x00f6,
+	0x2c78, 0x080c, 0x1725, 0x00fe, 0x2009, 0x0021, 0x080c, 0xaedc,
+	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009,
+	0x003d, 0x00c6, 0x0126, 0x0016, 0x2091, 0x8000, 0x080c, 0xae0b,
+	0x0198, 0x660a, 0x2b08, 0x6112, 0x080c, 0xcfaa, 0x6023, 0x0001,
+	0x2900, 0x6016, 0x001e, 0x0016, 0x080c, 0xaedc, 0x9085, 0x0001,
+	0x001e, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd0, 0x00c6, 0x0126,
+	0x2091, 0x8000, 0x080c, 0xaeaf, 0x0188, 0x2b08, 0x6112, 0x080c,
+	0xcfaa, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x0000, 0x080c,
+	0xaedc, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
+	0x2009, 0x0044, 0x0830, 0x2009, 0x0049, 0x0818, 0x0026, 0x00b6,
+	0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be,
+	0x002e, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e, 0x0002, 0x0140,
+	0x908e, 0x0003, 0x0128, 0x908e, 0x0004, 0x0110, 0x9085, 0x0001,
+	0x001e, 0x000e, 0x0005, 0x0006, 0x0096, 0x6020, 0x9086, 0x0004,
+	0x0190, 0x6014, 0x904d, 0x080c, 0xcb35, 0x0168, 0xa864, 0x9086,
+	0x0139, 0x0158, 0x6020, 0x9086, 0x0003, 0x0128, 0xa868, 0xd0fc,
+	0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x009e, 0x000e, 0x0005,
+	0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xaeaf, 0x0198, 0x2b08,
+	0x6112, 0x080c, 0xcfaa, 0x6023, 0x0001, 0x2900, 0x6016, 0x080c,
+	0x31bf, 0x2009, 0x0028, 0x080c, 0xaedc, 0x9085, 0x0001, 0x012e,
+	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x9186, 0x0015, 0x11a8, 0x2011,
+	0x1824, 0x2204, 0x9086, 0x0074, 0x1178, 0x00b6, 0x080c, 0xba65,
+	0x00be, 0x080c, 0xbc88, 0x6003, 0x0001, 0x6007, 0x0029, 0x080c,
+	0x9138, 0x080c, 0x968d, 0x0078, 0x6014, 0x0096, 0x2048, 0xa868,
+	0x009e, 0xd0fc, 0x0148, 0x2001, 0x0001, 0x080c, 0xd169, 0x080c,
+	0xb813, 0x080c, 0xae61, 0x0005, 0x0096, 0x6014, 0x904d, 0x090c,
+	0x0dd5, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b,
+	0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c81,
+	0x012e, 0x009e, 0x080c, 0xae61, 0x0c30, 0x0096, 0x9186, 0x0016,
+	0x1128, 0x2001, 0x0004, 0x080c, 0x654f, 0x00e8, 0x9186, 0x0015,
+	0x1510, 0x2011, 0x1824, 0x2204, 0x9086, 0x0014, 0x11e0, 0x6010,
+	0x00b6, 0x2058, 0x080c, 0x669a, 0x00be, 0x080c, 0xbd59, 0x1198,
+	0x6010, 0x00b6, 0x2058, 0xb890, 0x00be, 0x9005, 0x0160, 0x2001,
+	0x0006, 0x080c, 0x654f, 0x6014, 0x2048, 0xa868, 0xd0fc, 0x0170,
+	0x080c, 0xb265, 0x0048, 0x6014, 0x2048, 0xa868, 0xd0fc, 0x0528,
+	0x080c, 0xb813, 0x080c, 0xae61, 0x009e, 0x0005, 0x6014, 0x6310,
+	0x2358, 0x904d, 0x090c, 0x0dd5, 0xa87b, 0x0000, 0xa883, 0x0000,
+	0xa897, 0x4000, 0x900e, 0x080c, 0x681f, 0x1108, 0xc185, 0xb800,
+	0xd0bc, 0x0108, 0xc18d, 0xa99a, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6c81, 0x012e, 0x080c, 0xae61, 0x08f8, 0x6014, 0x904d, 0x090c,
+	0x0dd5, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b,
+	0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000, 0x080c, 0x6c81,
+	0x012e, 0x080c, 0xae61, 0x0840, 0xa878, 0x9086, 0x0005, 0x1108,
+	0x0009, 0x0005, 0xa880, 0xc0ad, 0xa882, 0x0005, 0x6043, 0x0000,
+	0x6017, 0x0000, 0x6003, 0x0001, 0x6007, 0x0050, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x0005, 0x00c6, 0x6010, 0x00b6, 0x2058, 0xb800,
+	0x00be, 0xd0bc, 0x0120, 0x6020, 0x9084, 0x000f, 0x0013, 0x00ce,
+	0x0005, 0xc850, 0xce5a, 0xce5a, 0xce5d, 0xe5fd, 0xe618, 0xe61b,
+	0xc850, 0xc850, 0xc850, 0xc850, 0xc850, 0xc850, 0xc850, 0xc850,
+	0x080c, 0x0dd5, 0xa001, 0xa001, 0x0005, 0x0096, 0x6014, 0x904d,
+	0x0118, 0xa87c, 0xd0e4, 0x1110, 0x009e, 0x0010, 0x009e, 0x0005,
+	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0550, 0x2001,
+	0x1834, 0x2004, 0x9005, 0x1540, 0x00f6, 0x2c78, 0x080c, 0xae0b,
+	0x0508, 0x7810, 0x6012, 0x080c, 0xcfaa, 0x7820, 0x9086, 0x0003,
+	0x0128, 0x7808, 0x603a, 0x2f00, 0x603e, 0x0020, 0x7808, 0x603e,
+	0x2f00, 0x603a, 0x602e, 0x6023, 0x0001, 0x6007, 0x0035, 0x6003,
+	0x0001, 0x7954, 0x6156, 0x080c, 0x90f0, 0x080c, 0x968d, 0x2f60,
+	0x00fe, 0x0005, 0x2f60, 0x00fe, 0x2001, 0x1988, 0x2004, 0x6042,
+	0x0005, 0x0016, 0x0096, 0x6814, 0x2048, 0xa87c, 0xd0e4, 0x0180,
+	0xc0e4, 0xa87e, 0xa877, 0x0000, 0xa893, 0x0000, 0xa88f, 0x0000,
+	0xd0cc, 0x0130, 0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c, 0x0fb1,
+	0x6830, 0x6036, 0x908e, 0x0001, 0x0148, 0x6803, 0x0002, 0x9086,
+	0x0005, 0x0170, 0x9006, 0x602e, 0x6032, 0x00d0, 0x681c, 0xc085,
+	0x681e, 0x6803, 0x0004, 0x6824, 0xc0f4, 0x9085, 0x0c00, 0x6826,
+	0x6814, 0x2048, 0xa8ac, 0x6938, 0x9102, 0xa8b0, 0x693c, 0x9103,
+	0x1e48, 0x683c, 0x602e, 0x6838, 0x9084, 0xfffc, 0x683a, 0x6032,
+	0x2d00, 0x603a, 0x6808, 0x603e, 0x6910, 0x6112, 0x6954, 0x6156,
+	0x6023, 0x0001, 0x6007, 0x0039, 0x6003, 0x0001, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x009e, 0x001e, 0x0005, 0x6024, 0xd0d4, 0x0510,
+	0xd0f4, 0x11f8, 0x6038, 0x940a, 0x603c, 0x9303, 0x0230, 0x9105,
+	0x0120, 0x6024, 0xc0d4, 0xc0f5, 0x0098, 0x643a, 0x633e, 0xac3e,
+	0xab42, 0x0046, 0x0036, 0x2400, 0xacac, 0x9402, 0xa836, 0x2300,
+	0xabb0, 0x9303, 0xa83a, 0x003e, 0x004e, 0x6024, 0xc0d4, 0x0000,
+	0x6026, 0x0005, 0xd0f4, 0x1138, 0xa83c, 0x603a, 0xa840, 0x603e,
+	0x6024, 0xc0f5, 0x6026, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e,
+	0x0034, 0x01b8, 0x908e, 0x0035, 0x01a0, 0x908e, 0x0036, 0x0188,
+	0x908e, 0x0037, 0x0170, 0x908e, 0x0038, 0x0158, 0x908e, 0x0039,
+	0x0140, 0x908e, 0x003a, 0x0128, 0x908e, 0x003b, 0x0110, 0x9085,
+	0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036,
+	0x00e6, 0x2001, 0x1982, 0x200c, 0x8000, 0x2014, 0x2001, 0x0032,
+	0x080c, 0x8f68, 0x2001, 0x1986, 0x82ff, 0x1110, 0x2011, 0x0014,
+	0x2202, 0x2001, 0x1984, 0x200c, 0x8000, 0x2014, 0x2071, 0x196c,
+	0x711a, 0x721e, 0x2001, 0x0064, 0x080c, 0x8f68, 0x2001, 0x1987,
+	0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001, 0x1988, 0x9288,
+	0x000a, 0x2102, 0x2001, 0x1a91, 0x2102, 0x2001, 0x0032, 0x080c,
+	0x15ee, 0x080c, 0x6953, 0x00ee, 0x003e, 0x002e, 0x001e, 0x000e,
+	0x0005, 0x0006, 0x0016, 0x00e6, 0x2001, 0x1986, 0x2003, 0x0028,
+	0x2001, 0x1987, 0x2003, 0x0014, 0x2071, 0x196c, 0x701b, 0x0000,
+	0x701f, 0x07d0, 0x2001, 0x1988, 0x2009, 0x001e, 0x2102, 0x2001,
+	0x1a91, 0x2102, 0x2001, 0x0032, 0x080c, 0x15ee, 0x00ee, 0x001e,
+	0x000e, 0x0005, 0x0096, 0x6058, 0x904d, 0x0110, 0x080c, 0x1031,
+	0x009e, 0x0005, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
+	0xae0b, 0x0180, 0x2b08, 0x6112, 0x0ca9, 0x6023, 0x0001, 0x2900,
+	0x6016, 0x2009, 0x0033, 0x080c, 0xaedc, 0x9085, 0x0001, 0x012e,
+	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x00e6, 0x00f6, 0x2071,
+	0x1800, 0x9186, 0x0015, 0x1500, 0x7090, 0x9086, 0x0018, 0x11e0,
+	0x6014, 0x2048, 0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x9920,
+	0x01d8, 0x707c, 0xaa50, 0x9206, 0x1160, 0x7080, 0xaa54, 0x9206,
+	0x1140, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e, 0x080c,
+	0x3208, 0x080c, 0xb265, 0x0020, 0x080c, 0xb813, 0x080c, 0xae61,
+	0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa54, 0x9206, 0x0d48,
+	0x0c80, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xae0b, 0x0188,
+	0x2b08, 0x6112, 0x080c, 0xcfaa, 0x6023, 0x0001, 0x2900, 0x6016,
+	0x2009, 0x004d, 0x080c, 0xaedc, 0x9085, 0x0001, 0x012e, 0x00ce,
+	0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x0016,
+	0x080c, 0xae0b, 0x0180, 0x2b08, 0x6112, 0x080c, 0xcfaa, 0x6023,
+	0x0001, 0x2900, 0x6016, 0x001e, 0x080c, 0xaedc, 0x9085, 0x0001,
+	0x012e, 0x00ce, 0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016, 0x0026,
+	0x0036, 0x0046, 0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6, 0x2071,
+	0x1800, 0x9186, 0x0015, 0x1568, 0x7190, 0x6014, 0x2048, 0xa814,
+	0x8003, 0x9106, 0x1530, 0x20e1, 0x0000, 0x2001, 0x19a0, 0x2003,
+	0x0000, 0x6014, 0x2048, 0xa830, 0x20a8, 0x8906, 0x8006, 0x8007,
+	0x9094, 0x003f, 0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b, 0x20a0,
+	0x2001, 0x19a0, 0x0016, 0x200c, 0x080c, 0xd81b, 0x001e, 0xa804,
+	0x9005, 0x0110, 0x2048, 0x0c38, 0x6014, 0x2048, 0xa867, 0x0103,
+	0x0010, 0x080c, 0xb813, 0x080c, 0xae61, 0x00fe, 0x00ee, 0x009e,
+	0x006e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x0096,
+	0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x11b8, 0x7090,
+	0x9086, 0x0004, 0x1198, 0x6014, 0x2048, 0x2c78, 0x080c, 0x9920,
+	0x01a8, 0x707c, 0xaa74, 0x9206, 0x1130, 0x7080, 0xaa78, 0x9206,
+	0x1110, 0x080c, 0x31bf, 0x080c, 0xb265, 0x0020, 0x080c, 0xb813,
+	0x080c, 0xae61, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa78,
+	0x9206, 0x0d78, 0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800,
+	0x9186, 0x0015, 0x1550, 0x7090, 0x9086, 0x0004, 0x1530, 0x6014,
+	0x2048, 0x2c78, 0x080c, 0x9920, 0x05f0, 0x707c, 0xaacc, 0x9206,
+	0x1180, 0x7080, 0xaad0, 0x9206, 0x1160, 0x080c, 0x31bf, 0x0016,
+	0xa998, 0xaab0, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5687, 0x001e,
+	0x0010, 0x080c, 0x5478, 0x080c, 0xcb35, 0x0508, 0xa87b, 0x0000,
+	0xa883, 0x0000, 0xa897, 0x4000, 0x0080, 0x080c, 0xcb35, 0x01b8,
+	0x6014, 0x2048, 0x080c, 0x5478, 0x1d70, 0xa87b, 0x0030, 0xa883,
+	0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0x0126, 0x2091, 0x8000,
+	0xa867, 0x0139, 0x080c, 0x6c81, 0x012e, 0x080c, 0xae61, 0x00fe,
+	0x00ee, 0x009e, 0x0005, 0x7060, 0xaad0, 0x9206, 0x0930, 0x0888,
+	0x0016, 0x0026, 0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34, 0x2100,
+	0x9205, 0x0150, 0xa890, 0x9106, 0x1118, 0xa88c, 0x9206, 0x0120,
+	0xa992, 0xaa8e, 0x9085, 0x0001, 0x002e, 0x001e, 0x0005, 0x00b6,
+	0x00d6, 0x0036, 0x080c, 0xcb35, 0x0904, 0xd165, 0x0096, 0x6314,
+	0x2348, 0xa87a, 0xa982, 0x929e, 0x4000, 0x1580, 0x6310, 0x00c6,
+	0x2358, 0x2009, 0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c, 0x681f,
+	0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96, 0xa99a,
+	0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0,
+	0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0f7c,
+	0x20a9, 0x0004, 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c8, 0x9080,
+	0x000a, 0x2098, 0x080c, 0x0f7c, 0x00ce, 0x0090, 0xaa96, 0x3918,
+	0x9398, 0x0007, 0x231c, 0x6004, 0x9086, 0x0016, 0x0110, 0xa89b,
+	0x0004, 0xaba2, 0x6310, 0x2358, 0xb804, 0x9084, 0x00ff, 0xa89e,
+	0x080c, 0x6c75, 0x6017, 0x0000, 0x009e, 0x003e, 0x00de, 0x00be,
+	0x0005, 0x0026, 0x0036, 0x0046, 0x00b6, 0x0096, 0x00f6, 0x6214,
+	0x2248, 0x6210, 0x2258, 0x2079, 0x0260, 0x9096, 0x0000, 0x11a0,
+	0xb814, 0x9084, 0x00ff, 0x900e, 0x080c, 0x283e, 0x2118, 0x831f,
+	0x939c, 0xff00, 0x7838, 0x9084, 0x00ff, 0x931d, 0x7c3c, 0x2011,
+	0x8018, 0x080c, 0x4b04, 0x00a8, 0x9096, 0x0001, 0x1148, 0x89ff,
+	0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x0048,
+	0x9096, 0x0002, 0x1130, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c,
+	0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e, 0x003e, 0x002e, 0x0005,
+	0x00c6, 0x0026, 0x0016, 0x9186, 0x0035, 0x0110, 0x6a38, 0x0008,
+	0x6a2c, 0x080c, 0xcb23, 0x01f0, 0x2260, 0x6120, 0x9186, 0x0003,
+	0x0118, 0x9186, 0x0006, 0x1190, 0x6838, 0x9206, 0x0140, 0x683c,
+	0x9206, 0x1160, 0x6108, 0x6838, 0x9106, 0x1140, 0x0020, 0x6008,
+	0x693c, 0x9106, 0x1118, 0x6010, 0x6910, 0x9106, 0x001e, 0x002e,
+	0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8, 0xa974, 0xd1cc, 0x0188,
+	0x918c, 0x00ff, 0x918e, 0x0002, 0x1160, 0xa9a8, 0x918c, 0x0f00,
+	0x810f, 0x918e, 0x0001, 0x1128, 0xa834, 0xa938, 0x9115, 0x190c,
+	0xc245, 0x0005, 0x0036, 0x2019, 0x0001, 0x0010, 0x0036, 0x901e,
+	0x0499, 0x01e0, 0x080c, 0xcb35, 0x01c8, 0x080c, 0xcd1e, 0x6037,
+	0x4000, 0x6014, 0x6017, 0x0000, 0x0096, 0x2048, 0xa87c, 0x080c,
+	0xcd3b, 0x1118, 0x080c, 0xb813, 0x0040, 0xa867, 0x0103, 0xa877,
+	0x0000, 0x83ff, 0x1129, 0x080c, 0x6c81, 0x009e, 0x003e, 0x0005,
+	0xa880, 0xd0b4, 0x0128, 0xa87b, 0x0006, 0xc0ec, 0xa882, 0x0048,
+	0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c,
+	0xce2a, 0xa877, 0x0000, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0ec,
+	0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0f4, 0x000e, 0x0005,
+	0x0006, 0x2001, 0x1810, 0x2004, 0xd0e4, 0x000e, 0x0005, 0x0036,
+	0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0007,
+	0x080c, 0x4cbb, 0x004e, 0x003e, 0x0005, 0x0c51, 0x1d81, 0x0005,
+	0x2001, 0x1986, 0x2004, 0x601a, 0x0005, 0x2001, 0x1988, 0x2004,
+	0x6042, 0x0005, 0x080c, 0xae61, 0x0804, 0x968d, 0x00b6, 0x0066,
+	0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0dd5, 0x001b, 0x006e, 0x00be,
+	0x0005, 0xd271, 0xd978, 0xdad5, 0xd271, 0xd271, 0xd271, 0xd271,
+	0xd271, 0xd2a8, 0xdb57, 0xd271, 0xd271, 0xd271, 0xd271, 0xd271,
+	0xd271, 0x080c, 0x0dd5, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c,
+	0x0dd5, 0x0013, 0x006e, 0x0005, 0xd28c, 0xe0bf, 0xd28c, 0xd28c,
+	0xd28c, 0xd28c, 0xd28c, 0xd28c, 0xe06c, 0xe113, 0xd28c, 0xe738,
+	0xe76e, 0xe738, 0xe76e, 0xd28c, 0x080c, 0x0dd5, 0x6000, 0x9082,
+	0x0016, 0x1a0c, 0x0dd5, 0x6000, 0x000a, 0x0005, 0xd2a6, 0xdd34,
+	0xde24, 0xde46, 0xdf05, 0xd2a6, 0xdfe3, 0xdf8d, 0xdb63, 0xe042,
+	0xe057, 0xd2a6, 0xd2a6, 0xd2a6, 0xd2a6, 0xd2a6, 0x080c, 0x0dd5,
+	0x91b2, 0x0053, 0x1a0c, 0x0dd5, 0x2100, 0x91b2, 0x0040, 0x1a04,
+	0xd6ec, 0x0002, 0xd2f2, 0xd4dd, 0xd2f2, 0xd2f2, 0xd2f2, 0xd4e6,
+	0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2,
+	0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2,
+	0xd2f2, 0xd2f4, 0xd357, 0xd366, 0xd3ca, 0xd3f5, 0xd46e, 0xd4c8,
+	0xd2f2, 0xd2f2, 0xd4e9, 0xd2f2, 0xd2f2, 0xd4fe, 0xd50b, 0xd2f2,
+	0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd58e, 0xd2f2, 0xd2f2, 0xd5a2,
+	0xd2f2, 0xd2f2, 0xd55d, 0xd2f2, 0xd2f2, 0xd2f2, 0xd5ba, 0xd2f2,
+	0xd2f2, 0xd2f2, 0xd637, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2, 0xd2f2,
+	0xd2f2, 0xd6b4, 0x080c, 0x0dd5, 0x080c, 0x6930, 0x1150, 0x2001,
+	0x1837, 0x2004, 0xd0cc, 0x1128, 0x9084, 0x0009, 0x9086, 0x0008,
+	0x1140, 0x6007, 0x0009, 0x602f, 0x0009, 0x6017, 0x0000, 0x0804,
+	0xd4d6, 0x080c, 0x68cc, 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016,
+	0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x928b,
+	0x0076, 0x903e, 0x080c, 0x9168, 0x2c08, 0x080c, 0xe2eb, 0x007e,
+	0x001e, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee, 0x6610, 0x2658,
+	0x080c, 0x660e, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1268,
+	0x0016, 0x0026, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x2c08,
+	0x080c, 0xe997, 0x002e, 0x001e, 0x1178, 0x080c, 0xe21d, 0x1904,
+	0xd3c2, 0x080c, 0xe1b9, 0x1120, 0x6007, 0x0008, 0x0804, 0xd4d6,
+	0x6007, 0x0009, 0x0804, 0xd4d6, 0x080c, 0xe441, 0x0128, 0x080c,
+	0xe21d, 0x0d78, 0x0804, 0xd3c2, 0x6017, 0x1900, 0x0c88, 0x080c,
+	0x32e3, 0x1904, 0xd6e9, 0x6106, 0x080c, 0xe16e, 0x6007, 0x0006,
+	0x0804, 0xd4d6, 0x6007, 0x0007, 0x0804, 0xd4d6, 0x080c, 0xe7aa,
+	0x1904, 0xd6e9, 0x080c, 0x32e3, 0x1904, 0xd6e9, 0x00d6, 0x6610,
+	0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1220, 0x2001,
+	0x0001, 0x080c, 0x653b, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006,
+	0x0188, 0x9686, 0x0004, 0x0170, 0xbe04, 0x96b4, 0x00ff, 0x9686,
+	0x0006, 0x0140, 0x9686, 0x0004, 0x0128, 0x9686, 0x0005, 0x0110,
+	0x00de, 0x0480, 0x00e6, 0x2071, 0x0260, 0x7034, 0x9084, 0x0003,
+	0x1140, 0x7034, 0x9082, 0x0014, 0x0220, 0x7030, 0x9084, 0x0003,
+	0x0130, 0x00ee, 0x6017, 0x0000, 0x602f, 0x0007, 0x00b0, 0x00ee,
+	0x080c, 0xe281, 0x1190, 0x9686, 0x0006, 0x1140, 0x0026, 0x6210,
+	0x2258, 0xbaa0, 0x900e, 0x080c, 0x3208, 0x002e, 0x080c, 0x669a,
+	0x6007, 0x000a, 0x00de, 0x0804, 0xd4d6, 0x6007, 0x000b, 0x00de,
+	0x0804, 0xd4d6, 0x080c, 0x31bf, 0x080c, 0xd245, 0x6007, 0x0001,
+	0x0804, 0xd4d6, 0x080c, 0xe7aa, 0x1904, 0xd6e9, 0x080c, 0x32e3,
+	0x1904, 0xd6e9, 0x2071, 0x0260, 0x7034, 0x90b4, 0x0003, 0x1948,
+	0x90b2, 0x0014, 0x0a30, 0x7030, 0x9084, 0x0003, 0x1910, 0x6610,
+	0x2658, 0xbe04, 0x9686, 0x0707, 0x09e8, 0x0026, 0x6210, 0x2258,
+	0xbaa0, 0x900e, 0x080c, 0x3208, 0x002e, 0x6007, 0x000c, 0x2001,
+	0x0001, 0x080c, 0xe977, 0x0804, 0xd4d6, 0x080c, 0x6930, 0x1140,
+	0x2001, 0x1837, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110,
+	0x0804, 0xd301, 0x080c, 0x68cc, 0x6610, 0x2658, 0xbe04, 0x9684,
+	0x00ff, 0x9082, 0x0006, 0x06c8, 0x1138, 0x0026, 0x2001, 0x0006,
+	0x080c, 0x657b, 0x002e, 0x0050, 0x96b4, 0xff00, 0x8637, 0x9686,
+	0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xd3c2, 0x080c, 0xe28e,
+	0x1120, 0x6007, 0x000e, 0x0804, 0xd4d6, 0x0046, 0x6410, 0x2458,
+	0xbca0, 0x0046, 0x080c, 0x31bf, 0x080c, 0xd245, 0x004e, 0x0016,
+	0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029,
+	0x080c, 0xe5ae, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e,
+	0x004e, 0x6007, 0x0001, 0x0804, 0xd4d6, 0x2001, 0x0001, 0x080c,
+	0x653b, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
+	0x1805, 0x2011, 0x0270, 0x080c, 0xbe09, 0x003e, 0x002e, 0x001e,
+	0x015e, 0x9005, 0x0168, 0x96b4, 0xff00, 0x8637, 0x9682, 0x0004,
+	0x0a04, 0xd3c2, 0x9682, 0x0007, 0x0a04, 0xd41e, 0x0804, 0xd3c2,
+	0x6017, 0x1900, 0x6007, 0x0009, 0x0804, 0xd4d6, 0x080c, 0x6930,
+	0x1140, 0x2001, 0x1837, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008,
+	0x1110, 0x0804, 0xd301, 0x080c, 0x68cc, 0x6610, 0x2658, 0xbe04,
+	0x9684, 0x00ff, 0x9082, 0x0006, 0x0698, 0x0150, 0x96b4, 0xff00,
+	0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xd3c2,
+	0x080c, 0xe2bc, 0x1130, 0x080c, 0xe1b9, 0x1118, 0x6007, 0x0010,
+	0x04e8, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046, 0x080c, 0x31bf,
+	0x080c, 0xd245, 0x004e, 0x0016, 0x9006, 0x2009, 0x1848, 0x210c,
+	0xd1a4, 0x0148, 0x2009, 0x0029, 0x080c, 0xe5ae, 0x6010, 0x2058,
+	0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007, 0x0001, 0x00f0,
+	0x080c, 0xe441, 0x0140, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006,
+	0x0978, 0x0804, 0xd3c2, 0x6017, 0x1900, 0x6007, 0x0009, 0x0070,
+	0x080c, 0x32e3, 0x1904, 0xd6e9, 0x080c, 0xe7aa, 0x1904, 0xd6e9,
+	0x080c, 0xd8b6, 0x1904, 0xd3c2, 0x6007, 0x0012, 0x6003, 0x0001,
+	0x080c, 0x9138, 0x080c, 0x968d, 0x0005, 0x6007, 0x0001, 0x6003,
+	0x0001, 0x080c, 0x9138, 0x080c, 0x968d, 0x0cb0, 0x6007, 0x0005,
+	0x0c68, 0x080c, 0xe7aa, 0x1904, 0xd6e9, 0x080c, 0x32e3, 0x1904,
+	0xd6e9, 0x080c, 0xd8b6, 0x1904, 0xd3c2, 0x6007, 0x0020, 0x6003,
+	0x0001, 0x080c, 0x9138, 0x080c, 0x968d, 0x0005, 0x080c, 0x32e3,
+	0x1904, 0xd6e9, 0x6007, 0x0023, 0x6003, 0x0001, 0x080c, 0x9138,
+	0x080c, 0x968d, 0x0005, 0x080c, 0xe7aa, 0x1904, 0xd6e9, 0x080c,
+	0x32e3, 0x1904, 0xd6e9, 0x080c, 0xd8b6, 0x1904, 0xd3c2, 0x0016,
+	0x0026, 0x00e6, 0x2071, 0x0260, 0x7244, 0x9286, 0xffff, 0x0180,
+	0x2c08, 0x080c, 0xcb23, 0x01b0, 0x2260, 0x7240, 0x6008, 0x9206,
+	0x1188, 0x6010, 0x9190, 0x0004, 0x2214, 0x9206, 0x01b8, 0x0050,
+	0x7240, 0x2c08, 0x9006, 0x080c, 0xe578, 0x1180, 0x7244, 0x9286,
+	0xffff, 0x01b0, 0x2160, 0x6007, 0x0026, 0x6017, 0x1700, 0x7214,
+	0x9296, 0xffff, 0x1180, 0x6007, 0x0025, 0x0068, 0x6020, 0x9086,
+	0x0007, 0x1d80, 0x6004, 0x9086, 0x0024, 0x1110, 0x080c, 0xae61,
+	0x2160, 0x6007, 0x0025, 0x6003, 0x0001, 0x080c, 0x9138, 0x080c,
+	0x968d, 0x00ee, 0x002e, 0x001e, 0x0005, 0x2001, 0x0001, 0x080c,
+	0x653b, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
+	0x1805, 0x2011, 0x0276, 0x080c, 0xbe09, 0x003e, 0x002e, 0x001e,
+	0x015e, 0x0120, 0x6007, 0x0031, 0x0804, 0xd4d6, 0x080c, 0xba7d,
+	0x080c, 0x73bc, 0x1190, 0x0006, 0x0026, 0x0036, 0x080c, 0x73d6,
+	0x1138, 0x080c, 0x76a4, 0x080c, 0x601a, 0x080c, 0x72ee, 0x0010,
+	0x080c, 0x7394, 0x003e, 0x002e, 0x000e, 0x0005, 0x080c, 0x32e3,
+	0x1904, 0xd6e9, 0x080c, 0xd8b6, 0x1904, 0xd3c2, 0x6106, 0x080c,
+	0xd8d2, 0x1120, 0x6007, 0x002b, 0x0804, 0xd4d6, 0x6007, 0x002c,
+	0x0804, 0xd4d6, 0x080c, 0xe7aa, 0x1904, 0xd6e9, 0x080c, 0x32e3,
+	0x1904, 0xd6e9, 0x080c, 0xd8b6, 0x1904, 0xd3c2, 0x6106, 0x080c,
+	0xd8d7, 0x1120, 0x6007, 0x002e, 0x0804, 0xd4d6, 0x6007, 0x002f,
+	0x0804, 0xd4d6, 0x080c, 0x32e3, 0x1904, 0xd6e9, 0x00e6, 0x00d6,
+	0x00c6, 0x6010, 0x2058, 0xb904, 0x9184, 0x00ff, 0x9086, 0x0006,
+	0x0158, 0x9184, 0xff00, 0x8007, 0x9086, 0x0006, 0x0128, 0x00ce,
+	0x00de, 0x00ee, 0x0804, 0xd4dd, 0x080c, 0x56d3, 0xd0e4, 0x0904,
+	0xd634, 0x2071, 0x026c, 0x7010, 0x603a, 0x7014, 0x603e, 0x7108,
+	0x720c, 0x080c, 0x696e, 0x0140, 0x6010, 0x2058, 0xb810, 0x9106,
+	0x1118, 0xb814, 0x9206, 0x0510, 0x080c, 0x696a, 0x15b8, 0x2069,
+	0x1800, 0x6880, 0x9206, 0x1590, 0x687c, 0x9106, 0x1578, 0x7210,
+	0x080c, 0xcb23, 0x0590, 0x080c, 0xd7a1, 0x0578, 0x080c, 0xe62a,
+	0x0560, 0x622e, 0x6007, 0x0036, 0x6003, 0x0001, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x7214, 0x9286,
+	0xffff, 0x0150, 0x080c, 0xcb23, 0x01c0, 0x9280, 0x0002, 0x2004,
+	0x7110, 0x9106, 0x1190, 0x08e0, 0x7210, 0x2c08, 0x9085, 0x0001,
+	0x080c, 0xe578, 0x2c10, 0x2160, 0x0140, 0x0890, 0x6007, 0x0037,
+	0x602f, 0x0009, 0x6017, 0x1500, 0x08b8, 0x6007, 0x0037, 0x602f,
+	0x0003, 0x6017, 0x1700, 0x0880, 0x6007, 0x0012, 0x0868, 0x080c,
+	0x32e3, 0x1904, 0xd6e9, 0x6010, 0x2058, 0xb804, 0x9084, 0xff00,
+	0x8007, 0x9086, 0x0006, 0x1904, 0xd4dd, 0x00e6, 0x00d6, 0x00c6,
+	0x080c, 0x56d3, 0xd0e4, 0x0904, 0xd6ac, 0x2069, 0x1800, 0x2071,
+	0x026c, 0x7008, 0x603a, 0x720c, 0x623e, 0x9286, 0xffff, 0x1150,
+	0x7208, 0x00c6, 0x2c08, 0x9085, 0x0001, 0x080c, 0xe578, 0x2c10,
+	0x00ce, 0x05e8, 0x080c, 0xcb23, 0x05d0, 0x7108, 0x9280, 0x0002,
+	0x2004, 0x9106, 0x15a0, 0x00c6, 0x0026, 0x2260, 0x080c, 0xc75b,
+	0x002e, 0x00ce, 0x7118, 0x918c, 0xff00, 0x810f, 0x9186, 0x0001,
+	0x0178, 0x9186, 0x0005, 0x0118, 0x9186, 0x0007, 0x1198, 0x9280,
+	0x0005, 0x2004, 0x9005, 0x0170, 0x080c, 0xd7a1, 0x0904, 0xd62d,
+	0x0056, 0x7510, 0x7614, 0x080c, 0xe643, 0x005e, 0x00ce, 0x00de,
+	0x00ee, 0x0005, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017, 0x2a00,
+	0x6003, 0x0001, 0x080c, 0x90f0, 0x080c, 0x968d, 0x0c78, 0x6007,
+	0x003b, 0x602f, 0x0003, 0x6017, 0x0300, 0x6003, 0x0001, 0x080c,
+	0x90f0, 0x080c, 0x968d, 0x0c10, 0x6007, 0x003b, 0x602f, 0x000b,
+	0x6017, 0x0000, 0x0804, 0xd604, 0x00e6, 0x0026, 0x080c, 0x6930,
+	0x0550, 0x080c, 0x68cc, 0x080c, 0xe81c, 0x1518, 0x2071, 0x1800,
+	0x70dc, 0x9085, 0x0003, 0x70de, 0x00f6, 0x2079, 0x0100, 0x72b0,
+	0x9284, 0x00ff, 0x707e, 0x78e6, 0x9284, 0xff00, 0x7280, 0x9205,
+	0x7082, 0x78ea, 0x00fe, 0x70e7, 0x0000, 0x080c, 0x696e, 0x0120,
+	0x2011, 0x1a00, 0x2013, 0x07d0, 0xd0ac, 0x1128, 0x080c, 0x2f96,
+	0x0010, 0x080c, 0xe84e, 0x002e, 0x00ee, 0x080c, 0xae61, 0x0804,
+	0xd4dc, 0x080c, 0xae61, 0x0005, 0x2600, 0x0002, 0xd700, 0xd731,
+	0xd742, 0xd700, 0xd700, 0xd702, 0xd753, 0xd700, 0xd700, 0xd700,
+	0xd71f, 0xd700, 0xd700, 0xd700, 0xd75e, 0xd76b, 0xd79c, 0xd700,
+	0x080c, 0x0dd5, 0x080c, 0xe7aa, 0x1d20, 0x080c, 0x32e3, 0x1d08,
+	0x080c, 0xd8b6, 0x1148, 0x7038, 0x6016, 0x6007, 0x0045, 0x6003,
+	0x0001, 0x080c, 0x9138, 0x0005, 0x080c, 0x31bf, 0x080c, 0xd245,
+	0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9138, 0x0005, 0x080c,
+	0xe7aa, 0x1938, 0x080c, 0x32e3, 0x1920, 0x080c, 0xd8b6, 0x1d60,
+	0x703c, 0x6016, 0x6007, 0x004a, 0x6003, 0x0001, 0x080c, 0x9138,
+	0x0005, 0x080c, 0x32e3, 0x1904, 0xd6e9, 0x2009, 0x0041, 0x080c,
+	0xe857, 0x6007, 0x0047, 0x6003, 0x0001, 0x080c, 0x9138, 0x080c,
+	0x968d, 0x0005, 0x080c, 0x32e3, 0x1904, 0xd6e9, 0x2009, 0x0042,
+	0x080c, 0xe857, 0x6007, 0x0047, 0x6003, 0x0001, 0x080c, 0x9138,
+	0x080c, 0x968d, 0x0005, 0x080c, 0x32e3, 0x1904, 0xd6e9, 0x2009,
+	0x0046, 0x080c, 0xe857, 0x080c, 0xae61, 0x0005, 0x080c, 0xd7be,
+	0x0904, 0xd6e9, 0x6007, 0x004e, 0x6003, 0x0001, 0x080c, 0x9138,
+	0x080c, 0x968d, 0x0005, 0x6007, 0x004f, 0x6017, 0x0000, 0x7134,
+	0x918c, 0x00ff, 0x81ff, 0x0508, 0x9186, 0x0001, 0x1160, 0x7140,
+	0x2001, 0x19bd, 0x2004, 0x9106, 0x11b0, 0x7144, 0x2001, 0x19be,
+	0x2004, 0x9106, 0x0190, 0x9186, 0x0002, 0x1168, 0x2011, 0x0276,
+	0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c,
+	0xbe1d, 0x009e, 0x0110, 0x6017, 0x0001, 0x6003, 0x0001, 0x080c,
+	0x9138, 0x080c, 0x968d, 0x0005, 0x6007, 0x0050, 0x703c, 0x6016,
+	0x0ca0, 0x0016, 0x00e6, 0x2071, 0x0260, 0x00b6, 0x00c6, 0x2260,
+	0x6010, 0x2058, 0xb8cc, 0xd084, 0x0150, 0x7128, 0x6048, 0x9106,
+	0x1120, 0x712c, 0x6044, 0x9106, 0x0110, 0x9006, 0x0010, 0x9085,
+	0x0001, 0x00ce, 0x00be, 0x00ee, 0x001e, 0x0005, 0x0016, 0x0096,
+	0x0086, 0x00e6, 0x01c6, 0x01d6, 0x0126, 0x2091, 0x8000, 0x2071,
+	0x1800, 0x7090, 0x908a, 0x00f9, 0x16e8, 0x20e1, 0x0000, 0x2001,
+	0x19a0, 0x2003, 0x0000, 0x080c, 0x1018, 0x05a0, 0x2900, 0x6016,
+	0x7090, 0x8004, 0xa816, 0x908a, 0x001e, 0x02d0, 0xa833, 0x001e,
+	0x20a9, 0x001e, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0,
+	0x2001, 0x19a0, 0x0016, 0x200c, 0x0471, 0x001e, 0x2940, 0x080c,
+	0x1018, 0x01c0, 0x2900, 0xa006, 0x2100, 0x81ff, 0x0180, 0x0c18,
+	0xa832, 0x20a8, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0,
+	0x2001, 0x19a0, 0x0016, 0x200c, 0x00b1, 0x001e, 0x0000, 0x9085,
+	0x0001, 0x0048, 0x2071, 0x1800, 0x7093, 0x0000, 0x6014, 0x2048,
+	0x080c, 0x0fb1, 0x9006, 0x012e, 0x01de, 0x01ce, 0x00ee, 0x008e,
+	0x009e, 0x001e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00c6,
+	0x918c, 0xffff, 0x11a8, 0x080c, 0x23ab, 0x2099, 0x026c, 0x2001,
+	0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x00f8, 0x20a8,
+	0x4003, 0x22a8, 0x8108, 0x080c, 0x23ab, 0x2099, 0x0260, 0x0ca8,
+	0x080c, 0x23ab, 0x2061, 0x19a0, 0x6004, 0x2098, 0x6008, 0x3518,
+	0x9312, 0x1218, 0x23a8, 0x4003, 0x0048, 0x20a8, 0x4003, 0x22a8,
+	0x8108, 0x080c, 0x23ab, 0x2099, 0x0260, 0x0ca8, 0x2061, 0x19a0,
+	0x2019, 0x0280, 0x3300, 0x931e, 0x0110, 0x6006, 0x0020, 0x2001,
+	0x0260, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021, 0x9296, 0xffff,
+	0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006,
+	0x0016, 0x0026, 0x0036, 0x00c6, 0x81ff, 0x11b8, 0x080c, 0x23c3,
+	0x20a1, 0x024c, 0x2001, 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8,
+	0x4003, 0x0418, 0x20a8, 0x4003, 0x82ff, 0x01f8, 0x22a8, 0x8108,
+	0x080c, 0x23c3, 0x20a1, 0x0240, 0x0c98, 0x080c, 0x23c3, 0x2061,
+	0x19a3, 0x6004, 0x20a0, 0x6008, 0x3518, 0x9312, 0x1218, 0x23a8,
+	0x4003, 0x0058, 0x20a8, 0x4003, 0x82ff, 0x0138, 0x22a8, 0x8108,
+	0x080c, 0x23c3, 0x20a1, 0x0240, 0x0c98, 0x2061, 0x19a3, 0x2019,
+	0x0260, 0x3400, 0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0240,
+	0x6006, 0x8108, 0x2162, 0x9292, 0x0021, 0x9296, 0xffff, 0x620a,
+	0x00ce, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x00b6, 0x0066,
 	0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006,
-	0x0904, 0xda83, 0x9686, 0x0004, 0x0904, 0xda83, 0x080c, 0x8c92,
-	0x2001, 0x0004, 0x0804, 0xda81, 0x2001, 0x1800, 0x2004, 0x9086,
-	0x0003, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021,
-	0x0006, 0x080c, 0x4cbc, 0x004e, 0x003e, 0x2001, 0x0006, 0x080c,
-	0xdaa7, 0x6610, 0x2658, 0xbe04, 0x0066, 0x96b4, 0xff00, 0x8637,
-	0x9686, 0x0006, 0x006e, 0x0168, 0x2001, 0x0006, 0x080c, 0x657c,
-	0x9284, 0x00ff, 0x908e, 0x0007, 0x1120, 0x2001, 0x0006, 0x080c,
-	0x6550, 0x080c, 0x6962, 0x11f8, 0x2001, 0x1837, 0x2004, 0xd0a4,
-	0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x01a0, 0x00f6,
-	0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x0804, 0xda08,
-	0x2001, 0x0004, 0x0030, 0x2001, 0x0006, 0x0449, 0x0020, 0x0018,
-	0x0010, 0x080c, 0x657c, 0x080c, 0x955f, 0x080c, 0xae47, 0x080c,
-	0x9664, 0x0005, 0x2600, 0x0002, 0xda9e, 0xda9e, 0xda9e, 0xda9e,
-	0xda9e, 0xdaa0, 0xda9e, 0xdaa0, 0xda9e, 0xda9e, 0xdaa0, 0xda9e,
-	0xda9e, 0xda9e, 0xdaa0, 0xdaa0, 0xdaa0, 0xdaa0, 0x080c, 0x0dd5,
-	0x080c, 0x955f, 0x080c, 0xae47, 0x080c, 0x9664, 0x0005, 0x0016,
-	0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900, 0xd184, 0x0138, 0x080c,
-	0x6550, 0x9006, 0x080c, 0x653c, 0x080c, 0x31e1, 0x00de, 0x00be,
-	0x001e, 0x0005, 0x6610, 0x2658, 0xb804, 0x9084, 0xff00, 0x8007,
-	0x90b2, 0x000c, 0x1a0c, 0x0dd5, 0x91b6, 0x0015, 0x1110, 0x003b,
-	0x0028, 0x91b6, 0x0016, 0x190c, 0x0dd5, 0x006b, 0x0005, 0xb8e2,
-	0xb8e2, 0xb8e2, 0xb8e2, 0xb8e2, 0xb8e2, 0xdb22, 0xdae7, 0xb8e2,
-	0xb8e2, 0xb8e2, 0xb8e2, 0xb8e2, 0xb8e2, 0xb8e2, 0xb8e2, 0xb8e2,
-	0xb8e2, 0xdb22, 0xdb29, 0xb8e2, 0xb8e2, 0xb8e2, 0xb8e2, 0x00f6,
-	0x080c, 0x6962, 0x11d8, 0x080c, 0xd216, 0x11c0, 0x6010, 0x905d,
-	0x01a8, 0xb8c0, 0x9005, 0x0190, 0x9006, 0x080c, 0x653c, 0x2001,
-	0x0002, 0x080c, 0x6550, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007,
-	0x0002, 0x080c, 0x910f, 0x080c, 0x9664, 0x00d0, 0x2011, 0x0263,
-	0x2204, 0x8211, 0x220c, 0x080c, 0x283e, 0x1190, 0x080c, 0x6600,
-	0x0118, 0x080c, 0xae47, 0x0060, 0xb810, 0x0006, 0xb814, 0x0006,
-	0x080c, 0x6035, 0x000e, 0xb816, 0x000e, 0xb812, 0x080c, 0xae47,
-	0x00fe, 0x0005, 0x6604, 0x96b6, 0x001e, 0x1110, 0x080c, 0xae47,
-	0x0005, 0x080c, 0xbc6b, 0x1148, 0x6003, 0x0001, 0x6007, 0x0001,
-	0x080c, 0x910f, 0x080c, 0x9664, 0x0010, 0x080c, 0xae47, 0x0005,
-	0x6004, 0x908a, 0x0053, 0x1a0c, 0x0dd5, 0x080c, 0x955f, 0x080c,
-	0xae78, 0x080c, 0x9664, 0x0005, 0x9182, 0x0040, 0x0002, 0xdb5a,
-	0xdb5a, 0xdb5a, 0xdb5a, 0xdb5c, 0xdb5a, 0xdb5a, 0xdb5a, 0xdb5a,
-	0xdb5a, 0xdb5a, 0xdb5a, 0xdb5a, 0xdb5a, 0xdb5a, 0xdb5a, 0xdb5a,
-	0xdb5a, 0xdb5a, 0x080c, 0x0dd5, 0x0096, 0x00b6, 0x00d6, 0x00e6,
-	0x00f6, 0x0046, 0x0026, 0x6210, 0x2258, 0xb8bc, 0x9005, 0x11a8,
-	0x6106, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904, 0xdbc2,
-	0x080c, 0xe94a, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009, 0x0001,
-	0x2011, 0x0200, 0x080c, 0x86b4, 0x0020, 0x9026, 0x080c, 0xe7ce,
-	0x0c38, 0x080c, 0x0fff, 0x090c, 0x0dd5, 0x6003, 0x0007, 0xa867,
-	0x010d, 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e, 0x6008,
-	0xa8e2, 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016, 0xa876,
-	0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c, 0x6c79,
-	0x001e, 0x080c, 0xe94a, 0x1904, 0xdc22, 0x9486, 0x2000, 0x1130,
-	0x2019, 0x0017, 0x080c, 0xe501, 0x0804, 0xdc22, 0x9486, 0x0200,
-	0x1120, 0x080c, 0xe49d, 0x0804, 0xdc22, 0x9486, 0x0400, 0x0120,
-	0x9486, 0x1000, 0x1904, 0xdc22, 0x2019, 0x0002, 0x080c, 0xe4b8,
-	0x0804, 0xdc22, 0x2069, 0x1a71, 0x6a00, 0xd284, 0x0904, 0xdc8c,
-	0x9284, 0x0300, 0x1904, 0xdc85, 0x6804, 0x9005, 0x0904, 0xdc6d,
-	0x2d78, 0x6003, 0x0007, 0x080c, 0x1018, 0x0904, 0xdc2e, 0x7800,
-	0xd08c, 0x1118, 0x7804, 0x8001, 0x7806, 0x6017, 0x0000, 0x2001,
-	0x180f, 0x2004, 0xd084, 0x1904, 0xdc90, 0x9006, 0xa802, 0xa867,
-	0x0116, 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010, 0x2058,
-	0xb8a0, 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c, 0xa9be,
-	0xb930, 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044, 0x9084,
-	0x0003, 0x9080, 0xdc2a, 0x2005, 0xa87e, 0x20a9, 0x000a, 0x2001,
-	0x0270, 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205, 0x200b, 0x0080,
-	0x20e1, 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003, 0x200b,
-	0x0000, 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c, 0xa9ae,
-	0x080c, 0x6c79, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de, 0x00be,
-	0x009e, 0x0005, 0x0000, 0x0080, 0x0040, 0x0000, 0x2001, 0x1810,
-	0x2004, 0xd084, 0x0120, 0x080c, 0x0fff, 0x1904, 0xdbd7, 0x6017,
-	0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x90c7, 0x080c,
-	0x9664, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00, 0x9086,
-	0x1200, 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114, 0x918c,
-	0xf700, 0x910d, 0x6116, 0x001e, 0x6003, 0x0001, 0x6007, 0x0043,
-	0x080c, 0x90c7, 0x080c, 0x9664, 0x0828, 0x6868, 0x602e, 0x686c,
-	0x6032, 0x6017, 0xf200, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
-	0x90c7, 0x080c, 0x9664, 0x0804, 0xdc22, 0x2001, 0x180e, 0x2004,
-	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4b05, 0x6017, 0xf300,
-	0x0010, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
-	0x90c7, 0x080c, 0x9664, 0x0804, 0xdc22, 0x6017, 0xf500, 0x0c98,
-	0x6017, 0xf600, 0x0804, 0xdc42, 0x6017, 0xf200, 0x0804, 0xdc42,
-	0xa867, 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00, 0xa87a,
-	0x7044, 0x9084, 0x0003, 0x9080, 0xdc2a, 0x2005, 0xa87e, 0x2928,
-	0x6010, 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c, 0xa88e,
-	0xb830, 0xa892, 0xb834, 0xa896, 0xa883, 0x003d, 0x2009, 0x0205,
-	0x2104, 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011, 0x0210,
-	0x2214, 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c, 0x0dd5,
-	0x8210, 0x821c, 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8, 0xa85c,
-	0x9080, 0x0029, 0x20a0, 0x2011, 0xdd0c, 0x2041, 0x0001, 0x223d,
-	0x9784, 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003, 0x931a,
-	0x0530, 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001, 0x0260,
-	0x2098, 0x0c68, 0x2950, 0x080c, 0x1018, 0x0170, 0x2900, 0xb002,
-	0xa867, 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c, 0x9080,
-	0x001b, 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d, 0x0118,
-	0x080c, 0x1031, 0x0cc8, 0x080c, 0x1031, 0x0804, 0xdc2e, 0x2548,
-	0x8847, 0x9885, 0x0046, 0xa866, 0x2009, 0x0205, 0x200b, 0x0000,
-	0x080c, 0xe530, 0x0804, 0xdc22, 0x8010, 0x0004, 0x801a, 0x0006,
-	0x8018, 0x0008, 0x8016, 0x000a, 0x8014, 0x9186, 0x0013, 0x1160,
-	0x6004, 0x908a, 0x0054, 0x1a0c, 0x0dd5, 0x9082, 0x0040, 0x0a0c,
-	0x0dd5, 0x2008, 0x0804, 0xddbd, 0x9186, 0x0051, 0x0108, 0x00c0,
-	0x2001, 0x0109, 0x2004, 0xd084, 0x0904, 0xdd6e, 0x0126, 0x2091,
-	0x2800, 0x0006, 0x0016, 0x0026, 0x080c, 0x8fac, 0x002e, 0x001e,
-	0x000e, 0x012e, 0x6000, 0x9086, 0x0002, 0x1580, 0x0804, 0xde05,
-	0x9186, 0x0027, 0x0530, 0x9186, 0x0048, 0x0128, 0x9186, 0x0014,
-	0x0500, 0x190c, 0x0dd5, 0x2001, 0x0109, 0x2004, 0xd084, 0x01f0,
-	0x00c6, 0x0126, 0x2091, 0x2800, 0x00c6, 0x2061, 0x0100, 0x0006,
-	0x0016, 0x0026, 0x080c, 0x8fac, 0x002e, 0x001e, 0x000e, 0x00ce,
-	0x012e, 0x00ce, 0x6000, 0x9086, 0x0004, 0x190c, 0x0dd5, 0x0804,
-	0xdee6, 0x6004, 0x9082, 0x0040, 0x2008, 0x001a, 0x080c, 0xaedd,
-	0x0005, 0xdd84, 0xdd86, 0xdd86, 0xddad, 0xdd84, 0xdd84, 0xdd84,
-	0xdd84, 0xdd84, 0xdd84, 0xdd84, 0xdd84, 0xdd84, 0xdd84, 0xdd84,
-	0xdd84, 0xdd84, 0xdd84, 0xdd84, 0x080c, 0x0dd5, 0x080c, 0x955f,
-	0x080c, 0x9664, 0x0036, 0x0096, 0x6014, 0x904d, 0x01d8, 0x080c,
-	0xcb1b, 0x01c0, 0x6003, 0x0002, 0x6010, 0x00b6, 0x2058, 0xb800,
-	0x00be, 0xd0bc, 0x1178, 0x2019, 0x0004, 0x080c, 0xe530, 0x6017,
-	0x0000, 0x6018, 0x9005, 0x1120, 0x2001, 0x1987, 0x2004, 0x601a,
-	0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x0096, 0x080c, 0x955f,
-	0x080c, 0x9664, 0x080c, 0xcb1b, 0x0120, 0x6014, 0x2048, 0x080c,
-	0x1031, 0x080c, 0xae78, 0x009e, 0x0005, 0x0002, 0xddd1, 0xdde8,
-	0xddd3, 0xddff, 0xddd1, 0xddd1, 0xddd1, 0xddd1, 0xddd1, 0xddd1,
-	0xddd1, 0xddd1, 0xddd1, 0xddd1, 0xddd1, 0xddd1, 0xddd1, 0xddd1,
-	0xddd1, 0x080c, 0x0dd5, 0x0096, 0x080c, 0x955f, 0x6014, 0x2048,
-	0xa87c, 0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009, 0x0043, 0x080c,
-	0xaec2, 0x0010, 0x6003, 0x0004, 0x080c, 0x9664, 0x009e, 0x0005,
-	0x080c, 0x955f, 0x080c, 0xcb1b, 0x0138, 0x6114, 0x0096, 0x2148,
-	0xa97c, 0x009e, 0xd1ec, 0x1138, 0x080c, 0x8689, 0x080c, 0xae47,
-	0x080c, 0x9664, 0x0005, 0x080c, 0xe792, 0x0db0, 0x0cc8, 0x080c,
-	0x955f, 0x2009, 0x0041, 0x0804, 0xdf6e, 0x9182, 0x0040, 0x0002,
-	0xde1b, 0xde1d, 0xde1b, 0xde1b, 0xde1b, 0xde1b, 0xde1b, 0xde1b,
-	0xde1b, 0xde1b, 0xde1b, 0xde1b, 0xde1b, 0xde1b, 0xde1b, 0xde1b,
-	0xde1b, 0xde1e, 0xde1b, 0x080c, 0x0dd5, 0x0005, 0x00d6, 0x080c,
-	0x8689, 0x00de, 0x080c, 0xe7ea, 0x080c, 0xae47, 0x0005, 0x9182,
-	0x0040, 0x0002, 0xde3d, 0xde3d, 0xde3d, 0xde3d, 0xde3d, 0xde3d,
-	0xde3d, 0xde3d, 0xde3d, 0xde3f, 0xdeae, 0xde3d, 0xde3d, 0xde3d,
-	0xde3d, 0xdeae, 0xde3d, 0xde3d, 0xde3d, 0x080c, 0x0dd5, 0x2001,
-	0x0105, 0x2004, 0x9084, 0x1800, 0x01c8, 0x2001, 0x0132, 0x200c,
-	0x2001, 0x0131, 0x2004, 0x9105, 0x1904, 0xdeae, 0x2009, 0x180c,
-	0x2104, 0xd0d4, 0x0904, 0xdeae, 0xc0d4, 0x200a, 0x2009, 0x0105,
-	0x2104, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x200a, 0x2001, 0x1867,
-	0x2004, 0xd0e4, 0x1528, 0x603b, 0x0000, 0x080c, 0x9614, 0x6014,
-	0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0188, 0x908c, 0x0003, 0x918e,
-	0x0002, 0x0508, 0x2001, 0x180c, 0x2004, 0xd0d4, 0x11e0, 0x080c,
-	0x9790, 0x2009, 0x0041, 0x009e, 0x0804, 0xdf6e, 0x080c, 0x9790,
-	0x6003, 0x0007, 0x601b, 0x0000, 0x080c, 0x8689, 0x009e, 0x0005,
-	0x2001, 0x0100, 0x2004, 0x9082, 0x0005, 0x0aa8, 0x2001, 0x011f,
-	0x2004, 0x603a, 0x0890, 0x2001, 0x180c, 0x200c, 0xc1d4, 0x2102,
-	0xd1cc, 0x0110, 0x080c, 0x2c52, 0x080c, 0x9790, 0x6014, 0x2048,
-	0xa97c, 0xd1ec, 0x1130, 0x080c, 0x8689, 0x080c, 0xae47, 0x009e,
-	0x0005, 0x080c, 0xe792, 0x0db8, 0x009e, 0x0005, 0x2001, 0x180c,
-	0x200c, 0xc1d4, 0x2102, 0x0036, 0x080c, 0x9614, 0x080c, 0x9790,
-	0x6014, 0x0096, 0x2048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-	0xd0bc, 0x0188, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x0140,
-	0xa8ac, 0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c, 0x931b, 0x632e,
-	0x6003, 0x0002, 0x0080, 0x2019, 0x0004, 0x080c, 0xe530, 0x6018,
-	0x9005, 0x1128, 0x2001, 0x1987, 0x2004, 0x8003, 0x601a, 0x6017,
-	0x0000, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x9182, 0x0040,
-	0x0002, 0xdefd, 0xdefd, 0xdefd, 0xdefd, 0xdefd, 0xdefd, 0xdefd,
-	0xdefd, 0xdeff, 0xdefd, 0xdefd, 0xdefd, 0xdefd, 0xdefd, 0xdefd,
-	0xdefd, 0xdefd, 0xdefd, 0xdefd, 0xdf4a, 0x080c, 0x0dd5, 0x6014,
-	0x0096, 0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6, 0x2158, 0xb900,
-	0x00be, 0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c, 0xd0fc, 0x0128,
-	0x2009, 0x0041, 0x009e, 0x0804, 0xdf6e, 0x6003, 0x0007, 0x601b,
-	0x0000, 0x080c, 0x8689, 0x009e, 0x0005, 0x6124, 0xd1f4, 0x1d58,
-	0x0006, 0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200, 0x910b, 0x6030,
-	0x9420, 0x6432, 0x602c, 0x9109, 0x612e, 0x004e, 0x000e, 0x08d8,
-	0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1178, 0x2009,
-	0x180e, 0x210c, 0xd19c, 0x0118, 0x6003, 0x0007, 0x0010, 0x6003,
-	0x0006, 0x00e9, 0x080c, 0x868b, 0x009e, 0x0005, 0x6003, 0x0002,
-	0x009e, 0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c, 0x15e5, 0x1904,
-	0xdeff, 0x0005, 0x6014, 0x0096, 0x2048, 0xa834, 0xa938, 0x009e,
-	0x9105, 0x1120, 0x080c, 0x15e5, 0x1904, 0xdeff, 0x0005, 0xd2fc,
-	0x0140, 0x8002, 0x8000, 0x8212, 0x9291, 0x0000, 0x2009, 0x0009,
-	0x0010, 0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005, 0x9182, 0x0040,
-	0x0208, 0x0062, 0x9186, 0x0013, 0x0120, 0x9186, 0x0014, 0x190c,
-	0x0dd5, 0x6024, 0xd0dc, 0x090c, 0x0dd5, 0x0005, 0xdf91, 0xdf9d,
-	0xdfa9, 0xdfb5, 0xdf91, 0xdf91, 0xdf91, 0xdf91, 0xdf98, 0xdf93,
-	0xdf93, 0xdf91, 0xdf91, 0xdf91, 0xdf91, 0xdf93, 0xdf91, 0xdf93,
-	0xdf91, 0x080c, 0x0dd5, 0x6024, 0xd0dc, 0x090c, 0x0dd5, 0x0005,
-	0x6014, 0x9005, 0x190c, 0x0dd5, 0x0005, 0x6003, 0x0001, 0x6106,
-	0x080c, 0x90c7, 0x0126, 0x2091, 0x8000, 0x080c, 0x9664, 0x012e,
-	0x0005, 0x6003, 0x0001, 0x6106, 0x080c, 0x90c7, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x9664, 0x012e, 0x0005, 0x6003, 0x0003, 0x6106,
-	0x2c10, 0x080c, 0x1bad, 0x0126, 0x2091, 0x8000, 0x080c, 0x912c,
-	0x080c, 0x9790, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0036,
-	0x0096, 0x9182, 0x0040, 0x0023, 0x009e, 0x003e, 0x012e, 0x0005,
-	0xdfe0, 0xdfe2, 0xdff4, 0xe00e, 0xdfe0, 0xdfe0, 0xdfe0, 0xdfe0,
-	0xdfe0, 0xdfe0, 0xdfe0, 0xdfe0, 0xdfe0, 0xdfe0, 0xdfe0, 0xdfe0,
-	0x080c, 0x0dd5, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x01f8, 0x909c,
-	0x0003, 0x939e, 0x0003, 0x01d0, 0x6003, 0x0001, 0x6106, 0x080c,
-	0x90c7, 0x080c, 0x9664, 0x0470, 0x6014, 0x2048, 0xa87c, 0xd0fc,
-	0x0168, 0x909c, 0x0003, 0x939e, 0x0003, 0x0140, 0x6003, 0x0001,
-	0x6106, 0x080c, 0x90c7, 0x080c, 0x9664, 0x00e0, 0x901e, 0x6316,
-	0x631a, 0x2019, 0x0004, 0x080c, 0xe530, 0x00a0, 0x6014, 0x2048,
-	0xa87c, 0xd0fc, 0x0d98, 0x909c, 0x0003, 0x939e, 0x0003, 0x0d70,
-	0x6003, 0x0003, 0x6106, 0x2c10, 0x080c, 0x1bad, 0x080c, 0x912c,
-	0x080c, 0x9790, 0x0005, 0x080c, 0x955f, 0x6114, 0x81ff, 0x0158,
-	0x0096, 0x2148, 0x080c, 0xe8e7, 0x0036, 0x2019, 0x0029, 0x080c,
-	0xe530, 0x003e, 0x009e, 0x080c, 0xae78, 0x080c, 0x9664, 0x0005,
-	0x080c, 0x9614, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c,
-	0xe8e7, 0x0036, 0x2019, 0x0029, 0x080c, 0xe530, 0x003e, 0x009e,
-	0x080c, 0xae78, 0x080c, 0x9790, 0x0005, 0x9182, 0x0085, 0x0002,
-	0xe05f, 0xe05d, 0xe05d, 0xe06b, 0xe05d, 0xe05d, 0xe05d, 0xe05d,
-	0xe05d, 0xe05d, 0xe05d, 0xe05d, 0xe05d, 0x080c, 0x0dd5, 0x6003,
-	0x000b, 0x6106, 0x080c, 0x90c7, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x9664, 0x012e, 0x0005, 0x0026, 0x00e6, 0x080c, 0xe789, 0x0118,
-	0x080c, 0xae47, 0x0450, 0x2071, 0x0260, 0x7224, 0x6216, 0x2001,
-	0x180e, 0x2004, 0xd0e4, 0x0150, 0x6010, 0x00b6, 0x2058, 0xbca0,
-	0x00be, 0x2c00, 0x2011, 0x014e, 0x080c, 0xb168, 0x7220, 0x080c,
-	0xe3d6, 0x0118, 0x6007, 0x0086, 0x0040, 0x6007, 0x0087, 0x7224,
-	0x9296, 0xffff, 0x1110, 0x6007, 0x0086, 0x6003, 0x0001, 0x080c,
-	0x90c7, 0x080c, 0x9664, 0x080c, 0x9790, 0x00ee, 0x002e, 0x0005,
-	0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dd5,
-	0x908a, 0x0092, 0x1a0c, 0x0dd5, 0x9082, 0x0085, 0x00a2, 0x9186,
-	0x0027, 0x0130, 0x9186, 0x0014, 0x0118, 0x080c, 0xaedd, 0x0050,
-	0x2001, 0x0007, 0x080c, 0x657c, 0x080c, 0x955f, 0x080c, 0xae78,
-	0x080c, 0x9664, 0x0005, 0xe0d0, 0xe0d2, 0xe0d2, 0xe0d0, 0xe0d0,
-	0xe0d0, 0xe0d0, 0xe0d0, 0xe0d0, 0xe0d0, 0xe0d0, 0xe0d0, 0xe0d0,
-	0x080c, 0x0dd5, 0x080c, 0x955f, 0x080c, 0xae78, 0x080c, 0x9664,
-	0x0005, 0x9182, 0x0085, 0x0a0c, 0x0dd5, 0x9182, 0x0092, 0x1a0c,
-	0x0dd5, 0x9182, 0x0085, 0x0002, 0xe0f1, 0xe0f1, 0xe0f1, 0xe0f3,
-	0xe0f1, 0xe0f1, 0xe0f1, 0xe0f1, 0xe0f1, 0xe0f1, 0xe0f1, 0xe0f1,
-	0xe0f1, 0x080c, 0x0dd5, 0x0005, 0x9186, 0x0013, 0x0148, 0x9186,
-	0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xaedd, 0x0030,
-	0x080c, 0x955f, 0x080c, 0xae78, 0x080c, 0x9664, 0x0005, 0x0036,
-	0x080c, 0xe7ea, 0x6043, 0x0000, 0x2019, 0x000b, 0x0031, 0x6023,
-	0x0006, 0x6003, 0x0007, 0x003e, 0x0005, 0x0126, 0x0036, 0x2091,
-	0x8000, 0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0xa682, 0x009e,
-	0x008e, 0x1550, 0x0076, 0x2c38, 0x080c, 0xa72d, 0x007e, 0x1520,
-	0x6000, 0x9086, 0x0000, 0x0500, 0x6020, 0x9086, 0x0007, 0x01e0,
-	0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xe7ea, 0x080c, 0xd22e,
-	0x080c, 0x1a5e, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xcb1b,
-	0x0110, 0x080c, 0xe530, 0x009e, 0x6017, 0x0000, 0x080c, 0xe7ea,
-	0x6023, 0x0007, 0x080c, 0xd22e, 0x003e, 0x012e, 0x0005, 0x00f6,
-	0x00c6, 0x00b6, 0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c,
-	0x080c, 0x283e, 0x15b8, 0x0016, 0x00c6, 0x080c, 0x6600, 0x1580,
-	0x001e, 0x00c6, 0x2160, 0x080c, 0xd22b, 0x00ce, 0x002e, 0x0026,
-	0x0016, 0x2019, 0x0029, 0x080c, 0xa7ee, 0x080c, 0x9262, 0x0076,
-	0x903e, 0x080c, 0x913f, 0x007e, 0x001e, 0x0076, 0x903e, 0x080c,
-	0xe2ca, 0x007e, 0x0026, 0xba04, 0x9294, 0xff00, 0x8217, 0x9286,
-	0x0006, 0x0118, 0x9286, 0x0004, 0x1118, 0xbaa0, 0x080c, 0x3276,
-	0x002e, 0x001e, 0x080c, 0x6035, 0xbe12, 0xbd16, 0x9006, 0x0010,
-	0x00ce, 0x001e, 0x015e, 0x003e, 0x00be, 0x00ce, 0x00fe, 0x0005,
-	0x00c6, 0x00d6, 0x00b6, 0x0016, 0x2009, 0x1824, 0x2104, 0x9086,
-	0x0074, 0x1904, 0xe1f1, 0x2069, 0x0260, 0x6944, 0x9182, 0x0100,
-	0x06e0, 0x6940, 0x9184, 0x8000, 0x0904, 0xe1ee, 0x2001, 0x197c,
-	0x2004, 0x9005, 0x1140, 0x6010, 0x2058, 0xb8c0, 0x9005, 0x0118,
-	0x9184, 0x0800, 0x0598, 0x6948, 0x918a, 0x0001, 0x0648, 0x080c,
-	0xe94f, 0x0118, 0x6978, 0xd1fc, 0x11b8, 0x2009, 0x0205, 0x200b,
-	0x0001, 0x693c, 0x81ff, 0x1198, 0x6944, 0x9182, 0x0100, 0x02a8,
-	0x6940, 0x81ff, 0x1178, 0x6948, 0x918a, 0x0001, 0x0288, 0x6950,
-	0x918a, 0x0001, 0x0298, 0x00d0, 0x6017, 0x0100, 0x00a0, 0x6017,
-	0x0300, 0x0088, 0x6017, 0x0500, 0x0070, 0x6017, 0x0700, 0x0058,
-	0x6017, 0x0900, 0x0040, 0x6017, 0x0b00, 0x0028, 0x6017, 0x0f00,
-	0x0010, 0x6017, 0x2d00, 0x9085, 0x0001, 0x0008, 0x9006, 0x001e,
-	0x00be, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00b6, 0x0026, 0x0036,
-	0x0156, 0x6210, 0x2258, 0xbb04, 0x9394, 0x00ff, 0x9286, 0x0006,
-	0x0180, 0x9286, 0x0004, 0x0168, 0x9394, 0xff00, 0x8217, 0x9286,
-	0x0006, 0x0138, 0x9286, 0x0004, 0x0120, 0x080c, 0x660f, 0x0804,
-	0xe259, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019,
-	0x000a, 0x080c, 0xbe03, 0x009e, 0x15a8, 0x2011, 0x027a, 0x20a9,
-	0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xbe03, 0x009e,
-	0x1548, 0x0046, 0x0016, 0xbaa0, 0x2220, 0x9006, 0x2009, 0x1848,
-	0x210c, 0xd1a4, 0x0138, 0x2009, 0x0029, 0x080c, 0xe58d, 0xb800,
-	0xc0e5, 0xb802, 0x2019, 0x0029, 0x080c, 0x9262, 0x0076, 0x2039,
-	0x0000, 0x080c, 0x913f, 0x2c08, 0x080c, 0xe2ca, 0x007e, 0x2001,
-	0x0007, 0x080c, 0x657c, 0x2001, 0x0007, 0x080c, 0x6550, 0x001e,
-	0x004e, 0x9006, 0x015e, 0x003e, 0x002e, 0x00be, 0x00ce, 0x0005,
-	0x00d6, 0x2069, 0x026e, 0x6800, 0x9086, 0x0800, 0x0118, 0x6017,
-	0x0000, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6, 0x00f6, 0x0016,
-	0x0026, 0x0036, 0x0156, 0x2079, 0x026c, 0x7930, 0x7834, 0x080c,
-	0x283e, 0x11d0, 0x080c, 0x6600, 0x11b8, 0x2011, 0x0270, 0x20a9,
-	0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbe03, 0x009e,
-	0x1158, 0x2011, 0x0274, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019,
-	0x0006, 0x080c, 0xbe03, 0x009e, 0x015e, 0x003e, 0x002e, 0x001e,
-	0x00fe, 0x00be, 0x0005, 0x00b6, 0x0006, 0x0016, 0x0026, 0x0036,
-	0x0156, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x283e,
-	0x11d0, 0x080c, 0x6600, 0x11b8, 0x2011, 0x0276, 0x20a9, 0x0004,
-	0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbe03, 0x009e, 0x1158,
-	0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006,
-	0x080c, 0xbe03, 0x009e, 0x015e, 0x003e, 0x002e, 0x001e, 0x000e,
-	0x00be, 0x0005, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x0056,
-	0x0046, 0x0026, 0x0126, 0x2091, 0x8000, 0x2740, 0x2029, 0x19f0,
-	0x252c, 0x2021, 0x19f6, 0x2424, 0x2061, 0x1cd0, 0x2071, 0x1800,
-	0x7654, 0x7074, 0x81ff, 0x0150, 0x0006, 0x9186, 0x1ab0, 0x000e,
-	0x0128, 0x8001, 0x9602, 0x1a04, 0xe367, 0x0018, 0x9606, 0x0904,
-	0xe367, 0x080c, 0x8958, 0x0904, 0xe35e, 0x2100, 0x9c06, 0x0904,
-	0xe35e, 0x080c, 0xe5ce, 0x1904, 0xe35e, 0x080c, 0xe96c, 0x0904,
-	0xe35e, 0x080c, 0xe5be, 0x0904, 0xe35e, 0x6720, 0x9786, 0x0001,
-	0x1148, 0x080c, 0x330d, 0x0904, 0xe3a6, 0x6004, 0x9086, 0x0000,
-	0x1904, 0xe3a6, 0x9786, 0x0004, 0x0904, 0xe3a6, 0x9786, 0x0007,
-	0x0904, 0xe35e, 0x2500, 0x9c06, 0x0904, 0xe35e, 0x2400, 0x9c06,
-	0x05e8, 0x88ff, 0x0118, 0x6054, 0x9906, 0x15c0, 0x0096, 0x6000,
-	0x9086, 0x0004, 0x1120, 0x0016, 0x080c, 0x1a5e, 0x001e, 0x9786,
-	0x000a, 0x0148, 0x080c, 0xcd21, 0x1130, 0x080c, 0xb7f9, 0x009e,
-	0x080c, 0xae78, 0x0418, 0x6014, 0x2048, 0x080c, 0xcb1b, 0x01d8,
-	0x9786, 0x0003, 0x1570, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130,
-	0x0096, 0xa878, 0x2048, 0x080c, 0x0fb1, 0x009e, 0xab7a, 0xa877,
-	0x0000, 0x080c, 0xe8e7, 0x0016, 0x080c, 0xce0a, 0x080c, 0x6c6d,
-	0x001e, 0x080c, 0xcd04, 0x009e, 0x080c, 0xae78, 0x9ce0, 0x0018,
-	0x2001, 0x181a, 0x2004, 0x9c02, 0x1210, 0x0804, 0xe2de, 0x012e,
-	0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee,
-	0x0005, 0x9786, 0x0006, 0x1150, 0x9386, 0x0005, 0x0128, 0x080c,
-	0xe8e7, 0x080c, 0xe530, 0x08f8, 0x009e, 0x0c00, 0x9786, 0x0009,
-	0x11f8, 0x6000, 0x9086, 0x0004, 0x01c0, 0x6000, 0x9086, 0x0003,
-	0x11a0, 0x080c, 0x9614, 0x0096, 0x6114, 0x2148, 0x080c, 0xcb1b,
-	0x0118, 0x6010, 0x080c, 0x6c79, 0x009e, 0x00c6, 0x080c, 0xae47,
-	0x00ce, 0x0036, 0x080c, 0x9790, 0x003e, 0x009e, 0x0804, 0xe35e,
-	0x9786, 0x000a, 0x0904, 0xe345, 0x0804, 0xe343, 0x81ff, 0x0904,
-	0xe35e, 0x9180, 0x0001, 0x2004, 0x9086, 0x0018, 0x0138, 0x9180,
-	0x0001, 0x2004, 0x9086, 0x002d, 0x1904, 0xe35e, 0x6000, 0x9086,
-	0x0002, 0x1904, 0xe35e, 0x080c, 0xcd10, 0x0138, 0x080c, 0xcd21,
-	0x1904, 0xe35e, 0x080c, 0xb7f9, 0x0038, 0x080c, 0x31e1, 0x080c,
-	0xcd21, 0x1110, 0x080c, 0xb7f9, 0x080c, 0xae78, 0x0804, 0xe35e,
-	0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x0005, 0x00c6, 0x00e6,
-	0x0016, 0x2c08, 0x2170, 0x9006, 0x080c, 0xe557, 0x001e, 0x0120,
-	0x6020, 0x9084, 0x000f, 0x001b, 0x00ee, 0x00ce, 0x0005, 0xe3f5,
-	0xe3f5, 0xe3f5, 0xe3f5, 0xe3f5, 0xe3f5, 0xe3f7, 0xe3f5, 0xe3f5,
-	0xe3f5, 0xe3f5, 0xae78, 0xae78, 0xe3f5, 0x9006, 0x0005, 0x0036,
-	0x0046, 0x0016, 0x7010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00,
-	0x2009, 0x0020, 0x080c, 0xe58d, 0x001e, 0x004e, 0x2019, 0x0002,
-	0x080c, 0xe115, 0x003e, 0x9085, 0x0001, 0x0005, 0x0096, 0x080c,
-	0xcb1b, 0x0140, 0x6014, 0x904d, 0x080c, 0xc74e, 0x687b, 0x0005,
-	0x080c, 0x6c79, 0x009e, 0x080c, 0xae78, 0x9085, 0x0001, 0x0005,
-	0x2001, 0x0001, 0x080c, 0x653c, 0x0156, 0x0016, 0x0026, 0x0036,
-	0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276, 0x080c, 0xbdef,
-	0x003e, 0x002e, 0x001e, 0x015e, 0x9005, 0x0005, 0x00f6, 0x00e6,
-	0x00c6, 0x0086, 0x0076, 0x0066, 0x00b6, 0x0126, 0x2091, 0x8000,
-	0x2740, 0x2061, 0x1cd0, 0x2079, 0x0001, 0x8fff, 0x0904, 0xe490,
-	0x2071, 0x1800, 0x7654, 0x7074, 0x8001, 0x9602, 0x1a04, 0xe490,
-	0x88ff, 0x0120, 0x2800, 0x9c06, 0x1590, 0x2078, 0x080c, 0xe5be,
-	0x0570, 0x2400, 0x9c06, 0x0558, 0x6720, 0x9786, 0x0006, 0x1538,
-	0x9786, 0x0007, 0x0520, 0x88ff, 0x1140, 0x6010, 0x9b06, 0x11f8,
-	0x85ff, 0x0118, 0x6054, 0x9106, 0x11d0, 0x0096, 0x601c, 0xd084,
-	0x0140, 0x080c, 0xe7ea, 0x080c, 0xd22e, 0x080c, 0x1a5e, 0x6023,
-	0x0007, 0x6014, 0x2048, 0x080c, 0xcb1b, 0x0120, 0x0046, 0x080c,
-	0xe530, 0x004e, 0x009e, 0x080c, 0xae78, 0x88ff, 0x1198, 0x9ce0,
-	0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1210, 0x0804, 0xe445,
-	0x9006, 0x012e, 0x00be, 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee,
-	0x00fe, 0x0005, 0x98c5, 0x0001, 0x0ca0, 0x00b6, 0x0076, 0x0056,
-	0x0086, 0x9046, 0x2029, 0x0001, 0x2c20, 0x2019, 0x0002, 0x6210,
-	0x2258, 0x0096, 0x904e, 0x080c, 0xa682, 0x009e, 0x008e, 0x903e,
-	0x080c, 0xa72d, 0x080c, 0xe436, 0x005e, 0x007e, 0x00be, 0x0005,
-	0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156, 0x2c20, 0x2128,
-	0x20a9, 0x007f, 0x900e, 0x0016, 0x0036, 0x080c, 0x6600, 0x1190,
-	0x0056, 0x0086, 0x9046, 0x2508, 0x2029, 0x0001, 0x0096, 0x904e,
-	0x080c, 0xa682, 0x009e, 0x008e, 0x903e, 0x080c, 0xa72d, 0x080c,
-	0xe436, 0x005e, 0x003e, 0x001e, 0x8108, 0x1f04, 0xe4c3, 0x015e,
-	0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x0005, 0x00b6, 0x0076,
-	0x0056, 0x6210, 0x2258, 0x0086, 0x9046, 0x2029, 0x0001, 0x2019,
-	0x0048, 0x0096, 0x904e, 0x080c, 0xa682, 0x009e, 0x008e, 0x903e,
-	0x080c, 0xa72d, 0x2c20, 0x080c, 0xe436, 0x005e, 0x007e, 0x00be,
+	0x0170, 0x9686, 0x0004, 0x0158, 0xbe04, 0x96b4, 0x00ff, 0x9686,
+	0x0006, 0x0128, 0x9686, 0x0004, 0x0110, 0x9085, 0x0001, 0x006e,
+	0x00be, 0x0005, 0x00d6, 0x080c, 0xd94e, 0x00de, 0x0005, 0x00d6,
+	0x080c, 0xd95b, 0x1520, 0x680c, 0x908c, 0xff00, 0x6820, 0x9084,
+	0x00ff, 0x9115, 0x6216, 0x6824, 0x602e, 0xd1e4, 0x0130, 0x9006,
+	0x080c, 0xe977, 0x2009, 0x0001, 0x0078, 0xd1ec, 0x0180, 0x6920,
+	0x918c, 0x00ff, 0x6824, 0x080c, 0x283e, 0x1148, 0x2001, 0x0001,
+	0x080c, 0xe977, 0x2110, 0x900e, 0x080c, 0x3208, 0x0018, 0x9085,
+	0x0001, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6, 0x00c6, 0x080c,
+	0xaeaf, 0x05a8, 0x0016, 0x0026, 0x00c6, 0x2011, 0x0263, 0x2204,
+	0x8211, 0x220c, 0x080c, 0x283e, 0x1578, 0x080c, 0x659e, 0x1560,
+	0xbe12, 0xbd16, 0x00ce, 0x002e, 0x001e, 0x2b00, 0x6012, 0x080c,
+	0xe7aa, 0x11d8, 0x080c, 0x32e3, 0x11c0, 0x080c, 0xd8b6, 0x0510,
+	0x2001, 0x0007, 0x080c, 0x654f, 0x2001, 0x0007, 0x080c, 0x657b,
+	0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001,
+	0x080c, 0x9138, 0x080c, 0x968d, 0x0010, 0x080c, 0xae61, 0x9085,
+	0x0001, 0x00ce, 0x00be, 0x0005, 0x080c, 0xae61, 0x00ce, 0x002e,
+	0x001e, 0x0ca8, 0x080c, 0xae61, 0x9006, 0x0c98, 0x2069, 0x026d,
+	0x6800, 0x9082, 0x0010, 0x1228, 0x6017, 0x0000, 0x9085, 0x0001,
+	0x0008, 0x9006, 0x0005, 0x6017, 0x0000, 0x2069, 0x026c, 0x6808,
+	0x9084, 0xff00, 0x9086, 0x0800, 0x1190, 0x6904, 0x9186, 0x0018,
+	0x0118, 0x9186, 0x0014, 0x1158, 0x810f, 0x6800, 0x9084, 0x00ff,
+	0x910d, 0x615a, 0x908e, 0x0014, 0x0110, 0x908e, 0x0010, 0x0005,
+	0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0dd5, 0x91b6, 0x0013, 0x1130,
+	0x2008, 0x91b2, 0x0040, 0x1a04, 0xdaa5, 0x0092, 0x91b6, 0x0027,
+	0x0120, 0x91b6, 0x0014, 0x190c, 0x0dd5, 0x2001, 0x0007, 0x080c,
+	0x657b, 0x080c, 0x9588, 0x080c, 0xae92, 0x080c, 0x968d, 0x0005,
+	0xd9d8, 0xd9da, 0xd9d8, 0xd9d8, 0xd9d8, 0xd9da, 0xd9e9, 0xda9e,
+	0xda3b, 0xda9e, 0xda4f, 0xda9e, 0xd9e9, 0xda9e, 0xda96, 0xda9e,
+	0xda96, 0xda9e, 0xda9e, 0xd9d8, 0xd9d8, 0xd9d8, 0xd9d8, 0xd9d8,
+	0xd9d8, 0xd9d8, 0xd9d8, 0xd9d8, 0xd9d8, 0xd9d8, 0xd9da, 0xd9d8,
+	0xda9e, 0xd9d8, 0xd9d8, 0xda9e, 0xd9d8, 0xda9b, 0xda9e, 0xd9d8,
+	0xd9d8, 0xd9d8, 0xd9d8, 0xda9e, 0xda9e, 0xd9d8, 0xda9e, 0xda9e,
+	0xd9d8, 0xd9e4, 0xd9d8, 0xd9d8, 0xd9d8, 0xd9d8, 0xda9a, 0xda9e,
+	0xd9d8, 0xd9d8, 0xda9e, 0xda9e, 0xd9d8, 0xd9d8, 0xd9d8, 0xd9d8,
+	0x080c, 0x0dd5, 0x080c, 0x9588, 0x080c, 0xd248, 0x6003, 0x0002,
+	0x080c, 0x968d, 0x0804, 0xdaa4, 0x9006, 0x080c, 0x653b, 0x0804,
+	0xda9e, 0x080c, 0x696a, 0x1904, 0xda9e, 0x9006, 0x080c, 0x653b,
+	0x6010, 0x2058, 0xb810, 0x9086, 0x00ff, 0x1140, 0x00f6, 0x2079,
+	0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x0428, 0x6010, 0x2058,
+	0xb8c0, 0x9005, 0x1178, 0x080c, 0xd230, 0x1904, 0xda9e, 0x0036,
+	0x0046, 0xbba0, 0x2021, 0x0007, 0x080c, 0x4cbb, 0x004e, 0x003e,
+	0x0804, 0xda9e, 0x080c, 0x3314, 0x1904, 0xda9e, 0x2001, 0x1800,
+	0x2004, 0x9086, 0x0002, 0x1138, 0x00f6, 0x2079, 0x1800, 0x78a8,
+	0x8000, 0x78aa, 0x00fe, 0x2001, 0x0002, 0x080c, 0x654f, 0x080c,
+	0x9588, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c,
+	0x9138, 0x080c, 0x968d, 0x6110, 0x2158, 0x2009, 0x0001, 0x080c,
+	0x8501, 0x0804, 0xdaa4, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00,
+	0x8637, 0x9686, 0x0006, 0x0904, 0xda9e, 0x9686, 0x0004, 0x0904,
+	0xda9e, 0x080c, 0x8cbb, 0x2001, 0x0004, 0x0804, 0xda9c, 0x2001,
+	0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0x6010,
+	0x2058, 0xbba0, 0x2021, 0x0006, 0x080c, 0x4cbb, 0x004e, 0x003e,
+	0x2001, 0x0006, 0x080c, 0xdac2, 0x6610, 0x2658, 0xbe04, 0x0066,
+	0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x006e, 0x0168, 0x2001,
+	0x0006, 0x080c, 0x657b, 0x9284, 0x00ff, 0x908e, 0x0007, 0x1120,
+	0x2001, 0x0006, 0x080c, 0x654f, 0x080c, 0x696a, 0x11f8, 0x2001,
+	0x1837, 0x2004, 0xd0a4, 0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686,
+	0x0006, 0x01a0, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa,
+	0x00fe, 0x0804, 0xda23, 0x2001, 0x0004, 0x0030, 0x2001, 0x0006,
+	0x0449, 0x0020, 0x0018, 0x0010, 0x080c, 0x657b, 0x080c, 0x9588,
+	0x080c, 0xae61, 0x080c, 0x968d, 0x0005, 0x2600, 0x0002, 0xdab9,
+	0xdab9, 0xdab9, 0xdab9, 0xdab9, 0xdabb, 0xdab9, 0xdabb, 0xdab9,
+	0xdab9, 0xdabb, 0xdab9, 0xdab9, 0xdab9, 0xdabb, 0xdabb, 0xdabb,
+	0xdabb, 0x080c, 0x0dd5, 0x080c, 0x9588, 0x080c, 0xae61, 0x080c,
+	0x968d, 0x0005, 0x0016, 0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900,
+	0xd184, 0x0138, 0x080c, 0x654f, 0x9006, 0x080c, 0x653b, 0x080c,
+	0x31e8, 0x00de, 0x00be, 0x001e, 0x0005, 0x6610, 0x2658, 0xb804,
+	0x9084, 0xff00, 0x8007, 0x90b2, 0x000c, 0x1a0c, 0x0dd5, 0x91b6,
+	0x0015, 0x1110, 0x003b, 0x0028, 0x91b6, 0x0016, 0x190c, 0x0dd5,
+	0x006b, 0x0005, 0xb8fc, 0xb8fc, 0xb8fc, 0xb8fc, 0xb8fc, 0xb8fc,
+	0xdb41, 0xdb02, 0xb8fc, 0xb8fc, 0xb8fc, 0xb8fc, 0xb8fc, 0xb8fc,
+	0xb8fc, 0xb8fc, 0xb8fc, 0xb8fc, 0xdb41, 0xdb48, 0xb8fc, 0xb8fc,
+	0xb8fc, 0xb8fc, 0x00f6, 0x080c, 0x696a, 0x11d8, 0x080c, 0xd230,
+	0x11c0, 0x6010, 0x905d, 0x01a8, 0xb8c0, 0x9005, 0x0190, 0x9006,
+	0x080c, 0x653b, 0x2001, 0x0002, 0x080c, 0x654f, 0x6023, 0x0001,
+	0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9138, 0x080c, 0x968d,
+	0x00f0, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x283e,
+	0x11b0, 0x080c, 0x65ff, 0x0118, 0x080c, 0xae61, 0x0080, 0xb810,
+	0x0006, 0xb814, 0x0006, 0xb8c0, 0x0006, 0x080c, 0x6034, 0x000e,
+	0xb8c2, 0x000e, 0xb816, 0x000e, 0xb812, 0x080c, 0xae61, 0x00fe,
+	0x0005, 0x6604, 0x96b6, 0x001e, 0x1110, 0x080c, 0xae61, 0x0005,
+	0x080c, 0xbc85, 0x1148, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
+	0x9138, 0x080c, 0x968d, 0x0010, 0x080c, 0xae61, 0x0005, 0x6004,
+	0x908a, 0x0053, 0x1a0c, 0x0dd5, 0x080c, 0x9588, 0x080c, 0xae92,
+	0x080c, 0x968d, 0x0005, 0x9182, 0x0040, 0x0002, 0xdb79, 0xdb79,
+	0xdb79, 0xdb79, 0xdb7b, 0xdb79, 0xdb79, 0xdb79, 0xdb79, 0xdb79,
+	0xdb79, 0xdb79, 0xdb79, 0xdb79, 0xdb79, 0xdb79, 0xdb79, 0xdb79,
+	0xdb79, 0x080c, 0x0dd5, 0x0096, 0x00b6, 0x00d6, 0x00e6, 0x00f6,
+	0x0046, 0x0026, 0x6210, 0x2258, 0xb8bc, 0x9005, 0x11a8, 0x6106,
+	0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904, 0xdbe1, 0x080c,
+	0xe96b, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009, 0x0001, 0x2011,
+	0x0200, 0x080c, 0x86dd, 0x0020, 0x9026, 0x080c, 0xe7ef, 0x0c38,
+	0x080c, 0x0fff, 0x090c, 0x0dd5, 0x6003, 0x0007, 0xa867, 0x010d,
+	0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e, 0x6008, 0xa8e2,
+	0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016, 0xa876, 0xa87f,
+	0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c, 0x6c81, 0x001e,
+	0x080c, 0xe96b, 0x1904, 0xdc41, 0x9486, 0x2000, 0x1130, 0x2019,
+	0x0017, 0x080c, 0xe522, 0x0804, 0xdc41, 0x9486, 0x0200, 0x1120,
+	0x080c, 0xe4be, 0x0804, 0xdc41, 0x9486, 0x0400, 0x0120, 0x9486,
+	0x1000, 0x1904, 0xdc41, 0x2019, 0x0002, 0x080c, 0xe4d9, 0x0804,
+	0xdc41, 0x2069, 0x1a71, 0x6a00, 0xd284, 0x0904, 0xdcab, 0x9284,
+	0x0300, 0x1904, 0xdca4, 0x6804, 0x9005, 0x0904, 0xdc8c, 0x2d78,
+	0x6003, 0x0007, 0x080c, 0x1018, 0x0904, 0xdc4d, 0x7800, 0xd08c,
+	0x1118, 0x7804, 0x8001, 0x7806, 0x6017, 0x0000, 0x2001, 0x180f,
+	0x2004, 0xd084, 0x1904, 0xdcaf, 0x9006, 0xa802, 0xa867, 0x0116,
+	0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010, 0x2058, 0xb8a0,
+	0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c, 0xa9be, 0xb930,
+	0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044, 0x9084, 0x0003,
+	0x9080, 0xdc49, 0x2005, 0xa87e, 0x20a9, 0x000a, 0x2001, 0x0270,
+	0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205, 0x200b, 0x0080, 0x20e1,
+	0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003, 0x200b, 0x0000,
+	0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c, 0xa9ae, 0x080c,
+	0x6c81, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de, 0x00be, 0x009e,
+	0x0005, 0x0000, 0x0080, 0x0040, 0x0000, 0x2001, 0x1810, 0x2004,
+	0xd084, 0x0120, 0x080c, 0x0fff, 0x1904, 0xdbf6, 0x6017, 0xf100,
+	0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x90f0, 0x080c, 0x968d,
+	0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00, 0x9086, 0x1200,
+	0x1198, 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114, 0x918c, 0xf700,
+	0x910d, 0x6116, 0x001e, 0x6003, 0x0001, 0x6007, 0x0043, 0x080c,
+	0x90f0, 0x080c, 0x968d, 0x0828, 0x6868, 0x602e, 0x686c, 0x6032,
+	0x6017, 0xf200, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x0804, 0xdc41, 0x2001, 0x180e, 0x2004, 0xd0ec,
+	0x0120, 0x2011, 0x8049, 0x080c, 0x4b04, 0x6017, 0xf300, 0x0010,
+	0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x0804, 0xdc41, 0x6017, 0xf500, 0x0c98, 0x6017,
+	0xf600, 0x0804, 0xdc61, 0x6017, 0xf200, 0x0804, 0xdc61, 0xa867,
+	0x0146, 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00, 0xa87a, 0x7044,
+	0x9084, 0x0003, 0x9080, 0xdc49, 0x2005, 0xa87e, 0x2928, 0x6010,
+	0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c, 0xa88e, 0xb830,
+	0xa892, 0xb834, 0xa896, 0xa883, 0x003d, 0x2009, 0x0205, 0x2104,
+	0x9085, 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011, 0x0210, 0x2214,
+	0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c, 0x0dd5, 0x8210,
+	0x821c, 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x0029, 0x20a0, 0x2011, 0xdd2b, 0x2041, 0x0001, 0x223d, 0x9784,
+	0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003, 0x931a, 0x0530,
+	0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001, 0x0260, 0x2098,
+	0x0c68, 0x2950, 0x080c, 0x1018, 0x0170, 0x2900, 0xb002, 0xa867,
+	0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b,
+	0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d, 0x0118, 0x080c,
+	0x1031, 0x0cc8, 0x080c, 0x1031, 0x0804, 0xdc4d, 0x2548, 0x8847,
+	0x9885, 0x0046, 0xa866, 0x2009, 0x0205, 0x200b, 0x0000, 0x080c,
+	0xe551, 0x0804, 0xdc41, 0x8010, 0x0004, 0x801a, 0x0006, 0x8018,
+	0x0008, 0x8016, 0x000a, 0x8014, 0x9186, 0x0013, 0x1160, 0x6004,
+	0x908a, 0x0054, 0x1a0c, 0x0dd5, 0x9082, 0x0040, 0x0a0c, 0x0dd5,
+	0x2008, 0x0804, 0xdddc, 0x9186, 0x0051, 0x0108, 0x00c0, 0x2001,
+	0x0109, 0x2004, 0xd084, 0x0904, 0xdd8d, 0x0126, 0x2091, 0x2800,
+	0x0006, 0x0016, 0x0026, 0x080c, 0x8fd5, 0x002e, 0x001e, 0x000e,
+	0x012e, 0x6000, 0x9086, 0x0002, 0x1580, 0x0804, 0xde24, 0x9186,
+	0x0027, 0x0530, 0x9186, 0x0048, 0x0128, 0x9186, 0x0014, 0x0500,
+	0x190c, 0x0dd5, 0x2001, 0x0109, 0x2004, 0xd084, 0x01f0, 0x00c6,
+	0x0126, 0x2091, 0x2800, 0x00c6, 0x2061, 0x0100, 0x0006, 0x0016,
+	0x0026, 0x080c, 0x8fd5, 0x002e, 0x001e, 0x000e, 0x00ce, 0x012e,
+	0x00ce, 0x6000, 0x9086, 0x0004, 0x190c, 0x0dd5, 0x0804, 0xdf05,
+	0x6004, 0x9082, 0x0040, 0x2008, 0x001a, 0x080c, 0xaef7, 0x0005,
+	0xdda3, 0xdda5, 0xdda5, 0xddcc, 0xdda3, 0xdda3, 0xdda3, 0xdda3,
+	0xdda3, 0xdda3, 0xdda3, 0xdda3, 0xdda3, 0xdda3, 0xdda3, 0xdda3,
+	0xdda3, 0xdda3, 0xdda3, 0x080c, 0x0dd5, 0x080c, 0x9588, 0x080c,
+	0x968d, 0x0036, 0x0096, 0x6014, 0x904d, 0x01d8, 0x080c, 0xcb35,
+	0x01c0, 0x6003, 0x0002, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
+	0xd0bc, 0x1178, 0x2019, 0x0004, 0x080c, 0xe551, 0x6017, 0x0000,
+	0x6018, 0x9005, 0x1120, 0x2001, 0x1987, 0x2004, 0x601a, 0x6003,
+	0x0007, 0x009e, 0x003e, 0x0005, 0x0096, 0x080c, 0x9588, 0x080c,
+	0x968d, 0x080c, 0xcb35, 0x0120, 0x6014, 0x2048, 0x080c, 0x1031,
+	0x080c, 0xae92, 0x009e, 0x0005, 0x0002, 0xddf0, 0xde07, 0xddf2,
+	0xde1e, 0xddf0, 0xddf0, 0xddf0, 0xddf0, 0xddf0, 0xddf0, 0xddf0,
+	0xddf0, 0xddf0, 0xddf0, 0xddf0, 0xddf0, 0xddf0, 0xddf0, 0xddf0,
+	0x080c, 0x0dd5, 0x0096, 0x080c, 0x9588, 0x6014, 0x2048, 0xa87c,
+	0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009, 0x0043, 0x080c, 0xaedc,
+	0x0010, 0x6003, 0x0004, 0x080c, 0x968d, 0x009e, 0x0005, 0x080c,
+	0x9588, 0x080c, 0xcb35, 0x0138, 0x6114, 0x0096, 0x2148, 0xa97c,
+	0x009e, 0xd1ec, 0x1138, 0x080c, 0x86b2, 0x080c, 0xae61, 0x080c,
+	0x968d, 0x0005, 0x080c, 0xe7b3, 0x0db0, 0x0cc8, 0x080c, 0x9588,
+	0x2009, 0x0041, 0x0804, 0xdf8d, 0x9182, 0x0040, 0x0002, 0xde3a,
+	0xde3c, 0xde3a, 0xde3a, 0xde3a, 0xde3a, 0xde3a, 0xde3a, 0xde3a,
+	0xde3a, 0xde3a, 0xde3a, 0xde3a, 0xde3a, 0xde3a, 0xde3a, 0xde3a,
+	0xde3d, 0xde3a, 0x080c, 0x0dd5, 0x0005, 0x00d6, 0x080c, 0x86b2,
+	0x00de, 0x080c, 0xe80b, 0x080c, 0xae61, 0x0005, 0x9182, 0x0040,
+	0x0002, 0xde5c, 0xde5c, 0xde5c, 0xde5c, 0xde5c, 0xde5c, 0xde5c,
+	0xde5c, 0xde5c, 0xde5e, 0xdecd, 0xde5c, 0xde5c, 0xde5c, 0xde5c,
+	0xdecd, 0xde5c, 0xde5c, 0xde5c, 0x080c, 0x0dd5, 0x2001, 0x0105,
+	0x2004, 0x9084, 0x1800, 0x01c8, 0x2001, 0x0132, 0x200c, 0x2001,
+	0x0131, 0x2004, 0x9105, 0x1904, 0xdecd, 0x2009, 0x180c, 0x2104,
+	0xd0d4, 0x0904, 0xdecd, 0xc0d4, 0x200a, 0x2009, 0x0105, 0x2104,
+	0x9084, 0xe7fd, 0x9085, 0x0010, 0x200a, 0x2001, 0x1867, 0x2004,
+	0xd0e4, 0x1528, 0x603b, 0x0000, 0x080c, 0x963d, 0x6014, 0x0096,
+	0x2048, 0xa87c, 0xd0fc, 0x0188, 0x908c, 0x0003, 0x918e, 0x0002,
+	0x0508, 0x2001, 0x180c, 0x2004, 0xd0d4, 0x11e0, 0x080c, 0x97b9,
+	0x2009, 0x0041, 0x009e, 0x0804, 0xdf8d, 0x080c, 0x97b9, 0x6003,
+	0x0007, 0x601b, 0x0000, 0x080c, 0x86b2, 0x009e, 0x0005, 0x2001,
+	0x0100, 0x2004, 0x9082, 0x0005, 0x0aa8, 0x2001, 0x011f, 0x2004,
+	0x603a, 0x0890, 0x2001, 0x180c, 0x200c, 0xc1d4, 0x2102, 0xd1cc,
+	0x0110, 0x080c, 0x2c52, 0x080c, 0x97b9, 0x6014, 0x2048, 0xa97c,
+	0xd1ec, 0x1130, 0x080c, 0x86b2, 0x080c, 0xae61, 0x009e, 0x0005,
+	0x080c, 0xe7b3, 0x0db8, 0x009e, 0x0005, 0x2001, 0x180c, 0x200c,
+	0xc1d4, 0x2102, 0x0036, 0x080c, 0x963d, 0x080c, 0x97b9, 0x6014,
+	0x0096, 0x2048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
+	0x0188, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x0140, 0xa8ac,
+	0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c, 0x931b, 0x632e, 0x6003,
+	0x0002, 0x0080, 0x2019, 0x0004, 0x080c, 0xe551, 0x6018, 0x9005,
+	0x1128, 0x2001, 0x1987, 0x2004, 0x8003, 0x601a, 0x6017, 0x0000,
+	0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x9182, 0x0040, 0x0002,
+	0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c,
+	0xdf1e, 0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c, 0xdf1c,
+	0xdf1c, 0xdf1c, 0xdf1c, 0xdf69, 0x080c, 0x0dd5, 0x6014, 0x0096,
+	0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be,
+	0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c, 0xd0fc, 0x0128, 0x2009,
+	0x0041, 0x009e, 0x0804, 0xdf8d, 0x6003, 0x0007, 0x601b, 0x0000,
+	0x080c, 0x86b2, 0x009e, 0x0005, 0x6124, 0xd1f4, 0x1d58, 0x0006,
+	0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200, 0x910b, 0x6030, 0x9420,
+	0x6432, 0x602c, 0x9109, 0x612e, 0x004e, 0x000e, 0x08d8, 0x6110,
+	0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1178, 0x2009, 0x180e,
+	0x210c, 0xd19c, 0x0118, 0x6003, 0x0007, 0x0010, 0x6003, 0x0006,
+	0x00e9, 0x080c, 0x86b4, 0x009e, 0x0005, 0x6003, 0x0002, 0x009e,
+	0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c, 0x15e5, 0x1904, 0xdf1e,
+	0x0005, 0x6014, 0x0096, 0x2048, 0xa834, 0xa938, 0x009e, 0x9105,
+	0x1120, 0x080c, 0x15e5, 0x1904, 0xdf1e, 0x0005, 0xd2fc, 0x0140,
+	0x8002, 0x8000, 0x8212, 0x9291, 0x0000, 0x2009, 0x0009, 0x0010,
+	0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005, 0x9182, 0x0040, 0x0208,
+	0x0062, 0x9186, 0x0013, 0x0120, 0x9186, 0x0014, 0x190c, 0x0dd5,
+	0x6024, 0xd0dc, 0x090c, 0x0dd5, 0x0005, 0xdfb0, 0xdfbc, 0xdfc8,
+	0xdfd4, 0xdfb0, 0xdfb0, 0xdfb0, 0xdfb0, 0xdfb7, 0xdfb2, 0xdfb2,
+	0xdfb0, 0xdfb0, 0xdfb0, 0xdfb0, 0xdfb2, 0xdfb0, 0xdfb2, 0xdfb0,
+	0x080c, 0x0dd5, 0x6024, 0xd0dc, 0x090c, 0x0dd5, 0x0005, 0x6014,
+	0x9005, 0x190c, 0x0dd5, 0x0005, 0x6003, 0x0001, 0x6106, 0x080c,
+	0x90f0, 0x0126, 0x2091, 0x8000, 0x080c, 0x968d, 0x012e, 0x0005,
+	0x6003, 0x0001, 0x6106, 0x080c, 0x90f0, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x968d, 0x012e, 0x0005, 0x6003, 0x0003, 0x6106, 0x2c10,
+	0x080c, 0x1bad, 0x0126, 0x2091, 0x8000, 0x080c, 0x9155, 0x080c,
+	0x97b9, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0036, 0x0096,
+	0x9182, 0x0040, 0x0023, 0x009e, 0x003e, 0x012e, 0x0005, 0xdfff,
+	0xe001, 0xe013, 0xe02d, 0xdfff, 0xdfff, 0xdfff, 0xdfff, 0xdfff,
+	0xdfff, 0xdfff, 0xdfff, 0xdfff, 0xdfff, 0xdfff, 0xdfff, 0x080c,
+	0x0dd5, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x01f8, 0x909c, 0x0003,
+	0x939e, 0x0003, 0x01d0, 0x6003, 0x0001, 0x6106, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x0470, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0168,
+	0x909c, 0x0003, 0x939e, 0x0003, 0x0140, 0x6003, 0x0001, 0x6106,
+	0x080c, 0x90f0, 0x080c, 0x968d, 0x00e0, 0x901e, 0x6316, 0x631a,
+	0x2019, 0x0004, 0x080c, 0xe551, 0x00a0, 0x6014, 0x2048, 0xa87c,
+	0xd0fc, 0x0d98, 0x909c, 0x0003, 0x939e, 0x0003, 0x0d70, 0x6003,
+	0x0003, 0x6106, 0x2c10, 0x080c, 0x1bad, 0x080c, 0x9155, 0x080c,
+	0x97b9, 0x0005, 0x080c, 0x9588, 0x6114, 0x81ff, 0x0158, 0x0096,
+	0x2148, 0x080c, 0xe908, 0x0036, 0x2019, 0x0029, 0x080c, 0xe551,
+	0x003e, 0x009e, 0x080c, 0xae92, 0x080c, 0x968d, 0x0005, 0x080c,
+	0x963d, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xe908,
+	0x0036, 0x2019, 0x0029, 0x080c, 0xe551, 0x003e, 0x009e, 0x080c,
+	0xae92, 0x080c, 0x97b9, 0x0005, 0x9182, 0x0085, 0x0002, 0xe07e,
+	0xe07c, 0xe07c, 0xe08a, 0xe07c, 0xe07c, 0xe07c, 0xe07c, 0xe07c,
+	0xe07c, 0xe07c, 0xe07c, 0xe07c, 0x080c, 0x0dd5, 0x6003, 0x000b,
+	0x6106, 0x080c, 0x90f0, 0x0126, 0x2091, 0x8000, 0x080c, 0x968d,
+	0x012e, 0x0005, 0x0026, 0x00e6, 0x080c, 0xe7aa, 0x0118, 0x080c,
+	0xae61, 0x0450, 0x2071, 0x0260, 0x7224, 0x6216, 0x2001, 0x180e,
+	0x2004, 0xd0e4, 0x0150, 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be,
+	0x2c00, 0x2011, 0x014e, 0x080c, 0xb182, 0x7220, 0x080c, 0xe3f7,
+	0x0118, 0x6007, 0x0086, 0x0040, 0x6007, 0x0087, 0x7224, 0x9296,
+	0xffff, 0x1110, 0x6007, 0x0086, 0x6003, 0x0001, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x080c, 0x97b9, 0x00ee, 0x002e, 0x0005, 0x9186,
+	0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0dd5, 0x908a,
+	0x0092, 0x1a0c, 0x0dd5, 0x9082, 0x0085, 0x00a2, 0x9186, 0x0027,
+	0x0130, 0x9186, 0x0014, 0x0118, 0x080c, 0xaef7, 0x0050, 0x2001,
+	0x0007, 0x080c, 0x657b, 0x080c, 0x9588, 0x080c, 0xae92, 0x080c,
+	0x968d, 0x0005, 0xe0ef, 0xe0f1, 0xe0f1, 0xe0ef, 0xe0ef, 0xe0ef,
+	0xe0ef, 0xe0ef, 0xe0ef, 0xe0ef, 0xe0ef, 0xe0ef, 0xe0ef, 0x080c,
+	0x0dd5, 0x080c, 0x9588, 0x080c, 0xae92, 0x080c, 0x968d, 0x0005,
+	0x9182, 0x0085, 0x0a0c, 0x0dd5, 0x9182, 0x0092, 0x1a0c, 0x0dd5,
+	0x9182, 0x0085, 0x0002, 0xe110, 0xe110, 0xe110, 0xe112, 0xe110,
+	0xe110, 0xe110, 0xe110, 0xe110, 0xe110, 0xe110, 0xe110, 0xe110,
+	0x080c, 0x0dd5, 0x0005, 0x9186, 0x0013, 0x0148, 0x9186, 0x0014,
+	0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xaef7, 0x0030, 0x080c,
+	0x9588, 0x080c, 0xae92, 0x080c, 0x968d, 0x0005, 0x0036, 0x080c,
+	0xe80b, 0x6043, 0x0000, 0x2019, 0x000b, 0x0031, 0x6023, 0x0006,
+	0x6003, 0x0007, 0x003e, 0x0005, 0x0126, 0x0036, 0x2091, 0x8000,
+	0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0xa69c, 0x009e, 0x008e,
+	0x1550, 0x0076, 0x2c38, 0x080c, 0xa747, 0x007e, 0x1520, 0x6000,
+	0x9086, 0x0000, 0x0500, 0x6020, 0x9086, 0x0007, 0x01e0, 0x0096,
+	0x601c, 0xd084, 0x0140, 0x080c, 0xe80b, 0x080c, 0xd248, 0x080c,
+	0x1a5e, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xcb35, 0x0110,
+	0x080c, 0xe551, 0x009e, 0x6017, 0x0000, 0x080c, 0xe80b, 0x6023,
+	0x0007, 0x080c, 0xd248, 0x003e, 0x012e, 0x0005, 0x00f6, 0x00c6,
+	0x00b6, 0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c, 0x080c,
+	0x283e, 0x15c8, 0x0016, 0x00c6, 0x080c, 0x65ff, 0x1590, 0x001e,
+	0x00c6, 0x2160, 0x080c, 0xd245, 0x00ce, 0x002e, 0x0026, 0x0016,
+	0x2019, 0x0029, 0x080c, 0xa808, 0x080c, 0x928b, 0x0076, 0x903e,
+	0x080c, 0x9168, 0x007e, 0x001e, 0x0076, 0x903e, 0x080c, 0xe2eb,
+	0x007e, 0x0026, 0xba04, 0x9294, 0xff00, 0x8217, 0x9286, 0x0006,
+	0x0118, 0x9286, 0x0004, 0x1118, 0xbaa0, 0x080c, 0x327d, 0x002e,
+	0xbcc0, 0x001e, 0x080c, 0x6034, 0xbe12, 0xbd16, 0xbcc2, 0x9006,
+	0x0010, 0x00ce, 0x001e, 0x015e, 0x003e, 0x00be, 0x00ce, 0x00fe,
+	0x0005, 0x00c6, 0x00d6, 0x00b6, 0x0016, 0x2009, 0x1824, 0x2104,
+	0x9086, 0x0074, 0x1904, 0xe212, 0x2069, 0x0260, 0x6944, 0x9182,
+	0x0100, 0x06e0, 0x6940, 0x9184, 0x8000, 0x0904, 0xe20f, 0x2001,
+	0x197c, 0x2004, 0x9005, 0x1140, 0x6010, 0x2058, 0xb8c0, 0x9005,
+	0x0118, 0x9184, 0x0800, 0x0598, 0x6948, 0x918a, 0x0001, 0x0648,
+	0x080c, 0xe970, 0x0118, 0x6978, 0xd1fc, 0x11b8, 0x2009, 0x0205,
+	0x200b, 0x0001, 0x693c, 0x81ff, 0x1198, 0x6944, 0x9182, 0x0100,
+	0x02a8, 0x6940, 0x81ff, 0x1178, 0x6948, 0x918a, 0x0001, 0x0288,
+	0x6950, 0x918a, 0x0001, 0x0298, 0x00d0, 0x6017, 0x0100, 0x00a0,
+	0x6017, 0x0300, 0x0088, 0x6017, 0x0500, 0x0070, 0x6017, 0x0700,
+	0x0058, 0x6017, 0x0900, 0x0040, 0x6017, 0x0b00, 0x0028, 0x6017,
+	0x0f00, 0x0010, 0x6017, 0x2d00, 0x9085, 0x0001, 0x0008, 0x9006,
+	0x001e, 0x00be, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00b6, 0x0026,
+	0x0036, 0x0156, 0x6210, 0x2258, 0xbb04, 0x9394, 0x00ff, 0x9286,
+	0x0006, 0x0180, 0x9286, 0x0004, 0x0168, 0x9394, 0xff00, 0x8217,
+	0x9286, 0x0006, 0x0138, 0x9286, 0x0004, 0x0120, 0x080c, 0x660e,
+	0x0804, 0xe27a, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48,
+	0x2019, 0x000a, 0x080c, 0xbe1d, 0x009e, 0x15a8, 0x2011, 0x027a,
+	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xbe1d,
+	0x009e, 0x1548, 0x0046, 0x0016, 0xbaa0, 0x2220, 0x9006, 0x2009,
+	0x1848, 0x210c, 0xd1a4, 0x0138, 0x2009, 0x0029, 0x080c, 0xe5ae,
+	0xb800, 0xc0e5, 0xb802, 0x2019, 0x0029, 0x080c, 0x928b, 0x0076,
+	0x2039, 0x0000, 0x080c, 0x9168, 0x2c08, 0x080c, 0xe2eb, 0x007e,
+	0x2001, 0x0007, 0x080c, 0x657b, 0x2001, 0x0007, 0x080c, 0x654f,
+	0x001e, 0x004e, 0x9006, 0x015e, 0x003e, 0x002e, 0x00be, 0x00ce,
+	0x0005, 0x00d6, 0x2069, 0x026e, 0x6800, 0x9086, 0x0800, 0x0118,
+	0x6017, 0x0000, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6, 0x00f6,
+	0x0016, 0x0026, 0x0036, 0x0156, 0x2079, 0x026c, 0x7930, 0x7834,
+	0x080c, 0x283e, 0x11d0, 0x080c, 0x65ff, 0x11b8, 0x2011, 0x0270,
+	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbe1d,
+	0x009e, 0x1158, 0x2011, 0x0274, 0x20a9, 0x0004, 0x0096, 0x2b48,
+	0x2019, 0x0006, 0x080c, 0xbe1d, 0x009e, 0x015e, 0x003e, 0x002e,
+	0x001e, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x0006, 0x0016, 0x0026,
+	0x0036, 0x0156, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
+	0x283e, 0x11d0, 0x080c, 0x65ff, 0x11b8, 0x2011, 0x0276, 0x20a9,
+	0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbe1d, 0x009e,
+	0x1158, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019,
+	0x0006, 0x080c, 0xbe1d, 0x009e, 0x015e, 0x003e, 0x002e, 0x001e,
+	0x000e, 0x00be, 0x0005, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066,
+	0x0056, 0x0046, 0x0026, 0x0126, 0x2091, 0x8000, 0x2740, 0x2029,
+	0x19f0, 0x252c, 0x2021, 0x19f6, 0x2424, 0x2061, 0x1cd0, 0x2071,
+	0x1800, 0x7654, 0x7074, 0x81ff, 0x0150, 0x0006, 0x9186, 0x1ab0,
+	0x000e, 0x0128, 0x8001, 0x9602, 0x1a04, 0xe388, 0x0018, 0x9606,
+	0x0904, 0xe388, 0x080c, 0x8981, 0x0904, 0xe37f, 0x2100, 0x9c06,
+	0x0904, 0xe37f, 0x080c, 0xe5ef, 0x1904, 0xe37f, 0x080c, 0xe98d,
+	0x0904, 0xe37f, 0x080c, 0xe5df, 0x0904, 0xe37f, 0x6720, 0x9786,
+	0x0001, 0x1148, 0x080c, 0x3314, 0x0904, 0xe3c7, 0x6004, 0x9086,
+	0x0000, 0x1904, 0xe3c7, 0x9786, 0x0004, 0x0904, 0xe3c7, 0x9786,
+	0x0007, 0x0904, 0xe37f, 0x2500, 0x9c06, 0x0904, 0xe37f, 0x2400,
+	0x9c06, 0x05e8, 0x88ff, 0x0118, 0x6054, 0x9906, 0x15c0, 0x0096,
+	0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c, 0x1a5e, 0x001e,
+	0x9786, 0x000a, 0x0148, 0x080c, 0xcd3b, 0x1130, 0x080c, 0xb813,
+	0x009e, 0x080c, 0xae92, 0x0418, 0x6014, 0x2048, 0x080c, 0xcb35,
+	0x01d8, 0x9786, 0x0003, 0x1570, 0xa867, 0x0103, 0xa87c, 0xd0cc,
+	0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fb1, 0x009e, 0xab7a,
+	0xa877, 0x0000, 0x080c, 0xe908, 0x0016, 0x080c, 0xce24, 0x080c,
+	0x6c75, 0x001e, 0x080c, 0xcd1e, 0x009e, 0x080c, 0xae92, 0x9ce0,
+	0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1210, 0x0804, 0xe2ff,
+	0x012e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x008e, 0x00ce,
+	0x00ee, 0x0005, 0x9786, 0x0006, 0x1150, 0x9386, 0x0005, 0x0128,
+	0x080c, 0xe908, 0x080c, 0xe551, 0x08f8, 0x009e, 0x0c00, 0x9786,
+	0x0009, 0x11f8, 0x6000, 0x9086, 0x0004, 0x01c0, 0x6000, 0x9086,
+	0x0003, 0x11a0, 0x080c, 0x963d, 0x0096, 0x6114, 0x2148, 0x080c,
+	0xcb35, 0x0118, 0x6010, 0x080c, 0x6c81, 0x009e, 0x00c6, 0x080c,
+	0xae61, 0x00ce, 0x0036, 0x080c, 0x97b9, 0x003e, 0x009e, 0x0804,
+	0xe37f, 0x9786, 0x000a, 0x0904, 0xe366, 0x0804, 0xe364, 0x81ff,
+	0x0904, 0xe37f, 0x9180, 0x0001, 0x2004, 0x9086, 0x0018, 0x0138,
+	0x9180, 0x0001, 0x2004, 0x9086, 0x002d, 0x1904, 0xe37f, 0x6000,
+	0x9086, 0x0002, 0x1904, 0xe37f, 0x080c, 0xcd2a, 0x0138, 0x080c,
+	0xcd3b, 0x1904, 0xe37f, 0x080c, 0xb813, 0x0038, 0x080c, 0x31e8,
+	0x080c, 0xcd3b, 0x1110, 0x080c, 0xb813, 0x080c, 0xae92, 0x0804,
+	0xe37f, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x0005, 0x00c6,
+	0x00e6, 0x0016, 0x2c08, 0x2170, 0x9006, 0x080c, 0xe578, 0x001e,
+	0x0120, 0x6020, 0x9084, 0x000f, 0x001b, 0x00ee, 0x00ce, 0x0005,
+	0xe416, 0xe416, 0xe416, 0xe416, 0xe416, 0xe416, 0xe418, 0xe416,
+	0xe416, 0xe416, 0xe416, 0xae92, 0xae92, 0xe416, 0x9006, 0x0005,
+	0x0036, 0x0046, 0x0016, 0x7010, 0x00b6, 0x2058, 0xbca0, 0x00be,
+	0x2c00, 0x2009, 0x0020, 0x080c, 0xe5ae, 0x001e, 0x004e, 0x2019,
+	0x0002, 0x080c, 0xe134, 0x003e, 0x9085, 0x0001, 0x0005, 0x0096,
+	0x080c, 0xcb35, 0x0140, 0x6014, 0x904d, 0x080c, 0xc768, 0x687b,
+	0x0005, 0x080c, 0x6c81, 0x009e, 0x080c, 0xae92, 0x9085, 0x0001,
+	0x0005, 0x2001, 0x0001, 0x080c, 0x653b, 0x0156, 0x0016, 0x0026,
+	0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276, 0x080c,
+	0xbe09, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005, 0x0005, 0x00f6,
+	0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x00b6, 0x0126, 0x2091,
+	0x8000, 0x2740, 0x2061, 0x1cd0, 0x2079, 0x0001, 0x8fff, 0x0904,
+	0xe4b1, 0x2071, 0x1800, 0x7654, 0x7074, 0x8001, 0x9602, 0x1a04,
+	0xe4b1, 0x88ff, 0x0120, 0x2800, 0x9c06, 0x1590, 0x2078, 0x080c,
+	0xe5df, 0x0570, 0x2400, 0x9c06, 0x0558, 0x6720, 0x9786, 0x0006,
+	0x1538, 0x9786, 0x0007, 0x0520, 0x88ff, 0x1140, 0x6010, 0x9b06,
+	0x11f8, 0x85ff, 0x0118, 0x6054, 0x9106, 0x11d0, 0x0096, 0x601c,
+	0xd084, 0x0140, 0x080c, 0xe80b, 0x080c, 0xd248, 0x080c, 0x1a5e,
+	0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xcb35, 0x0120, 0x0046,
+	0x080c, 0xe551, 0x004e, 0x009e, 0x080c, 0xae92, 0x88ff, 0x1198,
+	0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1210, 0x0804,
+	0xe466, 0x9006, 0x012e, 0x00be, 0x006e, 0x007e, 0x008e, 0x00ce,
+	0x00ee, 0x00fe, 0x0005, 0x98c5, 0x0001, 0x0ca0, 0x00b6, 0x0076,
+	0x0056, 0x0086, 0x9046, 0x2029, 0x0001, 0x2c20, 0x2019, 0x0002,
+	0x6210, 0x2258, 0x0096, 0x904e, 0x080c, 0xa69c, 0x009e, 0x008e,
+	0x903e, 0x080c, 0xa747, 0x080c, 0xe457, 0x005e, 0x007e, 0x00be,
 	0x0005, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156, 0x2c20,
-	0x20a9, 0x0800, 0x900e, 0x0016, 0x0036, 0x080c, 0x6600, 0x11a0,
-	0x0086, 0x9046, 0x2828, 0x0046, 0x2021, 0x0001, 0x080c, 0xe7ce,
-	0x004e, 0x0096, 0x904e, 0x080c, 0xa682, 0x009e, 0x008e, 0x903e,
-	0x080c, 0xa72d, 0x080c, 0xe436, 0x003e, 0x001e, 0x8108, 0x1f04,
-	0xe50b, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x0005,
-	0x0016, 0x00f6, 0x080c, 0xcb19, 0x0198, 0xa864, 0x9084, 0x00ff,
-	0x9086, 0x0046, 0x0180, 0xa800, 0x907d, 0x0138, 0xa803, 0x0000,
-	0xab82, 0x080c, 0x6c79, 0x2f48, 0x0cb0, 0xab82, 0x080c, 0x6c79,
-	0x00fe, 0x001e, 0x0005, 0xa800, 0x907d, 0x0130, 0xa803, 0x0000,
-	0x080c, 0x6c79, 0x2f48, 0x0cb8, 0x080c, 0x6c79, 0x0c88, 0x00e6,
-	0x0046, 0x0036, 0x2061, 0x1cd0, 0x9005, 0x1138, 0x2071, 0x1800,
-	0x7454, 0x7074, 0x8001, 0x9402, 0x12f8, 0x2100, 0x9c06, 0x0188,
-	0x6000, 0x9086, 0x0000, 0x0168, 0x6008, 0x9206, 0x1150, 0x6320,
-	0x9386, 0x0009, 0x01b0, 0x6010, 0x91a0, 0x0004, 0x2424, 0x9406,
-	0x0140, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1220,
-	0x0c20, 0x9085, 0x0001, 0x0008, 0x9006, 0x003e, 0x004e, 0x00ee,
-	0x0005, 0x631c, 0xd3c4, 0x1d68, 0x0c30, 0x0096, 0x0006, 0x080c,
-	0x0fff, 0x000e, 0x090c, 0x0dd5, 0xaae2, 0xa867, 0x010d, 0xa88e,
-	0x0026, 0x2010, 0x080c, 0xcb09, 0x2001, 0x0000, 0x0120, 0x2200,
-	0x9080, 0x0015, 0x2004, 0x002e, 0xa87a, 0x9186, 0x0020, 0x0110,
-	0xa8e3, 0xffff, 0xa986, 0xac76, 0xa87f, 0x0000, 0x2001, 0x198e,
-	0x2004, 0xa882, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x6c79, 0x012e, 0x009e, 0x0005, 0x6700, 0x9786,
-	0x0000, 0x0158, 0x9786, 0x0001, 0x0140, 0x9786, 0x000a, 0x0128,
-	0x9786, 0x0009, 0x0110, 0x9085, 0x0001, 0x0005, 0x00e6, 0x6010,
-	0x9075, 0x0138, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x00ee,
-	0x0005, 0x9085, 0x0001, 0x0cd8, 0x0016, 0x6004, 0x908e, 0x001e,
-	0x11a0, 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007,
-	0x0085, 0x6003, 0x000b, 0x6023, 0x0005, 0x2001, 0x1987, 0x2004,
-	0x601a, 0x080c, 0x90c7, 0x080c, 0x9664, 0x001e, 0x0005, 0xa001,
-	0xa001, 0x0005, 0x6024, 0xd0e4, 0x0158, 0xd0cc, 0x0118, 0x080c,
-	0xce4e, 0x0030, 0x080c, 0xe7ea, 0x080c, 0x8689, 0x080c, 0xae47,
-	0x0005, 0x9280, 0x0008, 0x2004, 0x9084, 0x000f, 0x0002, 0xe61d,
-	0xe61d, 0xe61d, 0xe61f, 0xe61d, 0xe61f, 0xe61f, 0xe61d, 0xe61f,
-	0xe61d, 0xe61d, 0xe61d, 0xe61d, 0xe61d, 0x9006, 0x0005, 0x9085,
-	0x0001, 0x0005, 0x9280, 0x0008, 0x2004, 0x9084, 0x000f, 0x0002,
-	0xe636, 0xe636, 0xe636, 0xe636, 0xe636, 0xe636, 0xe643, 0xe636,
-	0xe636, 0xe636, 0xe636, 0xe636, 0xe636, 0xe636, 0x6007, 0x003b,
-	0x602f, 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x080c, 0x90c7,
-	0x080c, 0x9664, 0x0005, 0x0096, 0x00c6, 0x2260, 0x080c, 0xe7ea,
-	0x6043, 0x0000, 0x6024, 0xc0f4, 0xc0e4, 0x6026, 0x603b, 0x0000,
-	0x00ce, 0x00d6, 0x2268, 0x9186, 0x0007, 0x1904, 0xe69c, 0x6814,
-	0x9005, 0x0138, 0x2048, 0xa87c, 0xd0fc, 0x1118, 0x00de, 0x009e,
-	0x08a8, 0x6007, 0x003a, 0x6003, 0x0001, 0x080c, 0x90c7, 0x080c,
-	0x9664, 0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002, 0x1904, 0xe713,
-	0x6014, 0x9005, 0x1138, 0x6000, 0x9086, 0x0007, 0x190c, 0x0dd5,
-	0x0804, 0xe713, 0x2048, 0x080c, 0xcb1b, 0x1130, 0x0028, 0x2048,
-	0xa800, 0x9005, 0x1de0, 0x2900, 0x2048, 0xa87c, 0x9084, 0x0003,
-	0x9086, 0x0002, 0x1168, 0xa87c, 0xc0dc, 0xc0f4, 0xa87e, 0xa880,
-	0xc0fc, 0xa882, 0x2009, 0x0043, 0x080c, 0xdf6e, 0x0804, 0xe713,
-	0x2009, 0x0041, 0x0804, 0xe70d, 0x9186, 0x0005, 0x15a0, 0x6814,
-	0x2048, 0xa87c, 0xd0bc, 0x1120, 0x00de, 0x009e, 0x0804, 0xe636,
-	0xd0b4, 0x0128, 0xd0fc, 0x090c, 0x0dd5, 0x0804, 0xe657, 0x6007,
-	0x003a, 0x6003, 0x0001, 0x080c, 0x90c7, 0x080c, 0x9664, 0x00c6,
-	0x2d60, 0x6100, 0x9186, 0x0002, 0x0120, 0x9186, 0x0004, 0x1904,
-	0xe713, 0x6814, 0x2048, 0xa97c, 0xc1f4, 0xc1dc, 0xa97e, 0xa980,
-	0xc1fc, 0xc1bc, 0xa982, 0x00f6, 0x2c78, 0x080c, 0x1725, 0x00fe,
-	0x2009, 0x0042, 0x04d0, 0x0036, 0x080c, 0x0fff, 0x090c, 0x0dd5,
-	0xa867, 0x010d, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x2d18, 0xab8e,
-	0xa887, 0x0045, 0x2c00, 0xa892, 0x6038, 0xa8a2, 0x2360, 0x6024,
-	0xc0dd, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x2004,
-	0x6354, 0xab7a, 0xa876, 0x9006, 0xa87e, 0xa882, 0xad9a, 0xae96,
-	0xa89f, 0x0001, 0x080c, 0x6c79, 0x2019, 0x0045, 0x6008, 0x2068,
-	0x080c, 0xe115, 0x2d00, 0x600a, 0x6023, 0x0006, 0x6003, 0x0007,
-	0x901e, 0x631a, 0x6342, 0x003e, 0x0038, 0x6043, 0x0000, 0x6003,
-	0x0007, 0x080c, 0xdf6e, 0x00ce, 0x00de, 0x009e, 0x0005, 0x9186,
-	0x0013, 0x1128, 0x6004, 0x9082, 0x0085, 0x2008, 0x00c2, 0x9186,
-	0x0027, 0x1178, 0x080c, 0x955f, 0x0036, 0x0096, 0x6014, 0x2048,
-	0x2019, 0x0004, 0x080c, 0xe530, 0x009e, 0x003e, 0x080c, 0x9664,
-	0x0005, 0x9186, 0x0014, 0x0d70, 0x080c, 0xaedd, 0x0005, 0xe746,
-	0xe744, 0xe744, 0xe744, 0xe744, 0xe744, 0xe746, 0xe744, 0xe744,
-	0xe744, 0xe744, 0xe744, 0xe744, 0x080c, 0x0dd5, 0x080c, 0x955f,
-	0x6003, 0x000c, 0x080c, 0x9664, 0x0005, 0x9182, 0x0092, 0x1220,
-	0x9182, 0x0085, 0x0208, 0x001a, 0x080c, 0xaedd, 0x0005, 0xe764,
-	0xe764, 0xe764, 0xe764, 0xe766, 0xe786, 0xe764, 0xe764, 0xe764,
-	0xe764, 0xe764, 0xe764, 0xe764, 0x080c, 0x0dd5, 0x00d6, 0x2c68,
-	0x080c, 0xadf1, 0x01b0, 0x6003, 0x0001, 0x6007, 0x001e, 0x2009,
-	0x026e, 0x210c, 0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x600b,
-	0xffff, 0x6910, 0x6112, 0x6023, 0x0004, 0x080c, 0x90c7, 0x080c,
-	0x9664, 0x2d60, 0x080c, 0xae47, 0x00de, 0x0005, 0x080c, 0xae47,
-	0x0005, 0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ec,
-	0x00ee, 0x0005, 0x2009, 0x1867, 0x210c, 0xd1ec, 0x05b0, 0x6003,
-	0x0002, 0x6024, 0xc0e5, 0x6026, 0xd0cc, 0x0150, 0x2001, 0x1988,
-	0x2004, 0x6042, 0x2009, 0x1867, 0x210c, 0xd1f4, 0x1520, 0x00a0,
-	0x2009, 0x1867, 0x210c, 0xd1f4, 0x0128, 0x6024, 0xc0e4, 0x6026,
-	0x9006, 0x00d8, 0x2001, 0x1988, 0x200c, 0x2001, 0x1986, 0x2004,
-	0x9100, 0x9080, 0x000a, 0x6042, 0x6010, 0x00b6, 0x2058, 0xb8bc,
-	0x00be, 0x0008, 0x2104, 0x9005, 0x0118, 0x9088, 0x0003, 0x0cd0,
-	0x2c0a, 0x600f, 0x0000, 0x9085, 0x0001, 0x0005, 0x0016, 0x00c6,
-	0x00e6, 0x6154, 0xb8bc, 0x2060, 0x8cff, 0x0180, 0x84ff, 0x1118,
-	0x6054, 0x9106, 0x1138, 0x600c, 0x2072, 0x080c, 0x8689, 0x080c,
-	0xae47, 0x0010, 0x9cf0, 0x0003, 0x2e64, 0x0c70, 0x00ee, 0x00ce,
-	0x001e, 0x0005, 0x00d6, 0x00b6, 0x6010, 0x2058, 0xb8bc, 0x2068,
-	0x9005, 0x0130, 0x9c06, 0x0110, 0x680c, 0x0cd0, 0x600c, 0x680e,
-	0x00be, 0x00de, 0x0005, 0x0026, 0x0036, 0x0156, 0x2011, 0x182c,
-	0x2204, 0x9084, 0x00ff, 0x2019, 0x026e, 0x2334, 0x9636, 0x1508,
-	0x8318, 0x2334, 0x2204, 0x9084, 0xff00, 0x9636, 0x11d0, 0x2011,
-	0x0270, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a,
-	0x080c, 0xbe03, 0x009e, 0x1168, 0x2011, 0x0274, 0x20a9, 0x0004,
-	0x6010, 0x0096, 0x2048, 0x2019, 0x0006, 0x080c, 0xbe03, 0x009e,
-	0x1100, 0x015e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x2071, 0x1800,
-	0x080c, 0x5fae, 0x080c, 0x2f96, 0x00ee, 0x0005, 0x0096, 0x0026,
-	0x080c, 0x0fff, 0x090c, 0x0dd5, 0xa85c, 0x9080, 0x001a, 0x20a0,
-	0x20a9, 0x000c, 0xa860, 0x20e8, 0x9006, 0x4004, 0x9186, 0x0046,
-	0x1118, 0xa867, 0x0136, 0x0038, 0xa867, 0x0138, 0x9186, 0x0041,
-	0x0110, 0xa87b, 0x0001, 0x7038, 0x9084, 0xff00, 0x7240, 0x9294,
-	0xff00, 0x8007, 0x9215, 0xaa9a, 0x9186, 0x0046, 0x1168, 0x7038,
-	0x9084, 0x00ff, 0x723c, 0x9294, 0xff00, 0x9215, 0xaa9e, 0x723c,
-	0x9294, 0x00ff, 0xaaa2, 0x0060, 0x7040, 0x9084, 0x00ff, 0x7244,
-	0x9294, 0xff00, 0x9215, 0xaa9e, 0x7244, 0x9294, 0x00ff, 0xaaa2,
-	0x9186, 0x0046, 0x1118, 0x9e90, 0x0012, 0x0010, 0x9e90, 0x001a,
-	0x2204, 0x8007, 0xa8a6, 0x8210, 0x2204, 0x8007, 0xa8aa, 0x8210,
-	0x2204, 0x8007, 0xa8ae, 0x8210, 0x2204, 0x8007, 0xa8b2, 0x8210,
-	0x9186, 0x0046, 0x11b8, 0x9e90, 0x0016, 0x2204, 0x8007, 0xa8b6,
-	0x8210, 0x2204, 0x8007, 0xa8ba, 0x8210, 0x2204, 0x8007, 0xa8be,
-	0x8210, 0x2204, 0x8007, 0xa8c2, 0x8210, 0x2011, 0x0205, 0x2013,
-	0x0001, 0x00b0, 0x9e90, 0x001e, 0x2204, 0x8007, 0xa8b6, 0x8210,
-	0x2204, 0x8007, 0xa8ba, 0x2011, 0x0205, 0x2013, 0x0001, 0x2011,
-	0x0260, 0x2204, 0x8007, 0xa8be, 0x8210, 0x2204, 0x8007, 0xa8c2,
-	0x9186, 0x0046, 0x1118, 0x2011, 0x0262, 0x0010, 0x2011, 0x026a,
-	0x0146, 0x01d6, 0x0036, 0x20a9, 0x0001, 0x2019, 0x0008, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0x2204, 0x8007, 0x4004,
-	0x8210, 0x8319, 0x1dd0, 0x003e, 0x01ce, 0x013e, 0x2011, 0x0205,
-	0x2013, 0x0000, 0x002e, 0x080c, 0x6c79, 0x009e, 0x0005, 0x00e6,
-	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0fc, 0x0108, 0x0011,
-	0x00ee, 0x0005, 0xa880, 0xc0e5, 0xa882, 0x0005, 0x00e6, 0x00d6,
-	0x00c6, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0016, 0x0126,
-	0x2091, 0x8000, 0x2029, 0x19f0, 0x252c, 0x2021, 0x19f6, 0x2424,
-	0x2061, 0x1cd0, 0x2071, 0x1800, 0x7654, 0x7074, 0x9606, 0x0578,
-	0x6720, 0x9786, 0x0001, 0x0118, 0x9786, 0x0008, 0x1500, 0x2500,
-	0x9c06, 0x01e8, 0x2400, 0x9c06, 0x01d0, 0x080c, 0xe5be, 0x01b8,
-	0x080c, 0xe5ce, 0x11a0, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016,
-	0x080c, 0x1a5e, 0x001e, 0x080c, 0xcd10, 0x1110, 0x080c, 0x31e1,
-	0x080c, 0xcd21, 0x1110, 0x080c, 0xb7f9, 0x080c, 0xae78, 0x9ce0,
-	0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1208, 0x0858, 0x012e,
-	0x001e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce, 0x00de,
-	0x00ee, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0dc, 0x0005, 0x0006,
-	0x2001, 0x1837, 0x2004, 0xd09c, 0x000e, 0x0005, 0x0006, 0x0036,
-	0x0046, 0x080c, 0xd216, 0x0168, 0x2019, 0xffff, 0x9005, 0x0128,
-	0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x080c,
-	0x4cbc, 0x004e, 0x003e, 0x000e, 0x6004, 0x9086, 0x0001, 0x1128,
-	0x080c, 0xa7ee, 0x080c, 0xae78, 0x9006, 0x0005, 0x00e6, 0x00c6,
-	0x00b6, 0x0046, 0x2061, 0x1cd0, 0x2071, 0x1800, 0x7454, 0x7074,
-	0x8001, 0x9402, 0x12b8, 0x2100, 0x9c06, 0x0148, 0x6000, 0x9086,
-	0x0000, 0x0128, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x0140, 0x9ce0,
-	0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1220, 0x0c60, 0x9085,
-	0x0001, 0x0008, 0x9006, 0x004e, 0x00be, 0x00ce, 0x00ee, 0x0005,
-	0x0126, 0x0006, 0x00e6, 0x0016, 0x2091, 0x8000, 0x2071, 0x1840,
-	0xd5a4, 0x0118, 0x7004, 0x8000, 0x7006, 0xd5b4, 0x0118, 0x7000,
-	0x8000, 0x7002, 0xd5ac, 0x0178, 0x2500, 0x9084, 0x0007, 0x908e,
-	0x0003, 0x0148, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118,
-	0x2071, 0xfffe, 0x0089, 0x001e, 0x00ee, 0x000e, 0x012e, 0x0005,
-	0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0xfff6, 0x0021,
-	0x00ee, 0x000e, 0x012e, 0x0005, 0x2e05, 0x8000, 0x2077, 0x1220,
-	0x8e70, 0x2e05, 0x8000, 0x2077, 0x0005, 0x00e6, 0x2071, 0xfff4,
-	0x0c99, 0x00ee, 0x0005, 0x00e6, 0x2071, 0xfff8, 0x0c69, 0x00ee,
-	0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0x1840,
-	0x7014, 0x8000, 0x7016, 0x00ee, 0x000e, 0x012e, 0x0005, 0x0003,
-	0x000b, 0x079e, 0x0000, 0xc000, 0x0001, 0x8064, 0x0008, 0x0010,
-	0x0000, 0x8066, 0x0000, 0x0101, 0x0008, 0x4407, 0x0003, 0x8060,
-	0x0000, 0x0400, 0x0000, 0x580d, 0x000b, 0x79a8, 0x000b, 0x50ee,
-	0x000b, 0x4c0a, 0x0003, 0xbac0, 0x0009, 0x008a, 0x0000, 0x0c0a,
-	0x000b, 0x15fe, 0x0008, 0x340a, 0x0003, 0xc4c0, 0x0009, 0x7000,
-	0x0000, 0xffa0, 0x0001, 0x2000, 0x0000, 0x1668, 0x000b, 0x808c,
-	0x0008, 0x0001, 0x0000, 0x0000, 0x0007, 0x4028, 0x0000, 0x4047,
-	0x000a, 0x808c, 0x0008, 0x0002, 0x0000, 0x0822, 0x0003, 0x4022,
-	0x0000, 0x0028, 0x000b, 0x4122, 0x0008, 0x94c0, 0x0009, 0xff00,
-	0x0008, 0xffe0, 0x0009, 0x0500, 0x0008, 0x0a93, 0x000b, 0x4447,
-	0x0002, 0x0e90, 0x0003, 0x0bfe, 0x0008, 0x11a0, 0x0001, 0x126e,
-	0x0003, 0x0ca0, 0x0001, 0x126e, 0x0003, 0x9180, 0x0001, 0x0004,
-	0x0000, 0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066,
-	0x0000, 0x0009, 0x0008, 0x4436, 0x000b, 0x808c, 0x0008, 0x0000,
-	0x0008, 0x0060, 0x0008, 0x8062, 0x0008, 0x0004, 0x0000, 0x8066,
-	0x0000, 0x0411, 0x0000, 0x443e, 0x0003, 0x03fe, 0x0000, 0x43e0,
-	0x0001, 0x0e6b, 0x000b, 0xc2c0, 0x0009, 0x00ff, 0x0008, 0x02e0,
-	0x0001, 0x0e6b, 0x000b, 0x9180, 0x0001, 0x0005, 0x0008, 0x8060,
-	0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0019,
-	0x0000, 0x444d, 0x000b, 0x0240, 0x0002, 0x0a68, 0x0003, 0x00fe,
-	0x0000, 0x326b, 0x000b, 0x0248, 0x000a, 0x085c, 0x0003, 0x9180,
-	0x0001, 0x0006, 0x0008, 0x7f62, 0x0008, 0x8002, 0x0008, 0x0003,
-	0x0008, 0x8066, 0x0000, 0x020a, 0x0000, 0x445b, 0x0003, 0x112a,
-	0x0000, 0x002e, 0x0008, 0x022c, 0x0008, 0x3a44, 0x0002, 0x0c0a,
-	0x000b, 0x808c, 0x0008, 0x0002, 0x0000, 0x1760, 0x0008, 0x8062,
-	0x0008, 0x000f, 0x0008, 0x8066, 0x0000, 0x0011, 0x0008, 0x4468,
-	0x0003, 0x01fe, 0x0008, 0x42e0, 0x0009, 0x0e5c, 0x0003, 0x00fe,
-	0x0000, 0x43e0, 0x0001, 0x0e5c, 0x0003, 0x1734, 0x0000, 0x1530,
-	0x0000, 0x1632, 0x0008, 0x0d2a, 0x0008, 0x9880, 0x0001, 0x0010,
-	0x0000, 0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066,
-	0x0000, 0x1e0a, 0x0008, 0x447a, 0x0003, 0x808a, 0x0008, 0x0003,
-	0x0008, 0x1a60, 0x0000, 0x8062, 0x0008, 0x0002, 0x0000, 0x5880,
-	0x000b, 0x8066, 0x0000, 0x3679, 0x0000, 0x4483, 0x0003, 0x5884,
-	0x0003, 0x3efe, 0x0008, 0x7f4f, 0x0002, 0x088a, 0x000b, 0x0d00,
-	0x0000, 0x0092, 0x000c, 0x8054, 0x0008, 0x0011, 0x0008, 0x8074,
-	0x0000, 0x1010, 0x0008, 0x1efe, 0x0000, 0x300a, 0x000b, 0x00c8,
-	0x000c, 0x000a, 0x000b, 0x00fe, 0x0000, 0x349a, 0x0003, 0x1a60,
-	0x0000, 0x8062, 0x0008, 0x0007, 0x0000, 0x8066, 0x0000, 0x0231,
-	0x0008, 0x4499, 0x000b, 0x03fe, 0x0000, 0x04d0, 0x0001, 0x0cc0,
-	0x000b, 0x82c0, 0x0001, 0x1f00, 0x0000, 0xffa0, 0x0001, 0x0400,
-	0x0000, 0x08af, 0x0003, 0x14c0, 0x000b, 0x01fe, 0x0008, 0x0580,
-	0x0009, 0x7f06, 0x0000, 0x02fe, 0x0008, 0xffc0, 0x0001, 0x00ff,
-	0x0008, 0x0690, 0x0001, 0x10af, 0x0003, 0x7f08, 0x0008, 0x84c0,
-	0x0001, 0xff00, 0x0008, 0x08c0, 0x0003, 0x00fe, 0x0000, 0x34b6,
-	0x000b, 0x8072, 0x0000, 0x1010, 0x0008, 0x3944, 0x0002, 0x08b1,
-	0x0003, 0x00ba, 0x0003, 0x8072, 0x0000, 0x2020, 0x0008, 0x3945,
-	0x000a, 0x08b6, 0x000b, 0x3946, 0x000a, 0x0cc7, 0x0003, 0x0000,
-	0x0007, 0x3943, 0x000a, 0x08c7, 0x000b, 0x00ba, 0x0003, 0x00fe,
-	0x0000, 0x34c5, 0x0003, 0x8072, 0x0000, 0x1000, 0x0000, 0x00c7,
-	0x0003, 0x8072, 0x0000, 0x2000, 0x0000, 0x4000, 0x000f, 0x1c60,
-	0x0000, 0x1b62, 0x0000, 0x8066, 0x0000, 0x0231, 0x0008, 0x44cc,
-	0x000b, 0x58cd, 0x000b, 0x0140, 0x0008, 0x0242, 0x0000, 0x1f43,
-	0x0002, 0x0cdb, 0x000b, 0x0d44, 0x0000, 0x0d46, 0x0008, 0x0348,
-	0x0008, 0x044a, 0x0008, 0x030a, 0x0008, 0x040c, 0x0000, 0x0d06,
-	0x0000, 0x0d08, 0x0008, 0x00df, 0x0003, 0x0344, 0x0008, 0x0446,
-	0x0008, 0x0548, 0x0008, 0x064a, 0x0000, 0x1948, 0x000a, 0x08e2,
-	0x0003, 0x0d4a, 0x0008, 0x58e2, 0x0003, 0x3efe, 0x0008, 0x7f4f,
-	0x0002, 0x08e9, 0x000b, 0x8000, 0x0000, 0x0001, 0x0000, 0x0092,
-	0x000c, 0x8054, 0x0008, 0x0001, 0x0000, 0x8074, 0x0000, 0x2020,
-	0x0008, 0x4000, 0x000f, 0x3a40, 0x000a, 0x0c0d, 0x0003, 0x2b24,
-	0x0008, 0x2b24, 0x0008, 0x58f2, 0x000b, 0x8054, 0x0008, 0x0002,
-	0x0000, 0x1242, 0x0002, 0x0940, 0x0003, 0x3a45, 0x000a, 0x092f,
-	0x0003, 0x8072, 0x0000, 0x1000, 0x0000, 0x3945, 0x000a, 0x08ff,
-	0x0003, 0x8072, 0x0000, 0x3010, 0x0000, 0x1e10, 0x000a, 0x7f3c,
-	0x0000, 0x092a, 0x0003, 0x1d00, 0x0002, 0x7f3a, 0x0000, 0x0d60,
-	0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0009, 0x0008, 0x4508,
-	0x000b, 0x00fe, 0x0000, 0x3527, 0x000b, 0x1c60, 0x0000, 0x8062,
-	0x0008, 0x0001, 0x0000, 0x8066, 0x0000, 0x0009, 0x0008, 0x4510,
-	0x000b, 0x00fe, 0x0000, 0x3243, 0x000b, 0x0038, 0x0000, 0x0060,
-	0x0008, 0x8062, 0x0008, 0x0019, 0x0000, 0x8066, 0x0000, 0x0009,
-	0x0008, 0x4519, 0x000b, 0x80c0, 0x0009, 0x00ff, 0x0008, 0x7f3e,
-	0x0008, 0x0d60, 0x0000, 0x0efe, 0x0008, 0x1f80, 0x0001, 0x7f62,
-	0x0008, 0x8066, 0x0000, 0x0009, 0x0008, 0x4523, 0x000b, 0x003a,
-	0x0008, 0x1dfe, 0x0000, 0x0104, 0x000b, 0x0036, 0x0008, 0x00c8,
-	0x000c, 0x0140, 0x000b, 0x8074, 0x0000, 0x2000, 0x0000, 0x8072,
-	0x0000, 0x2000, 0x0000, 0x0140, 0x000b, 0x3a44, 0x0002, 0x0a71,
-	0x000b, 0x8074, 0x0000, 0x1000, 0x0000, 0x8072, 0x0000, 0x1000,
-	0x0000, 0x2d0e, 0x0000, 0x2d0e, 0x0000, 0x3640, 0x0003, 0x26fe,
-	0x0008, 0x26fe, 0x0008, 0x2700, 0x0008, 0x2700, 0x0008, 0x00d0,
-	0x0009, 0x0d52, 0x000b, 0x8074, 0x0000, 0x4040, 0x0008, 0x5940,
-	0x0003, 0x50ee, 0x000b, 0x3a46, 0x000a, 0x0d52, 0x000b, 0x3a47,
-	0x0002, 0x094d, 0x000b, 0x8054, 0x0008, 0x0004, 0x0000, 0x8074,
-	0x0000, 0x8000, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008, 0x019c,
-	0x0003, 0x92c0, 0x0009, 0x0fc8, 0x0000, 0x080a, 0x0003, 0x1246,
-	0x000a, 0x0e3a, 0x0003, 0x1a60, 0x0000, 0x8062, 0x0008, 0x0002,
-	0x0000, 0x8066, 0x0000, 0x362a, 0x0000, 0x4557, 0x000b, 0x2000,
-	0x0000, 0x2000, 0x0000, 0x2102, 0x0000, 0x2102, 0x0000, 0x2204,
-	0x0000, 0x2204, 0x0000, 0x2306, 0x0000, 0x2306, 0x0000, 0x2408,
-	0x0000, 0x2408, 0x0000, 0x250a, 0x0000, 0x250a, 0x0000, 0x260c,
-	0x0000, 0x260c, 0x0000, 0x270e, 0x0000, 0x270e, 0x0000, 0x2810,
-	0x0000, 0x2810, 0x0000, 0x2912, 0x0000, 0x2912, 0x0000, 0x1a60,
-	0x0000, 0x8062, 0x0008, 0x0007, 0x0000, 0x8066, 0x0000, 0x0052,
-	0x0000, 0x4571, 0x0003, 0x92c0, 0x0009, 0x0780, 0x0008, 0x0e56,
-	0x0003, 0x124b, 0x0002, 0x097a, 0x0003, 0x2e4d, 0x0002, 0x2e4d,
-	0x0002, 0x0a40, 0x0003, 0x3a46, 0x000a, 0x0d8a, 0x000b, 0x597c,
-	0x0003, 0x8054, 0x0008, 0x0004, 0x0000, 0x1243, 0x000a, 0x0998,
-	0x0003, 0x8010, 0x0008, 0x000d, 0x0000, 0x021b, 0x000c, 0x1948,
-	0x000a, 0x0987, 0x000b, 0x0210, 0x0004, 0x1810, 0x0000, 0x021b,
-	0x000c, 0x0198, 0x000b, 0x1948, 0x000a, 0x098e, 0x000b, 0x1243,
-	0x000a, 0x0a43, 0x0003, 0x194d, 0x000a, 0x0992, 0x0003, 0x1243,
-	0x000a, 0x0a4a, 0x0003, 0x5992, 0x0003, 0x8054, 0x0008, 0x0004,
-	0x0000, 0x0210, 0x0004, 0x1810, 0x0000, 0x021b, 0x000c, 0x8074,
-	0x0000, 0xf000, 0x0008, 0x8072, 0x0000, 0x3000, 0x0008, 0x0d30,
-	0x0000, 0x3a42, 0x0002, 0x0da2, 0x000b, 0x15fe, 0x0008, 0x3461,
-	0x000b, 0x000a, 0x000b, 0x8074, 0x0000, 0x0501, 0x0000, 0x8010,
-	0x0008, 0x000c, 0x0008, 0x021b, 0x000c, 0x000a, 0x000b, 0xbbe0,
-	0x0009, 0x0030, 0x0008, 0x0db8, 0x0003, 0x18fe, 0x0000, 0x3ce0,
-	0x0009, 0x09b5, 0x0003, 0x15fe, 0x0008, 0x3ce0, 0x0009, 0x09b5,
-	0x0003, 0x020b, 0x0004, 0x8076, 0x0008, 0x0040, 0x0000, 0x0208,
-	0x000b, 0x8076, 0x0008, 0x0041, 0x0008, 0x0208, 0x000b, 0xbbe0,
-	0x0009, 0x0032, 0x0000, 0x0dbd, 0x0003, 0x3c1e, 0x0008, 0x0208,
-	0x000b, 0xbbe0, 0x0009, 0x003b, 0x0000, 0x0dc2, 0x000b, 0x3c20,
-	0x0000, 0x0208, 0x000b, 0xbbe0, 0x0009, 0x0035, 0x0008, 0x0dc8,
-	0x000b, 0x8072, 0x0000, 0x8000, 0x0000, 0x0384, 0x000b, 0xbbe0,
-	0x0009, 0x0036, 0x0008, 0x0aa5, 0x000b, 0xbbe0, 0x0009, 0x0037,
-	0x0000, 0x0de9, 0x000b, 0x18fe, 0x0000, 0x3ce0, 0x0009, 0x0db5,
-	0x000b, 0x8076, 0x0008, 0x0040, 0x0000, 0x1a60, 0x0000, 0x8062,
-	0x0008, 0x000d, 0x0000, 0x2604, 0x0008, 0x2604, 0x0008, 0x2706,
-	0x0008, 0x2706, 0x0008, 0x2808, 0x0000, 0x2808, 0x0000, 0x290a,
-	0x0000, 0x290a, 0x0000, 0x8066, 0x0000, 0x0422, 0x0000, 0x45e0,
-	0x000b, 0x0210, 0x0004, 0x8054, 0x0008, 0x0004, 0x0000, 0x8074,
-	0x0000, 0xf000, 0x0008, 0x8072, 0x0000, 0xb000, 0x0000, 0x019c,
-	0x0003, 0xbbe0, 0x0009, 0x0038, 0x0000, 0x0dfb, 0x000b, 0x18fe,
-	0x0000, 0x3ce0, 0x0009, 0x09f8, 0x0003, 0x15fe, 0x0008, 0x3ce0,
-	0x0009, 0x0db1, 0x0003, 0x020b, 0x0004, 0x8076, 0x0008, 0x0040,
-	0x0000, 0x8072, 0x0000, 0x8000, 0x0000, 0x0268, 0x000b, 0x8076,
-	0x0008, 0x0042, 0x0008, 0x0208, 0x000b, 0xbbe0, 0x0009, 0x0016,
-	0x0000, 0x0e08, 0x000b, 0x8074, 0x0000, 0x0808, 0x0008, 0x3a44,
-	0x0002, 0x0c0c, 0x000b, 0x8074, 0x0000, 0x0800, 0x0000, 0x8072,
-	0x0000, 0x8000, 0x0000, 0x8000, 0x000f, 0x000a, 0x000b, 0x8072,
-	0x0000, 0x8000, 0x0000, 0x000a, 0x000b, 0x3d30, 0x000a, 0x7f00,
-	0x0000, 0xbc80, 0x0001, 0x0007, 0x0000, 0x0214, 0x0003, 0x1930,
-	0x000a, 0x7f00, 0x0000, 0x9880, 0x0001, 0x0007, 0x0000, 0x8060,
-	0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x000a,
-	0x0008, 0x4619, 0x000b, 0x4000, 0x000f, 0x221e, 0x000b, 0x0870,
-	0x0008, 0x4000, 0x000f, 0x7e1b, 0x000b, 0xbbe0, 0x0009, 0x0030,
-	0x0008, 0x0e1b, 0x0003, 0x18fe, 0x0000, 0x3ce0, 0x0009, 0x0a2c,
-	0x0003, 0x15fe, 0x0008, 0x3ce0, 0x0009, 0x0a2c, 0x0003, 0x020b,
-	0x0004, 0x8076, 0x0008, 0x0040, 0x0000, 0x022e, 0x0003, 0x8076,
-	0x0008, 0x0041, 0x0008, 0x8072, 0x0000, 0x8000, 0x0000, 0x021b,
-	0x0003, 0xbac0, 0x0009, 0x0090, 0x0008, 0x0a37, 0x0003, 0x8074,
-	0x0000, 0x0706, 0x0000, 0x0239, 0x0003, 0x8074, 0x0000, 0x0703,
-	0x0000, 0x4000, 0x000f, 0x8010, 0x0008, 0x0023, 0x0000, 0x0276,
-	0x000b, 0x8010, 0x0008, 0x0008, 0x0000, 0x0276, 0x000b, 0x8010,
-	0x0008, 0x0022, 0x0008, 0x0276, 0x000b, 0x0210, 0x0004, 0x8010,
-	0x0008, 0x0007, 0x0000, 0x021b, 0x000c, 0x1810, 0x0000, 0x021b,
-	0x000c, 0x0282, 0x0003, 0x0210, 0x0004, 0x8010, 0x0008, 0x001b,
-	0x0008, 0x021b, 0x000c, 0x1810, 0x0000, 0x021b, 0x000c, 0x8074,
-	0x0000, 0xf080, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008, 0x0d30,
-	0x0000, 0x000a, 0x000b, 0x8010, 0x0008, 0x0009, 0x0008, 0x0276,
-	0x000b, 0x8010, 0x0008, 0x0005, 0x0008, 0x0276, 0x000b, 0x1648,
-	0x000a, 0x0c6f, 0x000b, 0x808c, 0x0008, 0x0001, 0x0000, 0x8010,
-	0x0008, 0x0004, 0x0000, 0x4143, 0x000a, 0x086f, 0x0003, 0x3a44,
-	0x0002, 0x0c0a, 0x000b, 0x0d2a, 0x0008, 0x0276, 0x000b, 0x8010,
-	0x0008, 0x0003, 0x0008, 0x027a, 0x000b, 0x8010, 0x0008, 0x000b,
-	0x0000, 0x027a, 0x000b, 0x8010, 0x0008, 0x0002, 0x0000, 0x027a,
-	0x000b, 0x3a47, 0x0002, 0x0d40, 0x000b, 0x8010, 0x0008, 0x0006,
-	0x0008, 0x027a, 0x000b, 0x8074, 0x0000, 0xf000, 0x0008, 0x8072,
-	0x0000, 0x3000, 0x0008, 0x021b, 0x000c, 0x0231, 0x0004, 0x3a40,
-	0x000a, 0x080a, 0x0003, 0x8010, 0x0008, 0x000c, 0x0008, 0x021b,
-	0x000c, 0x000a, 0x000b, 0x8074, 0x0000, 0xf080, 0x0000, 0x8072,
-	0x0000, 0x3000, 0x0008, 0x0d30, 0x0000, 0x2e4d, 0x0002, 0x2e4d,
-	0x0002, 0x0a8d, 0x000b, 0x8054, 0x0008, 0x0019, 0x0000, 0x000a,
-	0x000b, 0x8054, 0x0008, 0x0009, 0x0008, 0x000a, 0x000b, 0x3a44,
-	0x0002, 0x0c0a, 0x000b, 0x026b, 0x000b, 0x808c, 0x0008, 0x0000,
-	0x0008, 0x4447, 0x0002, 0x0ab9, 0x0003, 0xc0c0, 0x0001, 0x00ff,
-	0x0008, 0xffe0, 0x0009, 0x00ff, 0x0008, 0x0e90, 0x0003, 0xc1e0,
-	0x0001, 0xffff, 0x0008, 0x0e90, 0x0003, 0x8010, 0x0008, 0x0013,
-	0x0000, 0x021b, 0x000c, 0x8074, 0x0000, 0x0202, 0x0008, 0x000a,
-	0x000b, 0x3a40, 0x000a, 0x0eb6, 0x000b, 0x8074, 0x0000, 0x0200,
-	0x0000, 0x3d00, 0x0000, 0x3cfe, 0x0000, 0x8072, 0x0000, 0x8000,
-	0x0000, 0x43e0, 0x0001, 0x0eb4, 0x0003, 0x42fe, 0x0000, 0xffc0,
-	0x0001, 0x00ff, 0x0008, 0x00e0, 0x0009, 0x0a90, 0x000b, 0x0d08,
-	0x0008, 0x0309, 0x000b, 0x8072, 0x0000, 0x8000, 0x0000, 0x000a,
-	0x000b, 0x038d, 0x0004, 0x808c, 0x0008, 0x0001, 0x0000, 0x04fe,
-	0x0008, 0x3370, 0x0003, 0x0460, 0x0000, 0x8062, 0x0008, 0x0001,
-	0x0000, 0x8066, 0x0000, 0x0009, 0x0008, 0x46c3, 0x0003, 0x0004,
-	0x0000, 0x80c0, 0x0009, 0x00ff, 0x0008, 0x7f00, 0x0000, 0x80e0,
-	0x0001, 0x0004, 0x0000, 0x0add, 0x000b, 0x80e0, 0x0001, 0x0005,
-	0x0008, 0x0add, 0x000b, 0x80e0, 0x0001, 0x0006, 0x0008, 0x0add,
-	0x000b, 0x82c0, 0x0001, 0xff00, 0x0008, 0x7f04, 0x0008, 0x82e0,
-	0x0009, 0x0600, 0x0008, 0x0add, 0x000b, 0x82e0, 0x0009, 0x0500,
-	0x0008, 0x0add, 0x000b, 0x82e0, 0x0009, 0x0400, 0x0000, 0x0f70,
-	0x0003, 0xc4c0, 0x0009, 0x7000, 0x0000, 0xffe0, 0x0009, 0x1000,
-	0x0000, 0x0b09, 0x0003, 0x037e, 0x0004, 0x3941, 0x0002, 0x0ae8,
-	0x000b, 0x8072, 0x0000, 0x0400, 0x0000, 0x000a, 0x000b, 0x0460,
-	0x0000, 0x80fe, 0x0008, 0x002b, 0x0008, 0x7f62, 0x0008, 0x8066,
-	0x0000, 0x2209, 0x0008, 0x46ee, 0x0003, 0x11fe, 0x0000, 0x3304,
-	0x0003, 0x9180, 0x0001, 0x0002, 0x0000, 0x8060, 0x0000, 0x0400,
-	0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0609, 0x0008, 0x46f8,
-	0x000b, 0x42fe, 0x0000, 0xffc0, 0x0001, 0xff00, 0x0008, 0x03e0,
-	0x0009, 0x0f01, 0x0003, 0x8072, 0x0000, 0x0400, 0x0000, 0x0046,
-	0x0003, 0x9180, 0x0001, 0x0003, 0x0008, 0x02eb, 0x0003, 0x8072,
-	0x0000, 0x0400, 0x0000, 0x8010, 0x0008, 0x0010, 0x0000, 0x0361,
-	0x0003, 0x037e, 0x0004, 0x3941, 0x0002, 0x0b0f, 0x0003, 0x8072,
-	0x0000, 0x0400, 0x0000, 0x000a, 0x000b, 0x0346, 0x000c, 0x11fe,
-	0x0000, 0x0f17, 0x000b, 0x8072, 0x0000, 0x0400, 0x0000, 0x8010,
-	0x0008, 0x000e, 0x0000, 0x0361, 0x0003, 0x8060, 0x0000, 0x0400,
-	0x0000, 0x04fe, 0x0008, 0x0f2c, 0x0003, 0x808c, 0x0008, 0x0000,
-	0x0008, 0x9180, 0x0001, 0x0005, 0x0008, 0x7f62, 0x0008, 0x8066,
-	0x0000, 0x0009, 0x0008, 0x4722, 0x000b, 0x0060, 0x0008, 0x8062,
-	0x0008, 0x001b, 0x0008, 0x4304, 0x0008, 0x4206, 0x0008, 0x8066,
-	0x0000, 0x0412, 0x0000, 0x472a, 0x0003, 0x0343, 0x0003, 0x808c,
-	0x0008, 0x0001, 0x0000, 0x0460, 0x0000, 0x8062, 0x0008, 0x002b,
-	0x0008, 0x8066, 0x0000, 0x0609, 0x0008, 0x4733, 0x000b, 0x8066,
-	0x0000, 0x220a, 0x0008, 0x4736, 0x000b, 0x42fe, 0x0000, 0xffc0,
-	0x0001, 0xff00, 0x0008, 0x7f04, 0x0008, 0x8060, 0x0000, 0x0400,
-	0x0000, 0x9180, 0x0001, 0x0002, 0x0000, 0x7f62, 0x0008, 0x8066,
-	0x0000, 0x041a, 0x0008, 0x4742, 0x000b, 0x8072, 0x0000, 0x0400,
-	0x0000, 0x0046, 0x0003, 0x8060, 0x0000, 0x0400, 0x0000, 0x1362,
-	0x0008, 0x8066, 0x0000, 0x0411, 0x0000, 0x474b, 0x000b, 0x02fe,
-	0x0008, 0x03e0, 0x0009, 0x0f51, 0x0003, 0x0d22, 0x0000, 0x4000,
-	0x000f, 0x8280, 0x0009, 0x0002, 0x0000, 0x1380, 0x0001, 0x7f62,
-	0x0008, 0x8066, 0x0000, 0x2209, 0x0008, 0x4757, 0x0003, 0x0200,
-	0x000a, 0xffc0, 0x0001, 0x0007, 0x0000, 0x7f06, 0x0000, 0x1362,
-	0x0008, 0x8066, 0x0000, 0x060a, 0x0008, 0x475f, 0x000b, 0x4000,
-	0x000f, 0x3a44, 0x0002, 0x0c0a, 0x000b, 0x2f44, 0x000a, 0x2f44,
-	0x000a, 0x0e6b, 0x000b, 0x808a, 0x0008, 0x0003, 0x0008, 0x8074,
-	0x0000, 0xf080, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008, 0x5b6c,
-	0x0003, 0x8054, 0x0008, 0x0019, 0x0000, 0x000a, 0x000b, 0x3a44,
-	0x0002, 0x0c0a, 0x000b, 0x808c, 0x0008, 0x0000, 0x0008, 0x8010,
-	0x0008, 0x0011, 0x0008, 0x021b, 0x000c, 0x42fe, 0x0000, 0xffc0,
-	0x0001, 0x00ff, 0x0008, 0x7f10, 0x0008, 0x021b, 0x000c, 0x4310,
-	0x0008, 0x027a, 0x000b, 0x3941, 0x0002, 0x0b81, 0x0003, 0x4000,
-	0x000f, 0x8072, 0x0000, 0x0404, 0x0008, 0x4000, 0x000f, 0x8010,
-	0x0008, 0x0012, 0x0008, 0x021b, 0x000c, 0x0346, 0x000c, 0x1110,
-	0x0000, 0x021b, 0x000c, 0x11fe, 0x0000, 0x0f87, 0x000b, 0x000a,
-	0x000b, 0xc2c0, 0x0009, 0x00ff, 0x0008, 0x7f00, 0x0000, 0xc3c0,
-	0x0001, 0xff00, 0x0008, 0x00d0, 0x0009, 0x0bb2, 0x0003, 0x0d0a,
-	0x0000, 0x8580, 0x0001, 0x1000, 0x0000, 0x7f62, 0x0008, 0x8060,
-	0x0000, 0x0400, 0x0000, 0x8066, 0x0000, 0x0809, 0x0000, 0x479c,
-	0x000b, 0x04fe, 0x0008, 0x33ab, 0x0003, 0x0460, 0x0000, 0x8062,
-	0x0008, 0x0004, 0x0000, 0x8066, 0x0000, 0x0211, 0x0000, 0x47a4,
-	0x0003, 0x01fe, 0x0008, 0x00e0, 0x0009, 0x0fab, 0x0003, 0x02fe,
-	0x0008, 0x43e0, 0x0001, 0x0bb1, 0x0003, 0x0500, 0x0002, 0x7f0a,
-	0x0000, 0xffe0, 0x0009, 0x0800, 0x0000, 0x0f95, 0x000b, 0x0d08,
-	0x0008, 0x4000, 0x000f, 0x43fe, 0x0008, 0x3e80, 0x0001, 0xffc0,
-	0x0001, 0x7fff, 0x0000, 0x0d60, 0x0000, 0x7f62, 0x0008, 0x8066,
-	0x0000, 0x0809, 0x0000, 0x47ba, 0x0003, 0x8060, 0x0000, 0x0400,
-	0x0000, 0x84c0, 0x0001, 0xff00, 0x0008, 0x7f60, 0x000a, 0x7f60,
-	0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60,
-	0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0xff80, 0x0009, 0x1000,
-	0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0809, 0x0000, 0x47cc,
-	0x000b, 0x4000, 0x000f, 0xd7f4, 0xebe5, 0x0001, 0x0002, 0x0004,
-	0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400,
-	0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0x45cc
+	0x2128, 0x20a9, 0x007f, 0x900e, 0x0016, 0x0036, 0x080c, 0x65ff,
+	0x1190, 0x0056, 0x0086, 0x9046, 0x2508, 0x2029, 0x0001, 0x0096,
+	0x904e, 0x080c, 0xa69c, 0x009e, 0x008e, 0x903e, 0x080c, 0xa747,
+	0x080c, 0xe457, 0x005e, 0x003e, 0x001e, 0x8108, 0x1f04, 0xe4e4,
+	0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x0005, 0x00b6,
+	0x0076, 0x0056, 0x6210, 0x2258, 0x0086, 0x9046, 0x2029, 0x0001,
+	0x2019, 0x0048, 0x0096, 0x904e, 0x080c, 0xa69c, 0x009e, 0x008e,
+	0x903e, 0x080c, 0xa747, 0x2c20, 0x080c, 0xe457, 0x005e, 0x007e,
+	0x00be, 0x0005, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156,
+	0x2c20, 0x20a9, 0x0800, 0x900e, 0x0016, 0x0036, 0x080c, 0x65ff,
+	0x11a0, 0x0086, 0x9046, 0x2828, 0x0046, 0x2021, 0x0001, 0x080c,
+	0xe7ef, 0x004e, 0x0096, 0x904e, 0x080c, 0xa69c, 0x009e, 0x008e,
+	0x903e, 0x080c, 0xa747, 0x080c, 0xe457, 0x003e, 0x001e, 0x8108,
+	0x1f04, 0xe52c, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be,
+	0x0005, 0x0016, 0x00f6, 0x080c, 0xcb33, 0x0198, 0xa864, 0x9084,
+	0x00ff, 0x9086, 0x0046, 0x0180, 0xa800, 0x907d, 0x0138, 0xa803,
+	0x0000, 0xab82, 0x080c, 0x6c81, 0x2f48, 0x0cb0, 0xab82, 0x080c,
+	0x6c81, 0x00fe, 0x001e, 0x0005, 0xa800, 0x907d, 0x0130, 0xa803,
+	0x0000, 0x080c, 0x6c81, 0x2f48, 0x0cb8, 0x080c, 0x6c81, 0x0c88,
+	0x00e6, 0x0046, 0x0036, 0x2061, 0x1cd0, 0x9005, 0x1138, 0x2071,
+	0x1800, 0x7454, 0x7074, 0x8001, 0x9402, 0x12f8, 0x2100, 0x9c06,
+	0x0188, 0x6000, 0x9086, 0x0000, 0x0168, 0x6008, 0x9206, 0x1150,
+	0x6320, 0x9386, 0x0009, 0x01b0, 0x6010, 0x91a0, 0x0004, 0x2424,
+	0x9406, 0x0140, 0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02,
+	0x1220, 0x0c20, 0x9085, 0x0001, 0x0008, 0x9006, 0x003e, 0x004e,
+	0x00ee, 0x0005, 0x631c, 0xd3c4, 0x1d68, 0x0c30, 0x0096, 0x0006,
+	0x080c, 0x0fff, 0x000e, 0x090c, 0x0dd5, 0xaae2, 0xa867, 0x010d,
+	0xa88e, 0x0026, 0x2010, 0x080c, 0xcb23, 0x2001, 0x0000, 0x0120,
+	0x2200, 0x9080, 0x0015, 0x2004, 0x002e, 0xa87a, 0x9186, 0x0020,
+	0x0110, 0xa8e3, 0xffff, 0xa986, 0xac76, 0xa87f, 0x0000, 0x2001,
+	0x198e, 0x2004, 0xa882, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x6c81, 0x012e, 0x009e, 0x0005, 0x6700,
+	0x9786, 0x0000, 0x0158, 0x9786, 0x0001, 0x0140, 0x9786, 0x000a,
+	0x0128, 0x9786, 0x0009, 0x0110, 0x9085, 0x0001, 0x0005, 0x00e6,
+	0x6010, 0x9075, 0x0138, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206,
+	0x00ee, 0x0005, 0x9085, 0x0001, 0x0cd8, 0x0016, 0x6004, 0x908e,
+	0x001e, 0x11a0, 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036,
+	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0005, 0x2001, 0x1987,
+	0x2004, 0x601a, 0x080c, 0x90f0, 0x080c, 0x968d, 0x001e, 0x0005,
+	0xa001, 0xa001, 0x0005, 0x6024, 0xd0e4, 0x0158, 0xd0cc, 0x0118,
+	0x080c, 0xce68, 0x0030, 0x080c, 0xe80b, 0x080c, 0x86b2, 0x080c,
+	0xae61, 0x0005, 0x9280, 0x0008, 0x2004, 0x9084, 0x000f, 0x0002,
+	0xe63e, 0xe63e, 0xe63e, 0xe640, 0xe63e, 0xe640, 0xe640, 0xe63e,
+	0xe640, 0xe63e, 0xe63e, 0xe63e, 0xe63e, 0xe63e, 0x9006, 0x0005,
+	0x9085, 0x0001, 0x0005, 0x9280, 0x0008, 0x2004, 0x9084, 0x000f,
+	0x0002, 0xe657, 0xe657, 0xe657, 0xe657, 0xe657, 0xe657, 0xe664,
+	0xe657, 0xe657, 0xe657, 0xe657, 0xe657, 0xe657, 0xe657, 0x6007,
+	0x003b, 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x080c,
+	0x90f0, 0x080c, 0x968d, 0x0005, 0x0096, 0x00c6, 0x2260, 0x080c,
+	0xe80b, 0x6043, 0x0000, 0x6024, 0xc0f4, 0xc0e4, 0x6026, 0x603b,
+	0x0000, 0x00ce, 0x00d6, 0x2268, 0x9186, 0x0007, 0x1904, 0xe6bd,
+	0x6814, 0x9005, 0x0138, 0x2048, 0xa87c, 0xd0fc, 0x1118, 0x00de,
+	0x009e, 0x08a8, 0x6007, 0x003a, 0x6003, 0x0001, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002, 0x1904,
+	0xe734, 0x6014, 0x9005, 0x1138, 0x6000, 0x9086, 0x0007, 0x190c,
+	0x0dd5, 0x0804, 0xe734, 0x2048, 0x080c, 0xcb35, 0x1130, 0x0028,
+	0x2048, 0xa800, 0x9005, 0x1de0, 0x2900, 0x2048, 0xa87c, 0x9084,
+	0x0003, 0x9086, 0x0002, 0x1168, 0xa87c, 0xc0dc, 0xc0f4, 0xa87e,
+	0xa880, 0xc0fc, 0xa882, 0x2009, 0x0043, 0x080c, 0xdf8d, 0x0804,
+	0xe734, 0x2009, 0x0041, 0x0804, 0xe72e, 0x9186, 0x0005, 0x15a0,
+	0x6814, 0x2048, 0xa87c, 0xd0bc, 0x1120, 0x00de, 0x009e, 0x0804,
+	0xe657, 0xd0b4, 0x0128, 0xd0fc, 0x090c, 0x0dd5, 0x0804, 0xe678,
+	0x6007, 0x003a, 0x6003, 0x0001, 0x080c, 0x90f0, 0x080c, 0x968d,
+	0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002, 0x0120, 0x9186, 0x0004,
+	0x1904, 0xe734, 0x6814, 0x2048, 0xa97c, 0xc1f4, 0xc1dc, 0xa97e,
+	0xa980, 0xc1fc, 0xc1bc, 0xa982, 0x00f6, 0x2c78, 0x080c, 0x1725,
+	0x00fe, 0x2009, 0x0042, 0x04d0, 0x0036, 0x080c, 0x0fff, 0x090c,
+	0x0dd5, 0xa867, 0x010d, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x2d18,
+	0xab8e, 0xa887, 0x0045, 0x2c00, 0xa892, 0x6038, 0xa8a2, 0x2360,
+	0x6024, 0xc0dd, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be,
+	0x2004, 0x6354, 0xab7a, 0xa876, 0x9006, 0xa87e, 0xa882, 0xad9a,
+	0xae96, 0xa89f, 0x0001, 0x080c, 0x6c81, 0x2019, 0x0045, 0x6008,
+	0x2068, 0x080c, 0xe134, 0x2d00, 0x600a, 0x6023, 0x0006, 0x6003,
+	0x0007, 0x901e, 0x631a, 0x6342, 0x003e, 0x0038, 0x6043, 0x0000,
+	0x6003, 0x0007, 0x080c, 0xdf8d, 0x00ce, 0x00de, 0x009e, 0x0005,
+	0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0085, 0x2008, 0x00c2,
+	0x9186, 0x0027, 0x1178, 0x080c, 0x9588, 0x0036, 0x0096, 0x6014,
+	0x2048, 0x2019, 0x0004, 0x080c, 0xe551, 0x009e, 0x003e, 0x080c,
+	0x968d, 0x0005, 0x9186, 0x0014, 0x0d70, 0x080c, 0xaef7, 0x0005,
+	0xe767, 0xe765, 0xe765, 0xe765, 0xe765, 0xe765, 0xe767, 0xe765,
+	0xe765, 0xe765, 0xe765, 0xe765, 0xe765, 0x080c, 0x0dd5, 0x080c,
+	0x9588, 0x6003, 0x000c, 0x080c, 0x968d, 0x0005, 0x9182, 0x0092,
+	0x1220, 0x9182, 0x0085, 0x0208, 0x001a, 0x080c, 0xaef7, 0x0005,
+	0xe785, 0xe785, 0xe785, 0xe785, 0xe787, 0xe7a7, 0xe785, 0xe785,
+	0xe785, 0xe785, 0xe785, 0xe785, 0xe785, 0x080c, 0x0dd5, 0x00d6,
+	0x2c68, 0x080c, 0xae0b, 0x01b0, 0x6003, 0x0001, 0x6007, 0x001e,
+	0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f, 0x210c, 0x613e,
+	0x600b, 0xffff, 0x6910, 0x6112, 0x6023, 0x0004, 0x080c, 0x90f0,
+	0x080c, 0x968d, 0x2d60, 0x080c, 0xae61, 0x00de, 0x0005, 0x080c,
+	0xae61, 0x0005, 0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
+	0xd0ec, 0x00ee, 0x0005, 0x2009, 0x1867, 0x210c, 0xd1ec, 0x05b0,
+	0x6003, 0x0002, 0x6024, 0xc0e5, 0x6026, 0xd0cc, 0x0150, 0x2001,
+	0x1988, 0x2004, 0x6042, 0x2009, 0x1867, 0x210c, 0xd1f4, 0x1520,
+	0x00a0, 0x2009, 0x1867, 0x210c, 0xd1f4, 0x0128, 0x6024, 0xc0e4,
+	0x6026, 0x9006, 0x00d8, 0x2001, 0x1988, 0x200c, 0x2001, 0x1986,
+	0x2004, 0x9100, 0x9080, 0x000a, 0x6042, 0x6010, 0x00b6, 0x2058,
+	0xb8bc, 0x00be, 0x0008, 0x2104, 0x9005, 0x0118, 0x9088, 0x0003,
+	0x0cd0, 0x2c0a, 0x600f, 0x0000, 0x9085, 0x0001, 0x0005, 0x0016,
+	0x00c6, 0x00e6, 0x6154, 0xb8bc, 0x2060, 0x8cff, 0x0180, 0x84ff,
+	0x1118, 0x6054, 0x9106, 0x1138, 0x600c, 0x2072, 0x080c, 0x86b2,
+	0x080c, 0xae61, 0x0010, 0x9cf0, 0x0003, 0x2e64, 0x0c70, 0x00ee,
+	0x00ce, 0x001e, 0x0005, 0x00d6, 0x00b6, 0x6010, 0x2058, 0xb8bc,
+	0x2068, 0x9005, 0x0130, 0x9c06, 0x0110, 0x680c, 0x0cd0, 0x600c,
+	0x680e, 0x00be, 0x00de, 0x0005, 0x0026, 0x0036, 0x0156, 0x2011,
+	0x182c, 0x2204, 0x9084, 0x00ff, 0x2019, 0x026e, 0x2334, 0x9636,
+	0x1508, 0x8318, 0x2334, 0x2204, 0x9084, 0xff00, 0x9636, 0x11d0,
+	0x2011, 0x0270, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019,
+	0x000a, 0x080c, 0xbe1d, 0x009e, 0x1168, 0x2011, 0x0274, 0x20a9,
+	0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x0006, 0x080c, 0xbe1d,
+	0x009e, 0x1100, 0x015e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x2071,
+	0x1800, 0x080c, 0x5fad, 0x080c, 0x2f96, 0x00ee, 0x0005, 0x0096,
+	0x0026, 0x080c, 0x0fff, 0x090c, 0x0dd5, 0xa85c, 0x9080, 0x001a,
+	0x20a0, 0x20a9, 0x000c, 0xa860, 0x20e8, 0x9006, 0x4004, 0x9186,
+	0x0046, 0x1118, 0xa867, 0x0136, 0x0038, 0xa867, 0x0138, 0x9186,
+	0x0041, 0x0110, 0xa87b, 0x0001, 0x7038, 0x9084, 0xff00, 0x7240,
+	0x9294, 0xff00, 0x8007, 0x9215, 0xaa9a, 0x9186, 0x0046, 0x1168,
+	0x7038, 0x9084, 0x00ff, 0x723c, 0x9294, 0xff00, 0x9215, 0xaa9e,
+	0x723c, 0x9294, 0x00ff, 0xaaa2, 0x0060, 0x7040, 0x9084, 0x00ff,
+	0x7244, 0x9294, 0xff00, 0x9215, 0xaa9e, 0x7244, 0x9294, 0x00ff,
+	0xaaa2, 0x9186, 0x0046, 0x1118, 0x9e90, 0x0012, 0x0010, 0x9e90,
+	0x001a, 0x2204, 0x8007, 0xa8a6, 0x8210, 0x2204, 0x8007, 0xa8aa,
+	0x8210, 0x2204, 0x8007, 0xa8ae, 0x8210, 0x2204, 0x8007, 0xa8b2,
+	0x8210, 0x9186, 0x0046, 0x11b8, 0x9e90, 0x0016, 0x2204, 0x8007,
+	0xa8b6, 0x8210, 0x2204, 0x8007, 0xa8ba, 0x8210, 0x2204, 0x8007,
+	0xa8be, 0x8210, 0x2204, 0x8007, 0xa8c2, 0x8210, 0x2011, 0x0205,
+	0x2013, 0x0001, 0x00b0, 0x9e90, 0x001e, 0x2204, 0x8007, 0xa8b6,
+	0x8210, 0x2204, 0x8007, 0xa8ba, 0x2011, 0x0205, 0x2013, 0x0001,
+	0x2011, 0x0260, 0x2204, 0x8007, 0xa8be, 0x8210, 0x2204, 0x8007,
+	0xa8c2, 0x9186, 0x0046, 0x1118, 0x2011, 0x0262, 0x0010, 0x2011,
+	0x026a, 0x0146, 0x01d6, 0x0036, 0x20a9, 0x0001, 0x2019, 0x0008,
+	0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0x2204, 0x8007,
+	0x4004, 0x8210, 0x8319, 0x1dd0, 0x003e, 0x01ce, 0x013e, 0x2011,
+	0x0205, 0x2013, 0x0000, 0x002e, 0x080c, 0x6c81, 0x009e, 0x0005,
+	0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0fc, 0x0108,
+	0x0011, 0x00ee, 0x0005, 0xa880, 0xc0e5, 0xa882, 0x0005, 0x00e6,
+	0x00d6, 0x00c6, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0016,
+	0x0126, 0x2091, 0x8000, 0x2029, 0x19f0, 0x252c, 0x2021, 0x19f6,
+	0x2424, 0x2061, 0x1cd0, 0x2071, 0x1800, 0x7654, 0x7074, 0x9606,
+	0x0578, 0x6720, 0x9786, 0x0001, 0x0118, 0x9786, 0x0008, 0x1500,
+	0x2500, 0x9c06, 0x01e8, 0x2400, 0x9c06, 0x01d0, 0x080c, 0xe5df,
+	0x01b8, 0x080c, 0xe5ef, 0x11a0, 0x6000, 0x9086, 0x0004, 0x1120,
+	0x0016, 0x080c, 0x1a5e, 0x001e, 0x080c, 0xcd2a, 0x1110, 0x080c,
+	0x31e8, 0x080c, 0xcd3b, 0x1110, 0x080c, 0xb813, 0x080c, 0xae92,
+	0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1208, 0x0858,
+	0x012e, 0x001e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce,
+	0x00de, 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0dc, 0x0005,
+	0x0006, 0x2001, 0x1837, 0x2004, 0xd09c, 0x000e, 0x0005, 0x0006,
+	0x0036, 0x0046, 0x080c, 0xd230, 0x0168, 0x2019, 0xffff, 0x9005,
+	0x0128, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004,
+	0x080c, 0x4cbb, 0x004e, 0x003e, 0x000e, 0x6004, 0x9086, 0x0001,
+	0x1128, 0x080c, 0xa808, 0x080c, 0xae92, 0x9006, 0x0005, 0x00e6,
+	0x00c6, 0x00b6, 0x0046, 0x2061, 0x1cd0, 0x2071, 0x1800, 0x7454,
+	0x7074, 0x8001, 0x9402, 0x12b8, 0x2100, 0x9c06, 0x0148, 0x6000,
+	0x9086, 0x0000, 0x0128, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x0140,
+	0x9ce0, 0x0018, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1220, 0x0c60,
+	0x9085, 0x0001, 0x0008, 0x9006, 0x004e, 0x00be, 0x00ce, 0x00ee,
+	0x0005, 0x0126, 0x0006, 0x00e6, 0x0016, 0x2091, 0x8000, 0x2071,
+	0x1840, 0xd5a4, 0x0118, 0x7004, 0x8000, 0x7006, 0xd5b4, 0x0118,
+	0x7000, 0x8000, 0x7002, 0xd5ac, 0x0178, 0x2500, 0x9084, 0x0007,
+	0x908e, 0x0003, 0x0148, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005,
+	0x0118, 0x2071, 0xfffe, 0x0089, 0x001e, 0x00ee, 0x000e, 0x012e,
+	0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0xfff6,
+	0x0021, 0x00ee, 0x000e, 0x012e, 0x0005, 0x2e05, 0x8000, 0x2077,
+	0x1220, 0x8e70, 0x2e05, 0x8000, 0x2077, 0x0005, 0x00e6, 0x2071,
+	0xfff4, 0x0c99, 0x00ee, 0x0005, 0x00e6, 0x2071, 0xfff8, 0x0c69,
+	0x00ee, 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071,
+	0x1840, 0x7014, 0x8000, 0x7016, 0x00ee, 0x000e, 0x012e, 0x0005,
+	0x0003, 0x000b, 0x079e, 0x0000, 0xc000, 0x0001, 0x8064, 0x0008,
+	0x0010, 0x0000, 0x8066, 0x0000, 0x0101, 0x0008, 0x4407, 0x0003,
+	0x8060, 0x0000, 0x0400, 0x0000, 0x580d, 0x000b, 0x79a8, 0x000b,
+	0x50ee, 0x000b, 0x4c0a, 0x0003, 0xbac0, 0x0009, 0x008a, 0x0000,
+	0x0c0a, 0x000b, 0x15fe, 0x0008, 0x340a, 0x0003, 0xc4c0, 0x0009,
+	0x7000, 0x0000, 0xffa0, 0x0001, 0x2000, 0x0000, 0x1668, 0x000b,
+	0x808c, 0x0008, 0x0001, 0x0000, 0x0000, 0x0007, 0x4028, 0x0000,
+	0x4047, 0x000a, 0x808c, 0x0008, 0x0002, 0x0000, 0x0822, 0x0003,
+	0x4022, 0x0000, 0x0028, 0x000b, 0x4122, 0x0008, 0x94c0, 0x0009,
+	0xff00, 0x0008, 0xffe0, 0x0009, 0x0500, 0x0008, 0x0a93, 0x000b,
+	0x4447, 0x0002, 0x0e90, 0x0003, 0x0bfe, 0x0008, 0x11a0, 0x0001,
+	0x126e, 0x0003, 0x0ca0, 0x0001, 0x126e, 0x0003, 0x9180, 0x0001,
+	0x0004, 0x0000, 0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008,
+	0x8066, 0x0000, 0x0009, 0x0008, 0x4436, 0x000b, 0x808c, 0x0008,
+	0x0000, 0x0008, 0x0060, 0x0008, 0x8062, 0x0008, 0x0004, 0x0000,
+	0x8066, 0x0000, 0x0411, 0x0000, 0x443e, 0x0003, 0x03fe, 0x0000,
+	0x43e0, 0x0001, 0x0e6b, 0x000b, 0xc2c0, 0x0009, 0x00ff, 0x0008,
+	0x02e0, 0x0001, 0x0e6b, 0x000b, 0x9180, 0x0001, 0x0005, 0x0008,
+	0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000,
+	0x0019, 0x0000, 0x444d, 0x000b, 0x0240, 0x0002, 0x0a68, 0x0003,
+	0x00fe, 0x0000, 0x326b, 0x000b, 0x0248, 0x000a, 0x085c, 0x0003,
+	0x9180, 0x0001, 0x0006, 0x0008, 0x7f62, 0x0008, 0x8002, 0x0008,
+	0x0003, 0x0008, 0x8066, 0x0000, 0x020a, 0x0000, 0x445b, 0x0003,
+	0x112a, 0x0000, 0x002e, 0x0008, 0x022c, 0x0008, 0x3a44, 0x0002,
+	0x0c0a, 0x000b, 0x808c, 0x0008, 0x0002, 0x0000, 0x1760, 0x0008,
+	0x8062, 0x0008, 0x000f, 0x0008, 0x8066, 0x0000, 0x0011, 0x0008,
+	0x4468, 0x0003, 0x01fe, 0x0008, 0x42e0, 0x0009, 0x0e5c, 0x0003,
+	0x00fe, 0x0000, 0x43e0, 0x0001, 0x0e5c, 0x0003, 0x1734, 0x0000,
+	0x1530, 0x0000, 0x1632, 0x0008, 0x0d2a, 0x0008, 0x9880, 0x0001,
+	0x0010, 0x0000, 0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008,
+	0x8066, 0x0000, 0x1e0a, 0x0008, 0x447a, 0x0003, 0x808a, 0x0008,
+	0x0003, 0x0008, 0x1a60, 0x0000, 0x8062, 0x0008, 0x0002, 0x0000,
+	0x5880, 0x000b, 0x8066, 0x0000, 0x3679, 0x0000, 0x4483, 0x0003,
+	0x5884, 0x0003, 0x3efe, 0x0008, 0x7f4f, 0x0002, 0x088a, 0x000b,
+	0x0d00, 0x0000, 0x0092, 0x000c, 0x8054, 0x0008, 0x0011, 0x0008,
+	0x8074, 0x0000, 0x1010, 0x0008, 0x1efe, 0x0000, 0x300a, 0x000b,
+	0x00c8, 0x000c, 0x000a, 0x000b, 0x00fe, 0x0000, 0x349a, 0x0003,
+	0x1a60, 0x0000, 0x8062, 0x0008, 0x0007, 0x0000, 0x8066, 0x0000,
+	0x0231, 0x0008, 0x4499, 0x000b, 0x03fe, 0x0000, 0x04d0, 0x0001,
+	0x0cc0, 0x000b, 0x82c0, 0x0001, 0x1f00, 0x0000, 0xffa0, 0x0001,
+	0x0400, 0x0000, 0x08af, 0x0003, 0x14c0, 0x000b, 0x01fe, 0x0008,
+	0x0580, 0x0009, 0x7f06, 0x0000, 0x02fe, 0x0008, 0xffc0, 0x0001,
+	0x00ff, 0x0008, 0x0690, 0x0001, 0x10af, 0x0003, 0x7f08, 0x0008,
+	0x84c0, 0x0001, 0xff00, 0x0008, 0x08c0, 0x0003, 0x00fe, 0x0000,
+	0x34b6, 0x000b, 0x8072, 0x0000, 0x1010, 0x0008, 0x3944, 0x0002,
+	0x08b1, 0x0003, 0x00ba, 0x0003, 0x8072, 0x0000, 0x2020, 0x0008,
+	0x3945, 0x000a, 0x08b6, 0x000b, 0x3946, 0x000a, 0x0cc7, 0x0003,
+	0x0000, 0x0007, 0x3943, 0x000a, 0x08c7, 0x000b, 0x00ba, 0x0003,
+	0x00fe, 0x0000, 0x34c5, 0x0003, 0x8072, 0x0000, 0x1000, 0x0000,
+	0x00c7, 0x0003, 0x8072, 0x0000, 0x2000, 0x0000, 0x4000, 0x000f,
+	0x1c60, 0x0000, 0x1b62, 0x0000, 0x8066, 0x0000, 0x0231, 0x0008,
+	0x44cc, 0x000b, 0x58cd, 0x000b, 0x0140, 0x0008, 0x0242, 0x0000,
+	0x1f43, 0x0002, 0x0cdb, 0x000b, 0x0d44, 0x0000, 0x0d46, 0x0008,
+	0x0348, 0x0008, 0x044a, 0x0008, 0x030a, 0x0008, 0x040c, 0x0000,
+	0x0d06, 0x0000, 0x0d08, 0x0008, 0x00df, 0x0003, 0x0344, 0x0008,
+	0x0446, 0x0008, 0x0548, 0x0008, 0x064a, 0x0000, 0x1948, 0x000a,
+	0x08e2, 0x0003, 0x0d4a, 0x0008, 0x58e2, 0x0003, 0x3efe, 0x0008,
+	0x7f4f, 0x0002, 0x08e9, 0x000b, 0x8000, 0x0000, 0x0001, 0x0000,
+	0x0092, 0x000c, 0x8054, 0x0008, 0x0001, 0x0000, 0x8074, 0x0000,
+	0x2020, 0x0008, 0x4000, 0x000f, 0x3a40, 0x000a, 0x0c0d, 0x0003,
+	0x2b24, 0x0008, 0x2b24, 0x0008, 0x58f2, 0x000b, 0x8054, 0x0008,
+	0x0002, 0x0000, 0x1242, 0x0002, 0x0940, 0x0003, 0x3a45, 0x000a,
+	0x092f, 0x0003, 0x8072, 0x0000, 0x1000, 0x0000, 0x3945, 0x000a,
+	0x08ff, 0x0003, 0x8072, 0x0000, 0x3010, 0x0000, 0x1e10, 0x000a,
+	0x7f3c, 0x0000, 0x092a, 0x0003, 0x1d00, 0x0002, 0x7f3a, 0x0000,
+	0x0d60, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0009, 0x0008,
+	0x4508, 0x000b, 0x00fe, 0x0000, 0x3527, 0x000b, 0x1c60, 0x0000,
+	0x8062, 0x0008, 0x0001, 0x0000, 0x8066, 0x0000, 0x0009, 0x0008,
+	0x4510, 0x000b, 0x00fe, 0x0000, 0x3243, 0x000b, 0x0038, 0x0000,
+	0x0060, 0x0008, 0x8062, 0x0008, 0x0019, 0x0000, 0x8066, 0x0000,
+	0x0009, 0x0008, 0x4519, 0x000b, 0x80c0, 0x0009, 0x00ff, 0x0008,
+	0x7f3e, 0x0008, 0x0d60, 0x0000, 0x0efe, 0x0008, 0x1f80, 0x0001,
+	0x7f62, 0x0008, 0x8066, 0x0000, 0x0009, 0x0008, 0x4523, 0x000b,
+	0x003a, 0x0008, 0x1dfe, 0x0000, 0x0104, 0x000b, 0x0036, 0x0008,
+	0x00c8, 0x000c, 0x0140, 0x000b, 0x8074, 0x0000, 0x2000, 0x0000,
+	0x8072, 0x0000, 0x2000, 0x0000, 0x0140, 0x000b, 0x3a44, 0x0002,
+	0x0a71, 0x000b, 0x8074, 0x0000, 0x1000, 0x0000, 0x8072, 0x0000,
+	0x1000, 0x0000, 0x2d0e, 0x0000, 0x2d0e, 0x0000, 0x3640, 0x0003,
+	0x26fe, 0x0008, 0x26fe, 0x0008, 0x2700, 0x0008, 0x2700, 0x0008,
+	0x00d0, 0x0009, 0x0d52, 0x000b, 0x8074, 0x0000, 0x4040, 0x0008,
+	0x5940, 0x0003, 0x50ee, 0x000b, 0x3a46, 0x000a, 0x0d52, 0x000b,
+	0x3a47, 0x0002, 0x094d, 0x000b, 0x8054, 0x0008, 0x0004, 0x0000,
+	0x8074, 0x0000, 0x8000, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008,
+	0x019c, 0x0003, 0x92c0, 0x0009, 0x0fc8, 0x0000, 0x080a, 0x0003,
+	0x1246, 0x000a, 0x0e3a, 0x0003, 0x1a60, 0x0000, 0x8062, 0x0008,
+	0x0002, 0x0000, 0x8066, 0x0000, 0x362a, 0x0000, 0x4557, 0x000b,
+	0x2000, 0x0000, 0x2000, 0x0000, 0x2102, 0x0000, 0x2102, 0x0000,
+	0x2204, 0x0000, 0x2204, 0x0000, 0x2306, 0x0000, 0x2306, 0x0000,
+	0x2408, 0x0000, 0x2408, 0x0000, 0x250a, 0x0000, 0x250a, 0x0000,
+	0x260c, 0x0000, 0x260c, 0x0000, 0x270e, 0x0000, 0x270e, 0x0000,
+	0x2810, 0x0000, 0x2810, 0x0000, 0x2912, 0x0000, 0x2912, 0x0000,
+	0x1a60, 0x0000, 0x8062, 0x0008, 0x0007, 0x0000, 0x8066, 0x0000,
+	0x0052, 0x0000, 0x4571, 0x0003, 0x92c0, 0x0009, 0x0780, 0x0008,
+	0x0e56, 0x0003, 0x124b, 0x0002, 0x097a, 0x0003, 0x2e4d, 0x0002,
+	0x2e4d, 0x0002, 0x0a40, 0x0003, 0x3a46, 0x000a, 0x0d8a, 0x000b,
+	0x597c, 0x0003, 0x8054, 0x0008, 0x0004, 0x0000, 0x1243, 0x000a,
+	0x0998, 0x0003, 0x8010, 0x0008, 0x000d, 0x0000, 0x021b, 0x000c,
+	0x1948, 0x000a, 0x0987, 0x000b, 0x0210, 0x0004, 0x1810, 0x0000,
+	0x021b, 0x000c, 0x0198, 0x000b, 0x1948, 0x000a, 0x098e, 0x000b,
+	0x1243, 0x000a, 0x0a43, 0x0003, 0x194d, 0x000a, 0x0992, 0x0003,
+	0x1243, 0x000a, 0x0a4a, 0x0003, 0x5992, 0x0003, 0x8054, 0x0008,
+	0x0004, 0x0000, 0x0210, 0x0004, 0x1810, 0x0000, 0x021b, 0x000c,
+	0x8074, 0x0000, 0xf000, 0x0008, 0x8072, 0x0000, 0x3000, 0x0008,
+	0x0d30, 0x0000, 0x3a42, 0x0002, 0x0da2, 0x000b, 0x15fe, 0x0008,
+	0x3461, 0x000b, 0x000a, 0x000b, 0x8074, 0x0000, 0x0501, 0x0000,
+	0x8010, 0x0008, 0x000c, 0x0008, 0x021b, 0x000c, 0x000a, 0x000b,
+	0xbbe0, 0x0009, 0x0030, 0x0008, 0x0db8, 0x0003, 0x18fe, 0x0000,
+	0x3ce0, 0x0009, 0x09b5, 0x0003, 0x15fe, 0x0008, 0x3ce0, 0x0009,
+	0x09b5, 0x0003, 0x020b, 0x0004, 0x8076, 0x0008, 0x0040, 0x0000,
+	0x0208, 0x000b, 0x8076, 0x0008, 0x0041, 0x0008, 0x0208, 0x000b,
+	0xbbe0, 0x0009, 0x0032, 0x0000, 0x0dbd, 0x0003, 0x3c1e, 0x0008,
+	0x0208, 0x000b, 0xbbe0, 0x0009, 0x003b, 0x0000, 0x0dc2, 0x000b,
+	0x3c20, 0x0000, 0x0208, 0x000b, 0xbbe0, 0x0009, 0x0035, 0x0008,
+	0x0dc8, 0x000b, 0x8072, 0x0000, 0x8000, 0x0000, 0x0384, 0x000b,
+	0xbbe0, 0x0009, 0x0036, 0x0008, 0x0aa5, 0x000b, 0xbbe0, 0x0009,
+	0x0037, 0x0000, 0x0de9, 0x000b, 0x18fe, 0x0000, 0x3ce0, 0x0009,
+	0x0db5, 0x000b, 0x8076, 0x0008, 0x0040, 0x0000, 0x1a60, 0x0000,
+	0x8062, 0x0008, 0x000d, 0x0000, 0x2604, 0x0008, 0x2604, 0x0008,
+	0x2706, 0x0008, 0x2706, 0x0008, 0x2808, 0x0000, 0x2808, 0x0000,
+	0x290a, 0x0000, 0x290a, 0x0000, 0x8066, 0x0000, 0x0422, 0x0000,
+	0x45e0, 0x000b, 0x0210, 0x0004, 0x8054, 0x0008, 0x0004, 0x0000,
+	0x8074, 0x0000, 0xf000, 0x0008, 0x8072, 0x0000, 0xb000, 0x0000,
+	0x019c, 0x0003, 0xbbe0, 0x0009, 0x0038, 0x0000, 0x0dfb, 0x000b,
+	0x18fe, 0x0000, 0x3ce0, 0x0009, 0x09f8, 0x0003, 0x15fe, 0x0008,
+	0x3ce0, 0x0009, 0x0db1, 0x0003, 0x020b, 0x0004, 0x8076, 0x0008,
+	0x0040, 0x0000, 0x8072, 0x0000, 0x8000, 0x0000, 0x0268, 0x000b,
+	0x8076, 0x0008, 0x0042, 0x0008, 0x0208, 0x000b, 0xbbe0, 0x0009,
+	0x0016, 0x0000, 0x0e08, 0x000b, 0x8074, 0x0000, 0x0808, 0x0008,
+	0x3a44, 0x0002, 0x0c0c, 0x000b, 0x8074, 0x0000, 0x0800, 0x0000,
+	0x8072, 0x0000, 0x8000, 0x0000, 0x8000, 0x000f, 0x000a, 0x000b,
+	0x8072, 0x0000, 0x8000, 0x0000, 0x000a, 0x000b, 0x3d30, 0x000a,
+	0x7f00, 0x0000, 0xbc80, 0x0001, 0x0007, 0x0000, 0x0214, 0x0003,
+	0x1930, 0x000a, 0x7f00, 0x0000, 0x9880, 0x0001, 0x0007, 0x0000,
+	0x8060, 0x0000, 0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000,
+	0x000a, 0x0008, 0x4619, 0x000b, 0x4000, 0x000f, 0x221e, 0x000b,
+	0x0870, 0x0008, 0x4000, 0x000f, 0x7e1b, 0x000b, 0xbbe0, 0x0009,
+	0x0030, 0x0008, 0x0e1b, 0x0003, 0x18fe, 0x0000, 0x3ce0, 0x0009,
+	0x0a2c, 0x0003, 0x15fe, 0x0008, 0x3ce0, 0x0009, 0x0a2c, 0x0003,
+	0x020b, 0x0004, 0x8076, 0x0008, 0x0040, 0x0000, 0x022e, 0x0003,
+	0x8076, 0x0008, 0x0041, 0x0008, 0x8072, 0x0000, 0x8000, 0x0000,
+	0x021b, 0x0003, 0xbac0, 0x0009, 0x0090, 0x0008, 0x0a37, 0x0003,
+	0x8074, 0x0000, 0x0706, 0x0000, 0x0239, 0x0003, 0x8074, 0x0000,
+	0x0703, 0x0000, 0x4000, 0x000f, 0x8010, 0x0008, 0x0023, 0x0000,
+	0x0276, 0x000b, 0x8010, 0x0008, 0x0008, 0x0000, 0x0276, 0x000b,
+	0x8010, 0x0008, 0x0022, 0x0008, 0x0276, 0x000b, 0x0210, 0x0004,
+	0x8010, 0x0008, 0x0007, 0x0000, 0x021b, 0x000c, 0x1810, 0x0000,
+	0x021b, 0x000c, 0x0282, 0x0003, 0x0210, 0x0004, 0x8010, 0x0008,
+	0x001b, 0x0008, 0x021b, 0x000c, 0x1810, 0x0000, 0x021b, 0x000c,
+	0x8074, 0x0000, 0xf080, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008,
+	0x0d30, 0x0000, 0x000a, 0x000b, 0x8010, 0x0008, 0x0009, 0x0008,
+	0x0276, 0x000b, 0x8010, 0x0008, 0x0005, 0x0008, 0x0276, 0x000b,
+	0x1648, 0x000a, 0x0c6f, 0x000b, 0x808c, 0x0008, 0x0001, 0x0000,
+	0x8010, 0x0008, 0x0004, 0x0000, 0x4143, 0x000a, 0x086f, 0x0003,
+	0x3a44, 0x0002, 0x0c0a, 0x000b, 0x0d2a, 0x0008, 0x0276, 0x000b,
+	0x8010, 0x0008, 0x0003, 0x0008, 0x027a, 0x000b, 0x8010, 0x0008,
+	0x000b, 0x0000, 0x027a, 0x000b, 0x8010, 0x0008, 0x0002, 0x0000,
+	0x027a, 0x000b, 0x3a47, 0x0002, 0x0d40, 0x000b, 0x8010, 0x0008,
+	0x0006, 0x0008, 0x027a, 0x000b, 0x8074, 0x0000, 0xf000, 0x0008,
+	0x8072, 0x0000, 0x3000, 0x0008, 0x021b, 0x000c, 0x0231, 0x0004,
+	0x3a40, 0x000a, 0x080a, 0x0003, 0x8010, 0x0008, 0x000c, 0x0008,
+	0x021b, 0x000c, 0x000a, 0x000b, 0x8074, 0x0000, 0xf080, 0x0000,
+	0x8072, 0x0000, 0x3000, 0x0008, 0x0d30, 0x0000, 0x2e4d, 0x0002,
+	0x2e4d, 0x0002, 0x0a8d, 0x000b, 0x8054, 0x0008, 0x0019, 0x0000,
+	0x000a, 0x000b, 0x8054, 0x0008, 0x0009, 0x0008, 0x000a, 0x000b,
+	0x3a44, 0x0002, 0x0c0a, 0x000b, 0x026b, 0x000b, 0x808c, 0x0008,
+	0x0000, 0x0008, 0x4447, 0x0002, 0x0ab9, 0x0003, 0xc0c0, 0x0001,
+	0x00ff, 0x0008, 0xffe0, 0x0009, 0x00ff, 0x0008, 0x0e90, 0x0003,
+	0xc1e0, 0x0001, 0xffff, 0x0008, 0x0e90, 0x0003, 0x8010, 0x0008,
+	0x0013, 0x0000, 0x021b, 0x000c, 0x8074, 0x0000, 0x0202, 0x0008,
+	0x000a, 0x000b, 0x3a40, 0x000a, 0x0eb6, 0x000b, 0x8074, 0x0000,
+	0x0200, 0x0000, 0x3d00, 0x0000, 0x3cfe, 0x0000, 0x8072, 0x0000,
+	0x8000, 0x0000, 0x43e0, 0x0001, 0x0eb4, 0x0003, 0x42fe, 0x0000,
+	0xffc0, 0x0001, 0x00ff, 0x0008, 0x00e0, 0x0009, 0x0a90, 0x000b,
+	0x0d08, 0x0008, 0x0309, 0x000b, 0x8072, 0x0000, 0x8000, 0x0000,
+	0x000a, 0x000b, 0x038d, 0x0004, 0x808c, 0x0008, 0x0001, 0x0000,
+	0x04fe, 0x0008, 0x3370, 0x0003, 0x0460, 0x0000, 0x8062, 0x0008,
+	0x0001, 0x0000, 0x8066, 0x0000, 0x0009, 0x0008, 0x46c3, 0x0003,
+	0x0004, 0x0000, 0x80c0, 0x0009, 0x00ff, 0x0008, 0x7f00, 0x0000,
+	0x80e0, 0x0001, 0x0004, 0x0000, 0x0add, 0x000b, 0x80e0, 0x0001,
+	0x0005, 0x0008, 0x0add, 0x000b, 0x80e0, 0x0001, 0x0006, 0x0008,
+	0x0add, 0x000b, 0x82c0, 0x0001, 0xff00, 0x0008, 0x7f04, 0x0008,
+	0x82e0, 0x0009, 0x0600, 0x0008, 0x0add, 0x000b, 0x82e0, 0x0009,
+	0x0500, 0x0008, 0x0add, 0x000b, 0x82e0, 0x0009, 0x0400, 0x0000,
+	0x0f70, 0x0003, 0xc4c0, 0x0009, 0x7000, 0x0000, 0xffe0, 0x0009,
+	0x1000, 0x0000, 0x0b09, 0x0003, 0x037e, 0x0004, 0x3941, 0x0002,
+	0x0ae8, 0x000b, 0x8072, 0x0000, 0x0400, 0x0000, 0x000a, 0x000b,
+	0x0460, 0x0000, 0x80fe, 0x0008, 0x002b, 0x0008, 0x7f62, 0x0008,
+	0x8066, 0x0000, 0x2209, 0x0008, 0x46ee, 0x0003, 0x11fe, 0x0000,
+	0x3304, 0x0003, 0x9180, 0x0001, 0x0002, 0x0000, 0x8060, 0x0000,
+	0x0400, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0609, 0x0008,
+	0x46f8, 0x000b, 0x42fe, 0x0000, 0xffc0, 0x0001, 0xff00, 0x0008,
+	0x03e0, 0x0009, 0x0f01, 0x0003, 0x8072, 0x0000, 0x0400, 0x0000,
+	0x0046, 0x0003, 0x9180, 0x0001, 0x0003, 0x0008, 0x02eb, 0x0003,
+	0x8072, 0x0000, 0x0400, 0x0000, 0x8010, 0x0008, 0x0010, 0x0000,
+	0x0361, 0x0003, 0x037e, 0x0004, 0x3941, 0x0002, 0x0b0f, 0x0003,
+	0x8072, 0x0000, 0x0400, 0x0000, 0x000a, 0x000b, 0x0346, 0x000c,
+	0x11fe, 0x0000, 0x3717, 0x0003, 0x8072, 0x0000, 0x0400, 0x0000,
+	0x8010, 0x0008, 0x000e, 0x0000, 0x0361, 0x0003, 0x8060, 0x0000,
+	0x0400, 0x0000, 0x04fe, 0x0008, 0x372c, 0x000b, 0x808c, 0x0008,
+	0x0000, 0x0008, 0x9180, 0x0001, 0x0005, 0x0008, 0x7f62, 0x0008,
+	0x8066, 0x0000, 0x0009, 0x0008, 0x4722, 0x000b, 0x0060, 0x0008,
+	0x8062, 0x0008, 0x001b, 0x0008, 0x4304, 0x0008, 0x4206, 0x0008,
+	0x8066, 0x0000, 0x0412, 0x0000, 0x472a, 0x0003, 0x0343, 0x0003,
+	0x808c, 0x0008, 0x0001, 0x0000, 0x0460, 0x0000, 0x8062, 0x0008,
+	0x002b, 0x0008, 0x8066, 0x0000, 0x0609, 0x0008, 0x4733, 0x000b,
+	0x8066, 0x0000, 0x220a, 0x0008, 0x4736, 0x000b, 0x42fe, 0x0000,
+	0xffc0, 0x0001, 0xff00, 0x0008, 0x7f04, 0x0008, 0x8060, 0x0000,
+	0x0400, 0x0000, 0x9180, 0x0001, 0x0002, 0x0000, 0x7f62, 0x0008,
+	0x8066, 0x0000, 0x041a, 0x0008, 0x4742, 0x000b, 0x8072, 0x0000,
+	0x0400, 0x0000, 0x0046, 0x0003, 0x8060, 0x0000, 0x0400, 0x0000,
+	0x1362, 0x0008, 0x8066, 0x0000, 0x0411, 0x0000, 0x474b, 0x000b,
+	0x02fe, 0x0008, 0x03e0, 0x0009, 0x0f51, 0x0003, 0x0d22, 0x0000,
+	0x4000, 0x000f, 0x8280, 0x0009, 0x0002, 0x0000, 0x1380, 0x0001,
+	0x7f62, 0x0008, 0x8066, 0x0000, 0x2209, 0x0008, 0x4757, 0x0003,
+	0x0200, 0x000a, 0xffc0, 0x0001, 0x0007, 0x0000, 0x7f06, 0x0000,
+	0x1362, 0x0008, 0x8066, 0x0000, 0x060a, 0x0008, 0x475f, 0x000b,
+	0x4000, 0x000f, 0x3a44, 0x0002, 0x0c0a, 0x000b, 0x2f44, 0x000a,
+	0x2f44, 0x000a, 0x0e6b, 0x000b, 0x808a, 0x0008, 0x0003, 0x0008,
+	0x8074, 0x0000, 0xf080, 0x0000, 0x8072, 0x0000, 0x3000, 0x0008,
+	0x5b6c, 0x0003, 0x8054, 0x0008, 0x0019, 0x0000, 0x000a, 0x000b,
+	0x3a44, 0x0002, 0x0c0a, 0x000b, 0x808c, 0x0008, 0x0000, 0x0008,
+	0x8010, 0x0008, 0x0011, 0x0008, 0x021b, 0x000c, 0x42fe, 0x0000,
+	0xffc0, 0x0001, 0x00ff, 0x0008, 0x7f10, 0x0008, 0x021b, 0x000c,
+	0x4310, 0x0008, 0x027a, 0x000b, 0x3941, 0x0002, 0x0b81, 0x0003,
+	0x4000, 0x000f, 0x8072, 0x0000, 0x0404, 0x0008, 0x4000, 0x000f,
+	0x8010, 0x0008, 0x0012, 0x0008, 0x021b, 0x000c, 0x0346, 0x000c,
+	0x1110, 0x0000, 0x021b, 0x000c, 0x11fe, 0x0000, 0x3787, 0x0003,
+	0x000a, 0x000b, 0xc2c0, 0x0009, 0x00ff, 0x0008, 0x7f00, 0x0000,
+	0xc3c0, 0x0001, 0xff00, 0x0008, 0x00d0, 0x0009, 0x0bb2, 0x0003,
+	0x0d0a, 0x0000, 0x8580, 0x0001, 0x1000, 0x0000, 0x7f62, 0x0008,
+	0x8060, 0x0000, 0x0400, 0x0000, 0x8066, 0x0000, 0x0809, 0x0000,
+	0x479c, 0x000b, 0x04fe, 0x0008, 0x33ab, 0x0003, 0x0460, 0x0000,
+	0x8062, 0x0008, 0x0004, 0x0000, 0x8066, 0x0000, 0x0211, 0x0000,
+	0x47a4, 0x0003, 0x01fe, 0x0008, 0x00e0, 0x0009, 0x0fab, 0x0003,
+	0x02fe, 0x0008, 0x43e0, 0x0001, 0x0bb1, 0x0003, 0x0500, 0x0002,
+	0x7f0a, 0x0000, 0xffe0, 0x0009, 0x0800, 0x0000, 0x0f95, 0x000b,
+	0x0d08, 0x0008, 0x4000, 0x000f, 0x43fe, 0x0008, 0x3e80, 0x0001,
+	0xffc0, 0x0001, 0x7fff, 0x0000, 0x0d60, 0x0000, 0x7f62, 0x0008,
+	0x8066, 0x0000, 0x0809, 0x0000, 0x47ba, 0x0003, 0x8060, 0x0000,
+	0x0400, 0x0000, 0x84c0, 0x0001, 0xff00, 0x0008, 0x7f60, 0x000a,
+	0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a,
+	0x7f60, 0x000a, 0x7f60, 0x000a, 0x7f60, 0x000a, 0xff80, 0x0009,
+	0x1000, 0x0000, 0x7f62, 0x0008, 0x8066, 0x0000, 0x0809, 0x0000,
+	0x47cc, 0x000b, 0x4000, 0x000f, 0x5ff4, 0xebed, 0x0001, 0x0002,
+	0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200,
+	0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0x2c40
 };
 #ifdef UNIQUE_FW_NAME
-unsigned short fw2300ipx_length01 = 0xe9a6;
+unsigned short fw2300ipx_length01 = 0xe9c7;
 #else
-unsigned short risc_code_length01 = 0xe9a6;
+unsigned short risc_code_length01 = 0xe9c7;
 #endif
 
diff -Nru a/drivers/scsi/qla2xxx/ql2322_fw.c b/drivers/scsi/qla2xxx/ql2322_fw.c
--- a/drivers/scsi/qla2xxx/ql2322_fw.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/qla2xxx/ql2322_fw.c	Tue Jun 15 22:20:36 2004
@@ -18,7 +18,7 @@
  *************************************************************************/
 
 /*
- *	Firmware Version 3.02.26 (08:08 Mar 11, 2004)
+ *	Firmware Version 3.02.28 (14:05 Apr 03, 2004)
  */
 
 #ifdef UNIQUE_FW_NAME
@@ -28,15 +28,15 @@
 #endif
 
 #ifdef UNIQUE_FW_NAME
-unsigned char fw2322ipx_version_str[] = {3, 2,26};
+unsigned char fw2322ipx_version_str[] = {3, 2,28};
 #else
-unsigned char firmware_version[] = {3, 2,26};
+unsigned char firmware_version[] = {3, 2,28};
 #endif
 
 #ifdef UNIQUE_FW_NAME
-#define fw2322ipx_VERSION_STRING "3.02.26"
+#define fw2322ipx_VERSION_STRING "3.02.28"
 #else
-#define FW_VERSION_STRING "3.02.26"
+#define FW_VERSION_STRING "3.02.28"
 #endif
 
 #ifdef UNIQUE_FW_NAME
@@ -50,12 +50,12 @@
 #else
 unsigned short risc_code01[] = { 
 #endif
-	0x0470, 0x0000, 0x0000, 0xdf17, 0x0000, 0x0003, 0x0002, 0x001a,
+	0x0470, 0x0000, 0x0000, 0xdf42, 0x0000, 0x0003, 0x0002, 0x001c,
 	0x0137, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2032, 0x3030,
 	0x3120, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241,
 	0x5449, 0x4f4e, 0x2049, 0x5350, 0x3233, 0x3030, 0x2046, 0x6972,
 	0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030,
-	0x332e, 0x3032, 0x2e32, 0x3620, 0x2020, 0x2020, 0x2400, 0x20a9,
+	0x332e, 0x3032, 0x2e32, 0x3820, 0x2020, 0x2020, 0x2400, 0x20a9,
 	0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2200, 0x20a9, 0x000f,
 	0x2001, 0x0000, 0x400f, 0x2091, 0x2400, 0x20a9, 0x000f, 0x2001,
 	0x0000, 0x400f, 0x2091, 0x2600, 0x20a9, 0x000f, 0x2001, 0x0000,
@@ -82,97 +82,97 @@
 	0x20a8, 0x900e, 0x4104, 0x2009, 0x1800, 0x810d, 0x810d, 0x810d,
 	0x810d, 0x810d, 0x918c, 0x001f, 0x2001, 0x0001, 0x9112, 0x20e9,
 	0x0001, 0x20a1, 0x0800, 0x900e, 0x20a9, 0x0800, 0x4104, 0x8211,
-	0x1dd8, 0x080c, 0x0f52, 0x080c, 0x6030, 0x080c, 0xab5f, 0x080c,
-	0x1109, 0x080c, 0x1328, 0x080c, 0x1bb0, 0x080c, 0x915c, 0x080c,
-	0x0d0f, 0x080c, 0x108e, 0x080c, 0x346d, 0x080c, 0x77ed, 0x080c,
-	0x6a7f, 0x080c, 0x88d4, 0x080c, 0x8538, 0x080c, 0x223f, 0x080c,
-	0x7ec2, 0x080c, 0x2089, 0x080c, 0x21c3, 0x080c, 0x2234, 0x2091,
+	0x1dd8, 0x080c, 0x0f52, 0x080c, 0x6037, 0x080c, 0xab83, 0x080c,
+	0x1109, 0x080c, 0x1328, 0x080c, 0x1bb0, 0x080c, 0x918d, 0x080c,
+	0x0d0f, 0x080c, 0x108e, 0x080c, 0x3474, 0x080c, 0x7801, 0x080c,
+	0x6a8f, 0x080c, 0x8905, 0x080c, 0x8569, 0x080c, 0x223f, 0x080c,
+	0x7ed6, 0x080c, 0x2089, 0x080c, 0x21c3, 0x080c, 0x2234, 0x2091,
 	0x3009, 0x7883, 0x0000, 0x1004, 0x0943, 0x7880, 0x9086, 0x0002,
 	0x1190, 0x7883, 0x4000, 0x7837, 0x4000, 0x7833, 0x0010, 0x0e04,
 	0x0937, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
 	0xd084, 0x190c, 0x11d6, 0x2071, 0x1800, 0x7003, 0x0000, 0x780c,
 	0x9084, 0x0030, 0x9086, 0x0000, 0x190c, 0x0d7d, 0x2071, 0x1800,
-	0x7000, 0x908e, 0x0003, 0x1168, 0x080c, 0x4bc5, 0x080c, 0x3494,
-	0x080c, 0x7855, 0x080c, 0x6fc7, 0x080c, 0x89b2, 0x080c, 0x8561,
+	0x7000, 0x908e, 0x0003, 0x1168, 0x080c, 0x4bcc, 0x080c, 0x349b,
+	0x080c, 0x7869, 0x080c, 0x6fd7, 0x080c, 0x89e3, 0x080c, 0x8592,
 	0x0c68, 0x000b, 0x0c88, 0x096d, 0x096e, 0x0b09, 0x096b, 0x0bc3,
 	0x0d0e, 0x0d0e, 0x0d0e, 0x080c, 0x0d7d, 0x0005, 0x0126, 0x00f6,
 	0x2091, 0x8000, 0x7000, 0x9086, 0x0001, 0x1904, 0x0adc, 0x080c,
-	0x0ea5, 0x080c, 0x74d5, 0x0150, 0x080c, 0x74f8, 0x15b0, 0x2079,
-	0x0100, 0x7828, 0x9085, 0x1800, 0x782a, 0x0478, 0x080c, 0x7406,
+	0x0ea5, 0x080c, 0x74e9, 0x0150, 0x080c, 0x750c, 0x15b0, 0x2079,
+	0x0100, 0x7828, 0x9085, 0x1800, 0x782a, 0x0478, 0x080c, 0x741a,
 	0x7000, 0x9086, 0x0001, 0x1904, 0x0adc, 0x7098, 0x9086, 0x0028,
-	0x1904, 0x0adc, 0x080c, 0x8530, 0x080c, 0x8522, 0x2001, 0x0161,
+	0x1904, 0x0adc, 0x080c, 0x8561, 0x080c, 0x8553, 0x2001, 0x0161,
 	0x2003, 0x0001, 0x2079, 0x0100, 0x2011, 0xffff, 0x080c, 0x2a44,
-	0x7a28, 0x9295, 0x5e2c, 0x7a2a, 0x2011, 0x734b, 0x080c, 0x860d,
-	0x2011, 0x733e, 0x080c, 0x8719, 0x2011, 0x5e87, 0x080c, 0x860d,
-	0x2011, 0x8030, 0x901e, 0x7396, 0x04d0, 0x080c, 0x5734, 0x2079,
-	0x0100, 0x7844, 0x9005, 0x1904, 0x0adc, 0x2011, 0x5e87, 0x080c,
-	0x860d, 0x2011, 0x734b, 0x080c, 0x860d, 0x2011, 0x733e, 0x080c,
-	0x8719, 0x2001, 0x0265, 0x2001, 0x0205, 0x2003, 0x0000, 0x7840,
+	0x7a28, 0x9295, 0x5e2c, 0x7a2a, 0x2011, 0x735f, 0x080c, 0x863e,
+	0x2011, 0x7352, 0x080c, 0x874a, 0x2011, 0x5e8e, 0x080c, 0x863e,
+	0x2011, 0x8030, 0x901e, 0x7396, 0x04d0, 0x080c, 0x573b, 0x2079,
+	0x0100, 0x7844, 0x9005, 0x1904, 0x0adc, 0x2011, 0x5e8e, 0x080c,
+	0x863e, 0x2011, 0x735f, 0x080c, 0x863e, 0x2011, 0x7352, 0x080c,
+	0x874a, 0x2001, 0x0265, 0x2001, 0x0205, 0x2003, 0x0000, 0x7840,
 	0x9084, 0xfffb, 0x7842, 0x2001, 0x19a6, 0x2004, 0x9005, 0x1140,
-	0x00c6, 0x2061, 0x0100, 0x080c, 0x5fd8, 0x00ce, 0x0804, 0x0adc,
-	0x780f, 0x006b, 0x7a28, 0x080c, 0x74dd, 0x0118, 0x9295, 0x5e2c,
+	0x00c6, 0x2061, 0x0100, 0x080c, 0x5fdf, 0x00ce, 0x0804, 0x0adc,
+	0x780f, 0x006b, 0x7a28, 0x080c, 0x74f1, 0x0118, 0x9295, 0x5e2c,
 	0x0010, 0x9295, 0x402c, 0x7a2a, 0x2011, 0x8010, 0x73d8, 0x2001,
-	0x19a7, 0x2003, 0x0001, 0x080c, 0x2916, 0x080c, 0x4b00, 0x7248,
+	0x19a7, 0x2003, 0x0001, 0x080c, 0x2916, 0x080c, 0x4b07, 0x7248,
 	0xc284, 0x724a, 0x2001, 0x180c, 0x200c, 0xc1ac, 0xc1cc, 0x2102,
-	0x2001, 0x0390, 0x2003, 0x0400, 0x080c, 0xa872, 0x080c, 0xa04f,
-	0x2011, 0x0004, 0x080c, 0xc824, 0x080c, 0xa88e, 0x080c, 0x6910,
-	0x080c, 0x74d5, 0x1120, 0x080c, 0x2971, 0x0600, 0x0420, 0x080c,
-	0x5fdf, 0x0140, 0x7097, 0x0001, 0x70d3, 0x0000, 0x080c, 0x5901,
-	0x0804, 0x0adc, 0x080c, 0x56d3, 0xd094, 0x01a8, 0x2001, 0x0390,
+	0x2001, 0x0390, 0x2003, 0x0400, 0x080c, 0xa896, 0x080c, 0xa073,
+	0x2011, 0x0004, 0x080c, 0xc848, 0x080c, 0xa8b2, 0x080c, 0x6917,
+	0x080c, 0x74e9, 0x1120, 0x080c, 0x2971, 0x0600, 0x0420, 0x080c,
+	0x5fe6, 0x0140, 0x7097, 0x0001, 0x70d3, 0x0000, 0x080c, 0x5908,
+	0x0804, 0x0adc, 0x080c, 0x56da, 0xd094, 0x01a8, 0x2001, 0x0390,
 	0x2003, 0x0404, 0x2011, 0x180c, 0x2204, 0xc0cd, 0x2012, 0x080c,
-	0x56d7, 0xd0d4, 0x1118, 0x080c, 0x2971, 0x1270, 0x2011, 0x180c,
-	0x2204, 0xc0bc, 0x00a8, 0x080c, 0x56d7, 0xd0d4, 0x1db8, 0x2011,
+	0x56de, 0xd0d4, 0x1118, 0x080c, 0x2971, 0x1270, 0x2011, 0x180c,
+	0x2204, 0xc0bc, 0x00a8, 0x080c, 0x56de, 0xd0d4, 0x1db8, 0x2011,
 	0x180c, 0x2204, 0xc0bd, 0x0060, 0x2011, 0x180c, 0x2204, 0xc0bd,
-	0x2012, 0x080c, 0x6a53, 0x1128, 0xd0a4, 0x0118, 0x2204, 0xc0fd,
-	0x2012, 0x080c, 0x6a19, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e, 0x00a8,
-	0x707f, 0x0000, 0x080c, 0x74d5, 0x1130, 0x70b0, 0x9005, 0x1168,
-	0x080c, 0xcc7b, 0x0050, 0x080c, 0xcc7b, 0x70dc, 0xd09c, 0x1128,
-	0x70b0, 0x9005, 0x0110, 0x080c, 0x5fb5, 0x70e7, 0x0000, 0x70e3,
+	0x2012, 0x080c, 0x6a63, 0x1128, 0xd0a4, 0x0118, 0x2204, 0xc0fd,
+	0x2012, 0x080c, 0x6a29, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e, 0x00a8,
+	0x707f, 0x0000, 0x080c, 0x74e9, 0x1130, 0x70b0, 0x9005, 0x1168,
+	0x080c, 0xcc9f, 0x0050, 0x080c, 0xcc9f, 0x70dc, 0xd09c, 0x1128,
+	0x70b0, 0x9005, 0x0110, 0x080c, 0x5fbc, 0x70e7, 0x0000, 0x70e3,
 	0x0000, 0x70a7, 0x0000, 0x080c, 0x2979, 0x0228, 0x2011, 0x0101,
-	0x2204, 0xc0c4, 0x2012, 0x72dc, 0x080c, 0x74d5, 0x1178, 0x9016,
+	0x2204, 0xc0c4, 0x2012, 0x72dc, 0x080c, 0x74e9, 0x1178, 0x9016,
 	0x0016, 0x080c, 0x2713, 0x2019, 0x196d, 0x211a, 0x001e, 0x705f,
 	0xffff, 0x7063, 0x00ef, 0x7083, 0x0000, 0x0020, 0x2019, 0x196d,
 	0x201b, 0x0000, 0x2079, 0x1847, 0x7804, 0xd0ac, 0x0108, 0xc295,
-	0x72de, 0x080c, 0x74d5, 0x0118, 0x9296, 0x0004, 0x0518, 0x2011,
-	0x0001, 0x080c, 0xc824, 0x70ab, 0x0000, 0x70af, 0xffff, 0x7003,
-	0x0002, 0x00fe, 0x080c, 0x2fb2, 0x080c, 0xa872, 0x2011, 0x0005,
-	0x080c, 0xa1ab, 0x080c, 0xa88e, 0x080c, 0x74d5, 0x0148, 0x00c6,
+	0x72de, 0x080c, 0x74e9, 0x0118, 0x9296, 0x0004, 0x0518, 0x2011,
+	0x0001, 0x080c, 0xc848, 0x70ab, 0x0000, 0x70af, 0xffff, 0x7003,
+	0x0002, 0x00fe, 0x080c, 0x2fb2, 0x080c, 0xa896, 0x2011, 0x0005,
+	0x080c, 0xa1cf, 0x080c, 0xa8b2, 0x080c, 0x74e9, 0x0148, 0x00c6,
 	0x2061, 0x0100, 0x0016, 0x080c, 0x2713, 0x61e2, 0x001e, 0x00ce,
 	0x012e, 0x00e0, 0x70ab, 0x0000, 0x70af, 0xffff, 0x7003, 0x0002,
-	0x080c, 0xa872, 0x2011, 0x0005, 0x080c, 0xa1ab, 0x080c, 0xa88e,
-	0x080c, 0x74d5, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c,
+	0x080c, 0xa896, 0x2011, 0x0005, 0x080c, 0xa1cf, 0x080c, 0xa8b2,
+	0x080c, 0x74e9, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x080c,
 	0x2713, 0x61e2, 0x001e, 0x00ce, 0x00fe, 0x012e, 0x0005, 0x00c6,
-	0x00b6, 0x080c, 0x74d5, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9,
-	0x0782, 0x080c, 0x74d5, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e,
+	0x00b6, 0x080c, 0x74e9, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9,
+	0x0782, 0x080c, 0x74e9, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e,
 	0x86ff, 0x0138, 0x9180, 0x1000, 0x2004, 0x905d, 0x0110, 0xb800,
-	0xd0bc, 0x090c, 0x32f5, 0x8108, 0x1f04, 0x0af0, 0x707f, 0x0000,
+	0xd0bc, 0x090c, 0x32fc, 0x8108, 0x1f04, 0x0af0, 0x707f, 0x0000,
 	0x7080, 0x9084, 0x00ff, 0x7082, 0x70b3, 0x0000, 0x00be, 0x00ce,
 	0x0005, 0x00b6, 0x0126, 0x2091, 0x8000, 0x7000, 0x9086, 0x0002,
 	0x1904, 0x0bc0, 0x70ac, 0x9086, 0xffff, 0x0120, 0x080c, 0x2fb2,
 	0x0804, 0x0bc0, 0x70dc, 0xd0ac, 0x1110, 0xd09c, 0x0538, 0xd084,
 	0x0528, 0x0006, 0x2001, 0x0103, 0x2003, 0x002b, 0x000e, 0xd08c,
-	0x01e8, 0x080c, 0x3366, 0x11b0, 0x70e0, 0x9086, 0xffff, 0x0190,
-	0x080c, 0x3144, 0x70dc, 0xd094, 0x1904, 0x0bc0, 0x2011, 0x0001,
-	0x080c, 0xcf2e, 0x0110, 0x2011, 0x0003, 0x901e, 0x080c, 0x317e,
+	0x01e8, 0x080c, 0x336d, 0x11b0, 0x70e0, 0x9086, 0xffff, 0x0190,
+	0x080c, 0x3147, 0x70dc, 0xd094, 0x1904, 0x0bc0, 0x2011, 0x0001,
+	0x080c, 0xcf52, 0x0110, 0x2011, 0x0003, 0x901e, 0x080c, 0x3181,
 	0x0804, 0x0bc0, 0x70e4, 0x9005, 0x1904, 0x0bc0, 0x70a8, 0x9005,
 	0x1904, 0x0bc0, 0x70dc, 0xd0a4, 0x0118, 0xd0b4, 0x0904, 0x0bc0,
-	0x080c, 0x6a19, 0x1904, 0x0bc0, 0x080c, 0x6a6c, 0x1904, 0x0bc0,
-	0x080c, 0x6a53, 0x01c0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e,
-	0x0016, 0x080c, 0x661e, 0x1118, 0xb800, 0xd0ec, 0x1138, 0x001e,
+	0x080c, 0x6a29, 0x1904, 0x0bc0, 0x080c, 0x6a7c, 0x1904, 0x0bc0,
+	0x080c, 0x6a63, 0x01c0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e,
+	0x0016, 0x080c, 0x6625, 0x1118, 0xb800, 0xd0ec, 0x1138, 0x001e,
 	0x8108, 0x1f04, 0x0b60, 0x00ce, 0x015e, 0x0028, 0x001e, 0x00ce,
 	0x015e, 0x0804, 0x0bc0, 0x0006, 0x2001, 0x0103, 0x2003, 0x002b,
 	0x000e, 0x2011, 0x19b3, 0x080c, 0x0fc2, 0x2011, 0x19cd, 0x080c,
 	0x0fc2, 0x7030, 0xc08c, 0x7032, 0x7003, 0x0003, 0x70af, 0xffff,
-	0x080c, 0x0e79, 0x9006, 0x080c, 0x25a0, 0x080c, 0x3366, 0x0118,
-	0x080c, 0x4c9d, 0x0050, 0x0036, 0x0046, 0x2019, 0xffff, 0x2021,
-	0x0006, 0x080c, 0x4cb7, 0x004e, 0x003e, 0x00f6, 0x2079, 0x0100,
-	0x080c, 0x74f8, 0x0150, 0x080c, 0x74d5, 0x7828, 0x0118, 0x9084,
-	0xe1ff, 0x0010, 0x9084, 0xffdf, 0x782a, 0x00fe, 0x080c, 0xa872,
+	0x080c, 0x0e79, 0x9006, 0x080c, 0x25a0, 0x080c, 0x336d, 0x0118,
+	0x080c, 0x4ca4, 0x0050, 0x0036, 0x0046, 0x2019, 0xffff, 0x2021,
+	0x0006, 0x080c, 0x4cbe, 0x004e, 0x003e, 0x00f6, 0x2079, 0x0100,
+	0x080c, 0x750c, 0x0150, 0x080c, 0x74e9, 0x7828, 0x0118, 0x9084,
+	0xe1ff, 0x0010, 0x9084, 0xffdf, 0x782a, 0x00fe, 0x080c, 0xa896,
 	0x2001, 0x19e8, 0x2004, 0x9086, 0x0005, 0x1120, 0x2011, 0x0000,
-	0x080c, 0xa1ab, 0x2011, 0x0000, 0x080c, 0xa1b5, 0x080c, 0xa88e,
+	0x080c, 0xa1cf, 0x2011, 0x0000, 0x080c, 0xa1d9, 0x080c, 0xa8b2,
 	0x012e, 0x00be, 0x0005, 0x0016, 0x0026, 0x0046, 0x00f6, 0x0126,
 	0x2091, 0x8000, 0x2079, 0x0100, 0x7904, 0x918c, 0xfffd, 0x7906,
-	0x2009, 0x00f7, 0x080c, 0x5f9e, 0x7940, 0x918c, 0x0010, 0x7942,
+	0x2009, 0x00f7, 0x080c, 0x5fa5, 0x7940, 0x918c, 0x0010, 0x7942,
 	0x7924, 0xd1b4, 0x0120, 0x2011, 0x0040, 0x080c, 0x2a44, 0xd19c,
 	0x0120, 0x2011, 0x0008, 0x080c, 0x2a44, 0x0006, 0x0036, 0x0156,
 	0x0000, 0x2001, 0x19a7, 0x2004, 0x9005, 0x1518, 0x080c, 0x29d8,
@@ -181,26 +181,26 @@
 	0x9006, 0x080c, 0x2928, 0x0068, 0x080c, 0x29e8, 0x1d50, 0x2001,
 	0x1998, 0x2004, 0xd0fc, 0x0108, 0x0020, 0x080c, 0x273f, 0x0804,
 	0x0cc1, 0x080c, 0x2a67, 0x080c, 0x2aab, 0x20a9, 0x003a, 0x1d04,
-	0x0c17, 0x080c, 0x86f9, 0x1f04, 0x0c17, 0x080c, 0x74e6, 0x0148,
-	0x080c, 0x74f8, 0x1118, 0x080c, 0x77e8, 0x0050, 0x080c, 0x74dd,
-	0x0dd0, 0x080c, 0x77e3, 0x080c, 0x77d9, 0x080c, 0x7406, 0x0020,
-	0x2009, 0x00f8, 0x080c, 0x5f9e, 0x7850, 0xc0e5, 0x7852, 0x080c,
-	0x74d5, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010, 0x2021, 0xe678,
-	0x2019, 0xea60, 0x0d0c, 0x86f9, 0x7820, 0xd09c, 0x15a0, 0x080c,
-	0x74d5, 0x0904, 0x0ca3, 0x7824, 0xd0ac, 0x1904, 0x0cc6, 0x080c,
-	0x74f8, 0x1548, 0x0046, 0x2021, 0x0320, 0x8421, 0x1df0, 0x004e,
+	0x0c17, 0x080c, 0x872a, 0x1f04, 0x0c17, 0x080c, 0x74fa, 0x0148,
+	0x080c, 0x750c, 0x1118, 0x080c, 0x77fc, 0x0050, 0x080c, 0x74f1,
+	0x0dd0, 0x080c, 0x77f7, 0x080c, 0x77ed, 0x080c, 0x741a, 0x0020,
+	0x2009, 0x00f8, 0x080c, 0x5fa5, 0x7850, 0xc0e5, 0x7852, 0x080c,
+	0x74e9, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010, 0x2021, 0xe678,
+	0x2019, 0xea60, 0x0d0c, 0x872a, 0x7820, 0xd09c, 0x15a0, 0x080c,
+	0x74e9, 0x0904, 0x0ca3, 0x7824, 0xd0ac, 0x1904, 0x0cc6, 0x080c,
+	0x750c, 0x1548, 0x0046, 0x2021, 0x0320, 0x8421, 0x1df0, 0x004e,
 	0x2011, 0x1800, 0x080c, 0x2a44, 0x080c, 0x29f0, 0x7824, 0x9084,
 	0x1800, 0x1168, 0x9484, 0x0fff, 0x1140, 0x2001, 0x1810, 0x2004,
 	0x9084, 0x9000, 0x0110, 0x080c, 0x0ce9, 0x8421, 0x1160, 0x1d04,
-	0x0c73, 0x080c, 0x86f9, 0x080c, 0x77e3, 0x080c, 0x77d9, 0x7003,
+	0x0c73, 0x080c, 0x872a, 0x080c, 0x77f7, 0x080c, 0x77ed, 0x7003,
 	0x0001, 0x0804, 0x0cc6, 0x8319, 0x1928, 0x2001, 0x1810, 0x2004,
 	0x9084, 0x9000, 0x0110, 0x080c, 0x0ce9, 0x1d04, 0x0c89, 0x080c,
-	0x86f9, 0x2009, 0x199b, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a,
+	0x872a, 0x2009, 0x199b, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a,
 	0x1188, 0x200b, 0x000a, 0x2011, 0x0048, 0x080c, 0x2a44, 0x20a9,
 	0x0002, 0x080c, 0x29d1, 0x7924, 0x080c, 0x29f0, 0xd19c, 0x0110,
-	0x080c, 0x2916, 0x00f0, 0x080c, 0x74e6, 0x1140, 0x94a2, 0x03e8,
-	0x1128, 0x080c, 0x74a9, 0x7003, 0x0001, 0x00c0, 0x2011, 0x1800,
-	0x080c, 0x2a44, 0x080c, 0x29f0, 0x7824, 0x080c, 0x74ef, 0x0110,
+	0x080c, 0x2916, 0x00f0, 0x080c, 0x74fa, 0x1140, 0x94a2, 0x03e8,
+	0x1128, 0x080c, 0x74bd, 0x7003, 0x0001, 0x00c0, 0x2011, 0x1800,
+	0x080c, 0x2a44, 0x080c, 0x29f0, 0x7824, 0x080c, 0x7503, 0x0110,
 	0xd0ac, 0x1160, 0x9084, 0x1800, 0x0904, 0x0c7b, 0x7003, 0x0001,
 	0x0028, 0x2001, 0x0001, 0x080c, 0x25a0, 0x00a0, 0x7850, 0xc0e4,
 	0x7852, 0x2009, 0x180c, 0x210c, 0xd19c, 0x1120, 0x7904, 0x918d,
@@ -208,20 +208,20 @@
 	0x0028, 0x782a, 0x2001, 0x19a7, 0x2003, 0x0000, 0x9006, 0x78f2,
 	0x015e, 0x003e, 0x000e, 0x012e, 0x00fe, 0x004e, 0x002e, 0x001e,
 	0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x0046, 0x00b6, 0x00c6,
-	0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0071, 0x0d0c, 0x86f9, 0x015e,
+	0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0071, 0x0d0c, 0x872a, 0x015e,
 	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x004e, 0x003e, 0x002e,
 	0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x189e, 0x7004, 0x9086,
-	0x0001, 0x1110, 0x080c, 0x3494, 0x00ee, 0x0005, 0x0005, 0x2a70,
-	0x2061, 0x19ab, 0x2063, 0x0003, 0x6007, 0x0002, 0x600b, 0x001a,
+	0x0001, 0x1110, 0x080c, 0x349b, 0x00ee, 0x0005, 0x0005, 0x2a70,
+	0x2061, 0x19ab, 0x2063, 0x0003, 0x6007, 0x0002, 0x600b, 0x001c,
 	0x600f, 0x0137, 0x2001, 0x197c, 0x900e, 0x2102, 0x7196, 0x2001,
 	0x0100, 0x2004, 0x9082, 0x0002, 0x0218, 0x705f, 0xffff, 0x0008,
-	0x715e, 0x7067, 0xffff, 0x717e, 0x7182, 0x080c, 0xcc7b, 0x70ef,
+	0x715e, 0x7067, 0xffff, 0x717e, 0x7182, 0x080c, 0xcc9f, 0x70ef,
 	0x00c0, 0x2061, 0x196c, 0x6003, 0x0909, 0x6106, 0x600b, 0x8800,
 	0x600f, 0x0200, 0x6013, 0x00ff, 0x6017, 0x001f, 0x611a, 0x601f,
 	0x07d0, 0x2061, 0x1974, 0x6003, 0x8000, 0x6106, 0x610a, 0x600f,
 	0x0200, 0x6013, 0x00ff, 0x6116, 0x601b, 0x0001, 0x611e, 0x2061,
 	0x1989, 0x6003, 0x514c, 0x6007, 0x4f47, 0x600b, 0x4943, 0x600f,
-	0x2020, 0x2001, 0x182c, 0x2102, 0x0005, 0x9016, 0x080c, 0x661e,
+	0x2020, 0x2001, 0x182c, 0x2102, 0x0005, 0x9016, 0x080c, 0x6625,
 	0x1178, 0xb804, 0x90c4, 0x00ff, 0x98c6, 0x0006, 0x0128, 0x90c4,
 	0xff00, 0x98c6, 0x0600, 0x1120, 0x9186, 0x0080, 0x0108, 0x8210,
 	0x8108, 0x9186, 0x0800, 0x1d50, 0x2208, 0x0005, 0x2091, 0x8000,
@@ -240,11 +240,11 @@
 	0x2079, 0x1800, 0x7803, 0x0005, 0x2091, 0x4080, 0x2001, 0x0089,
 	0x2004, 0xd084, 0x0180, 0x2001, 0x1a22, 0x2004, 0x9005, 0x0128,
 	0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003,
-	0x0002, 0x2003, 0x1001, 0x080c, 0x56e2, 0x1170, 0x080c, 0x0f13,
-	0x0110, 0x080c, 0x0e66, 0x080c, 0x56e2, 0x1130, 0x2071, 0x1800,
+	0x0002, 0x2003, 0x1001, 0x080c, 0x56e9, 0x1170, 0x080c, 0x0f13,
+	0x0110, 0x080c, 0x0e66, 0x080c, 0x56e9, 0x1130, 0x2071, 0x1800,
 	0x2011, 0x8000, 0x080c, 0x0f27, 0x0c70, 0x0005, 0x2001, 0x0382,
 	0x2004, 0x9084, 0x0007, 0x9086, 0x0001, 0x1120, 0x2001, 0x0015,
-	0x080c, 0xa863, 0x2079, 0x0380, 0x2069, 0x1b04, 0x7818, 0x6802,
+	0x080c, 0xa887, 0x2079, 0x0380, 0x2069, 0x1b04, 0x7818, 0x6802,
 	0x781c, 0x6806, 0x7840, 0x680a, 0x7844, 0x680e, 0x782c, 0x6812,
 	0x2019, 0x1b0f, 0x9016, 0x7808, 0xd09c, 0x0150, 0x7820, 0x201a,
 	0x8210, 0x8318, 0x8210, 0x9282, 0x0011, 0x0ea8, 0x2011, 0xdead,
@@ -323,7 +323,7 @@
 	0x0016, 0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0xa862, 0x9184,
 	0xffc0, 0xa85e, 0x001e, 0x0020, 0x00e6, 0x0126, 0x2091, 0x8000,
 	0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000,
-	0x70c2, 0x080c, 0x8522, 0x012e, 0x00ee, 0x0005, 0x2071, 0x1800,
+	0x70c2, 0x080c, 0x8553, 0x012e, 0x00ee, 0x0005, 0x2071, 0x1800,
 	0x9026, 0x2009, 0x0000, 0x2049, 0x0400, 0x2900, 0x702e, 0x8940,
 	0x2800, 0xa802, 0xa95e, 0xa863, 0x0001, 0x8420, 0x9886, 0x0440,
 	0x0120, 0x2848, 0x9188, 0x0040, 0x0c90, 0x2071, 0x188d, 0x7000,
@@ -387,15 +387,15 @@
 	0x008e, 0x00de, 0x009e, 0x080c, 0x1143, 0x0005, 0x00de, 0x009e,
 	0x080c, 0x1143, 0x0005, 0xa8a8, 0xd08c, 0x0005, 0x0096, 0xa0a0,
 	0x904d, 0x090c, 0x0d7d, 0xa06c, 0x908e, 0x0100, 0x0130, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x080c, 0x6d64, 0xa09f,
+	0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x080c, 0x6d74, 0xa09f,
 	0x0000, 0xa0a3, 0x0000, 0x2848, 0x080c, 0x106c, 0x009e, 0x0005,
 	0x00a6, 0xa0a0, 0x904d, 0x090c, 0x0d7d, 0xa06c, 0x908e, 0x0100,
 	0x0128, 0xa87b, 0x0001, 0xa883, 0x0000, 0x00c0, 0xa80c, 0x2050,
 	0xb004, 0x9005, 0x0198, 0xa80e, 0x2050, 0x8006, 0x8006, 0x8007,
 	0x908c, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0xa076, 0xa172,
 	0xb000, 0xa07a, 0x2810, 0x080c, 0x1124, 0x00e8, 0xa97c, 0xa894,
-	0x0016, 0x0006, 0x080c, 0x6d64, 0x000e, 0x001e, 0xd1fc, 0x1138,
-	0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, 0xabc9, 0x00ce, 0x7008,
+	0x0016, 0x0006, 0x080c, 0x6d74, 0x000e, 0x001e, 0xd1fc, 0x1138,
+	0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, 0xabed, 0x00ce, 0x7008,
 	0x2048, 0xa89f, 0x0000, 0xa8a3, 0x0000, 0x080c, 0x106c, 0x7007,
 	0x0000, 0x080c, 0x1143, 0x00ae, 0x0005, 0x0126, 0x2091, 0x8000,
 	0x782b, 0x1001, 0x7007, 0x0005, 0x7000, 0xc094, 0x7002, 0x012e,
@@ -404,8 +404,8 @@
 	0x0020, 0x0126, 0x2091, 0x8000, 0x782b, 0x0041, 0x7007, 0x0003,
 	0x7000, 0xc084, 0x7002, 0x2900, 0x700a, 0x012e, 0x009e, 0x0005,
 	0x20e1, 0x0000, 0x2099, 0x0088, 0x782b, 0x0040, 0x0096, 0x2001,
-	0x192e, 0x204c, 0xaa7c, 0x009e, 0x080c, 0x8bea, 0x2009, 0x188c,
-	0x2104, 0x9084, 0xfffc, 0x200a, 0x080c, 0x8a5d, 0x7007, 0x0000,
+	0x192e, 0x204c, 0xaa7c, 0x009e, 0x080c, 0x8c1b, 0x2009, 0x188c,
+	0x2104, 0x9084, 0xfffc, 0x200a, 0x080c, 0x8a8e, 0x7007, 0x0000,
 	0x080c, 0x1154, 0x0005, 0x7007, 0x0000, 0x080c, 0x1154, 0x0005,
 	0x0126, 0x2091, 0x2200, 0x2079, 0x0300, 0x2071, 0x1a6b, 0x7003,
 	0x0000, 0x78bf, 0x00f6, 0x0041, 0x7807, 0x0007, 0x7803, 0x0000,
@@ -418,17 +418,17 @@
 	0x0303, 0x2061, 0x1a7a, 0x602f, 0x1ddc, 0x2001, 0x181a, 0x2004,
 	0x9082, 0x1ddc, 0x6032, 0x603b, 0x1e55, 0x602b, 0x1aba, 0x6007,
 	0x1a9a, 0x2061, 0x1a9a, 0x60af, 0x193c, 0x2001, 0x1927, 0x2004,
-	0x60ba, 0x783f, 0x336d, 0x00ce, 0x0005, 0x9086, 0x000d, 0x11d0,
-	0x7808, 0xd09c, 0x01b8, 0x7820, 0x0026, 0x2010, 0x080c, 0xc802,
+	0x60ba, 0x783f, 0x3374, 0x00ce, 0x0005, 0x9086, 0x000d, 0x11d0,
+	0x7808, 0xd09c, 0x01b8, 0x7820, 0x0026, 0x2010, 0x080c, 0xc826,
 	0x0180, 0x2260, 0x6000, 0x9086, 0x0004, 0x1158, 0x0016, 0x6120,
-	0x9186, 0x0009, 0x0108, 0x0020, 0x2009, 0x004c, 0x080c, 0xac68,
+	0x9186, 0x0009, 0x0108, 0x0020, 0x2009, 0x004c, 0x080c, 0xac8c,
 	0x001e, 0x002e, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908, 0x9184,
 	0x0070, 0x190c, 0x0d76, 0xd19c, 0x05a0, 0x7820, 0x908c, 0xf000,
 	0x0540, 0x2060, 0x6020, 0x9086, 0x0003, 0x1550, 0x6000, 0x9086,
 	0x0004, 0x1530, 0x6114, 0x2148, 0xa876, 0xa87a, 0xa867, 0x0103,
-	0x080c, 0x6b86, 0x00b6, 0x6010, 0x2058, 0xba3c, 0x8211, 0x0208,
-	0xba3e, 0xb8d0, 0x9005, 0x190c, 0x6749, 0x00be, 0x6044, 0xd0fc,
-	0x190c, 0xa89b, 0x080c, 0xabf2, 0x7808, 0xd09c, 0x19b0, 0x012e,
+	0x080c, 0x6b96, 0x00b6, 0x6010, 0x2058, 0xba3c, 0x8211, 0x0208,
+	0xba3e, 0xb8d0, 0x9005, 0x190c, 0x6750, 0x00be, 0x6044, 0xd0fc,
+	0x190c, 0xa8bf, 0x080c, 0xac16, 0x7808, 0xd09c, 0x19b0, 0x012e,
 	0x0005, 0x908a, 0x0024, 0x1a0c, 0x0d7d, 0x002b, 0x012e, 0x0005,
 	0x04b0, 0x012e, 0x0005, 0x1407, 0x142d, 0x145d, 0x1462, 0x1466,
 	0x146b, 0x1493, 0x1497, 0x14a5, 0x14a9, 0x1407, 0x1574, 0x1578,
@@ -436,25 +436,25 @@
 	0x1407, 0x1407, 0x1407, 0x1407, 0x1407, 0x1407, 0x146d, 0x1407,
 	0x1435, 0x145a, 0x1421, 0x1407, 0x1441, 0x140b, 0x1409, 0x080c,
 	0x0d7d, 0x080c, 0x0d76, 0x080c, 0x1603, 0x2009, 0x1a79, 0x2104,
-	0x8000, 0x200a, 0x080c, 0x7f85, 0x080c, 0x1ab5, 0x0005, 0x6044,
-	0xd0fc, 0x190c, 0xa89b, 0x2009, 0x0055, 0x080c, 0xac68, 0x012e,
-	0x0005, 0x080c, 0x1603, 0x2060, 0x6044, 0xd0fc, 0x190c, 0xa89b,
-	0x2009, 0x0055, 0x080c, 0xac68, 0x0005, 0x2009, 0x0048, 0x080c,
-	0x1603, 0x2060, 0x080c, 0xac68, 0x0005, 0x2009, 0x0054, 0x080c,
-	0x1603, 0x2060, 0x6044, 0xd0fc, 0x190c, 0xa89b, 0x080c, 0xac68,
+	0x8000, 0x200a, 0x080c, 0x7f99, 0x080c, 0x1ab5, 0x0005, 0x6044,
+	0xd0fc, 0x190c, 0xa8bf, 0x2009, 0x0055, 0x080c, 0xac8c, 0x012e,
+	0x0005, 0x080c, 0x1603, 0x2060, 0x6044, 0xd0fc, 0x190c, 0xa8bf,
+	0x2009, 0x0055, 0x080c, 0xac8c, 0x0005, 0x2009, 0x0048, 0x080c,
+	0x1603, 0x2060, 0x080c, 0xac8c, 0x0005, 0x2009, 0x0054, 0x080c,
+	0x1603, 0x2060, 0x6044, 0xd0fc, 0x190c, 0xa8bf, 0x080c, 0xac8c,
 	0x0005, 0x080c, 0x1603, 0x2060, 0x0056, 0x0066, 0x080c, 0x1603,
 	0x2028, 0x080c, 0x1603, 0x2030, 0x0036, 0x0046, 0x2021, 0x0000,
-	0x2418, 0x2009, 0x0056, 0x080c, 0xac68, 0x004e, 0x003e, 0x006e,
+	0x2418, 0x2009, 0x0056, 0x080c, 0xac8c, 0x004e, 0x003e, 0x006e,
 	0x005e, 0x0005, 0x080c, 0x1603, 0x0005, 0x7004, 0xc085, 0xc0b5,
 	0x7006, 0x0005, 0x7004, 0xc085, 0x7006, 0x0005, 0x080c, 0x1603,
 	0x080c, 0x16c7, 0x0005, 0x080c, 0x0d7d, 0x080c, 0x1603, 0x2060,
 	0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, 0x2009, 0x0048,
-	0x080c, 0xac68, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009, 0x03e8,
+	0x080c, 0xac8c, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009, 0x03e8,
 	0x8109, 0x0160, 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8, 0x2001,
 	0x0218, 0x2004, 0xd0ec, 0x1110, 0x080c, 0x1608, 0x2001, 0x0307,
 	0x2003, 0x8000, 0x0005, 0x7004, 0xc095, 0x7006, 0x0005, 0x080c,
 	0x1603, 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e,
-	0x2009, 0x0048, 0x080c, 0xac68, 0x0005, 0x080c, 0x1603, 0x080c,
+	0x2009, 0x0048, 0x080c, 0xac8c, 0x0005, 0x080c, 0x1603, 0x080c,
 	0x0d7d, 0x080c, 0x1603, 0x080c, 0x155f, 0x7827, 0x0018, 0x79ac,
 	0xd1dc, 0x0904, 0x1512, 0x7827, 0x0015, 0x7828, 0x782b, 0x0000,
 	0x9065, 0x0140, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003, 0x0020,
@@ -470,13 +470,13 @@
 	0x0004, 0x7803, 0x0001, 0x080c, 0x1578, 0x2001, 0x020d, 0x2003,
 	0x0020, 0x0005, 0x7828, 0x782b, 0x0000, 0x9065, 0x090c, 0x0d7d,
 	0x6014, 0x2048, 0x78ab, 0x0004, 0x918c, 0x0700, 0x0198, 0x080c,
-	0x7f85, 0x080c, 0x1ab5, 0x080c, 0xc814, 0x0158, 0xa9ac, 0xa936,
+	0x7f99, 0x080c, 0x1ab5, 0x080c, 0xc838, 0x0158, 0xa9ac, 0xa936,
 	0xa9b0, 0xa93a, 0xa83f, 0xffff, 0xa843, 0xffff, 0xa880, 0xc0bd,
 	0xa882, 0x0005, 0x6020, 0x9086, 0x0009, 0x1128, 0x2009, 0x004c,
-	0x080c, 0xac68, 0x0048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-	0xd0bc, 0x6024, 0x190c, 0xcc10, 0x2029, 0x00c8, 0x8529, 0x0128,
-	0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xe6af,
-	0xd5a4, 0x1118, 0x080c, 0x1608, 0x0005, 0x080c, 0x7f85, 0x080c,
+	0x080c, 0xac8c, 0x0048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
+	0xd0bc, 0x6024, 0x190c, 0xcc34, 0x2029, 0x00c8, 0x8529, 0x0128,
+	0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xe6da,
+	0xd5a4, 0x1118, 0x080c, 0x1608, 0x0005, 0x080c, 0x7f99, 0x080c,
 	0x1ab5, 0x0005, 0x781f, 0x0300, 0x7803, 0x0001, 0x0005, 0x0016,
 	0x0066, 0x0076, 0x00f6, 0x2079, 0x0300, 0x7908, 0x918c, 0x0007,
 	0x9186, 0x0003, 0x0120, 0x2001, 0x0016, 0x080c, 0x1679, 0x00fe,
@@ -494,9 +494,9 @@
 	0x1608, 0x0040, 0x2001, 0x020d, 0x2003, 0x0020, 0x080c, 0x133c,
 	0x7803, 0x0001, 0x00ee, 0x001e, 0x0005, 0x2001, 0x020d, 0x2003,
 	0x0050, 0x2003, 0x0020, 0x0461, 0x0ca8, 0x0429, 0x2060, 0x2009,
-	0x0053, 0x080c, 0xac68, 0x0005, 0x0005, 0x0005, 0x00e1, 0x2008,
-	0x00d1, 0x0006, 0x7004, 0xc09d, 0x7006, 0x000e, 0x080c, 0x8f47,
-	0x0005, 0x0089, 0x9005, 0x0118, 0x080c, 0x8b4a, 0x0cd0, 0x0005,
+	0x0053, 0x080c, 0xac8c, 0x0005, 0x0005, 0x0005, 0x00e1, 0x2008,
+	0x00d1, 0x0006, 0x7004, 0xc09d, 0x7006, 0x000e, 0x080c, 0x8f78,
+	0x0005, 0x0089, 0x9005, 0x0118, 0x080c, 0x8b7b, 0x0cd0, 0x0005,
 	0x2001, 0x0036, 0x2009, 0x1820, 0x210c, 0x2011, 0x181f, 0x2214,
 	0x080c, 0x1679, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x0005,
 	0x080c, 0x155f, 0x00d6, 0x2069, 0x0200, 0x2009, 0x01f4, 0x8109,
@@ -506,7 +506,7 @@
 	0x810c, 0x080c, 0x166b, 0x6827, 0x0001, 0x8109, 0x1dd0, 0x04d9,
 	0x6827, 0x0002, 0x04c1, 0x6804, 0x9005, 0x1130, 0x682c, 0xd0e4,
 	0x1500, 0x6804, 0x9005, 0x0de8, 0x79b8, 0xd1ec, 0x1130, 0x08c0,
-	0x080c, 0x7f85, 0x080c, 0x1ab5, 0x0090, 0x7827, 0x0015, 0x782b,
+	0x080c, 0x7f99, 0x080c, 0x1ab5, 0x0090, 0x7827, 0x0015, 0x782b,
 	0x0000, 0x7827, 0x0018, 0x782b, 0x0000, 0x2001, 0x020d, 0x2003,
 	0x0020, 0x2001, 0x0307, 0x2003, 0x0300, 0x7803, 0x0001, 0x00de,
 	0x0005, 0x682c, 0x9084, 0x5400, 0x9086, 0x5400, 0x0d30, 0x7827,
@@ -527,9 +527,9 @@
 	0xd08c, 0x0904, 0x1726, 0x7017, 0x0000, 0x2001, 0x0264, 0x2004,
 	0xd0bc, 0x0904, 0x1726, 0x2001, 0x0268, 0x00c6, 0x2064, 0x6104,
 	0x6038, 0x00ce, 0x918e, 0x0039, 0x1904, 0x1726, 0x9c06, 0x15f0,
-	0x0126, 0x2091, 0x2600, 0x080c, 0x7edd, 0x012e, 0x7358, 0x745c,
+	0x0126, 0x2091, 0x2600, 0x080c, 0x7ef1, 0x012e, 0x7358, 0x745c,
 	0x6014, 0x905d, 0x0598, 0x2b48, 0x6010, 0x00b6, 0x2058, 0xb800,
-	0x00be, 0xd0bc, 0x190c, 0xcbeb, 0xab42, 0xac3e, 0x2001, 0x1869,
+	0x00be, 0xd0bc, 0x190c, 0xcc0f, 0xab42, 0xac3e, 0x2001, 0x1869,
 	0x2004, 0xd0b4, 0x1170, 0x601c, 0xd0e4, 0x1158, 0x6010, 0x00b6,
 	0x2058, 0xb800, 0x00be, 0xd0bc, 0x1120, 0xa83b, 0x7fff, 0xa837,
 	0xffff, 0x080c, 0x1e75, 0x1190, 0x080c, 0x1913, 0x2a00, 0xa816,
@@ -544,7 +544,7 @@
 	0x918e, 0x0048, 0x0904, 0x17c1, 0x9085, 0x0001, 0x0804, 0x18ad,
 	0xa87c, 0xd0ac, 0x0dc8, 0x0804, 0x17d1, 0xa87c, 0xd0ac, 0x0da0,
 	0x0804, 0x183c, 0xa898, 0x901d, 0x1108, 0xab9c, 0x9016, 0xaab2,
-	0xaa3e, 0xaa42, 0x3e00, 0x9080, 0x0008, 0x2004, 0x9080, 0x9110,
+	0xaa3e, 0xaa42, 0x3e00, 0x9080, 0x0008, 0x2004, 0x9080, 0x9141,
 	0x2005, 0x9005, 0x090c, 0x0d7d, 0x2004, 0xa8ae, 0x0804, 0x1895,
 	0xa87c, 0xd0bc, 0x09c8, 0xa890, 0xa842, 0xa88c, 0xa83e, 0xa888,
 	0x0804, 0x17d1, 0xa87c, 0xd0bc, 0x0978, 0xa890, 0xa842, 0xa88c,
@@ -639,7 +639,7 @@
 	0xa887, 0x0001, 0x0008, 0xa986, 0x601b, 0x0002, 0xa974, 0xd1dc,
 	0x1108, 0x0005, 0xa934, 0xa88c, 0x9106, 0x1158, 0xa938, 0xa890,
 	0x9106, 0x1138, 0x601c, 0xc084, 0x601e, 0x2009, 0x0048, 0x0804,
-	0xac68, 0x0005, 0x0126, 0x00c6, 0x2091, 0x2200, 0x00ce, 0x7908,
+	0xac8c, 0x0005, 0x0126, 0x00c6, 0x2091, 0x2200, 0x00ce, 0x7908,
 	0x918c, 0x0007, 0x9186, 0x0000, 0x05b0, 0x9186, 0x0003, 0x0598,
 	0x6020, 0x6023, 0x0000, 0x0006, 0x2031, 0x0008, 0x00c6, 0x781f,
 	0x0808, 0x7808, 0xd09c, 0x0120, 0x080c, 0x13a3, 0x8631, 0x1db8,
@@ -649,18 +649,18 @@
 	0x001e, 0x8001, 0x1df0, 0x8631, 0x1d40, 0x080c, 0x1b51, 0x000e,
 	0x6022, 0x012e, 0x0005, 0x080c, 0x1b3e, 0x7827, 0x0015, 0x7828,
 	0x9c06, 0x1db8, 0x782b, 0x0000, 0x0ca0, 0x00f6, 0x2079, 0x0300,
-	0x7803, 0x0000, 0x78ab, 0x0004, 0x00fe, 0x080c, 0x74d5, 0x11b0,
+	0x7803, 0x0000, 0x78ab, 0x0004, 0x00fe, 0x080c, 0x74e9, 0x11b0,
 	0x2001, 0x0138, 0x2003, 0x0000, 0x2001, 0x0160, 0x2003, 0x0000,
 	0x2011, 0x012c, 0xa001, 0xa001, 0x8211, 0x1de0, 0x0081, 0x2001,
-	0x0386, 0x2003, 0x2020, 0x080c, 0x7576, 0x0005, 0x0479, 0x0039,
+	0x0386, 0x2003, 0x2020, 0x080c, 0x758a, 0x0005, 0x0479, 0x0039,
 	0x2001, 0x0160, 0x2502, 0x2001, 0x0138, 0x2202, 0x0005, 0x00e6,
 	0x2071, 0x0200, 0x080c, 0x29fc, 0x2009, 0x003c, 0x080c, 0x21b0,
 	0x2001, 0x015d, 0x2003, 0x0000, 0x7000, 0x9084, 0x003c, 0x1de0,
-	0x080c, 0x8522, 0x70a0, 0x70a2, 0x7098, 0x709a, 0x709c, 0x709e,
+	0x080c, 0x8553, 0x70a0, 0x70a2, 0x7098, 0x709a, 0x709c, 0x709e,
 	0x2001, 0x020d, 0x2003, 0x0020, 0x00f6, 0x2079, 0x0300, 0x080c,
 	0x133c, 0x7803, 0x0001, 0x00fe, 0x00ee, 0x0005, 0x2001, 0x0138,
 	0x2014, 0x2003, 0x0000, 0x2001, 0x0160, 0x202c, 0x2003, 0x0000,
-	0x080c, 0x74d5, 0x1108, 0x0005, 0x2021, 0x0260, 0x2001, 0x0141,
+	0x080c, 0x74e9, 0x1108, 0x0005, 0x2021, 0x0260, 0x2001, 0x0141,
 	0x201c, 0xd3dc, 0x1168, 0x2001, 0x0109, 0x201c, 0x939c, 0x0048,
 	0x1160, 0x2001, 0x0111, 0x201c, 0x83ff, 0x1110, 0x8421, 0x1d70,
 	0x2001, 0x015d, 0x2003, 0x0000, 0x0005, 0x0046, 0x2021, 0x0019,
@@ -736,13 +736,13 @@
 	0x3e60, 0x6044, 0x9105, 0x6046, 0x0804, 0x1d0e, 0x080c, 0x0d7d,
 	0x00f6, 0x00e6, 0x0096, 0x00c6, 0x0026, 0x704c, 0x9c06, 0x190c,
 	0x0d7d, 0x2079, 0x0090, 0x2001, 0x0105, 0x2003, 0x0010, 0x782b,
-	0x0004, 0x7057, 0x0000, 0x6014, 0x2048, 0x080c, 0xc814, 0x0118,
+	0x0004, 0x7057, 0x0000, 0x6014, 0x2048, 0x080c, 0xc838, 0x0118,
 	0xa880, 0xc0bd, 0xa882, 0x6020, 0x9086, 0x0006, 0x1170, 0x2061,
 	0x0100, 0x62c8, 0x2001, 0x00fa, 0x8001, 0x1df0, 0x60c8, 0x9206,
 	0x1dc0, 0x60c4, 0xa89a, 0x60c8, 0xa896, 0x704c, 0x2060, 0x00c6,
-	0x080c, 0xc41f, 0x080c, 0xa872, 0x00ce, 0x704c, 0x9c06, 0x1150,
-	0x2009, 0x0040, 0x080c, 0x21b0, 0x080c, 0xa32a, 0x2011, 0x0000,
-	0x080c, 0xa1b5, 0x002e, 0x00ce, 0x009e, 0x00ee, 0x00fe, 0x0005,
+	0x080c, 0xc443, 0x080c, 0xa896, 0x00ce, 0x704c, 0x9c06, 0x1150,
+	0x2009, 0x0040, 0x080c, 0x21b0, 0x080c, 0xa34e, 0x2011, 0x0000,
+	0x080c, 0xa1d9, 0x002e, 0x00ce, 0x009e, 0x00ee, 0x00fe, 0x0005,
 	0x00f6, 0x2079, 0x0090, 0x781c, 0x0006, 0x7818, 0x0006, 0x2079,
 	0x0100, 0x7a14, 0x9284, 0x1984, 0x9085, 0x0012, 0x7816, 0x2019,
 	0x1000, 0x8319, 0x090c, 0x0d7d, 0x7820, 0xd0bc, 0x1dd0, 0x79c8,
@@ -751,12 +751,12 @@
 	0x2079, 0x0090, 0x782b, 0x0008, 0x7057, 0x0000, 0x00fe, 0x0005,
 	0x00f6, 0x00e6, 0x2071, 0x19e7, 0x7054, 0x9086, 0x0000, 0x0904,
 	0x1e26, 0x2079, 0x0090, 0x2009, 0x0207, 0x210c, 0xd194, 0x01b8,
-	0x2009, 0x020c, 0x210c, 0x9184, 0x0003, 0x0188, 0x080c, 0xe6f8,
+	0x2009, 0x020c, 0x210c, 0x9184, 0x0003, 0x0188, 0x080c, 0xe723,
 	0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0d7d, 0x0016, 0x2009,
 	0x0040, 0x080c, 0x21b0, 0x001e, 0x2001, 0x020c, 0x2102, 0x2009,
 	0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106, 0x1120, 0x2009,
-	0x0040, 0x080c, 0x21b0, 0x782c, 0xd0fc, 0x09a8, 0x080c, 0xa88e,
-	0x782c, 0xd0fc, 0x1de8, 0x080c, 0xa872, 0x7054, 0x9086, 0x0000,
+	0x0040, 0x080c, 0x21b0, 0x782c, 0xd0fc, 0x09a8, 0x080c, 0xa8b2,
+	0x782c, 0xd0fc, 0x1de8, 0x080c, 0xa896, 0x7054, 0x9086, 0x0000,
 	0x1950, 0x782b, 0x0004, 0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040,
 	0x080c, 0x21b0, 0x782b, 0x0002, 0x7057, 0x0000, 0x00ee, 0x00fe,
 	0x0005, 0x080c, 0x0d7d, 0x8c60, 0x2c05, 0x9005, 0x0110, 0x8a51,
@@ -841,17 +841,17 @@
 	0x783b, 0x001f, 0x7837, 0x0020, 0x7803, 0x1600, 0x012e, 0x0005,
 	0x2091, 0x2600, 0x781c, 0xd0a4, 0x190c, 0x21ad, 0x7900, 0xd1dc,
 	0x1118, 0x9084, 0x0006, 0x001a, 0x9084, 0x000e, 0x0002, 0x20cf,
-	0x20c7, 0x7edd, 0x20c7, 0x20c9, 0x20c9, 0x20c9, 0x20c9, 0x7ec3,
+	0x20c7, 0x7ef1, 0x20c7, 0x20c9, 0x20c9, 0x20c9, 0x20c9, 0x7ed7,
 	0x20c7, 0x20cb, 0x20c7, 0x20c9, 0x20c7, 0x20c9, 0x20c7, 0x080c,
-	0x0d7d, 0x0031, 0x0020, 0x080c, 0x7ec3, 0x080c, 0x7edd, 0x0005,
-	0x0006, 0x0016, 0x0026, 0x080c, 0xe6f8, 0x7930, 0x9184, 0x0003,
-	0x01f0, 0x080c, 0xa872, 0x2001, 0x19fa, 0x2004, 0x9005, 0x0180,
+	0x0d7d, 0x0031, 0x0020, 0x080c, 0x7ed7, 0x080c, 0x7ef1, 0x0005,
+	0x0006, 0x0016, 0x0026, 0x080c, 0xe723, 0x7930, 0x9184, 0x0003,
+	0x01f0, 0x080c, 0xa896, 0x2001, 0x19fa, 0x2004, 0x9005, 0x0180,
 	0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0d7d, 0x00c6, 0x2001,
-	0x19fa, 0x2064, 0x080c, 0xa88e, 0x080c, 0xc41f, 0x00ce, 0x0408,
-	0x2009, 0x0040, 0x080c, 0x21b0, 0x080c, 0xa88e, 0x00d0, 0x9184,
-	0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160, 0x080c, 0x74d5,
-	0x1138, 0x080c, 0x77d9, 0x080c, 0x6022, 0x080c, 0x7406, 0x0010,
-	0x080c, 0x5edd, 0x080c, 0x7f7b, 0x0041, 0x0018, 0x9184, 0x9540,
+	0x19fa, 0x2064, 0x080c, 0xa8b2, 0x080c, 0xc443, 0x00ce, 0x0408,
+	0x2009, 0x0040, 0x080c, 0x21b0, 0x080c, 0xa8b2, 0x00d0, 0x9184,
+	0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160, 0x080c, 0x74e9,
+	0x1138, 0x080c, 0x77ed, 0x080c, 0x6029, 0x080c, 0x741a, 0x0010,
+	0x080c, 0x5ee4, 0x080c, 0x7f8f, 0x0041, 0x0018, 0x9184, 0x9540,
 	0x1dc8, 0x002e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x0036, 0x0046,
 	0x0056, 0x2071, 0x1a6b, 0x080c, 0x1ab5, 0x005e, 0x004e, 0x003e,
 	0x00ee, 0x0005, 0x0126, 0x2091, 0x2e00, 0x2071, 0x1800, 0x7128,
@@ -900,93 +900,93 @@
 	0x001e, 0x0d30, 0x0c58, 0x2286, 0x2283, 0x2283, 0x2283, 0x2285,
 	0x2283, 0x2283, 0x2283, 0x080c, 0x0d7d, 0x0029, 0x002e, 0x001e,
 	0x000e, 0x012e, 0x0005, 0x00a6, 0x6124, 0x6028, 0xd09c, 0x0118,
-	0xd19c, 0x1904, 0x2500, 0xd1f4, 0x190c, 0x0d76, 0x080c, 0x74d5,
-	0x0904, 0x22e3, 0x080c, 0xcf2e, 0x1120, 0x7000, 0x9086, 0x0003,
-	0x0580, 0x6024, 0x9084, 0x1800, 0x0560, 0x080c, 0x74f8, 0x0118,
-	0x080c, 0x74e6, 0x1530, 0x2011, 0x0020, 0x080c, 0x2a44, 0x6043,
-	0x0000, 0x080c, 0xcf2e, 0x0168, 0x080c, 0x74f8, 0x1150, 0x2001,
-	0x19a7, 0x2003, 0x0001, 0x6027, 0x1800, 0x080c, 0x734b, 0x0804,
+	0xd19c, 0x1904, 0x2500, 0xd1f4, 0x190c, 0x0d76, 0x080c, 0x74e9,
+	0x0904, 0x22e3, 0x080c, 0xcf52, 0x1120, 0x7000, 0x9086, 0x0003,
+	0x0580, 0x6024, 0x9084, 0x1800, 0x0560, 0x080c, 0x750c, 0x0118,
+	0x080c, 0x74fa, 0x1530, 0x2011, 0x0020, 0x080c, 0x2a44, 0x6043,
+	0x0000, 0x080c, 0xcf52, 0x0168, 0x080c, 0x750c, 0x1150, 0x2001,
+	0x19a7, 0x2003, 0x0001, 0x6027, 0x1800, 0x080c, 0x735f, 0x0804,
 	0x2503, 0x70a4, 0x9005, 0x1150, 0x70a7, 0x0001, 0x00d6, 0x2069,
-	0x0140, 0x080c, 0x752c, 0x00de, 0x1904, 0x2503, 0x080c, 0x77e3,
-	0x0428, 0x080c, 0x74f8, 0x1590, 0x6024, 0x9084, 0x1800, 0x1108,
-	0x0468, 0x080c, 0x77e3, 0x080c, 0x77d9, 0x080c, 0x6022, 0x080c,
-	0x7406, 0x0804, 0x2500, 0xd1ac, 0x1508, 0x6024, 0xd0dc, 0x1170,
+	0x0140, 0x080c, 0x7540, 0x00de, 0x1904, 0x2503, 0x080c, 0x77f7,
+	0x0428, 0x080c, 0x750c, 0x1590, 0x6024, 0x9084, 0x1800, 0x1108,
+	0x0468, 0x080c, 0x77f7, 0x080c, 0x77ed, 0x080c, 0x6029, 0x080c,
+	0x741a, 0x0804, 0x2500, 0xd1ac, 0x1508, 0x6024, 0xd0dc, 0x1170,
 	0xd0e4, 0x1178, 0xd0d4, 0x1190, 0xd0cc, 0x0130, 0x7098, 0x9086,
-	0x0028, 0x1110, 0x080c, 0x76ba, 0x0804, 0x2500, 0x080c, 0x77de,
-	0x0048, 0x2001, 0x197d, 0x2003, 0x0002, 0x0020, 0x080c, 0x7617,
-	0x0804, 0x2500, 0x080c, 0x775d, 0x0804, 0x2500, 0x6220, 0xd1bc,
+	0x0028, 0x1110, 0x080c, 0x76ce, 0x0804, 0x2500, 0x080c, 0x77f2,
+	0x0048, 0x2001, 0x197d, 0x2003, 0x0002, 0x0020, 0x080c, 0x762b,
+	0x0804, 0x2500, 0x080c, 0x7771, 0x0804, 0x2500, 0x6220, 0xd1bc,
 	0x0138, 0xd2bc, 0x1904, 0x2565, 0xd2b4, 0x1904, 0x2577, 0x0000,
 	0xd1ac, 0x0904, 0x240d, 0x0036, 0x6328, 0xc3bc, 0x632a, 0x003e,
-	0x080c, 0x74d5, 0x11d0, 0x2011, 0x0020, 0x080c, 0x2a44, 0x0006,
-	0x0026, 0x0036, 0x080c, 0x74ef, 0x1158, 0x080c, 0x77d9, 0x080c,
-	0x6022, 0x080c, 0x7406, 0x003e, 0x002e, 0x000e, 0x00ae, 0x0005,
-	0x003e, 0x002e, 0x000e, 0x080c, 0x74a9, 0x0016, 0x0046, 0x00c6,
+	0x080c, 0x74e9, 0x11d0, 0x2011, 0x0020, 0x080c, 0x2a44, 0x0006,
+	0x0026, 0x0036, 0x080c, 0x7503, 0x1158, 0x080c, 0x77ed, 0x080c,
+	0x6029, 0x080c, 0x741a, 0x003e, 0x002e, 0x000e, 0x00ae, 0x0005,
+	0x003e, 0x002e, 0x000e, 0x080c, 0x74bd, 0x0016, 0x0046, 0x00c6,
 	0x644c, 0x9486, 0xf0f0, 0x1138, 0x2061, 0x0100, 0x644a, 0x6043,
 	0x0090, 0x6043, 0x0010, 0x74da, 0x948c, 0xff00, 0x7038, 0xd084,
 	0x0178, 0x9186, 0xf800, 0x1160, 0x7048, 0xd084, 0x1148, 0xc085,
-	0x704a, 0x0036, 0x2418, 0x2011, 0x8016, 0x080c, 0x4b00, 0x003e,
-	0x080c, 0xcf27, 0x1904, 0x23e4, 0x9196, 0xff00, 0x05a8, 0x7060,
+	0x704a, 0x0036, 0x2418, 0x2011, 0x8016, 0x080c, 0x4b07, 0x003e,
+	0x080c, 0xcf4b, 0x1904, 0x23e4, 0x9196, 0xff00, 0x05a8, 0x7060,
 	0x9084, 0x00ff, 0x810f, 0x81ff, 0x0110, 0x9116, 0x0568, 0x7130,
-	0xd184, 0x1550, 0x080c, 0x3361, 0x0128, 0xc18d, 0x7132, 0x080c,
-	0x6a53, 0x1510, 0x6240, 0x9294, 0x0010, 0x0130, 0x6248, 0x9294,
+	0xd184, 0x1550, 0x080c, 0x3368, 0x0128, 0xc18d, 0x7132, 0x080c,
+	0x6a63, 0x1510, 0x6240, 0x9294, 0x0010, 0x0130, 0x6248, 0x9294,
 	0xff00, 0x9296, 0xff00, 0x01c0, 0x7030, 0xd08c, 0x0904, 0x23e4,
 	0x7038, 0xd08c, 0x1140, 0x2001, 0x180c, 0x200c, 0xd1ac, 0x1904,
 	0x23e4, 0xc1ad, 0x2102, 0x0036, 0x73d8, 0x2011, 0x8013, 0x080c,
-	0x4b00, 0x003e, 0x0804, 0x23e4, 0x7038, 0xd08c, 0x1140, 0x2001,
+	0x4b07, 0x003e, 0x0804, 0x23e4, 0x7038, 0xd08c, 0x1140, 0x2001,
 	0x180c, 0x200c, 0xd1ac, 0x1904, 0x23e4, 0xc1ad, 0x2102, 0x0036,
-	0x73d8, 0x2011, 0x8013, 0x080c, 0x4b00, 0x003e, 0x7130, 0xc185,
+	0x73d8, 0x2011, 0x8013, 0x080c, 0x4b07, 0x003e, 0x7130, 0xc185,
 	0x7132, 0x2011, 0x1848, 0x220c, 0xd1a4, 0x01f0, 0x0016, 0x2009,
-	0x0001, 0x2011, 0x0100, 0x080c, 0x88bb, 0x2019, 0x000e, 0x00c6,
-	0x2061, 0x0000, 0x080c, 0xe20e, 0x00ce, 0x9484, 0x00ff, 0x9080,
-	0x336d, 0x200d, 0x918c, 0xff00, 0x810f, 0x2120, 0x9006, 0x2009,
-	0x000e, 0x080c, 0xe29e, 0x001e, 0x0016, 0x2009, 0x0002, 0x2019,
-	0x0004, 0x080c, 0x31a3, 0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9,
-	0x007f, 0x900e, 0x080c, 0x661e, 0x1110, 0x080c, 0x603c, 0x8108,
-	0x1f04, 0x23da, 0x00be, 0x015e, 0x00ce, 0x004e, 0x080c, 0xa872,
-	0x080c, 0xab3a, 0x080c, 0xa88e, 0x60e3, 0x0000, 0x001e, 0x2001,
+	0x0001, 0x2011, 0x0100, 0x080c, 0x88ec, 0x2019, 0x000e, 0x00c6,
+	0x2061, 0x0000, 0x080c, 0xe239, 0x00ce, 0x9484, 0x00ff, 0x9080,
+	0x3374, 0x200d, 0x918c, 0xff00, 0x810f, 0x2120, 0x9006, 0x2009,
+	0x000e, 0x080c, 0xe2c9, 0x001e, 0x0016, 0x2009, 0x0002, 0x2019,
+	0x0004, 0x080c, 0x31a6, 0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9,
+	0x007f, 0x900e, 0x080c, 0x6625, 0x1110, 0x080c, 0x6043, 0x8108,
+	0x1f04, 0x23da, 0x00be, 0x015e, 0x00ce, 0x004e, 0x080c, 0xa896,
+	0x080c, 0xab5e, 0x080c, 0xa8b2, 0x60e3, 0x0000, 0x001e, 0x2001,
 	0x1800, 0x2014, 0x9296, 0x0004, 0x1170, 0xd19c, 0x11b0, 0x2011,
 	0x180c, 0x2214, 0xd29c, 0x1120, 0x6204, 0x9295, 0x0002, 0x6206,
 	0x6228, 0xc29d, 0x622a, 0x2003, 0x0001, 0x2001, 0x1826, 0x2003,
 	0x0000, 0x2011, 0x0020, 0x080c, 0x2a44, 0xd194, 0x0904, 0x2500,
-	0x0016, 0x080c, 0xa872, 0x6220, 0xd2b4, 0x0904, 0x249b, 0x080c,
-	0x86c5, 0x080c, 0x9e0e, 0x2011, 0x0004, 0x080c, 0x2a44, 0x00f6,
+	0x0016, 0x080c, 0xa896, 0x6220, 0xd2b4, 0x0904, 0x249b, 0x080c,
+	0x86f6, 0x080c, 0x9e32, 0x2011, 0x0004, 0x080c, 0x2a44, 0x00f6,
 	0x2019, 0x19f3, 0x2304, 0x907d, 0x0904, 0x2468, 0x7804, 0x9086,
 	0x0032, 0x15f0, 0x00d6, 0x00c6, 0x00e6, 0x0096, 0x2069, 0x0140,
 	0x782c, 0x685e, 0x7808, 0x685a, 0x6043, 0x0002, 0x2001, 0x0003,
 	0x8001, 0x1df0, 0x6043, 0x0000, 0x2001, 0x003c, 0x8001, 0x1df0,
 	0x080c, 0x2a1a, 0x2001, 0x001e, 0x8001, 0x0240, 0x20a9, 0x0009,
 	0x080c, 0x29d1, 0x6904, 0xd1dc, 0x1140, 0x0cb0, 0x2001, 0x0100,
-	0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x080c, 0x95ad, 0x080c,
-	0xa88e, 0x7814, 0x2048, 0xa867, 0x0103, 0x2f60, 0x080c, 0xabc9,
+	0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x080c, 0x95de, 0x080c,
+	0xa8b2, 0x7814, 0x2048, 0xa867, 0x0103, 0x2f60, 0x080c, 0xabed,
 	0x009e, 0x00ee, 0x00ce, 0x00de, 0x00fe, 0x001e, 0x00ae, 0x0005,
 	0x00fe, 0x00d6, 0x2069, 0x0140, 0x6804, 0x9084, 0x4000, 0x0110,
 	0x080c, 0x2a1a, 0x00de, 0x00c6, 0x2061, 0x19e7, 0x6034, 0x080c,
-	0xcf2e, 0x0120, 0x909a, 0x0003, 0x1258, 0x0018, 0x909a, 0x00c8,
-	0x1238, 0x8000, 0x6036, 0x00ce, 0x080c, 0x9de6, 0x0804, 0x24fd,
-	0x2061, 0x0100, 0x62c0, 0x080c, 0xa7a8, 0x2019, 0x19f3, 0x2304,
-	0x9065, 0x0130, 0x6003, 0x0001, 0x2009, 0x0027, 0x080c, 0xac68,
-	0x00ce, 0x0804, 0x24fd, 0xd2bc, 0x0904, 0x24e0, 0x080c, 0x86d2,
+	0xcf52, 0x0120, 0x909a, 0x0003, 0x1258, 0x0018, 0x909a, 0x00c8,
+	0x1238, 0x8000, 0x6036, 0x00ce, 0x080c, 0x9e0a, 0x0804, 0x24fd,
+	0x2061, 0x0100, 0x62c0, 0x080c, 0xa7cc, 0x2019, 0x19f3, 0x2304,
+	0x9065, 0x0130, 0x6003, 0x0001, 0x2009, 0x0027, 0x080c, 0xac8c,
+	0x00ce, 0x0804, 0x24fd, 0xd2bc, 0x0904, 0x24e0, 0x080c, 0x8703,
 	0x2011, 0x0004, 0x080c, 0x2a44, 0x00d6, 0x2069, 0x0140, 0x6804,
 	0x9084, 0x4000, 0x0110, 0x080c, 0x2a1a, 0x00de, 0x00c6, 0x2061,
-	0x19e7, 0x6050, 0x080c, 0xcf2e, 0x0120, 0x909a, 0x0003, 0x1668,
+	0x19e7, 0x6050, 0x080c, 0xcf52, 0x0120, 0x909a, 0x0003, 0x1668,
 	0x0018, 0x909a, 0x00c8, 0x1648, 0x8000, 0x6052, 0x604c, 0x00ce,
-	0x9005, 0x05d8, 0x2009, 0x07d0, 0x080c, 0x86ca, 0x9080, 0x0008,
+	0x9005, 0x05d8, 0x2009, 0x07d0, 0x080c, 0x86fb, 0x9080, 0x0008,
 	0x2004, 0x9086, 0x0006, 0x1138, 0x2009, 0x1984, 0x2011, 0x0012,
 	0x080c, 0x2a53, 0x0450, 0x9080, 0x0008, 0x2004, 0x9086, 0x0009,
 	0x0d98, 0x2009, 0x1984, 0x2011, 0x0016, 0x080c, 0x2a53, 0x00e8,
 	0x2011, 0x0004, 0x080c, 0x2a44, 0x00c0, 0x0036, 0x2019, 0x0001,
-	0x080c, 0xa0f4, 0x003e, 0x2019, 0x19fa, 0x2304, 0x9065, 0x0160,
+	0x080c, 0xa118, 0x003e, 0x2019, 0x19fa, 0x2304, 0x9065, 0x0160,
 	0x2009, 0x004f, 0x6020, 0x9086, 0x0009, 0x1110, 0x2009, 0x004f,
-	0x6003, 0x0003, 0x080c, 0xac68, 0x00ce, 0x080c, 0xa88e, 0x001e,
+	0x6003, 0x0003, 0x080c, 0xac8c, 0x00ce, 0x080c, 0xa8b2, 0x001e,
 	0xd19c, 0x0904, 0x255e, 0x7038, 0xd0ac, 0x1538, 0x0016, 0x0156,
 	0x2011, 0x0008, 0x080c, 0x2a44, 0x6050, 0xc0e5, 0x6052, 0x20a9,
-	0x0367, 0x1f04, 0x252b, 0x1d04, 0x2513, 0x080c, 0x86f9, 0x6020,
+	0x0367, 0x1f04, 0x252b, 0x1d04, 0x2513, 0x080c, 0x872a, 0x6020,
 	0xd09c, 0x1db8, 0x00f6, 0x2079, 0x0100, 0x080c, 0x2981, 0x00fe,
 	0x1d80, 0x6050, 0xc0e4, 0x6052, 0x2011, 0x0008, 0x080c, 0x2a44,
 	0x015e, 0x001e, 0x0498, 0x015e, 0x001e, 0x0016, 0x6028, 0xc09c,
-	0x602a, 0x080c, 0xa872, 0x080c, 0xab3a, 0x080c, 0xa88e, 0x60e3,
-	0x0000, 0x080c, 0xe6d7, 0x080c, 0xe6f2, 0x080c, 0x56d7, 0xd0fc,
-	0x1138, 0x080c, 0xcf27, 0x1120, 0x9085, 0x0001, 0x080c, 0x751c,
+	0x602a, 0x080c, 0xa896, 0x080c, 0xab5e, 0x080c, 0xa8b2, 0x60e3,
+	0x0000, 0x080c, 0xe702, 0x080c, 0xe71d, 0x080c, 0x56de, 0xd0fc,
+	0x1138, 0x080c, 0xcf4b, 0x1120, 0x9085, 0x0001, 0x080c, 0x7530,
 	0x9006, 0x080c, 0x2a0a, 0x2009, 0x0002, 0x080c, 0x29f6, 0x00e6,
 	0x2071, 0x1800, 0x7003, 0x0004, 0x080c, 0x0eb4, 0x00ee, 0x2011,
 	0x0008, 0x080c, 0x2a44, 0x080c, 0x0bc3, 0x001e, 0x918c, 0xffd0,
@@ -1002,34 +1002,34 @@
 	0x8000, 0x2071, 0x1800, 0x71d0, 0x70d2, 0x9116, 0x0904, 0x25f3,
 	0x81ff, 0x01a0, 0x2009, 0x0000, 0x080c, 0x29f6, 0x2011, 0x8011,
 	0x2019, 0x010e, 0x231c, 0x939e, 0x0007, 0x1118, 0x2019, 0x0001,
-	0x0010, 0x2019, 0x0000, 0x080c, 0x4b00, 0x0468, 0x2001, 0x19a8,
+	0x0010, 0x2019, 0x0000, 0x080c, 0x4b07, 0x0468, 0x2001, 0x19a8,
 	0x200c, 0x81ff, 0x1140, 0x2001, 0x0109, 0x2004, 0xd0b4, 0x0118,
-	0x2019, 0x0003, 0x0008, 0x2118, 0x2011, 0x8012, 0x080c, 0x4b00,
-	0x080c, 0x0eb4, 0x080c, 0x56d7, 0xd0fc, 0x11a8, 0x080c, 0xcf27,
-	0x1190, 0x00c6, 0x080c, 0x268f, 0x080c, 0xa872, 0x080c, 0xa04f,
-	0x080c, 0xa88e, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009, 0x0002,
-	0x080c, 0x31a3, 0x00ce, 0x012e, 0x00fe, 0x00ee, 0x003e, 0x002e,
+	0x2019, 0x0003, 0x0008, 0x2118, 0x2011, 0x8012, 0x080c, 0x4b07,
+	0x080c, 0x0eb4, 0x080c, 0x56de, 0xd0fc, 0x11a8, 0x080c, 0xcf4b,
+	0x1190, 0x00c6, 0x080c, 0x268f, 0x080c, 0xa896, 0x080c, 0xa073,
+	0x080c, 0xa8b2, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009, 0x0002,
+	0x080c, 0x31a6, 0x00ce, 0x012e, 0x00fe, 0x00ee, 0x003e, 0x002e,
 	0x001e, 0x000e, 0x0005, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094,
 	0xff00, 0x11f0, 0x2011, 0x1837, 0x2214, 0xd2ac, 0x11c8, 0x81ff,
 	0x01e8, 0x2011, 0x181f, 0x2204, 0x9106, 0x1190, 0x2011, 0x1820,
 	0x2214, 0x9294, 0xff00, 0x9584, 0xff00, 0x9206, 0x1148, 0x2011,
 	0x1820, 0x2214, 0x9294, 0x00ff, 0x9584, 0x00ff, 0x9206, 0x1120,
-	0x2500, 0x080c, 0x81ce, 0x0048, 0x9584, 0x00ff, 0x9080, 0x336d,
-	0x200d, 0x918c, 0xff00, 0x810f, 0x9006, 0x0005, 0x9080, 0x336d,
+	0x2500, 0x080c, 0x81ff, 0x0048, 0x9584, 0x00ff, 0x9080, 0x3374,
+	0x200d, 0x918c, 0xff00, 0x810f, 0x9006, 0x0005, 0x9080, 0x3374,
 	0x200d, 0x918c, 0x00ff, 0x0005, 0x00d6, 0x2069, 0x0140, 0x2001,
 	0x1818, 0x2003, 0x00ef, 0x20a9, 0x0010, 0x9006, 0x6852, 0x6856,
 	0x1f04, 0x263f, 0x00de, 0x0005, 0x0006, 0x00d6, 0x0026, 0x2069,
 	0x0140, 0x2001, 0x1818, 0x2102, 0x8114, 0x8214, 0x8214, 0x8214,
 	0x20a9, 0x0010, 0x6853, 0x0000, 0x9006, 0x82ff, 0x1128, 0x9184,
-	0x000f, 0x9080, 0xe706, 0x2005, 0x6856, 0x8211, 0x1f04, 0x2654,
+	0x000f, 0x9080, 0xe731, 0x2005, 0x6856, 0x8211, 0x1f04, 0x2654,
 	0x002e, 0x00de, 0x000e, 0x0005, 0x00c6, 0x2061, 0x1800, 0x6030,
 	0x0110, 0xc09d, 0x0008, 0xc09c, 0x6032, 0x00ce, 0x0005, 0x0156,
 	0x00d6, 0x0026, 0x0016, 0x0006, 0x2069, 0x0140, 0x6980, 0x9116,
 	0x0180, 0x9112, 0x1230, 0x8212, 0x8210, 0x22a8, 0x2001, 0x0402,
 	0x0018, 0x22a8, 0x2001, 0x0404, 0x680e, 0x1f04, 0x2684, 0x680f,
 	0x0000, 0x000e, 0x001e, 0x002e, 0x00de, 0x015e, 0x0005, 0x080c,
-	0x56d3, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046, 0x2020,
-	0x2009, 0x002e, 0x080c, 0xe29e, 0x004e, 0x0005, 0x00f6, 0x0016,
+	0x56da, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046, 0x2020,
+	0x2009, 0x002e, 0x080c, 0xe2c9, 0x004e, 0x0005, 0x00f6, 0x0016,
 	0x0026, 0x2079, 0x0140, 0x78c4, 0xd0dc, 0x0904, 0x26fb, 0x080c,
 	0x2971, 0x0660, 0x9084, 0x0700, 0x908e, 0x0600, 0x1120, 0x2011,
 	0x4000, 0x900e, 0x0458, 0x908e, 0x0500, 0x1120, 0x2011, 0x8000,
@@ -1038,9 +1038,9 @@
 	0x908e, 0x0200, 0x1120, 0x9016, 0x2009, 0x0004, 0x0078, 0x908e,
 	0x0100, 0x1548, 0x9016, 0x2009, 0x0008, 0x0040, 0x9084, 0x0700,
 	0x908e, 0x0300, 0x1500, 0x2011, 0x0030, 0x0058, 0x2300, 0x9080,
-	0x0020, 0x2018, 0x080c, 0x9135, 0x928c, 0xff00, 0x0110, 0x2011,
+	0x0020, 0x2018, 0x080c, 0x9166, 0x928c, 0xff00, 0x0110, 0x2011,
 	0x00ff, 0x2200, 0x8007, 0x9085, 0x004c, 0x78c2, 0x2009, 0x0138,
-	0x220a, 0x080c, 0x74d5, 0x1118, 0x2009, 0x196d, 0x220a, 0x002e,
+	0x220a, 0x080c, 0x74e9, 0x1118, 0x2009, 0x196d, 0x220a, 0x002e,
 	0x001e, 0x00fe, 0x0005, 0x78c3, 0x0000, 0x0cc8, 0x0126, 0x2091,
 	0x2800, 0x0006, 0x0016, 0x0026, 0x2001, 0x0170, 0x200c, 0x8000,
 	0x2014, 0x9184, 0x0003, 0x0110, 0x080c, 0x0d76, 0x002e, 0x001e,
@@ -1056,17 +1056,17 @@
 	0x27ca, 0x2001, 0x0001, 0x080c, 0x25a0, 0x080c, 0x29bb, 0x2001,
 	0x1992, 0x2003, 0x0000, 0x7828, 0x9084, 0xe1d7, 0x782a, 0x9006,
 	0x20a9, 0x0009, 0x080c, 0x298d, 0x2001, 0x1990, 0x2003, 0x0006,
-	0x2009, 0x001e, 0x2011, 0x27cb, 0x080c, 0x86d7, 0x0005, 0x2009,
+	0x2009, 0x001e, 0x2011, 0x27cb, 0x080c, 0x8708, 0x0005, 0x2009,
 	0x1995, 0x200b, 0x0000, 0x2001, 0x199a, 0x2003, 0x0036, 0x2001,
 	0x1999, 0x2003, 0x002a, 0x2001, 0x1992, 0x2003, 0x0001, 0x9006,
 	0x080c, 0x2928, 0x2001, 0xffff, 0x20a9, 0x0009, 0x080c, 0x298d,
 	0x2001, 0x1990, 0x2003, 0x0006, 0x2009, 0x001e, 0x2011, 0x27cb,
-	0x080c, 0x86d7, 0x0005, 0x080c, 0x0d7d, 0x2001, 0x199a, 0x2003,
+	0x080c, 0x8708, 0x0005, 0x080c, 0x0d7d, 0x2001, 0x199a, 0x2003,
 	0x0036, 0x2001, 0x1992, 0x2003, 0x0003, 0x7a38, 0x9294, 0x0005,
 	0x9296, 0x0004, 0x0110, 0x9006, 0x0010, 0x2001, 0x0001, 0x080c,
 	0x2928, 0x2001, 0x1996, 0x2003, 0x0000, 0x2001, 0xffff, 0x20a9,
 	0x0009, 0x080c, 0x298d, 0x2001, 0x1990, 0x2003, 0x0006, 0x2009,
-	0x001e, 0x2011, 0x27cb, 0x080c, 0x86d7, 0x0005, 0x080c, 0x0d7d,
+	0x001e, 0x2011, 0x27cb, 0x080c, 0x8708, 0x0005, 0x080c, 0x0d7d,
 	0x080c, 0x0d7d, 0x0005, 0x0006, 0x0016, 0x0026, 0x00e6, 0x00f6,
 	0x0156, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100, 0x2001, 0x1992,
 	0x2004, 0x908a, 0x0007, 0x1a0c, 0x0d7d, 0x0043, 0x012e, 0x015e,
@@ -1128,24 +1128,24 @@
 	0x0007, 0x0090, 0x9186, 0x0001, 0x1118, 0x783b, 0x0006, 0x0060,
 	0x9186, 0x0002, 0x1118, 0x783b, 0x0005, 0x0030, 0x9186, 0x0003,
 	0x1118, 0x783b, 0x0004, 0x0000, 0x0006, 0x1d04, 0x29ad, 0x080c,
-	0x86f9, 0x1f04, 0x29ad, 0x7850, 0x9085, 0x1000, 0x7852, 0x000e,
+	0x872a, 0x1f04, 0x29ad, 0x7850, 0x9085, 0x1000, 0x7852, 0x000e,
 	0x001e, 0x012e, 0x0005, 0x080c, 0x2aab, 0x0005, 0x0006, 0x0156,
 	0x00f6, 0x2079, 0x0100, 0x20a9, 0x000a, 0x7854, 0xd0ac, 0x1100,
 	0x7854, 0xd08c, 0x1110, 0x1f04, 0x29c8, 0x00fe, 0x015e, 0x000e,
-	0x0005, 0x1d04, 0x29d1, 0x080c, 0x86f9, 0x1f04, 0x29d1, 0x0005,
+	0x0005, 0x1d04, 0x29d1, 0x080c, 0x872a, 0x1f04, 0x29d1, 0x0005,
 	0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0000, 0x000e, 0x0005,
 	0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0001, 0x000e, 0x0005,
 	0x0006, 0x2001, 0x199c, 0x2004, 0x9086, 0x0002, 0x000e, 0x0005,
 	0xa001, 0xa001, 0xa001, 0xa001, 0xa001, 0x0005, 0x0006, 0x2001,
 	0x19a8, 0x2102, 0x000e, 0x0005, 0x2009, 0x0171, 0x2104, 0xd0dc,
 	0x0140, 0x2009, 0x0170, 0x2104, 0x200b, 0x0080, 0xa001, 0xa001,
-	0x200a, 0x0005, 0x0016, 0x0026, 0x080c, 0x74ef, 0x0108, 0xc0bc,
+	0x200a, 0x0005, 0x0016, 0x0026, 0x080c, 0x7503, 0x0108, 0xc0bc,
 	0x2009, 0x0140, 0x2114, 0x9294, 0x0001, 0x9215, 0x220a, 0x002e,
 	0x001e, 0x0005, 0x0016, 0x0026, 0x2009, 0x0140, 0x2114, 0x9294,
 	0x0001, 0x9285, 0x1000, 0x200a, 0x220a, 0x002e, 0x001e, 0x0005,
 	0x0016, 0x0026, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001, 0x9215,
 	0x220a, 0x002e, 0x001e, 0x0005, 0x0006, 0x0016, 0x2009, 0x0140,
-	0x2104, 0x1128, 0x080c, 0x74ef, 0x0110, 0xc0bc, 0x0008, 0xc0bd,
+	0x2104, 0x1128, 0x080c, 0x7503, 0x0110, 0xc0bc, 0x0008, 0xc0bd,
 	0x200a, 0x001e, 0x000e, 0x0005, 0x00f6, 0x2079, 0x0380, 0x7843,
 	0x0101, 0x7844, 0xd084, 0x1de8, 0x2001, 0x0109, 0x2202, 0x7843,
 	0x0100, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0380, 0x7843, 0x0202,
@@ -1252,1935 +1252,1937 @@
 	0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146,
 	0x0156, 0x080c, 0x26fe, 0x080c, 0x207e, 0x080c, 0x2248, 0x080c,
 	0x13a3, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
-	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8d8, 0x0804,
+	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8fc, 0x0804,
 	0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146,
-	0x0156, 0x080c, 0xa8d8, 0x080c, 0x2248, 0x0804, 0x2fa9, 0x0106,
+	0x0156, 0x080c, 0xa8fc, 0x080c, 0x2248, 0x0804, 0x2fa9, 0x0106,
 	0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c,
-	0x207e, 0x080c, 0xa8d8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
+	0x207e, 0x080c, 0xa8fc, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
 	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c,
-	0xa8d8, 0x080c, 0x2248, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
-	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8d8, 0x080c,
+	0xa8fc, 0x080c, 0x2248, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
+	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8fc, 0x080c,
 	0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
-	0x0136, 0x0146, 0x0156, 0x080c, 0xa8d8, 0x080c, 0x2248, 0x080c,
+	0x0136, 0x0146, 0x0156, 0x080c, 0xa8fc, 0x080c, 0x2248, 0x080c,
 	0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
-	0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c,
+	0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c,
 	0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
-	0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c,
+	0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c,
 	0x2248, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
-	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8d8, 0x080c,
+	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8fc, 0x080c,
 	0x13a3, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
-	0x0136, 0x0146, 0x0156, 0x080c, 0xa8d8, 0x080c, 0x2248, 0x080c,
+	0x0136, 0x0146, 0x0156, 0x080c, 0xa8fc, 0x080c, 0x2248, 0x080c,
 	0x13a3, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
-	0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c,
+	0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c,
 	0x13a3, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
-	0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c,
+	0x0136, 0x0146, 0x0156, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c,
 	0x2248, 0x080c, 0x13a3, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
-	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8d8, 0x080c,
+	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8fc, 0x080c,
 	0x13a3, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
-	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8d8, 0x080c,
+	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0xa8fc, 0x080c,
 	0x2248, 0x080c, 0x13a3, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106,
 	0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c,
-	0x207e, 0x080c, 0xa8d8, 0x080c, 0x13a3, 0x080c, 0x20a8, 0x0804,
+	0x207e, 0x080c, 0xa8fc, 0x080c, 0x13a3, 0x080c, 0x20a8, 0x0804,
 	0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146,
-	0x0156, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c, 0x2248, 0x080c,
+	0x0156, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c, 0x2248, 0x080c,
 	0x13a3, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
 	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c,
-	0xa8d8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
-	0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c, 0xa8d8, 0x080c,
+	0xa8fc, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
+	0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c, 0xa8fc, 0x080c,
 	0x2248, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
 	0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c, 0x207e, 0x080c,
-	0xa8d8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
+	0xa8fc, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6,
 	0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c, 0x207e, 0x080c,
-	0xa8d8, 0x080c, 0x2248, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
+	0xa8fc, 0x080c, 0x2248, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
 	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c,
-	0xa8d8, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
+	0xa8fc, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
 	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c,
-	0xa8d8, 0x080c, 0x2248, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106,
+	0xa8fc, 0x080c, 0x2248, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106,
 	0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c,
-	0x26fe, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c, 0x20a8, 0x0804,
+	0x26fe, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c, 0x20a8, 0x0804,
 	0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146,
-	0x0156, 0x080c, 0x26fe, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c,
+	0x0156, 0x080c, 0x26fe, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c,
 	0x2248, 0x080c, 0x20a8, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
 	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c,
-	0xa8d8, 0x080c, 0x13a3, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
+	0xa8fc, 0x080c, 0x13a3, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
 	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c,
-	0xa8d8, 0x080c, 0x2248, 0x080c, 0x13a3, 0x0804, 0x2fa9, 0x0106,
+	0xa8fc, 0x080c, 0x2248, 0x080c, 0x13a3, 0x0804, 0x2fa9, 0x0106,
 	0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c,
-	0x26fe, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c, 0x13a3, 0x0804,
+	0x26fe, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c, 0x13a3, 0x0804,
 	0x2fa9, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146,
-	0x0156, 0x080c, 0x26fe, 0x080c, 0x207e, 0x080c, 0xa8d8, 0x080c,
+	0x0156, 0x080c, 0x26fe, 0x080c, 0x207e, 0x080c, 0xa8fc, 0x080c,
 	0x2248, 0x080c, 0x13a3, 0x0804, 0x2fa9, 0x0106, 0x0006, 0x0126,
 	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c,
-	0xa8d8, 0x080c, 0x13a3, 0x080c, 0x20a8, 0x04d8, 0x0106, 0x0006,
+	0xa8fc, 0x080c, 0x13a3, 0x080c, 0x20a8, 0x04d8, 0x0106, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x26fe,
-	0x080c, 0xa8d8, 0x080c, 0x2248, 0x080c, 0x13a3, 0x080c, 0x20a8,
+	0x080c, 0xa8fc, 0x080c, 0x2248, 0x080c, 0x13a3, 0x080c, 0x20a8,
 	0x0440, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146,
 	0x0156, 0x080c, 0x26fe, 0x080c, 0x207e, 0x080c, 0x13a3, 0x080c,
-	0xa8d8, 0x080c, 0x20a8, 0x00a8, 0x0106, 0x0006, 0x0126, 0x01c6,
+	0xa8fc, 0x080c, 0x20a8, 0x00a8, 0x0106, 0x0006, 0x0126, 0x01c6,
 	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x26fe, 0x080c, 0x207e,
-	0x080c, 0xa8d8, 0x080c, 0x2248, 0x080c, 0x13a3, 0x080c, 0x20a8,
+	0x080c, 0xa8fc, 0x080c, 0x2248, 0x080c, 0x13a3, 0x080c, 0x20a8,
 	0x0000, 0x015e, 0x014e, 0x013e, 0x01de, 0x01ce, 0x012e, 0x000e,
 	0x010e, 0x000d, 0x00b6, 0x00c6, 0x0026, 0x0046, 0x9026, 0x080c,
-	0x6a19, 0x1904, 0x30bf, 0x72dc, 0x2001, 0x197c, 0x2004, 0x9005,
-	0x1110, 0xd29c, 0x0148, 0xd284, 0x1138, 0xd2bc, 0x1904, 0x30bf,
-	0x080c, 0x30c4, 0x0804, 0x30bf, 0xd2cc, 0x1904, 0x30bf, 0x080c,
-	0x74d5, 0x1120, 0x70af, 0xffff, 0x0804, 0x30bf, 0xd294, 0x0120,
-	0x70af, 0xffff, 0x0804, 0x30bf, 0x080c, 0x335c, 0x0160, 0x080c,
-	0xcf2e, 0x0128, 0x2001, 0x1818, 0x203c, 0x0804, 0x304c, 0x70af,
-	0xffff, 0x0804, 0x30bf, 0x2001, 0x1818, 0x203c, 0x7294, 0xd284,
-	0x0904, 0x304c, 0xd28c, 0x1904, 0x304c, 0x0036, 0x73ac, 0x938e,
+	0x6a29, 0x1904, 0x30c2, 0x72dc, 0x2001, 0x197c, 0x2004, 0x9005,
+	0x1110, 0xd29c, 0x0148, 0xd284, 0x1138, 0xd2bc, 0x1904, 0x30c2,
+	0x080c, 0x30c7, 0x0804, 0x30c2, 0xd2cc, 0x1904, 0x30c2, 0x080c,
+	0x74e9, 0x1120, 0x70af, 0xffff, 0x0804, 0x30c2, 0xd294, 0x0120,
+	0x70af, 0xffff, 0x0804, 0x30c2, 0x080c, 0x3363, 0x0160, 0x080c,
+	0xcf52, 0x0128, 0x2001, 0x1818, 0x203c, 0x0804, 0x304f, 0x70af,
+	0xffff, 0x0804, 0x30c2, 0x2001, 0x1818, 0x203c, 0x7294, 0xd284,
+	0x0904, 0x304f, 0xd28c, 0x1904, 0x304f, 0x0036, 0x73ac, 0x938e,
 	0xffff, 0x1110, 0x2019, 0x0001, 0x8314, 0x92e0, 0x1d80, 0x2c04,
 	0x938c, 0x0001, 0x0120, 0x9084, 0xff00, 0x8007, 0x0010, 0x9084,
-	0x00ff, 0x970e, 0x05b8, 0x908e, 0x0000, 0x05a0, 0x908e, 0x00ff,
-	0x1150, 0x7230, 0xd284, 0x1598, 0x7294, 0xc28d, 0x7296, 0x70af,
-	0xffff, 0x003e, 0x0488, 0x900e, 0x080c, 0x25fb, 0x080c, 0x65bd,
-	0x1520, 0x9006, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148, 0x00c6,
-	0x2060, 0x080c, 0x8b5f, 0x00ce, 0x090c, 0x8f03, 0xb8af, 0x0000,
-	0x080c, 0x6a5b, 0x1150, 0x7030, 0xd08c, 0x0118, 0xb800, 0xd0bc,
-	0x0120, 0x080c, 0x30dd, 0x0148, 0x0028, 0x080c, 0x3231, 0x080c,
-	0x3109, 0x0118, 0x8318, 0x0804, 0x2ffc, 0x73ae, 0x0010, 0x70af,
-	0xffff, 0x003e, 0x0804, 0x30bf, 0x9780, 0x336d, 0x203d, 0x97bc,
-	0xff00, 0x873f, 0x2041, 0x007e, 0x70ac, 0x9096, 0xffff, 0x1118,
-	0x900e, 0x28a8, 0x0050, 0x9812, 0x0220, 0x2008, 0x9802, 0x20a8,
-	0x0020, 0x70af, 0xffff, 0x0804, 0x30bf, 0x2700, 0x0156, 0x0016,
-	0x9106, 0x0904, 0x30b4, 0xc484, 0x080c, 0x661e, 0x0148, 0x080c,
-	0xcf2e, 0x1904, 0x30b4, 0x080c, 0x65bd, 0x1904, 0x30bc, 0x0008,
-	0xc485, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148, 0x00c6, 0x2060,
-	0x080c, 0x8b5f, 0x00ce, 0x090c, 0x8f03, 0xb8af, 0x0000, 0x080c,
-	0x6a5b, 0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800, 0xd0bc, 0x11e0,
-	0x7294, 0xd28c, 0x0180, 0x080c, 0x6a5b, 0x9082, 0x0006, 0x02e0,
-	0xd484, 0x1118, 0x080c, 0x65e2, 0x0028, 0x080c, 0x32ca, 0x01a0,
-	0x080c, 0x32f5, 0x0088, 0x080c, 0x3231, 0x080c, 0xcf2e, 0x1160,
-	0x080c, 0x3109, 0x0188, 0x0040, 0x080c, 0xcf2e, 0x1118, 0x080c,
-	0x32ca, 0x0110, 0x0451, 0x0140, 0x001e, 0x8108, 0x015e, 0x1f04,
-	0x3065, 0x70af, 0xffff, 0x0018, 0x001e, 0x015e, 0x71ae, 0x004e,
-	0x002e, 0x00ce, 0x00be, 0x0005, 0x00c6, 0x0016, 0x70af, 0x0001,
-	0x2009, 0x007e, 0x080c, 0x65bd, 0x1168, 0xb813, 0x00ff, 0xb817,
-	0xfffe, 0x080c, 0x3231, 0x04a9, 0x0128, 0x70dc, 0xc0bd, 0x70de,
-	0x080c, 0xcc7b, 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6,
-	0x00c6, 0x2001, 0x184c, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c,
-	0xac3b, 0x01d0, 0x2b00, 0x6012, 0x080c, 0xcca8, 0x6023, 0x0001,
-	0x9006, 0x080c, 0x655a, 0x2001, 0x0000, 0x080c, 0x656e, 0x0126,
-	0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa, 0x012e, 0x2009, 0x0004,
-	0x080c, 0xac68, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e,
-	0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001, 0x184c, 0x2004,
-	0x9084, 0x00ff, 0xb842, 0x080c, 0xac3b, 0x0548, 0x2b00, 0x6012,
-	0xb800, 0xc0c4, 0xb802, 0xb8a0, 0x9086, 0x007e, 0x0140, 0xb804,
-	0x9084, 0x00ff, 0x9086, 0x0006, 0x1110, 0x080c, 0x31e4, 0x080c,
-	0xcca8, 0x6023, 0x0001, 0x9006, 0x080c, 0x655a, 0x2001, 0x0002,
-	0x080c, 0x656e, 0x0126, 0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa,
-	0x012e, 0x2009, 0x0002, 0x080c, 0xac68, 0x9085, 0x0001, 0x00ce,
-	0x00de, 0x007e, 0x001e, 0x0005, 0x00b6, 0x00c6, 0x0026, 0x2009,
-	0x0080, 0x080c, 0x65bd, 0x1140, 0xb813, 0x00ff, 0xb817, 0xfffc,
-	0x0039, 0x0110, 0x70e3, 0xffff, 0x002e, 0x00ce, 0x00be, 0x0005,
-	0x0016, 0x0076, 0x00d6, 0x00c6, 0x080c, 0xab73, 0x01d0, 0x2b00,
-	0x6012, 0x080c, 0xcca8, 0x6023, 0x0001, 0x9006, 0x080c, 0x655a,
-	0x2001, 0x0002, 0x080c, 0x656e, 0x0126, 0x2091, 0x8000, 0x70e4,
-	0x8000, 0x70e6, 0x012e, 0x2009, 0x0002, 0x080c, 0xac68, 0x9085,
-	0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00c6, 0x00d6,
-	0x0126, 0x2091, 0x8000, 0x2009, 0x007f, 0x080c, 0x65bd, 0x11b8,
-	0xb813, 0x00ff, 0xb817, 0xfffd, 0xb8d7, 0x0004, 0x080c, 0xab73,
-	0x0170, 0x2b00, 0x6012, 0x6316, 0x6023, 0x0001, 0x620a, 0x080c,
-	0xcca8, 0x2009, 0x0022, 0x080c, 0xac68, 0x9085, 0x0001, 0x012e,
-	0x00de, 0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066, 0x0036, 0x0026,
-	0x00b6, 0x21f0, 0x9036, 0x080c, 0xa872, 0x1110, 0x2031, 0x0001,
-	0x0066, 0x080c, 0x937f, 0x080c, 0x92f5, 0x080c, 0xa7c8, 0x080c,
-	0xbaf5, 0x006e, 0x86ff, 0x0110, 0x080c, 0xa88e, 0x3e08, 0x2130,
-	0x81ff, 0x0120, 0x20a9, 0x007e, 0x900e, 0x0018, 0x20a9, 0x007f,
-	0x900e, 0x0016, 0x080c, 0x661e, 0x1140, 0x9686, 0x0002, 0x1118,
-	0xb800, 0xd0bc, 0x1110, 0x080c, 0x603c, 0x001e, 0x8108, 0x1f04,
-	0x31c9, 0x9686, 0x0001, 0x190c, 0x3330, 0x00be, 0x002e, 0x003e,
-	0x006e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0026,
-	0x0016, 0x00b6, 0x9016, 0x080c, 0xa872, 0x1110, 0x2011, 0x0001,
-	0x0026, 0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c,
-	0x9374, 0x0076, 0x2039, 0x0000, 0x080c, 0x9246, 0x2c08, 0x080c,
-	0xdfc0, 0x007e, 0x001e, 0x002e, 0x82ff, 0x0110, 0x080c, 0xa88e,
-	0xba10, 0xbb14, 0x080c, 0x603c, 0xba12, 0xbb16, 0x00be, 0x001e,
-	0x002e, 0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x00b6,
-	0x6010, 0x2058, 0xb8a0, 0x00be, 0x9086, 0x0080, 0x0150, 0x2071,
-	0x1800, 0x70a8, 0x9005, 0x0110, 0x8001, 0x70aa, 0x000e, 0x00ee,
-	0x0005, 0x2071, 0x1800, 0x70e4, 0x9005, 0x0dc0, 0x8001, 0x70e6,
-	0x0ca8, 0xb800, 0xc08c, 0xb802, 0x0005, 0x00f6, 0x00e6, 0x00c6,
-	0x00b6, 0x0036, 0x0026, 0x0016, 0x0156, 0x2178, 0x9016, 0x080c,
-	0xa872, 0x1110, 0x2011, 0x0001, 0x0026, 0x81ff, 0x1118, 0x20a9,
-	0x0001, 0x0088, 0x080c, 0x56d3, 0xd0c4, 0x0150, 0xd0a4, 0x0140,
-	0x9006, 0x0046, 0x2020, 0x2009, 0x002d, 0x080c, 0xe29e, 0x004e,
-	0x20a9, 0x0800, 0x9016, 0x0026, 0x928e, 0x007e, 0x0904, 0x32a5,
-	0x928e, 0x007f, 0x0904, 0x32a5, 0x928e, 0x0080, 0x05f0, 0x9288,
-	0x1000, 0x210c, 0x81ff, 0x05c8, 0x8fff, 0x1150, 0x2001, 0x198e,
-	0x0006, 0x2003, 0x0001, 0x080c, 0x32b7, 0x000e, 0x2003, 0x0000,
-	0x00b6, 0x00c6, 0x2158, 0x2001, 0x0001, 0x080c, 0x6a25, 0x00ce,
-	0x00be, 0x2019, 0x0029, 0x080c, 0x9374, 0x0076, 0x2039, 0x0000,
-	0x080c, 0x9246, 0x00b6, 0x00c6, 0x0026, 0x2158, 0xba04, 0x9294,
-	0x00ff, 0x9286, 0x0006, 0x1118, 0xb807, 0x0404, 0x0028, 0x2001,
-	0x0004, 0x8007, 0x9215, 0xba06, 0x002e, 0x00ce, 0x00be, 0x0016,
-	0x2c08, 0x080c, 0xdfc0, 0x001e, 0x007e, 0x002e, 0x8210, 0x1f04,
-	0x325b, 0x002e, 0x82ff, 0x0110, 0x080c, 0xa88e, 0x015e, 0x001e,
-	0x002e, 0x003e, 0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046,
-	0x0026, 0x0016, 0x080c, 0x56d3, 0xd0c4, 0x0140, 0xd0a4, 0x0130,
-	0x9006, 0x2220, 0x2009, 0x0029, 0x080c, 0xe29e, 0x001e, 0x002e,
-	0x004e, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x7294, 0x82ff,
-	0x01e8, 0x080c, 0x6a53, 0x11d0, 0x2100, 0x080c, 0x262e, 0x81ff,
-	0x01b8, 0x2019, 0x0001, 0x8314, 0x92e0, 0x1d80, 0x2c04, 0xd384,
-	0x0120, 0x9084, 0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x9116,
-	0x0138, 0x9096, 0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085, 0x0001,
-	0x00ce, 0x003e, 0x002e, 0x001e, 0x0005, 0x0016, 0x00c6, 0x0126,
-	0x2091, 0x8000, 0x0066, 0x9036, 0x080c, 0xa872, 0x1110, 0x2031,
-	0x0001, 0x0066, 0x0036, 0x2019, 0x0029, 0x00d9, 0x003e, 0x006e,
-	0x86ff, 0x0110, 0x080c, 0xa88e, 0x006e, 0x9180, 0x1000, 0x2004,
-	0x9065, 0x0158, 0x0016, 0x00c6, 0x2061, 0x1b32, 0x001e, 0x6112,
-	0x080c, 0x31e4, 0x001e, 0x080c, 0x65e2, 0x012e, 0x00ce, 0x001e,
-	0x0005, 0x0016, 0x0026, 0x2110, 0x080c, 0xa366, 0x080c, 0xe605,
-	0x002e, 0x001e, 0x0005, 0x2001, 0x1837, 0x2004, 0xd0cc, 0x0005,
-	0x00c6, 0x00b6, 0x080c, 0x74d5, 0x1118, 0x20a9, 0x0800, 0x0010,
-	0x20a9, 0x0782, 0x080c, 0x74d5, 0x1110, 0x900e, 0x0010, 0x2009,
-	0x007e, 0x9180, 0x1000, 0x2004, 0x905d, 0x0130, 0x86ff, 0x0110,
-	0xb800, 0xd0bc, 0x090c, 0x65e2, 0x8108, 0x1f04, 0x3341, 0x2061,
-	0x1800, 0x607f, 0x0000, 0x6080, 0x9084, 0x00ff, 0x6082, 0x60b3,
-	0x0000, 0x00be, 0x00ce, 0x0005, 0x2001, 0x1869, 0x2004, 0xd0bc,
-	0x0005, 0x2011, 0x1848, 0x2214, 0xd2ec, 0x0005, 0x0026, 0x2011,
-	0x1867, 0x2214, 0xd2dc, 0x002e, 0x0005, 0x7eef, 0x7de8, 0x7ce4,
-	0x80e2, 0x7be1, 0x80e0, 0x80dc, 0x80da, 0x7ad9, 0x80d6, 0x80d5,
-	0x80d4, 0x80d3, 0x80d2, 0x80d1, 0x79ce, 0x78cd, 0x80cc, 0x80cb,
-	0x80ca, 0x80c9, 0x80c7, 0x80c6, 0x77c5, 0x76c3, 0x80bc, 0x80ba,
-	0x75b9, 0x80b6, 0x74b5, 0x73b4, 0x72b3, 0x80b2, 0x80b1, 0x80ae,
-	0x71ad, 0x80ac, 0x70ab, 0x6faa, 0x6ea9, 0x80a7, 0x6da6, 0x6ca5,
-	0x6ba3, 0x6a9f, 0x699e, 0x689d, 0x809b, 0x8098, 0x6797, 0x6690,
-	0x658f, 0x6488, 0x6384, 0x6282, 0x8081, 0x8080, 0x617c, 0x607a,
-	0x8079, 0x5f76, 0x8075, 0x8074, 0x8073, 0x8072, 0x8071, 0x806e,
-	0x5e6d, 0x806c, 0x5d6b, 0x5c6a, 0x5b69, 0x8067, 0x5a66, 0x5965,
-	0x5863, 0x575c, 0x565a, 0x5559, 0x8056, 0x8055, 0x5454, 0x5353,
-	0x5252, 0x5151, 0x504e, 0x4f4d, 0x804c, 0x804b, 0x4e4a, 0x4d49,
-	0x8047, 0x4c46, 0x8045, 0x8043, 0x803c, 0x803a, 0x8039, 0x8036,
-	0x4b35, 0x8034, 0x4a33, 0x4932, 0x4831, 0x802e, 0x472d, 0x462c,
-	0x452b, 0x442a, 0x4329, 0x4227, 0x8026, 0x8025, 0x4123, 0x401f,
-	0x3f1e, 0x3e1d, 0x3d1b, 0x3c18, 0x8017, 0x8010, 0x3b0f, 0x3a08,
-	0x8004, 0x3902, 0x8001, 0x8000, 0x8000, 0x3800, 0x3700, 0x3600,
-	0x8000, 0x3500, 0x8000, 0x8000, 0x8000, 0x3400, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x3300, 0x3200, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x3100, 0x3000, 0x8000, 0x8000,
-	0x2f00, 0x8000, 0x2e00, 0x2d00, 0x2c00, 0x8000, 0x8000, 0x8000,
-	0x2b00, 0x8000, 0x2a00, 0x2900, 0x2800, 0x8000, 0x2700, 0x2600,
-	0x2500, 0x2400, 0x2300, 0x2200, 0x8000, 0x8000, 0x2100, 0x2000,
-	0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x8000, 0x8000, 0x1b00, 0x1a00,
-	0x8000, 0x1900, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x1800, 0x8000, 0x1700, 0x1600, 0x1500, 0x8000, 0x1400, 0x1300,
-	0x1200, 0x1100, 0x1000, 0x0f00, 0x8000, 0x8000, 0x0e00, 0x0d00,
-	0x0c00, 0x0b00, 0x0a00, 0x0900, 0x8000, 0x8000, 0x0800, 0x0700,
-	0x8000, 0x0600, 0x8000, 0x8000, 0x8000, 0x0500, 0x0400, 0x0300,
-	0x8000, 0x0200, 0x8000, 0x8000, 0x8000, 0x0100, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
+	0x00ff, 0x970e, 0x05d0, 0x908e, 0x0000, 0x05b8, 0x908e, 0x00ff,
+	0x1150, 0x7230, 0xd284, 0x15b0, 0x7294, 0xc28d, 0x7296, 0x70af,
+	0xffff, 0x003e, 0x04a0, 0x900e, 0x080c, 0x25fb, 0x080c, 0x65c4,
+	0x1538, 0x9006, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0148, 0x00c6,
+	0x2060, 0x080c, 0x8b90, 0x00ce, 0x090c, 0x8f34, 0xb8af, 0x0000,
+	0x080c, 0x6a6b, 0x1168, 0x7030, 0xd08c, 0x0130, 0xb800, 0xd0bc,
+	0x0138, 0x080c, 0x6914, 0x0120, 0x080c, 0x30e0, 0x0148, 0x0028,
+	0x080c, 0x3238, 0x080c, 0x310c, 0x0118, 0x8318, 0x0804, 0x2ffc,
+	0x73ae, 0x0010, 0x70af, 0xffff, 0x003e, 0x0804, 0x30c2, 0x9780,
+	0x3374, 0x203d, 0x97bc, 0xff00, 0x873f, 0x2041, 0x007e, 0x70ac,
+	0x9096, 0xffff, 0x1118, 0x900e, 0x28a8, 0x0050, 0x9812, 0x0220,
+	0x2008, 0x9802, 0x20a8, 0x0020, 0x70af, 0xffff, 0x0804, 0x30c2,
+	0x2700, 0x0156, 0x0016, 0x9106, 0x0904, 0x30b7, 0xc484, 0x080c,
+	0x6625, 0x0148, 0x080c, 0xcf52, 0x1904, 0x30b7, 0x080c, 0x65c4,
+	0x1904, 0x30bf, 0x0008, 0xc485, 0xb8bb, 0x0520, 0xb8ac, 0x9005,
+	0x0148, 0x00c6, 0x2060, 0x080c, 0x8b90, 0x00ce, 0x090c, 0x8f34,
+	0xb8af, 0x0000, 0x080c, 0x6a6b, 0x1130, 0x7030, 0xd08c, 0x01f8,
+	0xb800, 0xd0bc, 0x11e0, 0x7294, 0xd28c, 0x0180, 0x080c, 0x6a6b,
+	0x9082, 0x0006, 0x02e0, 0xd484, 0x1118, 0x080c, 0x65e9, 0x0028,
+	0x080c, 0x32d1, 0x01a0, 0x080c, 0x32fc, 0x0088, 0x080c, 0x3238,
+	0x080c, 0xcf52, 0x1160, 0x080c, 0x310c, 0x0188, 0x0040, 0x080c,
+	0xcf52, 0x1118, 0x080c, 0x32d1, 0x0110, 0x0451, 0x0140, 0x001e,
+	0x8108, 0x015e, 0x1f04, 0x3068, 0x70af, 0xffff, 0x0018, 0x001e,
+	0x015e, 0x71ae, 0x004e, 0x002e, 0x00ce, 0x00be, 0x0005, 0x00c6,
+	0x0016, 0x70af, 0x0001, 0x2009, 0x007e, 0x080c, 0x65c4, 0x1168,
+	0xb813, 0x00ff, 0xb817, 0xfffe, 0x080c, 0x3238, 0x04a9, 0x0128,
+	0x70dc, 0xc0bd, 0x70de, 0x080c, 0xcc9f, 0x001e, 0x00ce, 0x0005,
+	0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001, 0x184c, 0x2004, 0x9084,
+	0x00ff, 0xb842, 0x080c, 0xac5f, 0x01d0, 0x2b00, 0x6012, 0x080c,
+	0xcccc, 0x6023, 0x0001, 0x9006, 0x080c, 0x6561, 0x2001, 0x0000,
+	0x080c, 0x6575, 0x0126, 0x2091, 0x8000, 0x70a8, 0x8000, 0x70aa,
+	0x012e, 0x2009, 0x0004, 0x080c, 0xac8c, 0x9085, 0x0001, 0x00ce,
+	0x00de, 0x007e, 0x001e, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6,
+	0x2001, 0x184c, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c, 0xac5f,
+	0x0548, 0x2b00, 0x6012, 0xb800, 0xc0c4, 0xb802, 0xb8a0, 0x9086,
+	0x007e, 0x0140, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1110,
+	0x080c, 0x31e7, 0x080c, 0xcccc, 0x6023, 0x0001, 0x9006, 0x080c,
+	0x6561, 0x2001, 0x0002, 0x080c, 0x6575, 0x0126, 0x2091, 0x8000,
+	0x70a8, 0x8000, 0x70aa, 0x012e, 0x2009, 0x0002, 0x080c, 0xac8c,
+	0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00b6,
+	0x00c6, 0x0026, 0x2009, 0x0080, 0x080c, 0x65c4, 0x1140, 0xb813,
+	0x00ff, 0xb817, 0xfffc, 0x0039, 0x0110, 0x70e3, 0xffff, 0x002e,
+	0x00ce, 0x00be, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x080c,
+	0xab97, 0x01d0, 0x2b00, 0x6012, 0x080c, 0xcccc, 0x6023, 0x0001,
+	0x9006, 0x080c, 0x6561, 0x2001, 0x0002, 0x080c, 0x6575, 0x0126,
+	0x2091, 0x8000, 0x70e4, 0x8000, 0x70e6, 0x012e, 0x2009, 0x0002,
+	0x080c, 0xac8c, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e,
+	0x0005, 0x00c6, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2009, 0x007f,
+	0x080c, 0x65c4, 0x11b8, 0xb813, 0x00ff, 0xb817, 0xfffd, 0xb8d7,
+	0x0004, 0x080c, 0xab97, 0x0170, 0x2b00, 0x6012, 0x6316, 0x6023,
+	0x0001, 0x620a, 0x080c, 0xcccc, 0x2009, 0x0022, 0x080c, 0xac8c,
+	0x9085, 0x0001, 0x012e, 0x00de, 0x00ce, 0x0005, 0x00e6, 0x00c6,
+	0x0066, 0x0036, 0x0026, 0x00b6, 0x21f0, 0x9036, 0x080c, 0xa896,
+	0x1110, 0x2031, 0x0001, 0x0066, 0x080c, 0x93b0, 0x080c, 0x9326,
+	0x080c, 0xa7ec, 0x080c, 0xbb19, 0x006e, 0x86ff, 0x0110, 0x080c,
+	0xa8b2, 0x3e08, 0x2130, 0x81ff, 0x0120, 0x20a9, 0x007e, 0x900e,
+	0x0018, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6625, 0x1140,
+	0x9686, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c, 0x6043,
+	0x001e, 0x8108, 0x1f04, 0x31cc, 0x9686, 0x0001, 0x190c, 0x3337,
+	0x00be, 0x002e, 0x003e, 0x006e, 0x00ce, 0x00ee, 0x0005, 0x00e6,
+	0x00c6, 0x0046, 0x0036, 0x0026, 0x0016, 0x00b6, 0x9016, 0x080c,
+	0xa896, 0x1110, 0x2011, 0x0001, 0x0026, 0x6210, 0x2258, 0xbaa0,
+	0x0026, 0x2019, 0x0029, 0x080c, 0x93a5, 0x0076, 0x2039, 0x0000,
+	0x080c, 0x9277, 0x2c08, 0x080c, 0xdfeb, 0x007e, 0x001e, 0x002e,
+	0x82ff, 0x0110, 0x080c, 0xa8b2, 0xba10, 0xbb14, 0xbc84, 0x080c,
+	0x6043, 0xba12, 0xbb16, 0xbc86, 0x00be, 0x001e, 0x002e, 0x003e,
+	0x004e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x00b6, 0x6010,
+	0x2058, 0xb8a0, 0x00be, 0x9086, 0x0080, 0x0150, 0x2071, 0x1800,
+	0x70a8, 0x9005, 0x0110, 0x8001, 0x70aa, 0x000e, 0x00ee, 0x0005,
+	0x2071, 0x1800, 0x70e4, 0x9005, 0x0dc0, 0x8001, 0x70e6, 0x0ca8,
+	0xb800, 0xc08c, 0xb802, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x00b6,
+	0x0046, 0x0036, 0x0026, 0x0016, 0x0156, 0x2178, 0x9016, 0x080c,
+	0xa896, 0x1110, 0x2011, 0x0001, 0x0026, 0x81ff, 0x1118, 0x20a9,
+	0x0001, 0x0078, 0x080c, 0x56da, 0xd0c4, 0x0140, 0xd0a4, 0x0130,
+	0x9006, 0x2020, 0x2009, 0x002d, 0x080c, 0xe2c9, 0x20a9, 0x0800,
+	0x9016, 0x0026, 0x928e, 0x007e, 0x0904, 0x32ab, 0x928e, 0x007f,
+	0x0904, 0x32ab, 0x928e, 0x0080, 0x05f0, 0x9288, 0x1000, 0x210c,
+	0x81ff, 0x05c8, 0x8fff, 0x1150, 0x2001, 0x198e, 0x0006, 0x2003,
+	0x0001, 0x080c, 0x32be, 0x000e, 0x2003, 0x0000, 0x00b6, 0x00c6,
+	0x2158, 0x2001, 0x0001, 0x080c, 0x6a35, 0x00ce, 0x00be, 0x2019,
+	0x0029, 0x080c, 0x93a5, 0x0076, 0x2039, 0x0000, 0x080c, 0x9277,
+	0x00b6, 0x00c6, 0x0026, 0x2158, 0xba04, 0x9294, 0x00ff, 0x9286,
+	0x0006, 0x1118, 0xb807, 0x0404, 0x0028, 0x2001, 0x0004, 0x8007,
+	0x9215, 0xba06, 0x002e, 0x00ce, 0x00be, 0x0016, 0x2c08, 0x080c,
+	0xdfeb, 0x001e, 0x007e, 0x002e, 0x8210, 0x1f04, 0x3261, 0x002e,
+	0x82ff, 0x0110, 0x080c, 0xa8b2, 0x015e, 0x001e, 0x002e, 0x003e,
+	0x004e, 0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046, 0x0026,
+	0x0016, 0x080c, 0x56da, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006,
+	0x2220, 0x2009, 0x0029, 0x080c, 0xe2c9, 0x001e, 0x002e, 0x004e,
+	0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x7294, 0x82ff, 0x01e8,
+	0x080c, 0x6a63, 0x11d0, 0x2100, 0x080c, 0x262e, 0x81ff, 0x01b8,
+	0x2019, 0x0001, 0x8314, 0x92e0, 0x1d80, 0x2c04, 0xd384, 0x0120,
+	0x9084, 0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x9116, 0x0138,
+	0x9096, 0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085, 0x0001, 0x00ce,
+	0x003e, 0x002e, 0x001e, 0x0005, 0x0016, 0x00c6, 0x0126, 0x2091,
+	0x8000, 0x0066, 0x9036, 0x080c, 0xa896, 0x1110, 0x2031, 0x0001,
+	0x0066, 0x0036, 0x2019, 0x0029, 0x00d9, 0x003e, 0x006e, 0x86ff,
+	0x0110, 0x080c, 0xa8b2, 0x006e, 0x9180, 0x1000, 0x2004, 0x9065,
+	0x0158, 0x0016, 0x00c6, 0x2061, 0x1b32, 0x001e, 0x6112, 0x080c,
+	0x31e7, 0x001e, 0x080c, 0x65e9, 0x012e, 0x00ce, 0x001e, 0x0005,
+	0x0016, 0x0026, 0x2110, 0x080c, 0xa38a, 0x080c, 0xe630, 0x002e,
+	0x001e, 0x0005, 0x2001, 0x1837, 0x2004, 0xd0cc, 0x0005, 0x00c6,
+	0x00b6, 0x080c, 0x74e9, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9,
+	0x0782, 0x080c, 0x74e9, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e,
+	0x9180, 0x1000, 0x2004, 0x905d, 0x0130, 0x86ff, 0x0110, 0xb800,
+	0xd0bc, 0x090c, 0x65e9, 0x8108, 0x1f04, 0x3348, 0x2061, 0x1800,
+	0x607f, 0x0000, 0x6080, 0x9084, 0x00ff, 0x6082, 0x60b3, 0x0000,
+	0x00be, 0x00ce, 0x0005, 0x2001, 0x1869, 0x2004, 0xd0bc, 0x0005,
+	0x2011, 0x1848, 0x2214, 0xd2ec, 0x0005, 0x0026, 0x2011, 0x1867,
+	0x2214, 0xd2dc, 0x002e, 0x0005, 0x7eef, 0x7de8, 0x7ce4, 0x80e2,
+	0x7be1, 0x80e0, 0x80dc, 0x80da, 0x7ad9, 0x80d6, 0x80d5, 0x80d4,
+	0x80d3, 0x80d2, 0x80d1, 0x79ce, 0x78cd, 0x80cc, 0x80cb, 0x80ca,
+	0x80c9, 0x80c7, 0x80c6, 0x77c5, 0x76c3, 0x80bc, 0x80ba, 0x75b9,
+	0x80b6, 0x74b5, 0x73b4, 0x72b3, 0x80b2, 0x80b1, 0x80ae, 0x71ad,
+	0x80ac, 0x70ab, 0x6faa, 0x6ea9, 0x80a7, 0x6da6, 0x6ca5, 0x6ba3,
+	0x6a9f, 0x699e, 0x689d, 0x809b, 0x8098, 0x6797, 0x6690, 0x658f,
+	0x6488, 0x6384, 0x6282, 0x8081, 0x8080, 0x617c, 0x607a, 0x8079,
+	0x5f76, 0x8075, 0x8074, 0x8073, 0x8072, 0x8071, 0x806e, 0x5e6d,
+	0x806c, 0x5d6b, 0x5c6a, 0x5b69, 0x8067, 0x5a66, 0x5965, 0x5863,
+	0x575c, 0x565a, 0x5559, 0x8056, 0x8055, 0x5454, 0x5353, 0x5252,
+	0x5151, 0x504e, 0x4f4d, 0x804c, 0x804b, 0x4e4a, 0x4d49, 0x8047,
+	0x4c46, 0x8045, 0x8043, 0x803c, 0x803a, 0x8039, 0x8036, 0x4b35,
+	0x8034, 0x4a33, 0x4932, 0x4831, 0x802e, 0x472d, 0x462c, 0x452b,
+	0x442a, 0x4329, 0x4227, 0x8026, 0x8025, 0x4123, 0x401f, 0x3f1e,
+	0x3e1d, 0x3d1b, 0x3c18, 0x8017, 0x8010, 0x3b0f, 0x3a08, 0x8004,
+	0x3902, 0x8001, 0x8000, 0x8000, 0x3800, 0x3700, 0x3600, 0x8000,
+	0x3500, 0x8000, 0x8000, 0x8000, 0x3400, 0x8000, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x8000, 0x3300, 0x3200, 0x8000, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x8000, 0x3100, 0x3000, 0x8000, 0x8000, 0x2f00,
+	0x8000, 0x2e00, 0x2d00, 0x2c00, 0x8000, 0x8000, 0x8000, 0x2b00,
+	0x8000, 0x2a00, 0x2900, 0x2800, 0x8000, 0x2700, 0x2600, 0x2500,
+	0x2400, 0x2300, 0x2200, 0x8000, 0x8000, 0x2100, 0x2000, 0x1f00,
+	0x1e00, 0x1d00, 0x1c00, 0x8000, 0x8000, 0x1b00, 0x1a00, 0x8000,
+	0x1900, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x1800,
+	0x8000, 0x1700, 0x1600, 0x1500, 0x8000, 0x1400, 0x1300, 0x1200,
+	0x1100, 0x1000, 0x0f00, 0x8000, 0x8000, 0x0e00, 0x0d00, 0x0c00,
+	0x0b00, 0x0a00, 0x0900, 0x8000, 0x8000, 0x0800, 0x0700, 0x8000,
+	0x0600, 0x8000, 0x8000, 0x8000, 0x0500, 0x0400, 0x0300, 0x8000,
+	0x0200, 0x8000, 0x8000, 0x8000, 0x0100, 0x8000, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000, 0x8000,
 	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x2071, 0x189e, 0x7003,
-	0x0002, 0x9006, 0x7016, 0x701a, 0x704a, 0x704e, 0x700e, 0x7042,
-	0x7046, 0x703b, 0x18ba, 0x703f, 0x18ba, 0x7007, 0x0001, 0x080c,
-	0x1053, 0x090c, 0x0d7d, 0x2900, 0x706a, 0xa867, 0x0002, 0xa8ab,
-	0xdcb0, 0x080c, 0x1053, 0x090c, 0x0d7d, 0x2900, 0x706e, 0xa867,
-	0x0002, 0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x189e, 0x7004, 0x0002,
-	0x349c, 0x349d, 0x34b0, 0x34c4, 0x0005, 0x1004, 0x34ad, 0x0e04,
-	0x34ad, 0x2079, 0x0000, 0x0126, 0x2091, 0x8000, 0x700c, 0x9005,
-	0x1128, 0x700f, 0x0001, 0x012e, 0x0468, 0x0005, 0x012e, 0x0ce8,
-	0x2079, 0x0000, 0x2061, 0x18b8, 0x2c4c, 0xa86c, 0x908e, 0x0100,
-	0x0128, 0x9086, 0x0200, 0x0904, 0x3598, 0x0005, 0x7018, 0x2048,
-	0x2061, 0x1800, 0x701c, 0x0807, 0x7014, 0x2048, 0xa864, 0x9094,
-	0x00ff, 0x9296, 0x0029, 0x1120, 0xaa78, 0xd2fc, 0x0128, 0x0005,
-	0x9086, 0x0103, 0x0108, 0x0005, 0x2079, 0x0000, 0x2061, 0x1800,
-	0x701c, 0x0807, 0x2061, 0x1800, 0x7880, 0x908a, 0x0040, 0x1210,
-	0x61d0, 0x0042, 0x2100, 0x908a, 0x003f, 0x1a04, 0x3595, 0x61d0,
-	0x0804, 0x352a, 0x356c, 0x35a4, 0x35ae, 0x35b2, 0x35bc, 0x35c2,
-	0x35c6, 0x35d6, 0x35d9, 0x35e3, 0x35e8, 0x35ed, 0x35f8, 0x3603,
-	0x3612, 0x3621, 0x362f, 0x3646, 0x3661, 0x3595, 0x370a, 0x3748,
-	0x37ed, 0x37fe, 0x3821, 0x3595, 0x3595, 0x3595, 0x3859, 0x3879,
-	0x3882, 0x38ae, 0x38b4, 0x3595, 0x38fa, 0x3595, 0x3595, 0x3595,
-	0x3595, 0x3595, 0x3905, 0x390e, 0x3916, 0x3918, 0x3595, 0x3595,
-	0x3595, 0x3595, 0x3595, 0x3595, 0x3948, 0x3595, 0x3595, 0x3595,
-	0x3595, 0x3595, 0x3965, 0x39c9, 0x3595, 0x3595, 0x3595, 0x3595,
-	0x3595, 0x3595, 0x0002, 0x39f3, 0x39f6, 0x3a55, 0x3a6e, 0x3a9e,
-	0x3d40, 0x3595, 0x52a4, 0x3595, 0x3595, 0x3595, 0x3595, 0x3595,
-	0x3595, 0x3595, 0x3595, 0x35e3, 0x35e8, 0x423f, 0x56f7, 0x425d,
-	0x5333, 0x5384, 0x5487, 0x3595, 0x54e9, 0x5525, 0x5556, 0x5662,
-	0x5583, 0x55e2, 0x3595, 0x4261, 0x4416, 0x442c, 0x4451, 0x44b6,
-	0x452a, 0x454a, 0x45c1, 0x461d, 0x4679, 0x467c, 0x46a1, 0x4711,
-	0x477b, 0x4783, 0x48b5, 0x4a2a, 0x4a5e, 0x4cc2, 0x3595, 0x4ce0,
-	0x4d8c, 0x4e6e, 0x4ec8, 0x3595, 0x4f7d, 0x3595, 0x4fe3, 0x4ffe,
-	0x4783, 0x5244, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c, 0x4adc,
-	0x0126, 0x2091, 0x8000, 0x0e04, 0x3576, 0x0010, 0x012e, 0x0cc0,
-	0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833,
-	0x0010, 0x7c82, 0x7986, 0x7a8a, 0x7b8e, 0x2091, 0x4080, 0x2001,
-	0x0089, 0x2004, 0xd084, 0x190c, 0x11d6, 0x7007, 0x0001, 0x2091,
-	0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x2021, 0x4001, 0x08b0,
-	0x2021, 0x4002, 0x0898, 0x2021, 0x4003, 0x0880, 0x2021, 0x4005,
-	0x0868, 0x2021, 0x4006, 0x0850, 0x2039, 0x0001, 0x902e, 0x2520,
-	0x7b88, 0x7a8c, 0x7884, 0x7990, 0x0804, 0x4ae9, 0x7883, 0x0004,
-	0x7884, 0x0807, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c,
-	0x7884, 0x7990, 0x0804, 0x4aec, 0x7984, 0x7888, 0x2114, 0x200a,
-	0x0804, 0x356c, 0x7984, 0x2114, 0x0804, 0x356c, 0x20e1, 0x0000,
-	0x2099, 0x0021, 0x20e9, 0x0000, 0x20a1, 0x0021, 0x20a9, 0x001f,
-	0x4003, 0x7984, 0x7a88, 0x7b8c, 0x0804, 0x356c, 0x7884, 0x2060,
-	0x04d8, 0x2009, 0x0003, 0x2011, 0x0002, 0x2019, 0x001a, 0x789b,
-	0x0137, 0x0804, 0x356c, 0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0800,
-	0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0848, 0x79a0, 0x9182, 0x0040,
-	0x0210, 0x0804, 0x35a1, 0x2138, 0x7d98, 0x7c9c, 0x0804, 0x35a8,
-	0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x35a1, 0x2138, 0x7d98,
-	0x7c9c, 0x0804, 0x35b6, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804,
-	0x35a1, 0x21e8, 0x7984, 0x7888, 0x20a9, 0x0001, 0x21a0, 0x4004,
-	0x0804, 0x356c, 0x2061, 0x0800, 0xe10c, 0x9006, 0x2c15, 0x9200,
-	0x8c60, 0x8109, 0x1dd8, 0x2010, 0x9005, 0x0904, 0x356c, 0x0804,
-	0x359b, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x35a1, 0x21e0,
-	0x20a9, 0x0001, 0x7984, 0x2198, 0x4012, 0x0804, 0x356c, 0x2069,
-	0x1847, 0x7884, 0x7990, 0x911a, 0x1a04, 0x35a1, 0x8019, 0x0904,
-	0x35a1, 0x684a, 0x6942, 0x788c, 0x6852, 0x7888, 0x6856, 0x9006,
-	0x685a, 0x685e, 0x080c, 0x780a, 0x0804, 0x356c, 0x2069, 0x1847,
-	0x7884, 0x7994, 0x911a, 0x1a04, 0x35a1, 0x8019, 0x0904, 0x35a1,
-	0x684e, 0x6946, 0x788c, 0x6862, 0x7888, 0x6866, 0x9006, 0x686a,
-	0x686e, 0x0126, 0x2091, 0x8000, 0x080c, 0x6ac5, 0x012e, 0x0804,
-	0x356c, 0x902e, 0x2520, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-	0x359e, 0x7984, 0x7b88, 0x7a8c, 0x20a9, 0x0005, 0x20e9, 0x0001,
-	0x20a1, 0x18a6, 0x4101, 0x080c, 0x4aa0, 0x1120, 0x2009, 0x0002,
-	0x0804, 0x359e, 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60,
-	0x080c, 0x4ae9, 0x701f, 0x3685, 0x0005, 0xa864, 0x2008, 0x9084,
-	0x00ff, 0x9096, 0x0011, 0x0168, 0x9096, 0x0019, 0x0150, 0x9096,
-	0x0015, 0x0138, 0x9096, 0x0048, 0x0120, 0x9096, 0x0029, 0x1904,
-	0x359e, 0x810f, 0x918c, 0x00ff, 0x0904, 0x359e, 0x7112, 0x7010,
-	0x8001, 0x0560, 0x7012, 0x080c, 0x4aa0, 0x1120, 0x2009, 0x0002,
-	0x0804, 0x359e, 0x2009, 0x0020, 0x7068, 0x2040, 0xa28c, 0xa390,
-	0xa494, 0xa598, 0x9290, 0x0040, 0x9399, 0x0000, 0x94a1, 0x0000,
-	0x95a9, 0x0000, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4ae9,
-	0x701f, 0x36c3, 0x0005, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0002,
-	0x0120, 0x9096, 0x000a, 0x1904, 0x359e, 0x0888, 0x7014, 0x2048,
-	0xa868, 0xc0fd, 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0029,
-	0x1160, 0xc2fd, 0xaa7a, 0x080c, 0x618f, 0x0150, 0x0126, 0x2091,
-	0x8000, 0xa87a, 0xa982, 0x012e, 0x0050, 0x080c, 0x64b8, 0x1128,
-	0x7007, 0x0003, 0x701f, 0x36ef, 0x0005, 0x080c, 0x6fb0, 0x0126,
-	0x2091, 0x8000, 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x18a6,
-	0x400a, 0x2100, 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9,
-	0x0000, 0xa85c, 0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60,
-	0x0804, 0x4aec, 0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010,
-	0x7883, 0x4000, 0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020,
-	0x2009, 0x017f, 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100,
-	0x6200, 0x2061, 0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009,
-	0x04fd, 0x2104, 0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001,
-	0x0089, 0x2004, 0xd084, 0x0180, 0x2001, 0x1a22, 0x2004, 0x9005,
-	0x0128, 0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a,
-	0x2003, 0x0002, 0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427,
-	0x81ff, 0x1904, 0x359e, 0x7984, 0x080c, 0x661e, 0x1904, 0x35a1,
-	0x7e98, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x35a1, 0x7c88,
-	0x7d8c, 0x080c, 0x6850, 0x080c, 0x67e1, 0x1518, 0x2061, 0x1ddc,
-	0x0126, 0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014,
-	0x904d, 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0150,
-	0x012e, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a04,
-	0x359e, 0x0c30, 0x080c, 0xc41f, 0x012e, 0x0904, 0x359e, 0x0804,
-	0x356c, 0x900e, 0x2001, 0x0005, 0x080c, 0x6fb0, 0x0126, 0x2091,
-	0x8000, 0x080c, 0xcb18, 0x080c, 0x6d70, 0x012e, 0x0804, 0x356c,
-	0x00a6, 0x2950, 0xb198, 0x080c, 0x661e, 0x1904, 0x37da, 0xb6a4,
-	0x9684, 0x3fff, 0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0, 0x080c,
-	0x6850, 0x080c, 0x67fb, 0x1520, 0x2061, 0x1ddc, 0x0126, 0x2091,
-	0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130,
-	0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0158, 0x012e, 0x9ce0,
-	0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x2009, 0x000d, 0x12b0,
-	0x0c28, 0x080c, 0xc41f, 0x012e, 0x2009, 0x0003, 0x0178, 0x00e0,
-	0x900e, 0x2001, 0x0005, 0x080c, 0x6fb0, 0x0126, 0x2091, 0x8000,
-	0x080c, 0xcb18, 0x080c, 0x6d64, 0x012e, 0x0070, 0xb097, 0x4005,
-	0xb19a, 0x0010, 0xb097, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
-	0x0030, 0x2a48, 0x00ae, 0x0005, 0xb097, 0x4000, 0x9006, 0x918d,
-	0x0001, 0x2008, 0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904, 0x359e,
-	0x080c, 0x4ab7, 0x0904, 0x35a1, 0x080c, 0x66e5, 0x0904, 0x359e,
-	0x080c, 0x6856, 0x0904, 0x359e, 0x0804, 0x4541, 0x81ff, 0x1904,
-	0x359e, 0x080c, 0x4ad3, 0x0904, 0x35a1, 0x080c, 0x68e4, 0x0904,
-	0x359e, 0x2019, 0x0005, 0x79a8, 0x080c, 0x6871, 0x0904, 0x359e,
-	0x7888, 0x908a, 0x1000, 0x1a04, 0x35a1, 0x8003, 0x800b, 0x810b,
-	0x9108, 0x080c, 0x861b, 0x7984, 0xd184, 0x1904, 0x356c, 0x0804,
-	0x4541, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0118, 0x2009, 0x0001,
-	0x0450, 0x2029, 0x07ff, 0x645c, 0x2400, 0x9506, 0x01f8, 0x2508,
-	0x080c, 0x661e, 0x11d8, 0x080c, 0x68e4, 0x1128, 0x2009, 0x0002,
-	0x62c0, 0x2518, 0x00c0, 0x2019, 0x0004, 0x900e, 0x080c, 0x6871,
-	0x1118, 0x2009, 0x0006, 0x0078, 0x7884, 0x908a, 0x1000, 0x1270,
-	0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x861b, 0x8529, 0x1ae0,
-	0x012e, 0x0804, 0x356c, 0x012e, 0x0804, 0x359e, 0x012e, 0x0804,
-	0x35a1, 0x080c, 0x4ab7, 0x0904, 0x35a1, 0x080c, 0x66e5, 0x0904,
-	0x359e, 0x080c, 0xa872, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066,
-	0x080c, 0x9374, 0x0076, 0x903e, 0x080c, 0x9246, 0x900e, 0x080c,
-	0xdfc0, 0x007e, 0x00ce, 0x080c, 0xa88e, 0x080c, 0x6850, 0x0804,
-	0x356c, 0x080c, 0x4ab7, 0x0904, 0x35a1, 0x080c, 0x6850, 0x2208,
-	0x0804, 0x356c, 0x0156, 0x00d6, 0x00e6, 0x00c6, 0x2069, 0x1910,
-	0x6810, 0x6914, 0x910a, 0x1208, 0x900e, 0x6816, 0x9016, 0x901e,
-	0x2071, 0x19e7, 0x7028, 0x9065, 0x0118, 0x8210, 0x600c, 0x0cd8,
-	0x2300, 0x9218, 0x00ce, 0x00ee, 0x00de, 0x015e, 0x0804, 0x356c,
-	0x00f6, 0x0016, 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff,
-	0x0110, 0x2178, 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1910,
-	0x6910, 0x62bc, 0x0804, 0x356c, 0x81ff, 0x0120, 0x2009, 0x0001,
-	0x0804, 0x359e, 0x0126, 0x2091, 0x8000, 0x080c, 0x56e7, 0x0128,
-	0x2009, 0x0007, 0x012e, 0x0804, 0x359e, 0x012e, 0x615c, 0x9190,
-	0x336d, 0x2215, 0x9294, 0x00ff, 0x637c, 0x83ff, 0x0108, 0x6280,
-	0x67dc, 0x97c4, 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001,
-	0x00e8, 0x97c4, 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003,
-	0x00a8, 0x97c4, 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002,
-	0x0068, 0x080c, 0x74d5, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c,
-	0x0120, 0x2009, 0x0005, 0x0804, 0x359e, 0x9036, 0x7e9a, 0x7f9e,
-	0x0804, 0x356c, 0x614c, 0x6250, 0x2019, 0x1986, 0x231c, 0x2001,
-	0x1987, 0x2004, 0x789a, 0x0804, 0x356c, 0x0126, 0x2091, 0x8000,
-	0x6138, 0x623c, 0x6340, 0x012e, 0x0804, 0x356c, 0x080c, 0x4ad3,
-	0x0904, 0x35a1, 0xba44, 0xbb38, 0x0804, 0x356c, 0x080c, 0x0d7d,
-	0x080c, 0x4ad3, 0x2110, 0x0904, 0x35a1, 0xb804, 0x908c, 0x00ff,
-	0x918e, 0x0006, 0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009,
-	0x0009, 0x1904, 0x359e, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005,
-	0x00c6, 0x9066, 0x080c, 0xa872, 0x080c, 0xa366, 0x080c, 0x9374,
-	0x0076, 0x903e, 0x080c, 0x9246, 0x900e, 0x080c, 0xdfc0, 0x007e,
-	0x00ce, 0x080c, 0xa88e, 0xb807, 0x0407, 0x012e, 0x0804, 0x356c,
-	0x614c, 0x6250, 0x7884, 0x604e, 0x7b88, 0x6352, 0x2069, 0x1847,
-	0x831f, 0x9305, 0x6816, 0x788c, 0x2069, 0x1986, 0x2d1c, 0x206a,
-	0x7e98, 0x9682, 0x0014, 0x1210, 0x2031, 0x07d0, 0x2069, 0x1987,
-	0x2d04, 0x266a, 0x789a, 0x0804, 0x356c, 0x0126, 0x2091, 0x8000,
-	0x6138, 0x7884, 0x603a, 0x910e, 0xd1b4, 0x190c, 0x0ecc, 0xd0c4,
-	0x01a8, 0x00d6, 0x78a8, 0x2009, 0x199d, 0x200a, 0x78ac, 0x2011,
-	0x199e, 0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118,
-	0x2214, 0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0x603e,
-	0x2011, 0x0116, 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0040,
-	0x0010, 0x918c, 0xff7f, 0x2112, 0x6140, 0x788c, 0x6042, 0x910e,
-	0xd1e4, 0x190c, 0x0ee7, 0x9084, 0x0020, 0x0130, 0x78b4, 0x6046,
-	0x9084, 0x0001, 0x090c, 0x423f, 0x6040, 0xd0cc, 0x0120, 0x78b0,
-	0x2011, 0x0114, 0x2012, 0x012e, 0x0804, 0x356c, 0x00f6, 0x2079,
-	0x1800, 0x7a38, 0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084,
-	0xfebf, 0x8002, 0x9214, 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a,
-	0xa897, 0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe,
-	0x0005, 0x7898, 0x9005, 0x01a8, 0x7888, 0x9025, 0x0904, 0x35a1,
-	0x788c, 0x902d, 0x0904, 0x35a1, 0x900e, 0x080c, 0x661e, 0x1120,
-	0xba44, 0xbb38, 0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108,
-	0x0ca0, 0x080c, 0x4ad3, 0x0904, 0x35a1, 0x7888, 0x900d, 0x0904,
-	0x35a1, 0x788c, 0x9005, 0x0904, 0x35a1, 0xba44, 0xb946, 0xbb38,
-	0xb83a, 0x0804, 0x356c, 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05,
-	0x080c, 0x56e7, 0x1904, 0x359e, 0x00c6, 0x2061, 0x0100, 0x7984,
-	0x9186, 0x00ff, 0x1130, 0x2001, 0x1818, 0x2004, 0x9085, 0xff00,
-	0x0088, 0x9182, 0x007f, 0x16e0, 0x9188, 0x336d, 0x210d, 0x918c,
-	0x00ff, 0x2001, 0x1818, 0x2004, 0x0026, 0x9116, 0x002e, 0x0580,
-	0x810f, 0x9105, 0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0xab73,
-	0x000e, 0x0510, 0x602e, 0x620a, 0x7984, 0x00b6, 0x080c, 0x65c3,
-	0x2b08, 0x00be, 0x1500, 0x6112, 0x6023, 0x0001, 0x080c, 0x4aa0,
-	0x01d0, 0x9006, 0xa866, 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd,
-	0xa86a, 0x701f, 0x3a4e, 0x2900, 0x6016, 0x2009, 0x0032, 0x080c,
-	0xac68, 0x012e, 0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804, 0x359e,
-	0x00ce, 0x0804, 0x35a1, 0x080c, 0xabc9, 0x0cb0, 0xa830, 0x9086,
-	0x0100, 0x0904, 0x359e, 0x0804, 0x356c, 0x2061, 0x1a6f, 0x0126,
-	0x2091, 0x8000, 0x6000, 0xd084, 0x0170, 0x6104, 0x6208, 0x2061,
-	0x1800, 0x6354, 0x6074, 0x789a, 0x60c0, 0x789e, 0x60bc, 0x78aa,
-	0x012e, 0x0804, 0x356c, 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904,
-	0x359e, 0x080c, 0x74d5, 0x0904, 0x359e, 0x0126, 0x2091, 0x8000,
-	0x6254, 0x6074, 0x9202, 0x0248, 0x9085, 0x0001, 0x080c, 0x2664,
-	0x080c, 0x5901, 0x012e, 0x0804, 0x356c, 0x012e, 0x0804, 0x35a1,
-	0x0006, 0x0016, 0x00c6, 0x00e6, 0x2001, 0x19a9, 0x2070, 0x2061,
-	0x1847, 0x6008, 0x2072, 0x900e, 0x2011, 0x1400, 0x080c, 0x9135,
-	0x7206, 0x00ee, 0x00ce, 0x001e, 0x000e, 0x0005, 0x0126, 0x2091,
-	0x8000, 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x356e,
-	0x7884, 0xd0fc, 0x0148, 0x2001, 0x002a, 0x2004, 0x9082, 0x00e1,
-	0x0288, 0x012e, 0x0804, 0x35a1, 0x2001, 0x002a, 0x2004, 0x2069,
-	0x1847, 0x6908, 0x9102, 0x1230, 0x012e, 0x0804, 0x35a1, 0x012e,
-	0x0804, 0x359e, 0x080c, 0xab33, 0x0dd0, 0x7884, 0xd0fc, 0x0904,
-	0x3b19, 0x00c6, 0x080c, 0x4aa0, 0x00ce, 0x0d88, 0xa867, 0x0000,
-	0x7884, 0xa80a, 0x7898, 0xa80e, 0x789c, 0xa812, 0x2001, 0x002e,
-	0x2004, 0xa81a, 0x2001, 0x002f, 0x2004, 0xa81e, 0x2001, 0x0030,
-	0x2004, 0xa822, 0x2001, 0x0031, 0x2004, 0xa826, 0x2001, 0x0034,
-	0x2004, 0xa82a, 0x2001, 0x0035, 0x2004, 0xa82e, 0x2001, 0x002a,
-	0x2004, 0x9080, 0x0003, 0x9084, 0x00fc, 0x8004, 0xa816, 0x080c,
-	0x3ca3, 0x0928, 0x7014, 0x2048, 0xad2c, 0xac28, 0xab1c, 0xaa18,
-	0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000,
-	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-	0x001b, 0x080c, 0x4ae9, 0x701f, 0x3be0, 0x7023, 0x0001, 0x012e,
-	0x0005, 0x080c, 0xa872, 0x0046, 0x0086, 0x0096, 0x00a6, 0x00b6,
-	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3a88, 0x2001, 0x199f,
-	0x2003, 0x0000, 0x2021, 0x000a, 0x2061, 0x0100, 0x6104, 0x0016,
-	0x60bb, 0x0000, 0x60bf, 0x32e1, 0x60bf, 0x0012, 0x080c, 0x3d12,
-	0x080c, 0x3cd1, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x19e7,
-	0x2079, 0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0140,
-	0x2001, 0x0035, 0x2004, 0x780e, 0x2001, 0x0034, 0x2004, 0x780a,
-	0x00de, 0x2011, 0x0001, 0x080c, 0x4083, 0x008e, 0x00ee, 0x00fe,
-	0x080c, 0x3fb0, 0x080c, 0x3edd, 0x05b8, 0x2001, 0x020b, 0x2004,
-	0x9084, 0x0140, 0x1db8, 0x080c, 0x40f7, 0x00f6, 0x2079, 0x0300,
-	0x78bc, 0x00fe, 0x908c, 0x0070, 0x1560, 0x2071, 0x0200, 0x7037,
-	0x0000, 0x7050, 0x9084, 0xff00, 0x9086, 0x3200, 0x1510, 0x7037,
-	0x0001, 0x7050, 0x9084, 0xff00, 0x9086, 0xe100, 0x11d0, 0x7037,
-	0x0000, 0x7054, 0x7037, 0x0000, 0x715c, 0x9106, 0x1190, 0x2001,
-	0x1820, 0x2004, 0x9106, 0x1168, 0x00c6, 0x2061, 0x0100, 0x6024,
-	0x9084, 0x1e00, 0x00ce, 0x0138, 0x080c, 0x3ee7, 0x080c, 0x3ccc,
-	0x0058, 0x080c, 0x3ccc, 0x080c, 0x401b, 0x080c, 0x3fa6, 0x2001,
-	0x020b, 0x2004, 0xd0e4, 0x0dd8, 0x2001, 0x032a, 0x2003, 0x0004,
-	0x2061, 0x0100, 0x6027, 0x0002, 0x001e, 0x6106, 0x2011, 0x020d,
-	0x2013, 0x0020, 0x60bb, 0x0000, 0x60bf, 0x0108, 0x60bf, 0x0012,
-	0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x1328,
-	0x2009, 0x0028, 0x080c, 0x21b0, 0x2001, 0x0227, 0x200c, 0x2102,
-	0x080c, 0xa88e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae,
-	0x009e, 0x008e, 0x004e, 0x2001, 0x199f, 0x2004, 0x9005, 0x1118,
-	0x012e, 0x0804, 0x356c, 0x012e, 0x2021, 0x400c, 0x0804, 0x356e,
-	0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096,
-	0x00d6, 0x0156, 0x7014, 0x2048, 0x7020, 0x20a8, 0x8000, 0x7022,
-	0xa804, 0x9005, 0x0904, 0x3c3c, 0x2048, 0x1f04, 0x3bf0, 0x7068,
-	0x2040, 0xa28c, 0xa390, 0xa494, 0xa598, 0xa930, 0xa808, 0xd0b4,
-	0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x0096, 0x7014, 0x2048,
-	0xa864, 0x009e, 0x9086, 0x0103, 0x0170, 0x8906, 0x8006, 0x8007,
-	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x080c, 0x4ae9,
-	0x701f, 0x3be0, 0x00b0, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
-	0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8,
-	0x20a0, 0x0006, 0x080c, 0x0fb7, 0x000e, 0x080c, 0x4aec, 0x701f,
-	0x3be0, 0x015e, 0x00de, 0x009e, 0x008e, 0x007e, 0x005e, 0x004e,
-	0x003e, 0x002e, 0x001e, 0x0005, 0x7014, 0x2048, 0xa864, 0x9086,
-	0x0103, 0x1118, 0x701f, 0x3ca1, 0x0450, 0x7014, 0x2048, 0xa868,
-	0xc0fd, 0xa86a, 0x2009, 0x007f, 0x080c, 0x65bd, 0x0110, 0x9006,
-	0x0030, 0xb813, 0x00ff, 0xb817, 0xfffd, 0x080c, 0xccf7, 0x015e,
-	0x00de, 0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e,
-	0x001e, 0x0904, 0x359e, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056,
-	0x0076, 0x0086, 0x0096, 0x00d6, 0x0156, 0x701f, 0x3c73, 0x7007,
-	0x0003, 0x0804, 0x3c31, 0xa830, 0x9086, 0x0100, 0x2021, 0x400c,
-	0x0904, 0x356e, 0x0076, 0xad10, 0xac0c, 0xab24, 0xaa20, 0xa930,
+	0x8000, 0x8000, 0x8000, 0x8000, 0x2071, 0x189e, 0x7003, 0x0002,
+	0x9006, 0x7016, 0x701a, 0x704a, 0x704e, 0x700e, 0x7042, 0x7046,
+	0x703b, 0x18ba, 0x703f, 0x18ba, 0x7007, 0x0001, 0x080c, 0x1053,
+	0x090c, 0x0d7d, 0x2900, 0x706a, 0xa867, 0x0002, 0xa8ab, 0xdcb0,
+	0x080c, 0x1053, 0x090c, 0x0d7d, 0x2900, 0x706e, 0xa867, 0x0002,
+	0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x189e, 0x7004, 0x0002, 0x34a3,
+	0x34a4, 0x34b7, 0x34cb, 0x0005, 0x1004, 0x34b4, 0x0e04, 0x34b4,
+	0x2079, 0x0000, 0x0126, 0x2091, 0x8000, 0x700c, 0x9005, 0x1128,
+	0x700f, 0x0001, 0x012e, 0x0468, 0x0005, 0x012e, 0x0ce8, 0x2079,
+	0x0000, 0x2061, 0x18b8, 0x2c4c, 0xa86c, 0x908e, 0x0100, 0x0128,
+	0x9086, 0x0200, 0x0904, 0x359f, 0x0005, 0x7018, 0x2048, 0x2061,
+	0x1800, 0x701c, 0x0807, 0x7014, 0x2048, 0xa864, 0x9094, 0x00ff,
+	0x9296, 0x0029, 0x1120, 0xaa78, 0xd2fc, 0x0128, 0x0005, 0x9086,
+	0x0103, 0x0108, 0x0005, 0x2079, 0x0000, 0x2061, 0x1800, 0x701c,
+	0x0807, 0x2061, 0x1800, 0x7880, 0x908a, 0x0040, 0x1210, 0x61d0,
+	0x0042, 0x2100, 0x908a, 0x003f, 0x1a04, 0x359c, 0x61d0, 0x0804,
+	0x3531, 0x3573, 0x35ab, 0x35b5, 0x35b9, 0x35c3, 0x35c9, 0x35cd,
+	0x35dd, 0x35e0, 0x35ea, 0x35ef, 0x35f4, 0x35ff, 0x360a, 0x3619,
+	0x3628, 0x3636, 0x364d, 0x3668, 0x359c, 0x3711, 0x374f, 0x37f4,
+	0x3805, 0x3828, 0x359c, 0x359c, 0x359c, 0x3860, 0x3880, 0x3889,
+	0x38b5, 0x38bb, 0x359c, 0x3901, 0x359c, 0x359c, 0x359c, 0x359c,
+	0x359c, 0x390c, 0x3915, 0x391d, 0x391f, 0x359c, 0x359c, 0x359c,
+	0x359c, 0x359c, 0x359c, 0x394f, 0x359c, 0x359c, 0x359c, 0x359c,
+	0x359c, 0x396c, 0x39d0, 0x359c, 0x359c, 0x359c, 0x359c, 0x359c,
+	0x359c, 0x0002, 0x39fa, 0x39fd, 0x3a5c, 0x3a75, 0x3aa5, 0x3d47,
+	0x359c, 0x52ab, 0x359c, 0x359c, 0x359c, 0x359c, 0x359c, 0x359c,
+	0x359c, 0x359c, 0x35ea, 0x35ef, 0x4246, 0x56fe, 0x4264, 0x533a,
+	0x538b, 0x548e, 0x359c, 0x54f0, 0x552c, 0x555d, 0x5669, 0x558a,
+	0x55e9, 0x359c, 0x4268, 0x441d, 0x4433, 0x4458, 0x44bd, 0x4531,
+	0x4551, 0x45c8, 0x4624, 0x4680, 0x4683, 0x46a8, 0x4718, 0x4782,
+	0x478a, 0x48bc, 0x4a31, 0x4a65, 0x4cc9, 0x359c, 0x4ce7, 0x4d93,
+	0x4e75, 0x4ecf, 0x359c, 0x4f84, 0x359c, 0x4fea, 0x5005, 0x478a,
+	0x524b, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c, 0x4ae3, 0x0126,
+	0x2091, 0x8000, 0x0e04, 0x357d, 0x0010, 0x012e, 0x0cc0, 0x7c36,
+	0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833, 0x0010,
+	0x7c82, 0x7986, 0x7a8a, 0x7b8e, 0x2091, 0x4080, 0x2001, 0x0089,
+	0x2004, 0xd084, 0x190c, 0x11d6, 0x7007, 0x0001, 0x2091, 0x5000,
+	0x700f, 0x0000, 0x012e, 0x0005, 0x2021, 0x4001, 0x08b0, 0x2021,
+	0x4002, 0x0898, 0x2021, 0x4003, 0x0880, 0x2021, 0x4005, 0x0868,
+	0x2021, 0x4006, 0x0850, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88,
+	0x7a8c, 0x7884, 0x7990, 0x0804, 0x4af0, 0x7883, 0x0004, 0x7884,
+	0x0807, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884,
+	0x7990, 0x0804, 0x4af3, 0x7984, 0x7888, 0x2114, 0x200a, 0x0804,
+	0x3573, 0x7984, 0x2114, 0x0804, 0x3573, 0x20e1, 0x0000, 0x2099,
+	0x0021, 0x20e9, 0x0000, 0x20a1, 0x0021, 0x20a9, 0x001f, 0x4003,
+	0x7984, 0x7a88, 0x7b8c, 0x0804, 0x3573, 0x7884, 0x2060, 0x04d8,
+	0x2009, 0x0003, 0x2011, 0x0002, 0x2019, 0x001c, 0x789b, 0x0137,
+	0x0804, 0x3573, 0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0800, 0x2039,
+	0x0001, 0x7d98, 0x7c9c, 0x0848, 0x79a0, 0x9182, 0x0040, 0x0210,
+	0x0804, 0x35a8, 0x2138, 0x7d98, 0x7c9c, 0x0804, 0x35af, 0x79a0,
+	0x9182, 0x0040, 0x0210, 0x0804, 0x35a8, 0x2138, 0x7d98, 0x7c9c,
+	0x0804, 0x35bd, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x35a8,
+	0x21e8, 0x7984, 0x7888, 0x20a9, 0x0001, 0x21a0, 0x4004, 0x0804,
+	0x3573, 0x2061, 0x0800, 0xe10c, 0x9006, 0x2c15, 0x9200, 0x8c60,
+	0x8109, 0x1dd8, 0x2010, 0x9005, 0x0904, 0x3573, 0x0804, 0x35a2,
+	0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x35a8, 0x21e0, 0x20a9,
+	0x0001, 0x7984, 0x2198, 0x4012, 0x0804, 0x3573, 0x2069, 0x1847,
+	0x7884, 0x7990, 0x911a, 0x1a04, 0x35a8, 0x8019, 0x0904, 0x35a8,
+	0x684a, 0x6942, 0x788c, 0x6852, 0x7888, 0x6856, 0x9006, 0x685a,
+	0x685e, 0x080c, 0x781e, 0x0804, 0x3573, 0x2069, 0x1847, 0x7884,
+	0x7994, 0x911a, 0x1a04, 0x35a8, 0x8019, 0x0904, 0x35a8, 0x684e,
+	0x6946, 0x788c, 0x6862, 0x7888, 0x6866, 0x9006, 0x686a, 0x686e,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x6ad5, 0x012e, 0x0804, 0x3573,
+	0x902e, 0x2520, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35a5,
+	0x7984, 0x7b88, 0x7a8c, 0x20a9, 0x0005, 0x20e9, 0x0001, 0x20a1,
+	0x18a6, 0x4101, 0x080c, 0x4aa7, 0x1120, 0x2009, 0x0002, 0x0804,
+	0x35a5, 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c,
+	0x4af0, 0x701f, 0x368c, 0x0005, 0xa864, 0x2008, 0x9084, 0x00ff,
+	0x9096, 0x0011, 0x0168, 0x9096, 0x0019, 0x0150, 0x9096, 0x0015,
+	0x0138, 0x9096, 0x0048, 0x0120, 0x9096, 0x0029, 0x1904, 0x35a5,
+	0x810f, 0x918c, 0x00ff, 0x0904, 0x35a5, 0x7112, 0x7010, 0x8001,
+	0x0560, 0x7012, 0x080c, 0x4aa7, 0x1120, 0x2009, 0x0002, 0x0804,
+	0x35a5, 0x2009, 0x0020, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494,
+	0xa598, 0x9290, 0x0040, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9,
+	0x0000, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4af0, 0x701f,
+	0x36ca, 0x0005, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0002, 0x0120,
+	0x9096, 0x000a, 0x1904, 0x35a5, 0x0888, 0x7014, 0x2048, 0xa868,
+	0xc0fd, 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0029, 0x1160,
+	0xc2fd, 0xaa7a, 0x080c, 0x6196, 0x0150, 0x0126, 0x2091, 0x8000,
+	0xa87a, 0xa982, 0x012e, 0x0050, 0x080c, 0x64bf, 0x1128, 0x7007,
+	0x0003, 0x701f, 0x36f6, 0x0005, 0x080c, 0x6fc0, 0x0126, 0x2091,
+	0x8000, 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x18a6, 0x400a,
+	0x2100, 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000,
+	0xa85c, 0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60, 0x0804,
+	0x4af3, 0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010, 0x7883,
+	0x4000, 0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020, 0x2009,
+	0x017f, 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100, 0x6200,
+	0x2061, 0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009, 0x04fd,
+	0x2104, 0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001, 0x0089,
+	0x2004, 0xd084, 0x0180, 0x2001, 0x1a22, 0x2004, 0x9005, 0x0128,
+	0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003,
+	0x0002, 0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427, 0x81ff,
+	0x1904, 0x35a5, 0x7984, 0x080c, 0x6625, 0x1904, 0x35a8, 0x7e98,
+	0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x35a8, 0x7c88, 0x7d8c,
+	0x080c, 0x6857, 0x080c, 0x67e8, 0x1518, 0x2061, 0x1ddc, 0x0126,
+	0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d,
+	0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0150, 0x012e,
+	0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a04, 0x35a5,
+	0x0c30, 0x080c, 0xc443, 0x012e, 0x0904, 0x35a5, 0x0804, 0x3573,
+	0x900e, 0x2001, 0x0005, 0x080c, 0x6fc0, 0x0126, 0x2091, 0x8000,
+	0x080c, 0xcb3c, 0x080c, 0x6d80, 0x012e, 0x0804, 0x3573, 0x00a6,
+	0x2950, 0xb198, 0x080c, 0x6625, 0x1904, 0x37e1, 0xb6a4, 0x9684,
+	0x3fff, 0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0, 0x080c, 0x6857,
+	0x080c, 0x6802, 0x1520, 0x2061, 0x1ddc, 0x0126, 0x2091, 0x8000,
+	0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130, 0xa86c,
+	0x9406, 0x1118, 0xa870, 0x9506, 0x0158, 0x012e, 0x9ce0, 0x001c,
+	0x2001, 0x181a, 0x2004, 0x9c02, 0x2009, 0x000d, 0x12b0, 0x0c28,
+	0x080c, 0xc443, 0x012e, 0x2009, 0x0003, 0x0178, 0x00e0, 0x900e,
+	0x2001, 0x0005, 0x080c, 0x6fc0, 0x0126, 0x2091, 0x8000, 0x080c,
+	0xcb3c, 0x080c, 0x6d74, 0x012e, 0x0070, 0xb097, 0x4005, 0xb19a,
+	0x0010, 0xb097, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
+	0x2a48, 0x00ae, 0x0005, 0xb097, 0x4000, 0x9006, 0x918d, 0x0001,
+	0x2008, 0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904, 0x35a5, 0x080c,
+	0x4abe, 0x0904, 0x35a8, 0x080c, 0x66ec, 0x0904, 0x35a5, 0x080c,
+	0x685d, 0x0904, 0x35a5, 0x0804, 0x4548, 0x81ff, 0x1904, 0x35a5,
+	0x080c, 0x4ada, 0x0904, 0x35a8, 0x080c, 0x68eb, 0x0904, 0x35a5,
+	0x2019, 0x0005, 0x79a8, 0x080c, 0x6878, 0x0904, 0x35a5, 0x7888,
+	0x908a, 0x1000, 0x1a04, 0x35a8, 0x8003, 0x800b, 0x810b, 0x9108,
+	0x080c, 0x864c, 0x7984, 0xd184, 0x1904, 0x3573, 0x0804, 0x4548,
+	0x0126, 0x2091, 0x8000, 0x81ff, 0x0118, 0x2009, 0x0001, 0x0450,
+	0x2029, 0x07ff, 0x645c, 0x2400, 0x9506, 0x01f8, 0x2508, 0x080c,
+	0x6625, 0x11d8, 0x080c, 0x68eb, 0x1128, 0x2009, 0x0002, 0x62c0,
+	0x2518, 0x00c0, 0x2019, 0x0004, 0x900e, 0x080c, 0x6878, 0x1118,
+	0x2009, 0x0006, 0x0078, 0x7884, 0x908a, 0x1000, 0x1270, 0x8003,
+	0x800b, 0x810b, 0x9108, 0x080c, 0x864c, 0x8529, 0x1ae0, 0x012e,
+	0x0804, 0x3573, 0x012e, 0x0804, 0x35a5, 0x012e, 0x0804, 0x35a8,
+	0x080c, 0x4abe, 0x0904, 0x35a8, 0x080c, 0x66ec, 0x0904, 0x35a5,
+	0x080c, 0xa896, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c,
+	0x93a5, 0x0076, 0x903e, 0x080c, 0x9277, 0x900e, 0x080c, 0xdfeb,
+	0x007e, 0x00ce, 0x080c, 0xa8b2, 0x080c, 0x6857, 0x0804, 0x3573,
+	0x080c, 0x4abe, 0x0904, 0x35a8, 0x080c, 0x6857, 0x2208, 0x0804,
+	0x3573, 0x0156, 0x00d6, 0x00e6, 0x00c6, 0x2069, 0x1910, 0x6810,
+	0x6914, 0x910a, 0x1208, 0x900e, 0x6816, 0x9016, 0x901e, 0x2071,
+	0x19e7, 0x7028, 0x9065, 0x0118, 0x8210, 0x600c, 0x0cd8, 0x2300,
+	0x9218, 0x00ce, 0x00ee, 0x00de, 0x015e, 0x0804, 0x3573, 0x00f6,
+	0x0016, 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff, 0x0110,
+	0x2178, 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1910, 0x6910,
+	0x62bc, 0x0804, 0x3573, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
+	0x35a5, 0x0126, 0x2091, 0x8000, 0x080c, 0x56ee, 0x0128, 0x2009,
+	0x0007, 0x012e, 0x0804, 0x35a5, 0x012e, 0x615c, 0x9190, 0x3374,
+	0x2215, 0x9294, 0x00ff, 0x637c, 0x83ff, 0x0108, 0x6280, 0x67dc,
+	0x97c4, 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001, 0x00e8,
+	0x97c4, 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003, 0x00a8,
+	0x97c4, 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002, 0x0068,
+	0x080c, 0x74e9, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c, 0x0120,
+	0x2009, 0x0005, 0x0804, 0x35a5, 0x9036, 0x7e9a, 0x7f9e, 0x0804,
+	0x3573, 0x614c, 0x6250, 0x2019, 0x1986, 0x231c, 0x2001, 0x1987,
+	0x2004, 0x789a, 0x0804, 0x3573, 0x0126, 0x2091, 0x8000, 0x6138,
+	0x623c, 0x6340, 0x012e, 0x0804, 0x3573, 0x080c, 0x4ada, 0x0904,
+	0x35a8, 0xba44, 0xbb38, 0x0804, 0x3573, 0x080c, 0x0d7d, 0x080c,
+	0x4ada, 0x2110, 0x0904, 0x35a8, 0xb804, 0x908c, 0x00ff, 0x918e,
+	0x0006, 0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009, 0x0009,
+	0x1904, 0x35a5, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005, 0x00c6,
+	0x9066, 0x080c, 0xa896, 0x080c, 0xa38a, 0x080c, 0x93a5, 0x0076,
+	0x903e, 0x080c, 0x9277, 0x900e, 0x080c, 0xdfeb, 0x007e, 0x00ce,
+	0x080c, 0xa8b2, 0xb807, 0x0407, 0x012e, 0x0804, 0x3573, 0x614c,
+	0x6250, 0x7884, 0x604e, 0x7b88, 0x6352, 0x2069, 0x1847, 0x831f,
+	0x9305, 0x6816, 0x788c, 0x2069, 0x1986, 0x2d1c, 0x206a, 0x7e98,
+	0x9682, 0x0014, 0x1210, 0x2031, 0x07d0, 0x2069, 0x1987, 0x2d04,
+	0x266a, 0x789a, 0x0804, 0x3573, 0x0126, 0x2091, 0x8000, 0x6138,
+	0x7884, 0x603a, 0x910e, 0xd1b4, 0x190c, 0x0ecc, 0xd0c4, 0x01a8,
+	0x00d6, 0x78a8, 0x2009, 0x199d, 0x200a, 0x78ac, 0x2011, 0x199e,
+	0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118, 0x2214,
+	0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0x603e, 0x2011,
+	0x0116, 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0040, 0x0010,
+	0x918c, 0xff7f, 0x2112, 0x6140, 0x788c, 0x6042, 0x910e, 0xd1e4,
+	0x190c, 0x0ee7, 0x9084, 0x0020, 0x0130, 0x78b4, 0x6046, 0x9084,
+	0x0001, 0x090c, 0x4246, 0x6040, 0xd0cc, 0x0120, 0x78b0, 0x2011,
+	0x0114, 0x2012, 0x012e, 0x0804, 0x3573, 0x00f6, 0x2079, 0x1800,
+	0x7a38, 0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084, 0xfebf,
+	0x8002, 0x9214, 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a, 0xa897,
+	0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe, 0x0005,
+	0x7898, 0x9005, 0x01a8, 0x7888, 0x9025, 0x0904, 0x35a8, 0x788c,
+	0x902d, 0x0904, 0x35a8, 0x900e, 0x080c, 0x6625, 0x1120, 0xba44,
+	0xbb38, 0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108, 0x0ca0,
+	0x080c, 0x4ada, 0x0904, 0x35a8, 0x7888, 0x900d, 0x0904, 0x35a8,
+	0x788c, 0x9005, 0x0904, 0x35a8, 0xba44, 0xb946, 0xbb38, 0xb83a,
+	0x0804, 0x3573, 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05, 0x080c,
+	0x56ee, 0x1904, 0x35a5, 0x00c6, 0x2061, 0x0100, 0x7984, 0x9186,
+	0x00ff, 0x1130, 0x2001, 0x1818, 0x2004, 0x9085, 0xff00, 0x0088,
+	0x9182, 0x007f, 0x16e0, 0x9188, 0x3374, 0x210d, 0x918c, 0x00ff,
+	0x2001, 0x1818, 0x2004, 0x0026, 0x9116, 0x002e, 0x0580, 0x810f,
+	0x9105, 0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0xab97, 0x000e,
+	0x0510, 0x602e, 0x620a, 0x7984, 0x00b6, 0x080c, 0x65ca, 0x2b08,
+	0x00be, 0x1500, 0x6112, 0x6023, 0x0001, 0x080c, 0x4aa7, 0x01d0,
+	0x9006, 0xa866, 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd, 0xa86a,
+	0x701f, 0x3a55, 0x2900, 0x6016, 0x2009, 0x0032, 0x080c, 0xac8c,
+	0x012e, 0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804, 0x35a5, 0x00ce,
+	0x0804, 0x35a8, 0x080c, 0xabed, 0x0cb0, 0xa830, 0x9086, 0x0100,
+	0x0904, 0x35a5, 0x0804, 0x3573, 0x2061, 0x1a6f, 0x0126, 0x2091,
+	0x8000, 0x6000, 0xd084, 0x0170, 0x6104, 0x6208, 0x2061, 0x1800,
+	0x6354, 0x6074, 0x789a, 0x60c0, 0x789e, 0x60bc, 0x78aa, 0x012e,
+	0x0804, 0x3573, 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904, 0x35a5,
+	0x080c, 0x74e9, 0x0904, 0x35a5, 0x0126, 0x2091, 0x8000, 0x6254,
+	0x6074, 0x9202, 0x0248, 0x9085, 0x0001, 0x080c, 0x2664, 0x080c,
+	0x5908, 0x012e, 0x0804, 0x3573, 0x012e, 0x0804, 0x35a8, 0x0006,
+	0x0016, 0x00c6, 0x00e6, 0x2001, 0x19a9, 0x2070, 0x2061, 0x1847,
+	0x6008, 0x2072, 0x900e, 0x2011, 0x1400, 0x080c, 0x9166, 0x7206,
+	0x00ee, 0x00ce, 0x001e, 0x000e, 0x0005, 0x0126, 0x2091, 0x8000,
+	0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x3575, 0x7884,
+	0xd0fc, 0x0148, 0x2001, 0x002a, 0x2004, 0x9082, 0x00e1, 0x0288,
+	0x012e, 0x0804, 0x35a8, 0x2001, 0x002a, 0x2004, 0x2069, 0x1847,
+	0x6908, 0x9102, 0x1230, 0x012e, 0x0804, 0x35a8, 0x012e, 0x0804,
+	0x35a5, 0x080c, 0xab57, 0x0dd0, 0x7884, 0xd0fc, 0x0904, 0x3b20,
+	0x00c6, 0x080c, 0x4aa7, 0x00ce, 0x0d88, 0xa867, 0x0000, 0x7884,
+	0xa80a, 0x7898, 0xa80e, 0x789c, 0xa812, 0x2001, 0x002e, 0x2004,
+	0xa81a, 0x2001, 0x002f, 0x2004, 0xa81e, 0x2001, 0x0030, 0x2004,
+	0xa822, 0x2001, 0x0031, 0x2004, 0xa826, 0x2001, 0x0034, 0x2004,
+	0xa82a, 0x2001, 0x0035, 0x2004, 0xa82e, 0x2001, 0x002a, 0x2004,
+	0x9080, 0x0003, 0x9084, 0x00fc, 0x8004, 0xa816, 0x080c, 0x3caa,
+	0x0928, 0x7014, 0x2048, 0xad2c, 0xac28, 0xab1c, 0xaa18, 0xa930,
 	0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x8906,
 	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b,
-	0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0fb7,
-	0x000e, 0x080c, 0x4aec, 0x007e, 0x701f, 0x3be0, 0x7023, 0x0001,
-	0x0005, 0x0804, 0x356c, 0x0156, 0x00c6, 0xa814, 0x908a, 0x001e,
-	0x0218, 0xa833, 0x001e, 0x0010, 0xa832, 0x0078, 0x81ff, 0x0168,
-	0x0016, 0x080c, 0x4aa0, 0x001e, 0x0130, 0xa800, 0x2040, 0xa008,
-	0xa80a, 0x2100, 0x0c58, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce,
-	0x015e, 0x0005, 0x0006, 0x00f6, 0x2079, 0x0000, 0x7880, 0x9086,
-	0x0044, 0x00fe, 0x000e, 0x0005, 0x2001, 0x199f, 0x2003, 0x0001,
-	0x0005, 0x00f6, 0x00e6, 0x00c6, 0x2061, 0x0200, 0x2001, 0x19aa,
-	0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x19a9, 0x2004, 0x60ce,
-	0x6104, 0xc1ac, 0x6106, 0x080c, 0x4aa0, 0xa813, 0x0019, 0xa817,
-	0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001,
-	0x002f, 0x2004, 0xa86a, 0x2061, 0x0090, 0x2079, 0x0100, 0x2001,
-	0x19a9, 0x2004, 0x6036, 0x2009, 0x0040, 0x080c, 0x21b0, 0x2001,
-	0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0x601a, 0xa873, 0x0000,
-	0x601f, 0x0000, 0x78ca, 0x9006, 0x600a, 0x600e, 0x00ce, 0x00ee,
-	0x00fe, 0x0005, 0x00e6, 0x080c, 0x4aa0, 0x2940, 0xa013, 0x0019,
-	0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa866,
-	0x2001, 0x0031, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084,
-	0xfff8, 0xa86e, 0xa873, 0x0000, 0x2001, 0x032a, 0x2003, 0x0004,
-	0x2001, 0x0300, 0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000,
-	0x2001, 0x0004, 0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005,
-	0x0126, 0x2091, 0x8000, 0x81ff, 0x0148, 0x080c, 0x29e8, 0x1130,
-	0x9006, 0x080c, 0x2945, 0x9006, 0x080c, 0x2928, 0x7884, 0x9084,
-	0x0007, 0x0002, 0x3d5d, 0x3d66, 0x3d6f, 0x3d5a, 0x3d5a, 0x3d5a,
-	0x3d5a, 0x3d5a, 0x012e, 0x0804, 0x35a1, 0x2009, 0x0114, 0x2104,
-	0x9085, 0x0800, 0x200a, 0x080c, 0x3f31, 0x00c0, 0x2009, 0x0114,
-	0x2104, 0x9085, 0x4000, 0x200a, 0x080c, 0x3f31, 0x0078, 0x080c,
-	0x74d5, 0x1128, 0x012e, 0x2009, 0x0016, 0x0804, 0x359e, 0x81ff,
-	0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x356e, 0x080c, 0xa872,
-	0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
-	0x080c, 0x3a88, 0x2009, 0x0101, 0x210c, 0x0016, 0x7ec8, 0x7dcc,
-	0x9006, 0x2068, 0x2060, 0x2058, 0x080c, 0x41d2, 0x080c, 0x4122,
-	0x903e, 0x2720, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x19e7,
-	0x2079, 0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120,
-	0x68d4, 0x780e, 0x68d0, 0x780a, 0x00de, 0x2011, 0x0001, 0x080c,
-	0x4083, 0x080c, 0x29f0, 0x080c, 0x29f0, 0x080c, 0x29f0, 0x080c,
-	0x29f0, 0x080c, 0x4083, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x3fb0,
-	0x2009, 0x9c40, 0x8109, 0x11b0, 0x080c, 0x3ee7, 0x2001, 0x0004,
-	0x200c, 0x918c, 0xfffd, 0x2102, 0x001e, 0x00fe, 0x00ee, 0x00de,
-	0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x2009, 0x0017, 0x080c,
-	0x359e, 0x0cf8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1d10,
-	0x00f6, 0x2079, 0x0000, 0x7884, 0x00fe, 0xd0bc, 0x0178, 0x2001,
-	0x0201, 0x200c, 0x81ff, 0x0150, 0x080c, 0x3f8e, 0x2d00, 0x9c05,
-	0x9b05, 0x0120, 0x080c, 0x3ee7, 0x0804, 0x3e90, 0x080c, 0x40f7,
-	0x080c, 0x401b, 0x080c, 0x3f71, 0x080c, 0x3fa6, 0x00f6, 0x2079,
-	0x0100, 0x7824, 0xd0ac, 0x0130, 0x8b58, 0x080c, 0x3ee7, 0x00fe,
-	0x0804, 0x3e90, 0x00fe, 0x080c, 0x3edd, 0x1150, 0x8d68, 0x2001,
-	0x0032, 0x2602, 0x2001, 0x0033, 0x2502, 0x080c, 0x3ee7, 0x0080,
-	0x87ff, 0x0138, 0x2001, 0x0201, 0x2004, 0x9005, 0x1908, 0x8739,
-	0x0038, 0x2001, 0x1a6b, 0x2004, 0x9086, 0x0000, 0x1904, 0x3de0,
-	0x2001, 0x032f, 0x2003, 0x00f6, 0x8631, 0x1208, 0x8529, 0x2500,
-	0x9605, 0x0904, 0x3e90, 0x7884, 0xd0bc, 0x0128, 0x2d00, 0x9c05,
-	0x9b05, 0x1904, 0x3e90, 0xa013, 0x0019, 0x2001, 0x032a, 0x2003,
-	0x0004, 0x7884, 0xd0ac, 0x1148, 0x2001, 0x1a6b, 0x2003, 0x0003,
-	0x2001, 0x032a, 0x2003, 0x0009, 0x0030, 0xa017, 0x0001, 0x78b4,
-	0x9005, 0x0108, 0xa016, 0x2800, 0xa05a, 0x2009, 0x0040, 0x080c,
-	0x21b0, 0x2900, 0xa85a, 0xa813, 0x0019, 0x7884, 0xd0a4, 0x1180,
-	0xa817, 0x0000, 0x00c6, 0x20a9, 0x0004, 0x2061, 0x0090, 0x602b,
-	0x0008, 0x2001, 0x0203, 0x2004, 0x1f04, 0x3e67, 0x00ce, 0x0030,
-	0xa817, 0x0001, 0x78b0, 0x9005, 0x0108, 0xa816, 0x00f6, 0x00c6,
-	0x2079, 0x0100, 0x2061, 0x0090, 0x7827, 0x0002, 0x2001, 0x002a,
-	0x2004, 0x9084, 0xfff8, 0x601a, 0x0006, 0x2001, 0x002b, 0x2004,
-	0x601e, 0x78c6, 0x000e, 0x78ca, 0x00ce, 0x00fe, 0x0804, 0x3d9a,
-	0x001e, 0x00c6, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100,
-	0x6027, 0x0002, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x2001,
-	0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x1328, 0x7884,
-	0x9084, 0x0003, 0x9086, 0x0002, 0x01b0, 0x2009, 0x0028, 0x080c,
-	0x21b0, 0x2001, 0x0227, 0x200c, 0x2102, 0x6050, 0x9084, 0xb7ff,
-	0x080c, 0x2aab, 0x6052, 0x602f, 0x0000, 0x604b, 0xf7f7, 0x6043,
-	0x0090, 0x6043, 0x0010, 0x080c, 0xa88e, 0x00ce, 0x2d08, 0x2c10,
-	0x2b18, 0x2b00, 0x9c05, 0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-	0x00be, 0x00ae, 0x009e, 0x008e, 0x1118, 0x012e, 0x0804, 0x356c,
-	0x012e, 0x2021, 0x400c, 0x0804, 0x356e, 0x9085, 0x0001, 0x1d04,
-	0x3ee6, 0x2091, 0x6000, 0x8420, 0x9486, 0x0064, 0x0005, 0x2001,
-	0x0105, 0x2003, 0x0010, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001,
-	0x1a6b, 0x2003, 0x0000, 0x0071, 0x2009, 0x0048, 0x080c, 0x21b0,
-	0x2001, 0x0227, 0x2024, 0x2402, 0x2001, 0x0109, 0x2003, 0x4000,
-	0x9026, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x19e7, 0x7054, 0x9086,
-	0x0000, 0x0520, 0x2079, 0x0090, 0x2009, 0x0206, 0x2104, 0x2009,
-	0x0203, 0x210c, 0x9106, 0x1120, 0x2009, 0x0040, 0x080c, 0x21b0,
-	0x782c, 0xd0fc, 0x0d88, 0x080c, 0x40f7, 0x7054, 0x9086, 0x0000,
-	0x1d58, 0x782b, 0x0004, 0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040,
-	0x080c, 0x21b0, 0x782b, 0x0002, 0x7057, 0x0000, 0x00ee, 0x00fe,
-	0x0005, 0x00f6, 0x2079, 0x0100, 0x2001, 0x1818, 0x200c, 0x7932,
-	0x7936, 0x080c, 0x2644, 0x080c, 0x2a67, 0x080c, 0x2aab, 0x784b,
-	0xf7f7, 0x7843, 0x0090, 0x7843, 0x0010, 0x7850, 0xc0e5, 0x7852,
-	0x2019, 0x61a8, 0x7820, 0xd09c, 0x0110, 0x8319, 0x1dd8, 0x7850,
-	0xc0e4, 0x7852, 0x2011, 0x0048, 0x080c, 0x2a44, 0x7843, 0x0040,
-	0x2019, 0x01f4, 0xa001, 0xa001, 0x8319, 0x1de0, 0x2001, 0x0100,
-	0x080c, 0x2a0a, 0x2011, 0x0020, 0x080c, 0x2a44, 0x7843, 0x0000,
-	0x9006, 0x080c, 0x2a0a, 0x2011, 0x0048, 0x080c, 0x2a44, 0x00fe,
-	0x0005, 0x7884, 0xd0ac, 0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a6b,
-	0x2079, 0x0320, 0x2001, 0x0201, 0x2004, 0x9005, 0x0160, 0x7000,
-	0x9086, 0x0000, 0x1140, 0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003,
-	0x0003, 0x782b, 0x0019, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079,
-	0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070, 0x0178, 0x2009, 0x0032,
-	0x260a, 0x2009, 0x0033, 0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac,
-	0x0108, 0x8d68, 0xd0a4, 0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079,
-	0x0200, 0x781c, 0xd084, 0x0110, 0x7837, 0x0050, 0x00fe, 0x0005,
-	0x00e6, 0x2071, 0x0100, 0x2001, 0x19aa, 0x2004, 0x70e2, 0x080c,
-	0x3cc2, 0x1188, 0x2001, 0x1820, 0x2004, 0x2009, 0x181f, 0x210c,
-	0x918c, 0x00ff, 0x706e, 0x716a, 0x7066, 0x918d, 0x3200, 0x7162,
-	0x7073, 0xe109, 0x0080, 0x702c, 0x9085, 0x0002, 0x702e, 0x2009,
-	0x1818, 0x210c, 0x716e, 0x7063, 0x0100, 0x7166, 0x719e, 0x706b,
-	0x0000, 0x7073, 0x0809, 0x7077, 0x0008, 0x7078, 0x9080, 0x0100,
-	0x707a, 0x7080, 0x8000, 0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a,
-	0x708e, 0x707e, 0x70d6, 0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014,
-	0x9084, 0x1984, 0x9085, 0x0092, 0x7016, 0x080c, 0x40f7, 0x00f6,
-	0x2071, 0x1a6b, 0x2079, 0x0320, 0x00d6, 0x2069, 0x0000, 0x6884,
-	0xd0b4, 0x0120, 0x689c, 0x780e, 0x6898, 0x780a, 0x00de, 0x2009,
-	0x03e8, 0x8109, 0x1df0, 0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004,
-	0x2011, 0x0011, 0x080c, 0x4083, 0x2011, 0x0001, 0x080c, 0x4083,
-	0x00fe, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a6b, 0x2079,
-	0x0320, 0x792c, 0xd1fc, 0x0904, 0x4080, 0x782b, 0x0002, 0x9026,
-	0xd19c, 0x1904, 0x407c, 0x7000, 0x0002, 0x4080, 0x4031, 0x4061,
-	0x407c, 0xd1bc, 0x1170, 0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011,
-	0x0001, 0x080c, 0x4083, 0x0904, 0x4080, 0x080c, 0x4083, 0x0804,
-	0x4080, 0x00f6, 0x2079, 0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810,
-	0x7914, 0x782b, 0x0004, 0x7812, 0x7916, 0x2001, 0x0201, 0x200c,
-	0x81ff, 0x0de8, 0x080c, 0x3f8e, 0x2009, 0x0001, 0x00f6, 0x2079,
-	0x0300, 0x78b8, 0x00fe, 0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a,
-	0x00f8, 0x8001, 0x7002, 0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc,
-	0x1904, 0x4025, 0x2011, 0x0001, 0x00b1, 0x0090, 0xa010, 0x9092,
-	0x0004, 0x9086, 0x0015, 0x1120, 0xa000, 0xa05a, 0x2011, 0x0031,
-	0xa212, 0xd1dc, 0x1960, 0x0828, 0x782b, 0x0004, 0x7003, 0x0000,
-	0x00ee, 0x00fe, 0x0005, 0xa014, 0x9005, 0x0550, 0x8001, 0x0036,
-	0x0096, 0xa016, 0xa058, 0x2048, 0xa010, 0x2009, 0x0031, 0x911a,
-	0x831c, 0x831c, 0x938a, 0x0007, 0x1a0c, 0x0d7d, 0x9398, 0x40b1,
-	0x231d, 0x083f, 0x9080, 0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102,
-	0x009e, 0x003e, 0x908a, 0x0035, 0x1140, 0x0096, 0xa058, 0x2048,
-	0xa804, 0xa05a, 0x2001, 0x0019, 0x009e, 0xa012, 0x9085, 0x0001,
-	0x0005, 0x40ee, 0x40e5, 0x40dc, 0x40d3, 0x40ca, 0x40c1, 0x40b8,
-	0xa964, 0x7902, 0xa968, 0x7906, 0xa96c, 0x7912, 0xa970, 0x7916,
-	0x0005, 0xa974, 0x7902, 0xa978, 0x7906, 0xa97c, 0x7912, 0xa980,
-	0x7916, 0x0005, 0xa984, 0x7902, 0xa988, 0x7906, 0xa98c, 0x7912,
-	0xa990, 0x7916, 0x0005, 0xa994, 0x7902, 0xa998, 0x7906, 0xa99c,
-	0x7912, 0xa9a0, 0x7916, 0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906,
-	0xa9ac, 0x7912, 0xa9b0, 0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8,
-	0x7906, 0xa9bc, 0x7912, 0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902,
-	0xa9c8, 0x7906, 0xa9cc, 0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6,
-	0x00e6, 0x0086, 0x2071, 0x19e7, 0x2079, 0x0090, 0x792c, 0xd1fc,
-	0x01e8, 0x782b, 0x0002, 0x2940, 0x9026, 0x7054, 0x0002, 0x411e,
-	0x410a, 0x4115, 0x8001, 0x7056, 0xd19c, 0x1180, 0x2011, 0x0001,
-	0x080c, 0x4083, 0x190c, 0x4083, 0x0048, 0x8001, 0x7056, 0x782c,
-	0xd0fc, 0x1d38, 0x2011, 0x0001, 0x080c, 0x4083, 0x008e, 0x00ee,
-	0x00fe, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200,
-	0x2001, 0x19aa, 0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x19a9,
-	0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004,
-	0x9005, 0x0520, 0x2038, 0x2001, 0x002e, 0x2024, 0x2001, 0x002f,
-	0x201c, 0x080c, 0x4aa0, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a,
-	0x978a, 0x0007, 0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708,
-	0x903e, 0x0096, 0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e,
-	0x080c, 0x419a, 0x1d68, 0x2900, 0xa85a, 0x00d0, 0x080c, 0x4aa0,
-	0xa813, 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e,
-	0x2004, 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2001, 0x002a,
-	0x2004, 0x9084, 0xfff8, 0xa86e, 0x2001, 0x002b, 0x2004, 0xa872,
-	0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x19a9, 0x2004, 0x6036,
-	0x2009, 0x0040, 0x080c, 0x21b0, 0x2001, 0x002a, 0x2004, 0x9084,
-	0xfff8, 0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6,
-	0x000e, 0x78ca, 0x9006, 0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee,
-	0x00fe, 0x0005, 0x00e6, 0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0,
-	0x20e1, 0x0000, 0x2099, 0x0088, 0x702b, 0x0026, 0x7402, 0x7306,
-	0x9006, 0x700a, 0x700e, 0x810b, 0x810b, 0x21a8, 0x810b, 0x7112,
-	0x702b, 0x0041, 0x702c, 0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b,
-	0x0040, 0x4005, 0x7400, 0x7304, 0x87ff, 0x0190, 0x0086, 0x0096,
-	0x2940, 0x0086, 0x080c, 0x4aa0, 0x008e, 0xa058, 0x00a6, 0x2050,
-	0x2900, 0xb006, 0xa05a, 0x00ae, 0x009e, 0x008e, 0x9085, 0x0001,
-	0x00ee, 0x0005, 0x00e6, 0x2001, 0x002d, 0x2004, 0x9005, 0x0528,
-	0x2038, 0x2001, 0x0030, 0x2024, 0x2001, 0x0031, 0x201c, 0x080c,
-	0x4aa0, 0x2940, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a,
-	0x0007, 0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e,
-	0x0096, 0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c,
-	0x419a, 0x1d68, 0x2900, 0xa85a, 0x00d8, 0x080c, 0x4aa0, 0x2940,
-	0xa013, 0x0019, 0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030,
-	0x2004, 0xa066, 0x2001, 0x0031, 0x2004, 0xa06a, 0x2001, 0x002a,
-	0x2004, 0x9084, 0xfff8, 0xa06e, 0x2001, 0x002b, 0x2004, 0xa072,
-	0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001,
-	0x0101, 0x200c, 0x918d, 0x0200, 0x2102, 0xa017, 0x0000, 0x2001,
-	0x1a6b, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x2001,
+	0x080c, 0x4af0, 0x701f, 0x3be7, 0x7023, 0x0001, 0x012e, 0x0005,
+	0x080c, 0xa896, 0x0046, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6,
+	0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3a8f, 0x2001, 0x199f, 0x2003,
+	0x0000, 0x2021, 0x000a, 0x2061, 0x0100, 0x6104, 0x0016, 0x60bb,
+	0x0000, 0x60bf, 0x32e1, 0x60bf, 0x0012, 0x080c, 0x3d19, 0x080c,
+	0x3cd8, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x19e7, 0x2079,
+	0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0140, 0x2001,
+	0x0035, 0x2004, 0x780e, 0x2001, 0x0034, 0x2004, 0x780a, 0x00de,
+	0x2011, 0x0001, 0x080c, 0x408a, 0x008e, 0x00ee, 0x00fe, 0x080c,
+	0x3fb7, 0x080c, 0x3ee4, 0x05b8, 0x2001, 0x020b, 0x2004, 0x9084,
+	0x0140, 0x1db8, 0x080c, 0x40fe, 0x00f6, 0x2079, 0x0300, 0x78bc,
+	0x00fe, 0x908c, 0x0070, 0x1560, 0x2071, 0x0200, 0x7037, 0x0000,
+	0x7050, 0x9084, 0xff00, 0x9086, 0x3200, 0x1510, 0x7037, 0x0001,
+	0x7050, 0x9084, 0xff00, 0x9086, 0xe100, 0x11d0, 0x7037, 0x0000,
+	0x7054, 0x7037, 0x0000, 0x715c, 0x9106, 0x1190, 0x2001, 0x1820,
+	0x2004, 0x9106, 0x1168, 0x00c6, 0x2061, 0x0100, 0x6024, 0x9084,
+	0x1e00, 0x00ce, 0x0138, 0x080c, 0x3eee, 0x080c, 0x3cd3, 0x0058,
+	0x080c, 0x3cd3, 0x080c, 0x4022, 0x080c, 0x3fad, 0x2001, 0x020b,
+	0x2004, 0xd0e4, 0x0dd8, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061,
+	0x0100, 0x6027, 0x0002, 0x001e, 0x6106, 0x2011, 0x020d, 0x2013,
+	0x0020, 0x60bb, 0x0000, 0x60bf, 0x0108, 0x60bf, 0x0012, 0x2001,
+	0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x1328, 0x2009,
+	0x0028, 0x080c, 0x21b0, 0x2001, 0x0227, 0x200c, 0x2102, 0x080c,
+	0xa8b2, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
+	0x008e, 0x004e, 0x2001, 0x199f, 0x2004, 0x9005, 0x1118, 0x012e,
+	0x0804, 0x3573, 0x012e, 0x2021, 0x400c, 0x0804, 0x3575, 0x0016,
+	0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6,
+	0x0156, 0x7014, 0x2048, 0x7020, 0x20a8, 0x8000, 0x7022, 0xa804,
+	0x9005, 0x0904, 0x3c43, 0x2048, 0x1f04, 0x3bf7, 0x7068, 0x2040,
+	0xa28c, 0xa390, 0xa494, 0xa598, 0xa930, 0xa808, 0xd0b4, 0x1120,
+	0x2029, 0x0000, 0x2021, 0x0000, 0x0096, 0x7014, 0x2048, 0xa864,
+	0x009e, 0x9086, 0x0103, 0x0170, 0x8906, 0x8006, 0x8007, 0x90bc,
+	0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x080c, 0x4af0, 0x701f,
+	0x3be7, 0x00b0, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
+	0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0,
+	0x0006, 0x080c, 0x0fb7, 0x000e, 0x080c, 0x4af3, 0x701f, 0x3be7,
+	0x015e, 0x00de, 0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e,
+	0x002e, 0x001e, 0x0005, 0x7014, 0x2048, 0xa864, 0x9086, 0x0103,
+	0x1118, 0x701f, 0x3ca8, 0x0450, 0x7014, 0x2048, 0xa868, 0xc0fd,
+	0xa86a, 0x2009, 0x007f, 0x080c, 0x65c4, 0x0110, 0x9006, 0x0030,
+	0xb813, 0x00ff, 0xb817, 0xfffd, 0x080c, 0xcd1b, 0x015e, 0x00de,
+	0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e,
+	0x0904, 0x35a5, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076,
+	0x0086, 0x0096, 0x00d6, 0x0156, 0x701f, 0x3c7a, 0x7007, 0x0003,
+	0x0804, 0x3c38, 0xa830, 0x9086, 0x0100, 0x2021, 0x400c, 0x0904,
+	0x3575, 0x0076, 0xad10, 0xac0c, 0xab24, 0xaa20, 0xa930, 0xa808,
+	0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006,
+	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8,
+	0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0fb7, 0x000e,
+	0x080c, 0x4af3, 0x007e, 0x701f, 0x3be7, 0x7023, 0x0001, 0x0005,
+	0x0804, 0x3573, 0x0156, 0x00c6, 0xa814, 0x908a, 0x001e, 0x0218,
+	0xa833, 0x001e, 0x0010, 0xa832, 0x0078, 0x81ff, 0x0168, 0x0016,
+	0x080c, 0x4aa7, 0x001e, 0x0130, 0xa800, 0x2040, 0xa008, 0xa80a,
+	0x2100, 0x0c58, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x015e,
+	0x0005, 0x0006, 0x00f6, 0x2079, 0x0000, 0x7880, 0x9086, 0x0044,
+	0x00fe, 0x000e, 0x0005, 0x2001, 0x199f, 0x2003, 0x0001, 0x0005,
+	0x00f6, 0x00e6, 0x00c6, 0x2061, 0x0200, 0x2001, 0x19aa, 0x2004,
+	0x601a, 0x2061, 0x0100, 0x2001, 0x19a9, 0x2004, 0x60ce, 0x6104,
+	0xc1ac, 0x6106, 0x080c, 0x4aa7, 0xa813, 0x0019, 0xa817, 0x0001,
+	0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f,
+	0x2004, 0xa86a, 0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x19a9,
+	0x2004, 0x6036, 0x2009, 0x0040, 0x080c, 0x21b0, 0x2001, 0x002a,
+	0x2004, 0x9084, 0xfff8, 0xa86e, 0x601a, 0xa873, 0x0000, 0x601f,
+	0x0000, 0x78ca, 0x9006, 0x600a, 0x600e, 0x00ce, 0x00ee, 0x00fe,
+	0x0005, 0x00e6, 0x080c, 0x4aa7, 0x2940, 0xa013, 0x0019, 0xa017,
+	0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa866, 0x2001,
+	0x0031, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
+	0xa86e, 0xa873, 0x0000, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001,
 	0x0300, 0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001,
 	0x0004, 0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126,
-	0x2091, 0x8000, 0x20a9, 0x0007, 0x20a1, 0x1840, 0x20e9, 0x0001,
-	0x9006, 0x4004, 0x20a9, 0x000c, 0x20a1, 0xfff4, 0x20e9, 0x0000,
-	0x9006, 0x4004, 0x2009, 0x013c, 0x200a, 0x012e, 0x7880, 0x9086,
-	0x0052, 0x0108, 0x0005, 0x0804, 0x356c, 0x7d98, 0x7c9c, 0x0804,
-	0x3663, 0x080c, 0x74d5, 0x190c, 0x5fe7, 0x6040, 0x9084, 0x0020,
-	0x09b1, 0x2069, 0x1847, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88,
-	0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x4ae9, 0x701f, 0x4279,
-	0x0005, 0x080c, 0x56e2, 0x1130, 0x3b00, 0x3a08, 0xc194, 0xc095,
-	0x20d8, 0x21d0, 0x2069, 0x1847, 0x6800, 0x9005, 0x0904, 0x35a1,
-	0x6804, 0xd0ac, 0x0118, 0xd0a4, 0x0904, 0x35a1, 0xd094, 0x00c6,
-	0x2061, 0x0100, 0x6104, 0x0138, 0x6200, 0x9292, 0x0005, 0x0218,
-	0x918c, 0xffdf, 0x0010, 0x918d, 0x0020, 0x6106, 0x00ce, 0xd08c,
-	0x00c6, 0x2061, 0x0100, 0x6104, 0x0118, 0x918d, 0x0010, 0x0010,
-	0x918c, 0xffef, 0x6106, 0x00ce, 0xd084, 0x0158, 0x6a28, 0x928a,
-	0x007f, 0x1a04, 0x35a1, 0x9288, 0x336d, 0x210d, 0x918c, 0x00ff,
-	0x6166, 0xd0dc, 0x0130, 0x6828, 0x908a, 0x007f, 0x1a04, 0x35a1,
-	0x605e, 0x6888, 0x9084, 0x0030, 0x8004, 0x8004, 0x8004, 0x8004,
-	0x0006, 0x2009, 0x19b1, 0x9080, 0x2737, 0x2005, 0x200a, 0x2008,
-	0x2001, 0x0018, 0x080c, 0xa863, 0x2009, 0x0390, 0x200b, 0x0400,
-	0x000e, 0x2009, 0x19b2, 0x9080, 0x273b, 0x2005, 0x200a, 0x6808,
-	0x908a, 0x0100, 0x0a04, 0x35a1, 0x908a, 0x0841, 0x1a04, 0x35a1,
-	0x9084, 0x0007, 0x1904, 0x35a1, 0x680c, 0x9005, 0x0904, 0x35a1,
-	0x6810, 0x9005, 0x0904, 0x35a1, 0x6848, 0x6940, 0x910a, 0x1a04,
-	0x35a1, 0x8001, 0x0904, 0x35a1, 0x684c, 0x6944, 0x910a, 0x1a04,
-	0x35a1, 0x8001, 0x0904, 0x35a1, 0x6814, 0x908c, 0x00ff, 0x614e,
-	0x8007, 0x9084, 0x00ff, 0x6052, 0x080c, 0x780a, 0x080c, 0x6a91,
-	0x080c, 0x6ac5, 0x6808, 0x602a, 0x080c, 0x2122, 0x2009, 0x0170,
-	0x200b, 0x0080, 0xa001, 0xa001, 0x200b, 0x0000, 0x0036, 0x6b08,
-	0x080c, 0x269e, 0x003e, 0x6000, 0x9086, 0x0000, 0x1904, 0x4404,
-	0x6818, 0x691c, 0x6a20, 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f,
-	0x6016, 0x611a, 0x621e, 0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830,
-	0x6934, 0x6a38, 0x6b3c, 0x8007, 0x810f, 0x8217, 0x831f, 0x0010,
-	0x9084, 0xf0ff, 0x6006, 0x610a, 0x620e, 0x6312, 0x8007, 0x810f,
-	0x8217, 0x831f, 0x20a9, 0x0004, 0x20a1, 0x19b3, 0x20e9, 0x0001,
-	0x4001, 0x20a9, 0x0004, 0x20a1, 0x19cd, 0x20e9, 0x0001, 0x4001,
-	0x080c, 0x87a0, 0x00c6, 0x900e, 0x20a9, 0x0001, 0x6b70, 0xd384,
-	0x01c8, 0x0020, 0x839d, 0x12b0, 0x3508, 0x8109, 0x080c, 0x7dcb,
-	0x6878, 0x6016, 0x6874, 0x2008, 0x9084, 0xff00, 0x8007, 0x600a,
-	0x9184, 0x00ff, 0x6006, 0x8108, 0x1118, 0x6003, 0x0003, 0x0010,
-	0x6003, 0x0001, 0x1f04, 0x4362, 0x00ce, 0x00c6, 0x2061, 0x199c,
-	0x6a88, 0x9284, 0xc000, 0x2010, 0x9286, 0x0000, 0x1158, 0x2063,
-	0x0000, 0x2001, 0x0001, 0x080c, 0x2945, 0x2001, 0x0001, 0x080c,
-	0x2928, 0x0088, 0x9286, 0x4000, 0x1148, 0x2063, 0x0001, 0x9006,
-	0x080c, 0x2945, 0x9006, 0x080c, 0x2928, 0x0028, 0x9286, 0x8000,
-	0x1d30, 0x2063, 0x0002, 0x00ce, 0x00e6, 0x2c70, 0x080c, 0x0eb4,
-	0x00ee, 0x6888, 0xd0ec, 0x0130, 0x2011, 0x0114, 0x2204, 0x9085,
-	0x0180, 0x2012, 0x6a80, 0x9284, 0x0030, 0x9086, 0x0030, 0x1128,
-	0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82, 0x2001, 0x197c, 0x6a80,
-	0x9294, 0x0030, 0x928e, 0x0000, 0x0170, 0x928e, 0x0010, 0x0118,
-	0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa, 0x080c, 0x2713, 0x2001,
-	0x196d, 0x2102, 0x0008, 0x2102, 0x00c6, 0x2061, 0x0100, 0x602f,
-	0x0040, 0x602f, 0x0000, 0x00ce, 0x080c, 0x74d5, 0x0128, 0x080c,
-	0x4fd7, 0x0110, 0x080c, 0x2664, 0x60d4, 0x9005, 0x01c0, 0x6003,
-	0x0001, 0x2009, 0x43ec, 0x00e0, 0x080c, 0x74d5, 0x1168, 0x2011,
-	0x734b, 0x080c, 0x860d, 0x2011, 0x733e, 0x080c, 0x8719, 0x080c,
-	0x77de, 0x080c, 0x7406, 0x0040, 0x080c, 0x5edd, 0x0028, 0x6003,
-	0x0004, 0x2009, 0x4404, 0x0020, 0x080c, 0x69c6, 0x0804, 0x356c,
-	0x2001, 0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c, 0x1118,
-	0x2091, 0x31bd, 0x0817, 0x2091, 0x313d, 0x0817, 0x6000, 0x9086,
-	0x0000, 0x0904, 0x359e, 0x2069, 0x1847, 0x7890, 0x6842, 0x7894,
-	0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0x2039, 0x0001, 0x0804, 0x4aec, 0x9006, 0x080c, 0x2664, 0x81ff,
-	0x1904, 0x359e, 0x080c, 0x74d5, 0x11b0, 0x080c, 0x77d9, 0x080c,
-	0x6022, 0x080c, 0x3361, 0x0118, 0x6130, 0xc18d, 0x6132, 0x080c,
-	0xcf2e, 0x0130, 0x080c, 0x74f8, 0x1118, 0x080c, 0x74a9, 0x0038,
-	0x080c, 0x7406, 0x0020, 0x080c, 0x5fe7, 0x080c, 0x5edd, 0x0804,
-	0x356c, 0x81ff, 0x1904, 0x359e, 0x080c, 0x74d5, 0x1110, 0x0804,
-	0x359e, 0x6194, 0x81ff, 0x01a8, 0x704f, 0x0000, 0x2001, 0x1d80,
-	0x2009, 0x0040, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0126, 0x2091,
-	0x8000, 0x2039, 0x0001, 0x080c, 0x4aec, 0x701f, 0x356a, 0x012e,
-	0x0005, 0x704f, 0x0001, 0x00d6, 0x2069, 0x1d80, 0x20a9, 0x0040,
-	0x20e9, 0x0001, 0x20a1, 0x1d80, 0x2019, 0xffff, 0x4304, 0x655c,
-	0x9588, 0x336d, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e, 0x2011,
-	0x0002, 0x2100, 0x9506, 0x01a8, 0x080c, 0x661e, 0x1190, 0xb814,
-	0x821c, 0x0238, 0x9398, 0x1d80, 0x9085, 0xff00, 0x8007, 0x201a,
-	0x0038, 0x9398, 0x1d80, 0x2324, 0x94a4, 0xff00, 0x9405, 0x201a,
-	0x8210, 0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201, 0x8007,
-	0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1, 0x1d80,
-	0x2099, 0x1d80, 0x080c, 0x5f72, 0x0804, 0x445e, 0x080c, 0x4ad3,
-	0x0904, 0x35a1, 0x080c, 0x4aa0, 0x1120, 0x2009, 0x0002, 0x0804,
-	0x359e, 0x080c, 0x56d3, 0xd0b4, 0x0558, 0x7884, 0x908e, 0x007e,
-	0x0538, 0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508, 0x080c,
-	0x335c, 0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084, 0x00ff,
-	0x9086, 0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
-	0x080c, 0xc9e3, 0x1120, 0x2009, 0x0003, 0x0804, 0x359e, 0x7007,
-	0x0003, 0x701f, 0x44ec, 0x0005, 0x080c, 0x4ad3, 0x0904, 0x35a1,
-	0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080,
-	0x0006, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098,
-	0x080c, 0x0fb7, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x000a,
-	0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c,
-	0x0fb7, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-	0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0x0804, 0x4aec, 0x81ff, 0x1904, 0x359e, 0x080c, 0x4ab7, 0x0904,
-	0x35a1, 0x080c, 0x685f, 0x0904, 0x359e, 0x0058, 0xa878, 0x9005,
-	0x0120, 0x2009, 0x0004, 0x0804, 0x359e, 0xa974, 0xaa94, 0x0804,
-	0x356c, 0x080c, 0x56db, 0x0904, 0x356c, 0x701f, 0x4536, 0x7007,
-	0x0003, 0x0005, 0x81ff, 0x1904, 0x359e, 0x7888, 0x908a, 0x1000,
-	0x1a04, 0x35a1, 0x080c, 0x4ad3, 0x0904, 0x35a1, 0x080c, 0x6a5b,
-	0x0120, 0x080c, 0x6a63, 0x1904, 0x35a1, 0x080c, 0x68e4, 0x0904,
-	0x359e, 0x2019, 0x0004, 0x900e, 0x080c, 0x6871, 0x0904, 0x359e,
-	0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000, 0x12f8,
-	0x080c, 0x4ad1, 0x01e0, 0x080c, 0x6a5b, 0x0118, 0x080c, 0x6a63,
-	0x11b0, 0x080c, 0x68e4, 0x2009, 0x0002, 0x0168, 0x2009, 0x0002,
-	0x2019, 0x0004, 0x080c, 0x6871, 0x2009, 0x0003, 0x0120, 0xa998,
-	0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
-	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
-	0x4000, 0x080c, 0x56db, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085,
-	0x0001, 0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110, 0x0071,
-	0x0060, 0x2029, 0x007e, 0x2061, 0x1800, 0x645c, 0x2400, 0x9506,
-	0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c, 0x661e,
-	0x1138, 0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x861b,
-	0x0005, 0x81ff, 0x1904, 0x359e, 0x798c, 0x2001, 0x1980, 0x918c,
-	0x8000, 0x2102, 0x080c, 0x4ab7, 0x0904, 0x35a1, 0x080c, 0x6a5b,
-	0x0120, 0x080c, 0x6a63, 0x1904, 0x35a1, 0x080c, 0x66e5, 0x0904,
-	0x359e, 0x080c, 0x6868, 0x0904, 0x359e, 0x2001, 0x1980, 0x2004,
-	0xd0fc, 0x1904, 0x356c, 0x0804, 0x4541, 0xa9a0, 0x2001, 0x1980,
-	0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4ac4, 0x01a0, 0x080c,
-	0x6a5b, 0x0118, 0x080c, 0x6a63, 0x1170, 0x080c, 0x66e5, 0x2009,
-	0x0002, 0x0128, 0x080c, 0x6868, 0x1170, 0x2009, 0x0003, 0xa897,
-	0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001,
-	0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1980, 0x2004,
-	0xd0fc, 0x1128, 0x080c, 0x56db, 0x0110, 0x9006, 0x0018, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904, 0x359e,
-	0x798c, 0x2001, 0x197f, 0x918c, 0x8000, 0x2102, 0x080c, 0x4ab7,
-	0x0904, 0x35a1, 0x080c, 0x6a5b, 0x0120, 0x080c, 0x6a63, 0x1904,
-	0x35a1, 0x080c, 0x66e5, 0x0904, 0x359e, 0x080c, 0x6856, 0x0904,
-	0x359e, 0x2001, 0x197f, 0x2004, 0xd0fc, 0x1904, 0x356c, 0x0804,
-	0x4541, 0xa9a0, 0x2001, 0x197f, 0x918c, 0x8000, 0xc18d, 0x2102,
-	0x080c, 0x4ac4, 0x01a0, 0x080c, 0x6a5b, 0x0118, 0x080c, 0x6a63,
-	0x1170, 0x080c, 0x66e5, 0x2009, 0x0002, 0x0128, 0x080c, 0x6856,
-	0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
-	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
-	0x4000, 0x2001, 0x197f, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x56db,
-	0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000,
-	0x0005, 0x6100, 0x0804, 0x356c, 0x080c, 0x4ad3, 0x0904, 0x35a1,
-	0x080c, 0x56e7, 0x1904, 0x359e, 0x79a8, 0xd184, 0x1158, 0xb834,
-	0x8007, 0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f, 0xba28,
-	0x8217, 0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007, 0x789a,
-	0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0200, 0x0804,
-	0x356c, 0x78a8, 0x909c, 0x0003, 0xd0b4, 0x1140, 0x939a, 0x0003,
-	0x1a04, 0x359e, 0x625c, 0x7884, 0x9206, 0x1548, 0x080c, 0x878a,
-	0x2001, 0xfff4, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0x2039, 0x0000, 0x0006, 0x78a8, 0x9084, 0x0080, 0x1118, 0x000e,
-	0x0804, 0x4aec, 0x000e, 0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44,
-	0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a,
-	0x080c, 0x1124, 0x7007, 0x0002, 0x701f, 0x46f7, 0x0005, 0x81ff,
-	0x1904, 0x359e, 0x080c, 0x4ad3, 0x0904, 0x35a1, 0x080c, 0x6a5b,
-	0x1904, 0x359e, 0x00c6, 0x080c, 0x4aa0, 0x00ce, 0x0904, 0x359e,
-	0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7ea8, 0x080c, 0xc989,
-	0x0904, 0x359e, 0x7007, 0x0003, 0x701f, 0x46fb, 0x0005, 0x080c,
-	0x423f, 0x0804, 0x356c, 0xa830, 0x9086, 0x0100, 0x0904, 0x359e,
+	0x2091, 0x8000, 0x81ff, 0x0148, 0x080c, 0x29e8, 0x1130, 0x9006,
+	0x080c, 0x2945, 0x9006, 0x080c, 0x2928, 0x7884, 0x9084, 0x0007,
+	0x0002, 0x3d64, 0x3d6d, 0x3d76, 0x3d61, 0x3d61, 0x3d61, 0x3d61,
+	0x3d61, 0x012e, 0x0804, 0x35a8, 0x2009, 0x0114, 0x2104, 0x9085,
+	0x0800, 0x200a, 0x080c, 0x3f38, 0x00c0, 0x2009, 0x0114, 0x2104,
+	0x9085, 0x4000, 0x200a, 0x080c, 0x3f38, 0x0078, 0x080c, 0x74e9,
+	0x1128, 0x012e, 0x2009, 0x0016, 0x0804, 0x35a5, 0x81ff, 0x0128,
+	0x012e, 0x2021, 0x400b, 0x0804, 0x3575, 0x080c, 0xa896, 0x0086,
+	0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c,
+	0x3a8f, 0x2009, 0x0101, 0x210c, 0x0016, 0x7ec8, 0x7dcc, 0x9006,
+	0x2068, 0x2060, 0x2058, 0x080c, 0x41d9, 0x080c, 0x4129, 0x903e,
+	0x2720, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x19e7, 0x2079,
+	0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x68d4,
+	0x780e, 0x68d0, 0x780a, 0x00de, 0x2011, 0x0001, 0x080c, 0x408a,
+	0x080c, 0x29f0, 0x080c, 0x29f0, 0x080c, 0x29f0, 0x080c, 0x29f0,
+	0x080c, 0x408a, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x3fb7, 0x2009,
+	0x9c40, 0x8109, 0x11b0, 0x080c, 0x3eee, 0x2001, 0x0004, 0x200c,
+	0x918c, 0xfffd, 0x2102, 0x001e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
+	0x00be, 0x00ae, 0x009e, 0x008e, 0x2009, 0x0017, 0x080c, 0x35a5,
+	0x0cf8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1d10, 0x00f6,
+	0x2079, 0x0000, 0x7884, 0x00fe, 0xd0bc, 0x0178, 0x2001, 0x0201,
+	0x200c, 0x81ff, 0x0150, 0x080c, 0x3f95, 0x2d00, 0x9c05, 0x9b05,
+	0x0120, 0x080c, 0x3eee, 0x0804, 0x3e97, 0x080c, 0x40fe, 0x080c,
+	0x4022, 0x080c, 0x3f78, 0x080c, 0x3fad, 0x00f6, 0x2079, 0x0100,
+	0x7824, 0xd0ac, 0x0130, 0x8b58, 0x080c, 0x3eee, 0x00fe, 0x0804,
+	0x3e97, 0x00fe, 0x080c, 0x3ee4, 0x1150, 0x8d68, 0x2001, 0x0032,
+	0x2602, 0x2001, 0x0033, 0x2502, 0x080c, 0x3eee, 0x0080, 0x87ff,
+	0x0138, 0x2001, 0x0201, 0x2004, 0x9005, 0x1908, 0x8739, 0x0038,
+	0x2001, 0x1a6b, 0x2004, 0x9086, 0x0000, 0x1904, 0x3de7, 0x2001,
+	0x032f, 0x2003, 0x00f6, 0x8631, 0x1208, 0x8529, 0x2500, 0x9605,
+	0x0904, 0x3e97, 0x7884, 0xd0bc, 0x0128, 0x2d00, 0x9c05, 0x9b05,
+	0x1904, 0x3e97, 0xa013, 0x0019, 0x2001, 0x032a, 0x2003, 0x0004,
+	0x7884, 0xd0ac, 0x1148, 0x2001, 0x1a6b, 0x2003, 0x0003, 0x2001,
+	0x032a, 0x2003, 0x0009, 0x0030, 0xa017, 0x0001, 0x78b4, 0x9005,
+	0x0108, 0xa016, 0x2800, 0xa05a, 0x2009, 0x0040, 0x080c, 0x21b0,
+	0x2900, 0xa85a, 0xa813, 0x0019, 0x7884, 0xd0a4, 0x1180, 0xa817,
+	0x0000, 0x00c6, 0x20a9, 0x0004, 0x2061, 0x0090, 0x602b, 0x0008,
+	0x2001, 0x0203, 0x2004, 0x1f04, 0x3e6e, 0x00ce, 0x0030, 0xa817,
+	0x0001, 0x78b0, 0x9005, 0x0108, 0xa816, 0x00f6, 0x00c6, 0x2079,
+	0x0100, 0x2061, 0x0090, 0x7827, 0x0002, 0x2001, 0x002a, 0x2004,
+	0x9084, 0xfff8, 0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e,
+	0x78c6, 0x000e, 0x78ca, 0x00ce, 0x00fe, 0x0804, 0x3da1, 0x001e,
+	0x00c6, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027,
+	0x0002, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x2001, 0x0004,
+	0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x1328, 0x7884, 0x9084,
+	0x0003, 0x9086, 0x0002, 0x01b0, 0x2009, 0x0028, 0x080c, 0x21b0,
+	0x2001, 0x0227, 0x200c, 0x2102, 0x6050, 0x9084, 0xb7ff, 0x080c,
+	0x2aab, 0x6052, 0x602f, 0x0000, 0x604b, 0xf7f7, 0x6043, 0x0090,
+	0x6043, 0x0010, 0x080c, 0xa8b2, 0x00ce, 0x2d08, 0x2c10, 0x2b18,
+	0x2b00, 0x9c05, 0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
+	0x00ae, 0x009e, 0x008e, 0x1118, 0x012e, 0x0804, 0x3573, 0x012e,
+	0x2021, 0x400c, 0x0804, 0x3575, 0x9085, 0x0001, 0x1d04, 0x3eed,
+	0x2091, 0x6000, 0x8420, 0x9486, 0x0064, 0x0005, 0x2001, 0x0105,
+	0x2003, 0x0010, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x1a6b,
+	0x2003, 0x0000, 0x0071, 0x2009, 0x0048, 0x080c, 0x21b0, 0x2001,
+	0x0227, 0x2024, 0x2402, 0x2001, 0x0109, 0x2003, 0x4000, 0x9026,
+	0x0005, 0x00f6, 0x00e6, 0x2071, 0x19e7, 0x7054, 0x9086, 0x0000,
+	0x0520, 0x2079, 0x0090, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203,
+	0x210c, 0x9106, 0x1120, 0x2009, 0x0040, 0x080c, 0x21b0, 0x782c,
+	0xd0fc, 0x0d88, 0x080c, 0x40fe, 0x7054, 0x9086, 0x0000, 0x1d58,
+	0x782b, 0x0004, 0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040, 0x080c,
+	0x21b0, 0x782b, 0x0002, 0x7057, 0x0000, 0x00ee, 0x00fe, 0x0005,
+	0x00f6, 0x2079, 0x0100, 0x2001, 0x1818, 0x200c, 0x7932, 0x7936,
+	0x080c, 0x2644, 0x080c, 0x2a67, 0x080c, 0x2aab, 0x784b, 0xf7f7,
+	0x7843, 0x0090, 0x7843, 0x0010, 0x7850, 0xc0e5, 0x7852, 0x2019,
+	0x61a8, 0x7820, 0xd09c, 0x0110, 0x8319, 0x1dd8, 0x7850, 0xc0e4,
+	0x7852, 0x2011, 0x0048, 0x080c, 0x2a44, 0x7843, 0x0040, 0x2019,
+	0x01f4, 0xa001, 0xa001, 0x8319, 0x1de0, 0x2001, 0x0100, 0x080c,
+	0x2a0a, 0x2011, 0x0020, 0x080c, 0x2a44, 0x7843, 0x0000, 0x9006,
+	0x080c, 0x2a0a, 0x2011, 0x0048, 0x080c, 0x2a44, 0x00fe, 0x0005,
+	0x7884, 0xd0ac, 0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a6b, 0x2079,
+	0x0320, 0x2001, 0x0201, 0x2004, 0x9005, 0x0160, 0x7000, 0x9086,
+	0x0000, 0x1140, 0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003, 0x0003,
+	0x782b, 0x0019, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0300,
+	0x78bc, 0x00fe, 0x908c, 0x0070, 0x0178, 0x2009, 0x0032, 0x260a,
+	0x2009, 0x0033, 0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac, 0x0108,
+	0x8d68, 0xd0a4, 0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079, 0x0200,
+	0x781c, 0xd084, 0x0110, 0x7837, 0x0050, 0x00fe, 0x0005, 0x00e6,
+	0x2071, 0x0100, 0x2001, 0x19aa, 0x2004, 0x70e2, 0x080c, 0x3cc9,
+	0x1188, 0x2001, 0x1820, 0x2004, 0x2009, 0x181f, 0x210c, 0x918c,
+	0x00ff, 0x706e, 0x716a, 0x7066, 0x918d, 0x3200, 0x7162, 0x7073,
+	0xe109, 0x0080, 0x702c, 0x9085, 0x0002, 0x702e, 0x2009, 0x1818,
+	0x210c, 0x716e, 0x7063, 0x0100, 0x7166, 0x719e, 0x706b, 0x0000,
+	0x7073, 0x0809, 0x7077, 0x0008, 0x7078, 0x9080, 0x0100, 0x707a,
+	0x7080, 0x8000, 0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a, 0x708e,
+	0x707e, 0x70d6, 0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014, 0x9084,
+	0x1984, 0x9085, 0x0092, 0x7016, 0x080c, 0x40fe, 0x00f6, 0x2071,
+	0x1a6b, 0x2079, 0x0320, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4,
+	0x0120, 0x689c, 0x780e, 0x6898, 0x780a, 0x00de, 0x2009, 0x03e8,
+	0x8109, 0x1df0, 0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004, 0x2011,
+	0x0011, 0x080c, 0x408a, 0x2011, 0x0001, 0x080c, 0x408a, 0x00fe,
+	0x00ee, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a6b, 0x2079, 0x0320,
+	0x792c, 0xd1fc, 0x0904, 0x4087, 0x782b, 0x0002, 0x9026, 0xd19c,
+	0x1904, 0x4083, 0x7000, 0x0002, 0x4087, 0x4038, 0x4068, 0x4083,
+	0xd1bc, 0x1170, 0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011, 0x0001,
+	0x080c, 0x408a, 0x0904, 0x4087, 0x080c, 0x408a, 0x0804, 0x4087,
+	0x00f6, 0x2079, 0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810, 0x7914,
+	0x782b, 0x0004, 0x7812, 0x7916, 0x2001, 0x0201, 0x200c, 0x81ff,
+	0x0de8, 0x080c, 0x3f95, 0x2009, 0x0001, 0x00f6, 0x2079, 0x0300,
+	0x78b8, 0x00fe, 0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a, 0x00f8,
+	0x8001, 0x7002, 0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc, 0x1904,
+	0x402c, 0x2011, 0x0001, 0x00b1, 0x0090, 0xa010, 0x9092, 0x0004,
+	0x9086, 0x0015, 0x1120, 0xa000, 0xa05a, 0x2011, 0x0031, 0xa212,
+	0xd1dc, 0x1960, 0x0828, 0x782b, 0x0004, 0x7003, 0x0000, 0x00ee,
+	0x00fe, 0x0005, 0xa014, 0x9005, 0x0550, 0x8001, 0x0036, 0x0096,
+	0xa016, 0xa058, 0x2048, 0xa010, 0x2009, 0x0031, 0x911a, 0x831c,
+	0x831c, 0x938a, 0x0007, 0x1a0c, 0x0d7d, 0x9398, 0x40b8, 0x231d,
+	0x083f, 0x9080, 0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102, 0x009e,
+	0x003e, 0x908a, 0x0035, 0x1140, 0x0096, 0xa058, 0x2048, 0xa804,
+	0xa05a, 0x2001, 0x0019, 0x009e, 0xa012, 0x9085, 0x0001, 0x0005,
+	0x40f5, 0x40ec, 0x40e3, 0x40da, 0x40d1, 0x40c8, 0x40bf, 0xa964,
+	0x7902, 0xa968, 0x7906, 0xa96c, 0x7912, 0xa970, 0x7916, 0x0005,
+	0xa974, 0x7902, 0xa978, 0x7906, 0xa97c, 0x7912, 0xa980, 0x7916,
+	0x0005, 0xa984, 0x7902, 0xa988, 0x7906, 0xa98c, 0x7912, 0xa990,
+	0x7916, 0x0005, 0xa994, 0x7902, 0xa998, 0x7906, 0xa99c, 0x7912,
+	0xa9a0, 0x7916, 0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906, 0xa9ac,
+	0x7912, 0xa9b0, 0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8, 0x7906,
+	0xa9bc, 0x7912, 0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902, 0xa9c8,
+	0x7906, 0xa9cc, 0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6, 0x00e6,
+	0x0086, 0x2071, 0x19e7, 0x2079, 0x0090, 0x792c, 0xd1fc, 0x01e8,
+	0x782b, 0x0002, 0x2940, 0x9026, 0x7054, 0x0002, 0x4125, 0x4111,
+	0x411c, 0x8001, 0x7056, 0xd19c, 0x1180, 0x2011, 0x0001, 0x080c,
+	0x408a, 0x190c, 0x408a, 0x0048, 0x8001, 0x7056, 0x782c, 0xd0fc,
+	0x1d38, 0x2011, 0x0001, 0x080c, 0x408a, 0x008e, 0x00ee, 0x00fe,
+	0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200, 0x2001,
+	0x19aa, 0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x19a9, 0x2004,
+	0x60ce, 0x6104, 0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004, 0x9005,
+	0x0520, 0x2038, 0x2001, 0x002e, 0x2024, 0x2001, 0x002f, 0x201c,
+	0x080c, 0x4aa7, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a,
+	0x0007, 0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e,
+	0x0096, 0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c,
+	0x41a1, 0x1d68, 0x2900, 0xa85a, 0x00d0, 0x080c, 0x4aa7, 0xa813,
+	0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004,
+	0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004,
+	0x9084, 0xfff8, 0xa86e, 0x2001, 0x002b, 0x2004, 0xa872, 0x2061,
+	0x0090, 0x2079, 0x0100, 0x2001, 0x19a9, 0x2004, 0x6036, 0x2009,
+	0x0040, 0x080c, 0x21b0, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
+	0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e,
+	0x78ca, 0x9006, 0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee, 0x00fe,
+	0x0005, 0x00e6, 0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0, 0x20e1,
+	0x0000, 0x2099, 0x0088, 0x702b, 0x0026, 0x7402, 0x7306, 0x9006,
+	0x700a, 0x700e, 0x810b, 0x810b, 0x21a8, 0x810b, 0x7112, 0x702b,
+	0x0041, 0x702c, 0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b, 0x0040,
+	0x4005, 0x7400, 0x7304, 0x87ff, 0x0190, 0x0086, 0x0096, 0x2940,
+	0x0086, 0x080c, 0x4aa7, 0x008e, 0xa058, 0x00a6, 0x2050, 0x2900,
+	0xb006, 0xa05a, 0x00ae, 0x009e, 0x008e, 0x9085, 0x0001, 0x00ee,
+	0x0005, 0x00e6, 0x2001, 0x002d, 0x2004, 0x9005, 0x0528, 0x2038,
+	0x2001, 0x0030, 0x2024, 0x2001, 0x0031, 0x201c, 0x080c, 0x4aa7,
+	0x2940, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007,
+	0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096,
+	0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x41a1,
+	0x1d68, 0x2900, 0xa85a, 0x00d8, 0x080c, 0x4aa7, 0x2940, 0xa013,
+	0x0019, 0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004,
+	0xa066, 0x2001, 0x0031, 0x2004, 0xa06a, 0x2001, 0x002a, 0x2004,
+	0x9084, 0xfff8, 0xa06e, 0x2001, 0x002b, 0x2004, 0xa072, 0x2001,
+	0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001, 0x0101,
+	0x200c, 0x918d, 0x0200, 0x2102, 0xa017, 0x0000, 0x2001, 0x1a6b,
+	0x2003, 0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x2001, 0x0300,
+	0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004,
+	0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091,
+	0x8000, 0x20a9, 0x0007, 0x20a1, 0x1840, 0x20e9, 0x0001, 0x9006,
+	0x4004, 0x20a9, 0x000c, 0x20a1, 0xfff4, 0x20e9, 0x0000, 0x9006,
+	0x4004, 0x2009, 0x013c, 0x200a, 0x012e, 0x7880, 0x9086, 0x0052,
+	0x0108, 0x0005, 0x0804, 0x3573, 0x7d98, 0x7c9c, 0x0804, 0x366a,
+	0x080c, 0x74e9, 0x190c, 0x5fee, 0x6040, 0x9084, 0x0020, 0x09b1,
+	0x2069, 0x1847, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c,
+	0x7d98, 0x2039, 0x0001, 0x080c, 0x4af0, 0x701f, 0x4280, 0x0005,
+	0x080c, 0x56e9, 0x1130, 0x3b00, 0x3a08, 0xc194, 0xc095, 0x20d8,
+	0x21d0, 0x2069, 0x1847, 0x6800, 0x9005, 0x0904, 0x35a8, 0x6804,
+	0xd0ac, 0x0118, 0xd0a4, 0x0904, 0x35a8, 0xd094, 0x00c6, 0x2061,
+	0x0100, 0x6104, 0x0138, 0x6200, 0x9292, 0x0005, 0x0218, 0x918c,
+	0xffdf, 0x0010, 0x918d, 0x0020, 0x6106, 0x00ce, 0xd08c, 0x00c6,
+	0x2061, 0x0100, 0x6104, 0x0118, 0x918d, 0x0010, 0x0010, 0x918c,
+	0xffef, 0x6106, 0x00ce, 0xd084, 0x0158, 0x6a28, 0x928a, 0x007f,
+	0x1a04, 0x35a8, 0x9288, 0x3374, 0x210d, 0x918c, 0x00ff, 0x6166,
+	0xd0dc, 0x0130, 0x6828, 0x908a, 0x007f, 0x1a04, 0x35a8, 0x605e,
+	0x6888, 0x9084, 0x0030, 0x8004, 0x8004, 0x8004, 0x8004, 0x0006,
+	0x2009, 0x19b1, 0x9080, 0x2737, 0x2005, 0x200a, 0x2008, 0x2001,
+	0x0018, 0x080c, 0xa887, 0x2009, 0x0390, 0x200b, 0x0400, 0x000e,
+	0x2009, 0x19b2, 0x9080, 0x273b, 0x2005, 0x200a, 0x6808, 0x908a,
+	0x0100, 0x0a04, 0x35a8, 0x908a, 0x0841, 0x1a04, 0x35a8, 0x9084,
+	0x0007, 0x1904, 0x35a8, 0x680c, 0x9005, 0x0904, 0x35a8, 0x6810,
+	0x9005, 0x0904, 0x35a8, 0x6848, 0x6940, 0x910a, 0x1a04, 0x35a8,
+	0x8001, 0x0904, 0x35a8, 0x684c, 0x6944, 0x910a, 0x1a04, 0x35a8,
+	0x8001, 0x0904, 0x35a8, 0x6814, 0x908c, 0x00ff, 0x614e, 0x8007,
+	0x9084, 0x00ff, 0x6052, 0x080c, 0x781e, 0x080c, 0x6aa1, 0x080c,
+	0x6ad5, 0x6808, 0x602a, 0x080c, 0x2122, 0x2009, 0x0170, 0x200b,
+	0x0080, 0xa001, 0xa001, 0x200b, 0x0000, 0x0036, 0x6b08, 0x080c,
+	0x269e, 0x003e, 0x6000, 0x9086, 0x0000, 0x1904, 0x440b, 0x6818,
+	0x691c, 0x6a20, 0x6b24, 0x8007, 0x810f, 0x8217, 0x831f, 0x6016,
+	0x611a, 0x621e, 0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830, 0x6934,
+	0x6a38, 0x6b3c, 0x8007, 0x810f, 0x8217, 0x831f, 0x0010, 0x9084,
+	0xf0ff, 0x6006, 0x610a, 0x620e, 0x6312, 0x8007, 0x810f, 0x8217,
+	0x831f, 0x20a9, 0x0004, 0x20a1, 0x19b3, 0x20e9, 0x0001, 0x4001,
+	0x20a9, 0x0004, 0x20a1, 0x19cd, 0x20e9, 0x0001, 0x4001, 0x080c,
+	0x87d1, 0x00c6, 0x900e, 0x20a9, 0x0001, 0x6b70, 0xd384, 0x01c8,
+	0x0020, 0x839d, 0x12b0, 0x3508, 0x8109, 0x080c, 0x7ddf, 0x6878,
+	0x6016, 0x6874, 0x2008, 0x9084, 0xff00, 0x8007, 0x600a, 0x9184,
+	0x00ff, 0x6006, 0x8108, 0x1118, 0x6003, 0x0003, 0x0010, 0x6003,
+	0x0001, 0x1f04, 0x4369, 0x00ce, 0x00c6, 0x2061, 0x199c, 0x6a88,
+	0x9284, 0xc000, 0x2010, 0x9286, 0x0000, 0x1158, 0x2063, 0x0000,
+	0x2001, 0x0001, 0x080c, 0x2945, 0x2001, 0x0001, 0x080c, 0x2928,
+	0x0088, 0x9286, 0x4000, 0x1148, 0x2063, 0x0001, 0x9006, 0x080c,
+	0x2945, 0x9006, 0x080c, 0x2928, 0x0028, 0x9286, 0x8000, 0x1d30,
+	0x2063, 0x0002, 0x00ce, 0x00e6, 0x2c70, 0x080c, 0x0eb4, 0x00ee,
+	0x6888, 0xd0ec, 0x0130, 0x2011, 0x0114, 0x2204, 0x9085, 0x0180,
+	0x2012, 0x6a80, 0x9284, 0x0030, 0x9086, 0x0030, 0x1128, 0x9294,
+	0xffcf, 0x9295, 0x0020, 0x6a82, 0x2001, 0x197c, 0x6a80, 0x9294,
+	0x0030, 0x928e, 0x0000, 0x0170, 0x928e, 0x0010, 0x0118, 0x928e,
+	0x0020, 0x0140, 0x2003, 0xaaaa, 0x080c, 0x2713, 0x2001, 0x196d,
+	0x2102, 0x0008, 0x2102, 0x00c6, 0x2061, 0x0100, 0x602f, 0x0040,
+	0x602f, 0x0000, 0x00ce, 0x080c, 0x74e9, 0x0128, 0x080c, 0x4fde,
+	0x0110, 0x080c, 0x2664, 0x60d4, 0x9005, 0x01c0, 0x6003, 0x0001,
+	0x2009, 0x43f3, 0x00e0, 0x080c, 0x74e9, 0x1168, 0x2011, 0x735f,
+	0x080c, 0x863e, 0x2011, 0x7352, 0x080c, 0x874a, 0x080c, 0x77f2,
+	0x080c, 0x741a, 0x0040, 0x080c, 0x5ee4, 0x0028, 0x6003, 0x0004,
+	0x2009, 0x440b, 0x0020, 0x080c, 0x69cd, 0x0804, 0x3573, 0x2001,
+	0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c, 0x1118, 0x2091,
+	0x31bd, 0x0817, 0x2091, 0x313d, 0x0817, 0x6000, 0x9086, 0x0000,
+	0x0904, 0x35a5, 0x2069, 0x1847, 0x7890, 0x6842, 0x7894, 0x6846,
+	0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039,
+	0x0001, 0x0804, 0x4af3, 0x9006, 0x080c, 0x2664, 0x81ff, 0x1904,
+	0x35a5, 0x080c, 0x74e9, 0x11b0, 0x080c, 0x77ed, 0x080c, 0x6029,
+	0x080c, 0x3368, 0x0118, 0x6130, 0xc18d, 0x6132, 0x080c, 0xcf52,
+	0x0130, 0x080c, 0x750c, 0x1118, 0x080c, 0x74bd, 0x0038, 0x080c,
+	0x741a, 0x0020, 0x080c, 0x5fee, 0x080c, 0x5ee4, 0x0804, 0x3573,
+	0x81ff, 0x1904, 0x35a5, 0x080c, 0x74e9, 0x1110, 0x0804, 0x35a5,
+	0x6194, 0x81ff, 0x01a8, 0x704f, 0x0000, 0x2001, 0x1d80, 0x2009,
+	0x0040, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0126, 0x2091, 0x8000,
+	0x2039, 0x0001, 0x080c, 0x4af3, 0x701f, 0x3571, 0x012e, 0x0005,
+	0x704f, 0x0001, 0x00d6, 0x2069, 0x1d80, 0x20a9, 0x0040, 0x20e9,
+	0x0001, 0x20a1, 0x1d80, 0x2019, 0xffff, 0x4304, 0x655c, 0x9588,
+	0x3374, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e, 0x2011, 0x0002,
+	0x2100, 0x9506, 0x01a8, 0x080c, 0x6625, 0x1190, 0xb814, 0x821c,
+	0x0238, 0x9398, 0x1d80, 0x9085, 0xff00, 0x8007, 0x201a, 0x0038,
+	0x9398, 0x1d80, 0x2324, 0x94a4, 0xff00, 0x9405, 0x201a, 0x8210,
+	0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201, 0x8007, 0x2d0c,
+	0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1, 0x1d80, 0x2099,
+	0x1d80, 0x080c, 0x5f79, 0x0804, 0x4465, 0x080c, 0x4ada, 0x0904,
+	0x35a8, 0x080c, 0x4aa7, 0x1120, 0x2009, 0x0002, 0x0804, 0x35a5,
+	0x080c, 0x56da, 0xd0b4, 0x0558, 0x7884, 0x908e, 0x007e, 0x0538,
+	0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508, 0x080c, 0x3363,
+	0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084, 0x00ff, 0x9086,
+	0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c,
+	0xca07, 0x1120, 0x2009, 0x0003, 0x0804, 0x35a5, 0x7007, 0x0003,
+	0x701f, 0x44f3, 0x0005, 0x080c, 0x4ada, 0x0904, 0x35a8, 0x20a9,
+	0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080, 0x0006,
+	0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c,
+	0x0fb7, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x000a, 0x20a0,
+	0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c, 0x0fb7,
 	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-	0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804,
-	0x4aec, 0x9006, 0x080c, 0x2664, 0x78a8, 0x9084, 0x00ff, 0x9086,
-	0x00ff, 0x0118, 0x81ff, 0x1904, 0x359e, 0x080c, 0x74d5, 0x0110,
-	0x080c, 0x5fe7, 0x7888, 0x908a, 0x1000, 0x1a04, 0x35a1, 0x7984,
-	0x9186, 0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04, 0x35a1, 0x2100,
-	0x080c, 0x262e, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x2061,
-	0x1a03, 0x601b, 0x0000, 0x601f, 0x0000, 0x6073, 0x0000, 0x6077,
-	0x0000, 0x080c, 0x74d5, 0x1158, 0x080c, 0x77d9, 0x080c, 0x6022,
-	0x9085, 0x0001, 0x080c, 0x751c, 0x080c, 0x7406, 0x00f0, 0x080c,
-	0xa872, 0x080c, 0xab3a, 0x080c, 0xa88e, 0x2061, 0x0100, 0x2001,
-	0x1818, 0x2004, 0x9084, 0x00ff, 0x810f, 0x9105, 0x604a, 0x6043,
-	0x0090, 0x6043, 0x0010, 0x2009, 0x1999, 0x200b, 0x0000, 0x2009,
-	0x002d, 0x2011, 0x5f0d, 0x080c, 0x86d7, 0x7984, 0x080c, 0x74d5,
-	0x1110, 0x2009, 0x00ff, 0x7a88, 0x080c, 0x45a4, 0x012e, 0x00ce,
-	0x002e, 0x0804, 0x356c, 0x7984, 0x080c, 0x65bd, 0x2b08, 0x1904,
-	0x35a1, 0x0804, 0x356c, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-	0x359e, 0x60dc, 0xd0ac, 0x1130, 0xd09c, 0x1120, 0x2009, 0x0005,
-	0x0804, 0x359e, 0x080c, 0x4aa0, 0x1120, 0x2009, 0x0002, 0x0804,
-	0x359e, 0x7984, 0x9192, 0x0021, 0x1a04, 0x35a1, 0x7a8c, 0x7b88,
-	0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0x702a, 0xaf60, 0x7736,
-	0x080c, 0x4ae9, 0x701f, 0x47b3, 0x7880, 0x9086, 0x006e, 0x0110,
-	0x701f, 0x5189, 0x0005, 0x2009, 0x0080, 0x080c, 0x661e, 0x1118,
-	0x080c, 0x6a5b, 0x0120, 0x2021, 0x400a, 0x0804, 0x356e, 0x00d6,
-	0x0096, 0xa964, 0xaa6c, 0xab70, 0xac74, 0xad78, 0xae7c, 0xa884,
-	0x90be, 0x0100, 0x0904, 0x484c, 0x90be, 0x0112, 0x0904, 0x484c,
-	0x90be, 0x0113, 0x0904, 0x484c, 0x90be, 0x0114, 0x0904, 0x484c,
-	0x90be, 0x0117, 0x0904, 0x484c, 0x90be, 0x011a, 0x0904, 0x484c,
-	0x90be, 0x011c, 0x0904, 0x484c, 0x90be, 0x0121, 0x0904, 0x4833,
-	0x90be, 0x0131, 0x0904, 0x4833, 0x90be, 0x0171, 0x0904, 0x484c,
-	0x90be, 0x0173, 0x0904, 0x484c, 0x90be, 0x01a1, 0x1128, 0xa894,
-	0x8007, 0xa896, 0x0804, 0x4857, 0x90be, 0x0212, 0x0904, 0x4840,
-	0x90be, 0x0213, 0x05e8, 0x90be, 0x0214, 0x0500, 0x90be, 0x0217,
-	0x0188, 0x90be, 0x021a, 0x1120, 0xa89c, 0x8007, 0xa89e, 0x04e0,
-	0x90be, 0x021f, 0x05c8, 0x90be, 0x0300, 0x05b0, 0x009e, 0x00de,
-	0x0804, 0x35a1, 0x7028, 0x9080, 0x0010, 0x2098, 0x20a0, 0x7034,
-	0x20e0, 0x20e8, 0x20a9, 0x0007, 0x080c, 0x4895, 0x7028, 0x9080,
-	0x000e, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001,
-	0x080c, 0x4895, 0x00c8, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0,
-	0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x48a2, 0x00b8,
-	0x7028, 0x9080, 0x000e, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8,
-	0x20a9, 0x0001, 0x080c, 0x48a2, 0x7028, 0x9080, 0x000c, 0x2098,
-	0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x04f1, 0x00c6,
-	0x080c, 0x4aa0, 0x0550, 0xa868, 0xc0fd, 0xa86a, 0xa867, 0x0119,
-	0x9006, 0xa882, 0xa87f, 0x0020, 0xa88b, 0x0001, 0x810b, 0xa9ae,
-	0xa8b2, 0xaab6, 0xabba, 0xacbe, 0xadc2, 0xa9c6, 0xa8ca, 0x00ce,
-	0x009e, 0x00de, 0xa866, 0xa822, 0xa868, 0xc0fd, 0xa86a, 0xa804,
-	0x2048, 0x080c, 0xc9a4, 0x1120, 0x2009, 0x0003, 0x0804, 0x359e,
-	0x7007, 0x0003, 0x701f, 0x488c, 0x0005, 0x00ce, 0x009e, 0x00de,
-	0x2009, 0x0002, 0x0804, 0x359e, 0xa820, 0x9086, 0x8001, 0x1904,
-	0x356c, 0x2009, 0x0004, 0x0804, 0x359e, 0x0016, 0x0026, 0x3510,
-	0x20a9, 0x0002, 0x4002, 0x4104, 0x4004, 0x8211, 0x1dc8, 0x002e,
-	0x001e, 0x0005, 0x0016, 0x0026, 0x0036, 0x0046, 0x3520, 0x20a9,
-	0x0004, 0x4002, 0x4304, 0x4204, 0x4104, 0x4004, 0x8421, 0x1db8,
-	0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x81ff, 0x0120, 0x2009,
-	0x0001, 0x0804, 0x359e, 0x60dc, 0xd0ac, 0x1130, 0xd09c, 0x1120,
-	0x2009, 0x0005, 0x0804, 0x359e, 0x7984, 0x78a8, 0x2040, 0x080c,
-	0xab33, 0x1120, 0x9182, 0x007f, 0x0a04, 0x35a1, 0x9186, 0x00ff,
-	0x0904, 0x35a1, 0x9182, 0x0800, 0x1a04, 0x35a1, 0x7a8c, 0x7b88,
-	0x607c, 0x9306, 0x1140, 0x6080, 0x924e, 0x0904, 0x35a1, 0x99cc,
-	0xff00, 0x0904, 0x35a1, 0x0126, 0x2091, 0x8000, 0x080c, 0x49b3,
-	0x0904, 0x4933, 0x0086, 0x90c6, 0x4000, 0x008e, 0x1538, 0x00c6,
-	0x0006, 0x0036, 0xb818, 0xbb1c, 0x9305, 0xbb20, 0x9305, 0xbb24,
-	0x9305, 0xbb28, 0x9305, 0xbb2c, 0x9305, 0xbb30, 0x9305, 0xbb34,
-	0x9305, 0x003e, 0x0570, 0xd88c, 0x1128, 0x080c, 0x6a5b, 0x0110,
-	0xc89d, 0x0438, 0x900e, 0x080c, 0x690d, 0x1108, 0xc185, 0xb800,
-	0xd0bc, 0x0108, 0xc18d, 0x000e, 0x00ce, 0x00b8, 0x90c6, 0x4007,
-	0x1110, 0x2408, 0x0090, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610,
-	0x0060, 0x90c6, 0x4009, 0x1108, 0x0040, 0x90c6, 0x4006, 0x1108,
-	0x0020, 0x2001, 0x4005, 0x2009, 0x000a, 0x2020, 0x012e, 0x0804,
-	0x356e, 0x000e, 0x00ce, 0x2b00, 0x7026, 0x0016, 0x00b6, 0x00c6,
-	0x00e6, 0x2c70, 0x080c, 0xac3b, 0x0904, 0x4988, 0x2b00, 0x6012,
-	0x080c, 0xcca8, 0x2e58, 0x00ee, 0x00e6, 0x00c6, 0x080c, 0x4aa0,
-	0x00ce, 0x2b70, 0x1158, 0x080c, 0xabc9, 0x00ee, 0x00ce, 0x00be,
-	0x001e, 0x012e, 0x2009, 0x0002, 0x0804, 0x359e, 0x900e, 0xa966,
-	0xa96a, 0x2900, 0x6016, 0xa932, 0xa868, 0xc0fd, 0xd88c, 0x0108,
-	0xc0f5, 0xa86a, 0xd89c, 0x1110, 0x080c, 0x31e4, 0x6023, 0x0001,
-	0x9006, 0x080c, 0x655a, 0xd89c, 0x0138, 0x2001, 0x0004, 0x080c,
-	0x656e, 0x2009, 0x0003, 0x0030, 0x2001, 0x0002, 0x080c, 0x656e,
-	0x2009, 0x0002, 0x080c, 0xac68, 0x78a8, 0xd094, 0x0138, 0x00ee,
-	0x7024, 0x00e6, 0x2058, 0xb8d4, 0xc08d, 0xb8d6, 0x9085, 0x0001,
-	0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x1120, 0x2009, 0x0003,
-	0x0804, 0x359e, 0x7007, 0x0003, 0x701f, 0x4997, 0x0005, 0xa830,
-	0x9086, 0x0100, 0x7024, 0x2058, 0x1138, 0x2009, 0x0004, 0xba04,
-	0x9294, 0x00ff, 0x0804, 0x5630, 0x900e, 0xa868, 0xd0f4, 0x1904,
-	0x356c, 0x080c, 0x690d, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0x0804, 0x356c, 0x00e6, 0x00d6, 0x0096, 0x83ff, 0x0904,
-	0x4a02, 0x902e, 0x080c, 0xab33, 0x0130, 0x9026, 0x20a9, 0x0800,
-	0x2071, 0x1000, 0x0030, 0x2021, 0x007f, 0x20a9, 0x0781, 0x2071,
-	0x107f, 0x2e04, 0x9005, 0x11b8, 0x2100, 0x9406, 0x1904, 0x4a13,
-	0x2428, 0x94ce, 0x007f, 0x1120, 0x92ce, 0xfffd, 0x1558, 0x0030,
-	0x94ce, 0x0080, 0x1130, 0x92ce, 0xfffc, 0x1520, 0x93ce, 0x00ff,
-	0x1508, 0xc5fd, 0x0480, 0x2058, 0xbf10, 0x2700, 0x9306, 0x11e8,
-	0xbe14, 0x2600, 0x9206, 0x11c8, 0x2400, 0x9106, 0x1180, 0xd884,
-	0x0598, 0xd894, 0x1588, 0x080c, 0x69fb, 0x1570, 0x2001, 0x4000,
-	0x0460, 0x080c, 0x6a5b, 0x1540, 0x2001, 0x4000, 0x0430, 0x2001,
-	0x4007, 0x0418, 0x2001, 0x4006, 0x0400, 0x2400, 0x9106, 0x1158,
-	0xbe14, 0x87ff, 0x1128, 0x86ff, 0x0918, 0x080c, 0xab33, 0x1900,
-	0x2001, 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04, 0x49c9, 0x85ff,
-	0x1130, 0x2001, 0x4009, 0x0048, 0x2001, 0x0001, 0x0030, 0x080c,
-	0x65bd, 0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005, 0x009e, 0x00de,
-	0x00ee, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x359e,
-	0x080c, 0x4aa0, 0x1120, 0x2009, 0x0002, 0x0804, 0x359e, 0xa867,
-	0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005, 0x0904, 0x35a1,
-	0x9096, 0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04, 0x35a1, 0x2010,
-	0x2918, 0x080c, 0x317e, 0x1120, 0x2009, 0x0003, 0x0804, 0x359e,
-	0x7007, 0x0003, 0x701f, 0x4a55, 0x0005, 0xa830, 0x9086, 0x0100,
-	0x1904, 0x356c, 0x2009, 0x0004, 0x0804, 0x359e, 0x7984, 0x080c,
-	0xab33, 0x1120, 0x9182, 0x007f, 0x0a04, 0x35a1, 0x9186, 0x00ff,
-	0x0904, 0x35a1, 0x9182, 0x0800, 0x1a04, 0x35a1, 0x2001, 0x9000,
-	0x080c, 0x568b, 0x1904, 0x359e, 0x0804, 0x356c, 0xa998, 0x080c,
-	0xab33, 0x1118, 0x9182, 0x007f, 0x0280, 0x9186, 0x00ff, 0x0168,
-	0x9182, 0x0800, 0x1250, 0x2001, 0x9000, 0x080c, 0x568b, 0x11a8,
-	0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x2009, 0x000a, 0x0c48,
-	0x080c, 0x103a, 0x0198, 0x9006, 0xa802, 0x7014, 0x9005, 0x1120,
-	0x2900, 0x7016, 0x701a, 0x0040, 0x7018, 0xa802, 0x0086, 0x2040,
-	0x2900, 0xa006, 0x701a, 0x008e, 0x9085, 0x0001, 0x0005, 0x7984,
-	0x080c, 0x661e, 0x1130, 0x7e88, 0x9684, 0x3fff, 0x9082, 0x4000,
-	0x0208, 0x905e, 0x8bff, 0x0005, 0xa998, 0x080c, 0x661e, 0x1130,
-	0xae9c, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e, 0x8bff,
-	0x0005, 0xae98, 0x0008, 0x7e84, 0x2608, 0x080c, 0x661e, 0x1108,
-	0x0008, 0x905e, 0x8bff, 0x0005, 0x0016, 0x7114, 0x81ff, 0x0128,
-	0x2148, 0xa904, 0x080c, 0x106c, 0x0cc8, 0x7116, 0x711a, 0x001e,
-	0x0005, 0x2031, 0x0001, 0x0010, 0x2031, 0x0000, 0x2061, 0x18b8,
-	0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496,
-	0xa59a, 0x080c, 0x1124, 0x7007, 0x0002, 0x701f, 0x356c, 0x0005,
-	0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0000, 0x2001, 0x18b0,
-	0x2004, 0x9005, 0x1190, 0x0e04, 0x4b1d, 0x7a36, 0x7833, 0x0012,
-	0x7a82, 0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-	0xd084, 0x190c, 0x11d6, 0x0804, 0x4b83, 0x0016, 0x0086, 0x0096,
-	0x00c6, 0x00e6, 0x2071, 0x189e, 0x7044, 0x9005, 0x1540, 0x7148,
-	0x9182, 0x0010, 0x0288, 0x7038, 0x2060, 0x080c, 0x103a, 0x0904,
-	0x4b7b, 0xa84b, 0x0000, 0x2900, 0x7046, 0x2001, 0x0002, 0x9080,
-	0x1e55, 0x2005, 0xa846, 0x0098, 0x7038, 0x90e0, 0x0004, 0x2001,
-	0x18ba, 0x9c82, 0x18fa, 0x0210, 0x2061, 0x18ba, 0x2c00, 0x703a,
-	0x7148, 0x81ff, 0x1108, 0x703e, 0x8108, 0x714a, 0x0460, 0x7148,
-	0x8108, 0x714a, 0x7044, 0x2040, 0xa144, 0x2105, 0x0016, 0x908a,
-	0x0036, 0x1a0c, 0x0d7d, 0x2060, 0x001e, 0x8108, 0x2105, 0x9005,
-	0xa146, 0x1520, 0x080c, 0x103a, 0x1130, 0x8109, 0xa946, 0x7148,
-	0x8109, 0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a, 0xa046, 0x2800,
-	0xa802, 0x2900, 0xa006, 0x7046, 0x2001, 0x0002, 0x9080, 0x1e55,
-	0x2005, 0xa846, 0x0058, 0x2262, 0x6306, 0x640a, 0x00ee, 0x00ce,
-	0x009e, 0x008e, 0x001e, 0x012e, 0x00fe, 0x0005, 0x2c00, 0x9082,
-	0x001b, 0x0002, 0x4ba5, 0x4ba5, 0x4ba7, 0x4ba5, 0x4ba5, 0x4ba5,
-	0x4bab, 0x4ba5, 0x4ba5, 0x4ba5, 0x4baf, 0x4ba5, 0x4ba5, 0x4ba5,
-	0x4bb3, 0x4ba5, 0x4ba5, 0x4ba5, 0x4bb7, 0x4ba5, 0x4ba5, 0x4ba5,
-	0x4bbb, 0x4ba5, 0x4ba5, 0x4ba5, 0x4bc0, 0x080c, 0x0d7d, 0xa276,
-	0xa37a, 0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e, 0x0878, 0xa296,
-	0xa39a, 0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae, 0x0838, 0xa2b6,
-	0xa3ba, 0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce, 0x0804, 0x4b7e,
-	0xa2d6, 0xa3da, 0xa4de, 0x0804, 0x4b7e, 0x00e6, 0x2071, 0x189e,
-	0x7048, 0x9005, 0x0904, 0x4c57, 0x0126, 0x2091, 0x8000, 0x0e04,
-	0x4c56, 0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096, 0x0086, 0x0076,
-	0x9006, 0x2038, 0x7040, 0x2048, 0x9005, 0x0500, 0xa948, 0x2105,
-	0x0016, 0x908a, 0x0036, 0x1a0c, 0x0d7d, 0x2060, 0x001e, 0x8108,
-	0x2105, 0x9005, 0xa94a, 0x1904, 0x4c59, 0xa804, 0x9005, 0x090c,
-	0x0d7d, 0x7042, 0x2938, 0x2040, 0xa003, 0x0000, 0x2001, 0x0002,
-	0x9080, 0x1e55, 0x2005, 0xa04a, 0x0804, 0x4c59, 0x703c, 0x2060,
-	0x2c14, 0x6304, 0x6408, 0x650c, 0x2200, 0x7836, 0x7833, 0x0012,
-	0x7882, 0x2300, 0x7886, 0x2400, 0x788a, 0x2091, 0x4080, 0x2001,
-	0x0089, 0x2004, 0xd084, 0x190c, 0x11d6, 0x87ff, 0x0118, 0x2748,
-	0x080c, 0x106c, 0x7048, 0x8001, 0x704a, 0x9005, 0x1170, 0x7040,
-	0x2048, 0x9005, 0x0128, 0x080c, 0x106c, 0x9006, 0x7042, 0x7046,
-	0x703b, 0x18ba, 0x703f, 0x18ba, 0x0420, 0x7040, 0x9005, 0x1508,
-	0x7238, 0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004, 0x90fa, 0x18fa,
-	0x0210, 0x2001, 0x18ba, 0x703e, 0x00a0, 0x9006, 0x703e, 0x703a,
-	0x7044, 0x9005, 0x090c, 0x0d7d, 0x2048, 0xa800, 0x9005, 0x1de0,
-	0x2900, 0x7042, 0x2001, 0x0002, 0x9080, 0x1e55, 0x2005, 0xa84a,
-	0x0000, 0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe, 0x012e, 0x00ee,
-	0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4c78, 0x4c78, 0x4c7a,
-	0x4c78, 0x4c78, 0x4c78, 0x4c7f, 0x4c78, 0x4c78, 0x4c78, 0x4c84,
-	0x4c78, 0x4c78, 0x4c78, 0x4c89, 0x4c78, 0x4c78, 0x4c78, 0x4c8e,
-	0x4c78, 0x4c78, 0x4c78, 0x4c93, 0x4c78, 0x4c78, 0x4c78, 0x4c98,
-	0x080c, 0x0d7d, 0xaa74, 0xab78, 0xac7c, 0x0804, 0x4c04, 0xaa84,
-	0xab88, 0xac8c, 0x0804, 0x4c04, 0xaa94, 0xab98, 0xac9c, 0x0804,
-	0x4c04, 0xaaa4, 0xaba8, 0xacac, 0x0804, 0x4c04, 0xaab4, 0xabb8,
-	0xacbc, 0x0804, 0x4c04, 0xaac4, 0xabc8, 0xaccc, 0x0804, 0x4c04,
-	0xaad4, 0xabd8, 0xacdc, 0x0804, 0x4c04, 0x0016, 0x0026, 0x0036,
-	0x00b6, 0x00c6, 0x2009, 0x007e, 0x080c, 0x661e, 0x2019, 0x0001,
-	0xb85c, 0xd0ac, 0x0110, 0x2019, 0x0000, 0x2011, 0x801b, 0x080c,
-	0x4b00, 0x00ce, 0x00be, 0x003e, 0x002e, 0x001e, 0x0005, 0x0026,
-	0x080c, 0x56d3, 0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c, 0x4b00,
-	0x002e, 0x0005, 0x81ff, 0x1904, 0x359e, 0x0126, 0x2091, 0x8000,
-	0x6030, 0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c, 0x74d5, 0x1158,
-	0x080c, 0x77d9, 0x080c, 0x6022, 0x9085, 0x0001, 0x080c, 0x751c,
-	0x080c, 0x7406, 0x0010, 0x080c, 0x5edd, 0x012e, 0x0804, 0x356c,
-	0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x359e, 0x080c, 0x56e7,
-	0x0120, 0x2009, 0x0007, 0x0804, 0x359e, 0x080c, 0x6a53, 0x0120,
-	0x2009, 0x0008, 0x0804, 0x359e, 0x080c, 0x335c, 0x0128, 0x7984,
-	0x080c, 0x65bd, 0x1904, 0x35a1, 0x080c, 0x4ad3, 0x0904, 0x35a1,
-	0x2b00, 0x7026, 0x080c, 0x6a5b, 0x7888, 0x1170, 0x9084, 0x0005,
-	0x1158, 0x900e, 0x080c, 0x690d, 0x1108, 0xc185, 0xb800, 0xd0bc,
-	0x0108, 0xc18d, 0x0804, 0x356c, 0x080c, 0x4aa0, 0x0904, 0x359e,
-	0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xca46,
-	0x0904, 0x359e, 0x7888, 0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6,
-	0x7007, 0x0003, 0x701f, 0x4d79, 0x0005, 0x2061, 0x1800, 0x080c,
-	0x56e7, 0x2009, 0x0007, 0x1578, 0x080c, 0x6a53, 0x0118, 0x2009,
-	0x0008, 0x0448, 0x080c, 0x335c, 0x0120, 0xa998, 0x080c, 0x65bd,
-	0x1530, 0x080c, 0x4ad1, 0x0518, 0x080c, 0x6a5b, 0xa89c, 0x1168,
-	0x9084, 0x0005, 0x1150, 0x900e, 0x080c, 0x690d, 0x1108, 0xc185,
-	0xb800, 0xd0bc, 0x0108, 0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a,
-	0x080c, 0xca46, 0x11e0, 0xa89c, 0xd094, 0x0118, 0xb8d4, 0xc08d,
-	0xb8d6, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
-	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
-	0x4000, 0xa99a, 0x9006, 0x918d, 0x0001, 0x2008, 0x0005, 0x9006,
-	0x0005, 0xa830, 0x9086, 0x0100, 0x7024, 0x2058, 0x1110, 0x0804,
-	0x5630, 0x900e, 0x080c, 0x690d, 0x1108, 0xc185, 0xb800, 0xd0bc,
-	0x0108, 0xc18d, 0x0804, 0x356c, 0x080c, 0x56e7, 0x0120, 0x2009,
-	0x0007, 0x0804, 0x359e, 0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0x080c, 0x4aa0, 0x1120, 0x2009, 0x0002, 0x0804, 0x359e, 0x900e,
-	0x2130, 0x7126, 0x7132, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080,
-	0x0005, 0x702a, 0x20a0, 0x080c, 0x661e, 0x1904, 0x4e1b, 0x080c,
-	0x6a5b, 0x0138, 0x080c, 0x6a63, 0x0120, 0x080c, 0x69fb, 0x1904,
-	0x4e1b, 0xd794, 0x1110, 0xd784, 0x01a8, 0xb8c4, 0x20e0, 0xb8c8,
-	0x9080, 0x0006, 0x2098, 0x3400, 0xd794, 0x0160, 0x20a9, 0x0008,
-	0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x20a9, 0x0002, 0x080c,
-	0x48a2, 0x0048, 0x20a9, 0x0004, 0x4003, 0x2098, 0x20a0, 0x3d00,
-	0x20e0, 0x080c, 0x48a2, 0x9186, 0x007e, 0x0170, 0x9186, 0x0080,
-	0x0158, 0x080c, 0x6a5b, 0x90c2, 0x0006, 0x1210, 0xc1fd, 0x0020,
-	0x080c, 0x690d, 0x1108, 0xc1fd, 0x4104, 0xc1fc, 0xd794, 0x0528,
-	0xb8c4, 0x20e0, 0xb8c8, 0x2060, 0x9c80, 0x0000, 0x2098, 0x20a9,
-	0x0002, 0x4003, 0x9c80, 0x0003, 0x2098, 0x20a9, 0x0001, 0x4005,
-	0x9c80, 0x0004, 0x2098, 0x3400, 0x20a9, 0x0002, 0x4003, 0x2098,
-	0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4895, 0x9c80, 0x0026, 0x2098,
-	0xb8c4, 0x20e0, 0x20a9, 0x0002, 0x4003, 0xd794, 0x0110, 0x96b0,
-	0x000b, 0x96b0, 0x0005, 0x8108, 0x080c, 0xab33, 0x0118, 0x9186,
-	0x0800, 0x0040, 0xd78c, 0x0120, 0x9186, 0x0800, 0x0170, 0x0018,
-	0x9186, 0x007e, 0x0150, 0xd794, 0x0118, 0x9686, 0x0020, 0x0010,
-	0x9686, 0x0028, 0x0150, 0x0804, 0x4dab, 0x86ff, 0x1120, 0x7124,
-	0x810b, 0x0804, 0x356c, 0x7033, 0x0001, 0x7122, 0x7024, 0x9600,
-	0x7026, 0x772e, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa67a,
-	0x7034, 0xa072, 0x7028, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a,
-	0x080c, 0x1124, 0x7007, 0x0002, 0x701f, 0x4e57, 0x0005, 0x7030,
-	0x9005, 0x1180, 0x7120, 0x7028, 0x20a0, 0x772c, 0x9036, 0x7034,
-	0x20e8, 0x2061, 0x18b8, 0x2c44, 0xa28c, 0xa390, 0xa494, 0xa598,
-	0x0804, 0x4dab, 0x7124, 0x810b, 0x0804, 0x356c, 0x2029, 0x007e,
-	0x7984, 0x7a88, 0x7b8c, 0x7c98, 0x9184, 0xff00, 0x8007, 0x90e2,
-	0x0020, 0x0a04, 0x35a1, 0x9502, 0x0a04, 0x35a1, 0x9184, 0x00ff,
-	0x90e2, 0x0020, 0x0a04, 0x35a1, 0x9502, 0x0a04, 0x35a1, 0x9284,
-	0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x35a1, 0x9502, 0x0a04,
-	0x35a1, 0x9284, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x35a1, 0x9502,
-	0x0a04, 0x35a1, 0x9384, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04,
-	0x35a1, 0x9502, 0x0a04, 0x35a1, 0x9384, 0x00ff, 0x90e2, 0x0020,
-	0x0a04, 0x35a1, 0x9502, 0x0a04, 0x35a1, 0x9484, 0xff00, 0x8007,
-	0x90e2, 0x0020, 0x0a04, 0x35a1, 0x9502, 0x0a04, 0x35a1, 0x9484,
-	0x00ff, 0x90e2, 0x0020, 0x0a04, 0x35a1, 0x9502, 0x0a04, 0x35a1,
-	0x2061, 0x1989, 0x6102, 0x6206, 0x630a, 0x640e, 0x0804, 0x356c,
-	0x080c, 0x4aa0, 0x0904, 0x359e, 0x2009, 0x0016, 0x7a8c, 0x7b88,
-	0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4ae9,
-	0x701f, 0x4edb, 0x0005, 0x2001, 0x0138, 0x2003, 0x0000, 0x00e6,
-	0x2071, 0x0300, 0x701c, 0xd0a4, 0x1de8, 0x00ee, 0x20a9, 0x0016,
-	0x896e, 0x8d6e, 0x8d6f, 0x9d84, 0xffc0, 0x9080, 0x0019, 0x2098,
-	0x9d84, 0x003f, 0x20e0, 0x2069, 0x1877, 0x20e9, 0x0001, 0x2da0,
-	0x4003, 0x6800, 0x9005, 0x0904, 0x4f5c, 0x6804, 0x2008, 0x918c,
-	0xfff8, 0x1904, 0x4f5c, 0x680c, 0x9005, 0x0904, 0x4f5c, 0x9082,
-	0xff01, 0x1a04, 0x4f5c, 0x6810, 0x9082, 0x005c, 0x0a04, 0x4f5c,
-	0x6824, 0x2008, 0x9082, 0x0008, 0x0a04, 0x4f5c, 0x9182, 0x0400,
-	0x1a04, 0x4f5c, 0x0056, 0x2029, 0x0000, 0x080c, 0x8cd9, 0x005e,
-	0x6944, 0x6820, 0x9102, 0x06c0, 0x6820, 0x9082, 0x0019, 0x16a0,
-	0x6828, 0x6944, 0x810c, 0x9102, 0x0678, 0x6840, 0x9082, 0x000f,
-	0x1658, 0x080c, 0x1053, 0x2900, 0x0904, 0x4f76, 0x684e, 0x00e6,
-	0x2071, 0x1930, 0x00b6, 0x2059, 0x0000, 0x080c, 0x8b95, 0x00be,
-	0x00ee, 0x0558, 0x080c, 0x88ef, 0x080c, 0x8935, 0x11e0, 0x6857,
-	0x0000, 0x00c6, 0x2061, 0x0100, 0x6104, 0x918d, 0x2000, 0x6106,
-	0x6b10, 0x2061, 0x1a6b, 0x630a, 0x00ce, 0x080c, 0x2713, 0x2001,
-	0x0138, 0x2102, 0x0804, 0x356c, 0x080c, 0x2713, 0x2001, 0x0138,
-	0x2102, 0x0804, 0x35a1, 0x00e6, 0x2071, 0x1930, 0x080c, 0x8d6a,
-	0x080c, 0x8d79, 0x080c, 0x8b84, 0x00ee, 0x2001, 0x188a, 0x204c,
-	0x080c, 0x106c, 0x2001, 0x188a, 0x2003, 0x0000, 0x080c, 0x2713,
-	0x2001, 0x0138, 0x2102, 0x0804, 0x359e, 0x2001, 0x1924, 0x200c,
-	0x918e, 0x0000, 0x0904, 0x4fd5, 0x080c, 0x8b7f, 0x0904, 0x4fd5,
-	0x2001, 0x0101, 0x200c, 0x918c, 0xdfff, 0x2102, 0x2001, 0x0138,
-	0x2003, 0x0000, 0x00e6, 0x2071, 0x0300, 0x701c, 0xd0a4, 0x1de8,
-	0x00ee, 0x080c, 0x8b84, 0x2001, 0x0035, 0x080c, 0x1679, 0x00c6,
-	0x2061, 0x193c, 0x6004, 0x6100, 0x9106, 0x1de0, 0x00ce, 0x080c,
-	0x2713, 0x2001, 0x0138, 0x2102, 0x00e6, 0x00f6, 0x2071, 0x1923,
-	0x080c, 0x8ac0, 0x0120, 0x2f00, 0x080c, 0x8b4a, 0x0cc8, 0x00fe,
-	0x00ee, 0x0126, 0x2091, 0x8000, 0x2001, 0x188a, 0x200c, 0x81ff,
-	0x0138, 0x2148, 0x080c, 0x106c, 0x2001, 0x188a, 0x2003, 0x0000,
-	0x2001, 0x183d, 0x2003, 0x0020, 0x00e6, 0x2071, 0x1930, 0x080c,
-	0x8d6a, 0x080c, 0x8d79, 0x00ee, 0x012e, 0x0804, 0x356c, 0x0006,
-	0x080c, 0x56d3, 0xd0cc, 0x000e, 0x0005, 0x0006, 0x080c, 0x56d7,
-	0xd0bc, 0x000e, 0x0005, 0x6174, 0x7a84, 0x6300, 0x82ff, 0x1118,
-	0x7986, 0x0804, 0x356c, 0x83ff, 0x1904, 0x35a1, 0x2001, 0xfff0,
-	0x9200, 0x1a04, 0x35a1, 0x2019, 0xffff, 0x6078, 0x9302, 0x9200,
-	0x0a04, 0x35a1, 0x7986, 0x6276, 0x0804, 0x356c, 0x080c, 0x56e7,
-	0x1904, 0x359e, 0x7c88, 0x7d84, 0x7e98, 0x7f8c, 0x080c, 0x4aa0,
-	0x0904, 0x359e, 0x900e, 0x901e, 0x7326, 0x7332, 0xa860, 0x20e8,
-	0x7036, 0xa85c, 0x9080, 0x0003, 0x702a, 0x20a0, 0x91d8, 0x1000,
-	0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6a5b, 0x0118, 0x080c, 0x6a63,
-	0x1148, 0x20a9, 0x0001, 0xb814, 0x4004, 0xb810, 0x4004, 0x4104,
-	0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c,
-	0x0170, 0x0c20, 0x83ff, 0x1148, 0x7224, 0x900e, 0x2001, 0x0003,
-	0x080c, 0x9135, 0x2208, 0x0804, 0x356c, 0x7033, 0x0001, 0x7122,
-	0x7024, 0x9300, 0x7026, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000,
-	0xa37a, 0x7028, 0xa076, 0x7034, 0xa072, 0xa48e, 0xa592, 0xa696,
-	0xa79a, 0x080c, 0x1124, 0x7007, 0x0002, 0x701f, 0x5058, 0x0005,
-	0x7030, 0x9005, 0x1178, 0x7120, 0x7028, 0x20a0, 0x901e, 0x7034,
-	0x20e8, 0x2061, 0x18b8, 0x2c44, 0xa48c, 0xa590, 0xa694, 0xa798,
-	0x0804, 0x5016, 0x7224, 0x900e, 0x2001, 0x0003, 0x080c, 0x9135,
-	0x2208, 0x0804, 0x356c, 0x00f6, 0x00e6, 0x080c, 0x56e7, 0x2009,
-	0x0007, 0x1904, 0x50eb, 0x2071, 0x189e, 0x745c, 0x84ff, 0x2009,
-	0x000e, 0x1904, 0x50eb, 0xac9c, 0xad98, 0xaea4, 0xafa0, 0x0096,
-	0x080c, 0x1053, 0x2009, 0x0002, 0x0904, 0x50eb, 0x2900, 0x705e,
-	0x900e, 0x901e, 0x7356, 0x7362, 0xa860, 0x7066, 0xa85c, 0x9080,
-	0x0003, 0x705a, 0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178,
-	0x080c, 0x6a5b, 0x0118, 0x080c, 0x6a63, 0x1148, 0xb814, 0x20a9,
-	0x0001, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108,
-	0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x01e8, 0x0c20, 0x83ff,
-	0x11c0, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x9135, 0x2208,
-	0x009e, 0xa897, 0x4000, 0xa99a, 0x715c, 0x81ff, 0x090c, 0x0d7d,
-	0x2148, 0x080c, 0x106c, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008,
-	0x0418, 0x7063, 0x0001, 0x7152, 0x7054, 0x9300, 0x7056, 0x2061,
-	0x18b9, 0x2c44, 0xa37a, 0x7058, 0xa076, 0x7064, 0xa072, 0xa48e,
-	0xa592, 0xa696, 0xa79a, 0xa09f, 0x50f7, 0x000e, 0xa0a2, 0x080c,
-	0x1124, 0x9006, 0x0048, 0x009e, 0xa897, 0x4005, 0xa99a, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0030, 0x00ee, 0x00fe, 0x0005, 0x00f6,
-	0xa0a0, 0x904d, 0x090c, 0x0d7d, 0x00e6, 0x2071, 0x189e, 0xa06c,
-	0x908e, 0x0100, 0x0138, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
-	0x4002, 0x00d8, 0x7060, 0x9005, 0x1158, 0x7150, 0x7058, 0x20a0,
-	0x901e, 0x7064, 0x20e8, 0xa48c, 0xa590, 0xa694, 0xa798, 0x0428,
-	0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x7254, 0x900e,
-	0x2001, 0x0003, 0x080c, 0x9135, 0xaa9a, 0x715c, 0x81ff, 0x090c,
-	0x0d7d, 0x2148, 0x080c, 0x106c, 0x705f, 0x0000, 0xa0a0, 0x2048,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x6d70, 0x012e, 0xa09f, 0x0000,
-	0xa0a3, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x91d8, 0x1000, 0x2b5c,
-	0x8bff, 0x0178, 0x080c, 0x6a5b, 0x0118, 0x080c, 0x6a63, 0x1148,
-	0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398,
-	0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x0518,
-	0x0c20, 0x83ff, 0x11f0, 0x7154, 0x810c, 0xa99a, 0xa897, 0x4000,
-	0x715c, 0x81ff, 0x090c, 0x0d7d, 0x2148, 0x080c, 0x106c, 0x9006,
-	0x705e, 0x918d, 0x0001, 0x2008, 0xa0a0, 0x2048, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x6d70, 0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000,
-	0x0070, 0x7063, 0x0001, 0x7152, 0x7054, 0x9300, 0x7056, 0xa37a,
-	0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x1124, 0x9006, 0x00ee,
-	0x0005, 0x0096, 0xa88c, 0x90be, 0x7000, 0x0148, 0x90be, 0x7100,
-	0x0130, 0x90be, 0x7200, 0x0118, 0x009e, 0x0804, 0x35a1, 0xa884,
-	0xa988, 0x080c, 0x25fb, 0x1518, 0x080c, 0x65bd, 0x1500, 0x7126,
-	0xbe12, 0xbd16, 0xae7c, 0x080c, 0x4aa0, 0x01c8, 0x080c, 0x4aa0,
-	0x01b0, 0x009e, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0xa823,
-	0x0000, 0xa804, 0x2048, 0x080c, 0xc9c4, 0x1120, 0x2009, 0x0003,
-	0x0804, 0x359e, 0x7007, 0x0003, 0x701f, 0x51c4, 0x0005, 0x009e,
-	0x2009, 0x0002, 0x0804, 0x359e, 0x7124, 0x080c, 0x32f5, 0xa820,
-	0x9086, 0x8001, 0x1120, 0x2009, 0x0004, 0x0804, 0x359e, 0x2900,
-	0x7022, 0xa804, 0x0096, 0x2048, 0x8906, 0x8006, 0x8007, 0x90bc,
-	0x003f, 0x9084, 0xffc0, 0x009e, 0x9080, 0x0002, 0x0076, 0x0006,
-	0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c, 0x0fb7,
-	0xaa6c, 0xab70, 0xac74, 0xad78, 0x2061, 0x18b8, 0x2c44, 0xa06b,
-	0x0000, 0xae64, 0xaf8c, 0x97c6, 0x7000, 0x0118, 0x97c6, 0x7100,
-	0x1148, 0x96c2, 0x0004, 0x0600, 0x2009, 0x0004, 0x000e, 0x007e,
-	0x0804, 0x4aec, 0x97c6, 0x7200, 0x11b8, 0x96c2, 0x0054, 0x02a0,
-	0x000e, 0x007e, 0x2061, 0x18b8, 0x2c44, 0xa076, 0xa772, 0xa07b,
-	0x002a, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x1124, 0x7007,
-	0x0002, 0x701f, 0x5220, 0x0005, 0x000e, 0x007e, 0x0804, 0x35a1,
-	0x7020, 0x2048, 0xa804, 0x2048, 0xa804, 0x2048, 0x8906, 0x8006,
-	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2098,
-	0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c, 0x0fb7, 0x2100,
-	0x2238, 0x2061, 0x18b8, 0x2c44, 0xa28c, 0xa390, 0xa494, 0xa598,
-	0x2009, 0x002a, 0x0804, 0x4aec, 0x81ff, 0x1904, 0x359e, 0x798c,
-	0x2001, 0x197e, 0x918c, 0x8000, 0x2102, 0x080c, 0x4ab7, 0x0904,
-	0x35a1, 0x080c, 0x6a5b, 0x0120, 0x080c, 0x6a63, 0x1904, 0x35a1,
-	0x080c, 0x66e5, 0x0904, 0x359e, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x687a, 0x012e, 0x0904, 0x359e, 0x2001, 0x197e, 0x2004, 0xd0fc,
-	0x1904, 0x356c, 0x0804, 0x4541, 0xa9a0, 0x2001, 0x197e, 0x918c,
-	0x8000, 0xc18d, 0x2102, 0x080c, 0x4ac4, 0x01a0, 0x080c, 0x6a5b,
-	0x0118, 0x080c, 0x6a63, 0x1170, 0x080c, 0x66e5, 0x2009, 0x0002,
-	0x0128, 0x080c, 0x687a, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005,
+	0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804,
+	0x4af3, 0x81ff, 0x1904, 0x35a5, 0x080c, 0x4abe, 0x0904, 0x35a8,
+	0x080c, 0x6866, 0x0904, 0x35a5, 0x0058, 0xa878, 0x9005, 0x0120,
+	0x2009, 0x0004, 0x0804, 0x35a5, 0xa974, 0xaa94, 0x0804, 0x3573,
+	0x080c, 0x56e2, 0x0904, 0x3573, 0x701f, 0x453d, 0x7007, 0x0003,
+	0x0005, 0x81ff, 0x1904, 0x35a5, 0x7888, 0x908a, 0x1000, 0x1a04,
+	0x35a8, 0x080c, 0x4ada, 0x0904, 0x35a8, 0x080c, 0x6a6b, 0x0120,
+	0x080c, 0x6a73, 0x1904, 0x35a8, 0x080c, 0x68eb, 0x0904, 0x35a5,
+	0x2019, 0x0004, 0x900e, 0x080c, 0x6878, 0x0904, 0x35a5, 0x7984,
+	0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000, 0x12f8, 0x080c,
+	0x4ad8, 0x01e0, 0x080c, 0x6a6b, 0x0118, 0x080c, 0x6a73, 0x11b0,
+	0x080c, 0x68eb, 0x2009, 0x0002, 0x0168, 0x2009, 0x0002, 0x2019,
+	0x0004, 0x080c, 0x6878, 0x2009, 0x0003, 0x0120, 0xa998, 0xaa9c,
+	0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
+	0x080c, 0x56e2, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001,
+	0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110, 0x0071, 0x0060,
+	0x2029, 0x007e, 0x2061, 0x1800, 0x645c, 0x2400, 0x9506, 0x0110,
+	0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c, 0x6625, 0x1138,
+	0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x864c, 0x0005,
+	0x81ff, 0x1904, 0x35a5, 0x798c, 0x2001, 0x1980, 0x918c, 0x8000,
+	0x2102, 0x080c, 0x4abe, 0x0904, 0x35a8, 0x080c, 0x6a6b, 0x0120,
+	0x080c, 0x6a73, 0x1904, 0x35a8, 0x080c, 0x66ec, 0x0904, 0x35a5,
+	0x080c, 0x686f, 0x0904, 0x35a5, 0x2001, 0x1980, 0x2004, 0xd0fc,
+	0x1904, 0x3573, 0x0804, 0x4548, 0xa9a0, 0x2001, 0x1980, 0x918c,
+	0x8000, 0xc18d, 0x2102, 0x080c, 0x4acb, 0x01a0, 0x080c, 0x6a6b,
+	0x0118, 0x080c, 0x6a73, 0x1170, 0x080c, 0x66ec, 0x2009, 0x0002,
+	0x0128, 0x080c, 0x686f, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005,
 	0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001,
-	0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x197e, 0x2004, 0xd0fc,
-	0x1128, 0x080c, 0x56db, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085,
-	0x0001, 0x2001, 0x0000, 0x0005, 0x78a8, 0xd08c, 0x1118, 0xd084,
-	0x0904, 0x44b6, 0x080c, 0x4ad3, 0x0904, 0x35a1, 0x080c, 0x4aa0,
-	0x1120, 0x2009, 0x0002, 0x0804, 0x359e, 0x080c, 0x6a5b, 0x0130,
-	0x908e, 0x0004, 0x0118, 0x908e, 0x0005, 0x15a0, 0x78a8, 0xd08c,
-	0x0120, 0xb800, 0xc08c, 0xb802, 0x0028, 0x080c, 0x56d3, 0xd0b4,
-	0x0904, 0x44f0, 0x7884, 0x908e, 0x007e, 0x0904, 0x44f0, 0x908e,
-	0x007f, 0x0904, 0x44f0, 0x908e, 0x0080, 0x0904, 0x44f0, 0xb800,
-	0xd08c, 0x1904, 0x44f0, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
-	0x080c, 0xc9e3, 0x1120, 0x2009, 0x0003, 0x0804, 0x359e, 0x7007,
-	0x0003, 0x701f, 0x52ec, 0x0005, 0x080c, 0x4ad3, 0x0904, 0x35a1,
-	0x0804, 0x44f0, 0x080c, 0x335c, 0x0108, 0x0005, 0x2009, 0x1834,
-	0x210c, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x359e, 0x080c,
-	0x56e7, 0x0120, 0x2009, 0x0007, 0x0804, 0x359e, 0x080c, 0x6a53,
-	0x0120, 0x2009, 0x0008, 0x0804, 0x359e, 0xb89c, 0xd0a4, 0x1118,
-	0xd0ac, 0x1904, 0x44f0, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd,
-	0xa86a, 0x080c, 0xca46, 0x1120, 0x2009, 0x0003, 0x0804, 0x359e,
-	0x7007, 0x0003, 0x701f, 0x5325, 0x0005, 0xa830, 0x9086, 0x0100,
-	0x1120, 0x2009, 0x0004, 0x0804, 0x5630, 0x080c, 0x4ad3, 0x0904,
-	0x35a1, 0x0804, 0x52be, 0x81ff, 0x2009, 0x0001, 0x1904, 0x359e,
-	0x080c, 0x56e7, 0x2009, 0x0007, 0x1904, 0x359e, 0x080c, 0x6a53,
-	0x0120, 0x2009, 0x0008, 0x0804, 0x359e, 0x080c, 0x4ad3, 0x0904,
-	0x35a1, 0x080c, 0x6a5b, 0x2009, 0x0009, 0x1904, 0x359e, 0x080c,
-	0x4aa0, 0x2009, 0x0002, 0x0904, 0x359e, 0x9006, 0xa866, 0xa832,
-	0xa868, 0xc0fd, 0xa86a, 0x7988, 0x9194, 0xff00, 0x918c, 0x00ff,
-	0x9006, 0x82ff, 0x1128, 0xc0ed, 0xa952, 0x798c, 0xa956, 0x0038,
-	0x928e, 0x0100, 0x1904, 0x35a1, 0xc0e5, 0xa952, 0xa956, 0xa83e,
-	0x080c, 0xcca9, 0x2009, 0x0003, 0x0904, 0x359e, 0x7007, 0x0003,
-	0x701f, 0x537b, 0x0005, 0xa830, 0x9086, 0x0100, 0x2009, 0x0004,
-	0x0904, 0x359e, 0x0804, 0x356c, 0x7aa8, 0x9284, 0xc000, 0x0148,
-	0xd2ec, 0x01a0, 0x080c, 0x56e7, 0x1188, 0x2009, 0x0014, 0x0804,
-	0x359e, 0xd2dc, 0x1568, 0x81ff, 0x2009, 0x0001, 0x1904, 0x359e,
-	0x080c, 0x56e7, 0x2009, 0x0007, 0x1904, 0x359e, 0xd2f4, 0x0130,
-	0x9284, 0x5000, 0x080c, 0x56ae, 0x0804, 0x356c, 0xd2fc, 0x0158,
-	0x080c, 0x4ad3, 0x0904, 0x35a1, 0x7984, 0x9284, 0x9000, 0x080c,
-	0x568b, 0x0804, 0x356c, 0x080c, 0x4ad3, 0x0904, 0x35a1, 0xb804,
-	0x9084, 0x00ff, 0x9086, 0x0006, 0x2009, 0x0009, 0x1904, 0x5464,
-	0x080c, 0x4aa0, 0x2009, 0x0002, 0x0904, 0x5464, 0xa85c, 0x9080,
-	0x001b, 0xaf60, 0x2009, 0x0008, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0x080c, 0x4ae9, 0x701f, 0x53d5, 0x0005, 0xa86c, 0x9086, 0x0500,
-	0x1138, 0xa870, 0x9005, 0x1120, 0xa874, 0x9084, 0xff00, 0x0110,
-	0x1904, 0x35a1, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c,
-	0x4ad3, 0x1110, 0x0804, 0x35a1, 0x2009, 0x0043, 0x080c, 0xcd11,
-	0x2009, 0x0003, 0x0904, 0x5464, 0x7007, 0x0003, 0x701f, 0x53f9,
-	0x0005, 0xa830, 0x9086, 0x0100, 0x2009, 0x0004, 0x0904, 0x5464,
-	0x7984, 0x7aa8, 0x9284, 0x1000, 0x080c, 0x568b, 0x0804, 0x356c,
-	0x00c6, 0xaab0, 0x9284, 0xc000, 0x0140, 0xd2ec, 0x0168, 0x080c,
-	0x56e7, 0x1150, 0x2009, 0x0014, 0x04f0, 0x2061, 0x1800, 0x080c,
-	0x56e7, 0x2009, 0x0007, 0x15b8, 0xd2f4, 0x0128, 0x9284, 0x5000,
-	0x080c, 0x56ae, 0x0050, 0xd2fc, 0x0178, 0x080c, 0x4ad1, 0x0588,
-	0xa998, 0x9284, 0x9000, 0x080c, 0x568b, 0xa87b, 0x0000, 0xa883,
-	0x0000, 0xa897, 0x4000, 0x0438, 0x080c, 0x4ad1, 0x0510, 0x080c,
-	0x6a5b, 0x2009, 0x0009, 0x11b8, 0xa8c4, 0x9086, 0x0500, 0x11c8,
-	0xa8c8, 0x9005, 0x11b0, 0xa8cc, 0x9084, 0xff00, 0x1190, 0x080c,
-	0x4ad1, 0x1108, 0x0070, 0x2009, 0x004b, 0x080c, 0xcd11, 0x2009,
-	0x0003, 0x0108, 0x0078, 0x0429, 0x19c0, 0xa897, 0x4005, 0xa99a,
+	0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1980, 0x2004, 0xd0fc,
+	0x1128, 0x080c, 0x56e2, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904, 0x35a5, 0x798c,
+	0x2001, 0x197f, 0x918c, 0x8000, 0x2102, 0x080c, 0x4abe, 0x0904,
+	0x35a8, 0x080c, 0x6a6b, 0x0120, 0x080c, 0x6a73, 0x1904, 0x35a8,
+	0x080c, 0x66ec, 0x0904, 0x35a5, 0x080c, 0x685d, 0x0904, 0x35a5,
+	0x2001, 0x197f, 0x2004, 0xd0fc, 0x1904, 0x3573, 0x0804, 0x4548,
+	0xa9a0, 0x2001, 0x197f, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c,
+	0x4acb, 0x01a0, 0x080c, 0x6a6b, 0x0118, 0x080c, 0x6a73, 0x1170,
+	0x080c, 0x66ec, 0x2009, 0x0002, 0x0128, 0x080c, 0x685d, 0x1170,
+	0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
+	0x2001, 0x197f, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x56e2, 0x0110,
+	0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005,
+	0x6100, 0x0804, 0x3573, 0x080c, 0x4ada, 0x0904, 0x35a8, 0x080c,
+	0x56ee, 0x1904, 0x35a5, 0x79a8, 0xd184, 0x1158, 0xb834, 0x8007,
+	0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f, 0xba28, 0x8217,
+	0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007, 0x789a, 0xbb1c,
+	0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0200, 0x0804, 0x3573,
+	0x78a8, 0x909c, 0x0003, 0xd0b4, 0x1140, 0x939a, 0x0003, 0x1a04,
+	0x35a5, 0x625c, 0x7884, 0x9206, 0x1548, 0x080c, 0x87bb, 0x2001,
+	0xfff4, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039,
+	0x0000, 0x0006, 0x78a8, 0x9084, 0x0080, 0x1118, 0x000e, 0x0804,
+	0x4af3, 0x000e, 0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44, 0xa66a,
+	0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c,
+	0x1124, 0x7007, 0x0002, 0x701f, 0x46fe, 0x0005, 0x81ff, 0x1904,
+	0x35a5, 0x080c, 0x4ada, 0x0904, 0x35a8, 0x080c, 0x6a6b, 0x1904,
+	0x35a5, 0x00c6, 0x080c, 0x4aa7, 0x00ce, 0x0904, 0x35a5, 0xa867,
+	0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7ea8, 0x080c, 0xc9ad, 0x0904,
+	0x35a5, 0x7007, 0x0003, 0x701f, 0x4702, 0x0005, 0x080c, 0x4246,
+	0x0804, 0x3573, 0xa830, 0x9086, 0x0100, 0x0904, 0x35a5, 0x8906,
+	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b,
+	0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x4af3,
+	0x9006, 0x080c, 0x2664, 0x78a8, 0x9084, 0x00ff, 0x9086, 0x00ff,
+	0x0118, 0x81ff, 0x1904, 0x35a5, 0x080c, 0x74e9, 0x0110, 0x080c,
+	0x5fee, 0x7888, 0x908a, 0x1000, 0x1a04, 0x35a8, 0x7984, 0x9186,
+	0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04, 0x35a8, 0x2100, 0x080c,
+	0x262e, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x2061, 0x1a03,
+	0x601b, 0x0000, 0x601f, 0x0000, 0x6073, 0x0000, 0x6077, 0x0000,
+	0x080c, 0x74e9, 0x1158, 0x080c, 0x77ed, 0x080c, 0x6029, 0x9085,
+	0x0001, 0x080c, 0x7530, 0x080c, 0x741a, 0x00f0, 0x080c, 0xa896,
+	0x080c, 0xab5e, 0x080c, 0xa8b2, 0x2061, 0x0100, 0x2001, 0x1818,
+	0x2004, 0x9084, 0x00ff, 0x810f, 0x9105, 0x604a, 0x6043, 0x0090,
+	0x6043, 0x0010, 0x2009, 0x1999, 0x200b, 0x0000, 0x2009, 0x002d,
+	0x2011, 0x5f14, 0x080c, 0x8708, 0x7984, 0x080c, 0x74e9, 0x1110,
+	0x2009, 0x00ff, 0x7a88, 0x080c, 0x45ab, 0x012e, 0x00ce, 0x002e,
+	0x0804, 0x3573, 0x7984, 0x080c, 0x65c4, 0x2b08, 0x1904, 0x35a8,
+	0x0804, 0x3573, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35a5,
+	0x60dc, 0xd0ac, 0x1130, 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804,
+	0x35a5, 0x080c, 0x4aa7, 0x1120, 0x2009, 0x0002, 0x0804, 0x35a5,
+	0x7984, 0x9192, 0x0021, 0x1a04, 0x35a8, 0x7a8c, 0x7b88, 0x7c9c,
+	0x7d98, 0xa85c, 0x9080, 0x0019, 0x702a, 0xaf60, 0x7736, 0x080c,
+	0x4af0, 0x701f, 0x47ba, 0x7880, 0x9086, 0x006e, 0x0110, 0x701f,
+	0x5190, 0x0005, 0x2009, 0x0080, 0x080c, 0x6625, 0x1118, 0x080c,
+	0x6a6b, 0x0120, 0x2021, 0x400a, 0x0804, 0x3575, 0x00d6, 0x0096,
+	0xa964, 0xaa6c, 0xab70, 0xac74, 0xad78, 0xae7c, 0xa884, 0x90be,
+	0x0100, 0x0904, 0x4853, 0x90be, 0x0112, 0x0904, 0x4853, 0x90be,
+	0x0113, 0x0904, 0x4853, 0x90be, 0x0114, 0x0904, 0x4853, 0x90be,
+	0x0117, 0x0904, 0x4853, 0x90be, 0x011a, 0x0904, 0x4853, 0x90be,
+	0x011c, 0x0904, 0x4853, 0x90be, 0x0121, 0x0904, 0x483a, 0x90be,
+	0x0131, 0x0904, 0x483a, 0x90be, 0x0171, 0x0904, 0x4853, 0x90be,
+	0x0173, 0x0904, 0x4853, 0x90be, 0x01a1, 0x1128, 0xa894, 0x8007,
+	0xa896, 0x0804, 0x485e, 0x90be, 0x0212, 0x0904, 0x4847, 0x90be,
+	0x0213, 0x05e8, 0x90be, 0x0214, 0x0500, 0x90be, 0x0217, 0x0188,
+	0x90be, 0x021a, 0x1120, 0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be,
+	0x021f, 0x05c8, 0x90be, 0x0300, 0x05b0, 0x009e, 0x00de, 0x0804,
+	0x35a8, 0x7028, 0x9080, 0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0,
+	0x20e8, 0x20a9, 0x0007, 0x080c, 0x489c, 0x7028, 0x9080, 0x000e,
+	0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c,
+	0x489c, 0x00c8, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034,
+	0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x48a9, 0x00b8, 0x7028,
+	0x9080, 0x000e, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9,
+	0x0001, 0x080c, 0x48a9, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0,
+	0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c,
+	0x4aa7, 0x0550, 0xa868, 0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006,
+	0xa882, 0xa87f, 0x0020, 0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2,
+	0xaab6, 0xabba, 0xacbe, 0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e,
+	0x00de, 0xa866, 0xa822, 0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048,
+	0x080c, 0xc9c8, 0x1120, 0x2009, 0x0003, 0x0804, 0x35a5, 0x7007,
+	0x0003, 0x701f, 0x4893, 0x0005, 0x00ce, 0x009e, 0x00de, 0x2009,
+	0x0002, 0x0804, 0x35a5, 0xa820, 0x9086, 0x8001, 0x1904, 0x3573,
+	0x2009, 0x0004, 0x0804, 0x35a5, 0x0016, 0x0026, 0x3510, 0x20a9,
+	0x0002, 0x4002, 0x4104, 0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e,
+	0x0005, 0x0016, 0x0026, 0x0036, 0x0046, 0x3520, 0x20a9, 0x0004,
+	0x4002, 0x4304, 0x4204, 0x4104, 0x4004, 0x8421, 0x1db8, 0x004e,
+	0x003e, 0x002e, 0x001e, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001,
+	0x0804, 0x35a5, 0x60dc, 0xd0ac, 0x1130, 0xd09c, 0x1120, 0x2009,
+	0x0005, 0x0804, 0x35a5, 0x7984, 0x78a8, 0x2040, 0x080c, 0xab57,
+	0x1120, 0x9182, 0x007f, 0x0a04, 0x35a8, 0x9186, 0x00ff, 0x0904,
+	0x35a8, 0x9182, 0x0800, 0x1a04, 0x35a8, 0x7a8c, 0x7b88, 0x607c,
+	0x9306, 0x1140, 0x6080, 0x924e, 0x0904, 0x35a8, 0x99cc, 0xff00,
+	0x0904, 0x35a8, 0x0126, 0x2091, 0x8000, 0x080c, 0x49ba, 0x0904,
+	0x493a, 0x0086, 0x90c6, 0x4000, 0x008e, 0x1538, 0x00c6, 0x0006,
+	0x0036, 0xb818, 0xbb1c, 0x9305, 0xbb20, 0x9305, 0xbb24, 0x9305,
+	0xbb28, 0x9305, 0xbb2c, 0x9305, 0xbb30, 0x9305, 0xbb34, 0x9305,
+	0x003e, 0x0570, 0xd88c, 0x1128, 0x080c, 0x6a6b, 0x0110, 0xc89d,
+	0x0438, 0x900e, 0x080c, 0x6914, 0x1108, 0xc185, 0xb800, 0xd0bc,
+	0x0108, 0xc18d, 0x000e, 0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110,
+	0x2408, 0x0090, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0060,
+	0x90c6, 0x4009, 0x1108, 0x0040, 0x90c6, 0x4006, 0x1108, 0x0020,
+	0x2001, 0x4005, 0x2009, 0x000a, 0x2020, 0x012e, 0x0804, 0x3575,
+	0x000e, 0x00ce, 0x2b00, 0x7026, 0x0016, 0x00b6, 0x00c6, 0x00e6,
+	0x2c70, 0x080c, 0xac5f, 0x0904, 0x498f, 0x2b00, 0x6012, 0x080c,
+	0xcccc, 0x2e58, 0x00ee, 0x00e6, 0x00c6, 0x080c, 0x4aa7, 0x00ce,
+	0x2b70, 0x1158, 0x080c, 0xabed, 0x00ee, 0x00ce, 0x00be, 0x001e,
+	0x012e, 0x2009, 0x0002, 0x0804, 0x35a5, 0x900e, 0xa966, 0xa96a,
+	0x2900, 0x6016, 0xa932, 0xa868, 0xc0fd, 0xd88c, 0x0108, 0xc0f5,
+	0xa86a, 0xd89c, 0x1110, 0x080c, 0x31e7, 0x6023, 0x0001, 0x9006,
+	0x080c, 0x6561, 0xd89c, 0x0138, 0x2001, 0x0004, 0x080c, 0x6575,
+	0x2009, 0x0003, 0x0030, 0x2001, 0x0002, 0x080c, 0x6575, 0x2009,
+	0x0002, 0x080c, 0xac8c, 0x78a8, 0xd094, 0x0138, 0x00ee, 0x7024,
+	0x00e6, 0x2058, 0xb8d4, 0xc08d, 0xb8d6, 0x9085, 0x0001, 0x00ee,
+	0x00ce, 0x00be, 0x001e, 0x012e, 0x1120, 0x2009, 0x0003, 0x0804,
+	0x35a5, 0x7007, 0x0003, 0x701f, 0x499e, 0x0005, 0xa830, 0x9086,
+	0x0100, 0x7024, 0x2058, 0x1138, 0x2009, 0x0004, 0xba04, 0x9294,
+	0x00ff, 0x0804, 0x5637, 0x900e, 0xa868, 0xd0f4, 0x1904, 0x3573,
+	0x080c, 0x6914, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0x0804, 0x3573, 0x00e6, 0x00d6, 0x0096, 0x83ff, 0x0904, 0x4a09,
+	0x902e, 0x080c, 0xab57, 0x0130, 0x9026, 0x20a9, 0x0800, 0x2071,
+	0x1000, 0x0030, 0x2021, 0x007f, 0x20a9, 0x0781, 0x2071, 0x107f,
+	0x2e04, 0x9005, 0x11b8, 0x2100, 0x9406, 0x1904, 0x4a1a, 0x2428,
+	0x94ce, 0x007f, 0x1120, 0x92ce, 0xfffd, 0x1558, 0x0030, 0x94ce,
+	0x0080, 0x1130, 0x92ce, 0xfffc, 0x1520, 0x93ce, 0x00ff, 0x1508,
+	0xc5fd, 0x0480, 0x2058, 0xbf10, 0x2700, 0x9306, 0x11e8, 0xbe14,
+	0x2600, 0x9206, 0x11c8, 0x2400, 0x9106, 0x1180, 0xd884, 0x0598,
+	0xd894, 0x1588, 0x080c, 0x6a0b, 0x1570, 0x2001, 0x4000, 0x0460,
+	0x080c, 0x6a6b, 0x1540, 0x2001, 0x4000, 0x0430, 0x2001, 0x4007,
+	0x0418, 0x2001, 0x4006, 0x0400, 0x2400, 0x9106, 0x1158, 0xbe14,
+	0x87ff, 0x1128, 0x86ff, 0x0918, 0x080c, 0xab57, 0x1900, 0x2001,
+	0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04, 0x49d0, 0x85ff, 0x1130,
+	0x2001, 0x4009, 0x0048, 0x2001, 0x0001, 0x0030, 0x080c, 0x65c4,
+	0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005, 0x009e, 0x00de, 0x00ee,
+	0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35a5, 0x080c,
+	0x4aa7, 0x1120, 0x2009, 0x0002, 0x0804, 0x35a5, 0xa867, 0x0000,
+	0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005, 0x0904, 0x35a8, 0x9096,
+	0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04, 0x35a8, 0x2010, 0x2918,
+	0x080c, 0x3181, 0x1120, 0x2009, 0x0003, 0x0804, 0x35a5, 0x7007,
+	0x0003, 0x701f, 0x4a5c, 0x0005, 0xa830, 0x9086, 0x0100, 0x1904,
+	0x3573, 0x2009, 0x0004, 0x0804, 0x35a5, 0x7984, 0x080c, 0xab57,
+	0x1120, 0x9182, 0x007f, 0x0a04, 0x35a8, 0x9186, 0x00ff, 0x0904,
+	0x35a8, 0x9182, 0x0800, 0x1a04, 0x35a8, 0x2001, 0x9000, 0x080c,
+	0x5692, 0x1904, 0x35a5, 0x0804, 0x3573, 0xa998, 0x080c, 0xab57,
+	0x1118, 0x9182, 0x007f, 0x0280, 0x9186, 0x00ff, 0x0168, 0x9182,
+	0x0800, 0x1250, 0x2001, 0x9000, 0x080c, 0x5692, 0x11a8, 0x0060,
+	0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0000, 0x0005, 0x2009, 0x000a, 0x0c48, 0x080c,
+	0x103a, 0x0198, 0x9006, 0xa802, 0x7014, 0x9005, 0x1120, 0x2900,
+	0x7016, 0x701a, 0x0040, 0x7018, 0xa802, 0x0086, 0x2040, 0x2900,
+	0xa006, 0x701a, 0x008e, 0x9085, 0x0001, 0x0005, 0x7984, 0x080c,
+	0x6625, 0x1130, 0x7e88, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208,
+	0x905e, 0x8bff, 0x0005, 0xa998, 0x080c, 0x6625, 0x1130, 0xae9c,
+	0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005,
+	0xae98, 0x0008, 0x7e84, 0x2608, 0x080c, 0x6625, 0x1108, 0x0008,
+	0x905e, 0x8bff, 0x0005, 0x0016, 0x7114, 0x81ff, 0x0128, 0x2148,
+	0xa904, 0x080c, 0x106c, 0x0cc8, 0x7116, 0x711a, 0x001e, 0x0005,
+	0x2031, 0x0001, 0x0010, 0x2031, 0x0000, 0x2061, 0x18b8, 0x2c44,
+	0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a,
+	0x080c, 0x1124, 0x7007, 0x0002, 0x701f, 0x3573, 0x0005, 0x00f6,
+	0x0126, 0x2091, 0x8000, 0x2079, 0x0000, 0x2001, 0x18b0, 0x2004,
+	0x9005, 0x1190, 0x0e04, 0x4b24, 0x7a36, 0x7833, 0x0012, 0x7a82,
+	0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
+	0x190c, 0x11d6, 0x0804, 0x4b8a, 0x0016, 0x0086, 0x0096, 0x00c6,
+	0x00e6, 0x2071, 0x189e, 0x7044, 0x9005, 0x1540, 0x7148, 0x9182,
+	0x0010, 0x0288, 0x7038, 0x2060, 0x080c, 0x103a, 0x0904, 0x4b82,
+	0xa84b, 0x0000, 0x2900, 0x7046, 0x2001, 0x0002, 0x9080, 0x1e55,
+	0x2005, 0xa846, 0x0098, 0x7038, 0x90e0, 0x0004, 0x2001, 0x18ba,
+	0x9c82, 0x18fa, 0x0210, 0x2061, 0x18ba, 0x2c00, 0x703a, 0x7148,
+	0x81ff, 0x1108, 0x703e, 0x8108, 0x714a, 0x0460, 0x7148, 0x8108,
+	0x714a, 0x7044, 0x2040, 0xa144, 0x2105, 0x0016, 0x908a, 0x0036,
+	0x1a0c, 0x0d7d, 0x2060, 0x001e, 0x8108, 0x2105, 0x9005, 0xa146,
+	0x1520, 0x080c, 0x103a, 0x1130, 0x8109, 0xa946, 0x7148, 0x8109,
+	0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a, 0xa046, 0x2800, 0xa802,
+	0x2900, 0xa006, 0x7046, 0x2001, 0x0002, 0x9080, 0x1e55, 0x2005,
+	0xa846, 0x0058, 0x2262, 0x6306, 0x640a, 0x00ee, 0x00ce, 0x009e,
+	0x008e, 0x001e, 0x012e, 0x00fe, 0x0005, 0x2c00, 0x9082, 0x001b,
+	0x0002, 0x4bac, 0x4bac, 0x4bae, 0x4bac, 0x4bac, 0x4bac, 0x4bb2,
+	0x4bac, 0x4bac, 0x4bac, 0x4bb6, 0x4bac, 0x4bac, 0x4bac, 0x4bba,
+	0x4bac, 0x4bac, 0x4bac, 0x4bbe, 0x4bac, 0x4bac, 0x4bac, 0x4bc2,
+	0x4bac, 0x4bac, 0x4bac, 0x4bc7, 0x080c, 0x0d7d, 0xa276, 0xa37a,
+	0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e, 0x0878, 0xa296, 0xa39a,
+	0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae, 0x0838, 0xa2b6, 0xa3ba,
+	0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce, 0x0804, 0x4b85, 0xa2d6,
+	0xa3da, 0xa4de, 0x0804, 0x4b85, 0x00e6, 0x2071, 0x189e, 0x7048,
+	0x9005, 0x0904, 0x4c5e, 0x0126, 0x2091, 0x8000, 0x0e04, 0x4c5d,
+	0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096, 0x0086, 0x0076, 0x9006,
+	0x2038, 0x7040, 0x2048, 0x9005, 0x0500, 0xa948, 0x2105, 0x0016,
+	0x908a, 0x0036, 0x1a0c, 0x0d7d, 0x2060, 0x001e, 0x8108, 0x2105,
+	0x9005, 0xa94a, 0x1904, 0x4c60, 0xa804, 0x9005, 0x090c, 0x0d7d,
+	0x7042, 0x2938, 0x2040, 0xa003, 0x0000, 0x2001, 0x0002, 0x9080,
+	0x1e55, 0x2005, 0xa04a, 0x0804, 0x4c60, 0x703c, 0x2060, 0x2c14,
+	0x6304, 0x6408, 0x650c, 0x2200, 0x7836, 0x7833, 0x0012, 0x7882,
+	0x2300, 0x7886, 0x2400, 0x788a, 0x2091, 0x4080, 0x2001, 0x0089,
+	0x2004, 0xd084, 0x190c, 0x11d6, 0x87ff, 0x0118, 0x2748, 0x080c,
+	0x106c, 0x7048, 0x8001, 0x704a, 0x9005, 0x1170, 0x7040, 0x2048,
+	0x9005, 0x0128, 0x080c, 0x106c, 0x9006, 0x7042, 0x7046, 0x703b,
+	0x18ba, 0x703f, 0x18ba, 0x0420, 0x7040, 0x9005, 0x1508, 0x7238,
+	0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004, 0x90fa, 0x18fa, 0x0210,
+	0x2001, 0x18ba, 0x703e, 0x00a0, 0x9006, 0x703e, 0x703a, 0x7044,
+	0x9005, 0x090c, 0x0d7d, 0x2048, 0xa800, 0x9005, 0x1de0, 0x2900,
+	0x7042, 0x2001, 0x0002, 0x9080, 0x1e55, 0x2005, 0xa84a, 0x0000,
+	0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe, 0x012e, 0x00ee, 0x0005,
+	0x2c00, 0x9082, 0x001b, 0x0002, 0x4c7f, 0x4c7f, 0x4c81, 0x4c7f,
+	0x4c7f, 0x4c7f, 0x4c86, 0x4c7f, 0x4c7f, 0x4c7f, 0x4c8b, 0x4c7f,
+	0x4c7f, 0x4c7f, 0x4c90, 0x4c7f, 0x4c7f, 0x4c7f, 0x4c95, 0x4c7f,
+	0x4c7f, 0x4c7f, 0x4c9a, 0x4c7f, 0x4c7f, 0x4c7f, 0x4c9f, 0x080c,
+	0x0d7d, 0xaa74, 0xab78, 0xac7c, 0x0804, 0x4c0b, 0xaa84, 0xab88,
+	0xac8c, 0x0804, 0x4c0b, 0xaa94, 0xab98, 0xac9c, 0x0804, 0x4c0b,
+	0xaaa4, 0xaba8, 0xacac, 0x0804, 0x4c0b, 0xaab4, 0xabb8, 0xacbc,
+	0x0804, 0x4c0b, 0xaac4, 0xabc8, 0xaccc, 0x0804, 0x4c0b, 0xaad4,
+	0xabd8, 0xacdc, 0x0804, 0x4c0b, 0x0016, 0x0026, 0x0036, 0x00b6,
+	0x00c6, 0x2009, 0x007e, 0x080c, 0x6625, 0x2019, 0x0001, 0xb85c,
+	0xd0ac, 0x0110, 0x2019, 0x0000, 0x2011, 0x801b, 0x080c, 0x4b07,
+	0x00ce, 0x00be, 0x003e, 0x002e, 0x001e, 0x0005, 0x0026, 0x080c,
+	0x56da, 0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c, 0x4b07, 0x002e,
+	0x0005, 0x81ff, 0x1904, 0x35a5, 0x0126, 0x2091, 0x8000, 0x6030,
+	0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c, 0x74e9, 0x1158, 0x080c,
+	0x77ed, 0x080c, 0x6029, 0x9085, 0x0001, 0x080c, 0x7530, 0x080c,
+	0x741a, 0x0010, 0x080c, 0x5ee4, 0x012e, 0x0804, 0x3573, 0x81ff,
+	0x0120, 0x2009, 0x0001, 0x0804, 0x35a5, 0x080c, 0x56ee, 0x0120,
+	0x2009, 0x0007, 0x0804, 0x35a5, 0x080c, 0x6a63, 0x0120, 0x2009,
+	0x0008, 0x0804, 0x35a5, 0x080c, 0x3363, 0x0128, 0x7984, 0x080c,
+	0x65c4, 0x1904, 0x35a8, 0x080c, 0x4ada, 0x0904, 0x35a8, 0x2b00,
+	0x7026, 0x080c, 0x6a6b, 0x7888, 0x1170, 0x9084, 0x0005, 0x1158,
+	0x900e, 0x080c, 0x6914, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
+	0xc18d, 0x0804, 0x3573, 0x080c, 0x4aa7, 0x0904, 0x35a5, 0x9006,
+	0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xca6a, 0x0904,
+	0x35a5, 0x7888, 0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6, 0x7007,
+	0x0003, 0x701f, 0x4d80, 0x0005, 0x2061, 0x1800, 0x080c, 0x56ee,
+	0x2009, 0x0007, 0x1578, 0x080c, 0x6a63, 0x0118, 0x2009, 0x0008,
+	0x0448, 0x080c, 0x3363, 0x0120, 0xa998, 0x080c, 0x65c4, 0x1530,
+	0x080c, 0x4ad8, 0x0518, 0x080c, 0x6a6b, 0xa89c, 0x1168, 0x9084,
+	0x0005, 0x1150, 0x900e, 0x080c, 0x6914, 0x1108, 0xc185, 0xb800,
+	0xd0bc, 0x0108, 0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c,
+	0xca6a, 0x11e0, 0xa89c, 0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6,
+	0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
+	0xa99a, 0x9006, 0x918d, 0x0001, 0x2008, 0x0005, 0x9006, 0x0005,
+	0xa830, 0x9086, 0x0100, 0x7024, 0x2058, 0x1110, 0x0804, 0x5637,
+	0x900e, 0x080c, 0x6914, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
+	0xc18d, 0x0804, 0x3573, 0x080c, 0x56ee, 0x0120, 0x2009, 0x0007,
+	0x0804, 0x35a5, 0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c,
+	0x4aa7, 0x1120, 0x2009, 0x0002, 0x0804, 0x35a5, 0x900e, 0x2130,
+	0x7126, 0x7132, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005,
+	0x702a, 0x20a0, 0x080c, 0x6625, 0x1904, 0x4e22, 0x080c, 0x6a6b,
+	0x0138, 0x080c, 0x6a73, 0x0120, 0x080c, 0x6a0b, 0x1904, 0x4e22,
+	0xd794, 0x1110, 0xd784, 0x01a8, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
+	0x0006, 0x2098, 0x3400, 0xd794, 0x0160, 0x20a9, 0x0008, 0x4003,
+	0x2098, 0x20a0, 0x3d00, 0x20e0, 0x20a9, 0x0002, 0x080c, 0x48a9,
+	0x0048, 0x20a9, 0x0004, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0,
+	0x080c, 0x48a9, 0x9186, 0x007e, 0x0170, 0x9186, 0x0080, 0x0158,
+	0x080c, 0x6a6b, 0x90c2, 0x0006, 0x1210, 0xc1fd, 0x0020, 0x080c,
+	0x6914, 0x1108, 0xc1fd, 0x4104, 0xc1fc, 0xd794, 0x0528, 0xb8c4,
+	0x20e0, 0xb8c8, 0x2060, 0x9c80, 0x0000, 0x2098, 0x20a9, 0x0002,
+	0x4003, 0x9c80, 0x0003, 0x2098, 0x20a9, 0x0001, 0x4005, 0x9c80,
+	0x0004, 0x2098, 0x3400, 0x20a9, 0x0002, 0x4003, 0x2098, 0x20a0,
+	0x3d00, 0x20e0, 0x080c, 0x489c, 0x9c80, 0x0026, 0x2098, 0xb8c4,
+	0x20e0, 0x20a9, 0x0002, 0x4003, 0xd794, 0x0110, 0x96b0, 0x000b,
+	0x96b0, 0x0005, 0x8108, 0x080c, 0xab57, 0x0118, 0x9186, 0x0800,
+	0x0040, 0xd78c, 0x0120, 0x9186, 0x0800, 0x0170, 0x0018, 0x9186,
+	0x007e, 0x0150, 0xd794, 0x0118, 0x9686, 0x0020, 0x0010, 0x9686,
+	0x0028, 0x0150, 0x0804, 0x4db2, 0x86ff, 0x1120, 0x7124, 0x810b,
+	0x0804, 0x3573, 0x7033, 0x0001, 0x7122, 0x7024, 0x9600, 0x7026,
+	0x772e, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa67a, 0x7034,
+	0xa072, 0x7028, 0xa076, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c,
+	0x1124, 0x7007, 0x0002, 0x701f, 0x4e5e, 0x0005, 0x7030, 0x9005,
+	0x1180, 0x7120, 0x7028, 0x20a0, 0x772c, 0x9036, 0x7034, 0x20e8,
+	0x2061, 0x18b8, 0x2c44, 0xa28c, 0xa390, 0xa494, 0xa598, 0x0804,
+	0x4db2, 0x7124, 0x810b, 0x0804, 0x3573, 0x2029, 0x007e, 0x7984,
+	0x7a88, 0x7b8c, 0x7c98, 0x9184, 0xff00, 0x8007, 0x90e2, 0x0020,
+	0x0a04, 0x35a8, 0x9502, 0x0a04, 0x35a8, 0x9184, 0x00ff, 0x90e2,
+	0x0020, 0x0a04, 0x35a8, 0x9502, 0x0a04, 0x35a8, 0x9284, 0xff00,
+	0x8007, 0x90e2, 0x0020, 0x0a04, 0x35a8, 0x9502, 0x0a04, 0x35a8,
+	0x9284, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x35a8, 0x9502, 0x0a04,
+	0x35a8, 0x9384, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x35a8,
+	0x9502, 0x0a04, 0x35a8, 0x9384, 0x00ff, 0x90e2, 0x0020, 0x0a04,
+	0x35a8, 0x9502, 0x0a04, 0x35a8, 0x9484, 0xff00, 0x8007, 0x90e2,
+	0x0020, 0x0a04, 0x35a8, 0x9502, 0x0a04, 0x35a8, 0x9484, 0x00ff,
+	0x90e2, 0x0020, 0x0a04, 0x35a8, 0x9502, 0x0a04, 0x35a8, 0x2061,
+	0x1989, 0x6102, 0x6206, 0x630a, 0x640e, 0x0804, 0x3573, 0x080c,
+	0x4aa7, 0x0904, 0x35a5, 0x2009, 0x0016, 0x7a8c, 0x7b88, 0x7c9c,
+	0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4af0, 0x701f,
+	0x4ee2, 0x0005, 0x2001, 0x0138, 0x2003, 0x0000, 0x00e6, 0x2071,
+	0x0300, 0x701c, 0xd0a4, 0x1de8, 0x00ee, 0x20a9, 0x0016, 0x896e,
+	0x8d6e, 0x8d6f, 0x9d84, 0xffc0, 0x9080, 0x0019, 0x2098, 0x9d84,
+	0x003f, 0x20e0, 0x2069, 0x1877, 0x20e9, 0x0001, 0x2da0, 0x4003,
+	0x6800, 0x9005, 0x0904, 0x4f63, 0x6804, 0x2008, 0x918c, 0xfff8,
+	0x1904, 0x4f63, 0x680c, 0x9005, 0x0904, 0x4f63, 0x9082, 0xff01,
+	0x1a04, 0x4f63, 0x6810, 0x9082, 0x005c, 0x0a04, 0x4f63, 0x6824,
+	0x2008, 0x9082, 0x0008, 0x0a04, 0x4f63, 0x9182, 0x0400, 0x1a04,
+	0x4f63, 0x0056, 0x2029, 0x0000, 0x080c, 0x8d0a, 0x005e, 0x6944,
+	0x6820, 0x9102, 0x06c0, 0x6820, 0x9082, 0x0019, 0x16a0, 0x6828,
+	0x6944, 0x810c, 0x9102, 0x0678, 0x6840, 0x9082, 0x000f, 0x1658,
+	0x080c, 0x1053, 0x2900, 0x0904, 0x4f7d, 0x684e, 0x00e6, 0x2071,
+	0x1930, 0x00b6, 0x2059, 0x0000, 0x080c, 0x8bc6, 0x00be, 0x00ee,
+	0x0558, 0x080c, 0x8920, 0x080c, 0x8966, 0x11e0, 0x6857, 0x0000,
+	0x00c6, 0x2061, 0x0100, 0x6104, 0x918d, 0x2000, 0x6106, 0x6b10,
+	0x2061, 0x1a6b, 0x630a, 0x00ce, 0x080c, 0x2713, 0x2001, 0x0138,
+	0x2102, 0x0804, 0x3573, 0x080c, 0x2713, 0x2001, 0x0138, 0x2102,
+	0x0804, 0x35a8, 0x00e6, 0x2071, 0x1930, 0x080c, 0x8d9b, 0x080c,
+	0x8daa, 0x080c, 0x8bb5, 0x00ee, 0x2001, 0x188a, 0x204c, 0x080c,
+	0x106c, 0x2001, 0x188a, 0x2003, 0x0000, 0x080c, 0x2713, 0x2001,
+	0x0138, 0x2102, 0x0804, 0x35a5, 0x2001, 0x1924, 0x200c, 0x918e,
+	0x0000, 0x0904, 0x4fdc, 0x080c, 0x8bb0, 0x0904, 0x4fdc, 0x2001,
+	0x0101, 0x200c, 0x918c, 0xdfff, 0x2102, 0x2001, 0x0138, 0x2003,
+	0x0000, 0x00e6, 0x2071, 0x0300, 0x701c, 0xd0a4, 0x1de8, 0x00ee,
+	0x080c, 0x8bb5, 0x2001, 0x0035, 0x080c, 0x1679, 0x00c6, 0x2061,
+	0x193c, 0x6004, 0x6100, 0x9106, 0x1de0, 0x00ce, 0x080c, 0x2713,
+	0x2001, 0x0138, 0x2102, 0x00e6, 0x00f6, 0x2071, 0x1923, 0x080c,
+	0x8af1, 0x0120, 0x2f00, 0x080c, 0x8b7b, 0x0cc8, 0x00fe, 0x00ee,
+	0x0126, 0x2091, 0x8000, 0x2001, 0x188a, 0x200c, 0x81ff, 0x0138,
+	0x2148, 0x080c, 0x106c, 0x2001, 0x188a, 0x2003, 0x0000, 0x2001,
+	0x183d, 0x2003, 0x0020, 0x00e6, 0x2071, 0x1930, 0x080c, 0x8d9b,
+	0x080c, 0x8daa, 0x00ee, 0x012e, 0x0804, 0x3573, 0x0006, 0x080c,
+	0x56da, 0xd0cc, 0x000e, 0x0005, 0x0006, 0x080c, 0x56de, 0xd0bc,
+	0x000e, 0x0005, 0x6174, 0x7a84, 0x6300, 0x82ff, 0x1118, 0x7986,
+	0x0804, 0x3573, 0x83ff, 0x1904, 0x35a8, 0x2001, 0xfff0, 0x9200,
+	0x1a04, 0x35a8, 0x2019, 0xffff, 0x6078, 0x9302, 0x9200, 0x0a04,
+	0x35a8, 0x7986, 0x6276, 0x0804, 0x3573, 0x080c, 0x56ee, 0x1904,
+	0x35a5, 0x7c88, 0x7d84, 0x7e98, 0x7f8c, 0x080c, 0x4aa7, 0x0904,
+	0x35a5, 0x900e, 0x901e, 0x7326, 0x7332, 0xa860, 0x20e8, 0x7036,
+	0xa85c, 0x9080, 0x0003, 0x702a, 0x20a0, 0x91d8, 0x1000, 0x2b5c,
+	0x8bff, 0x0178, 0x080c, 0x6a6b, 0x0118, 0x080c, 0x6a73, 0x1148,
+	0x20a9, 0x0001, 0xb814, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398,
+	0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x0170,
+	0x0c20, 0x83ff, 0x1148, 0x7224, 0x900e, 0x2001, 0x0003, 0x080c,
+	0x9166, 0x2208, 0x0804, 0x3573, 0x7033, 0x0001, 0x7122, 0x7024,
+	0x9300, 0x7026, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000, 0xa37a,
+	0x7028, 0xa076, 0x7034, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a,
+	0x080c, 0x1124, 0x7007, 0x0002, 0x701f, 0x505f, 0x0005, 0x7030,
+	0x9005, 0x1178, 0x7120, 0x7028, 0x20a0, 0x901e, 0x7034, 0x20e8,
+	0x2061, 0x18b8, 0x2c44, 0xa48c, 0xa590, 0xa694, 0xa798, 0x0804,
+	0x501d, 0x7224, 0x900e, 0x2001, 0x0003, 0x080c, 0x9166, 0x2208,
+	0x0804, 0x3573, 0x00f6, 0x00e6, 0x080c, 0x56ee, 0x2009, 0x0007,
+	0x1904, 0x50f2, 0x2071, 0x189e, 0x745c, 0x84ff, 0x2009, 0x000e,
+	0x1904, 0x50f2, 0xac9c, 0xad98, 0xaea4, 0xafa0, 0x0096, 0x080c,
+	0x1053, 0x2009, 0x0002, 0x0904, 0x50f2, 0x2900, 0x705e, 0x900e,
+	0x901e, 0x7356, 0x7362, 0xa860, 0x7066, 0xa85c, 0x9080, 0x0003,
+	0x705a, 0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c,
+	0x6a6b, 0x0118, 0x080c, 0x6a73, 0x1148, 0xb814, 0x20a9, 0x0001,
+	0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182,
+	0x0800, 0x0120, 0x9386, 0x003c, 0x01e8, 0x0c20, 0x83ff, 0x11c0,
+	0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x9166, 0x2208, 0x009e,
+	0xa897, 0x4000, 0xa99a, 0x715c, 0x81ff, 0x090c, 0x0d7d, 0x2148,
+	0x080c, 0x106c, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008, 0x0418,
+	0x7063, 0x0001, 0x7152, 0x7054, 0x9300, 0x7056, 0x2061, 0x18b9,
+	0x2c44, 0xa37a, 0x7058, 0xa076, 0x7064, 0xa072, 0xa48e, 0xa592,
+	0xa696, 0xa79a, 0xa09f, 0x50fe, 0x000e, 0xa0a2, 0x080c, 0x1124,
+	0x9006, 0x0048, 0x009e, 0xa897, 0x4005, 0xa99a, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0030, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0xa0a0,
+	0x904d, 0x090c, 0x0d7d, 0x00e6, 0x2071, 0x189e, 0xa06c, 0x908e,
+	0x0100, 0x0138, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4002,
+	0x00d8, 0x7060, 0x9005, 0x1158, 0x7150, 0x7058, 0x20a0, 0x901e,
+	0x7064, 0x20e8, 0xa48c, 0xa590, 0xa694, 0xa798, 0x0428, 0xa87b,
+	0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x7254, 0x900e, 0x2001,
+	0x0003, 0x080c, 0x9166, 0xaa9a, 0x715c, 0x81ff, 0x090c, 0x0d7d,
+	0x2148, 0x080c, 0x106c, 0x705f, 0x0000, 0xa0a0, 0x2048, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x6d80, 0x012e, 0xa09f, 0x0000, 0xa0a3,
+	0x0000, 0x00ee, 0x00fe, 0x0005, 0x91d8, 0x1000, 0x2b5c, 0x8bff,
+	0x0178, 0x080c, 0x6a6b, 0x0118, 0x080c, 0x6a73, 0x1148, 0xb814,
+	0x20a9, 0x0001, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003,
+	0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x0518, 0x0c20,
+	0x83ff, 0x11f0, 0x7154, 0x810c, 0xa99a, 0xa897, 0x4000, 0x715c,
+	0x81ff, 0x090c, 0x0d7d, 0x2148, 0x080c, 0x106c, 0x9006, 0x705e,
+	0x918d, 0x0001, 0x2008, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x6d80, 0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x0070,
+	0x7063, 0x0001, 0x7152, 0x7054, 0x9300, 0x7056, 0xa37a, 0xa48e,
+	0xa592, 0xa696, 0xa79a, 0x080c, 0x1124, 0x9006, 0x00ee, 0x0005,
+	0x0096, 0xa88c, 0x90be, 0x7000, 0x0148, 0x90be, 0x7100, 0x0130,
+	0x90be, 0x7200, 0x0118, 0x009e, 0x0804, 0x35a8, 0xa884, 0xa988,
+	0x080c, 0x25fb, 0x1518, 0x080c, 0x65c4, 0x1500, 0x7126, 0xbe12,
+	0xbd16, 0xae7c, 0x080c, 0x4aa7, 0x01c8, 0x080c, 0x4aa7, 0x01b0,
+	0x009e, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0xa823, 0x0000,
+	0xa804, 0x2048, 0x080c, 0xc9e8, 0x1120, 0x2009, 0x0003, 0x0804,
+	0x35a5, 0x7007, 0x0003, 0x701f, 0x51cb, 0x0005, 0x009e, 0x2009,
+	0x0002, 0x0804, 0x35a5, 0x7124, 0x080c, 0x32fc, 0xa820, 0x9086,
+	0x8001, 0x1120, 0x2009, 0x0004, 0x0804, 0x35a5, 0x2900, 0x7022,
+	0xa804, 0x0096, 0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
+	0x9084, 0xffc0, 0x009e, 0x9080, 0x0002, 0x0076, 0x0006, 0x2098,
+	0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c, 0x0fb7, 0xaa6c,
+	0xab70, 0xac74, 0xad78, 0x2061, 0x18b8, 0x2c44, 0xa06b, 0x0000,
+	0xae64, 0xaf8c, 0x97c6, 0x7000, 0x0118, 0x97c6, 0x7100, 0x1148,
+	0x96c2, 0x0004, 0x0600, 0x2009, 0x0004, 0x000e, 0x007e, 0x0804,
+	0x4af3, 0x97c6, 0x7200, 0x11b8, 0x96c2, 0x0054, 0x02a0, 0x000e,
+	0x007e, 0x2061, 0x18b8, 0x2c44, 0xa076, 0xa772, 0xa07b, 0x002a,
+	0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x1124, 0x7007, 0x0002,
+	0x701f, 0x5227, 0x0005, 0x000e, 0x007e, 0x0804, 0x35a8, 0x7020,
+	0x2048, 0xa804, 0x2048, 0xa804, 0x2048, 0x8906, 0x8006, 0x8007,
+	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2098, 0x20a0,
+	0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c, 0x0fb7, 0x2100, 0x2238,
+	0x2061, 0x18b8, 0x2c44, 0xa28c, 0xa390, 0xa494, 0xa598, 0x2009,
+	0x002a, 0x0804, 0x4af3, 0x81ff, 0x1904, 0x35a5, 0x798c, 0x2001,
+	0x197e, 0x918c, 0x8000, 0x2102, 0x080c, 0x4abe, 0x0904, 0x35a8,
+	0x080c, 0x6a6b, 0x0120, 0x080c, 0x6a73, 0x1904, 0x35a8, 0x080c,
+	0x66ec, 0x0904, 0x35a5, 0x0126, 0x2091, 0x8000, 0x080c, 0x6881,
+	0x012e, 0x0904, 0x35a5, 0x2001, 0x197e, 0x2004, 0xd0fc, 0x1904,
+	0x3573, 0x0804, 0x4548, 0xa9a0, 0x2001, 0x197e, 0x918c, 0x8000,
+	0xc18d, 0x2102, 0x080c, 0x4acb, 0x01a0, 0x080c, 0x6a6b, 0x0118,
+	0x080c, 0x6a73, 0x1170, 0x080c, 0x66ec, 0x2009, 0x0002, 0x0128,
+	0x080c, 0x6881, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a,
 	0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
-	0x00ce, 0x0005, 0x9006, 0x0ce0, 0x7aa8, 0xd2dc, 0x0904, 0x359e,
-	0x0016, 0x7984, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x568b, 0x001e,
-	0x1904, 0x359e, 0x0804, 0x356c, 0x00f6, 0x2d78, 0x0011, 0x00fe,
-	0x0005, 0xaab0, 0xd2dc, 0x0150, 0x0016, 0xa998, 0x9284, 0x1000,
-	0xc0fd, 0x080c, 0x568b, 0x001e, 0x9085, 0x0001, 0x0005, 0x81ff,
-	0x0120, 0x2009, 0x0001, 0x0804, 0x359e, 0x080c, 0x56e7, 0x0120,
-	0x2009, 0x0007, 0x0804, 0x359e, 0x7984, 0x7ea8, 0x96b4, 0x00ff,
-	0x080c, 0x661e, 0x1904, 0x35a1, 0x9186, 0x007f, 0x0138, 0x080c,
-	0x6a5b, 0x0120, 0x2009, 0x0009, 0x0804, 0x359e, 0x080c, 0x4aa0,
-	0x1120, 0x2009, 0x0002, 0x0804, 0x359e, 0xa867, 0x0000, 0xa868,
-	0xc0fd, 0xa86a, 0x2001, 0x0100, 0x8007, 0xa80a, 0x080c, 0xc9fd,
-	0x1120, 0x2009, 0x0003, 0x0804, 0x359e, 0x7007, 0x0003, 0x701f,
-	0x54c2, 0x0005, 0xa808, 0x8007, 0x9086, 0x0100, 0x1120, 0x2009,
-	0x0004, 0x0804, 0x359e, 0xa8e0, 0xa866, 0xa810, 0x8007, 0x9084,
-	0x00ff, 0x800c, 0xa814, 0x8007, 0x9084, 0x00ff, 0x8004, 0x9080,
-	0x0002, 0x9108, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x0004, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804,
-	0x4aec, 0x080c, 0x4aa0, 0x1120, 0x2009, 0x0002, 0x0804, 0x359e,
-	0x7984, 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118,
-	0x7023, 0x19b3, 0x0040, 0x92c6, 0x0001, 0x1118, 0x7023, 0x19cd,
-	0x0010, 0x0804, 0x35a1, 0x2009, 0x001a, 0x7a8c, 0x7b88, 0x7c9c,
-	0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4ae9, 0x701f,
-	0x5512, 0x0005, 0x2001, 0x182e, 0x2003, 0x0001, 0xa85c, 0x9080,
-	0x0019, 0x2098, 0xa860, 0x20e0, 0x20a9, 0x001a, 0x7020, 0x20a0,
-	0x20e9, 0x0001, 0x4003, 0x0804, 0x356c, 0x080c, 0x4aa0, 0x1120,
-	0x2009, 0x0002, 0x0804, 0x359e, 0x7984, 0x9194, 0xff00, 0x918c,
-	0x00ff, 0x8217, 0x82ff, 0x1118, 0x2099, 0x19b3, 0x0040, 0x92c6,
-	0x0001, 0x1118, 0x2099, 0x19cd, 0x0010, 0x0804, 0x35a1, 0xa85c,
-	0x9080, 0x0019, 0x20a0, 0xa860, 0x20e8, 0x20a9, 0x001a, 0x20e1,
-	0x0001, 0x4003, 0x2009, 0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0xa85c, 0x9080, 0x0019, 0xaf60, 0x0804, 0x4aec, 0x7884, 0x908a,
-	0x1000, 0x1a04, 0x35a1, 0x0126, 0x2091, 0x8000, 0x8003, 0x800b,
-	0x810b, 0x9108, 0x00c6, 0x2061, 0x1a03, 0x6142, 0x00ce, 0x012e,
-	0x0804, 0x356c, 0x00c6, 0x080c, 0x74d5, 0x1160, 0x080c, 0x77d9,
-	0x080c, 0x6022, 0x9085, 0x0001, 0x080c, 0x751c, 0x080c, 0x7406,
-	0x080c, 0x0d7d, 0x2061, 0x1800, 0x6030, 0xc09d, 0x6032, 0x080c,
-	0x5edd, 0x00ce, 0x0005, 0x00c6, 0x2001, 0x1800, 0x2004, 0x908e,
-	0x0000, 0x0904, 0x359e, 0x7884, 0x9005, 0x0188, 0x7888, 0x2061,
-	0x199c, 0x2c0c, 0x2062, 0x080c, 0x29d8, 0x01a0, 0x080c, 0x29e0,
-	0x0188, 0x080c, 0x29e8, 0x0170, 0x2162, 0x0804, 0x35a1, 0x2061,
-	0x0100, 0x6038, 0x9086, 0x0007, 0x1118, 0x2009, 0x0001, 0x0010,
-	0x2009, 0x0000, 0x7884, 0x9086, 0x0002, 0x1588, 0x2061, 0x0100,
-	0x6028, 0xc09c, 0x602a, 0x080c, 0xa872, 0x0026, 0x2011, 0x0003,
-	0x080c, 0xa1ab, 0x2011, 0x0002, 0x080c, 0xa1b5, 0x002e, 0x080c,
-	0xa074, 0x0036, 0x901e, 0x080c, 0xa0f4, 0x003e, 0x080c, 0xa88e,
-	0x60e3, 0x0000, 0x080c, 0xe6d7, 0x080c, 0xe6f2, 0x9085, 0x0001,
-	0x080c, 0x751c, 0x9006, 0x080c, 0x2a0a, 0x2001, 0x1800, 0x2003,
-	0x0004, 0x0026, 0x2011, 0x0008, 0x080c, 0x2a44, 0x002e, 0x00ce,
-	0x0804, 0x356c, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x359e,
-	0x080c, 0x56e7, 0x0120, 0x2009, 0x0007, 0x0804, 0x359e, 0x7984,
-	0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x661e, 0x1904, 0x35a1, 0x9186,
-	0x007f, 0x0138, 0x080c, 0x6a5b, 0x0120, 0x2009, 0x0009, 0x0804,
-	0x359e, 0x080c, 0x4aa0, 0x1120, 0x2009, 0x0002, 0x0804, 0x359e,
-	0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xca00, 0x1120,
-	0x2009, 0x0003, 0x0804, 0x359e, 0x7007, 0x0003, 0x701f, 0x5619,
-	0x0005, 0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804,
-	0x359e, 0xa8e0, 0xa866, 0xa834, 0x8007, 0x800c, 0xa85c, 0x9080,
-	0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xaf60, 0x0804, 0x4aec,
-	0xa898, 0x9086, 0x000d, 0x1904, 0x359e, 0x2021, 0x4005, 0x0126,
-	0x2091, 0x8000, 0x0e04, 0x563d, 0x0010, 0x012e, 0x0cc0, 0x7c36,
-	0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833, 0x0010,
-	0x7883, 0x4005, 0xa998, 0x7986, 0xa9a4, 0x799a, 0xa9a8, 0x799e,
-	0x080c, 0x4adc, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-	0x190c, 0x11d6, 0x7007, 0x0001, 0x2091, 0x5000, 0x700f, 0x0000,
-	0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x00c6, 0x2061, 0x1a03,
-	0x7984, 0x6152, 0x614e, 0x6057, 0x0000, 0x604b, 0x0009, 0x7898,
-	0x606a, 0x789c, 0x6066, 0x7888, 0x6062, 0x788c, 0x605e, 0x2001,
-	0x1a11, 0x2044, 0x2001, 0x1a18, 0xa076, 0xa060, 0xa072, 0xa07b,
-	0x0001, 0xa07f, 0x0002, 0xa06b, 0x0000, 0xa09f, 0x0000, 0x00ce,
-	0x012e, 0x0804, 0x356c, 0x0126, 0x2091, 0x8000, 0x00b6, 0x00c6,
-	0x90e4, 0xc000, 0x0128, 0x0006, 0x080c, 0xc861, 0x000e, 0x1198,
-	0xd0e4, 0x0160, 0x9180, 0x1000, 0x2004, 0x905d, 0x0160, 0x080c,
-	0x603c, 0x080c, 0xab33, 0x0110, 0xb817, 0x0000, 0x9006, 0x00ce,
-	0x00be, 0x012e, 0x0005, 0x9085, 0x0001, 0x0cc8, 0x0126, 0x2091,
-	0x8000, 0x0156, 0x2010, 0x900e, 0x20a9, 0x0800, 0x0016, 0x9180,
-	0x1000, 0x2004, 0x9005, 0x0180, 0x9186, 0x007e, 0x0168, 0x9186,
-	0x007f, 0x0150, 0x9186, 0x0080, 0x0138, 0x9186, 0x00ff, 0x0120,
-	0x0026, 0x2200, 0x0801, 0x002e, 0x001e, 0x8108, 0x1f04, 0x56b6,
-	0x015e, 0x012e, 0x0005, 0x2001, 0x1848, 0x2004, 0x0005, 0x2001,
-	0x1867, 0x2004, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0d4,
-	0x000e, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0b4, 0x0005, 0x2001,
-	0x1800, 0x2004, 0x9086, 0x0003, 0x0005, 0x0016, 0x00e6, 0x2071,
-	0x189e, 0x7108, 0x910d, 0x710a, 0x00ee, 0x001e, 0x0005, 0x79a4,
-	0x9182, 0x0081, 0x1a04, 0x35a1, 0x810c, 0x0016, 0x080c, 0x4aa0,
-	0x080c, 0x0f42, 0x2100, 0x2238, 0x7d84, 0x7c88, 0x7b8c, 0x7a90,
-	0x001e, 0x080c, 0x4ae9, 0x701f, 0x570e, 0x0005, 0x2079, 0x0000,
-	0x7d94, 0x7c98, 0x7ba8, 0x7aac, 0x79a4, 0x810c, 0x2061, 0x18b8,
-	0x2c44, 0xa770, 0xa074, 0x2071, 0x189e, 0x080c, 0x4aec, 0x701f,
-	0x5722, 0x0005, 0x2061, 0x18b8, 0x2c44, 0x0016, 0x0026, 0xa270,
-	0xa174, 0x080c, 0x0f4a, 0x002e, 0x001e, 0x080c, 0x0ff7, 0x9006,
-	0xa802, 0xa806, 0x0804, 0x356c, 0x0126, 0x0156, 0x0136, 0x0146,
-	0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2061, 0x0100,
-	0x2069, 0x0200, 0x2071, 0x1800, 0x6044, 0xd0a4, 0x11e8, 0xd084,
-	0x0118, 0x080c, 0x58dd, 0x0068, 0xd08c, 0x0118, 0x080c, 0x57e6,
-	0x0040, 0xd094, 0x0118, 0x080c, 0x57b6, 0x0018, 0xd09c, 0x0108,
-	0x0099, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e,
-	0x013e, 0x015e, 0x012e, 0x0005, 0x0016, 0x6128, 0xd19c, 0x1110,
-	0xc19d, 0x612a, 0x001e, 0x0c68, 0x0006, 0x7098, 0x9005, 0x000e,
-	0x0120, 0x709b, 0x0000, 0x7093, 0x0000, 0x624c, 0x9286, 0xf0f0,
-	0x1150, 0x6048, 0x9086, 0xf0f0, 0x0130, 0x624a, 0x6043, 0x0090,
-	0x6043, 0x0010, 0x0490, 0x9294, 0xff00, 0x9296, 0xf700, 0x0178,
-	0x7138, 0xd1a4, 0x1160, 0x6240, 0x9295, 0x0100, 0x6242, 0x9294,
-	0x0010, 0x0128, 0x2009, 0x00f7, 0x080c, 0x5f9e, 0x00f0, 0x6040,
-	0x9084, 0x0010, 0x9085, 0x0140, 0x6042, 0x6043, 0x0000, 0x7087,
-	0x0000, 0x70a3, 0x0001, 0x70c7, 0x0000, 0x70df, 0x0000, 0x2009,
-	0x1d80, 0x200b, 0x0000, 0x7097, 0x0000, 0x708b, 0x000f, 0x2009,
-	0x000f, 0x2011, 0x5e80, 0x080c, 0x86d7, 0x0005, 0x2001, 0x1869,
-	0x2004, 0xd08c, 0x0110, 0x705f, 0xffff, 0x7088, 0x9005, 0x1528,
-	0x2011, 0x5e80, 0x080c, 0x860d, 0x6040, 0x9094, 0x0010, 0x9285,
-	0x0020, 0x6042, 0x20a9, 0x00c8, 0x6044, 0xd08c, 0x1168, 0x1f04,
-	0x57cc, 0x6242, 0x709b, 0x0000, 0x6040, 0x9094, 0x0010, 0x9285,
-	0x0080, 0x6042, 0x6242, 0x0048, 0x6242, 0x709b, 0x0000, 0x708f,
-	0x0000, 0x9006, 0x080c, 0x6027, 0x0000, 0x0005, 0x708c, 0x908a,
-	0x0003, 0x1a0c, 0x0d7d, 0x000b, 0x0005, 0x57f0, 0x5841, 0x58dc,
-	0x00f6, 0x0016, 0x6900, 0x918c, 0x0800, 0x708f, 0x0001, 0x2001,
-	0x015d, 0x2003, 0x0000, 0x6803, 0x00fc, 0x20a9, 0x0004, 0x6800,
-	0x9084, 0x00fc, 0x0120, 0x1f04, 0x57ff, 0x080c, 0x0d7d, 0x68a0,
-	0x68a2, 0x689c, 0x689e, 0x6898, 0x689a, 0xa001, 0x918d, 0x1600,
-	0x6902, 0x001e, 0x6837, 0x0020, 0x080c, 0x6003, 0x2079, 0x1d00,
-	0x7833, 0x1101, 0x7837, 0x0000, 0x20e1, 0x0001, 0x2099, 0x1805,
-	0x20e9, 0x0001, 0x20a1, 0x1d0e, 0x20a9, 0x0004, 0x4003, 0x080c,
-	0xa66c, 0x20e1, 0x0001, 0x2099, 0x1d00, 0x20e9, 0x0000, 0x20a1,
-	0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c, 0x600f, 0x0000,
-	0x080c, 0x5eb1, 0x00fe, 0x9006, 0x7092, 0x6043, 0x0008, 0x6042,
-	0x0005, 0x00f6, 0x7090, 0x7093, 0x0000, 0x9025, 0x0904, 0x58b9,
-	0x6020, 0xd0b4, 0x1904, 0x58b7, 0x71a0, 0x81ff, 0x0904, 0x58a5,
-	0x9486, 0x000c, 0x1904, 0x58b2, 0x9480, 0x0018, 0x8004, 0x20a8,
-	0x080c, 0x5ffc, 0x2011, 0x0260, 0x2019, 0x1d00, 0x220c, 0x2304,
-	0x9106, 0x11e8, 0x8210, 0x8318, 0x1f04, 0x585e, 0x6043, 0x0004,
-	0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100,
-	0x6043, 0x0006, 0x708f, 0x0002, 0x709b, 0x0002, 0x2009, 0x07d0,
-	0x2011, 0x5e87, 0x080c, 0x86d7, 0x080c, 0x6003, 0x04c0, 0x080c,
-	0x5ffc, 0x2079, 0x0260, 0x7930, 0x918e, 0x1101, 0x1558, 0x7834,
-	0x9005, 0x1540, 0x7900, 0x918c, 0x00ff, 0x1118, 0x7804, 0x9005,
-	0x0190, 0x080c, 0x5ffc, 0x2011, 0x026e, 0x2019, 0x1805, 0x20a9,
-	0x0004, 0x220c, 0x2304, 0x9102, 0x0230, 0x11a0, 0x8210, 0x8318,
-	0x1f04, 0x5899, 0x0078, 0x70a3, 0x0000, 0x080c, 0x5ffc, 0x20e1,
-	0x0000, 0x2099, 0x0260, 0x20e9, 0x0001, 0x20a1, 0x1d00, 0x20a9,
-	0x0014, 0x4003, 0x6043, 0x0008, 0x6043, 0x0000, 0x0010, 0x00fe,
-	0x0005, 0x6040, 0x9085, 0x0100, 0x6042, 0x6020, 0xd0b4, 0x1db8,
-	0x080c, 0xa66c, 0x20e1, 0x0001, 0x2099, 0x1d00, 0x20e9, 0x0000,
-	0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c, 0x2011,
-	0x19f4, 0x2013, 0x0000, 0x7093, 0x0000, 0x60a3, 0x0056, 0x60a7,
-	0x9575, 0x080c, 0x9e01, 0x08d8, 0x0005, 0x7098, 0x908a, 0x001d,
-	0x1a0c, 0x0d7d, 0x000b, 0x0005, 0x590e, 0x5921, 0x594a, 0x596a,
-	0x5990, 0x59bf, 0x59e5, 0x5a1d, 0x5a43, 0x5a71, 0x5aac, 0x5ae4,
-	0x5b02, 0x5b2d, 0x5b4f, 0x5b6a, 0x5b74, 0x5ba8, 0x5bce, 0x5bfd,
-	0x5c23, 0x5c5b, 0x5c9f, 0x5cdc, 0x5cfd, 0x5d56, 0x5d78, 0x5da6,
-	0x5da6, 0x00c6, 0x2061, 0x1800, 0x6003, 0x0007, 0x2061, 0x0100,
-	0x6004, 0x9084, 0xfff9, 0x6006, 0x00ce, 0x0005, 0x2061, 0x0140,
-	0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043, 0x0002,
-	0x709b, 0x0001, 0x2009, 0x07d0, 0x2011, 0x5e87, 0x080c, 0x86d7,
-	0x0005, 0x00f6, 0x7090, 0x9086, 0x0014, 0x1510, 0x6042, 0x6020,
-	0xd0b4, 0x11f0, 0x080c, 0x5ffc, 0x2079, 0x0260, 0x7a30, 0x9296,
-	0x1102, 0x11a0, 0x7834, 0x9005, 0x1188, 0x7a38, 0xd2fc, 0x0128,
-	0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x2011, 0x5e87, 0x080c,
-	0x860d, 0x709b, 0x0010, 0x080c, 0x5b74, 0x0010, 0x7093, 0x0000,
-	0x00fe, 0x0005, 0x00f6, 0x709b, 0x0003, 0x6043, 0x0004, 0x2011,
-	0x5e87, 0x080c, 0x860d, 0x080c, 0x5f80, 0x2079, 0x0240, 0x7833,
-	0x1102, 0x7837, 0x0000, 0x20a9, 0x0008, 0x9f88, 0x000e, 0x200b,
-	0x0000, 0x8108, 0x1f04, 0x595f, 0x60c3, 0x0014, 0x080c, 0x5eb1,
-	0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5e87,
-	0x080c, 0x860d, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ffc, 0x2079,
-	0x0260, 0x7a30, 0x9296, 0x1102, 0x1178, 0x7834, 0x9005, 0x1160,
-	0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
-	0x709b, 0x0004, 0x0029, 0x0010, 0x080c, 0x5fd8, 0x00fe, 0x0005,
-	0x00f6, 0x709b, 0x0005, 0x080c, 0x5f80, 0x2079, 0x0240, 0x7833,
-	0x1103, 0x7837, 0x0000, 0x080c, 0x5ffc, 0x080c, 0x5fdf, 0x1170,
-	0x7084, 0x9005, 0x1158, 0x715c, 0x9186, 0xffff, 0x0138, 0x2011,
-	0x0008, 0x080c, 0x5e34, 0x0168, 0x080c, 0x5fb5, 0x20a9, 0x0008,
-	0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e,
-	0x4003, 0x60c3, 0x0014, 0x080c, 0x5eb1, 0x00fe, 0x0005, 0x00f6,
-	0x7090, 0x9005, 0x0500, 0x2011, 0x5e87, 0x080c, 0x860d, 0x9086,
-	0x0014, 0x11b8, 0x080c, 0x5ffc, 0x2079, 0x0260, 0x7a30, 0x9296,
-	0x1103, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128,
-	0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0006, 0x0029,
-	0x0010, 0x080c, 0x5fd8, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0007,
-	0x080c, 0x5f80, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837, 0x0000,
-	0x080c, 0x5ffc, 0x080c, 0x5fdf, 0x11b8, 0x7084, 0x9005, 0x11a0,
-	0x7164, 0x9186, 0xffff, 0x0180, 0x9180, 0x336d, 0x200d, 0x918c,
-	0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5e34, 0x0180, 0x080c,
-	0x4fdd, 0x0110, 0x080c, 0x2664, 0x20a9, 0x0008, 0x20e1, 0x0000,
-	0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3,
-	0x0014, 0x080c, 0x5eb1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-	0x0500, 0x2011, 0x5e87, 0x080c, 0x860d, 0x9086, 0x0014, 0x11b8,
-	0x080c, 0x5ffc, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1104, 0x1178,
-	0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
-	0x1110, 0x70c7, 0x0001, 0x709b, 0x0008, 0x0029, 0x0010, 0x080c,
-	0x5fd8, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0009, 0x080c, 0x5f80,
-	0x2079, 0x0240, 0x7833, 0x1105, 0x7837, 0x0100, 0x080c, 0x5fdf,
-	0x1150, 0x7084, 0x9005, 0x1138, 0x080c, 0x5da7, 0x1188, 0x9085,
-	0x0001, 0x080c, 0x2664, 0x20a9, 0x0008, 0x080c, 0x5ffc, 0x20e1,
+	0x0005, 0xa897, 0x4000, 0x2001, 0x197e, 0x2004, 0xd0fc, 0x1128,
+	0x080c, 0x56e2, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001,
+	0x2001, 0x0000, 0x0005, 0x78a8, 0xd08c, 0x1118, 0xd084, 0x0904,
+	0x44bd, 0x080c, 0x4ada, 0x0904, 0x35a8, 0x080c, 0x4aa7, 0x1120,
+	0x2009, 0x0002, 0x0804, 0x35a5, 0x080c, 0x6a6b, 0x0130, 0x908e,
+	0x0004, 0x0118, 0x908e, 0x0005, 0x15a0, 0x78a8, 0xd08c, 0x0120,
+	0xb800, 0xc08c, 0xb802, 0x0028, 0x080c, 0x56da, 0xd0b4, 0x0904,
+	0x44f7, 0x7884, 0x908e, 0x007e, 0x0904, 0x44f7, 0x908e, 0x007f,
+	0x0904, 0x44f7, 0x908e, 0x0080, 0x0904, 0x44f7, 0xb800, 0xd08c,
+	0x1904, 0x44f7, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c,
+	0xca07, 0x1120, 0x2009, 0x0003, 0x0804, 0x35a5, 0x7007, 0x0003,
+	0x701f, 0x52f3, 0x0005, 0x080c, 0x4ada, 0x0904, 0x35a8, 0x0804,
+	0x44f7, 0x080c, 0x3363, 0x0108, 0x0005, 0x2009, 0x1834, 0x210c,
+	0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35a5, 0x080c, 0x56ee,
+	0x0120, 0x2009, 0x0007, 0x0804, 0x35a5, 0x080c, 0x6a63, 0x0120,
+	0x2009, 0x0008, 0x0804, 0x35a5, 0xb89c, 0xd0a4, 0x1118, 0xd0ac,
+	0x1904, 0x44f7, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a,
+	0x080c, 0xca6a, 0x1120, 0x2009, 0x0003, 0x0804, 0x35a5, 0x7007,
+	0x0003, 0x701f, 0x532c, 0x0005, 0xa830, 0x9086, 0x0100, 0x1120,
+	0x2009, 0x0004, 0x0804, 0x5637, 0x080c, 0x4ada, 0x0904, 0x35a8,
+	0x0804, 0x52c5, 0x81ff, 0x2009, 0x0001, 0x1904, 0x35a5, 0x080c,
+	0x56ee, 0x2009, 0x0007, 0x1904, 0x35a5, 0x080c, 0x6a63, 0x0120,
+	0x2009, 0x0008, 0x0804, 0x35a5, 0x080c, 0x4ada, 0x0904, 0x35a8,
+	0x080c, 0x6a6b, 0x2009, 0x0009, 0x1904, 0x35a5, 0x080c, 0x4aa7,
+	0x2009, 0x0002, 0x0904, 0x35a5, 0x9006, 0xa866, 0xa832, 0xa868,
+	0xc0fd, 0xa86a, 0x7988, 0x9194, 0xff00, 0x918c, 0x00ff, 0x9006,
+	0x82ff, 0x1128, 0xc0ed, 0xa952, 0x798c, 0xa956, 0x0038, 0x928e,
+	0x0100, 0x1904, 0x35a8, 0xc0e5, 0xa952, 0xa956, 0xa83e, 0x080c,
+	0xcccd, 0x2009, 0x0003, 0x0904, 0x35a5, 0x7007, 0x0003, 0x701f,
+	0x5382, 0x0005, 0xa830, 0x9086, 0x0100, 0x2009, 0x0004, 0x0904,
+	0x35a5, 0x0804, 0x3573, 0x7aa8, 0x9284, 0xc000, 0x0148, 0xd2ec,
+	0x01a0, 0x080c, 0x56ee, 0x1188, 0x2009, 0x0014, 0x0804, 0x35a5,
+	0xd2dc, 0x1568, 0x81ff, 0x2009, 0x0001, 0x1904, 0x35a5, 0x080c,
+	0x56ee, 0x2009, 0x0007, 0x1904, 0x35a5, 0xd2f4, 0x0130, 0x9284,
+	0x5000, 0x080c, 0x56b5, 0x0804, 0x3573, 0xd2fc, 0x0158, 0x080c,
+	0x4ada, 0x0904, 0x35a8, 0x7984, 0x9284, 0x9000, 0x080c, 0x5692,
+	0x0804, 0x3573, 0x080c, 0x4ada, 0x0904, 0x35a8, 0xb804, 0x9084,
+	0x00ff, 0x9086, 0x0006, 0x2009, 0x0009, 0x1904, 0x546b, 0x080c,
+	0x4aa7, 0x2009, 0x0002, 0x0904, 0x546b, 0xa85c, 0x9080, 0x001b,
+	0xaf60, 0x2009, 0x0008, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c,
+	0x4af0, 0x701f, 0x53dc, 0x0005, 0xa86c, 0x9086, 0x0500, 0x1138,
+	0xa870, 0x9005, 0x1120, 0xa874, 0x9084, 0xff00, 0x0110, 0x1904,
+	0x35a8, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0x4ada,
+	0x1110, 0x0804, 0x35a8, 0x2009, 0x0043, 0x080c, 0xcd35, 0x2009,
+	0x0003, 0x0904, 0x546b, 0x7007, 0x0003, 0x701f, 0x5400, 0x0005,
+	0xa830, 0x9086, 0x0100, 0x2009, 0x0004, 0x0904, 0x546b, 0x7984,
+	0x7aa8, 0x9284, 0x1000, 0x080c, 0x5692, 0x0804, 0x3573, 0x00c6,
+	0xaab0, 0x9284, 0xc000, 0x0140, 0xd2ec, 0x0168, 0x080c, 0x56ee,
+	0x1150, 0x2009, 0x0014, 0x04f0, 0x2061, 0x1800, 0x080c, 0x56ee,
+	0x2009, 0x0007, 0x15b8, 0xd2f4, 0x0128, 0x9284, 0x5000, 0x080c,
+	0x56b5, 0x0050, 0xd2fc, 0x0178, 0x080c, 0x4ad8, 0x0588, 0xa998,
+	0x9284, 0x9000, 0x080c, 0x5692, 0xa87b, 0x0000, 0xa883, 0x0000,
+	0xa897, 0x4000, 0x0438, 0x080c, 0x4ad8, 0x0510, 0x080c, 0x6a6b,
+	0x2009, 0x0009, 0x11b8, 0xa8c4, 0x9086, 0x0500, 0x11c8, 0xa8c8,
+	0x9005, 0x11b0, 0xa8cc, 0x9084, 0xff00, 0x1190, 0x080c, 0x4ad8,
+	0x1108, 0x0070, 0x2009, 0x004b, 0x080c, 0xcd35, 0x2009, 0x0003,
+	0x0108, 0x0078, 0x0429, 0x19c0, 0xa897, 0x4005, 0xa99a, 0x0010,
+	0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x00ce,
+	0x0005, 0x9006, 0x0ce0, 0x7aa8, 0xd2dc, 0x0904, 0x35a5, 0x0016,
+	0x7984, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5692, 0x001e, 0x1904,
+	0x35a5, 0x0804, 0x3573, 0x00f6, 0x2d78, 0x0011, 0x00fe, 0x0005,
+	0xaab0, 0xd2dc, 0x0150, 0x0016, 0xa998, 0x9284, 0x1000, 0xc0fd,
+	0x080c, 0x5692, 0x001e, 0x9085, 0x0001, 0x0005, 0x81ff, 0x0120,
+	0x2009, 0x0001, 0x0804, 0x35a5, 0x080c, 0x56ee, 0x0120, 0x2009,
+	0x0007, 0x0804, 0x35a5, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c,
+	0x6625, 0x1904, 0x35a8, 0x9186, 0x007f, 0x0138, 0x080c, 0x6a6b,
+	0x0120, 0x2009, 0x0009, 0x0804, 0x35a5, 0x080c, 0x4aa7, 0x1120,
+	0x2009, 0x0002, 0x0804, 0x35a5, 0xa867, 0x0000, 0xa868, 0xc0fd,
+	0xa86a, 0x2001, 0x0100, 0x8007, 0xa80a, 0x080c, 0xca21, 0x1120,
+	0x2009, 0x0003, 0x0804, 0x35a5, 0x7007, 0x0003, 0x701f, 0x54c9,
+	0x0005, 0xa808, 0x8007, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004,
+	0x0804, 0x35a5, 0xa8e0, 0xa866, 0xa810, 0x8007, 0x9084, 0x00ff,
+	0x800c, 0xa814, 0x8007, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0002,
+	0x9108, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x0004, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x4af3,
+	0x080c, 0x4aa7, 0x1120, 0x2009, 0x0002, 0x0804, 0x35a5, 0x7984,
+	0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118, 0x7023,
+	0x19b3, 0x0040, 0x92c6, 0x0001, 0x1118, 0x7023, 0x19cd, 0x0010,
+	0x0804, 0x35a8, 0x2009, 0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
+	0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x4af0, 0x701f, 0x5519,
+	0x0005, 0x2001, 0x182e, 0x2003, 0x0001, 0xa85c, 0x9080, 0x0019,
+	0x2098, 0xa860, 0x20e0, 0x20a9, 0x001a, 0x7020, 0x20a0, 0x20e9,
+	0x0001, 0x4003, 0x0804, 0x3573, 0x080c, 0x4aa7, 0x1120, 0x2009,
+	0x0002, 0x0804, 0x35a5, 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff,
+	0x8217, 0x82ff, 0x1118, 0x2099, 0x19b3, 0x0040, 0x92c6, 0x0001,
+	0x1118, 0x2099, 0x19cd, 0x0010, 0x0804, 0x35a8, 0xa85c, 0x9080,
+	0x0019, 0x20a0, 0xa860, 0x20e8, 0x20a9, 0x001a, 0x20e1, 0x0001,
+	0x4003, 0x2009, 0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c,
+	0x9080, 0x0019, 0xaf60, 0x0804, 0x4af3, 0x7884, 0x908a, 0x1000,
+	0x1a04, 0x35a8, 0x0126, 0x2091, 0x8000, 0x8003, 0x800b, 0x810b,
+	0x9108, 0x00c6, 0x2061, 0x1a03, 0x6142, 0x00ce, 0x012e, 0x0804,
+	0x3573, 0x00c6, 0x080c, 0x74e9, 0x1160, 0x080c, 0x77ed, 0x080c,
+	0x6029, 0x9085, 0x0001, 0x080c, 0x7530, 0x080c, 0x741a, 0x080c,
+	0x0d7d, 0x2061, 0x1800, 0x6030, 0xc09d, 0x6032, 0x080c, 0x5ee4,
+	0x00ce, 0x0005, 0x00c6, 0x2001, 0x1800, 0x2004, 0x908e, 0x0000,
+	0x0904, 0x35a5, 0x7884, 0x9005, 0x0188, 0x7888, 0x2061, 0x199c,
+	0x2c0c, 0x2062, 0x080c, 0x29d8, 0x01a0, 0x080c, 0x29e0, 0x0188,
+	0x080c, 0x29e8, 0x0170, 0x2162, 0x0804, 0x35a8, 0x2061, 0x0100,
+	0x6038, 0x9086, 0x0007, 0x1118, 0x2009, 0x0001, 0x0010, 0x2009,
+	0x0000, 0x7884, 0x9086, 0x0002, 0x1588, 0x2061, 0x0100, 0x6028,
+	0xc09c, 0x602a, 0x080c, 0xa896, 0x0026, 0x2011, 0x0003, 0x080c,
+	0xa1cf, 0x2011, 0x0002, 0x080c, 0xa1d9, 0x002e, 0x080c, 0xa098,
+	0x0036, 0x901e, 0x080c, 0xa118, 0x003e, 0x080c, 0xa8b2, 0x60e3,
+	0x0000, 0x080c, 0xe702, 0x080c, 0xe71d, 0x9085, 0x0001, 0x080c,
+	0x7530, 0x9006, 0x080c, 0x2a0a, 0x2001, 0x1800, 0x2003, 0x0004,
+	0x0026, 0x2011, 0x0008, 0x080c, 0x2a44, 0x002e, 0x00ce, 0x0804,
+	0x3573, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x35a5, 0x080c,
+	0x56ee, 0x0120, 0x2009, 0x0007, 0x0804, 0x35a5, 0x7984, 0x7ea8,
+	0x96b4, 0x00ff, 0x080c, 0x6625, 0x1904, 0x35a8, 0x9186, 0x007f,
+	0x0138, 0x080c, 0x6a6b, 0x0120, 0x2009, 0x0009, 0x0804, 0x35a5,
+	0x080c, 0x4aa7, 0x1120, 0x2009, 0x0002, 0x0804, 0x35a5, 0xa867,
+	0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xca24, 0x1120, 0x2009,
+	0x0003, 0x0804, 0x35a5, 0x7007, 0x0003, 0x701f, 0x5620, 0x0005,
+	0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x35a5,
+	0xa8e0, 0xa866, 0xa834, 0x8007, 0x800c, 0xa85c, 0x9080, 0x000c,
+	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xaf60, 0x0804, 0x4af3, 0xa898,
+	0x9086, 0x000d, 0x1904, 0x35a5, 0x2021, 0x4005, 0x0126, 0x2091,
+	0x8000, 0x0e04, 0x5644, 0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486,
+	0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833, 0x0010, 0x7883,
+	0x4005, 0xa998, 0x7986, 0xa9a4, 0x799a, 0xa9a8, 0x799e, 0x080c,
+	0x4ae3, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
+	0x11d6, 0x7007, 0x0001, 0x2091, 0x5000, 0x700f, 0x0000, 0x012e,
+	0x0005, 0x0126, 0x2091, 0x8000, 0x00c6, 0x2061, 0x1a03, 0x7984,
+	0x6152, 0x614e, 0x6057, 0x0000, 0x604b, 0x0009, 0x7898, 0x606a,
+	0x789c, 0x6066, 0x7888, 0x6062, 0x788c, 0x605e, 0x2001, 0x1a11,
+	0x2044, 0x2001, 0x1a18, 0xa076, 0xa060, 0xa072, 0xa07b, 0x0001,
+	0xa07f, 0x0002, 0xa06b, 0x0000, 0xa09f, 0x0000, 0x00ce, 0x012e,
+	0x0804, 0x3573, 0x0126, 0x2091, 0x8000, 0x00b6, 0x00c6, 0x90e4,
+	0xc000, 0x0128, 0x0006, 0x080c, 0xc885, 0x000e, 0x1198, 0xd0e4,
+	0x0160, 0x9180, 0x1000, 0x2004, 0x905d, 0x0160, 0x080c, 0x6043,
+	0x080c, 0xab57, 0x0110, 0xb817, 0x0000, 0x9006, 0x00ce, 0x00be,
+	0x012e, 0x0005, 0x9085, 0x0001, 0x0cc8, 0x0126, 0x2091, 0x8000,
+	0x0156, 0x2010, 0x900e, 0x20a9, 0x0800, 0x0016, 0x9180, 0x1000,
+	0x2004, 0x9005, 0x0180, 0x9186, 0x007e, 0x0168, 0x9186, 0x007f,
+	0x0150, 0x9186, 0x0080, 0x0138, 0x9186, 0x00ff, 0x0120, 0x0026,
+	0x2200, 0x0801, 0x002e, 0x001e, 0x8108, 0x1f04, 0x56bd, 0x015e,
+	0x012e, 0x0005, 0x2001, 0x1848, 0x2004, 0x0005, 0x2001, 0x1867,
+	0x2004, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0d4, 0x000e,
+	0x0005, 0x2001, 0x180e, 0x2004, 0xd0b4, 0x0005, 0x2001, 0x1800,
+	0x2004, 0x9086, 0x0003, 0x0005, 0x0016, 0x00e6, 0x2071, 0x189e,
+	0x7108, 0x910d, 0x710a, 0x00ee, 0x001e, 0x0005, 0x79a4, 0x9182,
+	0x0081, 0x1a04, 0x35a8, 0x810c, 0x0016, 0x080c, 0x4aa7, 0x080c,
+	0x0f42, 0x2100, 0x2238, 0x7d84, 0x7c88, 0x7b8c, 0x7a90, 0x001e,
+	0x080c, 0x4af0, 0x701f, 0x5715, 0x0005, 0x2079, 0x0000, 0x7d94,
+	0x7c98, 0x7ba8, 0x7aac, 0x79a4, 0x810c, 0x2061, 0x18b8, 0x2c44,
+	0xa770, 0xa074, 0x2071, 0x189e, 0x080c, 0x4af3, 0x701f, 0x5729,
+	0x0005, 0x2061, 0x18b8, 0x2c44, 0x0016, 0x0026, 0xa270, 0xa174,
+	0x080c, 0x0f4a, 0x002e, 0x001e, 0x080c, 0x0ff7, 0x9006, 0xa802,
+	0xa806, 0x0804, 0x3573, 0x0126, 0x0156, 0x0136, 0x0146, 0x01c6,
+	0x01d6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2061, 0x0100, 0x2069,
+	0x0200, 0x2071, 0x1800, 0x6044, 0xd0a4, 0x11e8, 0xd084, 0x0118,
+	0x080c, 0x58e4, 0x0068, 0xd08c, 0x0118, 0x080c, 0x57ed, 0x0040,
+	0xd094, 0x0118, 0x080c, 0x57bd, 0x0018, 0xd09c, 0x0108, 0x0099,
+	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e,
+	0x015e, 0x012e, 0x0005, 0x0016, 0x6128, 0xd19c, 0x1110, 0xc19d,
+	0x612a, 0x001e, 0x0c68, 0x0006, 0x7098, 0x9005, 0x000e, 0x0120,
+	0x709b, 0x0000, 0x7093, 0x0000, 0x624c, 0x9286, 0xf0f0, 0x1150,
+	0x6048, 0x9086, 0xf0f0, 0x0130, 0x624a, 0x6043, 0x0090, 0x6043,
+	0x0010, 0x0490, 0x9294, 0xff00, 0x9296, 0xf700, 0x0178, 0x7138,
+	0xd1a4, 0x1160, 0x6240, 0x9295, 0x0100, 0x6242, 0x9294, 0x0010,
+	0x0128, 0x2009, 0x00f7, 0x080c, 0x5fa5, 0x00f0, 0x6040, 0x9084,
+	0x0010, 0x9085, 0x0140, 0x6042, 0x6043, 0x0000, 0x7087, 0x0000,
+	0x70a3, 0x0001, 0x70c7, 0x0000, 0x70df, 0x0000, 0x2009, 0x1d80,
+	0x200b, 0x0000, 0x7097, 0x0000, 0x708b, 0x000f, 0x2009, 0x000f,
+	0x2011, 0x5e87, 0x080c, 0x8708, 0x0005, 0x2001, 0x1869, 0x2004,
+	0xd08c, 0x0110, 0x705f, 0xffff, 0x7088, 0x9005, 0x1528, 0x2011,
+	0x5e87, 0x080c, 0x863e, 0x6040, 0x9094, 0x0010, 0x9285, 0x0020,
+	0x6042, 0x20a9, 0x00c8, 0x6044, 0xd08c, 0x1168, 0x1f04, 0x57d3,
+	0x6242, 0x709b, 0x0000, 0x6040, 0x9094, 0x0010, 0x9285, 0x0080,
+	0x6042, 0x6242, 0x0048, 0x6242, 0x709b, 0x0000, 0x708f, 0x0000,
+	0x9006, 0x080c, 0x602e, 0x0000, 0x0005, 0x708c, 0x908a, 0x0003,
+	0x1a0c, 0x0d7d, 0x000b, 0x0005, 0x57f7, 0x5848, 0x58e3, 0x00f6,
+	0x0016, 0x6900, 0x918c, 0x0800, 0x708f, 0x0001, 0x2001, 0x015d,
+	0x2003, 0x0000, 0x6803, 0x00fc, 0x20a9, 0x0004, 0x6800, 0x9084,
+	0x00fc, 0x0120, 0x1f04, 0x5806, 0x080c, 0x0d7d, 0x68a0, 0x68a2,
+	0x689c, 0x689e, 0x6898, 0x689a, 0xa001, 0x918d, 0x1600, 0x6902,
+	0x001e, 0x6837, 0x0020, 0x080c, 0x600a, 0x2079, 0x1d00, 0x7833,
+	0x1101, 0x7837, 0x0000, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
+	0x0001, 0x20a1, 0x1d0e, 0x20a9, 0x0004, 0x4003, 0x080c, 0xa690,
+	0x20e1, 0x0001, 0x2099, 0x1d00, 0x20e9, 0x0000, 0x20a1, 0x0240,
+	0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c, 0x600f, 0x0000, 0x080c,
+	0x5eb8, 0x00fe, 0x9006, 0x7092, 0x6043, 0x0008, 0x6042, 0x0005,
+	0x00f6, 0x7090, 0x7093, 0x0000, 0x9025, 0x0904, 0x58c0, 0x6020,
+	0xd0b4, 0x1904, 0x58be, 0x71a0, 0x81ff, 0x0904, 0x58ac, 0x9486,
+	0x000c, 0x1904, 0x58b9, 0x9480, 0x0018, 0x8004, 0x20a8, 0x080c,
+	0x6003, 0x2011, 0x0260, 0x2019, 0x1d00, 0x220c, 0x2304, 0x9106,
+	0x11e8, 0x8210, 0x8318, 0x1f04, 0x5865, 0x6043, 0x0004, 0x2061,
+	0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043,
+	0x0006, 0x708f, 0x0002, 0x709b, 0x0002, 0x2009, 0x07d0, 0x2011,
+	0x5e8e, 0x080c, 0x8708, 0x080c, 0x600a, 0x04c0, 0x080c, 0x6003,
+	0x2079, 0x0260, 0x7930, 0x918e, 0x1101, 0x1558, 0x7834, 0x9005,
+	0x1540, 0x7900, 0x918c, 0x00ff, 0x1118, 0x7804, 0x9005, 0x0190,
+	0x080c, 0x6003, 0x2011, 0x026e, 0x2019, 0x1805, 0x20a9, 0x0004,
+	0x220c, 0x2304, 0x9102, 0x0230, 0x11a0, 0x8210, 0x8318, 0x1f04,
+	0x58a0, 0x0078, 0x70a3, 0x0000, 0x080c, 0x6003, 0x20e1, 0x0000,
+	0x2099, 0x0260, 0x20e9, 0x0001, 0x20a1, 0x1d00, 0x20a9, 0x0014,
+	0x4003, 0x6043, 0x0008, 0x6043, 0x0000, 0x0010, 0x00fe, 0x0005,
+	0x6040, 0x9085, 0x0100, 0x6042, 0x6020, 0xd0b4, 0x1db8, 0x080c,
+	0xa690, 0x20e1, 0x0001, 0x2099, 0x1d00, 0x20e9, 0x0000, 0x20a1,
+	0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c, 0x2011, 0x19f4,
+	0x2013, 0x0000, 0x7093, 0x0000, 0x60a3, 0x0056, 0x60a7, 0x9575,
+	0x080c, 0x9e25, 0x08d8, 0x0005, 0x7098, 0x908a, 0x001d, 0x1a0c,
+	0x0d7d, 0x000b, 0x0005, 0x5915, 0x5928, 0x5951, 0x5971, 0x5997,
+	0x59c6, 0x59ec, 0x5a24, 0x5a4a, 0x5a78, 0x5ab3, 0x5aeb, 0x5b09,
+	0x5b34, 0x5b56, 0x5b71, 0x5b7b, 0x5baf, 0x5bd5, 0x5c04, 0x5c2a,
+	0x5c62, 0x5ca6, 0x5ce3, 0x5d04, 0x5d5d, 0x5d7f, 0x5dad, 0x5dad,
+	0x00c6, 0x2061, 0x1800, 0x6003, 0x0007, 0x2061, 0x0100, 0x6004,
+	0x9084, 0xfff9, 0x6006, 0x00ce, 0x0005, 0x2061, 0x0140, 0x605b,
+	0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043, 0x0002, 0x709b,
+	0x0001, 0x2009, 0x07d0, 0x2011, 0x5e8e, 0x080c, 0x8708, 0x0005,
+	0x00f6, 0x7090, 0x9086, 0x0014, 0x1510, 0x6042, 0x6020, 0xd0b4,
+	0x11f0, 0x080c, 0x6003, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102,
+	0x11a0, 0x7834, 0x9005, 0x1188, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
+	0x9005, 0x1110, 0x70c7, 0x0001, 0x2011, 0x5e8e, 0x080c, 0x863e,
+	0x709b, 0x0010, 0x080c, 0x5b7b, 0x0010, 0x7093, 0x0000, 0x00fe,
+	0x0005, 0x00f6, 0x709b, 0x0003, 0x6043, 0x0004, 0x2011, 0x5e8e,
+	0x080c, 0x863e, 0x080c, 0x5f87, 0x2079, 0x0240, 0x7833, 0x1102,
+	0x7837, 0x0000, 0x20a9, 0x0008, 0x9f88, 0x000e, 0x200b, 0x0000,
+	0x8108, 0x1f04, 0x5966, 0x60c3, 0x0014, 0x080c, 0x5eb8, 0x00fe,
+	0x0005, 0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5e8e, 0x080c,
+	0x863e, 0x9086, 0x0014, 0x11b8, 0x080c, 0x6003, 0x2079, 0x0260,
+	0x7a30, 0x9296, 0x1102, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
+	0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b,
+	0x0004, 0x0029, 0x0010, 0x080c, 0x5fdf, 0x00fe, 0x0005, 0x00f6,
+	0x709b, 0x0005, 0x080c, 0x5f87, 0x2079, 0x0240, 0x7833, 0x1103,
+	0x7837, 0x0000, 0x080c, 0x6003, 0x080c, 0x5fe6, 0x1170, 0x7084,
+	0x9005, 0x1158, 0x715c, 0x9186, 0xffff, 0x0138, 0x2011, 0x0008,
+	0x080c, 0x5e3b, 0x0168, 0x080c, 0x5fbc, 0x20a9, 0x0008, 0x20e1,
 	0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003,
-	0x60c3, 0x0014, 0x080c, 0x5eb1, 0x0010, 0x080c, 0x5901, 0x00fe,
-	0x0005, 0x00f6, 0x7090, 0x9005, 0x05a8, 0x2011, 0x5e87, 0x080c,
-	0x860d, 0x9086, 0x0014, 0x1560, 0x080c, 0x5ffc, 0x2079, 0x0260,
-	0x7a30, 0x9296, 0x1105, 0x1520, 0x7834, 0x9084, 0x0100, 0x2011,
-	0x0100, 0x921e, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
-	0x1110, 0x70c7, 0x0001, 0x709b, 0x000a, 0x00b1, 0x0098, 0x9005,
-	0x1178, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
-	0x0001, 0x7097, 0x0000, 0x709b, 0x000e, 0x080c, 0x5b4f, 0x0010,
-	0x080c, 0x5fd8, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x000b, 0x2011,
-	0x1d0e, 0x20e9, 0x0001, 0x22a0, 0x20a9, 0x0040, 0x2019, 0xffff,
-	0x4304, 0x080c, 0x5f80, 0x2079, 0x0240, 0x7833, 0x1106, 0x7837,
-	0x0000, 0x080c, 0x5fdf, 0x0118, 0x2013, 0x0000, 0x0020, 0x7060,
-	0x9085, 0x0100, 0x2012, 0x20a9, 0x0040, 0x2009, 0x024e, 0x2011,
-	0x1d0e, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1128, 0x6810,
-	0x8000, 0x6812, 0x2009, 0x0240, 0x1f04, 0x5ad1, 0x60c3, 0x0084,
-	0x080c, 0x5eb1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01c0,
-	0x2011, 0x5e87, 0x080c, 0x860d, 0x9086, 0x0084, 0x1178, 0x080c,
-	0x5ffc, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1106, 0x1138, 0x7834,
-	0x9005, 0x1120, 0x709b, 0x000c, 0x0029, 0x0010, 0x080c, 0x5fd8,
-	0x00fe, 0x0005, 0x00f6, 0x709b, 0x000d, 0x080c, 0x5f80, 0x2079,
-	0x0240, 0x7833, 0x1107, 0x7837, 0x0000, 0x080c, 0x5ffc, 0x20a9,
-	0x0040, 0x2011, 0x026e, 0x2009, 0x024e, 0x220e, 0x8210, 0x8108,
-	0x9186, 0x0260, 0x1150, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240,
-	0x6814, 0x8000, 0x6816, 0x2011, 0x0260, 0x1f04, 0x5b15, 0x60c3,
-	0x0084, 0x080c, 0x5eb1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-	0x01e0, 0x2011, 0x5e87, 0x080c, 0x860d, 0x9086, 0x0084, 0x1198,
-	0x080c, 0x5ffc, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1107, 0x1158,
-	0x7834, 0x9005, 0x1140, 0x7097, 0x0001, 0x080c, 0x5f52, 0x709b,
-	0x000e, 0x0029, 0x0010, 0x080c, 0x5fd8, 0x00fe, 0x0005, 0x918d,
-	0x0001, 0x080c, 0x6027, 0x709b, 0x000f, 0x7093, 0x0000, 0x2061,
-	0x0140, 0x605b, 0xbc85, 0x605f, 0xb5b5, 0x2061, 0x0100, 0x6043,
-	0x0005, 0x6043, 0x0004, 0x2009, 0x07d0, 0x2011, 0x5e87, 0x080c,
-	0x8601, 0x0005, 0x7090, 0x9005, 0x0130, 0x2011, 0x5e87, 0x080c,
-	0x860d, 0x709b, 0x0000, 0x0005, 0x709b, 0x0011, 0x080c, 0xa66c,
-	0x080c, 0x5ffc, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000,
-	0x20a1, 0x0240, 0x7490, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084,
-	0x03f8, 0x8004, 0x20a8, 0x4003, 0x080c, 0x5fdf, 0x11a0, 0x717c,
-	0x81ff, 0x0188, 0x900e, 0x7080, 0x9084, 0x00ff, 0x0160, 0x080c,
-	0x25fb, 0x9186, 0x007e, 0x0138, 0x9186, 0x0080, 0x0120, 0x2011,
-	0x0008, 0x080c, 0x5e34, 0x60c3, 0x0014, 0x080c, 0x5eb1, 0x0005,
-	0x00f6, 0x7090, 0x9005, 0x0500, 0x2011, 0x5e87, 0x080c, 0x860d,
-	0x9086, 0x0014, 0x11b8, 0x080c, 0x5ffc, 0x2079, 0x0260, 0x7a30,
-	0x9296, 0x1103, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
-	0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0012,
-	0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b,
-	0x0013, 0x080c, 0x5f8e, 0x2079, 0x0240, 0x7833, 0x1103, 0x7837,
-	0x0000, 0x080c, 0x5ffc, 0x080c, 0x5fdf, 0x1170, 0x7084, 0x9005,
-	0x1158, 0x715c, 0x9186, 0xffff, 0x0138, 0x2011, 0x0008, 0x080c,
-	0x5e34, 0x0168, 0x080c, 0x5fb5, 0x20a9, 0x0008, 0x20e1, 0x0000,
+	0x60c3, 0x0014, 0x080c, 0x5eb8, 0x00fe, 0x0005, 0x00f6, 0x7090,
+	0x9005, 0x0500, 0x2011, 0x5e8e, 0x080c, 0x863e, 0x9086, 0x0014,
+	0x11b8, 0x080c, 0x6003, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1103,
+	0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
+	0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0006, 0x0029, 0x0010,
+	0x080c, 0x5fdf, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0007, 0x080c,
+	0x5f87, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837, 0x0000, 0x080c,
+	0x6003, 0x080c, 0x5fe6, 0x11b8, 0x7084, 0x9005, 0x11a0, 0x7164,
+	0x9186, 0xffff, 0x0180, 0x9180, 0x3374, 0x200d, 0x918c, 0xff00,
+	0x810f, 0x2011, 0x0008, 0x080c, 0x5e3b, 0x0180, 0x080c, 0x4fe4,
+	0x0110, 0x080c, 0x2664, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099,
+	0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014,
+	0x080c, 0x5eb8, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500,
+	0x2011, 0x5e8e, 0x080c, 0x863e, 0x9086, 0x0014, 0x11b8, 0x080c,
+	0x6003, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1104, 0x1178, 0x7834,
+	0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
+	0x70c7, 0x0001, 0x709b, 0x0008, 0x0029, 0x0010, 0x080c, 0x5fdf,
+	0x00fe, 0x0005, 0x00f6, 0x709b, 0x0009, 0x080c, 0x5f87, 0x2079,
+	0x0240, 0x7833, 0x1105, 0x7837, 0x0100, 0x080c, 0x5fe6, 0x1150,
+	0x7084, 0x9005, 0x1138, 0x080c, 0x5dae, 0x1188, 0x9085, 0x0001,
+	0x080c, 0x2664, 0x20a9, 0x0008, 0x080c, 0x6003, 0x20e1, 0x0000,
 	0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3,
-	0x0014, 0x080c, 0x5eb1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
-	0x0500, 0x2011, 0x5e87, 0x080c, 0x860d, 0x9086, 0x0014, 0x11b8,
-	0x080c, 0x5ffc, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1104, 0x1178,
-	0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
-	0x1110, 0x70c7, 0x0001, 0x709b, 0x0014, 0x0029, 0x0010, 0x7093,
-	0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0015, 0x080c, 0x5f8e,
-	0x2079, 0x0240, 0x7833, 0x1104, 0x7837, 0x0000, 0x080c, 0x5ffc,
-	0x080c, 0x5fdf, 0x11b8, 0x7084, 0x9005, 0x11a0, 0x7164, 0x9186,
-	0xffff, 0x0180, 0x9180, 0x336d, 0x200d, 0x918c, 0xff00, 0x810f,
-	0x2011, 0x0008, 0x080c, 0x5e34, 0x0180, 0x080c, 0x4fdd, 0x0110,
-	0x080c, 0x2664, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e,
-	0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c,
-	0x5eb1, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x05f0, 0x2011,
-	0x5e87, 0x080c, 0x860d, 0x9086, 0x0014, 0x15a8, 0x080c, 0x5ffc,
-	0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1568, 0x7834, 0x9084,
-	0x0100, 0x2011, 0x0100, 0x921e, 0x1168, 0x9085, 0x0001, 0x080c,
-	0x6027, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7,
-	0x0001, 0x0080, 0x9005, 0x11b8, 0x7a38, 0xd2fc, 0x0128, 0x70c4,
-	0x9005, 0x1110, 0x70c7, 0x0001, 0x9085, 0x0001, 0x080c, 0x6027,
-	0x7097, 0x0000, 0x7a38, 0xd2f4, 0x0110, 0x70df, 0x0008, 0x709b,
-	0x0016, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x080c,
-	0xa66c, 0x080c, 0x5ffc, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9,
-	0x0000, 0x20a1, 0x0240, 0x20a9, 0x000e, 0x4003, 0x2011, 0x026d,
-	0x2204, 0x9084, 0x0100, 0x2011, 0x024d, 0x2012, 0x2011, 0x026e,
-	0x709b, 0x0017, 0x080c, 0x5fdf, 0x1150, 0x7084, 0x9005, 0x1138,
-	0x080c, 0x5da7, 0x1188, 0x9085, 0x0001, 0x080c, 0x2664, 0x20a9,
-	0x0008, 0x080c, 0x5ffc, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-	0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5eb1,
-	0x0010, 0x080c, 0x5901, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01d8,
-	0x2011, 0x5e87, 0x080c, 0x860d, 0x9086, 0x0084, 0x1190, 0x080c,
-	0x5ffc, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1106, 0x1150, 0x7834,
-	0x9005, 0x1138, 0x9006, 0x080c, 0x6027, 0x709b, 0x0018, 0x0029,
-	0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0019,
-	0x080c, 0x5f8e, 0x2079, 0x0240, 0x7833, 0x1106, 0x7837, 0x0000,
-	0x080c, 0x5ffc, 0x2009, 0x026e, 0x2039, 0x1d0e, 0x20a9, 0x0040,
-	0x213e, 0x8738, 0x8108, 0x9186, 0x0280, 0x1128, 0x6814, 0x8000,
-	0x6816, 0x2009, 0x0260, 0x1f04, 0x5d10, 0x2039, 0x1d0e, 0x080c,
-	0x5fdf, 0x11e8, 0x2728, 0x2514, 0x8207, 0x9084, 0x00ff, 0x8000,
-	0x2018, 0x9294, 0x00ff, 0x8007, 0x9205, 0x202a, 0x7060, 0x2310,
-	0x8214, 0x92a0, 0x1d0e, 0x2414, 0x938c, 0x0001, 0x0118, 0x9294,
-	0xff00, 0x0018, 0x9294, 0x00ff, 0x8007, 0x9215, 0x2222, 0x20a9,
-	0x0040, 0x2009, 0x024e, 0x270e, 0x8738, 0x8108, 0x9186, 0x0260,
-	0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04, 0x5d43,
-	0x60c3, 0x0084, 0x080c, 0x5eb1, 0x00fe, 0x0005, 0x00f6, 0x7090,
-	0x9005, 0x01e0, 0x2011, 0x5e87, 0x080c, 0x860d, 0x9086, 0x0084,
-	0x1198, 0x080c, 0x5ffc, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1107,
-	0x1158, 0x7834, 0x9005, 0x1140, 0x7097, 0x0001, 0x080c, 0x5f52,
-	0x709b, 0x001a, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005,
-	0x9085, 0x0001, 0x080c, 0x6027, 0x709b, 0x001b, 0x080c, 0xa66c,
-	0x080c, 0x5ffc, 0x2011, 0x0260, 0x2009, 0x0240, 0x7490, 0x9480,
-	0x0018, 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x220e,
-	0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000, 0x6812,
-	0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260, 0x1f04,
-	0x5d8f, 0x60c3, 0x0084, 0x080c, 0x5eb1, 0x0005, 0x0005, 0x0086,
-	0x0096, 0x2029, 0x1848, 0x252c, 0x20a9, 0x0008, 0x2041, 0x1d0e,
-	0x20e9, 0x0001, 0x28a0, 0x080c, 0x5ffc, 0x20e1, 0x0000, 0x2099,
-	0x026e, 0x4003, 0x20a9, 0x0008, 0x2011, 0x0007, 0xd5d4, 0x0108,
-	0x9016, 0x2800, 0x9200, 0x200c, 0x91a6, 0xffff, 0x1148, 0xd5d4,
-	0x0110, 0x8210, 0x0008, 0x8211, 0x1f04, 0x5dc1, 0x0804, 0x5e30,
-	0x82ff, 0x1160, 0xd5d4, 0x0120, 0x91a6, 0x3fff, 0x0d90, 0x0020,
-	0x91a6, 0x3fff, 0x0904, 0x5e30, 0x918d, 0xc000, 0x20a9, 0x0010,
-	0x2019, 0x0001, 0xd5d4, 0x0110, 0x2019, 0x0010, 0x2120, 0xd5d4,
-	0x0110, 0x8423, 0x0008, 0x8424, 0x1240, 0xd5d4, 0x0110, 0x8319,
-	0x0008, 0x8318, 0x1f04, 0x5de7, 0x04d8, 0x23a8, 0x2021, 0x0001,
-	0x8426, 0x8425, 0x1f04, 0x5df9, 0x2328, 0x8529, 0x92be, 0x0007,
-	0x0158, 0x0006, 0x2039, 0x0007, 0x2200, 0x973a, 0x000e, 0x27a8,
-	0x95a8, 0x0010, 0x1f04, 0x5e08, 0x755e, 0x95c8, 0x336d, 0x292d,
-	0x95ac, 0x00ff, 0x7582, 0x6532, 0x6536, 0x0016, 0x2508, 0x080c,
-	0x2644, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x2018, 0x2304, 0x9405,
-	0x201a, 0x7087, 0x0001, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x20e1,
-	0x0001, 0x2898, 0x20a9, 0x0008, 0x4003, 0x9085, 0x0001, 0x0008,
-	0x9006, 0x009e, 0x008e, 0x0005, 0x0156, 0x01c6, 0x01d6, 0x0136,
-	0x0146, 0x22a8, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
-	0x2011, 0x024e, 0x22a0, 0x4003, 0x014e, 0x013e, 0x01de, 0x01ce,
-	0x015e, 0x2118, 0x9026, 0x2001, 0x0007, 0x939a, 0x0010, 0x0218,
-	0x8420, 0x8001, 0x0cd0, 0x2118, 0x84ff, 0x0120, 0x939a, 0x0010,
-	0x8421, 0x1de0, 0x2021, 0x0001, 0x83ff, 0x0118, 0x8423, 0x8319,
-	0x1de8, 0x9238, 0x2029, 0x026e, 0x9528, 0x2504, 0x942c, 0x11b8,
-	0x9405, 0x203a, 0x715e, 0x91a0, 0x336d, 0x242d, 0x95ac, 0x00ff,
-	0x7582, 0x6532, 0x6536, 0x0016, 0x2508, 0x080c, 0x2644, 0x001e,
-	0x60e7, 0x0000, 0x65ea, 0x7087, 0x0001, 0x9084, 0x0000, 0x0005,
-	0x00e6, 0x2071, 0x1800, 0x708b, 0x0000, 0x00ee, 0x0005, 0x00e6,
-	0x00f6, 0x2079, 0x0100, 0x2071, 0x0140, 0x080c, 0x5f41, 0x080c,
-	0x9e0e, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2a1a, 0x0126,
-	0x2091, 0x8000, 0x2071, 0x1826, 0x2073, 0x0000, 0x7840, 0x0026,
-	0x0016, 0x2009, 0x00f7, 0x080c, 0x5f9e, 0x001e, 0x9094, 0x0010,
-	0x9285, 0x0080, 0x7842, 0x7a42, 0x002e, 0x012e, 0x00fe, 0x00ee,
-	0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x2979, 0x0228, 0x2011,
-	0x0101, 0x2204, 0xc0c5, 0x2012, 0x2011, 0x19f4, 0x2013, 0x0000,
-	0x7093, 0x0000, 0x012e, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c,
-	0x9e01, 0x6144, 0xd184, 0x0120, 0x7198, 0x918d, 0x2000, 0x0018,
-	0x718c, 0x918d, 0x1000, 0x2011, 0x1999, 0x2112, 0x2009, 0x07d0,
-	0x2011, 0x5e87, 0x080c, 0x86d7, 0x0005, 0x0016, 0x0026, 0x00c6,
-	0x0126, 0x2091, 0x8000, 0x080c, 0xa872, 0x080c, 0xab3a, 0x080c,
-	0xa88e, 0x2009, 0x00f7, 0x080c, 0x5f9e, 0x2061, 0x1a03, 0x900e,
-	0x611a, 0x611e, 0x6172, 0x6176, 0x2061, 0x1800, 0x6003, 0x0001,
-	0x2061, 0x0100, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009, 0x1999,
-	0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5f0d, 0x080c, 0x8601,
-	0x012e, 0x00ce, 0x002e, 0x001e, 0x0005, 0x00e6, 0x0006, 0x0126,
-	0x2091, 0x8000, 0x0471, 0x2071, 0x0100, 0x080c, 0x9e0e, 0x2071,
-	0x0140, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2a1a, 0x080c,
-	0x74dd, 0x0188, 0x080c, 0x74f8, 0x1170, 0x080c, 0x77e3, 0x0016,
-	0x080c, 0x2713, 0x2001, 0x196d, 0x2102, 0x001e, 0x080c, 0x77de,
-	0x080c, 0x7406, 0x0050, 0x2009, 0x0001, 0x080c, 0x29f6, 0x2001,
-	0x0001, 0x080c, 0x25a0, 0x080c, 0x5edd, 0x012e, 0x000e, 0x00ee,
-	0x0005, 0x2001, 0x180e, 0x2004, 0xd0bc, 0x0158, 0x0026, 0x0036,
-	0x2011, 0x8017, 0x2001, 0x1999, 0x201c, 0x080c, 0x4b00, 0x003e,
-	0x002e, 0x0005, 0x20a9, 0x0012, 0x20e9, 0x0001, 0x20a1, 0x1d80,
-	0x080c, 0x5ffc, 0x20e9, 0x0000, 0x2099, 0x026e, 0x0099, 0x20a9,
-	0x0020, 0x080c, 0x5ff6, 0x2099, 0x0260, 0x20a1, 0x1d92, 0x0051,
-	0x20a9, 0x000e, 0x080c, 0x5ff9, 0x2099, 0x0260, 0x20a1, 0x1db2,
-	0x0009, 0x0005, 0x0016, 0x0026, 0x3410, 0x3308, 0x2104, 0x8007,
-	0x2012, 0x8108, 0x8210, 0x1f04, 0x5f76, 0x002e, 0x001e, 0x0005,
-	0x080c, 0xa66c, 0x20e1, 0x0001, 0x2099, 0x1d00, 0x20e9, 0x0000,
-	0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x080c, 0xa66c,
-	0x080c, 0x5ffc, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000,
-	0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x00c6, 0x0006,
-	0x2061, 0x0100, 0x810f, 0x2001, 0x1834, 0x2004, 0x9005, 0x1138,
-	0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x9105, 0x0010, 0x9185,
-	0x00f7, 0x604a, 0x000e, 0x00ce, 0x0005, 0x0016, 0x0046, 0x080c,
-	0x6a57, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xe29e,
-	0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x900e,
-	0x080c, 0x31a3, 0x080c, 0xcf2e, 0x0140, 0x0036, 0x2019, 0xffff,
-	0x2021, 0x0007, 0x080c, 0x4cb7, 0x003e, 0x004e, 0x001e, 0x0005,
-	0x080c, 0x5edd, 0x709b, 0x0000, 0x7093, 0x0000, 0x0005, 0x0006,
-	0x2001, 0x180c, 0x2004, 0xd09c, 0x0100, 0x000e, 0x0005, 0x0006,
-	0x0016, 0x0126, 0x2091, 0x8000, 0x2001, 0x0101, 0x200c, 0x918d,
-	0x0006, 0x2102, 0x012e, 0x001e, 0x000e, 0x0005, 0x2009, 0x0001,
-	0x0020, 0x2009, 0x0002, 0x0008, 0x900e, 0x6814, 0x9084, 0xffc0,
-	0x910d, 0x6916, 0x0005, 0x00f6, 0x0156, 0x0146, 0x01d6, 0x9006,
-	0x20a9, 0x0080, 0x20e9, 0x0001, 0x20a1, 0x1d00, 0x4004, 0x2079,
-	0x1d00, 0x7803, 0x2200, 0x7807, 0x00ef, 0x780f, 0x00ef, 0x7813,
-	0x0138, 0x7823, 0xffff, 0x7827, 0xffff, 0x01de, 0x014e, 0x015e,
-	0x00fe, 0x0005, 0x2001, 0x1800, 0x2003, 0x0001, 0x0005, 0x2001,
-	0x19a6, 0x0118, 0x2003, 0x0001, 0x0010, 0x2003, 0x0000, 0x0005,
-	0x0156, 0x20a9, 0x0800, 0x2009, 0x1000, 0x9006, 0x200a, 0x8108,
-	0x1f04, 0x6036, 0x015e, 0x0005, 0x00d6, 0x0036, 0x0156, 0x0136,
-	0x0146, 0x2069, 0x1847, 0x9006, 0xb802, 0xb8d6, 0xb807, 0x0707,
-	0xb80a, 0xb80e, 0xb812, 0x9198, 0x336d, 0x231d, 0x939c, 0x00ff,
-	0xbb16, 0x0016, 0x0026, 0xb886, 0x080c, 0xab33, 0x1120, 0x9192,
-	0x007e, 0x1208, 0xbb86, 0x20a9, 0x0004, 0xb8c4, 0x20e8, 0xb9c8,
-	0x9198, 0x0006, 0x9006, 0x23a0, 0x4004, 0x20a9, 0x0004, 0x9198,
-	0x000a, 0x23a0, 0x4004, 0x002e, 0x001e, 0xb83e, 0xb842, 0xb8ce,
-	0xb8d2, 0xb85e, 0xb862, 0xb866, 0xb86a, 0xb86f, 0x0100, 0xb872,
-	0xb876, 0xb87a, 0xb88a, 0xb88e, 0xb893, 0x0008, 0xb896, 0xb89a,
-	0xb89e, 0xb8be, 0xb9a2, 0x0096, 0xb8a4, 0x904d, 0x0110, 0x080c,
-	0x106c, 0xb8a7, 0x0000, 0x009e, 0x9006, 0xb84a, 0x6810, 0xb83a,
-	0x680c, 0xb846, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0198, 0x00c6,
-	0x2060, 0x9c82, 0x1ddc, 0x0a0c, 0x0d7d, 0x2001, 0x181a, 0x2004,
-	0x9c02, 0x1a0c, 0x0d7d, 0x080c, 0x8b5f, 0x00ce, 0x090c, 0x8f03,
-	0xb8af, 0x0000, 0x6814, 0x9084, 0x00ff, 0xb842, 0x014e, 0x013e,
-	0x015e, 0x003e, 0x00de, 0x0005, 0x0126, 0x2091, 0x8000, 0xa974,
-	0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x6112, 0x9182,
-	0x0800, 0x1a04, 0x6116, 0x2001, 0x180c, 0x2004, 0x9084, 0x0003,
-	0x1904, 0x611c, 0x9188, 0x1000, 0x2104, 0x905d, 0x0198, 0xb804,
-	0x9084, 0x00ff, 0x908e, 0x0006, 0x1188, 0xb8a4, 0x900d, 0x1904,
-	0x612e, 0x080c, 0x64e7, 0x9006, 0x012e, 0x0005, 0x2001, 0x0005,
-	0x900e, 0x04b8, 0x2001, 0x0028, 0x900e, 0x0498, 0x9082, 0x0006,
-	0x1290, 0x080c, 0xab33, 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140,
-	0xb900, 0xd1fc, 0x0d10, 0x2001, 0x0029, 0x2009, 0x1000, 0x0408,
-	0x2001, 0x0028, 0x00a8, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118,
-	0x2001, 0x0004, 0x0068, 0xd184, 0x0118, 0x2001, 0x0004, 0x0040,
-	0x2001, 0x0029, 0xb900, 0xd1fc, 0x0118, 0x2009, 0x1000, 0x0048,
-	0x900e, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018, 0x2001, 0x0029,
-	0x900e, 0x9005, 0x012e, 0x0005, 0x2001, 0x180c, 0x2004, 0xd084,
-	0x19d0, 0x9188, 0x1000, 0x2104, 0x9065, 0x09a8, 0x080c, 0x6a5b,
-	0x1990, 0xb800, 0xd0bc, 0x0978, 0x0804, 0x60d5, 0x080c, 0x6889,
-	0x0904, 0x60de, 0x0804, 0x60d9, 0x00e6, 0x2071, 0x19e7, 0x7004,
-	0x9086, 0x0002, 0x1128, 0x7030, 0x9080, 0x0004, 0x2004, 0x9b06,
-	0x00ee, 0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa874,
-	0x908e, 0x00ff, 0x1120, 0x2001, 0x196b, 0x205c, 0x0060, 0xa974,
-	0x9182, 0x0800, 0x1690, 0x9188, 0x1000, 0x2104, 0x905d, 0x01d0,
-	0x080c, 0x69fb, 0x11d0, 0x080c, 0xab73, 0x0570, 0x2b00, 0x6012,
-	0x2900, 0x6016, 0x6023, 0x0009, 0x602b, 0x0000, 0xa874, 0x908e,
-	0x00ff, 0x1110, 0x602b, 0x8000, 0x2009, 0x0043, 0x080c, 0xac68,
-	0x9006, 0x00b0, 0x2001, 0x0028, 0x0090, 0x2009, 0x180c, 0x210c,
-	0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001,
-	0x0004, 0x0010, 0x2001, 0x0029, 0x0010, 0x2001, 0x0029, 0x9005,
-	0x012e, 0x00ee, 0x00be, 0x0005, 0x2001, 0x002c, 0x0cc0, 0x00b6,
-	0x00e6, 0x0126, 0x2091, 0x8000, 0xa974, 0x9182, 0x0800, 0x1a04,
-	0x620a, 0x9188, 0x1000, 0x2104, 0x905d, 0x0904, 0x61e2, 0xb8a0,
-	0x9086, 0x007f, 0x0178, 0x080c, 0x6a63, 0x0160, 0xa994, 0x81ff,
-	0x0130, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x080c,
-	0x6a5b, 0x1598, 0xa87c, 0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8,
-	0x2060, 0x0026, 0x2010, 0x080c, 0xc802, 0x002e, 0x1120, 0x2001,
-	0x0008, 0x0804, 0x620c, 0x6020, 0x9086, 0x000a, 0x0120, 0x2001,
-	0x0008, 0x0804, 0x620c, 0x601a, 0x6003, 0x0008, 0x2900, 0x6016,
-	0x0058, 0x080c, 0xab73, 0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016,
-	0x600b, 0xffff, 0x6023, 0x000a, 0x2009, 0x0003, 0x080c, 0xac68,
-	0x9006, 0x0458, 0x2001, 0x0028, 0x0438, 0x9082, 0x0006, 0x1290,
-	0x080c, 0xab33, 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900,
-	0xd1fc, 0x0900, 0x2001, 0x0029, 0x2009, 0x1000, 0x00a8, 0x2001,
-	0x0028, 0x0090, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001,
-	0x0004, 0x0050, 0xd184, 0x0118, 0x2001, 0x0004, 0x0028, 0x2001,
-	0x0029, 0x0010, 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be,
-	0x0005, 0x2001, 0x002c, 0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091,
-	0x8000, 0xa8e0, 0x9005, 0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630,
-	0xa8c8, 0x9005, 0x1518, 0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974,
-	0x2079, 0x1800, 0x9182, 0x0800, 0x12e8, 0x7830, 0x9084, 0x0003,
-	0x1130, 0xaa98, 0xab94, 0xa878, 0x9084, 0x0007, 0x00ea, 0x7930,
-	0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001,
-	0x0004, 0x0010, 0x2001, 0x0029, 0x900e, 0x0038, 0x2001, 0x002c,
-	0x900e, 0x0018, 0x2001, 0x0029, 0x900e, 0x9006, 0x0008, 0x9005,
-	0x012e, 0x00be, 0x00fe, 0x0005, 0x62a1, 0x625c, 0x6273, 0x62a1,
-	0x62a1, 0x62a1, 0x62a1, 0x62a1, 0x2100, 0x9082, 0x007e, 0x1278,
-	0x080c, 0x65bd, 0x0148, 0x9046, 0xb810, 0x9306, 0x1904, 0x62a9,
-	0xb814, 0x9206, 0x15f0, 0x0028, 0xbb12, 0xba16, 0x0010, 0x080c,
-	0x49b3, 0x0150, 0x04b0, 0x080c, 0x661e, 0x1598, 0xb810, 0x9306,
-	0x1580, 0xb814, 0x9206, 0x1568, 0x080c, 0xab73, 0x0530, 0x2b00,
-	0x6012, 0x080c, 0xcca8, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023,
-	0x000a, 0xa878, 0x9086, 0x0001, 0x1170, 0x080c, 0x31e4, 0x9006,
-	0x080c, 0x655a, 0x2001, 0x0002, 0x080c, 0x656e, 0x2001, 0x0200,
-	0xb86e, 0xb893, 0x0002, 0x2009, 0x0003, 0x080c, 0xac68, 0x9006,
-	0x0068, 0x2001, 0x0001, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e,
-	0x0018, 0x2001, 0x0028, 0x900e, 0x9005, 0x0000, 0x012e, 0x00be,
-	0x00fe, 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000,
-	0xa894, 0x90c6, 0x0015, 0x0904, 0x6490, 0x90c6, 0x0056, 0x0904,
-	0x6494, 0x90c6, 0x0066, 0x0904, 0x6498, 0x90c6, 0x0067, 0x0904,
-	0x649c, 0x90c6, 0x0068, 0x0904, 0x64a0, 0x90c6, 0x0071, 0x0904,
-	0x64a4, 0x90c6, 0x0074, 0x0904, 0x64a8, 0x90c6, 0x007c, 0x0904,
-	0x64ac, 0x90c6, 0x007e, 0x0904, 0x64b0, 0x90c6, 0x0037, 0x0904,
-	0x64b4, 0x9016, 0x2079, 0x1800, 0xa974, 0x9186, 0x00ff, 0x0904,
-	0x648b, 0x9182, 0x0800, 0x1a04, 0x648b, 0x080c, 0x661e, 0x1198,
-	0xb804, 0x9084, 0x00ff, 0x9082, 0x0006, 0x1268, 0xa894, 0x90c6,
-	0x006f, 0x0148, 0x080c, 0xab33, 0x1904, 0x6474, 0xb8a0, 0x9084,
-	0xff80, 0x1904, 0x6474, 0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6,
-	0x005e, 0x0904, 0x63d4, 0x90c6, 0x0064, 0x0904, 0x63fd, 0x2008,
-	0x0804, 0x6396, 0xa998, 0xa8b0, 0x2040, 0x080c, 0xab33, 0x1120,
-	0x9182, 0x007f, 0x0a04, 0x6396, 0x9186, 0x00ff, 0x0904, 0x6396,
-	0x9182, 0x0800, 0x1a04, 0x6396, 0xaaa0, 0xab9c, 0x787c, 0x9306,
-	0x1188, 0x7880, 0x0096, 0x924e, 0x1128, 0x2208, 0x2310, 0x009e,
-	0x0804, 0x6396, 0x99cc, 0xff00, 0x009e, 0x1120, 0x2208, 0x2310,
-	0x0804, 0x6396, 0x080c, 0x49b3, 0x0904, 0x63a0, 0x900e, 0x9016,
-	0x90c6, 0x4000, 0x15e0, 0x0006, 0x080c, 0x690d, 0x1108, 0xc185,
-	0xb800, 0xd0bc, 0x0108, 0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
-	0x0006, 0x2098, 0x080c, 0x0fb7, 0x20a9, 0x0004, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080,
-	0x000a, 0x2098, 0x080c, 0x0fb7, 0xa8c4, 0xabc8, 0x9305, 0xabcc,
-	0x9305, 0xabd0, 0x9305, 0xabd4, 0x9305, 0xabd8, 0x9305, 0xabdc,
-	0x9305, 0xabe0, 0x9305, 0x9005, 0x0510, 0x000e, 0x00c8, 0x90c6,
-	0x4007, 0x1110, 0x2408, 0x00a0, 0x90c6, 0x4008, 0x1118, 0x2708,
-	0x2610, 0x0070, 0x90c6, 0x4009, 0x1108, 0x0050, 0x90c6, 0x4006,
-	0x0138, 0x2001, 0x4005, 0x2009, 0x000a, 0x0010, 0x2001, 0x4006,
-	0xa896, 0xa99a, 0xaa9e, 0x2001, 0x0030, 0x900e, 0x0478, 0x000e,
-	0x080c, 0xab73, 0x1130, 0x2001, 0x4005, 0x2009, 0x0003, 0x9016,
-	0x0c78, 0x2b00, 0x6012, 0x080c, 0xcca8, 0x2900, 0x6016, 0x6023,
-	0x0001, 0xa868, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x31e4, 0x012e, 0x9006, 0x080c, 0x655a, 0x2001,
-	0x0002, 0x080c, 0x656e, 0x2009, 0x0002, 0x080c, 0xac68, 0xa8b0,
-	0xd094, 0x0118, 0xb8d4, 0xc08d, 0xb8d6, 0x9006, 0x9005, 0x012e,
-	0x00ee, 0x00fe, 0x00be, 0x0005, 0x080c, 0x56e7, 0x0118, 0x2009,
-	0x0007, 0x00f8, 0xa998, 0xaeb0, 0x080c, 0x661e, 0x1904, 0x6391,
-	0x9186, 0x007f, 0x0130, 0x080c, 0x6a5b, 0x0118, 0x2009, 0x0009,
-	0x0080, 0x0096, 0x080c, 0x103a, 0x1120, 0x009e, 0x2009, 0x0002,
-	0x0040, 0x2900, 0x009e, 0xa806, 0x080c, 0xca00, 0x19b0, 0x2009,
-	0x0003, 0x2001, 0x4005, 0x0804, 0x6398, 0xa998, 0xaeb0, 0x080c,
-	0x661e, 0x1904, 0x6391, 0x0096, 0x080c, 0x103a, 0x1128, 0x009e,
-	0x2009, 0x0002, 0x0804, 0x6451, 0x2900, 0x009e, 0xa806, 0x0096,
-	0x2048, 0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008,
-	0x9080, 0x0006, 0x20a0, 0xbbc8, 0x9398, 0x0006, 0x2398, 0x080c,
-	0x0fb7, 0x009e, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
-	0xd684, 0x1168, 0x080c, 0x56d3, 0xd0b4, 0x1118, 0xa89b, 0x000b,
-	0x00e0, 0xb800, 0xd08c, 0x0118, 0xa89b, 0x000c, 0x00b0, 0x080c,
-	0x6a5b, 0x0118, 0xa89b, 0x0009, 0x0080, 0x080c, 0x56e7, 0x0118,
-	0xa89b, 0x0007, 0x0050, 0x080c, 0xc9e3, 0x1904, 0x63cd, 0x2009,
-	0x0003, 0x2001, 0x4005, 0x0804, 0x6398, 0xa87b, 0x0030, 0xa897,
-	0x4005, 0xa804, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8,
-	0xada4, 0x2031, 0x0000, 0x2041, 0x127e, 0x080c, 0xb0ee, 0x1904,
-	0x63cd, 0x2009, 0x0002, 0x08e8, 0x2001, 0x0028, 0x900e, 0x0804,
-	0x63ce, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
-	0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029,
-	0x900e, 0x0804, 0x63ce, 0x2001, 0x0029, 0x900e, 0x0804, 0x63ce,
-	0x080c, 0x3790, 0x0804, 0x63cf, 0x080c, 0x5408, 0x0804, 0x63cf,
-	0x080c, 0x456c, 0x0804, 0x63cf, 0x080c, 0x45e5, 0x0804, 0x63cf,
-	0x080c, 0x4641, 0x0804, 0x63cf, 0x080c, 0x4a76, 0x0804, 0x63cf,
-	0x080c, 0x4d2d, 0x0804, 0x63cf, 0x080c, 0x5073, 0x0804, 0x63cf,
-	0x080c, 0x526c, 0x0804, 0x63cf, 0x080c, 0x39ae, 0x0804, 0x63cf,
-	0x00b6, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1608,
-	0x9182, 0x0800, 0x1258, 0x9188, 0x1000, 0x2104, 0x905d, 0x0130,
-	0x080c, 0x6a5b, 0x1138, 0x00d9, 0x9006, 0x00b0, 0x2001, 0x0028,
-	0x900e, 0x0090, 0x9082, 0x0006, 0x1240, 0xb900, 0xd1fc, 0x0d98,
-	0x2001, 0x0029, 0x2009, 0x1000, 0x0038, 0x2001, 0x0029, 0x900e,
-	0x0018, 0x2001, 0x0029, 0x900e, 0x9005, 0x00be, 0x0005, 0xa877,
-	0x0000, 0xb8d0, 0x9005, 0x1904, 0x654e, 0xb888, 0x9005, 0x1904,
-	0x654e, 0xb838, 0xb93c, 0x9102, 0x1a04, 0x654e, 0x2b10, 0x080c,
-	0xaba0, 0x0904, 0x654a, 0x8108, 0xb93e, 0x6212, 0x2900, 0x6016,
-	0x6023, 0x0003, 0x600b, 0xffff, 0x6007, 0x0040, 0xa878, 0x605e,
-	0xa880, 0x9084, 0x00ff, 0x6066, 0xa883, 0x0000, 0xa87c, 0xd0ac,
-	0x0588, 0xc0dd, 0xa87e, 0xa888, 0x8001, 0x1530, 0xa816, 0xa864,
-	0x9094, 0x00f7, 0x9296, 0x0011, 0x11f8, 0x9084, 0x00ff, 0xc0bd,
-	0x601e, 0xa8ac, 0xaab0, 0xa836, 0xaa3a, 0x2001, 0x000f, 0x8001,
-	0x1df0, 0x2001, 0x8004, 0x6003, 0x0004, 0x6046, 0x00f6, 0x2079,
-	0x0380, 0x7818, 0xd0bc, 0x1de8, 0x7833, 0x0010, 0x2c00, 0x7836,
-	0x781b, 0x8080, 0x00fe, 0x0005, 0x080c, 0x1731, 0x601c, 0xc0bd,
-	0x601e, 0x0c38, 0xd0b4, 0x190c, 0x1c30, 0x2001, 0x8004, 0x6003,
-	0x0002, 0x0c18, 0x81ff, 0x1110, 0xb88b, 0x0001, 0x2908, 0xb8cc,
-	0xb9ce, 0x9005, 0x1110, 0xb9d2, 0x0020, 0x0096, 0x2048, 0xa902,
-	0x009e, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x0026, 0x2091, 0x8000,
-	0x6210, 0x2258, 0xba00, 0x9005, 0x0110, 0xc285, 0x0008, 0xc284,
-	0xba02, 0x002e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126,
-	0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006, 0x9086,
-	0x0006, 0x1170, 0xb89c, 0xd0ac, 0x0158, 0x080c, 0x6a57, 0x0140,
-	0x9284, 0xff00, 0x8007, 0x9086, 0x0007, 0x1110, 0x2011, 0x0600,
-	0x000e, 0x9294, 0xff00, 0x9215, 0xba06, 0x0006, 0x9086, 0x0006,
-	0x1120, 0xba90, 0x82ff, 0x090c, 0x0d7d, 0x000e, 0x00ce, 0x012e,
-	0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210,
-	0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1168, 0xb89c, 0xd0a4,
-	0x0150, 0x080c, 0x6a53, 0x1138, 0x9284, 0x00ff, 0x9086, 0x0007,
-	0x1110, 0x2011, 0x0006, 0x000e, 0x9294, 0x00ff, 0x8007, 0x9215,
-	0xba06, 0x00ce, 0x012e, 0x00be, 0x0005, 0x9182, 0x0800, 0x0218,
-	0x9085, 0x0001, 0x0005, 0x00d6, 0x0026, 0x9190, 0x1000, 0x2204,
-	0x905d, 0x1188, 0x0096, 0x080c, 0x103a, 0x2958, 0x009e, 0x0168,
-	0x2b00, 0x2012, 0xb85c, 0xb8ca, 0xb860, 0xb8c6, 0x9006, 0xb8a6,
-	0xb8ae, 0x080c, 0x603c, 0x9006, 0x0010, 0x9085, 0x0001, 0x002e,
-	0x00de, 0x0005, 0x00b6, 0x0096, 0x0126, 0x2091, 0x8000, 0x0026,
-	0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0458, 0x00d6, 0x9190,
-	0x1000, 0x2204, 0x905d, 0x0518, 0x2013, 0x0000, 0xb8a4, 0x904d,
-	0x0110, 0x080c, 0x106c, 0x00d6, 0x00c6, 0xb8bc, 0x2060, 0x8cff,
-	0x0168, 0x600c, 0x0006, 0x6014, 0x2048, 0x080c, 0xc814, 0x0110,
-	0x080c, 0x0fec, 0x080c, 0xabc9, 0x00ce, 0x0c88, 0x00ce, 0x00de,
-	0x2b48, 0xb8c8, 0xb85e, 0xb8c4, 0xb862, 0x080c, 0x107c, 0x00de,
-	0x9006, 0x002e, 0x012e, 0x009e, 0x00be, 0x0005, 0x0016, 0x9182,
-	0x0800, 0x0218, 0x9085, 0x0001, 0x0030, 0x9188, 0x1000, 0x2104,
-	0x905d, 0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156, 0x0136,
-	0x0146, 0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802, 0x080c,
-	0x74d5, 0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c, 0xab33,
-	0x11d8, 0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061, 0x1982,
-	0x7048, 0x2062, 0x704c, 0x6006, 0x7050, 0x600a, 0x7054, 0x600e,
-	0x00ce, 0x703c, 0x2069, 0x0140, 0x9005, 0x1110, 0x2001, 0x0001,
-	0x6886, 0x2069, 0x1800, 0x68b6, 0x7040, 0xb85e, 0x7048, 0xb862,
-	0x704c, 0xb866, 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8c4, 0x20e8,
-	0xb8c8, 0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2099,
-	0x027a, 0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2069,
-	0x0200, 0x6817, 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e, 0x7048,
-	0xb872, 0x7050, 0xb876, 0x2069, 0x0200, 0x6817, 0x0000, 0xb8a0,
-	0x9086, 0x007e, 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211, 0x1218,
-	0x2009, 0x0008, 0x0400, 0x9182, 0x0259, 0x1218, 0x2009, 0x0007,
-	0x00d0, 0x9182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0, 0x9182,
-	0x0349, 0x1218, 0x2009, 0x0005, 0x0070, 0x9182, 0x0421, 0x1218,
-	0x2009, 0x0004, 0x0040, 0x9182, 0x0581, 0x1218, 0x2009, 0x0003,
-	0x0010, 0x2009, 0x0002, 0xb992, 0x014e, 0x013e, 0x015e, 0x00de,
-	0x0005, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034, 0xb896,
-	0x703c, 0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbd4, 0xc384, 0xba00,
-	0x2009, 0x1867, 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110, 0xc2ad,
-	0x0008, 0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd, 0xd0cc,
-	0x0128, 0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02, 0xbbd6,
-	0x003e, 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096, 0x0126, 0x2091,
-	0x8000, 0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0, 0xaa04,
-	0x9282, 0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x8906,
-	0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9080,
-	0x0004, 0x2098, 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002, 0x9086,
-	0xffff, 0x0120, 0x8109, 0x1dd0, 0x080c, 0x0d7d, 0x3c00, 0x20e8,
-	0x3300, 0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de, 0x01ce,
-	0x014e, 0x013e, 0x0060, 0x080c, 0x103a, 0x0170, 0x2900, 0xb8a6,
-	0xa803, 0x0000, 0x080c, 0x68a9, 0xa807, 0x0001, 0xae12, 0x9085,
-	0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126, 0x2091,
-	0x8000, 0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005, 0x1150,
-	0x080c, 0x68b8, 0x1158, 0xa804, 0x908a, 0x0002, 0x0218, 0x8001,
-	0xa806, 0x0020, 0x080c, 0x106c, 0xb8a7, 0x0000, 0x009e, 0x012e,
-	0x0005, 0x0096, 0x00c6, 0xb888, 0x9005, 0x1904, 0x67a2, 0xb8d0,
-	0x904d, 0x0904, 0x67a2, 0x080c, 0xaba0, 0x0904, 0x679e, 0x8210,
-	0xba3e, 0xa800, 0xb8d2, 0x9005, 0x1108, 0xb8ce, 0x2b00, 0x6012,
-	0x2900, 0x6016, 0x6023, 0x0003, 0x600b, 0xffff, 0x6007, 0x0040,
-	0xa878, 0x605e, 0xa880, 0x9084, 0x00ff, 0x6066, 0xa883, 0x0000,
-	0xa87c, 0xd0ac, 0x01c8, 0xc0dd, 0xa87e, 0xa888, 0x8001, 0x1568,
-	0xa816, 0xa864, 0x9094, 0x00f7, 0x9296, 0x0011, 0x1530, 0x9084,
-	0x00ff, 0xc0bd, 0x601e, 0xa8ac, 0xaab0, 0xa836, 0xaa3a, 0x2001,
-	0x8004, 0x6003, 0x0004, 0x0030, 0x080c, 0x1c30, 0x2001, 0x8004,
-	0x6003, 0x0002, 0x6046, 0x2001, 0x0010, 0x2c08, 0x080c, 0xa863,
-	0xb838, 0xba3c, 0x9202, 0x0a04, 0x674f, 0x0020, 0x82ff, 0x1110,
-	0xb88b, 0x0001, 0x00ce, 0x009e, 0x0005, 0x080c, 0x1731, 0x601c,
-	0xc0bd, 0x601e, 0x08e0, 0x00b6, 0x0096, 0x0016, 0x20a9, 0x0800,
-	0x900e, 0x0016, 0x080c, 0x661e, 0x1158, 0xb8d0, 0x904d, 0x0140,
-	0x3e00, 0x9086, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x1108, 0x0041,
-	0x001e, 0x8108, 0x1f04, 0x67b1, 0x001e, 0x00be, 0x009e, 0x0005,
-	0x0096, 0x0016, 0xb8d0, 0x904d, 0x0188, 0xa800, 0xb8d2, 0x9005,
-	0x1108, 0xb8ce, 0x9006, 0xa802, 0xa867, 0x0103, 0xab7a, 0xa877,
-	0x0000, 0x080c, 0xcb12, 0x080c, 0x6d70, 0x0c60, 0x001e, 0x009e,
-	0x0005, 0x0086, 0x9046, 0xb8d0, 0x904d, 0x0198, 0xa86c, 0x9406,
-	0x1118, 0xa870, 0x9506, 0x0128, 0x2940, 0xa800, 0x904d, 0x0148,
-	0x0ca8, 0xa800, 0x88ff, 0x1110, 0xb8d2, 0x0008, 0xa002, 0xa803,
-	0x0000, 0x008e, 0x0005, 0x901e, 0x0010, 0x2019, 0x0001, 0x00e6,
-	0x0096, 0x00c6, 0x0086, 0x0026, 0x0126, 0x2091, 0x8000, 0x2071,
-	0x19e7, 0x9046, 0x7028, 0x9065, 0x01e8, 0x6014, 0x2068, 0x83ff,
-	0x0120, 0x605c, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118,
-	0xa870, 0x9506, 0x0120, 0x2c40, 0x600c, 0x2060, 0x0c60, 0x600c,
-	0x0006, 0x0066, 0x2830, 0x080c, 0x9f7e, 0x006e, 0x000e, 0x83ff,
-	0x0508, 0x0c08, 0x9046, 0xb8d0, 0x904d, 0x01e0, 0x83ff, 0x0120,
-	0xa878, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118, 0xa870,
-	0x9506, 0x0120, 0x2940, 0xa800, 0x2048, 0x0c70, 0xb8d0, 0xaa00,
-	0x0026, 0x9906, 0x1110, 0xbad2, 0x0008, 0xa202, 0x000e, 0x83ff,
-	0x0108, 0x0c10, 0x002e, 0x008e, 0x00ce, 0x009e, 0x00ee, 0x0005,
-	0x9016, 0x0489, 0x1110, 0x2011, 0x0001, 0x0005, 0x080c, 0x690d,
-	0x0128, 0x080c, 0xc8d5, 0x0010, 0x9085, 0x0001, 0x0005, 0x080c,
-	0x690d, 0x0128, 0x080c, 0xc876, 0x0010, 0x9085, 0x0001, 0x0005,
-	0x080c, 0x690d, 0x0128, 0x080c, 0xc8d2, 0x0010, 0x9085, 0x0001,
-	0x0005, 0x080c, 0x690d, 0x0128, 0x080c, 0xc895, 0x0010, 0x9085,
-	0x0001, 0x0005, 0x080c, 0x690d, 0x0128, 0x080c, 0xc916, 0x0010,
-	0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118, 0x9085, 0x0001,
-	0x0005, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e, 0x810e,
-	0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0004,
-	0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002, 0x9606, 0x0128,
-	0x8109, 0x1dd8, 0x9085, 0x0001, 0x0008, 0x9006, 0x01ce, 0x013e,
-	0x0005, 0x0146, 0x01d6, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0004,
-	0x20a0, 0x20a9, 0x0010, 0x2009, 0xffff, 0x4104, 0x01de, 0x014e,
+	0x0014, 0x080c, 0x5eb8, 0x0010, 0x080c, 0x5908, 0x00fe, 0x0005,
+	0x00f6, 0x7090, 0x9005, 0x05a8, 0x2011, 0x5e8e, 0x080c, 0x863e,
+	0x9086, 0x0014, 0x1560, 0x080c, 0x6003, 0x2079, 0x0260, 0x7a30,
+	0x9296, 0x1105, 0x1520, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100,
+	0x921e, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
+	0x70c7, 0x0001, 0x709b, 0x000a, 0x00b1, 0x0098, 0x9005, 0x1178,
+	0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
+	0x7097, 0x0000, 0x709b, 0x000e, 0x080c, 0x5b56, 0x0010, 0x080c,
+	0x5fdf, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x000b, 0x2011, 0x1d0e,
+	0x20e9, 0x0001, 0x22a0, 0x20a9, 0x0040, 0x2019, 0xffff, 0x4304,
+	0x080c, 0x5f87, 0x2079, 0x0240, 0x7833, 0x1106, 0x7837, 0x0000,
+	0x080c, 0x5fe6, 0x0118, 0x2013, 0x0000, 0x0020, 0x7060, 0x9085,
+	0x0100, 0x2012, 0x20a9, 0x0040, 0x2009, 0x024e, 0x2011, 0x1d0e,
+	0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000,
+	0x6812, 0x2009, 0x0240, 0x1f04, 0x5ad8, 0x60c3, 0x0084, 0x080c,
+	0x5eb8, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01c0, 0x2011,
+	0x5e8e, 0x080c, 0x863e, 0x9086, 0x0084, 0x1178, 0x080c, 0x6003,
+	0x2079, 0x0260, 0x7a30, 0x9296, 0x1106, 0x1138, 0x7834, 0x9005,
+	0x1120, 0x709b, 0x000c, 0x0029, 0x0010, 0x080c, 0x5fdf, 0x00fe,
+	0x0005, 0x00f6, 0x709b, 0x000d, 0x080c, 0x5f87, 0x2079, 0x0240,
+	0x7833, 0x1107, 0x7837, 0x0000, 0x080c, 0x6003, 0x20a9, 0x0040,
+	0x2011, 0x026e, 0x2009, 0x024e, 0x220e, 0x8210, 0x8108, 0x9186,
+	0x0260, 0x1150, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814,
+	0x8000, 0x6816, 0x2011, 0x0260, 0x1f04, 0x5b1c, 0x60c3, 0x0084,
+	0x080c, 0x5eb8, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01e0,
+	0x2011, 0x5e8e, 0x080c, 0x863e, 0x9086, 0x0084, 0x1198, 0x080c,
+	0x6003, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1107, 0x1158, 0x7834,
+	0x9005, 0x1140, 0x7097, 0x0001, 0x080c, 0x5f59, 0x709b, 0x000e,
+	0x0029, 0x0010, 0x080c, 0x5fdf, 0x00fe, 0x0005, 0x918d, 0x0001,
+	0x080c, 0x602e, 0x709b, 0x000f, 0x7093, 0x0000, 0x2061, 0x0140,
+	0x605b, 0xbc85, 0x605f, 0xb5b5, 0x2061, 0x0100, 0x6043, 0x0005,
+	0x6043, 0x0004, 0x2009, 0x07d0, 0x2011, 0x5e8e, 0x080c, 0x8632,
+	0x0005, 0x7090, 0x9005, 0x0130, 0x2011, 0x5e8e, 0x080c, 0x863e,
+	0x709b, 0x0000, 0x0005, 0x709b, 0x0011, 0x080c, 0xa690, 0x080c,
+	0x6003, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1,
+	0x0240, 0x7490, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8,
+	0x8004, 0x20a8, 0x4003, 0x080c, 0x5fe6, 0x11a0, 0x717c, 0x81ff,
+	0x0188, 0x900e, 0x7080, 0x9084, 0x00ff, 0x0160, 0x080c, 0x25fb,
+	0x9186, 0x007e, 0x0138, 0x9186, 0x0080, 0x0120, 0x2011, 0x0008,
+	0x080c, 0x5e3b, 0x60c3, 0x0014, 0x080c, 0x5eb8, 0x0005, 0x00f6,
+	0x7090, 0x9005, 0x0500, 0x2011, 0x5e8e, 0x080c, 0x863e, 0x9086,
+	0x0014, 0x11b8, 0x080c, 0x6003, 0x2079, 0x0260, 0x7a30, 0x9296,
+	0x1103, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128,
+	0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001, 0x709b, 0x0012, 0x0029,
+	0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0013,
+	0x080c, 0x5f95, 0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000,
+	0x080c, 0x6003, 0x080c, 0x5fe6, 0x1170, 0x7084, 0x9005, 0x1158,
+	0x715c, 0x9186, 0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5e3b,
+	0x0168, 0x080c, 0x5fbc, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099,
+	0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014,
+	0x080c, 0x5eb8, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x0500,
+	0x2011, 0x5e8e, 0x080c, 0x863e, 0x9086, 0x0014, 0x11b8, 0x080c,
+	0x6003, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1104, 0x1178, 0x7834,
+	0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110,
+	0x70c7, 0x0001, 0x709b, 0x0014, 0x0029, 0x0010, 0x7093, 0x0000,
+	0x00fe, 0x0005, 0x00f6, 0x709b, 0x0015, 0x080c, 0x5f95, 0x2079,
+	0x0240, 0x7833, 0x1104, 0x7837, 0x0000, 0x080c, 0x6003, 0x080c,
+	0x5fe6, 0x11b8, 0x7084, 0x9005, 0x11a0, 0x7164, 0x9186, 0xffff,
+	0x0180, 0x9180, 0x3374, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011,
+	0x0008, 0x080c, 0x5e3b, 0x0180, 0x080c, 0x4fe4, 0x0110, 0x080c,
+	0x2664, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
+	0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5eb8,
+	0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005, 0x05f0, 0x2011, 0x5e8e,
+	0x080c, 0x863e, 0x9086, 0x0014, 0x15a8, 0x080c, 0x6003, 0x2079,
+	0x0260, 0x7a30, 0x9296, 0x1105, 0x1568, 0x7834, 0x9084, 0x0100,
+	0x2011, 0x0100, 0x921e, 0x1168, 0x9085, 0x0001, 0x080c, 0x602e,
+	0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005, 0x1110, 0x70c7, 0x0001,
+	0x0080, 0x9005, 0x11b8, 0x7a38, 0xd2fc, 0x0128, 0x70c4, 0x9005,
+	0x1110, 0x70c7, 0x0001, 0x9085, 0x0001, 0x080c, 0x602e, 0x7097,
+	0x0000, 0x7a38, 0xd2f4, 0x0110, 0x70df, 0x0008, 0x709b, 0x0016,
+	0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x080c, 0xa690,
+	0x080c, 0x6003, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000,
+	0x20a1, 0x0240, 0x20a9, 0x000e, 0x4003, 0x2011, 0x026d, 0x2204,
+	0x9084, 0x0100, 0x2011, 0x024d, 0x2012, 0x2011, 0x026e, 0x709b,
+	0x0017, 0x080c, 0x5fe6, 0x1150, 0x7084, 0x9005, 0x1138, 0x080c,
+	0x5dae, 0x1188, 0x9085, 0x0001, 0x080c, 0x2664, 0x20a9, 0x0008,
+	0x080c, 0x6003, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
+	0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5eb8, 0x0010,
+	0x080c, 0x5908, 0x0005, 0x00f6, 0x7090, 0x9005, 0x01d8, 0x2011,
+	0x5e8e, 0x080c, 0x863e, 0x9086, 0x0084, 0x1190, 0x080c, 0x6003,
+	0x2079, 0x0260, 0x7a30, 0x9296, 0x1106, 0x1150, 0x7834, 0x9005,
+	0x1138, 0x9006, 0x080c, 0x602e, 0x709b, 0x0018, 0x0029, 0x0010,
+	0x7093, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x709b, 0x0019, 0x080c,
+	0x5f95, 0x2079, 0x0240, 0x7833, 0x1106, 0x7837, 0x0000, 0x080c,
+	0x6003, 0x2009, 0x026e, 0x2039, 0x1d0e, 0x20a9, 0x0040, 0x213e,
+	0x8738, 0x8108, 0x9186, 0x0280, 0x1128, 0x6814, 0x8000, 0x6816,
+	0x2009, 0x0260, 0x1f04, 0x5d17, 0x2039, 0x1d0e, 0x080c, 0x5fe6,
+	0x11e8, 0x2728, 0x2514, 0x8207, 0x9084, 0x00ff, 0x8000, 0x2018,
+	0x9294, 0x00ff, 0x8007, 0x9205, 0x202a, 0x7060, 0x2310, 0x8214,
+	0x92a0, 0x1d0e, 0x2414, 0x938c, 0x0001, 0x0118, 0x9294, 0xff00,
+	0x0018, 0x9294, 0x00ff, 0x8007, 0x9215, 0x2222, 0x20a9, 0x0040,
+	0x2009, 0x024e, 0x270e, 0x8738, 0x8108, 0x9186, 0x0260, 0x1128,
+	0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04, 0x5d4a, 0x60c3,
+	0x0084, 0x080c, 0x5eb8, 0x00fe, 0x0005, 0x00f6, 0x7090, 0x9005,
+	0x01e0, 0x2011, 0x5e8e, 0x080c, 0x863e, 0x9086, 0x0084, 0x1198,
+	0x080c, 0x6003, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1107, 0x1158,
+	0x7834, 0x9005, 0x1140, 0x7097, 0x0001, 0x080c, 0x5f59, 0x709b,
+	0x001a, 0x0029, 0x0010, 0x7093, 0x0000, 0x00fe, 0x0005, 0x9085,
+	0x0001, 0x080c, 0x602e, 0x709b, 0x001b, 0x080c, 0xa690, 0x080c,
+	0x6003, 0x2011, 0x0260, 0x2009, 0x0240, 0x7490, 0x9480, 0x0018,
+	0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x220e, 0x8210,
+	0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000, 0x6812, 0x2009,
+	0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260, 0x1f04, 0x5d96,
+	0x60c3, 0x0084, 0x080c, 0x5eb8, 0x0005, 0x0005, 0x0086, 0x0096,
+	0x2029, 0x1848, 0x252c, 0x20a9, 0x0008, 0x2041, 0x1d0e, 0x20e9,
+	0x0001, 0x28a0, 0x080c, 0x6003, 0x20e1, 0x0000, 0x2099, 0x026e,
+	0x4003, 0x20a9, 0x0008, 0x2011, 0x0007, 0xd5d4, 0x0108, 0x9016,
+	0x2800, 0x9200, 0x200c, 0x91a6, 0xffff, 0x1148, 0xd5d4, 0x0110,
+	0x8210, 0x0008, 0x8211, 0x1f04, 0x5dc8, 0x0804, 0x5e37, 0x82ff,
+	0x1160, 0xd5d4, 0x0120, 0x91a6, 0x3fff, 0x0d90, 0x0020, 0x91a6,
+	0x3fff, 0x0904, 0x5e37, 0x918d, 0xc000, 0x20a9, 0x0010, 0x2019,
+	0x0001, 0xd5d4, 0x0110, 0x2019, 0x0010, 0x2120, 0xd5d4, 0x0110,
+	0x8423, 0x0008, 0x8424, 0x1240, 0xd5d4, 0x0110, 0x8319, 0x0008,
+	0x8318, 0x1f04, 0x5dee, 0x04d8, 0x23a8, 0x2021, 0x0001, 0x8426,
+	0x8425, 0x1f04, 0x5e00, 0x2328, 0x8529, 0x92be, 0x0007, 0x0158,
+	0x0006, 0x2039, 0x0007, 0x2200, 0x973a, 0x000e, 0x27a8, 0x95a8,
+	0x0010, 0x1f04, 0x5e0f, 0x755e, 0x95c8, 0x3374, 0x292d, 0x95ac,
+	0x00ff, 0x7582, 0x6532, 0x6536, 0x0016, 0x2508, 0x080c, 0x2644,
+	0x001e, 0x60e7, 0x0000, 0x65ea, 0x2018, 0x2304, 0x9405, 0x201a,
+	0x7087, 0x0001, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x20e1, 0x0001,
+	0x2898, 0x20a9, 0x0008, 0x4003, 0x9085, 0x0001, 0x0008, 0x9006,
+	0x009e, 0x008e, 0x0005, 0x0156, 0x01c6, 0x01d6, 0x0136, 0x0146,
+	0x22a8, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x2011,
+	0x024e, 0x22a0, 0x4003, 0x014e, 0x013e, 0x01de, 0x01ce, 0x015e,
+	0x2118, 0x9026, 0x2001, 0x0007, 0x939a, 0x0010, 0x0218, 0x8420,
+	0x8001, 0x0cd0, 0x2118, 0x84ff, 0x0120, 0x939a, 0x0010, 0x8421,
+	0x1de0, 0x2021, 0x0001, 0x83ff, 0x0118, 0x8423, 0x8319, 0x1de8,
+	0x9238, 0x2029, 0x026e, 0x9528, 0x2504, 0x942c, 0x11b8, 0x9405,
+	0x203a, 0x715e, 0x91a0, 0x3374, 0x242d, 0x95ac, 0x00ff, 0x7582,
+	0x6532, 0x6536, 0x0016, 0x2508, 0x080c, 0x2644, 0x001e, 0x60e7,
+	0x0000, 0x65ea, 0x7087, 0x0001, 0x9084, 0x0000, 0x0005, 0x00e6,
+	0x2071, 0x1800, 0x708b, 0x0000, 0x00ee, 0x0005, 0x00e6, 0x00f6,
+	0x2079, 0x0100, 0x2071, 0x0140, 0x080c, 0x5f48, 0x080c, 0x9e32,
+	0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2a1a, 0x0126, 0x2091,
+	0x8000, 0x2071, 0x1826, 0x2073, 0x0000, 0x7840, 0x0026, 0x0016,
+	0x2009, 0x00f7, 0x080c, 0x5fa5, 0x001e, 0x9094, 0x0010, 0x9285,
+	0x0080, 0x7842, 0x7a42, 0x002e, 0x012e, 0x00fe, 0x00ee, 0x0005,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x2979, 0x0228, 0x2011, 0x0101,
+	0x2204, 0xc0c5, 0x2012, 0x2011, 0x19f4, 0x2013, 0x0000, 0x7093,
+	0x0000, 0x012e, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0x9e25,
+	0x6144, 0xd184, 0x0120, 0x7198, 0x918d, 0x2000, 0x0018, 0x718c,
+	0x918d, 0x1000, 0x2011, 0x1999, 0x2112, 0x2009, 0x07d0, 0x2011,
+	0x5e8e, 0x080c, 0x8708, 0x0005, 0x0016, 0x0026, 0x00c6, 0x0126,
+	0x2091, 0x8000, 0x080c, 0xa896, 0x080c, 0xab5e, 0x080c, 0xa8b2,
+	0x2009, 0x00f7, 0x080c, 0x5fa5, 0x2061, 0x1a03, 0x900e, 0x611a,
+	0x611e, 0x6172, 0x6176, 0x2061, 0x1800, 0x6003, 0x0001, 0x2061,
+	0x0100, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009, 0x1999, 0x200b,
+	0x0000, 0x2009, 0x002d, 0x2011, 0x5f14, 0x080c, 0x8632, 0x012e,
+	0x00ce, 0x002e, 0x001e, 0x0005, 0x00e6, 0x0006, 0x0126, 0x2091,
+	0x8000, 0x0471, 0x2071, 0x0100, 0x080c, 0x9e32, 0x2071, 0x0140,
+	0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2a1a, 0x080c, 0x74f1,
+	0x0188, 0x080c, 0x750c, 0x1170, 0x080c, 0x77f7, 0x0016, 0x080c,
+	0x2713, 0x2001, 0x196d, 0x2102, 0x001e, 0x080c, 0x77f2, 0x080c,
+	0x741a, 0x0050, 0x2009, 0x0001, 0x080c, 0x29f6, 0x2001, 0x0001,
+	0x080c, 0x25a0, 0x080c, 0x5ee4, 0x012e, 0x000e, 0x00ee, 0x0005,
+	0x2001, 0x180e, 0x2004, 0xd0bc, 0x0158, 0x0026, 0x0036, 0x2011,
+	0x8017, 0x2001, 0x1999, 0x201c, 0x080c, 0x4b07, 0x003e, 0x002e,
+	0x0005, 0x20a9, 0x0012, 0x20e9, 0x0001, 0x20a1, 0x1d80, 0x080c,
+	0x6003, 0x20e9, 0x0000, 0x2099, 0x026e, 0x0099, 0x20a9, 0x0020,
+	0x080c, 0x5ffd, 0x2099, 0x0260, 0x20a1, 0x1d92, 0x0051, 0x20a9,
+	0x000e, 0x080c, 0x6000, 0x2099, 0x0260, 0x20a1, 0x1db2, 0x0009,
+	0x0005, 0x0016, 0x0026, 0x3410, 0x3308, 0x2104, 0x8007, 0x2012,
+	0x8108, 0x8210, 0x1f04, 0x5f7d, 0x002e, 0x001e, 0x0005, 0x080c,
+	0xa690, 0x20e1, 0x0001, 0x2099, 0x1d00, 0x20e9, 0x0000, 0x20a1,
+	0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x080c, 0xa690, 0x080c,
+	0x6003, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1,
+	0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x00c6, 0x0006, 0x2061,
+	0x0100, 0x810f, 0x2001, 0x1834, 0x2004, 0x9005, 0x1138, 0x2001,
+	0x1818, 0x2004, 0x9084, 0x00ff, 0x9105, 0x0010, 0x9185, 0x00f7,
+	0x604a, 0x000e, 0x00ce, 0x0005, 0x0016, 0x0046, 0x080c, 0x6a67,
+	0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xe2c9, 0x2001,
+	0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x900e, 0x080c,
+	0x31a6, 0x080c, 0xcf52, 0x0140, 0x0036, 0x2019, 0xffff, 0x2021,
+	0x0007, 0x080c, 0x4cbe, 0x003e, 0x004e, 0x001e, 0x0005, 0x080c,
+	0x5ee4, 0x709b, 0x0000, 0x7093, 0x0000, 0x0005, 0x0006, 0x2001,
+	0x180c, 0x2004, 0xd09c, 0x0100, 0x000e, 0x0005, 0x0006, 0x0016,
+	0x0126, 0x2091, 0x8000, 0x2001, 0x0101, 0x200c, 0x918d, 0x0006,
+	0x2102, 0x012e, 0x001e, 0x000e, 0x0005, 0x2009, 0x0001, 0x0020,
+	0x2009, 0x0002, 0x0008, 0x900e, 0x6814, 0x9084, 0xffc0, 0x910d,
+	0x6916, 0x0005, 0x00f6, 0x0156, 0x0146, 0x01d6, 0x9006, 0x20a9,
+	0x0080, 0x20e9, 0x0001, 0x20a1, 0x1d00, 0x4004, 0x2079, 0x1d00,
+	0x7803, 0x2200, 0x7807, 0x00ef, 0x780f, 0x00ef, 0x7813, 0x0138,
+	0x7823, 0xffff, 0x7827, 0xffff, 0x01de, 0x014e, 0x015e, 0x00fe,
+	0x0005, 0x2001, 0x1800, 0x2003, 0x0001, 0x0005, 0x2001, 0x19a6,
+	0x0118, 0x2003, 0x0001, 0x0010, 0x2003, 0x0000, 0x0005, 0x0156,
+	0x20a9, 0x0800, 0x2009, 0x1000, 0x9006, 0x200a, 0x8108, 0x1f04,
+	0x603d, 0x015e, 0x0005, 0x00d6, 0x0036, 0x0156, 0x0136, 0x0146,
+	0x2069, 0x1847, 0x9006, 0xb802, 0xb8d6, 0xb807, 0x0707, 0xb80a,
+	0xb80e, 0xb812, 0x9198, 0x3374, 0x231d, 0x939c, 0x00ff, 0xbb16,
+	0x0016, 0x0026, 0xb886, 0x080c, 0xab57, 0x1120, 0x9192, 0x007e,
+	0x1208, 0xbb86, 0x20a9, 0x0004, 0xb8c4, 0x20e8, 0xb9c8, 0x9198,
+	0x0006, 0x9006, 0x23a0, 0x4004, 0x20a9, 0x0004, 0x9198, 0x000a,
+	0x23a0, 0x4004, 0x002e, 0x001e, 0xb83e, 0xb842, 0xb8ce, 0xb8d2,
+	0xb85e, 0xb862, 0xb866, 0xb86a, 0xb86f, 0x0100, 0xb872, 0xb876,
+	0xb87a, 0xb88a, 0xb88e, 0xb893, 0x0008, 0xb896, 0xb89a, 0xb89e,
+	0xb8be, 0xb9a2, 0x0096, 0xb8a4, 0x904d, 0x0110, 0x080c, 0x106c,
+	0xb8a7, 0x0000, 0x009e, 0x9006, 0xb84a, 0x6810, 0xb83a, 0x680c,
+	0xb846, 0xb8bb, 0x0520, 0xb8ac, 0x9005, 0x0198, 0x00c6, 0x2060,
+	0x9c82, 0x1ddc, 0x0a0c, 0x0d7d, 0x2001, 0x181a, 0x2004, 0x9c02,
+	0x1a0c, 0x0d7d, 0x080c, 0x8b90, 0x00ce, 0x090c, 0x8f34, 0xb8af,
+	0x0000, 0x6814, 0x9084, 0x00ff, 0xb842, 0x014e, 0x013e, 0x015e,
+	0x003e, 0x00de, 0x0005, 0x0126, 0x2091, 0x8000, 0xa974, 0xae78,
+	0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x6119, 0x9182, 0x0800,
+	0x1a04, 0x611d, 0x2001, 0x180c, 0x2004, 0x9084, 0x0003, 0x1904,
+	0x6123, 0x9188, 0x1000, 0x2104, 0x905d, 0x0198, 0xb804, 0x9084,
+	0x00ff, 0x908e, 0x0006, 0x1188, 0xb8a4, 0x900d, 0x1904, 0x6135,
+	0x080c, 0x64ee, 0x9006, 0x012e, 0x0005, 0x2001, 0x0005, 0x900e,
+	0x04b8, 0x2001, 0x0028, 0x900e, 0x0498, 0x9082, 0x0006, 0x1290,
+	0x080c, 0xab57, 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900,
+	0xd1fc, 0x0d10, 0x2001, 0x0029, 0x2009, 0x1000, 0x0408, 0x2001,
+	0x0028, 0x00a8, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001,
+	0x0004, 0x0068, 0xd184, 0x0118, 0x2001, 0x0004, 0x0040, 0x2001,
+	0x0029, 0xb900, 0xd1fc, 0x0118, 0x2009, 0x1000, 0x0048, 0x900e,
+	0x0038, 0x2001, 0x0029, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e,
+	0x9005, 0x012e, 0x0005, 0x2001, 0x180c, 0x2004, 0xd084, 0x19d0,
+	0x9188, 0x1000, 0x2104, 0x9065, 0x09a8, 0x080c, 0x6a6b, 0x1990,
+	0xb800, 0xd0bc, 0x0978, 0x0804, 0x60dc, 0x080c, 0x6890, 0x0904,
+	0x60e5, 0x0804, 0x60e0, 0x00e6, 0x2071, 0x19e7, 0x7004, 0x9086,
+	0x0002, 0x1128, 0x7030, 0x9080, 0x0004, 0x2004, 0x9b06, 0x00ee,
+	0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa874, 0x908e,
+	0x00ff, 0x1120, 0x2001, 0x196b, 0x205c, 0x0060, 0xa974, 0x9182,
+	0x0800, 0x1690, 0x9188, 0x1000, 0x2104, 0x905d, 0x01d0, 0x080c,
+	0x6a0b, 0x11d0, 0x080c, 0xab97, 0x0570, 0x2b00, 0x6012, 0x2900,
+	0x6016, 0x6023, 0x0009, 0x602b, 0x0000, 0xa874, 0x908e, 0x00ff,
+	0x1110, 0x602b, 0x8000, 0x2009, 0x0043, 0x080c, 0xac8c, 0x9006,
+	0x00b0, 0x2001, 0x0028, 0x0090, 0x2009, 0x180c, 0x210c, 0xd18c,
+	0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004,
+	0x0010, 0x2001, 0x0029, 0x0010, 0x2001, 0x0029, 0x9005, 0x012e,
+	0x00ee, 0x00be, 0x0005, 0x2001, 0x002c, 0x0cc0, 0x00b6, 0x00e6,
+	0x0126, 0x2091, 0x8000, 0xa974, 0x9182, 0x0800, 0x1a04, 0x6211,
+	0x9188, 0x1000, 0x2104, 0x905d, 0x0904, 0x61e9, 0xb8a0, 0x9086,
+	0x007f, 0x0178, 0x080c, 0x6a73, 0x0160, 0xa994, 0x81ff, 0x0130,
+	0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x080c, 0x6a6b,
+	0x1598, 0xa87c, 0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060,
+	0x0026, 0x2010, 0x080c, 0xc826, 0x002e, 0x1120, 0x2001, 0x0008,
+	0x0804, 0x6213, 0x6020, 0x9086, 0x000a, 0x0120, 0x2001, 0x0008,
+	0x0804, 0x6213, 0x601a, 0x6003, 0x0008, 0x2900, 0x6016, 0x0058,
+	0x080c, 0xab97, 0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b,
+	0xffff, 0x6023, 0x000a, 0x2009, 0x0003, 0x080c, 0xac8c, 0x9006,
+	0x0458, 0x2001, 0x0028, 0x0438, 0x9082, 0x0006, 0x1290, 0x080c,
+	0xab57, 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc,
+	0x0900, 0x2001, 0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028,
+	0x0090, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
+	0x0050, 0xd184, 0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029,
+	0x0010, 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005,
+	0x2001, 0x002c, 0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000,
+	0xa8e0, 0x9005, 0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8,
+	0x9005, 0x1518, 0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079,
+	0x1800, 0x9182, 0x0800, 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130,
+	0xaa98, 0xab94, 0xa878, 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c,
+	0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004,
+	0x0010, 0x2001, 0x0029, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e,
+	0x0018, 0x2001, 0x0029, 0x900e, 0x9006, 0x0008, 0x9005, 0x012e,
+	0x00be, 0x00fe, 0x0005, 0x62a8, 0x6263, 0x627a, 0x62a8, 0x62a8,
+	0x62a8, 0x62a8, 0x62a8, 0x2100, 0x9082, 0x007e, 0x1278, 0x080c,
+	0x65c4, 0x0148, 0x9046, 0xb810, 0x9306, 0x1904, 0x62b0, 0xb814,
+	0x9206, 0x15f0, 0x0028, 0xbb12, 0xba16, 0x0010, 0x080c, 0x49ba,
+	0x0150, 0x04b0, 0x080c, 0x6625, 0x1598, 0xb810, 0x9306, 0x1580,
+	0xb814, 0x9206, 0x1568, 0x080c, 0xab97, 0x0530, 0x2b00, 0x6012,
+	0x080c, 0xcccc, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a,
+	0xa878, 0x9086, 0x0001, 0x1170, 0x080c, 0x31e7, 0x9006, 0x080c,
+	0x6561, 0x2001, 0x0002, 0x080c, 0x6575, 0x2001, 0x0200, 0xb86e,
+	0xb893, 0x0002, 0x2009, 0x0003, 0x080c, 0xac8c, 0x9006, 0x0068,
+	0x2001, 0x0001, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018,
+	0x2001, 0x0028, 0x900e, 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe,
+	0x0005, 0x00b6, 0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894,
+	0x90c6, 0x0015, 0x0904, 0x6497, 0x90c6, 0x0056, 0x0904, 0x649b,
+	0x90c6, 0x0066, 0x0904, 0x649f, 0x90c6, 0x0067, 0x0904, 0x64a3,
+	0x90c6, 0x0068, 0x0904, 0x64a7, 0x90c6, 0x0071, 0x0904, 0x64ab,
+	0x90c6, 0x0074, 0x0904, 0x64af, 0x90c6, 0x007c, 0x0904, 0x64b3,
+	0x90c6, 0x007e, 0x0904, 0x64b7, 0x90c6, 0x0037, 0x0904, 0x64bb,
+	0x9016, 0x2079, 0x1800, 0xa974, 0x9186, 0x00ff, 0x0904, 0x6492,
+	0x9182, 0x0800, 0x1a04, 0x6492, 0x080c, 0x6625, 0x1198, 0xb804,
+	0x9084, 0x00ff, 0x9082, 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f,
+	0x0148, 0x080c, 0xab57, 0x1904, 0x647b, 0xb8a0, 0x9084, 0xff80,
+	0x1904, 0x647b, 0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e,
+	0x0904, 0x63db, 0x90c6, 0x0064, 0x0904, 0x6404, 0x2008, 0x0804,
+	0x639d, 0xa998, 0xa8b0, 0x2040, 0x080c, 0xab57, 0x1120, 0x9182,
+	0x007f, 0x0a04, 0x639d, 0x9186, 0x00ff, 0x0904, 0x639d, 0x9182,
+	0x0800, 0x1a04, 0x639d, 0xaaa0, 0xab9c, 0x787c, 0x9306, 0x1188,
+	0x7880, 0x0096, 0x924e, 0x1128, 0x2208, 0x2310, 0x009e, 0x0804,
+	0x639d, 0x99cc, 0xff00, 0x009e, 0x1120, 0x2208, 0x2310, 0x0804,
+	0x639d, 0x080c, 0x49ba, 0x0904, 0x63a7, 0x900e, 0x9016, 0x90c6,
+	0x4000, 0x15e0, 0x0006, 0x080c, 0x6914, 0x1108, 0xc185, 0xb800,
+	0xd0bc, 0x0108, 0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006,
+	0x2098, 0x080c, 0x0fb7, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0035, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x000a,
+	0x2098, 0x080c, 0x0fb7, 0xa8c4, 0xabc8, 0x9305, 0xabcc, 0x9305,
+	0xabd0, 0x9305, 0xabd4, 0x9305, 0xabd8, 0x9305, 0xabdc, 0x9305,
+	0xabe0, 0x9305, 0x9005, 0x0510, 0x000e, 0x00c8, 0x90c6, 0x4007,
+	0x1110, 0x2408, 0x00a0, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610,
+	0x0070, 0x90c6, 0x4009, 0x1108, 0x0050, 0x90c6, 0x4006, 0x0138,
+	0x2001, 0x4005, 0x2009, 0x000a, 0x0010, 0x2001, 0x4006, 0xa896,
+	0xa99a, 0xaa9e, 0x2001, 0x0030, 0x900e, 0x0478, 0x000e, 0x080c,
+	0xab97, 0x1130, 0x2001, 0x4005, 0x2009, 0x0003, 0x9016, 0x0c78,
+	0x2b00, 0x6012, 0x080c, 0xcccc, 0x2900, 0x6016, 0x6023, 0x0001,
+	0xa868, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x31e7, 0x012e, 0x9006, 0x080c, 0x6561, 0x2001, 0x0002,
+	0x080c, 0x6575, 0x2009, 0x0002, 0x080c, 0xac8c, 0xa8b0, 0xd094,
+	0x0118, 0xb8d4, 0xc08d, 0xb8d6, 0x9006, 0x9005, 0x012e, 0x00ee,
+	0x00fe, 0x00be, 0x0005, 0x080c, 0x56ee, 0x0118, 0x2009, 0x0007,
+	0x00f8, 0xa998, 0xaeb0, 0x080c, 0x6625, 0x1904, 0x6398, 0x9186,
+	0x007f, 0x0130, 0x080c, 0x6a6b, 0x0118, 0x2009, 0x0009, 0x0080,
+	0x0096, 0x080c, 0x103a, 0x1120, 0x009e, 0x2009, 0x0002, 0x0040,
+	0x2900, 0x009e, 0xa806, 0x080c, 0xca24, 0x19b0, 0x2009, 0x0003,
+	0x2001, 0x4005, 0x0804, 0x639f, 0xa998, 0xaeb0, 0x080c, 0x6625,
+	0x1904, 0x6398, 0x0096, 0x080c, 0x103a, 0x1128, 0x009e, 0x2009,
+	0x0002, 0x0804, 0x6458, 0x2900, 0x009e, 0xa806, 0x0096, 0x2048,
+	0x20a9, 0x002b, 0xb8c4, 0x20e0, 0xb8c8, 0x2098, 0xa860, 0x20e8,
+	0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080,
+	0x0006, 0x20a0, 0xbbc8, 0x9398, 0x0006, 0x2398, 0x080c, 0x0fb7,
+	0x009e, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xd684,
+	0x1168, 0x080c, 0x56da, 0xd0b4, 0x1118, 0xa89b, 0x000b, 0x00e0,
+	0xb800, 0xd08c, 0x0118, 0xa89b, 0x000c, 0x00b0, 0x080c, 0x6a6b,
+	0x0118, 0xa89b, 0x0009, 0x0080, 0x080c, 0x56ee, 0x0118, 0xa89b,
+	0x0007, 0x0050, 0x080c, 0xca07, 0x1904, 0x63d4, 0x2009, 0x0003,
+	0x2001, 0x4005, 0x0804, 0x639f, 0xa87b, 0x0030, 0xa897, 0x4005,
+	0xa804, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4,
+	0x2031, 0x0000, 0x2041, 0x127e, 0x080c, 0xb112, 0x1904, 0x63d4,
+	0x2009, 0x0002, 0x08e8, 0x2001, 0x0028, 0x900e, 0x0804, 0x63d5,
+	0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038,
+	0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001, 0x0029, 0x900e,
+	0x0804, 0x63d5, 0x2001, 0x0029, 0x900e, 0x0804, 0x63d5, 0x080c,
+	0x3797, 0x0804, 0x63d6, 0x080c, 0x540f, 0x0804, 0x63d6, 0x080c,
+	0x4573, 0x0804, 0x63d6, 0x080c, 0x45ec, 0x0804, 0x63d6, 0x080c,
+	0x4648, 0x0804, 0x63d6, 0x080c, 0x4a7d, 0x0804, 0x63d6, 0x080c,
+	0x4d34, 0x0804, 0x63d6, 0x080c, 0x507a, 0x0804, 0x63d6, 0x080c,
+	0x5273, 0x0804, 0x63d6, 0x080c, 0x39b5, 0x0804, 0x63d6, 0x00b6,
+	0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1608, 0x9182,
+	0x0800, 0x1258, 0x9188, 0x1000, 0x2104, 0x905d, 0x0130, 0x080c,
+	0x6a6b, 0x1138, 0x00d9, 0x9006, 0x00b0, 0x2001, 0x0028, 0x900e,
+	0x0090, 0x9082, 0x0006, 0x1240, 0xb900, 0xd1fc, 0x0d98, 0x2001,
+	0x0029, 0x2009, 0x1000, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018,
+	0x2001, 0x0029, 0x900e, 0x9005, 0x00be, 0x0005, 0xa877, 0x0000,
+	0xb8d0, 0x9005, 0x1904, 0x6555, 0xb888, 0x9005, 0x1904, 0x6555,
+	0xb838, 0xb93c, 0x9102, 0x1a04, 0x6555, 0x2b10, 0x080c, 0xabc4,
+	0x0904, 0x6551, 0x8108, 0xb93e, 0x6212, 0x2900, 0x6016, 0x6023,
+	0x0003, 0x600b, 0xffff, 0x6007, 0x0040, 0xa878, 0x605e, 0xa880,
+	0x9084, 0x00ff, 0x6066, 0xa883, 0x0000, 0xa87c, 0xd0ac, 0x0588,
+	0xc0dd, 0xa87e, 0xa888, 0x8001, 0x1530, 0xa816, 0xa864, 0x9094,
+	0x00f7, 0x9296, 0x0011, 0x11f8, 0x9084, 0x00ff, 0xc0bd, 0x601e,
+	0xa8ac, 0xaab0, 0xa836, 0xaa3a, 0x2001, 0x000f, 0x8001, 0x1df0,
+	0x2001, 0x8004, 0x6003, 0x0004, 0x6046, 0x00f6, 0x2079, 0x0380,
+	0x7818, 0xd0bc, 0x1de8, 0x7833, 0x0010, 0x2c00, 0x7836, 0x781b,
+	0x8080, 0x00fe, 0x0005, 0x080c, 0x1731, 0x601c, 0xc0bd, 0x601e,
+	0x0c38, 0xd0b4, 0x190c, 0x1c30, 0x2001, 0x8004, 0x6003, 0x0002,
+	0x0c18, 0x81ff, 0x1110, 0xb88b, 0x0001, 0x2908, 0xb8cc, 0xb9ce,
+	0x9005, 0x1110, 0xb9d2, 0x0020, 0x0096, 0x2048, 0xa902, 0x009e,
+	0x0005, 0x00b6, 0x0126, 0x00c6, 0x0026, 0x2091, 0x8000, 0x6210,
+	0x2258, 0xba00, 0x9005, 0x0110, 0xc285, 0x0008, 0xc284, 0xba02,
+	0x002e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6,
+	0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006, 0x9086, 0x0006,
+	0x1170, 0xb89c, 0xd0ac, 0x0158, 0x080c, 0x6a67, 0x0140, 0x9284,
+	0xff00, 0x8007, 0x9086, 0x0007, 0x1110, 0x2011, 0x0600, 0x000e,
+	0x9294, 0xff00, 0x9215, 0xba06, 0x0006, 0x9086, 0x0006, 0x1120,
+	0xba90, 0x82ff, 0x090c, 0x0d7d, 0x000e, 0x00ce, 0x012e, 0x00be,
+	0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258,
+	0xba04, 0x0006, 0x9086, 0x0006, 0x1168, 0xb89c, 0xd0a4, 0x0150,
+	0x080c, 0x6a63, 0x1138, 0x9284, 0x00ff, 0x9086, 0x0007, 0x1110,
+	0x2011, 0x0006, 0x000e, 0x9294, 0x00ff, 0x8007, 0x9215, 0xba06,
+	0x00ce, 0x012e, 0x00be, 0x0005, 0x9182, 0x0800, 0x0218, 0x9085,
+	0x0001, 0x0005, 0x00d6, 0x0026, 0x9190, 0x1000, 0x2204, 0x905d,
+	0x1188, 0x0096, 0x080c, 0x103a, 0x2958, 0x009e, 0x0168, 0x2b00,
+	0x2012, 0xb85c, 0xb8ca, 0xb860, 0xb8c6, 0x9006, 0xb8a6, 0xb8ae,
+	0x080c, 0x6043, 0x9006, 0x0010, 0x9085, 0x0001, 0x002e, 0x00de,
+	0x0005, 0x00b6, 0x0096, 0x0126, 0x2091, 0x8000, 0x0026, 0x9182,
+	0x0800, 0x0218, 0x9085, 0x0001, 0x0458, 0x00d6, 0x9190, 0x1000,
+	0x2204, 0x905d, 0x0518, 0x2013, 0x0000, 0xb8a4, 0x904d, 0x0110,
+	0x080c, 0x106c, 0x00d6, 0x00c6, 0xb8bc, 0x2060, 0x8cff, 0x0168,
+	0x600c, 0x0006, 0x6014, 0x2048, 0x080c, 0xc838, 0x0110, 0x080c,
+	0x0fec, 0x080c, 0xabed, 0x00ce, 0x0c88, 0x00ce, 0x00de, 0x2b48,
+	0xb8c8, 0xb85e, 0xb8c4, 0xb862, 0x080c, 0x107c, 0x00de, 0x9006,
+	0x002e, 0x012e, 0x009e, 0x00be, 0x0005, 0x0016, 0x9182, 0x0800,
+	0x0218, 0x9085, 0x0001, 0x0030, 0x9188, 0x1000, 0x2104, 0x905d,
+	0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156, 0x0136, 0x0146,
+	0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802, 0x080c, 0x74e9,
+	0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c, 0xab57, 0x11d8,
+	0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061, 0x1982, 0x7048,
+	0x2062, 0x704c, 0x6006, 0x7050, 0x600a, 0x7054, 0x600e, 0x00ce,
+	0x703c, 0x2069, 0x0140, 0x9005, 0x1110, 0x2001, 0x0001, 0x6886,
+	0x2069, 0x1800, 0x68b6, 0x7040, 0xb85e, 0x7048, 0xb862, 0x704c,
+	0xb866, 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8c4, 0x20e8, 0xb8c8,
+	0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2099, 0x027a,
+	0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2069, 0x0200,
+	0x6817, 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e, 0x7048, 0xb872,
+	0x7050, 0xb876, 0x2069, 0x0200, 0x6817, 0x0000, 0xb8a0, 0x9086,
+	0x007e, 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211, 0x1218, 0x2009,
+	0x0008, 0x0400, 0x9182, 0x0259, 0x1218, 0x2009, 0x0007, 0x00d0,
+	0x9182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0, 0x9182, 0x0349,
+	0x1218, 0x2009, 0x0005, 0x0070, 0x9182, 0x0421, 0x1218, 0x2009,
+	0x0004, 0x0040, 0x9182, 0x0581, 0x1218, 0x2009, 0x0003, 0x0010,
+	0x2009, 0x0002, 0xb992, 0x014e, 0x013e, 0x015e, 0x00de, 0x0005,
+	0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034, 0xb896, 0x703c,
+	0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbd4, 0xc384, 0xba00, 0x2009,
+	0x1867, 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110, 0xc2ad, 0x0008,
+	0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd, 0xd0cc, 0x0128,
+	0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02, 0xbbd6, 0x003e,
+	0x00ee, 0x002e, 0x001e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000,
+	0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0, 0xaa04, 0x9282,
+	0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x8906, 0x8006,
+	0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9080, 0x0004,
+	0x2098, 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002, 0x9086, 0xffff,
+	0x0120, 0x8109, 0x1dd0, 0x080c, 0x0d7d, 0x3c00, 0x20e8, 0x3300,
+	0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de, 0x01ce, 0x014e,
+	0x013e, 0x0060, 0x080c, 0x103a, 0x0170, 0x2900, 0xb8a6, 0xa803,
+	0x0000, 0x080c, 0x68b0, 0xa807, 0x0001, 0xae12, 0x9085, 0x0001,
+	0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126, 0x2091, 0x8000,
+	0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005, 0x1150, 0x080c,
+	0x68bf, 0x1158, 0xa804, 0x908a, 0x0002, 0x0218, 0x8001, 0xa806,
+	0x0020, 0x080c, 0x106c, 0xb8a7, 0x0000, 0x009e, 0x012e, 0x0005,
+	0x0096, 0x00c6, 0xb888, 0x9005, 0x1904, 0x67a9, 0xb8d0, 0x904d,
+	0x0904, 0x67a9, 0x080c, 0xabc4, 0x0904, 0x67a5, 0x8210, 0xba3e,
+	0xa800, 0xb8d2, 0x9005, 0x1108, 0xb8ce, 0x2b00, 0x6012, 0x2900,
+	0x6016, 0x6023, 0x0003, 0x600b, 0xffff, 0x6007, 0x0040, 0xa878,
+	0x605e, 0xa880, 0x9084, 0x00ff, 0x6066, 0xa883, 0x0000, 0xa87c,
+	0xd0ac, 0x01c8, 0xc0dd, 0xa87e, 0xa888, 0x8001, 0x1568, 0xa816,
+	0xa864, 0x9094, 0x00f7, 0x9296, 0x0011, 0x1530, 0x9084, 0x00ff,
+	0xc0bd, 0x601e, 0xa8ac, 0xaab0, 0xa836, 0xaa3a, 0x2001, 0x8004,
+	0x6003, 0x0004, 0x0030, 0x080c, 0x1c30, 0x2001, 0x8004, 0x6003,
+	0x0002, 0x6046, 0x2001, 0x0010, 0x2c08, 0x080c, 0xa887, 0xb838,
+	0xba3c, 0x9202, 0x0a04, 0x6756, 0x0020, 0x82ff, 0x1110, 0xb88b,
+	0x0001, 0x00ce, 0x009e, 0x0005, 0x080c, 0x1731, 0x601c, 0xc0bd,
+	0x601e, 0x08e0, 0x00b6, 0x0096, 0x0016, 0x20a9, 0x0800, 0x900e,
+	0x0016, 0x080c, 0x6625, 0x1158, 0xb8d0, 0x904d, 0x0140, 0x3e00,
+	0x9086, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x1108, 0x0041, 0x001e,
+	0x8108, 0x1f04, 0x67b8, 0x001e, 0x00be, 0x009e, 0x0005, 0x0096,
+	0x0016, 0xb8d0, 0x904d, 0x0188, 0xa800, 0xb8d2, 0x9005, 0x1108,
+	0xb8ce, 0x9006, 0xa802, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
+	0x080c, 0xcb36, 0x080c, 0x6d80, 0x0c60, 0x001e, 0x009e, 0x0005,
+	0x0086, 0x9046, 0xb8d0, 0x904d, 0x0198, 0xa86c, 0x9406, 0x1118,
+	0xa870, 0x9506, 0x0128, 0x2940, 0xa800, 0x904d, 0x0148, 0x0ca8,
+	0xa800, 0x88ff, 0x1110, 0xb8d2, 0x0008, 0xa002, 0xa803, 0x0000,
+	0x008e, 0x0005, 0x901e, 0x0010, 0x2019, 0x0001, 0x00e6, 0x0096,
+	0x00c6, 0x0086, 0x0026, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7,
+	0x9046, 0x7028, 0x9065, 0x01e8, 0x6014, 0x2068, 0x83ff, 0x0120,
+	0x605c, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118, 0xa870,
+	0x9506, 0x0120, 0x2c40, 0x600c, 0x2060, 0x0c60, 0x600c, 0x0006,
+	0x0066, 0x2830, 0x080c, 0x9fa2, 0x006e, 0x000e, 0x83ff, 0x0508,
+	0x0c08, 0x9046, 0xb8d0, 0x904d, 0x01e0, 0x83ff, 0x0120, 0xa878,
+	0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506,
+	0x0120, 0x2940, 0xa800, 0x2048, 0x0c70, 0xb8d0, 0xaa00, 0x0026,
+	0x9906, 0x1110, 0xbad2, 0x0008, 0xa202, 0x000e, 0x83ff, 0x0108,
+	0x0c10, 0x002e, 0x008e, 0x00ce, 0x009e, 0x00ee, 0x0005, 0x9016,
+	0x0489, 0x1110, 0x2011, 0x0001, 0x0005, 0x080c, 0x6914, 0x0128,
+	0x080c, 0xc8f9, 0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x6914,
+	0x0128, 0x080c, 0xc89a, 0x0010, 0x9085, 0x0001, 0x0005, 0x080c,
+	0x6914, 0x0128, 0x080c, 0xc8f6, 0x0010, 0x9085, 0x0001, 0x0005,
+	0x080c, 0x6914, 0x0128, 0x080c, 0xc8b9, 0x0010, 0x9085, 0x0001,
+	0x0005, 0x080c, 0x6914, 0x0128, 0x080c, 0xc93a, 0x0010, 0x9085,
+	0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118, 0x9085, 0x0001, 0x0005,
 	0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e, 0x810e, 0x810f,
 	0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0004, 0x2098,
 	0x20a9, 0x0001, 0x2009, 0x0010, 0x4002, 0x9606, 0x0128, 0x8109,
-	0x1dd8, 0x9085, 0x0001, 0x0068, 0x0146, 0x01d6, 0x3300, 0x8001,
-	0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004, 0x01de, 0x014e,
-	0x9006, 0x01ce, 0x013e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000,
-	0xb8a4, 0x904d, 0x1128, 0x080c, 0x103a, 0x0168, 0x2900, 0xb8a6,
-	0x080c, 0x68a9, 0xa803, 0x0001, 0xa807, 0x0000, 0x9085, 0x0001,
-	0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x0126, 0x2091,
-	0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000, 0x080c, 0x106c,
-	0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0xb89c, 0xd0a4, 0x0005,
-	0x00b6, 0x00f6, 0x080c, 0x74d5, 0x01b0, 0x71c4, 0x81ff, 0x1198,
-	0x71dc, 0xd19c, 0x0180, 0x2001, 0x007e, 0x9080, 0x1000, 0x2004,
-	0x905d, 0x0148, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1118,
-	0xb800, 0xc0ed, 0xb802, 0x2079, 0x1847, 0x7804, 0xd0a4, 0x01d0,
-	0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x661e, 0x1168,
-	0xb804, 0x9084, 0xff00, 0x8007, 0x9096, 0x0004, 0x0118, 0x9086,
-	0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e, 0x8108, 0x1f04,
-	0x6934, 0x015e, 0x080c, 0x6a19, 0x0120, 0x2001, 0x1985, 0x200c,
-	0x0038, 0x2079, 0x1847, 0x7804, 0xd0a4, 0x0130, 0x2009, 0x07d0,
-	0x2011, 0x695f, 0x080c, 0x86d7, 0x00fe, 0x00be, 0x0005, 0x00b6,
-	0x2011, 0x695f, 0x080c, 0x860d, 0x080c, 0x6a19, 0x01d8, 0x2001,
-	0x107e, 0x2004, 0x2058, 0xb900, 0xc1ec, 0xb902, 0x080c, 0x6a57,
-	0x0130, 0x2009, 0x07d0, 0x2011, 0x695f, 0x080c, 0x86d7, 0x00e6,
-	0x2071, 0x1800, 0x9006, 0x707e, 0x7060, 0x7082, 0x080c, 0x2fb2,
-	0x00ee, 0x04d0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016,
-	0x080c, 0x661e, 0x1558, 0xb800, 0xd0ec, 0x0540, 0x0046, 0xbaa0,
-	0x2220, 0x9006, 0x2009, 0x0029, 0x080c, 0xe29e, 0xb800, 0xc0e5,
-	0xc0ec, 0xb802, 0x080c, 0x6a53, 0x2001, 0x0707, 0x1128, 0xb804,
-	0x9084, 0x00ff, 0x9085, 0x0700, 0xb806, 0x080c, 0xa872, 0x2019,
-	0x0029, 0x080c, 0x9374, 0x0076, 0x903e, 0x080c, 0x9246, 0x900e,
-	0x080c, 0xdfc0, 0x007e, 0x004e, 0x080c, 0xa88e, 0x001e, 0x8108,
-	0x1f04, 0x6987, 0x00ce, 0x015e, 0x00be, 0x0005, 0x00b6, 0x6010,
-	0x2058, 0xb800, 0xc0ec, 0xb802, 0x00be, 0x0005, 0x00b6, 0x00c6,
-	0x0096, 0x080c, 0x1053, 0x090c, 0x0d7d, 0x2958, 0x009e, 0x2001,
-	0x196b, 0x2b02, 0xb8af, 0x0000, 0x2009, 0x00ff, 0x080c, 0x603c,
+	0x1dd8, 0x9085, 0x0001, 0x0008, 0x9006, 0x01ce, 0x013e, 0x0005,
+	0x0146, 0x01d6, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0004, 0x20a0,
+	0x20a9, 0x0010, 0x2009, 0xffff, 0x4104, 0x01de, 0x014e, 0x0136,
+	0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e, 0x810e, 0x810f, 0x9184,
+	0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0004, 0x2098, 0x20a9,
+	0x0001, 0x2009, 0x0010, 0x4002, 0x9606, 0x0128, 0x8109, 0x1dd8,
+	0x9085, 0x0001, 0x0068, 0x0146, 0x01d6, 0x3300, 0x8001, 0x20a0,
+	0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004, 0x01de, 0x014e, 0x9006,
+	0x01ce, 0x013e, 0x0005, 0x0096, 0x0126, 0x2091, 0x8000, 0xb8a4,
+	0x904d, 0x1128, 0x080c, 0x103a, 0x0168, 0x2900, 0xb8a6, 0x080c,
+	0x68b0, 0xa803, 0x0001, 0xa807, 0x0000, 0x9085, 0x0001, 0x012e,
+	0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x0126, 0x2091, 0x8000,
+	0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000, 0x080c, 0x106c, 0x9085,
+	0x0001, 0x012e, 0x009e, 0x0005, 0xb89c, 0xd0a4, 0x0005, 0x00b6,
+	0x00f6, 0x080c, 0x74e9, 0x01b0, 0x71c4, 0x81ff, 0x1198, 0x71dc,
+	0xd19c, 0x0180, 0x2001, 0x007e, 0x9080, 0x1000, 0x2004, 0x905d,
+	0x0148, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1118, 0xb800,
+	0xc0ed, 0xb802, 0x2079, 0x1847, 0x7804, 0xd0a4, 0x01d0, 0x0156,
+	0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6625, 0x1168, 0xb804,
+	0x9084, 0xff00, 0x8007, 0x9096, 0x0004, 0x0118, 0x9086, 0x0006,
+	0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e, 0x8108, 0x1f04, 0x693b,
+	0x015e, 0x080c, 0x6a29, 0x0120, 0x2001, 0x1985, 0x200c, 0x0038,
+	0x2079, 0x1847, 0x7804, 0xd0a4, 0x0130, 0x2009, 0x07d0, 0x2011,
+	0x6966, 0x080c, 0x8708, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x2011,
+	0x6966, 0x080c, 0x863e, 0x080c, 0x6a29, 0x01d8, 0x2001, 0x107e,
+	0x2004, 0x2058, 0xb900, 0xc1ec, 0xb902, 0x080c, 0x6a67, 0x0130,
+	0x2009, 0x07d0, 0x2011, 0x6966, 0x080c, 0x8708, 0x00e6, 0x2071,
+	0x1800, 0x9006, 0x707e, 0x7060, 0x7082, 0x080c, 0x2fb2, 0x00ee,
+	0x04d0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c,
+	0x6625, 0x1558, 0xb800, 0xd0ec, 0x0540, 0x0046, 0xbaa0, 0x2220,
+	0x9006, 0x2009, 0x0029, 0x080c, 0xe2c9, 0xb800, 0xc0e5, 0xc0ec,
+	0xb802, 0x080c, 0x6a63, 0x2001, 0x0707, 0x1128, 0xb804, 0x9084,
+	0x00ff, 0x9085, 0x0700, 0xb806, 0x080c, 0xa896, 0x2019, 0x0029,
+	0x080c, 0x93a5, 0x0076, 0x903e, 0x080c, 0x9277, 0x900e, 0x080c,
+	0xdfeb, 0x007e, 0x004e, 0x080c, 0xa8b2, 0x001e, 0x8108, 0x1f04,
+	0x698e, 0x00ce, 0x015e, 0x00be, 0x0005, 0x00b6, 0x6010, 0x2058,
+	0xb800, 0xc0ec, 0xb802, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x0096,
+	0x080c, 0x1053, 0x090c, 0x0d7d, 0x2958, 0x009e, 0x2001, 0x196b,
+	0x2b02, 0x8b07, 0x8006, 0x8006, 0x908c, 0x003f, 0xb9c6, 0x908c,
+	0xffc0, 0xb9ca, 0xb8af, 0x0000, 0x2009, 0x00ff, 0x080c, 0x6043,
 	0xb807, 0x0006, 0xb813, 0x00ff, 0xb817, 0xffff, 0xb86f, 0x0200,
 	0xb86c, 0xb893, 0x0002, 0xb8bb, 0x0520, 0xb8a3, 0x00ff, 0xb8af,
 	0x0000, 0x00ce, 0x00be, 0x0005, 0x7810, 0x00b6, 0x2058, 0xb800,
@@ -3194,85 +3196,85 @@
 	0x8000, 0x0006, 0xbaa0, 0x9290, 0x1000, 0x2204, 0x9b06, 0x190c,
 	0x0d7d, 0x000e, 0xba00, 0x9005, 0x0110, 0xc2fd, 0x0008, 0xc2fc,
 	0xba02, 0x002e, 0x012e, 0x0005, 0x2011, 0x1837, 0x2204, 0xd0cc,
-	0x0138, 0x2001, 0x1983, 0x200c, 0x2011, 0x6a49, 0x080c, 0x86d7,
-	0x0005, 0x2011, 0x6a49, 0x080c, 0x860d, 0x2011, 0x1837, 0x2204,
-	0xc0cc, 0x2012, 0x0005, 0x080c, 0x56d3, 0xd0ac, 0x0005, 0x080c,
-	0x56d3, 0xd0a4, 0x0005, 0x0016, 0xb904, 0x9184, 0x00ff, 0x908e,
+	0x0138, 0x2001, 0x1983, 0x200c, 0x2011, 0x6a59, 0x080c, 0x8708,
+	0x0005, 0x2011, 0x6a59, 0x080c, 0x863e, 0x2011, 0x1837, 0x2204,
+	0xc0cc, 0x2012, 0x0005, 0x080c, 0x56da, 0xd0ac, 0x0005, 0x080c,
+	0x56da, 0xd0a4, 0x0005, 0x0016, 0xb904, 0x9184, 0x00ff, 0x908e,
 	0x0006, 0x001e, 0x0005, 0x0016, 0xb904, 0x9184, 0xff00, 0x8007,
-	0x908e, 0x0006, 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xcf2e,
+	0x908e, 0x0006, 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xcf52,
 	0x0158, 0x70dc, 0x9084, 0x0028, 0x0138, 0x2001, 0x107f, 0x2004,
 	0x905d, 0x0110, 0xb8d4, 0xd094, 0x00fe, 0x00be, 0x0005, 0x2071,
 	0x1910, 0x7003, 0x0001, 0x7007, 0x0000, 0x9006, 0x7012, 0x7016,
 	0x701a, 0x701e, 0x700a, 0x7046, 0x2001, 0x1947, 0x2003, 0x0000,
 	0x0005, 0x0016, 0x00e6, 0x2071, 0x1948, 0x900e, 0x710a, 0x080c,
-	0x56d3, 0xd0fc, 0x1140, 0x080c, 0x56d3, 0x900e, 0xd09c, 0x0108,
+	0x56da, 0xd0fc, 0x1140, 0x080c, 0x56da, 0x900e, 0xd09c, 0x0108,
 	0x8108, 0x7102, 0x00f8, 0x2001, 0x1867, 0x200c, 0x9184, 0x0007,
-	0x0002, 0x6a9b, 0x6a9b, 0x6a9b, 0x6a9b, 0x6a9b, 0x6ab1, 0x6abf,
-	0x6a9b, 0x7003, 0x0003, 0x2009, 0x1868, 0x210c, 0x9184, 0xff00,
+	0x0002, 0x6aab, 0x6aab, 0x6aab, 0x6aab, 0x6aab, 0x6ac1, 0x6acf,
+	0x6aab, 0x7003, 0x0003, 0x2009, 0x1868, 0x210c, 0x9184, 0xff00,
 	0x8007, 0x9005, 0x1110, 0x2001, 0x0002, 0x7006, 0x0018, 0x7003,
 	0x0005, 0x0c88, 0x00ee, 0x001e, 0x0005, 0x00e6, 0x2071, 0x0050,
 	0x684c, 0x9005, 0x1150, 0x00e6, 0x2071, 0x1910, 0x7028, 0xc085,
 	0x702a, 0x00ee, 0x9085, 0x0001, 0x0488, 0x6844, 0x9005, 0x0158,
-	0x080c, 0x784b, 0x6a60, 0x9200, 0x7002, 0x6864, 0x9101, 0x7006,
+	0x080c, 0x785f, 0x6a60, 0x9200, 0x7002, 0x6864, 0x9101, 0x7006,
 	0x9006, 0x7012, 0x7016, 0x6860, 0x7002, 0x6864, 0x7006, 0x6868,
 	0x700a, 0x686c, 0x700e, 0x6844, 0x9005, 0x1110, 0x7012, 0x7016,
 	0x684c, 0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x7037, 0x0019,
 	0x702b, 0x0001, 0x00e6, 0x2071, 0x1910, 0x7028, 0xc084, 0x702a,
 	0x7007, 0x0001, 0x700b, 0x0000, 0x00ee, 0x9006, 0x00ee, 0x0005,
-	0x00e6, 0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904, 0x6d75,
-	0x9286, 0x0003, 0x0904, 0x6c05, 0x9286, 0x0005, 0x0904, 0x6c05,
-	0x2071, 0x1877, 0xa87c, 0x9005, 0x0904, 0x6b66, 0x7140, 0xa868,
-	0x9102, 0x0a04, 0x6d75, 0xa878, 0xd084, 0x15d8, 0xa853, 0x0019,
+	0x00e6, 0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904, 0x6d85,
+	0x9286, 0x0003, 0x0904, 0x6c15, 0x9286, 0x0005, 0x0904, 0x6c15,
+	0x2071, 0x1877, 0xa87c, 0x9005, 0x0904, 0x6b76, 0x7140, 0xa868,
+	0x9102, 0x0a04, 0x6d85, 0xa878, 0xd084, 0x15d8, 0xa853, 0x0019,
 	0x2001, 0x8023, 0xa84e, 0x2071, 0x1910, 0x701c, 0x9005, 0x1904,
-	0x6f18, 0x0e04, 0x6f86, 0x2071, 0x0000, 0xa850, 0x7032, 0xa84c,
+	0x6f28, 0x0e04, 0x6f96, 0x2071, 0x0000, 0xa850, 0x7032, 0xa84c,
 	0x7082, 0xa870, 0x7086, 0xa86c, 0x708a, 0xa880, 0x708e, 0x7036,
 	0x0146, 0x01d6, 0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000, 0x20a1,
 	0x002a, 0xa868, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021,
 	0x2098, 0x4003, 0x015e, 0x01ce, 0x013e, 0x01de, 0x014e, 0x2091,
 	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11d6, 0x0804,
-	0x6be8, 0xa853, 0x001b, 0x2001, 0x8027, 0x0820, 0x7004, 0xd08c,
-	0x1904, 0x6d75, 0xa853, 0x001a, 0x2001, 0x8024, 0x0804, 0x6b2a,
-	0x00e6, 0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904, 0x6d75,
-	0x9286, 0x0003, 0x0904, 0x6c05, 0x9286, 0x0005, 0x0904, 0x6c05,
-	0xa84f, 0x8022, 0xa853, 0x0018, 0x0804, 0x6bcd, 0xa868, 0xd0fc,
+	0x6bf8, 0xa853, 0x001b, 0x2001, 0x8027, 0x0820, 0x7004, 0xd08c,
+	0x1904, 0x6d85, 0xa853, 0x001a, 0x2001, 0x8024, 0x0804, 0x6b3a,
+	0x00e6, 0x0026, 0x2071, 0x1948, 0x7000, 0x9015, 0x0904, 0x6d85,
+	0x9286, 0x0003, 0x0904, 0x6c15, 0x9286, 0x0005, 0x0904, 0x6c15,
+	0xa84f, 0x8022, 0xa853, 0x0018, 0x0804, 0x6bdd, 0xa868, 0xd0fc,
 	0x11d8, 0x00e6, 0x0026, 0x2001, 0x1948, 0x2004, 0x9005, 0x0904,
-	0x6d75, 0xa87c, 0xd0bc, 0x1904, 0x6d75, 0xa978, 0xa874, 0x9105,
-	0x1904, 0x6d75, 0x2001, 0x1948, 0x2004, 0x0002, 0x6d75, 0x6bc9,
-	0x6c05, 0x6c05, 0x6d75, 0x6c05, 0x0005, 0xa868, 0xd0fc, 0x1500,
-	0x00e6, 0x0026, 0x2009, 0x1948, 0x210c, 0x81ff, 0x0904, 0x6d75,
-	0xa87c, 0xd0cc, 0x0904, 0x6d75, 0xa880, 0x9084, 0x00ff, 0x9086,
-	0x0001, 0x1904, 0x6d75, 0x9186, 0x0003, 0x0904, 0x6c05, 0x9186,
-	0x0005, 0x0904, 0x6c05, 0xa84f, 0x8021, 0xa853, 0x0017, 0x0028,
+	0x6d85, 0xa87c, 0xd0bc, 0x1904, 0x6d85, 0xa978, 0xa874, 0x9105,
+	0x1904, 0x6d85, 0x2001, 0x1948, 0x2004, 0x0002, 0x6d85, 0x6bd9,
+	0x6c15, 0x6c15, 0x6d85, 0x6c15, 0x0005, 0xa868, 0xd0fc, 0x1500,
+	0x00e6, 0x0026, 0x2009, 0x1948, 0x210c, 0x81ff, 0x0904, 0x6d85,
+	0xa87c, 0xd0cc, 0x0904, 0x6d85, 0xa880, 0x9084, 0x00ff, 0x9086,
+	0x0001, 0x1904, 0x6d85, 0x9186, 0x0003, 0x0904, 0x6c15, 0x9186,
+	0x0005, 0x0904, 0x6c15, 0xa84f, 0x8021, 0xa853, 0x0017, 0x0028,
 	0x0005, 0xa84f, 0x8020, 0xa853, 0x0016, 0x2071, 0x1910, 0x701c,
-	0x9005, 0x1904, 0x6f18, 0x0e04, 0x6f86, 0x2071, 0x0000, 0xa84c,
+	0x9005, 0x1904, 0x6f28, 0x0e04, 0x6f96, 0x2071, 0x0000, 0xa84c,
 	0x7082, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a,
 	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11d6,
 	0x2071, 0x1800, 0x2011, 0x0001, 0xa804, 0x900d, 0x702c, 0x1158,
-	0xa802, 0x2900, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8522,
+	0xa802, 0x2900, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8553,
 	0x002e, 0x00ee, 0x0005, 0x0096, 0x2148, 0xa904, 0xa802, 0x8210,
 	0x2900, 0x81ff, 0x1dc8, 0x009e, 0x0c58, 0xa84f, 0x0000, 0x00f6,
 	0x2079, 0x0050, 0x2071, 0x1910, 0xa803, 0x0000, 0x7010, 0x9005,
-	0x1904, 0x6cfa, 0x782c, 0x908c, 0x0780, 0x190c, 0x70d2, 0x8004,
-	0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6c23, 0x6cfa, 0x6c48,
-	0x6c95, 0x080c, 0x0d7d, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804,
+	0x1904, 0x6d0a, 0x782c, 0x908c, 0x0780, 0x190c, 0x70e2, 0x8004,
+	0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6c33, 0x6d0a, 0x6c58,
+	0x6ca5, 0x080c, 0x0d7d, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804,
 	0x900d, 0x1170, 0x2071, 0x1a03, 0x703c, 0x9005, 0x1328, 0x2001,
 	0x1949, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005,
 	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8522, 0x0c10,
+	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8553, 0x0c10,
 	0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x15a8, 0x7824,
 	0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1170, 0x2009, 0x1830,
 	0x210c, 0x918a, 0x0020, 0x0240, 0x7022, 0x2001, 0x1dc0, 0x200c,
 	0x8108, 0x2102, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802,
-	0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8522, 0x782c,
-	0x9094, 0x0780, 0x190c, 0x70d2, 0xd0a4, 0x19c8, 0x2071, 0x1a03,
+	0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8553, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x70e2, 0xd0a4, 0x19c8, 0x2071, 0x1a03,
 	0x703c, 0x9005, 0x1328, 0x2001, 0x1949, 0x2004, 0x8005, 0x703e,
 	0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016, 0x702c, 0x2148, 0xa904,
 	0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200,
-	0x70c2, 0x080c, 0x8522, 0x0804, 0x6c4f, 0x0096, 0x00e6, 0x7824,
+	0x70c2, 0x080c, 0x8553, 0x0804, 0x6c5f, 0x0096, 0x00e6, 0x7824,
 	0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0,
-	0x8000, 0x70c2, 0x080c, 0x8522, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x70d2, 0xd0a4, 0x1d60, 0x00ee, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x70d2, 0xd09c, 0x11a0, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d,
+	0x8000, 0x70c2, 0x080c, 0x8553, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x70e2, 0xd0a4, 0x1d60, 0x00ee, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x70e2, 0xd09c, 0x11a0, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d,
 	0x1560, 0x2071, 0x1a03, 0x703c, 0x9005, 0x1328, 0x2001, 0x1949,
 	0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x009e,
 	0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
@@ -3280,85 +3282,85 @@
 	0x1a03, 0x703c, 0x9005, 0x1328, 0x2001, 0x1949, 0x2004, 0x8005,
 	0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016,
 	0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8522, 0x00fe, 0x002e,
+	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8553, 0x00fe, 0x002e,
 	0x00ee, 0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
 	0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
-	0x1904, 0x6d4f, 0x782c, 0x9094, 0x0780, 0x190c, 0x70d2, 0xd09c,
+	0x1904, 0x6d5f, 0x782c, 0x9094, 0x0780, 0x190c, 0x70e2, 0xd09c,
 	0x1198, 0x701c, 0x904d, 0x0180, 0x7010, 0x8001, 0x7012, 0x1108,
 	0x701a, 0xa800, 0x701e, 0x2900, 0x7822, 0x782c, 0x9094, 0x0780,
-	0x190c, 0x70d2, 0xd09c, 0x0d68, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x70d2, 0xd0a4, 0x01b0, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800,
+	0x190c, 0x70e2, 0xd09c, 0x0d68, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x70e2, 0xd0a4, 0x01b0, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800,
 	0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c,
-	0x8522, 0x782c, 0x9094, 0x0780, 0x190c, 0x70d2, 0xd0a4, 0x1d60,
+	0x8553, 0x782c, 0x9094, 0x0780, 0x190c, 0x70e2, 0xd0a4, 0x1d60,
 	0x00ee, 0x2071, 0x1a03, 0x703c, 0x9005, 0x1328, 0x2001, 0x1949,
 	0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6,
 	0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
 	0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c,
-	0x8522, 0x00ee, 0x0804, 0x6d0a, 0xa868, 0xd0fc, 0x1560, 0x0096,
+	0x8553, 0x00ee, 0x0804, 0x6d1a, 0xa868, 0xd0fc, 0x1560, 0x0096,
 	0xa804, 0xa807, 0x0000, 0x904d, 0x190c, 0x0fec, 0x009e, 0x0018,
 	0xa868, 0xd0fc, 0x1500, 0x00e6, 0x0026, 0xa84f, 0x0000, 0x00f6,
 	0x2079, 0x0050, 0x2071, 0x1910, 0xa803, 0x0000, 0x7010, 0x9005,
-	0x1904, 0x6e92, 0x782c, 0x908c, 0x0780, 0x190c, 0x70d2, 0x8004,
-	0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6d94, 0x6e92, 0x6daf,
-	0x6e21, 0x080c, 0x0d7d, 0x0005, 0x2071, 0x1800, 0x2900, 0x7822,
+	0x1904, 0x6ea2, 0x782c, 0x908c, 0x0780, 0x190c, 0x70e2, 0x8004,
+	0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6da4, 0x6ea2, 0x6dbf,
+	0x6e31, 0x080c, 0x0d7d, 0x0005, 0x2071, 0x1800, 0x2900, 0x7822,
 	0xa804, 0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016,
 	0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8522, 0x0c60, 0x2071,
-	0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1904, 0x6e10, 0x7830,
+	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8553, 0x0c60, 0x2071,
+	0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1904, 0x6e20, 0x7830,
 	0xd0dc, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7824, 0x00e6,
 	0x2071, 0x0040, 0x712c, 0xd19c, 0x1170, 0x2009, 0x1830, 0x210c,
 	0x918a, 0x0020, 0x0240, 0x7022, 0x2001, 0x1dc0, 0x200c, 0x8108,
 	0x2102, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900,
-	0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8522, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x70d2, 0xd0a4, 0x19c8, 0x0e04, 0x6e07, 0x7838,
+	0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8553, 0x782c, 0x9094,
+	0x0780, 0x190c, 0x70e2, 0xd0a4, 0x19c8, 0x0e04, 0x6e17, 0x7838,
 	0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833,
 	0x0013, 0x00de, 0x2001, 0x1921, 0x200c, 0xc184, 0x2102, 0x2091,
 	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11d6, 0x2009,
 	0x1947, 0x200b, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2001,
 	0x1921, 0x200c, 0xc185, 0x2102, 0x00fe, 0x002e, 0x00ee, 0x0005,
 	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8522, 0x0804,
-	0x6dbe, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c,
-	0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8522,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x70d2, 0xd0a4, 0x1d60, 0x00ee,
-	0x0e04, 0x6e65, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069,
+	0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8553, 0x0804,
+	0x6dce, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c,
+	0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c, 0x8553,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x70e2, 0xd0a4, 0x1d60, 0x00ee,
+	0x0e04, 0x6e75, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069,
 	0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044, 0xc084, 0x7046,
 	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11d6,
 	0x2009, 0x1947, 0x200b, 0x0000, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x70d2, 0xd09c, 0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d,
+	0x70e2, 0xd09c, 0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d,
 	0x11e0, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046,
 	0x0c58, 0x009e, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
 	0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
 	0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016,
 	0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8522, 0x00fe, 0x002e,
+	0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c, 0x8553, 0x00fe, 0x002e,
 	0x00ee, 0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
 	0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
-	0x1904, 0x6f03, 0x782c, 0x9094, 0x0780, 0x190c, 0x70d2, 0xd09c,
+	0x1904, 0x6f13, 0x782c, 0x9094, 0x0780, 0x190c, 0x70e2, 0xd09c,
 	0x11b0, 0x701c, 0x904d, 0x0198, 0xa84c, 0x9005, 0x1180, 0x7010,
 	0x8001, 0x7012, 0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x70d2, 0xd09c, 0x0d50, 0x782c,
-	0x9094, 0x0780, 0x190c, 0x70d2, 0xd0a4, 0x05c8, 0x00e6, 0x7824,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x70e2, 0xd09c, 0x0d50, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x70e2, 0xd0a4, 0x05c8, 0x00e6, 0x7824,
 	0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70c0,
-	0x8000, 0x70c2, 0x080c, 0x8522, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x70d2, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x6efc, 0x7838, 0x7938,
+	0x8000, 0x70c2, 0x080c, 0x8553, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x70e2, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x6f0c, 0x7838, 0x7938,
 	0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
 	0x00de, 0x7044, 0xc084, 0x7046, 0x2091, 0x4080, 0x2001, 0x0089,
 	0x2004, 0xd084, 0x190c, 0x11d6, 0x2009, 0x1947, 0x200b, 0x0000,
 	0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x00fe,
 	0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800, 0x9016, 0x702c,
 	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70c0, 0x9200, 0x70c2, 0x080c, 0x8522, 0x00ee, 0x0804, 0x6ea2,
+	0x70c0, 0x9200, 0x70c2, 0x080c, 0x8553, 0x00ee, 0x0804, 0x6eb2,
 	0x2071, 0x1910, 0xa803, 0x0000, 0x2908, 0x7010, 0x8000, 0x7012,
 	0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148,
-	0xa804, 0x900d, 0x1128, 0x1e04, 0x6f43, 0x002e, 0x00ee, 0x0005,
+	0xa804, 0x900d, 0x1128, 0x1e04, 0x6f53, 0x002e, 0x00ee, 0x0005,
 	0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
 	0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70c0, 0x9200, 0x70c2, 0x080c,
-	0x8522, 0x0e04, 0x6f2d, 0x2071, 0x1910, 0x701c, 0x2048, 0xa84c,
+	0x8553, 0x0e04, 0x6f3d, 0x2071, 0x1910, 0x701c, 0x2048, 0xa84c,
 	0x900d, 0x0d18, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c,
 	0x7086, 0x7036, 0xa870, 0x708a, 0xa850, 0x9082, 0x0019, 0x1278,
 	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11d6,
-	0x2071, 0x1910, 0x080c, 0x70be, 0x002e, 0x00ee, 0x0005, 0xa850,
+	0x2071, 0x1910, 0x080c, 0x70ce, 0x002e, 0x00ee, 0x0005, 0xa850,
 	0x9082, 0x001c, 0x1e68, 0xa880, 0x708e, 0x7036, 0x0146, 0x01d6,
 	0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a, 0xa868,
 	0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x4003,
@@ -3367,23 +3369,23 @@
 	0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
 	0x1118, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c,
 	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70c0, 0x9200, 0x70c2, 0x080c, 0x8522, 0x002e, 0x00ee, 0x0005,
+	0x70c0, 0x9200, 0x70c2, 0x080c, 0x8553, 0x002e, 0x00ee, 0x0005,
 	0x0006, 0xa87c, 0x0006, 0xa867, 0x0103, 0x20a9, 0x001c, 0xa860,
 	0x20e8, 0xa85c, 0x9080, 0x001d, 0x20a0, 0x9006, 0x4004, 0x000e,
 	0x9084, 0x00ff, 0xa87e, 0x000e, 0xa87a, 0xa982, 0x0005, 0x2071,
-	0x1910, 0x7004, 0x0002, 0x6fd1, 0x6fd2, 0x70bd, 0x6fd2, 0x0d7d,
-	0x70bd, 0x0005, 0x2001, 0x1948, 0x2004, 0x0002, 0x6fdc, 0x6fdc,
-	0x7056, 0x7057, 0x6fdc, 0x7057, 0x0126, 0x2091, 0x8000, 0x1e0c,
-	0x70dd, 0x701c, 0x904d, 0x0508, 0xa84c, 0x9005, 0x0904, 0x7027,
-	0x0e04, 0x7005, 0xa94c, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032,
+	0x1910, 0x7004, 0x0002, 0x6fe1, 0x6fe2, 0x70cd, 0x6fe2, 0x0d7d,
+	0x70cd, 0x0005, 0x2001, 0x1948, 0x2004, 0x0002, 0x6fec, 0x6fec,
+	0x7066, 0x7067, 0x6fec, 0x7067, 0x0126, 0x2091, 0x8000, 0x1e0c,
+	0x70ed, 0x701c, 0x904d, 0x0508, 0xa84c, 0x9005, 0x0904, 0x7037,
+	0x0e04, 0x7015, 0xa94c, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032,
 	0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0xa850, 0x9082, 0x0019,
 	0x1278, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-	0x11d6, 0x2071, 0x1910, 0x080c, 0x70be, 0x012e, 0x0804, 0x7055,
+	0x11d6, 0x2071, 0x1910, 0x080c, 0x70ce, 0x012e, 0x0804, 0x7065,
 	0xa850, 0x9082, 0x001c, 0x1e68, 0xa880, 0x708e, 0x7036, 0x0146,
 	0x01d6, 0x0136, 0x01c6, 0x0156, 0x20e9, 0x0000, 0x20a1, 0x002a,
 	0xa868, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098,
 	0x4003, 0x015e, 0x01ce, 0x013e, 0x01de, 0x014e, 0x0890, 0x2001,
-	0x005b, 0x2004, 0x9094, 0x0780, 0x190c, 0x70d2, 0xd09c, 0x2071,
+	0x005b, 0x2004, 0x9094, 0x0780, 0x190c, 0x70e2, 0xd09c, 0x2071,
 	0x1910, 0x1510, 0x2071, 0x1910, 0x700f, 0x0001, 0xa964, 0x9184,
 	0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101,
 	0x0108, 0x710e, 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de,
@@ -3392,10 +3394,10 @@
 	0x2008, 0x2069, 0x1a03, 0x683c, 0x9005, 0x0760, 0x0158, 0x9186,
 	0x0003, 0x0540, 0x2001, 0x1815, 0x2004, 0x2009, 0x1b4e, 0x210c,
 	0x9102, 0x1500, 0x0126, 0x2091, 0x8000, 0x2069, 0x0050, 0x693c,
-	0x6838, 0x9106, 0x0190, 0x0e04, 0x7089, 0x2069, 0x0000, 0x6837,
+	0x6838, 0x9106, 0x0190, 0x0e04, 0x7099, 0x2069, 0x0000, 0x6837,
 	0x8040, 0x6833, 0x0012, 0x6883, 0x8040, 0x2091, 0x4080, 0x2001,
 	0x0089, 0x2004, 0xd084, 0x190c, 0x11d6, 0x2069, 0x1a03, 0x683f,
-	0xffff, 0x012e, 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x7153,
+	0xffff, 0x012e, 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x7163,
 	0x701c, 0x904d, 0x0540, 0x2001, 0x005b, 0x2004, 0x9094, 0x0780,
 	0x15c9, 0xd09c, 0x1500, 0x2071, 0x1910, 0x700f, 0x0001, 0xa964,
 	0x9184, 0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff,
@@ -3404,7 +3406,7 @@
 	0x9005, 0x1108, 0x701a, 0x012e, 0x0005, 0x0005, 0x0126, 0x2091,
 	0x8000, 0x701c, 0x904d, 0x0160, 0x7010, 0x8001, 0x7012, 0xa800,
 	0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x080c, 0x106c, 0x0005,
-	0x012e, 0x0005, 0x2091, 0x8000, 0x0e04, 0x70d4, 0x0006, 0x0016,
+	0x012e, 0x0005, 0x2091, 0x8000, 0x0e04, 0x70e4, 0x0006, 0x0016,
 	0x2001, 0x8004, 0x0006, 0x0804, 0x0d86, 0x0096, 0x00f6, 0x2079,
 	0x0050, 0x7044, 0xd084, 0x01e0, 0xc084, 0x7046, 0x7838, 0x7938,
 	0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
@@ -3416,7 +3418,7 @@
 	0x2009, 0x1830, 0x210c, 0x918a, 0x0020, 0x0240, 0x7022, 0x2001,
 	0x1dc0, 0x200c, 0x8108, 0x2102, 0x00ee, 0x0058, 0x00ee, 0x2048,
 	0x702c, 0xa802, 0x2900, 0x702e, 0x70c0, 0x8000, 0x70c2, 0x080c,
-	0x8522, 0x782c, 0x9094, 0x0780, 0x190c, 0x70d2, 0xd0a4, 0x19c8,
+	0x8553, 0x782c, 0x9094, 0x0780, 0x190c, 0x70e2, 0xd0a4, 0x19c8,
 	0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836,
 	0x6833, 0x0013, 0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
 	0xd084, 0x190c, 0x11d6, 0x2009, 0x1947, 0x200b, 0x0000, 0x00ee,
@@ -3424,3776 +3426,3780 @@
 	0x01b8, 0xc084, 0x7046, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6,
 	0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x2091, 0x4080,
 	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11d6, 0x00fe, 0x0005,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x70d2, 0xd0a4, 0x0db8, 0x00e6,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x70e2, 0xd0a4, 0x0db8, 0x00e6,
 	0x2071, 0x1800, 0x7824, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e,
-	0x70c0, 0x8000, 0x70c2, 0x080c, 0x8522, 0x782c, 0x9094, 0x0780,
-	0x190c, 0x70d2, 0xd0a4, 0x1d70, 0x00d6, 0x2069, 0x0050, 0x693c,
+	0x70c0, 0x8000, 0x70c2, 0x080c, 0x8553, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x70e2, 0xd0a4, 0x1d70, 0x00d6, 0x2069, 0x0050, 0x693c,
 	0x2069, 0x1948, 0x6808, 0x690a, 0x2069, 0x1a03, 0x9102, 0x1118,
 	0x683c, 0x9005, 0x1328, 0x2001, 0x1949, 0x200c, 0x810d, 0x693e,
 	0x00de, 0x00ee, 0x00fe, 0x0005, 0x7098, 0x908a, 0x0029, 0x1a0c,
 	0x0d7d, 0x9082, 0x001d, 0x003b, 0x0026, 0x2011, 0x1e00, 0x080c,
-	0x2a44, 0x002e, 0x0005, 0x727b, 0x7205, 0x7221, 0x7249, 0x726a,
-	0x72aa, 0x72bc, 0x7221, 0x7292, 0x71c0, 0x71ee, 0x71bf, 0x0005,
+	0x2a44, 0x002e, 0x0005, 0x728f, 0x7215, 0x7231, 0x725b, 0x727e,
+	0x72be, 0x72d0, 0x7231, 0x72a6, 0x71d0, 0x71fe, 0x71cf, 0x0005,
 	0x00d6, 0x2069, 0x0200, 0x6804, 0x9005, 0x1180, 0x6808, 0x9005,
 	0x1518, 0x709b, 0x0028, 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c,
-	0x7617, 0x6028, 0x9085, 0x0600, 0x602a, 0x00b0, 0x709b, 0x0028,
+	0x762b, 0x6028, 0x9085, 0x0600, 0x602a, 0x00b0, 0x709b, 0x0028,
 	0x2069, 0x198f, 0x2d04, 0x7002, 0x6028, 0x9085, 0x0600, 0x602a,
 	0x00e6, 0x0036, 0x0046, 0x0056, 0x2071, 0x1a6b, 0x080c, 0x1ab5,
 	0x005e, 0x004e, 0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6, 0x2069,
 	0x0200, 0x6804, 0x9005, 0x1178, 0x6808, 0x9005, 0x1160, 0x709b,
-	0x0028, 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x76ba, 0x6028,
+	0x0028, 0x2069, 0x198f, 0x2d04, 0x7002, 0x080c, 0x76ce, 0x6028,
 	0x9085, 0x0600, 0x602a, 0x00de, 0x0005, 0x0006, 0x2001, 0x0090,
-	0x080c, 0x2a0a, 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x732d,
+	0x080c, 0x2a0a, 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x7341,
 	0xd1d4, 0x1160, 0xd1dc, 0x1138, 0xd1cc, 0x0150, 0x709b, 0x0020,
-	0x080c, 0x732d, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f,
-	0x0005, 0x2001, 0x0088, 0x080c, 0x2a0a, 0x6124, 0xd1cc, 0x11d8,
-	0xd1dc, 0x11b0, 0xd1e4, 0x1188, 0x9184, 0x1e00, 0x11c8, 0x60e3,
-	0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x7501, 0x2001, 0x0080,
-	0x080c, 0x2a0a, 0x709b, 0x0028, 0x0058, 0x709b, 0x001e, 0x0040,
-	0x709b, 0x001d, 0x0028, 0x709b, 0x0020, 0x0010, 0x709b, 0x001f,
-	0x0005, 0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x7501,
-	0x2001, 0x0080, 0x080c, 0x2a0a, 0x6124, 0xd1d4, 0x1180, 0xd1dc,
-	0x1158, 0xd1e4, 0x1130, 0x9184, 0x1e00, 0x1158, 0x709b, 0x0028,
-	0x0040, 0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b,
-	0x001f, 0x0005, 0x2001, 0x00a0, 0x080c, 0x2a0a, 0x6124, 0xd1dc,
-	0x1138, 0xd1e4, 0x0138, 0x080c, 0x1adf, 0x709b, 0x001e, 0x0010,
-	0x709b, 0x001d, 0x0005, 0x080c, 0x73b6, 0x6124, 0xd1dc, 0x1188,
-	0x080c, 0x732d, 0x0016, 0x080c, 0x1adf, 0x001e, 0xd1d4, 0x1128,
-	0xd1e4, 0x0138, 0x709b, 0x001e, 0x0020, 0x709b, 0x001f, 0x080c,
-	0x732d, 0x0005, 0x0006, 0x2001, 0x00a0, 0x080c, 0x2a0a, 0x000e,
-	0x6124, 0xd1d4, 0x1160, 0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4,
-	0x0140, 0x709b, 0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b,
-	0x0021, 0x0005, 0x080c, 0x73b6, 0x6124, 0xd1d4, 0x1150, 0xd1dc,
-	0x1128, 0xd1e4, 0x0140, 0x709b, 0x001e, 0x0028, 0x709b, 0x001d,
-	0x0010, 0x709b, 0x001f, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c,
-	0x2a0a, 0x000e, 0x6124, 0xd1d4, 0x1178, 0xd1cc, 0x1150, 0xd1dc,
-	0x1128, 0xd1e4, 0x0158, 0x709b, 0x001e, 0x0040, 0x709b, 0x001d,
-	0x0028, 0x709b, 0x0020, 0x0010, 0x709b, 0x001f, 0x0005, 0x0016,
-	0x00c6, 0x00d6, 0x00e6, 0x0126, 0x2061, 0x0100, 0x2069, 0x0140,
-	0x2071, 0x1800, 0x2091, 0x8000, 0x080c, 0x74d5, 0x11f8, 0x2001,
-	0x180c, 0x200c, 0xd1b4, 0x01d0, 0xc1b4, 0x2102, 0x0026, 0x2011,
-	0x0200, 0x080c, 0x2a44, 0x002e, 0x080c, 0x29f0, 0x6024, 0xd0cc,
-	0x0148, 0x2001, 0x00a0, 0x080c, 0x2a0a, 0x080c, 0x77d9, 0x080c,
-	0x6022, 0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x74ef,
-	0x0150, 0x080c, 0x74e6, 0x1138, 0x2001, 0x0001, 0x080c, 0x25a0,
-	0x080c, 0x74a9, 0x00a0, 0x080c, 0x73b3, 0x0178, 0x2001, 0x0001,
-	0x080c, 0x25a0, 0x7098, 0x9086, 0x001e, 0x0120, 0x7098, 0x9086,
-	0x0022, 0x1118, 0x709b, 0x0025, 0x0010, 0x709b, 0x0021, 0x012e,
-	0x00ee, 0x00de, 0x00ce, 0x001e, 0x0005, 0x0026, 0x2011, 0x733e,
-	0x080c, 0x8719, 0x002e, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011,
-	0x733e, 0x080c, 0x8710, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6,
-	0x0016, 0x080c, 0x9e0e, 0x2071, 0x1800, 0x080c, 0x72d7, 0x001e,
-	0x00fe, 0x00ee, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
-	0x00e6, 0x00f6, 0x0126, 0x080c, 0x9e0e, 0x2061, 0x0100, 0x2069,
-	0x0140, 0x2071, 0x1800, 0x2091, 0x8000, 0x6028, 0xc09c, 0x602a,
-	0x080c, 0xa872, 0x2011, 0x0003, 0x080c, 0xa1ab, 0x2011, 0x0002,
-	0x080c, 0xa1b5, 0x080c, 0xa074, 0x080c, 0x86c5, 0x0036, 0x901e,
-	0x080c, 0xa0f4, 0x003e, 0x080c, 0xa88e, 0x60e3, 0x0000, 0x080c,
-	0xe6d7, 0x080c, 0xe6f2, 0x2009, 0x0004, 0x080c, 0x29f6, 0x080c,
-	0x2916, 0x2001, 0x1800, 0x2003, 0x0004, 0x2011, 0x0008, 0x080c,
-	0x2a44, 0x2011, 0x733e, 0x080c, 0x8719, 0x080c, 0x74ef, 0x0118,
-	0x9006, 0x080c, 0x2a0a, 0x080c, 0x0bc3, 0x2001, 0x0001, 0x080c,
-	0x25a0, 0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e,
-	0x001e, 0x0005, 0x0026, 0x00e6, 0x2011, 0x734b, 0x2071, 0x1a03,
-	0x701c, 0x9206, 0x1118, 0x7018, 0x9005, 0x0110, 0x9085, 0x0001,
-	0x00ee, 0x002e, 0x0005, 0x6020, 0xd09c, 0x0005, 0x6800, 0x9084,
-	0xfffe, 0x9086, 0x00c0, 0x01b8, 0x2001, 0x00c0, 0x080c, 0x2a0a,
-	0x0156, 0x20a9, 0x002d, 0x1d04, 0x73c3, 0x2091, 0x6000, 0x1f04,
-	0x73c3, 0x015e, 0x00d6, 0x2069, 0x1800, 0x689c, 0x8001, 0x0220,
-	0x0118, 0x689e, 0x00de, 0x0005, 0x689f, 0x0014, 0x68ec, 0xd0dc,
-	0x0dc8, 0x6800, 0x9086, 0x0001, 0x1da8, 0x080c, 0x8725, 0x0c90,
-	0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071,
-	0x1800, 0x080c, 0x77e8, 0x2001, 0x196d, 0x2003, 0x0000, 0x9006,
-	0x709a, 0x60e2, 0x6886, 0x080c, 0x266f, 0x9006, 0x080c, 0x2a0a,
-	0x080c, 0x5edd, 0x0026, 0x2011, 0xffff, 0x080c, 0x2a44, 0x002e,
-	0x602b, 0x182c, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6,
-	0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2001,
-	0x197d, 0x200c, 0x9186, 0x0000, 0x0158, 0x9186, 0x0001, 0x0158,
-	0x9186, 0x0002, 0x0158, 0x9186, 0x0003, 0x0158, 0x0804, 0x7499,
-	0x709b, 0x0022, 0x0040, 0x709b, 0x0021, 0x0028, 0x709b, 0x0023,
-	0x0010, 0x709b, 0x0024, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001,
-	0x0001, 0x080c, 0x266f, 0x080c, 0xa872, 0x0026, 0x080c, 0xab3a,
-	0x002e, 0x080c, 0xa88e, 0x7000, 0x908e, 0x0004, 0x0118, 0x602b,
-	0x0028, 0x0010, 0x602b, 0x0020, 0x0156, 0x0126, 0x2091, 0x8000,
-	0x20a9, 0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e, 0x015e, 0x080c,
-	0xcf2e, 0x0118, 0x9006, 0x080c, 0x2a34, 0x0804, 0x74a5, 0x6800,
-	0x9084, 0x00a1, 0xc0bd, 0x6802, 0x080c, 0x29f0, 0x6904, 0xd1d4,
-	0x1140, 0x2001, 0x0100, 0x080c, 0x2a0a, 0x1f04, 0x744a, 0x080c,
-	0x752c, 0x012e, 0x015e, 0x080c, 0x74e6, 0x0170, 0x6044, 0x9005,
-	0x0130, 0x080c, 0x752c, 0x9006, 0x8001, 0x1df0, 0x0028, 0x6804,
-	0xd0d4, 0x1110, 0x080c, 0x752c, 0x080c, 0xcf2e, 0x0118, 0x9006,
-	0x080c, 0x2a34, 0x0016, 0x0026, 0x7000, 0x908e, 0x0004, 0x0130,
-	0x2009, 0x00c8, 0x2011, 0x734b, 0x080c, 0x86d7, 0x002e, 0x001e,
-	0x080c, 0x8519, 0x7034, 0xc085, 0x7036, 0x2001, 0x197d, 0x2003,
-	0x0004, 0x080c, 0x71a4, 0x080c, 0x74e6, 0x0138, 0x6804, 0xd0d4,
-	0x1120, 0xd0dc, 0x1100, 0x080c, 0x77de, 0x00ee, 0x00de, 0x00ce,
-	0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140,
-	0x2071, 0x1800, 0x080c, 0x8530, 0x080c, 0x8522, 0x080c, 0x77e8,
-	0x2001, 0x196d, 0x2003, 0x0000, 0x9006, 0x709a, 0x60e2, 0x6886,
-	0x080c, 0x266f, 0x9006, 0x080c, 0x2a0a, 0x6043, 0x0090, 0x6043,
-	0x0010, 0x0026, 0x2011, 0xffff, 0x080c, 0x2a44, 0x002e, 0x602b,
-	0x182c, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x0006, 0x2001, 0x197c,
-	0x2004, 0x9086, 0xaaaa, 0x000e, 0x0005, 0x0006, 0x080c, 0x56d7,
-	0x9084, 0x0030, 0x9086, 0x0000, 0x000e, 0x0005, 0x0006, 0x080c,
-	0x56d7, 0x9084, 0x0030, 0x9086, 0x0030, 0x000e, 0x0005, 0x0006,
-	0x080c, 0x56d7, 0x9084, 0x0030, 0x9086, 0x0010, 0x000e, 0x0005,
-	0x0006, 0x080c, 0x56d7, 0x9084, 0x0030, 0x9086, 0x0020, 0x000e,
-	0x0005, 0x0036, 0x0016, 0x2001, 0x180c, 0x2004, 0x908c, 0x0013,
-	0x0180, 0x0020, 0x080c, 0x268f, 0x900e, 0x0028, 0x080c, 0x6a53,
-	0x1dc8, 0x2009, 0x0002, 0x2019, 0x0028, 0x080c, 0x31a3, 0x9006,
-	0x0019, 0x001e, 0x003e, 0x0005, 0x00e6, 0x2071, 0x180c, 0x2e04,
-	0x0130, 0x080c, 0xcf27, 0x1128, 0x9085, 0x0010, 0x0010, 0x9084,
-	0xffef, 0x2072, 0x00ee, 0x0005, 0x6050, 0x0006, 0x60ec, 0x0006,
-	0x600c, 0x0006, 0x6004, 0x0006, 0x6028, 0x0006, 0x602f, 0x0100,
-	0x602f, 0x0000, 0x602f, 0x0040, 0x602f, 0x0000, 0x20a9, 0x0002,
-	0x080c, 0x29d1, 0x0026, 0x2011, 0x0040, 0x080c, 0x2a44, 0x002e,
-	0x000e, 0x602a, 0x000e, 0x6006, 0x000e, 0x600e, 0x000e, 0x60ee,
-	0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x266f,
-	0x2001, 0x00a0, 0x0006, 0x080c, 0xcf2e, 0x000e, 0x0130, 0x080c,
-	0x2a28, 0x9006, 0x080c, 0x2a34, 0x0010, 0x080c, 0x2a0a, 0x000e,
-	0x6052, 0x6050, 0x0006, 0xc0e5, 0x6052, 0x00f6, 0x2079, 0x0100,
-	0x080c, 0x2981, 0x00fe, 0x000e, 0x6052, 0x0005, 0x0156, 0x0016,
-	0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
-	0x0140, 0x2071, 0x1800, 0x080c, 0xa8d0, 0x0158, 0x2001, 0x0386,
-	0x2004, 0xd0b4, 0x1130, 0x2001, 0x0016, 0x080c, 0xa863, 0x0804,
-	0x7609, 0x2001, 0x180c, 0x200c, 0xc1c4, 0x2102, 0x6028, 0x9084,
-	0xe1ff, 0x602a, 0x2011, 0x0200, 0x080c, 0x2a44, 0x2001, 0x0090,
-	0x080c, 0x2a0a, 0x20a9, 0x0366, 0x6024, 0xd0cc, 0x1558, 0x1d04,
-	0x75a4, 0x2091, 0x6000, 0x1f04, 0x75a4, 0x080c, 0xa872, 0x2011,
-	0x0003, 0x080c, 0xa1ab, 0x2011, 0x0002, 0x080c, 0xa1b5, 0x080c,
-	0xa074, 0x901e, 0x080c, 0xa0f4, 0x2001, 0x0386, 0x2003, 0x7000,
-	0x080c, 0xa88e, 0x2001, 0x00a0, 0x080c, 0x2a0a, 0x080c, 0x77d9,
-	0x080c, 0x6022, 0x080c, 0xcf2e, 0x0110, 0x080c, 0x0ce9, 0x9085,
-	0x0001, 0x04e8, 0x2001, 0x0386, 0x2004, 0xd0ac, 0x0110, 0x080c,
-	0x1adf, 0x60e3, 0x0000, 0x2001, 0x196d, 0x2004, 0x080c, 0x266f,
-	0x60e2, 0x2001, 0x0080, 0x080c, 0x2a0a, 0x20a9, 0x0366, 0x2011,
-	0x1e00, 0x080c, 0x2a44, 0x2009, 0x1e00, 0x080c, 0x29f0, 0x6024,
-	0x910c, 0x0140, 0x1d04, 0x75e7, 0x2091, 0x6000, 0x1f04, 0x75e7,
-	0x0804, 0x75ad, 0x2001, 0x0386, 0x2003, 0x7000, 0x6028, 0x9085,
-	0x1e00, 0x602a, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008,
-	0x6886, 0x080c, 0xcf2e, 0x0110, 0x080c, 0x0ce9, 0x9006, 0x00ee,
-	0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156,
-	0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100,
-	0x2071, 0x1800, 0x7000, 0x9086, 0x0003, 0x1168, 0x2001, 0x020b,
-	0x2004, 0x9084, 0x5540, 0x9086, 0x5540, 0x1128, 0x2069, 0x1a77,
-	0x2d04, 0x8000, 0x206a, 0x2069, 0x0140, 0x6020, 0x9084, 0x00c0,
-	0x0120, 0x6884, 0x9005, 0x1904, 0x7680, 0x2001, 0x0088, 0x080c,
-	0x2a0a, 0x9006, 0x60e2, 0x6886, 0x080c, 0x266f, 0x2069, 0x0200,
-	0x6804, 0x9005, 0x1118, 0x6808, 0x9005, 0x01d0, 0x6028, 0x9084,
-	0xfbff, 0x602a, 0x2011, 0x0400, 0x080c, 0x2a44, 0x2069, 0x198f,
-	0x7000, 0x206a, 0x709b, 0x0026, 0x7003, 0x0001, 0x20a9, 0x0002,
-	0x1d04, 0x7660, 0x2091, 0x6000, 0x1f04, 0x7660, 0x0804, 0x76b2,
-	0x2069, 0x0140, 0x20a9, 0x0384, 0x2011, 0x1e00, 0x080c, 0x2a44,
-	0x2009, 0x1e00, 0x080c, 0x29f0, 0x6024, 0x910c, 0x0528, 0x9084,
-	0x1a00, 0x1510, 0x1d04, 0x766c, 0x2091, 0x6000, 0x1f04, 0x766c,
-	0x080c, 0xa872, 0x2011, 0x0003, 0x080c, 0xa1ab, 0x2011, 0x0002,
-	0x080c, 0xa1b5, 0x080c, 0xa074, 0x901e, 0x080c, 0xa0f4, 0x080c,
-	0xa88e, 0x2001, 0x00a0, 0x080c, 0x2a0a, 0x080c, 0x77d9, 0x080c,
-	0x6022, 0x9085, 0x0001, 0x00b0, 0x2001, 0x0080, 0x080c, 0x2a0a,
-	0x2069, 0x0140, 0x60e3, 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887,
-	0x0001, 0x0008, 0x6886, 0x2001, 0x196d, 0x2004, 0x080c, 0x266f,
-	0x60e2, 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
-	0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
-	0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x6020, 0x9084, 0x00c0,
-	0x01e8, 0x080c, 0xa872, 0x2011, 0x0003, 0x080c, 0xa1ab, 0x2011,
-	0x0002, 0x080c, 0xa1b5, 0x080c, 0xa074, 0x901e, 0x080c, 0xa0f4,
-	0x080c, 0xa88e, 0x2069, 0x0140, 0x2001, 0x00a0, 0x080c, 0x2a0a,
-	0x080c, 0x77d9, 0x080c, 0x6022, 0x0804, 0x7755, 0x2001, 0x180c,
-	0x200c, 0xd1b4, 0x1160, 0xc1b5, 0x2102, 0x080c, 0x7333, 0x2069,
-	0x0140, 0x2001, 0x0080, 0x080c, 0x2a0a, 0x60e3, 0x0000, 0x2069,
-	0x0200, 0x6804, 0x9005, 0x1118, 0x6808, 0x9005, 0x0190, 0x6028,
-	0x9084, 0xfdff, 0x602a, 0x2011, 0x0200, 0x080c, 0x2a44, 0x2069,
-	0x198f, 0x7000, 0x206a, 0x709b, 0x0027, 0x7003, 0x0001, 0x0804,
-	0x7755, 0x2011, 0x1e00, 0x080c, 0x2a44, 0x2009, 0x1e00, 0x080c,
-	0x29f0, 0x6024, 0x910c, 0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04,
-	0x7711, 0x0006, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c, 0x8561,
-	0x00ee, 0x00de, 0x00ce, 0x001e, 0x000e, 0x00e6, 0x2071, 0x1a03,
-	0x7018, 0x00ee, 0x9005, 0x19e8, 0x0500, 0x0026, 0x2011, 0x734b,
-	0x080c, 0x860d, 0x2011, 0x733e, 0x080c, 0x8719, 0x002e, 0x2069,
-	0x0140, 0x60e3, 0x0000, 0x70b4, 0x9005, 0x1118, 0x6887, 0x0001,
-	0x0008, 0x6886, 0x2001, 0x196d, 0x2004, 0x080c, 0x266f, 0x60e2,
-	0x2001, 0x180c, 0x200c, 0xc1b4, 0x2102, 0x00ee, 0x00de, 0x00ce,
-	0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026,
-	0x0036, 0x0046, 0x00c6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800,
-	0x080c, 0xcf27, 0x1904, 0x77c3, 0x7130, 0xd184, 0x1170, 0x080c,
-	0x3361, 0x0138, 0xc18d, 0x7132, 0x2011, 0x1848, 0x2214, 0xd2ac,
-	0x1120, 0x7030, 0xd08c, 0x0904, 0x77c3, 0x2011, 0x1848, 0x220c,
-	0xd1a4, 0x0538, 0x0016, 0x2019, 0x000e, 0x080c, 0xe20e, 0x0156,
-	0x00b6, 0x20a9, 0x007f, 0x900e, 0x9186, 0x007e, 0x01a0, 0x9186,
-	0x0080, 0x0188, 0x080c, 0x661e, 0x1170, 0x2120, 0x9006, 0x0016,
-	0x2009, 0x000e, 0x080c, 0xe29e, 0x2009, 0x0001, 0x2011, 0x0100,
-	0x080c, 0x88bb, 0x001e, 0x8108, 0x1f04, 0x778c, 0x00be, 0x015e,
-	0x001e, 0xd1ac, 0x1148, 0x0016, 0x2009, 0x0002, 0x2019, 0x0004,
-	0x080c, 0x31a3, 0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f,
-	0x900e, 0x080c, 0x661e, 0x1110, 0x080c, 0x603c, 0x8108, 0x1f04,
-	0x77b9, 0x00be, 0x015e, 0x080c, 0x1adf, 0x080c, 0xa872, 0x080c,
-	0xab3a, 0x080c, 0xa88e, 0x60e3, 0x0000, 0x080c, 0x6022, 0x080c,
-	0x7406, 0x00ee, 0x00ce, 0x004e, 0x003e, 0x002e, 0x001e, 0x015e,
-	0x0005, 0x2001, 0x197d, 0x2003, 0x0001, 0x0005, 0x2001, 0x197d,
-	0x2003, 0x0000, 0x0005, 0x2001, 0x197c, 0x2003, 0xaaaa, 0x0005,
-	0x2001, 0x197c, 0x2003, 0x0000, 0x0005, 0x2071, 0x18fa, 0x7003,
-	0x0000, 0x7007, 0x0000, 0x080c, 0x1053, 0x090c, 0x0d7d, 0xa8ab,
-	0xdcb0, 0x2900, 0x704e, 0x080c, 0x1053, 0x090c, 0x0d7d, 0xa8ab,
-	0xdcb0, 0x2900, 0x7052, 0xa867, 0x0000, 0xa86b, 0x0001, 0xa89f,
-	0x0000, 0x0005, 0x00e6, 0x2071, 0x0040, 0x6848, 0x9005, 0x1118,
-	0x9085, 0x0001, 0x04b0, 0x6840, 0x9005, 0x0150, 0x04a1, 0x6a50,
-	0x9200, 0x7002, 0x6854, 0x9101, 0x7006, 0x9006, 0x7012, 0x7016,
-	0x6850, 0x7002, 0x6854, 0x7006, 0x6858, 0x700a, 0x685c, 0x700e,
-	0x6840, 0x9005, 0x1110, 0x7012, 0x7016, 0x6848, 0x701a, 0x701c,
-	0x9085, 0x0040, 0x701e, 0x2001, 0x0019, 0x7036, 0x702b, 0x0001,
-	0x2001, 0x0004, 0x200c, 0x918c, 0xfff7, 0x918d, 0x8000, 0x2102,
-	0x00d6, 0x2069, 0x18fa, 0x6807, 0x0001, 0x00de, 0x080c, 0x7dd0,
-	0x9006, 0x00ee, 0x0005, 0x900e, 0x0156, 0x20a9, 0x0006, 0x8003,
-	0x818d, 0x1f04, 0x784f, 0x015e, 0x0005, 0x2079, 0x0040, 0x2071,
-	0x18fa, 0x7004, 0x0002, 0x7865, 0x7866, 0x78b1, 0x790c, 0x7a1c,
-	0x7863, 0x7863, 0x7a46, 0x080c, 0x0d7d, 0x0005, 0x2079, 0x0040,
-	0x2001, 0x1dc0, 0x2003, 0x0000, 0x782c, 0x908c, 0x0780, 0x190c,
-	0x7eb2, 0xd0a4, 0x0570, 0x2001, 0x1dc0, 0x2004, 0x9082, 0x0080,
-	0x1640, 0x1d04, 0x7883, 0x2001, 0x1a06, 0x200c, 0x8109, 0x0508,
-	0x2091, 0x6000, 0x2102, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806,
-	0xa864, 0x9084, 0x00ff, 0x908a, 0x0040, 0x0608, 0x00b8, 0x2001,
-	0x1800, 0x200c, 0x9186, 0x0003, 0x1160, 0x7104, 0x9186, 0x0004,
-	0x0140, 0x9186, 0x0007, 0x0128, 0x9186, 0x0003, 0x1968, 0x080c,
-	0x790c, 0x782c, 0xd09c, 0x090c, 0x7dd0, 0x0005, 0x9082, 0x005a,
-	0x1218, 0x2100, 0x003b, 0x0c18, 0x080c, 0x7942, 0x0c90, 0x00e3,
-	0x08f0, 0x0005, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942,
-	0x7942, 0x7942, 0x7964, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942,
-	0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942,
-	0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x794e, 0x7942,
-	0x7b37, 0x7942, 0x7942, 0x7942, 0x7964, 0x7942, 0x794e, 0x7b78,
-	0x7bb9, 0x7c00, 0x7c14, 0x7942, 0x7942, 0x7964, 0x794e, 0x7978,
-	0x7942, 0x79f0, 0x7cbf, 0x7cda, 0x7942, 0x7964, 0x7942, 0x7978,
-	0x7942, 0x7942, 0x79e6, 0x7cda, 0x7942, 0x7942, 0x7942, 0x7942,
-	0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x798c, 0x7942, 0x7942,
-	0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x7942, 0x7e56,
-	0x7942, 0x7e00, 0x7942, 0x7e00, 0x7942, 0x79a1, 0x7942, 0x7942,
-	0x7942, 0x7942, 0x7942, 0x7942, 0x2079, 0x0040, 0x7004, 0x9086,
-	0x0003, 0x1198, 0x782c, 0x080c, 0x7df9, 0xd0a4, 0x0170, 0x7824,
+	0x080c, 0x7341, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f,
+	0x0005, 0x2001, 0x0088, 0x080c, 0x2a0a, 0x6124, 0xd1cc, 0x11e8,
+	0xd1dc, 0x11c0, 0xd1e4, 0x1198, 0x9184, 0x1e00, 0x11d8, 0x080c,
+	0x1adf, 0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x7515,
+	0x2001, 0x0080, 0x080c, 0x2a0a, 0x709b, 0x0028, 0x0058, 0x709b,
+	0x001e, 0x0040, 0x709b, 0x001d, 0x0028, 0x709b, 0x0020, 0x0010,
+	0x709b, 0x001f, 0x0005, 0x080c, 0x1adf, 0x60e3, 0x0001, 0x600c,
+	0xc0b4, 0x600e, 0x080c, 0x7515, 0x2001, 0x0080, 0x080c, 0x2a0a,
+	0x6124, 0xd1d4, 0x1180, 0xd1dc, 0x1158, 0xd1e4, 0x1130, 0x9184,
+	0x1e00, 0x1158, 0x709b, 0x0028, 0x0040, 0x709b, 0x001e, 0x0028,
+	0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005, 0x2001, 0x00a0,
+	0x080c, 0x2a0a, 0x6124, 0xd1dc, 0x1138, 0xd1e4, 0x0138, 0x080c,
+	0x1adf, 0x709b, 0x001e, 0x0010, 0x709b, 0x001d, 0x0005, 0x080c,
+	0x73ca, 0x6124, 0xd1dc, 0x1188, 0x080c, 0x7341, 0x0016, 0x080c,
+	0x1adf, 0x001e, 0xd1d4, 0x1128, 0xd1e4, 0x0138, 0x709b, 0x001e,
+	0x0020, 0x709b, 0x001f, 0x080c, 0x7341, 0x0005, 0x0006, 0x2001,
+	0x00a0, 0x080c, 0x2a0a, 0x000e, 0x6124, 0xd1d4, 0x1160, 0xd1cc,
+	0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x709b, 0x001e, 0x0028,
+	0x709b, 0x001d, 0x0010, 0x709b, 0x0021, 0x0005, 0x080c, 0x73ca,
+	0x6124, 0xd1d4, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x709b,
+	0x001e, 0x0028, 0x709b, 0x001d, 0x0010, 0x709b, 0x001f, 0x0005,
+	0x0006, 0x2001, 0x0090, 0x080c, 0x2a0a, 0x000e, 0x6124, 0xd1d4,
+	0x1178, 0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0158, 0x709b,
+	0x001e, 0x0040, 0x709b, 0x001d, 0x0028, 0x709b, 0x0020, 0x0010,
+	0x709b, 0x001f, 0x0005, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x0126,
+	0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2091, 0x8000,
+	0x080c, 0x74e9, 0x11f8, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x01d0,
+	0xc1b4, 0x2102, 0x0026, 0x2011, 0x0200, 0x080c, 0x2a44, 0x002e,
+	0x080c, 0x29f0, 0x6024, 0xd0cc, 0x0148, 0x2001, 0x00a0, 0x080c,
+	0x2a0a, 0x080c, 0x77ed, 0x080c, 0x6029, 0x0428, 0x6028, 0xc0cd,
+	0x602a, 0x0408, 0x080c, 0x7503, 0x0150, 0x080c, 0x74fa, 0x1138,
+	0x2001, 0x0001, 0x080c, 0x25a0, 0x080c, 0x74bd, 0x00a0, 0x080c,
+	0x73c7, 0x0178, 0x2001, 0x0001, 0x080c, 0x25a0, 0x7098, 0x9086,
+	0x001e, 0x0120, 0x7098, 0x9086, 0x0022, 0x1118, 0x709b, 0x0025,
+	0x0010, 0x709b, 0x0021, 0x012e, 0x00ee, 0x00de, 0x00ce, 0x001e,
+	0x0005, 0x0026, 0x2011, 0x7352, 0x080c, 0x874a, 0x002e, 0x0016,
+	0x0026, 0x2009, 0x0064, 0x2011, 0x7352, 0x080c, 0x8741, 0x002e,
+	0x001e, 0x0005, 0x00e6, 0x00f6, 0x0016, 0x080c, 0x9e32, 0x2071,
+	0x1800, 0x080c, 0x72eb, 0x001e, 0x00fe, 0x00ee, 0x0005, 0x0016,
+	0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0126, 0x080c,
+	0x9e32, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2091,
+	0x8000, 0x6028, 0xc09c, 0x602a, 0x080c, 0xa896, 0x2011, 0x0003,
+	0x080c, 0xa1cf, 0x2011, 0x0002, 0x080c, 0xa1d9, 0x080c, 0xa098,
+	0x080c, 0x86f6, 0x0036, 0x901e, 0x080c, 0xa118, 0x003e, 0x080c,
+	0xa8b2, 0x60e3, 0x0000, 0x080c, 0xe702, 0x080c, 0xe71d, 0x2009,
+	0x0004, 0x080c, 0x29f6, 0x080c, 0x2916, 0x2001, 0x1800, 0x2003,
+	0x0004, 0x2011, 0x0008, 0x080c, 0x2a44, 0x2011, 0x7352, 0x080c,
+	0x874a, 0x080c, 0x7503, 0x0118, 0x9006, 0x080c, 0x2a0a, 0x080c,
+	0x0bc3, 0x2001, 0x0001, 0x080c, 0x25a0, 0x012e, 0x00fe, 0x00ee,
+	0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x0005, 0x0026, 0x00e6,
+	0x2011, 0x735f, 0x2071, 0x1a03, 0x701c, 0x9206, 0x1118, 0x7018,
+	0x9005, 0x0110, 0x9085, 0x0001, 0x00ee, 0x002e, 0x0005, 0x6020,
+	0xd09c, 0x0005, 0x6800, 0x9084, 0xfffe, 0x9086, 0x00c0, 0x01b8,
+	0x2001, 0x00c0, 0x080c, 0x2a0a, 0x0156, 0x20a9, 0x002d, 0x1d04,
+	0x73d7, 0x2091, 0x6000, 0x1f04, 0x73d7, 0x015e, 0x00d6, 0x2069,
+	0x1800, 0x689c, 0x8001, 0x0220, 0x0118, 0x689e, 0x00de, 0x0005,
+	0x689f, 0x0014, 0x68ec, 0xd0dc, 0x0dc8, 0x6800, 0x9086, 0x0001,
+	0x1da8, 0x080c, 0x8756, 0x0c90, 0x00c6, 0x00d6, 0x00e6, 0x2061,
+	0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x080c, 0x77fc, 0x2001,
+	0x196d, 0x2003, 0x0000, 0x9006, 0x709a, 0x60e2, 0x6886, 0x080c,
+	0x266f, 0x9006, 0x080c, 0x2a0a, 0x080c, 0x5ee4, 0x0026, 0x2011,
+	0xffff, 0x080c, 0x2a44, 0x002e, 0x602b, 0x182c, 0x00ee, 0x00de,
+	0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x2071, 0x1800, 0x2001, 0x197d, 0x200c, 0x9186, 0x0000,
+	0x0158, 0x9186, 0x0001, 0x0158, 0x9186, 0x0002, 0x0158, 0x9186,
+	0x0003, 0x0158, 0x0804, 0x74ad, 0x709b, 0x0022, 0x0040, 0x709b,
+	0x0021, 0x0028, 0x709b, 0x0023, 0x0010, 0x709b, 0x0024, 0x60e3,
+	0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x266f, 0x080c,
+	0xa896, 0x0026, 0x080c, 0xab5e, 0x002e, 0x080c, 0xa8b2, 0x7000,
+	0x908e, 0x0004, 0x0118, 0x602b, 0x0028, 0x0010, 0x602b, 0x0020,
+	0x0156, 0x0126, 0x2091, 0x8000, 0x20a9, 0x0005, 0x6024, 0xd0ac,
+	0x0150, 0x012e, 0x015e, 0x080c, 0xcf52, 0x0118, 0x9006, 0x080c,
+	0x2a34, 0x0804, 0x74b9, 0x6800, 0x9084, 0x00a1, 0xc0bd, 0x6802,
+	0x080c, 0x29f0, 0x6904, 0xd1d4, 0x1140, 0x2001, 0x0100, 0x080c,
+	0x2a0a, 0x1f04, 0x745e, 0x080c, 0x7540, 0x012e, 0x015e, 0x080c,
+	0x74fa, 0x0170, 0x6044, 0x9005, 0x0130, 0x080c, 0x7540, 0x9006,
+	0x8001, 0x1df0, 0x0028, 0x6804, 0xd0d4, 0x1110, 0x080c, 0x7540,
+	0x080c, 0xcf52, 0x0118, 0x9006, 0x080c, 0x2a34, 0x0016, 0x0026,
+	0x7000, 0x908e, 0x0004, 0x0130, 0x2009, 0x00c8, 0x2011, 0x735f,
+	0x080c, 0x8708, 0x002e, 0x001e, 0x080c, 0x854a, 0x7034, 0xc085,
+	0x7036, 0x2001, 0x197d, 0x2003, 0x0004, 0x080c, 0x71b4, 0x080c,
+	0x74fa, 0x0138, 0x6804, 0xd0d4, 0x1120, 0xd0dc, 0x1100, 0x080c,
+	0x77f2, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6,
+	0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x080c, 0x8561,
+	0x080c, 0x8553, 0x080c, 0x77fc, 0x2001, 0x196d, 0x2003, 0x0000,
+	0x9006, 0x709a, 0x60e2, 0x6886, 0x080c, 0x266f, 0x9006, 0x080c,
+	0x2a0a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0026, 0x2011, 0xffff,
+	0x080c, 0x2a44, 0x002e, 0x602b, 0x182c, 0x00ee, 0x00de, 0x00ce,
+	0x0005, 0x0006, 0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x000e,
+	0x0005, 0x0006, 0x080c, 0x56de, 0x9084, 0x0030, 0x9086, 0x0000,
+	0x000e, 0x0005, 0x0006, 0x080c, 0x56de, 0x9084, 0x0030, 0x9086,
+	0x0030, 0x000e, 0x0005, 0x0006, 0x080c, 0x56de, 0x9084, 0x0030,
+	0x9086, 0x0010, 0x000e, 0x0005, 0x0006, 0x080c, 0x56de, 0x9084,
+	0x0030, 0x9086, 0x0020, 0x000e, 0x0005, 0x0036, 0x0016, 0x2001,
+	0x180c, 0x2004, 0x908c, 0x0013, 0x0180, 0x0020, 0x080c, 0x268f,
+	0x900e, 0x0028, 0x080c, 0x6a63, 0x1dc8, 0x2009, 0x0002, 0x2019,
+	0x0028, 0x080c, 0x31a6, 0x9006, 0x0019, 0x001e, 0x003e, 0x0005,
+	0x00e6, 0x2071, 0x180c, 0x2e04, 0x0130, 0x080c, 0xcf4b, 0x1128,
+	0x9085, 0x0010, 0x0010, 0x9084, 0xffef, 0x2072, 0x00ee, 0x0005,
+	0x6050, 0x0006, 0x60ec, 0x0006, 0x600c, 0x0006, 0x6004, 0x0006,
+	0x6028, 0x0006, 0x602f, 0x0100, 0x602f, 0x0000, 0x602f, 0x0040,
+	0x602f, 0x0000, 0x20a9, 0x0002, 0x080c, 0x29d1, 0x0026, 0x2011,
+	0x0040, 0x080c, 0x2a44, 0x002e, 0x000e, 0x602a, 0x000e, 0x6006,
+	0x000e, 0x600e, 0x000e, 0x60ee, 0x60e3, 0x0000, 0x6887, 0x0001,
+	0x2001, 0x0001, 0x080c, 0x266f, 0x2001, 0x00a0, 0x0006, 0x080c,
+	0xcf52, 0x000e, 0x0130, 0x080c, 0x2a28, 0x9006, 0x080c, 0x2a34,
+	0x0010, 0x080c, 0x2a0a, 0x000e, 0x6052, 0x6050, 0x0006, 0xc0e5,
+	0x6052, 0x00f6, 0x2079, 0x0100, 0x080c, 0x2981, 0x00fe, 0x000e,
+	0x6052, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
+	0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x080c,
+	0xa8f4, 0x0158, 0x2001, 0x0386, 0x2004, 0xd0b4, 0x1130, 0x2001,
+	0x0016, 0x080c, 0xa887, 0x0804, 0x761d, 0x2001, 0x180c, 0x200c,
+	0xc1c4, 0x2102, 0x6028, 0x9084, 0xe1ff, 0x602a, 0x2011, 0x0200,
+	0x080c, 0x2a44, 0x2001, 0x0090, 0x080c, 0x2a0a, 0x20a9, 0x0366,
+	0x6024, 0xd0cc, 0x1558, 0x1d04, 0x75b8, 0x2091, 0x6000, 0x1f04,
+	0x75b8, 0x080c, 0xa896, 0x2011, 0x0003, 0x080c, 0xa1cf, 0x2011,
+	0x0002, 0x080c, 0xa1d9, 0x080c, 0xa098, 0x901e, 0x080c, 0xa118,
+	0x2001, 0x0386, 0x2003, 0x7000, 0x080c, 0xa8b2, 0x2001, 0x00a0,
+	0x080c, 0x2a0a, 0x080c, 0x77ed, 0x080c, 0x6029, 0x080c, 0xcf52,
+	0x0110, 0x080c, 0x0ce9, 0x9085, 0x0001, 0x04e8, 0x2001, 0x0386,
+	0x2004, 0xd0ac, 0x0110, 0x080c, 0x1adf, 0x60e3, 0x0000, 0x2001,
+	0x196d, 0x2004, 0x080c, 0x266f, 0x60e2, 0x2001, 0x0080, 0x080c,
+	0x2a0a, 0x20a9, 0x0366, 0x2011, 0x1e00, 0x080c, 0x2a44, 0x2009,
+	0x1e00, 0x080c, 0x29f0, 0x6024, 0x910c, 0x0140, 0x1d04, 0x75fb,
+	0x2091, 0x6000, 0x1f04, 0x75fb, 0x0804, 0x75c1, 0x2001, 0x0386,
+	0x2003, 0x7000, 0x6028, 0x9085, 0x1e00, 0x602a, 0x70b4, 0x9005,
+	0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x080c, 0xcf52, 0x0110,
+	0x080c, 0x0ce9, 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e,
+	0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6,
+	0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x7000, 0x9086,
+	0x0003, 0x1168, 0x2001, 0x020b, 0x2004, 0x9084, 0x5540, 0x9086,
+	0x5540, 0x1128, 0x2069, 0x1a77, 0x2d04, 0x8000, 0x206a, 0x2069,
+	0x0140, 0x6020, 0x9084, 0x00c0, 0x0120, 0x6884, 0x9005, 0x1904,
+	0x7694, 0x2001, 0x0088, 0x080c, 0x2a0a, 0x9006, 0x60e2, 0x6886,
+	0x080c, 0x266f, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118, 0x6808,
+	0x9005, 0x01d0, 0x6028, 0x9084, 0xfbff, 0x602a, 0x2011, 0x0400,
+	0x080c, 0x2a44, 0x2069, 0x198f, 0x7000, 0x206a, 0x709b, 0x0026,
+	0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04, 0x7674, 0x2091, 0x6000,
+	0x1f04, 0x7674, 0x0804, 0x76c6, 0x2069, 0x0140, 0x20a9, 0x0384,
+	0x2011, 0x1e00, 0x080c, 0x2a44, 0x2009, 0x1e00, 0x080c, 0x29f0,
+	0x6024, 0x910c, 0x0528, 0x9084, 0x1a00, 0x1510, 0x1d04, 0x7680,
+	0x2091, 0x6000, 0x1f04, 0x7680, 0x080c, 0xa896, 0x2011, 0x0003,
+	0x080c, 0xa1cf, 0x2011, 0x0002, 0x080c, 0xa1d9, 0x080c, 0xa098,
+	0x901e, 0x080c, 0xa118, 0x080c, 0xa8b2, 0x2001, 0x00a0, 0x080c,
+	0x2a0a, 0x080c, 0x77ed, 0x080c, 0x6029, 0x9085, 0x0001, 0x00b0,
+	0x2001, 0x0080, 0x080c, 0x2a0a, 0x2069, 0x0140, 0x60e3, 0x0000,
+	0x70b4, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x2001,
+	0x196d, 0x2004, 0x080c, 0x266f, 0x60e2, 0x9006, 0x00ee, 0x00de,
+	0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016,
+	0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071,
+	0x1800, 0x6020, 0x9084, 0x00c0, 0x01e8, 0x080c, 0xa896, 0x2011,
+	0x0003, 0x080c, 0xa1cf, 0x2011, 0x0002, 0x080c, 0xa1d9, 0x080c,
+	0xa098, 0x901e, 0x080c, 0xa118, 0x080c, 0xa8b2, 0x2069, 0x0140,
+	0x2001, 0x00a0, 0x080c, 0x2a0a, 0x080c, 0x77ed, 0x080c, 0x6029,
+	0x0804, 0x7769, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x1160, 0xc1b5,
+	0x2102, 0x080c, 0x7347, 0x2069, 0x0140, 0x2001, 0x0080, 0x080c,
+	0x2a0a, 0x60e3, 0x0000, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118,
+	0x6808, 0x9005, 0x0190, 0x6028, 0x9084, 0xfdff, 0x602a, 0x2011,
+	0x0200, 0x080c, 0x2a44, 0x2069, 0x198f, 0x7000, 0x206a, 0x709b,
+	0x0027, 0x7003, 0x0001, 0x0804, 0x7769, 0x2011, 0x1e00, 0x080c,
+	0x2a44, 0x2009, 0x1e00, 0x080c, 0x29f0, 0x6024, 0x910c, 0x01c8,
+	0x9084, 0x1c00, 0x11b0, 0x1d04, 0x7725, 0x0006, 0x0016, 0x00c6,
+	0x00d6, 0x00e6, 0x080c, 0x8592, 0x00ee, 0x00de, 0x00ce, 0x001e,
+	0x000e, 0x00e6, 0x2071, 0x1a03, 0x7018, 0x00ee, 0x9005, 0x19e8,
+	0x0500, 0x0026, 0x2011, 0x735f, 0x080c, 0x863e, 0x2011, 0x7352,
+	0x080c, 0x874a, 0x002e, 0x2069, 0x0140, 0x60e3, 0x0000, 0x70b4,
+	0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x2001, 0x196d,
+	0x2004, 0x080c, 0x266f, 0x60e2, 0x2001, 0x180c, 0x200c, 0xc1b4,
+	0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e,
+	0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x0046, 0x00c6, 0x00e6,
+	0x2061, 0x0100, 0x2071, 0x1800, 0x080c, 0xcf4b, 0x1904, 0x77d7,
+	0x7130, 0xd184, 0x1170, 0x080c, 0x3368, 0x0138, 0xc18d, 0x7132,
+	0x2011, 0x1848, 0x2214, 0xd2ac, 0x1120, 0x7030, 0xd08c, 0x0904,
+	0x77d7, 0x2011, 0x1848, 0x220c, 0xd1a4, 0x0538, 0x0016, 0x2019,
+	0x000e, 0x080c, 0xe239, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e,
+	0x9186, 0x007e, 0x01a0, 0x9186, 0x0080, 0x0188, 0x080c, 0x6625,
+	0x1170, 0x2120, 0x9006, 0x0016, 0x2009, 0x000e, 0x080c, 0xe2c9,
+	0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x88ec, 0x001e, 0x8108,
+	0x1f04, 0x77a0, 0x00be, 0x015e, 0x001e, 0xd1ac, 0x1148, 0x0016,
+	0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x31a6, 0x001e, 0x0078,
+	0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x6625, 0x1110,
+	0x080c, 0x6043, 0x8108, 0x1f04, 0x77cd, 0x00be, 0x015e, 0x080c,
+	0x1adf, 0x080c, 0xa896, 0x080c, 0xab5e, 0x080c, 0xa8b2, 0x60e3,
+	0x0000, 0x080c, 0x6029, 0x080c, 0x741a, 0x00ee, 0x00ce, 0x004e,
+	0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x2001, 0x197d, 0x2003,
+	0x0001, 0x0005, 0x2001, 0x197d, 0x2003, 0x0000, 0x0005, 0x2001,
+	0x197c, 0x2003, 0xaaaa, 0x0005, 0x2001, 0x197c, 0x2003, 0x0000,
+	0x0005, 0x2071, 0x18fa, 0x7003, 0x0000, 0x7007, 0x0000, 0x080c,
+	0x1053, 0x090c, 0x0d7d, 0xa8ab, 0xdcb0, 0x2900, 0x704e, 0x080c,
+	0x1053, 0x090c, 0x0d7d, 0xa8ab, 0xdcb0, 0x2900, 0x7052, 0xa867,
+	0x0000, 0xa86b, 0x0001, 0xa89f, 0x0000, 0x0005, 0x00e6, 0x2071,
+	0x0040, 0x6848, 0x9005, 0x1118, 0x9085, 0x0001, 0x04b0, 0x6840,
+	0x9005, 0x0150, 0x04a1, 0x6a50, 0x9200, 0x7002, 0x6854, 0x9101,
+	0x7006, 0x9006, 0x7012, 0x7016, 0x6850, 0x7002, 0x6854, 0x7006,
+	0x6858, 0x700a, 0x685c, 0x700e, 0x6840, 0x9005, 0x1110, 0x7012,
+	0x7016, 0x6848, 0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x2001,
+	0x0019, 0x7036, 0x702b, 0x0001, 0x2001, 0x0004, 0x200c, 0x918c,
+	0xfff7, 0x918d, 0x8000, 0x2102, 0x00d6, 0x2069, 0x18fa, 0x6807,
+	0x0001, 0x00de, 0x080c, 0x7de4, 0x9006, 0x00ee, 0x0005, 0x900e,
+	0x0156, 0x20a9, 0x0006, 0x8003, 0x818d, 0x1f04, 0x7863, 0x015e,
+	0x0005, 0x2079, 0x0040, 0x2071, 0x18fa, 0x7004, 0x0002, 0x7879,
+	0x787a, 0x78c5, 0x7920, 0x7a30, 0x7877, 0x7877, 0x7a5a, 0x080c,
+	0x0d7d, 0x0005, 0x2079, 0x0040, 0x2001, 0x1dc0, 0x2003, 0x0000,
+	0x782c, 0x908c, 0x0780, 0x190c, 0x7ec6, 0xd0a4, 0x0570, 0x2001,
+	0x1dc0, 0x2004, 0x9082, 0x0080, 0x1640, 0x1d04, 0x7897, 0x2001,
+	0x1a06, 0x200c, 0x8109, 0x0508, 0x2091, 0x6000, 0x2102, 0x7824,
 	0x2048, 0x9006, 0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a,
-	0x001a, 0x1210, 0x002b, 0x0c50, 0x00e9, 0x080c, 0x7dd0, 0x0005,
-	0x7942, 0x794e, 0x7b23, 0x7942, 0x794e, 0x7942, 0x794e, 0x794e,
-	0x7942, 0x794e, 0x7b23, 0x794e, 0x794e, 0x794e, 0x794e, 0x794e,
-	0x7942, 0x794e, 0x7b23, 0x7942, 0x7942, 0x794e, 0x7942, 0x7942,
-	0x7942, 0x794e, 0x00e6, 0x2071, 0x18fa, 0x2009, 0x0400, 0x0071,
-	0x00ee, 0x0005, 0x2009, 0x1000, 0x0049, 0x0005, 0x2009, 0x2000,
-	0x0029, 0x0005, 0x2009, 0x0800, 0x0009, 0x0005, 0x7007, 0x0001,
-	0xa868, 0x9084, 0x00ff, 0x9105, 0xa86a, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x6d70, 0x012e, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff,
-	0x0d08, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7ac5, 0x7007,
-	0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7ac5, 0x0005,
-	0xa864, 0x8007, 0x9084, 0x00ff, 0x0968, 0x8001, 0x1120, 0x7007,
-	0x0001, 0x0804, 0x7ae0, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016,
-	0x701a, 0x704b, 0x7ae0, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff,
-	0x0904, 0x794a, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7afc,
-	0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7afc,
-	0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904,
-	0x794a, 0x7007, 0x0001, 0x2009, 0x1834, 0x210c, 0x81ff, 0x11a8,
-	0xa868, 0x9084, 0x00ff, 0xa86a, 0xa883, 0x0000, 0x080c, 0x62b2,
-	0x1108, 0x0005, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139, 0xa87a,
-	0xa982, 0x080c, 0x6d70, 0x012e, 0x0ca0, 0xa994, 0x9186, 0x0071,
-	0x0d38, 0x9186, 0x0064, 0x0d20, 0x9186, 0x007c, 0x0d08, 0x9186,
-	0x0028, 0x09f0, 0x9186, 0x0038, 0x09d8, 0x9186, 0x0078, 0x09c0,
-	0x9186, 0x005f, 0x09a8, 0x9186, 0x0056, 0x0990, 0xa897, 0x4005,
-	0xa89b, 0x0001, 0x2001, 0x0030, 0x900e, 0x08a0, 0xa87c, 0x9084,
-	0x00c0, 0x9086, 0x00c0, 0x1120, 0x7007, 0x0001, 0x0804, 0x7cf1,
-	0x2900, 0x7016, 0x701a, 0x20a9, 0x0004, 0xa860, 0x20e0, 0xa85c,
-	0x9080, 0x0030, 0x2098, 0x7050, 0x2040, 0xa060, 0x20e8, 0xa05c,
-	0x9080, 0x0023, 0x20a0, 0x4003, 0xa888, 0x7012, 0x9082, 0x0401,
-	0x1a04, 0x7952, 0xaab4, 0x928a, 0x0002, 0x1a04, 0x7952, 0x82ff,
-	0x1138, 0xa8b8, 0xa9bc, 0x9105, 0x0118, 0x2001, 0x7a83, 0x0018,
-	0x9280, 0x7a79, 0x2005, 0x7056, 0x7010, 0x9015, 0x0904, 0x7a64,
-	0x080c, 0x1053, 0x1118, 0x7007, 0x0004, 0x0005, 0x2900, 0x7022,
-	0x7054, 0x2060, 0xe000, 0xa866, 0x7050, 0x2040, 0xa95c, 0xe004,
-	0x9100, 0xa076, 0xa860, 0xa072, 0xe008, 0x920a, 0x1210, 0x900e,
-	0x2200, 0x7112, 0xe20c, 0x8003, 0x800b, 0x9296, 0x0004, 0x0108,
-	0x9108, 0xa17a, 0x810b, 0xa17e, 0x080c, 0x1124, 0xa06c, 0x908e,
-	0x0100, 0x0170, 0x9086, 0x0200, 0x0118, 0x7007, 0x0007, 0x0005,
-	0x7020, 0x2048, 0x080c, 0x106c, 0x7014, 0x2048, 0x0804, 0x7952,
-	0x7020, 0x2048, 0x7018, 0xa802, 0xa807, 0x0000, 0x2908, 0x2048,
-	0xa906, 0x711a, 0x0804, 0x7a1c, 0x7014, 0x2048, 0x7007, 0x0001,
-	0xa8b4, 0x9005, 0x1128, 0xa8b8, 0xa9bc, 0x9105, 0x0108, 0x00b9,
-	0xa864, 0x9084, 0x00ff, 0x9086, 0x001e, 0x0904, 0x7cf1, 0x0804,
-	0x7ac5, 0x7a7b, 0x7a7f, 0x0002, 0x001d, 0x0007, 0x0004, 0x000a,
-	0x001b, 0x0005, 0x0006, 0x000a, 0x001d, 0x0005, 0x0004, 0x0076,
-	0x0066, 0xafb8, 0xaebc, 0xa804, 0x2050, 0xb0c0, 0xb0e2, 0xb0bc,
-	0xb0de, 0xb0b8, 0xb0d2, 0xb0b4, 0xb0ce, 0xb6da, 0xb7d6, 0xb0b0,
-	0xb0ca, 0xb0ac, 0xb0c6, 0xb0a8, 0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2,
-	0xb7be, 0xb0a0, 0xb0b2, 0xb09c, 0xb0ae, 0xb098, 0xb0a2, 0xb094,
-	0xb09e, 0xb6aa, 0xb7a6, 0xb090, 0xb09a, 0xb08c, 0xb096, 0xb088,
-	0xb08a, 0xb084, 0xb086, 0xb692, 0xb78e, 0xb080, 0xb082, 0xb07c,
-	0xb07e, 0xb078, 0xb072, 0xb074, 0xb06e, 0xb67a, 0xb776, 0xb004,
-	0x9055, 0x1958, 0x006e, 0x007e, 0x0005, 0x2009, 0x1834, 0x210c,
-	0x81ff, 0x1178, 0x080c, 0x60b4, 0x1108, 0x0005, 0x080c, 0x6fb0,
-	0x0126, 0x2091, 0x8000, 0x080c, 0xcb12, 0x080c, 0x6d70, 0x012e,
-	0x0ca0, 0x080c, 0xcf27, 0x1d70, 0x2001, 0x0028, 0x900e, 0x0c70,
-	0x2009, 0x1834, 0x210c, 0x81ff, 0x1188, 0xa888, 0x9005, 0x0188,
-	0xa883, 0x0000, 0x080c, 0x6142, 0x1108, 0x0005, 0xa87a, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x6d70, 0x012e, 0x0cb8, 0x2001, 0x0028,
-	0x0ca8, 0x2001, 0x0000, 0x0c90, 0x2009, 0x1834, 0x210c, 0x81ff,
-	0x11d8, 0xa888, 0x9005, 0x01e0, 0xa883, 0x0000, 0xa87c, 0xd0f4,
-	0x0120, 0x080c, 0x6214, 0x1138, 0x0005, 0x9006, 0xa87a, 0x080c,
-	0x618f, 0x1108, 0x0005, 0x0126, 0x2091, 0x8000, 0xa87a, 0xa982,
-	0x080c, 0x6d70, 0x012e, 0x0cb0, 0x2001, 0x0028, 0x900e, 0x0c98,
-	0x2001, 0x0000, 0x0c80, 0x7018, 0xa802, 0x2908, 0x2048, 0xa906,
-	0x711a, 0x7010, 0x8001, 0x7012, 0x0118, 0x7007, 0x0003, 0x0030,
-	0x7014, 0x2048, 0x7007, 0x0001, 0x7048, 0x080f, 0x0005, 0x00b6,
-	0x7007, 0x0001, 0xa974, 0xa878, 0x9084, 0x00ff, 0x9096, 0x0004,
-	0x0540, 0x20a9, 0x0001, 0x9096, 0x0001, 0x0190, 0x900e, 0x20a9,
-	0x0800, 0x9096, 0x0002, 0x0160, 0x9005, 0x11d8, 0xa974, 0x080c,
-	0x661e, 0x11b8, 0x0066, 0xae80, 0x080c, 0x672e, 0x006e, 0x0088,
-	0x0046, 0x2011, 0x180c, 0x2224, 0xc484, 0x2412, 0x004e, 0x00c6,
-	0x080c, 0x661e, 0x1110, 0x080c, 0x68fd, 0x8108, 0x1f04, 0x7b60,
-	0x00ce, 0xa87c, 0xd084, 0x1120, 0x080c, 0x106c, 0x00be, 0x0005,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x6d70, 0x012e, 0x00be, 0x0005,
-	0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x080c, 0x6a57, 0x0580,
-	0x2061, 0x1a6f, 0x6100, 0xd184, 0x0178, 0xa888, 0x9084, 0x00ff,
-	0x1550, 0x6000, 0xd084, 0x0520, 0x6004, 0x9005, 0x1538, 0x6003,
-	0x0000, 0x600b, 0x0000, 0x00c8, 0x2011, 0x0001, 0xa890, 0x9005,
-	0x1110, 0x2001, 0x001e, 0x8000, 0x6016, 0xa888, 0x9084, 0x00ff,
-	0x0178, 0x6006, 0xa888, 0x8007, 0x9084, 0x00ff, 0x0148, 0x600a,
-	0xa888, 0x8000, 0x1108, 0xc28d, 0x6202, 0x012e, 0x0804, 0x7dba,
-	0x012e, 0x0804, 0x7db4, 0x012e, 0x0804, 0x7dae, 0x012e, 0x0804,
-	0x7db1, 0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x080c, 0x6a57,
-	0x05e0, 0x2061, 0x1a6f, 0x6000, 0xd084, 0x05b8, 0x6204, 0x6308,
-	0xd08c, 0x1530, 0xac78, 0x9484, 0x0003, 0x0170, 0xa988, 0x918c,
-	0x00ff, 0x8001, 0x1120, 0x2100, 0x9210, 0x0620, 0x0028, 0x8001,
-	0x1508, 0x2100, 0x9212, 0x02f0, 0x9484, 0x000c, 0x0188, 0xa988,
-	0x810f, 0x918c, 0x00ff, 0x9082, 0x0004, 0x1120, 0x2100, 0x9318,
-	0x0288, 0x0030, 0x9082, 0x0004, 0x1168, 0x2100, 0x931a, 0x0250,
-	0xa890, 0x9005, 0x0110, 0x8000, 0x6016, 0x6206, 0x630a, 0x012e,
-	0x0804, 0x7dba, 0x012e, 0x0804, 0x7db7, 0x012e, 0x0804, 0x7db4,
-	0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x2061, 0x1a6f, 0x6300,
-	0xd38c, 0x1120, 0x6308, 0x8318, 0x0220, 0x630a, 0x012e, 0x0804,
-	0x7dc8, 0x012e, 0x0804, 0x7db7, 0x00b6, 0x0126, 0x00c6, 0x2091,
-	0x8000, 0x7007, 0x0001, 0xa87c, 0xd0ac, 0x0148, 0x00c6, 0x2061,
-	0x1a6f, 0x6000, 0x9084, 0xfcff, 0x6002, 0x00ce, 0x0440, 0xa888,
-	0x9005, 0x05d8, 0xa88c, 0x9065, 0x0598, 0x2001, 0x1834, 0x2004,
-	0x9005, 0x0118, 0x080c, 0xac04, 0x0068, 0x6017, 0xf400, 0x6063,
-	0x0000, 0xa97c, 0xd1a4, 0x0110, 0xa980, 0x6162, 0x2009, 0x0041,
-	0x080c, 0xac68, 0xa988, 0x918c, 0xff00, 0x9186, 0x2000, 0x1138,
-	0x0026, 0x900e, 0x2011, 0xfdff, 0x080c, 0x88bb, 0x002e, 0xa87c,
-	0xd0c4, 0x0148, 0x2061, 0x1a6f, 0x6000, 0xd08c, 0x1120, 0x6008,
-	0x8000, 0x0208, 0x600a, 0x00ce, 0x012e, 0x00be, 0x0804, 0x7dba,
-	0x00ce, 0x012e, 0x00be, 0x0804, 0x7db4, 0xa984, 0x9186, 0x002e,
-	0x0d30, 0x9186, 0x002d, 0x0d18, 0x9186, 0x0045, 0x0510, 0x9186,
-	0x002a, 0x1130, 0x2001, 0x180c, 0x200c, 0xc194, 0x2102, 0x08b8,
-	0x9186, 0x0020, 0x0158, 0x9186, 0x0029, 0x1d10, 0xa974, 0x080c,
-	0x661e, 0x1968, 0xb800, 0xc0e4, 0xb802, 0x0848, 0xa88c, 0x9065,
-	0x09b8, 0x6007, 0x0024, 0x2001, 0x1986, 0x2004, 0x601a, 0x0804,
-	0x7c4f, 0xa88c, 0x9065, 0x0960, 0x00e6, 0xa890, 0x9075, 0x2001,
-	0x1834, 0x2004, 0x9005, 0x0150, 0x080c, 0xac04, 0x8eff, 0x0118,
-	0x2e60, 0x080c, 0xac04, 0x00ee, 0x0804, 0x7c4f, 0x6024, 0xc0dc,
-	0xc0d5, 0x6026, 0x2e60, 0x6007, 0x003a, 0xa8a0, 0x9005, 0x0130,
-	0x6007, 0x003b, 0xa8a4, 0x602e, 0xa8a8, 0x6016, 0x6003, 0x0001,
-	0x2009, 0x8020, 0x080c, 0x91ed, 0x00ee, 0x0804, 0x7c4f, 0x2061,
-	0x1a6f, 0x6000, 0xd084, 0x0190, 0xd08c, 0x1904, 0x7dc8, 0x0126,
-	0x2091, 0x8000, 0x6204, 0x8210, 0x0220, 0x6206, 0x012e, 0x0804,
-	0x7dc8, 0x012e, 0xa883, 0x0016, 0x0804, 0x7dc1, 0xa883, 0x0007,
-	0x0804, 0x7dc1, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0130, 0x8001,
-	0x1138, 0x7007, 0x0001, 0x0069, 0x0005, 0x080c, 0x794a, 0x0040,
-	0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7cf1,
-	0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0x903e, 0x2061,
-	0x1800, 0x61d0, 0x81ff, 0x1904, 0x7d73, 0x6130, 0xd194, 0x1904,
-	0x7d9d, 0xa878, 0x2070, 0x9e82, 0x1ddc, 0x0a04, 0x7d67, 0x6068,
-	0x9e02, 0x1a04, 0x7d67, 0x7120, 0x9186, 0x0006, 0x1904, 0x7d59,
-	0x7010, 0x905d, 0x0904, 0x7d73, 0xb800, 0xd0e4, 0x1904, 0x7d97,
-	0x2061, 0x1a6f, 0x6100, 0x9184, 0x0301, 0x9086, 0x0001, 0x15a0,
-	0x7024, 0xd0dc, 0x1904, 0x7da0, 0xa883, 0x0000, 0xa803, 0x0000,
-	0x2908, 0x7014, 0x9005, 0x1198, 0x7116, 0xa87c, 0xd0f4, 0x1904,
-	0x7da3, 0x080c, 0x56d3, 0xd09c, 0x1118, 0xa87c, 0xc0cc, 0xa87e,
-	0x2e60, 0x080c, 0x87ae, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2048,
-	0xa800, 0x9005, 0x1de0, 0xa902, 0x2148, 0xa87c, 0xd0f4, 0x1904,
-	0x7da3, 0x012e, 0x00ee, 0x00be, 0x0005, 0x012e, 0x00ee, 0xa883,
-	0x0006, 0x00be, 0x0804, 0x7dc1, 0xd184, 0x0db8, 0xd1c4, 0x1190,
-	0x00a0, 0xa974, 0x080c, 0x661e, 0x15d0, 0xb800, 0xd0e4, 0x15b8,
-	0x7120, 0x9186, 0x0007, 0x1118, 0xa883, 0x0002, 0x0490, 0xa883,
-	0x0008, 0x0478, 0xa883, 0x000e, 0x0460, 0xa883, 0x0017, 0x0448,
-	0xa883, 0x0035, 0x0430, 0x080c, 0x56d7, 0xd0fc, 0x01e8, 0xa878,
-	0x2070, 0x9e82, 0x1ddc, 0x02c0, 0x6068, 0x9e02, 0x12a8, 0x7120,
-	0x9186, 0x0006, 0x1188, 0x7010, 0x905d, 0x0170, 0xb800, 0xd0bc,
-	0x0158, 0x2039, 0x0001, 0x7000, 0x9086, 0x0007, 0x1904, 0x7cfd,
-	0x7003, 0x0002, 0x0804, 0x7cfd, 0xa883, 0x0028, 0x0010, 0xa883,
-	0x0029, 0x012e, 0x00ee, 0x00be, 0x0420, 0xa883, 0x002a, 0x0cc8,
-	0xa883, 0x0045, 0x0cb0, 0x2e60, 0x2019, 0x0002, 0x601b, 0x0014,
-	0x080c, 0xddf2, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2009, 0x003e,
-	0x0058, 0x2009, 0x0004, 0x0040, 0x2009, 0x0006, 0x0028, 0x2009,
-	0x0016, 0x0010, 0x2009, 0x0001, 0xa884, 0x9084, 0xff00, 0x9105,
-	0xa886, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d70, 0x012e, 0x0005,
-	0x080c, 0x106c, 0x0005, 0x00d6, 0x080c, 0x87a5, 0x00de, 0x0005,
-	0x00d6, 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0x0040, 0x702c,
-	0xd084, 0x01d8, 0x908c, 0x0780, 0x190c, 0x7eb2, 0xd09c, 0x11a8,
-	0x2071, 0x1800, 0x70c0, 0x90ea, 0x0020, 0x0278, 0x8001, 0x70c2,
-	0x702c, 0x2048, 0xa800, 0x702e, 0x9006, 0xa802, 0xa806, 0x2071,
-	0x0040, 0x2900, 0x7022, 0x702c, 0x0c28, 0x012e, 0x00ee, 0x00de,
-	0x0005, 0x0006, 0x9084, 0x0780, 0x190c, 0x7eb2, 0x000e, 0x0005,
-	0xa898, 0x9084, 0x0003, 0x05a8, 0x080c, 0xab73, 0x05d8, 0x2900,
-	0x6016, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0035, 0x1138, 0x6028,
-	0xc0fd, 0x602a, 0x2001, 0x196b, 0x2004, 0x0098, 0xa8a0, 0x9084,
-	0x00ff, 0xa99c, 0x918c, 0xff00, 0x9105, 0xa99c, 0x918c, 0x00ff,
-	0x080c, 0x25fb, 0x1540, 0x00b6, 0x080c, 0x661e, 0x2b00, 0x00be,
-	0x1510, 0x6012, 0x6023, 0x0001, 0x2009, 0x0040, 0xa864, 0x9084,
-	0x00ff, 0x9086, 0x0035, 0x0110, 0x2009, 0x0041, 0x080c, 0xac68,
-	0x0005, 0xa87b, 0x0101, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d70,
-	0x012e, 0x0005, 0xa87b, 0x002c, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6d70, 0x012e, 0x0005, 0xa87b, 0x0028, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x6d70, 0x012e, 0x080c, 0xabc9, 0x0005, 0x00d6, 0x00c6,
-	0x0036, 0x0026, 0x0016, 0x00b6, 0x7007, 0x0001, 0xaa74, 0x9282,
-	0x0004, 0x1a04, 0x7ea3, 0xa97c, 0x9188, 0x1000, 0x2104, 0x905d,
-	0xb804, 0xd284, 0x0140, 0x05e8, 0x8007, 0x9084, 0x00ff, 0x9084,
-	0x0006, 0x1108, 0x04b0, 0x2b10, 0x080c, 0xab73, 0x1118, 0x080c,
-	0xac3b, 0x05a8, 0x6212, 0xa874, 0x0002, 0x7e81, 0x7e86, 0x7e89,
-	0x7e8f, 0x2019, 0x0002, 0x080c, 0xe20e, 0x0060, 0x080c, 0xe19e,
-	0x0048, 0x2019, 0x0002, 0xa980, 0x080c, 0xe1bd, 0x0018, 0xa980,
-	0x080c, 0xe19e, 0x080c, 0xabc9, 0xa887, 0x0000, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x6d70, 0x012e, 0x00be, 0x001e, 0x002e, 0x003e,
-	0x00ce, 0x00de, 0x0005, 0xa887, 0x0006, 0x0c80, 0xa887, 0x0002,
-	0x0c68, 0xa887, 0x0005, 0x0c50, 0xa887, 0x0004, 0x0c38, 0xa887,
-	0x0007, 0x0c20, 0x2091, 0x8000, 0x0e04, 0x7eb4, 0x0006, 0x0016,
-	0x2001, 0x8003, 0x0006, 0x0804, 0x0d86, 0x2001, 0x1834, 0x2004,
-	0x9005, 0x0005, 0x0005, 0x00f6, 0x2079, 0x0300, 0x2001, 0x0200,
-	0x200c, 0xc1e5, 0xc1dc, 0x2102, 0x2009, 0x0218, 0x210c, 0xd1ec,
-	0x1120, 0x080c, 0x1608, 0x00fe, 0x0005, 0x2001, 0x020d, 0x2003,
-	0x0020, 0x781f, 0x0300, 0x00fe, 0x0005, 0x781c, 0xd08c, 0x0904,
-	0x7f35, 0x68c0, 0x90aa, 0x0005, 0x0a04, 0x8519, 0x7d44, 0x7c40,
-	0xd59c, 0x190c, 0x0d7d, 0x9584, 0x00f6, 0x1508, 0x9484, 0x7000,
-	0x0138, 0x908a, 0x2000, 0x1258, 0x9584, 0x0700, 0x8007, 0x04f0,
-	0x7000, 0x9084, 0xff00, 0x9086, 0x8100, 0x0db0, 0x00b0, 0x9484,
-	0x0fff, 0x1130, 0x7000, 0x9084, 0xff00, 0x9086, 0x8100, 0x11c0,
-	0x080c, 0xe6af, 0x080c, 0x8410, 0x7817, 0x0140, 0x00a8, 0x9584,
-	0x0076, 0x1118, 0x080c, 0x846c, 0x19c8, 0xd5a4, 0x0148, 0x0046,
-	0x0056, 0x080c, 0x7f85, 0x080c, 0x2115, 0x005e, 0x004e, 0x0020,
-	0x080c, 0xe6af, 0x7817, 0x0140, 0x080c, 0x74d5, 0x0168, 0x2001,
-	0x0111, 0x2004, 0xd08c, 0x0140, 0x6893, 0x0000, 0x2001, 0x0110,
-	0x2003, 0x0008, 0x2003, 0x0000, 0x0489, 0x0005, 0x0002, 0x7f42,
-	0x8232, 0x7f3f, 0x7f3f, 0x7f3f, 0x7f3f, 0x7f3f, 0x7f3f, 0x7817,
-	0x0140, 0x0005, 0x7000, 0x908c, 0xff00, 0x9194, 0xf000, 0x810f,
-	0x9484, 0x0fff, 0x6892, 0x9286, 0x2000, 0x1150, 0x6800, 0x9086,
-	0x0001, 0x1118, 0x080c, 0x5734, 0x0070, 0x080c, 0x7fa5, 0x0058,
-	0x9286, 0x3000, 0x1118, 0x080c, 0x816f, 0x0028, 0x9286, 0x8000,
-	0x1110, 0x080c, 0x8346, 0x7817, 0x0140, 0x0005, 0x2001, 0x1810,
-	0x2004, 0xd08c, 0x0178, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003,
-	0x1148, 0x0026, 0x0036, 0x2011, 0x8048, 0x2518, 0x080c, 0x4b00,
-	0x003e, 0x002e, 0x0005, 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079,
-	0x0200, 0x2019, 0xfffe, 0x7c30, 0x0050, 0x0036, 0x0046, 0x0056,
-	0x00f6, 0x2079, 0x0200, 0x7d44, 0x7c40, 0x2019, 0xffff, 0x2001,
-	0x1810, 0x2004, 0xd08c, 0x0160, 0x2001, 0x1800, 0x2004, 0x9086,
-	0x0003, 0x1130, 0x0026, 0x2011, 0x8048, 0x080c, 0x4b00, 0x002e,
-	0x00fe, 0x005e, 0x004e, 0x003e, 0x0005, 0x00b6, 0x00c6, 0x7010,
-	0x9084, 0xff00, 0x8007, 0x9096, 0x0001, 0x0120, 0x9096, 0x0023,
-	0x1904, 0x8140, 0x9186, 0x0023, 0x15c0, 0x080c, 0x83db, 0x0904,
-	0x8140, 0x6120, 0x9186, 0x0001, 0x0150, 0x9186, 0x0004, 0x0138,
-	0x9186, 0x0008, 0x0120, 0x9186, 0x000a, 0x1904, 0x8140, 0x7124,
-	0x610a, 0x7030, 0x908e, 0x0200, 0x1130, 0x2009, 0x0015, 0x080c,
-	0xac68, 0x0804, 0x8140, 0x908e, 0x0214, 0x0118, 0x908e, 0x0210,
-	0x1130, 0x2009, 0x0015, 0x080c, 0xac68, 0x0804, 0x8140, 0x908e,
-	0x0100, 0x1904, 0x8140, 0x7034, 0x9005, 0x1904, 0x8140, 0x2009,
-	0x0016, 0x080c, 0xac68, 0x0804, 0x8140, 0x9186, 0x0022, 0x1904,
-	0x8140, 0x7030, 0x908e, 0x0300, 0x1580, 0x68dc, 0xd0a4, 0x0528,
-	0xc0b5, 0x68de, 0x7100, 0x918c, 0x00ff, 0x697e, 0x7004, 0x6882,
-	0x00f6, 0x2079, 0x0100, 0x79e6, 0x78ea, 0x0006, 0x9084, 0x00ff,
-	0x0016, 0x2008, 0x080c, 0x2644, 0x7932, 0x7936, 0x001e, 0x000e,
-	0x00fe, 0x080c, 0x25fb, 0x695e, 0x703c, 0x00e6, 0x2071, 0x0140,
-	0x7086, 0x2071, 0x1800, 0x70b6, 0x00ee, 0x7034, 0x9005, 0x1904,
-	0x8140, 0x2009, 0x0017, 0x0804, 0x810d, 0x908e, 0x0400, 0x1190,
-	0x7034, 0x9005, 0x1904, 0x8140, 0x080c, 0x74d5, 0x0120, 0x2009,
-	0x001d, 0x0804, 0x810d, 0x68dc, 0xc0a5, 0x68de, 0x2009, 0x0030,
-	0x0804, 0x810d, 0x908e, 0x0500, 0x1140, 0x7034, 0x9005, 0x1904,
-	0x8140, 0x2009, 0x0018, 0x0804, 0x810d, 0x908e, 0x2010, 0x1120,
-	0x2009, 0x0019, 0x0804, 0x810d, 0x908e, 0x2110, 0x1120, 0x2009,
-	0x001a, 0x0804, 0x810d, 0x908e, 0x5200, 0x1140, 0x7034, 0x9005,
-	0x1904, 0x8140, 0x2009, 0x001b, 0x0804, 0x810d, 0x908e, 0x5000,
-	0x1140, 0x7034, 0x9005, 0x1904, 0x8140, 0x2009, 0x001c, 0x0804,
-	0x810d, 0x908e, 0x1300, 0x1120, 0x2009, 0x0034, 0x0804, 0x810d,
-	0x908e, 0x1200, 0x1140, 0x7034, 0x9005, 0x1904, 0x8140, 0x2009,
-	0x0024, 0x0804, 0x810d, 0x908c, 0xff00, 0x918e, 0x2400, 0x1170,
-	0x2009, 0x002d, 0x2001, 0x1810, 0x2004, 0xd09c, 0x0904, 0x810d,
-	0x080c, 0xd62a, 0x1904, 0x8140, 0x0804, 0x810b, 0x908c, 0xff00,
-	0x918e, 0x5300, 0x1120, 0x2009, 0x002a, 0x0804, 0x810d, 0x908e,
-	0x0f00, 0x1120, 0x2009, 0x0020, 0x0804, 0x810d, 0x908e, 0x6104,
-	0x1530, 0x2029, 0x0205, 0x2011, 0x026d, 0x8208, 0x2204, 0x9082,
-	0x0004, 0x8004, 0x8004, 0x20a8, 0x2011, 0x8015, 0x211c, 0x8108,
-	0x0046, 0x2124, 0x080c, 0x4b00, 0x004e, 0x8108, 0x0f04, 0x80c1,
-	0x9186, 0x0280, 0x1d88, 0x2504, 0x8000, 0x202a, 0x2009, 0x0260,
-	0x0c58, 0x202b, 0x0000, 0x2009, 0x0023, 0x0804, 0x810d, 0x908e,
-	0x6000, 0x1120, 0x2009, 0x003f, 0x0804, 0x810d, 0x908e, 0x5400,
-	0x1138, 0x080c, 0x84c9, 0x1904, 0x8140, 0x2009, 0x0046, 0x04a8,
-	0x908e, 0x5500, 0x1148, 0x080c, 0x84f1, 0x1118, 0x2009, 0x0041,
-	0x0460, 0x2009, 0x0042, 0x0448, 0x908e, 0x7800, 0x1118, 0x2009,
-	0x0045, 0x0418, 0x908e, 0x1000, 0x1118, 0x2009, 0x004e, 0x00e8,
-	0x908e, 0x6300, 0x1118, 0x2009, 0x004a, 0x00b8, 0x908c, 0xff00,
-	0x918e, 0x5600, 0x1118, 0x2009, 0x004f, 0x0078, 0x908c, 0xff00,
-	0x918e, 0x5700, 0x1118, 0x2009, 0x0050, 0x0038, 0x2009, 0x001d,
-	0x6838, 0xd0d4, 0x0110, 0x2009, 0x004c, 0x0016, 0x2011, 0x0263,
-	0x2204, 0x8211, 0x220c, 0x080c, 0x25fb, 0x1568, 0x080c, 0x65bd,
-	0x1550, 0xbe12, 0xbd16, 0x001e, 0x0016, 0xb884, 0x9005, 0x1168,
-	0x9186, 0x0046, 0x1150, 0x687c, 0x9606, 0x1138, 0x6880, 0x9506,
-	0x9084, 0xff00, 0x1110, 0x001e, 0x0098, 0x080c, 0xab73, 0x01a8,
-	0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x9186,
-	0x004c, 0x1110, 0x6023, 0x000a, 0x0016, 0x001e, 0x080c, 0xac68,
-	0x00ce, 0x00be, 0x0005, 0x001e, 0x0cd8, 0x2001, 0x180e, 0x2004,
-	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4b00, 0x080c, 0xac3b,
-	0x0d90, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e,
-	0x0016, 0x9186, 0x0017, 0x0118, 0x9186, 0x0030, 0x1128, 0x6007,
-	0x0009, 0x6017, 0x2900, 0x0020, 0x6007, 0x0051, 0x6017, 0x0000,
-	0x602f, 0x0009, 0x6003, 0x0001, 0x080c, 0x91f4, 0x08a0, 0x080c,
-	0x332b, 0x1140, 0x7010, 0x9084, 0xff00, 0x8007, 0x908e, 0x0008,
-	0x1108, 0x0009, 0x0005, 0x00b6, 0x00c6, 0x0046, 0x7000, 0x908c,
-	0xff00, 0x810f, 0x9186, 0x0033, 0x11e8, 0x080c, 0x83db, 0x0904,
-	0x81ca, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200, 0x1140, 0x7034,
-	0x9005, 0x15c0, 0x2009, 0x0015, 0x080c, 0xac68, 0x0498, 0x908e,
-	0x0100, 0x1580, 0x7034, 0x9005, 0x1568, 0x2009, 0x0016, 0x080c,
-	0xac68, 0x0440, 0x9186, 0x0032, 0x1528, 0x7030, 0x908e, 0x1400,
-	0x1508, 0x2009, 0x0038, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211,
-	0x220c, 0x080c, 0x25fb, 0x11a8, 0x080c, 0x65bd, 0x1190, 0xbe12,
-	0xbd16, 0x080c, 0xab73, 0x0168, 0x2b08, 0x6112, 0x080c, 0xcca8,
-	0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x080c, 0xac68, 0x0010,
-	0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be, 0x0005, 0x00b6, 0x0046,
-	0x00e6, 0x00d6, 0x2028, 0x2130, 0x9696, 0x00ff, 0x11b8, 0x9592,
-	0xfffc, 0x02a0, 0x9596, 0xfffd, 0x1120, 0x2009, 0x007f, 0x0804,
-	0x822c, 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e, 0x0804, 0x822c,
-	0x9596, 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0, 0x2011, 0x0000,
-	0x2019, 0x1837, 0x231c, 0xd3ac, 0x0130, 0x9026, 0x20a9, 0x0800,
-	0x2071, 0x1000, 0x0030, 0x2021, 0x0081, 0x20a9, 0x077f, 0x2071,
-	0x1081, 0x2e1c, 0x93dd, 0x0000, 0x1140, 0x82ff, 0x11d0, 0x9496,
-	0x00ff, 0x01b8, 0x2410, 0xc2fd, 0x00a0, 0xbf10, 0x2600, 0x9706,
-	0xb814, 0x1120, 0x9546, 0x1110, 0x2408, 0x00b0, 0x9745, 0x1148,
-	0x94c6, 0x007e, 0x0130, 0x94c6, 0x007f, 0x0118, 0x94c6, 0x0080,
-	0x1d20, 0x8420, 0x8e70, 0x1f04, 0x8201, 0x82ff, 0x1118, 0x9085,
-	0x0001, 0x0018, 0xc2fc, 0x2208, 0x9006, 0x00de, 0x00ee, 0x004e,
-	0x00be, 0x0005, 0x7000, 0x908c, 0xff00, 0x810f, 0x9184, 0x000f,
-	0x0002, 0x8249, 0x8249, 0x8249, 0x83ed, 0x8249, 0x824c, 0x8271,
-	0x82fa, 0x8249, 0x8249, 0x8249, 0x8249, 0x8249, 0x8249, 0x8249,
-	0x8249, 0x7817, 0x0140, 0x0005, 0x00b6, 0x7110, 0xd1bc, 0x01e8,
-	0x7120, 0x2160, 0x9c8c, 0x0003, 0x11c0, 0x9c8a, 0x1ddc, 0x02a8,
-	0x6868, 0x9c02, 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158,
-	0xb910, 0x9106, 0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124,
-	0x610a, 0x2009, 0x0046, 0x080c, 0xac68, 0x7817, 0x0140, 0x00be,
-	0x0005, 0x00b6, 0x00c6, 0x9484, 0x0fff, 0x0904, 0x82d6, 0x7110,
-	0xd1bc, 0x1904, 0x82d6, 0x7108, 0x700c, 0x2028, 0x918c, 0x00ff,
-	0x2130, 0x9094, 0xff00, 0x15c8, 0x81ff, 0x15b8, 0x9080, 0x336d,
-	0x200d, 0x918c, 0xff00, 0x810f, 0x2001, 0x0080, 0x9106, 0x0904,
-	0x82d6, 0x9182, 0x0801, 0x1a04, 0x82d6, 0x9190, 0x1000, 0x2204,
-	0x905d, 0x05e0, 0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15b8, 0xba04,
-	0x9294, 0xff00, 0x9286, 0x0600, 0x1190, 0x080c, 0xab73, 0x0598,
-	0x2b08, 0x7028, 0x6052, 0x702c, 0x604e, 0x6112, 0x6023, 0x0006,
-	0x7120, 0x610a, 0x7130, 0x615e, 0x080c, 0xd88c, 0x00f8, 0x080c,
-	0x6a5b, 0x1138, 0xb807, 0x0606, 0x0c40, 0x190c, 0x81ce, 0x11b0,
-	0x0880, 0x080c, 0xab73, 0x2b08, 0x0188, 0x6112, 0x6023, 0x0004,
-	0x7120, 0x610a, 0x9286, 0x0400, 0x1118, 0x6007, 0x0005, 0x0010,
-	0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x91f4, 0x7817, 0x0140,
-	0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0ec, 0x0120,
-	0x2011, 0x8049, 0x080c, 0x4b00, 0x080c, 0xac3b, 0x0d78, 0x2b08,
-	0x6112, 0x6023, 0x0006, 0x7120, 0x610a, 0x7130, 0x615e, 0x6017,
-	0xf300, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c,
-	0x91ed, 0x08e0, 0x00b6, 0x7110, 0xd1bc, 0x05d0, 0x7020, 0x2060,
-	0x9c84, 0x0003, 0x15a8, 0x9c82, 0x1ddc, 0x0690, 0x6868, 0x9c02,
-	0x1678, 0x9484, 0x0fff, 0x9082, 0x000c, 0x0650, 0x7008, 0x9084,
-	0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1510, 0x700c, 0xb914,
-	0x9106, 0x11f0, 0x7124, 0x610a, 0x601c, 0xd0fc, 0x11c8, 0x2001,
-	0x0271, 0x2004, 0x9005, 0x1180, 0x9484, 0x0fff, 0x9082, 0x000c,
-	0x0158, 0x0066, 0x2031, 0x0100, 0xa001, 0xa001, 0x8631, 0x1de0,
-	0x006e, 0x601c, 0xd0fc, 0x1120, 0x2009, 0x0045, 0x080c, 0xac68,
-	0x7817, 0x0140, 0x00be, 0x0005, 0x6120, 0x9186, 0x0002, 0x0128,
-	0x9186, 0x0005, 0x0110, 0x9085, 0x0001, 0x0005, 0x080c, 0x332b,
-	0x1168, 0x7010, 0x9084, 0xff00, 0x8007, 0x9086, 0x0000, 0x1130,
-	0x9184, 0x000f, 0x908a, 0x0006, 0x1208, 0x000b, 0x0005, 0x835d,
-	0x835e, 0x835d, 0x835d, 0x83bd, 0x83cc, 0x0005, 0x00b6, 0x7110,
-	0xd1bc, 0x0120, 0x702c, 0xd084, 0x0904, 0x83bb, 0x700c, 0x7108,
-	0x080c, 0x25fb, 0x1904, 0x83bb, 0x080c, 0x65bd, 0x1904, 0x83bb,
-	0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x01d8, 0x080c, 0x6a5b, 0x0118,
-	0x9086, 0x0004, 0x1588, 0x00c6, 0x080c, 0x83db, 0x00ce, 0x05d8,
-	0x080c, 0xab73, 0x2b08, 0x05b8, 0x6112, 0x080c, 0xcca8, 0x6023,
-	0x0002, 0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0xac68, 0x0458,
-	0x080c, 0x6a5b, 0x0148, 0x9086, 0x0004, 0x0130, 0x080c, 0x6a63,
-	0x0118, 0x9086, 0x0004, 0x1180, 0x080c, 0xab73, 0x2b08, 0x01d8,
-	0x6112, 0x080c, 0xcca8, 0x6023, 0x0005, 0x7120, 0x610a, 0x2009,
-	0x0088, 0x080c, 0xac68, 0x0078, 0x080c, 0xab73, 0x2b08, 0x0158,
-	0x6112, 0x080c, 0xcca8, 0x6023, 0x0004, 0x7120, 0x610a, 0x2009,
-	0x0001, 0x080c, 0xac68, 0x00be, 0x0005, 0x7110, 0xd1bc, 0x0158,
-	0x00d1, 0x0148, 0x080c, 0x833c, 0x1130, 0x7124, 0x610a, 0x2009,
-	0x0089, 0x080c, 0xac68, 0x0005, 0x7110, 0xd1bc, 0x0158, 0x0059,
-	0x0148, 0x080c, 0x833c, 0x1130, 0x7124, 0x610a, 0x2009, 0x008a,
-	0x080c, 0xac68, 0x0005, 0x7020, 0x2060, 0x9c84, 0x0003, 0x1158,
-	0x9c82, 0x1ddc, 0x0240, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1218,
-	0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x00b6, 0x7110, 0xd1bc,
-	0x11d8, 0x7024, 0x2060, 0x9c84, 0x0003, 0x11b0, 0x9c82, 0x1ddc,
-	0x0298, 0x6868, 0x9c02, 0x1280, 0x7008, 0x9084, 0x00ff, 0x6110,
-	0x2158, 0xb910, 0x9106, 0x1140, 0x700c, 0xb914, 0x9106, 0x1120,
-	0x2009, 0x0051, 0x080c, 0xac68, 0x7817, 0x0140, 0x00be, 0x0005,
-	0x2031, 0x0105, 0x0069, 0x0005, 0x2031, 0x0206, 0x0049, 0x0005,
-	0x2031, 0x0207, 0x0029, 0x0005, 0x2031, 0x0213, 0x0009, 0x0005,
-	0x00c6, 0x0096, 0x00f6, 0x7000, 0x9084, 0xf000, 0x9086, 0xc000,
-	0x05c0, 0x080c, 0xab73, 0x05a8, 0x0066, 0x00c6, 0x0046, 0x2011,
-	0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x25fb, 0x1590, 0x080c,
-	0x65bd, 0x1578, 0xbe12, 0xbd16, 0x2b00, 0x004e, 0x00ce, 0x6012,
-	0x080c, 0xcca8, 0x080c, 0x103a, 0x0500, 0x2900, 0x6062, 0x9006,
-	0xa802, 0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b, 0x20a9, 0x000e,
-	0xa860, 0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98, 0x4003, 0x006e,
-	0x6616, 0x6007, 0x003e, 0x6023, 0x0001, 0x6003, 0x0001, 0x080c,
-	0x91f4, 0x00fe, 0x009e, 0x00ce, 0x0005, 0x080c, 0xabc9, 0x006e,
-	0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6, 0x7000, 0x908c, 0xff00,
-	0x9184, 0xf000, 0x810f, 0x9086, 0x2000, 0x1904, 0x84c3, 0x9186,
-	0x0022, 0x15f0, 0x2001, 0x0111, 0x2004, 0x9005, 0x1904, 0x84c5,
-	0x7030, 0x908e, 0x0400, 0x0904, 0x84c5, 0x908e, 0x6000, 0x05e8,
-	0x908e, 0x5400, 0x05d0, 0x908e, 0x0300, 0x11d8, 0x2009, 0x1837,
-	0x210c, 0xd18c, 0x1590, 0xd1a4, 0x1580, 0x080c, 0x6a19, 0x0558,
-	0x68b0, 0x9084, 0x00ff, 0x7100, 0x918c, 0x00ff, 0x9106, 0x1518,
-	0x6880, 0x69b0, 0x918c, 0xff00, 0x9105, 0x7104, 0x9106, 0x11d8,
-	0x00e0, 0x2009, 0x0103, 0x210c, 0xd1b4, 0x11a8, 0x908e, 0x5200,
-	0x09e8, 0x908e, 0x0500, 0x09d0, 0x908e, 0x5000, 0x09b8, 0x0058,
-	0x9186, 0x0023, 0x1140, 0x080c, 0x83db, 0x0128, 0x6004, 0x9086,
-	0x0002, 0x0118, 0x0000, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce,
-	0x0005, 0x0156, 0x0046, 0x0016, 0x0036, 0x7038, 0x2020, 0x8427,
-	0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004, 0x2019, 0x1805,
-	0x2011, 0x027a, 0x080c, 0xbb8a, 0x1178, 0xd48c, 0x0148, 0x20a9,
-	0x0004, 0x2019, 0x1801, 0x2011, 0x027e, 0x080c, 0xbb8a, 0x1120,
-	0xd494, 0x0110, 0x9085, 0x0001, 0x003e, 0x001e, 0x004e, 0x015e,
-	0x0005, 0x0156, 0x0046, 0x0016, 0x0036, 0x7038, 0x2020, 0x8427,
-	0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004, 0x2019, 0x1805,
-	0x2011, 0x0272, 0x080c, 0xbb8a, 0x1178, 0xd48c, 0x0148, 0x20a9,
-	0x0004, 0x2019, 0x1801, 0x2011, 0x0276, 0x080c, 0xbb8a, 0x1120,
-	0xd494, 0x0110, 0x9085, 0x0001, 0x003e, 0x001e, 0x004e, 0x015e,
-	0x0005, 0x00f6, 0x2079, 0x0200, 0x7800, 0xc0e5, 0xc0cc, 0x7802,
-	0x00fe, 0x0005, 0x00f6, 0x2079, 0x1800, 0x7834, 0xd084, 0x1130,
-	0x2079, 0x0200, 0x7800, 0x9085, 0x1200, 0x7802, 0x00fe, 0x0005,
-	0x00e6, 0x2071, 0x1800, 0x7034, 0xc084, 0x7036, 0x00ee, 0x0005,
-	0x2071, 0x1a03, 0x7003, 0x0003, 0x700f, 0x0361, 0x9006, 0x701a,
-	0x7072, 0x7012, 0x7017, 0x1ddc, 0x7007, 0x0000, 0x7026, 0x702b,
-	0x9e30, 0x7032, 0x7037, 0x9ead, 0x703f, 0xffff, 0x7042, 0x7047,
-	0x556a, 0x704a, 0x705b, 0x86e0, 0x080c, 0x1053, 0x090c, 0x0d7d,
-	0x2900, 0x703a, 0xa867, 0x0003, 0xa86f, 0x0100, 0xa8ab, 0xdcb0,
-	0x0005, 0x2071, 0x1a03, 0x1d04, 0x85fc, 0x2091, 0x6000, 0x700c,
-	0x8001, 0x700e, 0x1590, 0x2001, 0x013c, 0x2004, 0x9005, 0x190c,
-	0x878a, 0x2001, 0x1869, 0x2004, 0xd0c4, 0x0158, 0x3a00, 0xd08c,
-	0x1140, 0x20d1, 0x0000, 0x20d1, 0x0001, 0x20d1, 0x0000, 0x080c,
-	0x0d7d, 0x700f, 0x0361, 0x7007, 0x0001, 0x0126, 0x2091, 0x8000,
-	0x2069, 0x1800, 0x69ec, 0xd1e4, 0x1138, 0xd1dc, 0x1118, 0x080c,
-	0x874e, 0x0010, 0x080c, 0x8725, 0x7040, 0x900d, 0x0148, 0x8109,
-	0x7142, 0x1130, 0x7044, 0x080f, 0x0018, 0x0126, 0x2091, 0x8000,
-	0x7024, 0x900d, 0x0188, 0x7020, 0x8001, 0x7022, 0x1168, 0x7023,
-	0x0009, 0x8109, 0x7126, 0x9186, 0x03e8, 0x1110, 0x7028, 0x080f,
-	0x81ff, 0x1110, 0x7028, 0x080f, 0x7030, 0x900d, 0x0180, 0x702c,
-	0x8001, 0x702e, 0x1160, 0x702f, 0x0009, 0x8109, 0x7132, 0x0128,
-	0x9184, 0x007f, 0x090c, 0x9f49, 0x0010, 0x7034, 0x080f, 0x703c,
-	0x9005, 0x0118, 0x0310, 0x8001, 0x703e, 0x704c, 0x900d, 0x0168,
-	0x7048, 0x8001, 0x704a, 0x1148, 0x704b, 0x0009, 0x8109, 0x714e,
-	0x1120, 0x7150, 0x714e, 0x7058, 0x080f, 0x7018, 0x900d, 0x01d8,
-	0x0016, 0x7070, 0x900d, 0x0158, 0x706c, 0x8001, 0x706e, 0x1138,
-	0x706f, 0x0009, 0x8109, 0x7172, 0x1110, 0x7074, 0x080f, 0x001e,
-	0x7008, 0x8001, 0x700a, 0x1138, 0x700b, 0x0009, 0x8109, 0x711a,
-	0x1110, 0x701c, 0x080f, 0x012e, 0x7004, 0x0002, 0x8624, 0x8625,
-	0x864f, 0x00e6, 0x2071, 0x1a03, 0x7018, 0x9005, 0x1120, 0x711a,
-	0x721e, 0x700b, 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071,
-	0x1a03, 0x701c, 0x9206, 0x1120, 0x701a, 0x701e, 0x7072, 0x7076,
-	0x000e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1a03, 0xb888, 0x9102,
-	0x0208, 0xb98a, 0x00ee, 0x0005, 0x0005, 0x00b6, 0x2031, 0x0010,
-	0x7110, 0x080c, 0x661e, 0x11a8, 0xb888, 0x8001, 0x0290, 0xb88a,
-	0x1180, 0x0126, 0x2091, 0x8000, 0x0066, 0xb8d0, 0x9005, 0x0138,
-	0x0026, 0xba3c, 0x0016, 0x080c, 0x6749, 0x001e, 0x002e, 0x006e,
-	0x012e, 0x8108, 0x9182, 0x0800, 0x1220, 0x8631, 0x0128, 0x7112,
-	0x0c00, 0x900e, 0x7007, 0x0002, 0x7112, 0x00be, 0x0005, 0x2031,
-	0x0010, 0x7014, 0x2060, 0x0126, 0x2091, 0x8000, 0x6048, 0x9005,
-	0x0128, 0x8001, 0x604a, 0x1110, 0x080c, 0xcb29, 0x6018, 0x9005,
-	0x0904, 0x86a7, 0x00f6, 0x2079, 0x0300, 0x7918, 0xd1b4, 0x1904,
-	0x86ba, 0x781b, 0x2020, 0xa001, 0x7918, 0xd1b4, 0x0120, 0x781b,
-	0x2000, 0x0804, 0x86ba, 0x8001, 0x601a, 0x0106, 0x781b, 0x2000,
-	0xa001, 0x7918, 0xd1ac, 0x1dd0, 0x010e, 0x00fe, 0x1540, 0x6120,
-	0x9186, 0x0003, 0x0148, 0x9186, 0x0006, 0x0130, 0x9186, 0x0009,
-	0x11e0, 0x611c, 0xd1c4, 0x1100, 0x080c, 0xc814, 0x01b0, 0x6014,
-	0x2048, 0xa884, 0x908a, 0x199a, 0x0280, 0x9082, 0x1999, 0xa886,
-	0x908a, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003, 0x800b, 0x810b,
-	0x9108, 0x611a, 0x080c, 0xcf5a, 0x0110, 0x080c, 0xc512, 0x012e,
-	0x9c88, 0x001c, 0x7116, 0x2001, 0x181a, 0x2004, 0x9102, 0x1228,
-	0x8631, 0x0138, 0x2160, 0x0804, 0x8653, 0x7017, 0x1ddc, 0x7007,
-	0x0000, 0x0005, 0x00fe, 0x0c58, 0x00e6, 0x2071, 0x1a03, 0x7027,
-	0x07d0, 0x7023, 0x0009, 0x00ee, 0x0005, 0x2001, 0x1a0c, 0x2003,
-	0x0000, 0x0005, 0x00e6, 0x2071, 0x1a03, 0x7132, 0x702f, 0x0009,
-	0x00ee, 0x0005, 0x2011, 0x1a0f, 0x2013, 0x0000, 0x0005, 0x00e6,
-	0x2071, 0x1a03, 0x711a, 0x721e, 0x700b, 0x0009, 0x00ee, 0x0005,
-	0x0086, 0x0026, 0x7054, 0x8000, 0x7056, 0x2001, 0x1a11, 0x2044,
-	0xa06c, 0x9086, 0x0000, 0x0150, 0x7068, 0xa09a, 0x7064, 0xa096,
-	0x7060, 0xa092, 0x705c, 0xa08e, 0x080c, 0x1124, 0x002e, 0x008e,
-	0x0005, 0x0006, 0x0016, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6,
-	0x00e6, 0x00f6, 0x0156, 0x080c, 0x8561, 0x015e, 0x00fe, 0x00ee,
-	0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x001e, 0x000e, 0x0005,
-	0x00e6, 0x2071, 0x1a03, 0x7172, 0x7276, 0x706f, 0x0009, 0x00ee,
-	0x0005, 0x00e6, 0x0006, 0x2071, 0x1a03, 0x7074, 0x9206, 0x1110,
-	0x7072, 0x7076, 0x000e, 0x00ee, 0x0005, 0x2069, 0x1800, 0x69ec,
-	0xd1e4, 0x1518, 0x0026, 0xd1ec, 0x0140, 0x6a54, 0x6874, 0x9202,
-	0x0288, 0x8117, 0x9294, 0x00c1, 0x0088, 0x9184, 0x0007, 0x01a0,
-	0x8109, 0x9184, 0x0007, 0x0110, 0x69ee, 0x0070, 0x8107, 0x9084,
-	0x0007, 0x910d, 0x8107, 0x9106, 0x9094, 0x00c1, 0x9184, 0xff3e,
-	0x9205, 0x68ee, 0x080c, 0x0f05, 0x002e, 0x0005, 0x69e8, 0x9184,
-	0x003f, 0x05b8, 0x8109, 0x9184, 0x003f, 0x01a8, 0x6a54, 0x6874,
-	0x9202, 0x0220, 0xd1bc, 0x0168, 0xc1bc, 0x0018, 0xd1bc, 0x1148,
-	0xc1bd, 0x2110, 0x00e6, 0x2071, 0x1800, 0x080c, 0x0f27, 0x00ee,
-	0x0400, 0x69ea, 0x00f0, 0x0026, 0x8107, 0x9094, 0x0007, 0x0128,
-	0x8001, 0x8007, 0x9085, 0x0007, 0x0050, 0x2010, 0x8004, 0x8004,
-	0x8004, 0x9084, 0x0007, 0x9205, 0x8007, 0x9085, 0x0028, 0x9086,
-	0x0040, 0x2010, 0x00e6, 0x2071, 0x1800, 0x080c, 0x0f27, 0x00ee,
-	0x002e, 0x0005, 0x0016, 0x00c6, 0x2009, 0xfffc, 0x210d, 0x2061,
-	0x0100, 0x60f0, 0x9100, 0x60f3, 0x0000, 0x2009, 0xfffc, 0x200f,
-	0x1220, 0x8108, 0x2105, 0x8000, 0x200f, 0x00ce, 0x001e, 0x0005,
-	0x00c6, 0x2061, 0x1a6f, 0x00ce, 0x0005, 0x9184, 0x000f, 0x8003,
-	0x8003, 0x8003, 0x9080, 0x1a6f, 0x2060, 0x0005, 0xa884, 0x908a,
-	0x199a, 0x1638, 0x9005, 0x1150, 0x00c6, 0x2061, 0x1a6f, 0x6014,
-	0x00ce, 0x9005, 0x1130, 0x2001, 0x001e, 0x0018, 0x908e, 0xffff,
-	0x01b0, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0xa87c, 0x908c,
-	0x00c0, 0x918e, 0x00c0, 0x0904, 0x8865, 0xd0b4, 0x1168, 0xd0bc,
-	0x1904, 0x883e, 0x2009, 0x0006, 0x080c, 0x8892, 0x0005, 0x900e,
-	0x0c60, 0x2001, 0x1999, 0x08b0, 0xd0fc, 0x05c8, 0x908c, 0x2023,
-	0x1550, 0x87ff, 0x1540, 0x6124, 0x918c, 0x0500, 0x1520, 0x6100,
-	0x918e, 0x0007, 0x1500, 0x2009, 0x1869, 0x210c, 0xd184, 0x11d8,
-	0x6003, 0x0003, 0x6007, 0x0043, 0x6047, 0xb035, 0x080c, 0x1c03,
-	0xa87c, 0xc0dd, 0xa87e, 0x600f, 0x0000, 0x00f6, 0x2079, 0x0380,
-	0x7818, 0xd0bc, 0x1de8, 0x7833, 0x0013, 0x2c00, 0x7836, 0x781b,
-	0x8080, 0x00fe, 0x0005, 0x908c, 0x0003, 0x0120, 0x918e, 0x0003,
-	0x1904, 0x888c, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8, 0x6024,
-	0xd0d4, 0x11e8, 0x2009, 0x1869, 0x2104, 0xd084, 0x1138, 0x87ff,
-	0x1120, 0x2009, 0x0043, 0x0804, 0xac68, 0x0005, 0x87ff, 0x1de8,
-	0x2009, 0x0042, 0x0804, 0xac68, 0x6110, 0x00b6, 0x2158, 0xb900,
-	0x00be, 0xd1ac, 0x0d20, 0x6024, 0xc0cd, 0x6026, 0x0c00, 0xc0d4,
-	0x6026, 0xa890, 0x602e, 0xa88c, 0x6032, 0x08e0, 0xd0fc, 0x0160,
-	0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x888c, 0x908c,
-	0x2020, 0x918e, 0x2020, 0x0170, 0x0076, 0x00f6, 0x2c78, 0x080c,
-	0x1731, 0x00fe, 0x007e, 0x87ff, 0x1120, 0x2009, 0x0042, 0x080c,
-	0xac68, 0x0005, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac,
-	0x0d58, 0x6124, 0xc1cd, 0x6126, 0x0c38, 0xd0fc, 0x0188, 0x908c,
-	0x2020, 0x918e, 0x2020, 0x01a8, 0x9084, 0x0003, 0x908e, 0x0002,
-	0x0148, 0x87ff, 0x1120, 0x2009, 0x0041, 0x080c, 0xac68, 0x0005,
-	0x00b9, 0x0ce8, 0x87ff, 0x1dd8, 0x2009, 0x0043, 0x080c, 0xac68,
-	0x0cb0, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d20,
-	0x6124, 0xc1cd, 0x6126, 0x0c00, 0x2009, 0x0004, 0x0019, 0x0005,
-	0x2009, 0x0001, 0x0096, 0x080c, 0xc814, 0x0518, 0x6014, 0x2048,
-	0xa982, 0xa800, 0x6016, 0x9186, 0x0001, 0x1188, 0xa97c, 0x918c,
-	0x8100, 0x918e, 0x8100, 0x1158, 0x00c6, 0x2061, 0x1a6f, 0x6200,
-	0xd28c, 0x1120, 0x6204, 0x8210, 0x0208, 0x6206, 0x00ce, 0x080c,
-	0x6ba5, 0x6014, 0x904d, 0x0076, 0x2039, 0x0000, 0x190c, 0x87ae,
-	0x007e, 0x009e, 0x0005, 0x0156, 0x00c6, 0x2061, 0x1a6f, 0x6000,
-	0x81ff, 0x0110, 0x9205, 0x0008, 0x9204, 0x6002, 0x00ce, 0x015e,
-	0x0005, 0x6800, 0xd08c, 0x1138, 0x6808, 0x9005, 0x0120, 0x8001,
-	0x680a, 0x9085, 0x0001, 0x0005, 0x2071, 0x1923, 0x7003, 0x0006,
-	0x7007, 0x0000, 0x700f, 0x0000, 0x7013, 0x0001, 0x080c, 0x1053,
-	0x090c, 0x0d7d, 0xa867, 0x0006, 0xa86b, 0x0001, 0xa8ab, 0xdcb0,
-	0xa89f, 0x0000, 0x2900, 0x702e, 0x7033, 0x0000, 0x0005, 0x0096,
-	0x00e6, 0x2071, 0x1923, 0x702c, 0x2048, 0x6a2c, 0x721e, 0x6b30,
-	0x7322, 0x6834, 0x7026, 0xa896, 0x6838, 0x702a, 0xa89a, 0x6824,
-	0x7016, 0x683c, 0x701a, 0x2009, 0x0028, 0x200a, 0x9005, 0x0148,
-	0x900e, 0x9188, 0x000c, 0x8001, 0x1de0, 0x2100, 0x9210, 0x1208,
-	0x8318, 0xaa8e, 0xab92, 0x7010, 0xd084, 0x0178, 0xc084, 0x7007,
-	0x0001, 0x700f, 0x0000, 0x0006, 0x2009, 0x181d, 0x2104, 0x9082,
-	0x0007, 0x2009, 0x1b4e, 0x200a, 0x000e, 0xc095, 0x7012, 0x2008,
-	0x2001, 0x003b, 0x080c, 0x1679, 0x9006, 0x2071, 0x193c, 0x7002,
-	0x7006, 0x702a, 0x00ee, 0x009e, 0x0005, 0x00e6, 0x0126, 0x0156,
-	0x2091, 0x8000, 0x2071, 0x1800, 0x7154, 0x2001, 0x0008, 0x910a,
-	0x0638, 0x2001, 0x187d, 0x20ac, 0x9006, 0x9080, 0x0008, 0x1f04,
-	0x8945, 0x71c0, 0x9102, 0x02e0, 0x2071, 0x1877, 0x20a9, 0x0007,
-	0x00c6, 0x080c, 0xab73, 0x6023, 0x0009, 0x6003, 0x0004, 0x601f,
-	0x0101, 0x0089, 0x0126, 0x2091, 0x8000, 0x080c, 0x8acb, 0x012e,
-	0x1f04, 0x8951, 0x9006, 0x00ce, 0x015e, 0x012e, 0x00ee, 0x0005,
-	0x9085, 0x0001, 0x0cc8, 0x00e6, 0x00b6, 0x0096, 0x0086, 0x0056,
-	0x0046, 0x0026, 0x7118, 0x720c, 0x7620, 0x7004, 0xd084, 0x1128,
-	0x2021, 0x0024, 0x2029, 0x0002, 0x0020, 0x2021, 0x002c, 0x2029,
-	0x000a, 0x080c, 0x103a, 0x090c, 0x0d7d, 0x2900, 0x6016, 0x2058,
-	0xac66, 0x9006, 0xa802, 0xa806, 0xa86a, 0xa87a, 0xa8aa, 0xa887,
-	0x0005, 0xa87f, 0x0020, 0x7008, 0xa89a, 0x7010, 0xa89e, 0xae8a,
-	0xa8af, 0xffff, 0xa8b3, 0x0000, 0x8109, 0x0160, 0x080c, 0x103a,
-	0x090c, 0x0d7d, 0xad66, 0x2b00, 0xa802, 0x2900, 0xb806, 0x2058,
-	0x8109, 0x1da0, 0x002e, 0x004e, 0x005e, 0x008e, 0x009e, 0x00be,
-	0x00ee, 0x0005, 0x2079, 0x0000, 0x2071, 0x1923, 0x7004, 0x004b,
-	0x700c, 0x0002, 0x89bd, 0x89b6, 0x89b6, 0x0005, 0x89c7, 0x8a28,
-	0x8a28, 0x8a28, 0x8a29, 0x8a3a, 0x8a3a, 0x700c, 0x0cba, 0x0126,
-	0x2091, 0x8000, 0x78a0, 0x79a0, 0x9106, 0x0128, 0x78a0, 0x79a0,
-	0x9106, 0x1904, 0x8a1b, 0x2001, 0x0005, 0x2004, 0xd0bc, 0x0130,
-	0x2011, 0x0004, 0x2204, 0xc0c5, 0x2012, 0x0ca8, 0x012e, 0x7018,
-	0x910a, 0x1130, 0x7030, 0x9005, 0x05a8, 0x080c, 0x8a69, 0x0490,
-	0x1210, 0x7114, 0x910a, 0x9192, 0x000a, 0x0210, 0x2009, 0x000a,
-	0x2001, 0x1888, 0x2014, 0x2001, 0x1935, 0x2004, 0x9100, 0x9202,
-	0x0e48, 0x080c, 0x8bb5, 0x2200, 0x9102, 0x0208, 0x2208, 0x0096,
-	0x702c, 0x2048, 0xa873, 0x0001, 0xa976, 0x080c, 0x8cbe, 0x2100,
-	0xa87e, 0xa86f, 0x0000, 0x009e, 0x0126, 0x2091, 0x8000, 0x2009,
-	0x1a21, 0x2104, 0xc085, 0x200a, 0x700f, 0x0002, 0x012e, 0x080c,
-	0x1143, 0x1de8, 0x0005, 0x2001, 0x0005, 0x2004, 0xd0bc, 0x0130,
-	0x2011, 0x0004, 0x2204, 0xc0c5, 0x2012, 0x0ca8, 0x012e, 0x0005,
-	0x0005, 0x700c, 0x0002, 0x8a2e, 0x8a31, 0x8a30, 0x080c, 0x89c5,
-	0x0005, 0x8001, 0x700e, 0x0096, 0x702c, 0x2048, 0xa974, 0x009e,
-	0x0011, 0x0ca0, 0x0005, 0x0096, 0x702c, 0x2048, 0x7018, 0x9100,
-	0x7214, 0x921a, 0x1130, 0x701c, 0xa88e, 0x7020, 0xa892, 0x9006,
-	0x0068, 0x0006, 0x080c, 0x8cbe, 0x2100, 0xaa8c, 0x9210, 0xaa8e,
-	0x1220, 0xa890, 0x9081, 0x0000, 0xa892, 0x000e, 0x009e, 0x2f08,
-	0x9188, 0x0028, 0x200a, 0x701a, 0x0005, 0x00e6, 0x2071, 0x1923,
-	0x700c, 0x0002, 0x8a67, 0x8a67, 0x8a65, 0x700f, 0x0001, 0x00ee,
-	0x0005, 0x0126, 0x2091, 0x8000, 0x7030, 0x9005, 0x0508, 0x2078,
-	0x7814, 0x2048, 0xae88, 0x00b6, 0x2059, 0x0000, 0x080c, 0x8ad4,
-	0x00be, 0x01b0, 0x00e6, 0x2071, 0x193c, 0x080c, 0x8b1b, 0x00ee,
-	0x0178, 0x0096, 0x080c, 0x1053, 0x2900, 0x009e, 0x0148, 0xa8aa,
-	0x04b9, 0x0041, 0x2001, 0x1946, 0x2003, 0x0000, 0x012e, 0x08c8,
-	0x012e, 0x0005, 0x00d6, 0x00c6, 0x0086, 0x00a6, 0x2940, 0x2650,
-	0x2600, 0x9005, 0x0180, 0xa864, 0x9084, 0x000f, 0x2068, 0x9d88,
-	0x1e55, 0x2165, 0x0056, 0x2029, 0x0000, 0x080c, 0x8c43, 0x080c,
-	0x1e2b, 0x1dd8, 0x005e, 0x00ae, 0x2001, 0x187f, 0x2004, 0xa88a,
-	0x080c, 0x1731, 0x781f, 0x0101, 0x7813, 0x0000, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x8b2a, 0x012e, 0x008e, 0x00ce, 0x00de, 0x0005,
-	0x7030, 0x9005, 0x0138, 0x2078, 0x780c, 0x7032, 0x2001, 0x1946,
-	0x2003, 0x0001, 0x0005, 0x00e6, 0x2071, 0x1923, 0x7030, 0x600e,
-	0x2c00, 0x7032, 0x00ee, 0x0005, 0x00d6, 0x00c6, 0x0026, 0x9b80,
-	0x8d9d, 0x2005, 0x906d, 0x090c, 0x0d7d, 0x9b80, 0x8d95, 0x2005,
-	0x9065, 0x090c, 0x0d7d, 0x6114, 0x2600, 0x9102, 0x0248, 0x6828,
-	0x9102, 0x02f0, 0x9085, 0x0001, 0x002e, 0x00ce, 0x00de, 0x0005,
-	0x6804, 0xd094, 0x0148, 0x6854, 0xd084, 0x1178, 0xc085, 0x6856,
-	0x2011, 0x8026, 0x080c, 0x4b00, 0x684c, 0x0096, 0x904d, 0x090c,
-	0x0d7d, 0xa804, 0x8000, 0xa806, 0x009e, 0x9006, 0x2030, 0x0c20,
-	0x6854, 0xd08c, 0x1d08, 0xc08d, 0x6856, 0x2011, 0x8025, 0x080c,
-	0x4b00, 0x684c, 0x0096, 0x904d, 0x090c, 0x0d7d, 0xa800, 0x8000,
-	0xa802, 0x009e, 0x0888, 0x7000, 0x2019, 0x0008, 0x8319, 0x7104,
-	0x9102, 0x1118, 0x2300, 0x9005, 0x0020, 0x0210, 0x9302, 0x0008,
-	0x8002, 0x0005, 0x00d6, 0x7814, 0x9005, 0x090c, 0x0d7d, 0x781c,
-	0x9084, 0x0101, 0x9086, 0x0101, 0x190c, 0x0d7d, 0x2069, 0x193c,
-	0x6804, 0x9080, 0x193e, 0x2f08, 0x2102, 0x6904, 0x8108, 0x9182,
-	0x0008, 0x0208, 0x900e, 0x6906, 0x9180, 0x193e, 0x2003, 0x0000,
-	0x00de, 0x0005, 0x0096, 0x00c6, 0x2060, 0x6014, 0x2048, 0xa8a8,
-	0x0096, 0x2048, 0x9005, 0x190c, 0x106c, 0x009e, 0xa8ab, 0x0000,
-	0x080c, 0x0fec, 0x080c, 0xabc9, 0x00ce, 0x009e, 0x0005, 0x6020,
-	0x9086, 0x0009, 0x1128, 0x601c, 0xd0c4, 0x0110, 0x9006, 0x0005,
-	0x9085, 0x0001, 0x0005, 0x6000, 0x9086, 0x0000, 0x0178, 0x6010,
-	0x9005, 0x0150, 0x00b6, 0x2058, 0x080c, 0x8ed0, 0x00be, 0x6013,
-	0x0000, 0x601b, 0x0000, 0x0010, 0x2c00, 0x0861, 0x0005, 0x2009,
-	0x1927, 0x210c, 0xd194, 0x0005, 0x00e6, 0x2071, 0x1923, 0x7110,
-	0xc194, 0xd19c, 0x1118, 0xc185, 0x7007, 0x0000, 0x7112, 0x2001,
-	0x003b, 0x080c, 0x1679, 0x00ee, 0x0005, 0x0096, 0x00d6, 0x9006,
-	0x7006, 0x700e, 0x701a, 0x701e, 0x7022, 0x7016, 0x702a, 0x7026,
-	0x702f, 0x0000, 0x080c, 0x8d1d, 0x0170, 0x080c, 0x8d52, 0x0158,
-	0x2900, 0x7002, 0x700a, 0x701a, 0x7013, 0x0001, 0x701f, 0x000a,
-	0x00de, 0x009e, 0x0005, 0x900e, 0x0cd8, 0x00e6, 0x0096, 0x0086,
-	0x00d6, 0x00c6, 0x2071, 0x1930, 0x721c, 0x2100, 0x9202, 0x1618,
-	0x080c, 0x8d52, 0x090c, 0x0d7d, 0x7018, 0x9005, 0x1160, 0x2900,
-	0x7002, 0x700a, 0x701a, 0x9006, 0x7006, 0x700e, 0xa806, 0xa802,
-	0x7012, 0x701e, 0x0038, 0x2040, 0xa806, 0x2900, 0xa002, 0x701a,
-	0xa803, 0x0000, 0x7010, 0x8000, 0x7012, 0x701c, 0x9080, 0x000a,
-	0x701e, 0x721c, 0x08d0, 0x721c, 0x00ce, 0x00de, 0x008e, 0x009e,
-	0x00ee, 0x0005, 0x0096, 0x0156, 0x0136, 0x0146, 0x00e6, 0x0126,
-	0x2091, 0x8000, 0x2071, 0x1930, 0x7300, 0x831f, 0x831e, 0x831e,
-	0x9384, 0x003f, 0x20e8, 0x939c, 0xffc0, 0x9398, 0x0003, 0x7104,
-	0x080c, 0x8cbe, 0x810c, 0x2100, 0x9318, 0x8003, 0x2228, 0x2021,
-	0x0078, 0x9402, 0x9532, 0x0208, 0x2028, 0x2500, 0x8004, 0x20a8,
-	0x23a0, 0xa001, 0xa001, 0x4005, 0x2508, 0x080c, 0x8cc7, 0x2130,
-	0x7014, 0x9600, 0x7016, 0x2600, 0x711c, 0x9102, 0x701e, 0x7004,
-	0x9600, 0x2008, 0x9082, 0x000a, 0x1190, 0x7000, 0x2048, 0xa800,
-	0x9005, 0x1148, 0x2009, 0x0001, 0x0026, 0x080c, 0x8bb5, 0x002e,
-	0x7000, 0x2048, 0xa800, 0x7002, 0x7007, 0x0000, 0x0008, 0x7106,
-	0x2500, 0x9212, 0x1904, 0x8bf4, 0x012e, 0x00ee, 0x014e, 0x013e,
-	0x015e, 0x009e, 0x0005, 0x0016, 0x0026, 0x00e6, 0x0126, 0x2091,
-	0x8000, 0x9580, 0x8d95, 0x2005, 0x9075, 0x090c, 0x0d7d, 0x080c,
-	0x8c99, 0x012e, 0x9580, 0x8d91, 0x2005, 0x9075, 0x090c, 0x0d7d,
-	0x0156, 0x0136, 0x01c6, 0x0146, 0x01d6, 0x831f, 0x831e, 0x831e,
-	0x9384, 0x003f, 0x20e0, 0x9384, 0xffc0, 0x9100, 0x2098, 0xa860,
-	0x20e8, 0xa95c, 0x2c05, 0x9100, 0x20a0, 0x20a9, 0x0002, 0x4003,
-	0x2e0c, 0x2d00, 0x0002, 0x8c83, 0x8c83, 0x8c85, 0x8c83, 0x8c85,
-	0x8c83, 0x8c83, 0x8c83, 0x8c83, 0x8c83, 0x8c8b, 0x8c83, 0x8c8b,
-	0x8c83, 0x8c83, 0x8c83, 0x080c, 0x0d7d, 0x4104, 0x20a9, 0x0002,
-	0x4002, 0x4003, 0x0028, 0x20a9, 0x0002, 0x4003, 0x4104, 0x4003,
-	0x01de, 0x014e, 0x01ce, 0x013e, 0x015e, 0x00ee, 0x002e, 0x001e,
-	0x0005, 0x0096, 0x7014, 0x8001, 0x7016, 0x710c, 0x2110, 0x00f1,
-	0x810c, 0x9188, 0x0003, 0x7308, 0x8210, 0x9282, 0x000a, 0x1198,
-	0x7008, 0x2048, 0xa800, 0x9005, 0x0158, 0x0006, 0x080c, 0x8d61,
-	0x009e, 0xa807, 0x0000, 0x2900, 0x700a, 0x7010, 0x8001, 0x7012,
-	0x700f, 0x0000, 0x0008, 0x720e, 0x009e, 0x0005, 0x0006, 0x810b,
-	0x810b, 0x2100, 0x810b, 0x9100, 0x2008, 0x000e, 0x0005, 0x0006,
-	0x0026, 0x2100, 0x9005, 0x0158, 0x9092, 0x000c, 0x0240, 0x900e,
-	0x8108, 0x9082, 0x000c, 0x1de0, 0x002e, 0x000e, 0x0005, 0x900e,
-	0x0cd8, 0x2d00, 0x90b8, 0x0008, 0x690c, 0x6810, 0x2019, 0x0001,
-	0x2031, 0x8d07, 0x9112, 0x0220, 0x0118, 0x8318, 0x2208, 0x0cd0,
-	0x6808, 0x9005, 0x0108, 0x8318, 0x233a, 0x6804, 0xd084, 0x2300,
-	0x2021, 0x0001, 0x1150, 0x9082, 0x0003, 0x0967, 0x0a67, 0x8420,
-	0x9082, 0x0007, 0x0967, 0x0a67, 0x0cd0, 0x9082, 0x0002, 0x0967,
-	0x0a67, 0x8420, 0x9082, 0x0005, 0x0967, 0x0a67, 0x0cd0, 0x6c1a,
-	0x2d00, 0x90b8, 0x0007, 0x00e6, 0x2071, 0x1800, 0x7128, 0x6810,
-	0x2019, 0x0001, 0x910a, 0x0118, 0x0210, 0x8318, 0x0cd8, 0x2031,
-	0x8d1a, 0x0870, 0x6c16, 0x00ee, 0x0005, 0x0096, 0x0046, 0x0126,
-	0x2091, 0x8000, 0x2b00, 0x9080, 0x8d99, 0x2005, 0x9005, 0x090c,
-	0x0d7d, 0x2004, 0x90a0, 0x000a, 0x080c, 0x1053, 0x01d0, 0x2900,
-	0x7026, 0xa803, 0x0000, 0xa807, 0x0000, 0x080c, 0x1053, 0x0188,
-	0x7024, 0xa802, 0xa807, 0x0000, 0x2900, 0x7026, 0x94a2, 0x000a,
-	0x0110, 0x0208, 0x0c90, 0x9085, 0x0001, 0x012e, 0x004e, 0x009e,
-	0x0005, 0x7024, 0x9005, 0x0dc8, 0x2048, 0xac00, 0x080c, 0x106c,
-	0x2400, 0x0cc0, 0x0126, 0x2091, 0x8000, 0x7024, 0x2048, 0x9005,
-	0x0130, 0xa800, 0x7026, 0xa803, 0x0000, 0xa807, 0x0000, 0x012e,
-	0x0005, 0x0126, 0x2091, 0x8000, 0x7024, 0xa802, 0x2900, 0x7026,
-	0x012e, 0x0005, 0x0096, 0x9e80, 0x0009, 0x2004, 0x9005, 0x0138,
-	0x2048, 0xa800, 0x0006, 0x080c, 0x106c, 0x000e, 0x0cb8, 0x009e,
-	0x0005, 0x0096, 0x7008, 0x9005, 0x0138, 0x2048, 0xa800, 0x0006,
-	0x080c, 0x106c, 0x000e, 0x0cb8, 0x9006, 0x7002, 0x700a, 0x7006,
-	0x700e, 0x701a, 0x701e, 0x7022, 0x702a, 0x7026, 0x702e, 0x009e,
-	0x0005, 0x1a6d, 0x0000, 0x0000, 0x0000, 0x1930, 0x0000, 0x0000,
-	0x0000, 0x1888, 0x0000, 0x0000, 0x0000, 0x1877, 0x0000, 0x0000,
-	0x0000, 0x00e6, 0x00c6, 0x00b6, 0x00a6, 0xa8a8, 0x2040, 0x2071,
-	0x1877, 0x080c, 0x8ebb, 0xa067, 0x0023, 0x6010, 0x905d, 0x0904,
-	0x8e90, 0xb814, 0xa06e, 0xb910, 0xa172, 0xb9a0, 0xa176, 0x2001,
-	0x0003, 0xa07e, 0xa834, 0xa082, 0xa07b, 0x0000, 0xa898, 0x9005,
-	0x0118, 0xa078, 0xc085, 0xa07a, 0x2858, 0x2031, 0x0018, 0xa068,
-	0x908a, 0x0019, 0x1a0c, 0x0d7d, 0x2020, 0x2050, 0x2940, 0xa864,
-	0x90bc, 0x00ff, 0x908c, 0x000f, 0x91e0, 0x1e55, 0x2c65, 0x9786,
-	0x0024, 0x2c05, 0x1590, 0x908a, 0x0036, 0x1a0c, 0x0d7d, 0x9082,
-	0x001b, 0x0002, 0x8dfd, 0x8dfd, 0x8dff, 0x8dfd, 0x8dfd, 0x8dfd,
-	0x8e01, 0x8dfd, 0x8dfd, 0x8dfd, 0x8e03, 0x8dfd, 0x8dfd, 0x8dfd,
-	0x8e05, 0x8dfd, 0x8dfd, 0x8dfd, 0x8e07, 0x8dfd, 0x8dfd, 0x8dfd,
-	0x8e09, 0x8dfd, 0x8dfd, 0x8dfd, 0x8e0b, 0x080c, 0x0d7d, 0xa180,
-	0x04b8, 0xa190, 0x04a8, 0xa1a0, 0x0498, 0xa1b0, 0x0488, 0xa1c0,
-	0x0478, 0xa1d0, 0x0468, 0xa1e0, 0x0458, 0x908a, 0x0034, 0x1a0c,
-	0x0d7d, 0x9082, 0x001b, 0x0002, 0x8e2f, 0x8e2d, 0x8e2d, 0x8e2d,
-	0x8e2d, 0x8e2d, 0x8e31, 0x8e2d, 0x8e2d, 0x8e2d, 0x8e2d, 0x8e2d,
-	0x8e33, 0x8e2d, 0x8e2d, 0x8e2d, 0x8e2d, 0x8e2d, 0x8e35, 0x8e2d,
-	0x8e2d, 0x8e2d, 0x8e2d, 0x8e2d, 0x8e37, 0x080c, 0x0d7d, 0xa180,
-	0x0038, 0xa198, 0x0028, 0xa1b0, 0x0018, 0xa1c8, 0x0008, 0xa1e0,
-	0x2600, 0x0002, 0x8e53, 0x8e55, 0x8e57, 0x8e59, 0x8e5b, 0x8e5d,
-	0x8e5f, 0x8e61, 0x8e63, 0x8e65, 0x8e67, 0x8e69, 0x8e6b, 0x8e6d,
-	0x8e6f, 0x8e71, 0x8e73, 0x8e75, 0x8e77, 0x8e79, 0x8e7b, 0x8e7d,
-	0x8e7f, 0x8e81, 0x8e83, 0x080c, 0x0d7d, 0xb9e2, 0x0468, 0xb9de,
-	0x0458, 0xb9da, 0x0448, 0xb9d6, 0x0438, 0xb9d2, 0x0428, 0xb9ce,
-	0x0418, 0xb9ca, 0x0408, 0xb9c6, 0x00f8, 0xb9c2, 0x00e8, 0xb9be,
-	0x00d8, 0xb9ba, 0x00c8, 0xb9b6, 0x00b8, 0xb9b2, 0x00a8, 0xb9ae,
-	0x0098, 0xb9aa, 0x0088, 0xb9a6, 0x0078, 0xb9a2, 0x0068, 0xb99e,
-	0x0058, 0xb99a, 0x0048, 0xb996, 0x0038, 0xb992, 0x0028, 0xb98e,
-	0x0018, 0xb98a, 0x0008, 0xb986, 0x8631, 0x8421, 0x0120, 0x080c,
-	0x1e2b, 0x0804, 0x8dd7, 0x00ae, 0x00be, 0x00ce, 0x00ee, 0x0005,
-	0xa86c, 0xa06e, 0xa870, 0xa072, 0xa077, 0x00ff, 0x9006, 0x0804,
-	0x8db9, 0x0006, 0x0016, 0x00b6, 0x6010, 0x2058, 0xb810, 0x9005,
-	0x01b0, 0x2001, 0x1924, 0x2004, 0x9005, 0x0188, 0x2001, 0x1800,
-	0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0xbba0, 0x2021,
-	0x0004, 0x2011, 0x8014, 0x080c, 0x4b00, 0x004e, 0x003e, 0x00be,
-	0x001e, 0x000e, 0x0005, 0x9016, 0x710c, 0xa834, 0x910a, 0xa936,
-	0x7008, 0x9005, 0x0120, 0x8210, 0x910a, 0x0238, 0x0130, 0x7010,
-	0x8210, 0x910a, 0x0210, 0x0108, 0x0cd8, 0xaa8a, 0xa26a, 0x0005,
-	0x00f6, 0x00d6, 0x0036, 0x2079, 0x0300, 0x781b, 0x0200, 0x7818,
-	0xd094, 0x1dd8, 0x781b, 0x0202, 0xa001, 0xa001, 0x7818, 0xd094,
-	0x1da0, 0xb8ac, 0x9005, 0x01b8, 0x2068, 0x2079, 0x0000, 0x2c08,
-	0x911e, 0x1118, 0x680c, 0xb8ae, 0x0060, 0x9106, 0x0140, 0x2d00,
-	0x2078, 0x680c, 0x9005, 0x090c, 0x0d7d, 0x2068, 0x0cb0, 0x6b0c,
-	0x7b0e, 0x600f, 0x0000, 0x2079, 0x0300, 0x781b, 0x0200, 0x003e,
-	0x00de, 0x00fe, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x00c6, 0x0036,
-	0x0126, 0x2091, 0x8000, 0x0156, 0x20a9, 0x01ff, 0x2071, 0x0300,
-	0x701b, 0x0200, 0x7018, 0xd094, 0x0110, 0x1f04, 0x8f10, 0x701b,
-	0x0202, 0xa001, 0xa001, 0x7018, 0xd094, 0x1d90, 0xb8ac, 0x9005,
-	0x01d0, 0x2060, 0x600c, 0xb8ae, 0x6003, 0x0004, 0x601b, 0x0000,
-	0x6013, 0x0000, 0x601f, 0x0101, 0x6014, 0x2048, 0xa88b, 0x0000,
-	0xa8a8, 0xa8ab, 0x0000, 0x904d, 0x090c, 0x0d7d, 0x080c, 0x106c,
-	0x080c, 0x8acb, 0x0c18, 0x2071, 0x0300, 0x701b, 0x0200, 0x015e,
-	0x012e, 0x003e, 0x00ce, 0x009e, 0x00de, 0x00ee, 0x0005, 0x00c6,
-	0x00b6, 0x0016, 0x0006, 0x0156, 0x080c, 0x25fb, 0x015e, 0x11b0,
-	0x080c, 0x65bd, 0x190c, 0x0d7d, 0x000e, 0x001e, 0xb912, 0xb816,
-	0x080c, 0xab73, 0x0140, 0x2b00, 0x6012, 0x6023, 0x0001, 0x2009,
-	0x0001, 0x080c, 0xac68, 0x00be, 0x00ce, 0x0005, 0x000e, 0x001e,
-	0x0cd0, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d7d, 0x0013,
-	0x006e, 0x0005, 0x8f82, 0x8f82, 0x8f82, 0x8f84, 0x8fcd, 0x8f82,
-	0x8f82, 0x8f82, 0x9030, 0x8f82, 0x9068, 0x8f82, 0x8f82, 0x8f82,
-	0x8f82, 0x8f82, 0x080c, 0x0d7d, 0x9182, 0x0040, 0x0002, 0x8f97,
-	0x8f97, 0x8f97, 0x8f97, 0x8f97, 0x8f97, 0x8f97, 0x8f97, 0x8f97,
-	0x8f99, 0x8faa, 0x8f97, 0x8f97, 0x8f97, 0x8f97, 0x8fbb, 0x080c,
-	0x0d7d, 0x0096, 0x6114, 0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6,
-	0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6b70, 0x080c, 0xabc9,
-	0x009e, 0x0005, 0x080c, 0x960a, 0x00d6, 0x6114, 0x080c, 0xc814,
-	0x0130, 0x0096, 0x6114, 0x2148, 0x080c, 0x6d70, 0x009e, 0x00de,
-	0x080c, 0xabc9, 0x0005, 0x080c, 0x960a, 0x080c, 0x31e4, 0x6114,
-	0x0096, 0x2148, 0x080c, 0xc814, 0x0120, 0xa87b, 0x0029, 0x080c,
-	0x6d70, 0x009e, 0x080c, 0xabc9, 0x0005, 0x601b, 0x0000, 0x9182,
-	0x0040, 0x0096, 0x0002, 0x8fe8, 0x8fe8, 0x8fe8, 0x8fe8, 0x8fe8,
-	0x8fe8, 0x8fe8, 0x8fe8, 0x8fea, 0x8fe8, 0x8fe8, 0x8fe8, 0x902c,
-	0x8fe8, 0x8fe8, 0x8fe8, 0x8fe8, 0x8fe8, 0x8fe8, 0x8ff0, 0x8fe8,
-	0x080c, 0x0d7d, 0x6114, 0x2148, 0xa938, 0x918e, 0xffff, 0x05e0,
-	0x00e6, 0x6114, 0x2148, 0x080c, 0x8da1, 0x0096, 0xa8a8, 0x2048,
-	0x080c, 0x6b08, 0x009e, 0xa8ab, 0x0000, 0x6010, 0x9005, 0x0128,
-	0x00b6, 0x2058, 0x080c, 0x8ed0, 0x00be, 0xae88, 0x00b6, 0x2059,
-	0x0000, 0x080c, 0x8ad4, 0x00be, 0x01e0, 0x2071, 0x193c, 0x080c,
-	0x8b1b, 0x01b8, 0x9086, 0x0001, 0x1128, 0x2001, 0x1946, 0x2004,
-	0x9005, 0x1178, 0x0096, 0x080c, 0x103a, 0x2900, 0x009e, 0x0148,
-	0xa8aa, 0x00f6, 0x2c78, 0x080c, 0x8a92, 0x00fe, 0x00ee, 0x009e,
-	0x0005, 0x080c, 0x8acb, 0x0cd0, 0x080c, 0x90e4, 0x009e, 0x0005,
-	0x9182, 0x0040, 0x0096, 0x0002, 0x9044, 0x9044, 0x9044, 0x9046,
-	0x9044, 0x9044, 0x9044, 0x9066, 0x9044, 0x9044, 0x9044, 0x9044,
-	0x9044, 0x9044, 0x9044, 0x9044, 0x080c, 0x0d7d, 0x6003, 0x0003,
-	0x6106, 0x6014, 0x2048, 0xa8ac, 0xa836, 0xa8b0, 0xa83a, 0xa847,
-	0x0000, 0xa84b, 0x0000, 0xa884, 0x9092, 0x199a, 0x0210, 0x2001,
-	0x1999, 0x8003, 0x8013, 0x8213, 0x9210, 0x621a, 0x080c, 0x1bba,
-	0x2009, 0x8030, 0x080c, 0x9234, 0x009e, 0x0005, 0x080c, 0x0d7d,
-	0x080c, 0x960a, 0x6114, 0x2148, 0xa87b, 0x0000, 0x6010, 0x00b6,
-	0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6d70, 0x080c, 0xabc9,
-	0x009e, 0x0005, 0x080c, 0xa872, 0x6144, 0xd1fc, 0x0120, 0xd1ac,
-	0x1110, 0x6003, 0x0003, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d7d,
-	0x0096, 0x0023, 0x009e, 0x080c, 0xa88e, 0x0005, 0x909e, 0x909e,
-	0x909e, 0x90a0, 0x90b1, 0x909e, 0x909e, 0x909e, 0x909e, 0x909e,
-	0x909e, 0x909e, 0x909e, 0x909e, 0x909e, 0x909e, 0x080c, 0x0d7d,
-	0x080c, 0xaa06, 0x6114, 0x2148, 0xa87b, 0x0006, 0x6010, 0x00b6,
-	0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6d70, 0x080c, 0xabc9,
-	0x0005, 0x0491, 0x0005, 0x080c, 0xa872, 0x6000, 0x6144, 0xd1fc,
-	0x0130, 0xd1ac, 0x1120, 0x6003, 0x0003, 0x2009, 0x0003, 0x908a,
-	0x0016, 0x1a0c, 0x0d7d, 0x0096, 0x0033, 0x009e, 0x0106, 0x080c,
-	0xa88e, 0x010e, 0x0005, 0x90db, 0x90db, 0x90db, 0x90dd, 0x90e4,
-	0x90db, 0x90db, 0x90db, 0x90db, 0x90db, 0x90db, 0x90db, 0x90db,
-	0x90db, 0x90db, 0x90db, 0x080c, 0x0d7d, 0x0036, 0x00e6, 0x080c,
-	0xaa06, 0x00ee, 0x003e, 0x0005, 0x00f6, 0x00e6, 0x601b, 0x0000,
-	0x6014, 0x2048, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058, 0x080c,
-	0x8ed0, 0x00be, 0x2071, 0x193c, 0x080c, 0x8b1b, 0x0160, 0x2001,
-	0x187f, 0x2004, 0xa88a, 0x2031, 0x0000, 0x2c78, 0x080c, 0x8a92,
-	0x00ee, 0x00fe, 0x0005, 0x0096, 0xa88b, 0x0000, 0xa8a8, 0x2048,
-	0x080c, 0x106c, 0x009e, 0xa8ab, 0x0000, 0x080c, 0x8acb, 0x0c80,
-	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-	0x0000, 0x187a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-	0x0126, 0x2091, 0x8000, 0x0036, 0x0046, 0x20a9, 0x0010, 0x9006,
-	0x8004, 0x8086, 0x818e, 0x1208, 0x9200, 0x1f04, 0x9129, 0x8086,
-	0x818e, 0x004e, 0x003e, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000,
-	0x0076, 0x0156, 0x20a9, 0x0010, 0x9005, 0x01c8, 0x911a, 0x12b8,
-	0x8213, 0x818d, 0x0228, 0x911a, 0x1220, 0x1f04, 0x9140, 0x0028,
-	0x911a, 0x2308, 0x8210, 0x1f04, 0x9140, 0x0006, 0x3200, 0x9084,
-	0xefff, 0x2080, 0x000e, 0x015e, 0x007e, 0x012e, 0x0005, 0x0006,
-	0x3200, 0x9085, 0x1000, 0x0ca8, 0x0126, 0x2091, 0x2800, 0x2079,
-	0x19e7, 0x012e, 0x00d6, 0x2069, 0x19e7, 0x6803, 0x0005, 0x0156,
-	0x0146, 0x01d6, 0x20e9, 0x0000, 0x2069, 0x0200, 0x080c, 0xa66c,
-	0x04a9, 0x080c, 0xa657, 0x0491, 0x080c, 0xa65a, 0x0479, 0x080c,
-	0xa65d, 0x0461, 0x080c, 0xa660, 0x0449, 0x080c, 0xa663, 0x0431,
-	0x080c, 0xa666, 0x0419, 0x080c, 0xa669, 0x0401, 0x01de, 0x014e,
-	0x015e, 0x6857, 0x0000, 0x00f6, 0x2079, 0x0380, 0x00f9, 0x7807,
-	0x0003, 0x7803, 0x0000, 0x7803, 0x0001, 0x2069, 0x0004, 0x2d04,
-	0x9084, 0xfffe, 0x9085, 0x8000, 0x206a, 0x2069, 0x0100, 0x6828,
-	0x9084, 0xfffc, 0x682a, 0x00fe, 0x00de, 0x0005, 0x20a9, 0x0020,
-	0x20a1, 0x0240, 0x2001, 0x0000, 0x4004, 0x0005, 0x00c6, 0x7803,
-	0x0000, 0x9006, 0x7827, 0x0030, 0x782b, 0x0400, 0x7827, 0x0031,
-	0x782b, 0x1aef, 0x781f, 0xff00, 0x781b, 0xff00, 0x2061, 0x1ae4,
-	0x602f, 0x19e7, 0x6033, 0x1800, 0x6037, 0x1a03, 0x603b, 0x1e55,
-	0x603f, 0x1e65, 0x6042, 0x6047, 0x1aba, 0x00ce, 0x0005, 0x2001,
-	0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0001, 0x01b0, 0x00c6,
-	0x6146, 0x600f, 0x0000, 0x2c08, 0x2061, 0x19e7, 0x602c, 0x8000,
-	0x602e, 0x601c, 0x9005, 0x0130, 0x9080, 0x0003, 0x2102, 0x611e,
-	0x00ce, 0x0005, 0x6122, 0x611e, 0x0cd8, 0x6146, 0x2c08, 0x2001,
-	0x0012, 0x080c, 0xa863, 0x0005, 0x0016, 0x2009, 0x8020, 0x6146,
-	0x2c08, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0001,
-	0x1128, 0x2001, 0x0019, 0x080c, 0xa863, 0x0088, 0x00c6, 0x2061,
-	0x19e7, 0x602c, 0x8000, 0x602e, 0x600c, 0x9005, 0x0128, 0x9080,
-	0x0003, 0x2102, 0x610e, 0x0010, 0x6112, 0x610e, 0x00ce, 0x001e,
-	0x0005, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0001,
-	0x0198, 0x00c6, 0x6146, 0x600f, 0x0000, 0x2c08, 0x2061, 0x19e7,
-	0x6044, 0x9005, 0x0130, 0x9080, 0x0003, 0x2102, 0x6146, 0x00ce,
-	0x0005, 0x614a, 0x6146, 0x0cd8, 0x6146, 0x600f, 0x0000, 0x2c08,
-	0x2001, 0x0013, 0x080c, 0xa863, 0x0005, 0x6044, 0xd0dc, 0x0128,
-	0x9006, 0x7007, 0x0000, 0x700a, 0x7032, 0x0005, 0x00f6, 0x00e6,
-	0x00d6, 0x00c6, 0x00b6, 0x0096, 0x0076, 0x0066, 0x0056, 0x0036,
-	0x0026, 0x0016, 0x0006, 0x0126, 0x902e, 0x2071, 0x19e7, 0x7648,
-	0x2660, 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904, 0x92bf, 0x6010,
-	0x2058, 0xb8a0, 0x9206, 0x1904, 0x92ba, 0x87ff, 0x0120, 0x605c,
-	0x9106, 0x1904, 0x92ba, 0x704c, 0x9c06, 0x1178, 0x0036, 0x2019,
-	0x0001, 0x080c, 0xa0f4, 0x703f, 0x0000, 0x9006, 0x704e, 0x706a,
-	0x7052, 0x706e, 0x003e, 0x2029, 0x0001, 0x080c, 0x923d, 0x7048,
-	0x9c36, 0x1110, 0x660c, 0x764a, 0x7044, 0x9c36, 0x1140, 0x2c00,
-	0x9f36, 0x0118, 0x2f00, 0x7046, 0x0010, 0x7047, 0x0000, 0x660c,
-	0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
-	0x0000, 0x080c, 0xc814, 0x01c8, 0x6014, 0x2048, 0x6020, 0x9086,
-	0x0003, 0x1560, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016,
-	0x0036, 0x0076, 0x080c, 0xcb12, 0x080c, 0xe5f6, 0x080c, 0x6d70,
-	0x007e, 0x003e, 0x001e, 0x080c, 0xca03, 0x080c, 0xac04, 0x00ce,
-	0x0804, 0x925c, 0x2c78, 0x600c, 0x2060, 0x0804, 0x925c, 0x012e,
-	0x000e, 0x001e, 0x002e, 0x003e, 0x005e, 0x006e, 0x007e, 0x009e,
-	0x00be, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086,
-	0x0006, 0x1158, 0x0016, 0x0036, 0x0076, 0x080c, 0xe5f6, 0x080c,
-	0xe241, 0x007e, 0x003e, 0x001e, 0x08c0, 0x6020, 0x9086, 0x0009,
-	0x1168, 0xa87b, 0x0006, 0x0016, 0x0036, 0x0076, 0x080c, 0x6d70,
-	0x080c, 0xabc9, 0x007e, 0x003e, 0x001e, 0x0848, 0x6020, 0x9086,
-	0x000a, 0x0904, 0x92a4, 0x0804, 0x92a2, 0x0006, 0x0066, 0x0096,
-	0x00c6, 0x00d6, 0x00f6, 0x9036, 0x0126, 0x2091, 0x8000, 0x2079,
-	0x19e7, 0x7848, 0x9065, 0x0904, 0x9354, 0x600c, 0x0006, 0x600f,
-	0x0000, 0x784c, 0x9c06, 0x11a0, 0x0036, 0x2019, 0x0001, 0x080c,
-	0xa0f4, 0x783f, 0x0000, 0x901e, 0x7b4e, 0x7b6a, 0x7b52, 0x7b6e,
-	0x003e, 0x000e, 0x9005, 0x1118, 0x600c, 0x600f, 0x0000, 0x0006,
-	0x00e6, 0x2f70, 0x080c, 0x923d, 0x00ee, 0x080c, 0xc814, 0x0520,
-	0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1580, 0x3e08, 0x918e,
-	0x0002, 0x1188, 0x6010, 0x9005, 0x0170, 0x00b6, 0x2058, 0xb800,
-	0x00be, 0xd0bc, 0x0140, 0x6048, 0x9005, 0x1198, 0x2001, 0x1988,
-	0x2004, 0x604a, 0x0070, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
-	0x080c, 0x6d64, 0x080c, 0xca03, 0x6044, 0xc0fc, 0x6046, 0x080c,
-	0xac04, 0x000e, 0x0804, 0x9302, 0x7e4a, 0x7e46, 0x012e, 0x00fe,
-	0x00de, 0x00ce, 0x009e, 0x006e, 0x000e, 0x0005, 0x6020, 0x9086,
-	0x0006, 0x1118, 0x080c, 0xe241, 0x0c38, 0x6020, 0x9086, 0x0009,
-	0x1130, 0xab7a, 0x080c, 0x6d70, 0x080c, 0xabc9, 0x0c10, 0x6020,
-	0x9086, 0x000a, 0x0990, 0x0878, 0x0016, 0x0026, 0x0086, 0x9046,
-	0x00a9, 0x080c, 0x9465, 0x008e, 0x002e, 0x001e, 0x0005, 0x00f6,
-	0x0126, 0x2079, 0x19e7, 0x2091, 0x8000, 0x080c, 0x94ae, 0x080c,
-	0x9542, 0x080c, 0x67ab, 0x012e, 0x00fe, 0x0005, 0x00b6, 0x0096,
-	0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0016, 0x0006, 0x0126,
-	0x2091, 0x8000, 0x2071, 0x19e7, 0x7620, 0x2660, 0x2678, 0x8cff,
-	0x0904, 0x942a, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x9425,
-	0x88ff, 0x0120, 0x605c, 0x9106, 0x1904, 0x9425, 0x7030, 0x9c06,
-	0x1570, 0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508, 0x080c, 0x86c5,
-	0x080c, 0x9e0e, 0x68c3, 0x0000, 0x080c, 0xa314, 0x7033, 0x0000,
-	0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001,
-	0x0100, 0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x2069, 0x0100,
-	0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0040, 0x7008,
-	0xc0ad, 0x700a, 0x6003, 0x0009, 0x630a, 0x0804, 0x9425, 0x7020,
-	0x9c36, 0x1110, 0x660c, 0x7622, 0x701c, 0x9c36, 0x1140, 0x2c00,
-	0x9f36, 0x0118, 0x2f00, 0x701e, 0x0010, 0x701f, 0x0000, 0x660c,
-	0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
-	0x0000, 0x6044, 0xc0fc, 0x6046, 0x6014, 0x2048, 0x080c, 0xc814,
-	0x01e8, 0x6020, 0x9086, 0x0003, 0x1580, 0x080c, 0xca29, 0x1118,
-	0x080c, 0xb591, 0x0098, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
-	0x0016, 0x0036, 0x0086, 0x080c, 0xcb12, 0x080c, 0xe5f6, 0x080c,
-	0x6d70, 0x008e, 0x003e, 0x001e, 0x080c, 0xca03, 0x080c, 0xac04,
-	0x080c, 0xa1ea, 0x00ce, 0x0804, 0x939f, 0x2c78, 0x600c, 0x2060,
-	0x0804, 0x939f, 0x012e, 0x000e, 0x001e, 0x006e, 0x00ce, 0x00de,
-	0x00ee, 0x00fe, 0x009e, 0x00be, 0x0005, 0x6020, 0x9086, 0x0006,
-	0x1158, 0x0016, 0x0036, 0x0086, 0x080c, 0xe5f6, 0x080c, 0xe241,
-	0x008e, 0x003e, 0x001e, 0x08d0, 0x080c, 0xb591, 0x6020, 0x9086,
-	0x0002, 0x1160, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0904,
-	0x940b, 0x9086, 0x008b, 0x0904, 0x940b, 0x0840, 0x6020, 0x9086,
-	0x0005, 0x1920, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x09c8,
-	0x9086, 0x008b, 0x09b0, 0x0804, 0x941e, 0x0006, 0x00f6, 0x00e6,
-	0x0096, 0x00b6, 0x00c6, 0x0066, 0x0016, 0x0126, 0x2091, 0x8000,
-	0x9280, 0x1000, 0x2004, 0x905d, 0x2079, 0x19e7, 0x9036, 0x7828,
-	0x2060, 0x8cff, 0x0538, 0x6010, 0x9b06, 0x1500, 0x6043, 0xffff,
-	0x080c, 0xaa51, 0x01d8, 0x610c, 0x0016, 0x080c, 0x9f7e, 0x6014,
-	0x2048, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036,
-	0x0086, 0x080c, 0xcb12, 0x080c, 0xe5f6, 0x080c, 0x6d70, 0x008e,
-	0x003e, 0x001e, 0x080c, 0xac04, 0x00ce, 0x08d8, 0x2c30, 0x600c,
-	0x2060, 0x08b8, 0x080c, 0x67c8, 0x012e, 0x001e, 0x006e, 0x00ce,
-	0x00be, 0x009e, 0x00ee, 0x00fe, 0x000e, 0x0005, 0x0096, 0x0006,
-	0x0066, 0x00c6, 0x00d6, 0x9036, 0x7820, 0x9065, 0x0904, 0x9515,
-	0x600c, 0x0006, 0x6044, 0xc0fc, 0x6046, 0x600f, 0x0000, 0x7830,
-	0x9c06, 0x1588, 0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508, 0x080c,
-	0x86c5, 0x080c, 0x9e0e, 0x68c3, 0x0000, 0x080c, 0xa314, 0x7833,
+	0x0040, 0x0608, 0x00b8, 0x2001, 0x1800, 0x200c, 0x9186, 0x0003,
+	0x1160, 0x7104, 0x9186, 0x0004, 0x0140, 0x9186, 0x0007, 0x0128,
+	0x9186, 0x0003, 0x1968, 0x080c, 0x7920, 0x782c, 0xd09c, 0x090c,
+	0x7de4, 0x0005, 0x9082, 0x005a, 0x1218, 0x2100, 0x003b, 0x0c18,
+	0x080c, 0x7956, 0x0c90, 0x00e3, 0x08f0, 0x0005, 0x7956, 0x7956,
+	0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7978, 0x7956,
+	0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956,
+	0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956,
+	0x7956, 0x7956, 0x7962, 0x7956, 0x7b4b, 0x7956, 0x7956, 0x7956,
+	0x7978, 0x7956, 0x7962, 0x7b8c, 0x7bcd, 0x7c14, 0x7c28, 0x7956,
+	0x7956, 0x7978, 0x7962, 0x798c, 0x7956, 0x7a04, 0x7cd3, 0x7cee,
+	0x7956, 0x7978, 0x7956, 0x798c, 0x7956, 0x7956, 0x79fa, 0x7cee,
+	0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956,
+	0x7956, 0x79a0, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956,
+	0x7956, 0x7956, 0x7956, 0x7e6a, 0x7956, 0x7e14, 0x7956, 0x7e14,
+	0x7956, 0x79b5, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956, 0x7956,
+	0x2079, 0x0040, 0x7004, 0x9086, 0x0003, 0x1198, 0x782c, 0x080c,
+	0x7e0d, 0xd0a4, 0x0170, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806,
+	0xa864, 0x9084, 0x00ff, 0x908a, 0x001a, 0x1210, 0x002b, 0x0c50,
+	0x00e9, 0x080c, 0x7de4, 0x0005, 0x7956, 0x7962, 0x7b37, 0x7956,
+	0x7962, 0x7956, 0x7962, 0x7962, 0x7956, 0x7962, 0x7b37, 0x7962,
+	0x7962, 0x7962, 0x7962, 0x7962, 0x7956, 0x7962, 0x7b37, 0x7956,
+	0x7956, 0x7962, 0x7956, 0x7956, 0x7956, 0x7962, 0x00e6, 0x2071,
+	0x18fa, 0x2009, 0x0400, 0x0071, 0x00ee, 0x0005, 0x2009, 0x1000,
+	0x0049, 0x0005, 0x2009, 0x2000, 0x0029, 0x0005, 0x2009, 0x0800,
+	0x0009, 0x0005, 0x7007, 0x0001, 0xa868, 0x9084, 0x00ff, 0x9105,
+	0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d80, 0x012e, 0x0005,
+	0xa864, 0x8007, 0x9084, 0x00ff, 0x0d08, 0x8001, 0x1120, 0x7007,
+	0x0001, 0x0804, 0x7ad9, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016,
+	0x701a, 0x704b, 0x7ad9, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff,
+	0x0968, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x7af4, 0x7007,
+	0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x7af4, 0x0005,
+	0xa864, 0x8007, 0x9084, 0x00ff, 0x0904, 0x795e, 0x8001, 0x1120,
+	0x7007, 0x0001, 0x0804, 0x7b10, 0x7007, 0x0003, 0x7012, 0x2900,
+	0x7016, 0x701a, 0x704b, 0x7b10, 0x0005, 0xa864, 0x8007, 0x9084,
+	0x00ff, 0x9086, 0x0001, 0x1904, 0x795e, 0x7007, 0x0001, 0x2009,
+	0x1834, 0x210c, 0x81ff, 0x11a8, 0xa868, 0x9084, 0x00ff, 0xa86a,
+	0xa883, 0x0000, 0x080c, 0x62b9, 0x1108, 0x0005, 0x0126, 0x2091,
+	0x8000, 0xa867, 0x0139, 0xa87a, 0xa982, 0x080c, 0x6d80, 0x012e,
+	0x0ca0, 0xa994, 0x9186, 0x0071, 0x0d38, 0x9186, 0x0064, 0x0d20,
+	0x9186, 0x007c, 0x0d08, 0x9186, 0x0028, 0x09f0, 0x9186, 0x0038,
+	0x09d8, 0x9186, 0x0078, 0x09c0, 0x9186, 0x005f, 0x09a8, 0x9186,
+	0x0056, 0x0990, 0xa897, 0x4005, 0xa89b, 0x0001, 0x2001, 0x0030,
+	0x900e, 0x08a0, 0xa87c, 0x9084, 0x00c0, 0x9086, 0x00c0, 0x1120,
+	0x7007, 0x0001, 0x0804, 0x7d05, 0x2900, 0x7016, 0x701a, 0x20a9,
+	0x0004, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0030, 0x2098, 0x7050,
+	0x2040, 0xa060, 0x20e8, 0xa05c, 0x9080, 0x0023, 0x20a0, 0x4003,
+	0xa888, 0x7012, 0x9082, 0x0401, 0x1a04, 0x7966, 0xaab4, 0x928a,
+	0x0002, 0x1a04, 0x7966, 0x82ff, 0x1138, 0xa8b8, 0xa9bc, 0x9105,
+	0x0118, 0x2001, 0x7a97, 0x0018, 0x9280, 0x7a8d, 0x2005, 0x7056,
+	0x7010, 0x9015, 0x0904, 0x7a78, 0x080c, 0x1053, 0x1118, 0x7007,
+	0x0004, 0x0005, 0x2900, 0x7022, 0x7054, 0x2060, 0xe000, 0xa866,
+	0x7050, 0x2040, 0xa95c, 0xe004, 0x9100, 0xa076, 0xa860, 0xa072,
+	0xe008, 0x920a, 0x1210, 0x900e, 0x2200, 0x7112, 0xe20c, 0x8003,
+	0x800b, 0x9296, 0x0004, 0x0108, 0x9108, 0xa17a, 0x810b, 0xa17e,
+	0x080c, 0x1124, 0xa06c, 0x908e, 0x0100, 0x0170, 0x9086, 0x0200,
+	0x0118, 0x7007, 0x0007, 0x0005, 0x7020, 0x2048, 0x080c, 0x106c,
+	0x7014, 0x2048, 0x0804, 0x7966, 0x7020, 0x2048, 0x7018, 0xa802,
+	0xa807, 0x0000, 0x2908, 0x2048, 0xa906, 0x711a, 0x0804, 0x7a30,
+	0x7014, 0x2048, 0x7007, 0x0001, 0xa8b4, 0x9005, 0x1128, 0xa8b8,
+	0xa9bc, 0x9105, 0x0108, 0x00b9, 0xa864, 0x9084, 0x00ff, 0x9086,
+	0x001e, 0x0904, 0x7d05, 0x0804, 0x7ad9, 0x7a8f, 0x7a93, 0x0002,
+	0x001d, 0x0007, 0x0004, 0x000a, 0x001b, 0x0005, 0x0006, 0x000a,
+	0x001d, 0x0005, 0x0004, 0x0076, 0x0066, 0xafb8, 0xaebc, 0xa804,
+	0x2050, 0xb0c0, 0xb0e2, 0xb0bc, 0xb0de, 0xb0b8, 0xb0d2, 0xb0b4,
+	0xb0ce, 0xb6da, 0xb7d6, 0xb0b0, 0xb0ca, 0xb0ac, 0xb0c6, 0xb0a8,
+	0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2, 0xb7be, 0xb0a0, 0xb0b2, 0xb09c,
+	0xb0ae, 0xb098, 0xb0a2, 0xb094, 0xb09e, 0xb6aa, 0xb7a6, 0xb090,
+	0xb09a, 0xb08c, 0xb096, 0xb088, 0xb08a, 0xb084, 0xb086, 0xb692,
+	0xb78e, 0xb080, 0xb082, 0xb07c, 0xb07e, 0xb078, 0xb072, 0xb074,
+	0xb06e, 0xb67a, 0xb776, 0xb004, 0x9055, 0x1958, 0x006e, 0x007e,
+	0x0005, 0x2009, 0x1834, 0x210c, 0x81ff, 0x1178, 0x080c, 0x60bb,
+	0x1108, 0x0005, 0x080c, 0x6fc0, 0x0126, 0x2091, 0x8000, 0x080c,
+	0xcb36, 0x080c, 0x6d80, 0x012e, 0x0ca0, 0x080c, 0xcf4b, 0x1d70,
+	0x2001, 0x0028, 0x900e, 0x0c70, 0x2009, 0x1834, 0x210c, 0x81ff,
+	0x1188, 0xa888, 0x9005, 0x0188, 0xa883, 0x0000, 0x080c, 0x6149,
+	0x1108, 0x0005, 0xa87a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d80,
+	0x012e, 0x0cb8, 0x2001, 0x0028, 0x0ca8, 0x2001, 0x0000, 0x0c90,
+	0x2009, 0x1834, 0x210c, 0x81ff, 0x11d8, 0xa888, 0x9005, 0x01e0,
+	0xa883, 0x0000, 0xa87c, 0xd0f4, 0x0120, 0x080c, 0x621b, 0x1138,
+	0x0005, 0x9006, 0xa87a, 0x080c, 0x6196, 0x1108, 0x0005, 0x0126,
+	0x2091, 0x8000, 0xa87a, 0xa982, 0x080c, 0x6d80, 0x012e, 0x0cb0,
+	0x2001, 0x0028, 0x900e, 0x0c98, 0x2001, 0x0000, 0x0c80, 0x7018,
+	0xa802, 0x2908, 0x2048, 0xa906, 0x711a, 0x7010, 0x8001, 0x7012,
+	0x0118, 0x7007, 0x0003, 0x0030, 0x7014, 0x2048, 0x7007, 0x0001,
+	0x7048, 0x080f, 0x0005, 0x00b6, 0x7007, 0x0001, 0xa974, 0xa878,
+	0x9084, 0x00ff, 0x9096, 0x0004, 0x0540, 0x20a9, 0x0001, 0x9096,
+	0x0001, 0x0190, 0x900e, 0x20a9, 0x0800, 0x9096, 0x0002, 0x0160,
+	0x9005, 0x11d8, 0xa974, 0x080c, 0x6625, 0x11b8, 0x0066, 0xae80,
+	0x080c, 0x6735, 0x006e, 0x0088, 0x0046, 0x2011, 0x180c, 0x2224,
+	0xc484, 0x2412, 0x004e, 0x00c6, 0x080c, 0x6625, 0x1110, 0x080c,
+	0x6904, 0x8108, 0x1f04, 0x7b74, 0x00ce, 0xa87c, 0xd084, 0x1120,
+	0x080c, 0x106c, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6d80, 0x012e, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x7007,
+	0x0001, 0x080c, 0x6a67, 0x0580, 0x2061, 0x1a6f, 0x6100, 0xd184,
+	0x0178, 0xa888, 0x9084, 0x00ff, 0x1550, 0x6000, 0xd084, 0x0520,
+	0x6004, 0x9005, 0x1538, 0x6003, 0x0000, 0x600b, 0x0000, 0x00c8,
+	0x2011, 0x0001, 0xa890, 0x9005, 0x1110, 0x2001, 0x001e, 0x8000,
+	0x6016, 0xa888, 0x9084, 0x00ff, 0x0178, 0x6006, 0xa888, 0x8007,
+	0x9084, 0x00ff, 0x0148, 0x600a, 0xa888, 0x8000, 0x1108, 0xc28d,
+	0x6202, 0x012e, 0x0804, 0x7dce, 0x012e, 0x0804, 0x7dc8, 0x012e,
+	0x0804, 0x7dc2, 0x012e, 0x0804, 0x7dc5, 0x0126, 0x2091, 0x8000,
+	0x7007, 0x0001, 0x080c, 0x6a67, 0x05e0, 0x2061, 0x1a6f, 0x6000,
+	0xd084, 0x05b8, 0x6204, 0x6308, 0xd08c, 0x1530, 0xac78, 0x9484,
+	0x0003, 0x0170, 0xa988, 0x918c, 0x00ff, 0x8001, 0x1120, 0x2100,
+	0x9210, 0x0620, 0x0028, 0x8001, 0x1508, 0x2100, 0x9212, 0x02f0,
+	0x9484, 0x000c, 0x0188, 0xa988, 0x810f, 0x918c, 0x00ff, 0x9082,
+	0x0004, 0x1120, 0x2100, 0x9318, 0x0288, 0x0030, 0x9082, 0x0004,
+	0x1168, 0x2100, 0x931a, 0x0250, 0xa890, 0x9005, 0x0110, 0x8000,
+	0x6016, 0x6206, 0x630a, 0x012e, 0x0804, 0x7dce, 0x012e, 0x0804,
+	0x7dcb, 0x012e, 0x0804, 0x7dc8, 0x0126, 0x2091, 0x8000, 0x7007,
+	0x0001, 0x2061, 0x1a6f, 0x6300, 0xd38c, 0x1120, 0x6308, 0x8318,
+	0x0220, 0x630a, 0x012e, 0x0804, 0x7ddc, 0x012e, 0x0804, 0x7dcb,
+	0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x7007, 0x0001, 0xa87c,
+	0xd0ac, 0x0148, 0x00c6, 0x2061, 0x1a6f, 0x6000, 0x9084, 0xfcff,
+	0x6002, 0x00ce, 0x0440, 0xa888, 0x9005, 0x05d8, 0xa88c, 0x9065,
+	0x0598, 0x2001, 0x1834, 0x2004, 0x9005, 0x0118, 0x080c, 0xac28,
+	0x0068, 0x6017, 0xf400, 0x6063, 0x0000, 0xa97c, 0xd1a4, 0x0110,
+	0xa980, 0x6162, 0x2009, 0x0041, 0x080c, 0xac8c, 0xa988, 0x918c,
+	0xff00, 0x9186, 0x2000, 0x1138, 0x0026, 0x900e, 0x2011, 0xfdff,
+	0x080c, 0x88ec, 0x002e, 0xa87c, 0xd0c4, 0x0148, 0x2061, 0x1a6f,
+	0x6000, 0xd08c, 0x1120, 0x6008, 0x8000, 0x0208, 0x600a, 0x00ce,
+	0x012e, 0x00be, 0x0804, 0x7dce, 0x00ce, 0x012e, 0x00be, 0x0804,
+	0x7dc8, 0xa984, 0x9186, 0x002e, 0x0d30, 0x9186, 0x002d, 0x0d18,
+	0x9186, 0x0045, 0x0510, 0x9186, 0x002a, 0x1130, 0x2001, 0x180c,
+	0x200c, 0xc194, 0x2102, 0x08b8, 0x9186, 0x0020, 0x0158, 0x9186,
+	0x0029, 0x1d10, 0xa974, 0x080c, 0x6625, 0x1968, 0xb800, 0xc0e4,
+	0xb802, 0x0848, 0xa88c, 0x9065, 0x09b8, 0x6007, 0x0024, 0x2001,
+	0x1986, 0x2004, 0x601a, 0x0804, 0x7c63, 0xa88c, 0x9065, 0x0960,
+	0x00e6, 0xa890, 0x9075, 0x2001, 0x1834, 0x2004, 0x9005, 0x0150,
+	0x080c, 0xac28, 0x8eff, 0x0118, 0x2e60, 0x080c, 0xac28, 0x00ee,
+	0x0804, 0x7c63, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60, 0x6007,
+	0x003a, 0xa8a0, 0x9005, 0x0130, 0x6007, 0x003b, 0xa8a4, 0x602e,
+	0xa8a8, 0x6016, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x921e,
+	0x00ee, 0x0804, 0x7c63, 0x2061, 0x1a6f, 0x6000, 0xd084, 0x0190,
+	0xd08c, 0x1904, 0x7ddc, 0x0126, 0x2091, 0x8000, 0x6204, 0x8210,
+	0x0220, 0x6206, 0x012e, 0x0804, 0x7ddc, 0x012e, 0xa883, 0x0016,
+	0x0804, 0x7dd5, 0xa883, 0x0007, 0x0804, 0x7dd5, 0xa864, 0x8007,
+	0x9084, 0x00ff, 0x0130, 0x8001, 0x1138, 0x7007, 0x0001, 0x0069,
+	0x0005, 0x080c, 0x795e, 0x0040, 0x7007, 0x0003, 0x7012, 0x2900,
+	0x7016, 0x701a, 0x704b, 0x7d05, 0x0005, 0x00b6, 0x00e6, 0x0126,
+	0x2091, 0x8000, 0x903e, 0x2061, 0x1800, 0x61d0, 0x81ff, 0x1904,
+	0x7d87, 0x6130, 0xd194, 0x1904, 0x7db1, 0xa878, 0x2070, 0x9e82,
+	0x1ddc, 0x0a04, 0x7d7b, 0x6068, 0x9e02, 0x1a04, 0x7d7b, 0x7120,
+	0x9186, 0x0006, 0x1904, 0x7d6d, 0x7010, 0x905d, 0x0904, 0x7d87,
+	0xb800, 0xd0e4, 0x1904, 0x7dab, 0x2061, 0x1a6f, 0x6100, 0x9184,
+	0x0301, 0x9086, 0x0001, 0x15a0, 0x7024, 0xd0dc, 0x1904, 0x7db4,
+	0xa883, 0x0000, 0xa803, 0x0000, 0x2908, 0x7014, 0x9005, 0x1198,
+	0x7116, 0xa87c, 0xd0f4, 0x1904, 0x7db7, 0x080c, 0x56da, 0xd09c,
+	0x1118, 0xa87c, 0xc0cc, 0xa87e, 0x2e60, 0x080c, 0x87df, 0x012e,
+	0x00ee, 0x00be, 0x0005, 0x2048, 0xa800, 0x9005, 0x1de0, 0xa902,
+	0x2148, 0xa87c, 0xd0f4, 0x1904, 0x7db7, 0x012e, 0x00ee, 0x00be,
+	0x0005, 0x012e, 0x00ee, 0xa883, 0x0006, 0x00be, 0x0804, 0x7dd5,
+	0xd184, 0x0db8, 0xd1c4, 0x1190, 0x00a0, 0xa974, 0x080c, 0x6625,
+	0x15d0, 0xb800, 0xd0e4, 0x15b8, 0x7120, 0x9186, 0x0007, 0x1118,
+	0xa883, 0x0002, 0x0490, 0xa883, 0x0008, 0x0478, 0xa883, 0x000e,
+	0x0460, 0xa883, 0x0017, 0x0448, 0xa883, 0x0035, 0x0430, 0x080c,
+	0x56de, 0xd0fc, 0x01e8, 0xa878, 0x2070, 0x9e82, 0x1ddc, 0x02c0,
+	0x6068, 0x9e02, 0x12a8, 0x7120, 0x9186, 0x0006, 0x1188, 0x7010,
+	0x905d, 0x0170, 0xb800, 0xd0bc, 0x0158, 0x2039, 0x0001, 0x7000,
+	0x9086, 0x0007, 0x1904, 0x7d11, 0x7003, 0x0002, 0x0804, 0x7d11,
+	0xa883, 0x0028, 0x0010, 0xa883, 0x0029, 0x012e, 0x00ee, 0x00be,
+	0x0420, 0xa883, 0x002a, 0x0cc8, 0xa883, 0x0045, 0x0cb0, 0x2e60,
+	0x2019, 0x0002, 0x601b, 0x0014, 0x080c, 0xde1b, 0x012e, 0x00ee,
+	0x00be, 0x0005, 0x2009, 0x003e, 0x0058, 0x2009, 0x0004, 0x0040,
+	0x2009, 0x0006, 0x0028, 0x2009, 0x0016, 0x0010, 0x2009, 0x0001,
+	0xa884, 0x9084, 0xff00, 0x9105, 0xa886, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x6d80, 0x012e, 0x0005, 0x080c, 0x106c, 0x0005, 0x00d6,
+	0x080c, 0x87d6, 0x00de, 0x0005, 0x00d6, 0x00e6, 0x0126, 0x2091,
+	0x8000, 0x2071, 0x0040, 0x702c, 0xd084, 0x01d8, 0x908c, 0x0780,
+	0x190c, 0x7ec6, 0xd09c, 0x11a8, 0x2071, 0x1800, 0x70c0, 0x90ea,
+	0x0020, 0x0278, 0x8001, 0x70c2, 0x702c, 0x2048, 0xa800, 0x702e,
+	0x9006, 0xa802, 0xa806, 0x2071, 0x0040, 0x2900, 0x7022, 0x702c,
+	0x0c28, 0x012e, 0x00ee, 0x00de, 0x0005, 0x0006, 0x9084, 0x0780,
+	0x190c, 0x7ec6, 0x000e, 0x0005, 0xa898, 0x9084, 0x0003, 0x05a8,
+	0x080c, 0xab97, 0x05d8, 0x2900, 0x6016, 0xa864, 0x9084, 0x00ff,
+	0x9086, 0x0035, 0x1138, 0x6028, 0xc0fd, 0x602a, 0x2001, 0x196b,
+	0x2004, 0x0098, 0xa8a0, 0x9084, 0x00ff, 0xa99c, 0x918c, 0xff00,
+	0x9105, 0xa99c, 0x918c, 0x00ff, 0x080c, 0x25fb, 0x1540, 0x00b6,
+	0x080c, 0x6625, 0x2b00, 0x00be, 0x1510, 0x6012, 0x6023, 0x0001,
+	0x2009, 0x0040, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0035, 0x0110,
+	0x2009, 0x0041, 0x080c, 0xac8c, 0x0005, 0xa87b, 0x0101, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x6d80, 0x012e, 0x0005, 0xa87b, 0x002c,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x6d80, 0x012e, 0x0005, 0xa87b,
+	0x0028, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d80, 0x012e, 0x080c,
+	0xabed, 0x0005, 0x00d6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x00b6,
+	0x7007, 0x0001, 0xaa74, 0x9282, 0x0004, 0x1a04, 0x7eb7, 0xa97c,
+	0x9188, 0x1000, 0x2104, 0x905d, 0xb804, 0xd284, 0x0140, 0x05e8,
+	0x8007, 0x9084, 0x00ff, 0x9084, 0x0006, 0x1108, 0x04b0, 0x2b10,
+	0x080c, 0xab97, 0x1118, 0x080c, 0xac5f, 0x05a8, 0x6212, 0xa874,
+	0x0002, 0x7e95, 0x7e9a, 0x7e9d, 0x7ea3, 0x2019, 0x0002, 0x080c,
+	0xe239, 0x0060, 0x080c, 0xe1c9, 0x0048, 0x2019, 0x0002, 0xa980,
+	0x080c, 0xe1e8, 0x0018, 0xa980, 0x080c, 0xe1c9, 0x080c, 0xabed,
+	0xa887, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d80, 0x012e,
+	0x00be, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00de, 0x0005, 0xa887,
+	0x0006, 0x0c80, 0xa887, 0x0002, 0x0c68, 0xa887, 0x0005, 0x0c50,
+	0xa887, 0x0004, 0x0c38, 0xa887, 0x0007, 0x0c20, 0x2091, 0x8000,
+	0x0e04, 0x7ec8, 0x0006, 0x0016, 0x2001, 0x8003, 0x0006, 0x0804,
+	0x0d86, 0x2001, 0x1834, 0x2004, 0x9005, 0x0005, 0x0005, 0x00f6,
+	0x2079, 0x0300, 0x2001, 0x0200, 0x200c, 0xc1e5, 0xc1dc, 0x2102,
+	0x2009, 0x0218, 0x210c, 0xd1ec, 0x1120, 0x080c, 0x1608, 0x00fe,
+	0x0005, 0x2001, 0x020d, 0x2003, 0x0020, 0x781f, 0x0300, 0x00fe,
+	0x0005, 0x781c, 0xd08c, 0x0904, 0x7f49, 0x68c0, 0x90aa, 0x0005,
+	0x0a04, 0x854a, 0x7d44, 0x7c40, 0xd59c, 0x190c, 0x0d7d, 0x9584,
+	0x00f6, 0x1508, 0x9484, 0x7000, 0x0138, 0x908a, 0x2000, 0x1258,
+	0x9584, 0x0700, 0x8007, 0x04f0, 0x7000, 0x9084, 0xff00, 0x9086,
+	0x8100, 0x0db0, 0x00b0, 0x9484, 0x0fff, 0x1130, 0x7000, 0x9084,
+	0xff00, 0x9086, 0x8100, 0x11c0, 0x080c, 0xe6da, 0x080c, 0x8441,
+	0x7817, 0x0140, 0x00a8, 0x9584, 0x0076, 0x1118, 0x080c, 0x849d,
+	0x19c8, 0xd5a4, 0x0148, 0x0046, 0x0056, 0x080c, 0x7f99, 0x080c,
+	0x2115, 0x005e, 0x004e, 0x0020, 0x080c, 0xe6da, 0x7817, 0x0140,
+	0x080c, 0x74e9, 0x0168, 0x2001, 0x0111, 0x2004, 0xd08c, 0x0140,
+	0x6893, 0x0000, 0x2001, 0x0110, 0x2003, 0x0008, 0x2003, 0x0000,
+	0x0489, 0x0005, 0x0002, 0x7f56, 0x8263, 0x7f53, 0x7f53, 0x7f53,
+	0x7f53, 0x7f53, 0x7f53, 0x7817, 0x0140, 0x0005, 0x7000, 0x908c,
+	0xff00, 0x9194, 0xf000, 0x810f, 0x9484, 0x0fff, 0x6892, 0x9286,
+	0x2000, 0x1150, 0x6800, 0x9086, 0x0001, 0x1118, 0x080c, 0x573b,
+	0x0070, 0x080c, 0x7fb9, 0x0058, 0x9286, 0x3000, 0x1118, 0x080c,
+	0x81a0, 0x0028, 0x9286, 0x8000, 0x1110, 0x080c, 0x8377, 0x7817,
+	0x0140, 0x0005, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0178, 0x2001,
+	0x1800, 0x2004, 0x9086, 0x0003, 0x1148, 0x0026, 0x0036, 0x2011,
+	0x8048, 0x2518, 0x080c, 0x4b07, 0x003e, 0x002e, 0x0005, 0x0036,
+	0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x2019, 0xfffe, 0x7c30,
+	0x0050, 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x7d44,
+	0x7c40, 0x2019, 0xffff, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0160,
+	0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1130, 0x0026, 0x2011,
+	0x8048, 0x080c, 0x4b07, 0x002e, 0x00fe, 0x005e, 0x004e, 0x003e,
+	0x0005, 0x00b6, 0x00c6, 0x7010, 0x9084, 0xff00, 0x8007, 0x9096,
+	0x0001, 0x0120, 0x9096, 0x0023, 0x1904, 0x8171, 0x9186, 0x0023,
+	0x15c0, 0x080c, 0x840c, 0x0904, 0x8171, 0x6120, 0x9186, 0x0001,
+	0x0150, 0x9186, 0x0004, 0x0138, 0x9186, 0x0008, 0x0120, 0x9186,
+	0x000a, 0x1904, 0x8171, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200,
+	0x1130, 0x2009, 0x0015, 0x080c, 0xac8c, 0x0804, 0x8171, 0x908e,
+	0x0214, 0x0118, 0x908e, 0x0210, 0x1130, 0x2009, 0x0015, 0x080c,
+	0xac8c, 0x0804, 0x8171, 0x908e, 0x0100, 0x1904, 0x8171, 0x7034,
+	0x9005, 0x1904, 0x8171, 0x2009, 0x0016, 0x080c, 0xac8c, 0x0804,
+	0x8171, 0x9186, 0x0022, 0x1904, 0x8171, 0x7030, 0x908e, 0x0300,
+	0x1580, 0x68dc, 0xd0a4, 0x0528, 0xc0b5, 0x68de, 0x7100, 0x918c,
+	0x00ff, 0x697e, 0x7004, 0x6882, 0x00f6, 0x2079, 0x0100, 0x79e6,
+	0x78ea, 0x0006, 0x9084, 0x00ff, 0x0016, 0x2008, 0x080c, 0x2644,
+	0x7932, 0x7936, 0x001e, 0x000e, 0x00fe, 0x080c, 0x25fb, 0x695e,
+	0x703c, 0x00e6, 0x2071, 0x0140, 0x7086, 0x2071, 0x1800, 0x70b6,
+	0x00ee, 0x7034, 0x9005, 0x1904, 0x8171, 0x2009, 0x0017, 0x0804,
+	0x8121, 0x908e, 0x0400, 0x1190, 0x7034, 0x9005, 0x1904, 0x8171,
+	0x080c, 0x74e9, 0x0120, 0x2009, 0x001d, 0x0804, 0x8121, 0x68dc,
+	0xc0a5, 0x68de, 0x2009, 0x0030, 0x0804, 0x8121, 0x908e, 0x0500,
+	0x1140, 0x7034, 0x9005, 0x1904, 0x8171, 0x2009, 0x0018, 0x0804,
+	0x8121, 0x908e, 0x2010, 0x1120, 0x2009, 0x0019, 0x0804, 0x8121,
+	0x908e, 0x2110, 0x1120, 0x2009, 0x001a, 0x0804, 0x8121, 0x908e,
+	0x5200, 0x1140, 0x7034, 0x9005, 0x1904, 0x8171, 0x2009, 0x001b,
+	0x0804, 0x8121, 0x908e, 0x5000, 0x1140, 0x7034, 0x9005, 0x1904,
+	0x8171, 0x2009, 0x001c, 0x0804, 0x8121, 0x908e, 0x1300, 0x1120,
+	0x2009, 0x0034, 0x0804, 0x8121, 0x908e, 0x1200, 0x1140, 0x7034,
+	0x9005, 0x1904, 0x8171, 0x2009, 0x0024, 0x0804, 0x8121, 0x908c,
+	0xff00, 0x918e, 0x2400, 0x1170, 0x2009, 0x002d, 0x2001, 0x1810,
+	0x2004, 0xd09c, 0x0904, 0x8121, 0x080c, 0xd64f, 0x1904, 0x8171,
+	0x0804, 0x811f, 0x908c, 0xff00, 0x918e, 0x5300, 0x1120, 0x2009,
+	0x002a, 0x0804, 0x8121, 0x908e, 0x0f00, 0x1120, 0x2009, 0x0020,
+	0x0804, 0x8121, 0x908e, 0x6104, 0x1530, 0x2029, 0x0205, 0x2011,
+	0x026d, 0x8208, 0x2204, 0x9082, 0x0004, 0x8004, 0x8004, 0x20a8,
+	0x2011, 0x8015, 0x211c, 0x8108, 0x0046, 0x2124, 0x080c, 0x4b07,
+	0x004e, 0x8108, 0x0f04, 0x80d5, 0x9186, 0x0280, 0x1d88, 0x2504,
+	0x8000, 0x202a, 0x2009, 0x0260, 0x0c58, 0x202b, 0x0000, 0x2009,
+	0x0023, 0x0804, 0x8121, 0x908e, 0x6000, 0x1120, 0x2009, 0x003f,
+	0x0804, 0x8121, 0x908e, 0x5400, 0x1138, 0x080c, 0x84fa, 0x1904,
+	0x8171, 0x2009, 0x0046, 0x04a8, 0x908e, 0x5500, 0x1148, 0x080c,
+	0x8522, 0x1118, 0x2009, 0x0041, 0x0460, 0x2009, 0x0042, 0x0448,
+	0x908e, 0x7800, 0x1118, 0x2009, 0x0045, 0x0418, 0x908e, 0x1000,
+	0x1118, 0x2009, 0x004e, 0x00e8, 0x908e, 0x6300, 0x1118, 0x2009,
+	0x004a, 0x00b8, 0x908c, 0xff00, 0x918e, 0x5600, 0x1118, 0x2009,
+	0x004f, 0x0078, 0x908c, 0xff00, 0x918e, 0x5700, 0x1118, 0x2009,
+	0x0050, 0x0038, 0x2009, 0x001d, 0x6838, 0xd0d4, 0x0110, 0x2009,
+	0x004c, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
+	0x25fb, 0x1904, 0x8174, 0x080c, 0x65c4, 0x1904, 0x8174, 0xbe12,
+	0xbd16, 0x001e, 0x0016, 0x080c, 0x74e9, 0x01c0, 0x68dc, 0xd08c,
+	0x1148, 0x7000, 0x9084, 0x00ff, 0x1188, 0x7004, 0x9084, 0xff00,
+	0x1168, 0x0040, 0x687c, 0x9606, 0x1148, 0x6880, 0x9506, 0x9084,
+	0xff00, 0x1120, 0x9584, 0x00ff, 0xb886, 0x0080, 0xb884, 0x9005,
+	0x1168, 0x9186, 0x0046, 0x1150, 0x687c, 0x9606, 0x1138, 0x6880,
+	0x9506, 0x9084, 0xff00, 0x1110, 0x001e, 0x0098, 0x080c, 0xab97,
+	0x01a8, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e,
+	0x9186, 0x004c, 0x1110, 0x6023, 0x000a, 0x0016, 0x001e, 0x080c,
+	0xac8c, 0x00ce, 0x00be, 0x0005, 0x001e, 0x0cd8, 0x2001, 0x180e,
+	0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4b07, 0x080c,
+	0xac5f, 0x0d90, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a,
+	0x001e, 0x0016, 0x9186, 0x0017, 0x0118, 0x9186, 0x0030, 0x1128,
+	0x6007, 0x0009, 0x6017, 0x2900, 0x0020, 0x6007, 0x0051, 0x6017,
+	0x0000, 0x602f, 0x0009, 0x6003, 0x0001, 0x080c, 0x9225, 0x08a0,
+	0x080c, 0x3332, 0x1140, 0x7010, 0x9084, 0xff00, 0x8007, 0x908e,
+	0x0008, 0x1108, 0x0009, 0x0005, 0x00b6, 0x00c6, 0x0046, 0x7000,
+	0x908c, 0xff00, 0x810f, 0x9186, 0x0033, 0x11e8, 0x080c, 0x840c,
+	0x0904, 0x81fb, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200, 0x1140,
+	0x7034, 0x9005, 0x15c0, 0x2009, 0x0015, 0x080c, 0xac8c, 0x0498,
+	0x908e, 0x0100, 0x1580, 0x7034, 0x9005, 0x1568, 0x2009, 0x0016,
+	0x080c, 0xac8c, 0x0440, 0x9186, 0x0032, 0x1528, 0x7030, 0x908e,
+	0x1400, 0x1508, 0x2009, 0x0038, 0x0016, 0x2011, 0x0263, 0x2204,
+	0x8211, 0x220c, 0x080c, 0x25fb, 0x11a8, 0x080c, 0x65c4, 0x1190,
+	0xbe12, 0xbd16, 0x080c, 0xab97, 0x0168, 0x2b08, 0x6112, 0x080c,
+	0xcccc, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x080c, 0xac8c,
+	0x0010, 0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be, 0x0005, 0x00b6,
+	0x0046, 0x00e6, 0x00d6, 0x2028, 0x2130, 0x9696, 0x00ff, 0x11b8,
+	0x9592, 0xfffc, 0x02a0, 0x9596, 0xfffd, 0x1120, 0x2009, 0x007f,
+	0x0804, 0x825d, 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e, 0x0804,
+	0x825d, 0x9596, 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0, 0x2011,
+	0x0000, 0x2019, 0x1837, 0x231c, 0xd3ac, 0x0130, 0x9026, 0x20a9,
+	0x0800, 0x2071, 0x1000, 0x0030, 0x2021, 0x0081, 0x20a9, 0x077f,
+	0x2071, 0x1081, 0x2e1c, 0x93dd, 0x0000, 0x1140, 0x82ff, 0x11d0,
+	0x9496, 0x00ff, 0x01b8, 0x2410, 0xc2fd, 0x00a0, 0xbf10, 0x2600,
+	0x9706, 0xb814, 0x1120, 0x9546, 0x1110, 0x2408, 0x00b0, 0x9745,
+	0x1148, 0x94c6, 0x007e, 0x0130, 0x94c6, 0x007f, 0x0118, 0x94c6,
+	0x0080, 0x1d20, 0x8420, 0x8e70, 0x1f04, 0x8232, 0x82ff, 0x1118,
+	0x9085, 0x0001, 0x0018, 0xc2fc, 0x2208, 0x9006, 0x00de, 0x00ee,
+	0x004e, 0x00be, 0x0005, 0x7000, 0x908c, 0xff00, 0x810f, 0x9184,
+	0x000f, 0x0002, 0x827a, 0x827a, 0x827a, 0x841e, 0x827a, 0x827d,
+	0x82a2, 0x832b, 0x827a, 0x827a, 0x827a, 0x827a, 0x827a, 0x827a,
+	0x827a, 0x827a, 0x7817, 0x0140, 0x0005, 0x00b6, 0x7110, 0xd1bc,
+	0x01e8, 0x7120, 0x2160, 0x9c8c, 0x0003, 0x11c0, 0x9c8a, 0x1ddc,
+	0x02a8, 0x6868, 0x9c02, 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110,
+	0x2158, 0xb910, 0x9106, 0x1150, 0x700c, 0xb914, 0x9106, 0x1130,
+	0x7124, 0x610a, 0x2009, 0x0046, 0x080c, 0xac8c, 0x7817, 0x0140,
+	0x00be, 0x0005, 0x00b6, 0x00c6, 0x9484, 0x0fff, 0x0904, 0x8307,
+	0x7110, 0xd1bc, 0x1904, 0x8307, 0x7108, 0x700c, 0x2028, 0x918c,
+	0x00ff, 0x2130, 0x9094, 0xff00, 0x15c8, 0x81ff, 0x15b8, 0x9080,
+	0x3374, 0x200d, 0x918c, 0xff00, 0x810f, 0x2001, 0x0080, 0x9106,
+	0x0904, 0x8307, 0x9182, 0x0801, 0x1a04, 0x8307, 0x9190, 0x1000,
+	0x2204, 0x905d, 0x05e0, 0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15b8,
+	0xba04, 0x9294, 0xff00, 0x9286, 0x0600, 0x1190, 0x080c, 0xab97,
+	0x0598, 0x2b08, 0x7028, 0x6052, 0x702c, 0x604e, 0x6112, 0x6023,
+	0x0006, 0x7120, 0x610a, 0x7130, 0x615e, 0x080c, 0xd8b5, 0x00f8,
+	0x080c, 0x6a6b, 0x1138, 0xb807, 0x0606, 0x0c40, 0x190c, 0x81ff,
+	0x11b0, 0x0880, 0x080c, 0xab97, 0x2b08, 0x0188, 0x6112, 0x6023,
+	0x0004, 0x7120, 0x610a, 0x9286, 0x0400, 0x1118, 0x6007, 0x0005,
+	0x0010, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9225, 0x7817,
+	0x0140, 0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0ec,
+	0x0120, 0x2011, 0x8049, 0x080c, 0x4b07, 0x080c, 0xac5f, 0x0d78,
+	0x2b08, 0x6112, 0x6023, 0x0006, 0x7120, 0x610a, 0x7130, 0x615e,
+	0x6017, 0xf300, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009, 0xa022,
+	0x080c, 0x921e, 0x08e0, 0x00b6, 0x7110, 0xd1bc, 0x05d0, 0x7020,
+	0x2060, 0x9c84, 0x0003, 0x15a8, 0x9c82, 0x1ddc, 0x0690, 0x6868,
+	0x9c02, 0x1678, 0x9484, 0x0fff, 0x9082, 0x000c, 0x0650, 0x7008,
+	0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1510, 0x700c,
+	0xb914, 0x9106, 0x11f0, 0x7124, 0x610a, 0x601c, 0xd0fc, 0x11c8,
+	0x2001, 0x0271, 0x2004, 0x9005, 0x1180, 0x9484, 0x0fff, 0x9082,
+	0x000c, 0x0158, 0x0066, 0x2031, 0x0100, 0xa001, 0xa001, 0x8631,
+	0x1de0, 0x006e, 0x601c, 0xd0fc, 0x1120, 0x2009, 0x0045, 0x080c,
+	0xac8c, 0x7817, 0x0140, 0x00be, 0x0005, 0x6120, 0x9186, 0x0002,
+	0x0128, 0x9186, 0x0005, 0x0110, 0x9085, 0x0001, 0x0005, 0x080c,
+	0x3332, 0x1168, 0x7010, 0x9084, 0xff00, 0x8007, 0x9086, 0x0000,
+	0x1130, 0x9184, 0x000f, 0x908a, 0x0006, 0x1208, 0x000b, 0x0005,
+	0x838e, 0x838f, 0x838e, 0x838e, 0x83ee, 0x83fd, 0x0005, 0x00b6,
+	0x7110, 0xd1bc, 0x0120, 0x702c, 0xd084, 0x0904, 0x83ec, 0x700c,
+	0x7108, 0x080c, 0x25fb, 0x1904, 0x83ec, 0x080c, 0x65c4, 0x1904,
+	0x83ec, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x01d8, 0x080c, 0x6a6b,
+	0x0118, 0x9086, 0x0004, 0x1588, 0x00c6, 0x080c, 0x840c, 0x00ce,
+	0x05d8, 0x080c, 0xab97, 0x2b08, 0x05b8, 0x6112, 0x080c, 0xcccc,
+	0x6023, 0x0002, 0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0xac8c,
+	0x0458, 0x080c, 0x6a6b, 0x0148, 0x9086, 0x0004, 0x0130, 0x080c,
+	0x6a73, 0x0118, 0x9086, 0x0004, 0x1180, 0x080c, 0xab97, 0x2b08,
+	0x01d8, 0x6112, 0x080c, 0xcccc, 0x6023, 0x0005, 0x7120, 0x610a,
+	0x2009, 0x0088, 0x080c, 0xac8c, 0x0078, 0x080c, 0xab97, 0x2b08,
+	0x0158, 0x6112, 0x080c, 0xcccc, 0x6023, 0x0004, 0x7120, 0x610a,
+	0x2009, 0x0001, 0x080c, 0xac8c, 0x00be, 0x0005, 0x7110, 0xd1bc,
+	0x0158, 0x00d1, 0x0148, 0x080c, 0x836d, 0x1130, 0x7124, 0x610a,
+	0x2009, 0x0089, 0x080c, 0xac8c, 0x0005, 0x7110, 0xd1bc, 0x0158,
+	0x0059, 0x0148, 0x080c, 0x836d, 0x1130, 0x7124, 0x610a, 0x2009,
+	0x008a, 0x080c, 0xac8c, 0x0005, 0x7020, 0x2060, 0x9c84, 0x0003,
+	0x1158, 0x9c82, 0x1ddc, 0x0240, 0x2001, 0x181a, 0x2004, 0x9c02,
+	0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x00b6, 0x7110,
+	0xd1bc, 0x11d8, 0x7024, 0x2060, 0x9c84, 0x0003, 0x11b0, 0x9c82,
+	0x1ddc, 0x0298, 0x6868, 0x9c02, 0x1280, 0x7008, 0x9084, 0x00ff,
+	0x6110, 0x2158, 0xb910, 0x9106, 0x1140, 0x700c, 0xb914, 0x9106,
+	0x1120, 0x2009, 0x0051, 0x080c, 0xac8c, 0x7817, 0x0140, 0x00be,
+	0x0005, 0x2031, 0x0105, 0x0069, 0x0005, 0x2031, 0x0206, 0x0049,
+	0x0005, 0x2031, 0x0207, 0x0029, 0x0005, 0x2031, 0x0213, 0x0009,
+	0x0005, 0x00c6, 0x0096, 0x00f6, 0x7000, 0x9084, 0xf000, 0x9086,
+	0xc000, 0x05c0, 0x080c, 0xab97, 0x05a8, 0x0066, 0x00c6, 0x0046,
+	0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x25fb, 0x1590,
+	0x080c, 0x65c4, 0x1578, 0xbe12, 0xbd16, 0x2b00, 0x004e, 0x00ce,
+	0x6012, 0x080c, 0xcccc, 0x080c, 0x103a, 0x0500, 0x2900, 0x6062,
+	0x9006, 0xa802, 0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b, 0x20a9,
+	0x000e, 0xa860, 0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98, 0x4003,
+	0x006e, 0x6616, 0x6007, 0x003e, 0x6023, 0x0001, 0x6003, 0x0001,
+	0x080c, 0x9225, 0x00fe, 0x009e, 0x00ce, 0x0005, 0x080c, 0xabed,
+	0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6, 0x7000, 0x908c,
+	0xff00, 0x9184, 0xf000, 0x810f, 0x9086, 0x2000, 0x1904, 0x84f4,
+	0x9186, 0x0022, 0x15f0, 0x2001, 0x0111, 0x2004, 0x9005, 0x1904,
+	0x84f6, 0x7030, 0x908e, 0x0400, 0x0904, 0x84f6, 0x908e, 0x6000,
+	0x05e8, 0x908e, 0x5400, 0x05d0, 0x908e, 0x0300, 0x11d8, 0x2009,
+	0x1837, 0x210c, 0xd18c, 0x1590, 0xd1a4, 0x1580, 0x080c, 0x6a29,
+	0x0558, 0x68b0, 0x9084, 0x00ff, 0x7100, 0x918c, 0x00ff, 0x9106,
+	0x1518, 0x6880, 0x69b0, 0x918c, 0xff00, 0x9105, 0x7104, 0x9106,
+	0x11d8, 0x00e0, 0x2009, 0x0103, 0x210c, 0xd1b4, 0x11a8, 0x908e,
+	0x5200, 0x09e8, 0x908e, 0x0500, 0x09d0, 0x908e, 0x5000, 0x09b8,
+	0x0058, 0x9186, 0x0023, 0x1140, 0x080c, 0x840c, 0x0128, 0x6004,
+	0x9086, 0x0002, 0x0118, 0x0000, 0x9006, 0x0010, 0x9085, 0x0001,
+	0x00ce, 0x0005, 0x0156, 0x0046, 0x0016, 0x0036, 0x7038, 0x2020,
+	0x8427, 0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004, 0x2019,
+	0x1805, 0x2011, 0x027a, 0x080c, 0xbbae, 0x1178, 0xd48c, 0x0148,
+	0x20a9, 0x0004, 0x2019, 0x1801, 0x2011, 0x027e, 0x080c, 0xbbae,
+	0x1120, 0xd494, 0x0110, 0x9085, 0x0001, 0x003e, 0x001e, 0x004e,
+	0x015e, 0x0005, 0x0156, 0x0046, 0x0016, 0x0036, 0x7038, 0x2020,
+	0x8427, 0x94a4, 0x0007, 0xd484, 0x0148, 0x20a9, 0x0004, 0x2019,
+	0x1805, 0x2011, 0x0272, 0x080c, 0xbbae, 0x1178, 0xd48c, 0x0148,
+	0x20a9, 0x0004, 0x2019, 0x1801, 0x2011, 0x0276, 0x080c, 0xbbae,
+	0x1120, 0xd494, 0x0110, 0x9085, 0x0001, 0x003e, 0x001e, 0x004e,
+	0x015e, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7800, 0xc0e5, 0xc0cc,
+	0x7802, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x1800, 0x7834, 0xd084,
+	0x1130, 0x2079, 0x0200, 0x7800, 0x9085, 0x1200, 0x7802, 0x00fe,
+	0x0005, 0x00e6, 0x2071, 0x1800, 0x7034, 0xc084, 0x7036, 0x00ee,
+	0x0005, 0x2071, 0x1a03, 0x7003, 0x0003, 0x700f, 0x0361, 0x9006,
+	0x701a, 0x7072, 0x7012, 0x7017, 0x1ddc, 0x7007, 0x0000, 0x7026,
+	0x702b, 0x9e54, 0x7032, 0x7037, 0x9ed1, 0x703f, 0xffff, 0x7042,
+	0x7047, 0x5571, 0x704a, 0x705b, 0x8711, 0x080c, 0x1053, 0x090c,
+	0x0d7d, 0x2900, 0x703a, 0xa867, 0x0003, 0xa86f, 0x0100, 0xa8ab,
+	0xdcb0, 0x0005, 0x2071, 0x1a03, 0x1d04, 0x862d, 0x2091, 0x6000,
+	0x700c, 0x8001, 0x700e, 0x1590, 0x2001, 0x013c, 0x2004, 0x9005,
+	0x190c, 0x87bb, 0x2001, 0x1869, 0x2004, 0xd0c4, 0x0158, 0x3a00,
+	0xd08c, 0x1140, 0x20d1, 0x0000, 0x20d1, 0x0001, 0x20d1, 0x0000,
+	0x080c, 0x0d7d, 0x700f, 0x0361, 0x7007, 0x0001, 0x0126, 0x2091,
+	0x8000, 0x2069, 0x1800, 0x69ec, 0xd1e4, 0x1138, 0xd1dc, 0x1118,
+	0x080c, 0x877f, 0x0010, 0x080c, 0x8756, 0x7040, 0x900d, 0x0148,
+	0x8109, 0x7142, 0x1130, 0x7044, 0x080f, 0x0018, 0x0126, 0x2091,
+	0x8000, 0x7024, 0x900d, 0x0188, 0x7020, 0x8001, 0x7022, 0x1168,
+	0x7023, 0x0009, 0x8109, 0x7126, 0x9186, 0x03e8, 0x1110, 0x7028,
+	0x080f, 0x81ff, 0x1110, 0x7028, 0x080f, 0x7030, 0x900d, 0x0180,
+	0x702c, 0x8001, 0x702e, 0x1160, 0x702f, 0x0009, 0x8109, 0x7132,
+	0x0128, 0x9184, 0x007f, 0x090c, 0x9f6d, 0x0010, 0x7034, 0x080f,
+	0x703c, 0x9005, 0x0118, 0x0310, 0x8001, 0x703e, 0x704c, 0x900d,
+	0x0168, 0x7048, 0x8001, 0x704a, 0x1148, 0x704b, 0x0009, 0x8109,
+	0x714e, 0x1120, 0x7150, 0x714e, 0x7058, 0x080f, 0x7018, 0x900d,
+	0x01d8, 0x0016, 0x7070, 0x900d, 0x0158, 0x706c, 0x8001, 0x706e,
+	0x1138, 0x706f, 0x0009, 0x8109, 0x7172, 0x1110, 0x7074, 0x080f,
+	0x001e, 0x7008, 0x8001, 0x700a, 0x1138, 0x700b, 0x0009, 0x8109,
+	0x711a, 0x1110, 0x701c, 0x080f, 0x012e, 0x7004, 0x0002, 0x8655,
+	0x8656, 0x8680, 0x00e6, 0x2071, 0x1a03, 0x7018, 0x9005, 0x1120,
+	0x711a, 0x721e, 0x700b, 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006,
+	0x2071, 0x1a03, 0x701c, 0x9206, 0x1120, 0x701a, 0x701e, 0x7072,
+	0x7076, 0x000e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1a03, 0xb888,
+	0x9102, 0x0208, 0xb98a, 0x00ee, 0x0005, 0x0005, 0x00b6, 0x2031,
+	0x0010, 0x7110, 0x080c, 0x6625, 0x11a8, 0xb888, 0x8001, 0x0290,
+	0xb88a, 0x1180, 0x0126, 0x2091, 0x8000, 0x0066, 0xb8d0, 0x9005,
+	0x0138, 0x0026, 0xba3c, 0x0016, 0x080c, 0x6750, 0x001e, 0x002e,
+	0x006e, 0x012e, 0x8108, 0x9182, 0x0800, 0x1220, 0x8631, 0x0128,
+	0x7112, 0x0c00, 0x900e, 0x7007, 0x0002, 0x7112, 0x00be, 0x0005,
+	0x2031, 0x0010, 0x7014, 0x2060, 0x0126, 0x2091, 0x8000, 0x6048,
+	0x9005, 0x0128, 0x8001, 0x604a, 0x1110, 0x080c, 0xcb4d, 0x6018,
+	0x9005, 0x0904, 0x86d8, 0x00f6, 0x2079, 0x0300, 0x7918, 0xd1b4,
+	0x1904, 0x86eb, 0x781b, 0x2020, 0xa001, 0x7918, 0xd1b4, 0x0120,
+	0x781b, 0x2000, 0x0804, 0x86eb, 0x8001, 0x601a, 0x0106, 0x781b,
+	0x2000, 0xa001, 0x7918, 0xd1ac, 0x1dd0, 0x010e, 0x00fe, 0x1540,
+	0x6120, 0x9186, 0x0003, 0x0148, 0x9186, 0x0006, 0x0130, 0x9186,
+	0x0009, 0x11e0, 0x611c, 0xd1c4, 0x1100, 0x080c, 0xc838, 0x01b0,
+	0x6014, 0x2048, 0xa884, 0x908a, 0x199a, 0x0280, 0x9082, 0x1999,
+	0xa886, 0x908a, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003, 0x800b,
+	0x810b, 0x9108, 0x611a, 0x080c, 0xcf7e, 0x0110, 0x080c, 0xc536,
+	0x012e, 0x9c88, 0x001c, 0x7116, 0x2001, 0x181a, 0x2004, 0x9102,
+	0x1228, 0x8631, 0x0138, 0x2160, 0x0804, 0x8684, 0x7017, 0x1ddc,
+	0x7007, 0x0000, 0x0005, 0x00fe, 0x0c58, 0x00e6, 0x2071, 0x1a03,
+	0x7027, 0x07d0, 0x7023, 0x0009, 0x00ee, 0x0005, 0x2001, 0x1a0c,
+	0x2003, 0x0000, 0x0005, 0x00e6, 0x2071, 0x1a03, 0x7132, 0x702f,
+	0x0009, 0x00ee, 0x0005, 0x2011, 0x1a0f, 0x2013, 0x0000, 0x0005,
+	0x00e6, 0x2071, 0x1a03, 0x711a, 0x721e, 0x700b, 0x0009, 0x00ee,
+	0x0005, 0x0086, 0x0026, 0x7054, 0x8000, 0x7056, 0x2001, 0x1a11,
+	0x2044, 0xa06c, 0x9086, 0x0000, 0x0150, 0x7068, 0xa09a, 0x7064,
+	0xa096, 0x7060, 0xa092, 0x705c, 0xa08e, 0x080c, 0x1124, 0x002e,
+	0x008e, 0x0005, 0x0006, 0x0016, 0x0096, 0x00a6, 0x00b6, 0x00c6,
+	0x00d6, 0x00e6, 0x00f6, 0x0156, 0x080c, 0x8592, 0x015e, 0x00fe,
+	0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x001e, 0x000e,
+	0x0005, 0x00e6, 0x2071, 0x1a03, 0x7172, 0x7276, 0x706f, 0x0009,
+	0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071, 0x1a03, 0x7074, 0x9206,
+	0x1110, 0x7072, 0x7076, 0x000e, 0x00ee, 0x0005, 0x2069, 0x1800,
+	0x69ec, 0xd1e4, 0x1518, 0x0026, 0xd1ec, 0x0140, 0x6a54, 0x6874,
+	0x9202, 0x0288, 0x8117, 0x9294, 0x00c1, 0x0088, 0x9184, 0x0007,
+	0x01a0, 0x8109, 0x9184, 0x0007, 0x0110, 0x69ee, 0x0070, 0x8107,
+	0x9084, 0x0007, 0x910d, 0x8107, 0x9106, 0x9094, 0x00c1, 0x9184,
+	0xff3e, 0x9205, 0x68ee, 0x080c, 0x0f05, 0x002e, 0x0005, 0x69e8,
+	0x9184, 0x003f, 0x05b8, 0x8109, 0x9184, 0x003f, 0x01a8, 0x6a54,
+	0x6874, 0x9202, 0x0220, 0xd1bc, 0x0168, 0xc1bc, 0x0018, 0xd1bc,
+	0x1148, 0xc1bd, 0x2110, 0x00e6, 0x2071, 0x1800, 0x080c, 0x0f27,
+	0x00ee, 0x0400, 0x69ea, 0x00f0, 0x0026, 0x8107, 0x9094, 0x0007,
+	0x0128, 0x8001, 0x8007, 0x9085, 0x0007, 0x0050, 0x2010, 0x8004,
+	0x8004, 0x8004, 0x9084, 0x0007, 0x9205, 0x8007, 0x9085, 0x0028,
+	0x9086, 0x0040, 0x2010, 0x00e6, 0x2071, 0x1800, 0x080c, 0x0f27,
+	0x00ee, 0x002e, 0x0005, 0x0016, 0x00c6, 0x2009, 0xfffc, 0x210d,
+	0x2061, 0x0100, 0x60f0, 0x9100, 0x60f3, 0x0000, 0x2009, 0xfffc,
+	0x200f, 0x1220, 0x8108, 0x2105, 0x8000, 0x200f, 0x00ce, 0x001e,
+	0x0005, 0x00c6, 0x2061, 0x1a6f, 0x00ce, 0x0005, 0x9184, 0x000f,
+	0x8003, 0x8003, 0x8003, 0x9080, 0x1a6f, 0x2060, 0x0005, 0xa884,
+	0x908a, 0x199a, 0x1638, 0x9005, 0x1150, 0x00c6, 0x2061, 0x1a6f,
+	0x6014, 0x00ce, 0x9005, 0x1130, 0x2001, 0x001e, 0x0018, 0x908e,
+	0xffff, 0x01b0, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0xa87c,
+	0x908c, 0x00c0, 0x918e, 0x00c0, 0x0904, 0x8896, 0xd0b4, 0x1168,
+	0xd0bc, 0x1904, 0x886f, 0x2009, 0x0006, 0x080c, 0x88c3, 0x0005,
+	0x900e, 0x0c60, 0x2001, 0x1999, 0x08b0, 0xd0fc, 0x05c8, 0x908c,
+	0x2023, 0x1550, 0x87ff, 0x1540, 0x6124, 0x918c, 0x0500, 0x1520,
+	0x6100, 0x918e, 0x0007, 0x1500, 0x2009, 0x1869, 0x210c, 0xd184,
+	0x11d8, 0x6003, 0x0003, 0x6007, 0x0043, 0x6047, 0xb035, 0x080c,
+	0x1c03, 0xa87c, 0xc0dd, 0xa87e, 0x600f, 0x0000, 0x00f6, 0x2079,
+	0x0380, 0x7818, 0xd0bc, 0x1de8, 0x7833, 0x0013, 0x2c00, 0x7836,
+	0x781b, 0x8080, 0x00fe, 0x0005, 0x908c, 0x0003, 0x0120, 0x918e,
+	0x0003, 0x1904, 0x88bd, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8,
+	0x6024, 0xd0d4, 0x11e8, 0x2009, 0x1869, 0x2104, 0xd084, 0x1138,
+	0x87ff, 0x1120, 0x2009, 0x0043, 0x0804, 0xac8c, 0x0005, 0x87ff,
+	0x1de8, 0x2009, 0x0042, 0x0804, 0xac8c, 0x6110, 0x00b6, 0x2158,
+	0xb900, 0x00be, 0xd1ac, 0x0d20, 0x6024, 0xc0cd, 0x6026, 0x0c00,
+	0xc0d4, 0x6026, 0xa890, 0x602e, 0xa88c, 0x6032, 0x08e0, 0xd0fc,
+	0x0160, 0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x88bd,
+	0x908c, 0x2020, 0x918e, 0x2020, 0x0170, 0x0076, 0x00f6, 0x2c78,
+	0x080c, 0x1731, 0x00fe, 0x007e, 0x87ff, 0x1120, 0x2009, 0x0042,
+	0x080c, 0xac8c, 0x0005, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be,
+	0xd1ac, 0x0d58, 0x6124, 0xc1cd, 0x6126, 0x0c38, 0xd0fc, 0x0188,
+	0x908c, 0x2020, 0x918e, 0x2020, 0x01a8, 0x9084, 0x0003, 0x908e,
+	0x0002, 0x0148, 0x87ff, 0x1120, 0x2009, 0x0041, 0x080c, 0xac8c,
+	0x0005, 0x00b9, 0x0ce8, 0x87ff, 0x1dd8, 0x2009, 0x0043, 0x080c,
+	0xac8c, 0x0cb0, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac,
+	0x0d20, 0x6124, 0xc1cd, 0x6126, 0x0c00, 0x2009, 0x0004, 0x0019,
+	0x0005, 0x2009, 0x0001, 0x0096, 0x080c, 0xc838, 0x0518, 0x6014,
+	0x2048, 0xa982, 0xa800, 0x6016, 0x9186, 0x0001, 0x1188, 0xa97c,
+	0x918c, 0x8100, 0x918e, 0x8100, 0x1158, 0x00c6, 0x2061, 0x1a6f,
+	0x6200, 0xd28c, 0x1120, 0x6204, 0x8210, 0x0208, 0x6206, 0x00ce,
+	0x080c, 0x6bb5, 0x6014, 0x904d, 0x0076, 0x2039, 0x0000, 0x190c,
+	0x87df, 0x007e, 0x009e, 0x0005, 0x0156, 0x00c6, 0x2061, 0x1a6f,
+	0x6000, 0x81ff, 0x0110, 0x9205, 0x0008, 0x9204, 0x6002, 0x00ce,
+	0x015e, 0x0005, 0x6800, 0xd08c, 0x1138, 0x6808, 0x9005, 0x0120,
+	0x8001, 0x680a, 0x9085, 0x0001, 0x0005, 0x2071, 0x1923, 0x7003,
+	0x0006, 0x7007, 0x0000, 0x700f, 0x0000, 0x7013, 0x0001, 0x080c,
+	0x1053, 0x090c, 0x0d7d, 0xa867, 0x0006, 0xa86b, 0x0001, 0xa8ab,
+	0xdcb0, 0xa89f, 0x0000, 0x2900, 0x702e, 0x7033, 0x0000, 0x0005,
+	0x0096, 0x00e6, 0x2071, 0x1923, 0x702c, 0x2048, 0x6a2c, 0x721e,
+	0x6b30, 0x7322, 0x6834, 0x7026, 0xa896, 0x6838, 0x702a, 0xa89a,
+	0x6824, 0x7016, 0x683c, 0x701a, 0x2009, 0x0028, 0x200a, 0x9005,
+	0x0148, 0x900e, 0x9188, 0x000c, 0x8001, 0x1de0, 0x2100, 0x9210,
+	0x1208, 0x8318, 0xaa8e, 0xab92, 0x7010, 0xd084, 0x0178, 0xc084,
+	0x7007, 0x0001, 0x700f, 0x0000, 0x0006, 0x2009, 0x181d, 0x2104,
+	0x9082, 0x0007, 0x2009, 0x1b4e, 0x200a, 0x000e, 0xc095, 0x7012,
+	0x2008, 0x2001, 0x003b, 0x080c, 0x1679, 0x9006, 0x2071, 0x193c,
+	0x7002, 0x7006, 0x702a, 0x00ee, 0x009e, 0x0005, 0x00e6, 0x0126,
+	0x0156, 0x2091, 0x8000, 0x2071, 0x1800, 0x7154, 0x2001, 0x0008,
+	0x910a, 0x0638, 0x2001, 0x187d, 0x20ac, 0x9006, 0x9080, 0x0008,
+	0x1f04, 0x8976, 0x71c0, 0x9102, 0x02e0, 0x2071, 0x1877, 0x20a9,
+	0x0007, 0x00c6, 0x080c, 0xab97, 0x6023, 0x0009, 0x6003, 0x0004,
+	0x601f, 0x0101, 0x0089, 0x0126, 0x2091, 0x8000, 0x080c, 0x8afc,
+	0x012e, 0x1f04, 0x8982, 0x9006, 0x00ce, 0x015e, 0x012e, 0x00ee,
+	0x0005, 0x9085, 0x0001, 0x0cc8, 0x00e6, 0x00b6, 0x0096, 0x0086,
+	0x0056, 0x0046, 0x0026, 0x7118, 0x720c, 0x7620, 0x7004, 0xd084,
+	0x1128, 0x2021, 0x0024, 0x2029, 0x0002, 0x0020, 0x2021, 0x002c,
+	0x2029, 0x000a, 0x080c, 0x103a, 0x090c, 0x0d7d, 0x2900, 0x6016,
+	0x2058, 0xac66, 0x9006, 0xa802, 0xa806, 0xa86a, 0xa87a, 0xa8aa,
+	0xa887, 0x0005, 0xa87f, 0x0020, 0x7008, 0xa89a, 0x7010, 0xa89e,
+	0xae8a, 0xa8af, 0xffff, 0xa8b3, 0x0000, 0x8109, 0x0160, 0x080c,
+	0x103a, 0x090c, 0x0d7d, 0xad66, 0x2b00, 0xa802, 0x2900, 0xb806,
+	0x2058, 0x8109, 0x1da0, 0x002e, 0x004e, 0x005e, 0x008e, 0x009e,
+	0x00be, 0x00ee, 0x0005, 0x2079, 0x0000, 0x2071, 0x1923, 0x7004,
+	0x004b, 0x700c, 0x0002, 0x89ee, 0x89e7, 0x89e7, 0x0005, 0x89f8,
+	0x8a59, 0x8a59, 0x8a59, 0x8a5a, 0x8a6b, 0x8a6b, 0x700c, 0x0cba,
+	0x0126, 0x2091, 0x8000, 0x78a0, 0x79a0, 0x9106, 0x0128, 0x78a0,
+	0x79a0, 0x9106, 0x1904, 0x8a4c, 0x2001, 0x0005, 0x2004, 0xd0bc,
+	0x0130, 0x2011, 0x0004, 0x2204, 0xc0c5, 0x2012, 0x0ca8, 0x012e,
+	0x7018, 0x910a, 0x1130, 0x7030, 0x9005, 0x05a8, 0x080c, 0x8a9a,
+	0x0490, 0x1210, 0x7114, 0x910a, 0x9192, 0x000a, 0x0210, 0x2009,
+	0x000a, 0x2001, 0x1888, 0x2014, 0x2001, 0x1935, 0x2004, 0x9100,
+	0x9202, 0x0e48, 0x080c, 0x8be6, 0x2200, 0x9102, 0x0208, 0x2208,
+	0x0096, 0x702c, 0x2048, 0xa873, 0x0001, 0xa976, 0x080c, 0x8cef,
+	0x2100, 0xa87e, 0xa86f, 0x0000, 0x009e, 0x0126, 0x2091, 0x8000,
+	0x2009, 0x1a21, 0x2104, 0xc085, 0x200a, 0x700f, 0x0002, 0x012e,
+	0x080c, 0x1143, 0x1de8, 0x0005, 0x2001, 0x0005, 0x2004, 0xd0bc,
+	0x0130, 0x2011, 0x0004, 0x2204, 0xc0c5, 0x2012, 0x0ca8, 0x012e,
+	0x0005, 0x0005, 0x700c, 0x0002, 0x8a5f, 0x8a62, 0x8a61, 0x080c,
+	0x89f6, 0x0005, 0x8001, 0x700e, 0x0096, 0x702c, 0x2048, 0xa974,
+	0x009e, 0x0011, 0x0ca0, 0x0005, 0x0096, 0x702c, 0x2048, 0x7018,
+	0x9100, 0x7214, 0x921a, 0x1130, 0x701c, 0xa88e, 0x7020, 0xa892,
+	0x9006, 0x0068, 0x0006, 0x080c, 0x8cef, 0x2100, 0xaa8c, 0x9210,
+	0xaa8e, 0x1220, 0xa890, 0x9081, 0x0000, 0xa892, 0x000e, 0x009e,
+	0x2f08, 0x9188, 0x0028, 0x200a, 0x701a, 0x0005, 0x00e6, 0x2071,
+	0x1923, 0x700c, 0x0002, 0x8a98, 0x8a98, 0x8a96, 0x700f, 0x0001,
+	0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x7030, 0x9005, 0x0508,
+	0x2078, 0x7814, 0x2048, 0xae88, 0x00b6, 0x2059, 0x0000, 0x080c,
+	0x8b05, 0x00be, 0x01b0, 0x00e6, 0x2071, 0x193c, 0x080c, 0x8b4c,
+	0x00ee, 0x0178, 0x0096, 0x080c, 0x1053, 0x2900, 0x009e, 0x0148,
+	0xa8aa, 0x04b9, 0x0041, 0x2001, 0x1946, 0x2003, 0x0000, 0x012e,
+	0x08c8, 0x012e, 0x0005, 0x00d6, 0x00c6, 0x0086, 0x00a6, 0x2940,
+	0x2650, 0x2600, 0x9005, 0x0180, 0xa864, 0x9084, 0x000f, 0x2068,
+	0x9d88, 0x1e55, 0x2165, 0x0056, 0x2029, 0x0000, 0x080c, 0x8c74,
+	0x080c, 0x1e2b, 0x1dd8, 0x005e, 0x00ae, 0x2001, 0x187f, 0x2004,
+	0xa88a, 0x080c, 0x1731, 0x781f, 0x0101, 0x7813, 0x0000, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x8b5b, 0x012e, 0x008e, 0x00ce, 0x00de,
+	0x0005, 0x7030, 0x9005, 0x0138, 0x2078, 0x780c, 0x7032, 0x2001,
+	0x1946, 0x2003, 0x0001, 0x0005, 0x00e6, 0x2071, 0x1923, 0x7030,
+	0x600e, 0x2c00, 0x7032, 0x00ee, 0x0005, 0x00d6, 0x00c6, 0x0026,
+	0x9b80, 0x8dce, 0x2005, 0x906d, 0x090c, 0x0d7d, 0x9b80, 0x8dc6,
+	0x2005, 0x9065, 0x090c, 0x0d7d, 0x6114, 0x2600, 0x9102, 0x0248,
+	0x6828, 0x9102, 0x02f0, 0x9085, 0x0001, 0x002e, 0x00ce, 0x00de,
+	0x0005, 0x6804, 0xd094, 0x0148, 0x6854, 0xd084, 0x1178, 0xc085,
+	0x6856, 0x2011, 0x8026, 0x080c, 0x4b07, 0x684c, 0x0096, 0x904d,
+	0x090c, 0x0d7d, 0xa804, 0x8000, 0xa806, 0x009e, 0x9006, 0x2030,
+	0x0c20, 0x6854, 0xd08c, 0x1d08, 0xc08d, 0x6856, 0x2011, 0x8025,
+	0x080c, 0x4b07, 0x684c, 0x0096, 0x904d, 0x090c, 0x0d7d, 0xa800,
+	0x8000, 0xa802, 0x009e, 0x0888, 0x7000, 0x2019, 0x0008, 0x8319,
+	0x7104, 0x9102, 0x1118, 0x2300, 0x9005, 0x0020, 0x0210, 0x9302,
+	0x0008, 0x8002, 0x0005, 0x00d6, 0x7814, 0x9005, 0x090c, 0x0d7d,
+	0x781c, 0x9084, 0x0101, 0x9086, 0x0101, 0x190c, 0x0d7d, 0x2069,
+	0x193c, 0x6804, 0x9080, 0x193e, 0x2f08, 0x2102, 0x6904, 0x8108,
+	0x9182, 0x0008, 0x0208, 0x900e, 0x6906, 0x9180, 0x193e, 0x2003,
+	0x0000, 0x00de, 0x0005, 0x0096, 0x00c6, 0x2060, 0x6014, 0x2048,
+	0xa8a8, 0x0096, 0x2048, 0x9005, 0x190c, 0x106c, 0x009e, 0xa8ab,
+	0x0000, 0x080c, 0x0fec, 0x080c, 0xabed, 0x00ce, 0x009e, 0x0005,
+	0x6020, 0x9086, 0x0009, 0x1128, 0x601c, 0xd0c4, 0x0110, 0x9006,
+	0x0005, 0x9085, 0x0001, 0x0005, 0x6000, 0x9086, 0x0000, 0x0178,
+	0x6010, 0x9005, 0x0150, 0x00b6, 0x2058, 0x080c, 0x8f01, 0x00be,
+	0x6013, 0x0000, 0x601b, 0x0000, 0x0010, 0x2c00, 0x0861, 0x0005,
+	0x2009, 0x1927, 0x210c, 0xd194, 0x0005, 0x00e6, 0x2071, 0x1923,
+	0x7110, 0xc194, 0xd19c, 0x1118, 0xc185, 0x7007, 0x0000, 0x7112,
+	0x2001, 0x003b, 0x080c, 0x1679, 0x00ee, 0x0005, 0x0096, 0x00d6,
+	0x9006, 0x7006, 0x700e, 0x701a, 0x701e, 0x7022, 0x7016, 0x702a,
+	0x7026, 0x702f, 0x0000, 0x080c, 0x8d4e, 0x0170, 0x080c, 0x8d83,
+	0x0158, 0x2900, 0x7002, 0x700a, 0x701a, 0x7013, 0x0001, 0x701f,
+	0x000a, 0x00de, 0x009e, 0x0005, 0x900e, 0x0cd8, 0x00e6, 0x0096,
+	0x0086, 0x00d6, 0x00c6, 0x2071, 0x1930, 0x721c, 0x2100, 0x9202,
+	0x1618, 0x080c, 0x8d83, 0x090c, 0x0d7d, 0x7018, 0x9005, 0x1160,
+	0x2900, 0x7002, 0x700a, 0x701a, 0x9006, 0x7006, 0x700e, 0xa806,
+	0xa802, 0x7012, 0x701e, 0x0038, 0x2040, 0xa806, 0x2900, 0xa002,
+	0x701a, 0xa803, 0x0000, 0x7010, 0x8000, 0x7012, 0x701c, 0x9080,
+	0x000a, 0x701e, 0x721c, 0x08d0, 0x721c, 0x00ce, 0x00de, 0x008e,
+	0x009e, 0x00ee, 0x0005, 0x0096, 0x0156, 0x0136, 0x0146, 0x00e6,
+	0x0126, 0x2091, 0x8000, 0x2071, 0x1930, 0x7300, 0x831f, 0x831e,
+	0x831e, 0x9384, 0x003f, 0x20e8, 0x939c, 0xffc0, 0x9398, 0x0003,
+	0x7104, 0x080c, 0x8cef, 0x810c, 0x2100, 0x9318, 0x8003, 0x2228,
+	0x2021, 0x0078, 0x9402, 0x9532, 0x0208, 0x2028, 0x2500, 0x8004,
+	0x20a8, 0x23a0, 0xa001, 0xa001, 0x4005, 0x2508, 0x080c, 0x8cf8,
+	0x2130, 0x7014, 0x9600, 0x7016, 0x2600, 0x711c, 0x9102, 0x701e,
+	0x7004, 0x9600, 0x2008, 0x9082, 0x000a, 0x1190, 0x7000, 0x2048,
+	0xa800, 0x9005, 0x1148, 0x2009, 0x0001, 0x0026, 0x080c, 0x8be6,
+	0x002e, 0x7000, 0x2048, 0xa800, 0x7002, 0x7007, 0x0000, 0x0008,
+	0x7106, 0x2500, 0x9212, 0x1904, 0x8c25, 0x012e, 0x00ee, 0x014e,
+	0x013e, 0x015e, 0x009e, 0x0005, 0x0016, 0x0026, 0x00e6, 0x0126,
+	0x2091, 0x8000, 0x9580, 0x8dc6, 0x2005, 0x9075, 0x090c, 0x0d7d,
+	0x080c, 0x8cca, 0x012e, 0x9580, 0x8dc2, 0x2005, 0x9075, 0x090c,
+	0x0d7d, 0x0156, 0x0136, 0x01c6, 0x0146, 0x01d6, 0x831f, 0x831e,
+	0x831e, 0x9384, 0x003f, 0x20e0, 0x9384, 0xffc0, 0x9100, 0x2098,
+	0xa860, 0x20e8, 0xa95c, 0x2c05, 0x9100, 0x20a0, 0x20a9, 0x0002,
+	0x4003, 0x2e0c, 0x2d00, 0x0002, 0x8cb4, 0x8cb4, 0x8cb6, 0x8cb4,
+	0x8cb6, 0x8cb4, 0x8cb4, 0x8cb4, 0x8cb4, 0x8cb4, 0x8cbc, 0x8cb4,
+	0x8cbc, 0x8cb4, 0x8cb4, 0x8cb4, 0x080c, 0x0d7d, 0x4104, 0x20a9,
+	0x0002, 0x4002, 0x4003, 0x0028, 0x20a9, 0x0002, 0x4003, 0x4104,
+	0x4003, 0x01de, 0x014e, 0x01ce, 0x013e, 0x015e, 0x00ee, 0x002e,
+	0x001e, 0x0005, 0x0096, 0x7014, 0x8001, 0x7016, 0x710c, 0x2110,
+	0x00f1, 0x810c, 0x9188, 0x0003, 0x7308, 0x8210, 0x9282, 0x000a,
+	0x1198, 0x7008, 0x2048, 0xa800, 0x9005, 0x0158, 0x0006, 0x080c,
+	0x8d92, 0x009e, 0xa807, 0x0000, 0x2900, 0x700a, 0x7010, 0x8001,
+	0x7012, 0x700f, 0x0000, 0x0008, 0x720e, 0x009e, 0x0005, 0x0006,
+	0x810b, 0x810b, 0x2100, 0x810b, 0x9100, 0x2008, 0x000e, 0x0005,
+	0x0006, 0x0026, 0x2100, 0x9005, 0x0158, 0x9092, 0x000c, 0x0240,
+	0x900e, 0x8108, 0x9082, 0x000c, 0x1de0, 0x002e, 0x000e, 0x0005,
+	0x900e, 0x0cd8, 0x2d00, 0x90b8, 0x0008, 0x690c, 0x6810, 0x2019,
+	0x0001, 0x2031, 0x8d38, 0x9112, 0x0220, 0x0118, 0x8318, 0x2208,
+	0x0cd0, 0x6808, 0x9005, 0x0108, 0x8318, 0x233a, 0x6804, 0xd084,
+	0x2300, 0x2021, 0x0001, 0x1150, 0x9082, 0x0003, 0x0967, 0x0a67,
+	0x8420, 0x9082, 0x0007, 0x0967, 0x0a67, 0x0cd0, 0x9082, 0x0002,
+	0x0967, 0x0a67, 0x8420, 0x9082, 0x0005, 0x0967, 0x0a67, 0x0cd0,
+	0x6c1a, 0x2d00, 0x90b8, 0x0007, 0x00e6, 0x2071, 0x1800, 0x7128,
+	0x6810, 0x2019, 0x0001, 0x910a, 0x0118, 0x0210, 0x8318, 0x0cd8,
+	0x2031, 0x8d4b, 0x0870, 0x6c16, 0x00ee, 0x0005, 0x0096, 0x0046,
+	0x0126, 0x2091, 0x8000, 0x2b00, 0x9080, 0x8dca, 0x2005, 0x9005,
+	0x090c, 0x0d7d, 0x2004, 0x90a0, 0x000a, 0x080c, 0x1053, 0x01d0,
+	0x2900, 0x7026, 0xa803, 0x0000, 0xa807, 0x0000, 0x080c, 0x1053,
+	0x0188, 0x7024, 0xa802, 0xa807, 0x0000, 0x2900, 0x7026, 0x94a2,
+	0x000a, 0x0110, 0x0208, 0x0c90, 0x9085, 0x0001, 0x012e, 0x004e,
+	0x009e, 0x0005, 0x7024, 0x9005, 0x0dc8, 0x2048, 0xac00, 0x080c,
+	0x106c, 0x2400, 0x0cc0, 0x0126, 0x2091, 0x8000, 0x7024, 0x2048,
+	0x9005, 0x0130, 0xa800, 0x7026, 0xa803, 0x0000, 0xa807, 0x0000,
+	0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x7024, 0xa802, 0x2900,
+	0x7026, 0x012e, 0x0005, 0x0096, 0x9e80, 0x0009, 0x2004, 0x9005,
+	0x0138, 0x2048, 0xa800, 0x0006, 0x080c, 0x106c, 0x000e, 0x0cb8,
+	0x009e, 0x0005, 0x0096, 0x7008, 0x9005, 0x0138, 0x2048, 0xa800,
+	0x0006, 0x080c, 0x106c, 0x000e, 0x0cb8, 0x9006, 0x7002, 0x700a,
+	0x7006, 0x700e, 0x701a, 0x701e, 0x7022, 0x702a, 0x7026, 0x702e,
+	0x009e, 0x0005, 0x1a6d, 0x0000, 0x0000, 0x0000, 0x1930, 0x0000,
+	0x0000, 0x0000, 0x1888, 0x0000, 0x0000, 0x0000, 0x1877, 0x0000,
+	0x0000, 0x0000, 0x00e6, 0x00c6, 0x00b6, 0x00a6, 0xa8a8, 0x2040,
+	0x2071, 0x1877, 0x080c, 0x8eec, 0xa067, 0x0023, 0x6010, 0x905d,
+	0x0904, 0x8ec1, 0xb814, 0xa06e, 0xb910, 0xa172, 0xb9a0, 0xa176,
+	0x2001, 0x0003, 0xa07e, 0xa834, 0xa082, 0xa07b, 0x0000, 0xa898,
+	0x9005, 0x0118, 0xa078, 0xc085, 0xa07a, 0x2858, 0x2031, 0x0018,
+	0xa068, 0x908a, 0x0019, 0x1a0c, 0x0d7d, 0x2020, 0x2050, 0x2940,
+	0xa864, 0x90bc, 0x00ff, 0x908c, 0x000f, 0x91e0, 0x1e55, 0x2c65,
+	0x9786, 0x0024, 0x2c05, 0x1590, 0x908a, 0x0036, 0x1a0c, 0x0d7d,
+	0x9082, 0x001b, 0x0002, 0x8e2e, 0x8e2e, 0x8e30, 0x8e2e, 0x8e2e,
+	0x8e2e, 0x8e32, 0x8e2e, 0x8e2e, 0x8e2e, 0x8e34, 0x8e2e, 0x8e2e,
+	0x8e2e, 0x8e36, 0x8e2e, 0x8e2e, 0x8e2e, 0x8e38, 0x8e2e, 0x8e2e,
+	0x8e2e, 0x8e3a, 0x8e2e, 0x8e2e, 0x8e2e, 0x8e3c, 0x080c, 0x0d7d,
+	0xa180, 0x04b8, 0xa190, 0x04a8, 0xa1a0, 0x0498, 0xa1b0, 0x0488,
+	0xa1c0, 0x0478, 0xa1d0, 0x0468, 0xa1e0, 0x0458, 0x908a, 0x0034,
+	0x1a0c, 0x0d7d, 0x9082, 0x001b, 0x0002, 0x8e60, 0x8e5e, 0x8e5e,
+	0x8e5e, 0x8e5e, 0x8e5e, 0x8e62, 0x8e5e, 0x8e5e, 0x8e5e, 0x8e5e,
+	0x8e5e, 0x8e64, 0x8e5e, 0x8e5e, 0x8e5e, 0x8e5e, 0x8e5e, 0x8e66,
+	0x8e5e, 0x8e5e, 0x8e5e, 0x8e5e, 0x8e5e, 0x8e68, 0x080c, 0x0d7d,
+	0xa180, 0x0038, 0xa198, 0x0028, 0xa1b0, 0x0018, 0xa1c8, 0x0008,
+	0xa1e0, 0x2600, 0x0002, 0x8e84, 0x8e86, 0x8e88, 0x8e8a, 0x8e8c,
+	0x8e8e, 0x8e90, 0x8e92, 0x8e94, 0x8e96, 0x8e98, 0x8e9a, 0x8e9c,
+	0x8e9e, 0x8ea0, 0x8ea2, 0x8ea4, 0x8ea6, 0x8ea8, 0x8eaa, 0x8eac,
+	0x8eae, 0x8eb0, 0x8eb2, 0x8eb4, 0x080c, 0x0d7d, 0xb9e2, 0x0468,
+	0xb9de, 0x0458, 0xb9da, 0x0448, 0xb9d6, 0x0438, 0xb9d2, 0x0428,
+	0xb9ce, 0x0418, 0xb9ca, 0x0408, 0xb9c6, 0x00f8, 0xb9c2, 0x00e8,
+	0xb9be, 0x00d8, 0xb9ba, 0x00c8, 0xb9b6, 0x00b8, 0xb9b2, 0x00a8,
+	0xb9ae, 0x0098, 0xb9aa, 0x0088, 0xb9a6, 0x0078, 0xb9a2, 0x0068,
+	0xb99e, 0x0058, 0xb99a, 0x0048, 0xb996, 0x0038, 0xb992, 0x0028,
+	0xb98e, 0x0018, 0xb98a, 0x0008, 0xb986, 0x8631, 0x8421, 0x0120,
+	0x080c, 0x1e2b, 0x0804, 0x8e08, 0x00ae, 0x00be, 0x00ce, 0x00ee,
+	0x0005, 0xa86c, 0xa06e, 0xa870, 0xa072, 0xa077, 0x00ff, 0x9006,
+	0x0804, 0x8dea, 0x0006, 0x0016, 0x00b6, 0x6010, 0x2058, 0xb810,
+	0x9005, 0x01b0, 0x2001, 0x1924, 0x2004, 0x9005, 0x0188, 0x2001,
+	0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0xbba0,
+	0x2021, 0x0004, 0x2011, 0x8014, 0x080c, 0x4b07, 0x004e, 0x003e,
+	0x00be, 0x001e, 0x000e, 0x0005, 0x9016, 0x710c, 0xa834, 0x910a,
+	0xa936, 0x7008, 0x9005, 0x0120, 0x8210, 0x910a, 0x0238, 0x0130,
+	0x7010, 0x8210, 0x910a, 0x0210, 0x0108, 0x0cd8, 0xaa8a, 0xa26a,
+	0x0005, 0x00f6, 0x00d6, 0x0036, 0x2079, 0x0300, 0x781b, 0x0200,
+	0x7818, 0xd094, 0x1dd8, 0x781b, 0x0202, 0xa001, 0xa001, 0x7818,
+	0xd094, 0x1da0, 0xb8ac, 0x9005, 0x01b8, 0x2068, 0x2079, 0x0000,
+	0x2c08, 0x911e, 0x1118, 0x680c, 0xb8ae, 0x0060, 0x9106, 0x0140,
+	0x2d00, 0x2078, 0x680c, 0x9005, 0x090c, 0x0d7d, 0x2068, 0x0cb0,
+	0x6b0c, 0x7b0e, 0x600f, 0x0000, 0x2079, 0x0300, 0x781b, 0x0200,
+	0x003e, 0x00de, 0x00fe, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x00c6,
+	0x0036, 0x0126, 0x2091, 0x8000, 0x0156, 0x20a9, 0x01ff, 0x2071,
+	0x0300, 0x701b, 0x0200, 0x7018, 0xd094, 0x0110, 0x1f04, 0x8f41,
+	0x701b, 0x0202, 0xa001, 0xa001, 0x7018, 0xd094, 0x1d90, 0xb8ac,
+	0x9005, 0x01d0, 0x2060, 0x600c, 0xb8ae, 0x6003, 0x0004, 0x601b,
+	0x0000, 0x6013, 0x0000, 0x601f, 0x0101, 0x6014, 0x2048, 0xa88b,
+	0x0000, 0xa8a8, 0xa8ab, 0x0000, 0x904d, 0x090c, 0x0d7d, 0x080c,
+	0x106c, 0x080c, 0x8afc, 0x0c18, 0x2071, 0x0300, 0x701b, 0x0200,
+	0x015e, 0x012e, 0x003e, 0x00ce, 0x009e, 0x00de, 0x00ee, 0x0005,
+	0x00c6, 0x00b6, 0x0016, 0x0006, 0x0156, 0x080c, 0x25fb, 0x015e,
+	0x11b0, 0x080c, 0x65c4, 0x190c, 0x0d7d, 0x000e, 0x001e, 0xb912,
+	0xb816, 0x080c, 0xab97, 0x0140, 0x2b00, 0x6012, 0x6023, 0x0001,
+	0x2009, 0x0001, 0x080c, 0xac8c, 0x00be, 0x00ce, 0x0005, 0x000e,
+	0x001e, 0x0cd0, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d7d,
+	0x0013, 0x006e, 0x0005, 0x8fb3, 0x8fb3, 0x8fb3, 0x8fb5, 0x8ffe,
+	0x8fb3, 0x8fb3, 0x8fb3, 0x9061, 0x8fb3, 0x9099, 0x8fb3, 0x8fb3,
+	0x8fb3, 0x8fb3, 0x8fb3, 0x080c, 0x0d7d, 0x9182, 0x0040, 0x0002,
+	0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8,
+	0x8fc8, 0x8fca, 0x8fdb, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fc8, 0x8fec,
+	0x080c, 0x0d7d, 0x0096, 0x6114, 0x2148, 0xa87b, 0x0000, 0x6010,
+	0x00b6, 0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6b80, 0x080c,
+	0xabed, 0x009e, 0x0005, 0x080c, 0x963b, 0x00d6, 0x6114, 0x080c,
+	0xc838, 0x0130, 0x0096, 0x6114, 0x2148, 0x080c, 0x6d80, 0x009e,
+	0x00de, 0x080c, 0xabed, 0x0005, 0x080c, 0x963b, 0x080c, 0x31e7,
+	0x6114, 0x0096, 0x2148, 0x080c, 0xc838, 0x0120, 0xa87b, 0x0029,
+	0x080c, 0x6d80, 0x009e, 0x080c, 0xabed, 0x0005, 0x601b, 0x0000,
+	0x9182, 0x0040, 0x0096, 0x0002, 0x9019, 0x9019, 0x9019, 0x9019,
+	0x9019, 0x9019, 0x9019, 0x9019, 0x901b, 0x9019, 0x9019, 0x9019,
+	0x905d, 0x9019, 0x9019, 0x9019, 0x9019, 0x9019, 0x9019, 0x9021,
+	0x9019, 0x080c, 0x0d7d, 0x6114, 0x2148, 0xa938, 0x918e, 0xffff,
+	0x05e0, 0x00e6, 0x6114, 0x2148, 0x080c, 0x8dd2, 0x0096, 0xa8a8,
+	0x2048, 0x080c, 0x6b18, 0x009e, 0xa8ab, 0x0000, 0x6010, 0x9005,
+	0x0128, 0x00b6, 0x2058, 0x080c, 0x8f01, 0x00be, 0xae88, 0x00b6,
+	0x2059, 0x0000, 0x080c, 0x8b05, 0x00be, 0x01e0, 0x2071, 0x193c,
+	0x080c, 0x8b4c, 0x01b8, 0x9086, 0x0001, 0x1128, 0x2001, 0x1946,
+	0x2004, 0x9005, 0x1178, 0x0096, 0x080c, 0x103a, 0x2900, 0x009e,
+	0x0148, 0xa8aa, 0x00f6, 0x2c78, 0x080c, 0x8ac3, 0x00fe, 0x00ee,
+	0x009e, 0x0005, 0x080c, 0x8afc, 0x0cd0, 0x080c, 0x9115, 0x009e,
+	0x0005, 0x9182, 0x0040, 0x0096, 0x0002, 0x9075, 0x9075, 0x9075,
+	0x9077, 0x9075, 0x9075, 0x9075, 0x9097, 0x9075, 0x9075, 0x9075,
+	0x9075, 0x9075, 0x9075, 0x9075, 0x9075, 0x080c, 0x0d7d, 0x6003,
+	0x0003, 0x6106, 0x6014, 0x2048, 0xa8ac, 0xa836, 0xa8b0, 0xa83a,
+	0xa847, 0x0000, 0xa84b, 0x0000, 0xa884, 0x9092, 0x199a, 0x0210,
+	0x2001, 0x1999, 0x8003, 0x8013, 0x8213, 0x9210, 0x621a, 0x080c,
+	0x1bba, 0x2009, 0x8030, 0x080c, 0x9265, 0x009e, 0x0005, 0x080c,
+	0x0d7d, 0x080c, 0x963b, 0x6114, 0x2148, 0xa87b, 0x0000, 0x6010,
+	0x00b6, 0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6d80, 0x080c,
+	0xabed, 0x009e, 0x0005, 0x080c, 0xa896, 0x6144, 0xd1fc, 0x0120,
+	0xd1ac, 0x1110, 0x6003, 0x0003, 0x6000, 0x908a, 0x0016, 0x1a0c,
+	0x0d7d, 0x0096, 0x0023, 0x009e, 0x080c, 0xa8b2, 0x0005, 0x90cf,
+	0x90cf, 0x90cf, 0x90d1, 0x90e2, 0x90cf, 0x90cf, 0x90cf, 0x90cf,
+	0x90cf, 0x90cf, 0x90cf, 0x90cf, 0x90cf, 0x90cf, 0x90cf, 0x080c,
+	0x0d7d, 0x080c, 0xaa2a, 0x6114, 0x2148, 0xa87b, 0x0006, 0x6010,
+	0x00b6, 0x2058, 0xb8bb, 0x0500, 0x00be, 0x080c, 0x6d80, 0x080c,
+	0xabed, 0x0005, 0x0491, 0x0005, 0x080c, 0xa896, 0x6000, 0x6144,
+	0xd1fc, 0x0130, 0xd1ac, 0x1120, 0x6003, 0x0003, 0x2009, 0x0003,
+	0x908a, 0x0016, 0x1a0c, 0x0d7d, 0x0096, 0x0033, 0x009e, 0x0106,
+	0x080c, 0xa8b2, 0x010e, 0x0005, 0x910c, 0x910c, 0x910c, 0x910e,
+	0x9115, 0x910c, 0x910c, 0x910c, 0x910c, 0x910c, 0x910c, 0x910c,
+	0x910c, 0x910c, 0x910c, 0x910c, 0x080c, 0x0d7d, 0x0036, 0x00e6,
+	0x080c, 0xaa2a, 0x00ee, 0x003e, 0x0005, 0x00f6, 0x00e6, 0x601b,
+	0x0000, 0x6014, 0x2048, 0x6010, 0x9005, 0x0128, 0x00b6, 0x2058,
+	0x080c, 0x8f01, 0x00be, 0x2071, 0x193c, 0x080c, 0x8b4c, 0x0160,
+	0x2001, 0x187f, 0x2004, 0xa88a, 0x2031, 0x0000, 0x2c78, 0x080c,
+	0x8ac3, 0x00ee, 0x00fe, 0x0005, 0x0096, 0xa88b, 0x0000, 0xa8a8,
+	0x2048, 0x080c, 0x106c, 0x009e, 0xa8ab, 0x0000, 0x080c, 0x8afc,
+	0x0c80, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+	0x0000, 0x0000, 0x187a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+	0x0000, 0x0126, 0x2091, 0x8000, 0x0036, 0x0046, 0x20a9, 0x0010,
+	0x9006, 0x8004, 0x8086, 0x818e, 0x1208, 0x9200, 0x1f04, 0x915a,
+	0x8086, 0x818e, 0x004e, 0x003e, 0x012e, 0x0005, 0x0126, 0x2091,
+	0x8000, 0x0076, 0x0156, 0x20a9, 0x0010, 0x9005, 0x01c8, 0x911a,
+	0x12b8, 0x8213, 0x818d, 0x0228, 0x911a, 0x1220, 0x1f04, 0x9171,
+	0x0028, 0x911a, 0x2308, 0x8210, 0x1f04, 0x9171, 0x0006, 0x3200,
+	0x9084, 0xefff, 0x2080, 0x000e, 0x015e, 0x007e, 0x012e, 0x0005,
+	0x0006, 0x3200, 0x9085, 0x1000, 0x0ca8, 0x0126, 0x2091, 0x2800,
+	0x2079, 0x19e7, 0x012e, 0x00d6, 0x2069, 0x19e7, 0x6803, 0x0005,
+	0x0156, 0x0146, 0x01d6, 0x20e9, 0x0000, 0x2069, 0x0200, 0x080c,
+	0xa690, 0x04a9, 0x080c, 0xa67b, 0x0491, 0x080c, 0xa67e, 0x0479,
+	0x080c, 0xa681, 0x0461, 0x080c, 0xa684, 0x0449, 0x080c, 0xa687,
+	0x0431, 0x080c, 0xa68a, 0x0419, 0x080c, 0xa68d, 0x0401, 0x01de,
+	0x014e, 0x015e, 0x6857, 0x0000, 0x00f6, 0x2079, 0x0380, 0x00f9,
+	0x7807, 0x0003, 0x7803, 0x0000, 0x7803, 0x0001, 0x2069, 0x0004,
+	0x2d04, 0x9084, 0xfffe, 0x9085, 0x8000, 0x206a, 0x2069, 0x0100,
+	0x6828, 0x9084, 0xfffc, 0x682a, 0x00fe, 0x00de, 0x0005, 0x20a9,
+	0x0020, 0x20a1, 0x0240, 0x2001, 0x0000, 0x4004, 0x0005, 0x00c6,
+	0x7803, 0x0000, 0x9006, 0x7827, 0x0030, 0x782b, 0x0400, 0x7827,
+	0x0031, 0x782b, 0x1aef, 0x781f, 0xff00, 0x781b, 0xff00, 0x2061,
+	0x1ae4, 0x602f, 0x19e7, 0x6033, 0x1800, 0x6037, 0x1a03, 0x603b,
+	0x1e55, 0x603f, 0x1e65, 0x6042, 0x6047, 0x1aba, 0x00ce, 0x0005,
+	0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0001, 0x01b0,
+	0x00c6, 0x6146, 0x600f, 0x0000, 0x2c08, 0x2061, 0x19e7, 0x602c,
+	0x8000, 0x602e, 0x601c, 0x9005, 0x0130, 0x9080, 0x0003, 0x2102,
+	0x611e, 0x00ce, 0x0005, 0x6122, 0x611e, 0x0cd8, 0x6146, 0x2c08,
+	0x2001, 0x0012, 0x080c, 0xa887, 0x0005, 0x0016, 0x2009, 0x8020,
+	0x6146, 0x2c08, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086,
+	0x0001, 0x1128, 0x2001, 0x0019, 0x080c, 0xa887, 0x0088, 0x00c6,
+	0x2061, 0x19e7, 0x602c, 0x8000, 0x602e, 0x600c, 0x9005, 0x0128,
+	0x9080, 0x0003, 0x2102, 0x610e, 0x0010, 0x6112, 0x610e, 0x00ce,
+	0x001e, 0x0005, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086,
+	0x0001, 0x0198, 0x00c6, 0x6146, 0x600f, 0x0000, 0x2c08, 0x2061,
+	0x19e7, 0x6044, 0x9005, 0x0130, 0x9080, 0x0003, 0x2102, 0x6146,
+	0x00ce, 0x0005, 0x614a, 0x6146, 0x0cd8, 0x6146, 0x600f, 0x0000,
+	0x2c08, 0x2001, 0x0013, 0x080c, 0xa887, 0x0005, 0x6044, 0xd0dc,
+	0x0128, 0x9006, 0x7007, 0x0000, 0x700a, 0x7032, 0x0005, 0x00f6,
+	0x00e6, 0x00d6, 0x00c6, 0x00b6, 0x0096, 0x0076, 0x0066, 0x0056,
+	0x0036, 0x0026, 0x0016, 0x0006, 0x0126, 0x902e, 0x2071, 0x19e7,
+	0x7648, 0x2660, 0x2678, 0x2091, 0x8000, 0x8cff, 0x0904, 0x92f0,
+	0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x92eb, 0x87ff, 0x0120,
+	0x605c, 0x9106, 0x1904, 0x92eb, 0x704c, 0x9c06, 0x1178, 0x0036,
+	0x2019, 0x0001, 0x080c, 0xa118, 0x703f, 0x0000, 0x9006, 0x704e,
+	0x706a, 0x7052, 0x706e, 0x003e, 0x2029, 0x0001, 0x080c, 0x926e,
+	0x7048, 0x9c36, 0x1110, 0x660c, 0x764a, 0x7044, 0x9c36, 0x1140,
+	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7046, 0x0010, 0x7047, 0x0000,
+	0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678,
+	0x600f, 0x0000, 0x080c, 0xc838, 0x01c8, 0x6014, 0x2048, 0x6020,
+	0x9086, 0x0003, 0x1560, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
+	0x0016, 0x0036, 0x0076, 0x080c, 0xcb36, 0x080c, 0xe621, 0x080c,
+	0x6d80, 0x007e, 0x003e, 0x001e, 0x080c, 0xca27, 0x080c, 0xac28,
+	0x00ce, 0x0804, 0x928d, 0x2c78, 0x600c, 0x2060, 0x0804, 0x928d,
+	0x012e, 0x000e, 0x001e, 0x002e, 0x003e, 0x005e, 0x006e, 0x007e,
+	0x009e, 0x00be, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020,
+	0x9086, 0x0006, 0x1158, 0x0016, 0x0036, 0x0076, 0x080c, 0xe621,
+	0x080c, 0xe26c, 0x007e, 0x003e, 0x001e, 0x08c0, 0x6020, 0x9086,
+	0x0009, 0x1168, 0xa87b, 0x0006, 0x0016, 0x0036, 0x0076, 0x080c,
+	0x6d80, 0x080c, 0xabed, 0x007e, 0x003e, 0x001e, 0x0848, 0x6020,
+	0x9086, 0x000a, 0x0904, 0x92d5, 0x0804, 0x92d3, 0x0006, 0x0066,
+	0x0096, 0x00c6, 0x00d6, 0x00f6, 0x9036, 0x0126, 0x2091, 0x8000,
+	0x2079, 0x19e7, 0x7848, 0x9065, 0x0904, 0x9385, 0x600c, 0x0006,
+	0x600f, 0x0000, 0x784c, 0x9c06, 0x11a0, 0x0036, 0x2019, 0x0001,
+	0x080c, 0xa118, 0x783f, 0x0000, 0x901e, 0x7b4e, 0x7b6a, 0x7b52,
+	0x7b6e, 0x003e, 0x000e, 0x9005, 0x1118, 0x600c, 0x600f, 0x0000,
+	0x0006, 0x00e6, 0x2f70, 0x080c, 0x926e, 0x00ee, 0x080c, 0xc838,
+	0x0520, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1580, 0x3e08,
+	0x918e, 0x0002, 0x1188, 0x6010, 0x9005, 0x0170, 0x00b6, 0x2058,
+	0xb800, 0x00be, 0xd0bc, 0x0140, 0x6048, 0x9005, 0x1198, 0x2001,
+	0x1988, 0x2004, 0x604a, 0x0070, 0xa867, 0x0103, 0xab7a, 0xa877,
+	0x0000, 0x080c, 0x6d74, 0x080c, 0xca27, 0x6044, 0xc0fc, 0x6046,
+	0x080c, 0xac28, 0x000e, 0x0804, 0x9333, 0x7e4a, 0x7e46, 0x012e,
+	0x00fe, 0x00de, 0x00ce, 0x009e, 0x006e, 0x000e, 0x0005, 0x6020,
+	0x9086, 0x0006, 0x1118, 0x080c, 0xe26c, 0x0c38, 0x6020, 0x9086,
+	0x0009, 0x1130, 0xab7a, 0x080c, 0x6d80, 0x080c, 0xabed, 0x0c10,
+	0x6020, 0x9086, 0x000a, 0x0990, 0x0878, 0x0016, 0x0026, 0x0086,
+	0x9046, 0x00a9, 0x080c, 0x9496, 0x008e, 0x002e, 0x001e, 0x0005,
+	0x00f6, 0x0126, 0x2079, 0x19e7, 0x2091, 0x8000, 0x080c, 0x94df,
+	0x080c, 0x9573, 0x080c, 0x67b2, 0x012e, 0x00fe, 0x0005, 0x00b6,
+	0x0096, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0016, 0x0006,
+	0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x7620, 0x2660, 0x2678,
+	0x8cff, 0x0904, 0x945b, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904,
+	0x9456, 0x88ff, 0x0120, 0x605c, 0x9106, 0x1904, 0x9456, 0x7030,
+	0x9c06, 0x1570, 0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508, 0x080c,
+	0x86f6, 0x080c, 0x9e32, 0x68c3, 0x0000, 0x080c, 0xa338, 0x7033,
 	0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
 	0x2001, 0x0100, 0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x2069,
-	0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0058,
-	0x080c, 0x69f3, 0x1538, 0x6003, 0x0009, 0x630a, 0x7808, 0xc0ad,
-	0x780a, 0x2c30, 0x00f8, 0x6014, 0x2048, 0x080c, 0xc812, 0x01b0,
-	0x6020, 0x9086, 0x0003, 0x1508, 0x080c, 0xca29, 0x1118, 0x080c,
-	0xb591, 0x0060, 0x080c, 0x69f3, 0x1168, 0xa867, 0x0103, 0xab7a,
-	0xa877, 0x0000, 0x080c, 0x6d70, 0x080c, 0xca03, 0x080c, 0xac04,
-	0x080c, 0xa1ea, 0x000e, 0x0804, 0x94b5, 0x7e22, 0x7e1e, 0x00de,
-	0x00ce, 0x006e, 0x000e, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006,
-	0x1118, 0x080c, 0xe241, 0x0c50, 0x080c, 0xb591, 0x6020, 0x9086,
-	0x0002, 0x1150, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0990,
-	0x9086, 0x008b, 0x0978, 0x08d0, 0x6020, 0x9086, 0x0005, 0x19b0,
-	0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0d18, 0x9086, 0x008b,
-	0x0d00, 0x0860, 0x0006, 0x0096, 0x00b6, 0x00c6, 0x0066, 0x9036,
-	0x7828, 0x9065, 0x0510, 0x6010, 0x2058, 0x600c, 0x0006, 0x3e08,
-	0x918e, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x11a8, 0x6043, 0xffff,
-	0x080c, 0xaa51, 0x0180, 0x610c, 0x080c, 0x9f7e, 0x6014, 0x2048,
-	0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6d70, 0x080c,
-	0xac04, 0x000e, 0x08f0, 0x2c30, 0x0ce0, 0x006e, 0x00ce, 0x00be,
-	0x009e, 0x000e, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x0066, 0x080c,
-	0x6134, 0x11b0, 0x2071, 0x19e7, 0x7030, 0x9080, 0x0005, 0x2004,
-	0x904d, 0x0170, 0xa878, 0x9606, 0x1158, 0x2071, 0x19e7, 0x7030,
-	0x9035, 0x0130, 0x9080, 0x0005, 0x2004, 0x9906, 0x1108, 0x0029,
-	0x006e, 0x009e, 0x00de, 0x00ee, 0x0005, 0x00c6, 0x2660, 0x6043,
-	0xffff, 0x080c, 0xaa51, 0x0178, 0x080c, 0x9f7e, 0x6014, 0x2048,
-	0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xcb12, 0x080c,
-	0x6d70, 0x080c, 0xac04, 0x00ce, 0x0005, 0x00b6, 0x00e6, 0x00c6,
-	0x080c, 0xa8d0, 0x0106, 0x190c, 0xa872, 0x2071, 0x0101, 0x2e04,
-	0xc0c4, 0x2072, 0x6044, 0xd0fc, 0x1138, 0x010e, 0x190c, 0xa88e,
-	0x00ce, 0x00ee, 0x00be, 0x0005, 0x2071, 0x19e7, 0x7030, 0x9005,
-	0x0da0, 0x9c06, 0x190c, 0x0d7d, 0x7036, 0x080c, 0x86c5, 0x7004,
-	0x9084, 0x0007, 0x0002, 0x95dd, 0x95df, 0x95e6, 0x95f0, 0x95fe,
-	0x95dd, 0x95e6, 0x95db, 0x080c, 0x0d7d, 0x0428, 0x0005, 0x080c,
-	0xaa3c, 0x7007, 0x0000, 0x7033, 0x0000, 0x00e8, 0x0066, 0x9036,
-	0x080c, 0x9f7e, 0x006e, 0x7007, 0x0000, 0x7033, 0x0000, 0x0098,
-	0x080c, 0xaa27, 0x0140, 0x080c, 0xaa3c, 0x0128, 0x0066, 0x9036,
-	0x080c, 0x9f7e, 0x006e, 0x7033, 0x0000, 0x0028, 0x080c, 0xaa27,
-	0x080c, 0xa314, 0x0000, 0x010e, 0x190c, 0xa88e, 0x00ce, 0x00ee,
-	0x00be, 0x0005, 0x00d6, 0x00c6, 0x080c, 0xa8d0, 0x0106, 0x190c,
-	0xa872, 0x6044, 0xd0fc, 0x1130, 0x010e, 0x190c, 0xa88e, 0x00ce,
-	0x00de, 0x0005, 0x2069, 0x19e7, 0x684c, 0x9005, 0x0da8, 0x9c06,
-	0x190c, 0x0d7d, 0x6852, 0x00e6, 0x2d70, 0x080c, 0x923d, 0x00ee,
-	0x080c, 0x86d2, 0x0016, 0x2009, 0x0040, 0x080c, 0x21b0, 0x001e,
-	0x683c, 0x9084, 0x0003, 0x0002, 0x963a, 0x963b, 0x9659, 0x9638,
-	0x080c, 0x0d7d, 0x0460, 0x6868, 0x9086, 0x0001, 0x0190, 0x600c,
-	0x9015, 0x0160, 0x6a4a, 0x600f, 0x0000, 0x6044, 0xc0fc, 0x6046,
-	0x9006, 0x7042, 0x684e, 0x683f, 0x0000, 0x00c8, 0x684a, 0x6846,
-	0x0ca0, 0x686b, 0x0000, 0x6848, 0x9065, 0x0d78, 0x6003, 0x0002,
-	0x0c60, 0x9006, 0x686a, 0x6852, 0x686e, 0x600c, 0x9015, 0x0120,
-	0x6a4a, 0x600f, 0x0000, 0x0018, 0x684e, 0x684a, 0x6846, 0x684f,
-	0x0000, 0x010e, 0x190c, 0xa88e, 0x00ce, 0x00de, 0x0005, 0x0005,
-	0x6020, 0x9084, 0x000f, 0x000b, 0x0005, 0x9685, 0x9688, 0x9af6,
-	0x9b85, 0x9688, 0x9af6, 0x9b85, 0x9685, 0x9688, 0x9685, 0x9685,
-	0x9685, 0x9685, 0x9685, 0x9685, 0x9685, 0x080c, 0x95ad, 0x0005,
-	0x00b6, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6,
-	0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071, 0x0240, 0x6004, 0x908a,
-	0x0053, 0x1a0c, 0x0d7d, 0x6110, 0x2158, 0xb984, 0x2c78, 0x2061,
-	0x0100, 0x619a, 0x908a, 0x0040, 0x1a04, 0x96f4, 0x005b, 0x00fe,
-	0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e,
-	0x00be, 0x0005, 0x9879, 0x98b4, 0x98dd, 0x9985, 0x99a7, 0x99ad,
-	0x99ba, 0x99c2, 0x99ce, 0x99d4, 0x99e5, 0x99d4, 0x9a3d, 0x99c2,
-	0x9a49, 0x9a4f, 0x99ce, 0x9a4f, 0x9a5b, 0x96f2, 0x96f2, 0x96f2,
-	0x96f2, 0x96f2, 0x96f2, 0x96f2, 0x96f2, 0x96f2, 0x96f2, 0x96f2,
-	0x9f9f, 0x9fc2, 0x9fd3, 0x9ff3, 0xa025, 0x99ba, 0x96f2, 0x99ba,
-	0x99d4, 0x96f2, 0x98dd, 0x9985, 0x96f2, 0xa407, 0x99d4, 0x96f2,
-	0xa423, 0x99d4, 0x96f2, 0x99ce, 0x9873, 0x9715, 0x96f2, 0xa43f,
-	0xa4ac, 0xa58c, 0x96f2, 0xa599, 0x99b7, 0xa5c4, 0x96f2, 0xa02f,
-	0xa5d0, 0x96f2, 0x080c, 0x0d7d, 0x2100, 0x005b, 0x00fe, 0x00ee,
-	0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be,
-	0x0005, 0xa670, 0xa722, 0x9713, 0x973c, 0x97e8, 0x97f3, 0x9713,
-	0x99ba, 0x9713, 0x983a, 0x9846, 0x9757, 0x9713, 0x9772, 0x97a6,
-	0xaaa7, 0xaaec, 0x99d4, 0x080c, 0x0d7d, 0x00d6, 0x0096, 0x080c,
-	0x9a6e, 0x7003, 0x2414, 0x7007, 0x0018, 0x700b, 0x0800, 0x7814,
-	0x2048, 0xa83c, 0x700e, 0xa850, 0x7022, 0xa854, 0x7026, 0x60c3,
-	0x0018, 0x080c, 0x9dde, 0x009e, 0x00de, 0x0005, 0x7810, 0x00b6,
-	0x2058, 0xb8a0, 0x00be, 0x080c, 0xab33, 0x1118, 0x9084, 0xff80,
-	0x0110, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0096, 0x080c, 0x9a6e,
-	0x7003, 0x0500, 0x7814, 0x2048, 0xa874, 0x700a, 0xa878, 0x700e,
-	0xa87c, 0x7012, 0xa880, 0x7016, 0xa884, 0x701a, 0xa888, 0x701e,
-	0x60c3, 0x0010, 0x080c, 0x9dde, 0x009e, 0x00de, 0x0005, 0x00d6,
-	0x0096, 0x080c, 0x9a6e, 0x7003, 0x0500, 0x7814, 0x2048, 0xa8cc,
-	0x700a, 0xa8d0, 0x700e, 0xa8d4, 0x7012, 0xa8d8, 0x7016, 0xa8dc,
-	0x701a, 0xa8e0, 0x701e, 0x60c3, 0x0010, 0x080c, 0x9dde, 0x009e,
-	0x00de, 0x0005, 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x9a6e, 0x20e9, 0x0000, 0x2001, 0x19a3, 0x2003, 0x0000, 0x7814,
-	0x2048, 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0,
-	0xa85c, 0x9080, 0x001b, 0x2098, 0x2001, 0x19a3, 0x0016, 0x200c,
-	0x2001, 0x0001, 0x080c, 0x2195, 0x080c, 0xd58c, 0x9006, 0x080c,
-	0x2195, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c28, 0x04d9,
-	0x080c, 0x9dde, 0x012e, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x9ab9, 0x20e9, 0x0000, 0x2001,
-	0x19a3, 0x2003, 0x0000, 0x7814, 0x2048, 0xa86f, 0x0200, 0xa873,
-	0x0000, 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0,
-	0xa85c, 0x9080, 0x001b, 0x2098, 0x2001, 0x19a3, 0x0016, 0x200c,
-	0x080c, 0xd58c, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c60,
-	0x0051, 0x7814, 0x2048, 0x080c, 0x0fec, 0x080c, 0x9dde, 0x012e,
-	0x009e, 0x00de, 0x0005, 0x60c0, 0x8004, 0x9084, 0x0003, 0x9005,
-	0x0130, 0x9082, 0x0004, 0x20a3, 0x0000, 0x8000, 0x1de0, 0x0005,
-	0x080c, 0x9a6e, 0x7003, 0x7800, 0x7808, 0x8007, 0x700a, 0x60c3,
-	0x0008, 0x0804, 0x9dde, 0x00d6, 0x00e6, 0x080c, 0x9ab9, 0x7814,
-	0x9084, 0xff00, 0x2073, 0x0200, 0x8e70, 0x8e70, 0x9095, 0x0010,
-	0x2272, 0x8e70, 0x2073, 0x0034, 0x8e70, 0x2069, 0x1805, 0x20a9,
-	0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9809, 0x2069, 0x1801,
-	0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9812, 0x2069,
-	0x19b3, 0x9086, 0xdf00, 0x0110, 0x2069, 0x19cd, 0x20a9, 0x001a,
-	0x9e86, 0x0260, 0x1148, 0x00c6, 0x2061, 0x0200, 0x6010, 0x8000,
-	0x6012, 0x00ce, 0x2071, 0x0240, 0x2d04, 0x8007, 0x2072, 0x8d68,
-	0x8e70, 0x1f04, 0x9820, 0x60c3, 0x004c, 0x080c, 0x9dde, 0x00ee,
-	0x00de, 0x0005, 0x080c, 0x9a6e, 0x7003, 0x6300, 0x7007, 0x0028,
-	0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9dde, 0x00d6, 0x0026,
-	0x0016, 0x080c, 0x9ab9, 0x7003, 0x0200, 0x7814, 0x700e, 0x00e6,
-	0x9ef0, 0x0004, 0x2009, 0x0001, 0x2011, 0x000c, 0x2069, 0x1923,
-	0x6810, 0xd084, 0x1148, 0x2073, 0x0500, 0x8e70, 0x2073, 0x0000,
-	0x8e70, 0x8108, 0x9290, 0x0004, 0x2073, 0x0800, 0x8e70, 0x2073,
-	0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0x9dde, 0x001e,
-	0x002e, 0x00de, 0x0005, 0x2001, 0x1818, 0x2004, 0x609a, 0x0804,
-	0x9dde, 0x080c, 0x9a6e, 0x7003, 0x5200, 0x2069, 0x1847, 0x6804,
-	0xd084, 0x0130, 0x6828, 0x0016, 0x080c, 0x262e, 0x710e, 0x001e,
-	0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000,
-	0x20a1, 0x0250, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1,
-	0x0254, 0x4003, 0x080c, 0xab33, 0x1120, 0xb8a0, 0x9082, 0x007f,
-	0x0248, 0x2001, 0x181f, 0x2004, 0x7032, 0x2001, 0x1820, 0x2004,
-	0x7036, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x7036,
-	0x60c3, 0x001c, 0x0804, 0x9dde, 0x080c, 0x9a6e, 0x7003, 0x0500,
-	0x080c, 0xab33, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001,
-	0x181f, 0x2004, 0x700a, 0x2001, 0x1820, 0x2004, 0x700e, 0x0030,
-	0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x700e, 0x20a9, 0x0004,
-	0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0250,
-	0x4003, 0x60c3, 0x0010, 0x0804, 0x9dde, 0x080c, 0x9a6e, 0x9006,
-	0x080c, 0x6a25, 0xb8a0, 0x9086, 0x007e, 0x1130, 0x7003, 0x0400,
-	0x620c, 0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096, 0x904d, 0x0120,
-	0x9006, 0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003, 0x0300, 0xb8a0,
-	0x9086, 0x007e, 0x1904, 0x994c, 0x00d6, 0x2069, 0x196c, 0x2001,
-	0x1837, 0x2004, 0xd0a4, 0x0188, 0x6800, 0x700a, 0x6808, 0x9084,
-	0x2000, 0x7012, 0x080c, 0xab4a, 0x680c, 0x7016, 0x701f, 0x2710,
-	0x6818, 0x7022, 0x681c, 0x7026, 0x0090, 0x6800, 0x700a, 0x6804,
-	0x700e, 0x6808, 0x080c, 0x74d5, 0x1118, 0x9084, 0x37ff, 0x0010,
-	0x9084, 0x3fff, 0x7012, 0x080c, 0xab4a, 0x680c, 0x7016, 0x00de,
-	0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000,
-	0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1,
-	0x025a, 0x4003, 0x00d6, 0x080c, 0xa657, 0x2069, 0x1974, 0x2071,
-	0x024e, 0x6800, 0xc0dd, 0x7002, 0x080c, 0x56d7, 0xd0e4, 0x0110,
-	0x680c, 0x700e, 0x00de, 0x04a8, 0x2001, 0x1837, 0x2004, 0xd0a4,
-	0x0170, 0x0016, 0x2001, 0x196d, 0x200c, 0x60e0, 0x9106, 0x0130,
-	0x2100, 0x60e3, 0x0000, 0x080c, 0x266f, 0x61e2, 0x001e, 0x20e1,
-	0x0001, 0x2099, 0x196c, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x20a9,
-	0x0008, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1805, 0x20a1, 0x0256,
-	0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1, 0x025a, 0x4003,
-	0x080c, 0xa657, 0x20a1, 0x024e, 0x20a9, 0x0008, 0x2099, 0x1974,
-	0x4003, 0x60c3, 0x0074, 0x0804, 0x9dde, 0x080c, 0x9a6e, 0x7003,
-	0x2010, 0x7007, 0x0014, 0x700b, 0x0800, 0x700f, 0x2000, 0x9006,
-	0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe, 0xd1ac, 0x1110, 0x9085,
-	0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010, 0x9085, 0x0002, 0x00d6,
-	0x0804, 0x9a1e, 0x7026, 0x60c3, 0x0014, 0x0804, 0x9dde, 0x080c,
-	0x9a6e, 0x7003, 0x5000, 0x0804, 0x98f7, 0x080c, 0x9a6e, 0x7003,
-	0x2110, 0x7007, 0x0014, 0x60c3, 0x0014, 0x0804, 0x9dde, 0x080c,
-	0x9ab0, 0x0010, 0x080c, 0x9ab9, 0x7003, 0x0200, 0x60c3, 0x0004,
-	0x0804, 0x9dde, 0x080c, 0x9ab9, 0x7003, 0x0100, 0x700b, 0x0003,
-	0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0x9dde, 0x080c, 0x9ab9,
-	0x7003, 0x0200, 0x0804, 0x98f7, 0x080c, 0x9ab9, 0x7003, 0x0100,
-	0x782c, 0x9005, 0x0110, 0x700a, 0x0010, 0x700b, 0x0003, 0x7814,
-	0x700e, 0x60c3, 0x0008, 0x0804, 0x9dde, 0x00d6, 0x080c, 0x9ab9,
-	0x7003, 0x0210, 0x7007, 0x0014, 0x700b, 0x0800, 0xb894, 0x9086,
-	0x0014, 0x1198, 0xb99c, 0x9184, 0x0030, 0x0190, 0xb998, 0x9184,
-	0xc000, 0x1140, 0xd1ec, 0x0118, 0x700f, 0x2100, 0x0058, 0x700f,
-	0x0100, 0x0040, 0x700f, 0x0400, 0x0028, 0x700f, 0x0700, 0x0010,
-	0x700f, 0x0800, 0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe, 0xd1ac,
-	0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010, 0x2009,
-	0x1869, 0x210c, 0xd184, 0x1110, 0x9085, 0x0002, 0x0026, 0x2009,
-	0x1867, 0x210c, 0xd1e4, 0x0150, 0xc0c5, 0xbad4, 0xd28c, 0x1108,
-	0xc0cd, 0x9094, 0x0030, 0x9296, 0x0010, 0x0140, 0xd1ec, 0x0130,
-	0x9094, 0x0030, 0x9296, 0x0010, 0x0108, 0xc0bd, 0x002e, 0x7026,
-	0x60c3, 0x0014, 0x00de, 0x0804, 0x9dde, 0x080c, 0x9ab9, 0x7003,
-	0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3, 0x0014, 0x0804,
-	0x9dde, 0x080c, 0x9ab9, 0x7003, 0x0200, 0x0804, 0x987d, 0x080c,
-	0x9ab9, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3,
-	0x0008, 0x0804, 0x9dde, 0x080c, 0x9ab9, 0x7003, 0x0100, 0x700b,
-	0x000b, 0x60c3, 0x0008, 0x0804, 0x9dde, 0x0026, 0x00d6, 0x0036,
-	0x0046, 0x2019, 0x3200, 0x2021, 0x0800, 0x0040, 0x0026, 0x00d6,
-	0x0036, 0x0046, 0x2019, 0x2200, 0x2021, 0x0100, 0x080c, 0xa66c,
-	0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c,
-	0x700a, 0x6880, 0x700e, 0x9485, 0x0029, 0x7012, 0x004e, 0x003e,
-	0x00de, 0x080c, 0x9dd2, 0x721a, 0x9f95, 0x0000, 0x7222, 0x7027,
-	0xffff, 0x2071, 0x024c, 0x002e, 0x0005, 0x0026, 0x080c, 0xa66c,
-	0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069, 0x1800, 0x687c,
-	0x700a, 0x6880, 0x700e, 0x00de, 0x7013, 0x2029, 0x0c10, 0x7003,
-	0x0100, 0x7007, 0x0000, 0x700b, 0xfc02, 0x700f, 0x0000, 0x0005,
-	0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3300, 0x2021, 0x0800,
-	0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2300, 0x2021,
-	0x0100, 0x080c, 0xa66c, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006,
-	0x2069, 0x1800, 0xb810, 0x9005, 0x1140, 0xb814, 0x9005, 0x1128,
-	0x700b, 0x00ff, 0x700f, 0xfffe, 0x0020, 0x687c, 0x700a, 0x6880,
-	0x700e, 0x0000, 0x9485, 0x0098, 0x7012, 0x004e, 0x003e, 0x00de,
-	0x080c, 0x9dd2, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071,
-	0x024c, 0x002e, 0x0005, 0x080c, 0x9dd2, 0x721a, 0x7a08, 0x7222,
-	0x7814, 0x7026, 0x2071, 0x024c, 0x002e, 0x0005, 0x00b6, 0x00c6,
+	0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0040,
+	0x7008, 0xc0ad, 0x700a, 0x6003, 0x0009, 0x630a, 0x0804, 0x9456,
+	0x7020, 0x9c36, 0x1110, 0x660c, 0x7622, 0x701c, 0x9c36, 0x1140,
+	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x701e, 0x0010, 0x701f, 0x0000,
+	0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678,
+	0x600f, 0x0000, 0x6044, 0xc0fc, 0x6046, 0x6014, 0x2048, 0x080c,
+	0xc838, 0x01e8, 0x6020, 0x9086, 0x0003, 0x1580, 0x080c, 0xca4d,
+	0x1118, 0x080c, 0xb5b5, 0x0098, 0xa867, 0x0103, 0xab7a, 0xa877,
+	0x0000, 0x0016, 0x0036, 0x0086, 0x080c, 0xcb36, 0x080c, 0xe621,
+	0x080c, 0x6d80, 0x008e, 0x003e, 0x001e, 0x080c, 0xca27, 0x080c,
+	0xac28, 0x080c, 0xa20e, 0x00ce, 0x0804, 0x93d0, 0x2c78, 0x600c,
+	0x2060, 0x0804, 0x93d0, 0x012e, 0x000e, 0x001e, 0x006e, 0x00ce,
+	0x00de, 0x00ee, 0x00fe, 0x009e, 0x00be, 0x0005, 0x6020, 0x9086,
+	0x0006, 0x1158, 0x0016, 0x0036, 0x0086, 0x080c, 0xe621, 0x080c,
+	0xe26c, 0x008e, 0x003e, 0x001e, 0x08d0, 0x080c, 0xb5b5, 0x6020,
+	0x9086, 0x0002, 0x1160, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e,
+	0x0904, 0x943c, 0x9086, 0x008b, 0x0904, 0x943c, 0x0840, 0x6020,
+	0x9086, 0x0005, 0x1920, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e,
+	0x09c8, 0x9086, 0x008b, 0x09b0, 0x0804, 0x944f, 0x0006, 0x00f6,
+	0x00e6, 0x0096, 0x00b6, 0x00c6, 0x0066, 0x0016, 0x0126, 0x2091,
+	0x8000, 0x9280, 0x1000, 0x2004, 0x905d, 0x2079, 0x19e7, 0x9036,
+	0x7828, 0x2060, 0x8cff, 0x0538, 0x6010, 0x9b06, 0x1500, 0x6043,
+	0xffff, 0x080c, 0xaa75, 0x01d8, 0x610c, 0x0016, 0x080c, 0x9fa2,
+	0x6014, 0x2048, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016,
+	0x0036, 0x0086, 0x080c, 0xcb36, 0x080c, 0xe621, 0x080c, 0x6d80,
+	0x008e, 0x003e, 0x001e, 0x080c, 0xac28, 0x00ce, 0x08d8, 0x2c30,
+	0x600c, 0x2060, 0x08b8, 0x080c, 0x67cf, 0x012e, 0x001e, 0x006e,
+	0x00ce, 0x00be, 0x009e, 0x00ee, 0x00fe, 0x000e, 0x0005, 0x0096,
+	0x0006, 0x0066, 0x00c6, 0x00d6, 0x9036, 0x7820, 0x9065, 0x0904,
+	0x9546, 0x600c, 0x0006, 0x6044, 0xc0fc, 0x6046, 0x600f, 0x0000,
+	0x7830, 0x9c06, 0x1588, 0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508,
+	0x080c, 0x86f6, 0x080c, 0x9e32, 0x68c3, 0x0000, 0x080c, 0xa338,
+	0x7833, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
+	0x0138, 0x2001, 0x0100, 0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a,
+	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
+	0x0058, 0x080c, 0x6a03, 0x1538, 0x6003, 0x0009, 0x630a, 0x7808,
+	0xc0ad, 0x780a, 0x2c30, 0x00f8, 0x6014, 0x2048, 0x080c, 0xc836,
+	0x01b0, 0x6020, 0x9086, 0x0003, 0x1508, 0x080c, 0xca4d, 0x1118,
+	0x080c, 0xb5b5, 0x0060, 0x080c, 0x6a03, 0x1168, 0xa867, 0x0103,
+	0xab7a, 0xa877, 0x0000, 0x080c, 0x6d80, 0x080c, 0xca27, 0x080c,
+	0xac28, 0x080c, 0xa20e, 0x000e, 0x0804, 0x94e6, 0x7e22, 0x7e1e,
+	0x00de, 0x00ce, 0x006e, 0x000e, 0x009e, 0x0005, 0x6020, 0x9086,
+	0x0006, 0x1118, 0x080c, 0xe26c, 0x0c50, 0x080c, 0xb5b5, 0x6020,
+	0x9086, 0x0002, 0x1150, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e,
+	0x0990, 0x9086, 0x008b, 0x0978, 0x08d0, 0x6020, 0x9086, 0x0005,
+	0x19b0, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0d18, 0x9086,
+	0x008b, 0x0d00, 0x0860, 0x0006, 0x0096, 0x00b6, 0x00c6, 0x0066,
+	0x9036, 0x7828, 0x9065, 0x0510, 0x6010, 0x2058, 0x600c, 0x0006,
+	0x3e08, 0x918e, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x11a8, 0x6043,
+	0xffff, 0x080c, 0xaa75, 0x0180, 0x610c, 0x080c, 0x9fa2, 0x6014,
+	0x2048, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6d80,
+	0x080c, 0xac28, 0x000e, 0x08f0, 0x2c30, 0x0ce0, 0x006e, 0x00ce,
+	0x00be, 0x009e, 0x000e, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x0066,
+	0x080c, 0x613b, 0x11b0, 0x2071, 0x19e7, 0x7030, 0x9080, 0x0005,
+	0x2004, 0x904d, 0x0170, 0xa878, 0x9606, 0x1158, 0x2071, 0x19e7,
+	0x7030, 0x9035, 0x0130, 0x9080, 0x0005, 0x2004, 0x9906, 0x1108,
+	0x0029, 0x006e, 0x009e, 0x00de, 0x00ee, 0x0005, 0x00c6, 0x2660,
+	0x6043, 0xffff, 0x080c, 0xaa75, 0x0178, 0x080c, 0x9fa2, 0x6014,
+	0x2048, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xcb36,
+	0x080c, 0x6d80, 0x080c, 0xac28, 0x00ce, 0x0005, 0x00b6, 0x00e6,
+	0x00c6, 0x080c, 0xa8f4, 0x0106, 0x190c, 0xa896, 0x2071, 0x0101,
+	0x2e04, 0xc0c4, 0x2072, 0x6044, 0xd0fc, 0x1138, 0x010e, 0x190c,
+	0xa8b2, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x2071, 0x19e7, 0x7030,
+	0x9005, 0x0da0, 0x9c06, 0x190c, 0x0d7d, 0x7036, 0x080c, 0x86f6,
+	0x7004, 0x9084, 0x0007, 0x0002, 0x960e, 0x9610, 0x9617, 0x9621,
+	0x962f, 0x960e, 0x9617, 0x960c, 0x080c, 0x0d7d, 0x0428, 0x0005,
+	0x080c, 0xaa60, 0x7007, 0x0000, 0x7033, 0x0000, 0x00e8, 0x0066,
+	0x9036, 0x080c, 0x9fa2, 0x006e, 0x7007, 0x0000, 0x7033, 0x0000,
+	0x0098, 0x080c, 0xaa4b, 0x0140, 0x080c, 0xaa60, 0x0128, 0x0066,
+	0x9036, 0x080c, 0x9fa2, 0x006e, 0x7033, 0x0000, 0x0028, 0x080c,
+	0xaa4b, 0x080c, 0xa338, 0x0000, 0x010e, 0x190c, 0xa8b2, 0x00ce,
+	0x00ee, 0x00be, 0x0005, 0x00d6, 0x00c6, 0x080c, 0xa8f4, 0x0106,
+	0x190c, 0xa896, 0x6044, 0xd0fc, 0x1130, 0x010e, 0x190c, 0xa8b2,
+	0x00ce, 0x00de, 0x0005, 0x2069, 0x19e7, 0x684c, 0x9005, 0x0da8,
+	0x9c06, 0x190c, 0x0d7d, 0x6852, 0x00e6, 0x2d70, 0x080c, 0x926e,
+	0x00ee, 0x080c, 0x8703, 0x0016, 0x2009, 0x0040, 0x080c, 0x21b0,
+	0x001e, 0x683c, 0x9084, 0x0003, 0x0002, 0x966b, 0x966c, 0x968a,
+	0x9669, 0x080c, 0x0d7d, 0x0460, 0x6868, 0x9086, 0x0001, 0x0190,
+	0x600c, 0x9015, 0x0160, 0x6a4a, 0x600f, 0x0000, 0x6044, 0xc0fc,
+	0x6046, 0x9006, 0x7042, 0x684e, 0x683f, 0x0000, 0x00c8, 0x684a,
+	0x6846, 0x0ca0, 0x686b, 0x0000, 0x6848, 0x9065, 0x0d78, 0x6003,
+	0x0002, 0x0c60, 0x9006, 0x686a, 0x6852, 0x686e, 0x600c, 0x9015,
+	0x0120, 0x6a4a, 0x600f, 0x0000, 0x0018, 0x684e, 0x684a, 0x6846,
+	0x684f, 0x0000, 0x010e, 0x190c, 0xa8b2, 0x00ce, 0x00de, 0x0005,
+	0x0005, 0x6020, 0x9084, 0x000f, 0x000b, 0x0005, 0x96b6, 0x96b9,
+	0x9b27, 0x9bb6, 0x96b9, 0x9b27, 0x9bb6, 0x96b6, 0x96b9, 0x96b6,
+	0x96b6, 0x96b6, 0x96b6, 0x96b6, 0x96b6, 0x96b6, 0x080c, 0x95de,
+	0x0005, 0x00b6, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6,
 	0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071, 0x0240, 0x6004,
-	0x908a, 0x0085, 0x0a0c, 0x0d7d, 0x908a, 0x0092, 0x1a0c, 0x0d7d,
-	0x6110, 0x2158, 0xb984, 0x2c78, 0x2061, 0x0100, 0x619a, 0x9082,
-	0x0085, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x0005,
-	0x9b27, 0x9b36, 0x9b41, 0x9b25, 0x9b25, 0x9b25, 0x9b27, 0x9b25,
-	0x9b25, 0x9b25, 0x9b25, 0x9b25, 0x9b25, 0x080c, 0x0d7d, 0x0411,
-	0x60c3, 0x0000, 0x0026, 0x080c, 0x2979, 0x0228, 0x2011, 0x0101,
-	0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0x9dde, 0x0431, 0x7808,
-	0x700a, 0x7814, 0x700e, 0x7017, 0xffff, 0x60c3, 0x000c, 0x0804,
-	0x9dde, 0x0479, 0x7003, 0x0003, 0x7007, 0x0300, 0x60c3, 0x0004,
-	0x0804, 0x9dde, 0x0026, 0x080c, 0xa66c, 0xb810, 0x9085, 0x8100,
+	0x908a, 0x0053, 0x1a0c, 0x0d7d, 0x6110, 0x2158, 0xb984, 0x2c78,
+	0x2061, 0x0100, 0x619a, 0x908a, 0x0040, 0x1a04, 0x9725, 0x005b,
+	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e,
+	0x015e, 0x00be, 0x0005, 0x98aa, 0x98e5, 0x990e, 0x99b6, 0x99d8,
+	0x99de, 0x99eb, 0x99f3, 0x99ff, 0x9a05, 0x9a16, 0x9a05, 0x9a6e,
+	0x99f3, 0x9a7a, 0x9a80, 0x99ff, 0x9a80, 0x9a8c, 0x9723, 0x9723,
+	0x9723, 0x9723, 0x9723, 0x9723, 0x9723, 0x9723, 0x9723, 0x9723,
+	0x9723, 0x9fc3, 0x9fe6, 0x9ff7, 0xa017, 0xa049, 0x99eb, 0x9723,
+	0x99eb, 0x9a05, 0x9723, 0x990e, 0x99b6, 0x9723, 0xa42b, 0x9a05,
+	0x9723, 0xa447, 0x9a05, 0x9723, 0x99ff, 0x98a4, 0x9746, 0x9723,
+	0xa463, 0xa4d0, 0xa5b0, 0x9723, 0xa5bd, 0x99e8, 0xa5e8, 0x9723,
+	0xa053, 0xa5f4, 0x9723, 0x080c, 0x0d7d, 0x2100, 0x005b, 0x00fe,
+	0x00ee, 0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e,
+	0x00be, 0x0005, 0xa694, 0xa746, 0x9744, 0x976d, 0x9819, 0x9824,
+	0x9744, 0x99eb, 0x9744, 0x986b, 0x9877, 0x9788, 0x9744, 0x97a3,
+	0x97d7, 0xaacb, 0xab10, 0x9a05, 0x080c, 0x0d7d, 0x00d6, 0x0096,
+	0x080c, 0x9a9f, 0x7003, 0x2414, 0x7007, 0x0018, 0x700b, 0x0800,
+	0x7814, 0x2048, 0xa83c, 0x700e, 0xa850, 0x7022, 0xa854, 0x7026,
+	0x60c3, 0x0018, 0x080c, 0x9e02, 0x009e, 0x00de, 0x0005, 0x7810,
+	0x00b6, 0x2058, 0xb8a0, 0x00be, 0x080c, 0xab57, 0x1118, 0x9084,
+	0xff80, 0x0110, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0096, 0x080c,
+	0x9a9f, 0x7003, 0x0500, 0x7814, 0x2048, 0xa874, 0x700a, 0xa878,
+	0x700e, 0xa87c, 0x7012, 0xa880, 0x7016, 0xa884, 0x701a, 0xa888,
+	0x701e, 0x60c3, 0x0010, 0x080c, 0x9e02, 0x009e, 0x00de, 0x0005,
+	0x00d6, 0x0096, 0x080c, 0x9a9f, 0x7003, 0x0500, 0x7814, 0x2048,
+	0xa8cc, 0x700a, 0xa8d0, 0x700e, 0xa8d4, 0x7012, 0xa8d8, 0x7016,
+	0xa8dc, 0x701a, 0xa8e0, 0x701e, 0x60c3, 0x0010, 0x080c, 0x9e02,
+	0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x9a9f, 0x20e9, 0x0000, 0x2001, 0x19a3, 0x2003, 0x0000,
+	0x7814, 0x2048, 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860,
+	0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x2001, 0x19a3, 0x0016,
+	0x200c, 0x2001, 0x0001, 0x080c, 0x2195, 0x080c, 0xd5b1, 0x9006,
+	0x080c, 0x2195, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c28,
+	0x04d9, 0x080c, 0x9e02, 0x012e, 0x009e, 0x00de, 0x0005, 0x00d6,
+	0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x9aea, 0x20e9, 0x0000,
+	0x2001, 0x19a3, 0x2003, 0x0000, 0x7814, 0x2048, 0xa86f, 0x0200,
+	0xa873, 0x0000, 0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860,
+	0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x2001, 0x19a3, 0x0016,
+	0x200c, 0x080c, 0xd5b1, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048,
+	0x0c60, 0x0051, 0x7814, 0x2048, 0x080c, 0x0fec, 0x080c, 0x9e02,
+	0x012e, 0x009e, 0x00de, 0x0005, 0x60c0, 0x8004, 0x9084, 0x0003,
+	0x9005, 0x0130, 0x9082, 0x0004, 0x20a3, 0x0000, 0x8000, 0x1de0,
+	0x0005, 0x080c, 0x9a9f, 0x7003, 0x7800, 0x7808, 0x8007, 0x700a,
+	0x60c3, 0x0008, 0x0804, 0x9e02, 0x00d6, 0x00e6, 0x080c, 0x9aea,
+	0x7814, 0x9084, 0xff00, 0x2073, 0x0200, 0x8e70, 0x8e70, 0x9095,
+	0x0010, 0x2272, 0x8e70, 0x2073, 0x0034, 0x8e70, 0x2069, 0x1805,
+	0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x983a, 0x2069,
+	0x1801, 0x20a9, 0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x9843,
+	0x2069, 0x19b3, 0x9086, 0xdf00, 0x0110, 0x2069, 0x19cd, 0x20a9,
+	0x001a, 0x9e86, 0x0260, 0x1148, 0x00c6, 0x2061, 0x0200, 0x6010,
+	0x8000, 0x6012, 0x00ce, 0x2071, 0x0240, 0x2d04, 0x8007, 0x2072,
+	0x8d68, 0x8e70, 0x1f04, 0x9851, 0x60c3, 0x004c, 0x080c, 0x9e02,
+	0x00ee, 0x00de, 0x0005, 0x080c, 0x9a9f, 0x7003, 0x6300, 0x7007,
+	0x0028, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9e02, 0x00d6,
+	0x0026, 0x0016, 0x080c, 0x9aea, 0x7003, 0x0200, 0x7814, 0x700e,
+	0x00e6, 0x9ef0, 0x0004, 0x2009, 0x0001, 0x2011, 0x000c, 0x2069,
+	0x1923, 0x6810, 0xd084, 0x1148, 0x2073, 0x0500, 0x8e70, 0x2073,
+	0x0000, 0x8e70, 0x8108, 0x9290, 0x0004, 0x2073, 0x0800, 0x8e70,
+	0x2073, 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0x9e02,
+	0x001e, 0x002e, 0x00de, 0x0005, 0x2001, 0x1818, 0x2004, 0x609a,
+	0x0804, 0x9e02, 0x080c, 0x9a9f, 0x7003, 0x5200, 0x2069, 0x1847,
+	0x6804, 0xd084, 0x0130, 0x6828, 0x0016, 0x080c, 0x262e, 0x710e,
+	0x001e, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
+	0x0000, 0x20a1, 0x0250, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801,
+	0x20a1, 0x0254, 0x4003, 0x080c, 0xab57, 0x1120, 0xb8a0, 0x9082,
+	0x007f, 0x0248, 0x2001, 0x181f, 0x2004, 0x7032, 0x2001, 0x1820,
+	0x2004, 0x7036, 0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff,
+	0x7036, 0x60c3, 0x001c, 0x0804, 0x9e02, 0x080c, 0x9a9f, 0x7003,
+	0x0500, 0x080c, 0xab57, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
+	0x2001, 0x181f, 0x2004, 0x700a, 0x2001, 0x1820, 0x2004, 0x700e,
+	0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x700e, 0x20a9,
+	0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1,
+	0x0250, 0x4003, 0x60c3, 0x0010, 0x0804, 0x9e02, 0x080c, 0x9a9f,
+	0x9006, 0x080c, 0x6a35, 0xb8a0, 0x9086, 0x007e, 0x1130, 0x7003,
+	0x0400, 0x620c, 0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096, 0x904d,
+	0x0120, 0x9006, 0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003, 0x0300,
+	0xb8a0, 0x9086, 0x007e, 0x1904, 0x997d, 0x00d6, 0x2069, 0x196c,
+	0x2001, 0x1837, 0x2004, 0xd0a4, 0x0188, 0x6800, 0x700a, 0x6808,
+	0x9084, 0x2000, 0x7012, 0x080c, 0xab6e, 0x680c, 0x7016, 0x701f,
+	0x2710, 0x6818, 0x7022, 0x681c, 0x7026, 0x0090, 0x6800, 0x700a,
+	0x6804, 0x700e, 0x6808, 0x080c, 0x74e9, 0x1118, 0x9084, 0x37ff,
+	0x0010, 0x9084, 0x3fff, 0x7012, 0x080c, 0xab6e, 0x680c, 0x7016,
+	0x00de, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
+	0x0000, 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801,
+	0x20a1, 0x025a, 0x4003, 0x00d6, 0x080c, 0xa67b, 0x2069, 0x1974,
+	0x2071, 0x024e, 0x6800, 0xc0dd, 0x7002, 0x080c, 0x56de, 0xd0e4,
+	0x0110, 0x680c, 0x700e, 0x00de, 0x04a8, 0x2001, 0x1837, 0x2004,
+	0xd0a4, 0x0170, 0x0016, 0x2001, 0x196d, 0x200c, 0x60e0, 0x9106,
+	0x0130, 0x2100, 0x60e3, 0x0000, 0x080c, 0x266f, 0x61e2, 0x001e,
+	0x20e1, 0x0001, 0x2099, 0x196c, 0x20e9, 0x0000, 0x20a1, 0x024e,
+	0x20a9, 0x0008, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1805, 0x20a1,
+	0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1, 0x025a,
+	0x4003, 0x080c, 0xa67b, 0x20a1, 0x024e, 0x20a9, 0x0008, 0x2099,
+	0x1974, 0x4003, 0x60c3, 0x0074, 0x0804, 0x9e02, 0x080c, 0x9a9f,
+	0x7003, 0x2010, 0x7007, 0x0014, 0x700b, 0x0800, 0x700f, 0x2000,
+	0x9006, 0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe, 0xd1ac, 0x1110,
+	0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010, 0x9085, 0x0002,
+	0x00d6, 0x0804, 0x9a4f, 0x7026, 0x60c3, 0x0014, 0x0804, 0x9e02,
+	0x080c, 0x9a9f, 0x7003, 0x5000, 0x0804, 0x9928, 0x080c, 0x9a9f,
+	0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014, 0x0804, 0x9e02,
+	0x080c, 0x9ae1, 0x0010, 0x080c, 0x9aea, 0x7003, 0x0200, 0x60c3,
+	0x0004, 0x0804, 0x9e02, 0x080c, 0x9aea, 0x7003, 0x0100, 0x700b,
+	0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0x9e02, 0x080c,
+	0x9aea, 0x7003, 0x0200, 0x0804, 0x9928, 0x080c, 0x9aea, 0x7003,
+	0x0100, 0x782c, 0x9005, 0x0110, 0x700a, 0x0010, 0x700b, 0x0003,
+	0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9e02, 0x00d6, 0x080c,
+	0x9aea, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b, 0x0800, 0xb894,
+	0x9086, 0x0014, 0x1198, 0xb99c, 0x9184, 0x0030, 0x0190, 0xb998,
+	0x9184, 0xc000, 0x1140, 0xd1ec, 0x0118, 0x700f, 0x2100, 0x0058,
+	0x700f, 0x0100, 0x0040, 0x700f, 0x0400, 0x0028, 0x700f, 0x0700,
+	0x0010, 0x700f, 0x0800, 0x00f6, 0x2079, 0x1847, 0x7904, 0x00fe,
+	0xd1ac, 0x1110, 0x9085, 0x0020, 0xd1a4, 0x0110, 0x9085, 0x0010,
+	0x2009, 0x1869, 0x210c, 0xd184, 0x1110, 0x9085, 0x0002, 0x0026,
+	0x2009, 0x1867, 0x210c, 0xd1e4, 0x0150, 0xc0c5, 0xbad4, 0xd28c,
+	0x1108, 0xc0cd, 0x9094, 0x0030, 0x9296, 0x0010, 0x0140, 0xd1ec,
+	0x0130, 0x9094, 0x0030, 0x9296, 0x0010, 0x0108, 0xc0bd, 0x002e,
+	0x7026, 0x60c3, 0x0014, 0x00de, 0x0804, 0x9e02, 0x080c, 0x9aea,
+	0x7003, 0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3, 0x0014,
+	0x0804, 0x9e02, 0x080c, 0x9aea, 0x7003, 0x0200, 0x0804, 0x98ae,
+	0x080c, 0x9aea, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f, 0x2a00,
+	0x60c3, 0x0008, 0x0804, 0x9e02, 0x080c, 0x9aea, 0x7003, 0x0100,
+	0x700b, 0x000b, 0x60c3, 0x0008, 0x0804, 0x9e02, 0x0026, 0x00d6,
+	0x0036, 0x0046, 0x2019, 0x3200, 0x2021, 0x0800, 0x0040, 0x0026,
+	0x00d6, 0x0036, 0x0046, 0x2019, 0x2200, 0x2021, 0x0100, 0x080c,
+	0xa690, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
+	0x687c, 0x700a, 0x6880, 0x700e, 0x9485, 0x0029, 0x7012, 0x004e,
+	0x003e, 0x00de, 0x080c, 0x9df6, 0x721a, 0x9f95, 0x0000, 0x7222,
+	0x7027, 0xffff, 0x2071, 0x024c, 0x002e, 0x0005, 0x0026, 0x080c,
+	0xa690, 0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069, 0x1800,
+	0x687c, 0x700a, 0x6880, 0x700e, 0x00de, 0x7013, 0x2029, 0x0c10,
+	0x7003, 0x0100, 0x7007, 0x0000, 0x700b, 0xfc02, 0x700f, 0x0000,
+	0x0005, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3300, 0x2021,
+	0x0800, 0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2300,
+	0x2021, 0x0100, 0x080c, 0xa690, 0xb810, 0x9305, 0x7002, 0xb814,
+	0x7006, 0x2069, 0x1800, 0xb810, 0x9005, 0x1140, 0xb814, 0x9005,
+	0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0020, 0x687c, 0x700a,
+	0x6880, 0x700e, 0x0000, 0x9485, 0x0098, 0x7012, 0x004e, 0x003e,
+	0x00de, 0x080c, 0x9df6, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226,
+	0x2071, 0x024c, 0x002e, 0x0005, 0x080c, 0x9df6, 0x721a, 0x7a08,
+	0x7222, 0x7814, 0x7026, 0x2071, 0x024c, 0x002e, 0x0005, 0x00b6,
+	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071, 0x0240,
+	0x6004, 0x908a, 0x0085, 0x0a0c, 0x0d7d, 0x908a, 0x0092, 0x1a0c,
+	0x0d7d, 0x6110, 0x2158, 0xb984, 0x2c78, 0x2061, 0x0100, 0x619a,
+	0x9082, 0x0085, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
+	0x0005, 0x9b58, 0x9b67, 0x9b72, 0x9b56, 0x9b56, 0x9b56, 0x9b58,
+	0x9b56, 0x9b56, 0x9b56, 0x9b56, 0x9b56, 0x9b56, 0x080c, 0x0d7d,
+	0x0411, 0x60c3, 0x0000, 0x0026, 0x080c, 0x2979, 0x0228, 0x2011,
+	0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0x9e02, 0x0431,
+	0x7808, 0x700a, 0x7814, 0x700e, 0x7017, 0xffff, 0x60c3, 0x000c,
+	0x0804, 0x9e02, 0x0479, 0x7003, 0x0003, 0x7007, 0x0300, 0x60c3,
+	0x0004, 0x0804, 0x9e02, 0x0026, 0x080c, 0xa690, 0xb810, 0x9085,
+	0x8100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a,
+	0x6880, 0x700e, 0x7013, 0x0009, 0x0804, 0x9aba, 0x0026, 0x080c,
+	0xa690, 0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006, 0x2069,
+	0x1800, 0x687c, 0x700a, 0x6880, 0x700e, 0x2001, 0x0099, 0x7012,
+	0x0804, 0x9b1c, 0x0026, 0x080c, 0xa690, 0xb810, 0x9085, 0x8500,
 	0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880,
-	0x700e, 0x7013, 0x0009, 0x0804, 0x9a89, 0x0026, 0x080c, 0xa66c,
-	0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
-	0x687c, 0x700a, 0x6880, 0x700e, 0x2001, 0x0099, 0x7012, 0x0804,
-	0x9aeb, 0x0026, 0x080c, 0xa66c, 0xb810, 0x9085, 0x8500, 0x7002,
-	0xb814, 0x7006, 0x2069, 0x1800, 0x687c, 0x700a, 0x6880, 0x700e,
-	0x2001, 0x0099, 0x7012, 0x0804, 0x9aeb, 0x00b6, 0x00c6, 0x00d6,
-	0x00e6, 0x00f6, 0x2c78, 0x2069, 0x0200, 0x2071, 0x0240, 0x7804,
-	0x908a, 0x0040, 0x0a0c, 0x0d7d, 0x908a, 0x0057, 0x1a0c, 0x0d7d,
-	0x7910, 0x2158, 0xb984, 0x2061, 0x0100, 0x619a, 0x9082, 0x0040,
-	0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x0005, 0x9bba,
-	0x9bba, 0x9bba, 0x9bde, 0x9bba, 0x9bba, 0x9bba, 0x9bba, 0x9bba,
-	0x9bba, 0x9bba, 0xa1c7, 0xa1cf, 0xa1d7, 0xa1df, 0x9bba, 0x9bba,
-	0x9bba, 0xa1bf, 0x080c, 0x0d7d, 0x6813, 0x0008, 0xba8c, 0x8210,
-	0xb8d4, 0xd084, 0x0128, 0x7a4e, 0x7b14, 0x7b52, 0x722e, 0x732a,
-	0x9294, 0x00ff, 0xba8e, 0x8217, 0x721a, 0xba10, 0x9295, 0x0600,
-	0x7202, 0xba14, 0x7206, 0x6a7c, 0x720a, 0x6a80, 0x720e, 0x7013,
-	0x0829, 0x2f10, 0x7222, 0x7027, 0xffff, 0x0005, 0x0016, 0x7814,
-	0x9084, 0x0700, 0x8007, 0x0013, 0x001e, 0x0005, 0x9bee, 0x9bee,
-	0x9bf0, 0x9bee, 0x9bee, 0x9bee, 0x9c0a, 0x9bee, 0x080c, 0x0d7d,
-	0x7914, 0x918c, 0x08ff, 0x918d, 0xf600, 0x7916, 0x2009, 0x0003,
-	0x00b9, 0x2069, 0x1847, 0x6804, 0xd0bc, 0x0130, 0x682c, 0x9084,
-	0x00ff, 0x8007, 0x7032, 0x0010, 0x7033, 0x3f00, 0x60c3, 0x0001,
-	0x0804, 0x9dde, 0x2009, 0x0003, 0x0019, 0x7033, 0x7f00, 0x0cb0,
-	0x0016, 0x080c, 0xa66c, 0x001e, 0xb810, 0x9085, 0x0100, 0x7002,
-	0xb814, 0x7006, 0x2069, 0x1800, 0x6a7c, 0x720a, 0x6a80, 0x720e,
-	0x7013, 0x0888, 0x918d, 0x0008, 0x7116, 0x080c, 0x9dd2, 0x721a,
-	0x7a08, 0x7222, 0x2f10, 0x7226, 0x0005, 0x00b6, 0x00e6, 0x00d6,
-	0x00c6, 0x0066, 0x0056, 0x0046, 0x0036, 0x2061, 0x0100, 0x2071,
-	0x1800, 0x7160, 0x7810, 0x2058, 0x76dc, 0x96b4, 0x0028, 0x0110,
-	0x737c, 0x7480, 0x2500, 0x76dc, 0x96b4, 0x0028, 0x0140, 0x2001,
-	0x04ff, 0x6062, 0x6067, 0xffff, 0x636a, 0x646e, 0x0050, 0x2001,
-	0x00ff, 0x9085, 0x0400, 0x6062, 0x6067, 0xffff, 0x606b, 0x0000,
-	0x616e, 0xb8b8, 0x6073, 0x0530, 0x6077, 0x0008, 0xb88c, 0x8000,
-	0x9084, 0x00ff, 0xb88e, 0x8007, 0x9085, 0x0020, 0x607a, 0x607f,
-	0x0000, 0x2b00, 0x6082, 0x6087, 0xffff, 0x7814, 0x0096, 0x2048,
-	0xa848, 0x608a, 0xa844, 0x608e, 0xa838, 0x60c6, 0xa834, 0x60ca,
-	0x009e, 0xb86c, 0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7,
-	0x0000, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x0128, 0x609f,
-	0x0000, 0x2001, 0x0092, 0x0058, 0x6028, 0xc0bd, 0x602a, 0x609f,
-	0x00ff, 0x2011, 0xffff, 0x080c, 0x2a44, 0x2001, 0x00b2, 0x2010,
-	0x900e, 0x080c, 0x2a53, 0x2009, 0x07d0, 0x080c, 0x86ca, 0x003e,
-	0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005,
+	0x700e, 0x2001, 0x0099, 0x7012, 0x0804, 0x9b1c, 0x00b6, 0x00c6,
+	0x00d6, 0x00e6, 0x00f6, 0x2c78, 0x2069, 0x0200, 0x2071, 0x0240,
+	0x7804, 0x908a, 0x0040, 0x0a0c, 0x0d7d, 0x908a, 0x0057, 0x1a0c,
+	0x0d7d, 0x7910, 0x2158, 0xb984, 0x2061, 0x0100, 0x619a, 0x9082,
+	0x0040, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x0005,
+	0x9beb, 0x9beb, 0x9beb, 0x9c11, 0x9beb, 0x9beb, 0x9beb, 0x9beb,
+	0x9beb, 0x9beb, 0x9beb, 0xa1eb, 0xa1f3, 0xa1fb, 0xa203, 0x9beb,
+	0x9beb, 0x9beb, 0xa1e3, 0x080c, 0x0d7d, 0x6813, 0x0008, 0xba8c,
+	0x8210, 0xb8d4, 0xd084, 0x0128, 0x7a4e, 0x7b14, 0x7b52, 0x722e,
+	0x732a, 0x9294, 0x00ff, 0xba8e, 0x8217, 0x721a, 0xba10, 0x9295,
+	0x0600, 0x7202, 0xba14, 0x7206, 0x2069, 0x1800, 0x6a7c, 0x720a,
+	0x6a80, 0x720e, 0x7013, 0x0829, 0x2f10, 0x7222, 0x7027, 0xffff,
+	0x0005, 0x0016, 0x7814, 0x9084, 0x0700, 0x8007, 0x0013, 0x001e,
+	0x0005, 0x9c21, 0x9c21, 0x9c23, 0x9c21, 0x9c21, 0x9c21, 0x9c3d,
+	0x9c21, 0x080c, 0x0d7d, 0x7914, 0x918c, 0x08ff, 0x918d, 0xf600,
+	0x7916, 0x2009, 0x0003, 0x00b9, 0x2069, 0x1847, 0x6804, 0xd0bc,
+	0x0130, 0x682c, 0x9084, 0x00ff, 0x8007, 0x7032, 0x0010, 0x7033,
+	0x3f00, 0x60c3, 0x0001, 0x0804, 0x9e02, 0x2009, 0x0003, 0x0019,
+	0x7033, 0x7f00, 0x0cb0, 0x0016, 0x080c, 0xa690, 0x001e, 0xb810,
+	0x9085, 0x0100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6a7c,
+	0x720a, 0x6a80, 0x720e, 0x7013, 0x0888, 0x918d, 0x0008, 0x7116,
+	0x080c, 0x9df6, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x0005,
 	0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046, 0x0036,
-	0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810, 0x2058, 0xb8a0,
-	0x2028, 0x76dc, 0xd6ac, 0x1168, 0x9582, 0x007e, 0x1250, 0x2500,
-	0x9094, 0xff80, 0x1130, 0x9080, 0x336d, 0x2015, 0x9294, 0x00ff,
-	0x0020, 0xb910, 0xba14, 0x737c, 0x7480, 0x70dc, 0xd0ac, 0x1130,
-	0x9582, 0x007e, 0x1218, 0x9584, 0xff80, 0x0138, 0x9185, 0x0400,
-	0x6062, 0x6266, 0x636a, 0x646e, 0x0030, 0x6063, 0x0400, 0x6266,
-	0x606b, 0x0000, 0x616e, 0xb8b8, 0x6072, 0x6077, 0x0000, 0xb864,
-	0xd0a4, 0x0110, 0x6077, 0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff,
-	0xb88e, 0x8007, 0x9085, 0x0020, 0x607a, 0x607f, 0x0000, 0x2b00,
-	0x6082, 0x6087, 0xffff, 0x7814, 0x0096, 0x2048, 0xa848, 0x608a,
-	0xa844, 0x608e, 0xa838, 0x60c6, 0xa834, 0x60ca, 0x009e, 0xb86c,
-	0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5, 0x60d7, 0x0000, 0xba84,
-	0x629e, 0x00f6, 0x2079, 0x0140, 0x7803, 0x0000, 0x00fe, 0x900e,
-	0x2011, 0x0092, 0x080c, 0x2a53, 0x2009, 0x07d0, 0x080c, 0x86ca,
-	0x003e, 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be,
-	0x0005, 0x00b6, 0x0096, 0x00e6, 0x00d6, 0x00c6, 0x0056, 0x0046,
-	0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7810, 0x2058, 0xb8a0,
-	0x2028, 0xb910, 0xba14, 0x737c, 0x7480, 0x7820, 0x0002, 0x9d4e,
-	0x9d4e, 0x9d4e, 0x9d4e, 0x9d4e, 0x9d4e, 0x9d4e, 0x9d4e, 0x9d4e,
-	0x9d4e, 0x9d50, 0x9d4e, 0x9d4e, 0x9d4e, 0x9d4e, 0x080c, 0x0d7d,
-	0x609f, 0x0000, 0x7814, 0x2048, 0xa87c, 0xd0fc, 0x05d0, 0xaf90,
-	0x9784, 0xff00, 0x9105, 0x6062, 0x873f, 0x9784, 0xff00, 0x0006,
-	0x7814, 0x2048, 0xa878, 0xc0fc, 0x9005, 0x000e, 0x1160, 0xaf94,
-	0x87ff, 0x0510, 0x2039, 0x0098, 0x9705, 0x6072, 0x7808, 0x6082,
-	0x2f00, 0x6086, 0x0038, 0x9185, 0x2200, 0x6062, 0x6073, 0x0129,
-	0x6077, 0x0000, 0x609f, 0x0000, 0x2001, 0x1837, 0x2004, 0xd0ac,
-	0x11a8, 0xd09c, 0x0130, 0x7814, 0x2048, 0xa874, 0x9082, 0x0080,
-	0x1268, 0xb814, 0x609e, 0x0050, 0x2039, 0x0029, 0x9705, 0x6072,
-	0x0c48, 0x9185, 0x0200, 0x6062, 0x6073, 0x2029, 0xa87c, 0xd0fc,
-	0x0118, 0xaf94, 0x87ff, 0x1120, 0x2f00, 0x6082, 0x7808, 0x6086,
-	0x6266, 0x636a, 0x646e, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084,
-	0x00ff, 0xb88e, 0x8007, 0x607a, 0x607f, 0x0000, 0xa848, 0x608a,
-	0xa844, 0x608e, 0xa838, 0x60c6, 0xa834, 0x60ca, 0xb86c, 0x60ce,
-	0x60af, 0x95d5, 0x60d7, 0x0000, 0x080c, 0xa64c, 0x2009, 0x07d0,
-	0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58, 0x080c,
-	0x86ca, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x009e,
-	0x00be, 0x0005, 0x7a40, 0x9294, 0x00ff, 0x8217, 0x0005, 0x00d6,
-	0x2069, 0x19e7, 0x686b, 0x0001, 0x00de, 0x0005, 0x60a3, 0x0056,
-	0x60a7, 0x9575, 0x00f1, 0x080c, 0x86bc, 0x0005, 0x0016, 0x2001,
-	0x180c, 0x200c, 0x9184, 0x0600, 0x9086, 0x0600, 0x0128, 0x0089,
-	0x080c, 0x86bc, 0x001e, 0x0005, 0xc1e5, 0x2001, 0x180c, 0x2102,
-	0x2001, 0x19e8, 0x2003, 0x0000, 0x2001, 0x19f3, 0x2003, 0x0000,
-	0x0c88, 0x0006, 0x0016, 0x0026, 0x2009, 0x1804, 0x2011, 0x0009,
-	0x080c, 0x2a53, 0x002e, 0x001e, 0x000e, 0x0005, 0x0016, 0x00c6,
-	0x0006, 0x080c, 0xa8d0, 0x0106, 0x190c, 0xa872, 0x2061, 0x0100,
-	0x61a4, 0x60a7, 0x95f5, 0x0016, 0x0026, 0x2009, 0x1804, 0x2011,
-	0x0008, 0x080c, 0x2a53, 0x002e, 0x001e, 0x010e, 0x190c, 0xa88e,
-	0x000e, 0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e, 0x0005,
-	0x00c6, 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069, 0x0140,
-	0x080c, 0x74d5, 0x1510, 0x2001, 0x1a0c, 0x2004, 0x9005, 0x1904,
-	0x9e8f, 0x080c, 0x7576, 0x11a8, 0x2069, 0x0380, 0x6843, 0x0101,
-	0x6844, 0xd084, 0x1de8, 0x2061, 0x0100, 0x6020, 0xd0b4, 0x1120,
-	0x6024, 0xd084, 0x090c, 0x0d7d, 0x6843, 0x0100, 0x080c, 0x86bc,
-	0x04b0, 0x00c6, 0x2061, 0x19e7, 0x00f0, 0x6904, 0x9194, 0x4000,
-	0x0598, 0x080c, 0x9e0e, 0x080c, 0x2a1a, 0x00c6, 0x2061, 0x19e7,
-	0x6134, 0x9192, 0x0008, 0x1278, 0x8108, 0x6136, 0x080c, 0xa872,
-	0x6130, 0x080c, 0xa88e, 0x00ce, 0x81ff, 0x01c8, 0x080c, 0x86bc,
-	0x080c, 0x9e01, 0x00a0, 0x080c, 0xa872, 0x6130, 0x91e5, 0x0000,
-	0x0150, 0x080c, 0xe6ec, 0x080c, 0x86c5, 0x6003, 0x0001, 0x2009,
-	0x0014, 0x080c, 0xac68, 0x080c, 0xa88e, 0x00ce, 0x0000, 0x002e,
-	0x001e, 0x00de, 0x00ce, 0x0005, 0x2001, 0x1a0c, 0x2004, 0x9005,
-	0x1db0, 0x00c6, 0x2061, 0x19e7, 0x6134, 0x9192, 0x0003, 0x1ad8,
-	0x8108, 0x6136, 0x00ce, 0x080c, 0x86bc, 0x080c, 0x5edd, 0x2009,
-	0x1846, 0x2114, 0x8210, 0x220a, 0x0c10, 0x0096, 0x00c6, 0x00d6,
-	0x00e6, 0x0016, 0x0026, 0x080c, 0x86d2, 0x080c, 0xa872, 0x2001,
-	0x0387, 0x2003, 0x0202, 0x2071, 0x19e7, 0x714c, 0x81ff, 0x0904,
-	0x9f37, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c, 0x74d5, 0x1510,
-	0x0036, 0x2019, 0x0002, 0x080c, 0xa0f4, 0x003e, 0x714c, 0x2160,
-	0x080c, 0xe6ec, 0x2009, 0x004a, 0x6220, 0x9296, 0x0009, 0x1130,
-	0x6114, 0x2148, 0xa87b, 0x0006, 0x2009, 0x004a, 0x6003, 0x0003,
-	0x080c, 0xac68, 0x2001, 0x0386, 0x2003, 0x5040, 0x080c, 0x7576,
-	0x0804, 0x9f37, 0x6904, 0xd1f4, 0x0904, 0x9f44, 0x080c, 0x2a1a,
-	0x00c6, 0x704c, 0x9065, 0x090c, 0x0d7d, 0x6020, 0x00ce, 0x9086,
-	0x0006, 0x1518, 0x61c8, 0x60c4, 0x9105, 0x11f8, 0x2009, 0x180c,
-	0x2104, 0xd0d4, 0x01d0, 0x6214, 0x9294, 0x1800, 0x1128, 0x6224,
-	0x9294, 0x0002, 0x1560, 0x0010, 0xc0d4, 0x200a, 0x6014, 0x9084,
-	0xe7fd, 0x9085, 0x0010, 0x6016, 0x704c, 0x2060, 0x080c, 0x960a,
-	0x2009, 0x0049, 0x080c, 0xac68, 0x00d0, 0x0036, 0x2019, 0x0001,
-	0x080c, 0xa0f4, 0x003e, 0x714c, 0x2160, 0x080c, 0xe6ec, 0x2009,
-	0x004a, 0x6220, 0x9296, 0x0009, 0x1130, 0x6114, 0x2148, 0xa87b,
-	0x0006, 0x2009, 0x004a, 0x6003, 0x0003, 0x080c, 0xac68, 0x2001,
-	0x0387, 0x2003, 0x0200, 0x080c, 0xa88e, 0x002e, 0x001e, 0x00ee,
-	0x00de, 0x00ce, 0x009e, 0x0005, 0xd1ec, 0x1904, 0x9eee, 0x0804,
-	0x9ef0, 0x0026, 0x00e6, 0x2071, 0x19e7, 0x706c, 0xd084, 0x01e8,
-	0xc084, 0x706e, 0x714c, 0x81ff, 0x01c0, 0x2071, 0x0100, 0x9188,
-	0x0008, 0x2114, 0x928e, 0x0006, 0x1138, 0x2009, 0x1984, 0x2011,
-	0x0012, 0x080c, 0x2a53, 0x0048, 0x928e, 0x0009, 0x0db0, 0x2009,
-	0x1984, 0x2011, 0x0016, 0x080c, 0x2a53, 0x00ee, 0x002e, 0x0005,
-	0x9036, 0x2001, 0x19f1, 0x2004, 0x9005, 0x0128, 0x9c06, 0x0128,
-	0x2c30, 0x600c, 0x0cc8, 0x9085, 0x0001, 0x0005, 0x00f6, 0x2079,
-	0x19e7, 0x610c, 0x9006, 0x600e, 0x6044, 0xc0fc, 0x6046, 0x86ff,
-	0x1140, 0x7824, 0x9c06, 0x1118, 0x7826, 0x782a, 0x0050, 0x792a,
-	0x0040, 0x00c6, 0x2660, 0x610e, 0x00ce, 0x7824, 0x9c06, 0x1108,
-	0x7e26, 0x080c, 0xa1ea, 0x080c, 0xca03, 0x00fe, 0x0005, 0x080c,
-	0x9a6e, 0x7003, 0x1200, 0x7838, 0x7012, 0x783c, 0x7016, 0x00c6,
-	0x7820, 0x9086, 0x0004, 0x1148, 0x7810, 0x9005, 0x0130, 0x00b6,
-	0x2058, 0xb810, 0xb914, 0x00be, 0x0020, 0x2061, 0x1800, 0x607c,
-	0x6180, 0x9084, 0x00ff, 0x700a, 0x710e, 0x00ce, 0x60c3, 0x002c,
-	0x0804, 0x9dde, 0x080c, 0x9a6e, 0x7003, 0x0f00, 0x7808, 0xd09c,
-	0x0128, 0xb810, 0x9084, 0x00ff, 0x700a, 0xb814, 0x700e, 0x60c3,
-	0x0008, 0x0804, 0x9dde, 0x0156, 0x080c, 0x9ab9, 0x7003, 0x0200,
-	0x080c, 0x878a, 0x20a9, 0x0006, 0x2011, 0xfff4, 0x2019, 0xfff5,
-	0x9ef0, 0x0002, 0x2305, 0x2072, 0x8e70, 0x2205, 0x2072, 0x8e70,
-	0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0x9fe2, 0x60c3, 0x001c,
-	0x015e, 0x0804, 0x9dde, 0x0016, 0x0026, 0x080c, 0x9a95, 0x080c,
-	0x9aa7, 0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0, 0x7814, 0x0096,
-	0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021,
-	0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x9192, 0x0010,
-	0x1250, 0x4003, 0x9080, 0x0004, 0x8003, 0x60c2, 0x080c, 0x9dde,
-	0x002e, 0x001e, 0x0005, 0x20a9, 0x0010, 0x4003, 0x080c, 0xa657,
-	0x20a1, 0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c, 0x9a6e, 0x7003,
-	0x6200, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9dde, 0x0016,
-	0x0026, 0x080c, 0x9a6e, 0x20e9, 0x0000, 0x20a1, 0x024c, 0x7814,
-	0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080,
-	0x0023, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x4003,
-	0x8003, 0x60c2, 0x080c, 0x9dde, 0x002e, 0x001e, 0x0005, 0x00e6,
-	0x00c6, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x7010,
-	0x2060, 0x8cff, 0x0188, 0x080c, 0xca29, 0x1110, 0x080c, 0xb591,
-	0x600c, 0x0006, 0x080c, 0xcca0, 0x600f, 0x0000, 0x080c, 0xabc9,
-	0x080c, 0xa1ea, 0x00ce, 0x0c68, 0x2c00, 0x7012, 0x700e, 0x012e,
-	0x000e, 0x00ce, 0x00ee, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6,
-	0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000,
-	0x2001, 0x180c, 0x200c, 0x918c, 0xe7ff, 0x2102, 0x2069, 0x0100,
-	0x2079, 0x0140, 0x2071, 0x19e7, 0x7030, 0x2060, 0x8cff, 0x0548,
-	0x080c, 0x9e0e, 0x6ac0, 0x68c3, 0x0000, 0x080c, 0x86c5, 0x00c6,
-	0x2061, 0x0100, 0x080c, 0xa7a8, 0x00ce, 0x20a9, 0x01f4, 0x04b1,
-	0x080c, 0x95ad, 0x6044, 0xd0ac, 0x1128, 0x2001, 0x1988, 0x2004,
-	0x604a, 0x0020, 0x2009, 0x0013, 0x080c, 0xac68, 0x000e, 0x001e,
-	0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e,
-	0x0005, 0x2001, 0x1800, 0x2004, 0x9096, 0x0001, 0x0d78, 0x9096,
-	0x0004, 0x0d60, 0x080c, 0x86c5, 0x6814, 0x9084, 0x0001, 0x0110,
-	0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000, 0x2011, 0x5e87,
-	0x080c, 0x860d, 0x20a9, 0x01f4, 0x0009, 0x08c0, 0x6824, 0xd094,
-	0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000, 0x190c, 0x2a1a,
-	0x0090, 0xd084, 0x0118, 0x6827, 0x0001, 0x0010, 0x1f04, 0xa0d6,
-	0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2a0a,
-	0x9006, 0x080c, 0x2a0a, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6,
-	0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000,
-	0x2001, 0x180c, 0x200c, 0x918c, 0xdbff, 0x2102, 0x2069, 0x0100,
-	0x2079, 0x0140, 0x2071, 0x0380, 0x701c, 0x0006, 0x701f, 0x0202,
-	0x2071, 0x19e7, 0x704c, 0x2060, 0x8cff, 0x0904, 0xa199, 0x9386,
-	0x0002, 0x1128, 0x6814, 0x9084, 0x0002, 0x0904, 0xa199, 0x68af,
-	0x95f5, 0x6817, 0x0010, 0x2009, 0x00fa, 0x8109, 0x1df0, 0x69c6,
-	0x68cb, 0x0008, 0x080c, 0x86d2, 0x080c, 0x1dd8, 0x0046, 0x2009,
-	0x00a5, 0x080c, 0x0e55, 0x2021, 0x0169, 0x2404, 0x9084, 0x000f,
-	0x9086, 0x0004, 0x11f8, 0x68af, 0x95f5, 0x68c6, 0x68cb, 0x0008,
-	0x00e6, 0x00f6, 0x2079, 0x0090, 0x2071, 0x19e7, 0x6814, 0x9084,
-	0x1984, 0x9085, 0x0012, 0x6816, 0x782b, 0x0008, 0x7057, 0x0000,
-	0x00fe, 0x00ee, 0x9386, 0x0002, 0x1128, 0x7884, 0x9005, 0x1110,
-	0x7887, 0x0001, 0x0016, 0x2009, 0x0040, 0x080c, 0x21b0, 0x001e,
-	0x2009, 0x0000, 0x080c, 0x0e55, 0x004e, 0x20a9, 0x03e8, 0x6824,
-	0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000, 0x190c,
-	0x2a1a, 0x0090, 0xd08c, 0x0118, 0x6827, 0x0002, 0x0010, 0x1f04,
-	0xa167, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
-	0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x6827, 0x4000, 0x6824, 0x83ff,
-	0x1180, 0x2009, 0x0049, 0x6020, 0x9086, 0x0009, 0x0150, 0x080c,
-	0x960a, 0x6044, 0xd0ac, 0x1118, 0x6003, 0x0002, 0x0010, 0x080c,
-	0xac68, 0x000e, 0x2071, 0x0380, 0xd08c, 0x1110, 0x701f, 0x0200,
-	0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
-	0x015e, 0x012e, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069,
-	0x19e7, 0x6a06, 0x012e, 0x00de, 0x0005, 0x00d6, 0x0126, 0x2091,
-	0x8000, 0x2069, 0x19e7, 0x6a3e, 0x012e, 0x00de, 0x0005, 0x080c,
-	0x9bbc, 0x785c, 0x7032, 0x7042, 0x7047, 0x1000, 0x00f8, 0x080c,
-	0x9bbc, 0x785c, 0x7032, 0x7042, 0x7047, 0x4000, 0x00b8, 0x080c,
-	0x9bbc, 0x785c, 0x7032, 0x7042, 0x7047, 0x2000, 0x0078, 0x080c,
-	0x9bbc, 0x785c, 0x7032, 0x7042, 0x7047, 0x0400, 0x0038, 0x080c,
-	0x9bbc, 0x785c, 0x7032, 0x7042, 0x7047, 0x0200, 0x60c3, 0x0020,
-	0x0804, 0x9dde, 0x00e6, 0x2071, 0x19e7, 0x702c, 0x9005, 0x0110,
-	0x8001, 0x702e, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
-	0x0076, 0x0066, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7,
-	0x7620, 0x2660, 0x2678, 0x2039, 0x0001, 0x87ff, 0x0904, 0xa28f,
-	0x8cff, 0x0904, 0xa28f, 0x6020, 0x9086, 0x0006, 0x1904, 0xa28a,
-	0x88ff, 0x0138, 0x2800, 0x9c06, 0x1904, 0xa28a, 0x2039, 0x0000,
-	0x0050, 0x6010, 0x9b06, 0x1904, 0xa28a, 0x85ff, 0x0120, 0x605c,
-	0x9106, 0x1904, 0xa28a, 0x7030, 0x9c06, 0x15b0, 0x2069, 0x0100,
-	0x68c0, 0x9005, 0x1160, 0x6824, 0xd084, 0x0148, 0x6827, 0x0001,
-	0x080c, 0x86c5, 0x080c, 0xa314, 0x7033, 0x0000, 0x0428, 0x080c,
-	0x86c5, 0x6820, 0xd0b4, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008,
-	0x68c3, 0x0000, 0x080c, 0xa314, 0x7033, 0x0000, 0x0036, 0x2069,
-	0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
-	0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x2069, 0x0100, 0x6824, 0xd084,
-	0x0110, 0x6827, 0x0001, 0x003e, 0x7020, 0x9c36, 0x1110, 0x660c,
-	0x7622, 0x701c, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
-	0x701e, 0x0010, 0x701f, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
-	0x0110, 0x7e0e, 0x0008, 0x2678, 0x89ff, 0x1168, 0x600f, 0x0000,
-	0x6014, 0x0096, 0x2048, 0x080c, 0xc812, 0x0110, 0x080c, 0xe241,
-	0x009e, 0x080c, 0xac04, 0x080c, 0xa1ea, 0x88ff, 0x1190, 0x00ce,
-	0x0804, 0xa205, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa205, 0x9006,
-	0x012e, 0x000e, 0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
-	0x0005, 0x601b, 0x0000, 0x00ce, 0x98c5, 0x0001, 0x0c88, 0x00f6,
-	0x00e6, 0x00d6, 0x0096, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126,
-	0x2091, 0x8000, 0x2071, 0x19e7, 0x7648, 0x2660, 0x2678, 0x8cff,
-	0x0904, 0xa303, 0x6020, 0x9086, 0x0006, 0x1904, 0xa2fe, 0x87ff,
-	0x0128, 0x2700, 0x9c06, 0x1904, 0xa2fe, 0x0040, 0x6010, 0x9b06,
-	0x15e8, 0x85ff, 0x0118, 0x605c, 0x9106, 0x15c0, 0x704c, 0x9c06,
-	0x1168, 0x0036, 0x2019, 0x0001, 0x080c, 0xa0f4, 0x703f, 0x0000,
-	0x9006, 0x704e, 0x706a, 0x7052, 0x706e, 0x003e, 0x7048, 0x9c36,
-	0x1110, 0x660c, 0x764a, 0x7044, 0x9c36, 0x1140, 0x2c00, 0x9f36,
-	0x0118, 0x2f00, 0x7046, 0x0010, 0x7047, 0x0000, 0x660c, 0x0066,
-	0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
-	0x6014, 0x2048, 0x080c, 0xc812, 0x0110, 0x080c, 0xe241, 0x080c,
-	0xac04, 0x87ff, 0x1198, 0x00ce, 0x0804, 0xa2af, 0x2c78, 0x600c,
-	0x2060, 0x0804, 0xa2af, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e,
-	0x00ce, 0x009e, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000,
-	0x00ce, 0x97bd, 0x0001, 0x0c80, 0x00e6, 0x2071, 0x19e7, 0x7033,
-	0x0000, 0x7004, 0x9086, 0x0003, 0x0158, 0x2001, 0x1800, 0x2004,
-	0x9086, 0x0002, 0x1118, 0x7007, 0x0005, 0x0010, 0x7007, 0x0000,
-	0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0066, 0x0026, 0x0006,
-	0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x2c10, 0x7648, 0x2660,
-	0x2678, 0x8cff, 0x0518, 0x2200, 0x9c06, 0x11e0, 0x7048, 0x9c36,
-	0x1110, 0x660c, 0x764a, 0x7044, 0x9c36, 0x1140, 0x2c00, 0x9f36,
-	0x0118, 0x2f00, 0x7046, 0x0010, 0x7047, 0x0000, 0x660c, 0x2c00,
-	0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x9085,
-	0x0001, 0x0020, 0x2c78, 0x600c, 0x2060, 0x08d8, 0x012e, 0x000e,
-	0x002e, 0x006e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0096, 0x00f6,
-	0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091,
-	0x8000, 0x2071, 0x19e7, 0x7610, 0x2660, 0x2678, 0x8cff, 0x0904,
-	0xa3f6, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x1904,
-	0xa3f1, 0x7030, 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005,
-	0x0904, 0xa3cd, 0x080c, 0x9e0e, 0x68c3, 0x0000, 0x080c, 0xa314,
+	0x2061, 0x0100, 0x2071, 0x1800, 0x7160, 0x7810, 0x2058, 0x76dc,
+	0x96b4, 0x0028, 0x0110, 0x737c, 0x7480, 0x2500, 0x76dc, 0x96b4,
+	0x0028, 0x0140, 0x2001, 0x04ff, 0x6062, 0x6067, 0xffff, 0x636a,
+	0x646e, 0x0050, 0x2001, 0x00ff, 0x9085, 0x0400, 0x6062, 0x6067,
+	0xffff, 0x606b, 0x0000, 0x616e, 0xb8b8, 0x6073, 0x0530, 0x6077,
+	0x0008, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x9085,
+	0x0020, 0x607a, 0x607f, 0x0000, 0x2b00, 0x6082, 0x6087, 0xffff,
+	0x7814, 0x0096, 0x2048, 0xa848, 0x608a, 0xa844, 0x608e, 0xa838,
+	0x60c6, 0xa834, 0x60ca, 0x009e, 0xb86c, 0x60ce, 0x60ab, 0x0036,
+	0x60af, 0x95d5, 0x60d7, 0x0000, 0x2001, 0x1837, 0x2004, 0x9084,
+	0x0028, 0x0128, 0x609f, 0x0000, 0x2001, 0x0092, 0x0058, 0x6028,
+	0xc0bd, 0x602a, 0x609f, 0x00ff, 0x2011, 0xffff, 0x080c, 0x2a44,
+	0x2001, 0x00b2, 0x2010, 0x900e, 0x080c, 0x2a53, 0x2009, 0x07d0,
+	0x080c, 0x86fb, 0x003e, 0x004e, 0x005e, 0x006e, 0x00ce, 0x00de,
+	0x00ee, 0x00be, 0x0005, 0x00b6, 0x00e6, 0x00d6, 0x00c6, 0x0066,
+	0x0056, 0x0046, 0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7160,
+	0x7810, 0x2058, 0xb8a0, 0x2028, 0x76dc, 0xd6ac, 0x1168, 0x9582,
+	0x007e, 0x1250, 0x2500, 0x9094, 0xff80, 0x1130, 0x9080, 0x3374,
+	0x2015, 0x9294, 0x00ff, 0x0020, 0xb910, 0xba14, 0x737c, 0x7480,
+	0x70dc, 0xd0ac, 0x1130, 0x9582, 0x007e, 0x1218, 0x9584, 0xff80,
+	0x0138, 0x9185, 0x0400, 0x6062, 0x6266, 0x636a, 0x646e, 0x0030,
+	0x6063, 0x0400, 0x6266, 0x606b, 0x0000, 0x616e, 0xb8b8, 0x6072,
+	0x6077, 0x0000, 0xb864, 0xd0a4, 0x0110, 0x6077, 0x0008, 0xb88c,
+	0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x9085, 0x0020, 0x607a,
+	0x607f, 0x0000, 0x2b00, 0x6082, 0x6087, 0xffff, 0x7814, 0x0096,
+	0x2048, 0xa848, 0x608a, 0xa844, 0x608e, 0xa838, 0x60c6, 0xa834,
+	0x60ca, 0x009e, 0xb86c, 0x60ce, 0x60ab, 0x0036, 0x60af, 0x95d5,
+	0x60d7, 0x0000, 0xba84, 0x629e, 0x00f6, 0x2079, 0x0140, 0x7803,
+	0x0000, 0x00fe, 0x900e, 0x2011, 0x0092, 0x080c, 0x2a53, 0x2009,
+	0x07d0, 0x080c, 0x86fb, 0x003e, 0x004e, 0x005e, 0x006e, 0x00ce,
+	0x00de, 0x00ee, 0x00be, 0x0005, 0x00b6, 0x0096, 0x00e6, 0x00d6,
+	0x00c6, 0x0056, 0x0046, 0x0036, 0x2061, 0x0100, 0x2071, 0x1800,
+	0x7810, 0x2058, 0xb8a0, 0x2028, 0xb910, 0xba14, 0x737c, 0x7480,
+	0x7820, 0x0002, 0x9d81, 0x9d81, 0x9d81, 0x9d81, 0x9d81, 0x9d81,
+	0x9d81, 0x9d81, 0x9d81, 0x9d81, 0x9d83, 0x9d81, 0x9d81, 0x9d81,
+	0x9d81, 0x080c, 0x0d7d, 0xb884, 0x609e, 0x7814, 0x2048, 0xa87c,
+	0xd0fc, 0x0558, 0xaf90, 0x9784, 0xff00, 0x9105, 0x6062, 0x873f,
+	0x9784, 0xff00, 0x0006, 0x7814, 0x2048, 0xa878, 0xc0fc, 0x9005,
+	0x000e, 0x1160, 0xaf94, 0x87ff, 0x0198, 0x2039, 0x0098, 0x9705,
+	0x6072, 0x7808, 0x6082, 0x2f00, 0x6086, 0x0038, 0x9185, 0x2200,
+	0x6062, 0x6073, 0x0129, 0x6077, 0x0000, 0xb884, 0x609e, 0x0050,
+	0x2039, 0x0029, 0x9705, 0x6072, 0x0cc0, 0x9185, 0x0200, 0x6062,
+	0x6073, 0x2029, 0xa87c, 0xd0fc, 0x0118, 0xaf94, 0x87ff, 0x1120,
+	0x2f00, 0x6082, 0x7808, 0x6086, 0x6266, 0x636a, 0x646e, 0x6077,
+	0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a,
+	0x607f, 0x0000, 0xa848, 0x608a, 0xa844, 0x608e, 0xa838, 0x60c6,
+	0xa834, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
+	0x080c, 0xa670, 0x2009, 0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005,
+	0x0110, 0x2009, 0x1b58, 0x080c, 0x86fb, 0x003e, 0x004e, 0x005e,
+	0x00ce, 0x00de, 0x00ee, 0x009e, 0x00be, 0x0005, 0x7a40, 0x9294,
+	0x00ff, 0x8217, 0x0005, 0x00d6, 0x2069, 0x19e7, 0x686b, 0x0001,
+	0x00de, 0x0005, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x00f1, 0x080c,
+	0x86ed, 0x0005, 0x0016, 0x2001, 0x180c, 0x200c, 0x9184, 0x0600,
+	0x9086, 0x0600, 0x0128, 0x0089, 0x080c, 0x86ed, 0x001e, 0x0005,
+	0xc1e5, 0x2001, 0x180c, 0x2102, 0x2001, 0x19e8, 0x2003, 0x0000,
+	0x2001, 0x19f3, 0x2003, 0x0000, 0x0c88, 0x0006, 0x0016, 0x0026,
+	0x2009, 0x1804, 0x2011, 0x0009, 0x080c, 0x2a53, 0x002e, 0x001e,
+	0x000e, 0x0005, 0x0016, 0x00c6, 0x0006, 0x080c, 0xa8f4, 0x0106,
+	0x190c, 0xa896, 0x2061, 0x0100, 0x61a4, 0x60a7, 0x95f5, 0x0016,
+	0x0026, 0x2009, 0x1804, 0x2011, 0x0008, 0x080c, 0x2a53, 0x002e,
+	0x001e, 0x010e, 0x190c, 0xa8b2, 0x000e, 0xa001, 0xa001, 0xa001,
+	0x61a6, 0x00ce, 0x001e, 0x0005, 0x00c6, 0x00d6, 0x0016, 0x0026,
+	0x2061, 0x0100, 0x2069, 0x0140, 0x080c, 0x74e9, 0x1510, 0x2001,
+	0x1a0c, 0x2004, 0x9005, 0x1904, 0x9eb3, 0x080c, 0x758a, 0x11a8,
+	0x2069, 0x0380, 0x6843, 0x0101, 0x6844, 0xd084, 0x1de8, 0x2061,
+	0x0100, 0x6020, 0xd0b4, 0x1120, 0x6024, 0xd084, 0x090c, 0x0d7d,
+	0x6843, 0x0100, 0x080c, 0x86ed, 0x04b0, 0x00c6, 0x2061, 0x19e7,
+	0x00f0, 0x6904, 0x9194, 0x4000, 0x0598, 0x080c, 0x9e32, 0x080c,
+	0x2a1a, 0x00c6, 0x2061, 0x19e7, 0x6134, 0x9192, 0x0008, 0x1278,
+	0x8108, 0x6136, 0x080c, 0xa896, 0x6130, 0x080c, 0xa8b2, 0x00ce,
+	0x81ff, 0x01c8, 0x080c, 0x86ed, 0x080c, 0x9e25, 0x00a0, 0x080c,
+	0xa896, 0x6130, 0x91e5, 0x0000, 0x0150, 0x080c, 0xe717, 0x080c,
+	0x86f6, 0x6003, 0x0001, 0x2009, 0x0014, 0x080c, 0xac8c, 0x080c,
+	0xa8b2, 0x00ce, 0x0000, 0x002e, 0x001e, 0x00de, 0x00ce, 0x0005,
+	0x2001, 0x1a0c, 0x2004, 0x9005, 0x1db0, 0x00c6, 0x2061, 0x19e7,
+	0x6134, 0x9192, 0x0003, 0x1ad8, 0x8108, 0x6136, 0x00ce, 0x080c,
+	0x86ed, 0x080c, 0x5ee4, 0x2009, 0x1846, 0x2114, 0x8210, 0x220a,
+	0x0c10, 0x0096, 0x00c6, 0x00d6, 0x00e6, 0x0016, 0x0026, 0x080c,
+	0x8703, 0x080c, 0xa896, 0x2001, 0x0387, 0x2003, 0x0202, 0x2071,
+	0x19e7, 0x714c, 0x81ff, 0x0904, 0x9f5b, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x080c, 0x74e9, 0x1510, 0x0036, 0x2019, 0x0002, 0x080c,
+	0xa118, 0x003e, 0x714c, 0x2160, 0x080c, 0xe717, 0x2009, 0x004a,
+	0x6220, 0x9296, 0x0009, 0x1130, 0x6114, 0x2148, 0xa87b, 0x0006,
+	0x2009, 0x004a, 0x6003, 0x0003, 0x080c, 0xac8c, 0x2001, 0x0386,
+	0x2003, 0x5040, 0x080c, 0x758a, 0x0804, 0x9f5b, 0x6904, 0xd1f4,
+	0x0904, 0x9f68, 0x080c, 0x2a1a, 0x00c6, 0x704c, 0x9065, 0x090c,
+	0x0d7d, 0x6020, 0x00ce, 0x9086, 0x0006, 0x1518, 0x61c8, 0x60c4,
+	0x9105, 0x11f8, 0x2009, 0x180c, 0x2104, 0xd0d4, 0x01d0, 0x6214,
+	0x9294, 0x1800, 0x1128, 0x6224, 0x9294, 0x0002, 0x1560, 0x0010,
+	0xc0d4, 0x200a, 0x6014, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x6016,
+	0x704c, 0x2060, 0x080c, 0x963b, 0x2009, 0x0049, 0x080c, 0xac8c,
+	0x00d0, 0x0036, 0x2019, 0x0001, 0x080c, 0xa118, 0x003e, 0x714c,
+	0x2160, 0x080c, 0xe717, 0x2009, 0x004a, 0x6220, 0x9296, 0x0009,
+	0x1130, 0x6114, 0x2148, 0xa87b, 0x0006, 0x2009, 0x004a, 0x6003,
+	0x0003, 0x080c, 0xac8c, 0x2001, 0x0387, 0x2003, 0x0200, 0x080c,
+	0xa8b2, 0x002e, 0x001e, 0x00ee, 0x00de, 0x00ce, 0x009e, 0x0005,
+	0xd1ec, 0x1904, 0x9f12, 0x0804, 0x9f14, 0x0026, 0x00e6, 0x2071,
+	0x19e7, 0x706c, 0xd084, 0x01e8, 0xc084, 0x706e, 0x714c, 0x81ff,
+	0x01c0, 0x2071, 0x0100, 0x9188, 0x0008, 0x2114, 0x928e, 0x0006,
+	0x1138, 0x2009, 0x1984, 0x2011, 0x0012, 0x080c, 0x2a53, 0x0048,
+	0x928e, 0x0009, 0x0db0, 0x2009, 0x1984, 0x2011, 0x0016, 0x080c,
+	0x2a53, 0x00ee, 0x002e, 0x0005, 0x9036, 0x2001, 0x19f1, 0x2004,
+	0x9005, 0x0128, 0x9c06, 0x0128, 0x2c30, 0x600c, 0x0cc8, 0x9085,
+	0x0001, 0x0005, 0x00f6, 0x2079, 0x19e7, 0x610c, 0x9006, 0x600e,
+	0x6044, 0xc0fc, 0x6046, 0x86ff, 0x1140, 0x7824, 0x9c06, 0x1118,
+	0x7826, 0x782a, 0x0050, 0x792a, 0x0040, 0x00c6, 0x2660, 0x610e,
+	0x00ce, 0x7824, 0x9c06, 0x1108, 0x7e26, 0x080c, 0xa20e, 0x080c,
+	0xca27, 0x00fe, 0x0005, 0x080c, 0x9a9f, 0x7003, 0x1200, 0x7838,
+	0x7012, 0x783c, 0x7016, 0x00c6, 0x7820, 0x9086, 0x0004, 0x1148,
+	0x7810, 0x9005, 0x0130, 0x00b6, 0x2058, 0xb810, 0xb914, 0x00be,
+	0x0020, 0x2061, 0x1800, 0x607c, 0x6180, 0x9084, 0x00ff, 0x700a,
+	0x710e, 0x00ce, 0x60c3, 0x002c, 0x0804, 0x9e02, 0x080c, 0x9a9f,
+	0x7003, 0x0f00, 0x7808, 0xd09c, 0x0128, 0xb810, 0x9084, 0x00ff,
+	0x700a, 0xb814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9e02, 0x0156,
+	0x080c, 0x9aea, 0x7003, 0x0200, 0x080c, 0x87bb, 0x20a9, 0x0006,
+	0x2011, 0xfff4, 0x2019, 0xfff5, 0x9ef0, 0x0002, 0x2305, 0x2072,
+	0x8e70, 0x2205, 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002,
+	0x1f04, 0xa006, 0x60c3, 0x001c, 0x015e, 0x0804, 0x9e02, 0x0016,
+	0x0026, 0x080c, 0x9ac6, 0x080c, 0x9ad8, 0x9e80, 0x0004, 0x20e9,
+	0x0000, 0x20a0, 0x7814, 0x0096, 0x2048, 0xa800, 0x2048, 0xa860,
+	0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098, 0x009e, 0x7808, 0x9088,
+	0x0002, 0x21a8, 0x9192, 0x0010, 0x1250, 0x4003, 0x9080, 0x0004,
+	0x8003, 0x60c2, 0x080c, 0x9e02, 0x002e, 0x001e, 0x0005, 0x20a9,
+	0x0010, 0x4003, 0x080c, 0xa67b, 0x20a1, 0x0240, 0x22a8, 0x4003,
+	0x0c68, 0x080c, 0x9a9f, 0x7003, 0x6200, 0x7808, 0x700e, 0x60c3,
+	0x0008, 0x0804, 0x9e02, 0x0016, 0x0026, 0x080c, 0x9a9f, 0x20e9,
+	0x0000, 0x20a1, 0x024c, 0x7814, 0x0096, 0x2048, 0xa800, 0x2048,
+	0xa860, 0x20e0, 0xa85c, 0x9080, 0x0023, 0x2098, 0x009e, 0x7808,
+	0x9088, 0x0002, 0x21a8, 0x4003, 0x8003, 0x60c2, 0x080c, 0x9e02,
+	0x002e, 0x001e, 0x0005, 0x00e6, 0x00c6, 0x0006, 0x0126, 0x2091,
+	0x8000, 0x2071, 0x19e7, 0x7010, 0x2060, 0x8cff, 0x0188, 0x080c,
+	0xca4d, 0x1110, 0x080c, 0xb5b5, 0x600c, 0x0006, 0x080c, 0xccc4,
+	0x600f, 0x0000, 0x080c, 0xabed, 0x080c, 0xa20e, 0x00ce, 0x0c68,
+	0x2c00, 0x7012, 0x700e, 0x012e, 0x000e, 0x00ce, 0x00ee, 0x0005,
+	0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026,
+	0x0016, 0x0006, 0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c,
+	0xe7ff, 0x2102, 0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x19e7,
+	0x7030, 0x2060, 0x8cff, 0x0548, 0x080c, 0x9e32, 0x6ac0, 0x68c3,
+	0x0000, 0x080c, 0x86f6, 0x00c6, 0x2061, 0x0100, 0x080c, 0xa7cc,
+	0x00ce, 0x20a9, 0x01f4, 0x04b1, 0x080c, 0x95de, 0x6044, 0xd0ac,
+	0x1128, 0x2001, 0x1988, 0x2004, 0x604a, 0x0020, 0x2009, 0x0013,
+	0x080c, 0xac8c, 0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de,
+	0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005, 0x2001, 0x1800, 0x2004,
+	0x9096, 0x0001, 0x0d78, 0x9096, 0x0004, 0x0d60, 0x080c, 0x86f6,
+	0x6814, 0x9084, 0x0001, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008,
+	0x68c3, 0x0000, 0x2011, 0x5e8e, 0x080c, 0x863e, 0x20a9, 0x01f4,
+	0x0009, 0x08c0, 0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804,
+	0x9084, 0x4000, 0x190c, 0x2a1a, 0x0090, 0xd084, 0x0118, 0x6827,
+	0x0001, 0x0010, 0x1f04, 0xa0fa, 0x7804, 0x9084, 0x1000, 0x0138,
+	0x2001, 0x0100, 0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x0005,
+	0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026,
+	0x0016, 0x0006, 0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c,
+	0xdbff, 0x2102, 0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x0380,
+	0x701c, 0x0006, 0x701f, 0x0202, 0x2071, 0x19e7, 0x704c, 0x2060,
+	0x8cff, 0x0904, 0xa1bd, 0x9386, 0x0002, 0x1128, 0x6814, 0x9084,
+	0x0002, 0x0904, 0xa1bd, 0x68af, 0x95f5, 0x6817, 0x0010, 0x2009,
+	0x00fa, 0x8109, 0x1df0, 0x69c6, 0x68cb, 0x0008, 0x080c, 0x8703,
+	0x080c, 0x1dd8, 0x0046, 0x2009, 0x00a5, 0x080c, 0x0e55, 0x2021,
+	0x0169, 0x2404, 0x9084, 0x000f, 0x9086, 0x0004, 0x11f8, 0x68af,
+	0x95f5, 0x68c6, 0x68cb, 0x0008, 0x00e6, 0x00f6, 0x2079, 0x0090,
+	0x2071, 0x19e7, 0x6814, 0x9084, 0x1984, 0x9085, 0x0012, 0x6816,
+	0x782b, 0x0008, 0x7057, 0x0000, 0x00fe, 0x00ee, 0x9386, 0x0002,
+	0x1128, 0x7884, 0x9005, 0x1110, 0x7887, 0x0001, 0x0016, 0x2009,
+	0x0040, 0x080c, 0x21b0, 0x001e, 0x2009, 0x0000, 0x080c, 0x0e55,
+	0x004e, 0x20a9, 0x03e8, 0x6824, 0xd094, 0x0140, 0x6827, 0x0004,
+	0x7804, 0x9084, 0x4000, 0x190c, 0x2a1a, 0x0090, 0xd08c, 0x0118,
+	0x6827, 0x0002, 0x0010, 0x1f04, 0xa18b, 0x7804, 0x9084, 0x1000,
+	0x0138, 0x2001, 0x0100, 0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a,
+	0x6827, 0x4000, 0x6824, 0x83ff, 0x1180, 0x2009, 0x0049, 0x6020,
+	0x9086, 0x0009, 0x0150, 0x080c, 0x963b, 0x6044, 0xd0ac, 0x1118,
+	0x6003, 0x0002, 0x0010, 0x080c, 0xac8c, 0x000e, 0x2071, 0x0380,
+	0xd08c, 0x1110, 0x701f, 0x0200, 0x000e, 0x001e, 0x002e, 0x006e,
+	0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005, 0x00d6,
+	0x0126, 0x2091, 0x8000, 0x2069, 0x19e7, 0x6a06, 0x012e, 0x00de,
+	0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19e7, 0x6a3e,
+	0x012e, 0x00de, 0x0005, 0x080c, 0x9bed, 0x785c, 0x7032, 0x7042,
+	0x7047, 0x1000, 0x00f8, 0x080c, 0x9bed, 0x785c, 0x7032, 0x7042,
+	0x7047, 0x4000, 0x00b8, 0x080c, 0x9bed, 0x785c, 0x7032, 0x7042,
+	0x7047, 0x2000, 0x0078, 0x080c, 0x9bed, 0x785c, 0x7032, 0x7042,
+	0x7047, 0x0400, 0x0038, 0x080c, 0x9bed, 0x785c, 0x7032, 0x7042,
+	0x7047, 0x0200, 0x60c3, 0x0020, 0x0804, 0x9e02, 0x00e6, 0x2071,
+	0x19e7, 0x702c, 0x9005, 0x0110, 0x8001, 0x702e, 0x00ee, 0x0005,
+	0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066, 0x0006, 0x0126,
+	0x2091, 0x8000, 0x2071, 0x19e7, 0x7620, 0x2660, 0x2678, 0x2039,
+	0x0001, 0x87ff, 0x0904, 0xa2b3, 0x8cff, 0x0904, 0xa2b3, 0x6020,
+	0x9086, 0x0006, 0x1904, 0xa2ae, 0x88ff, 0x0138, 0x2800, 0x9c06,
+	0x1904, 0xa2ae, 0x2039, 0x0000, 0x0050, 0x6010, 0x9b06, 0x1904,
+	0xa2ae, 0x85ff, 0x0120, 0x605c, 0x9106, 0x1904, 0xa2ae, 0x7030,
+	0x9c06, 0x15b0, 0x2069, 0x0100, 0x68c0, 0x9005, 0x1160, 0x6824,
+	0xd084, 0x0148, 0x6827, 0x0001, 0x080c, 0x86f6, 0x080c, 0xa338,
+	0x7033, 0x0000, 0x0428, 0x080c, 0x86f6, 0x6820, 0xd0b4, 0x0110,
+	0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000, 0x080c, 0xa338,
 	0x7033, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
 	0x0138, 0x2001, 0x0100, 0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a,
 	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
-	0x7010, 0x9c36, 0x1110, 0x660c, 0x7612, 0x700c, 0x9c36, 0x1140,
-	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700e, 0x0010, 0x700f, 0x0000,
+	0x7020, 0x9c36, 0x1110, 0x660c, 0x7622, 0x701c, 0x9c36, 0x1140,
+	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x701e, 0x0010, 0x701f, 0x0000,
 	0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678,
-	0x600f, 0x0000, 0x080c, 0xca18, 0x1158, 0x080c, 0x3215, 0x080c,
-	0xca29, 0x11f0, 0x080c, 0xb591, 0x00d8, 0x080c, 0xa314, 0x08c0,
-	0x080c, 0xca29, 0x1118, 0x080c, 0xb591, 0x0090, 0x6014, 0x2048,
-	0x080c, 0xc812, 0x0168, 0x6020, 0x9086, 0x0003, 0x1508, 0xa867,
-	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6d64, 0x080c, 0xca03,
-	0x080c, 0xcca0, 0x080c, 0xac04, 0x080c, 0xa1ea, 0x00ce, 0x0804,
-	0xa376, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa376, 0x012e, 0x000e,
-	0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e, 0x0005,
-	0x6020, 0x9086, 0x0006, 0x1d20, 0x080c, 0xe241, 0x0c08, 0x00d6,
-	0x080c, 0x9ab9, 0x7003, 0x0200, 0x7007, 0x0014, 0x60c3, 0x0014,
-	0x20e1, 0x0001, 0x2099, 0x1989, 0x20e9, 0x0000, 0x20a1, 0x0250,
-	0x20a9, 0x0004, 0x4003, 0x7023, 0x0004, 0x7027, 0x7878, 0x080c,
-	0x9dde, 0x00de, 0x0005, 0x080c, 0x9ab9, 0x700b, 0x0800, 0x7814,
-	0x9084, 0xff00, 0x700e, 0x7814, 0x9084, 0x00ff, 0x7022, 0x782c,
-	0x7026, 0x7860, 0x9084, 0x00ff, 0x9085, 0x0200, 0x7002, 0x7860,
-	0x9084, 0xff00, 0x8007, 0x7006, 0x60c2, 0x0804, 0x9dde, 0x00b6,
-	0x00d6, 0x0016, 0x00d6, 0x2f68, 0x2009, 0x0035, 0x080c, 0xcea6,
-	0x00de, 0x1904, 0xa4a4, 0x080c, 0x9a6e, 0x7003, 0x1300, 0x782c,
-	0x080c, 0xa5af, 0x2068, 0x6820, 0x9086, 0x0003, 0x0560, 0x7810,
-	0x2058, 0xbaa0, 0x080c, 0xab33, 0x11d8, 0x9286, 0x007e, 0x1128,
-	0x700b, 0x00ff, 0x700f, 0xfffe, 0x0498, 0x9286, 0x007f, 0x1128,
-	0x700b, 0x00ff, 0x700f, 0xfffd, 0x0458, 0x9284, 0xff80, 0x0180,
-	0x9286, 0x0080, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffc, 0x0400,
-	0x92d8, 0x1000, 0x2b5c, 0xb810, 0x700a, 0xb814, 0x700e, 0x00c0,
-	0xb884, 0x700e, 0x00a8, 0x080c, 0xab33, 0x1130, 0x7810, 0x2058,
-	0xb8a0, 0x9082, 0x007e, 0x0250, 0x00d6, 0x2069, 0x181f, 0x2d04,
-	0x700a, 0x8d68, 0x2d04, 0x700e, 0x00de, 0x0010, 0x6034, 0x700e,
-	0x7838, 0x7012, 0x783c, 0x7016, 0x60c3, 0x000c, 0x001e, 0x00de,
-	0x080c, 0x9dde, 0x00be, 0x0005, 0x781b, 0x0001, 0x7803, 0x0006,
-	0x001e, 0x00de, 0x00be, 0x0005, 0x792c, 0x9180, 0x0008, 0x200c,
-	0x9186, 0x0006, 0x01c0, 0x9186, 0x0003, 0x0904, 0xa522, 0x9186,
-	0x0005, 0x0904, 0xa50a, 0x9186, 0x0004, 0x05f0, 0x9186, 0x0008,
-	0x0904, 0xa513, 0x7807, 0x0037, 0x782f, 0x0003, 0x7817, 0x1700,
-	0x080c, 0xa58c, 0x0005, 0x080c, 0xa54d, 0x00d6, 0x0026, 0x792c,
-	0x2168, 0x2009, 0x4000, 0x6800, 0x6a44, 0xd2fc, 0x11f8, 0x0002,
-	0xa4eb, 0xa4f6, 0xa4ed, 0xa4f6, 0xa4f2, 0xa4eb, 0xa4eb, 0xa4f6,
-	0xa4f6, 0xa4f6, 0xa4f6, 0xa4eb, 0xa4eb, 0xa4eb, 0xa4eb, 0xa4eb,
-	0xa4f6, 0xa4eb, 0xa4f6, 0x080c, 0x0d7d, 0x6824, 0xd0e4, 0x0110,
-	0xd0cc, 0x0110, 0x900e, 0x0010, 0x2009, 0x2000, 0x682c, 0x7022,
-	0x6830, 0x7026, 0x0804, 0xa546, 0x080c, 0xa54d, 0x00d6, 0x0026,
-	0x792c, 0x2168, 0x2009, 0x4000, 0x6a00, 0x9286, 0x0002, 0x1108,
-	0x900e, 0x04e0, 0x080c, 0xa54d, 0x00d6, 0x0026, 0x792c, 0x2168,
-	0x2009, 0x4000, 0x0498, 0x04c9, 0x00d6, 0x0026, 0x792c, 0x2168,
-	0x2009, 0x4000, 0x9286, 0x0005, 0x0118, 0x9286, 0x0002, 0x1108,
-	0x900e, 0x0420, 0x0451, 0x00d6, 0x0026, 0x792c, 0x2168, 0x6814,
-	0x0096, 0x2048, 0xa9ac, 0xa834, 0x9112, 0xa9b0, 0xa838, 0x009e,
-	0x9103, 0x7022, 0x7226, 0x792c, 0x9180, 0x0011, 0x2004, 0xd0fc,
-	0x1148, 0x9180, 0x0000, 0x2004, 0x908e, 0x0002, 0x0130, 0x908e,
-	0x0004, 0x0118, 0x2009, 0x4000, 0x0008, 0x900e, 0x712a, 0x60c3,
-	0x0018, 0x002e, 0x00de, 0x0804, 0x9dde, 0x00b6, 0x0036, 0x0046,
-	0x0056, 0x0066, 0x080c, 0x9ab9, 0x9006, 0x7003, 0x0200, 0x7938,
-	0x710a, 0x793c, 0x710e, 0x7810, 0x2058, 0xb8a0, 0x080c, 0xab33,
-	0x1118, 0x9092, 0x007e, 0x0268, 0x00d6, 0x2069, 0x181f, 0x2d2c,
-	0x8d68, 0x2d34, 0x90d8, 0x1000, 0x2b5c, 0xbb10, 0xbc14, 0x00de,
-	0x0028, 0x901e, 0xbc84, 0x2029, 0x0000, 0x6634, 0x782c, 0x9080,
-	0x0008, 0x2004, 0x9086, 0x0003, 0x1128, 0x7512, 0x7616, 0x731a,
-	0x741e, 0x0020, 0x7312, 0x7416, 0x751a, 0x761e, 0x006e, 0x005e,
-	0x004e, 0x003e, 0x00be, 0x0005, 0x080c, 0x9ab9, 0x7003, 0x0100,
-	0x782c, 0x700a, 0x7814, 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804,
-	0x9dde, 0x080c, 0x9a65, 0x7003, 0x1400, 0x7838, 0x700a, 0x0079,
-	0x783c, 0x700e, 0x782c, 0x7012, 0x7830, 0x7016, 0x7834, 0x9084,
-	0x00ff, 0x8007, 0x701a, 0x60c3, 0x0010, 0x0804, 0x9dde, 0x00e6,
-	0x2071, 0x0240, 0x0006, 0x00f6, 0x2078, 0x7810, 0x00b6, 0x2058,
-	0xb8d4, 0xd084, 0x0120, 0x7850, 0x702a, 0x784c, 0x702e, 0x00be,
-	0x00fe, 0x000e, 0x00ee, 0x0005, 0x080c, 0x9ab0, 0x7003, 0x0100,
-	0x782c, 0x700a, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9dde,
-	0x00a9, 0x7914, 0x712a, 0x60c3, 0x0000, 0x60a7, 0x9575, 0x0026,
-	0x080c, 0x2979, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012,
-	0x002e, 0x080c, 0x9e01, 0x080c, 0x86bc, 0x0005, 0x0036, 0x0096,
-	0x00d6, 0x00e6, 0x7860, 0x2048, 0xaa7c, 0x9296, 0x00c0, 0x9294,
-	0xfffd, 0xaa7e, 0xaa80, 0x9294, 0x0300, 0xaa82, 0xa96c, 0x9194,
-	0x00ff, 0xab74, 0x9384, 0x00ff, 0x908d, 0xc200, 0xa96e, 0x9384,
-	0xff00, 0x9215, 0xaa76, 0xa870, 0xaa78, 0xa87a, 0xaa72, 0x00d6,
-	0x2069, 0x0200, 0x080c, 0xa66c, 0x00de, 0x20e9, 0x0000, 0x20a1,
-	0x0240, 0x20a9, 0x000a, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b,
-	0x2098, 0x4003, 0x60a3, 0x0035, 0xaa68, 0x9294, 0x7000, 0x9286,
-	0x3000, 0x0110, 0x60a3, 0x0037, 0x00ee, 0x00de, 0x009e, 0x003e,
-	0x0005, 0x900e, 0x7814, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x01c0,
-	0x9084, 0x0003, 0x11a8, 0x2001, 0x180c, 0x2004, 0xd0bc, 0x0180,
-	0x7824, 0xd0cc, 0x1168, 0xd0c4, 0x1158, 0xa8a8, 0x9005, 0x1140,
-	0x2001, 0x180c, 0x200c, 0xc1d5, 0x2102, 0x2009, 0x19b2, 0x210c,
-	0x009e, 0x918d, 0x0092, 0x0010, 0x2009, 0x0096, 0x60ab, 0x0036,
-	0x0026, 0x2110, 0x900e, 0x080c, 0x2a53, 0x002e, 0x0005, 0x2009,
-	0x0009, 0x00a0, 0x2009, 0x000a, 0x0088, 0x2009, 0x000b, 0x0070,
-	0x2009, 0x000c, 0x0058, 0x2009, 0x000d, 0x0040, 0x2009, 0x000e,
-	0x0028, 0x2009, 0x000f, 0x0010, 0x2009, 0x0008, 0x6912, 0x0005,
-	0x080c, 0x9a6e, 0x0016, 0x0026, 0x0096, 0x00d6, 0x7814, 0x2048,
-	0x7013, 0x0138, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1138,
-	0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x1904, 0xa711, 0x7003,
-	0x5400, 0x00c6, 0x2061, 0x1800, 0x607c, 0x9084, 0x00ff, 0xa998,
-	0x810f, 0x918c, 0xff00, 0x9105, 0x700a, 0x6080, 0x700e, 0xa998,
-	0x918c, 0xff00, 0x7112, 0x20a9, 0x0004, 0x2009, 0x1805, 0x2e10,
-	0x9290, 0x0006, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xa6a2,
-	0x20a9, 0x0004, 0x2009, 0x1801, 0x2104, 0x2012, 0x8108, 0x8210,
-	0x1f04, 0xa6ac, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0029, 0x2098,
-	0x2009, 0x0006, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210,
-	0x8109, 0x1dc0, 0x00d6, 0x2069, 0x0200, 0x080c, 0xa657, 0x00de,
-	0x2071, 0x0240, 0x2011, 0x0240, 0x2009, 0x0002, 0x20a9, 0x0001,
-	0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0x2009, 0x0008,
-	0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0,
-	0xa85c, 0x9080, 0x0031, 0x2098, 0x2009, 0x0008, 0x20a9, 0x0001,
-	0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0x00ce, 0x60c3,
-	0x004c, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x2001, 0x1837, 0x2004,
-	0x9084, 0x0028, 0x1168, 0x080c, 0x74d5, 0x0150, 0x6028, 0xc0bd,
-	0x602a, 0x2009, 0x1804, 0x2011, 0x0029, 0x080c, 0x2a53, 0x0010,
-	0x080c, 0x9dde, 0x080c, 0x86bc, 0x00de, 0x009e, 0x002e, 0x001e,
-	0x0005, 0x00e6, 0x2071, 0x0240, 0x2001, 0x2200, 0x9085, 0x00ff,
-	0x7002, 0x7007, 0xffff, 0x2071, 0x0100, 0x709b, 0x00ff, 0x00ee,
-	0x0804, 0xa687, 0x080c, 0x9a6e, 0x0016, 0x0026, 0x0096, 0x00d6,
-	0x7814, 0x2048, 0x7013, 0x0138, 0x7003, 0x5500, 0x00c6, 0xa89c,
-	0x9084, 0x00ff, 0xa998, 0x810f, 0x918c, 0xff00, 0x9105, 0x700a,
-	0xa99c, 0x918c, 0xff00, 0xa8a0, 0x9084, 0x00ff, 0x9105, 0x700e,
-	0xa998, 0x918c, 0xff00, 0x2061, 0x1800, 0x607c, 0x9084, 0x00ff,
-	0x910d, 0x7112, 0x6180, 0x7116, 0x2009, 0x0008, 0xa860, 0x20e0,
-	0xa85c, 0x9080, 0x0029, 0x2098, 0x2e10, 0x9290, 0x0006, 0x20a9,
-	0x0001, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0x20a9,
-	0x0004, 0x2009, 0x1805, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04,
-	0xa763, 0x20a9, 0x0002, 0x2009, 0x1801, 0x2104, 0x2012, 0x8108,
-	0x8210, 0x1f04, 0xa76d, 0x00d6, 0x0016, 0x2069, 0x0200, 0x080c,
-	0xa657, 0x001e, 0x00de, 0x2071, 0x0240, 0x20a9, 0x0002, 0x2009,
-	0x1803, 0x2011, 0x0240, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04,
-	0xa783, 0x2009, 0x0008, 0x4002, 0x8007, 0x2012, 0x8210, 0x8109,
-	0x1dd0, 0x9006, 0x20a9, 0x0008, 0x2012, 0x8210, 0x1f04, 0xa794,
-	0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c,
-	0x9dde, 0x080c, 0x86bc, 0x00de, 0x009e, 0x002e, 0x001e, 0x0005,
-	0x00d6, 0x9290, 0x0018, 0x8214, 0x20e9, 0x0000, 0x2069, 0x0200,
-	0x6813, 0x0000, 0x22a8, 0x9284, 0x00e0, 0x0128, 0x20a9, 0x0020,
-	0x9292, 0x0020, 0x0008, 0x9016, 0x20a1, 0x0240, 0x9006, 0x4004,
-	0x82ff, 0x0120, 0x6810, 0x8000, 0x6812, 0x0c60, 0x00de, 0x0005,
-	0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00a6, 0x0096, 0x0066, 0x0126,
-	0x2091, 0x8000, 0x2071, 0x19e7, 0x7610, 0x2660, 0x2678, 0x8cff,
-	0x0904, 0xa84f, 0x7030, 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0,
-	0x9005, 0x0904, 0xa826, 0x080c, 0x9e0e, 0x68c3, 0x0000, 0x080c,
-	0xa314, 0x7033, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384,
-	0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2a0a, 0x9006, 0x080c,
-	0x2a0a, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001,
-	0x003e, 0x7010, 0x9c36, 0x1110, 0x660c, 0x7612, 0x700c, 0x9c36,
-	0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700e, 0x0010, 0x700f,
-	0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008,
-	0x2678, 0x600f, 0x0000, 0x080c, 0xca18, 0x1158, 0x080c, 0x3215,
-	0x080c, 0xca29, 0x11f0, 0x080c, 0xb591, 0x00d8, 0x080c, 0xa314,
-	0x08c0, 0x080c, 0xca29, 0x1118, 0x080c, 0xb591, 0x0090, 0x6014,
-	0x2048, 0x080c, 0xc812, 0x0168, 0x6020, 0x9086, 0x0003, 0x1520,
-	0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6d70, 0x080c,
-	0xca03, 0x080c, 0xcca0, 0x080c, 0xac04, 0x080c, 0xa1ea, 0x00ce,
-	0x0804, 0xa7d7, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa7d7, 0x7013,
-	0x0000, 0x700f, 0x0000, 0x012e, 0x006e, 0x009e, 0x00ae, 0x00ce,
-	0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d08,
-	0x080c, 0xe241, 0x08f0, 0x00f6, 0x0036, 0x2079, 0x0380, 0x7b18,
-	0xd3bc, 0x1de8, 0x7832, 0x7936, 0x7a3a, 0x781b, 0x8080, 0x003e,
-	0x00fe, 0x0005, 0x0016, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007,
-	0x9086, 0x0001, 0x1188, 0x2001, 0x0015, 0x0c29, 0x2009, 0x1000,
-	0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0003, 0x0120,
-	0x8109, 0x1db0, 0x080c, 0x0d7d, 0x001e, 0x0005, 0x2001, 0x0382,
-	0x2004, 0x9084, 0x0007, 0x9086, 0x0003, 0x1120, 0x2001, 0x0380,
-	0x2003, 0x0001, 0x0005, 0x0156, 0x0016, 0x0026, 0x00e6, 0x900e,
-	0x2071, 0x19e7, 0x0469, 0x0106, 0x0190, 0x7004, 0x9086, 0x0003,
-	0x0148, 0x20a9, 0x1000, 0x6044, 0xd0fc, 0x01d8, 0x1f04, 0xa8ab,
-	0x080c, 0x0d7d, 0x080c, 0xa872, 0x6044, 0xd0fc, 0x0190, 0x7030,
-	0x9c06, 0x1148, 0x080c, 0x95ad, 0x6044, 0xd0dc, 0x0150, 0xc0dc,
-	0x6046, 0x700a, 0x7042, 0x704c, 0x9c06, 0x190c, 0x0d7d, 0x080c,
-	0x960a, 0x010e, 0x1919, 0x00ee, 0x002e, 0x001e, 0x015e, 0x0005,
-	0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0003, 0x0005,
-	0x0126, 0x2091, 0x2400, 0x7808, 0xd0a4, 0x190c, 0x0d76, 0xd09c,
-	0x0128, 0x7820, 0x908c, 0xf000, 0x11b8, 0x0012, 0x012e, 0x0005,
-	0xa8f8, 0xa936, 0xa95d, 0xa994, 0xa9a4, 0xa9b5, 0xa9c4, 0xa9d2,
-	0xa9ff, 0xaa03, 0xa8f8, 0xa8f8, 0xa8f8, 0xa8f8, 0xa8f8, 0xa8f8,
-	0x080c, 0x0d7d, 0x012e, 0x0005, 0x2060, 0x6044, 0xd0bc, 0x0140,
-	0xc0bc, 0x6046, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d7d, 0x0012,
-	0x012e, 0x0005, 0xa91d, 0xa91f, 0xa91d, 0xa925, 0xa91d, 0xa91d,
-	0xa91d, 0xa91d, 0xa91d, 0xa91f, 0xa91d, 0xa91f, 0xa91d, 0xa91f,
-	0xa91d, 0xa91d, 0xa91d, 0xa91f, 0xa91d, 0x080c, 0x0d7d, 0x2009,
-	0x0013, 0x080c, 0xac68, 0x012e, 0x0005, 0x6014, 0x2048, 0xa87c,
-	0xd0dc, 0x0130, 0x080c, 0x8890, 0x080c, 0xabc9, 0x012e, 0x0005,
-	0x2009, 0x0049, 0x080c, 0xac68, 0x012e, 0x0005, 0x080c, 0xa872,
-	0x2001, 0x1a0c, 0x2003, 0x0000, 0x7030, 0x9065, 0x090c, 0x0d7d,
-	0x7034, 0x9092, 0x00c8, 0x1258, 0x8000, 0x7036, 0x7004, 0x9086,
-	0x0003, 0x0110, 0x7007, 0x0000, 0x781f, 0x0808, 0x0040, 0x080c,
-	0xe6ec, 0x6003, 0x0001, 0x2009, 0x0014, 0x080c, 0xac68, 0x781f,
-	0x0100, 0x080c, 0xa88e, 0x012e, 0x0005, 0x080c, 0xa872, 0x714c,
-	0x81ff, 0x1128, 0x2011, 0x1a0f, 0x2013, 0x0000, 0x0438, 0x2061,
-	0x0100, 0x7150, 0x9192, 0x7530, 0x12f0, 0x8108, 0x7152, 0x714c,
-	0x9188, 0x0008, 0x210c, 0x918e, 0x0006, 0x1138, 0x6014, 0x9084,
-	0x1984, 0x9085, 0x0012, 0x6016, 0x0088, 0x714c, 0x9188, 0x0008,
-	0x210c, 0x918e, 0x0009, 0x0d90, 0x6014, 0x9084, 0x1984, 0x9085,
-	0x0016, 0x6016, 0x0018, 0x706c, 0xc085, 0x706e, 0x781f, 0x0200,
-	0x080c, 0xa88e, 0x012e, 0x0005, 0x080c, 0xa872, 0x714c, 0x2160,
-	0x6003, 0x0003, 0x2009, 0x004a, 0x080c, 0xac68, 0x781f, 0x0200,
-	0x080c, 0xa88e, 0x012e, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820,
-	0x2060, 0x6003, 0x0003, 0x080c, 0xa872, 0x080c, 0x1d60, 0x781f,
-	0x0400, 0x080c, 0xa88e, 0x012e, 0x0005, 0x7808, 0xd09c, 0x0de8,
-	0x7820, 0x2060, 0x080c, 0xa872, 0x080c, 0x1da8, 0x781f, 0x0400,
-	0x080c, 0xa88e, 0x012e, 0x0005, 0x7030, 0x9065, 0x0148, 0x6044,
-	0xc0bc, 0x6046, 0x7104, 0x9186, 0x0003, 0x0110, 0x080c, 0x9670,
-	0x012e, 0x0005, 0x00f6, 0x703c, 0x9086, 0x0002, 0x0528, 0x704c,
-	0x907d, 0x0510, 0x7844, 0xc0bc, 0x7846, 0x7820, 0x9086, 0x0009,
-	0x0118, 0x080c, 0x9d29, 0x00c0, 0x7828, 0xd0fc, 0x1118, 0x080c,
-	0x9ca8, 0x0090, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1130,
-	0x2001, 0x197c, 0x2004, 0x9086, 0xaaaa, 0x1120, 0x2001, 0x0387,
-	0x2003, 0x1000, 0x080c, 0x9c2d, 0x00fe, 0x012e, 0x0005, 0x080c,
-	0x7576, 0x012e, 0x0005, 0x080c, 0x0d7d, 0x0005, 0x00e6, 0x2071,
-	0x19e7, 0x6044, 0xc0bc, 0x6046, 0xd0fc, 0x01b8, 0x704c, 0x9c06,
-	0x1190, 0x2019, 0x0001, 0x080c, 0xa0f4, 0x704f, 0x0000, 0x2001,
-	0x0109, 0x2004, 0xd08c, 0x1138, 0x2001, 0x0108, 0x2004, 0xd0bc,
-	0x1110, 0x703f, 0x0000, 0x080c, 0xa32a, 0x00ee, 0x0005, 0x0026,
-	0x7010, 0x9c06, 0x1178, 0x080c, 0xa1ea, 0x6044, 0xc0fc, 0x6046,
-	0x600c, 0x9015, 0x0120, 0x7212, 0x600f, 0x0000, 0x0010, 0x7212,
-	0x720e, 0x9006, 0x002e, 0x0005, 0x0026, 0x7020, 0x9c06, 0x1178,
-	0x080c, 0xa1ea, 0x6044, 0xc0fc, 0x6046, 0x600c, 0x9015, 0x0120,
-	0x7222, 0x600f, 0x0000, 0x0010, 0x7222, 0x721e, 0x9006, 0x002e,
-	0x0005, 0x00d6, 0x0036, 0x7830, 0x9c06, 0x1558, 0x2069, 0x0100,
-	0x68c0, 0x9005, 0x01f8, 0x080c, 0x86c5, 0x080c, 0x9e0e, 0x68c3,
-	0x0000, 0x080c, 0xa314, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
-	0x0138, 0x2001, 0x0100, 0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a,
-	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x9085,
-	0x0001, 0x0038, 0x7808, 0xc0ad, 0x780a, 0x6003, 0x0009, 0x630a,
-	0x9006, 0x003e, 0x00de, 0x0005, 0x0016, 0x0026, 0x0036, 0x6100,
-	0x2019, 0x0100, 0x2001, 0x0382, 0x2004, 0xd09c, 0x0190, 0x00c6,
-	0x0126, 0x2091, 0x2800, 0x0016, 0x0036, 0x080c, 0xa8d8, 0x003e,
-	0x001e, 0x012e, 0x00ce, 0x6200, 0x2200, 0x9106, 0x0d58, 0x2200,
-	0x0010, 0x8319, 0x1d38, 0x003e, 0x002e, 0x001e, 0x0005, 0x00d6,
-	0x0156, 0x080c, 0x9ab9, 0x7a14, 0x82ff, 0x0138, 0x7003, 0x0100,
-	0x700b, 0x0003, 0x60c3, 0x0008, 0x0490, 0x7003, 0x0200, 0x7007,
-	0x0000, 0x2069, 0x1800, 0x901e, 0x6800, 0x9086, 0x0004, 0x1110,
-	0xc38d, 0x0060, 0x080c, 0x74d5, 0x1110, 0xc3ad, 0x0008, 0xc3a5,
-	0x6adc, 0xd29c, 0x1110, 0xd2ac, 0x0108, 0xc39d, 0x730e, 0x080c,
-	0x878a, 0x20a9, 0x0006, 0x2011, 0xfff4, 0x2019, 0xfff5, 0x2071,
-	0x0250, 0x2305, 0x2072, 0x8e70, 0x2205, 0x2072, 0x8e70, 0x9398,
-	0x0002, 0x9290, 0x0002, 0x1f04, 0xaad9, 0x60c3, 0x0020, 0x080c,
-	0x9dde, 0x015e, 0x00de, 0x0005, 0x0156, 0x080c, 0x9ab9, 0x7a14,
-	0x82ff, 0x0168, 0x9286, 0xffff, 0x0118, 0x9282, 0x000e, 0x1238,
-	0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008, 0x0488, 0x7003,
-	0x0200, 0x7007, 0x001c, 0x700f, 0x0001, 0x2011, 0x19bd, 0x2204,
-	0x8007, 0x701a, 0x8210, 0x2204, 0x8007, 0x701e, 0x0421, 0x1120,
-	0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001, 0x181f, 0x2004, 0x7022,
-	0x2001, 0x1820, 0x2004, 0x7026, 0x0030, 0x2001, 0x1818, 0x2004,
-	0x9084, 0x00ff, 0x7026, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099,
-	0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003, 0x60c3, 0x001c,
-	0x015e, 0x0804, 0x9dde, 0x0006, 0x2001, 0x1837, 0x2004, 0xd0ac,
-	0x000e, 0x0005, 0x2011, 0x0003, 0x080c, 0xa1ab, 0x2011, 0x0002,
-	0x080c, 0xa1b5, 0x080c, 0xa074, 0x0036, 0x901e, 0x080c, 0xa0f4,
-	0x003e, 0x0005, 0x080c, 0x3366, 0x0188, 0x0016, 0x00b6, 0x00c6,
-	0x7010, 0x9085, 0x0020, 0x7012, 0x2009, 0x007e, 0x080c, 0x661e,
-	0xb85c, 0xc0ac, 0xb85e, 0x00ce, 0x00be, 0x001e, 0x0005, 0x2071,
-	0x188d, 0x7000, 0x9005, 0x0140, 0x2001, 0x0812, 0x2071, 0x1800,
-	0x7076, 0x707a, 0x706b, 0xffd4, 0x2071, 0x1800, 0x7074, 0x7056,
-	0x705b, 0x1ddc, 0x0005, 0x00e6, 0x0126, 0x2071, 0x1800, 0x2091,
-	0x8000, 0x7554, 0x9582, 0x0010, 0x0608, 0x7058, 0x2060, 0x6000,
-	0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1208,
-	0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556,
-	0x9ca8, 0x001c, 0x7068, 0x9502, 0x1230, 0x755a, 0x9085, 0x0001,
-	0x012e, 0x00ee, 0x0005, 0x705b, 0x1ddc, 0x0cc0, 0x9006, 0x0cc0,
-	0x00e6, 0x2071, 0x1800, 0x7554, 0x9582, 0x0010, 0x0600, 0x7058,
-	0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c, 0x7068,
-	0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003, 0x0008,
-	0x8529, 0x7556, 0x9ca8, 0x001c, 0x7068, 0x9502, 0x1228, 0x755a,
-	0x9085, 0x0001, 0x00ee, 0x0005, 0x705b, 0x1ddc, 0x0cc8, 0x9006,
-	0x0cc8, 0x9c82, 0x1ddc, 0x0a0c, 0x0d7d, 0x2001, 0x181a, 0x2004,
-	0x9c02, 0x1a0c, 0x0d7d, 0x9006, 0x6006, 0x600a, 0x600e, 0x6016,
-	0x601a, 0x6012, 0x6023, 0x0000, 0x6003, 0x0000, 0x601e, 0x605e,
-	0x6062, 0x6026, 0x602a, 0x602e, 0x6032, 0x6036, 0x603a, 0x603e,
-	0x604a, 0x602a, 0x6046, 0x6042, 0x2061, 0x1800, 0x6054, 0x8000,
-	0x6056, 0x0005, 0x9006, 0x600e, 0x6016, 0x601a, 0x6012, 0x6022,
-	0x6002, 0x601e, 0x605e, 0x6062, 0x604a, 0x6046, 0x2061, 0x1800,
-	0x6054, 0x8000, 0x6056, 0x0005, 0x0006, 0x6000, 0x9086, 0x0000,
-	0x01d0, 0x601c, 0xd084, 0x190c, 0x1a6a, 0x6023, 0x0007, 0x2001,
-	0x1986, 0x2004, 0x0006, 0x9082, 0x0051, 0x000e, 0x0208, 0x8004,
-	0x601a, 0x080c, 0xe4f9, 0x604b, 0x0000, 0x6044, 0xd0fc, 0x1129,
-	0x9006, 0x6046, 0x6016, 0x000e, 0x0005, 0x080c, 0xa8d0, 0x0106,
-	0x190c, 0xa872, 0x2001, 0x19fa, 0x2004, 0x9c06, 0x1130, 0x0036,
-	0x2019, 0x0001, 0x080c, 0xa0f4, 0x003e, 0x080c, 0xa32a, 0x010e,
-	0x190c, 0xa88e, 0x0005, 0x00e6, 0x0126, 0x2071, 0x1800, 0x2091,
-	0x8000, 0x7554, 0x9582, 0x0001, 0x0608, 0x7058, 0x2060, 0x6000,
-	0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1208,
-	0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556,
-	0x9ca8, 0x001c, 0x7068, 0x9502, 0x1230, 0x755a, 0x9085, 0x0001,
-	0x012e, 0x00ee, 0x0005, 0x705b, 0x1ddc, 0x0cc0, 0x9006, 0x0cc0,
-	0x6020, 0x9084, 0x000f, 0x0002, 0xac7c, 0xac86, 0xaca1, 0xacbc,
-	0xcf78, 0xcf95, 0xcfb0, 0xac7c, 0xac86, 0x8f69, 0xacd8, 0xac7c,
-	0xac7c, 0xac7c, 0xac7c, 0xac7c, 0x9186, 0x0013, 0x1130, 0x6044,
-	0xd0fc, 0x0110, 0x080c, 0x95ad, 0x0005, 0x0005, 0x0066, 0x6000,
-	0x90b2, 0x0016, 0x1a0c, 0x0d7d, 0x0013, 0x006e, 0x0005, 0xac9f,
-	0xb3fd, 0xb5d8, 0xac9f, 0xb66e, 0xafa1, 0xac9f, 0xac9f, 0xb37f,
-	0xbbd6, 0xac9f, 0xac9f, 0xac9f, 0xac9f, 0xac9f, 0xac9f, 0x080c,
-	0x0d7d, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d7d, 0x0013,
-	0x006e, 0x0005, 0xacba, 0xc1e1, 0xacba, 0xacba, 0xacba, 0xacba,
-	0xacba, 0xacba, 0xc186, 0xc364, 0xacba, 0xc21e, 0xc2a2, 0xc21e,
-	0xc2a2, 0xacba, 0x080c, 0x0d7d, 0x6000, 0x9082, 0x0016, 0x1a0c,
-	0x0d7d, 0x6000, 0x0002, 0xacd6, 0xbc20, 0xbcb7, 0xbe37, 0xbea6,
-	0xacd6, 0xacd6, 0xacd6, 0xbbef, 0xc107, 0xc10a, 0xacd6, 0xacd6,
-	0xacd6, 0xacd6, 0xc13a, 0xacd6, 0xacd6, 0xacd6, 0x080c, 0x0d7d,
-	0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d7d, 0x0013, 0x006e,
-	0x0005, 0xacf1, 0xacf1, 0xad2f, 0xadce, 0xae4e, 0xacf1, 0xacf1,
-	0xacf1, 0xacf3, 0xacf1, 0xacf1, 0xacf1, 0xacf1, 0xacf1, 0xacf1,
-	0xacf1, 0x080c, 0x0d7d, 0x9186, 0x004c, 0x0560, 0x9186, 0x0003,
-	0x190c, 0x0d7d, 0x0096, 0x601c, 0xc0ed, 0x601e, 0x6003, 0x0003,
-	0x6106, 0x6014, 0x2048, 0xa87c, 0x9084, 0xa000, 0xc0b5, 0xa87e,
-	0xa8ac, 0xa836, 0xa8b0, 0xa83a, 0x9006, 0xa846, 0xa84a, 0xa884,
-	0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003, 0x8013, 0x8213,
-	0x9210, 0x621a, 0x009e, 0x080c, 0x1bba, 0x2009, 0x8030, 0x080c,
-	0x9234, 0x0005, 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00,
-	0x080c, 0xae70, 0x080c, 0xcf46, 0x6003, 0x0007, 0x0005, 0x00d6,
-	0x0096, 0x00f6, 0x2079, 0x1800, 0x7a90, 0x6014, 0x2048, 0xa87c,
-	0xd0ec, 0x1110, 0x9290, 0x0018, 0xac78, 0xc4fc, 0x0046, 0xa8e0,
-	0x9005, 0x1140, 0xa8dc, 0x921a, 0x0140, 0x0220, 0xa87b, 0x0007,
-	0x2010, 0x0028, 0xa87b, 0x0015, 0x0010, 0xa87b, 0x0000, 0x8214,
-	0xa883, 0x0000, 0xaa02, 0x0006, 0x0016, 0x0026, 0x00c6, 0x00d6,
-	0x00e6, 0x00f6, 0x2400, 0x9005, 0x1108, 0x009a, 0x2100, 0x9086,
-	0x0015, 0x1118, 0x2001, 0x0001, 0x0038, 0x2100, 0x9086, 0x0016,
-	0x0118, 0x2001, 0x0001, 0x002a, 0x94a4, 0x0007, 0x8423, 0x9405,
-	0x0002, 0xad96, 0xad96, 0xad91, 0xad94, 0xad96, 0xad8e, 0xad81,
-	0xad81, 0xad81, 0xad81, 0xad81, 0xad81, 0xad81, 0xad81, 0xad81,
-	0xad81, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x000e,
-	0x004e, 0x00fe, 0x009e, 0x00de, 0x080c, 0x0d7d, 0x080c, 0xb82b,
-	0x0028, 0x080c, 0xb910, 0x0010, 0x080c, 0xba06, 0x00fe, 0x00ee,
-	0x00de, 0x00ce, 0x002e, 0x001e, 0x2c00, 0xa896, 0x000e, 0x080c,
-	0xaf2e, 0x0530, 0xa804, 0xa80e, 0x00a6, 0x2050, 0xb100, 0x00ae,
-	0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-	0x0002, 0xaacc, 0xabd0, 0xacd4, 0xadd8, 0x2031, 0x0000, 0x2041,
-	0x1298, 0x080c, 0xb0ee, 0x0160, 0x000e, 0x9005, 0x0120, 0x00fe,
-	0x009e, 0x00de, 0x0005, 0x00fe, 0x009e, 0x00de, 0x0804, 0xabc9,
-	0x2001, 0x002c, 0x900e, 0x080c, 0xaf94, 0x0c70, 0x91b6, 0x0015,
-	0x0170, 0x91b6, 0x0016, 0x0158, 0x91b2, 0x0047, 0x0a0c, 0x0d7d,
-	0x91b2, 0x0050, 0x1a0c, 0x0d7d, 0x9182, 0x0047, 0x0042, 0x080c,
-	0xaa84, 0x0120, 0x9086, 0x0002, 0x0904, 0xad2f, 0x0005, 0xadf0,
-	0xadf0, 0xadf2, 0xae24, 0xadf0, 0xadf0, 0xadf0, 0xadf0, 0xae37,
-	0x080c, 0x0d7d, 0x00d6, 0x0016, 0x0096, 0x6003, 0x0004, 0x6114,
-	0x2148, 0xa87c, 0xd0fc, 0x01c0, 0xa878, 0xc0fc, 0x9005, 0x1158,
-	0xa894, 0x9005, 0x0140, 0x2001, 0x0000, 0x900e, 0x080c, 0xaf94,
-	0x080c, 0xabc9, 0x00a8, 0x6003, 0x0002, 0xa8a4, 0xa9a8, 0x9105,
-	0x1178, 0xa8ae, 0xa8b2, 0x0c78, 0xa87f, 0x0020, 0xa88c, 0xa88a,
-	0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2, 0xa8c7, 0x0000, 0xa8cb, 0x0000,
-	0x009e, 0x001e, 0x00de, 0x0005, 0x080c, 0x960a, 0x00d6, 0x0096,
-	0x6114, 0x2148, 0x080c, 0xc814, 0x0120, 0xa87b, 0x0006, 0x080c,
-	0x6d70, 0x009e, 0x00de, 0x080c, 0xabc9, 0x0804, 0x966f, 0x080c,
-	0x960a, 0x080c, 0x31e4, 0x080c, 0xcf43, 0x00d6, 0x0096, 0x6114,
-	0x2148, 0x080c, 0xc814, 0x0120, 0xa87b, 0x0029, 0x080c, 0x6d70,
-	0x009e, 0x00de, 0x080c, 0xabc9, 0x0804, 0x966f, 0x9182, 0x0047,
-	0x0002, 0xae5e, 0xae60, 0xae5e, 0xae5e, 0xae5e, 0xae5e, 0xae5e,
-	0xae5e, 0xae5e, 0xae5e, 0xae5e, 0xae5e, 0xae60, 0x080c, 0x0d7d,
-	0x00d6, 0x0096, 0x601f, 0x0000, 0x6114, 0x2148, 0xa87b, 0x0000,
-	0xa883, 0x0000, 0x080c, 0x6d70, 0x009e, 0x00de, 0x0804, 0xabc9,
-	0x0026, 0x0036, 0x0056, 0x0066, 0x0096, 0x00a6, 0x00f6, 0x0006,
-	0x080c, 0x103a, 0x000e, 0x090c, 0x0d7d, 0xa960, 0x21e8, 0xa95c,
-	0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104, 0xa87a,
-	0x2079, 0x1800, 0x7990, 0x9188, 0x0018, 0x918c, 0x0fff, 0xa972,
-	0xac76, 0x2950, 0x00a6, 0x2001, 0x0205, 0x2003, 0x0000, 0x901e,
-	0x2029, 0x0001, 0x9182, 0x0034, 0x1228, 0x2011, 0x001f, 0x080c,
-	0xc3e7, 0x04c0, 0x2130, 0x2009, 0x0034, 0x2011, 0x001f, 0x080c,
-	0xc3e7, 0x96b2, 0x0034, 0xb004, 0x904d, 0x0110, 0x080c, 0x0fec,
-	0x080c, 0x103a, 0x01d0, 0x8528, 0xa867, 0x0110, 0xa86b, 0x0000,
-	0x2920, 0xb406, 0x968a, 0x003d, 0x1230, 0x2608, 0x2011, 0x001b,
-	0x080c, 0xc3e7, 0x00b8, 0x96b2, 0x003c, 0x2009, 0x003c, 0x2950,
-	0x2011, 0x001b, 0x080c, 0xc3e7, 0x0c18, 0x2001, 0x0205, 0x2003,
-	0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0xb070, 0xc0fd,
-	0xb072, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f,
-	0x95ad, 0x0050, 0xb566, 0x2a48, 0xa804, 0xa807, 0x0000, 0x0006,
-	0x080c, 0x6d70, 0x000e, 0x2048, 0x9005, 0x1db0, 0x00fe, 0x00ae,
-	0x009e, 0x006e, 0x005e, 0x003e, 0x002e, 0x0005, 0x00d6, 0x00f6,
-	0x0096, 0x0006, 0x080c, 0x103a, 0x000e, 0x090c, 0x0d7d, 0xa960,
-	0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020,
-	0x4104, 0xaa66, 0xa87a, 0x2079, 0x1800, 0x7990, 0x810c, 0x9188,
-	0x000c, 0x9182, 0x001a, 0x0210, 0x2009, 0x001a, 0x21a8, 0x810b,
-	0xa972, 0xac76, 0x2e98, 0xa85c, 0x9080, 0x001f, 0x20a0, 0x2001,
-	0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x4003, 0x2003, 0x0000,
-	0x080c, 0x6d70, 0x009e, 0x00fe, 0x00de, 0x0005, 0x0016, 0x00d6,
-	0x00f6, 0x0096, 0x0016, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080,
-	0x2102, 0x001e, 0x2079, 0x0200, 0x2e98, 0xa87c, 0xd0ec, 0x0118,
-	0x9e80, 0x000c, 0x2098, 0x2021, 0x003e, 0x901e, 0x9282, 0x0020,
-	0x0218, 0x2011, 0x0020, 0x2018, 0x9486, 0x003e, 0x1170, 0x0096,
-	0x080c, 0x103a, 0x2900, 0x009e, 0x05c0, 0xa806, 0x2048, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x3300, 0x908e, 0x0260,
-	0x0140, 0x2009, 0x0280, 0x9102, 0x920a, 0x0218, 0x2010, 0x2100,
-	0x9318, 0x2200, 0x9402, 0x1228, 0x2400, 0x9202, 0x2410, 0x9318,
-	0x9006, 0x2020, 0x22a8, 0xa800, 0x9200, 0xa802, 0x20e1, 0x0000,
-	0x4003, 0x83ff, 0x0180, 0x3300, 0x9086, 0x0280, 0x1130, 0x7814,
-	0x8000, 0x9085, 0x0080, 0x7816, 0x2e98, 0x2310, 0x84ff, 0x0904,
-	0xaf43, 0x0804, 0xaf45, 0x9085, 0x0001, 0x7817, 0x0000, 0x009e,
-	0x00fe, 0x00de, 0x001e, 0x0005, 0x00d6, 0x0036, 0x0096, 0x6314,
-	0x2348, 0xa87a, 0xa982, 0x080c, 0x6d64, 0x009e, 0x003e, 0x00de,
-	0x0005, 0x91b6, 0x0015, 0x1118, 0x080c, 0xabc9, 0x0030, 0x91b6,
-	0x0016, 0x190c, 0x0d7d, 0x080c, 0xabc9, 0x0005, 0x20a9, 0x000e,
-	0x20e1, 0x0000, 0x2e98, 0x6014, 0x0096, 0x2048, 0xa860, 0x20e8,
-	0xa85c, 0x20a0, 0x009e, 0x4003, 0x0136, 0x9080, 0x001b, 0x2011,
-	0x0006, 0x20a9, 0x0001, 0x3418, 0x8318, 0x23a0, 0x4003, 0x3318,
-	0x8318, 0x2398, 0x8211, 0x1db8, 0x2011, 0x0006, 0x013e, 0x20a0,
-	0x3318, 0x8318, 0x2398, 0x4003, 0x3418, 0x8318, 0x23a0, 0x8211,
-	0x1db8, 0x0096, 0x080c, 0xc814, 0x0130, 0x6014, 0x2048, 0xa807,
-	0x0000, 0xa867, 0x0103, 0x009e, 0x0804, 0xabc9, 0x0096, 0x00d6,
-	0x0036, 0x7330, 0x9386, 0x0200, 0x11a8, 0x6010, 0x00b6, 0x2058,
-	0xb8d7, 0x0000, 0x00be, 0x6014, 0x9005, 0x0130, 0x2048, 0xa807,
-	0x0000, 0xa867, 0x0103, 0xab32, 0x080c, 0xabc9, 0x003e, 0x00de,
-	0x009e, 0x0005, 0x0011, 0x1d48, 0x0cc8, 0x0006, 0x0016, 0x080c,
-	0xcf2e, 0x0188, 0x6014, 0x9005, 0x1170, 0x600b, 0x0003, 0x601b,
-	0x0000, 0x604b, 0x0000, 0x2009, 0x0022, 0x080c, 0xb3d5, 0x9006,
-	0x001e, 0x000e, 0x0005, 0x9085, 0x0001, 0x0cd0, 0x0096, 0x0016,
-	0x20a9, 0x0014, 0x9e80, 0x000c, 0x20e1, 0x0000, 0x2098, 0x6014,
+	0x89ff, 0x1168, 0x600f, 0x0000, 0x6014, 0x0096, 0x2048, 0x080c,
+	0xc836, 0x0110, 0x080c, 0xe26c, 0x009e, 0x080c, 0xac28, 0x080c,
+	0xa20e, 0x88ff, 0x1190, 0x00ce, 0x0804, 0xa229, 0x2c78, 0x600c,
+	0x2060, 0x0804, 0xa229, 0x9006, 0x012e, 0x000e, 0x006e, 0x007e,
+	0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce,
+	0x98c5, 0x0001, 0x0c88, 0x00f6, 0x00e6, 0x00d6, 0x0096, 0x00c6,
+	0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7,
+	0x7648, 0x2660, 0x2678, 0x8cff, 0x0904, 0xa327, 0x6020, 0x9086,
+	0x0006, 0x1904, 0xa322, 0x87ff, 0x0128, 0x2700, 0x9c06, 0x1904,
+	0xa322, 0x0040, 0x6010, 0x9b06, 0x15e8, 0x85ff, 0x0118, 0x605c,
+	0x9106, 0x15c0, 0x704c, 0x9c06, 0x1168, 0x0036, 0x2019, 0x0001,
+	0x080c, 0xa118, 0x703f, 0x0000, 0x9006, 0x704e, 0x706a, 0x7052,
+	0x706e, 0x003e, 0x7048, 0x9c36, 0x1110, 0x660c, 0x764a, 0x7044,
+	0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7046, 0x0010,
+	0x7047, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e,
+	0x0008, 0x2678, 0x600f, 0x0000, 0x6014, 0x2048, 0x080c, 0xc836,
+	0x0110, 0x080c, 0xe26c, 0x080c, 0xac28, 0x87ff, 0x1198, 0x00ce,
+	0x0804, 0xa2d3, 0x2c78, 0x600c, 0x2060, 0x0804, 0xa2d3, 0x9006,
+	0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x009e, 0x00de, 0x00ee,
+	0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce, 0x97bd, 0x0001, 0x0c80,
+	0x00e6, 0x2071, 0x19e7, 0x7033, 0x0000, 0x7004, 0x9086, 0x0003,
+	0x0158, 0x2001, 0x1800, 0x2004, 0x9086, 0x0002, 0x1118, 0x7007,
+	0x0005, 0x0010, 0x7007, 0x0000, 0x00ee, 0x0005, 0x00f6, 0x00e6,
+	0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071,
+	0x19e7, 0x2c10, 0x7648, 0x2660, 0x2678, 0x8cff, 0x0518, 0x2200,
+	0x9c06, 0x11e0, 0x7048, 0x9c36, 0x1110, 0x660c, 0x764a, 0x7044,
+	0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7046, 0x0010,
+	0x7047, 0x0000, 0x660c, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008,
+	0x2678, 0x600f, 0x0000, 0x9085, 0x0001, 0x0020, 0x2c78, 0x600c,
+	0x2060, 0x08d8, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00ee,
+	0x00fe, 0x0005, 0x0096, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066,
+	0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7, 0x7610,
+	0x2660, 0x2678, 0x8cff, 0x0904, 0xa41a, 0x6010, 0x00b6, 0x2058,
+	0xb8a0, 0x00be, 0x9206, 0x1904, 0xa415, 0x7030, 0x9c06, 0x1520,
+	0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0xa3f1, 0x080c, 0x9e32,
+	0x68c3, 0x0000, 0x080c, 0xa338, 0x7033, 0x0000, 0x0036, 0x2069,
+	0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
+	0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x2069, 0x0100, 0x6824, 0xd084,
+	0x0110, 0x6827, 0x0001, 0x003e, 0x7010, 0x9c36, 0x1110, 0x660c,
+	0x7612, 0x700c, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
+	0x700e, 0x0010, 0x700f, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
+	0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xca3c,
+	0x1158, 0x080c, 0x321c, 0x080c, 0xca4d, 0x11f0, 0x080c, 0xb5b5,
+	0x00d8, 0x080c, 0xa338, 0x08c0, 0x080c, 0xca4d, 0x1118, 0x080c,
+	0xb5b5, 0x0090, 0x6014, 0x2048, 0x080c, 0xc836, 0x0168, 0x6020,
+	0x9086, 0x0003, 0x1508, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
+	0x080c, 0x6d74, 0x080c, 0xca27, 0x080c, 0xccc4, 0x080c, 0xac28,
+	0x080c, 0xa20e, 0x00ce, 0x0804, 0xa39a, 0x2c78, 0x600c, 0x2060,
+	0x0804, 0xa39a, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00de,
+	0x00ee, 0x00fe, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d20,
+	0x080c, 0xe26c, 0x0c08, 0x00d6, 0x080c, 0x9aea, 0x7003, 0x0200,
+	0x7007, 0x0014, 0x60c3, 0x0014, 0x20e1, 0x0001, 0x2099, 0x1989,
+	0x20e9, 0x0000, 0x20a1, 0x0250, 0x20a9, 0x0004, 0x4003, 0x7023,
+	0x0004, 0x7027, 0x7878, 0x080c, 0x9e02, 0x00de, 0x0005, 0x080c,
+	0x9aea, 0x700b, 0x0800, 0x7814, 0x9084, 0xff00, 0x700e, 0x7814,
+	0x9084, 0x00ff, 0x7022, 0x782c, 0x7026, 0x7860, 0x9084, 0x00ff,
+	0x9085, 0x0200, 0x7002, 0x7860, 0x9084, 0xff00, 0x8007, 0x7006,
+	0x60c2, 0x0804, 0x9e02, 0x00b6, 0x00d6, 0x0016, 0x00d6, 0x2f68,
+	0x2009, 0x0035, 0x080c, 0xceca, 0x00de, 0x1904, 0xa4c8, 0x080c,
+	0x9a9f, 0x7003, 0x1300, 0x782c, 0x080c, 0xa5d3, 0x2068, 0x6820,
+	0x9086, 0x0003, 0x0560, 0x7810, 0x2058, 0xbaa0, 0x080c, 0xab57,
+	0x11d8, 0x9286, 0x007e, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe,
+	0x0498, 0x9286, 0x007f, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffd,
+	0x0458, 0x9284, 0xff80, 0x0180, 0x9286, 0x0080, 0x1128, 0x700b,
+	0x00ff, 0x700f, 0xfffc, 0x0400, 0x92d8, 0x1000, 0x2b5c, 0xb810,
+	0x700a, 0xb814, 0x700e, 0x00c0, 0xb884, 0x700e, 0x00a8, 0x080c,
+	0xab57, 0x1130, 0x7810, 0x2058, 0xb8a0, 0x9082, 0x007e, 0x0250,
+	0x00d6, 0x2069, 0x181f, 0x2d04, 0x700a, 0x8d68, 0x2d04, 0x700e,
+	0x00de, 0x0010, 0x6034, 0x700e, 0x7838, 0x7012, 0x783c, 0x7016,
+	0x60c3, 0x000c, 0x001e, 0x00de, 0x080c, 0x9e02, 0x00be, 0x0005,
+	0x781b, 0x0001, 0x7803, 0x0006, 0x001e, 0x00de, 0x00be, 0x0005,
+	0x792c, 0x9180, 0x0008, 0x200c, 0x9186, 0x0006, 0x01c0, 0x9186,
+	0x0003, 0x0904, 0xa546, 0x9186, 0x0005, 0x0904, 0xa52e, 0x9186,
+	0x0004, 0x05f0, 0x9186, 0x0008, 0x0904, 0xa537, 0x7807, 0x0037,
+	0x782f, 0x0003, 0x7817, 0x1700, 0x080c, 0xa5b0, 0x0005, 0x080c,
+	0xa571, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x6800,
+	0x6a44, 0xd2fc, 0x11f8, 0x0002, 0xa50f, 0xa51a, 0xa511, 0xa51a,
+	0xa516, 0xa50f, 0xa50f, 0xa51a, 0xa51a, 0xa51a, 0xa51a, 0xa50f,
+	0xa50f, 0xa50f, 0xa50f, 0xa50f, 0xa51a, 0xa50f, 0xa51a, 0x080c,
+	0x0d7d, 0x6824, 0xd0e4, 0x0110, 0xd0cc, 0x0110, 0x900e, 0x0010,
+	0x2009, 0x2000, 0x682c, 0x7022, 0x6830, 0x7026, 0x0804, 0xa56a,
+	0x080c, 0xa571, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000,
+	0x6a00, 0x9286, 0x0002, 0x1108, 0x900e, 0x04e0, 0x080c, 0xa571,
+	0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x0498, 0x04c9,
+	0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x9286, 0x0005,
+	0x0118, 0x9286, 0x0002, 0x1108, 0x900e, 0x0420, 0x0451, 0x00d6,
+	0x0026, 0x792c, 0x2168, 0x6814, 0x0096, 0x2048, 0xa9ac, 0xa834,
+	0x9112, 0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022, 0x7226, 0x792c,
+	0x9180, 0x0011, 0x2004, 0xd0fc, 0x1148, 0x9180, 0x0000, 0x2004,
+	0x908e, 0x0002, 0x0130, 0x908e, 0x0004, 0x0118, 0x2009, 0x4000,
+	0x0008, 0x900e, 0x712a, 0x60c3, 0x0018, 0x002e, 0x00de, 0x0804,
+	0x9e02, 0x00b6, 0x0036, 0x0046, 0x0056, 0x0066, 0x080c, 0x9aea,
+	0x9006, 0x7003, 0x0200, 0x7938, 0x710a, 0x793c, 0x710e, 0x7810,
+	0x2058, 0xb8a0, 0x080c, 0xab57, 0x1118, 0x9092, 0x007e, 0x0268,
+	0x00d6, 0x2069, 0x181f, 0x2d2c, 0x8d68, 0x2d34, 0x90d8, 0x1000,
+	0x2b5c, 0xbb10, 0xbc14, 0x00de, 0x0028, 0x901e, 0xbc84, 0x2029,
+	0x0000, 0x6634, 0x782c, 0x9080, 0x0008, 0x2004, 0x9086, 0x0003,
+	0x1128, 0x7512, 0x7616, 0x731a, 0x741e, 0x0020, 0x7312, 0x7416,
+	0x751a, 0x761e, 0x006e, 0x005e, 0x004e, 0x003e, 0x00be, 0x0005,
+	0x080c, 0x9aea, 0x7003, 0x0100, 0x782c, 0x700a, 0x7814, 0x700e,
+	0x700e, 0x60c3, 0x0008, 0x0804, 0x9e02, 0x080c, 0x9a96, 0x7003,
+	0x1400, 0x7838, 0x700a, 0x0079, 0x783c, 0x700e, 0x782c, 0x7012,
+	0x7830, 0x7016, 0x7834, 0x9084, 0x00ff, 0x8007, 0x701a, 0x60c3,
+	0x0010, 0x0804, 0x9e02, 0x00e6, 0x2071, 0x0240, 0x0006, 0x00f6,
+	0x2078, 0x7810, 0x00b6, 0x2058, 0xb8d4, 0xd084, 0x0120, 0x7850,
+	0x702a, 0x784c, 0x702e, 0x00be, 0x00fe, 0x000e, 0x00ee, 0x0005,
+	0x080c, 0x9ae1, 0x7003, 0x0100, 0x782c, 0x700a, 0x7814, 0x700e,
+	0x60c3, 0x0008, 0x0804, 0x9e02, 0x00a9, 0x7914, 0x712a, 0x60c3,
+	0x0000, 0x60a7, 0x9575, 0x0026, 0x080c, 0x2979, 0x0228, 0x2011,
+	0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x080c, 0x9e25, 0x080c,
+	0x86ed, 0x0005, 0x0036, 0x0096, 0x00d6, 0x00e6, 0x7860, 0x2048,
+	0xaa7c, 0x9296, 0x00c0, 0x9294, 0xfffd, 0xaa7e, 0xaa80, 0x9294,
+	0x0300, 0xaa82, 0xa96c, 0x9194, 0x00ff, 0xab74, 0x9384, 0x00ff,
+	0x908d, 0xc200, 0xa96e, 0x9384, 0xff00, 0x9215, 0xaa76, 0xa870,
+	0xaa78, 0xa87a, 0xaa72, 0x00d6, 0x2069, 0x0200, 0x080c, 0xa690,
+	0x00de, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000a, 0xa860,
+	0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x4003, 0x60a3, 0x0035,
+	0xaa68, 0x9294, 0x7000, 0x9286, 0x3000, 0x0110, 0x60a3, 0x0037,
+	0x00ee, 0x00de, 0x009e, 0x003e, 0x0005, 0x900e, 0x7814, 0x0096,
+	0x2048, 0xa87c, 0xd0fc, 0x01c0, 0x9084, 0x0003, 0x11a8, 0x2001,
+	0x180c, 0x2004, 0xd0bc, 0x0180, 0x7824, 0xd0cc, 0x1168, 0xd0c4,
+	0x1158, 0xa8a8, 0x9005, 0x1140, 0x2001, 0x180c, 0x200c, 0xc1d5,
+	0x2102, 0x2009, 0x19b2, 0x210c, 0x009e, 0x918d, 0x0092, 0x0010,
+	0x2009, 0x0096, 0x60ab, 0x0036, 0x0026, 0x2110, 0x900e, 0x080c,
+	0x2a53, 0x002e, 0x0005, 0x2009, 0x0009, 0x00a0, 0x2009, 0x000a,
+	0x0088, 0x2009, 0x000b, 0x0070, 0x2009, 0x000c, 0x0058, 0x2009,
+	0x000d, 0x0040, 0x2009, 0x000e, 0x0028, 0x2009, 0x000f, 0x0010,
+	0x2009, 0x0008, 0x6912, 0x0005, 0x080c, 0x9a9f, 0x0016, 0x0026,
+	0x0096, 0x00d6, 0x7814, 0x2048, 0x7013, 0x0138, 0x2001, 0x1837,
+	0x2004, 0x9084, 0x0028, 0x1138, 0x2001, 0x197c, 0x2004, 0x9086,
+	0xaaaa, 0x1904, 0xa735, 0x7003, 0x5400, 0x00c6, 0x2061, 0x1800,
+	0x607c, 0x9084, 0x00ff, 0xa998, 0x810f, 0x918c, 0xff00, 0x9105,
+	0x700a, 0x6080, 0x700e, 0xa998, 0x918c, 0xff00, 0x7112, 0x20a9,
+	0x0004, 0x2009, 0x1805, 0x2e10, 0x9290, 0x0006, 0x2104, 0x2012,
+	0x8108, 0x8210, 0x1f04, 0xa6c6, 0x20a9, 0x0004, 0x2009, 0x1801,
+	0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xa6d0, 0xa860, 0x20e0,
+	0xa85c, 0x9080, 0x0029, 0x2098, 0x2009, 0x0006, 0x20a9, 0x0001,
+	0x4002, 0x8007, 0x2012, 0x8210, 0x8109, 0x1dc0, 0x00d6, 0x2069,
+	0x0200, 0x080c, 0xa67b, 0x00de, 0x2071, 0x0240, 0x2011, 0x0240,
+	0x2009, 0x0002, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210,
+	0x8109, 0x1dc0, 0x2009, 0x0008, 0x20a9, 0x0001, 0x4002, 0x8007,
+	0x2012, 0x8210, 0x8109, 0x1dc0, 0xa85c, 0x9080, 0x0031, 0x2098,
+	0x2009, 0x0008, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012, 0x8210,
+	0x8109, 0x1dc0, 0x00ce, 0x60c3, 0x004c, 0x60a3, 0x0056, 0x60a7,
+	0x9575, 0x2001, 0x1837, 0x2004, 0x9084, 0x0028, 0x1168, 0x080c,
+	0x74e9, 0x0150, 0x6028, 0xc0bd, 0x602a, 0x2009, 0x1804, 0x2011,
+	0x0029, 0x080c, 0x2a53, 0x0010, 0x080c, 0x9e02, 0x080c, 0x86ed,
+	0x00de, 0x009e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x2071, 0x0240,
+	0x2001, 0x2200, 0x9085, 0x00ff, 0x7002, 0x7007, 0xffff, 0x2071,
+	0x0100, 0x709b, 0x00ff, 0x00ee, 0x0804, 0xa6ab, 0x080c, 0x9a9f,
+	0x0016, 0x0026, 0x0096, 0x00d6, 0x7814, 0x2048, 0x7013, 0x0138,
+	0x7003, 0x5500, 0x00c6, 0xa89c, 0x9084, 0x00ff, 0xa998, 0x810f,
+	0x918c, 0xff00, 0x9105, 0x700a, 0xa99c, 0x918c, 0xff00, 0xa8a0,
+	0x9084, 0x00ff, 0x9105, 0x700e, 0xa998, 0x918c, 0xff00, 0x2061,
+	0x1800, 0x607c, 0x9084, 0x00ff, 0x910d, 0x7112, 0x6180, 0x7116,
+	0x2009, 0x0008, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0029, 0x2098,
+	0x2e10, 0x9290, 0x0006, 0x20a9, 0x0001, 0x4002, 0x8007, 0x2012,
+	0x8210, 0x8109, 0x1dc0, 0x20a9, 0x0004, 0x2009, 0x1805, 0x2104,
+	0x2012, 0x8108, 0x8210, 0x1f04, 0xa787, 0x20a9, 0x0002, 0x2009,
+	0x1801, 0x2104, 0x2012, 0x8108, 0x8210, 0x1f04, 0xa791, 0x00d6,
+	0x0016, 0x2069, 0x0200, 0x080c, 0xa67b, 0x001e, 0x00de, 0x2071,
+	0x0240, 0x20a9, 0x0002, 0x2009, 0x1803, 0x2011, 0x0240, 0x2104,
+	0x2012, 0x8108, 0x8210, 0x1f04, 0xa7a7, 0x2009, 0x0008, 0x4002,
+	0x8007, 0x2012, 0x8210, 0x8109, 0x1dd0, 0x9006, 0x20a9, 0x0008,
+	0x2012, 0x8210, 0x1f04, 0xa7b8, 0x00ce, 0x60c3, 0x004c, 0x60a3,
+	0x0056, 0x60a7, 0x9575, 0x080c, 0x9e02, 0x080c, 0x86ed, 0x00de,
+	0x009e, 0x002e, 0x001e, 0x0005, 0x00d6, 0x9290, 0x0018, 0x8214,
+	0x20e9, 0x0000, 0x2069, 0x0200, 0x6813, 0x0000, 0x22a8, 0x9284,
+	0x00e0, 0x0128, 0x20a9, 0x0020, 0x9292, 0x0020, 0x0008, 0x9016,
+	0x20a1, 0x0240, 0x9006, 0x4004, 0x82ff, 0x0120, 0x6810, 0x8000,
+	0x6812, 0x0c60, 0x00de, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
+	0x00a6, 0x0096, 0x0066, 0x0126, 0x2091, 0x8000, 0x2071, 0x19e7,
+	0x7610, 0x2660, 0x2678, 0x8cff, 0x0904, 0xa873, 0x7030, 0x9c06,
+	0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0xa84a, 0x080c,
+	0x9e32, 0x68c3, 0x0000, 0x080c, 0xa338, 0x7033, 0x0000, 0x0036,
+	0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100,
+	0x080c, 0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x2069, 0x0100, 0x6824,
+	0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x7010, 0x9c36, 0x1110,
+	0x660c, 0x7612, 0x700c, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118,
+	0x2f00, 0x700e, 0x0010, 0x700f, 0x0000, 0x660c, 0x0066, 0x2c00,
+	0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c,
+	0xca3c, 0x1158, 0x080c, 0x321c, 0x080c, 0xca4d, 0x11f0, 0x080c,
+	0xb5b5, 0x00d8, 0x080c, 0xa338, 0x08c0, 0x080c, 0xca4d, 0x1118,
+	0x080c, 0xb5b5, 0x0090, 0x6014, 0x2048, 0x080c, 0xc836, 0x0168,
+	0x6020, 0x9086, 0x0003, 0x1520, 0xa867, 0x0103, 0xab7a, 0xa877,
+	0x0000, 0x080c, 0x6d80, 0x080c, 0xca27, 0x080c, 0xccc4, 0x080c,
+	0xac28, 0x080c, 0xa20e, 0x00ce, 0x0804, 0xa7fb, 0x2c78, 0x600c,
+	0x2060, 0x0804, 0xa7fb, 0x7013, 0x0000, 0x700f, 0x0000, 0x012e,
+	0x006e, 0x009e, 0x00ae, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005,
+	0x6020, 0x9086, 0x0006, 0x1d08, 0x080c, 0xe26c, 0x08f0, 0x00f6,
+	0x0036, 0x2079, 0x0380, 0x7b18, 0xd3bc, 0x1de8, 0x7832, 0x7936,
+	0x7a3a, 0x781b, 0x8080, 0x003e, 0x00fe, 0x0005, 0x0016, 0x2001,
+	0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0001, 0x1188, 0x2001,
+	0x0015, 0x0c29, 0x2009, 0x1000, 0x2001, 0x0382, 0x2004, 0x9084,
+	0x0007, 0x9086, 0x0003, 0x0120, 0x8109, 0x1db0, 0x080c, 0x0d7d,
+	0x001e, 0x0005, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086,
+	0x0003, 0x1120, 0x2001, 0x0380, 0x2003, 0x0001, 0x0005, 0x0156,
+	0x0016, 0x0026, 0x00e6, 0x900e, 0x2071, 0x19e7, 0x0469, 0x0106,
+	0x0190, 0x7004, 0x9086, 0x0003, 0x0148, 0x20a9, 0x1000, 0x6044,
+	0xd0fc, 0x01d8, 0x1f04, 0xa8cf, 0x080c, 0x0d7d, 0x080c, 0xa896,
+	0x6044, 0xd0fc, 0x0190, 0x7030, 0x9c06, 0x1148, 0x080c, 0x95de,
+	0x6044, 0xd0dc, 0x0150, 0xc0dc, 0x6046, 0x700a, 0x7042, 0x704c,
+	0x9c06, 0x190c, 0x0d7d, 0x080c, 0x963b, 0x010e, 0x1919, 0x00ee,
+	0x002e, 0x001e, 0x015e, 0x0005, 0x2001, 0x0382, 0x2004, 0x9084,
+	0x0007, 0x9086, 0x0003, 0x0005, 0x0126, 0x2091, 0x2400, 0x7808,
+	0xd0a4, 0x190c, 0x0d76, 0xd09c, 0x0128, 0x7820, 0x908c, 0xf000,
+	0x11b8, 0x0012, 0x012e, 0x0005, 0xa91c, 0xa95a, 0xa981, 0xa9b8,
+	0xa9c8, 0xa9d9, 0xa9e8, 0xa9f6, 0xaa23, 0xaa27, 0xa91c, 0xa91c,
+	0xa91c, 0xa91c, 0xa91c, 0xa91c, 0x080c, 0x0d7d, 0x012e, 0x0005,
+	0x2060, 0x6044, 0xd0bc, 0x0140, 0xc0bc, 0x6046, 0x6000, 0x908a,
+	0x0016, 0x1a0c, 0x0d7d, 0x0012, 0x012e, 0x0005, 0xa941, 0xa943,
+	0xa941, 0xa949, 0xa941, 0xa941, 0xa941, 0xa941, 0xa941, 0xa943,
+	0xa941, 0xa943, 0xa941, 0xa943, 0xa941, 0xa941, 0xa941, 0xa943,
+	0xa941, 0x080c, 0x0d7d, 0x2009, 0x0013, 0x080c, 0xac8c, 0x012e,
+	0x0005, 0x6014, 0x2048, 0xa87c, 0xd0dc, 0x0130, 0x080c, 0x88c1,
+	0x080c, 0xabed, 0x012e, 0x0005, 0x2009, 0x0049, 0x080c, 0xac8c,
+	0x012e, 0x0005, 0x080c, 0xa896, 0x2001, 0x1a0c, 0x2003, 0x0000,
+	0x7030, 0x9065, 0x090c, 0x0d7d, 0x7034, 0x9092, 0x00c8, 0x1258,
+	0x8000, 0x7036, 0x7004, 0x9086, 0x0003, 0x0110, 0x7007, 0x0000,
+	0x781f, 0x0808, 0x0040, 0x080c, 0xe717, 0x6003, 0x0001, 0x2009,
+	0x0014, 0x080c, 0xac8c, 0x781f, 0x0100, 0x080c, 0xa8b2, 0x012e,
+	0x0005, 0x080c, 0xa896, 0x714c, 0x81ff, 0x1128, 0x2011, 0x1a0f,
+	0x2013, 0x0000, 0x0438, 0x2061, 0x0100, 0x7150, 0x9192, 0x7530,
+	0x12f0, 0x8108, 0x7152, 0x714c, 0x9188, 0x0008, 0x210c, 0x918e,
+	0x0006, 0x1138, 0x6014, 0x9084, 0x1984, 0x9085, 0x0012, 0x6016,
+	0x0088, 0x714c, 0x9188, 0x0008, 0x210c, 0x918e, 0x0009, 0x0d90,
+	0x6014, 0x9084, 0x1984, 0x9085, 0x0016, 0x6016, 0x0018, 0x706c,
+	0xc085, 0x706e, 0x781f, 0x0200, 0x080c, 0xa8b2, 0x012e, 0x0005,
+	0x080c, 0xa896, 0x714c, 0x2160, 0x6003, 0x0003, 0x2009, 0x004a,
+	0x080c, 0xac8c, 0x781f, 0x0200, 0x080c, 0xa8b2, 0x012e, 0x0005,
+	0x7808, 0xd09c, 0x0de8, 0x7820, 0x2060, 0x6003, 0x0003, 0x080c,
+	0xa896, 0x080c, 0x1d60, 0x781f, 0x0400, 0x080c, 0xa8b2, 0x012e,
+	0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x2060, 0x080c, 0xa896,
+	0x080c, 0x1da8, 0x781f, 0x0400, 0x080c, 0xa8b2, 0x012e, 0x0005,
+	0x7030, 0x9065, 0x0148, 0x6044, 0xc0bc, 0x6046, 0x7104, 0x9186,
+	0x0003, 0x0110, 0x080c, 0x96a1, 0x012e, 0x0005, 0x00f6, 0x703c,
+	0x9086, 0x0002, 0x0528, 0x704c, 0x907d, 0x0510, 0x7844, 0xc0bc,
+	0x7846, 0x7820, 0x9086, 0x0009, 0x0118, 0x080c, 0x9d5c, 0x00c0,
+	0x7828, 0xd0fc, 0x1118, 0x080c, 0x9cdb, 0x0090, 0x2001, 0x1837,
+	0x2004, 0x9084, 0x0028, 0x1130, 0x2001, 0x197c, 0x2004, 0x9086,
+	0xaaaa, 0x1120, 0x2001, 0x0387, 0x2003, 0x1000, 0x080c, 0x9c60,
+	0x00fe, 0x012e, 0x0005, 0x080c, 0x758a, 0x012e, 0x0005, 0x080c,
+	0x0d7d, 0x0005, 0x00e6, 0x2071, 0x19e7, 0x6044, 0xc0bc, 0x6046,
+	0xd0fc, 0x01b8, 0x704c, 0x9c06, 0x1190, 0x2019, 0x0001, 0x080c,
+	0xa118, 0x704f, 0x0000, 0x2001, 0x0109, 0x2004, 0xd08c, 0x1138,
+	0x2001, 0x0108, 0x2004, 0xd0bc, 0x1110, 0x703f, 0x0000, 0x080c,
+	0xa34e, 0x00ee, 0x0005, 0x0026, 0x7010, 0x9c06, 0x1178, 0x080c,
+	0xa20e, 0x6044, 0xc0fc, 0x6046, 0x600c, 0x9015, 0x0120, 0x7212,
+	0x600f, 0x0000, 0x0010, 0x7212, 0x720e, 0x9006, 0x002e, 0x0005,
+	0x0026, 0x7020, 0x9c06, 0x1178, 0x080c, 0xa20e, 0x6044, 0xc0fc,
+	0x6046, 0x600c, 0x9015, 0x0120, 0x7222, 0x600f, 0x0000, 0x0010,
+	0x7222, 0x721e, 0x9006, 0x002e, 0x0005, 0x00d6, 0x0036, 0x7830,
+	0x9c06, 0x1558, 0x2069, 0x0100, 0x68c0, 0x9005, 0x01f8, 0x080c,
+	0x86f6, 0x080c, 0x9e32, 0x68c3, 0x0000, 0x080c, 0xa338, 0x2069,
+	0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
+	0x2a0a, 0x9006, 0x080c, 0x2a0a, 0x2069, 0x0100, 0x6824, 0xd084,
+	0x0110, 0x6827, 0x0001, 0x9085, 0x0001, 0x0038, 0x7808, 0xc0ad,
+	0x780a, 0x6003, 0x0009, 0x630a, 0x9006, 0x003e, 0x00de, 0x0005,
+	0x0016, 0x0026, 0x0036, 0x6100, 0x2019, 0x0100, 0x2001, 0x0382,
+	0x2004, 0xd09c, 0x0190, 0x00c6, 0x0126, 0x2091, 0x2800, 0x0016,
+	0x0036, 0x080c, 0xa8fc, 0x003e, 0x001e, 0x012e, 0x00ce, 0x6200,
+	0x2200, 0x9106, 0x0d58, 0x2200, 0x0010, 0x8319, 0x1d38, 0x003e,
+	0x002e, 0x001e, 0x0005, 0x00d6, 0x0156, 0x080c, 0x9aea, 0x7a14,
+	0x82ff, 0x0138, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008,
+	0x0490, 0x7003, 0x0200, 0x7007, 0x0000, 0x2069, 0x1800, 0x901e,
+	0x6800, 0x9086, 0x0004, 0x1110, 0xc38d, 0x0060, 0x080c, 0x74e9,
+	0x1110, 0xc3ad, 0x0008, 0xc3a5, 0x6adc, 0xd29c, 0x1110, 0xd2ac,
+	0x0108, 0xc39d, 0x730e, 0x080c, 0x87bb, 0x20a9, 0x0006, 0x2011,
+	0xfff4, 0x2019, 0xfff5, 0x2071, 0x0250, 0x2305, 0x2072, 0x8e70,
+	0x2205, 0x2072, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04,
+	0xaafd, 0x60c3, 0x0020, 0x080c, 0x9e02, 0x015e, 0x00de, 0x0005,
+	0x0156, 0x080c, 0x9aea, 0x7a14, 0x82ff, 0x0168, 0x9286, 0xffff,
+	0x0118, 0x9282, 0x000e, 0x1238, 0x7003, 0x0100, 0x700b, 0x0003,
+	0x60c3, 0x0008, 0x0488, 0x7003, 0x0200, 0x7007, 0x001c, 0x700f,
+	0x0001, 0x2011, 0x19bd, 0x2204, 0x8007, 0x701a, 0x8210, 0x2204,
+	0x8007, 0x701e, 0x0421, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
+	0x2001, 0x181f, 0x2004, 0x7022, 0x2001, 0x1820, 0x2004, 0x7026,
+	0x0030, 0x2001, 0x1818, 0x2004, 0x9084, 0x00ff, 0x7026, 0x20a9,
+	0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1,
+	0x0256, 0x4003, 0x60c3, 0x001c, 0x015e, 0x0804, 0x9e02, 0x0006,
+	0x2001, 0x1837, 0x2004, 0xd0ac, 0x000e, 0x0005, 0x2011, 0x0003,
+	0x080c, 0xa1cf, 0x2011, 0x0002, 0x080c, 0xa1d9, 0x080c, 0xa098,
+	0x0036, 0x901e, 0x080c, 0xa118, 0x003e, 0x0005, 0x080c, 0x336d,
+	0x0188, 0x0016, 0x00b6, 0x00c6, 0x7010, 0x9085, 0x0020, 0x7012,
+	0x2009, 0x007e, 0x080c, 0x6625, 0xb85c, 0xc0ac, 0xb85e, 0x00ce,
+	0x00be, 0x001e, 0x0005, 0x2071, 0x188d, 0x7000, 0x9005, 0x0140,
+	0x2001, 0x0812, 0x2071, 0x1800, 0x7076, 0x707a, 0x706b, 0xffd4,
+	0x2071, 0x1800, 0x7074, 0x7056, 0x705b, 0x1ddc, 0x0005, 0x00e6,
+	0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0010,
+	0x0608, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0,
+	0x001c, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc, 0x0c98,
+	0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x001c, 0x7068, 0x9502,
+	0x1230, 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b,
+	0x1ddc, 0x0cc0, 0x9006, 0x0cc0, 0x00e6, 0x2071, 0x1800, 0x7554,
+	0x9582, 0x0010, 0x0600, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000,
+	0x0148, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061,
+	0x1ddc, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x001c,
+	0x7068, 0x9502, 0x1228, 0x755a, 0x9085, 0x0001, 0x00ee, 0x0005,
+	0x705b, 0x1ddc, 0x0cc8, 0x9006, 0x0cc8, 0x9c82, 0x1ddc, 0x0a0c,
+	0x0d7d, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1a0c, 0x0d7d, 0x9006,
+	0x6006, 0x600a, 0x600e, 0x6016, 0x601a, 0x6012, 0x6023, 0x0000,
+	0x6003, 0x0000, 0x601e, 0x605e, 0x6062, 0x6026, 0x602a, 0x602e,
+	0x6032, 0x6036, 0x603a, 0x603e, 0x604a, 0x602a, 0x6046, 0x6042,
+	0x2061, 0x1800, 0x6054, 0x8000, 0x6056, 0x0005, 0x9006, 0x600e,
+	0x6016, 0x601a, 0x6012, 0x6022, 0x6002, 0x601e, 0x605e, 0x6062,
+	0x604a, 0x6046, 0x2061, 0x1800, 0x6054, 0x8000, 0x6056, 0x0005,
+	0x0006, 0x6000, 0x9086, 0x0000, 0x01d0, 0x601c, 0xd084, 0x190c,
+	0x1a6a, 0x6023, 0x0007, 0x2001, 0x1986, 0x2004, 0x0006, 0x9082,
+	0x0051, 0x000e, 0x0208, 0x8004, 0x601a, 0x080c, 0xe524, 0x604b,
+	0x0000, 0x6044, 0xd0fc, 0x1129, 0x9006, 0x6046, 0x6016, 0x000e,
+	0x0005, 0x080c, 0xa8f4, 0x0106, 0x190c, 0xa896, 0x2001, 0x19fa,
+	0x2004, 0x9c06, 0x1130, 0x0036, 0x2019, 0x0001, 0x080c, 0xa118,
+	0x003e, 0x080c, 0xa34e, 0x010e, 0x190c, 0xa8b2, 0x0005, 0x00e6,
+	0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7554, 0x9582, 0x0001,
+	0x0608, 0x7058, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0,
+	0x001c, 0x7068, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc, 0x0c98,
+	0x6003, 0x0008, 0x8529, 0x7556, 0x9ca8, 0x001c, 0x7068, 0x9502,
+	0x1230, 0x755a, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x705b,
+	0x1ddc, 0x0cc0, 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002,
+	0xaca0, 0xacaa, 0xacc5, 0xace0, 0xcf9c, 0xcfb9, 0xcfd4, 0xaca0,
+	0xacaa, 0x8f9a, 0xacfc, 0xaca0, 0xaca0, 0xaca0, 0xaca0, 0xaca0,
+	0x9186, 0x0013, 0x1130, 0x6044, 0xd0fc, 0x0110, 0x080c, 0x95de,
+	0x0005, 0x0005, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d7d,
+	0x0013, 0x006e, 0x0005, 0xacc3, 0xb421, 0xb5fc, 0xacc3, 0xb692,
+	0xafc5, 0xacc3, 0xacc3, 0xb3a3, 0xbbfa, 0xacc3, 0xacc3, 0xacc3,
+	0xacc3, 0xacc3, 0xacc3, 0x080c, 0x0d7d, 0x0066, 0x6000, 0x90b2,
+	0x0016, 0x1a0c, 0x0d7d, 0x0013, 0x006e, 0x0005, 0xacde, 0xc205,
+	0xacde, 0xacde, 0xacde, 0xacde, 0xacde, 0xacde, 0xc1aa, 0xc388,
+	0xacde, 0xc242, 0xc2c6, 0xc242, 0xc2c6, 0xacde, 0x080c, 0x0d7d,
+	0x6000, 0x9082, 0x0016, 0x1a0c, 0x0d7d, 0x6000, 0x0002, 0xacfa,
+	0xbc44, 0xbcdb, 0xbe5b, 0xbeca, 0xacfa, 0xacfa, 0xacfa, 0xbc13,
+	0xc12b, 0xc12e, 0xacfa, 0xacfa, 0xacfa, 0xacfa, 0xc15e, 0xacfa,
+	0xacfa, 0xacfa, 0x080c, 0x0d7d, 0x0066, 0x6000, 0x90b2, 0x0016,
+	0x1a0c, 0x0d7d, 0x0013, 0x006e, 0x0005, 0xad15, 0xad15, 0xad53,
+	0xadf2, 0xae72, 0xad15, 0xad15, 0xad15, 0xad17, 0xad15, 0xad15,
+	0xad15, 0xad15, 0xad15, 0xad15, 0xad15, 0x080c, 0x0d7d, 0x9186,
+	0x004c, 0x0560, 0x9186, 0x0003, 0x190c, 0x0d7d, 0x0096, 0x601c,
+	0xc0ed, 0x601e, 0x6003, 0x0003, 0x6106, 0x6014, 0x2048, 0xa87c,
+	0x9084, 0xa000, 0xc0b5, 0xa87e, 0xa8ac, 0xa836, 0xa8b0, 0xa83a,
+	0x9006, 0xa846, 0xa84a, 0xa884, 0x9092, 0x199a, 0x0210, 0x2001,
+	0x1999, 0x8003, 0x8013, 0x8213, 0x9210, 0x621a, 0x009e, 0x080c,
+	0x1bba, 0x2009, 0x8030, 0x080c, 0x9265, 0x0005, 0x6010, 0x00b6,
+	0x2058, 0xbca0, 0x00be, 0x2c00, 0x080c, 0xae94, 0x080c, 0xcf6a,
+	0x6003, 0x0007, 0x0005, 0x00d6, 0x0096, 0x00f6, 0x2079, 0x1800,
+	0x7a90, 0x6014, 0x2048, 0xa87c, 0xd0ec, 0x1110, 0x9290, 0x0018,
+	0xac78, 0xc4fc, 0x0046, 0xa8e0, 0x9005, 0x1140, 0xa8dc, 0x921a,
+	0x0140, 0x0220, 0xa87b, 0x0007, 0x2010, 0x0028, 0xa87b, 0x0015,
+	0x0010, 0xa87b, 0x0000, 0x8214, 0xa883, 0x0000, 0xaa02, 0x0006,
+	0x0016, 0x0026, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2400, 0x9005,
+	0x1108, 0x009a, 0x2100, 0x9086, 0x0015, 0x1118, 0x2001, 0x0001,
+	0x0038, 0x2100, 0x9086, 0x0016, 0x0118, 0x2001, 0x0001, 0x002a,
+	0x94a4, 0x0007, 0x8423, 0x9405, 0x0002, 0xadba, 0xadba, 0xadb5,
+	0xadb8, 0xadba, 0xadb2, 0xada5, 0xada5, 0xada5, 0xada5, 0xada5,
+	0xada5, 0xada5, 0xada5, 0xada5, 0xada5, 0x00fe, 0x00ee, 0x00de,
+	0x00ce, 0x002e, 0x001e, 0x000e, 0x004e, 0x00fe, 0x009e, 0x00de,
+	0x080c, 0x0d7d, 0x080c, 0xb84f, 0x0028, 0x080c, 0xb934, 0x0010,
+	0x080c, 0xba2a, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e,
+	0x2c00, 0xa896, 0x000e, 0x080c, 0xaf52, 0x0530, 0xa804, 0xa80e,
+	0x00a6, 0x2050, 0xb100, 0x00ae, 0x8006, 0x8006, 0x8007, 0x90bc,
+	0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0xaacc, 0xabd0, 0xacd4,
+	0xadd8, 0x2031, 0x0000, 0x2041, 0x1298, 0x080c, 0xb112, 0x0160,
+	0x000e, 0x9005, 0x0120, 0x00fe, 0x009e, 0x00de, 0x0005, 0x00fe,
+	0x009e, 0x00de, 0x0804, 0xabed, 0x2001, 0x002c, 0x900e, 0x080c,
+	0xafb8, 0x0c70, 0x91b6, 0x0015, 0x0170, 0x91b6, 0x0016, 0x0158,
+	0x91b2, 0x0047, 0x0a0c, 0x0d7d, 0x91b2, 0x0050, 0x1a0c, 0x0d7d,
+	0x9182, 0x0047, 0x0042, 0x080c, 0xaaa8, 0x0120, 0x9086, 0x0002,
+	0x0904, 0xad53, 0x0005, 0xae14, 0xae14, 0xae16, 0xae48, 0xae14,
+	0xae14, 0xae14, 0xae14, 0xae5b, 0x080c, 0x0d7d, 0x00d6, 0x0016,
+	0x0096, 0x6003, 0x0004, 0x6114, 0x2148, 0xa87c, 0xd0fc, 0x01c0,
+	0xa878, 0xc0fc, 0x9005, 0x1158, 0xa894, 0x9005, 0x0140, 0x2001,
+	0x0000, 0x900e, 0x080c, 0xafb8, 0x080c, 0xabed, 0x00a8, 0x6003,
+	0x0002, 0xa8a4, 0xa9a8, 0x9105, 0x1178, 0xa8ae, 0xa8b2, 0x0c78,
+	0xa87f, 0x0020, 0xa88c, 0xa88a, 0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2,
+	0xa8c7, 0x0000, 0xa8cb, 0x0000, 0x009e, 0x001e, 0x00de, 0x0005,
+	0x080c, 0x963b, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xc838,
+	0x0120, 0xa87b, 0x0006, 0x080c, 0x6d80, 0x009e, 0x00de, 0x080c,
+	0xabed, 0x0804, 0x96a0, 0x080c, 0x963b, 0x080c, 0x31e7, 0x080c,
+	0xcf67, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xc838, 0x0120,
+	0xa87b, 0x0029, 0x080c, 0x6d80, 0x009e, 0x00de, 0x080c, 0xabed,
+	0x0804, 0x96a0, 0x9182, 0x0047, 0x0002, 0xae82, 0xae84, 0xae82,
+	0xae82, 0xae82, 0xae82, 0xae82, 0xae82, 0xae82, 0xae82, 0xae82,
+	0xae82, 0xae84, 0x080c, 0x0d7d, 0x00d6, 0x0096, 0x601f, 0x0000,
+	0x6114, 0x2148, 0xa87b, 0x0000, 0xa883, 0x0000, 0x080c, 0x6d80,
+	0x009e, 0x00de, 0x0804, 0xabed, 0x0026, 0x0036, 0x0056, 0x0066,
+	0x0096, 0x00a6, 0x00f6, 0x0006, 0x080c, 0x103a, 0x000e, 0x090c,
+	0x0d7d, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e,
+	0x20a9, 0x0020, 0x4104, 0xa87a, 0x2079, 0x1800, 0x7990, 0x9188,
+	0x0018, 0x918c, 0x0fff, 0xa972, 0xac76, 0x2950, 0x00a6, 0x2001,
+	0x0205, 0x2003, 0x0000, 0x901e, 0x2029, 0x0001, 0x9182, 0x0034,
+	0x1228, 0x2011, 0x001f, 0x080c, 0xc40b, 0x04c0, 0x2130, 0x2009,
+	0x0034, 0x2011, 0x001f, 0x080c, 0xc40b, 0x96b2, 0x0034, 0xb004,
+	0x904d, 0x0110, 0x080c, 0x0fec, 0x080c, 0x103a, 0x01d0, 0x8528,
+	0xa867, 0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d,
+	0x1230, 0x2608, 0x2011, 0x001b, 0x080c, 0xc40b, 0x00b8, 0x96b2,
+	0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x080c, 0xc40b,
+	0x0c18, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
+	0x0050, 0xb566, 0xb070, 0xc0fd, 0xb072, 0x0048, 0x2001, 0x0205,
+	0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0x2a48,
+	0xa804, 0xa807, 0x0000, 0x0006, 0x080c, 0x6d80, 0x000e, 0x2048,
+	0x9005, 0x1db0, 0x00fe, 0x00ae, 0x009e, 0x006e, 0x005e, 0x003e,
+	0x002e, 0x0005, 0x00d6, 0x00f6, 0x0096, 0x0006, 0x080c, 0x103a,
+	0x000e, 0x090c, 0x0d7d, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019,
+	0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104, 0xaa66, 0xa87a, 0x2079,
+	0x1800, 0x7990, 0x810c, 0x9188, 0x000c, 0x9182, 0x001a, 0x0210,
+	0x2009, 0x001a, 0x21a8, 0x810b, 0xa972, 0xac76, 0x2e98, 0xa85c,
+	0x9080, 0x001f, 0x20a0, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080,
+	0x2102, 0x4003, 0x2003, 0x0000, 0x080c, 0x6d80, 0x009e, 0x00fe,
+	0x00de, 0x0005, 0x0016, 0x00d6, 0x00f6, 0x0096, 0x0016, 0x2001,
+	0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x001e, 0x2079, 0x0200,
+	0x2e98, 0xa87c, 0xd0ec, 0x0118, 0x9e80, 0x000c, 0x2098, 0x2021,
+	0x003e, 0x901e, 0x9282, 0x0020, 0x0218, 0x2011, 0x0020, 0x2018,
+	0x9486, 0x003e, 0x1170, 0x0096, 0x080c, 0x103a, 0x2900, 0x009e,
+	0x05c0, 0xa806, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
+	0x20a0, 0x3300, 0x908e, 0x0260, 0x0140, 0x2009, 0x0280, 0x9102,
+	0x920a, 0x0218, 0x2010, 0x2100, 0x9318, 0x2200, 0x9402, 0x1228,
+	0x2400, 0x9202, 0x2410, 0x9318, 0x9006, 0x2020, 0x22a8, 0xa800,
+	0x9200, 0xa802, 0x20e1, 0x0000, 0x4003, 0x83ff, 0x0180, 0x3300,
+	0x9086, 0x0280, 0x1130, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816,
+	0x2e98, 0x2310, 0x84ff, 0x0904, 0xaf67, 0x0804, 0xaf69, 0x9085,
+	0x0001, 0x7817, 0x0000, 0x009e, 0x00fe, 0x00de, 0x001e, 0x0005,
+	0x00d6, 0x0036, 0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x080c,
+	0x6d74, 0x009e, 0x003e, 0x00de, 0x0005, 0x91b6, 0x0015, 0x1118,
+	0x080c, 0xabed, 0x0030, 0x91b6, 0x0016, 0x190c, 0x0d7d, 0x080c,
+	0xabed, 0x0005, 0x20a9, 0x000e, 0x20e1, 0x0000, 0x2e98, 0x6014,
+	0x0096, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x20a0, 0x009e, 0x4003,
+	0x0136, 0x9080, 0x001b, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418,
+	0x8318, 0x23a0, 0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8,
+	0x2011, 0x0006, 0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003,
+	0x3418, 0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xc838,
+	0x0130, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e,
+	0x0804, 0xabed, 0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200,
+	0x11a8, 0x6010, 0x00b6, 0x2058, 0xb8d7, 0x0000, 0x00be, 0x6014,
+	0x9005, 0x0130, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32,
+	0x080c, 0xabed, 0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48,
+	0x0cc8, 0x0006, 0x0016, 0x080c, 0xcf52, 0x0188, 0x6014, 0x9005,
+	0x1170, 0x600b, 0x0003, 0x601b, 0x0000, 0x604b, 0x0000, 0x2009,
+	0x0022, 0x080c, 0xb3f9, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085,
+	0x0001, 0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c,
+	0x20e1, 0x0000, 0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001,
+	0x2099, 0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804,
 	0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003,
-	0x2001, 0x0205, 0x2003, 0x0001, 0x2099, 0x0260, 0x20a9, 0x0016,
-	0x4003, 0x20a9, 0x000a, 0xa804, 0x2048, 0xa860, 0x20e8, 0xa85c,
-	0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0002,
-	0x2099, 0x0260, 0x20a9, 0x0020, 0x4003, 0x2003, 0x0000, 0x6014,
-	0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x080c, 0xabc9, 0x001e,
-	0x009e, 0x0005, 0x0096, 0x0016, 0x900e, 0x7030, 0x9086, 0x0100,
-	0x0140, 0x7038, 0x9084, 0x00ff, 0x800c, 0x703c, 0x9084, 0x00ff,
-	0x8004, 0x9080, 0x0004, 0x9108, 0x810b, 0x2011, 0x0002, 0x2019,
-	0x000c, 0x6014, 0x2048, 0x080c, 0xc3e7, 0x080c, 0xc814, 0x0140,
-	0x6014, 0x2048, 0xa807, 0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103,
-	0x080c, 0xabc9, 0x001e, 0x009e, 0x0005, 0x0016, 0x2009, 0x0000,
-	0x7030, 0x9086, 0x0200, 0x0110, 0x2009, 0x0001, 0x0096, 0x6014,
-	0x904d, 0x090c, 0x0d7d, 0xa97a, 0x080c, 0x6d70, 0x009e, 0x080c,
-	0xabc9, 0x001e, 0x0005, 0x0016, 0x0096, 0x7030, 0x9086, 0x0100,
-	0x1118, 0x2009, 0x0004, 0x0010, 0x7034, 0x800c, 0x810b, 0x2011,
-	0x000c, 0x2019, 0x000c, 0x6014, 0x2048, 0xa804, 0x0096, 0x9005,
-	0x0108, 0x2048, 0x080c, 0xc3e7, 0x009e, 0x080c, 0xc814, 0x0148,
-	0xa804, 0x9005, 0x1158, 0xa807, 0x0000, 0xa864, 0xa8e2, 0xa867,
-	0x0103, 0x080c, 0xabc9, 0x009e, 0x001e, 0x0005, 0x0086, 0x2040,
-	0xa030, 0x8007, 0x9086, 0x0100, 0x1118, 0x080c, 0xb591, 0x00e0,
-	0xa034, 0x8007, 0x800c, 0x8806, 0x8006, 0x8007, 0x90bc, 0x003f,
-	0x9084, 0xffc0, 0x9080, 0x000c, 0xa87b, 0x0000, 0xa883, 0x0000,
-	0xa897, 0x4000, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000,
-	0x2041, 0x127e, 0x0019, 0x0d08, 0x008e, 0x0898, 0x0096, 0x0006,
-	0x080c, 0x103a, 0x000e, 0x01b0, 0xa8ab, 0x0dcb, 0xa876, 0x000e,
-	0xa8a2, 0x0006, 0xae6a, 0x2800, 0xa89e, 0xa97a, 0xaf72, 0xaa8e,
-	0xab92, 0xac96, 0xad9a, 0x0086, 0x2940, 0x080c, 0x1124, 0x008e,
-	0x9085, 0x0001, 0x009e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008,
-	0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206,
-	0x1520, 0x700c, 0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206,
-	0x11e0, 0x604b, 0x0000, 0x2c68, 0x0016, 0x2009, 0x0035, 0x080c,
-	0xcea6, 0x001e, 0x1158, 0x622c, 0x2268, 0x2071, 0x026c, 0x6b20,
-	0x9386, 0x0003, 0x0130, 0x9386, 0x0006, 0x0128, 0x080c, 0xabc9,
-	0x0020, 0x0039, 0x0010, 0x080c, 0xb20a, 0x002e, 0x00de, 0x00ee,
-	0x0005, 0x0096, 0x6814, 0x2048, 0x9186, 0x0015, 0x0904, 0xb1e9,
-	0x918e, 0x0016, 0x1904, 0xb208, 0x700c, 0x908c, 0xff00, 0x9186,
-	0x1700, 0x0120, 0x9186, 0x0300, 0x1904, 0xb1c3, 0x89ff, 0x1138,
-	0x6800, 0x9086, 0x000f, 0x0904, 0xb1a5, 0x0804, 0xb206, 0x6808,
-	0x9086, 0xffff, 0x1904, 0xb1eb, 0xa87c, 0x9084, 0x0060, 0x9086,
-	0x0020, 0x1128, 0xa83c, 0xa940, 0x9105, 0x1904, 0xb1eb, 0x6824,
-	0xd0b4, 0x1904, 0xb1eb, 0x080c, 0xca03, 0x6864, 0xa882, 0xa87c,
-	0xc0dc, 0xc0f4, 0xc0d4, 0xa87e, 0x0026, 0x900e, 0x6a18, 0x2001,
-	0x000a, 0x080c, 0x9135, 0xa884, 0x920a, 0x0208, 0x8011, 0xaa86,
-	0x82ff, 0x002e, 0x1138, 0x00c6, 0x2d60, 0x080c, 0xc53a, 0x00ce,
-	0x0804, 0xb206, 0x00c6, 0xa868, 0xd0fc, 0x1118, 0x080c, 0x60b4,
-	0x0010, 0x080c, 0x64b8, 0x00ce, 0x1904, 0xb1eb, 0x00c6, 0x2d60,
-	0x080c, 0xabc9, 0x00ce, 0x0804, 0xb206, 0x00c6, 0x080c, 0xac3b,
-	0x0198, 0x6017, 0x0000, 0x6810, 0x6012, 0x080c, 0xcca8, 0x6023,
-	0x0003, 0x6904, 0x00c6, 0x2d60, 0x080c, 0xabc9, 0x00ce, 0x080c,
-	0xac68, 0x00ce, 0x0804, 0xb206, 0x2001, 0x1988, 0x2004, 0x684a,
-	0x00ce, 0x0804, 0xb206, 0x7008, 0x9086, 0x000b, 0x11c8, 0x6010,
-	0x00b6, 0x2058, 0xb900, 0xc1bc, 0xb902, 0x00be, 0x00c6, 0x2d60,
-	0xa87b, 0x0003, 0x080c, 0xcee8, 0x6007, 0x0085, 0x6003, 0x000b,
-	0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x91ed, 0x00ce, 0x0430,
-	0x700c, 0x9086, 0x2a00, 0x1138, 0x2001, 0x1988, 0x2004, 0x684a,
-	0x00e8, 0x04c1, 0x00e8, 0x89ff, 0x090c, 0x0d7d, 0x00c6, 0x00d6,
-	0x2d60, 0xa867, 0x0103, 0xa87b, 0x0003, 0x080c, 0x6b86, 0x080c,
-	0xca03, 0x080c, 0xac04, 0x0026, 0x6010, 0x00b6, 0x2058, 0xba3c,
-	0x080c, 0x6749, 0x00be, 0x002e, 0x00de, 0x00ce, 0x080c, 0xabc9,
-	0x009e, 0x0005, 0x9186, 0x0015, 0x1128, 0x2001, 0x1988, 0x2004,
-	0x684a, 0x0068, 0x918e, 0x0016, 0x1160, 0x00c6, 0x2d00, 0x2060,
-	0x080c, 0xe4f9, 0x080c, 0x8890, 0x080c, 0xabc9, 0x00ce, 0x080c,
-	0xabc9, 0x0005, 0x0026, 0x0036, 0x0046, 0x7228, 0xacb0, 0xabac,
-	0xd2f4, 0x0130, 0x2001, 0x1988, 0x2004, 0x684a, 0x0804, 0xb284,
-	0x00c6, 0x2d60, 0x080c, 0xc412, 0x00ce, 0x6804, 0x9086, 0x0050,
-	0x1168, 0x00c6, 0x2d00, 0x2060, 0x6003, 0x0001, 0x6007, 0x0050,
-	0x2009, 0x8023, 0x080c, 0x91ed, 0x00ce, 0x04f0, 0x6800, 0x9086,
-	0x000f, 0x01a8, 0x89ff, 0x090c, 0x0d7d, 0x6800, 0x9086, 0x0004,
-	0x1190, 0xa87c, 0xd0ac, 0x0178, 0xa843, 0x0fff, 0xa83f, 0x0fff,
-	0xa880, 0xc0fc, 0xa882, 0x2001, 0x0001, 0x6832, 0x0400, 0x2001,
-	0x0007, 0x6832, 0x00e0, 0xa87c, 0xd0b4, 0x1150, 0xd0ac, 0x0db8,
-	0x6824, 0xd0f4, 0x1d48, 0xa838, 0xa934, 0x9105, 0x0d80, 0x0c20,
-	0xd2ec, 0x1d68, 0x7024, 0x9306, 0x1118, 0x7020, 0x9406, 0x0d38,
-	0x7020, 0x683e, 0x7024, 0x683a, 0x2001, 0x0005, 0x6832, 0x080c,
-	0xcb92, 0x080c, 0x966f, 0x0010, 0x080c, 0xabc9, 0x004e, 0x003e,
-	0x002e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff,
-	0x6210, 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1904, 0xb2ef,
-	0x700c, 0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x1904,
-	0xb2ef, 0x6038, 0x2068, 0x6824, 0xc0dc, 0x6826, 0x6a20, 0x9286,
-	0x0007, 0x0904, 0xb2ef, 0x9286, 0x0002, 0x0904, 0xb2ef, 0x9286,
-	0x0000, 0x05e8, 0x6808, 0x633c, 0x9306, 0x15c8, 0x2071, 0x026c,
-	0x9186, 0x0015, 0x0570, 0x918e, 0x0016, 0x1100, 0x00c6, 0x6038,
-	0x2060, 0x6104, 0x9186, 0x004b, 0x01c0, 0x9186, 0x004c, 0x01a8,
-	0x9186, 0x004d, 0x0190, 0x9186, 0x004e, 0x0178, 0x9186, 0x0052,
-	0x0160, 0x6014, 0x0096, 0x2048, 0x080c, 0xc814, 0x090c, 0x0d7d,
-	0xa87b, 0x0003, 0x009e, 0x080c, 0xcee8, 0x6007, 0x0085, 0x6003,
-	0x000b, 0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x91ed, 0x00ce,
-	0x0030, 0x6038, 0x2070, 0x2001, 0x1988, 0x2004, 0x704a, 0x080c,
-	0xabc9, 0x002e, 0x00de, 0x00ee, 0x0005, 0x00b6, 0x0096, 0x00f6,
-	0x6014, 0x2048, 0x6010, 0x2058, 0x91b6, 0x0015, 0x0130, 0xba08,
-	0xbb0c, 0xbc00, 0xc48c, 0xbc02, 0x0460, 0x0096, 0x0156, 0x0036,
-	0x0026, 0x2b48, 0x9e90, 0x0010, 0x2019, 0x000a, 0x20a9, 0x0004,
-	0x080c, 0xbb9e, 0x002e, 0x003e, 0x015e, 0x009e, 0x1904, 0xb35e,
-	0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0014, 0x2019,
-	0x0006, 0x20a9, 0x0004, 0x080c, 0xbb9e, 0x002e, 0x003e, 0x015e,
-	0x009e, 0x15a0, 0x7238, 0xba0a, 0x733c, 0xbb0e, 0xbc00, 0xc48d,
-	0xbc02, 0xa804, 0x9005, 0x1128, 0x00fe, 0x009e, 0x00be, 0x0804,
-	0xafd9, 0x0096, 0x2048, 0xaa12, 0xab16, 0xac0a, 0x009e, 0x8006,
-	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
-	0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000,
-	0x2041, 0x127e, 0x080c, 0xb0ee, 0x0130, 0x00fe, 0x009e, 0x080c,
-	0xabc9, 0x00be, 0x0005, 0x080c, 0xb591, 0x0cb8, 0x2b78, 0x00f6,
-	0x080c, 0x31e4, 0x080c, 0xcf43, 0x00fe, 0x00c6, 0x080c, 0xab73,
-	0x2f00, 0x6012, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001,
-	0x6003, 0x0001, 0x2001, 0x0007, 0x080c, 0x656e, 0x080c, 0x659a,
-	0x080c, 0x91f4, 0x080c, 0x966f, 0x00ce, 0x0804, 0xb331, 0x2100,
-	0x91b2, 0x0053, 0x1a0c, 0x0d7d, 0x91b2, 0x0040, 0x1a04, 0xb3e7,
-	0x0002, 0xb3d5, 0xb3d5, 0xb3cb, 0xb3d5, 0xb3d5, 0xb3d5, 0xb3c9,
-	0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9,
-	0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9,
-	0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9,
-	0xb3d5, 0xb3c9, 0xb3d5, 0xb3d5, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9,
-	0xb3c9, 0xb3cb, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9,
-	0xb3c9, 0xb3c9, 0xb3c9, 0xb3d5, 0xb3d5, 0xb3c9, 0xb3c9, 0xb3c9,
-	0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3c9, 0xb3d5, 0xb3c9,
-	0xb3c9, 0x080c, 0x0d7d, 0x0066, 0x00b6, 0x6610, 0x2658, 0xb8d4,
-	0xc08c, 0xb8d6, 0x00be, 0x006e, 0x0000, 0x6003, 0x0001, 0x6106,
-	0x9186, 0x0032, 0x0118, 0x080c, 0x91f4, 0x0010, 0x080c, 0x91ed,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x966f, 0x012e, 0x0005, 0x2600,
-	0x0002, 0xb3d5, 0xb3d5, 0xb3fb, 0xb3d5, 0xb3d5, 0xb3fb, 0xb3fb,
-	0xb3fb, 0xb3fb, 0xb3d5, 0xb3fb, 0xb3d5, 0xb3fb, 0xb3d5, 0xb3fb,
-	0xb3fb, 0xb3fb, 0xb3fb, 0x080c, 0x0d7d, 0x6004, 0x90b2, 0x0053,
-	0x1a0c, 0x0d7d, 0x91b6, 0x0013, 0x0904, 0xb4d2, 0x91b6, 0x0027,
-	0x1904, 0xb47e, 0x080c, 0x95ad, 0x6004, 0x080c, 0xca18, 0x01b0,
-	0x080c, 0xca29, 0x01a8, 0x908e, 0x0021, 0x0904, 0xb47b, 0x908e,
-	0x0022, 0x1130, 0x080c, 0xb005, 0x0904, 0xb477, 0x0804, 0xb478,
-	0x908e, 0x003d, 0x0904, 0xb47b, 0x0804, 0xb471, 0x080c, 0x3215,
-	0x2001, 0x0007, 0x080c, 0x656e, 0x6010, 0x00b6, 0x2058, 0xb9a0,
-	0x00be, 0x080c, 0xb591, 0x9186, 0x007e, 0x1148, 0x2001, 0x1837,
-	0x2014, 0xc285, 0x080c, 0x74d5, 0x1108, 0xc2ad, 0x2202, 0x080c,
-	0xa872, 0x0036, 0x0026, 0x2019, 0x0028, 0x2110, 0x080c, 0xe605,
-	0x002e, 0x003e, 0x0016, 0x0026, 0x0036, 0x2110, 0x2019, 0x0028,
-	0x080c, 0x9374, 0x0076, 0x903e, 0x080c, 0x9246, 0x6010, 0x00b6,
-	0x905d, 0x0100, 0x00be, 0x2c08, 0x080c, 0xdfc0, 0x007e, 0x003e,
-	0x002e, 0x001e, 0x080c, 0xa88e, 0x080c, 0xcf43, 0x0016, 0x080c,
-	0xcca0, 0x080c, 0xabc9, 0x001e, 0x080c, 0x32f5, 0x080c, 0x966f,
-	0x0030, 0x080c, 0xcca0, 0x080c, 0xabc9, 0x080c, 0x966f, 0x0005,
-	0x080c, 0xb591, 0x0cb0, 0x080c, 0xb5cd, 0x0c98, 0x9186, 0x0015,
-	0x0118, 0x9186, 0x0016, 0x1140, 0x080c, 0xaa84, 0x0d80, 0x9086,
-	0x0002, 0x0904, 0xb5d8, 0x0c58, 0x9186, 0x0014, 0x1d40, 0x080c,
-	0x95ad, 0x6004, 0x908e, 0x0022, 0x1118, 0x080c, 0xb005, 0x09f8,
-	0x080c, 0x31e4, 0x080c, 0xcf43, 0x080c, 0xca18, 0x1190, 0x080c,
-	0x3215, 0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xb591,
-	0x9186, 0x007e, 0x1128, 0x2001, 0x1837, 0x200c, 0xc185, 0x2102,
-	0x0800, 0x080c, 0xca29, 0x1120, 0x080c, 0xb591, 0x0804, 0xb471,
-	0x6004, 0x908e, 0x0032, 0x1160, 0x00e6, 0x00f6, 0x2071, 0x189e,
-	0x2079, 0x0000, 0x080c, 0x359e, 0x00fe, 0x00ee, 0x0804, 0xb471,
-	0x6004, 0x908e, 0x0021, 0x0d40, 0x908e, 0x0022, 0x090c, 0xb591,
-	0x0804, 0xb471, 0x90b2, 0x0040, 0x1a04, 0xb571, 0x2008, 0x0002,
-	0xb51a, 0xb51b, 0xb51e, 0xb521, 0xb524, 0xb527, 0xb518, 0xb518,
-	0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518,
-	0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518,
-	0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb52a, 0xb533,
-	0xb518, 0xb534, 0xb533, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518,
-	0xb533, 0xb533, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518, 0xb518,
-	0xb518, 0xb518, 0xb55c, 0xb533, 0xb518, 0xb52f, 0xb518, 0xb518,
-	0xb518, 0xb530, 0xb518, 0xb518, 0xb518, 0xb533, 0xb557, 0xb518,
-	0x080c, 0x0d7d, 0x00c0, 0x2001, 0x000b, 0x00e8, 0x2001, 0x0003,
-	0x00d0, 0x2001, 0x0005, 0x00b8, 0x2001, 0x0001, 0x00a0, 0x2001,
-	0x0009, 0x0088, 0x6003, 0x0005, 0x080c, 0x966f, 0x0058, 0x0018,
-	0x0010, 0x080c, 0x656e, 0x04b8, 0x080c, 0xcf46, 0x6003, 0x0004,
-	0x080c, 0x966f, 0x0005, 0x080c, 0x656e, 0x6003, 0x0002, 0x0036,
-	0x2019, 0x1852, 0x2304, 0x9084, 0xff00, 0x1120, 0x2001, 0x1986,
-	0x201c, 0x0040, 0x8007, 0x909a, 0x0004, 0x0ec0, 0x8003, 0x801b,
-	0x831b, 0x9318, 0x631a, 0x003e, 0x080c, 0x966f, 0x0c18, 0x080c,
-	0xcca0, 0x080c, 0xabc9, 0x08f0, 0x00e6, 0x00f6, 0x2071, 0x189e,
-	0x2079, 0x0000, 0x080c, 0x359e, 0x00fe, 0x00ee, 0x080c, 0x95ad,
-	0x080c, 0xabc9, 0x0878, 0x6003, 0x0002, 0x080c, 0xcf46, 0x0804,
-	0x966f, 0x2600, 0x2008, 0x0002, 0xb588, 0xb56b, 0xb586, 0xb56b,
-	0xb56b, 0xb586, 0xb586, 0xb586, 0xb586, 0xb56b, 0xb586, 0xb56b,
-	0xb586, 0xb56b, 0xb586, 0xb586, 0xb586, 0xb586, 0x080c, 0x0d7d,
-	0x0096, 0x6014, 0x2048, 0x080c, 0x6d70, 0x009e, 0x080c, 0xabc9,
-	0x0005, 0x00e6, 0x0096, 0x0026, 0x0016, 0x080c, 0xc814, 0x0568,
-	0x6014, 0x2048, 0xa864, 0x9086, 0x0139, 0x11a8, 0xa894, 0x9086,
-	0x0056, 0x1148, 0x080c, 0x5474, 0x0130, 0x2001, 0x0000, 0x900e,
-	0x2011, 0x4000, 0x0028, 0x2001, 0x0030, 0x900e, 0x2011, 0x4005,
-	0x080c, 0xce0d, 0x0090, 0xa868, 0xd0fc, 0x0178, 0xa807, 0x0000,
-	0x0016, 0x6004, 0x908e, 0x0021, 0x0168, 0x908e, 0x003d, 0x0150,
-	0x001e, 0xa867, 0x0103, 0xa833, 0x0100, 0x001e, 0x002e, 0x009e,
-	0x00ee, 0x0005, 0x001e, 0x0009, 0x0cc0, 0x0096, 0x6014, 0x2048,
-	0xa800, 0x2048, 0xa867, 0x0103, 0xa823, 0x8001, 0x009e, 0x0005,
-	0x00b6, 0x6610, 0x2658, 0xb804, 0x9084, 0x00ff, 0x90b2, 0x000c,
-	0x1a0c, 0x0d7d, 0x6604, 0x96b6, 0x004d, 0x1120, 0x080c, 0xcd2c,
-	0x0804, 0xb65d, 0x6604, 0x96b6, 0x0043, 0x1120, 0x080c, 0xcd75,
-	0x0804, 0xb65d, 0x6604, 0x96b6, 0x004b, 0x1120, 0x080c, 0xcda1,
-	0x0804, 0xb65d, 0x6604, 0x96b6, 0x0033, 0x1120, 0x080c, 0xccc2,
-	0x0804, 0xb65d, 0x6604, 0x96b6, 0x0028, 0x1120, 0x080c, 0xca62,
-	0x0804, 0xb65d, 0x6604, 0x96b6, 0x0029, 0x1120, 0x080c, 0xcaa3,
-	0x0804, 0xb65d, 0x6604, 0x96b6, 0x001f, 0x1120, 0x080c, 0xafae,
-	0x0804, 0xb65d, 0x6604, 0x96b6, 0x0000, 0x1118, 0x080c, 0xb2f5,
-	0x04e0, 0x6604, 0x96b6, 0x0022, 0x1118, 0x080c, 0xafe6, 0x04a8,
-	0x6604, 0x96b6, 0x0035, 0x1118, 0x080c, 0xb10c, 0x0470, 0x6604,
-	0x96b6, 0x0039, 0x1118, 0x080c, 0xb28a, 0x0438, 0x6604, 0x96b6,
-	0x003d, 0x1118, 0x080c, 0xb01e, 0x0400, 0x6604, 0x96b6, 0x0044,
-	0x1118, 0x080c, 0xb05a, 0x00c8, 0x6604, 0x96b6, 0x0049, 0x1118,
-	0x080c, 0xb09b, 0x0090, 0x6604, 0x96b6, 0x0041, 0x1118, 0x080c,
-	0xb085, 0x0058, 0x91b6, 0x0015, 0x1110, 0x0063, 0x0030, 0x91b6,
-	0x0016, 0x1128, 0x00be, 0x0804, 0xb8b7, 0x00be, 0x0005, 0x080c,
-	0xac85, 0x0cd8, 0xb67a, 0xb67d, 0xb67a, 0xb6c4, 0xb67a, 0xb82b,
-	0xb8c4, 0xb67a, 0xb67a, 0xb88d, 0xb67a, 0xb8a3, 0x0096, 0x601f,
-	0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x009e,
-	0x0804, 0xabc9, 0xa001, 0xa001, 0x0005, 0x00e6, 0x2071, 0x1800,
-	0x7090, 0x9086, 0x0074, 0x1540, 0x080c, 0xdf91, 0x11b0, 0x6010,
-	0x00b6, 0x2058, 0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc, 0x0110,
-	0xc0c5, 0xb802, 0x00f9, 0x00be, 0x2001, 0x0006, 0x080c, 0x656e,
-	0x080c, 0x3215, 0x080c, 0xabc9, 0x0098, 0x2001, 0x000a, 0x080c,
-	0x656e, 0x080c, 0x3215, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
-	0x91f4, 0x080c, 0x966f, 0x0020, 0x2001, 0x0001, 0x080c, 0xb7fb,
-	0x00ee, 0x0005, 0x00d6, 0xb800, 0xd084, 0x0160, 0x9006, 0x080c,
-	0x655a, 0x2069, 0x1847, 0x6804, 0xd0a4, 0x0120, 0x2001, 0x0006,
-	0x080c, 0x659a, 0x00de, 0x0005, 0x00b6, 0x0096, 0x00d6, 0x2011,
-	0x1824, 0x2204, 0x9086, 0x0074, 0x1904, 0xb7d2, 0x6010, 0x2058,
-	0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c, 0xba11, 0x0804, 0xb736,
-	0x080c, 0xba06, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510,
-	0x6014, 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086,
-	0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c,
-	0xce0d, 0x0030, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
-	0x2001, 0x0006, 0x080c, 0x656e, 0x080c, 0x3215, 0x080c, 0xabc9,
-	0x0804, 0xb7d5, 0x080c, 0xb7e3, 0x6014, 0x9005, 0x0190, 0x2048,
-	0xa868, 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-	0x1d08, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xce0d,
-	0x08f8, 0x080c, 0xb7d9, 0x0160, 0x9006, 0x080c, 0x655a, 0x2001,
-	0x0004, 0x080c, 0x659a, 0x2001, 0x0007, 0x080c, 0x656e, 0x08a0,
-	0x2001, 0x0004, 0x080c, 0x656e, 0x6003, 0x0001, 0x6007, 0x0003,
-	0x080c, 0x91f4, 0x080c, 0x966f, 0x0804, 0xb7d5, 0xb85c, 0xd0e4,
-	0x01d8, 0x080c, 0xcc3a, 0x080c, 0x74d5, 0x0118, 0xd0dc, 0x1904,
-	0xb6f8, 0x2011, 0x1837, 0x2204, 0xc0ad, 0x2012, 0x2001, 0x196d,
-	0x2004, 0x00f6, 0x2079, 0x0100, 0x78e3, 0x0000, 0x080c, 0x266f,
-	0x78e2, 0x00fe, 0x0804, 0xb6f8, 0x080c, 0xcc7b, 0x2011, 0x1837,
-	0x2204, 0xc0a5, 0x2012, 0x0006, 0x080c, 0xe121, 0x000e, 0x1904,
-	0xb6f8, 0xc0b5, 0x2012, 0x2001, 0x0006, 0x080c, 0x656e, 0x9006,
-	0x080c, 0x655a, 0x00c6, 0x2001, 0x180f, 0x2004, 0xd09c, 0x0520,
-	0x00f6, 0x2079, 0x0100, 0x00e6, 0x2071, 0x1800, 0x700c, 0x9084,
-	0x00ff, 0x78e6, 0x707e, 0x7010, 0x78ea, 0x7082, 0x908c, 0x00ff,
-	0x00ee, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x2644, 0x00f6,
-	0x2100, 0x900e, 0x080c, 0x25fb, 0x795e, 0x00fe, 0x9186, 0x0081,
-	0x01d8, 0x2009, 0x0081, 0x00c8, 0x2009, 0x00ef, 0x00f6, 0x2079,
-	0x0100, 0x79ea, 0x7932, 0x7936, 0x780c, 0xc0b5, 0x780e, 0x00fe,
-	0x080c, 0x2644, 0x00f6, 0x2079, 0x1800, 0x7982, 0x2100, 0x900e,
-	0x080c, 0x25fb, 0x795e, 0x00fe, 0x8108, 0x080c, 0x65bd, 0x2b00,
-	0x00ce, 0x1904, 0xb6f8, 0x6012, 0x2009, 0x180f, 0x210c, 0xd19c,
-	0x0150, 0x2009, 0x027c, 0x210c, 0x918c, 0x00ff, 0xb912, 0x2009,
-	0x027d, 0x210c, 0xb916, 0x2001, 0x0002, 0x080c, 0x656e, 0x6023,
-	0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x91f4, 0x080c,
-	0x966f, 0x0018, 0x2001, 0x0001, 0x0431, 0x00de, 0x009e, 0x00be,
-	0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4, 0x0120, 0x2001, 0x1848,
-	0x2004, 0xd0ac, 0x0005, 0x00e6, 0x080c, 0xe65e, 0x0190, 0x2071,
-	0x0260, 0x7108, 0x720c, 0x918c, 0x00ff, 0x1118, 0x9284, 0xff00,
-	0x0140, 0x6010, 0x2058, 0xb8a0, 0x9084, 0xff80, 0x1110, 0xb912,
-	0xba16, 0x00ee, 0x0005, 0x2030, 0x9005, 0x0158, 0x2001, 0x0007,
-	0x080c, 0x656e, 0x080c, 0x56e7, 0x1120, 0x2001, 0x0007, 0x080c,
-	0x659a, 0x2600, 0x9005, 0x11b0, 0x6014, 0x0096, 0x2048, 0xa868,
-	0x009e, 0xd0fc, 0x1178, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058,
-	0xbba0, 0x00be, 0x2021, 0x0004, 0x2011, 0x8014, 0x080c, 0x4b00,
-	0x004e, 0x003e, 0x080c, 0x3215, 0x6020, 0x9086, 0x000a, 0x1108,
-	0x0005, 0x0804, 0xabc9, 0x00b6, 0x00e6, 0x0026, 0x0016, 0x2071,
-	0x1800, 0x7090, 0x9086, 0x0014, 0x1904, 0xb883, 0x080c, 0x56e7,
-	0x1170, 0x6014, 0x9005, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058,
-	0xbba0, 0x2021, 0x0006, 0x080c, 0x4cb7, 0x004e, 0x003e, 0x00d6,
-	0x6010, 0x2058, 0x080c, 0x66b9, 0x080c, 0xb6b2, 0x00de, 0x080c,
-	0xbad7, 0x1588, 0x6010, 0x2058, 0xb890, 0x9005, 0x0560, 0x2001,
-	0x0006, 0x080c, 0x656e, 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864,
-	0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e,
-	0x2011, 0x4000, 0x080c, 0xce0d, 0x0060, 0xa864, 0x9084, 0x00ff,
-	0x9086, 0x0029, 0x0130, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-	0x0200, 0x009e, 0x080c, 0x3215, 0x6020, 0x9086, 0x000a, 0x0140,
-	0x080c, 0xabc9, 0x0028, 0x080c, 0xb591, 0x9006, 0x080c, 0xb7fb,
-	0x001e, 0x002e, 0x00ee, 0x00be, 0x0005, 0x2011, 0x1824, 0x2204,
-	0x9086, 0x0014, 0x1160, 0x2001, 0x0002, 0x080c, 0x656e, 0x6003,
-	0x0001, 0x6007, 0x0001, 0x080c, 0x91f4, 0x0804, 0x966f, 0x2001,
-	0x0001, 0x0804, 0xb7fb, 0x2030, 0x2011, 0x1824, 0x2204, 0x9086,
-	0x0004, 0x1148, 0x96b6, 0x000b, 0x1120, 0x2001, 0x0007, 0x080c,
-	0x656e, 0x0804, 0xabc9, 0x2001, 0x0001, 0x0804, 0xb7fb, 0x0002,
-	0xb67a, 0xb8cf, 0xb67a, 0xb910, 0xb67a, 0xb9bd, 0xb8c4, 0xb67a,
-	0xb67a, 0xb9d1, 0xb67a, 0xb9e3, 0x6604, 0x9686, 0x0003, 0x0904,
-	0xb82b, 0x96b6, 0x001e, 0x1110, 0x080c, 0xabc9, 0x0005, 0x00b6,
-	0x00d6, 0x00c6, 0x080c, 0xb9f5, 0x11a0, 0x9006, 0x080c, 0x655a,
-	0x080c, 0x31e4, 0x080c, 0xcf43, 0x2001, 0x0002, 0x080c, 0x656e,
-	0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x91f4, 0x080c, 0x966f,
-	0x0418, 0x2009, 0x026e, 0x2104, 0x9086, 0x0009, 0x1160, 0x6010,
-	0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0170, 0x8001, 0xb842,
-	0x601b, 0x000a, 0x0088, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00,
-	0x9086, 0x1900, 0x1108, 0x08a0, 0x080c, 0x31e4, 0x080c, 0xcf43,
-	0x2001, 0x0001, 0x080c, 0xb7fb, 0x00ce, 0x00de, 0x00be, 0x0005,
-	0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xba03, 0x00d6, 0x2069,
-	0x197c, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058, 0xb8a0, 0x9086,
-	0x007e, 0x1138, 0x2069, 0x1820, 0x2d04, 0x8000, 0x206a, 0x00de,
-	0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x655a, 0x2001, 0x0002,
-	0x080c, 0x656e, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x91f4,
-	0x080c, 0x966f, 0x0804, 0xb98d, 0x080c, 0xc814, 0x01b0, 0x6014,
-	0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138, 0x6007, 0x0016,
-	0x2001, 0x0002, 0x080c, 0xce67, 0x00b0, 0x6014, 0x2048, 0xa864,
-	0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001, 0x180e, 0x2004,
-	0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005,
-	0x1110, 0x9006, 0x0c38, 0x080c, 0xb591, 0x2009, 0x026e, 0x2134,
-	0x96b4, 0x00ff, 0x9686, 0x0005, 0x0520, 0x9686, 0x000b, 0x01c8,
-	0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118, 0x9686, 0x0009,
-	0x01c0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009, 0x0190, 0x2001,
-	0x0004, 0x080c, 0x656e, 0x2001, 0x0028, 0x601a, 0x6007, 0x0052,
-	0x0020, 0x2001, 0x0001, 0x080c, 0xb7fb, 0x002e, 0x00be, 0x009e,
-	0x0005, 0x9286, 0x0139, 0x0160, 0x6014, 0x2048, 0x080c, 0xc814,
-	0x0140, 0xa864, 0x9086, 0x0139, 0x0118, 0xa868, 0xd0fc, 0x0108,
-	0x0c40, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0138,
-	0x8001, 0xb842, 0x601b, 0x000a, 0x6007, 0x0016, 0x08f0, 0xb8a0,
-	0x9086, 0x007e, 0x1138, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5fb5,
-	0x00ee, 0x0010, 0x080c, 0x31e4, 0x0860, 0x080c, 0xba03, 0x1160,
-	0x2001, 0x0004, 0x080c, 0x656e, 0x6003, 0x0001, 0x6007, 0x0003,
-	0x080c, 0x91f4, 0x0804, 0x966f, 0x080c, 0xb591, 0x9006, 0x0804,
-	0xb7fb, 0x0489, 0x1160, 0x2001, 0x0008, 0x080c, 0x656e, 0x6003,
-	0x0001, 0x6007, 0x0005, 0x080c, 0x91f4, 0x0804, 0x966f, 0x2001,
-	0x0001, 0x0804, 0xb7fb, 0x00f9, 0x1160, 0x2001, 0x000a, 0x080c,
-	0x656e, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x91f4, 0x0804,
-	0x966f, 0x2001, 0x0001, 0x0804, 0xb7fb, 0x2009, 0x026e, 0x2104,
-	0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00,
-	0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005, 0x00b6, 0x00c6,
-	0x0016, 0x6110, 0x2158, 0x080c, 0x662d, 0x001e, 0x00ce, 0x00be,
-	0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036, 0x0016, 0x6010,
-	0x2058, 0x2009, 0x1837, 0x2104, 0x9085, 0x0003, 0x200a, 0x080c,
-	0xbaa9, 0x0560, 0x2009, 0x1837, 0x2104, 0xc0cd, 0x200a, 0x080c,
-	0x6a57, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xe29e,
-	0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x2009,
-	0x0001, 0x080c, 0x31a3, 0x00e6, 0x2071, 0x1800, 0x080c, 0x2fb2,
-	0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009, 0x007f, 0x080c,
-	0x32f5, 0x8108, 0x1f04, 0xba47, 0x015e, 0x00ce, 0x080c, 0xba06,
-	0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001, 0x2001, 0x1837,
-	0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc, 0x0118, 0x7038,
-	0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001, 0x1837, 0x2102,
-	0x2079, 0x0100, 0x2e04, 0x9084, 0x00ff, 0x2069, 0x181f, 0x206a,
-	0x78e6, 0x0006, 0x8e70, 0x2e04, 0x2069, 0x1820, 0x206a, 0x78ea,
-	0x7832, 0x7836, 0x2010, 0x9084, 0xff00, 0x001e, 0x9105, 0x2009,
-	0x182c, 0x200a, 0x2200, 0x9084, 0x00ff, 0x2008, 0x080c, 0x2644,
-	0x080c, 0x74d5, 0x0170, 0x2071, 0x0260, 0x2069, 0x1982, 0x7048,
-	0x206a, 0x704c, 0x6806, 0x7050, 0x680a, 0x7054, 0x680e, 0x080c,
-	0xcc3a, 0x0040, 0x2001, 0x0006, 0x080c, 0x656e, 0x080c, 0x3215,
-	0x080c, 0xabc9, 0x001e, 0x003e, 0x00de, 0x00ee, 0x00fe, 0x00be,
-	0x0005, 0x0096, 0x0026, 0x0036, 0x00e6, 0x0156, 0x2019, 0x182c,
-	0x231c, 0x83ff, 0x01f0, 0x2071, 0x0260, 0x7200, 0x9294, 0x00ff,
-	0x7004, 0x9084, 0xff00, 0x9205, 0x9306, 0x1198, 0x2011, 0x0276,
-	0x20a9, 0x0004, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbb9e, 0x1148,
-	0x2011, 0x027a, 0x20a9, 0x0004, 0x2019, 0x0006, 0x080c, 0xbb9e,
-	0x1100, 0x015e, 0x00ee, 0x003e, 0x002e, 0x009e, 0x0005, 0x00e6,
-	0x2071, 0x0260, 0x7034, 0x9086, 0x0014, 0x11a8, 0x7038, 0x9086,
-	0x0800, 0x1188, 0x703c, 0xd0ec, 0x0160, 0x9084, 0x0f00, 0x9086,
-	0x0100, 0x1138, 0x7054, 0xd0a4, 0x1110, 0xd0ac, 0x0110, 0x9006,
-	0x0010, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x0096, 0x00c6,
-	0x0076, 0x0056, 0x0046, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000,
-	0x2029, 0x19f3, 0x252c, 0x2021, 0x19fa, 0x2424, 0x2061, 0x1ddc,
-	0x2071, 0x1800, 0x7254, 0x7074, 0x9202, 0x1a04, 0xbb6a, 0x080c,
-	0x8b5f, 0x0904, 0xbb63, 0x080c, 0xe2cf, 0x0904, 0xbb63, 0x6720,
-	0x9786, 0x0007, 0x0904, 0xbb63, 0x2500, 0x9c06, 0x0904, 0xbb63,
-	0x2400, 0x9c06, 0x0904, 0xbb63, 0x3e08, 0x9186, 0x0002, 0x1148,
-	0x6010, 0x9005, 0x0130, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-	0x1590, 0x00c6, 0x6043, 0xffff, 0x6000, 0x9086, 0x0004, 0x1110,
-	0x080c, 0x1a6a, 0x9786, 0x000a, 0x0148, 0x080c, 0xca29, 0x1130,
-	0x00ce, 0x080c, 0xb591, 0x080c, 0xac04, 0x00e8, 0x6014, 0x2048,
-	0x080c, 0xc814, 0x01a8, 0x9786, 0x0003, 0x1530, 0xa867, 0x0103,
-	0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fec,
-	0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6d64, 0x080c, 0xca03,
-	0x080c, 0xac04, 0x00ce, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1210,
-	0x0804, 0xbb0a, 0x012e, 0x000e, 0x002e, 0x004e, 0x005e, 0x007e,
-	0x00ce, 0x009e, 0x00ee, 0x0005, 0x9786, 0x0006, 0x1118, 0x080c,
-	0xe241, 0x0c30, 0x9786, 0x0009, 0x1148, 0x6000, 0x9086, 0x0004,
-	0x0d08, 0x2009, 0x004c, 0x080c, 0xac68, 0x08e0, 0x9786, 0x000a,
-	0x0938, 0x0820, 0x220c, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318,
-	0x1f04, 0xbb8a, 0x9006, 0x0005, 0x2304, 0x9102, 0x0218, 0x2001,
-	0x0001, 0x0008, 0x9006, 0x918d, 0x0001, 0x0005, 0x0136, 0x01c6,
-	0x0016, 0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084,
-	0xffc0, 0x9300, 0x2098, 0x3518, 0x20a9, 0x0001, 0x220c, 0x4002,
-	0x910e, 0x1140, 0x8210, 0x8319, 0x1dc8, 0x9006, 0x001e, 0x01ce,
-	0x013e, 0x0005, 0x220c, 0x9102, 0x0218, 0x2001, 0x0001, 0x0010,
-	0x2001, 0x0000, 0x918d, 0x0001, 0x001e, 0x01ce, 0x013e, 0x0005,
-	0x220c, 0x810f, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04,
-	0xbbc8, 0x9006, 0x0005, 0x918d, 0x0001, 0x0005, 0x6004, 0x908a,
-	0x0053, 0x1a0c, 0x0d7d, 0x080c, 0xca18, 0x0120, 0x080c, 0xca29,
-	0x0158, 0x0028, 0x080c, 0x3215, 0x080c, 0xca29, 0x0128, 0x080c,
-	0x95ad, 0x080c, 0xabc9, 0x0005, 0x080c, 0xb591, 0x0cc0, 0x9182,
-	0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xbc0e,
-	0xbc0e, 0xbc0e, 0xbc0e, 0xbc0e, 0xbc0e, 0xbc0e, 0xbc0e, 0xbc0e,
-	0xbc0e, 0xbc0e, 0xbc10, 0xbc10, 0xbc10, 0xbc10, 0xbc0e, 0xbc0e,
-	0xbc0e, 0xbc10, 0xbc0e, 0xbc0e, 0xbc0e, 0xbc0e, 0x080c, 0x0d7d,
-	0x600b, 0xffff, 0x6003, 0x000f, 0x6106, 0x0126, 0x2091, 0x8000,
-	0x080c, 0xcf46, 0x2009, 0x8000, 0x080c, 0x91ed, 0x012e, 0x0005,
-	0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0040, 0x0804, 0xbc95,
-	0x9186, 0x0027, 0x1520, 0x080c, 0x95ad, 0x080c, 0x31e4, 0x080c,
-	0xcf43, 0x0096, 0x6114, 0x2148, 0x080c, 0xc814, 0x0198, 0x080c,
-	0xca29, 0x1118, 0x080c, 0xb591, 0x0068, 0xa867, 0x0103, 0xa87b,
-	0x0029, 0xa877, 0x0000, 0xa97c, 0xc1c5, 0xa97e, 0x080c, 0x6d70,
-	0x080c, 0xca03, 0x009e, 0x080c, 0xabc9, 0x0804, 0x966f, 0x9186,
-	0x0014, 0x1120, 0x6004, 0x9082, 0x0040, 0x0018, 0x080c, 0x0d7d,
-	0x0005, 0x0002, 0xbc73, 0xbc71, 0xbc71, 0xbc71, 0xbc71, 0xbc71,
-	0xbc71, 0xbc71, 0xbc71, 0xbc71, 0xbc71, 0xbc8c, 0xbc8c, 0xbc8c,
-	0xbc8c, 0xbc71, 0xbc8c, 0xbc71, 0xbc8c, 0xbc71, 0xbc71, 0xbc71,
-	0xbc71, 0x080c, 0x0d7d, 0x080c, 0x95ad, 0x0096, 0x6114, 0x2148,
-	0x080c, 0xc814, 0x0168, 0xa867, 0x0103, 0xa87b, 0x0006, 0xa877,
-	0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c, 0x6d70, 0x080c, 0xca03,
-	0x009e, 0x080c, 0xabc9, 0x0005, 0x080c, 0x95ad, 0x080c, 0xca29,
-	0x090c, 0xb591, 0x080c, 0xabc9, 0x0005, 0x0002, 0xbcaf, 0xbcad,
-	0xbcad, 0xbcad, 0xbcad, 0xbcad, 0xbcad, 0xbcad, 0xbcad, 0xbcad,
-	0xbcad, 0xbcb1, 0xbcb1, 0xbcb1, 0xbcb1, 0xbcad, 0xbcb3, 0xbcad,
-	0xbcb1, 0xbcad, 0xbcad, 0xbcad, 0xbcad, 0x080c, 0x0d7d, 0x080c,
-	0x0d7d, 0x080c, 0x0d7d, 0x080c, 0xabc9, 0x0804, 0x966f, 0x9182,
-	0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xbcd6,
-	0xbcd6, 0xbcd6, 0xbcd6, 0xbcd6, 0xbd0f, 0xbdfe, 0xbcd6, 0xbe0a,
-	0xbcd6, 0xbcd6, 0xbcd6, 0xbcd6, 0xbcd6, 0xbcd6, 0xbcd6, 0xbcd6,
-	0xbcd6, 0xbcd6, 0xbe0a, 0xbcd8, 0xbcd6, 0xbe08, 0x080c, 0x0d7d,
-	0x00b6, 0x0096, 0x6114, 0x2148, 0x6010, 0x2058, 0xb800, 0xd0bc,
-	0x1508, 0xa87b, 0x0000, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87c,
-	0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xbe8f, 0x080c,
-	0x6b86, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e,
-	0xb8d0, 0x9005, 0x0110, 0x080c, 0x6749, 0x080c, 0xabc9, 0x009e,
-	0x00be, 0x0005, 0xa87c, 0xd0ac, 0x09e0, 0xa838, 0xa934, 0x9105,
-	0x09c0, 0xa880, 0xd0bc, 0x19a8, 0x080c, 0xcb59, 0x0c80, 0x00b6,
-	0x0096, 0x6114, 0x2148, 0x601c, 0xd0fc, 0x1110, 0x7644, 0x0008,
-	0x9036, 0x96b4, 0x0fff, 0x86ff, 0x1590, 0x6010, 0x2058, 0xb800,
-	0xd0bc, 0x1904, 0xbded, 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76,
-	0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xbe8f,
-	0x080c, 0x6b86, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211,
-	0xba3e, 0xb8d0, 0x9005, 0x0110, 0x080c, 0x6749, 0x601c, 0xd0fc,
-	0x1148, 0x7044, 0xd0e4, 0x1904, 0xbdd1, 0x080c, 0xabc9, 0x009e,
-	0x00be, 0x0005, 0x2009, 0x0211, 0x210c, 0x080c, 0x0d7d, 0x968c,
-	0x0c00, 0x0150, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xbdd5,
-	0x7348, 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002,
-	0x0508, 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00e8, 0xd6dc,
-	0x01a0, 0xa87b, 0x0015, 0xa87c, 0xd0ac, 0x0170, 0xa938, 0xaa34,
-	0x2100, 0x9205, 0x0148, 0x7048, 0x9106, 0x1118, 0x704c, 0x9206,
-	0x0118, 0xa992, 0xaa8e, 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0xa87b,
-	0x0007, 0x0010, 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0x901e,
-	0xd6c4, 0x01d8, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118,
-	0xc6c4, 0x0804, 0xbd1b, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a,
-	0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018,
-	0x2011, 0x0025, 0x080c, 0xc3e7, 0x003e, 0xd6cc, 0x0904, 0xbd30,
-	0x7154, 0xa98a, 0x81ff, 0x0904, 0xbd30, 0x9192, 0x0021, 0x1278,
-	0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xc3e7, 0x2011,
-	0x0205, 0x2013, 0x0000, 0x080c, 0xced3, 0x0804, 0xbd30, 0xa868,
-	0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c50, 0x00a6, 0x2950,
-	0x080c, 0xc386, 0x00ae, 0x080c, 0xced3, 0x080c, 0xc3d7, 0x0804,
-	0xbd32, 0x080c, 0xcb1c, 0x0804, 0xbd47, 0xa87c, 0xd0ac, 0x0904,
-	0xbd58, 0xa880, 0xd0bc, 0x1904, 0xbd58, 0x7348, 0xa838, 0x9306,
-	0x11c8, 0x734c, 0xa834, 0x931e, 0x0904, 0xbd58, 0xd6d4, 0x0190,
-	0xab38, 0x9305, 0x0904, 0xbd58, 0x0068, 0xa87c, 0xd0ac, 0x0904,
-	0xbd23, 0xa838, 0xa934, 0x9105, 0x0904, 0xbd23, 0xa880, 0xd0bc,
-	0x1904, 0xbd23, 0x080c, 0xcb59, 0x0804, 0xbd47, 0x00f6, 0x2079,
-	0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08, 0x00fe, 0x0021, 0x0005,
-	0x0011, 0x0005, 0x0005, 0x0096, 0x6003, 0x0002, 0x6007, 0x0043,
-	0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0128, 0x009e, 0x0005, 0x2130,
-	0x2228, 0x0058, 0x2400, 0xa9ac, 0x910a, 0x2300, 0xaab0, 0x9213,
-	0x2600, 0x9102, 0x2500, 0x9203, 0x0e90, 0xac46, 0xab4a, 0xae36,
-	0xad3a, 0x6044, 0xd0fc, 0x190c, 0xa89b, 0x604b, 0x0000, 0x080c,
-	0x1c30, 0x1118, 0x6144, 0x080c, 0x9219, 0x009e, 0x0005, 0x9182,
-	0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xbe56,
-	0xbe56, 0xbe56, 0xbe56, 0xbe56, 0xbe56, 0xbe56, 0xbe56, 0xbe56,
-	0xbe56, 0xbe58, 0xbe56, 0xbe56, 0xbe56, 0xbe56, 0xbe69, 0xbe56,
-	0xbe56, 0xbe56, 0xbe56, 0xbe8d, 0xbe56, 0xbe56, 0x080c, 0x0d7d,
-	0x6004, 0x9086, 0x0040, 0x1110, 0x080c, 0x95ad, 0x2019, 0x0001,
-	0x080c, 0xa0f4, 0x6003, 0x0002, 0x080c, 0xcf4b, 0x080c, 0x960a,
-	0x0005, 0x6004, 0x9086, 0x0040, 0x1110, 0x080c, 0x95ad, 0x2019,
-	0x0001, 0x080c, 0xa0f4, 0x080c, 0x960a, 0x080c, 0x31e4, 0x080c,
-	0xcf43, 0x0096, 0x6114, 0x2148, 0x080c, 0xc814, 0x0150, 0xa867,
-	0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0x080c, 0x6d70, 0x080c,
-	0xca03, 0x009e, 0x080c, 0xabc9, 0x0005, 0x080c, 0x0d7d, 0xa87b,
-	0x0015, 0xd1fc, 0x0180, 0xa87b, 0x0007, 0x8002, 0x8000, 0x810a,
-	0x9189, 0x0000, 0x0006, 0x0016, 0x2009, 0x1a78, 0x2104, 0x8000,
-	0x200a, 0x001e, 0x000e, 0xa992, 0xa88e, 0x0005, 0x9182, 0x0057,
-	0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xbec5, 0xbec5,
-	0xbec5, 0xbec5, 0xbec5, 0xbec7, 0xbec5, 0xbec5, 0xbf84, 0xbec5,
-	0xbec5, 0xbec5, 0xbec5, 0xbec5, 0xbec5, 0xbec5, 0xbec5, 0xbec5,
-	0xbec5, 0xc0c8, 0xbec5, 0xc0d2, 0xbec5, 0x080c, 0x0d7d, 0x601c,
-	0xd0bc, 0x0178, 0xd084, 0x0168, 0xd0f4, 0x0120, 0xc084, 0x601e,
-	0x0804, 0xbcb7, 0x6114, 0x0096, 0x2148, 0xa87c, 0xc0e5, 0xa87e,
-	0x009e, 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114,
-	0x2150, 0x601c, 0xd0fc, 0x1110, 0x7644, 0x0008, 0x9036, 0xb676,
-	0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e, 0x6210, 0x00b6, 0x2258,
-	0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be, 0x86ff, 0x0904,
-	0xbf7d, 0x9694, 0xff00, 0x9284, 0x0c00, 0x0120, 0x7048, 0xb092,
-	0x704c, 0xb08e, 0x9284, 0x0300, 0x0904, 0xbf7d, 0x9686, 0x0100,
-	0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0xb676, 0x0c38, 0x080c,
-	0x103a, 0x090c, 0x0d7d, 0x2900, 0xb07a, 0xb77c, 0x97bd, 0x0200,
-	0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c, 0xa86e, 0xb070,
-	0xa872, 0x7044, 0x9084, 0xf000, 0x9635, 0xae76, 0x968c, 0x0c00,
-	0x0120, 0x7348, 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186,
-	0x0002, 0x0180, 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060,
-	0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038, 0xd6d4, 0x0118, 0xa87b,
-	0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e, 0xb080, 0xa882, 0xb084,
-	0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c, 0xab86, 0x83ff, 0x0170,
-	0x938a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019,
-	0x0018, 0x2011, 0x0025, 0x080c, 0xc3e7, 0x003e, 0xd6cc, 0x01e8,
-	0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192, 0x0021, 0x1260, 0x8304,
-	0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xc3e7, 0x2011, 0x0205,
-	0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc, 0x0120, 0x2009, 0x0020,
-	0xa98a, 0x0c68, 0x2950, 0x080c, 0xc386, 0x080c, 0x1a48, 0x009e,
-	0x00ee, 0x00ae, 0x007e, 0x0005, 0x2001, 0x1988, 0x2004, 0x604a,
-	0x0096, 0x6114, 0x2148, 0xa83c, 0xa940, 0x9105, 0x1118, 0xa87c,
-	0xc0dc, 0xa87e, 0x6003, 0x0002, 0x080c, 0xcf54, 0x0904, 0xc0c3,
-	0x604b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-	0x1500, 0xd1cc, 0x0904, 0xc082, 0xa978, 0xa868, 0xd0fc, 0x0904,
-	0xc043, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006, 0x00a6, 0x2150,
-	0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x0904, 0xc011, 0x9086,
-	0x0028, 0x1904, 0xbffd, 0xa87b, 0x001c, 0xb07b, 0x001c, 0x0804,
-	0xc019, 0x6024, 0xd0f4, 0x11d0, 0xa838, 0xaa34, 0x9205, 0x09c8,
-	0xa838, 0xaa90, 0x9206, 0x1120, 0xa88c, 0xaa34, 0x9206, 0x0988,
-	0x6024, 0xd0d4, 0x1148, 0xa9ac, 0xa834, 0x9102, 0x603a, 0xa9b0,
-	0xa838, 0x9103, 0x603e, 0x6024, 0xc0f5, 0x6026, 0x6010, 0x00b6,
-	0x2058, 0xb83c, 0x8000, 0xb83e, 0x00be, 0x601c, 0xc0fc, 0x601e,
-	0x9006, 0xa876, 0xa892, 0xa88e, 0xa87c, 0xc0e4, 0xa87e, 0xd0cc,
-	0x0140, 0xc0cc, 0xa87e, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fec,
-	0x009e, 0x080c, 0xcb59, 0x0804, 0xc0c3, 0xd1dc, 0x0158, 0xa87b,
-	0x0015, 0xb07b, 0x0015, 0x080c, 0xcdf6, 0x0118, 0xb174, 0xc1dc,
-	0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007,
-	0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c,
-	0xbe8f, 0xa87c, 0xb07e, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x20a9, 0x0020, 0x8a06,
-	0x8006, 0x8007, 0x9094, 0x003f, 0x22e0, 0x9084, 0xffc0, 0x9080,
-	0x0019, 0x2098, 0x4003, 0x00ae, 0x000e, 0xa882, 0x000e, 0xa87e,
-	0x080c, 0xced3, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c, 0x0fec,
-	0x001e, 0x0804, 0xc0af, 0x0016, 0x00a6, 0x2150, 0xb174, 0x9184,
-	0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086, 0x0028, 0x1128, 0xa87b,
-	0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc, 0x0158, 0xa87b, 0x0015,
-	0xb07b, 0x0015, 0x080c, 0xcdf6, 0x0118, 0xb174, 0xc1dc, 0xb176,
-	0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040,
-	0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xbe8f,
-	0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c, 0xb07e, 0x00ae, 0x080c,
-	0x0fec, 0x009e, 0x080c, 0xced3, 0xa974, 0x0016, 0x080c, 0xc3d7,
-	0x001e, 0x0468, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6,
-	0x0002, 0x01b0, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00d0,
-	0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c, 0xcdf6, 0x0118, 0xa974,
-	0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118, 0xa87b, 0x0007, 0x0050,
-	0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115,
-	0x190c, 0xbe8f, 0xa974, 0x0016, 0x080c, 0x6b86, 0x001e, 0x6010,
-	0x00b6, 0x2058, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0xb8d0,
-	0x9005, 0x0120, 0x0016, 0x080c, 0x6749, 0x001e, 0x00be, 0xd1e4,
-	0x1120, 0x080c, 0xabc9, 0x009e, 0x0005, 0x080c, 0xcb1c, 0x0cd8,
-	0x6114, 0x0096, 0x2148, 0xa97c, 0x080c, 0xcf54, 0x190c, 0x1a56,
-	0x009e, 0x0005, 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940, 0x9105,
-	0x01e8, 0xa877, 0x0000, 0xa87b, 0x0000, 0xa867, 0x0103, 0x00b6,
-	0x6010, 0x2058, 0xa834, 0xa938, 0x9115, 0x11a0, 0x080c, 0x6b86,
-	0xba3c, 0x8211, 0x0208, 0xba3e, 0xb8d0, 0x9005, 0x0110, 0x080c,
-	0x6749, 0x080c, 0xabc9, 0x00be, 0x009e, 0x0005, 0xa87c, 0xc0dc,
-	0xa87e, 0x08f8, 0xb800, 0xd0bc, 0x1120, 0xa834, 0x080c, 0xbe8f,
-	0x0c28, 0xa880, 0xd0bc, 0x1dc8, 0x080c, 0xcb59, 0x0c60, 0x080c,
-	0x95ad, 0x0010, 0x080c, 0x960a, 0x601c, 0xd084, 0x0110, 0x080c,
-	0x1a6a, 0x080c, 0xc814, 0x01f0, 0x0096, 0x6114, 0x2148, 0x080c,
-	0xca29, 0x1118, 0x080c, 0xb591, 0x00a0, 0xa867, 0x0103, 0x2009,
-	0x180c, 0x210c, 0xd18c, 0x1198, 0xd184, 0x1170, 0x6108, 0xa97a,
-	0x918e, 0x0029, 0x1110, 0x080c, 0xe5f6, 0xa877, 0x0000, 0x080c,
-	0x6d70, 0x009e, 0x0804, 0xac04, 0xa87b, 0x0004, 0x0cb0, 0xa87b,
-	0x0004, 0x0c98, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208,
-	0x000a, 0x0005, 0xc159, 0xc159, 0xc159, 0xc159, 0xc159, 0xc15b,
-	0xc159, 0xc159, 0xc159, 0xc159, 0xc159, 0xc159, 0xc159, 0xc159,
-	0xc159, 0xc159, 0xc159, 0xc159, 0xc159, 0xc159, 0xc17f, 0xc159,
-	0xc159, 0x080c, 0x0d7d, 0x080c, 0x56db, 0x01f8, 0x6014, 0x7144,
-	0x918c, 0x0fff, 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294, 0x00ff,
-	0x0096, 0x904d, 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086, 0x0139,
-	0x0128, 0xa867, 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897, 0x4000,
-	0xa99a, 0xaa9e, 0x080c, 0x6d70, 0x009e, 0x0804, 0xabc9, 0x080c,
-	0x56db, 0x0dd8, 0x6014, 0x900e, 0x9016, 0x0c10, 0x9182, 0x0085,
-	0x0002, 0xc198, 0xc196, 0xc196, 0xc1a4, 0xc196, 0xc196, 0xc196,
-	0xc196, 0xc196, 0xc196, 0xc196, 0xc196, 0xc196, 0x080c, 0x0d7d,
-	0x6003, 0x0001, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0x8020,
-	0x080c, 0x91ed, 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6, 0x00e6,
-	0x2071, 0x0260, 0x7224, 0x6216, 0x7220, 0x080c, 0xc802, 0x01a0,
-	0x2268, 0x6800, 0x9086, 0x0000, 0x0178, 0x6010, 0x6d10, 0x952e,
-	0x1158, 0x00c6, 0x2d60, 0x080c, 0xc412, 0x00ce, 0x0128, 0x6803,
-	0x0002, 0x6007, 0x0086, 0x0010, 0x6007, 0x0087, 0x6003, 0x0001,
-	0x2009, 0x8020, 0x080c, 0x91ed, 0x9280, 0x0004, 0x00b6, 0x2058,
-	0xb800, 0x00be, 0xd0bc, 0x0140, 0x6824, 0xd0ec, 0x0128, 0x00c6,
-	0x2260, 0x080c, 0xcb59, 0x00ce, 0x00ee, 0x00de, 0x005e, 0x002e,
-	0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c,
-	0x0d7d, 0x908a, 0x0092, 0x1a0c, 0x0d7d, 0x9082, 0x0085, 0x00e2,
-	0x9186, 0x0027, 0x0120, 0x9186, 0x0014, 0x190c, 0x0d7d, 0x080c,
-	0x95ad, 0x0096, 0x6014, 0x2048, 0x080c, 0xc814, 0x0140, 0xa867,
-	0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x6d70, 0x009e,
-	0x080c, 0xac04, 0x0804, 0x966f, 0xc219, 0xc21b, 0xc21b, 0xc219,
-	0xc219, 0xc219, 0xc219, 0xc219, 0xc219, 0xc219, 0xc219, 0xc219,
-	0xc219, 0x080c, 0x0d7d, 0x080c, 0xac04, 0x0005, 0x9186, 0x0013,
-	0x1130, 0x6004, 0x9082, 0x0085, 0x2008, 0x0804, 0xc26a, 0x9186,
-	0x0027, 0x1558, 0x080c, 0x95ad, 0x080c, 0x31e4, 0x080c, 0xcf43,
-	0x0096, 0x6014, 0x2048, 0x080c, 0xc814, 0x0150, 0xa867, 0x0103,
-	0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x6d70, 0x080c, 0xca03,
-	0x009e, 0x080c, 0xabc9, 0x0005, 0x9186, 0x0089, 0x0118, 0x9186,
-	0x008a, 0x1140, 0x080c, 0xaa84, 0x0128, 0x9086, 0x000c, 0x0904,
-	0xc2a2, 0x0000, 0x080c, 0xac85, 0x0c70, 0x9186, 0x0014, 0x1d60,
-	0x080c, 0x95ad, 0x0096, 0x6014, 0x2048, 0x080c, 0xc814, 0x0d00,
-	0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0006, 0xa880, 0xc0ec,
-	0xa882, 0x0890, 0x0002, 0xc27a, 0xc278, 0xc278, 0xc278, 0xc278,
-	0xc278, 0xc28e, 0xc278, 0xc278, 0xc278, 0xc278, 0xc278, 0xc278,
-	0x080c, 0x0d7d, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
-	0x0118, 0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001,
-	0x1987, 0x2004, 0x601a, 0x6003, 0x000c, 0x0005, 0x6034, 0x908c,
+	0x2001, 0x0205, 0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020,
+	0x4003, 0x2003, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867,
+	0x0103, 0x080c, 0xabed, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016,
+	0x900e, 0x7030, 0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff,
+	0x800c, 0x703c, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108,
+	0x810b, 0x2011, 0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c,
+	0xc40b, 0x080c, 0xc838, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000,
+	0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xabed, 0x001e, 0x009e,
+	0x0005, 0x0016, 0x2009, 0x0000, 0x7030, 0x9086, 0x0200, 0x0110,
+	0x2009, 0x0001, 0x0096, 0x6014, 0x904d, 0x090c, 0x0d7d, 0xa97a,
+	0x080c, 0x6d80, 0x009e, 0x080c, 0xabed, 0x001e, 0x0005, 0x0016,
+	0x0096, 0x7030, 0x9086, 0x0100, 0x1118, 0x2009, 0x0004, 0x0010,
+	0x7034, 0x800c, 0x810b, 0x2011, 0x000c, 0x2019, 0x000c, 0x6014,
+	0x2048, 0xa804, 0x0096, 0x9005, 0x0108, 0x2048, 0x080c, 0xc40b,
+	0x009e, 0x080c, 0xc838, 0x0148, 0xa804, 0x9005, 0x1158, 0xa807,
+	0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0xabed, 0x009e,
+	0x001e, 0x0005, 0x0086, 0x2040, 0xa030, 0x8007, 0x9086, 0x0100,
+	0x1118, 0x080c, 0xb5b5, 0x00e0, 0xa034, 0x8007, 0x800c, 0x8806,
+	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x000c,
+	0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xaaa0, 0xab9c,
+	0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x127e, 0x0019, 0x0d08,
+	0x008e, 0x0898, 0x0096, 0x0006, 0x080c, 0x103a, 0x000e, 0x01b0,
+	0xa8ab, 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006, 0xae6a, 0x2800,
+	0xa89e, 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96, 0xad9a, 0x0086,
+	0x2940, 0x080c, 0x1124, 0x008e, 0x9085, 0x0001, 0x009e, 0x0005,
+	0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6,
+	0x2258, 0xba10, 0x00be, 0x9206, 0x1520, 0x700c, 0x6210, 0x00b6,
+	0x2258, 0xba14, 0x00be, 0x9206, 0x11e0, 0x604b, 0x0000, 0x2c68,
+	0x0016, 0x2009, 0x0035, 0x080c, 0xceca, 0x001e, 0x1158, 0x622c,
+	0x2268, 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003, 0x0130, 0x9386,
+	0x0006, 0x0128, 0x080c, 0xabed, 0x0020, 0x0039, 0x0010, 0x080c,
+	0xb22e, 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096, 0x6814, 0x2048,
+	0x9186, 0x0015, 0x0904, 0xb20d, 0x918e, 0x0016, 0x1904, 0xb22c,
+	0x700c, 0x908c, 0xff00, 0x9186, 0x1700, 0x0120, 0x9186, 0x0300,
+	0x1904, 0xb1e7, 0x89ff, 0x1138, 0x6800, 0x9086, 0x000f, 0x0904,
+	0xb1c9, 0x0804, 0xb22a, 0x6808, 0x9086, 0xffff, 0x1904, 0xb20f,
+	0xa87c, 0x9084, 0x0060, 0x9086, 0x0020, 0x1128, 0xa83c, 0xa940,
+	0x9105, 0x1904, 0xb20f, 0x6824, 0xd0b4, 0x1904, 0xb20f, 0x080c,
+	0xca27, 0x6864, 0xa882, 0xa87c, 0xc0dc, 0xc0f4, 0xc0d4, 0xa87e,
+	0x0026, 0x900e, 0x6a18, 0x2001, 0x000a, 0x080c, 0x9166, 0xa884,
+	0x920a, 0x0208, 0x8011, 0xaa86, 0x82ff, 0x002e, 0x1138, 0x00c6,
+	0x2d60, 0x080c, 0xc55e, 0x00ce, 0x0804, 0xb22a, 0x00c6, 0xa868,
+	0xd0fc, 0x1118, 0x080c, 0x60bb, 0x0010, 0x080c, 0x64bf, 0x00ce,
+	0x1904, 0xb20f, 0x00c6, 0x2d60, 0x080c, 0xabed, 0x00ce, 0x0804,
+	0xb22a, 0x00c6, 0x080c, 0xac5f, 0x0198, 0x6017, 0x0000, 0x6810,
+	0x6012, 0x080c, 0xcccc, 0x6023, 0x0003, 0x6904, 0x00c6, 0x2d60,
+	0x080c, 0xabed, 0x00ce, 0x080c, 0xac8c, 0x00ce, 0x0804, 0xb22a,
+	0x2001, 0x1988, 0x2004, 0x684a, 0x00ce, 0x0804, 0xb22a, 0x7008,
+	0x9086, 0x000b, 0x11c8, 0x6010, 0x00b6, 0x2058, 0xb900, 0xc1bc,
+	0xb902, 0x00be, 0x00c6, 0x2d60, 0xa87b, 0x0003, 0x080c, 0xcf0c,
+	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009, 0x8020,
+	0x080c, 0x921e, 0x00ce, 0x0430, 0x700c, 0x9086, 0x2a00, 0x1138,
+	0x2001, 0x1988, 0x2004, 0x684a, 0x00e8, 0x04c1, 0x00e8, 0x89ff,
+	0x090c, 0x0d7d, 0x00c6, 0x00d6, 0x2d60, 0xa867, 0x0103, 0xa87b,
+	0x0003, 0x080c, 0x6b96, 0x080c, 0xca27, 0x080c, 0xac28, 0x0026,
+	0x6010, 0x00b6, 0x2058, 0xba3c, 0x080c, 0x6750, 0x00be, 0x002e,
+	0x00de, 0x00ce, 0x080c, 0xabed, 0x009e, 0x0005, 0x9186, 0x0015,
+	0x1128, 0x2001, 0x1988, 0x2004, 0x684a, 0x0068, 0x918e, 0x0016,
+	0x1160, 0x00c6, 0x2d00, 0x2060, 0x080c, 0xe524, 0x080c, 0x88c1,
+	0x080c, 0xabed, 0x00ce, 0x080c, 0xabed, 0x0005, 0x0026, 0x0036,
+	0x0046, 0x7228, 0xacb0, 0xabac, 0xd2f4, 0x0130, 0x2001, 0x1988,
+	0x2004, 0x684a, 0x0804, 0xb2a8, 0x00c6, 0x2d60, 0x080c, 0xc436,
+	0x00ce, 0x6804, 0x9086, 0x0050, 0x1168, 0x00c6, 0x2d00, 0x2060,
+	0x6003, 0x0001, 0x6007, 0x0050, 0x2009, 0x8023, 0x080c, 0x921e,
+	0x00ce, 0x04f0, 0x6800, 0x9086, 0x000f, 0x01a8, 0x89ff, 0x090c,
+	0x0d7d, 0x6800, 0x9086, 0x0004, 0x1190, 0xa87c, 0xd0ac, 0x0178,
+	0xa843, 0x0fff, 0xa83f, 0x0fff, 0xa880, 0xc0fc, 0xa882, 0x2001,
+	0x0001, 0x6832, 0x0400, 0x2001, 0x0007, 0x6832, 0x00e0, 0xa87c,
+	0xd0b4, 0x1150, 0xd0ac, 0x0db8, 0x6824, 0xd0f4, 0x1d48, 0xa838,
+	0xa934, 0x9105, 0x0d80, 0x0c20, 0xd2ec, 0x1d68, 0x7024, 0x9306,
+	0x1118, 0x7020, 0x9406, 0x0d38, 0x7020, 0x683e, 0x7024, 0x683a,
+	0x2001, 0x0005, 0x6832, 0x080c, 0xcbb6, 0x080c, 0x96a0, 0x0010,
+	0x080c, 0xabed, 0x004e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x00d6,
+	0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258, 0xba10,
+	0x00be, 0x9206, 0x1904, 0xb313, 0x700c, 0x6210, 0x00b6, 0x2258,
+	0xba14, 0x00be, 0x9206, 0x1904, 0xb313, 0x6038, 0x2068, 0x6824,
+	0xc0dc, 0x6826, 0x6a20, 0x9286, 0x0007, 0x0904, 0xb313, 0x9286,
+	0x0002, 0x0904, 0xb313, 0x9286, 0x0000, 0x05e8, 0x6808, 0x633c,
+	0x9306, 0x15c8, 0x2071, 0x026c, 0x9186, 0x0015, 0x0570, 0x918e,
+	0x0016, 0x1100, 0x00c6, 0x6038, 0x2060, 0x6104, 0x9186, 0x004b,
+	0x01c0, 0x9186, 0x004c, 0x01a8, 0x9186, 0x004d, 0x0190, 0x9186,
+	0x004e, 0x0178, 0x9186, 0x0052, 0x0160, 0x6014, 0x0096, 0x2048,
+	0x080c, 0xc838, 0x090c, 0x0d7d, 0xa87b, 0x0003, 0x009e, 0x080c,
+	0xcf0c, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009,
+	0x8020, 0x080c, 0x921e, 0x00ce, 0x0030, 0x6038, 0x2070, 0x2001,
+	0x1988, 0x2004, 0x704a, 0x080c, 0xabed, 0x002e, 0x00de, 0x00ee,
+	0x0005, 0x00b6, 0x0096, 0x00f6, 0x6014, 0x2048, 0x6010, 0x2058,
+	0x91b6, 0x0015, 0x0130, 0xba08, 0xbb0c, 0xbc00, 0xc48c, 0xbc02,
+	0x0460, 0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0010,
+	0x2019, 0x000a, 0x20a9, 0x0004, 0x080c, 0xbbc2, 0x002e, 0x003e,
+	0x015e, 0x009e, 0x1904, 0xb382, 0x0096, 0x0156, 0x0036, 0x0026,
+	0x2b48, 0x9e90, 0x0014, 0x2019, 0x0006, 0x20a9, 0x0004, 0x080c,
+	0xbbc2, 0x002e, 0x003e, 0x015e, 0x009e, 0x15a0, 0x7238, 0xba0a,
+	0x733c, 0xbb0e, 0xbc00, 0xc48d, 0xbc02, 0xa804, 0x9005, 0x1128,
+	0x00fe, 0x009e, 0x00be, 0x0804, 0xaffd, 0x0096, 0x2048, 0xaa12,
+	0xab16, 0xac0a, 0x009e, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f,
+	0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c,
+	0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x127e, 0x080c, 0xb112,
+	0x0130, 0x00fe, 0x009e, 0x080c, 0xabed, 0x00be, 0x0005, 0x080c,
+	0xb5b5, 0x0cb8, 0x2b78, 0x00f6, 0x080c, 0x31e7, 0x080c, 0xcf67,
+	0x00fe, 0x00c6, 0x080c, 0xab97, 0x2f00, 0x6012, 0x6017, 0x0000,
+	0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x2001, 0x0007,
+	0x080c, 0x6575, 0x080c, 0x65a1, 0x080c, 0x9225, 0x080c, 0x96a0,
+	0x00ce, 0x0804, 0xb355, 0x2100, 0x91b2, 0x0053, 0x1a0c, 0x0d7d,
+	0x91b2, 0x0040, 0x1a04, 0xb40b, 0x0002, 0xb3f9, 0xb3f9, 0xb3ef,
+	0xb3f9, 0xb3f9, 0xb3f9, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed,
+	0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed,
+	0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed,
+	0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3f9, 0xb3ed, 0xb3f9, 0xb3f9,
+	0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ef, 0xb3ed, 0xb3ed,
+	0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3f9,
+	0xb3f9, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed, 0xb3ed,
+	0xb3ed, 0xb3ed, 0xb3f9, 0xb3ed, 0xb3ed, 0x080c, 0x0d7d, 0x0066,
+	0x00b6, 0x6610, 0x2658, 0xb8d4, 0xc08c, 0xb8d6, 0x00be, 0x006e,
+	0x0000, 0x6003, 0x0001, 0x6106, 0x9186, 0x0032, 0x0118, 0x080c,
+	0x9225, 0x0010, 0x080c, 0x921e, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x96a0, 0x012e, 0x0005, 0x2600, 0x0002, 0xb3f9, 0xb3f9, 0xb41f,
+	0xb3f9, 0xb3f9, 0xb41f, 0xb41f, 0xb41f, 0xb41f, 0xb3f9, 0xb41f,
+	0xb3f9, 0xb41f, 0xb3f9, 0xb41f, 0xb41f, 0xb41f, 0xb41f, 0x080c,
+	0x0d7d, 0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0d7d, 0x91b6, 0x0013,
+	0x0904, 0xb4f6, 0x91b6, 0x0027, 0x1904, 0xb4a2, 0x080c, 0x95de,
+	0x6004, 0x080c, 0xca3c, 0x01b0, 0x080c, 0xca4d, 0x01a8, 0x908e,
+	0x0021, 0x0904, 0xb49f, 0x908e, 0x0022, 0x1130, 0x080c, 0xb029,
+	0x0904, 0xb49b, 0x0804, 0xb49c, 0x908e, 0x003d, 0x0904, 0xb49f,
+	0x0804, 0xb495, 0x080c, 0x321c, 0x2001, 0x0007, 0x080c, 0x6575,
+	0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xb5b5, 0x9186,
+	0x007e, 0x1148, 0x2001, 0x1837, 0x2014, 0xc285, 0x080c, 0x74e9,
+	0x1108, 0xc2ad, 0x2202, 0x080c, 0xa896, 0x0036, 0x0026, 0x2019,
+	0x0028, 0x2110, 0x080c, 0xe630, 0x002e, 0x003e, 0x0016, 0x0026,
+	0x0036, 0x2110, 0x2019, 0x0028, 0x080c, 0x93a5, 0x0076, 0x903e,
+	0x080c, 0x9277, 0x6010, 0x00b6, 0x905d, 0x0100, 0x00be, 0x2c08,
+	0x080c, 0xdfeb, 0x007e, 0x003e, 0x002e, 0x001e, 0x080c, 0xa8b2,
+	0x080c, 0xcf67, 0x0016, 0x080c, 0xccc4, 0x080c, 0xabed, 0x001e,
+	0x080c, 0x32fc, 0x080c, 0x96a0, 0x0030, 0x080c, 0xccc4, 0x080c,
+	0xabed, 0x080c, 0x96a0, 0x0005, 0x080c, 0xb5b5, 0x0cb0, 0x080c,
+	0xb5f1, 0x0c98, 0x9186, 0x0015, 0x0118, 0x9186, 0x0016, 0x1140,
+	0x080c, 0xaaa8, 0x0d80, 0x9086, 0x0002, 0x0904, 0xb5fc, 0x0c58,
+	0x9186, 0x0014, 0x1d40, 0x080c, 0x95de, 0x6004, 0x908e, 0x0022,
+	0x1118, 0x080c, 0xb029, 0x09f8, 0x080c, 0x31e7, 0x080c, 0xcf67,
+	0x080c, 0xca3c, 0x1190, 0x080c, 0x321c, 0x6010, 0x00b6, 0x2058,
+	0xb9a0, 0x00be, 0x080c, 0xb5b5, 0x9186, 0x007e, 0x1128, 0x2001,
+	0x1837, 0x200c, 0xc185, 0x2102, 0x0800, 0x080c, 0xca4d, 0x1120,
+	0x080c, 0xb5b5, 0x0804, 0xb495, 0x6004, 0x908e, 0x0032, 0x1160,
+	0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079, 0x0000, 0x080c, 0x35a5,
+	0x00fe, 0x00ee, 0x0804, 0xb495, 0x6004, 0x908e, 0x0021, 0x0d40,
+	0x908e, 0x0022, 0x090c, 0xb5b5, 0x0804, 0xb495, 0x90b2, 0x0040,
+	0x1a04, 0xb595, 0x2008, 0x0002, 0xb53e, 0xb53f, 0xb542, 0xb545,
+	0xb548, 0xb54b, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c,
+	0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c,
+	0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c,
+	0xb53c, 0xb53c, 0xb54e, 0xb557, 0xb53c, 0xb558, 0xb557, 0xb53c,
+	0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb557, 0xb557, 0xb53c, 0xb53c,
+	0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb53c, 0xb580, 0xb557,
+	0xb53c, 0xb553, 0xb53c, 0xb53c, 0xb53c, 0xb554, 0xb53c, 0xb53c,
+	0xb53c, 0xb557, 0xb57b, 0xb53c, 0x080c, 0x0d7d, 0x00c0, 0x2001,
+	0x000b, 0x00e8, 0x2001, 0x0003, 0x00d0, 0x2001, 0x0005, 0x00b8,
+	0x2001, 0x0001, 0x00a0, 0x2001, 0x0009, 0x0088, 0x6003, 0x0005,
+	0x080c, 0x96a0, 0x0058, 0x0018, 0x0010, 0x080c, 0x6575, 0x04b8,
+	0x080c, 0xcf6a, 0x6003, 0x0004, 0x080c, 0x96a0, 0x0005, 0x080c,
+	0x6575, 0x6003, 0x0002, 0x0036, 0x2019, 0x1852, 0x2304, 0x9084,
+	0xff00, 0x1120, 0x2001, 0x1986, 0x201c, 0x0040, 0x8007, 0x909a,
+	0x0004, 0x0ec0, 0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x003e,
+	0x080c, 0x96a0, 0x0c18, 0x080c, 0xccc4, 0x080c, 0xabed, 0x08f0,
+	0x00e6, 0x00f6, 0x2071, 0x189e, 0x2079, 0x0000, 0x080c, 0x35a5,
+	0x00fe, 0x00ee, 0x080c, 0x95de, 0x080c, 0xabed, 0x0878, 0x6003,
+	0x0002, 0x080c, 0xcf6a, 0x0804, 0x96a0, 0x2600, 0x2008, 0x0002,
+	0xb5ac, 0xb58f, 0xb5aa, 0xb58f, 0xb58f, 0xb5aa, 0xb5aa, 0xb5aa,
+	0xb5aa, 0xb58f, 0xb5aa, 0xb58f, 0xb5aa, 0xb58f, 0xb5aa, 0xb5aa,
+	0xb5aa, 0xb5aa, 0x080c, 0x0d7d, 0x0096, 0x6014, 0x2048, 0x080c,
+	0x6d80, 0x009e, 0x080c, 0xabed, 0x0005, 0x00e6, 0x0096, 0x0026,
+	0x0016, 0x080c, 0xc838, 0x0568, 0x6014, 0x2048, 0xa864, 0x9086,
+	0x0139, 0x11a8, 0xa894, 0x9086, 0x0056, 0x1148, 0x080c, 0x547b,
+	0x0130, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x0028, 0x2001,
+	0x0030, 0x900e, 0x2011, 0x4005, 0x080c, 0xce31, 0x0090, 0xa868,
+	0xd0fc, 0x0178, 0xa807, 0x0000, 0x0016, 0x6004, 0x908e, 0x0021,
+	0x0168, 0x908e, 0x003d, 0x0150, 0x001e, 0xa867, 0x0103, 0xa833,
+	0x0100, 0x001e, 0x002e, 0x009e, 0x00ee, 0x0005, 0x001e, 0x0009,
+	0x0cc0, 0x0096, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103,
+	0xa823, 0x8001, 0x009e, 0x0005, 0x00b6, 0x6610, 0x2658, 0xb804,
+	0x9084, 0x00ff, 0x90b2, 0x000c, 0x1a0c, 0x0d7d, 0x6604, 0x96b6,
+	0x004d, 0x1120, 0x080c, 0xcd50, 0x0804, 0xb681, 0x6604, 0x96b6,
+	0x0043, 0x1120, 0x080c, 0xcd99, 0x0804, 0xb681, 0x6604, 0x96b6,
+	0x004b, 0x1120, 0x080c, 0xcdc5, 0x0804, 0xb681, 0x6604, 0x96b6,
+	0x0033, 0x1120, 0x080c, 0xcce6, 0x0804, 0xb681, 0x6604, 0x96b6,
+	0x0028, 0x1120, 0x080c, 0xca86, 0x0804, 0xb681, 0x6604, 0x96b6,
+	0x0029, 0x1120, 0x080c, 0xcac7, 0x0804, 0xb681, 0x6604, 0x96b6,
+	0x001f, 0x1120, 0x080c, 0xafd2, 0x0804, 0xb681, 0x6604, 0x96b6,
+	0x0000, 0x1118, 0x080c, 0xb319, 0x04e0, 0x6604, 0x96b6, 0x0022,
+	0x1118, 0x080c, 0xb00a, 0x04a8, 0x6604, 0x96b6, 0x0035, 0x1118,
+	0x080c, 0xb130, 0x0470, 0x6604, 0x96b6, 0x0039, 0x1118, 0x080c,
+	0xb2ae, 0x0438, 0x6604, 0x96b6, 0x003d, 0x1118, 0x080c, 0xb042,
+	0x0400, 0x6604, 0x96b6, 0x0044, 0x1118, 0x080c, 0xb07e, 0x00c8,
+	0x6604, 0x96b6, 0x0049, 0x1118, 0x080c, 0xb0bf, 0x0090, 0x6604,
+	0x96b6, 0x0041, 0x1118, 0x080c, 0xb0a9, 0x0058, 0x91b6, 0x0015,
+	0x1110, 0x0063, 0x0030, 0x91b6, 0x0016, 0x1128, 0x00be, 0x0804,
+	0xb8db, 0x00be, 0x0005, 0x080c, 0xaca9, 0x0cd8, 0xb69e, 0xb6a1,
+	0xb69e, 0xb6e8, 0xb69e, 0xb84f, 0xb8e8, 0xb69e, 0xb69e, 0xb8b1,
+	0xb69e, 0xb8c7, 0x0096, 0x601f, 0x0000, 0x6014, 0x2048, 0xa800,
+	0x2048, 0xa867, 0x0103, 0x009e, 0x0804, 0xabed, 0xa001, 0xa001,
+	0x0005, 0x00e6, 0x2071, 0x1800, 0x7090, 0x9086, 0x0074, 0x1540,
+	0x080c, 0xdfbc, 0x11b0, 0x6010, 0x00b6, 0x2058, 0x7030, 0xd08c,
+	0x0128, 0xb800, 0xd0bc, 0x0110, 0xc0c5, 0xb802, 0x00f9, 0x00be,
+	0x2001, 0x0006, 0x080c, 0x6575, 0x080c, 0x321c, 0x080c, 0xabed,
+	0x0098, 0x2001, 0x000a, 0x080c, 0x6575, 0x080c, 0x321c, 0x6003,
+	0x0001, 0x6007, 0x0001, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0020,
+	0x2001, 0x0001, 0x080c, 0xb81f, 0x00ee, 0x0005, 0x00d6, 0xb800,
+	0xd084, 0x0160, 0x9006, 0x080c, 0x6561, 0x2069, 0x1847, 0x6804,
+	0xd0a4, 0x0120, 0x2001, 0x0006, 0x080c, 0x65a1, 0x00de, 0x0005,
+	0x00b6, 0x0096, 0x00d6, 0x2011, 0x1824, 0x2204, 0x9086, 0x0074,
+	0x1904, 0xb7f6, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x007e, 0x1120,
+	0x080c, 0xba35, 0x0804, 0xb75a, 0x080c, 0xba2a, 0x6010, 0x2058,
+	0xbaa0, 0x9286, 0x0080, 0x1510, 0x6014, 0x9005, 0x01a8, 0x2048,
+	0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000,
+	0x900e, 0x2011, 0x4000, 0x080c, 0xce31, 0x0030, 0xa807, 0x0000,
+	0xa867, 0x0103, 0xa833, 0x0200, 0x2001, 0x0006, 0x080c, 0x6575,
+	0x080c, 0x321c, 0x080c, 0xabed, 0x0804, 0xb7f9, 0x080c, 0xb807,
+	0x6014, 0x9005, 0x0190, 0x2048, 0xa868, 0xd0f4, 0x01e8, 0xa864,
+	0x9084, 0x00ff, 0x9086, 0x0039, 0x1d08, 0x2001, 0x0000, 0x900e,
+	0x2011, 0x4000, 0x080c, 0xce31, 0x08f8, 0x080c, 0xb7fd, 0x0160,
+	0x9006, 0x080c, 0x6561, 0x2001, 0x0004, 0x080c, 0x65a1, 0x2001,
+	0x0007, 0x080c, 0x6575, 0x08a0, 0x2001, 0x0004, 0x080c, 0x6575,
+	0x6003, 0x0001, 0x6007, 0x0003, 0x080c, 0x9225, 0x080c, 0x96a0,
+	0x0804, 0xb7f9, 0xb85c, 0xd0e4, 0x01d8, 0x080c, 0xcc5e, 0x080c,
+	0x74e9, 0x0118, 0xd0dc, 0x1904, 0xb71c, 0x2011, 0x1837, 0x2204,
+	0xc0ad, 0x2012, 0x2001, 0x196d, 0x2004, 0x00f6, 0x2079, 0x0100,
+	0x78e3, 0x0000, 0x080c, 0x266f, 0x78e2, 0x00fe, 0x0804, 0xb71c,
+	0x080c, 0xcc9f, 0x2011, 0x1837, 0x2204, 0xc0a5, 0x2012, 0x0006,
+	0x080c, 0xe14c, 0x000e, 0x1904, 0xb71c, 0xc0b5, 0x2012, 0x2001,
+	0x0006, 0x080c, 0x6575, 0x9006, 0x080c, 0x6561, 0x00c6, 0x2001,
+	0x180f, 0x2004, 0xd09c, 0x0520, 0x00f6, 0x2079, 0x0100, 0x00e6,
+	0x2071, 0x1800, 0x700c, 0x9084, 0x00ff, 0x78e6, 0x707e, 0x7010,
+	0x78ea, 0x7082, 0x908c, 0x00ff, 0x00ee, 0x780c, 0xc0b5, 0x780e,
+	0x00fe, 0x080c, 0x2644, 0x00f6, 0x2100, 0x900e, 0x080c, 0x25fb,
+	0x795e, 0x00fe, 0x9186, 0x0081, 0x01d8, 0x2009, 0x0081, 0x00c8,
+	0x2009, 0x00ef, 0x00f6, 0x2079, 0x0100, 0x79ea, 0x7932, 0x7936,
+	0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x2644, 0x00f6, 0x2079,
+	0x1800, 0x7982, 0x2100, 0x900e, 0x080c, 0x25fb, 0x795e, 0x00fe,
+	0x8108, 0x080c, 0x65c4, 0x2b00, 0x00ce, 0x1904, 0xb71c, 0x6012,
+	0x2009, 0x180f, 0x210c, 0xd19c, 0x0150, 0x2009, 0x027c, 0x210c,
+	0x918c, 0x00ff, 0xb912, 0x2009, 0x027d, 0x210c, 0xb916, 0x2001,
+	0x0002, 0x080c, 0x6575, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007,
+	0x0002, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0018, 0x2001, 0x0001,
+	0x0431, 0x00de, 0x009e, 0x00be, 0x0005, 0x2001, 0x1810, 0x2004,
+	0xd0a4, 0x0120, 0x2001, 0x1848, 0x2004, 0xd0ac, 0x0005, 0x00e6,
+	0x080c, 0xe689, 0x0190, 0x2071, 0x0260, 0x7108, 0x720c, 0x918c,
+	0x00ff, 0x1118, 0x9284, 0xff00, 0x0140, 0x6010, 0x2058, 0xb8a0,
+	0x9084, 0xff80, 0x1110, 0xb912, 0xba16, 0x00ee, 0x0005, 0x2030,
+	0x9005, 0x0158, 0x2001, 0x0007, 0x080c, 0x6575, 0x080c, 0x56ee,
+	0x1120, 0x2001, 0x0007, 0x080c, 0x65a1, 0x2600, 0x9005, 0x11b0,
+	0x6014, 0x0096, 0x2048, 0xa868, 0x009e, 0xd0fc, 0x1178, 0x0036,
+	0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004,
+	0x2011, 0x8014, 0x080c, 0x4b07, 0x004e, 0x003e, 0x080c, 0x321c,
+	0x6020, 0x9086, 0x000a, 0x1108, 0x0005, 0x0804, 0xabed, 0x00b6,
+	0x00e6, 0x0026, 0x0016, 0x2071, 0x1800, 0x7090, 0x9086, 0x0014,
+	0x1904, 0xb8a7, 0x080c, 0x56ee, 0x1170, 0x6014, 0x9005, 0x1158,
+	0x0036, 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021, 0x0006, 0x080c,
+	0x4cbe, 0x004e, 0x003e, 0x00d6, 0x6010, 0x2058, 0x080c, 0x66c0,
+	0x080c, 0xb6d6, 0x00de, 0x080c, 0xbafb, 0x1588, 0x6010, 0x2058,
+	0xb890, 0x9005, 0x0560, 0x2001, 0x0006, 0x080c, 0x6575, 0x0096,
+	0x6014, 0x904d, 0x01d0, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
+	0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xce31,
+	0x0060, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0029, 0x0130, 0xa807,
+	0x0000, 0xa867, 0x0103, 0xa833, 0x0200, 0x009e, 0x080c, 0x321c,
+	0x6020, 0x9086, 0x000a, 0x0140, 0x080c, 0xabed, 0x0028, 0x080c,
+	0xb5b5, 0x9006, 0x080c, 0xb81f, 0x001e, 0x002e, 0x00ee, 0x00be,
+	0x0005, 0x2011, 0x1824, 0x2204, 0x9086, 0x0014, 0x1160, 0x2001,
+	0x0002, 0x080c, 0x6575, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c,
+	0x9225, 0x0804, 0x96a0, 0x2001, 0x0001, 0x0804, 0xb81f, 0x2030,
+	0x2011, 0x1824, 0x2204, 0x9086, 0x0004, 0x1148, 0x96b6, 0x000b,
+	0x1120, 0x2001, 0x0007, 0x080c, 0x6575, 0x0804, 0xabed, 0x2001,
+	0x0001, 0x0804, 0xb81f, 0x0002, 0xb69e, 0xb8f3, 0xb69e, 0xb934,
+	0xb69e, 0xb9e1, 0xb8e8, 0xb69e, 0xb69e, 0xb9f5, 0xb69e, 0xba07,
+	0x6604, 0x9686, 0x0003, 0x0904, 0xb84f, 0x96b6, 0x001e, 0x1110,
+	0x080c, 0xabed, 0x0005, 0x00b6, 0x00d6, 0x00c6, 0x080c, 0xba19,
+	0x11a0, 0x9006, 0x080c, 0x6561, 0x080c, 0x31e7, 0x080c, 0xcf67,
+	0x2001, 0x0002, 0x080c, 0x6575, 0x6003, 0x0001, 0x6007, 0x0002,
+	0x080c, 0x9225, 0x080c, 0x96a0, 0x0418, 0x2009, 0x026e, 0x2104,
+	0x9086, 0x0009, 0x1160, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff,
+	0x9005, 0x0170, 0x8001, 0xb842, 0x601b, 0x000a, 0x0088, 0x2009,
+	0x026f, 0x2104, 0x9084, 0xff00, 0x9086, 0x1900, 0x1108, 0x08a0,
+	0x080c, 0x31e7, 0x080c, 0xcf67, 0x2001, 0x0001, 0x080c, 0xb81f,
+	0x00ce, 0x00de, 0x00be, 0x0005, 0x0096, 0x00b6, 0x0026, 0x9016,
+	0x080c, 0xba27, 0x00d6, 0x2069, 0x197c, 0x2d04, 0x9005, 0x0168,
+	0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1138, 0x2069, 0x1820,
+	0x2d04, 0x8000, 0x206a, 0x00de, 0x0010, 0x00de, 0x0088, 0x9006,
+	0x080c, 0x6561, 0x2001, 0x0002, 0x080c, 0x6575, 0x6003, 0x0001,
+	0x6007, 0x0002, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0804, 0xb9b1,
+	0x080c, 0xc838, 0x01b0, 0x6014, 0x2048, 0xa864, 0x2010, 0x9086,
+	0x0139, 0x1138, 0x6007, 0x0016, 0x2001, 0x0002, 0x080c, 0xce8b,
+	0x00b0, 0x6014, 0x2048, 0xa864, 0xd0fc, 0x0118, 0x2001, 0x0001,
+	0x0ca8, 0x2001, 0x180e, 0x2004, 0xd0dc, 0x0148, 0x6010, 0x2058,
+	0xb840, 0x9084, 0x00ff, 0x9005, 0x1110, 0x9006, 0x0c38, 0x080c,
+	0xb5b5, 0x2009, 0x026e, 0x2134, 0x96b4, 0x00ff, 0x9686, 0x0005,
+	0x0520, 0x9686, 0x000b, 0x01c8, 0x2009, 0x026f, 0x2104, 0x9084,
+	0xff00, 0x1118, 0x9686, 0x0009, 0x01c0, 0x9086, 0x1900, 0x1168,
+	0x9686, 0x0009, 0x0190, 0x2001, 0x0004, 0x080c, 0x6575, 0x2001,
+	0x0028, 0x601a, 0x6007, 0x0052, 0x0020, 0x2001, 0x0001, 0x080c,
+	0xb81f, 0x002e, 0x00be, 0x009e, 0x0005, 0x9286, 0x0139, 0x0160,
+	0x6014, 0x2048, 0x080c, 0xc838, 0x0140, 0xa864, 0x9086, 0x0139,
+	0x0118, 0xa868, 0xd0fc, 0x0108, 0x0c40, 0x6010, 0x2058, 0xb840,
+	0x9084, 0x00ff, 0x9005, 0x0138, 0x8001, 0xb842, 0x601b, 0x000a,
+	0x6007, 0x0016, 0x08f0, 0xb8a0, 0x9086, 0x007e, 0x1138, 0x00e6,
+	0x2071, 0x1800, 0x080c, 0x5fbc, 0x00ee, 0x0010, 0x080c, 0x31e7,
+	0x0860, 0x080c, 0xba27, 0x1160, 0x2001, 0x0004, 0x080c, 0x6575,
+	0x6003, 0x0001, 0x6007, 0x0003, 0x080c, 0x9225, 0x0804, 0x96a0,
+	0x080c, 0xb5b5, 0x9006, 0x0804, 0xb81f, 0x0489, 0x1160, 0x2001,
+	0x0008, 0x080c, 0x6575, 0x6003, 0x0001, 0x6007, 0x0005, 0x080c,
+	0x9225, 0x0804, 0x96a0, 0x2001, 0x0001, 0x0804, 0xb81f, 0x00f9,
+	0x1160, 0x2001, 0x000a, 0x080c, 0x6575, 0x6003, 0x0001, 0x6007,
+	0x0001, 0x080c, 0x9225, 0x0804, 0x96a0, 0x2001, 0x0001, 0x0804,
+	0xb81f, 0x2009, 0x026e, 0x2104, 0x9086, 0x0003, 0x1138, 0x2009,
+	0x026f, 0x2104, 0x9084, 0xff00, 0x9086, 0x2a00, 0x0005, 0x9085,
+	0x0001, 0x0005, 0x00b6, 0x00c6, 0x0016, 0x6110, 0x2158, 0x080c,
+	0x6634, 0x001e, 0x00ce, 0x00be, 0x0005, 0x00b6, 0x00f6, 0x00e6,
+	0x00d6, 0x0036, 0x0016, 0x6010, 0x2058, 0x2009, 0x1837, 0x2104,
+	0x9085, 0x0003, 0x200a, 0x080c, 0xbacd, 0x0560, 0x2009, 0x1837,
+	0x2104, 0xc0cd, 0x200a, 0x080c, 0x6a67, 0x0158, 0x9006, 0x2020,
+	0x2009, 0x002a, 0x080c, 0xe2c9, 0x2001, 0x180c, 0x200c, 0xc195,
+	0x2102, 0x2019, 0x002a, 0x2009, 0x0001, 0x080c, 0x31a6, 0x00e6,
+	0x2071, 0x1800, 0x080c, 0x2fb2, 0x00ee, 0x00c6, 0x0156, 0x20a9,
+	0x0781, 0x2009, 0x007f, 0x080c, 0x32fc, 0x8108, 0x1f04, 0xba6b,
+	0x015e, 0x00ce, 0x080c, 0xba2a, 0x2071, 0x0260, 0x2079, 0x0200,
+	0x7817, 0x0001, 0x2001, 0x1837, 0x200c, 0xc1c5, 0x7018, 0xd0fc,
+	0x0110, 0xd0dc, 0x0118, 0x7038, 0xd0dc, 0x1108, 0xc1c4, 0x7817,
+	0x0000, 0x2001, 0x1837, 0x2102, 0x2079, 0x0100, 0x2e04, 0x9084,
+	0x00ff, 0x2069, 0x181f, 0x206a, 0x78e6, 0x0006, 0x8e70, 0x2e04,
+	0x2069, 0x1820, 0x206a, 0x78ea, 0x7832, 0x7836, 0x2010, 0x9084,
+	0xff00, 0x001e, 0x9105, 0x2009, 0x182c, 0x200a, 0x2200, 0x9084,
+	0x00ff, 0x2008, 0x080c, 0x2644, 0x080c, 0x74e9, 0x0170, 0x2071,
+	0x0260, 0x2069, 0x1982, 0x7048, 0x206a, 0x704c, 0x6806, 0x7050,
+	0x680a, 0x7054, 0x680e, 0x080c, 0xcc5e, 0x0040, 0x2001, 0x0006,
+	0x080c, 0x6575, 0x080c, 0x321c, 0x080c, 0xabed, 0x001e, 0x003e,
+	0x00de, 0x00ee, 0x00fe, 0x00be, 0x0005, 0x0096, 0x0026, 0x0036,
+	0x00e6, 0x0156, 0x2019, 0x182c, 0x231c, 0x83ff, 0x01f0, 0x2071,
+	0x0260, 0x7200, 0x9294, 0x00ff, 0x7004, 0x9084, 0xff00, 0x9205,
+	0x9306, 0x1198, 0x2011, 0x0276, 0x20a9, 0x0004, 0x2b48, 0x2019,
+	0x000a, 0x080c, 0xbbc2, 0x1148, 0x2011, 0x027a, 0x20a9, 0x0004,
+	0x2019, 0x0006, 0x080c, 0xbbc2, 0x1100, 0x015e, 0x00ee, 0x003e,
+	0x002e, 0x009e, 0x0005, 0x00e6, 0x2071, 0x0260, 0x7034, 0x9086,
+	0x0014, 0x11a8, 0x7038, 0x9086, 0x0800, 0x1188, 0x703c, 0xd0ec,
+	0x0160, 0x9084, 0x0f00, 0x9086, 0x0100, 0x1138, 0x7054, 0xd0a4,
+	0x1110, 0xd0ac, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ee,
+	0x0005, 0x00e6, 0x0096, 0x00c6, 0x0076, 0x0056, 0x0046, 0x0026,
+	0x0006, 0x0126, 0x2091, 0x8000, 0x2029, 0x19f3, 0x252c, 0x2021,
+	0x19fa, 0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7254, 0x7074,
+	0x9202, 0x1a04, 0xbb8e, 0x080c, 0x8b90, 0x0904, 0xbb87, 0x080c,
+	0xe2fa, 0x0904, 0xbb87, 0x6720, 0x9786, 0x0007, 0x0904, 0xbb87,
+	0x2500, 0x9c06, 0x0904, 0xbb87, 0x2400, 0x9c06, 0x0904, 0xbb87,
+	0x3e08, 0x9186, 0x0002, 0x1148, 0x6010, 0x9005, 0x0130, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0bc, 0x1590, 0x00c6, 0x6043, 0xffff,
+	0x6000, 0x9086, 0x0004, 0x1110, 0x080c, 0x1a6a, 0x9786, 0x000a,
+	0x0148, 0x080c, 0xca4d, 0x1130, 0x00ce, 0x080c, 0xb5b5, 0x080c,
+	0xac28, 0x00e8, 0x6014, 0x2048, 0x080c, 0xc838, 0x01a8, 0x9786,
+	0x0003, 0x1530, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096,
+	0xa878, 0x2048, 0x080c, 0x0fec, 0x009e, 0xab7a, 0xa877, 0x0000,
+	0x080c, 0x6d74, 0x080c, 0xca27, 0x080c, 0xac28, 0x00ce, 0x9ce0,
+	0x001c, 0x7068, 0x9c02, 0x1210, 0x0804, 0xbb2e, 0x012e, 0x000e,
+	0x002e, 0x004e, 0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee, 0x0005,
+	0x9786, 0x0006, 0x1118, 0x080c, 0xe26c, 0x0c30, 0x9786, 0x0009,
+	0x1148, 0x6000, 0x9086, 0x0004, 0x0d08, 0x2009, 0x004c, 0x080c,
+	0xac8c, 0x08e0, 0x9786, 0x000a, 0x0938, 0x0820, 0x220c, 0x2304,
+	0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xbbae, 0x9006, 0x0005,
+	0x2304, 0x9102, 0x0218, 0x2001, 0x0001, 0x0008, 0x9006, 0x918d,
+	0x0001, 0x0005, 0x0136, 0x01c6, 0x0016, 0x8906, 0x8006, 0x8007,
+	0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9300, 0x2098, 0x3518,
+	0x20a9, 0x0001, 0x220c, 0x4002, 0x910e, 0x1140, 0x8210, 0x8319,
+	0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e, 0x0005, 0x220c, 0x9102,
+	0x0218, 0x2001, 0x0001, 0x0010, 0x2001, 0x0000, 0x918d, 0x0001,
+	0x001e, 0x01ce, 0x013e, 0x0005, 0x220c, 0x810f, 0x2304, 0x9106,
+	0x1130, 0x8210, 0x8318, 0x1f04, 0xbbec, 0x9006, 0x0005, 0x918d,
+	0x0001, 0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d7d, 0x080c,
+	0xca3c, 0x0120, 0x080c, 0xca4d, 0x0158, 0x0028, 0x080c, 0x321c,
+	0x080c, 0xca4d, 0x0128, 0x080c, 0x95de, 0x080c, 0xabed, 0x0005,
+	0x080c, 0xb5b5, 0x0cc0, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040,
+	0x0208, 0x000a, 0x0005, 0xbc32, 0xbc32, 0xbc32, 0xbc32, 0xbc32,
+	0xbc32, 0xbc32, 0xbc32, 0xbc32, 0xbc32, 0xbc32, 0xbc34, 0xbc34,
+	0xbc34, 0xbc34, 0xbc32, 0xbc32, 0xbc32, 0xbc34, 0xbc32, 0xbc32,
+	0xbc32, 0xbc32, 0x080c, 0x0d7d, 0x600b, 0xffff, 0x6003, 0x000f,
+	0x6106, 0x0126, 0x2091, 0x8000, 0x080c, 0xcf6a, 0x2009, 0x8000,
+	0x080c, 0x921e, 0x012e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004,
+	0x9082, 0x0040, 0x0804, 0xbcb9, 0x9186, 0x0027, 0x1520, 0x080c,
+	0x95de, 0x080c, 0x31e7, 0x080c, 0xcf67, 0x0096, 0x6114, 0x2148,
+	0x080c, 0xc838, 0x0198, 0x080c, 0xca4d, 0x1118, 0x080c, 0xb5b5,
+	0x0068, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0xa97c,
+	0xc1c5, 0xa97e, 0x080c, 0x6d80, 0x080c, 0xca27, 0x009e, 0x080c,
+	0xabed, 0x0804, 0x96a0, 0x9186, 0x0014, 0x1120, 0x6004, 0x9082,
+	0x0040, 0x0018, 0x080c, 0x0d7d, 0x0005, 0x0002, 0xbc97, 0xbc95,
+	0xbc95, 0xbc95, 0xbc95, 0xbc95, 0xbc95, 0xbc95, 0xbc95, 0xbc95,
+	0xbc95, 0xbcb0, 0xbcb0, 0xbcb0, 0xbcb0, 0xbc95, 0xbcb0, 0xbc95,
+	0xbcb0, 0xbc95, 0xbc95, 0xbc95, 0xbc95, 0x080c, 0x0d7d, 0x080c,
+	0x95de, 0x0096, 0x6114, 0x2148, 0x080c, 0xc838, 0x0168, 0xa867,
+	0x0103, 0xa87b, 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ec, 0xa882,
+	0x080c, 0x6d80, 0x080c, 0xca27, 0x009e, 0x080c, 0xabed, 0x0005,
+	0x080c, 0x95de, 0x080c, 0xca4d, 0x090c, 0xb5b5, 0x080c, 0xabed,
+	0x0005, 0x0002, 0xbcd3, 0xbcd1, 0xbcd1, 0xbcd1, 0xbcd1, 0xbcd1,
+	0xbcd1, 0xbcd1, 0xbcd1, 0xbcd1, 0xbcd1, 0xbcd5, 0xbcd5, 0xbcd5,
+	0xbcd5, 0xbcd1, 0xbcd7, 0xbcd1, 0xbcd5, 0xbcd1, 0xbcd1, 0xbcd1,
+	0xbcd1, 0x080c, 0x0d7d, 0x080c, 0x0d7d, 0x080c, 0x0d7d, 0x080c,
+	0xabed, 0x0804, 0x96a0, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040,
+	0x0208, 0x000a, 0x0005, 0xbcfa, 0xbcfa, 0xbcfa, 0xbcfa, 0xbcfa,
+	0xbd33, 0xbe22, 0xbcfa, 0xbe2e, 0xbcfa, 0xbcfa, 0xbcfa, 0xbcfa,
+	0xbcfa, 0xbcfa, 0xbcfa, 0xbcfa, 0xbcfa, 0xbcfa, 0xbe2e, 0xbcfc,
+	0xbcfa, 0xbe2c, 0x080c, 0x0d7d, 0x00b6, 0x0096, 0x6114, 0x2148,
+	0x6010, 0x2058, 0xb800, 0xd0bc, 0x1508, 0xa87b, 0x0000, 0xa867,
+	0x0103, 0xa877, 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
+	0x9115, 0x190c, 0xbeb3, 0x080c, 0x6b96, 0x6210, 0x2258, 0xba3c,
+	0x82ff, 0x0110, 0x8211, 0xba3e, 0xb8d0, 0x9005, 0x0110, 0x080c,
+	0x6750, 0x080c, 0xabed, 0x009e, 0x00be, 0x0005, 0xa87c, 0xd0ac,
+	0x09e0, 0xa838, 0xa934, 0x9105, 0x09c0, 0xa880, 0xd0bc, 0x19a8,
+	0x080c, 0xcb7d, 0x0c80, 0x00b6, 0x0096, 0x6114, 0x2148, 0x601c,
+	0xd0fc, 0x1110, 0x7644, 0x0008, 0x9036, 0x96b4, 0x0fff, 0x86ff,
+	0x1590, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xbe11, 0xa87b,
+	0x0000, 0xa867, 0x0103, 0xae76, 0xa87c, 0xd0ac, 0x0128, 0xa834,
+	0xa938, 0x9115, 0x190c, 0xbeb3, 0x080c, 0x6b96, 0x6210, 0x2258,
+	0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0xb8d0, 0x9005, 0x0110,
+	0x080c, 0x6750, 0x601c, 0xd0fc, 0x1148, 0x7044, 0xd0e4, 0x1904,
+	0xbdf5, 0x080c, 0xabed, 0x009e, 0x00be, 0x0005, 0x2009, 0x0211,
+	0x210c, 0x080c, 0x0d7d, 0x968c, 0x0c00, 0x0150, 0x6010, 0x2058,
+	0xb800, 0xd0bc, 0x1904, 0xbdf9, 0x7348, 0xab92, 0x734c, 0xab8e,
+	0x968c, 0x00ff, 0x9186, 0x0002, 0x0508, 0x9186, 0x0028, 0x1118,
+	0xa87b, 0x001c, 0x00e8, 0xd6dc, 0x01a0, 0xa87b, 0x0015, 0xa87c,
+	0xd0ac, 0x0170, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0148, 0x7048,
+	0x9106, 0x1118, 0x704c, 0x9206, 0x0118, 0xa992, 0xaa8e, 0xc6dc,
+	0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000,
+	0xa867, 0x0103, 0xae76, 0x901e, 0xd6c4, 0x01d8, 0x9686, 0x0100,
+	0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0x0804, 0xbd3f, 0x735c,
+	0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008,
+	0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xc40b,
+	0x003e, 0xd6cc, 0x0904, 0xbd54, 0x7154, 0xa98a, 0x81ff, 0x0904,
+	0xbd54, 0x9192, 0x0021, 0x1278, 0x8304, 0x9098, 0x0018, 0x2011,
+	0x0029, 0x080c, 0xc40b, 0x2011, 0x0205, 0x2013, 0x0000, 0x080c,
+	0xcef7, 0x0804, 0xbd54, 0xa868, 0xd0fc, 0x0120, 0x2009, 0x0020,
+	0xa98a, 0x0c50, 0x00a6, 0x2950, 0x080c, 0xc3aa, 0x00ae, 0x080c,
+	0xcef7, 0x080c, 0xc3fb, 0x0804, 0xbd56, 0x080c, 0xcb40, 0x0804,
+	0xbd6b, 0xa87c, 0xd0ac, 0x0904, 0xbd7c, 0xa880, 0xd0bc, 0x1904,
+	0xbd7c, 0x7348, 0xa838, 0x9306, 0x11c8, 0x734c, 0xa834, 0x931e,
+	0x0904, 0xbd7c, 0xd6d4, 0x0190, 0xab38, 0x9305, 0x0904, 0xbd7c,
+	0x0068, 0xa87c, 0xd0ac, 0x0904, 0xbd47, 0xa838, 0xa934, 0x9105,
+	0x0904, 0xbd47, 0xa880, 0xd0bc, 0x1904, 0xbd47, 0x080c, 0xcb7d,
+	0x0804, 0xbd6b, 0x00f6, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c,
+	0x7d08, 0x00fe, 0x0021, 0x0005, 0x0011, 0x0005, 0x0005, 0x0096,
+	0x6003, 0x0002, 0x6007, 0x0043, 0x6014, 0x2048, 0xa87c, 0xd0ac,
+	0x0128, 0x009e, 0x0005, 0x2130, 0x2228, 0x0058, 0x2400, 0xa9ac,
+	0x910a, 0x2300, 0xaab0, 0x9213, 0x2600, 0x9102, 0x2500, 0x9203,
+	0x0e90, 0xac46, 0xab4a, 0xae36, 0xad3a, 0x6044, 0xd0fc, 0x190c,
+	0xa8bf, 0x604b, 0x0000, 0x080c, 0x1c30, 0x1118, 0x6144, 0x080c,
+	0x924a, 0x009e, 0x0005, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040,
+	0x0208, 0x000a, 0x0005, 0xbe7a, 0xbe7a, 0xbe7a, 0xbe7a, 0xbe7a,
+	0xbe7a, 0xbe7a, 0xbe7a, 0xbe7a, 0xbe7a, 0xbe7c, 0xbe7a, 0xbe7a,
+	0xbe7a, 0xbe7a, 0xbe8d, 0xbe7a, 0xbe7a, 0xbe7a, 0xbe7a, 0xbeb1,
+	0xbe7a, 0xbe7a, 0x080c, 0x0d7d, 0x6004, 0x9086, 0x0040, 0x1110,
+	0x080c, 0x95de, 0x2019, 0x0001, 0x080c, 0xa118, 0x6003, 0x0002,
+	0x080c, 0xcf6f, 0x080c, 0x963b, 0x0005, 0x6004, 0x9086, 0x0040,
+	0x1110, 0x080c, 0x95de, 0x2019, 0x0001, 0x080c, 0xa118, 0x080c,
+	0x963b, 0x080c, 0x31e7, 0x080c, 0xcf67, 0x0096, 0x6114, 0x2148,
+	0x080c, 0xc838, 0x0150, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877,
+	0x0000, 0x080c, 0x6d80, 0x080c, 0xca27, 0x009e, 0x080c, 0xabed,
+	0x0005, 0x080c, 0x0d7d, 0xa87b, 0x0015, 0xd1fc, 0x0180, 0xa87b,
+	0x0007, 0x8002, 0x8000, 0x810a, 0x9189, 0x0000, 0x0006, 0x0016,
+	0x2009, 0x1a78, 0x2104, 0x8000, 0x200a, 0x001e, 0x000e, 0xa992,
+	0xa88e, 0x0005, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208,
+	0x000a, 0x0005, 0xbee9, 0xbee9, 0xbee9, 0xbee9, 0xbee9, 0xbeeb,
+	0xbee9, 0xbee9, 0xbfa8, 0xbee9, 0xbee9, 0xbee9, 0xbee9, 0xbee9,
+	0xbee9, 0xbee9, 0xbee9, 0xbee9, 0xbee9, 0xc0ec, 0xbee9, 0xc0f6,
+	0xbee9, 0x080c, 0x0d7d, 0x601c, 0xd0bc, 0x0178, 0xd084, 0x0168,
+	0xd0f4, 0x0120, 0xc084, 0x601e, 0x0804, 0xbcdb, 0x6114, 0x0096,
+	0x2148, 0xa87c, 0xc0e5, 0xa87e, 0x009e, 0x0076, 0x00a6, 0x00e6,
+	0x0096, 0x2071, 0x0260, 0x6114, 0x2150, 0x601c, 0xd0fc, 0x1110,
+	0x7644, 0x0008, 0x9036, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5,
+	0xb77e, 0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211,
+	0xba3e, 0x00be, 0x86ff, 0x0904, 0xbfa1, 0x9694, 0xff00, 0x9284,
+	0x0c00, 0x0120, 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300,
+	0x0904, 0xbfa1, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118,
+	0xc6c4, 0xb676, 0x0c38, 0x080c, 0x103a, 0x090c, 0x0d7d, 0x2900,
+	0xb07a, 0xb77c, 0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103, 0xb068,
+	0xa86a, 0xb06c, 0xa86e, 0xb070, 0xa872, 0x7044, 0x9084, 0xf000,
+	0x9635, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c,
+	0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028,
+	0x1118, 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015,
+	0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000,
+	0xaf7e, 0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190,
+	0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019,
+	0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c,
+	0xc40b, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8,
+	0x9192, 0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029,
+	0x080c, 0xc40b, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068,
+	0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c,
+	0xc3aa, 0x080c, 0x1a48, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005,
+	0x2001, 0x1988, 0x2004, 0x604a, 0x0096, 0x6114, 0x2148, 0xa83c,
+	0xa940, 0x9105, 0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003, 0x0002,
+	0x080c, 0xcf78, 0x0904, 0xc0e7, 0x604b, 0x0000, 0x6010, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904, 0xc0a6,
+	0xa978, 0xa868, 0xd0fc, 0x0904, 0xc067, 0x0016, 0xa87c, 0x0006,
+	0xa880, 0x0006, 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6,
+	0x0002, 0x0904, 0xc035, 0x9086, 0x0028, 0x1904, 0xc021, 0xa87b,
+	0x001c, 0xb07b, 0x001c, 0x0804, 0xc03d, 0x6024, 0xd0f4, 0x11d0,
+	0xa838, 0xaa34, 0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206, 0x1120,
+	0xa88c, 0xaa34, 0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148, 0xa9ac,
+	0xa834, 0x9102, 0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e, 0x6024,
+	0xc0f5, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000, 0xb83e,
+	0x00be, 0x601c, 0xc0fc, 0x601e, 0x9006, 0xa876, 0xa892, 0xa88e,
+	0xa87c, 0xc0e4, 0xa87e, 0xd0cc, 0x0140, 0xc0cc, 0xa87e, 0x0096,
+	0xa878, 0x2048, 0x080c, 0x0fec, 0x009e, 0x080c, 0xcb7d, 0x0804,
+	0xc0e7, 0xd1dc, 0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c,
+	0xce1a, 0x0118, 0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128,
+	0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128,
+	0xa834, 0xa938, 0x9115, 0x190c, 0xbeb3, 0xa87c, 0xb07e, 0xa890,
+	0xb092, 0xa88c, 0xb08e, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0019,
+	0x20a0, 0x20a9, 0x0020, 0x8a06, 0x8006, 0x8007, 0x9094, 0x003f,
+	0x22e0, 0x9084, 0xffc0, 0x9080, 0x0019, 0x2098, 0x4003, 0x00ae,
+	0x000e, 0xa882, 0x000e, 0xa87e, 0x080c, 0xcef7, 0x001e, 0xa874,
+	0x0006, 0x2148, 0x080c, 0x0fec, 0x001e, 0x0804, 0xc0d3, 0x0016,
+	0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01e0,
+	0x9086, 0x0028, 0x1128, 0xa87b, 0x001c, 0xb07b, 0x001c, 0x00e0,
+	0xd1dc, 0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xce1a,
+	0x0118, 0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b,
+	0x0007, 0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834,
+	0xa938, 0x9115, 0x190c, 0xbeb3, 0xa890, 0xb092, 0xa88c, 0xb08e,
+	0xa87c, 0xb07e, 0x00ae, 0x080c, 0x0fec, 0x009e, 0x080c, 0xcef7,
+	0xa974, 0x0016, 0x080c, 0xc3fb, 0x001e, 0x0468, 0xa867, 0x0103,
+	0xa974, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01b0, 0x9086, 0x0028,
+	0x1118, 0xa87b, 0x001c, 0x00d0, 0xd1dc, 0x0148, 0xa87b, 0x0015,
+	0x080c, 0xce1a, 0x0118, 0xa974, 0xc1dc, 0xa976, 0x0078, 0xd1d4,
+	0x0118, 0xa87b, 0x0007, 0x0050, 0xa87b, 0x0000, 0xa87c, 0xd0ac,
+	0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xbeb3, 0xa974, 0x0016,
+	0x080c, 0x6b96, 0x001e, 0x6010, 0x00b6, 0x2058, 0xba3c, 0x82ff,
+	0x0110, 0x8211, 0xba3e, 0xb8d0, 0x9005, 0x0120, 0x0016, 0x080c,
+	0x6750, 0x001e, 0x00be, 0xd1e4, 0x1120, 0x080c, 0xabed, 0x009e,
+	0x0005, 0x080c, 0xcb40, 0x0cd8, 0x6114, 0x0096, 0x2148, 0xa97c,
+	0x080c, 0xcf78, 0x190c, 0x1a56, 0x009e, 0x0005, 0x0096, 0x6114,
+	0x2148, 0xa83c, 0xa940, 0x9105, 0x01e8, 0xa877, 0x0000, 0xa87b,
+	0x0000, 0xa867, 0x0103, 0x00b6, 0x6010, 0x2058, 0xa834, 0xa938,
+	0x9115, 0x11a0, 0x080c, 0x6b96, 0xba3c, 0x8211, 0x0208, 0xba3e,
+	0xb8d0, 0x9005, 0x0110, 0x080c, 0x6750, 0x080c, 0xabed, 0x00be,
+	0x009e, 0x0005, 0xa87c, 0xc0dc, 0xa87e, 0x08f8, 0xb800, 0xd0bc,
+	0x1120, 0xa834, 0x080c, 0xbeb3, 0x0c28, 0xa880, 0xd0bc, 0x1dc8,
+	0x080c, 0xcb7d, 0x0c60, 0x080c, 0x95de, 0x0010, 0x080c, 0x963b,
+	0x601c, 0xd084, 0x0110, 0x080c, 0x1a6a, 0x080c, 0xc838, 0x01f0,
+	0x0096, 0x6114, 0x2148, 0x080c, 0xca4d, 0x1118, 0x080c, 0xb5b5,
+	0x00a0, 0xa867, 0x0103, 0x2009, 0x180c, 0x210c, 0xd18c, 0x1198,
+	0xd184, 0x1170, 0x6108, 0xa97a, 0x918e, 0x0029, 0x1110, 0x080c,
+	0xe621, 0xa877, 0x0000, 0x080c, 0x6d80, 0x009e, 0x0804, 0xac28,
+	0xa87b, 0x0004, 0x0cb0, 0xa87b, 0x0004, 0x0c98, 0x9182, 0x0057,
+	0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xc17d, 0xc17d,
+	0xc17d, 0xc17d, 0xc17d, 0xc17f, 0xc17d, 0xc17d, 0xc17d, 0xc17d,
+	0xc17d, 0xc17d, 0xc17d, 0xc17d, 0xc17d, 0xc17d, 0xc17d, 0xc17d,
+	0xc17d, 0xc17d, 0xc1a3, 0xc17d, 0xc17d, 0x080c, 0x0d7d, 0x080c,
+	0x56e2, 0x01f8, 0x6014, 0x7144, 0x918c, 0x0fff, 0x9016, 0xd1c4,
+	0x0118, 0x7264, 0x9294, 0x00ff, 0x0096, 0x904d, 0x0188, 0xa87b,
+	0x0000, 0xa864, 0x9086, 0x0139, 0x0128, 0xa867, 0x0103, 0xa976,
+	0xaa96, 0x0030, 0xa897, 0x4000, 0xa99a, 0xaa9e, 0x080c, 0x6d80,
+	0x009e, 0x0804, 0xabed, 0x080c, 0x56e2, 0x0dd8, 0x6014, 0x900e,
+	0x9016, 0x0c10, 0x9182, 0x0085, 0x0002, 0xc1bc, 0xc1ba, 0xc1ba,
+	0xc1c8, 0xc1ba, 0xc1ba, 0xc1ba, 0xc1ba, 0xc1ba, 0xc1ba, 0xc1ba,
+	0xc1ba, 0xc1ba, 0x080c, 0x0d7d, 0x6003, 0x0001, 0x6106, 0x0126,
+	0x2091, 0x8000, 0x2009, 0x8020, 0x080c, 0x921e, 0x012e, 0x0005,
+	0x0026, 0x0056, 0x00d6, 0x00e6, 0x2071, 0x0260, 0x7224, 0x6216,
+	0x7220, 0x080c, 0xc826, 0x01a0, 0x2268, 0x6800, 0x9086, 0x0000,
+	0x0178, 0x6010, 0x6d10, 0x952e, 0x1158, 0x00c6, 0x2d60, 0x080c,
+	0xc436, 0x00ce, 0x0128, 0x6803, 0x0002, 0x6007, 0x0086, 0x0010,
+	0x6007, 0x0087, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x921e,
+	0x9280, 0x0004, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0140,
+	0x6824, 0xd0ec, 0x0128, 0x00c6, 0x2260, 0x080c, 0xcb7d, 0x00ce,
+	0x00ee, 0x00de, 0x005e, 0x002e, 0x0005, 0x9186, 0x0013, 0x1160,
+	0x6004, 0x908a, 0x0085, 0x0a0c, 0x0d7d, 0x908a, 0x0092, 0x1a0c,
+	0x0d7d, 0x9082, 0x0085, 0x00e2, 0x9186, 0x0027, 0x0120, 0x9186,
+	0x0014, 0x190c, 0x0d7d, 0x080c, 0x95de, 0x0096, 0x6014, 0x2048,
+	0x080c, 0xc838, 0x0140, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b,
+	0x0029, 0x080c, 0x6d80, 0x009e, 0x080c, 0xac28, 0x0804, 0x96a0,
+	0xc23d, 0xc23f, 0xc23f, 0xc23d, 0xc23d, 0xc23d, 0xc23d, 0xc23d,
+	0xc23d, 0xc23d, 0xc23d, 0xc23d, 0xc23d, 0x080c, 0x0d7d, 0x080c,
+	0xac28, 0x0005, 0x9186, 0x0013, 0x1130, 0x6004, 0x9082, 0x0085,
+	0x2008, 0x0804, 0xc28e, 0x9186, 0x0027, 0x1558, 0x080c, 0x95de,
+	0x080c, 0x31e7, 0x080c, 0xcf67, 0x0096, 0x6014, 0x2048, 0x080c,
+	0xc838, 0x0150, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029,
+	0x080c, 0x6d80, 0x080c, 0xca27, 0x009e, 0x080c, 0xabed, 0x0005,
+	0x9186, 0x0089, 0x0118, 0x9186, 0x008a, 0x1140, 0x080c, 0xaaa8,
+	0x0128, 0x9086, 0x000c, 0x0904, 0xc2c6, 0x0000, 0x080c, 0xaca9,
+	0x0c70, 0x9186, 0x0014, 0x1d60, 0x080c, 0x95de, 0x0096, 0x6014,
+	0x2048, 0x080c, 0xc838, 0x0d00, 0xa867, 0x0103, 0xa877, 0x0000,
+	0xa87b, 0x0006, 0xa880, 0xc0ec, 0xa882, 0x0890, 0x0002, 0xc29e,
+	0xc29c, 0xc29c, 0xc29c, 0xc29c, 0xc29c, 0xc2b2, 0xc29c, 0xc29c,
+	0xc29c, 0xc29c, 0xc29c, 0xc29c, 0x080c, 0x0d7d, 0x6034, 0x908c,
 	0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118,
 	0x2001, 0x1986, 0x0010, 0x2001, 0x1987, 0x2004, 0x601a, 0x6003,
-	0x000e, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208,
-	0x0012, 0x0804, 0xac85, 0xc2b8, 0xc2b8, 0xc2b8, 0xc2b8, 0xc2ba,
-	0xc307, 0xc2b8, 0xc2b8, 0xc2b8, 0xc2b8, 0xc2b8, 0xc2b8, 0xc2b8,
-	0x080c, 0x0d7d, 0x0096, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-	0xd0bc, 0x0168, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
-	0x0118, 0x9186, 0x0035, 0x1118, 0x009e, 0x0804, 0xc31b, 0x080c,
-	0xc814, 0x1118, 0x080c, 0xca03, 0x0068, 0x6014, 0x2048, 0x080c,
-	0xcf5a, 0x1110, 0x080c, 0xca03, 0xa867, 0x0103, 0x080c, 0xcf0e,
-	0x080c, 0x6d70, 0x00d6, 0x2c68, 0x080c, 0xab73, 0x01d0, 0x6003,
-	0x0001, 0x6007, 0x001e, 0x600b, 0xffff, 0x2009, 0x026e, 0x210c,
-	0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x6910, 0x6112, 0x080c,
-	0xcca8, 0x695c, 0x615e, 0x6023, 0x0001, 0x2009, 0x8020, 0x080c,
-	0x91ed, 0x2d60, 0x00de, 0x080c, 0xabc9, 0x009e, 0x0005, 0x6010,
-	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x05a0, 0x6034, 0x908c,
-	0xff00, 0x810f, 0x9186, 0x0035, 0x0130, 0x9186, 0x001e, 0x0118,
-	0x9186, 0x0039, 0x1538, 0x00d6, 0x2c68, 0x080c, 0xcea6, 0x11f0,
-	0x080c, 0xab73, 0x01d8, 0x6106, 0x6003, 0x0001, 0x6023, 0x0001,
-	0x6910, 0x6112, 0x692c, 0x612e, 0x6930, 0x6132, 0x6934, 0x918c,
-	0x00ff, 0x6136, 0x6938, 0x613a, 0x693c, 0x613e, 0x695c, 0x615e,
-	0x080c, 0xcca8, 0x2009, 0x8020, 0x080c, 0x91ed, 0x2d60, 0x00de,
-	0x0804, 0xabc9, 0x0096, 0x6014, 0x2048, 0x080c, 0xc814, 0x01c8,
-	0xa867, 0x0103, 0xa880, 0xd0b4, 0x0128, 0xc0ec, 0xa882, 0xa87b,
-	0x0006, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b,
-	0x0005, 0x080c, 0xcb18, 0xa877, 0x0000, 0x080c, 0x6d70, 0x080c,
-	0xca03, 0x009e, 0x0804, 0xabc9, 0x0016, 0x0096, 0x6014, 0x2048,
-	0x080c, 0xc814, 0x0140, 0xa867, 0x0103, 0xa87b, 0x0028, 0xa877,
-	0x0000, 0x080c, 0x6d70, 0x009e, 0x001e, 0x9186, 0x0013, 0x0158,
-	0x9186, 0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xac85,
-	0x0020, 0x080c, 0x95ad, 0x080c, 0xac04, 0x0005, 0x0056, 0x0066,
-	0x0096, 0x00a6, 0x2029, 0x0001, 0x9182, 0x0101, 0x1208, 0x0010,
-	0x2009, 0x0100, 0x2130, 0x8304, 0x9098, 0x0018, 0x2009, 0x0020,
-	0x2011, 0x0029, 0x080c, 0xc3e7, 0x96b2, 0x0020, 0xb004, 0x904d,
-	0x0110, 0x080c, 0x0fec, 0x080c, 0x103a, 0x0520, 0x8528, 0xa867,
-	0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1228,
-	0x2608, 0x2011, 0x001b, 0x0499, 0x00a8, 0x96b2, 0x003c, 0x2009,
-	0x003c, 0x2950, 0x2011, 0x001b, 0x0451, 0x0c28, 0x2001, 0x0205,
-	0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x95ac,
-	0x0000, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f,
-	0x95ad, 0x0003, 0xb566, 0x009e, 0x006e, 0x005e, 0x0005, 0x00a6,
-	0x89ff, 0x0158, 0xa804, 0x9055, 0x0130, 0xa807, 0x0000, 0x080c,
-	0x6d70, 0x2a48, 0x0cb8, 0x080c, 0x6d70, 0x00ae, 0x0005, 0x00f6,
-	0x2079, 0x0200, 0x7814, 0x9085, 0x0080, 0x7816, 0xd184, 0x0108,
-	0x8108, 0x810c, 0x20a9, 0x0001, 0xa860, 0x20e8, 0xa85c, 0x9200,
-	0x20a0, 0x20e1, 0x0000, 0x2300, 0x9e00, 0x2098, 0x4003, 0x8318,
-	0x9386, 0x0020, 0x1148, 0x2018, 0x2300, 0x9e00, 0x2098, 0x7814,
-	0x8000, 0x9085, 0x0080, 0x7816, 0x8109, 0x1d80, 0x7817, 0x0000,
-	0x00fe, 0x0005, 0x0066, 0x0126, 0x2091, 0x8000, 0x2031, 0x0001,
-	0x6020, 0x9084, 0x000f, 0x0083, 0x012e, 0x006e, 0x0005, 0x0126,
-	0x2091, 0x8000, 0x0066, 0x2031, 0x0000, 0x6020, 0x9084, 0x000f,
-	0x001b, 0x006e, 0x012e, 0x0005, 0xc464, 0xc464, 0xc45f, 0xc488,
-	0xc43c, 0xc45f, 0xc43e, 0xc45f, 0xc43c, 0x90b3, 0xc45f, 0xc45f,
-	0xc45f, 0xc43c, 0xc43c, 0xc43c, 0x080c, 0x0d7d, 0x6010, 0x9080,
-	0x0000, 0x2004, 0xd0bc, 0x190c, 0xc488, 0x0036, 0x6014, 0x0096,
-	0x2048, 0xa880, 0x009e, 0xd0cc, 0x0118, 0x2019, 0x000c, 0x0038,
-	0xd094, 0x0118, 0x2019, 0x000d, 0x0010, 0x2019, 0x0010, 0x080c,
-	0xddf2, 0x6023, 0x0006, 0x6003, 0x0007, 0x003e, 0x0005, 0x9006,
-	0x0005, 0x9085, 0x0001, 0x0005, 0x0096, 0x86ff, 0x11e8, 0x6014,
-	0x2048, 0x080c, 0xc814, 0x01d0, 0x6043, 0xffff, 0xa864, 0x9086,
-	0x0139, 0x1128, 0xa87b, 0x0005, 0xa883, 0x0000, 0x0028, 0x900e,
-	0x2001, 0x0005, 0x080c, 0x6fb0, 0x080c, 0xcb18, 0x080c, 0x6d64,
-	0x080c, 0xac04, 0x9085, 0x0001, 0x009e, 0x0005, 0x9006, 0x0ce0,
-	0x080c, 0xa872, 0x080c, 0xcf68, 0x6000, 0x908a, 0x0016, 0x1a0c,
-	0x0d7d, 0x002b, 0x0106, 0x080c, 0xa88e, 0x010e, 0x0005, 0xc4a7,
-	0xc4d5, 0xc4a9, 0xc4fc, 0xc4d0, 0xc4a7, 0xc45f, 0xc464, 0xc464,
-	0xc45f, 0xc45f, 0xc45f, 0xc45f, 0xc45f, 0xc45f, 0xc45f, 0x080c,
-	0x0d7d, 0x86ff, 0x1510, 0x6020, 0x9086, 0x0006, 0x01f0, 0x0096,
-	0x6014, 0x2048, 0x080c, 0xc814, 0x0158, 0xa87c, 0xd0cc, 0x0130,
-	0x0096, 0xa878, 0x2048, 0x080c, 0x0fec, 0x009e, 0x080c, 0xcb18,
-	0x009e, 0x080c, 0xcee8, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-	0x0002, 0x2009, 0x8020, 0x080c, 0x91cf, 0x9085, 0x0001, 0x0005,
-	0x0066, 0x080c, 0x1a6a, 0x006e, 0x08a0, 0x00e6, 0x2071, 0x19e7,
-	0x7030, 0x9c06, 0x1120, 0x080c, 0xa074, 0x00ee, 0x0850, 0x6020,
-	0x9084, 0x000f, 0x9086, 0x0006, 0x1150, 0x0086, 0x0096, 0x2049,
-	0x0001, 0x2c40, 0x080c, 0xa1f4, 0x009e, 0x008e, 0x0040, 0x0066,
-	0x080c, 0x9f70, 0x190c, 0x0d7d, 0x080c, 0x9f7e, 0x006e, 0x00ee,
-	0x1904, 0xc4a9, 0x0804, 0xc45f, 0x0036, 0x00e6, 0x2071, 0x19e7,
-	0x704c, 0x9c06, 0x1138, 0x901e, 0x080c, 0xa0f4, 0x00ee, 0x003e,
-	0x0804, 0xc4a9, 0x080c, 0xa32a, 0x00ee, 0x003e, 0x1904, 0xc4a9,
-	0x0804, 0xc45f, 0x00c6, 0x0066, 0x6020, 0x9084, 0x000f, 0x001b,
-	0x006e, 0x00ce, 0x0005, 0xc532, 0xc5f4, 0xc75b, 0xc53a, 0xac04,
-	0xc532, 0xdde4, 0xcf50, 0xc5f4, 0x907a, 0xc7da, 0xc52b, 0xc52b,
-	0xc52b, 0xc52b, 0xc52b, 0x080c, 0x0d7d, 0x080c, 0xca29, 0x1110,
-	0x080c, 0xb591, 0x0005, 0x080c, 0x95ad, 0x0804, 0xabc9, 0x601b,
-	0x0001, 0x0005, 0x080c, 0xc814, 0x0130, 0x6014, 0x0096, 0x2048,
-	0x2c00, 0xa896, 0x009e, 0x080c, 0xa872, 0x080c, 0xcf68, 0x6000,
-	0x908a, 0x0016, 0x1a0c, 0x0d7d, 0x0013, 0x0804, 0xa88e, 0xc55f,
-	0xc561, 0xc58b, 0xc59f, 0xc5ca, 0xc55f, 0xc532, 0xc532, 0xc532,
-	0xc5a6, 0xc5a6, 0xc55f, 0xc55f, 0xc55f, 0xc55f, 0xc5b0, 0x080c,
-	0x0d7d, 0x00e6, 0x6014, 0x0096, 0x2048, 0xa880, 0xc0b5, 0xa882,
-	0x009e, 0x2071, 0x19e7, 0x7030, 0x9c06, 0x01d0, 0x0066, 0x080c,
-	0x9f70, 0x190c, 0x0d7d, 0x080c, 0x9f7e, 0x006e, 0x080c, 0xcee8,
-	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2001, 0x1987,
-	0x2004, 0x601a, 0x2009, 0x8020, 0x080c, 0x91cf, 0x00ee, 0x0005,
-	0x601b, 0x0001, 0x0cd8, 0x0096, 0x6014, 0x2048, 0xa880, 0xc0b5,
-	0xa882, 0x009e, 0x080c, 0xcee8, 0x6007, 0x0085, 0x6003, 0x000b,
-	0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x91cf, 0x0005, 0x080c,
-	0xa872, 0x080c, 0xaa06, 0x080c, 0xa88e, 0x0c28, 0x0096, 0x601b,
-	0x0001, 0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x0005,
-	0x080c, 0x56db, 0x01a8, 0x6014, 0x0096, 0x904d, 0x0180, 0xa864,
-	0xa867, 0x0103, 0xa87b, 0x0006, 0x9086, 0x0139, 0x1140, 0xa867,
-	0x0139, 0xa897, 0x4005, 0xa89b, 0x0004, 0x080c, 0x6d70, 0x009e,
-	0x0804, 0xabc9, 0x6014, 0x0096, 0x904d, 0x0508, 0x080c, 0xcf54,
-	0x01f0, 0x080c, 0xa88e, 0x2001, 0x180f, 0x2004, 0xd0c4, 0x0110,
-	0x009e, 0x0005, 0xa884, 0x009e, 0x8003, 0x800b, 0x810b, 0x9108,
-	0x611a, 0x2001, 0x0037, 0x2c08, 0x080c, 0x1679, 0x6000, 0x9086,
-	0x0004, 0x1120, 0x2009, 0x0048, 0x080c, 0xac68, 0x0005, 0x009e,
-	0x080c, 0x1a6a, 0x0804, 0xc58b, 0x6000, 0x908a, 0x0016, 0x1a0c,
-	0x0d7d, 0x000b, 0x0005, 0xc60b, 0xc537, 0xc60d, 0xc60b, 0xc60d,
-	0xc60d, 0xc533, 0xc60b, 0xc52d, 0xc52d, 0xc60b, 0xc60b, 0xc60b,
-	0xc60b, 0xc60b, 0xc60b, 0x080c, 0x0d7d, 0x6010, 0x00b6, 0x2058,
-	0xb804, 0x9084, 0x00ff, 0x00be, 0x908a, 0x000c, 0x1a0c, 0x0d7d,
-	0x00b6, 0x0013, 0x00be, 0x0005, 0xc628, 0xc6f5, 0xc62a, 0xc66a,
-	0xc62a, 0xc66a, 0xc62a, 0xc638, 0xc628, 0xc66a, 0xc628, 0xc659,
-	0x080c, 0x0d7d, 0x6004, 0x908e, 0x0016, 0x05c0, 0x908e, 0x0004,
-	0x05a8, 0x908e, 0x0002, 0x0590, 0x908e, 0x0052, 0x0904, 0xc6f1,
-	0x6004, 0x080c, 0xca29, 0x0904, 0xc70e, 0x908e, 0x0004, 0x1110,
-	0x080c, 0x3215, 0x908e, 0x0021, 0x0904, 0xc712, 0x908e, 0x0022,
-	0x0904, 0xc756, 0x908e, 0x003d, 0x0904, 0xc712, 0x908e, 0x0039,
-	0x0904, 0xc716, 0x908e, 0x0035, 0x0904, 0xc716, 0x908e, 0x001e,
-	0x0178, 0x908e, 0x0001, 0x1140, 0x6010, 0x2058, 0xb804, 0x9084,
-	0x00ff, 0x9086, 0x0006, 0x0110, 0x080c, 0x31e4, 0x080c, 0xb591,
-	0x0804, 0xac04, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0904,
-	0xc6e2, 0x9186, 0x0002, 0x1904, 0xc6b7, 0x2001, 0x1837, 0x2004,
-	0xd08c, 0x11c8, 0x080c, 0x74d5, 0x11b0, 0x080c, 0xcf2e, 0x0138,
-	0x080c, 0x74f8, 0x1120, 0x080c, 0x73e0, 0x0804, 0xc73f, 0x2001,
-	0x197d, 0x2003, 0x0001, 0x2001, 0x1800, 0x2003, 0x0001, 0x080c,
-	0x7406, 0x0804, 0xc73f, 0x6010, 0x2058, 0x2001, 0x1837, 0x2004,
-	0xd0ac, 0x1904, 0xc73f, 0xb8a0, 0x9084, 0xff80, 0x1904, 0xc73f,
-	0xb840, 0x9084, 0x00ff, 0x9005, 0x0190, 0x8001, 0xb842, 0x6017,
-	0x0000, 0x6023, 0x0007, 0x601b, 0x0398, 0x604b, 0x0000, 0x080c,
-	0xab73, 0x0128, 0x2b00, 0x6012, 0x6023, 0x0001, 0x0458, 0x00de,
-	0x00ce, 0x6004, 0x908e, 0x0002, 0x11a0, 0x6010, 0x2058, 0xb8a0,
-	0x9086, 0x007e, 0x1170, 0x2009, 0x1837, 0x2104, 0xc085, 0x200a,
-	0x00e6, 0x2071, 0x1800, 0x080c, 0x5fb5, 0x00ee, 0x080c, 0xb591,
-	0x0030, 0x080c, 0xb591, 0x080c, 0x31e4, 0x080c, 0xcf43, 0x00e6,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x3215, 0x012e, 0x00ee, 0x080c,
-	0xac04, 0x0005, 0x2001, 0x0002, 0x080c, 0x656e, 0x6003, 0x0001,
-	0x6007, 0x0002, 0x080c, 0x91f4, 0x080c, 0x966f, 0x00de, 0x00ce,
-	0x0c80, 0x080c, 0x3215, 0x0804, 0xc666, 0x00c6, 0x00d6, 0x6104,
-	0x9186, 0x0016, 0x0d38, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff,
-	0x9005, 0x0904, 0xc6b7, 0x8001, 0xb842, 0x6003, 0x0001, 0x080c,
-	0x91f4, 0x080c, 0x966f, 0x00de, 0x00ce, 0x0898, 0x080c, 0xb591,
-	0x0804, 0xc668, 0x080c, 0xb5cd, 0x0804, 0xc668, 0x00d6, 0x2c68,
-	0x6104, 0x080c, 0xcea6, 0x00de, 0x0118, 0x080c, 0xabc9, 0x00f0,
-	0x6004, 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007,
-	0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x603c, 0x600a, 0x2001,
-	0x1987, 0x2004, 0x601a, 0x602c, 0x2c08, 0x2060, 0x6024, 0xc0b5,
-	0x6026, 0x2160, 0x2009, 0x8020, 0x080c, 0x91ed, 0x0005, 0x00de,
-	0x00ce, 0x080c, 0xb591, 0x080c, 0x31e4, 0x00e6, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x3215, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b,
-	0x0398, 0x604b, 0x0000, 0x012e, 0x00ee, 0x0005, 0x080c, 0xb005,
-	0x1904, 0xc70e, 0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d7d,
-	0x0096, 0x00d6, 0x001b, 0x00de, 0x009e, 0x0005, 0xc776, 0xc776,
-	0xc776, 0xc776, 0xc776, 0xc776, 0xc776, 0xc776, 0xc776, 0xc532,
-	0xc776, 0xc537, 0xc778, 0xc537, 0xc785, 0xc776, 0x080c, 0x0d7d,
-	0x6004, 0x9086, 0x008b, 0x0148, 0x6007, 0x008b, 0x6003, 0x000d,
-	0x2009, 0x8020, 0x080c, 0x91ed, 0x0005, 0x080c, 0xcf22, 0x0118,
-	0x080c, 0xcf35, 0x0010, 0x080c, 0xcf43, 0x080c, 0xca03, 0x080c,
-	0xc814, 0x0570, 0x080c, 0x31e4, 0x080c, 0xc814, 0x0168, 0x6014,
-	0x2048, 0xa867, 0x0103, 0xa87b, 0x0006, 0xa877, 0x0000, 0xa880,
-	0xc0ed, 0xa882, 0x080c, 0x6d70, 0x2c68, 0x080c, 0xab73, 0x0150,
-	0x6810, 0x6012, 0x080c, 0xcca8, 0x00c6, 0x2d60, 0x080c, 0xac04,
-	0x00ce, 0x0008, 0x2d60, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007,
-	0x0001, 0x6003, 0x0001, 0x080c, 0x91f4, 0x080c, 0x966f, 0x00c8,
-	0x080c, 0xcf22, 0x0138, 0x6034, 0x9086, 0x4000, 0x1118, 0x080c,
-	0x31e4, 0x08d0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
-	0x0118, 0x9186, 0x0035, 0x1118, 0x080c, 0x31e4, 0x0868, 0x080c,
-	0xac04, 0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d7d, 0x0002,
-	0xc7f0, 0xc7f0, 0xc7f2, 0xc7f2, 0xc7f2, 0xc7f0, 0xc7f0, 0xac04,
-	0xc7f0, 0xc7f0, 0xc7f0, 0xc7f0, 0xc7f0, 0xc7f0, 0xc7f0, 0xc7f0,
-	0x080c, 0x0d7d, 0x080c, 0xa872, 0x080c, 0xaa06, 0x080c, 0xa88e,
-	0x6114, 0x0096, 0x2148, 0xa87b, 0x0006, 0x080c, 0x6d70, 0x009e,
-	0x0804, 0xabc9, 0x9284, 0x0003, 0x1158, 0x9282, 0x1ddc, 0x0240,
-	0x2001, 0x181a, 0x2004, 0x9202, 0x1218, 0x9085, 0x0001, 0x0005,
-	0x9006, 0x0ce8, 0x0096, 0x0028, 0x0096, 0x0006, 0x6014, 0x2048,
-	0x000e, 0x0006, 0x9984, 0xf000, 0x9086, 0xf000, 0x0110, 0x080c,
-	0x10e5, 0x000e, 0x009e, 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0006,
-	0x0126, 0x2091, 0x8000, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7354,
-	0x7074, 0x9302, 0x1640, 0x6020, 0x9206, 0x11f8, 0x080c, 0xcf2e,
-	0x0180, 0x9286, 0x0001, 0x1168, 0x6004, 0x9086, 0x0004, 0x1148,
-	0x080c, 0x31e4, 0x080c, 0xcf43, 0x00c6, 0x080c, 0xac04, 0x00ce,
-	0x0060, 0x080c, 0xcc1a, 0x0148, 0x080c, 0xca29, 0x1110, 0x080c,
-	0xb591, 0x00c6, 0x080c, 0xabc9, 0x00ce, 0x9ce0, 0x001c, 0x7068,
-	0x9c02, 0x1208, 0x08a0, 0x012e, 0x000e, 0x003e, 0x00ce, 0x00ee,
-	0x0005, 0x00e6, 0x00c6, 0x0016, 0x9188, 0x1000, 0x210c, 0x81ff,
-	0x0128, 0x2061, 0x1b32, 0x6112, 0x080c, 0x31e4, 0x9006, 0x0010,
-	0x9085, 0x0001, 0x001e, 0x00ce, 0x00ee, 0x0005, 0x00c6, 0x0126,
-	0x2091, 0x8000, 0x080c, 0xab73, 0x01b0, 0x665e, 0x2b00, 0x6012,
-	0x080c, 0x56db, 0x0118, 0x080c, 0xc945, 0x0168, 0x080c, 0xcca8,
-	0x6023, 0x0003, 0x2009, 0x004b, 0x080c, 0xac68, 0x9085, 0x0001,
+	0x000c, 0x0005, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
+	0x0118, 0x9186, 0x0035, 0x1118, 0x2001, 0x1986, 0x0010, 0x2001,
+	0x1987, 0x2004, 0x601a, 0x6003, 0x000e, 0x0005, 0x9182, 0x0092,
+	0x1220, 0x9182, 0x0085, 0x0208, 0x0012, 0x0804, 0xaca9, 0xc2dc,
+	0xc2dc, 0xc2dc, 0xc2dc, 0xc2de, 0xc32b, 0xc2dc, 0xc2dc, 0xc2dc,
+	0xc2dc, 0xc2dc, 0xc2dc, 0xc2dc, 0x080c, 0x0d7d, 0x0096, 0x6010,
+	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0168, 0x6034, 0x908c,
+	0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118,
+	0x009e, 0x0804, 0xc33f, 0x080c, 0xc838, 0x1118, 0x080c, 0xca27,
+	0x0068, 0x6014, 0x2048, 0x080c, 0xcf7e, 0x1110, 0x080c, 0xca27,
+	0xa867, 0x0103, 0x080c, 0xcf32, 0x080c, 0x6d80, 0x00d6, 0x2c68,
+	0x080c, 0xab97, 0x01d0, 0x6003, 0x0001, 0x6007, 0x001e, 0x600b,
+	0xffff, 0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f, 0x210c,
+	0x613e, 0x6910, 0x6112, 0x080c, 0xcccc, 0x695c, 0x615e, 0x6023,
+	0x0001, 0x2009, 0x8020, 0x080c, 0x921e, 0x2d60, 0x00de, 0x080c,
+	0xabed, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
+	0xd0bc, 0x05a0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0035,
+	0x0130, 0x9186, 0x001e, 0x0118, 0x9186, 0x0039, 0x1538, 0x00d6,
+	0x2c68, 0x080c, 0xceca, 0x11f0, 0x080c, 0xab97, 0x01d8, 0x6106,
+	0x6003, 0x0001, 0x6023, 0x0001, 0x6910, 0x6112, 0x692c, 0x612e,
+	0x6930, 0x6132, 0x6934, 0x918c, 0x00ff, 0x6136, 0x6938, 0x613a,
+	0x693c, 0x613e, 0x695c, 0x615e, 0x080c, 0xcccc, 0x2009, 0x8020,
+	0x080c, 0x921e, 0x2d60, 0x00de, 0x0804, 0xabed, 0x0096, 0x6014,
+	0x2048, 0x080c, 0xc838, 0x01c8, 0xa867, 0x0103, 0xa880, 0xd0b4,
+	0x0128, 0xc0ec, 0xa882, 0xa87b, 0x0006, 0x0048, 0xd0bc, 0x0118,
+	0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xcb3c, 0xa877,
+	0x0000, 0x080c, 0x6d80, 0x080c, 0xca27, 0x009e, 0x0804, 0xabed,
+	0x0016, 0x0096, 0x6014, 0x2048, 0x080c, 0xc838, 0x0140, 0xa867,
+	0x0103, 0xa87b, 0x0028, 0xa877, 0x0000, 0x080c, 0x6d80, 0x009e,
+	0x001e, 0x9186, 0x0013, 0x0158, 0x9186, 0x0014, 0x0130, 0x9186,
+	0x0027, 0x0118, 0x080c, 0xaca9, 0x0020, 0x080c, 0x95de, 0x080c,
+	0xac28, 0x0005, 0x0056, 0x0066, 0x0096, 0x00a6, 0x2029, 0x0001,
+	0x9182, 0x0101, 0x1208, 0x0010, 0x2009, 0x0100, 0x2130, 0x8304,
+	0x9098, 0x0018, 0x2009, 0x0020, 0x2011, 0x0029, 0x080c, 0xc40b,
+	0x96b2, 0x0020, 0xb004, 0x904d, 0x0110, 0x080c, 0x0fec, 0x080c,
+	0x103a, 0x0520, 0x8528, 0xa867, 0x0110, 0xa86b, 0x0000, 0x2920,
+	0xb406, 0x968a, 0x003d, 0x1228, 0x2608, 0x2011, 0x001b, 0x0499,
+	0x00a8, 0x96b2, 0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b,
+	0x0451, 0x0c28, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f,
+	0x95ad, 0x0003, 0xb566, 0x95ac, 0x0000, 0x0048, 0x2001, 0x0205,
+	0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x009e,
+	0x006e, 0x005e, 0x0005, 0x00a6, 0x89ff, 0x0158, 0xa804, 0x9055,
+	0x0130, 0xa807, 0x0000, 0x080c, 0x6d80, 0x2a48, 0x0cb8, 0x080c,
+	0x6d80, 0x00ae, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7814, 0x9085,
+	0x0080, 0x7816, 0xd184, 0x0108, 0x8108, 0x810c, 0x20a9, 0x0001,
+	0xa860, 0x20e8, 0xa85c, 0x9200, 0x20a0, 0x20e1, 0x0000, 0x2300,
+	0x9e00, 0x2098, 0x4003, 0x8318, 0x9386, 0x0020, 0x1148, 0x2018,
+	0x2300, 0x9e00, 0x2098, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816,
+	0x8109, 0x1d80, 0x7817, 0x0000, 0x00fe, 0x0005, 0x0066, 0x0126,
+	0x2091, 0x8000, 0x2031, 0x0001, 0x6020, 0x9084, 0x000f, 0x0083,
+	0x012e, 0x006e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0066, 0x2031,
+	0x0000, 0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x012e, 0x0005,
+	0xc488, 0xc488, 0xc483, 0xc4ac, 0xc460, 0xc483, 0xc462, 0xc483,
+	0xc460, 0x90e4, 0xc483, 0xc483, 0xc483, 0xc460, 0xc460, 0xc460,
+	0x080c, 0x0d7d, 0x6010, 0x9080, 0x0000, 0x2004, 0xd0bc, 0x190c,
+	0xc4ac, 0x0036, 0x6014, 0x0096, 0x2048, 0xa880, 0x009e, 0xd0cc,
+	0x0118, 0x2019, 0x000c, 0x0038, 0xd094, 0x0118, 0x2019, 0x000d,
+	0x0010, 0x2019, 0x0010, 0x080c, 0xde1b, 0x6023, 0x0006, 0x6003,
+	0x0007, 0x003e, 0x0005, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005,
+	0x0096, 0x86ff, 0x11e8, 0x6014, 0x2048, 0x080c, 0xc838, 0x01d0,
+	0x6043, 0xffff, 0xa864, 0x9086, 0x0139, 0x1128, 0xa87b, 0x0005,
+	0xa883, 0x0000, 0x0028, 0x900e, 0x2001, 0x0005, 0x080c, 0x6fc0,
+	0x080c, 0xcb3c, 0x080c, 0x6d74, 0x080c, 0xac28, 0x9085, 0x0001,
+	0x009e, 0x0005, 0x9006, 0x0ce0, 0x080c, 0xa896, 0x080c, 0xcf8c,
+	0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d7d, 0x002b, 0x0106, 0x080c,
+	0xa8b2, 0x010e, 0x0005, 0xc4cb, 0xc4f9, 0xc4cd, 0xc520, 0xc4f4,
+	0xc4cb, 0xc483, 0xc488, 0xc488, 0xc483, 0xc483, 0xc483, 0xc483,
+	0xc483, 0xc483, 0xc483, 0x080c, 0x0d7d, 0x86ff, 0x1510, 0x6020,
+	0x9086, 0x0006, 0x01f0, 0x0096, 0x6014, 0x2048, 0x080c, 0xc838,
+	0x0158, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c,
+	0x0fec, 0x009e, 0x080c, 0xcb3c, 0x009e, 0x080c, 0xcf0c, 0x6007,
+	0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009, 0x8020, 0x080c,
+	0x9200, 0x9085, 0x0001, 0x0005, 0x0066, 0x080c, 0x1a6a, 0x006e,
+	0x08a0, 0x00e6, 0x2071, 0x19e7, 0x7030, 0x9c06, 0x1120, 0x080c,
+	0xa098, 0x00ee, 0x0850, 0x6020, 0x9084, 0x000f, 0x9086, 0x0006,
+	0x1150, 0x0086, 0x0096, 0x2049, 0x0001, 0x2c40, 0x080c, 0xa218,
+	0x009e, 0x008e, 0x0040, 0x0066, 0x080c, 0x9f94, 0x190c, 0x0d7d,
+	0x080c, 0x9fa2, 0x006e, 0x00ee, 0x1904, 0xc4cd, 0x0804, 0xc483,
+	0x0036, 0x00e6, 0x2071, 0x19e7, 0x704c, 0x9c06, 0x1138, 0x901e,
+	0x080c, 0xa118, 0x00ee, 0x003e, 0x0804, 0xc4cd, 0x080c, 0xa34e,
+	0x00ee, 0x003e, 0x1904, 0xc4cd, 0x0804, 0xc483, 0x00c6, 0x0066,
+	0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x00ce, 0x0005, 0xc556,
+	0xc618, 0xc77f, 0xc55e, 0xac28, 0xc556, 0xde0d, 0xcf74, 0xc618,
+	0x90ab, 0xc7fe, 0xc54f, 0xc54f, 0xc54f, 0xc54f, 0xc54f, 0x080c,
+	0x0d7d, 0x080c, 0xca4d, 0x1110, 0x080c, 0xb5b5, 0x0005, 0x080c,
+	0x95de, 0x0804, 0xabed, 0x601b, 0x0001, 0x0005, 0x080c, 0xc838,
+	0x0130, 0x6014, 0x0096, 0x2048, 0x2c00, 0xa896, 0x009e, 0x080c,
+	0xa896, 0x080c, 0xcf8c, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d7d,
+	0x0013, 0x0804, 0xa8b2, 0xc583, 0xc585, 0xc5af, 0xc5c3, 0xc5ee,
+	0xc583, 0xc556, 0xc556, 0xc556, 0xc5ca, 0xc5ca, 0xc583, 0xc583,
+	0xc583, 0xc583, 0xc5d4, 0x080c, 0x0d7d, 0x00e6, 0x6014, 0x0096,
+	0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x2071, 0x19e7, 0x7030,
+	0x9c06, 0x01d0, 0x0066, 0x080c, 0x9f94, 0x190c, 0x0d7d, 0x080c,
+	0x9fa2, 0x006e, 0x080c, 0xcf0c, 0x6007, 0x0085, 0x6003, 0x000b,
+	0x6023, 0x0002, 0x2001, 0x1987, 0x2004, 0x601a, 0x2009, 0x8020,
+	0x080c, 0x9200, 0x00ee, 0x0005, 0x601b, 0x0001, 0x0cd8, 0x0096,
+	0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x080c, 0xcf0c,
+	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009, 0x8020,
+	0x080c, 0x9200, 0x0005, 0x080c, 0xa896, 0x080c, 0xaa2a, 0x080c,
+	0xa8b2, 0x0c28, 0x0096, 0x601b, 0x0001, 0x6014, 0x2048, 0xa880,
+	0xc0b5, 0xa882, 0x009e, 0x0005, 0x080c, 0x56e2, 0x01a8, 0x6014,
+	0x0096, 0x904d, 0x0180, 0xa864, 0xa867, 0x0103, 0xa87b, 0x0006,
+	0x9086, 0x0139, 0x1140, 0xa867, 0x0139, 0xa897, 0x4005, 0xa89b,
+	0x0004, 0x080c, 0x6d80, 0x009e, 0x0804, 0xabed, 0x6014, 0x0096,
+	0x904d, 0x0508, 0x080c, 0xcf78, 0x01f0, 0x080c, 0xa8b2, 0x2001,
+	0x180f, 0x2004, 0xd0c4, 0x0110, 0x009e, 0x0005, 0xa884, 0x009e,
+	0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0x2001, 0x0037, 0x2c08,
+	0x080c, 0x1679, 0x6000, 0x9086, 0x0004, 0x1120, 0x2009, 0x0048,
+	0x080c, 0xac8c, 0x0005, 0x009e, 0x080c, 0x1a6a, 0x0804, 0xc5af,
+	0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d7d, 0x000b, 0x0005, 0xc62f,
+	0xc55b, 0xc631, 0xc62f, 0xc631, 0xc631, 0xc557, 0xc62f, 0xc551,
+	0xc551, 0xc62f, 0xc62f, 0xc62f, 0xc62f, 0xc62f, 0xc62f, 0x080c,
+	0x0d7d, 0x6010, 0x00b6, 0x2058, 0xb804, 0x9084, 0x00ff, 0x00be,
+	0x908a, 0x000c, 0x1a0c, 0x0d7d, 0x00b6, 0x0013, 0x00be, 0x0005,
+	0xc64c, 0xc719, 0xc64e, 0xc68e, 0xc64e, 0xc68e, 0xc64e, 0xc65c,
+	0xc64c, 0xc68e, 0xc64c, 0xc67d, 0x080c, 0x0d7d, 0x6004, 0x908e,
+	0x0016, 0x05c0, 0x908e, 0x0004, 0x05a8, 0x908e, 0x0002, 0x0590,
+	0x908e, 0x0052, 0x0904, 0xc715, 0x6004, 0x080c, 0xca4d, 0x0904,
+	0xc732, 0x908e, 0x0004, 0x1110, 0x080c, 0x321c, 0x908e, 0x0021,
+	0x0904, 0xc736, 0x908e, 0x0022, 0x0904, 0xc77a, 0x908e, 0x003d,
+	0x0904, 0xc736, 0x908e, 0x0039, 0x0904, 0xc73a, 0x908e, 0x0035,
+	0x0904, 0xc73a, 0x908e, 0x001e, 0x0178, 0x908e, 0x0001, 0x1140,
+	0x6010, 0x2058, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x0110,
+	0x080c, 0x31e7, 0x080c, 0xb5b5, 0x0804, 0xac28, 0x00c6, 0x00d6,
+	0x6104, 0x9186, 0x0016, 0x0904, 0xc706, 0x9186, 0x0002, 0x1904,
+	0xc6db, 0x2001, 0x1837, 0x2004, 0xd08c, 0x11c8, 0x080c, 0x74e9,
+	0x11b0, 0x080c, 0xcf52, 0x0138, 0x080c, 0x750c, 0x1120, 0x080c,
+	0x73f4, 0x0804, 0xc763, 0x2001, 0x197d, 0x2003, 0x0001, 0x2001,
+	0x1800, 0x2003, 0x0001, 0x080c, 0x741a, 0x0804, 0xc763, 0x6010,
+	0x2058, 0x2001, 0x1837, 0x2004, 0xd0ac, 0x1904, 0xc763, 0xb8a0,
+	0x9084, 0xff80, 0x1904, 0xc763, 0xb840, 0x9084, 0x00ff, 0x9005,
+	0x0190, 0x8001, 0xb842, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b,
+	0x0398, 0x604b, 0x0000, 0x080c, 0xab97, 0x0128, 0x2b00, 0x6012,
+	0x6023, 0x0001, 0x0458, 0x00de, 0x00ce, 0x6004, 0x908e, 0x0002,
+	0x11a0, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2009,
+	0x1837, 0x2104, 0xc085, 0x200a, 0x00e6, 0x2071, 0x1800, 0x080c,
+	0x5fbc, 0x00ee, 0x080c, 0xb5b5, 0x0030, 0x080c, 0xb5b5, 0x080c,
+	0x31e7, 0x080c, 0xcf67, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x321c, 0x012e, 0x00ee, 0x080c, 0xac28, 0x0005, 0x2001, 0x0002,
+	0x080c, 0x6575, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x9225,
+	0x080c, 0x96a0, 0x00de, 0x00ce, 0x0c80, 0x080c, 0x321c, 0x0804,
+	0xc68a, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0d38, 0x6010,
+	0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0904, 0xc6db, 0x8001,
+	0xb842, 0x6003, 0x0001, 0x080c, 0x9225, 0x080c, 0x96a0, 0x00de,
+	0x00ce, 0x0898, 0x080c, 0xb5b5, 0x0804, 0xc68c, 0x080c, 0xb5f1,
+	0x0804, 0xc68c, 0x00d6, 0x2c68, 0x6104, 0x080c, 0xceca, 0x00de,
+	0x0118, 0x080c, 0xabed, 0x00f0, 0x6004, 0x8007, 0x6134, 0x918c,
+	0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
+	0x0002, 0x603c, 0x600a, 0x2001, 0x1987, 0x2004, 0x601a, 0x602c,
+	0x2c08, 0x2060, 0x6024, 0xc0b5, 0x6026, 0x2160, 0x2009, 0x8020,
+	0x080c, 0x921e, 0x0005, 0x00de, 0x00ce, 0x080c, 0xb5b5, 0x080c,
+	0x31e7, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x321c, 0x6017,
+	0x0000, 0x6023, 0x0007, 0x601b, 0x0398, 0x604b, 0x0000, 0x012e,
+	0x00ee, 0x0005, 0x080c, 0xb029, 0x1904, 0xc732, 0x0005, 0x6000,
+	0x908a, 0x0016, 0x1a0c, 0x0d7d, 0x0096, 0x00d6, 0x001b, 0x00de,
+	0x009e, 0x0005, 0xc79a, 0xc79a, 0xc79a, 0xc79a, 0xc79a, 0xc79a,
+	0xc79a, 0xc79a, 0xc79a, 0xc556, 0xc79a, 0xc55b, 0xc79c, 0xc55b,
+	0xc7a9, 0xc79a, 0x080c, 0x0d7d, 0x6004, 0x9086, 0x008b, 0x0148,
+	0x6007, 0x008b, 0x6003, 0x000d, 0x2009, 0x8020, 0x080c, 0x921e,
+	0x0005, 0x080c, 0xcf46, 0x0118, 0x080c, 0xcf59, 0x0010, 0x080c,
+	0xcf67, 0x080c, 0xca27, 0x080c, 0xc838, 0x0570, 0x080c, 0x31e7,
+	0x080c, 0xc838, 0x0168, 0x6014, 0x2048, 0xa867, 0x0103, 0xa87b,
+	0x0006, 0xa877, 0x0000, 0xa880, 0xc0ed, 0xa882, 0x080c, 0x6d80,
+	0x2c68, 0x080c, 0xab97, 0x0150, 0x6810, 0x6012, 0x080c, 0xcccc,
+	0x00c6, 0x2d60, 0x080c, 0xac28, 0x00ce, 0x0008, 0x2d60, 0x6017,
+	0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c,
+	0x9225, 0x080c, 0x96a0, 0x00c8, 0x080c, 0xcf46, 0x0138, 0x6034,
+	0x9086, 0x4000, 0x1118, 0x080c, 0x31e7, 0x08d0, 0x6034, 0x908c,
+	0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118,
+	0x080c, 0x31e7, 0x0868, 0x080c, 0xac28, 0x0005, 0x6000, 0x908a,
+	0x0016, 0x1a0c, 0x0d7d, 0x0002, 0xc814, 0xc814, 0xc816, 0xc816,
+	0xc816, 0xc814, 0xc814, 0xac28, 0xc814, 0xc814, 0xc814, 0xc814,
+	0xc814, 0xc814, 0xc814, 0xc814, 0x080c, 0x0d7d, 0x080c, 0xa896,
+	0x080c, 0xaa2a, 0x080c, 0xa8b2, 0x6114, 0x0096, 0x2148, 0xa87b,
+	0x0006, 0x080c, 0x6d80, 0x009e, 0x0804, 0xabed, 0x9284, 0x0003,
+	0x1158, 0x9282, 0x1ddc, 0x0240, 0x2001, 0x181a, 0x2004, 0x9202,
+	0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x0096, 0x0028,
+	0x0096, 0x0006, 0x6014, 0x2048, 0x000e, 0x0006, 0x9984, 0xf000,
+	0x9086, 0xf000, 0x0110, 0x080c, 0x10e5, 0x000e, 0x009e, 0x0005,
+	0x00e6, 0x00c6, 0x0036, 0x0006, 0x0126, 0x2091, 0x8000, 0x2061,
+	0x1ddc, 0x2071, 0x1800, 0x7354, 0x7074, 0x9302, 0x1640, 0x6020,
+	0x9206, 0x11f8, 0x080c, 0xcf52, 0x0180, 0x9286, 0x0001, 0x1168,
+	0x6004, 0x9086, 0x0004, 0x1148, 0x080c, 0x31e7, 0x080c, 0xcf67,
+	0x00c6, 0x080c, 0xac28, 0x00ce, 0x0060, 0x080c, 0xcc3e, 0x0148,
+	0x080c, 0xca4d, 0x1110, 0x080c, 0xb5b5, 0x00c6, 0x080c, 0xabed,
+	0x00ce, 0x9ce0, 0x001c, 0x7068, 0x9c02, 0x1208, 0x08a0, 0x012e,
+	0x000e, 0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0016,
+	0x9188, 0x1000, 0x210c, 0x81ff, 0x0128, 0x2061, 0x1b32, 0x6112,
+	0x080c, 0x31e7, 0x9006, 0x0010, 0x9085, 0x0001, 0x001e, 0x00ce,
+	0x00ee, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xab97,
+	0x01b0, 0x665e, 0x2b00, 0x6012, 0x080c, 0x56e2, 0x0118, 0x080c,
+	0xc969, 0x0168, 0x080c, 0xcccc, 0x6023, 0x0003, 0x2009, 0x004b,
+	0x080c, 0xac8c, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
+	0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0xbaa0, 0x080c, 0xac5f,
+	0x0580, 0x605f, 0x0000, 0x2b00, 0x6012, 0x080c, 0xcccc, 0x6023,
+	0x0003, 0x0016, 0x080c, 0xa896, 0x080c, 0x93a5, 0x0076, 0x903e,
+	0x080c, 0x9277, 0x2c08, 0x080c, 0xdfeb, 0x007e, 0x080c, 0xa8b2,
+	0x001e, 0xd184, 0x0128, 0x080c, 0xabed, 0x9085, 0x0001, 0x0070,
+	0x080c, 0x56e2, 0x0128, 0xd18c, 0x1170, 0x080c, 0xc969, 0x0148,
+	0x2009, 0x004c, 0x080c, 0xac8c, 0x9085, 0x0001, 0x012e, 0x00ce,
+	0x0005, 0x9006, 0x0cd8, 0x2900, 0x6016, 0x0c90, 0x2009, 0x004d,
+	0x0010, 0x2009, 0x004e, 0x00f6, 0x00c6, 0x0046, 0x0016, 0x080c,
+	0xab97, 0x2c78, 0x0590, 0x7e5e, 0x2b00, 0x7812, 0x7823, 0x0003,
+	0x2021, 0x0005, 0x080c, 0xc97b, 0x9186, 0x004d, 0x0118, 0x9186,
+	0x004e, 0x0148, 0x2001, 0x1980, 0x200c, 0xd1fc, 0x0168, 0x2f60,
+	0x080c, 0xabed, 0x00d0, 0x2001, 0x197f, 0x200c, 0xd1fc, 0x0120,
+	0x2f60, 0x080c, 0xabed, 0x0088, 0x2f60, 0x080c, 0x56e2, 0x0138,
+	0xd18c, 0x1118, 0x04f1, 0x0148, 0x0010, 0x2900, 0x7816, 0x001e,
+	0x0016, 0x080c, 0xac8c, 0x9085, 0x0001, 0x001e, 0x004e, 0x00ce,
+	0x00fe, 0x0005, 0x00f6, 0x00c6, 0x0046, 0x080c, 0xab97, 0x2c78,
+	0x0508, 0x7e5e, 0x2b00, 0x7812, 0x7823, 0x0003, 0x0096, 0x2021,
+	0x0004, 0x0489, 0x009e, 0x2001, 0x197e, 0x200c, 0xd1fc, 0x0120,
+	0x2f60, 0x080c, 0xabed, 0x0060, 0x2f60, 0x080c, 0x56e2, 0x0120,
+	0xd18c, 0x1160, 0x0071, 0x0130, 0x2009, 0x0052, 0x080c, 0xac8c,
+	0x9085, 0x0001, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x2900, 0x7816,
+	0x0c98, 0x00c6, 0x080c, 0x4aa7, 0x00ce, 0x1120, 0x080c, 0xabed,
+	0x9006, 0x0005, 0xa867, 0x0000, 0xa86b, 0x8000, 0x2900, 0x6016,
+	0x9085, 0x0001, 0x0005, 0x0096, 0x0076, 0x0126, 0x2091, 0x8000,
+	0x080c, 0xa896, 0x080c, 0x6804, 0x0158, 0x2001, 0xc982, 0x0006,
+	0x900e, 0x2400, 0x080c, 0x6fc0, 0x080c, 0x6d80, 0x000e, 0x0807,
+	0x2418, 0x080c, 0x95a4, 0xbaa0, 0x0086, 0x2041, 0x0001, 0x2039,
+	0x0001, 0x2608, 0x080c, 0x93bf, 0x008e, 0x080c, 0x9277, 0x2f08,
+	0x2648, 0x080c, 0xdfeb, 0xb93c, 0x81ff, 0x090c, 0x9496, 0x080c,
+	0xa8b2, 0x012e, 0x007e, 0x009e, 0x0005, 0x00c6, 0x0126, 0x2091,
+	0x8000, 0x080c, 0xab97, 0x0190, 0x660a, 0x2b08, 0x6112, 0x080c,
+	0xcccc, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x001f, 0x080c,
+	0xac8c, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
+	0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xac5f, 0x01b8, 0x660a,
+	0x2b08, 0x6112, 0x080c, 0xcccc, 0x6023, 0x0008, 0x2900, 0x6016,
+	0x00f6, 0x2c78, 0x080c, 0x1731, 0x00fe, 0x2009, 0x0021, 0x080c,
+	0xac8c, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
+	0x2009, 0x003d, 0x00c6, 0x0126, 0x0016, 0x2091, 0x8000, 0x080c,
+	0xab97, 0x0198, 0x660a, 0x2b08, 0x6112, 0x080c, 0xcccc, 0x6023,
+	0x0001, 0x2900, 0x6016, 0x001e, 0x0016, 0x080c, 0xac8c, 0x9085,
+	0x0001, 0x001e, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd0, 0x00c6,
+	0x0126, 0x2091, 0x8000, 0x080c, 0xac5f, 0x0188, 0x2b08, 0x6112,
+	0x080c, 0xcccc, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x0000,
+	0x080c, 0xac8c, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
+	0x0cd8, 0x2009, 0x0044, 0x0830, 0x2009, 0x0049, 0x0818, 0x0026,
+	0x00b6, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0118, 0x8211, 0xba3e,
+	0x1140, 0xb8d0, 0x9005, 0x0128, 0xb888, 0x9005, 0x1110, 0xb88b,
+	0x0001, 0x00be, 0x002e, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e,
+	0x0002, 0x0140, 0x908e, 0x0003, 0x0128, 0x908e, 0x0004, 0x0110,
+	0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0096, 0x6020,
+	0x9086, 0x0004, 0x0190, 0x6014, 0x904d, 0x080c, 0xc838, 0x0168,
+	0xa864, 0x9086, 0x0139, 0x0158, 0x6020, 0x9086, 0x0003, 0x0128,
+	0xa868, 0xd0fc, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x009e,
+	0x000e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xac5f,
+	0x0198, 0x2b08, 0x6112, 0x080c, 0xcccc, 0x6023, 0x0001, 0x2900,
+	0x6016, 0x080c, 0x31e7, 0x2009, 0x0028, 0x080c, 0xac8c, 0x9085,
+	0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x9186, 0x0015,
+	0x11a8, 0x2011, 0x1824, 0x2204, 0x9086, 0x0074, 0x1178, 0x00b6,
+	0x080c, 0xb807, 0x00be, 0x080c, 0xba2a, 0x6003, 0x0001, 0x6007,
+	0x0029, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0078, 0x6014, 0x0096,
+	0x2048, 0xa868, 0x009e, 0xd0fc, 0x0148, 0x2001, 0x0001, 0x080c,
+	0xce8b, 0x080c, 0xb5b5, 0x080c, 0xabed, 0x0005, 0x0096, 0x6014,
+	0x904d, 0x090c, 0x0d7d, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
+	0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x6d80, 0x012e, 0x009e, 0x080c, 0xabed, 0x0c30, 0x0096,
+	0x9186, 0x0016, 0x1128, 0x2001, 0x0004, 0x080c, 0x6575, 0x00e8,
+	0x9186, 0x0015, 0x1510, 0x2011, 0x1824, 0x2204, 0x9086, 0x0014,
+	0x11e0, 0x6010, 0x00b6, 0x2058, 0x080c, 0x66c0, 0x00be, 0x080c,
+	0xbafb, 0x1198, 0x6010, 0x00b6, 0x2058, 0xb890, 0x00be, 0x9005,
+	0x0160, 0x2001, 0x0006, 0x080c, 0x6575, 0x6014, 0x2048, 0xa868,
+	0xd0fc, 0x0170, 0x080c, 0xaffd, 0x0048, 0x6014, 0x2048, 0xa868,
+	0xd0fc, 0x0528, 0x080c, 0xb5b5, 0x080c, 0xabed, 0x009e, 0x0005,
+	0x6014, 0x6310, 0x2358, 0x904d, 0x090c, 0x0d7d, 0xa87b, 0x0000,
+	0xa883, 0x0000, 0xa897, 0x4000, 0x900e, 0x080c, 0x6914, 0x1108,
+	0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xa99a, 0x0126, 0x2091,
+	0x8000, 0x080c, 0x6d80, 0x012e, 0x080c, 0xabed, 0x08f8, 0x6014,
+	0x904d, 0x090c, 0x0d7d, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
+	0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x6d80, 0x012e, 0x080c, 0xabed, 0x0840, 0xa878, 0x9086,
+	0x0005, 0x1108, 0x0009, 0x0005, 0xa880, 0xc0ad, 0xa882, 0x0005,
+	0x604b, 0x0000, 0x6017, 0x0000, 0x6003, 0x0001, 0x6007, 0x0050,
+	0x2009, 0x8023, 0x080c, 0x921e, 0x0005, 0x00c6, 0x6010, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0bc, 0x0130, 0x0066, 0x6020, 0x9084,
+	0x000f, 0x001b, 0x006e, 0x00ce, 0x0005, 0xc556, 0xcb6f, 0xcb6f,
+	0xcb72, 0xe318, 0xe333, 0xe336, 0xc556, 0xc556, 0xc556, 0xc556,
+	0xc556, 0xc556, 0xc556, 0xc556, 0xc556, 0x080c, 0x0d7d, 0xa001,
+	0xa001, 0x0005, 0x0096, 0x6014, 0x904d, 0x0118, 0xa87c, 0xd0e4,
+	0x1110, 0x009e, 0x0010, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058,
+	0xb800, 0x00be, 0xd0bc, 0x0550, 0x2001, 0x1834, 0x2004, 0x9005,
+	0x1540, 0x00f6, 0x2c78, 0x080c, 0xab97, 0x0508, 0x7810, 0x6012,
+	0x080c, 0xcccc, 0x7820, 0x9086, 0x0003, 0x0128, 0x7808, 0x603a,
+	0x2f00, 0x603e, 0x0020, 0x7808, 0x603e, 0x2f00, 0x603a, 0x602e,
+	0x6023, 0x0001, 0x6007, 0x0035, 0x6003, 0x0001, 0x795c, 0x615e,
+	0x2009, 0x8020, 0x080c, 0x921e, 0x2f60, 0x00fe, 0x0005, 0x2f60,
+	0x00fe, 0x2001, 0x1988, 0x2004, 0x604a, 0x0005, 0x0016, 0x0096,
+	0x6814, 0x2048, 0x681c, 0xd0fc, 0xc0fc, 0x681e, 0xa87c, 0x1108,
+	0xd0e4, 0x0180, 0xc0e4, 0xa87e, 0xa877, 0x0000, 0xa893, 0x0000,
+	0xa88f, 0x0000, 0xd0cc, 0x0130, 0xc0cc, 0xa87e, 0xa878, 0x2048,
+	0x080c, 0x0fec, 0x6830, 0x6036, 0x908e, 0x0001, 0x0148, 0x6803,
+	0x0002, 0x9086, 0x0005, 0x0170, 0x9006, 0x602e, 0x6032, 0x00d0,
+	0x681c, 0xc085, 0x681e, 0x6803, 0x0004, 0x6824, 0xc0f4, 0x9085,
+	0x0c00, 0x6826, 0x6814, 0x2048, 0xa8ac, 0x6938, 0x9102, 0xa8b0,
+	0x693c, 0x9103, 0x1e48, 0x683c, 0x602e, 0x6838, 0x9084, 0xfffc,
+	0x683a, 0x6032, 0x2d00, 0x603a, 0x6808, 0x603e, 0x6910, 0x6112,
+	0x695c, 0x615e, 0x6023, 0x0001, 0x6007, 0x0039, 0x6003, 0x0001,
+	0x2009, 0x8020, 0x080c, 0x921e, 0x009e, 0x001e, 0x0005, 0x6024,
+	0xd0d4, 0x0510, 0xd0f4, 0x11f8, 0x6038, 0x940a, 0x603c, 0x9303,
+	0x0230, 0x9105, 0x0120, 0x6024, 0xc0d4, 0xc0f5, 0x0098, 0x643a,
+	0x633e, 0xac3e, 0xab42, 0x0046, 0x0036, 0x2400, 0xacac, 0x9402,
+	0xa836, 0x2300, 0xabb0, 0x9303, 0xa83a, 0x003e, 0x004e, 0x6024,
+	0xc0d4, 0x0000, 0x6026, 0x0005, 0xd0f4, 0x1138, 0xa83c, 0x603a,
+	0xa840, 0x603e, 0x6024, 0xc0f5, 0x6026, 0x0005, 0x0006, 0x0016,
+	0x6004, 0x908e, 0x0034, 0x01b8, 0x908e, 0x0035, 0x01a0, 0x908e,
+	0x0036, 0x0188, 0x908e, 0x0037, 0x0170, 0x908e, 0x0038, 0x0158,
+	0x908e, 0x0039, 0x0140, 0x908e, 0x003a, 0x0128, 0x908e, 0x003b,
+	0x0110, 0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016,
+	0x0026, 0x0036, 0x00e6, 0x2001, 0x1982, 0x200c, 0x8000, 0x2014,
+	0x2001, 0x0032, 0x080c, 0x9166, 0x2001, 0x1986, 0x82ff, 0x1110,
+	0x2011, 0x0014, 0x2202, 0x2001, 0x1984, 0x200c, 0x8000, 0x2014,
+	0x2071, 0x196c, 0x711a, 0x721e, 0x2001, 0x0064, 0x080c, 0x9166,
+	0x2001, 0x1987, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001,
+	0x1988, 0x9288, 0x000a, 0x2102, 0x2001, 0x0017, 0x080c, 0xa887,
+	0x2001, 0x1a89, 0x2102, 0x2001, 0x0032, 0x080c, 0x1679, 0x080c,
+	0x6a4c, 0x00ee, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006,
+	0x0016, 0x00e6, 0x2001, 0x1986, 0x2003, 0x0028, 0x2001, 0x1987,
+	0x2003, 0x0014, 0x2071, 0x196c, 0x701b, 0x0000, 0x701f, 0x07d0,
+	0x2001, 0x1988, 0x2009, 0x001e, 0x2102, 0x2001, 0x0017, 0x080c,
+	0xa887, 0x2001, 0x1a89, 0x2102, 0x2001, 0x0032, 0x080c, 0x1679,
+	0x00ee, 0x001e, 0x000e, 0x0005, 0x0096, 0x6060, 0x904d, 0x0110,
+	0x080c, 0x106c, 0x009e, 0x0005, 0x0005, 0x00c6, 0x0126, 0x2091,
+	0x8000, 0x080c, 0xab97, 0x0180, 0x2b08, 0x6112, 0x0ca9, 0x6023,
+	0x0001, 0x2900, 0x6016, 0x2009, 0x0033, 0x080c, 0xac8c, 0x9085,
+	0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x00e6,
+	0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x1500, 0x7090, 0x9086,
+	0x0018, 0x11e0, 0x6014, 0x2048, 0xaa3c, 0xd2e4, 0x1160, 0x2c78,
+	0x080c, 0x975f, 0x01d8, 0x707c, 0xaa50, 0x9206, 0x1160, 0x7080,
+	0xaa54, 0x9206, 0x1140, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be,
+	0x900e, 0x080c, 0x323c, 0x080c, 0xaffd, 0x0020, 0x080c, 0xb5b5,
+	0x080c, 0xabed, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa54,
+	0x9206, 0x0d48, 0x0c80, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
+	0xab97, 0x0188, 0x2b08, 0x6112, 0x080c, 0xcccc, 0x6023, 0x0001,
+	0x2900, 0x6016, 0x2009, 0x004d, 0x080c, 0xac8c, 0x9085, 0x0001,
 	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091,
-	0x8000, 0xbaa0, 0x080c, 0xac3b, 0x0580, 0x605f, 0x0000, 0x2b00,
-	0x6012, 0x080c, 0xcca8, 0x6023, 0x0003, 0x0016, 0x080c, 0xa872,
-	0x080c, 0x9374, 0x0076, 0x903e, 0x080c, 0x9246, 0x2c08, 0x080c,
-	0xdfc0, 0x007e, 0x080c, 0xa88e, 0x001e, 0xd184, 0x0128, 0x080c,
-	0xabc9, 0x9085, 0x0001, 0x0070, 0x080c, 0x56db, 0x0128, 0xd18c,
-	0x1170, 0x080c, 0xc945, 0x0148, 0x2009, 0x004c, 0x080c, 0xac68,
-	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2900,
-	0x6016, 0x0c90, 0x2009, 0x004d, 0x0010, 0x2009, 0x004e, 0x00f6,
-	0x00c6, 0x0046, 0x0016, 0x080c, 0xab73, 0x2c78, 0x0590, 0x7e5e,
-	0x2b00, 0x7812, 0x7823, 0x0003, 0x2021, 0x0005, 0x080c, 0xc957,
-	0x9186, 0x004d, 0x0118, 0x9186, 0x004e, 0x0148, 0x2001, 0x1980,
-	0x200c, 0xd1fc, 0x0168, 0x2f60, 0x080c, 0xabc9, 0x00d0, 0x2001,
-	0x197f, 0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c, 0xabc9, 0x0088,
-	0x2f60, 0x080c, 0x56db, 0x0138, 0xd18c, 0x1118, 0x04f1, 0x0148,
-	0x0010, 0x2900, 0x7816, 0x001e, 0x0016, 0x080c, 0xac68, 0x9085,
-	0x0001, 0x001e, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x00f6, 0x00c6,
-	0x0046, 0x080c, 0xab73, 0x2c78, 0x0508, 0x7e5e, 0x2b00, 0x7812,
-	0x7823, 0x0003, 0x0096, 0x2021, 0x0004, 0x0489, 0x009e, 0x2001,
-	0x197e, 0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c, 0xabc9, 0x0060,
-	0x2f60, 0x080c, 0x56db, 0x0120, 0xd18c, 0x1160, 0x0071, 0x0130,
-	0x2009, 0x0052, 0x080c, 0xac68, 0x9085, 0x0001, 0x004e, 0x00ce,
-	0x00fe, 0x0005, 0x2900, 0x7816, 0x0c98, 0x00c6, 0x080c, 0x4aa0,
-	0x00ce, 0x1120, 0x080c, 0xabc9, 0x9006, 0x0005, 0xa867, 0x0000,
-	0xa86b, 0x8000, 0x2900, 0x6016, 0x9085, 0x0001, 0x0005, 0x0096,
-	0x0076, 0x0126, 0x2091, 0x8000, 0x080c, 0xa872, 0x080c, 0x67fd,
-	0x0158, 0x2001, 0xc95e, 0x0006, 0x900e, 0x2400, 0x080c, 0x6fb0,
-	0x080c, 0x6d70, 0x000e, 0x0807, 0x2418, 0x080c, 0x9573, 0xbaa0,
-	0x0086, 0x2041, 0x0001, 0x2039, 0x0001, 0x2608, 0x080c, 0x938e,
-	0x008e, 0x080c, 0x9246, 0x2f08, 0x2648, 0x080c, 0xdfc0, 0xb93c,
-	0x81ff, 0x090c, 0x9465, 0x080c, 0xa88e, 0x012e, 0x007e, 0x009e,
-	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xab73, 0x0190,
-	0x660a, 0x2b08, 0x6112, 0x080c, 0xcca8, 0x6023, 0x0001, 0x2900,
-	0x6016, 0x2009, 0x001f, 0x080c, 0xac68, 0x9085, 0x0001, 0x012e,
-	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x080c, 0xac3b, 0x01b8, 0x660a, 0x2b08, 0x6112, 0x080c, 0xcca8,
-	0x6023, 0x0008, 0x2900, 0x6016, 0x00f6, 0x2c78, 0x080c, 0x1731,
-	0x00fe, 0x2009, 0x0021, 0x080c, 0xac68, 0x9085, 0x0001, 0x012e,
-	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x003d, 0x00c6, 0x0126,
-	0x0016, 0x2091, 0x8000, 0x080c, 0xab73, 0x0198, 0x660a, 0x2b08,
-	0x6112, 0x080c, 0xcca8, 0x6023, 0x0001, 0x2900, 0x6016, 0x001e,
-	0x0016, 0x080c, 0xac68, 0x9085, 0x0001, 0x001e, 0x012e, 0x00ce,
-	0x0005, 0x9006, 0x0cd0, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
-	0xac3b, 0x0188, 0x2b08, 0x6112, 0x080c, 0xcca8, 0x6023, 0x0001,
-	0x2900, 0x6016, 0x2009, 0x0000, 0x080c, 0xac68, 0x9085, 0x0001,
-	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x0044, 0x0830,
-	0x2009, 0x0049, 0x0818, 0x0026, 0x00b6, 0x6210, 0x2258, 0xba3c,
-	0x82ff, 0x0118, 0x8211, 0xba3e, 0x1140, 0xb8d0, 0x9005, 0x0128,
-	0xb888, 0x9005, 0x1110, 0xb88b, 0x0001, 0x00be, 0x002e, 0x0005,
-	0x0006, 0x0016, 0x6004, 0x908e, 0x0002, 0x0140, 0x908e, 0x0003,
-	0x0128, 0x908e, 0x0004, 0x0110, 0x9085, 0x0001, 0x001e, 0x000e,
-	0x0005, 0x0006, 0x0096, 0x6020, 0x9086, 0x0004, 0x0190, 0x6014,
-	0x904d, 0x080c, 0xc814, 0x0168, 0xa864, 0x9086, 0x0139, 0x0158,
-	0x6020, 0x9086, 0x0003, 0x0128, 0xa868, 0xd0fc, 0x0110, 0x9006,
-	0x0010, 0x9085, 0x0001, 0x009e, 0x000e, 0x0005, 0x00c6, 0x0126,
-	0x2091, 0x8000, 0x080c, 0xac3b, 0x0198, 0x2b08, 0x6112, 0x080c,
-	0xcca8, 0x6023, 0x0001, 0x2900, 0x6016, 0x080c, 0x31e4, 0x2009,
-	0x0028, 0x080c, 0xac68, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-	0x9006, 0x0cd8, 0x9186, 0x0015, 0x11a8, 0x2011, 0x1824, 0x2204,
-	0x9086, 0x0074, 0x1178, 0x00b6, 0x080c, 0xb7e3, 0x00be, 0x080c,
-	0xba06, 0x6003, 0x0001, 0x6007, 0x0029, 0x080c, 0x91f4, 0x080c,
-	0x966f, 0x0078, 0x6014, 0x0096, 0x2048, 0xa868, 0x009e, 0xd0fc,
-	0x0148, 0x2001, 0x0001, 0x080c, 0xce67, 0x080c, 0xb591, 0x080c,
-	0xabc9, 0x0005, 0x0096, 0x6014, 0x904d, 0x090c, 0x0d7d, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867,
-	0x0139, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d70, 0x012e, 0x009e,
-	0x080c, 0xabc9, 0x0c30, 0x0096, 0x9186, 0x0016, 0x1128, 0x2001,
-	0x0004, 0x080c, 0x656e, 0x00e8, 0x9186, 0x0015, 0x1510, 0x2011,
-	0x1824, 0x2204, 0x9086, 0x0014, 0x11e0, 0x6010, 0x00b6, 0x2058,
-	0x080c, 0x66b9, 0x00be, 0x080c, 0xbad7, 0x1198, 0x6010, 0x00b6,
-	0x2058, 0xb890, 0x00be, 0x9005, 0x0160, 0x2001, 0x0006, 0x080c,
-	0x656e, 0x6014, 0x2048, 0xa868, 0xd0fc, 0x0170, 0x080c, 0xafd9,
-	0x0048, 0x6014, 0x2048, 0xa868, 0xd0fc, 0x0528, 0x080c, 0xb591,
-	0x080c, 0xabc9, 0x009e, 0x0005, 0x6014, 0x6310, 0x2358, 0x904d,
-	0x090c, 0x0d7d, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
-	0x900e, 0x080c, 0x690d, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0xa99a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d70, 0x012e,
-	0x080c, 0xabc9, 0x08f8, 0x6014, 0x904d, 0x090c, 0x0d7d, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867,
-	0x0139, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d70, 0x012e, 0x080c,
-	0xabc9, 0x0840, 0xa878, 0x9086, 0x0005, 0x1108, 0x0009, 0x0005,
-	0xa880, 0xc0ad, 0xa882, 0x0005, 0x604b, 0x0000, 0x6017, 0x0000,
-	0x6003, 0x0001, 0x6007, 0x0050, 0x2009, 0x8023, 0x080c, 0x91ed,
-	0x0005, 0x00c6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-	0x0130, 0x0066, 0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x00ce,
-	0x0005, 0xc532, 0xcb4b, 0xcb4b, 0xcb4e, 0xe2ed, 0xe308, 0xe30b,
-	0xc532, 0xc532, 0xc532, 0xc532, 0xc532, 0xc532, 0xc532, 0xc532,
-	0xc532, 0x080c, 0x0d7d, 0xa001, 0xa001, 0x0005, 0x0096, 0x6014,
-	0x904d, 0x0118, 0xa87c, 0xd0e4, 0x1110, 0x009e, 0x0010, 0x009e,
-	0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0550,
-	0x2001, 0x1834, 0x2004, 0x9005, 0x1540, 0x00f6, 0x2c78, 0x080c,
-	0xab73, 0x0508, 0x7810, 0x6012, 0x080c, 0xcca8, 0x7820, 0x9086,
-	0x0003, 0x0128, 0x7808, 0x603a, 0x2f00, 0x603e, 0x0020, 0x7808,
-	0x603e, 0x2f00, 0x603a, 0x602e, 0x6023, 0x0001, 0x6007, 0x0035,
-	0x6003, 0x0001, 0x795c, 0x615e, 0x2009, 0x8020, 0x080c, 0x91ed,
-	0x2f60, 0x00fe, 0x0005, 0x2f60, 0x00fe, 0x2001, 0x1988, 0x2004,
-	0x604a, 0x0005, 0x0016, 0x0096, 0x6814, 0x2048, 0x681c, 0xd0fc,
-	0xc0fc, 0x681e, 0xa87c, 0x1108, 0xd0e4, 0x0180, 0xc0e4, 0xa87e,
-	0xa877, 0x0000, 0xa893, 0x0000, 0xa88f, 0x0000, 0xd0cc, 0x0130,
-	0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c, 0x0fec, 0x6830, 0x6036,
-	0x908e, 0x0001, 0x0148, 0x6803, 0x0002, 0x9086, 0x0005, 0x0170,
-	0x9006, 0x602e, 0x6032, 0x00d0, 0x681c, 0xc085, 0x681e, 0x6803,
-	0x0004, 0x6824, 0xc0f4, 0x9085, 0x0c00, 0x6826, 0x6814, 0x2048,
-	0xa8ac, 0x6938, 0x9102, 0xa8b0, 0x693c, 0x9103, 0x1e48, 0x683c,
-	0x602e, 0x6838, 0x9084, 0xfffc, 0x683a, 0x6032, 0x2d00, 0x603a,
-	0x6808, 0x603e, 0x6910, 0x6112, 0x695c, 0x615e, 0x6023, 0x0001,
-	0x6007, 0x0039, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x91ed,
-	0x009e, 0x001e, 0x0005, 0x6024, 0xd0d4, 0x0510, 0xd0f4, 0x11f8,
-	0x6038, 0x940a, 0x603c, 0x9303, 0x0230, 0x9105, 0x0120, 0x6024,
-	0xc0d4, 0xc0f5, 0x0098, 0x643a, 0x633e, 0xac3e, 0xab42, 0x0046,
-	0x0036, 0x2400, 0xacac, 0x9402, 0xa836, 0x2300, 0xabb0, 0x9303,
-	0xa83a, 0x003e, 0x004e, 0x6024, 0xc0d4, 0x0000, 0x6026, 0x0005,
-	0xd0f4, 0x1138, 0xa83c, 0x603a, 0xa840, 0x603e, 0x6024, 0xc0f5,
-	0x6026, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e, 0x0034, 0x01b8,
-	0x908e, 0x0035, 0x01a0, 0x908e, 0x0036, 0x0188, 0x908e, 0x0037,
-	0x0170, 0x908e, 0x0038, 0x0158, 0x908e, 0x0039, 0x0140, 0x908e,
-	0x003a, 0x0128, 0x908e, 0x003b, 0x0110, 0x9085, 0x0001, 0x001e,
-	0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00e6, 0x2001,
-	0x1982, 0x200c, 0x8000, 0x2014, 0x2001, 0x0032, 0x080c, 0x9135,
-	0x2001, 0x1986, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001,
-	0x1984, 0x200c, 0x8000, 0x2014, 0x2071, 0x196c, 0x711a, 0x721e,
-	0x2001, 0x0064, 0x080c, 0x9135, 0x2001, 0x1987, 0x82ff, 0x1110,
-	0x2011, 0x0014, 0x2202, 0x2001, 0x1988, 0x9288, 0x000a, 0x2102,
-	0x2001, 0x0017, 0x080c, 0xa863, 0x2001, 0x1a89, 0x2102, 0x2001,
-	0x0032, 0x080c, 0x1679, 0x080c, 0x6a3c, 0x00ee, 0x003e, 0x002e,
-	0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x00e6, 0x2001, 0x1986,
-	0x2003, 0x0028, 0x2001, 0x1987, 0x2003, 0x0014, 0x2071, 0x196c,
-	0x701b, 0x0000, 0x701f, 0x07d0, 0x2001, 0x1988, 0x2009, 0x001e,
-	0x2102, 0x2001, 0x0017, 0x080c, 0xa863, 0x2001, 0x1a89, 0x2102,
-	0x2001, 0x0032, 0x080c, 0x1679, 0x00ee, 0x001e, 0x000e, 0x0005,
-	0x0096, 0x6060, 0x904d, 0x0110, 0x080c, 0x106c, 0x009e, 0x0005,
-	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0xab73, 0x0180,
-	0x2b08, 0x6112, 0x0ca9, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009,
-	0x0033, 0x080c, 0xac68, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-	0x9006, 0x0cd8, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186,
-	0x0015, 0x1500, 0x7090, 0x9086, 0x0018, 0x11e0, 0x6014, 0x2048,
-	0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x972e, 0x01d8, 0x707c,
-	0xaa50, 0x9206, 0x1160, 0x7080, 0xaa54, 0x9206, 0x1140, 0x6210,
-	0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e, 0x080c, 0x3235, 0x080c,
-	0xafd9, 0x0020, 0x080c, 0xb591, 0x080c, 0xabc9, 0x00fe, 0x00ee,
-	0x009e, 0x0005, 0x7060, 0xaa54, 0x9206, 0x0d48, 0x0c80, 0x00c6,
-	0x0126, 0x2091, 0x8000, 0x080c, 0xab73, 0x0188, 0x2b08, 0x6112,
-	0x080c, 0xcca8, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x004d,
-	0x080c, 0xac68, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
-	0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x0016, 0x080c, 0xab73,
-	0x0180, 0x2b08, 0x6112, 0x080c, 0xcca8, 0x6023, 0x0001, 0x2900,
-	0x6016, 0x001e, 0x080c, 0xac68, 0x9085, 0x0001, 0x012e, 0x00ce,
-	0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016, 0x0026, 0x0036, 0x0046,
-	0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186,
-	0x0015, 0x1568, 0x7190, 0x6014, 0x2048, 0xa814, 0x8003, 0x9106,
-	0x1530, 0x20e1, 0x0000, 0x2001, 0x19a0, 0x2003, 0x0000, 0x6014,
-	0x2048, 0xa830, 0x20a8, 0x8906, 0x8006, 0x8007, 0x9094, 0x003f,
-	0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a0,
-	0x0016, 0x200c, 0x080c, 0xd540, 0x001e, 0xa804, 0x9005, 0x0110,
-	0x2048, 0x0c38, 0x6014, 0x2048, 0xa867, 0x0103, 0x0010, 0x080c,
-	0xb591, 0x080c, 0xabc9, 0x00fe, 0x00ee, 0x009e, 0x006e, 0x005e,
-	0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x0096, 0x00e6, 0x00f6,
-	0x2071, 0x1800, 0x9186, 0x0015, 0x11b8, 0x7090, 0x9086, 0x0004,
-	0x1198, 0x6014, 0x2048, 0x2c78, 0x080c, 0x972e, 0x01a8, 0x707c,
-	0xaa74, 0x9206, 0x1130, 0x7080, 0xaa78, 0x9206, 0x1110, 0x080c,
-	0x31e4, 0x080c, 0xafd9, 0x0020, 0x080c, 0xb591, 0x080c, 0xabc9,
-	0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaa78, 0x9206, 0x0d78,
-	0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015,
-	0x1550, 0x7090, 0x9086, 0x0004, 0x1530, 0x6014, 0x2048, 0x2c78,
-	0x080c, 0x972e, 0x05f0, 0x707c, 0xaacc, 0x9206, 0x1180, 0x7080,
-	0xaad0, 0x9206, 0x1160, 0x080c, 0x31e4, 0x0016, 0xa998, 0xaab0,
-	0x9284, 0x1000, 0xc0fd, 0x080c, 0x568b, 0x001e, 0x0010, 0x080c,
-	0x5474, 0x080c, 0xc814, 0x0508, 0xa87b, 0x0000, 0xa883, 0x0000,
-	0xa897, 0x4000, 0x0080, 0x080c, 0xc814, 0x01b8, 0x6014, 0x2048,
-	0x080c, 0x5474, 0x1d70, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
-	0x4005, 0xa89b, 0x0004, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139,
-	0x080c, 0x6d70, 0x012e, 0x080c, 0xabc9, 0x00fe, 0x00ee, 0x009e,
-	0x0005, 0x7060, 0xaad0, 0x9206, 0x0930, 0x0888, 0x0016, 0x0026,
-	0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0150,
-	0xa890, 0x9106, 0x1118, 0xa88c, 0x9206, 0x0120, 0xa992, 0xaa8e,
-	0x9085, 0x0001, 0x002e, 0x001e, 0x0005, 0x00b6, 0x00d6, 0x0036,
-	0x080c, 0xc814, 0x0904, 0xce63, 0x0096, 0x6314, 0x2348, 0xa87a,
-	0xa982, 0x929e, 0x4000, 0x1580, 0x6310, 0x00c6, 0x2358, 0x2009,
-	0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c, 0x690d, 0x1108, 0xc185,
-	0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96, 0xa99a, 0x20a9, 0x0004,
-	0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8c4, 0x20e0,
-	0xb8c8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0fb7, 0x20a9, 0x0004,
-	0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8c8, 0x9080, 0x000a, 0x2098,
-	0x080c, 0x0fb7, 0x00ce, 0x0090, 0xaa96, 0x3918, 0x9398, 0x0007,
-	0x231c, 0x6004, 0x9086, 0x0016, 0x0110, 0xa89b, 0x0004, 0xaba2,
-	0x6310, 0x2358, 0xb804, 0x9084, 0x00ff, 0xa89e, 0x080c, 0x6d64,
-	0x6017, 0x0000, 0x009e, 0x003e, 0x00de, 0x00be, 0x0005, 0x0026,
-	0x0036, 0x0046, 0x00b6, 0x0096, 0x00f6, 0x6214, 0x2248, 0x6210,
-	0x2258, 0x2079, 0x0260, 0x9096, 0x0000, 0x11a0, 0xb814, 0x9084,
-	0x00ff, 0x900e, 0x080c, 0x25fb, 0x2118, 0x831f, 0x939c, 0xff00,
-	0x7838, 0x9084, 0x00ff, 0x931d, 0x7c3c, 0x2011, 0x8018, 0x080c,
-	0x4b00, 0x00a8, 0x9096, 0x0001, 0x1148, 0x89ff, 0x0180, 0xa89b,
-	0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x0048, 0x9096, 0x0002,
-	0x1130, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x00fe,
-	0x009e, 0x00be, 0x004e, 0x003e, 0x002e, 0x0005, 0x00c6, 0x0026,
-	0x0016, 0x9186, 0x0035, 0x0110, 0x6a38, 0x0008, 0x6a2c, 0x080c,
-	0xc802, 0x01f0, 0x2260, 0x6120, 0x9186, 0x0003, 0x0118, 0x9186,
-	0x0006, 0x1190, 0x6838, 0x9206, 0x0140, 0x683c, 0x9206, 0x1160,
-	0x6108, 0x6838, 0x9106, 0x1140, 0x0020, 0x6008, 0x693c, 0x9106,
-	0x1118, 0x6010, 0x6910, 0x9106, 0x001e, 0x002e, 0x00ce, 0x0005,
-	0x9085, 0x0001, 0x0cc8, 0xa974, 0xd1cc, 0x0188, 0x918c, 0x00ff,
-	0x918e, 0x0002, 0x1160, 0xa9a8, 0x918c, 0x0f00, 0x810f, 0x918e,
-	0x0001, 0x1128, 0xa834, 0xa938, 0x9115, 0x190c, 0xbe8f, 0x0005,
-	0x0036, 0x2019, 0x0001, 0x0010, 0x0036, 0x901e, 0x0499, 0x01e0,
-	0x080c, 0xc814, 0x01c8, 0x080c, 0xca03, 0x6037, 0x4000, 0x6014,
-	0x6017, 0x0000, 0x0096, 0x2048, 0xa87c, 0x080c, 0xca29, 0x1118,
-	0x080c, 0xb591, 0x0040, 0xa867, 0x0103, 0xa877, 0x0000, 0x83ff,
-	0x1129, 0x080c, 0x6d70, 0x009e, 0x003e, 0x0005, 0xa880, 0xd0b4,
-	0x0128, 0xa87b, 0x0006, 0xc0ec, 0xa882, 0x0048, 0xd0bc, 0x0118,
-	0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xcb18, 0xa877,
-	0x0000, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0ec, 0x0005, 0x0006,
-	0x2001, 0x1810, 0x2004, 0xd0f4, 0x000e, 0x0005, 0x0006, 0x2001,
-	0x1810, 0x2004, 0xd0e4, 0x000e, 0x0005, 0x0036, 0x0046, 0x6010,
-	0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0007, 0x080c, 0x4cb7,
-	0x004e, 0x003e, 0x0005, 0x0c51, 0x1d81, 0x0005, 0x2001, 0x1986,
-	0x2004, 0x601a, 0x0005, 0x2001, 0x1988, 0x2004, 0x604a, 0x0005,
-	0x080c, 0xabc9, 0x0804, 0x966f, 0x611c, 0xd1fc, 0xa97c, 0x1108,
-	0xd1e4, 0x0005, 0x601c, 0xd0fc, 0xa87c, 0x1108, 0xd0e4, 0x0005,
-	0x601c, 0xd0fc, 0xc0fc, 0x601e, 0xa87c, 0x1108, 0xd0e4, 0x0005,
-	0x6044, 0xd0fc, 0x0160, 0xd0dc, 0x1128, 0x908c, 0x000f, 0x9186,
-	0x0005, 0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001, 0x0005,
-	0x00b6, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d7d, 0x001b,
-	0x006e, 0x00be, 0x0005, 0xcf93, 0xd69b, 0xd7ec, 0xcf93, 0xcf93,
-	0xcf93, 0xcf93, 0xcf93, 0xcfca, 0xd86a, 0xcf93, 0xcf93, 0xcf93,
-	0xcf93, 0xcf93, 0xcf93, 0x080c, 0x0d7d, 0x0066, 0x6000, 0x90b2,
-	0x0016, 0x1a0c, 0x0d7d, 0x0013, 0x006e, 0x0005, 0xcfae, 0xdd81,
-	0xcfae, 0xcfae, 0xcfae, 0xcfae, 0xcfae, 0xcfae, 0xdd30, 0xddd3,
-	0xcfae, 0xe428, 0xe45c, 0xe428, 0xe45c, 0xcfae, 0x080c, 0x0d7d,
-	0x6000, 0x9082, 0x0016, 0x1a0c, 0x0d7d, 0x6000, 0x000a, 0x0005,
-	0xcfc8, 0xda46, 0xdb0f, 0xdb31, 0xdbac, 0xcfc8, 0xdca6, 0xdc34,
-	0xd874, 0xdd08, 0xdd1d, 0xcfc8, 0xcfc8, 0xcfc8, 0xcfc8, 0xcfc8,
-	0x080c, 0x0d7d, 0x91b2, 0x0053, 0x1a0c, 0x0d7d, 0x2100, 0x91b2,
-	0x0040, 0x1a04, 0xd411, 0x0002, 0xd014, 0xd202, 0xd014, 0xd014,
-	0xd014, 0xd20b, 0xd014, 0xd014, 0xd014, 0xd014, 0xd014, 0xd014,
-	0xd014, 0xd014, 0xd014, 0xd014, 0xd014, 0xd014, 0xd014, 0xd014,
-	0xd014, 0xd014, 0xd014, 0xd016, 0xd07d, 0xd08c, 0xd0f0, 0xd11b,
-	0xd194, 0xd1ed, 0xd014, 0xd014, 0xd20e, 0xd014, 0xd014, 0xd223,
-	0xd230, 0xd014, 0xd014, 0xd014, 0xd014, 0xd014, 0xd2b3, 0xd014,
-	0xd014, 0xd2c7, 0xd014, 0xd014, 0xd282, 0xd014, 0xd014, 0xd014,
-	0xd2df, 0xd014, 0xd014, 0xd014, 0xd35c, 0xd014, 0xd014, 0xd014,
-	0xd014, 0xd014, 0xd014, 0xd3d9, 0x080c, 0x0d7d, 0x080c, 0x6a19,
-	0x1150, 0x2001, 0x1837, 0x2004, 0xd0cc, 0x1128, 0x9084, 0x0009,
-	0x9086, 0x0008, 0x1140, 0x6007, 0x0009, 0x602f, 0x0009, 0x6017,
-	0x0000, 0x0804, 0xd1fb, 0x080c, 0x69be, 0x00e6, 0x00c6, 0x0036,
-	0x0026, 0x0016, 0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029,
-	0x080c, 0xa872, 0x080c, 0x9374, 0x0076, 0x903e, 0x080c, 0x9246,
-	0x2c08, 0x080c, 0xdfc0, 0x007e, 0x001e, 0x080c, 0xa88e, 0x001e,
-	0x002e, 0x003e, 0x00ce, 0x00ee, 0x6610, 0x2658, 0x080c, 0x662d,
-	0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1268, 0x0016, 0x0026,
-	0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x2c08, 0x080c, 0xe685,
-	0x002e, 0x001e, 0x1178, 0x080c, 0xdeee, 0x1904, 0xd0e8, 0x080c,
-	0xde8a, 0x1120, 0x6007, 0x0008, 0x0804, 0xd1fb, 0x6007, 0x0009,
-	0x0804, 0xd1fb, 0x080c, 0xe121, 0x0128, 0x080c, 0xdeee, 0x0d78,
-	0x0804, 0xd0e8, 0x6017, 0x1900, 0x0c88, 0x080c, 0x332b, 0x1904,
-	0xd40e, 0x6106, 0x080c, 0xde3d, 0x6007, 0x0006, 0x0804, 0xd1fb,
-	0x6007, 0x0007, 0x0804, 0xd1fb, 0x080c, 0xe498, 0x1904, 0xd40e,
-	0x080c, 0x332b, 0x1904, 0xd40e, 0x00d6, 0x6610, 0x2658, 0xbe04,
-	0x9684, 0x00ff, 0x9082, 0x0006, 0x1220, 0x2001, 0x0001, 0x080c,
-	0x655a, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0188, 0x9686,
-	0x0004, 0x0170, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0140,
-	0x9686, 0x0004, 0x0128, 0x9686, 0x0005, 0x0110, 0x00de, 0x0480,
-	0x00e6, 0x2071, 0x0260, 0x7034, 0x9084, 0x0003, 0x1140, 0x7034,
-	0x9082, 0x0014, 0x0220, 0x7030, 0x9084, 0x0003, 0x0130, 0x00ee,
-	0x6017, 0x0000, 0x602f, 0x0007, 0x00b0, 0x00ee, 0x080c, 0xdf56,
-	0x1190, 0x9686, 0x0006, 0x1140, 0x0026, 0x6210, 0x2258, 0xbaa0,
-	0x900e, 0x080c, 0x3235, 0x002e, 0x080c, 0x66b9, 0x6007, 0x000a,
-	0x00de, 0x0804, 0xd1fb, 0x6007, 0x000b, 0x00de, 0x0804, 0xd1fb,
-	0x080c, 0x31e4, 0x080c, 0xcf43, 0x6007, 0x0001, 0x0804, 0xd1fb,
-	0x080c, 0xe498, 0x1904, 0xd40e, 0x080c, 0x332b, 0x1904, 0xd40e,
-	0x2071, 0x0260, 0x7034, 0x90b4, 0x0003, 0x1948, 0x90b2, 0x0014,
-	0x0a30, 0x7030, 0x9084, 0x0003, 0x1910, 0x6610, 0x2658, 0xbe04,
-	0x9686, 0x0707, 0x09e8, 0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e,
-	0x080c, 0x3235, 0x002e, 0x6007, 0x000c, 0x2001, 0x0001, 0x080c,
-	0xe665, 0x0804, 0xd1fb, 0x080c, 0x6a19, 0x1140, 0x2001, 0x1837,
-	0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804, 0xd023,
-	0x080c, 0x69be, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082,
-	0x0006, 0x06c8, 0x1138, 0x0026, 0x2001, 0x0006, 0x080c, 0x659a,
-	0x002e, 0x0050, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120,
-	0x9686, 0x0006, 0x1904, 0xd0e8, 0x080c, 0xdf63, 0x1120, 0x6007,
-	0x000e, 0x0804, 0xd1fb, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046,
-	0x080c, 0x31e4, 0x080c, 0xcf43, 0x004e, 0x0016, 0x9006, 0x2009,
-	0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029, 0x080c, 0xe29e,
+	0x8000, 0x0016, 0x080c, 0xab97, 0x0180, 0x2b08, 0x6112, 0x080c,
+	0xcccc, 0x6023, 0x0001, 0x2900, 0x6016, 0x001e, 0x080c, 0xac8c,
+	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x001e, 0x9006, 0x0cd0,
+	0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0066, 0x0096, 0x00e6,
+	0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x1568, 0x7190, 0x6014,
+	0x2048, 0xa814, 0x8003, 0x9106, 0x1530, 0x20e1, 0x0000, 0x2001,
+	0x19a0, 0x2003, 0x0000, 0x6014, 0x2048, 0xa830, 0x20a8, 0x8906,
+	0x8006, 0x8007, 0x9094, 0x003f, 0x22e8, 0x9084, 0xffc0, 0x9080,
+	0x001b, 0x20a0, 0x2001, 0x19a0, 0x0016, 0x200c, 0x080c, 0xd565,
+	0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c38, 0x6014, 0x2048,
+	0xa867, 0x0103, 0x0010, 0x080c, 0xb5b5, 0x080c, 0xabed, 0x00fe,
+	0x00ee, 0x009e, 0x006e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e,
+	0x0005, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015,
+	0x11b8, 0x7090, 0x9086, 0x0004, 0x1198, 0x6014, 0x2048, 0x2c78,
+	0x080c, 0x975f, 0x01a8, 0x707c, 0xaa74, 0x9206, 0x1130, 0x7080,
+	0xaa78, 0x9206, 0x1110, 0x080c, 0x31e7, 0x080c, 0xaffd, 0x0020,
+	0x080c, 0xb5b5, 0x080c, 0xabed, 0x00fe, 0x00ee, 0x009e, 0x0005,
+	0x7060, 0xaa78, 0x9206, 0x0d78, 0x0c80, 0x0096, 0x00e6, 0x00f6,
+	0x2071, 0x1800, 0x9186, 0x0015, 0x1550, 0x7090, 0x9086, 0x0004,
+	0x1530, 0x6014, 0x2048, 0x2c78, 0x080c, 0x975f, 0x05f0, 0x707c,
+	0xaacc, 0x9206, 0x1180, 0x7080, 0xaad0, 0x9206, 0x1160, 0x080c,
+	0x31e7, 0x0016, 0xa998, 0xaab0, 0x9284, 0x1000, 0xc0fd, 0x080c,
+	0x5692, 0x001e, 0x0010, 0x080c, 0x547b, 0x080c, 0xc838, 0x0508,
+	0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0080, 0x080c,
+	0xc838, 0x01b8, 0x6014, 0x2048, 0x080c, 0x547b, 0x1d70, 0xa87b,
+	0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0x0126,
+	0x2091, 0x8000, 0xa867, 0x0139, 0x080c, 0x6d80, 0x012e, 0x080c,
+	0xabed, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x7060, 0xaad0, 0x9206,
+	0x0930, 0x0888, 0x0016, 0x0026, 0xa87c, 0xd0ac, 0x0178, 0xa938,
+	0xaa34, 0x2100, 0x9205, 0x0150, 0xa890, 0x9106, 0x1118, 0xa88c,
+	0x9206, 0x0120, 0xa992, 0xaa8e, 0x9085, 0x0001, 0x002e, 0x001e,
+	0x0005, 0x00b6, 0x00d6, 0x0036, 0x080c, 0xc838, 0x0904, 0xce87,
+	0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x929e, 0x4000, 0x1580,
+	0x6310, 0x00c6, 0x2358, 0x2009, 0x0000, 0xa868, 0xd0f4, 0x1140,
+	0x080c, 0x6914, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0xaa96, 0xa99a, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x0031, 0x20a0, 0xb8c4, 0x20e0, 0xb8c8, 0x9080, 0x0006, 0x2098,
+	0x080c, 0x0fb7, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x0035, 0x20a0,
+	0xb8c8, 0x9080, 0x000a, 0x2098, 0x080c, 0x0fb7, 0x00ce, 0x0090,
+	0xaa96, 0x3918, 0x9398, 0x0007, 0x231c, 0x6004, 0x9086, 0x0016,
+	0x0110, 0xa89b, 0x0004, 0xaba2, 0x6310, 0x2358, 0xb804, 0x9084,
+	0x00ff, 0xa89e, 0x080c, 0x6d74, 0x6017, 0x0000, 0x009e, 0x003e,
+	0x00de, 0x00be, 0x0005, 0x0026, 0x0036, 0x0046, 0x00b6, 0x0096,
+	0x00f6, 0x6214, 0x2248, 0x6210, 0x2258, 0x2079, 0x0260, 0x9096,
+	0x0000, 0x11a0, 0xb814, 0x9084, 0x00ff, 0x900e, 0x080c, 0x25fb,
+	0x2118, 0x831f, 0x939c, 0xff00, 0x7838, 0x9084, 0x00ff, 0x931d,
+	0x7c3c, 0x2011, 0x8018, 0x080c, 0x4b07, 0x00a8, 0x9096, 0x0001,
+	0x1148, 0x89ff, 0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c,
+	0xa8aa, 0x0048, 0x9096, 0x0002, 0x1130, 0xa89b, 0x000d, 0x7838,
+	0xa8a6, 0x783c, 0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e, 0x003e,
+	0x002e, 0x0005, 0x00c6, 0x0026, 0x0016, 0x9186, 0x0035, 0x0110,
+	0x6a38, 0x0008, 0x6a2c, 0x080c, 0xc826, 0x01f0, 0x2260, 0x6120,
+	0x9186, 0x0003, 0x0118, 0x9186, 0x0006, 0x1190, 0x6838, 0x9206,
+	0x0140, 0x683c, 0x9206, 0x1160, 0x6108, 0x6838, 0x9106, 0x1140,
+	0x0020, 0x6008, 0x693c, 0x9106, 0x1118, 0x6010, 0x6910, 0x9106,
+	0x001e, 0x002e, 0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8, 0xa974,
+	0xd1cc, 0x0188, 0x918c, 0x00ff, 0x918e, 0x0002, 0x1160, 0xa9a8,
+	0x918c, 0x0f00, 0x810f, 0x918e, 0x0001, 0x1128, 0xa834, 0xa938,
+	0x9115, 0x190c, 0xbeb3, 0x0005, 0x0036, 0x2019, 0x0001, 0x0010,
+	0x0036, 0x901e, 0x0499, 0x01e0, 0x080c, 0xc838, 0x01c8, 0x080c,
+	0xca27, 0x6037, 0x4000, 0x6014, 0x6017, 0x0000, 0x0096, 0x2048,
+	0xa87c, 0x080c, 0xca4d, 0x1118, 0x080c, 0xb5b5, 0x0040, 0xa867,
+	0x0103, 0xa877, 0x0000, 0x83ff, 0x1129, 0x080c, 0x6d80, 0x009e,
+	0x003e, 0x0005, 0xa880, 0xd0b4, 0x0128, 0xa87b, 0x0006, 0xc0ec,
+	0xa882, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b,
+	0x0005, 0x080c, 0xcb3c, 0xa877, 0x0000, 0x0005, 0x2001, 0x1810,
+	0x2004, 0xd0ec, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0f4,
+	0x000e, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0e4, 0x000e,
+	0x0005, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be,
+	0x2021, 0x0007, 0x080c, 0x4cbe, 0x004e, 0x003e, 0x0005, 0x0c51,
+	0x1d81, 0x0005, 0x2001, 0x1986, 0x2004, 0x601a, 0x0005, 0x2001,
+	0x1988, 0x2004, 0x604a, 0x0005, 0x080c, 0xabed, 0x0804, 0x96a0,
+	0x611c, 0xd1fc, 0xa97c, 0x1108, 0xd1e4, 0x0005, 0x601c, 0xd0fc,
+	0xa87c, 0x1108, 0xd0e4, 0x0005, 0x601c, 0xd0fc, 0xc0fc, 0x601e,
+	0xa87c, 0x1108, 0xd0e4, 0x0005, 0x6044, 0xd0fc, 0x0160, 0xd0dc,
+	0x1128, 0x908c, 0x000f, 0x9186, 0x0005, 0x1118, 0x6003, 0x0003,
+	0x0010, 0x6003, 0x0001, 0x0005, 0x00b6, 0x0066, 0x6000, 0x90b2,
+	0x0016, 0x1a0c, 0x0d7d, 0x001b, 0x006e, 0x00be, 0x0005, 0xcfb7,
+	0xd6c0, 0xd811, 0xcfb7, 0xcfb7, 0xcfb7, 0xcfb7, 0xcfb7, 0xcfee,
+	0xd893, 0xcfb7, 0xcfb7, 0xcfb7, 0xcfb7, 0xcfb7, 0xcfb7, 0x080c,
+	0x0d7d, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d7d, 0x0013,
+	0x006e, 0x0005, 0xcfd2, 0xddaa, 0xcfd2, 0xcfd2, 0xcfd2, 0xcfd2,
+	0xcfd2, 0xcfd2, 0xdd59, 0xddfc, 0xcfd2, 0xe453, 0xe487, 0xe453,
+	0xe487, 0xcfd2, 0x080c, 0x0d7d, 0x6000, 0x9082, 0x0016, 0x1a0c,
+	0x0d7d, 0x6000, 0x000a, 0x0005, 0xcfec, 0xda6f, 0xdb38, 0xdb5a,
+	0xdbd5, 0xcfec, 0xdccf, 0xdc5d, 0xd89d, 0xdd31, 0xdd46, 0xcfec,
+	0xcfec, 0xcfec, 0xcfec, 0xcfec, 0x080c, 0x0d7d, 0x91b2, 0x0053,
+	0x1a0c, 0x0d7d, 0x2100, 0x91b2, 0x0040, 0x1a04, 0xd436, 0x0002,
+	0xd038, 0xd227, 0xd038, 0xd038, 0xd038, 0xd230, 0xd038, 0xd038,
+	0xd038, 0xd038, 0xd038, 0xd038, 0xd038, 0xd038, 0xd038, 0xd038,
+	0xd038, 0xd038, 0xd038, 0xd038, 0xd038, 0xd038, 0xd038, 0xd03a,
+	0xd0a1, 0xd0b0, 0xd114, 0xd13f, 0xd1b8, 0xd212, 0xd038, 0xd038,
+	0xd233, 0xd038, 0xd038, 0xd248, 0xd255, 0xd038, 0xd038, 0xd038,
+	0xd038, 0xd038, 0xd2d8, 0xd038, 0xd038, 0xd2ec, 0xd038, 0xd038,
+	0xd2a7, 0xd038, 0xd038, 0xd038, 0xd304, 0xd038, 0xd038, 0xd038,
+	0xd381, 0xd038, 0xd038, 0xd038, 0xd038, 0xd038, 0xd038, 0xd3fe,
+	0x080c, 0x0d7d, 0x080c, 0x6a29, 0x1150, 0x2001, 0x1837, 0x2004,
+	0xd0cc, 0x1128, 0x9084, 0x0009, 0x9086, 0x0008, 0x1140, 0x6007,
+	0x0009, 0x602f, 0x0009, 0x6017, 0x0000, 0x0804, 0xd220, 0x080c,
+	0x69c5, 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x6210, 0x2258,
+	0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0xa896, 0x080c, 0x93a5,
+	0x0076, 0x903e, 0x080c, 0x9277, 0x2c08, 0x080c, 0xdfeb, 0x007e,
+	0x001e, 0x080c, 0xa8b2, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee,
+	0x6610, 0x2658, 0x080c, 0x6634, 0xbe04, 0x9684, 0x00ff, 0x9082,
+	0x0006, 0x1268, 0x0016, 0x0026, 0x6210, 0x00b6, 0x2258, 0xbaa0,
+	0x00be, 0x2c08, 0x080c, 0xe6b0, 0x002e, 0x001e, 0x1178, 0x080c,
+	0xdf19, 0x1904, 0xd10c, 0x080c, 0xdeb5, 0x1120, 0x6007, 0x0008,
+	0x0804, 0xd220, 0x6007, 0x0009, 0x0804, 0xd220, 0x080c, 0xe14c,
+	0x0128, 0x080c, 0xdf19, 0x0d78, 0x0804, 0xd10c, 0x6017, 0x1900,
+	0x0c88, 0x080c, 0x3332, 0x1904, 0xd433, 0x6106, 0x080c, 0xde66,
+	0x6007, 0x0006, 0x0804, 0xd220, 0x6007, 0x0007, 0x0804, 0xd220,
+	0x080c, 0xe4c3, 0x1904, 0xd433, 0x080c, 0x3332, 0x1904, 0xd433,
+	0x00d6, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006,
+	0x1220, 0x2001, 0x0001, 0x080c, 0x6561, 0x96b4, 0xff00, 0x8637,
+	0x9686, 0x0006, 0x0188, 0x9686, 0x0004, 0x0170, 0xbe04, 0x96b4,
+	0x00ff, 0x9686, 0x0006, 0x0140, 0x9686, 0x0004, 0x0128, 0x9686,
+	0x0005, 0x0110, 0x00de, 0x0480, 0x00e6, 0x2071, 0x0260, 0x7034,
+	0x9084, 0x0003, 0x1140, 0x7034, 0x9082, 0x0014, 0x0220, 0x7030,
+	0x9084, 0x0003, 0x0130, 0x00ee, 0x6017, 0x0000, 0x602f, 0x0007,
+	0x00b0, 0x00ee, 0x080c, 0xdf81, 0x1190, 0x9686, 0x0006, 0x1140,
+	0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c, 0x323c, 0x002e,
+	0x080c, 0x66c0, 0x6007, 0x000a, 0x00de, 0x0804, 0xd220, 0x6007,
+	0x000b, 0x00de, 0x0804, 0xd220, 0x080c, 0x31e7, 0x080c, 0xcf67,
+	0x6007, 0x0001, 0x0804, 0xd220, 0x080c, 0xe4c3, 0x1904, 0xd433,
+	0x080c, 0x3332, 0x1904, 0xd433, 0x2071, 0x0260, 0x7034, 0x90b4,
+	0x0003, 0x1948, 0x90b2, 0x0014, 0x0a30, 0x7030, 0x9084, 0x0003,
+	0x1910, 0x6610, 0x2658, 0xbe04, 0x9686, 0x0707, 0x09e8, 0x0026,
+	0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c, 0x323c, 0x002e, 0x6007,
+	0x000c, 0x2001, 0x0001, 0x080c, 0xe690, 0x0804, 0xd220, 0x080c,
+	0x6a29, 0x1140, 0x2001, 0x1837, 0x2004, 0x9084, 0x0009, 0x9086,
+	0x0008, 0x1110, 0x0804, 0xd047, 0x080c, 0x69c5, 0x6610, 0x2658,
+	0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x06c8, 0x1138, 0x0026,
+	0x2001, 0x0006, 0x080c, 0x65a1, 0x002e, 0x0050, 0x96b4, 0xff00,
+	0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xd10c,
+	0x080c, 0xdf8e, 0x1120, 0x6007, 0x000e, 0x0804, 0xd220, 0x0046,
+	0x6410, 0x2458, 0xbca0, 0x0046, 0x080c, 0x31e7, 0x080c, 0xcf67,
+	0x004e, 0x0016, 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0148,
+	0x2009, 0x0029, 0x080c, 0xe2c9, 0x6010, 0x2058, 0xb800, 0xc0e5,
+	0xb802, 0x001e, 0x004e, 0x6007, 0x0001, 0x0804, 0xd220, 0x2001,
+	0x0001, 0x080c, 0x6561, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9,
+	0x0004, 0x2019, 0x1805, 0x2011, 0x0270, 0x080c, 0xbbae, 0x003e,
+	0x002e, 0x001e, 0x015e, 0x9005, 0x0168, 0x96b4, 0xff00, 0x8637,
+	0x9682, 0x0004, 0x0a04, 0xd10c, 0x9682, 0x0007, 0x0a04, 0xd168,
+	0x0804, 0xd10c, 0x6017, 0x1900, 0x6007, 0x0009, 0x0804, 0xd220,
+	0x080c, 0x6a29, 0x1140, 0x2001, 0x1837, 0x2004, 0x9084, 0x0009,
+	0x9086, 0x0008, 0x1110, 0x0804, 0xd047, 0x080c, 0x69c5, 0x6610,
+	0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x0698, 0x0150,
+	0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006,
+	0x1904, 0xd10c, 0x080c, 0xdfbc, 0x1130, 0x080c, 0xdeb5, 0x1118,
+	0x6007, 0x0010, 0x04e8, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046,
+	0x080c, 0x31e7, 0x080c, 0xcf67, 0x004e, 0x0016, 0x9006, 0x2009,
+	0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009, 0x0029, 0x080c, 0xe2c9,
 	0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007,
-	0x0001, 0x0804, 0xd1fb, 0x2001, 0x0001, 0x080c, 0x655a, 0x0156,
-	0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011,
-	0x0270, 0x080c, 0xbb8a, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005,
-	0x0168, 0x96b4, 0xff00, 0x8637, 0x9682, 0x0004, 0x0a04, 0xd0e8,
-	0x9682, 0x0007, 0x0a04, 0xd144, 0x0804, 0xd0e8, 0x6017, 0x1900,
-	0x6007, 0x0009, 0x0804, 0xd1fb, 0x080c, 0x6a19, 0x1140, 0x2001,
-	0x1837, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804,
-	0xd023, 0x080c, 0x69be, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff,
-	0x9082, 0x0006, 0x0690, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004,
-	0x0120, 0x9686, 0x0006, 0x1904, 0xd0e8, 0x080c, 0xdf91, 0x1130,
-	0x080c, 0xde8a, 0x1118, 0x6007, 0x0010, 0x04e8, 0x0046, 0x6410,
-	0x2458, 0xbca0, 0x0046, 0x080c, 0x31e4, 0x080c, 0xcf43, 0x004e,
-	0x0016, 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0148, 0x2009,
-	0x0029, 0x080c, 0xe29e, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802,
-	0x001e, 0x004e, 0x6007, 0x0001, 0x00f0, 0x080c, 0xe121, 0x0140,
-	0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0978, 0x0804, 0xd0e8,
-	0x6017, 0x1900, 0x6007, 0x0009, 0x0070, 0x080c, 0x332b, 0x1904,
-	0xd40e, 0x080c, 0xe498, 0x1904, 0xd40e, 0x080c, 0xd5db, 0x1904,
-	0xd0e8, 0x6007, 0x0012, 0x6003, 0x0001, 0x080c, 0x91f4, 0x080c,
-	0x966f, 0x0005, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x91f4,
-	0x080c, 0x966f, 0x0cb0, 0x6007, 0x0005, 0x0c68, 0x080c, 0xe498,
-	0x1904, 0xd40e, 0x080c, 0x332b, 0x1904, 0xd40e, 0x080c, 0xd5db,
-	0x1904, 0xd0e8, 0x6007, 0x0020, 0x6003, 0x0001, 0x080c, 0x91f4,
-	0x080c, 0x966f, 0x0005, 0x080c, 0x332b, 0x1904, 0xd40e, 0x6007,
-	0x0023, 0x6003, 0x0001, 0x080c, 0x91f4, 0x080c, 0x966f, 0x0005,
-	0x080c, 0xe498, 0x1904, 0xd40e, 0x080c, 0x332b, 0x1904, 0xd40e,
-	0x080c, 0xd5db, 0x1904, 0xd0e8, 0x0016, 0x0026, 0x00e6, 0x2071,
-	0x0260, 0x7244, 0x9286, 0xffff, 0x0180, 0x2c08, 0x080c, 0xc802,
-	0x01b0, 0x2260, 0x7240, 0x6008, 0x9206, 0x1188, 0x6010, 0x9190,
-	0x0004, 0x2214, 0x9206, 0x01b8, 0x0050, 0x7240, 0x2c08, 0x9006,
-	0x080c, 0xe268, 0x1180, 0x7244, 0x9286, 0xffff, 0x01b0, 0x2160,
-	0x6007, 0x0026, 0x6017, 0x1700, 0x7214, 0x9296, 0xffff, 0x1180,
-	0x6007, 0x0025, 0x0068, 0x6020, 0x9086, 0x0007, 0x1d80, 0x6004,
-	0x9086, 0x0024, 0x1110, 0x080c, 0xabc9, 0x2160, 0x6007, 0x0025,
-	0x6003, 0x0001, 0x080c, 0x91f4, 0x080c, 0x966f, 0x00ee, 0x002e,
-	0x001e, 0x0005, 0x2001, 0x0001, 0x080c, 0x655a, 0x0156, 0x0016,
-	0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276,
-	0x080c, 0xbb8a, 0x003e, 0x002e, 0x001e, 0x015e, 0x0120, 0x6007,
-	0x0031, 0x0804, 0xd1fb, 0x080c, 0xb7fb, 0x080c, 0x74d5, 0x1190,
-	0x0006, 0x0026, 0x0036, 0x080c, 0x74ef, 0x1138, 0x080c, 0x77d9,
-	0x080c, 0x6022, 0x080c, 0x7406, 0x0010, 0x080c, 0x74a9, 0x003e,
-	0x002e, 0x000e, 0x0005, 0x080c, 0x332b, 0x1904, 0xd40e, 0x080c,
-	0xd5db, 0x1904, 0xd0e8, 0x6106, 0x080c, 0xd5f7, 0x1120, 0x6007,
-	0x002b, 0x0804, 0xd1fb, 0x6007, 0x002c, 0x0804, 0xd1fb, 0x080c,
-	0xe498, 0x1904, 0xd40e, 0x080c, 0x332b, 0x1904, 0xd40e, 0x080c,
-	0xd5db, 0x1904, 0xd0e8, 0x6106, 0x080c, 0xd5fc, 0x1120, 0x6007,
-	0x002e, 0x0804, 0xd1fb, 0x6007, 0x002f, 0x0804, 0xd1fb, 0x080c,
-	0x332b, 0x1904, 0xd40e, 0x00e6, 0x00d6, 0x00c6, 0x6010, 0x2058,
-	0xb904, 0x9184, 0x00ff, 0x9086, 0x0006, 0x0158, 0x9184, 0xff00,
-	0x8007, 0x9086, 0x0006, 0x0128, 0x00ce, 0x00de, 0x00ee, 0x0804,
-	0xd202, 0x080c, 0x56d7, 0xd0e4, 0x0904, 0xd359, 0x2071, 0x026c,
-	0x7010, 0x603a, 0x7014, 0x603e, 0x7108, 0x720c, 0x080c, 0x6a57,
-	0x0140, 0x6010, 0x2058, 0xb810, 0x9106, 0x1118, 0xb814, 0x9206,
-	0x0510, 0x080c, 0x6a53, 0x15b8, 0x2069, 0x1800, 0x6880, 0x9206,
-	0x1590, 0x687c, 0x9106, 0x1578, 0x7210, 0x080c, 0xc802, 0x0590,
-	0x080c, 0xd4c6, 0x0578, 0x080c, 0xe31a, 0x0560, 0x622e, 0x6007,
-	0x0036, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x91ed, 0x00ce,
-	0x00de, 0x00ee, 0x0005, 0x7214, 0x9286, 0xffff, 0x0150, 0x080c,
-	0xc802, 0x01c0, 0x9280, 0x0002, 0x2004, 0x7110, 0x9106, 0x1190,
-	0x08e0, 0x7210, 0x2c08, 0x9085, 0x0001, 0x080c, 0xe268, 0x2c10,
-	0x2160, 0x0140, 0x0890, 0x6007, 0x0037, 0x602f, 0x0009, 0x6017,
-	0x1500, 0x08b8, 0x6007, 0x0037, 0x602f, 0x0003, 0x6017, 0x1700,
-	0x0880, 0x6007, 0x0012, 0x0868, 0x080c, 0x332b, 0x1904, 0xd40e,
-	0x6010, 0x2058, 0xb804, 0x9084, 0xff00, 0x8007, 0x9086, 0x0006,
-	0x1904, 0xd202, 0x00e6, 0x00d6, 0x00c6, 0x080c, 0x56d7, 0xd0e4,
-	0x0904, 0xd3d1, 0x2069, 0x1800, 0x2071, 0x026c, 0x7008, 0x603a,
-	0x720c, 0x623e, 0x9286, 0xffff, 0x1150, 0x7208, 0x00c6, 0x2c08,
-	0x9085, 0x0001, 0x080c, 0xe268, 0x2c10, 0x00ce, 0x05e8, 0x080c,
-	0xc802, 0x05d0, 0x7108, 0x9280, 0x0002, 0x2004, 0x9106, 0x15a0,
-	0x00c6, 0x0026, 0x2260, 0x080c, 0xc412, 0x002e, 0x00ce, 0x7118,
-	0x918c, 0xff00, 0x810f, 0x9186, 0x0001, 0x0178, 0x9186, 0x0005,
-	0x0118, 0x9186, 0x0007, 0x1198, 0x9280, 0x0005, 0x2004, 0x9005,
-	0x0170, 0x080c, 0xd4c6, 0x0904, 0xd352, 0x0056, 0x7510, 0x7614,
-	0x080c, 0xe333, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x6007,
-	0x003b, 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x2009,
-	0x8020, 0x080c, 0x91ed, 0x0c78, 0x6007, 0x003b, 0x602f, 0x0003,
-	0x6017, 0x0300, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x91ed,
-	0x0c10, 0x6007, 0x003b, 0x602f, 0x000b, 0x6017, 0x0000, 0x0804,
-	0xd329, 0x00e6, 0x0026, 0x080c, 0x6a19, 0x0550, 0x080c, 0x69be,
-	0x080c, 0xe50a, 0x1518, 0x2071, 0x1800, 0x70dc, 0x9085, 0x0003,
-	0x70de, 0x00f6, 0x2079, 0x0100, 0x72b0, 0x9284, 0x00ff, 0x707e,
-	0x78e6, 0x9284, 0xff00, 0x7280, 0x9205, 0x7082, 0x78ea, 0x00fe,
-	0x70e7, 0x0000, 0x080c, 0x6a57, 0x0120, 0x2011, 0x1a09, 0x2013,
-	0x07d0, 0xd0ac, 0x1128, 0x080c, 0x2fb2, 0x0010, 0x080c, 0xe53c,
-	0x002e, 0x00ee, 0x080c, 0xabc9, 0x0804, 0xd201, 0x080c, 0xabc9,
-	0x0005, 0x2600, 0x0002, 0xd425, 0xd456, 0xd467, 0xd425, 0xd425,
-	0xd427, 0xd478, 0xd425, 0xd425, 0xd425, 0xd444, 0xd425, 0xd425,
-	0xd425, 0xd483, 0xd490, 0xd4c1, 0xd425, 0x080c, 0x0d7d, 0x080c,
-	0xe498, 0x1d20, 0x080c, 0x332b, 0x1d08, 0x080c, 0xd5db, 0x1148,
-	0x7038, 0x6016, 0x6007, 0x0045, 0x6003, 0x0001, 0x080c, 0x91f4,
-	0x0005, 0x080c, 0x31e4, 0x080c, 0xcf43, 0x6007, 0x0001, 0x6003,
-	0x0001, 0x080c, 0x91f4, 0x0005, 0x080c, 0xe498, 0x1938, 0x080c,
-	0x332b, 0x1920, 0x080c, 0xd5db, 0x1d60, 0x703c, 0x6016, 0x6007,
-	0x004a, 0x6003, 0x0001, 0x080c, 0x91f4, 0x0005, 0x080c, 0x332b,
-	0x1904, 0xd40e, 0x2009, 0x0041, 0x080c, 0xe545, 0x6007, 0x0047,
-	0x6003, 0x0001, 0x080c, 0x91f4, 0x080c, 0x966f, 0x0005, 0x080c,
-	0x332b, 0x1904, 0xd40e, 0x2009, 0x0042, 0x080c, 0xe545, 0x6007,
-	0x0047, 0x6003, 0x0001, 0x080c, 0x91f4, 0x080c, 0x966f, 0x0005,
-	0x080c, 0x332b, 0x1904, 0xd40e, 0x2009, 0x0046, 0x080c, 0xe545,
-	0x080c, 0xabc9, 0x0005, 0x080c, 0xd4e3, 0x0904, 0xd40e, 0x6007,
-	0x004e, 0x6003, 0x0001, 0x080c, 0x91f4, 0x080c, 0x966f, 0x0005,
-	0x6007, 0x004f, 0x6017, 0x0000, 0x7134, 0x918c, 0x00ff, 0x81ff,
-	0x0508, 0x9186, 0x0001, 0x1160, 0x7140, 0x2001, 0x19bd, 0x2004,
-	0x9106, 0x11b0, 0x7144, 0x2001, 0x19be, 0x2004, 0x9106, 0x0190,
-	0x9186, 0x0002, 0x1168, 0x2011, 0x0276, 0x20a9, 0x0004, 0x6010,
-	0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xbb9e, 0x009e, 0x0110,
-	0x6017, 0x0001, 0x6003, 0x0001, 0x080c, 0x91f4, 0x080c, 0x966f,
-	0x0005, 0x6007, 0x0050, 0x703c, 0x6016, 0x0ca0, 0x0016, 0x00e6,
-	0x2071, 0x0260, 0x00b6, 0x00c6, 0x2260, 0x6010, 0x2058, 0xb8d4,
-	0xd084, 0x0150, 0x7128, 0x6050, 0x9106, 0x1120, 0x712c, 0x604c,
-	0x9106, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x00be,
-	0x00ee, 0x001e, 0x0005, 0x0016, 0x0096, 0x0086, 0x00e6, 0x01c6,
-	0x01d6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1800, 0x7090, 0x908a,
-	0x00f9, 0x16e8, 0x20e1, 0x0000, 0x2001, 0x19a0, 0x2003, 0x0000,
-	0x080c, 0x1053, 0x05a0, 0x2900, 0x6016, 0x7090, 0x8004, 0xa816,
-	0x908a, 0x001e, 0x02d0, 0xa833, 0x001e, 0x20a9, 0x001e, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a0, 0x0016,
-	0x200c, 0x0471, 0x001e, 0x2940, 0x080c, 0x1053, 0x01c0, 0x2900,
-	0xa006, 0x2100, 0x81ff, 0x0180, 0x0c18, 0xa832, 0x20a8, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x19a0, 0x0016,
-	0x200c, 0x00b1, 0x001e, 0x0000, 0x9085, 0x0001, 0x0048, 0x2071,
-	0x1800, 0x7093, 0x0000, 0x6014, 0x2048, 0x080c, 0x0fec, 0x9006,
-	0x012e, 0x01de, 0x01ce, 0x00ee, 0x008e, 0x009e, 0x001e, 0x0005,
-	0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x918c, 0xffff, 0x11a8,
-	0x080c, 0x2189, 0x2099, 0x026c, 0x2001, 0x0014, 0x3518, 0x9312,
-	0x1218, 0x23a8, 0x4003, 0x00f8, 0x20a8, 0x4003, 0x22a8, 0x8108,
-	0x080c, 0x2189, 0x2099, 0x0260, 0x0ca8, 0x080c, 0x2189, 0x2061,
-	0x19a0, 0x6004, 0x2098, 0x6008, 0x3518, 0x9312, 0x1218, 0x23a8,
-	0x4003, 0x0048, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x2189,
-	0x2099, 0x0260, 0x0ca8, 0x2061, 0x19a0, 0x2019, 0x0280, 0x3300,
-	0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0260, 0x6006, 0x8108,
-	0x2162, 0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e,
-	0x002e, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036,
-	0x00c6, 0x81ff, 0x11b8, 0x080c, 0x21a1, 0x20a1, 0x024c, 0x2001,
-	0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0418, 0x20a8,
-	0x4003, 0x82ff, 0x01f8, 0x22a8, 0x8108, 0x080c, 0x21a1, 0x20a1,
-	0x0240, 0x0c98, 0x080c, 0x21a1, 0x2061, 0x19a3, 0x6004, 0x20a0,
-	0x6008, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0058, 0x20a8,
-	0x4003, 0x82ff, 0x0138, 0x22a8, 0x8108, 0x080c, 0x21a1, 0x20a1,
-	0x0240, 0x0c98, 0x2061, 0x19a3, 0x2019, 0x0260, 0x3400, 0x931e,
-	0x0110, 0x6006, 0x0020, 0x2001, 0x0240, 0x6006, 0x8108, 0x2162,
-	0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e,
-	0x001e, 0x000e, 0x0005, 0x00b6, 0x0066, 0x6610, 0x2658, 0xbe04,
-	0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0170, 0x9686, 0x0004,
-	0x0158, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0128, 0x9686,
-	0x0004, 0x0110, 0x9085, 0x0001, 0x006e, 0x00be, 0x0005, 0x00d6,
-	0x080c, 0xd671, 0x00de, 0x0005, 0x00d6, 0x080c, 0xd67e, 0x1520,
-	0x680c, 0x908c, 0xff00, 0x6820, 0x9084, 0x00ff, 0x9115, 0x6216,
-	0x6824, 0x602e, 0xd1e4, 0x0130, 0x9006, 0x080c, 0xe665, 0x2009,
-	0x0001, 0x0078, 0xd1ec, 0x0180, 0x6920, 0x918c, 0x00ff, 0x6824,
-	0x080c, 0x25fb, 0x1148, 0x2001, 0x0001, 0x080c, 0xe665, 0x2110,
-	0x900e, 0x080c, 0x3235, 0x0018, 0x9085, 0x0001, 0x0008, 0x9006,
-	0x00de, 0x0005, 0x00b6, 0x00c6, 0x080c, 0xac3b, 0x0598, 0x0016,
-	0x0026, 0x00c6, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
-	0x25fb, 0x1568, 0x080c, 0x65bd, 0x1550, 0xbe12, 0xbd16, 0x00ce,
-	0x002e, 0x001e, 0x2b00, 0x6012, 0x080c, 0xe498, 0x11c8, 0x080c,
-	0x332b, 0x11b0, 0x080c, 0xd5db, 0x0500, 0x2001, 0x0007, 0x080c,
-	0x656e, 0x2001, 0x0007, 0x080c, 0x659a, 0x6017, 0x0000, 0x6023,
-	0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x91f4, 0x0010,
-	0x080c, 0xabc9, 0x9085, 0x0001, 0x00ce, 0x00be, 0x0005, 0x080c,
-	0xabc9, 0x00ce, 0x002e, 0x001e, 0x0ca8, 0x080c, 0xabc9, 0x9006,
-	0x0c98, 0x2069, 0x026d, 0x6800, 0x9082, 0x0010, 0x1228, 0x6017,
-	0x0000, 0x9085, 0x0001, 0x0008, 0x9006, 0x0005, 0x6017, 0x0000,
-	0x2069, 0x026c, 0x6808, 0x9084, 0xff00, 0x9086, 0x0800, 0x1190,
-	0x6904, 0x9186, 0x0018, 0x0118, 0x9186, 0x0014, 0x1158, 0x810f,
-	0x6800, 0x9084, 0x00ff, 0x910d, 0x6162, 0x908e, 0x0014, 0x0110,
-	0x908e, 0x0010, 0x0005, 0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0d7d,
-	0x91b6, 0x0013, 0x1130, 0x2008, 0x91b2, 0x0040, 0x1a04, 0xd7c0,
-	0x0092, 0x91b6, 0x0027, 0x0120, 0x91b6, 0x0014, 0x190c, 0x0d7d,
-	0x2001, 0x0007, 0x080c, 0x659a, 0x080c, 0x95ad, 0x080c, 0xac04,
-	0x080c, 0x966f, 0x0005, 0xd6fb, 0xd6fd, 0xd6fb, 0xd6fb, 0xd6fb,
-	0xd6fd, 0xd70a, 0xd7bd, 0xd75a, 0xd7bd, 0xd76e, 0xd7bd, 0xd70a,
-	0xd7bd, 0xd7b5, 0xd7bd, 0xd7b5, 0xd7bd, 0xd7bd, 0xd6fb, 0xd6fb,
-	0xd6fb, 0xd6fb, 0xd6fb, 0xd6fb, 0xd6fb, 0xd6fb, 0xd6fb, 0xd6fb,
-	0xd6fb, 0xd6fd, 0xd6fb, 0xd7bd, 0xd6fb, 0xd6fb, 0xd7bd, 0xd6fb,
-	0xd7ba, 0xd7bd, 0xd6fb, 0xd6fb, 0xd6fb, 0xd6fb, 0xd7bd, 0xd7bd,
-	0xd6fb, 0xd7bd, 0xd7bd, 0xd6fb, 0xd705, 0xd6fb, 0xd6fb, 0xd6fb,
-	0xd6fb, 0xd7b9, 0xd7bd, 0xd6fb, 0xd6fb, 0xd7bd, 0xd7bd, 0xd6fb,
-	0xd6fb, 0xd6fb, 0xd6fb, 0x080c, 0x0d7d, 0x080c, 0xcf46, 0x6003,
-	0x0002, 0x080c, 0x966f, 0x0804, 0xd7bf, 0x9006, 0x080c, 0x655a,
-	0x0804, 0xd7bd, 0x080c, 0x6a53, 0x1904, 0xd7bd, 0x9006, 0x080c,
-	0x655a, 0x6010, 0x2058, 0xb810, 0x9086, 0x00ff, 0x1140, 0x00f6,
-	0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x0428, 0x6010,
-	0x2058, 0xb884, 0x9005, 0x1178, 0x080c, 0xcf2e, 0x1904, 0xd7bd,
-	0x0036, 0x0046, 0xbba0, 0x2021, 0x0007, 0x080c, 0x4cb7, 0x004e,
-	0x003e, 0x0804, 0xd7bd, 0x080c, 0x335c, 0x1904, 0xd7bd, 0x2001,
-	0x1800, 0x2004, 0x9086, 0x0002, 0x1138, 0x00f6, 0x2079, 0x1800,
-	0x78a8, 0x8000, 0x78aa, 0x00fe, 0x2001, 0x0002, 0x080c, 0x656e,
-	0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x91f4,
-	0x080c, 0x966f, 0x6110, 0x2158, 0x2009, 0x0001, 0x080c, 0x861b,
-	0x0804, 0xd7bf, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637,
-	0x9686, 0x0006, 0x0904, 0xd7bd, 0x9686, 0x0004, 0x0904, 0xd7bd,
-	0x080c, 0x8e99, 0x2001, 0x0004, 0x0804, 0xd7bb, 0x2001, 0x1800,
-	0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058,
-	0xbba0, 0x2021, 0x0006, 0x080c, 0x4cb7, 0x004e, 0x003e, 0x2001,
-	0x0006, 0x080c, 0xd7d9, 0x6610, 0x2658, 0xbe04, 0x0066, 0x96b4,
-	0xff00, 0x8637, 0x9686, 0x0006, 0x006e, 0x0168, 0x2001, 0x0006,
-	0x080c, 0x659a, 0x9284, 0x00ff, 0x908e, 0x0007, 0x1120, 0x2001,
-	0x0006, 0x080c, 0x656e, 0x080c, 0x6a53, 0x11f8, 0x2001, 0x1837,
-	0x2004, 0xd0a4, 0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006,
-	0x01a0, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe,
-	0x0804, 0xd744, 0x2001, 0x0004, 0x0030, 0x2001, 0x0006, 0x0409,
-	0x0020, 0x0018, 0x0010, 0x080c, 0x659a, 0x080c, 0xabc9, 0x0005,
-	0x2600, 0x0002, 0xd7d4, 0xd7d4, 0xd7d4, 0xd7d4, 0xd7d4, 0xd7d6,
-	0xd7d4, 0xd7d6, 0xd7d4, 0xd7d4, 0xd7d6, 0xd7d4, 0xd7d4, 0xd7d4,
-	0xd7d6, 0xd7d6, 0xd7d6, 0xd7d6, 0x080c, 0x0d7d, 0x080c, 0xabc9,
-	0x0005, 0x0016, 0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900, 0xd184,
-	0x0138, 0x080c, 0x656e, 0x9006, 0x080c, 0x655a, 0x080c, 0x3215,
-	0x00de, 0x00be, 0x001e, 0x0005, 0x6610, 0x2658, 0xb804, 0x9084,
-	0xff00, 0x8007, 0x90b2, 0x000c, 0x1a0c, 0x0d7d, 0x91b6, 0x0015,
-	0x1110, 0x003b, 0x0028, 0x91b6, 0x0016, 0x190c, 0x0d7d, 0x006b,
-	0x0005, 0xb67a, 0xb67a, 0xb67a, 0xb67a, 0xb67a, 0xb67a, 0xd854,
-	0xd819, 0xb67a, 0xb67a, 0xb67a, 0xb67a, 0xb67a, 0xb67a, 0xb67a,
-	0xb67a, 0xb67a, 0xb67a, 0xd854, 0xd85b, 0xb67a, 0xb67a, 0xb67a,
-	0xb67a, 0x00f6, 0x080c, 0x6a53, 0x11d8, 0x080c, 0xcf2e, 0x11c0,
-	0x6010, 0x905d, 0x01a8, 0xb884, 0x9005, 0x0190, 0x9006, 0x080c,
-	0x655a, 0x2001, 0x0002, 0x080c, 0x656e, 0x6023, 0x0001, 0x6003,
-	0x0001, 0x6007, 0x0002, 0x080c, 0x91f4, 0x080c, 0x966f, 0x00d0,
-	0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x25fb, 0x1190,
-	0x080c, 0x661e, 0x0118, 0x080c, 0xabc9, 0x0060, 0xb810, 0x0006,
-	0xb814, 0x0006, 0x080c, 0x603c, 0x000e, 0xb816, 0x000e, 0xb812,
-	0x080c, 0xabc9, 0x00fe, 0x0005, 0x6604, 0x96b6, 0x001e, 0x1110,
-	0x080c, 0xabc9, 0x0005, 0x080c, 0xba03, 0x1148, 0x6003, 0x0001,
-	0x6007, 0x0001, 0x080c, 0x91f4, 0x080c, 0x966f, 0x0010, 0x080c,
-	0xabc9, 0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d7d, 0x080c,
-	0x95ad, 0x080c, 0xac04, 0x0005, 0x9182, 0x0040, 0x0002, 0xd88a,
-	0xd88a, 0xd88a, 0xd88a, 0xd88c, 0xd88a, 0xd88a, 0xd88a, 0xd88a,
-	0xd88a, 0xd88a, 0xd88a, 0xd88a, 0xd88a, 0xd88a, 0xd88a, 0xd88a,
-	0xd88a, 0xd88a, 0x080c, 0x0d7d, 0x0096, 0x00b6, 0x00d6, 0x00e6,
-	0x00f6, 0x0046, 0x0026, 0x6210, 0x2258, 0xb8bc, 0x9005, 0x11b0,
-	0x6007, 0x0044, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904,
-	0xd8f3, 0x080c, 0xe659, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009,
-	0x0001, 0x2011, 0x0200, 0x080c, 0x88bb, 0x0020, 0x9026, 0x080c,
-	0xe4dd, 0x0c30, 0x080c, 0x103a, 0x090c, 0x0d7d, 0x6003, 0x0007,
-	0xa867, 0x010d, 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e,
-	0x6008, 0xa8e2, 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016,
-	0xa876, 0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c,
-	0x6d70, 0x001e, 0x080c, 0xe659, 0x1904, 0xd953, 0x9486, 0x2000,
-	0x1130, 0x2019, 0x0017, 0x080c, 0xe20e, 0x0804, 0xd953, 0x9486,
-	0x0200, 0x1120, 0x080c, 0xe19e, 0x0804, 0xd953, 0x9486, 0x0400,
-	0x0120, 0x9486, 0x1000, 0x1904, 0xd953, 0x2019, 0x0002, 0x080c,
-	0xe1bd, 0x0804, 0xd953, 0x2069, 0x1a6f, 0x6a00, 0xd284, 0x0904,
-	0xd9bd, 0x9284, 0x0300, 0x1904, 0xd9b6, 0x6804, 0x9005, 0x0904,
-	0xd99e, 0x2d78, 0x6003, 0x0007, 0x080c, 0x1053, 0x0904, 0xd95f,
-	0x7800, 0xd08c, 0x1118, 0x7804, 0x8001, 0x7806, 0x6017, 0x0000,
-	0x2001, 0x180f, 0x2004, 0xd084, 0x1904, 0xd9c1, 0x9006, 0xa802,
-	0xa867, 0x0116, 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010,
-	0x2058, 0xb8a0, 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c,
-	0xa9be, 0xb930, 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044,
-	0x9084, 0x0003, 0x9080, 0xd95b, 0x2005, 0xa87e, 0x20a9, 0x000a,
-	0x2001, 0x0270, 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205, 0x200b,
-	0x0080, 0x20e1, 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003,
-	0x200b, 0x0000, 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c,
-	0xa9ae, 0x080c, 0x6d73, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de,
-	0x00be, 0x009e, 0x0005, 0x0000, 0x0080, 0x0040, 0x0000, 0x2001,
-	0x1810, 0x2004, 0xd084, 0x0120, 0x080c, 0x103a, 0x1904, 0xd908,
-	0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009, 0xa022,
-	0x080c, 0x91ed, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00,
-	0x9086, 0x1200, 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114,
-	0x918c, 0xf700, 0x910d, 0x6116, 0x001e, 0x6003, 0x0001, 0x6007,
-	0x0043, 0x2009, 0xa025, 0x080c, 0x91ed, 0x0828, 0x6868, 0x602e,
-	0x686c, 0x6032, 0x6017, 0xf200, 0x6003, 0x0001, 0x6007, 0x0041,
-	0x2009, 0xa022, 0x080c, 0x91ed, 0x0804, 0xd953, 0x2001, 0x180e,
-	0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4b00, 0x6017,
-	0xf300, 0x0010, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041,
-	0x2009, 0xa022, 0x080c, 0x91ed, 0x0804, 0xd953, 0x6017, 0xf500,
-	0x0c98, 0x6017, 0xf600, 0x0804, 0xd973, 0x6017, 0xf200, 0x0804,
-	0xd973, 0xa867, 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00,
-	0xa87a, 0x7044, 0x9084, 0x0003, 0x9080, 0xd95b, 0x2005, 0xa87e,
-	0x2928, 0x6010, 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c,
-	0xa88e, 0xb830, 0xa892, 0xb834, 0xa896, 0xa883, 0x003d, 0x2009,
-	0x0205, 0x2104, 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011,
-	0x0210, 0x2214, 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c,
-	0x0d7d, 0x8210, 0x821c, 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0029, 0x20a0, 0x2011, 0xda3d, 0x2041, 0x0001,
-	0x223d, 0x9784, 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003,
-	0x931a, 0x0530, 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001,
-	0x0260, 0x2098, 0x0c68, 0x2950, 0x080c, 0x1053, 0x0170, 0x2900,
-	0xb002, 0xa867, 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c,
-	0x9080, 0x001b, 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d,
-	0x0118, 0x080c, 0x106c, 0x0cc8, 0x080c, 0x106c, 0x0804, 0xd95f,
-	0x2548, 0x8847, 0x9885, 0x0046, 0xa866, 0x2009, 0x0205, 0x200b,
-	0x0000, 0x080c, 0xe241, 0x0804, 0xd953, 0x8010, 0x0004, 0x801a,
-	0x0006, 0x8018, 0x0008, 0x8016, 0x000a, 0x8014, 0x9186, 0x0013,
-	0x1160, 0x6004, 0x908a, 0x0057, 0x1a0c, 0x0d7d, 0x9082, 0x0040,
-	0x0a0c, 0x0d7d, 0x2008, 0x0804, 0xdac8, 0x9186, 0x0051, 0x0108,
-	0x0040, 0x080c, 0xaa84, 0x01e8, 0x9086, 0x0002, 0x0904, 0xdb0f,
-	0x00c0, 0x9186, 0x0027, 0x0180, 0x9186, 0x0048, 0x0128, 0x9186,
-	0x0014, 0x0150, 0x190c, 0x0d7d, 0x080c, 0xaa84, 0x0150, 0x9086,
-	0x0004, 0x0904, 0xdbac, 0x0028, 0x6004, 0x9082, 0x0040, 0x2008,
-	0x001a, 0x080c, 0xac85, 0x0005, 0xda8f, 0xda91, 0xda91, 0xdab8,
-	0xda8f, 0xda8f, 0xda8f, 0xda8f, 0xda8f, 0xda8f, 0xda8f, 0xda8f,
-	0xda8f, 0xda8f, 0xda8f, 0xda8f, 0xda8f, 0xda8f, 0xda8f, 0x080c,
-	0x0d7d, 0x080c, 0x95ad, 0x080c, 0x966f, 0x0036, 0x0096, 0x6014,
-	0x904d, 0x01d8, 0x080c, 0xc814, 0x01c0, 0x6003, 0x0002, 0x6010,
-	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1178, 0x2019, 0x0004,
-	0x080c, 0xe241, 0x6017, 0x0000, 0x6018, 0x9005, 0x1120, 0x2001,
-	0x1987, 0x2004, 0x601a, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005,
-	0x0096, 0x080c, 0x95ad, 0x080c, 0x966f, 0x080c, 0xc814, 0x0120,
-	0x6014, 0x2048, 0x080c, 0x106c, 0x080c, 0xac04, 0x009e, 0x0005,
-	0x0002, 0xdadc, 0xdaf1, 0xdade, 0xdb06, 0xdadc, 0xdadc, 0xdadc,
-	0xdadc, 0xdadc, 0xdadc, 0xdadc, 0xdadc, 0xdadc, 0xdadc, 0xdadc,
-	0xdadc, 0xdadc, 0xdadc, 0xdadc, 0x080c, 0x0d7d, 0x0096, 0x6014,
-	0x2048, 0xa87c, 0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009, 0x0043,
-	0x080c, 0xac68, 0x0010, 0x6003, 0x0004, 0x080c, 0x966f, 0x009e,
-	0x0005, 0x080c, 0xc814, 0x0138, 0x6114, 0x0096, 0x2148, 0xa97c,
-	0x009e, 0xd1ec, 0x1138, 0x080c, 0x8890, 0x080c, 0xabc9, 0x080c,
-	0x966f, 0x0005, 0x080c, 0xe4a1, 0x0db0, 0x0cc8, 0x6003, 0x0001,
-	0x6007, 0x0041, 0x2009, 0xa022, 0x080c, 0x91ed, 0x0005, 0x9182,
-	0x0040, 0x0002, 0xdb25, 0xdb27, 0xdb25, 0xdb25, 0xdb25, 0xdb25,
-	0xdb25, 0xdb25, 0xdb25, 0xdb25, 0xdb25, 0xdb25, 0xdb25, 0xdb25,
-	0xdb25, 0xdb25, 0xdb25, 0xdb28, 0xdb25, 0x080c, 0x0d7d, 0x0005,
-	0x00d6, 0x080c, 0x8890, 0x00de, 0x080c, 0xe4f9, 0x080c, 0xabc9,
-	0x0005, 0x9182, 0x0040, 0x0002, 0xdb47, 0xdb47, 0xdb47, 0xdb47,
-	0xdb47, 0xdb47, 0xdb47, 0xdb47, 0xdb47, 0xdb49, 0xdb74, 0xdb47,
-	0xdb47, 0xdb47, 0xdb47, 0xdb74, 0xdb47, 0xdb47, 0xdb47, 0x080c,
-	0x0d7d, 0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x908c,
-	0x0003, 0x918e, 0x0002, 0x0180, 0x6144, 0xd1e4, 0x1168, 0x2009,
-	0x0041, 0x009e, 0x0804, 0xdc34, 0x6003, 0x0007, 0x601b, 0x0000,
-	0x080c, 0x8890, 0x009e, 0x0005, 0x6014, 0x2048, 0xa97c, 0xd1ec,
-	0x1130, 0x080c, 0x8890, 0x080c, 0xabc9, 0x009e, 0x0005, 0x080c,
-	0xe4a1, 0x0db8, 0x009e, 0x0005, 0x2001, 0x180c, 0x200c, 0xc1d4,
-	0x2102, 0x0036, 0x080c, 0x960a, 0x080c, 0x966f, 0x6014, 0x0096,
-	0x2048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0188,
-	0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x0140, 0xa8ac, 0x6330,
-	0x931a, 0x6332, 0xa8b0, 0x632c, 0x931b, 0x632e, 0x6003, 0x0002,
-	0x0080, 0x2019, 0x0004, 0x080c, 0xe241, 0x6018, 0x9005, 0x1128,
-	0x2001, 0x1987, 0x2004, 0x8003, 0x601a, 0x6017, 0x0000, 0x6003,
-	0x0007, 0x009e, 0x003e, 0x0005, 0x9182, 0x0040, 0x0002, 0xdbc3,
-	0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3, 0xdbc5,
-	0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3, 0xdbc3,
-	0xdbc3, 0xdbc3, 0xdc10, 0x080c, 0x0d7d, 0x6014, 0x0096, 0x2048,
-	0xa834, 0xaa38, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc,
-	0x1190, 0x920d, 0x1518, 0xa87c, 0xd0fc, 0x0128, 0x2009, 0x0041,
-	0x009e, 0x0804, 0xdc34, 0x6003, 0x0007, 0x601b, 0x0000, 0x080c,
-	0x8890, 0x009e, 0x0005, 0x6124, 0xd1f4, 0x1d58, 0x0006, 0x0046,
-	0xacac, 0x9422, 0xa9b0, 0x2200, 0x910b, 0x6030, 0x9420, 0x6432,
-	0x602c, 0x9109, 0x612e, 0x004e, 0x000e, 0x08d8, 0x6110, 0x00b6,
-	0x2158, 0xb900, 0x00be, 0xd1bc, 0x1178, 0x2009, 0x180e, 0x210c,
-	0xd19c, 0x0118, 0x6003, 0x0007, 0x0010, 0x6003, 0x0006, 0x00e9,
-	0x080c, 0x8892, 0x009e, 0x0005, 0x6003, 0x0002, 0x009e, 0x0005,
-	0x6024, 0xd0f4, 0x0128, 0x080c, 0x1670, 0x1904, 0xdbc5, 0x0005,
-	0x6014, 0x0096, 0x2048, 0xa834, 0xa938, 0x009e, 0x9105, 0x1120,
-	0x080c, 0x1670, 0x1904, 0xdbc5, 0x0005, 0xd2fc, 0x0140, 0x8002,
-	0x8000, 0x8212, 0x9291, 0x0000, 0x2009, 0x0009, 0x0010, 0x2009,
-	0x0015, 0xaa9a, 0xa896, 0x0005, 0x9182, 0x0040, 0x0208, 0x0062,
-	0x9186, 0x0013, 0x0120, 0x9186, 0x0014, 0x190c, 0x0d7d, 0x6024,
-	0xd0dc, 0x090c, 0x0d7d, 0x0005, 0xdc57, 0xdc63, 0xdc6f, 0xdc7b,
-	0xdc57, 0xdc57, 0xdc57, 0xdc57, 0xdc5e, 0xdc59, 0xdc59, 0xdc57,
-	0xdc57, 0xdc57, 0xdc57, 0xdc59, 0xdc57, 0xdc59, 0xdc57, 0x080c,
-	0x0d7d, 0x6024, 0xd0dc, 0x090c, 0x0d7d, 0x0005, 0x6014, 0x9005,
-	0x190c, 0x0d7d, 0x0005, 0x6003, 0x0001, 0x6106, 0x0126, 0x2091,
-	0x8000, 0x2009, 0xa022, 0x080c, 0x91cf, 0x012e, 0x0005, 0x6003,
-	0x0004, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa001, 0x080c,
-	0x91ed, 0x012e, 0x0005, 0x6003, 0x0003, 0x6106, 0x080c, 0x1c03,
-	0x0126, 0x2091, 0x8000, 0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc,
-	0x0188, 0x9084, 0x0003, 0x9086, 0x0002, 0x01a0, 0x6024, 0xd0cc,
-	0x1148, 0xd0c4, 0x1138, 0xa8a8, 0x9005, 0x1120, 0x6144, 0x918d,
-	0xb035, 0x0018, 0x6144, 0x918d, 0xa035, 0x009e, 0x080c, 0x9234,
-	0x012e, 0x0005, 0x6144, 0x918d, 0xa032, 0x0cb8, 0x0126, 0x2091,
-	0x8000, 0x0036, 0x0096, 0x9182, 0x0040, 0x0023, 0x009e, 0x003e,
-	0x012e, 0x0005, 0xdcc2, 0xdcc4, 0xdcd9, 0xdcf3, 0xdcc2, 0xdcc2,
-	0xdcc2, 0xdcc2, 0xdcc2, 0xdcc2, 0xdcc2, 0xdcc2, 0xdcc2, 0xdcc2,
-	0xdcc2, 0xdcc2, 0x080c, 0x0d7d, 0x6014, 0x2048, 0xa87c, 0xd0fc,
-	0x0510, 0x909c, 0x0003, 0x939e, 0x0003, 0x01e8, 0x6003, 0x0001,
-	0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa022, 0x080c, 0x91ed,
-	0x0470, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x909c, 0x0003,
-	0x939e, 0x0003, 0x0140, 0x6003, 0x0001, 0x6106, 0x2009, 0xa001,
-	0x080c, 0x91ed, 0x00e0, 0x901e, 0x6316, 0x631a, 0x2019, 0x0004,
-	0x080c, 0xe241, 0x00a0, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0d98,
-	0x909c, 0x0003, 0x939e, 0x0003, 0x0d70, 0x6003, 0x0003, 0x6106,
-	0x080c, 0x1c03, 0x6144, 0x918d, 0xa035, 0x080c, 0x9234, 0x0005,
-	0x080c, 0x95ad, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c,
-	0xe5f6, 0x0036, 0x2019, 0x0029, 0x080c, 0xe241, 0x003e, 0x009e,
-	0x080c, 0xac04, 0x080c, 0x966f, 0x0005, 0x080c, 0x960a, 0x6114,
-	0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xe5f6, 0x0036, 0x2019,
-	0x0029, 0x080c, 0xe241, 0x003e, 0x009e, 0x080c, 0xac04, 0x0005,
-	0x9182, 0x0085, 0x0002, 0xdd42, 0xdd40, 0xdd40, 0xdd4e, 0xdd40,
-	0xdd40, 0xdd40, 0xdd40, 0xdd40, 0xdd40, 0xdd40, 0xdd40, 0xdd40,
-	0x080c, 0x0d7d, 0x6003, 0x000b, 0x6106, 0x0126, 0x2091, 0x8000,
-	0x2009, 0x8020, 0x080c, 0x91ed, 0x012e, 0x0005, 0x0026, 0x00e6,
-	0x080c, 0xe498, 0x0118, 0x080c, 0xabc9, 0x0440, 0x2071, 0x0260,
-	0x7224, 0x6216, 0x2001, 0x180e, 0x2004, 0xd0e4, 0x0150, 0x6010,
-	0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2011, 0x014e, 0x080c,
-	0xaef6, 0x7220, 0x080c, 0xe0d7, 0x0118, 0x6007, 0x0086, 0x0040,
-	0x6007, 0x0087, 0x7224, 0x9296, 0xffff, 0x1110, 0x6007, 0x0086,
-	0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x91ed, 0x00ee, 0x002e,
-	0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c,
-	0x0d7d, 0x908a, 0x0092, 0x1a0c, 0x0d7d, 0x9082, 0x0085, 0x00a2,
-	0x9186, 0x0027, 0x0130, 0x9186, 0x0014, 0x0118, 0x080c, 0xac85,
-	0x0050, 0x2001, 0x0007, 0x080c, 0x659a, 0x080c, 0x95ad, 0x080c,
-	0xac04, 0x080c, 0x966f, 0x0005, 0xddb1, 0xddb3, 0xddb3, 0xddb1,
-	0xddb1, 0xddb1, 0xddb1, 0xddb1, 0xddb1, 0xddb1, 0xddb1, 0xddb1,
-	0xddb1, 0x080c, 0x0d7d, 0x080c, 0xac04, 0x080c, 0x966f, 0x0005,
-	0x9182, 0x0085, 0x0a0c, 0x0d7d, 0x9182, 0x0092, 0x1a0c, 0x0d7d,
-	0x9182, 0x0085, 0x0002, 0xddd0, 0xddd0, 0xddd0, 0xddd2, 0xddd0,
-	0xddd0, 0xddd0, 0xddd0, 0xddd0, 0xddd0, 0xddd0, 0xddd0, 0xddd0,
-	0x080c, 0x0d7d, 0x0005, 0x9186, 0x0013, 0x0148, 0x9186, 0x0014,
-	0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xac85, 0x0020, 0x080c,
-	0x95ad, 0x080c, 0xac04, 0x0005, 0x0036, 0x080c, 0xe4f9, 0x604b,
-	0x0000, 0x2019, 0x000b, 0x0031, 0x6023, 0x0006, 0x6003, 0x0007,
-	0x003e, 0x0005, 0x0126, 0x0036, 0x2091, 0x8000, 0x2001, 0x0382,
-	0x2004, 0x9084, 0x0007, 0x0006, 0x9086, 0x0003, 0x0110, 0x080c,
-	0xa872, 0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0xa1f4, 0x009e,
-	0x008e, 0x1550, 0x0076, 0x2c38, 0x080c, 0xa29f, 0x007e, 0x1520,
-	0x6000, 0x9086, 0x0000, 0x0500, 0x6020, 0x9086, 0x0007, 0x01e0,
-	0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xe4f9, 0x080c, 0xcf46,
-	0x080c, 0x1a6a, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xc814,
-	0x0110, 0x080c, 0xe241, 0x009e, 0x6017, 0x0000, 0x080c, 0xe4f9,
-	0x6023, 0x0007, 0x080c, 0xcf46, 0x000e, 0x9086, 0x0003, 0x0110,
-	0x080c, 0xa88e, 0x003e, 0x012e, 0x0005, 0x00f6, 0x00c6, 0x00b6,
-	0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c, 0x080c, 0x25fb,
-	0x15d8, 0x0016, 0x00c6, 0x080c, 0x661e, 0x15a0, 0x001e, 0x00c6,
-	0x2160, 0x080c, 0xcf43, 0x00ce, 0x002e, 0x0026, 0x0016, 0x080c,
-	0xa872, 0x2019, 0x0029, 0x080c, 0xa366, 0x080c, 0x9374, 0x0076,
-	0x903e, 0x080c, 0x9246, 0x007e, 0x001e, 0x0076, 0x903e, 0x080c,
-	0xdfc0, 0x007e, 0x080c, 0xa88e, 0x0026, 0xba04, 0x9294, 0xff00,
-	0x8217, 0x9286, 0x0006, 0x0118, 0x9286, 0x0004, 0x1118, 0xbaa0,
-	0x080c, 0x32b7, 0x002e, 0x001e, 0x080c, 0x603c, 0xbe12, 0xbd16,
-	0x9006, 0x0010, 0x00ce, 0x001e, 0x015e, 0x003e, 0x00be, 0x00ce,
-	0x00fe, 0x0005, 0x00c6, 0x00d6, 0x00b6, 0x0016, 0x2009, 0x1824,
-	0x2104, 0x9086, 0x0074, 0x1904, 0xdee3, 0x2069, 0x0260, 0x6944,
-	0x9182, 0x0100, 0x06e0, 0x6940, 0x9184, 0x8000, 0x0904, 0xdee0,
-	0x2001, 0x197c, 0x2004, 0x9005, 0x1140, 0x6010, 0x2058, 0xb884,
-	0x9005, 0x0118, 0x9184, 0x0800, 0x0598, 0x6948, 0x918a, 0x0001,
-	0x0648, 0x080c, 0xe65e, 0x0118, 0x6978, 0xd1fc, 0x11b8, 0x2009,
-	0x0205, 0x200b, 0x0001, 0x693c, 0x81ff, 0x1198, 0x6944, 0x9182,
-	0x0100, 0x02a8, 0x6940, 0x81ff, 0x1178, 0x6948, 0x918a, 0x0001,
-	0x0288, 0x6950, 0x918a, 0x0001, 0x0298, 0x00d0, 0x6017, 0x0100,
-	0x00a0, 0x6017, 0x0300, 0x0088, 0x6017, 0x0500, 0x0070, 0x6017,
-	0x0700, 0x0058, 0x6017, 0x0900, 0x0040, 0x6017, 0x0b00, 0x0028,
-	0x6017, 0x0f00, 0x0010, 0x6017, 0x2d00, 0x9085, 0x0001, 0x0008,
-	0x9006, 0x001e, 0x00be, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00b6,
-	0x0026, 0x0036, 0x0156, 0x6210, 0x2258, 0xbb04, 0x9394, 0x00ff,
-	0x9286, 0x0006, 0x0180, 0x9286, 0x0004, 0x0168, 0x9394, 0xff00,
-	0x8217, 0x9286, 0x0006, 0x0138, 0x9286, 0x0004, 0x0120, 0x080c,
-	0x662d, 0x0804, 0xdf4f, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096,
-	0x2b48, 0x2019, 0x000a, 0x080c, 0xbb9e, 0x009e, 0x15c8, 0x2011,
-	0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c,
-	0xbb9e, 0x009e, 0x1568, 0x0046, 0x0016, 0xbaa0, 0x2220, 0x9006,
-	0x2009, 0x1848, 0x210c, 0xd1a4, 0x0138, 0x2009, 0x0029, 0x080c,
-	0xe29e, 0xb800, 0xc0e5, 0xb802, 0x080c, 0xa872, 0x2019, 0x0029,
-	0x080c, 0x9374, 0x0076, 0x2039, 0x0000, 0x080c, 0x9246, 0x2c08,
-	0x080c, 0xdfc0, 0x007e, 0x080c, 0xa88e, 0x2001, 0x0007, 0x080c,
-	0x659a, 0x2001, 0x0007, 0x080c, 0x656e, 0x001e, 0x004e, 0x9006,
-	0x015e, 0x003e, 0x002e, 0x00be, 0x00ce, 0x0005, 0x00d6, 0x2069,
-	0x026e, 0x6800, 0x9086, 0x0800, 0x0118, 0x6017, 0x0000, 0x0008,
-	0x9006, 0x00de, 0x0005, 0x00b6, 0x00f6, 0x0016, 0x0026, 0x0036,
-	0x0156, 0x2079, 0x026c, 0x7930, 0x7834, 0x080c, 0x25fb, 0x11d0,
-	0x080c, 0x661e, 0x11b8, 0x2011, 0x0270, 0x20a9, 0x0004, 0x0096,
-	0x2b48, 0x2019, 0x000a, 0x080c, 0xbb9e, 0x009e, 0x1158, 0x2011,
-	0x0274, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c,
-	0xbb9e, 0x009e, 0x015e, 0x003e, 0x002e, 0x001e, 0x00fe, 0x00be,
-	0x0005, 0x00b6, 0x0006, 0x0016, 0x0026, 0x0036, 0x0156, 0x2011,
-	0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x25fb, 0x11d0, 0x080c,
-	0x661e, 0x11b8, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48,
-	0x2019, 0x000a, 0x080c, 0xbb9e, 0x009e, 0x1158, 0x2011, 0x027a,
-	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xbb9e,
-	0x009e, 0x015e, 0x003e, 0x002e, 0x001e, 0x000e, 0x00be, 0x0005,
-	0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026,
-	0x0126, 0x2091, 0x8000, 0x080c, 0xa8d0, 0x0106, 0x190c, 0xa872,
-	0x2740, 0x2029, 0x19f3, 0x252c, 0x2021, 0x19fa, 0x2424, 0x2061,
-	0x1ddc, 0x2071, 0x1800, 0x7654, 0x7074, 0x81ff, 0x0150, 0x0006,
-	0x9186, 0x1b32, 0x000e, 0x0128, 0x8001, 0x9602, 0x1a04, 0xe065,
-	0x0018, 0x9606, 0x0904, 0xe065, 0x080c, 0x8b5f, 0x0904, 0xe05c,
-	0x2100, 0x9c06, 0x0904, 0xe05c, 0x080c, 0xe2df, 0x1904, 0xe05c,
-	0x080c, 0xe67b, 0x0904, 0xe05c, 0x080c, 0xe2cf, 0x0904, 0xe05c,
-	0x6720, 0x9786, 0x0001, 0x1148, 0x080c, 0x335c, 0x0904, 0xe0a7,
-	0x6004, 0x9086, 0x0000, 0x1904, 0xe0a7, 0x9786, 0x0004, 0x0904,
-	0xe0a7, 0x9786, 0x0007, 0x0904, 0xe05c, 0x2500, 0x9c06, 0x0904,
-	0xe05c, 0x2400, 0x9c06, 0x0904, 0xe05c, 0x88ff, 0x0118, 0x605c,
-	0x9906, 0x15d0, 0x0096, 0x6043, 0xffff, 0x6000, 0x9086, 0x0004,
-	0x1120, 0x0016, 0x080c, 0x1a6a, 0x001e, 0x9786, 0x000a, 0x0148,
-	0x080c, 0xca29, 0x1130, 0x080c, 0xb591, 0x009e, 0x080c, 0xac04,
-	0x0418, 0x6014, 0x2048, 0x080c, 0xc814, 0x01d8, 0x9786, 0x0003,
-	0x1588, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878,
-	0x2048, 0x080c, 0x0fec, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c,
-	0xe5f6, 0x0016, 0x080c, 0xcb12, 0x080c, 0x6d64, 0x001e, 0x080c,
-	0xca03, 0x009e, 0x080c, 0xac04, 0x9ce0, 0x001c, 0x2001, 0x181a,
-	0x2004, 0x9c02, 0x1210, 0x0804, 0xdfd9, 0x010e, 0x190c, 0xa88e,
-	0x012e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x008e, 0x00ce,
-	0x00ee, 0x0005, 0x9786, 0x0006, 0x1150, 0x9386, 0x0005, 0x0128,
-	0x080c, 0xe5f6, 0x080c, 0xe241, 0x08e0, 0x009e, 0x08e8, 0x9786,
-	0x0009, 0x11f8, 0x6000, 0x9086, 0x0004, 0x01c0, 0x6000, 0x9086,
-	0x0003, 0x11a0, 0x080c, 0x960a, 0x0096, 0x6114, 0x2148, 0x080c,
-	0xc814, 0x0118, 0x6010, 0x080c, 0x6d70, 0x009e, 0x00c6, 0x080c,
-	0xabc9, 0x00ce, 0x0036, 0x080c, 0x966f, 0x003e, 0x009e, 0x0804,
-	0xe05c, 0x9786, 0x000a, 0x0904, 0xe043, 0x0804, 0xe041, 0x81ff,
-	0x0904, 0xe05c, 0x9180, 0x0001, 0x2004, 0x9086, 0x0018, 0x0138,
-	0x9180, 0x0001, 0x2004, 0x9086, 0x002d, 0x1904, 0xe05c, 0x6000,
-	0x9086, 0x0002, 0x1904, 0xe05c, 0x080c, 0xca18, 0x0138, 0x080c,
-	0xca29, 0x1904, 0xe05c, 0x080c, 0xb591, 0x0038, 0x080c, 0x3215,
-	0x080c, 0xca29, 0x1110, 0x080c, 0xb591, 0x080c, 0xac04, 0x0804,
-	0xe05c, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x0005, 0x00c6,
-	0x00e6, 0x0016, 0x2c08, 0x2170, 0x9006, 0x080c, 0xe268, 0x001e,
-	0x0120, 0x6020, 0x9084, 0x000f, 0x001b, 0x00ee, 0x00ce, 0x0005,
-	0xe0f6, 0xe0f6, 0xe0f6, 0xe0f6, 0xe0f6, 0xe0f6, 0xe0f8, 0xe0f6,
-	0xe0f6, 0xe0f6, 0xe0f6, 0xac04, 0xac04, 0xe0f6, 0x9006, 0x0005,
-	0x0036, 0x0046, 0x0016, 0x7010, 0x00b6, 0x2058, 0xbca0, 0x00be,
-	0x2c00, 0x2009, 0x0020, 0x080c, 0xe29e, 0x001e, 0x004e, 0x2019,
-	0x0002, 0x080c, 0xddf2, 0x003e, 0x9085, 0x0001, 0x0005, 0x0096,
-	0x080c, 0xc814, 0x0140, 0x6014, 0x904d, 0x080c, 0xc41f, 0x687b,
-	0x0005, 0x080c, 0x6d70, 0x009e, 0x080c, 0xac04, 0x9085, 0x0001,
-	0x0005, 0x2001, 0x0001, 0x080c, 0x655a, 0x0156, 0x0016, 0x0026,
-	0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276, 0x080c,
-	0xbb8a, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005, 0x0005, 0x00f6,
-	0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x00b6, 0x0126, 0x2091,
-	0x8000, 0x2740, 0x2061, 0x1ddc, 0x2079, 0x0001, 0x8fff, 0x0904,
-	0xe191, 0x2071, 0x1800, 0x7654, 0x7074, 0x8001, 0x9602, 0x1a04,
-	0xe191, 0x88ff, 0x0120, 0x2800, 0x9c06, 0x1590, 0x2078, 0x080c,
-	0xe2cf, 0x0570, 0x2400, 0x9c06, 0x0558, 0x6720, 0x9786, 0x0006,
-	0x1538, 0x9786, 0x0007, 0x0520, 0x88ff, 0x1140, 0x6010, 0x9b06,
-	0x11f8, 0x85ff, 0x0118, 0x605c, 0x9106, 0x11d0, 0x0096, 0x601c,
-	0xd084, 0x0140, 0x080c, 0xe4f9, 0x080c, 0xcf46, 0x080c, 0x1a6a,
-	0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xc814, 0x0120, 0x0046,
-	0x080c, 0xe241, 0x004e, 0x009e, 0x080c, 0xac04, 0x88ff, 0x1198,
-	0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1210, 0x0804,
-	0xe146, 0x9006, 0x012e, 0x00be, 0x006e, 0x007e, 0x008e, 0x00ce,
-	0x00ee, 0x00fe, 0x0005, 0x98c5, 0x0001, 0x0ca0, 0x080c, 0xa872,
-	0x00b6, 0x0076, 0x0056, 0x0086, 0x9046, 0x2029, 0x0001, 0x2c20,
-	0x2019, 0x0002, 0x6210, 0x2258, 0x0096, 0x904e, 0x080c, 0xa1f4,
-	0x009e, 0x008e, 0x903e, 0x080c, 0xa29f, 0x080c, 0xe137, 0x005e,
-	0x007e, 0x00be, 0x080c, 0xa88e, 0x0005, 0x080c, 0xa872, 0x00b6,
-	0x0046, 0x0056, 0x0076, 0x00c6, 0x0156, 0x2c20, 0x2128, 0x20a9,
-	0x007f, 0x900e, 0x0016, 0x0036, 0x080c, 0x661e, 0x1190, 0x0056,
-	0x0086, 0x9046, 0x2508, 0x2029, 0x0001, 0x0096, 0x904e, 0x080c,
-	0xa1f4, 0x009e, 0x008e, 0x903e, 0x080c, 0xa29f, 0x080c, 0xe137,
-	0x005e, 0x003e, 0x001e, 0x8108, 0x1f04, 0xe1ca, 0x015e, 0x00ce,
-	0x007e, 0x005e, 0x004e, 0x00be, 0x080c, 0xa88e, 0x0005, 0x080c,
-	0xa872, 0x00b6, 0x0076, 0x0056, 0x6210, 0x2258, 0x0086, 0x9046,
-	0x2029, 0x0001, 0x2019, 0x0048, 0x0096, 0x904e, 0x080c, 0xa1f4,
-	0x009e, 0x008e, 0x903e, 0x080c, 0xa29f, 0x2c20, 0x080c, 0xe137,
-	0x005e, 0x007e, 0x00be, 0x080c, 0xa88e, 0x0005, 0x080c, 0xa872,
-	0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156, 0x2c20, 0x20a9,
-	0x0800, 0x900e, 0x0016, 0x0036, 0x080c, 0x661e, 0x11a0, 0x0086,
-	0x9046, 0x2828, 0x0046, 0x2021, 0x0001, 0x080c, 0xe4dd, 0x004e,
-	0x0096, 0x904e, 0x080c, 0xa1f4, 0x009e, 0x008e, 0x903e, 0x080c,
-	0xa29f, 0x080c, 0xe137, 0x003e, 0x001e, 0x8108, 0x1f04, 0xe21a,
-	0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x080c, 0xa88e,
-	0x0005, 0x0016, 0x00f6, 0x080c, 0xc812, 0x0198, 0xa864, 0x9084,
-	0x00ff, 0x9086, 0x0046, 0x0180, 0xa800, 0x907d, 0x0138, 0xa803,
-	0x0000, 0xab82, 0x080c, 0x6d70, 0x2f48, 0x0cb0, 0xab82, 0x080c,
-	0x6d70, 0x00fe, 0x001e, 0x0005, 0xa800, 0x907d, 0x0130, 0xa803,
-	0x0000, 0x080c, 0x6d70, 0x2f48, 0x0cb8, 0x080c, 0x6d70, 0x0c88,
-	0x00e6, 0x0046, 0x0036, 0x2061, 0x1ddc, 0x9005, 0x1138, 0x2071,
-	0x1800, 0x7454, 0x7074, 0x8001, 0x9402, 0x12f8, 0x2100, 0x9c06,
-	0x0188, 0x6000, 0x9086, 0x0000, 0x0168, 0x6008, 0x9206, 0x1150,
-	0x6320, 0x9386, 0x0009, 0x01b0, 0x6010, 0x91a0, 0x0004, 0x2424,
-	0x9406, 0x0140, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02,
-	0x1220, 0x0c20, 0x9085, 0x0001, 0x0008, 0x9006, 0x003e, 0x004e,
-	0x00ee, 0x0005, 0x631c, 0xd3c4, 0x1d68, 0x0c30, 0x0096, 0x0006,
-	0x080c, 0x103a, 0x000e, 0x090c, 0x0d7d, 0xaae2, 0xa867, 0x010d,
-	0xa88e, 0x0026, 0x2010, 0x080c, 0xc802, 0x2001, 0x0000, 0x0120,
-	0x2200, 0x9080, 0x0017, 0x2004, 0x002e, 0xa87a, 0x9186, 0x0020,
-	0x0110, 0xa8e3, 0xffff, 0xa986, 0xac76, 0xa87f, 0x0000, 0x2001,
-	0x198e, 0x2004, 0xa882, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x6d70, 0x012e, 0x009e, 0x0005, 0x6700,
-	0x9786, 0x0000, 0x0158, 0x9786, 0x0001, 0x0140, 0x9786, 0x000a,
-	0x0128, 0x9786, 0x0009, 0x0110, 0x9085, 0x0001, 0x0005, 0x00e6,
-	0x6010, 0x9075, 0x0138, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206,
-	0x00ee, 0x0005, 0x9085, 0x0001, 0x0cd8, 0x0016, 0x6004, 0x908e,
-	0x001e, 0x11a0, 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036,
-	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0005, 0x2001, 0x1987,
-	0x2004, 0x601a, 0x2009, 0x8020, 0x080c, 0x91ed, 0x001e, 0x0005,
-	0xa001, 0xa001, 0x0005, 0x6024, 0xd0e4, 0x0158, 0xd0cc, 0x0118,
-	0x080c, 0xcb59, 0x0030, 0x080c, 0xe4f9, 0x080c, 0x8890, 0x080c,
-	0xabc9, 0x0005, 0x9280, 0x0008, 0x2004, 0x9084, 0x000f, 0x0002,
-	0xe32e, 0xe32e, 0xe32e, 0xe330, 0xe32e, 0xe330, 0xe330, 0xe32e,
-	0xe330, 0xe32e, 0xe32e, 0xe32e, 0xe32e, 0xe32e, 0x9006, 0x0005,
-	0x9085, 0x0001, 0x0005, 0x9280, 0x0008, 0x2004, 0x9084, 0x000f,
-	0x0002, 0xe347, 0xe347, 0xe347, 0xe347, 0xe347, 0xe347, 0xe354,
-	0xe347, 0xe347, 0xe347, 0xe347, 0xe347, 0xe347, 0xe347, 0x6007,
-	0x003b, 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x2009,
-	0x8020, 0x080c, 0x91ed, 0x0005, 0x0096, 0x00c6, 0x2260, 0x080c,
-	0xe4f9, 0x604b, 0x0000, 0x6024, 0xc0f4, 0xc0e4, 0x6026, 0x603b,
-	0x0000, 0x00ce, 0x00d6, 0x2268, 0x9186, 0x0007, 0x1904, 0xe3ad,
-	0x6814, 0x9005, 0x0138, 0x2048, 0xa87c, 0xd0fc, 0x1118, 0x00de,
-	0x009e, 0x08a8, 0x6007, 0x003a, 0x6003, 0x0001, 0x2009, 0x8020,
-	0x080c, 0x91ed, 0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002, 0x1904,
-	0xe424, 0x6014, 0x9005, 0x1138, 0x6000, 0x9086, 0x0007, 0x190c,
-	0x0d7d, 0x0804, 0xe424, 0x2048, 0x080c, 0xc814, 0x1130, 0x0028,
-	0x2048, 0xa800, 0x9005, 0x1de0, 0x2900, 0x2048, 0xa87c, 0x9084,
-	0x0003, 0x9086, 0x0002, 0x1168, 0xa87c, 0xc0dc, 0xc0f4, 0xa87e,
-	0xa880, 0xc0fc, 0xa882, 0x2009, 0x0043, 0x080c, 0xdc34, 0x0804,
-	0xe424, 0x2009, 0x0041, 0x0804, 0xe41e, 0x9186, 0x0005, 0x15a0,
-	0x6814, 0x2048, 0xa87c, 0xd0bc, 0x1120, 0x00de, 0x009e, 0x0804,
-	0xe347, 0xd0b4, 0x0128, 0xd0fc, 0x090c, 0x0d7d, 0x0804, 0xe368,
-	0x6007, 0x003a, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x91ed,
-	0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002, 0x0120, 0x9186, 0x0004,
-	0x1904, 0xe424, 0x6814, 0x2048, 0xa97c, 0xc1f4, 0xc1dc, 0xa97e,
-	0xa980, 0xc1fc, 0xc1bc, 0xa982, 0x00f6, 0x2c78, 0x080c, 0x1731,
-	0x00fe, 0x2009, 0x0042, 0x04d0, 0x0036, 0x080c, 0x103a, 0x090c,
-	0x0d7d, 0xa867, 0x010d, 0x9006, 0xa802, 0xa86a, 0xa88a, 0x2d18,
-	0xab8e, 0xa887, 0x0045, 0x2c00, 0xa892, 0x6038, 0xa8a2, 0x2360,
-	0x6024, 0xc0dd, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be,
-	0x2004, 0x635c, 0xab7a, 0xa876, 0x9006, 0xa87e, 0xa882, 0xad9a,
-	0xae96, 0xa89f, 0x0001, 0x080c, 0x6d70, 0x2019, 0x0045, 0x6008,
-	0x2068, 0x080c, 0xddf2, 0x2d00, 0x600a, 0x6023, 0x0006, 0x6003,
-	0x0007, 0x901e, 0x631a, 0x634a, 0x003e, 0x0038, 0x604b, 0x0000,
-	0x6003, 0x0007, 0x080c, 0xdc34, 0x00ce, 0x00de, 0x009e, 0x0005,
-	0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0085, 0x2008, 0x00c2,
-	0x9186, 0x0027, 0x1178, 0x080c, 0x95ad, 0x0036, 0x0096, 0x6014,
-	0x2048, 0x2019, 0x0004, 0x080c, 0xe241, 0x009e, 0x003e, 0x080c,
-	0x966f, 0x0005, 0x9186, 0x0014, 0x0d70, 0x080c, 0xac85, 0x0005,
-	0xe457, 0xe455, 0xe455, 0xe455, 0xe455, 0xe455, 0xe457, 0xe455,
-	0xe455, 0xe455, 0xe455, 0xe455, 0xe455, 0x080c, 0x0d7d, 0x6003,
-	0x000c, 0x080c, 0x966f, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182,
-	0x0085, 0x0208, 0x001a, 0x080c, 0xac85, 0x0005, 0xe473, 0xe473,
-	0xe473, 0xe473, 0xe475, 0xe495, 0xe473, 0xe473, 0xe473, 0xe473,
-	0xe473, 0xe473, 0xe473, 0x080c, 0x0d7d, 0x00d6, 0x2c68, 0x080c,
-	0xab73, 0x01b0, 0x6003, 0x0001, 0x6007, 0x001e, 0x2009, 0x026e,
-	0x210c, 0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x600b, 0xffff,
-	0x6910, 0x6112, 0x6023, 0x0004, 0x2009, 0x8020, 0x080c, 0x91ed,
-	0x2d60, 0x080c, 0xabc9, 0x00de, 0x0005, 0x080c, 0xabc9, 0x0005,
-	0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ec, 0x00ee,
-	0x0005, 0x2009, 0x1867, 0x210c, 0xd1ec, 0x05b0, 0x6003, 0x0002,
-	0x6024, 0xc0e5, 0x6026, 0xd0cc, 0x0150, 0x2001, 0x1988, 0x2004,
-	0x604a, 0x2009, 0x1867, 0x210c, 0xd1f4, 0x1520, 0x00a0, 0x2009,
-	0x1867, 0x210c, 0xd1f4, 0x0128, 0x6024, 0xc0e4, 0x6026, 0x9006,
-	0x00d8, 0x2001, 0x1988, 0x200c, 0x2001, 0x1986, 0x2004, 0x9100,
-	0x9080, 0x000a, 0x604a, 0x6010, 0x00b6, 0x2058, 0xb8bc, 0x00be,
-	0x0008, 0x2104, 0x9005, 0x0118, 0x9088, 0x0003, 0x0cd0, 0x2c0a,
-	0x600f, 0x0000, 0x9085, 0x0001, 0x0005, 0x0016, 0x00c6, 0x00e6,
-	0x615c, 0xb8bc, 0x2060, 0x8cff, 0x0180, 0x84ff, 0x1118, 0x605c,
-	0x9106, 0x1138, 0x600c, 0x2072, 0x080c, 0x8890, 0x080c, 0xabc9,
-	0x0010, 0x9cf0, 0x0003, 0x2e64, 0x0c70, 0x00ee, 0x00ce, 0x001e,
-	0x0005, 0x00d6, 0x00b6, 0x6010, 0x2058, 0xb8bc, 0x2068, 0x9005,
-	0x0130, 0x9c06, 0x0110, 0x680c, 0x0cd0, 0x600c, 0x680e, 0x00be,
-	0x00de, 0x0005, 0x0026, 0x0036, 0x0156, 0x2011, 0x182c, 0x2204,
-	0x9084, 0x00ff, 0x2019, 0x026e, 0x2334, 0x9636, 0x1508, 0x8318,
-	0x2334, 0x2204, 0x9084, 0xff00, 0x9636, 0x11d0, 0x2011, 0x0270,
-	0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c,
-	0xbb9e, 0x009e, 0x1168, 0x2011, 0x0274, 0x20a9, 0x0004, 0x6010,
-	0x0096, 0x2048, 0x2019, 0x0006, 0x080c, 0xbb9e, 0x009e, 0x1100,
-	0x015e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x2071, 0x1800, 0x080c,
-	0x5fb5, 0x080c, 0x2fb2, 0x00ee, 0x0005, 0x0096, 0x0026, 0x080c,
-	0x103a, 0x090c, 0x0d7d, 0xa85c, 0x9080, 0x001a, 0x20a0, 0x20a9,
-	0x000c, 0xa860, 0x20e8, 0x9006, 0x4004, 0x9186, 0x0046, 0x1118,
-	0xa867, 0x0136, 0x0038, 0xa867, 0x0138, 0x9186, 0x0041, 0x0110,
-	0xa87b, 0x0001, 0x7038, 0x9084, 0xff00, 0x7240, 0x9294, 0xff00,
-	0x8007, 0x9215, 0xaa9a, 0x9186, 0x0046, 0x1168, 0x7038, 0x9084,
-	0x00ff, 0x723c, 0x9294, 0xff00, 0x9215, 0xaa9e, 0x723c, 0x9294,
-	0x00ff, 0xaaa2, 0x0060, 0x7040, 0x9084, 0x00ff, 0x7244, 0x9294,
-	0xff00, 0x9215, 0xaa9e, 0x7244, 0x9294, 0x00ff, 0xaaa2, 0x9186,
-	0x0046, 0x1118, 0x9e90, 0x0012, 0x0010, 0x9e90, 0x001a, 0x2204,
-	0x8007, 0xa8a6, 0x8210, 0x2204, 0x8007, 0xa8aa, 0x8210, 0x2204,
-	0x8007, 0xa8ae, 0x8210, 0x2204, 0x8007, 0xa8b2, 0x8210, 0x9186,
-	0x0046, 0x11b8, 0x9e90, 0x0016, 0x2204, 0x8007, 0xa8b6, 0x8210,
-	0x2204, 0x8007, 0xa8ba, 0x8210, 0x2204, 0x8007, 0xa8be, 0x8210,
-	0x2204, 0x8007, 0xa8c2, 0x8210, 0x2011, 0x0205, 0x2013, 0x0001,
-	0x00b0, 0x9e90, 0x001e, 0x2204, 0x8007, 0xa8b6, 0x8210, 0x2204,
-	0x8007, 0xa8ba, 0x2011, 0x0205, 0x2013, 0x0001, 0x2011, 0x0260,
-	0x2204, 0x8007, 0xa8be, 0x8210, 0x2204, 0x8007, 0xa8c2, 0x9186,
-	0x0046, 0x1118, 0x2011, 0x0262, 0x0010, 0x2011, 0x026a, 0x0146,
-	0x01d6, 0x0036, 0x20a9, 0x0001, 0x2019, 0x0008, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0031, 0x20a0, 0x2204, 0x8007, 0x4004, 0x8210,
-	0x8319, 0x1dd0, 0x003e, 0x01ce, 0x013e, 0x2011, 0x0205, 0x2013,
-	0x0000, 0x002e, 0x080c, 0x6d70, 0x009e, 0x0005, 0x00e6, 0x6010,
-	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0fc, 0x0108, 0x0011, 0x00ee,
-	0x0005, 0xa880, 0xc0e5, 0xa882, 0x0005, 0x00e6, 0x00d6, 0x00c6,
-	0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0016, 0x0126, 0x2091,
-	0x8000, 0x2029, 0x19f3, 0x252c, 0x2021, 0x19fa, 0x2424, 0x2061,
-	0x1ddc, 0x2071, 0x1800, 0x7654, 0x7074, 0x9606, 0x0578, 0x6720,
-	0x9786, 0x0001, 0x0118, 0x9786, 0x0008, 0x1500, 0x2500, 0x9c06,
-	0x01e8, 0x2400, 0x9c06, 0x01d0, 0x080c, 0xe2cf, 0x01b8, 0x080c,
-	0xe2df, 0x11a0, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c,
-	0x1a6a, 0x001e, 0x080c, 0xca18, 0x1110, 0x080c, 0x3215, 0x080c,
-	0xca29, 0x1110, 0x080c, 0xb591, 0x080c, 0xac04, 0x9ce0, 0x001c,
-	0x2001, 0x181a, 0x2004, 0x9c02, 0x1208, 0x0858, 0x012e, 0x001e,
-	0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee,
-	0x0005, 0x2001, 0x1810, 0x2004, 0xd0dc, 0x0005, 0x0006, 0x2001,
-	0x1837, 0x2004, 0xd09c, 0x000e, 0x0005, 0x0006, 0x0036, 0x0046,
-	0x080c, 0xcf2e, 0x0168, 0x2019, 0xffff, 0x9005, 0x0128, 0x6010,
-	0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004, 0x080c, 0x4cb7,
-	0x004e, 0x003e, 0x000e, 0x6004, 0x9086, 0x0001, 0x1128, 0x080c,
-	0xa366, 0x080c, 0xac04, 0x9006, 0x0005, 0x00e6, 0x00c6, 0x00b6,
-	0x0046, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7454, 0x7074, 0x8001,
-	0x9402, 0x12b8, 0x2100, 0x9c06, 0x0148, 0x6000, 0x9086, 0x0000,
-	0x0128, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x0140, 0x9ce0, 0x001c,
-	0x2001, 0x181a, 0x2004, 0x9c02, 0x1220, 0x0c60, 0x9085, 0x0001,
-	0x0008, 0x9006, 0x004e, 0x00be, 0x00ce, 0x00ee, 0x0005, 0x0126,
-	0x0006, 0x00e6, 0x0016, 0x2091, 0x8000, 0x2071, 0x1840, 0xd5a4,
-	0x0118, 0x7004, 0x8000, 0x7006, 0xd5b4, 0x0118, 0x7000, 0x8000,
-	0x7002, 0xd5ac, 0x0178, 0x2500, 0x9084, 0x0007, 0x908e, 0x0003,
-	0x0148, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x2071,
-	0xfffe, 0x0089, 0x001e, 0x00ee, 0x000e, 0x012e, 0x0005, 0x0126,
-	0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0xfff6, 0x0021, 0x00ee,
-	0x000e, 0x012e, 0x0005, 0x2e05, 0x8000, 0x2077, 0x1220, 0x8e70,
-	0x2e05, 0x8000, 0x2077, 0x0005, 0x00e6, 0x2071, 0xfff4, 0x0c99,
-	0x00ee, 0x0005, 0x00e6, 0x2071, 0xfff8, 0x0c69, 0x00ee, 0x0005,
-	0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0x1840, 0x7014,
-	0x8000, 0x7016, 0x00ee, 0x000e, 0x012e, 0x0005, 0x0001, 0x0002,
-	0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200,
-	0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0xf93e
+	0x0001, 0x00f0, 0x080c, 0xe14c, 0x0140, 0x96b4, 0xff00, 0x8637,
+	0x9686, 0x0006, 0x0978, 0x0804, 0xd10c, 0x6017, 0x1900, 0x6007,
+	0x0009, 0x0070, 0x080c, 0x3332, 0x1904, 0xd433, 0x080c, 0xe4c3,
+	0x1904, 0xd433, 0x080c, 0xd600, 0x1904, 0xd10c, 0x6007, 0x0012,
+	0x6003, 0x0001, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0005, 0x6007,
+	0x0001, 0x6003, 0x0001, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0cb0,
+	0x6007, 0x0005, 0x0c68, 0x080c, 0xe4c3, 0x1904, 0xd433, 0x080c,
+	0x3332, 0x1904, 0xd433, 0x080c, 0xd600, 0x1904, 0xd10c, 0x6007,
+	0x0020, 0x6003, 0x0001, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0005,
+	0x080c, 0x3332, 0x1904, 0xd433, 0x6007, 0x0023, 0x6003, 0x0001,
+	0x080c, 0x9225, 0x080c, 0x96a0, 0x0005, 0x080c, 0xe4c3, 0x1904,
+	0xd433, 0x080c, 0x3332, 0x1904, 0xd433, 0x080c, 0xd600, 0x1904,
+	0xd10c, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7244, 0x9286,
+	0xffff, 0x0180, 0x2c08, 0x080c, 0xc826, 0x01b0, 0x2260, 0x7240,
+	0x6008, 0x9206, 0x1188, 0x6010, 0x9190, 0x0004, 0x2214, 0x9206,
+	0x01b8, 0x0050, 0x7240, 0x2c08, 0x9006, 0x080c, 0xe293, 0x1180,
+	0x7244, 0x9286, 0xffff, 0x01b0, 0x2160, 0x6007, 0x0026, 0x6017,
+	0x1700, 0x7214, 0x9296, 0xffff, 0x1180, 0x6007, 0x0025, 0x0068,
+	0x6020, 0x9086, 0x0007, 0x1d80, 0x6004, 0x9086, 0x0024, 0x1110,
+	0x080c, 0xabed, 0x2160, 0x6007, 0x0025, 0x6003, 0x0001, 0x080c,
+	0x9225, 0x080c, 0x96a0, 0x00ee, 0x002e, 0x001e, 0x0005, 0x2001,
+	0x0001, 0x080c, 0x6561, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9,
+	0x0004, 0x2019, 0x1805, 0x2011, 0x0276, 0x080c, 0xbbae, 0x003e,
+	0x002e, 0x001e, 0x015e, 0x0120, 0x6007, 0x0031, 0x0804, 0xd220,
+	0x080c, 0xb81f, 0x080c, 0x74e9, 0x1190, 0x0006, 0x0026, 0x0036,
+	0x080c, 0x7503, 0x1138, 0x080c, 0x77ed, 0x080c, 0x6029, 0x080c,
+	0x741a, 0x0010, 0x080c, 0x74bd, 0x003e, 0x002e, 0x000e, 0x0005,
+	0x080c, 0x3332, 0x1904, 0xd433, 0x080c, 0xd600, 0x1904, 0xd10c,
+	0x6106, 0x080c, 0xd61c, 0x1120, 0x6007, 0x002b, 0x0804, 0xd220,
+	0x6007, 0x002c, 0x0804, 0xd220, 0x080c, 0xe4c3, 0x1904, 0xd433,
+	0x080c, 0x3332, 0x1904, 0xd433, 0x080c, 0xd600, 0x1904, 0xd10c,
+	0x6106, 0x080c, 0xd621, 0x1120, 0x6007, 0x002e, 0x0804, 0xd220,
+	0x6007, 0x002f, 0x0804, 0xd220, 0x080c, 0x3332, 0x1904, 0xd433,
+	0x00e6, 0x00d6, 0x00c6, 0x6010, 0x2058, 0xb904, 0x9184, 0x00ff,
+	0x9086, 0x0006, 0x0158, 0x9184, 0xff00, 0x8007, 0x9086, 0x0006,
+	0x0128, 0x00ce, 0x00de, 0x00ee, 0x0804, 0xd227, 0x080c, 0x56de,
+	0xd0e4, 0x0904, 0xd37e, 0x2071, 0x026c, 0x7010, 0x603a, 0x7014,
+	0x603e, 0x7108, 0x720c, 0x080c, 0x6a67, 0x0140, 0x6010, 0x2058,
+	0xb810, 0x9106, 0x1118, 0xb814, 0x9206, 0x0510, 0x080c, 0x6a63,
+	0x15b8, 0x2069, 0x1800, 0x6880, 0x9206, 0x1590, 0x687c, 0x9106,
+	0x1578, 0x7210, 0x080c, 0xc826, 0x0590, 0x080c, 0xd4eb, 0x0578,
+	0x080c, 0xe345, 0x0560, 0x622e, 0x6007, 0x0036, 0x6003, 0x0001,
+	0x2009, 0x8020, 0x080c, 0x921e, 0x00ce, 0x00de, 0x00ee, 0x0005,
+	0x7214, 0x9286, 0xffff, 0x0150, 0x080c, 0xc826, 0x01c0, 0x9280,
+	0x0002, 0x2004, 0x7110, 0x9106, 0x1190, 0x08e0, 0x7210, 0x2c08,
+	0x9085, 0x0001, 0x080c, 0xe293, 0x2c10, 0x2160, 0x0140, 0x0890,
+	0x6007, 0x0037, 0x602f, 0x0009, 0x6017, 0x1500, 0x08b8, 0x6007,
+	0x0037, 0x602f, 0x0003, 0x6017, 0x1700, 0x0880, 0x6007, 0x0012,
+	0x0868, 0x080c, 0x3332, 0x1904, 0xd433, 0x6010, 0x2058, 0xb804,
+	0x9084, 0xff00, 0x8007, 0x9086, 0x0006, 0x1904, 0xd227, 0x00e6,
+	0x00d6, 0x00c6, 0x080c, 0x56de, 0xd0e4, 0x0904, 0xd3f6, 0x2069,
+	0x1800, 0x2071, 0x026c, 0x7008, 0x603a, 0x720c, 0x623e, 0x9286,
+	0xffff, 0x1150, 0x7208, 0x00c6, 0x2c08, 0x9085, 0x0001, 0x080c,
+	0xe293, 0x2c10, 0x00ce, 0x05e8, 0x080c, 0xc826, 0x05d0, 0x7108,
+	0x9280, 0x0002, 0x2004, 0x9106, 0x15a0, 0x00c6, 0x0026, 0x2260,
+	0x080c, 0xc436, 0x002e, 0x00ce, 0x7118, 0x918c, 0xff00, 0x810f,
+	0x9186, 0x0001, 0x0178, 0x9186, 0x0005, 0x0118, 0x9186, 0x0007,
+	0x1198, 0x9280, 0x0005, 0x2004, 0x9005, 0x0170, 0x080c, 0xd4eb,
+	0x0904, 0xd377, 0x0056, 0x7510, 0x7614, 0x080c, 0xe35e, 0x005e,
+	0x00ce, 0x00de, 0x00ee, 0x0005, 0x6007, 0x003b, 0x602f, 0x0009,
+	0x6017, 0x2a00, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x921e,
+	0x0c78, 0x6007, 0x003b, 0x602f, 0x0003, 0x6017, 0x0300, 0x6003,
+	0x0001, 0x2009, 0x8020, 0x080c, 0x921e, 0x0c10, 0x6007, 0x003b,
+	0x602f, 0x000b, 0x6017, 0x0000, 0x0804, 0xd34e, 0x00e6, 0x0026,
+	0x080c, 0x6a29, 0x0550, 0x080c, 0x69c5, 0x080c, 0xe535, 0x1518,
+	0x2071, 0x1800, 0x70dc, 0x9085, 0x0003, 0x70de, 0x00f6, 0x2079,
+	0x0100, 0x72b0, 0x9284, 0x00ff, 0x707e, 0x78e6, 0x9284, 0xff00,
+	0x7280, 0x9205, 0x7082, 0x78ea, 0x00fe, 0x70e7, 0x0000, 0x080c,
+	0x6a67, 0x0120, 0x2011, 0x1a09, 0x2013, 0x07d0, 0xd0ac, 0x1128,
+	0x080c, 0x2fb2, 0x0010, 0x080c, 0xe567, 0x002e, 0x00ee, 0x080c,
+	0xabed, 0x0804, 0xd226, 0x080c, 0xabed, 0x0005, 0x2600, 0x0002,
+	0xd44a, 0xd47b, 0xd48c, 0xd44a, 0xd44a, 0xd44c, 0xd49d, 0xd44a,
+	0xd44a, 0xd44a, 0xd469, 0xd44a, 0xd44a, 0xd44a, 0xd4a8, 0xd4b5,
+	0xd4e6, 0xd44a, 0x080c, 0x0d7d, 0x080c, 0xe4c3, 0x1d20, 0x080c,
+	0x3332, 0x1d08, 0x080c, 0xd600, 0x1148, 0x7038, 0x6016, 0x6007,
+	0x0045, 0x6003, 0x0001, 0x080c, 0x9225, 0x0005, 0x080c, 0x31e7,
+	0x080c, 0xcf67, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x9225,
+	0x0005, 0x080c, 0xe4c3, 0x1938, 0x080c, 0x3332, 0x1920, 0x080c,
+	0xd600, 0x1d60, 0x703c, 0x6016, 0x6007, 0x004a, 0x6003, 0x0001,
+	0x080c, 0x9225, 0x0005, 0x080c, 0x3332, 0x1904, 0xd433, 0x2009,
+	0x0041, 0x080c, 0xe570, 0x6007, 0x0047, 0x6003, 0x0001, 0x080c,
+	0x9225, 0x080c, 0x96a0, 0x0005, 0x080c, 0x3332, 0x1904, 0xd433,
+	0x2009, 0x0042, 0x080c, 0xe570, 0x6007, 0x0047, 0x6003, 0x0001,
+	0x080c, 0x9225, 0x080c, 0x96a0, 0x0005, 0x080c, 0x3332, 0x1904,
+	0xd433, 0x2009, 0x0046, 0x080c, 0xe570, 0x080c, 0xabed, 0x0005,
+	0x080c, 0xd508, 0x0904, 0xd433, 0x6007, 0x004e, 0x6003, 0x0001,
+	0x080c, 0x9225, 0x080c, 0x96a0, 0x0005, 0x6007, 0x004f, 0x6017,
+	0x0000, 0x7134, 0x918c, 0x00ff, 0x81ff, 0x0508, 0x9186, 0x0001,
+	0x1160, 0x7140, 0x2001, 0x19bd, 0x2004, 0x9106, 0x11b0, 0x7144,
+	0x2001, 0x19be, 0x2004, 0x9106, 0x0190, 0x9186, 0x0002, 0x1168,
+	0x2011, 0x0276, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019,
+	0x000a, 0x080c, 0xbbc2, 0x009e, 0x0110, 0x6017, 0x0001, 0x6003,
+	0x0001, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0005, 0x6007, 0x0050,
+	0x703c, 0x6016, 0x0ca0, 0x0016, 0x00e6, 0x2071, 0x0260, 0x00b6,
+	0x00c6, 0x2260, 0x6010, 0x2058, 0xb8d4, 0xd084, 0x0150, 0x7128,
+	0x6050, 0x9106, 0x1120, 0x712c, 0x604c, 0x9106, 0x0110, 0x9006,
+	0x0010, 0x9085, 0x0001, 0x00ce, 0x00be, 0x00ee, 0x001e, 0x0005,
+	0x0016, 0x0096, 0x0086, 0x00e6, 0x01c6, 0x01d6, 0x0126, 0x2091,
+	0x8000, 0x2071, 0x1800, 0x7090, 0x908a, 0x00f9, 0x16e8, 0x20e1,
+	0x0000, 0x2001, 0x19a0, 0x2003, 0x0000, 0x080c, 0x1053, 0x05a0,
+	0x2900, 0x6016, 0x7090, 0x8004, 0xa816, 0x908a, 0x001e, 0x02d0,
+	0xa833, 0x001e, 0x20a9, 0x001e, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x001b, 0x20a0, 0x2001, 0x19a0, 0x0016, 0x200c, 0x0471, 0x001e,
+	0x2940, 0x080c, 0x1053, 0x01c0, 0x2900, 0xa006, 0x2100, 0x81ff,
+	0x0180, 0x0c18, 0xa832, 0x20a8, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x001b, 0x20a0, 0x2001, 0x19a0, 0x0016, 0x200c, 0x00b1, 0x001e,
+	0x0000, 0x9085, 0x0001, 0x0048, 0x2071, 0x1800, 0x7093, 0x0000,
+	0x6014, 0x2048, 0x080c, 0x0fec, 0x9006, 0x012e, 0x01de, 0x01ce,
+	0x00ee, 0x008e, 0x009e, 0x001e, 0x0005, 0x0006, 0x0016, 0x0026,
+	0x0036, 0x00c6, 0x918c, 0xffff, 0x11a8, 0x080c, 0x2189, 0x2099,
+	0x026c, 0x2001, 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003,
+	0x00f8, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x2189, 0x2099,
+	0x0260, 0x0ca8, 0x080c, 0x2189, 0x2061, 0x19a0, 0x6004, 0x2098,
+	0x6008, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0048, 0x20a8,
+	0x4003, 0x22a8, 0x8108, 0x080c, 0x2189, 0x2099, 0x0260, 0x0ca8,
+	0x2061, 0x19a0, 0x2019, 0x0280, 0x3300, 0x931e, 0x0110, 0x6006,
+	0x0020, 0x2001, 0x0260, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021,
+	0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e,
+	0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x81ff, 0x11b8,
+	0x080c, 0x21a1, 0x20a1, 0x024c, 0x2001, 0x0014, 0x3518, 0x9312,
+	0x1218, 0x23a8, 0x4003, 0x0418, 0x20a8, 0x4003, 0x82ff, 0x01f8,
+	0x22a8, 0x8108, 0x080c, 0x21a1, 0x20a1, 0x0240, 0x0c98, 0x080c,
+	0x21a1, 0x2061, 0x19a3, 0x6004, 0x20a0, 0x6008, 0x3518, 0x9312,
+	0x1218, 0x23a8, 0x4003, 0x0058, 0x20a8, 0x4003, 0x82ff, 0x0138,
+	0x22a8, 0x8108, 0x080c, 0x21a1, 0x20a1, 0x0240, 0x0c98, 0x2061,
+	0x19a3, 0x2019, 0x0260, 0x3400, 0x931e, 0x0110, 0x6006, 0x0020,
+	0x2001, 0x0240, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021, 0x9296,
+	0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005,
+	0x00b6, 0x0066, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637,
+	0x9686, 0x0006, 0x0170, 0x9686, 0x0004, 0x0158, 0xbe04, 0x96b4,
+	0x00ff, 0x9686, 0x0006, 0x0128, 0x9686, 0x0004, 0x0110, 0x9085,
+	0x0001, 0x006e, 0x00be, 0x0005, 0x00d6, 0x080c, 0xd696, 0x00de,
+	0x0005, 0x00d6, 0x080c, 0xd6a3, 0x1520, 0x680c, 0x908c, 0xff00,
+	0x6820, 0x9084, 0x00ff, 0x9115, 0x6216, 0x6824, 0x602e, 0xd1e4,
+	0x0130, 0x9006, 0x080c, 0xe690, 0x2009, 0x0001, 0x0078, 0xd1ec,
+	0x0180, 0x6920, 0x918c, 0x00ff, 0x6824, 0x080c, 0x25fb, 0x1148,
+	0x2001, 0x0001, 0x080c, 0xe690, 0x2110, 0x900e, 0x080c, 0x323c,
+	0x0018, 0x9085, 0x0001, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6,
+	0x00c6, 0x080c, 0xac5f, 0x0598, 0x0016, 0x0026, 0x00c6, 0x2011,
+	0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x25fb, 0x1568, 0x080c,
+	0x65c4, 0x1550, 0xbe12, 0xbd16, 0x00ce, 0x002e, 0x001e, 0x2b00,
+	0x6012, 0x080c, 0xe4c3, 0x11c8, 0x080c, 0x3332, 0x11b0, 0x080c,
+	0xd600, 0x0500, 0x2001, 0x0007, 0x080c, 0x6575, 0x2001, 0x0007,
+	0x080c, 0x65a1, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001,
+	0x6003, 0x0001, 0x080c, 0x9225, 0x0010, 0x080c, 0xabed, 0x9085,
+	0x0001, 0x00ce, 0x00be, 0x0005, 0x080c, 0xabed, 0x00ce, 0x002e,
+	0x001e, 0x0ca8, 0x080c, 0xabed, 0x9006, 0x0c98, 0x2069, 0x026d,
+	0x6800, 0x9082, 0x0010, 0x1228, 0x6017, 0x0000, 0x9085, 0x0001,
+	0x0008, 0x9006, 0x0005, 0x6017, 0x0000, 0x2069, 0x026c, 0x6808,
+	0x9084, 0xff00, 0x9086, 0x0800, 0x1190, 0x6904, 0x9186, 0x0018,
+	0x0118, 0x9186, 0x0014, 0x1158, 0x810f, 0x6800, 0x9084, 0x00ff,
+	0x910d, 0x6162, 0x908e, 0x0014, 0x0110, 0x908e, 0x0010, 0x0005,
+	0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0d7d, 0x91b6, 0x0013, 0x1130,
+	0x2008, 0x91b2, 0x0040, 0x1a04, 0xd7e5, 0x0092, 0x91b6, 0x0027,
+	0x0120, 0x91b6, 0x0014, 0x190c, 0x0d7d, 0x2001, 0x0007, 0x080c,
+	0x65a1, 0x080c, 0x95de, 0x080c, 0xac28, 0x080c, 0x96a0, 0x0005,
+	0xd720, 0xd722, 0xd720, 0xd720, 0xd720, 0xd722, 0xd72f, 0xd7e2,
+	0xd77f, 0xd7e2, 0xd793, 0xd7e2, 0xd72f, 0xd7e2, 0xd7da, 0xd7e2,
+	0xd7da, 0xd7e2, 0xd7e2, 0xd720, 0xd720, 0xd720, 0xd720, 0xd720,
+	0xd720, 0xd720, 0xd720, 0xd720, 0xd720, 0xd720, 0xd722, 0xd720,
+	0xd7e2, 0xd720, 0xd720, 0xd7e2, 0xd720, 0xd7df, 0xd7e2, 0xd720,
+	0xd720, 0xd720, 0xd720, 0xd7e2, 0xd7e2, 0xd720, 0xd7e2, 0xd7e2,
+	0xd720, 0xd72a, 0xd720, 0xd720, 0xd720, 0xd720, 0xd7de, 0xd7e2,
+	0xd720, 0xd720, 0xd7e2, 0xd7e2, 0xd720, 0xd720, 0xd720, 0xd720,
+	0x080c, 0x0d7d, 0x080c, 0xcf6a, 0x6003, 0x0002, 0x080c, 0x96a0,
+	0x0804, 0xd7e4, 0x9006, 0x080c, 0x6561, 0x0804, 0xd7e2, 0x080c,
+	0x6a63, 0x1904, 0xd7e2, 0x9006, 0x080c, 0x6561, 0x6010, 0x2058,
+	0xb810, 0x9086, 0x00ff, 0x1140, 0x00f6, 0x2079, 0x1800, 0x78a8,
+	0x8000, 0x78aa, 0x00fe, 0x0428, 0x6010, 0x2058, 0xb884, 0x9005,
+	0x1178, 0x080c, 0xcf52, 0x1904, 0xd7e2, 0x0036, 0x0046, 0xbba0,
+	0x2021, 0x0007, 0x080c, 0x4cbe, 0x004e, 0x003e, 0x0804, 0xd7e2,
+	0x080c, 0x3363, 0x1904, 0xd7e2, 0x2001, 0x1800, 0x2004, 0x9086,
+	0x0002, 0x1138, 0x00f6, 0x2079, 0x1800, 0x78a8, 0x8000, 0x78aa,
+	0x00fe, 0x2001, 0x0002, 0x080c, 0x6575, 0x6023, 0x0001, 0x6003,
+	0x0001, 0x6007, 0x0002, 0x080c, 0x9225, 0x080c, 0x96a0, 0x6110,
+	0x2158, 0x2009, 0x0001, 0x080c, 0x864c, 0x0804, 0xd7e4, 0x6610,
+	0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0904,
+	0xd7e2, 0x9686, 0x0004, 0x0904, 0xd7e2, 0x080c, 0x8eca, 0x2001,
+	0x0004, 0x0804, 0xd7e0, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003,
+	0x1158, 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021, 0x0006,
+	0x080c, 0x4cbe, 0x004e, 0x003e, 0x2001, 0x0006, 0x080c, 0xd7fe,
+	0x6610, 0x2658, 0xbe04, 0x0066, 0x96b4, 0xff00, 0x8637, 0x9686,
+	0x0006, 0x006e, 0x0168, 0x2001, 0x0006, 0x080c, 0x65a1, 0x9284,
+	0x00ff, 0x908e, 0x0007, 0x1120, 0x2001, 0x0006, 0x080c, 0x6575,
+	0x080c, 0x6a63, 0x11f8, 0x2001, 0x1837, 0x2004, 0xd0a4, 0x01d0,
+	0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x01a0, 0x00f6, 0x2079,
+	0x1800, 0x78a8, 0x8000, 0x78aa, 0x00fe, 0x0804, 0xd769, 0x2001,
+	0x0004, 0x0030, 0x2001, 0x0006, 0x0409, 0x0020, 0x0018, 0x0010,
+	0x080c, 0x65a1, 0x080c, 0xabed, 0x0005, 0x2600, 0x0002, 0xd7f9,
+	0xd7f9, 0xd7f9, 0xd7f9, 0xd7f9, 0xd7fb, 0xd7f9, 0xd7fb, 0xd7f9,
+	0xd7f9, 0xd7fb, 0xd7f9, 0xd7f9, 0xd7f9, 0xd7fb, 0xd7fb, 0xd7fb,
+	0xd7fb, 0x080c, 0x0d7d, 0x080c, 0xabed, 0x0005, 0x0016, 0x00b6,
+	0x00d6, 0x6110, 0x2158, 0xb900, 0xd184, 0x0138, 0x080c, 0x6575,
+	0x9006, 0x080c, 0x6561, 0x080c, 0x321c, 0x00de, 0x00be, 0x001e,
+	0x0005, 0x6610, 0x2658, 0xb804, 0x9084, 0xff00, 0x8007, 0x90b2,
+	0x000c, 0x1a0c, 0x0d7d, 0x91b6, 0x0015, 0x1110, 0x003b, 0x0028,
+	0x91b6, 0x0016, 0x190c, 0x0d7d, 0x006b, 0x0005, 0xb69e, 0xb69e,
+	0xb69e, 0xb69e, 0xb69e, 0xb69e, 0xd87d, 0xd83e, 0xb69e, 0xb69e,
+	0xb69e, 0xb69e, 0xb69e, 0xb69e, 0xb69e, 0xb69e, 0xb69e, 0xb69e,
+	0xd87d, 0xd884, 0xb69e, 0xb69e, 0xb69e, 0xb69e, 0x00f6, 0x080c,
+	0x6a63, 0x11d8, 0x080c, 0xcf52, 0x11c0, 0x6010, 0x905d, 0x01a8,
+	0xb884, 0x9005, 0x0190, 0x9006, 0x080c, 0x6561, 0x2001, 0x0002,
+	0x080c, 0x6575, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002,
+	0x080c, 0x9225, 0x080c, 0x96a0, 0x00f0, 0x2011, 0x0263, 0x2204,
+	0x8211, 0x220c, 0x080c, 0x25fb, 0x11b0, 0x080c, 0x6625, 0x0118,
+	0x080c, 0xabed, 0x0080, 0xb810, 0x0006, 0xb814, 0x0006, 0xb884,
+	0x0006, 0x080c, 0x6043, 0x000e, 0xb886, 0x000e, 0xb816, 0x000e,
+	0xb812, 0x080c, 0xabed, 0x00fe, 0x0005, 0x6604, 0x96b6, 0x001e,
+	0x1110, 0x080c, 0xabed, 0x0005, 0x080c, 0xba27, 0x1148, 0x6003,
+	0x0001, 0x6007, 0x0001, 0x080c, 0x9225, 0x080c, 0x96a0, 0x0010,
+	0x080c, 0xabed, 0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d7d,
+	0x080c, 0x95de, 0x080c, 0xac28, 0x0005, 0x9182, 0x0040, 0x0002,
+	0xd8b3, 0xd8b3, 0xd8b3, 0xd8b3, 0xd8b5, 0xd8b3, 0xd8b3, 0xd8b3,
+	0xd8b3, 0xd8b3, 0xd8b3, 0xd8b3, 0xd8b3, 0xd8b3, 0xd8b3, 0xd8b3,
+	0xd8b3, 0xd8b3, 0xd8b3, 0x080c, 0x0d7d, 0x0096, 0x00b6, 0x00d6,
+	0x00e6, 0x00f6, 0x0046, 0x0026, 0x6210, 0x2258, 0xb8bc, 0x9005,
+	0x11b0, 0x6007, 0x0044, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00,
+	0x0904, 0xd91c, 0x080c, 0xe684, 0x1170, 0x9486, 0x2000, 0x1158,
+	0x2009, 0x0001, 0x2011, 0x0200, 0x080c, 0x88ec, 0x0020, 0x9026,
+	0x080c, 0xe508, 0x0c30, 0x080c, 0x103a, 0x090c, 0x0d7d, 0x6003,
+	0x0007, 0xa867, 0x010d, 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00,
+	0xa88e, 0x6008, 0xa8e2, 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a,
+	0x0016, 0xa876, 0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036,
+	0x080c, 0x6d80, 0x001e, 0x080c, 0xe684, 0x1904, 0xd97c, 0x9486,
+	0x2000, 0x1130, 0x2019, 0x0017, 0x080c, 0xe239, 0x0804, 0xd97c,
+	0x9486, 0x0200, 0x1120, 0x080c, 0xe1c9, 0x0804, 0xd97c, 0x9486,
+	0x0400, 0x0120, 0x9486, 0x1000, 0x1904, 0xd97c, 0x2019, 0x0002,
+	0x080c, 0xe1e8, 0x0804, 0xd97c, 0x2069, 0x1a6f, 0x6a00, 0xd284,
+	0x0904, 0xd9e6, 0x9284, 0x0300, 0x1904, 0xd9df, 0x6804, 0x9005,
+	0x0904, 0xd9c7, 0x2d78, 0x6003, 0x0007, 0x080c, 0x1053, 0x0904,
+	0xd988, 0x7800, 0xd08c, 0x1118, 0x7804, 0x8001, 0x7806, 0x6017,
+	0x0000, 0x2001, 0x180f, 0x2004, 0xd084, 0x1904, 0xd9ea, 0x9006,
+	0xa802, 0xa867, 0x0116, 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a,
+	0x6010, 0x2058, 0xb8a0, 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba,
+	0xb92c, 0xa9be, 0xb930, 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d,
+	0x7044, 0x9084, 0x0003, 0x9080, 0xd984, 0x2005, 0xa87e, 0x20a9,
+	0x000a, 0x2001, 0x0270, 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205,
+	0x200b, 0x0080, 0x20e1, 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0,
+	0x4003, 0x200b, 0x0000, 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000,
+	0x200c, 0xa9ae, 0x080c, 0x6d83, 0x002e, 0x004e, 0x00fe, 0x00ee,
+	0x00de, 0x00be, 0x009e, 0x0005, 0x0000, 0x0080, 0x0040, 0x0000,
+	0x2001, 0x1810, 0x2004, 0xd084, 0x0120, 0x080c, 0x103a, 0x1904,
+	0xd931, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009,
+	0xa022, 0x080c, 0x921e, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084,
+	0xff00, 0x9086, 0x1200, 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016,
+	0x6114, 0x918c, 0xf700, 0x910d, 0x6116, 0x001e, 0x6003, 0x0001,
+	0x6007, 0x0043, 0x2009, 0xa025, 0x080c, 0x921e, 0x0828, 0x6868,
+	0x602e, 0x686c, 0x6032, 0x6017, 0xf200, 0x6003, 0x0001, 0x6007,
+	0x0041, 0x2009, 0xa022, 0x080c, 0x921e, 0x0804, 0xd97c, 0x2001,
+	0x180e, 0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x4b07,
+	0x6017, 0xf300, 0x0010, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007,
+	0x0041, 0x2009, 0xa022, 0x080c, 0x921e, 0x0804, 0xd97c, 0x6017,
+	0xf500, 0x0c98, 0x6017, 0xf600, 0x0804, 0xd99c, 0x6017, 0xf200,
+	0x0804, 0xd99c, 0xa867, 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886,
+	0x2c00, 0xa87a, 0x7044, 0x9084, 0x0003, 0x9080, 0xd984, 0x2005,
+	0xa87e, 0x2928, 0x6010, 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a,
+	0xb82c, 0xa88e, 0xb830, 0xa892, 0xb834, 0xa896, 0xa883, 0x003d,
+	0x2009, 0x0205, 0x2104, 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000,
+	0x2011, 0x0210, 0x2214, 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111,
+	0x1a0c, 0x0d7d, 0x8210, 0x821c, 0x2001, 0x026c, 0x2098, 0xa860,
+	0x20e8, 0xa85c, 0x9080, 0x0029, 0x20a0, 0x2011, 0xda66, 0x2041,
+	0x0001, 0x223d, 0x9784, 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8,
+	0x4003, 0x931a, 0x0530, 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a,
+	0x2001, 0x0260, 0x2098, 0x0c68, 0x2950, 0x080c, 0x1053, 0x0170,
+	0x2900, 0xb002, 0xa867, 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8,
+	0xa85c, 0x9080, 0x001b, 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800,
+	0x902d, 0x0118, 0x080c, 0x106c, 0x0cc8, 0x080c, 0x106c, 0x0804,
+	0xd988, 0x2548, 0x8847, 0x9885, 0x0046, 0xa866, 0x2009, 0x0205,
+	0x200b, 0x0000, 0x080c, 0xe26c, 0x0804, 0xd97c, 0x8010, 0x0004,
+	0x801a, 0x0006, 0x8018, 0x0008, 0x8016, 0x000a, 0x8014, 0x9186,
+	0x0013, 0x1160, 0x6004, 0x908a, 0x0057, 0x1a0c, 0x0d7d, 0x9082,
+	0x0040, 0x0a0c, 0x0d7d, 0x2008, 0x0804, 0xdaf1, 0x9186, 0x0051,
+	0x0108, 0x0040, 0x080c, 0xaaa8, 0x01e8, 0x9086, 0x0002, 0x0904,
+	0xdb38, 0x00c0, 0x9186, 0x0027, 0x0180, 0x9186, 0x0048, 0x0128,
+	0x9186, 0x0014, 0x0150, 0x190c, 0x0d7d, 0x080c, 0xaaa8, 0x0150,
+	0x9086, 0x0004, 0x0904, 0xdbd5, 0x0028, 0x6004, 0x9082, 0x0040,
+	0x2008, 0x001a, 0x080c, 0xaca9, 0x0005, 0xdab8, 0xdaba, 0xdaba,
+	0xdae1, 0xdab8, 0xdab8, 0xdab8, 0xdab8, 0xdab8, 0xdab8, 0xdab8,
+	0xdab8, 0xdab8, 0xdab8, 0xdab8, 0xdab8, 0xdab8, 0xdab8, 0xdab8,
+	0x080c, 0x0d7d, 0x080c, 0x95de, 0x080c, 0x96a0, 0x0036, 0x0096,
+	0x6014, 0x904d, 0x01d8, 0x080c, 0xc838, 0x01c0, 0x6003, 0x0002,
+	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1178, 0x2019,
+	0x0004, 0x080c, 0xe26c, 0x6017, 0x0000, 0x6018, 0x9005, 0x1120,
+	0x2001, 0x1987, 0x2004, 0x601a, 0x6003, 0x0007, 0x009e, 0x003e,
+	0x0005, 0x0096, 0x080c, 0x95de, 0x080c, 0x96a0, 0x080c, 0xc838,
+	0x0120, 0x6014, 0x2048, 0x080c, 0x106c, 0x080c, 0xac28, 0x009e,
+	0x0005, 0x0002, 0xdb05, 0xdb1a, 0xdb07, 0xdb2f, 0xdb05, 0xdb05,
+	0xdb05, 0xdb05, 0xdb05, 0xdb05, 0xdb05, 0xdb05, 0xdb05, 0xdb05,
+	0xdb05, 0xdb05, 0xdb05, 0xdb05, 0xdb05, 0x080c, 0x0d7d, 0x0096,
+	0x6014, 0x2048, 0xa87c, 0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009,
+	0x0043, 0x080c, 0xac8c, 0x0010, 0x6003, 0x0004, 0x080c, 0x96a0,
+	0x009e, 0x0005, 0x080c, 0xc838, 0x0138, 0x6114, 0x0096, 0x2148,
+	0xa97c, 0x009e, 0xd1ec, 0x1138, 0x080c, 0x88c1, 0x080c, 0xabed,
+	0x080c, 0x96a0, 0x0005, 0x080c, 0xe4cc, 0x0db0, 0x0cc8, 0x6003,
+	0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c, 0x921e, 0x0005,
+	0x9182, 0x0040, 0x0002, 0xdb4e, 0xdb50, 0xdb4e, 0xdb4e, 0xdb4e,
+	0xdb4e, 0xdb4e, 0xdb4e, 0xdb4e, 0xdb4e, 0xdb4e, 0xdb4e, 0xdb4e,
+	0xdb4e, 0xdb4e, 0xdb4e, 0xdb4e, 0xdb51, 0xdb4e, 0x080c, 0x0d7d,
+	0x0005, 0x00d6, 0x080c, 0x88c1, 0x00de, 0x080c, 0xe524, 0x080c,
+	0xabed, 0x0005, 0x9182, 0x0040, 0x0002, 0xdb70, 0xdb70, 0xdb70,
+	0xdb70, 0xdb70, 0xdb70, 0xdb70, 0xdb70, 0xdb70, 0xdb72, 0xdb9d,
+	0xdb70, 0xdb70, 0xdb70, 0xdb70, 0xdb9d, 0xdb70, 0xdb70, 0xdb70,
+	0x080c, 0x0d7d, 0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0168,
+	0x908c, 0x0003, 0x918e, 0x0002, 0x0180, 0x6144, 0xd1e4, 0x1168,
+	0x2009, 0x0041, 0x009e, 0x0804, 0xdc5d, 0x6003, 0x0007, 0x601b,
+	0x0000, 0x080c, 0x88c1, 0x009e, 0x0005, 0x6014, 0x2048, 0xa97c,
+	0xd1ec, 0x1130, 0x080c, 0x88c1, 0x080c, 0xabed, 0x009e, 0x0005,
+	0x080c, 0xe4cc, 0x0db8, 0x009e, 0x0005, 0x2001, 0x180c, 0x200c,
+	0xc1d4, 0x2102, 0x0036, 0x080c, 0x963b, 0x080c, 0x96a0, 0x6014,
+	0x0096, 0x2048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
+	0x0188, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x0140, 0xa8ac,
+	0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c, 0x931b, 0x632e, 0x6003,
+	0x0002, 0x0080, 0x2019, 0x0004, 0x080c, 0xe26c, 0x6018, 0x9005,
+	0x1128, 0x2001, 0x1987, 0x2004, 0x8003, 0x601a, 0x6017, 0x0000,
+	0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x9182, 0x0040, 0x0002,
+	0xdbec, 0xdbec, 0xdbec, 0xdbec, 0xdbec, 0xdbec, 0xdbec, 0xdbec,
+	0xdbee, 0xdbec, 0xdbec, 0xdbec, 0xdbec, 0xdbec, 0xdbec, 0xdbec,
+	0xdbec, 0xdbec, 0xdbec, 0xdc39, 0x080c, 0x0d7d, 0x6014, 0x0096,
+	0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be,
+	0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c, 0xd0fc, 0x0128, 0x2009,
+	0x0041, 0x009e, 0x0804, 0xdc5d, 0x6003, 0x0007, 0x601b, 0x0000,
+	0x080c, 0x88c1, 0x009e, 0x0005, 0x6124, 0xd1f4, 0x1d58, 0x0006,
+	0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200, 0x910b, 0x6030, 0x9420,
+	0x6432, 0x602c, 0x9109, 0x612e, 0x004e, 0x000e, 0x08d8, 0x6110,
+	0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1178, 0x2009, 0x180e,
+	0x210c, 0xd19c, 0x0118, 0x6003, 0x0007, 0x0010, 0x6003, 0x0006,
+	0x00e9, 0x080c, 0x88c3, 0x009e, 0x0005, 0x6003, 0x0002, 0x009e,
+	0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c, 0x1670, 0x1904, 0xdbee,
+	0x0005, 0x6014, 0x0096, 0x2048, 0xa834, 0xa938, 0x009e, 0x9105,
+	0x1120, 0x080c, 0x1670, 0x1904, 0xdbee, 0x0005, 0xd2fc, 0x0140,
+	0x8002, 0x8000, 0x8212, 0x9291, 0x0000, 0x2009, 0x0009, 0x0010,
+	0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005, 0x9182, 0x0040, 0x0208,
+	0x0062, 0x9186, 0x0013, 0x0120, 0x9186, 0x0014, 0x190c, 0x0d7d,
+	0x6024, 0xd0dc, 0x090c, 0x0d7d, 0x0005, 0xdc80, 0xdc8c, 0xdc98,
+	0xdca4, 0xdc80, 0xdc80, 0xdc80, 0xdc80, 0xdc87, 0xdc82, 0xdc82,
+	0xdc80, 0xdc80, 0xdc80, 0xdc80, 0xdc82, 0xdc80, 0xdc82, 0xdc80,
+	0x080c, 0x0d7d, 0x6024, 0xd0dc, 0x090c, 0x0d7d, 0x0005, 0x6014,
+	0x9005, 0x190c, 0x0d7d, 0x0005, 0x6003, 0x0001, 0x6106, 0x0126,
+	0x2091, 0x8000, 0x2009, 0xa022, 0x080c, 0x9200, 0x012e, 0x0005,
+	0x6003, 0x0004, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa001,
+	0x080c, 0x921e, 0x012e, 0x0005, 0x6003, 0x0003, 0x6106, 0x080c,
+	0x1c03, 0x0126, 0x2091, 0x8000, 0x6014, 0x0096, 0x2048, 0xa87c,
+	0xd0fc, 0x0188, 0x9084, 0x0003, 0x9086, 0x0002, 0x01a0, 0x6024,
+	0xd0cc, 0x1148, 0xd0c4, 0x1138, 0xa8a8, 0x9005, 0x1120, 0x6144,
+	0x918d, 0xb035, 0x0018, 0x6144, 0x918d, 0xa035, 0x009e, 0x080c,
+	0x9265, 0x012e, 0x0005, 0x6144, 0x918d, 0xa032, 0x0cb8, 0x0126,
+	0x2091, 0x8000, 0x0036, 0x0096, 0x9182, 0x0040, 0x0023, 0x009e,
+	0x003e, 0x012e, 0x0005, 0xdceb, 0xdced, 0xdd02, 0xdd1c, 0xdceb,
+	0xdceb, 0xdceb, 0xdceb, 0xdceb, 0xdceb, 0xdceb, 0xdceb, 0xdceb,
+	0xdceb, 0xdceb, 0xdceb, 0x080c, 0x0d7d, 0x6014, 0x2048, 0xa87c,
+	0xd0fc, 0x0510, 0x909c, 0x0003, 0x939e, 0x0003, 0x01e8, 0x6003,
+	0x0001, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa022, 0x080c,
+	0x921e, 0x0470, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x909c,
+	0x0003, 0x939e, 0x0003, 0x0140, 0x6003, 0x0001, 0x6106, 0x2009,
+	0xa001, 0x080c, 0x921e, 0x00e0, 0x901e, 0x6316, 0x631a, 0x2019,
+	0x0004, 0x080c, 0xe26c, 0x00a0, 0x6014, 0x2048, 0xa87c, 0xd0fc,
+	0x0d98, 0x909c, 0x0003, 0x939e, 0x0003, 0x0d70, 0x6003, 0x0003,
+	0x6106, 0x080c, 0x1c03, 0x6144, 0x918d, 0xa035, 0x080c, 0x9265,
+	0x0005, 0x080c, 0x95de, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148,
+	0x080c, 0xe621, 0x0036, 0x2019, 0x0029, 0x080c, 0xe26c, 0x003e,
+	0x009e, 0x080c, 0xac28, 0x080c, 0x96a0, 0x0005, 0x080c, 0x963b,
+	0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xe621, 0x0036,
+	0x2019, 0x0029, 0x080c, 0xe26c, 0x003e, 0x009e, 0x080c, 0xac28,
+	0x0005, 0x9182, 0x0085, 0x0002, 0xdd6b, 0xdd69, 0xdd69, 0xdd77,
+	0xdd69, 0xdd69, 0xdd69, 0xdd69, 0xdd69, 0xdd69, 0xdd69, 0xdd69,
+	0xdd69, 0x080c, 0x0d7d, 0x6003, 0x000b, 0x6106, 0x0126, 0x2091,
+	0x8000, 0x2009, 0x8020, 0x080c, 0x921e, 0x012e, 0x0005, 0x0026,
+	0x00e6, 0x080c, 0xe4c3, 0x0118, 0x080c, 0xabed, 0x0440, 0x2071,
+	0x0260, 0x7224, 0x6216, 0x2001, 0x180e, 0x2004, 0xd0e4, 0x0150,
+	0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2011, 0x014e,
+	0x080c, 0xaf1a, 0x7220, 0x080c, 0xe102, 0x0118, 0x6007, 0x0086,
+	0x0040, 0x6007, 0x0087, 0x7224, 0x9296, 0xffff, 0x1110, 0x6007,
+	0x0086, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x921e, 0x00ee,
+	0x002e, 0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085,
+	0x0a0c, 0x0d7d, 0x908a, 0x0092, 0x1a0c, 0x0d7d, 0x9082, 0x0085,
+	0x00a2, 0x9186, 0x0027, 0x0130, 0x9186, 0x0014, 0x0118, 0x080c,
+	0xaca9, 0x0050, 0x2001, 0x0007, 0x080c, 0x65a1, 0x080c, 0x95de,
+	0x080c, 0xac28, 0x080c, 0x96a0, 0x0005, 0xddda, 0xdddc, 0xdddc,
+	0xddda, 0xddda, 0xddda, 0xddda, 0xddda, 0xddda, 0xddda, 0xddda,
+	0xddda, 0xddda, 0x080c, 0x0d7d, 0x080c, 0xac28, 0x080c, 0x96a0,
+	0x0005, 0x9182, 0x0085, 0x0a0c, 0x0d7d, 0x9182, 0x0092, 0x1a0c,
+	0x0d7d, 0x9182, 0x0085, 0x0002, 0xddf9, 0xddf9, 0xddf9, 0xddfb,
+	0xddf9, 0xddf9, 0xddf9, 0xddf9, 0xddf9, 0xddf9, 0xddf9, 0xddf9,
+	0xddf9, 0x080c, 0x0d7d, 0x0005, 0x9186, 0x0013, 0x0148, 0x9186,
+	0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0xaca9, 0x0020,
+	0x080c, 0x95de, 0x080c, 0xac28, 0x0005, 0x0036, 0x080c, 0xe524,
+	0x604b, 0x0000, 0x2019, 0x000b, 0x0031, 0x6023, 0x0006, 0x6003,
+	0x0007, 0x003e, 0x0005, 0x0126, 0x0036, 0x2091, 0x8000, 0x2001,
+	0x0382, 0x2004, 0x9084, 0x0007, 0x0006, 0x9086, 0x0003, 0x0110,
+	0x080c, 0xa896, 0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0xa218,
+	0x009e, 0x008e, 0x1550, 0x0076, 0x2c38, 0x080c, 0xa2c3, 0x007e,
+	0x1520, 0x6000, 0x9086, 0x0000, 0x0500, 0x6020, 0x9086, 0x0007,
+	0x01e0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xe524, 0x080c,
+	0xcf6a, 0x080c, 0x1a6a, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c,
+	0xc838, 0x0110, 0x080c, 0xe26c, 0x009e, 0x6017, 0x0000, 0x080c,
+	0xe524, 0x6023, 0x0007, 0x080c, 0xcf6a, 0x000e, 0x9086, 0x0003,
+	0x0110, 0x080c, 0xa8b2, 0x003e, 0x012e, 0x0005, 0x00f6, 0x00c6,
+	0x00b6, 0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c, 0x080c,
+	0x25fb, 0x15e8, 0x0016, 0x00c6, 0x080c, 0x6625, 0x15b0, 0x001e,
+	0x00c6, 0x2160, 0x080c, 0xcf67, 0x00ce, 0x002e, 0x0026, 0x0016,
+	0x080c, 0xa896, 0x2019, 0x0029, 0x080c, 0xa38a, 0x080c, 0x93a5,
+	0x0076, 0x903e, 0x080c, 0x9277, 0x007e, 0x001e, 0x0076, 0x903e,
+	0x080c, 0xdfeb, 0x007e, 0x080c, 0xa8b2, 0x0026, 0xba04, 0x9294,
+	0xff00, 0x8217, 0x9286, 0x0006, 0x0118, 0x9286, 0x0004, 0x1118,
+	0xbaa0, 0x080c, 0x32be, 0x002e, 0xbc84, 0x001e, 0x080c, 0x6043,
+	0xbe12, 0xbd16, 0xbc86, 0x9006, 0x0010, 0x00ce, 0x001e, 0x015e,
+	0x003e, 0x00be, 0x00ce, 0x00fe, 0x0005, 0x00c6, 0x00d6, 0x00b6,
+	0x0016, 0x2009, 0x1824, 0x2104, 0x9086, 0x0074, 0x1904, 0xdf0e,
+	0x2069, 0x0260, 0x6944, 0x9182, 0x0100, 0x06e0, 0x6940, 0x9184,
+	0x8000, 0x0904, 0xdf0b, 0x2001, 0x197c, 0x2004, 0x9005, 0x1140,
+	0x6010, 0x2058, 0xb884, 0x9005, 0x0118, 0x9184, 0x0800, 0x0598,
+	0x6948, 0x918a, 0x0001, 0x0648, 0x080c, 0xe689, 0x0118, 0x6978,
+	0xd1fc, 0x11b8, 0x2009, 0x0205, 0x200b, 0x0001, 0x693c, 0x81ff,
+	0x1198, 0x6944, 0x9182, 0x0100, 0x02a8, 0x6940, 0x81ff, 0x1178,
+	0x6948, 0x918a, 0x0001, 0x0288, 0x6950, 0x918a, 0x0001, 0x0298,
+	0x00d0, 0x6017, 0x0100, 0x00a0, 0x6017, 0x0300, 0x0088, 0x6017,
+	0x0500, 0x0070, 0x6017, 0x0700, 0x0058, 0x6017, 0x0900, 0x0040,
+	0x6017, 0x0b00, 0x0028, 0x6017, 0x0f00, 0x0010, 0x6017, 0x2d00,
+	0x9085, 0x0001, 0x0008, 0x9006, 0x001e, 0x00be, 0x00de, 0x00ce,
+	0x0005, 0x00c6, 0x00b6, 0x0026, 0x0036, 0x0156, 0x6210, 0x2258,
+	0xbb04, 0x9394, 0x00ff, 0x9286, 0x0006, 0x0180, 0x9286, 0x0004,
+	0x0168, 0x9394, 0xff00, 0x8217, 0x9286, 0x0006, 0x0138, 0x9286,
+	0x0004, 0x0120, 0x080c, 0x6634, 0x0804, 0xdf7a, 0x2011, 0x0276,
+	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbbc2,
+	0x009e, 0x15c8, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48,
+	0x2019, 0x0006, 0x080c, 0xbbc2, 0x009e, 0x1568, 0x0046, 0x0016,
+	0xbaa0, 0x2220, 0x9006, 0x2009, 0x1848, 0x210c, 0xd1a4, 0x0138,
+	0x2009, 0x0029, 0x080c, 0xe2c9, 0xb800, 0xc0e5, 0xb802, 0x080c,
+	0xa896, 0x2019, 0x0029, 0x080c, 0x93a5, 0x0076, 0x2039, 0x0000,
+	0x080c, 0x9277, 0x2c08, 0x080c, 0xdfeb, 0x007e, 0x080c, 0xa8b2,
+	0x2001, 0x0007, 0x080c, 0x65a1, 0x2001, 0x0007, 0x080c, 0x6575,
+	0x001e, 0x004e, 0x9006, 0x015e, 0x003e, 0x002e, 0x00be, 0x00ce,
+	0x0005, 0x00d6, 0x2069, 0x026e, 0x6800, 0x9086, 0x0800, 0x0118,
+	0x6017, 0x0000, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6, 0x00f6,
+	0x0016, 0x0026, 0x0036, 0x0156, 0x2079, 0x026c, 0x7930, 0x7834,
+	0x080c, 0x25fb, 0x11d0, 0x080c, 0x6625, 0x11b8, 0x2011, 0x0270,
+	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbbc2,
+	0x009e, 0x1158, 0x2011, 0x0274, 0x20a9, 0x0004, 0x0096, 0x2b48,
+	0x2019, 0x0006, 0x080c, 0xbbc2, 0x009e, 0x015e, 0x003e, 0x002e,
+	0x001e, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x0006, 0x0016, 0x0026,
+	0x0036, 0x0156, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
+	0x25fb, 0x11d0, 0x080c, 0x6625, 0x11b8, 0x2011, 0x0276, 0x20a9,
+	0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xbbc2, 0x009e,
+	0x1158, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019,
+	0x0006, 0x080c, 0xbbc2, 0x009e, 0x015e, 0x003e, 0x002e, 0x001e,
+	0x000e, 0x00be, 0x0005, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066,
+	0x0056, 0x0046, 0x0026, 0x0126, 0x2091, 0x8000, 0x080c, 0xa8f4,
+	0x0106, 0x190c, 0xa896, 0x2740, 0x2029, 0x19f3, 0x252c, 0x2021,
+	0x19fa, 0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7654, 0x7074,
+	0x81ff, 0x0150, 0x0006, 0x9186, 0x1b32, 0x000e, 0x0128, 0x8001,
+	0x9602, 0x1a04, 0xe090, 0x0018, 0x9606, 0x0904, 0xe090, 0x080c,
+	0x8b90, 0x0904, 0xe087, 0x2100, 0x9c06, 0x0904, 0xe087, 0x080c,
+	0xe30a, 0x1904, 0xe087, 0x080c, 0xe6a6, 0x0904, 0xe087, 0x080c,
+	0xe2fa, 0x0904, 0xe087, 0x6720, 0x9786, 0x0001, 0x1148, 0x080c,
+	0x3363, 0x0904, 0xe0d2, 0x6004, 0x9086, 0x0000, 0x1904, 0xe0d2,
+	0x9786, 0x0004, 0x0904, 0xe0d2, 0x9786, 0x0007, 0x0904, 0xe087,
+	0x2500, 0x9c06, 0x0904, 0xe087, 0x2400, 0x9c06, 0x0904, 0xe087,
+	0x88ff, 0x0118, 0x605c, 0x9906, 0x15d0, 0x0096, 0x6043, 0xffff,
+	0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c, 0x1a6a, 0x001e,
+	0x9786, 0x000a, 0x0148, 0x080c, 0xca4d, 0x1130, 0x080c, 0xb5b5,
+	0x009e, 0x080c, 0xac28, 0x0418, 0x6014, 0x2048, 0x080c, 0xc838,
+	0x01d8, 0x9786, 0x0003, 0x1588, 0xa867, 0x0103, 0xa87c, 0xd0cc,
+	0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fec, 0x009e, 0xab7a,
+	0xa877, 0x0000, 0x080c, 0xe621, 0x0016, 0x080c, 0xcb36, 0x080c,
+	0x6d74, 0x001e, 0x080c, 0xca27, 0x009e, 0x080c, 0xac28, 0x9ce0,
+	0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1210, 0x0804, 0xe004,
+	0x010e, 0x190c, 0xa8b2, 0x012e, 0x002e, 0x004e, 0x005e, 0x006e,
+	0x007e, 0x008e, 0x00ce, 0x00ee, 0x0005, 0x9786, 0x0006, 0x1150,
+	0x9386, 0x0005, 0x0128, 0x080c, 0xe621, 0x080c, 0xe26c, 0x08e0,
+	0x009e, 0x08e8, 0x9786, 0x0009, 0x11f8, 0x6000, 0x9086, 0x0004,
+	0x01c0, 0x6000, 0x9086, 0x0003, 0x11a0, 0x080c, 0x963b, 0x0096,
+	0x6114, 0x2148, 0x080c, 0xc838, 0x0118, 0x6010, 0x080c, 0x6d80,
+	0x009e, 0x00c6, 0x080c, 0xabed, 0x00ce, 0x0036, 0x080c, 0x96a0,
+	0x003e, 0x009e, 0x0804, 0xe087, 0x9786, 0x000a, 0x0904, 0xe06e,
+	0x0804, 0xe06c, 0x81ff, 0x0904, 0xe087, 0x9180, 0x0001, 0x2004,
+	0x9086, 0x0018, 0x0138, 0x9180, 0x0001, 0x2004, 0x9086, 0x002d,
+	0x1904, 0xe087, 0x6000, 0x9086, 0x0002, 0x1904, 0xe087, 0x080c,
+	0xca3c, 0x0138, 0x080c, 0xca4d, 0x1904, 0xe087, 0x080c, 0xb5b5,
+	0x0038, 0x080c, 0x321c, 0x080c, 0xca4d, 0x1110, 0x080c, 0xb5b5,
+	0x080c, 0xac28, 0x0804, 0xe087, 0xa864, 0x9084, 0x00ff, 0x9086,
+	0x0039, 0x0005, 0x00c6, 0x00e6, 0x0016, 0x2c08, 0x2170, 0x9006,
+	0x080c, 0xe293, 0x001e, 0x0120, 0x6020, 0x9084, 0x000f, 0x001b,
+	0x00ee, 0x00ce, 0x0005, 0xe121, 0xe121, 0xe121, 0xe121, 0xe121,
+	0xe121, 0xe123, 0xe121, 0xe121, 0xe121, 0xe121, 0xac28, 0xac28,
+	0xe121, 0x9006, 0x0005, 0x0036, 0x0046, 0x0016, 0x7010, 0x00b6,
+	0x2058, 0xbca0, 0x00be, 0x2c00, 0x2009, 0x0020, 0x080c, 0xe2c9,
+	0x001e, 0x004e, 0x2019, 0x0002, 0x080c, 0xde1b, 0x003e, 0x9085,
+	0x0001, 0x0005, 0x0096, 0x080c, 0xc838, 0x0140, 0x6014, 0x904d,
+	0x080c, 0xc443, 0x687b, 0x0005, 0x080c, 0x6d80, 0x009e, 0x080c,
+	0xac28, 0x9085, 0x0001, 0x0005, 0x2001, 0x0001, 0x080c, 0x6561,
+	0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805,
+	0x2011, 0x0276, 0x080c, 0xbbae, 0x003e, 0x002e, 0x001e, 0x015e,
+	0x9005, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066,
+	0x00b6, 0x0126, 0x2091, 0x8000, 0x2740, 0x2061, 0x1ddc, 0x2079,
+	0x0001, 0x8fff, 0x0904, 0xe1bc, 0x2071, 0x1800, 0x7654, 0x7074,
+	0x8001, 0x9602, 0x1a04, 0xe1bc, 0x88ff, 0x0120, 0x2800, 0x9c06,
+	0x1590, 0x2078, 0x080c, 0xe2fa, 0x0570, 0x2400, 0x9c06, 0x0558,
+	0x6720, 0x9786, 0x0006, 0x1538, 0x9786, 0x0007, 0x0520, 0x88ff,
+	0x1140, 0x6010, 0x9b06, 0x11f8, 0x85ff, 0x0118, 0x605c, 0x9106,
+	0x11d0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xe524, 0x080c,
+	0xcf6a, 0x080c, 0x1a6a, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c,
+	0xc838, 0x0120, 0x0046, 0x080c, 0xe26c, 0x004e, 0x009e, 0x080c,
+	0xac28, 0x88ff, 0x1198, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004,
+	0x9c02, 0x1210, 0x0804, 0xe171, 0x9006, 0x012e, 0x00be, 0x006e,
+	0x007e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x98c5, 0x0001,
+	0x0ca0, 0x080c, 0xa896, 0x00b6, 0x0076, 0x0056, 0x0086, 0x9046,
+	0x2029, 0x0001, 0x2c20, 0x2019, 0x0002, 0x6210, 0x2258, 0x0096,
+	0x904e, 0x080c, 0xa218, 0x009e, 0x008e, 0x903e, 0x080c, 0xa2c3,
+	0x080c, 0xe162, 0x005e, 0x007e, 0x00be, 0x080c, 0xa8b2, 0x0005,
+	0x080c, 0xa896, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156,
+	0x2c20, 0x2128, 0x20a9, 0x007f, 0x900e, 0x0016, 0x0036, 0x080c,
+	0x6625, 0x1190, 0x0056, 0x0086, 0x9046, 0x2508, 0x2029, 0x0001,
+	0x0096, 0x904e, 0x080c, 0xa218, 0x009e, 0x008e, 0x903e, 0x080c,
+	0xa2c3, 0x080c, 0xe162, 0x005e, 0x003e, 0x001e, 0x8108, 0x1f04,
+	0xe1f5, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x080c,
+	0xa8b2, 0x0005, 0x080c, 0xa896, 0x00b6, 0x0076, 0x0056, 0x6210,
+	0x2258, 0x0086, 0x9046, 0x2029, 0x0001, 0x2019, 0x0048, 0x0096,
+	0x904e, 0x080c, 0xa218, 0x009e, 0x008e, 0x903e, 0x080c, 0xa2c3,
+	0x2c20, 0x080c, 0xe162, 0x005e, 0x007e, 0x00be, 0x080c, 0xa8b2,
+	0x0005, 0x080c, 0xa896, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6,
+	0x0156, 0x2c20, 0x20a9, 0x0800, 0x900e, 0x0016, 0x0036, 0x080c,
+	0x6625, 0x11a0, 0x0086, 0x9046, 0x2828, 0x0046, 0x2021, 0x0001,
+	0x080c, 0xe508, 0x004e, 0x0096, 0x904e, 0x080c, 0xa218, 0x009e,
+	0x008e, 0x903e, 0x080c, 0xa2c3, 0x080c, 0xe162, 0x003e, 0x001e,
+	0x8108, 0x1f04, 0xe245, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e,
+	0x00be, 0x080c, 0xa8b2, 0x0005, 0x0016, 0x00f6, 0x080c, 0xc836,
+	0x0198, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0046, 0x0180, 0xa800,
+	0x907d, 0x0138, 0xa803, 0x0000, 0xab82, 0x080c, 0x6d80, 0x2f48,
+	0x0cb0, 0xab82, 0x080c, 0x6d80, 0x00fe, 0x001e, 0x0005, 0xa800,
+	0x907d, 0x0130, 0xa803, 0x0000, 0x080c, 0x6d80, 0x2f48, 0x0cb8,
+	0x080c, 0x6d80, 0x0c88, 0x00e6, 0x0046, 0x0036, 0x2061, 0x1ddc,
+	0x9005, 0x1138, 0x2071, 0x1800, 0x7454, 0x7074, 0x8001, 0x9402,
+	0x12f8, 0x2100, 0x9c06, 0x0188, 0x6000, 0x9086, 0x0000, 0x0168,
+	0x6008, 0x9206, 0x1150, 0x6320, 0x9386, 0x0009, 0x01b0, 0x6010,
+	0x91a0, 0x0004, 0x2424, 0x9406, 0x0140, 0x9ce0, 0x001c, 0x2001,
+	0x181a, 0x2004, 0x9c02, 0x1220, 0x0c20, 0x9085, 0x0001, 0x0008,
+	0x9006, 0x003e, 0x004e, 0x00ee, 0x0005, 0x631c, 0xd3c4, 0x1d68,
+	0x0c30, 0x0096, 0x0006, 0x080c, 0x103a, 0x000e, 0x090c, 0x0d7d,
+	0xaae2, 0xa867, 0x010d, 0xa88e, 0x0026, 0x2010, 0x080c, 0xc826,
+	0x2001, 0x0000, 0x0120, 0x2200, 0x9080, 0x0017, 0x2004, 0x002e,
+	0xa87a, 0x9186, 0x0020, 0x0110, 0xa8e3, 0xffff, 0xa986, 0xac76,
+	0xa87f, 0x0000, 0x2001, 0x198e, 0x2004, 0xa882, 0x9006, 0xa802,
+	0xa86a, 0xa88a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6d80, 0x012e,
+	0x009e, 0x0005, 0x6700, 0x9786, 0x0000, 0x0158, 0x9786, 0x0001,
+	0x0140, 0x9786, 0x000a, 0x0128, 0x9786, 0x0009, 0x0110, 0x9085,
+	0x0001, 0x0005, 0x00e6, 0x6010, 0x9075, 0x0138, 0x00b6, 0x2058,
+	0xb8a0, 0x00be, 0x9206, 0x00ee, 0x0005, 0x9085, 0x0001, 0x0cd8,
+	0x0016, 0x6004, 0x908e, 0x001e, 0x11a0, 0x8007, 0x6134, 0x918c,
+	0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
+	0x0005, 0x2001, 0x1987, 0x2004, 0x601a, 0x2009, 0x8020, 0x080c,
+	0x921e, 0x001e, 0x0005, 0xa001, 0xa001, 0x0005, 0x6024, 0xd0e4,
+	0x0158, 0xd0cc, 0x0118, 0x080c, 0xcb7d, 0x0030, 0x080c, 0xe524,
+	0x080c, 0x88c1, 0x080c, 0xabed, 0x0005, 0x9280, 0x0008, 0x2004,
+	0x9084, 0x000f, 0x0002, 0xe359, 0xe359, 0xe359, 0xe35b, 0xe359,
+	0xe35b, 0xe35b, 0xe359, 0xe35b, 0xe359, 0xe359, 0xe359, 0xe359,
+	0xe359, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x9280, 0x0008,
+	0x2004, 0x9084, 0x000f, 0x0002, 0xe372, 0xe372, 0xe372, 0xe372,
+	0xe372, 0xe372, 0xe37f, 0xe372, 0xe372, 0xe372, 0xe372, 0xe372,
+	0xe372, 0xe372, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017, 0x2a00,
+	0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x921e, 0x0005, 0x0096,
+	0x00c6, 0x2260, 0x080c, 0xe524, 0x604b, 0x0000, 0x6024, 0xc0f4,
+	0xc0e4, 0x6026, 0x603b, 0x0000, 0x00ce, 0x00d6, 0x2268, 0x9186,
+	0x0007, 0x1904, 0xe3d8, 0x6814, 0x9005, 0x0138, 0x2048, 0xa87c,
+	0xd0fc, 0x1118, 0x00de, 0x009e, 0x08a8, 0x6007, 0x003a, 0x6003,
+	0x0001, 0x2009, 0x8020, 0x080c, 0x921e, 0x00c6, 0x2d60, 0x6100,
+	0x9186, 0x0002, 0x1904, 0xe44f, 0x6014, 0x9005, 0x1138, 0x6000,
+	0x9086, 0x0007, 0x190c, 0x0d7d, 0x0804, 0xe44f, 0x2048, 0x080c,
+	0xc838, 0x1130, 0x0028, 0x2048, 0xa800, 0x9005, 0x1de0, 0x2900,
+	0x2048, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x1168, 0xa87c,
+	0xc0dc, 0xc0f4, 0xa87e, 0xa880, 0xc0fc, 0xa882, 0x2009, 0x0043,
+	0x080c, 0xdc5d, 0x0804, 0xe44f, 0x2009, 0x0041, 0x0804, 0xe449,
+	0x9186, 0x0005, 0x15a0, 0x6814, 0x2048, 0xa87c, 0xd0bc, 0x1120,
+	0x00de, 0x009e, 0x0804, 0xe372, 0xd0b4, 0x0128, 0xd0fc, 0x090c,
+	0x0d7d, 0x0804, 0xe393, 0x6007, 0x003a, 0x6003, 0x0001, 0x2009,
+	0x8020, 0x080c, 0x921e, 0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002,
+	0x0120, 0x9186, 0x0004, 0x1904, 0xe44f, 0x6814, 0x2048, 0xa97c,
+	0xc1f4, 0xc1dc, 0xa97e, 0xa980, 0xc1fc, 0xc1bc, 0xa982, 0x00f6,
+	0x2c78, 0x080c, 0x1731, 0x00fe, 0x2009, 0x0042, 0x04d0, 0x0036,
+	0x080c, 0x103a, 0x090c, 0x0d7d, 0xa867, 0x010d, 0x9006, 0xa802,
+	0xa86a, 0xa88a, 0x2d18, 0xab8e, 0xa887, 0x0045, 0x2c00, 0xa892,
+	0x6038, 0xa8a2, 0x2360, 0x6024, 0xc0dd, 0x6026, 0x6010, 0x00b6,
+	0x2058, 0xb8a0, 0x00be, 0x2004, 0x635c, 0xab7a, 0xa876, 0x9006,
+	0xa87e, 0xa882, 0xad9a, 0xae96, 0xa89f, 0x0001, 0x080c, 0x6d80,
+	0x2019, 0x0045, 0x6008, 0x2068, 0x080c, 0xde1b, 0x2d00, 0x600a,
+	0x6023, 0x0006, 0x6003, 0x0007, 0x901e, 0x631a, 0x634a, 0x003e,
+	0x0038, 0x604b, 0x0000, 0x6003, 0x0007, 0x080c, 0xdc5d, 0x00ce,
+	0x00de, 0x009e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004, 0x9082,
+	0x0085, 0x2008, 0x00c2, 0x9186, 0x0027, 0x1178, 0x080c, 0x95de,
+	0x0036, 0x0096, 0x6014, 0x2048, 0x2019, 0x0004, 0x080c, 0xe26c,
+	0x009e, 0x003e, 0x080c, 0x96a0, 0x0005, 0x9186, 0x0014, 0x0d70,
+	0x080c, 0xaca9, 0x0005, 0xe482, 0xe480, 0xe480, 0xe480, 0xe480,
+	0xe480, 0xe482, 0xe480, 0xe480, 0xe480, 0xe480, 0xe480, 0xe480,
+	0x080c, 0x0d7d, 0x6003, 0x000c, 0x080c, 0x96a0, 0x0005, 0x9182,
+	0x0092, 0x1220, 0x9182, 0x0085, 0x0208, 0x001a, 0x080c, 0xaca9,
+	0x0005, 0xe49e, 0xe49e, 0xe49e, 0xe49e, 0xe4a0, 0xe4c0, 0xe49e,
+	0xe49e, 0xe49e, 0xe49e, 0xe49e, 0xe49e, 0xe49e, 0x080c, 0x0d7d,
+	0x00d6, 0x2c68, 0x080c, 0xab97, 0x01b0, 0x6003, 0x0001, 0x6007,
+	0x001e, 0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f, 0x210c,
+	0x613e, 0x600b, 0xffff, 0x6910, 0x6112, 0x6023, 0x0004, 0x2009,
+	0x8020, 0x080c, 0x921e, 0x2d60, 0x080c, 0xabed, 0x00de, 0x0005,
+	0x080c, 0xabed, 0x0005, 0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800,
+	0x00be, 0xd0ec, 0x00ee, 0x0005, 0x2009, 0x1867, 0x210c, 0xd1ec,
+	0x05b0, 0x6003, 0x0002, 0x6024, 0xc0e5, 0x6026, 0xd0cc, 0x0150,
+	0x2001, 0x1988, 0x2004, 0x604a, 0x2009, 0x1867, 0x210c, 0xd1f4,
+	0x1520, 0x00a0, 0x2009, 0x1867, 0x210c, 0xd1f4, 0x0128, 0x6024,
+	0xc0e4, 0x6026, 0x9006, 0x00d8, 0x2001, 0x1988, 0x200c, 0x2001,
+	0x1986, 0x2004, 0x9100, 0x9080, 0x000a, 0x604a, 0x6010, 0x00b6,
+	0x2058, 0xb8bc, 0x00be, 0x0008, 0x2104, 0x9005, 0x0118, 0x9088,
+	0x0003, 0x0cd0, 0x2c0a, 0x600f, 0x0000, 0x9085, 0x0001, 0x0005,
+	0x0016, 0x00c6, 0x00e6, 0x615c, 0xb8bc, 0x2060, 0x8cff, 0x0180,
+	0x84ff, 0x1118, 0x605c, 0x9106, 0x1138, 0x600c, 0x2072, 0x080c,
+	0x88c1, 0x080c, 0xabed, 0x0010, 0x9cf0, 0x0003, 0x2e64, 0x0c70,
+	0x00ee, 0x00ce, 0x001e, 0x0005, 0x00d6, 0x00b6, 0x6010, 0x2058,
+	0xb8bc, 0x2068, 0x9005, 0x0130, 0x9c06, 0x0110, 0x680c, 0x0cd0,
+	0x600c, 0x680e, 0x00be, 0x00de, 0x0005, 0x0026, 0x0036, 0x0156,
+	0x2011, 0x182c, 0x2204, 0x9084, 0x00ff, 0x2019, 0x026e, 0x2334,
+	0x9636, 0x1508, 0x8318, 0x2334, 0x2204, 0x9084, 0xff00, 0x9636,
+	0x11d0, 0x2011, 0x0270, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048,
+	0x2019, 0x000a, 0x080c, 0xbbc2, 0x009e, 0x1168, 0x2011, 0x0274,
+	0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x0006, 0x080c,
+	0xbbc2, 0x009e, 0x1100, 0x015e, 0x003e, 0x002e, 0x0005, 0x00e6,
+	0x2071, 0x1800, 0x080c, 0x5fbc, 0x080c, 0x2fb2, 0x00ee, 0x0005,
+	0x0096, 0x0026, 0x080c, 0x103a, 0x090c, 0x0d7d, 0xa85c, 0x9080,
+	0x001a, 0x20a0, 0x20a9, 0x000c, 0xa860, 0x20e8, 0x9006, 0x4004,
+	0x9186, 0x0046, 0x1118, 0xa867, 0x0136, 0x0038, 0xa867, 0x0138,
+	0x9186, 0x0041, 0x0110, 0xa87b, 0x0001, 0x7038, 0x9084, 0xff00,
+	0x7240, 0x9294, 0xff00, 0x8007, 0x9215, 0xaa9a, 0x9186, 0x0046,
+	0x1168, 0x7038, 0x9084, 0x00ff, 0x723c, 0x9294, 0xff00, 0x9215,
+	0xaa9e, 0x723c, 0x9294, 0x00ff, 0xaaa2, 0x0060, 0x7040, 0x9084,
+	0x00ff, 0x7244, 0x9294, 0xff00, 0x9215, 0xaa9e, 0x7244, 0x9294,
+	0x00ff, 0xaaa2, 0x9186, 0x0046, 0x1118, 0x9e90, 0x0012, 0x0010,
+	0x9e90, 0x001a, 0x2204, 0x8007, 0xa8a6, 0x8210, 0x2204, 0x8007,
+	0xa8aa, 0x8210, 0x2204, 0x8007, 0xa8ae, 0x8210, 0x2204, 0x8007,
+	0xa8b2, 0x8210, 0x9186, 0x0046, 0x11b8, 0x9e90, 0x0016, 0x2204,
+	0x8007, 0xa8b6, 0x8210, 0x2204, 0x8007, 0xa8ba, 0x8210, 0x2204,
+	0x8007, 0xa8be, 0x8210, 0x2204, 0x8007, 0xa8c2, 0x8210, 0x2011,
+	0x0205, 0x2013, 0x0001, 0x00b0, 0x9e90, 0x001e, 0x2204, 0x8007,
+	0xa8b6, 0x8210, 0x2204, 0x8007, 0xa8ba, 0x2011, 0x0205, 0x2013,
+	0x0001, 0x2011, 0x0260, 0x2204, 0x8007, 0xa8be, 0x8210, 0x2204,
+	0x8007, 0xa8c2, 0x9186, 0x0046, 0x1118, 0x2011, 0x0262, 0x0010,
+	0x2011, 0x026a, 0x0146, 0x01d6, 0x0036, 0x20a9, 0x0001, 0x2019,
+	0x0008, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0x2204,
+	0x8007, 0x4004, 0x8210, 0x8319, 0x1dd0, 0x003e, 0x01ce, 0x013e,
+	0x2011, 0x0205, 0x2013, 0x0000, 0x002e, 0x080c, 0x6d80, 0x009e,
+	0x0005, 0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0fc,
+	0x0108, 0x0011, 0x00ee, 0x0005, 0xa880, 0xc0e5, 0xa882, 0x0005,
+	0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026,
+	0x0016, 0x0126, 0x2091, 0x8000, 0x2029, 0x19f3, 0x252c, 0x2021,
+	0x19fa, 0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7654, 0x7074,
+	0x9606, 0x0578, 0x6720, 0x9786, 0x0001, 0x0118, 0x9786, 0x0008,
+	0x1500, 0x2500, 0x9c06, 0x01e8, 0x2400, 0x9c06, 0x01d0, 0x080c,
+	0xe2fa, 0x01b8, 0x080c, 0xe30a, 0x11a0, 0x6000, 0x9086, 0x0004,
+	0x1120, 0x0016, 0x080c, 0x1a6a, 0x001e, 0x080c, 0xca3c, 0x1110,
+	0x080c, 0x321c, 0x080c, 0xca4d, 0x1110, 0x080c, 0xb5b5, 0x080c,
+	0xac28, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1208,
+	0x0858, 0x012e, 0x001e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e,
+	0x00ce, 0x00de, 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0dc,
+	0x0005, 0x0006, 0x2001, 0x1837, 0x2004, 0xd09c, 0x000e, 0x0005,
+	0x0006, 0x0036, 0x0046, 0x080c, 0xcf52, 0x0168, 0x2019, 0xffff,
+	0x9005, 0x0128, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021,
+	0x0004, 0x080c, 0x4cbe, 0x004e, 0x003e, 0x000e, 0x6004, 0x9086,
+	0x0001, 0x1128, 0x080c, 0xa38a, 0x080c, 0xac28, 0x9006, 0x0005,
+	0x00e6, 0x00c6, 0x00b6, 0x0046, 0x2061, 0x1ddc, 0x2071, 0x1800,
+	0x7454, 0x7074, 0x8001, 0x9402, 0x12b8, 0x2100, 0x9c06, 0x0148,
+	0x6000, 0x9086, 0x0000, 0x0128, 0x6010, 0x2058, 0xb8a0, 0x9206,
+	0x0140, 0x9ce0, 0x001c, 0x2001, 0x181a, 0x2004, 0x9c02, 0x1220,
+	0x0c60, 0x9085, 0x0001, 0x0008, 0x9006, 0x004e, 0x00be, 0x00ce,
+	0x00ee, 0x0005, 0x0126, 0x0006, 0x00e6, 0x0016, 0x2091, 0x8000,
+	0x2071, 0x1840, 0xd5a4, 0x0118, 0x7004, 0x8000, 0x7006, 0xd5b4,
+	0x0118, 0x7000, 0x8000, 0x7002, 0xd5ac, 0x0178, 0x2500, 0x9084,
+	0x0007, 0x908e, 0x0003, 0x0148, 0x908e, 0x0004, 0x0130, 0x908e,
+	0x0005, 0x0118, 0x2071, 0xfffe, 0x0089, 0x001e, 0x00ee, 0x000e,
+	0x012e, 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071,
+	0xfff6, 0x0021, 0x00ee, 0x000e, 0x012e, 0x0005, 0x2e05, 0x8000,
+	0x2077, 0x1220, 0x8e70, 0x2e05, 0x8000, 0x2077, 0x0005, 0x00e6,
+	0x2071, 0xfff4, 0x0c99, 0x00ee, 0x0005, 0x00e6, 0x2071, 0xfff8,
+	0x0c69, 0x00ee, 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000,
+	0x2071, 0x1840, 0x7014, 0x8000, 0x7016, 0x00ee, 0x000e, 0x012e,
+	0x0005, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040,
+	0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000,
+	0x8000, 0x7155
 };
 #ifdef UNIQUE_FW_NAME
-unsigned short fw2322ipx_length01 = 0xdf17;
+unsigned short fw2322ipx_length01 = 0xdf42;
 #else
-unsigned short risc_code_length01 = 0xdf17;
+unsigned short risc_code_length01 = 0xdf42;
 #endif
 
 /*
@@ -7472,9 +7478,9 @@
 	0x0000, 0x8072, 0x0000, 0x0400, 0x0008, 0x8010, 0x0000, 0x0010,
 	0x000b, 0x0489, 0x0004, 0x04a4, 0x0002, 0x3941, 0x0003, 0x0c37,
 	0x0000, 0x8072, 0x0000, 0x0400, 0x0003, 0x0013, 0x0004, 0x046e,
-	0x0008, 0x11fc, 0x0003, 0x8c3f, 0x0000, 0x8072, 0x0000, 0x0400,
+	0x0008, 0x11fc, 0x000b, 0xb43f, 0x0000, 0x8072, 0x0000, 0x0400,
 	0x0008, 0x8010, 0x0000, 0x000e, 0x000b, 0x0489, 0x0000, 0x8060,
-	0x0000, 0x0400, 0x0000, 0x04fc, 0x000b, 0x8c54, 0x0008, 0x808c,
+	0x0000, 0x0400, 0x0000, 0x04fc, 0x0003, 0xb454, 0x0008, 0x808c,
 	0x0008, 0x0000, 0x0001, 0x9180, 0x0008, 0x0005, 0x0008, 0x7f62,
 	0x0000, 0x8066, 0x0008, 0x0009, 0x000b, 0xc44a, 0x0008, 0x0060,
 	0x0008, 0x8062, 0x0008, 0x001b, 0x0008, 0x4304, 0x0008, 0x4206,
@@ -7502,7 +7508,7 @@
 	0x0002, 0x3941, 0x0003, 0x0ca7, 0x000f, 0x4000, 0x0000, 0x8072,
 	0x0008, 0x0404, 0x000f, 0x4000, 0x0008, 0x8010, 0x0008, 0x0012,
 	0x000c, 0x035b, 0x0004, 0x046e, 0x0000, 0x1110, 0x000c, 0x035b,
-	0x0008, 0x11fc, 0x000b, 0x8cad, 0x0003, 0x0013, 0x0009, 0xc2c0,
+	0x0008, 0x11fc, 0x0003, 0xb4ad, 0x0003, 0x0013, 0x0009, 0xc2c0,
 	0x0008, 0x00ff, 0x0000, 0x7f00, 0x0001, 0xc3c0, 0x0008, 0xff00,
 	0x0009, 0x00d0, 0x000b, 0x0cd8, 0x0000, 0x0d0a, 0x0001, 0x8580,
 	0x0000, 0x1000, 0x0008, 0x7f62, 0x0000, 0x8060, 0x0000, 0x0400,
@@ -7516,7 +7522,7 @@
 	0x0000, 0x8066, 0x0000, 0x0809, 0x0003, 0xc4de, 0x0000, 0x8060,
 	0x0000, 0x0400, 0x0001, 0x84c0, 0x0008, 0xff00, 0x0002, 0x7f70,
 	0x0009, 0xff80, 0x0000, 0x1000, 0x0008, 0x7f62, 0x0000, 0x8066,
-	0x0000, 0x0809, 0x000b, 0xc4e9, 0x000f, 0x4000, 0xe552, 0xe9f6
+	0x0000, 0x0809, 0x000b, 0xc4e9, 0x000f, 0x4000, 0xe55a, 0x71f6
 };
 unsigned short rseqipx_code_length01 = 0x09d8;
 /*
diff -Nru a/drivers/scsi/qla2xxx/ql6312_fw.c b/drivers/scsi/qla2xxx/ql6312_fw.c
--- a/drivers/scsi/qla2xxx/ql6312_fw.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/scsi/qla2xxx/ql6312_fw.c	Tue Jun 15 22:20:37 2004
@@ -18,7 +18,7 @@
  *************************************************************************/
 
 /*
- *	Firmware Version 3.02.26 (08:43 Mar 11, 2004)
+ *	Firmware Version 3.02.28 (13:56 Apr 03, 2004)
  */
 
 #ifdef UNIQUE_FW_NAME
@@ -28,15 +28,15 @@
 #endif
 
 #ifdef UNIQUE_FW_NAME
-unsigned char fw2300flx_version_str[] = {3, 2,26};
+unsigned char fw2300flx_version_str[] = {3, 2,28};
 #else
-unsigned char firmware_version[] = {3, 2,26};
+unsigned char firmware_version[] = {3, 2,28};
 #endif
 
 #ifdef UNIQUE_FW_NAME
-#define fw2300flx_VERSION_STRING "3.02.26"
+#define fw2300flx_VERSION_STRING "3.02.28"
 #else
-#define FW_VERSION_STRING "3.02.26"
+#define FW_VERSION_STRING "3.02.28"
 #endif
 
 #ifdef UNIQUE_FW_NAME
@@ -50,12 +50,12 @@
 #else
 unsigned short risc_code01[] = { 
 #endif
-	0x0470, 0x0000, 0x0000, 0xd57a, 0x0000, 0x0003, 0x0002, 0x001a,
+	0x0470, 0x0000, 0x0000, 0xd59a, 0x0000, 0x0003, 0x0002, 0x001c,
 	0x0317, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2032, 0x3030,
 	0x3120, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241,
 	0x5449, 0x4f4e, 0x2049, 0x5350, 0x3233, 0x3030, 0x2046, 0x6972,
 	0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030,
-	0x332e, 0x3032, 0x2e32, 0x3620, 0x2020, 0x2020, 0x2400, 0x20a9,
+	0x332e, 0x3032, 0x2e32, 0x3820, 0x2020, 0x2020, 0x2400, 0x20a9,
 	0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2200, 0x20a9, 0x000f,
 	0x2001, 0x0000, 0x400f, 0x2091, 0x2400, 0x20a9, 0x000f, 0x2001,
 	0x0000, 0x400f, 0x2091, 0x2600, 0x20a9, 0x000f, 0x2001, 0x0000,
@@ -78,94 +78,94 @@
 	0x1800, 0x810d, 0x810d, 0x810d, 0x810d, 0x810d, 0x918c, 0x001f,
 	0x2001, 0x0001, 0x9112, 0x20e9, 0x0001, 0x20a1, 0x0800, 0x900e,
 	0x20a9, 0x0800, 0x4104, 0x8211, 0x1dd8, 0x080c, 0x0f03, 0x080c,
-	0x5cd8, 0x080c, 0x9daf, 0x080c, 0x10ba, 0x080c, 0x129f, 0x080c,
-	0x1a53, 0x080c, 0x0d46, 0x080c, 0x103f, 0x080c, 0x3231, 0x080c,
-	0x729f, 0x080c, 0x6616, 0x080c, 0x7f4b, 0x080c, 0x230a, 0x080c,
-	0x8278, 0x080c, 0x7928, 0x080c, 0x2147, 0x080c, 0x227b, 0x080c,
+	0x5cdf, 0x080c, 0x9dc8, 0x080c, 0x10ba, 0x080c, 0x129f, 0x080c,
+	0x1a53, 0x080c, 0x0d46, 0x080c, 0x103f, 0x080c, 0x3238, 0x080c,
+	0x72aa, 0x080c, 0x661d, 0x080c, 0x7f73, 0x080c, 0x230a, 0x080c,
+	0x82a0, 0x080c, 0x7933, 0x080c, 0x2147, 0x080c, 0x227b, 0x080c,
 	0x22ff, 0x2091, 0x3009, 0x7883, 0x0000, 0x1004, 0x091d, 0x7880,
 	0x9086, 0x0002, 0x1190, 0x7883, 0x4000, 0x7837, 0x4000, 0x7833,
 	0x0010, 0x0e04, 0x0911, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001,
 	0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x2071, 0x1800, 0x7003,
 	0x0000, 0x2071, 0x1800, 0x7000, 0x908e, 0x0003, 0x1168, 0x080c,
-	0x4997, 0x080c, 0x3258, 0x080c, 0x7310, 0x080c, 0x6ad6, 0x080c,
-	0x7f74, 0x080c, 0x2ab8, 0x0c68, 0x000b, 0x0c88, 0x0940, 0x0941,
+	0x499e, 0x080c, 0x325f, 0x080c, 0x731b, 0x080c, 0x6add, 0x080c,
+	0x7f9c, 0x080c, 0x2ab8, 0x0c68, 0x000b, 0x0c88, 0x0940, 0x0941,
 	0x0ad8, 0x093e, 0x0b8f, 0x0d45, 0x0d45, 0x0d45, 0x080c, 0x0db4,
 	0x0005, 0x0126, 0x00f6, 0x2091, 0x8000, 0x7000, 0x9086, 0x0001,
-	0x1904, 0x0aab, 0x080c, 0x0e71, 0x080c, 0x6fa7, 0x0150, 0x080c,
-	0x6fca, 0x15a0, 0x2079, 0x0100, 0x7828, 0x9085, 0x1800, 0x782a,
-	0x0468, 0x080c, 0x6ed9, 0x7000, 0x9086, 0x0001, 0x1904, 0x0aab,
-	0x7094, 0x9086, 0x0028, 0x1904, 0x0aab, 0x080c, 0x7f43, 0x080c,
-	0x7f35, 0x2001, 0x0161, 0x2003, 0x0001, 0x2079, 0x0100, 0x7827,
-	0xffff, 0x7a28, 0x9295, 0x5e2f, 0x7a2a, 0x2011, 0x6e28, 0x080c,
-	0x8010, 0x2011, 0x6e1b, 0x080c, 0x80e4, 0x2011, 0x5b33, 0x080c,
-	0x8010, 0x2011, 0x8030, 0x901e, 0x7392, 0x04d0, 0x080c, 0x53e0,
-	0x2079, 0x0100, 0x7844, 0x9005, 0x1904, 0x0aab, 0x2011, 0x5b33,
-	0x080c, 0x8010, 0x2011, 0x6e28, 0x080c, 0x8010, 0x2011, 0x6e1b,
-	0x080c, 0x80e4, 0x2001, 0x0265, 0x2001, 0x0205, 0x2003, 0x0000,
+	0x1904, 0x0aab, 0x080c, 0x0e71, 0x080c, 0x6fb2, 0x0150, 0x080c,
+	0x6fd5, 0x15a0, 0x2079, 0x0100, 0x7828, 0x9085, 0x1800, 0x782a,
+	0x0468, 0x080c, 0x6ee4, 0x7000, 0x9086, 0x0001, 0x1904, 0x0aab,
+	0x7094, 0x9086, 0x0028, 0x1904, 0x0aab, 0x080c, 0x7f6b, 0x080c,
+	0x7f5d, 0x2001, 0x0161, 0x2003, 0x0001, 0x2079, 0x0100, 0x7827,
+	0xffff, 0x7a28, 0x9295, 0x5e2f, 0x7a2a, 0x2011, 0x6e33, 0x080c,
+	0x8038, 0x2011, 0x6e26, 0x080c, 0x810c, 0x2011, 0x5b3a, 0x080c,
+	0x8038, 0x2011, 0x8030, 0x901e, 0x7392, 0x04d0, 0x080c, 0x53e7,
+	0x2079, 0x0100, 0x7844, 0x9005, 0x1904, 0x0aab, 0x2011, 0x5b3a,
+	0x080c, 0x8038, 0x2011, 0x6e33, 0x080c, 0x8038, 0x2011, 0x6e26,
+	0x080c, 0x810c, 0x2001, 0x0265, 0x2001, 0x0205, 0x2003, 0x0000,
 	0x7840, 0x9084, 0xfffb, 0x7842, 0x2001, 0x1977, 0x2004, 0x9005,
-	0x1140, 0x00c6, 0x2061, 0x0100, 0x080c, 0x5c80, 0x00ce, 0x0804,
-	0x0aab, 0x780f, 0x006b, 0x7a28, 0x080c, 0x6faf, 0x0118, 0x9295,
+	0x1140, 0x00c6, 0x2061, 0x0100, 0x080c, 0x5c87, 0x00ce, 0x0804,
+	0x0aab, 0x780f, 0x006b, 0x7a28, 0x080c, 0x6fba, 0x0118, 0x9295,
 	0x5e2f, 0x0010, 0x9295, 0x402f, 0x7a2a, 0x2011, 0x8010, 0x73d4,
-	0x2001, 0x1978, 0x2003, 0x0001, 0x080c, 0x297e, 0x080c, 0x48d2,
+	0x2001, 0x1978, 0x2003, 0x0001, 0x080c, 0x297e, 0x080c, 0x48d9,
 	0x7244, 0xc284, 0x7246, 0x2001, 0x180c, 0x200c, 0xc1ac, 0xc1cc,
-	0x2102, 0x080c, 0x9626, 0x2011, 0x0004, 0x080c, 0xbb0e, 0x080c,
-	0x645a, 0x080c, 0x6fa7, 0x1120, 0x080c, 0x29c2, 0x02e0, 0x0400,
-	0x080c, 0x5c87, 0x0140, 0x7093, 0x0001, 0x70cf, 0x0000, 0x080c,
-	0x55ad, 0x0804, 0x0aab, 0x080c, 0x537f, 0xd094, 0x0188, 0x2011,
-	0x180c, 0x2204, 0xc0cd, 0x2012, 0x080c, 0x5383, 0xd0d4, 0x1118,
+	0x2102, 0x080c, 0x963f, 0x2011, 0x0004, 0x080c, 0xbb27, 0x080c,
+	0x6461, 0x080c, 0x6fb2, 0x1120, 0x080c, 0x29c2, 0x02e0, 0x0400,
+	0x080c, 0x5c8e, 0x0140, 0x7093, 0x0001, 0x70cf, 0x0000, 0x080c,
+	0x55b4, 0x0804, 0x0aab, 0x080c, 0x5386, 0xd094, 0x0188, 0x2011,
+	0x180c, 0x2204, 0xc0cd, 0x2012, 0x080c, 0x538a, 0xd0d4, 0x1118,
 	0x080c, 0x29c2, 0x1270, 0x2011, 0x180c, 0x2204, 0xc0bc, 0x0088,
-	0x080c, 0x5383, 0xd0d4, 0x1db8, 0x2011, 0x180c, 0x2204, 0xc0bd,
-	0x0040, 0x2011, 0x180c, 0x2204, 0xc0bd, 0x2012, 0x080c, 0x6553,
-	0x0008, 0x2012, 0x080c, 0x6519, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e,
-	0x00a8, 0x707b, 0x0000, 0x080c, 0x6fa7, 0x1130, 0x70ac, 0x9005,
-	0x1168, 0x080c, 0xbf4a, 0x0050, 0x080c, 0xbf4a, 0x70d8, 0xd09c,
-	0x1128, 0x70ac, 0x9005, 0x0110, 0x080c, 0x5c5d, 0x70e3, 0x0000,
+	0x080c, 0x538a, 0xd0d4, 0x1db8, 0x2011, 0x180c, 0x2204, 0xc0bd,
+	0x0040, 0x2011, 0x180c, 0x2204, 0xc0bd, 0x2012, 0x080c, 0x655a,
+	0x0008, 0x2012, 0x080c, 0x6520, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e,
+	0x00a8, 0x707b, 0x0000, 0x080c, 0x6fb2, 0x1130, 0x70ac, 0x9005,
+	0x1168, 0x080c, 0xbf63, 0x0050, 0x080c, 0xbf63, 0x70d8, 0xd09c,
+	0x1128, 0x70ac, 0x9005, 0x0110, 0x080c, 0x5c64, 0x70e3, 0x0000,
 	0x70df, 0x0000, 0x70a3, 0x0000, 0x080c, 0x29ca, 0x0228, 0x2011,
-	0x0101, 0x2204, 0xc0c4, 0x2012, 0x72d8, 0x080c, 0x6fa7, 0x1178,
+	0x0101, 0x2204, 0xc0c4, 0x2012, 0x72d8, 0x080c, 0x6fb2, 0x1178,
 	0x9016, 0x0016, 0x2009, 0x0002, 0x2019, 0x193e, 0x211a, 0x001e,
 	0x705b, 0xffff, 0x705f, 0x00ef, 0x707f, 0x0000, 0x0020, 0x2019,
 	0x193e, 0x201b, 0x0000, 0x2079, 0x1853, 0x7804, 0xd0ac, 0x0108,
-	0xc295, 0x72da, 0x080c, 0x6fa7, 0x0118, 0x9296, 0x0004, 0x0548,
-	0x2011, 0x0001, 0x080c, 0xbb0e, 0x70a7, 0x0000, 0x70ab, 0xffff,
+	0xc295, 0x72da, 0x080c, 0x6fb2, 0x0118, 0x9296, 0x0004, 0x0548,
+	0x2011, 0x0001, 0x080c, 0xbb27, 0x70a7, 0x0000, 0x70ab, 0xffff,
 	0x7003, 0x0002, 0x2079, 0x0100, 0x7827, 0x0003, 0x7828, 0x9085,
 	0x0003, 0x782a, 0x00fe, 0x080c, 0x2dbb, 0x2011, 0x0005, 0x080c,
-	0x9758, 0x080c, 0x894b, 0x080c, 0x6fa7, 0x0148, 0x00c6, 0x2061,
+	0x9771, 0x080c, 0x8973, 0x080c, 0x6fb2, 0x0148, 0x00c6, 0x2061,
 	0x0100, 0x0016, 0x2009, 0x0002, 0x61e2, 0x001e, 0x00ce, 0x012e,
 	0x0420, 0x70a7, 0x0000, 0x70ab, 0xffff, 0x7003, 0x0002, 0x00f6,
 	0x2079, 0x0100, 0x7827, 0x0003, 0x7828, 0x9085, 0x0003, 0x782a,
-	0x00fe, 0x2011, 0x0005, 0x080c, 0x9758, 0x080c, 0x894b, 0x080c,
-	0x6fa7, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x2009, 0x0002,
+	0x00fe, 0x2011, 0x0005, 0x080c, 0x9771, 0x080c, 0x8973, 0x080c,
+	0x6fb2, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016, 0x2009, 0x0002,
 	0x61e2, 0x001e, 0x00ce, 0x00fe, 0x012e, 0x0005, 0x00c6, 0x00b6,
-	0x080c, 0x6fa7, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782,
-	0x080c, 0x6fa7, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x86ff,
+	0x080c, 0x6fb2, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782,
+	0x080c, 0x6fb2, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x86ff,
 	0x0138, 0x9180, 0x1000, 0x2004, 0x905d, 0x0110, 0xb800, 0xd0bc,
-	0x090c, 0x30ce, 0x8108, 0x1f04, 0x0abf, 0x707b, 0x0000, 0x707c,
+	0x090c, 0x30d5, 0x8108, 0x1f04, 0x0abf, 0x707b, 0x0000, 0x707c,
 	0x9084, 0x00ff, 0x707e, 0x70af, 0x0000, 0x00be, 0x00ce, 0x0005,
 	0x00b6, 0x0126, 0x2091, 0x8000, 0x7000, 0x9086, 0x0002, 0x1904,
 	0x0b8c, 0x70a8, 0x9086, 0xffff, 0x0130, 0x080c, 0x2dbb, 0x080c,
-	0x894b, 0x0804, 0x0b8c, 0x70d8, 0xd0ac, 0x1110, 0xd09c, 0x0540,
+	0x8973, 0x0804, 0x0b8c, 0x70d8, 0xd0ac, 0x1110, 0xd09c, 0x0540,
 	0xd084, 0x0530, 0x0006, 0x2001, 0x0103, 0x2003, 0x002b, 0x000e,
-	0xd08c, 0x01f0, 0x70dc, 0x9086, 0xffff, 0x01b0, 0x080c, 0x2f43,
-	0x080c, 0x894b, 0x70d8, 0xd094, 0x1904, 0x0b8c, 0x2011, 0x0001,
-	0x080c, 0xc1f9, 0x0110, 0x2011, 0x0003, 0x901e, 0x080c, 0x2f7d,
-	0x080c, 0x894b, 0x0804, 0x0b8c, 0x70e0, 0x9005, 0x1904, 0x0b8c,
+	0xd08c, 0x01f0, 0x70dc, 0x9086, 0xffff, 0x01b0, 0x080c, 0x2f46,
+	0x080c, 0x8973, 0x70d8, 0xd094, 0x1904, 0x0b8c, 0x2011, 0x0001,
+	0x080c, 0xc212, 0x0110, 0x2011, 0x0003, 0x901e, 0x080c, 0x2f80,
+	0x080c, 0x8973, 0x0804, 0x0b8c, 0x70e0, 0x9005, 0x1904, 0x0b8c,
 	0x70a4, 0x9005, 0x1904, 0x0b8c, 0x70d8, 0xd0a4, 0x0118, 0xd0b4,
-	0x0904, 0x0b8c, 0x080c, 0x6519, 0x1904, 0x0b8c, 0x080c, 0x656c,
-	0x1904, 0x0b8c, 0x080c, 0x6553, 0x01c0, 0x0156, 0x00c6, 0x20a9,
-	0x007f, 0x900e, 0x0016, 0x080c, 0x6237, 0x1118, 0xb800, 0xd0ec,
+	0x0904, 0x0b8c, 0x080c, 0x6520, 0x1904, 0x0b8c, 0x080c, 0x6573,
+	0x1904, 0x0b8c, 0x080c, 0x655a, 0x01c0, 0x0156, 0x00c6, 0x20a9,
+	0x007f, 0x900e, 0x0016, 0x080c, 0x623e, 0x1118, 0xb800, 0xd0ec,
 	0x1138, 0x001e, 0x8108, 0x1f04, 0x0b32, 0x00ce, 0x015e, 0x0028,
 	0x001e, 0x00ce, 0x015e, 0x0804, 0x0b8c, 0x0006, 0x2001, 0x0103,
 	0x2003, 0x006b, 0x000e, 0x2011, 0x1984, 0x080c, 0x0f73, 0x2011,
 	0x199e, 0x080c, 0x0f73, 0x7030, 0xc08c, 0x7032, 0x7003, 0x0003,
 	0x70ab, 0xffff, 0x080c, 0x0e53, 0x9006, 0x080c, 0x260c, 0x0036,
-	0x0046, 0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4a6f, 0x004e,
-	0x003e, 0x00f6, 0x2079, 0x0100, 0x080c, 0x6fca, 0x0150, 0x080c,
-	0x6fa7, 0x7828, 0x0118, 0x9084, 0xe1ff, 0x0010, 0x9084, 0xffdf,
+	0x0046, 0x2019, 0xffff, 0x2021, 0x0006, 0x080c, 0x4a76, 0x004e,
+	0x003e, 0x00f6, 0x2079, 0x0100, 0x080c, 0x6fd5, 0x0150, 0x080c,
+	0x6fb2, 0x7828, 0x0118, 0x9084, 0xe1ff, 0x0010, 0x9084, 0xffdf,
 	0x782a, 0x00fe, 0x2001, 0x19b9, 0x2004, 0x9086, 0x0005, 0x1120,
-	0x2011, 0x0000, 0x080c, 0x9758, 0x2011, 0x0000, 0x080c, 0x9762,
-	0x080c, 0x894b, 0x080c, 0x8a26, 0x012e, 0x00be, 0x0005, 0x0016,
+	0x2011, 0x0000, 0x080c, 0x9771, 0x2011, 0x0000, 0x080c, 0x977b,
+	0x080c, 0x8973, 0x080c, 0x8a4e, 0x012e, 0x00be, 0x0005, 0x0016,
 	0x0046, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100, 0x7904,
-	0x918c, 0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x5c46, 0x7940,
+	0x918c, 0xfffd, 0x7906, 0x2009, 0x00f7, 0x080c, 0x5c4d, 0x7940,
 	0x918c, 0x0010, 0x7942, 0x7924, 0xd1b4, 0x0110, 0x7827, 0x0040,
 	0xd19c, 0x0110, 0x7827, 0x0008, 0x0006, 0x0036, 0x0156, 0x7954,
 	0xd1ac, 0x1904, 0x0c1c, 0x2001, 0x1978, 0x2004, 0x9005, 0x1518,
@@ -173,13 +173,13 @@
 	0x0001, 0x080c, 0x2990, 0x00b8, 0x080c, 0x2a4d, 0x1138, 0x9006,
 	0x080c, 0x29ad, 0x9006, 0x080c, 0x2990, 0x0068, 0x080c, 0x2a55,
 	0x1d50, 0x2001, 0x1969, 0x2004, 0xd0fc, 0x0108, 0x0020, 0x080c,
-	0x27a7, 0x0804, 0x0cfc, 0x080c, 0x6fb8, 0x0148, 0x080c, 0x6fca,
-	0x1118, 0x080c, 0x729a, 0x0050, 0x080c, 0x6faf, 0x0dd0, 0x080c,
-	0x7295, 0x080c, 0x728b, 0x080c, 0x6ed9, 0x0058, 0x080c, 0x6fa7,
-	0x0140, 0x2009, 0x00f8, 0x080c, 0x5c46, 0x7843, 0x0090, 0x7843,
-	0x0010, 0x20a9, 0x09c4, 0x7820, 0xd09c, 0x1138, 0x080c, 0x6fa7,
+	0x27a7, 0x0804, 0x0cfc, 0x080c, 0x6fc3, 0x0148, 0x080c, 0x6fd5,
+	0x1118, 0x080c, 0x72a5, 0x0050, 0x080c, 0x6fba, 0x0dd0, 0x080c,
+	0x72a0, 0x080c, 0x7296, 0x080c, 0x6ee4, 0x0058, 0x080c, 0x6fb2,
+	0x0140, 0x2009, 0x00f8, 0x080c, 0x5c4d, 0x7843, 0x0090, 0x7843,
+	0x0010, 0x20a9, 0x09c4, 0x7820, 0xd09c, 0x1138, 0x080c, 0x6fb2,
 	0x0138, 0x7824, 0xd0ac, 0x1904, 0x0d01, 0x1f04, 0x0bfb, 0x0070,
-	0x7824, 0x080c, 0x6fc1, 0x0118, 0xd0ac, 0x1904, 0x0d01, 0x9084,
+	0x7824, 0x080c, 0x6fcc, 0x0118, 0xd0ac, 0x1904, 0x0d01, 0x9084,
 	0x1800, 0x0d98, 0x7003, 0x0001, 0x0804, 0x0d01, 0x2001, 0x0001,
 	0x080c, 0x260c, 0x0804, 0x0d14, 0x2001, 0x1978, 0x2004, 0x9005,
 	0x1518, 0x080c, 0x2a45, 0x1148, 0x2001, 0x0001, 0x080c, 0x29ad,
@@ -189,46 +189,46 @@
 	0x080c, 0x27a7, 0x0804, 0x0cfc, 0x7850, 0x9085, 0x0040, 0x7852,
 	0x7938, 0x7850, 0x9084, 0xfbcf, 0x7852, 0x080c, 0x2a5d, 0x9085,
 	0x2000, 0x7852, 0x793a, 0x20a9, 0x0046, 0x1d04, 0x0c55, 0x080c,
-	0x80c4, 0x1f04, 0x0c55, 0x7850, 0x9085, 0x0400, 0x9084, 0xdfbf,
-	0x7852, 0x793a, 0x080c, 0x6fb8, 0x0148, 0x080c, 0x6fca, 0x1118,
-	0x080c, 0x729a, 0x0050, 0x080c, 0x6faf, 0x0dd0, 0x080c, 0x7295,
-	0x080c, 0x728b, 0x080c, 0x6ed9, 0x0020, 0x2009, 0x00f8, 0x080c,
-	0x5c46, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x0c7b, 0x7850, 0x9085,
-	0x1400, 0x7852, 0x080c, 0x6fa7, 0x0120, 0x7843, 0x0090, 0x7843,
-	0x0010, 0x2021, 0xe678, 0x2019, 0xea60, 0x0d0c, 0x80c4, 0x7820,
-	0xd09c, 0x1588, 0x080c, 0x6fa7, 0x0904, 0x0ce1, 0x7824, 0xd0ac,
-	0x1904, 0x0d01, 0x080c, 0x6fca, 0x1530, 0x0046, 0x2021, 0x0320,
+	0x80ec, 0x1f04, 0x0c55, 0x7850, 0x9085, 0x0400, 0x9084, 0xdfbf,
+	0x7852, 0x793a, 0x080c, 0x6fc3, 0x0148, 0x080c, 0x6fd5, 0x1118,
+	0x080c, 0x72a5, 0x0050, 0x080c, 0x6fba, 0x0dd0, 0x080c, 0x72a0,
+	0x080c, 0x7296, 0x080c, 0x6ee4, 0x0020, 0x2009, 0x00f8, 0x080c,
+	0x5c4d, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x0c7b, 0x7850, 0x9085,
+	0x1400, 0x7852, 0x080c, 0x6fb2, 0x0120, 0x7843, 0x0090, 0x7843,
+	0x0010, 0x2021, 0xe678, 0x2019, 0xea60, 0x0d0c, 0x80ec, 0x7820,
+	0xd09c, 0x1588, 0x080c, 0x6fb2, 0x0904, 0x0ce1, 0x7824, 0xd0ac,
+	0x1904, 0x0d01, 0x080c, 0x6fd5, 0x1530, 0x0046, 0x2021, 0x0320,
 	0x8421, 0x1df0, 0x004e, 0x7827, 0x1800, 0x080c, 0x2a5d, 0x7824,
 	0x9084, 0x1800, 0x1168, 0x9484, 0x0fff, 0x1140, 0x2001, 0x1810,
 	0x2004, 0x9084, 0x9000, 0x0110, 0x080c, 0x0d22, 0x8421, 0x1158,
-	0x1d04, 0x0cbc, 0x080c, 0x80c4, 0x080c, 0x7295, 0x080c, 0x728b,
+	0x1d04, 0x0cbc, 0x080c, 0x80ec, 0x080c, 0x72a0, 0x080c, 0x7296,
 	0x7003, 0x0001, 0x04f0, 0x8319, 0x1940, 0x1d04, 0x0cc9, 0x080c,
-	0x80c4, 0x2009, 0x196c, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a,
+	0x80ec, 0x2009, 0x196c, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a,
 	0x1178, 0x200b, 0x000a, 0x7827, 0x0048, 0x20a9, 0x0002, 0x080c,
 	0x2a3e, 0x7924, 0x080c, 0x2a5d, 0xd19c, 0x0110, 0x080c, 0x297e,
-	0x00d8, 0x080c, 0x6fb8, 0x1140, 0x94a2, 0x03e8, 0x1128, 0x080c,
-	0x6f7f, 0x7003, 0x0001, 0x00a8, 0x7827, 0x1800, 0x080c, 0x2a5d,
-	0x7824, 0x080c, 0x6fc1, 0x0110, 0xd0ac, 0x1158, 0x9084, 0x1800,
+	0x00d8, 0x080c, 0x6fc3, 0x1140, 0x94a2, 0x03e8, 0x1128, 0x080c,
+	0x6f8a, 0x7003, 0x0001, 0x00a8, 0x7827, 0x1800, 0x080c, 0x2a5d,
+	0x7824, 0x080c, 0x6fcc, 0x0110, 0xd0ac, 0x1158, 0x9084, 0x1800,
 	0x0950, 0x7003, 0x0001, 0x0028, 0x2001, 0x0001, 0x080c, 0x260c,
 	0x0078, 0x2009, 0x180c, 0x210c, 0xd19c, 0x1120, 0x7904, 0x918d,
 	0x0002, 0x7906, 0x7827, 0x0048, 0x7828, 0x9085, 0x0028, 0x782a,
 	0x7850, 0x9085, 0x0400, 0x7852, 0x2001, 0x1978, 0x2003, 0x0000,
 	0x9006, 0x78f2, 0x015e, 0x003e, 0x000e, 0x012e, 0x00fe, 0x004e,
 	0x001e, 0x0005, 0x0006, 0x0016, 0x0036, 0x0046, 0x00b6, 0x00c6,
-	0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0069, 0x0d0c, 0x80c4, 0x015e,
+	0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0069, 0x0d0c, 0x80ec, 0x015e,
 	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x004e, 0x003e, 0x001e,
 	0x000e, 0x0005, 0x00e6, 0x2071, 0x1894, 0x7004, 0x9086, 0x0001,
-	0x1110, 0x080c, 0x3258, 0x00ee, 0x0005, 0x0005, 0x2a70, 0x2061,
-	0x197c, 0x2063, 0x0003, 0x6007, 0x0002, 0x600b, 0x001a, 0x600f,
+	0x1110, 0x080c, 0x325f, 0x00ee, 0x0005, 0x0005, 0x2a70, 0x2061,
+	0x197c, 0x2063, 0x0003, 0x6007, 0x0002, 0x600b, 0x001c, 0x600f,
 	0x0317, 0x2001, 0x194d, 0x900e, 0x2102, 0x7192, 0x2001, 0x0100,
 	0x2004, 0x9082, 0x0002, 0x0218, 0x705b, 0xffff, 0x0008, 0x715a,
-	0x7063, 0xffff, 0x717a, 0x717e, 0x080c, 0xbf4a, 0x70e7, 0x00c0,
+	0x7063, 0xffff, 0x717a, 0x717e, 0x080c, 0xbf63, 0x70e7, 0x00c0,
 	0x2061, 0x193d, 0x6003, 0x0909, 0x6106, 0x600b, 0x8800, 0x600f,
 	0x0200, 0x6013, 0x00ff, 0x6017, 0x000f, 0x611a, 0x601f, 0x07d0,
 	0x2061, 0x1945, 0x6003, 0x8000, 0x6106, 0x610a, 0x600f, 0x0200,
 	0x6013, 0x00ff, 0x6116, 0x601b, 0x0001, 0x611e, 0x2061, 0x195a,
 	0x6003, 0x514c, 0x6007, 0x4f47, 0x600b, 0x4943, 0x600f, 0x2020,
-	0x2001, 0x182b, 0x2102, 0x0005, 0x9016, 0x080c, 0x6237, 0x1178,
+	0x2001, 0x182b, 0x2102, 0x0005, 0x9016, 0x080c, 0x623e, 0x1178,
 	0xb804, 0x90c4, 0x00ff, 0x98c6, 0x0006, 0x0128, 0x90c4, 0xff00,
 	0x98c6, 0x0600, 0x1120, 0x9186, 0x0080, 0x0108, 0x8210, 0x8108,
 	0x9186, 0x0800, 0x1d50, 0x2208, 0x0005, 0x2091, 0x8000, 0x2079,
@@ -247,7 +247,7 @@
 	0x7803, 0x0005, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
 	0x0180, 0x2001, 0x19ea, 0x2004, 0x9005, 0x0128, 0x2001, 0x008b,
 	0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002, 0x2003,
-	0x1001, 0x080c, 0x538e, 0x1108, 0x0099, 0x0cd8, 0x0005, 0x918c,
+	0x1001, 0x080c, 0x5395, 0x1108, 0x0099, 0x0cd8, 0x0005, 0x918c,
 	0x03ff, 0x2001, 0x0003, 0x2004, 0x9084, 0x0600, 0x1118, 0x918d,
 	0x2800, 0x0010, 0x918d, 0x2000, 0x2001, 0x017f, 0x2102, 0x0005,
 	0x0026, 0x0126, 0x2011, 0x0080, 0x080c, 0x0ecb, 0x20a9, 0x0900,
@@ -313,7 +313,7 @@
 	0x8000, 0x0016, 0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0xa862,
 	0x9184, 0xffc0, 0xa85e, 0x001e, 0x0020, 0x00e6, 0x0126, 0x2091,
 	0x8000, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc,
-	0x8000, 0x70be, 0x080c, 0x7f35, 0x012e, 0x00ee, 0x0005, 0x2071,
+	0x8000, 0x70be, 0x080c, 0x7f5d, 0x012e, 0x00ee, 0x0005, 0x2071,
 	0x1800, 0x9026, 0x2009, 0x0000, 0x2049, 0x0400, 0x2900, 0x702e,
 	0x8940, 0x2800, 0xa802, 0xa95e, 0xa863, 0x0001, 0x8420, 0x9886,
 	0x0440, 0x0120, 0x2848, 0x9188, 0x0040, 0x0c90, 0x2071, 0x1883,
@@ -377,22 +377,22 @@
 	0x080f, 0x008e, 0x00de, 0x009e, 0x080c, 0x10f4, 0x0005, 0x00de,
 	0x009e, 0x080c, 0x10f4, 0x0005, 0xa8a8, 0xd08c, 0x0005, 0x0096,
 	0xa0a0, 0x904d, 0x090c, 0x0db4, 0xa06c, 0x908e, 0x0100, 0x0130,
-	0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x080c, 0x6878,
+	0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x080c, 0x687f,
 	0xa09f, 0x0000, 0xa0a3, 0x0000, 0x2848, 0x080c, 0x101d, 0x009e,
 	0x0005, 0x00a6, 0xa0a0, 0x904d, 0x090c, 0x0db4, 0xa06c, 0x908e,
 	0x0100, 0x0128, 0xa87b, 0x0001, 0xa883, 0x0000, 0x00c0, 0xa80c,
 	0x2050, 0xb004, 0x9005, 0x0198, 0xa80e, 0x2050, 0x8006, 0x8006,
 	0x8007, 0x908c, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0xa076,
 	0xa172, 0xb000, 0xa07a, 0x2810, 0x080c, 0x10d5, 0x00e8, 0xa97c,
-	0xa894, 0x0016, 0x0006, 0x080c, 0x6878, 0x000e, 0x001e, 0xd1fc,
-	0x1138, 0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, 0x9e19, 0x00ce,
+	0xa894, 0x0016, 0x0006, 0x080c, 0x687f, 0x000e, 0x001e, 0xd1fc,
+	0x1138, 0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, 0x9e32, 0x00ce,
 	0x7008, 0x2048, 0xa89f, 0x0000, 0xa8a3, 0x0000, 0x080c, 0x101d,
 	0x7007, 0x0000, 0x080c, 0x10f4, 0x00ae, 0x0005, 0x0126, 0x2091,
 	0x8000, 0x782b, 0x1001, 0x7007, 0x0005, 0x7000, 0xc094, 0x7002,
 	0x012e, 0x0005, 0x7007, 0x0000, 0x080c, 0x1105, 0x0005, 0x0126,
 	0x2091, 0x2200, 0x2079, 0x0300, 0x2071, 0x1a33, 0x7003, 0x0000,
 	0x78bf, 0x00f6, 0x781b, 0x4800, 0x00c1, 0x7803, 0x0003, 0x780f,
-	0x0000, 0x20a9, 0x0254, 0x2061, 0xd8c3, 0x2c0d, 0x7912, 0xe104,
+	0x0000, 0x20a9, 0x0254, 0x2061, 0xd8e3, 0x2c0d, 0x7912, 0xe104,
 	0x9ce0, 0x0002, 0x7916, 0x1f04, 0x12b5, 0x7807, 0x0007, 0x7803,
 	0x0000, 0x7803, 0x0001, 0x012e, 0x0005, 0x00c6, 0x7803, 0x0000,
 	0x7808, 0xd09c, 0x0110, 0x7820, 0x0cd8, 0x2001, 0x1a34, 0x2003,
@@ -401,9 +401,9 @@
 	0x782b, 0x1a52, 0x781f, 0xff00, 0x781b, 0xb700, 0x2001, 0x0200,
 	0x2004, 0xd0dc, 0x0110, 0x781f, 0x0303, 0x2061, 0x1a52, 0x602f,
 	0x1cd0, 0x2001, 0x1819, 0x2004, 0x9082, 0x1cd0, 0x6032, 0x603b,
-	0x1f26, 0x2001, 0x3131, 0xd0fc, 0x190c, 0x0db4, 0x2001, 0x0003,
-	0x2004, 0xd0d4, 0x1118, 0x783f, 0x3131, 0x0020, 0x9084, 0xc000,
-	0x783f, 0xb131, 0x00ce, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908,
+	0x1f26, 0x2001, 0x3138, 0xd0fc, 0x190c, 0x0db4, 0x2001, 0x0003,
+	0x2004, 0xd0d4, 0x1118, 0x783f, 0x3138, 0x0020, 0x9084, 0xc000,
+	0x783f, 0xb138, 0x00ce, 0x0005, 0x0126, 0x2091, 0x2200, 0x7908,
 	0x9184, 0x0070, 0x190c, 0x0dad, 0xd19c, 0x0158, 0x7820, 0x908c,
 	0xf000, 0x15e8, 0x908a, 0x0024, 0x1a0c, 0x0db4, 0x0023, 0x012e,
 	0x0005, 0x012e, 0x0005, 0x1347, 0x1347, 0x135e, 0x1363, 0x1367,
@@ -412,17 +412,17 @@
 	0x1347, 0x1347, 0x1347, 0x1347, 0x1347, 0x1347, 0x136e, 0x1347,
 	0x1347, 0x1347, 0x1347, 0x1347, 0x1347, 0x134b, 0x1349, 0x080c,
 	0x0db4, 0x080c, 0x0dad, 0x080c, 0x14a2, 0x2009, 0x1a4b, 0x2104,
-	0x8000, 0x200a, 0x080c, 0x79fc, 0x080c, 0x1958, 0x0005, 0x2009,
-	0x0048, 0x2060, 0x080c, 0x9e93, 0x012e, 0x0005, 0x7004, 0xc085,
+	0x8000, 0x200a, 0x080c, 0x7a07, 0x080c, 0x1958, 0x0005, 0x2009,
+	0x0048, 0x2060, 0x080c, 0x9eac, 0x012e, 0x0005, 0x7004, 0xc085,
 	0xc0b5, 0x7006, 0x0005, 0x7004, 0xc085, 0x7006, 0x0005, 0x080c,
 	0x14a2, 0x080c, 0x15de, 0x0005, 0x080c, 0x0db4, 0x080c, 0x14a2,
 	0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, 0x2009,
-	0x0048, 0x080c, 0x9e93, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009,
+	0x0048, 0x080c, 0x9eac, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009,
 	0x03e8, 0x8109, 0x0160, 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8,
 	0x2001, 0x0218, 0x2004, 0xd0ec, 0x1110, 0x080c, 0x14a7, 0x2001,
 	0x0307, 0x2003, 0x8000, 0x0005, 0x7004, 0xc095, 0x7006, 0x0005,
 	0x080c, 0x14a2, 0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff,
-	0x009e, 0x2009, 0x0048, 0x080c, 0x9e93, 0x0005, 0x080c, 0x14a2,
+	0x009e, 0x2009, 0x0048, 0x080c, 0x9eac, 0x0005, 0x080c, 0x14a2,
 	0x080c, 0x0db4, 0x080c, 0x14a2, 0x080c, 0x141f, 0x7827, 0x0018,
 	0x79ac, 0xd1dc, 0x0540, 0x7827, 0x0015, 0x7828, 0x782b, 0x0000,
 	0x9065, 0x0138, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003, 0x0020,
@@ -431,12 +431,12 @@
 	0x0050, 0x2003, 0x0020, 0x0480, 0x78ab, 0x0004, 0x7803, 0x0001,
 	0x080c, 0x1438, 0x0005, 0x7828, 0x782b, 0x0000, 0x9065, 0x090c,
 	0x0db4, 0x6014, 0x2048, 0x78ab, 0x0004, 0x918c, 0x0700, 0x0198,
-	0x080c, 0x79fc, 0x080c, 0x1958, 0x080c, 0xbafe, 0x0158, 0xa9ac,
+	0x080c, 0x7a07, 0x080c, 0x1958, 0x080c, 0xbb17, 0x0158, 0xa9ac,
 	0xa936, 0xa9b0, 0xa93a, 0xa83f, 0xffff, 0xa843, 0xffff, 0xa880,
 	0xc0bd, 0xa882, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-	0xd0bc, 0x6024, 0x190c, 0xbee3, 0x2029, 0x00c8, 0x8529, 0x0128,
-	0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xd86c,
-	0xd5a4, 0x1118, 0x080c, 0x14a7, 0x0005, 0x080c, 0x79fc, 0x080c,
+	0xd0bc, 0x6024, 0x190c, 0xbefc, 0x2029, 0x00c8, 0x8529, 0x0128,
+	0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xd88c,
+	0xd5a4, 0x1118, 0x080c, 0x14a7, 0x0005, 0x080c, 0x7a07, 0x080c,
 	0x1958, 0x0005, 0x781f, 0x0300, 0x7803, 0x0001, 0x0005, 0x0016,
 	0x0066, 0x0076, 0x00f6, 0x2079, 0x0300, 0x7908, 0x918c, 0x0007,
 	0x9186, 0x0003, 0x0120, 0x2001, 0x0016, 0x080c, 0x1518, 0x00fe,
@@ -454,7 +454,7 @@
 	0x2001, 0x020d, 0x2003, 0x0020, 0x080c, 0x12c5, 0x7803, 0x0001,
 	0x00ee, 0x001e, 0x0005, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003,
 	0x0020, 0x0069, 0x0ca8, 0x0031, 0x2060, 0x2009, 0x0053, 0x080c,
-	0x9e93, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x0005, 0x080c,
+	0x9eac, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x0005, 0x080c,
 	0x141f, 0x00d6, 0x2069, 0x0200, 0x2009, 0x01f4, 0x8109, 0x0510,
 	0x6804, 0x9005, 0x0dd8, 0x2001, 0x015d, 0x2003, 0x0000, 0x79bc,
 	0xd1a4, 0x1528, 0x79b8, 0x918c, 0x0fff, 0x0180, 0x9182, 0x0841,
@@ -462,7 +462,7 @@
 	0x080c, 0x150a, 0x6827, 0x0001, 0x8109, 0x1dd0, 0x04d9, 0x6827,
 	0x0002, 0x04c1, 0x6804, 0x9005, 0x1130, 0x682c, 0xd0e4, 0x1500,
 	0x6804, 0x9005, 0x0de8, 0x79b8, 0xd1ec, 0x1130, 0x08c0, 0x080c,
-	0x79fc, 0x080c, 0x1958, 0x0090, 0x7827, 0x0015, 0x782b, 0x0000,
+	0x7a07, 0x080c, 0x1958, 0x0090, 0x7827, 0x0015, 0x782b, 0x0000,
 	0x7827, 0x0018, 0x782b, 0x0000, 0x2001, 0x020d, 0x2003, 0x0020,
 	0x2001, 0x0307, 0x2003, 0x0300, 0x7803, 0x0001, 0x00de, 0x0005,
 	0x682c, 0x9084, 0x5400, 0x9086, 0x5400, 0x0d30, 0x7827, 0x0015,
@@ -478,7 +478,7 @@
 	0x1591, 0x9284, 0x0048, 0x9086, 0x0008, 0x1904, 0x1591, 0x2001,
 	0x0109, 0x2004, 0xd08c, 0x01f0, 0x0006, 0x01c6, 0x01d6, 0x0136,
 	0x0146, 0x0156, 0x0126, 0x2091, 0x2800, 0x00f6, 0x0026, 0x0016,
-	0x2009, 0x1a4d, 0x2104, 0x8000, 0x0208, 0x200a, 0x080c, 0x8382,
+	0x2009, 0x1a4d, 0x2104, 0x8000, 0x0208, 0x200a, 0x080c, 0x83aa,
 	0x001e, 0x002e, 0x00fe, 0x012e, 0x015e, 0x014e, 0x013e, 0x01de,
 	0x01ce, 0x000e, 0x2001, 0x009b, 0x2004, 0xd0fc, 0x01d0, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x00f6, 0x0016,
@@ -488,7 +488,7 @@
 	0x2004, 0xd0f4, 0x1528, 0x7a18, 0x9284, 0x0030, 0x0508, 0x9284,
 	0x0048, 0x9086, 0x0008, 0x11e0, 0x2001, 0x19c7, 0x2004, 0x9005,
 	0x01b8, 0x2001, 0x1a36, 0x2004, 0x9086, 0x0000, 0x0188, 0x2009,
-	0x1a4c, 0x2104, 0x8000, 0x0208, 0x200a, 0x080c, 0x9417, 0x2009,
+	0x1a4c, 0x2104, 0x8000, 0x0208, 0x200a, 0x080c, 0x9430, 0x2009,
 	0x180c, 0x2104, 0xc0f5, 0x200a, 0x2009, 0xff00, 0x0804, 0x1541,
 	0x9085, 0x0001, 0x0005, 0x7832, 0x7936, 0x7a3a, 0x781b, 0x8080,
 	0x080c, 0x153a, 0x1108, 0x0005, 0x792c, 0x3900, 0x8000, 0x2004,
@@ -498,9 +498,9 @@
 	0x0904, 0x163d, 0x7017, 0x0000, 0x2001, 0x0264, 0x2004, 0xd0bc,
 	0x0904, 0x163d, 0x2001, 0x0268, 0x00c6, 0x2064, 0x6104, 0x6038,
 	0x00ce, 0x918e, 0x0039, 0x1904, 0x163d, 0x9c06, 0x15f0, 0x0126,
-	0x2091, 0x2600, 0x080c, 0x7943, 0x012e, 0x7358, 0x745c, 0x6014,
+	0x2091, 0x2600, 0x080c, 0x794e, 0x012e, 0x7358, 0x745c, 0x6014,
 	0x905d, 0x0598, 0x2b48, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-	0xd0bc, 0x190c, 0xbebe, 0xab42, 0xac3e, 0x2001, 0x1875, 0x2004,
+	0xd0bc, 0x190c, 0xbed7, 0xab42, 0xac3e, 0x2001, 0x1875, 0x2004,
 	0xd0b4, 0x1170, 0x601c, 0xd0e4, 0x1158, 0x6010, 0x00b6, 0x2058,
 	0xb800, 0x00be, 0xd0bc, 0x1120, 0xa83b, 0x7fff, 0xa837, 0xffff,
 	0x080c, 0x1f46, 0x1190, 0x080c, 0x17eb, 0x2a00, 0xa816, 0x0130,
@@ -595,7 +595,7 @@
 	0x810c, 0x81ff, 0x1118, 0xa887, 0x0001, 0x0008, 0xa986, 0x601b,
 	0x0002, 0xa974, 0xd1dc, 0x1108, 0x0005, 0xa934, 0xa88c, 0x9106,
 	0x1158, 0xa938, 0xa890, 0x9106, 0x1138, 0x601c, 0xc084, 0x601e,
-	0x2009, 0x0048, 0x0804, 0x9e93, 0x0005, 0x0126, 0x00c6, 0x2091,
+	0x2009, 0x0048, 0x0804, 0x9eac, 0x0005, 0x0126, 0x00c6, 0x2091,
 	0x2200, 0x00ce, 0x7908, 0x918c, 0x0007, 0x9186, 0x0000, 0x05b0,
 	0x9186, 0x0003, 0x0598, 0x6020, 0x6023, 0x0000, 0x0006, 0x2031,
 	0x0008, 0x00c6, 0x781f, 0x0808, 0x7808, 0xd09c, 0x0120, 0x080c,
@@ -606,17 +606,17 @@
 	0x080c, 0x19f4, 0x000e, 0x6022, 0x012e, 0x0005, 0x080c, 0x19e1,
 	0x7827, 0x0015, 0x7828, 0x9c06, 0x1db8, 0x782b, 0x0000, 0x0ca0,
 	0x00f6, 0x2079, 0x0300, 0x7803, 0x0000, 0x78ab, 0x0004, 0x00fe,
-	0x080c, 0x6fa7, 0x11b0, 0x2001, 0x0138, 0x2003, 0x0000, 0x2001,
+	0x080c, 0x6fb2, 0x11b0, 0x2001, 0x0138, 0x2003, 0x0000, 0x2001,
 	0x0160, 0x2003, 0x0000, 0x2011, 0x012c, 0xa001, 0xa001, 0x8211,
-	0x1de0, 0x0081, 0x0066, 0x2031, 0x0000, 0x080c, 0x7057, 0x006e,
+	0x1de0, 0x0081, 0x0066, 0x2031, 0x0000, 0x080c, 0x7062, 0x006e,
 	0x0005, 0x0479, 0x0039, 0x2001, 0x0160, 0x2502, 0x2001, 0x0138,
 	0x2202, 0x0005, 0x00e6, 0x2071, 0x0200, 0x080c, 0x2a69, 0x2009,
 	0x003c, 0x080c, 0x2268, 0x2001, 0x015d, 0x2003, 0x0000, 0x7000,
-	0x9084, 0x003c, 0x1de0, 0x080c, 0x7f35, 0x70a0, 0x70a2, 0x7098,
+	0x9084, 0x003c, 0x1de0, 0x080c, 0x7f5d, 0x70a0, 0x70a2, 0x7098,
 	0x709a, 0x709c, 0x709e, 0x2001, 0x020d, 0x2003, 0x0020, 0x00f6,
 	0x2079, 0x0300, 0x080c, 0x12c5, 0x7803, 0x0001, 0x00fe, 0x00ee,
 	0x0005, 0x2001, 0x0138, 0x2014, 0x2003, 0x0000, 0x2001, 0x0160,
-	0x202c, 0x2003, 0x0000, 0x080c, 0x6fa7, 0x1108, 0x0005, 0x2021,
+	0x202c, 0x2003, 0x0000, 0x080c, 0x6fb2, 0x1108, 0x0005, 0x2021,
 	0x0260, 0x2001, 0x0141, 0x201c, 0xd3dc, 0x1168, 0x2001, 0x0109,
 	0x201c, 0x939c, 0x0048, 0x1160, 0x2001, 0x0111, 0x201c, 0x83ff,
 	0x1110, 0x8421, 0x1d70, 0x2001, 0x015d, 0x2003, 0x0000, 0x0005,
@@ -725,12 +725,12 @@
 	0x004e, 0x005e, 0x006e, 0x007e, 0x0005, 0x080c, 0x0db4, 0x0026,
 	0x2001, 0x0105, 0x2003, 0x0010, 0x782b, 0x0004, 0x7003, 0x0000,
 	0x7004, 0x0016, 0x080c, 0x1b60, 0x001e, 0x2060, 0x6014, 0x2048,
-	0x080c, 0xbafe, 0x0118, 0xa880, 0xc0bd, 0xa882, 0x6020, 0x9086,
+	0x080c, 0xbb17, 0x0118, 0xa880, 0xc0bd, 0xa882, 0x6020, 0x9086,
 	0x0006, 0x1180, 0x2061, 0x0100, 0x62c8, 0x2001, 0x00fa, 0x8001,
 	0x1df0, 0x60c8, 0x9206, 0x1dc0, 0x60c4, 0xa89a, 0x60c8, 0xa896,
-	0x7004, 0x2060, 0x00c6, 0x080c, 0xb731, 0x00ce, 0x2001, 0x19c7,
+	0x7004, 0x2060, 0x00c6, 0x080c, 0xb74a, 0x00ce, 0x2001, 0x19c7,
 	0x2004, 0x9c06, 0x1160, 0x2009, 0x0040, 0x080c, 0x2268, 0x080c,
-	0x98d1, 0x2011, 0x0000, 0x080c, 0x9762, 0x080c, 0x8a26, 0x002e,
+	0x98ea, 0x2011, 0x0000, 0x080c, 0x977b, 0x080c, 0x8a4e, 0x002e,
 	0x0804, 0x1e8e, 0x0126, 0x2091, 0x2400, 0xa858, 0x2040, 0x792c,
 	0x782b, 0x0002, 0x9184, 0x0700, 0x1904, 0x1d07, 0x7000, 0x0002,
 	0x1e8e, 0x1d5c, 0x1ddc, 0x1e8c, 0x8001, 0x7002, 0x7027, 0x0000,
@@ -774,7 +774,7 @@
 	0x0804, 0x1d7e, 0x0804, 0x1d7a, 0x080c, 0x0db4, 0x012e, 0x0005,
 	0x00f6, 0x00e6, 0x2071, 0x1a36, 0x7000, 0x9086, 0x0000, 0x0904,
 	0x1ed9, 0x2079, 0x0090, 0x2009, 0x0207, 0x210c, 0xd194, 0x01b8,
-	0x2009, 0x020c, 0x210c, 0x9184, 0x0003, 0x0188, 0x080c, 0xd8b5,
+	0x2009, 0x020c, 0x210c, 0x9184, 0x0003, 0x0188, 0x080c, 0xd8d5,
 	0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0db4, 0x0016, 0x2009,
 	0x0040, 0x080c, 0x2268, 0x001e, 0x2001, 0x020c, 0x2102, 0x2009,
 	0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106, 0x1120, 0x2009,
@@ -864,17 +864,17 @@
 	0x2009, 0x013b, 0x200b, 0x0400, 0x781b, 0x0002, 0x783b, 0x001f,
 	0x7837, 0x0020, 0x7803, 0x1600, 0x012e, 0x0005, 0x2091, 0x2600,
 	0x781c, 0xd0a4, 0x190c, 0x2265, 0x7900, 0xd1dc, 0x1118, 0x9084,
-	0x0006, 0x001a, 0x9084, 0x000e, 0x0002, 0x218d, 0x2185, 0x7943,
-	0x2185, 0x2187, 0x2187, 0x2187, 0x2187, 0x7929, 0x2185, 0x2189,
+	0x0006, 0x001a, 0x9084, 0x000e, 0x0002, 0x218d, 0x2185, 0x794e,
+	0x2185, 0x2187, 0x2187, 0x2187, 0x2187, 0x7934, 0x2185, 0x2189,
 	0x2185, 0x2187, 0x2185, 0x2187, 0x2185, 0x080c, 0x0db4, 0x0031,
-	0x0020, 0x080c, 0x7929, 0x080c, 0x7943, 0x0005, 0x0006, 0x0016,
-	0x0026, 0x080c, 0xd8b5, 0x7930, 0x9184, 0x0003, 0x01c0, 0x2001,
+	0x0020, 0x080c, 0x7934, 0x080c, 0x794e, 0x0005, 0x0006, 0x0016,
+	0x0026, 0x080c, 0xd8d5, 0x7930, 0x9184, 0x0003, 0x01c0, 0x2001,
 	0x19c7, 0x2004, 0x9005, 0x0170, 0x2001, 0x0133, 0x2004, 0x9005,
-	0x090c, 0x0db4, 0x00c6, 0x2001, 0x19c7, 0x2064, 0x080c, 0xb731,
+	0x090c, 0x0db4, 0x00c6, 0x2001, 0x19c7, 0x2064, 0x080c, 0xb74a,
 	0x00ce, 0x00f8, 0x2009, 0x0040, 0x080c, 0x2268, 0x00d0, 0x9184,
-	0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160, 0x080c, 0x6fa7,
-	0x1138, 0x080c, 0x728b, 0x080c, 0x5cca, 0x080c, 0x6ed9, 0x0010,
-	0x080c, 0x5b89, 0x080c, 0x79f2, 0x0041, 0x0018, 0x9184, 0x9540,
+	0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160, 0x080c, 0x6fb2,
+	0x1138, 0x080c, 0x7296, 0x080c, 0x5cd1, 0x080c, 0x6ee4, 0x0010,
+	0x080c, 0x5b90, 0x080c, 0x79fd, 0x0041, 0x0018, 0x9184, 0x9540,
 	0x1dc8, 0x002e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x0036, 0x0046,
 	0x0056, 0x2071, 0x1a33, 0x080c, 0x1958, 0x005e, 0x004e, 0x003e,
 	0x00ee, 0x0005, 0x0126, 0x2091, 0x2e00, 0x2071, 0x1800, 0x7128,
@@ -919,96 +919,96 @@
 	0x2003, 0x0001, 0x0005, 0x0126, 0x2091, 0x2800, 0x0006, 0x0016,
 	0x0026, 0x6124, 0x9184, 0x5e2c, 0x1118, 0x9184, 0x0007, 0x002a,
 	0x9195, 0x0004, 0x9284, 0x0007, 0x0002, 0x2347, 0x232d, 0x2330,
-	0x2333, 0x2338, 0x233a, 0x233e, 0x2342, 0x080c, 0x82b5, 0x00b8,
-	0x080c, 0x8382, 0x00a0, 0x080c, 0x8382, 0x080c, 0x82b5, 0x0078,
-	0x0099, 0x0068, 0x080c, 0x82b5, 0x0079, 0x0048, 0x080c, 0x8382,
-	0x0059, 0x0028, 0x080c, 0x8382, 0x080c, 0x82b5, 0x0029, 0x002e,
+	0x2333, 0x2338, 0x233a, 0x233e, 0x2342, 0x080c, 0x82dd, 0x00b8,
+	0x080c, 0x83aa, 0x00a0, 0x080c, 0x83aa, 0x080c, 0x82dd, 0x0078,
+	0x0099, 0x0068, 0x080c, 0x82dd, 0x0079, 0x0048, 0x080c, 0x83aa,
+	0x0059, 0x0028, 0x080c, 0x83aa, 0x080c, 0x82dd, 0x0029, 0x002e,
 	0x001e, 0x000e, 0x012e, 0x0005, 0x00a6, 0x6124, 0x6028, 0xd09c,
 	0x0118, 0xd19c, 0x1904, 0x2595, 0xd1f4, 0x190c, 0x0dad, 0x080c,
-	0x6fa7, 0x0904, 0x23a2, 0x080c, 0xc1f9, 0x1120, 0x7000, 0x9086,
-	0x0003, 0x0570, 0x6024, 0x9084, 0x1800, 0x0550, 0x080c, 0x6fca,
-	0x0118, 0x080c, 0x6fb8, 0x1520, 0x6027, 0x0020, 0x6043, 0x0000,
-	0x080c, 0xc1f9, 0x0168, 0x080c, 0x6fca, 0x1150, 0x2001, 0x1978,
-	0x2003, 0x0001, 0x6027, 0x1800, 0x080c, 0x6e28, 0x0804, 0x2598,
+	0x6fb2, 0x0904, 0x23a2, 0x080c, 0xc212, 0x1120, 0x7000, 0x9086,
+	0x0003, 0x0570, 0x6024, 0x9084, 0x1800, 0x0550, 0x080c, 0x6fd5,
+	0x0118, 0x080c, 0x6fc3, 0x1520, 0x6027, 0x0020, 0x6043, 0x0000,
+	0x080c, 0xc212, 0x0168, 0x080c, 0x6fd5, 0x1150, 0x2001, 0x1978,
+	0x2003, 0x0001, 0x6027, 0x1800, 0x080c, 0x6e33, 0x0804, 0x2598,
 	0x70a0, 0x9005, 0x1150, 0x70a3, 0x0001, 0x00d6, 0x2069, 0x0140,
-	0x080c, 0x6ffe, 0x00de, 0x1904, 0x2598, 0x080c, 0x7295, 0x0428,
-	0x080c, 0x6fca, 0x1590, 0x6024, 0x9084, 0x1800, 0x1108, 0x0468,
-	0x080c, 0x7295, 0x080c, 0x728b, 0x080c, 0x5cca, 0x080c, 0x6ed9,
+	0x080c, 0x7009, 0x00de, 0x1904, 0x2598, 0x080c, 0x72a0, 0x0428,
+	0x080c, 0x6fd5, 0x1590, 0x6024, 0x9084, 0x1800, 0x1108, 0x0468,
+	0x080c, 0x72a0, 0x080c, 0x7296, 0x080c, 0x5cd1, 0x080c, 0x6ee4,
 	0x0804, 0x2595, 0xd1ac, 0x1508, 0x6024, 0xd0dc, 0x1170, 0xd0e4,
 	0x1178, 0xd0d4, 0x1190, 0xd0cc, 0x0130, 0x7094, 0x9086, 0x0028,
-	0x1110, 0x080c, 0x717a, 0x0804, 0x2595, 0x080c, 0x7290, 0x0048,
-	0x2001, 0x194e, 0x2003, 0x0002, 0x0020, 0x080c, 0x70e0, 0x0804,
-	0x2595, 0x080c, 0x7214, 0x0804, 0x2595, 0xd1ac, 0x0904, 0x24b6,
-	0x080c, 0x6fa7, 0x11c0, 0x6027, 0x0020, 0x0006, 0x0026, 0x0036,
-	0x080c, 0x6fc1, 0x1158, 0x080c, 0x728b, 0x080c, 0x5cca, 0x080c,
-	0x6ed9, 0x003e, 0x002e, 0x000e, 0x00ae, 0x0005, 0x003e, 0x002e,
-	0x000e, 0x080c, 0x6f7f, 0x0016, 0x0046, 0x00c6, 0x644c, 0x9486,
+	0x1110, 0x080c, 0x7185, 0x0804, 0x2595, 0x080c, 0x729b, 0x0048,
+	0x2001, 0x194e, 0x2003, 0x0002, 0x0020, 0x080c, 0x70eb, 0x0804,
+	0x2595, 0x080c, 0x721f, 0x0804, 0x2595, 0xd1ac, 0x0904, 0x24b6,
+	0x080c, 0x6fb2, 0x11c0, 0x6027, 0x0020, 0x0006, 0x0026, 0x0036,
+	0x080c, 0x6fcc, 0x1158, 0x080c, 0x7296, 0x080c, 0x5cd1, 0x080c,
+	0x6ee4, 0x003e, 0x002e, 0x000e, 0x00ae, 0x0005, 0x003e, 0x002e,
+	0x000e, 0x080c, 0x6f8a, 0x0016, 0x0046, 0x00c6, 0x644c, 0x9486,
 	0xf0f0, 0x1138, 0x2061, 0x0100, 0x644a, 0x6043, 0x0090, 0x6043,
 	0x0010, 0x74d6, 0x948c, 0xff00, 0x7038, 0xd084, 0x0178, 0x9186,
 	0xf800, 0x1160, 0x7044, 0xd084, 0x1148, 0xc085, 0x7046, 0x0036,
-	0x2418, 0x2011, 0x8016, 0x080c, 0x48d2, 0x003e, 0x080c, 0xc1f2,
+	0x2418, 0x2011, 0x8016, 0x080c, 0x48d9, 0x003e, 0x080c, 0xc20b,
 	0x1904, 0x2493, 0x9196, 0xff00, 0x05a8, 0x705c, 0x9084, 0x00ff,
 	0x810f, 0x81ff, 0x0110, 0x9116, 0x0568, 0x7130, 0xd184, 0x1550,
-	0x080c, 0x312c, 0x0128, 0xc18d, 0x7132, 0x080c, 0x6553, 0x1510,
+	0x080c, 0x3133, 0x0128, 0xc18d, 0x7132, 0x080c, 0x655a, 0x1510,
 	0x6240, 0x9294, 0x0010, 0x0130, 0x6248, 0x9294, 0xff00, 0x9296,
 	0xff00, 0x01c0, 0x7030, 0xd08c, 0x0904, 0x2493, 0x7038, 0xd08c,
 	0x1140, 0x2001, 0x180c, 0x200c, 0xd1ac, 0x1904, 0x2493, 0xc1ad,
-	0x2102, 0x0036, 0x73d4, 0x2011, 0x8013, 0x080c, 0x48d2, 0x003e,
+	0x2102, 0x0036, 0x73d4, 0x2011, 0x8013, 0x080c, 0x48d9, 0x003e,
 	0x0804, 0x2493, 0x7038, 0xd08c, 0x1140, 0x2001, 0x180c, 0x200c,
 	0xd1ac, 0x1904, 0x2493, 0xc1ad, 0x2102, 0x0036, 0x73d4, 0x2011,
-	0x8013, 0x080c, 0x48d2, 0x003e, 0x7130, 0xc185, 0x7132, 0x2011,
+	0x8013, 0x080c, 0x48d9, 0x003e, 0x7130, 0xc185, 0x7132, 0x2011,
 	0x1854, 0x220c, 0x00f0, 0x0016, 0x2009, 0x0001, 0x2011, 0x0100,
-	0x080c, 0x8207, 0x2019, 0x000e, 0x00c6, 0x2061, 0x0000, 0x080c,
-	0xd486, 0x00ce, 0x9484, 0x00ff, 0x9080, 0x3131, 0x200d, 0x918c,
-	0xff00, 0x810f, 0x2120, 0x9006, 0x2009, 0x000e, 0x080c, 0xd50a,
+	0x080c, 0x822f, 0x2019, 0x000e, 0x00c6, 0x2061, 0x0000, 0x080c,
+	0xd4a6, 0x00ce, 0x9484, 0x00ff, 0x9080, 0x3138, 0x200d, 0x918c,
+	0xff00, 0x810f, 0x2120, 0x9006, 0x2009, 0x000e, 0x080c, 0xd52a,
 	0x001e, 0xd1ac, 0x1148, 0x0016, 0x2009, 0x0002, 0x2019, 0x0004,
-	0x080c, 0x2fa2, 0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f,
-	0x900e, 0x080c, 0x6237, 0x1110, 0x080c, 0x5ce4, 0x8108, 0x1f04,
-	0x2489, 0x00be, 0x015e, 0x00ce, 0x004e, 0x080c, 0x9d9f, 0x60e3,
+	0x080c, 0x2fa5, 0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f,
+	0x900e, 0x080c, 0x623e, 0x1110, 0x080c, 0x5ceb, 0x8108, 0x1f04,
+	0x2489, 0x00be, 0x015e, 0x00ce, 0x004e, 0x080c, 0x9db8, 0x60e3,
 	0x0000, 0x001e, 0x2001, 0x1800, 0x2014, 0x9296, 0x0004, 0x1170,
 	0xd19c, 0x11a0, 0x2011, 0x180c, 0x2214, 0xd29c, 0x1120, 0x6204,
 	0x9295, 0x0002, 0x6206, 0x6228, 0xc29d, 0x622a, 0x2003, 0x0001,
 	0x2001, 0x1825, 0x2003, 0x0000, 0x6027, 0x0020, 0xd194, 0x0904,
-	0x2595, 0x0016, 0x6220, 0xd2b4, 0x0904, 0x253e, 0x080c, 0x8090,
-	0x080c, 0x9393, 0x6027, 0x0004, 0x00f6, 0x2019, 0x19c1, 0x2304,
+	0x2595, 0x0016, 0x6220, 0xd2b4, 0x0904, 0x253e, 0x080c, 0x80b8,
+	0x080c, 0x93ac, 0x6027, 0x0004, 0x00f6, 0x2019, 0x19c1, 0x2304,
 	0x907d, 0x0904, 0x250d, 0x7804, 0x9086, 0x0032, 0x15f0, 0x00d6,
 	0x00c6, 0x00e6, 0x0096, 0x2069, 0x0140, 0x782c, 0x685e, 0x7808,
 	0x685a, 0x6043, 0x0002, 0x2001, 0x0003, 0x8001, 0x1df0, 0x6043,
 	0x0000, 0x2001, 0x003c, 0x8001, 0x1df0, 0x080c, 0x2b24, 0x2001,
 	0x001e, 0x8001, 0x0240, 0x20a9, 0x0009, 0x080c, 0x2a3e, 0x6904,
 	0xd1dc, 0x1140, 0x0cb0, 0x2001, 0x0100, 0x080c, 0x2b14, 0x9006,
-	0x080c, 0x2b14, 0x080c, 0x8846, 0x080c, 0x894b, 0x7814, 0x2048,
-	0xa867, 0x0103, 0x2f60, 0x080c, 0x9e19, 0x009e, 0x00ee, 0x00ce,
+	0x080c, 0x2b14, 0x080c, 0x886e, 0x080c, 0x8973, 0x7814, 0x2048,
+	0xa867, 0x0103, 0x2f60, 0x080c, 0x9e32, 0x009e, 0x00ee, 0x00ce,
 	0x00de, 0x00fe, 0x001e, 0x00ae, 0x0005, 0x00fe, 0x00d6, 0x2069,
 	0x0140, 0x6804, 0x9084, 0x4000, 0x0110, 0x080c, 0x2b24, 0x00de,
-	0x00c6, 0x2061, 0x19b8, 0x6028, 0x080c, 0xc1f9, 0x0120, 0x909a,
+	0x00c6, 0x2061, 0x19b8, 0x6028, 0x080c, 0xc212, 0x0120, 0x909a,
 	0x0003, 0x1258, 0x0018, 0x909a, 0x00c8, 0x1238, 0x8000, 0x602a,
-	0x00ce, 0x080c, 0x936f, 0x0804, 0x2594, 0x2061, 0x0100, 0x62c0,
-	0x080c, 0x9c2a, 0x2019, 0x19c1, 0x2304, 0x9065, 0x0120, 0x2009,
-	0x0027, 0x080c, 0x9e93, 0x00ce, 0x0804, 0x2594, 0xd2bc, 0x0904,
-	0x2581, 0x080c, 0x809d, 0x6014, 0x9084, 0x1984, 0x9085, 0x0010,
+	0x00ce, 0x080c, 0x9388, 0x0804, 0x2594, 0x2061, 0x0100, 0x62c0,
+	0x080c, 0x9c43, 0x2019, 0x19c1, 0x2304, 0x9065, 0x0120, 0x2009,
+	0x0027, 0x080c, 0x9eac, 0x00ce, 0x0804, 0x2594, 0xd2bc, 0x0904,
+	0x2581, 0x080c, 0x80c5, 0x6014, 0x9084, 0x1984, 0x9085, 0x0010,
 	0x6016, 0x6027, 0x0004, 0x00d6, 0x2069, 0x0140, 0x6804, 0x9084,
 	0x4000, 0x0110, 0x080c, 0x2b24, 0x00de, 0x00c6, 0x2061, 0x19b8,
-	0x6044, 0x080c, 0xc1f9, 0x0120, 0x909a, 0x0003, 0x1628, 0x0018,
+	0x6044, 0x080c, 0xc212, 0x0120, 0x909a, 0x0003, 0x1628, 0x0018,
 	0x909a, 0x00c8, 0x1608, 0x8000, 0x6046, 0x603c, 0x00ce, 0x9005,
-	0x0558, 0x2009, 0x07d0, 0x080c, 0x8095, 0x9080, 0x0008, 0x2004,
+	0x0558, 0x2009, 0x07d0, 0x080c, 0x80bd, 0x9080, 0x0008, 0x2004,
 	0x9086, 0x0006, 0x1138, 0x6114, 0x918c, 0x1984, 0x918d, 0x0012,
 	0x6116, 0x00d0, 0x6114, 0x918c, 0x1984, 0x918d, 0x0016, 0x6116,
 	0x0098, 0x6027, 0x0004, 0x0080, 0x0036, 0x2019, 0x0001, 0x080c,
-	0x96bf, 0x003e, 0x2019, 0x19c7, 0x2304, 0x9065, 0x0120, 0x2009,
-	0x004f, 0x080c, 0x9e93, 0x00ce, 0x001e, 0xd19c, 0x0904, 0x2607,
+	0x96d8, 0x003e, 0x2019, 0x19c7, 0x2304, 0x9065, 0x0120, 0x2009,
+	0x004f, 0x080c, 0x9eac, 0x00ce, 0x001e, 0xd19c, 0x0904, 0x2607,
 	0x7038, 0xd0ac, 0x1904, 0x25dc, 0x0016, 0x0156, 0x6027, 0x0008,
 	0x6050, 0x9085, 0x0040, 0x6052, 0x6050, 0x9084, 0xfbcf, 0x6052,
 	0x080c, 0x2a5d, 0x9085, 0x2000, 0x6052, 0x20a9, 0x0012, 0x1d04,
-	0x25af, 0x080c, 0x80c4, 0x1f04, 0x25af, 0x6050, 0x9085, 0x0400,
+	0x25af, 0x080c, 0x80ec, 0x1f04, 0x25af, 0x6050, 0x9085, 0x0400,
 	0x9084, 0xdfbf, 0x6052, 0x20a9, 0x0028, 0xa001, 0x1f04, 0x25bd,
 	0x6150, 0x9185, 0x1400, 0x6052, 0x20a9, 0x0366, 0x1d04, 0x25c6,
-	0x080c, 0x80c4, 0x6020, 0xd09c, 0x1130, 0x015e, 0x6152, 0x001e,
+	0x080c, 0x80ec, 0x6020, 0xd09c, 0x1130, 0x015e, 0x6152, 0x001e,
 	0x6027, 0x0008, 0x04a0, 0x080c, 0x2a25, 0x1f04, 0x25c6, 0x015e,
 	0x6152, 0x001e, 0x6027, 0x0008, 0x0016, 0x6028, 0xc09c, 0x602a,
-	0x080c, 0x9d9f, 0x60e3, 0x0000, 0x080c, 0xd894, 0x080c, 0xd8af,
-	0x080c, 0x5383, 0xd0fc, 0x1138, 0x080c, 0xc1f2, 0x1120, 0x9085,
-	0x0001, 0x080c, 0x6fee, 0x9006, 0x080c, 0x2b14, 0x2009, 0x0002,
+	0x080c, 0x9db8, 0x60e3, 0x0000, 0x080c, 0xd8b4, 0x080c, 0xd8cf,
+	0x080c, 0x538a, 0xd0fc, 0x1138, 0x080c, 0xc20b, 0x1120, 0x9085,
+	0x0001, 0x080c, 0x6ff9, 0x9006, 0x080c, 0x2b14, 0x2009, 0x0002,
 	0x080c, 0x2a63, 0x00e6, 0x2071, 0x1800, 0x7003, 0x0004, 0x080c,
 	0x0e80, 0x00ee, 0x6027, 0x0008, 0x080c, 0x0b8f, 0x001e, 0x918c,
 	0xffd0, 0x6126, 0x00ae, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036,
@@ -1016,33 +1016,33 @@
 	0x70ce, 0x9116, 0x0904, 0x265b, 0x81ff, 0x01a0, 0x2009, 0x0000,
 	0x080c, 0x2a63, 0x2011, 0x8011, 0x2019, 0x010e, 0x231c, 0x939e,
 	0x0007, 0x1118, 0x2019, 0x0001, 0x0010, 0x2019, 0x0000, 0x080c,
-	0x48d2, 0x0448, 0x2001, 0x1979, 0x200c, 0x81ff, 0x1140, 0x2001,
+	0x48d9, 0x0448, 0x2001, 0x1979, 0x200c, 0x81ff, 0x1140, 0x2001,
 	0x0109, 0x2004, 0xd0b4, 0x0118, 0x2019, 0x0003, 0x0008, 0x2118,
-	0x2011, 0x8012, 0x080c, 0x48d2, 0x080c, 0x0e80, 0x080c, 0x5383,
-	0xd0fc, 0x1188, 0x080c, 0xc1f2, 0x1170, 0x00c6, 0x080c, 0x26f7,
-	0x080c, 0x9626, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009, 0x0002,
-	0x080c, 0x2fa2, 0x00ce, 0x012e, 0x00fe, 0x00ee, 0x003e, 0x002e,
+	0x2011, 0x8012, 0x080c, 0x48d9, 0x080c, 0x0e80, 0x080c, 0x538a,
+	0xd0fc, 0x1188, 0x080c, 0xc20b, 0x1170, 0x00c6, 0x080c, 0x26f7,
+	0x080c, 0x963f, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009, 0x0002,
+	0x080c, 0x2fa5, 0x00ce, 0x012e, 0x00fe, 0x00ee, 0x003e, 0x002e,
 	0x001e, 0x000e, 0x0005, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094,
 	0xff00, 0x11f0, 0x2011, 0x1836, 0x2214, 0xd2ac, 0x11c8, 0x81ff,
 	0x01e8, 0x2011, 0x181e, 0x2204, 0x9106, 0x1190, 0x2011, 0x181f,
 	0x2214, 0x9294, 0xff00, 0x9584, 0xff00, 0x9206, 0x1148, 0x2011,
 	0x181f, 0x2214, 0x9294, 0x00ff, 0x9584, 0x00ff, 0x9206, 0x1120,
-	0x2500, 0x080c, 0x7c2f, 0x0048, 0x9584, 0x00ff, 0x9080, 0x3131,
-	0x200d, 0x918c, 0xff00, 0x810f, 0x9006, 0x0005, 0x9080, 0x3131,
+	0x2500, 0x080c, 0x7c57, 0x0048, 0x9584, 0x00ff, 0x9080, 0x3138,
+	0x200d, 0x918c, 0xff00, 0x810f, 0x9006, 0x0005, 0x9080, 0x3138,
 	0x200d, 0x918c, 0x00ff, 0x0005, 0x00d6, 0x2069, 0x0140, 0x2001,
 	0x1817, 0x2003, 0x00ef, 0x20a9, 0x0010, 0x9006, 0x6852, 0x6856,
 	0x1f04, 0x26a7, 0x00de, 0x0005, 0x0006, 0x00d6, 0x0026, 0x2069,
 	0x0140, 0x2001, 0x1817, 0x2102, 0x8114, 0x8214, 0x8214, 0x8214,
 	0x20a9, 0x0010, 0x6853, 0x0000, 0x9006, 0x82ff, 0x1128, 0x9184,
-	0x000f, 0x9080, 0xdd69, 0x2005, 0x6856, 0x8211, 0x1f04, 0x26bc,
+	0x000f, 0x9080, 0xdd89, 0x2005, 0x6856, 0x8211, 0x1f04, 0x26bc,
 	0x002e, 0x00de, 0x000e, 0x0005, 0x00c6, 0x2061, 0x1800, 0x6030,
 	0x0110, 0xc09d, 0x0008, 0xc09c, 0x6032, 0x00ce, 0x0005, 0x0156,
 	0x00d6, 0x0026, 0x0016, 0x0006, 0x2069, 0x0140, 0x6980, 0x9116,
 	0x0180, 0x9112, 0x1230, 0x8212, 0x8210, 0x22a8, 0x2001, 0x0402,
 	0x0018, 0x22a8, 0x2001, 0x0404, 0x680e, 0x1f04, 0x26ec, 0x680f,
 	0x0000, 0x000e, 0x001e, 0x002e, 0x00de, 0x015e, 0x0005, 0x080c,
-	0x537f, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046, 0x2020,
-	0x2009, 0x002e, 0x080c, 0xd50a, 0x004e, 0x0005, 0x00f6, 0x0016,
+	0x5386, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046, 0x2020,
+	0x2009, 0x002e, 0x080c, 0xd52a, 0x004e, 0x0005, 0x00f6, 0x0016,
 	0x0026, 0x2079, 0x0140, 0x78c4, 0xd0dc, 0x0904, 0x2763, 0x080c,
 	0x29c2, 0x0660, 0x9084, 0x0700, 0x908e, 0x0600, 0x1120, 0x2011,
 	0x4000, 0x900e, 0x0458, 0x908e, 0x0500, 0x1120, 0x2011, 0x8000,
@@ -1051,9 +1051,9 @@
 	0x908e, 0x0200, 0x1120, 0x9016, 0x2009, 0x0004, 0x0078, 0x908e,
 	0x0100, 0x1548, 0x9016, 0x2009, 0x0008, 0x0040, 0x9084, 0x0700,
 	0x908e, 0x0300, 0x1500, 0x2011, 0x0030, 0x0058, 0x2300, 0x9080,
-	0x0020, 0x2018, 0x080c, 0x8248, 0x928c, 0xff00, 0x0110, 0x2011,
+	0x0020, 0x2018, 0x080c, 0x8270, 0x928c, 0xff00, 0x0110, 0x2011,
 	0x00ff, 0x2200, 0x8007, 0x9085, 0x004c, 0x78c2, 0x2009, 0x0138,
-	0x220a, 0x080c, 0x6fa7, 0x1118, 0x2009, 0x193e, 0x220a, 0x002e,
+	0x220a, 0x080c, 0x6fb2, 0x1118, 0x2009, 0x193e, 0x220a, 0x002e,
 	0x001e, 0x00fe, 0x0005, 0x78c3, 0x0000, 0x0cc8, 0x0126, 0x2091,
 	0x2800, 0x0006, 0x0016, 0x0026, 0x2001, 0x0170, 0x200c, 0x8000,
 	0x2014, 0x9184, 0x0003, 0x0110, 0x080c, 0x0dad, 0x002e, 0x001e,
@@ -1069,17 +1069,17 @@
 	0x2832, 0x2001, 0x0001, 0x080c, 0x260c, 0x080c, 0x2a20, 0x2001,
 	0x1963, 0x2003, 0x0000, 0x7828, 0x9084, 0xe1d7, 0x782a, 0x9006,
 	0x20a9, 0x0009, 0x080c, 0x29de, 0x2001, 0x1961, 0x2003, 0x0006,
-	0x2009, 0x001e, 0x2011, 0x2833, 0x080c, 0x80a2, 0x0005, 0x2009,
+	0x2009, 0x001e, 0x2011, 0x2833, 0x080c, 0x80ca, 0x0005, 0x2009,
 	0x1966, 0x200b, 0x0000, 0x2001, 0x196b, 0x2003, 0x0036, 0x2001,
 	0x196a, 0x2003, 0x002a, 0x2001, 0x1963, 0x2003, 0x0001, 0x9006,
 	0x080c, 0x2990, 0x2001, 0xffff, 0x20a9, 0x0009, 0x080c, 0x29de,
 	0x2001, 0x1961, 0x2003, 0x0006, 0x2009, 0x001e, 0x2011, 0x2833,
-	0x080c, 0x80a2, 0x0005, 0x080c, 0x0db4, 0x2001, 0x196b, 0x2003,
+	0x080c, 0x80ca, 0x0005, 0x080c, 0x0db4, 0x2001, 0x196b, 0x2003,
 	0x0036, 0x2001, 0x1963, 0x2003, 0x0003, 0x7a38, 0x9294, 0x0005,
 	0x9296, 0x0004, 0x0110, 0x9006, 0x0010, 0x2001, 0x0001, 0x080c,
 	0x2990, 0x2001, 0x1967, 0x2003, 0x0000, 0x2001, 0xffff, 0x20a9,
 	0x0009, 0x080c, 0x29de, 0x2001, 0x1961, 0x2003, 0x0006, 0x2009,
-	0x001e, 0x2011, 0x2833, 0x080c, 0x80a2, 0x0005, 0x080c, 0x0db4,
+	0x001e, 0x2011, 0x2833, 0x080c, 0x80ca, 0x0005, 0x080c, 0x0db4,
 	0x080c, 0x0db4, 0x0005, 0x0006, 0x0016, 0x0026, 0x00e6, 0x00f6,
 	0x0156, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100, 0x2001, 0x1963,
 	0x2004, 0x908a, 0x0007, 0x1a0c, 0x0db4, 0x0043, 0x012e, 0x015e,
@@ -1139,14 +1139,14 @@
 	0x000e, 0x2008, 0x9186, 0x0000, 0x1118, 0x783b, 0x0007, 0x0090,
 	0x9186, 0x0001, 0x1118, 0x783b, 0x0006, 0x0060, 0x9186, 0x0002,
 	0x1118, 0x783b, 0x0005, 0x0030, 0x9186, 0x0003, 0x1118, 0x783b,
-	0x0004, 0x0000, 0x0006, 0x1d04, 0x2a0b, 0x080c, 0x80c4, 0x1f04,
+	0x0004, 0x0000, 0x0006, 0x1d04, 0x2a0b, 0x080c, 0x80ec, 0x1f04,
 	0x2a0b, 0x7850, 0x9085, 0x0400, 0x9084, 0xdfbf, 0x7852, 0x080c,
 	0x2a5d, 0x9085, 0x1000, 0x7852, 0x000e, 0x001e, 0x012e, 0x0005,
 	0x7850, 0x9084, 0xffcf, 0x7852, 0x0005, 0x0006, 0x0156, 0x00f6,
 	0x2079, 0x0100, 0x20a9, 0x000a, 0x7854, 0xd0ac, 0x1130, 0x7820,
 	0xd0e4, 0x1140, 0x1f04, 0x2a2f, 0x0028, 0x7854, 0xd08c, 0x1110,
 	0x1f04, 0x2a35, 0x00fe, 0x015e, 0x000e, 0x0005, 0x1d04, 0x2a3e,
-	0x080c, 0x80c4, 0x1f04, 0x2a3e, 0x0005, 0x0006, 0x2001, 0x196d,
+	0x080c, 0x80ec, 0x1f04, 0x2a3e, 0x0005, 0x0006, 0x2001, 0x196d,
 	0x2004, 0x9086, 0x0000, 0x000e, 0x0005, 0x0006, 0x2001, 0x196d,
 	0x2004, 0x9086, 0x0001, 0x000e, 0x0005, 0x0006, 0x2001, 0x196d,
 	0x2004, 0x9086, 0x0002, 0x000e, 0x0005, 0xa001, 0xa001, 0xa001,
@@ -1172,13 +1172,13 @@
 	0x1120, 0x2304, 0x9084, 0x2800, 0x0dc0, 0x001e, 0x919c, 0xffe4,
 	0x9184, 0x0001, 0x0118, 0x9385, 0x0009, 0x6016, 0x9184, 0x0002,
 	0x0118, 0x9385, 0x0012, 0x6016, 0x003e, 0x2001, 0x180c, 0x200c,
-	0xc1dc, 0x2102, 0x00ce, 0x0005, 0x0016, 0x0026, 0x080c, 0x6fc1,
+	0xc1dc, 0x2102, 0x00ce, 0x0005, 0x0016, 0x0026, 0x080c, 0x6fcc,
 	0x0108, 0xc0bc, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001, 0x9215,
 	0x220a, 0x002e, 0x001e, 0x0005, 0x0016, 0x0026, 0x2009, 0x0140,
 	0x2114, 0x9294, 0x0001, 0x9285, 0x1000, 0x200a, 0x220a, 0x002e,
 	0x001e, 0x0005, 0x0016, 0x0026, 0x2009, 0x0140, 0x2114, 0x9294,
 	0x0001, 0x9215, 0x220a, 0x002e, 0x001e, 0x0005, 0x0006, 0x0016,
-	0x2009, 0x0140, 0x2104, 0x1128, 0x080c, 0x6fc1, 0x0110, 0xc0bc,
+	0x2009, 0x0140, 0x2104, 0x1128, 0x080c, 0x6fcc, 0x0110, 0xc0bc,
 	0x0008, 0xc0bd, 0x200a, 0x001e, 0x000e, 0x0005, 0x2dba, 0x2dba,
 	0x2bde, 0x2bde, 0x2bea, 0x2bea, 0x2bf6, 0x2bf6, 0x2c04, 0x2c04,
 	0x2c10, 0x2c10, 0x2c1e, 0x2c1e, 0x2c2c, 0x2c2c, 0x2c3e, 0x2c3e,
@@ -1258,2610 +1258,2615 @@
 	0x2766, 0x080c, 0x212b, 0x080c, 0x2313, 0x080c, 0x130c, 0x080c,
 	0x2166, 0x0000, 0x015e, 0x014e, 0x013e, 0x01de, 0x01ce, 0x012e,
 	0x000e, 0x010e, 0x000d, 0x00b6, 0x00c6, 0x0026, 0x0046, 0x9026,
-	0x080c, 0x6519, 0x1904, 0x2ebe, 0x72d8, 0x2001, 0x194d, 0x2004,
+	0x080c, 0x6520, 0x1904, 0x2ec1, 0x72d8, 0x2001, 0x194d, 0x2004,
 	0x9005, 0x1110, 0xd29c, 0x0148, 0xd284, 0x1138, 0xd2bc, 0x1904,
-	0x2ebe, 0x080c, 0x2ec3, 0x0804, 0x2ebe, 0xd2cc, 0x1904, 0x2ebe,
-	0x080c, 0x6fa7, 0x1120, 0x70ab, 0xffff, 0x0804, 0x2ebe, 0xd294,
-	0x0120, 0x70ab, 0xffff, 0x0804, 0x2ebe, 0x080c, 0x3127, 0x0160,
-	0x080c, 0xc1f9, 0x0128, 0x2001, 0x1817, 0x203c, 0x0804, 0x2e50,
-	0x70ab, 0xffff, 0x0804, 0x2ebe, 0x2001, 0x1817, 0x203c, 0x7290,
-	0xd284, 0x0904, 0x2e50, 0xd28c, 0x1904, 0x2e50, 0x0036, 0x73a8,
+	0x2ec1, 0x080c, 0x2ec6, 0x0804, 0x2ec1, 0xd2cc, 0x1904, 0x2ec1,
+	0x080c, 0x6fb2, 0x1120, 0x70ab, 0xffff, 0x0804, 0x2ec1, 0xd294,
+	0x0120, 0x70ab, 0xffff, 0x0804, 0x2ec1, 0x080c, 0x312e, 0x0160,
+	0x080c, 0xc212, 0x0128, 0x2001, 0x1817, 0x203c, 0x0804, 0x2e53,
+	0x70ab, 0xffff, 0x0804, 0x2ec1, 0x2001, 0x1817, 0x203c, 0x7290,
+	0xd284, 0x0904, 0x2e53, 0xd28c, 0x1904, 0x2e53, 0x0036, 0x73a8,
 	0x938e, 0xffff, 0x1110, 0x2019, 0x0001, 0x8314, 0x92e0, 0x1c80,
 	0x2c04, 0x938c, 0x0001, 0x0120, 0x9084, 0xff00, 0x8007, 0x0010,
-	0x9084, 0x00ff, 0x970e, 0x0590, 0x908e, 0x0000, 0x0578, 0x908e,
-	0x00ff, 0x1150, 0x7230, 0xd284, 0x1570, 0x7290, 0xc28d, 0x7292,
-	0x70ab, 0xffff, 0x003e, 0x0460, 0x0026, 0x2011, 0x0010, 0x080c,
-	0x657f, 0x002e, 0x0118, 0x70ab, 0xffff, 0x00f8, 0x900e, 0x080c,
-	0x2663, 0x080c, 0x61d7, 0x11a8, 0x080c, 0x655b, 0x1150, 0x7030,
-	0xd08c, 0x0118, 0xb800, 0xd0bc, 0x0120, 0x080c, 0x2edc, 0x0148,
-	0x0028, 0x080c, 0x3018, 0x080c, 0x2f08, 0x0118, 0x8318, 0x0804,
-	0x2e05, 0x73aa, 0x0010, 0x70ab, 0xffff, 0x003e, 0x0804, 0x2ebe,
-	0x9780, 0x3131, 0x203d, 0x97bc, 0xff00, 0x873f, 0x2041, 0x007e,
-	0x70a8, 0x9096, 0xffff, 0x1118, 0x900e, 0x28a8, 0x0050, 0x9812,
-	0x0220, 0x2008, 0x9802, 0x20a8, 0x0020, 0x70ab, 0xffff, 0x0804,
-	0x2ebe, 0x2700, 0x0156, 0x0016, 0x9106, 0x0904, 0x2eb3, 0x0026,
-	0x2011, 0x0010, 0x080c, 0x657f, 0x002e, 0x0120, 0x2009, 0xffff,
-	0x0804, 0x2ebb, 0xc484, 0x080c, 0x6237, 0x0138, 0x080c, 0xc1f9,
-	0x1590, 0x080c, 0x61d7, 0x15b8, 0x0008, 0xc485, 0x080c, 0x655b,
-	0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800, 0xd0bc, 0x11e0, 0x7290,
-	0xd28c, 0x0180, 0x080c, 0x655b, 0x9082, 0x0006, 0x02e0, 0xd484,
-	0x1118, 0x080c, 0x61fb, 0x0028, 0x080c, 0x30a3, 0x01a0, 0x080c,
-	0x30ce, 0x0088, 0x080c, 0x3018, 0x080c, 0xc1f9, 0x1160, 0x080c,
-	0x2f08, 0x0188, 0x0040, 0x080c, 0xc1f9, 0x1118, 0x080c, 0x30a3,
-	0x0110, 0x0451, 0x0140, 0x001e, 0x8108, 0x015e, 0x1f04, 0x2e69,
-	0x70ab, 0xffff, 0x0018, 0x001e, 0x015e, 0x71aa, 0x004e, 0x002e,
-	0x00ce, 0x00be, 0x0005, 0x00c6, 0x0016, 0x70ab, 0x0001, 0x2009,
-	0x007e, 0x080c, 0x61d7, 0x1168, 0xb813, 0x00ff, 0xb817, 0xfffe,
-	0x080c, 0x3018, 0x04a9, 0x0128, 0x70d8, 0xc0bd, 0x70da, 0x080c,
-	0xbf4a, 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6,
-	0x2001, 0x1858, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c, 0x9e66,
-	0x01d0, 0x2b00, 0x6012, 0x080c, 0xbf73, 0x6023, 0x0001, 0x9006,
-	0x080c, 0x6174, 0x2001, 0x0000, 0x080c, 0x6188, 0x0126, 0x2091,
-	0x8000, 0x70a4, 0x8000, 0x70a6, 0x012e, 0x2009, 0x0004, 0x080c,
-	0x9e93, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005,
-	0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001, 0x1858, 0x2004, 0x9084,
-	0x00ff, 0xb842, 0x080c, 0x9e66, 0x0548, 0x2b00, 0x6012, 0xb800,
-	0xc0c4, 0xb802, 0xb8a0, 0x9086, 0x007e, 0x0140, 0xb804, 0x9084,
-	0x00ff, 0x9086, 0x0006, 0x1110, 0x080c, 0x2fd7, 0x080c, 0xbf73,
-	0x6023, 0x0001, 0x9006, 0x080c, 0x6174, 0x2001, 0x0002, 0x080c,
-	0x6188, 0x0126, 0x2091, 0x8000, 0x70a4, 0x8000, 0x70a6, 0x012e,
-	0x2009, 0x0002, 0x080c, 0x9e93, 0x9085, 0x0001, 0x00ce, 0x00de,
-	0x007e, 0x001e, 0x0005, 0x00b6, 0x00c6, 0x0026, 0x2009, 0x0080,
-	0x080c, 0x61d7, 0x1140, 0xb813, 0x00ff, 0xb817, 0xfffc, 0x0039,
-	0x0110, 0x70df, 0xffff, 0x002e, 0x00ce, 0x00be, 0x0005, 0x0016,
-	0x0076, 0x00d6, 0x00c6, 0x080c, 0x9dc3, 0x01d0, 0x2b00, 0x6012,
-	0x080c, 0xbf73, 0x6023, 0x0001, 0x9006, 0x080c, 0x6174, 0x2001,
-	0x0002, 0x080c, 0x6188, 0x0126, 0x2091, 0x8000, 0x70e0, 0x8000,
-	0x70e2, 0x012e, 0x2009, 0x0002, 0x080c, 0x9e93, 0x9085, 0x0001,
-	0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00c6, 0x00d6, 0x0126,
-	0x2091, 0x8000, 0x2009, 0x007f, 0x080c, 0x61d7, 0x11b8, 0xb813,
-	0x00ff, 0xb817, 0xfffd, 0xb8bf, 0x0004, 0x080c, 0x9dc3, 0x0170,
-	0x2b00, 0x6012, 0x6316, 0x6023, 0x0001, 0x620a, 0x080c, 0xbf73,
-	0x2009, 0x0022, 0x080c, 0x9e93, 0x9085, 0x0001, 0x012e, 0x00de,
-	0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066, 0x0036, 0x0026, 0x00b6,
-	0x21f0, 0x080c, 0x8554, 0x080c, 0x84e3, 0x080c, 0x9c71, 0x080c,
-	0xad5e, 0x3e08, 0x2130, 0x81ff, 0x0120, 0x20a9, 0x007e, 0x900e,
-	0x0018, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6237, 0x1140,
-	0x9686, 0x0002, 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c, 0x5ce4,
-	0x001e, 0x8108, 0x1f04, 0x2fbc, 0x9686, 0x0001, 0x190c, 0x30fb,
-	0x00be, 0x002e, 0x003e, 0x006e, 0x00ce, 0x00ee, 0x0005, 0x00e6,
-	0x00c6, 0x0036, 0x0026, 0x0016, 0x00b6, 0x6210, 0x2258, 0xbaa0,
-	0x0026, 0x2019, 0x0029, 0x080c, 0x8549, 0x0076, 0x2039, 0x0000,
-	0x080c, 0x8441, 0x2c08, 0x080c, 0xd27b, 0x007e, 0x001e, 0xba10,
-	0xbb14, 0x080c, 0x5ce4, 0xba12, 0xbb16, 0x00be, 0x001e, 0x002e,
-	0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x00b6, 0x6010,
-	0x2058, 0xb8a0, 0x00be, 0x9086, 0x0080, 0x0150, 0x2071, 0x1800,
-	0x70a4, 0x9005, 0x0110, 0x8001, 0x70a6, 0x000e, 0x00ee, 0x0005,
-	0x2071, 0x1800, 0x70e0, 0x9005, 0x0dc0, 0x8001, 0x70e2, 0x0ca8,
-	0xb800, 0xc08c, 0xb802, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x00b6,
+	0x9084, 0x00ff, 0x970e, 0x05a8, 0x908e, 0x0000, 0x0590, 0x908e,
+	0x00ff, 0x1150, 0x7230, 0xd284, 0x1588, 0x7290, 0xc28d, 0x7292,
+	0x70ab, 0xffff, 0x003e, 0x0478, 0x0026, 0x2011, 0x0010, 0x080c,
+	0x6586, 0x002e, 0x0118, 0x70ab, 0xffff, 0x0410, 0x900e, 0x080c,
+	0x2663, 0x080c, 0x61de, 0x11c0, 0x080c, 0x6562, 0x1168, 0x7030,
+	0xd08c, 0x0130, 0xb800, 0xd0bc, 0x0138, 0x080c, 0x645e, 0x0120,
+	0x080c, 0x2edf, 0x0148, 0x0028, 0x080c, 0x301f, 0x080c, 0x2f0b,
+	0x0118, 0x8318, 0x0804, 0x2e05, 0x73aa, 0x0010, 0x70ab, 0xffff,
+	0x003e, 0x0804, 0x2ec1, 0x9780, 0x3138, 0x203d, 0x97bc, 0xff00,
+	0x873f, 0x2041, 0x007e, 0x70a8, 0x9096, 0xffff, 0x1118, 0x900e,
+	0x28a8, 0x0050, 0x9812, 0x0220, 0x2008, 0x9802, 0x20a8, 0x0020,
+	0x70ab, 0xffff, 0x0804, 0x2ec1, 0x2700, 0x0156, 0x0016, 0x9106,
+	0x0904, 0x2eb6, 0x0026, 0x2011, 0x0010, 0x080c, 0x6586, 0x002e,
+	0x0120, 0x2009, 0xffff, 0x0804, 0x2ebe, 0xc484, 0x080c, 0x623e,
+	0x0138, 0x080c, 0xc212, 0x1590, 0x080c, 0x61de, 0x15b8, 0x0008,
+	0xc485, 0x080c, 0x6562, 0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800,
+	0xd0bc, 0x11e0, 0x7290, 0xd28c, 0x0180, 0x080c, 0x6562, 0x9082,
+	0x0006, 0x02e0, 0xd484, 0x1118, 0x080c, 0x6202, 0x0028, 0x080c,
+	0x30aa, 0x01a0, 0x080c, 0x30d5, 0x0088, 0x080c, 0x301f, 0x080c,
+	0xc212, 0x1160, 0x080c, 0x2f0b, 0x0188, 0x0040, 0x080c, 0xc212,
+	0x1118, 0x080c, 0x30aa, 0x0110, 0x0451, 0x0140, 0x001e, 0x8108,
+	0x015e, 0x1f04, 0x2e6c, 0x70ab, 0xffff, 0x0018, 0x001e, 0x015e,
+	0x71aa, 0x004e, 0x002e, 0x00ce, 0x00be, 0x0005, 0x00c6, 0x0016,
+	0x70ab, 0x0001, 0x2009, 0x007e, 0x080c, 0x61de, 0x1168, 0xb813,
+	0x00ff, 0xb817, 0xfffe, 0x080c, 0x301f, 0x04a9, 0x0128, 0x70d8,
+	0xc0bd, 0x70da, 0x080c, 0xbf63, 0x001e, 0x00ce, 0x0005, 0x0016,
+	0x0076, 0x00d6, 0x00c6, 0x2001, 0x1858, 0x2004, 0x9084, 0x00ff,
+	0xb842, 0x080c, 0x9e7f, 0x01d0, 0x2b00, 0x6012, 0x080c, 0xbf8c,
+	0x6023, 0x0001, 0x9006, 0x080c, 0x617b, 0x2001, 0x0000, 0x080c,
+	0x618f, 0x0126, 0x2091, 0x8000, 0x70a4, 0x8000, 0x70a6, 0x012e,
+	0x2009, 0x0004, 0x080c, 0x9eac, 0x9085, 0x0001, 0x00ce, 0x00de,
+	0x007e, 0x001e, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001,
+	0x1858, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c, 0x9e7f, 0x0548,
+	0x2b00, 0x6012, 0xb800, 0xc0c4, 0xb802, 0xb8a0, 0x9086, 0x007e,
+	0x0140, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1110, 0x080c,
+	0x2fda, 0x080c, 0xbf8c, 0x6023, 0x0001, 0x9006, 0x080c, 0x617b,
+	0x2001, 0x0002, 0x080c, 0x618f, 0x0126, 0x2091, 0x8000, 0x70a4,
+	0x8000, 0x70a6, 0x012e, 0x2009, 0x0002, 0x080c, 0x9eac, 0x9085,
+	0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00b6, 0x00c6,
+	0x0026, 0x2009, 0x0080, 0x080c, 0x61de, 0x1140, 0xb813, 0x00ff,
+	0xb817, 0xfffc, 0x0039, 0x0110, 0x70df, 0xffff, 0x002e, 0x00ce,
+	0x00be, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x080c, 0x9ddc,
+	0x01d0, 0x2b00, 0x6012, 0x080c, 0xbf8c, 0x6023, 0x0001, 0x9006,
+	0x080c, 0x617b, 0x2001, 0x0002, 0x080c, 0x618f, 0x0126, 0x2091,
+	0x8000, 0x70e0, 0x8000, 0x70e2, 0x012e, 0x2009, 0x0002, 0x080c,
+	0x9eac, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005,
+	0x00c6, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2009, 0x007f, 0x080c,
+	0x61de, 0x11b8, 0xb813, 0x00ff, 0xb817, 0xfffd, 0xb8bf, 0x0004,
+	0x080c, 0x9ddc, 0x0170, 0x2b00, 0x6012, 0x6316, 0x6023, 0x0001,
+	0x620a, 0x080c, 0xbf8c, 0x2009, 0x0022, 0x080c, 0x9eac, 0x9085,
+	0x0001, 0x012e, 0x00de, 0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066,
+	0x0036, 0x0026, 0x00b6, 0x21f0, 0x080c, 0x857c, 0x080c, 0x850b,
+	0x080c, 0x9c8a, 0x080c, 0xad77, 0x3e08, 0x2130, 0x81ff, 0x0120,
+	0x20a9, 0x007e, 0x900e, 0x0018, 0x20a9, 0x007f, 0x900e, 0x0016,
+	0x080c, 0x623e, 0x1140, 0x9686, 0x0002, 0x1118, 0xb800, 0xd0bc,
+	0x1110, 0x080c, 0x5ceb, 0x001e, 0x8108, 0x1f04, 0x2fbf, 0x9686,
+	0x0001, 0x190c, 0x3102, 0x00be, 0x002e, 0x003e, 0x006e, 0x00ce,
+	0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0046, 0x0036, 0x0026, 0x0016,
+	0x00b6, 0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c,
+	0x8571, 0x0076, 0x2039, 0x0000, 0x080c, 0x8469, 0x2c08, 0x080c,
+	0xd29b, 0x007e, 0x001e, 0xba10, 0xbb14, 0xbcb0, 0x080c, 0x5ceb,
+	0xba12, 0xbb16, 0xbcb2, 0x00be, 0x001e, 0x002e, 0x003e, 0x004e,
+	0x00ce, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x00b6, 0x6010, 0x2058,
+	0xb8a0, 0x00be, 0x9086, 0x0080, 0x0150, 0x2071, 0x1800, 0x70a4,
+	0x9005, 0x0110, 0x8001, 0x70a6, 0x000e, 0x00ee, 0x0005, 0x2071,
+	0x1800, 0x70e0, 0x9005, 0x0dc0, 0x8001, 0x70e2, 0x0ca8, 0xb800,
+	0xc08c, 0xb802, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x00b6, 0x0046,
 	0x0036, 0x0026, 0x0016, 0x0156, 0x2178, 0x81ff, 0x1118, 0x20a9,
-	0x0001, 0x0080, 0x080c, 0x537f, 0xd0c4, 0x0148, 0x0040, 0x9006,
-	0x0046, 0x2020, 0x2009, 0x002d, 0x080c, 0xd50a, 0x004e, 0x20a9,
-	0x0800, 0x9016, 0x0026, 0x928e, 0x007e, 0x0904, 0x3083, 0x928e,
-	0x007f, 0x0904, 0x3083, 0x928e, 0x0080, 0x05e8, 0x9288, 0x1000,
-	0x210c, 0x81ff, 0x05c0, 0x8fff, 0x1148, 0x2001, 0x195f, 0x0006,
-	0x2003, 0x0001, 0x04e9, 0x000e, 0x2003, 0x0000, 0x00b6, 0x00c6,
-	0x2158, 0x2001, 0x0001, 0x080c, 0x6525, 0x00ce, 0x00be, 0x2019,
-	0x0029, 0x080c, 0x8549, 0x0076, 0x2039, 0x0000, 0x080c, 0x8441,
-	0x00b6, 0x00c6, 0x0026, 0x2158, 0xba04, 0x9294, 0x00ff, 0x9286,
-	0x0006, 0x1118, 0xb807, 0x0404, 0x0028, 0x2001, 0x0004, 0x8007,
-	0x9215, 0xba06, 0x002e, 0x00ce, 0x00be, 0x0016, 0x2c08, 0x080c,
-	0xd27b, 0x001e, 0x007e, 0x002e, 0x8210, 0x1f04, 0x303a, 0x015e,
-	0x001e, 0x002e, 0x003e, 0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005,
-	0x0046, 0x0026, 0x0016, 0x080c, 0x537f, 0xd0c4, 0x0140, 0xd0a4,
-	0x0130, 0x9006, 0x2220, 0x2009, 0x0029, 0x080c, 0xd50a, 0x001e,
-	0x002e, 0x004e, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x7290,
-	0x82ff, 0x01e8, 0x080c, 0x6553, 0x11d0, 0x2100, 0x080c, 0x2696,
-	0x81ff, 0x01b8, 0x2019, 0x0001, 0x8314, 0x92e0, 0x1c80, 0x2c04,
-	0xd384, 0x0120, 0x9084, 0xff00, 0x8007, 0x0010, 0x9084, 0x00ff,
-	0x9116, 0x0138, 0x9096, 0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085,
-	0x0001, 0x00ce, 0x003e, 0x002e, 0x001e, 0x0005, 0x0016, 0x00c6,
-	0x0126, 0x2091, 0x8000, 0x0036, 0x2019, 0x0029, 0x00a9, 0x003e,
-	0x9180, 0x1000, 0x2004, 0x9065, 0x0158, 0x0016, 0x00c6, 0x2061,
-	0x1a80, 0x001e, 0x6112, 0x080c, 0x2fd7, 0x001e, 0x080c, 0x61fb,
-	0x012e, 0x00ce, 0x001e, 0x0005, 0x0016, 0x0026, 0x2110, 0x080c,
-	0x990d, 0x080c, 0xd7c2, 0x002e, 0x001e, 0x0005, 0x2001, 0x1836,
-	0x2004, 0xd0cc, 0x0005, 0x00c6, 0x00b6, 0x080c, 0x6fa7, 0x1118,
-	0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782, 0x080c, 0x6fa7, 0x1110,
-	0x900e, 0x0010, 0x2009, 0x007e, 0x9180, 0x1000, 0x2004, 0x905d,
-	0x0130, 0x86ff, 0x0110, 0xb800, 0xd0bc, 0x090c, 0x61fb, 0x8108,
-	0x1f04, 0x310c, 0x2061, 0x1800, 0x607b, 0x0000, 0x607c, 0x9084,
-	0x00ff, 0x607e, 0x60af, 0x0000, 0x00be, 0x00ce, 0x0005, 0x2001,
-	0x1875, 0x2004, 0xd0bc, 0x0005, 0x2011, 0x1854, 0x2214, 0xd2ec,
-	0x0005, 0x7eef, 0x7de8, 0x7ce4, 0x80e2, 0x7be1, 0x80e0, 0x80dc,
-	0x80da, 0x7ad9, 0x80d6, 0x80d5, 0x80d4, 0x80d3, 0x80d2, 0x80d1,
-	0x79ce, 0x78cd, 0x80cc, 0x80cb, 0x80ca, 0x80c9, 0x80c7, 0x80c6,
-	0x77c5, 0x76c3, 0x80bc, 0x80ba, 0x75b9, 0x80b6, 0x74b5, 0x73b4,
-	0x72b3, 0x80b2, 0x80b1, 0x80ae, 0x71ad, 0x80ac, 0x70ab, 0x6faa,
-	0x6ea9, 0x80a7, 0x6da6, 0x6ca5, 0x6ba3, 0x6a9f, 0x699e, 0x689d,
-	0x809b, 0x8098, 0x6797, 0x6690, 0x658f, 0x6488, 0x6384, 0x6282,
-	0x8081, 0x8080, 0x617c, 0x607a, 0x8079, 0x5f76, 0x8075, 0x8074,
-	0x8073, 0x8072, 0x8071, 0x806e, 0x5e6d, 0x806c, 0x5d6b, 0x5c6a,
-	0x5b69, 0x8067, 0x5a66, 0x5965, 0x5863, 0x575c, 0x565a, 0x5559,
-	0x8056, 0x8055, 0x5454, 0x5353, 0x5252, 0x5151, 0x504e, 0x4f4d,
-	0x804c, 0x804b, 0x4e4a, 0x4d49, 0x8047, 0x4c46, 0x8045, 0x8043,
-	0x803c, 0x803a, 0x8039, 0x8036, 0x4b35, 0x8034, 0x4a33, 0x4932,
-	0x4831, 0x802e, 0x472d, 0x462c, 0x452b, 0x442a, 0x4329, 0x4227,
-	0x8026, 0x8025, 0x4123, 0x401f, 0x3f1e, 0x3e1d, 0x3d1b, 0x3c18,
-	0x8017, 0x8010, 0x3b0f, 0x3a08, 0x8004, 0x3902, 0x8001, 0x8000,
-	0x8000, 0x3800, 0x3700, 0x3600, 0x8000, 0x3500, 0x8000, 0x8000,
-	0x8000, 0x3400, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x3300, 0x3200, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x3100, 0x3000, 0x8000, 0x8000, 0x2f00, 0x8000, 0x2e00, 0x2d00,
-	0x2c00, 0x8000, 0x8000, 0x8000, 0x2b00, 0x8000, 0x2a00, 0x2900,
-	0x2800, 0x8000, 0x2700, 0x2600, 0x2500, 0x2400, 0x2300, 0x2200,
-	0x8000, 0x8000, 0x2100, 0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00,
-	0x8000, 0x8000, 0x1b00, 0x1a00, 0x8000, 0x1900, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x1800, 0x8000, 0x1700, 0x1600,
-	0x1500, 0x8000, 0x1400, 0x1300, 0x1200, 0x1100, 0x1000, 0x0f00,
-	0x8000, 0x8000, 0x0e00, 0x0d00, 0x0c00, 0x0b00, 0x0a00, 0x0900,
-	0x8000, 0x8000, 0x0800, 0x0700, 0x8000, 0x0600, 0x8000, 0x8000,
-	0x8000, 0x0500, 0x0400, 0x0300, 0x8000, 0x0200, 0x8000, 0x8000,
-	0x8000, 0x0100, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x0000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
+	0x0001, 0x0070, 0x080c, 0x5386, 0xd0c4, 0x0138, 0x0030, 0x9006,
+	0x2020, 0x2009, 0x002d, 0x080c, 0xd52a, 0x20a9, 0x0800, 0x9016,
+	0x0026, 0x928e, 0x007e, 0x0904, 0x3089, 0x928e, 0x007f, 0x0904,
+	0x3089, 0x928e, 0x0080, 0x05e8, 0x9288, 0x1000, 0x210c, 0x81ff,
+	0x05c0, 0x8fff, 0x1148, 0x2001, 0x195f, 0x0006, 0x2003, 0x0001,
+	0x04f1, 0x000e, 0x2003, 0x0000, 0x00b6, 0x00c6, 0x2158, 0x2001,
+	0x0001, 0x080c, 0x652c, 0x00ce, 0x00be, 0x2019, 0x0029, 0x080c,
+	0x8571, 0x0076, 0x2039, 0x0000, 0x080c, 0x8469, 0x00b6, 0x00c6,
+	0x0026, 0x2158, 0xba04, 0x9294, 0x00ff, 0x9286, 0x0006, 0x1118,
+	0xb807, 0x0404, 0x0028, 0x2001, 0x0004, 0x8007, 0x9215, 0xba06,
+	0x002e, 0x00ce, 0x00be, 0x0016, 0x2c08, 0x080c, 0xd29b, 0x001e,
+	0x007e, 0x002e, 0x8210, 0x1f04, 0x3040, 0x015e, 0x001e, 0x002e,
+	0x003e, 0x004e, 0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046,
+	0x0026, 0x0016, 0x080c, 0x5386, 0xd0c4, 0x0140, 0xd0a4, 0x0130,
+	0x9006, 0x2220, 0x2009, 0x0029, 0x080c, 0xd52a, 0x001e, 0x002e,
+	0x004e, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x7290, 0x82ff,
+	0x01e8, 0x080c, 0x655a, 0x11d0, 0x2100, 0x080c, 0x2696, 0x81ff,
+	0x01b8, 0x2019, 0x0001, 0x8314, 0x92e0, 0x1c80, 0x2c04, 0xd384,
+	0x0120, 0x9084, 0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x9116,
+	0x0138, 0x9096, 0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085, 0x0001,
+	0x00ce, 0x003e, 0x002e, 0x001e, 0x0005, 0x0016, 0x00c6, 0x0126,
+	0x2091, 0x8000, 0x0036, 0x2019, 0x0029, 0x00a9, 0x003e, 0x9180,
+	0x1000, 0x2004, 0x9065, 0x0158, 0x0016, 0x00c6, 0x2061, 0x1a80,
+	0x001e, 0x6112, 0x080c, 0x2fda, 0x001e, 0x080c, 0x6202, 0x012e,
+	0x00ce, 0x001e, 0x0005, 0x0016, 0x0026, 0x2110, 0x080c, 0x9926,
+	0x080c, 0xd7e2, 0x002e, 0x001e, 0x0005, 0x2001, 0x1836, 0x2004,
+	0xd0cc, 0x0005, 0x00c6, 0x00b6, 0x080c, 0x6fb2, 0x1118, 0x20a9,
+	0x0800, 0x0010, 0x20a9, 0x0782, 0x080c, 0x6fb2, 0x1110, 0x900e,
+	0x0010, 0x2009, 0x007e, 0x9180, 0x1000, 0x2004, 0x905d, 0x0130,
+	0x86ff, 0x0110, 0xb800, 0xd0bc, 0x090c, 0x6202, 0x8108, 0x1f04,
+	0x3113, 0x2061, 0x1800, 0x607b, 0x0000, 0x607c, 0x9084, 0x00ff,
+	0x607e, 0x60af, 0x0000, 0x00be, 0x00ce, 0x0005, 0x2001, 0x1875,
+	0x2004, 0xd0bc, 0x0005, 0x2011, 0x1854, 0x2214, 0xd2ec, 0x0005,
+	0x7eef, 0x7de8, 0x7ce4, 0x80e2, 0x7be1, 0x80e0, 0x80dc, 0x80da,
+	0x7ad9, 0x80d6, 0x80d5, 0x80d4, 0x80d3, 0x80d2, 0x80d1, 0x79ce,
+	0x78cd, 0x80cc, 0x80cb, 0x80ca, 0x80c9, 0x80c7, 0x80c6, 0x77c5,
+	0x76c3, 0x80bc, 0x80ba, 0x75b9, 0x80b6, 0x74b5, 0x73b4, 0x72b3,
+	0x80b2, 0x80b1, 0x80ae, 0x71ad, 0x80ac, 0x70ab, 0x6faa, 0x6ea9,
+	0x80a7, 0x6da6, 0x6ca5, 0x6ba3, 0x6a9f, 0x699e, 0x689d, 0x809b,
+	0x8098, 0x6797, 0x6690, 0x658f, 0x6488, 0x6384, 0x6282, 0x8081,
+	0x8080, 0x617c, 0x607a, 0x8079, 0x5f76, 0x8075, 0x8074, 0x8073,
+	0x8072, 0x8071, 0x806e, 0x5e6d, 0x806c, 0x5d6b, 0x5c6a, 0x5b69,
+	0x8067, 0x5a66, 0x5965, 0x5863, 0x575c, 0x565a, 0x5559, 0x8056,
+	0x8055, 0x5454, 0x5353, 0x5252, 0x5151, 0x504e, 0x4f4d, 0x804c,
+	0x804b, 0x4e4a, 0x4d49, 0x8047, 0x4c46, 0x8045, 0x8043, 0x803c,
+	0x803a, 0x8039, 0x8036, 0x4b35, 0x8034, 0x4a33, 0x4932, 0x4831,
+	0x802e, 0x472d, 0x462c, 0x452b, 0x442a, 0x4329, 0x4227, 0x8026,
+	0x8025, 0x4123, 0x401f, 0x3f1e, 0x3e1d, 0x3d1b, 0x3c18, 0x8017,
+	0x8010, 0x3b0f, 0x3a08, 0x8004, 0x3902, 0x8001, 0x8000, 0x8000,
+	0x3800, 0x3700, 0x3600, 0x8000, 0x3500, 0x8000, 0x8000, 0x8000,
+	0x3400, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x3300,
+	0x3200, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x3100,
+	0x3000, 0x8000, 0x8000, 0x2f00, 0x8000, 0x2e00, 0x2d00, 0x2c00,
+	0x8000, 0x8000, 0x8000, 0x2b00, 0x8000, 0x2a00, 0x2900, 0x2800,
+	0x8000, 0x2700, 0x2600, 0x2500, 0x2400, 0x2300, 0x2200, 0x8000,
+	0x8000, 0x2100, 0x2000, 0x1f00, 0x1e00, 0x1d00, 0x1c00, 0x8000,
+	0x8000, 0x1b00, 0x1a00, 0x8000, 0x1900, 0x8000, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x8000, 0x1800, 0x8000, 0x1700, 0x1600, 0x1500,
+	0x8000, 0x1400, 0x1300, 0x1200, 0x1100, 0x1000, 0x0f00, 0x8000,
+	0x8000, 0x0e00, 0x0d00, 0x0c00, 0x0b00, 0x0a00, 0x0900, 0x8000,
+	0x8000, 0x0800, 0x0700, 0x8000, 0x0600, 0x8000, 0x8000, 0x8000,
+	0x0500, 0x0400, 0x0300, 0x8000, 0x0200, 0x8000, 0x8000, 0x8000,
+	0x0100, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000,
 	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x8000, 0x2071, 0x1894, 0x7003, 0x0002, 0x9006, 0x7016, 0x701a,
-	0x704a, 0x704e, 0x700e, 0x7042, 0x7046, 0x703b, 0x18b0, 0x703f,
-	0x18b0, 0x7007, 0x0001, 0x080c, 0x1004, 0x090c, 0x0db4, 0x2900,
-	0x706a, 0xa867, 0x0002, 0xa8ab, 0xdcb0, 0x080c, 0x1004, 0x090c,
-	0x0db4, 0x2900, 0x706e, 0xa867, 0x0002, 0xa8ab, 0xdcb0, 0x0005,
-	0x2071, 0x1894, 0x7004, 0x0002, 0x3260, 0x3261, 0x3274, 0x3288,
-	0x0005, 0x1004, 0x3271, 0x0e04, 0x3271, 0x2079, 0x0000, 0x0126,
-	0x2091, 0x8000, 0x700c, 0x9005, 0x1128, 0x700f, 0x0001, 0x012e,
-	0x0468, 0x0005, 0x012e, 0x0ce8, 0x2079, 0x0000, 0x2061, 0x18ae,
-	0x2c4c, 0xa86c, 0x908e, 0x0100, 0x0128, 0x9086, 0x0200, 0x0904,
-	0x335c, 0x0005, 0x7018, 0x2048, 0x2061, 0x1800, 0x701c, 0x0807,
-	0x7014, 0x2048, 0xa864, 0x9094, 0x00ff, 0x9296, 0x0029, 0x1120,
-	0xaa78, 0xd2fc, 0x0128, 0x0005, 0x9086, 0x0103, 0x0108, 0x0005,
-	0x2079, 0x0000, 0x2061, 0x1800, 0x701c, 0x0807, 0x2061, 0x1800,
-	0x7880, 0x908a, 0x0040, 0x1210, 0x61cc, 0x0042, 0x2100, 0x908a,
-	0x003f, 0x1a04, 0x3359, 0x61cc, 0x0804, 0x32ee, 0x3330, 0x3368,
-	0x3372, 0x3376, 0x3380, 0x3386, 0x338a, 0x339a, 0x339d, 0x33a7,
-	0x33ac, 0x33b1, 0x33bc, 0x33c7, 0x33d6, 0x33e5, 0x33f3, 0x340a,
-	0x3425, 0x3359, 0x34ce, 0x350c, 0x35b2, 0x35c3, 0x35e6, 0x3359,
-	0x3359, 0x3359, 0x361e, 0x363a, 0x3643, 0x3672, 0x3678, 0x3359,
-	0x36be, 0x3359, 0x3359, 0x3359, 0x3359, 0x3359, 0x36c9, 0x36d2,
-	0x36da, 0x36dc, 0x3359, 0x3359, 0x3359, 0x3359, 0x3359, 0x3359,
-	0x3708, 0x3359, 0x3359, 0x3359, 0x3359, 0x3359, 0x3725, 0x3780,
-	0x3359, 0x3359, 0x3359, 0x3359, 0x3359, 0x3359, 0x0002, 0x37aa,
-	0x37ad, 0x380c, 0x3825, 0x3855, 0x3af3, 0x3359, 0x4f58, 0x3359,
-	0x3359, 0x3359, 0x3359, 0x3359, 0x3359, 0x3359, 0x3359, 0x33a7,
-	0x33ac, 0x4014, 0x53a3, 0x402a, 0x4fe7, 0x5038, 0x513b, 0x3359,
-	0x519d, 0x51d9, 0x520a, 0x530e, 0x5237, 0x528e, 0x3359, 0x402e,
-	0x41cf, 0x41e5, 0x420a, 0x426f, 0x42e3, 0x4303, 0x437a, 0x43d6,
-	0x4432, 0x4435, 0x445a, 0x44fa, 0x4560, 0x4568, 0x469a, 0x47fc,
-	0x4830, 0x4a7a, 0x3359, 0x4a98, 0x4b5b, 0x4c31, 0x3359, 0x3359,
-	0x3359, 0x3359, 0x4c97, 0x4cb2, 0x4568, 0x4ef8, 0x714c, 0x0000,
-	0x2021, 0x4000, 0x080c, 0x48ae, 0x0126, 0x2091, 0x8000, 0x0e04,
-	0x333a, 0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118,
-	0x7833, 0x0011, 0x0010, 0x7833, 0x0010, 0x7c82, 0x7986, 0x7a8a,
-	0x7b8e, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-	0x1187, 0x7007, 0x0001, 0x2091, 0x5000, 0x700f, 0x0000, 0x012e,
-	0x0005, 0x2021, 0x4001, 0x08b0, 0x2021, 0x4002, 0x0898, 0x2021,
-	0x4003, 0x0880, 0x2021, 0x4005, 0x0868, 0x2021, 0x4006, 0x0850,
-	0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884, 0x7990,
-	0x0804, 0x48bb, 0x7883, 0x0004, 0x7884, 0x0807, 0x2039, 0x0001,
-	0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884, 0x7990, 0x0804, 0x48be,
-	0x7984, 0x7888, 0x2114, 0x200a, 0x0804, 0x3330, 0x7984, 0x2114,
-	0x0804, 0x3330, 0x20e1, 0x0000, 0x2099, 0x0021, 0x20e9, 0x0000,
-	0x20a1, 0x0021, 0x20a9, 0x001f, 0x4003, 0x7984, 0x7a88, 0x7b8c,
-	0x0804, 0x3330, 0x7884, 0x2060, 0x04d8, 0x2009, 0x0003, 0x2011,
-	0x0002, 0x2019, 0x001a, 0x789b, 0x0317, 0x0804, 0x3330, 0x2039,
-	0x0001, 0x7d98, 0x7c9c, 0x0800, 0x2039, 0x0001, 0x7d98, 0x7c9c,
-	0x0848, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x3365, 0x2138,
-	0x7d98, 0x7c9c, 0x0804, 0x336c, 0x79a0, 0x9182, 0x0040, 0x0210,
-	0x0804, 0x3365, 0x2138, 0x7d98, 0x7c9c, 0x0804, 0x337a, 0x79a0,
-	0x9182, 0x0040, 0x0210, 0x0804, 0x3365, 0x21e8, 0x7984, 0x7888,
-	0x20a9, 0x0001, 0x21a0, 0x4004, 0x0804, 0x3330, 0x2061, 0x0800,
-	0xe10c, 0x9006, 0x2c15, 0x9200, 0x8c60, 0x8109, 0x1dd8, 0x2010,
-	0x9005, 0x0904, 0x3330, 0x0804, 0x335f, 0x79a0, 0x9182, 0x0040,
-	0x0210, 0x0804, 0x3365, 0x21e0, 0x20a9, 0x0001, 0x7984, 0x2198,
-	0x4012, 0x0804, 0x3330, 0x2069, 0x1853, 0x7884, 0x7990, 0x911a,
-	0x1a04, 0x3365, 0x8019, 0x0904, 0x3365, 0x684a, 0x6942, 0x788c,
-	0x6852, 0x7888, 0x6856, 0x9006, 0x685a, 0x685e, 0x080c, 0x72bc,
-	0x0804, 0x3330, 0x2069, 0x1853, 0x7884, 0x7994, 0x911a, 0x1a04,
-	0x3365, 0x8019, 0x0904, 0x3365, 0x684e, 0x6946, 0x788c, 0x6862,
-	0x7888, 0x6866, 0x9006, 0x686a, 0x686e, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x665d, 0x012e, 0x0804, 0x3330, 0x902e, 0x2520, 0x81ff,
-	0x0120, 0x2009, 0x0001, 0x0804, 0x3362, 0x7984, 0x7b88, 0x7a8c,
-	0x20a9, 0x0005, 0x20e9, 0x0001, 0x20a1, 0x189c, 0x4101, 0x080c,
-	0x4872, 0x1120, 0x2009, 0x0002, 0x0804, 0x3362, 0x2009, 0x0020,
-	0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x48bb, 0x701f, 0x3449,
-	0x0005, 0xa864, 0x2008, 0x9084, 0x00ff, 0x9096, 0x0011, 0x0168,
-	0x9096, 0x0019, 0x0150, 0x9096, 0x0015, 0x0138, 0x9096, 0x0048,
-	0x0120, 0x9096, 0x0029, 0x1904, 0x3362, 0x810f, 0x918c, 0x00ff,
-	0x0904, 0x3362, 0x7112, 0x7010, 0x8001, 0x0560, 0x7012, 0x080c,
-	0x4872, 0x1120, 0x2009, 0x0002, 0x0804, 0x3362, 0x2009, 0x0020,
-	0x7068, 0x2040, 0xa28c, 0xa390, 0xa494, 0xa598, 0x9290, 0x0040,
-	0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000, 0xa85c, 0x9080,
-	0x0019, 0xaf60, 0x080c, 0x48bb, 0x701f, 0x3487, 0x0005, 0xa864,
-	0x9084, 0x00ff, 0x9096, 0x0002, 0x0120, 0x9096, 0x000a, 0x1904,
-	0x3362, 0x0888, 0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a, 0xa864,
-	0x9084, 0x00ff, 0x9096, 0x0029, 0x1160, 0xc2fd, 0xaa7a, 0x080c,
-	0x5dd6, 0x0150, 0x0126, 0x2091, 0x8000, 0xa87a, 0xa982, 0x012e,
-	0x0050, 0x080c, 0x60ed, 0x1128, 0x7007, 0x0003, 0x701f, 0x34b3,
-	0x0005, 0x080c, 0x6abf, 0x0126, 0x2091, 0x8000, 0x20a9, 0x0005,
-	0x20e1, 0x0001, 0x2099, 0x189c, 0x400a, 0x2100, 0x9210, 0x9399,
+	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
+	0x2071, 0x1894, 0x7003, 0x0002, 0x9006, 0x7016, 0x701a, 0x704a,
+	0x704e, 0x700e, 0x7042, 0x7046, 0x703b, 0x18b0, 0x703f, 0x18b0,
+	0x7007, 0x0001, 0x080c, 0x1004, 0x090c, 0x0db4, 0x2900, 0x706a,
+	0xa867, 0x0002, 0xa8ab, 0xdcb0, 0x080c, 0x1004, 0x090c, 0x0db4,
+	0x2900, 0x706e, 0xa867, 0x0002, 0xa8ab, 0xdcb0, 0x0005, 0x2071,
+	0x1894, 0x7004, 0x0002, 0x3267, 0x3268, 0x327b, 0x328f, 0x0005,
+	0x1004, 0x3278, 0x0e04, 0x3278, 0x2079, 0x0000, 0x0126, 0x2091,
+	0x8000, 0x700c, 0x9005, 0x1128, 0x700f, 0x0001, 0x012e, 0x0468,
+	0x0005, 0x012e, 0x0ce8, 0x2079, 0x0000, 0x2061, 0x18ae, 0x2c4c,
+	0xa86c, 0x908e, 0x0100, 0x0128, 0x9086, 0x0200, 0x0904, 0x3363,
+	0x0005, 0x7018, 0x2048, 0x2061, 0x1800, 0x701c, 0x0807, 0x7014,
+	0x2048, 0xa864, 0x9094, 0x00ff, 0x9296, 0x0029, 0x1120, 0xaa78,
+	0xd2fc, 0x0128, 0x0005, 0x9086, 0x0103, 0x0108, 0x0005, 0x2079,
+	0x0000, 0x2061, 0x1800, 0x701c, 0x0807, 0x2061, 0x1800, 0x7880,
+	0x908a, 0x0040, 0x1210, 0x61cc, 0x0042, 0x2100, 0x908a, 0x003f,
+	0x1a04, 0x3360, 0x61cc, 0x0804, 0x32f5, 0x3337, 0x336f, 0x3379,
+	0x337d, 0x3387, 0x338d, 0x3391, 0x33a1, 0x33a4, 0x33ae, 0x33b3,
+	0x33b8, 0x33c3, 0x33ce, 0x33dd, 0x33ec, 0x33fa, 0x3411, 0x342c,
+	0x3360, 0x34d5, 0x3513, 0x35b9, 0x35ca, 0x35ed, 0x3360, 0x3360,
+	0x3360, 0x3625, 0x3641, 0x364a, 0x3679, 0x367f, 0x3360, 0x36c5,
+	0x3360, 0x3360, 0x3360, 0x3360, 0x3360, 0x36d0, 0x36d9, 0x36e1,
+	0x36e3, 0x3360, 0x3360, 0x3360, 0x3360, 0x3360, 0x3360, 0x370f,
+	0x3360, 0x3360, 0x3360, 0x3360, 0x3360, 0x372c, 0x3787, 0x3360,
+	0x3360, 0x3360, 0x3360, 0x3360, 0x3360, 0x0002, 0x37b1, 0x37b4,
+	0x3813, 0x382c, 0x385c, 0x3afa, 0x3360, 0x4f5f, 0x3360, 0x3360,
+	0x3360, 0x3360, 0x3360, 0x3360, 0x3360, 0x3360, 0x33ae, 0x33b3,
+	0x401b, 0x53aa, 0x4031, 0x4fee, 0x503f, 0x5142, 0x3360, 0x51a4,
+	0x51e0, 0x5211, 0x5315, 0x523e, 0x5295, 0x3360, 0x4035, 0x41d6,
+	0x41ec, 0x4211, 0x4276, 0x42ea, 0x430a, 0x4381, 0x43dd, 0x4439,
+	0x443c, 0x4461, 0x4501, 0x4567, 0x456f, 0x46a1, 0x4803, 0x4837,
+	0x4a81, 0x3360, 0x4a9f, 0x4b62, 0x4c38, 0x3360, 0x3360, 0x3360,
+	0x3360, 0x4c9e, 0x4cb9, 0x456f, 0x4eff, 0x714c, 0x0000, 0x2021,
+	0x4000, 0x080c, 0x48b5, 0x0126, 0x2091, 0x8000, 0x0e04, 0x3341,
+	0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833,
+	0x0011, 0x0010, 0x7833, 0x0010, 0x7c82, 0x7986, 0x7a8a, 0x7b8e,
+	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187,
+	0x7007, 0x0001, 0x2091, 0x5000, 0x700f, 0x0000, 0x012e, 0x0005,
+	0x2021, 0x4001, 0x08b0, 0x2021, 0x4002, 0x0898, 0x2021, 0x4003,
+	0x0880, 0x2021, 0x4005, 0x0868, 0x2021, 0x4006, 0x0850, 0x2039,
+	0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884, 0x7990, 0x0804,
+	0x48c2, 0x7883, 0x0004, 0x7884, 0x0807, 0x2039, 0x0001, 0x902e,
+	0x2520, 0x7b88, 0x7a8c, 0x7884, 0x7990, 0x0804, 0x48c5, 0x7984,
+	0x7888, 0x2114, 0x200a, 0x0804, 0x3337, 0x7984, 0x2114, 0x0804,
+	0x3337, 0x20e1, 0x0000, 0x2099, 0x0021, 0x20e9, 0x0000, 0x20a1,
+	0x0021, 0x20a9, 0x001f, 0x4003, 0x7984, 0x7a88, 0x7b8c, 0x0804,
+	0x3337, 0x7884, 0x2060, 0x04d8, 0x2009, 0x0003, 0x2011, 0x0002,
+	0x2019, 0x001c, 0x789b, 0x0317, 0x0804, 0x3337, 0x2039, 0x0001,
+	0x7d98, 0x7c9c, 0x0800, 0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0848,
+	0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x336c, 0x2138, 0x7d98,
+	0x7c9c, 0x0804, 0x3373, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804,
+	0x336c, 0x2138, 0x7d98, 0x7c9c, 0x0804, 0x3381, 0x79a0, 0x9182,
+	0x0040, 0x0210, 0x0804, 0x336c, 0x21e8, 0x7984, 0x7888, 0x20a9,
+	0x0001, 0x21a0, 0x4004, 0x0804, 0x3337, 0x2061, 0x0800, 0xe10c,
+	0x9006, 0x2c15, 0x9200, 0x8c60, 0x8109, 0x1dd8, 0x2010, 0x9005,
+	0x0904, 0x3337, 0x0804, 0x3366, 0x79a0, 0x9182, 0x0040, 0x0210,
+	0x0804, 0x336c, 0x21e0, 0x20a9, 0x0001, 0x7984, 0x2198, 0x4012,
+	0x0804, 0x3337, 0x2069, 0x1853, 0x7884, 0x7990, 0x911a, 0x1a04,
+	0x336c, 0x8019, 0x0904, 0x336c, 0x684a, 0x6942, 0x788c, 0x6852,
+	0x7888, 0x6856, 0x9006, 0x685a, 0x685e, 0x080c, 0x72c7, 0x0804,
+	0x3337, 0x2069, 0x1853, 0x7884, 0x7994, 0x911a, 0x1a04, 0x336c,
+	0x8019, 0x0904, 0x336c, 0x684e, 0x6946, 0x788c, 0x6862, 0x7888,
+	0x6866, 0x9006, 0x686a, 0x686e, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6664, 0x012e, 0x0804, 0x3337, 0x902e, 0x2520, 0x81ff, 0x0120,
+	0x2009, 0x0001, 0x0804, 0x3369, 0x7984, 0x7b88, 0x7a8c, 0x20a9,
+	0x0005, 0x20e9, 0x0001, 0x20a1, 0x189c, 0x4101, 0x080c, 0x4879,
+	0x1120, 0x2009, 0x0002, 0x0804, 0x3369, 0x2009, 0x0020, 0xa85c,
+	0x9080, 0x0019, 0xaf60, 0x080c, 0x48c2, 0x701f, 0x3450, 0x0005,
+	0xa864, 0x2008, 0x9084, 0x00ff, 0x9096, 0x0011, 0x0168, 0x9096,
+	0x0019, 0x0150, 0x9096, 0x0015, 0x0138, 0x9096, 0x0048, 0x0120,
+	0x9096, 0x0029, 0x1904, 0x3369, 0x810f, 0x918c, 0x00ff, 0x0904,
+	0x3369, 0x7112, 0x7010, 0x8001, 0x0560, 0x7012, 0x080c, 0x4879,
+	0x1120, 0x2009, 0x0002, 0x0804, 0x3369, 0x2009, 0x0020, 0x7068,
+	0x2040, 0xa28c, 0xa390, 0xa494, 0xa598, 0x9290, 0x0040, 0x9399,
 	0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000, 0xa85c, 0x9080, 0x0019,
-	0x2009, 0x0020, 0x012e, 0xaf60, 0x0804, 0x48be, 0x2091, 0x8000,
-	0x7837, 0x4000, 0x7833, 0x0010, 0x7883, 0x4000, 0x7887, 0x4953,
-	0x788b, 0x5020, 0x788f, 0x2020, 0x2009, 0x017f, 0x2104, 0x7892,
-	0x3f00, 0x7896, 0x2061, 0x0100, 0x6200, 0x2061, 0x0200, 0x603c,
-	0x8007, 0x9205, 0x789a, 0x2009, 0x04fd, 0x2104, 0x789e, 0x2091,
-	0x5000, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x0180,
-	0x2001, 0x19ea, 0x2004, 0x9005, 0x0128, 0x2001, 0x008b, 0x2004,
-	0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002, 0x2003, 0x1001,
-	0x2071, 0x0080, 0x0804, 0x0427, 0x81ff, 0x1904, 0x3362, 0x7984,
-	0x080c, 0x6237, 0x1904, 0x3365, 0x7e98, 0x9684, 0x3fff, 0x9082,
-	0x4000, 0x1a04, 0x3365, 0x7c88, 0x7d8c, 0x080c, 0x639a, 0x080c,
-	0x6369, 0x0000, 0x1518, 0x2061, 0x1cd0, 0x0126, 0x2091, 0x8000,
-	0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130, 0xa86c,
-	0x9406, 0x1118, 0xa870, 0x9506, 0x0150, 0x012e, 0x9ce0, 0x0018,
-	0x2001, 0x1819, 0x2004, 0x9c02, 0x1a04, 0x3362, 0x0c30, 0x080c,
-	0xb731, 0x012e, 0x0904, 0x3362, 0x0804, 0x3330, 0x900e, 0x2001,
-	0x0005, 0x080c, 0x6abf, 0x0126, 0x2091, 0x8000, 0x080c, 0xbdf3,
-	0x080c, 0x6885, 0x012e, 0x0804, 0x3330, 0x00a6, 0x2950, 0xb198,
-	0x080c, 0x6237, 0x1904, 0x359f, 0xb6a4, 0x9684, 0x3fff, 0x9082,
-	0x4000, 0x16e8, 0xb49c, 0xb5a0, 0x080c, 0x639a, 0x080c, 0x6369,
-	0x1520, 0x2061, 0x1cd0, 0x0126, 0x2091, 0x8000, 0x6000, 0x9086,
-	0x0000, 0x0148, 0x6014, 0x904d, 0x0130, 0xa86c, 0x9406, 0x1118,
-	0xa870, 0x9506, 0x0158, 0x012e, 0x9ce0, 0x0018, 0x2001, 0x1819,
-	0x2004, 0x9c02, 0x2009, 0x000d, 0x12b0, 0x0c28, 0x080c, 0xb731,
-	0x012e, 0x2009, 0x0003, 0x0178, 0x00e0, 0x900e, 0x2001, 0x0005,
-	0x080c, 0x6abf, 0x0126, 0x2091, 0x8000, 0x080c, 0xbdf3, 0x080c,
-	0x6878, 0x012e, 0x0070, 0xb097, 0x4005, 0xb19a, 0x0010, 0xb097,
-	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x2a48, 0x00ae,
-	0x0005, 0xb097, 0x4000, 0x9006, 0x918d, 0x0001, 0x2008, 0x2a48,
-	0x00ae, 0x0005, 0x81ff, 0x1904, 0x3362, 0x080c, 0x4889, 0x0904,
-	0x3365, 0x080c, 0x62fe, 0x0904, 0x3362, 0x080c, 0x63a0, 0x0904,
-	0x3362, 0x0804, 0x42fa, 0x81ff, 0x1904, 0x3362, 0x080c, 0x48a5,
-	0x0904, 0x3365, 0x080c, 0x642e, 0x0904, 0x3362, 0x2019, 0x0005,
-	0x79a8, 0x080c, 0x63bb, 0x0904, 0x3362, 0x7888, 0x908a, 0x1000,
-	0x1a04, 0x3365, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x801e,
-	0x7984, 0xd184, 0x1904, 0x3330, 0x0804, 0x42fa, 0x0126, 0x2091,
-	0x8000, 0x81ff, 0x0118, 0x2009, 0x0001, 0x0450, 0x2029, 0x07ff,
-	0x6458, 0x2400, 0x9506, 0x01f8, 0x2508, 0x080c, 0x6237, 0x11d8,
-	0x080c, 0x642e, 0x1128, 0x2009, 0x0002, 0x62bc, 0x2518, 0x00c0,
-	0x2019, 0x0004, 0x900e, 0x080c, 0x63bb, 0x1118, 0x2009, 0x0006,
-	0x0078, 0x7884, 0x908a, 0x1000, 0x1270, 0x8003, 0x800b, 0x810b,
-	0x9108, 0x080c, 0x801e, 0x8529, 0x1ae0, 0x012e, 0x0804, 0x3330,
-	0x012e, 0x0804, 0x3362, 0x012e, 0x0804, 0x3365, 0x080c, 0x4889,
-	0x0904, 0x3365, 0x080c, 0x62fe, 0x0904, 0x3362, 0xbaa0, 0x2019,
-	0x0005, 0x00c6, 0x9066, 0x080c, 0x8549, 0x0076, 0x903e, 0x080c,
-	0x8441, 0x900e, 0x080c, 0xd27b, 0x007e, 0x00ce, 0x080c, 0x639a,
-	0x0804, 0x3330, 0x080c, 0x4889, 0x0904, 0x3365, 0x080c, 0x639a,
-	0x2208, 0x0804, 0x3330, 0x0156, 0x00d6, 0x00e6, 0x2069, 0x1906,
-	0x6810, 0x6914, 0x910a, 0x1208, 0x900e, 0x6816, 0x9016, 0x901e,
-	0x20a9, 0x007e, 0x2069, 0x1000, 0x2d04, 0x905d, 0x0118, 0xb84c,
-	0x0059, 0x9210, 0x8d68, 0x1f04, 0x3654, 0x2300, 0x9218, 0x00ee,
-	0x00de, 0x015e, 0x0804, 0x3330, 0x00f6, 0x0016, 0x907d, 0x0138,
-	0x9006, 0x8000, 0x2f0c, 0x81ff, 0x0110, 0x2178, 0x0cd0, 0x001e,
-	0x00fe, 0x0005, 0x2069, 0x1906, 0x6910, 0x62b8, 0x0804, 0x3330,
-	0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x3362, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x5393, 0x0128, 0x2009, 0x0007, 0x012e, 0x0804,
-	0x3362, 0x012e, 0x6158, 0x9190, 0x3131, 0x2215, 0x9294, 0x00ff,
-	0x6378, 0x83ff, 0x0108, 0x627c, 0x67d8, 0x97c4, 0x000a, 0x98c6,
-	0x000a, 0x1118, 0x2031, 0x0001, 0x00e8, 0x97c4, 0x0022, 0x98c6,
-	0x0022, 0x1118, 0x2031, 0x0003, 0x00a8, 0x97c4, 0x0012, 0x98c6,
-	0x0012, 0x1118, 0x2031, 0x0002, 0x0068, 0x080c, 0x6fa7, 0x1118,
-	0x2031, 0x0004, 0x0038, 0xd79c, 0x0120, 0x2009, 0x0005, 0x0804,
-	0x3362, 0x9036, 0x7e9a, 0x7f9e, 0x0804, 0x3330, 0x6148, 0x624c,
-	0x2019, 0x1957, 0x231c, 0x2001, 0x1958, 0x2004, 0x789a, 0x0804,
-	0x3330, 0x0126, 0x2091, 0x8000, 0x6138, 0x623c, 0x6340, 0x012e,
-	0x0804, 0x3330, 0x080c, 0x48a5, 0x0904, 0x3365, 0xba44, 0xbb38,
-	0x0804, 0x3330, 0x080c, 0x0db4, 0x080c, 0x48a5, 0x2110, 0x0904,
-	0x3365, 0xb804, 0x908c, 0x00ff, 0x918e, 0x0006, 0x0140, 0x9084,
-	0xff00, 0x9086, 0x0600, 0x2009, 0x0009, 0x1904, 0x3362, 0x0126,
-	0x2091, 0x8000, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c, 0x990d,
-	0x080c, 0x8549, 0x0076, 0x903e, 0x080c, 0x8441, 0x900e, 0x080c,
-	0xd27b, 0x007e, 0x00ce, 0xb807, 0x0407, 0x012e, 0x0804, 0x3330,
-	0x6148, 0x624c, 0x7884, 0x604a, 0x7b88, 0x634e, 0x2069, 0x1853,
-	0x831f, 0x9305, 0x6816, 0x788c, 0x2069, 0x1957, 0x2d1c, 0x206a,
-	0x7e98, 0x9682, 0x0014, 0x1210, 0x2031, 0x07d0, 0x2069, 0x1958,
-	0x2d04, 0x266a, 0x789a, 0x0804, 0x3330, 0x0126, 0x2091, 0x8000,
-	0x6138, 0x7884, 0x603a, 0x910e, 0xd1b4, 0x190c, 0x0e9b, 0xd0c4,
-	0x01a8, 0x00d6, 0x78a8, 0x2009, 0x196e, 0x200a, 0x78ac, 0x2011,
-	0x196f, 0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118,
-	0x2214, 0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0x603e,
-	0x2011, 0x0114, 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0080,
-	0x0010, 0x918c, 0xff7f, 0x2112, 0x6140, 0x788c, 0x6042, 0x910e,
-	0xd1e4, 0x190c, 0x0eb1, 0x6040, 0xd0cc, 0x0120, 0x78b0, 0x2011,
-	0x0114, 0x2012, 0x012e, 0x0804, 0x3330, 0x00f6, 0x2079, 0x1800,
-	0x7a38, 0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084, 0xfebf,
-	0x8002, 0x9214, 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a, 0xa897,
-	0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe, 0x0005,
-	0x7898, 0x9005, 0x01a8, 0x7888, 0x9025, 0x0904, 0x3365, 0x788c,
-	0x902d, 0x0904, 0x3365, 0x900e, 0x080c, 0x6237, 0x1120, 0xba44,
-	0xbb38, 0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108, 0x0ca0,
-	0x080c, 0x48a5, 0x0904, 0x3365, 0x7888, 0x900d, 0x0904, 0x3365,
-	0x788c, 0x9005, 0x0904, 0x3365, 0xba44, 0xb946, 0xbb38, 0xb83a,
-	0x0804, 0x3330, 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05, 0x080c,
-	0x5393, 0x1904, 0x3362, 0x00c6, 0x2061, 0x0100, 0x7984, 0x9186,
-	0x00ff, 0x1130, 0x2001, 0x1817, 0x2004, 0x9085, 0xff00, 0x0088,
-	0x9182, 0x007f, 0x16e0, 0x9188, 0x3131, 0x210d, 0x918c, 0x00ff,
-	0x2001, 0x1817, 0x2004, 0x0026, 0x9116, 0x002e, 0x0580, 0x810f,
-	0x9105, 0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0x9dc3, 0x000e,
-	0x0510, 0x602e, 0x620a, 0x7984, 0x00b6, 0x080c, 0x61dd, 0x2b08,
-	0x00be, 0x1500, 0x6112, 0x6023, 0x0001, 0x080c, 0x4872, 0x01d0,
-	0x9006, 0xa866, 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd, 0xa86a,
-	0x701f, 0x3805, 0x2900, 0x6016, 0x2009, 0x0032, 0x080c, 0x9e93,
-	0x012e, 0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804, 0x3362, 0x00ce,
-	0x0804, 0x3365, 0x080c, 0x9e19, 0x0cb0, 0xa830, 0x9086, 0x0100,
-	0x0904, 0x3362, 0x0804, 0x3330, 0x2061, 0x1a41, 0x0126, 0x2091,
-	0x8000, 0x6000, 0xd084, 0x0170, 0x6104, 0x6208, 0x2061, 0x1800,
-	0x6350, 0x6070, 0x789a, 0x60bc, 0x789e, 0x60b8, 0x78aa, 0x012e,
-	0x0804, 0x3330, 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904, 0x3362,
-	0x080c, 0x6fa7, 0x0904, 0x3362, 0x0126, 0x2091, 0x8000, 0x6250,
-	0x6070, 0x9202, 0x0248, 0x9085, 0x0001, 0x080c, 0x26cc, 0x080c,
-	0x55ad, 0x012e, 0x0804, 0x3330, 0x012e, 0x0804, 0x3365, 0x0006,
-	0x0016, 0x00c6, 0x00e6, 0x2001, 0x197a, 0x2070, 0x2061, 0x1853,
-	0x6008, 0x2072, 0x900e, 0x2011, 0x1400, 0x080c, 0x8248, 0x7206,
-	0x00ee, 0x00ce, 0x001e, 0x000e, 0x0005, 0x0126, 0x2091, 0x8000,
-	0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x3332, 0x7884,
-	0xd0fc, 0x0148, 0x2001, 0x002a, 0x2004, 0x9082, 0x00e1, 0x0288,
-	0x012e, 0x0804, 0x3365, 0x2001, 0x002a, 0x2004, 0x2069, 0x1853,
-	0x6908, 0x9102, 0x1230, 0x012e, 0x0804, 0x3365, 0x012e, 0x0804,
-	0x3362, 0x080c, 0x9d98, 0x0dd0, 0x7884, 0xd0fc, 0x0904, 0x38d0,
-	0x00c6, 0x080c, 0x4872, 0x00ce, 0x0d88, 0xa867, 0x0000, 0x7884,
-	0xa80a, 0x7898, 0xa80e, 0x789c, 0xa812, 0x2001, 0x002e, 0x2004,
-	0xa81a, 0x2001, 0x002f, 0x2004, 0xa81e, 0x2001, 0x0030, 0x2004,
-	0xa822, 0x2001, 0x0031, 0x2004, 0xa826, 0x2001, 0x0034, 0x2004,
-	0xa82a, 0x2001, 0x0035, 0x2004, 0xa82e, 0x2001, 0x002a, 0x2004,
-	0x9080, 0x0003, 0x9084, 0x00fc, 0x8004, 0xa816, 0x080c, 0x3a56,
-	0x0928, 0x7014, 0x2048, 0xad2c, 0xac28, 0xab1c, 0xaa18, 0xa930,
-	0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x8906,
+	0xaf60, 0x080c, 0x48c2, 0x701f, 0x348e, 0x0005, 0xa864, 0x9084,
+	0x00ff, 0x9096, 0x0002, 0x0120, 0x9096, 0x000a, 0x1904, 0x3369,
+	0x0888, 0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a, 0xa864, 0x9084,
+	0x00ff, 0x9096, 0x0029, 0x1160, 0xc2fd, 0xaa7a, 0x080c, 0x5ddd,
+	0x0150, 0x0126, 0x2091, 0x8000, 0xa87a, 0xa982, 0x012e, 0x0050,
+	0x080c, 0x60f4, 0x1128, 0x7007, 0x0003, 0x701f, 0x34ba, 0x0005,
+	0x080c, 0x6ac6, 0x0126, 0x2091, 0x8000, 0x20a9, 0x0005, 0x20e1,
+	0x0001, 0x2099, 0x189c, 0x400a, 0x2100, 0x9210, 0x9399, 0x0000,
+	0x94a1, 0x0000, 0x95a9, 0x0000, 0xa85c, 0x9080, 0x0019, 0x2009,
+	0x0020, 0x012e, 0xaf60, 0x0804, 0x48c5, 0x2091, 0x8000, 0x7837,
+	0x4000, 0x7833, 0x0010, 0x7883, 0x4000, 0x7887, 0x4953, 0x788b,
+	0x5020, 0x788f, 0x2020, 0x2009, 0x017f, 0x2104, 0x7892, 0x3f00,
+	0x7896, 0x2061, 0x0100, 0x6200, 0x2061, 0x0200, 0x603c, 0x8007,
+	0x9205, 0x789a, 0x2009, 0x04fd, 0x2104, 0x789e, 0x2091, 0x5000,
+	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x0180, 0x2001,
+	0x19ea, 0x2004, 0x9005, 0x0128, 0x2001, 0x008b, 0x2004, 0xd0fc,
+	0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002, 0x2003, 0x1001, 0x2071,
+	0x0080, 0x0804, 0x0427, 0x81ff, 0x1904, 0x3369, 0x7984, 0x080c,
+	0x623e, 0x1904, 0x336c, 0x7e98, 0x9684, 0x3fff, 0x9082, 0x4000,
+	0x1a04, 0x336c, 0x7c88, 0x7d8c, 0x080c, 0x63a1, 0x080c, 0x6370,
+	0x0000, 0x1518, 0x2061, 0x1cd0, 0x0126, 0x2091, 0x8000, 0x6000,
+	0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130, 0xa86c, 0x9406,
+	0x1118, 0xa870, 0x9506, 0x0150, 0x012e, 0x9ce0, 0x0018, 0x2001,
+	0x1819, 0x2004, 0x9c02, 0x1a04, 0x3369, 0x0c30, 0x080c, 0xb74a,
+	0x012e, 0x0904, 0x3369, 0x0804, 0x3337, 0x900e, 0x2001, 0x0005,
+	0x080c, 0x6ac6, 0x0126, 0x2091, 0x8000, 0x080c, 0xbe0c, 0x080c,
+	0x688c, 0x012e, 0x0804, 0x3337, 0x00a6, 0x2950, 0xb198, 0x080c,
+	0x623e, 0x1904, 0x35a6, 0xb6a4, 0x9684, 0x3fff, 0x9082, 0x4000,
+	0x16e8, 0xb49c, 0xb5a0, 0x080c, 0x63a1, 0x080c, 0x6370, 0x1520,
+	0x2061, 0x1cd0, 0x0126, 0x2091, 0x8000, 0x6000, 0x9086, 0x0000,
+	0x0148, 0x6014, 0x904d, 0x0130, 0xa86c, 0x9406, 0x1118, 0xa870,
+	0x9506, 0x0158, 0x012e, 0x9ce0, 0x0018, 0x2001, 0x1819, 0x2004,
+	0x9c02, 0x2009, 0x000d, 0x12b0, 0x0c28, 0x080c, 0xb74a, 0x012e,
+	0x2009, 0x0003, 0x0178, 0x00e0, 0x900e, 0x2001, 0x0005, 0x080c,
+	0x6ac6, 0x0126, 0x2091, 0x8000, 0x080c, 0xbe0c, 0x080c, 0x687f,
+	0x012e, 0x0070, 0xb097, 0x4005, 0xb19a, 0x0010, 0xb097, 0x4006,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x2a48, 0x00ae, 0x0005,
+	0xb097, 0x4000, 0x9006, 0x918d, 0x0001, 0x2008, 0x2a48, 0x00ae,
+	0x0005, 0x81ff, 0x1904, 0x3369, 0x080c, 0x4890, 0x0904, 0x336c,
+	0x080c, 0x6305, 0x0904, 0x3369, 0x080c, 0x63a7, 0x0904, 0x3369,
+	0x0804, 0x4301, 0x81ff, 0x1904, 0x3369, 0x080c, 0x48ac, 0x0904,
+	0x336c, 0x080c, 0x6435, 0x0904, 0x3369, 0x2019, 0x0005, 0x79a8,
+	0x080c, 0x63c2, 0x0904, 0x3369, 0x7888, 0x908a, 0x1000, 0x1a04,
+	0x336c, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x8046, 0x7984,
+	0xd184, 0x1904, 0x3337, 0x0804, 0x4301, 0x0126, 0x2091, 0x8000,
+	0x81ff, 0x0118, 0x2009, 0x0001, 0x0450, 0x2029, 0x07ff, 0x6458,
+	0x2400, 0x9506, 0x01f8, 0x2508, 0x080c, 0x623e, 0x11d8, 0x080c,
+	0x6435, 0x1128, 0x2009, 0x0002, 0x62bc, 0x2518, 0x00c0, 0x2019,
+	0x0004, 0x900e, 0x080c, 0x63c2, 0x1118, 0x2009, 0x0006, 0x0078,
+	0x7884, 0x908a, 0x1000, 0x1270, 0x8003, 0x800b, 0x810b, 0x9108,
+	0x080c, 0x8046, 0x8529, 0x1ae0, 0x012e, 0x0804, 0x3337, 0x012e,
+	0x0804, 0x3369, 0x012e, 0x0804, 0x336c, 0x080c, 0x4890, 0x0904,
+	0x336c, 0x080c, 0x6305, 0x0904, 0x3369, 0xbaa0, 0x2019, 0x0005,
+	0x00c6, 0x9066, 0x080c, 0x8571, 0x0076, 0x903e, 0x080c, 0x8469,
+	0x900e, 0x080c, 0xd29b, 0x007e, 0x00ce, 0x080c, 0x63a1, 0x0804,
+	0x3337, 0x080c, 0x4890, 0x0904, 0x336c, 0x080c, 0x63a1, 0x2208,
+	0x0804, 0x3337, 0x0156, 0x00d6, 0x00e6, 0x2069, 0x1906, 0x6810,
+	0x6914, 0x910a, 0x1208, 0x900e, 0x6816, 0x9016, 0x901e, 0x20a9,
+	0x007e, 0x2069, 0x1000, 0x2d04, 0x905d, 0x0118, 0xb84c, 0x0059,
+	0x9210, 0x8d68, 0x1f04, 0x365b, 0x2300, 0x9218, 0x00ee, 0x00de,
+	0x015e, 0x0804, 0x3337, 0x00f6, 0x0016, 0x907d, 0x0138, 0x9006,
+	0x8000, 0x2f0c, 0x81ff, 0x0110, 0x2178, 0x0cd0, 0x001e, 0x00fe,
+	0x0005, 0x2069, 0x1906, 0x6910, 0x62b8, 0x0804, 0x3337, 0x81ff,
+	0x0120, 0x2009, 0x0001, 0x0804, 0x3369, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x539a, 0x0128, 0x2009, 0x0007, 0x012e, 0x0804, 0x3369,
+	0x012e, 0x6158, 0x9190, 0x3138, 0x2215, 0x9294, 0x00ff, 0x6378,
+	0x83ff, 0x0108, 0x627c, 0x67d8, 0x97c4, 0x000a, 0x98c6, 0x000a,
+	0x1118, 0x2031, 0x0001, 0x00e8, 0x97c4, 0x0022, 0x98c6, 0x0022,
+	0x1118, 0x2031, 0x0003, 0x00a8, 0x97c4, 0x0012, 0x98c6, 0x0012,
+	0x1118, 0x2031, 0x0002, 0x0068, 0x080c, 0x6fb2, 0x1118, 0x2031,
+	0x0004, 0x0038, 0xd79c, 0x0120, 0x2009, 0x0005, 0x0804, 0x3369,
+	0x9036, 0x7e9a, 0x7f9e, 0x0804, 0x3337, 0x6148, 0x624c, 0x2019,
+	0x1957, 0x231c, 0x2001, 0x1958, 0x2004, 0x789a, 0x0804, 0x3337,
+	0x0126, 0x2091, 0x8000, 0x6138, 0x623c, 0x6340, 0x012e, 0x0804,
+	0x3337, 0x080c, 0x48ac, 0x0904, 0x336c, 0xba44, 0xbb38, 0x0804,
+	0x3337, 0x080c, 0x0db4, 0x080c, 0x48ac, 0x2110, 0x0904, 0x336c,
+	0xb804, 0x908c, 0x00ff, 0x918e, 0x0006, 0x0140, 0x9084, 0xff00,
+	0x9086, 0x0600, 0x2009, 0x0009, 0x1904, 0x3369, 0x0126, 0x2091,
+	0x8000, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c, 0x9926, 0x080c,
+	0x8571, 0x0076, 0x903e, 0x080c, 0x8469, 0x900e, 0x080c, 0xd29b,
+	0x007e, 0x00ce, 0xb807, 0x0407, 0x012e, 0x0804, 0x3337, 0x6148,
+	0x624c, 0x7884, 0x604a, 0x7b88, 0x634e, 0x2069, 0x1853, 0x831f,
+	0x9305, 0x6816, 0x788c, 0x2069, 0x1957, 0x2d1c, 0x206a, 0x7e98,
+	0x9682, 0x0014, 0x1210, 0x2031, 0x07d0, 0x2069, 0x1958, 0x2d04,
+	0x266a, 0x789a, 0x0804, 0x3337, 0x0126, 0x2091, 0x8000, 0x6138,
+	0x7884, 0x603a, 0x910e, 0xd1b4, 0x190c, 0x0e9b, 0xd0c4, 0x01a8,
+	0x00d6, 0x78a8, 0x2009, 0x196e, 0x200a, 0x78ac, 0x2011, 0x196f,
+	0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118, 0x2214,
+	0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0x603e, 0x2011,
+	0x0114, 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0080, 0x0010,
+	0x918c, 0xff7f, 0x2112, 0x6140, 0x788c, 0x6042, 0x910e, 0xd1e4,
+	0x190c, 0x0eb1, 0x6040, 0xd0cc, 0x0120, 0x78b0, 0x2011, 0x0114,
+	0x2012, 0x012e, 0x0804, 0x3337, 0x00f6, 0x2079, 0x1800, 0x7a38,
+	0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084, 0xfebf, 0x8002,
+	0x9214, 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a, 0xa897, 0x4000,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe, 0x0005, 0x7898,
+	0x9005, 0x01a8, 0x7888, 0x9025, 0x0904, 0x336c, 0x788c, 0x902d,
+	0x0904, 0x336c, 0x900e, 0x080c, 0x623e, 0x1120, 0xba44, 0xbb38,
+	0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108, 0x0ca0, 0x080c,
+	0x48ac, 0x0904, 0x336c, 0x7888, 0x900d, 0x0904, 0x336c, 0x788c,
+	0x9005, 0x0904, 0x336c, 0xba44, 0xb946, 0xbb38, 0xb83a, 0x0804,
+	0x3337, 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05, 0x080c, 0x539a,
+	0x1904, 0x3369, 0x00c6, 0x2061, 0x0100, 0x7984, 0x9186, 0x00ff,
+	0x1130, 0x2001, 0x1817, 0x2004, 0x9085, 0xff00, 0x0088, 0x9182,
+	0x007f, 0x16e0, 0x9188, 0x3138, 0x210d, 0x918c, 0x00ff, 0x2001,
+	0x1817, 0x2004, 0x0026, 0x9116, 0x002e, 0x0580, 0x810f, 0x9105,
+	0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0x9ddc, 0x000e, 0x0510,
+	0x602e, 0x620a, 0x7984, 0x00b6, 0x080c, 0x61e4, 0x2b08, 0x00be,
+	0x1500, 0x6112, 0x6023, 0x0001, 0x080c, 0x4879, 0x01d0, 0x9006,
+	0xa866, 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x701f,
+	0x380c, 0x2900, 0x6016, 0x2009, 0x0032, 0x080c, 0x9eac, 0x012e,
+	0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804, 0x3369, 0x00ce, 0x0804,
+	0x336c, 0x080c, 0x9e32, 0x0cb0, 0xa830, 0x9086, 0x0100, 0x0904,
+	0x3369, 0x0804, 0x3337, 0x2061, 0x1a41, 0x0126, 0x2091, 0x8000,
+	0x6000, 0xd084, 0x0170, 0x6104, 0x6208, 0x2061, 0x1800, 0x6350,
+	0x6070, 0x789a, 0x60bc, 0x789e, 0x60b8, 0x78aa, 0x012e, 0x0804,
+	0x3337, 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904, 0x3369, 0x080c,
+	0x6fb2, 0x0904, 0x3369, 0x0126, 0x2091, 0x8000, 0x6250, 0x6070,
+	0x9202, 0x0248, 0x9085, 0x0001, 0x080c, 0x26cc, 0x080c, 0x55b4,
+	0x012e, 0x0804, 0x3337, 0x012e, 0x0804, 0x336c, 0x0006, 0x0016,
+	0x00c6, 0x00e6, 0x2001, 0x197a, 0x2070, 0x2061, 0x1853, 0x6008,
+	0x2072, 0x900e, 0x2011, 0x1400, 0x080c, 0x8270, 0x7206, 0x00ee,
+	0x00ce, 0x001e, 0x000e, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff,
+	0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x3339, 0x7884, 0xd0fc,
+	0x0148, 0x2001, 0x002a, 0x2004, 0x9082, 0x00e1, 0x0288, 0x012e,
+	0x0804, 0x336c, 0x2001, 0x002a, 0x2004, 0x2069, 0x1853, 0x6908,
+	0x9102, 0x1230, 0x012e, 0x0804, 0x336c, 0x012e, 0x0804, 0x3369,
+	0x080c, 0x9db1, 0x0dd0, 0x7884, 0xd0fc, 0x0904, 0x38d7, 0x00c6,
+	0x080c, 0x4879, 0x00ce, 0x0d88, 0xa867, 0x0000, 0x7884, 0xa80a,
+	0x7898, 0xa80e, 0x789c, 0xa812, 0x2001, 0x002e, 0x2004, 0xa81a,
+	0x2001, 0x002f, 0x2004, 0xa81e, 0x2001, 0x0030, 0x2004, 0xa822,
+	0x2001, 0x0031, 0x2004, 0xa826, 0x2001, 0x0034, 0x2004, 0xa82a,
+	0x2001, 0x0035, 0x2004, 0xa82e, 0x2001, 0x002a, 0x2004, 0x9080,
+	0x0003, 0x9084, 0x00fc, 0x8004, 0xa816, 0x080c, 0x3a5d, 0x0928,
+	0x7014, 0x2048, 0xad2c, 0xac28, 0xab1c, 0xaa18, 0xa930, 0xa808,
+	0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006,
+	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x080c,
+	0x48c2, 0x701f, 0x399a, 0x7023, 0x0001, 0x012e, 0x0005, 0x0046,
+	0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
+	0x080c, 0x3846, 0x2001, 0x1970, 0x2003, 0x0000, 0x2021, 0x000a,
+	0x2061, 0x0100, 0x6104, 0x0016, 0x60bb, 0x0000, 0x60bf, 0x32e1,
+	0x60bf, 0x0012, 0x080c, 0x3acc, 0x080c, 0x3a8b, 0x00f6, 0x00e6,
+	0x0086, 0x2940, 0x2071, 0x1a36, 0x2079, 0x0090, 0x00d6, 0x2069,
+	0x0000, 0x6884, 0xd0b4, 0x0140, 0x2001, 0x0035, 0x2004, 0x780e,
+	0x2001, 0x0034, 0x2004, 0x780a, 0x00de, 0x2011, 0x0001, 0x080c,
+	0x3e5f, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x3d8c, 0x080c, 0x3c91,
+	0x05b8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1db8, 0x080c,
+	0x3ed3, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe, 0x908c, 0x0070,
+	0x1560, 0x2071, 0x0200, 0x7037, 0x0000, 0x7050, 0x9084, 0xff00,
+	0x9086, 0x3200, 0x1510, 0x7037, 0x0001, 0x7050, 0x9084, 0xff00,
+	0x9086, 0xe100, 0x11d0, 0x7037, 0x0000, 0x7054, 0x7037, 0x0000,
+	0x715c, 0x9106, 0x1190, 0x2001, 0x181f, 0x2004, 0x9106, 0x1168,
+	0x00c6, 0x2061, 0x0100, 0x6024, 0x9084, 0x1e00, 0x00ce, 0x0138,
+	0x080c, 0x3c9b, 0x080c, 0x3a86, 0x0058, 0x080c, 0x3a86, 0x080c,
+	0x3df7, 0x080c, 0x3d82, 0x2001, 0x020b, 0x2004, 0xd0e4, 0x0dd8,
+	0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002,
+	0x001e, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x60bb, 0x0000,
+	0x60bf, 0x0108, 0x60bf, 0x0012, 0x2001, 0x0004, 0x200c, 0x918c,
+	0xfffd, 0x2102, 0x080c, 0x129f, 0x2009, 0x0028, 0x080c, 0x2268,
+	0x2001, 0x0227, 0x200c, 0x2102, 0x00fe, 0x00ee, 0x00de, 0x00ce,
+	0x00be, 0x00ae, 0x009e, 0x008e, 0x004e, 0x2001, 0x1970, 0x2004,
+	0x9005, 0x1118, 0x012e, 0x0804, 0x3337, 0x012e, 0x2021, 0x400c,
+	0x0804, 0x3339, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076,
+	0x0086, 0x0096, 0x00d6, 0x0156, 0x7014, 0x2048, 0x7020, 0x20a8,
+	0x8000, 0x7022, 0xa804, 0x9005, 0x0904, 0x39f6, 0x2048, 0x1f04,
+	0x39aa, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494, 0xa598, 0xa930,
+	0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x0096,
+	0x7014, 0x2048, 0xa864, 0x009e, 0x9086, 0x0103, 0x0170, 0x8906,
 	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b,
-	0x080c, 0x48bb, 0x701f, 0x3993, 0x7023, 0x0001, 0x012e, 0x0005,
-	0x0046, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6,
-	0x00f6, 0x080c, 0x383f, 0x2001, 0x1970, 0x2003, 0x0000, 0x2021,
-	0x000a, 0x2061, 0x0100, 0x6104, 0x0016, 0x60bb, 0x0000, 0x60bf,
-	0x32e1, 0x60bf, 0x0012, 0x080c, 0x3ac5, 0x080c, 0x3a84, 0x00f6,
-	0x00e6, 0x0086, 0x2940, 0x2071, 0x1a36, 0x2079, 0x0090, 0x00d6,
-	0x2069, 0x0000, 0x6884, 0xd0b4, 0x0140, 0x2001, 0x0035, 0x2004,
-	0x780e, 0x2001, 0x0034, 0x2004, 0x780a, 0x00de, 0x2011, 0x0001,
-	0x080c, 0x3e58, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x3d85, 0x080c,
-	0x3c8a, 0x05b8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1db8,
-	0x080c, 0x3ecc, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe, 0x908c,
-	0x0070, 0x1560, 0x2071, 0x0200, 0x7037, 0x0000, 0x7050, 0x9084,
-	0xff00, 0x9086, 0x3200, 0x1510, 0x7037, 0x0001, 0x7050, 0x9084,
-	0xff00, 0x9086, 0xe100, 0x11d0, 0x7037, 0x0000, 0x7054, 0x7037,
-	0x0000, 0x715c, 0x9106, 0x1190, 0x2001, 0x181f, 0x2004, 0x9106,
-	0x1168, 0x00c6, 0x2061, 0x0100, 0x6024, 0x9084, 0x1e00, 0x00ce,
-	0x0138, 0x080c, 0x3c94, 0x080c, 0x3a7f, 0x0058, 0x080c, 0x3a7f,
-	0x080c, 0x3df0, 0x080c, 0x3d7b, 0x2001, 0x020b, 0x2004, 0xd0e4,
-	0x0dd8, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027,
-	0x0002, 0x001e, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x60bb,
-	0x0000, 0x60bf, 0x0108, 0x60bf, 0x0012, 0x2001, 0x0004, 0x200c,
-	0x918c, 0xfffd, 0x2102, 0x080c, 0x129f, 0x2009, 0x0028, 0x080c,
-	0x2268, 0x2001, 0x0227, 0x200c, 0x2102, 0x00fe, 0x00ee, 0x00de,
-	0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x004e, 0x2001, 0x1970,
-	0x2004, 0x9005, 0x1118, 0x012e, 0x0804, 0x3330, 0x012e, 0x2021,
-	0x400c, 0x0804, 0x3332, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056,
-	0x0076, 0x0086, 0x0096, 0x00d6, 0x0156, 0x7014, 0x2048, 0x7020,
-	0x20a8, 0x8000, 0x7022, 0xa804, 0x9005, 0x0904, 0x39ef, 0x2048,
-	0x1f04, 0x39a3, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494, 0xa598,
-	0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000,
-	0x0096, 0x7014, 0x2048, 0xa864, 0x009e, 0x9086, 0x0103, 0x0170,
-	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-	0x001b, 0x080c, 0x48bb, 0x701f, 0x3993, 0x00b0, 0x8906, 0x8006,
-	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8,
-	0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0f68, 0x000e,
-	0x080c, 0x48be, 0x701f, 0x3993, 0x015e, 0x00de, 0x009e, 0x008e,
-	0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x7014,
-	0x2048, 0xa864, 0x9086, 0x0103, 0x1118, 0x701f, 0x3a54, 0x0450,
-	0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a, 0x2009, 0x007f, 0x080c,
-	0x61d7, 0x0110, 0x9006, 0x0030, 0xb813, 0x00ff, 0xb817, 0xfffd,
-	0x080c, 0xbfc2, 0x015e, 0x00de, 0x009e, 0x008e, 0x007e, 0x005e,
-	0x004e, 0x003e, 0x002e, 0x001e, 0x0904, 0x3362, 0x0016, 0x0026,
-	0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156,
-	0x701f, 0x3a26, 0x7007, 0x0003, 0x0804, 0x39e4, 0xa830, 0x9086,
-	0x0100, 0x2021, 0x400c, 0x0904, 0x3332, 0x0076, 0xad10, 0xac0c,
-	0xab24, 0xaa20, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000,
-	0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0,
-	0x0006, 0x080c, 0x0f68, 0x000e, 0x080c, 0x48be, 0x007e, 0x701f,
-	0x3993, 0x7023, 0x0001, 0x0005, 0x0804, 0x3330, 0x0156, 0x00c6,
-	0xa814, 0x908a, 0x001e, 0x0218, 0xa833, 0x001e, 0x0010, 0xa832,
-	0x0078, 0x81ff, 0x0168, 0x0016, 0x080c, 0x4872, 0x001e, 0x0130,
-	0xa800, 0x2040, 0xa008, 0xa80a, 0x2100, 0x0c58, 0x9006, 0x0010,
-	0x9085, 0x0001, 0x00ce, 0x015e, 0x0005, 0x0006, 0x00f6, 0x2079,
-	0x0000, 0x7880, 0x9086, 0x0044, 0x00fe, 0x000e, 0x0005, 0x2001,
-	0x1970, 0x2003, 0x0001, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x2061,
-	0x0200, 0x2001, 0x197b, 0x2004, 0x601a, 0x2061, 0x0100, 0x2001,
-	0x197a, 0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106, 0x080c, 0x4872,
-	0xa813, 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e,
-	0x2004, 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2061, 0x0090,
-	0x2079, 0x0100, 0x2001, 0x197a, 0x2004, 0x6036, 0x2009, 0x0040,
-	0x080c, 0x2268, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e,
-	0x601a, 0xa873, 0x0000, 0x601f, 0x0000, 0x78ca, 0x9006, 0x600a,
-	0x600e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6, 0x080c, 0x4872,
-	0x2940, 0xa013, 0x0019, 0xa017, 0x0001, 0x2800, 0xa05a, 0x2001,
-	0x0030, 0x2004, 0xa866, 0x2001, 0x0031, 0x2004, 0xa86a, 0x2001,
-	0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0xa873, 0x0000, 0x2001,
-	0x032a, 0x2003, 0x0004, 0x2001, 0x0300, 0x2003, 0x0000, 0x2001,
-	0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d, 0x0002,
-	0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0148,
-	0x080c, 0x2a55, 0x1130, 0x9006, 0x080c, 0x29ad, 0x9006, 0x080c,
-	0x2990, 0x7884, 0x9084, 0x0007, 0x0002, 0x3b10, 0x3b19, 0x3b22,
-	0x3b0d, 0x3b0d, 0x3b0d, 0x3b0d, 0x3b0d, 0x012e, 0x0804, 0x3365,
-	0x2009, 0x0114, 0x2104, 0x9085, 0x0800, 0x200a, 0x080c, 0x3cde,
-	0x00c0, 0x2009, 0x0114, 0x2104, 0x9085, 0x4000, 0x200a, 0x080c,
-	0x3cde, 0x0078, 0x080c, 0x6fa7, 0x1128, 0x012e, 0x2009, 0x0016,
-	0x0804, 0x3362, 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804,
-	0x3332, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6,
-	0x00f6, 0x080c, 0x383f, 0x2009, 0x0101, 0x210c, 0x0016, 0x7ec8,
-	0x7dcc, 0x9006, 0x2068, 0x2060, 0x2058, 0x080c, 0x3fa7, 0x080c,
-	0x3ef7, 0x903e, 0x2720, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071,
-	0x1a36, 0x2079, 0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4,
-	0x0120, 0x68d4, 0x780e, 0x68d0, 0x780a, 0x00de, 0x2011, 0x0001,
-	0x080c, 0x3e58, 0x080c, 0x2a5d, 0x080c, 0x2a5d, 0x080c, 0x2a5d,
-	0x080c, 0x2a5d, 0x080c, 0x3e58, 0x008e, 0x00ee, 0x00fe, 0x080c,
-	0x3d85, 0x2009, 0x9c40, 0x8109, 0x11b0, 0x080c, 0x3c94, 0x2001,
-	0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x001e, 0x00fe, 0x00ee,
-	0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x2009, 0x0017,
-	0x080c, 0x3362, 0x0cf8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140,
-	0x1d10, 0x00f6, 0x2079, 0x0000, 0x7884, 0x00fe, 0xd0bc, 0x0178,
-	0x2001, 0x0201, 0x200c, 0x81ff, 0x0150, 0x080c, 0x3d63, 0x2d00,
-	0x9c05, 0x9b05, 0x0120, 0x080c, 0x3c94, 0x0804, 0x3c41, 0x080c,
-	0x3ecc, 0x080c, 0x3df0, 0x080c, 0x3d46, 0x080c, 0x3d7b, 0x00f6,
-	0x2079, 0x0100, 0x7824, 0xd0ac, 0x0130, 0x8b58, 0x080c, 0x3c94,
-	0x00fe, 0x0804, 0x3c41, 0x00fe, 0x080c, 0x3c8a, 0x1150, 0x8d68,
-	0x2001, 0x0032, 0x2602, 0x2001, 0x0033, 0x2502, 0x080c, 0x3c94,
-	0x0080, 0x87ff, 0x0138, 0x2001, 0x0201, 0x2004, 0x9005, 0x1908,
-	0x8739, 0x0038, 0x2001, 0x1a33, 0x2004, 0x9086, 0x0000, 0x1904,
-	0x3b91, 0x2001, 0x032f, 0x2003, 0x00f6, 0x8631, 0x1208, 0x8529,
-	0x2500, 0x9605, 0x0904, 0x3c41, 0x7884, 0xd0bc, 0x0128, 0x2d00,
-	0x9c05, 0x9b05, 0x1904, 0x3c41, 0xa013, 0x0019, 0x2001, 0x032a,
-	0x2003, 0x0004, 0x7884, 0xd0ac, 0x1148, 0x2001, 0x1a33, 0x2003,
-	0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x0030, 0xa017, 0x0001,
-	0x78b4, 0x9005, 0x0108, 0xa016, 0x2800, 0xa05a, 0x2009, 0x0040,
-	0x080c, 0x2268, 0x2900, 0xa85a, 0xa813, 0x0019, 0x7884, 0xd0a4,
-	0x1180, 0xa817, 0x0000, 0x00c6, 0x20a9, 0x0004, 0x2061, 0x0090,
-	0x602b, 0x0008, 0x2001, 0x0203, 0x2004, 0x1f04, 0x3c18, 0x00ce,
-	0x0030, 0xa817, 0x0001, 0x78b0, 0x9005, 0x0108, 0xa816, 0x00f6,
-	0x00c6, 0x2079, 0x0100, 0x2061, 0x0090, 0x7827, 0x0002, 0x2001,
-	0x002a, 0x2004, 0x9084, 0xfff8, 0x601a, 0x0006, 0x2001, 0x002b,
-	0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca, 0x00ce, 0x00fe, 0x0804,
-	0x3b4b, 0x001e, 0x00c6, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061,
-	0x0100, 0x6027, 0x0002, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020,
-	0x2001, 0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x129f,
-	0x7884, 0x9084, 0x0003, 0x9086, 0x0002, 0x01a0, 0x2009, 0x0028,
-	0x080c, 0x2268, 0x2001, 0x0227, 0x200c, 0x2102, 0x6050, 0x9084,
-	0xb7ef, 0x6052, 0x602f, 0x0000, 0x604b, 0xf7f7, 0x6043, 0x0090,
-	0x6043, 0x0010, 0x00ce, 0x2d08, 0x2c10, 0x2b18, 0x2b00, 0x9c05,
-	0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
-	0x008e, 0x1118, 0x012e, 0x0804, 0x3330, 0x012e, 0x2021, 0x400c,
-	0x0804, 0x3332, 0x9085, 0x0001, 0x1d04, 0x3c93, 0x2091, 0x6000,
-	0x8420, 0x9486, 0x0064, 0x0005, 0x2001, 0x0105, 0x2003, 0x0010,
-	0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x1a33, 0x2003, 0x0000,
-	0x0071, 0x2009, 0x0048, 0x080c, 0x2268, 0x2001, 0x0227, 0x2024,
-	0x2402, 0x2001, 0x0109, 0x2003, 0x4000, 0x9026, 0x0005, 0x00f6,
-	0x00e6, 0x2071, 0x1a36, 0x7000, 0x9086, 0x0000, 0x0520, 0x2079,
-	0x0090, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106,
-	0x1120, 0x2009, 0x0040, 0x080c, 0x2268, 0x782c, 0xd0fc, 0x0d88,
-	0x080c, 0x3ecc, 0x7000, 0x9086, 0x0000, 0x1d58, 0x782b, 0x0004,
-	0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040, 0x080c, 0x2268, 0x782b,
-	0x0002, 0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079,
-	0x0100, 0x2001, 0x1817, 0x200c, 0x7932, 0x7936, 0x080c, 0x26ac,
-	0x7850, 0x9084, 0xfbff, 0x9085, 0x0030, 0x7852, 0x2019, 0x01f4,
-	0x8319, 0x1df0, 0x9084, 0xffcf, 0x9085, 0x2000, 0x7852, 0x20a9,
-	0x0046, 0x1d04, 0x3cf9, 0x2091, 0x6000, 0x1f04, 0x3cf9, 0x7850,
-	0x9085, 0x0400, 0x9084, 0xdfff, 0x7852, 0x2001, 0x0021, 0x2004,
-	0x9084, 0x0003, 0x9086, 0x0001, 0x1120, 0x7850, 0x9084, 0xdfff,
-	0x7852, 0x784b, 0xf7f7, 0x7843, 0x0090, 0x7843, 0x0010, 0x20a9,
-	0x0028, 0xa001, 0x1f04, 0x3d19, 0x7850, 0x9085, 0x1400, 0x7852,
-	0x2019, 0x61a8, 0x7854, 0xa001, 0xa001, 0xd08c, 0x1110, 0x8319,
-	0x1dc8, 0x7827, 0x0048, 0x7850, 0x9085, 0x0400, 0x7852, 0x7843,
-	0x0040, 0x2019, 0x01f4, 0xa001, 0xa001, 0x8319, 0x1de0, 0x2001,
-	0x0100, 0x080c, 0x2b14, 0x7827, 0x0020, 0x7843, 0x0000, 0x9006,
-	0x080c, 0x2b14, 0x7827, 0x0048, 0x00fe, 0x0005, 0x7884, 0xd0ac,
-	0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a33, 0x2079, 0x0320, 0x2001,
-	0x0201, 0x2004, 0x9005, 0x0160, 0x7000, 0x9086, 0x0000, 0x1140,
-	0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003, 0x0003, 0x782b, 0x0019,
-	0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe,
-	0x908c, 0x0070, 0x0178, 0x2009, 0x0032, 0x260a, 0x2009, 0x0033,
-	0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac, 0x0108, 0x8d68, 0xd0a4,
-	0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079, 0x0200, 0x781c, 0xd084,
-	0x0110, 0x7837, 0x0050, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0100,
-	0x2001, 0x197b, 0x2004, 0x70e2, 0x080c, 0x3a75, 0x1188, 0x2001,
-	0x181f, 0x2004, 0x2009, 0x181e, 0x210c, 0x918c, 0x00ff, 0x706e,
-	0x716a, 0x7066, 0x918d, 0x3200, 0x7162, 0x7073, 0xe109, 0x0080,
-	0x702c, 0x9085, 0x0002, 0x702e, 0x2009, 0x1817, 0x210c, 0x716e,
-	0x7063, 0x0100, 0x7166, 0x719e, 0x706b, 0x0000, 0x7073, 0x0809,
-	0x7077, 0x0008, 0x7078, 0x9080, 0x0100, 0x707a, 0x7080, 0x8000,
-	0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a, 0x708e, 0x707e, 0x70d6,
-	0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014, 0x9084, 0x1984, 0x9085,
-	0x0092, 0x7016, 0x080c, 0x3ecc, 0x00f6, 0x2071, 0x1a33, 0x2079,
-	0x0320, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x689c,
-	0x780e, 0x6898, 0x780a, 0x00de, 0x2009, 0x03e8, 0x8109, 0x1df0,
-	0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004, 0x2011, 0x0011, 0x080c,
-	0x3e58, 0x2011, 0x0001, 0x080c, 0x3e58, 0x00fe, 0x00ee, 0x0005,
-	0x00f6, 0x00e6, 0x2071, 0x1a33, 0x2079, 0x0320, 0x792c, 0xd1fc,
-	0x0904, 0x3e55, 0x782b, 0x0002, 0x9026, 0xd19c, 0x1904, 0x3e51,
-	0x7000, 0x0002, 0x3e55, 0x3e06, 0x3e36, 0x3e51, 0xd1bc, 0x1170,
-	0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011, 0x0001, 0x080c, 0x3e58,
-	0x0904, 0x3e55, 0x080c, 0x3e58, 0x0804, 0x3e55, 0x00f6, 0x2079,
-	0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810, 0x7914, 0x782b, 0x0004,
-	0x7812, 0x7916, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0de8, 0x080c,
-	0x3d63, 0x2009, 0x0001, 0x00f6, 0x2079, 0x0300, 0x78b8, 0x00fe,
-	0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a, 0x00f8, 0x8001, 0x7002,
-	0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc, 0x1904, 0x3dfa, 0x2011,
-	0x0001, 0x00b1, 0x0090, 0xa010, 0x9092, 0x0004, 0x9086, 0x0015,
-	0x1120, 0xa000, 0xa05a, 0x2011, 0x0031, 0xa212, 0xd1dc, 0x1960,
-	0x0828, 0x782b, 0x0004, 0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005,
-	0xa014, 0x9005, 0x0550, 0x8001, 0x0036, 0x0096, 0xa016, 0xa058,
-	0x2048, 0xa010, 0x2009, 0x0031, 0x911a, 0x831c, 0x831c, 0x938a,
-	0x0007, 0x1a0c, 0x0db4, 0x9398, 0x3e86, 0x231d, 0x083f, 0x9080,
-	0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102, 0x009e, 0x003e, 0x908a,
-	0x0035, 0x1140, 0x0096, 0xa058, 0x2048, 0xa804, 0xa05a, 0x2001,
-	0x0019, 0x009e, 0xa012, 0x9085, 0x0001, 0x0005, 0x3ec3, 0x3eba,
-	0x3eb1, 0x3ea8, 0x3e9f, 0x3e96, 0x3e8d, 0xa964, 0x7902, 0xa968,
-	0x7906, 0xa96c, 0x7912, 0xa970, 0x7916, 0x0005, 0xa974, 0x7902,
-	0xa978, 0x7906, 0xa97c, 0x7912, 0xa980, 0x7916, 0x0005, 0xa984,
-	0x7902, 0xa988, 0x7906, 0xa98c, 0x7912, 0xa990, 0x7916, 0x0005,
-	0xa994, 0x7902, 0xa998, 0x7906, 0xa99c, 0x7912, 0xa9a0, 0x7916,
-	0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906, 0xa9ac, 0x7912, 0xa9b0,
-	0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8, 0x7906, 0xa9bc, 0x7912,
-	0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902, 0xa9c8, 0x7906, 0xa9cc,
-	0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6, 0x00e6, 0x0086, 0x2071,
-	0x1a36, 0x2079, 0x0090, 0x792c, 0xd1fc, 0x01e8, 0x782b, 0x0002,
-	0x2940, 0x9026, 0x7000, 0x0002, 0x3ef3, 0x3edf, 0x3eea, 0x8001,
-	0x7002, 0xd19c, 0x1180, 0x2011, 0x0001, 0x080c, 0x3e58, 0x190c,
-	0x3e58, 0x0048, 0x8001, 0x7002, 0x782c, 0xd0fc, 0x1d38, 0x2011,
-	0x0001, 0x080c, 0x3e58, 0x008e, 0x00ee, 0x00fe, 0x0005, 0x00f6,
-	0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200, 0x2001, 0x197b, 0x2004,
-	0x601a, 0x2061, 0x0100, 0x2001, 0x197a, 0x2004, 0x60ce, 0x6104,
-	0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004, 0x9005, 0x0520, 0x2038,
-	0x2001, 0x002e, 0x2024, 0x2001, 0x002f, 0x201c, 0x080c, 0x4872,
-	0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220,
-	0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858,
-	0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x3f6f, 0x1d68,
-	0x2900, 0xa85a, 0x00d0, 0x080c, 0x4872, 0xa813, 0x0019, 0xa817,
-	0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001,
-	0x002f, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
-	0xa86e, 0x2001, 0x002b, 0x2004, 0xa872, 0x2061, 0x0090, 0x2079,
+	0x080c, 0x48c2, 0x701f, 0x399a, 0x00b0, 0x8906, 0x8006, 0x8007,
+	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0,
+	0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0f68, 0x000e, 0x080c,
+	0x48c5, 0x701f, 0x399a, 0x015e, 0x00de, 0x009e, 0x008e, 0x007e,
+	0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x7014, 0x2048,
+	0xa864, 0x9086, 0x0103, 0x1118, 0x701f, 0x3a5b, 0x0450, 0x7014,
+	0x2048, 0xa868, 0xc0fd, 0xa86a, 0x2009, 0x007f, 0x080c, 0x61de,
+	0x0110, 0x9006, 0x0030, 0xb813, 0x00ff, 0xb817, 0xfffd, 0x080c,
+	0xbfdb, 0x015e, 0x00de, 0x009e, 0x008e, 0x007e, 0x005e, 0x004e,
+	0x003e, 0x002e, 0x001e, 0x0904, 0x3369, 0x0016, 0x0026, 0x0036,
+	0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156, 0x701f,
+	0x3a2d, 0x7007, 0x0003, 0x0804, 0x39eb, 0xa830, 0x9086, 0x0100,
+	0x2021, 0x400c, 0x0904, 0x3339, 0x0076, 0xad10, 0xac0c, 0xab24,
+	0xaa20, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021,
+	0x0000, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006,
+	0x080c, 0x0f68, 0x000e, 0x080c, 0x48c5, 0x007e, 0x701f, 0x399a,
+	0x7023, 0x0001, 0x0005, 0x0804, 0x3337, 0x0156, 0x00c6, 0xa814,
+	0x908a, 0x001e, 0x0218, 0xa833, 0x001e, 0x0010, 0xa832, 0x0078,
+	0x81ff, 0x0168, 0x0016, 0x080c, 0x4879, 0x001e, 0x0130, 0xa800,
+	0x2040, 0xa008, 0xa80a, 0x2100, 0x0c58, 0x9006, 0x0010, 0x9085,
+	0x0001, 0x00ce, 0x015e, 0x0005, 0x0006, 0x00f6, 0x2079, 0x0000,
+	0x7880, 0x9086, 0x0044, 0x00fe, 0x000e, 0x0005, 0x2001, 0x1970,
+	0x2003, 0x0001, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x2061, 0x0200,
+	0x2001, 0x197b, 0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x197a,
+	0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106, 0x080c, 0x4879, 0xa813,
+	0x0019, 0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004,
+	0xa866, 0x2001, 0x002f, 0x2004, 0xa86a, 0x2061, 0x0090, 0x2079,
 	0x0100, 0x2001, 0x197a, 0x2004, 0x6036, 0x2009, 0x0040, 0x080c,
-	0x2268, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a, 0x0006,
-	0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca, 0x9006,
-	0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6,
-	0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0, 0x20e1, 0x0000, 0x2099,
-	0x0088, 0x702b, 0x0026, 0x7402, 0x7306, 0x9006, 0x700a, 0x700e,
-	0x810b, 0x810b, 0x21a8, 0x810b, 0x7112, 0x702b, 0x0041, 0x702c,
-	0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b, 0x0040, 0x4005, 0x7400,
-	0x7304, 0x87ff, 0x0190, 0x0086, 0x0096, 0x2940, 0x0086, 0x080c,
-	0x4872, 0x008e, 0xa058, 0x00a6, 0x2050, 0x2900, 0xb006, 0xa05a,
-	0x00ae, 0x009e, 0x008e, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6,
-	0x2001, 0x002d, 0x2004, 0x9005, 0x0528, 0x2038, 0x2001, 0x0030,
-	0x2024, 0x2001, 0x0031, 0x201c, 0x080c, 0x4872, 0x2940, 0xa813,
+	0x2268, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0x601a,
+	0xa873, 0x0000, 0x601f, 0x0000, 0x78ca, 0x9006, 0x600a, 0x600e,
+	0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6, 0x080c, 0x4879, 0x2940,
+	0xa013, 0x0019, 0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030,
+	0x2004, 0xa866, 0x2001, 0x0031, 0x2004, 0xa86a, 0x2001, 0x002a,
+	0x2004, 0x9084, 0xfff8, 0xa86e, 0xa873, 0x0000, 0x2001, 0x032a,
+	0x2003, 0x0004, 0x2001, 0x0300, 0x2003, 0x0000, 0x2001, 0x020d,
+	0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d, 0x0002, 0x2102,
+	0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0148, 0x080c,
+	0x2a55, 0x1130, 0x9006, 0x080c, 0x29ad, 0x9006, 0x080c, 0x2990,
+	0x7884, 0x9084, 0x0007, 0x0002, 0x3b17, 0x3b20, 0x3b29, 0x3b14,
+	0x3b14, 0x3b14, 0x3b14, 0x3b14, 0x012e, 0x0804, 0x336c, 0x2009,
+	0x0114, 0x2104, 0x9085, 0x0800, 0x200a, 0x080c, 0x3ce5, 0x00c0,
+	0x2009, 0x0114, 0x2104, 0x9085, 0x4000, 0x200a, 0x080c, 0x3ce5,
+	0x0078, 0x080c, 0x6fb2, 0x1128, 0x012e, 0x2009, 0x0016, 0x0804,
+	0x3369, 0x81ff, 0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x3339,
+	0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
+	0x080c, 0x3846, 0x2009, 0x0101, 0x210c, 0x0016, 0x7ec8, 0x7dcc,
+	0x9006, 0x2068, 0x2060, 0x2058, 0x080c, 0x3fae, 0x080c, 0x3efe,
+	0x903e, 0x2720, 0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x1a36,
+	0x2079, 0x0090, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120,
+	0x68d4, 0x780e, 0x68d0, 0x780a, 0x00de, 0x2011, 0x0001, 0x080c,
+	0x3e5f, 0x080c, 0x2a5d, 0x080c, 0x2a5d, 0x080c, 0x2a5d, 0x080c,
+	0x2a5d, 0x080c, 0x3e5f, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x3d8c,
+	0x2009, 0x9c40, 0x8109, 0x11b0, 0x080c, 0x3c9b, 0x2001, 0x0004,
+	0x200c, 0x918c, 0xfffd, 0x2102, 0x001e, 0x00fe, 0x00ee, 0x00de,
+	0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x2009, 0x0017, 0x080c,
+	0x3369, 0x0cf8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1d10,
+	0x00f6, 0x2079, 0x0000, 0x7884, 0x00fe, 0xd0bc, 0x0178, 0x2001,
+	0x0201, 0x200c, 0x81ff, 0x0150, 0x080c, 0x3d6a, 0x2d00, 0x9c05,
+	0x9b05, 0x0120, 0x080c, 0x3c9b, 0x0804, 0x3c48, 0x080c, 0x3ed3,
+	0x080c, 0x3df7, 0x080c, 0x3d4d, 0x080c, 0x3d82, 0x00f6, 0x2079,
+	0x0100, 0x7824, 0xd0ac, 0x0130, 0x8b58, 0x080c, 0x3c9b, 0x00fe,
+	0x0804, 0x3c48, 0x00fe, 0x080c, 0x3c91, 0x1150, 0x8d68, 0x2001,
+	0x0032, 0x2602, 0x2001, 0x0033, 0x2502, 0x080c, 0x3c9b, 0x0080,
+	0x87ff, 0x0138, 0x2001, 0x0201, 0x2004, 0x9005, 0x1908, 0x8739,
+	0x0038, 0x2001, 0x1a33, 0x2004, 0x9086, 0x0000, 0x1904, 0x3b98,
+	0x2001, 0x032f, 0x2003, 0x00f6, 0x8631, 0x1208, 0x8529, 0x2500,
+	0x9605, 0x0904, 0x3c48, 0x7884, 0xd0bc, 0x0128, 0x2d00, 0x9c05,
+	0x9b05, 0x1904, 0x3c48, 0xa013, 0x0019, 0x2001, 0x032a, 0x2003,
+	0x0004, 0x7884, 0xd0ac, 0x1148, 0x2001, 0x1a33, 0x2003, 0x0003,
+	0x2001, 0x032a, 0x2003, 0x0009, 0x0030, 0xa017, 0x0001, 0x78b4,
+	0x9005, 0x0108, 0xa016, 0x2800, 0xa05a, 0x2009, 0x0040, 0x080c,
+	0x2268, 0x2900, 0xa85a, 0xa813, 0x0019, 0x7884, 0xd0a4, 0x1180,
+	0xa817, 0x0000, 0x00c6, 0x20a9, 0x0004, 0x2061, 0x0090, 0x602b,
+	0x0008, 0x2001, 0x0203, 0x2004, 0x1f04, 0x3c1f, 0x00ce, 0x0030,
+	0xa817, 0x0001, 0x78b0, 0x9005, 0x0108, 0xa816, 0x00f6, 0x00c6,
+	0x2079, 0x0100, 0x2061, 0x0090, 0x7827, 0x0002, 0x2001, 0x002a,
+	0x2004, 0x9084, 0xfff8, 0x601a, 0x0006, 0x2001, 0x002b, 0x2004,
+	0x601e, 0x78c6, 0x000e, 0x78ca, 0x00ce, 0x00fe, 0x0804, 0x3b52,
+	0x001e, 0x00c6, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100,
+	0x6027, 0x0002, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x2001,
+	0x0004, 0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x129f, 0x7884,
+	0x9084, 0x0003, 0x9086, 0x0002, 0x01a0, 0x2009, 0x0028, 0x080c,
+	0x2268, 0x2001, 0x0227, 0x200c, 0x2102, 0x6050, 0x9084, 0xb7ef,
+	0x6052, 0x602f, 0x0000, 0x604b, 0xf7f7, 0x6043, 0x0090, 0x6043,
+	0x0010, 0x00ce, 0x2d08, 0x2c10, 0x2b18, 0x2b00, 0x9c05, 0x9d05,
+	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e,
+	0x1118, 0x012e, 0x0804, 0x3337, 0x012e, 0x2021, 0x400c, 0x0804,
+	0x3339, 0x9085, 0x0001, 0x1d04, 0x3c9a, 0x2091, 0x6000, 0x8420,
+	0x9486, 0x0064, 0x0005, 0x2001, 0x0105, 0x2003, 0x0010, 0x2001,
+	0x032a, 0x2003, 0x0004, 0x2001, 0x1a33, 0x2003, 0x0000, 0x0071,
+	0x2009, 0x0048, 0x080c, 0x2268, 0x2001, 0x0227, 0x2024, 0x2402,
+	0x2001, 0x0109, 0x2003, 0x4000, 0x9026, 0x0005, 0x00f6, 0x00e6,
+	0x2071, 0x1a36, 0x7000, 0x9086, 0x0000, 0x0520, 0x2079, 0x0090,
+	0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106, 0x1120,
+	0x2009, 0x0040, 0x080c, 0x2268, 0x782c, 0xd0fc, 0x0d88, 0x080c,
+	0x3ed3, 0x7000, 0x9086, 0x0000, 0x1d58, 0x782b, 0x0004, 0x782c,
+	0xd0ac, 0x1de8, 0x2009, 0x0040, 0x080c, 0x2268, 0x782b, 0x0002,
+	0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0100,
+	0x2001, 0x1817, 0x200c, 0x7932, 0x7936, 0x080c, 0x26ac, 0x7850,
+	0x9084, 0xfbff, 0x9085, 0x0030, 0x7852, 0x2019, 0x01f4, 0x8319,
+	0x1df0, 0x9084, 0xffcf, 0x9085, 0x2000, 0x7852, 0x20a9, 0x0046,
+	0x1d04, 0x3d00, 0x2091, 0x6000, 0x1f04, 0x3d00, 0x7850, 0x9085,
+	0x0400, 0x9084, 0xdfff, 0x7852, 0x2001, 0x0021, 0x2004, 0x9084,
+	0x0003, 0x9086, 0x0001, 0x1120, 0x7850, 0x9084, 0xdfff, 0x7852,
+	0x784b, 0xf7f7, 0x7843, 0x0090, 0x7843, 0x0010, 0x20a9, 0x0028,
+	0xa001, 0x1f04, 0x3d20, 0x7850, 0x9085, 0x1400, 0x7852, 0x2019,
+	0x61a8, 0x7854, 0xa001, 0xa001, 0xd08c, 0x1110, 0x8319, 0x1dc8,
+	0x7827, 0x0048, 0x7850, 0x9085, 0x0400, 0x7852, 0x7843, 0x0040,
+	0x2019, 0x01f4, 0xa001, 0xa001, 0x8319, 0x1de0, 0x2001, 0x0100,
+	0x080c, 0x2b14, 0x7827, 0x0020, 0x7843, 0x0000, 0x9006, 0x080c,
+	0x2b14, 0x7827, 0x0048, 0x00fe, 0x0005, 0x7884, 0xd0ac, 0x11c8,
+	0x00f6, 0x00e6, 0x2071, 0x1a33, 0x2079, 0x0320, 0x2001, 0x0201,
+	0x2004, 0x9005, 0x0160, 0x7000, 0x9086, 0x0000, 0x1140, 0x0051,
+	0xd0bc, 0x0108, 0x8738, 0x7003, 0x0003, 0x782b, 0x0019, 0x00ee,
+	0x00fe, 0x0005, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe, 0x908c,
+	0x0070, 0x0178, 0x2009, 0x0032, 0x260a, 0x2009, 0x0033, 0x250a,
+	0xd0b4, 0x0108, 0x8c60, 0xd0ac, 0x0108, 0x8d68, 0xd0a4, 0x0108,
+	0x8b58, 0x0005, 0x00f6, 0x2079, 0x0200, 0x781c, 0xd084, 0x0110,
+	0x7837, 0x0050, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0100, 0x2001,
+	0x197b, 0x2004, 0x70e2, 0x080c, 0x3a7c, 0x1188, 0x2001, 0x181f,
+	0x2004, 0x2009, 0x181e, 0x210c, 0x918c, 0x00ff, 0x706e, 0x716a,
+	0x7066, 0x918d, 0x3200, 0x7162, 0x7073, 0xe109, 0x0080, 0x702c,
+	0x9085, 0x0002, 0x702e, 0x2009, 0x1817, 0x210c, 0x716e, 0x7063,
+	0x0100, 0x7166, 0x719e, 0x706b, 0x0000, 0x7073, 0x0809, 0x7077,
+	0x0008, 0x7078, 0x9080, 0x0100, 0x707a, 0x7080, 0x8000, 0x7082,
+	0x7087, 0xaaaa, 0x9006, 0x708a, 0x708e, 0x707e, 0x70d6, 0x70ab,
+	0x0036, 0x70af, 0x95d5, 0x7014, 0x9084, 0x1984, 0x9085, 0x0092,
+	0x7016, 0x080c, 0x3ed3, 0x00f6, 0x2071, 0x1a33, 0x2079, 0x0320,
+	0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x689c, 0x780e,
+	0x6898, 0x780a, 0x00de, 0x2009, 0x03e8, 0x8109, 0x1df0, 0x792c,
+	0xd1fc, 0x0110, 0x782b, 0x0004, 0x2011, 0x0011, 0x080c, 0x3e5f,
+	0x2011, 0x0001, 0x080c, 0x3e5f, 0x00fe, 0x00ee, 0x0005, 0x00f6,
+	0x00e6, 0x2071, 0x1a33, 0x2079, 0x0320, 0x792c, 0xd1fc, 0x0904,
+	0x3e5c, 0x782b, 0x0002, 0x9026, 0xd19c, 0x1904, 0x3e58, 0x7000,
+	0x0002, 0x3e5c, 0x3e0d, 0x3e3d, 0x3e58, 0xd1bc, 0x1170, 0xd1dc,
+	0x1190, 0x8001, 0x7002, 0x2011, 0x0001, 0x080c, 0x3e5f, 0x0904,
+	0x3e5c, 0x080c, 0x3e5f, 0x0804, 0x3e5c, 0x00f6, 0x2079, 0x0300,
+	0x78bf, 0x0000, 0x00fe, 0x7810, 0x7914, 0x782b, 0x0004, 0x7812,
+	0x7916, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0de8, 0x080c, 0x3d6a,
+	0x2009, 0x0001, 0x00f6, 0x2079, 0x0300, 0x78b8, 0x00fe, 0xd0ec,
+	0x0110, 0x2009, 0x0011, 0x792a, 0x00f8, 0x8001, 0x7002, 0x9184,
+	0x0880, 0x1140, 0x782c, 0xd0fc, 0x1904, 0x3e01, 0x2011, 0x0001,
+	0x00b1, 0x0090, 0xa010, 0x9092, 0x0004, 0x9086, 0x0015, 0x1120,
+	0xa000, 0xa05a, 0x2011, 0x0031, 0xa212, 0xd1dc, 0x1960, 0x0828,
+	0x782b, 0x0004, 0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005, 0xa014,
+	0x9005, 0x0550, 0x8001, 0x0036, 0x0096, 0xa016, 0xa058, 0x2048,
+	0xa010, 0x2009, 0x0031, 0x911a, 0x831c, 0x831c, 0x938a, 0x0007,
+	0x1a0c, 0x0db4, 0x9398, 0x3e8d, 0x231d, 0x083f, 0x9080, 0x0004,
+	0x7a2a, 0x7100, 0x8108, 0x7102, 0x009e, 0x003e, 0x908a, 0x0035,
+	0x1140, 0x0096, 0xa058, 0x2048, 0xa804, 0xa05a, 0x2001, 0x0019,
+	0x009e, 0xa012, 0x9085, 0x0001, 0x0005, 0x3eca, 0x3ec1, 0x3eb8,
+	0x3eaf, 0x3ea6, 0x3e9d, 0x3e94, 0xa964, 0x7902, 0xa968, 0x7906,
+	0xa96c, 0x7912, 0xa970, 0x7916, 0x0005, 0xa974, 0x7902, 0xa978,
+	0x7906, 0xa97c, 0x7912, 0xa980, 0x7916, 0x0005, 0xa984, 0x7902,
+	0xa988, 0x7906, 0xa98c, 0x7912, 0xa990, 0x7916, 0x0005, 0xa994,
+	0x7902, 0xa998, 0x7906, 0xa99c, 0x7912, 0xa9a0, 0x7916, 0x0005,
+	0xa9a4, 0x7902, 0xa9a8, 0x7906, 0xa9ac, 0x7912, 0xa9b0, 0x7916,
+	0x0005, 0xa9b4, 0x7902, 0xa9b8, 0x7906, 0xa9bc, 0x7912, 0xa9c0,
+	0x7916, 0x0005, 0xa9c4, 0x7902, 0xa9c8, 0x7906, 0xa9cc, 0x7912,
+	0xa9d0, 0x7916, 0x0005, 0x00f6, 0x00e6, 0x0086, 0x2071, 0x1a36,
+	0x2079, 0x0090, 0x792c, 0xd1fc, 0x01e8, 0x782b, 0x0002, 0x2940,
+	0x9026, 0x7000, 0x0002, 0x3efa, 0x3ee6, 0x3ef1, 0x8001, 0x7002,
+	0xd19c, 0x1180, 0x2011, 0x0001, 0x080c, 0x3e5f, 0x190c, 0x3e5f,
+	0x0048, 0x8001, 0x7002, 0x782c, 0xd0fc, 0x1d38, 0x2011, 0x0001,
+	0x080c, 0x3e5f, 0x008e, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x00e6,
+	0x00c6, 0x0086, 0x2061, 0x0200, 0x2001, 0x197b, 0x2004, 0x601a,
+	0x2061, 0x0100, 0x2001, 0x197a, 0x2004, 0x60ce, 0x6104, 0xc1ac,
+	0x6106, 0x2001, 0x002c, 0x2004, 0x9005, 0x0520, 0x2038, 0x2001,
+	0x002e, 0x2024, 0x2001, 0x002f, 0x201c, 0x080c, 0x4879, 0xa813,
 	0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220, 0x2138,
 	0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858, 0x2048,
-	0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x3f6f, 0x1d68, 0x2900,
-	0xa85a, 0x00d8, 0x080c, 0x4872, 0x2940, 0xa013, 0x0019, 0xa017,
-	0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa066, 0x2001,
-	0x0031, 0x2004, 0xa06a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
-	0xa06e, 0x2001, 0x002b, 0x2004, 0xa072, 0x2001, 0x032a, 0x2003,
-	0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001, 0x0101, 0x200c, 0x918d,
-	0x0200, 0x2102, 0xa017, 0x0000, 0x2001, 0x1a33, 0x2003, 0x0003,
-	0x2001, 0x032a, 0x2003, 0x0009, 0x2001, 0x0300, 0x2003, 0x0000,
-	0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d,
-	0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x20a9,
-	0x0013, 0x20a1, 0x1840, 0x20e9, 0x0001, 0x9006, 0x4004, 0x2009,
-	0x013c, 0x200a, 0x012e, 0x7880, 0x9086, 0x0052, 0x0108, 0x0005,
-	0x0804, 0x3330, 0x7d98, 0x7c9c, 0x0804, 0x3427, 0x080c, 0x6fa7,
-	0x190c, 0x5c8f, 0x2069, 0x1853, 0x2d00, 0x2009, 0x0030, 0x7a8c,
-	0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x48bb, 0x701f,
-	0x4042, 0x0005, 0x080c, 0x538e, 0x1130, 0x3b00, 0x3a08, 0xc194,
-	0xc095, 0x20d8, 0x21d0, 0x2069, 0x1853, 0x6800, 0x9005, 0x0904,
-	0x3365, 0x6804, 0xd094, 0x00c6, 0x2061, 0x0100, 0x6104, 0x0138,
-	0x6200, 0x9292, 0x0005, 0x0218, 0x918c, 0xffdf, 0x0010, 0x918d,
-	0x0020, 0x6106, 0x00ce, 0xd08c, 0x00c6, 0x2061, 0x0100, 0x6104,
-	0x0118, 0x918d, 0x0010, 0x0010, 0x918c, 0xffef, 0x6106, 0x00ce,
-	0xd084, 0x0158, 0x6a28, 0x928a, 0x007f, 0x1a04, 0x3365, 0x9288,
-	0x3131, 0x210d, 0x918c, 0x00ff, 0x6162, 0xd0dc, 0x0130, 0x6828,
-	0x908a, 0x007f, 0x1a04, 0x3365, 0x605a, 0x6888, 0x9084, 0x0030,
-	0x8004, 0x8004, 0x8004, 0x8004, 0x0006, 0x2009, 0x1982, 0x9080,
-	0x279f, 0x2005, 0x200a, 0x000e, 0x2009, 0x1983, 0x9080, 0x27a3,
-	0x2005, 0x200a, 0x6808, 0x908a, 0x0100, 0x0a04, 0x3365, 0x908a,
-	0x0841, 0x1a04, 0x3365, 0x9084, 0x0007, 0x1904, 0x3365, 0x680c,
-	0x9005, 0x0904, 0x3365, 0x6810, 0x9005, 0x0904, 0x3365, 0x6848,
-	0x6940, 0x910a, 0x1a04, 0x3365, 0x8001, 0x0904, 0x3365, 0x684c,
-	0x6944, 0x910a, 0x1a04, 0x3365, 0x8001, 0x0904, 0x3365, 0x2009,
-	0x1952, 0x200b, 0x0000, 0x2001, 0x1875, 0x2004, 0xd0c4, 0x0140,
-	0x7884, 0x200a, 0x2009, 0x017f, 0x200a, 0x3b00, 0xc085, 0x20d8,
-	0x6814, 0x908c, 0x00ff, 0x614a, 0x8007, 0x9084, 0x00ff, 0x604e,
-	0x080c, 0x72bc, 0x080c, 0x6628, 0x080c, 0x665d, 0x6808, 0x602a,
-	0x080c, 0x21da, 0x2009, 0x0170, 0x200b, 0x0080, 0xa001, 0xa001,
-	0x200b, 0x0000, 0x0036, 0x6b08, 0x080c, 0x2706, 0x003e, 0x6000,
-	0x9086, 0x0000, 0x1904, 0x41bf, 0x6818, 0x691c, 0x6a20, 0x6b24,
-	0x8007, 0x810f, 0x8217, 0x831f, 0x6016, 0x611a, 0x621e, 0x6322,
-	0x6c04, 0xd4f4, 0x0148, 0x6830, 0x6934, 0x6a38, 0x6b3c, 0x8007,
-	0x810f, 0x8217, 0x831f, 0x0010, 0x9084, 0xf0ff, 0x6006, 0x610a,
-	0x620e, 0x6312, 0x8007, 0x810f, 0x8217, 0x831f, 0x20a9, 0x0004,
-	0x20a1, 0x1984, 0x20e9, 0x0001, 0x4001, 0x20a9, 0x0004, 0x20a1,
-	0x199e, 0x20e9, 0x0001, 0x4001, 0x080c, 0x8119, 0x00c6, 0x900e,
-	0x20a9, 0x0001, 0x6b70, 0xd384, 0x0510, 0x0068, 0x2009, 0x0100,
-	0x210c, 0x918e, 0x0008, 0x1110, 0x839d, 0x0010, 0x83f5, 0x3e18,
-	0x12b0, 0x3508, 0x8109, 0x080c, 0x7887, 0x6878, 0x6016, 0x6874,
-	0x2008, 0x9084, 0xff00, 0x8007, 0x600a, 0x9184, 0x00ff, 0x6006,
-	0x8108, 0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001, 0x1f04,
-	0x412e, 0x00ce, 0x00c6, 0x2061, 0x196d, 0x2063, 0x0001, 0x9006,
-	0x080c, 0x29ad, 0x9006, 0x080c, 0x2990, 0x0000, 0x00ce, 0x00e6,
-	0x2c70, 0x080c, 0x0e80, 0x00ee, 0x6888, 0xd0ec, 0x0130, 0x2011,
-	0x0114, 0x2204, 0x9085, 0x0100, 0x2012, 0x6a80, 0x9284, 0x0030,
-	0x9086, 0x0030, 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82,
-	0x2001, 0x194d, 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000, 0x0170,
-	0x928e, 0x0010, 0x0118, 0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa,
-	0x080c, 0x277b, 0x2001, 0x193e, 0x2102, 0x0008, 0x2102, 0x00c6,
-	0x2061, 0x0100, 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c,
-	0x6fa7, 0x0128, 0x080c, 0x4c8b, 0x0110, 0x080c, 0x26cc, 0x60d0,
-	0x9005, 0x01c0, 0x6003, 0x0001, 0x2009, 0x41a7, 0x00d0, 0x080c,
-	0x6fa7, 0x1168, 0x2011, 0x6e28, 0x080c, 0x8010, 0x2011, 0x6e1b,
-	0x080c, 0x80e4, 0x080c, 0x7290, 0x080c, 0x6ed9, 0x0040, 0x080c,
-	0x5b89, 0x0028, 0x6003, 0x0004, 0x2009, 0x41bf, 0x0010, 0x0804,
-	0x3330, 0x2001, 0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c,
-	0x1118, 0x2091, 0x30bd, 0x0817, 0x2091, 0x303d, 0x0817, 0x6000,
-	0x9086, 0x0000, 0x0904, 0x3362, 0x2069, 0x1853, 0x7890, 0x6842,
-	0x7894, 0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c,
-	0x7d98, 0x2039, 0x0001, 0x0804, 0x48be, 0x9006, 0x080c, 0x26cc,
-	0x81ff, 0x1904, 0x3362, 0x080c, 0x6fa7, 0x11b0, 0x080c, 0x728b,
-	0x080c, 0x5cca, 0x080c, 0x312c, 0x0118, 0x6130, 0xc18d, 0x6132,
-	0x080c, 0xc1f9, 0x0130, 0x080c, 0x6fca, 0x1118, 0x080c, 0x6f7f,
-	0x0038, 0x080c, 0x6ed9, 0x0020, 0x080c, 0x5c8f, 0x080c, 0x5b89,
-	0x0804, 0x3330, 0x81ff, 0x1904, 0x3362, 0x080c, 0x6fa7, 0x1110,
-	0x0804, 0x3362, 0x6190, 0x81ff, 0x01a8, 0x704f, 0x0000, 0x2001,
-	0x1c80, 0x2009, 0x0040, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0126,
-	0x2091, 0x8000, 0x2039, 0x0001, 0x080c, 0x48be, 0x701f, 0x332e,
-	0x012e, 0x0005, 0x704f, 0x0001, 0x00d6, 0x2069, 0x1c80, 0x20a9,
-	0x0040, 0x20e9, 0x0001, 0x20a1, 0x1c80, 0x2019, 0xffff, 0x4304,
-	0x6558, 0x9588, 0x3131, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e,
-	0x2011, 0x0002, 0x2100, 0x9506, 0x01a8, 0x080c, 0x6237, 0x1190,
-	0xb814, 0x821c, 0x0238, 0x9398, 0x1c80, 0x9085, 0xff00, 0x8007,
-	0x201a, 0x0038, 0x9398, 0x1c80, 0x2324, 0x94a4, 0xff00, 0x9405,
-	0x201a, 0x8210, 0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201,
-	0x8007, 0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1,
-	0x1c80, 0x2099, 0x1c80, 0x080c, 0x5c1a, 0x0804, 0x4217, 0x080c,
-	0x48a5, 0x0904, 0x3365, 0x080c, 0x4872, 0x1120, 0x2009, 0x0002,
-	0x0804, 0x3362, 0x080c, 0x537f, 0xd0b4, 0x0558, 0x7884, 0x908e,
-	0x007e, 0x0538, 0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508,
-	0x080c, 0x3127, 0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084,
-	0x00ff, 0x9086, 0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd,
-	0xa86a, 0x080c, 0xbcc7, 0x1120, 0x2009, 0x0003, 0x0804, 0x3362,
-	0x7007, 0x0003, 0x701f, 0x42a5, 0x0005, 0x080c, 0x48a5, 0x0904,
-	0x3365, 0x20a9, 0x002b, 0xb8b4, 0x20e0, 0xb8b8, 0x2098, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008,
-	0x9080, 0x0006, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006,
-	0x2098, 0x080c, 0x0f68, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080,
-	0x000a, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x000a, 0x2098,
-	0x080c, 0x0f68, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c,
-	0x7d98, 0x0804, 0x48be, 0x81ff, 0x1904, 0x3362, 0x080c, 0x4889,
-	0x0904, 0x3365, 0x080c, 0x63a9, 0x0904, 0x3362, 0x0058, 0xa878,
-	0x9005, 0x0120, 0x2009, 0x0004, 0x0804, 0x3362, 0xa974, 0xaa94,
-	0x0804, 0x3330, 0x080c, 0x5387, 0x0904, 0x3330, 0x701f, 0x42ef,
-	0x7007, 0x0003, 0x0005, 0x81ff, 0x1904, 0x3362, 0x7888, 0x908a,
-	0x1000, 0x1a04, 0x3365, 0x080c, 0x48a5, 0x0904, 0x3365, 0x080c,
-	0x655b, 0x0120, 0x080c, 0x6563, 0x1904, 0x3365, 0x080c, 0x642e,
-	0x0904, 0x3362, 0x2019, 0x0004, 0x900e, 0x080c, 0x63bb, 0x0904,
-	0x3362, 0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000,
-	0x12f8, 0x080c, 0x48a3, 0x01e0, 0x080c, 0x655b, 0x0118, 0x080c,
-	0x6563, 0x11b0, 0x080c, 0x642e, 0x2009, 0x0002, 0x0168, 0x2009,
-	0x0002, 0x2019, 0x0004, 0x080c, 0x63bb, 0x2009, 0x0003, 0x0120,
-	0xa998, 0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010,
-	0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005,
-	0xa897, 0x4000, 0x080c, 0x5387, 0x0110, 0x9006, 0x0018, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110,
-	0x0071, 0x0060, 0x2029, 0x007e, 0x2061, 0x1800, 0x6458, 0x2400,
-	0x9506, 0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c,
-	0x6237, 0x1138, 0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c,
-	0x801e, 0x0005, 0x81ff, 0x1904, 0x3362, 0x798c, 0x2001, 0x1951,
-	0x918c, 0x8000, 0x2102, 0x080c, 0x4889, 0x0904, 0x3365, 0x080c,
-	0x655b, 0x0120, 0x080c, 0x6563, 0x1904, 0x3365, 0x080c, 0x62fe,
-	0x0904, 0x3362, 0x080c, 0x63b2, 0x0904, 0x3362, 0x2001, 0x1951,
-	0x2004, 0xd0fc, 0x1904, 0x3330, 0x0804, 0x42fa, 0xa9a0, 0x2001,
-	0x1951, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4896, 0x01a0,
-	0x080c, 0x655b, 0x0118, 0x080c, 0x6563, 0x1170, 0x080c, 0x62fe,
-	0x2009, 0x0002, 0x0128, 0x080c, 0x63b2, 0x1170, 0x2009, 0x0003,
-	0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-	0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1951,
-	0x2004, 0xd0fc, 0x1128, 0x080c, 0x5387, 0x0110, 0x9006, 0x0018,
-	0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904,
-	0x3362, 0x798c, 0x2001, 0x1950, 0x918c, 0x8000, 0x2102, 0x080c,
-	0x4889, 0x0904, 0x3365, 0x080c, 0x655b, 0x0120, 0x080c, 0x6563,
-	0x1904, 0x3365, 0x080c, 0x62fe, 0x0904, 0x3362, 0x080c, 0x63a0,
-	0x0904, 0x3362, 0x2001, 0x1950, 0x2004, 0xd0fc, 0x1904, 0x3330,
-	0x0804, 0x42fa, 0xa9a0, 0x2001, 0x1950, 0x918c, 0x8000, 0xc18d,
-	0x2102, 0x080c, 0x4896, 0x01a0, 0x080c, 0x655b, 0x0118, 0x080c,
-	0x6563, 0x1170, 0x080c, 0x62fe, 0x2009, 0x0002, 0x0128, 0x080c,
-	0x63a0, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010,
-	0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005,
-	0xa897, 0x4000, 0x2001, 0x1950, 0x2004, 0xd0fc, 0x1128, 0x080c,
-	0x5387, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001,
-	0x0000, 0x0005, 0x6100, 0x0804, 0x3330, 0x080c, 0x48a5, 0x0904,
-	0x3365, 0x080c, 0x5393, 0x1904, 0x3362, 0x79a8, 0xd184, 0x1158,
-	0xb834, 0x8007, 0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f,
-	0xba28, 0x8217, 0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007,
-	0x789a, 0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0200,
-	0x0804, 0x3330, 0x78a8, 0x909c, 0x0003, 0xd0b4, 0x1148, 0x939a,
-	0x0003, 0x1a04, 0x3362, 0x6258, 0x7884, 0x9206, 0x1904, 0x44aa,
-	0x2031, 0x1848, 0x2009, 0x013c, 0x2136, 0x2001, 0x1840, 0x2009,
-	0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x0006,
-	0x78a8, 0x9084, 0x0080, 0x11c8, 0x0006, 0x0036, 0x2001, 0x1a4f,
-	0x201c, 0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a50, 0x201c, 0x7b9e,
-	0x2003, 0x0000, 0x2001, 0x1a51, 0x201c, 0x7ba2, 0x2003, 0x0000,
-	0x003e, 0x000e, 0x000e, 0x0804, 0x48be, 0x000e, 0x2031, 0x0000,
-	0x2061, 0x18ae, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e,
-	0xa392, 0xa496, 0xa59a, 0x080c, 0x10d5, 0x7007, 0x0002, 0x701f,
-	0x44ca, 0x0005, 0x81ff, 0x1904, 0x3362, 0x080c, 0x48a5, 0x0904,
-	0x3365, 0x080c, 0x655b, 0x1904, 0x3362, 0x00c6, 0x080c, 0x4872,
-	0x00ce, 0x0904, 0x3362, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
-	0x7ea8, 0x080c, 0xbc6d, 0x0904, 0x3362, 0x7007, 0x0003, 0x701f,
-	0x44e4, 0x0005, 0x080c, 0x4014, 0x0006, 0x0036, 0x2001, 0x1a4f,
-	0x201c, 0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a50, 0x201c, 0x7b9e,
-	0x2003, 0x0000, 0x2001, 0x1a51, 0x201c, 0x7ba2, 0x2003, 0x0000,
-	0x003e, 0x000e, 0x0804, 0x3330, 0xa830, 0x9086, 0x0100, 0x0904,
-	0x3362, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-	0x9080, 0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0x0804, 0x48be, 0x9006, 0x080c, 0x26cc, 0x78a8, 0x9084, 0x00ff,
-	0x9086, 0x00ff, 0x0118, 0x81ff, 0x1904, 0x3362, 0x080c, 0x6fa7,
-	0x0110, 0x080c, 0x5c8f, 0x7888, 0x908a, 0x1000, 0x1a04, 0x3365,
-	0x7984, 0x9186, 0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04, 0x3365,
-	0x2100, 0x080c, 0x2696, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x2061, 0x19cb, 0x601b, 0x0000, 0x601f, 0x0000, 0x6073, 0x0000,
-	0x6077, 0x0000, 0x080c, 0x6fa7, 0x1158, 0x080c, 0x728b, 0x080c,
-	0x5cca, 0x9085, 0x0001, 0x080c, 0x6fee, 0x080c, 0x6ed9, 0x00d0,
-	0x080c, 0x9d9f, 0x2061, 0x0100, 0x2001, 0x1817, 0x2004, 0x9084,
-	0x00ff, 0x810f, 0x9105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010,
-	0x2009, 0x196a, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5bb5,
-	0x080c, 0x80a2, 0x7984, 0x080c, 0x6fa7, 0x1110, 0x2009, 0x00ff,
-	0x7a88, 0x080c, 0x435d, 0x012e, 0x00ce, 0x002e, 0x0804, 0x3330,
-	0x7984, 0x080c, 0x61d7, 0x2b08, 0x1904, 0x3365, 0x0804, 0x3330,
-	0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x3362, 0x60d8, 0xd0ac,
-	0x1130, 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x3362, 0x080c,
-	0x4872, 0x1120, 0x2009, 0x0002, 0x0804, 0x3362, 0x7984, 0x9192,
-	0x0021, 0x1a04, 0x3365, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c,
-	0x9080, 0x0019, 0x702a, 0xaf60, 0x7736, 0x080c, 0x48bb, 0x701f,
-	0x4598, 0x7880, 0x9086, 0x006e, 0x0110, 0x701f, 0x4e3d, 0x0005,
-	0x2009, 0x0080, 0x080c, 0x6237, 0x1118, 0x080c, 0x655b, 0x0120,
-	0x2021, 0x400a, 0x0804, 0x3332, 0x00d6, 0x0096, 0xa964, 0xaa6c,
-	0xab70, 0xac74, 0xad78, 0xae7c, 0xa884, 0x90be, 0x0100, 0x0904,
-	0x4631, 0x90be, 0x0112, 0x0904, 0x4631, 0x90be, 0x0113, 0x0904,
-	0x4631, 0x90be, 0x0114, 0x0904, 0x4631, 0x90be, 0x0117, 0x0904,
-	0x4631, 0x90be, 0x011a, 0x0904, 0x4631, 0x90be, 0x011c, 0x0904,
-	0x4631, 0x90be, 0x0121, 0x0904, 0x4618, 0x90be, 0x0131, 0x0904,
-	0x4618, 0x90be, 0x0171, 0x0904, 0x4631, 0x90be, 0x0173, 0x0904,
-	0x4631, 0x90be, 0x01a1, 0x1128, 0xa894, 0x8007, 0xa896, 0x0804,
-	0x463c, 0x90be, 0x0212, 0x0904, 0x4625, 0x90be, 0x0213, 0x05e8,
-	0x90be, 0x0214, 0x0500, 0x90be, 0x0217, 0x0188, 0x90be, 0x021a,
-	0x1120, 0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be, 0x021f, 0x05c8,
-	0x90be, 0x0300, 0x05b0, 0x009e, 0x00de, 0x0804, 0x3365, 0x7028,
-	0x9080, 0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9,
-	0x0007, 0x080c, 0x467a, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0,
-	0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x467a, 0x00c8,
-	0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8,
-	0x20a9, 0x0001, 0x080c, 0x4687, 0x00b8, 0x7028, 0x9080, 0x000e,
-	0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c,
-	0x4687, 0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0,
-	0x20e8, 0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c, 0x4872, 0x0550,
-	0xa868, 0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006, 0xa882, 0xa87f,
-	0x0020, 0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2, 0xaab6, 0xabba,
-	0xacbe, 0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e, 0x00de, 0xa866,
-	0xa822, 0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048, 0x080c, 0xbc88,
-	0x1120, 0x2009, 0x0003, 0x0804, 0x3362, 0x7007, 0x0003, 0x701f,
-	0x4671, 0x0005, 0x00ce, 0x009e, 0x00de, 0x2009, 0x0002, 0x0804,
-	0x3362, 0xa820, 0x9086, 0x8001, 0x1904, 0x3330, 0x2009, 0x0004,
-	0x0804, 0x3362, 0x0016, 0x0026, 0x3510, 0x20a9, 0x0002, 0x4002,
-	0x4104, 0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e, 0x0005, 0x0016,
-	0x0026, 0x0036, 0x0046, 0x3520, 0x20a9, 0x0004, 0x4002, 0x4304,
-	0x4204, 0x4104, 0x4004, 0x8421, 0x1db8, 0x004e, 0x003e, 0x002e,
-	0x001e, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x3362,
-	0x60d8, 0xd0ac, 0x1160, 0xd09c, 0x0120, 0x2009, 0x0016, 0x0804,
-	0x3362, 0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x3362, 0x7984,
-	0x78a8, 0x2040, 0x080c, 0x9d98, 0x1120, 0x9182, 0x007f, 0x0a04,
-	0x3365, 0x9186, 0x00ff, 0x0904, 0x3365, 0x9182, 0x0800, 0x1a04,
-	0x3365, 0x7a8c, 0x7b88, 0x6078, 0x9306, 0x1140, 0x607c, 0x924e,
-	0x0904, 0x3365, 0x99cc, 0xff00, 0x0904, 0x3365, 0x0126, 0x2091,
-	0x8000, 0x0026, 0x2011, 0x8008, 0x080c, 0x657f, 0x002e, 0x0140,
-	0x918d, 0x8000, 0x080c, 0x65c9, 0x1118, 0x2001, 0x4009, 0x0458,
-	0x080c, 0x478c, 0x0560, 0x90c6, 0x4000, 0x1170, 0x00c6, 0x0006,
-	0x900e, 0x080c, 0x6457, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0x000e, 0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110, 0x2408,
-	0x0090, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0060, 0x90c6,
-	0x4009, 0x1108, 0x0040, 0x90c6, 0x4006, 0x1108, 0x0020, 0x2001,
-	0x4005, 0x2009, 0x000a, 0x2020, 0x012e, 0x0804, 0x3332, 0x2b00,
-	0x7026, 0x0016, 0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c, 0x9e66,
-	0x0904, 0x4759, 0x2b00, 0x6012, 0x080c, 0xbf73, 0x2e58, 0x00ee,
-	0x00e6, 0x00c6, 0x080c, 0x4872, 0x00ce, 0x2b70, 0x1158, 0x080c,
-	0x9e19, 0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x2009, 0x0002,
-	0x0804, 0x3362, 0x900e, 0xa966, 0xa96a, 0x2900, 0x6016, 0xa932,
-	0xa868, 0xc0fd, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0x080c, 0x2fd7,
-	0x6023, 0x0001, 0x9006, 0x080c, 0x6174, 0x2001, 0x0002, 0x080c,
-	0x6188, 0x2009, 0x0002, 0x080c, 0x9e93, 0x78a8, 0xd094, 0x0138,
-	0x00ee, 0x7024, 0x00e6, 0x2058, 0xb8bc, 0xc08d, 0xb8be, 0x9085,
-	0x0001, 0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x1120, 0x2009,
-	0x0003, 0x0804, 0x3362, 0x7007, 0x0003, 0x701f, 0x4768, 0x0005,
-	0xa830, 0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804,
-	0x3332, 0x9086, 0x0100, 0x7024, 0x2058, 0x1138, 0x2009, 0x0004,
-	0xba04, 0x9294, 0x00ff, 0x0804, 0x52dc, 0x900e, 0xa868, 0xd0f4,
-	0x1904, 0x3330, 0x080c, 0x6457, 0x1108, 0xc185, 0xb800, 0xd0bc,
-	0x0108, 0xc18d, 0x0804, 0x3330, 0x00e6, 0x00d6, 0x0096, 0x83ff,
-	0x0904, 0x47d4, 0x902e, 0x080c, 0x9d98, 0x0130, 0x9026, 0x20a9,
-	0x0800, 0x2071, 0x1000, 0x0030, 0x2021, 0x007f, 0x20a9, 0x0781,
-	0x2071, 0x107f, 0x2e04, 0x9005, 0x11b0, 0x2100, 0x9406, 0x15e8,
-	0x2428, 0x94ce, 0x007f, 0x1120, 0x92ce, 0xfffd, 0x1528, 0x0030,
-	0x94ce, 0x0080, 0x1130, 0x92ce, 0xfffc, 0x11f0, 0x93ce, 0x00ff,
-	0x11d8, 0xc5fd, 0x0450, 0x2058, 0xbf10, 0x2700, 0x9306, 0x11b8,
-	0xbe14, 0x2600, 0x9206, 0x1198, 0x2400, 0x9106, 0x1150, 0xd884,
-	0x0568, 0xd894, 0x1558, 0x080c, 0x655b, 0x1540, 0x2001, 0x4000,
-	0x0430, 0x2001, 0x4007, 0x0418, 0x2001, 0x4006, 0x0400, 0x2400,
-	0x9106, 0x1158, 0xbe14, 0x87ff, 0x1128, 0x86ff, 0x0948, 0x080c,
-	0x9d98, 0x1930, 0x2001, 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04,
-	0x47a2, 0x85ff, 0x1130, 0x2001, 0x4009, 0x0048, 0x2001, 0x0001,
-	0x0030, 0x080c, 0x61d7, 0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005,
-	0x009e, 0x00de, 0x00ee, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001,
-	0x0804, 0x3362, 0x080c, 0x4872, 0x1120, 0x2009, 0x0002, 0x0804,
-	0x3362, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005,
-	0x0904, 0x3365, 0x9096, 0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04,
-	0x3365, 0x2010, 0x2918, 0x080c, 0x2f7d, 0x1120, 0x2009, 0x0003,
-	0x0804, 0x3362, 0x7007, 0x0003, 0x701f, 0x4827, 0x0005, 0xa830,
-	0x9086, 0x0100, 0x1904, 0x3330, 0x2009, 0x0004, 0x0804, 0x3362,
-	0x7984, 0x080c, 0x9d98, 0x1120, 0x9182, 0x007f, 0x0a04, 0x3365,
-	0x9186, 0x00ff, 0x0904, 0x3365, 0x9182, 0x0800, 0x1a04, 0x3365,
-	0x2001, 0x9000, 0x080c, 0x5337, 0x1904, 0x3362, 0x0804, 0x3330,
-	0xa998, 0x080c, 0x9d98, 0x1118, 0x9182, 0x007f, 0x0280, 0x9186,
-	0x00ff, 0x0168, 0x9182, 0x0800, 0x1250, 0x2001, 0x9000, 0x080c,
-	0x5337, 0x11a8, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
+	0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x3f76, 0x1d68, 0x2900,
+	0xa85a, 0x00d0, 0x080c, 0x4879, 0xa813, 0x0019, 0xa817, 0x0001,
+	0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f,
+	0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e,
+	0x2001, 0x002b, 0x2004, 0xa872, 0x2061, 0x0090, 0x2079, 0x0100,
+	0x2001, 0x197a, 0x2004, 0x6036, 0x2009, 0x0040, 0x080c, 0x2268,
+	0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a, 0x0006, 0x2001,
+	0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca, 0x9006, 0x600a,
+	0x600e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6, 0x2071,
+	0x0080, 0xaa60, 0x22e8, 0x20a0, 0x20e1, 0x0000, 0x2099, 0x0088,
+	0x702b, 0x0026, 0x7402, 0x7306, 0x9006, 0x700a, 0x700e, 0x810b,
+	0x810b, 0x21a8, 0x810b, 0x7112, 0x702b, 0x0041, 0x702c, 0xd0fc,
+	0x0de8, 0x702b, 0x0002, 0x702b, 0x0040, 0x4005, 0x7400, 0x7304,
+	0x87ff, 0x0190, 0x0086, 0x0096, 0x2940, 0x0086, 0x080c, 0x4879,
+	0x008e, 0xa058, 0x00a6, 0x2050, 0x2900, 0xb006, 0xa05a, 0x00ae,
+	0x009e, 0x008e, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x2001,
+	0x002d, 0x2004, 0x9005, 0x0528, 0x2038, 0x2001, 0x0030, 0x2024,
+	0x2001, 0x0031, 0x201c, 0x080c, 0x4879, 0x2940, 0xa813, 0x0019,
+	0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220, 0x2138, 0x2009,
+	0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858, 0x2048, 0xa85c,
+	0x9080, 0x0019, 0x009e, 0x080c, 0x3f76, 0x1d68, 0x2900, 0xa85a,
+	0x00d8, 0x080c, 0x4879, 0x2940, 0xa013, 0x0019, 0xa017, 0x0001,
+	0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa066, 0x2001, 0x0031,
+	0x2004, 0xa06a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa06e,
+	0x2001, 0x002b, 0x2004, 0xa072, 0x2001, 0x032a, 0x2003, 0x0004,
+	0x7884, 0xd0ac, 0x1180, 0x2001, 0x0101, 0x200c, 0x918d, 0x0200,
+	0x2102, 0xa017, 0x0000, 0x2001, 0x1a33, 0x2003, 0x0003, 0x2001,
+	0x032a, 0x2003, 0x0009, 0x2001, 0x0300, 0x2003, 0x0000, 0x2001,
+	0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d, 0x0002,
+	0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x20a9, 0x0013,
+	0x20a1, 0x1840, 0x20e9, 0x0001, 0x9006, 0x4004, 0x2009, 0x013c,
+	0x200a, 0x012e, 0x7880, 0x9086, 0x0052, 0x0108, 0x0005, 0x0804,
+	0x3337, 0x7d98, 0x7c9c, 0x0804, 0x342e, 0x080c, 0x6fb2, 0x190c,
+	0x5c96, 0x2069, 0x1853, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88,
+	0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x48c2, 0x701f, 0x4049,
+	0x0005, 0x080c, 0x5395, 0x1130, 0x3b00, 0x3a08, 0xc194, 0xc095,
+	0x20d8, 0x21d0, 0x2069, 0x1853, 0x6800, 0x9005, 0x0904, 0x336c,
+	0x6804, 0xd094, 0x00c6, 0x2061, 0x0100, 0x6104, 0x0138, 0x6200,
+	0x9292, 0x0005, 0x0218, 0x918c, 0xffdf, 0x0010, 0x918d, 0x0020,
+	0x6106, 0x00ce, 0xd08c, 0x00c6, 0x2061, 0x0100, 0x6104, 0x0118,
+	0x918d, 0x0010, 0x0010, 0x918c, 0xffef, 0x6106, 0x00ce, 0xd084,
+	0x0158, 0x6a28, 0x928a, 0x007f, 0x1a04, 0x336c, 0x9288, 0x3138,
+	0x210d, 0x918c, 0x00ff, 0x6162, 0xd0dc, 0x0130, 0x6828, 0x908a,
+	0x007f, 0x1a04, 0x336c, 0x605a, 0x6888, 0x9084, 0x0030, 0x8004,
+	0x8004, 0x8004, 0x8004, 0x0006, 0x2009, 0x1982, 0x9080, 0x279f,
+	0x2005, 0x200a, 0x000e, 0x2009, 0x1983, 0x9080, 0x27a3, 0x2005,
+	0x200a, 0x6808, 0x908a, 0x0100, 0x0a04, 0x336c, 0x908a, 0x0841,
+	0x1a04, 0x336c, 0x9084, 0x0007, 0x1904, 0x336c, 0x680c, 0x9005,
+	0x0904, 0x336c, 0x6810, 0x9005, 0x0904, 0x336c, 0x6848, 0x6940,
+	0x910a, 0x1a04, 0x336c, 0x8001, 0x0904, 0x336c, 0x684c, 0x6944,
+	0x910a, 0x1a04, 0x336c, 0x8001, 0x0904, 0x336c, 0x2009, 0x1952,
+	0x200b, 0x0000, 0x2001, 0x1875, 0x2004, 0xd0c4, 0x0140, 0x7884,
+	0x200a, 0x2009, 0x017f, 0x200a, 0x3b00, 0xc085, 0x20d8, 0x6814,
+	0x908c, 0x00ff, 0x614a, 0x8007, 0x9084, 0x00ff, 0x604e, 0x080c,
+	0x72c7, 0x080c, 0x662f, 0x080c, 0x6664, 0x6808, 0x602a, 0x080c,
+	0x21da, 0x2009, 0x0170, 0x200b, 0x0080, 0xa001, 0xa001, 0x200b,
+	0x0000, 0x0036, 0x6b08, 0x080c, 0x2706, 0x003e, 0x6000, 0x9086,
+	0x0000, 0x1904, 0x41c6, 0x6818, 0x691c, 0x6a20, 0x6b24, 0x8007,
+	0x810f, 0x8217, 0x831f, 0x6016, 0x611a, 0x621e, 0x6322, 0x6c04,
+	0xd4f4, 0x0148, 0x6830, 0x6934, 0x6a38, 0x6b3c, 0x8007, 0x810f,
+	0x8217, 0x831f, 0x0010, 0x9084, 0xf0ff, 0x6006, 0x610a, 0x620e,
+	0x6312, 0x8007, 0x810f, 0x8217, 0x831f, 0x20a9, 0x0004, 0x20a1,
+	0x1984, 0x20e9, 0x0001, 0x4001, 0x20a9, 0x0004, 0x20a1, 0x199e,
+	0x20e9, 0x0001, 0x4001, 0x080c, 0x8141, 0x00c6, 0x900e, 0x20a9,
+	0x0001, 0x6b70, 0xd384, 0x0510, 0x0068, 0x2009, 0x0100, 0x210c,
+	0x918e, 0x0008, 0x1110, 0x839d, 0x0010, 0x83f5, 0x3e18, 0x12b0,
+	0x3508, 0x8109, 0x080c, 0x7892, 0x6878, 0x6016, 0x6874, 0x2008,
+	0x9084, 0xff00, 0x8007, 0x600a, 0x9184, 0x00ff, 0x6006, 0x8108,
+	0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001, 0x1f04, 0x4135,
+	0x00ce, 0x00c6, 0x2061, 0x196d, 0x2063, 0x0001, 0x9006, 0x080c,
+	0x29ad, 0x9006, 0x080c, 0x2990, 0x0000, 0x00ce, 0x00e6, 0x2c70,
+	0x080c, 0x0e80, 0x00ee, 0x6888, 0xd0ec, 0x0130, 0x2011, 0x0114,
+	0x2204, 0x9085, 0x0100, 0x2012, 0x6a80, 0x9284, 0x0030, 0x9086,
+	0x0030, 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82, 0x2001,
+	0x194d, 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000, 0x0170, 0x928e,
+	0x0010, 0x0118, 0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa, 0x080c,
+	0x277b, 0x2001, 0x193e, 0x2102, 0x0008, 0x2102, 0x00c6, 0x2061,
+	0x0100, 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c, 0x6fb2,
+	0x0128, 0x080c, 0x4c92, 0x0110, 0x080c, 0x26cc, 0x60d0, 0x9005,
+	0x01c0, 0x6003, 0x0001, 0x2009, 0x41ae, 0x00d0, 0x080c, 0x6fb2,
+	0x1168, 0x2011, 0x6e33, 0x080c, 0x8038, 0x2011, 0x6e26, 0x080c,
+	0x810c, 0x080c, 0x729b, 0x080c, 0x6ee4, 0x0040, 0x080c, 0x5b90,
+	0x0028, 0x6003, 0x0004, 0x2009, 0x41c6, 0x0010, 0x0804, 0x3337,
+	0x2001, 0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c, 0x1118,
+	0x2091, 0x30bd, 0x0817, 0x2091, 0x303d, 0x0817, 0x6000, 0x9086,
+	0x0000, 0x0904, 0x3369, 0x2069, 0x1853, 0x7890, 0x6842, 0x7894,
+	0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
+	0x2039, 0x0001, 0x0804, 0x48c5, 0x9006, 0x080c, 0x26cc, 0x81ff,
+	0x1904, 0x3369, 0x080c, 0x6fb2, 0x11b0, 0x080c, 0x7296, 0x080c,
+	0x5cd1, 0x080c, 0x3133, 0x0118, 0x6130, 0xc18d, 0x6132, 0x080c,
+	0xc212, 0x0130, 0x080c, 0x6fd5, 0x1118, 0x080c, 0x6f8a, 0x0038,
+	0x080c, 0x6ee4, 0x0020, 0x080c, 0x5c96, 0x080c, 0x5b90, 0x0804,
+	0x3337, 0x81ff, 0x1904, 0x3369, 0x080c, 0x6fb2, 0x1110, 0x0804,
+	0x3369, 0x6190, 0x81ff, 0x01a8, 0x704f, 0x0000, 0x2001, 0x1c80,
+	0x2009, 0x0040, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0126, 0x2091,
+	0x8000, 0x2039, 0x0001, 0x080c, 0x48c5, 0x701f, 0x3335, 0x012e,
+	0x0005, 0x704f, 0x0001, 0x00d6, 0x2069, 0x1c80, 0x20a9, 0x0040,
+	0x20e9, 0x0001, 0x20a1, 0x1c80, 0x2019, 0xffff, 0x4304, 0x6558,
+	0x9588, 0x3138, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e, 0x2011,
+	0x0002, 0x2100, 0x9506, 0x01a8, 0x080c, 0x623e, 0x1190, 0xb814,
+	0x821c, 0x0238, 0x9398, 0x1c80, 0x9085, 0xff00, 0x8007, 0x201a,
+	0x0038, 0x9398, 0x1c80, 0x2324, 0x94a4, 0xff00, 0x9405, 0x201a,
+	0x8210, 0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201, 0x8007,
+	0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1, 0x1c80,
+	0x2099, 0x1c80, 0x080c, 0x5c21, 0x0804, 0x421e, 0x080c, 0x48ac,
+	0x0904, 0x336c, 0x080c, 0x4879, 0x1120, 0x2009, 0x0002, 0x0804,
+	0x3369, 0x080c, 0x5386, 0xd0b4, 0x0558, 0x7884, 0x908e, 0x007e,
+	0x0538, 0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508, 0x080c,
+	0x312e, 0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084, 0x00ff,
+	0x9086, 0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
+	0x080c, 0xbce0, 0x1120, 0x2009, 0x0003, 0x0804, 0x3369, 0x7007,
+	0x0003, 0x701f, 0x42ac, 0x0005, 0x080c, 0x48ac, 0x0904, 0x336c,
+	0x20a9, 0x002b, 0xb8b4, 0x20e0, 0xb8b8, 0x2098, 0xa860, 0x20e8,
+	0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080,
+	0x0006, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098,
+	0x080c, 0x0f68, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x000a,
+	0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x000a, 0x2098, 0x080c,
+	0x0f68, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
+	0x0804, 0x48c5, 0x81ff, 0x1904, 0x3369, 0x080c, 0x4890, 0x0904,
+	0x336c, 0x080c, 0x63b0, 0x0904, 0x3369, 0x0058, 0xa878, 0x9005,
+	0x0120, 0x2009, 0x0004, 0x0804, 0x3369, 0xa974, 0xaa94, 0x0804,
+	0x3337, 0x080c, 0x538e, 0x0904, 0x3337, 0x701f, 0x42f6, 0x7007,
+	0x0003, 0x0005, 0x81ff, 0x1904, 0x3369, 0x7888, 0x908a, 0x1000,
+	0x1a04, 0x336c, 0x080c, 0x48ac, 0x0904, 0x336c, 0x080c, 0x6562,
+	0x0120, 0x080c, 0x656a, 0x1904, 0x336c, 0x080c, 0x6435, 0x0904,
+	0x3369, 0x2019, 0x0004, 0x900e, 0x080c, 0x63c2, 0x0904, 0x3369,
+	0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000, 0x12f8,
+	0x080c, 0x48aa, 0x01e0, 0x080c, 0x6562, 0x0118, 0x080c, 0x656a,
+	0x11b0, 0x080c, 0x6435, 0x2009, 0x0002, 0x0168, 0x2009, 0x0002,
+	0x2019, 0x0004, 0x080c, 0x63c2, 0x2009, 0x0003, 0x0120, 0xa998,
+	0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
+	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
+	0x4000, 0x080c, 0x538e, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110, 0x0071,
+	0x0060, 0x2029, 0x007e, 0x2061, 0x1800, 0x6458, 0x2400, 0x9506,
+	0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c, 0x623e,
+	0x1138, 0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x8046,
+	0x0005, 0x81ff, 0x1904, 0x3369, 0x798c, 0x2001, 0x1951, 0x918c,
+	0x8000, 0x2102, 0x080c, 0x4890, 0x0904, 0x336c, 0x080c, 0x6562,
+	0x0120, 0x080c, 0x656a, 0x1904, 0x336c, 0x080c, 0x6305, 0x0904,
+	0x3369, 0x080c, 0x63b9, 0x0904, 0x3369, 0x2001, 0x1951, 0x2004,
+	0xd0fc, 0x1904, 0x3337, 0x0804, 0x4301, 0xa9a0, 0x2001, 0x1951,
+	0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x489d, 0x01a0, 0x080c,
+	0x6562, 0x0118, 0x080c, 0x656a, 0x1170, 0x080c, 0x6305, 0x2009,
+	0x0002, 0x0128, 0x080c, 0x63b9, 0x1170, 0x2009, 0x0003, 0xa897,
+	0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001,
+	0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1951, 0x2004,
+	0xd0fc, 0x1128, 0x080c, 0x538e, 0x0110, 0x9006, 0x0018, 0x900e,
+	0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904, 0x3369,
+	0x798c, 0x2001, 0x1950, 0x918c, 0x8000, 0x2102, 0x080c, 0x4890,
+	0x0904, 0x336c, 0x080c, 0x6562, 0x0120, 0x080c, 0x656a, 0x1904,
+	0x336c, 0x080c, 0x6305, 0x0904, 0x3369, 0x080c, 0x63a7, 0x0904,
+	0x3369, 0x2001, 0x1950, 0x2004, 0xd0fc, 0x1904, 0x3337, 0x0804,
+	0x4301, 0xa9a0, 0x2001, 0x1950, 0x918c, 0x8000, 0xc18d, 0x2102,
+	0x080c, 0x489d, 0x01a0, 0x080c, 0x6562, 0x0118, 0x080c, 0x656a,
+	0x1170, 0x080c, 0x6305, 0x2009, 0x0002, 0x0128, 0x080c, 0x63a7,
+	0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
 	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
-	0x4000, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x2009,
-	0x000a, 0x0c48, 0x080c, 0x0feb, 0x0198, 0x9006, 0xa802, 0x7014,
-	0x9005, 0x1120, 0x2900, 0x7016, 0x701a, 0x0040, 0x7018, 0xa802,
-	0x0086, 0x2040, 0x2900, 0xa006, 0x701a, 0x008e, 0x9085, 0x0001,
-	0x0005, 0x7984, 0x080c, 0x6237, 0x1130, 0x7e88, 0x9684, 0x3fff,
-	0x9082, 0x4000, 0x0208, 0x905e, 0x8bff, 0x0005, 0xa998, 0x080c,
-	0x6237, 0x1130, 0xae9c, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208,
-	0x905e, 0x8bff, 0x0005, 0xae98, 0x0008, 0x7e84, 0x2608, 0x080c,
-	0x6237, 0x1108, 0x0008, 0x905e, 0x8bff, 0x0005, 0x0016, 0x7114,
-	0x81ff, 0x0128, 0x2148, 0xa904, 0x080c, 0x101d, 0x0cc8, 0x7116,
-	0x711a, 0x001e, 0x0005, 0x2031, 0x0001, 0x0010, 0x2031, 0x0000,
-	0x2061, 0x18ae, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e,
-	0xa392, 0xa496, 0xa59a, 0x080c, 0x10d5, 0x7007, 0x0002, 0x701f,
-	0x3330, 0x0005, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0000,
-	0x2001, 0x18a6, 0x2004, 0x9005, 0x1190, 0x0e04, 0x48ef, 0x7a36,
-	0x7833, 0x0012, 0x7a82, 0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001,
-	0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x0804, 0x4955, 0x0016,
-	0x0086, 0x0096, 0x00c6, 0x00e6, 0x2071, 0x1894, 0x7044, 0x9005,
-	0x1540, 0x7148, 0x9182, 0x0010, 0x0288, 0x7038, 0x2060, 0x080c,
-	0x0feb, 0x0904, 0x494d, 0xa84b, 0x0000, 0x2900, 0x7046, 0x2001,
-	0x0002, 0x9080, 0x1f26, 0x2005, 0xa846, 0x0098, 0x7038, 0x90e0,
-	0x0004, 0x2001, 0x18b0, 0x9c82, 0x18f0, 0x0210, 0x2061, 0x18b0,
-	0x2c00, 0x703a, 0x7148, 0x81ff, 0x1108, 0x703e, 0x8108, 0x714a,
-	0x0460, 0x7148, 0x8108, 0x714a, 0x7044, 0x2040, 0xa144, 0x2105,
-	0x0016, 0x908a, 0x0036, 0x1a0c, 0x0db4, 0x2060, 0x001e, 0x8108,
-	0x2105, 0x9005, 0xa146, 0x1520, 0x080c, 0x0feb, 0x1130, 0x8109,
-	0xa946, 0x7148, 0x8109, 0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a,
-	0xa046, 0x2800, 0xa802, 0x2900, 0xa006, 0x7046, 0x2001, 0x0002,
-	0x9080, 0x1f26, 0x2005, 0xa846, 0x0058, 0x2262, 0x6306, 0x640a,
-	0x00ee, 0x00ce, 0x009e, 0x008e, 0x001e, 0x012e, 0x00fe, 0x0005,
-	0x2c00, 0x9082, 0x001b, 0x0002, 0x4977, 0x4977, 0x4979, 0x4977,
-	0x4977, 0x4977, 0x497d, 0x4977, 0x4977, 0x4977, 0x4981, 0x4977,
-	0x4977, 0x4977, 0x4985, 0x4977, 0x4977, 0x4977, 0x4989, 0x4977,
-	0x4977, 0x4977, 0x498d, 0x4977, 0x4977, 0x4977, 0x4992, 0x080c,
-	0x0db4, 0xa276, 0xa37a, 0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e,
-	0x0878, 0xa296, 0xa39a, 0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae,
-	0x0838, 0xa2b6, 0xa3ba, 0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce,
-	0x0804, 0x4950, 0xa2d6, 0xa3da, 0xa4de, 0x0804, 0x4950, 0x00e6,
-	0x2071, 0x1894, 0x7048, 0x9005, 0x0904, 0x4a29, 0x0126, 0x2091,
-	0x8000, 0x0e04, 0x4a28, 0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096,
-	0x0086, 0x0076, 0x9006, 0x2038, 0x7040, 0x2048, 0x9005, 0x0500,
-	0xa948, 0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0db4, 0x2060,
-	0x001e, 0x8108, 0x2105, 0x9005, 0xa94a, 0x1904, 0x4a2b, 0xa804,
-	0x9005, 0x090c, 0x0db4, 0x7042, 0x2938, 0x2040, 0xa003, 0x0000,
-	0x2001, 0x0002, 0x9080, 0x1f26, 0x2005, 0xa04a, 0x0804, 0x4a2b,
-	0x703c, 0x2060, 0x2c14, 0x6304, 0x6408, 0x650c, 0x2200, 0x7836,
-	0x7833, 0x0012, 0x7882, 0x2300, 0x7886, 0x2400, 0x788a, 0x2091,
-	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x87ff,
-	0x0118, 0x2748, 0x080c, 0x101d, 0x7048, 0x8001, 0x704a, 0x9005,
-	0x1170, 0x7040, 0x2048, 0x9005, 0x0128, 0x080c, 0x101d, 0x9006,
-	0x7042, 0x7046, 0x703b, 0x18b0, 0x703f, 0x18b0, 0x0420, 0x7040,
-	0x9005, 0x1508, 0x7238, 0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004,
-	0x90fa, 0x18f0, 0x0210, 0x2001, 0x18b0, 0x703e, 0x00a0, 0x9006,
-	0x703e, 0x703a, 0x7044, 0x9005, 0x090c, 0x0db4, 0x2048, 0xa800,
-	0x9005, 0x1de0, 0x2900, 0x7042, 0x2001, 0x0002, 0x9080, 0x1f26,
-	0x2005, 0xa84a, 0x0000, 0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe,
-	0x012e, 0x00ee, 0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4a4a,
-	0x4a4a, 0x4a4c, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a51, 0x4a4a, 0x4a4a,
-	0x4a4a, 0x4a56, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a5b, 0x4a4a, 0x4a4a,
-	0x4a4a, 0x4a60, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a65, 0x4a4a, 0x4a4a,
-	0x4a4a, 0x4a6a, 0x080c, 0x0db4, 0xaa74, 0xab78, 0xac7c, 0x0804,
-	0x49d6, 0xaa84, 0xab88, 0xac8c, 0x0804, 0x49d6, 0xaa94, 0xab98,
-	0xac9c, 0x0804, 0x49d6, 0xaaa4, 0xaba8, 0xacac, 0x0804, 0x49d6,
-	0xaab4, 0xabb8, 0xacbc, 0x0804, 0x49d6, 0xaac4, 0xabc8, 0xaccc,
-	0x0804, 0x49d6, 0xaad4, 0xabd8, 0xacdc, 0x0804, 0x49d6, 0x0026,
-	0x080c, 0x537f, 0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c, 0x48d2,
-	0x002e, 0x0005, 0x81ff, 0x1904, 0x3362, 0x0126, 0x2091, 0x8000,
-	0x6030, 0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c, 0x6fa7, 0x1158,
-	0x080c, 0x728b, 0x080c, 0x5cca, 0x9085, 0x0001, 0x080c, 0x6fee,
-	0x080c, 0x6ed9, 0x0010, 0x080c, 0x5b89, 0x012e, 0x0804, 0x3330,
-	0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x3362, 0x080c, 0x5393,
-	0x0120, 0x2009, 0x0007, 0x0804, 0x3362, 0x080c, 0x6553, 0x0120,
-	0x2009, 0x0008, 0x0804, 0x3362, 0x0026, 0x2011, 0x0010, 0x080c,
-	0x657f, 0x002e, 0x0140, 0x7984, 0x080c, 0x65c9, 0x1120, 0x2009,
-	0x4009, 0x0804, 0x3362, 0x080c, 0x3127, 0x0128, 0x7984, 0x080c,
-	0x61d7, 0x1904, 0x3365, 0x080c, 0x48a5, 0x0904, 0x3365, 0x2b00,
-	0x7026, 0x080c, 0x655b, 0x7888, 0x1170, 0x9084, 0x0005, 0x1158,
-	0x900e, 0x080c, 0x6457, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0x0804, 0x3330, 0x080c, 0x4872, 0x0904, 0x3362, 0x9006,
-	0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xbd21, 0x0904,
-	0x3362, 0x7888, 0xd094, 0x0118, 0xb8bc, 0xc08d, 0xb8be, 0x7007,
-	0x0003, 0x701f, 0x4b40, 0x0005, 0x2061, 0x1800, 0x080c, 0x5393,
-	0x2009, 0x0007, 0x1578, 0x080c, 0x6553, 0x0118, 0x2009, 0x0008,
-	0x0448, 0x080c, 0x3127, 0x0120, 0xa998, 0x080c, 0x61d7, 0x1530,
-	0x080c, 0x48a3, 0x0518, 0x080c, 0x655b, 0xa89c, 0x1168, 0x9084,
-	0x0005, 0x1150, 0x900e, 0x080c, 0x6457, 0x1108, 0xc185, 0xb800,
-	0xd0bc, 0x0108, 0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c,
-	0xbd21, 0x11e0, 0xa89c, 0xd094, 0x0118, 0xb8bc, 0xc08d, 0xb8be,
-	0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
+	0x4000, 0x2001, 0x1950, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x538e,
+	0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000,
+	0x0005, 0x6100, 0x0804, 0x3337, 0x080c, 0x48ac, 0x0904, 0x336c,
+	0x080c, 0x539a, 0x1904, 0x3369, 0x79a8, 0xd184, 0x1158, 0xb834,
+	0x8007, 0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f, 0xba28,
+	0x8217, 0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007, 0x789a,
+	0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0200, 0x0804,
+	0x3337, 0x78a8, 0x909c, 0x0003, 0xd0b4, 0x1148, 0x939a, 0x0003,
+	0x1a04, 0x3369, 0x6258, 0x7884, 0x9206, 0x1904, 0x44b1, 0x2031,
+	0x1848, 0x2009, 0x013c, 0x2136, 0x2001, 0x1840, 0x2009, 0x000c,
+	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x0006, 0x78a8,
+	0x9084, 0x0080, 0x11c8, 0x0006, 0x0036, 0x2001, 0x1a4f, 0x201c,
+	0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a50, 0x201c, 0x7b9e, 0x2003,
+	0x0000, 0x2001, 0x1a51, 0x201c, 0x7ba2, 0x2003, 0x0000, 0x003e,
+	0x000e, 0x000e, 0x0804, 0x48c5, 0x000e, 0x2031, 0x0000, 0x2061,
+	0x18ae, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392,
+	0xa496, 0xa59a, 0x080c, 0x10d5, 0x7007, 0x0002, 0x701f, 0x44d1,
+	0x0005, 0x81ff, 0x1904, 0x3369, 0x080c, 0x48ac, 0x0904, 0x336c,
+	0x080c, 0x6562, 0x1904, 0x3369, 0x00c6, 0x080c, 0x4879, 0x00ce,
+	0x0904, 0x3369, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7ea8,
+	0x080c, 0xbc86, 0x0904, 0x3369, 0x7007, 0x0003, 0x701f, 0x44eb,
+	0x0005, 0x080c, 0x401b, 0x0006, 0x0036, 0x2001, 0x1a4f, 0x201c,
+	0x7b9a, 0x2003, 0x0000, 0x2001, 0x1a50, 0x201c, 0x7b9e, 0x2003,
+	0x0000, 0x2001, 0x1a51, 0x201c, 0x7ba2, 0x2003, 0x0000, 0x003e,
+	0x000e, 0x0804, 0x3337, 0xa830, 0x9086, 0x0100, 0x0904, 0x3369,
+	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
+	0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0804,
+	0x48c5, 0x9006, 0x080c, 0x26cc, 0x78a8, 0x9084, 0x00ff, 0x9086,
+	0x00ff, 0x0118, 0x81ff, 0x1904, 0x3369, 0x080c, 0x6fb2, 0x0110,
+	0x080c, 0x5c96, 0x7888, 0x908a, 0x1000, 0x1a04, 0x336c, 0x7984,
+	0x9186, 0x00ff, 0x0138, 0x9182, 0x007f, 0x1a04, 0x336c, 0x2100,
+	0x080c, 0x2696, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x2061,
+	0x19cb, 0x601b, 0x0000, 0x601f, 0x0000, 0x6073, 0x0000, 0x6077,
+	0x0000, 0x080c, 0x6fb2, 0x1158, 0x080c, 0x7296, 0x080c, 0x5cd1,
+	0x9085, 0x0001, 0x080c, 0x6ff9, 0x080c, 0x6ee4, 0x00d0, 0x080c,
+	0x9db8, 0x2061, 0x0100, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff,
+	0x810f, 0x9105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009,
+	0x196a, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5bbc, 0x080c,
+	0x80ca, 0x7984, 0x080c, 0x6fb2, 0x1110, 0x2009, 0x00ff, 0x7a88,
+	0x080c, 0x4364, 0x012e, 0x00ce, 0x002e, 0x0804, 0x3337, 0x7984,
+	0x080c, 0x61de, 0x2b08, 0x1904, 0x336c, 0x0804, 0x3337, 0x81ff,
+	0x0120, 0x2009, 0x0001, 0x0804, 0x3369, 0x60d8, 0xd0ac, 0x1130,
+	0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x3369, 0x080c, 0x4879,
+	0x1120, 0x2009, 0x0002, 0x0804, 0x3369, 0x7984, 0x9192, 0x0021,
+	0x1a04, 0x336c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080,
+	0x0019, 0x702a, 0xaf60, 0x7736, 0x080c, 0x48c2, 0x701f, 0x459f,
+	0x7880, 0x9086, 0x006e, 0x0110, 0x701f, 0x4e44, 0x0005, 0x2009,
+	0x0080, 0x080c, 0x623e, 0x1118, 0x080c, 0x6562, 0x0120, 0x2021,
+	0x400a, 0x0804, 0x3339, 0x00d6, 0x0096, 0xa964, 0xaa6c, 0xab70,
+	0xac74, 0xad78, 0xae7c, 0xa884, 0x90be, 0x0100, 0x0904, 0x4638,
+	0x90be, 0x0112, 0x0904, 0x4638, 0x90be, 0x0113, 0x0904, 0x4638,
+	0x90be, 0x0114, 0x0904, 0x4638, 0x90be, 0x0117, 0x0904, 0x4638,
+	0x90be, 0x011a, 0x0904, 0x4638, 0x90be, 0x011c, 0x0904, 0x4638,
+	0x90be, 0x0121, 0x0904, 0x461f, 0x90be, 0x0131, 0x0904, 0x461f,
+	0x90be, 0x0171, 0x0904, 0x4638, 0x90be, 0x0173, 0x0904, 0x4638,
+	0x90be, 0x01a1, 0x1128, 0xa894, 0x8007, 0xa896, 0x0804, 0x4643,
+	0x90be, 0x0212, 0x0904, 0x462c, 0x90be, 0x0213, 0x05e8, 0x90be,
+	0x0214, 0x0500, 0x90be, 0x0217, 0x0188, 0x90be, 0x021a, 0x1120,
+	0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be, 0x021f, 0x05c8, 0x90be,
+	0x0300, 0x05b0, 0x009e, 0x00de, 0x0804, 0x336c, 0x7028, 0x9080,
+	0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0007,
+	0x080c, 0x4681, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0, 0x7034,
+	0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x4681, 0x00c8, 0x7028,
+	0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9,
+	0x0001, 0x080c, 0x468e, 0x00b8, 0x7028, 0x9080, 0x000e, 0x2098,
+	0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x468e,
+	0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8,
+	0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c, 0x4879, 0x0550, 0xa868,
+	0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006, 0xa882, 0xa87f, 0x0020,
+	0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2, 0xaab6, 0xabba, 0xacbe,
+	0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e, 0x00de, 0xa866, 0xa822,
+	0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048, 0x080c, 0xbca1, 0x1120,
+	0x2009, 0x0003, 0x0804, 0x3369, 0x7007, 0x0003, 0x701f, 0x4678,
+	0x0005, 0x00ce, 0x009e, 0x00de, 0x2009, 0x0002, 0x0804, 0x3369,
+	0xa820, 0x9086, 0x8001, 0x1904, 0x3337, 0x2009, 0x0004, 0x0804,
+	0x3369, 0x0016, 0x0026, 0x3510, 0x20a9, 0x0002, 0x4002, 0x4104,
+	0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e, 0x0005, 0x0016, 0x0026,
+	0x0036, 0x0046, 0x3520, 0x20a9, 0x0004, 0x4002, 0x4304, 0x4204,
+	0x4104, 0x4004, 0x8421, 0x1db8, 0x004e, 0x003e, 0x002e, 0x001e,
+	0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x3369, 0x60d8,
+	0xd0ac, 0x1160, 0xd09c, 0x0120, 0x2009, 0x0016, 0x0804, 0x3369,
+	0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x3369, 0x7984, 0x78a8,
+	0x2040, 0x080c, 0x9db1, 0x1120, 0x9182, 0x007f, 0x0a04, 0x336c,
+	0x9186, 0x00ff, 0x0904, 0x336c, 0x9182, 0x0800, 0x1a04, 0x336c,
+	0x7a8c, 0x7b88, 0x6078, 0x9306, 0x1140, 0x607c, 0x924e, 0x0904,
+	0x336c, 0x99cc, 0xff00, 0x0904, 0x336c, 0x0126, 0x2091, 0x8000,
+	0x0026, 0x2011, 0x8008, 0x080c, 0x6586, 0x002e, 0x0140, 0x918d,
+	0x8000, 0x080c, 0x65d0, 0x1118, 0x2001, 0x4009, 0x0458, 0x080c,
+	0x4793, 0x0560, 0x90c6, 0x4000, 0x1170, 0x00c6, 0x0006, 0x900e,
+	0x080c, 0x645e, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0x000e, 0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x0090,
+	0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0060, 0x90c6, 0x4009,
+	0x1108, 0x0040, 0x90c6, 0x4006, 0x1108, 0x0020, 0x2001, 0x4005,
+	0x2009, 0x000a, 0x2020, 0x012e, 0x0804, 0x3339, 0x2b00, 0x7026,
+	0x0016, 0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c, 0x9e7f, 0x0904,
+	0x4760, 0x2b00, 0x6012, 0x080c, 0xbf8c, 0x2e58, 0x00ee, 0x00e6,
+	0x00c6, 0x080c, 0x4879, 0x00ce, 0x2b70, 0x1158, 0x080c, 0x9e32,
+	0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x2009, 0x0002, 0x0804,
+	0x3369, 0x900e, 0xa966, 0xa96a, 0x2900, 0x6016, 0xa932, 0xa868,
+	0xc0fd, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0x080c, 0x2fda, 0x6023,
+	0x0001, 0x9006, 0x080c, 0x617b, 0x2001, 0x0002, 0x080c, 0x618f,
+	0x2009, 0x0002, 0x080c, 0x9eac, 0x78a8, 0xd094, 0x0138, 0x00ee,
+	0x7024, 0x00e6, 0x2058, 0xb8bc, 0xc08d, 0xb8be, 0x9085, 0x0001,
+	0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x1120, 0x2009, 0x0003,
+	0x0804, 0x3369, 0x7007, 0x0003, 0x701f, 0x476f, 0x0005, 0xa830,
+	0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x3339,
+	0x9086, 0x0100, 0x7024, 0x2058, 0x1138, 0x2009, 0x0004, 0xba04,
+	0x9294, 0x00ff, 0x0804, 0x52e3, 0x900e, 0xa868, 0xd0f4, 0x1904,
+	0x3337, 0x080c, 0x645e, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
+	0xc18d, 0x0804, 0x3337, 0x00e6, 0x00d6, 0x0096, 0x83ff, 0x0904,
+	0x47db, 0x902e, 0x080c, 0x9db1, 0x0130, 0x9026, 0x20a9, 0x0800,
+	0x2071, 0x1000, 0x0030, 0x2021, 0x007f, 0x20a9, 0x0781, 0x2071,
+	0x107f, 0x2e04, 0x9005, 0x11b0, 0x2100, 0x9406, 0x15e8, 0x2428,
+	0x94ce, 0x007f, 0x1120, 0x92ce, 0xfffd, 0x1528, 0x0030, 0x94ce,
+	0x0080, 0x1130, 0x92ce, 0xfffc, 0x11f0, 0x93ce, 0x00ff, 0x11d8,
+	0xc5fd, 0x0450, 0x2058, 0xbf10, 0x2700, 0x9306, 0x11b8, 0xbe14,
+	0x2600, 0x9206, 0x1198, 0x2400, 0x9106, 0x1150, 0xd884, 0x0568,
+	0xd894, 0x1558, 0x080c, 0x6562, 0x1540, 0x2001, 0x4000, 0x0430,
+	0x2001, 0x4007, 0x0418, 0x2001, 0x4006, 0x0400, 0x2400, 0x9106,
+	0x1158, 0xbe14, 0x87ff, 0x1128, 0x86ff, 0x0948, 0x080c, 0x9db1,
+	0x1930, 0x2001, 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04, 0x47a9,
+	0x85ff, 0x1130, 0x2001, 0x4009, 0x0048, 0x2001, 0x0001, 0x0030,
+	0x080c, 0x61de, 0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005, 0x009e,
+	0x00de, 0x00ee, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
+	0x3369, 0x080c, 0x4879, 0x1120, 0x2009, 0x0002, 0x0804, 0x3369,
+	0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005, 0x0904,
+	0x336c, 0x9096, 0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04, 0x336c,
+	0x2010, 0x2918, 0x080c, 0x2f80, 0x1120, 0x2009, 0x0003, 0x0804,
+	0x3369, 0x7007, 0x0003, 0x701f, 0x482e, 0x0005, 0xa830, 0x9086,
+	0x0100, 0x1904, 0x3337, 0x2009, 0x0004, 0x0804, 0x3369, 0x7984,
+	0x080c, 0x9db1, 0x1120, 0x9182, 0x007f, 0x0a04, 0x336c, 0x9186,
+	0x00ff, 0x0904, 0x336c, 0x9182, 0x0800, 0x1a04, 0x336c, 0x2001,
+	0x9000, 0x080c, 0x533e, 0x1904, 0x3369, 0x0804, 0x3337, 0xa998,
+	0x080c, 0x9db1, 0x1118, 0x9182, 0x007f, 0x0280, 0x9186, 0x00ff,
+	0x0168, 0x9182, 0x0800, 0x1250, 0x2001, 0x9000, 0x080c, 0x533e,
+	0x11a8, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
 	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
-	0xa99a, 0x9006, 0x918d, 0x0001, 0x2008, 0x0005, 0x9006, 0x0005,
-	0xa830, 0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804,
-	0x3332, 0x9086, 0x0100, 0x7024, 0x2058, 0x1110, 0x0804, 0x52dc,
-	0x900e, 0x080c, 0x6457, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0x0804, 0x3330, 0x080c, 0x5393, 0x0120, 0x2009, 0x0007,
-	0x0804, 0x3362, 0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c,
-	0x4872, 0x1120, 0x2009, 0x0002, 0x0804, 0x3362, 0x900e, 0x2130,
-	0x7126, 0x7132, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005,
-	0x702a, 0x20a0, 0x080c, 0x6237, 0x1904, 0x4bde, 0x080c, 0x655b,
-	0x0120, 0x080c, 0x6563, 0x1904, 0x4bde, 0x080c, 0x6553, 0x1130,
-	0x080c, 0x6457, 0x1118, 0xd79c, 0x0904, 0x4bde, 0xd794, 0x1110,
-	0xd784, 0x01a8, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098,
-	0x3400, 0xd794, 0x0160, 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0,
-	0x3d00, 0x20e0, 0x20a9, 0x0002, 0x080c, 0x4687, 0x0048, 0x20a9,
-	0x0004, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4687,
-	0x4104, 0xd794, 0x0528, 0xb8b4, 0x20e0, 0xb8b8, 0x2060, 0x9c80,
-	0x0000, 0x2098, 0x20a9, 0x0002, 0x4003, 0x9c80, 0x0003, 0x2098,
-	0x20a9, 0x0001, 0x4005, 0x9c80, 0x0004, 0x2098, 0x3400, 0x20a9,
-	0x0002, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x467a,
-	0x9c80, 0x0026, 0x2098, 0xb8b4, 0x20e0, 0x20a9, 0x0002, 0x4003,
-	0xd794, 0x0110, 0x96b0, 0x000b, 0x96b0, 0x0005, 0x8108, 0x080c,
-	0x9d98, 0x0118, 0x9186, 0x0800, 0x0040, 0xd78c, 0x0120, 0x9186,
-	0x0800, 0x0170, 0x0018, 0x9186, 0x007e, 0x0150, 0xd794, 0x0118,
-	0x9686, 0x0020, 0x0010, 0x9686, 0x0028, 0x0150, 0x0804, 0x4b7a,
-	0x86ff, 0x1120, 0x7124, 0x810b, 0x0804, 0x3330, 0x7033, 0x0001,
-	0x7122, 0x7024, 0x9600, 0x7026, 0x772e, 0x2061, 0x18ae, 0x2c44,
-	0xa06b, 0x0000, 0xa67a, 0x7034, 0xa072, 0x7028, 0xa076, 0xa28e,
-	0xa392, 0xa496, 0xa59a, 0x080c, 0x10d5, 0x7007, 0x0002, 0x701f,
-	0x4c1a, 0x0005, 0x7030, 0x9005, 0x1180, 0x7120, 0x7028, 0x20a0,
-	0x772c, 0x9036, 0x7034, 0x20e8, 0x2061, 0x18ae, 0x2c44, 0xa28c,
-	0xa390, 0xa494, 0xa598, 0x0804, 0x4b7a, 0x7124, 0x810b, 0x0804,
-	0x3330, 0x2029, 0x007e, 0x7984, 0x7a88, 0x7b8c, 0x7c98, 0x9184,
-	0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x3365, 0x9502, 0x0a04,
-	0x3365, 0x9184, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x3365, 0x9502,
-	0x0a04, 0x3365, 0x9284, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04,
-	0x3365, 0x9502, 0x0a04, 0x3365, 0x9284, 0x00ff, 0x90e2, 0x0020,
-	0x0a04, 0x3365, 0x9502, 0x0a04, 0x3365, 0x9384, 0xff00, 0x8007,
-	0x90e2, 0x0020, 0x0a04, 0x3365, 0x9502, 0x0a04, 0x3365, 0x9384,
-	0x00ff, 0x90e2, 0x0020, 0x0a04, 0x3365, 0x9502, 0x0a04, 0x3365,
-	0x9484, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x3365, 0x9502,
-	0x0a04, 0x3365, 0x9484, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x3365,
-	0x9502, 0x0a04, 0x3365, 0x2061, 0x195a, 0x6102, 0x6206, 0x630a,
-	0x640e, 0x0804, 0x3330, 0x0006, 0x080c, 0x537f, 0xd0cc, 0x000e,
-	0x0005, 0x0006, 0x080c, 0x5383, 0xd0bc, 0x000e, 0x0005, 0x6170,
-	0x7a84, 0x6300, 0x82ff, 0x1118, 0x7986, 0x0804, 0x3330, 0x83ff,
-	0x1904, 0x3365, 0x2001, 0xfff0, 0x9200, 0x1a04, 0x3365, 0x2019,
-	0xffff, 0x6074, 0x9302, 0x9200, 0x0a04, 0x3365, 0x7986, 0x6272,
-	0x0804, 0x3330, 0x080c, 0x5393, 0x1904, 0x3362, 0x7c88, 0x7d84,
-	0x7e98, 0x7f8c, 0x080c, 0x4872, 0x0904, 0x3362, 0x900e, 0x901e,
-	0x7326, 0x7332, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0003,
-	0x702a, 0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c,
-	0x655b, 0x0118, 0x080c, 0x6563, 0x1148, 0x20a9, 0x0001, 0xb814,
-	0x4004, 0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182,
-	0x0800, 0x0120, 0x9386, 0x003c, 0x0170, 0x0c20, 0x83ff, 0x1148,
-	0x7224, 0x900e, 0x2001, 0x0003, 0x080c, 0x8248, 0x2208, 0x0804,
-	0x3330, 0x7033, 0x0001, 0x7122, 0x7024, 0x9300, 0x7026, 0x2061,
-	0x18ae, 0x2c44, 0xa06b, 0x0000, 0xa37a, 0x7028, 0xa076, 0x7034,
-	0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x10d5, 0x7007,
-	0x0002, 0x701f, 0x4d0c, 0x0005, 0x7030, 0x9005, 0x1178, 0x7120,
-	0x7028, 0x20a0, 0x901e, 0x7034, 0x20e8, 0x2061, 0x18ae, 0x2c44,
-	0xa48c, 0xa590, 0xa694, 0xa798, 0x0804, 0x4cca, 0x7224, 0x900e,
-	0x2001, 0x0003, 0x080c, 0x8248, 0x2208, 0x0804, 0x3330, 0x00f6,
-	0x00e6, 0x080c, 0x5393, 0x2009, 0x0007, 0x1904, 0x4d9f, 0x2071,
-	0x1894, 0x745c, 0x84ff, 0x2009, 0x000e, 0x1904, 0x4d9f, 0xac9c,
-	0xad98, 0xaea4, 0xafa0, 0x0096, 0x080c, 0x1004, 0x2009, 0x0002,
-	0x0904, 0x4d9f, 0x2900, 0x705e, 0x900e, 0x901e, 0x7356, 0x7362,
-	0xa860, 0x7066, 0xa85c, 0x9080, 0x0003, 0x705a, 0x20a0, 0x91d8,
-	0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x655b, 0x0118, 0x080c,
-	0x6563, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004,
-	0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386,
-	0x003c, 0x01e8, 0x0c20, 0x83ff, 0x11c0, 0x7254, 0x900e, 0x2001,
-	0x0003, 0x080c, 0x8248, 0x2208, 0x009e, 0xa897, 0x4000, 0xa99a,
-	0x715c, 0x81ff, 0x090c, 0x0db4, 0x2148, 0x080c, 0x101d, 0x9006,
-	0x705e, 0x918d, 0x0001, 0x2008, 0x0418, 0x7063, 0x0001, 0x7152,
-	0x7054, 0x9300, 0x7056, 0x2061, 0x18af, 0x2c44, 0xa37a, 0x7058,
-	0xa076, 0x7064, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0xa09f,
-	0x4dab, 0x000e, 0xa0a2, 0x080c, 0x10d5, 0x9006, 0x0048, 0x009e,
-	0xa897, 0x4005, 0xa99a, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
-	0x00ee, 0x00fe, 0x0005, 0x00f6, 0xa0a0, 0x904d, 0x090c, 0x0db4,
-	0x00e6, 0x2071, 0x1894, 0xa06c, 0x908e, 0x0100, 0x0138, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x00d8, 0x7060, 0x9005,
-	0x1158, 0x7150, 0x7058, 0x20a0, 0x901e, 0x7064, 0x20e8, 0xa48c,
-	0xa590, 0xa694, 0xa798, 0x0428, 0xa87b, 0x0000, 0xa883, 0x0000,
-	0xa897, 0x4000, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x8248,
-	0xaa9a, 0x715c, 0x81ff, 0x090c, 0x0db4, 0x2148, 0x080c, 0x101d,
-	0x705f, 0x0000, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6885, 0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x00ee, 0x00fe,
-	0x0005, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x655b,
-	0x0118, 0x080c, 0x6563, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x2009, 0x000a,
+	0x0c48, 0x080c, 0x0feb, 0x0198, 0x9006, 0xa802, 0x7014, 0x9005,
+	0x1120, 0x2900, 0x7016, 0x701a, 0x0040, 0x7018, 0xa802, 0x0086,
+	0x2040, 0x2900, 0xa006, 0x701a, 0x008e, 0x9085, 0x0001, 0x0005,
+	0x7984, 0x080c, 0x623e, 0x1130, 0x7e88, 0x9684, 0x3fff, 0x9082,
+	0x4000, 0x0208, 0x905e, 0x8bff, 0x0005, 0xa998, 0x080c, 0x623e,
+	0x1130, 0xae9c, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e,
+	0x8bff, 0x0005, 0xae98, 0x0008, 0x7e84, 0x2608, 0x080c, 0x623e,
+	0x1108, 0x0008, 0x905e, 0x8bff, 0x0005, 0x0016, 0x7114, 0x81ff,
+	0x0128, 0x2148, 0xa904, 0x080c, 0x101d, 0x0cc8, 0x7116, 0x711a,
+	0x001e, 0x0005, 0x2031, 0x0001, 0x0010, 0x2031, 0x0000, 0x2061,
+	0x18ae, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392,
+	0xa496, 0xa59a, 0x080c, 0x10d5, 0x7007, 0x0002, 0x701f, 0x3337,
+	0x0005, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0000, 0x2001,
+	0x18a6, 0x2004, 0x9005, 0x1190, 0x0e04, 0x48f6, 0x7a36, 0x7833,
+	0x0012, 0x7a82, 0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001, 0x0089,
+	0x2004, 0xd084, 0x190c, 0x1187, 0x0804, 0x495c, 0x0016, 0x0086,
+	0x0096, 0x00c6, 0x00e6, 0x2071, 0x1894, 0x7044, 0x9005, 0x1540,
+	0x7148, 0x9182, 0x0010, 0x0288, 0x7038, 0x2060, 0x080c, 0x0feb,
+	0x0904, 0x4954, 0xa84b, 0x0000, 0x2900, 0x7046, 0x2001, 0x0002,
+	0x9080, 0x1f26, 0x2005, 0xa846, 0x0098, 0x7038, 0x90e0, 0x0004,
+	0x2001, 0x18b0, 0x9c82, 0x18f0, 0x0210, 0x2061, 0x18b0, 0x2c00,
+	0x703a, 0x7148, 0x81ff, 0x1108, 0x703e, 0x8108, 0x714a, 0x0460,
+	0x7148, 0x8108, 0x714a, 0x7044, 0x2040, 0xa144, 0x2105, 0x0016,
+	0x908a, 0x0036, 0x1a0c, 0x0db4, 0x2060, 0x001e, 0x8108, 0x2105,
+	0x9005, 0xa146, 0x1520, 0x080c, 0x0feb, 0x1130, 0x8109, 0xa946,
+	0x7148, 0x8109, 0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a, 0xa046,
+	0x2800, 0xa802, 0x2900, 0xa006, 0x7046, 0x2001, 0x0002, 0x9080,
+	0x1f26, 0x2005, 0xa846, 0x0058, 0x2262, 0x6306, 0x640a, 0x00ee,
+	0x00ce, 0x009e, 0x008e, 0x001e, 0x012e, 0x00fe, 0x0005, 0x2c00,
+	0x9082, 0x001b, 0x0002, 0x497e, 0x497e, 0x4980, 0x497e, 0x497e,
+	0x497e, 0x4984, 0x497e, 0x497e, 0x497e, 0x4988, 0x497e, 0x497e,
+	0x497e, 0x498c, 0x497e, 0x497e, 0x497e, 0x4990, 0x497e, 0x497e,
+	0x497e, 0x4994, 0x497e, 0x497e, 0x497e, 0x4999, 0x080c, 0x0db4,
+	0xa276, 0xa37a, 0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e, 0x0878,
+	0xa296, 0xa39a, 0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae, 0x0838,
+	0xa2b6, 0xa3ba, 0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce, 0x0804,
+	0x4957, 0xa2d6, 0xa3da, 0xa4de, 0x0804, 0x4957, 0x00e6, 0x2071,
+	0x1894, 0x7048, 0x9005, 0x0904, 0x4a30, 0x0126, 0x2091, 0x8000,
+	0x0e04, 0x4a2f, 0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096, 0x0086,
+	0x0076, 0x9006, 0x2038, 0x7040, 0x2048, 0x9005, 0x0500, 0xa948,
+	0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0db4, 0x2060, 0x001e,
+	0x8108, 0x2105, 0x9005, 0xa94a, 0x1904, 0x4a32, 0xa804, 0x9005,
+	0x090c, 0x0db4, 0x7042, 0x2938, 0x2040, 0xa003, 0x0000, 0x2001,
+	0x0002, 0x9080, 0x1f26, 0x2005, 0xa04a, 0x0804, 0x4a32, 0x703c,
+	0x2060, 0x2c14, 0x6304, 0x6408, 0x650c, 0x2200, 0x7836, 0x7833,
+	0x0012, 0x7882, 0x2300, 0x7886, 0x2400, 0x788a, 0x2091, 0x4080,
+	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x87ff, 0x0118,
+	0x2748, 0x080c, 0x101d, 0x7048, 0x8001, 0x704a, 0x9005, 0x1170,
+	0x7040, 0x2048, 0x9005, 0x0128, 0x080c, 0x101d, 0x9006, 0x7042,
+	0x7046, 0x703b, 0x18b0, 0x703f, 0x18b0, 0x0420, 0x7040, 0x9005,
+	0x1508, 0x7238, 0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004, 0x90fa,
+	0x18f0, 0x0210, 0x2001, 0x18b0, 0x703e, 0x00a0, 0x9006, 0x703e,
+	0x703a, 0x7044, 0x9005, 0x090c, 0x0db4, 0x2048, 0xa800, 0x9005,
+	0x1de0, 0x2900, 0x7042, 0x2001, 0x0002, 0x9080, 0x1f26, 0x2005,
+	0xa84a, 0x0000, 0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe, 0x012e,
+	0x00ee, 0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4a51, 0x4a51,
+	0x4a53, 0x4a51, 0x4a51, 0x4a51, 0x4a58, 0x4a51, 0x4a51, 0x4a51,
+	0x4a5d, 0x4a51, 0x4a51, 0x4a51, 0x4a62, 0x4a51, 0x4a51, 0x4a51,
+	0x4a67, 0x4a51, 0x4a51, 0x4a51, 0x4a6c, 0x4a51, 0x4a51, 0x4a51,
+	0x4a71, 0x080c, 0x0db4, 0xaa74, 0xab78, 0xac7c, 0x0804, 0x49dd,
+	0xaa84, 0xab88, 0xac8c, 0x0804, 0x49dd, 0xaa94, 0xab98, 0xac9c,
+	0x0804, 0x49dd, 0xaaa4, 0xaba8, 0xacac, 0x0804, 0x49dd, 0xaab4,
+	0xabb8, 0xacbc, 0x0804, 0x49dd, 0xaac4, 0xabc8, 0xaccc, 0x0804,
+	0x49dd, 0xaad4, 0xabd8, 0xacdc, 0x0804, 0x49dd, 0x0026, 0x080c,
+	0x5386, 0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c, 0x48d9, 0x002e,
+	0x0005, 0x81ff, 0x1904, 0x3369, 0x0126, 0x2091, 0x8000, 0x6030,
+	0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c, 0x6fb2, 0x1158, 0x080c,
+	0x7296, 0x080c, 0x5cd1, 0x9085, 0x0001, 0x080c, 0x6ff9, 0x080c,
+	0x6ee4, 0x0010, 0x080c, 0x5b90, 0x012e, 0x0804, 0x3337, 0x81ff,
+	0x0120, 0x2009, 0x0001, 0x0804, 0x3369, 0x080c, 0x539a, 0x0120,
+	0x2009, 0x0007, 0x0804, 0x3369, 0x080c, 0x655a, 0x0120, 0x2009,
+	0x0008, 0x0804, 0x3369, 0x0026, 0x2011, 0x0010, 0x080c, 0x6586,
+	0x002e, 0x0140, 0x7984, 0x080c, 0x65d0, 0x1120, 0x2009, 0x4009,
+	0x0804, 0x3369, 0x080c, 0x312e, 0x0128, 0x7984, 0x080c, 0x61de,
+	0x1904, 0x336c, 0x080c, 0x48ac, 0x0904, 0x336c, 0x2b00, 0x7026,
+	0x080c, 0x6562, 0x7888, 0x1170, 0x9084, 0x0005, 0x1158, 0x900e,
+	0x080c, 0x645e, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0x0804, 0x3337, 0x080c, 0x4879, 0x0904, 0x3369, 0x9006, 0xa866,
+	0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xbd3a, 0x0904, 0x3369,
+	0x7888, 0xd094, 0x0118, 0xb8bc, 0xc08d, 0xb8be, 0x7007, 0x0003,
+	0x701f, 0x4b47, 0x0005, 0x2061, 0x1800, 0x080c, 0x539a, 0x2009,
+	0x0007, 0x1578, 0x080c, 0x655a, 0x0118, 0x2009, 0x0008, 0x0448,
+	0x080c, 0x312e, 0x0120, 0xa998, 0x080c, 0x61de, 0x1530, 0x080c,
+	0x48aa, 0x0518, 0x080c, 0x6562, 0xa89c, 0x1168, 0x9084, 0x0005,
+	0x1150, 0x900e, 0x080c, 0x645e, 0x1108, 0xc185, 0xb800, 0xd0bc,
+	0x0108, 0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c, 0xbd3a,
+	0x11e0, 0xa89c, 0xd094, 0x0118, 0xb8bc, 0xc08d, 0xb8be, 0x2009,
+	0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e,
+	0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0xa99a,
+	0x9006, 0x918d, 0x0001, 0x2008, 0x0005, 0x9006, 0x0005, 0xa830,
+	0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x3339,
+	0x9086, 0x0100, 0x7024, 0x2058, 0x1110, 0x0804, 0x52e3, 0x900e,
+	0x080c, 0x645e, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0x0804, 0x3337, 0x080c, 0x539a, 0x0120, 0x2009, 0x0007, 0x0804,
+	0x3369, 0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4879,
+	0x1120, 0x2009, 0x0002, 0x0804, 0x3369, 0x900e, 0x2130, 0x7126,
+	0x7132, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005, 0x702a,
+	0x20a0, 0x080c, 0x623e, 0x1904, 0x4be5, 0x080c, 0x6562, 0x0120,
+	0x080c, 0x656a, 0x1904, 0x4be5, 0x080c, 0x655a, 0x1130, 0x080c,
+	0x645e, 0x1118, 0xd79c, 0x0904, 0x4be5, 0xd794, 0x1110, 0xd784,
+	0x01a8, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098, 0x3400,
+	0xd794, 0x0160, 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0, 0x3d00,
+	0x20e0, 0x20a9, 0x0002, 0x080c, 0x468e, 0x0048, 0x20a9, 0x0004,
+	0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x468e, 0x4104,
+	0xd794, 0x0528, 0xb8b4, 0x20e0, 0xb8b8, 0x2060, 0x9c80, 0x0000,
+	0x2098, 0x20a9, 0x0002, 0x4003, 0x9c80, 0x0003, 0x2098, 0x20a9,
+	0x0001, 0x4005, 0x9c80, 0x0004, 0x2098, 0x3400, 0x20a9, 0x0002,
+	0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4681, 0x9c80,
+	0x0026, 0x2098, 0xb8b4, 0x20e0, 0x20a9, 0x0002, 0x4003, 0xd794,
+	0x0110, 0x96b0, 0x000b, 0x96b0, 0x0005, 0x8108, 0x080c, 0x9db1,
+	0x0118, 0x9186, 0x0800, 0x0040, 0xd78c, 0x0120, 0x9186, 0x0800,
+	0x0170, 0x0018, 0x9186, 0x007e, 0x0150, 0xd794, 0x0118, 0x9686,
+	0x0020, 0x0010, 0x9686, 0x0028, 0x0150, 0x0804, 0x4b81, 0x86ff,
+	0x1120, 0x7124, 0x810b, 0x0804, 0x3337, 0x7033, 0x0001, 0x7122,
+	0x7024, 0x9600, 0x7026, 0x772e, 0x2061, 0x18ae, 0x2c44, 0xa06b,
+	0x0000, 0xa67a, 0x7034, 0xa072, 0x7028, 0xa076, 0xa28e, 0xa392,
+	0xa496, 0xa59a, 0x080c, 0x10d5, 0x7007, 0x0002, 0x701f, 0x4c21,
+	0x0005, 0x7030, 0x9005, 0x1180, 0x7120, 0x7028, 0x20a0, 0x772c,
+	0x9036, 0x7034, 0x20e8, 0x2061, 0x18ae, 0x2c44, 0xa28c, 0xa390,
+	0xa494, 0xa598, 0x0804, 0x4b81, 0x7124, 0x810b, 0x0804, 0x3337,
+	0x2029, 0x007e, 0x7984, 0x7a88, 0x7b8c, 0x7c98, 0x9184, 0xff00,
+	0x8007, 0x90e2, 0x0020, 0x0a04, 0x336c, 0x9502, 0x0a04, 0x336c,
+	0x9184, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x336c, 0x9502, 0x0a04,
+	0x336c, 0x9284, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x336c,
+	0x9502, 0x0a04, 0x336c, 0x9284, 0x00ff, 0x90e2, 0x0020, 0x0a04,
+	0x336c, 0x9502, 0x0a04, 0x336c, 0x9384, 0xff00, 0x8007, 0x90e2,
+	0x0020, 0x0a04, 0x336c, 0x9502, 0x0a04, 0x336c, 0x9384, 0x00ff,
+	0x90e2, 0x0020, 0x0a04, 0x336c, 0x9502, 0x0a04, 0x336c, 0x9484,
+	0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x336c, 0x9502, 0x0a04,
+	0x336c, 0x9484, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x336c, 0x9502,
+	0x0a04, 0x336c, 0x2061, 0x195a, 0x6102, 0x6206, 0x630a, 0x640e,
+	0x0804, 0x3337, 0x0006, 0x080c, 0x5386, 0xd0cc, 0x000e, 0x0005,
+	0x0006, 0x080c, 0x538a, 0xd0bc, 0x000e, 0x0005, 0x6170, 0x7a84,
+	0x6300, 0x82ff, 0x1118, 0x7986, 0x0804, 0x3337, 0x83ff, 0x1904,
+	0x336c, 0x2001, 0xfff0, 0x9200, 0x1a04, 0x336c, 0x2019, 0xffff,
+	0x6074, 0x9302, 0x9200, 0x0a04, 0x336c, 0x7986, 0x6272, 0x0804,
+	0x3337, 0x080c, 0x539a, 0x1904, 0x3369, 0x7c88, 0x7d84, 0x7e98,
+	0x7f8c, 0x080c, 0x4879, 0x0904, 0x3369, 0x900e, 0x901e, 0x7326,
+	0x7332, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0003, 0x702a,
+	0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6562,
+	0x0118, 0x080c, 0x656a, 0x1148, 0x20a9, 0x0001, 0xb814, 0x4004,
 	0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800,
-	0x0120, 0x9386, 0x003c, 0x0518, 0x0c20, 0x83ff, 0x11f0, 0x7154,
-	0x810c, 0xa99a, 0xa897, 0x4000, 0x715c, 0x81ff, 0x090c, 0x0db4,
-	0x2148, 0x080c, 0x101d, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008,
-	0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x6885, 0x012e,
-	0xa09f, 0x0000, 0xa0a3, 0x0000, 0x0070, 0x7063, 0x0001, 0x7152,
-	0x7054, 0x9300, 0x7056, 0xa37a, 0xa48e, 0xa592, 0xa696, 0xa79a,
-	0x080c, 0x10d5, 0x9006, 0x00ee, 0x0005, 0x0096, 0xa88c, 0x90be,
-	0x7000, 0x0148, 0x90be, 0x7100, 0x0130, 0x90be, 0x7200, 0x0118,
-	0x009e, 0x0804, 0x3365, 0xa884, 0xa988, 0x080c, 0x2663, 0x1518,
-	0x080c, 0x61d7, 0x1500, 0x7126, 0xbe12, 0xbd16, 0xae7c, 0x080c,
-	0x4872, 0x01c8, 0x080c, 0x4872, 0x01b0, 0x009e, 0xa867, 0x0000,
-	0xa868, 0xc0fd, 0xa86a, 0xa823, 0x0000, 0xa804, 0x2048, 0x080c,
-	0xbca8, 0x1120, 0x2009, 0x0003, 0x0804, 0x3362, 0x7007, 0x0003,
-	0x701f, 0x4e78, 0x0005, 0x009e, 0x2009, 0x0002, 0x0804, 0x3362,
-	0x7124, 0x080c, 0x30ce, 0xa820, 0x9086, 0x8001, 0x1120, 0x2009,
-	0x0004, 0x0804, 0x3362, 0x2900, 0x7022, 0xa804, 0x0096, 0x2048,
-	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x009e,
-	0x9080, 0x0002, 0x0076, 0x0006, 0x2098, 0x20a0, 0x27e0, 0x27e8,
-	0x20a9, 0x002a, 0x080c, 0x0f68, 0xaa6c, 0xab70, 0xac74, 0xad78,
-	0x2061, 0x18ae, 0x2c44, 0xa06b, 0x0000, 0xae64, 0xaf8c, 0x97c6,
-	0x7000, 0x0118, 0x97c6, 0x7100, 0x1148, 0x96c2, 0x0004, 0x0600,
-	0x2009, 0x0004, 0x000e, 0x007e, 0x0804, 0x48be, 0x97c6, 0x7200,
-	0x11b8, 0x96c2, 0x0054, 0x02a0, 0x000e, 0x007e, 0x2061, 0x18ae,
-	0x2c44, 0xa076, 0xa772, 0xa07b, 0x002a, 0xa28e, 0xa392, 0xa496,
-	0xa59a, 0x080c, 0x10d5, 0x7007, 0x0002, 0x701f, 0x4ed4, 0x0005,
-	0x000e, 0x007e, 0x0804, 0x3365, 0x7020, 0x2048, 0xa804, 0x2048,
-	0xa804, 0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x0002, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9,
-	0x002a, 0x080c, 0x0f68, 0x2100, 0x2238, 0x2061, 0x18ae, 0x2c44,
-	0xa28c, 0xa390, 0xa494, 0xa598, 0x2009, 0x002a, 0x0804, 0x48be,
-	0x81ff, 0x1904, 0x3362, 0x798c, 0x2001, 0x194f, 0x918c, 0x8000,
-	0x2102, 0x080c, 0x4889, 0x0904, 0x3365, 0x080c, 0x655b, 0x0120,
-	0x080c, 0x6563, 0x1904, 0x3365, 0x080c, 0x62fe, 0x0904, 0x3362,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x63c4, 0x012e, 0x0904, 0x3362,
-	0x2001, 0x194f, 0x2004, 0xd0fc, 0x1904, 0x3330, 0x0804, 0x42fa,
-	0xa9a0, 0x2001, 0x194f, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c,
-	0x4896, 0x01a0, 0x080c, 0x655b, 0x0118, 0x080c, 0x6563, 0x1170,
-	0x080c, 0x62fe, 0x2009, 0x0002, 0x0128, 0x080c, 0x63c4, 0x1170,
-	0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
-	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
-	0x2001, 0x194f, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x5387, 0x0110,
-	0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005,
-	0x78a8, 0xd08c, 0x1118, 0xd084, 0x0904, 0x426f, 0x080c, 0x48a5,
-	0x0904, 0x3365, 0x080c, 0x4872, 0x1120, 0x2009, 0x0002, 0x0804,
-	0x3362, 0x080c, 0x655b, 0x0130, 0x908e, 0x0004, 0x0118, 0x908e,
-	0x0005, 0x15a0, 0x78a8, 0xd08c, 0x0120, 0xb800, 0xc08c, 0xb802,
-	0x0028, 0x080c, 0x537f, 0xd0b4, 0x0904, 0x42a9, 0x7884, 0x908e,
-	0x007e, 0x0904, 0x42a9, 0x908e, 0x007f, 0x0904, 0x42a9, 0x908e,
-	0x0080, 0x0904, 0x42a9, 0xb800, 0xd08c, 0x1904, 0x42a9, 0xa867,
-	0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xbcc7, 0x1120, 0x2009,
-	0x0003, 0x0804, 0x3362, 0x7007, 0x0003, 0x701f, 0x4fa0, 0x0005,
-	0x080c, 0x48a5, 0x0904, 0x3365, 0x0804, 0x42a9, 0x080c, 0x3127,
-	0x0108, 0x0005, 0x2009, 0x1833, 0x210c, 0x81ff, 0x0120, 0x2009,
-	0x0001, 0x0804, 0x3362, 0x080c, 0x5393, 0x0120, 0x2009, 0x0007,
-	0x0804, 0x3362, 0x080c, 0x6553, 0x0120, 0x2009, 0x0008, 0x0804,
-	0x3362, 0xb89c, 0xd0a4, 0x1118, 0xd0ac, 0x1904, 0x42a9, 0x9006,
-	0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xbd21, 0x1120,
-	0x2009, 0x0003, 0x0804, 0x3362, 0x7007, 0x0003, 0x701f, 0x4fd9,
-	0x0005, 0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804,
-	0x52dc, 0x080c, 0x48a5, 0x0904, 0x3365, 0x0804, 0x4f72, 0x81ff,
-	0x2009, 0x0001, 0x1904, 0x3362, 0x080c, 0x5393, 0x2009, 0x0007,
-	0x1904, 0x3362, 0x080c, 0x6553, 0x0120, 0x2009, 0x0008, 0x0804,
-	0x3362, 0x080c, 0x48a5, 0x0904, 0x3365, 0x080c, 0x655b, 0x2009,
-	0x0009, 0x1904, 0x3362, 0x080c, 0x4872, 0x2009, 0x0002, 0x0904,
-	0x3362, 0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x7988,
-	0x9194, 0xff00, 0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128, 0xc0ed,
-	0xa952, 0x798c, 0xa956, 0x0038, 0x928e, 0x0100, 0x1904, 0x3365,
-	0xc0e5, 0xa952, 0xa956, 0xa83e, 0x080c, 0xbf74, 0x2009, 0x0003,
-	0x0904, 0x3362, 0x7007, 0x0003, 0x701f, 0x502f, 0x0005, 0xa830,
-	0x9086, 0x0100, 0x2009, 0x0004, 0x0904, 0x3362, 0x0804, 0x3330,
-	0x7aa8, 0x9284, 0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c, 0x5393,
-	0x1188, 0x2009, 0x0014, 0x0804, 0x3362, 0xd2dc, 0x1568, 0x81ff,
-	0x2009, 0x0001, 0x1904, 0x3362, 0x080c, 0x5393, 0x2009, 0x0007,
-	0x1904, 0x3362, 0xd2f4, 0x0130, 0x9284, 0x5000, 0x080c, 0x535a,
-	0x0804, 0x3330, 0xd2fc, 0x0158, 0x080c, 0x48a5, 0x0904, 0x3365,
-	0x7984, 0x9284, 0x9000, 0x080c, 0x5337, 0x0804, 0x3330, 0x080c,
-	0x48a5, 0x0904, 0x3365, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006,
-	0x2009, 0x0009, 0x1904, 0x5118, 0x080c, 0x4872, 0x2009, 0x0002,
-	0x0904, 0x5118, 0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009, 0x0008,
-	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x48bb, 0x701f, 0x5089,
-	0x0005, 0xa86c, 0x9086, 0x0500, 0x1138, 0xa870, 0x9005, 0x1120,
-	0xa874, 0x9084, 0xff00, 0x0110, 0x1904, 0x3365, 0xa866, 0xa832,
-	0xa868, 0xc0fd, 0xa86a, 0x080c, 0x48a5, 0x1110, 0x0804, 0x3365,
-	0x2009, 0x0043, 0x080c, 0xbfdc, 0x2009, 0x0003, 0x0904, 0x5118,
-	0x7007, 0x0003, 0x701f, 0x50ad, 0x0005, 0xa830, 0x9086, 0x0100,
-	0x2009, 0x0004, 0x0904, 0x5118, 0x7984, 0x7aa8, 0x9284, 0x1000,
-	0x080c, 0x5337, 0x0804, 0x3330, 0x00c6, 0xaab0, 0x9284, 0xc000,
-	0x0140, 0xd2ec, 0x0168, 0x080c, 0x5393, 0x1150, 0x2009, 0x0014,
-	0x04f0, 0x2061, 0x1800, 0x080c, 0x5393, 0x2009, 0x0007, 0x15b8,
-	0xd2f4, 0x0128, 0x9284, 0x5000, 0x080c, 0x535a, 0x0050, 0xd2fc,
-	0x0178, 0x080c, 0x48a3, 0x0588, 0xa998, 0x9284, 0x9000, 0x080c,
-	0x5337, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0438,
-	0x080c, 0x48a3, 0x0510, 0x080c, 0x655b, 0x2009, 0x0009, 0x11b8,
-	0xa8c4, 0x9086, 0x0500, 0x11c8, 0xa8c8, 0x9005, 0x11b0, 0xa8cc,
-	0x9084, 0xff00, 0x1190, 0x080c, 0x48a3, 0x1108, 0x0070, 0x2009,
-	0x004b, 0x080c, 0xbfdc, 0x2009, 0x0003, 0x0108, 0x0078, 0x0429,
-	0x19c0, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0030, 0x00ce, 0x0005, 0x9006, 0x0ce0,
-	0x7aa8, 0xd2dc, 0x0904, 0x3362, 0x0016, 0x7984, 0x9284, 0x1000,
-	0xc0fd, 0x080c, 0x5337, 0x001e, 0x1904, 0x3362, 0x0804, 0x3330,
-	0x00f6, 0x2d78, 0x0011, 0x00fe, 0x0005, 0xaab0, 0xd2dc, 0x0150,
-	0x0016, 0xa998, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5337, 0x001e,
-	0x9085, 0x0001, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-	0x3362, 0x080c, 0x5393, 0x0120, 0x2009, 0x0007, 0x0804, 0x3362,
-	0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x6237, 0x1904, 0x3365,
-	0x9186, 0x007f, 0x0138, 0x080c, 0x655b, 0x0120, 0x2009, 0x0009,
-	0x0804, 0x3362, 0x080c, 0x4872, 0x1120, 0x2009, 0x0002, 0x0804,
-	0x3362, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001, 0x0100,
-	0x8007, 0xa80a, 0x080c, 0xbce1, 0x1120, 0x2009, 0x0003, 0x0804,
-	0x3362, 0x7007, 0x0003, 0x701f, 0x5176, 0x0005, 0xa808, 0x8007,
-	0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x3362, 0xa8e0,
-	0xa866, 0xa810, 0x8007, 0x9084, 0x00ff, 0x800c, 0xa814, 0x8007,
-	0x9084, 0x00ff, 0x8004, 0x9080, 0x0002, 0x9108, 0x8906, 0x8006,
-	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0004, 0x7a8c,
-	0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x48be, 0x080c, 0x4872, 0x1120,
-	0x2009, 0x0002, 0x0804, 0x3362, 0x7984, 0x9194, 0xff00, 0x918c,
-	0x00ff, 0x8217, 0x82ff, 0x1118, 0x7023, 0x1984, 0x0040, 0x92c6,
-	0x0001, 0x1118, 0x7023, 0x199e, 0x0010, 0x0804, 0x3365, 0x2009,
-	0x001a, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019,
-	0xaf60, 0x080c, 0x48bb, 0x701f, 0x51c6, 0x0005, 0x2001, 0x182d,
-	0x2003, 0x0001, 0xa85c, 0x9080, 0x0019, 0x2098, 0xa860, 0x20e0,
-	0x20a9, 0x001a, 0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003, 0x0804,
-	0x3330, 0x080c, 0x4872, 0x1120, 0x2009, 0x0002, 0x0804, 0x3362,
-	0x7984, 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118,
-	0x2099, 0x1984, 0x0040, 0x92c6, 0x0001, 0x1118, 0x2099, 0x199e,
-	0x0010, 0x0804, 0x3365, 0xa85c, 0x9080, 0x0019, 0x20a0, 0xa860,
-	0x20e8, 0x20a9, 0x001a, 0x20e1, 0x0001, 0x4003, 0x2009, 0x001a,
+	0x0120, 0x9386, 0x003c, 0x0170, 0x0c20, 0x83ff, 0x1148, 0x7224,
+	0x900e, 0x2001, 0x0003, 0x080c, 0x8270, 0x2208, 0x0804, 0x3337,
+	0x7033, 0x0001, 0x7122, 0x7024, 0x9300, 0x7026, 0x2061, 0x18ae,
+	0x2c44, 0xa06b, 0x0000, 0xa37a, 0x7028, 0xa076, 0x7034, 0xa072,
+	0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x10d5, 0x7007, 0x0002,
+	0x701f, 0x4d13, 0x0005, 0x7030, 0x9005, 0x1178, 0x7120, 0x7028,
+	0x20a0, 0x901e, 0x7034, 0x20e8, 0x2061, 0x18ae, 0x2c44, 0xa48c,
+	0xa590, 0xa694, 0xa798, 0x0804, 0x4cd1, 0x7224, 0x900e, 0x2001,
+	0x0003, 0x080c, 0x8270, 0x2208, 0x0804, 0x3337, 0x00f6, 0x00e6,
+	0x080c, 0x539a, 0x2009, 0x0007, 0x1904, 0x4da6, 0x2071, 0x1894,
+	0x745c, 0x84ff, 0x2009, 0x000e, 0x1904, 0x4da6, 0xac9c, 0xad98,
+	0xaea4, 0xafa0, 0x0096, 0x080c, 0x1004, 0x2009, 0x0002, 0x0904,
+	0x4da6, 0x2900, 0x705e, 0x900e, 0x901e, 0x7356, 0x7362, 0xa860,
+	0x7066, 0xa85c, 0x9080, 0x0003, 0x705a, 0x20a0, 0x91d8, 0x1000,
+	0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6562, 0x0118, 0x080c, 0x656a,
+	0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004, 0x4104,
+	0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c,
+	0x01e8, 0x0c20, 0x83ff, 0x11c0, 0x7254, 0x900e, 0x2001, 0x0003,
+	0x080c, 0x8270, 0x2208, 0x009e, 0xa897, 0x4000, 0xa99a, 0x715c,
+	0x81ff, 0x090c, 0x0db4, 0x2148, 0x080c, 0x101d, 0x9006, 0x705e,
+	0x918d, 0x0001, 0x2008, 0x0418, 0x7063, 0x0001, 0x7152, 0x7054,
+	0x9300, 0x7056, 0x2061, 0x18af, 0x2c44, 0xa37a, 0x7058, 0xa076,
+	0x7064, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0xa09f, 0x4db2,
+	0x000e, 0xa0a2, 0x080c, 0x10d5, 0x9006, 0x0048, 0x009e, 0xa897,
+	0x4005, 0xa99a, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x00ee,
+	0x00fe, 0x0005, 0x00f6, 0xa0a0, 0x904d, 0x090c, 0x0db4, 0x00e6,
+	0x2071, 0x1894, 0xa06c, 0x908e, 0x0100, 0x0138, 0xa87b, 0x0030,
+	0xa883, 0x0000, 0xa897, 0x4002, 0x00d8, 0x7060, 0x9005, 0x1158,
+	0x7150, 0x7058, 0x20a0, 0x901e, 0x7064, 0x20e8, 0xa48c, 0xa590,
+	0xa694, 0xa798, 0x0428, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897,
+	0x4000, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x8270, 0xaa9a,
+	0x715c, 0x81ff, 0x090c, 0x0db4, 0x2148, 0x080c, 0x101d, 0x705f,
+	0x0000, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x688c,
+	0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x00ee, 0x00fe, 0x0005,
+	0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6562, 0x0118,
+	0x080c, 0x656a, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810,
+	0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120,
+	0x9386, 0x003c, 0x0518, 0x0c20, 0x83ff, 0x11f0, 0x7154, 0x810c,
+	0xa99a, 0xa897, 0x4000, 0x715c, 0x81ff, 0x090c, 0x0db4, 0x2148,
+	0x080c, 0x101d, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008, 0xa0a0,
+	0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x688c, 0x012e, 0xa09f,
+	0x0000, 0xa0a3, 0x0000, 0x0070, 0x7063, 0x0001, 0x7152, 0x7054,
+	0x9300, 0x7056, 0xa37a, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c,
+	0x10d5, 0x9006, 0x00ee, 0x0005, 0x0096, 0xa88c, 0x90be, 0x7000,
+	0x0148, 0x90be, 0x7100, 0x0130, 0x90be, 0x7200, 0x0118, 0x009e,
+	0x0804, 0x336c, 0xa884, 0xa988, 0x080c, 0x2663, 0x1518, 0x080c,
+	0x61de, 0x1500, 0x7126, 0xbe12, 0xbd16, 0xae7c, 0x080c, 0x4879,
+	0x01c8, 0x080c, 0x4879, 0x01b0, 0x009e, 0xa867, 0x0000, 0xa868,
+	0xc0fd, 0xa86a, 0xa823, 0x0000, 0xa804, 0x2048, 0x080c, 0xbcc1,
+	0x1120, 0x2009, 0x0003, 0x0804, 0x3369, 0x7007, 0x0003, 0x701f,
+	0x4e7f, 0x0005, 0x009e, 0x2009, 0x0002, 0x0804, 0x3369, 0x7124,
+	0x080c, 0x30d5, 0xa820, 0x9086, 0x8001, 0x1120, 0x2009, 0x0004,
+	0x0804, 0x3369, 0x2900, 0x7022, 0xa804, 0x0096, 0x2048, 0x8906,
+	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x009e, 0x9080,
+	0x0002, 0x0076, 0x0006, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9,
+	0x002a, 0x080c, 0x0f68, 0xaa6c, 0xab70, 0xac74, 0xad78, 0x2061,
+	0x18ae, 0x2c44, 0xa06b, 0x0000, 0xae64, 0xaf8c, 0x97c6, 0x7000,
+	0x0118, 0x97c6, 0x7100, 0x1148, 0x96c2, 0x0004, 0x0600, 0x2009,
+	0x0004, 0x000e, 0x007e, 0x0804, 0x48c5, 0x97c6, 0x7200, 0x11b8,
+	0x96c2, 0x0054, 0x02a0, 0x000e, 0x007e, 0x2061, 0x18ae, 0x2c44,
+	0xa076, 0xa772, 0xa07b, 0x002a, 0xa28e, 0xa392, 0xa496, 0xa59a,
+	0x080c, 0x10d5, 0x7007, 0x0002, 0x701f, 0x4edb, 0x0005, 0x000e,
+	0x007e, 0x0804, 0x336c, 0x7020, 0x2048, 0xa804, 0x2048, 0xa804,
+	0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x0002, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a,
+	0x080c, 0x0f68, 0x2100, 0x2238, 0x2061, 0x18ae, 0x2c44, 0xa28c,
+	0xa390, 0xa494, 0xa598, 0x2009, 0x002a, 0x0804, 0x48c5, 0x81ff,
+	0x1904, 0x3369, 0x798c, 0x2001, 0x194f, 0x918c, 0x8000, 0x2102,
+	0x080c, 0x4890, 0x0904, 0x336c, 0x080c, 0x6562, 0x0120, 0x080c,
+	0x656a, 0x1904, 0x336c, 0x080c, 0x6305, 0x0904, 0x3369, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x63cb, 0x012e, 0x0904, 0x3369, 0x2001,
+	0x194f, 0x2004, 0xd0fc, 0x1904, 0x3337, 0x0804, 0x4301, 0xa9a0,
+	0x2001, 0x194f, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x489d,
+	0x01a0, 0x080c, 0x6562, 0x0118, 0x080c, 0x656a, 0x1170, 0x080c,
+	0x6305, 0x2009, 0x0002, 0x0128, 0x080c, 0x63cb, 0x1170, 0x2009,
+	0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e,
+	0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001,
+	0x194f, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x538e, 0x0110, 0x9006,
+	0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x78a8,
+	0xd08c, 0x1118, 0xd084, 0x0904, 0x4276, 0x080c, 0x48ac, 0x0904,
+	0x336c, 0x080c, 0x4879, 0x1120, 0x2009, 0x0002, 0x0804, 0x3369,
+	0x080c, 0x6562, 0x0130, 0x908e, 0x0004, 0x0118, 0x908e, 0x0005,
+	0x15a0, 0x78a8, 0xd08c, 0x0120, 0xb800, 0xc08c, 0xb802, 0x0028,
+	0x080c, 0x5386, 0xd0b4, 0x0904, 0x42b0, 0x7884, 0x908e, 0x007e,
+	0x0904, 0x42b0, 0x908e, 0x007f, 0x0904, 0x42b0, 0x908e, 0x0080,
+	0x0904, 0x42b0, 0xb800, 0xd08c, 0x1904, 0x42b0, 0xa867, 0x0000,
+	0xa868, 0xc0fd, 0xa86a, 0x080c, 0xbce0, 0x1120, 0x2009, 0x0003,
+	0x0804, 0x3369, 0x7007, 0x0003, 0x701f, 0x4fa7, 0x0005, 0x080c,
+	0x48ac, 0x0904, 0x336c, 0x0804, 0x42b0, 0x080c, 0x312e, 0x0108,
+	0x0005, 0x2009, 0x1833, 0x210c, 0x81ff, 0x0120, 0x2009, 0x0001,
+	0x0804, 0x3369, 0x080c, 0x539a, 0x0120, 0x2009, 0x0007, 0x0804,
+	0x3369, 0x080c, 0x655a, 0x0120, 0x2009, 0x0008, 0x0804, 0x3369,
+	0xb89c, 0xd0a4, 0x1118, 0xd0ac, 0x1904, 0x42b0, 0x9006, 0xa866,
+	0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xbd3a, 0x1120, 0x2009,
+	0x0003, 0x0804, 0x3369, 0x7007, 0x0003, 0x701f, 0x4fe0, 0x0005,
+	0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x52e3,
+	0x080c, 0x48ac, 0x0904, 0x336c, 0x0804, 0x4f79, 0x81ff, 0x2009,
+	0x0001, 0x1904, 0x3369, 0x080c, 0x539a, 0x2009, 0x0007, 0x1904,
+	0x3369, 0x080c, 0x655a, 0x0120, 0x2009, 0x0008, 0x0804, 0x3369,
+	0x080c, 0x48ac, 0x0904, 0x336c, 0x080c, 0x6562, 0x2009, 0x0009,
+	0x1904, 0x3369, 0x080c, 0x4879, 0x2009, 0x0002, 0x0904, 0x3369,
+	0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x7988, 0x9194,
+	0xff00, 0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128, 0xc0ed, 0xa952,
+	0x798c, 0xa956, 0x0038, 0x928e, 0x0100, 0x1904, 0x336c, 0xc0e5,
+	0xa952, 0xa956, 0xa83e, 0x080c, 0xbf8d, 0x2009, 0x0003, 0x0904,
+	0x3369, 0x7007, 0x0003, 0x701f, 0x5036, 0x0005, 0xa830, 0x9086,
+	0x0100, 0x2009, 0x0004, 0x0904, 0x3369, 0x0804, 0x3337, 0x7aa8,
+	0x9284, 0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c, 0x539a, 0x1188,
+	0x2009, 0x0014, 0x0804, 0x3369, 0xd2dc, 0x1568, 0x81ff, 0x2009,
+	0x0001, 0x1904, 0x3369, 0x080c, 0x539a, 0x2009, 0x0007, 0x1904,
+	0x3369, 0xd2f4, 0x0130, 0x9284, 0x5000, 0x080c, 0x5361, 0x0804,
+	0x3337, 0xd2fc, 0x0158, 0x080c, 0x48ac, 0x0904, 0x336c, 0x7984,
+	0x9284, 0x9000, 0x080c, 0x533e, 0x0804, 0x3337, 0x080c, 0x48ac,
+	0x0904, 0x336c, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x2009,
+	0x0009, 0x1904, 0x511f, 0x080c, 0x4879, 0x2009, 0x0002, 0x0904,
+	0x511f, 0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009, 0x0008, 0x7a8c,
+	0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x48c2, 0x701f, 0x5090, 0x0005,
+	0xa86c, 0x9086, 0x0500, 0x1138, 0xa870, 0x9005, 0x1120, 0xa874,
+	0x9084, 0xff00, 0x0110, 0x1904, 0x336c, 0xa866, 0xa832, 0xa868,
+	0xc0fd, 0xa86a, 0x080c, 0x48ac, 0x1110, 0x0804, 0x336c, 0x2009,
+	0x0043, 0x080c, 0xbff5, 0x2009, 0x0003, 0x0904, 0x511f, 0x7007,
+	0x0003, 0x701f, 0x50b4, 0x0005, 0xa830, 0x9086, 0x0100, 0x2009,
+	0x0004, 0x0904, 0x511f, 0x7984, 0x7aa8, 0x9284, 0x1000, 0x080c,
+	0x533e, 0x0804, 0x3337, 0x00c6, 0xaab0, 0x9284, 0xc000, 0x0140,
+	0xd2ec, 0x0168, 0x080c, 0x539a, 0x1150, 0x2009, 0x0014, 0x04f0,
+	0x2061, 0x1800, 0x080c, 0x539a, 0x2009, 0x0007, 0x15b8, 0xd2f4,
+	0x0128, 0x9284, 0x5000, 0x080c, 0x5361, 0x0050, 0xd2fc, 0x0178,
+	0x080c, 0x48aa, 0x0588, 0xa998, 0x9284, 0x9000, 0x080c, 0x533e,
+	0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0438, 0x080c,
+	0x48aa, 0x0510, 0x080c, 0x6562, 0x2009, 0x0009, 0x11b8, 0xa8c4,
+	0x9086, 0x0500, 0x11c8, 0xa8c8, 0x9005, 0x11b0, 0xa8cc, 0x9084,
+	0xff00, 0x1190, 0x080c, 0x48aa, 0x1108, 0x0070, 0x2009, 0x004b,
+	0x080c, 0xbff5, 0x2009, 0x0003, 0x0108, 0x0078, 0x0429, 0x19c0,
+	0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0030, 0x00ce, 0x0005, 0x9006, 0x0ce0, 0x7aa8,
+	0xd2dc, 0x0904, 0x3369, 0x0016, 0x7984, 0x9284, 0x1000, 0xc0fd,
+	0x080c, 0x533e, 0x001e, 0x1904, 0x3369, 0x0804, 0x3337, 0x00f6,
+	0x2d78, 0x0011, 0x00fe, 0x0005, 0xaab0, 0xd2dc, 0x0150, 0x0016,
+	0xa998, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x533e, 0x001e, 0x9085,
+	0x0001, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x3369,
+	0x080c, 0x539a, 0x0120, 0x2009, 0x0007, 0x0804, 0x3369, 0x7984,
+	0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x623e, 0x1904, 0x336c, 0x9186,
+	0x007f, 0x0138, 0x080c, 0x6562, 0x0120, 0x2009, 0x0009, 0x0804,
+	0x3369, 0x080c, 0x4879, 0x1120, 0x2009, 0x0002, 0x0804, 0x3369,
+	0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001, 0x0100, 0x8007,
+	0xa80a, 0x080c, 0xbcfa, 0x1120, 0x2009, 0x0003, 0x0804, 0x3369,
+	0x7007, 0x0003, 0x701f, 0x517d, 0x0005, 0xa808, 0x8007, 0x9086,
+	0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x3369, 0xa8e0, 0xa866,
+	0xa810, 0x8007, 0x9084, 0x00ff, 0x800c, 0xa814, 0x8007, 0x9084,
+	0x00ff, 0x8004, 0x9080, 0x0002, 0x9108, 0x8906, 0x8006, 0x8007,
+	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0004, 0x7a8c, 0x7b88,
+	0x7c9c, 0x7d98, 0x0804, 0x48c5, 0x080c, 0x4879, 0x1120, 0x2009,
+	0x0002, 0x0804, 0x3369, 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff,
+	0x8217, 0x82ff, 0x1118, 0x7023, 0x1984, 0x0040, 0x92c6, 0x0001,
+	0x1118, 0x7023, 0x199e, 0x0010, 0x0804, 0x336c, 0x2009, 0x001a,
 	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60,
-	0x0804, 0x48be, 0x7884, 0x908a, 0x1000, 0x1a04, 0x3365, 0x0126,
-	0x2091, 0x8000, 0x8003, 0x800b, 0x810b, 0x9108, 0x00c6, 0x2061,
-	0x19cb, 0x6142, 0x00ce, 0x012e, 0x0804, 0x3330, 0x00c6, 0x080c,
-	0x6fa7, 0x1160, 0x080c, 0x728b, 0x080c, 0x5cca, 0x9085, 0x0001,
-	0x080c, 0x6fee, 0x080c, 0x6ed9, 0x080c, 0x0db4, 0x2061, 0x1800,
-	0x6030, 0xc09d, 0x6032, 0x080c, 0x5b89, 0x00ce, 0x0005, 0x00c6,
-	0x2001, 0x1800, 0x2004, 0x908e, 0x0000, 0x0904, 0x3362, 0x7884,
-	0x9005, 0x0188, 0x7888, 0x2061, 0x196d, 0x2c0c, 0x2062, 0x080c,
-	0x2a45, 0x01a0, 0x080c, 0x2a4d, 0x0188, 0x080c, 0x2a55, 0x0170,
-	0x2162, 0x0804, 0x3365, 0x2061, 0x0100, 0x6038, 0x9086, 0x0007,
-	0x1118, 0x2009, 0x0001, 0x0010, 0x2009, 0x0000, 0x7884, 0x9086,
-	0x0002, 0x1548, 0x2061, 0x0100, 0x6028, 0xc09c, 0x602a, 0x0026,
-	0x2011, 0x0003, 0x080c, 0x9758, 0x2011, 0x0002, 0x080c, 0x9762,
-	0x002e, 0x080c, 0x9649, 0x0036, 0x901e, 0x080c, 0x96bf, 0x003e,
-	0x60e3, 0x0000, 0x080c, 0xd894, 0x080c, 0xd8af, 0x9085, 0x0001,
-	0x080c, 0x6fee, 0x9006, 0x080c, 0x2b14, 0x2001, 0x1800, 0x2003,
-	0x0004, 0x6027, 0x0008, 0x00ce, 0x0804, 0x3330, 0x81ff, 0x0120,
-	0x2009, 0x0001, 0x0804, 0x3362, 0x080c, 0x5393, 0x0120, 0x2009,
-	0x0007, 0x0804, 0x3362, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c,
-	0x6237, 0x1904, 0x3365, 0x9186, 0x007f, 0x0138, 0x080c, 0x655b,
-	0x0120, 0x2009, 0x0009, 0x0804, 0x3362, 0x080c, 0x4872, 0x1120,
-	0x2009, 0x0002, 0x0804, 0x3362, 0xa867, 0x0000, 0xa868, 0xc0fd,
-	0xa86a, 0x080c, 0xbce4, 0x1120, 0x2009, 0x0003, 0x0804, 0x3362,
-	0x7007, 0x0003, 0x701f, 0x52c5, 0x0005, 0xa830, 0x9086, 0x0100,
-	0x1120, 0x2009, 0x0004, 0x0804, 0x3362, 0xa8e0, 0xa866, 0xa834,
-	0x8007, 0x800c, 0xa85c, 0x9080, 0x000c, 0x7a8c, 0x7b88, 0x7c9c,
-	0x7d98, 0xaf60, 0x0804, 0x48be, 0xa898, 0x9086, 0x000d, 0x1904,
-	0x3362, 0x2021, 0x4005, 0x0126, 0x2091, 0x8000, 0x0e04, 0x52e9,
-	0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833,
-	0x0011, 0x0010, 0x7833, 0x0010, 0x7883, 0x4005, 0xa998, 0x7986,
-	0xa9a4, 0x799a, 0xa9a8, 0x799e, 0x080c, 0x48ae, 0x2091, 0x4080,
-	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x7007, 0x0001,
-	0x2091, 0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x0126, 0x2091,
-	0x8000, 0x00c6, 0x2061, 0x19cb, 0x7984, 0x6152, 0x614e, 0x6057,
-	0x0000, 0x604b, 0x0009, 0x7898, 0x606a, 0x789c, 0x6066, 0x7888,
-	0x6062, 0x788c, 0x605e, 0x2001, 0x19d9, 0x2044, 0x2001, 0x19e0,
-	0xa076, 0xa060, 0xa072, 0xa07b, 0x0001, 0xa07f, 0x0002, 0xa06b,
-	0x0000, 0xa09f, 0x0000, 0x00ce, 0x012e, 0x0804, 0x3330, 0x0126,
-	0x2091, 0x8000, 0x00b6, 0x00c6, 0x90e4, 0xc000, 0x0128, 0x0006,
-	0x080c, 0xbb4b, 0x000e, 0x1198, 0xd0e4, 0x0160, 0x9180, 0x1000,
-	0x2004, 0x905d, 0x0160, 0x080c, 0x5ce4, 0x080c, 0x9d98, 0x0110,
-	0xb817, 0x0000, 0x9006, 0x00ce, 0x00be, 0x012e, 0x0005, 0x9085,
-	0x0001, 0x0cc8, 0x0126, 0x2091, 0x8000, 0x0156, 0x2010, 0x900e,
-	0x20a9, 0x0800, 0x0016, 0x9180, 0x1000, 0x2004, 0x9005, 0x0180,
-	0x9186, 0x007e, 0x0168, 0x9186, 0x007f, 0x0150, 0x9186, 0x0080,
-	0x0138, 0x9186, 0x00ff, 0x0120, 0x0026, 0x2200, 0x0801, 0x002e,
-	0x001e, 0x8108, 0x1f04, 0x5362, 0x015e, 0x012e, 0x0005, 0x2001,
-	0x1854, 0x2004, 0x0005, 0x2001, 0x1873, 0x2004, 0x0005, 0x0006,
-	0x2001, 0x1810, 0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001, 0x180e,
-	0x2004, 0xd0b4, 0x0005, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003,
-	0x0005, 0x0016, 0x00e6, 0x2071, 0x1894, 0x7108, 0x910d, 0x710a,
-	0x00ee, 0x001e, 0x0005, 0x79a4, 0x9182, 0x0081, 0x1a04, 0x3365,
-	0x810c, 0x0016, 0x080c, 0x4872, 0x080c, 0x0ef3, 0x2100, 0x2238,
-	0x7d84, 0x7c88, 0x7b8c, 0x7a90, 0x001e, 0x080c, 0x48bb, 0x701f,
-	0x53ba, 0x0005, 0x2079, 0x0000, 0x7d94, 0x7c98, 0x7ba8, 0x7aac,
-	0x79a4, 0x810c, 0x2061, 0x18ae, 0x2c44, 0xa770, 0xa074, 0x2071,
-	0x1894, 0x080c, 0x48be, 0x701f, 0x53ce, 0x0005, 0x2061, 0x18ae,
-	0x2c44, 0x0016, 0x0026, 0xa270, 0xa174, 0x080c, 0x0efb, 0x002e,
-	0x001e, 0x080c, 0x0fa8, 0x9006, 0xa802, 0xa806, 0x0804, 0x3330,
-	0x0126, 0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6,
-	0x00e6, 0x00f6, 0x2061, 0x0100, 0x2069, 0x0200, 0x2071, 0x1800,
-	0x6044, 0xd0a4, 0x11e8, 0xd084, 0x0118, 0x080c, 0x5589, 0x0068,
-	0xd08c, 0x0118, 0x080c, 0x5492, 0x0040, 0xd094, 0x0118, 0x080c,
-	0x5462, 0x0018, 0xd09c, 0x0108, 0x0099, 0x00fe, 0x00ee, 0x00de,
-	0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x012e, 0x0005,
-	0x0016, 0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e, 0x0c68,
-	0x0006, 0x7094, 0x9005, 0x000e, 0x0120, 0x7097, 0x0000, 0x708f,
-	0x0000, 0x624c, 0x9286, 0xf0f0, 0x1150, 0x6048, 0x9086, 0xf0f0,
-	0x0130, 0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0490, 0x9294,
-	0xff00, 0x9296, 0xf700, 0x0178, 0x7138, 0xd1a4, 0x1160, 0x6240,
-	0x9295, 0x0100, 0x6242, 0x9294, 0x0010, 0x0128, 0x2009, 0x00f7,
-	0x080c, 0x5c46, 0x00f0, 0x6040, 0x9084, 0x0010, 0x9085, 0x0140,
-	0x6042, 0x6043, 0x0000, 0x7083, 0x0000, 0x709f, 0x0001, 0x70c3,
-	0x0000, 0x70db, 0x0000, 0x2009, 0x1c80, 0x200b, 0x0000, 0x7093,
-	0x0000, 0x7087, 0x000f, 0x2009, 0x000f, 0x2011, 0x5b2c, 0x080c,
-	0x80a2, 0x0005, 0x2001, 0x1875, 0x2004, 0xd08c, 0x0110, 0x705b,
-	0xffff, 0x7084, 0x9005, 0x1528, 0x2011, 0x5b2c, 0x080c, 0x8010,
-	0x6040, 0x9094, 0x0010, 0x9285, 0x0020, 0x6042, 0x20a9, 0x00c8,
-	0x6044, 0xd08c, 0x1168, 0x1f04, 0x5478, 0x6242, 0x7097, 0x0000,
-	0x6040, 0x9094, 0x0010, 0x9285, 0x0080, 0x6042, 0x6242, 0x0048,
-	0x6242, 0x7097, 0x0000, 0x708b, 0x0000, 0x9006, 0x080c, 0x5ccf,
-	0x0000, 0x0005, 0x7088, 0x908a, 0x0003, 0x1a0c, 0x0db4, 0x000b,
-	0x0005, 0x549c, 0x54ed, 0x5588, 0x00f6, 0x0016, 0x6900, 0x918c,
-	0x0800, 0x708b, 0x0001, 0x2001, 0x015d, 0x2003, 0x0000, 0x6803,
-	0x00fc, 0x20a9, 0x0004, 0x6800, 0x9084, 0x00fc, 0x0120, 0x1f04,
-	0x54ab, 0x080c, 0x0db4, 0x68a0, 0x68a2, 0x689c, 0x689e, 0x6898,
-	0x689a, 0xa001, 0x918d, 0x1600, 0x6902, 0x001e, 0x6837, 0x0020,
-	0x080c, 0x5cab, 0x2079, 0x1c00, 0x7833, 0x1101, 0x7837, 0x0000,
-	0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0001, 0x20a1, 0x1c0e,
-	0x20a9, 0x0004, 0x4003, 0x080c, 0x9c26, 0x20e1, 0x0001, 0x2099,
+	0x080c, 0x48c2, 0x701f, 0x51cd, 0x0005, 0x2001, 0x182d, 0x2003,
+	0x0001, 0xa85c, 0x9080, 0x0019, 0x2098, 0xa860, 0x20e0, 0x20a9,
+	0x001a, 0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003, 0x0804, 0x3337,
+	0x080c, 0x4879, 0x1120, 0x2009, 0x0002, 0x0804, 0x3369, 0x7984,
+	0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118, 0x2099,
+	0x1984, 0x0040, 0x92c6, 0x0001, 0x1118, 0x2099, 0x199e, 0x0010,
+	0x0804, 0x336c, 0xa85c, 0x9080, 0x0019, 0x20a0, 0xa860, 0x20e8,
+	0x20a9, 0x001a, 0x20e1, 0x0001, 0x4003, 0x2009, 0x001a, 0x7a8c,
+	0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x0804,
+	0x48c5, 0x7884, 0x908a, 0x1000, 0x1a04, 0x336c, 0x0126, 0x2091,
+	0x8000, 0x8003, 0x800b, 0x810b, 0x9108, 0x00c6, 0x2061, 0x19cb,
+	0x6142, 0x00ce, 0x012e, 0x0804, 0x3337, 0x00c6, 0x080c, 0x6fb2,
+	0x1160, 0x080c, 0x7296, 0x080c, 0x5cd1, 0x9085, 0x0001, 0x080c,
+	0x6ff9, 0x080c, 0x6ee4, 0x080c, 0x0db4, 0x2061, 0x1800, 0x6030,
+	0xc09d, 0x6032, 0x080c, 0x5b90, 0x00ce, 0x0005, 0x00c6, 0x2001,
+	0x1800, 0x2004, 0x908e, 0x0000, 0x0904, 0x3369, 0x7884, 0x9005,
+	0x0188, 0x7888, 0x2061, 0x196d, 0x2c0c, 0x2062, 0x080c, 0x2a45,
+	0x01a0, 0x080c, 0x2a4d, 0x0188, 0x080c, 0x2a55, 0x0170, 0x2162,
+	0x0804, 0x336c, 0x2061, 0x0100, 0x6038, 0x9086, 0x0007, 0x1118,
+	0x2009, 0x0001, 0x0010, 0x2009, 0x0000, 0x7884, 0x9086, 0x0002,
+	0x1548, 0x2061, 0x0100, 0x6028, 0xc09c, 0x602a, 0x0026, 0x2011,
+	0x0003, 0x080c, 0x9771, 0x2011, 0x0002, 0x080c, 0x977b, 0x002e,
+	0x080c, 0x9662, 0x0036, 0x901e, 0x080c, 0x96d8, 0x003e, 0x60e3,
+	0x0000, 0x080c, 0xd8b4, 0x080c, 0xd8cf, 0x9085, 0x0001, 0x080c,
+	0x6ff9, 0x9006, 0x080c, 0x2b14, 0x2001, 0x1800, 0x2003, 0x0004,
+	0x6027, 0x0008, 0x00ce, 0x0804, 0x3337, 0x81ff, 0x0120, 0x2009,
+	0x0001, 0x0804, 0x3369, 0x080c, 0x539a, 0x0120, 0x2009, 0x0007,
+	0x0804, 0x3369, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x623e,
+	0x1904, 0x336c, 0x9186, 0x007f, 0x0138, 0x080c, 0x6562, 0x0120,
+	0x2009, 0x0009, 0x0804, 0x3369, 0x080c, 0x4879, 0x1120, 0x2009,
+	0x0002, 0x0804, 0x3369, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
+	0x080c, 0xbcfd, 0x1120, 0x2009, 0x0003, 0x0804, 0x3369, 0x7007,
+	0x0003, 0x701f, 0x52cc, 0x0005, 0xa830, 0x9086, 0x0100, 0x1120,
+	0x2009, 0x0004, 0x0804, 0x3369, 0xa8e0, 0xa866, 0xa834, 0x8007,
+	0x800c, 0xa85c, 0x9080, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
+	0xaf60, 0x0804, 0x48c5, 0xa898, 0x9086, 0x000d, 0x1904, 0x3369,
+	0x2021, 0x4005, 0x0126, 0x2091, 0x8000, 0x0e04, 0x52f0, 0x0010,
+	0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011,
+	0x0010, 0x7833, 0x0010, 0x7883, 0x4005, 0xa998, 0x7986, 0xa9a4,
+	0x799a, 0xa9a8, 0x799e, 0x080c, 0x48b5, 0x2091, 0x4080, 0x2001,
+	0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x7007, 0x0001, 0x2091,
+	0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000,
+	0x00c6, 0x2061, 0x19cb, 0x7984, 0x6152, 0x614e, 0x6057, 0x0000,
+	0x604b, 0x0009, 0x7898, 0x606a, 0x789c, 0x6066, 0x7888, 0x6062,
+	0x788c, 0x605e, 0x2001, 0x19d9, 0x2044, 0x2001, 0x19e0, 0xa076,
+	0xa060, 0xa072, 0xa07b, 0x0001, 0xa07f, 0x0002, 0xa06b, 0x0000,
+	0xa09f, 0x0000, 0x00ce, 0x012e, 0x0804, 0x3337, 0x0126, 0x2091,
+	0x8000, 0x00b6, 0x00c6, 0x90e4, 0xc000, 0x0128, 0x0006, 0x080c,
+	0xbb64, 0x000e, 0x1198, 0xd0e4, 0x0160, 0x9180, 0x1000, 0x2004,
+	0x905d, 0x0160, 0x080c, 0x5ceb, 0x080c, 0x9db1, 0x0110, 0xb817,
+	0x0000, 0x9006, 0x00ce, 0x00be, 0x012e, 0x0005, 0x9085, 0x0001,
+	0x0cc8, 0x0126, 0x2091, 0x8000, 0x0156, 0x2010, 0x900e, 0x20a9,
+	0x0800, 0x0016, 0x9180, 0x1000, 0x2004, 0x9005, 0x0180, 0x9186,
+	0x007e, 0x0168, 0x9186, 0x007f, 0x0150, 0x9186, 0x0080, 0x0138,
+	0x9186, 0x00ff, 0x0120, 0x0026, 0x2200, 0x0801, 0x002e, 0x001e,
+	0x8108, 0x1f04, 0x5369, 0x015e, 0x012e, 0x0005, 0x2001, 0x1854,
+	0x2004, 0x0005, 0x2001, 0x1873, 0x2004, 0x0005, 0x0006, 0x2001,
+	0x1810, 0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001, 0x180e, 0x2004,
+	0xd0b4, 0x0005, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x0005,
+	0x0016, 0x00e6, 0x2071, 0x1894, 0x7108, 0x910d, 0x710a, 0x00ee,
+	0x001e, 0x0005, 0x79a4, 0x9182, 0x0081, 0x1a04, 0x336c, 0x810c,
+	0x0016, 0x080c, 0x4879, 0x080c, 0x0ef3, 0x2100, 0x2238, 0x7d84,
+	0x7c88, 0x7b8c, 0x7a90, 0x001e, 0x080c, 0x48c2, 0x701f, 0x53c1,
+	0x0005, 0x2079, 0x0000, 0x7d94, 0x7c98, 0x7ba8, 0x7aac, 0x79a4,
+	0x810c, 0x2061, 0x18ae, 0x2c44, 0xa770, 0xa074, 0x2071, 0x1894,
+	0x080c, 0x48c5, 0x701f, 0x53d5, 0x0005, 0x2061, 0x18ae, 0x2c44,
+	0x0016, 0x0026, 0xa270, 0xa174, 0x080c, 0x0efb, 0x002e, 0x001e,
+	0x080c, 0x0fa8, 0x9006, 0xa802, 0xa806, 0x0804, 0x3337, 0x0126,
+	0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6,
+	0x00f6, 0x2061, 0x0100, 0x2069, 0x0200, 0x2071, 0x1800, 0x6044,
+	0xd0a4, 0x11e8, 0xd084, 0x0118, 0x080c, 0x5590, 0x0068, 0xd08c,
+	0x0118, 0x080c, 0x5499, 0x0040, 0xd094, 0x0118, 0x080c, 0x5469,
+	0x0018, 0xd09c, 0x0108, 0x0099, 0x00fe, 0x00ee, 0x00de, 0x00ce,
+	0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x012e, 0x0005, 0x0016,
+	0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e, 0x0c68, 0x0006,
+	0x7094, 0x9005, 0x000e, 0x0120, 0x7097, 0x0000, 0x708f, 0x0000,
+	0x624c, 0x9286, 0xf0f0, 0x1150, 0x6048, 0x9086, 0xf0f0, 0x0130,
+	0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0490, 0x9294, 0xff00,
+	0x9296, 0xf700, 0x0178, 0x7138, 0xd1a4, 0x1160, 0x6240, 0x9295,
+	0x0100, 0x6242, 0x9294, 0x0010, 0x0128, 0x2009, 0x00f7, 0x080c,
+	0x5c4d, 0x00f0, 0x6040, 0x9084, 0x0010, 0x9085, 0x0140, 0x6042,
+	0x6043, 0x0000, 0x7083, 0x0000, 0x709f, 0x0001, 0x70c3, 0x0000,
+	0x70db, 0x0000, 0x2009, 0x1c80, 0x200b, 0x0000, 0x7093, 0x0000,
+	0x7087, 0x000f, 0x2009, 0x000f, 0x2011, 0x5b33, 0x080c, 0x80ca,
+	0x0005, 0x2001, 0x1875, 0x2004, 0xd08c, 0x0110, 0x705b, 0xffff,
+	0x7084, 0x9005, 0x1528, 0x2011, 0x5b33, 0x080c, 0x8038, 0x6040,
+	0x9094, 0x0010, 0x9285, 0x0020, 0x6042, 0x20a9, 0x00c8, 0x6044,
+	0xd08c, 0x1168, 0x1f04, 0x547f, 0x6242, 0x7097, 0x0000, 0x6040,
+	0x9094, 0x0010, 0x9285, 0x0080, 0x6042, 0x6242, 0x0048, 0x6242,
+	0x7097, 0x0000, 0x708b, 0x0000, 0x9006, 0x080c, 0x5cd6, 0x0000,
+	0x0005, 0x7088, 0x908a, 0x0003, 0x1a0c, 0x0db4, 0x000b, 0x0005,
+	0x54a3, 0x54f4, 0x558f, 0x00f6, 0x0016, 0x6900, 0x918c, 0x0800,
+	0x708b, 0x0001, 0x2001, 0x015d, 0x2003, 0x0000, 0x6803, 0x00fc,
+	0x20a9, 0x0004, 0x6800, 0x9084, 0x00fc, 0x0120, 0x1f04, 0x54b2,
+	0x080c, 0x0db4, 0x68a0, 0x68a2, 0x689c, 0x689e, 0x6898, 0x689a,
+	0xa001, 0x918d, 0x1600, 0x6902, 0x001e, 0x6837, 0x0020, 0x080c,
+	0x5cb2, 0x2079, 0x1c00, 0x7833, 0x1101, 0x7837, 0x0000, 0x20e1,
+	0x0001, 0x2099, 0x1805, 0x20e9, 0x0001, 0x20a1, 0x1c0e, 0x20a9,
+	0x0004, 0x4003, 0x080c, 0x9c3f, 0x20e1, 0x0001, 0x2099, 0x1c00,
+	0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3,
+	0x000c, 0x600f, 0x0000, 0x080c, 0x5b64, 0x00fe, 0x9006, 0x708e,
+	0x6043, 0x0008, 0x6042, 0x0005, 0x00f6, 0x708c, 0x708f, 0x0000,
+	0x9025, 0x0904, 0x556c, 0x6020, 0xd0b4, 0x1904, 0x556a, 0x719c,
+	0x81ff, 0x0904, 0x5558, 0x9486, 0x000c, 0x1904, 0x5565, 0x9480,
+	0x0018, 0x8004, 0x20a8, 0x080c, 0x5cab, 0x2011, 0x0260, 0x2019,
+	0x1c00, 0x220c, 0x2304, 0x9106, 0x11e8, 0x8210, 0x8318, 0x1f04,
+	0x5511, 0x6043, 0x0004, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f,
+	0xf0f0, 0x2061, 0x0100, 0x6043, 0x0006, 0x708b, 0x0002, 0x7097,
+	0x0002, 0x2009, 0x07d0, 0x2011, 0x5b3a, 0x080c, 0x80ca, 0x080c,
+	0x5cb2, 0x04c0, 0x080c, 0x5cab, 0x2079, 0x0260, 0x7930, 0x918e,
+	0x1101, 0x1558, 0x7834, 0x9005, 0x1540, 0x7900, 0x918c, 0x00ff,
+	0x1118, 0x7804, 0x9005, 0x0190, 0x080c, 0x5cab, 0x2011, 0x026e,
+	0x2019, 0x1805, 0x20a9, 0x0004, 0x220c, 0x2304, 0x9102, 0x0230,
+	0x11a0, 0x8210, 0x8318, 0x1f04, 0x554c, 0x0078, 0x709f, 0x0000,
+	0x080c, 0x5cab, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0001,
+	0x20a1, 0x1c00, 0x20a9, 0x0014, 0x4003, 0x6043, 0x0008, 0x6043,
+	0x0000, 0x0010, 0x00fe, 0x0005, 0x6040, 0x9085, 0x0100, 0x6042,
+	0x6020, 0xd0b4, 0x1db8, 0x080c, 0x9c3f, 0x20e1, 0x0001, 0x2099,
 	0x1c00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003,
-	0x60c3, 0x000c, 0x600f, 0x0000, 0x080c, 0x5b5d, 0x00fe, 0x9006,
-	0x708e, 0x6043, 0x0008, 0x6042, 0x0005, 0x00f6, 0x708c, 0x708f,
-	0x0000, 0x9025, 0x0904, 0x5565, 0x6020, 0xd0b4, 0x1904, 0x5563,
-	0x719c, 0x81ff, 0x0904, 0x5551, 0x9486, 0x000c, 0x1904, 0x555e,
-	0x9480, 0x0018, 0x8004, 0x20a8, 0x080c, 0x5ca4, 0x2011, 0x0260,
-	0x2019, 0x1c00, 0x220c, 0x2304, 0x9106, 0x11e8, 0x8210, 0x8318,
-	0x1f04, 0x550a, 0x6043, 0x0004, 0x2061, 0x0140, 0x605b, 0xbc94,
-	0x605f, 0xf0f0, 0x2061, 0x0100, 0x6043, 0x0006, 0x708b, 0x0002,
-	0x7097, 0x0002, 0x2009, 0x07d0, 0x2011, 0x5b33, 0x080c, 0x80a2,
-	0x080c, 0x5cab, 0x04c0, 0x080c, 0x5ca4, 0x2079, 0x0260, 0x7930,
-	0x918e, 0x1101, 0x1558, 0x7834, 0x9005, 0x1540, 0x7900, 0x918c,
-	0x00ff, 0x1118, 0x7804, 0x9005, 0x0190, 0x080c, 0x5ca4, 0x2011,
-	0x026e, 0x2019, 0x1805, 0x20a9, 0x0004, 0x220c, 0x2304, 0x9102,
-	0x0230, 0x11a0, 0x8210, 0x8318, 0x1f04, 0x5545, 0x0078, 0x709f,
-	0x0000, 0x080c, 0x5ca4, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9,
-	0x0001, 0x20a1, 0x1c00, 0x20a9, 0x0014, 0x4003, 0x6043, 0x0008,
-	0x6043, 0x0000, 0x0010, 0x00fe, 0x0005, 0x6040, 0x9085, 0x0100,
-	0x6042, 0x6020, 0xd0b4, 0x1db8, 0x080c, 0x9c26, 0x20e1, 0x0001,
-	0x2099, 0x1c00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014,
-	0x4003, 0x60c3, 0x000c, 0x2011, 0x19c2, 0x2013, 0x0000, 0x708f,
-	0x0000, 0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0x938a, 0x08d8,
-	0x0005, 0x7094, 0x908a, 0x001d, 0x1a0c, 0x0db4, 0x000b, 0x0005,
-	0x55ba, 0x55cd, 0x55f6, 0x5616, 0x563c, 0x566b, 0x5691, 0x56c9,
-	0x56ef, 0x571d, 0x5758, 0x5790, 0x57ae, 0x57d9, 0x57fb, 0x5816,
-	0x5820, 0x5854, 0x587a, 0x58a9, 0x58cf, 0x5907, 0x594b, 0x5988,
-	0x59a9, 0x5a02, 0x5a24, 0x5a52, 0x5a52, 0x00c6, 0x2061, 0x1800,
-	0x6003, 0x0007, 0x2061, 0x0100, 0x6004, 0x9084, 0xfff9, 0x6006,
-	0x00ce, 0x0005, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0,
-	0x2061, 0x0100, 0x6043, 0x0002, 0x7097, 0x0001, 0x2009, 0x07d0,
-	0x2011, 0x5b33, 0x080c, 0x80a2, 0x0005, 0x00f6, 0x708c, 0x9086,
-	0x0014, 0x1510, 0x6042, 0x6020, 0xd0b4, 0x11f0, 0x080c, 0x5ca4,
-	0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x11a0, 0x7834, 0x9005,
-	0x1188, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3,
-	0x0001, 0x2011, 0x5b33, 0x080c, 0x8010, 0x7097, 0x0010, 0x080c,
-	0x5820, 0x0010, 0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x7097,
-	0x0003, 0x6043, 0x0004, 0x2011, 0x5b33, 0x080c, 0x8010, 0x080c,
-	0x5c28, 0x2079, 0x0240, 0x7833, 0x1102, 0x7837, 0x0000, 0x20a9,
-	0x0008, 0x9f88, 0x000e, 0x200b, 0x0000, 0x8108, 0x1f04, 0x560b,
-	0x60c3, 0x0014, 0x080c, 0x5b5d, 0x00fe, 0x0005, 0x00f6, 0x708c,
-	0x9005, 0x0500, 0x2011, 0x5b33, 0x080c, 0x8010, 0x9086, 0x0014,
-	0x11b8, 0x080c, 0x5ca4, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102,
-	0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c0,
-	0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x0004, 0x0029, 0x0010,
-	0x080c, 0x5c80, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x0005, 0x080c,
-	0x5c28, 0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c,
-	0x5ca4, 0x080c, 0x5c87, 0x1170, 0x7080, 0x9005, 0x1158, 0x7158,
-	0x9186, 0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5ae0, 0x0168,
-	0x080c, 0x5c5d, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e,
-	0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c,
-	0x5b5d, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011,
-	0x5b33, 0x080c, 0x8010, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ca4,
+	0x60c3, 0x000c, 0x2011, 0x19c2, 0x2013, 0x0000, 0x708f, 0x0000,
+	0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0x93a3, 0x08d8, 0x0005,
+	0x7094, 0x908a, 0x001d, 0x1a0c, 0x0db4, 0x000b, 0x0005, 0x55c1,
+	0x55d4, 0x55fd, 0x561d, 0x5643, 0x5672, 0x5698, 0x56d0, 0x56f6,
+	0x5724, 0x575f, 0x5797, 0x57b5, 0x57e0, 0x5802, 0x581d, 0x5827,
+	0x585b, 0x5881, 0x58b0, 0x58d6, 0x590e, 0x5952, 0x598f, 0x59b0,
+	0x5a09, 0x5a2b, 0x5a59, 0x5a59, 0x00c6, 0x2061, 0x1800, 0x6003,
+	0x0007, 0x2061, 0x0100, 0x6004, 0x9084, 0xfff9, 0x6006, 0x00ce,
+	0x0005, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061,
+	0x0100, 0x6043, 0x0002, 0x7097, 0x0001, 0x2009, 0x07d0, 0x2011,
+	0x5b3a, 0x080c, 0x80ca, 0x0005, 0x00f6, 0x708c, 0x9086, 0x0014,
+	0x1510, 0x6042, 0x6020, 0xd0b4, 0x11f0, 0x080c, 0x5cab, 0x2079,
+	0x0260, 0x7a30, 0x9296, 0x1102, 0x11a0, 0x7834, 0x9005, 0x1188,
+	0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001,
+	0x2011, 0x5b3a, 0x080c, 0x8038, 0x7097, 0x0010, 0x080c, 0x5827,
+	0x0010, 0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x0003,
+	0x6043, 0x0004, 0x2011, 0x5b3a, 0x080c, 0x8038, 0x080c, 0x5c2f,
+	0x2079, 0x0240, 0x7833, 0x1102, 0x7837, 0x0000, 0x20a9, 0x0008,
+	0x9f88, 0x000e, 0x200b, 0x0000, 0x8108, 0x1f04, 0x5612, 0x60c3,
+	0x0014, 0x080c, 0x5b64, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005,
+	0x0500, 0x2011, 0x5b3a, 0x080c, 0x8038, 0x9086, 0x0014, 0x11b8,
+	0x080c, 0x5cab, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x1178,
+	0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005,
+	0x1110, 0x70c3, 0x0001, 0x7097, 0x0004, 0x0029, 0x0010, 0x080c,
+	0x5c87, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x0005, 0x080c, 0x5c2f,
+	0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x5cab,
+	0x080c, 0x5c8e, 0x1170, 0x7080, 0x9005, 0x1158, 0x7158, 0x9186,
+	0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5ae7, 0x0168, 0x080c,
+	0x5c64, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
+	0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b64,
+	0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b3a,
+	0x080c, 0x8038, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5cab, 0x2079,
+	0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005, 0x1160,
+	0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001,
+	0x7097, 0x0006, 0x0029, 0x0010, 0x080c, 0x5c87, 0x00fe, 0x0005,
+	0x00f6, 0x7097, 0x0007, 0x080c, 0x5c2f, 0x2079, 0x0240, 0x7833,
+	0x1104, 0x7837, 0x0000, 0x080c, 0x5cab, 0x080c, 0x5c8e, 0x11b8,
+	0x7080, 0x9005, 0x11a0, 0x7160, 0x9186, 0xffff, 0x0180, 0x9180,
+	0x3138, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c,
+	0x5ae7, 0x0180, 0x080c, 0x4c98, 0x0110, 0x080c, 0x26cc, 0x20a9,
+	0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
+	0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b64, 0x00fe, 0x0005,
+	0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b3a, 0x080c, 0x8038,
+	0x9086, 0x0014, 0x11b8, 0x080c, 0x5cab, 0x2079, 0x0260, 0x7a30,
+	0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
+	0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x0008,
+	0x0029, 0x0010, 0x080c, 0x5c87, 0x00fe, 0x0005, 0x00f6, 0x7097,
+	0x0009, 0x080c, 0x5c2f, 0x2079, 0x0240, 0x7833, 0x1105, 0x7837,
+	0x0100, 0x080c, 0x5c8e, 0x1150, 0x7080, 0x9005, 0x1138, 0x080c,
+	0x5a5a, 0x1188, 0x9085, 0x0001, 0x080c, 0x26cc, 0x20a9, 0x0008,
+	0x080c, 0x5cab, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
+	0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b64, 0x0010,
+	0x080c, 0x55b4, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005, 0x05a8,
+	0x2011, 0x5b3a, 0x080c, 0x8038, 0x9086, 0x0014, 0x1560, 0x080c,
+	0x5cab, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1520, 0x7834,
+	0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1160, 0x7a38, 0xd2fc,
+	0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x000a,
+	0x00b1, 0x0098, 0x9005, 0x1178, 0x7a38, 0xd2fc, 0x0128, 0x70c0,
+	0x9005, 0x1110, 0x70c3, 0x0001, 0x7093, 0x0000, 0x7097, 0x000e,
+	0x080c, 0x5802, 0x0010, 0x080c, 0x5c87, 0x00fe, 0x0005, 0x00f6,
+	0x7097, 0x000b, 0x2011, 0x1c0e, 0x20e9, 0x0001, 0x22a0, 0x20a9,
+	0x0040, 0x2019, 0xffff, 0x4304, 0x080c, 0x5c2f, 0x2079, 0x0240,
+	0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x5c8e, 0x0118, 0x2013,
+	0x0000, 0x0020, 0x705c, 0x9085, 0x0100, 0x2012, 0x20a9, 0x0040,
+	0x2009, 0x024e, 0x2011, 0x1c0e, 0x220e, 0x8210, 0x8108, 0x9186,
+	0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04,
+	0x5784, 0x60c3, 0x0084, 0x080c, 0x5b64, 0x00fe, 0x0005, 0x00f6,
+	0x708c, 0x9005, 0x01c0, 0x2011, 0x5b3a, 0x080c, 0x8038, 0x9086,
+	0x0084, 0x1178, 0x080c, 0x5cab, 0x2079, 0x0260, 0x7a30, 0x9296,
+	0x1106, 0x1138, 0x7834, 0x9005, 0x1120, 0x7097, 0x000c, 0x0029,
+	0x0010, 0x080c, 0x5c87, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x000d,
+	0x080c, 0x5c2f, 0x2079, 0x0240, 0x7833, 0x1107, 0x7837, 0x0000,
+	0x080c, 0x5cab, 0x20a9, 0x0040, 0x2011, 0x026e, 0x2009, 0x024e,
+	0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000,
+	0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260,
+	0x1f04, 0x57c8, 0x60c3, 0x0084, 0x080c, 0x5b64, 0x00fe, 0x0005,
+	0x00f6, 0x708c, 0x9005, 0x01e0, 0x2011, 0x5b3a, 0x080c, 0x8038,
+	0x9086, 0x0084, 0x1198, 0x080c, 0x5cab, 0x2079, 0x0260, 0x7a30,
+	0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7093, 0x0001,
+	0x080c, 0x5c01, 0x7097, 0x000e, 0x0029, 0x0010, 0x080c, 0x5c87,
+	0x00fe, 0x0005, 0x918d, 0x0001, 0x080c, 0x5cd6, 0x7097, 0x000f,
+	0x708f, 0x0000, 0x2061, 0x0140, 0x605b, 0xbc85, 0x605f, 0xb5b5,
+	0x2061, 0x0100, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009, 0x07d0,
+	0x2011, 0x5b3a, 0x080c, 0x802c, 0x0005, 0x708c, 0x9005, 0x0130,
+	0x2011, 0x5b3a, 0x080c, 0x8038, 0x7097, 0x0000, 0x0005, 0x7097,
+	0x0011, 0x080c, 0x9c3f, 0x080c, 0x5cab, 0x20e1, 0x0000, 0x2099,
+	0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x748c, 0x9480, 0x0018,
+	0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x4003, 0x080c,
+	0x5c8e, 0x11a0, 0x7178, 0x81ff, 0x0188, 0x900e, 0x707c, 0x9084,
+	0x00ff, 0x0160, 0x080c, 0x2663, 0x9186, 0x007e, 0x0138, 0x9186,
+	0x0080, 0x0120, 0x2011, 0x0008, 0x080c, 0x5ae7, 0x60c3, 0x0014,
+	0x080c, 0x5b64, 0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011,
+	0x5b3a, 0x080c, 0x8038, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5cab,
 	0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005,
 	0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3,
-	0x0001, 0x7097, 0x0006, 0x0029, 0x0010, 0x080c, 0x5c80, 0x00fe,
-	0x0005, 0x00f6, 0x7097, 0x0007, 0x080c, 0x5c28, 0x2079, 0x0240,
-	0x7833, 0x1104, 0x7837, 0x0000, 0x080c, 0x5ca4, 0x080c, 0x5c87,
-	0x11b8, 0x7080, 0x9005, 0x11a0, 0x7160, 0x9186, 0xffff, 0x0180,
-	0x9180, 0x3131, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008,
-	0x080c, 0x5ae0, 0x0180, 0x080c, 0x4c91, 0x0110, 0x080c, 0x26cc,
-	0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
-	0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b5d, 0x00fe,
-	0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b33, 0x080c,
-	0x8010, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ca4, 0x2079, 0x0260,
-	0x7a30, 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
-	0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097,
-	0x0008, 0x0029, 0x0010, 0x080c, 0x5c80, 0x00fe, 0x0005, 0x00f6,
-	0x7097, 0x0009, 0x080c, 0x5c28, 0x2079, 0x0240, 0x7833, 0x1105,
-	0x7837, 0x0100, 0x080c, 0x5c87, 0x1150, 0x7080, 0x9005, 0x1138,
-	0x080c, 0x5a53, 0x1188, 0x9085, 0x0001, 0x080c, 0x26cc, 0x20a9,
-	0x0008, 0x080c, 0x5ca4, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-	0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b5d,
-	0x0010, 0x080c, 0x55ad, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005,
-	0x05a8, 0x2011, 0x5b33, 0x080c, 0x8010, 0x9086, 0x0014, 0x1560,
-	0x080c, 0x5ca4, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1520,
-	0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1160, 0x7a38,
-	0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097,
-	0x000a, 0x00b1, 0x0098, 0x9005, 0x1178, 0x7a38, 0xd2fc, 0x0128,
-	0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7093, 0x0000, 0x7097,
-	0x000e, 0x080c, 0x57fb, 0x0010, 0x080c, 0x5c80, 0x00fe, 0x0005,
-	0x00f6, 0x7097, 0x000b, 0x2011, 0x1c0e, 0x20e9, 0x0001, 0x22a0,
-	0x20a9, 0x0040, 0x2019, 0xffff, 0x4304, 0x080c, 0x5c28, 0x2079,
-	0x0240, 0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x5c87, 0x0118,
-	0x2013, 0x0000, 0x0020, 0x705c, 0x9085, 0x0100, 0x2012, 0x20a9,
-	0x0040, 0x2009, 0x024e, 0x2011, 0x1c0e, 0x220e, 0x8210, 0x8108,
-	0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240,
-	0x1f04, 0x577d, 0x60c3, 0x0084, 0x080c, 0x5b5d, 0x00fe, 0x0005,
-	0x00f6, 0x708c, 0x9005, 0x01c0, 0x2011, 0x5b33, 0x080c, 0x8010,
-	0x9086, 0x0084, 0x1178, 0x080c, 0x5ca4, 0x2079, 0x0260, 0x7a30,
-	0x9296, 0x1106, 0x1138, 0x7834, 0x9005, 0x1120, 0x7097, 0x000c,
-	0x0029, 0x0010, 0x080c, 0x5c80, 0x00fe, 0x0005, 0x00f6, 0x7097,
-	0x000d, 0x080c, 0x5c28, 0x2079, 0x0240, 0x7833, 0x1107, 0x7837,
-	0x0000, 0x080c, 0x5ca4, 0x20a9, 0x0040, 0x2011, 0x026e, 0x2009,
-	0x024e, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810,
-	0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011,
-	0x0260, 0x1f04, 0x57c1, 0x60c3, 0x0084, 0x080c, 0x5b5d, 0x00fe,
-	0x0005, 0x00f6, 0x708c, 0x9005, 0x01e0, 0x2011, 0x5b33, 0x080c,
-	0x8010, 0x9086, 0x0084, 0x1198, 0x080c, 0x5ca4, 0x2079, 0x0260,
-	0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7093,
-	0x0001, 0x080c, 0x5bfa, 0x7097, 0x000e, 0x0029, 0x0010, 0x080c,
-	0x5c80, 0x00fe, 0x0005, 0x918d, 0x0001, 0x080c, 0x5ccf, 0x7097,
-	0x000f, 0x708f, 0x0000, 0x2061, 0x0140, 0x605b, 0xbc85, 0x605f,
-	0xb5b5, 0x2061, 0x0100, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009,
-	0x07d0, 0x2011, 0x5b33, 0x080c, 0x8004, 0x0005, 0x708c, 0x9005,
-	0x0130, 0x2011, 0x5b33, 0x080c, 0x8010, 0x7097, 0x0000, 0x0005,
-	0x7097, 0x0011, 0x080c, 0x9c26, 0x080c, 0x5ca4, 0x20e1, 0x0000,
-	0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x748c, 0x9480,
-	0x0018, 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x4003,
-	0x080c, 0x5c87, 0x11a0, 0x7178, 0x81ff, 0x0188, 0x900e, 0x707c,
-	0x9084, 0x00ff, 0x0160, 0x080c, 0x2663, 0x9186, 0x007e, 0x0138,
-	0x9186, 0x0080, 0x0120, 0x2011, 0x0008, 0x080c, 0x5ae0, 0x60c3,
-	0x0014, 0x080c, 0x5b5d, 0x0005, 0x00f6, 0x708c, 0x9005, 0x0500,
-	0x2011, 0x5b33, 0x080c, 0x8010, 0x9086, 0x0014, 0x11b8, 0x080c,
-	0x5ca4, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834,
-	0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110,
-	0x70c3, 0x0001, 0x7097, 0x0012, 0x0029, 0x0010, 0x708f, 0x0000,
-	0x00fe, 0x0005, 0x00f6, 0x7097, 0x0013, 0x080c, 0x5c36, 0x2079,
-	0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x5ca4, 0x080c,
-	0x5c87, 0x1170, 0x7080, 0x9005, 0x1158, 0x7158, 0x9186, 0xffff,
-	0x0138, 0x2011, 0x0008, 0x080c, 0x5ae0, 0x0168, 0x080c, 0x5c5d,
-	0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
-	0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b5d, 0x00fe,
-	0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b33, 0x080c,
-	0x8010, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5ca4, 0x2079, 0x0260,
-	0x7a30, 0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
-	0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097,
-	0x0014, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6,
-	0x7097, 0x0015, 0x080c, 0x5c36, 0x2079, 0x0240, 0x7833, 0x1104,
-	0x7837, 0x0000, 0x080c, 0x5ca4, 0x080c, 0x5c87, 0x11b8, 0x7080,
-	0x9005, 0x11a0, 0x7160, 0x9186, 0xffff, 0x0180, 0x9180, 0x3131,
-	0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5ae0,
-	0x0180, 0x080c, 0x4c91, 0x0110, 0x080c, 0x26cc, 0x20a9, 0x0008,
-	0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e,
-	0x4003, 0x60c3, 0x0014, 0x080c, 0x5b5d, 0x00fe, 0x0005, 0x00f6,
-	0x708c, 0x9005, 0x05f0, 0x2011, 0x5b33, 0x080c, 0x8010, 0x9086,
-	0x0014, 0x15a8, 0x080c, 0x5ca4, 0x2079, 0x0260, 0x7a30, 0x9296,
-	0x1105, 0x1568, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e,
-	0x1168, 0x9085, 0x0001, 0x080c, 0x5ccf, 0x7a38, 0xd2fc, 0x0128,
-	0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x0080, 0x9005, 0x11b8,
-	0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001,
-	0x9085, 0x0001, 0x080c, 0x5ccf, 0x7093, 0x0000, 0x7a38, 0xd2f4,
-	0x0110, 0x70db, 0x0008, 0x7097, 0x0016, 0x0029, 0x0010, 0x708f,
-	0x0000, 0x00fe, 0x0005, 0x080c, 0x9c26, 0x080c, 0x5ca4, 0x20e1,
-	0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9,
-	0x000e, 0x4003, 0x2011, 0x026d, 0x2204, 0x9084, 0x0100, 0x2011,
-	0x024d, 0x2012, 0x2011, 0x026e, 0x7097, 0x0017, 0x080c, 0x5c87,
-	0x1150, 0x7080, 0x9005, 0x1138, 0x080c, 0x5a53, 0x1188, 0x9085,
-	0x0001, 0x080c, 0x26cc, 0x20a9, 0x0008, 0x080c, 0x5ca4, 0x20e1,
+	0x0001, 0x7097, 0x0012, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe,
+	0x0005, 0x00f6, 0x7097, 0x0013, 0x080c, 0x5c3d, 0x2079, 0x0240,
+	0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x5cab, 0x080c, 0x5c8e,
+	0x1170, 0x7080, 0x9005, 0x1158, 0x7158, 0x9186, 0xffff, 0x0138,
+	0x2011, 0x0008, 0x080c, 0x5ae7, 0x0168, 0x080c, 0x5c64, 0x20a9,
+	0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
+	0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b64, 0x00fe, 0x0005,
+	0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b3a, 0x080c, 0x8038,
+	0x9086, 0x0014, 0x11b8, 0x080c, 0x5cab, 0x2079, 0x0260, 0x7a30,
+	0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
+	0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x0014,
+	0x0029, 0x0010, 0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x7097,
+	0x0015, 0x080c, 0x5c3d, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837,
+	0x0000, 0x080c, 0x5cab, 0x080c, 0x5c8e, 0x11b8, 0x7080, 0x9005,
+	0x11a0, 0x7160, 0x9186, 0xffff, 0x0180, 0x9180, 0x3138, 0x200d,
+	0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5ae7, 0x0180,
+	0x080c, 0x4c98, 0x0110, 0x080c, 0x26cc, 0x20a9, 0x0008, 0x20e1,
 	0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003,
-	0x60c3, 0x0014, 0x080c, 0x5b5d, 0x0010, 0x080c, 0x55ad, 0x0005,
-	0x00f6, 0x708c, 0x9005, 0x01d8, 0x2011, 0x5b33, 0x080c, 0x8010,
-	0x9086, 0x0084, 0x1190, 0x080c, 0x5ca4, 0x2079, 0x0260, 0x7a30,
-	0x9296, 0x1106, 0x1150, 0x7834, 0x9005, 0x1138, 0x9006, 0x080c,
-	0x5ccf, 0x7097, 0x0018, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe,
-	0x0005, 0x00f6, 0x7097, 0x0019, 0x080c, 0x5c36, 0x2079, 0x0240,
-	0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x5ca4, 0x2009, 0x026e,
-	0x2039, 0x1c0e, 0x20a9, 0x0040, 0x213e, 0x8738, 0x8108, 0x9186,
-	0x0280, 0x1128, 0x6814, 0x8000, 0x6816, 0x2009, 0x0260, 0x1f04,
-	0x59bc, 0x2039, 0x1c0e, 0x080c, 0x5c87, 0x11e8, 0x2728, 0x2514,
-	0x8207, 0x9084, 0x00ff, 0x8000, 0x2018, 0x9294, 0x00ff, 0x8007,
-	0x9205, 0x202a, 0x705c, 0x2310, 0x8214, 0x92a0, 0x1c0e, 0x2414,
-	0x938c, 0x0001, 0x0118, 0x9294, 0xff00, 0x0018, 0x9294, 0x00ff,
-	0x8007, 0x9215, 0x2222, 0x20a9, 0x0040, 0x2009, 0x024e, 0x270e,
-	0x8738, 0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812,
-	0x2009, 0x0240, 0x1f04, 0x59ef, 0x60c3, 0x0084, 0x080c, 0x5b5d,
-	0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005, 0x01e0, 0x2011, 0x5b33,
-	0x080c, 0x8010, 0x9086, 0x0084, 0x1198, 0x080c, 0x5ca4, 0x2079,
-	0x0260, 0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140,
-	0x7093, 0x0001, 0x080c, 0x5bfa, 0x7097, 0x001a, 0x0029, 0x0010,
-	0x708f, 0x0000, 0x00fe, 0x0005, 0x9085, 0x0001, 0x080c, 0x5ccf,
-	0x7097, 0x001b, 0x080c, 0x9c26, 0x080c, 0x5ca4, 0x2011, 0x0260,
-	0x2009, 0x0240, 0x748c, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084,
-	0x03f8, 0x8004, 0x20a8, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260,
-	0x1150, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000,
-	0x6816, 0x2011, 0x0260, 0x1f04, 0x5a3b, 0x60c3, 0x0084, 0x080c,
-	0x5b5d, 0x0005, 0x0005, 0x0086, 0x0096, 0x2029, 0x1854, 0x252c,
-	0x20a9, 0x0008, 0x2041, 0x1c0e, 0x20e9, 0x0001, 0x28a0, 0x080c,
-	0x5ca4, 0x20e1, 0x0000, 0x2099, 0x026e, 0x4003, 0x20a9, 0x0008,
-	0x2011, 0x0007, 0xd5d4, 0x0108, 0x9016, 0x2800, 0x9200, 0x200c,
-	0x91a6, 0xffff, 0x1148, 0xd5d4, 0x0110, 0x8210, 0x0008, 0x8211,
-	0x1f04, 0x5a6d, 0x0804, 0x5adc, 0x82ff, 0x1160, 0xd5d4, 0x0120,
-	0x91a6, 0x3fff, 0x0d90, 0x0020, 0x91a6, 0x3fff, 0x0904, 0x5adc,
-	0x918d, 0xc000, 0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4, 0x0110,
-	0x2019, 0x0010, 0x2120, 0xd5d4, 0x0110, 0x8423, 0x0008, 0x8424,
-	0x1240, 0xd5d4, 0x0110, 0x8319, 0x0008, 0x8318, 0x1f04, 0x5a93,
-	0x04d8, 0x23a8, 0x2021, 0x0001, 0x8426, 0x8425, 0x1f04, 0x5aa5,
-	0x2328, 0x8529, 0x92be, 0x0007, 0x0158, 0x0006, 0x2039, 0x0007,
-	0x2200, 0x973a, 0x000e, 0x27a8, 0x95a8, 0x0010, 0x1f04, 0x5ab4,
-	0x755a, 0x95c8, 0x3131, 0x292d, 0x95ac, 0x00ff, 0x757e, 0x6532,
-	0x6536, 0x0016, 0x2508, 0x080c, 0x26ac, 0x001e, 0x60e7, 0x0000,
-	0x65ea, 0x2018, 0x2304, 0x9405, 0x201a, 0x7083, 0x0001, 0x20e9,
-	0x0000, 0x20a1, 0x024e, 0x20e1, 0x0001, 0x2898, 0x20a9, 0x0008,
-	0x4003, 0x9085, 0x0001, 0x0008, 0x9006, 0x009e, 0x008e, 0x0005,
-	0x0156, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x22a8, 0x20e1, 0x0000,
-	0x2099, 0x026e, 0x20e9, 0x0000, 0x2011, 0x024e, 0x22a0, 0x4003,
-	0x014e, 0x013e, 0x01de, 0x01ce, 0x015e, 0x2118, 0x9026, 0x2001,
-	0x0007, 0x939a, 0x0010, 0x0218, 0x8420, 0x8001, 0x0cd0, 0x2118,
-	0x84ff, 0x0120, 0x939a, 0x0010, 0x8421, 0x1de0, 0x2021, 0x0001,
-	0x83ff, 0x0118, 0x8423, 0x8319, 0x1de8, 0x9238, 0x2029, 0x026e,
-	0x9528, 0x2504, 0x942c, 0x11b8, 0x9405, 0x203a, 0x715a, 0x91a0,
-	0x3131, 0x242d, 0x95ac, 0x00ff, 0x757e, 0x6532, 0x6536, 0x0016,
-	0x2508, 0x080c, 0x26ac, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7083,
-	0x0001, 0x9084, 0x0000, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7087,
-	0x0000, 0x00ee, 0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071,
-	0x0140, 0x080c, 0x5be9, 0x080c, 0x9393, 0x7004, 0x9084, 0x4000,
-	0x0110, 0x080c, 0x2b24, 0x0126, 0x2091, 0x8000, 0x2071, 0x1825,
-	0x2073, 0x0000, 0x7840, 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c,
-	0x5c46, 0x001e, 0x9094, 0x0010, 0x9285, 0x0080, 0x7842, 0x7a42,
-	0x002e, 0x012e, 0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x29ca, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012,
-	0x2011, 0x19c2, 0x2013, 0x0000, 0x708f, 0x0000, 0x012e, 0x60a3,
-	0x0056, 0x60a7, 0x9575, 0x080c, 0x938a, 0x6144, 0xd184, 0x0120,
-	0x7194, 0x918d, 0x2000, 0x0018, 0x7188, 0x918d, 0x1000, 0x2011,
-	0x196a, 0x2112, 0x2009, 0x07d0, 0x2011, 0x5b33, 0x080c, 0x80a2,
-	0x0005, 0x0016, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x9d9f, 0x2009, 0x00f7, 0x080c, 0x5c46, 0x2061, 0x19cb, 0x900e,
-	0x611a, 0x611e, 0x6172, 0x6176, 0x2061, 0x1800, 0x6003, 0x0001,
-	0x2061, 0x0100, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009, 0x196a,
-	0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5bb5, 0x080c, 0x8004,
-	0x012e, 0x00ce, 0x002e, 0x001e, 0x0005, 0x00e6, 0x0006, 0x0126,
-	0x2091, 0x8000, 0x0471, 0x2071, 0x0100, 0x080c, 0x9393, 0x2071,
-	0x0140, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2b24, 0x080c,
-	0x6faf, 0x0188, 0x080c, 0x6fca, 0x1170, 0x080c, 0x7295, 0x0016,
-	0x080c, 0x277b, 0x2001, 0x193e, 0x2102, 0x001e, 0x080c, 0x7290,
-	0x080c, 0x6ed9, 0x0050, 0x2009, 0x0001, 0x080c, 0x2a63, 0x2001,
-	0x0001, 0x080c, 0x260c, 0x080c, 0x5b89, 0x012e, 0x000e, 0x00ee,
-	0x0005, 0x2001, 0x180e, 0x2004, 0xd0bc, 0x0158, 0x0026, 0x0036,
-	0x2011, 0x8017, 0x2001, 0x196a, 0x201c, 0x080c, 0x48d2, 0x003e,
-	0x002e, 0x0005, 0x20a9, 0x0012, 0x20e9, 0x0001, 0x20a1, 0x1c80,
-	0x080c, 0x5ca4, 0x20e9, 0x0000, 0x2099, 0x026e, 0x0099, 0x20a9,
-	0x0020, 0x080c, 0x5c9e, 0x2099, 0x0260, 0x20a1, 0x1c92, 0x0051,
-	0x20a9, 0x000e, 0x080c, 0x5ca1, 0x2099, 0x0260, 0x20a1, 0x1cb2,
-	0x0009, 0x0005, 0x0016, 0x0026, 0x3410, 0x3308, 0x2104, 0x8007,
-	0x2012, 0x8108, 0x8210, 0x1f04, 0x5c1e, 0x002e, 0x001e, 0x0005,
-	0x080c, 0x9c26, 0x20e1, 0x0001, 0x2099, 0x1c00, 0x20e9, 0x0000,
-	0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x080c, 0x9c26,
-	0x080c, 0x5ca4, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000,
-	0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x00c6, 0x0006,
-	0x2061, 0x0100, 0x810f, 0x2001, 0x1833, 0x2004, 0x9005, 0x1138,
-	0x2001, 0x1817, 0x2004, 0x9084, 0x00ff, 0x9105, 0x0010, 0x9185,
-	0x00f7, 0x604a, 0x000e, 0x00ce, 0x0005, 0x0016, 0x0046, 0x080c,
-	0x6557, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xd50a,
-	0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x900e,
-	0x080c, 0x2fa2, 0x080c, 0xc1f9, 0x0140, 0x0036, 0x2019, 0xffff,
-	0x2021, 0x0007, 0x080c, 0x4a6f, 0x003e, 0x004e, 0x001e, 0x0005,
-	0x080c, 0x5b89, 0x7097, 0x0000, 0x708f, 0x0000, 0x0005, 0x0006,
-	0x2001, 0x180c, 0x2004, 0xd09c, 0x0100, 0x000e, 0x0005, 0x0006,
-	0x0016, 0x0126, 0x2091, 0x8000, 0x2001, 0x0101, 0x200c, 0x918d,
-	0x0006, 0x2102, 0x012e, 0x001e, 0x000e, 0x0005, 0x2009, 0x0001,
-	0x0020, 0x2009, 0x0002, 0x0008, 0x900e, 0x6814, 0x9084, 0xffc0,
-	0x910d, 0x6916, 0x0005, 0x00f6, 0x0156, 0x0146, 0x01d6, 0x9006,
-	0x20a9, 0x0080, 0x20e9, 0x0001, 0x20a1, 0x1c00, 0x4004, 0x2079,
-	0x1c00, 0x7803, 0x2200, 0x7807, 0x00ef, 0x780f, 0x00ef, 0x7813,
-	0x0138, 0x7823, 0xffff, 0x7827, 0xffff, 0x01de, 0x014e, 0x015e,
-	0x00fe, 0x0005, 0x2001, 0x1800, 0x2003, 0x0001, 0x0005, 0x2001,
-	0x1977, 0x0118, 0x2003, 0x0001, 0x0010, 0x2003, 0x0000, 0x0005,
-	0x0156, 0x20a9, 0x0800, 0x2009, 0x1000, 0x9006, 0x200a, 0x8108,
-	0x1f04, 0x5cde, 0x015e, 0x0005, 0x00d6, 0x0036, 0x0156, 0x0136,
-	0x0146, 0x2069, 0x1853, 0x9006, 0xb802, 0xb8be, 0xb807, 0x0707,
-	0xb80a, 0xb80e, 0xb812, 0x9198, 0x3131, 0x231d, 0x939c, 0x00ff,
-	0xbb16, 0x0016, 0x0026, 0xb8b2, 0x080c, 0x9d98, 0x1120, 0x9192,
-	0x007e, 0x1208, 0xbbb2, 0x20a9, 0x0004, 0xb8b4, 0x20e8, 0xb9b8,
-	0x9198, 0x0006, 0x9006, 0x23a0, 0x4004, 0x20a9, 0x0004, 0x9198,
-	0x000a, 0x23a0, 0x4004, 0x002e, 0x001e, 0xb83e, 0xb842, 0xb84e,
-	0xb852, 0xb856, 0xb85a, 0xb85e, 0xb862, 0xb866, 0xb86a, 0xb86f,
-	0x0100, 0xb872, 0xb876, 0xb87a, 0xb88a, 0xb88e, 0xb893, 0x0008,
-	0xb896, 0xb89a, 0xb89e, 0xb8ae, 0xb9a2, 0x0096, 0xb8a4, 0x904d,
-	0x0110, 0x080c, 0x101d, 0xb8a7, 0x0000, 0x009e, 0x9006, 0xb84a,
-	0x6810, 0xb83a, 0x680c, 0xb846, 0x6814, 0x9084, 0x00ff, 0xb842,
-	0x014e, 0x013e, 0x015e, 0x003e, 0x00de, 0x0005, 0x0126, 0x2091,
-	0x8000, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04,
-	0x5db4, 0x9182, 0x0800, 0x1a04, 0x5db8, 0x2001, 0x180c, 0x2004,
-	0x9084, 0x0003, 0x1904, 0x5dbe, 0x9188, 0x1000, 0x2104, 0x905d,
-	0x0518, 0xb804, 0x9084, 0x00ff, 0x908e, 0x0006, 0x1508, 0xb8a4,
-	0x900d, 0x1904, 0x5dd0, 0xb850, 0x900d, 0x1148, 0xa802, 0x2900,
-	0xb852, 0xb84e, 0x080c, 0x83e6, 0x9006, 0x012e, 0x0005, 0x00a6,
-	0x2150, 0x2900, 0xb002, 0xa803, 0x0000, 0x00ae, 0xb852, 0x0c90,
-	0x2001, 0x0005, 0x900e, 0x04b8, 0x2001, 0x0028, 0x900e, 0x0498,
-	0x9082, 0x0006, 0x1290, 0x080c, 0x9d98, 0x1160, 0xb8a0, 0x9084,
-	0xff80, 0x1140, 0xb900, 0xd1fc, 0x0990, 0x2001, 0x0029, 0x2009,
-	0x1000, 0x0408, 0x2001, 0x0028, 0x00a8, 0x2009, 0x180c, 0x210c,
-	0xd18c, 0x0118, 0x2001, 0x0004, 0x0068, 0xd184, 0x0118, 0x2001,
-	0x0004, 0x0040, 0x2001, 0x0029, 0xb900, 0xd1fc, 0x0118, 0x2009,
-	0x1000, 0x0048, 0x900e, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018,
-	0x2001, 0x0029, 0x900e, 0x9005, 0x012e, 0x0005, 0x2001, 0x180c,
-	0x2004, 0xd084, 0x19d0, 0x9188, 0x1000, 0x2104, 0x905d, 0x09a8,
-	0x080c, 0x655b, 0x1990, 0xb800, 0xd0bc, 0x0978, 0x0804, 0x5d67,
-	0x080c, 0x63d3, 0x0904, 0x5d80, 0x0804, 0x5d6b, 0x00b6, 0x00e6,
-	0x0126, 0x2091, 0x8000, 0xa974, 0x9182, 0x0800, 0x1a04, 0x5e51,
-	0x9188, 0x1000, 0x2104, 0x905d, 0x0904, 0x5e29, 0xb8a0, 0x9086,
-	0x007f, 0x0178, 0x080c, 0x6563, 0x0160, 0xa994, 0x81ff, 0x0130,
-	0x908e, 0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x080c, 0x655b,
-	0x1598, 0xa87c, 0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060,
-	0x0026, 0x2010, 0x080c, 0xbaec, 0x002e, 0x1120, 0x2001, 0x0008,
-	0x0804, 0x5e53, 0x6020, 0x9086, 0x000a, 0x0120, 0x2001, 0x0008,
-	0x0804, 0x5e53, 0x601a, 0x6003, 0x0008, 0x2900, 0x6016, 0x0058,
-	0x080c, 0x9dc3, 0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b,
-	0xffff, 0x6023, 0x000a, 0x2009, 0x0003, 0x080c, 0x9e93, 0x9006,
-	0x0458, 0x2001, 0x0028, 0x0438, 0x9082, 0x0006, 0x1290, 0x080c,
-	0x9d98, 0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc,
-	0x0900, 0x2001, 0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028,
-	0x0090, 0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004,
-	0x0050, 0xd184, 0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029,
-	0x0010, 0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005,
-	0x2001, 0x002c, 0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000,
-	0xa8e0, 0x9005, 0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8,
-	0x9005, 0x1518, 0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079,
-	0x1800, 0x9182, 0x0800, 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130,
-	0xaa98, 0xab94, 0xa878, 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c,
-	0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004,
-	0x0010, 0x2001, 0x0029, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e,
-	0x0018, 0x2001, 0x0029, 0x900e, 0x9006, 0x0008, 0x9005, 0x012e,
-	0x00be, 0x00fe, 0x0005, 0x5ee8, 0x5ea3, 0x5eba, 0x5ee8, 0x5ee8,
-	0x5ee8, 0x5ee8, 0x5ee8, 0x2100, 0x9082, 0x007e, 0x1278, 0x080c,
-	0x61d7, 0x0148, 0x9046, 0xb810, 0x9306, 0x1904, 0x5ef0, 0xb814,
-	0x9206, 0x15f0, 0x0028, 0xbb12, 0xba16, 0x0010, 0x080c, 0x478c,
-	0x0150, 0x04b0, 0x080c, 0x6237, 0x1598, 0xb810, 0x9306, 0x1580,
-	0xb814, 0x9206, 0x1568, 0x080c, 0x9dc3, 0x0530, 0x2b00, 0x6012,
-	0x080c, 0xbf73, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a,
-	0xa878, 0x9086, 0x0001, 0x1170, 0x080c, 0x2fd7, 0x9006, 0x080c,
-	0x6174, 0x2001, 0x0002, 0x080c, 0x6188, 0x2001, 0x0200, 0xb86e,
-	0xb893, 0x0002, 0x2009, 0x0003, 0x080c, 0x9e93, 0x9006, 0x0068,
-	0x2001, 0x0001, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018,
-	0x2001, 0x0028, 0x900e, 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe,
-	0x0005, 0x00b6, 0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894,
-	0x90c6, 0x0015, 0x0904, 0x60c5, 0x90c6, 0x0056, 0x0904, 0x60c9,
-	0x90c6, 0x0066, 0x0904, 0x60cd, 0x90c6, 0x0067, 0x0904, 0x60d1,
-	0x90c6, 0x0068, 0x0904, 0x60d5, 0x90c6, 0x0071, 0x0904, 0x60d9,
-	0x90c6, 0x0074, 0x0904, 0x60dd, 0x90c6, 0x007c, 0x0904, 0x60e1,
-	0x90c6, 0x007e, 0x0904, 0x60e5, 0x90c6, 0x0037, 0x0904, 0x60e9,
-	0x9016, 0x2079, 0x1800, 0xa974, 0x9186, 0x00ff, 0x0904, 0x60c0,
-	0x9182, 0x0800, 0x1a04, 0x60c0, 0x080c, 0x6237, 0x1198, 0xb804,
-	0x9084, 0x00ff, 0x9082, 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f,
-	0x0148, 0x080c, 0x9d98, 0x1904, 0x60a9, 0xb8a0, 0x9084, 0xff80,
-	0x1904, 0x60a9, 0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e,
-	0x0904, 0x6009, 0x90c6, 0x0064, 0x0904, 0x6032, 0x2008, 0x0804,
-	0x5fcc, 0xa998, 0xa8b0, 0x2040, 0x080c, 0x9d98, 0x1120, 0x9182,
-	0x007f, 0x0a04, 0x5fcc, 0x9186, 0x00ff, 0x0904, 0x5fcc, 0x9182,
-	0x0800, 0x1a04, 0x5fcc, 0xaaa0, 0xab9c, 0x7878, 0x9306, 0x1188,
-	0x787c, 0x0096, 0x924e, 0x1128, 0x2208, 0x2310, 0x009e, 0x0804,
-	0x5fcc, 0x99cc, 0xff00, 0x009e, 0x1120, 0x2208, 0x2310, 0x0804,
-	0x5fcc, 0x080c, 0x478c, 0x0904, 0x5fd5, 0x900e, 0x9016, 0x90c6,
-	0x4000, 0x1558, 0x0006, 0x080c, 0x6457, 0x1108, 0xc185, 0xb800,
-	0xd0bc, 0x0108, 0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c,
-	0x9080, 0x0031, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006,
-	0x2098, 0x080c, 0x0f68, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c,
-	0x9080, 0x0035, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x000a,
-	0x2098, 0x080c, 0x0f68, 0x000e, 0x00c8, 0x90c6, 0x4007, 0x1110,
-	0x2408, 0x00a0, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0070,
-	0x90c6, 0x4009, 0x1108, 0x0050, 0x90c6, 0x4006, 0x0138, 0x2001,
-	0x4005, 0x2009, 0x000a, 0x0010, 0x2001, 0x4006, 0xa896, 0xa99a,
-	0xaa9e, 0x2001, 0x0030, 0x900e, 0x0470, 0x080c, 0x9dc3, 0x1130,
-	0x2001, 0x4005, 0x2009, 0x0003, 0x9016, 0x0c80, 0x2b00, 0x6012,
-	0x080c, 0xbf73, 0x2900, 0x6016, 0x6023, 0x0001, 0xa868, 0xd88c,
-	0x0108, 0xc0f5, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x2fd7,
-	0x012e, 0x9006, 0x080c, 0x6174, 0x2001, 0x0002, 0x080c, 0x6188,
-	0x2009, 0x0002, 0x080c, 0x9e93, 0xa8b0, 0xd094, 0x0118, 0xb8bc,
-	0xc08d, 0xb8be, 0x9006, 0x9005, 0x012e, 0x00ee, 0x00fe, 0x00be,
-	0x0005, 0x080c, 0x5393, 0x0118, 0x2009, 0x0007, 0x00f8, 0xa998,
-	0xaeb0, 0x080c, 0x6237, 0x1904, 0x5fc7, 0x9186, 0x007f, 0x0130,
-	0x080c, 0x655b, 0x0118, 0x2009, 0x0009, 0x0080, 0x0096, 0x080c,
-	0x0feb, 0x1120, 0x009e, 0x2009, 0x0002, 0x0040, 0x2900, 0x009e,
-	0xa806, 0x080c, 0xbce4, 0x19b0, 0x2009, 0x0003, 0x2001, 0x4005,
-	0x0804, 0x5fce, 0xa998, 0xaeb0, 0x080c, 0x6237, 0x1904, 0x5fc7,
-	0x0096, 0x080c, 0x0feb, 0x1128, 0x009e, 0x2009, 0x0002, 0x0804,
-	0x6086, 0x2900, 0x009e, 0xa806, 0x0096, 0x2048, 0x20a9, 0x002b,
-	0xb8b4, 0x20e0, 0xb8b8, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080,
-	0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0,
-	0xbbb8, 0x9398, 0x0006, 0x2398, 0x080c, 0x0f68, 0x009e, 0xa87b,
-	0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xd684, 0x1168, 0x080c,
-	0x537f, 0xd0b4, 0x1118, 0xa89b, 0x000b, 0x00e0, 0xb800, 0xd08c,
-	0x0118, 0xa89b, 0x000c, 0x00b0, 0x080c, 0x655b, 0x0118, 0xa89b,
-	0x0009, 0x0080, 0x080c, 0x5393, 0x0118, 0xa89b, 0x0007, 0x0050,
-	0x080c, 0xbcc7, 0x1904, 0x6002, 0x2009, 0x0003, 0x2001, 0x4005,
-	0x0804, 0x5fce, 0xa87b, 0x0030, 0xa897, 0x4005, 0xa804, 0x8006,
-	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
-	0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000,
-	0x2041, 0x122f, 0x080c, 0xa31b, 0x1904, 0x6002, 0x2009, 0x0002,
-	0x08e8, 0x2001, 0x0028, 0x900e, 0x0804, 0x6003, 0x2009, 0x180c,
-	0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118,
-	0x2001, 0x0004, 0x0010, 0x2001, 0x0029, 0x900e, 0x0804, 0x6003,
-	0x2001, 0x0029, 0x900e, 0x0804, 0x6003, 0x080c, 0x3555, 0x0804,
-	0x6004, 0x080c, 0x50bc, 0x0804, 0x6004, 0x080c, 0x4325, 0x0804,
-	0x6004, 0x080c, 0x439e, 0x0804, 0x6004, 0x080c, 0x43fa, 0x0804,
-	0x6004, 0x080c, 0x4848, 0x0804, 0x6004, 0x080c, 0x4af4, 0x0804,
-	0x6004, 0x080c, 0x4d27, 0x0804, 0x6004, 0x080c, 0x4f20, 0x0804,
-	0x6004, 0x080c, 0x3765, 0x0804, 0x6004, 0x00b6, 0xa974, 0xae78,
-	0x9684, 0x3fff, 0x9082, 0x4000, 0x1618, 0x9182, 0x0800, 0x1268,
-	0x9188, 0x1000, 0x2104, 0x905d, 0x0140, 0x080c, 0x655b, 0x1148,
-	0x00e9, 0x080c, 0x6362, 0x9006, 0x00b0, 0x2001, 0x0028, 0x900e,
-	0x0090, 0x9082, 0x0006, 0x1240, 0xb900, 0xd1fc, 0x0d88, 0x2001,
-	0x0029, 0x2009, 0x1000, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018,
-	0x2001, 0x0029, 0x900e, 0x9005, 0x00be, 0x0005, 0x0126, 0x2091,
-	0x8000, 0xb850, 0x900d, 0x0150, 0x2900, 0x0096, 0x2148, 0xa802,
-	0x009e, 0xa803, 0x0000, 0xb852, 0x012e, 0x0005, 0x2900, 0xb852,
-	0xb84e, 0xa803, 0x0000, 0x0cc0, 0x0126, 0x2091, 0x8000, 0xb84c,
-	0x9005, 0x0170, 0x00e6, 0x2071, 0x19b8, 0x7004, 0x9086, 0x0002,
-	0x0168, 0x00ee, 0xb84c, 0xa802, 0x2900, 0xb84e, 0x012e, 0x0005,
-	0x2900, 0xb852, 0xb84e, 0xa803, 0x0000, 0x0cc0, 0x701c, 0x9b06,
-	0x1d80, 0xb84c, 0x00a6, 0x2050, 0xb000, 0xa802, 0x2900, 0xb002,
-	0x00ae, 0x00ee, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0xb84c,
-	0x904d, 0x0130, 0xa800, 0x9005, 0x1108, 0xb852, 0xb84e, 0x9905,
-	0x012e, 0x0005, 0xb84c, 0x904d, 0x0130, 0xa800, 0x9005, 0x1108,
-	0xb852, 0xb84e, 0x9905, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x0026,
-	0x2091, 0x8000, 0x6210, 0x2258, 0xba00, 0x9005, 0x0110, 0xc285,
-	0x0008, 0xc284, 0xba02, 0x002e, 0x00ce, 0x012e, 0x00be, 0x0005,
-	0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04,
-	0x0006, 0x9086, 0x0006, 0x1170, 0xb89c, 0xd0ac, 0x0158, 0x080c,
-	0x6557, 0x0140, 0x9284, 0xff00, 0x8007, 0x9086, 0x0007, 0x1110,
-	0x2011, 0x0600, 0x000e, 0x9294, 0xff00, 0x9215, 0xba06, 0x0006,
-	0x9086, 0x0006, 0x1120, 0xba90, 0x82ff, 0x090c, 0x0db4, 0x000e,
-	0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091,
-	0x8000, 0x6210, 0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1168,
-	0xb89c, 0xd0a4, 0x0150, 0x080c, 0x6553, 0x1138, 0x9284, 0x00ff,
-	0x9086, 0x0007, 0x1110, 0x2011, 0x0006, 0x000e, 0x9294, 0x00ff,
-	0x8007, 0x9215, 0xba06, 0x00ce, 0x012e, 0x00be, 0x0005, 0x9182,
-	0x0800, 0x0218, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0026, 0x9190,
-	0x1000, 0x2204, 0x905d, 0x1180, 0x0096, 0x080c, 0x0feb, 0x2958,
-	0x009e, 0x0160, 0x2b00, 0x2012, 0xb85c, 0xb8ba, 0xb860, 0xb8b6,
-	0x9006, 0xb8a6, 0x080c, 0x5ce4, 0x9006, 0x0010, 0x9085, 0x0001,
-	0x002e, 0x00de, 0x0005, 0x00b6, 0x0096, 0x0126, 0x2091, 0x8000,
-	0x0026, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0458, 0x00d6,
-	0x9190, 0x1000, 0x2204, 0x905d, 0x0518, 0x2013, 0x0000, 0xb8a4,
-	0x904d, 0x0110, 0x080c, 0x101d, 0x00d6, 0x00c6, 0xb8ac, 0x2060,
-	0x8cff, 0x0168, 0x600c, 0x0006, 0x6014, 0x2048, 0x080c, 0xbafe,
-	0x0110, 0x080c, 0x0f9d, 0x080c, 0x9e19, 0x00ce, 0x0c88, 0x00ce,
-	0x00de, 0x2b48, 0xb8b8, 0xb85e, 0xb8b4, 0xb862, 0x080c, 0x102d,
-	0x00de, 0x9006, 0x002e, 0x012e, 0x009e, 0x00be, 0x0005, 0x0016,
-	0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0030, 0x9188, 0x1000,
-	0x2104, 0x905d, 0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156,
-	0x0136, 0x0146, 0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802,
-	0x080c, 0x6fa7, 0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c,
-	0x9d98, 0x11d8, 0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061,
-	0x1953, 0x7048, 0x2062, 0x704c, 0x6006, 0x7050, 0x600a, 0x7054,
-	0x600e, 0x00ce, 0x703c, 0x2069, 0x0140, 0x9005, 0x1110, 0x2001,
-	0x0001, 0x6886, 0x2069, 0x1800, 0x68b2, 0x7040, 0xb85e, 0x7048,
-	0xb862, 0x704c, 0xb866, 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8b4,
-	0x20e8, 0xb8b8, 0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003,
-	0x2099, 0x027a, 0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003,
-	0x2069, 0x0200, 0x6817, 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e,
-	0x7048, 0xb872, 0x7050, 0xb876, 0x2069, 0x0200, 0x6817, 0x0000,
-	0xb8a0, 0x9086, 0x007e, 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211,
-	0x1218, 0x2009, 0x0008, 0x0400, 0x9182, 0x0259, 0x1218, 0x2009,
-	0x0007, 0x00d0, 0x9182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0,
-	0x9182, 0x0349, 0x1218, 0x2009, 0x0005, 0x0070, 0x9182, 0x0421,
-	0x1218, 0x2009, 0x0004, 0x0040, 0x9182, 0x0581, 0x1218, 0x2009,
-	0x0003, 0x0010, 0x2009, 0x0002, 0xb992, 0x014e, 0x013e, 0x015e,
-	0x00de, 0x0005, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034,
-	0xb896, 0x703c, 0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbbc, 0xc384,
-	0xba00, 0x2009, 0x1873, 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110,
-	0xc2ad, 0x0008, 0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd,
-	0xd0cc, 0x0128, 0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02,
-	0xbbbe, 0x003e, 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096, 0x0126,
-	0x2091, 0x8000, 0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0,
-	0xaa04, 0x9282, 0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6,
-	0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0,
-	0x9080, 0x0004, 0x2098, 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002,
-	0x9086, 0xffff, 0x0120, 0x8109, 0x1dd0, 0x080c, 0x0db4, 0x3c00,
-	0x20e8, 0x3300, 0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de,
-	0x01ce, 0x014e, 0x013e, 0x0060, 0x080c, 0x0feb, 0x0170, 0x2900,
-	0xb8a6, 0xa803, 0x0000, 0x080c, 0x63f3, 0xa807, 0x0001, 0xae12,
-	0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126,
-	0x2091, 0x8000, 0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005,
-	0x1150, 0x080c, 0x6402, 0x1158, 0xa804, 0x908a, 0x0002, 0x0218,
-	0x8001, 0xa806, 0x0020, 0x080c, 0x101d, 0xb8a7, 0x0000, 0x009e,
-	0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x83e6, 0x012e,
-	0x0005, 0x901e, 0x0010, 0x2019, 0x0001, 0x900e, 0x0126, 0x2091,
-	0x8000, 0xb84c, 0x2048, 0xb800, 0xd0dc, 0x1170, 0x89ff, 0x0500,
-	0x83ff, 0x0120, 0xa878, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406,
-	0x1118, 0xa870, 0x9506, 0x0120, 0x2908, 0xa800, 0x2048, 0x0c70,
-	0x080c, 0x9797, 0xaa00, 0xb84c, 0x9906, 0x1110, 0xba4e, 0x0020,
-	0x00a6, 0x2150, 0xb202, 0x00ae, 0x82ff, 0x1110, 0xb952, 0x89ff,
-	0x012e, 0x0005, 0x9016, 0x0489, 0x1110, 0x2011, 0x0001, 0x0005,
-	0x080c, 0x6457, 0x0128, 0x080c, 0xbbbb, 0x0010, 0x9085, 0x0001,
-	0x0005, 0x080c, 0x6457, 0x0128, 0x080c, 0xbb60, 0x0010, 0x9085,
-	0x0001, 0x0005, 0x080c, 0x6457, 0x0128, 0x080c, 0xbbb8, 0x0010,
-	0x9085, 0x0001, 0x0005, 0x080c, 0x6457, 0x0128, 0x080c, 0xbb7f,
-	0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x6457, 0x0128, 0x080c,
-	0xbbfc, 0x0010, 0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118,
-	0x9085, 0x0001, 0x0005, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8,
-	0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0,
-	0x9080, 0x0004, 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002,
-	0x9606, 0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0008, 0x9006,
-	0x01ce, 0x013e, 0x0005, 0x0146, 0x01d6, 0xa860, 0x20e8, 0xa85c,
-	0x9080, 0x0004, 0x20a0, 0x20a9, 0x0010, 0x2009, 0xffff, 0x4104,
-	0x01de, 0x014e, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e,
+	0x60c3, 0x0014, 0x080c, 0x5b64, 0x00fe, 0x0005, 0x00f6, 0x708c,
+	0x9005, 0x05f0, 0x2011, 0x5b3a, 0x080c, 0x8038, 0x9086, 0x0014,
+	0x15a8, 0x080c, 0x5cab, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105,
+	0x1568, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1168,
+	0x9085, 0x0001, 0x080c, 0x5cd6, 0x7a38, 0xd2fc, 0x0128, 0x70c0,
+	0x9005, 0x1110, 0x70c3, 0x0001, 0x0080, 0x9005, 0x11b8, 0x7a38,
+	0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x9085,
+	0x0001, 0x080c, 0x5cd6, 0x7093, 0x0000, 0x7a38, 0xd2f4, 0x0110,
+	0x70db, 0x0008, 0x7097, 0x0016, 0x0029, 0x0010, 0x708f, 0x0000,
+	0x00fe, 0x0005, 0x080c, 0x9c3f, 0x080c, 0x5cab, 0x20e1, 0x0000,
+	0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000e,
+	0x4003, 0x2011, 0x026d, 0x2204, 0x9084, 0x0100, 0x2011, 0x024d,
+	0x2012, 0x2011, 0x026e, 0x7097, 0x0017, 0x080c, 0x5c8e, 0x1150,
+	0x7080, 0x9005, 0x1138, 0x080c, 0x5a5a, 0x1188, 0x9085, 0x0001,
+	0x080c, 0x26cc, 0x20a9, 0x0008, 0x080c, 0x5cab, 0x20e1, 0x0000,
+	0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3,
+	0x0014, 0x080c, 0x5b64, 0x0010, 0x080c, 0x55b4, 0x0005, 0x00f6,
+	0x708c, 0x9005, 0x01d8, 0x2011, 0x5b3a, 0x080c, 0x8038, 0x9086,
+	0x0084, 0x1190, 0x080c, 0x5cab, 0x2079, 0x0260, 0x7a30, 0x9296,
+	0x1106, 0x1150, 0x7834, 0x9005, 0x1138, 0x9006, 0x080c, 0x5cd6,
+	0x7097, 0x0018, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe, 0x0005,
+	0x00f6, 0x7097, 0x0019, 0x080c, 0x5c3d, 0x2079, 0x0240, 0x7833,
+	0x1106, 0x7837, 0x0000, 0x080c, 0x5cab, 0x2009, 0x026e, 0x2039,
+	0x1c0e, 0x20a9, 0x0040, 0x213e, 0x8738, 0x8108, 0x9186, 0x0280,
+	0x1128, 0x6814, 0x8000, 0x6816, 0x2009, 0x0260, 0x1f04, 0x59c3,
+	0x2039, 0x1c0e, 0x080c, 0x5c8e, 0x11e8, 0x2728, 0x2514, 0x8207,
+	0x9084, 0x00ff, 0x8000, 0x2018, 0x9294, 0x00ff, 0x8007, 0x9205,
+	0x202a, 0x705c, 0x2310, 0x8214, 0x92a0, 0x1c0e, 0x2414, 0x938c,
+	0x0001, 0x0118, 0x9294, 0xff00, 0x0018, 0x9294, 0x00ff, 0x8007,
+	0x9215, 0x2222, 0x20a9, 0x0040, 0x2009, 0x024e, 0x270e, 0x8738,
+	0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009,
+	0x0240, 0x1f04, 0x59f6, 0x60c3, 0x0084, 0x080c, 0x5b64, 0x00fe,
+	0x0005, 0x00f6, 0x708c, 0x9005, 0x01e0, 0x2011, 0x5b3a, 0x080c,
+	0x8038, 0x9086, 0x0084, 0x1198, 0x080c, 0x5cab, 0x2079, 0x0260,
+	0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7093,
+	0x0001, 0x080c, 0x5c01, 0x7097, 0x001a, 0x0029, 0x0010, 0x708f,
+	0x0000, 0x00fe, 0x0005, 0x9085, 0x0001, 0x080c, 0x5cd6, 0x7097,
+	0x001b, 0x080c, 0x9c3f, 0x080c, 0x5cab, 0x2011, 0x0260, 0x2009,
+	0x0240, 0x748c, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8,
+	0x8004, 0x20a8, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150,
+	0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816,
+	0x2011, 0x0260, 0x1f04, 0x5a42, 0x60c3, 0x0084, 0x080c, 0x5b64,
+	0x0005, 0x0005, 0x0086, 0x0096, 0x2029, 0x1854, 0x252c, 0x20a9,
+	0x0008, 0x2041, 0x1c0e, 0x20e9, 0x0001, 0x28a0, 0x080c, 0x5cab,
+	0x20e1, 0x0000, 0x2099, 0x026e, 0x4003, 0x20a9, 0x0008, 0x2011,
+	0x0007, 0xd5d4, 0x0108, 0x9016, 0x2800, 0x9200, 0x200c, 0x91a6,
+	0xffff, 0x1148, 0xd5d4, 0x0110, 0x8210, 0x0008, 0x8211, 0x1f04,
+	0x5a74, 0x0804, 0x5ae3, 0x82ff, 0x1160, 0xd5d4, 0x0120, 0x91a6,
+	0x3fff, 0x0d90, 0x0020, 0x91a6, 0x3fff, 0x0904, 0x5ae3, 0x918d,
+	0xc000, 0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4, 0x0110, 0x2019,
+	0x0010, 0x2120, 0xd5d4, 0x0110, 0x8423, 0x0008, 0x8424, 0x1240,
+	0xd5d4, 0x0110, 0x8319, 0x0008, 0x8318, 0x1f04, 0x5a9a, 0x04d8,
+	0x23a8, 0x2021, 0x0001, 0x8426, 0x8425, 0x1f04, 0x5aac, 0x2328,
+	0x8529, 0x92be, 0x0007, 0x0158, 0x0006, 0x2039, 0x0007, 0x2200,
+	0x973a, 0x000e, 0x27a8, 0x95a8, 0x0010, 0x1f04, 0x5abb, 0x755a,
+	0x95c8, 0x3138, 0x292d, 0x95ac, 0x00ff, 0x757e, 0x6532, 0x6536,
+	0x0016, 0x2508, 0x080c, 0x26ac, 0x001e, 0x60e7, 0x0000, 0x65ea,
+	0x2018, 0x2304, 0x9405, 0x201a, 0x7083, 0x0001, 0x20e9, 0x0000,
+	0x20a1, 0x024e, 0x20e1, 0x0001, 0x2898, 0x20a9, 0x0008, 0x4003,
+	0x9085, 0x0001, 0x0008, 0x9006, 0x009e, 0x008e, 0x0005, 0x0156,
+	0x01c6, 0x01d6, 0x0136, 0x0146, 0x22a8, 0x20e1, 0x0000, 0x2099,
+	0x026e, 0x20e9, 0x0000, 0x2011, 0x024e, 0x22a0, 0x4003, 0x014e,
+	0x013e, 0x01de, 0x01ce, 0x015e, 0x2118, 0x9026, 0x2001, 0x0007,
+	0x939a, 0x0010, 0x0218, 0x8420, 0x8001, 0x0cd0, 0x2118, 0x84ff,
+	0x0120, 0x939a, 0x0010, 0x8421, 0x1de0, 0x2021, 0x0001, 0x83ff,
+	0x0118, 0x8423, 0x8319, 0x1de8, 0x9238, 0x2029, 0x026e, 0x9528,
+	0x2504, 0x942c, 0x11b8, 0x9405, 0x203a, 0x715a, 0x91a0, 0x3138,
+	0x242d, 0x95ac, 0x00ff, 0x757e, 0x6532, 0x6536, 0x0016, 0x2508,
+	0x080c, 0x26ac, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7083, 0x0001,
+	0x9084, 0x0000, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7087, 0x0000,
+	0x00ee, 0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071, 0x0140,
+	0x080c, 0x5bf0, 0x080c, 0x93ac, 0x7004, 0x9084, 0x4000, 0x0110,
+	0x080c, 0x2b24, 0x0126, 0x2091, 0x8000, 0x2071, 0x1825, 0x2073,
+	0x0000, 0x7840, 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c, 0x5c4d,
+	0x001e, 0x9094, 0x0010, 0x9285, 0x0080, 0x7842, 0x7a42, 0x002e,
+	0x012e, 0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x29ca, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x2011,
+	0x19c2, 0x2013, 0x0000, 0x708f, 0x0000, 0x012e, 0x60a3, 0x0056,
+	0x60a7, 0x9575, 0x080c, 0x93a3, 0x6144, 0xd184, 0x0120, 0x7194,
+	0x918d, 0x2000, 0x0018, 0x7188, 0x918d, 0x1000, 0x2011, 0x196a,
+	0x2112, 0x2009, 0x07d0, 0x2011, 0x5b3a, 0x080c, 0x80ca, 0x0005,
+	0x0016, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9db8,
+	0x2009, 0x00f7, 0x080c, 0x5c4d, 0x2061, 0x19cb, 0x900e, 0x611a,
+	0x611e, 0x6172, 0x6176, 0x2061, 0x1800, 0x6003, 0x0001, 0x2061,
+	0x0100, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009, 0x196a, 0x200b,
+	0x0000, 0x2009, 0x002d, 0x2011, 0x5bbc, 0x080c, 0x802c, 0x012e,
+	0x00ce, 0x002e, 0x001e, 0x0005, 0x00e6, 0x0006, 0x0126, 0x2091,
+	0x8000, 0x0471, 0x2071, 0x0100, 0x080c, 0x93ac, 0x2071, 0x0140,
+	0x7004, 0x9084, 0x4000, 0x0110, 0x080c, 0x2b24, 0x080c, 0x6fba,
+	0x0188, 0x080c, 0x6fd5, 0x1170, 0x080c, 0x72a0, 0x0016, 0x080c,
+	0x277b, 0x2001, 0x193e, 0x2102, 0x001e, 0x080c, 0x729b, 0x080c,
+	0x6ee4, 0x0050, 0x2009, 0x0001, 0x080c, 0x2a63, 0x2001, 0x0001,
+	0x080c, 0x260c, 0x080c, 0x5b90, 0x012e, 0x000e, 0x00ee, 0x0005,
+	0x2001, 0x180e, 0x2004, 0xd0bc, 0x0158, 0x0026, 0x0036, 0x2011,
+	0x8017, 0x2001, 0x196a, 0x201c, 0x080c, 0x48d9, 0x003e, 0x002e,
+	0x0005, 0x20a9, 0x0012, 0x20e9, 0x0001, 0x20a1, 0x1c80, 0x080c,
+	0x5cab, 0x20e9, 0x0000, 0x2099, 0x026e, 0x0099, 0x20a9, 0x0020,
+	0x080c, 0x5ca5, 0x2099, 0x0260, 0x20a1, 0x1c92, 0x0051, 0x20a9,
+	0x000e, 0x080c, 0x5ca8, 0x2099, 0x0260, 0x20a1, 0x1cb2, 0x0009,
+	0x0005, 0x0016, 0x0026, 0x3410, 0x3308, 0x2104, 0x8007, 0x2012,
+	0x8108, 0x8210, 0x1f04, 0x5c25, 0x002e, 0x001e, 0x0005, 0x080c,
+	0x9c3f, 0x20e1, 0x0001, 0x2099, 0x1c00, 0x20e9, 0x0000, 0x20a1,
+	0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x080c, 0x9c3f, 0x080c,
+	0x5cab, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1,
+	0x0240, 0x20a9, 0x000c, 0x4003, 0x0005, 0x00c6, 0x0006, 0x2061,
+	0x0100, 0x810f, 0x2001, 0x1833, 0x2004, 0x9005, 0x1138, 0x2001,
+	0x1817, 0x2004, 0x9084, 0x00ff, 0x9105, 0x0010, 0x9185, 0x00f7,
+	0x604a, 0x000e, 0x00ce, 0x0005, 0x0016, 0x0046, 0x080c, 0x655e,
+	0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xd52a, 0x2001,
+	0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x900e, 0x080c,
+	0x2fa5, 0x080c, 0xc212, 0x0140, 0x0036, 0x2019, 0xffff, 0x2021,
+	0x0007, 0x080c, 0x4a76, 0x003e, 0x004e, 0x001e, 0x0005, 0x080c,
+	0x5b90, 0x7097, 0x0000, 0x708f, 0x0000, 0x0005, 0x0006, 0x2001,
+	0x180c, 0x2004, 0xd09c, 0x0100, 0x000e, 0x0005, 0x0006, 0x0016,
+	0x0126, 0x2091, 0x8000, 0x2001, 0x0101, 0x200c, 0x918d, 0x0006,
+	0x2102, 0x012e, 0x001e, 0x000e, 0x0005, 0x2009, 0x0001, 0x0020,
+	0x2009, 0x0002, 0x0008, 0x900e, 0x6814, 0x9084, 0xffc0, 0x910d,
+	0x6916, 0x0005, 0x00f6, 0x0156, 0x0146, 0x01d6, 0x9006, 0x20a9,
+	0x0080, 0x20e9, 0x0001, 0x20a1, 0x1c00, 0x4004, 0x2079, 0x1c00,
+	0x7803, 0x2200, 0x7807, 0x00ef, 0x780f, 0x00ef, 0x7813, 0x0138,
+	0x7823, 0xffff, 0x7827, 0xffff, 0x01de, 0x014e, 0x015e, 0x00fe,
+	0x0005, 0x2001, 0x1800, 0x2003, 0x0001, 0x0005, 0x2001, 0x1977,
+	0x0118, 0x2003, 0x0001, 0x0010, 0x2003, 0x0000, 0x0005, 0x0156,
+	0x20a9, 0x0800, 0x2009, 0x1000, 0x9006, 0x200a, 0x8108, 0x1f04,
+	0x5ce5, 0x015e, 0x0005, 0x00d6, 0x0036, 0x0156, 0x0136, 0x0146,
+	0x2069, 0x1853, 0x9006, 0xb802, 0xb8be, 0xb807, 0x0707, 0xb80a,
+	0xb80e, 0xb812, 0x9198, 0x3138, 0x231d, 0x939c, 0x00ff, 0xbb16,
+	0x0016, 0x0026, 0xb8b2, 0x080c, 0x9db1, 0x1120, 0x9192, 0x007e,
+	0x1208, 0xbbb2, 0x20a9, 0x0004, 0xb8b4, 0x20e8, 0xb9b8, 0x9198,
+	0x0006, 0x9006, 0x23a0, 0x4004, 0x20a9, 0x0004, 0x9198, 0x000a,
+	0x23a0, 0x4004, 0x002e, 0x001e, 0xb83e, 0xb842, 0xb84e, 0xb852,
+	0xb856, 0xb85a, 0xb85e, 0xb862, 0xb866, 0xb86a, 0xb86f, 0x0100,
+	0xb872, 0xb876, 0xb87a, 0xb88a, 0xb88e, 0xb893, 0x0008, 0xb896,
+	0xb89a, 0xb89e, 0xb8ae, 0xb9a2, 0x0096, 0xb8a4, 0x904d, 0x0110,
+	0x080c, 0x101d, 0xb8a7, 0x0000, 0x009e, 0x9006, 0xb84a, 0x6810,
+	0xb83a, 0x680c, 0xb846, 0x6814, 0x9084, 0x00ff, 0xb842, 0x014e,
+	0x013e, 0x015e, 0x003e, 0x00de, 0x0005, 0x0126, 0x2091, 0x8000,
+	0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x5dbb,
+	0x9182, 0x0800, 0x1a04, 0x5dbf, 0x2001, 0x180c, 0x2004, 0x9084,
+	0x0003, 0x1904, 0x5dc5, 0x9188, 0x1000, 0x2104, 0x905d, 0x0518,
+	0xb804, 0x9084, 0x00ff, 0x908e, 0x0006, 0x1508, 0xb8a4, 0x900d,
+	0x1904, 0x5dd7, 0xb850, 0x900d, 0x1148, 0xa802, 0x2900, 0xb852,
+	0xb84e, 0x080c, 0x840e, 0x9006, 0x012e, 0x0005, 0x00a6, 0x2150,
+	0x2900, 0xb002, 0xa803, 0x0000, 0x00ae, 0xb852, 0x0c90, 0x2001,
+	0x0005, 0x900e, 0x04b8, 0x2001, 0x0028, 0x900e, 0x0498, 0x9082,
+	0x0006, 0x1290, 0x080c, 0x9db1, 0x1160, 0xb8a0, 0x9084, 0xff80,
+	0x1140, 0xb900, 0xd1fc, 0x0990, 0x2001, 0x0029, 0x2009, 0x1000,
+	0x0408, 0x2001, 0x0028, 0x00a8, 0x2009, 0x180c, 0x210c, 0xd18c,
+	0x0118, 0x2001, 0x0004, 0x0068, 0xd184, 0x0118, 0x2001, 0x0004,
+	0x0040, 0x2001, 0x0029, 0xb900, 0xd1fc, 0x0118, 0x2009, 0x1000,
+	0x0048, 0x900e, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018, 0x2001,
+	0x0029, 0x900e, 0x9005, 0x012e, 0x0005, 0x2001, 0x180c, 0x2004,
+	0xd084, 0x19d0, 0x9188, 0x1000, 0x2104, 0x905d, 0x09a8, 0x080c,
+	0x6562, 0x1990, 0xb800, 0xd0bc, 0x0978, 0x0804, 0x5d6e, 0x080c,
+	0x63da, 0x0904, 0x5d87, 0x0804, 0x5d72, 0x00b6, 0x00e6, 0x0126,
+	0x2091, 0x8000, 0xa974, 0x9182, 0x0800, 0x1a04, 0x5e58, 0x9188,
+	0x1000, 0x2104, 0x905d, 0x0904, 0x5e30, 0xb8a0, 0x9086, 0x007f,
+	0x0178, 0x080c, 0x656a, 0x0160, 0xa994, 0x81ff, 0x0130, 0x908e,
+	0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x080c, 0x6562, 0x1598,
+	0xa87c, 0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060, 0x0026,
+	0x2010, 0x080c, 0xbb05, 0x002e, 0x1120, 0x2001, 0x0008, 0x0804,
+	0x5e5a, 0x6020, 0x9086, 0x000a, 0x0120, 0x2001, 0x0008, 0x0804,
+	0x5e5a, 0x601a, 0x6003, 0x0008, 0x2900, 0x6016, 0x0058, 0x080c,
+	0x9ddc, 0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b, 0xffff,
+	0x6023, 0x000a, 0x2009, 0x0003, 0x080c, 0x9eac, 0x9006, 0x0458,
+	0x2001, 0x0028, 0x0438, 0x9082, 0x0006, 0x1290, 0x080c, 0x9db1,
+	0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0900,
+	0x2001, 0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090,
+	0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050,
+	0xd184, 0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029, 0x0010,
+	0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001,
+	0x002c, 0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000, 0xa8e0,
+	0x9005, 0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8, 0x9005,
+	0x1518, 0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079, 0x1800,
+	0x9182, 0x0800, 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130, 0xaa98,
+	0xab94, 0xa878, 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c, 0x0118,
+	0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010,
+	0x2001, 0x0029, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018,
+	0x2001, 0x0029, 0x900e, 0x9006, 0x0008, 0x9005, 0x012e, 0x00be,
+	0x00fe, 0x0005, 0x5eef, 0x5eaa, 0x5ec1, 0x5eef, 0x5eef, 0x5eef,
+	0x5eef, 0x5eef, 0x2100, 0x9082, 0x007e, 0x1278, 0x080c, 0x61de,
+	0x0148, 0x9046, 0xb810, 0x9306, 0x1904, 0x5ef7, 0xb814, 0x9206,
+	0x15f0, 0x0028, 0xbb12, 0xba16, 0x0010, 0x080c, 0x4793, 0x0150,
+	0x04b0, 0x080c, 0x623e, 0x1598, 0xb810, 0x9306, 0x1580, 0xb814,
+	0x9206, 0x1568, 0x080c, 0x9ddc, 0x0530, 0x2b00, 0x6012, 0x080c,
+	0xbf8c, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a, 0xa878,
+	0x9086, 0x0001, 0x1170, 0x080c, 0x2fda, 0x9006, 0x080c, 0x617b,
+	0x2001, 0x0002, 0x080c, 0x618f, 0x2001, 0x0200, 0xb86e, 0xb893,
+	0x0002, 0x2009, 0x0003, 0x080c, 0x9eac, 0x9006, 0x0068, 0x2001,
+	0x0001, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001,
+	0x0028, 0x900e, 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe, 0x0005,
+	0x00b6, 0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894, 0x90c6,
+	0x0015, 0x0904, 0x60cc, 0x90c6, 0x0056, 0x0904, 0x60d0, 0x90c6,
+	0x0066, 0x0904, 0x60d4, 0x90c6, 0x0067, 0x0904, 0x60d8, 0x90c6,
+	0x0068, 0x0904, 0x60dc, 0x90c6, 0x0071, 0x0904, 0x60e0, 0x90c6,
+	0x0074, 0x0904, 0x60e4, 0x90c6, 0x007c, 0x0904, 0x60e8, 0x90c6,
+	0x007e, 0x0904, 0x60ec, 0x90c6, 0x0037, 0x0904, 0x60f0, 0x9016,
+	0x2079, 0x1800, 0xa974, 0x9186, 0x00ff, 0x0904, 0x60c7, 0x9182,
+	0x0800, 0x1a04, 0x60c7, 0x080c, 0x623e, 0x1198, 0xb804, 0x9084,
+	0x00ff, 0x9082, 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f, 0x0148,
+	0x080c, 0x9db1, 0x1904, 0x60b0, 0xb8a0, 0x9084, 0xff80, 0x1904,
+	0x60b0, 0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e, 0x0904,
+	0x6010, 0x90c6, 0x0064, 0x0904, 0x6039, 0x2008, 0x0804, 0x5fd3,
+	0xa998, 0xa8b0, 0x2040, 0x080c, 0x9db1, 0x1120, 0x9182, 0x007f,
+	0x0a04, 0x5fd3, 0x9186, 0x00ff, 0x0904, 0x5fd3, 0x9182, 0x0800,
+	0x1a04, 0x5fd3, 0xaaa0, 0xab9c, 0x7878, 0x9306, 0x1188, 0x787c,
+	0x0096, 0x924e, 0x1128, 0x2208, 0x2310, 0x009e, 0x0804, 0x5fd3,
+	0x99cc, 0xff00, 0x009e, 0x1120, 0x2208, 0x2310, 0x0804, 0x5fd3,
+	0x080c, 0x4793, 0x0904, 0x5fdc, 0x900e, 0x9016, 0x90c6, 0x4000,
+	0x1558, 0x0006, 0x080c, 0x645e, 0x1108, 0xc185, 0xb800, 0xd0bc,
+	0x0108, 0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x0031, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098,
+	0x080c, 0x0f68, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x0035, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x000a, 0x2098,
+	0x080c, 0x0f68, 0x000e, 0x00c8, 0x90c6, 0x4007, 0x1110, 0x2408,
+	0x00a0, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0070, 0x90c6,
+	0x4009, 0x1108, 0x0050, 0x90c6, 0x4006, 0x0138, 0x2001, 0x4005,
+	0x2009, 0x000a, 0x0010, 0x2001, 0x4006, 0xa896, 0xa99a, 0xaa9e,
+	0x2001, 0x0030, 0x900e, 0x0470, 0x080c, 0x9ddc, 0x1130, 0x2001,
+	0x4005, 0x2009, 0x0003, 0x9016, 0x0c80, 0x2b00, 0x6012, 0x080c,
+	0xbf8c, 0x2900, 0x6016, 0x6023, 0x0001, 0xa868, 0xd88c, 0x0108,
+	0xc0f5, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x2fda, 0x012e,
+	0x9006, 0x080c, 0x617b, 0x2001, 0x0002, 0x080c, 0x618f, 0x2009,
+	0x0002, 0x080c, 0x9eac, 0xa8b0, 0xd094, 0x0118, 0xb8bc, 0xc08d,
+	0xb8be, 0x9006, 0x9005, 0x012e, 0x00ee, 0x00fe, 0x00be, 0x0005,
+	0x080c, 0x539a, 0x0118, 0x2009, 0x0007, 0x00f8, 0xa998, 0xaeb0,
+	0x080c, 0x623e, 0x1904, 0x5fce, 0x9186, 0x007f, 0x0130, 0x080c,
+	0x6562, 0x0118, 0x2009, 0x0009, 0x0080, 0x0096, 0x080c, 0x0feb,
+	0x1120, 0x009e, 0x2009, 0x0002, 0x0040, 0x2900, 0x009e, 0xa806,
+	0x080c, 0xbcfd, 0x19b0, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804,
+	0x5fd5, 0xa998, 0xaeb0, 0x080c, 0x623e, 0x1904, 0x5fce, 0x0096,
+	0x080c, 0x0feb, 0x1128, 0x009e, 0x2009, 0x0002, 0x0804, 0x608d,
+	0x2900, 0x009e, 0xa806, 0x0096, 0x2048, 0x20a9, 0x002b, 0xb8b4,
+	0x20e0, 0xb8b8, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
+	0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xbbb8,
+	0x9398, 0x0006, 0x2398, 0x080c, 0x0f68, 0x009e, 0xa87b, 0x0000,
+	0xa883, 0x0000, 0xa897, 0x4000, 0xd684, 0x1168, 0x080c, 0x5386,
+	0xd0b4, 0x1118, 0xa89b, 0x000b, 0x00e0, 0xb800, 0xd08c, 0x0118,
+	0xa89b, 0x000c, 0x00b0, 0x080c, 0x6562, 0x0118, 0xa89b, 0x0009,
+	0x0080, 0x080c, 0x539a, 0x0118, 0xa89b, 0x0007, 0x0050, 0x080c,
+	0xbce0, 0x1904, 0x6009, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804,
+	0x5fd5, 0xa87b, 0x0030, 0xa897, 0x4005, 0xa804, 0x8006, 0x8006,
+	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009,
+	0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041,
+	0x122f, 0x080c, 0xa334, 0x1904, 0x6009, 0x2009, 0x0002, 0x08e8,
+	0x2001, 0x0028, 0x900e, 0x0804, 0x600a, 0x2009, 0x180c, 0x210c,
+	0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001,
+	0x0004, 0x0010, 0x2001, 0x0029, 0x900e, 0x0804, 0x600a, 0x2001,
+	0x0029, 0x900e, 0x0804, 0x600a, 0x080c, 0x355c, 0x0804, 0x600b,
+	0x080c, 0x50c3, 0x0804, 0x600b, 0x080c, 0x432c, 0x0804, 0x600b,
+	0x080c, 0x43a5, 0x0804, 0x600b, 0x080c, 0x4401, 0x0804, 0x600b,
+	0x080c, 0x484f, 0x0804, 0x600b, 0x080c, 0x4afb, 0x0804, 0x600b,
+	0x080c, 0x4d2e, 0x0804, 0x600b, 0x080c, 0x4f27, 0x0804, 0x600b,
+	0x080c, 0x376c, 0x0804, 0x600b, 0x00b6, 0xa974, 0xae78, 0x9684,
+	0x3fff, 0x9082, 0x4000, 0x1618, 0x9182, 0x0800, 0x1268, 0x9188,
+	0x1000, 0x2104, 0x905d, 0x0140, 0x080c, 0x6562, 0x1148, 0x00e9,
+	0x080c, 0x6369, 0x9006, 0x00b0, 0x2001, 0x0028, 0x900e, 0x0090,
+	0x9082, 0x0006, 0x1240, 0xb900, 0xd1fc, 0x0d88, 0x2001, 0x0029,
+	0x2009, 0x1000, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018, 0x2001,
+	0x0029, 0x900e, 0x9005, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000,
+	0xb850, 0x900d, 0x0150, 0x2900, 0x0096, 0x2148, 0xa802, 0x009e,
+	0xa803, 0x0000, 0xb852, 0x012e, 0x0005, 0x2900, 0xb852, 0xb84e,
+	0xa803, 0x0000, 0x0cc0, 0x0126, 0x2091, 0x8000, 0xb84c, 0x9005,
+	0x0170, 0x00e6, 0x2071, 0x19b8, 0x7004, 0x9086, 0x0002, 0x0168,
+	0x00ee, 0xb84c, 0xa802, 0x2900, 0xb84e, 0x012e, 0x0005, 0x2900,
+	0xb852, 0xb84e, 0xa803, 0x0000, 0x0cc0, 0x701c, 0x9b06, 0x1d80,
+	0xb84c, 0x00a6, 0x2050, 0xb000, 0xa802, 0x2900, 0xb002, 0x00ae,
+	0x00ee, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0xb84c, 0x904d,
+	0x0130, 0xa800, 0x9005, 0x1108, 0xb852, 0xb84e, 0x9905, 0x012e,
+	0x0005, 0xb84c, 0x904d, 0x0130, 0xa800, 0x9005, 0x1108, 0xb852,
+	0xb84e, 0x9905, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x0026, 0x2091,
+	0x8000, 0x6210, 0x2258, 0xba00, 0x9005, 0x0110, 0xc285, 0x0008,
+	0xc284, 0xba02, 0x002e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6,
+	0x0126, 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006,
+	0x9086, 0x0006, 0x1170, 0xb89c, 0xd0ac, 0x0158, 0x080c, 0x655e,
+	0x0140, 0x9284, 0xff00, 0x8007, 0x9086, 0x0007, 0x1110, 0x2011,
+	0x0600, 0x000e, 0x9294, 0xff00, 0x9215, 0xba06, 0x0006, 0x9086,
+	0x0006, 0x1120, 0xba90, 0x82ff, 0x090c, 0x0db4, 0x000e, 0x00ce,
+	0x012e, 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000,
+	0x6210, 0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1168, 0xb89c,
+	0xd0a4, 0x0150, 0x080c, 0x655a, 0x1138, 0x9284, 0x00ff, 0x9086,
+	0x0007, 0x1110, 0x2011, 0x0006, 0x000e, 0x9294, 0x00ff, 0x8007,
+	0x9215, 0xba06, 0x00ce, 0x012e, 0x00be, 0x0005, 0x9182, 0x0800,
+	0x0218, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0026, 0x9190, 0x1000,
+	0x2204, 0x905d, 0x1180, 0x0096, 0x080c, 0x0feb, 0x2958, 0x009e,
+	0x0160, 0x2b00, 0x2012, 0xb85c, 0xb8ba, 0xb860, 0xb8b6, 0x9006,
+	0xb8a6, 0x080c, 0x5ceb, 0x9006, 0x0010, 0x9085, 0x0001, 0x002e,
+	0x00de, 0x0005, 0x00b6, 0x0096, 0x0126, 0x2091, 0x8000, 0x0026,
+	0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0458, 0x00d6, 0x9190,
+	0x1000, 0x2204, 0x905d, 0x0518, 0x2013, 0x0000, 0xb8a4, 0x904d,
+	0x0110, 0x080c, 0x101d, 0x00d6, 0x00c6, 0xb8ac, 0x2060, 0x8cff,
+	0x0168, 0x600c, 0x0006, 0x6014, 0x2048, 0x080c, 0xbb17, 0x0110,
+	0x080c, 0x0f9d, 0x080c, 0x9e32, 0x00ce, 0x0c88, 0x00ce, 0x00de,
+	0x2b48, 0xb8b8, 0xb85e, 0xb8b4, 0xb862, 0x080c, 0x102d, 0x00de,
+	0x9006, 0x002e, 0x012e, 0x009e, 0x00be, 0x0005, 0x0016, 0x9182,
+	0x0800, 0x0218, 0x9085, 0x0001, 0x0030, 0x9188, 0x1000, 0x2104,
+	0x905d, 0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6, 0x0156, 0x0136,
+	0x0146, 0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c, 0xb802, 0x080c,
+	0x6fb2, 0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120, 0x080c, 0x9db1,
+	0x11d8, 0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6, 0x2061, 0x1953,
+	0x7048, 0x2062, 0x704c, 0x6006, 0x7050, 0x600a, 0x7054, 0x600e,
+	0x00ce, 0x703c, 0x2069, 0x0140, 0x9005, 0x1110, 0x2001, 0x0001,
+	0x6886, 0x2069, 0x1800, 0x68b2, 0x7040, 0xb85e, 0x7048, 0xb862,
+	0x704c, 0xb866, 0x20e1, 0x0000, 0x2099, 0x0276, 0xb8b4, 0x20e8,
+	0xb8b8, 0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2099,
+	0x027a, 0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004, 0x4003, 0x2069,
+	0x0200, 0x6817, 0x0001, 0x7040, 0xb86a, 0x7144, 0xb96e, 0x7048,
+	0xb872, 0x7050, 0xb876, 0x2069, 0x0200, 0x6817, 0x0000, 0xb8a0,
+	0x9086, 0x007e, 0x1110, 0x7144, 0xb96e, 0x9182, 0x0211, 0x1218,
+	0x2009, 0x0008, 0x0400, 0x9182, 0x0259, 0x1218, 0x2009, 0x0007,
+	0x00d0, 0x9182, 0x02c1, 0x1218, 0x2009, 0x0006, 0x00a0, 0x9182,
+	0x0349, 0x1218, 0x2009, 0x0005, 0x0070, 0x9182, 0x0421, 0x1218,
+	0x2009, 0x0004, 0x0040, 0x9182, 0x0581, 0x1218, 0x2009, 0x0003,
+	0x0010, 0x2009, 0x0002, 0xb992, 0x014e, 0x013e, 0x015e, 0x00de,
+	0x0005, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7034, 0xb896,
+	0x703c, 0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbbc, 0xc384, 0xba00,
+	0x2009, 0x1873, 0x210c, 0xd0bc, 0x0120, 0xd1ec, 0x0110, 0xc2ad,
+	0x0008, 0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138, 0xc2bd, 0xd0cc,
+	0x0128, 0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc, 0xba02, 0xbbbe,
+	0x003e, 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096, 0x0126, 0x2091,
+	0x8000, 0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff, 0x15c0, 0xaa04,
+	0x9282, 0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x8906,
+	0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9080,
+	0x0004, 0x2098, 0x2009, 0x0010, 0x20a9, 0x0001, 0x4002, 0x9086,
+	0xffff, 0x0120, 0x8109, 0x1dd0, 0x080c, 0x0db4, 0x3c00, 0x20e8,
+	0x3300, 0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06, 0x01de, 0x01ce,
+	0x014e, 0x013e, 0x0060, 0x080c, 0x0feb, 0x0170, 0x2900, 0xb8a6,
+	0xa803, 0x0000, 0x080c, 0x63fa, 0xa807, 0x0001, 0xae12, 0x9085,
+	0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0126, 0x2091,
+	0x8000, 0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800, 0x9005, 0x1150,
+	0x080c, 0x6409, 0x1158, 0xa804, 0x908a, 0x0002, 0x0218, 0x8001,
+	0xa806, 0x0020, 0x080c, 0x101d, 0xb8a7, 0x0000, 0x009e, 0x012e,
+	0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x840e, 0x012e, 0x0005,
+	0x901e, 0x0010, 0x2019, 0x0001, 0x900e, 0x0126, 0x2091, 0x8000,
+	0xb84c, 0x2048, 0xb800, 0xd0dc, 0x1170, 0x89ff, 0x0500, 0x83ff,
+	0x0120, 0xa878, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406, 0x1118,
+	0xa870, 0x9506, 0x0120, 0x2908, 0xa800, 0x2048, 0x0c70, 0x080c,
+	0x97b0, 0xaa00, 0xb84c, 0x9906, 0x1110, 0xba4e, 0x0020, 0x00a6,
+	0x2150, 0xb202, 0x00ae, 0x82ff, 0x1110, 0xb952, 0x89ff, 0x012e,
+	0x0005, 0x9016, 0x0489, 0x1110, 0x2011, 0x0001, 0x0005, 0x080c,
+	0x645e, 0x0128, 0x080c, 0xbbd4, 0x0010, 0x9085, 0x0001, 0x0005,
+	0x080c, 0x645e, 0x0128, 0x080c, 0xbb79, 0x0010, 0x9085, 0x0001,
+	0x0005, 0x080c, 0x645e, 0x0128, 0x080c, 0xbbd1, 0x0010, 0x9085,
+	0x0001, 0x0005, 0x080c, 0x645e, 0x0128, 0x080c, 0xbb98, 0x0010,
+	0x9085, 0x0001, 0x0005, 0x080c, 0x645e, 0x0128, 0x080c, 0xbc15,
+	0x0010, 0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118, 0x9085,
+	0x0001, 0x0005, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e,
 	0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080,
 	0x0004, 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002, 0x9606,
-	0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0068, 0x0146, 0x01d6,
-	0x3300, 0x8001, 0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004,
-	0x01de, 0x014e, 0x9006, 0x01ce, 0x013e, 0x0005, 0x0096, 0x0126,
-	0x2091, 0x8000, 0xb8a4, 0x904d, 0x1128, 0x080c, 0x0feb, 0x0168,
-	0x2900, 0xb8a6, 0x080c, 0x63f3, 0xa803, 0x0001, 0xa807, 0x0000,
-	0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096,
-	0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000,
-	0x080c, 0x101d, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0xb89c,
-	0xd0a4, 0x0005, 0x00b6, 0x00f6, 0x080c, 0x6fa7, 0x01b0, 0x71c0,
-	0x81ff, 0x1198, 0x71d8, 0xd19c, 0x0180, 0x2001, 0x007e, 0x9080,
-	0x1000, 0x2004, 0x905d, 0x0148, 0xb804, 0x9084, 0x00ff, 0x9086,
-	0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x2079, 0x1853, 0x7804,
-	0x00d0, 0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6237,
-	0x1168, 0xb804, 0x9084, 0xff00, 0x8007, 0x9096, 0x0004, 0x0118,
-	0x9086, 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e, 0x8108,
-	0x1f04, 0x647d, 0x015e, 0x080c, 0x6519, 0x0120, 0x2001, 0x1956,
-	0x200c, 0x0030, 0x2079, 0x1853, 0x7804, 0x0030, 0x2009, 0x07d0,
-	0x2011, 0x64a7, 0x080c, 0x80a2, 0x00fe, 0x00be, 0x0005, 0x00b6,
-	0x2011, 0x64a7, 0x080c, 0x8010, 0x080c, 0x6519, 0x01d8, 0x2001,
-	0x107e, 0x2004, 0x2058, 0xb900, 0xc1ec, 0xb902, 0x080c, 0x6557,
-	0x0130, 0x2009, 0x07d0, 0x2011, 0x64a7, 0x080c, 0x80a2, 0x00e6,
-	0x2071, 0x1800, 0x9006, 0x707a, 0x705c, 0x707e, 0x080c, 0x2dbb,
-	0x00ee, 0x04b0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016,
-	0x080c, 0x6237, 0x1538, 0xb800, 0xd0ec, 0x0520, 0x0046, 0xbaa0,
-	0x2220, 0x9006, 0x2009, 0x0029, 0x080c, 0xd50a, 0xb800, 0xc0e5,
-	0xc0ec, 0xb802, 0x080c, 0x6553, 0x2001, 0x0707, 0x1128, 0xb804,
-	0x9084, 0x00ff, 0x9085, 0x0700, 0xb806, 0x2019, 0x0029, 0x080c,
-	0x8549, 0x0076, 0x903e, 0x080c, 0x8441, 0x900e, 0x080c, 0xd27b,
-	0x007e, 0x004e, 0x001e, 0x8108, 0x1f04, 0x64cf, 0x00ce, 0x015e,
-	0x00be, 0x0005, 0x00b6, 0x6010, 0x2058, 0xb800, 0xc0ec, 0xb802,
-	0x00be, 0x0005, 0x7810, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ac,
-	0x0005, 0x6010, 0x00b6, 0x905d, 0x0108, 0xb800, 0x00be, 0xd0bc,
-	0x0005, 0x00b6, 0x00f6, 0x2001, 0x107e, 0x2004, 0x905d, 0x0110,
-	0xb800, 0xd0ec, 0x00fe, 0x00be, 0x0005, 0x0126, 0x0026, 0x2091,
-	0x8000, 0x0006, 0xbaa0, 0x9290, 0x1000, 0x2204, 0x9b06, 0x190c,
-	0x0db4, 0x000e, 0xba00, 0x9005, 0x0110, 0xc2fd, 0x0008, 0xc2fc,
-	0xba02, 0x002e, 0x012e, 0x0005, 0x2011, 0x1836, 0x2204, 0xd0cc,
-	0x0138, 0x2001, 0x1954, 0x200c, 0x2011, 0x6549, 0x080c, 0x80a2,
-	0x0005, 0x2011, 0x6549, 0x080c, 0x8010, 0x2011, 0x1836, 0x2204,
-	0xc0cc, 0x2012, 0x0005, 0x080c, 0x537f, 0xd0ac, 0x0005, 0x080c,
-	0x537f, 0xd0a4, 0x0005, 0x0016, 0xb904, 0x9184, 0x00ff, 0x908e,
-	0x0006, 0x001e, 0x0005, 0x0016, 0xb904, 0x9184, 0xff00, 0x8007,
-	0x908e, 0x0006, 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xc1f9,
-	0x0158, 0x70d8, 0x9084, 0x0028, 0x0138, 0x2001, 0x107f, 0x2004,
-	0x905d, 0x0110, 0xb8bc, 0xd094, 0x00fe, 0x00be, 0x0005, 0x0006,
-	0x0016, 0x0036, 0x0046, 0x0076, 0x00b6, 0x2001, 0x1817, 0x203c,
-	0x9780, 0x3131, 0x203d, 0x97bc, 0xff00, 0x873f, 0x9006, 0x2018,
-	0x2008, 0x9284, 0x8000, 0x0110, 0x2019, 0x0001, 0x9294, 0x7fff,
-	0x2100, 0x9706, 0x0190, 0x91a0, 0x1000, 0x2404, 0x905d, 0x0168,
-	0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1138, 0x83ff, 0x0118,
-	0xb89c, 0xd0a4, 0x0110, 0x8211, 0x0158, 0x8108, 0x83ff, 0x0120,
-	0x9182, 0x0800, 0x0e28, 0x0068, 0x9182, 0x007e, 0x0e08, 0x0048,
-	0x00be, 0x007e, 0x004e, 0x003e, 0x001e, 0x9085, 0x0001, 0x000e,
-	0x0005, 0x00be, 0x007e, 0x004e, 0x003e, 0x001e, 0x9006, 0x000e,
-	0x0005, 0x0046, 0x0056, 0x0076, 0x00b6, 0x2100, 0x9084, 0x7fff,
-	0x9080, 0x1000, 0x2004, 0x905d, 0x0130, 0xb804, 0x9084, 0x00ff,
-	0x9086, 0x0006, 0x0550, 0x9184, 0x8000, 0x0580, 0x2001, 0x1817,
-	0x203c, 0x9780, 0x3131, 0x203d, 0x97bc, 0xff00, 0x873f, 0x9006,
-	0x2020, 0x2400, 0x9706, 0x01a0, 0x94a8, 0x1000, 0x2504, 0x905d,
-	0x0178, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1148, 0xb89c,
-	0xd0a4, 0x0130, 0xb814, 0x9206, 0x1118, 0xb810, 0x9306, 0x0128,
-	0x8420, 0x9482, 0x0800, 0x0e28, 0x0048, 0x918c, 0x7fff, 0x00be,
-	0x007e, 0x005e, 0x004e, 0x9085, 0x0001, 0x0005, 0x918c, 0x7fff,
-	0x00be, 0x007e, 0x005e, 0x004e, 0x9006, 0x0005, 0x2071, 0x1906,
-	0x7003, 0x0001, 0x7007, 0x0000, 0x9006, 0x7012, 0x7016, 0x701a,
-	0x701e, 0x700a, 0x7046, 0x2001, 0x1919, 0x2003, 0x0000, 0x0005,
-	0x0016, 0x00e6, 0x2071, 0x191a, 0x900e, 0x710a, 0x080c, 0x537f,
-	0xd0fc, 0x1140, 0x080c, 0x537f, 0x900e, 0xd09c, 0x0108, 0x8108,
-	0x7102, 0x0400, 0x2001, 0x1873, 0x200c, 0x9184, 0x0007, 0x9006,
-	0x0002, 0x6632, 0x6632, 0x6632, 0x6632, 0x6632, 0x6649, 0x6657,
-	0x6632, 0x7003, 0x0003, 0x2009, 0x1874, 0x210c, 0x9184, 0xff00,
-	0x8007, 0x9005, 0x1110, 0x2001, 0x0002, 0x7006, 0x0018, 0x7003,
-	0x0005, 0x0c88, 0x00ee, 0x001e, 0x0005, 0x00e6, 0x2071, 0x0050,
-	0x684c, 0x9005, 0x1150, 0x00e6, 0x2071, 0x1906, 0x7028, 0xc085,
-	0x702a, 0x00ee, 0x9085, 0x0001, 0x0488, 0x6844, 0x9005, 0x0158,
-	0x080c, 0x72fd, 0x6a60, 0x9200, 0x7002, 0x6864, 0x9101, 0x7006,
-	0x9006, 0x7012, 0x7016, 0x6860, 0x7002, 0x6864, 0x7006, 0x6868,
-	0x700a, 0x686c, 0x700e, 0x6844, 0x9005, 0x1110, 0x7012, 0x7016,
-	0x684c, 0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x7037, 0x0019,
-	0x702b, 0x0001, 0x00e6, 0x2071, 0x1906, 0x7028, 0xc084, 0x702a,
-	0x7007, 0x0001, 0x700b, 0x0000, 0x00ee, 0x9006, 0x00ee, 0x0005,
-	0xa868, 0xd0fc, 0x11d8, 0x00e6, 0x0026, 0x2001, 0x191a, 0x2004,
-	0x9005, 0x0904, 0x688a, 0xa87c, 0xd0bc, 0x1904, 0x688a, 0xa978,
-	0xa874, 0x9105, 0x1904, 0x688a, 0x2001, 0x191a, 0x2004, 0x0002,
-	0x688a, 0x66e3, 0x671f, 0x671f, 0x688a, 0x671f, 0x0005, 0xa868,
-	0xd0fc, 0x1500, 0x00e6, 0x0026, 0x2009, 0x191a, 0x210c, 0x81ff,
-	0x0904, 0x688a, 0xa87c, 0xd0cc, 0x0904, 0x688a, 0xa880, 0x9084,
-	0x00ff, 0x9086, 0x0001, 0x1904, 0x688a, 0x9186, 0x0003, 0x0904,
-	0x671f, 0x9186, 0x0005, 0x0904, 0x671f, 0xa84f, 0x8021, 0xa853,
-	0x0017, 0x0028, 0x0005, 0xa84f, 0x8020, 0xa853, 0x0016, 0x2071,
-	0x1906, 0x701c, 0x9005, 0x1904, 0x6a4a, 0x0e04, 0x6a95, 0x2071,
-	0x0000, 0xa84c, 0x7082, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036,
-	0xa870, 0x708a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-	0x190c, 0x1187, 0x2071, 0x1800, 0x2011, 0x0001, 0xa804, 0x900d,
-	0x702c, 0x1158, 0xa802, 0x2900, 0x702e, 0x70bc, 0x9200, 0x70be,
-	0x080c, 0x7f35, 0x002e, 0x00ee, 0x0005, 0x0096, 0x2148, 0xa904,
-	0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x009e, 0x0c58, 0xa84f,
-	0x0000, 0x00f6, 0x2079, 0x0050, 0x2071, 0x1906, 0xa803, 0x0000,
-	0x7010, 0x9005, 0x1904, 0x680e, 0x782c, 0x908c, 0x0780, 0x190c,
-	0x6bbc, 0x8004, 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x673d,
-	0x680e, 0x6762, 0x67a9, 0x080c, 0x0db4, 0x2071, 0x1800, 0x2900,
-	0x7822, 0xa804, 0x900d, 0x1170, 0x2071, 0x19cb, 0x703c, 0x9005,
-	0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e,
-	0x00ee, 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
-	0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c,
-	0x7f35, 0x0c10, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d,
-	0x1580, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1148,
-	0x2009, 0x182f, 0x210c, 0x918a, 0x0040, 0x0218, 0x7022, 0x00ee,
-	0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc,
-	0x8000, 0x70be, 0x080c, 0x7f35, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x6bbc, 0xd0a4, 0x19f0, 0x2071, 0x19cb, 0x703c, 0x9005, 0x1328,
-	0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee,
-	0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-	0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f35,
-	0x0800, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c,
-	0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x7f35,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd0a4, 0x1d60, 0x00ee,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd09c, 0x11a0, 0x009e,
-	0x2900, 0x7822, 0xa804, 0x900d, 0x1560, 0x2071, 0x19cb, 0x703c,
-	0x9005, 0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe,
-	0x002e, 0x00ee, 0x0005, 0x009e, 0x2908, 0x7010, 0x8000, 0x7012,
-	0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148,
+	0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0008, 0x9006, 0x01ce,
+	0x013e, 0x0005, 0x0146, 0x01d6, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x0004, 0x20a0, 0x20a9, 0x0010, 0x2009, 0xffff, 0x4104, 0x01de,
+	0x014e, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e, 0x810e,
+	0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0004,
+	0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002, 0x9606, 0x0128,
+	0x8109, 0x1dd8, 0x9085, 0x0001, 0x0068, 0x0146, 0x01d6, 0x3300,
+	0x8001, 0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004, 0x01de,
+	0x014e, 0x9006, 0x01ce, 0x013e, 0x0005, 0x0096, 0x0126, 0x2091,
+	0x8000, 0xb8a4, 0x904d, 0x1128, 0x080c, 0x0feb, 0x0168, 0x2900,
+	0xb8a6, 0x080c, 0x63fa, 0xa803, 0x0001, 0xa807, 0x0000, 0x9085,
+	0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x0126,
+	0x2091, 0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000, 0x080c,
+	0x101d, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0xb89c, 0xd0a4,
+	0x0005, 0x00b6, 0x00f6, 0x080c, 0x6fb2, 0x01b0, 0x71c0, 0x81ff,
+	0x1198, 0x71d8, 0xd19c, 0x0180, 0x2001, 0x007e, 0x9080, 0x1000,
+	0x2004, 0x905d, 0x0148, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006,
+	0x1118, 0xb800, 0xc0ed, 0xb802, 0x2079, 0x1853, 0x7804, 0x00d0,
+	0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x623e, 0x1168,
+	0xb804, 0x9084, 0xff00, 0x8007, 0x9096, 0x0004, 0x0118, 0x9086,
+	0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e, 0x8108, 0x1f04,
+	0x6484, 0x015e, 0x080c, 0x6520, 0x0120, 0x2001, 0x1956, 0x200c,
+	0x0030, 0x2079, 0x1853, 0x7804, 0x0030, 0x2009, 0x07d0, 0x2011,
+	0x64ae, 0x080c, 0x80ca, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x2011,
+	0x64ae, 0x080c, 0x8038, 0x080c, 0x6520, 0x01d8, 0x2001, 0x107e,
+	0x2004, 0x2058, 0xb900, 0xc1ec, 0xb902, 0x080c, 0x655e, 0x0130,
+	0x2009, 0x07d0, 0x2011, 0x64ae, 0x080c, 0x80ca, 0x00e6, 0x2071,
+	0x1800, 0x9006, 0x707a, 0x705c, 0x707e, 0x080c, 0x2dbb, 0x00ee,
+	0x04b0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c,
+	0x623e, 0x1538, 0xb800, 0xd0ec, 0x0520, 0x0046, 0xbaa0, 0x2220,
+	0x9006, 0x2009, 0x0029, 0x080c, 0xd52a, 0xb800, 0xc0e5, 0xc0ec,
+	0xb802, 0x080c, 0x655a, 0x2001, 0x0707, 0x1128, 0xb804, 0x9084,
+	0x00ff, 0x9085, 0x0700, 0xb806, 0x2019, 0x0029, 0x080c, 0x8571,
+	0x0076, 0x903e, 0x080c, 0x8469, 0x900e, 0x080c, 0xd29b, 0x007e,
+	0x004e, 0x001e, 0x8108, 0x1f04, 0x64d6, 0x00ce, 0x015e, 0x00be,
+	0x0005, 0x00b6, 0x6010, 0x2058, 0xb800, 0xc0ec, 0xb802, 0x00be,
+	0x0005, 0x7810, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ac, 0x0005,
+	0x6010, 0x00b6, 0x905d, 0x0108, 0xb800, 0x00be, 0xd0bc, 0x0005,
+	0x00b6, 0x00f6, 0x2001, 0x107e, 0x2004, 0x905d, 0x0110, 0xb800,
+	0xd0ec, 0x00fe, 0x00be, 0x0005, 0x0126, 0x0026, 0x2091, 0x8000,
+	0x0006, 0xbaa0, 0x9290, 0x1000, 0x2204, 0x9b06, 0x190c, 0x0db4,
+	0x000e, 0xba00, 0x9005, 0x0110, 0xc2fd, 0x0008, 0xc2fc, 0xba02,
+	0x002e, 0x012e, 0x0005, 0x2011, 0x1836, 0x2204, 0xd0cc, 0x0138,
+	0x2001, 0x1954, 0x200c, 0x2011, 0x6550, 0x080c, 0x80ca, 0x0005,
+	0x2011, 0x6550, 0x080c, 0x8038, 0x2011, 0x1836, 0x2204, 0xc0cc,
+	0x2012, 0x0005, 0x080c, 0x5386, 0xd0ac, 0x0005, 0x080c, 0x5386,
+	0xd0a4, 0x0005, 0x0016, 0xb904, 0x9184, 0x00ff, 0x908e, 0x0006,
+	0x001e, 0x0005, 0x0016, 0xb904, 0x9184, 0xff00, 0x8007, 0x908e,
+	0x0006, 0x001e, 0x0005, 0x00b6, 0x00f6, 0x080c, 0xc212, 0x0158,
+	0x70d8, 0x9084, 0x0028, 0x0138, 0x2001, 0x107f, 0x2004, 0x905d,
+	0x0110, 0xb8bc, 0xd094, 0x00fe, 0x00be, 0x0005, 0x0006, 0x0016,
+	0x0036, 0x0046, 0x0076, 0x00b6, 0x2001, 0x1817, 0x203c, 0x9780,
+	0x3138, 0x203d, 0x97bc, 0xff00, 0x873f, 0x9006, 0x2018, 0x2008,
+	0x9284, 0x8000, 0x0110, 0x2019, 0x0001, 0x9294, 0x7fff, 0x2100,
+	0x9706, 0x0190, 0x91a0, 0x1000, 0x2404, 0x905d, 0x0168, 0xb804,
+	0x9084, 0x00ff, 0x9086, 0x0006, 0x1138, 0x83ff, 0x0118, 0xb89c,
+	0xd0a4, 0x0110, 0x8211, 0x0158, 0x8108, 0x83ff, 0x0120, 0x9182,
+	0x0800, 0x0e28, 0x0068, 0x9182, 0x007e, 0x0e08, 0x0048, 0x00be,
+	0x007e, 0x004e, 0x003e, 0x001e, 0x9085, 0x0001, 0x000e, 0x0005,
+	0x00be, 0x007e, 0x004e, 0x003e, 0x001e, 0x9006, 0x000e, 0x0005,
+	0x0046, 0x0056, 0x0076, 0x00b6, 0x2100, 0x9084, 0x7fff, 0x9080,
+	0x1000, 0x2004, 0x905d, 0x0130, 0xb804, 0x9084, 0x00ff, 0x9086,
+	0x0006, 0x0550, 0x9184, 0x8000, 0x0580, 0x2001, 0x1817, 0x203c,
+	0x9780, 0x3138, 0x203d, 0x97bc, 0xff00, 0x873f, 0x9006, 0x2020,
+	0x2400, 0x9706, 0x01a0, 0x94a8, 0x1000, 0x2504, 0x905d, 0x0178,
+	0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1148, 0xb89c, 0xd0a4,
+	0x0130, 0xb814, 0x9206, 0x1118, 0xb810, 0x9306, 0x0128, 0x8420,
+	0x9482, 0x0800, 0x0e28, 0x0048, 0x918c, 0x7fff, 0x00be, 0x007e,
+	0x005e, 0x004e, 0x9085, 0x0001, 0x0005, 0x918c, 0x7fff, 0x00be,
+	0x007e, 0x005e, 0x004e, 0x9006, 0x0005, 0x2071, 0x1906, 0x7003,
+	0x0001, 0x7007, 0x0000, 0x9006, 0x7012, 0x7016, 0x701a, 0x701e,
+	0x700a, 0x7046, 0x2001, 0x1919, 0x2003, 0x0000, 0x0005, 0x0016,
+	0x00e6, 0x2071, 0x191a, 0x900e, 0x710a, 0x080c, 0x5386, 0xd0fc,
+	0x1140, 0x080c, 0x5386, 0x900e, 0xd09c, 0x0108, 0x8108, 0x7102,
+	0x0400, 0x2001, 0x1873, 0x200c, 0x9184, 0x0007, 0x9006, 0x0002,
+	0x6639, 0x6639, 0x6639, 0x6639, 0x6639, 0x6650, 0x665e, 0x6639,
+	0x7003, 0x0003, 0x2009, 0x1874, 0x210c, 0x9184, 0xff00, 0x8007,
+	0x9005, 0x1110, 0x2001, 0x0002, 0x7006, 0x0018, 0x7003, 0x0005,
+	0x0c88, 0x00ee, 0x001e, 0x0005, 0x00e6, 0x2071, 0x0050, 0x684c,
+	0x9005, 0x1150, 0x00e6, 0x2071, 0x1906, 0x7028, 0xc085, 0x702a,
+	0x00ee, 0x9085, 0x0001, 0x0488, 0x6844, 0x9005, 0x0158, 0x080c,
+	0x7308, 0x6a60, 0x9200, 0x7002, 0x6864, 0x9101, 0x7006, 0x9006,
+	0x7012, 0x7016, 0x6860, 0x7002, 0x6864, 0x7006, 0x6868, 0x700a,
+	0x686c, 0x700e, 0x6844, 0x9005, 0x1110, 0x7012, 0x7016, 0x684c,
+	0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x7037, 0x0019, 0x702b,
+	0x0001, 0x00e6, 0x2071, 0x1906, 0x7028, 0xc084, 0x702a, 0x7007,
+	0x0001, 0x700b, 0x0000, 0x00ee, 0x9006, 0x00ee, 0x0005, 0xa868,
+	0xd0fc, 0x11d8, 0x00e6, 0x0026, 0x2001, 0x191a, 0x2004, 0x9005,
+	0x0904, 0x6891, 0xa87c, 0xd0bc, 0x1904, 0x6891, 0xa978, 0xa874,
+	0x9105, 0x1904, 0x6891, 0x2001, 0x191a, 0x2004, 0x0002, 0x6891,
+	0x66ea, 0x6726, 0x6726, 0x6891, 0x6726, 0x0005, 0xa868, 0xd0fc,
+	0x1500, 0x00e6, 0x0026, 0x2009, 0x191a, 0x210c, 0x81ff, 0x0904,
+	0x6891, 0xa87c, 0xd0cc, 0x0904, 0x6891, 0xa880, 0x9084, 0x00ff,
+	0x9086, 0x0001, 0x1904, 0x6891, 0x9186, 0x0003, 0x0904, 0x6726,
+	0x9186, 0x0005, 0x0904, 0x6726, 0xa84f, 0x8021, 0xa853, 0x0017,
+	0x0028, 0x0005, 0xa84f, 0x8020, 0xa853, 0x0016, 0x2071, 0x1906,
+	0x701c, 0x9005, 0x1904, 0x6a51, 0x0e04, 0x6a9c, 0x2071, 0x0000,
+	0xa84c, 0x7082, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870,
+	0x708a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
+	0x1187, 0x2071, 0x1800, 0x2011, 0x0001, 0xa804, 0x900d, 0x702c,
+	0x1158, 0xa802, 0x2900, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c,
+	0x7f5d, 0x002e, 0x00ee, 0x0005, 0x0096, 0x2148, 0xa904, 0xa802,
+	0x8210, 0x2900, 0x81ff, 0x1dc8, 0x009e, 0x0c58, 0xa84f, 0x0000,
+	0x00f6, 0x2079, 0x0050, 0x2071, 0x1906, 0xa803, 0x0000, 0x7010,
+	0x9005, 0x1904, 0x6815, 0x782c, 0x908c, 0x0780, 0x190c, 0x6bc3,
+	0x8004, 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x6744, 0x6815,
+	0x6769, 0x67b0, 0x080c, 0x0db4, 0x2071, 0x1800, 0x2900, 0x7822,
 	0xa804, 0x900d, 0x1170, 0x2071, 0x19cb, 0x703c, 0x9005, 0x1328,
 	0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee,
-	0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802,
-	0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be,
-	0x080c, 0x7f35, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2908, 0x7010,
-	0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008,
-	0x711e, 0x2148, 0xa804, 0x900d, 0x1904, 0x6863, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x6bbc, 0xd09c, 0x1198, 0x701c, 0x904d, 0x0180,
-	0x7010, 0x8001, 0x7012, 0x1108, 0x701a, 0xa800, 0x701e, 0x2900,
-	0x7822, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd09c, 0x0d68,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd0a4, 0x01b0, 0x00e6,
-	0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e,
-	0x70bc, 0x8000, 0x70be, 0x080c, 0x7f35, 0x782c, 0x9094, 0x0780,
-	0x190c, 0x6bbc, 0xd0a4, 0x1d60, 0x00ee, 0x2071, 0x19cb, 0x703c,
-	0x9005, 0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe,
-	0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800, 0x9016, 0x702c,
-	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70bc, 0x9200, 0x70be, 0x080c, 0x7f35, 0x00ee, 0x0804, 0x681e,
-	0xa868, 0xd0fc, 0x1904, 0x68c6, 0x0096, 0xa804, 0xa807, 0x0000,
-	0x904d, 0x190c, 0x0f9d, 0x009e, 0x0018, 0xa868, 0xd0fc, 0x15f0,
-	0x00e6, 0x0026, 0xa84f, 0x0000, 0x00f6, 0x2079, 0x0050, 0x2071,
-	0x1800, 0x70e8, 0x8001, 0x01d0, 0x1678, 0x2071, 0x1906, 0xa803,
-	0x0000, 0x7010, 0x9005, 0x1904, 0x69c4, 0x782c, 0x908c, 0x0780,
-	0x190c, 0x6bbc, 0x8004, 0x8004, 0x8004, 0x9084, 0x0003, 0x0002,
-	0x68c7, 0x69c4, 0x68e2, 0x6953, 0x080c, 0x0db4, 0x70eb, 0x0fa0,
-	0x71e4, 0x8107, 0x9106, 0x9094, 0x00c0, 0x9184, 0xff3f, 0x9205,
-	0x70e6, 0x3b08, 0x3a00, 0x9104, 0x918d, 0x00c0, 0x21d8, 0x9084,
-	0xff3f, 0x9205, 0x20d0, 0x0888, 0x70ea, 0x0878, 0x0005, 0x2071,
-	0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1120, 0x00fe, 0x002e,
-	0x00ee, 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
-	0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c,
-	0x7f35, 0x0c60, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d,
-	0x1904, 0x6942, 0x7830, 0x8007, 0x9084, 0x001f, 0x9082, 0x0005,
-	0x1220, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7824, 0x00e6, 0x2071,
-	0x0040, 0x712c, 0xd19c, 0x1148, 0x2009, 0x182f, 0x210c, 0x918a,
-	0x0040, 0x0218, 0x7022, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c,
-	0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x7f35,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd0a4, 0x19f0, 0x0e04,
-	0x6939, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000,
-	0x6836, 0x6833, 0x0013, 0x00de, 0x2001, 0x1917, 0x200c, 0xc184,
-	0x2102, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
-	0x1187, 0x2009, 0x1919, 0x200b, 0x0000, 0x00fe, 0x002e, 0x00ee,
-	0x0005, 0x2001, 0x1917, 0x200c, 0xc185, 0x2102, 0x00fe, 0x002e,
-	0x00ee, 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
+	0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
+	0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f5d,
+	0x0c10, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1580,
+	0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1148, 0x2009,
+	0x182f, 0x210c, 0x918a, 0x0040, 0x0218, 0x7022, 0x00ee, 0x0058,
+	0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000,
+	0x70be, 0x080c, 0x7f5d, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bc3,
+	0xd0a4, 0x19f0, 0x2071, 0x19cb, 0x703c, 0x9005, 0x1328, 0x2001,
+	0x191b, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005,
+	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
+	0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f5d, 0x0800,
+	0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802,
+	0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x7f5d, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x6bc3, 0xd0a4, 0x1d60, 0x00ee, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x6bc3, 0xd09c, 0x11a0, 0x009e, 0x2900,
+	0x7822, 0xa804, 0x900d, 0x1560, 0x2071, 0x19cb, 0x703c, 0x9005,
+	0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e,
+	0x00ee, 0x0005, 0x009e, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018,
+	0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804,
+	0x900d, 0x1170, 0x2071, 0x19cb, 0x703c, 0x9005, 0x1328, 0x2001,
+	0x191b, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005,
+	0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
 	0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c,
-	0x7f35, 0x0804, 0x68f5, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071,
-	0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be,
-	0x080c, 0x7f35, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd0a4,
-	0x1d60, 0x00ee, 0x0e04, 0x6997, 0x7838, 0x7938, 0x910e, 0x1de0,
-	0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044,
-	0xc084, 0x7046, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-	0x190c, 0x1187, 0x2009, 0x1919, 0x200b, 0x0000, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x6bbc, 0xd09c, 0x1170, 0x009e, 0x2900, 0x7822,
-	0xa804, 0x900d, 0x11e0, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044,
-	0xc085, 0x7046, 0x0c58, 0x009e, 0x2908, 0x7010, 0x8000, 0x7012,
-	0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148,
-	0xa804, 0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071,
-	0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-	0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f35,
-	0x00fe, 0x002e, 0x00ee, 0x0005, 0x2908, 0x7010, 0x8000, 0x7012,
-	0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148,
-	0xa804, 0x900d, 0x1904, 0x6a35, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x6bbc, 0xd09c, 0x11b0, 0x701c, 0x904d, 0x0198, 0xa84c, 0x9005,
-	0x1180, 0x7010, 0x8001, 0x7012, 0x1108, 0x701a, 0xa800, 0x701e,
-	0x2900, 0x7822, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd09c,
-	0x0d50, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd0a4, 0x05c8,
-	0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900,
-	0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x7f35, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x6bbc, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x6a2e,
+	0x7f5d, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2908, 0x7010, 0x8000,
+	0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e,
+	0x2148, 0xa804, 0x900d, 0x1904, 0x686a, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6bc3, 0xd09c, 0x1198, 0x701c, 0x904d, 0x0180, 0x7010,
+	0x8001, 0x7012, 0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x6bc3, 0xd09c, 0x0d68, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x6bc3, 0xd0a4, 0x01b0, 0x00e6, 0x7824,
+	0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc,
+	0x8000, 0x70be, 0x080c, 0x7f5d, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x6bc3, 0xd0a4, 0x1d60, 0x00ee, 0x2071, 0x19cb, 0x703c, 0x9005,
+	0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e,
+	0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148,
+	0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc,
+	0x9200, 0x70be, 0x080c, 0x7f5d, 0x00ee, 0x0804, 0x6825, 0xa868,
+	0xd0fc, 0x1904, 0x68cd, 0x0096, 0xa804, 0xa807, 0x0000, 0x904d,
+	0x190c, 0x0f9d, 0x009e, 0x0018, 0xa868, 0xd0fc, 0x15f0, 0x00e6,
+	0x0026, 0xa84f, 0x0000, 0x00f6, 0x2079, 0x0050, 0x2071, 0x1800,
+	0x70e8, 0x8001, 0x01d0, 0x1678, 0x2071, 0x1906, 0xa803, 0x0000,
+	0x7010, 0x9005, 0x1904, 0x69cb, 0x782c, 0x908c, 0x0780, 0x190c,
+	0x6bc3, 0x8004, 0x8004, 0x8004, 0x9084, 0x0003, 0x0002, 0x68ce,
+	0x69cb, 0x68e9, 0x695a, 0x080c, 0x0db4, 0x70eb, 0x0fa0, 0x71e4,
+	0x8107, 0x9106, 0x9094, 0x00c0, 0x9184, 0xff3f, 0x9205, 0x70e6,
+	0x3b08, 0x3a00, 0x9104, 0x918d, 0x00c0, 0x21d8, 0x9084, 0xff3f,
+	0x9205, 0x20d0, 0x0888, 0x70ea, 0x0878, 0x0005, 0x2071, 0x1800,
+	0x2900, 0x7822, 0xa804, 0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee,
+	0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
+	0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f5d,
+	0x0c60, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1904,
+	0x6949, 0x7830, 0x8007, 0x9084, 0x001f, 0x9082, 0x0005, 0x1220,
+	0x00fe, 0x002e, 0x00ee, 0x0005, 0x7824, 0x00e6, 0x2071, 0x0040,
+	0x712c, 0xd19c, 0x1148, 0x2009, 0x182f, 0x210c, 0x918a, 0x0040,
+	0x0218, 0x7022, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802,
+	0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x7f5d, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x6bc3, 0xd0a4, 0x19f0, 0x0e04, 0x6940,
 	0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836,
-	0x6833, 0x0013, 0x00de, 0x7044, 0xc084, 0x7046, 0x2091, 0x4080,
-	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x2009, 0x1919,
-	0x200b, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085,
-	0x7046, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800,
+	0x6833, 0x0013, 0x00de, 0x2001, 0x1917, 0x200c, 0xc184, 0x2102,
+	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187,
+	0x2009, 0x1919, 0x200b, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005,
+	0x2001, 0x1917, 0x200c, 0xc185, 0x2102, 0x00fe, 0x002e, 0x00ee,
+	0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
+	0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f5d,
+	0x0804, 0x68fc, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800,
+	0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c,
+	0x7f5d, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bc3, 0xd0a4, 0x1d60,
+	0x00ee, 0x0e04, 0x699e, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6,
+	0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044, 0xc084,
+	0x7046, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
+	0x1187, 0x2009, 0x1919, 0x200b, 0x0000, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6bc3, 0xd09c, 0x1170, 0x009e, 0x2900, 0x7822, 0xa804,
+	0x900d, 0x11e0, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085,
+	0x7046, 0x0c58, 0x009e, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018,
+	0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804,
+	0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800,
 	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
-	0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f35, 0x00ee,
-	0x0804, 0x69d4, 0x2071, 0x1906, 0xa803, 0x0000, 0x2908, 0x7010,
-	0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008,
-	0x711e, 0x2148, 0xa804, 0x900d, 0x1128, 0x1e04, 0x6a75, 0x002e,
+	0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f5d, 0x00fe,
+	0x002e, 0x00ee, 0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018,
+	0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804,
+	0x900d, 0x1904, 0x6a3c, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bc3,
+	0xd09c, 0x11b0, 0x701c, 0x904d, 0x0198, 0xa84c, 0x9005, 0x1180,
+	0x7010, 0x8001, 0x7012, 0x1108, 0x701a, 0xa800, 0x701e, 0x2900,
+	0x7822, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bc3, 0xd09c, 0x0d50,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x6bc3, 0xd0a4, 0x05c8, 0x00e6,
+	0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e,
+	0x70bc, 0x8000, 0x70be, 0x080c, 0x7f5d, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6bc3, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x6a35, 0x7838,
+	0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833,
+	0x0013, 0x00de, 0x7044, 0xc084, 0x7046, 0x2091, 0x4080, 0x2001,
+	0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x2009, 0x1919, 0x200b,
+	0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046,
+	0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800, 0x9016,
+	0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
+	0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x7f5d, 0x00ee, 0x0804,
+	0x69db, 0x2071, 0x1906, 0xa803, 0x0000, 0x2908, 0x7010, 0x8000,
+	0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e,
+	0x2148, 0xa804, 0x900d, 0x1128, 0x1e04, 0x6a7c, 0x002e, 0x00ee,
+	0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802,
+	0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be,
+	0x080c, 0x7f5d, 0x0e04, 0x6a66, 0x2071, 0x1906, 0x701c, 0x2048,
+	0xa84c, 0x900d, 0x0d18, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032,
+	0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0x2091, 0x4080, 0x2001,
+	0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x2071, 0x1906, 0x080c,
+	0x6baf, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1906, 0xa803, 0x0000,
+	0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
+	0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1118, 0x002e,
 	0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904,
 	0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200,
-	0x70be, 0x080c, 0x7f35, 0x0e04, 0x6a5f, 0x2071, 0x1906, 0x701c,
-	0x2048, 0xa84c, 0x900d, 0x0d18, 0x2071, 0x0000, 0x7182, 0xa850,
-	0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0x2091, 0x4080,
-	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x2071, 0x1906,
-	0x080c, 0x6ba8, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1906, 0xa803,
-	0x0000, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a,
-	0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1118,
-	0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148,
-	0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc,
-	0x9200, 0x70be, 0x080c, 0x7f35, 0x002e, 0x00ee, 0x0005, 0x0006,
-	0xa87c, 0x0006, 0xa867, 0x0103, 0x20a9, 0x001c, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x001d, 0x20a0, 0x9006, 0x4004, 0x000e, 0x9084,
-	0x00ff, 0xa87e, 0x000e, 0xa87a, 0xa982, 0x0005, 0x2071, 0x1906,
-	0x7004, 0x0002, 0x6ae0, 0x6ae1, 0x6ba7, 0x6ae1, 0x0db4, 0x6ba7,
-	0x0005, 0x2001, 0x191a, 0x2004, 0x0002, 0x6aeb, 0x6aeb, 0x6b40,
-	0x6b41, 0x6aeb, 0x6b41, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x6bc7,
-	0x701c, 0x904d, 0x01e0, 0xa84c, 0x9005, 0x01d8, 0x0e04, 0x6b0f,
-	0xa94c, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c, 0x7086,
-	0x7036, 0xa870, 0x708a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-	0xd084, 0x190c, 0x1187, 0x2071, 0x1906, 0x080c, 0x6ba8, 0x012e,
-	0x0470, 0x2001, 0x005b, 0x2004, 0x9094, 0x0780, 0x190c, 0x6bbc,
-	0xd09c, 0x2071, 0x1906, 0x1510, 0x2071, 0x1906, 0x700f, 0x0001,
+	0x70be, 0x080c, 0x7f5d, 0x002e, 0x00ee, 0x0005, 0x0006, 0xa87c,
+	0x0006, 0xa867, 0x0103, 0x20a9, 0x001c, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x001d, 0x20a0, 0x9006, 0x4004, 0x000e, 0x9084, 0x00ff,
+	0xa87e, 0x000e, 0xa87a, 0xa982, 0x0005, 0x2071, 0x1906, 0x7004,
+	0x0002, 0x6ae7, 0x6ae8, 0x6bae, 0x6ae8, 0x0db4, 0x6bae, 0x0005,
+	0x2001, 0x191a, 0x2004, 0x0002, 0x6af2, 0x6af2, 0x6b47, 0x6b48,
+	0x6af2, 0x6b48, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x6bce, 0x701c,
+	0x904d, 0x01e0, 0xa84c, 0x9005, 0x01d8, 0x0e04, 0x6b16, 0xa94c,
+	0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036,
+	0xa870, 0x708a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
+	0x190c, 0x1187, 0x2071, 0x1906, 0x080c, 0x6baf, 0x012e, 0x0470,
+	0x2001, 0x005b, 0x2004, 0x9094, 0x0780, 0x190c, 0x6bc3, 0xd09c,
+	0x2071, 0x1906, 0x1510, 0x2071, 0x1906, 0x700f, 0x0001, 0xa964,
+	0x9184, 0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff,
+	0x8101, 0x0108, 0x710e, 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822,
+	0x00de, 0x2071, 0x1906, 0x701c, 0x2048, 0x7010, 0x8001, 0x7012,
+	0xa800, 0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x0005, 0x0005,
+	0x00d6, 0x2008, 0x2069, 0x19cb, 0x683c, 0x9005, 0x0760, 0x0158,
+	0x9186, 0x0003, 0x0540, 0x2001, 0x1814, 0x2004, 0x2009, 0x1a98,
+	0x210c, 0x9102, 0x1500, 0x0126, 0x2091, 0x8000, 0x2069, 0x0050,
+	0x693c, 0x6838, 0x9106, 0x0190, 0x0e04, 0x6b7a, 0x2069, 0x0000,
+	0x6837, 0x8040, 0x6833, 0x0012, 0x6883, 0x8040, 0x2091, 0x4080,
+	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x2069, 0x19cb,
+	0x683f, 0xffff, 0x012e, 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c,
+	0x6c3f, 0x701c, 0x904d, 0x0540, 0x2001, 0x005b, 0x2004, 0x9094,
+	0x0780, 0x15c9, 0xd09c, 0x1500, 0x2071, 0x1906, 0x700f, 0x0001,
 	0xa964, 0x9184, 0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c,
 	0x00ff, 0x8101, 0x0108, 0x710e, 0x2900, 0x00d6, 0x2069, 0x0050,
-	0x6822, 0x00de, 0x2071, 0x1906, 0x701c, 0x2048, 0x7010, 0x8001,
-	0x7012, 0xa800, 0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x0005,
-	0x0005, 0x00d6, 0x2008, 0x2069, 0x19cb, 0x683c, 0x9005, 0x0760,
-	0x0158, 0x9186, 0x0003, 0x0540, 0x2001, 0x1814, 0x2004, 0x2009,
-	0x1a98, 0x210c, 0x9102, 0x1500, 0x0126, 0x2091, 0x8000, 0x2069,
-	0x0050, 0x693c, 0x6838, 0x9106, 0x0190, 0x0e04, 0x6b73, 0x2069,
-	0x0000, 0x6837, 0x8040, 0x6833, 0x0012, 0x6883, 0x8040, 0x2091,
-	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x2069,
-	0x19cb, 0x683f, 0xffff, 0x012e, 0x00de, 0x0126, 0x2091, 0x8000,
-	0x1e0c, 0x6c38, 0x701c, 0x904d, 0x0540, 0x2001, 0x005b, 0x2004,
-	0x9094, 0x0780, 0x15c9, 0xd09c, 0x1500, 0x2071, 0x1906, 0x700f,
-	0x0001, 0xa964, 0x9184, 0x00ff, 0x9086, 0x0003, 0x1130, 0x810f,
-	0x918c, 0x00ff, 0x8101, 0x0108, 0x710e, 0x2900, 0x00d6, 0x2069,
-	0x0050, 0x6822, 0x00de, 0x701c, 0x2048, 0x7010, 0x8001, 0x7012,
-	0xa800, 0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x0005, 0x0005,
-	0x0126, 0x2091, 0x8000, 0x701c, 0x904d, 0x0160, 0x7010, 0x8001,
-	0x7012, 0xa800, 0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x080c,
-	0x101d, 0x0005, 0x012e, 0x0005, 0x2091, 0x8000, 0x0e04, 0x6bbe,
-	0x0006, 0x0016, 0x2001, 0x8004, 0x0006, 0x0804, 0x0dbd, 0x0096,
-	0x00f6, 0x2079, 0x0050, 0x7044, 0xd084, 0x01e0, 0xc084, 0x7046,
-	0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836,
-	0x6833, 0x0013, 0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-	0xd084, 0x190c, 0x1187, 0x2009, 0x1919, 0x200b, 0x0000, 0x00fe,
-	0x009e, 0x0005, 0x782c, 0x9094, 0x0780, 0x1971, 0xd0a4, 0x0db8,
-	0x2009, 0x1919, 0x2104, 0x8000, 0x200a, 0x9082, 0x000f, 0x0e78,
-	0x00e6, 0x2071, 0x1800, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c,
-	0xd19c, 0x1148, 0x2009, 0x182f, 0x210c, 0x918a, 0x0040, 0x0218,
-	0x7022, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900,
-	0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x7f35, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x6bbc, 0xd0a4, 0x19f0, 0x7838, 0x7938, 0x910e,
-	0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de,
-	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187,
-	0x2009, 0x1919, 0x200b, 0x0000, 0x00ee, 0x00fe, 0x009e, 0x0005,
-	0x00f6, 0x2079, 0x0050, 0x7044, 0xd084, 0x01b8, 0xc084, 0x7046,
-	0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836,
-	0x6833, 0x0013, 0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-	0xd084, 0x190c, 0x1187, 0x00fe, 0x0005, 0x782c, 0x9094, 0x0780,
-	0x190c, 0x6bbc, 0xd0a4, 0x0db8, 0x00e6, 0x2071, 0x1800, 0x7824,
-	0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be,
-	0x080c, 0x7f35, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bbc, 0xd0a4,
-	0x1d70, 0x00d6, 0x2069, 0x0050, 0x693c, 0x2069, 0x191a, 0x6808,
-	0x690a, 0x2069, 0x19cb, 0x9102, 0x1118, 0x683c, 0x9005, 0x1328,
-	0x2001, 0x191b, 0x200c, 0x810d, 0x693e, 0x00de, 0x00ee, 0x00fe,
-	0x0005, 0x7094, 0x908a, 0x0029, 0x1a0c, 0x0db4, 0x9082, 0x001d,
-	0x001b, 0x6027, 0x1e00, 0x0005, 0x6d5c, 0x6ce6, 0x6d02, 0x6d2a,
-	0x6d4b, 0x6d8b, 0x6d9d, 0x6d02, 0x6d73, 0x6ca1, 0x6ccf, 0x6ca0,
-	0x0005, 0x00d6, 0x2069, 0x0200, 0x6804, 0x9005, 0x1180, 0x6808,
-	0x9005, 0x1518, 0x7097, 0x0028, 0x2069, 0x1960, 0x2d04, 0x7002,
-	0x080c, 0x70e0, 0x6028, 0x9085, 0x0600, 0x602a, 0x00b0, 0x7097,
-	0x0028, 0x2069, 0x1960, 0x2d04, 0x7002, 0x6028, 0x9085, 0x0600,
-	0x602a, 0x00e6, 0x0036, 0x0046, 0x0056, 0x2071, 0x1a33, 0x080c,
-	0x1958, 0x005e, 0x004e, 0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6,
-	0x2069, 0x0200, 0x6804, 0x9005, 0x1178, 0x6808, 0x9005, 0x1160,
-	0x7097, 0x0028, 0x2069, 0x1960, 0x2d04, 0x7002, 0x080c, 0x717a,
-	0x6028, 0x9085, 0x0600, 0x602a, 0x00de, 0x0005, 0x0006, 0x2001,
-	0x0090, 0x080c, 0x2b14, 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c,
-	0x6e0a, 0xd1d4, 0x1160, 0xd1dc, 0x1138, 0xd1cc, 0x0150, 0x7097,
-	0x0020, 0x080c, 0x6e0a, 0x0028, 0x7097, 0x001d, 0x0010, 0x7097,
-	0x001f, 0x0005, 0x2001, 0x0088, 0x080c, 0x2b14, 0x6124, 0xd1cc,
-	0x11d8, 0xd1dc, 0x11b0, 0xd1e4, 0x1188, 0x9184, 0x1e00, 0x11c8,
-	0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x6fd3, 0x2001,
-	0x0080, 0x080c, 0x2b14, 0x7097, 0x0028, 0x0058, 0x7097, 0x001e,
-	0x0040, 0x7097, 0x001d, 0x0028, 0x7097, 0x0020, 0x0010, 0x7097,
-	0x001f, 0x0005, 0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c,
-	0x6fd3, 0x2001, 0x0080, 0x080c, 0x2b14, 0x6124, 0xd1d4, 0x1180,
-	0xd1dc, 0x1158, 0xd1e4, 0x1130, 0x9184, 0x1e00, 0x1158, 0x7097,
-	0x0028, 0x0040, 0x7097, 0x001e, 0x0028, 0x7097, 0x001d, 0x0010,
-	0x7097, 0x001f, 0x0005, 0x2001, 0x00a0, 0x080c, 0x2b14, 0x6124,
-	0xd1dc, 0x1138, 0xd1e4, 0x0138, 0x080c, 0x1982, 0x7097, 0x001e,
-	0x0010, 0x7097, 0x001d, 0x0005, 0x080c, 0x6e8d, 0x6124, 0xd1dc,
-	0x1188, 0x080c, 0x6e0a, 0x0016, 0x080c, 0x1982, 0x001e, 0xd1d4,
-	0x1128, 0xd1e4, 0x0138, 0x7097, 0x001e, 0x0020, 0x7097, 0x001f,
-	0x080c, 0x6e0a, 0x0005, 0x0006, 0x2001, 0x00a0, 0x080c, 0x2b14,
-	0x000e, 0x6124, 0xd1d4, 0x1160, 0xd1cc, 0x1150, 0xd1dc, 0x1128,
-	0xd1e4, 0x0140, 0x7097, 0x001e, 0x0028, 0x7097, 0x001d, 0x0010,
-	0x7097, 0x0021, 0x0005, 0x080c, 0x6e8d, 0x6124, 0xd1d4, 0x1150,
-	0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x7097, 0x001e, 0x0028, 0x7097,
-	0x001d, 0x0010, 0x7097, 0x001f, 0x0005, 0x0006, 0x2001, 0x0090,
-	0x080c, 0x2b14, 0x000e, 0x6124, 0xd1d4, 0x1178, 0xd1cc, 0x1150,
-	0xd1dc, 0x1128, 0xd1e4, 0x0158, 0x7097, 0x001e, 0x0040, 0x7097,
-	0x001d, 0x0028, 0x7097, 0x0020, 0x0010, 0x7097, 0x001f, 0x0005,
-	0x0016, 0x00c6, 0x00d6, 0x00e6, 0x0126, 0x2061, 0x0100, 0x2069,
-	0x0140, 0x2071, 0x1800, 0x2091, 0x8000, 0x080c, 0x6fa7, 0x11d8,
-	0x2001, 0x180c, 0x200c, 0xd1b4, 0x01b0, 0xc1b4, 0x2102, 0x6027,
-	0x0200, 0x080c, 0x2a5d, 0x6024, 0xd0cc, 0x0148, 0x2001, 0x00a0,
-	0x080c, 0x2b14, 0x080c, 0x728b, 0x080c, 0x5cca, 0x0428, 0x6028,
-	0xc0cd, 0x602a, 0x0408, 0x080c, 0x6fc1, 0x0150, 0x080c, 0x6fb8,
-	0x1138, 0x2001, 0x0001, 0x080c, 0x260c, 0x080c, 0x6f7f, 0x00a0,
-	0x080c, 0x6e8a, 0x0178, 0x2001, 0x0001, 0x080c, 0x260c, 0x7094,
-	0x9086, 0x001e, 0x0120, 0x7094, 0x9086, 0x0022, 0x1118, 0x7097,
-	0x0025, 0x0010, 0x7097, 0x0021, 0x012e, 0x00ee, 0x00de, 0x00ce,
-	0x001e, 0x0005, 0x0026, 0x2011, 0x6e1b, 0x080c, 0x80e4, 0x002e,
-	0x0016, 0x0026, 0x2009, 0x0064, 0x2011, 0x6e1b, 0x080c, 0x80db,
-	0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6, 0x0016, 0x080c, 0x9393,
-	0x2071, 0x1800, 0x080c, 0x6db8, 0x001e, 0x00fe, 0x00ee, 0x0005,
-	0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0126,
-	0x080c, 0x9393, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800,
-	0x2091, 0x8000, 0x6028, 0xc09c, 0x602a, 0x2011, 0x0003, 0x080c,
-	0x9758, 0x2011, 0x0002, 0x080c, 0x9762, 0x080c, 0x9649, 0x080c,
-	0x8090, 0x0036, 0x901e, 0x080c, 0x96bf, 0x003e, 0x60e3, 0x0000,
-	0x080c, 0xd894, 0x080c, 0xd8af, 0x2009, 0x0004, 0x080c, 0x2a63,
-	0x080c, 0x297e, 0x2001, 0x1800, 0x2003, 0x0004, 0x6027, 0x0008,
-	0x2011, 0x6e1b, 0x080c, 0x80e4, 0x080c, 0x6fc1, 0x0118, 0x9006,
-	0x080c, 0x2b14, 0x080c, 0x0b8f, 0x2001, 0x0001, 0x080c, 0x260c,
-	0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
-	0x0005, 0x0026, 0x00e6, 0x2011, 0x6e28, 0x2071, 0x19cb, 0x701c,
-	0x9206, 0x1118, 0x7018, 0x9005, 0x0110, 0x9085, 0x0001, 0x00ee,
-	0x002e, 0x0005, 0x6020, 0xd09c, 0x0005, 0x6800, 0x9084, 0xfffe,
-	0x9086, 0x00c0, 0x01b8, 0x2001, 0x00c0, 0x080c, 0x2b14, 0x0156,
-	0x20a9, 0x002d, 0x1d04, 0x6e9a, 0x2091, 0x6000, 0x1f04, 0x6e9a,
-	0x015e, 0x00d6, 0x2069, 0x1800, 0x6898, 0x8001, 0x0220, 0x0118,
-	0x689a, 0x00de, 0x0005, 0x689b, 0x0014, 0x68e4, 0xd0dc, 0x0dc8,
-	0x6800, 0x9086, 0x0001, 0x1da8, 0x080c, 0x80f0, 0x0c90, 0x00c6,
-	0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800,
-	0x080c, 0x729a, 0x2001, 0x193e, 0x2003, 0x0000, 0x9006, 0x7096,
-	0x60e2, 0x6886, 0x080c, 0x26d7, 0x9006, 0x080c, 0x2b14, 0x080c,
-	0x5b89, 0x6027, 0xffff, 0x602b, 0x182f, 0x00ee, 0x00de, 0x00ce,
-	0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140,
-	0x2071, 0x1800, 0x2001, 0x194e, 0x200c, 0x9186, 0x0000, 0x0158,
-	0x9186, 0x0001, 0x0158, 0x9186, 0x0002, 0x0158, 0x9186, 0x0003,
-	0x0158, 0x0804, 0x6f6f, 0x7097, 0x0022, 0x0040, 0x7097, 0x0021,
-	0x0028, 0x7097, 0x0023, 0x0010, 0x7097, 0x0024, 0x60e3, 0x0000,
-	0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x26d7, 0x0026, 0x080c,
-	0x9d9f, 0x002e, 0x7000, 0x908e, 0x0004, 0x0118, 0x602b, 0x0028,
-	0x0010, 0x602b, 0x0020, 0x0156, 0x0126, 0x2091, 0x8000, 0x20a9,
-	0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e, 0x015e, 0x080c, 0xc1f9,
-	0x0118, 0x9006, 0x080c, 0x2b3e, 0x0804, 0x6f7b, 0x6800, 0x9084,
-	0x00a1, 0xc0bd, 0x6802, 0x080c, 0x2a5d, 0x6904, 0xd1d4, 0x1140,
-	0x2001, 0x0100, 0x080c, 0x2b14, 0x1f04, 0x6f19, 0x080c, 0x6ffe,
-	0x012e, 0x015e, 0x080c, 0x6fb8, 0x01a8, 0x6044, 0x9005, 0x0168,
-	0x6050, 0x0006, 0x9085, 0x0020, 0x6052, 0x080c, 0x6ffe, 0x9006,
-	0x8001, 0x1df0, 0x000e, 0x6052, 0x0028, 0x6804, 0xd0d4, 0x1110,
-	0x080c, 0x6ffe, 0x080c, 0xc1f9, 0x0118, 0x9006, 0x080c, 0x2b3e,
-	0x0016, 0x0026, 0x7000, 0x908e, 0x0004, 0x0130, 0x2009, 0x00c8,
-	0x2011, 0x6e28, 0x080c, 0x80a2, 0x002e, 0x001e, 0x080c, 0x7f2c,
-	0x7034, 0xc085, 0x7036, 0x2001, 0x194e, 0x2003, 0x0004, 0x080c,
-	0x6c89, 0x080c, 0x6fb8, 0x0138, 0x6804, 0xd0d4, 0x1120, 0xd0dc,
-	0x1100, 0x080c, 0x7290, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6,
-	0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800,
-	0x080c, 0x7f43, 0x080c, 0x7f35, 0x080c, 0x729a, 0x2001, 0x193e,
-	0x2003, 0x0000, 0x9006, 0x7096, 0x60e2, 0x6886, 0x080c, 0x26d7,
-	0x9006, 0x080c, 0x2b14, 0x6043, 0x0090, 0x6043, 0x0010, 0x6027,
-	0xffff, 0x602b, 0x182f, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x0006,
-	0x2001, 0x194d, 0x2004, 0x9086, 0xaaaa, 0x000e, 0x0005, 0x0006,
-	0x080c, 0x5383, 0x9084, 0x0030, 0x9086, 0x0000, 0x000e, 0x0005,
-	0x0006, 0x080c, 0x5383, 0x9084, 0x0030, 0x9086, 0x0030, 0x000e,
-	0x0005, 0x0006, 0x080c, 0x5383, 0x9084, 0x0030, 0x9086, 0x0010,
-	0x000e, 0x0005, 0x0006, 0x080c, 0x5383, 0x9084, 0x0030, 0x9086,
-	0x0020, 0x000e, 0x0005, 0x0036, 0x0016, 0x2001, 0x180c, 0x2004,
-	0x908c, 0x0013, 0x0180, 0x0020, 0x080c, 0x26f7, 0x900e, 0x0028,
-	0x080c, 0x6553, 0x1dc8, 0x2009, 0x0002, 0x2019, 0x0028, 0x080c,
-	0x2fa2, 0x9006, 0x0019, 0x001e, 0x003e, 0x0005, 0x00e6, 0x2071,
-	0x180c, 0x2e04, 0x0130, 0x080c, 0xc1f2, 0x1128, 0x9085, 0x0010,
-	0x0010, 0x9084, 0xffef, 0x2072, 0x00ee, 0x0005, 0x6050, 0x0006,
-	0x60ec, 0x0006, 0x600c, 0x0006, 0x6004, 0x0006, 0x6028, 0x0006,
-	0x0016, 0x6138, 0x6050, 0x9084, 0xfbff, 0x9085, 0x2000, 0x6052,
-	0x613a, 0x20a9, 0x0012, 0x1d04, 0x7013, 0x2091, 0x6000, 0x1f04,
-	0x7013, 0x602f, 0x0100, 0x602f, 0x0000, 0x6050, 0x9085, 0x0400,
-	0x9084, 0xdfff, 0x6052, 0x613a, 0x001e, 0x602f, 0x0040, 0x602f,
-	0x0000, 0x000e, 0x602a, 0x000e, 0x6006, 0x000e, 0x600e, 0x000e,
-	0x60ee, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c,
-	0x26d7, 0x2001, 0x00a0, 0x0006, 0x080c, 0xc1f9, 0x000e, 0x0130,
-	0x080c, 0x2b32, 0x9006, 0x080c, 0x2b3e, 0x0010, 0x080c, 0x2b14,
-	0x000e, 0x6052, 0x6050, 0x0006, 0xc0e5, 0x6052, 0x00f6, 0x2079,
-	0x0100, 0x080c, 0x29d2, 0x00fe, 0x000e, 0x6052, 0x0005, 0x0156,
-	0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100,
-	0x2069, 0x0140, 0x2071, 0x1800, 0x6020, 0x9084, 0x0080, 0x0138,
-	0x2001, 0x180c, 0x200c, 0xc1c5, 0x2102, 0x0804, 0x70d2, 0x2001,
-	0x180c, 0x200c, 0xc1c4, 0x2102, 0x6028, 0x9084, 0xe1ff, 0x602a,
-	0x6027, 0x0200, 0x2001, 0x0090, 0x080c, 0x2b14, 0x20a9, 0x0366,
-	0x6024, 0xd0cc, 0x1518, 0x1d04, 0x7080, 0x2091, 0x6000, 0x1f04,
-	0x7080, 0x2011, 0x0003, 0x080c, 0x9758, 0x2011, 0x0002, 0x080c,
-	0x9762, 0x080c, 0x9649, 0x901e, 0x080c, 0x96bf, 0x2001, 0x00a0,
-	0x080c, 0x2b14, 0x080c, 0x728b, 0x080c, 0x5cca, 0x080c, 0xc1f9,
-	0x0110, 0x080c, 0x0d22, 0x9085, 0x0001, 0x0490, 0x86ff, 0x1110,
-	0x080c, 0x1982, 0x60e3, 0x0000, 0x2001, 0x0002, 0x080c, 0x26d7,
-	0x60e2, 0x2001, 0x0080, 0x080c, 0x2b14, 0x20a9, 0x0366, 0x6027,
-	0x1e00, 0x2009, 0x1e00, 0x080c, 0x2a5d, 0x6024, 0x910c, 0x0138,
-	0x1d04, 0x70b7, 0x2091, 0x6000, 0x1f04, 0x70b7, 0x0810, 0x6028,
-	0x9085, 0x1e00, 0x602a, 0x70b0, 0x9005, 0x1118, 0x6887, 0x0001,
-	0x0008, 0x6886, 0x080c, 0xc1f9, 0x0110, 0x080c, 0x0d22, 0x9006,
-	0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005,
-	0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061,
-	0x0100, 0x2071, 0x1800, 0x7000, 0x9086, 0x0003, 0x1168, 0x2001,
-	0x020b, 0x2004, 0x9084, 0x5540, 0x9086, 0x5540, 0x1128, 0x2069,
-	0x1a49, 0x2d04, 0x8000, 0x206a, 0x2069, 0x0140, 0x6020, 0x9084,
-	0x00c0, 0x0120, 0x6884, 0x9005, 0x1904, 0x7145, 0x2001, 0x0088,
-	0x080c, 0x2b14, 0x9006, 0x60e2, 0x6886, 0x080c, 0x26d7, 0x2069,
-	0x0200, 0x6804, 0x9005, 0x1118, 0x6808, 0x9005, 0x01c0, 0x6028,
-	0x9084, 0xfbff, 0x602a, 0x6027, 0x0400, 0x2069, 0x1960, 0x7000,
-	0x206a, 0x7097, 0x0026, 0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04,
-	0x7127, 0x2091, 0x6000, 0x1f04, 0x7127, 0x0804, 0x7172, 0x2069,
-	0x0140, 0x20a9, 0x0384, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c,
-	0x2a5d, 0x6024, 0x910c, 0x0508, 0x9084, 0x1a00, 0x11f0, 0x1d04,
-	0x7133, 0x2091, 0x6000, 0x1f04, 0x7133, 0x2011, 0x0003, 0x080c,
-	0x9758, 0x2011, 0x0002, 0x080c, 0x9762, 0x080c, 0x9649, 0x901e,
-	0x080c, 0x96bf, 0x2001, 0x00a0, 0x080c, 0x2b14, 0x080c, 0x728b,
-	0x080c, 0x5cca, 0x9085, 0x0001, 0x00a8, 0x2001, 0x0080, 0x080c,
-	0x2b14, 0x2069, 0x0140, 0x60e3, 0x0000, 0x70b0, 0x9005, 0x1118,
-	0x6887, 0x0001, 0x0008, 0x6886, 0x2001, 0x0002, 0x080c, 0x26d7,
-	0x60e2, 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
-	0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
-	0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x6020, 0x9084, 0x00c0,
-	0x01c8, 0x2011, 0x0003, 0x080c, 0x9758, 0x2011, 0x0002, 0x080c,
-	0x9762, 0x080c, 0x9649, 0x901e, 0x080c, 0x96bf, 0x2069, 0x0140,
-	0x2001, 0x00a0, 0x080c, 0x2b14, 0x080c, 0x728b, 0x080c, 0x5cca,
-	0x0804, 0x720c, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x1160, 0xc1b5,
-	0x2102, 0x080c, 0x6e10, 0x2069, 0x0140, 0x2001, 0x0080, 0x080c,
-	0x2b14, 0x60e3, 0x0000, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118,
-	0x6808, 0x9005, 0x0180, 0x6028, 0x9084, 0xfdff, 0x602a, 0x6027,
-	0x0200, 0x2069, 0x1960, 0x7000, 0x206a, 0x7097, 0x0027, 0x7003,
-	0x0001, 0x0804, 0x720c, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c,
-	0x2a5d, 0x6024, 0x910c, 0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04,
-	0x71cb, 0x0006, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c, 0x7f74,
-	0x00ee, 0x00de, 0x00ce, 0x001e, 0x000e, 0x00e6, 0x2071, 0x19cb,
-	0x7018, 0x00ee, 0x9005, 0x19f8, 0x01f8, 0x0026, 0x2011, 0x6e28,
-	0x080c, 0x8010, 0x2011, 0x6e1b, 0x080c, 0x80e4, 0x002e, 0x2069,
-	0x0140, 0x60e3, 0x0000, 0x70b0, 0x9005, 0x1118, 0x6887, 0x0001,
-	0x0008, 0x6886, 0x2001, 0x0002, 0x080c, 0x26d7, 0x60e2, 0x2001,
-	0x180c, 0x200c, 0xc1b4, 0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e,
-	0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036,
-	0x0046, 0x00c6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x080c,
-	0xc1f2, 0x1904, 0x7279, 0x7130, 0xd184, 0x1170, 0x080c, 0x312c,
-	0x0138, 0xc18d, 0x7132, 0x2011, 0x1854, 0x2214, 0xd2ac, 0x1120,
-	0x7030, 0xd08c, 0x0904, 0x7279, 0x2011, 0x1854, 0x220c, 0x0438,
-	0x0016, 0x2019, 0x000e, 0x080c, 0xd486, 0x0156, 0x00b6, 0x20a9,
-	0x007f, 0x900e, 0x9186, 0x007e, 0x01a0, 0x9186, 0x0080, 0x0188,
-	0x080c, 0x6237, 0x1170, 0x2120, 0x9006, 0x0016, 0x2009, 0x000e,
-	0x080c, 0xd50a, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x8207,
-	0x001e, 0x8108, 0x1f04, 0x7242, 0x00be, 0x015e, 0x001e, 0xd1ac,
-	0x1148, 0x0016, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x2fa2,
-	0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c,
-	0x6237, 0x1110, 0x080c, 0x5ce4, 0x8108, 0x1f04, 0x726f, 0x00be,
-	0x015e, 0x080c, 0x1982, 0x080c, 0x9d9f, 0x60e3, 0x0000, 0x080c,
-	0x5cca, 0x080c, 0x6ed9, 0x00ee, 0x00ce, 0x004e, 0x003e, 0x002e,
-	0x001e, 0x015e, 0x0005, 0x2001, 0x194e, 0x2003, 0x0001, 0x0005,
-	0x2001, 0x194e, 0x2003, 0x0000, 0x0005, 0x2001, 0x194d, 0x2003,
-	0xaaaa, 0x0005, 0x2001, 0x194d, 0x2003, 0x0000, 0x0005, 0x2071,
-	0x18f0, 0x7003, 0x0000, 0x7007, 0x0000, 0x080c, 0x1004, 0x090c,
-	0x0db4, 0xa8ab, 0xdcb0, 0x2900, 0x704e, 0x080c, 0x1004, 0x090c,
-	0x0db4, 0xa8ab, 0xdcb0, 0x2900, 0x7052, 0xa867, 0x0000, 0xa86b,
-	0x0001, 0xa89f, 0x0000, 0x0005, 0x00e6, 0x2071, 0x0040, 0x6848,
-	0x9005, 0x1118, 0x9085, 0x0001, 0x04b0, 0x6840, 0x9005, 0x0150,
-	0x04a1, 0x6a50, 0x9200, 0x7002, 0x6854, 0x9101, 0x7006, 0x9006,
-	0x7012, 0x7016, 0x6850, 0x7002, 0x6854, 0x7006, 0x6858, 0x700a,
-	0x685c, 0x700e, 0x6840, 0x9005, 0x1110, 0x7012, 0x7016, 0x6848,
-	0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x2001, 0x0019, 0x7036,
-	0x702b, 0x0001, 0x2001, 0x0004, 0x200c, 0x918c, 0xfff7, 0x918d,
-	0x8000, 0x2102, 0x00d6, 0x2069, 0x18f0, 0x6807, 0x0001, 0x00de,
-	0x080c, 0x788c, 0x9006, 0x00ee, 0x0005, 0x900e, 0x0156, 0x20a9,
-	0x0006, 0x8003, 0x2011, 0x0100, 0x2214, 0x9296, 0x0008, 0x1110,
-	0x818d, 0x0010, 0x81f5, 0x3e08, 0x1f04, 0x7301, 0x015e, 0x0005,
-	0x2079, 0x0040, 0x2071, 0x18f0, 0x7004, 0x0002, 0x7320, 0x7321,
-	0x7358, 0x73b3, 0x74f4, 0x731e, 0x731e, 0x751e, 0x080c, 0x0db4,
-	0x0005, 0x2079, 0x0040, 0x782c, 0x908c, 0x0780, 0x190c, 0x7918,
-	0xd0a4, 0x01f0, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806, 0xa864,
-	0x9084, 0x00ff, 0x908a, 0x0040, 0x0608, 0x00b8, 0x2001, 0x1800,
-	0x200c, 0x9186, 0x0003, 0x1160, 0x7104, 0x9186, 0x0004, 0x0140,
-	0x9186, 0x0007, 0x0128, 0x9186, 0x0003, 0x19e8, 0x080c, 0x73b3,
-	0x782c, 0xd09c, 0x090c, 0x788c, 0x0005, 0x9082, 0x005a, 0x1218,
-	0x2100, 0x003b, 0x0c18, 0x080c, 0x73e9, 0x0c90, 0x00e3, 0x08f0,
-	0x0005, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9,
-	0x73e9, 0x740b, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9,
-	0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9,
-	0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73f5, 0x73e9, 0x75f3,
-	0x73e9, 0x73e9, 0x73e9, 0x740b, 0x73e9, 0x73f5, 0x7634, 0x7675,
-	0x76bc, 0x76d0, 0x73e9, 0x73e9, 0x740b, 0x73f5, 0x73e9, 0x73e9,
-	0x74c8, 0x777b, 0x7796, 0x73e9, 0x740b, 0x73e9, 0x73e9, 0x73e9,
-	0x73e9, 0x74be, 0x7796, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9,
-	0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x741f, 0x73e9, 0x73e9, 0x73e9,
-	0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x78bc, 0x73e9,
-	0x73e9, 0x73e9, 0x73e9, 0x73e9, 0x7433, 0x73e9, 0x73e9, 0x73e9,
-	0x73e9, 0x73e9, 0x73e9, 0x2079, 0x0040, 0x7004, 0x9086, 0x0003,
-	0x1198, 0x782c, 0x080c, 0x78b5, 0xd0a4, 0x0170, 0x7824, 0x2048,
-	0x9006, 0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a, 0x001a,
-	0x1210, 0x002b, 0x0c50, 0x00e9, 0x080c, 0x788c, 0x0005, 0x73e9,
-	0x73f5, 0x75df, 0x73e9, 0x73f5, 0x73e9, 0x73f5, 0x73f5, 0x73e9,
-	0x73f5, 0x75df, 0x73f5, 0x73f5, 0x73f5, 0x73f5, 0x73f5, 0x73e9,
-	0x73f5, 0x75df, 0x73e9, 0x73e9, 0x73f5, 0x73e9, 0x73e9, 0x73e9,
-	0x73f5, 0x00e6, 0x2071, 0x18f0, 0x2009, 0x0400, 0x0071, 0x00ee,
-	0x0005, 0x2009, 0x1000, 0x0049, 0x0005, 0x2009, 0x2000, 0x0029,
-	0x0005, 0x2009, 0x0800, 0x0009, 0x0005, 0x7007, 0x0001, 0xa868,
-	0x9084, 0x00ff, 0x9105, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6885, 0x012e, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0d08,
-	0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x759d, 0x7007, 0x0003,
-	0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x759d, 0x0005, 0xa864,
-	0x8007, 0x9084, 0x00ff, 0x0968, 0x8001, 0x1120, 0x7007, 0x0001,
-	0x0804, 0x75b8, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a,
-	0x704b, 0x75b8, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x9086,
-	0x0001, 0x1904, 0x73f1, 0x7007, 0x0001, 0x2009, 0x1833, 0x210c,
-	0x81ff, 0x1904, 0x7495, 0xa994, 0x9186, 0x006f, 0x0188, 0x9186,
-	0x0074, 0x15b0, 0x0026, 0x2011, 0x0010, 0x080c, 0x657f, 0x002e,
-	0x0578, 0x0016, 0xa998, 0x080c, 0x65c9, 0x001e, 0x1548, 0x0400,
-	0x080c, 0x6fa7, 0x0140, 0xa897, 0x4005, 0xa89b, 0x0016, 0x2001,
-	0x0030, 0x900e, 0x0438, 0x0026, 0x2011, 0x8008, 0x080c, 0x657f,
-	0x002e, 0x01b0, 0x0016, 0x0026, 0x0036, 0xa998, 0xaaa0, 0xab9c,
-	0x918d, 0x8000, 0x080c, 0x65c9, 0x003e, 0x002e, 0x001e, 0x1140,
-	0xa897, 0x4005, 0xa89b, 0x4009, 0x2001, 0x0030, 0x900e, 0x0050,
-	0xa868, 0x9084, 0x00ff, 0xa86a, 0xa883, 0x0000, 0x080c, 0x5ef9,
-	0x1108, 0x0005, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139, 0xa87a,
-	0xa982, 0x080c, 0x6885, 0x012e, 0x0ca0, 0xa994, 0x9186, 0x0071,
-	0x0904, 0x7443, 0x9186, 0x0064, 0x0904, 0x7443, 0x9186, 0x007c,
-	0x0904, 0x7443, 0x9186, 0x0028, 0x0904, 0x7443, 0x9186, 0x0038,
-	0x0904, 0x7443, 0x9186, 0x0078, 0x0904, 0x7443, 0x9186, 0x005f,
-	0x0904, 0x7443, 0x9186, 0x0056, 0x0904, 0x7443, 0xa897, 0x4005,
-	0xa89b, 0x0001, 0x2001, 0x0030, 0x900e, 0x0860, 0xa87c, 0x9084,
-	0x00c0, 0x9086, 0x00c0, 0x1120, 0x7007, 0x0001, 0x0804, 0x77ad,
-	0x2900, 0x7016, 0x701a, 0x20a9, 0x0004, 0xa860, 0x20e0, 0xa85c,
-	0x9080, 0x0030, 0x2098, 0x7050, 0x2040, 0xa060, 0x20e8, 0xa05c,
-	0x9080, 0x0023, 0x20a0, 0x4003, 0xa888, 0x7012, 0x9082, 0x0401,
-	0x1a04, 0x73f9, 0xaab4, 0x928a, 0x0002, 0x1a04, 0x73f9, 0x82ff,
-	0x1138, 0xa8b8, 0xa9bc, 0x9105, 0x0118, 0x2001, 0x755b, 0x0018,
-	0x9280, 0x7551, 0x2005, 0x7056, 0x7010, 0x9015, 0x0904, 0x753c,
-	0x080c, 0x1004, 0x1118, 0x7007, 0x0004, 0x0005, 0x2900, 0x7022,
-	0x7054, 0x2060, 0xe000, 0xa866, 0x7050, 0x2040, 0xa95c, 0xe004,
-	0x9100, 0xa076, 0xa860, 0xa072, 0xe008, 0x920a, 0x1210, 0x900e,
-	0x2200, 0x7112, 0xe20c, 0x8003, 0x800b, 0x9296, 0x0004, 0x0108,
-	0x9108, 0xa17a, 0x810b, 0xa17e, 0x080c, 0x10d5, 0xa06c, 0x908e,
-	0x0100, 0x0170, 0x9086, 0x0200, 0x0118, 0x7007, 0x0007, 0x0005,
-	0x7020, 0x2048, 0x080c, 0x101d, 0x7014, 0x2048, 0x0804, 0x73f9,
-	0x7020, 0x2048, 0x7018, 0xa802, 0xa807, 0x0000, 0x2908, 0x2048,
-	0xa906, 0x711a, 0x0804, 0x74f4, 0x7014, 0x2048, 0x7007, 0x0001,
-	0xa8b4, 0x9005, 0x1128, 0xa8b8, 0xa9bc, 0x9105, 0x0108, 0x00b9,
-	0xa864, 0x9084, 0x00ff, 0x9086, 0x001e, 0x0904, 0x77ad, 0x0804,
-	0x759d, 0x7553, 0x7557, 0x0002, 0x001d, 0x0007, 0x0004, 0x000a,
-	0x001b, 0x0005, 0x0006, 0x000a, 0x001d, 0x0005, 0x0004, 0x0076,
-	0x0066, 0xafb8, 0xaebc, 0xa804, 0x2050, 0xb0c0, 0xb0e2, 0xb0bc,
-	0xb0de, 0xb0b8, 0xb0d2, 0xb0b4, 0xb0ce, 0xb6da, 0xb7d6, 0xb0b0,
-	0xb0ca, 0xb0ac, 0xb0c6, 0xb0a8, 0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2,
-	0xb7be, 0xb0a0, 0xb0b2, 0xb09c, 0xb0ae, 0xb098, 0xb0a2, 0xb094,
-	0xb09e, 0xb6aa, 0xb7a6, 0xb090, 0xb09a, 0xb08c, 0xb096, 0xb088,
-	0xb08a, 0xb084, 0xb086, 0xb692, 0xb78e, 0xb080, 0xb082, 0xb07c,
-	0xb07e, 0xb078, 0xb072, 0xb074, 0xb06e, 0xb67a, 0xb776, 0xb004,
-	0x9055, 0x1958, 0x006e, 0x007e, 0x0005, 0x2009, 0x1833, 0x210c,
-	0x81ff, 0x1178, 0x080c, 0x5d46, 0x1108, 0x0005, 0x080c, 0x6abf,
-	0x0126, 0x2091, 0x8000, 0x080c, 0xbded, 0x080c, 0x6885, 0x012e,
-	0x0ca0, 0x080c, 0xc1f2, 0x1d70, 0x2001, 0x0028, 0x900e, 0x0c70,
-	0x2009, 0x1833, 0x210c, 0x81ff, 0x11d8, 0xa888, 0x9005, 0x01e0,
-	0xa883, 0x0000, 0xa87c, 0xd0f4, 0x0120, 0x080c, 0x5e5b, 0x1138,
-	0x0005, 0x9006, 0xa87a, 0x080c, 0x5dd6, 0x1108, 0x0005, 0x0126,
-	0x2091, 0x8000, 0xa87a, 0xa982, 0x080c, 0x6885, 0x012e, 0x0cb0,
-	0x2001, 0x0028, 0x900e, 0x0c98, 0x2001, 0x0000, 0x0c80, 0x7018,
-	0xa802, 0x2908, 0x2048, 0xa906, 0x711a, 0x7010, 0x8001, 0x7012,
-	0x0118, 0x7007, 0x0003, 0x0030, 0x7014, 0x2048, 0x7007, 0x0001,
-	0x7048, 0x080f, 0x0005, 0x00b6, 0x7007, 0x0001, 0xa974, 0xa878,
-	0x9084, 0x00ff, 0x9096, 0x0004, 0x0540, 0x20a9, 0x0001, 0x9096,
-	0x0001, 0x0190, 0x900e, 0x20a9, 0x0800, 0x9096, 0x0002, 0x0160,
-	0x9005, 0x11d8, 0xa974, 0x080c, 0x6237, 0x11b8, 0x0066, 0xae80,
-	0x080c, 0x6347, 0x006e, 0x0088, 0x0046, 0x2011, 0x180c, 0x2224,
-	0xc484, 0x2412, 0x004e, 0x00c6, 0x080c, 0x6237, 0x1110, 0x080c,
-	0x6447, 0x8108, 0x1f04, 0x761c, 0x00ce, 0xa87c, 0xd084, 0x1120,
-	0x080c, 0x101d, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6885, 0x012e, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x7007,
-	0x0001, 0x080c, 0x6557, 0x0580, 0x2061, 0x1a41, 0x6100, 0xd184,
-	0x0178, 0xa888, 0x9084, 0x00ff, 0x1550, 0x6000, 0xd084, 0x0520,
-	0x6004, 0x9005, 0x1538, 0x6003, 0x0000, 0x600b, 0x0000, 0x00c8,
-	0x2011, 0x0001, 0xa890, 0x9005, 0x1110, 0x2001, 0x001e, 0x8000,
-	0x6016, 0xa888, 0x9084, 0x00ff, 0x0178, 0x6006, 0xa888, 0x8007,
-	0x9084, 0x00ff, 0x0148, 0x600a, 0xa888, 0x8000, 0x1108, 0xc28d,
-	0x6202, 0x012e, 0x0804, 0x7876, 0x012e, 0x0804, 0x7870, 0x012e,
-	0x0804, 0x786a, 0x012e, 0x0804, 0x786d, 0x0126, 0x2091, 0x8000,
-	0x7007, 0x0001, 0x080c, 0x6557, 0x05e0, 0x2061, 0x1a41, 0x6000,
-	0xd084, 0x05b8, 0x6204, 0x6308, 0xd08c, 0x1530, 0xac78, 0x9484,
-	0x0003, 0x0170, 0xa988, 0x918c, 0x00ff, 0x8001, 0x1120, 0x2100,
-	0x9210, 0x0620, 0x0028, 0x8001, 0x1508, 0x2100, 0x9212, 0x02f0,
-	0x9484, 0x000c, 0x0188, 0xa988, 0x810f, 0x918c, 0x00ff, 0x9082,
-	0x0004, 0x1120, 0x2100, 0x9318, 0x0288, 0x0030, 0x9082, 0x0004,
-	0x1168, 0x2100, 0x931a, 0x0250, 0xa890, 0x9005, 0x0110, 0x8000,
-	0x6016, 0x6206, 0x630a, 0x012e, 0x0804, 0x7876, 0x012e, 0x0804,
-	0x7873, 0x012e, 0x0804, 0x7870, 0x0126, 0x2091, 0x8000, 0x7007,
-	0x0001, 0x2061, 0x1a41, 0x6300, 0xd38c, 0x1120, 0x6308, 0x8318,
-	0x0220, 0x630a, 0x012e, 0x0804, 0x7884, 0x012e, 0x0804, 0x7873,
-	0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x7007, 0x0001, 0xa87c,
-	0xd0ac, 0x0148, 0x00c6, 0x2061, 0x1a41, 0x6000, 0x9084, 0xfcff,
-	0x6002, 0x00ce, 0x0440, 0xa888, 0x9005, 0x05d8, 0xa88c, 0x9065,
-	0x0598, 0x2001, 0x1833, 0x2004, 0x9005, 0x0118, 0x080c, 0x9e49,
-	0x0068, 0x6017, 0xf400, 0x605b, 0x0000, 0xa97c, 0xd1a4, 0x0110,
-	0xa980, 0x615a, 0x2009, 0x0041, 0x080c, 0x9e93, 0xa988, 0x918c,
-	0xff00, 0x9186, 0x2000, 0x1138, 0x0026, 0x900e, 0x2011, 0xfdff,
-	0x080c, 0x8207, 0x002e, 0xa87c, 0xd0c4, 0x0148, 0x2061, 0x1a41,
-	0x6000, 0xd08c, 0x1120, 0x6008, 0x8000, 0x0208, 0x600a, 0x00ce,
-	0x012e, 0x00be, 0x0804, 0x7876, 0x00ce, 0x012e, 0x00be, 0x0804,
-	0x7870, 0xa984, 0x9186, 0x002e, 0x0d30, 0x9186, 0x002d, 0x0d18,
-	0x9186, 0x0045, 0x0510, 0x9186, 0x002a, 0x1130, 0x2001, 0x180c,
-	0x200c, 0xc194, 0x2102, 0x08b8, 0x9186, 0x0020, 0x0158, 0x9186,
-	0x0029, 0x1d10, 0xa974, 0x080c, 0x6237, 0x1968, 0xb800, 0xc0e4,
-	0xb802, 0x0848, 0xa88c, 0x9065, 0x09b8, 0x6007, 0x0024, 0x2001,
-	0x1957, 0x2004, 0x601a, 0x0804, 0x770b, 0xa88c, 0x9065, 0x0960,
-	0x00e6, 0xa890, 0x9075, 0x2001, 0x1833, 0x2004, 0x9005, 0x0150,
-	0x080c, 0x9e49, 0x8eff, 0x0118, 0x2e60, 0x080c, 0x9e49, 0x00ee,
-	0x0804, 0x770b, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60, 0x6007,
-	0x003a, 0xa8a0, 0x9005, 0x0130, 0x6007, 0x003b, 0xa8a4, 0x602e,
-	0xa8a8, 0x6016, 0x6003, 0x0001, 0x080c, 0x83c9, 0x080c, 0x894b,
-	0x00ee, 0x0804, 0x770b, 0x2061, 0x1a41, 0x6000, 0xd084, 0x0190,
-	0xd08c, 0x1904, 0x7884, 0x0126, 0x2091, 0x8000, 0x6204, 0x8210,
-	0x0220, 0x6206, 0x012e, 0x0804, 0x7884, 0x012e, 0xa883, 0x0016,
-	0x0804, 0x787d, 0xa883, 0x0007, 0x0804, 0x787d, 0xa864, 0x8007,
-	0x9084, 0x00ff, 0x0130, 0x8001, 0x1138, 0x7007, 0x0001, 0x0069,
-	0x0005, 0x080c, 0x73f1, 0x0040, 0x7007, 0x0003, 0x7012, 0x2900,
-	0x7016, 0x701a, 0x704b, 0x77ad, 0x0005, 0x00b6, 0x00e6, 0x0126,
-	0x2091, 0x8000, 0x903e, 0x2061, 0x1800, 0x61cc, 0x81ff, 0x1904,
-	0x782f, 0x6130, 0xd194, 0x1904, 0x7859, 0xa878, 0x2070, 0x9e82,
-	0x1cd0, 0x0a04, 0x7823, 0x6064, 0x9e02, 0x1a04, 0x7823, 0x7120,
-	0x9186, 0x0006, 0x1904, 0x7815, 0x7010, 0x905d, 0x0904, 0x782f,
-	0xb800, 0xd0e4, 0x1904, 0x7853, 0x2061, 0x1a41, 0x6100, 0x9184,
-	0x0301, 0x9086, 0x0001, 0x15a0, 0x7024, 0xd0dc, 0x1904, 0x785c,
-	0xa883, 0x0000, 0xa803, 0x0000, 0x2908, 0x7014, 0x9005, 0x1198,
-	0x7116, 0xa87c, 0xd0f4, 0x1904, 0x785f, 0x080c, 0x537f, 0xd09c,
-	0x1118, 0xa87c, 0xc0cc, 0xa87e, 0x2e60, 0x080c, 0x8127, 0x012e,
-	0x00ee, 0x00be, 0x0005, 0x2048, 0xa800, 0x9005, 0x1de0, 0xa902,
-	0x2148, 0xa87c, 0xd0f4, 0x1904, 0x785f, 0x012e, 0x00ee, 0x00be,
-	0x0005, 0x012e, 0x00ee, 0xa883, 0x0006, 0x00be, 0x0804, 0x787d,
-	0xd184, 0x0db8, 0xd1c4, 0x1190, 0x00a0, 0xa974, 0x080c, 0x6237,
-	0x15d0, 0xb800, 0xd0e4, 0x15b8, 0x7120, 0x9186, 0x0007, 0x1118,
-	0xa883, 0x0002, 0x0490, 0xa883, 0x0008, 0x0478, 0xa883, 0x000e,
-	0x0460, 0xa883, 0x0017, 0x0448, 0xa883, 0x0035, 0x0430, 0x080c,
-	0x5383, 0xd0fc, 0x01e8, 0xa878, 0x2070, 0x9e82, 0x1cd0, 0x02c0,
-	0x6064, 0x9e02, 0x12a8, 0x7120, 0x9186, 0x0006, 0x1188, 0x7010,
-	0x905d, 0x0170, 0xb800, 0xd0bc, 0x0158, 0x2039, 0x0001, 0x7000,
-	0x9086, 0x0007, 0x1904, 0x77b9, 0x7003, 0x0002, 0x0804, 0x77b9,
-	0xa883, 0x0028, 0x0010, 0xa883, 0x0029, 0x012e, 0x00ee, 0x00be,
-	0x0420, 0xa883, 0x002a, 0x0cc8, 0xa883, 0x0045, 0x0cb0, 0x2e60,
-	0x2019, 0x0002, 0x601b, 0x0014, 0x080c, 0xd0c7, 0x012e, 0x00ee,
-	0x00be, 0x0005, 0x2009, 0x003e, 0x0058, 0x2009, 0x0004, 0x0040,
-	0x2009, 0x0006, 0x0028, 0x2009, 0x0016, 0x0010, 0x2009, 0x0001,
-	0xa884, 0x9084, 0xff00, 0x9105, 0xa886, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x6885, 0x012e, 0x0005, 0x080c, 0x101d, 0x0005, 0x00d6,
-	0x080c, 0x811e, 0x00de, 0x0005, 0x00d6, 0x00e6, 0x0126, 0x2091,
-	0x8000, 0x2071, 0x0040, 0x702c, 0xd084, 0x01d8, 0x908c, 0x0780,
-	0x190c, 0x7918, 0xd09c, 0x11a8, 0x2071, 0x1800, 0x70bc, 0x90ea,
-	0x0040, 0x0278, 0x8001, 0x70be, 0x702c, 0x2048, 0xa800, 0x702e,
-	0x9006, 0xa802, 0xa806, 0x2071, 0x0040, 0x2900, 0x7022, 0x702c,
-	0x0c28, 0x012e, 0x00ee, 0x00de, 0x0005, 0x0006, 0x9084, 0x0780,
-	0x190c, 0x7918, 0x000e, 0x0005, 0x00d6, 0x00c6, 0x0036, 0x0026,
-	0x0016, 0x00b6, 0x7007, 0x0001, 0xaa74, 0x9282, 0x0004, 0x1a04,
-	0x7909, 0xa97c, 0x9188, 0x1000, 0x2104, 0x905d, 0xb804, 0xd284,
-	0x0140, 0x05e8, 0x8007, 0x9084, 0x00ff, 0x9084, 0x0006, 0x1108,
-	0x04b0, 0x2b10, 0x080c, 0x9dc3, 0x1118, 0x080c, 0x9e66, 0x05a8,
-	0x6212, 0xa874, 0x0002, 0x78e7, 0x78ec, 0x78ef, 0x78f5, 0x2019,
-	0x0002, 0x080c, 0xd486, 0x0060, 0x080c, 0xd422, 0x0048, 0x2019,
-	0x0002, 0xa980, 0x080c, 0xd43d, 0x0018, 0xa980, 0x080c, 0xd422,
-	0x080c, 0x9e19, 0xa887, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6885, 0x012e, 0x00be, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00de,
-	0x0005, 0xa887, 0x0006, 0x0c80, 0xa887, 0x0002, 0x0c68, 0xa887,
-	0x0005, 0x0c50, 0xa887, 0x0004, 0x0c38, 0xa887, 0x0007, 0x0c20,
-	0x2091, 0x8000, 0x0e04, 0x791a, 0x0006, 0x0016, 0x2001, 0x8003,
-	0x0006, 0x0804, 0x0dbd, 0x2001, 0x1833, 0x2004, 0x9005, 0x0005,
-	0x0005, 0x00f6, 0x2079, 0x0300, 0x2001, 0x0200, 0x200c, 0xc1e5,
-	0xc1dc, 0x2102, 0x2009, 0x0218, 0x210c, 0xd1ec, 0x1120, 0x080c,
-	0x14a7, 0x00fe, 0x0005, 0x2001, 0x020d, 0x2003, 0x0020, 0x781f,
-	0x0300, 0x00fe, 0x0005, 0x781c, 0xd08c, 0x0904, 0x799a, 0x68bc,
-	0x90aa, 0x0005, 0x0a04, 0x7f2c, 0x7d44, 0x7c40, 0x9584, 0x00f6,
-	0x1510, 0x9484, 0x7000, 0x0140, 0x908a, 0x2000, 0x1260, 0x9584,
-	0x0700, 0x8007, 0x0804, 0x79a1, 0x7000, 0x9084, 0xff00, 0x9086,
-	0x8100, 0x0da8, 0x00b0, 0x9484, 0x0fff, 0x1130, 0x7000, 0x9084,
-	0xff00, 0x9086, 0x8100, 0x11c0, 0x080c, 0xd86c, 0x080c, 0x7e71,
-	0x7817, 0x0140, 0x00a8, 0x9584, 0x0076, 0x1118, 0x080c, 0x7ecf,
-	0x19c0, 0xd5a4, 0x0148, 0x0046, 0x0056, 0x080c, 0x79fc, 0x080c,
-	0x21cd, 0x005e, 0x004e, 0x0020, 0x080c, 0xd86c, 0x7817, 0x0140,
-	0x080c, 0x6fa7, 0x0168, 0x2001, 0x0111, 0x2004, 0xd08c, 0x0140,
-	0x688f, 0x0000, 0x2001, 0x0110, 0x2003, 0x0008, 0x2003, 0x0000,
-	0x080c, 0x79dd, 0x2001, 0x19c1, 0x2004, 0x9005, 0x090c, 0x894b,
-	0x0005, 0x0002, 0x79b3, 0x7c93, 0x79aa, 0x79aa, 0x79aa, 0x79aa,
-	0x79aa, 0x79aa, 0x7817, 0x0140, 0x2001, 0x19c1, 0x2004, 0x9005,
-	0x090c, 0x894b, 0x0005, 0x7000, 0x908c, 0xff00, 0x9194, 0xf000,
-	0x810f, 0x9484, 0x0fff, 0x688e, 0x9286, 0x2000, 0x1150, 0x6800,
-	0x9086, 0x0001, 0x1118, 0x080c, 0x53e0, 0x0070, 0x080c, 0x7a1c,
-	0x0058, 0x9286, 0x3000, 0x1118, 0x080c, 0x7bce, 0x0028, 0x9286,
-	0x8000, 0x1110, 0x080c, 0x7da1, 0x7817, 0x0140, 0x2001, 0x19c1,
-	0x2004, 0x9005, 0x090c, 0x894b, 0x0005, 0x2001, 0x1810, 0x2004,
-	0xd08c, 0x0178, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1148,
-	0x0026, 0x0036, 0x2011, 0x8048, 0x2518, 0x080c, 0x48d2, 0x003e,
-	0x002e, 0x0005, 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200,
-	0x2019, 0xfffe, 0x7c30, 0x0050, 0x0036, 0x0046, 0x0056, 0x00f6,
-	0x2079, 0x0200, 0x7d44, 0x7c40, 0x2019, 0xffff, 0x2001, 0x1810,
-	0x2004, 0xd08c, 0x0160, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003,
-	0x1130, 0x0026, 0x2011, 0x8048, 0x080c, 0x48d2, 0x002e, 0x00fe,
-	0x005e, 0x004e, 0x003e, 0x0005, 0x00b6, 0x00c6, 0x7010, 0x9084,
-	0xff00, 0x8007, 0x9096, 0x0001, 0x0120, 0x9096, 0x0023, 0x1904,
-	0x7b9f, 0x9186, 0x0023, 0x15c0, 0x080c, 0x7e36, 0x0904, 0x7b9f,
-	0x6120, 0x9186, 0x0001, 0x0150, 0x9186, 0x0004, 0x0138, 0x9186,
-	0x0008, 0x0120, 0x9186, 0x000a, 0x1904, 0x7b9f, 0x7124, 0x610a,
-	0x7030, 0x908e, 0x0200, 0x1130, 0x2009, 0x0015, 0x080c, 0x9e93,
-	0x0804, 0x7b9f, 0x908e, 0x0214, 0x0118, 0x908e, 0x0210, 0x1130,
-	0x2009, 0x0015, 0x080c, 0x9e93, 0x0804, 0x7b9f, 0x908e, 0x0100,
-	0x1904, 0x7b9f, 0x7034, 0x9005, 0x1904, 0x7b9f, 0x2009, 0x0016,
-	0x080c, 0x9e93, 0x0804, 0x7b9f, 0x9186, 0x0022, 0x1904, 0x7b9f,
-	0x7030, 0x908e, 0x0300, 0x1580, 0x68d8, 0xd0a4, 0x0528, 0xc0b5,
-	0x68da, 0x7100, 0x918c, 0x00ff, 0x697a, 0x7004, 0x687e, 0x00f6,
-	0x2079, 0x0100, 0x79e6, 0x78ea, 0x0006, 0x9084, 0x00ff, 0x0016,
-	0x2008, 0x080c, 0x26ac, 0x7932, 0x7936, 0x001e, 0x000e, 0x00fe,
-	0x080c, 0x2663, 0x695a, 0x703c, 0x00e6, 0x2071, 0x0140, 0x7086,
-	0x2071, 0x1800, 0x70b2, 0x00ee, 0x7034, 0x9005, 0x1904, 0x7b9f,
-	0x2009, 0x0017, 0x0804, 0x7b6c, 0x908e, 0x0400, 0x1190, 0x7034,
-	0x9005, 0x1904, 0x7b9f, 0x080c, 0x6fa7, 0x0120, 0x2009, 0x001d,
-	0x0804, 0x7b6c, 0x68d8, 0xc0a5, 0x68da, 0x2009, 0x0030, 0x0804,
-	0x7b6c, 0x908e, 0x0500, 0x1140, 0x7034, 0x9005, 0x1904, 0x7b9f,
-	0x2009, 0x0018, 0x0804, 0x7b6c, 0x908e, 0x2010, 0x1120, 0x2009,
-	0x0019, 0x0804, 0x7b6c, 0x908e, 0x2110, 0x1120, 0x2009, 0x001a,
-	0x0804, 0x7b6c, 0x908e, 0x5200, 0x1140, 0x7034, 0x9005, 0x1904,
-	0x7b9f, 0x2009, 0x001b, 0x0804, 0x7b6c, 0x908e, 0x5000, 0x1140,
-	0x7034, 0x9005, 0x1904, 0x7b9f, 0x2009, 0x001c, 0x0804, 0x7b6c,
-	0x908e, 0x1300, 0x1120, 0x2009, 0x0034, 0x0804, 0x7b6c, 0x908e,
-	0x1200, 0x1140, 0x7034, 0x9005, 0x1904, 0x7b9f, 0x2009, 0x0024,
-	0x0804, 0x7b6c, 0x908c, 0xff00, 0x918e, 0x2400, 0x1170, 0x2009,
-	0x002d, 0x2001, 0x1810, 0x2004, 0xd09c, 0x0904, 0x7b6c, 0x080c,
-	0xc89e, 0x1904, 0x7b9f, 0x0804, 0x7b6a, 0x908c, 0xff00, 0x918e,
-	0x5300, 0x1120, 0x2009, 0x002a, 0x0804, 0x7b6c, 0x908e, 0x0f00,
-	0x1120, 0x2009, 0x0020, 0x0804, 0x7b6c, 0x908e, 0x6104, 0x1528,
-	0x2029, 0x0205, 0x2011, 0x026d, 0x8208, 0x2204, 0x9082, 0x0004,
-	0x8004, 0x8004, 0x20a8, 0x2011, 0x8015, 0x211c, 0x8108, 0x0046,
-	0x2124, 0x080c, 0x48d2, 0x004e, 0x8108, 0x0f04, 0x7b38, 0x9186,
-	0x0280, 0x1d88, 0x2504, 0x8000, 0x202a, 0x2009, 0x0260, 0x0c58,
-	0x202b, 0x0000, 0x2009, 0x0023, 0x0478, 0x908e, 0x6000, 0x1118,
-	0x2009, 0x003f, 0x0448, 0x908e, 0x7800, 0x1118, 0x2009, 0x0045,
-	0x0418, 0x908e, 0x1000, 0x1118, 0x2009, 0x004e, 0x00e8, 0x908e,
-	0x6300, 0x1118, 0x2009, 0x004a, 0x00b8, 0x908c, 0xff00, 0x918e,
-	0x5600, 0x1118, 0x2009, 0x004f, 0x0078, 0x908c, 0xff00, 0x918e,
-	0x5700, 0x1118, 0x2009, 0x0050, 0x0038, 0x2009, 0x001d, 0x6838,
-	0xd0d4, 0x0110, 0x2009, 0x004c, 0x0016, 0x2011, 0x0263, 0x2204,
-	0x8211, 0x220c, 0x080c, 0x2663, 0x1568, 0x080c, 0x61d7, 0x1550,
-	0xbe12, 0xbd16, 0x001e, 0x0016, 0xb8b0, 0x9005, 0x1168, 0x9186,
+	0x6822, 0x00de, 0x701c, 0x2048, 0x7010, 0x8001, 0x7012, 0xa800,
+	0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x0005, 0x0005, 0x0126,
+	0x2091, 0x8000, 0x701c, 0x904d, 0x0160, 0x7010, 0x8001, 0x7012,
+	0xa800, 0x701e, 0x9005, 0x1108, 0x701a, 0x012e, 0x080c, 0x101d,
+	0x0005, 0x012e, 0x0005, 0x2091, 0x8000, 0x0e04, 0x6bc5, 0x0006,
+	0x0016, 0x2001, 0x8004, 0x0006, 0x0804, 0x0dbd, 0x0096, 0x00f6,
+	0x2079, 0x0050, 0x7044, 0xd084, 0x01e0, 0xc084, 0x7046, 0x7838,
+	0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833,
+	0x0013, 0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
+	0x190c, 0x1187, 0x2009, 0x1919, 0x200b, 0x0000, 0x00fe, 0x009e,
+	0x0005, 0x782c, 0x9094, 0x0780, 0x1971, 0xd0a4, 0x0db8, 0x2009,
+	0x1919, 0x2104, 0x8000, 0x200a, 0x9082, 0x000f, 0x0e78, 0x00e6,
+	0x2071, 0x1800, 0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c,
+	0x1148, 0x2009, 0x182f, 0x210c, 0x918a, 0x0040, 0x0218, 0x7022,
+	0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e,
+	0x70bc, 0x8000, 0x70be, 0x080c, 0x7f5d, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6bc3, 0xd0a4, 0x19f0, 0x7838, 0x7938, 0x910e, 0x1de0,
+	0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x2091,
+	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x1187, 0x2009,
+	0x1919, 0x200b, 0x0000, 0x00ee, 0x00fe, 0x009e, 0x0005, 0x00f6,
+	0x2079, 0x0050, 0x7044, 0xd084, 0x01b8, 0xc084, 0x7046, 0x7838,
+	0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833,
+	0x0013, 0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
+	0x190c, 0x1187, 0x00fe, 0x0005, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x6bc3, 0xd0a4, 0x0db8, 0x00e6, 0x2071, 0x1800, 0x7824, 0x2048,
+	0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c,
+	0x7f5d, 0x782c, 0x9094, 0x0780, 0x190c, 0x6bc3, 0xd0a4, 0x1d70,
+	0x00d6, 0x2069, 0x0050, 0x693c, 0x2069, 0x191a, 0x6808, 0x690a,
+	0x2069, 0x19cb, 0x9102, 0x1118, 0x683c, 0x9005, 0x1328, 0x2001,
+	0x191b, 0x200c, 0x810d, 0x693e, 0x00de, 0x00ee, 0x00fe, 0x0005,
+	0x7094, 0x908a, 0x0029, 0x1a0c, 0x0db4, 0x9082, 0x001d, 0x001b,
+	0x6027, 0x1e00, 0x0005, 0x6d67, 0x6ced, 0x6d09, 0x6d33, 0x6d56,
+	0x6d96, 0x6da8, 0x6d09, 0x6d7e, 0x6ca8, 0x6cd6, 0x6ca7, 0x0005,
+	0x00d6, 0x2069, 0x0200, 0x6804, 0x9005, 0x1180, 0x6808, 0x9005,
+	0x1518, 0x7097, 0x0028, 0x2069, 0x1960, 0x2d04, 0x7002, 0x080c,
+	0x70eb, 0x6028, 0x9085, 0x0600, 0x602a, 0x00b0, 0x7097, 0x0028,
+	0x2069, 0x1960, 0x2d04, 0x7002, 0x6028, 0x9085, 0x0600, 0x602a,
+	0x00e6, 0x0036, 0x0046, 0x0056, 0x2071, 0x1a33, 0x080c, 0x1958,
+	0x005e, 0x004e, 0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6, 0x2069,
+	0x0200, 0x6804, 0x9005, 0x1178, 0x6808, 0x9005, 0x1160, 0x7097,
+	0x0028, 0x2069, 0x1960, 0x2d04, 0x7002, 0x080c, 0x7185, 0x6028,
+	0x9085, 0x0600, 0x602a, 0x00de, 0x0005, 0x0006, 0x2001, 0x0090,
+	0x080c, 0x2b14, 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x6e15,
+	0xd1d4, 0x1160, 0xd1dc, 0x1138, 0xd1cc, 0x0150, 0x7097, 0x0020,
+	0x080c, 0x6e15, 0x0028, 0x7097, 0x001d, 0x0010, 0x7097, 0x001f,
+	0x0005, 0x2001, 0x0088, 0x080c, 0x2b14, 0x6124, 0xd1cc, 0x11e8,
+	0xd1dc, 0x11c0, 0xd1e4, 0x1198, 0x9184, 0x1e00, 0x11d8, 0x080c,
+	0x1982, 0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x6fde,
+	0x2001, 0x0080, 0x080c, 0x2b14, 0x7097, 0x0028, 0x0058, 0x7097,
+	0x001e, 0x0040, 0x7097, 0x001d, 0x0028, 0x7097, 0x0020, 0x0010,
+	0x7097, 0x001f, 0x0005, 0x080c, 0x1982, 0x60e3, 0x0001, 0x600c,
+	0xc0b4, 0x600e, 0x080c, 0x6fde, 0x2001, 0x0080, 0x080c, 0x2b14,
+	0x6124, 0xd1d4, 0x1180, 0xd1dc, 0x1158, 0xd1e4, 0x1130, 0x9184,
+	0x1e00, 0x1158, 0x7097, 0x0028, 0x0040, 0x7097, 0x001e, 0x0028,
+	0x7097, 0x001d, 0x0010, 0x7097, 0x001f, 0x0005, 0x2001, 0x00a0,
+	0x080c, 0x2b14, 0x6124, 0xd1dc, 0x1138, 0xd1e4, 0x0138, 0x080c,
+	0x1982, 0x7097, 0x001e, 0x0010, 0x7097, 0x001d, 0x0005, 0x080c,
+	0x6e98, 0x6124, 0xd1dc, 0x1188, 0x080c, 0x6e15, 0x0016, 0x080c,
+	0x1982, 0x001e, 0xd1d4, 0x1128, 0xd1e4, 0x0138, 0x7097, 0x001e,
+	0x0020, 0x7097, 0x001f, 0x080c, 0x6e15, 0x0005, 0x0006, 0x2001,
+	0x00a0, 0x080c, 0x2b14, 0x000e, 0x6124, 0xd1d4, 0x1160, 0xd1cc,
+	0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x7097, 0x001e, 0x0028,
+	0x7097, 0x001d, 0x0010, 0x7097, 0x0021, 0x0005, 0x080c, 0x6e98,
+	0x6124, 0xd1d4, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x7097,
+	0x001e, 0x0028, 0x7097, 0x001d, 0x0010, 0x7097, 0x001f, 0x0005,
+	0x0006, 0x2001, 0x0090, 0x080c, 0x2b14, 0x000e, 0x6124, 0xd1d4,
+	0x1178, 0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0158, 0x7097,
+	0x001e, 0x0040, 0x7097, 0x001d, 0x0028, 0x7097, 0x0020, 0x0010,
+	0x7097, 0x001f, 0x0005, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x0126,
+	0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2091, 0x8000,
+	0x080c, 0x6fb2, 0x11d8, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x01b0,
+	0xc1b4, 0x2102, 0x6027, 0x0200, 0x080c, 0x2a5d, 0x6024, 0xd0cc,
+	0x0148, 0x2001, 0x00a0, 0x080c, 0x2b14, 0x080c, 0x7296, 0x080c,
+	0x5cd1, 0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x6fcc,
+	0x0150, 0x080c, 0x6fc3, 0x1138, 0x2001, 0x0001, 0x080c, 0x260c,
+	0x080c, 0x6f8a, 0x00a0, 0x080c, 0x6e95, 0x0178, 0x2001, 0x0001,
+	0x080c, 0x260c, 0x7094, 0x9086, 0x001e, 0x0120, 0x7094, 0x9086,
+	0x0022, 0x1118, 0x7097, 0x0025, 0x0010, 0x7097, 0x0021, 0x012e,
+	0x00ee, 0x00de, 0x00ce, 0x001e, 0x0005, 0x0026, 0x2011, 0x6e26,
+	0x080c, 0x810c, 0x002e, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011,
+	0x6e26, 0x080c, 0x8103, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6,
+	0x0016, 0x080c, 0x93ac, 0x2071, 0x1800, 0x080c, 0x6dc3, 0x001e,
+	0x00fe, 0x00ee, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
+	0x00e6, 0x00f6, 0x0126, 0x080c, 0x93ac, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x2071, 0x1800, 0x2091, 0x8000, 0x6028, 0xc09c, 0x602a,
+	0x2011, 0x0003, 0x080c, 0x9771, 0x2011, 0x0002, 0x080c, 0x977b,
+	0x080c, 0x9662, 0x080c, 0x80b8, 0x0036, 0x901e, 0x080c, 0x96d8,
+	0x003e, 0x60e3, 0x0000, 0x080c, 0xd8b4, 0x080c, 0xd8cf, 0x2009,
+	0x0004, 0x080c, 0x2a63, 0x080c, 0x297e, 0x2001, 0x1800, 0x2003,
+	0x0004, 0x6027, 0x0008, 0x2011, 0x6e26, 0x080c, 0x810c, 0x080c,
+	0x6fcc, 0x0118, 0x9006, 0x080c, 0x2b14, 0x080c, 0x0b8f, 0x2001,
+	0x0001, 0x080c, 0x260c, 0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
+	0x003e, 0x002e, 0x001e, 0x0005, 0x0026, 0x00e6, 0x2011, 0x6e33,
+	0x2071, 0x19cb, 0x701c, 0x9206, 0x1118, 0x7018, 0x9005, 0x0110,
+	0x9085, 0x0001, 0x00ee, 0x002e, 0x0005, 0x6020, 0xd09c, 0x0005,
+	0x6800, 0x9084, 0xfffe, 0x9086, 0x00c0, 0x01b8, 0x2001, 0x00c0,
+	0x080c, 0x2b14, 0x0156, 0x20a9, 0x002d, 0x1d04, 0x6ea5, 0x2091,
+	0x6000, 0x1f04, 0x6ea5, 0x015e, 0x00d6, 0x2069, 0x1800, 0x6898,
+	0x8001, 0x0220, 0x0118, 0x689a, 0x00de, 0x0005, 0x689b, 0x0014,
+	0x68e4, 0xd0dc, 0x0dc8, 0x6800, 0x9086, 0x0001, 0x1da8, 0x080c,
+	0x8118, 0x0c90, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x2071, 0x1800, 0x080c, 0x72a5, 0x2001, 0x193e, 0x2003,
+	0x0000, 0x9006, 0x7096, 0x60e2, 0x6886, 0x080c, 0x26d7, 0x9006,
+	0x080c, 0x2b14, 0x080c, 0x5b90, 0x6027, 0xffff, 0x602b, 0x182f,
+	0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061,
+	0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2001, 0x194e, 0x200c,
+	0x9186, 0x0000, 0x0158, 0x9186, 0x0001, 0x0158, 0x9186, 0x0002,
+	0x0158, 0x9186, 0x0003, 0x0158, 0x0804, 0x6f7a, 0x7097, 0x0022,
+	0x0040, 0x7097, 0x0021, 0x0028, 0x7097, 0x0023, 0x0010, 0x7097,
+	0x0024, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c,
+	0x26d7, 0x0026, 0x080c, 0x9db8, 0x002e, 0x7000, 0x908e, 0x0004,
+	0x0118, 0x602b, 0x0028, 0x0010, 0x602b, 0x0020, 0x0156, 0x0126,
+	0x2091, 0x8000, 0x20a9, 0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e,
+	0x015e, 0x080c, 0xc212, 0x0118, 0x9006, 0x080c, 0x2b3e, 0x0804,
+	0x6f86, 0x6800, 0x9084, 0x00a1, 0xc0bd, 0x6802, 0x080c, 0x2a5d,
+	0x6904, 0xd1d4, 0x1140, 0x2001, 0x0100, 0x080c, 0x2b14, 0x1f04,
+	0x6f24, 0x080c, 0x7009, 0x012e, 0x015e, 0x080c, 0x6fc3, 0x01a8,
+	0x6044, 0x9005, 0x0168, 0x6050, 0x0006, 0x9085, 0x0020, 0x6052,
+	0x080c, 0x7009, 0x9006, 0x8001, 0x1df0, 0x000e, 0x6052, 0x0028,
+	0x6804, 0xd0d4, 0x1110, 0x080c, 0x7009, 0x080c, 0xc212, 0x0118,
+	0x9006, 0x080c, 0x2b3e, 0x0016, 0x0026, 0x7000, 0x908e, 0x0004,
+	0x0130, 0x2009, 0x00c8, 0x2011, 0x6e33, 0x080c, 0x80ca, 0x002e,
+	0x001e, 0x080c, 0x7f54, 0x7034, 0xc085, 0x7036, 0x2001, 0x194e,
+	0x2003, 0x0004, 0x080c, 0x6c90, 0x080c, 0x6fc3, 0x0138, 0x6804,
+	0xd0d4, 0x1120, 0xd0dc, 0x1100, 0x080c, 0x729b, 0x00ee, 0x00de,
+	0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x2071, 0x1800, 0x080c, 0x7f6b, 0x080c, 0x7f5d, 0x080c,
+	0x72a5, 0x2001, 0x193e, 0x2003, 0x0000, 0x9006, 0x7096, 0x60e2,
+	0x6886, 0x080c, 0x26d7, 0x9006, 0x080c, 0x2b14, 0x6043, 0x0090,
+	0x6043, 0x0010, 0x6027, 0xffff, 0x602b, 0x182f, 0x00ee, 0x00de,
+	0x00ce, 0x0005, 0x0006, 0x2001, 0x194d, 0x2004, 0x9086, 0xaaaa,
+	0x000e, 0x0005, 0x0006, 0x080c, 0x538a, 0x9084, 0x0030, 0x9086,
+	0x0000, 0x000e, 0x0005, 0x0006, 0x080c, 0x538a, 0x9084, 0x0030,
+	0x9086, 0x0030, 0x000e, 0x0005, 0x0006, 0x080c, 0x538a, 0x9084,
+	0x0030, 0x9086, 0x0010, 0x000e, 0x0005, 0x0006, 0x080c, 0x538a,
+	0x9084, 0x0030, 0x9086, 0x0020, 0x000e, 0x0005, 0x0036, 0x0016,
+	0x2001, 0x180c, 0x2004, 0x908c, 0x0013, 0x0180, 0x0020, 0x080c,
+	0x26f7, 0x900e, 0x0028, 0x080c, 0x655a, 0x1dc8, 0x2009, 0x0002,
+	0x2019, 0x0028, 0x080c, 0x2fa5, 0x9006, 0x0019, 0x001e, 0x003e,
+	0x0005, 0x00e6, 0x2071, 0x180c, 0x2e04, 0x0130, 0x080c, 0xc20b,
+	0x1128, 0x9085, 0x0010, 0x0010, 0x9084, 0xffef, 0x2072, 0x00ee,
+	0x0005, 0x6050, 0x0006, 0x60ec, 0x0006, 0x600c, 0x0006, 0x6004,
+	0x0006, 0x6028, 0x0006, 0x0016, 0x6138, 0x6050, 0x9084, 0xfbff,
+	0x9085, 0x2000, 0x6052, 0x613a, 0x20a9, 0x0012, 0x1d04, 0x701e,
+	0x2091, 0x6000, 0x1f04, 0x701e, 0x602f, 0x0100, 0x602f, 0x0000,
+	0x6050, 0x9085, 0x0400, 0x9084, 0xdfff, 0x6052, 0x613a, 0x001e,
+	0x602f, 0x0040, 0x602f, 0x0000, 0x000e, 0x602a, 0x000e, 0x6006,
+	0x000e, 0x600e, 0x000e, 0x60ee, 0x60e3, 0x0000, 0x6887, 0x0001,
+	0x2001, 0x0001, 0x080c, 0x26d7, 0x2001, 0x00a0, 0x0006, 0x080c,
+	0xc212, 0x000e, 0x0130, 0x080c, 0x2b32, 0x9006, 0x080c, 0x2b3e,
+	0x0010, 0x080c, 0x2b14, 0x000e, 0x6052, 0x6050, 0x0006, 0xc0e5,
+	0x6052, 0x00f6, 0x2079, 0x0100, 0x080c, 0x29d2, 0x00fe, 0x000e,
+	0x6052, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
+	0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x6020,
+	0x9084, 0x0080, 0x0138, 0x2001, 0x180c, 0x200c, 0xc1c5, 0x2102,
+	0x0804, 0x70dd, 0x2001, 0x180c, 0x200c, 0xc1c4, 0x2102, 0x6028,
+	0x9084, 0xe1ff, 0x602a, 0x6027, 0x0200, 0x2001, 0x0090, 0x080c,
+	0x2b14, 0x20a9, 0x0366, 0x6024, 0xd0cc, 0x1518, 0x1d04, 0x708b,
+	0x2091, 0x6000, 0x1f04, 0x708b, 0x2011, 0x0003, 0x080c, 0x9771,
+	0x2011, 0x0002, 0x080c, 0x977b, 0x080c, 0x9662, 0x901e, 0x080c,
+	0x96d8, 0x2001, 0x00a0, 0x080c, 0x2b14, 0x080c, 0x7296, 0x080c,
+	0x5cd1, 0x080c, 0xc212, 0x0110, 0x080c, 0x0d22, 0x9085, 0x0001,
+	0x0490, 0x86ff, 0x1110, 0x080c, 0x1982, 0x60e3, 0x0000, 0x2001,
+	0x0002, 0x080c, 0x26d7, 0x60e2, 0x2001, 0x0080, 0x080c, 0x2b14,
+	0x20a9, 0x0366, 0x6027, 0x1e00, 0x2009, 0x1e00, 0x080c, 0x2a5d,
+	0x6024, 0x910c, 0x0138, 0x1d04, 0x70c2, 0x2091, 0x6000, 0x1f04,
+	0x70c2, 0x0810, 0x6028, 0x9085, 0x1e00, 0x602a, 0x70b0, 0x9005,
+	0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x080c, 0xc212, 0x0110,
+	0x080c, 0x0d22, 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e,
+	0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6,
+	0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x7000, 0x9086,
+	0x0003, 0x1168, 0x2001, 0x020b, 0x2004, 0x9084, 0x5540, 0x9086,
+	0x5540, 0x1128, 0x2069, 0x1a49, 0x2d04, 0x8000, 0x206a, 0x2069,
+	0x0140, 0x6020, 0x9084, 0x00c0, 0x0120, 0x6884, 0x9005, 0x1904,
+	0x7150, 0x2001, 0x0088, 0x080c, 0x2b14, 0x9006, 0x60e2, 0x6886,
+	0x080c, 0x26d7, 0x2069, 0x0200, 0x6804, 0x9005, 0x1118, 0x6808,
+	0x9005, 0x01c0, 0x6028, 0x9084, 0xfbff, 0x602a, 0x6027, 0x0400,
+	0x2069, 0x1960, 0x7000, 0x206a, 0x7097, 0x0026, 0x7003, 0x0001,
+	0x20a9, 0x0002, 0x1d04, 0x7132, 0x2091, 0x6000, 0x1f04, 0x7132,
+	0x0804, 0x717d, 0x2069, 0x0140, 0x20a9, 0x0384, 0x6027, 0x1e00,
+	0x2009, 0x1e00, 0x080c, 0x2a5d, 0x6024, 0x910c, 0x0508, 0x9084,
+	0x1a00, 0x11f0, 0x1d04, 0x713e, 0x2091, 0x6000, 0x1f04, 0x713e,
+	0x2011, 0x0003, 0x080c, 0x9771, 0x2011, 0x0002, 0x080c, 0x977b,
+	0x080c, 0x9662, 0x901e, 0x080c, 0x96d8, 0x2001, 0x00a0, 0x080c,
+	0x2b14, 0x080c, 0x7296, 0x080c, 0x5cd1, 0x9085, 0x0001, 0x00a8,
+	0x2001, 0x0080, 0x080c, 0x2b14, 0x2069, 0x0140, 0x60e3, 0x0000,
+	0x70b0, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x2001,
+	0x0002, 0x080c, 0x26d7, 0x60e2, 0x9006, 0x00ee, 0x00de, 0x00ce,
+	0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026,
+	0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800,
+	0x6020, 0x9084, 0x00c0, 0x01c8, 0x2011, 0x0003, 0x080c, 0x9771,
+	0x2011, 0x0002, 0x080c, 0x977b, 0x080c, 0x9662, 0x901e, 0x080c,
+	0x96d8, 0x2069, 0x0140, 0x2001, 0x00a0, 0x080c, 0x2b14, 0x080c,
+	0x7296, 0x080c, 0x5cd1, 0x0804, 0x7217, 0x2001, 0x180c, 0x200c,
+	0xd1b4, 0x1160, 0xc1b5, 0x2102, 0x080c, 0x6e1b, 0x2069, 0x0140,
+	0x2001, 0x0080, 0x080c, 0x2b14, 0x60e3, 0x0000, 0x2069, 0x0200,
+	0x6804, 0x9005, 0x1118, 0x6808, 0x9005, 0x0180, 0x6028, 0x9084,
+	0xfdff, 0x602a, 0x6027, 0x0200, 0x2069, 0x1960, 0x7000, 0x206a,
+	0x7097, 0x0027, 0x7003, 0x0001, 0x0804, 0x7217, 0x6027, 0x1e00,
+	0x2009, 0x1e00, 0x080c, 0x2a5d, 0x6024, 0x910c, 0x01c8, 0x9084,
+	0x1c00, 0x11b0, 0x1d04, 0x71d6, 0x0006, 0x0016, 0x00c6, 0x00d6,
+	0x00e6, 0x080c, 0x7f9c, 0x00ee, 0x00de, 0x00ce, 0x001e, 0x000e,
+	0x00e6, 0x2071, 0x19cb, 0x7018, 0x00ee, 0x9005, 0x19f8, 0x01f8,
+	0x0026, 0x2011, 0x6e33, 0x080c, 0x8038, 0x2011, 0x6e26, 0x080c,
+	0x810c, 0x002e, 0x2069, 0x0140, 0x60e3, 0x0000, 0x70b0, 0x9005,
+	0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x2001, 0x0002, 0x080c,
+	0x26d7, 0x60e2, 0x2001, 0x180c, 0x200c, 0xc1b4, 0x2102, 0x00ee,
+	0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156,
+	0x0016, 0x0026, 0x0036, 0x0046, 0x00c6, 0x00e6, 0x2061, 0x0100,
+	0x2071, 0x1800, 0x080c, 0xc20b, 0x1904, 0x7284, 0x7130, 0xd184,
+	0x1170, 0x080c, 0x3133, 0x0138, 0xc18d, 0x7132, 0x2011, 0x1854,
+	0x2214, 0xd2ac, 0x1120, 0x7030, 0xd08c, 0x0904, 0x7284, 0x2011,
+	0x1854, 0x220c, 0x0438, 0x0016, 0x2019, 0x000e, 0x080c, 0xd4a6,
+	0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x9186, 0x007e, 0x01a0,
+	0x9186, 0x0080, 0x0188, 0x080c, 0x623e, 0x1170, 0x2120, 0x9006,
+	0x0016, 0x2009, 0x000e, 0x080c, 0xd52a, 0x2009, 0x0001, 0x2011,
+	0x0100, 0x080c, 0x822f, 0x001e, 0x8108, 0x1f04, 0x724d, 0x00be,
+	0x015e, 0x001e, 0xd1ac, 0x1148, 0x0016, 0x2009, 0x0002, 0x2019,
+	0x0004, 0x080c, 0x2fa5, 0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9,
+	0x007f, 0x900e, 0x080c, 0x623e, 0x1110, 0x080c, 0x5ceb, 0x8108,
+	0x1f04, 0x727a, 0x00be, 0x015e, 0x080c, 0x1982, 0x080c, 0x9db8,
+	0x60e3, 0x0000, 0x080c, 0x5cd1, 0x080c, 0x6ee4, 0x00ee, 0x00ce,
+	0x004e, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x2001, 0x194e,
+	0x2003, 0x0001, 0x0005, 0x2001, 0x194e, 0x2003, 0x0000, 0x0005,
+	0x2001, 0x194d, 0x2003, 0xaaaa, 0x0005, 0x2001, 0x194d, 0x2003,
+	0x0000, 0x0005, 0x2071, 0x18f0, 0x7003, 0x0000, 0x7007, 0x0000,
+	0x080c, 0x1004, 0x090c, 0x0db4, 0xa8ab, 0xdcb0, 0x2900, 0x704e,
+	0x080c, 0x1004, 0x090c, 0x0db4, 0xa8ab, 0xdcb0, 0x2900, 0x7052,
+	0xa867, 0x0000, 0xa86b, 0x0001, 0xa89f, 0x0000, 0x0005, 0x00e6,
+	0x2071, 0x0040, 0x6848, 0x9005, 0x1118, 0x9085, 0x0001, 0x04b0,
+	0x6840, 0x9005, 0x0150, 0x04a1, 0x6a50, 0x9200, 0x7002, 0x6854,
+	0x9101, 0x7006, 0x9006, 0x7012, 0x7016, 0x6850, 0x7002, 0x6854,
+	0x7006, 0x6858, 0x700a, 0x685c, 0x700e, 0x6840, 0x9005, 0x1110,
+	0x7012, 0x7016, 0x6848, 0x701a, 0x701c, 0x9085, 0x0040, 0x701e,
+	0x2001, 0x0019, 0x7036, 0x702b, 0x0001, 0x2001, 0x0004, 0x200c,
+	0x918c, 0xfff7, 0x918d, 0x8000, 0x2102, 0x00d6, 0x2069, 0x18f0,
+	0x6807, 0x0001, 0x00de, 0x080c, 0x7897, 0x9006, 0x00ee, 0x0005,
+	0x900e, 0x0156, 0x20a9, 0x0006, 0x8003, 0x2011, 0x0100, 0x2214,
+	0x9296, 0x0008, 0x1110, 0x818d, 0x0010, 0x81f5, 0x3e08, 0x1f04,
+	0x730c, 0x015e, 0x0005, 0x2079, 0x0040, 0x2071, 0x18f0, 0x7004,
+	0x0002, 0x732b, 0x732c, 0x7363, 0x73be, 0x74ff, 0x7329, 0x7329,
+	0x7529, 0x080c, 0x0db4, 0x0005, 0x2079, 0x0040, 0x782c, 0x908c,
+	0x0780, 0x190c, 0x7923, 0xd0a4, 0x01f0, 0x7824, 0x2048, 0x9006,
+	0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a, 0x0040, 0x0608,
+	0x00b8, 0x2001, 0x1800, 0x200c, 0x9186, 0x0003, 0x1160, 0x7104,
+	0x9186, 0x0004, 0x0140, 0x9186, 0x0007, 0x0128, 0x9186, 0x0003,
+	0x19e8, 0x080c, 0x73be, 0x782c, 0xd09c, 0x090c, 0x7897, 0x0005,
+	0x9082, 0x005a, 0x1218, 0x2100, 0x003b, 0x0c18, 0x080c, 0x73f4,
+	0x0c90, 0x00e3, 0x08f0, 0x0005, 0x73f4, 0x73f4, 0x73f4, 0x73f4,
+	0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x7416, 0x73f4, 0x73f4, 0x73f4,
+	0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4,
+	0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4,
+	0x7400, 0x73f4, 0x75fe, 0x73f4, 0x73f4, 0x73f4, 0x7416, 0x73f4,
+	0x7400, 0x763f, 0x7680, 0x76c7, 0x76db, 0x73f4, 0x73f4, 0x7416,
+	0x7400, 0x73f4, 0x73f4, 0x74d3, 0x7786, 0x77a1, 0x73f4, 0x7416,
+	0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x74c9, 0x77a1, 0x73f4, 0x73f4,
+	0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x742a,
+	0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4,
+	0x73f4, 0x78c7, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x743e,
+	0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x73f4, 0x2079, 0x0040,
+	0x7004, 0x9086, 0x0003, 0x1198, 0x782c, 0x080c, 0x78c0, 0xd0a4,
+	0x0170, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806, 0xa864, 0x9084,
+	0x00ff, 0x908a, 0x001a, 0x1210, 0x002b, 0x0c50, 0x00e9, 0x080c,
+	0x7897, 0x0005, 0x73f4, 0x7400, 0x75ea, 0x73f4, 0x7400, 0x73f4,
+	0x7400, 0x7400, 0x73f4, 0x7400, 0x75ea, 0x7400, 0x7400, 0x7400,
+	0x7400, 0x7400, 0x73f4, 0x7400, 0x75ea, 0x73f4, 0x73f4, 0x7400,
+	0x73f4, 0x73f4, 0x73f4, 0x7400, 0x00e6, 0x2071, 0x18f0, 0x2009,
+	0x0400, 0x0071, 0x00ee, 0x0005, 0x2009, 0x1000, 0x0049, 0x0005,
+	0x2009, 0x2000, 0x0029, 0x0005, 0x2009, 0x0800, 0x0009, 0x0005,
+	0x7007, 0x0001, 0xa868, 0x9084, 0x00ff, 0x9105, 0xa86a, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x688c, 0x012e, 0x0005, 0xa864, 0x8007,
+	0x9084, 0x00ff, 0x0d08, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804,
+	0x75a8, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b,
+	0x75a8, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0968, 0x8001,
+	0x1120, 0x7007, 0x0001, 0x0804, 0x75c3, 0x7007, 0x0003, 0x7012,
+	0x2900, 0x7016, 0x701a, 0x704b, 0x75c3, 0x0005, 0xa864, 0x8007,
+	0x9084, 0x00ff, 0x9086, 0x0001, 0x1904, 0x73fc, 0x7007, 0x0001,
+	0x2009, 0x1833, 0x210c, 0x81ff, 0x1904, 0x74a0, 0xa994, 0x9186,
+	0x006f, 0x0188, 0x9186, 0x0074, 0x15b0, 0x0026, 0x2011, 0x0010,
+	0x080c, 0x6586, 0x002e, 0x0578, 0x0016, 0xa998, 0x080c, 0x65d0,
+	0x001e, 0x1548, 0x0400, 0x080c, 0x6fb2, 0x0140, 0xa897, 0x4005,
+	0xa89b, 0x0016, 0x2001, 0x0030, 0x900e, 0x0438, 0x0026, 0x2011,
+	0x8008, 0x080c, 0x6586, 0x002e, 0x01b0, 0x0016, 0x0026, 0x0036,
+	0xa998, 0xaaa0, 0xab9c, 0x918d, 0x8000, 0x080c, 0x65d0, 0x003e,
+	0x002e, 0x001e, 0x1140, 0xa897, 0x4005, 0xa89b, 0x4009, 0x2001,
+	0x0030, 0x900e, 0x0050, 0xa868, 0x9084, 0x00ff, 0xa86a, 0xa883,
+	0x0000, 0x080c, 0x5f00, 0x1108, 0x0005, 0x0126, 0x2091, 0x8000,
+	0xa867, 0x0139, 0xa87a, 0xa982, 0x080c, 0x688c, 0x012e, 0x0ca0,
+	0xa994, 0x9186, 0x0071, 0x0904, 0x744e, 0x9186, 0x0064, 0x0904,
+	0x744e, 0x9186, 0x007c, 0x0904, 0x744e, 0x9186, 0x0028, 0x0904,
+	0x744e, 0x9186, 0x0038, 0x0904, 0x744e, 0x9186, 0x0078, 0x0904,
+	0x744e, 0x9186, 0x005f, 0x0904, 0x744e, 0x9186, 0x0056, 0x0904,
+	0x744e, 0xa897, 0x4005, 0xa89b, 0x0001, 0x2001, 0x0030, 0x900e,
+	0x0860, 0xa87c, 0x9084, 0x00c0, 0x9086, 0x00c0, 0x1120, 0x7007,
+	0x0001, 0x0804, 0x77b8, 0x2900, 0x7016, 0x701a, 0x20a9, 0x0004,
+	0xa860, 0x20e0, 0xa85c, 0x9080, 0x0030, 0x2098, 0x7050, 0x2040,
+	0xa060, 0x20e8, 0xa05c, 0x9080, 0x0023, 0x20a0, 0x4003, 0xa888,
+	0x7012, 0x9082, 0x0401, 0x1a04, 0x7404, 0xaab4, 0x928a, 0x0002,
+	0x1a04, 0x7404, 0x82ff, 0x1138, 0xa8b8, 0xa9bc, 0x9105, 0x0118,
+	0x2001, 0x7566, 0x0018, 0x9280, 0x755c, 0x2005, 0x7056, 0x7010,
+	0x9015, 0x0904, 0x7547, 0x080c, 0x1004, 0x1118, 0x7007, 0x0004,
+	0x0005, 0x2900, 0x7022, 0x7054, 0x2060, 0xe000, 0xa866, 0x7050,
+	0x2040, 0xa95c, 0xe004, 0x9100, 0xa076, 0xa860, 0xa072, 0xe008,
+	0x920a, 0x1210, 0x900e, 0x2200, 0x7112, 0xe20c, 0x8003, 0x800b,
+	0x9296, 0x0004, 0x0108, 0x9108, 0xa17a, 0x810b, 0xa17e, 0x080c,
+	0x10d5, 0xa06c, 0x908e, 0x0100, 0x0170, 0x9086, 0x0200, 0x0118,
+	0x7007, 0x0007, 0x0005, 0x7020, 0x2048, 0x080c, 0x101d, 0x7014,
+	0x2048, 0x0804, 0x7404, 0x7020, 0x2048, 0x7018, 0xa802, 0xa807,
+	0x0000, 0x2908, 0x2048, 0xa906, 0x711a, 0x0804, 0x74ff, 0x7014,
+	0x2048, 0x7007, 0x0001, 0xa8b4, 0x9005, 0x1128, 0xa8b8, 0xa9bc,
+	0x9105, 0x0108, 0x00b9, 0xa864, 0x9084, 0x00ff, 0x9086, 0x001e,
+	0x0904, 0x77b8, 0x0804, 0x75a8, 0x755e, 0x7562, 0x0002, 0x001d,
+	0x0007, 0x0004, 0x000a, 0x001b, 0x0005, 0x0006, 0x000a, 0x001d,
+	0x0005, 0x0004, 0x0076, 0x0066, 0xafb8, 0xaebc, 0xa804, 0x2050,
+	0xb0c0, 0xb0e2, 0xb0bc, 0xb0de, 0xb0b8, 0xb0d2, 0xb0b4, 0xb0ce,
+	0xb6da, 0xb7d6, 0xb0b0, 0xb0ca, 0xb0ac, 0xb0c6, 0xb0a8, 0xb0ba,
+	0xb0a4, 0xb0b6, 0xb6c2, 0xb7be, 0xb0a0, 0xb0b2, 0xb09c, 0xb0ae,
+	0xb098, 0xb0a2, 0xb094, 0xb09e, 0xb6aa, 0xb7a6, 0xb090, 0xb09a,
+	0xb08c, 0xb096, 0xb088, 0xb08a, 0xb084, 0xb086, 0xb692, 0xb78e,
+	0xb080, 0xb082, 0xb07c, 0xb07e, 0xb078, 0xb072, 0xb074, 0xb06e,
+	0xb67a, 0xb776, 0xb004, 0x9055, 0x1958, 0x006e, 0x007e, 0x0005,
+	0x2009, 0x1833, 0x210c, 0x81ff, 0x1178, 0x080c, 0x5d4d, 0x1108,
+	0x0005, 0x080c, 0x6ac6, 0x0126, 0x2091, 0x8000, 0x080c, 0xbe06,
+	0x080c, 0x688c, 0x012e, 0x0ca0, 0x080c, 0xc20b, 0x1d70, 0x2001,
+	0x0028, 0x900e, 0x0c70, 0x2009, 0x1833, 0x210c, 0x81ff, 0x11d8,
+	0xa888, 0x9005, 0x01e0, 0xa883, 0x0000, 0xa87c, 0xd0f4, 0x0120,
+	0x080c, 0x5e62, 0x1138, 0x0005, 0x9006, 0xa87a, 0x080c, 0x5ddd,
+	0x1108, 0x0005, 0x0126, 0x2091, 0x8000, 0xa87a, 0xa982, 0x080c,
+	0x688c, 0x012e, 0x0cb0, 0x2001, 0x0028, 0x900e, 0x0c98, 0x2001,
+	0x0000, 0x0c80, 0x7018, 0xa802, 0x2908, 0x2048, 0xa906, 0x711a,
+	0x7010, 0x8001, 0x7012, 0x0118, 0x7007, 0x0003, 0x0030, 0x7014,
+	0x2048, 0x7007, 0x0001, 0x7048, 0x080f, 0x0005, 0x00b6, 0x7007,
+	0x0001, 0xa974, 0xa878, 0x9084, 0x00ff, 0x9096, 0x0004, 0x0540,
+	0x20a9, 0x0001, 0x9096, 0x0001, 0x0190, 0x900e, 0x20a9, 0x0800,
+	0x9096, 0x0002, 0x0160, 0x9005, 0x11d8, 0xa974, 0x080c, 0x623e,
+	0x11b8, 0x0066, 0xae80, 0x080c, 0x634e, 0x006e, 0x0088, 0x0046,
+	0x2011, 0x180c, 0x2224, 0xc484, 0x2412, 0x004e, 0x00c6, 0x080c,
+	0x623e, 0x1110, 0x080c, 0x644e, 0x8108, 0x1f04, 0x7627, 0x00ce,
+	0xa87c, 0xd084, 0x1120, 0x080c, 0x101d, 0x00be, 0x0005, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x688c, 0x012e, 0x00be, 0x0005, 0x0126,
+	0x2091, 0x8000, 0x7007, 0x0001, 0x080c, 0x655e, 0x0580, 0x2061,
+	0x1a41, 0x6100, 0xd184, 0x0178, 0xa888, 0x9084, 0x00ff, 0x1550,
+	0x6000, 0xd084, 0x0520, 0x6004, 0x9005, 0x1538, 0x6003, 0x0000,
+	0x600b, 0x0000, 0x00c8, 0x2011, 0x0001, 0xa890, 0x9005, 0x1110,
+	0x2001, 0x001e, 0x8000, 0x6016, 0xa888, 0x9084, 0x00ff, 0x0178,
+	0x6006, 0xa888, 0x8007, 0x9084, 0x00ff, 0x0148, 0x600a, 0xa888,
+	0x8000, 0x1108, 0xc28d, 0x6202, 0x012e, 0x0804, 0x7881, 0x012e,
+	0x0804, 0x787b, 0x012e, 0x0804, 0x7875, 0x012e, 0x0804, 0x7878,
+	0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x080c, 0x655e, 0x05e0,
+	0x2061, 0x1a41, 0x6000, 0xd084, 0x05b8, 0x6204, 0x6308, 0xd08c,
+	0x1530, 0xac78, 0x9484, 0x0003, 0x0170, 0xa988, 0x918c, 0x00ff,
+	0x8001, 0x1120, 0x2100, 0x9210, 0x0620, 0x0028, 0x8001, 0x1508,
+	0x2100, 0x9212, 0x02f0, 0x9484, 0x000c, 0x0188, 0xa988, 0x810f,
+	0x918c, 0x00ff, 0x9082, 0x0004, 0x1120, 0x2100, 0x9318, 0x0288,
+	0x0030, 0x9082, 0x0004, 0x1168, 0x2100, 0x931a, 0x0250, 0xa890,
+	0x9005, 0x0110, 0x8000, 0x6016, 0x6206, 0x630a, 0x012e, 0x0804,
+	0x7881, 0x012e, 0x0804, 0x787e, 0x012e, 0x0804, 0x787b, 0x0126,
+	0x2091, 0x8000, 0x7007, 0x0001, 0x2061, 0x1a41, 0x6300, 0xd38c,
+	0x1120, 0x6308, 0x8318, 0x0220, 0x630a, 0x012e, 0x0804, 0x788f,
+	0x012e, 0x0804, 0x787e, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000,
+	0x7007, 0x0001, 0xa87c, 0xd0ac, 0x0148, 0x00c6, 0x2061, 0x1a41,
+	0x6000, 0x9084, 0xfcff, 0x6002, 0x00ce, 0x0440, 0xa888, 0x9005,
+	0x05d8, 0xa88c, 0x9065, 0x0598, 0x2001, 0x1833, 0x2004, 0x9005,
+	0x0118, 0x080c, 0x9e62, 0x0068, 0x6017, 0xf400, 0x605b, 0x0000,
+	0xa97c, 0xd1a4, 0x0110, 0xa980, 0x615a, 0x2009, 0x0041, 0x080c,
+	0x9eac, 0xa988, 0x918c, 0xff00, 0x9186, 0x2000, 0x1138, 0x0026,
+	0x900e, 0x2011, 0xfdff, 0x080c, 0x822f, 0x002e, 0xa87c, 0xd0c4,
+	0x0148, 0x2061, 0x1a41, 0x6000, 0xd08c, 0x1120, 0x6008, 0x8000,
+	0x0208, 0x600a, 0x00ce, 0x012e, 0x00be, 0x0804, 0x7881, 0x00ce,
+	0x012e, 0x00be, 0x0804, 0x787b, 0xa984, 0x9186, 0x002e, 0x0d30,
+	0x9186, 0x002d, 0x0d18, 0x9186, 0x0045, 0x0510, 0x9186, 0x002a,
+	0x1130, 0x2001, 0x180c, 0x200c, 0xc194, 0x2102, 0x08b8, 0x9186,
+	0x0020, 0x0158, 0x9186, 0x0029, 0x1d10, 0xa974, 0x080c, 0x623e,
+	0x1968, 0xb800, 0xc0e4, 0xb802, 0x0848, 0xa88c, 0x9065, 0x09b8,
+	0x6007, 0x0024, 0x2001, 0x1957, 0x2004, 0x601a, 0x0804, 0x7716,
+	0xa88c, 0x9065, 0x0960, 0x00e6, 0xa890, 0x9075, 0x2001, 0x1833,
+	0x2004, 0x9005, 0x0150, 0x080c, 0x9e62, 0x8eff, 0x0118, 0x2e60,
+	0x080c, 0x9e62, 0x00ee, 0x0804, 0x7716, 0x6024, 0xc0dc, 0xc0d5,
+	0x6026, 0x2e60, 0x6007, 0x003a, 0xa8a0, 0x9005, 0x0130, 0x6007,
+	0x003b, 0xa8a4, 0x602e, 0xa8a8, 0x6016, 0x6003, 0x0001, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x00ee, 0x0804, 0x7716, 0x2061, 0x1a41,
+	0x6000, 0xd084, 0x0190, 0xd08c, 0x1904, 0x788f, 0x0126, 0x2091,
+	0x8000, 0x6204, 0x8210, 0x0220, 0x6206, 0x012e, 0x0804, 0x788f,
+	0x012e, 0xa883, 0x0016, 0x0804, 0x7888, 0xa883, 0x0007, 0x0804,
+	0x7888, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0130, 0x8001, 0x1138,
+	0x7007, 0x0001, 0x0069, 0x0005, 0x080c, 0x73fc, 0x0040, 0x7007,
+	0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x77b8, 0x0005,
+	0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0x903e, 0x2061, 0x1800,
+	0x61cc, 0x81ff, 0x1904, 0x783a, 0x6130, 0xd194, 0x1904, 0x7864,
+	0xa878, 0x2070, 0x9e82, 0x1cd0, 0x0a04, 0x782e, 0x6064, 0x9e02,
+	0x1a04, 0x782e, 0x7120, 0x9186, 0x0006, 0x1904, 0x7820, 0x7010,
+	0x905d, 0x0904, 0x783a, 0xb800, 0xd0e4, 0x1904, 0x785e, 0x2061,
+	0x1a41, 0x6100, 0x9184, 0x0301, 0x9086, 0x0001, 0x15a0, 0x7024,
+	0xd0dc, 0x1904, 0x7867, 0xa883, 0x0000, 0xa803, 0x0000, 0x2908,
+	0x7014, 0x9005, 0x1198, 0x7116, 0xa87c, 0xd0f4, 0x1904, 0x786a,
+	0x080c, 0x5386, 0xd09c, 0x1118, 0xa87c, 0xc0cc, 0xa87e, 0x2e60,
+	0x080c, 0x814f, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2048, 0xa800,
+	0x9005, 0x1de0, 0xa902, 0x2148, 0xa87c, 0xd0f4, 0x1904, 0x786a,
+	0x012e, 0x00ee, 0x00be, 0x0005, 0x012e, 0x00ee, 0xa883, 0x0006,
+	0x00be, 0x0804, 0x7888, 0xd184, 0x0db8, 0xd1c4, 0x1190, 0x00a0,
+	0xa974, 0x080c, 0x623e, 0x15d0, 0xb800, 0xd0e4, 0x15b8, 0x7120,
+	0x9186, 0x0007, 0x1118, 0xa883, 0x0002, 0x0490, 0xa883, 0x0008,
+	0x0478, 0xa883, 0x000e, 0x0460, 0xa883, 0x0017, 0x0448, 0xa883,
+	0x0035, 0x0430, 0x080c, 0x538a, 0xd0fc, 0x01e8, 0xa878, 0x2070,
+	0x9e82, 0x1cd0, 0x02c0, 0x6064, 0x9e02, 0x12a8, 0x7120, 0x9186,
+	0x0006, 0x1188, 0x7010, 0x905d, 0x0170, 0xb800, 0xd0bc, 0x0158,
+	0x2039, 0x0001, 0x7000, 0x9086, 0x0007, 0x1904, 0x77c4, 0x7003,
+	0x0002, 0x0804, 0x77c4, 0xa883, 0x0028, 0x0010, 0xa883, 0x0029,
+	0x012e, 0x00ee, 0x00be, 0x0420, 0xa883, 0x002a, 0x0cc8, 0xa883,
+	0x0045, 0x0cb0, 0x2e60, 0x2019, 0x0002, 0x601b, 0x0014, 0x080c,
+	0xd0e5, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2009, 0x003e, 0x0058,
+	0x2009, 0x0004, 0x0040, 0x2009, 0x0006, 0x0028, 0x2009, 0x0016,
+	0x0010, 0x2009, 0x0001, 0xa884, 0x9084, 0xff00, 0x9105, 0xa886,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x688c, 0x012e, 0x0005, 0x080c,
+	0x101d, 0x0005, 0x00d6, 0x080c, 0x8146, 0x00de, 0x0005, 0x00d6,
+	0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0x0040, 0x702c, 0xd084,
+	0x01d8, 0x908c, 0x0780, 0x190c, 0x7923, 0xd09c, 0x11a8, 0x2071,
+	0x1800, 0x70bc, 0x90ea, 0x0040, 0x0278, 0x8001, 0x70be, 0x702c,
+	0x2048, 0xa800, 0x702e, 0x9006, 0xa802, 0xa806, 0x2071, 0x0040,
+	0x2900, 0x7022, 0x702c, 0x0c28, 0x012e, 0x00ee, 0x00de, 0x0005,
+	0x0006, 0x9084, 0x0780, 0x190c, 0x7923, 0x000e, 0x0005, 0x00d6,
+	0x00c6, 0x0036, 0x0026, 0x0016, 0x00b6, 0x7007, 0x0001, 0xaa74,
+	0x9282, 0x0004, 0x1a04, 0x7914, 0xa97c, 0x9188, 0x1000, 0x2104,
+	0x905d, 0xb804, 0xd284, 0x0140, 0x05e8, 0x8007, 0x9084, 0x00ff,
+	0x9084, 0x0006, 0x1108, 0x04b0, 0x2b10, 0x080c, 0x9ddc, 0x1118,
+	0x080c, 0x9e7f, 0x05a8, 0x6212, 0xa874, 0x0002, 0x78f2, 0x78f7,
+	0x78fa, 0x7900, 0x2019, 0x0002, 0x080c, 0xd4a6, 0x0060, 0x080c,
+	0xd442, 0x0048, 0x2019, 0x0002, 0xa980, 0x080c, 0xd45d, 0x0018,
+	0xa980, 0x080c, 0xd442, 0x080c, 0x9e32, 0xa887, 0x0000, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x688c, 0x012e, 0x00be, 0x001e, 0x002e,
+	0x003e, 0x00ce, 0x00de, 0x0005, 0xa887, 0x0006, 0x0c80, 0xa887,
+	0x0002, 0x0c68, 0xa887, 0x0005, 0x0c50, 0xa887, 0x0004, 0x0c38,
+	0xa887, 0x0007, 0x0c20, 0x2091, 0x8000, 0x0e04, 0x7925, 0x0006,
+	0x0016, 0x2001, 0x8003, 0x0006, 0x0804, 0x0dbd, 0x2001, 0x1833,
+	0x2004, 0x9005, 0x0005, 0x0005, 0x00f6, 0x2079, 0x0300, 0x2001,
+	0x0200, 0x200c, 0xc1e5, 0xc1dc, 0x2102, 0x2009, 0x0218, 0x210c,
+	0xd1ec, 0x1120, 0x080c, 0x14a7, 0x00fe, 0x0005, 0x2001, 0x020d,
+	0x2003, 0x0020, 0x781f, 0x0300, 0x00fe, 0x0005, 0x781c, 0xd08c,
+	0x0904, 0x79a5, 0x68bc, 0x90aa, 0x0005, 0x0a04, 0x7f54, 0x7d44,
+	0x7c40, 0x9584, 0x00f6, 0x1510, 0x9484, 0x7000, 0x0140, 0x908a,
+	0x2000, 0x1260, 0x9584, 0x0700, 0x8007, 0x0804, 0x79ac, 0x7000,
+	0x9084, 0xff00, 0x9086, 0x8100, 0x0da8, 0x00b0, 0x9484, 0x0fff,
+	0x1130, 0x7000, 0x9084, 0xff00, 0x9086, 0x8100, 0x11c0, 0x080c,
+	0xd88c, 0x080c, 0x7e99, 0x7817, 0x0140, 0x00a8, 0x9584, 0x0076,
+	0x1118, 0x080c, 0x7ef7, 0x19c0, 0xd5a4, 0x0148, 0x0046, 0x0056,
+	0x080c, 0x7a07, 0x080c, 0x21cd, 0x005e, 0x004e, 0x0020, 0x080c,
+	0xd88c, 0x7817, 0x0140, 0x080c, 0x6fb2, 0x0168, 0x2001, 0x0111,
+	0x2004, 0xd08c, 0x0140, 0x688f, 0x0000, 0x2001, 0x0110, 0x2003,
+	0x0008, 0x2003, 0x0000, 0x080c, 0x79e8, 0x2001, 0x19c1, 0x2004,
+	0x9005, 0x090c, 0x8973, 0x0005, 0x0002, 0x79be, 0x7cbb, 0x79b5,
+	0x79b5, 0x79b5, 0x79b5, 0x79b5, 0x79b5, 0x7817, 0x0140, 0x2001,
+	0x19c1, 0x2004, 0x9005, 0x090c, 0x8973, 0x0005, 0x7000, 0x908c,
+	0xff00, 0x9194, 0xf000, 0x810f, 0x9484, 0x0fff, 0x688e, 0x9286,
+	0x2000, 0x1150, 0x6800, 0x9086, 0x0001, 0x1118, 0x080c, 0x53e7,
+	0x0070, 0x080c, 0x7a27, 0x0058, 0x9286, 0x3000, 0x1118, 0x080c,
+	0x7bf6, 0x0028, 0x9286, 0x8000, 0x1110, 0x080c, 0x7dc9, 0x7817,
+	0x0140, 0x2001, 0x19c1, 0x2004, 0x9005, 0x090c, 0x8973, 0x0005,
+	0x2001, 0x1810, 0x2004, 0xd08c, 0x0178, 0x2001, 0x1800, 0x2004,
+	0x9086, 0x0003, 0x1148, 0x0026, 0x0036, 0x2011, 0x8048, 0x2518,
+	0x080c, 0x48d9, 0x003e, 0x002e, 0x0005, 0x0036, 0x0046, 0x0056,
+	0x00f6, 0x2079, 0x0200, 0x2019, 0xfffe, 0x7c30, 0x0050, 0x0036,
+	0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x7d44, 0x7c40, 0x2019,
+	0xffff, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0160, 0x2001, 0x1800,
+	0x2004, 0x9086, 0x0003, 0x1130, 0x0026, 0x2011, 0x8048, 0x080c,
+	0x48d9, 0x002e, 0x00fe, 0x005e, 0x004e, 0x003e, 0x0005, 0x00b6,
+	0x00c6, 0x7010, 0x9084, 0xff00, 0x8007, 0x9096, 0x0001, 0x0120,
+	0x9096, 0x0023, 0x1904, 0x7bc7, 0x9186, 0x0023, 0x15c0, 0x080c,
+	0x7e5e, 0x0904, 0x7bc7, 0x6120, 0x9186, 0x0001, 0x0150, 0x9186,
+	0x0004, 0x0138, 0x9186, 0x0008, 0x0120, 0x9186, 0x000a, 0x1904,
+	0x7bc7, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200, 0x1130, 0x2009,
+	0x0015, 0x080c, 0x9eac, 0x0804, 0x7bc7, 0x908e, 0x0214, 0x0118,
+	0x908e, 0x0210, 0x1130, 0x2009, 0x0015, 0x080c, 0x9eac, 0x0804,
+	0x7bc7, 0x908e, 0x0100, 0x1904, 0x7bc7, 0x7034, 0x9005, 0x1904,
+	0x7bc7, 0x2009, 0x0016, 0x080c, 0x9eac, 0x0804, 0x7bc7, 0x9186,
+	0x0022, 0x1904, 0x7bc7, 0x7030, 0x908e, 0x0300, 0x1580, 0x68d8,
+	0xd0a4, 0x0528, 0xc0b5, 0x68da, 0x7100, 0x918c, 0x00ff, 0x697a,
+	0x7004, 0x687e, 0x00f6, 0x2079, 0x0100, 0x79e6, 0x78ea, 0x0006,
+	0x9084, 0x00ff, 0x0016, 0x2008, 0x080c, 0x26ac, 0x7932, 0x7936,
+	0x001e, 0x000e, 0x00fe, 0x080c, 0x2663, 0x695a, 0x703c, 0x00e6,
+	0x2071, 0x0140, 0x7086, 0x2071, 0x1800, 0x70b2, 0x00ee, 0x7034,
+	0x9005, 0x1904, 0x7bc7, 0x2009, 0x0017, 0x0804, 0x7b77, 0x908e,
+	0x0400, 0x1190, 0x7034, 0x9005, 0x1904, 0x7bc7, 0x080c, 0x6fb2,
+	0x0120, 0x2009, 0x001d, 0x0804, 0x7b77, 0x68d8, 0xc0a5, 0x68da,
+	0x2009, 0x0030, 0x0804, 0x7b77, 0x908e, 0x0500, 0x1140, 0x7034,
+	0x9005, 0x1904, 0x7bc7, 0x2009, 0x0018, 0x0804, 0x7b77, 0x908e,
+	0x2010, 0x1120, 0x2009, 0x0019, 0x0804, 0x7b77, 0x908e, 0x2110,
+	0x1120, 0x2009, 0x001a, 0x0804, 0x7b77, 0x908e, 0x5200, 0x1140,
+	0x7034, 0x9005, 0x1904, 0x7bc7, 0x2009, 0x001b, 0x0804, 0x7b77,
+	0x908e, 0x5000, 0x1140, 0x7034, 0x9005, 0x1904, 0x7bc7, 0x2009,
+	0x001c, 0x0804, 0x7b77, 0x908e, 0x1300, 0x1120, 0x2009, 0x0034,
+	0x0804, 0x7b77, 0x908e, 0x1200, 0x1140, 0x7034, 0x9005, 0x1904,
+	0x7bc7, 0x2009, 0x0024, 0x0804, 0x7b77, 0x908c, 0xff00, 0x918e,
+	0x2400, 0x1170, 0x2009, 0x002d, 0x2001, 0x1810, 0x2004, 0xd09c,
+	0x0904, 0x7b77, 0x080c, 0xc8b8, 0x1904, 0x7bc7, 0x0804, 0x7b75,
+	0x908c, 0xff00, 0x918e, 0x5300, 0x1120, 0x2009, 0x002a, 0x0804,
+	0x7b77, 0x908e, 0x0f00, 0x1120, 0x2009, 0x0020, 0x0804, 0x7b77,
+	0x908e, 0x6104, 0x1528, 0x2029, 0x0205, 0x2011, 0x026d, 0x8208,
+	0x2204, 0x9082, 0x0004, 0x8004, 0x8004, 0x20a8, 0x2011, 0x8015,
+	0x211c, 0x8108, 0x0046, 0x2124, 0x080c, 0x48d9, 0x004e, 0x8108,
+	0x0f04, 0x7b43, 0x9186, 0x0280, 0x1d88, 0x2504, 0x8000, 0x202a,
+	0x2009, 0x0260, 0x0c58, 0x202b, 0x0000, 0x2009, 0x0023, 0x0478,
+	0x908e, 0x6000, 0x1118, 0x2009, 0x003f, 0x0448, 0x908e, 0x7800,
+	0x1118, 0x2009, 0x0045, 0x0418, 0x908e, 0x1000, 0x1118, 0x2009,
+	0x004e, 0x00e8, 0x908e, 0x6300, 0x1118, 0x2009, 0x004a, 0x00b8,
+	0x908c, 0xff00, 0x918e, 0x5600, 0x1118, 0x2009, 0x004f, 0x0078,
+	0x908c, 0xff00, 0x918e, 0x5700, 0x1118, 0x2009, 0x0050, 0x0038,
+	0x2009, 0x001d, 0x6838, 0xd0d4, 0x0110, 0x2009, 0x004c, 0x0016,
+	0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2663, 0x1904,
+	0x7bca, 0x080c, 0x61de, 0x1904, 0x7bca, 0xbe12, 0xbd16, 0x001e,
+	0x0016, 0x080c, 0x6fb2, 0x01c0, 0x68d8, 0xd08c, 0x1148, 0x7000,
+	0x9084, 0x00ff, 0x1188, 0x7004, 0x9084, 0xff00, 0x1168, 0x0040,
+	0x6878, 0x9606, 0x1148, 0x687c, 0x9506, 0x9084, 0xff00, 0x1120,
+	0x9584, 0x00ff, 0xb8b2, 0x0080, 0xb8b0, 0x9005, 0x1168, 0x9186,
 	0x0046, 0x1150, 0x6878, 0x9606, 0x1138, 0x687c, 0x9506, 0x9084,
-	0xff00, 0x1110, 0x001e, 0x0098, 0x080c, 0x9dc3, 0x01a8, 0x2b08,
+	0xff00, 0x1110, 0x001e, 0x0098, 0x080c, 0x9ddc, 0x01a8, 0x2b08,
 	0x6112, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x9186, 0x004c,
-	0x1110, 0x6023, 0x000a, 0x0016, 0x001e, 0x080c, 0x9e93, 0x00ce,
+	0x1110, 0x6023, 0x000a, 0x0016, 0x001e, 0x080c, 0x9eac, 0x00ce,
 	0x00be, 0x0005, 0x001e, 0x0cd8, 0x2001, 0x180e, 0x2004, 0xd0ec,
-	0x0120, 0x2011, 0x8049, 0x080c, 0x48d2, 0x080c, 0x9e66, 0x0d90,
+	0x0120, 0x2011, 0x8049, 0x080c, 0x48d9, 0x080c, 0x9e7f, 0x0d90,
 	0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x0016,
 	0x9186, 0x0017, 0x0118, 0x9186, 0x0030, 0x1128, 0x6007, 0x0009,
 	0x6017, 0x2900, 0x0020, 0x6007, 0x0051, 0x6017, 0x0000, 0x602f,
-	0x0009, 0x6003, 0x0001, 0x080c, 0x8411, 0x08a0, 0x080c, 0x30f6,
+	0x0009, 0x6003, 0x0001, 0x080c, 0x8439, 0x08a0, 0x080c, 0x30fd,
 	0x1140, 0x7010, 0x9084, 0xff00, 0x8007, 0x908e, 0x0008, 0x1108,
 	0x0009, 0x0005, 0x00b6, 0x00c6, 0x0046, 0x7000, 0x908c, 0xff00,
-	0x810f, 0x9186, 0x0033, 0x11e8, 0x080c, 0x7e36, 0x0904, 0x7c2b,
+	0x810f, 0x9186, 0x0033, 0x11e8, 0x080c, 0x7e5e, 0x0904, 0x7c53,
 	0x7124, 0x610a, 0x7030, 0x908e, 0x0200, 0x1140, 0x7034, 0x9005,
-	0x15d0, 0x2009, 0x0015, 0x080c, 0x9e93, 0x04a8, 0x908e, 0x0100,
-	0x1590, 0x7034, 0x9005, 0x1578, 0x2009, 0x0016, 0x080c, 0x9e93,
+	0x15d0, 0x2009, 0x0015, 0x080c, 0x9eac, 0x04a8, 0x908e, 0x0100,
+	0x1590, 0x7034, 0x9005, 0x1578, 0x2009, 0x0016, 0x080c, 0x9eac,
 	0x0450, 0x9186, 0x0032, 0x1538, 0x7030, 0x908e, 0x1400, 0x1518,
 	0x2009, 0x0038, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
-	0x080c, 0x2663, 0x11b8, 0x080c, 0x61d7, 0x11a0, 0xbe12, 0xbd16,
-	0x080c, 0x9dc3, 0x0178, 0x2b08, 0x6112, 0x080c, 0xbf73, 0x6023,
-	0x0004, 0x7120, 0x610a, 0x001e, 0x080c, 0x9e93, 0x080c, 0x894b,
+	0x080c, 0x2663, 0x11b8, 0x080c, 0x61de, 0x11a0, 0xbe12, 0xbd16,
+	0x080c, 0x9ddc, 0x0178, 0x2b08, 0x6112, 0x080c, 0xbf8c, 0x6023,
+	0x0004, 0x7120, 0x610a, 0x001e, 0x080c, 0x9eac, 0x080c, 0x8973,
 	0x0010, 0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be, 0x0005, 0x00b6,
 	0x0046, 0x00e6, 0x00d6, 0x2028, 0x2130, 0x9696, 0x00ff, 0x11b8,
 	0x9592, 0xfffc, 0x02a0, 0x9596, 0xfffd, 0x1120, 0x2009, 0x007f,
-	0x0804, 0x7c8d, 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e, 0x0804,
-	0x7c8d, 0x9596, 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0, 0x2011,
+	0x0804, 0x7cb5, 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e, 0x0804,
+	0x7cb5, 0x9596, 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0, 0x2011,
 	0x0000, 0x2019, 0x1836, 0x231c, 0xd3ac, 0x0130, 0x9026, 0x20a9,
 	0x0800, 0x2071, 0x1000, 0x0030, 0x2021, 0x0081, 0x20a9, 0x077f,
 	0x2071, 0x1081, 0x2e1c, 0x93dd, 0x0000, 0x1140, 0x82ff, 0x11d0,
 	0x9496, 0x00ff, 0x01b8, 0x2410, 0xc2fd, 0x00a0, 0xbf10, 0x2600,
 	0x9706, 0xb814, 0x1120, 0x9546, 0x1110, 0x2408, 0x00b0, 0x9745,
 	0x1148, 0x94c6, 0x007e, 0x0130, 0x94c6, 0x007f, 0x0118, 0x94c6,
-	0x0080, 0x1d20, 0x8420, 0x8e70, 0x1f04, 0x7c62, 0x82ff, 0x1118,
+	0x0080, 0x1d20, 0x8420, 0x8e70, 0x1f04, 0x7c8a, 0x82ff, 0x1118,
 	0x9085, 0x0001, 0x0018, 0xc2fc, 0x2208, 0x9006, 0x00de, 0x00ee,
 	0x004e, 0x00be, 0x0005, 0x7000, 0x908c, 0xff00, 0x810f, 0x9184,
-	0x000f, 0x0002, 0x7caa, 0x7caa, 0x7caa, 0x7e48, 0x7caa, 0x7cb3,
-	0x7cde, 0x7d6c, 0x7caa, 0x7caa, 0x7caa, 0x7caa, 0x7caa, 0x7caa,
-	0x7caa, 0x7caa, 0x7817, 0x0140, 0x2001, 0x19c1, 0x2004, 0x9005,
-	0x090c, 0x894b, 0x0005, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7120,
+	0x000f, 0x0002, 0x7cd2, 0x7cd2, 0x7cd2, 0x7e70, 0x7cd2, 0x7cdb,
+	0x7d06, 0x7d94, 0x7cd2, 0x7cd2, 0x7cd2, 0x7cd2, 0x7cd2, 0x7cd2,
+	0x7cd2, 0x7cd2, 0x7817, 0x0140, 0x2001, 0x19c1, 0x2004, 0x9005,
+	0x090c, 0x8973, 0x0005, 0x00b6, 0x7110, 0xd1bc, 0x01e8, 0x7120,
 	0x2160, 0x9c8c, 0x0007, 0x11c0, 0x9c8a, 0x1cd0, 0x02a8, 0x6864,
 	0x9c02, 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910,
 	0x9106, 0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124, 0x610a,
-	0x2009, 0x0046, 0x080c, 0x9e93, 0x7817, 0x0140, 0x2001, 0x19c1,
-	0x2004, 0x9005, 0x090c, 0x894b, 0x00be, 0x0005, 0x00b6, 0x00c6,
-	0x9484, 0x0fff, 0x0904, 0x7d42, 0x7110, 0xd1bc, 0x1904, 0x7d42,
+	0x2009, 0x0046, 0x080c, 0x9eac, 0x7817, 0x0140, 0x2001, 0x19c1,
+	0x2004, 0x9005, 0x090c, 0x8973, 0x00be, 0x0005, 0x00b6, 0x00c6,
+	0x9484, 0x0fff, 0x0904, 0x7d6a, 0x7110, 0xd1bc, 0x1904, 0x7d6a,
 	0x7108, 0x700c, 0x2028, 0x918c, 0x00ff, 0x2130, 0x9094, 0xff00,
-	0x15b0, 0x81ff, 0x15a0, 0x9080, 0x3131, 0x200d, 0x918c, 0xff00,
-	0x810f, 0x2001, 0x0080, 0x9106, 0x0904, 0x7d42, 0x080c, 0x61d7,
-	0x1904, 0x7d42, 0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15d8, 0xba04,
-	0x9294, 0xff00, 0x9286, 0x0600, 0x11a0, 0x080c, 0x9dc3, 0x05e8,
+	0x15b0, 0x81ff, 0x15a0, 0x9080, 0x3138, 0x200d, 0x918c, 0xff00,
+	0x810f, 0x2001, 0x0080, 0x9106, 0x0904, 0x7d6a, 0x080c, 0x61de,
+	0x1904, 0x7d6a, 0xbe12, 0xbd16, 0xb800, 0xd0ec, 0x15d8, 0xba04,
+	0x9294, 0xff00, 0x9286, 0x0600, 0x11a0, 0x080c, 0x9ddc, 0x05e8,
 	0x2b08, 0x7028, 0x604a, 0x702c, 0x6046, 0x6112, 0x6023, 0x0006,
-	0x7120, 0x610a, 0x7130, 0x6156, 0x2009, 0x0044, 0x080c, 0xcaf6,
-	0x0408, 0x080c, 0x655b, 0x1138, 0xb807, 0x0606, 0x0c30, 0x190c,
-	0x7c2f, 0x11c0, 0x0898, 0x080c, 0x9dc3, 0x2b08, 0x0198, 0x6112,
+	0x7120, 0x610a, 0x7130, 0x6156, 0x2009, 0x0044, 0x080c, 0xcb14,
+	0x0408, 0x080c, 0x6562, 0x1138, 0xb807, 0x0606, 0x0c30, 0x190c,
+	0x7c57, 0x11c0, 0x0898, 0x080c, 0x9ddc, 0x2b08, 0x0198, 0x6112,
 	0x6023, 0x0004, 0x7120, 0x610a, 0x9286, 0x0400, 0x1118, 0x6007,
-	0x0005, 0x0010, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x8411,
-	0x080c, 0x894b, 0x7817, 0x0140, 0x2001, 0x19c1, 0x2004, 0x9005,
-	0x090c, 0x894b, 0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004,
-	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d2, 0x080c, 0x9e66,
+	0x0005, 0x0010, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x8439,
+	0x080c, 0x8973, 0x7817, 0x0140, 0x2001, 0x19c1, 0x2004, 0x9005,
+	0x090c, 0x8973, 0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004,
+	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d9, 0x080c, 0x9e7f,
 	0x0d48, 0x2b08, 0x6112, 0x6023, 0x0006, 0x7120, 0x610a, 0x7130,
 	0x6156, 0x6017, 0xf300, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
-	0x83c9, 0x080c, 0x894b, 0x08b0, 0x00b6, 0x7110, 0xd1bc, 0x01e8,
+	0x83f1, 0x080c, 0x8973, 0x08b0, 0x00b6, 0x7110, 0xd1bc, 0x01e8,
 	0x7020, 0x2060, 0x9c84, 0x0007, 0x11c0, 0x9c82, 0x1cd0, 0x02a8,
 	0x6864, 0x9c02, 0x1290, 0x7008, 0x9084, 0x00ff, 0x6110, 0x2158,
 	0xb910, 0x9106, 0x1150, 0x700c, 0xb914, 0x9106, 0x1130, 0x7124,
-	0x610a, 0x2009, 0x0045, 0x080c, 0x9e93, 0x7817, 0x0140, 0x2001,
-	0x19c1, 0x2004, 0x9005, 0x090c, 0x894b, 0x00be, 0x0005, 0x6120,
+	0x610a, 0x2009, 0x0045, 0x080c, 0x9eac, 0x7817, 0x0140, 0x2001,
+	0x19c1, 0x2004, 0x9005, 0x090c, 0x8973, 0x00be, 0x0005, 0x6120,
 	0x9186, 0x0002, 0x0128, 0x9186, 0x0005, 0x0110, 0x9085, 0x0001,
-	0x0005, 0x080c, 0x30f6, 0x1168, 0x7010, 0x9084, 0xff00, 0x8007,
+	0x0005, 0x080c, 0x30fd, 0x1168, 0x7010, 0x9084, 0xff00, 0x8007,
 	0x9086, 0x0000, 0x1130, 0x9184, 0x000f, 0x908a, 0x0006, 0x1208,
-	0x000b, 0x0005, 0x7db8, 0x7db9, 0x7db8, 0x7db8, 0x7e18, 0x7e27,
+	0x000b, 0x0005, 0x7de0, 0x7de1, 0x7de0, 0x7de0, 0x7e40, 0x7e4f,
 	0x0005, 0x00b6, 0x7110, 0xd1bc, 0x0120, 0x702c, 0xd084, 0x0904,
-	0x7e16, 0x700c, 0x7108, 0x080c, 0x2663, 0x1904, 0x7e16, 0x080c,
-	0x61d7, 0x1904, 0x7e16, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x01d8,
-	0x080c, 0x655b, 0x0118, 0x9086, 0x0004, 0x1588, 0x00c6, 0x080c,
-	0x7e36, 0x00ce, 0x05d8, 0x080c, 0x9dc3, 0x2b08, 0x05b8, 0x6112,
-	0x080c, 0xbf73, 0x6023, 0x0002, 0x7120, 0x610a, 0x2009, 0x0088,
-	0x080c, 0x9e93, 0x0458, 0x080c, 0x655b, 0x0148, 0x9086, 0x0004,
-	0x0130, 0x080c, 0x6563, 0x0118, 0x9086, 0x0004, 0x1180, 0x080c,
-	0x9dc3, 0x2b08, 0x01d8, 0x6112, 0x080c, 0xbf73, 0x6023, 0x0005,
-	0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0x9e93, 0x0078, 0x080c,
-	0x9dc3, 0x2b08, 0x0158, 0x6112, 0x080c, 0xbf73, 0x6023, 0x0004,
-	0x7120, 0x610a, 0x2009, 0x0001, 0x080c, 0x9e93, 0x00be, 0x0005,
-	0x7110, 0xd1bc, 0x0158, 0x00d1, 0x0148, 0x080c, 0x7d97, 0x1130,
-	0x7124, 0x610a, 0x2009, 0x0089, 0x080c, 0x9e93, 0x0005, 0x7110,
-	0xd1bc, 0x0158, 0x0059, 0x0148, 0x080c, 0x7d97, 0x1130, 0x7124,
-	0x610a, 0x2009, 0x008a, 0x080c, 0x9e93, 0x0005, 0x7020, 0x2060,
+	0x7e3e, 0x700c, 0x7108, 0x080c, 0x2663, 0x1904, 0x7e3e, 0x080c,
+	0x61de, 0x1904, 0x7e3e, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x01d8,
+	0x080c, 0x6562, 0x0118, 0x9086, 0x0004, 0x1588, 0x00c6, 0x080c,
+	0x7e5e, 0x00ce, 0x05d8, 0x080c, 0x9ddc, 0x2b08, 0x05b8, 0x6112,
+	0x080c, 0xbf8c, 0x6023, 0x0002, 0x7120, 0x610a, 0x2009, 0x0088,
+	0x080c, 0x9eac, 0x0458, 0x080c, 0x6562, 0x0148, 0x9086, 0x0004,
+	0x0130, 0x080c, 0x656a, 0x0118, 0x9086, 0x0004, 0x1180, 0x080c,
+	0x9ddc, 0x2b08, 0x01d8, 0x6112, 0x080c, 0xbf8c, 0x6023, 0x0005,
+	0x7120, 0x610a, 0x2009, 0x0088, 0x080c, 0x9eac, 0x0078, 0x080c,
+	0x9ddc, 0x2b08, 0x0158, 0x6112, 0x080c, 0xbf8c, 0x6023, 0x0004,
+	0x7120, 0x610a, 0x2009, 0x0001, 0x080c, 0x9eac, 0x00be, 0x0005,
+	0x7110, 0xd1bc, 0x0158, 0x00d1, 0x0148, 0x080c, 0x7dbf, 0x1130,
+	0x7124, 0x610a, 0x2009, 0x0089, 0x080c, 0x9eac, 0x0005, 0x7110,
+	0xd1bc, 0x0158, 0x0059, 0x0148, 0x080c, 0x7dbf, 0x1130, 0x7124,
+	0x610a, 0x2009, 0x008a, 0x080c, 0x9eac, 0x0005, 0x7020, 0x2060,
 	0x9c84, 0x0007, 0x1158, 0x9c82, 0x1cd0, 0x0240, 0x2001, 0x1819,
 	0x2004, 0x9c02, 0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8,
 	0x00b6, 0x7110, 0xd1bc, 0x11d8, 0x7024, 0x2060, 0x9c84, 0x0007,
 	0x11b0, 0x9c82, 0x1cd0, 0x0298, 0x6864, 0x9c02, 0x1280, 0x7008,
 	0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1140, 0x700c,
-	0xb914, 0x9106, 0x1120, 0x2009, 0x0051, 0x080c, 0x9e93, 0x7817,
-	0x0140, 0x2001, 0x19c1, 0x2004, 0x9005, 0x090c, 0x894b, 0x00be,
+	0xb914, 0x9106, 0x1120, 0x2009, 0x0051, 0x080c, 0x9eac, 0x7817,
+	0x0140, 0x2001, 0x19c1, 0x2004, 0x9005, 0x090c, 0x8973, 0x00be,
 	0x0005, 0x2031, 0x0105, 0x0069, 0x0005, 0x2031, 0x0206, 0x0049,
 	0x0005, 0x2031, 0x0207, 0x0029, 0x0005, 0x2031, 0x0213, 0x0009,
 	0x0005, 0x00c6, 0x0096, 0x00f6, 0x7000, 0x9084, 0xf000, 0x9086,
-	0xc000, 0x05d0, 0x080c, 0x9dc3, 0x05b8, 0x0066, 0x00c6, 0x0046,
+	0xc000, 0x05d0, 0x080c, 0x9ddc, 0x05b8, 0x0066, 0x00c6, 0x0046,
 	0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2663, 0x15a0,
-	0x080c, 0x61d7, 0x1588, 0xbe12, 0xbd16, 0x2b00, 0x004e, 0x00ce,
-	0x6012, 0x080c, 0xbf73, 0x080c, 0x0feb, 0x0510, 0x2900, 0x605a,
+	0x080c, 0x61de, 0x1588, 0xbe12, 0xbd16, 0x2b00, 0x004e, 0x00ce,
+	0x6012, 0x080c, 0xbf8c, 0x080c, 0x0feb, 0x0510, 0x2900, 0x605a,
 	0x9006, 0xa802, 0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b, 0x20a9,
 	0x000e, 0xa860, 0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98, 0x4003,
 	0x006e, 0x6616, 0x6007, 0x003e, 0x6023, 0x0001, 0x6003, 0x0001,
-	0x080c, 0x8411, 0x080c, 0x894b, 0x00fe, 0x009e, 0x00ce, 0x0005,
-	0x080c, 0x9e19, 0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6,
+	0x080c, 0x8439, 0x080c, 0x8973, 0x00fe, 0x009e, 0x00ce, 0x0005,
+	0x080c, 0x9e32, 0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6,
 	0x7000, 0x908c, 0xff00, 0x9184, 0xf000, 0x810f, 0x9086, 0x2000,
-	0x1904, 0x7f26, 0x9186, 0x0022, 0x15f0, 0x2001, 0x0111, 0x2004,
-	0x9005, 0x1904, 0x7f28, 0x7030, 0x908e, 0x0400, 0x0904, 0x7f28,
+	0x1904, 0x7f4e, 0x9186, 0x0022, 0x15f0, 0x2001, 0x0111, 0x2004,
+	0x9005, 0x1904, 0x7f50, 0x7030, 0x908e, 0x0400, 0x0904, 0x7f50,
 	0x908e, 0x6000, 0x05e8, 0x908e, 0x5400, 0x05d0, 0x908e, 0x0300,
 	0x11d8, 0x2009, 0x1836, 0x210c, 0xd18c, 0x1590, 0xd1a4, 0x1580,
-	0x080c, 0x6519, 0x0558, 0x68ac, 0x9084, 0x00ff, 0x7100, 0x918c,
+	0x080c, 0x6520, 0x0558, 0x68ac, 0x9084, 0x00ff, 0x7100, 0x918c,
 	0x00ff, 0x9106, 0x1518, 0x687c, 0x69ac, 0x918c, 0xff00, 0x9105,
 	0x7104, 0x9106, 0x11d8, 0x00e0, 0x2009, 0x0103, 0x210c, 0xd1b4,
 	0x11a8, 0x908e, 0x5200, 0x09e8, 0x908e, 0x0500, 0x09d0, 0x908e,
-	0x5000, 0x09b8, 0x0058, 0x9186, 0x0023, 0x1140, 0x080c, 0x7e36,
+	0x5000, 0x09b8, 0x0058, 0x9186, 0x0023, 0x1140, 0x080c, 0x7e5e,
 	0x0128, 0x6004, 0x9086, 0x0002, 0x0118, 0x0000, 0x9006, 0x0010,
 	0x9085, 0x0001, 0x00ce, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7800,
 	0xc0e5, 0xc0cc, 0x7802, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x1800,
@@ -3869,20 +3874,20 @@
 	0x7802, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7034, 0xc084,
 	0x7036, 0x00ee, 0x0005, 0x2071, 0x19cb, 0x7003, 0x0003, 0x700f,
 	0x0361, 0x9006, 0x701a, 0x7072, 0x7012, 0x7017, 0x1cd0, 0x7007,
-	0x0000, 0x7026, 0x702b, 0x93a9, 0x7032, 0x7037, 0x9417, 0x703f,
-	0xffff, 0x7042, 0x7047, 0x521e, 0x704a, 0x705b, 0x80ab, 0x080c,
+	0x0000, 0x7026, 0x702b, 0x93c2, 0x7032, 0x7037, 0x9430, 0x703f,
+	0xffff, 0x7042, 0x7047, 0x5225, 0x704a, 0x705b, 0x80d3, 0x080c,
 	0x1004, 0x090c, 0x0db4, 0x2900, 0x703a, 0xa867, 0x0003, 0xa86f,
-	0x0100, 0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x19cb, 0x1d04, 0x7fff,
+	0x0100, 0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x19cb, 0x1d04, 0x8027,
 	0x2091, 0x6000, 0x700c, 0x8001, 0x700e, 0x1510, 0x2001, 0x1875,
 	0x2004, 0xd0c4, 0x0158, 0x3a00, 0xd08c, 0x1140, 0x20d1, 0x0000,
 	0x20d1, 0x0001, 0x20d1, 0x0000, 0x080c, 0x0db4, 0x700f, 0x0361,
-	0x7007, 0x0001, 0x0126, 0x2091, 0x8000, 0x080c, 0x80f0, 0x7040,
+	0x7007, 0x0001, 0x0126, 0x2091, 0x8000, 0x080c, 0x8118, 0x7040,
 	0x900d, 0x0148, 0x8109, 0x7142, 0x1130, 0x7044, 0x080f, 0x0018,
 	0x0126, 0x2091, 0x8000, 0x7024, 0x900d, 0x0188, 0x7020, 0x8001,
 	0x7022, 0x1168, 0x7023, 0x0009, 0x8109, 0x7126, 0x9186, 0x03e8,
 	0x1110, 0x7028, 0x080f, 0x81ff, 0x1110, 0x7028, 0x080f, 0x7030,
 	0x900d, 0x0180, 0x702c, 0x8001, 0x702e, 0x1160, 0x702f, 0x0009,
-	0x8109, 0x7132, 0x0128, 0x9184, 0x007f, 0x090c, 0x9524, 0x0010,
+	0x8109, 0x7132, 0x0128, 0x9184, 0x007f, 0x090c, 0x953d, 0x0010,
 	0x7034, 0x080f, 0x703c, 0x9005, 0x0118, 0x0310, 0x8001, 0x703e,
 	0x704c, 0x900d, 0x0168, 0x7048, 0x8001, 0x704a, 0x1148, 0x704b,
 	0x0009, 0x8109, 0x714e, 0x1120, 0x7150, 0x714e, 0x7058, 0x080f,
@@ -3890,22 +3895,22 @@
 	0x8001, 0x706e, 0x1138, 0x706f, 0x0009, 0x8109, 0x7172, 0x1110,
 	0x7074, 0x080f, 0x001e, 0x7008, 0x8001, 0x700a, 0x1138, 0x700b,
 	0x0009, 0x8109, 0x711a, 0x1110, 0x701c, 0x080f, 0x012e, 0x7004,
-	0x0002, 0x8027, 0x8028, 0x8044, 0x00e6, 0x2071, 0x19cb, 0x7018,
+	0x0002, 0x804f, 0x8050, 0x806c, 0x00e6, 0x2071, 0x19cb, 0x7018,
 	0x9005, 0x1120, 0x711a, 0x721e, 0x700b, 0x0009, 0x00ee, 0x0005,
 	0x00e6, 0x0006, 0x2071, 0x19cb, 0x701c, 0x9206, 0x1120, 0x701a,
 	0x701e, 0x7072, 0x7076, 0x000e, 0x00ee, 0x0005, 0x00e6, 0x2071,
 	0x19cb, 0xb888, 0x9102, 0x0208, 0xb98a, 0x00ee, 0x0005, 0x0005,
-	0x00b6, 0x7110, 0x080c, 0x6237, 0x1168, 0xb888, 0x8001, 0x0250,
-	0xb88a, 0x1140, 0x0126, 0x2091, 0x8000, 0x0016, 0x080c, 0x894b,
+	0x00b6, 0x7110, 0x080c, 0x623e, 0x1168, 0xb888, 0x8001, 0x0250,
+	0xb88a, 0x1140, 0x0126, 0x2091, 0x8000, 0x0016, 0x080c, 0x8973,
 	0x001e, 0x012e, 0x8108, 0x9182, 0x0800, 0x0218, 0x900e, 0x7007,
 	0x0002, 0x7112, 0x00be, 0x0005, 0x7014, 0x2060, 0x0126, 0x2091,
 	0x8000, 0x6040, 0x9005, 0x0128, 0x8001, 0x6042, 0x1110, 0x080c,
-	0xbe04, 0x6018, 0x9005, 0x0528, 0x8001, 0x601a, 0x1510, 0x6120,
-	0x9186, 0x0003, 0x0118, 0x9186, 0x0006, 0x11c8, 0x080c, 0xbafe,
+	0xbe1d, 0x6018, 0x9005, 0x0528, 0x8001, 0x601a, 0x1510, 0x6120,
+	0x9186, 0x0003, 0x0118, 0x9186, 0x0006, 0x11c8, 0x080c, 0xbb17,
 	0x01b0, 0x6014, 0x2048, 0xa884, 0x908a, 0x199a, 0x0280, 0x9082,
 	0x1999, 0xa886, 0x908a, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003,
 	0x800b, 0x810b, 0x9108, 0x611a, 0xa87c, 0xd0e4, 0x0110, 0x080c,
-	0xb7fc, 0x012e, 0x9c88, 0x0018, 0x7116, 0x2001, 0x1819, 0x2004,
+	0xb815, 0x012e, 0x9c88, 0x0018, 0x7116, 0x2001, 0x1819, 0x2004,
 	0x9102, 0x0220, 0x7017, 0x1cd0, 0x7007, 0x0000, 0x0005, 0x00e6,
 	0x2071, 0x19cb, 0x7027, 0x07d0, 0x7023, 0x0009, 0x00ee, 0x0005,
 	0x2001, 0x19d4, 0x2003, 0x0000, 0x0005, 0x00e6, 0x2071, 0x19cb,
@@ -3915,7 +3920,7 @@
 	0x2001, 0x19d9, 0x2044, 0xa06c, 0x9086, 0x0000, 0x0150, 0x7068,
 	0xa09a, 0x7064, 0xa096, 0x7060, 0xa092, 0x705c, 0xa08e, 0x080c,
 	0x10d5, 0x002e, 0x008e, 0x0005, 0x0006, 0x0016, 0x0096, 0x00a6,
-	0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x080c, 0x7f74,
+	0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0156, 0x080c, 0x7f9c,
 	0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
 	0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x19cb, 0x7172, 0x7276,
 	0x706f, 0x0009, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x2071, 0x19cb,
@@ -3930,93 +3935,93 @@
 	0x908a, 0x199a, 0x1638, 0x9005, 0x1150, 0x00c6, 0x2061, 0x1a41,
 	0x6014, 0x00ce, 0x9005, 0x1130, 0x2001, 0x001e, 0x0018, 0x908e,
 	0xffff, 0x01b0, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0xa87c,
-	0x908c, 0x00c0, 0x918e, 0x00c0, 0x0904, 0x81b1, 0xd0b4, 0x1168,
-	0xd0bc, 0x1904, 0x818a, 0x2009, 0x0006, 0x080c, 0x81de, 0x0005,
+	0x908c, 0x00c0, 0x918e, 0x00c0, 0x0904, 0x81d9, 0xd0b4, 0x1168,
+	0xd0bc, 0x1904, 0x81b2, 0x2009, 0x0006, 0x080c, 0x8206, 0x0005,
 	0x900e, 0x0c60, 0x2001, 0x1999, 0x08b0, 0xd0fc, 0x0160, 0x908c,
-	0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x81d8, 0x908c, 0x2020,
+	0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x8200, 0x908c, 0x2020,
 	0x918e, 0x2020, 0x01a8, 0x6024, 0xd0d4, 0x11e8, 0x2009, 0x1875,
 	0x2104, 0xd084, 0x1138, 0x87ff, 0x1120, 0x2009, 0x0043, 0x0804,
-	0x9e93, 0x0005, 0x87ff, 0x1de8, 0x2009, 0x0042, 0x0804, 0x9e93,
+	0x9eac, 0x0005, 0x87ff, 0x1de8, 0x2009, 0x0042, 0x0804, 0x9eac,
 	0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d20, 0x6024,
 	0xc0cd, 0x6026, 0x0c00, 0xc0d4, 0x6026, 0xa890, 0x602e, 0xa88c,
 	0x6032, 0x08e0, 0xd0fc, 0x0160, 0x908c, 0x0003, 0x0120, 0x918e,
-	0x0003, 0x1904, 0x81d8, 0x908c, 0x2020, 0x918e, 0x2020, 0x0170,
+	0x0003, 0x1904, 0x8200, 0x908c, 0x2020, 0x918e, 0x2020, 0x0170,
 	0x0076, 0x00f6, 0x2c78, 0x080c, 0x1648, 0x00fe, 0x007e, 0x87ff,
-	0x1120, 0x2009, 0x0042, 0x080c, 0x9e93, 0x0005, 0x6110, 0x00b6,
+	0x1120, 0x2009, 0x0042, 0x080c, 0x9eac, 0x0005, 0x6110, 0x00b6,
 	0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d58, 0x6124, 0xc1cd, 0x6126,
 	0x0c38, 0xd0fc, 0x0188, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8,
 	0x9084, 0x0003, 0x908e, 0x0002, 0x0148, 0x87ff, 0x1120, 0x2009,
-	0x0041, 0x080c, 0x9e93, 0x0005, 0x00b9, 0x0ce8, 0x87ff, 0x1dd8,
-	0x2009, 0x0043, 0x080c, 0x9e93, 0x0cb0, 0x6110, 0x00b6, 0x2158,
+	0x0041, 0x080c, 0x9eac, 0x0005, 0x00b9, 0x0ce8, 0x87ff, 0x1dd8,
+	0x2009, 0x0043, 0x080c, 0x9eac, 0x0cb0, 0x6110, 0x00b6, 0x2158,
 	0xb900, 0x00be, 0xd1ac, 0x0d20, 0x6124, 0xc1cd, 0x6126, 0x0c00,
 	0x2009, 0x0004, 0x0019, 0x0005, 0x2009, 0x0001, 0x0096, 0x080c,
-	0xbafe, 0x0518, 0x6014, 0x2048, 0xa982, 0xa800, 0x6016, 0x9186,
+	0xbb17, 0x0518, 0x6014, 0x2048, 0xa982, 0xa800, 0x6016, 0x9186,
 	0x0001, 0x1188, 0xa97c, 0x918c, 0x8100, 0x918e, 0x8100, 0x1158,
 	0x00c6, 0x2061, 0x1a41, 0x6200, 0xd28c, 0x1120, 0x6204, 0x8210,
-	0x0208, 0x6206, 0x00ce, 0x080c, 0x66bf, 0x6014, 0x904d, 0x0076,
-	0x2039, 0x0000, 0x190c, 0x8127, 0x007e, 0x009e, 0x0005, 0x0156,
+	0x0208, 0x6206, 0x00ce, 0x080c, 0x66c6, 0x6014, 0x904d, 0x0076,
+	0x2039, 0x0000, 0x190c, 0x814f, 0x007e, 0x009e, 0x0005, 0x0156,
 	0x00c6, 0x2061, 0x1a41, 0x6000, 0x81ff, 0x0110, 0x9205, 0x0008,
 	0x9204, 0x6002, 0x00ce, 0x015e, 0x0005, 0x6800, 0xd08c, 0x1138,
 	0x6808, 0x9005, 0x0120, 0x8001, 0x680a, 0x9085, 0x0001, 0x0005,
 	0x0126, 0x2091, 0x8000, 0x0036, 0x0046, 0x20a9, 0x0010, 0x9006,
 	0x8004, 0x2019, 0x0100, 0x231c, 0x93a6, 0x0008, 0x1118, 0x8086,
 	0x818e, 0x0020, 0x80f6, 0x3e00, 0x81f6, 0x3e08, 0x1208, 0x9200,
-	0x1f04, 0x8229, 0x93a6, 0x0008, 0x1118, 0x8086, 0x818e, 0x0020,
+	0x1f04, 0x8251, 0x93a6, 0x0008, 0x1118, 0x8086, 0x818e, 0x0020,
 	0x80f6, 0x3e00, 0x81f6, 0x3e08, 0x004e, 0x003e, 0x012e, 0x0005,
 	0x0126, 0x2091, 0x8000, 0x0076, 0x0156, 0x20a9, 0x0010, 0x9005,
 	0x0510, 0x911a, 0x1600, 0x8213, 0x2039, 0x0100, 0x273c, 0x97be,
 	0x0008, 0x1110, 0x818d, 0x0010, 0x81f5, 0x3e08, 0x0228, 0x911a,
-	0x1220, 0x1f04, 0x8253, 0x0028, 0x911a, 0x2308, 0x8210, 0x1f04,
-	0x8253, 0x0006, 0x3200, 0x9084, 0xefff, 0x2080, 0x000e, 0x015e,
+	0x1220, 0x1f04, 0x827b, 0x0028, 0x911a, 0x2308, 0x8210, 0x1f04,
+	0x827b, 0x0006, 0x3200, 0x9084, 0xefff, 0x2080, 0x000e, 0x015e,
 	0x007e, 0x012e, 0x0005, 0x0006, 0x3200, 0x9085, 0x1000, 0x0ca8,
 	0x0126, 0x2091, 0x2800, 0x2079, 0x19b8, 0x012e, 0x00d6, 0x2069,
 	0x19b8, 0x6803, 0x0005, 0x0156, 0x0146, 0x01d6, 0x20e9, 0x0000,
-	0x2069, 0x0200, 0x080c, 0x9c26, 0x0401, 0x080c, 0x9c11, 0x00e9,
-	0x080c, 0x9c14, 0x00d1, 0x080c, 0x9c17, 0x00b9, 0x080c, 0x9c1a,
-	0x00a1, 0x080c, 0x9c1d, 0x0089, 0x080c, 0x9c20, 0x0071, 0x080c,
-	0x9c23, 0x0059, 0x01de, 0x014e, 0x015e, 0x2069, 0x0004, 0x2d04,
+	0x2069, 0x0200, 0x080c, 0x9c3f, 0x0401, 0x080c, 0x9c2a, 0x00e9,
+	0x080c, 0x9c2d, 0x00d1, 0x080c, 0x9c30, 0x00b9, 0x080c, 0x9c33,
+	0x00a1, 0x080c, 0x9c36, 0x0089, 0x080c, 0x9c39, 0x0071, 0x080c,
+	0x9c3c, 0x0059, 0x01de, 0x014e, 0x015e, 0x2069, 0x0004, 0x2d04,
 	0x9085, 0x8001, 0x206a, 0x00de, 0x0005, 0x20a9, 0x0020, 0x20a1,
 	0x0240, 0x2001, 0x0000, 0x4004, 0x0005, 0x00c6, 0x6027, 0x0001,
-	0x7804, 0x9084, 0x0007, 0x0002, 0x82c6, 0x82ea, 0x8329, 0x82cc,
-	0x82ea, 0x82c6, 0x82c4, 0x82c4, 0x080c, 0x0db4, 0x080c, 0x8090,
-	0x080c, 0x894b, 0x00ce, 0x0005, 0x62c0, 0x82ff, 0x1110, 0x00ce,
-	0x0005, 0x2011, 0x5b33, 0x080c, 0x8010, 0x7828, 0x9092, 0x00c8,
-	0x1228, 0x8000, 0x782a, 0x080c, 0x5b73, 0x0c88, 0x62c0, 0x080c,
-	0x9c2a, 0x080c, 0x5b33, 0x7807, 0x0003, 0x7827, 0x0000, 0x782b,
-	0x0000, 0x0c28, 0x080c, 0x8090, 0x6220, 0xd2a4, 0x0160, 0x782b,
+	0x7804, 0x9084, 0x0007, 0x0002, 0x82ee, 0x8312, 0x8351, 0x82f4,
+	0x8312, 0x82ee, 0x82ec, 0x82ec, 0x080c, 0x0db4, 0x080c, 0x80b8,
+	0x080c, 0x8973, 0x00ce, 0x0005, 0x62c0, 0x82ff, 0x1110, 0x00ce,
+	0x0005, 0x2011, 0x5b3a, 0x080c, 0x8038, 0x7828, 0x9092, 0x00c8,
+	0x1228, 0x8000, 0x782a, 0x080c, 0x5b7a, 0x0c88, 0x62c0, 0x080c,
+	0x9c43, 0x080c, 0x5b3a, 0x7807, 0x0003, 0x7827, 0x0000, 0x782b,
+	0x0000, 0x0c28, 0x080c, 0x80b8, 0x6220, 0xd2a4, 0x0160, 0x782b,
 	0x0000, 0x7824, 0x9065, 0x090c, 0x0db4, 0x2009, 0x0013, 0x080c,
-	0x9e93, 0x00ce, 0x0005, 0x00c6, 0x7824, 0x9065, 0x090c, 0x0db4,
+	0x9eac, 0x00ce, 0x0005, 0x00c6, 0x7824, 0x9065, 0x090c, 0x0db4,
 	0x7828, 0x9092, 0xc350, 0x12c0, 0x8000, 0x782a, 0x00ce, 0x080c,
 	0x29ca, 0x0278, 0x00c6, 0x7924, 0x2160, 0x6010, 0x906d, 0x090c,
-	0x0db4, 0x7807, 0x0000, 0x7827, 0x0000, 0x00ce, 0x080c, 0x894b,
-	0x0c00, 0x080c, 0x936f, 0x08e8, 0x2011, 0x0130, 0x2214, 0x080c,
-	0x9c2a, 0x080c, 0xd8a9, 0x2009, 0x0014, 0x080c, 0x9e93, 0x00ce,
+	0x0db4, 0x7807, 0x0000, 0x7827, 0x0000, 0x00ce, 0x080c, 0x8973,
+	0x0c00, 0x080c, 0x9388, 0x08e8, 0x2011, 0x0130, 0x2214, 0x080c,
+	0x9c43, 0x080c, 0xd8c9, 0x2009, 0x0014, 0x080c, 0x9eac, 0x00ce,
 	0x0880, 0x2001, 0x19d4, 0x2003, 0x0000, 0x62c0, 0x82ff, 0x1160,
 	0x782b, 0x0000, 0x7824, 0x9065, 0x090c, 0x0db4, 0x2009, 0x0013,
-	0x080c, 0x9ee5, 0x00ce, 0x0005, 0x00b6, 0x00c6, 0x00d6, 0x7824,
+	0x080c, 0x9efe, 0x00ce, 0x0005, 0x00b6, 0x00c6, 0x00d6, 0x7824,
 	0x9005, 0x090c, 0x0db4, 0x7828, 0x9092, 0xc350, 0x1648, 0x8000,
 	0x782a, 0x00de, 0x00ce, 0x00be, 0x080c, 0x29ca, 0x02f0, 0x00b6,
 	0x00c6, 0x00d6, 0x781c, 0x905d, 0x090c, 0x0db4, 0xb800, 0xc0dc,
-	0xb802, 0x7924, 0x2160, 0x080c, 0x9e19, 0xb93c, 0x81ff, 0x090c,
+	0xb802, 0x7924, 0x2160, 0x080c, 0x9e32, 0xb93c, 0x81ff, 0x090c,
 	0x0db4, 0x8109, 0xb93e, 0x7807, 0x0000, 0x7827, 0x0000, 0x00de,
-	0x00ce, 0x00be, 0x080c, 0x894b, 0x0868, 0x080c, 0x936f, 0x0850,
-	0x2011, 0x0130, 0x2214, 0x080c, 0x9c2a, 0x080c, 0xd8a9, 0x7824,
-	0x9065, 0x2009, 0x0014, 0x080c, 0x9e93, 0x00de, 0x00ce, 0x00be,
-	0x0804, 0x833a, 0x00c6, 0x2001, 0x009b, 0x2004, 0xd0fc, 0x190c,
+	0x00ce, 0x00be, 0x080c, 0x8973, 0x0868, 0x080c, 0x9388, 0x0850,
+	0x2011, 0x0130, 0x2214, 0x080c, 0x9c43, 0x080c, 0xd8c9, 0x7824,
+	0x9065, 0x2009, 0x0014, 0x080c, 0x9eac, 0x00de, 0x00ce, 0x00be,
+	0x0804, 0x8362, 0x00c6, 0x2001, 0x009b, 0x2004, 0xd0fc, 0x190c,
 	0x1d4a, 0x6024, 0x6027, 0x0002, 0xd0f4, 0x1580, 0x62c8, 0x60c4,
 	0x9205, 0x1170, 0x783c, 0x9065, 0x0130, 0x2009, 0x0049, 0x080c,
-	0x9e93, 0x00ce, 0x0005, 0x2011, 0x19d7, 0x2013, 0x0000, 0x0cc8,
+	0x9eac, 0x00ce, 0x0005, 0x2011, 0x19d7, 0x2013, 0x0000, 0x0cc8,
 	0x793c, 0x81ff, 0x0dc0, 0x7944, 0x9192, 0x7530, 0x12f0, 0x8108,
 	0x7946, 0x793c, 0x9188, 0x0008, 0x210c, 0x918e, 0x0006, 0x1138,
 	0x6014, 0x9084, 0x1984, 0x9085, 0x0012, 0x6016, 0x0c10, 0x6014,
 	0x9084, 0x1984, 0x9085, 0x0016, 0x6016, 0x08d8, 0x793c, 0x2160,
-	0x2009, 0x004a, 0x080c, 0x9e93, 0x08a0, 0x7848, 0xc085, 0x784a,
+	0x2009, 0x004a, 0x080c, 0x9eac, 0x08a0, 0x7848, 0xc085, 0x784a,
 	0x0880, 0x0006, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x600f,
 	0x0000, 0x2c08, 0x2061, 0x19b8, 0x6020, 0x8000, 0x6022, 0x6010,
 	0x9005, 0x0148, 0x9080, 0x0003, 0x2102, 0x6112, 0x012e, 0x00ce,
 	0x001e, 0x000e, 0x0005, 0x6116, 0x6112, 0x0cc0, 0x00d6, 0x2069,
 	0x19b8, 0xb800, 0xd0d4, 0x0168, 0x6820, 0x8000, 0x6822, 0x9086,
-	0x0001, 0x1110, 0x2b00, 0x681e, 0x00de, 0x0804, 0x894b, 0x00de,
+	0x0001, 0x1110, 0x2b00, 0x681e, 0x00de, 0x0804, 0x8973, 0x00de,
 	0x0005, 0xc0d5, 0xb802, 0x6818, 0x9005, 0x0168, 0xb856, 0xb85b,
 	0x0000, 0x0086, 0x0006, 0x2b00, 0x681a, 0x008e, 0xa05a, 0x008e,
 	0x2069, 0x19b8, 0x0c08, 0xb856, 0xb85a, 0x2b00, 0x681a, 0x681e,
@@ -4029,156 +4034,156 @@
 	0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00b6, 0x0096, 0x0076,
 	0x0066, 0x0056, 0x0036, 0x0026, 0x0016, 0x0006, 0x0126, 0x902e,
 	0x2071, 0x19b8, 0x7638, 0x2660, 0x2678, 0x2091, 0x8000, 0x8cff,
-	0x0904, 0x84b8, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x84b3,
-	0x87ff, 0x0120, 0x6054, 0x9106, 0x1904, 0x84b3, 0x703c, 0x9c06,
-	0x1178, 0x0036, 0x2019, 0x0001, 0x080c, 0x96bf, 0x7033, 0x0000,
+	0x0904, 0x84e0, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x84db,
+	0x87ff, 0x0120, 0x6054, 0x9106, 0x1904, 0x84db, 0x703c, 0x9c06,
+	0x1178, 0x0036, 0x2019, 0x0001, 0x080c, 0x96d8, 0x7033, 0x0000,
 	0x9006, 0x703e, 0x7042, 0x7046, 0x704a, 0x003e, 0x2029, 0x0001,
 	0x7038, 0x9c36, 0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140,
 	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000,
 	0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678,
-	0x600f, 0x0000, 0x080c, 0xbafe, 0x01c8, 0x6014, 0x2048, 0x6020,
+	0x600f, 0x0000, 0x080c, 0xbb17, 0x01c8, 0x6014, 0x2048, 0x6020,
 	0x9086, 0x0003, 0x1590, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
-	0x0016, 0x0036, 0x0076, 0x080c, 0xbded, 0x080c, 0xd7b3, 0x080c,
-	0x6885, 0x007e, 0x003e, 0x001e, 0x080c, 0xbce7, 0x080c, 0x9e49,
-	0x00ce, 0x0804, 0x8457, 0x2c78, 0x600c, 0x2060, 0x0804, 0x8457,
-	0x85ff, 0x0120, 0x0036, 0x080c, 0x8a26, 0x003e, 0x012e, 0x000e,
+	0x0016, 0x0036, 0x0076, 0x080c, 0xbe06, 0x080c, 0xd7d3, 0x080c,
+	0x688c, 0x007e, 0x003e, 0x001e, 0x080c, 0xbd00, 0x080c, 0x9e62,
+	0x00ce, 0x0804, 0x847f, 0x2c78, 0x600c, 0x2060, 0x0804, 0x847f,
+	0x85ff, 0x0120, 0x0036, 0x080c, 0x8a4e, 0x003e, 0x012e, 0x000e,
 	0x001e, 0x002e, 0x003e, 0x005e, 0x006e, 0x007e, 0x009e, 0x00be,
 	0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086, 0x0006,
-	0x1158, 0x0016, 0x0036, 0x0076, 0x080c, 0xd7b3, 0x080c, 0xd4b5,
+	0x1158, 0x0016, 0x0036, 0x0076, 0x080c, 0xd7d3, 0x080c, 0xd4d5,
 	0x007e, 0x003e, 0x001e, 0x0890, 0x6020, 0x9086, 0x000a, 0x0904,
-	0x849d, 0x0804, 0x849b, 0x0006, 0x0066, 0x0096, 0x00c6, 0x00d6,
+	0x84c5, 0x0804, 0x84c3, 0x0006, 0x0066, 0x0096, 0x00c6, 0x00d6,
 	0x00f6, 0x9036, 0x0126, 0x2091, 0x8000, 0x2079, 0x19b8, 0x7838,
-	0x9065, 0x0904, 0x8533, 0x600c, 0x0006, 0x600f, 0x0000, 0x783c,
-	0x9c06, 0x1168, 0x0036, 0x2019, 0x0001, 0x080c, 0x96bf, 0x7833,
+	0x9065, 0x0904, 0x855b, 0x600c, 0x0006, 0x600f, 0x0000, 0x783c,
+	0x9c06, 0x1168, 0x0036, 0x2019, 0x0001, 0x080c, 0x96d8, 0x7833,
 	0x0000, 0x901e, 0x7b3e, 0x7b42, 0x7b46, 0x7b4a, 0x003e, 0x080c,
-	0xbafe, 0x0520, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1568,
+	0xbb17, 0x0520, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1568,
 	0x3e08, 0x918e, 0x0002, 0x1188, 0x6010, 0x9005, 0x0170, 0x00b6,
 	0x2058, 0xb800, 0x00be, 0xd0bc, 0x0140, 0x6040, 0x9005, 0x1180,
 	0x2001, 0x1959, 0x2004, 0x6042, 0x0058, 0xa867, 0x0103, 0xab7a,
-	0xa877, 0x0000, 0x080c, 0x6878, 0x080c, 0xbce7, 0x080c, 0x9e49,
-	0x000e, 0x0804, 0x84f0, 0x7e3a, 0x7e36, 0x012e, 0x00fe, 0x00de,
+	0xa877, 0x0000, 0x080c, 0x687f, 0x080c, 0xbd00, 0x080c, 0x9e62,
+	0x000e, 0x0804, 0x8518, 0x7e3a, 0x7e36, 0x012e, 0x00fe, 0x00de,
 	0x00ce, 0x009e, 0x006e, 0x000e, 0x0005, 0x6020, 0x9086, 0x0006,
-	0x1118, 0x080c, 0xd4b5, 0x0c50, 0x6020, 0x9086, 0x000a, 0x09f8,
-	0x08e0, 0x0016, 0x0026, 0x0086, 0x9046, 0x0099, 0x080c, 0x8632,
+	0x1118, 0x080c, 0xd4d5, 0x0c50, 0x6020, 0x9086, 0x000a, 0x09f8,
+	0x08e0, 0x0016, 0x0026, 0x0086, 0x9046, 0x0099, 0x080c, 0x865a,
 	0x008e, 0x002e, 0x001e, 0x0005, 0x00f6, 0x0126, 0x2079, 0x19b8,
-	0x2091, 0x8000, 0x080c, 0x86c9, 0x080c, 0x8757, 0x012e, 0x00fe,
+	0x2091, 0x8000, 0x080c, 0x86f1, 0x080c, 0x877f, 0x012e, 0x00fe,
 	0x0005, 0x00b6, 0x0096, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066,
 	0x0016, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x7614,
-	0x2660, 0x2678, 0x8cff, 0x0904, 0x85f7, 0x6010, 0x2058, 0xb8a0,
-	0x9206, 0x1904, 0x85f2, 0x88ff, 0x0120, 0x6054, 0x9106, 0x1904,
-	0x85f2, 0x7024, 0x9c06, 0x1558, 0x2069, 0x0100, 0x6820, 0xd0a4,
-	0x1508, 0x080c, 0x8090, 0x080c, 0x9393, 0x68c3, 0x0000, 0x080c,
-	0x98c1, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384,
+	0x2660, 0x2678, 0x8cff, 0x0904, 0x861f, 0x6010, 0x2058, 0xb8a0,
+	0x9206, 0x1904, 0x861a, 0x88ff, 0x0120, 0x6054, 0x9106, 0x1904,
+	0x861a, 0x7024, 0x9c06, 0x1558, 0x2069, 0x0100, 0x6820, 0xd0a4,
+	0x1508, 0x080c, 0x80b8, 0x080c, 0x93ac, 0x68c3, 0x0000, 0x080c,
+	0x98da, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384,
 	0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2b14, 0x9006, 0x080c,
 	0x2b14, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001,
-	0x003e, 0x0028, 0x6003, 0x0009, 0x630a, 0x0804, 0x85f2, 0x7014,
+	0x003e, 0x0028, 0x6003, 0x0009, 0x630a, 0x0804, 0x861a, 0x7014,
 	0x9c36, 0x1110, 0x660c, 0x7616, 0x7010, 0x9c36, 0x1140, 0x2c00,
 	0x9f36, 0x0118, 0x2f00, 0x7012, 0x0010, 0x7013, 0x0000, 0x660c,
 	0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
-	0x0000, 0x6014, 0x2048, 0x080c, 0xbafe, 0x01e8, 0x6020, 0x9086,
-	0x0003, 0x1580, 0x080c, 0xbd04, 0x1118, 0x080c, 0xa7a7, 0x0098,
+	0x0000, 0x6014, 0x2048, 0x080c, 0xbb17, 0x01e8, 0x6020, 0x9086,
+	0x0003, 0x1580, 0x080c, 0xbd1d, 0x1118, 0x080c, 0xa7c0, 0x0098,
 	0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036, 0x0086,
-	0x080c, 0xbded, 0x080c, 0xd7b3, 0x080c, 0x6885, 0x008e, 0x003e,
-	0x001e, 0x080c, 0xbce7, 0x080c, 0x9e49, 0x080c, 0x9797, 0x00ce,
-	0x0804, 0x8572, 0x2c78, 0x600c, 0x2060, 0x0804, 0x8572, 0x012e,
+	0x080c, 0xbe06, 0x080c, 0xd7d3, 0x080c, 0x688c, 0x008e, 0x003e,
+	0x001e, 0x080c, 0xbd00, 0x080c, 0x9e62, 0x080c, 0x97b0, 0x00ce,
+	0x0804, 0x859a, 0x2c78, 0x600c, 0x2060, 0x0804, 0x859a, 0x012e,
 	0x000e, 0x001e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e,
 	0x00be, 0x0005, 0x6020, 0x9086, 0x0006, 0x1158, 0x0016, 0x0036,
-	0x0086, 0x080c, 0xd7b3, 0x080c, 0xd4b5, 0x008e, 0x003e, 0x001e,
-	0x08d0, 0x080c, 0xa7a7, 0x6020, 0x9086, 0x0002, 0x1160, 0x6004,
-	0x0006, 0x9086, 0x0085, 0x000e, 0x0904, 0x85d8, 0x9086, 0x008b,
-	0x0904, 0x85d8, 0x0840, 0x6020, 0x9086, 0x0005, 0x1920, 0x6004,
+	0x0086, 0x080c, 0xd7d3, 0x080c, 0xd4d5, 0x008e, 0x003e, 0x001e,
+	0x08d0, 0x080c, 0xa7c0, 0x6020, 0x9086, 0x0002, 0x1160, 0x6004,
+	0x0006, 0x9086, 0x0085, 0x000e, 0x0904, 0x8600, 0x9086, 0x008b,
+	0x0904, 0x8600, 0x0840, 0x6020, 0x9086, 0x0005, 0x1920, 0x6004,
 	0x0006, 0x9086, 0x0085, 0x000e, 0x09c8, 0x9086, 0x008b, 0x09b0,
-	0x0804, 0x85eb, 0x00b6, 0x00a6, 0x0096, 0x00c6, 0x0006, 0x0126,
-	0x2091, 0x8000, 0x9280, 0x1000, 0x2004, 0x905d, 0x0904, 0x86c2,
+	0x0804, 0x8613, 0x00b6, 0x00a6, 0x0096, 0x00c6, 0x0006, 0x0126,
+	0x2091, 0x8000, 0x9280, 0x1000, 0x2004, 0x905d, 0x0904, 0x86ea,
 	0x00f6, 0x00e6, 0x00d6, 0x0066, 0x2071, 0x19b8, 0xbe54, 0x7018,
 	0x9b06, 0x1108, 0x761a, 0x701c, 0x9b06, 0x1130, 0x86ff, 0x1118,
 	0x7018, 0x701e, 0x0008, 0x761e, 0xb858, 0x904d, 0x0108, 0xae56,
 	0x96d5, 0x0000, 0x0110, 0x2900, 0xb05a, 0xb857, 0x0000, 0xb85b,
-	0x0000, 0xb800, 0xc0d4, 0xc0dc, 0xb802, 0x080c, 0x616a, 0x0904,
-	0x86be, 0x7624, 0x86ff, 0x0904, 0x86ad, 0x9680, 0x0005, 0x2004,
+	0x0000, 0xb800, 0xc0d4, 0xc0dc, 0xb802, 0x080c, 0x6171, 0x0904,
+	0x86e6, 0x7624, 0x86ff, 0x0904, 0x86d5, 0x9680, 0x0005, 0x2004,
 	0x9906, 0x15d8, 0x00d6, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0560,
-	0x080c, 0x8090, 0x080c, 0x9393, 0x68c3, 0x0000, 0x080c, 0x98c1,
+	0x080c, 0x80b8, 0x080c, 0x93ac, 0x68c3, 0x0000, 0x080c, 0x98da,
 	0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
 	0x0138, 0x2001, 0x0100, 0x080c, 0x2b14, 0x9006, 0x080c, 0x2b14,
 	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
 	0x00de, 0x00c6, 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660,
-	0x080c, 0x9e49, 0x00ce, 0x0048, 0x00de, 0x00c6, 0x2660, 0x6003,
-	0x0009, 0x630a, 0x00ce, 0x0804, 0x8665, 0x89ff, 0x0158, 0xa867,
-	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xbded, 0x080c, 0xd7b3,
-	0x080c, 0x6885, 0x080c, 0x9797, 0x0804, 0x8665, 0x006e, 0x00de,
+	0x080c, 0x9e62, 0x00ce, 0x0048, 0x00de, 0x00c6, 0x2660, 0x6003,
+	0x0009, 0x630a, 0x00ce, 0x0804, 0x868d, 0x89ff, 0x0158, 0xa867,
+	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xbe06, 0x080c, 0xd7d3,
+	0x080c, 0x688c, 0x080c, 0x97b0, 0x0804, 0x868d, 0x006e, 0x00de,
 	0x00ee, 0x00fe, 0x012e, 0x000e, 0x00ce, 0x009e, 0x00ae, 0x00be,
 	0x0005, 0x0096, 0x0006, 0x0066, 0x00c6, 0x00d6, 0x9036, 0x7814,
-	0x9065, 0x0904, 0x872a, 0x600c, 0x0006, 0x600f, 0x0000, 0x7824,
+	0x9065, 0x0904, 0x8752, 0x600c, 0x0006, 0x600f, 0x0000, 0x7824,
 	0x9c06, 0x1570, 0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508, 0x080c,
-	0x8090, 0x080c, 0x9393, 0x68c3, 0x0000, 0x080c, 0x98c1, 0x7827,
+	0x80b8, 0x080c, 0x93ac, 0x68c3, 0x0000, 0x080c, 0x98da, 0x7827,
 	0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
 	0x2001, 0x0100, 0x080c, 0x2b14, 0x9006, 0x080c, 0x2b14, 0x2069,
 	0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0040,
-	0x080c, 0x6511, 0x1520, 0x6003, 0x0009, 0x630a, 0x2c30, 0x00f8,
-	0x6014, 0x2048, 0x080c, 0xbafc, 0x01b0, 0x6020, 0x9086, 0x0003,
-	0x1508, 0x080c, 0xbd04, 0x1118, 0x080c, 0xa7a7, 0x0060, 0x080c,
-	0x6511, 0x1168, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
-	0x6885, 0x080c, 0xbce7, 0x080c, 0x9e49, 0x080c, 0x9797, 0x000e,
-	0x0804, 0x86d0, 0x7e16, 0x7e12, 0x00de, 0x00ce, 0x006e, 0x000e,
-	0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118, 0x080c, 0xd4b5,
-	0x0c50, 0x080c, 0xa7a7, 0x6020, 0x9086, 0x0002, 0x1150, 0x6004,
+	0x080c, 0x6518, 0x1520, 0x6003, 0x0009, 0x630a, 0x2c30, 0x00f8,
+	0x6014, 0x2048, 0x080c, 0xbb15, 0x01b0, 0x6020, 0x9086, 0x0003,
+	0x1508, 0x080c, 0xbd1d, 0x1118, 0x080c, 0xa7c0, 0x0060, 0x080c,
+	0x6518, 0x1168, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
+	0x688c, 0x080c, 0xbd00, 0x080c, 0x9e62, 0x080c, 0x97b0, 0x000e,
+	0x0804, 0x86f8, 0x7e16, 0x7e12, 0x00de, 0x00ce, 0x006e, 0x000e,
+	0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118, 0x080c, 0xd4d5,
+	0x0c50, 0x080c, 0xa7c0, 0x6020, 0x9086, 0x0002, 0x1150, 0x6004,
 	0x0006, 0x9086, 0x0085, 0x000e, 0x0990, 0x9086, 0x008b, 0x0978,
 	0x08d0, 0x6020, 0x9086, 0x0005, 0x19b0, 0x6004, 0x0006, 0x9086,
 	0x0085, 0x000e, 0x0d18, 0x9086, 0x008b, 0x0d00, 0x0860, 0x0006,
 	0x0066, 0x0096, 0x00b6, 0x00c6, 0x00d6, 0x7818, 0x905d, 0x0904,
-	0x87d7, 0xb854, 0x0006, 0x9006, 0xb856, 0xb85a, 0xb800, 0xc0d4,
-	0xc0dc, 0xb802, 0x080c, 0x616a, 0x0904, 0x87d4, 0x7e24, 0x86ff,
-	0x0904, 0x87c7, 0x9680, 0x0005, 0x2004, 0x9906, 0x1904, 0x87c7,
-	0x00d6, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0x87be, 0x080c,
-	0x8090, 0x080c, 0x9393, 0x68c3, 0x0000, 0x080c, 0x98c1, 0x7827,
+	0x87ff, 0xb854, 0x0006, 0x9006, 0xb856, 0xb85a, 0xb800, 0xc0d4,
+	0xc0dc, 0xb802, 0x080c, 0x6171, 0x0904, 0x87fc, 0x7e24, 0x86ff,
+	0x0904, 0x87ef, 0x9680, 0x0005, 0x2004, 0x9906, 0x1904, 0x87ef,
+	0x00d6, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0x87e6, 0x080c,
+	0x80b8, 0x080c, 0x93ac, 0x68c3, 0x0000, 0x080c, 0x98da, 0x7827,
 	0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
 	0x2001, 0x0100, 0x080c, 0x2b14, 0x9006, 0x080c, 0x2b14, 0x2069,
 	0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x00de,
 	0x00c6, 0x3e08, 0x918e, 0x0002, 0x1168, 0xb800, 0xd0bc, 0x0150,
 	0x9680, 0x0010, 0x200c, 0x81ff, 0x1518, 0x2009, 0x1959, 0x210c,
 	0x2102, 0x00f0, 0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660,
-	0x600f, 0x0000, 0x080c, 0x9e49, 0x00ce, 0x0048, 0x00de, 0x00c6,
-	0x2660, 0x6003, 0x0009, 0x630a, 0x00ce, 0x0804, 0x876a, 0x89ff,
-	0x0138, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6885,
-	0x080c, 0x9797, 0x0804, 0x876a, 0x000e, 0x0804, 0x875e, 0x781e,
+	0x600f, 0x0000, 0x080c, 0x9e62, 0x00ce, 0x0048, 0x00de, 0x00c6,
+	0x2660, 0x6003, 0x0009, 0x630a, 0x00ce, 0x0804, 0x8792, 0x89ff,
+	0x0138, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x688c,
+	0x080c, 0x97b0, 0x0804, 0x8792, 0x000e, 0x0804, 0x8786, 0x781e,
 	0x781a, 0x00de, 0x00ce, 0x00be, 0x009e, 0x006e, 0x000e, 0x0005,
 	0x00e6, 0x00d6, 0x0096, 0x0066, 0xb800, 0xd0dc, 0x01a0, 0xb84c,
 	0x904d, 0x0188, 0xa878, 0x9606, 0x1170, 0x2071, 0x19b8, 0x7024,
 	0x9035, 0x0148, 0x9080, 0x0005, 0x2004, 0x9906, 0x1120, 0xb800,
 	0xc0dc, 0xb802, 0x0029, 0x006e, 0x009e, 0x00de, 0x00ee, 0x0005,
 	0x00f6, 0x2079, 0x0100, 0x78c0, 0x9005, 0x1138, 0x00c6, 0x2660,
-	0x6003, 0x0009, 0x630a, 0x00ce, 0x04b8, 0x080c, 0x9393, 0x78c3,
-	0x0000, 0x080c, 0x98c1, 0x7027, 0x0000, 0x0036, 0x2079, 0x0140,
+	0x6003, 0x0009, 0x630a, 0x00ce, 0x04b8, 0x080c, 0x93ac, 0x78c3,
+	0x0000, 0x080c, 0x98da, 0x7027, 0x0000, 0x0036, 0x2079, 0x0140,
 	0x7b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2b14,
 	0x9006, 0x080c, 0x2b14, 0x2079, 0x0100, 0x7824, 0xd084, 0x0110,
-	0x7827, 0x0001, 0x080c, 0x98c1, 0x003e, 0x080c, 0x616a, 0x00c6,
-	0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660, 0x080c, 0x9e19,
-	0x00ce, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xbded,
-	0x080c, 0x6885, 0x080c, 0x9797, 0x00fe, 0x0005, 0x00b6, 0x00e6,
+	0x7827, 0x0001, 0x080c, 0x98da, 0x003e, 0x080c, 0x6171, 0x00c6,
+	0xb83c, 0x9005, 0x0110, 0x8001, 0xb83e, 0x2660, 0x080c, 0x9e32,
+	0x00ce, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xbe06,
+	0x080c, 0x688c, 0x080c, 0x97b0, 0x00fe, 0x0005, 0x00b6, 0x00e6,
 	0x00c6, 0x2011, 0x0101, 0x2204, 0xc0c4, 0x2012, 0x2001, 0x180c,
 	0x2014, 0xc2e4, 0x2202, 0x2071, 0x19b8, 0x7004, 0x9084, 0x0007,
-	0x0002, 0x8863, 0x8867, 0x887e, 0x88a7, 0x88e5, 0x8863, 0x887e,
-	0x8861, 0x080c, 0x0db4, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7024,
+	0x0002, 0x888b, 0x888f, 0x88a6, 0x88cf, 0x890d, 0x888b, 0x88a6,
+	0x8889, 0x080c, 0x0db4, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7024,
 	0x9065, 0x0148, 0x7020, 0x8001, 0x7022, 0x600c, 0x9015, 0x0158,
 	0x7216, 0x600f, 0x0000, 0x7007, 0x0000, 0x7027, 0x0000, 0x00ce,
 	0x00ee, 0x00be, 0x0005, 0x7216, 0x7212, 0x0ca8, 0x6010, 0x2058,
-	0x080c, 0x616a, 0xb800, 0xc0dc, 0xb802, 0x7007, 0x0000, 0x7027,
+	0x080c, 0x6171, 0xb800, 0xc0dc, 0xb802, 0x7007, 0x0000, 0x7027,
 	0x0000, 0x7020, 0x8001, 0x7022, 0x1148, 0x2001, 0x180c, 0x2014,
 	0xd2ec, 0x1180, 0x00ce, 0x00ee, 0x00be, 0x0005, 0xb854, 0x9015,
-	0x0120, 0x721e, 0x080c, 0x894b, 0x0ca8, 0x7218, 0x721e, 0x080c,
-	0x894b, 0x0c80, 0xc2ec, 0x2202, 0x080c, 0x8a26, 0x0c58, 0x7024,
-	0x9065, 0x05b8, 0x700c, 0x9c06, 0x1160, 0x080c, 0x9797, 0x600c,
+	0x0120, 0x721e, 0x080c, 0x8973, 0x0ca8, 0x7218, 0x721e, 0x080c,
+	0x8973, 0x0c80, 0xc2ec, 0x2202, 0x080c, 0x8a4e, 0x0c58, 0x7024,
+	0x9065, 0x05b8, 0x700c, 0x9c06, 0x1160, 0x080c, 0x97b0, 0x600c,
 	0x9015, 0x0120, 0x720e, 0x600f, 0x0000, 0x0448, 0x720e, 0x720a,
-	0x0430, 0x7014, 0x9c06, 0x1160, 0x080c, 0x9797, 0x600c, 0x9015,
+	0x0430, 0x7014, 0x9c06, 0x1160, 0x080c, 0x97b0, 0x600c, 0x9015,
 	0x0120, 0x7216, 0x600f, 0x0000, 0x00d0, 0x7216, 0x7212, 0x00b8,
-	0x6020, 0x9086, 0x0003, 0x1198, 0x6010, 0x2058, 0x080c, 0x616a,
-	0xb800, 0xc0dc, 0xb802, 0x080c, 0x9797, 0x701c, 0x9065, 0x0138,
+	0x6020, 0x9086, 0x0003, 0x1198, 0x6010, 0x2058, 0x080c, 0x6171,
+	0xb800, 0xc0dc, 0xb802, 0x080c, 0x97b0, 0x701c, 0x9065, 0x0138,
 	0xb854, 0x9015, 0x0110, 0x721e, 0x0010, 0x7218, 0x721e, 0x7027,
 	0x0000, 0x00ce, 0x00ee, 0x00be, 0x0005, 0x7024, 0x9065, 0x0140,
-	0x080c, 0x9797, 0x600c, 0x9015, 0x0158, 0x720e, 0x600f, 0x0000,
-	0x080c, 0x98c1, 0x7027, 0x0000, 0x00ce, 0x00ee, 0x00be, 0x0005,
+	0x080c, 0x97b0, 0x600c, 0x9015, 0x0158, 0x720e, 0x600f, 0x0000,
+	0x080c, 0x98da, 0x7027, 0x0000, 0x00ce, 0x00ee, 0x00be, 0x0005,
 	0x720e, 0x720a, 0x0ca8, 0x00d6, 0x2069, 0x19b8, 0x6830, 0x9084,
-	0x0003, 0x0002, 0x8908, 0x890a, 0x892e, 0x8906, 0x080c, 0x0db4,
+	0x0003, 0x0002, 0x8930, 0x8932, 0x8956, 0x892e, 0x080c, 0x0db4,
 	0x00de, 0x0005, 0x00c6, 0x6840, 0x9086, 0x0001, 0x01b8, 0x683c,
 	0x9065, 0x0130, 0x600c, 0x9015, 0x0170, 0x6a3a, 0x600f, 0x0000,
 	0x6833, 0x0000, 0x683f, 0x0000, 0x2011, 0x19d7, 0x2013, 0x0000,
@@ -4188,153 +4193,153 @@
 	0x0130, 0x6a3a, 0x600f, 0x0000, 0x683f, 0x0000, 0x0018, 0x683e,
 	0x683a, 0x6836, 0x00ce, 0x00de, 0x0005, 0x2001, 0x180c, 0x200c,
 	0xc1e5, 0x2102, 0x0005, 0x2001, 0x180c, 0x200c, 0xd1ec, 0x0120,
-	0xc1ec, 0x2102, 0x080c, 0x8a26, 0x2001, 0x19c4, 0x2004, 0x9086,
+	0xc1ec, 0x2102, 0x080c, 0x8a4e, 0x2001, 0x19c4, 0x2004, 0x9086,
 	0x0001, 0x0d58, 0x00d6, 0x2069, 0x19b8, 0x6804, 0x9084, 0x0007,
-	0x0002, 0x896b, 0x8a0e, 0x8a0e, 0x8a0e, 0x8a0e, 0x8a10, 0x8a0e,
-	0x8969, 0x080c, 0x0db4, 0x6820, 0x9005, 0x1110, 0x00de, 0x0005,
+	0x0002, 0x8993, 0x8a36, 0x8a36, 0x8a36, 0x8a36, 0x8a38, 0x8a36,
+	0x8991, 0x080c, 0x0db4, 0x6820, 0x9005, 0x1110, 0x00de, 0x0005,
 	0x00c6, 0x680c, 0x9065, 0x0150, 0x6807, 0x0004, 0x6826, 0x682b,
-	0x0000, 0x080c, 0x8a7c, 0x00ce, 0x00de, 0x0005, 0x6814, 0x9065,
-	0x0150, 0x6807, 0x0001, 0x6826, 0x682b, 0x0000, 0x080c, 0x8a7c,
+	0x0000, 0x080c, 0x8aa4, 0x00ce, 0x00de, 0x0005, 0x6814, 0x9065,
+	0x0150, 0x6807, 0x0001, 0x6826, 0x682b, 0x0000, 0x080c, 0x8aa4,
 	0x00ce, 0x00de, 0x0005, 0x00b6, 0x00e6, 0x6a1c, 0x92dd, 0x0000,
-	0x0904, 0x89fa, 0xb84c, 0x900d, 0x0118, 0xb888, 0x9005, 0x01a0,
-	0xb854, 0x905d, 0x0120, 0x920e, 0x0904, 0x89fa, 0x0028, 0x6818,
-	0x920e, 0x0904, 0x89fa, 0x2058, 0xb84c, 0x900d, 0x0d88, 0xb888,
+	0x0904, 0x8a22, 0xb84c, 0x900d, 0x0118, 0xb888, 0x9005, 0x01a0,
+	0xb854, 0x905d, 0x0120, 0x920e, 0x0904, 0x8a22, 0x0028, 0x6818,
+	0x920e, 0x0904, 0x8a22, 0x2058, 0xb84c, 0x900d, 0x0d88, 0xb888,
 	0x9005, 0x1d70, 0x2b00, 0x681e, 0xbb3c, 0xb838, 0x9302, 0x1e40,
-	0x080c, 0x9df0, 0x0904, 0x89fa, 0x8318, 0xbb3e, 0x6116, 0x2b10,
+	0x080c, 0x9e09, 0x0904, 0x8a22, 0x8318, 0xbb3e, 0x6116, 0x2b10,
 	0x6212, 0x0096, 0x2148, 0xa880, 0x9084, 0x00ff, 0x605e, 0xa883,
 	0x0000, 0xa884, 0x009e, 0x908a, 0x199a, 0x0210, 0x2001, 0x1999,
 	0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x6114, 0x0096, 0x2148,
 	0xa964, 0x009e, 0x918c, 0x00ff, 0x918e, 0x0048, 0x0538, 0x00f6,
 	0x2c78, 0x2061, 0x0100, 0xbab0, 0x629a, 0x2069, 0x0200, 0x2071,
-	0x0240, 0x080c, 0x8fb4, 0x2069, 0x19b8, 0xbb00, 0xc3dd, 0xbb02,
+	0x0240, 0x080c, 0x8fdc, 0x2069, 0x19b8, 0xbb00, 0xc3dd, 0xbb02,
 	0x6807, 0x0002, 0x2f18, 0x6b26, 0x682b, 0x0000, 0x7823, 0x0003,
 	0x7803, 0x0001, 0x7807, 0x0040, 0x00fe, 0x00ee, 0x00be, 0x00ce,
 	0x00de, 0x0005, 0x00ee, 0x00be, 0x00ce, 0x0cd0, 0xbb00, 0xc3dd,
 	0xbb02, 0x6807, 0x0006, 0x2f18, 0x6b26, 0x682b, 0x0000, 0x080c,
-	0x9c4a, 0x00ee, 0x00be, 0x00ce, 0x00de, 0x0005, 0x00de, 0x0005,
+	0x9c63, 0x00ee, 0x00be, 0x00ce, 0x00de, 0x0005, 0x00de, 0x0005,
 	0x00c6, 0x680c, 0x9065, 0x0138, 0x6807, 0x0004, 0x6826, 0x682b,
-	0x0000, 0x080c, 0x8a7c, 0x00ce, 0x00de, 0x0005, 0x2001, 0x180c,
+	0x0000, 0x080c, 0x8aa4, 0x00ce, 0x00de, 0x0005, 0x2001, 0x180c,
 	0x2014, 0xc2ed, 0x2202, 0x00de, 0x00fe, 0x0005, 0x00f6, 0x00d6,
 	0x2069, 0x19b8, 0x6830, 0x9086, 0x0000, 0x1548, 0x2001, 0x180c,
-	0x2014, 0xd2e4, 0x0130, 0xc2e4, 0x2202, 0x080c, 0x895a, 0x2069,
+	0x2014, 0xd2e4, 0x0130, 0xc2e4, 0x2202, 0x080c, 0x8982, 0x2069,
 	0x19b8, 0x2001, 0x180c, 0x200c, 0xd1c4, 0x11e0, 0x6838, 0x907d,
 	0x01b0, 0x6a04, 0x9296, 0x0000, 0x1588, 0x6833, 0x0001, 0x683e,
 	0x6847, 0x0000, 0x684b, 0x0000, 0x0126, 0x00f6, 0x2091, 0x2400,
-	0x002e, 0x080c, 0x1ae8, 0x1178, 0x012e, 0x080c, 0x91e1, 0x00de,
+	0x002e, 0x080c, 0x1ae8, 0x1178, 0x012e, 0x080c, 0x9209, 0x00de,
 	0x00fe, 0x0005, 0xc1c4, 0x2102, 0x0066, 0x2031, 0x0001, 0x080c,
-	0x7057, 0x006e, 0x08d8, 0x012e, 0x6843, 0x0000, 0x7803, 0x0002,
+	0x7062, 0x006e, 0x08d8, 0x012e, 0x6843, 0x0000, 0x7803, 0x0002,
 	0x780c, 0x9015, 0x0140, 0x6a3a, 0x780f, 0x0000, 0x6833, 0x0000,
 	0x683f, 0x0000, 0x0c20, 0x683a, 0x6836, 0x0cc0, 0x6a04, 0x9296,
-	0x0006, 0x0958, 0x0804, 0x8a1e, 0x6020, 0x9084, 0x000f, 0x000b,
-	0x0005, 0x8a90, 0x8a95, 0x8eee, 0x8f7d, 0x8a95, 0x8eee, 0x8f7d,
-	0x8a90, 0x8a95, 0x8a90, 0x8a90, 0x8a90, 0x8a90, 0x8a90, 0x8a90,
-	0x080c, 0x8846, 0x080c, 0x894b, 0x0005, 0x00b6, 0x0156, 0x0136,
+	0x0006, 0x0958, 0x0804, 0x8a46, 0x6020, 0x9084, 0x000f, 0x000b,
+	0x0005, 0x8ab8, 0x8abd, 0x8f16, 0x8fa5, 0x8abd, 0x8f16, 0x8fa5,
+	0x8ab8, 0x8abd, 0x8ab8, 0x8ab8, 0x8ab8, 0x8ab8, 0x8ab8, 0x8ab8,
+	0x080c, 0x886e, 0x080c, 0x8973, 0x0005, 0x00b6, 0x0156, 0x0136,
 	0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069,
 	0x0200, 0x2071, 0x0240, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0db4,
 	0x6110, 0x2158, 0xb9b0, 0x2c78, 0x2061, 0x0100, 0x619a, 0x908a,
-	0x0040, 0x1a04, 0x8b01, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-	0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0x8c78,
-	0x8cb3, 0x8cdc, 0x8d7f, 0x8da0, 0x8da6, 0x8db3, 0x8dbb, 0x8dc7,
-	0x8dcd, 0x8dde, 0x8dcd, 0x8e35, 0x8dbb, 0x8e41, 0x8e47, 0x8dc7,
-	0x8e47, 0x8e53, 0x8aff, 0x8aff, 0x8aff, 0x8aff, 0x8aff, 0x8aff,
-	0x8aff, 0x8aff, 0x8aff, 0x8aff, 0x8aff, 0x9576, 0x9599, 0x95aa,
-	0x95ca, 0x95fc, 0x8db3, 0x8aff, 0x8db3, 0x8dcd, 0x8aff, 0x8cdc,
-	0x8d7f, 0x8aff, 0x99ae, 0x8dcd, 0x8aff, 0x99ca, 0x8dcd, 0x8aff,
-	0x8dc7, 0x8c72, 0x8b22, 0x8aff, 0x99e6, 0x9a53, 0x9b2a, 0x8aff,
-	0x9b37, 0x8db0, 0x9b62, 0x8aff, 0x9606, 0x9b8f, 0x8aff, 0x080c,
+	0x0040, 0x1a04, 0x8b29, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce,
+	0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0x8ca0,
+	0x8cdb, 0x8d04, 0x8da7, 0x8dc8, 0x8dce, 0x8ddb, 0x8de3, 0x8def,
+	0x8df5, 0x8e06, 0x8df5, 0x8e5d, 0x8de3, 0x8e69, 0x8e6f, 0x8def,
+	0x8e6f, 0x8e7b, 0x8b27, 0x8b27, 0x8b27, 0x8b27, 0x8b27, 0x8b27,
+	0x8b27, 0x8b27, 0x8b27, 0x8b27, 0x8b27, 0x958f, 0x95b2, 0x95c3,
+	0x95e3, 0x9615, 0x8ddb, 0x8b27, 0x8ddb, 0x8df5, 0x8b27, 0x8d04,
+	0x8da7, 0x8b27, 0x99c7, 0x8df5, 0x8b27, 0x99e3, 0x8df5, 0x8b27,
+	0x8def, 0x8c9a, 0x8b4a, 0x8b27, 0x99ff, 0x9a6c, 0x9b43, 0x8b27,
+	0x9b50, 0x8dd8, 0x9b7b, 0x8b27, 0x961f, 0x9ba8, 0x8b27, 0x080c,
 	0x0db4, 0x2100, 0x005b, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de,
-	0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0x8b20, 0x8b20,
-	0x8b20, 0x8b49, 0x8bf5, 0x8c00, 0x8b20, 0x8b20, 0x8b20, 0x8c47,
-	0x8c53, 0x8b64, 0x8b20, 0x8b7f, 0x8bb3, 0x9d0c, 0x9d51, 0x8dcd,
-	0x080c, 0x0db4, 0x00d6, 0x0096, 0x080c, 0x8e66, 0x7003, 0x2414,
+	0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005, 0x8b48, 0x8b48,
+	0x8b48, 0x8b71, 0x8c1d, 0x8c28, 0x8b48, 0x8b48, 0x8b48, 0x8c6f,
+	0x8c7b, 0x8b8c, 0x8b48, 0x8ba7, 0x8bdb, 0x9d25, 0x9d6a, 0x8df5,
+	0x080c, 0x0db4, 0x00d6, 0x0096, 0x080c, 0x8e8e, 0x7003, 0x2414,
 	0x7007, 0x0018, 0x700b, 0x0800, 0x7814, 0x2048, 0xa83c, 0x700e,
-	0xa850, 0x7022, 0xa854, 0x7026, 0x60c3, 0x0018, 0x080c, 0x9367,
+	0xa850, 0x7022, 0xa854, 0x7026, 0x60c3, 0x0018, 0x080c, 0x9380,
 	0x009e, 0x00de, 0x0005, 0x7810, 0x00b6, 0x2058, 0xb8a0, 0x00be,
-	0x080c, 0x9d98, 0x1118, 0x9084, 0xff80, 0x0110, 0x9085, 0x0001,
-	0x0005, 0x00d6, 0x0096, 0x080c, 0x8e66, 0x7003, 0x0500, 0x7814,
+	0x080c, 0x9db1, 0x1118, 0x9084, 0xff80, 0x0110, 0x9085, 0x0001,
+	0x0005, 0x00d6, 0x0096, 0x080c, 0x8e8e, 0x7003, 0x0500, 0x7814,
 	0x2048, 0xa874, 0x700a, 0xa878, 0x700e, 0xa87c, 0x7012, 0xa880,
 	0x7016, 0xa884, 0x701a, 0xa888, 0x701e, 0x60c3, 0x0010, 0x080c,
-	0x9367, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x080c, 0x8e66,
+	0x9380, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x080c, 0x8e8e,
 	0x7003, 0x0500, 0x7814, 0x2048, 0xa8cc, 0x700a, 0xa8d0, 0x700e,
 	0xa8d4, 0x7012, 0xa8d8, 0x7016, 0xa8dc, 0x701a, 0xa8e0, 0x701e,
-	0x60c3, 0x0010, 0x080c, 0x9367, 0x009e, 0x00de, 0x0005, 0x00d6,
-	0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x8e66, 0x20e9, 0x0000,
+	0x60c3, 0x0010, 0x080c, 0x9380, 0x009e, 0x00de, 0x0005, 0x00d6,
+	0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x8e8e, 0x20e9, 0x0000,
 	0x2001, 0x1974, 0x2003, 0x0000, 0x7814, 0x2048, 0xa814, 0x8003,
 	0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b,
 	0x2098, 0x2001, 0x1974, 0x0016, 0x200c, 0x2001, 0x0001, 0x080c,
-	0x224d, 0x080c, 0xc800, 0x9006, 0x080c, 0x224d, 0x001e, 0xa804,
-	0x9005, 0x0110, 0x2048, 0x0c28, 0x04d9, 0x080c, 0x9367, 0x012e,
+	0x224d, 0x080c, 0xc81a, 0x9006, 0x080c, 0x224d, 0x001e, 0xa804,
+	0x9005, 0x0110, 0x2048, 0x0c28, 0x04d9, 0x080c, 0x9380, 0x012e,
 	0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x8eb1, 0x20e9, 0x0000, 0x2001, 0x1974, 0x2003, 0x0000,
+	0x080c, 0x8ed9, 0x20e9, 0x0000, 0x2001, 0x1974, 0x2003, 0x0000,
 	0x7814, 0x2048, 0xa86f, 0x0200, 0xa873, 0x0000, 0xa814, 0x8003,
 	0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b,
-	0x2098, 0x2001, 0x1974, 0x0016, 0x200c, 0x080c, 0xc800, 0x001e,
+	0x2098, 0x2001, 0x1974, 0x0016, 0x200c, 0x080c, 0xc81a, 0x001e,
 	0xa804, 0x9005, 0x0110, 0x2048, 0x0c60, 0x0051, 0x7814, 0x2048,
-	0x080c, 0x0f9d, 0x080c, 0x9367, 0x012e, 0x009e, 0x00de, 0x0005,
+	0x080c, 0x0f9d, 0x080c, 0x9380, 0x012e, 0x009e, 0x00de, 0x0005,
 	0x60c0, 0x8004, 0x9084, 0x0003, 0x9005, 0x0130, 0x9082, 0x0004,
-	0x20a3, 0x0000, 0x8000, 0x1de0, 0x0005, 0x080c, 0x8e66, 0x7003,
-	0x7800, 0x7808, 0x8007, 0x700a, 0x60c3, 0x0008, 0x0804, 0x9367,
-	0x00d6, 0x00e6, 0x080c, 0x8eb1, 0x7814, 0x9084, 0xff00, 0x2073,
+	0x20a3, 0x0000, 0x8000, 0x1de0, 0x0005, 0x080c, 0x8e8e, 0x7003,
+	0x7800, 0x7808, 0x8007, 0x700a, 0x60c3, 0x0008, 0x0804, 0x9380,
+	0x00d6, 0x00e6, 0x080c, 0x8ed9, 0x7814, 0x9084, 0xff00, 0x2073,
 	0x0200, 0x8e70, 0x8e70, 0x9095, 0x0010, 0x2272, 0x8e70, 0x2073,
 	0x0034, 0x8e70, 0x2069, 0x1805, 0x20a9, 0x0004, 0x2d76, 0x8d68,
-	0x8e70, 0x1f04, 0x8c16, 0x2069, 0x1801, 0x20a9, 0x0004, 0x2d76,
-	0x8d68, 0x8e70, 0x1f04, 0x8c1f, 0x2069, 0x1984, 0x9086, 0xdf00,
+	0x8e70, 0x1f04, 0x8c3e, 0x2069, 0x1801, 0x20a9, 0x0004, 0x2d76,
+	0x8d68, 0x8e70, 0x1f04, 0x8c47, 0x2069, 0x1984, 0x9086, 0xdf00,
 	0x0110, 0x2069, 0x199e, 0x20a9, 0x001a, 0x9e86, 0x0260, 0x1148,
 	0x00c6, 0x2061, 0x0200, 0x6010, 0x8000, 0x6012, 0x00ce, 0x2071,
-	0x0240, 0x2d04, 0x8007, 0x2072, 0x8d68, 0x8e70, 0x1f04, 0x8c2d,
-	0x60c3, 0x004c, 0x080c, 0x9367, 0x00ee, 0x00de, 0x0005, 0x080c,
-	0x8e66, 0x7003, 0x6300, 0x7007, 0x0028, 0x7808, 0x700e, 0x60c3,
-	0x0008, 0x0804, 0x9367, 0x00d6, 0x0026, 0x0016, 0x080c, 0x8eb1,
+	0x0240, 0x2d04, 0x8007, 0x2072, 0x8d68, 0x8e70, 0x1f04, 0x8c55,
+	0x60c3, 0x004c, 0x080c, 0x9380, 0x00ee, 0x00de, 0x0005, 0x080c,
+	0x8e8e, 0x7003, 0x6300, 0x7007, 0x0028, 0x7808, 0x700e, 0x60c3,
+	0x0008, 0x0804, 0x9380, 0x00d6, 0x0026, 0x0016, 0x080c, 0x8ed9,
 	0x7003, 0x0200, 0x7814, 0x700e, 0x00e6, 0x9ef0, 0x0004, 0x2009,
 	0x0001, 0x2011, 0x000c, 0x2073, 0x0800, 0x8e70, 0x2073, 0x0000,
-	0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0x9367, 0x001e, 0x002e,
-	0x00de, 0x0005, 0x2001, 0x1817, 0x2004, 0x609a, 0x0804, 0x9367,
-	0x080c, 0x8e66, 0x7003, 0x5200, 0x2069, 0x1853, 0x6804, 0xd084,
+	0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0x9380, 0x001e, 0x002e,
+	0x00de, 0x0005, 0x2001, 0x1817, 0x2004, 0x609a, 0x0804, 0x9380,
+	0x080c, 0x8e8e, 0x7003, 0x5200, 0x2069, 0x1853, 0x6804, 0xd084,
 	0x0130, 0x6828, 0x0016, 0x080c, 0x2696, 0x710e, 0x001e, 0x20a9,
 	0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1,
 	0x0250, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1, 0x0254,
-	0x4003, 0x080c, 0x9d98, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
+	0x4003, 0x080c, 0x9db1, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
 	0x2001, 0x181e, 0x2004, 0x7032, 0x2001, 0x181f, 0x2004, 0x7036,
 	0x0030, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff, 0x7036, 0x60c3,
-	0x001c, 0x0804, 0x9367, 0x080c, 0x8e66, 0x7003, 0x0500, 0x080c,
-	0x9d98, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001, 0x181e,
+	0x001c, 0x0804, 0x9380, 0x080c, 0x8e8e, 0x7003, 0x0500, 0x080c,
+	0x9db1, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001, 0x181e,
 	0x2004, 0x700a, 0x2001, 0x181f, 0x2004, 0x700e, 0x0030, 0x2001,
 	0x1817, 0x2004, 0x9084, 0x00ff, 0x700e, 0x20a9, 0x0004, 0x20e1,
 	0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0250, 0x4003,
-	0x60c3, 0x0010, 0x0804, 0x9367, 0x080c, 0x8e66, 0x9006, 0x080c,
-	0x6525, 0xb8a0, 0x9086, 0x007e, 0x1130, 0x7003, 0x0400, 0x620c,
+	0x60c3, 0x0010, 0x0804, 0x9380, 0x080c, 0x8e8e, 0x9006, 0x080c,
+	0x652c, 0xb8a0, 0x9086, 0x007e, 0x1130, 0x7003, 0x0400, 0x620c,
 	0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096, 0x904d, 0x0120, 0x9006,
 	0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003, 0x0300, 0xb8a0, 0x9086,
-	0x007e, 0x1904, 0x8d47, 0x00d6, 0x2069, 0x193d, 0x2001, 0x1836,
+	0x007e, 0x1904, 0x8d6f, 0x00d6, 0x2069, 0x193d, 0x2001, 0x1836,
 	0x2004, 0xd0a4, 0x0178, 0x6800, 0x700a, 0x6808, 0x9084, 0x2000,
 	0x7012, 0x680c, 0x7016, 0x701f, 0x2710, 0x6818, 0x7022, 0x681c,
 	0x7026, 0x0080, 0x6800, 0x700a, 0x6804, 0x700e, 0x6808, 0x080c,
-	0x6fa7, 0x1118, 0x9084, 0x37ff, 0x0010, 0x9084, 0x3fff, 0x7012,
+	0x6fb2, 0x1118, 0x9084, 0x37ff, 0x0010, 0x9084, 0x3fff, 0x7012,
 	0x680c, 0x7016, 0x00de, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099,
 	0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004,
-	0x2099, 0x1801, 0x20a1, 0x025a, 0x4003, 0x00d6, 0x080c, 0x9c11,
+	0x2099, 0x1801, 0x20a1, 0x025a, 0x4003, 0x00d6, 0x080c, 0x9c2a,
 	0x2069, 0x1945, 0x2071, 0x024e, 0x6800, 0xc0dd, 0x7002, 0x080c,
-	0x5383, 0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de, 0x04a0, 0x2001,
+	0x538a, 0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de, 0x04a0, 0x2001,
 	0x1836, 0x2004, 0xd0a4, 0x0168, 0x0016, 0x2009, 0x0002, 0x60e0,
 	0x9106, 0x0130, 0x2100, 0x60e3, 0x0000, 0x080c, 0x26d7, 0x61e2,
 	0x001e, 0x20e1, 0x0001, 0x2099, 0x193d, 0x20e9, 0x0000, 0x20a1,
 	0x024e, 0x20a9, 0x0008, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1805,
 	0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1,
-	0x025a, 0x4003, 0x080c, 0x9c11, 0x20a1, 0x024e, 0x20a9, 0x0008,
-	0x2099, 0x1945, 0x4003, 0x60c3, 0x0074, 0x0804, 0x9367, 0x080c,
-	0x8e66, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b, 0x0800, 0x700f,
+	0x025a, 0x4003, 0x080c, 0x9c2a, 0x20a1, 0x024e, 0x20a9, 0x0008,
+	0x2099, 0x1945, 0x4003, 0x60c3, 0x0074, 0x0804, 0x9380, 0x080c,
+	0x8e8e, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b, 0x0800, 0x700f,
 	0x2000, 0x9006, 0x00f6, 0x2079, 0x1853, 0x7904, 0x00fe, 0xd1ac,
 	0x1110, 0x9085, 0x0020, 0x0010, 0x9085, 0x0010, 0x9085, 0x0002,
-	0x00d6, 0x0804, 0x8e16, 0x7026, 0x60c3, 0x0014, 0x0804, 0x9367,
-	0x080c, 0x8e66, 0x7003, 0x5000, 0x0804, 0x8cf6, 0x080c, 0x8e66,
-	0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014, 0x0804, 0x9367,
-	0x080c, 0x8ea8, 0x0010, 0x080c, 0x8eb1, 0x7003, 0x0200, 0x60c3,
-	0x0004, 0x0804, 0x9367, 0x080c, 0x8eb1, 0x7003, 0x0100, 0x700b,
-	0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0x9367, 0x080c,
-	0x8eb1, 0x7003, 0x0200, 0x0804, 0x8cf6, 0x080c, 0x8eb1, 0x7003,
+	0x00d6, 0x0804, 0x8e3e, 0x7026, 0x60c3, 0x0014, 0x0804, 0x9380,
+	0x080c, 0x8e8e, 0x7003, 0x5000, 0x0804, 0x8d1e, 0x080c, 0x8e8e,
+	0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014, 0x0804, 0x9380,
+	0x080c, 0x8ed0, 0x0010, 0x080c, 0x8ed9, 0x7003, 0x0200, 0x60c3,
+	0x0004, 0x0804, 0x9380, 0x080c, 0x8ed9, 0x7003, 0x0100, 0x700b,
+	0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804, 0x9380, 0x080c,
+	0x8ed9, 0x7003, 0x0200, 0x0804, 0x8d1e, 0x080c, 0x8ed9, 0x7003,
 	0x0100, 0x782c, 0x9005, 0x0110, 0x700a, 0x0010, 0x700b, 0x0003,
-	0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9367, 0x00d6, 0x080c,
-	0x8eb1, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b, 0x0800, 0xb894,
+	0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9380, 0x00d6, 0x080c,
+	0x8ed9, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b, 0x0800, 0xb894,
 	0x9086, 0x0014, 0x1198, 0xb99c, 0x9184, 0x0030, 0x0190, 0xb998,
 	0x9184, 0xc000, 0x1140, 0xd1ec, 0x0118, 0x700f, 0x2100, 0x0058,
 	0x700f, 0x0100, 0x0040, 0x700f, 0x0400, 0x0028, 0x700f, 0x0700,
@@ -4344,56 +4349,56 @@
 	0x1873, 0x210c, 0xd1e4, 0x0150, 0xc0c5, 0xbabc, 0xd28c, 0x1108,
 	0xc0cd, 0x9094, 0x0030, 0x9296, 0x0010, 0x0140, 0xd1ec, 0x0130,
 	0x9094, 0x0030, 0x9296, 0x0010, 0x0108, 0xc0bd, 0x002e, 0x7026,
-	0x60c3, 0x0014, 0x00de, 0x0804, 0x9367, 0x080c, 0x8eb1, 0x7003,
+	0x60c3, 0x0014, 0x00de, 0x0804, 0x9380, 0x080c, 0x8ed9, 0x7003,
 	0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3, 0x0014, 0x0804,
-	0x9367, 0x080c, 0x8eb1, 0x7003, 0x0200, 0x0804, 0x8c7c, 0x080c,
-	0x8eb1, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3,
-	0x0008, 0x0804, 0x9367, 0x080c, 0x8eb1, 0x7003, 0x0100, 0x700b,
-	0x000b, 0x60c3, 0x0008, 0x0804, 0x9367, 0x0026, 0x00d6, 0x0036,
+	0x9380, 0x080c, 0x8ed9, 0x7003, 0x0200, 0x0804, 0x8ca4, 0x080c,
+	0x8ed9, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3,
+	0x0008, 0x0804, 0x9380, 0x080c, 0x8ed9, 0x7003, 0x0100, 0x700b,
+	0x000b, 0x60c3, 0x0008, 0x0804, 0x9380, 0x0026, 0x00d6, 0x0036,
 	0x0046, 0x2019, 0x3200, 0x2021, 0x0800, 0x0040, 0x0026, 0x00d6,
-	0x0036, 0x0046, 0x2019, 0x2200, 0x2021, 0x0100, 0x080c, 0x9c26,
+	0x0036, 0x0046, 0x2019, 0x2200, 0x2021, 0x0100, 0x080c, 0x9c3f,
 	0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6878,
 	0x700a, 0x687c, 0x700e, 0x9485, 0x0029, 0x7012, 0x004e, 0x003e,
-	0x00de, 0x080c, 0x9355, 0x721a, 0x9f95, 0x0000, 0x7222, 0x7027,
-	0xffff, 0x2071, 0x024c, 0x002e, 0x0005, 0x0026, 0x080c, 0x9c26,
+	0x00de, 0x080c, 0x936e, 0x721a, 0x9f95, 0x0000, 0x7222, 0x7027,
+	0xffff, 0x2071, 0x024c, 0x002e, 0x0005, 0x0026, 0x080c, 0x9c3f,
 	0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069, 0x1800, 0x6878,
 	0x700a, 0x687c, 0x700e, 0x00de, 0x7013, 0x2029, 0x0c10, 0x7003,
 	0x0100, 0x7007, 0x0000, 0x700b, 0xfc02, 0x700f, 0x0000, 0x0005,
 	0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3300, 0x2021, 0x0800,
 	0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2300, 0x2021,
-	0x0100, 0x080c, 0x9c26, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006,
+	0x0100, 0x080c, 0x9c3f, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006,
 	0x2069, 0x1800, 0xb810, 0x9005, 0x1140, 0xb814, 0x9005, 0x1128,
 	0x700b, 0x00ff, 0x700f, 0xfffe, 0x0020, 0x6878, 0x700a, 0x687c,
 	0x700e, 0x0000, 0x9485, 0x0098, 0x7012, 0x004e, 0x003e, 0x00de,
-	0x080c, 0x9355, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071,
-	0x024c, 0x002e, 0x0005, 0x080c, 0x9355, 0x721a, 0x7a08, 0x7222,
+	0x080c, 0x936e, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071,
+	0x024c, 0x002e, 0x0005, 0x080c, 0x936e, 0x721a, 0x7a08, 0x7222,
 	0x7814, 0x7026, 0x2071, 0x024c, 0x002e, 0x0005, 0x00b6, 0x00c6,
 	0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071, 0x0240, 0x6004,
 	0x908a, 0x0085, 0x0a0c, 0x0db4, 0x908a, 0x0092, 0x1a0c, 0x0db4,
 	0x6110, 0x2158, 0xb9b0, 0x2c78, 0x2061, 0x0100, 0x619a, 0x9082,
 	0x0085, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x0005,
-	0x8f1f, 0x8f2e, 0x8f39, 0x8f1d, 0x8f1d, 0x8f1d, 0x8f1f, 0x8f1d,
-	0x8f1d, 0x8f1d, 0x8f1d, 0x8f1d, 0x8f1d, 0x080c, 0x0db4, 0x0411,
+	0x8f47, 0x8f56, 0x8f61, 0x8f45, 0x8f45, 0x8f45, 0x8f47, 0x8f45,
+	0x8f45, 0x8f45, 0x8f45, 0x8f45, 0x8f45, 0x080c, 0x0db4, 0x0411,
 	0x60c3, 0x0000, 0x0026, 0x080c, 0x29ca, 0x0228, 0x2011, 0x0101,
-	0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0x9367, 0x0431, 0x7808,
+	0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0x9380, 0x0431, 0x7808,
 	0x700a, 0x7814, 0x700e, 0x7017, 0xffff, 0x60c3, 0x000c, 0x0804,
-	0x9367, 0x0479, 0x7003, 0x0003, 0x7007, 0x0300, 0x60c3, 0x0004,
-	0x0804, 0x9367, 0x0026, 0x080c, 0x9c26, 0xb810, 0x9085, 0x8100,
+	0x9380, 0x0479, 0x7003, 0x0003, 0x7007, 0x0300, 0x60c3, 0x0004,
+	0x0804, 0x9380, 0x0026, 0x080c, 0x9c3f, 0xb810, 0x9085, 0x8100,
 	0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6878, 0x700a, 0x687c,
-	0x700e, 0x7013, 0x0009, 0x0804, 0x8e81, 0x0026, 0x080c, 0x9c26,
+	0x700e, 0x7013, 0x0009, 0x0804, 0x8ea9, 0x0026, 0x080c, 0x9c3f,
 	0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
 	0x6878, 0x700a, 0x687c, 0x700e, 0x2001, 0x0099, 0x7012, 0x0804,
-	0x8ee3, 0x0026, 0x080c, 0x9c26, 0xb810, 0x9085, 0x8500, 0x7002,
+	0x8f0b, 0x0026, 0x080c, 0x9c3f, 0xb810, 0x9085, 0x8500, 0x7002,
 	0xb814, 0x7006, 0x2069, 0x1800, 0x6878, 0x700a, 0x687c, 0x700e,
-	0x2001, 0x0099, 0x7012, 0x0804, 0x8ee3, 0x00b6, 0x00c6, 0x00d6,
+	0x2001, 0x0099, 0x7012, 0x0804, 0x8f0b, 0x00b6, 0x00c6, 0x00d6,
 	0x00e6, 0x00f6, 0x2c78, 0x2069, 0x0200, 0x2071, 0x0240, 0x7804,
 	0x908a, 0x0040, 0x0a0c, 0x0db4, 0x908a, 0x0054, 0x1a0c, 0x0db4,
 	0x7910, 0x2158, 0xb9b0, 0x2061, 0x0100, 0x619a, 0x9082, 0x0040,
-	0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x0005, 0x8fb4,
-	0x9070, 0x9043, 0x9192, 0x8fb2, 0x8fb2, 0x8fb2, 0x8fb2, 0x8fb2,
-	0x8fb2, 0x8fb2, 0x9774, 0x977c, 0x9784, 0x978c, 0x8fb2, 0x9b6e,
-	0x8fb2, 0x976c, 0x080c, 0x0db4, 0x0096, 0x780b, 0xffff, 0x080c,
-	0x901f, 0x7914, 0x2148, 0xa978, 0x7956, 0xae64, 0x96b4, 0x00ff,
+	0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x0005, 0x8fdc,
+	0x9098, 0x906b, 0x91ba, 0x8fda, 0x8fda, 0x8fda, 0x8fda, 0x8fda,
+	0x8fda, 0x8fda, 0x978d, 0x9795, 0x979d, 0x97a5, 0x8fda, 0x9b87,
+	0x8fda, 0x9785, 0x080c, 0x0db4, 0x0096, 0x780b, 0xffff, 0x080c,
+	0x9047, 0x7914, 0x2148, 0xa978, 0x7956, 0xae64, 0x96b4, 0x00ff,
 	0x9686, 0x0008, 0x1148, 0xa8b4, 0x7032, 0xa8b8, 0x7036, 0xa8bc,
 	0x703a, 0xa8c0, 0x703e, 0x0008, 0x7132, 0xa97c, 0x9184, 0x000f,
 	0x1118, 0x2001, 0x0005, 0x0040, 0xd184, 0x0118, 0x2001, 0x0004,
@@ -4412,19 +4417,19 @@
 	0x6a78, 0x720a, 0x6a7c, 0x720e, 0x7013, 0x0829, 0x2f10, 0x7222,
 	0x7027, 0xffff, 0x0005, 0x00d6, 0x0096, 0x0081, 0x7814, 0x2048,
 	0xa890, 0x7002, 0xa88c, 0x7006, 0xa8b0, 0x700a, 0xa8ac, 0x700e,
-	0x60c3, 0x000c, 0x009e, 0x00de, 0x0804, 0x9367, 0x6813, 0x0008,
+	0x60c3, 0x000c, 0x009e, 0x00de, 0x0804, 0x9380, 0x6813, 0x0008,
 	0xb810, 0x9085, 0x0500, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
-	0x6878, 0x700a, 0x687c, 0x700e, 0x7013, 0x0889, 0x080c, 0x9355,
+	0x6878, 0x700a, 0x687c, 0x700e, 0x7013, 0x0889, 0x080c, 0x936e,
 	0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x2071, 0x024c, 0x0005,
-	0x00d6, 0x0096, 0x080c, 0x9170, 0x7814, 0x2048, 0x080c, 0xbafc,
+	0x00d6, 0x0096, 0x080c, 0x9198, 0x7814, 0x2048, 0x080c, 0xbb15,
 	0x1130, 0x7814, 0x9084, 0x0700, 0x8007, 0x0033, 0x0010, 0x9006,
-	0x001b, 0x009e, 0x00de, 0x0005, 0x908e, 0x90f7, 0x9107, 0x912d,
-	0x9139, 0x914a, 0x9152, 0x908c, 0x080c, 0x0db4, 0x0016, 0x0036,
+	0x001b, 0x009e, 0x00de, 0x0005, 0x90b6, 0x911f, 0x912f, 0x9155,
+	0x9161, 0x9172, 0x917a, 0x90b4, 0x080c, 0x0db4, 0x0016, 0x0036,
 	0xa97c, 0x918c, 0x0003, 0x0118, 0x9186, 0x0003, 0x1198, 0xaba8,
 	0x7824, 0xd0cc, 0x1168, 0x7316, 0xa898, 0x701a, 0xa894, 0x701e,
-	0x003e, 0x001e, 0x2001, 0x1982, 0x2004, 0x60c2, 0x0804, 0x9367,
+	0x003e, 0x001e, 0x2001, 0x1982, 0x2004, 0x60c2, 0x0804, 0x9380,
 	0xc3e5, 0x0c88, 0x9186, 0x0001, 0x190c, 0x0db4, 0xaba8, 0x7824,
-	0xd0cc, 0x1904, 0x90f4, 0x7316, 0xa898, 0x701a, 0xa894, 0x701e,
+	0xd0cc, 0x1904, 0x911c, 0x7316, 0xa898, 0x701a, 0xa894, 0x701e,
 	0xa8a4, 0x7026, 0xa8ac, 0x702e, 0x2009, 0x0018, 0x9384, 0x0300,
 	0x0570, 0xd3c4, 0x0110, 0xa8ac, 0x9108, 0xd3cc, 0x0110, 0xa8a4,
 	0x9108, 0x6810, 0x9085, 0x0010, 0x6812, 0x2011, 0x0258, 0x20e9,
@@ -4432,2071 +4437,2070 @@
 	0x9080, 0x002c, 0x2098, 0x4003, 0x6810, 0x8000, 0x6812, 0x2011,
 	0x0240, 0x22a0, 0x20a9, 0x0005, 0x4003, 0x6810, 0xc084, 0x6812,
 	0x015e, 0x9184, 0x0003, 0x0118, 0x2019, 0x0245, 0x201a, 0x61c2,
-	0x003e, 0x001e, 0x0804, 0x9367, 0xc3e5, 0x0804, 0x90b3, 0x2011,
+	0x003e, 0x001e, 0x0804, 0x9380, 0xc3e5, 0x0804, 0x90db, 0x2011,
 	0x0008, 0x2001, 0x180f, 0x2004, 0xd0a4, 0x0110, 0x2011, 0x0028,
 	0x7824, 0xd0cc, 0x1110, 0x7216, 0x0470, 0x0ce8, 0xc2e5, 0x2011,
 	0x0302, 0x0016, 0x782c, 0x701a, 0x7930, 0x711e, 0x9105, 0x0108,
 	0xc2dd, 0x001e, 0x7824, 0xd0cc, 0x0108, 0xc2e5, 0x7216, 0x7027,
 	0x0012, 0x702f, 0x0008, 0x7043, 0x7000, 0x7047, 0x0500, 0x704f,
 	0x000a, 0x2069, 0x0200, 0x6813, 0x0009, 0x2071, 0x0240, 0x700b,
-	0x2500, 0x60c3, 0x0032, 0x0804, 0x9367, 0x2011, 0x0028, 0x7824,
-	0xd0cc, 0x1128, 0x7216, 0x60c3, 0x0018, 0x0804, 0x9367, 0x0cd0,
+	0x2500, 0x60c3, 0x0032, 0x0804, 0x9380, 0x2011, 0x0028, 0x7824,
+	0xd0cc, 0x1128, 0x7216, 0x60c3, 0x0018, 0x0804, 0x9380, 0x0cd0,
 	0xc2e5, 0x2011, 0x0100, 0x7824, 0xd0cc, 0x0108, 0xc2e5, 0x7216,
 	0x702f, 0x0008, 0x7858, 0x9084, 0x00ff, 0x7036, 0x60c3, 0x0020,
-	0x0804, 0x9367, 0x2011, 0x0008, 0x7824, 0xd0cc, 0x0108, 0xc2e5,
+	0x0804, 0x9380, 0x2011, 0x0008, 0x7824, 0xd0cc, 0x0108, 0xc2e5,
 	0x7216, 0x0c08, 0x0036, 0x7b14, 0x9384, 0xff00, 0x7816, 0x9384,
 	0x00ff, 0x8001, 0x1138, 0x7824, 0xd0cc, 0x0108, 0xc2e5, 0x7216,
 	0x003e, 0x0888, 0x0046, 0x2021, 0x0800, 0x0006, 0x7824, 0xd0cc,
 	0x000e, 0x0108, 0xc4e5, 0x7416, 0x004e, 0x701e, 0x003e, 0x0818,
 	0x00d6, 0x6813, 0x0008, 0xb810, 0x9085, 0x0700, 0x7002, 0xb814,
 	0x7006, 0x2069, 0x1800, 0x6878, 0x700a, 0x687c, 0x700e, 0x7824,
-	0xd0cc, 0x1168, 0x7013, 0x0898, 0x080c, 0x9355, 0x721a, 0x7a08,
+	0xd0cc, 0x1168, 0x7013, 0x0898, 0x080c, 0x936e, 0x721a, 0x7a08,
 	0x7222, 0x2f10, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005, 0x7013,
 	0x0889, 0x0c90, 0x0016, 0x7814, 0x9084, 0x0700, 0x8007, 0x0013,
-	0x001e, 0x0005, 0x91a2, 0x91a2, 0x91a4, 0x91a2, 0x91a2, 0x91a2,
-	0x91be, 0x91a2, 0x080c, 0x0db4, 0x7914, 0x918c, 0x08ff, 0x918d,
+	0x001e, 0x0005, 0x91ca, 0x91ca, 0x91cc, 0x91ca, 0x91ca, 0x91ca,
+	0x91e6, 0x91ca, 0x080c, 0x0db4, 0x7914, 0x918c, 0x08ff, 0x918d,
 	0xf600, 0x7916, 0x2009, 0x0003, 0x00b9, 0x2069, 0x1853, 0x6804,
 	0xd0bc, 0x0130, 0x682c, 0x9084, 0x00ff, 0x8007, 0x7032, 0x0010,
-	0x7033, 0x3f00, 0x60c3, 0x0001, 0x0804, 0x9367, 0x2009, 0x0003,
-	0x0019, 0x7033, 0x7f00, 0x0cb0, 0x0016, 0x080c, 0x9c26, 0x001e,
+	0x7033, 0x3f00, 0x60c3, 0x0001, 0x0804, 0x9380, 0x2009, 0x0003,
+	0x0019, 0x7033, 0x7f00, 0x0cb0, 0x0016, 0x080c, 0x9c3f, 0x001e,
 	0xb810, 0x9085, 0x0100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
 	0x6a78, 0x720a, 0x6a7c, 0x720e, 0x7013, 0x0888, 0x918d, 0x0008,
-	0x7116, 0x080c, 0x9355, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226,
+	0x7116, 0x080c, 0x936e, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226,
 	0x0005, 0x00b6, 0x0096, 0x00e6, 0x00d6, 0x00c6, 0x0056, 0x0046,
 	0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7810, 0x2058, 0xb8a0,
 	0x2028, 0xb910, 0xba14, 0x7378, 0x747c, 0x7820, 0x90be, 0x0006,
-	0x0904, 0x92c4, 0x90be, 0x000a, 0x1904, 0x9280, 0x609f, 0x0000,
-	0x7814, 0x2048, 0xa87c, 0xd0fc, 0x05d0, 0xaf90, 0x9784, 0xff00,
+	0x0904, 0x92dd, 0x90be, 0x000a, 0x1904, 0x9299, 0xb8b0, 0x609e,
+	0x7814, 0x2048, 0xa87c, 0xd0fc, 0x0558, 0xaf90, 0x9784, 0xff00,
 	0x9105, 0x6062, 0x873f, 0x9784, 0xff00, 0x0006, 0x7814, 0x2048,
-	0xa878, 0xc0fc, 0x9005, 0x000e, 0x1160, 0xaf94, 0x87ff, 0x0510,
+	0xa878, 0xc0fc, 0x9005, 0x000e, 0x1160, 0xaf94, 0x87ff, 0x0198,
 	0x2039, 0x0098, 0x9705, 0x6072, 0x7808, 0x6082, 0x2f00, 0x6086,
 	0x0038, 0x9185, 0x2200, 0x6062, 0x6073, 0x0129, 0x6077, 0x0000,
-	0x609f, 0x0000, 0x2001, 0x1836, 0x2004, 0xd0ac, 0x11a8, 0xd09c,
-	0x0130, 0x7814, 0x2048, 0xa874, 0x9082, 0x0080, 0x1268, 0xb814,
-	0x609e, 0x0050, 0x2039, 0x0029, 0x9705, 0x6072, 0x0c48, 0x9185,
-	0x0200, 0x6062, 0x6073, 0x2029, 0xa87c, 0xd0fc, 0x0118, 0xaf94,
-	0x87ff, 0x1120, 0x2f00, 0x6082, 0x7808, 0x6086, 0x6266, 0x636a,
-	0x646e, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
-	0x8007, 0x607a, 0x607f, 0x0000, 0xa838, 0x608a, 0xa834, 0x608e,
-	0xa848, 0x60c6, 0xa844, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5,
-	0x60d7, 0x0000, 0x080c, 0x9c0b, 0x2009, 0x07d0, 0x60c4, 0x9084,
-	0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58, 0x080c, 0x8095, 0x003e,
-	0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x009e, 0x00be, 0x0005,
-	0x7804, 0x9086, 0x0040, 0x0904, 0x9300, 0x9185, 0x0100, 0x6062,
-	0x6266, 0x636a, 0x646e, 0x6073, 0x0809, 0x6077, 0x0008, 0x60af,
-	0x95d5, 0x60d7, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
-	0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6082, 0x7808, 0x6086,
-	0x7814, 0x2048, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6,
-	0xa844, 0x60ca, 0xb86c, 0x60ce, 0xbab0, 0x629e, 0x080c, 0x9c0b,
-	0x2009, 0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110, 0x2009,
-	0x1b58, 0x080c, 0x8095, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de,
-	0x00ee, 0x009e, 0x00be, 0x0005, 0x7814, 0x2048, 0xa87c, 0x9084,
-	0x0003, 0x9086, 0x0002, 0x0904, 0x931c, 0x9185, 0x0100, 0x6062,
-	0x6266, 0x636a, 0x646e, 0x6073, 0x0880, 0x6077, 0x0008, 0xb88c,
-	0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a, 0x7838, 0x607e,
-	0x2f00, 0x6086, 0x7808, 0x6082, 0xa890, 0x608a, 0xa88c, 0x608e,
-	0xa8b0, 0x60c6, 0xa8ac, 0x60ca, 0xa8ac, 0x7930, 0x9108, 0x7932,
-	0xa8b0, 0x792c, 0x9109, 0x792e, 0xb86c, 0x60ce, 0x60af, 0x95d5,
-	0x60d7, 0x0000, 0xbab0, 0x629e, 0x080c, 0x9be8, 0x0804, 0x92b0,
-	0xb8bc, 0xd084, 0x0148, 0xb88c, 0x7814, 0x2048, 0xb88c, 0x7846,
-	0xa836, 0x2900, 0xa83a, 0xb04a, 0x9185, 0x0600, 0x6062, 0x6266,
-	0x636a, 0x646e, 0x6073, 0x0829, 0x6077, 0x0000, 0x60af, 0x9575,
-	0x60d7, 0x0000, 0x0804, 0x9293, 0x9185, 0x0700, 0x6062, 0x6266,
-	0x636a, 0x646e, 0x7824, 0xd0cc, 0x7826, 0x0118, 0x6073, 0x0889,
-	0x0010, 0x6073, 0x0898, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084,
-	0x00ff, 0xb88e, 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6086,
-	0x7808, 0x6082, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848, 0x60c6,
-	0xa844, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000,
-	0xbab0, 0x629e, 0x7824, 0xd0cc, 0x0120, 0x080c, 0x9c0b, 0x0804,
-	0x92b0, 0x080c, 0x9be8, 0x0804, 0x92b0, 0x7a10, 0x00b6, 0x2258,
-	0xba8c, 0x8210, 0x9294, 0x00ff, 0xba8e, 0x00be, 0x8217, 0x0005,
-	0x00d6, 0x2069, 0x19b8, 0x6843, 0x0001, 0x00de, 0x0005, 0x60a3,
-	0x0056, 0x60a7, 0x9575, 0x00f1, 0x080c, 0x8087, 0x0005, 0x0016,
-	0x2001, 0x180c, 0x200c, 0x9184, 0x0600, 0x9086, 0x0600, 0x0128,
-	0x0089, 0x080c, 0x8087, 0x001e, 0x0005, 0xc1e5, 0x2001, 0x180c,
-	0x2102, 0x2001, 0x19b9, 0x2003, 0x0000, 0x2001, 0x19c1, 0x2003,
-	0x0000, 0x0c88, 0x0006, 0x6014, 0x9084, 0x1804, 0x9085, 0x0009,
-	0x6016, 0x000e, 0x0005, 0x0016, 0x00c6, 0x0006, 0x2061, 0x0100,
-	0x61a4, 0x60a7, 0x95f5, 0x6014, 0x9084, 0x1804, 0x9085, 0x0008,
-	0x6016, 0x000e, 0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e,
-	0x0005, 0x00c6, 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069,
-	0x0140, 0x080c, 0x6fa7, 0x11e8, 0x2001, 0x19d4, 0x2004, 0x9005,
-	0x1904, 0x93f9, 0x0066, 0x2031, 0x0001, 0x080c, 0x7057, 0x006e,
-	0x1160, 0x2061, 0x0100, 0x6020, 0xd0b4, 0x1120, 0x6024, 0xd084,
-	0x090c, 0x0db4, 0x080c, 0x8087, 0x0460, 0x00c6, 0x2061, 0x19b8,
-	0x00d0, 0x6904, 0x9194, 0x4000, 0x0548, 0x080c, 0x9393, 0x080c,
-	0x2b24, 0x00c6, 0x2061, 0x19b8, 0x6128, 0x9192, 0x0008, 0x1258,
-	0x8108, 0x612a, 0x6124, 0x00ce, 0x81ff, 0x0198, 0x080c, 0x8087,
-	0x080c, 0x938a, 0x0070, 0x6124, 0x91e5, 0x0000, 0x0140, 0x080c,
-	0xd8a9, 0x080c, 0x8090, 0x2009, 0x0014, 0x080c, 0x9e93, 0x00ce,
-	0x0000, 0x002e, 0x001e, 0x00de, 0x00ce, 0x0005, 0x2001, 0x19d4,
-	0x2004, 0x9005, 0x1db0, 0x00c6, 0x2061, 0x19b8, 0x6128, 0x9192,
-	0x0003, 0x1e08, 0x8108, 0x612a, 0x00ce, 0x080c, 0x8087, 0x080c,
-	0x5b89, 0x2009, 0x1852, 0x2114, 0x8210, 0x220a, 0x0c10, 0x0096,
-	0x00c6, 0x00d6, 0x00e6, 0x0016, 0x0026, 0x080c, 0x809d, 0x2071,
-	0x19b8, 0x713c, 0x81ff, 0x0904, 0x9489, 0x2061, 0x0100, 0x2069,
-	0x0140, 0x080c, 0x6fa7, 0x11b0, 0x0036, 0x2019, 0x0002, 0x080c,
-	0x96bf, 0x003e, 0x713c, 0x2160, 0x080c, 0xd8a9, 0x2009, 0x004a,
-	0x080c, 0x9e93, 0x0066, 0x2031, 0x0001, 0x080c, 0x7057, 0x006e,
-	0x0804, 0x9489, 0x080c, 0x9495, 0x0904, 0x9489, 0x6904, 0xd1f4,
-	0x0904, 0x9490, 0x080c, 0x2b24, 0x00c6, 0x703c, 0x9065, 0x090c,
-	0x0db4, 0x6020, 0x00ce, 0x9086, 0x0006, 0x1528, 0x61c8, 0x60c4,
-	0x9105, 0x1508, 0x2009, 0x180c, 0x2104, 0xd0d4, 0x01e0, 0x6214,
-	0x9294, 0x1800, 0x1128, 0x6224, 0x9294, 0x0002, 0x1510, 0x0030,
-	0xc0d4, 0x200a, 0xd0cc, 0x0110, 0x080c, 0x2a77, 0x6014, 0x9084,
-	0xe7fd, 0x9085, 0x0010, 0x6016, 0x703c, 0x2060, 0x2009, 0x0049,
-	0x080c, 0x9e93, 0x0070, 0x0036, 0x2019, 0x0001, 0x080c, 0x96bf,
-	0x003e, 0x713c, 0x2160, 0x080c, 0xd8a9, 0x2009, 0x004a, 0x080c,
-	0x9e93, 0x002e, 0x001e, 0x00ee, 0x00de, 0x00ce, 0x009e, 0x0005,
-	0xd1ec, 0x1904, 0x944a, 0x0804, 0x944c, 0x00d6, 0x00c6, 0x0096,
-	0x703c, 0x9065, 0x090c, 0x0db4, 0x2001, 0x1836, 0x2004, 0xd09c,
-	0x1904, 0x9521, 0x2001, 0x0306, 0x200c, 0x9184, 0x0030, 0x0904,
-	0x9521, 0x9184, 0x0048, 0x9086, 0x0008, 0x1904, 0x9521, 0x2001,
-	0x020b, 0x2004, 0xd0fc, 0x0904, 0x9521, 0xd08c, 0x0904, 0x9521,
-	0x2009, 0x1a50, 0x2104, 0x8000, 0x0208, 0x200a, 0x2069, 0x0100,
-	0x6914, 0x918c, 0x0184, 0x918d, 0x0010, 0x6916, 0x69c8, 0x2011,
-	0x0020, 0x68c8, 0x9106, 0x1570, 0x8211, 0x1dd8, 0x2001, 0x0306,
-	0x2003, 0x4800, 0x2001, 0x009a, 0x2003, 0x0004, 0x2001, 0x1a36,
-	0x2003, 0x0000, 0x2001, 0x1a3f, 0x2003, 0x0000, 0x6a88, 0x698c,
-	0x2200, 0x9105, 0x1120, 0x2c10, 0x080c, 0x1a5c, 0x0040, 0x6014,
-	0x2048, 0xaa3a, 0xa936, 0x6ac4, 0x69c8, 0xa946, 0xaa4a, 0x0126,
-	0x00c6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1ae8, 0x190c, 0x0db4,
-	0x012e, 0x0090, 0x2009, 0x1a51, 0x2104, 0x8000, 0x0208, 0x200a,
-	0x69c8, 0x2011, 0x0020, 0x8211, 0x1df0, 0x68c8, 0x9106, 0x1dc0,
-	0x69c4, 0x68c8, 0x9105, 0x0160, 0x6824, 0xd08c, 0x0110, 0x6827,
-	0x0002, 0x7048, 0xc085, 0x704a, 0x0079, 0x7048, 0xc084, 0x704a,
-	0x2009, 0x07d0, 0x080c, 0x8095, 0x9006, 0x009e, 0x00ce, 0x00de,
-	0x0005, 0x9085, 0x0001, 0x0cc8, 0x0026, 0x00e6, 0x2071, 0x19b8,
-	0x7048, 0xd084, 0x01c0, 0x713c, 0x81ff, 0x01a8, 0x2071, 0x0100,
-	0x9188, 0x0008, 0x2114, 0x928e, 0x0006, 0x1138, 0x7014, 0x9084,
-	0x1984, 0x9085, 0x0012, 0x7016, 0x0030, 0x7014, 0x9084, 0x1984,
-	0x9085, 0x0016, 0x7016, 0x00ee, 0x002e, 0x0005, 0x00b6, 0x00e6,
-	0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046, 0x0006, 0x0126, 0x2091,
-	0x8000, 0x6010, 0x2058, 0xbca0, 0x2071, 0x19b8, 0x7018, 0x2058,
-	0x8bff, 0x0190, 0xb8a0, 0x9406, 0x0118, 0xb854, 0x2058, 0x0cc0,
-	0x6014, 0x0096, 0x2048, 0xac6c, 0xad70, 0xae78, 0x009e, 0x080c,
-	0x6369, 0x0110, 0x9085, 0x0001, 0x012e, 0x000e, 0x004e, 0x005e,
-	0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005, 0x080c, 0x8e66,
-	0x7003, 0x1200, 0x7838, 0x7012, 0x783c, 0x7016, 0x00c6, 0x7820,
-	0x9086, 0x0004, 0x1148, 0x7810, 0x9005, 0x0130, 0x00b6, 0x2058,
-	0xb810, 0xb914, 0x00be, 0x0020, 0x2061, 0x1800, 0x6078, 0x617c,
-	0x9084, 0x00ff, 0x700a, 0x710e, 0x00ce, 0x60c3, 0x002c, 0x0804,
-	0x9367, 0x080c, 0x8e66, 0x7003, 0x0f00, 0x7808, 0xd09c, 0x0128,
-	0xb810, 0x9084, 0x00ff, 0x700a, 0xb814, 0x700e, 0x60c3, 0x0008,
-	0x0804, 0x9367, 0x0156, 0x080c, 0x8eb1, 0x7003, 0x0200, 0x2011,
-	0x1848, 0x63f0, 0x2312, 0x20a9, 0x0006, 0x2011, 0x1840, 0x2019,
-	0x1841, 0x9ef0, 0x0002, 0x2376, 0x8e70, 0x2276, 0x8e70, 0x9398,
-	0x0002, 0x9290, 0x0002, 0x1f04, 0x95bb, 0x60c3, 0x001c, 0x015e,
-	0x0804, 0x9367, 0x0016, 0x0026, 0x080c, 0x8e8d, 0x080c, 0x8e9f,
-	0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0, 0x7814, 0x0096, 0x2048,
-	0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098,
-	0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x9192, 0x0010, 0x1250,
-	0x4003, 0x9080, 0x0004, 0x8003, 0x60c2, 0x080c, 0x9367, 0x002e,
-	0x001e, 0x0005, 0x20a9, 0x0010, 0x4003, 0x080c, 0x9c11, 0x20a1,
-	0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c, 0x8e66, 0x7003, 0x6200,
-	0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9367, 0x0016, 0x0026,
-	0x080c, 0x8e66, 0x20e9, 0x0000, 0x20a1, 0x024c, 0x7814, 0x0096,
-	0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0023,
-	0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x4003, 0x8003,
-	0x60c2, 0x080c, 0x9367, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00c6,
-	0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x700c, 0x2060,
-	0x8cff, 0x0178, 0x080c, 0xbd04, 0x1110, 0x080c, 0xa7a7, 0x600c,
-	0x0006, 0x080c, 0xbf6b, 0x080c, 0x9e19, 0x080c, 0x9797, 0x00ce,
-	0x0c78, 0x2c00, 0x700e, 0x700a, 0x012e, 0x000e, 0x00ce, 0x00ee,
-	0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066,
-	0x0026, 0x0016, 0x0006, 0x2091, 0x8000, 0x2001, 0x180c, 0x200c,
-	0x918c, 0xe7ff, 0x2102, 0x2069, 0x0100, 0x2079, 0x0140, 0x2071,
-	0x19b8, 0x7024, 0x2060, 0x8cff, 0x01f8, 0x080c, 0x9393, 0x6ac0,
-	0x68c3, 0x0000, 0x080c, 0x8090, 0x00c6, 0x2061, 0x0100, 0x080c,
-	0x9c2a, 0x00ce, 0x20a9, 0x01f4, 0x0461, 0x2009, 0x0013, 0x080c,
-	0x9e93, 0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee,
-	0x00fe, 0x015e, 0x012e, 0x0005, 0x2001, 0x1800, 0x2004, 0x9096,
-	0x0001, 0x0d78, 0x9096, 0x0004, 0x0d60, 0x080c, 0x8090, 0x6814,
-	0x9084, 0x0001, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3,
-	0x0000, 0x2011, 0x5b33, 0x080c, 0x8010, 0x20a9, 0x01f4, 0x0009,
-	0x08c0, 0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084,
-	0x4000, 0x190c, 0x2b24, 0x0090, 0xd084, 0x0118, 0x6827, 0x0001,
-	0x0010, 0x1f04, 0x96a1, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001,
-	0x0100, 0x080c, 0x2b14, 0x9006, 0x080c, 0x2b14, 0x0005, 0x0126,
-	0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016,
-	0x0006, 0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c, 0xdbff,
-	0x2102, 0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x19b8, 0x703c,
-	0x2060, 0x8cff, 0x0904, 0x974d, 0x9386, 0x0002, 0x1128, 0x6814,
-	0x9084, 0x0002, 0x0904, 0x974d, 0x68af, 0x95f5, 0x6817, 0x0010,
-	0x2009, 0x00fa, 0x8109, 0x1df0, 0x69c6, 0x68cb, 0x0008, 0x080c,
-	0x809d, 0x080c, 0x1e90, 0x0046, 0x2009, 0x00a5, 0x080c, 0x0e2f,
-	0x2021, 0x0169, 0x2404, 0x9084, 0x000f, 0x9086, 0x0004, 0x11f8,
-	0x68af, 0x95f5, 0x68c6, 0x68cb, 0x0008, 0x00e6, 0x00f6, 0x2079,
-	0x0090, 0x2071, 0x1a36, 0x6814, 0x9084, 0x1984, 0x9085, 0x0012,
-	0x6816, 0x782b, 0x0008, 0x7003, 0x0000, 0x00fe, 0x00ee, 0x9386,
-	0x0002, 0x1128, 0x7884, 0x9005, 0x1110, 0x7887, 0x0001, 0x2001,
-	0x1952, 0x200c, 0x080c, 0x0e2f, 0x004e, 0x20a9, 0x03e8, 0x6824,
-	0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000, 0x190c,
-	0x2b24, 0x0090, 0xd08c, 0x0118, 0x6827, 0x0002, 0x0010, 0x1f04,
-	0x9727, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
-	0x2b14, 0x9006, 0x080c, 0x2b14, 0x6827, 0x4000, 0x6824, 0x83ff,
-	0x1120, 0x2009, 0x0049, 0x080c, 0x9e93, 0x000e, 0x001e, 0x002e,
-	0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005,
-	0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19b8, 0x6a06, 0x012e,
-	0x00de, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19b8,
-	0x6a32, 0x012e, 0x00de, 0x0005, 0x080c, 0x901f, 0x7854, 0x7032,
-	0x7042, 0x7047, 0x1000, 0x00f8, 0x080c, 0x901f, 0x7854, 0x7032,
-	0x7042, 0x7047, 0x4000, 0x00b8, 0x080c, 0x901f, 0x7854, 0x7032,
-	0x7042, 0x7047, 0x2000, 0x0078, 0x080c, 0x901f, 0x7854, 0x7032,
-	0x7042, 0x7047, 0x0400, 0x0038, 0x080c, 0x901f, 0x7854, 0x7032,
-	0x7042, 0x7047, 0x0200, 0x60c3, 0x0020, 0x0804, 0x9367, 0x00e6,
-	0x2071, 0x19b8, 0x7020, 0x9005, 0x0110, 0x8001, 0x7022, 0x00ee,
-	0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066, 0x0006,
-	0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x7614, 0x2660, 0x2678,
-	0x2039, 0x0001, 0x87ff, 0x0904, 0x983c, 0x8cff, 0x0904, 0x983c,
-	0x6020, 0x9086, 0x0006, 0x1904, 0x9837, 0x88ff, 0x0138, 0x2800,
-	0x9c06, 0x1904, 0x9837, 0x2039, 0x0000, 0x0050, 0x6010, 0x9b06,
-	0x1904, 0x9837, 0x85ff, 0x0120, 0x6054, 0x9106, 0x1904, 0x9837,
-	0x7024, 0x9c06, 0x15b0, 0x2069, 0x0100, 0x68c0, 0x9005, 0x1160,
-	0x6824, 0xd084, 0x0148, 0x6827, 0x0001, 0x080c, 0x8090, 0x080c,
-	0x98c1, 0x7027, 0x0000, 0x0428, 0x080c, 0x8090, 0x6820, 0xd0b4,
-	0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000, 0x080c,
-	0x98c1, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384,
-	0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2b14, 0x9006, 0x080c,
-	0x2b14, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001,
-	0x003e, 0x7014, 0x9c36, 0x1110, 0x660c, 0x7616, 0x7010, 0x9c36,
-	0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7012, 0x0010, 0x7013,
-	0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008,
-	0x2678, 0x89ff, 0x1168, 0x600f, 0x0000, 0x6014, 0x0096, 0x2048,
-	0x080c, 0xbafc, 0x0110, 0x080c, 0xd4b5, 0x009e, 0x080c, 0x9e49,
-	0x080c, 0x9797, 0x88ff, 0x1190, 0x00ce, 0x0804, 0x97b2, 0x2c78,
-	0x600c, 0x2060, 0x0804, 0x97b2, 0x9006, 0x012e, 0x000e, 0x006e,
-	0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000,
-	0x00ce, 0x98c5, 0x0001, 0x0c88, 0x00f6, 0x00e6, 0x00d6, 0x0096,
-	0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071,
-	0x19b8, 0x7638, 0x2660, 0x2678, 0x8cff, 0x0904, 0x98b0, 0x6020,
-	0x9086, 0x0006, 0x1904, 0x98ab, 0x87ff, 0x0128, 0x2700, 0x9c06,
-	0x1904, 0x98ab, 0x0040, 0x6010, 0x9b06, 0x15e8, 0x85ff, 0x0118,
-	0x6054, 0x9106, 0x15c0, 0x703c, 0x9c06, 0x1168, 0x0036, 0x2019,
-	0x0001, 0x080c, 0x96bf, 0x7033, 0x0000, 0x9006, 0x703e, 0x7042,
-	0x7046, 0x704a, 0x003e, 0x7038, 0x9c36, 0x1110, 0x660c, 0x763a,
-	0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7036,
-	0x0010, 0x7037, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110,
-	0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6014, 0x2048, 0x080c,
-	0xbafc, 0x0110, 0x080c, 0xd4b5, 0x080c, 0x9e49, 0x87ff, 0x1198,
-	0x00ce, 0x0804, 0x985c, 0x2c78, 0x600c, 0x2060, 0x0804, 0x985c,
-	0x9006, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x009e, 0x00de,
-	0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce, 0x97bd, 0x0001,
-	0x0c80, 0x00e6, 0x2071, 0x19b8, 0x2001, 0x1800, 0x2004, 0x9086,
-	0x0002, 0x1118, 0x7007, 0x0005, 0x0010, 0x7007, 0x0000, 0x00ee,
-	0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126,
-	0x2091, 0x8000, 0x2071, 0x19b8, 0x2c10, 0x7638, 0x2660, 0x2678,
-	0x8cff, 0x0518, 0x2200, 0x9c06, 0x11e0, 0x7038, 0x9c36, 0x1110,
-	0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118,
-	0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x2c00, 0x9f06,
-	0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x9085, 0x0001,
-	0x0020, 0x2c78, 0x600c, 0x2060, 0x08d8, 0x012e, 0x000e, 0x002e,
-	0x006e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0096, 0x00f6, 0x00e6,
-	0x00d6, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000,
-	0x2071, 0x19b8, 0x760c, 0x2660, 0x2678, 0x8cff, 0x0904, 0x999d,
-	0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x1904, 0x9998,
-	0x7024, 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904,
-	0x9974, 0x080c, 0x9393, 0x68c3, 0x0000, 0x080c, 0x98c1, 0x7027,
-	0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
-	0x2001, 0x0100, 0x080c, 0x2b14, 0x9006, 0x080c, 0x2b14, 0x2069,
-	0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x700c,
-	0x9c36, 0x1110, 0x660c, 0x760e, 0x7008, 0x9c36, 0x1140, 0x2c00,
-	0x9f36, 0x0118, 0x2f00, 0x700a, 0x0010, 0x700b, 0x0000, 0x660c,
-	0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
-	0x0000, 0x080c, 0xbcf3, 0x1158, 0x080c, 0x2ffc, 0x080c, 0xbd04,
-	0x11f0, 0x080c, 0xa7a7, 0x00d8, 0x080c, 0x98c1, 0x08c0, 0x080c,
-	0xbd04, 0x1118, 0x080c, 0xa7a7, 0x0090, 0x6014, 0x2048, 0x080c,
-	0xbafc, 0x0168, 0x6020, 0x9086, 0x0003, 0x1508, 0xa867, 0x0103,
-	0xab7a, 0xa877, 0x0000, 0x080c, 0x6878, 0x080c, 0xbce7, 0x080c,
-	0xbf6b, 0x080c, 0x9e49, 0x080c, 0x9797, 0x00ce, 0x0804, 0x991d,
-	0x2c78, 0x600c, 0x2060, 0x0804, 0x991d, 0x012e, 0x000e, 0x002e,
-	0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e, 0x0005, 0x6020,
-	0x9086, 0x0006, 0x1d20, 0x080c, 0xd4b5, 0x0c08, 0x00d6, 0x080c,
-	0x8eb1, 0x7003, 0x0200, 0x7007, 0x0014, 0x60c3, 0x0014, 0x20e1,
-	0x0001, 0x2099, 0x195a, 0x20e9, 0x0000, 0x20a1, 0x0250, 0x20a9,
-	0x0004, 0x4003, 0x7023, 0x0004, 0x7027, 0x7878, 0x080c, 0x9367,
-	0x00de, 0x0005, 0x080c, 0x8eb1, 0x700b, 0x0800, 0x7814, 0x9084,
-	0xff00, 0x700e, 0x7814, 0x9084, 0x00ff, 0x7022, 0x782c, 0x7026,
-	0x7858, 0x9084, 0x00ff, 0x9085, 0x0200, 0x7002, 0x7858, 0x9084,
-	0xff00, 0x8007, 0x7006, 0x60c2, 0x0804, 0x9367, 0x00b6, 0x00d6,
-	0x0016, 0x00d6, 0x2f68, 0x2009, 0x0035, 0x080c, 0xc171, 0x00de,
-	0x1904, 0x9a4b, 0x080c, 0x8e66, 0x7003, 0x1300, 0x782c, 0x080c,
-	0x9b4d, 0x2068, 0x6820, 0x9086, 0x0003, 0x0560, 0x7810, 0x2058,
-	0xbaa0, 0x080c, 0x9d98, 0x11d8, 0x9286, 0x007e, 0x1128, 0x700b,
-	0x00ff, 0x700f, 0xfffe, 0x0498, 0x9286, 0x007f, 0x1128, 0x700b,
-	0x00ff, 0x700f, 0xfffd, 0x0458, 0x9284, 0xff80, 0x0180, 0x9286,
-	0x0080, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffc, 0x0400, 0x92d8,
-	0x1000, 0x2b5c, 0xb810, 0x700a, 0xb814, 0x700e, 0x00c0, 0x6098,
-	0x700e, 0x00a8, 0x080c, 0x9d98, 0x1130, 0x7810, 0x2058, 0xb8a0,
-	0x9082, 0x007e, 0x0250, 0x00d6, 0x2069, 0x181e, 0x2d04, 0x700a,
-	0x8d68, 0x2d04, 0x700e, 0x00de, 0x0010, 0x6034, 0x700e, 0x7838,
-	0x7012, 0x783c, 0x7016, 0x60c3, 0x000c, 0x001e, 0x00de, 0x080c,
-	0x9367, 0x00be, 0x0005, 0x781b, 0x0001, 0x7803, 0x0006, 0x001e,
-	0x00de, 0x00be, 0x0005, 0x792c, 0x9180, 0x0008, 0x200c, 0x9186,
-	0x0006, 0x01c0, 0x9186, 0x0003, 0x0904, 0x9ac5, 0x9186, 0x0005,
-	0x0904, 0x9aae, 0x9186, 0x0004, 0x05d8, 0x9186, 0x0008, 0x0904,
-	0x9ab6, 0x7807, 0x0037, 0x782f, 0x0003, 0x7817, 0x1700, 0x080c,
-	0x9b2a, 0x0005, 0x080c, 0x9aeb, 0x00d6, 0x0026, 0x792c, 0x2168,
-	0x2009, 0x4000, 0x6800, 0x0002, 0x9a8f, 0x9a9a, 0x9a91, 0x9a9a,
-	0x9a96, 0x9a8f, 0x9a8f, 0x9a9a, 0x9a9a, 0x9a9a, 0x9a9a, 0x9a8f,
-	0x9a8f, 0x9a8f, 0x9a8f, 0x9a8f, 0x9a9a, 0x9a8f, 0x9a9a, 0x080c,
-	0x0db4, 0x6824, 0xd0e4, 0x0110, 0xd0cc, 0x0110, 0x900e, 0x0010,
-	0x2009, 0x2000, 0x682c, 0x7022, 0x6830, 0x7026, 0x0804, 0x9ae4,
-	0x080c, 0x9aeb, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000,
-	0x6a00, 0x9286, 0x0002, 0x1108, 0x900e, 0x04b0, 0x04e1, 0x00d6,
-	0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x0470, 0x04a1, 0x00d6,
-	0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x9286, 0x0005, 0x0118,
-	0x9286, 0x0002, 0x1108, 0x900e, 0x00f8, 0x0429, 0x00d6, 0x0026,
-	0x792c, 0x2168, 0x6814, 0x0096, 0x2048, 0xa9ac, 0xa834, 0x9112,
-	0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022, 0x7226, 0x792c, 0x9180,
-	0x0000, 0x2004, 0x908e, 0x0002, 0x0130, 0x908e, 0x0004, 0x0118,
-	0x2009, 0x4000, 0x0008, 0x900e, 0x712a, 0x60c3, 0x0018, 0x002e,
-	0x00de, 0x0804, 0x9367, 0x00b6, 0x0036, 0x0046, 0x0056, 0x0066,
-	0x080c, 0x8eb1, 0x9006, 0x7003, 0x0200, 0x7938, 0x710a, 0x793c,
-	0x710e, 0x7810, 0x2058, 0xb8a0, 0x080c, 0x9d98, 0x1118, 0x9092,
-	0x007e, 0x0268, 0x00d6, 0x2069, 0x181e, 0x2d2c, 0x8d68, 0x2d34,
-	0x90d8, 0x1000, 0x2b5c, 0xbb10, 0xbc14, 0x00de, 0x0028, 0x901e,
-	0x6498, 0x2029, 0x0000, 0x6634, 0x782c, 0x9080, 0x0008, 0x2004,
-	0x9086, 0x0003, 0x1128, 0x7512, 0x7616, 0x731a, 0x741e, 0x0020,
-	0x7312, 0x7416, 0x751a, 0x761e, 0x006e, 0x005e, 0x004e, 0x003e,
-	0x00be, 0x0005, 0x080c, 0x8eb1, 0x7003, 0x0100, 0x782c, 0x700a,
-	0x7814, 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9367, 0x080c,
-	0x8e5d, 0x7003, 0x1400, 0x7838, 0x700a, 0x0079, 0x783c, 0x700e,
-	0x782c, 0x7012, 0x7830, 0x7016, 0x7834, 0x9084, 0x00ff, 0x8007,
-	0x701a, 0x60c3, 0x0010, 0x0804, 0x9367, 0x00e6, 0x2071, 0x0240,
-	0x0006, 0x00f6, 0x2078, 0x7810, 0x00b6, 0x2058, 0xb8bc, 0xd084,
-	0x0120, 0x7848, 0x702a, 0x7844, 0x702e, 0x00be, 0x00fe, 0x000e,
-	0x00ee, 0x0005, 0x080c, 0x8ea8, 0x7003, 0x0100, 0x782c, 0x700a,
-	0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9367, 0x0021, 0x60c3,
-	0x0000, 0x0804, 0x9367, 0x00d6, 0x080c, 0x9c26, 0xb810, 0x9085,
-	0x0300, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6878, 0x700a,
-	0x687c, 0x700e, 0x7013, 0x0819, 0x080c, 0x9355, 0x721a, 0x2f10,
-	0x7222, 0x7a08, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005, 0x00a9,
-	0x7914, 0x712a, 0x60c3, 0x0000, 0x60a7, 0x9575, 0x0026, 0x080c,
-	0x29ca, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e,
-	0x080c, 0x938a, 0x080c, 0x8087, 0x0005, 0x0036, 0x0096, 0x00d6,
-	0x00e6, 0x7858, 0x2048, 0xaa7c, 0x9296, 0x00c0, 0x9294, 0xfffd,
-	0xaa7e, 0xaa80, 0x9294, 0x0300, 0xaa82, 0xa96c, 0x9194, 0x00ff,
-	0xab74, 0x9384, 0x00ff, 0x908d, 0xc200, 0xa96e, 0x9384, 0xff00,
-	0x9215, 0xaa76, 0xa870, 0xaa78, 0xa87a, 0xaa72, 0x00d6, 0x2069,
-	0x0200, 0x080c, 0x9c26, 0x00de, 0x20e9, 0x0000, 0x20a1, 0x0240,
-	0x20a9, 0x000a, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098,
-	0x4003, 0x60a3, 0x0035, 0xaa68, 0x9294, 0x7000, 0x9286, 0x3000,
-	0x0110, 0x60a3, 0x0037, 0x00ee, 0x00de, 0x009e, 0x003e, 0x0005,
-	0x900e, 0x7814, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x01c0, 0x9084,
-	0x0003, 0x11a8, 0x2001, 0x180c, 0x2004, 0xd0bc, 0x0180, 0x7824,
-	0xd0cc, 0x1168, 0xd0c4, 0x1158, 0xa8a8, 0x9005, 0x1140, 0x2001,
-	0x180c, 0x200c, 0xc1d5, 0x2102, 0x2009, 0x1983, 0x210c, 0x009e,
-	0x918d, 0x0092, 0x0010, 0x2009, 0x0096, 0x60ab, 0x0036, 0x6116,
-	0x0005, 0x2009, 0x0009, 0x00a0, 0x2009, 0x000a, 0x0088, 0x2009,
-	0x000b, 0x0070, 0x2009, 0x000c, 0x0058, 0x2009, 0x000d, 0x0040,
-	0x2009, 0x000e, 0x0028, 0x2009, 0x000f, 0x0010, 0x2009, 0x0008,
-	0x6912, 0x0005, 0x00d6, 0x9290, 0x0018, 0x8214, 0x20e9, 0x0000,
-	0x2069, 0x0200, 0x6813, 0x0000, 0x22a8, 0x9284, 0x00e0, 0x0128,
-	0x20a9, 0x0020, 0x9292, 0x0020, 0x0008, 0x9016, 0x20a1, 0x0240,
-	0x9006, 0x4004, 0x82ff, 0x0120, 0x6810, 0x8000, 0x6812, 0x0c60,
-	0x00de, 0x0005, 0x00d6, 0x0096, 0x6014, 0x2048, 0xa878, 0x6056,
-	0x9006, 0xa836, 0xa83a, 0xa99c, 0xa946, 0xa84a, 0x6023, 0x0003,
-	0x6007, 0x0040, 0x6003, 0x0003, 0x600b, 0xffff, 0xa817, 0x0001,
-	0xa842, 0xa83e, 0x2900, 0xa85a, 0xa813, 0x1f24, 0x080c, 0x842e,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x8a26, 0x012e, 0x009e, 0x00de,
-	0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00a6, 0x0096, 0x0066,
-	0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x760c, 0x2660, 0x2678,
-	0x8cff, 0x0904, 0x9cf8, 0x7024, 0x9c06, 0x1520, 0x2069, 0x0100,
-	0x68c0, 0x9005, 0x0904, 0x9ccf, 0x080c, 0x9393, 0x68c3, 0x0000,
-	0x080c, 0x98c1, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04,
+	0xb8b0, 0x609e, 0x0050, 0x2039, 0x0029, 0x9705, 0x6072, 0x0cc0,
+	0x9185, 0x0200, 0x6062, 0x6073, 0x2029, 0xa87c, 0xd0fc, 0x0118,
+	0xaf94, 0x87ff, 0x1120, 0x2f00, 0x6082, 0x7808, 0x6086, 0x6266,
+	0x636a, 0x646e, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff,
+	0xb88e, 0x8007, 0x607a, 0x607f, 0x0000, 0xa838, 0x608a, 0xa834,
+	0x608e, 0xa848, 0x60c6, 0xa844, 0x60ca, 0xb86c, 0x60ce, 0x60af,
+	0x95d5, 0x60d7, 0x0000, 0x080c, 0x9c24, 0x2009, 0x07d0, 0x60c4,
+	0x9084, 0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58, 0x080c, 0x80bd,
+	0x003e, 0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x009e, 0x00be,
+	0x0005, 0x7804, 0x9086, 0x0040, 0x0904, 0x9319, 0x9185, 0x0100,
+	0x6062, 0x6266, 0x636a, 0x646e, 0x6073, 0x0809, 0x6077, 0x0008,
+	0x60af, 0x95d5, 0x60d7, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff,
+	0xb88e, 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00, 0x6082, 0x7808,
+	0x6086, 0x7814, 0x2048, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848,
+	0x60c6, 0xa844, 0x60ca, 0xb86c, 0x60ce, 0xbab0, 0x629e, 0x080c,
+	0x9c24, 0x2009, 0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110,
+	0x2009, 0x1b58, 0x080c, 0x80bd, 0x003e, 0x004e, 0x005e, 0x00ce,
+	0x00de, 0x00ee, 0x009e, 0x00be, 0x0005, 0x7814, 0x2048, 0xa87c,
+	0x9084, 0x0003, 0x9086, 0x0002, 0x0904, 0x9335, 0x9185, 0x0100,
+	0x6062, 0x6266, 0x636a, 0x646e, 0x6073, 0x0880, 0x6077, 0x0008,
+	0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a, 0x7838,
+	0x607e, 0x2f00, 0x6086, 0x7808, 0x6082, 0xa890, 0x608a, 0xa88c,
+	0x608e, 0xa8b0, 0x60c6, 0xa8ac, 0x60ca, 0xa8ac, 0x7930, 0x9108,
+	0x7932, 0xa8b0, 0x792c, 0x9109, 0x792e, 0xb86c, 0x60ce, 0x60af,
+	0x95d5, 0x60d7, 0x0000, 0xbab0, 0x629e, 0x080c, 0x9c01, 0x0804,
+	0x92c9, 0xb8bc, 0xd084, 0x0148, 0xb88c, 0x7814, 0x2048, 0xb88c,
+	0x7846, 0xa836, 0x2900, 0xa83a, 0xb04a, 0x9185, 0x0600, 0x6062,
+	0x6266, 0x636a, 0x646e, 0x6073, 0x0829, 0x6077, 0x0000, 0x60af,
+	0x9575, 0x60d7, 0x0000, 0x0804, 0x92ac, 0x9185, 0x0700, 0x6062,
+	0x6266, 0x636a, 0x646e, 0x7824, 0xd0cc, 0x7826, 0x0118, 0x6073,
+	0x0889, 0x0010, 0x6073, 0x0898, 0x6077, 0x0000, 0xb88c, 0x8000,
+	0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a, 0x607f, 0x0000, 0x2f00,
+	0x6086, 0x7808, 0x6082, 0xa838, 0x608a, 0xa834, 0x608e, 0xa848,
+	0x60c6, 0xa844, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5, 0x60d7,
+	0x0000, 0xbab0, 0x629e, 0x7824, 0xd0cc, 0x0120, 0x080c, 0x9c24,
+	0x0804, 0x92c9, 0x080c, 0x9c01, 0x0804, 0x92c9, 0x7a10, 0x00b6,
+	0x2258, 0xba8c, 0x8210, 0x9294, 0x00ff, 0xba8e, 0x00be, 0x8217,
+	0x0005, 0x00d6, 0x2069, 0x19b8, 0x6843, 0x0001, 0x00de, 0x0005,
+	0x60a3, 0x0056, 0x60a7, 0x9575, 0x00f1, 0x080c, 0x80af, 0x0005,
+	0x0016, 0x2001, 0x180c, 0x200c, 0x9184, 0x0600, 0x9086, 0x0600,
+	0x0128, 0x0089, 0x080c, 0x80af, 0x001e, 0x0005, 0xc1e5, 0x2001,
+	0x180c, 0x2102, 0x2001, 0x19b9, 0x2003, 0x0000, 0x2001, 0x19c1,
+	0x2003, 0x0000, 0x0c88, 0x0006, 0x6014, 0x9084, 0x1804, 0x9085,
+	0x0009, 0x6016, 0x000e, 0x0005, 0x0016, 0x00c6, 0x0006, 0x2061,
+	0x0100, 0x61a4, 0x60a7, 0x95f5, 0x6014, 0x9084, 0x1804, 0x9085,
+	0x0008, 0x6016, 0x000e, 0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce,
+	0x001e, 0x0005, 0x00c6, 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100,
+	0x2069, 0x0140, 0x080c, 0x6fb2, 0x11e8, 0x2001, 0x19d4, 0x2004,
+	0x9005, 0x1904, 0x9412, 0x0066, 0x2031, 0x0001, 0x080c, 0x7062,
+	0x006e, 0x1160, 0x2061, 0x0100, 0x6020, 0xd0b4, 0x1120, 0x6024,
+	0xd084, 0x090c, 0x0db4, 0x080c, 0x80af, 0x0460, 0x00c6, 0x2061,
+	0x19b8, 0x00d0, 0x6904, 0x9194, 0x4000, 0x0548, 0x080c, 0x93ac,
+	0x080c, 0x2b24, 0x00c6, 0x2061, 0x19b8, 0x6128, 0x9192, 0x0008,
+	0x1258, 0x8108, 0x612a, 0x6124, 0x00ce, 0x81ff, 0x0198, 0x080c,
+	0x80af, 0x080c, 0x93a3, 0x0070, 0x6124, 0x91e5, 0x0000, 0x0140,
+	0x080c, 0xd8c9, 0x080c, 0x80b8, 0x2009, 0x0014, 0x080c, 0x9eac,
+	0x00ce, 0x0000, 0x002e, 0x001e, 0x00de, 0x00ce, 0x0005, 0x2001,
+	0x19d4, 0x2004, 0x9005, 0x1db0, 0x00c6, 0x2061, 0x19b8, 0x6128,
+	0x9192, 0x0003, 0x1e08, 0x8108, 0x612a, 0x00ce, 0x080c, 0x80af,
+	0x080c, 0x5b90, 0x2009, 0x1852, 0x2114, 0x8210, 0x220a, 0x0c10,
+	0x0096, 0x00c6, 0x00d6, 0x00e6, 0x0016, 0x0026, 0x080c, 0x80c5,
+	0x2071, 0x19b8, 0x713c, 0x81ff, 0x0904, 0x94a2, 0x2061, 0x0100,
+	0x2069, 0x0140, 0x080c, 0x6fb2, 0x11b0, 0x0036, 0x2019, 0x0002,
+	0x080c, 0x96d8, 0x003e, 0x713c, 0x2160, 0x080c, 0xd8c9, 0x2009,
+	0x004a, 0x080c, 0x9eac, 0x0066, 0x2031, 0x0001, 0x080c, 0x7062,
+	0x006e, 0x0804, 0x94a2, 0x080c, 0x94ae, 0x0904, 0x94a2, 0x6904,
+	0xd1f4, 0x0904, 0x94a9, 0x080c, 0x2b24, 0x00c6, 0x703c, 0x9065,
+	0x090c, 0x0db4, 0x6020, 0x00ce, 0x9086, 0x0006, 0x1528, 0x61c8,
+	0x60c4, 0x9105, 0x1508, 0x2009, 0x180c, 0x2104, 0xd0d4, 0x01e0,
+	0x6214, 0x9294, 0x1800, 0x1128, 0x6224, 0x9294, 0x0002, 0x1510,
+	0x0030, 0xc0d4, 0x200a, 0xd0cc, 0x0110, 0x080c, 0x2a77, 0x6014,
+	0x9084, 0xe7fd, 0x9085, 0x0010, 0x6016, 0x703c, 0x2060, 0x2009,
+	0x0049, 0x080c, 0x9eac, 0x0070, 0x0036, 0x2019, 0x0001, 0x080c,
+	0x96d8, 0x003e, 0x713c, 0x2160, 0x080c, 0xd8c9, 0x2009, 0x004a,
+	0x080c, 0x9eac, 0x002e, 0x001e, 0x00ee, 0x00de, 0x00ce, 0x009e,
+	0x0005, 0xd1ec, 0x1904, 0x9463, 0x0804, 0x9465, 0x00d6, 0x00c6,
+	0x0096, 0x703c, 0x9065, 0x090c, 0x0db4, 0x2001, 0x1836, 0x2004,
+	0xd09c, 0x1904, 0x953a, 0x2001, 0x0306, 0x200c, 0x9184, 0x0030,
+	0x0904, 0x953a, 0x9184, 0x0048, 0x9086, 0x0008, 0x1904, 0x953a,
+	0x2001, 0x020b, 0x2004, 0xd0fc, 0x0904, 0x953a, 0xd08c, 0x0904,
+	0x953a, 0x2009, 0x1a50, 0x2104, 0x8000, 0x0208, 0x200a, 0x2069,
+	0x0100, 0x6914, 0x918c, 0x0184, 0x918d, 0x0010, 0x6916, 0x69c8,
+	0x2011, 0x0020, 0x68c8, 0x9106, 0x1570, 0x8211, 0x1dd8, 0x2001,
+	0x0306, 0x2003, 0x4800, 0x2001, 0x009a, 0x2003, 0x0004, 0x2001,
+	0x1a36, 0x2003, 0x0000, 0x2001, 0x1a3f, 0x2003, 0x0000, 0x6a88,
+	0x698c, 0x2200, 0x9105, 0x1120, 0x2c10, 0x080c, 0x1a5c, 0x0040,
+	0x6014, 0x2048, 0xaa3a, 0xa936, 0x6ac4, 0x69c8, 0xa946, 0xaa4a,
+	0x0126, 0x00c6, 0x2091, 0x2400, 0x002e, 0x080c, 0x1ae8, 0x190c,
+	0x0db4, 0x012e, 0x0090, 0x2009, 0x1a51, 0x2104, 0x8000, 0x0208,
+	0x200a, 0x69c8, 0x2011, 0x0020, 0x8211, 0x1df0, 0x68c8, 0x9106,
+	0x1dc0, 0x69c4, 0x68c8, 0x9105, 0x0160, 0x6824, 0xd08c, 0x0110,
+	0x6827, 0x0002, 0x7048, 0xc085, 0x704a, 0x0079, 0x7048, 0xc084,
+	0x704a, 0x2009, 0x07d0, 0x080c, 0x80bd, 0x9006, 0x009e, 0x00ce,
+	0x00de, 0x0005, 0x9085, 0x0001, 0x0cc8, 0x0026, 0x00e6, 0x2071,
+	0x19b8, 0x7048, 0xd084, 0x01c0, 0x713c, 0x81ff, 0x01a8, 0x2071,
+	0x0100, 0x9188, 0x0008, 0x2114, 0x928e, 0x0006, 0x1138, 0x7014,
+	0x9084, 0x1984, 0x9085, 0x0012, 0x7016, 0x0030, 0x7014, 0x9084,
+	0x1984, 0x9085, 0x0016, 0x7016, 0x00ee, 0x002e, 0x0005, 0x00b6,
+	0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0056, 0x0046, 0x0006, 0x0126,
+	0x2091, 0x8000, 0x6010, 0x2058, 0xbca0, 0x2071, 0x19b8, 0x7018,
+	0x2058, 0x8bff, 0x0190, 0xb8a0, 0x9406, 0x0118, 0xb854, 0x2058,
+	0x0cc0, 0x6014, 0x0096, 0x2048, 0xac6c, 0xad70, 0xae78, 0x009e,
+	0x080c, 0x6370, 0x0110, 0x9085, 0x0001, 0x012e, 0x000e, 0x004e,
+	0x005e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00be, 0x0005, 0x080c,
+	0x8e8e, 0x7003, 0x1200, 0x7838, 0x7012, 0x783c, 0x7016, 0x00c6,
+	0x7820, 0x9086, 0x0004, 0x1148, 0x7810, 0x9005, 0x0130, 0x00b6,
+	0x2058, 0xb810, 0xb914, 0x00be, 0x0020, 0x2061, 0x1800, 0x6078,
+	0x617c, 0x9084, 0x00ff, 0x700a, 0x710e, 0x00ce, 0x60c3, 0x002c,
+	0x0804, 0x9380, 0x080c, 0x8e8e, 0x7003, 0x0f00, 0x7808, 0xd09c,
+	0x0128, 0xb810, 0x9084, 0x00ff, 0x700a, 0xb814, 0x700e, 0x60c3,
+	0x0008, 0x0804, 0x9380, 0x0156, 0x080c, 0x8ed9, 0x7003, 0x0200,
+	0x2011, 0x1848, 0x63f0, 0x2312, 0x20a9, 0x0006, 0x2011, 0x1840,
+	0x2019, 0x1841, 0x9ef0, 0x0002, 0x2376, 0x8e70, 0x2276, 0x8e70,
+	0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0x95d4, 0x60c3, 0x001c,
+	0x015e, 0x0804, 0x9380, 0x0016, 0x0026, 0x080c, 0x8eb5, 0x080c,
+	0x8ec7, 0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0, 0x7814, 0x0096,
+	0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021,
+	0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x9192, 0x0010,
+	0x1250, 0x4003, 0x9080, 0x0004, 0x8003, 0x60c2, 0x080c, 0x9380,
+	0x002e, 0x001e, 0x0005, 0x20a9, 0x0010, 0x4003, 0x080c, 0x9c2a,
+	0x20a1, 0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c, 0x8e8e, 0x7003,
+	0x6200, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9380, 0x0016,
+	0x0026, 0x080c, 0x8e8e, 0x20e9, 0x0000, 0x20a1, 0x024c, 0x7814,
+	0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080,
+	0x0023, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x4003,
+	0x8003, 0x60c2, 0x080c, 0x9380, 0x002e, 0x001e, 0x0005, 0x00e6,
+	0x00c6, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x700c,
+	0x2060, 0x8cff, 0x0178, 0x080c, 0xbd1d, 0x1110, 0x080c, 0xa7c0,
+	0x600c, 0x0006, 0x080c, 0xbf84, 0x080c, 0x9e32, 0x080c, 0x97b0,
+	0x00ce, 0x0c78, 0x2c00, 0x700e, 0x700a, 0x012e, 0x000e, 0x00ce,
+	0x00ee, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6,
+	0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000, 0x2001, 0x180c,
+	0x200c, 0x918c, 0xe7ff, 0x2102, 0x2069, 0x0100, 0x2079, 0x0140,
+	0x2071, 0x19b8, 0x7024, 0x2060, 0x8cff, 0x01f8, 0x080c, 0x93ac,
+	0x6ac0, 0x68c3, 0x0000, 0x080c, 0x80b8, 0x00c6, 0x2061, 0x0100,
+	0x080c, 0x9c43, 0x00ce, 0x20a9, 0x01f4, 0x0461, 0x2009, 0x0013,
+	0x080c, 0x9eac, 0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de,
+	0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005, 0x2001, 0x1800, 0x2004,
+	0x9096, 0x0001, 0x0d78, 0x9096, 0x0004, 0x0d60, 0x080c, 0x80b8,
+	0x6814, 0x9084, 0x0001, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008,
+	0x68c3, 0x0000, 0x2011, 0x5b3a, 0x080c, 0x8038, 0x20a9, 0x01f4,
+	0x0009, 0x08c0, 0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804,
+	0x9084, 0x4000, 0x190c, 0x2b24, 0x0090, 0xd084, 0x0118, 0x6827,
+	0x0001, 0x0010, 0x1f04, 0x96ba, 0x7804, 0x9084, 0x1000, 0x0138,
+	0x2001, 0x0100, 0x080c, 0x2b14, 0x9006, 0x080c, 0x2b14, 0x0005,
+	0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026,
+	0x0016, 0x0006, 0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c,
+	0xdbff, 0x2102, 0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x19b8,
+	0x703c, 0x2060, 0x8cff, 0x0904, 0x9766, 0x9386, 0x0002, 0x1128,
+	0x6814, 0x9084, 0x0002, 0x0904, 0x9766, 0x68af, 0x95f5, 0x6817,
+	0x0010, 0x2009, 0x00fa, 0x8109, 0x1df0, 0x69c6, 0x68cb, 0x0008,
+	0x080c, 0x80c5, 0x080c, 0x1e90, 0x0046, 0x2009, 0x00a5, 0x080c,
+	0x0e2f, 0x2021, 0x0169, 0x2404, 0x9084, 0x000f, 0x9086, 0x0004,
+	0x11f8, 0x68af, 0x95f5, 0x68c6, 0x68cb, 0x0008, 0x00e6, 0x00f6,
+	0x2079, 0x0090, 0x2071, 0x1a36, 0x6814, 0x9084, 0x1984, 0x9085,
+	0x0012, 0x6816, 0x782b, 0x0008, 0x7003, 0x0000, 0x00fe, 0x00ee,
+	0x9386, 0x0002, 0x1128, 0x7884, 0x9005, 0x1110, 0x7887, 0x0001,
+	0x2001, 0x1952, 0x200c, 0x080c, 0x0e2f, 0x004e, 0x20a9, 0x03e8,
+	0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000,
+	0x190c, 0x2b24, 0x0090, 0xd08c, 0x0118, 0x6827, 0x0002, 0x0010,
+	0x1f04, 0x9740, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100,
+	0x080c, 0x2b14, 0x9006, 0x080c, 0x2b14, 0x6827, 0x4000, 0x6824,
+	0x83ff, 0x1120, 0x2009, 0x0049, 0x080c, 0x9eac, 0x000e, 0x001e,
+	0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e,
+	0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19b8, 0x6a06,
+	0x012e, 0x00de, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069,
+	0x19b8, 0x6a32, 0x012e, 0x00de, 0x0005, 0x080c, 0x9047, 0x7854,
+	0x7032, 0x7042, 0x7047, 0x1000, 0x00f8, 0x080c, 0x9047, 0x7854,
+	0x7032, 0x7042, 0x7047, 0x4000, 0x00b8, 0x080c, 0x9047, 0x7854,
+	0x7032, 0x7042, 0x7047, 0x2000, 0x0078, 0x080c, 0x9047, 0x7854,
+	0x7032, 0x7042, 0x7047, 0x0400, 0x0038, 0x080c, 0x9047, 0x7854,
+	0x7032, 0x7042, 0x7047, 0x0200, 0x60c3, 0x0020, 0x0804, 0x9380,
+	0x00e6, 0x2071, 0x19b8, 0x7020, 0x9005, 0x0110, 0x8001, 0x7022,
+	0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066,
+	0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x7614, 0x2660,
+	0x2678, 0x2039, 0x0001, 0x87ff, 0x0904, 0x9855, 0x8cff, 0x0904,
+	0x9855, 0x6020, 0x9086, 0x0006, 0x1904, 0x9850, 0x88ff, 0x0138,
+	0x2800, 0x9c06, 0x1904, 0x9850, 0x2039, 0x0000, 0x0050, 0x6010,
+	0x9b06, 0x1904, 0x9850, 0x85ff, 0x0120, 0x6054, 0x9106, 0x1904,
+	0x9850, 0x7024, 0x9c06, 0x15b0, 0x2069, 0x0100, 0x68c0, 0x9005,
+	0x1160, 0x6824, 0xd084, 0x0148, 0x6827, 0x0001, 0x080c, 0x80b8,
+	0x080c, 0x98da, 0x7027, 0x0000, 0x0428, 0x080c, 0x80b8, 0x6820,
+	0xd0b4, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000,
+	0x080c, 0x98da, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04,
 	0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2b14, 0x9006,
 	0x080c, 0x2b14, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827,
-	0x0001, 0x003e, 0x700c, 0x9c36, 0x1110, 0x660c, 0x760e, 0x7008,
-	0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700a, 0x0010,
-	0x700b, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e,
-	0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xbcf3, 0x1158, 0x080c,
-	0x2ffc, 0x080c, 0xbd04, 0x11f0, 0x080c, 0xa7a7, 0x00d8, 0x080c,
-	0x98c1, 0x08c0, 0x080c, 0xbd04, 0x1118, 0x080c, 0xa7a7, 0x0090,
-	0x6014, 0x2048, 0x080c, 0xbafc, 0x0168, 0x6020, 0x9086, 0x0003,
-	0x1520, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6885,
-	0x080c, 0xbce7, 0x080c, 0xbf6b, 0x080c, 0x9e49, 0x080c, 0x9797,
-	0x00ce, 0x0804, 0x9c80, 0x2c78, 0x600c, 0x2060, 0x0804, 0x9c80,
-	0x700f, 0x0000, 0x700b, 0x0000, 0x012e, 0x006e, 0x009e, 0x00ae,
-	0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086, 0x0006,
-	0x1d08, 0x080c, 0xd4b5, 0x08f0, 0x00d6, 0x0156, 0x080c, 0x8eb1,
-	0x7a14, 0x82ff, 0x0138, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3,
-	0x0008, 0x0490, 0x7003, 0x0200, 0x7007, 0x0000, 0x2069, 0x1800,
-	0x901e, 0x6800, 0x9086, 0x0004, 0x1110, 0xc38d, 0x0060, 0x080c,
-	0x6fa7, 0x1110, 0xc3ad, 0x0008, 0xc3a5, 0x6ad8, 0xd29c, 0x1110,
-	0xd2ac, 0x0108, 0xc39d, 0x730e, 0x2011, 0x1848, 0x63f0, 0x2312,
-	0x20a9, 0x0006, 0x2011, 0x1840, 0x2019, 0x1841, 0x2071, 0x0250,
-	0x2376, 0x8e70, 0x2276, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002,
-	0x1f04, 0x9d40, 0x60c3, 0x0020, 0x080c, 0x9367, 0x015e, 0x00de,
-	0x0005, 0x0156, 0x080c, 0x8eb1, 0x7a14, 0x82ff, 0x0168, 0x9286,
-	0xffff, 0x0118, 0x9282, 0x000e, 0x1238, 0x7003, 0x0100, 0x700b,
-	0x0003, 0x60c3, 0x0008, 0x0488, 0x7003, 0x0200, 0x7007, 0x001c,
-	0x700f, 0x0001, 0x2011, 0x198e, 0x2204, 0x8007, 0x701a, 0x8210,
-	0x2204, 0x8007, 0x701e, 0x0421, 0x1120, 0xb8a0, 0x9082, 0x007f,
-	0x0248, 0x2001, 0x181e, 0x2004, 0x7022, 0x2001, 0x181f, 0x2004,
-	0x7026, 0x0030, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff, 0x7026,
-	0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000,
-	0x20a1, 0x0256, 0x4003, 0x60c3, 0x001c, 0x015e, 0x0804, 0x9367,
-	0x0006, 0x2001, 0x1836, 0x2004, 0xd0ac, 0x000e, 0x0005, 0x2011,
-	0x0003, 0x080c, 0x9758, 0x2011, 0x0002, 0x080c, 0x9762, 0x080c,
-	0x9649, 0x0036, 0x901e, 0x080c, 0x96bf, 0x003e, 0x0005, 0x2071,
-	0x1883, 0x7000, 0x9005, 0x0140, 0x2001, 0x0976, 0x2071, 0x1800,
-	0x7072, 0x7076, 0x7067, 0xffe0, 0x2071, 0x1800, 0x7070, 0x7052,
-	0x7057, 0x1cd0, 0x0005, 0x00e6, 0x0126, 0x2071, 0x1800, 0x2091,
-	0x8000, 0x7550, 0x9582, 0x0010, 0x0608, 0x7054, 0x2060, 0x6000,
-	0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018, 0x7064, 0x9c02, 0x1208,
-	0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7552,
-	0x9ca8, 0x0018, 0x7064, 0x9502, 0x1230, 0x7556, 0x9085, 0x0001,
-	0x012e, 0x00ee, 0x0005, 0x7057, 0x1cd0, 0x0cc0, 0x9006, 0x0cc0,
-	0x00e6, 0x2071, 0x1800, 0x7550, 0x9582, 0x0010, 0x0600, 0x7054,
-	0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018, 0x7064,
-	0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003, 0x0008,
-	0x8529, 0x7552, 0x9ca8, 0x0018, 0x7064, 0x9502, 0x1228, 0x7556,
-	0x9085, 0x0001, 0x00ee, 0x0005, 0x7057, 0x1cd0, 0x0cc8, 0x9006,
-	0x0cc8, 0x9c82, 0x1cd0, 0x0a0c, 0x0db4, 0x2001, 0x1819, 0x2004,
-	0x9c02, 0x1a0c, 0x0db4, 0x9006, 0x6006, 0x600a, 0x600e, 0x6016,
-	0x601a, 0x6012, 0x6023, 0x0000, 0x6003, 0x0000, 0x601e, 0x6056,
-	0x605a, 0x6026, 0x602a, 0x602e, 0x6032, 0x6036, 0x603a, 0x603e,
-	0x6042, 0x2061, 0x1800, 0x6050, 0x8000, 0x6052, 0x9086, 0x0001,
-	0x0108, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x894b, 0x012e,
-	0x0cc0, 0x0006, 0x6000, 0x9086, 0x0000, 0x01b0, 0x601c, 0xd084,
-	0x190c, 0x190d, 0x6017, 0x0000, 0x6023, 0x0007, 0x2001, 0x1957,
-	0x2004, 0x0006, 0x9082, 0x0051, 0x000e, 0x0208, 0x8004, 0x601a,
-	0x080c, 0xd767, 0x6043, 0x0000, 0x000e, 0x0005, 0x00e6, 0x0126,
-	0x2071, 0x1800, 0x2091, 0x8000, 0x7550, 0x9582, 0x0001, 0x0608,
+	0x0001, 0x003e, 0x7014, 0x9c36, 0x1110, 0x660c, 0x7616, 0x7010,
+	0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7012, 0x0010,
+	0x7013, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e,
+	0x0008, 0x2678, 0x89ff, 0x1168, 0x600f, 0x0000, 0x6014, 0x0096,
+	0x2048, 0x080c, 0xbb15, 0x0110, 0x080c, 0xd4d5, 0x009e, 0x080c,
+	0x9e62, 0x080c, 0x97b0, 0x88ff, 0x1190, 0x00ce, 0x0804, 0x97cb,
+	0x2c78, 0x600c, 0x2060, 0x0804, 0x97cb, 0x9006, 0x012e, 0x000e,
+	0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b,
+	0x0000, 0x00ce, 0x98c5, 0x0001, 0x0c88, 0x00f6, 0x00e6, 0x00d6,
+	0x0096, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000,
+	0x2071, 0x19b8, 0x7638, 0x2660, 0x2678, 0x8cff, 0x0904, 0x98c9,
+	0x6020, 0x9086, 0x0006, 0x1904, 0x98c4, 0x87ff, 0x0128, 0x2700,
+	0x9c06, 0x1904, 0x98c4, 0x0040, 0x6010, 0x9b06, 0x15e8, 0x85ff,
+	0x0118, 0x6054, 0x9106, 0x15c0, 0x703c, 0x9c06, 0x1168, 0x0036,
+	0x2019, 0x0001, 0x080c, 0x96d8, 0x7033, 0x0000, 0x9006, 0x703e,
+	0x7042, 0x7046, 0x704a, 0x003e, 0x7038, 0x9c36, 0x1110, 0x660c,
+	0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
+	0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
+	0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6014, 0x2048,
+	0x080c, 0xbb15, 0x0110, 0x080c, 0xd4d5, 0x080c, 0x9e62, 0x87ff,
+	0x1198, 0x00ce, 0x0804, 0x9875, 0x2c78, 0x600c, 0x2060, 0x0804,
+	0x9875, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x009e,
+	0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce, 0x97bd,
+	0x0001, 0x0c80, 0x00e6, 0x2071, 0x19b8, 0x2001, 0x1800, 0x2004,
+	0x9086, 0x0002, 0x1118, 0x7007, 0x0005, 0x0010, 0x7007, 0x0000,
+	0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0066, 0x0026, 0x0006,
+	0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x2c10, 0x7638, 0x2660,
+	0x2678, 0x8cff, 0x0518, 0x2200, 0x9c06, 0x11e0, 0x7038, 0x9c36,
+	0x1110, 0x660c, 0x763a, 0x7034, 0x9c36, 0x1140, 0x2c00, 0x9f36,
+	0x0118, 0x2f00, 0x7036, 0x0010, 0x7037, 0x0000, 0x660c, 0x2c00,
+	0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x9085,
+	0x0001, 0x0020, 0x2c78, 0x600c, 0x2060, 0x08d8, 0x012e, 0x000e,
+	0x002e, 0x006e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0096, 0x00f6,
+	0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091,
+	0x8000, 0x2071, 0x19b8, 0x760c, 0x2660, 0x2678, 0x8cff, 0x0904,
+	0x99b6, 0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x1904,
+	0x99b1, 0x7024, 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005,
+	0x0904, 0x998d, 0x080c, 0x93ac, 0x68c3, 0x0000, 0x080c, 0x98da,
+	0x7027, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
+	0x0138, 0x2001, 0x0100, 0x080c, 0x2b14, 0x9006, 0x080c, 0x2b14,
+	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e,
+	0x700c, 0x9c36, 0x1110, 0x660c, 0x760e, 0x7008, 0x9c36, 0x1140,
+	0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700a, 0x0010, 0x700b, 0x0000,
+	0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678,
+	0x600f, 0x0000, 0x080c, 0xbd0c, 0x1158, 0x080c, 0x3003, 0x080c,
+	0xbd1d, 0x11f0, 0x080c, 0xa7c0, 0x00d8, 0x080c, 0x98da, 0x08c0,
+	0x080c, 0xbd1d, 0x1118, 0x080c, 0xa7c0, 0x0090, 0x6014, 0x2048,
+	0x080c, 0xbb15, 0x0168, 0x6020, 0x9086, 0x0003, 0x1508, 0xa867,
+	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x687f, 0x080c, 0xbd00,
+	0x080c, 0xbf84, 0x080c, 0x9e62, 0x080c, 0x97b0, 0x00ce, 0x0804,
+	0x9936, 0x2c78, 0x600c, 0x2060, 0x0804, 0x9936, 0x012e, 0x000e,
+	0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e, 0x0005,
+	0x6020, 0x9086, 0x0006, 0x1d20, 0x080c, 0xd4d5, 0x0c08, 0x00d6,
+	0x080c, 0x8ed9, 0x7003, 0x0200, 0x7007, 0x0014, 0x60c3, 0x0014,
+	0x20e1, 0x0001, 0x2099, 0x195a, 0x20e9, 0x0000, 0x20a1, 0x0250,
+	0x20a9, 0x0004, 0x4003, 0x7023, 0x0004, 0x7027, 0x7878, 0x080c,
+	0x9380, 0x00de, 0x0005, 0x080c, 0x8ed9, 0x700b, 0x0800, 0x7814,
+	0x9084, 0xff00, 0x700e, 0x7814, 0x9084, 0x00ff, 0x7022, 0x782c,
+	0x7026, 0x7858, 0x9084, 0x00ff, 0x9085, 0x0200, 0x7002, 0x7858,
+	0x9084, 0xff00, 0x8007, 0x7006, 0x60c2, 0x0804, 0x9380, 0x00b6,
+	0x00d6, 0x0016, 0x00d6, 0x2f68, 0x2009, 0x0035, 0x080c, 0xc18a,
+	0x00de, 0x1904, 0x9a64, 0x080c, 0x8e8e, 0x7003, 0x1300, 0x782c,
+	0x080c, 0x9b66, 0x2068, 0x6820, 0x9086, 0x0003, 0x0560, 0x7810,
+	0x2058, 0xbaa0, 0x080c, 0x9db1, 0x11d8, 0x9286, 0x007e, 0x1128,
+	0x700b, 0x00ff, 0x700f, 0xfffe, 0x0498, 0x9286, 0x007f, 0x1128,
+	0x700b, 0x00ff, 0x700f, 0xfffd, 0x0458, 0x9284, 0xff80, 0x0180,
+	0x9286, 0x0080, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffc, 0x0400,
+	0x92d8, 0x1000, 0x2b5c, 0xb810, 0x700a, 0xb814, 0x700e, 0x00c0,
+	0x6098, 0x700e, 0x00a8, 0x080c, 0x9db1, 0x1130, 0x7810, 0x2058,
+	0xb8a0, 0x9082, 0x007e, 0x0250, 0x00d6, 0x2069, 0x181e, 0x2d04,
+	0x700a, 0x8d68, 0x2d04, 0x700e, 0x00de, 0x0010, 0x6034, 0x700e,
+	0x7838, 0x7012, 0x783c, 0x7016, 0x60c3, 0x000c, 0x001e, 0x00de,
+	0x080c, 0x9380, 0x00be, 0x0005, 0x781b, 0x0001, 0x7803, 0x0006,
+	0x001e, 0x00de, 0x00be, 0x0005, 0x792c, 0x9180, 0x0008, 0x200c,
+	0x9186, 0x0006, 0x01c0, 0x9186, 0x0003, 0x0904, 0x9ade, 0x9186,
+	0x0005, 0x0904, 0x9ac7, 0x9186, 0x0004, 0x05d8, 0x9186, 0x0008,
+	0x0904, 0x9acf, 0x7807, 0x0037, 0x782f, 0x0003, 0x7817, 0x1700,
+	0x080c, 0x9b43, 0x0005, 0x080c, 0x9b04, 0x00d6, 0x0026, 0x792c,
+	0x2168, 0x2009, 0x4000, 0x6800, 0x0002, 0x9aa8, 0x9ab3, 0x9aaa,
+	0x9ab3, 0x9aaf, 0x9aa8, 0x9aa8, 0x9ab3, 0x9ab3, 0x9ab3, 0x9ab3,
+	0x9aa8, 0x9aa8, 0x9aa8, 0x9aa8, 0x9aa8, 0x9ab3, 0x9aa8, 0x9ab3,
+	0x080c, 0x0db4, 0x6824, 0xd0e4, 0x0110, 0xd0cc, 0x0110, 0x900e,
+	0x0010, 0x2009, 0x2000, 0x682c, 0x7022, 0x6830, 0x7026, 0x0804,
+	0x9afd, 0x080c, 0x9b04, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009,
+	0x4000, 0x6a00, 0x9286, 0x0002, 0x1108, 0x900e, 0x04b0, 0x04e1,
+	0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x0470, 0x04a1,
+	0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x9286, 0x0005,
+	0x0118, 0x9286, 0x0002, 0x1108, 0x900e, 0x00f8, 0x0429, 0x00d6,
+	0x0026, 0x792c, 0x2168, 0x6814, 0x0096, 0x2048, 0xa9ac, 0xa834,
+	0x9112, 0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022, 0x7226, 0x792c,
+	0x9180, 0x0000, 0x2004, 0x908e, 0x0002, 0x0130, 0x908e, 0x0004,
+	0x0118, 0x2009, 0x4000, 0x0008, 0x900e, 0x712a, 0x60c3, 0x0018,
+	0x002e, 0x00de, 0x0804, 0x9380, 0x00b6, 0x0036, 0x0046, 0x0056,
+	0x0066, 0x080c, 0x8ed9, 0x9006, 0x7003, 0x0200, 0x7938, 0x710a,
+	0x793c, 0x710e, 0x7810, 0x2058, 0xb8a0, 0x080c, 0x9db1, 0x1118,
+	0x9092, 0x007e, 0x0268, 0x00d6, 0x2069, 0x181e, 0x2d2c, 0x8d68,
+	0x2d34, 0x90d8, 0x1000, 0x2b5c, 0xbb10, 0xbc14, 0x00de, 0x0028,
+	0x901e, 0x6498, 0x2029, 0x0000, 0x6634, 0x782c, 0x9080, 0x0008,
+	0x2004, 0x9086, 0x0003, 0x1128, 0x7512, 0x7616, 0x731a, 0x741e,
+	0x0020, 0x7312, 0x7416, 0x751a, 0x761e, 0x006e, 0x005e, 0x004e,
+	0x003e, 0x00be, 0x0005, 0x080c, 0x8ed9, 0x7003, 0x0100, 0x782c,
+	0x700a, 0x7814, 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9380,
+	0x080c, 0x8e85, 0x7003, 0x1400, 0x7838, 0x700a, 0x0079, 0x783c,
+	0x700e, 0x782c, 0x7012, 0x7830, 0x7016, 0x7834, 0x9084, 0x00ff,
+	0x8007, 0x701a, 0x60c3, 0x0010, 0x0804, 0x9380, 0x00e6, 0x2071,
+	0x0240, 0x0006, 0x00f6, 0x2078, 0x7810, 0x00b6, 0x2058, 0xb8bc,
+	0xd084, 0x0120, 0x7848, 0x702a, 0x7844, 0x702e, 0x00be, 0x00fe,
+	0x000e, 0x00ee, 0x0005, 0x080c, 0x8ed0, 0x7003, 0x0100, 0x782c,
+	0x700a, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x9380, 0x0021,
+	0x60c3, 0x0000, 0x0804, 0x9380, 0x00d6, 0x080c, 0x9c3f, 0xb810,
+	0x9085, 0x0300, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6878,
+	0x700a, 0x687c, 0x700e, 0x7013, 0x0819, 0x080c, 0x936e, 0x721a,
+	0x2f10, 0x7222, 0x7a08, 0x7226, 0x2071, 0x024c, 0x00de, 0x0005,
+	0x00a9, 0x7914, 0x712a, 0x60c3, 0x0000, 0x60a7, 0x9575, 0x0026,
+	0x080c, 0x29ca, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012,
+	0x002e, 0x080c, 0x93a3, 0x080c, 0x80af, 0x0005, 0x0036, 0x0096,
+	0x00d6, 0x00e6, 0x7858, 0x2048, 0xaa7c, 0x9296, 0x00c0, 0x9294,
+	0xfffd, 0xaa7e, 0xaa80, 0x9294, 0x0300, 0xaa82, 0xa96c, 0x9194,
+	0x00ff, 0xab74, 0x9384, 0x00ff, 0x908d, 0xc200, 0xa96e, 0x9384,
+	0xff00, 0x9215, 0xaa76, 0xa870, 0xaa78, 0xa87a, 0xaa72, 0x00d6,
+	0x2069, 0x0200, 0x080c, 0x9c3f, 0x00de, 0x20e9, 0x0000, 0x20a1,
+	0x0240, 0x20a9, 0x000a, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b,
+	0x2098, 0x4003, 0x60a3, 0x0035, 0xaa68, 0x9294, 0x7000, 0x9286,
+	0x3000, 0x0110, 0x60a3, 0x0037, 0x00ee, 0x00de, 0x009e, 0x003e,
+	0x0005, 0x900e, 0x7814, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x01c0,
+	0x9084, 0x0003, 0x11a8, 0x2001, 0x180c, 0x2004, 0xd0bc, 0x0180,
+	0x7824, 0xd0cc, 0x1168, 0xd0c4, 0x1158, 0xa8a8, 0x9005, 0x1140,
+	0x2001, 0x180c, 0x200c, 0xc1d5, 0x2102, 0x2009, 0x1983, 0x210c,
+	0x009e, 0x918d, 0x0092, 0x0010, 0x2009, 0x0096, 0x60ab, 0x0036,
+	0x6116, 0x0005, 0x2009, 0x0009, 0x00a0, 0x2009, 0x000a, 0x0088,
+	0x2009, 0x000b, 0x0070, 0x2009, 0x000c, 0x0058, 0x2009, 0x000d,
+	0x0040, 0x2009, 0x000e, 0x0028, 0x2009, 0x000f, 0x0010, 0x2009,
+	0x0008, 0x6912, 0x0005, 0x00d6, 0x9290, 0x0018, 0x8214, 0x20e9,
+	0x0000, 0x2069, 0x0200, 0x6813, 0x0000, 0x22a8, 0x9284, 0x00e0,
+	0x0128, 0x20a9, 0x0020, 0x9292, 0x0020, 0x0008, 0x9016, 0x20a1,
+	0x0240, 0x9006, 0x4004, 0x82ff, 0x0120, 0x6810, 0x8000, 0x6812,
+	0x0c60, 0x00de, 0x0005, 0x00d6, 0x0096, 0x6014, 0x2048, 0xa878,
+	0x6056, 0x9006, 0xa836, 0xa83a, 0xa99c, 0xa946, 0xa84a, 0x6023,
+	0x0003, 0x6007, 0x0040, 0x6003, 0x0003, 0x600b, 0xffff, 0xa817,
+	0x0001, 0xa842, 0xa83e, 0x2900, 0xa85a, 0xa813, 0x1f24, 0x080c,
+	0x8456, 0x0126, 0x2091, 0x8000, 0x080c, 0x8a4e, 0x012e, 0x009e,
+	0x00de, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00a6, 0x0096,
+	0x0066, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x760c, 0x2660,
+	0x2678, 0x8cff, 0x0904, 0x9d11, 0x7024, 0x9c06, 0x1520, 0x2069,
+	0x0100, 0x68c0, 0x9005, 0x0904, 0x9ce8, 0x080c, 0x93ac, 0x68c3,
+	0x0000, 0x080c, 0x98da, 0x7027, 0x0000, 0x0036, 0x2069, 0x0140,
+	0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2b14,
+	0x9006, 0x080c, 0x2b14, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110,
+	0x6827, 0x0001, 0x003e, 0x700c, 0x9c36, 0x1110, 0x660c, 0x760e,
+	0x7008, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700a,
+	0x0010, 0x700b, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110,
+	0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xbd0c, 0x1158,
+	0x080c, 0x3003, 0x080c, 0xbd1d, 0x11f0, 0x080c, 0xa7c0, 0x00d8,
+	0x080c, 0x98da, 0x08c0, 0x080c, 0xbd1d, 0x1118, 0x080c, 0xa7c0,
+	0x0090, 0x6014, 0x2048, 0x080c, 0xbb15, 0x0168, 0x6020, 0x9086,
+	0x0003, 0x1520, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
+	0x688c, 0x080c, 0xbd00, 0x080c, 0xbf84, 0x080c, 0x9e62, 0x080c,
+	0x97b0, 0x00ce, 0x0804, 0x9c99, 0x2c78, 0x600c, 0x2060, 0x0804,
+	0x9c99, 0x700f, 0x0000, 0x700b, 0x0000, 0x012e, 0x006e, 0x009e,
+	0x00ae, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020, 0x9086,
+	0x0006, 0x1d08, 0x080c, 0xd4d5, 0x08f0, 0x00d6, 0x0156, 0x080c,
+	0x8ed9, 0x7a14, 0x82ff, 0x0138, 0x7003, 0x0100, 0x700b, 0x0003,
+	0x60c3, 0x0008, 0x0490, 0x7003, 0x0200, 0x7007, 0x0000, 0x2069,
+	0x1800, 0x901e, 0x6800, 0x9086, 0x0004, 0x1110, 0xc38d, 0x0060,
+	0x080c, 0x6fb2, 0x1110, 0xc3ad, 0x0008, 0xc3a5, 0x6ad8, 0xd29c,
+	0x1110, 0xd2ac, 0x0108, 0xc39d, 0x730e, 0x2011, 0x1848, 0x63f0,
+	0x2312, 0x20a9, 0x0006, 0x2011, 0x1840, 0x2019, 0x1841, 0x2071,
+	0x0250, 0x2376, 0x8e70, 0x2276, 0x8e70, 0x9398, 0x0002, 0x9290,
+	0x0002, 0x1f04, 0x9d59, 0x60c3, 0x0020, 0x080c, 0x9380, 0x015e,
+	0x00de, 0x0005, 0x0156, 0x080c, 0x8ed9, 0x7a14, 0x82ff, 0x0168,
+	0x9286, 0xffff, 0x0118, 0x9282, 0x000e, 0x1238, 0x7003, 0x0100,
+	0x700b, 0x0003, 0x60c3, 0x0008, 0x0488, 0x7003, 0x0200, 0x7007,
+	0x001c, 0x700f, 0x0001, 0x2011, 0x198e, 0x2204, 0x8007, 0x701a,
+	0x8210, 0x2204, 0x8007, 0x701e, 0x0421, 0x1120, 0xb8a0, 0x9082,
+	0x007f, 0x0248, 0x2001, 0x181e, 0x2004, 0x7022, 0x2001, 0x181f,
+	0x2004, 0x7026, 0x0030, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff,
+	0x7026, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
+	0x0000, 0x20a1, 0x0256, 0x4003, 0x60c3, 0x001c, 0x015e, 0x0804,
+	0x9380, 0x0006, 0x2001, 0x1836, 0x2004, 0xd0ac, 0x000e, 0x0005,
+	0x2011, 0x0003, 0x080c, 0x9771, 0x2011, 0x0002, 0x080c, 0x977b,
+	0x080c, 0x9662, 0x0036, 0x901e, 0x080c, 0x96d8, 0x003e, 0x0005,
+	0x2071, 0x1883, 0x7000, 0x9005, 0x0140, 0x2001, 0x0976, 0x2071,
+	0x1800, 0x7072, 0x7076, 0x7067, 0xffe0, 0x2071, 0x1800, 0x7070,
+	0x7052, 0x7057, 0x1cd0, 0x0005, 0x00e6, 0x0126, 0x2071, 0x1800,
+	0x2091, 0x8000, 0x7550, 0x9582, 0x0010, 0x0608, 0x7054, 0x2060,
+	0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018, 0x7064, 0x9c02,
+	0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003, 0x0008, 0x8529,
+	0x7552, 0x9ca8, 0x0018, 0x7064, 0x9502, 0x1230, 0x7556, 0x9085,
+	0x0001, 0x012e, 0x00ee, 0x0005, 0x7057, 0x1cd0, 0x0cc0, 0x9006,
+	0x0cc0, 0x00e6, 0x2071, 0x1800, 0x7550, 0x9582, 0x0010, 0x0600,
 	0x7054, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x0018,
 	0x7064, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98, 0x6003,
-	0x0008, 0x8529, 0x7552, 0x9ca8, 0x0018, 0x7064, 0x9502, 0x1230,
-	0x7556, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x7057, 0x1cd0,
-	0x0cc0, 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002, 0x9ea6,
-	0x9eaf, 0x9eca, 0x9ee5, 0xc21f, 0xc23c, 0xc257, 0x9ea6, 0x9eaf,
-	0x9ea6, 0x9f01, 0x9ea6, 0x9ea6, 0x9ea6, 0x9ea6, 0x9186, 0x0013,
-	0x1128, 0x080c, 0x8846, 0x080c, 0x894b, 0x0005, 0x0005, 0x0066,
-	0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0db4, 0x0013, 0x006e, 0x0005,
-	0x9ec8, 0xa620, 0xa7ee, 0x9ec8, 0xa87c, 0xa1e4, 0x9ec8, 0x9ec8,
-	0xa5a2, 0xae1e, 0x9ec8, 0x9ec8, 0x9ec8, 0x9ec8, 0x9ec8, 0x9ec8,
+	0x0008, 0x8529, 0x7552, 0x9ca8, 0x0018, 0x7064, 0x9502, 0x1228,
+	0x7556, 0x9085, 0x0001, 0x00ee, 0x0005, 0x7057, 0x1cd0, 0x0cc8,
+	0x9006, 0x0cc8, 0x9c82, 0x1cd0, 0x0a0c, 0x0db4, 0x2001, 0x1819,
+	0x2004, 0x9c02, 0x1a0c, 0x0db4, 0x9006, 0x6006, 0x600a, 0x600e,
+	0x6016, 0x601a, 0x6012, 0x6023, 0x0000, 0x6003, 0x0000, 0x601e,
+	0x6056, 0x605a, 0x6026, 0x602a, 0x602e, 0x6032, 0x6036, 0x603a,
+	0x603e, 0x6042, 0x2061, 0x1800, 0x6050, 0x8000, 0x6052, 0x9086,
+	0x0001, 0x0108, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x8973,
+	0x012e, 0x0cc0, 0x0006, 0x6000, 0x9086, 0x0000, 0x01b0, 0x601c,
+	0xd084, 0x190c, 0x190d, 0x6017, 0x0000, 0x6023, 0x0007, 0x2001,
+	0x1957, 0x2004, 0x0006, 0x9082, 0x0051, 0x000e, 0x0208, 0x8004,
+	0x601a, 0x080c, 0xd787, 0x6043, 0x0000, 0x000e, 0x0005, 0x00e6,
+	0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7550, 0x9582, 0x0001,
+	0x0608, 0x7054, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0,
+	0x0018, 0x7064, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1cd0, 0x0c98,
+	0x6003, 0x0008, 0x8529, 0x7552, 0x9ca8, 0x0018, 0x7064, 0x9502,
+	0x1230, 0x7556, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x7057,
+	0x1cd0, 0x0cc0, 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002,
+	0x9ebf, 0x9ec8, 0x9ee3, 0x9efe, 0xc238, 0xc255, 0xc270, 0x9ebf,
+	0x9ec8, 0x9ebf, 0x9f1a, 0x9ebf, 0x9ebf, 0x9ebf, 0x9ebf, 0x9186,
+	0x0013, 0x1128, 0x080c, 0x886e, 0x080c, 0x8973, 0x0005, 0x0005,
+	0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0db4, 0x0013, 0x006e,
+	0x0005, 0x9ee1, 0xa639, 0xa807, 0x9ee1, 0xa895, 0xa1fd, 0x9ee1,
+	0x9ee1, 0xa5bb, 0xae37, 0x9ee1, 0x9ee1, 0x9ee1, 0x9ee1, 0x9ee1,
+	0x9ee1, 0x080c, 0x0db4, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c,
+	0x0db4, 0x0013, 0x006e, 0x0005, 0x9efc, 0xb50b, 0x9efc, 0x9efc,
+	0x9efc, 0x9efc, 0x9efc, 0x9efc, 0xb4b0, 0xb68d, 0x9efc, 0xb54c,
+	0xb5cb, 0xb54c, 0xb5cb, 0x9efc, 0x080c, 0x0db4, 0x6000, 0x9082,
+	0x0016, 0x1a0c, 0x0db4, 0x6000, 0x0002, 0x9f18, 0xae7e, 0xaf63,
+	0xb093, 0xb23e, 0x9f18, 0x9f18, 0x9f18, 0xae52, 0xb43c, 0xb43f,
+	0x9f18, 0x9f18, 0x9f18, 0x9f18, 0xb46e, 0x9f18, 0x9f18, 0x9f18,
 	0x080c, 0x0db4, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0db4,
-	0x0013, 0x006e, 0x0005, 0x9ee3, 0xb4f2, 0x9ee3, 0x9ee3, 0x9ee3,
-	0x9ee3, 0x9ee3, 0x9ee3, 0xb497, 0xb674, 0x9ee3, 0xb533, 0xb5b2,
-	0xb533, 0xb5b2, 0x9ee3, 0x080c, 0x0db4, 0x6000, 0x9082, 0x0016,
-	0x1a0c, 0x0db4, 0x6000, 0x0002, 0x9eff, 0xae65, 0xaf4a, 0xb07a,
-	0xb225, 0x9eff, 0x9eff, 0x9eff, 0xae39, 0xb423, 0xb426, 0x9eff,
-	0x9eff, 0x9eff, 0x9eff, 0xb455, 0x9eff, 0x9eff, 0x9eff, 0x080c,
-	0x0db4, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0db4, 0x0013,
-	0x006e, 0x0005, 0x9f1a, 0x9f1a, 0x9f5d, 0x9ffc, 0xa091, 0x9f1a,
-	0x9f1a, 0x9f1a, 0x9f1c, 0x9f1a, 0x9f1a, 0x9f1a, 0x9f1a, 0x9f1a,
-	0x9f1a, 0x9f1a, 0x080c, 0x0db4, 0x9186, 0x004c, 0x0588, 0x9186,
-	0x0003, 0x190c, 0x0db4, 0x0096, 0x601c, 0xc0ed, 0x601e, 0x6003,
-	0x0003, 0x6106, 0x6014, 0x2048, 0xa87c, 0x9084, 0xa000, 0xc0b5,
-	0xa87e, 0xa8ac, 0xa846, 0xa8b0, 0xa84a, 0x9006, 0xa836, 0xa83a,
-	0xa884, 0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003, 0x8013,
-	0x8213, 0x9210, 0x621a, 0x009e, 0x2c10, 0x080c, 0x1a5c, 0x080c,
-	0x842e, 0x0126, 0x2091, 0x8000, 0x080c, 0x8a26, 0x012e, 0x0005,
-	0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x080c, 0xa0b3,
-	0x080c, 0xc211, 0x6003, 0x0007, 0x0005, 0x00d6, 0x0096, 0x00f6,
-	0x2079, 0x1800, 0x7a8c, 0x6014, 0x2048, 0xa87c, 0xd0ec, 0x1110,
-	0x9290, 0x0018, 0xac78, 0xc4fc, 0x0046, 0xa8e0, 0x9005, 0x1140,
-	0xa8dc, 0x921a, 0x0140, 0x0220, 0xa87b, 0x0007, 0x2010, 0x0028,
-	0xa87b, 0x0015, 0x0010, 0xa87b, 0x0000, 0x8214, 0xa883, 0x0000,
-	0xaa02, 0x0006, 0x0016, 0x0026, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
-	0x2400, 0x9005, 0x1108, 0x009a, 0x2100, 0x9086, 0x0015, 0x1118,
-	0x2001, 0x0001, 0x0038, 0x2100, 0x9086, 0x0016, 0x0118, 0x2001,
-	0x0001, 0x002a, 0x94a4, 0x0007, 0x8423, 0x9405, 0x0002, 0x9fc4,
-	0x9fc4, 0x9fbf, 0x9fc2, 0x9fc4, 0x9fbc, 0x9faf, 0x9faf, 0x9faf,
-	0x9faf, 0x9faf, 0x9faf, 0x9faf, 0x9faf, 0x9faf, 0x9faf, 0x00fe,
-	0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x000e, 0x004e, 0x00fe,
-	0x009e, 0x00de, 0x080c, 0x0db4, 0x080c, 0xaa5d, 0x0028, 0x080c,
-	0xab80, 0x0010, 0x080c, 0xac6f, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-	0x002e, 0x001e, 0x2c00, 0xa896, 0x000e, 0x080c, 0xa171, 0x0530,
-	0xa804, 0xa80e, 0x00a6, 0x2050, 0xb100, 0x00ae, 0x8006, 0x8006,
-	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0xaacc,
-	0xabd0, 0xacd4, 0xadd8, 0x2031, 0x0000, 0x2041, 0x1249, 0x080c,
-	0xa31b, 0x0160, 0x000e, 0x9005, 0x0120, 0x00fe, 0x009e, 0x00de,
-	0x0005, 0x00fe, 0x009e, 0x00de, 0x0804, 0x9e19, 0x2001, 0x002c,
-	0x900e, 0x080c, 0xa1d7, 0x0c70, 0x91b6, 0x0015, 0x0170, 0x91b6,
-	0x0016, 0x0158, 0x91b2, 0x0047, 0x0a0c, 0x0db4, 0x91b2, 0x0050,
-	0x1a0c, 0x0db4, 0x9182, 0x0047, 0x00ca, 0x2001, 0x0109, 0x2004,
-	0xd08c, 0x0198, 0x0126, 0x2091, 0x2800, 0x0006, 0x0016, 0x0026,
-	0x080c, 0x8382, 0x002e, 0x001e, 0x000e, 0x012e, 0xa001, 0x6000,
-	0x9086, 0x0002, 0x1110, 0x0804, 0x9f5d, 0x0005, 0xa02f, 0xa02f,
-	0xa031, 0xa067, 0xa02f, 0xa02f, 0xa02f, 0xa02f, 0xa07a, 0x080c,
-	0x0db4, 0x00d6, 0x0016, 0x0096, 0x080c, 0x88fb, 0x080c, 0x8a26,
-	0x6003, 0x0004, 0x6114, 0x2148, 0xa87c, 0xd0fc, 0x01c0, 0xa878,
-	0xc0fc, 0x9005, 0x1158, 0xa894, 0x9005, 0x0140, 0x2001, 0x0000,
-	0x900e, 0x080c, 0xa1d7, 0x080c, 0x9e19, 0x00a8, 0x6003, 0x0002,
-	0xa8a4, 0xa9a8, 0x9105, 0x1178, 0xa8ae, 0xa8b2, 0x0c78, 0xa87f,
-	0x0020, 0xa88c, 0xa88a, 0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2, 0xa8c7,
-	0x0000, 0xa8cb, 0x0000, 0x009e, 0x001e, 0x00de, 0x0005, 0x080c,
-	0x88fb, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xbafe, 0x0120,
-	0xa87b, 0x0006, 0x080c, 0x6885, 0x009e, 0x00de, 0x080c, 0x9e19,
-	0x0804, 0x8a26, 0x080c, 0x88fb, 0x080c, 0x2fd7, 0x080c, 0xc20e,
-	0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xbafe, 0x0120, 0xa87b,
-	0x0029, 0x080c, 0x6885, 0x009e, 0x00de, 0x080c, 0x9e19, 0x0804,
-	0x8a26, 0x9182, 0x0047, 0x0002, 0xa0a1, 0xa0a3, 0xa0a1, 0xa0a1,
-	0xa0a1, 0xa0a1, 0xa0a1, 0xa0a1, 0xa0a1, 0xa0a1, 0xa0a1, 0xa0a1,
-	0xa0a3, 0x080c, 0x0db4, 0x00d6, 0x0096, 0x080c, 0x150f, 0x6114,
-	0x2148, 0xa87b, 0x0000, 0xa883, 0x0000, 0x080c, 0x6885, 0x009e,
-	0x00de, 0x0804, 0x9e19, 0x0026, 0x0036, 0x0056, 0x0066, 0x0096,
-	0x00a6, 0x00f6, 0x0006, 0x080c, 0x0feb, 0x000e, 0x090c, 0x0db4,
-	0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9,
-	0x0020, 0x4104, 0xa87a, 0x2079, 0x1800, 0x798c, 0x9188, 0x0018,
-	0x918c, 0x0fff, 0xa972, 0xac76, 0x2950, 0x00a6, 0x2001, 0x0205,
-	0x2003, 0x0000, 0x901e, 0x2029, 0x0001, 0x9182, 0x0034, 0x1228,
-	0x2011, 0x001f, 0x080c, 0xb6f9, 0x04c0, 0x2130, 0x2009, 0x0034,
-	0x2011, 0x001f, 0x080c, 0xb6f9, 0x96b2, 0x0034, 0xb004, 0x904d,
-	0x0110, 0x080c, 0x0f9d, 0x080c, 0x0feb, 0x01d0, 0x8528, 0xa867,
-	0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1230,
-	0x2608, 0x2011, 0x001b, 0x080c, 0xb6f9, 0x00b8, 0x96b2, 0x003c,
-	0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x080c, 0xb6f9, 0x0c18,
-	0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050,
-	0xb566, 0xb070, 0xc0fd, 0xb072, 0x0048, 0x2001, 0x0205, 0x2003,
-	0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0x2a48, 0xa804,
-	0xa807, 0x0000, 0x0006, 0x080c, 0x6885, 0x000e, 0x2048, 0x9005,
-	0x1db0, 0x00fe, 0x00ae, 0x009e, 0x006e, 0x005e, 0x003e, 0x002e,
-	0x0005, 0x00d6, 0x00f6, 0x0096, 0x0006, 0x080c, 0x0feb, 0x000e,
-	0x090c, 0x0db4, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0,
-	0x900e, 0x20a9, 0x0020, 0x4104, 0xaa66, 0xa87a, 0x2079, 0x1800,
-	0x798c, 0x810c, 0x9188, 0x000c, 0x9182, 0x001a, 0x0210, 0x2009,
-	0x001a, 0x21a8, 0x810b, 0xa972, 0xac76, 0x2e98, 0xa85c, 0x9080,
-	0x001f, 0x20a0, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080, 0x2102,
-	0x4003, 0x2003, 0x0000, 0x080c, 0x6885, 0x009e, 0x00fe, 0x00de,
-	0x0005, 0x0016, 0x00d6, 0x00f6, 0x0096, 0x0016, 0x2001, 0x0205,
-	0x200c, 0x918d, 0x0080, 0x2102, 0x001e, 0x2079, 0x0200, 0x2e98,
-	0xa87c, 0xd0ec, 0x0118, 0x9e80, 0x000c, 0x2098, 0x2021, 0x003e,
-	0x901e, 0x9282, 0x0020, 0x0218, 0x2011, 0x0020, 0x2018, 0x9486,
-	0x003e, 0x1170, 0x0096, 0x080c, 0x0feb, 0x2900, 0x009e, 0x05c0,
-	0xa806, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0,
-	0x3300, 0x908e, 0x0260, 0x0140, 0x2009, 0x0280, 0x9102, 0x920a,
-	0x0218, 0x2010, 0x2100, 0x9318, 0x2200, 0x9402, 0x1228, 0x2400,
-	0x9202, 0x2410, 0x9318, 0x9006, 0x2020, 0x22a8, 0xa800, 0x9200,
-	0xa802, 0x20e1, 0x0000, 0x4003, 0x83ff, 0x0180, 0x3300, 0x9086,
-	0x0280, 0x1130, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816, 0x2e98,
-	0x2310, 0x84ff, 0x0904, 0xa186, 0x0804, 0xa188, 0x9085, 0x0001,
-	0x7817, 0x0000, 0x009e, 0x00fe, 0x00de, 0x001e, 0x0005, 0x00d6,
-	0x0036, 0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x080c, 0x6878,
-	0x009e, 0x003e, 0x00de, 0x0005, 0x91b6, 0x0015, 0x1118, 0x080c,
-	0x9e19, 0x0030, 0x91b6, 0x0016, 0x190c, 0x0db4, 0x080c, 0x9e19,
-	0x0005, 0x20a9, 0x000e, 0x20e1, 0x0000, 0x2e98, 0x6014, 0x0096,
-	0x2048, 0xa860, 0x20e8, 0xa85c, 0x20a0, 0x009e, 0x4003, 0x0136,
-	0x9080, 0x001b, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418, 0x8318,
-	0x23a0, 0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8, 0x2011,
-	0x0006, 0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003, 0x3418,
-	0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xbafe, 0x0130,
-	0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e, 0x0804,
-	0x9e19, 0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200, 0x11a8,
-	0x6010, 0x00b6, 0x2058, 0xb8bf, 0x0000, 0x00be, 0x6014, 0x9005,
-	0x0130, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32, 0x080c,
-	0x9e19, 0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48, 0x0cc8,
-	0x0006, 0x0016, 0x080c, 0xc1f9, 0x0188, 0x6014, 0x9005, 0x1170,
-	0x600b, 0x0003, 0x601b, 0x0000, 0x6043, 0x0000, 0x2009, 0x0022,
-	0x080c, 0xa5f8, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085, 0x0001,
-	0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c, 0x20e1,
-	0x0000, 0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080,
-	0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001, 0x2099,
-	0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804, 0x2048,
-	0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x2001,
-	0x0205, 0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020, 0x4003,
-	0x2003, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103,
-	0x080c, 0x9e19, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016, 0x900e,
-	0x7030, 0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff, 0x800c,
-	0x703c, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108, 0x810b,
-	0x2011, 0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c, 0xb6f9,
-	0x080c, 0xbafe, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000, 0xa864,
-	0xa8e2, 0xa867, 0x0103, 0x080c, 0x9e19, 0x001e, 0x009e, 0x0005,
-	0x0016, 0x0096, 0x7030, 0x9086, 0x0100, 0x1118, 0x2009, 0x0004,
-	0x0010, 0x7034, 0x800c, 0x810b, 0x2011, 0x000c, 0x2019, 0x000c,
-	0x6014, 0x2048, 0xa804, 0x0096, 0x9005, 0x0108, 0x2048, 0x080c,
-	0xb6f9, 0x009e, 0x080c, 0xbafe, 0x0148, 0xa804, 0x9005, 0x1158,
-	0xa807, 0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0x9e19,
-	0x009e, 0x001e, 0x0005, 0x0086, 0x2040, 0xa030, 0x8007, 0x9086,
-	0x0100, 0x1118, 0x080c, 0xa7a7, 0x00e0, 0xa034, 0x8007, 0x800c,
-	0x8806, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
-	0x000c, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xaaa0,
-	0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x122f, 0x0019,
-	0x0d08, 0x008e, 0x0898, 0x0096, 0x0006, 0x080c, 0x0feb, 0x000e,
-	0x01b0, 0xa8ab, 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006, 0xae6a,
-	0x2800, 0xa89e, 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96, 0xad9a,
-	0x0086, 0x2940, 0x080c, 0x10d5, 0x008e, 0x9085, 0x0001, 0x009e,
-	0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210,
-	0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1520, 0x700c, 0x6210,
-	0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x11e0, 0x6043, 0x0000,
-	0x2c68, 0x0016, 0x2009, 0x0035, 0x080c, 0xc171, 0x001e, 0x1158,
-	0x622c, 0x2268, 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003, 0x0130,
-	0x9386, 0x0006, 0x0128, 0x080c, 0x9e19, 0x0020, 0x0039, 0x0010,
-	0x080c, 0xa42d, 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096, 0x6814,
-	0x2048, 0x9186, 0x0015, 0x0904, 0xa415, 0x918e, 0x0016, 0x1904,
-	0xa42b, 0x700c, 0x908c, 0xff00, 0x9186, 0x1700, 0x0120, 0x9186,
-	0x0300, 0x1904, 0xa3ef, 0x89ff, 0x1138, 0x6800, 0x9086, 0x000f,
-	0x0904, 0xa3d2, 0x0804, 0xa429, 0x6808, 0x9086, 0xffff, 0x1904,
-	0xa417, 0xa87c, 0x9084, 0x0060, 0x9086, 0x0020, 0x1128, 0xa83c,
-	0xa940, 0x9105, 0x1904, 0xa417, 0x6824, 0xd0b4, 0x1904, 0xa417,
-	0x080c, 0xbce7, 0x685c, 0xa882, 0xa87c, 0xc0dc, 0xc0f4, 0xc0d4,
-	0xa87e, 0x0026, 0x900e, 0x6a18, 0x2001, 0x000a, 0x080c, 0x8248,
-	0xa884, 0x920a, 0x0208, 0x8011, 0xaa86, 0x82ff, 0x002e, 0x1138,
-	0x00c6, 0x2d60, 0x080c, 0xb823, 0x00ce, 0x0804, 0xa429, 0x00c6,
-	0xa868, 0xd0fc, 0x1118, 0x080c, 0x5d46, 0x0010, 0x080c, 0x60ed,
-	0x00ce, 0x1904, 0xa417, 0x00c6, 0x2d60, 0x080c, 0x9e19, 0x00ce,
-	0x0804, 0xa429, 0x00c6, 0x080c, 0x9e66, 0x0198, 0x6017, 0x0000,
-	0x6810, 0x6012, 0x080c, 0xbf73, 0x6023, 0x0003, 0x6904, 0x00c6,
-	0x2d60, 0x080c, 0x9e19, 0x00ce, 0x080c, 0x9e93, 0x00ce, 0x0804,
-	0xa429, 0x2001, 0x1959, 0x2004, 0x6842, 0x00ce, 0x04d0, 0x7008,
-	0x9086, 0x000b, 0x11c8, 0x6010, 0x00b6, 0x2058, 0xb900, 0xc1bc,
-	0xb902, 0x00be, 0x00c6, 0x2d60, 0xa87b, 0x0003, 0x080c, 0xc1b3,
-	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c, 0x83c9,
-	0x080c, 0x894b, 0x00ce, 0x00e8, 0x700c, 0x9086, 0x2a00, 0x1138,
-	0x2001, 0x1959, 0x2004, 0x6842, 0x00a0, 0x0479, 0x00a0, 0x89ff,
-	0x090c, 0x0db4, 0x00c6, 0x00d6, 0x2d60, 0xa867, 0x0103, 0xa87b,
-	0x0003, 0x080c, 0x66a0, 0x080c, 0xbce7, 0x080c, 0x9e49, 0x00de,
-	0x00ce, 0x080c, 0x9e19, 0x009e, 0x0005, 0x9186, 0x0015, 0x1128,
-	0x2001, 0x1959, 0x2004, 0x6842, 0x0068, 0x918e, 0x0016, 0x1160,
-	0x00c6, 0x2d00, 0x2060, 0x080c, 0xd767, 0x080c, 0x81dc, 0x080c,
-	0x9e19, 0x00ce, 0x080c, 0x9e19, 0x0005, 0x0026, 0x0036, 0x0046,
-	0x7228, 0xacb0, 0xabac, 0xd2f4, 0x0130, 0x2001, 0x1959, 0x2004,
-	0x6842, 0x0804, 0xa4a7, 0x00c6, 0x2d60, 0x080c, 0xb724, 0x00ce,
-	0x6804, 0x9086, 0x0050, 0x1168, 0x00c6, 0x2d00, 0x2060, 0x6003,
-	0x0001, 0x6007, 0x0050, 0x080c, 0x83c9, 0x080c, 0x894b, 0x00ce,
-	0x04f0, 0x6800, 0x9086, 0x000f, 0x01a8, 0x89ff, 0x090c, 0x0db4,
-	0x6800, 0x9086, 0x0004, 0x1190, 0xa87c, 0xd0ac, 0x0178, 0xa843,
-	0x0fff, 0xa83f, 0x0fff, 0xa880, 0xc0fc, 0xa882, 0x2001, 0x0001,
-	0x6832, 0x0400, 0x2001, 0x0007, 0x6832, 0x00e0, 0xa87c, 0xd0b4,
-	0x1150, 0xd0ac, 0x0db8, 0x6824, 0xd0f4, 0x1d48, 0xa838, 0xa934,
-	0x9105, 0x0d80, 0x0c20, 0xd2ec, 0x1d68, 0x7024, 0x9306, 0x1118,
-	0x7020, 0x9406, 0x0d38, 0x7020, 0x683e, 0x7024, 0x683a, 0x2001,
-	0x0005, 0x6832, 0x080c, 0xbe6a, 0x080c, 0x894b, 0x0010, 0x080c,
-	0x9e19, 0x004e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x00d6, 0x0026,
-	0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258, 0xba10, 0x00be,
-	0x9206, 0x1904, 0xa512, 0x700c, 0x6210, 0x00b6, 0x2258, 0xba14,
-	0x00be, 0x9206, 0x1904, 0xa512, 0x6038, 0x2068, 0x6824, 0xc0dc,
-	0x6826, 0x6a20, 0x9286, 0x0007, 0x0904, 0xa512, 0x9286, 0x0002,
-	0x0904, 0xa512, 0x9286, 0x0000, 0x05e8, 0x6808, 0x633c, 0x9306,
-	0x15c8, 0x2071, 0x026c, 0x9186, 0x0015, 0x0570, 0x918e, 0x0016,
-	0x1100, 0x00c6, 0x6038, 0x2060, 0x6104, 0x9186, 0x004b, 0x01c0,
-	0x9186, 0x004c, 0x01a8, 0x9186, 0x004d, 0x0190, 0x9186, 0x004e,
-	0x0178, 0x9186, 0x0052, 0x0160, 0x6014, 0x0096, 0x2048, 0x080c,
-	0xbafe, 0x090c, 0x0db4, 0xa87b, 0x0003, 0x009e, 0x080c, 0xc1b3,
-	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c, 0x83c9,
-	0x080c, 0x894b, 0x00ce, 0x0030, 0x6038, 0x2070, 0x2001, 0x1959,
-	0x2004, 0x7042, 0x080c, 0x9e19, 0x002e, 0x00de, 0x00ee, 0x0005,
-	0x00b6, 0x0096, 0x00f6, 0x6014, 0x2048, 0x6010, 0x2058, 0x91b6,
-	0x0015, 0x0130, 0xba08, 0xbb0c, 0xbc00, 0xc48c, 0xbc02, 0x0460,
-	0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0010, 0x2019,
-	0x000a, 0x20a9, 0x0004, 0x080c, 0xadf4, 0x002e, 0x003e, 0x015e,
-	0x009e, 0x1904, 0xa581, 0x0096, 0x0156, 0x0036, 0x0026, 0x2b48,
-	0x9e90, 0x0014, 0x2019, 0x0006, 0x20a9, 0x0004, 0x080c, 0xadf4,
-	0x002e, 0x003e, 0x015e, 0x009e, 0x15a0, 0x7238, 0xba0a, 0x733c,
-	0xbb0e, 0xbc00, 0xc48d, 0xbc02, 0xa804, 0x9005, 0x1128, 0x00fe,
-	0x009e, 0x00be, 0x0804, 0xa21c, 0x0096, 0x2048, 0xaa12, 0xab16,
-	0xac0a, 0x009e, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c, 0xaca8,
-	0xada4, 0x2031, 0x0000, 0x2041, 0x122f, 0x080c, 0xa31b, 0x0130,
-	0x00fe, 0x009e, 0x080c, 0x9e19, 0x00be, 0x0005, 0x080c, 0xa7a7,
-	0x0cb8, 0x2b78, 0x00f6, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x00fe,
-	0x00c6, 0x080c, 0x9dc3, 0x2f00, 0x6012, 0x6017, 0x0000, 0x6023,
-	0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x2001, 0x0007, 0x080c,
-	0x6188, 0x080c, 0x61b4, 0x080c, 0x8411, 0x080c, 0x894b, 0x00ce,
-	0x0804, 0xa554, 0x2100, 0x91b2, 0x0053, 0x1a0c, 0x0db4, 0x91b2,
-	0x0040, 0x1a04, 0xa60a, 0x0002, 0xa5f8, 0xa5f8, 0xa5ee, 0xa5f8,
-	0xa5f8, 0xa5f8, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec,
-	0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec,
-	0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec,
-	0xa5ec, 0xa5ec, 0xa5ec, 0xa5f8, 0xa5ec, 0xa5f8, 0xa5f8, 0xa5ec,
-	0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ee, 0xa5ec, 0xa5ec, 0xa5ec,
-	0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5f8, 0xa5f8,
-	0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec, 0xa5ec,
-	0xa5ec, 0xa5f8, 0xa5ec, 0xa5ec, 0x080c, 0x0db4, 0x0066, 0x00b6,
-	0x6610, 0x2658, 0xb8bc, 0xc08c, 0xb8be, 0x00be, 0x006e, 0x0000,
-	0x6003, 0x0001, 0x6106, 0x9186, 0x0032, 0x0118, 0x080c, 0x8411,
-	0x0010, 0x080c, 0x83c9, 0x0126, 0x2091, 0x8000, 0x080c, 0x894b,
-	0x012e, 0x0005, 0x2600, 0x0002, 0xa61e, 0xa61e, 0xa61e, 0xa5f8,
-	0xa5f8, 0xa61e, 0xa61e, 0xa61e, 0xa61e, 0xa5f8, 0xa61e, 0xa5f8,
-	0xa61e, 0xa5f8, 0xa61e, 0xa61e, 0xa61e, 0xa61e, 0x080c, 0x0db4,
-	0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0db4, 0x91b6, 0x0013, 0x0904,
-	0xa6e2, 0x91b6, 0x0027, 0x1904, 0xa69d, 0x080c, 0x8846, 0x6004,
-	0x080c, 0xbcf3, 0x01b0, 0x080c, 0xbd04, 0x01a8, 0x908e, 0x0021,
-	0x0904, 0xa69a, 0x908e, 0x0022, 0x1130, 0x080c, 0xa248, 0x0904,
-	0xa696, 0x0804, 0xa697, 0x908e, 0x003d, 0x0904, 0xa69a, 0x0804,
-	0xa690, 0x080c, 0x2ffc, 0x2001, 0x0007, 0x080c, 0x6188, 0x6010,
-	0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xa7a7, 0x9186, 0x007e,
-	0x1148, 0x2001, 0x1836, 0x2014, 0xc285, 0x080c, 0x6fa7, 0x1108,
-	0xc2ad, 0x2202, 0x0036, 0x0026, 0x2019, 0x0028, 0x2110, 0x080c,
-	0xd7c2, 0x002e, 0x003e, 0x0016, 0x0026, 0x0036, 0x2110, 0x2019,
-	0x0028, 0x080c, 0x8549, 0x0076, 0x903e, 0x080c, 0x8441, 0x6010,
-	0x00b6, 0x905d, 0x0100, 0x00be, 0x2c08, 0x080c, 0xd27b, 0x007e,
-	0x003e, 0x002e, 0x001e, 0x080c, 0xc20e, 0x0016, 0x080c, 0xbf6b,
-	0x080c, 0x9e19, 0x001e, 0x080c, 0x30ce, 0x080c, 0x894b, 0x0030,
-	0x080c, 0xbf6b, 0x080c, 0x9e19, 0x080c, 0x894b, 0x0005, 0x080c,
-	0xa7a7, 0x0cb0, 0x080c, 0xa7e3, 0x0c98, 0x9186, 0x0014, 0x1db0,
-	0x080c, 0x8846, 0x6004, 0x908e, 0x0022, 0x1118, 0x080c, 0xa248,
-	0x0d68, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x080c, 0xbcf3, 0x1190,
-	0x080c, 0x2ffc, 0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c,
-	0xa7a7, 0x9186, 0x007e, 0x1128, 0x2001, 0x1836, 0x200c, 0xc185,
-	0x2102, 0x0870, 0x080c, 0xbd04, 0x1118, 0x080c, 0xa7a7, 0x0840,
-	0x6004, 0x908e, 0x0032, 0x1160, 0x00e6, 0x00f6, 0x2071, 0x1894,
-	0x2079, 0x0000, 0x080c, 0x3362, 0x00fe, 0x00ee, 0x0804, 0xa690,
-	0x6004, 0x908e, 0x0021, 0x0d48, 0x908e, 0x0022, 0x090c, 0xa7a7,
-	0x0804, 0xa690, 0x90b2, 0x0040, 0x1a04, 0xa790, 0x2008, 0x0002,
-	0xa72a, 0xa72b, 0xa72e, 0xa731, 0xa734, 0xa737, 0xa728, 0xa728,
-	0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728,
-	0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728,
-	0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa73a, 0xa745,
-	0xa728, 0xa747, 0xa745, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728,
-	0xa745, 0xa745, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728, 0xa728,
-	0xa728, 0xa728, 0xa777, 0xa745, 0xa728, 0xa741, 0xa728, 0xa728,
-	0xa728, 0xa742, 0xa728, 0xa728, 0xa728, 0xa745, 0xa76e, 0xa728,
-	0x080c, 0x0db4, 0x00d0, 0x2001, 0x000b, 0x0410, 0x2001, 0x0003,
-	0x00f8, 0x2001, 0x0005, 0x00e0, 0x2001, 0x0001, 0x00c8, 0x2001,
-	0x0009, 0x00b0, 0x080c, 0x8846, 0x6003, 0x0005, 0x080c, 0x894b,
-	0x0070, 0x0018, 0x0010, 0x080c, 0x6188, 0x0804, 0xa788, 0x080c,
-	0x8846, 0x080c, 0xc211, 0x6003, 0x0004, 0x080c, 0x894b, 0x0005,
-	0x080c, 0x6188, 0x080c, 0x8846, 0x6003, 0x0002, 0x0036, 0x2019,
-	0x185e, 0x2304, 0x9084, 0xff00, 0x1120, 0x2001, 0x1957, 0x201c,
-	0x0040, 0x8007, 0x909a, 0x0004, 0x0ec0, 0x8003, 0x801b, 0x831b,
-	0x9318, 0x631a, 0x003e, 0x080c, 0x894b, 0x0c08, 0x080c, 0x8846,
-	0x080c, 0xbf6b, 0x080c, 0x9e19, 0x080c, 0x894b, 0x08c0, 0x00e6,
-	0x00f6, 0x2071, 0x1894, 0x2079, 0x0000, 0x080c, 0x3362, 0x00fe,
-	0x00ee, 0x080c, 0x8846, 0x080c, 0x9e19, 0x080c, 0x894b, 0x0838,
-	0x080c, 0x8846, 0x6003, 0x0002, 0x080c, 0xc211, 0x0804, 0x894b,
-	0x2600, 0x2008, 0x0002, 0xa7a5, 0xa7a5, 0xa7a5, 0xa788, 0xa788,
-	0xa7a5, 0xa7a5, 0xa7a5, 0xa7a5, 0xa788, 0xa7a5, 0xa788, 0xa7a5,
-	0xa788, 0xa7a5, 0xa7a5, 0xa7a5, 0xa7a5, 0x080c, 0x0db4, 0x00e6,
-	0x0096, 0x0026, 0x0016, 0x080c, 0xbafe, 0x0568, 0x6014, 0x2048,
-	0xa864, 0x9086, 0x0139, 0x11a8, 0xa894, 0x9086, 0x0056, 0x1148,
-	0x080c, 0x5128, 0x0130, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000,
-	0x0028, 0x2001, 0x0030, 0x900e, 0x2011, 0x4005, 0x080c, 0xc0d8,
-	0x0090, 0xa868, 0xd0fc, 0x0178, 0xa807, 0x0000, 0x0016, 0x6004,
-	0x908e, 0x0021, 0x0168, 0x908e, 0x003d, 0x0150, 0x001e, 0xa867,
-	0x0103, 0xa833, 0x0100, 0x001e, 0x002e, 0x009e, 0x00ee, 0x0005,
-	0x001e, 0x0009, 0x0cc0, 0x0096, 0x6014, 0x2048, 0xa800, 0x2048,
-	0xa867, 0x0103, 0xa823, 0x8001, 0x009e, 0x0005, 0x00b6, 0x6610,
-	0x2658, 0xb804, 0x9084, 0x00ff, 0x90b2, 0x000c, 0x1a0c, 0x0db4,
-	0x6604, 0x96b6, 0x004d, 0x1120, 0x080c, 0xbff7, 0x0804, 0xa86b,
-	0x6604, 0x96b6, 0x0043, 0x1120, 0x080c, 0xc040, 0x0804, 0xa86b,
-	0x6604, 0x96b6, 0x004b, 0x1120, 0x080c, 0xc06c, 0x0804, 0xa86b,
-	0x6604, 0x96b6, 0x0033, 0x1120, 0x080c, 0xbf8d, 0x0804, 0xa86b,
-	0x6604, 0x96b6, 0x0028, 0x1120, 0x080c, 0xbd3d, 0x0804, 0xa86b,
-	0x6604, 0x96b6, 0x0029, 0x1120, 0x080c, 0xbd7e, 0x0804, 0xa86b,
-	0x6604, 0x96b6, 0x001f, 0x1118, 0x080c, 0xa1f1, 0x04e0, 0x6604,
-	0x96b6, 0x0000, 0x1118, 0x080c, 0xa518, 0x04a8, 0x6604, 0x96b6,
-	0x0022, 0x1118, 0x080c, 0xa229, 0x0470, 0x6604, 0x96b6, 0x0035,
-	0x1118, 0x080c, 0xa339, 0x0438, 0x6604, 0x96b6, 0x0039, 0x1118,
-	0x080c, 0xa4ad, 0x0400, 0x6604, 0x96b6, 0x003d, 0x1118, 0x080c,
-	0xa261, 0x00c8, 0x6604, 0x96b6, 0x0044, 0x1118, 0x080c, 0xa29d,
-	0x0090, 0x6604, 0x96b6, 0x0049, 0x1118, 0x080c, 0xa2c8, 0x0058,
-	0x91b6, 0x0015, 0x1110, 0x0063, 0x0030, 0x91b6, 0x0016, 0x1128,
-	0x00be, 0x0804, 0xab29, 0x00be, 0x0005, 0x080c, 0x9eae, 0x0cd8,
-	0xa888, 0xa88b, 0xa888, 0xa8cf, 0xa888, 0xaa5d, 0xab36, 0xa888,
-	0xa888, 0xab03, 0xa888, 0xab17, 0x0096, 0x080c, 0x150f, 0x6014,
-	0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x009e, 0x0804, 0x9e19,
-	0xa001, 0xa001, 0x0005, 0x00e6, 0x2071, 0x1800, 0x708c, 0x9086,
-	0x0074, 0x1540, 0x080c, 0xd24c, 0x11b0, 0x6010, 0x00b6, 0x2058,
-	0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc, 0x0110, 0xc0c5, 0xb802,
-	0x00e9, 0x00be, 0x2001, 0x0006, 0x080c, 0x6188, 0x080c, 0x2ffc,
-	0x080c, 0x9e19, 0x0088, 0x2001, 0x000a, 0x080c, 0x6188, 0x080c,
-	0x2ffc, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x8411, 0x080c,
-	0x894b, 0x0010, 0x080c, 0xaa48, 0x00ee, 0x0005, 0x00d6, 0xb800,
-	0xd084, 0x0158, 0x9006, 0x080c, 0x6174, 0x2069, 0x1853, 0x6804,
-	0x0020, 0x2001, 0x0006, 0x080c, 0x61b4, 0x00de, 0x0005, 0x00b6,
-	0x0096, 0x00d6, 0x2011, 0x1823, 0x2204, 0x9086, 0x0074, 0x1904,
-	0xaa21, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c,
-	0xac7a, 0x0804, 0xa986, 0x00d6, 0x080c, 0x6fa7, 0x0198, 0x0026,
-	0x2011, 0x0010, 0x080c, 0x657f, 0x002e, 0x05c8, 0x080c, 0x5393,
-	0x1540, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-	0xdead, 0x00f8, 0x0026, 0x2011, 0x8008, 0x080c, 0x657f, 0x002e,
-	0x0530, 0x6014, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-	0x1140, 0x2001, 0x0030, 0x900e, 0x2011, 0x4009, 0x080c, 0xc0d8,
-	0x0040, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
-	0xdead, 0x6010, 0x2058, 0xb9a0, 0x0016, 0x080c, 0x2ffc, 0x080c,
-	0x9e19, 0x001e, 0x080c, 0x30ce, 0x00de, 0x0804, 0xaa22, 0x00de,
-	0x080c, 0xac6f, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510,
-	0x6014, 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086,
-	0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c,
-	0xc0d8, 0x0030, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
-	0x2001, 0x0006, 0x080c, 0x6188, 0x080c, 0x2ffc, 0x080c, 0x9e19,
-	0x0804, 0xaa22, 0x080c, 0xaa30, 0x6014, 0x9005, 0x0190, 0x2048,
-	0xa868, 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-	0x1d08, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xc0d8,
-	0x08f8, 0x080c, 0xaa26, 0x0160, 0x9006, 0x080c, 0x6174, 0x2001,
-	0x0004, 0x080c, 0x61b4, 0x2001, 0x0007, 0x080c, 0x6188, 0x08a0,
-	0x2001, 0x0004, 0x080c, 0x6188, 0x6003, 0x0001, 0x6007, 0x0003,
-	0x080c, 0x8411, 0x080c, 0x894b, 0x0804, 0xaa22, 0xb85c, 0xd0e4,
-	0x01d0, 0x080c, 0xbf0d, 0x080c, 0x6fa7, 0x0118, 0xd0dc, 0x1904,
-	0xa948, 0x2011, 0x1836, 0x2204, 0xc0ad, 0x2012, 0x2001, 0x0002,
-	0x00f6, 0x2079, 0x0100, 0x78e3, 0x0000, 0x080c, 0x26d7, 0x78e2,
-	0x00fe, 0x0804, 0xa948, 0x080c, 0xbf4a, 0x2011, 0x1836, 0x2204,
-	0xc0a5, 0x2012, 0x0006, 0x080c, 0xd3a5, 0x000e, 0x1904, 0xa948,
-	0xc0b5, 0x2012, 0x2001, 0x0006, 0x080c, 0x6188, 0x9006, 0x080c,
-	0x6174, 0x00c6, 0x2001, 0x180f, 0x2004, 0xd09c, 0x0520, 0x00f6,
-	0x2079, 0x0100, 0x00e6, 0x2071, 0x1800, 0x700c, 0x9084, 0x00ff,
-	0x78e6, 0x707a, 0x7010, 0x78ea, 0x707e, 0x908c, 0x00ff, 0x00ee,
-	0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x26ac, 0x00f6, 0x2100,
-	0x900e, 0x080c, 0x2663, 0x795a, 0x00fe, 0x9186, 0x0081, 0x01d8,
-	0x2009, 0x0081, 0x00c8, 0x2009, 0x00ef, 0x00f6, 0x2079, 0x0100,
-	0x79ea, 0x7932, 0x7936, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c,
-	0x26ac, 0x00f6, 0x2079, 0x1800, 0x797e, 0x2100, 0x900e, 0x080c,
-	0x2663, 0x795a, 0x00fe, 0x8108, 0x080c, 0x61d7, 0x2b00, 0x00ce,
-	0x1904, 0xa948, 0x6012, 0x2009, 0x180f, 0x210c, 0xd19c, 0x0150,
-	0x2009, 0x027c, 0x210c, 0x918c, 0x00ff, 0xb912, 0x2009, 0x027d,
-	0x210c, 0xb916, 0x2001, 0x0002, 0x080c, 0x6188, 0x6023, 0x0001,
-	0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x8411, 0x080c, 0x894b,
-	0x0008, 0x0431, 0x00de, 0x009e, 0x00be, 0x0005, 0x2001, 0x1810,
-	0x2004, 0xd0a4, 0x0120, 0x2001, 0x1854, 0x2004, 0xd0ac, 0x0005,
-	0x00e6, 0x080c, 0xd81b, 0x0190, 0x2071, 0x0260, 0x7108, 0x720c,
-	0x918c, 0x00ff, 0x1118, 0x9284, 0xff00, 0x0140, 0x6010, 0x2058,
-	0xb8a0, 0x9084, 0xff80, 0x1110, 0xb912, 0xba16, 0x00ee, 0x0005,
-	0x2030, 0x2001, 0x0007, 0x080c, 0x6188, 0x080c, 0x5393, 0x1120,
-	0x2001, 0x0007, 0x080c, 0x61b4, 0x080c, 0x2ffc, 0x6020, 0x9086,
-	0x000a, 0x1108, 0x0005, 0x0804, 0x9e19, 0x00b6, 0x00e6, 0x0026,
-	0x0016, 0x2071, 0x1800, 0x708c, 0x9086, 0x0014, 0x1904, 0xaafa,
-	0x00d6, 0x080c, 0x6fa7, 0x0198, 0x0026, 0x2011, 0x0010, 0x080c,
-	0x657f, 0x002e, 0x05c8, 0x080c, 0x5393, 0x1540, 0x6014, 0x2048,
-	0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x00f8, 0x0026,
-	0x2011, 0x8008, 0x080c, 0x657f, 0x002e, 0x0530, 0x6014, 0x2048,
-	0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0030,
-	0x900e, 0x2011, 0x4009, 0x080c, 0xc0d8, 0x0040, 0x6014, 0x2048,
-	0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x6010, 0x2058,
-	0xb9a0, 0x0016, 0x080c, 0x2ffc, 0x080c, 0x9e19, 0x001e, 0x080c,
-	0x30ce, 0x00de, 0x0804, 0xaafe, 0x00de, 0x080c, 0x5393, 0x1170,
-	0x6014, 0x9005, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0,
-	0x2021, 0x0006, 0x080c, 0x4a6f, 0x004e, 0x003e, 0x00d6, 0x6010,
-	0x2058, 0x080c, 0x62d2, 0x080c, 0xa8be, 0x00de, 0x080c, 0xad40,
-	0x1588, 0x6010, 0x2058, 0xb890, 0x9005, 0x0560, 0x2001, 0x0006,
-	0x080c, 0x6188, 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864, 0x9084,
-	0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011,
-	0x4000, 0x080c, 0xc0d8, 0x0060, 0xa864, 0x9084, 0x00ff, 0x9086,
-	0x0029, 0x0130, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
-	0x009e, 0x080c, 0x2ffc, 0x6020, 0x9086, 0x000a, 0x0138, 0x080c,
-	0x9e19, 0x0020, 0x080c, 0xa7a7, 0x080c, 0xaa48, 0x001e, 0x002e,
-	0x00ee, 0x00be, 0x0005, 0x2011, 0x1823, 0x2204, 0x9086, 0x0014,
-	0x1160, 0x2001, 0x0002, 0x080c, 0x6188, 0x6003, 0x0001, 0x6007,
-	0x0001, 0x080c, 0x8411, 0x0804, 0x894b, 0x0804, 0xaa48, 0x2030,
-	0x2011, 0x1823, 0x2204, 0x9086, 0x0004, 0x1148, 0x96b6, 0x000b,
-	0x1120, 0x2001, 0x0007, 0x080c, 0x6188, 0x0804, 0x9e19, 0x0804,
-	0xaa48, 0x0002, 0xa888, 0xab41, 0xa888, 0xab80, 0xa888, 0xac2b,
-	0xab36, 0xa888, 0xa888, 0xac3e, 0xa888, 0xac4e, 0x6604, 0x9686,
-	0x0003, 0x0904, 0xaa5d, 0x96b6, 0x001e, 0x1110, 0x080c, 0x9e19,
-	0x0005, 0x00b6, 0x00d6, 0x00c6, 0x080c, 0xac5e, 0x11a0, 0x9006,
-	0x080c, 0x6174, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x2001, 0x0002,
-	0x080c, 0x6188, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x8411,
-	0x080c, 0x894b, 0x0408, 0x2009, 0x026e, 0x2104, 0x9086, 0x0009,
-	0x1160, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0170,
-	0x8001, 0xb842, 0x601b, 0x000a, 0x0078, 0x2009, 0x026f, 0x2104,
-	0x9084, 0xff00, 0x9086, 0x1900, 0x1108, 0x08a0, 0x080c, 0x2fd7,
-	0x080c, 0xc20e, 0x080c, 0xaa48, 0x00ce, 0x00de, 0x00be, 0x0005,
-	0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xac6c, 0x00d6, 0x2069,
-	0x194d, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058, 0xb8a0, 0x9086,
-	0x007e, 0x1138, 0x2069, 0x181f, 0x2d04, 0x8000, 0x206a, 0x00de,
-	0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x6174, 0x2001, 0x0002,
-	0x080c, 0x6188, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x8411,
-	0x080c, 0x894b, 0x0804, 0xabfb, 0x080c, 0xbafe, 0x01b0, 0x6014,
-	0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138, 0x6007, 0x0016,
-	0x2001, 0x0002, 0x080c, 0xc132, 0x00b0, 0x6014, 0x2048, 0xa864,
-	0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001, 0x180e, 0x2004,
-	0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005,
-	0x1110, 0x9006, 0x0c38, 0x080c, 0xa7a7, 0x2009, 0x026e, 0x2134,
-	0x96b4, 0x00ff, 0x9686, 0x0005, 0x0510, 0x9686, 0x000b, 0x01c8,
-	0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118, 0x9686, 0x0009,
-	0x01b0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009, 0x0180, 0x2001,
-	0x0004, 0x080c, 0x6188, 0x2001, 0x0028, 0x601a, 0x6007, 0x0052,
-	0x0010, 0x080c, 0xaa48, 0x002e, 0x00be, 0x009e, 0x0005, 0x9286,
-	0x0139, 0x0160, 0x6014, 0x2048, 0x080c, 0xbafe, 0x0140, 0xa864,
-	0x9086, 0x0139, 0x0118, 0xa868, 0xd0fc, 0x0108, 0x0c50, 0x6010,
-	0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0138, 0x8001, 0xb842,
-	0x601b, 0x000a, 0x6007, 0x0016, 0x08f0, 0xb8a0, 0x9086, 0x007e,
-	0x1138, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5c5d, 0x00ee, 0x0010,
-	0x080c, 0x2fd7, 0x0870, 0x080c, 0xac6c, 0x1160, 0x2001, 0x0004,
-	0x080c, 0x6188, 0x6003, 0x0001, 0x6007, 0x0003, 0x080c, 0x8411,
-	0x0804, 0x894b, 0x080c, 0xa7a7, 0x0804, 0xaa48, 0x0469, 0x1160,
-	0x2001, 0x0008, 0x080c, 0x6188, 0x6003, 0x0001, 0x6007, 0x0005,
-	0x080c, 0x8411, 0x0804, 0x894b, 0x0804, 0xaa48, 0x00e9, 0x1160,
-	0x2001, 0x000a, 0x080c, 0x6188, 0x6003, 0x0001, 0x6007, 0x0001,
-	0x080c, 0x8411, 0x0804, 0x894b, 0x0804, 0xaa48, 0x2009, 0x026e,
-	0x2104, 0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104, 0x9084,
-	0xff00, 0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005, 0x00b6,
-	0x00c6, 0x0016, 0x6110, 0x2158, 0x080c, 0x6246, 0x001e, 0x00ce,
-	0x00be, 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036, 0x0016,
-	0x6010, 0x2058, 0x2009, 0x1836, 0x2104, 0x9085, 0x0003, 0x200a,
-	0x080c, 0xad12, 0x0560, 0x2009, 0x1836, 0x2104, 0xc0cd, 0x200a,
-	0x080c, 0x6557, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c,
-	0xd50a, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a,
-	0x2009, 0x0001, 0x080c, 0x2fa2, 0x00e6, 0x2071, 0x1800, 0x080c,
-	0x2dbb, 0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009, 0x007f,
-	0x080c, 0x30ce, 0x8108, 0x1f04, 0xacb0, 0x015e, 0x00ce, 0x080c,
-	0xac6f, 0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001, 0x2001,
-	0x1836, 0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc, 0x0118,
-	0x7038, 0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001, 0x1836,
-	0x2102, 0x2079, 0x0100, 0x2e04, 0x9084, 0x00ff, 0x2069, 0x181e,
-	0x206a, 0x78e6, 0x0006, 0x8e70, 0x2e04, 0x2069, 0x181f, 0x206a,
-	0x78ea, 0x7832, 0x7836, 0x2010, 0x9084, 0xff00, 0x001e, 0x9105,
-	0x2009, 0x182b, 0x200a, 0x2200, 0x9084, 0x00ff, 0x2008, 0x080c,
-	0x26ac, 0x080c, 0x6fa7, 0x0170, 0x2071, 0x0260, 0x2069, 0x1953,
-	0x7048, 0x206a, 0x704c, 0x6806, 0x7050, 0x680a, 0x7054, 0x680e,
-	0x080c, 0xbf0d, 0x0040, 0x2001, 0x0006, 0x080c, 0x6188, 0x080c,
-	0x2ffc, 0x080c, 0x9e19, 0x001e, 0x003e, 0x00de, 0x00ee, 0x00fe,
-	0x00be, 0x0005, 0x0096, 0x0026, 0x0036, 0x00e6, 0x0156, 0x2019,
-	0x182b, 0x231c, 0x83ff, 0x01f0, 0x2071, 0x0260, 0x7200, 0x9294,
-	0x00ff, 0x7004, 0x9084, 0xff00, 0x9205, 0x9306, 0x1198, 0x2011,
-	0x0276, 0x20a9, 0x0004, 0x2b48, 0x2019, 0x000a, 0x080c, 0xadf4,
-	0x1148, 0x2011, 0x027a, 0x20a9, 0x0004, 0x2019, 0x0006, 0x080c,
-	0xadf4, 0x1100, 0x015e, 0x00ee, 0x003e, 0x002e, 0x009e, 0x0005,
-	0x00e6, 0x2071, 0x0260, 0x7034, 0x9086, 0x0014, 0x11a8, 0x7038,
-	0x9086, 0x0800, 0x1188, 0x703c, 0xd0ec, 0x0160, 0x9084, 0x0f00,
-	0x9086, 0x0100, 0x1138, 0x7054, 0xd0a4, 0x1110, 0xd0ac, 0x0110,
-	0x9006, 0x0010, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x0096,
-	0x00c6, 0x0076, 0x0056, 0x0046, 0x0026, 0x0006, 0x0126, 0x2091,
-	0x8000, 0x2029, 0x19c1, 0x252c, 0x2021, 0x19c7, 0x2424, 0x2061,
-	0x1cd0, 0x2071, 0x1800, 0x7250, 0x7070, 0x9202, 0x1a04, 0xadcc,
-	0x080c, 0xd53b, 0x0904, 0xadc5, 0x6720, 0x9786, 0x0007, 0x0904,
-	0xadc5, 0x2500, 0x9c06, 0x0904, 0xadc5, 0x2400, 0x9c06, 0x05e8,
-	0x3e08, 0x9186, 0x0002, 0x1148, 0x6010, 0x9005, 0x0130, 0x00b6,
-	0x2058, 0xb800, 0x00be, 0xd0bc, 0x1580, 0x00c6, 0x6000, 0x9086,
-	0x0004, 0x1110, 0x080c, 0x190d, 0x9786, 0x000a, 0x0148, 0x080c,
-	0xbd04, 0x1130, 0x00ce, 0x080c, 0xa7a7, 0x080c, 0x9e49, 0x00e8,
-	0x6014, 0x2048, 0x080c, 0xbafe, 0x01a8, 0x9786, 0x0003, 0x1530,
-	0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048,
-	0x080c, 0x0f9d, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6878,
-	0x080c, 0xbce7, 0x080c, 0x9e49, 0x00ce, 0x9ce0, 0x0018, 0x7064,
-	0x9c02, 0x1210, 0x0804, 0xad73, 0x012e, 0x000e, 0x002e, 0x004e,
-	0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee, 0x0005, 0x9786, 0x0006,
-	0x1118, 0x080c, 0xd4b5, 0x0c30, 0x9786, 0x000a, 0x0998, 0x0880,
-	0x220c, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xade0,
-	0x9006, 0x0005, 0x2304, 0x9102, 0x0218, 0x2001, 0x0001, 0x0008,
-	0x9006, 0x918d, 0x0001, 0x0005, 0x0136, 0x01c6, 0x0016, 0x8906,
-	0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9300,
-	0x2098, 0x3518, 0x20a9, 0x0001, 0x220c, 0x4002, 0x910e, 0x1140,
-	0x8210, 0x8319, 0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e, 0x0005,
-	0x220c, 0x9102, 0x0218, 0x2001, 0x0001, 0x0010, 0x2001, 0x0000,
-	0x918d, 0x0001, 0x001e, 0x01ce, 0x013e, 0x0005, 0x6004, 0x908a,
-	0x0053, 0x1a0c, 0x0db4, 0x080c, 0xbcf3, 0x0120, 0x080c, 0xbd04,
-	0x0168, 0x0028, 0x080c, 0x2ffc, 0x080c, 0xbd04, 0x0138, 0x080c,
-	0x8846, 0x080c, 0x9e19, 0x080c, 0x894b, 0x0005, 0x080c, 0xa7a7,
-	0x0cb0, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a,
-	0x0005, 0xae55, 0xae55, 0xae55, 0xae55, 0xae55, 0xae55, 0xae55,
-	0xae55, 0xae55, 0xae55, 0xae55, 0xae57, 0xae57, 0xae57, 0xae57,
-	0xae55, 0xae55, 0xae55, 0xae57, 0xae55, 0x080c, 0x0db4, 0x600b,
-	0xffff, 0x6003, 0x0001, 0x6106, 0x080c, 0x83c9, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x894b, 0x012e, 0x0005, 0x9186, 0x0013, 0x1128,
-	0x6004, 0x9082, 0x0040, 0x0804, 0xaf0c, 0x9186, 0x0027, 0x1520,
-	0x080c, 0x8846, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x0096, 0x6114,
-	0x2148, 0x080c, 0xbafe, 0x0198, 0x080c, 0xbd04, 0x1118, 0x080c,
-	0xa7a7, 0x0068, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877, 0x0000,
-	0xa97c, 0xc1c5, 0xa97e, 0x080c, 0x6885, 0x080c, 0xbce7, 0x009e,
-	0x080c, 0x9e19, 0x0804, 0x894b, 0x9186, 0x0014, 0x1120, 0x6004,
-	0x9082, 0x0040, 0x04a0, 0x9186, 0x0046, 0x0150, 0x9186, 0x0045,
-	0x0138, 0x9186, 0x0053, 0x0120, 0x9186, 0x0048, 0x190c, 0x0db4,
-	0x2001, 0x0109, 0x2004, 0xd084, 0x0508, 0x0126, 0x2091, 0x2800,
-	0x0006, 0x0016, 0x0026, 0x0036, 0x00f6, 0x00e6, 0x00c6, 0x2079,
-	0x19b8, 0x2071, 0x1800, 0x2061, 0x0100, 0x080c, 0x82b5, 0x00ce,
-	0x00ee, 0x00fe, 0x003e, 0x002e, 0x001e, 0x000e, 0x012e, 0xa001,
-	0x6000, 0x9086, 0x0002, 0x1110, 0x0804, 0xaf4a, 0x0005, 0x0002,
-	0xaee6, 0xaee4, 0xaee4, 0xaee4, 0xaee4, 0xaee4, 0xaee4, 0xaee4,
-	0xaee4, 0xaee4, 0xaee4, 0xaf01, 0xaf01, 0xaf01, 0xaf01, 0xaee4,
-	0xaf01, 0xaee4, 0xaf01, 0xaee4, 0x080c, 0x0db4, 0x080c, 0x8846,
-	0x0096, 0x6114, 0x2148, 0x080c, 0xbafe, 0x0168, 0xa867, 0x0103,
-	0xa87b, 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c,
-	0x6885, 0x080c, 0xbce7, 0x009e, 0x080c, 0x9e19, 0x080c, 0x894b,
-	0x0005, 0x080c, 0x8846, 0x080c, 0xbd04, 0x090c, 0xa7a7, 0x080c,
-	0x9e19, 0x080c, 0x894b, 0x0005, 0x0002, 0xaf23, 0xaf21, 0xaf21,
-	0xaf21, 0xaf21, 0xaf21, 0xaf21, 0xaf21, 0xaf21, 0xaf21, 0xaf21,
-	0xaf3a, 0xaf3a, 0xaf3a, 0xaf3a, 0xaf21, 0xaf44, 0xaf21, 0xaf3a,
-	0xaf21, 0x080c, 0x0db4, 0x0096, 0x080c, 0x8846, 0x6014, 0x2048,
-	0x2001, 0x1959, 0x2004, 0x6042, 0xa97c, 0xd1ac, 0x0140, 0x6003,
-	0x0004, 0xa87c, 0x9085, 0x0400, 0xa87e, 0x009e, 0x0005, 0x6003,
-	0x0002, 0x0cb8, 0x080c, 0x8846, 0x080c, 0xc211, 0x080c, 0xc216,
-	0x6003, 0x000f, 0x0804, 0x894b, 0x080c, 0x8846, 0x080c, 0x9e19,
-	0x0804, 0x894b, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208,
-	0x000a, 0x0005, 0xaf66, 0xaf66, 0xaf66, 0xaf66, 0xaf66, 0xaf68,
-	0xb045, 0xaf66, 0xb079, 0xaf66, 0xaf66, 0xaf66, 0xaf66, 0xaf66,
-	0xaf66, 0xaf66, 0xaf66, 0xaf66, 0xaf66, 0xb079, 0x080c, 0x0db4,
-	0x00b6, 0x0096, 0x6114, 0x2148, 0x7644, 0x96b4, 0x0fff, 0x86ff,
-	0x1528, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xb034, 0xa87b,
-	0x0000, 0xa867, 0x0103, 0xae76, 0xa87c, 0xd0ac, 0x0128, 0xa834,
-	0xa938, 0x9115, 0x190c, 0xb20e, 0x080c, 0x66a0, 0x6210, 0x2258,
-	0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x7044, 0xd0e4, 0x1904,
-	0xb018, 0x080c, 0x9e19, 0x009e, 0x00be, 0x0005, 0x968c, 0x0c00,
-	0x0150, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xb01c, 0x7348,
-	0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0508,
-	0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00e8, 0xd6dc, 0x01a0,
-	0xa87b, 0x0015, 0xa87c, 0xd0ac, 0x0170, 0xa938, 0xaa34, 0x2100,
-	0x9205, 0x0148, 0x7048, 0x9106, 0x1118, 0x704c, 0x9206, 0x0118,
-	0xa992, 0xaa8e, 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007,
-	0x0010, 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0x901e, 0xd6c4,
-	0x01d8, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4,
-	0x0804, 0xaf6f, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009,
-	0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011,
-	0x0025, 0x080c, 0xb6f9, 0x003e, 0xd6cc, 0x0904, 0xaf84, 0x7154,
-	0xa98a, 0x81ff, 0x0904, 0xaf84, 0x9192, 0x0021, 0x1278, 0x8304,
-	0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xb6f9, 0x2011, 0x0205,
-	0x2013, 0x0000, 0x080c, 0xc19e, 0x0804, 0xaf84, 0xa868, 0xd0fc,
-	0x0120, 0x2009, 0x0020, 0xa98a, 0x0c50, 0x00a6, 0x2950, 0x080c,
-	0xb698, 0x00ae, 0x080c, 0xc19e, 0x080c, 0xb6e9, 0x0804, 0xaf86,
-	0x080c, 0xbdf7, 0x0804, 0xaf93, 0xa87c, 0xd0ac, 0x0904, 0xaf9f,
-	0xa880, 0xd0bc, 0x1904, 0xaf9f, 0x7348, 0xa838, 0x9306, 0x11c8,
-	0x734c, 0xa834, 0x931e, 0x0904, 0xaf9f, 0xd6d4, 0x0190, 0xab38,
-	0x9305, 0x0904, 0xaf9f, 0x0068, 0xa87c, 0xd0ac, 0x0904, 0xaf77,
-	0xa838, 0xa934, 0x9105, 0x0904, 0xaf77, 0xa880, 0xd0bc, 0x1904,
-	0xaf77, 0x080c, 0xbe31, 0x0804, 0xaf93, 0x0096, 0x00f6, 0x6003,
-	0x0003, 0x6007, 0x0043, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c,
-	0x7d08, 0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0140, 0x6003, 0x0002,
-	0x00fe, 0x009e, 0x0005, 0x2130, 0x2228, 0x0058, 0x2400, 0xa9ac,
-	0x910a, 0x2300, 0xaab0, 0x9213, 0x2600, 0x9102, 0x2500, 0x9203,
-	0x0e90, 0xac36, 0xab3a, 0xae46, 0xad4a, 0x00fe, 0x6043, 0x0000,
-	0x2c10, 0x080c, 0x1a5c, 0x080c, 0x842e, 0x080c, 0x8a26, 0x009e,
-	0x0005, 0x0005, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208,
-	0x000a, 0x0005, 0xb096, 0xb096, 0xb096, 0xb096, 0xb096, 0xb098,
-	0xb12e, 0xb096, 0xb096, 0xb145, 0xb1d1, 0xb096, 0xb096, 0xb096,
-	0xb096, 0xb1e6, 0xb096, 0xb096, 0xb096, 0xb096, 0x080c, 0x0db4,
-	0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114, 0x2150,
-	0x7644, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e, 0x6210,
-	0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be,
-	0x86ff, 0x0904, 0xb129, 0x9694, 0xff00, 0x9284, 0x0c00, 0x0120,
-	0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300, 0x0904, 0xb129,
-	0x080c, 0x0feb, 0x090c, 0x0db4, 0x2900, 0xb07a, 0xb77c, 0xc7cd,
-	0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c, 0xa86e, 0xb070,
-	0xa872, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c,
-	0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028,
-	0x1118, 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015,
-	0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000,
-	0xaf7e, 0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190,
-	0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019,
-	0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c,
-	0xb6f9, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8,
-	0x9192, 0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029,
-	0x080c, 0xb6f9, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068,
-	0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c,
-	0xb698, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x00f6, 0x00a6,
-	0x6003, 0x0003, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08,
-	0x6014, 0x2050, 0xb436, 0xb33a, 0xb646, 0xb54a, 0x00ae, 0x00fe,
-	0x2c10, 0x080c, 0x1a5c, 0x0804, 0x9360, 0x6003, 0x0002, 0x6004,
-	0x9086, 0x0040, 0x11c8, 0x0096, 0x6014, 0x2048, 0xa87c, 0xd0ac,
-	0x0160, 0x601c, 0xd084, 0x1130, 0x00f6, 0x2c00, 0x2078, 0x080c,
-	0x1648, 0x00fe, 0x6003, 0x0004, 0x0010, 0x6003, 0x0002, 0x009e,
-	0x080c, 0x8846, 0x080c, 0x894b, 0x0096, 0x2001, 0x1959, 0x2004,
-	0x6042, 0x080c, 0x88fb, 0x080c, 0x8a26, 0x6114, 0x2148, 0xa97c,
-	0xd1e4, 0x0904, 0xb1cc, 0xd1cc, 0x05a8, 0xa978, 0xa868, 0xd0fc,
-	0x0538, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0019, 0x20a0, 0x810e, 0x810e, 0x810f, 0x9184,
-	0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0019, 0x2098, 0x0156,
-	0x20a9, 0x0020, 0x4003, 0x015e, 0x000e, 0xa882, 0x000e, 0xa87e,
-	0x001e, 0xa874, 0x0006, 0x2148, 0x080c, 0x0f9d, 0x001e, 0x0440,
-	0x0016, 0x080c, 0x0f9d, 0x009e, 0xa974, 0x0016, 0x080c, 0xb6e9,
-	0x001e, 0x00f0, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6,
-	0x0002, 0x0180, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060,
-	0xd1dc, 0x0118, 0xa87b, 0x0015, 0x0038, 0xd1d4, 0x0118, 0xa87b,
-	0x0007, 0x0010, 0xa87b, 0x0000, 0x0016, 0x080c, 0x66a0, 0x001e,
-	0xd1e4, 0x1120, 0x080c, 0x9e19, 0x009e, 0x0005, 0x080c, 0xbdf7,
-	0x0cd8, 0x6004, 0x9086, 0x0040, 0x1120, 0x080c, 0x8846, 0x080c,
-	0x894b, 0x2019, 0x0001, 0x080c, 0x96bf, 0x6003, 0x0002, 0x080c,
-	0xc216, 0x080c, 0x88fb, 0x080c, 0x8a26, 0x0005, 0x6004, 0x9086,
-	0x0040, 0x1120, 0x080c, 0x8846, 0x080c, 0x894b, 0x2019, 0x0001,
-	0x080c, 0x96bf, 0x080c, 0x88fb, 0x080c, 0x2fd7, 0x080c, 0xc20e,
-	0x0096, 0x6114, 0x2148, 0x080c, 0xbafe, 0x0150, 0xa867, 0x0103,
-	0xa87b, 0x0029, 0xa877, 0x0000, 0x080c, 0x6885, 0x080c, 0xbce7,
-	0x009e, 0x080c, 0x9e19, 0x080c, 0x8a26, 0x0005, 0xa87b, 0x0015,
-	0xd1fc, 0x0180, 0xa87b, 0x0007, 0x8002, 0x8000, 0x810a, 0x9189,
-	0x0000, 0x0006, 0x0016, 0x2009, 0x1a4a, 0x2104, 0x8000, 0x200a,
-	0x001e, 0x000e, 0xa992, 0xa88e, 0x0005, 0x9182, 0x0054, 0x1220,
-	0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xb241, 0xb241, 0xb241,
-	0xb241, 0xb241, 0xb243, 0xb241, 0xb241, 0xb2e9, 0xb241, 0xb241,
-	0xb241, 0xb241, 0xb241, 0xb241, 0xb241, 0xb241, 0xb241, 0xb241,
-	0xb41a, 0x080c, 0x0db4, 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071,
-	0x0260, 0x6114, 0x2150, 0x7644, 0xb676, 0x96b4, 0x0fff, 0xb77c,
-	0xc7e5, 0xb77e, 0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110,
-	0x8211, 0xba3e, 0x00be, 0x86ff, 0x0904, 0xb2e2, 0x9694, 0xff00,
-	0x9284, 0x0c00, 0x0120, 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284,
-	0x0300, 0x0904, 0xb2e2, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005,
-	0x1118, 0xc6c4, 0xb676, 0x0c38, 0x080c, 0x0feb, 0x090c, 0x0db4,
-	0x2900, 0xb07a, 0xb77c, 0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103,
-	0xb068, 0xa86a, 0xb06c, 0xa86e, 0xb070, 0xa872, 0x7044, 0x9084,
-	0xf000, 0x9635, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92,
+	0x0013, 0x006e, 0x0005, 0x9f33, 0x9f33, 0x9f76, 0xa015, 0xa0aa,
+	0x9f33, 0x9f33, 0x9f33, 0x9f35, 0x9f33, 0x9f33, 0x9f33, 0x9f33,
+	0x9f33, 0x9f33, 0x9f33, 0x080c, 0x0db4, 0x9186, 0x004c, 0x0588,
+	0x9186, 0x0003, 0x190c, 0x0db4, 0x0096, 0x601c, 0xc0ed, 0x601e,
+	0x6003, 0x0003, 0x6106, 0x6014, 0x2048, 0xa87c, 0x9084, 0xa000,
+	0xc0b5, 0xa87e, 0xa8ac, 0xa846, 0xa8b0, 0xa84a, 0x9006, 0xa836,
+	0xa83a, 0xa884, 0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003,
+	0x8013, 0x8213, 0x9210, 0x621a, 0x009e, 0x2c10, 0x080c, 0x1a5c,
+	0x080c, 0x8456, 0x0126, 0x2091, 0x8000, 0x080c, 0x8a4e, 0x012e,
+	0x0005, 0x6010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x080c,
+	0xa0cc, 0x080c, 0xc22a, 0x6003, 0x0007, 0x0005, 0x00d6, 0x0096,
+	0x00f6, 0x2079, 0x1800, 0x7a8c, 0x6014, 0x2048, 0xa87c, 0xd0ec,
+	0x1110, 0x9290, 0x0018, 0xac78, 0xc4fc, 0x0046, 0xa8e0, 0x9005,
+	0x1140, 0xa8dc, 0x921a, 0x0140, 0x0220, 0xa87b, 0x0007, 0x2010,
+	0x0028, 0xa87b, 0x0015, 0x0010, 0xa87b, 0x0000, 0x8214, 0xa883,
+	0x0000, 0xaa02, 0x0006, 0x0016, 0x0026, 0x00c6, 0x00d6, 0x00e6,
+	0x00f6, 0x2400, 0x9005, 0x1108, 0x009a, 0x2100, 0x9086, 0x0015,
+	0x1118, 0x2001, 0x0001, 0x0038, 0x2100, 0x9086, 0x0016, 0x0118,
+	0x2001, 0x0001, 0x002a, 0x94a4, 0x0007, 0x8423, 0x9405, 0x0002,
+	0x9fdd, 0x9fdd, 0x9fd8, 0x9fdb, 0x9fdd, 0x9fd5, 0x9fc8, 0x9fc8,
+	0x9fc8, 0x9fc8, 0x9fc8, 0x9fc8, 0x9fc8, 0x9fc8, 0x9fc8, 0x9fc8,
+	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x000e, 0x004e,
+	0x00fe, 0x009e, 0x00de, 0x080c, 0x0db4, 0x080c, 0xaa76, 0x0028,
+	0x080c, 0xab99, 0x0010, 0x080c, 0xac88, 0x00fe, 0x00ee, 0x00de,
+	0x00ce, 0x002e, 0x001e, 0x2c00, 0xa896, 0x000e, 0x080c, 0xa18a,
+	0x0530, 0xa804, 0xa80e, 0x00a6, 0x2050, 0xb100, 0x00ae, 0x8006,
+	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002,
+	0xaacc, 0xabd0, 0xacd4, 0xadd8, 0x2031, 0x0000, 0x2041, 0x1249,
+	0x080c, 0xa334, 0x0160, 0x000e, 0x9005, 0x0120, 0x00fe, 0x009e,
+	0x00de, 0x0005, 0x00fe, 0x009e, 0x00de, 0x0804, 0x9e32, 0x2001,
+	0x002c, 0x900e, 0x080c, 0xa1f0, 0x0c70, 0x91b6, 0x0015, 0x0170,
+	0x91b6, 0x0016, 0x0158, 0x91b2, 0x0047, 0x0a0c, 0x0db4, 0x91b2,
+	0x0050, 0x1a0c, 0x0db4, 0x9182, 0x0047, 0x00ca, 0x2001, 0x0109,
+	0x2004, 0xd08c, 0x0198, 0x0126, 0x2091, 0x2800, 0x0006, 0x0016,
+	0x0026, 0x080c, 0x83aa, 0x002e, 0x001e, 0x000e, 0x012e, 0xa001,
+	0x6000, 0x9086, 0x0002, 0x1110, 0x0804, 0x9f76, 0x0005, 0xa048,
+	0xa048, 0xa04a, 0xa080, 0xa048, 0xa048, 0xa048, 0xa048, 0xa093,
+	0x080c, 0x0db4, 0x00d6, 0x0016, 0x0096, 0x080c, 0x8923, 0x080c,
+	0x8a4e, 0x6003, 0x0004, 0x6114, 0x2148, 0xa87c, 0xd0fc, 0x01c0,
+	0xa878, 0xc0fc, 0x9005, 0x1158, 0xa894, 0x9005, 0x0140, 0x2001,
+	0x0000, 0x900e, 0x080c, 0xa1f0, 0x080c, 0x9e32, 0x00a8, 0x6003,
+	0x0002, 0xa8a4, 0xa9a8, 0x9105, 0x1178, 0xa8ae, 0xa8b2, 0x0c78,
+	0xa87f, 0x0020, 0xa88c, 0xa88a, 0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2,
+	0xa8c7, 0x0000, 0xa8cb, 0x0000, 0x009e, 0x001e, 0x00de, 0x0005,
+	0x080c, 0x8923, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xbb17,
+	0x0120, 0xa87b, 0x0006, 0x080c, 0x688c, 0x009e, 0x00de, 0x080c,
+	0x9e32, 0x0804, 0x8a4e, 0x080c, 0x8923, 0x080c, 0x2fda, 0x080c,
+	0xc227, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xbb17, 0x0120,
+	0xa87b, 0x0029, 0x080c, 0x688c, 0x009e, 0x00de, 0x080c, 0x9e32,
+	0x0804, 0x8a4e, 0x9182, 0x0047, 0x0002, 0xa0ba, 0xa0bc, 0xa0ba,
+	0xa0ba, 0xa0ba, 0xa0ba, 0xa0ba, 0xa0ba, 0xa0ba, 0xa0ba, 0xa0ba,
+	0xa0ba, 0xa0bc, 0x080c, 0x0db4, 0x00d6, 0x0096, 0x080c, 0x150f,
+	0x6114, 0x2148, 0xa87b, 0x0000, 0xa883, 0x0000, 0x080c, 0x688c,
+	0x009e, 0x00de, 0x0804, 0x9e32, 0x0026, 0x0036, 0x0056, 0x0066,
+	0x0096, 0x00a6, 0x00f6, 0x0006, 0x080c, 0x0feb, 0x000e, 0x090c,
+	0x0db4, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e,
+	0x20a9, 0x0020, 0x4104, 0xa87a, 0x2079, 0x1800, 0x798c, 0x9188,
+	0x0018, 0x918c, 0x0fff, 0xa972, 0xac76, 0x2950, 0x00a6, 0x2001,
+	0x0205, 0x2003, 0x0000, 0x901e, 0x2029, 0x0001, 0x9182, 0x0034,
+	0x1228, 0x2011, 0x001f, 0x080c, 0xb712, 0x04c0, 0x2130, 0x2009,
+	0x0034, 0x2011, 0x001f, 0x080c, 0xb712, 0x96b2, 0x0034, 0xb004,
+	0x904d, 0x0110, 0x080c, 0x0f9d, 0x080c, 0x0feb, 0x01d0, 0x8528,
+	0xa867, 0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d,
+	0x1230, 0x2608, 0x2011, 0x001b, 0x080c, 0xb712, 0x00b8, 0x96b2,
+	0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x080c, 0xb712,
+	0x0c18, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
+	0x0050, 0xb566, 0xb070, 0xc0fd, 0xb072, 0x0048, 0x2001, 0x0205,
+	0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0x2a48,
+	0xa804, 0xa807, 0x0000, 0x0006, 0x080c, 0x688c, 0x000e, 0x2048,
+	0x9005, 0x1db0, 0x00fe, 0x00ae, 0x009e, 0x006e, 0x005e, 0x003e,
+	0x002e, 0x0005, 0x00d6, 0x00f6, 0x0096, 0x0006, 0x080c, 0x0feb,
+	0x000e, 0x090c, 0x0db4, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019,
+	0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104, 0xaa66, 0xa87a, 0x2079,
+	0x1800, 0x798c, 0x810c, 0x9188, 0x000c, 0x9182, 0x001a, 0x0210,
+	0x2009, 0x001a, 0x21a8, 0x810b, 0xa972, 0xac76, 0x2e98, 0xa85c,
+	0x9080, 0x001f, 0x20a0, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080,
+	0x2102, 0x4003, 0x2003, 0x0000, 0x080c, 0x688c, 0x009e, 0x00fe,
+	0x00de, 0x0005, 0x0016, 0x00d6, 0x00f6, 0x0096, 0x0016, 0x2001,
+	0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x001e, 0x2079, 0x0200,
+	0x2e98, 0xa87c, 0xd0ec, 0x0118, 0x9e80, 0x000c, 0x2098, 0x2021,
+	0x003e, 0x901e, 0x9282, 0x0020, 0x0218, 0x2011, 0x0020, 0x2018,
+	0x9486, 0x003e, 0x1170, 0x0096, 0x080c, 0x0feb, 0x2900, 0x009e,
+	0x05c0, 0xa806, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
+	0x20a0, 0x3300, 0x908e, 0x0260, 0x0140, 0x2009, 0x0280, 0x9102,
+	0x920a, 0x0218, 0x2010, 0x2100, 0x9318, 0x2200, 0x9402, 0x1228,
+	0x2400, 0x9202, 0x2410, 0x9318, 0x9006, 0x2020, 0x22a8, 0xa800,
+	0x9200, 0xa802, 0x20e1, 0x0000, 0x4003, 0x83ff, 0x0180, 0x3300,
+	0x9086, 0x0280, 0x1130, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816,
+	0x2e98, 0x2310, 0x84ff, 0x0904, 0xa19f, 0x0804, 0xa1a1, 0x9085,
+	0x0001, 0x7817, 0x0000, 0x009e, 0x00fe, 0x00de, 0x001e, 0x0005,
+	0x00d6, 0x0036, 0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x080c,
+	0x687f, 0x009e, 0x003e, 0x00de, 0x0005, 0x91b6, 0x0015, 0x1118,
+	0x080c, 0x9e32, 0x0030, 0x91b6, 0x0016, 0x190c, 0x0db4, 0x080c,
+	0x9e32, 0x0005, 0x20a9, 0x000e, 0x20e1, 0x0000, 0x2e98, 0x6014,
+	0x0096, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x20a0, 0x009e, 0x4003,
+	0x0136, 0x9080, 0x001b, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418,
+	0x8318, 0x23a0, 0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8,
+	0x2011, 0x0006, 0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003,
+	0x3418, 0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xbb17,
+	0x0130, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e,
+	0x0804, 0x9e32, 0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200,
+	0x11a8, 0x6010, 0x00b6, 0x2058, 0xb8bf, 0x0000, 0x00be, 0x6014,
+	0x9005, 0x0130, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32,
+	0x080c, 0x9e32, 0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48,
+	0x0cc8, 0x0006, 0x0016, 0x080c, 0xc212, 0x0188, 0x6014, 0x9005,
+	0x1170, 0x600b, 0x0003, 0x601b, 0x0000, 0x6043, 0x0000, 0x2009,
+	0x0022, 0x080c, 0xa611, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085,
+	0x0001, 0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c,
+	0x20e1, 0x0000, 0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001,
+	0x2099, 0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804,
+	0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003,
+	0x2001, 0x0205, 0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020,
+	0x4003, 0x2003, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867,
+	0x0103, 0x080c, 0x9e32, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016,
+	0x900e, 0x7030, 0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff,
+	0x800c, 0x703c, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108,
+	0x810b, 0x2011, 0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c,
+	0xb712, 0x080c, 0xbb17, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000,
+	0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0x9e32, 0x001e, 0x009e,
+	0x0005, 0x0016, 0x0096, 0x7030, 0x9086, 0x0100, 0x1118, 0x2009,
+	0x0004, 0x0010, 0x7034, 0x800c, 0x810b, 0x2011, 0x000c, 0x2019,
+	0x000c, 0x6014, 0x2048, 0xa804, 0x0096, 0x9005, 0x0108, 0x2048,
+	0x080c, 0xb712, 0x009e, 0x080c, 0xbb17, 0x0148, 0xa804, 0x9005,
+	0x1158, 0xa807, 0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c,
+	0x9e32, 0x009e, 0x001e, 0x0005, 0x0086, 0x2040, 0xa030, 0x8007,
+	0x9086, 0x0100, 0x1118, 0x080c, 0xa7c0, 0x00e0, 0xa034, 0x8007,
+	0x800c, 0x8806, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x000c, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
+	0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x122f,
+	0x0019, 0x0d08, 0x008e, 0x0898, 0x0096, 0x0006, 0x080c, 0x0feb,
+	0x000e, 0x01b0, 0xa8ab, 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006,
+	0xae6a, 0x2800, 0xa89e, 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96,
+	0xad9a, 0x0086, 0x2940, 0x080c, 0x10d5, 0x008e, 0x9085, 0x0001,
+	0x009e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff,
+	0x6210, 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1520, 0x700c,
+	0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x11e0, 0x6043,
+	0x0000, 0x2c68, 0x0016, 0x2009, 0x0035, 0x080c, 0xc18a, 0x001e,
+	0x1158, 0x622c, 0x2268, 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003,
+	0x0130, 0x9386, 0x0006, 0x0128, 0x080c, 0x9e32, 0x0020, 0x0039,
+	0x0010, 0x080c, 0xa446, 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096,
+	0x6814, 0x2048, 0x9186, 0x0015, 0x0904, 0xa42e, 0x918e, 0x0016,
+	0x1904, 0xa444, 0x700c, 0x908c, 0xff00, 0x9186, 0x1700, 0x0120,
+	0x9186, 0x0300, 0x1904, 0xa408, 0x89ff, 0x1138, 0x6800, 0x9086,
+	0x000f, 0x0904, 0xa3eb, 0x0804, 0xa442, 0x6808, 0x9086, 0xffff,
+	0x1904, 0xa430, 0xa87c, 0x9084, 0x0060, 0x9086, 0x0020, 0x1128,
+	0xa83c, 0xa940, 0x9105, 0x1904, 0xa430, 0x6824, 0xd0b4, 0x1904,
+	0xa430, 0x080c, 0xbd00, 0x685c, 0xa882, 0xa87c, 0xc0dc, 0xc0f4,
+	0xc0d4, 0xa87e, 0x0026, 0x900e, 0x6a18, 0x2001, 0x000a, 0x080c,
+	0x8270, 0xa884, 0x920a, 0x0208, 0x8011, 0xaa86, 0x82ff, 0x002e,
+	0x1138, 0x00c6, 0x2d60, 0x080c, 0xb83c, 0x00ce, 0x0804, 0xa442,
+	0x00c6, 0xa868, 0xd0fc, 0x1118, 0x080c, 0x5d4d, 0x0010, 0x080c,
+	0x60f4, 0x00ce, 0x1904, 0xa430, 0x00c6, 0x2d60, 0x080c, 0x9e32,
+	0x00ce, 0x0804, 0xa442, 0x00c6, 0x080c, 0x9e7f, 0x0198, 0x6017,
+	0x0000, 0x6810, 0x6012, 0x080c, 0xbf8c, 0x6023, 0x0003, 0x6904,
+	0x00c6, 0x2d60, 0x080c, 0x9e32, 0x00ce, 0x080c, 0x9eac, 0x00ce,
+	0x0804, 0xa442, 0x2001, 0x1959, 0x2004, 0x6842, 0x00ce, 0x04d0,
+	0x7008, 0x9086, 0x000b, 0x11c8, 0x6010, 0x00b6, 0x2058, 0xb900,
+	0xc1bc, 0xb902, 0x00be, 0x00c6, 0x2d60, 0xa87b, 0x0003, 0x080c,
+	0xc1cc, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x00ce, 0x00e8, 0x700c, 0x9086, 0x2a00,
+	0x1138, 0x2001, 0x1959, 0x2004, 0x6842, 0x00a0, 0x0479, 0x00a0,
+	0x89ff, 0x090c, 0x0db4, 0x00c6, 0x00d6, 0x2d60, 0xa867, 0x0103,
+	0xa87b, 0x0003, 0x080c, 0x66a7, 0x080c, 0xbd00, 0x080c, 0x9e62,
+	0x00de, 0x00ce, 0x080c, 0x9e32, 0x009e, 0x0005, 0x9186, 0x0015,
+	0x1128, 0x2001, 0x1959, 0x2004, 0x6842, 0x0068, 0x918e, 0x0016,
+	0x1160, 0x00c6, 0x2d00, 0x2060, 0x080c, 0xd787, 0x080c, 0x8204,
+	0x080c, 0x9e32, 0x00ce, 0x080c, 0x9e32, 0x0005, 0x0026, 0x0036,
+	0x0046, 0x7228, 0xacb0, 0xabac, 0xd2f4, 0x0130, 0x2001, 0x1959,
+	0x2004, 0x6842, 0x0804, 0xa4c0, 0x00c6, 0x2d60, 0x080c, 0xb73d,
+	0x00ce, 0x6804, 0x9086, 0x0050, 0x1168, 0x00c6, 0x2d00, 0x2060,
+	0x6003, 0x0001, 0x6007, 0x0050, 0x080c, 0x83f1, 0x080c, 0x8973,
+	0x00ce, 0x04f0, 0x6800, 0x9086, 0x000f, 0x01a8, 0x89ff, 0x090c,
+	0x0db4, 0x6800, 0x9086, 0x0004, 0x1190, 0xa87c, 0xd0ac, 0x0178,
+	0xa843, 0x0fff, 0xa83f, 0x0fff, 0xa880, 0xc0fc, 0xa882, 0x2001,
+	0x0001, 0x6832, 0x0400, 0x2001, 0x0007, 0x6832, 0x00e0, 0xa87c,
+	0xd0b4, 0x1150, 0xd0ac, 0x0db8, 0x6824, 0xd0f4, 0x1d48, 0xa838,
+	0xa934, 0x9105, 0x0d80, 0x0c20, 0xd2ec, 0x1d68, 0x7024, 0x9306,
+	0x1118, 0x7020, 0x9406, 0x0d38, 0x7020, 0x683e, 0x7024, 0x683a,
+	0x2001, 0x0005, 0x6832, 0x080c, 0xbe83, 0x080c, 0x8973, 0x0010,
+	0x080c, 0x9e32, 0x004e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x00d6,
+	0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258, 0xba10,
+	0x00be, 0x9206, 0x1904, 0xa52b, 0x700c, 0x6210, 0x00b6, 0x2258,
+	0xba14, 0x00be, 0x9206, 0x1904, 0xa52b, 0x6038, 0x2068, 0x6824,
+	0xc0dc, 0x6826, 0x6a20, 0x9286, 0x0007, 0x0904, 0xa52b, 0x9286,
+	0x0002, 0x0904, 0xa52b, 0x9286, 0x0000, 0x05e8, 0x6808, 0x633c,
+	0x9306, 0x15c8, 0x2071, 0x026c, 0x9186, 0x0015, 0x0570, 0x918e,
+	0x0016, 0x1100, 0x00c6, 0x6038, 0x2060, 0x6104, 0x9186, 0x004b,
+	0x01c0, 0x9186, 0x004c, 0x01a8, 0x9186, 0x004d, 0x0190, 0x9186,
+	0x004e, 0x0178, 0x9186, 0x0052, 0x0160, 0x6014, 0x0096, 0x2048,
+	0x080c, 0xbb17, 0x090c, 0x0db4, 0xa87b, 0x0003, 0x009e, 0x080c,
+	0xc1cc, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x00ce, 0x0030, 0x6038, 0x2070, 0x2001,
+	0x1959, 0x2004, 0x7042, 0x080c, 0x9e32, 0x002e, 0x00de, 0x00ee,
+	0x0005, 0x00b6, 0x0096, 0x00f6, 0x6014, 0x2048, 0x6010, 0x2058,
+	0x91b6, 0x0015, 0x0130, 0xba08, 0xbb0c, 0xbc00, 0xc48c, 0xbc02,
+	0x0460, 0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0010,
+	0x2019, 0x000a, 0x20a9, 0x0004, 0x080c, 0xae0d, 0x002e, 0x003e,
+	0x015e, 0x009e, 0x1904, 0xa59a, 0x0096, 0x0156, 0x0036, 0x0026,
+	0x2b48, 0x9e90, 0x0014, 0x2019, 0x0006, 0x20a9, 0x0004, 0x080c,
+	0xae0d, 0x002e, 0x003e, 0x015e, 0x009e, 0x15a0, 0x7238, 0xba0a,
+	0x733c, 0xbb0e, 0xbc00, 0xc48d, 0xbc02, 0xa804, 0x9005, 0x1128,
+	0x00fe, 0x009e, 0x00be, 0x0804, 0xa235, 0x0096, 0x2048, 0xaa12,
+	0xab16, 0xac0a, 0x009e, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f,
+	0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c,
+	0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x122f, 0x080c, 0xa334,
+	0x0130, 0x00fe, 0x009e, 0x080c, 0x9e32, 0x00be, 0x0005, 0x080c,
+	0xa7c0, 0x0cb8, 0x2b78, 0x00f6, 0x080c, 0x2fda, 0x080c, 0xc227,
+	0x00fe, 0x00c6, 0x080c, 0x9ddc, 0x2f00, 0x6012, 0x6017, 0x0000,
+	0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x2001, 0x0007,
+	0x080c, 0x618f, 0x080c, 0x61bb, 0x080c, 0x8439, 0x080c, 0x8973,
+	0x00ce, 0x0804, 0xa56d, 0x2100, 0x91b2, 0x0053, 0x1a0c, 0x0db4,
+	0x91b2, 0x0040, 0x1a04, 0xa623, 0x0002, 0xa611, 0xa611, 0xa607,
+	0xa611, 0xa611, 0xa611, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605,
+	0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605,
+	0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605,
+	0xa605, 0xa605, 0xa605, 0xa605, 0xa611, 0xa605, 0xa611, 0xa611,
+	0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa607, 0xa605, 0xa605,
+	0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa611,
+	0xa611, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605, 0xa605,
+	0xa605, 0xa605, 0xa611, 0xa605, 0xa605, 0x080c, 0x0db4, 0x0066,
+	0x00b6, 0x6610, 0x2658, 0xb8bc, 0xc08c, 0xb8be, 0x00be, 0x006e,
+	0x0000, 0x6003, 0x0001, 0x6106, 0x9186, 0x0032, 0x0118, 0x080c,
+	0x8439, 0x0010, 0x080c, 0x83f1, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x8973, 0x012e, 0x0005, 0x2600, 0x0002, 0xa637, 0xa637, 0xa637,
+	0xa611, 0xa611, 0xa637, 0xa637, 0xa637, 0xa637, 0xa611, 0xa637,
+	0xa611, 0xa637, 0xa611, 0xa637, 0xa637, 0xa637, 0xa637, 0x080c,
+	0x0db4, 0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0db4, 0x91b6, 0x0013,
+	0x0904, 0xa6fb, 0x91b6, 0x0027, 0x1904, 0xa6b6, 0x080c, 0x886e,
+	0x6004, 0x080c, 0xbd0c, 0x01b0, 0x080c, 0xbd1d, 0x01a8, 0x908e,
+	0x0021, 0x0904, 0xa6b3, 0x908e, 0x0022, 0x1130, 0x080c, 0xa261,
+	0x0904, 0xa6af, 0x0804, 0xa6b0, 0x908e, 0x003d, 0x0904, 0xa6b3,
+	0x0804, 0xa6a9, 0x080c, 0x3003, 0x2001, 0x0007, 0x080c, 0x618f,
+	0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xa7c0, 0x9186,
+	0x007e, 0x1148, 0x2001, 0x1836, 0x2014, 0xc285, 0x080c, 0x6fb2,
+	0x1108, 0xc2ad, 0x2202, 0x0036, 0x0026, 0x2019, 0x0028, 0x2110,
+	0x080c, 0xd7e2, 0x002e, 0x003e, 0x0016, 0x0026, 0x0036, 0x2110,
+	0x2019, 0x0028, 0x080c, 0x8571, 0x0076, 0x903e, 0x080c, 0x8469,
+	0x6010, 0x00b6, 0x905d, 0x0100, 0x00be, 0x2c08, 0x080c, 0xd29b,
+	0x007e, 0x003e, 0x002e, 0x001e, 0x080c, 0xc227, 0x0016, 0x080c,
+	0xbf84, 0x080c, 0x9e32, 0x001e, 0x080c, 0x30d5, 0x080c, 0x8973,
+	0x0030, 0x080c, 0xbf84, 0x080c, 0x9e32, 0x080c, 0x8973, 0x0005,
+	0x080c, 0xa7c0, 0x0cb0, 0x080c, 0xa7fc, 0x0c98, 0x9186, 0x0014,
+	0x1db0, 0x080c, 0x886e, 0x6004, 0x908e, 0x0022, 0x1118, 0x080c,
+	0xa261, 0x0d68, 0x080c, 0x2fda, 0x080c, 0xc227, 0x080c, 0xbd0c,
+	0x1190, 0x080c, 0x3003, 0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be,
+	0x080c, 0xa7c0, 0x9186, 0x007e, 0x1128, 0x2001, 0x1836, 0x200c,
+	0xc185, 0x2102, 0x0870, 0x080c, 0xbd1d, 0x1118, 0x080c, 0xa7c0,
+	0x0840, 0x6004, 0x908e, 0x0032, 0x1160, 0x00e6, 0x00f6, 0x2071,
+	0x1894, 0x2079, 0x0000, 0x080c, 0x3369, 0x00fe, 0x00ee, 0x0804,
+	0xa6a9, 0x6004, 0x908e, 0x0021, 0x0d48, 0x908e, 0x0022, 0x090c,
+	0xa7c0, 0x0804, 0xa6a9, 0x90b2, 0x0040, 0x1a04, 0xa7a9, 0x2008,
+	0x0002, 0xa743, 0xa744, 0xa747, 0xa74a, 0xa74d, 0xa750, 0xa741,
+	0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741,
+	0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741,
+	0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741, 0xa753,
+	0xa75e, 0xa741, 0xa760, 0xa75e, 0xa741, 0xa741, 0xa741, 0xa741,
+	0xa741, 0xa75e, 0xa75e, 0xa741, 0xa741, 0xa741, 0xa741, 0xa741,
+	0xa741, 0xa741, 0xa741, 0xa790, 0xa75e, 0xa741, 0xa75a, 0xa741,
+	0xa741, 0xa741, 0xa75b, 0xa741, 0xa741, 0xa741, 0xa75e, 0xa787,
+	0xa741, 0x080c, 0x0db4, 0x00d0, 0x2001, 0x000b, 0x0410, 0x2001,
+	0x0003, 0x00f8, 0x2001, 0x0005, 0x00e0, 0x2001, 0x0001, 0x00c8,
+	0x2001, 0x0009, 0x00b0, 0x080c, 0x886e, 0x6003, 0x0005, 0x080c,
+	0x8973, 0x0070, 0x0018, 0x0010, 0x080c, 0x618f, 0x0804, 0xa7a1,
+	0x080c, 0x886e, 0x080c, 0xc22a, 0x6003, 0x0004, 0x080c, 0x8973,
+	0x0005, 0x080c, 0x618f, 0x080c, 0x886e, 0x6003, 0x0002, 0x0036,
+	0x2019, 0x185e, 0x2304, 0x9084, 0xff00, 0x1120, 0x2001, 0x1957,
+	0x201c, 0x0040, 0x8007, 0x909a, 0x0004, 0x0ec0, 0x8003, 0x801b,
+	0x831b, 0x9318, 0x631a, 0x003e, 0x080c, 0x8973, 0x0c08, 0x080c,
+	0x886e, 0x080c, 0xbf84, 0x080c, 0x9e32, 0x080c, 0x8973, 0x08c0,
+	0x00e6, 0x00f6, 0x2071, 0x1894, 0x2079, 0x0000, 0x080c, 0x3369,
+	0x00fe, 0x00ee, 0x080c, 0x886e, 0x080c, 0x9e32, 0x080c, 0x8973,
+	0x0838, 0x080c, 0x886e, 0x6003, 0x0002, 0x080c, 0xc22a, 0x0804,
+	0x8973, 0x2600, 0x2008, 0x0002, 0xa7be, 0xa7be, 0xa7be, 0xa7a1,
+	0xa7a1, 0xa7be, 0xa7be, 0xa7be, 0xa7be, 0xa7a1, 0xa7be, 0xa7a1,
+	0xa7be, 0xa7a1, 0xa7be, 0xa7be, 0xa7be, 0xa7be, 0x080c, 0x0db4,
+	0x00e6, 0x0096, 0x0026, 0x0016, 0x080c, 0xbb17, 0x0568, 0x6014,
+	0x2048, 0xa864, 0x9086, 0x0139, 0x11a8, 0xa894, 0x9086, 0x0056,
+	0x1148, 0x080c, 0x512f, 0x0130, 0x2001, 0x0000, 0x900e, 0x2011,
+	0x4000, 0x0028, 0x2001, 0x0030, 0x900e, 0x2011, 0x4005, 0x080c,
+	0xc0f1, 0x0090, 0xa868, 0xd0fc, 0x0178, 0xa807, 0x0000, 0x0016,
+	0x6004, 0x908e, 0x0021, 0x0168, 0x908e, 0x003d, 0x0150, 0x001e,
+	0xa867, 0x0103, 0xa833, 0x0100, 0x001e, 0x002e, 0x009e, 0x00ee,
+	0x0005, 0x001e, 0x0009, 0x0cc0, 0x0096, 0x6014, 0x2048, 0xa800,
+	0x2048, 0xa867, 0x0103, 0xa823, 0x8001, 0x009e, 0x0005, 0x00b6,
+	0x6610, 0x2658, 0xb804, 0x9084, 0x00ff, 0x90b2, 0x000c, 0x1a0c,
+	0x0db4, 0x6604, 0x96b6, 0x004d, 0x1120, 0x080c, 0xc010, 0x0804,
+	0xa884, 0x6604, 0x96b6, 0x0043, 0x1120, 0x080c, 0xc059, 0x0804,
+	0xa884, 0x6604, 0x96b6, 0x004b, 0x1120, 0x080c, 0xc085, 0x0804,
+	0xa884, 0x6604, 0x96b6, 0x0033, 0x1120, 0x080c, 0xbfa6, 0x0804,
+	0xa884, 0x6604, 0x96b6, 0x0028, 0x1120, 0x080c, 0xbd56, 0x0804,
+	0xa884, 0x6604, 0x96b6, 0x0029, 0x1120, 0x080c, 0xbd97, 0x0804,
+	0xa884, 0x6604, 0x96b6, 0x001f, 0x1118, 0x080c, 0xa20a, 0x04e0,
+	0x6604, 0x96b6, 0x0000, 0x1118, 0x080c, 0xa531, 0x04a8, 0x6604,
+	0x96b6, 0x0022, 0x1118, 0x080c, 0xa242, 0x0470, 0x6604, 0x96b6,
+	0x0035, 0x1118, 0x080c, 0xa352, 0x0438, 0x6604, 0x96b6, 0x0039,
+	0x1118, 0x080c, 0xa4c6, 0x0400, 0x6604, 0x96b6, 0x003d, 0x1118,
+	0x080c, 0xa27a, 0x00c8, 0x6604, 0x96b6, 0x0044, 0x1118, 0x080c,
+	0xa2b6, 0x0090, 0x6604, 0x96b6, 0x0049, 0x1118, 0x080c, 0xa2e1,
+	0x0058, 0x91b6, 0x0015, 0x1110, 0x0063, 0x0030, 0x91b6, 0x0016,
+	0x1128, 0x00be, 0x0804, 0xab42, 0x00be, 0x0005, 0x080c, 0x9ec7,
+	0x0cd8, 0xa8a1, 0xa8a4, 0xa8a1, 0xa8e8, 0xa8a1, 0xaa76, 0xab4f,
+	0xa8a1, 0xa8a1, 0xab1c, 0xa8a1, 0xab30, 0x0096, 0x080c, 0x150f,
+	0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x009e, 0x0804,
+	0x9e32, 0xa001, 0xa001, 0x0005, 0x00e6, 0x2071, 0x1800, 0x708c,
+	0x9086, 0x0074, 0x1540, 0x080c, 0xd26c, 0x11b0, 0x6010, 0x00b6,
+	0x2058, 0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc, 0x0110, 0xc0c5,
+	0xb802, 0x00e9, 0x00be, 0x2001, 0x0006, 0x080c, 0x618f, 0x080c,
+	0x3003, 0x080c, 0x9e32, 0x0088, 0x2001, 0x000a, 0x080c, 0x618f,
+	0x080c, 0x3003, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x8439,
+	0x080c, 0x8973, 0x0010, 0x080c, 0xaa61, 0x00ee, 0x0005, 0x00d6,
+	0xb800, 0xd084, 0x0158, 0x9006, 0x080c, 0x617b, 0x2069, 0x1853,
+	0x6804, 0x0020, 0x2001, 0x0006, 0x080c, 0x61bb, 0x00de, 0x0005,
+	0x00b6, 0x0096, 0x00d6, 0x2011, 0x1823, 0x2204, 0x9086, 0x0074,
+	0x1904, 0xaa3a, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x007e, 0x1120,
+	0x080c, 0xac93, 0x0804, 0xa99f, 0x00d6, 0x080c, 0x6fb2, 0x0198,
+	0x0026, 0x2011, 0x0010, 0x080c, 0x6586, 0x002e, 0x05c8, 0x080c,
+	0x539a, 0x1540, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103,
+	0xa833, 0xdead, 0x00f8, 0x0026, 0x2011, 0x8008, 0x080c, 0x6586,
+	0x002e, 0x0530, 0x6014, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086,
+	0x0039, 0x1140, 0x2001, 0x0030, 0x900e, 0x2011, 0x4009, 0x080c,
+	0xc0f1, 0x0040, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103,
+	0xa833, 0xdead, 0x6010, 0x2058, 0xb9a0, 0x0016, 0x080c, 0x3003,
+	0x080c, 0x9e32, 0x001e, 0x080c, 0x30d5, 0x00de, 0x0804, 0xaa3b,
+	0x00de, 0x080c, 0xac88, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x0080,
+	0x1510, 0x6014, 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084, 0x00ff,
+	0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000,
+	0x080c, 0xc0f1, 0x0030, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
+	0x0200, 0x2001, 0x0006, 0x080c, 0x618f, 0x080c, 0x3003, 0x080c,
+	0x9e32, 0x0804, 0xaa3b, 0x080c, 0xaa49, 0x6014, 0x9005, 0x0190,
+	0x2048, 0xa868, 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff, 0x9086,
+	0x0039, 0x1d08, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c,
+	0xc0f1, 0x08f8, 0x080c, 0xaa3f, 0x0160, 0x9006, 0x080c, 0x617b,
+	0x2001, 0x0004, 0x080c, 0x61bb, 0x2001, 0x0007, 0x080c, 0x618f,
+	0x08a0, 0x2001, 0x0004, 0x080c, 0x618f, 0x6003, 0x0001, 0x6007,
+	0x0003, 0x080c, 0x8439, 0x080c, 0x8973, 0x0804, 0xaa3b, 0xb85c,
+	0xd0e4, 0x01d0, 0x080c, 0xbf26, 0x080c, 0x6fb2, 0x0118, 0xd0dc,
+	0x1904, 0xa961, 0x2011, 0x1836, 0x2204, 0xc0ad, 0x2012, 0x2001,
+	0x0002, 0x00f6, 0x2079, 0x0100, 0x78e3, 0x0000, 0x080c, 0x26d7,
+	0x78e2, 0x00fe, 0x0804, 0xa961, 0x080c, 0xbf63, 0x2011, 0x1836,
+	0x2204, 0xc0a5, 0x2012, 0x0006, 0x080c, 0xd3c5, 0x000e, 0x1904,
+	0xa961, 0xc0b5, 0x2012, 0x2001, 0x0006, 0x080c, 0x618f, 0x9006,
+	0x080c, 0x617b, 0x00c6, 0x2001, 0x180f, 0x2004, 0xd09c, 0x0520,
+	0x00f6, 0x2079, 0x0100, 0x00e6, 0x2071, 0x1800, 0x700c, 0x9084,
+	0x00ff, 0x78e6, 0x707a, 0x7010, 0x78ea, 0x707e, 0x908c, 0x00ff,
+	0x00ee, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x26ac, 0x00f6,
+	0x2100, 0x900e, 0x080c, 0x2663, 0x795a, 0x00fe, 0x9186, 0x0081,
+	0x01d8, 0x2009, 0x0081, 0x00c8, 0x2009, 0x00ef, 0x00f6, 0x2079,
+	0x0100, 0x79ea, 0x7932, 0x7936, 0x780c, 0xc0b5, 0x780e, 0x00fe,
+	0x080c, 0x26ac, 0x00f6, 0x2079, 0x1800, 0x797e, 0x2100, 0x900e,
+	0x080c, 0x2663, 0x795a, 0x00fe, 0x8108, 0x080c, 0x61de, 0x2b00,
+	0x00ce, 0x1904, 0xa961, 0x6012, 0x2009, 0x180f, 0x210c, 0xd19c,
+	0x0150, 0x2009, 0x027c, 0x210c, 0x918c, 0x00ff, 0xb912, 0x2009,
+	0x027d, 0x210c, 0xb916, 0x2001, 0x0002, 0x080c, 0x618f, 0x6023,
+	0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x8439, 0x080c,
+	0x8973, 0x0008, 0x0431, 0x00de, 0x009e, 0x00be, 0x0005, 0x2001,
+	0x1810, 0x2004, 0xd0a4, 0x0120, 0x2001, 0x1854, 0x2004, 0xd0ac,
+	0x0005, 0x00e6, 0x080c, 0xd83b, 0x0190, 0x2071, 0x0260, 0x7108,
+	0x720c, 0x918c, 0x00ff, 0x1118, 0x9284, 0xff00, 0x0140, 0x6010,
+	0x2058, 0xb8a0, 0x9084, 0xff80, 0x1110, 0xb912, 0xba16, 0x00ee,
+	0x0005, 0x2030, 0x2001, 0x0007, 0x080c, 0x618f, 0x080c, 0x539a,
+	0x1120, 0x2001, 0x0007, 0x080c, 0x61bb, 0x080c, 0x3003, 0x6020,
+	0x9086, 0x000a, 0x1108, 0x0005, 0x0804, 0x9e32, 0x00b6, 0x00e6,
+	0x0026, 0x0016, 0x2071, 0x1800, 0x708c, 0x9086, 0x0014, 0x1904,
+	0xab13, 0x00d6, 0x080c, 0x6fb2, 0x0198, 0x0026, 0x2011, 0x0010,
+	0x080c, 0x6586, 0x002e, 0x05c8, 0x080c, 0x539a, 0x1540, 0x6014,
+	0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x00f8,
+	0x0026, 0x2011, 0x8008, 0x080c, 0x6586, 0x002e, 0x0530, 0x6014,
+	0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001,
+	0x0030, 0x900e, 0x2011, 0x4009, 0x080c, 0xc0f1, 0x0040, 0x6014,
+	0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x6010,
+	0x2058, 0xb9a0, 0x0016, 0x080c, 0x3003, 0x080c, 0x9e32, 0x001e,
+	0x080c, 0x30d5, 0x00de, 0x0804, 0xab17, 0x00de, 0x080c, 0x539a,
+	0x1170, 0x6014, 0x9005, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058,
+	0xbba0, 0x2021, 0x0006, 0x080c, 0x4a76, 0x004e, 0x003e, 0x00d6,
+	0x6010, 0x2058, 0x080c, 0x62d9, 0x080c, 0xa8d7, 0x00de, 0x080c,
+	0xad59, 0x1588, 0x6010, 0x2058, 0xb890, 0x9005, 0x0560, 0x2001,
+	0x0006, 0x080c, 0x618f, 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864,
+	0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e,
+	0x2011, 0x4000, 0x080c, 0xc0f1, 0x0060, 0xa864, 0x9084, 0x00ff,
+	0x9086, 0x0029, 0x0130, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
+	0x0200, 0x009e, 0x080c, 0x3003, 0x6020, 0x9086, 0x000a, 0x0138,
+	0x080c, 0x9e32, 0x0020, 0x080c, 0xa7c0, 0x080c, 0xaa61, 0x001e,
+	0x002e, 0x00ee, 0x00be, 0x0005, 0x2011, 0x1823, 0x2204, 0x9086,
+	0x0014, 0x1160, 0x2001, 0x0002, 0x080c, 0x618f, 0x6003, 0x0001,
+	0x6007, 0x0001, 0x080c, 0x8439, 0x0804, 0x8973, 0x0804, 0xaa61,
+	0x2030, 0x2011, 0x1823, 0x2204, 0x9086, 0x0004, 0x1148, 0x96b6,
+	0x000b, 0x1120, 0x2001, 0x0007, 0x080c, 0x618f, 0x0804, 0x9e32,
+	0x0804, 0xaa61, 0x0002, 0xa8a1, 0xab5a, 0xa8a1, 0xab99, 0xa8a1,
+	0xac44, 0xab4f, 0xa8a1, 0xa8a1, 0xac57, 0xa8a1, 0xac67, 0x6604,
+	0x9686, 0x0003, 0x0904, 0xaa76, 0x96b6, 0x001e, 0x1110, 0x080c,
+	0x9e32, 0x0005, 0x00b6, 0x00d6, 0x00c6, 0x080c, 0xac77, 0x11a0,
+	0x9006, 0x080c, 0x617b, 0x080c, 0x2fda, 0x080c, 0xc227, 0x2001,
+	0x0002, 0x080c, 0x618f, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c,
+	0x8439, 0x080c, 0x8973, 0x0408, 0x2009, 0x026e, 0x2104, 0x9086,
+	0x0009, 0x1160, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005,
+	0x0170, 0x8001, 0xb842, 0x601b, 0x000a, 0x0078, 0x2009, 0x026f,
+	0x2104, 0x9084, 0xff00, 0x9086, 0x1900, 0x1108, 0x08a0, 0x080c,
+	0x2fda, 0x080c, 0xc227, 0x080c, 0xaa61, 0x00ce, 0x00de, 0x00be,
+	0x0005, 0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xac85, 0x00d6,
+	0x2069, 0x194d, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058, 0xb8a0,
+	0x9086, 0x007e, 0x1138, 0x2069, 0x181f, 0x2d04, 0x8000, 0x206a,
+	0x00de, 0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x617b, 0x2001,
+	0x0002, 0x080c, 0x618f, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c,
+	0x8439, 0x080c, 0x8973, 0x0804, 0xac14, 0x080c, 0xbb17, 0x01b0,
+	0x6014, 0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138, 0x6007,
+	0x0016, 0x2001, 0x0002, 0x080c, 0xc14b, 0x00b0, 0x6014, 0x2048,
+	0xa864, 0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001, 0x180e,
+	0x2004, 0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff,
+	0x9005, 0x1110, 0x9006, 0x0c38, 0x080c, 0xa7c0, 0x2009, 0x026e,
+	0x2134, 0x96b4, 0x00ff, 0x9686, 0x0005, 0x0510, 0x9686, 0x000b,
+	0x01c8, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118, 0x9686,
+	0x0009, 0x01b0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009, 0x0180,
+	0x2001, 0x0004, 0x080c, 0x618f, 0x2001, 0x0028, 0x601a, 0x6007,
+	0x0052, 0x0010, 0x080c, 0xaa61, 0x002e, 0x00be, 0x009e, 0x0005,
+	0x9286, 0x0139, 0x0160, 0x6014, 0x2048, 0x080c, 0xbb17, 0x0140,
+	0xa864, 0x9086, 0x0139, 0x0118, 0xa868, 0xd0fc, 0x0108, 0x0c50,
+	0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0138, 0x8001,
+	0xb842, 0x601b, 0x000a, 0x6007, 0x0016, 0x08f0, 0xb8a0, 0x9086,
+	0x007e, 0x1138, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5c64, 0x00ee,
+	0x0010, 0x080c, 0x2fda, 0x0870, 0x080c, 0xac85, 0x1160, 0x2001,
+	0x0004, 0x080c, 0x618f, 0x6003, 0x0001, 0x6007, 0x0003, 0x080c,
+	0x8439, 0x0804, 0x8973, 0x080c, 0xa7c0, 0x0804, 0xaa61, 0x0469,
+	0x1160, 0x2001, 0x0008, 0x080c, 0x618f, 0x6003, 0x0001, 0x6007,
+	0x0005, 0x080c, 0x8439, 0x0804, 0x8973, 0x0804, 0xaa61, 0x00e9,
+	0x1160, 0x2001, 0x000a, 0x080c, 0x618f, 0x6003, 0x0001, 0x6007,
+	0x0001, 0x080c, 0x8439, 0x0804, 0x8973, 0x0804, 0xaa61, 0x2009,
+	0x026e, 0x2104, 0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104,
+	0x9084, 0xff00, 0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005,
+	0x00b6, 0x00c6, 0x0016, 0x6110, 0x2158, 0x080c, 0x624d, 0x001e,
+	0x00ce, 0x00be, 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036,
+	0x0016, 0x6010, 0x2058, 0x2009, 0x1836, 0x2104, 0x9085, 0x0003,
+	0x200a, 0x080c, 0xad2b, 0x0560, 0x2009, 0x1836, 0x2104, 0xc0cd,
+	0x200a, 0x080c, 0x655e, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a,
+	0x080c, 0xd52a, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019,
+	0x002a, 0x2009, 0x0001, 0x080c, 0x2fa5, 0x00e6, 0x2071, 0x1800,
+	0x080c, 0x2dbb, 0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009,
+	0x007f, 0x080c, 0x30d5, 0x8108, 0x1f04, 0xacc9, 0x015e, 0x00ce,
+	0x080c, 0xac88, 0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001,
+	0x2001, 0x1836, 0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc,
+	0x0118, 0x7038, 0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001,
+	0x1836, 0x2102, 0x2079, 0x0100, 0x2e04, 0x9084, 0x00ff, 0x2069,
+	0x181e, 0x206a, 0x78e6, 0x0006, 0x8e70, 0x2e04, 0x2069, 0x181f,
+	0x206a, 0x78ea, 0x7832, 0x7836, 0x2010, 0x9084, 0xff00, 0x001e,
+	0x9105, 0x2009, 0x182b, 0x200a, 0x2200, 0x9084, 0x00ff, 0x2008,
+	0x080c, 0x26ac, 0x080c, 0x6fb2, 0x0170, 0x2071, 0x0260, 0x2069,
+	0x1953, 0x7048, 0x206a, 0x704c, 0x6806, 0x7050, 0x680a, 0x7054,
+	0x680e, 0x080c, 0xbf26, 0x0040, 0x2001, 0x0006, 0x080c, 0x618f,
+	0x080c, 0x3003, 0x080c, 0x9e32, 0x001e, 0x003e, 0x00de, 0x00ee,
+	0x00fe, 0x00be, 0x0005, 0x0096, 0x0026, 0x0036, 0x00e6, 0x0156,
+	0x2019, 0x182b, 0x231c, 0x83ff, 0x01f0, 0x2071, 0x0260, 0x7200,
+	0x9294, 0x00ff, 0x7004, 0x9084, 0xff00, 0x9205, 0x9306, 0x1198,
+	0x2011, 0x0276, 0x20a9, 0x0004, 0x2b48, 0x2019, 0x000a, 0x080c,
+	0xae0d, 0x1148, 0x2011, 0x027a, 0x20a9, 0x0004, 0x2019, 0x0006,
+	0x080c, 0xae0d, 0x1100, 0x015e, 0x00ee, 0x003e, 0x002e, 0x009e,
+	0x0005, 0x00e6, 0x2071, 0x0260, 0x7034, 0x9086, 0x0014, 0x11a8,
+	0x7038, 0x9086, 0x0800, 0x1188, 0x703c, 0xd0ec, 0x0160, 0x9084,
+	0x0f00, 0x9086, 0x0100, 0x1138, 0x7054, 0xd0a4, 0x1110, 0xd0ac,
+	0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6,
+	0x0096, 0x00c6, 0x0076, 0x0056, 0x0046, 0x0026, 0x0006, 0x0126,
+	0x2091, 0x8000, 0x2029, 0x19c1, 0x252c, 0x2021, 0x19c7, 0x2424,
+	0x2061, 0x1cd0, 0x2071, 0x1800, 0x7250, 0x7070, 0x9202, 0x1a04,
+	0xade5, 0x080c, 0xd55b, 0x0904, 0xadde, 0x6720, 0x9786, 0x0007,
+	0x0904, 0xadde, 0x2500, 0x9c06, 0x0904, 0xadde, 0x2400, 0x9c06,
+	0x05e8, 0x3e08, 0x9186, 0x0002, 0x1148, 0x6010, 0x9005, 0x0130,
+	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1580, 0x00c6, 0x6000,
+	0x9086, 0x0004, 0x1110, 0x080c, 0x190d, 0x9786, 0x000a, 0x0148,
+	0x080c, 0xbd1d, 0x1130, 0x00ce, 0x080c, 0xa7c0, 0x080c, 0x9e62,
+	0x00e8, 0x6014, 0x2048, 0x080c, 0xbb17, 0x01a8, 0x9786, 0x0003,
+	0x1530, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878,
+	0x2048, 0x080c, 0x0f9d, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c,
+	0x687f, 0x080c, 0xbd00, 0x080c, 0x9e62, 0x00ce, 0x9ce0, 0x0018,
+	0x7064, 0x9c02, 0x1210, 0x0804, 0xad8c, 0x012e, 0x000e, 0x002e,
+	0x004e, 0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee, 0x0005, 0x9786,
+	0x0006, 0x1118, 0x080c, 0xd4d5, 0x0c30, 0x9786, 0x000a, 0x0998,
+	0x0880, 0x220c, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04,
+	0xadf9, 0x9006, 0x0005, 0x2304, 0x9102, 0x0218, 0x2001, 0x0001,
+	0x0008, 0x9006, 0x918d, 0x0001, 0x0005, 0x0136, 0x01c6, 0x0016,
+	0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0,
+	0x9300, 0x2098, 0x3518, 0x20a9, 0x0001, 0x220c, 0x4002, 0x910e,
+	0x1140, 0x8210, 0x8319, 0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e,
+	0x0005, 0x220c, 0x9102, 0x0218, 0x2001, 0x0001, 0x0010, 0x2001,
+	0x0000, 0x918d, 0x0001, 0x001e, 0x01ce, 0x013e, 0x0005, 0x6004,
+	0x908a, 0x0053, 0x1a0c, 0x0db4, 0x080c, 0xbd0c, 0x0120, 0x080c,
+	0xbd1d, 0x0168, 0x0028, 0x080c, 0x3003, 0x080c, 0xbd1d, 0x0138,
+	0x080c, 0x886e, 0x080c, 0x9e32, 0x080c, 0x8973, 0x0005, 0x080c,
+	0xa7c0, 0x0cb0, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040, 0x0208,
+	0x000a, 0x0005, 0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae6e,
+	0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae70, 0xae70, 0xae70,
+	0xae70, 0xae6e, 0xae6e, 0xae6e, 0xae70, 0xae6e, 0x080c, 0x0db4,
+	0x600b, 0xffff, 0x6003, 0x0001, 0x6106, 0x080c, 0x83f1, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x8973, 0x012e, 0x0005, 0x9186, 0x0013,
+	0x1128, 0x6004, 0x9082, 0x0040, 0x0804, 0xaf25, 0x9186, 0x0027,
+	0x1520, 0x080c, 0x886e, 0x080c, 0x2fda, 0x080c, 0xc227, 0x0096,
+	0x6114, 0x2148, 0x080c, 0xbb17, 0x0198, 0x080c, 0xbd1d, 0x1118,
+	0x080c, 0xa7c0, 0x0068, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877,
+	0x0000, 0xa97c, 0xc1c5, 0xa97e, 0x080c, 0x688c, 0x080c, 0xbd00,
+	0x009e, 0x080c, 0x9e32, 0x0804, 0x8973, 0x9186, 0x0014, 0x1120,
+	0x6004, 0x9082, 0x0040, 0x04a0, 0x9186, 0x0046, 0x0150, 0x9186,
+	0x0045, 0x0138, 0x9186, 0x0053, 0x0120, 0x9186, 0x0048, 0x190c,
+	0x0db4, 0x2001, 0x0109, 0x2004, 0xd084, 0x0508, 0x0126, 0x2091,
+	0x2800, 0x0006, 0x0016, 0x0026, 0x0036, 0x00f6, 0x00e6, 0x00c6,
+	0x2079, 0x19b8, 0x2071, 0x1800, 0x2061, 0x0100, 0x080c, 0x82dd,
+	0x00ce, 0x00ee, 0x00fe, 0x003e, 0x002e, 0x001e, 0x000e, 0x012e,
+	0xa001, 0x6000, 0x9086, 0x0002, 0x1110, 0x0804, 0xaf63, 0x0005,
+	0x0002, 0xaeff, 0xaefd, 0xaefd, 0xaefd, 0xaefd, 0xaefd, 0xaefd,
+	0xaefd, 0xaefd, 0xaefd, 0xaefd, 0xaf1a, 0xaf1a, 0xaf1a, 0xaf1a,
+	0xaefd, 0xaf1a, 0xaefd, 0xaf1a, 0xaefd, 0x080c, 0x0db4, 0x080c,
+	0x886e, 0x0096, 0x6114, 0x2148, 0x080c, 0xbb17, 0x0168, 0xa867,
+	0x0103, 0xa87b, 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ec, 0xa882,
+	0x080c, 0x688c, 0x080c, 0xbd00, 0x009e, 0x080c, 0x9e32, 0x080c,
+	0x8973, 0x0005, 0x080c, 0x886e, 0x080c, 0xbd1d, 0x090c, 0xa7c0,
+	0x080c, 0x9e32, 0x080c, 0x8973, 0x0005, 0x0002, 0xaf3c, 0xaf3a,
+	0xaf3a, 0xaf3a, 0xaf3a, 0xaf3a, 0xaf3a, 0xaf3a, 0xaf3a, 0xaf3a,
+	0xaf3a, 0xaf53, 0xaf53, 0xaf53, 0xaf53, 0xaf3a, 0xaf5d, 0xaf3a,
+	0xaf53, 0xaf3a, 0x080c, 0x0db4, 0x0096, 0x080c, 0x886e, 0x6014,
+	0x2048, 0x2001, 0x1959, 0x2004, 0x6042, 0xa97c, 0xd1ac, 0x0140,
+	0x6003, 0x0004, 0xa87c, 0x9085, 0x0400, 0xa87e, 0x009e, 0x0005,
+	0x6003, 0x0002, 0x0cb8, 0x080c, 0x886e, 0x080c, 0xc22a, 0x080c,
+	0xc22f, 0x6003, 0x000f, 0x0804, 0x8973, 0x080c, 0x886e, 0x080c,
+	0x9e32, 0x0804, 0x8973, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040,
+	0x0208, 0x000a, 0x0005, 0xaf7f, 0xaf7f, 0xaf7f, 0xaf7f, 0xaf7f,
+	0xaf81, 0xb05e, 0xaf7f, 0xb092, 0xaf7f, 0xaf7f, 0xaf7f, 0xaf7f,
+	0xaf7f, 0xaf7f, 0xaf7f, 0xaf7f, 0xaf7f, 0xaf7f, 0xb092, 0x080c,
+	0x0db4, 0x00b6, 0x0096, 0x6114, 0x2148, 0x7644, 0x96b4, 0x0fff,
+	0x86ff, 0x1528, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xb04d,
+	0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0xa87c, 0xd0ac, 0x0128,
+	0xa834, 0xa938, 0x9115, 0x190c, 0xb227, 0x080c, 0x66a7, 0x6210,
+	0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x7044, 0xd0e4,
+	0x1904, 0xb031, 0x080c, 0x9e32, 0x009e, 0x00be, 0x0005, 0x968c,
+	0x0c00, 0x0150, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xb035,
+	0x7348, 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002,
+	0x0508, 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00e8, 0xd6dc,
+	0x01a0, 0xa87b, 0x0015, 0xa87c, 0xd0ac, 0x0170, 0xa938, 0xaa34,
+	0x2100, 0x9205, 0x0148, 0x7048, 0x9106, 0x1118, 0x704c, 0x9206,
+	0x0118, 0xa992, 0xaa8e, 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0xa87b,
+	0x0007, 0x0010, 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0x901e,
+	0xd6c4, 0x01d8, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118,
+	0xc6c4, 0x0804, 0xaf88, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a,
+	0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018,
+	0x2011, 0x0025, 0x080c, 0xb712, 0x003e, 0xd6cc, 0x0904, 0xaf9d,
+	0x7154, 0xa98a, 0x81ff, 0x0904, 0xaf9d, 0x9192, 0x0021, 0x1278,
+	0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xb712, 0x2011,
+	0x0205, 0x2013, 0x0000, 0x080c, 0xc1b7, 0x0804, 0xaf9d, 0xa868,
+	0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c50, 0x00a6, 0x2950,
+	0x080c, 0xb6b1, 0x00ae, 0x080c, 0xc1b7, 0x080c, 0xb702, 0x0804,
+	0xaf9f, 0x080c, 0xbe10, 0x0804, 0xafac, 0xa87c, 0xd0ac, 0x0904,
+	0xafb8, 0xa880, 0xd0bc, 0x1904, 0xafb8, 0x7348, 0xa838, 0x9306,
+	0x11c8, 0x734c, 0xa834, 0x931e, 0x0904, 0xafb8, 0xd6d4, 0x0190,
+	0xab38, 0x9305, 0x0904, 0xafb8, 0x0068, 0xa87c, 0xd0ac, 0x0904,
+	0xaf90, 0xa838, 0xa934, 0x9105, 0x0904, 0xaf90, 0xa880, 0xd0bc,
+	0x1904, 0xaf90, 0x080c, 0xbe4a, 0x0804, 0xafac, 0x0096, 0x00f6,
+	0x6003, 0x0003, 0x6007, 0x0043, 0x2079, 0x026c, 0x7c04, 0x7b00,
+	0x7e0c, 0x7d08, 0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0140, 0x6003,
+	0x0002, 0x00fe, 0x009e, 0x0005, 0x2130, 0x2228, 0x0058, 0x2400,
+	0xa9ac, 0x910a, 0x2300, 0xaab0, 0x9213, 0x2600, 0x9102, 0x2500,
+	0x9203, 0x0e90, 0xac36, 0xab3a, 0xae46, 0xad4a, 0x00fe, 0x6043,
+	0x0000, 0x2c10, 0x080c, 0x1a5c, 0x080c, 0x8456, 0x080c, 0x8a4e,
+	0x009e, 0x0005, 0x0005, 0x9182, 0x0054, 0x1220, 0x9182, 0x0040,
+	0x0208, 0x000a, 0x0005, 0xb0af, 0xb0af, 0xb0af, 0xb0af, 0xb0af,
+	0xb0b1, 0xb147, 0xb0af, 0xb0af, 0xb15e, 0xb1ea, 0xb0af, 0xb0af,
+	0xb0af, 0xb0af, 0xb1ff, 0xb0af, 0xb0af, 0xb0af, 0xb0af, 0x080c,
+	0x0db4, 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114,
+	0x2150, 0x7644, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e,
+	0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e,
+	0x00be, 0x86ff, 0x0904, 0xb142, 0x9694, 0xff00, 0x9284, 0x0c00,
+	0x0120, 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300, 0x0904,
+	0xb142, 0x080c, 0x0feb, 0x090c, 0x0db4, 0x2900, 0xb07a, 0xb77c,
+	0xc7cd, 0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c, 0xa86e,
+	0xb070, 0xa872, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92,
 	0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186,
 	0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b,
 	0x0015, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b,
 	0x0000, 0xaf7e, 0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4,
 	0x0190, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210,
 	0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025,
-	0x080c, 0xb6f9, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff,
+	0x080c, 0xb712, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff,
 	0x01c8, 0x9192, 0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011,
-	0x0029, 0x080c, 0xb6f9, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050,
+	0x0029, 0x080c, 0xb712, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050,
 	0xb068, 0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950,
-	0x080c, 0xb698, 0x080c, 0x18eb, 0x009e, 0x00ee, 0x00ae, 0x007e,
-	0x0005, 0x2001, 0x1959, 0x2004, 0x6042, 0x0096, 0x6114, 0x2148,
-	0xa83c, 0xa940, 0x9105, 0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003,
-	0x0002, 0xa97c, 0xd1e4, 0x0904, 0xb415, 0x6043, 0x0000, 0x6010,
-	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904,
-	0xb3e4, 0xa978, 0xa868, 0xd0fc, 0x0904, 0xb3a5, 0x0016, 0xa87c,
-	0x0006, 0xa880, 0x0006, 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff,
-	0x90b6, 0x0002, 0x0904, 0xb373, 0x9086, 0x0028, 0x1904, 0xb35f,
-	0xa87b, 0x001c, 0xb07b, 0x001c, 0x0804, 0xb37b, 0x6024, 0xd0f4,
-	0x11d0, 0xa838, 0xaa34, 0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206,
-	0x1120, 0xa88c, 0xaa34, 0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148,
-	0xa9ac, 0xa834, 0x9102, 0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e,
-	0x6024, 0xc0f5, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000,
-	0xb83e, 0x00be, 0x9006, 0xa876, 0xa892, 0xa88e, 0xa87c, 0xc0e4,
-	0xa87e, 0xd0cc, 0x0140, 0xc0cc, 0xa87e, 0x0096, 0xa878, 0x2048,
-	0x080c, 0x0f9d, 0x009e, 0x080c, 0xbe31, 0x0804, 0xb415, 0xd1dc,
-	0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xc0c1, 0x0118,
+	0x080c, 0xb6b1, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x00f6,
+	0x00a6, 0x6003, 0x0003, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c,
+	0x7d08, 0x6014, 0x2050, 0xb436, 0xb33a, 0xb646, 0xb54a, 0x00ae,
+	0x00fe, 0x2c10, 0x080c, 0x1a5c, 0x0804, 0x9379, 0x6003, 0x0002,
+	0x6004, 0x9086, 0x0040, 0x11c8, 0x0096, 0x6014, 0x2048, 0xa87c,
+	0xd0ac, 0x0160, 0x601c, 0xd084, 0x1130, 0x00f6, 0x2c00, 0x2078,
+	0x080c, 0x1648, 0x00fe, 0x6003, 0x0004, 0x0010, 0x6003, 0x0002,
+	0x009e, 0x080c, 0x886e, 0x080c, 0x8973, 0x0096, 0x2001, 0x1959,
+	0x2004, 0x6042, 0x080c, 0x8923, 0x080c, 0x8a4e, 0x6114, 0x2148,
+	0xa97c, 0xd1e4, 0x0904, 0xb1e5, 0xd1cc, 0x05a8, 0xa978, 0xa868,
+	0xd0fc, 0x0538, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006, 0xa860,
+	0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x810e, 0x810e, 0x810f,
+	0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080, 0x0019, 0x2098,
+	0x0156, 0x20a9, 0x0020, 0x4003, 0x015e, 0x000e, 0xa882, 0x000e,
+	0xa87e, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c, 0x0f9d, 0x001e,
+	0x0440, 0x0016, 0x080c, 0x0f9d, 0x009e, 0xa974, 0x0016, 0x080c,
+	0xb702, 0x001e, 0x00f0, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff,
+	0x90b6, 0x0002, 0x0180, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c,
+	0x0060, 0xd1dc, 0x0118, 0xa87b, 0x0015, 0x0038, 0xd1d4, 0x0118,
+	0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0x0016, 0x080c, 0x66a7,
+	0x001e, 0xd1e4, 0x1120, 0x080c, 0x9e32, 0x009e, 0x0005, 0x080c,
+	0xbe10, 0x0cd8, 0x6004, 0x9086, 0x0040, 0x1120, 0x080c, 0x886e,
+	0x080c, 0x8973, 0x2019, 0x0001, 0x080c, 0x96d8, 0x6003, 0x0002,
+	0x080c, 0xc22f, 0x080c, 0x8923, 0x080c, 0x8a4e, 0x0005, 0x6004,
+	0x9086, 0x0040, 0x1120, 0x080c, 0x886e, 0x080c, 0x8973, 0x2019,
+	0x0001, 0x080c, 0x96d8, 0x080c, 0x8923, 0x080c, 0x2fda, 0x080c,
+	0xc227, 0x0096, 0x6114, 0x2148, 0x080c, 0xbb17, 0x0150, 0xa867,
+	0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0x080c, 0x688c, 0x080c,
+	0xbd00, 0x009e, 0x080c, 0x9e32, 0x080c, 0x8a4e, 0x0005, 0xa87b,
+	0x0015, 0xd1fc, 0x0180, 0xa87b, 0x0007, 0x8002, 0x8000, 0x810a,
+	0x9189, 0x0000, 0x0006, 0x0016, 0x2009, 0x1a4a, 0x2104, 0x8000,
+	0x200a, 0x001e, 0x000e, 0xa992, 0xa88e, 0x0005, 0x9182, 0x0054,
+	0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xb25a, 0xb25a,
+	0xb25a, 0xb25a, 0xb25a, 0xb25c, 0xb25a, 0xb25a, 0xb302, 0xb25a,
+	0xb25a, 0xb25a, 0xb25a, 0xb25a, 0xb25a, 0xb25a, 0xb25a, 0xb25a,
+	0xb25a, 0xb433, 0x080c, 0x0db4, 0x0076, 0x00a6, 0x00e6, 0x0096,
+	0x2071, 0x0260, 0x6114, 0x2150, 0x7644, 0xb676, 0x96b4, 0x0fff,
+	0xb77c, 0xc7e5, 0xb77e, 0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff,
+	0x0110, 0x8211, 0xba3e, 0x00be, 0x86ff, 0x0904, 0xb2fb, 0x9694,
+	0xff00, 0x9284, 0x0c00, 0x0120, 0x7048, 0xb092, 0x704c, 0xb08e,
+	0x9284, 0x0300, 0x0904, 0xb2fb, 0x9686, 0x0100, 0x1130, 0x7064,
+	0x9005, 0x1118, 0xc6c4, 0xb676, 0x0c38, 0x080c, 0x0feb, 0x090c,
+	0x0db4, 0x2900, 0xb07a, 0xb77c, 0x97bd, 0x0200, 0xb77e, 0xa867,
+	0x0103, 0xb068, 0xa86a, 0xb06c, 0xa86e, 0xb070, 0xa872, 0x7044,
+	0x9084, 0xf000, 0x9635, 0xae76, 0x968c, 0x0c00, 0x0120, 0x7348,
+	0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002, 0x0180,
+	0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118,
+	0xa87b, 0x0015, 0x0038, 0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010,
+	0xa87b, 0x0000, 0xaf7e, 0xb080, 0xa882, 0xb084, 0xa886, 0x901e,
+	0xd6c4, 0x0190, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a, 0x0009,
+	0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018, 0x2011,
+	0x0025, 0x080c, 0xb712, 0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a,
+	0x81ff, 0x01c8, 0x9192, 0x0021, 0x1260, 0x8304, 0x9098, 0x0018,
+	0x2011, 0x0029, 0x080c, 0xb712, 0x2011, 0x0205, 0x2013, 0x0000,
+	0x0050, 0xb068, 0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68,
+	0x2950, 0x080c, 0xb6b1, 0x080c, 0x18eb, 0x009e, 0x00ee, 0x00ae,
+	0x007e, 0x0005, 0x2001, 0x1959, 0x2004, 0x6042, 0x0096, 0x6114,
+	0x2148, 0xa83c, 0xa940, 0x9105, 0x1118, 0xa87c, 0xc0dc, 0xa87e,
+	0x6003, 0x0002, 0xa97c, 0xd1e4, 0x0904, 0xb42e, 0x6043, 0x0000,
+	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1500, 0xd1cc,
+	0x0904, 0xb3fd, 0xa978, 0xa868, 0xd0fc, 0x0904, 0xb3be, 0x0016,
+	0xa87c, 0x0006, 0xa880, 0x0006, 0x00a6, 0x2150, 0xb174, 0x9184,
+	0x00ff, 0x90b6, 0x0002, 0x0904, 0xb38c, 0x9086, 0x0028, 0x1904,
+	0xb378, 0xa87b, 0x001c, 0xb07b, 0x001c, 0x0804, 0xb394, 0x6024,
+	0xd0f4, 0x11d0, 0xa838, 0xaa34, 0x9205, 0x09c8, 0xa838, 0xaa90,
+	0x9206, 0x1120, 0xa88c, 0xaa34, 0x9206, 0x0988, 0x6024, 0xd0d4,
+	0x1148, 0xa9ac, 0xa834, 0x9102, 0x603a, 0xa9b0, 0xa838, 0x9103,
+	0x603e, 0x6024, 0xc0f5, 0x6026, 0x6010, 0x00b6, 0x2058, 0xb83c,
+	0x8000, 0xb83e, 0x00be, 0x9006, 0xa876, 0xa892, 0xa88e, 0xa87c,
+	0xc0e4, 0xa87e, 0xd0cc, 0x0140, 0xc0cc, 0xa87e, 0x0096, 0xa878,
+	0x2048, 0x080c, 0x0f9d, 0x009e, 0x080c, 0xbe4a, 0x0804, 0xb42e,
+	0xd1dc, 0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xc0da,
+	0x0118, 0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b,
+	0x0007, 0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834,
+	0xa938, 0x9115, 0x190c, 0xb227, 0xa87c, 0xb07e, 0xa890, 0xb092,
+	0xa88c, 0xb08e, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0,
+	0x20a9, 0x0020, 0x8a06, 0x8006, 0x8007, 0x9094, 0x003f, 0x22e0,
+	0x9084, 0xffc0, 0x9080, 0x0019, 0x2098, 0x4003, 0x00ae, 0x000e,
+	0xa882, 0x000e, 0xa87e, 0x080c, 0xc1b7, 0x001e, 0xa874, 0x0006,
+	0x2148, 0x080c, 0x0f9d, 0x001e, 0x0804, 0xb42a, 0x0016, 0x00a6,
+	0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086,
+	0x0028, 0x1128, 0xa87b, 0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc,
+	0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xc0da, 0x0118,
 	0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007,
 	0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
-	0x9115, 0x190c, 0xb20e, 0xa87c, 0xb07e, 0xa890, 0xb092, 0xa88c,
-	0xb08e, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x20a9,
-	0x0020, 0x8a06, 0x8006, 0x8007, 0x9094, 0x003f, 0x22e0, 0x9084,
-	0xffc0, 0x9080, 0x0019, 0x2098, 0x4003, 0x00ae, 0x000e, 0xa882,
-	0x000e, 0xa87e, 0x080c, 0xc19e, 0x001e, 0xa874, 0x0006, 0x2148,
-	0x080c, 0x0f9d, 0x001e, 0x0804, 0xb411, 0x0016, 0x00a6, 0x2150,
-	0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086, 0x0028,
-	0x1128, 0xa87b, 0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc, 0x0158,
-	0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xc0c1, 0x0118, 0xb174,
-	0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b,
-	0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115,
-	0x190c, 0xb20e, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c, 0xb07e,
-	0x00ae, 0x080c, 0x0f9d, 0x009e, 0x080c, 0xc19e, 0xa974, 0x0016,
-	0x080c, 0xb6e9, 0x001e, 0x0468, 0xa867, 0x0103, 0xa974, 0x9184,
-	0x00ff, 0x90b6, 0x0002, 0x01b0, 0x9086, 0x0028, 0x1118, 0xa87b,
-	0x001c, 0x00d0, 0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c, 0xc0c1,
-	0x0118, 0xa974, 0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118, 0xa87b,
-	0x0007, 0x0050, 0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834,
-	0xa938, 0x9115, 0x190c, 0xb20e, 0xa974, 0x0016, 0x080c, 0x66a0,
-	0x001e, 0xd1e4, 0x1120, 0x080c, 0x9e19, 0x009e, 0x0005, 0x080c,
-	0xbdf7, 0x0cd8, 0x6114, 0x0096, 0x2148, 0xa97c, 0xd1e4, 0x190c,
-	0x18f9, 0x009e, 0x0005, 0x080c, 0x8846, 0x0010, 0x080c, 0x88fb,
-	0x080c, 0xbafe, 0x01f0, 0x0096, 0x6114, 0x2148, 0x080c, 0xbd04,
-	0x1118, 0x080c, 0xa7a7, 0x00a0, 0xa867, 0x0103, 0x2009, 0x180c,
-	0x210c, 0xd18c, 0x11b8, 0xd184, 0x1190, 0x6108, 0xa97a, 0x918e,
-	0x0029, 0x1110, 0x080c, 0xd7b3, 0xa877, 0x0000, 0x080c, 0x6885,
-	0x009e, 0x080c, 0x9e19, 0x080c, 0x894b, 0x0804, 0x8a26, 0xa87b,
-	0x0004, 0x0c90, 0xa87b, 0x0004, 0x0c78, 0x9182, 0x0054, 0x1220,
-	0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xb471, 0xb471, 0xb471,
-	0xb471, 0xb471, 0xb473, 0xb471, 0xb471, 0xb471, 0xb471, 0xb471,
-	0xb471, 0xb471, 0xb471, 0xb471, 0xb471, 0xb471, 0xb471, 0xb471,
-	0xb471, 0x080c, 0x0db4, 0x080c, 0x5387, 0x01f8, 0x6014, 0x7144,
-	0x918c, 0x0fff, 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294, 0x00ff,
-	0x0096, 0x904d, 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086, 0x0139,
-	0x0128, 0xa867, 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897, 0x4000,
-	0xa99a, 0xaa9e, 0x080c, 0x6885, 0x009e, 0x0804, 0x9e19, 0x9182,
-	0x0085, 0x0002, 0xb4a9, 0xb4a7, 0xb4a7, 0xb4b5, 0xb4a7, 0xb4a7,
-	0xb4a7, 0xb4a7, 0xb4a7, 0xb4a7, 0xb4a7, 0xb4a7, 0xb4a7, 0x080c,
-	0x0db4, 0x6003, 0x0001, 0x6106, 0x080c, 0x83c9, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x894b, 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6,
-	0x00e6, 0x2071, 0x0260, 0x7224, 0x6216, 0x7220, 0x080c, 0xbaec,
-	0x01a0, 0x2268, 0x6800, 0x9086, 0x0000, 0x0178, 0x6010, 0x6d10,
-	0x952e, 0x1158, 0x00c6, 0x2d60, 0x080c, 0xb724, 0x00ce, 0x0128,
-	0x6803, 0x0002, 0x6007, 0x0086, 0x0010, 0x6007, 0x0087, 0x6003,
-	0x0001, 0x080c, 0x83c9, 0x080c, 0x894b, 0x9280, 0x0004, 0x00b6,
-	0x2058, 0xb800, 0x00be, 0xd0bc, 0x0140, 0x6824, 0xd0ec, 0x0128,
-	0x00c6, 0x2260, 0x080c, 0xbe31, 0x00ce, 0x00ee, 0x00de, 0x005e,
-	0x002e, 0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085,
-	0x0a0c, 0x0db4, 0x908a, 0x0092, 0x1a0c, 0x0db4, 0x9082, 0x0085,
-	0x00e2, 0x9186, 0x0027, 0x0120, 0x9186, 0x0014, 0x190c, 0x0db4,
-	0x080c, 0x8846, 0x0096, 0x6014, 0x2048, 0x080c, 0xbafe, 0x0140,
-	0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x6885,
-	0x009e, 0x080c, 0x9e49, 0x0804, 0x894b, 0xb52a, 0xb52c, 0xb52c,
-	0xb52a, 0xb52a, 0xb52a, 0xb52a, 0xb52a, 0xb52a, 0xb52a, 0xb52a,
-	0xb52a, 0xb52a, 0x080c, 0x0db4, 0x080c, 0x8846, 0x080c, 0x9e49,
-	0x080c, 0x894b, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004, 0x9082,
-	0x0085, 0x2008, 0x04b8, 0x9186, 0x0027, 0x11f8, 0x080c, 0x8846,
-	0x080c, 0x2fd7, 0x080c, 0xc20e, 0x0096, 0x6014, 0x2048, 0x080c,
-	0xbafe, 0x0150, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029,
-	0x080c, 0x6885, 0x080c, 0xbce7, 0x009e, 0x080c, 0x9e19, 0x080c,
-	0x894b, 0x0005, 0x080c, 0x9eae, 0x0ce0, 0x9186, 0x0014, 0x1dd0,
-	0x080c, 0x8846, 0x0096, 0x6014, 0x2048, 0x080c, 0xbafe, 0x0d60,
-	0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0006, 0xa880, 0xc0ec,
-	0xa882, 0x08f0, 0x0002, 0xb582, 0xb580, 0xb580, 0xb580, 0xb580,
-	0xb580, 0xb59a, 0xb580, 0xb580, 0xb580, 0xb580, 0xb580, 0xb580,
-	0x080c, 0x0db4, 0x080c, 0x8846, 0x6034, 0x908c, 0xff00, 0x810f,
-	0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x2001, 0x1957,
-	0x0010, 0x2001, 0x1958, 0x2004, 0x601a, 0x6003, 0x000c, 0x080c,
-	0x894b, 0x0005, 0x080c, 0x8846, 0x6034, 0x908c, 0xff00, 0x810f,
-	0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x2001, 0x1957,
-	0x0010, 0x2001, 0x1958, 0x2004, 0x601a, 0x6003, 0x000e, 0x080c,
-	0x894b, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208,
-	0x0012, 0x0804, 0x9eae, 0xb5c8, 0xb5c8, 0xb5c8, 0xb5c8, 0xb5ca,
-	0xb617, 0xb5c8, 0xb5c8, 0xb5c8, 0xb5c8, 0xb5c8, 0xb5c8, 0xb5c8,
-	0x080c, 0x0db4, 0x0096, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-	0xd0bc, 0x0168, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
-	0x0118, 0x9186, 0x0035, 0x1118, 0x009e, 0x0804, 0xb62b, 0x080c,
-	0xbafe, 0x1118, 0x080c, 0xbce7, 0x0068, 0x6014, 0x2048, 0xa87c,
-	0xd0e4, 0x1110, 0x080c, 0xbce7, 0xa867, 0x0103, 0x080c, 0xc1d9,
-	0x080c, 0x6885, 0x00d6, 0x2c68, 0x080c, 0x9dc3, 0x01d0, 0x6003,
-	0x0001, 0x6007, 0x001e, 0x600b, 0xffff, 0x2009, 0x026e, 0x210c,
-	0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x6910, 0x6112, 0x080c,
-	0xbf73, 0x6954, 0x6156, 0x6023, 0x0001, 0x080c, 0x83c9, 0x080c,
-	0x894b, 0x2d60, 0x00de, 0x080c, 0x9e19, 0x009e, 0x0005, 0x6010,
-	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x05a0, 0x6034, 0x908c,
-	0xff00, 0x810f, 0x9186, 0x0035, 0x0130, 0x9186, 0x001e, 0x0118,
-	0x9186, 0x0039, 0x1538, 0x00d6, 0x2c68, 0x080c, 0xc171, 0x11f0,
-	0x080c, 0x9dc3, 0x01d8, 0x6106, 0x6003, 0x0001, 0x6023, 0x0001,
-	0x6910, 0x6112, 0x692c, 0x612e, 0x6930, 0x6132, 0x6934, 0x918c,
-	0x00ff, 0x6136, 0x6938, 0x613a, 0x693c, 0x613e, 0x6954, 0x6156,
-	0x080c, 0xbf73, 0x080c, 0x83c9, 0x080c, 0x894b, 0x2d60, 0x00de,
-	0x0804, 0x9e19, 0x0096, 0x6014, 0x2048, 0x080c, 0xbafe, 0x01c8,
-	0xa867, 0x0103, 0xa880, 0xd0b4, 0x0128, 0xc0ec, 0xa882, 0xa87b,
-	0x0006, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b,
-	0x0005, 0x080c, 0xbdf3, 0xa877, 0x0000, 0x080c, 0x6885, 0x080c,
-	0xbce7, 0x009e, 0x0804, 0x9e19, 0x0016, 0x0096, 0x6014, 0x2048,
-	0x080c, 0xbafe, 0x0140, 0xa867, 0x0103, 0xa87b, 0x0028, 0xa877,
-	0x0000, 0x080c, 0x6885, 0x009e, 0x001e, 0x9186, 0x0013, 0x0148,
-	0x9186, 0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0x9eae,
-	0x0030, 0x080c, 0x8846, 0x080c, 0x9e49, 0x080c, 0x894b, 0x0005,
-	0x0056, 0x0066, 0x0096, 0x00a6, 0x2029, 0x0001, 0x9182, 0x0101,
-	0x1208, 0x0010, 0x2009, 0x0100, 0x2130, 0x8304, 0x9098, 0x0018,
-	0x2009, 0x0020, 0x2011, 0x0029, 0x080c, 0xb6f9, 0x96b2, 0x0020,
-	0xb004, 0x904d, 0x0110, 0x080c, 0x0f9d, 0x080c, 0x0feb, 0x0520,
-	0x8528, 0xa867, 0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a,
-	0x003d, 0x1228, 0x2608, 0x2011, 0x001b, 0x0499, 0x00a8, 0x96b2,
-	0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x0451, 0x0c28,
-	0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003,
-	0xb566, 0x95ac, 0x0000, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000,
-	0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x009e, 0x006e, 0x005e,
-	0x0005, 0x00a6, 0x89ff, 0x0158, 0xa804, 0x9055, 0x0130, 0xa807,
-	0x0000, 0x080c, 0x6885, 0x2a48, 0x0cb8, 0x080c, 0x6885, 0x00ae,
-	0x0005, 0x00f6, 0x2079, 0x0200, 0x7814, 0x9085, 0x0080, 0x7816,
-	0xd184, 0x0108, 0x8108, 0x810c, 0x20a9, 0x0001, 0xa860, 0x20e8,
-	0xa85c, 0x9200, 0x20a0, 0x20e1, 0x0000, 0x2300, 0x9e00, 0x2098,
-	0x4003, 0x8318, 0x9386, 0x0020, 0x1148, 0x2018, 0x2300, 0x9e00,
-	0x2098, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816, 0x8109, 0x1d80,
-	0x7817, 0x0000, 0x00fe, 0x0005, 0x0066, 0x0126, 0x2091, 0x8000,
-	0x2031, 0x0001, 0x6020, 0x9084, 0x000f, 0x0083, 0x012e, 0x006e,
-	0x0005, 0x0126, 0x2091, 0x8000, 0x0066, 0x2031, 0x0000, 0x6020,
-	0x9084, 0x000f, 0x001b, 0x006e, 0x012e, 0x0005, 0xb75f, 0xb75f,
-	0xb75a, 0xb781, 0xb74d, 0xb75a, 0xb781, 0xb75a, 0xb74d, 0xb74d,
-	0xb75a, 0xb75a, 0xb75a, 0xb74d, 0xb74d, 0x080c, 0x0db4, 0x0036,
-	0x2019, 0x0010, 0x080c, 0xd0c7, 0x6023, 0x0006, 0x6003, 0x0007,
-	0x003e, 0x0005, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x0096,
-	0x86ff, 0x11d8, 0x6014, 0x2048, 0x080c, 0xbafe, 0x01c0, 0xa864,
-	0x9086, 0x0139, 0x1128, 0xa87b, 0x0005, 0xa883, 0x0000, 0x0028,
-	0x900e, 0x2001, 0x0005, 0x080c, 0x6abf, 0x080c, 0xbdf3, 0x080c,
-	0x6878, 0x080c, 0x9e49, 0x9085, 0x0001, 0x009e, 0x0005, 0x9006,
-	0x0ce0, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0db4, 0x0002, 0xb797,
-	0xb7c5, 0xb799, 0xb7e6, 0xb7c0, 0xb797, 0xb75a, 0xb75f, 0xb75f,
-	0xb75a, 0xb75a, 0xb75a, 0xb75a, 0xb75a, 0xb75a, 0xb75a, 0x080c,
-	0x0db4, 0x86ff, 0x1510, 0x6020, 0x9086, 0x0006, 0x01f0, 0x0096,
-	0x6014, 0x2048, 0x080c, 0xbafe, 0x0158, 0xa87c, 0xd0cc, 0x0130,
-	0x0096, 0xa878, 0x2048, 0x080c, 0x0f9d, 0x009e, 0x080c, 0xbdf3,
-	0x009e, 0x080c, 0xc1b3, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-	0x0002, 0x080c, 0x83c9, 0x080c, 0x894b, 0x9085, 0x0001, 0x0005,
-	0x0066, 0x080c, 0x190d, 0x006e, 0x08a0, 0x00e6, 0x2071, 0x19b8,
-	0x7024, 0x9c06, 0x1120, 0x080c, 0x9649, 0x00ee, 0x0850, 0x6020,
-	0x9084, 0x000f, 0x9086, 0x0006, 0x1150, 0x0086, 0x0096, 0x2049,
-	0x0001, 0x2c40, 0x080c, 0x97a1, 0x009e, 0x008e, 0x0010, 0x080c,
-	0x9546, 0x00ee, 0x1904, 0xb799, 0x0804, 0xb75a, 0x0036, 0x00e6,
-	0x2071, 0x19b8, 0x703c, 0x9c06, 0x1138, 0x901e, 0x080c, 0x96bf,
-	0x00ee, 0x003e, 0x0804, 0xb799, 0x080c, 0x98d1, 0x00ee, 0x003e,
-	0x1904, 0xb799, 0x0804, 0xb75a, 0x00c6, 0x6020, 0x9084, 0x000f,
-	0x0013, 0x00ce, 0x0005, 0xb819, 0xb8e2, 0xba49, 0xb823, 0x9e49,
-	0xb819, 0xd0b9, 0xc21b, 0xb8e2, 0xb812, 0xbac8, 0xb812, 0xb812,
-	0xb812, 0xb812, 0x080c, 0x0db4, 0x080c, 0xbd04, 0x1110, 0x080c,
-	0xa7a7, 0x0005, 0x080c, 0x8846, 0x080c, 0x894b, 0x0804, 0x9e19,
-	0x601b, 0x0001, 0x0005, 0x080c, 0xbafe, 0x0130, 0x6014, 0x0096,
-	0x2048, 0x2c00, 0xa896, 0x009e, 0x6000, 0x908a, 0x0016, 0x1a0c,
-	0x0db4, 0x0002, 0xb842, 0xb844, 0xb868, 0xb87c, 0xb8a0, 0xb842,
-	0xb819, 0xb819, 0xb819, 0xb87c, 0xb87c, 0xb842, 0xb842, 0xb842,
-	0xb842, 0xb886, 0x080c, 0x0db4, 0x00e6, 0x6014, 0x0096, 0x2048,
-	0xa880, 0xc0b5, 0xa882, 0x009e, 0x2071, 0x19b8, 0x7024, 0x9c06,
-	0x01a0, 0x080c, 0x9546, 0x080c, 0xc1b3, 0x6007, 0x0085, 0x6003,
-	0x000b, 0x6023, 0x0002, 0x2001, 0x1958, 0x2004, 0x601a, 0x080c,
-	0x83c9, 0x080c, 0x894b, 0x00ee, 0x0005, 0x601b, 0x0001, 0x0cd8,
-	0x0096, 0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x080c,
-	0xc1b3, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x080c,
-	0x83c9, 0x080c, 0x894b, 0x0005, 0x0096, 0x601b, 0x0001, 0x6014,
-	0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x0005, 0x080c, 0x5387,
-	0x01a8, 0x6014, 0x0096, 0x904d, 0x0180, 0xa864, 0xa867, 0x0103,
-	0xa87b, 0x0006, 0x9086, 0x0139, 0x1140, 0xa867, 0x0139, 0xa897,
-	0x4005, 0xa89b, 0x0004, 0x080c, 0x6885, 0x009e, 0x0804, 0x9e19,
-	0x6014, 0x0096, 0x904d, 0x05c8, 0xa97c, 0xd1e4, 0x05b0, 0x2001,
-	0x180f, 0x2004, 0xd0c4, 0x0110, 0x009e, 0x0005, 0xa884, 0x009e,
-	0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0x2001, 0x0030, 0x2c08,
-	0x080c, 0x1518, 0x2001, 0x030c, 0x2004, 0x9086, 0x0041, 0x11a0,
-	0x6014, 0x0096, 0x904d, 0x090c, 0x0db4, 0xa880, 0xd0f4, 0x1130,
-	0xc0f5, 0xa882, 0x009e, 0x601b, 0x0002, 0x0070, 0x009e, 0x2001,
-	0x0037, 0x2c08, 0x080c, 0x1518, 0x6000, 0x9086, 0x0004, 0x1120,
-	0x2009, 0x0048, 0x080c, 0x9e93, 0x0005, 0x009e, 0x080c, 0x190d,
-	0x0804, 0xb868, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0db4, 0x000b,
-	0x0005, 0xb8f9, 0xb820, 0xb8fb, 0xb8f9, 0xb8fb, 0xb8fb, 0xb81a,
-	0xb8f9, 0xb814, 0xb814, 0xb8f9, 0xb8f9, 0xb8f9, 0xb8f9, 0xb8f9,
-	0xb8f9, 0x080c, 0x0db4, 0x6010, 0x00b6, 0x2058, 0xb804, 0x9084,
-	0x00ff, 0x00be, 0x908a, 0x000c, 0x1a0c, 0x0db4, 0x00b6, 0x0013,
-	0x00be, 0x0005, 0xb916, 0xb9e3, 0xb918, 0xb958, 0xb918, 0xb958,
-	0xb918, 0xb926, 0xb916, 0xb958, 0xb916, 0xb947, 0x080c, 0x0db4,
-	0x6004, 0x908e, 0x0016, 0x05c0, 0x908e, 0x0004, 0x05a8, 0x908e,
-	0x0002, 0x0590, 0x908e, 0x0052, 0x0904, 0xb9df, 0x6004, 0x080c,
-	0xbd04, 0x0904, 0xb9fc, 0x908e, 0x0004, 0x1110, 0x080c, 0x2ffc,
-	0x908e, 0x0021, 0x0904, 0xba00, 0x908e, 0x0022, 0x0904, 0xba44,
-	0x908e, 0x003d, 0x0904, 0xba00, 0x908e, 0x0039, 0x0904, 0xba04,
-	0x908e, 0x0035, 0x0904, 0xba04, 0x908e, 0x001e, 0x0178, 0x908e,
-	0x0001, 0x1140, 0x6010, 0x2058, 0xb804, 0x9084, 0x00ff, 0x9086,
-	0x0006, 0x0110, 0x080c, 0x2fd7, 0x080c, 0xa7a7, 0x0804, 0x9e49,
-	0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0904, 0xb9d0, 0x9186,
-	0x0002, 0x1904, 0xb9a5, 0x2001, 0x1836, 0x2004, 0xd08c, 0x11c8,
-	0x080c, 0x6fa7, 0x11b0, 0x080c, 0xc1f9, 0x0138, 0x080c, 0x6fca,
-	0x1120, 0x080c, 0x6eb7, 0x0804, 0xba2d, 0x2001, 0x194e, 0x2003,
-	0x0001, 0x2001, 0x1800, 0x2003, 0x0001, 0x080c, 0x6ed9, 0x0804,
-	0xba2d, 0x6010, 0x2058, 0x2001, 0x1836, 0x2004, 0xd0ac, 0x1904,
-	0xba2d, 0xb8a0, 0x9084, 0xff80, 0x1904, 0xba2d, 0xb840, 0x9084,
-	0x00ff, 0x9005, 0x0190, 0x8001, 0xb842, 0x6017, 0x0000, 0x6023,
-	0x0007, 0x601b, 0x0398, 0x6043, 0x0000, 0x080c, 0x9dc3, 0x0128,
-	0x2b00, 0x6012, 0x6023, 0x0001, 0x0458, 0x00de, 0x00ce, 0x6004,
-	0x908e, 0x0002, 0x11a0, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e,
-	0x1170, 0x2009, 0x1836, 0x2104, 0xc085, 0x200a, 0x00e6, 0x2071,
-	0x1800, 0x080c, 0x5c5d, 0x00ee, 0x080c, 0xa7a7, 0x0030, 0x080c,
-	0xa7a7, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x00e6, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x2ffc, 0x012e, 0x00ee, 0x080c, 0x9e49, 0x0005,
-	0x2001, 0x0002, 0x080c, 0x6188, 0x6003, 0x0001, 0x6007, 0x0002,
-	0x080c, 0x8411, 0x080c, 0x894b, 0x00de, 0x00ce, 0x0c80, 0x080c,
-	0x2ffc, 0x0804, 0xb954, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016,
-	0x0d38, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0904,
-	0xb9a5, 0x8001, 0xb842, 0x6003, 0x0001, 0x080c, 0x8411, 0x080c,
-	0x894b, 0x00de, 0x00ce, 0x0898, 0x080c, 0xa7a7, 0x0804, 0xb956,
-	0x080c, 0xa7e3, 0x0804, 0xb956, 0x00d6, 0x2c68, 0x6104, 0x080c,
-	0xc171, 0x00de, 0x0118, 0x080c, 0x9e19, 0x00f0, 0x6004, 0x8007,
-	0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003,
-	0x000b, 0x6023, 0x0002, 0x603c, 0x600a, 0x2001, 0x1958, 0x2004,
-	0x601a, 0x602c, 0x2c08, 0x2060, 0x6024, 0xc0b5, 0x6026, 0x2160,
-	0x080c, 0x83c9, 0x080c, 0x894b, 0x0005, 0x00de, 0x00ce, 0x080c,
-	0xa7a7, 0x080c, 0x2fd7, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x2ffc, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398, 0x6043,
-	0x0000, 0x012e, 0x00ee, 0x0005, 0x080c, 0xa248, 0x1904, 0xb9fc,
-	0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0db4, 0x0096, 0x00d6,
-	0x001b, 0x00de, 0x009e, 0x0005, 0xba64, 0xba64, 0xba64, 0xba64,
-	0xba64, 0xba64, 0xba64, 0xba64, 0xba64, 0xb819, 0xba64, 0xb820,
-	0xba66, 0xb820, 0xba73, 0xba64, 0x080c, 0x0db4, 0x6004, 0x9086,
-	0x008b, 0x0148, 0x6007, 0x008b, 0x6003, 0x000d, 0x080c, 0x83c9,
-	0x080c, 0x894b, 0x0005, 0x080c, 0xc1ed, 0x0118, 0x080c, 0xc200,
-	0x0010, 0x080c, 0xc20e, 0x080c, 0xbce7, 0x080c, 0xbafe, 0x0570,
-	0x080c, 0x2fd7, 0x080c, 0xbafe, 0x0168, 0x6014, 0x2048, 0xa867,
-	0x0103, 0xa87b, 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ed, 0xa882,
-	0x080c, 0x6885, 0x2c68, 0x080c, 0x9dc3, 0x0150, 0x6810, 0x6012,
-	0x080c, 0xbf73, 0x00c6, 0x2d60, 0x080c, 0x9e49, 0x00ce, 0x0008,
-	0x2d60, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003,
-	0x0001, 0x080c, 0x8411, 0x080c, 0x894b, 0x00c8, 0x080c, 0xc1ed,
-	0x0138, 0x6034, 0x9086, 0x4000, 0x1118, 0x080c, 0x2fd7, 0x08d0,
-	0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186,
-	0x0035, 0x1118, 0x080c, 0x2fd7, 0x0868, 0x080c, 0x9e49, 0x0005,
-	0x6000, 0x908a, 0x0016, 0x1a0c, 0x0db4, 0x0002, 0xbade, 0xbade,
-	0xbae0, 0xbae0, 0xbae0, 0xbade, 0xbade, 0x9e49, 0xbade, 0xbade,
-	0xbade, 0xbade, 0xbade, 0xbade, 0xbade, 0xbade, 0x080c, 0x0db4,
-	0x080c, 0x98d1, 0x6114, 0x0096, 0x2148, 0xa87b, 0x0006, 0x080c,
-	0x6885, 0x009e, 0x0804, 0x9e19, 0x9284, 0x0007, 0x1158, 0x9282,
-	0x1cd0, 0x0240, 0x2001, 0x1819, 0x2004, 0x9202, 0x1218, 0x9085,
-	0x0001, 0x0005, 0x9006, 0x0ce8, 0x0096, 0x0028, 0x0096, 0x0006,
-	0x6014, 0x2048, 0x000e, 0x0006, 0x9984, 0xf000, 0x9086, 0xf000,
-	0x0110, 0x080c, 0x1096, 0x000e, 0x009e, 0x0005, 0x00e6, 0x00c6,
-	0x0036, 0x0006, 0x0126, 0x2091, 0x8000, 0x2061, 0x1cd0, 0x2071,
-	0x1800, 0x7350, 0x7070, 0x9302, 0x1640, 0x6020, 0x9206, 0x11f8,
-	0x080c, 0xc1f9, 0x0180, 0x9286, 0x0001, 0x1168, 0x6004, 0x9086,
-	0x0004, 0x1148, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x00c6, 0x080c,
-	0x9e49, 0x00ce, 0x0060, 0x080c, 0xbeed, 0x0148, 0x080c, 0xbd04,
-	0x1110, 0x080c, 0xa7a7, 0x00c6, 0x080c, 0x9e19, 0x00ce, 0x9ce0,
-	0x0018, 0x7064, 0x9c02, 0x1208, 0x08a0, 0x012e, 0x000e, 0x003e,
-	0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0016, 0x9188, 0x1000,
-	0x210c, 0x81ff, 0x0128, 0x2061, 0x1a80, 0x6112, 0x080c, 0x2fd7,
-	0x9006, 0x0010, 0x9085, 0x0001, 0x001e, 0x00ce, 0x00ee, 0x0005,
-	0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9dc3, 0x01b0, 0x6656,
-	0x2b00, 0x6012, 0x080c, 0x5387, 0x0118, 0x080c, 0xbc2b, 0x0168,
-	0x080c, 0xbf73, 0x6023, 0x0003, 0x2009, 0x004b, 0x080c, 0x9e93,
-	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6,
-	0x0126, 0x2091, 0x8000, 0xbaa0, 0x080c, 0x9e66, 0x0560, 0x6057,
-	0x0000, 0x2b00, 0x6012, 0x080c, 0xbf73, 0x6023, 0x0003, 0x0016,
-	0x080c, 0x8549, 0x0076, 0x903e, 0x080c, 0x8441, 0x2c08, 0x080c,
-	0xd27b, 0x007e, 0x001e, 0xd184, 0x0128, 0x080c, 0x9e19, 0x9085,
-	0x0001, 0x0070, 0x080c, 0x5387, 0x0128, 0xd18c, 0x1170, 0x080c,
-	0xbc2b, 0x0148, 0x2009, 0x004c, 0x080c, 0x9e93, 0x9085, 0x0001,
-	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2900, 0x6016, 0x0c90,
-	0x2009, 0x004d, 0x0010, 0x2009, 0x004e, 0x00f6, 0x00c6, 0x0046,
-	0x0016, 0x080c, 0x9dc3, 0x2c78, 0x0590, 0x7e56, 0x2b00, 0x7812,
-	0x7823, 0x0003, 0x2021, 0x0005, 0x080c, 0xbc3d, 0x9186, 0x004d,
-	0x0118, 0x9186, 0x004e, 0x0148, 0x2001, 0x1951, 0x200c, 0xd1fc,
-	0x0168, 0x2f60, 0x080c, 0x9e19, 0x00d0, 0x2001, 0x1950, 0x200c,
-	0xd1fc, 0x0120, 0x2f60, 0x080c, 0x9e19, 0x0088, 0x2f60, 0x080c,
-	0x5387, 0x0138, 0xd18c, 0x1118, 0x04f1, 0x0148, 0x0010, 0x2900,
-	0x7816, 0x001e, 0x0016, 0x080c, 0x9e93, 0x9085, 0x0001, 0x001e,
-	0x004e, 0x00ce, 0x00fe, 0x0005, 0x00f6, 0x00c6, 0x0046, 0x080c,
-	0x9dc3, 0x2c78, 0x0508, 0x7e56, 0x2b00, 0x7812, 0x7823, 0x0003,
-	0x0096, 0x2021, 0x0004, 0x0489, 0x009e, 0x2001, 0x194f, 0x200c,
-	0xd1fc, 0x0120, 0x2f60, 0x080c, 0x9e19, 0x0060, 0x2f60, 0x080c,
-	0x5387, 0x0120, 0xd18c, 0x1160, 0x0071, 0x0130, 0x2009, 0x0052,
-	0x080c, 0x9e93, 0x9085, 0x0001, 0x004e, 0x00ce, 0x00fe, 0x0005,
-	0x2900, 0x7816, 0x0c98, 0x00c6, 0x080c, 0x4872, 0x00ce, 0x1120,
-	0x080c, 0x9e19, 0x9006, 0x0005, 0xa867, 0x0000, 0xa86b, 0x8000,
-	0x2900, 0x6016, 0x9085, 0x0001, 0x0005, 0x0096, 0x0076, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x636b, 0x0158, 0x2001, 0xbc42, 0x0006,
-	0x900e, 0x2400, 0x080c, 0x6abf, 0x080c, 0x6885, 0x000e, 0x0807,
-	0x2418, 0x080c, 0x87e0, 0xbaa0, 0x0086, 0x2041, 0x0001, 0x2039,
-	0x0001, 0x2608, 0x080c, 0x8561, 0x008e, 0x080c, 0x8441, 0x2f08,
-	0x2648, 0x080c, 0xd27b, 0xb93c, 0x81ff, 0x090c, 0x8632, 0x080c,
-	0x894b, 0x012e, 0x007e, 0x009e, 0x0005, 0x00c6, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x9dc3, 0x0190, 0x660a, 0x2b08, 0x6112, 0x080c,
-	0xbf73, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x001f, 0x080c,
-	0x9e93, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
-	0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9e66, 0x01b8, 0x660a,
-	0x2b08, 0x6112, 0x080c, 0xbf73, 0x6023, 0x0008, 0x2900, 0x6016,
-	0x00f6, 0x2c78, 0x080c, 0x1648, 0x00fe, 0x2009, 0x0021, 0x080c,
-	0x9e93, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
-	0x2009, 0x003d, 0x00c6, 0x0126, 0x0016, 0x2091, 0x8000, 0x080c,
-	0x9dc3, 0x0198, 0x660a, 0x2b08, 0x6112, 0x080c, 0xbf73, 0x6023,
-	0x0001, 0x2900, 0x6016, 0x001e, 0x0016, 0x080c, 0x9e93, 0x9085,
-	0x0001, 0x001e, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd0, 0x00c6,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x9e66, 0x0188, 0x2b08, 0x6112,
-	0x080c, 0xbf73, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x0000,
-	0x080c, 0x9e93, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
-	0x0cd8, 0x2009, 0x0044, 0x0830, 0x2009, 0x0049, 0x0818, 0x0026,
-	0x00b6, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e,
-	0x00be, 0x002e, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e, 0x0002,
-	0x0140, 0x908e, 0x0003, 0x0128, 0x908e, 0x0004, 0x0110, 0x9085,
-	0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0096, 0x6020, 0x9086,
-	0x0004, 0x0190, 0x6014, 0x904d, 0x080c, 0xbafe, 0x0168, 0xa864,
-	0x9086, 0x0139, 0x0158, 0x6020, 0x9086, 0x0003, 0x0128, 0xa868,
-	0xd0fc, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x009e, 0x000e,
-	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9e66, 0x0198,
-	0x2b08, 0x6112, 0x080c, 0xbf73, 0x6023, 0x0001, 0x2900, 0x6016,
-	0x080c, 0x2fd7, 0x2009, 0x0028, 0x080c, 0x9e93, 0x9085, 0x0001,
-	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x9186, 0x0015, 0x11a8,
-	0x2011, 0x1823, 0x2204, 0x9086, 0x0074, 0x1178, 0x00b6, 0x080c,
-	0xaa30, 0x00be, 0x080c, 0xac6f, 0x6003, 0x0001, 0x6007, 0x0029,
-	0x080c, 0x8411, 0x080c, 0x894b, 0x0078, 0x6014, 0x0096, 0x2048,
-	0xa868, 0x009e, 0xd0fc, 0x0148, 0x2001, 0x0001, 0x080c, 0xc132,
-	0x080c, 0xa7a7, 0x080c, 0x9e19, 0x0005, 0x0096, 0x6014, 0x904d,
-	0x090c, 0x0db4, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005,
-	0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6885, 0x012e, 0x009e, 0x080c, 0x9e19, 0x0c30, 0x0096, 0x9186,
-	0x0016, 0x1128, 0x2001, 0x0004, 0x080c, 0x6188, 0x00e8, 0x9186,
-	0x0015, 0x1510, 0x2011, 0x1823, 0x2204, 0x9086, 0x0014, 0x11e0,
-	0x6010, 0x00b6, 0x2058, 0x080c, 0x62d2, 0x00be, 0x080c, 0xad40,
-	0x1198, 0x6010, 0x00b6, 0x2058, 0xb890, 0x00be, 0x9005, 0x0160,
-	0x2001, 0x0006, 0x080c, 0x6188, 0x6014, 0x2048, 0xa868, 0xd0fc,
-	0x0170, 0x080c, 0xa21c, 0x0048, 0x6014, 0x2048, 0xa868, 0xd0fc,
-	0x0528, 0x080c, 0xa7a7, 0x080c, 0x9e19, 0x009e, 0x0005, 0x6014,
-	0x6310, 0x2358, 0x904d, 0x090c, 0x0db4, 0xa87b, 0x0000, 0xa883,
-	0x0000, 0xa897, 0x4000, 0x900e, 0x080c, 0x6457, 0x1108, 0xc185,
-	0xb800, 0xd0bc, 0x0108, 0xc18d, 0xa99a, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x6885, 0x012e, 0x080c, 0x9e19, 0x08f8, 0x6014, 0x904d,
-	0x090c, 0x0db4, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005,
-	0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x6885, 0x012e, 0x080c, 0x9e19, 0x0840, 0xa878, 0x9086, 0x0005,
-	0x1108, 0x0009, 0x0005, 0xa880, 0xc0ad, 0xa882, 0x0005, 0x6043,
-	0x0000, 0x6017, 0x0000, 0x6003, 0x0001, 0x6007, 0x0050, 0x080c,
-	0x83c9, 0x080c, 0x894b, 0x0005, 0x00c6, 0x6010, 0x00b6, 0x2058,
-	0xb800, 0x00be, 0xd0bc, 0x0120, 0x6020, 0x9084, 0x000f, 0x0013,
-	0x00ce, 0x0005, 0xb819, 0xbe23, 0xbe23, 0xbe26, 0xd559, 0xd574,
-	0xd577, 0xb819, 0xb819, 0xb819, 0xb819, 0xb819, 0xb819, 0xb819,
-	0xb819, 0x080c, 0x0db4, 0xa001, 0xa001, 0x0005, 0x0096, 0x6014,
-	0x904d, 0x0118, 0xa87c, 0xd0e4, 0x1110, 0x009e, 0x0010, 0x009e,
-	0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0550,
-	0x2001, 0x1833, 0x2004, 0x9005, 0x1540, 0x00f6, 0x2c78, 0x080c,
-	0x9dc3, 0x0508, 0x7810, 0x6012, 0x080c, 0xbf73, 0x7820, 0x9086,
-	0x0003, 0x0128, 0x7808, 0x603a, 0x2f00, 0x603e, 0x0020, 0x7808,
-	0x603e, 0x2f00, 0x603a, 0x602e, 0x6023, 0x0001, 0x6007, 0x0035,
-	0x6003, 0x0001, 0x7954, 0x6156, 0x080c, 0x83c9, 0x080c, 0x894b,
-	0x2f60, 0x00fe, 0x0005, 0x2f60, 0x00fe, 0x2001, 0x1959, 0x2004,
-	0x6042, 0x0005, 0x0016, 0x0096, 0x6814, 0x2048, 0xa87c, 0xd0e4,
-	0x0180, 0xc0e4, 0xa87e, 0xa877, 0x0000, 0xa893, 0x0000, 0xa88f,
-	0x0000, 0xd0cc, 0x0130, 0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c,
-	0x0f9d, 0x6830, 0x6036, 0x908e, 0x0001, 0x0148, 0x6803, 0x0002,
-	0x9086, 0x0005, 0x0170, 0x9006, 0x602e, 0x6032, 0x00d0, 0x681c,
-	0xc085, 0x681e, 0x6803, 0x0004, 0x6824, 0xc0f4, 0x9085, 0x0c00,
-	0x6826, 0x6814, 0x2048, 0xa8ac, 0x6938, 0x9102, 0xa8b0, 0x693c,
-	0x9103, 0x1e48, 0x683c, 0x602e, 0x6838, 0x9084, 0xfffc, 0x683a,
-	0x6032, 0x2d00, 0x603a, 0x6808, 0x603e, 0x6910, 0x6112, 0x6954,
-	0x6156, 0x6023, 0x0001, 0x6007, 0x0039, 0x6003, 0x0001, 0x080c,
-	0x83c9, 0x080c, 0x894b, 0x009e, 0x001e, 0x0005, 0x6024, 0xd0d4,
-	0x0510, 0xd0f4, 0x11f8, 0x6038, 0x940a, 0x603c, 0x9303, 0x0230,
-	0x9105, 0x0120, 0x6024, 0xc0d4, 0xc0f5, 0x0098, 0x643a, 0x633e,
-	0xac3e, 0xab42, 0x0046, 0x0036, 0x2400, 0xacac, 0x9402, 0xa836,
-	0x2300, 0xabb0, 0x9303, 0xa83a, 0x003e, 0x004e, 0x6024, 0xc0d4,
-	0x0000, 0x6026, 0x0005, 0xd0f4, 0x1138, 0xa83c, 0x603a, 0xa840,
-	0x603e, 0x6024, 0xc0f5, 0x6026, 0x0005, 0x0006, 0x0016, 0x6004,
-	0x908e, 0x0034, 0x01b8, 0x908e, 0x0035, 0x01a0, 0x908e, 0x0036,
-	0x0188, 0x908e, 0x0037, 0x0170, 0x908e, 0x0038, 0x0158, 0x908e,
-	0x0039, 0x0140, 0x908e, 0x003a, 0x0128, 0x908e, 0x003b, 0x0110,
-	0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026,
-	0x0036, 0x00e6, 0x2001, 0x1953, 0x200c, 0x8000, 0x2014, 0x2001,
-	0x0032, 0x080c, 0x8248, 0x2001, 0x1957, 0x82ff, 0x1110, 0x2011,
-	0x0014, 0x2202, 0x2001, 0x1955, 0x200c, 0x8000, 0x2014, 0x2071,
-	0x193d, 0x711a, 0x721e, 0x2001, 0x0064, 0x080c, 0x8248, 0x2001,
-	0x1958, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001, 0x1959,
-	0x9288, 0x000a, 0x2102, 0x2001, 0x1a61, 0x2102, 0x2001, 0x0032,
-	0x080c, 0x1518, 0x080c, 0x653c, 0x00ee, 0x003e, 0x002e, 0x001e,
-	0x000e, 0x0005, 0x0006, 0x0016, 0x00e6, 0x2001, 0x1957, 0x2003,
-	0x0028, 0x2001, 0x1958, 0x2003, 0x0014, 0x2071, 0x193d, 0x701b,
-	0x0000, 0x701f, 0x07d0, 0x2001, 0x1959, 0x2009, 0x001e, 0x2102,
-	0x2001, 0x1a61, 0x2102, 0x2001, 0x0032, 0x080c, 0x1518, 0x00ee,
-	0x001e, 0x000e, 0x0005, 0x0096, 0x6058, 0x904d, 0x0110, 0x080c,
-	0x101d, 0x009e, 0x0005, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x9dc3, 0x0180, 0x2b08, 0x6112, 0x0ca9, 0x6023, 0x0001,
-	0x2900, 0x6016, 0x2009, 0x0033, 0x080c, 0x9e93, 0x9085, 0x0001,
-	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x00e6, 0x00f6,
-	0x2071, 0x1800, 0x9186, 0x0015, 0x1500, 0x708c, 0x9086, 0x0018,
-	0x11e0, 0x6014, 0x2048, 0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c,
-	0x8b3b, 0x01d8, 0x7078, 0xaa50, 0x9206, 0x1160, 0x707c, 0xaa54,
-	0x9206, 0x1140, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e,
-	0x080c, 0x301c, 0x080c, 0xa21c, 0x0020, 0x080c, 0xa7a7, 0x080c,
-	0x9e19, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c, 0xaa54, 0x9206,
-	0x0d48, 0x0c80, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9dc3,
-	0x0188, 0x2b08, 0x6112, 0x080c, 0xbf73, 0x6023, 0x0001, 0x2900,
-	0x6016, 0x2009, 0x004d, 0x080c, 0x9e93, 0x9085, 0x0001, 0x012e,
-	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x0016, 0x080c, 0x9dc3, 0x0180, 0x2b08, 0x6112, 0x080c, 0xbf73,
-	0x6023, 0x0001, 0x2900, 0x6016, 0x001e, 0x080c, 0x9e93, 0x9085,
-	0x0001, 0x012e, 0x00ce, 0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016,
-	0x0026, 0x0036, 0x0046, 0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6,
-	0x2071, 0x1800, 0x9186, 0x0015, 0x1568, 0x718c, 0x6014, 0x2048,
-	0xa814, 0x8003, 0x9106, 0x1530, 0x20e1, 0x0000, 0x2001, 0x1971,
-	0x2003, 0x0000, 0x6014, 0x2048, 0xa830, 0x20a8, 0x8906, 0x8006,
-	0x8007, 0x9094, 0x003f, 0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b,
-	0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x080c, 0xc7b4, 0x001e,
-	0xa804, 0x9005, 0x0110, 0x2048, 0x0c38, 0x6014, 0x2048, 0xa867,
-	0x0103, 0x0010, 0x080c, 0xa7a7, 0x080c, 0x9e19, 0x00fe, 0x00ee,
-	0x009e, 0x006e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005,
-	0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x11b8,
-	0x708c, 0x9086, 0x0004, 0x1198, 0x6014, 0x2048, 0x2c78, 0x080c,
-	0x8b3b, 0x01a8, 0x7078, 0xaa74, 0x9206, 0x1130, 0x707c, 0xaa78,
-	0x9206, 0x1110, 0x080c, 0x2fd7, 0x080c, 0xa21c, 0x0020, 0x080c,
-	0xa7a7, 0x080c, 0x9e19, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c,
-	0xaa78, 0x9206, 0x0d78, 0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071,
-	0x1800, 0x9186, 0x0015, 0x1550, 0x708c, 0x9086, 0x0004, 0x1530,
-	0x6014, 0x2048, 0x2c78, 0x080c, 0x8b3b, 0x05f0, 0x7078, 0xaacc,
-	0x9206, 0x1180, 0x707c, 0xaad0, 0x9206, 0x1160, 0x080c, 0x2fd7,
-	0x0016, 0xa998, 0xaab0, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5337,
-	0x001e, 0x0010, 0x080c, 0x5128, 0x080c, 0xbafe, 0x0508, 0xa87b,
-	0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0080, 0x080c, 0xbafe,
-	0x01b8, 0x6014, 0x2048, 0x080c, 0x5128, 0x1d70, 0xa87b, 0x0030,
-	0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0x0126, 0x2091,
-	0x8000, 0xa867, 0x0139, 0x080c, 0x6885, 0x012e, 0x080c, 0x9e19,
-	0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c, 0xaad0, 0x9206, 0x0930,
-	0x0888, 0x0016, 0x0026, 0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34,
-	0x2100, 0x9205, 0x0150, 0xa890, 0x9106, 0x1118, 0xa88c, 0x9206,
-	0x0120, 0xa992, 0xaa8e, 0x9085, 0x0001, 0x002e, 0x001e, 0x0005,
-	0x00b6, 0x00d6, 0x0036, 0x080c, 0xbafe, 0x0904, 0xc12e, 0x0096,
-	0x6314, 0x2348, 0xa87a, 0xa982, 0x929e, 0x4000, 0x1580, 0x6310,
-	0x00c6, 0x2358, 0x2009, 0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c,
-	0x6457, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96,
-	0xa99a, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031,
-	0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098, 0x080c,
-	0x0f68, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8b8,
-	0x9080, 0x000a, 0x2098, 0x080c, 0x0f68, 0x00ce, 0x0090, 0xaa96,
-	0x3918, 0x9398, 0x0007, 0x231c, 0x6004, 0x9086, 0x0016, 0x0110,
-	0xa89b, 0x0004, 0xaba2, 0x6310, 0x2358, 0xb804, 0x9084, 0x00ff,
-	0xa89e, 0x080c, 0x6878, 0x6017, 0x0000, 0x009e, 0x003e, 0x00de,
-	0x00be, 0x0005, 0x0026, 0x0036, 0x0046, 0x00b6, 0x0096, 0x00f6,
-	0x6214, 0x2248, 0x6210, 0x2258, 0x2079, 0x0260, 0x9096, 0x0000,
-	0x11a0, 0xb814, 0x9084, 0x00ff, 0x900e, 0x080c, 0x2663, 0x2118,
-	0x831f, 0x939c, 0xff00, 0x7838, 0x9084, 0x00ff, 0x931d, 0x7c3c,
-	0x2011, 0x8018, 0x080c, 0x48d2, 0x00a8, 0x9096, 0x0001, 0x1148,
-	0x89ff, 0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa,
-	0x0048, 0x9096, 0x0002, 0x1130, 0xa89b, 0x000d, 0x7838, 0xa8a6,
-	0x783c, 0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e, 0x003e, 0x002e,
-	0x0005, 0x00c6, 0x0026, 0x0016, 0x9186, 0x0035, 0x0110, 0x6a38,
-	0x0008, 0x6a2c, 0x080c, 0xbaec, 0x01f0, 0x2260, 0x6120, 0x9186,
-	0x0003, 0x0118, 0x9186, 0x0006, 0x1190, 0x6838, 0x9206, 0x0140,
-	0x683c, 0x9206, 0x1160, 0x6108, 0x6838, 0x9106, 0x1140, 0x0020,
-	0x6008, 0x693c, 0x9106, 0x1118, 0x6010, 0x6910, 0x9106, 0x001e,
-	0x002e, 0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8, 0xa974, 0xd1cc,
-	0x0188, 0x918c, 0x00ff, 0x918e, 0x0002, 0x1160, 0xa9a8, 0x918c,
-	0x0f00, 0x810f, 0x918e, 0x0001, 0x1128, 0xa834, 0xa938, 0x9115,
-	0x190c, 0xb20e, 0x0005, 0x0036, 0x2019, 0x0001, 0x0010, 0x0036,
-	0x901e, 0x0499, 0x01e0, 0x080c, 0xbafe, 0x01c8, 0x080c, 0xbce7,
-	0x6037, 0x4000, 0x6014, 0x6017, 0x0000, 0x0096, 0x2048, 0xa87c,
-	0x080c, 0xbd04, 0x1118, 0x080c, 0xa7a7, 0x0040, 0xa867, 0x0103,
-	0xa877, 0x0000, 0x83ff, 0x1129, 0x080c, 0x6885, 0x009e, 0x003e,
-	0x0005, 0xa880, 0xd0b4, 0x0128, 0xa87b, 0x0006, 0xc0ec, 0xa882,
-	0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005,
-	0x080c, 0xbdf3, 0xa877, 0x0000, 0x0005, 0x2001, 0x1810, 0x2004,
-	0xd0ec, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0f4, 0x000e,
-	0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0e4, 0x000e, 0x0005,
-	0x0036, 0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021,
-	0x0007, 0x080c, 0x4a6f, 0x004e, 0x003e, 0x0005, 0x0c51, 0x1d81,
-	0x0005, 0x2001, 0x1957, 0x2004, 0x601a, 0x0005, 0x2001, 0x1959,
-	0x2004, 0x6042, 0x0005, 0x080c, 0x9e19, 0x0804, 0x894b, 0x00b6,
-	0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0db4, 0x001b, 0x006e,
-	0x00be, 0x0005, 0xc23a, 0xc911, 0xca6c, 0xc23a, 0xc23a, 0xc23a,
-	0xc23a, 0xc23a, 0xc271, 0xcaea, 0xc23a, 0xc23a, 0xc23a, 0xc23a,
-	0xc23a, 0xc23a, 0x080c, 0x0db4, 0x0066, 0x6000, 0x90b2, 0x0016,
-	0x1a0c, 0x0db4, 0x0013, 0x006e, 0x0005, 0xc255, 0xd052, 0xc255,
-	0xc255, 0xc255, 0xc255, 0xc255, 0xc255, 0xcfff, 0xd0a6, 0xc255,
-	0xd694, 0xd6ca, 0xd694, 0xd6ca, 0xc255, 0x080c, 0x0db4, 0x6000,
-	0x9082, 0x0016, 0x1a0c, 0x0db4, 0x6000, 0x000a, 0x0005, 0xc26f,
-	0xccc7, 0xcdb7, 0xcdd9, 0xce98, 0xc26f, 0xcf76, 0xcf20, 0xcaf6,
-	0xcfd5, 0xcfea, 0xc26f, 0xc26f, 0xc26f, 0xc26f, 0xc26f, 0x080c,
-	0x0db4, 0x91b2, 0x0053, 0x1a0c, 0x0db4, 0x2100, 0x91b2, 0x0040,
-	0x1a04, 0xc6b2, 0x0002, 0xc2bb, 0xc4a3, 0xc2bb, 0xc2bb, 0xc2bb,
-	0xc4ac, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb,
-	0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb,
-	0xc2bb, 0xc2bb, 0xc2bd, 0xc320, 0xc32f, 0xc393, 0xc3be, 0xc436,
-	0xc48e, 0xc2bb, 0xc2bb, 0xc4af, 0xc2bb, 0xc2bb, 0xc4c4, 0xc4d1,
-	0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb, 0xc554, 0xc2bb, 0xc2bb,
-	0xc568, 0xc2bb, 0xc2bb, 0xc523, 0xc2bb, 0xc2bb, 0xc2bb, 0xc580,
-	0xc2bb, 0xc2bb, 0xc2bb, 0xc5fd, 0xc2bb, 0xc2bb, 0xc2bb, 0xc2bb,
-	0xc2bb, 0xc2bb, 0xc67a, 0x080c, 0x0db4, 0x080c, 0x6519, 0x1150,
-	0x2001, 0x1836, 0x2004, 0xd0cc, 0x1128, 0x9084, 0x0009, 0x9086,
-	0x0008, 0x1140, 0x6007, 0x0009, 0x602f, 0x0009, 0x6017, 0x0000,
-	0x0804, 0xc49c, 0x080c, 0x6502, 0x00e6, 0x00c6, 0x0036, 0x0026,
-	0x0016, 0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c,
-	0x8549, 0x0076, 0x903e, 0x080c, 0x8441, 0x2c08, 0x080c, 0xd27b,
-	0x007e, 0x001e, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee, 0x6610,
-	0x2658, 0x080c, 0x6246, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006,
-	0x1268, 0x0016, 0x0026, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be,
-	0x2c08, 0x080c, 0xd842, 0x002e, 0x001e, 0x1178, 0x080c, 0xd1ae,
-	0x1904, 0xc38b, 0x080c, 0xd14a, 0x1120, 0x6007, 0x0008, 0x0804,
-	0xc49c, 0x6007, 0x0009, 0x0804, 0xc49c, 0x080c, 0xd3a5, 0x0128,
-	0x080c, 0xd1ae, 0x0d78, 0x0804, 0xc38b, 0x6017, 0x1900, 0x0c88,
-	0x080c, 0x30f6, 0x1904, 0xc6af, 0x6106, 0x080c, 0xd101, 0x6007,
-	0x0006, 0x0804, 0xc49c, 0x6007, 0x0007, 0x0804, 0xc49c, 0x080c,
-	0xd706, 0x1904, 0xc6af, 0x080c, 0x30f6, 0x1904, 0xc6af, 0x00d6,
-	0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1220,
-	0x2001, 0x0001, 0x080c, 0x6174, 0x96b4, 0xff00, 0x8637, 0x9686,
-	0x0006, 0x0188, 0x9686, 0x0004, 0x0170, 0xbe04, 0x96b4, 0x00ff,
-	0x9686, 0x0006, 0x0140, 0x9686, 0x0004, 0x0128, 0x9686, 0x0005,
-	0x0110, 0x00de, 0x0480, 0x00e6, 0x2071, 0x0260, 0x7034, 0x9084,
-	0x0003, 0x1140, 0x7034, 0x9082, 0x0014, 0x0220, 0x7030, 0x9084,
-	0x0003, 0x0130, 0x00ee, 0x6017, 0x0000, 0x602f, 0x0007, 0x00b0,
-	0x00ee, 0x080c, 0xd211, 0x1190, 0x9686, 0x0006, 0x1140, 0x0026,
-	0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c, 0x301c, 0x002e, 0x080c,
-	0x62d2, 0x6007, 0x000a, 0x00de, 0x0804, 0xc49c, 0x6007, 0x000b,
-	0x00de, 0x0804, 0xc49c, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x6007,
-	0x0001, 0x0804, 0xc49c, 0x080c, 0xd706, 0x1904, 0xc6af, 0x080c,
-	0x30f6, 0x1904, 0xc6af, 0x2071, 0x0260, 0x7034, 0x90b4, 0x0003,
-	0x1948, 0x90b2, 0x0014, 0x0a30, 0x7030, 0x9084, 0x0003, 0x1910,
-	0x6610, 0x2658, 0xbe04, 0x9686, 0x0707, 0x09e8, 0x0026, 0x6210,
-	0x2258, 0xbaa0, 0x900e, 0x080c, 0x301c, 0x002e, 0x6007, 0x000c,
-	0x2001, 0x0001, 0x080c, 0xd822, 0x0804, 0xc49c, 0x080c, 0x6519,
-	0x1140, 0x2001, 0x1836, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008,
-	0x1110, 0x0804, 0xc2ca, 0x080c, 0x6502, 0x6610, 0x2658, 0xbe04,
-	0x9684, 0x00ff, 0x9082, 0x0006, 0x06c0, 0x1138, 0x0026, 0x2001,
-	0x0006, 0x080c, 0x61b4, 0x002e, 0x0050, 0x96b4, 0xff00, 0x8637,
-	0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xc38b, 0x080c,
-	0xd21e, 0x1120, 0x6007, 0x000e, 0x0804, 0xc49c, 0x0046, 0x6410,
-	0x2458, 0xbca0, 0x0046, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x004e,
-	0x0016, 0x9006, 0x2009, 0x1854, 0x210c, 0x0048, 0x2009, 0x0029,
-	0x080c, 0xd50a, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e,
-	0x004e, 0x6007, 0x0001, 0x0804, 0xc49c, 0x2001, 0x0001, 0x080c,
-	0x6174, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
-	0x1805, 0x2011, 0x0270, 0x080c, 0xade0, 0x003e, 0x002e, 0x001e,
-	0x015e, 0x9005, 0x0168, 0x96b4, 0xff00, 0x8637, 0x9682, 0x0004,
-	0x0a04, 0xc38b, 0x9682, 0x0007, 0x0a04, 0xc3e7, 0x0804, 0xc38b,
-	0x6017, 0x1900, 0x6007, 0x0009, 0x0804, 0xc49c, 0x080c, 0x6519,
-	0x1140, 0x2001, 0x1836, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008,
-	0x1110, 0x0804, 0xc2ca, 0x080c, 0x6502, 0x6610, 0x2658, 0xbe04,
-	0x9684, 0x00ff, 0x9082, 0x0006, 0x0688, 0x96b4, 0xff00, 0x8637,
-	0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xc38b, 0x080c,
-	0xd24c, 0x1130, 0x080c, 0xd14a, 0x1118, 0x6007, 0x0010, 0x04e0,
-	0x0046, 0x6410, 0x2458, 0xbca0, 0x0046, 0x080c, 0x2fd7, 0x080c,
-	0xc20e, 0x004e, 0x0016, 0x9006, 0x2009, 0x1854, 0x210c, 0x0048,
-	0x2009, 0x0029, 0x080c, 0xd50a, 0x6010, 0x2058, 0xb800, 0xc0e5,
-	0xb802, 0x001e, 0x004e, 0x6007, 0x0001, 0x00f0, 0x080c, 0xd3a5,
-	0x0140, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0980, 0x0804,
-	0xc38b, 0x6017, 0x1900, 0x6007, 0x0009, 0x0070, 0x080c, 0x30f6,
-	0x1904, 0xc6af, 0x080c, 0xd706, 0x1904, 0xc6af, 0x080c, 0xc84f,
-	0x1904, 0xc38b, 0x6007, 0x0012, 0x6003, 0x0001, 0x080c, 0x8411,
-	0x080c, 0x894b, 0x0005, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c,
-	0x8411, 0x080c, 0x894b, 0x0cb0, 0x6007, 0x0005, 0x0c68, 0x080c,
-	0xd706, 0x1904, 0xc6af, 0x080c, 0x30f6, 0x1904, 0xc6af, 0x080c,
-	0xc84f, 0x1904, 0xc38b, 0x6007, 0x0020, 0x6003, 0x0001, 0x080c,
-	0x8411, 0x080c, 0x894b, 0x0005, 0x080c, 0x30f6, 0x1904, 0xc6af,
-	0x6007, 0x0023, 0x6003, 0x0001, 0x080c, 0x8411, 0x080c, 0x894b,
-	0x0005, 0x080c, 0xd706, 0x1904, 0xc6af, 0x080c, 0x30f6, 0x1904,
-	0xc6af, 0x080c, 0xc84f, 0x1904, 0xc38b, 0x0016, 0x0026, 0x00e6,
-	0x2071, 0x0260, 0x7244, 0x9286, 0xffff, 0x0180, 0x2c08, 0x080c,
-	0xbaec, 0x01b0, 0x2260, 0x7240, 0x6008, 0x9206, 0x1188, 0x6010,
-	0x9190, 0x0004, 0x2214, 0x9206, 0x01b8, 0x0050, 0x7240, 0x2c08,
-	0x9006, 0x080c, 0xd4dc, 0x1180, 0x7244, 0x9286, 0xffff, 0x01b0,
-	0x2160, 0x6007, 0x0026, 0x6017, 0x1700, 0x7214, 0x9296, 0xffff,
-	0x1180, 0x6007, 0x0025, 0x0068, 0x6020, 0x9086, 0x0007, 0x1d80,
-	0x6004, 0x9086, 0x0024, 0x1110, 0x080c, 0x9e19, 0x2160, 0x6007,
-	0x0025, 0x6003, 0x0001, 0x080c, 0x8411, 0x080c, 0x894b, 0x00ee,
-	0x002e, 0x001e, 0x0005, 0x2001, 0x0001, 0x080c, 0x6174, 0x0156,
-	0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011,
-	0x0276, 0x080c, 0xade0, 0x003e, 0x002e, 0x001e, 0x015e, 0x0120,
-	0x6007, 0x0031, 0x0804, 0xc49c, 0x080c, 0xaa48, 0x080c, 0x6fa7,
-	0x1190, 0x0006, 0x0026, 0x0036, 0x080c, 0x6fc1, 0x1138, 0x080c,
-	0x728b, 0x080c, 0x5cca, 0x080c, 0x6ed9, 0x0010, 0x080c, 0x6f7f,
-	0x003e, 0x002e, 0x000e, 0x0005, 0x080c, 0x30f6, 0x1904, 0xc6af,
-	0x080c, 0xc84f, 0x1904, 0xc38b, 0x6106, 0x080c, 0xc86b, 0x1120,
-	0x6007, 0x002b, 0x0804, 0xc49c, 0x6007, 0x002c, 0x0804, 0xc49c,
-	0x080c, 0xd706, 0x1904, 0xc6af, 0x080c, 0x30f6, 0x1904, 0xc6af,
-	0x080c, 0xc84f, 0x1904, 0xc38b, 0x6106, 0x080c, 0xc870, 0x1120,
-	0x6007, 0x002e, 0x0804, 0xc49c, 0x6007, 0x002f, 0x0804, 0xc49c,
-	0x080c, 0x30f6, 0x1904, 0xc6af, 0x00e6, 0x00d6, 0x00c6, 0x6010,
-	0x2058, 0xb904, 0x9184, 0x00ff, 0x9086, 0x0006, 0x0158, 0x9184,
-	0xff00, 0x8007, 0x9086, 0x0006, 0x0128, 0x00ce, 0x00de, 0x00ee,
-	0x0804, 0xc4a3, 0x080c, 0x5383, 0xd0e4, 0x0904, 0xc5fa, 0x2071,
-	0x026c, 0x7010, 0x603a, 0x7014, 0x603e, 0x7108, 0x720c, 0x080c,
-	0x6557, 0x0140, 0x6010, 0x2058, 0xb810, 0x9106, 0x1118, 0xb814,
-	0x9206, 0x0510, 0x080c, 0x6553, 0x15b8, 0x2069, 0x1800, 0x687c,
-	0x9206, 0x1590, 0x6878, 0x9106, 0x1578, 0x7210, 0x080c, 0xbaec,
-	0x0590, 0x080c, 0xc73a, 0x0578, 0x080c, 0xd586, 0x0560, 0x622e,
-	0x6007, 0x0036, 0x6003, 0x0001, 0x080c, 0x83c9, 0x080c, 0x894b,
-	0x00ce, 0x00de, 0x00ee, 0x0005, 0x7214, 0x9286, 0xffff, 0x0150,
-	0x080c, 0xbaec, 0x01c0, 0x9280, 0x0002, 0x2004, 0x7110, 0x9106,
-	0x1190, 0x08e0, 0x7210, 0x2c08, 0x9085, 0x0001, 0x080c, 0xd4dc,
-	0x2c10, 0x2160, 0x0140, 0x0890, 0x6007, 0x0037, 0x602f, 0x0009,
-	0x6017, 0x1500, 0x08b8, 0x6007, 0x0037, 0x602f, 0x0003, 0x6017,
-	0x1700, 0x0880, 0x6007, 0x0012, 0x0868, 0x080c, 0x30f6, 0x1904,
-	0xc6af, 0x6010, 0x2058, 0xb804, 0x9084, 0xff00, 0x8007, 0x9086,
-	0x0006, 0x1904, 0xc4a3, 0x00e6, 0x00d6, 0x00c6, 0x080c, 0x5383,
-	0xd0e4, 0x0904, 0xc672, 0x2069, 0x1800, 0x2071, 0x026c, 0x7008,
-	0x603a, 0x720c, 0x623e, 0x9286, 0xffff, 0x1150, 0x7208, 0x00c6,
-	0x2c08, 0x9085, 0x0001, 0x080c, 0xd4dc, 0x2c10, 0x00ce, 0x05e8,
-	0x080c, 0xbaec, 0x05d0, 0x7108, 0x9280, 0x0002, 0x2004, 0x9106,
-	0x15a0, 0x00c6, 0x0026, 0x2260, 0x080c, 0xb724, 0x002e, 0x00ce,
-	0x7118, 0x918c, 0xff00, 0x810f, 0x9186, 0x0001, 0x0178, 0x9186,
-	0x0005, 0x0118, 0x9186, 0x0007, 0x1198, 0x9280, 0x0005, 0x2004,
-	0x9005, 0x0170, 0x080c, 0xc73a, 0x0904, 0xc5f3, 0x0056, 0x7510,
-	0x7614, 0x080c, 0xd59f, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x0005,
-	0x6007, 0x003b, 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003, 0x0001,
-	0x080c, 0x83c9, 0x080c, 0x894b, 0x0c78, 0x6007, 0x003b, 0x602f,
-	0x0003, 0x6017, 0x0300, 0x6003, 0x0001, 0x080c, 0x83c9, 0x080c,
-	0x894b, 0x0c10, 0x6007, 0x003b, 0x602f, 0x000b, 0x6017, 0x0000,
-	0x0804, 0xc5ca, 0x00e6, 0x0026, 0x080c, 0x6519, 0x0550, 0x080c,
-	0x6502, 0x080c, 0xd778, 0x1518, 0x2071, 0x1800, 0x70d8, 0x9085,
-	0x0003, 0x70da, 0x00f6, 0x2079, 0x0100, 0x72ac, 0x9284, 0x00ff,
-	0x707a, 0x78e6, 0x9284, 0xff00, 0x727c, 0x9205, 0x707e, 0x78ea,
-	0x00fe, 0x70e3, 0x0000, 0x080c, 0x6557, 0x0120, 0x2011, 0x19d1,
-	0x2013, 0x07d0, 0xd0ac, 0x1128, 0x080c, 0x2dbb, 0x0010, 0x080c,
-	0xd7aa, 0x002e, 0x00ee, 0x080c, 0x9e19, 0x0804, 0xc4a2, 0x080c,
-	0x9e19, 0x0005, 0x2600, 0x0002, 0xc6c6, 0xc6c6, 0xc6c6, 0xc6c6,
-	0xc6c6, 0xc6c8, 0xc6c6, 0xc6c6, 0xc6c6, 0xc6c6, 0xc6e5, 0xc6c6,
-	0xc6c6, 0xc6c6, 0xc6f7, 0xc704, 0xc735, 0xc6c6, 0x080c, 0x0db4,
-	0x080c, 0xd706, 0x1d20, 0x080c, 0x30f6, 0x1d08, 0x080c, 0xc84f,
-	0x1148, 0x7038, 0x6016, 0x6007, 0x0045, 0x6003, 0x0001, 0x080c,
-	0x8411, 0x0005, 0x080c, 0x2fd7, 0x080c, 0xc20e, 0x6007, 0x0001,
-	0x6003, 0x0001, 0x080c, 0x8411, 0x0005, 0x080c, 0xd706, 0x1938,
-	0x080c, 0x30f6, 0x1920, 0x080c, 0xc84f, 0x1d60, 0x703c, 0x6016,
-	0x6007, 0x004a, 0x6003, 0x0001, 0x080c, 0x8411, 0x0005, 0x080c,
-	0xc757, 0x0904, 0xc6af, 0x6007, 0x004e, 0x6003, 0x0001, 0x080c,
-	0x8411, 0x080c, 0x894b, 0x0005, 0x6007, 0x004f, 0x6017, 0x0000,
-	0x7134, 0x918c, 0x00ff, 0x81ff, 0x0508, 0x9186, 0x0001, 0x1160,
-	0x7140, 0x2001, 0x198e, 0x2004, 0x9106, 0x11b0, 0x7144, 0x2001,
-	0x198f, 0x2004, 0x9106, 0x0190, 0x9186, 0x0002, 0x1168, 0x2011,
-	0x0276, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x000a,
-	0x080c, 0xadf4, 0x009e, 0x0110, 0x6017, 0x0001, 0x6003, 0x0001,
-	0x080c, 0x8411, 0x080c, 0x894b, 0x0005, 0x6007, 0x0050, 0x703c,
-	0x6016, 0x0ca0, 0x0016, 0x00e6, 0x2071, 0x0260, 0x00b6, 0x00c6,
-	0x2260, 0x6010, 0x2058, 0xb8bc, 0xd084, 0x0150, 0x7128, 0x6048,
-	0x9106, 0x1120, 0x712c, 0x6044, 0x9106, 0x0110, 0x9006, 0x0010,
-	0x9085, 0x0001, 0x00ce, 0x00be, 0x00ee, 0x001e, 0x0005, 0x0016,
-	0x0096, 0x0086, 0x00e6, 0x01c6, 0x01d6, 0x0126, 0x2091, 0x8000,
-	0x2071, 0x1800, 0x708c, 0x908a, 0x00f9, 0x16e8, 0x20e1, 0x0000,
-	0x2001, 0x1971, 0x2003, 0x0000, 0x080c, 0x1004, 0x05a0, 0x2900,
-	0x6016, 0x708c, 0x8004, 0xa816, 0x908a, 0x001e, 0x02d0, 0xa833,
-	0x001e, 0x20a9, 0x001e, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b,
-	0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x0471, 0x001e, 0x2940,
-	0x080c, 0x1004, 0x01c0, 0x2900, 0xa006, 0x2100, 0x81ff, 0x0180,
-	0x0c18, 0xa832, 0x20a8, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b,
-	0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x00b1, 0x001e, 0x0000,
-	0x9085, 0x0001, 0x0048, 0x2071, 0x1800, 0x708f, 0x0000, 0x6014,
-	0x2048, 0x080c, 0x0f9d, 0x9006, 0x012e, 0x01de, 0x01ce, 0x00ee,
-	0x008e, 0x009e, 0x001e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036,
-	0x00c6, 0x918c, 0xffff, 0x11a8, 0x080c, 0x2241, 0x2099, 0x026c,
-	0x2001, 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x00f8,
-	0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x2241, 0x2099, 0x0260,
-	0x0ca8, 0x080c, 0x2241, 0x2061, 0x1971, 0x6004, 0x2098, 0x6008,
-	0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0048, 0x20a8, 0x4003,
-	0x22a8, 0x8108, 0x080c, 0x2241, 0x2099, 0x0260, 0x0ca8, 0x2061,
-	0x1971, 0x2019, 0x0280, 0x3300, 0x931e, 0x0110, 0x6006, 0x0020,
-	0x2001, 0x0260, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021, 0x9296,
-	0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005,
-	0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x81ff, 0x11b8, 0x080c,
-	0x2259, 0x20a1, 0x024c, 0x2001, 0x0014, 0x3518, 0x9312, 0x1218,
-	0x23a8, 0x4003, 0x0418, 0x20a8, 0x4003, 0x82ff, 0x01f8, 0x22a8,
-	0x8108, 0x080c, 0x2259, 0x20a1, 0x0240, 0x0c98, 0x080c, 0x2259,
-	0x2061, 0x1974, 0x6004, 0x20a0, 0x6008, 0x3518, 0x9312, 0x1218,
-	0x23a8, 0x4003, 0x0058, 0x20a8, 0x4003, 0x82ff, 0x0138, 0x22a8,
-	0x8108, 0x080c, 0x2259, 0x20a1, 0x0240, 0x0c98, 0x2061, 0x1974,
-	0x2019, 0x0260, 0x3400, 0x931e, 0x0110, 0x6006, 0x0020, 0x2001,
-	0x0240, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021, 0x9296, 0xffff,
-	0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x00b6,
-	0x0066, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686,
-	0x0006, 0x0170, 0x9686, 0x0004, 0x0158, 0xbe04, 0x96b4, 0x00ff,
-	0x9686, 0x0006, 0x0128, 0x9686, 0x0004, 0x0110, 0x9085, 0x0001,
-	0x006e, 0x00be, 0x0005, 0x00d6, 0x080c, 0xc8e7, 0x00de, 0x0005,
-	0x00d6, 0x080c, 0xc8f4, 0x1520, 0x680c, 0x908c, 0xff00, 0x6820,
-	0x9084, 0x00ff, 0x9115, 0x6216, 0x6824, 0x602e, 0xd1e4, 0x0130,
-	0x9006, 0x080c, 0xd822, 0x2009, 0x0001, 0x0078, 0xd1ec, 0x0180,
-	0x6920, 0x918c, 0x00ff, 0x6824, 0x080c, 0x2663, 0x1148, 0x2001,
-	0x0001, 0x080c, 0xd822, 0x2110, 0x900e, 0x080c, 0x301c, 0x0018,
-	0x9085, 0x0001, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6, 0x00c6,
-	0x080c, 0x9e66, 0x05a8, 0x0016, 0x0026, 0x00c6, 0x2011, 0x0263,
-	0x2204, 0x8211, 0x220c, 0x080c, 0x2663, 0x1578, 0x080c, 0x61d7,
-	0x1560, 0xbe12, 0xbd16, 0x00ce, 0x002e, 0x001e, 0x2b00, 0x6012,
-	0x080c, 0xd706, 0x11d8, 0x080c, 0x30f6, 0x11c0, 0x080c, 0xc84f,
-	0x0510, 0x2001, 0x0007, 0x080c, 0x6188, 0x2001, 0x0007, 0x080c,
-	0x61b4, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003,
-	0x0001, 0x080c, 0x8411, 0x080c, 0x894b, 0x0010, 0x080c, 0x9e19,
-	0x9085, 0x0001, 0x00ce, 0x00be, 0x0005, 0x080c, 0x9e19, 0x00ce,
-	0x002e, 0x001e, 0x0ca8, 0x080c, 0x9e19, 0x9006, 0x0c98, 0x2069,
-	0x026d, 0x6800, 0x9082, 0x0010, 0x1228, 0x6017, 0x0000, 0x9085,
-	0x0001, 0x0008, 0x9006, 0x0005, 0x6017, 0x0000, 0x2069, 0x026c,
-	0x6808, 0x9084, 0xff00, 0x9086, 0x0800, 0x1190, 0x6904, 0x9186,
-	0x0018, 0x0118, 0x9186, 0x0014, 0x1158, 0x810f, 0x6800, 0x9084,
-	0x00ff, 0x910d, 0x615a, 0x908e, 0x0014, 0x0110, 0x908e, 0x0010,
-	0x0005, 0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0db4, 0x91b6, 0x0013,
-	0x1130, 0x2008, 0x91b2, 0x0040, 0x1a04, 0xca3c, 0x0092, 0x91b6,
-	0x0027, 0x0120, 0x91b6, 0x0014, 0x190c, 0x0db4, 0x2001, 0x0007,
-	0x080c, 0x61b4, 0x080c, 0x8846, 0x080c, 0x9e49, 0x080c, 0x894b,
-	0x0005, 0xc971, 0xc973, 0xc971, 0xc971, 0xc971, 0xc973, 0xc982,
-	0xca35, 0xc9d4, 0xca35, 0xc9e6, 0xca35, 0xc982, 0xca35, 0xca2d,
-	0xca35, 0xca2d, 0xca35, 0xca35, 0xc971, 0xc971, 0xc971, 0xc971,
-	0xc971, 0xc971, 0xc971, 0xc971, 0xc971, 0xc971, 0xc971, 0xc973,
-	0xc971, 0xca35, 0xc971, 0xc971, 0xca35, 0xc971, 0xca32, 0xca35,
-	0xc971, 0xc971, 0xc971, 0xc971, 0xca35, 0xca35, 0xc971, 0xca35,
-	0xca35, 0xc971, 0xc97d, 0xc971, 0xc971, 0xc971, 0xc971, 0xca31,
-	0xca35, 0xc971, 0xc971, 0xca35, 0xca35, 0xc971, 0xc971, 0xc971,
-	0xc971, 0x080c, 0x0db4, 0x080c, 0x8846, 0x080c, 0xc211, 0x6003,
-	0x0002, 0x080c, 0x894b, 0x0804, 0xca3b, 0x9006, 0x080c, 0x6174,
-	0x0804, 0xca35, 0x080c, 0x6553, 0x1904, 0xca35, 0x9006, 0x080c,
-	0x6174, 0x6010, 0x2058, 0xb810, 0x9086, 0x00ff, 0x1140, 0x00f6,
-	0x2079, 0x1800, 0x78a4, 0x8000, 0x78a6, 0x00fe, 0x0428, 0x6010,
-	0x2058, 0xb8b0, 0x9005, 0x1178, 0x080c, 0xc1f9, 0x1904, 0xca35,
-	0x0036, 0x0046, 0xbba0, 0x2021, 0x0007, 0x080c, 0x4a6f, 0x004e,
-	0x003e, 0x0804, 0xca35, 0x080c, 0x3127, 0x1904, 0xca35, 0x2001,
-	0x1800, 0x2004, 0x9086, 0x0002, 0x1138, 0x00f6, 0x2079, 0x1800,
-	0x78a4, 0x8000, 0x78a6, 0x00fe, 0x2001, 0x0002, 0x080c, 0x6188,
-	0x080c, 0x8846, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002,
-	0x080c, 0x8411, 0x080c, 0x894b, 0x6110, 0x2158, 0x2009, 0x0001,
-	0x080c, 0x801e, 0x0804, 0xca3b, 0x6610, 0x2658, 0xbe04, 0x96b4,
-	0xff00, 0x8637, 0x9686, 0x0006, 0x0904, 0xca35, 0x9686, 0x0004,
-	0x0904, 0xca35, 0x2001, 0x0004, 0x0804, 0xca33, 0x2001, 0x1800,
-	0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058,
-	0xbba0, 0x2021, 0x0006, 0x080c, 0x4a6f, 0x004e, 0x003e, 0x2001,
-	0x0006, 0x080c, 0xca59, 0x6610, 0x2658, 0xbe04, 0x0066, 0x96b4,
-	0xff00, 0x8637, 0x9686, 0x0006, 0x006e, 0x0168, 0x2001, 0x0006,
-	0x080c, 0x61b4, 0x9284, 0x00ff, 0x908e, 0x0007, 0x1120, 0x2001,
-	0x0006, 0x080c, 0x6188, 0x080c, 0x6553, 0x11f8, 0x2001, 0x1836,
-	0x2004, 0xd0a4, 0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006,
-	0x01a0, 0x00f6, 0x2079, 0x1800, 0x78a4, 0x8000, 0x78a6, 0x00fe,
-	0x0804, 0xc9bc, 0x2001, 0x0004, 0x0030, 0x2001, 0x0006, 0x0449,
-	0x0020, 0x0018, 0x0010, 0x080c, 0x61b4, 0x080c, 0x8846, 0x080c,
-	0x9e19, 0x080c, 0x894b, 0x0005, 0x2600, 0x0002, 0xca50, 0xca50,
-	0xca50, 0xca50, 0xca50, 0xca52, 0xca50, 0xca50, 0xca50, 0xca50,
-	0xca52, 0xca50, 0xca50, 0xca50, 0xca52, 0xca52, 0xca52, 0xca52,
-	0x080c, 0x0db4, 0x080c, 0x8846, 0x080c, 0x9e19, 0x080c, 0x894b,
-	0x0005, 0x0016, 0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900, 0xd184,
-	0x0138, 0x080c, 0x6188, 0x9006, 0x080c, 0x6174, 0x080c, 0x2ffc,
-	0x00de, 0x00be, 0x001e, 0x0005, 0x6610, 0x2658, 0xb804, 0x9084,
-	0xff00, 0x8007, 0x90b2, 0x000c, 0x1a0c, 0x0db4, 0x91b6, 0x0015,
-	0x1110, 0x003b, 0x0028, 0x91b6, 0x0016, 0x190c, 0x0db4, 0x006b,
-	0x0005, 0xa888, 0xa888, 0xa888, 0xa888, 0xa888, 0xa888, 0xcad4,
-	0xca99, 0xa888, 0xa888, 0xa888, 0xa888, 0xa888, 0xa888, 0xa888,
-	0xa888, 0xa888, 0xa888, 0xcad4, 0xcadb, 0xa888, 0xa888, 0xa888,
-	0xa888, 0x00f6, 0x080c, 0x6553, 0x11d8, 0x080c, 0xc1f9, 0x11c0,
-	0x6010, 0x905d, 0x01a8, 0xb8b0, 0x9005, 0x0190, 0x9006, 0x080c,
-	0x6174, 0x2001, 0x0002, 0x080c, 0x6188, 0x6023, 0x0001, 0x6003,
-	0x0001, 0x6007, 0x0002, 0x080c, 0x8411, 0x080c, 0x894b, 0x00d0,
-	0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2663, 0x1190,
-	0x080c, 0x6237, 0x0118, 0x080c, 0x9e19, 0x0060, 0xb810, 0x0006,
-	0xb814, 0x0006, 0x080c, 0x5ce4, 0x000e, 0xb816, 0x000e, 0xb812,
-	0x080c, 0x9e19, 0x00fe, 0x0005, 0x6604, 0x96b6, 0x001e, 0x1110,
-	0x080c, 0x9e19, 0x0005, 0x080c, 0xac6c, 0x1148, 0x6003, 0x0001,
-	0x6007, 0x0001, 0x080c, 0x8411, 0x080c, 0x894b, 0x0010, 0x080c,
-	0x9e19, 0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0db4, 0x080c,
-	0x8846, 0x080c, 0x9e49, 0x080c, 0x894b, 0x0005, 0x9182, 0x0040,
-	0x0002, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0e, 0xcb0c, 0xcb0c,
-	0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c,
-	0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0x080c, 0x0db4, 0x0096, 0x00b6,
-	0x00d6, 0x00e6, 0x00f6, 0x0046, 0x0026, 0x6210, 0x2258, 0xb8ac,
-	0x9005, 0x11a8, 0x6106, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00,
-	0x0904, 0xcb74, 0x080c, 0xd816, 0x1170, 0x9486, 0x2000, 0x1158,
-	0x2009, 0x0001, 0x2011, 0x0200, 0x080c, 0x8207, 0x0020, 0x9026,
-	0x080c, 0xd74b, 0x0c38, 0x080c, 0x0feb, 0x090c, 0x0db4, 0x6003,
-	0x0007, 0xa867, 0x010d, 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00,
-	0xa88e, 0x6008, 0xa8e2, 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a,
-	0x0016, 0xa876, 0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036,
-	0x080c, 0x6885, 0x001e, 0x080c, 0xd816, 0x1904, 0xcbd4, 0x9486,
-	0x2000, 0x1130, 0x2019, 0x0017, 0x080c, 0xd486, 0x0804, 0xcbd4,
-	0x9486, 0x0200, 0x1120, 0x080c, 0xd422, 0x0804, 0xcbd4, 0x9486,
-	0x0400, 0x0120, 0x9486, 0x1000, 0x1904, 0xcbd4, 0x2019, 0x0002,
-	0x080c, 0xd43d, 0x0804, 0xcbd4, 0x2069, 0x1a41, 0x6a00, 0xd284,
-	0x0904, 0xcc3e, 0x9284, 0x0300, 0x1904, 0xcc37, 0x6804, 0x9005,
-	0x0904, 0xcc1f, 0x2d78, 0x6003, 0x0007, 0x080c, 0x1004, 0x0904,
-	0xcbe0, 0x7800, 0xd08c, 0x1118, 0x7804, 0x8001, 0x7806, 0x6017,
-	0x0000, 0x2001, 0x180f, 0x2004, 0xd084, 0x1904, 0xcc42, 0x9006,
-	0xa802, 0xa867, 0x0116, 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a,
-	0x6010, 0x2058, 0xb8a0, 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba,
-	0xb92c, 0xa9be, 0xb930, 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d,
-	0x7044, 0x9084, 0x0003, 0x9080, 0xcbdc, 0x2005, 0xa87e, 0x20a9,
-	0x000a, 0x2001, 0x0270, 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205,
-	0x200b, 0x0080, 0x20e1, 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0,
-	0x4003, 0x200b, 0x0000, 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000,
-	0x200c, 0xa9ae, 0x080c, 0x6885, 0x002e, 0x004e, 0x00fe, 0x00ee,
-	0x00de, 0x00be, 0x009e, 0x0005, 0x0000, 0x0080, 0x0040, 0x0000,
-	0x2001, 0x1810, 0x2004, 0xd084, 0x0120, 0x080c, 0x0feb, 0x1904,
-	0xcb89, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
-	0x83c9, 0x080c, 0x894b, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084,
-	0xff00, 0x9086, 0x1200, 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016,
-	0x6114, 0x918c, 0xf700, 0x910d, 0x6116, 0x001e, 0x6003, 0x0001,
-	0x6007, 0x0043, 0x080c, 0x83c9, 0x080c, 0x894b, 0x0828, 0x6868,
-	0x602e, 0x686c, 0x6032, 0x6017, 0xf200, 0x6003, 0x0001, 0x6007,
-	0x0041, 0x080c, 0x83c9, 0x080c, 0x894b, 0x0804, 0xcbd4, 0x2001,
-	0x180e, 0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d2,
-	0x6017, 0xf300, 0x0010, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007,
-	0x0041, 0x080c, 0x83c9, 0x080c, 0x894b, 0x0804, 0xcbd4, 0x6017,
-	0xf500, 0x0c98, 0x6017, 0xf600, 0x0804, 0xcbf4, 0x6017, 0xf200,
-	0x0804, 0xcbf4, 0xa867, 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886,
-	0x2c00, 0xa87a, 0x7044, 0x9084, 0x0003, 0x9080, 0xcbdc, 0x2005,
-	0xa87e, 0x2928, 0x6010, 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a,
-	0xb82c, 0xa88e, 0xb830, 0xa892, 0xb834, 0xa896, 0xa883, 0x003d,
-	0x2009, 0x0205, 0x2104, 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000,
-	0x2011, 0x0210, 0x2214, 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111,
-	0x1a0c, 0x0db4, 0x8210, 0x821c, 0x2001, 0x026c, 0x2098, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0029, 0x20a0, 0x2011, 0xccbe, 0x2041,
-	0x0001, 0x223d, 0x9784, 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8,
-	0x4003, 0x931a, 0x0530, 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a,
-	0x2001, 0x0260, 0x2098, 0x0c68, 0x2950, 0x080c, 0x1004, 0x0170,
-	0x2900, 0xb002, 0xa867, 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x001b, 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800,
-	0x902d, 0x0118, 0x080c, 0x101d, 0x0cc8, 0x080c, 0x101d, 0x0804,
-	0xcbe0, 0x2548, 0x8847, 0x9885, 0x0046, 0xa866, 0x2009, 0x0205,
-	0x200b, 0x0000, 0x080c, 0xd4b5, 0x0804, 0xcbd4, 0x8010, 0x0004,
-	0x801a, 0x0006, 0x8018, 0x0008, 0x8016, 0x000a, 0x8014, 0x9186,
-	0x0013, 0x1160, 0x6004, 0x908a, 0x0054, 0x1a0c, 0x0db4, 0x9082,
-	0x0040, 0x0a0c, 0x0db4, 0x2008, 0x0804, 0xcd6f, 0x9186, 0x0051,
-	0x0108, 0x00c0, 0x2001, 0x0109, 0x2004, 0xd084, 0x0904, 0xcd20,
-	0x0126, 0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x080c, 0x82b5,
-	0x002e, 0x001e, 0x000e, 0x012e, 0x6000, 0x9086, 0x0002, 0x1580,
-	0x0804, 0xcdb7, 0x9186, 0x0027, 0x0530, 0x9186, 0x0048, 0x0128,
-	0x9186, 0x0014, 0x0500, 0x190c, 0x0db4, 0x2001, 0x0109, 0x2004,
-	0xd084, 0x01f0, 0x00c6, 0x0126, 0x2091, 0x2800, 0x00c6, 0x2061,
-	0x0100, 0x0006, 0x0016, 0x0026, 0x080c, 0x82b5, 0x002e, 0x001e,
-	0x000e, 0x00ce, 0x012e, 0x00ce, 0x6000, 0x9086, 0x0004, 0x190c,
-	0x0db4, 0x0804, 0xce98, 0x6004, 0x9082, 0x0040, 0x2008, 0x001a,
-	0x080c, 0x9eae, 0x0005, 0xcd36, 0xcd38, 0xcd38, 0xcd5f, 0xcd36,
-	0xcd36, 0xcd36, 0xcd36, 0xcd36, 0xcd36, 0xcd36, 0xcd36, 0xcd36,
-	0xcd36, 0xcd36, 0xcd36, 0xcd36, 0xcd36, 0xcd36, 0x080c, 0x0db4,
-	0x080c, 0x8846, 0x080c, 0x894b, 0x0036, 0x0096, 0x6014, 0x904d,
-	0x01d8, 0x080c, 0xbafe, 0x01c0, 0x6003, 0x0002, 0x6010, 0x00b6,
-	0x2058, 0xb800, 0x00be, 0xd0bc, 0x1178, 0x2019, 0x0004, 0x080c,
-	0xd4b5, 0x6017, 0x0000, 0x6018, 0x9005, 0x1120, 0x2001, 0x1958,
-	0x2004, 0x601a, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x0096,
-	0x080c, 0x8846, 0x080c, 0x894b, 0x080c, 0xbafe, 0x0120, 0x6014,
-	0x2048, 0x080c, 0x101d, 0x080c, 0x9e49, 0x009e, 0x0005, 0x0002,
-	0xcd83, 0xcd9a, 0xcd85, 0xcdb1, 0xcd83, 0xcd83, 0xcd83, 0xcd83,
-	0xcd83, 0xcd83, 0xcd83, 0xcd83, 0xcd83, 0xcd83, 0xcd83, 0xcd83,
-	0xcd83, 0xcd83, 0xcd83, 0x080c, 0x0db4, 0x0096, 0x080c, 0x8846,
-	0x6014, 0x2048, 0xa87c, 0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009,
-	0x0043, 0x080c, 0x9e93, 0x0010, 0x6003, 0x0004, 0x080c, 0x894b,
-	0x009e, 0x0005, 0x080c, 0x8846, 0x080c, 0xbafe, 0x0138, 0x6114,
-	0x0096, 0x2148, 0xa97c, 0x009e, 0xd1ec, 0x1138, 0x080c, 0x81dc,
-	0x080c, 0x9e19, 0x080c, 0x894b, 0x0005, 0x080c, 0xd70f, 0x0db0,
-	0x0cc8, 0x080c, 0x8846, 0x2009, 0x0041, 0x0804, 0xcf20, 0x9182,
-	0x0040, 0x0002, 0xcdcd, 0xcdcf, 0xcdcd, 0xcdcd, 0xcdcd, 0xcdcd,
-	0xcdcd, 0xcdcd, 0xcdcd, 0xcdcd, 0xcdcd, 0xcdcd, 0xcdcd, 0xcdcd,
-	0xcdcd, 0xcdcd, 0xcdcd, 0xcdd0, 0xcdcd, 0x080c, 0x0db4, 0x0005,
-	0x00d6, 0x080c, 0x81dc, 0x00de, 0x080c, 0xd767, 0x080c, 0x9e19,
-	0x0005, 0x9182, 0x0040, 0x0002, 0xcdef, 0xcdef, 0xcdef, 0xcdef,
-	0xcdef, 0xcdef, 0xcdef, 0xcdef, 0xcdef, 0xcdf1, 0xce60, 0xcdef,
-	0xcdef, 0xcdef, 0xcdef, 0xce60, 0xcdef, 0xcdef, 0xcdef, 0x080c,
-	0x0db4, 0x2001, 0x0105, 0x2004, 0x9084, 0x1800, 0x01c8, 0x2001,
-	0x0132, 0x200c, 0x2001, 0x0131, 0x2004, 0x9105, 0x1904, 0xce60,
-	0x2009, 0x180c, 0x2104, 0xd0d4, 0x0904, 0xce60, 0xc0d4, 0x200a,
-	0x2009, 0x0105, 0x2104, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x200a,
-	0x2001, 0x1873, 0x2004, 0xd0e4, 0x1528, 0x603b, 0x0000, 0x080c,
-	0x88fb, 0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0188, 0x908c,
-	0x0003, 0x918e, 0x0002, 0x0508, 0x2001, 0x180c, 0x2004, 0xd0d4,
-	0x11e0, 0x080c, 0x8a26, 0x2009, 0x0041, 0x009e, 0x0804, 0xcf20,
-	0x080c, 0x8a26, 0x6003, 0x0007, 0x601b, 0x0000, 0x080c, 0x81dc,
-	0x009e, 0x0005, 0x2001, 0x0100, 0x2004, 0x9082, 0x0005, 0x0aa8,
-	0x2001, 0x011f, 0x2004, 0x603a, 0x0890, 0x2001, 0x180c, 0x200c,
-	0xc1d4, 0x2102, 0xd1cc, 0x0110, 0x080c, 0x2a77, 0x080c, 0x8a26,
-	0x6014, 0x2048, 0xa97c, 0xd1ec, 0x1130, 0x080c, 0x81dc, 0x080c,
-	0x9e19, 0x009e, 0x0005, 0x080c, 0xd70f, 0x0db8, 0x009e, 0x0005,
-	0x2001, 0x180c, 0x200c, 0xc1d4, 0x2102, 0x0036, 0x080c, 0x88fb,
-	0x080c, 0x8a26, 0x6014, 0x0096, 0x2048, 0x6010, 0x00b6, 0x2058,
-	0xb800, 0x00be, 0xd0bc, 0x0188, 0xa87c, 0x9084, 0x0003, 0x9086,
-	0x0002, 0x0140, 0xa8ac, 0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c,
-	0x931b, 0x632e, 0x6003, 0x0002, 0x0080, 0x2019, 0x0004, 0x080c,
-	0xd4b5, 0x6018, 0x9005, 0x1128, 0x2001, 0x1958, 0x2004, 0x8003,
-	0x601a, 0x6017, 0x0000, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005,
-	0x9182, 0x0040, 0x0002, 0xceaf, 0xceaf, 0xceaf, 0xceaf, 0xceaf,
-	0xceaf, 0xceaf, 0xceaf, 0xceb1, 0xceaf, 0xceaf, 0xceaf, 0xceaf,
-	0xceaf, 0xceaf, 0xceaf, 0xceaf, 0xceaf, 0xceaf, 0xcefc, 0x080c,
-	0x0db4, 0x6014, 0x0096, 0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6,
-	0x2158, 0xb900, 0x00be, 0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c,
-	0xd0fc, 0x0128, 0x2009, 0x0041, 0x009e, 0x0804, 0xcf20, 0x6003,
-	0x0007, 0x601b, 0x0000, 0x080c, 0x81dc, 0x009e, 0x0005, 0x6124,
-	0xd1f4, 0x1d58, 0x0006, 0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200,
-	0x910b, 0x6030, 0x9420, 0x6432, 0x602c, 0x9109, 0x612e, 0x004e,
-	0x000e, 0x08d8, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc,
-	0x1178, 0x2009, 0x180e, 0x210c, 0xd19c, 0x0118, 0x6003, 0x0007,
-	0x0010, 0x6003, 0x0006, 0x00e9, 0x080c, 0x81de, 0x009e, 0x0005,
-	0x6003, 0x0002, 0x009e, 0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c,
-	0x150f, 0x1904, 0xceb1, 0x0005, 0x6014, 0x0096, 0x2048, 0xa834,
-	0xa938, 0x009e, 0x9105, 0x1120, 0x080c, 0x150f, 0x1904, 0xceb1,
-	0x0005, 0xd2fc, 0x0140, 0x8002, 0x8000, 0x8212, 0x9291, 0x0000,
-	0x2009, 0x0009, 0x0010, 0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005,
-	0x9182, 0x0040, 0x0208, 0x0062, 0x9186, 0x0013, 0x0120, 0x9186,
-	0x0014, 0x190c, 0x0db4, 0x6024, 0xd0dc, 0x090c, 0x0db4, 0x0005,
-	0xcf43, 0xcf4f, 0xcf5b, 0xcf67, 0xcf43, 0xcf43, 0xcf43, 0xcf43,
-	0xcf4a, 0xcf45, 0xcf45, 0xcf43, 0xcf43, 0xcf43, 0xcf43, 0xcf45,
-	0xcf43, 0xcf45, 0xcf43, 0x080c, 0x0db4, 0x6024, 0xd0dc, 0x090c,
-	0x0db4, 0x0005, 0x6014, 0x9005, 0x190c, 0x0db4, 0x0005, 0x6003,
-	0x0001, 0x6106, 0x080c, 0x83c9, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x894b, 0x012e, 0x0005, 0x6003, 0x0001, 0x6106, 0x080c, 0x83c9,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x894b, 0x012e, 0x0005, 0x6003,
-	0x0003, 0x6106, 0x2c10, 0x080c, 0x1a5c, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x842e, 0x080c, 0x8a26, 0x012e, 0x0005, 0x0126, 0x2091,
-	0x8000, 0x0036, 0x0096, 0x9182, 0x0040, 0x0023, 0x009e, 0x003e,
-	0x012e, 0x0005, 0xcf92, 0xcf94, 0xcfa6, 0xcfc0, 0xcf92, 0xcf92,
-	0xcf92, 0xcf92, 0xcf92, 0xcf92, 0xcf92, 0xcf92, 0xcf92, 0xcf92,
-	0xcf92, 0xcf92, 0x080c, 0x0db4, 0x6014, 0x2048, 0xa87c, 0xd0fc,
-	0x01f8, 0x909c, 0x0003, 0x939e, 0x0003, 0x01d0, 0x6003, 0x0001,
-	0x6106, 0x080c, 0x83c9, 0x080c, 0x894b, 0x0470, 0x6014, 0x2048,
-	0xa87c, 0xd0fc, 0x0168, 0x909c, 0x0003, 0x939e, 0x0003, 0x0140,
-	0x6003, 0x0001, 0x6106, 0x080c, 0x83c9, 0x080c, 0x894b, 0x00e0,
-	0x901e, 0x6316, 0x631a, 0x2019, 0x0004, 0x080c, 0xd4b5, 0x00a0,
-	0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0d98, 0x909c, 0x0003, 0x939e,
-	0x0003, 0x0d70, 0x6003, 0x0003, 0x6106, 0x2c10, 0x080c, 0x1a5c,
-	0x080c, 0x842e, 0x080c, 0x8a26, 0x0005, 0x080c, 0x8846, 0x6114,
-	0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xd7b3, 0x0036, 0x2019,
-	0x0029, 0x080c, 0xd4b5, 0x003e, 0x009e, 0x080c, 0x9e49, 0x080c,
-	0x894b, 0x0005, 0x080c, 0x88fb, 0x6114, 0x81ff, 0x0158, 0x0096,
-	0x2148, 0x080c, 0xd7b3, 0x0036, 0x2019, 0x0029, 0x080c, 0xd4b5,
-	0x003e, 0x009e, 0x080c, 0x9e49, 0x080c, 0x8a26, 0x0005, 0x9182,
-	0x0085, 0x0002, 0xd011, 0xd00f, 0xd00f, 0xd01d, 0xd00f, 0xd00f,
-	0xd00f, 0xd00f, 0xd00f, 0xd00f, 0xd00f, 0xd00f, 0xd00f, 0x080c,
-	0x0db4, 0x6003, 0x000b, 0x6106, 0x080c, 0x83c9, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x894b, 0x012e, 0x0005, 0x0026, 0x00e6, 0x080c,
-	0xd706, 0x0118, 0x080c, 0x9e19, 0x0450, 0x2071, 0x0260, 0x7224,
-	0x6216, 0x2001, 0x180e, 0x2004, 0xd0e4, 0x0150, 0x6010, 0x00b6,
-	0x2058, 0xbca0, 0x00be, 0x2c00, 0x2011, 0x014e, 0x080c, 0xa139,
-	0x7220, 0x080c, 0xd35b, 0x0118, 0x6007, 0x0086, 0x0040, 0x6007,
-	0x0087, 0x7224, 0x9296, 0xffff, 0x1110, 0x6007, 0x0086, 0x6003,
-	0x0001, 0x080c, 0x83c9, 0x080c, 0x894b, 0x080c, 0x8a26, 0x00ee,
-	0x002e, 0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085,
-	0x0a0c, 0x0db4, 0x908a, 0x0092, 0x1a0c, 0x0db4, 0x9082, 0x0085,
-	0x00a2, 0x9186, 0x0027, 0x0130, 0x9186, 0x0014, 0x0118, 0x080c,
-	0x9eae, 0x0050, 0x2001, 0x0007, 0x080c, 0x61b4, 0x080c, 0x8846,
-	0x080c, 0x9e49, 0x080c, 0x894b, 0x0005, 0xd082, 0xd084, 0xd084,
-	0xd082, 0xd082, 0xd082, 0xd082, 0xd082, 0xd082, 0xd082, 0xd082,
-	0xd082, 0xd082, 0x080c, 0x0db4, 0x080c, 0x8846, 0x080c, 0x9e49,
-	0x080c, 0x894b, 0x0005, 0x9182, 0x0085, 0x0a0c, 0x0db4, 0x9182,
-	0x0092, 0x1a0c, 0x0db4, 0x9182, 0x0085, 0x0002, 0xd0a3, 0xd0a3,
-	0xd0a3, 0xd0a5, 0xd0a3, 0xd0a3, 0xd0a3, 0xd0a3, 0xd0a3, 0xd0a3,
-	0xd0a3, 0xd0a3, 0xd0a3, 0x080c, 0x0db4, 0x0005, 0x9186, 0x0013,
+	0x9115, 0x190c, 0xb227, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c,
+	0xb07e, 0x00ae, 0x080c, 0x0f9d, 0x009e, 0x080c, 0xc1b7, 0xa974,
+	0x0016, 0x080c, 0xb702, 0x001e, 0x0468, 0xa867, 0x0103, 0xa974,
+	0x9184, 0x00ff, 0x90b6, 0x0002, 0x01b0, 0x9086, 0x0028, 0x1118,
+	0xa87b, 0x001c, 0x00d0, 0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c,
+	0xc0da, 0x0118, 0xa974, 0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118,
+	0xa87b, 0x0007, 0x0050, 0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128,
+	0xa834, 0xa938, 0x9115, 0x190c, 0xb227, 0xa974, 0x0016, 0x080c,
+	0x66a7, 0x001e, 0xd1e4, 0x1120, 0x080c, 0x9e32, 0x009e, 0x0005,
+	0x080c, 0xbe10, 0x0cd8, 0x6114, 0x0096, 0x2148, 0xa97c, 0xd1e4,
+	0x190c, 0x18f9, 0x009e, 0x0005, 0x080c, 0x886e, 0x0010, 0x080c,
+	0x8923, 0x080c, 0xbb17, 0x01f0, 0x0096, 0x6114, 0x2148, 0x080c,
+	0xbd1d, 0x1118, 0x080c, 0xa7c0, 0x00a0, 0xa867, 0x0103, 0x2009,
+	0x180c, 0x210c, 0xd18c, 0x11b8, 0xd184, 0x1190, 0x6108, 0xa97a,
+	0x918e, 0x0029, 0x1110, 0x080c, 0xd7d3, 0xa877, 0x0000, 0x080c,
+	0x688c, 0x009e, 0x080c, 0x9e32, 0x080c, 0x8973, 0x0804, 0x8a4e,
+	0xa87b, 0x0004, 0x0c90, 0xa87b, 0x0004, 0x0c78, 0x9182, 0x0054,
+	0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xb48a, 0xb48a,
+	0xb48a, 0xb48a, 0xb48a, 0xb48c, 0xb48a, 0xb48a, 0xb48a, 0xb48a,
+	0xb48a, 0xb48a, 0xb48a, 0xb48a, 0xb48a, 0xb48a, 0xb48a, 0xb48a,
+	0xb48a, 0xb48a, 0x080c, 0x0db4, 0x080c, 0x538e, 0x01f8, 0x6014,
+	0x7144, 0x918c, 0x0fff, 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294,
+	0x00ff, 0x0096, 0x904d, 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086,
+	0x0139, 0x0128, 0xa867, 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897,
+	0x4000, 0xa99a, 0xaa9e, 0x080c, 0x688c, 0x009e, 0x0804, 0x9e32,
+	0x9182, 0x0085, 0x0002, 0xb4c2, 0xb4c0, 0xb4c0, 0xb4ce, 0xb4c0,
+	0xb4c0, 0xb4c0, 0xb4c0, 0xb4c0, 0xb4c0, 0xb4c0, 0xb4c0, 0xb4c0,
+	0x080c, 0x0db4, 0x6003, 0x0001, 0x6106, 0x080c, 0x83f1, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x8973, 0x012e, 0x0005, 0x0026, 0x0056,
+	0x00d6, 0x00e6, 0x2071, 0x0260, 0x7224, 0x6216, 0x7220, 0x080c,
+	0xbb05, 0x01a0, 0x2268, 0x6800, 0x9086, 0x0000, 0x0178, 0x6010,
+	0x6d10, 0x952e, 0x1158, 0x00c6, 0x2d60, 0x080c, 0xb73d, 0x00ce,
+	0x0128, 0x6803, 0x0002, 0x6007, 0x0086, 0x0010, 0x6007, 0x0087,
+	0x6003, 0x0001, 0x080c, 0x83f1, 0x080c, 0x8973, 0x9280, 0x0004,
+	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0140, 0x6824, 0xd0ec,
+	0x0128, 0x00c6, 0x2260, 0x080c, 0xbe4a, 0x00ce, 0x00ee, 0x00de,
+	0x005e, 0x002e, 0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a,
+	0x0085, 0x0a0c, 0x0db4, 0x908a, 0x0092, 0x1a0c, 0x0db4, 0x9082,
+	0x0085, 0x00e2, 0x9186, 0x0027, 0x0120, 0x9186, 0x0014, 0x190c,
+	0x0db4, 0x080c, 0x886e, 0x0096, 0x6014, 0x2048, 0x080c, 0xbb17,
+	0x0140, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c,
+	0x688c, 0x009e, 0x080c, 0x9e62, 0x0804, 0x8973, 0xb543, 0xb545,
+	0xb545, 0xb543, 0xb543, 0xb543, 0xb543, 0xb543, 0xb543, 0xb543,
+	0xb543, 0xb543, 0xb543, 0x080c, 0x0db4, 0x080c, 0x886e, 0x080c,
+	0x9e62, 0x080c, 0x8973, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004,
+	0x9082, 0x0085, 0x2008, 0x04b8, 0x9186, 0x0027, 0x11f8, 0x080c,
+	0x886e, 0x080c, 0x2fda, 0x080c, 0xc227, 0x0096, 0x6014, 0x2048,
+	0x080c, 0xbb17, 0x0150, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b,
+	0x0029, 0x080c, 0x688c, 0x080c, 0xbd00, 0x009e, 0x080c, 0x9e32,
+	0x080c, 0x8973, 0x0005, 0x080c, 0x9ec7, 0x0ce0, 0x9186, 0x0014,
+	0x1dd0, 0x080c, 0x886e, 0x0096, 0x6014, 0x2048, 0x080c, 0xbb17,
+	0x0d60, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0006, 0xa880,
+	0xc0ec, 0xa882, 0x08f0, 0x0002, 0xb59b, 0xb599, 0xb599, 0xb599,
+	0xb599, 0xb599, 0xb5b3, 0xb599, 0xb599, 0xb599, 0xb599, 0xb599,
+	0xb599, 0x080c, 0x0db4, 0x080c, 0x886e, 0x6034, 0x908c, 0xff00,
+	0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x2001,
+	0x1957, 0x0010, 0x2001, 0x1958, 0x2004, 0x601a, 0x6003, 0x000c,
+	0x080c, 0x8973, 0x0005, 0x080c, 0x886e, 0x6034, 0x908c, 0xff00,
+	0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x2001,
+	0x1957, 0x0010, 0x2001, 0x1958, 0x2004, 0x601a, 0x6003, 0x000e,
+	0x080c, 0x8973, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085,
+	0x0208, 0x0012, 0x0804, 0x9ec7, 0xb5e1, 0xb5e1, 0xb5e1, 0xb5e1,
+	0xb5e3, 0xb630, 0xb5e1, 0xb5e1, 0xb5e1, 0xb5e1, 0xb5e1, 0xb5e1,
+	0xb5e1, 0x080c, 0x0db4, 0x0096, 0x6010, 0x00b6, 0x2058, 0xb800,
+	0x00be, 0xd0bc, 0x0168, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186,
+	0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x009e, 0x0804, 0xb644,
+	0x080c, 0xbb17, 0x1118, 0x080c, 0xbd00, 0x0068, 0x6014, 0x2048,
+	0xa87c, 0xd0e4, 0x1110, 0x080c, 0xbd00, 0xa867, 0x0103, 0x080c,
+	0xc1f2, 0x080c, 0x688c, 0x00d6, 0x2c68, 0x080c, 0x9ddc, 0x01d0,
+	0x6003, 0x0001, 0x6007, 0x001e, 0x600b, 0xffff, 0x2009, 0x026e,
+	0x210c, 0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x6910, 0x6112,
+	0x080c, 0xbf8c, 0x6954, 0x6156, 0x6023, 0x0001, 0x080c, 0x83f1,
+	0x080c, 0x8973, 0x2d60, 0x00de, 0x080c, 0x9e32, 0x009e, 0x0005,
+	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x05a0, 0x6034,
+	0x908c, 0xff00, 0x810f, 0x9186, 0x0035, 0x0130, 0x9186, 0x001e,
+	0x0118, 0x9186, 0x0039, 0x1538, 0x00d6, 0x2c68, 0x080c, 0xc18a,
+	0x11f0, 0x080c, 0x9ddc, 0x01d8, 0x6106, 0x6003, 0x0001, 0x6023,
+	0x0001, 0x6910, 0x6112, 0x692c, 0x612e, 0x6930, 0x6132, 0x6934,
+	0x918c, 0x00ff, 0x6136, 0x6938, 0x613a, 0x693c, 0x613e, 0x6954,
+	0x6156, 0x080c, 0xbf8c, 0x080c, 0x83f1, 0x080c, 0x8973, 0x2d60,
+	0x00de, 0x0804, 0x9e32, 0x0096, 0x6014, 0x2048, 0x080c, 0xbb17,
+	0x01c8, 0xa867, 0x0103, 0xa880, 0xd0b4, 0x0128, 0xc0ec, 0xa882,
+	0xa87b, 0x0006, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020,
+	0xa87b, 0x0005, 0x080c, 0xbe0c, 0xa877, 0x0000, 0x080c, 0x688c,
+	0x080c, 0xbd00, 0x009e, 0x0804, 0x9e32, 0x0016, 0x0096, 0x6014,
+	0x2048, 0x080c, 0xbb17, 0x0140, 0xa867, 0x0103, 0xa87b, 0x0028,
+	0xa877, 0x0000, 0x080c, 0x688c, 0x009e, 0x001e, 0x9186, 0x0013,
 	0x0148, 0x9186, 0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c,
-	0x9eae, 0x0030, 0x080c, 0x8846, 0x080c, 0x9e49, 0x080c, 0x894b,
-	0x0005, 0x0036, 0x080c, 0xd767, 0x6043, 0x0000, 0x2019, 0x000b,
-	0x0031, 0x6023, 0x0006, 0x6003, 0x0007, 0x003e, 0x0005, 0x0126,
-	0x0036, 0x2091, 0x8000, 0x0086, 0x2c40, 0x0096, 0x904e, 0x080c,
-	0x97a1, 0x009e, 0x008e, 0x1550, 0x0076, 0x2c38, 0x080c, 0x984c,
-	0x007e, 0x1520, 0x6000, 0x9086, 0x0000, 0x0500, 0x6020, 0x9086,
-	0x0007, 0x01e0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xd767,
-	0x080c, 0xc211, 0x080c, 0x190d, 0x6023, 0x0007, 0x6014, 0x2048,
-	0x080c, 0xbafe, 0x0110, 0x080c, 0xd4b5, 0x009e, 0x6017, 0x0000,
-	0x080c, 0xd767, 0x6023, 0x0007, 0x080c, 0xc211, 0x003e, 0x012e,
-	0x0005, 0x00f6, 0x00c6, 0x00b6, 0x0036, 0x0156, 0x2079, 0x0260,
-	0x7938, 0x783c, 0x080c, 0x2663, 0x15b8, 0x0016, 0x00c6, 0x080c,
-	0x6237, 0x1580, 0x001e, 0x00c6, 0x2160, 0x080c, 0xc20e, 0x00ce,
-	0x002e, 0x0026, 0x0016, 0x2019, 0x0029, 0x080c, 0x990d, 0x080c,
-	0x8549, 0x0076, 0x903e, 0x080c, 0x8441, 0x007e, 0x001e, 0x0076,
-	0x903e, 0x080c, 0xd27b, 0x007e, 0x0026, 0xba04, 0x9294, 0xff00,
-	0x8217, 0x9286, 0x0006, 0x0118, 0x9286, 0x0004, 0x1118, 0xbaa0,
-	0x080c, 0x3090, 0x002e, 0x001e, 0x080c, 0x5ce4, 0xbe12, 0xbd16,
+	0x9ec7, 0x0030, 0x080c, 0x886e, 0x080c, 0x9e62, 0x080c, 0x8973,
+	0x0005, 0x0056, 0x0066, 0x0096, 0x00a6, 0x2029, 0x0001, 0x9182,
+	0x0101, 0x1208, 0x0010, 0x2009, 0x0100, 0x2130, 0x8304, 0x9098,
+	0x0018, 0x2009, 0x0020, 0x2011, 0x0029, 0x080c, 0xb712, 0x96b2,
+	0x0020, 0xb004, 0x904d, 0x0110, 0x080c, 0x0f9d, 0x080c, 0x0feb,
+	0x0520, 0x8528, 0xa867, 0x0110, 0xa86b, 0x0000, 0x2920, 0xb406,
+	0x968a, 0x003d, 0x1228, 0x2608, 0x2011, 0x001b, 0x0499, 0x00a8,
+	0x96b2, 0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x0451,
+	0x0c28, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
+	0x0003, 0xb566, 0x95ac, 0x0000, 0x0048, 0x2001, 0x0205, 0x2003,
+	0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x009e, 0x006e,
+	0x005e, 0x0005, 0x00a6, 0x89ff, 0x0158, 0xa804, 0x9055, 0x0130,
+	0xa807, 0x0000, 0x080c, 0x688c, 0x2a48, 0x0cb8, 0x080c, 0x688c,
+	0x00ae, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7814, 0x9085, 0x0080,
+	0x7816, 0xd184, 0x0108, 0x8108, 0x810c, 0x20a9, 0x0001, 0xa860,
+	0x20e8, 0xa85c, 0x9200, 0x20a0, 0x20e1, 0x0000, 0x2300, 0x9e00,
+	0x2098, 0x4003, 0x8318, 0x9386, 0x0020, 0x1148, 0x2018, 0x2300,
+	0x9e00, 0x2098, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816, 0x8109,
+	0x1d80, 0x7817, 0x0000, 0x00fe, 0x0005, 0x0066, 0x0126, 0x2091,
+	0x8000, 0x2031, 0x0001, 0x6020, 0x9084, 0x000f, 0x0083, 0x012e,
+	0x006e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0066, 0x2031, 0x0000,
+	0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x012e, 0x0005, 0xb778,
+	0xb778, 0xb773, 0xb79a, 0xb766, 0xb773, 0xb79a, 0xb773, 0xb766,
+	0xb766, 0xb773, 0xb773, 0xb773, 0xb766, 0xb766, 0x080c, 0x0db4,
+	0x0036, 0x2019, 0x0010, 0x080c, 0xd0e5, 0x6023, 0x0006, 0x6003,
+	0x0007, 0x003e, 0x0005, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005,
+	0x0096, 0x86ff, 0x11d8, 0x6014, 0x2048, 0x080c, 0xbb17, 0x01c0,
+	0xa864, 0x9086, 0x0139, 0x1128, 0xa87b, 0x0005, 0xa883, 0x0000,
+	0x0028, 0x900e, 0x2001, 0x0005, 0x080c, 0x6ac6, 0x080c, 0xbe0c,
+	0x080c, 0x687f, 0x080c, 0x9e62, 0x9085, 0x0001, 0x009e, 0x0005,
+	0x9006, 0x0ce0, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0db4, 0x0002,
+	0xb7b0, 0xb7de, 0xb7b2, 0xb7ff, 0xb7d9, 0xb7b0, 0xb773, 0xb778,
+	0xb778, 0xb773, 0xb773, 0xb773, 0xb773, 0xb773, 0xb773, 0xb773,
+	0x080c, 0x0db4, 0x86ff, 0x1510, 0x6020, 0x9086, 0x0006, 0x01f0,
+	0x0096, 0x6014, 0x2048, 0x080c, 0xbb17, 0x0158, 0xa87c, 0xd0cc,
+	0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x0f9d, 0x009e, 0x080c,
+	0xbe0c, 0x009e, 0x080c, 0xc1cc, 0x6007, 0x0085, 0x6003, 0x000b,
+	0x6023, 0x0002, 0x080c, 0x83f1, 0x080c, 0x8973, 0x9085, 0x0001,
+	0x0005, 0x0066, 0x080c, 0x190d, 0x006e, 0x08a0, 0x00e6, 0x2071,
+	0x19b8, 0x7024, 0x9c06, 0x1120, 0x080c, 0x9662, 0x00ee, 0x0850,
+	0x6020, 0x9084, 0x000f, 0x9086, 0x0006, 0x1150, 0x0086, 0x0096,
+	0x2049, 0x0001, 0x2c40, 0x080c, 0x97ba, 0x009e, 0x008e, 0x0010,
+	0x080c, 0x955f, 0x00ee, 0x1904, 0xb7b2, 0x0804, 0xb773, 0x0036,
+	0x00e6, 0x2071, 0x19b8, 0x703c, 0x9c06, 0x1138, 0x901e, 0x080c,
+	0x96d8, 0x00ee, 0x003e, 0x0804, 0xb7b2, 0x080c, 0x98ea, 0x00ee,
+	0x003e, 0x1904, 0xb7b2, 0x0804, 0xb773, 0x00c6, 0x6020, 0x9084,
+	0x000f, 0x0013, 0x00ce, 0x0005, 0xb832, 0xb8fb, 0xba62, 0xb83c,
+	0x9e62, 0xb832, 0xd0d7, 0xc234, 0xb8fb, 0xb82b, 0xbae1, 0xb82b,
+	0xb82b, 0xb82b, 0xb82b, 0x080c, 0x0db4, 0x080c, 0xbd1d, 0x1110,
+	0x080c, 0xa7c0, 0x0005, 0x080c, 0x886e, 0x080c, 0x8973, 0x0804,
+	0x9e32, 0x601b, 0x0001, 0x0005, 0x080c, 0xbb17, 0x0130, 0x6014,
+	0x0096, 0x2048, 0x2c00, 0xa896, 0x009e, 0x6000, 0x908a, 0x0016,
+	0x1a0c, 0x0db4, 0x0002, 0xb85b, 0xb85d, 0xb881, 0xb895, 0xb8b9,
+	0xb85b, 0xb832, 0xb832, 0xb832, 0xb895, 0xb895, 0xb85b, 0xb85b,
+	0xb85b, 0xb85b, 0xb89f, 0x080c, 0x0db4, 0x00e6, 0x6014, 0x0096,
+	0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x2071, 0x19b8, 0x7024,
+	0x9c06, 0x01a0, 0x080c, 0x955f, 0x080c, 0xc1cc, 0x6007, 0x0085,
+	0x6003, 0x000b, 0x6023, 0x0002, 0x2001, 0x1958, 0x2004, 0x601a,
+	0x080c, 0x83f1, 0x080c, 0x8973, 0x00ee, 0x0005, 0x601b, 0x0001,
+	0x0cd8, 0x0096, 0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e,
+	0x080c, 0xc1cc, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
+	0x080c, 0x83f1, 0x080c, 0x8973, 0x0005, 0x0096, 0x601b, 0x0001,
+	0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x0005, 0x080c,
+	0x538e, 0x01a8, 0x6014, 0x0096, 0x904d, 0x0180, 0xa864, 0xa867,
+	0x0103, 0xa87b, 0x0006, 0x9086, 0x0139, 0x1140, 0xa867, 0x0139,
+	0xa897, 0x4005, 0xa89b, 0x0004, 0x080c, 0x688c, 0x009e, 0x0804,
+	0x9e32, 0x6014, 0x0096, 0x904d, 0x05c8, 0xa97c, 0xd1e4, 0x05b0,
+	0x2001, 0x180f, 0x2004, 0xd0c4, 0x0110, 0x009e, 0x0005, 0xa884,
+	0x009e, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0x2001, 0x0030,
+	0x2c08, 0x080c, 0x1518, 0x2001, 0x030c, 0x2004, 0x9086, 0x0041,
+	0x11a0, 0x6014, 0x0096, 0x904d, 0x090c, 0x0db4, 0xa880, 0xd0f4,
+	0x1130, 0xc0f5, 0xa882, 0x009e, 0x601b, 0x0002, 0x0070, 0x009e,
+	0x2001, 0x0037, 0x2c08, 0x080c, 0x1518, 0x6000, 0x9086, 0x0004,
+	0x1120, 0x2009, 0x0048, 0x080c, 0x9eac, 0x0005, 0x009e, 0x080c,
+	0x190d, 0x0804, 0xb881, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0db4,
+	0x000b, 0x0005, 0xb912, 0xb839, 0xb914, 0xb912, 0xb914, 0xb914,
+	0xb833, 0xb912, 0xb82d, 0xb82d, 0xb912, 0xb912, 0xb912, 0xb912,
+	0xb912, 0xb912, 0x080c, 0x0db4, 0x6010, 0x00b6, 0x2058, 0xb804,
+	0x9084, 0x00ff, 0x00be, 0x908a, 0x000c, 0x1a0c, 0x0db4, 0x00b6,
+	0x0013, 0x00be, 0x0005, 0xb92f, 0xb9fc, 0xb931, 0xb971, 0xb931,
+	0xb971, 0xb931, 0xb93f, 0xb92f, 0xb971, 0xb92f, 0xb960, 0x080c,
+	0x0db4, 0x6004, 0x908e, 0x0016, 0x05c0, 0x908e, 0x0004, 0x05a8,
+	0x908e, 0x0002, 0x0590, 0x908e, 0x0052, 0x0904, 0xb9f8, 0x6004,
+	0x080c, 0xbd1d, 0x0904, 0xba15, 0x908e, 0x0004, 0x1110, 0x080c,
+	0x3003, 0x908e, 0x0021, 0x0904, 0xba19, 0x908e, 0x0022, 0x0904,
+	0xba5d, 0x908e, 0x003d, 0x0904, 0xba19, 0x908e, 0x0039, 0x0904,
+	0xba1d, 0x908e, 0x0035, 0x0904, 0xba1d, 0x908e, 0x001e, 0x0178,
+	0x908e, 0x0001, 0x1140, 0x6010, 0x2058, 0xb804, 0x9084, 0x00ff,
+	0x9086, 0x0006, 0x0110, 0x080c, 0x2fda, 0x080c, 0xa7c0, 0x0804,
+	0x9e62, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0904, 0xb9e9,
+	0x9186, 0x0002, 0x1904, 0xb9be, 0x2001, 0x1836, 0x2004, 0xd08c,
+	0x11c8, 0x080c, 0x6fb2, 0x11b0, 0x080c, 0xc212, 0x0138, 0x080c,
+	0x6fd5, 0x1120, 0x080c, 0x6ec2, 0x0804, 0xba46, 0x2001, 0x194e,
+	0x2003, 0x0001, 0x2001, 0x1800, 0x2003, 0x0001, 0x080c, 0x6ee4,
+	0x0804, 0xba46, 0x6010, 0x2058, 0x2001, 0x1836, 0x2004, 0xd0ac,
+	0x1904, 0xba46, 0xb8a0, 0x9084, 0xff80, 0x1904, 0xba46, 0xb840,
+	0x9084, 0x00ff, 0x9005, 0x0190, 0x8001, 0xb842, 0x6017, 0x0000,
+	0x6023, 0x0007, 0x601b, 0x0398, 0x6043, 0x0000, 0x080c, 0x9ddc,
+	0x0128, 0x2b00, 0x6012, 0x6023, 0x0001, 0x0458, 0x00de, 0x00ce,
+	0x6004, 0x908e, 0x0002, 0x11a0, 0x6010, 0x2058, 0xb8a0, 0x9086,
+	0x007e, 0x1170, 0x2009, 0x1836, 0x2104, 0xc085, 0x200a, 0x00e6,
+	0x2071, 0x1800, 0x080c, 0x5c64, 0x00ee, 0x080c, 0xa7c0, 0x0030,
+	0x080c, 0xa7c0, 0x080c, 0x2fda, 0x080c, 0xc227, 0x00e6, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x3003, 0x012e, 0x00ee, 0x080c, 0x9e62,
+	0x0005, 0x2001, 0x0002, 0x080c, 0x618f, 0x6003, 0x0001, 0x6007,
+	0x0002, 0x080c, 0x8439, 0x080c, 0x8973, 0x00de, 0x00ce, 0x0c80,
+	0x080c, 0x3003, 0x0804, 0xb96d, 0x00c6, 0x00d6, 0x6104, 0x9186,
+	0x0016, 0x0d38, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005,
+	0x0904, 0xb9be, 0x8001, 0xb842, 0x6003, 0x0001, 0x080c, 0x8439,
+	0x080c, 0x8973, 0x00de, 0x00ce, 0x0898, 0x080c, 0xa7c0, 0x0804,
+	0xb96f, 0x080c, 0xa7fc, 0x0804, 0xb96f, 0x00d6, 0x2c68, 0x6104,
+	0x080c, 0xc18a, 0x00de, 0x0118, 0x080c, 0x9e32, 0x00f0, 0x6004,
+	0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085,
+	0x6003, 0x000b, 0x6023, 0x0002, 0x603c, 0x600a, 0x2001, 0x1958,
+	0x2004, 0x601a, 0x602c, 0x2c08, 0x2060, 0x6024, 0xc0b5, 0x6026,
+	0x2160, 0x080c, 0x83f1, 0x080c, 0x8973, 0x0005, 0x00de, 0x00ce,
+	0x080c, 0xa7c0, 0x080c, 0x2fda, 0x00e6, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x3003, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398,
+	0x6043, 0x0000, 0x012e, 0x00ee, 0x0005, 0x080c, 0xa261, 0x1904,
+	0xba15, 0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0db4, 0x0096,
+	0x00d6, 0x001b, 0x00de, 0x009e, 0x0005, 0xba7d, 0xba7d, 0xba7d,
+	0xba7d, 0xba7d, 0xba7d, 0xba7d, 0xba7d, 0xba7d, 0xb832, 0xba7d,
+	0xb839, 0xba7f, 0xb839, 0xba8c, 0xba7d, 0x080c, 0x0db4, 0x6004,
+	0x9086, 0x008b, 0x0148, 0x6007, 0x008b, 0x6003, 0x000d, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x0005, 0x080c, 0xc206, 0x0118, 0x080c,
+	0xc219, 0x0010, 0x080c, 0xc227, 0x080c, 0xbd00, 0x080c, 0xbb17,
+	0x0570, 0x080c, 0x2fda, 0x080c, 0xbb17, 0x0168, 0x6014, 0x2048,
+	0xa867, 0x0103, 0xa87b, 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ed,
+	0xa882, 0x080c, 0x688c, 0x2c68, 0x080c, 0x9ddc, 0x0150, 0x6810,
+	0x6012, 0x080c, 0xbf8c, 0x00c6, 0x2d60, 0x080c, 0x9e62, 0x00ce,
+	0x0008, 0x2d60, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001,
+	0x6003, 0x0001, 0x080c, 0x8439, 0x080c, 0x8973, 0x00c8, 0x080c,
+	0xc206, 0x0138, 0x6034, 0x9086, 0x4000, 0x1118, 0x080c, 0x2fda,
+	0x08d0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
+	0x9186, 0x0035, 0x1118, 0x080c, 0x2fda, 0x0868, 0x080c, 0x9e62,
+	0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0db4, 0x0002, 0xbaf7,
+	0xbaf7, 0xbaf9, 0xbaf9, 0xbaf9, 0xbaf7, 0xbaf7, 0x9e62, 0xbaf7,
+	0xbaf7, 0xbaf7, 0xbaf7, 0xbaf7, 0xbaf7, 0xbaf7, 0xbaf7, 0x080c,
+	0x0db4, 0x080c, 0x98ea, 0x6114, 0x0096, 0x2148, 0xa87b, 0x0006,
+	0x080c, 0x688c, 0x009e, 0x0804, 0x9e32, 0x9284, 0x0007, 0x1158,
+	0x9282, 0x1cd0, 0x0240, 0x2001, 0x1819, 0x2004, 0x9202, 0x1218,
+	0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x0096, 0x0028, 0x0096,
+	0x0006, 0x6014, 0x2048, 0x000e, 0x0006, 0x9984, 0xf000, 0x9086,
+	0xf000, 0x0110, 0x080c, 0x1096, 0x000e, 0x009e, 0x0005, 0x00e6,
+	0x00c6, 0x0036, 0x0006, 0x0126, 0x2091, 0x8000, 0x2061, 0x1cd0,
+	0x2071, 0x1800, 0x7350, 0x7070, 0x9302, 0x1640, 0x6020, 0x9206,
+	0x11f8, 0x080c, 0xc212, 0x0180, 0x9286, 0x0001, 0x1168, 0x6004,
+	0x9086, 0x0004, 0x1148, 0x080c, 0x2fda, 0x080c, 0xc227, 0x00c6,
+	0x080c, 0x9e62, 0x00ce, 0x0060, 0x080c, 0xbf06, 0x0148, 0x080c,
+	0xbd1d, 0x1110, 0x080c, 0xa7c0, 0x00c6, 0x080c, 0x9e32, 0x00ce,
+	0x9ce0, 0x0018, 0x7064, 0x9c02, 0x1208, 0x08a0, 0x012e, 0x000e,
+	0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0016, 0x9188,
+	0x1000, 0x210c, 0x81ff, 0x0128, 0x2061, 0x1a80, 0x6112, 0x080c,
+	0x2fda, 0x9006, 0x0010, 0x9085, 0x0001, 0x001e, 0x00ce, 0x00ee,
+	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9ddc, 0x01b0,
+	0x6656, 0x2b00, 0x6012, 0x080c, 0x538e, 0x0118, 0x080c, 0xbc44,
+	0x0168, 0x080c, 0xbf8c, 0x6023, 0x0003, 0x2009, 0x004b, 0x080c,
+	0x9eac, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
+	0x00c6, 0x0126, 0x2091, 0x8000, 0xbaa0, 0x080c, 0x9e7f, 0x0560,
+	0x6057, 0x0000, 0x2b00, 0x6012, 0x080c, 0xbf8c, 0x6023, 0x0003,
+	0x0016, 0x080c, 0x8571, 0x0076, 0x903e, 0x080c, 0x8469, 0x2c08,
+	0x080c, 0xd29b, 0x007e, 0x001e, 0xd184, 0x0128, 0x080c, 0x9e32,
+	0x9085, 0x0001, 0x0070, 0x080c, 0x538e, 0x0128, 0xd18c, 0x1170,
+	0x080c, 0xbc44, 0x0148, 0x2009, 0x004c, 0x080c, 0x9eac, 0x9085,
+	0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2900, 0x6016,
+	0x0c90, 0x2009, 0x004d, 0x0010, 0x2009, 0x004e, 0x00f6, 0x00c6,
+	0x0046, 0x0016, 0x080c, 0x9ddc, 0x2c78, 0x0590, 0x7e56, 0x2b00,
+	0x7812, 0x7823, 0x0003, 0x2021, 0x0005, 0x080c, 0xbc56, 0x9186,
+	0x004d, 0x0118, 0x9186, 0x004e, 0x0148, 0x2001, 0x1951, 0x200c,
+	0xd1fc, 0x0168, 0x2f60, 0x080c, 0x9e32, 0x00d0, 0x2001, 0x1950,
+	0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c, 0x9e32, 0x0088, 0x2f60,
+	0x080c, 0x538e, 0x0138, 0xd18c, 0x1118, 0x04f1, 0x0148, 0x0010,
+	0x2900, 0x7816, 0x001e, 0x0016, 0x080c, 0x9eac, 0x9085, 0x0001,
+	0x001e, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x00f6, 0x00c6, 0x0046,
+	0x080c, 0x9ddc, 0x2c78, 0x0508, 0x7e56, 0x2b00, 0x7812, 0x7823,
+	0x0003, 0x0096, 0x2021, 0x0004, 0x0489, 0x009e, 0x2001, 0x194f,
+	0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c, 0x9e32, 0x0060, 0x2f60,
+	0x080c, 0x538e, 0x0120, 0xd18c, 0x1160, 0x0071, 0x0130, 0x2009,
+	0x0052, 0x080c, 0x9eac, 0x9085, 0x0001, 0x004e, 0x00ce, 0x00fe,
+	0x0005, 0x2900, 0x7816, 0x0c98, 0x00c6, 0x080c, 0x4879, 0x00ce,
+	0x1120, 0x080c, 0x9e32, 0x9006, 0x0005, 0xa867, 0x0000, 0xa86b,
+	0x8000, 0x2900, 0x6016, 0x9085, 0x0001, 0x0005, 0x0096, 0x0076,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x6372, 0x0158, 0x2001, 0xbc5b,
+	0x0006, 0x900e, 0x2400, 0x080c, 0x6ac6, 0x080c, 0x688c, 0x000e,
+	0x0807, 0x2418, 0x080c, 0x8808, 0xbaa0, 0x0086, 0x2041, 0x0001,
+	0x2039, 0x0001, 0x2608, 0x080c, 0x8589, 0x008e, 0x080c, 0x8469,
+	0x2f08, 0x2648, 0x080c, 0xd29b, 0xb93c, 0x81ff, 0x090c, 0x865a,
+	0x080c, 0x8973, 0x012e, 0x007e, 0x009e, 0x0005, 0x00c6, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x9ddc, 0x0190, 0x660a, 0x2b08, 0x6112,
+	0x080c, 0xbf8c, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x001f,
+	0x080c, 0x9eac, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
+	0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9e7f, 0x01b8,
+	0x660a, 0x2b08, 0x6112, 0x080c, 0xbf8c, 0x6023, 0x0008, 0x2900,
+	0x6016, 0x00f6, 0x2c78, 0x080c, 0x1648, 0x00fe, 0x2009, 0x0021,
+	0x080c, 0x9eac, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
+	0x0cd8, 0x2009, 0x003d, 0x00c6, 0x0126, 0x0016, 0x2091, 0x8000,
+	0x080c, 0x9ddc, 0x0198, 0x660a, 0x2b08, 0x6112, 0x080c, 0xbf8c,
+	0x6023, 0x0001, 0x2900, 0x6016, 0x001e, 0x0016, 0x080c, 0x9eac,
+	0x9085, 0x0001, 0x001e, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd0,
+	0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9e7f, 0x0188, 0x2b08,
+	0x6112, 0x080c, 0xbf8c, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009,
+	0x0000, 0x080c, 0x9eac, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
+	0x9006, 0x0cd8, 0x2009, 0x0044, 0x0830, 0x2009, 0x0049, 0x0818,
+	0x0026, 0x00b6, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211,
+	0xba3e, 0x00be, 0x002e, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e,
+	0x0002, 0x0140, 0x908e, 0x0003, 0x0128, 0x908e, 0x0004, 0x0110,
+	0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0096, 0x6020,
+	0x9086, 0x0004, 0x0190, 0x6014, 0x904d, 0x080c, 0xbb17, 0x0168,
+	0xa864, 0x9086, 0x0139, 0x0158, 0x6020, 0x9086, 0x0003, 0x0128,
+	0xa868, 0xd0fc, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x009e,
+	0x000e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9e7f,
+	0x0198, 0x2b08, 0x6112, 0x080c, 0xbf8c, 0x6023, 0x0001, 0x2900,
+	0x6016, 0x080c, 0x2fda, 0x2009, 0x0028, 0x080c, 0x9eac, 0x9085,
+	0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x9186, 0x0015,
+	0x11a8, 0x2011, 0x1823, 0x2204, 0x9086, 0x0074, 0x1178, 0x00b6,
+	0x080c, 0xaa49, 0x00be, 0x080c, 0xac88, 0x6003, 0x0001, 0x6007,
+	0x0029, 0x080c, 0x8439, 0x080c, 0x8973, 0x0078, 0x6014, 0x0096,
+	0x2048, 0xa868, 0x009e, 0xd0fc, 0x0148, 0x2001, 0x0001, 0x080c,
+	0xc14b, 0x080c, 0xa7c0, 0x080c, 0x9e32, 0x0005, 0x0096, 0x6014,
+	0x904d, 0x090c, 0x0db4, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
+	0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x688c, 0x012e, 0x009e, 0x080c, 0x9e32, 0x0c30, 0x0096,
+	0x9186, 0x0016, 0x1128, 0x2001, 0x0004, 0x080c, 0x618f, 0x00e8,
+	0x9186, 0x0015, 0x1510, 0x2011, 0x1823, 0x2204, 0x9086, 0x0014,
+	0x11e0, 0x6010, 0x00b6, 0x2058, 0x080c, 0x62d9, 0x00be, 0x080c,
+	0xad59, 0x1198, 0x6010, 0x00b6, 0x2058, 0xb890, 0x00be, 0x9005,
+	0x0160, 0x2001, 0x0006, 0x080c, 0x618f, 0x6014, 0x2048, 0xa868,
+	0xd0fc, 0x0170, 0x080c, 0xa235, 0x0048, 0x6014, 0x2048, 0xa868,
+	0xd0fc, 0x0528, 0x080c, 0xa7c0, 0x080c, 0x9e32, 0x009e, 0x0005,
+	0x6014, 0x6310, 0x2358, 0x904d, 0x090c, 0x0db4, 0xa87b, 0x0000,
+	0xa883, 0x0000, 0xa897, 0x4000, 0x900e, 0x080c, 0x645e, 0x1108,
+	0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xa99a, 0x0126, 0x2091,
+	0x8000, 0x080c, 0x688c, 0x012e, 0x080c, 0x9e32, 0x08f8, 0x6014,
+	0x904d, 0x090c, 0x0db4, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
+	0x4005, 0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x688c, 0x012e, 0x080c, 0x9e32, 0x0840, 0xa878, 0x9086,
+	0x0005, 0x1108, 0x0009, 0x0005, 0xa880, 0xc0ad, 0xa882, 0x0005,
+	0x6043, 0x0000, 0x6017, 0x0000, 0x6003, 0x0001, 0x6007, 0x0050,
+	0x080c, 0x83f1, 0x080c, 0x8973, 0x0005, 0x00c6, 0x6010, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0bc, 0x0120, 0x6020, 0x9084, 0x000f,
+	0x0013, 0x00ce, 0x0005, 0xb832, 0xbe3c, 0xbe3c, 0xbe3f, 0xd579,
+	0xd594, 0xd597, 0xb832, 0xb832, 0xb832, 0xb832, 0xb832, 0xb832,
+	0xb832, 0xb832, 0x080c, 0x0db4, 0xa001, 0xa001, 0x0005, 0x0096,
+	0x6014, 0x904d, 0x0118, 0xa87c, 0xd0e4, 0x1110, 0x009e, 0x0010,
+	0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
+	0x0550, 0x2001, 0x1833, 0x2004, 0x9005, 0x1540, 0x00f6, 0x2c78,
+	0x080c, 0x9ddc, 0x0508, 0x7810, 0x6012, 0x080c, 0xbf8c, 0x7820,
+	0x9086, 0x0003, 0x0128, 0x7808, 0x603a, 0x2f00, 0x603e, 0x0020,
+	0x7808, 0x603e, 0x2f00, 0x603a, 0x602e, 0x6023, 0x0001, 0x6007,
+	0x0035, 0x6003, 0x0001, 0x7954, 0x6156, 0x080c, 0x83f1, 0x080c,
+	0x8973, 0x2f60, 0x00fe, 0x0005, 0x2f60, 0x00fe, 0x2001, 0x1959,
+	0x2004, 0x6042, 0x0005, 0x0016, 0x0096, 0x6814, 0x2048, 0xa87c,
+	0xd0e4, 0x0180, 0xc0e4, 0xa87e, 0xa877, 0x0000, 0xa893, 0x0000,
+	0xa88f, 0x0000, 0xd0cc, 0x0130, 0xc0cc, 0xa87e, 0xa878, 0x2048,
+	0x080c, 0x0f9d, 0x6830, 0x6036, 0x908e, 0x0001, 0x0148, 0x6803,
+	0x0002, 0x9086, 0x0005, 0x0170, 0x9006, 0x602e, 0x6032, 0x00d0,
+	0x681c, 0xc085, 0x681e, 0x6803, 0x0004, 0x6824, 0xc0f4, 0x9085,
+	0x0c00, 0x6826, 0x6814, 0x2048, 0xa8ac, 0x6938, 0x9102, 0xa8b0,
+	0x693c, 0x9103, 0x1e48, 0x683c, 0x602e, 0x6838, 0x9084, 0xfffc,
+	0x683a, 0x6032, 0x2d00, 0x603a, 0x6808, 0x603e, 0x6910, 0x6112,
+	0x6954, 0x6156, 0x6023, 0x0001, 0x6007, 0x0039, 0x6003, 0x0001,
+	0x080c, 0x83f1, 0x080c, 0x8973, 0x009e, 0x001e, 0x0005, 0x6024,
+	0xd0d4, 0x0510, 0xd0f4, 0x11f8, 0x6038, 0x940a, 0x603c, 0x9303,
+	0x0230, 0x9105, 0x0120, 0x6024, 0xc0d4, 0xc0f5, 0x0098, 0x643a,
+	0x633e, 0xac3e, 0xab42, 0x0046, 0x0036, 0x2400, 0xacac, 0x9402,
+	0xa836, 0x2300, 0xabb0, 0x9303, 0xa83a, 0x003e, 0x004e, 0x6024,
+	0xc0d4, 0x0000, 0x6026, 0x0005, 0xd0f4, 0x1138, 0xa83c, 0x603a,
+	0xa840, 0x603e, 0x6024, 0xc0f5, 0x6026, 0x0005, 0x0006, 0x0016,
+	0x6004, 0x908e, 0x0034, 0x01b8, 0x908e, 0x0035, 0x01a0, 0x908e,
+	0x0036, 0x0188, 0x908e, 0x0037, 0x0170, 0x908e, 0x0038, 0x0158,
+	0x908e, 0x0039, 0x0140, 0x908e, 0x003a, 0x0128, 0x908e, 0x003b,
+	0x0110, 0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016,
+	0x0026, 0x0036, 0x00e6, 0x2001, 0x1953, 0x200c, 0x8000, 0x2014,
+	0x2001, 0x0032, 0x080c, 0x8270, 0x2001, 0x1957, 0x82ff, 0x1110,
+	0x2011, 0x0014, 0x2202, 0x2001, 0x1955, 0x200c, 0x8000, 0x2014,
+	0x2071, 0x193d, 0x711a, 0x721e, 0x2001, 0x0064, 0x080c, 0x8270,
+	0x2001, 0x1958, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001,
+	0x1959, 0x9288, 0x000a, 0x2102, 0x2001, 0x1a61, 0x2102, 0x2001,
+	0x0032, 0x080c, 0x1518, 0x080c, 0x6543, 0x00ee, 0x003e, 0x002e,
+	0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x00e6, 0x2001, 0x1957,
+	0x2003, 0x0028, 0x2001, 0x1958, 0x2003, 0x0014, 0x2071, 0x193d,
+	0x701b, 0x0000, 0x701f, 0x07d0, 0x2001, 0x1959, 0x2009, 0x001e,
+	0x2102, 0x2001, 0x1a61, 0x2102, 0x2001, 0x0032, 0x080c, 0x1518,
+	0x00ee, 0x001e, 0x000e, 0x0005, 0x0096, 0x6058, 0x904d, 0x0110,
+	0x080c, 0x101d, 0x009e, 0x0005, 0x0005, 0x00c6, 0x0126, 0x2091,
+	0x8000, 0x080c, 0x9ddc, 0x0180, 0x2b08, 0x6112, 0x0ca9, 0x6023,
+	0x0001, 0x2900, 0x6016, 0x2009, 0x0033, 0x080c, 0x9eac, 0x9085,
+	0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x00e6,
+	0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x1500, 0x708c, 0x9086,
+	0x0018, 0x11e0, 0x6014, 0x2048, 0xaa3c, 0xd2e4, 0x1160, 0x2c78,
+	0x080c, 0x8b63, 0x01d8, 0x7078, 0xaa50, 0x9206, 0x1160, 0x707c,
+	0xaa54, 0x9206, 0x1140, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be,
+	0x900e, 0x080c, 0x3023, 0x080c, 0xa235, 0x0020, 0x080c, 0xa7c0,
+	0x080c, 0x9e32, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c, 0xaa54,
+	0x9206, 0x0d48, 0x0c80, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x9ddc, 0x0188, 0x2b08, 0x6112, 0x080c, 0xbf8c, 0x6023, 0x0001,
+	0x2900, 0x6016, 0x2009, 0x004d, 0x080c, 0x9eac, 0x9085, 0x0001,
+	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091,
+	0x8000, 0x0016, 0x080c, 0x9ddc, 0x0180, 0x2b08, 0x6112, 0x080c,
+	0xbf8c, 0x6023, 0x0001, 0x2900, 0x6016, 0x001e, 0x080c, 0x9eac,
+	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x001e, 0x9006, 0x0cd0,
+	0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0066, 0x0096, 0x00e6,
+	0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x1568, 0x718c, 0x6014,
+	0x2048, 0xa814, 0x8003, 0x9106, 0x1530, 0x20e1, 0x0000, 0x2001,
+	0x1971, 0x2003, 0x0000, 0x6014, 0x2048, 0xa830, 0x20a8, 0x8906,
+	0x8006, 0x8007, 0x9094, 0x003f, 0x22e8, 0x9084, 0xffc0, 0x9080,
+	0x001b, 0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x080c, 0xc7ce,
+	0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c38, 0x6014, 0x2048,
+	0xa867, 0x0103, 0x0010, 0x080c, 0xa7c0, 0x080c, 0x9e32, 0x00fe,
+	0x00ee, 0x009e, 0x006e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e,
+	0x0005, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015,
+	0x11b8, 0x708c, 0x9086, 0x0004, 0x1198, 0x6014, 0x2048, 0x2c78,
+	0x080c, 0x8b63, 0x01a8, 0x7078, 0xaa74, 0x9206, 0x1130, 0x707c,
+	0xaa78, 0x9206, 0x1110, 0x080c, 0x2fda, 0x080c, 0xa235, 0x0020,
+	0x080c, 0xa7c0, 0x080c, 0x9e32, 0x00fe, 0x00ee, 0x009e, 0x0005,
+	0x705c, 0xaa78, 0x9206, 0x0d78, 0x0c80, 0x0096, 0x00e6, 0x00f6,
+	0x2071, 0x1800, 0x9186, 0x0015, 0x1550, 0x708c, 0x9086, 0x0004,
+	0x1530, 0x6014, 0x2048, 0x2c78, 0x080c, 0x8b63, 0x05f0, 0x7078,
+	0xaacc, 0x9206, 0x1180, 0x707c, 0xaad0, 0x9206, 0x1160, 0x080c,
+	0x2fda, 0x0016, 0xa998, 0xaab0, 0x9284, 0x1000, 0xc0fd, 0x080c,
+	0x533e, 0x001e, 0x0010, 0x080c, 0x512f, 0x080c, 0xbb17, 0x0508,
+	0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0080, 0x080c,
+	0xbb17, 0x01b8, 0x6014, 0x2048, 0x080c, 0x512f, 0x1d70, 0xa87b,
+	0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0x0126,
+	0x2091, 0x8000, 0xa867, 0x0139, 0x080c, 0x688c, 0x012e, 0x080c,
+	0x9e32, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c, 0xaad0, 0x9206,
+	0x0930, 0x0888, 0x0016, 0x0026, 0xa87c, 0xd0ac, 0x0178, 0xa938,
+	0xaa34, 0x2100, 0x9205, 0x0150, 0xa890, 0x9106, 0x1118, 0xa88c,
+	0x9206, 0x0120, 0xa992, 0xaa8e, 0x9085, 0x0001, 0x002e, 0x001e,
+	0x0005, 0x00b6, 0x00d6, 0x0036, 0x080c, 0xbb17, 0x0904, 0xc147,
+	0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x929e, 0x4000, 0x1580,
+	0x6310, 0x00c6, 0x2358, 0x2009, 0x0000, 0xa868, 0xd0f4, 0x1140,
+	0x080c, 0x645e, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0xaa96, 0xa99a, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x0031, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098,
+	0x080c, 0x0f68, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x0035, 0x20a0,
+	0xb8b8, 0x9080, 0x000a, 0x2098, 0x080c, 0x0f68, 0x00ce, 0x0090,
+	0xaa96, 0x3918, 0x9398, 0x0007, 0x231c, 0x6004, 0x9086, 0x0016,
+	0x0110, 0xa89b, 0x0004, 0xaba2, 0x6310, 0x2358, 0xb804, 0x9084,
+	0x00ff, 0xa89e, 0x080c, 0x687f, 0x6017, 0x0000, 0x009e, 0x003e,
+	0x00de, 0x00be, 0x0005, 0x0026, 0x0036, 0x0046, 0x00b6, 0x0096,
+	0x00f6, 0x6214, 0x2248, 0x6210, 0x2258, 0x2079, 0x0260, 0x9096,
+	0x0000, 0x11a0, 0xb814, 0x9084, 0x00ff, 0x900e, 0x080c, 0x2663,
+	0x2118, 0x831f, 0x939c, 0xff00, 0x7838, 0x9084, 0x00ff, 0x931d,
+	0x7c3c, 0x2011, 0x8018, 0x080c, 0x48d9, 0x00a8, 0x9096, 0x0001,
+	0x1148, 0x89ff, 0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c,
+	0xa8aa, 0x0048, 0x9096, 0x0002, 0x1130, 0xa89b, 0x000d, 0x7838,
+	0xa8a6, 0x783c, 0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e, 0x003e,
+	0x002e, 0x0005, 0x00c6, 0x0026, 0x0016, 0x9186, 0x0035, 0x0110,
+	0x6a38, 0x0008, 0x6a2c, 0x080c, 0xbb05, 0x01f0, 0x2260, 0x6120,
+	0x9186, 0x0003, 0x0118, 0x9186, 0x0006, 0x1190, 0x6838, 0x9206,
+	0x0140, 0x683c, 0x9206, 0x1160, 0x6108, 0x6838, 0x9106, 0x1140,
+	0x0020, 0x6008, 0x693c, 0x9106, 0x1118, 0x6010, 0x6910, 0x9106,
+	0x001e, 0x002e, 0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8, 0xa974,
+	0xd1cc, 0x0188, 0x918c, 0x00ff, 0x918e, 0x0002, 0x1160, 0xa9a8,
+	0x918c, 0x0f00, 0x810f, 0x918e, 0x0001, 0x1128, 0xa834, 0xa938,
+	0x9115, 0x190c, 0xb227, 0x0005, 0x0036, 0x2019, 0x0001, 0x0010,
+	0x0036, 0x901e, 0x0499, 0x01e0, 0x080c, 0xbb17, 0x01c8, 0x080c,
+	0xbd00, 0x6037, 0x4000, 0x6014, 0x6017, 0x0000, 0x0096, 0x2048,
+	0xa87c, 0x080c, 0xbd1d, 0x1118, 0x080c, 0xa7c0, 0x0040, 0xa867,
+	0x0103, 0xa877, 0x0000, 0x83ff, 0x1129, 0x080c, 0x688c, 0x009e,
+	0x003e, 0x0005, 0xa880, 0xd0b4, 0x0128, 0xa87b, 0x0006, 0xc0ec,
+	0xa882, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b,
+	0x0005, 0x080c, 0xbe0c, 0xa877, 0x0000, 0x0005, 0x2001, 0x1810,
+	0x2004, 0xd0ec, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0f4,
+	0x000e, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0e4, 0x000e,
+	0x0005, 0x0036, 0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be,
+	0x2021, 0x0007, 0x080c, 0x4a76, 0x004e, 0x003e, 0x0005, 0x0c51,
+	0x1d81, 0x0005, 0x2001, 0x1957, 0x2004, 0x601a, 0x0005, 0x2001,
+	0x1959, 0x2004, 0x6042, 0x0005, 0x080c, 0x9e32, 0x0804, 0x8973,
+	0x00b6, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0db4, 0x001b,
+	0x006e, 0x00be, 0x0005, 0xc253, 0xc92b, 0xca86, 0xc253, 0xc253,
+	0xc253, 0xc253, 0xc253, 0xc28a, 0xcb08, 0xc253, 0xc253, 0xc253,
+	0xc253, 0xc253, 0xc253, 0x080c, 0x0db4, 0x0066, 0x6000, 0x90b2,
+	0x0016, 0x1a0c, 0x0db4, 0x0013, 0x006e, 0x0005, 0xc26e, 0xd070,
+	0xc26e, 0xc26e, 0xc26e, 0xc26e, 0xc26e, 0xc26e, 0xd01d, 0xd0c4,
+	0xc26e, 0xd6b4, 0xd6ea, 0xd6b4, 0xd6ea, 0xc26e, 0x080c, 0x0db4,
+	0x6000, 0x9082, 0x0016, 0x1a0c, 0x0db4, 0x6000, 0x000a, 0x0005,
+	0xc288, 0xcce5, 0xcdd5, 0xcdf7, 0xceb6, 0xc288, 0xcf94, 0xcf3e,
+	0xcb14, 0xcff3, 0xd008, 0xc288, 0xc288, 0xc288, 0xc288, 0xc288,
+	0x080c, 0x0db4, 0x91b2, 0x0053, 0x1a0c, 0x0db4, 0x2100, 0x91b2,
+	0x0040, 0x1a04, 0xc6cc, 0x0002, 0xc2d4, 0xc4bd, 0xc2d4, 0xc2d4,
+	0xc2d4, 0xc4c6, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4,
+	0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4,
+	0xc2d4, 0xc2d4, 0xc2d4, 0xc2d6, 0xc339, 0xc348, 0xc3ac, 0xc3d7,
+	0xc44f, 0xc4a8, 0xc2d4, 0xc2d4, 0xc4c9, 0xc2d4, 0xc2d4, 0xc4de,
+	0xc4eb, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4, 0xc2d4, 0xc56e, 0xc2d4,
+	0xc2d4, 0xc582, 0xc2d4, 0xc2d4, 0xc53d, 0xc2d4, 0xc2d4, 0xc2d4,
+	0xc59a, 0xc2d4, 0xc2d4, 0xc2d4, 0xc617, 0xc2d4, 0xc2d4, 0xc2d4,
+	0xc2d4, 0xc2d4, 0xc2d4, 0xc694, 0x080c, 0x0db4, 0x080c, 0x6520,
+	0x1150, 0x2001, 0x1836, 0x2004, 0xd0cc, 0x1128, 0x9084, 0x0009,
+	0x9086, 0x0008, 0x1140, 0x6007, 0x0009, 0x602f, 0x0009, 0x6017,
+	0x0000, 0x0804, 0xc4b6, 0x080c, 0x6509, 0x00e6, 0x00c6, 0x0036,
+	0x0026, 0x0016, 0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029,
+	0x080c, 0x8571, 0x0076, 0x903e, 0x080c, 0x8469, 0x2c08, 0x080c,
+	0xd29b, 0x007e, 0x001e, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee,
+	0x6610, 0x2658, 0x080c, 0x624d, 0xbe04, 0x9684, 0x00ff, 0x9082,
+	0x0006, 0x1268, 0x0016, 0x0026, 0x6210, 0x00b6, 0x2258, 0xbaa0,
+	0x00be, 0x2c08, 0x080c, 0xd862, 0x002e, 0x001e, 0x1178, 0x080c,
+	0xd1ce, 0x1904, 0xc3a4, 0x080c, 0xd16a, 0x1120, 0x6007, 0x0008,
+	0x0804, 0xc4b6, 0x6007, 0x0009, 0x0804, 0xc4b6, 0x080c, 0xd3c5,
+	0x0128, 0x080c, 0xd1ce, 0x0d78, 0x0804, 0xc3a4, 0x6017, 0x1900,
+	0x0c88, 0x080c, 0x30fd, 0x1904, 0xc6c9, 0x6106, 0x080c, 0xd11f,
+	0x6007, 0x0006, 0x0804, 0xc4b6, 0x6007, 0x0007, 0x0804, 0xc4b6,
+	0x080c, 0xd726, 0x1904, 0xc6c9, 0x080c, 0x30fd, 0x1904, 0xc6c9,
+	0x00d6, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006,
+	0x1220, 0x2001, 0x0001, 0x080c, 0x617b, 0x96b4, 0xff00, 0x8637,
+	0x9686, 0x0006, 0x0188, 0x9686, 0x0004, 0x0170, 0xbe04, 0x96b4,
+	0x00ff, 0x9686, 0x0006, 0x0140, 0x9686, 0x0004, 0x0128, 0x9686,
+	0x0005, 0x0110, 0x00de, 0x0480, 0x00e6, 0x2071, 0x0260, 0x7034,
+	0x9084, 0x0003, 0x1140, 0x7034, 0x9082, 0x0014, 0x0220, 0x7030,
+	0x9084, 0x0003, 0x0130, 0x00ee, 0x6017, 0x0000, 0x602f, 0x0007,
+	0x00b0, 0x00ee, 0x080c, 0xd231, 0x1190, 0x9686, 0x0006, 0x1140,
+	0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c, 0x3023, 0x002e,
+	0x080c, 0x62d9, 0x6007, 0x000a, 0x00de, 0x0804, 0xc4b6, 0x6007,
+	0x000b, 0x00de, 0x0804, 0xc4b6, 0x080c, 0x2fda, 0x080c, 0xc227,
+	0x6007, 0x0001, 0x0804, 0xc4b6, 0x080c, 0xd726, 0x1904, 0xc6c9,
+	0x080c, 0x30fd, 0x1904, 0xc6c9, 0x2071, 0x0260, 0x7034, 0x90b4,
+	0x0003, 0x1948, 0x90b2, 0x0014, 0x0a30, 0x7030, 0x9084, 0x0003,
+	0x1910, 0x6610, 0x2658, 0xbe04, 0x9686, 0x0707, 0x09e8, 0x0026,
+	0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c, 0x3023, 0x002e, 0x6007,
+	0x000c, 0x2001, 0x0001, 0x080c, 0xd842, 0x0804, 0xc4b6, 0x080c,
+	0x6520, 0x1140, 0x2001, 0x1836, 0x2004, 0x9084, 0x0009, 0x9086,
+	0x0008, 0x1110, 0x0804, 0xc2e3, 0x080c, 0x6509, 0x6610, 0x2658,
+	0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x06c0, 0x1138, 0x0026,
+	0x2001, 0x0006, 0x080c, 0x61bb, 0x002e, 0x0050, 0x96b4, 0xff00,
+	0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xc3a4,
+	0x080c, 0xd23e, 0x1120, 0x6007, 0x000e, 0x0804, 0xc4b6, 0x0046,
+	0x6410, 0x2458, 0xbca0, 0x0046, 0x080c, 0x2fda, 0x080c, 0xc227,
+	0x004e, 0x0016, 0x9006, 0x2009, 0x1854, 0x210c, 0x0048, 0x2009,
+	0x0029, 0x080c, 0xd52a, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802,
+	0x001e, 0x004e, 0x6007, 0x0001, 0x0804, 0xc4b6, 0x2001, 0x0001,
+	0x080c, 0x617b, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004,
+	0x2019, 0x1805, 0x2011, 0x0270, 0x080c, 0xadf9, 0x003e, 0x002e,
+	0x001e, 0x015e, 0x9005, 0x0168, 0x96b4, 0xff00, 0x8637, 0x9682,
+	0x0004, 0x0a04, 0xc3a4, 0x9682, 0x0007, 0x0a04, 0xc400, 0x0804,
+	0xc3a4, 0x6017, 0x1900, 0x6007, 0x0009, 0x0804, 0xc4b6, 0x080c,
+	0x6520, 0x1140, 0x2001, 0x1836, 0x2004, 0x9084, 0x0009, 0x9086,
+	0x0008, 0x1110, 0x0804, 0xc2e3, 0x080c, 0x6509, 0x6610, 0x2658,
+	0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x0690, 0x0150, 0x96b4,
+	0xff00, 0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904,
+	0xc3a4, 0x080c, 0xd26c, 0x1130, 0x080c, 0xd16a, 0x1118, 0x6007,
+	0x0010, 0x04e0, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046, 0x080c,
+	0x2fda, 0x080c, 0xc227, 0x004e, 0x0016, 0x9006, 0x2009, 0x1854,
+	0x210c, 0x0048, 0x2009, 0x0029, 0x080c, 0xd52a, 0x6010, 0x2058,
+	0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007, 0x0001, 0x00f0,
+	0x080c, 0xd3c5, 0x0140, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006,
+	0x0980, 0x0804, 0xc3a4, 0x6017, 0x1900, 0x6007, 0x0009, 0x0070,
+	0x080c, 0x30fd, 0x1904, 0xc6c9, 0x080c, 0xd726, 0x1904, 0xc6c9,
+	0x080c, 0xc869, 0x1904, 0xc3a4, 0x6007, 0x0012, 0x6003, 0x0001,
+	0x080c, 0x8439, 0x080c, 0x8973, 0x0005, 0x6007, 0x0001, 0x6003,
+	0x0001, 0x080c, 0x8439, 0x080c, 0x8973, 0x0cb0, 0x6007, 0x0005,
+	0x0c68, 0x080c, 0xd726, 0x1904, 0xc6c9, 0x080c, 0x30fd, 0x1904,
+	0xc6c9, 0x080c, 0xc869, 0x1904, 0xc3a4, 0x6007, 0x0020, 0x6003,
+	0x0001, 0x080c, 0x8439, 0x080c, 0x8973, 0x0005, 0x080c, 0x30fd,
+	0x1904, 0xc6c9, 0x6007, 0x0023, 0x6003, 0x0001, 0x080c, 0x8439,
+	0x080c, 0x8973, 0x0005, 0x080c, 0xd726, 0x1904, 0xc6c9, 0x080c,
+	0x30fd, 0x1904, 0xc6c9, 0x080c, 0xc869, 0x1904, 0xc3a4, 0x0016,
+	0x0026, 0x00e6, 0x2071, 0x0260, 0x7244, 0x9286, 0xffff, 0x0180,
+	0x2c08, 0x080c, 0xbb05, 0x01b0, 0x2260, 0x7240, 0x6008, 0x9206,
+	0x1188, 0x6010, 0x9190, 0x0004, 0x2214, 0x9206, 0x01b8, 0x0050,
+	0x7240, 0x2c08, 0x9006, 0x080c, 0xd4fc, 0x1180, 0x7244, 0x9286,
+	0xffff, 0x01b0, 0x2160, 0x6007, 0x0026, 0x6017, 0x1700, 0x7214,
+	0x9296, 0xffff, 0x1180, 0x6007, 0x0025, 0x0068, 0x6020, 0x9086,
+	0x0007, 0x1d80, 0x6004, 0x9086, 0x0024, 0x1110, 0x080c, 0x9e32,
+	0x2160, 0x6007, 0x0025, 0x6003, 0x0001, 0x080c, 0x8439, 0x080c,
+	0x8973, 0x00ee, 0x002e, 0x001e, 0x0005, 0x2001, 0x0001, 0x080c,
+	0x617b, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
+	0x1805, 0x2011, 0x0276, 0x080c, 0xadf9, 0x003e, 0x002e, 0x001e,
+	0x015e, 0x0120, 0x6007, 0x0031, 0x0804, 0xc4b6, 0x080c, 0xaa61,
+	0x080c, 0x6fb2, 0x1190, 0x0006, 0x0026, 0x0036, 0x080c, 0x6fcc,
+	0x1138, 0x080c, 0x7296, 0x080c, 0x5cd1, 0x080c, 0x6ee4, 0x0010,
+	0x080c, 0x6f8a, 0x003e, 0x002e, 0x000e, 0x0005, 0x080c, 0x30fd,
+	0x1904, 0xc6c9, 0x080c, 0xc869, 0x1904, 0xc3a4, 0x6106, 0x080c,
+	0xc885, 0x1120, 0x6007, 0x002b, 0x0804, 0xc4b6, 0x6007, 0x002c,
+	0x0804, 0xc4b6, 0x080c, 0xd726, 0x1904, 0xc6c9, 0x080c, 0x30fd,
+	0x1904, 0xc6c9, 0x080c, 0xc869, 0x1904, 0xc3a4, 0x6106, 0x080c,
+	0xc88a, 0x1120, 0x6007, 0x002e, 0x0804, 0xc4b6, 0x6007, 0x002f,
+	0x0804, 0xc4b6, 0x080c, 0x30fd, 0x1904, 0xc6c9, 0x00e6, 0x00d6,
+	0x00c6, 0x6010, 0x2058, 0xb904, 0x9184, 0x00ff, 0x9086, 0x0006,
+	0x0158, 0x9184, 0xff00, 0x8007, 0x9086, 0x0006, 0x0128, 0x00ce,
+	0x00de, 0x00ee, 0x0804, 0xc4bd, 0x080c, 0x538a, 0xd0e4, 0x0904,
+	0xc614, 0x2071, 0x026c, 0x7010, 0x603a, 0x7014, 0x603e, 0x7108,
+	0x720c, 0x080c, 0x655e, 0x0140, 0x6010, 0x2058, 0xb810, 0x9106,
+	0x1118, 0xb814, 0x9206, 0x0510, 0x080c, 0x655a, 0x15b8, 0x2069,
+	0x1800, 0x687c, 0x9206, 0x1590, 0x6878, 0x9106, 0x1578, 0x7210,
+	0x080c, 0xbb05, 0x0590, 0x080c, 0xc754, 0x0578, 0x080c, 0xd5a6,
+	0x0560, 0x622e, 0x6007, 0x0036, 0x6003, 0x0001, 0x080c, 0x83f1,
+	0x080c, 0x8973, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x7214, 0x9286,
+	0xffff, 0x0150, 0x080c, 0xbb05, 0x01c0, 0x9280, 0x0002, 0x2004,
+	0x7110, 0x9106, 0x1190, 0x08e0, 0x7210, 0x2c08, 0x9085, 0x0001,
+	0x080c, 0xd4fc, 0x2c10, 0x2160, 0x0140, 0x0890, 0x6007, 0x0037,
+	0x602f, 0x0009, 0x6017, 0x1500, 0x08b8, 0x6007, 0x0037, 0x602f,
+	0x0003, 0x6017, 0x1700, 0x0880, 0x6007, 0x0012, 0x0868, 0x080c,
+	0x30fd, 0x1904, 0xc6c9, 0x6010, 0x2058, 0xb804, 0x9084, 0xff00,
+	0x8007, 0x9086, 0x0006, 0x1904, 0xc4bd, 0x00e6, 0x00d6, 0x00c6,
+	0x080c, 0x538a, 0xd0e4, 0x0904, 0xc68c, 0x2069, 0x1800, 0x2071,
+	0x026c, 0x7008, 0x603a, 0x720c, 0x623e, 0x9286, 0xffff, 0x1150,
+	0x7208, 0x00c6, 0x2c08, 0x9085, 0x0001, 0x080c, 0xd4fc, 0x2c10,
+	0x00ce, 0x05e8, 0x080c, 0xbb05, 0x05d0, 0x7108, 0x9280, 0x0002,
+	0x2004, 0x9106, 0x15a0, 0x00c6, 0x0026, 0x2260, 0x080c, 0xb73d,
+	0x002e, 0x00ce, 0x7118, 0x918c, 0xff00, 0x810f, 0x9186, 0x0001,
+	0x0178, 0x9186, 0x0005, 0x0118, 0x9186, 0x0007, 0x1198, 0x9280,
+	0x0005, 0x2004, 0x9005, 0x0170, 0x080c, 0xc754, 0x0904, 0xc60d,
+	0x0056, 0x7510, 0x7614, 0x080c, 0xd5bf, 0x005e, 0x00ce, 0x00de,
+	0x00ee, 0x0005, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017, 0x2a00,
+	0x6003, 0x0001, 0x080c, 0x83f1, 0x080c, 0x8973, 0x0c78, 0x6007,
+	0x003b, 0x602f, 0x0003, 0x6017, 0x0300, 0x6003, 0x0001, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x0c10, 0x6007, 0x003b, 0x602f, 0x000b,
+	0x6017, 0x0000, 0x0804, 0xc5e4, 0x00e6, 0x0026, 0x080c, 0x6520,
+	0x0550, 0x080c, 0x6509, 0x080c, 0xd798, 0x1518, 0x2071, 0x1800,
+	0x70d8, 0x9085, 0x0003, 0x70da, 0x00f6, 0x2079, 0x0100, 0x72ac,
+	0x9284, 0x00ff, 0x707a, 0x78e6, 0x9284, 0xff00, 0x727c, 0x9205,
+	0x707e, 0x78ea, 0x00fe, 0x70e3, 0x0000, 0x080c, 0x655e, 0x0120,
+	0x2011, 0x19d1, 0x2013, 0x07d0, 0xd0ac, 0x1128, 0x080c, 0x2dbb,
+	0x0010, 0x080c, 0xd7ca, 0x002e, 0x00ee, 0x080c, 0x9e32, 0x0804,
+	0xc4bc, 0x080c, 0x9e32, 0x0005, 0x2600, 0x0002, 0xc6e0, 0xc6e0,
+	0xc6e0, 0xc6e0, 0xc6e0, 0xc6e2, 0xc6e0, 0xc6e0, 0xc6e0, 0xc6e0,
+	0xc6ff, 0xc6e0, 0xc6e0, 0xc6e0, 0xc711, 0xc71e, 0xc74f, 0xc6e0,
+	0x080c, 0x0db4, 0x080c, 0xd726, 0x1d20, 0x080c, 0x30fd, 0x1d08,
+	0x080c, 0xc869, 0x1148, 0x7038, 0x6016, 0x6007, 0x0045, 0x6003,
+	0x0001, 0x080c, 0x8439, 0x0005, 0x080c, 0x2fda, 0x080c, 0xc227,
+	0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x8439, 0x0005, 0x080c,
+	0xd726, 0x1938, 0x080c, 0x30fd, 0x1920, 0x080c, 0xc869, 0x1d60,
+	0x703c, 0x6016, 0x6007, 0x004a, 0x6003, 0x0001, 0x080c, 0x8439,
+	0x0005, 0x080c, 0xc771, 0x0904, 0xc6c9, 0x6007, 0x004e, 0x6003,
+	0x0001, 0x080c, 0x8439, 0x080c, 0x8973, 0x0005, 0x6007, 0x004f,
+	0x6017, 0x0000, 0x7134, 0x918c, 0x00ff, 0x81ff, 0x0508, 0x9186,
+	0x0001, 0x1160, 0x7140, 0x2001, 0x198e, 0x2004, 0x9106, 0x11b0,
+	0x7144, 0x2001, 0x198f, 0x2004, 0x9106, 0x0190, 0x9186, 0x0002,
+	0x1168, 0x2011, 0x0276, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048,
+	0x2019, 0x000a, 0x080c, 0xae0d, 0x009e, 0x0110, 0x6017, 0x0001,
+	0x6003, 0x0001, 0x080c, 0x8439, 0x080c, 0x8973, 0x0005, 0x6007,
+	0x0050, 0x703c, 0x6016, 0x0ca0, 0x0016, 0x00e6, 0x2071, 0x0260,
+	0x00b6, 0x00c6, 0x2260, 0x6010, 0x2058, 0xb8bc, 0xd084, 0x0150,
+	0x7128, 0x6048, 0x9106, 0x1120, 0x712c, 0x6044, 0x9106, 0x0110,
+	0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x00be, 0x00ee, 0x001e,
+	0x0005, 0x0016, 0x0096, 0x0086, 0x00e6, 0x01c6, 0x01d6, 0x0126,
+	0x2091, 0x8000, 0x2071, 0x1800, 0x708c, 0x908a, 0x00f9, 0x16e8,
+	0x20e1, 0x0000, 0x2001, 0x1971, 0x2003, 0x0000, 0x080c, 0x1004,
+	0x05a0, 0x2900, 0x6016, 0x708c, 0x8004, 0xa816, 0x908a, 0x001e,
+	0x02d0, 0xa833, 0x001e, 0x20a9, 0x001e, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x001b, 0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x0471,
+	0x001e, 0x2940, 0x080c, 0x1004, 0x01c0, 0x2900, 0xa006, 0x2100,
+	0x81ff, 0x0180, 0x0c18, 0xa832, 0x20a8, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x001b, 0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x00b1,
+	0x001e, 0x0000, 0x9085, 0x0001, 0x0048, 0x2071, 0x1800, 0x708f,
+	0x0000, 0x6014, 0x2048, 0x080c, 0x0f9d, 0x9006, 0x012e, 0x01de,
+	0x01ce, 0x00ee, 0x008e, 0x009e, 0x001e, 0x0005, 0x0006, 0x0016,
+	0x0026, 0x0036, 0x00c6, 0x918c, 0xffff, 0x11a8, 0x080c, 0x2241,
+	0x2099, 0x026c, 0x2001, 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8,
+	0x4003, 0x00f8, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x2241,
+	0x2099, 0x0260, 0x0ca8, 0x080c, 0x2241, 0x2061, 0x1971, 0x6004,
+	0x2098, 0x6008, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0048,
+	0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x2241, 0x2099, 0x0260,
+	0x0ca8, 0x2061, 0x1971, 0x2019, 0x0280, 0x3300, 0x931e, 0x0110,
+	0x6006, 0x0020, 0x2001, 0x0260, 0x6006, 0x8108, 0x2162, 0x9292,
+	0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e,
+	0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x81ff,
+	0x11b8, 0x080c, 0x2259, 0x20a1, 0x024c, 0x2001, 0x0014, 0x3518,
+	0x9312, 0x1218, 0x23a8, 0x4003, 0x0418, 0x20a8, 0x4003, 0x82ff,
+	0x01f8, 0x22a8, 0x8108, 0x080c, 0x2259, 0x20a1, 0x0240, 0x0c98,
+	0x080c, 0x2259, 0x2061, 0x1974, 0x6004, 0x20a0, 0x6008, 0x3518,
+	0x9312, 0x1218, 0x23a8, 0x4003, 0x0058, 0x20a8, 0x4003, 0x82ff,
+	0x0138, 0x22a8, 0x8108, 0x080c, 0x2259, 0x20a1, 0x0240, 0x0c98,
+	0x2061, 0x1974, 0x2019, 0x0260, 0x3400, 0x931e, 0x0110, 0x6006,
+	0x0020, 0x2001, 0x0240, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021,
+	0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e,
+	0x0005, 0x00b6, 0x0066, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00,
+	0x8637, 0x9686, 0x0006, 0x0170, 0x9686, 0x0004, 0x0158, 0xbe04,
+	0x96b4, 0x00ff, 0x9686, 0x0006, 0x0128, 0x9686, 0x0004, 0x0110,
+	0x9085, 0x0001, 0x006e, 0x00be, 0x0005, 0x00d6, 0x080c, 0xc901,
+	0x00de, 0x0005, 0x00d6, 0x080c, 0xc90e, 0x1520, 0x680c, 0x908c,
+	0xff00, 0x6820, 0x9084, 0x00ff, 0x9115, 0x6216, 0x6824, 0x602e,
+	0xd1e4, 0x0130, 0x9006, 0x080c, 0xd842, 0x2009, 0x0001, 0x0078,
+	0xd1ec, 0x0180, 0x6920, 0x918c, 0x00ff, 0x6824, 0x080c, 0x2663,
+	0x1148, 0x2001, 0x0001, 0x080c, 0xd842, 0x2110, 0x900e, 0x080c,
+	0x3023, 0x0018, 0x9085, 0x0001, 0x0008, 0x9006, 0x00de, 0x0005,
+	0x00b6, 0x00c6, 0x080c, 0x9e7f, 0x05a8, 0x0016, 0x0026, 0x00c6,
+	0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2663, 0x1578,
+	0x080c, 0x61de, 0x1560, 0xbe12, 0xbd16, 0x00ce, 0x002e, 0x001e,
+	0x2b00, 0x6012, 0x080c, 0xd726, 0x11d8, 0x080c, 0x30fd, 0x11c0,
+	0x080c, 0xc869, 0x0510, 0x2001, 0x0007, 0x080c, 0x618f, 0x2001,
+	0x0007, 0x080c, 0x61bb, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007,
+	0x0001, 0x6003, 0x0001, 0x080c, 0x8439, 0x080c, 0x8973, 0x0010,
+	0x080c, 0x9e32, 0x9085, 0x0001, 0x00ce, 0x00be, 0x0005, 0x080c,
+	0x9e32, 0x00ce, 0x002e, 0x001e, 0x0ca8, 0x080c, 0x9e32, 0x9006,
+	0x0c98, 0x2069, 0x026d, 0x6800, 0x9082, 0x0010, 0x1228, 0x6017,
+	0x0000, 0x9085, 0x0001, 0x0008, 0x9006, 0x0005, 0x6017, 0x0000,
+	0x2069, 0x026c, 0x6808, 0x9084, 0xff00, 0x9086, 0x0800, 0x1190,
+	0x6904, 0x9186, 0x0018, 0x0118, 0x9186, 0x0014, 0x1158, 0x810f,
+	0x6800, 0x9084, 0x00ff, 0x910d, 0x615a, 0x908e, 0x0014, 0x0110,
+	0x908e, 0x0010, 0x0005, 0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0db4,
+	0x91b6, 0x0013, 0x1130, 0x2008, 0x91b2, 0x0040, 0x1a04, 0xca56,
+	0x0092, 0x91b6, 0x0027, 0x0120, 0x91b6, 0x0014, 0x190c, 0x0db4,
+	0x2001, 0x0007, 0x080c, 0x61bb, 0x080c, 0x886e, 0x080c, 0x9e62,
+	0x080c, 0x8973, 0x0005, 0xc98b, 0xc98d, 0xc98b, 0xc98b, 0xc98b,
+	0xc98d, 0xc99c, 0xca4f, 0xc9ee, 0xca4f, 0xca00, 0xca4f, 0xc99c,
+	0xca4f, 0xca47, 0xca4f, 0xca47, 0xca4f, 0xca4f, 0xc98b, 0xc98b,
+	0xc98b, 0xc98b, 0xc98b, 0xc98b, 0xc98b, 0xc98b, 0xc98b, 0xc98b,
+	0xc98b, 0xc98d, 0xc98b, 0xca4f, 0xc98b, 0xc98b, 0xca4f, 0xc98b,
+	0xca4c, 0xca4f, 0xc98b, 0xc98b, 0xc98b, 0xc98b, 0xca4f, 0xca4f,
+	0xc98b, 0xca4f, 0xca4f, 0xc98b, 0xc997, 0xc98b, 0xc98b, 0xc98b,
+	0xc98b, 0xca4b, 0xca4f, 0xc98b, 0xc98b, 0xca4f, 0xca4f, 0xc98b,
+	0xc98b, 0xc98b, 0xc98b, 0x080c, 0x0db4, 0x080c, 0x886e, 0x080c,
+	0xc22a, 0x6003, 0x0002, 0x080c, 0x8973, 0x0804, 0xca55, 0x9006,
+	0x080c, 0x617b, 0x0804, 0xca4f, 0x080c, 0x655a, 0x1904, 0xca4f,
+	0x9006, 0x080c, 0x617b, 0x6010, 0x2058, 0xb810, 0x9086, 0x00ff,
+	0x1140, 0x00f6, 0x2079, 0x1800, 0x78a4, 0x8000, 0x78a6, 0x00fe,
+	0x0428, 0x6010, 0x2058, 0xb8b0, 0x9005, 0x1178, 0x080c, 0xc212,
+	0x1904, 0xca4f, 0x0036, 0x0046, 0xbba0, 0x2021, 0x0007, 0x080c,
+	0x4a76, 0x004e, 0x003e, 0x0804, 0xca4f, 0x080c, 0x312e, 0x1904,
+	0xca4f, 0x2001, 0x1800, 0x2004, 0x9086, 0x0002, 0x1138, 0x00f6,
+	0x2079, 0x1800, 0x78a4, 0x8000, 0x78a6, 0x00fe, 0x2001, 0x0002,
+	0x080c, 0x618f, 0x080c, 0x886e, 0x6023, 0x0001, 0x6003, 0x0001,
+	0x6007, 0x0002, 0x080c, 0x8439, 0x080c, 0x8973, 0x6110, 0x2158,
+	0x2009, 0x0001, 0x080c, 0x8046, 0x0804, 0xca55, 0x6610, 0x2658,
+	0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0904, 0xca4f,
+	0x9686, 0x0004, 0x0904, 0xca4f, 0x2001, 0x0004, 0x0804, 0xca4d,
+	0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036, 0x0046,
+	0x6010, 0x2058, 0xbba0, 0x2021, 0x0006, 0x080c, 0x4a76, 0x004e,
+	0x003e, 0x2001, 0x0006, 0x080c, 0xca73, 0x6610, 0x2658, 0xbe04,
+	0x0066, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x006e, 0x0168,
+	0x2001, 0x0006, 0x080c, 0x61bb, 0x9284, 0x00ff, 0x908e, 0x0007,
+	0x1120, 0x2001, 0x0006, 0x080c, 0x618f, 0x080c, 0x655a, 0x11f8,
+	0x2001, 0x1836, 0x2004, 0xd0a4, 0x01d0, 0xbe04, 0x96b4, 0x00ff,
+	0x9686, 0x0006, 0x01a0, 0x00f6, 0x2079, 0x1800, 0x78a4, 0x8000,
+	0x78a6, 0x00fe, 0x0804, 0xc9d6, 0x2001, 0x0004, 0x0030, 0x2001,
+	0x0006, 0x0449, 0x0020, 0x0018, 0x0010, 0x080c, 0x61bb, 0x080c,
+	0x886e, 0x080c, 0x9e32, 0x080c, 0x8973, 0x0005, 0x2600, 0x0002,
+	0xca6a, 0xca6a, 0xca6a, 0xca6a, 0xca6a, 0xca6c, 0xca6a, 0xca6a,
+	0xca6a, 0xca6a, 0xca6c, 0xca6a, 0xca6a, 0xca6a, 0xca6c, 0xca6c,
+	0xca6c, 0xca6c, 0x080c, 0x0db4, 0x080c, 0x886e, 0x080c, 0x9e32,
+	0x080c, 0x8973, 0x0005, 0x0016, 0x00b6, 0x00d6, 0x6110, 0x2158,
+	0xb900, 0xd184, 0x0138, 0x080c, 0x618f, 0x9006, 0x080c, 0x617b,
+	0x080c, 0x3003, 0x00de, 0x00be, 0x001e, 0x0005, 0x6610, 0x2658,
+	0xb804, 0x9084, 0xff00, 0x8007, 0x90b2, 0x000c, 0x1a0c, 0x0db4,
+	0x91b6, 0x0015, 0x1110, 0x003b, 0x0028, 0x91b6, 0x0016, 0x190c,
+	0x0db4, 0x006b, 0x0005, 0xa8a1, 0xa8a1, 0xa8a1, 0xa8a1, 0xa8a1,
+	0xa8a1, 0xcaf2, 0xcab3, 0xa8a1, 0xa8a1, 0xa8a1, 0xa8a1, 0xa8a1,
+	0xa8a1, 0xa8a1, 0xa8a1, 0xa8a1, 0xa8a1, 0xcaf2, 0xcaf9, 0xa8a1,
+	0xa8a1, 0xa8a1, 0xa8a1, 0x00f6, 0x080c, 0x655a, 0x11d8, 0x080c,
+	0xc212, 0x11c0, 0x6010, 0x905d, 0x01a8, 0xb8b0, 0x9005, 0x0190,
+	0x9006, 0x080c, 0x617b, 0x2001, 0x0002, 0x080c, 0x618f, 0x6023,
+	0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x8439, 0x080c,
+	0x8973, 0x00f0, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
+	0x2663, 0x11b0, 0x080c, 0x623e, 0x0118, 0x080c, 0x9e32, 0x0080,
+	0xb810, 0x0006, 0xb814, 0x0006, 0xb8b0, 0x0006, 0x080c, 0x5ceb,
+	0x000e, 0xb8b2, 0x000e, 0xb816, 0x000e, 0xb812, 0x080c, 0x9e32,
+	0x00fe, 0x0005, 0x6604, 0x96b6, 0x001e, 0x1110, 0x080c, 0x9e32,
+	0x0005, 0x080c, 0xac85, 0x1148, 0x6003, 0x0001, 0x6007, 0x0001,
+	0x080c, 0x8439, 0x080c, 0x8973, 0x0010, 0x080c, 0x9e32, 0x0005,
+	0x6004, 0x908a, 0x0053, 0x1a0c, 0x0db4, 0x080c, 0x886e, 0x080c,
+	0x9e62, 0x080c, 0x8973, 0x0005, 0x9182, 0x0040, 0x0002, 0xcb2a,
+	0xcb2a, 0xcb2a, 0xcb2a, 0xcb2c, 0xcb2a, 0xcb2a, 0xcb2a, 0xcb2a,
+	0xcb2a, 0xcb2a, 0xcb2a, 0xcb2a, 0xcb2a, 0xcb2a, 0xcb2a, 0xcb2a,
+	0xcb2a, 0xcb2a, 0x080c, 0x0db4, 0x0096, 0x00b6, 0x00d6, 0x00e6,
+	0x00f6, 0x0046, 0x0026, 0x6210, 0x2258, 0xb8ac, 0x9005, 0x11a8,
+	0x6106, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904, 0xcb92,
+	0x080c, 0xd836, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009, 0x0001,
+	0x2011, 0x0200, 0x080c, 0x822f, 0x0020, 0x9026, 0x080c, 0xd76b,
+	0x0c38, 0x080c, 0x0feb, 0x090c, 0x0db4, 0x6003, 0x0007, 0xa867,
+	0x010d, 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e, 0x6008,
+	0xa8e2, 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016, 0xa876,
+	0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c, 0x688c,
+	0x001e, 0x080c, 0xd836, 0x1904, 0xcbf2, 0x9486, 0x2000, 0x1130,
+	0x2019, 0x0017, 0x080c, 0xd4a6, 0x0804, 0xcbf2, 0x9486, 0x0200,
+	0x1120, 0x080c, 0xd442, 0x0804, 0xcbf2, 0x9486, 0x0400, 0x0120,
+	0x9486, 0x1000, 0x1904, 0xcbf2, 0x2019, 0x0002, 0x080c, 0xd45d,
+	0x0804, 0xcbf2, 0x2069, 0x1a41, 0x6a00, 0xd284, 0x0904, 0xcc5c,
+	0x9284, 0x0300, 0x1904, 0xcc55, 0x6804, 0x9005, 0x0904, 0xcc3d,
+	0x2d78, 0x6003, 0x0007, 0x080c, 0x1004, 0x0904, 0xcbfe, 0x7800,
+	0xd08c, 0x1118, 0x7804, 0x8001, 0x7806, 0x6017, 0x0000, 0x2001,
+	0x180f, 0x2004, 0xd084, 0x1904, 0xcc60, 0x9006, 0xa802, 0xa867,
+	0x0116, 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010, 0x2058,
+	0xb8a0, 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c, 0xa9be,
+	0xb930, 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044, 0x9084,
+	0x0003, 0x9080, 0xcbfa, 0x2005, 0xa87e, 0x20a9, 0x000a, 0x2001,
+	0x0270, 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205, 0x200b, 0x0080,
+	0x20e1, 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003, 0x200b,
+	0x0000, 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c, 0xa9ae,
+	0x080c, 0x688c, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de, 0x00be,
+	0x009e, 0x0005, 0x0000, 0x0080, 0x0040, 0x0000, 0x2001, 0x1810,
+	0x2004, 0xd084, 0x0120, 0x080c, 0x0feb, 0x1904, 0xcba7, 0x6017,
+	0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c, 0x83f1, 0x080c,
+	0x8973, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00, 0x9086,
+	0x1200, 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114, 0x918c,
+	0xf700, 0x910d, 0x6116, 0x001e, 0x6003, 0x0001, 0x6007, 0x0043,
+	0x080c, 0x83f1, 0x080c, 0x8973, 0x0828, 0x6868, 0x602e, 0x686c,
+	0x6032, 0x6017, 0xf200, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x0804, 0xcbf2, 0x2001, 0x180e, 0x2004,
+	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d9, 0x6017, 0xf300,
+	0x0010, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x0804, 0xcbf2, 0x6017, 0xf500, 0x0c98,
+	0x6017, 0xf600, 0x0804, 0xcc12, 0x6017, 0xf200, 0x0804, 0xcc12,
+	0xa867, 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00, 0xa87a,
+	0x7044, 0x9084, 0x0003, 0x9080, 0xcbfa, 0x2005, 0xa87e, 0x2928,
+	0x6010, 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c, 0xa88e,
+	0xb830, 0xa892, 0xb834, 0xa896, 0xa883, 0x003d, 0x2009, 0x0205,
+	0x2104, 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011, 0x0210,
+	0x2214, 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c, 0x0db4,
+	0x8210, 0x821c, 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0029, 0x20a0, 0x2011, 0xccdc, 0x2041, 0x0001, 0x223d,
+	0x9784, 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003, 0x931a,
+	0x0530, 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001, 0x0260,
+	0x2098, 0x0c68, 0x2950, 0x080c, 0x1004, 0x0170, 0x2900, 0xb002,
+	0xa867, 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x001b, 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d, 0x0118,
+	0x080c, 0x101d, 0x0cc8, 0x080c, 0x101d, 0x0804, 0xcbfe, 0x2548,
+	0x8847, 0x9885, 0x0046, 0xa866, 0x2009, 0x0205, 0x200b, 0x0000,
+	0x080c, 0xd4d5, 0x0804, 0xcbf2, 0x8010, 0x0004, 0x801a, 0x0006,
+	0x8018, 0x0008, 0x8016, 0x000a, 0x8014, 0x9186, 0x0013, 0x1160,
+	0x6004, 0x908a, 0x0054, 0x1a0c, 0x0db4, 0x9082, 0x0040, 0x0a0c,
+	0x0db4, 0x2008, 0x0804, 0xcd8d, 0x9186, 0x0051, 0x0108, 0x00c0,
+	0x2001, 0x0109, 0x2004, 0xd084, 0x0904, 0xcd3e, 0x0126, 0x2091,
+	0x2800, 0x0006, 0x0016, 0x0026, 0x080c, 0x82dd, 0x002e, 0x001e,
+	0x000e, 0x012e, 0x6000, 0x9086, 0x0002, 0x1580, 0x0804, 0xcdd5,
+	0x9186, 0x0027, 0x0530, 0x9186, 0x0048, 0x0128, 0x9186, 0x0014,
+	0x0500, 0x190c, 0x0db4, 0x2001, 0x0109, 0x2004, 0xd084, 0x01f0,
+	0x00c6, 0x0126, 0x2091, 0x2800, 0x00c6, 0x2061, 0x0100, 0x0006,
+	0x0016, 0x0026, 0x080c, 0x82dd, 0x002e, 0x001e, 0x000e, 0x00ce,
+	0x012e, 0x00ce, 0x6000, 0x9086, 0x0004, 0x190c, 0x0db4, 0x0804,
+	0xceb6, 0x6004, 0x9082, 0x0040, 0x2008, 0x001a, 0x080c, 0x9ec7,
+	0x0005, 0xcd54, 0xcd56, 0xcd56, 0xcd7d, 0xcd54, 0xcd54, 0xcd54,
+	0xcd54, 0xcd54, 0xcd54, 0xcd54, 0xcd54, 0xcd54, 0xcd54, 0xcd54,
+	0xcd54, 0xcd54, 0xcd54, 0xcd54, 0x080c, 0x0db4, 0x080c, 0x886e,
+	0x080c, 0x8973, 0x0036, 0x0096, 0x6014, 0x904d, 0x01d8, 0x080c,
+	0xbb17, 0x01c0, 0x6003, 0x0002, 0x6010, 0x00b6, 0x2058, 0xb800,
+	0x00be, 0xd0bc, 0x1178, 0x2019, 0x0004, 0x080c, 0xd4d5, 0x6017,
+	0x0000, 0x6018, 0x9005, 0x1120, 0x2001, 0x1958, 0x2004, 0x601a,
+	0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x0096, 0x080c, 0x886e,
+	0x080c, 0x8973, 0x080c, 0xbb17, 0x0120, 0x6014, 0x2048, 0x080c,
+	0x101d, 0x080c, 0x9e62, 0x009e, 0x0005, 0x0002, 0xcda1, 0xcdb8,
+	0xcda3, 0xcdcf, 0xcda1, 0xcda1, 0xcda1, 0xcda1, 0xcda1, 0xcda1,
+	0xcda1, 0xcda1, 0xcda1, 0xcda1, 0xcda1, 0xcda1, 0xcda1, 0xcda1,
+	0xcda1, 0x080c, 0x0db4, 0x0096, 0x080c, 0x886e, 0x6014, 0x2048,
+	0xa87c, 0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009, 0x0043, 0x080c,
+	0x9eac, 0x0010, 0x6003, 0x0004, 0x080c, 0x8973, 0x009e, 0x0005,
+	0x080c, 0x886e, 0x080c, 0xbb17, 0x0138, 0x6114, 0x0096, 0x2148,
+	0xa97c, 0x009e, 0xd1ec, 0x1138, 0x080c, 0x8204, 0x080c, 0x9e32,
+	0x080c, 0x8973, 0x0005, 0x080c, 0xd72f, 0x0db0, 0x0cc8, 0x080c,
+	0x886e, 0x2009, 0x0041, 0x0804, 0xcf3e, 0x9182, 0x0040, 0x0002,
+	0xcdeb, 0xcded, 0xcdeb, 0xcdeb, 0xcdeb, 0xcdeb, 0xcdeb, 0xcdeb,
+	0xcdeb, 0xcdeb, 0xcdeb, 0xcdeb, 0xcdeb, 0xcdeb, 0xcdeb, 0xcdeb,
+	0xcdeb, 0xcdee, 0xcdeb, 0x080c, 0x0db4, 0x0005, 0x00d6, 0x080c,
+	0x8204, 0x00de, 0x080c, 0xd787, 0x080c, 0x9e32, 0x0005, 0x9182,
+	0x0040, 0x0002, 0xce0d, 0xce0d, 0xce0d, 0xce0d, 0xce0d, 0xce0d,
+	0xce0d, 0xce0d, 0xce0d, 0xce0f, 0xce7e, 0xce0d, 0xce0d, 0xce0d,
+	0xce0d, 0xce7e, 0xce0d, 0xce0d, 0xce0d, 0x080c, 0x0db4, 0x2001,
+	0x0105, 0x2004, 0x9084, 0x1800, 0x01c8, 0x2001, 0x0132, 0x200c,
+	0x2001, 0x0131, 0x2004, 0x9105, 0x1904, 0xce7e, 0x2009, 0x180c,
+	0x2104, 0xd0d4, 0x0904, 0xce7e, 0xc0d4, 0x200a, 0x2009, 0x0105,
+	0x2104, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x200a, 0x2001, 0x1873,
+	0x2004, 0xd0e4, 0x1528, 0x603b, 0x0000, 0x080c, 0x8923, 0x6014,
+	0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0188, 0x908c, 0x0003, 0x918e,
+	0x0002, 0x0508, 0x2001, 0x180c, 0x2004, 0xd0d4, 0x11e0, 0x080c,
+	0x8a4e, 0x2009, 0x0041, 0x009e, 0x0804, 0xcf3e, 0x080c, 0x8a4e,
+	0x6003, 0x0007, 0x601b, 0x0000, 0x080c, 0x8204, 0x009e, 0x0005,
+	0x2001, 0x0100, 0x2004, 0x9082, 0x0005, 0x0aa8, 0x2001, 0x011f,
+	0x2004, 0x603a, 0x0890, 0x2001, 0x180c, 0x200c, 0xc1d4, 0x2102,
+	0xd1cc, 0x0110, 0x080c, 0x2a77, 0x080c, 0x8a4e, 0x6014, 0x2048,
+	0xa97c, 0xd1ec, 0x1130, 0x080c, 0x8204, 0x080c, 0x9e32, 0x009e,
+	0x0005, 0x080c, 0xd72f, 0x0db8, 0x009e, 0x0005, 0x2001, 0x180c,
+	0x200c, 0xc1d4, 0x2102, 0x0036, 0x080c, 0x8923, 0x080c, 0x8a4e,
+	0x6014, 0x0096, 0x2048, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
+	0xd0bc, 0x0188, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x0140,
+	0xa8ac, 0x6330, 0x931a, 0x6332, 0xa8b0, 0x632c, 0x931b, 0x632e,
+	0x6003, 0x0002, 0x0080, 0x2019, 0x0004, 0x080c, 0xd4d5, 0x6018,
+	0x9005, 0x1128, 0x2001, 0x1958, 0x2004, 0x8003, 0x601a, 0x6017,
+	0x0000, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x9182, 0x0040,
+	0x0002, 0xcecd, 0xcecd, 0xcecd, 0xcecd, 0xcecd, 0xcecd, 0xcecd,
+	0xcecd, 0xcecf, 0xcecd, 0xcecd, 0xcecd, 0xcecd, 0xcecd, 0xcecd,
+	0xcecd, 0xcecd, 0xcecd, 0xcecd, 0xcf1a, 0x080c, 0x0db4, 0x6014,
+	0x0096, 0x2048, 0xa834, 0xaa38, 0x6110, 0x00b6, 0x2158, 0xb900,
+	0x00be, 0xd1bc, 0x1190, 0x920d, 0x1518, 0xa87c, 0xd0fc, 0x0128,
+	0x2009, 0x0041, 0x009e, 0x0804, 0xcf3e, 0x6003, 0x0007, 0x601b,
+	0x0000, 0x080c, 0x8204, 0x009e, 0x0005, 0x6124, 0xd1f4, 0x1d58,
+	0x0006, 0x0046, 0xacac, 0x9422, 0xa9b0, 0x2200, 0x910b, 0x6030,
+	0x9420, 0x6432, 0x602c, 0x9109, 0x612e, 0x004e, 0x000e, 0x08d8,
+	0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1178, 0x2009,
+	0x180e, 0x210c, 0xd19c, 0x0118, 0x6003, 0x0007, 0x0010, 0x6003,
+	0x0006, 0x00e9, 0x080c, 0x8206, 0x009e, 0x0005, 0x6003, 0x0002,
+	0x009e, 0x0005, 0x6024, 0xd0f4, 0x0128, 0x080c, 0x150f, 0x1904,
+	0xcecf, 0x0005, 0x6014, 0x0096, 0x2048, 0xa834, 0xa938, 0x009e,
+	0x9105, 0x1120, 0x080c, 0x150f, 0x1904, 0xcecf, 0x0005, 0xd2fc,
+	0x0140, 0x8002, 0x8000, 0x8212, 0x9291, 0x0000, 0x2009, 0x0009,
+	0x0010, 0x2009, 0x0015, 0xaa9a, 0xa896, 0x0005, 0x9182, 0x0040,
+	0x0208, 0x0062, 0x9186, 0x0013, 0x0120, 0x9186, 0x0014, 0x190c,
+	0x0db4, 0x6024, 0xd0dc, 0x090c, 0x0db4, 0x0005, 0xcf61, 0xcf6d,
+	0xcf79, 0xcf85, 0xcf61, 0xcf61, 0xcf61, 0xcf61, 0xcf68, 0xcf63,
+	0xcf63, 0xcf61, 0xcf61, 0xcf61, 0xcf61, 0xcf63, 0xcf61, 0xcf63,
+	0xcf61, 0x080c, 0x0db4, 0x6024, 0xd0dc, 0x090c, 0x0db4, 0x0005,
+	0x6014, 0x9005, 0x190c, 0x0db4, 0x0005, 0x6003, 0x0001, 0x6106,
+	0x080c, 0x83f1, 0x0126, 0x2091, 0x8000, 0x080c, 0x8973, 0x012e,
+	0x0005, 0x6003, 0x0001, 0x6106, 0x080c, 0x83f1, 0x0126, 0x2091,
+	0x8000, 0x080c, 0x8973, 0x012e, 0x0005, 0x6003, 0x0003, 0x6106,
+	0x2c10, 0x080c, 0x1a5c, 0x0126, 0x2091, 0x8000, 0x080c, 0x8456,
+	0x080c, 0x8a4e, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0036,
+	0x0096, 0x9182, 0x0040, 0x0023, 0x009e, 0x003e, 0x012e, 0x0005,
+	0xcfb0, 0xcfb2, 0xcfc4, 0xcfde, 0xcfb0, 0xcfb0, 0xcfb0, 0xcfb0,
+	0xcfb0, 0xcfb0, 0xcfb0, 0xcfb0, 0xcfb0, 0xcfb0, 0xcfb0, 0xcfb0,
+	0x080c, 0x0db4, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x01f8, 0x909c,
+	0x0003, 0x939e, 0x0003, 0x01d0, 0x6003, 0x0001, 0x6106, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x0470, 0x6014, 0x2048, 0xa87c, 0xd0fc,
+	0x0168, 0x909c, 0x0003, 0x939e, 0x0003, 0x0140, 0x6003, 0x0001,
+	0x6106, 0x080c, 0x83f1, 0x080c, 0x8973, 0x00e0, 0x901e, 0x6316,
+	0x631a, 0x2019, 0x0004, 0x080c, 0xd4d5, 0x00a0, 0x6014, 0x2048,
+	0xa87c, 0xd0fc, 0x0d98, 0x909c, 0x0003, 0x939e, 0x0003, 0x0d70,
+	0x6003, 0x0003, 0x6106, 0x2c10, 0x080c, 0x1a5c, 0x080c, 0x8456,
+	0x080c, 0x8a4e, 0x0005, 0x080c, 0x886e, 0x6114, 0x81ff, 0x0158,
+	0x0096, 0x2148, 0x080c, 0xd7d3, 0x0036, 0x2019, 0x0029, 0x080c,
+	0xd4d5, 0x003e, 0x009e, 0x080c, 0x9e62, 0x080c, 0x8973, 0x0005,
+	0x080c, 0x8923, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c,
+	0xd7d3, 0x0036, 0x2019, 0x0029, 0x080c, 0xd4d5, 0x003e, 0x009e,
+	0x080c, 0x9e62, 0x080c, 0x8a4e, 0x0005, 0x9182, 0x0085, 0x0002,
+	0xd02f, 0xd02d, 0xd02d, 0xd03b, 0xd02d, 0xd02d, 0xd02d, 0xd02d,
+	0xd02d, 0xd02d, 0xd02d, 0xd02d, 0xd02d, 0x080c, 0x0db4, 0x6003,
+	0x000b, 0x6106, 0x080c, 0x83f1, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x8973, 0x012e, 0x0005, 0x0026, 0x00e6, 0x080c, 0xd726, 0x0118,
+	0x080c, 0x9e32, 0x0450, 0x2071, 0x0260, 0x7224, 0x6216, 0x2001,
+	0x180e, 0x2004, 0xd0e4, 0x0150, 0x6010, 0x00b6, 0x2058, 0xbca0,
+	0x00be, 0x2c00, 0x2011, 0x014e, 0x080c, 0xa152, 0x7220, 0x080c,
+	0xd37b, 0x0118, 0x6007, 0x0086, 0x0040, 0x6007, 0x0087, 0x7224,
+	0x9296, 0xffff, 0x1110, 0x6007, 0x0086, 0x6003, 0x0001, 0x080c,
+	0x83f1, 0x080c, 0x8973, 0x080c, 0x8a4e, 0x00ee, 0x002e, 0x0005,
+	0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0db4,
+	0x908a, 0x0092, 0x1a0c, 0x0db4, 0x9082, 0x0085, 0x00a2, 0x9186,
+	0x0027, 0x0130, 0x9186, 0x0014, 0x0118, 0x080c, 0x9ec7, 0x0050,
+	0x2001, 0x0007, 0x080c, 0x61bb, 0x080c, 0x886e, 0x080c, 0x9e62,
+	0x080c, 0x8973, 0x0005, 0xd0a0, 0xd0a2, 0xd0a2, 0xd0a0, 0xd0a0,
+	0xd0a0, 0xd0a0, 0xd0a0, 0xd0a0, 0xd0a0, 0xd0a0, 0xd0a0, 0xd0a0,
+	0x080c, 0x0db4, 0x080c, 0x886e, 0x080c, 0x9e62, 0x080c, 0x8973,
+	0x0005, 0x9182, 0x0085, 0x0a0c, 0x0db4, 0x9182, 0x0092, 0x1a0c,
+	0x0db4, 0x9182, 0x0085, 0x0002, 0xd0c1, 0xd0c1, 0xd0c1, 0xd0c3,
+	0xd0c1, 0xd0c1, 0xd0c1, 0xd0c1, 0xd0c1, 0xd0c1, 0xd0c1, 0xd0c1,
+	0xd0c1, 0x080c, 0x0db4, 0x0005, 0x9186, 0x0013, 0x0148, 0x9186,
+	0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0x9ec7, 0x0030,
+	0x080c, 0x886e, 0x080c, 0x9e62, 0x080c, 0x8973, 0x0005, 0x0036,
+	0x080c, 0xd787, 0x6043, 0x0000, 0x2019, 0x000b, 0x0031, 0x6023,
+	0x0006, 0x6003, 0x0007, 0x003e, 0x0005, 0x0126, 0x0036, 0x2091,
+	0x8000, 0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0x97ba, 0x009e,
+	0x008e, 0x1550, 0x0076, 0x2c38, 0x080c, 0x9865, 0x007e, 0x1520,
+	0x6000, 0x9086, 0x0000, 0x0500, 0x6020, 0x9086, 0x0007, 0x01e0,
+	0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xd787, 0x080c, 0xc22a,
+	0x080c, 0x190d, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xbb17,
+	0x0110, 0x080c, 0xd4d5, 0x009e, 0x6017, 0x0000, 0x080c, 0xd787,
+	0x6023, 0x0007, 0x080c, 0xc22a, 0x003e, 0x012e, 0x0005, 0x00f6,
+	0x00c6, 0x00b6, 0x0036, 0x0156, 0x2079, 0x0260, 0x7938, 0x783c,
+	0x080c, 0x2663, 0x15c8, 0x0016, 0x00c6, 0x080c, 0x623e, 0x1590,
+	0x001e, 0x00c6, 0x2160, 0x080c, 0xc227, 0x00ce, 0x002e, 0x0026,
+	0x0016, 0x2019, 0x0029, 0x080c, 0x9926, 0x080c, 0x8571, 0x0076,
+	0x903e, 0x080c, 0x8469, 0x007e, 0x001e, 0x0076, 0x903e, 0x080c,
+	0xd29b, 0x007e, 0x0026, 0xba04, 0x9294, 0xff00, 0x8217, 0x9286,
+	0x0006, 0x0118, 0x9286, 0x0004, 0x1118, 0xbaa0, 0x080c, 0x3097,
+	0x002e, 0xbcb0, 0x001e, 0x080c, 0x5ceb, 0xbe12, 0xbd16, 0xbcb2,
 	0x9006, 0x0010, 0x00ce, 0x001e, 0x015e, 0x003e, 0x00be, 0x00ce,
 	0x00fe, 0x0005, 0x00c6, 0x00d6, 0x00b6, 0x0016, 0x2009, 0x1823,
-	0x2104, 0x9086, 0x0074, 0x1904, 0xd1a3, 0x2069, 0x0260, 0x6944,
-	0x9182, 0x0100, 0x06e0, 0x6940, 0x9184, 0x8000, 0x0904, 0xd1a0,
+	0x2104, 0x9086, 0x0074, 0x1904, 0xd1c3, 0x2069, 0x0260, 0x6944,
+	0x9182, 0x0100, 0x06e0, 0x6940, 0x9184, 0x8000, 0x0904, 0xd1c0,
 	0x2001, 0x194d, 0x2004, 0x9005, 0x1140, 0x6010, 0x2058, 0xb8b0,
 	0x9005, 0x0118, 0x9184, 0x0800, 0x0598, 0x6948, 0x918a, 0x0001,
-	0x0648, 0x080c, 0xd81b, 0x0118, 0x6978, 0xd1fc, 0x11b8, 0x2009,
+	0x0648, 0x080c, 0xd83b, 0x0118, 0x6978, 0xd1fc, 0x11b8, 0x2009,
 	0x0205, 0x200b, 0x0001, 0x693c, 0x81ff, 0x1198, 0x6944, 0x9182,
 	0x0100, 0x02a8, 0x6940, 0x81ff, 0x1178, 0x6948, 0x918a, 0x0001,
 	0x0288, 0x6950, 0x918a, 0x0001, 0x0298, 0x00d0, 0x6017, 0x0100,
@@ -6507,105 +6511,105 @@
 	0x0026, 0x0036, 0x0156, 0x6210, 0x2258, 0xbb04, 0x9394, 0x00ff,
 	0x9286, 0x0006, 0x0180, 0x9286, 0x0004, 0x0168, 0x9394, 0xff00,
 	0x8217, 0x9286, 0x0006, 0x0138, 0x9286, 0x0004, 0x0120, 0x080c,
-	0x6246, 0x0804, 0xd20a, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096,
-	0x2b48, 0x2019, 0x000a, 0x080c, 0xadf4, 0x009e, 0x15a0, 0x2011,
+	0x624d, 0x0804, 0xd22a, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096,
+	0x2b48, 0x2019, 0x000a, 0x080c, 0xae0d, 0x009e, 0x15a0, 0x2011,
 	0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c,
-	0xadf4, 0x009e, 0x1540, 0x0046, 0x0016, 0xbaa0, 0x2220, 0x9006,
-	0x2009, 0x1854, 0x210c, 0x0038, 0x2009, 0x0029, 0x080c, 0xd50a,
-	0xb800, 0xc0e5, 0xb802, 0x2019, 0x0029, 0x080c, 0x8549, 0x0076,
-	0x2039, 0x0000, 0x080c, 0x8441, 0x2c08, 0x080c, 0xd27b, 0x007e,
-	0x2001, 0x0007, 0x080c, 0x61b4, 0x2001, 0x0007, 0x080c, 0x6188,
+	0xae0d, 0x009e, 0x1540, 0x0046, 0x0016, 0xbaa0, 0x2220, 0x9006,
+	0x2009, 0x1854, 0x210c, 0x0038, 0x2009, 0x0029, 0x080c, 0xd52a,
+	0xb800, 0xc0e5, 0xb802, 0x2019, 0x0029, 0x080c, 0x8571, 0x0076,
+	0x2039, 0x0000, 0x080c, 0x8469, 0x2c08, 0x080c, 0xd29b, 0x007e,
+	0x2001, 0x0007, 0x080c, 0x61bb, 0x2001, 0x0007, 0x080c, 0x618f,
 	0x001e, 0x004e, 0x9006, 0x015e, 0x003e, 0x002e, 0x00be, 0x00ce,
 	0x0005, 0x00d6, 0x2069, 0x026e, 0x6800, 0x9086, 0x0800, 0x0118,
 	0x6017, 0x0000, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6, 0x00f6,
 	0x0016, 0x0026, 0x0036, 0x0156, 0x2079, 0x026c, 0x7930, 0x7834,
-	0x080c, 0x2663, 0x11d0, 0x080c, 0x6237, 0x11b8, 0x2011, 0x0270,
-	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xadf4,
+	0x080c, 0x2663, 0x11d0, 0x080c, 0x623e, 0x11b8, 0x2011, 0x0270,
+	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xae0d,
 	0x009e, 0x1158, 0x2011, 0x0274, 0x20a9, 0x0004, 0x0096, 0x2b48,
-	0x2019, 0x0006, 0x080c, 0xadf4, 0x009e, 0x015e, 0x003e, 0x002e,
+	0x2019, 0x0006, 0x080c, 0xae0d, 0x009e, 0x015e, 0x003e, 0x002e,
 	0x001e, 0x00fe, 0x00be, 0x0005, 0x00b6, 0x0006, 0x0016, 0x0026,
 	0x0036, 0x0156, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c,
-	0x2663, 0x11d0, 0x080c, 0x6237, 0x11b8, 0x2011, 0x0276, 0x20a9,
-	0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xadf4, 0x009e,
+	0x2663, 0x11d0, 0x080c, 0x623e, 0x11b8, 0x2011, 0x0276, 0x20a9,
+	0x0004, 0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xae0d, 0x009e,
 	0x1158, 0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019,
-	0x0006, 0x080c, 0xadf4, 0x009e, 0x015e, 0x003e, 0x002e, 0x001e,
+	0x0006, 0x080c, 0xae0d, 0x009e, 0x015e, 0x003e, 0x002e, 0x001e,
 	0x000e, 0x00be, 0x0005, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066,
 	0x0056, 0x0046, 0x0026, 0x0126, 0x2091, 0x8000, 0x2740, 0x2029,
 	0x19c1, 0x252c, 0x2021, 0x19c7, 0x2424, 0x2061, 0x1cd0, 0x2071,
 	0x1800, 0x7650, 0x7070, 0x81ff, 0x0150, 0x0006, 0x9186, 0x1a80,
-	0x000e, 0x0128, 0x8001, 0x9602, 0x1a04, 0xd314, 0x0018, 0x9606,
-	0x0904, 0xd314, 0x2100, 0x9c06, 0x0904, 0xd30b, 0x080c, 0xd54b,
-	0x1904, 0xd30b, 0x080c, 0xd838, 0x0904, 0xd30b, 0x080c, 0xd53b,
-	0x0904, 0xd30b, 0x6720, 0x9786, 0x0001, 0x1148, 0x080c, 0x3127,
-	0x0904, 0xd32f, 0x6004, 0x9086, 0x0000, 0x1904, 0xd32f, 0x9786,
-	0x0004, 0x0904, 0xd32f, 0x9786, 0x0007, 0x0904, 0xd30b, 0x2500,
-	0x9c06, 0x0904, 0xd30b, 0x2400, 0x9c06, 0x05e8, 0x88ff, 0x0118,
+	0x000e, 0x0128, 0x8001, 0x9602, 0x1a04, 0xd334, 0x0018, 0x9606,
+	0x0904, 0xd334, 0x2100, 0x9c06, 0x0904, 0xd32b, 0x080c, 0xd56b,
+	0x1904, 0xd32b, 0x080c, 0xd858, 0x0904, 0xd32b, 0x080c, 0xd55b,
+	0x0904, 0xd32b, 0x6720, 0x9786, 0x0001, 0x1148, 0x080c, 0x312e,
+	0x0904, 0xd34f, 0x6004, 0x9086, 0x0000, 0x1904, 0xd34f, 0x9786,
+	0x0004, 0x0904, 0xd34f, 0x9786, 0x0007, 0x0904, 0xd32b, 0x2500,
+	0x9c06, 0x0904, 0xd32b, 0x2400, 0x9c06, 0x05e8, 0x88ff, 0x0118,
 	0x6054, 0x9906, 0x15c0, 0x0096, 0x6000, 0x9086, 0x0004, 0x1120,
 	0x0016, 0x080c, 0x190d, 0x001e, 0x9786, 0x000a, 0x0148, 0x080c,
-	0xbd04, 0x1130, 0x080c, 0xa7a7, 0x009e, 0x080c, 0x9e49, 0x0418,
-	0x6014, 0x2048, 0x080c, 0xbafe, 0x01d8, 0x9786, 0x0003, 0x1570,
+	0xbd1d, 0x1130, 0x080c, 0xa7c0, 0x009e, 0x080c, 0x9e62, 0x0418,
+	0x6014, 0x2048, 0x080c, 0xbb17, 0x01d8, 0x9786, 0x0003, 0x1570,
 	0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048,
-	0x080c, 0x0f9d, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0xd7b3,
-	0x0016, 0x080c, 0xbded, 0x080c, 0x6878, 0x001e, 0x080c, 0xbce7,
-	0x009e, 0x080c, 0x9e49, 0x9ce0, 0x0018, 0x2001, 0x1819, 0x2004,
-	0x9c02, 0x1210, 0x0804, 0xd28f, 0x012e, 0x002e, 0x004e, 0x005e,
+	0x080c, 0x0f9d, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0xd7d3,
+	0x0016, 0x080c, 0xbe06, 0x080c, 0x687f, 0x001e, 0x080c, 0xbd00,
+	0x009e, 0x080c, 0x9e62, 0x9ce0, 0x0018, 0x2001, 0x1819, 0x2004,
+	0x9c02, 0x1210, 0x0804, 0xd2af, 0x012e, 0x002e, 0x004e, 0x005e,
 	0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x0005, 0x9786, 0x0006,
-	0x1150, 0x9386, 0x0005, 0x0128, 0x080c, 0xd7b3, 0x080c, 0xd4b5,
+	0x1150, 0x9386, 0x0005, 0x0128, 0x080c, 0xd7d3, 0x080c, 0xd4d5,
 	0x08f8, 0x009e, 0x0c00, 0x9786, 0x000a, 0x0920, 0x0808, 0x81ff,
 	0x09d0, 0x9180, 0x0001, 0x2004, 0x9086, 0x0018, 0x0130, 0x9180,
 	0x0001, 0x2004, 0x9086, 0x002d, 0x1970, 0x6000, 0x9086, 0x0002,
-	0x1950, 0x080c, 0xbcf3, 0x0130, 0x080c, 0xbd04, 0x1920, 0x080c,
-	0xa7a7, 0x0038, 0x080c, 0x2ffc, 0x080c, 0xbd04, 0x1110, 0x080c,
-	0xa7a7, 0x080c, 0x9e49, 0x0804, 0xd30b, 0xa864, 0x9084, 0x00ff,
+	0x1950, 0x080c, 0xbd0c, 0x0130, 0x080c, 0xbd1d, 0x1920, 0x080c,
+	0xa7c0, 0x0038, 0x080c, 0x3003, 0x080c, 0xbd1d, 0x1110, 0x080c,
+	0xa7c0, 0x080c, 0x9e62, 0x0804, 0xd32b, 0xa864, 0x9084, 0x00ff,
 	0x9086, 0x0039, 0x0005, 0x00c6, 0x00e6, 0x0016, 0x2c08, 0x2170,
-	0x9006, 0x080c, 0xd4dc, 0x001e, 0x0120, 0x6020, 0x9084, 0x000f,
-	0x001b, 0x00ee, 0x00ce, 0x0005, 0xd37a, 0xd37a, 0xd37a, 0xd37a,
-	0xd37a, 0xd37a, 0xd37c, 0xd37a, 0xd37a, 0xd37a, 0xd37a, 0x9e49,
-	0x9e49, 0xd37a, 0x9006, 0x0005, 0x0036, 0x0046, 0x0016, 0x7010,
+	0x9006, 0x080c, 0xd4fc, 0x001e, 0x0120, 0x6020, 0x9084, 0x000f,
+	0x001b, 0x00ee, 0x00ce, 0x0005, 0xd39a, 0xd39a, 0xd39a, 0xd39a,
+	0xd39a, 0xd39a, 0xd39c, 0xd39a, 0xd39a, 0xd39a, 0xd39a, 0x9e62,
+	0x9e62, 0xd39a, 0x9006, 0x0005, 0x0036, 0x0046, 0x0016, 0x7010,
 	0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2009, 0x0020, 0x080c,
-	0xd50a, 0x001e, 0x004e, 0x2019, 0x0002, 0x080c, 0xd0c7, 0x003e,
-	0x9085, 0x0001, 0x0005, 0x0096, 0x080c, 0xbafe, 0x0140, 0x6014,
-	0x904d, 0x080c, 0xb731, 0x687b, 0x0005, 0x080c, 0x6885, 0x009e,
-	0x080c, 0x9e49, 0x9085, 0x0001, 0x0005, 0x2001, 0x0001, 0x080c,
-	0x6174, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
-	0x1805, 0x2011, 0x0276, 0x080c, 0xade0, 0x003e, 0x002e, 0x001e,
+	0xd52a, 0x001e, 0x004e, 0x2019, 0x0002, 0x080c, 0xd0e5, 0x003e,
+	0x9085, 0x0001, 0x0005, 0x0096, 0x080c, 0xbb17, 0x0140, 0x6014,
+	0x904d, 0x080c, 0xb74a, 0x687b, 0x0005, 0x080c, 0x688c, 0x009e,
+	0x080c, 0x9e62, 0x9085, 0x0001, 0x0005, 0x2001, 0x0001, 0x080c,
+	0x617b, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
+	0x1805, 0x2011, 0x0276, 0x080c, 0xadf9, 0x003e, 0x002e, 0x001e,
 	0x015e, 0x9005, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x0076,
 	0x0066, 0x00b6, 0x0126, 0x2091, 0x8000, 0x2740, 0x2061, 0x1cd0,
-	0x2079, 0x0001, 0x8fff, 0x0904, 0xd415, 0x2071, 0x1800, 0x7650,
-	0x7070, 0x8001, 0x9602, 0x1a04, 0xd415, 0x88ff, 0x0120, 0x2800,
-	0x9c06, 0x1590, 0x2078, 0x080c, 0xd53b, 0x0570, 0x2400, 0x9c06,
+	0x2079, 0x0001, 0x8fff, 0x0904, 0xd435, 0x2071, 0x1800, 0x7650,
+	0x7070, 0x8001, 0x9602, 0x1a04, 0xd435, 0x88ff, 0x0120, 0x2800,
+	0x9c06, 0x1590, 0x2078, 0x080c, 0xd55b, 0x0570, 0x2400, 0x9c06,
 	0x0558, 0x6720, 0x9786, 0x0006, 0x1538, 0x9786, 0x0007, 0x0520,
 	0x88ff, 0x1140, 0x6010, 0x9b06, 0x11f8, 0x85ff, 0x0118, 0x6054,
-	0x9106, 0x11d0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xd767,
-	0x080c, 0xc211, 0x080c, 0x190d, 0x6023, 0x0007, 0x6014, 0x2048,
-	0x080c, 0xbafe, 0x0120, 0x0046, 0x080c, 0xd4b5, 0x004e, 0x009e,
-	0x080c, 0x9e49, 0x88ff, 0x1198, 0x9ce0, 0x0018, 0x2001, 0x1819,
-	0x2004, 0x9c02, 0x1210, 0x0804, 0xd3ca, 0x9006, 0x012e, 0x00be,
+	0x9106, 0x11d0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xd787,
+	0x080c, 0xc22a, 0x080c, 0x190d, 0x6023, 0x0007, 0x6014, 0x2048,
+	0x080c, 0xbb17, 0x0120, 0x0046, 0x080c, 0xd4d5, 0x004e, 0x009e,
+	0x080c, 0x9e62, 0x88ff, 0x1198, 0x9ce0, 0x0018, 0x2001, 0x1819,
+	0x2004, 0x9c02, 0x1210, 0x0804, 0xd3ea, 0x9006, 0x012e, 0x00be,
 	0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x98c5,
 	0x0001, 0x0ca0, 0x00b6, 0x0076, 0x0056, 0x0086, 0x9046, 0x2029,
 	0x0001, 0x2c20, 0x2019, 0x0002, 0x6210, 0x2258, 0x0096, 0x904e,
-	0x080c, 0x97a1, 0x009e, 0x008e, 0x903e, 0x080c, 0x984c, 0x080c,
-	0xd3bb, 0x005e, 0x007e, 0x00be, 0x0005, 0x00b6, 0x0046, 0x0056,
+	0x080c, 0x97ba, 0x009e, 0x008e, 0x903e, 0x080c, 0x9865, 0x080c,
+	0xd3db, 0x005e, 0x007e, 0x00be, 0x0005, 0x00b6, 0x0046, 0x0056,
 	0x0076, 0x00c6, 0x0156, 0x2c20, 0x2128, 0x20a9, 0x007f, 0x900e,
-	0x0016, 0x0036, 0x080c, 0x6237, 0x1190, 0x0056, 0x0086, 0x9046,
-	0x2508, 0x2029, 0x0001, 0x0096, 0x904e, 0x080c, 0x97a1, 0x009e,
-	0x008e, 0x903e, 0x080c, 0x984c, 0x080c, 0xd3bb, 0x005e, 0x003e,
-	0x001e, 0x8108, 0x1f04, 0xd448, 0x015e, 0x00ce, 0x007e, 0x005e,
+	0x0016, 0x0036, 0x080c, 0x623e, 0x1190, 0x0056, 0x0086, 0x9046,
+	0x2508, 0x2029, 0x0001, 0x0096, 0x904e, 0x080c, 0x97ba, 0x009e,
+	0x008e, 0x903e, 0x080c, 0x9865, 0x080c, 0xd3db, 0x005e, 0x003e,
+	0x001e, 0x8108, 0x1f04, 0xd468, 0x015e, 0x00ce, 0x007e, 0x005e,
 	0x004e, 0x00be, 0x0005, 0x00b6, 0x0076, 0x0056, 0x6210, 0x2258,
 	0x0086, 0x9046, 0x2029, 0x0001, 0x2019, 0x0048, 0x0096, 0x904e,
-	0x080c, 0x97a1, 0x009e, 0x008e, 0x903e, 0x080c, 0x984c, 0x2c20,
-	0x080c, 0xd3bb, 0x005e, 0x007e, 0x00be, 0x0005, 0x00b6, 0x0046,
+	0x080c, 0x97ba, 0x009e, 0x008e, 0x903e, 0x080c, 0x9865, 0x2c20,
+	0x080c, 0xd3db, 0x005e, 0x007e, 0x00be, 0x0005, 0x00b6, 0x0046,
 	0x0056, 0x0076, 0x00c6, 0x0156, 0x2c20, 0x20a9, 0x0800, 0x900e,
-	0x0016, 0x0036, 0x080c, 0x6237, 0x11a0, 0x0086, 0x9046, 0x2828,
-	0x0046, 0x2021, 0x0001, 0x080c, 0xd74b, 0x004e, 0x0096, 0x904e,
-	0x080c, 0x97a1, 0x009e, 0x008e, 0x903e, 0x080c, 0x984c, 0x080c,
-	0xd3bb, 0x003e, 0x001e, 0x8108, 0x1f04, 0xd490, 0x015e, 0x00ce,
+	0x0016, 0x0036, 0x080c, 0x623e, 0x11a0, 0x0086, 0x9046, 0x2828,
+	0x0046, 0x2021, 0x0001, 0x080c, 0xd76b, 0x004e, 0x0096, 0x904e,
+	0x080c, 0x97ba, 0x009e, 0x008e, 0x903e, 0x080c, 0x9865, 0x080c,
+	0xd3db, 0x003e, 0x001e, 0x8108, 0x1f04, 0xd4b0, 0x015e, 0x00ce,
 	0x007e, 0x005e, 0x004e, 0x00be, 0x0005, 0x0016, 0x00f6, 0x080c,
-	0xbafc, 0x0198, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0046, 0x0180,
-	0xa800, 0x907d, 0x0138, 0xa803, 0x0000, 0xab82, 0x080c, 0x6885,
-	0x2f48, 0x0cb0, 0xab82, 0x080c, 0x6885, 0x00fe, 0x001e, 0x0005,
-	0xa800, 0x907d, 0x0130, 0xa803, 0x0000, 0x080c, 0x6885, 0x2f48,
-	0x0cb8, 0x080c, 0x6885, 0x0c88, 0x00e6, 0x0046, 0x0036, 0x2061,
+	0xbb15, 0x0198, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0046, 0x0180,
+	0xa800, 0x907d, 0x0138, 0xa803, 0x0000, 0xab82, 0x080c, 0x688c,
+	0x2f48, 0x0cb0, 0xab82, 0x080c, 0x688c, 0x00fe, 0x001e, 0x0005,
+	0xa800, 0x907d, 0x0130, 0xa803, 0x0000, 0x080c, 0x688c, 0x2f48,
+	0x0cb8, 0x080c, 0x688c, 0x0c88, 0x00e6, 0x0046, 0x0036, 0x2061,
 	0x1cd0, 0x9005, 0x1138, 0x2071, 0x1800, 0x7450, 0x7070, 0x8001,
 	0x9402, 0x12d8, 0x2100, 0x9c06, 0x0168, 0x6000, 0x9086, 0x0000,
 	0x0148, 0x6008, 0x9206, 0x1130, 0x6010, 0x91a0, 0x0004, 0x2424,
@@ -6613,43 +6617,43 @@
 	0x1220, 0x0c40, 0x9085, 0x0001, 0x0008, 0x9006, 0x003e, 0x004e,
 	0x00ee, 0x0005, 0x0096, 0x0006, 0x080c, 0x0feb, 0x000e, 0x090c,
 	0x0db4, 0xaae2, 0xa867, 0x010d, 0xa88e, 0x0026, 0x2010, 0x080c,
-	0xbaec, 0x2001, 0x0000, 0x0120, 0x2200, 0x9080, 0x0015, 0x2004,
+	0xbb05, 0x2001, 0x0000, 0x0120, 0x2200, 0x9080, 0x0015, 0x2004,
 	0x002e, 0xa87a, 0x9186, 0x0020, 0x0110, 0xa8e3, 0xffff, 0xa986,
 	0xac76, 0xa87f, 0x0000, 0x2001, 0x195f, 0x2004, 0xa882, 0x9006,
-	0xa802, 0xa86a, 0xa88a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6885,
+	0xa802, 0xa86a, 0xa88a, 0x0126, 0x2091, 0x8000, 0x080c, 0x688c,
 	0x012e, 0x009e, 0x0005, 0x6700, 0x9786, 0x0000, 0x0158, 0x9786,
 	0x0001, 0x0140, 0x9786, 0x000a, 0x0128, 0x9786, 0x0009, 0x0110,
 	0x9085, 0x0001, 0x0005, 0x00e6, 0x6010, 0x9075, 0x0138, 0x00b6,
 	0x2058, 0xb8a0, 0x00be, 0x9206, 0x00ee, 0x0005, 0x9085, 0x0001,
 	0x0cd8, 0x0016, 0x6004, 0x908e, 0x001e, 0x11a0, 0x8007, 0x6134,
 	0x918c, 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b,
-	0x6023, 0x0005, 0x2001, 0x1958, 0x2004, 0x601a, 0x080c, 0x83c9,
-	0x080c, 0x894b, 0x001e, 0x0005, 0xa001, 0xa001, 0x0005, 0x6024,
-	0xd0e4, 0x0158, 0xd0cc, 0x0118, 0x080c, 0xbe31, 0x0030, 0x080c,
-	0xd767, 0x080c, 0x81dc, 0x080c, 0x9e19, 0x0005, 0x9280, 0x0008,
-	0x2004, 0x9084, 0x000f, 0x0002, 0xd59a, 0xd59a, 0xd59a, 0xd59c,
-	0xd59a, 0xd59c, 0xd59c, 0xd59a, 0xd59c, 0xd59a, 0xd59a, 0xd59a,
-	0xd59a, 0xd59a, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x9280,
-	0x0008, 0x2004, 0x9084, 0x000f, 0x0002, 0xd5b3, 0xd5b3, 0xd5b3,
-	0xd5b3, 0xd5b3, 0xd5b3, 0xd5c0, 0xd5b3, 0xd5b3, 0xd5b3, 0xd5b3,
-	0xd5b3, 0xd5b3, 0xd5b3, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017,
-	0x2a00, 0x6003, 0x0001, 0x080c, 0x83c9, 0x080c, 0x894b, 0x0005,
-	0x0096, 0x00c6, 0x2260, 0x080c, 0xd767, 0x6043, 0x0000, 0x6024,
+	0x6023, 0x0005, 0x2001, 0x1958, 0x2004, 0x601a, 0x080c, 0x83f1,
+	0x080c, 0x8973, 0x001e, 0x0005, 0xa001, 0xa001, 0x0005, 0x6024,
+	0xd0e4, 0x0158, 0xd0cc, 0x0118, 0x080c, 0xbe4a, 0x0030, 0x080c,
+	0xd787, 0x080c, 0x8204, 0x080c, 0x9e32, 0x0005, 0x9280, 0x0008,
+	0x2004, 0x9084, 0x000f, 0x0002, 0xd5ba, 0xd5ba, 0xd5ba, 0xd5bc,
+	0xd5ba, 0xd5bc, 0xd5bc, 0xd5ba, 0xd5bc, 0xd5ba, 0xd5ba, 0xd5ba,
+	0xd5ba, 0xd5ba, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x9280,
+	0x0008, 0x2004, 0x9084, 0x000f, 0x0002, 0xd5d3, 0xd5d3, 0xd5d3,
+	0xd5d3, 0xd5d3, 0xd5d3, 0xd5e0, 0xd5d3, 0xd5d3, 0xd5d3, 0xd5d3,
+	0xd5d3, 0xd5d3, 0xd5d3, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017,
+	0x2a00, 0x6003, 0x0001, 0x080c, 0x83f1, 0x080c, 0x8973, 0x0005,
+	0x0096, 0x00c6, 0x2260, 0x080c, 0xd787, 0x6043, 0x0000, 0x6024,
 	0xc0f4, 0xc0e4, 0x6026, 0x603b, 0x0000, 0x00ce, 0x00d6, 0x2268,
-	0x9186, 0x0007, 0x1904, 0xd619, 0x6814, 0x9005, 0x0138, 0x2048,
+	0x9186, 0x0007, 0x1904, 0xd639, 0x6814, 0x9005, 0x0138, 0x2048,
 	0xa87c, 0xd0fc, 0x1118, 0x00de, 0x009e, 0x08a8, 0x6007, 0x003a,
-	0x6003, 0x0001, 0x080c, 0x83c9, 0x080c, 0x894b, 0x00c6, 0x2d60,
-	0x6100, 0x9186, 0x0002, 0x1904, 0xd690, 0x6014, 0x9005, 0x1138,
-	0x6000, 0x9086, 0x0007, 0x190c, 0x0db4, 0x0804, 0xd690, 0x2048,
-	0x080c, 0xbafe, 0x1130, 0x0028, 0x2048, 0xa800, 0x9005, 0x1de0,
+	0x6003, 0x0001, 0x080c, 0x83f1, 0x080c, 0x8973, 0x00c6, 0x2d60,
+	0x6100, 0x9186, 0x0002, 0x1904, 0xd6b0, 0x6014, 0x9005, 0x1138,
+	0x6000, 0x9086, 0x0007, 0x190c, 0x0db4, 0x0804, 0xd6b0, 0x2048,
+	0x080c, 0xbb17, 0x1130, 0x0028, 0x2048, 0xa800, 0x9005, 0x1de0,
 	0x2900, 0x2048, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x1168,
 	0xa87c, 0xc0dc, 0xc0f4, 0xa87e, 0xa880, 0xc0fc, 0xa882, 0x2009,
-	0x0043, 0x080c, 0xcf20, 0x0804, 0xd690, 0x2009, 0x0041, 0x0804,
-	0xd68a, 0x9186, 0x0005, 0x15a0, 0x6814, 0x2048, 0xa87c, 0xd0bc,
-	0x1120, 0x00de, 0x009e, 0x0804, 0xd5b3, 0xd0b4, 0x0128, 0xd0fc,
-	0x090c, 0x0db4, 0x0804, 0xd5d4, 0x6007, 0x003a, 0x6003, 0x0001,
-	0x080c, 0x83c9, 0x080c, 0x894b, 0x00c6, 0x2d60, 0x6100, 0x9186,
-	0x0002, 0x0120, 0x9186, 0x0004, 0x1904, 0xd690, 0x6814, 0x2048,
+	0x0043, 0x080c, 0xcf3e, 0x0804, 0xd6b0, 0x2009, 0x0041, 0x0804,
+	0xd6aa, 0x9186, 0x0005, 0x15a0, 0x6814, 0x2048, 0xa87c, 0xd0bc,
+	0x1120, 0x00de, 0x009e, 0x0804, 0xd5d3, 0xd0b4, 0x0128, 0xd0fc,
+	0x090c, 0x0db4, 0x0804, 0xd5f4, 0x6007, 0x003a, 0x6003, 0x0001,
+	0x080c, 0x83f1, 0x080c, 0x8973, 0x00c6, 0x2d60, 0x6100, 0x9186,
+	0x0002, 0x0120, 0x9186, 0x0004, 0x1904, 0xd6b0, 0x6814, 0x2048,
 	0xa97c, 0xc1f4, 0xc1dc, 0xa97e, 0xa980, 0xc1fc, 0xc1bc, 0xa982,
 	0x00f6, 0x2c78, 0x080c, 0x1648, 0x00fe, 0x2009, 0x0042, 0x04d0,
 	0x0036, 0x080c, 0x0feb, 0x090c, 0x0db4, 0xa867, 0x010d, 0x9006,
@@ -6657,24 +6661,24 @@
 	0xa892, 0x6038, 0xa8a2, 0x2360, 0x6024, 0xc0dd, 0x6026, 0x6010,
 	0x00b6, 0x2058, 0xb8a0, 0x00be, 0x2004, 0x6354, 0xab7a, 0xa876,
 	0x9006, 0xa87e, 0xa882, 0xad9a, 0xae96, 0xa89f, 0x0001, 0x080c,
-	0x6885, 0x2019, 0x0045, 0x6008, 0x2068, 0x080c, 0xd0c7, 0x2d00,
+	0x688c, 0x2019, 0x0045, 0x6008, 0x2068, 0x080c, 0xd0e5, 0x2d00,
 	0x600a, 0x6023, 0x0006, 0x6003, 0x0007, 0x901e, 0x631a, 0x6342,
-	0x003e, 0x0038, 0x6043, 0x0000, 0x6003, 0x0007, 0x080c, 0xcf20,
+	0x003e, 0x0038, 0x6043, 0x0000, 0x6003, 0x0007, 0x080c, 0xcf3e,
 	0x00ce, 0x00de, 0x009e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004,
 	0x9082, 0x0085, 0x2008, 0x00c2, 0x9186, 0x0027, 0x1178, 0x080c,
-	0x8846, 0x0036, 0x0096, 0x6014, 0x2048, 0x2019, 0x0004, 0x080c,
-	0xd4b5, 0x009e, 0x003e, 0x080c, 0x894b, 0x0005, 0x9186, 0x0014,
-	0x0d70, 0x080c, 0x9eae, 0x0005, 0xd6c3, 0xd6c1, 0xd6c1, 0xd6c1,
-	0xd6c1, 0xd6c1, 0xd6c3, 0xd6c1, 0xd6c1, 0xd6c1, 0xd6c1, 0xd6c1,
-	0xd6c1, 0x080c, 0x0db4, 0x080c, 0x8846, 0x6003, 0x000c, 0x080c,
-	0x894b, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208,
-	0x001a, 0x080c, 0x9eae, 0x0005, 0xd6e1, 0xd6e1, 0xd6e1, 0xd6e1,
-	0xd6e3, 0xd703, 0xd6e1, 0xd6e1, 0xd6e1, 0xd6e1, 0xd6e1, 0xd6e1,
-	0xd6e1, 0x080c, 0x0db4, 0x00d6, 0x2c68, 0x080c, 0x9dc3, 0x01b0,
+	0x886e, 0x0036, 0x0096, 0x6014, 0x2048, 0x2019, 0x0004, 0x080c,
+	0xd4d5, 0x009e, 0x003e, 0x080c, 0x8973, 0x0005, 0x9186, 0x0014,
+	0x0d70, 0x080c, 0x9ec7, 0x0005, 0xd6e3, 0xd6e1, 0xd6e1, 0xd6e1,
+	0xd6e1, 0xd6e1, 0xd6e3, 0xd6e1, 0xd6e1, 0xd6e1, 0xd6e1, 0xd6e1,
+	0xd6e1, 0x080c, 0x0db4, 0x080c, 0x886e, 0x6003, 0x000c, 0x080c,
+	0x8973, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208,
+	0x001a, 0x080c, 0x9ec7, 0x0005, 0xd701, 0xd701, 0xd701, 0xd701,
+	0xd703, 0xd723, 0xd701, 0xd701, 0xd701, 0xd701, 0xd701, 0xd701,
+	0xd701, 0x080c, 0x0db4, 0x00d6, 0x2c68, 0x080c, 0x9ddc, 0x01b0,
 	0x6003, 0x0001, 0x6007, 0x001e, 0x2009, 0x026e, 0x210c, 0x613a,
 	0x2009, 0x026f, 0x210c, 0x613e, 0x600b, 0xffff, 0x6910, 0x6112,
-	0x6023, 0x0004, 0x080c, 0x83c9, 0x080c, 0x894b, 0x2d60, 0x080c,
-	0x9e19, 0x00de, 0x0005, 0x080c, 0x9e19, 0x0005, 0x00e6, 0x6010,
+	0x6023, 0x0004, 0x080c, 0x83f1, 0x080c, 0x8973, 0x2d60, 0x080c,
+	0x9e32, 0x00de, 0x0005, 0x080c, 0x9e32, 0x0005, 0x00e6, 0x6010,
 	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ec, 0x00ee, 0x0005, 0x2009,
 	0x1873, 0x210c, 0xd1ec, 0x05b0, 0x6003, 0x0002, 0x6024, 0xc0e5,
 	0x6026, 0xd0cc, 0x0150, 0x2001, 0x1959, 0x2004, 0x6042, 0x2009,
@@ -6685,17 +6689,17 @@
 	0x9005, 0x0118, 0x9088, 0x0003, 0x0cd0, 0x2c0a, 0x600f, 0x0000,
 	0x9085, 0x0001, 0x0005, 0x0016, 0x00c6, 0x00e6, 0x6154, 0xb8ac,
 	0x2060, 0x8cff, 0x0180, 0x84ff, 0x1118, 0x6054, 0x9106, 0x1138,
-	0x600c, 0x2072, 0x080c, 0x81dc, 0x080c, 0x9e19, 0x0010, 0x9cf0,
+	0x600c, 0x2072, 0x080c, 0x8204, 0x080c, 0x9e32, 0x0010, 0x9cf0,
 	0x0003, 0x2e64, 0x0c70, 0x00ee, 0x00ce, 0x001e, 0x0005, 0x00d6,
 	0x00b6, 0x6010, 0x2058, 0xb8ac, 0x2068, 0x9005, 0x0130, 0x9c06,
 	0x0110, 0x680c, 0x0cd0, 0x600c, 0x680e, 0x00be, 0x00de, 0x0005,
 	0x0026, 0x0036, 0x0156, 0x2011, 0x182b, 0x2204, 0x9084, 0x00ff,
 	0x2019, 0x026e, 0x2334, 0x9636, 0x1508, 0x8318, 0x2334, 0x2204,
 	0x9084, 0xff00, 0x9636, 0x11d0, 0x2011, 0x0270, 0x20a9, 0x0004,
-	0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xadf4, 0x009e,
+	0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xae0d, 0x009e,
 	0x1168, 0x2011, 0x0274, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048,
-	0x2019, 0x0006, 0x080c, 0xadf4, 0x009e, 0x1100, 0x015e, 0x003e,
-	0x002e, 0x0005, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5c5d, 0x080c,
+	0x2019, 0x0006, 0x080c, 0xae0d, 0x009e, 0x1100, 0x015e, 0x003e,
+	0x002e, 0x0005, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5c64, 0x080c,
 	0x2dbb, 0x00ee, 0x0005, 0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800,
 	0x00be, 0xd0fc, 0x0108, 0x0011, 0x00ee, 0x0005, 0xa880, 0xc0e5,
 	0xa882, 0x0005, 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066, 0x0056,
@@ -6703,17 +6707,17 @@
 	0x252c, 0x2021, 0x19c7, 0x2424, 0x2061, 0x1cd0, 0x2071, 0x1800,
 	0x7650, 0x7070, 0x9606, 0x0578, 0x6720, 0x9786, 0x0001, 0x0118,
 	0x9786, 0x0008, 0x1500, 0x2500, 0x9c06, 0x01e8, 0x2400, 0x9c06,
-	0x01d0, 0x080c, 0xd53b, 0x01b8, 0x080c, 0xd54b, 0x11a0, 0x6000,
+	0x01d0, 0x080c, 0xd55b, 0x01b8, 0x080c, 0xd56b, 0x11a0, 0x6000,
 	0x9086, 0x0004, 0x1120, 0x0016, 0x080c, 0x190d, 0x001e, 0x080c,
-	0xbcf3, 0x1110, 0x080c, 0x2ffc, 0x080c, 0xbd04, 0x1110, 0x080c,
-	0xa7a7, 0x080c, 0x9e49, 0x9ce0, 0x0018, 0x2001, 0x1819, 0x2004,
+	0xbd0c, 0x1110, 0x080c, 0x3003, 0x080c, 0xbd1d, 0x1110, 0x080c,
+	0xa7c0, 0x080c, 0x9e62, 0x9ce0, 0x0018, 0x2001, 0x1819, 0x2004,
 	0x9c02, 0x1208, 0x0858, 0x012e, 0x001e, 0x002e, 0x004e, 0x005e,
 	0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x2001, 0x1810,
 	0x2004, 0xd0dc, 0x0005, 0x0006, 0x2001, 0x1836, 0x2004, 0xd09c,
-	0x000e, 0x0005, 0x0006, 0x0036, 0x0046, 0x080c, 0xc1f9, 0x0168,
+	0x000e, 0x0005, 0x0006, 0x0036, 0x0046, 0x080c, 0xc212, 0x0168,
 	0x2019, 0xffff, 0x9005, 0x0128, 0x6010, 0x00b6, 0x2058, 0xbba0,
-	0x00be, 0x2021, 0x0004, 0x080c, 0x4a6f, 0x004e, 0x003e, 0x000e,
-	0x6004, 0x9086, 0x0001, 0x1128, 0x080c, 0x990d, 0x080c, 0x9e49,
+	0x00be, 0x2021, 0x0004, 0x080c, 0x4a76, 0x004e, 0x003e, 0x000e,
+	0x6004, 0x9086, 0x0001, 0x1128, 0x080c, 0x9926, 0x080c, 0x9e62,
 	0x9006, 0x0005, 0x00e6, 0x00c6, 0x00b6, 0x0046, 0x2061, 0x1cd0,
 	0x2071, 0x1800, 0x7450, 0x7070, 0x8001, 0x9402, 0x12b8, 0x2100,
 	0x9c06, 0x0148, 0x6000, 0x9086, 0x0000, 0x0128, 0x6010, 0x2058,
@@ -6881,11 +6885,11 @@
 	0x000b, 0x3a44, 0x0002, 0x0c0a, 0x000b, 0x022a, 0x000b, 0x15b6,
 	0xf4ac, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040,
 	0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000,
-	0x8000, 0xbd16
+	0x8000, 0x89e3
 };
 #ifdef UNIQUE_FW_NAME
-unsigned short fw2300flx_length01 = 0xd57a;
+unsigned short fw2300flx_length01 = 0xd59a;
 #else
-unsigned short risc_code_length01 = 0xd57a;
+unsigned short risc_code_length01 = 0xd59a;
 #endif
 
diff -Nru a/drivers/scsi/qla2xxx/ql6322_fw.c b/drivers/scsi/qla2xxx/ql6322_fw.c
--- a/drivers/scsi/qla2xxx/ql6322_fw.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/scsi/qla2xxx/ql6322_fw.c	Tue Jun 15 22:21:04 2004
@@ -18,7 +18,7 @@
  *************************************************************************/
 
 /*
- *	Firmware Version 3.02.26 (08:08 Mar 11, 2004)
+ *	Firmware Version 3.02.28 (14:05 Apr 03, 2004)
  */
 
 #ifdef UNIQUE_FW_NAME
@@ -28,15 +28,15 @@
 #endif
 
 #ifdef UNIQUE_FW_NAME
-unsigned char fw2322flx_version_str[] = {3, 2,26};
+unsigned char fw2322flx_version_str[] = {3, 2,28};
 #else
-unsigned char firmware_version[] = {3, 2,26};
+unsigned char firmware_version[] = {3, 2,28};
 #endif
 
 #ifdef UNIQUE_FW_NAME
-#define fw2322flx_VERSION_STRING "3.02.26"
+#define fw2322flx_VERSION_STRING "3.02.28"
 #else
-#define FW_VERSION_STRING "3.02.26"
+#define FW_VERSION_STRING "3.02.28"
 #endif
 
 #ifdef UNIQUE_FW_NAME
@@ -50,12 +50,12 @@
 #else
 unsigned short risc_code01[] = { 
 #endif
-	0x0470, 0x0000, 0x0000, 0xce19, 0x0000, 0x0003, 0x0002, 0x001a,
+	0x0470, 0x0000, 0x0000, 0xce3b, 0x0000, 0x0003, 0x0002, 0x001c,
 	0x0317, 0x2043, 0x4f50, 0x5952, 0x4947, 0x4854, 0x2032, 0x3030,
 	0x3120, 0x514c, 0x4f47, 0x4943, 0x2043, 0x4f52, 0x504f, 0x5241,
 	0x5449, 0x4f4e, 0x2049, 0x5350, 0x3233, 0x3030, 0x2046, 0x6972,
 	0x6d77, 0x6172, 0x6520, 0x2056, 0x6572, 0x7369, 0x6f6e, 0x2030,
-	0x332e, 0x3032, 0x2e32, 0x3620, 0x2020, 0x2020, 0x2400, 0x20a9,
+	0x332e, 0x3032, 0x2e32, 0x3820, 0x2020, 0x2020, 0x2400, 0x20a9,
 	0x000f, 0x2001, 0x0000, 0x400f, 0x2091, 0x2200, 0x20a9, 0x000f,
 	0x2001, 0x0000, 0x400f, 0x2091, 0x2400, 0x20a9, 0x000f, 0x2001,
 	0x0000, 0x400f, 0x2091, 0x2600, 0x20a9, 0x000f, 0x2001, 0x0000,
@@ -82,94 +82,94 @@
 	0x20a8, 0x900e, 0x4104, 0x2009, 0x1800, 0x810d, 0x810d, 0x810d,
 	0x810d, 0x810d, 0x918c, 0x001f, 0x2001, 0x0001, 0x9112, 0x20e9,
 	0x0001, 0x20a1, 0x0800, 0x900e, 0x20a9, 0x0800, 0x4104, 0x8211,
-	0x1dd8, 0x080c, 0x0f3a, 0x080c, 0x5ce3, 0x080c, 0x9b62, 0x080c,
-	0x10f1, 0x080c, 0x12d6, 0x080c, 0x1a5a, 0x080c, 0x8418, 0x080c,
-	0x0cf7, 0x080c, 0x1076, 0x080c, 0x3284, 0x080c, 0x73c0, 0x080c,
-	0x671b, 0x080c, 0x8062, 0x080c, 0x20dd, 0x080c, 0x7a54, 0x080c,
+	0x1dd8, 0x080c, 0x0f3a, 0x080c, 0x5cea, 0x080c, 0x9b7d, 0x080c,
+	0x10f1, 0x080c, 0x12d6, 0x080c, 0x1a5a, 0x080c, 0x8440, 0x080c,
+	0x0cf7, 0x080c, 0x1076, 0x080c, 0x328b, 0x080c, 0x73cb, 0x080c,
+	0x6722, 0x080c, 0x808a, 0x080c, 0x20dd, 0x080c, 0x7a5f, 0x080c,
 	0x1f2b, 0x080c, 0x2065, 0x080c, 0x20d2, 0x2091, 0x3009, 0x7883,
 	0x0000, 0x1004, 0x0941, 0x7880, 0x9086, 0x0002, 0x1190, 0x7883,
 	0x4000, 0x7837, 0x4000, 0x7833, 0x0010, 0x0e04, 0x0935, 0x2091,
 	0x5000, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
 	0x11be, 0x2071, 0x1800, 0x7003, 0x0000, 0x2071, 0x1800, 0x7000,
-	0x908e, 0x0003, 0x1158, 0x080c, 0x4996, 0x080c, 0x32ab, 0x080c,
-	0x7428, 0x080c, 0x6bc3, 0x080c, 0x808b, 0x0c78, 0x000b, 0x0c98,
+	0x908e, 0x0003, 0x1158, 0x080c, 0x499d, 0x080c, 0x32b2, 0x080c,
+	0x7433, 0x080c, 0x6bca, 0x080c, 0x80b3, 0x0c78, 0x000b, 0x0c98,
 	0x0962, 0x0963, 0x0afa, 0x0960, 0x0bab, 0x0cf6, 0x0cf6, 0x0cf6,
 	0x080c, 0x0d65, 0x0005, 0x0126, 0x00f6, 0x2091, 0x8000, 0x7000,
-	0x9086, 0x0001, 0x1904, 0x0acd, 0x080c, 0x0e8d, 0x080c, 0x70ac,
-	0x0150, 0x080c, 0x70cf, 0x15b0, 0x2079, 0x0100, 0x7828, 0x9085,
-	0x1800, 0x782a, 0x0478, 0x080c, 0x6fdd, 0x7000, 0x9086, 0x0001,
+	0x9086, 0x0001, 0x1904, 0x0acd, 0x080c, 0x0e8d, 0x080c, 0x70b7,
+	0x0150, 0x080c, 0x70da, 0x15b0, 0x2079, 0x0100, 0x7828, 0x9085,
+	0x1800, 0x782a, 0x0478, 0x080c, 0x6fe8, 0x7000, 0x9086, 0x0001,
 	0x1904, 0x0acd, 0x7094, 0x9086, 0x0028, 0x1904, 0x0acd, 0x080c,
-	0x805a, 0x080c, 0x804c, 0x2001, 0x0161, 0x2003, 0x0001, 0x2079,
+	0x8082, 0x080c, 0x8074, 0x2001, 0x0161, 0x2003, 0x0001, 0x2079,
 	0x0100, 0x2011, 0xffff, 0x080c, 0x286d, 0x7a28, 0x9295, 0x5e2c,
-	0x7a2a, 0x2011, 0x6f22, 0x080c, 0x8131, 0x2011, 0x6f15, 0x080c,
-	0x8237, 0x2011, 0x5b3a, 0x080c, 0x8131, 0x2011, 0x8030, 0x901e,
-	0x7392, 0x04d0, 0x080c, 0x53e7, 0x2079, 0x0100, 0x7844, 0x9005,
-	0x1904, 0x0acd, 0x2011, 0x5b3a, 0x080c, 0x8131, 0x2011, 0x6f22,
-	0x080c, 0x8131, 0x2011, 0x6f15, 0x080c, 0x8237, 0x2001, 0x0265,
+	0x7a2a, 0x2011, 0x6f2d, 0x080c, 0x8159, 0x2011, 0x6f20, 0x080c,
+	0x825f, 0x2011, 0x5b41, 0x080c, 0x8159, 0x2011, 0x8030, 0x901e,
+	0x7392, 0x04d0, 0x080c, 0x53ee, 0x2079, 0x0100, 0x7844, 0x9005,
+	0x1904, 0x0acd, 0x2011, 0x5b41, 0x080c, 0x8159, 0x2011, 0x6f2d,
+	0x080c, 0x8159, 0x2011, 0x6f20, 0x080c, 0x825f, 0x2001, 0x0265,
 	0x2001, 0x0205, 0x2003, 0x0000, 0x7840, 0x9084, 0xfffb, 0x7842,
 	0x2001, 0x1977, 0x2004, 0x9005, 0x1140, 0x00c6, 0x2061, 0x0100,
-	0x080c, 0x5c8b, 0x00ce, 0x0804, 0x0acd, 0x780f, 0x006b, 0x7a28,
-	0x080c, 0x70b4, 0x0118, 0x9295, 0x5e2c, 0x0010, 0x9295, 0x402c,
+	0x080c, 0x5c92, 0x00ce, 0x0804, 0x0acd, 0x780f, 0x006b, 0x7a28,
+	0x080c, 0x70bf, 0x0118, 0x9295, 0x5e2c, 0x0010, 0x9295, 0x402c,
 	0x7a2a, 0x2011, 0x8010, 0x73d4, 0x2001, 0x1978, 0x2003, 0x0001,
-	0x080c, 0x273f, 0x080c, 0x48d1, 0x7244, 0xc284, 0x7246, 0x2001,
+	0x080c, 0x273f, 0x080c, 0x48d8, 0x7244, 0xc284, 0x7246, 0x2001,
 	0x180c, 0x200c, 0xc1ac, 0xc1cc, 0x2102, 0x2001, 0x0390, 0x2003,
-	0x0400, 0x080c, 0x98ad, 0x080c, 0x91c6, 0x2011, 0x0004, 0x080c,
-	0xb83c, 0x080c, 0x98c9, 0x080c, 0x655b, 0x080c, 0x70ac, 0x1120,
-	0x080c, 0x279a, 0x0600, 0x0420, 0x080c, 0x5c92, 0x0140, 0x7093,
-	0x0001, 0x70cf, 0x0000, 0x080c, 0x55b4, 0x0804, 0x0acd, 0x080c,
-	0x5386, 0xd094, 0x01a8, 0x2001, 0x0390, 0x2003, 0x0404, 0x2011,
-	0x180c, 0x2204, 0xc0cd, 0x2012, 0x080c, 0x538a, 0xd0d4, 0x1118,
+	0x0400, 0x080c, 0x98c8, 0x080c, 0x91e1, 0x2011, 0x0004, 0x080c,
+	0xb857, 0x080c, 0x98e4, 0x080c, 0x6562, 0x080c, 0x70b7, 0x1120,
+	0x080c, 0x279a, 0x0600, 0x0420, 0x080c, 0x5c99, 0x0140, 0x7093,
+	0x0001, 0x70cf, 0x0000, 0x080c, 0x55bb, 0x0804, 0x0acd, 0x080c,
+	0x538d, 0xd094, 0x01a8, 0x2001, 0x0390, 0x2003, 0x0404, 0x2011,
+	0x180c, 0x2204, 0xc0cd, 0x2012, 0x080c, 0x5391, 0xd0d4, 0x1118,
 	0x080c, 0x279a, 0x1270, 0x2011, 0x180c, 0x2204, 0xc0bc, 0x0088,
-	0x080c, 0x538a, 0xd0d4, 0x1db8, 0x2011, 0x180c, 0x2204, 0xc0bd,
-	0x0040, 0x2011, 0x180c, 0x2204, 0xc0bd, 0x2012, 0x080c, 0x6658,
-	0x0008, 0x2012, 0x080c, 0x661e, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e,
-	0x00a8, 0x707b, 0x0000, 0x080c, 0x70ac, 0x1130, 0x70ac, 0x9005,
-	0x1168, 0x080c, 0xbc93, 0x0050, 0x080c, 0xbc93, 0x70d8, 0xd09c,
-	0x1128, 0x70ac, 0x9005, 0x0110, 0x080c, 0x5c68, 0x70e3, 0x0000,
+	0x080c, 0x5391, 0xd0d4, 0x1db8, 0x2011, 0x180c, 0x2204, 0xc0bd,
+	0x0040, 0x2011, 0x180c, 0x2204, 0xc0bd, 0x2012, 0x080c, 0x665f,
+	0x0008, 0x2012, 0x080c, 0x6625, 0x0120, 0x7a0c, 0xc2b4, 0x7a0e,
+	0x00a8, 0x707b, 0x0000, 0x080c, 0x70b7, 0x1130, 0x70ac, 0x9005,
+	0x1168, 0x080c, 0xbcae, 0x0050, 0x080c, 0xbcae, 0x70d8, 0xd09c,
+	0x1128, 0x70ac, 0x9005, 0x0110, 0x080c, 0x5c6f, 0x70e3, 0x0000,
 	0x70df, 0x0000, 0x70a3, 0x0000, 0x080c, 0x27a2, 0x0228, 0x2011,
-	0x0101, 0x2204, 0xc0c4, 0x2012, 0x72d8, 0x080c, 0x70ac, 0x1178,
+	0x0101, 0x2204, 0xc0c4, 0x2012, 0x72d8, 0x080c, 0x70b7, 0x1178,
 	0x9016, 0x0016, 0x2009, 0x0002, 0x2019, 0x193e, 0x211a, 0x001e,
 	0x705b, 0xffff, 0x705f, 0x00ef, 0x707f, 0x0000, 0x0020, 0x2019,
 	0x193e, 0x201b, 0x0000, 0x2079, 0x1853, 0x7804, 0xd0ac, 0x0108,
-	0xc295, 0x72da, 0x080c, 0x70ac, 0x0118, 0x9296, 0x0004, 0x0518,
-	0x2011, 0x0001, 0x080c, 0xb83c, 0x70a7, 0x0000, 0x70ab, 0xffff,
-	0x7003, 0x0002, 0x00fe, 0x080c, 0x2ddb, 0x080c, 0x98ad, 0x2011,
-	0x0005, 0x080c, 0x931e, 0x080c, 0x98c9, 0x080c, 0x70ac, 0x0148,
+	0xc295, 0x72da, 0x080c, 0x70b7, 0x0118, 0x9296, 0x0004, 0x0518,
+	0x2011, 0x0001, 0x080c, 0xb857, 0x70a7, 0x0000, 0x70ab, 0xffff,
+	0x7003, 0x0002, 0x00fe, 0x080c, 0x2ddb, 0x080c, 0x98c8, 0x2011,
+	0x0005, 0x080c, 0x9339, 0x080c, 0x98e4, 0x080c, 0x70b7, 0x0148,
 	0x00c6, 0x2061, 0x0100, 0x0016, 0x2009, 0x0002, 0x61e2, 0x001e,
 	0x00ce, 0x012e, 0x00e0, 0x70a7, 0x0000, 0x70ab, 0xffff, 0x7003,
-	0x0002, 0x080c, 0x98ad, 0x2011, 0x0005, 0x080c, 0x931e, 0x080c,
-	0x98c9, 0x080c, 0x70ac, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016,
+	0x0002, 0x080c, 0x98c8, 0x2011, 0x0005, 0x080c, 0x9339, 0x080c,
+	0x98e4, 0x080c, 0x70b7, 0x0148, 0x00c6, 0x2061, 0x0100, 0x0016,
 	0x2009, 0x0002, 0x61e2, 0x001e, 0x00ce, 0x00fe, 0x012e, 0x0005,
-	0x00c6, 0x00b6, 0x080c, 0x70ac, 0x1118, 0x20a9, 0x0800, 0x0010,
-	0x20a9, 0x0782, 0x080c, 0x70ac, 0x1110, 0x900e, 0x0010, 0x2009,
+	0x00c6, 0x00b6, 0x080c, 0x70b7, 0x1118, 0x20a9, 0x0800, 0x0010,
+	0x20a9, 0x0782, 0x080c, 0x70b7, 0x1110, 0x900e, 0x0010, 0x2009,
 	0x007e, 0x86ff, 0x0138, 0x9180, 0x1000, 0x2004, 0x905d, 0x0110,
-	0xb800, 0xd0bc, 0x090c, 0x3113, 0x8108, 0x1f04, 0x0ae1, 0x707b,
+	0xb800, 0xd0bc, 0x090c, 0x311a, 0x8108, 0x1f04, 0x0ae1, 0x707b,
 	0x0000, 0x707c, 0x9084, 0x00ff, 0x707e, 0x70af, 0x0000, 0x00be,
 	0x00ce, 0x0005, 0x00b6, 0x0126, 0x2091, 0x8000, 0x7000, 0x9086,
 	0x0002, 0x1904, 0x0ba8, 0x70a8, 0x9086, 0xffff, 0x0120, 0x080c,
 	0x2ddb, 0x0804, 0x0ba8, 0x70d8, 0xd0ac, 0x1110, 0xd09c, 0x0520,
 	0xd084, 0x0510, 0x0006, 0x2001, 0x0103, 0x2003, 0x002b, 0x000e,
-	0xd08c, 0x01d0, 0x70dc, 0x9086, 0xffff, 0x0190, 0x080c, 0x2f63,
-	0x70d8, 0xd094, 0x1904, 0x0ba8, 0x2011, 0x0001, 0x080c, 0xbf46,
-	0x0110, 0x2011, 0x0003, 0x901e, 0x080c, 0x2f9d, 0x0804, 0x0ba8,
+	0xd08c, 0x01d0, 0x70dc, 0x9086, 0xffff, 0x0190, 0x080c, 0x2f66,
+	0x70d8, 0xd094, 0x1904, 0x0ba8, 0x2011, 0x0001, 0x080c, 0xbf61,
+	0x0110, 0x2011, 0x0003, 0x901e, 0x080c, 0x2fa0, 0x0804, 0x0ba8,
 	0x70e0, 0x9005, 0x1904, 0x0ba8, 0x70a4, 0x9005, 0x1904, 0x0ba8,
-	0x70d8, 0xd0a4, 0x0118, 0xd0b4, 0x0904, 0x0ba8, 0x080c, 0x661e,
-	0x1904, 0x0ba8, 0x080c, 0x6671, 0x1904, 0x0ba8, 0x080c, 0x6658,
+	0x70d8, 0xd0a4, 0x0118, 0xd0b4, 0x0904, 0x0ba8, 0x080c, 0x6625,
+	0x1904, 0x0ba8, 0x080c, 0x6678, 0x1904, 0x0ba8, 0x080c, 0x665f,
 	0x01c0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c,
-	0x6269, 0x1118, 0xb800, 0xd0ec, 0x1138, 0x001e, 0x8108, 0x1f04,
+	0x6270, 0x1118, 0xb800, 0xd0ec, 0x1138, 0x001e, 0x8108, 0x1f04,
 	0x0b4e, 0x00ce, 0x015e, 0x0028, 0x001e, 0x00ce, 0x015e, 0x0804,
 	0x0ba8, 0x0006, 0x2001, 0x0103, 0x2003, 0x006b, 0x000e, 0x2011,
 	0x1984, 0x080c, 0x0faa, 0x2011, 0x199e, 0x080c, 0x0faa, 0x7030,
 	0xc08c, 0x7032, 0x7003, 0x0003, 0x70ab, 0xffff, 0x080c, 0x0e61,
 	0x9006, 0x080c, 0x23c9, 0x0036, 0x0046, 0x2019, 0xffff, 0x2021,
-	0x0006, 0x080c, 0x4a6e, 0x004e, 0x003e, 0x00f6, 0x2079, 0x0100,
-	0x080c, 0x70cf, 0x0150, 0x080c, 0x70ac, 0x7828, 0x0118, 0x9084,
-	0xe1ff, 0x0010, 0x9084, 0xffdf, 0x782a, 0x00fe, 0x080c, 0x98ad,
+	0x0006, 0x080c, 0x4a75, 0x004e, 0x003e, 0x00f6, 0x2079, 0x0100,
+	0x080c, 0x70da, 0x0150, 0x080c, 0x70b7, 0x7828, 0x0118, 0x9084,
+	0xe1ff, 0x0010, 0x9084, 0xffdf, 0x782a, 0x00fe, 0x080c, 0x98c8,
 	0x2001, 0x19b9, 0x2004, 0x9086, 0x0005, 0x1120, 0x2011, 0x0000,
-	0x080c, 0x931e, 0x2011, 0x0000, 0x080c, 0x9328, 0x080c, 0x98c9,
+	0x080c, 0x9339, 0x2011, 0x0000, 0x080c, 0x9343, 0x080c, 0x98e4,
 	0x012e, 0x00be, 0x0005, 0x0016, 0x0026, 0x0046, 0x00f6, 0x0126,
 	0x2091, 0x8000, 0x2079, 0x0100, 0x7904, 0x918c, 0xfffd, 0x7906,
-	0x2009, 0x00f7, 0x080c, 0x5c51, 0x7940, 0x918c, 0x0010, 0x7942,
+	0x2009, 0x00f7, 0x080c, 0x5c58, 0x7940, 0x918c, 0x0010, 0x7942,
 	0x7924, 0xd1b4, 0x0120, 0x2011, 0x0040, 0x080c, 0x286d, 0xd19c,
 	0x0120, 0x2011, 0x0008, 0x080c, 0x286d, 0x0006, 0x0036, 0x0156,
 	0x0000, 0x2001, 0x1978, 0x2004, 0x9005, 0x1518, 0x080c, 0x2801,
@@ -178,26 +178,26 @@
 	0x9006, 0x080c, 0x2751, 0x0068, 0x080c, 0x2811, 0x1d50, 0x2001,
 	0x1969, 0x2004, 0xd0fc, 0x0108, 0x0020, 0x080c, 0x2568, 0x0804,
 	0x0ca9, 0x080c, 0x2890, 0x080c, 0x28d4, 0x20a9, 0x003a, 0x1d04,
-	0x0bff, 0x080c, 0x8217, 0x1f04, 0x0bff, 0x080c, 0x70bd, 0x0148,
-	0x080c, 0x70cf, 0x1118, 0x080c, 0x73bb, 0x0050, 0x080c, 0x70b4,
-	0x0dd0, 0x080c, 0x73b6, 0x080c, 0x73ac, 0x080c, 0x6fdd, 0x0020,
-	0x2009, 0x00f8, 0x080c, 0x5c51, 0x7850, 0xc0e5, 0x7852, 0x080c,
-	0x70ac, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010, 0x2021, 0xe678,
-	0x2019, 0xea60, 0x0d0c, 0x8217, 0x7820, 0xd09c, 0x15a0, 0x080c,
-	0x70ac, 0x0904, 0x0c8b, 0x7824, 0xd0ac, 0x1904, 0x0cae, 0x080c,
-	0x70cf, 0x1548, 0x0046, 0x2021, 0x0320, 0x8421, 0x1df0, 0x004e,
+	0x0bff, 0x080c, 0x823f, 0x1f04, 0x0bff, 0x080c, 0x70c8, 0x0148,
+	0x080c, 0x70da, 0x1118, 0x080c, 0x73c6, 0x0050, 0x080c, 0x70bf,
+	0x0dd0, 0x080c, 0x73c1, 0x080c, 0x73b7, 0x080c, 0x6fe8, 0x0020,
+	0x2009, 0x00f8, 0x080c, 0x5c58, 0x7850, 0xc0e5, 0x7852, 0x080c,
+	0x70b7, 0x0120, 0x7843, 0x0090, 0x7843, 0x0010, 0x2021, 0xe678,
+	0x2019, 0xea60, 0x0d0c, 0x823f, 0x7820, 0xd09c, 0x15a0, 0x080c,
+	0x70b7, 0x0904, 0x0c8b, 0x7824, 0xd0ac, 0x1904, 0x0cae, 0x080c,
+	0x70da, 0x1548, 0x0046, 0x2021, 0x0320, 0x8421, 0x1df0, 0x004e,
 	0x2011, 0x1800, 0x080c, 0x286d, 0x080c, 0x2819, 0x7824, 0x9084,
 	0x1800, 0x1168, 0x9484, 0x0fff, 0x1140, 0x2001, 0x1810, 0x2004,
 	0x9084, 0x9000, 0x0110, 0x080c, 0x0cd1, 0x8421, 0x1160, 0x1d04,
-	0x0c5b, 0x080c, 0x8217, 0x080c, 0x73b6, 0x080c, 0x73ac, 0x7003,
+	0x0c5b, 0x080c, 0x823f, 0x080c, 0x73c1, 0x080c, 0x73b7, 0x7003,
 	0x0001, 0x0804, 0x0cae, 0x8319, 0x1928, 0x2001, 0x1810, 0x2004,
 	0x9084, 0x9000, 0x0110, 0x080c, 0x0cd1, 0x1d04, 0x0c71, 0x080c,
-	0x8217, 0x2009, 0x196c, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a,
+	0x823f, 0x2009, 0x196c, 0x2104, 0x9005, 0x0118, 0x8001, 0x200a,
 	0x1188, 0x200b, 0x000a, 0x2011, 0x0048, 0x080c, 0x286d, 0x20a9,
 	0x0002, 0x080c, 0x27fa, 0x7924, 0x080c, 0x2819, 0xd19c, 0x0110,
-	0x080c, 0x273f, 0x00f0, 0x080c, 0x70bd, 0x1140, 0x94a2, 0x03e8,
-	0x1128, 0x080c, 0x7080, 0x7003, 0x0001, 0x00c0, 0x2011, 0x1800,
-	0x080c, 0x286d, 0x080c, 0x2819, 0x7824, 0x080c, 0x70c6, 0x0110,
+	0x080c, 0x273f, 0x00f0, 0x080c, 0x70c8, 0x1140, 0x94a2, 0x03e8,
+	0x1128, 0x080c, 0x708b, 0x7003, 0x0001, 0x00c0, 0x2011, 0x1800,
+	0x080c, 0x286d, 0x080c, 0x2819, 0x7824, 0x080c, 0x70d1, 0x0110,
 	0xd0ac, 0x1160, 0x9084, 0x1800, 0x0904, 0x0c63, 0x7003, 0x0001,
 	0x0028, 0x2001, 0x0001, 0x080c, 0x23c9, 0x00a0, 0x7850, 0xc0e4,
 	0x7852, 0x2009, 0x180c, 0x210c, 0xd19c, 0x1120, 0x7904, 0x918d,
@@ -205,20 +205,20 @@
 	0x0028, 0x782a, 0x2001, 0x1978, 0x2003, 0x0000, 0x9006, 0x78f2,
 	0x015e, 0x003e, 0x000e, 0x012e, 0x00fe, 0x004e, 0x002e, 0x001e,
 	0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x0046, 0x00b6, 0x00c6,
-	0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0071, 0x0d0c, 0x8217, 0x015e,
+	0x00d6, 0x00e6, 0x00f6, 0x0156, 0x0071, 0x0d0c, 0x823f, 0x015e,
 	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x004e, 0x003e, 0x002e,
 	0x001e, 0x000e, 0x0005, 0x00e6, 0x2071, 0x1894, 0x7004, 0x9086,
-	0x0001, 0x1110, 0x080c, 0x32ab, 0x00ee, 0x0005, 0x0005, 0x2a70,
-	0x2061, 0x197c, 0x2063, 0x0003, 0x6007, 0x0002, 0x600b, 0x001a,
+	0x0001, 0x1110, 0x080c, 0x32b2, 0x00ee, 0x0005, 0x0005, 0x2a70,
+	0x2061, 0x197c, 0x2063, 0x0003, 0x6007, 0x0002, 0x600b, 0x001c,
 	0x600f, 0x0317, 0x2001, 0x194d, 0x900e, 0x2102, 0x7192, 0x2001,
 	0x0100, 0x2004, 0x9082, 0x0002, 0x0218, 0x705b, 0xffff, 0x0008,
-	0x715a, 0x7063, 0xffff, 0x717a, 0x717e, 0x080c, 0xbc93, 0x70eb,
+	0x715a, 0x7063, 0xffff, 0x717a, 0x717e, 0x080c, 0xbcae, 0x70eb,
 	0x00c0, 0x2061, 0x193d, 0x6003, 0x0909, 0x6106, 0x600b, 0x8800,
 	0x600f, 0x0200, 0x6013, 0x00ff, 0x6017, 0x000f, 0x611a, 0x601f,
 	0x07d0, 0x2061, 0x1945, 0x6003, 0x8000, 0x6106, 0x610a, 0x600f,
 	0x0200, 0x6013, 0x00ff, 0x6116, 0x601b, 0x0001, 0x611e, 0x2061,
 	0x195a, 0x6003, 0x514c, 0x6007, 0x4f47, 0x600b, 0x4943, 0x600f,
-	0x2020, 0x2001, 0x182b, 0x2102, 0x0005, 0x9016, 0x080c, 0x6269,
+	0x2020, 0x2001, 0x182b, 0x2102, 0x0005, 0x9016, 0x080c, 0x6270,
 	0x1178, 0xb804, 0x90c4, 0x00ff, 0x98c6, 0x0006, 0x0128, 0x90c4,
 	0xff00, 0x98c6, 0x0600, 0x1120, 0x9186, 0x0080, 0x0108, 0x8210,
 	0x8108, 0x9186, 0x0800, 0x1d50, 0x2208, 0x0005, 0x2091, 0x8000,
@@ -237,11 +237,11 @@
 	0x2079, 0x1800, 0x7803, 0x0005, 0x2091, 0x4080, 0x2001, 0x0089,
 	0x2004, 0xd084, 0x0180, 0x2001, 0x19f3, 0x2004, 0x9005, 0x0128,
 	0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003,
-	0x0002, 0x2003, 0x1001, 0x080c, 0x5395, 0x1170, 0x080c, 0x0efb,
-	0x0110, 0x080c, 0x0e4e, 0x080c, 0x5395, 0x1130, 0x2071, 0x1800,
+	0x0002, 0x2003, 0x1001, 0x080c, 0x539c, 0x1170, 0x080c, 0x0efb,
+	0x0110, 0x080c, 0x0e4e, 0x080c, 0x539c, 0x1130, 0x2071, 0x1800,
 	0x2011, 0x8000, 0x080c, 0x0f0f, 0x0c70, 0x0005, 0x2001, 0x0382,
 	0x2004, 0x9084, 0x0007, 0x9086, 0x0001, 0x1120, 0x2001, 0x0015,
-	0x080c, 0x989e, 0x2079, 0x0380, 0x2069, 0x1ad4, 0x7818, 0x6802,
+	0x080c, 0x98b9, 0x2079, 0x0380, 0x2069, 0x1ad4, 0x7818, 0x6802,
 	0x781c, 0x6806, 0x7840, 0x680a, 0x7844, 0x680e, 0x782c, 0x6812,
 	0x2019, 0x1adf, 0x9016, 0x7808, 0xd09c, 0x0150, 0x7820, 0x201a,
 	0x8210, 0x8318, 0x8210, 0x9282, 0x0011, 0x0ea8, 0x2011, 0xdead,
@@ -320,7 +320,7 @@
 	0x0016, 0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0xa862, 0x9184,
 	0xffc0, 0xa85e, 0x001e, 0x0020, 0x00e6, 0x0126, 0x2091, 0x8000,
 	0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000,
-	0x70be, 0x080c, 0x804c, 0x012e, 0x00ee, 0x0005, 0x2071, 0x1800,
+	0x70be, 0x080c, 0x8074, 0x012e, 0x00ee, 0x0005, 0x2071, 0x1800,
 	0x9026, 0x2009, 0x0000, 0x2049, 0x0400, 0x2900, 0x702e, 0x8940,
 	0x2800, 0xa802, 0xa95e, 0xa863, 0x0001, 0x8420, 0x9886, 0x0440,
 	0x0120, 0x2848, 0x9188, 0x0040, 0x0c90, 0x2071, 0x1883, 0x7000,
@@ -384,15 +384,15 @@
 	0x008e, 0x00de, 0x009e, 0x080c, 0x112b, 0x0005, 0x00de, 0x009e,
 	0x080c, 0x112b, 0x0005, 0xa8a8, 0xd08c, 0x0005, 0x0096, 0xa0a0,
 	0x904d, 0x090c, 0x0d65, 0xa06c, 0x908e, 0x0100, 0x0130, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x080c, 0x6983, 0xa09f,
+	0x0030, 0xa883, 0x0000, 0xa897, 0x4002, 0x080c, 0x698a, 0xa09f,
 	0x0000, 0xa0a3, 0x0000, 0x2848, 0x080c, 0x1054, 0x009e, 0x0005,
 	0x00a6, 0xa0a0, 0x904d, 0x090c, 0x0d65, 0xa06c, 0x908e, 0x0100,
 	0x0128, 0xa87b, 0x0001, 0xa883, 0x0000, 0x00c0, 0xa80c, 0x2050,
 	0xb004, 0x9005, 0x0198, 0xa80e, 0x2050, 0x8006, 0x8006, 0x8007,
 	0x908c, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0xa076, 0xa172,
 	0xb000, 0xa07a, 0x2810, 0x080c, 0x110c, 0x00e8, 0xa97c, 0xa894,
-	0x0016, 0x0006, 0x080c, 0x6983, 0x000e, 0x001e, 0xd1fc, 0x1138,
-	0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, 0x9bcc, 0x00ce, 0x7008,
+	0x0016, 0x0006, 0x080c, 0x698a, 0x000e, 0x001e, 0xd1fc, 0x1138,
+	0xd1f4, 0x0128, 0x00c6, 0x2060, 0x080c, 0x9be7, 0x00ce, 0x7008,
 	0x2048, 0xa89f, 0x0000, 0xa8a3, 0x0000, 0x080c, 0x1054, 0x7007,
 	0x0000, 0x080c, 0x112b, 0x00ae, 0x0005, 0x0126, 0x2091, 0x8000,
 	0x782b, 0x1001, 0x7007, 0x0005, 0x7000, 0xc094, 0x7002, 0x012e,
@@ -411,9 +411,9 @@
 	0x190c, 0x0d5e, 0xd19c, 0x05a0, 0x7820, 0x908c, 0xf000, 0x0540,
 	0x2060, 0x6020, 0x9086, 0x0003, 0x1550, 0x6000, 0x9086, 0x0004,
 	0x1530, 0x6114, 0x2148, 0xa876, 0xa87a, 0xa867, 0x0103, 0x080c,
-	0x67a5, 0x00b6, 0x6010, 0x2058, 0xba3c, 0x8211, 0x0208, 0xba3e,
-	0xb8c0, 0x9005, 0x190c, 0x6394, 0x00be, 0x6044, 0xd0fc, 0x190c,
-	0x98d6, 0x080c, 0x9bf4, 0x7808, 0xd09c, 0x19b0, 0x012e, 0x0005,
+	0x67ac, 0x00b6, 0x6010, 0x2058, 0xba3c, 0x8211, 0x0208, 0xba3e,
+	0xb8c0, 0x9005, 0x190c, 0x639b, 0x00be, 0x6044, 0xd0fc, 0x190c,
+	0x98f1, 0x080c, 0x9c0f, 0x7808, 0xd09c, 0x19b0, 0x012e, 0x0005,
 	0x908a, 0x0024, 0x1a0c, 0x0d65, 0x002b, 0x012e, 0x0005, 0x04b0,
 	0x012e, 0x0005, 0x138e, 0x13b4, 0x13e4, 0x13e9, 0x13ed, 0x13f2,
 	0x141a, 0x141e, 0x142c, 0x1430, 0x138e, 0x14ba, 0x14be, 0x1521,
@@ -421,25 +421,25 @@
 	0x138e, 0x138e, 0x138e, 0x138e, 0x138e, 0x13f4, 0x138e, 0x13bc,
 	0x13e1, 0x13a8, 0x138e, 0x13c8, 0x1392, 0x1390, 0x080c, 0x0d65,
 	0x080c, 0x0d5e, 0x080c, 0x1528, 0x2009, 0x1a49, 0x2104, 0x8000,
-	0x200a, 0x080c, 0x7b17, 0x080c, 0x195f, 0x0005, 0x6044, 0xd0fc,
-	0x190c, 0x98d6, 0x2009, 0x0055, 0x080c, 0x9c6a, 0x012e, 0x0005,
-	0x080c, 0x1528, 0x2060, 0x6044, 0xd0fc, 0x190c, 0x98d6, 0x2009,
-	0x0055, 0x080c, 0x9c6a, 0x0005, 0x2009, 0x0048, 0x080c, 0x1528,
-	0x2060, 0x080c, 0x9c6a, 0x0005, 0x2009, 0x0054, 0x080c, 0x1528,
-	0x2060, 0x6044, 0xd0fc, 0x190c, 0x98d6, 0x080c, 0x9c6a, 0x0005,
+	0x200a, 0x080c, 0x7b22, 0x080c, 0x195f, 0x0005, 0x6044, 0xd0fc,
+	0x190c, 0x98f1, 0x2009, 0x0055, 0x080c, 0x9c85, 0x012e, 0x0005,
+	0x080c, 0x1528, 0x2060, 0x6044, 0xd0fc, 0x190c, 0x98f1, 0x2009,
+	0x0055, 0x080c, 0x9c85, 0x0005, 0x2009, 0x0048, 0x080c, 0x1528,
+	0x2060, 0x080c, 0x9c85, 0x0005, 0x2009, 0x0054, 0x080c, 0x1528,
+	0x2060, 0x6044, 0xd0fc, 0x190c, 0x98f1, 0x080c, 0x9c85, 0x0005,
 	0x080c, 0x1528, 0x2060, 0x0056, 0x0066, 0x080c, 0x1528, 0x2028,
 	0x080c, 0x1528, 0x2030, 0x0036, 0x0046, 0x2021, 0x0000, 0x2418,
-	0x2009, 0x0056, 0x080c, 0x9c6a, 0x004e, 0x003e, 0x006e, 0x005e,
+	0x2009, 0x0056, 0x080c, 0x9c85, 0x004e, 0x003e, 0x006e, 0x005e,
 	0x0005, 0x080c, 0x1528, 0x0005, 0x7004, 0xc085, 0xc0b5, 0x7006,
 	0x0005, 0x7004, 0xc085, 0x7006, 0x0005, 0x080c, 0x1528, 0x080c,
 	0x15e5, 0x0005, 0x080c, 0x0d65, 0x080c, 0x1528, 0x2060, 0x6014,
 	0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, 0x2009, 0x0048, 0x080c,
-	0x9c6a, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009, 0x03e8, 0x8109,
+	0x9c85, 0x2001, 0x015d, 0x2003, 0x0000, 0x2009, 0x03e8, 0x8109,
 	0x0160, 0x2001, 0x0201, 0x2004, 0x9005, 0x0dc8, 0x2001, 0x0218,
 	0x2004, 0xd0ec, 0x1110, 0x080c, 0x152d, 0x2001, 0x0307, 0x2003,
 	0x8000, 0x0005, 0x7004, 0xc095, 0x7006, 0x0005, 0x080c, 0x1528,
 	0x2060, 0x6014, 0x0096, 0x2048, 0xa83b, 0xffff, 0x009e, 0x2009,
-	0x0048, 0x080c, 0x9c6a, 0x0005, 0x080c, 0x1528, 0x080c, 0x0d65,
+	0x0048, 0x080c, 0x9c85, 0x0005, 0x080c, 0x1528, 0x080c, 0x0d65,
 	0x080c, 0x1528, 0x080c, 0x14a5, 0x7827, 0x0018, 0x79ac, 0xd1dc,
 	0x0540, 0x7827, 0x0015, 0x7828, 0x782b, 0x0000, 0x9065, 0x0138,
 	0x2001, 0x020d, 0x2003, 0x0050, 0x2003, 0x0020, 0x0400, 0x7004,
@@ -447,13 +447,13 @@
 	0xd1bc, 0x090c, 0x0d65, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003,
 	0x0020, 0x0480, 0x78ab, 0x0004, 0x7803, 0x0001, 0x080c, 0x14be,
 	0x0005, 0x7828, 0x782b, 0x0000, 0x9065, 0x090c, 0x0d65, 0x6014,
-	0x2048, 0x78ab, 0x0004, 0x918c, 0x0700, 0x0198, 0x080c, 0x7b17,
-	0x080c, 0x195f, 0x080c, 0xb82c, 0x0158, 0xa9ac, 0xa936, 0xa9b0,
+	0x2048, 0x78ab, 0x0004, 0x918c, 0x0700, 0x0198, 0x080c, 0x7b22,
+	0x080c, 0x195f, 0x080c, 0xb847, 0x0158, 0xa9ac, 0xa936, 0xa9b0,
 	0xa93a, 0xa83f, 0xffff, 0xa843, 0xffff, 0xa880, 0xc0bd, 0xa882,
 	0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x6024,
-	0x190c, 0xbc28, 0x2029, 0x00c8, 0x8529, 0x0128, 0x2001, 0x0201,
-	0x2004, 0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xd5b1, 0xd5a4, 0x1118,
-	0x080c, 0x152d, 0x0005, 0x080c, 0x7b17, 0x080c, 0x195f, 0x0005,
+	0x190c, 0xbc43, 0x2029, 0x00c8, 0x8529, 0x0128, 0x2001, 0x0201,
+	0x2004, 0x9005, 0x0dc8, 0x7dbc, 0x080c, 0xd5d3, 0xd5a4, 0x1118,
+	0x080c, 0x152d, 0x0005, 0x080c, 0x7b22, 0x080c, 0x195f, 0x0005,
 	0x781f, 0x0300, 0x7803, 0x0001, 0x0005, 0x0016, 0x0066, 0x0076,
 	0x00f6, 0x2079, 0x0300, 0x7908, 0x918c, 0x0007, 0x9186, 0x0003,
 	0x0120, 0x2001, 0x0016, 0x080c, 0x159e, 0x00fe, 0x007e, 0x006e,
@@ -470,7 +470,7 @@
 	0x0218, 0x2004, 0xd0ec, 0x1110, 0x0401, 0x0040, 0x2001, 0x020d,
 	0x2003, 0x0020, 0x080c, 0x12ea, 0x7803, 0x0001, 0x00ee, 0x001e,
 	0x0005, 0x2001, 0x020d, 0x2003, 0x0050, 0x2003, 0x0020, 0x0069,
-	0x0ca8, 0x0031, 0x2060, 0x2009, 0x0053, 0x080c, 0x9c6a, 0x0005,
+	0x0ca8, 0x0031, 0x2060, 0x2009, 0x0053, 0x080c, 0x9c85, 0x0005,
 	0x7808, 0xd09c, 0x0de8, 0x7820, 0x0005, 0x080c, 0x14a5, 0x00d6,
 	0x2069, 0x0200, 0x2009, 0x01f4, 0x8109, 0x0510, 0x6804, 0x9005,
 	0x0dd8, 0x2001, 0x015d, 0x2003, 0x0000, 0x79bc, 0xd1a4, 0x1528,
@@ -478,7 +478,7 @@
 	0x0007, 0x918c, 0x0ff8, 0x810c, 0x810c, 0x810c, 0x080c, 0x1590,
 	0x6827, 0x0001, 0x8109, 0x1dd0, 0x04d9, 0x6827, 0x0002, 0x04c1,
 	0x6804, 0x9005, 0x1130, 0x682c, 0xd0e4, 0x1500, 0x6804, 0x9005,
-	0x0de8, 0x79b8, 0xd1ec, 0x1130, 0x08c0, 0x080c, 0x7b17, 0x080c,
+	0x0de8, 0x79b8, 0xd1ec, 0x1130, 0x08c0, 0x080c, 0x7b22, 0x080c,
 	0x195f, 0x0090, 0x7827, 0x0015, 0x782b, 0x0000, 0x7827, 0x0018,
 	0x782b, 0x0000, 0x2001, 0x020d, 0x2003, 0x0020, 0x2001, 0x0307,
 	0x2003, 0x0300, 0x7803, 0x0001, 0x00de, 0x0005, 0x682c, 0x9084,
@@ -499,9 +499,9 @@
 	0x1644, 0x7017, 0x0000, 0x2001, 0x0264, 0x2004, 0xd0bc, 0x0904,
 	0x1644, 0x2001, 0x0268, 0x00c6, 0x2064, 0x6104, 0x6038, 0x00ce,
 	0x918e, 0x0039, 0x1904, 0x1644, 0x9c06, 0x15f0, 0x0126, 0x2091,
-	0x2600, 0x080c, 0x7a6f, 0x012e, 0x7358, 0x745c, 0x6014, 0x905d,
+	0x2600, 0x080c, 0x7a7a, 0x012e, 0x7358, 0x745c, 0x6014, 0x905d,
 	0x0598, 0x2b48, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-	0x190c, 0xbc03, 0xab42, 0xac3e, 0x2001, 0x1875, 0x2004, 0xd0b4,
+	0x190c, 0xbc1e, 0xab42, 0xac3e, 0x2001, 0x1875, 0x2004, 0xd0b4,
 	0x1170, 0x601c, 0xd0e4, 0x1158, 0x6010, 0x00b6, 0x2058, 0xb800,
 	0x00be, 0xd0bc, 0x1120, 0xa83b, 0x7fff, 0xa837, 0xffff, 0x080c,
 	0x1d17, 0x1190, 0x080c, 0x17f2, 0x2a00, 0xa816, 0x0130, 0x2800,
@@ -596,7 +596,7 @@
 	0x81ff, 0x1118, 0xa887, 0x0001, 0x0008, 0xa986, 0x601b, 0x0002,
 	0xa974, 0xd1dc, 0x1108, 0x0005, 0xa934, 0xa88c, 0x9106, 0x1158,
 	0xa938, 0xa890, 0x9106, 0x1138, 0x601c, 0xc084, 0x601e, 0x2009,
-	0x0048, 0x0804, 0x9c6a, 0x0005, 0x0126, 0x00c6, 0x2091, 0x2200,
+	0x0048, 0x0804, 0x9c85, 0x0005, 0x0126, 0x00c6, 0x2091, 0x2200,
 	0x00ce, 0x7908, 0x918c, 0x0007, 0x9186, 0x0000, 0x05b0, 0x9186,
 	0x0003, 0x0598, 0x6020, 0x6023, 0x0000, 0x0006, 0x2031, 0x0008,
 	0x00c6, 0x781f, 0x0808, 0x7808, 0xd09c, 0x0120, 0x080c, 0x132a,
@@ -607,17 +607,17 @@
 	0x19fb, 0x000e, 0x6022, 0x012e, 0x0005, 0x080c, 0x19e8, 0x7827,
 	0x0015, 0x7828, 0x9c06, 0x1db8, 0x782b, 0x0000, 0x0ca0, 0x00f6,
 	0x2079, 0x0300, 0x7803, 0x0000, 0x78ab, 0x0004, 0x00fe, 0x080c,
-	0x70ac, 0x11b0, 0x2001, 0x0138, 0x2003, 0x0000, 0x2001, 0x0160,
+	0x70b7, 0x11b0, 0x2001, 0x0138, 0x2003, 0x0000, 0x2001, 0x0160,
 	0x2003, 0x0000, 0x2011, 0x012c, 0xa001, 0xa001, 0x8211, 0x1de0,
-	0x0081, 0x2001, 0x0386, 0x2003, 0x2020, 0x080c, 0x714d, 0x0005,
+	0x0081, 0x2001, 0x0386, 0x2003, 0x2020, 0x080c, 0x7158, 0x0005,
 	0x0479, 0x0039, 0x2001, 0x0160, 0x2502, 0x2001, 0x0138, 0x2202,
 	0x0005, 0x00e6, 0x2071, 0x0200, 0x080c, 0x2825, 0x2009, 0x003c,
 	0x080c, 0x2052, 0x2001, 0x015d, 0x2003, 0x0000, 0x7000, 0x9084,
-	0x003c, 0x1de0, 0x080c, 0x804c, 0x70a0, 0x70a2, 0x7098, 0x709a,
+	0x003c, 0x1de0, 0x080c, 0x8074, 0x70a0, 0x70a2, 0x7098, 0x709a,
 	0x709c, 0x709e, 0x2001, 0x020d, 0x2003, 0x0020, 0x00f6, 0x2079,
 	0x0300, 0x080c, 0x12ea, 0x7803, 0x0001, 0x00fe, 0x00ee, 0x0005,
 	0x2001, 0x0138, 0x2014, 0x2003, 0x0000, 0x2001, 0x0160, 0x202c,
-	0x2003, 0x0000, 0x080c, 0x70ac, 0x1108, 0x0005, 0x2021, 0x0260,
+	0x2003, 0x0000, 0x080c, 0x70b7, 0x1108, 0x0005, 0x2021, 0x0260,
 	0x2001, 0x0141, 0x201c, 0xd3dc, 0x1168, 0x2001, 0x0109, 0x201c,
 	0x939c, 0x0048, 0x1160, 0x2001, 0x0111, 0x201c, 0x83ff, 0x1110,
 	0x8421, 0x1d70, 0x2001, 0x015d, 0x2003, 0x0000, 0x0005, 0x0046,
@@ -693,12 +693,12 @@
 	0x080c, 0x0d65, 0x00f6, 0x00e6, 0x0096, 0x00c6, 0x0026, 0x704c,
 	0x9c06, 0x190c, 0x0d65, 0x2079, 0x0090, 0x2001, 0x0105, 0x2003,
 	0x0010, 0x782b, 0x0004, 0x7057, 0x0000, 0x6014, 0x2048, 0x080c,
-	0xb82c, 0x0118, 0xa880, 0xc0bd, 0xa882, 0x6020, 0x9086, 0x0006,
+	0xb847, 0x0118, 0xa880, 0xc0bd, 0xa882, 0x6020, 0x9086, 0x0006,
 	0x1170, 0x2061, 0x0100, 0x62c8, 0x2001, 0x00fa, 0x8001, 0x1df0,
 	0x60c8, 0x9206, 0x1dc0, 0x60c4, 0xa89a, 0x60c8, 0xa896, 0x704c,
-	0x2060, 0x00c6, 0x080c, 0xb437, 0x080c, 0x98ad, 0x00ce, 0x704c,
-	0x9c06, 0x1150, 0x2009, 0x0040, 0x080c, 0x2052, 0x080c, 0x949d,
-	0x2011, 0x0000, 0x080c, 0x9328, 0x002e, 0x00ce, 0x009e, 0x00ee,
+	0x2060, 0x00c6, 0x080c, 0xb452, 0x080c, 0x98c8, 0x00ce, 0x704c,
+	0x9c06, 0x1150, 0x2009, 0x0040, 0x080c, 0x2052, 0x080c, 0x94b8,
+	0x2011, 0x0000, 0x080c, 0x9343, 0x002e, 0x00ce, 0x009e, 0x00ee,
 	0x00fe, 0x0005, 0x00f6, 0x2079, 0x0090, 0x781c, 0x0006, 0x7818,
 	0x0006, 0x2079, 0x0100, 0x7a14, 0x9284, 0x1984, 0x9085, 0x0012,
 	0x7816, 0x2019, 0x1000, 0x8319, 0x090c, 0x0d65, 0x7820, 0xd0bc,
@@ -708,11 +708,11 @@
 	0x00fe, 0x0005, 0x00f6, 0x00e6, 0x2071, 0x19b8, 0x7054, 0x9086,
 	0x0000, 0x0904, 0x1cc8, 0x2079, 0x0090, 0x2009, 0x0207, 0x210c,
 	0xd194, 0x01b8, 0x2009, 0x020c, 0x210c, 0x9184, 0x0003, 0x0188,
-	0x080c, 0xd5fa, 0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0d65,
+	0x080c, 0xd61c, 0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0d65,
 	0x0016, 0x2009, 0x0040, 0x080c, 0x2052, 0x001e, 0x2001, 0x020c,
 	0x2102, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106,
 	0x1120, 0x2009, 0x0040, 0x080c, 0x2052, 0x782c, 0xd0fc, 0x09a8,
-	0x080c, 0x98c9, 0x782c, 0xd0fc, 0x1de8, 0x080c, 0x98ad, 0x7054,
+	0x080c, 0x98e4, 0x782c, 0xd0fc, 0x1de8, 0x080c, 0x98c8, 0x7054,
 	0x9086, 0x0000, 0x1950, 0x782b, 0x0004, 0x782c, 0xd0ac, 0x1de8,
 	0x2009, 0x0040, 0x080c, 0x2052, 0x782b, 0x0002, 0x7057, 0x0000,
 	0x00ee, 0x00fe, 0x0005, 0x080c, 0x0d65, 0x8c60, 0x2c05, 0x9005,
@@ -797,17 +797,17 @@
 	0x781b, 0x0002, 0x783b, 0x001f, 0x7837, 0x0020, 0x7803, 0x1600,
 	0x012e, 0x0005, 0x2091, 0x2600, 0x781c, 0xd0a4, 0x190c, 0x204f,
 	0x7900, 0xd1dc, 0x1118, 0x9084, 0x0006, 0x001a, 0x9084, 0x000e,
-	0x0002, 0x1f71, 0x1f69, 0x7a6f, 0x1f69, 0x1f6b, 0x1f6b, 0x1f6b,
-	0x1f6b, 0x7a55, 0x1f69, 0x1f6d, 0x1f69, 0x1f6b, 0x1f69, 0x1f6b,
-	0x1f69, 0x080c, 0x0d65, 0x0031, 0x0020, 0x080c, 0x7a55, 0x080c,
-	0x7a6f, 0x0005, 0x0006, 0x0016, 0x0026, 0x080c, 0xd5fa, 0x7930,
-	0x9184, 0x0003, 0x01f0, 0x080c, 0x98ad, 0x2001, 0x19cb, 0x2004,
+	0x0002, 0x1f71, 0x1f69, 0x7a7a, 0x1f69, 0x1f6b, 0x1f6b, 0x1f6b,
+	0x1f6b, 0x7a60, 0x1f69, 0x1f6d, 0x1f69, 0x1f6b, 0x1f69, 0x1f6b,
+	0x1f69, 0x080c, 0x0d65, 0x0031, 0x0020, 0x080c, 0x7a60, 0x080c,
+	0x7a7a, 0x0005, 0x0006, 0x0016, 0x0026, 0x080c, 0xd61c, 0x7930,
+	0x9184, 0x0003, 0x01f0, 0x080c, 0x98c8, 0x2001, 0x19cb, 0x2004,
 	0x9005, 0x0180, 0x2001, 0x0133, 0x2004, 0x9005, 0x090c, 0x0d65,
-	0x00c6, 0x2001, 0x19cb, 0x2064, 0x080c, 0x98c9, 0x080c, 0xb437,
-	0x00ce, 0x0408, 0x2009, 0x0040, 0x080c, 0x2052, 0x080c, 0x98c9,
+	0x00c6, 0x2001, 0x19cb, 0x2064, 0x080c, 0x98e4, 0x080c, 0xb452,
+	0x00ce, 0x0408, 0x2009, 0x0040, 0x080c, 0x2052, 0x080c, 0x98e4,
 	0x00d0, 0x9184, 0x0014, 0x01a0, 0x6a00, 0x9286, 0x0003, 0x0160,
-	0x080c, 0x70ac, 0x1138, 0x080c, 0x73ac, 0x080c, 0x5cd5, 0x080c,
-	0x6fdd, 0x0010, 0x080c, 0x5b90, 0x080c, 0x7b0d, 0x0041, 0x0018,
+	0x080c, 0x70b7, 0x1138, 0x080c, 0x73b7, 0x080c, 0x5cdc, 0x080c,
+	0x6fe8, 0x0010, 0x080c, 0x5b97, 0x080c, 0x7b18, 0x0041, 0x0018,
 	0x9184, 0x9540, 0x1dc8, 0x002e, 0x001e, 0x000e, 0x0005, 0x00e6,
 	0x0036, 0x0046, 0x0056, 0x2071, 0x1a3c, 0x080c, 0x195f, 0x005e,
 	0x004e, 0x003e, 0x00ee, 0x0005, 0x0126, 0x2091, 0x2e00, 0x2071,
@@ -852,90 +852,90 @@
 	0x0007, 0x0002, 0x2105, 0x2102, 0x2102, 0x2102, 0x2104, 0x2102,
 	0x2102, 0x2102, 0x080c, 0x0d65, 0x0029, 0x002e, 0x001e, 0x000e,
 	0x012e, 0x0005, 0x00a6, 0x6124, 0x6028, 0xd09c, 0x0118, 0xd19c,
-	0x1904, 0x2364, 0xd1f4, 0x190c, 0x0d5e, 0x080c, 0x70ac, 0x0904,
-	0x2162, 0x080c, 0xbf46, 0x1120, 0x7000, 0x9086, 0x0003, 0x0580,
-	0x6024, 0x9084, 0x1800, 0x0560, 0x080c, 0x70cf, 0x0118, 0x080c,
-	0x70bd, 0x1530, 0x2011, 0x0020, 0x080c, 0x286d, 0x6043, 0x0000,
-	0x080c, 0xbf46, 0x0168, 0x080c, 0x70cf, 0x1150, 0x2001, 0x1978,
-	0x2003, 0x0001, 0x6027, 0x1800, 0x080c, 0x6f22, 0x0804, 0x2367,
+	0x1904, 0x2364, 0xd1f4, 0x190c, 0x0d5e, 0x080c, 0x70b7, 0x0904,
+	0x2162, 0x080c, 0xbf61, 0x1120, 0x7000, 0x9086, 0x0003, 0x0580,
+	0x6024, 0x9084, 0x1800, 0x0560, 0x080c, 0x70da, 0x0118, 0x080c,
+	0x70c8, 0x1530, 0x2011, 0x0020, 0x080c, 0x286d, 0x6043, 0x0000,
+	0x080c, 0xbf61, 0x0168, 0x080c, 0x70da, 0x1150, 0x2001, 0x1978,
+	0x2003, 0x0001, 0x6027, 0x1800, 0x080c, 0x6f2d, 0x0804, 0x2367,
 	0x70a0, 0x9005, 0x1150, 0x70a3, 0x0001, 0x00d6, 0x2069, 0x0140,
-	0x080c, 0x7103, 0x00de, 0x1904, 0x2367, 0x080c, 0x73b6, 0x0428,
-	0x080c, 0x70cf, 0x1590, 0x6024, 0x9084, 0x1800, 0x1108, 0x0468,
-	0x080c, 0x73b6, 0x080c, 0x73ac, 0x080c, 0x5cd5, 0x080c, 0x6fdd,
+	0x080c, 0x710e, 0x00de, 0x1904, 0x2367, 0x080c, 0x73c1, 0x0428,
+	0x080c, 0x70da, 0x1590, 0x6024, 0x9084, 0x1800, 0x1108, 0x0468,
+	0x080c, 0x73c1, 0x080c, 0x73b7, 0x080c, 0x5cdc, 0x080c, 0x6fe8,
 	0x0804, 0x2364, 0xd1ac, 0x1508, 0x6024, 0xd0dc, 0x1170, 0xd0e4,
 	0x1178, 0xd0d4, 0x1190, 0xd0cc, 0x0130, 0x7094, 0x9086, 0x0028,
-	0x1110, 0x080c, 0x728f, 0x0804, 0x2364, 0x080c, 0x73b1, 0x0048,
-	0x2001, 0x194e, 0x2003, 0x0002, 0x0020, 0x080c, 0x71ed, 0x0804,
-	0x2364, 0x080c, 0x7331, 0x0804, 0x2364, 0xd1ac, 0x0904, 0x227e,
-	0x080c, 0x70ac, 0x11d0, 0x2011, 0x0020, 0x080c, 0x286d, 0x0006,
-	0x0026, 0x0036, 0x080c, 0x70c6, 0x1158, 0x080c, 0x73ac, 0x080c,
-	0x5cd5, 0x080c, 0x6fdd, 0x003e, 0x002e, 0x000e, 0x00ae, 0x0005,
-	0x003e, 0x002e, 0x000e, 0x080c, 0x7080, 0x0016, 0x0046, 0x00c6,
+	0x1110, 0x080c, 0x729a, 0x0804, 0x2364, 0x080c, 0x73bc, 0x0048,
+	0x2001, 0x194e, 0x2003, 0x0002, 0x0020, 0x080c, 0x71f8, 0x0804,
+	0x2364, 0x080c, 0x733c, 0x0804, 0x2364, 0xd1ac, 0x0904, 0x227e,
+	0x080c, 0x70b7, 0x11d0, 0x2011, 0x0020, 0x080c, 0x286d, 0x0006,
+	0x0026, 0x0036, 0x080c, 0x70d1, 0x1158, 0x080c, 0x73b7, 0x080c,
+	0x5cdc, 0x080c, 0x6fe8, 0x003e, 0x002e, 0x000e, 0x00ae, 0x0005,
+	0x003e, 0x002e, 0x000e, 0x080c, 0x708b, 0x0016, 0x0046, 0x00c6,
 	0x644c, 0x9486, 0xf0f0, 0x1138, 0x2061, 0x0100, 0x644a, 0x6043,
 	0x0090, 0x6043, 0x0010, 0x74d6, 0x948c, 0xff00, 0x7038, 0xd084,
 	0x0178, 0x9186, 0xf800, 0x1160, 0x7044, 0xd084, 0x1148, 0xc085,
-	0x7046, 0x0036, 0x2418, 0x2011, 0x8016, 0x080c, 0x48d1, 0x003e,
-	0x080c, 0xbf3f, 0x1904, 0x2255, 0x9196, 0xff00, 0x05a8, 0x705c,
+	0x7046, 0x0036, 0x2418, 0x2011, 0x8016, 0x080c, 0x48d8, 0x003e,
+	0x080c, 0xbf5a, 0x1904, 0x2255, 0x9196, 0xff00, 0x05a8, 0x705c,
 	0x9084, 0x00ff, 0x810f, 0x81ff, 0x0110, 0x9116, 0x0568, 0x7130,
-	0xd184, 0x1550, 0x080c, 0x317f, 0x0128, 0xc18d, 0x7132, 0x080c,
-	0x6658, 0x1510, 0x6240, 0x9294, 0x0010, 0x0130, 0x6248, 0x9294,
+	0xd184, 0x1550, 0x080c, 0x3186, 0x0128, 0xc18d, 0x7132, 0x080c,
+	0x665f, 0x1510, 0x6240, 0x9294, 0x0010, 0x0130, 0x6248, 0x9294,
 	0xff00, 0x9296, 0xff00, 0x01c0, 0x7030, 0xd08c, 0x0904, 0x2255,
 	0x7038, 0xd08c, 0x1140, 0x2001, 0x180c, 0x200c, 0xd1ac, 0x1904,
 	0x2255, 0xc1ad, 0x2102, 0x0036, 0x73d4, 0x2011, 0x8013, 0x080c,
-	0x48d1, 0x003e, 0x0804, 0x2255, 0x7038, 0xd08c, 0x1140, 0x2001,
+	0x48d8, 0x003e, 0x0804, 0x2255, 0x7038, 0xd08c, 0x1140, 0x2001,
 	0x180c, 0x200c, 0xd1ac, 0x1904, 0x2255, 0xc1ad, 0x2102, 0x0036,
-	0x73d4, 0x2011, 0x8013, 0x080c, 0x48d1, 0x003e, 0x7130, 0xc185,
+	0x73d4, 0x2011, 0x8013, 0x080c, 0x48d8, 0x003e, 0x7130, 0xc185,
 	0x7132, 0x2011, 0x1854, 0x220c, 0x00f0, 0x0016, 0x2009, 0x0001,
-	0x2011, 0x0100, 0x080c, 0x83c3, 0x2019, 0x000e, 0x00c6, 0x2061,
-	0x0000, 0x080c, 0xd1c9, 0x00ce, 0x9484, 0x00ff, 0x9080, 0x3184,
+	0x2011, 0x0100, 0x080c, 0x83eb, 0x2019, 0x000e, 0x00c6, 0x2061,
+	0x0000, 0x080c, 0xd1eb, 0x00ce, 0x9484, 0x00ff, 0x9080, 0x318b,
 	0x200d, 0x918c, 0xff00, 0x810f, 0x2120, 0x9006, 0x2009, 0x000e,
-	0x080c, 0xd251, 0x001e, 0xd1ac, 0x1148, 0x0016, 0x2009, 0x0002,
-	0x2019, 0x0004, 0x080c, 0x2fc2, 0x001e, 0x0078, 0x0156, 0x00b6,
-	0x20a9, 0x007f, 0x900e, 0x080c, 0x6269, 0x1110, 0x080c, 0x5cef,
+	0x080c, 0xd273, 0x001e, 0xd1ac, 0x1148, 0x0016, 0x2009, 0x0002,
+	0x2019, 0x0004, 0x080c, 0x2fc5, 0x001e, 0x0078, 0x0156, 0x00b6,
+	0x20a9, 0x007f, 0x900e, 0x080c, 0x6270, 0x1110, 0x080c, 0x5cf6,
 	0x8108, 0x1f04, 0x224b, 0x00be, 0x015e, 0x00ce, 0x004e, 0x080c,
-	0x98ad, 0x080c, 0x9b52, 0x080c, 0x98c9, 0x60e3, 0x0000, 0x001e,
+	0x98c8, 0x080c, 0x9b6d, 0x080c, 0x98e4, 0x60e3, 0x0000, 0x001e,
 	0x2001, 0x1800, 0x2014, 0x9296, 0x0004, 0x1170, 0xd19c, 0x11b0,
 	0x2011, 0x180c, 0x2214, 0xd29c, 0x1120, 0x6204, 0x9295, 0x0002,
 	0x6206, 0x6228, 0xc29d, 0x622a, 0x2003, 0x0001, 0x2001, 0x1825,
 	0x2003, 0x0000, 0x2011, 0x0020, 0x080c, 0x286d, 0xd194, 0x0904,
-	0x2364, 0x0016, 0x080c, 0x98ad, 0x6220, 0xd2b4, 0x0904, 0x230c,
-	0x080c, 0x81e3, 0x080c, 0x8f9c, 0x2011, 0x0004, 0x080c, 0x286d,
+	0x2364, 0x0016, 0x080c, 0x98c8, 0x6220, 0xd2b4, 0x0904, 0x230c,
+	0x080c, 0x820b, 0x080c, 0x8fb7, 0x2011, 0x0004, 0x080c, 0x286d,
 	0x00f6, 0x2019, 0x19c4, 0x2304, 0x907d, 0x0904, 0x22d9, 0x7804,
 	0x9086, 0x0032, 0x15f0, 0x00d6, 0x00c6, 0x00e6, 0x0096, 0x2069,
 	0x0140, 0x782c, 0x685e, 0x7808, 0x685a, 0x6043, 0x0002, 0x2001,
 	0x0003, 0x8001, 0x1df0, 0x6043, 0x0000, 0x2001, 0x003c, 0x8001,
 	0x1df0, 0x080c, 0x2843, 0x2001, 0x001e, 0x8001, 0x0240, 0x20a9,
 	0x0009, 0x080c, 0x27fa, 0x6904, 0xd1dc, 0x1140, 0x0cb0, 0x2001,
-	0x0100, 0x080c, 0x2833, 0x9006, 0x080c, 0x2833, 0x080c, 0x884c,
-	0x080c, 0x98c9, 0x7814, 0x2048, 0xa867, 0x0103, 0x2f60, 0x080c,
-	0x9bcc, 0x009e, 0x00ee, 0x00ce, 0x00de, 0x00fe, 0x001e, 0x00ae,
+	0x0100, 0x080c, 0x2833, 0x9006, 0x080c, 0x2833, 0x080c, 0x8874,
+	0x080c, 0x98e4, 0x7814, 0x2048, 0xa867, 0x0103, 0x2f60, 0x080c,
+	0x9be7, 0x009e, 0x00ee, 0x00ce, 0x00de, 0x00fe, 0x001e, 0x00ae,
 	0x0005, 0x00fe, 0x00d6, 0x2069, 0x0140, 0x6804, 0x9084, 0x4000,
 	0x0110, 0x080c, 0x2843, 0x00de, 0x00c6, 0x2061, 0x19b8, 0x6034,
-	0x080c, 0xbf46, 0x0120, 0x909a, 0x0003, 0x1258, 0x0018, 0x909a,
-	0x00c8, 0x1238, 0x8000, 0x6036, 0x00ce, 0x080c, 0x8f74, 0x0804,
-	0x2361, 0x2061, 0x0100, 0x62c0, 0x080c, 0x97e3, 0x2019, 0x19c4,
+	0x080c, 0xbf61, 0x0120, 0x909a, 0x0003, 0x1258, 0x0018, 0x909a,
+	0x00c8, 0x1238, 0x8000, 0x6036, 0x00ce, 0x080c, 0x8f8f, 0x0804,
+	0x2361, 0x2061, 0x0100, 0x62c0, 0x080c, 0x97fe, 0x2019, 0x19c4,
 	0x2304, 0x9065, 0x0130, 0x6003, 0x0001, 0x2009, 0x0027, 0x080c,
-	0x9c6a, 0x00ce, 0x0804, 0x2361, 0xd2bc, 0x05e0, 0x080c, 0x81f0,
+	0x9c85, 0x00ce, 0x0804, 0x2361, 0xd2bc, 0x05e0, 0x080c, 0x8218,
 	0x2011, 0x0004, 0x080c, 0x286d, 0x00d6, 0x2069, 0x0140, 0x6804,
 	0x9084, 0x4000, 0x0110, 0x080c, 0x2843, 0x00de, 0x00c6, 0x2061,
-	0x19b8, 0x6050, 0x080c, 0xbf46, 0x0120, 0x909a, 0x0003, 0x1638,
+	0x19b8, 0x6050, 0x080c, 0xbf61, 0x0120, 0x909a, 0x0003, 0x1638,
 	0x0018, 0x909a, 0x00c8, 0x1618, 0x8000, 0x6052, 0x604c, 0x00ce,
-	0x9005, 0x0578, 0x2009, 0x07d0, 0x080c, 0x81e8, 0x9080, 0x0008,
+	0x9005, 0x0578, 0x2009, 0x07d0, 0x080c, 0x8210, 0x9080, 0x0008,
 	0x2004, 0x9086, 0x0006, 0x1138, 0x2009, 0x1984, 0x2011, 0x0012,
 	0x080c, 0x287c, 0x00f0, 0x2009, 0x1984, 0x2011, 0x0016, 0x080c,
 	0x287c, 0x00b8, 0x2011, 0x0004, 0x080c, 0x286d, 0x0090, 0x0036,
-	0x2019, 0x0001, 0x080c, 0x926b, 0x003e, 0x2019, 0x19cb, 0x2304,
-	0x9065, 0x0130, 0x2009, 0x004f, 0x6003, 0x0003, 0x080c, 0x9c6a,
-	0x00ce, 0x080c, 0x98c9, 0x001e, 0xd19c, 0x0904, 0x23c2, 0x7038,
+	0x2019, 0x0001, 0x080c, 0x9286, 0x003e, 0x2019, 0x19cb, 0x2304,
+	0x9065, 0x0130, 0x2009, 0x004f, 0x6003, 0x0003, 0x080c, 0x9c85,
+	0x00ce, 0x080c, 0x98e4, 0x001e, 0xd19c, 0x0904, 0x23c2, 0x7038,
 	0xd0ac, 0x1538, 0x0016, 0x0156, 0x2011, 0x0008, 0x080c, 0x286d,
 	0x6050, 0xc0e5, 0x6052, 0x20a9, 0x0367, 0x1f04, 0x238f, 0x1d04,
-	0x2377, 0x080c, 0x8217, 0x6020, 0xd09c, 0x1db8, 0x00f6, 0x2079,
+	0x2377, 0x080c, 0x823f, 0x6020, 0xd09c, 0x1db8, 0x00f6, 0x2079,
 	0x0100, 0x080c, 0x27aa, 0x00fe, 0x1d80, 0x6050, 0xc0e4, 0x6052,
 	0x2011, 0x0008, 0x080c, 0x286d, 0x015e, 0x001e, 0x0498, 0x015e,
-	0x001e, 0x0016, 0x6028, 0xc09c, 0x602a, 0x080c, 0x98ad, 0x080c,
-	0x9b52, 0x080c, 0x98c9, 0x60e3, 0x0000, 0x080c, 0xd5d9, 0x080c,
-	0xd5f4, 0x080c, 0x538a, 0xd0fc, 0x1138, 0x080c, 0xbf3f, 0x1120,
-	0x9085, 0x0001, 0x080c, 0x70f3, 0x9006, 0x080c, 0x2833, 0x2009,
+	0x001e, 0x0016, 0x6028, 0xc09c, 0x602a, 0x080c, 0x98c8, 0x080c,
+	0x9b6d, 0x080c, 0x98e4, 0x60e3, 0x0000, 0x080c, 0xd5fb, 0x080c,
+	0xd616, 0x080c, 0x5391, 0xd0fc, 0x1138, 0x080c, 0xbf5a, 0x1120,
+	0x9085, 0x0001, 0x080c, 0x70fe, 0x9006, 0x080c, 0x2833, 0x2009,
 	0x0002, 0x080c, 0x281f, 0x00e6, 0x2071, 0x1800, 0x7003, 0x0004,
 	0x080c, 0x0e9c, 0x00ee, 0x2011, 0x0008, 0x080c, 0x286d, 0x080c,
 	0x0bab, 0x001e, 0x918c, 0xffd0, 0x2110, 0x080c, 0x286d, 0x00ae,
@@ -943,34 +943,34 @@
 	0x2091, 0x8000, 0x2071, 0x1800, 0x71cc, 0x70ce, 0x9116, 0x0904,
 	0x241c, 0x81ff, 0x01a0, 0x2009, 0x0000, 0x080c, 0x281f, 0x2011,
 	0x8011, 0x2019, 0x010e, 0x231c, 0x939e, 0x0007, 0x1118, 0x2019,
-	0x0001, 0x0010, 0x2019, 0x0000, 0x080c, 0x48d1, 0x0468, 0x2001,
+	0x0001, 0x0010, 0x2019, 0x0000, 0x080c, 0x48d8, 0x0468, 0x2001,
 	0x1979, 0x200c, 0x81ff, 0x1140, 0x2001, 0x0109, 0x2004, 0xd0b4,
 	0x0118, 0x2019, 0x0003, 0x0008, 0x2118, 0x2011, 0x8012, 0x080c,
-	0x48d1, 0x080c, 0x0e9c, 0x080c, 0x538a, 0xd0fc, 0x11a8, 0x080c,
-	0xbf3f, 0x1190, 0x00c6, 0x080c, 0x24b8, 0x080c, 0x98ad, 0x080c,
-	0x91c6, 0x080c, 0x98c9, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009,
-	0x0002, 0x080c, 0x2fc2, 0x00ce, 0x012e, 0x00fe, 0x00ee, 0x003e,
+	0x48d8, 0x080c, 0x0e9c, 0x080c, 0x5391, 0xd0fc, 0x11a8, 0x080c,
+	0xbf5a, 0x1190, 0x00c6, 0x080c, 0x24b8, 0x080c, 0x98c8, 0x080c,
+	0x91e1, 0x080c, 0x98e4, 0x2061, 0x0100, 0x2019, 0x0028, 0x2009,
+	0x0002, 0x080c, 0x2fc5, 0x00ce, 0x012e, 0x00fe, 0x00ee, 0x003e,
 	0x002e, 0x001e, 0x000e, 0x0005, 0x2028, 0x918c, 0x00ff, 0x2130,
 	0x9094, 0xff00, 0x11f0, 0x2011, 0x1836, 0x2214, 0xd2ac, 0x11c8,
 	0x81ff, 0x01e8, 0x2011, 0x181e, 0x2204, 0x9106, 0x1190, 0x2011,
 	0x181f, 0x2214, 0x9294, 0xff00, 0x9584, 0xff00, 0x9206, 0x1148,
 	0x2011, 0x181f, 0x2214, 0x9294, 0x00ff, 0x9584, 0x00ff, 0x9206,
-	0x1120, 0x2500, 0x080c, 0x7d48, 0x0048, 0x9584, 0x00ff, 0x9080,
-	0x3184, 0x200d, 0x918c, 0xff00, 0x810f, 0x9006, 0x0005, 0x9080,
-	0x3184, 0x200d, 0x918c, 0x00ff, 0x0005, 0x00d6, 0x2069, 0x0140,
+	0x1120, 0x2500, 0x080c, 0x7d70, 0x0048, 0x9584, 0x00ff, 0x9080,
+	0x318b, 0x200d, 0x918c, 0xff00, 0x810f, 0x9006, 0x0005, 0x9080,
+	0x318b, 0x200d, 0x918c, 0x00ff, 0x0005, 0x00d6, 0x2069, 0x0140,
 	0x2001, 0x1817, 0x2003, 0x00ef, 0x20a9, 0x0010, 0x9006, 0x6852,
 	0x6856, 0x1f04, 0x2468, 0x00de, 0x0005, 0x0006, 0x00d6, 0x0026,
 	0x2069, 0x0140, 0x2001, 0x1817, 0x2102, 0x8114, 0x8214, 0x8214,
 	0x8214, 0x20a9, 0x0010, 0x6853, 0x0000, 0x9006, 0x82ff, 0x1128,
-	0x9184, 0x000f, 0x9080, 0xd608, 0x2005, 0x6856, 0x8211, 0x1f04,
+	0x9184, 0x000f, 0x9080, 0xd62a, 0x2005, 0x6856, 0x8211, 0x1f04,
 	0x247d, 0x002e, 0x00de, 0x000e, 0x0005, 0x00c6, 0x2061, 0x1800,
 	0x6030, 0x0110, 0xc09d, 0x0008, 0xc09c, 0x6032, 0x00ce, 0x0005,
 	0x0156, 0x00d6, 0x0026, 0x0016, 0x0006, 0x2069, 0x0140, 0x6980,
 	0x9116, 0x0180, 0x9112, 0x1230, 0x8212, 0x8210, 0x22a8, 0x2001,
 	0x0402, 0x0018, 0x22a8, 0x2001, 0x0404, 0x680e, 0x1f04, 0x24ad,
 	0x680f, 0x0000, 0x000e, 0x001e, 0x002e, 0x00de, 0x015e, 0x0005,
-	0x080c, 0x5386, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046,
-	0x2020, 0x2009, 0x002e, 0x080c, 0xd251, 0x004e, 0x0005, 0x00f6,
+	0x080c, 0x538d, 0xd0c4, 0x0150, 0xd0a4, 0x0140, 0x9006, 0x0046,
+	0x2020, 0x2009, 0x002e, 0x080c, 0xd273, 0x004e, 0x0005, 0x00f6,
 	0x0016, 0x0026, 0x2079, 0x0140, 0x78c4, 0xd0dc, 0x0904, 0x2524,
 	0x080c, 0x279a, 0x0660, 0x9084, 0x0700, 0x908e, 0x0600, 0x1120,
 	0x2011, 0x4000, 0x900e, 0x0458, 0x908e, 0x0500, 0x1120, 0x2011,
@@ -979,9 +979,9 @@
 	0x00b0, 0x908e, 0x0200, 0x1120, 0x9016, 0x2009, 0x0004, 0x0078,
 	0x908e, 0x0100, 0x1548, 0x9016, 0x2009, 0x0008, 0x0040, 0x9084,
 	0x0700, 0x908e, 0x0300, 0x1500, 0x2011, 0x0030, 0x0058, 0x2300,
-	0x9080, 0x0020, 0x2018, 0x080c, 0x83f1, 0x928c, 0xff00, 0x0110,
+	0x9080, 0x0020, 0x2018, 0x080c, 0x8419, 0x928c, 0xff00, 0x0110,
 	0x2011, 0x00ff, 0x2200, 0x8007, 0x9085, 0x004c, 0x78c2, 0x2009,
-	0x0138, 0x220a, 0x080c, 0x70ac, 0x1118, 0x2009, 0x193e, 0x220a,
+	0x0138, 0x220a, 0x080c, 0x70b7, 0x1118, 0x2009, 0x193e, 0x220a,
 	0x002e, 0x001e, 0x00fe, 0x0005, 0x78c3, 0x0000, 0x0cc8, 0x0126,
 	0x2091, 0x2800, 0x0006, 0x0016, 0x0026, 0x2001, 0x0170, 0x200c,
 	0x8000, 0x2014, 0x9184, 0x0003, 0x0110, 0x080c, 0x0d5e, 0x002e,
@@ -997,17 +997,17 @@
 	0x25f1, 0x25f3, 0x2001, 0x0001, 0x080c, 0x23c9, 0x080c, 0x27e4,
 	0x2001, 0x1963, 0x2003, 0x0000, 0x7828, 0x9084, 0xe1d7, 0x782a,
 	0x9006, 0x20a9, 0x0009, 0x080c, 0x27b6, 0x2001, 0x1961, 0x2003,
-	0x0006, 0x2009, 0x001e, 0x2011, 0x25f4, 0x080c, 0x81f5, 0x0005,
+	0x0006, 0x2009, 0x001e, 0x2011, 0x25f4, 0x080c, 0x821d, 0x0005,
 	0x2009, 0x1966, 0x200b, 0x0000, 0x2001, 0x196b, 0x2003, 0x0036,
 	0x2001, 0x196a, 0x2003, 0x002a, 0x2001, 0x1963, 0x2003, 0x0001,
 	0x9006, 0x080c, 0x2751, 0x2001, 0xffff, 0x20a9, 0x0009, 0x080c,
 	0x27b6, 0x2001, 0x1961, 0x2003, 0x0006, 0x2009, 0x001e, 0x2011,
-	0x25f4, 0x080c, 0x81f5, 0x0005, 0x080c, 0x0d65, 0x2001, 0x196b,
+	0x25f4, 0x080c, 0x821d, 0x0005, 0x080c, 0x0d65, 0x2001, 0x196b,
 	0x2003, 0x0036, 0x2001, 0x1963, 0x2003, 0x0003, 0x7a38, 0x9294,
 	0x0005, 0x9296, 0x0004, 0x0110, 0x9006, 0x0010, 0x2001, 0x0001,
 	0x080c, 0x2751, 0x2001, 0x1967, 0x2003, 0x0000, 0x2001, 0xffff,
 	0x20a9, 0x0009, 0x080c, 0x27b6, 0x2001, 0x1961, 0x2003, 0x0006,
-	0x2009, 0x001e, 0x2011, 0x25f4, 0x080c, 0x81f5, 0x0005, 0x080c,
+	0x2009, 0x001e, 0x2011, 0x25f4, 0x080c, 0x821d, 0x0005, 0x080c,
 	0x0d65, 0x080c, 0x0d65, 0x0005, 0x0006, 0x0016, 0x0026, 0x00e6,
 	0x00f6, 0x0156, 0x0126, 0x2091, 0x8000, 0x2079, 0x0100, 0x2001,
 	0x1963, 0x2004, 0x908a, 0x0007, 0x1a0c, 0x0d65, 0x0043, 0x012e,
@@ -1069,24 +1069,24 @@
 	0x783b, 0x0007, 0x0090, 0x9186, 0x0001, 0x1118, 0x783b, 0x0006,
 	0x0060, 0x9186, 0x0002, 0x1118, 0x783b, 0x0005, 0x0030, 0x9186,
 	0x0003, 0x1118, 0x783b, 0x0004, 0x0000, 0x0006, 0x1d04, 0x27d6,
-	0x080c, 0x8217, 0x1f04, 0x27d6, 0x7850, 0x9085, 0x1000, 0x7852,
+	0x080c, 0x823f, 0x1f04, 0x27d6, 0x7850, 0x9085, 0x1000, 0x7852,
 	0x000e, 0x001e, 0x012e, 0x0005, 0x080c, 0x28d4, 0x0005, 0x0006,
 	0x0156, 0x00f6, 0x2079, 0x0100, 0x20a9, 0x000a, 0x7854, 0xd0ac,
 	0x1100, 0x7854, 0xd08c, 0x1110, 0x1f04, 0x27f1, 0x00fe, 0x015e,
-	0x000e, 0x0005, 0x1d04, 0x27fa, 0x080c, 0x8217, 0x1f04, 0x27fa,
+	0x000e, 0x0005, 0x1d04, 0x27fa, 0x080c, 0x823f, 0x1f04, 0x27fa,
 	0x0005, 0x0006, 0x2001, 0x196d, 0x2004, 0x9086, 0x0000, 0x000e,
 	0x0005, 0x0006, 0x2001, 0x196d, 0x2004, 0x9086, 0x0001, 0x000e,
 	0x0005, 0x0006, 0x2001, 0x196d, 0x2004, 0x9086, 0x0002, 0x000e,
 	0x0005, 0xa001, 0xa001, 0xa001, 0xa001, 0xa001, 0x0005, 0x0006,
 	0x2001, 0x1979, 0x2102, 0x000e, 0x0005, 0x2009, 0x0171, 0x2104,
 	0xd0dc, 0x0140, 0x2009, 0x0170, 0x2104, 0x200b, 0x0080, 0xa001,
-	0xa001, 0x200a, 0x0005, 0x0016, 0x0026, 0x080c, 0x70c6, 0x0108,
+	0xa001, 0x200a, 0x0005, 0x0016, 0x0026, 0x080c, 0x70d1, 0x0108,
 	0xc0bc, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001, 0x9215, 0x220a,
 	0x002e, 0x001e, 0x0005, 0x0016, 0x0026, 0x2009, 0x0140, 0x2114,
 	0x9294, 0x0001, 0x9285, 0x1000, 0x200a, 0x220a, 0x002e, 0x001e,
 	0x0005, 0x0016, 0x0026, 0x2009, 0x0140, 0x2114, 0x9294, 0x0001,
 	0x9215, 0x220a, 0x002e, 0x001e, 0x0005, 0x0006, 0x0016, 0x2009,
-	0x0140, 0x2104, 0x1128, 0x080c, 0x70c6, 0x0110, 0xc0bc, 0x0008,
+	0x0140, 0x2104, 0x1128, 0x080c, 0x70d1, 0x0110, 0xc0bc, 0x0008,
 	0xc0bd, 0x200a, 0x001e, 0x000e, 0x0005, 0x00f6, 0x2079, 0x0380,
 	0x7843, 0x0101, 0x7844, 0xd084, 0x1de8, 0x2001, 0x0109, 0x2202,
 	0x7843, 0x0100, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0380, 0x7843,
@@ -1193,2654 +1193,2659 @@
 	0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
 	0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x20e6,
 	0x080c, 0x132a, 0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006,
-	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x9913,
+	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x992e,
 	0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-	0x0146, 0x0156, 0x080c, 0x9913, 0x080c, 0x20e6, 0x0804, 0x2dd2,
+	0x0146, 0x0156, 0x080c, 0x992e, 0x080c, 0x20e6, 0x0804, 0x2dd2,
 	0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-	0x080c, 0x1f20, 0x080c, 0x9913, 0x0804, 0x2dd2, 0x0106, 0x0006,
+	0x080c, 0x1f20, 0x080c, 0x992e, 0x0804, 0x2dd2, 0x0106, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20,
-	0x080c, 0x9913, 0x080c, 0x20e6, 0x0804, 0x2dd2, 0x0106, 0x0006,
-	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x9913,
+	0x080c, 0x992e, 0x080c, 0x20e6, 0x0804, 0x2dd2, 0x0106, 0x0006,
+	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x992e,
 	0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
-	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x9913, 0x080c, 0x20e6,
+	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x992e, 0x080c, 0x20e6,
 	0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
-	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x9913,
+	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x992e,
 	0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
-	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x9913,
+	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x992e,
 	0x080c, 0x20e6, 0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006,
-	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x9913,
+	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x992e,
 	0x080c, 0x132a, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
-	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x9913, 0x080c, 0x20e6,
+	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x992e, 0x080c, 0x20e6,
 	0x080c, 0x132a, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
-	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x9913,
+	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x992e,
 	0x080c, 0x132a, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
-	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x9913,
+	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x992e,
 	0x080c, 0x20e6, 0x080c, 0x132a, 0x0804, 0x2dd2, 0x0106, 0x0006,
-	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x9913,
+	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x992e,
 	0x080c, 0x132a, 0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006,
-	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x9913,
+	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x992e,
 	0x080c, 0x20e6, 0x080c, 0x132a, 0x080c, 0x1f4a, 0x0804, 0x2dd2,
 	0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-	0x080c, 0x1f20, 0x080c, 0x9913, 0x080c, 0x132a, 0x080c, 0x1f4a,
+	0x080c, 0x1f20, 0x080c, 0x992e, 0x080c, 0x132a, 0x080c, 0x1f4a,
 	0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-	0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x9913, 0x080c, 0x20e6,
+	0x0146, 0x0156, 0x080c, 0x1f20, 0x080c, 0x992e, 0x080c, 0x20e6,
 	0x080c, 0x132a, 0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527,
-	0x080c, 0x9913, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
-	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x9913,
+	0x080c, 0x992e, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
+	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x992e,
 	0x080c, 0x20e6, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
 	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x1f20,
-	0x080c, 0x9913, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
+	0x080c, 0x992e, 0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6,
 	0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x1f20,
-	0x080c, 0x9913, 0x080c, 0x20e6, 0x0804, 0x2dd2, 0x0106, 0x0006,
+	0x080c, 0x992e, 0x080c, 0x20e6, 0x0804, 0x2dd2, 0x0106, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527,
-	0x080c, 0x9913, 0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006,
+	0x080c, 0x992e, 0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527,
-	0x080c, 0x9913, 0x080c, 0x20e6, 0x080c, 0x1f4a, 0x0804, 0x2dd2,
+	0x080c, 0x992e, 0x080c, 0x20e6, 0x080c, 0x1f4a, 0x0804, 0x2dd2,
 	0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-	0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x9913, 0x080c, 0x1f4a,
+	0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x992e, 0x080c, 0x1f4a,
 	0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-	0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x9913,
+	0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x992e,
 	0x080c, 0x20e6, 0x080c, 0x1f4a, 0x0804, 0x2dd2, 0x0106, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527,
-	0x080c, 0x9913, 0x080c, 0x132a, 0x0804, 0x2dd2, 0x0106, 0x0006,
+	0x080c, 0x992e, 0x080c, 0x132a, 0x0804, 0x2dd2, 0x0106, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527,
-	0x080c, 0x9913, 0x080c, 0x20e6, 0x080c, 0x132a, 0x0804, 0x2dd2,
+	0x080c, 0x992e, 0x080c, 0x20e6, 0x080c, 0x132a, 0x0804, 0x2dd2,
 	0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156,
-	0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x9913, 0x080c, 0x132a,
+	0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x992e, 0x080c, 0x132a,
 	0x0804, 0x2dd2, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
-	0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x9913,
+	0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x992e,
 	0x080c, 0x20e6, 0x080c, 0x132a, 0x0804, 0x2dd2, 0x0106, 0x0006,
 	0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527,
-	0x080c, 0x9913, 0x080c, 0x132a, 0x080c, 0x1f4a, 0x04d8, 0x0106,
+	0x080c, 0x992e, 0x080c, 0x132a, 0x080c, 0x1f4a, 0x04d8, 0x0106,
 	0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c,
-	0x2527, 0x080c, 0x9913, 0x080c, 0x20e6, 0x080c, 0x132a, 0x080c,
+	0x2527, 0x080c, 0x992e, 0x080c, 0x20e6, 0x080c, 0x132a, 0x080c,
 	0x1f4a, 0x0440, 0x0106, 0x0006, 0x0126, 0x01c6, 0x01d6, 0x0136,
 	0x0146, 0x0156, 0x080c, 0x2527, 0x080c, 0x1f20, 0x080c, 0x132a,
-	0x080c, 0x9913, 0x080c, 0x1f4a, 0x00a8, 0x0106, 0x0006, 0x0126,
+	0x080c, 0x992e, 0x080c, 0x1f4a, 0x00a8, 0x0106, 0x0006, 0x0126,
 	0x01c6, 0x01d6, 0x0136, 0x0146, 0x0156, 0x080c, 0x2527, 0x080c,
-	0x1f20, 0x080c, 0x9913, 0x080c, 0x20e6, 0x080c, 0x132a, 0x080c,
+	0x1f20, 0x080c, 0x992e, 0x080c, 0x20e6, 0x080c, 0x132a, 0x080c,
 	0x1f4a, 0x0000, 0x015e, 0x014e, 0x013e, 0x01de, 0x01ce, 0x012e,
 	0x000e, 0x010e, 0x000d, 0x00b6, 0x00c6, 0x0026, 0x0046, 0x9026,
-	0x080c, 0x661e, 0x1904, 0x2ede, 0x72d8, 0x2001, 0x194d, 0x2004,
+	0x080c, 0x6625, 0x1904, 0x2ee1, 0x72d8, 0x2001, 0x194d, 0x2004,
 	0x9005, 0x1110, 0xd29c, 0x0148, 0xd284, 0x1138, 0xd2bc, 0x1904,
-	0x2ede, 0x080c, 0x2ee3, 0x0804, 0x2ede, 0xd2cc, 0x1904, 0x2ede,
-	0x080c, 0x70ac, 0x1120, 0x70ab, 0xffff, 0x0804, 0x2ede, 0xd294,
-	0x0120, 0x70ab, 0xffff, 0x0804, 0x2ede, 0x080c, 0x317a, 0x0160,
-	0x080c, 0xbf46, 0x0128, 0x2001, 0x1817, 0x203c, 0x0804, 0x2e70,
-	0x70ab, 0xffff, 0x0804, 0x2ede, 0x2001, 0x1817, 0x203c, 0x7290,
-	0xd284, 0x0904, 0x2e70, 0xd28c, 0x1904, 0x2e70, 0x0036, 0x73a8,
+	0x2ee1, 0x080c, 0x2ee6, 0x0804, 0x2ee1, 0xd2cc, 0x1904, 0x2ee1,
+	0x080c, 0x70b7, 0x1120, 0x70ab, 0xffff, 0x0804, 0x2ee1, 0xd294,
+	0x0120, 0x70ab, 0xffff, 0x0804, 0x2ee1, 0x080c, 0x3181, 0x0160,
+	0x080c, 0xbf61, 0x0128, 0x2001, 0x1817, 0x203c, 0x0804, 0x2e73,
+	0x70ab, 0xffff, 0x0804, 0x2ee1, 0x2001, 0x1817, 0x203c, 0x7290,
+	0xd284, 0x0904, 0x2e73, 0xd28c, 0x1904, 0x2e73, 0x0036, 0x73a8,
 	0x938e, 0xffff, 0x1110, 0x2019, 0x0001, 0x8314, 0x92e0, 0x1d80,
 	0x2c04, 0x938c, 0x0001, 0x0120, 0x9084, 0xff00, 0x8007, 0x0010,
-	0x9084, 0x00ff, 0x970e, 0x0590, 0x908e, 0x0000, 0x0578, 0x908e,
-	0x00ff, 0x1150, 0x7230, 0xd284, 0x1570, 0x7290, 0xc28d, 0x7292,
-	0x70ab, 0xffff, 0x003e, 0x0460, 0x0026, 0x2011, 0x0010, 0x080c,
-	0x6684, 0x002e, 0x0118, 0x70ab, 0xffff, 0x00f8, 0x900e, 0x080c,
-	0x2424, 0x080c, 0x6209, 0x11a8, 0x080c, 0x6660, 0x1150, 0x7030,
-	0xd08c, 0x0118, 0xb800, 0xd0bc, 0x0120, 0x080c, 0x2efc, 0x0148,
-	0x0028, 0x080c, 0x3050, 0x080c, 0x2f28, 0x0118, 0x8318, 0x0804,
-	0x2e25, 0x73aa, 0x0010, 0x70ab, 0xffff, 0x003e, 0x0804, 0x2ede,
-	0x9780, 0x3184, 0x203d, 0x97bc, 0xff00, 0x873f, 0x2041, 0x007e,
-	0x70a8, 0x9096, 0xffff, 0x1118, 0x900e, 0x28a8, 0x0050, 0x9812,
-	0x0220, 0x2008, 0x9802, 0x20a8, 0x0020, 0x70ab, 0xffff, 0x0804,
-	0x2ede, 0x2700, 0x0156, 0x0016, 0x9106, 0x0904, 0x2ed3, 0x0026,
-	0x2011, 0x0010, 0x080c, 0x6684, 0x002e, 0x0120, 0x2009, 0xffff,
-	0x0804, 0x2edb, 0xc484, 0x080c, 0x6269, 0x0138, 0x080c, 0xbf46,
-	0x1590, 0x080c, 0x6209, 0x15b8, 0x0008, 0xc485, 0x080c, 0x6660,
-	0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800, 0xd0bc, 0x11e0, 0x7290,
-	0xd28c, 0x0180, 0x080c, 0x6660, 0x9082, 0x0006, 0x02e0, 0xd484,
-	0x1118, 0x080c, 0x622d, 0x0028, 0x080c, 0x30e8, 0x01a0, 0x080c,
-	0x3113, 0x0088, 0x080c, 0x3050, 0x080c, 0xbf46, 0x1160, 0x080c,
-	0x2f28, 0x0188, 0x0040, 0x080c, 0xbf46, 0x1118, 0x080c, 0x30e8,
-	0x0110, 0x0451, 0x0140, 0x001e, 0x8108, 0x015e, 0x1f04, 0x2e89,
-	0x70ab, 0xffff, 0x0018, 0x001e, 0x015e, 0x71aa, 0x004e, 0x002e,
-	0x00ce, 0x00be, 0x0005, 0x00c6, 0x0016, 0x70ab, 0x0001, 0x2009,
-	0x007e, 0x080c, 0x6209, 0x1168, 0xb813, 0x00ff, 0xb817, 0xfffe,
-	0x080c, 0x3050, 0x04a9, 0x0128, 0x70d8, 0xc0bd, 0x70da, 0x080c,
-	0xbc93, 0x001e, 0x00ce, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6,
-	0x2001, 0x1858, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c, 0x9c3d,
-	0x01d0, 0x2b00, 0x6012, 0x080c, 0xbcc0, 0x6023, 0x0001, 0x9006,
-	0x080c, 0x61a6, 0x2001, 0x0000, 0x080c, 0x61ba, 0x0126, 0x2091,
-	0x8000, 0x70a4, 0x8000, 0x70a6, 0x012e, 0x2009, 0x0004, 0x080c,
-	0x9c6a, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005,
-	0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001, 0x1858, 0x2004, 0x9084,
-	0x00ff, 0xb842, 0x080c, 0x9c3d, 0x0548, 0x2b00, 0x6012, 0xb800,
-	0xc0c4, 0xb802, 0xb8a0, 0x9086, 0x007e, 0x0140, 0xb804, 0x9084,
-	0x00ff, 0x9086, 0x0006, 0x1110, 0x080c, 0x3003, 0x080c, 0xbcc0,
-	0x6023, 0x0001, 0x9006, 0x080c, 0x61a6, 0x2001, 0x0002, 0x080c,
-	0x61ba, 0x0126, 0x2091, 0x8000, 0x70a4, 0x8000, 0x70a6, 0x012e,
-	0x2009, 0x0002, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x00ce, 0x00de,
-	0x007e, 0x001e, 0x0005, 0x00b6, 0x00c6, 0x0026, 0x2009, 0x0080,
-	0x080c, 0x6209, 0x1140, 0xb813, 0x00ff, 0xb817, 0xfffc, 0x0039,
-	0x0110, 0x70df, 0xffff, 0x002e, 0x00ce, 0x00be, 0x0005, 0x0016,
-	0x0076, 0x00d6, 0x00c6, 0x080c, 0x9b76, 0x01d0, 0x2b00, 0x6012,
-	0x080c, 0xbcc0, 0x6023, 0x0001, 0x9006, 0x080c, 0x61a6, 0x2001,
-	0x0002, 0x080c, 0x61ba, 0x0126, 0x2091, 0x8000, 0x70e0, 0x8000,
-	0x70e2, 0x012e, 0x2009, 0x0002, 0x080c, 0x9c6a, 0x9085, 0x0001,
-	0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00c6, 0x00d6, 0x0126,
-	0x2091, 0x8000, 0x2009, 0x007f, 0x080c, 0x6209, 0x11b8, 0xb813,
-	0x00ff, 0xb817, 0xfffd, 0xb8c7, 0x0004, 0x080c, 0x9b76, 0x0170,
-	0x2b00, 0x6012, 0x6316, 0x6023, 0x0001, 0x620a, 0x080c, 0xbcc0,
-	0x2009, 0x0022, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x012e, 0x00de,
-	0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066, 0x0036, 0x0026, 0x00b6,
-	0x21f0, 0x9036, 0x080c, 0x98ad, 0x1110, 0x2031, 0x0001, 0x0066,
-	0x080c, 0x861e, 0x080c, 0x859e, 0x080c, 0x9803, 0x080c, 0xab2b,
-	0x006e, 0x86ff, 0x0110, 0x080c, 0x98c9, 0x3e08, 0x2130, 0x81ff,
-	0x0120, 0x20a9, 0x007e, 0x900e, 0x0018, 0x20a9, 0x007f, 0x900e,
-	0x0016, 0x080c, 0x6269, 0x1140, 0x9686, 0x0002, 0x1118, 0xb800,
-	0xd0bc, 0x1110, 0x080c, 0x5cef, 0x001e, 0x8108, 0x1f04, 0x2fe8,
-	0x9686, 0x0001, 0x190c, 0x314e, 0x00be, 0x002e, 0x003e, 0x006e,
-	0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016,
-	0x00b6, 0x9016, 0x080c, 0x98ad, 0x1110, 0x2011, 0x0001, 0x0026,
-	0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029, 0x080c, 0x8613,
-	0x0076, 0x2039, 0x0000, 0x080c, 0x8502, 0x2c08, 0x080c, 0xcfa6,
-	0x007e, 0x001e, 0x002e, 0x82ff, 0x0110, 0x080c, 0x98c9, 0xba10,
-	0xbb14, 0x080c, 0x5cef, 0xba12, 0xbb16, 0x00be, 0x001e, 0x002e,
-	0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x00b6, 0x6010,
-	0x2058, 0xb8a0, 0x00be, 0x9086, 0x0080, 0x0150, 0x2071, 0x1800,
-	0x70a4, 0x9005, 0x0110, 0x8001, 0x70a6, 0x000e, 0x00ee, 0x0005,
-	0x2071, 0x1800, 0x70e0, 0x9005, 0x0dc0, 0x8001, 0x70e2, 0x0ca8,
-	0xb800, 0xc08c, 0xb802, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x00b6,
-	0x0036, 0x0026, 0x0016, 0x0156, 0x2178, 0x9016, 0x080c, 0x98ad,
+	0x9084, 0x00ff, 0x970e, 0x05a8, 0x908e, 0x0000, 0x0590, 0x908e,
+	0x00ff, 0x1150, 0x7230, 0xd284, 0x1588, 0x7290, 0xc28d, 0x7292,
+	0x70ab, 0xffff, 0x003e, 0x0478, 0x0026, 0x2011, 0x0010, 0x080c,
+	0x668b, 0x002e, 0x0118, 0x70ab, 0xffff, 0x0410, 0x900e, 0x080c,
+	0x2424, 0x080c, 0x6210, 0x11c0, 0x080c, 0x6667, 0x1168, 0x7030,
+	0xd08c, 0x0130, 0xb800, 0xd0bc, 0x0138, 0x080c, 0x655f, 0x0120,
+	0x080c, 0x2eff, 0x0148, 0x0028, 0x080c, 0x3057, 0x080c, 0x2f2b,
+	0x0118, 0x8318, 0x0804, 0x2e25, 0x73aa, 0x0010, 0x70ab, 0xffff,
+	0x003e, 0x0804, 0x2ee1, 0x9780, 0x318b, 0x203d, 0x97bc, 0xff00,
+	0x873f, 0x2041, 0x007e, 0x70a8, 0x9096, 0xffff, 0x1118, 0x900e,
+	0x28a8, 0x0050, 0x9812, 0x0220, 0x2008, 0x9802, 0x20a8, 0x0020,
+	0x70ab, 0xffff, 0x0804, 0x2ee1, 0x2700, 0x0156, 0x0016, 0x9106,
+	0x0904, 0x2ed6, 0x0026, 0x2011, 0x0010, 0x080c, 0x668b, 0x002e,
+	0x0120, 0x2009, 0xffff, 0x0804, 0x2ede, 0xc484, 0x080c, 0x6270,
+	0x0138, 0x080c, 0xbf61, 0x1590, 0x080c, 0x6210, 0x15b8, 0x0008,
+	0xc485, 0x080c, 0x6667, 0x1130, 0x7030, 0xd08c, 0x01f8, 0xb800,
+	0xd0bc, 0x11e0, 0x7290, 0xd28c, 0x0180, 0x080c, 0x6667, 0x9082,
+	0x0006, 0x02e0, 0xd484, 0x1118, 0x080c, 0x6234, 0x0028, 0x080c,
+	0x30ef, 0x01a0, 0x080c, 0x311a, 0x0088, 0x080c, 0x3057, 0x080c,
+	0xbf61, 0x1160, 0x080c, 0x2f2b, 0x0188, 0x0040, 0x080c, 0xbf61,
+	0x1118, 0x080c, 0x30ef, 0x0110, 0x0451, 0x0140, 0x001e, 0x8108,
+	0x015e, 0x1f04, 0x2e8c, 0x70ab, 0xffff, 0x0018, 0x001e, 0x015e,
+	0x71aa, 0x004e, 0x002e, 0x00ce, 0x00be, 0x0005, 0x00c6, 0x0016,
+	0x70ab, 0x0001, 0x2009, 0x007e, 0x080c, 0x6210, 0x1168, 0xb813,
+	0x00ff, 0xb817, 0xfffe, 0x080c, 0x3057, 0x04a9, 0x0128, 0x70d8,
+	0xc0bd, 0x70da, 0x080c, 0xbcae, 0x001e, 0x00ce, 0x0005, 0x0016,
+	0x0076, 0x00d6, 0x00c6, 0x2001, 0x1858, 0x2004, 0x9084, 0x00ff,
+	0xb842, 0x080c, 0x9c58, 0x01d0, 0x2b00, 0x6012, 0x080c, 0xbcdb,
+	0x6023, 0x0001, 0x9006, 0x080c, 0x61ad, 0x2001, 0x0000, 0x080c,
+	0x61c1, 0x0126, 0x2091, 0x8000, 0x70a4, 0x8000, 0x70a6, 0x012e,
+	0x2009, 0x0004, 0x080c, 0x9c85, 0x9085, 0x0001, 0x00ce, 0x00de,
+	0x007e, 0x001e, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x2001,
+	0x1858, 0x2004, 0x9084, 0x00ff, 0xb842, 0x080c, 0x9c58, 0x0548,
+	0x2b00, 0x6012, 0xb800, 0xc0c4, 0xb802, 0xb8a0, 0x9086, 0x007e,
+	0x0140, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x1110, 0x080c,
+	0x3006, 0x080c, 0xbcdb, 0x6023, 0x0001, 0x9006, 0x080c, 0x61ad,
+	0x2001, 0x0002, 0x080c, 0x61c1, 0x0126, 0x2091, 0x8000, 0x70a4,
+	0x8000, 0x70a6, 0x012e, 0x2009, 0x0002, 0x080c, 0x9c85, 0x9085,
+	0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005, 0x00b6, 0x00c6,
+	0x0026, 0x2009, 0x0080, 0x080c, 0x6210, 0x1140, 0xb813, 0x00ff,
+	0xb817, 0xfffc, 0x0039, 0x0110, 0x70df, 0xffff, 0x002e, 0x00ce,
+	0x00be, 0x0005, 0x0016, 0x0076, 0x00d6, 0x00c6, 0x080c, 0x9b91,
+	0x01d0, 0x2b00, 0x6012, 0x080c, 0xbcdb, 0x6023, 0x0001, 0x9006,
+	0x080c, 0x61ad, 0x2001, 0x0002, 0x080c, 0x61c1, 0x0126, 0x2091,
+	0x8000, 0x70e0, 0x8000, 0x70e2, 0x012e, 0x2009, 0x0002, 0x080c,
+	0x9c85, 0x9085, 0x0001, 0x00ce, 0x00de, 0x007e, 0x001e, 0x0005,
+	0x00c6, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2009, 0x007f, 0x080c,
+	0x6210, 0x11b8, 0xb813, 0x00ff, 0xb817, 0xfffd, 0xb8c7, 0x0004,
+	0x080c, 0x9b91, 0x0170, 0x2b00, 0x6012, 0x6316, 0x6023, 0x0001,
+	0x620a, 0x080c, 0xbcdb, 0x2009, 0x0022, 0x080c, 0x9c85, 0x9085,
+	0x0001, 0x012e, 0x00de, 0x00ce, 0x0005, 0x00e6, 0x00c6, 0x0066,
+	0x0036, 0x0026, 0x00b6, 0x21f0, 0x9036, 0x080c, 0x98c8, 0x1110,
+	0x2031, 0x0001, 0x0066, 0x080c, 0x8646, 0x080c, 0x85c6, 0x080c,
+	0x981e, 0x080c, 0xab46, 0x006e, 0x86ff, 0x0110, 0x080c, 0x98e4,
+	0x3e08, 0x2130, 0x81ff, 0x0120, 0x20a9, 0x007e, 0x900e, 0x0018,
+	0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6270, 0x1140, 0x9686,
+	0x0002, 0x1118, 0xb800, 0xd0bc, 0x1110, 0x080c, 0x5cf6, 0x001e,
+	0x8108, 0x1f04, 0x2feb, 0x9686, 0x0001, 0x190c, 0x3155, 0x00be,
+	0x002e, 0x003e, 0x006e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6,
+	0x0046, 0x0036, 0x0026, 0x0016, 0x00b6, 0x9016, 0x080c, 0x98c8,
+	0x1110, 0x2011, 0x0001, 0x0026, 0x6210, 0x2258, 0xbaa0, 0x0026,
+	0x2019, 0x0029, 0x080c, 0x863b, 0x0076, 0x2039, 0x0000, 0x080c,
+	0x852a, 0x2c08, 0x080c, 0xcfc8, 0x007e, 0x001e, 0x002e, 0x82ff,
+	0x0110, 0x080c, 0x98e4, 0xba10, 0xbb14, 0xbc84, 0x080c, 0x5cf6,
+	0xba12, 0xbb16, 0xbc86, 0x00be, 0x001e, 0x002e, 0x003e, 0x004e,
+	0x00ce, 0x00ee, 0x0005, 0x00e6, 0x0006, 0x00b6, 0x6010, 0x2058,
+	0xb8a0, 0x00be, 0x9086, 0x0080, 0x0150, 0x2071, 0x1800, 0x70a4,
+	0x9005, 0x0110, 0x8001, 0x70a6, 0x000e, 0x00ee, 0x0005, 0x2071,
+	0x1800, 0x70e0, 0x9005, 0x0dc0, 0x8001, 0x70e2, 0x0ca8, 0xb800,
+	0xc08c, 0xb802, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x00b6, 0x0046,
+	0x0036, 0x0026, 0x0016, 0x0156, 0x2178, 0x9016, 0x080c, 0x98c8,
 	0x1110, 0x2011, 0x0001, 0x0026, 0x81ff, 0x1118, 0x20a9, 0x0001,
-	0x0080, 0x080c, 0x5386, 0xd0c4, 0x0148, 0x0040, 0x9006, 0x0046,
-	0x2020, 0x2009, 0x002d, 0x080c, 0xd251, 0x004e, 0x20a9, 0x0800,
-	0x9016, 0x0026, 0x928e, 0x007e, 0x0904, 0x30c3, 0x928e, 0x007f,
-	0x0904, 0x30c3, 0x928e, 0x0080, 0x05f0, 0x9288, 0x1000, 0x210c,
-	0x81ff, 0x05c8, 0x8fff, 0x1150, 0x2001, 0x195f, 0x0006, 0x2003,
-	0x0001, 0x080c, 0x30d5, 0x000e, 0x2003, 0x0000, 0x00b6, 0x00c6,
-	0x2158, 0x2001, 0x0001, 0x080c, 0x662a, 0x00ce, 0x00be, 0x2019,
-	0x0029, 0x080c, 0x8613, 0x0076, 0x2039, 0x0000, 0x080c, 0x8502,
-	0x00b6, 0x00c6, 0x0026, 0x2158, 0xba04, 0x9294, 0x00ff, 0x9286,
-	0x0006, 0x1118, 0xb807, 0x0404, 0x0028, 0x2001, 0x0004, 0x8007,
-	0x9215, 0xba06, 0x002e, 0x00ce, 0x00be, 0x0016, 0x2c08, 0x080c,
-	0xcfa6, 0x001e, 0x007e, 0x002e, 0x8210, 0x1f04, 0x3079, 0x002e,
-	0x82ff, 0x0110, 0x080c, 0x98c9, 0x015e, 0x001e, 0x002e, 0x003e,
-	0x00be, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046, 0x0026, 0x0016,
-	0x080c, 0x5386, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006, 0x2220,
-	0x2009, 0x0029, 0x080c, 0xd251, 0x001e, 0x002e, 0x004e, 0x0005,
-	0x0016, 0x0026, 0x0036, 0x00c6, 0x7290, 0x82ff, 0x01e8, 0x080c,
-	0x6658, 0x11d0, 0x2100, 0x080c, 0x2457, 0x81ff, 0x01b8, 0x2019,
-	0x0001, 0x8314, 0x92e0, 0x1d80, 0x2c04, 0xd384, 0x0120, 0x9084,
-	0xff00, 0x8007, 0x0010, 0x9084, 0x00ff, 0x9116, 0x0138, 0x9096,
-	0x00ff, 0x0110, 0x8318, 0x0c68, 0x9085, 0x0001, 0x00ce, 0x003e,
-	0x002e, 0x001e, 0x0005, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x0066, 0x9036, 0x080c, 0x98ad, 0x1110, 0x2031, 0x0001, 0x0066,
-	0x0036, 0x2019, 0x0029, 0x00d9, 0x003e, 0x006e, 0x86ff, 0x0110,
-	0x080c, 0x98c9, 0x006e, 0x9180, 0x1000, 0x2004, 0x9065, 0x0158,
-	0x0016, 0x00c6, 0x2061, 0x1b02, 0x001e, 0x6112, 0x080c, 0x3003,
-	0x001e, 0x080c, 0x622d, 0x012e, 0x00ce, 0x001e, 0x0005, 0x0016,
-	0x0026, 0x2110, 0x080c, 0x94d9, 0x080c, 0xd507, 0x002e, 0x001e,
-	0x0005, 0x2001, 0x1836, 0x2004, 0xd0cc, 0x0005, 0x00c6, 0x00b6,
-	0x080c, 0x70ac, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782,
-	0x080c, 0x70ac, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x9180,
-	0x1000, 0x2004, 0x905d, 0x0130, 0x86ff, 0x0110, 0xb800, 0xd0bc,
-	0x090c, 0x622d, 0x8108, 0x1f04, 0x315f, 0x2061, 0x1800, 0x607b,
-	0x0000, 0x607c, 0x9084, 0x00ff, 0x607e, 0x60af, 0x0000, 0x00be,
-	0x00ce, 0x0005, 0x2001, 0x1875, 0x2004, 0xd0bc, 0x0005, 0x2011,
-	0x1854, 0x2214, 0xd2ec, 0x0005, 0x7eef, 0x7de8, 0x7ce4, 0x80e2,
-	0x7be1, 0x80e0, 0x80dc, 0x80da, 0x7ad9, 0x80d6, 0x80d5, 0x80d4,
-	0x80d3, 0x80d2, 0x80d1, 0x79ce, 0x78cd, 0x80cc, 0x80cb, 0x80ca,
-	0x80c9, 0x80c7, 0x80c6, 0x77c5, 0x76c3, 0x80bc, 0x80ba, 0x75b9,
-	0x80b6, 0x74b5, 0x73b4, 0x72b3, 0x80b2, 0x80b1, 0x80ae, 0x71ad,
-	0x80ac, 0x70ab, 0x6faa, 0x6ea9, 0x80a7, 0x6da6, 0x6ca5, 0x6ba3,
-	0x6a9f, 0x699e, 0x689d, 0x809b, 0x8098, 0x6797, 0x6690, 0x658f,
-	0x6488, 0x6384, 0x6282, 0x8081, 0x8080, 0x617c, 0x607a, 0x8079,
-	0x5f76, 0x8075, 0x8074, 0x8073, 0x8072, 0x8071, 0x806e, 0x5e6d,
-	0x806c, 0x5d6b, 0x5c6a, 0x5b69, 0x8067, 0x5a66, 0x5965, 0x5863,
-	0x575c, 0x565a, 0x5559, 0x8056, 0x8055, 0x5454, 0x5353, 0x5252,
-	0x5151, 0x504e, 0x4f4d, 0x804c, 0x804b, 0x4e4a, 0x4d49, 0x8047,
-	0x4c46, 0x8045, 0x8043, 0x803c, 0x803a, 0x8039, 0x8036, 0x4b35,
-	0x8034, 0x4a33, 0x4932, 0x4831, 0x802e, 0x472d, 0x462c, 0x452b,
-	0x442a, 0x4329, 0x4227, 0x8026, 0x8025, 0x4123, 0x401f, 0x3f1e,
-	0x3e1d, 0x3d1b, 0x3c18, 0x8017, 0x8010, 0x3b0f, 0x3a08, 0x8004,
-	0x3902, 0x8001, 0x8000, 0x8000, 0x3800, 0x3700, 0x3600, 0x8000,
-	0x3500, 0x8000, 0x8000, 0x8000, 0x3400, 0x8000, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x3300, 0x3200, 0x8000, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x3100, 0x3000, 0x8000, 0x8000, 0x2f00,
-	0x8000, 0x2e00, 0x2d00, 0x2c00, 0x8000, 0x8000, 0x8000, 0x2b00,
-	0x8000, 0x2a00, 0x2900, 0x2800, 0x8000, 0x2700, 0x2600, 0x2500,
-	0x2400, 0x2300, 0x2200, 0x8000, 0x8000, 0x2100, 0x2000, 0x1f00,
-	0x1e00, 0x1d00, 0x1c00, 0x8000, 0x8000, 0x1b00, 0x1a00, 0x8000,
-	0x1900, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x1800,
-	0x8000, 0x1700, 0x1600, 0x1500, 0x8000, 0x1400, 0x1300, 0x1200,
-	0x1100, 0x1000, 0x0f00, 0x8000, 0x8000, 0x0e00, 0x0d00, 0x0c00,
-	0x0b00, 0x0a00, 0x0900, 0x8000, 0x8000, 0x0800, 0x0700, 0x8000,
-	0x0600, 0x8000, 0x8000, 0x8000, 0x0500, 0x0400, 0x0300, 0x8000,
-	0x0200, 0x8000, 0x8000, 0x8000, 0x0100, 0x8000, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000, 0x8000,
+	0x0070, 0x080c, 0x538d, 0xd0c4, 0x0138, 0x0030, 0x9006, 0x2020,
+	0x2009, 0x002d, 0x080c, 0xd273, 0x20a9, 0x0800, 0x9016, 0x0026,
+	0x928e, 0x007e, 0x0904, 0x30c9, 0x928e, 0x007f, 0x0904, 0x30c9,
+	0x928e, 0x0080, 0x05f0, 0x9288, 0x1000, 0x210c, 0x81ff, 0x05c8,
+	0x8fff, 0x1150, 0x2001, 0x195f, 0x0006, 0x2003, 0x0001, 0x080c,
+	0x30dc, 0x000e, 0x2003, 0x0000, 0x00b6, 0x00c6, 0x2158, 0x2001,
+	0x0001, 0x080c, 0x6631, 0x00ce, 0x00be, 0x2019, 0x0029, 0x080c,
+	0x863b, 0x0076, 0x2039, 0x0000, 0x080c, 0x852a, 0x00b6, 0x00c6,
+	0x0026, 0x2158, 0xba04, 0x9294, 0x00ff, 0x9286, 0x0006, 0x1118,
+	0xb807, 0x0404, 0x0028, 0x2001, 0x0004, 0x8007, 0x9215, 0xba06,
+	0x002e, 0x00ce, 0x00be, 0x0016, 0x2c08, 0x080c, 0xcfc8, 0x001e,
+	0x007e, 0x002e, 0x8210, 0x1f04, 0x307f, 0x002e, 0x82ff, 0x0110,
+	0x080c, 0x98e4, 0x015e, 0x001e, 0x002e, 0x003e, 0x004e, 0x00be,
+	0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0046, 0x0026, 0x0016, 0x080c,
+	0x538d, 0xd0c4, 0x0140, 0xd0a4, 0x0130, 0x9006, 0x2220, 0x2009,
+	0x0029, 0x080c, 0xd273, 0x001e, 0x002e, 0x004e, 0x0005, 0x0016,
+	0x0026, 0x0036, 0x00c6, 0x7290, 0x82ff, 0x01e8, 0x080c, 0x665f,
+	0x11d0, 0x2100, 0x080c, 0x2457, 0x81ff, 0x01b8, 0x2019, 0x0001,
+	0x8314, 0x92e0, 0x1d80, 0x2c04, 0xd384, 0x0120, 0x9084, 0xff00,
+	0x8007, 0x0010, 0x9084, 0x00ff, 0x9116, 0x0138, 0x9096, 0x00ff,
+	0x0110, 0x8318, 0x0c68, 0x9085, 0x0001, 0x00ce, 0x003e, 0x002e,
+	0x001e, 0x0005, 0x0016, 0x00c6, 0x0126, 0x2091, 0x8000, 0x0066,
+	0x9036, 0x080c, 0x98c8, 0x1110, 0x2031, 0x0001, 0x0066, 0x0036,
+	0x2019, 0x0029, 0x00d9, 0x003e, 0x006e, 0x86ff, 0x0110, 0x080c,
+	0x98e4, 0x006e, 0x9180, 0x1000, 0x2004, 0x9065, 0x0158, 0x0016,
+	0x00c6, 0x2061, 0x1b02, 0x001e, 0x6112, 0x080c, 0x3006, 0x001e,
+	0x080c, 0x6234, 0x012e, 0x00ce, 0x001e, 0x0005, 0x0016, 0x0026,
+	0x2110, 0x080c, 0x94f4, 0x080c, 0xd529, 0x002e, 0x001e, 0x0005,
+	0x2001, 0x1836, 0x2004, 0xd0cc, 0x0005, 0x00c6, 0x00b6, 0x080c,
+	0x70b7, 0x1118, 0x20a9, 0x0800, 0x0010, 0x20a9, 0x0782, 0x080c,
+	0x70b7, 0x1110, 0x900e, 0x0010, 0x2009, 0x007e, 0x9180, 0x1000,
+	0x2004, 0x905d, 0x0130, 0x86ff, 0x0110, 0xb800, 0xd0bc, 0x090c,
+	0x6234, 0x8108, 0x1f04, 0x3166, 0x2061, 0x1800, 0x607b, 0x0000,
+	0x607c, 0x9084, 0x00ff, 0x607e, 0x60af, 0x0000, 0x00be, 0x00ce,
+	0x0005, 0x2001, 0x1875, 0x2004, 0xd0bc, 0x0005, 0x2011, 0x1854,
+	0x2214, 0xd2ec, 0x0005, 0x7eef, 0x7de8, 0x7ce4, 0x80e2, 0x7be1,
+	0x80e0, 0x80dc, 0x80da, 0x7ad9, 0x80d6, 0x80d5, 0x80d4, 0x80d3,
+	0x80d2, 0x80d1, 0x79ce, 0x78cd, 0x80cc, 0x80cb, 0x80ca, 0x80c9,
+	0x80c7, 0x80c6, 0x77c5, 0x76c3, 0x80bc, 0x80ba, 0x75b9, 0x80b6,
+	0x74b5, 0x73b4, 0x72b3, 0x80b2, 0x80b1, 0x80ae, 0x71ad, 0x80ac,
+	0x70ab, 0x6faa, 0x6ea9, 0x80a7, 0x6da6, 0x6ca5, 0x6ba3, 0x6a9f,
+	0x699e, 0x689d, 0x809b, 0x8098, 0x6797, 0x6690, 0x658f, 0x6488,
+	0x6384, 0x6282, 0x8081, 0x8080, 0x617c, 0x607a, 0x8079, 0x5f76,
+	0x8075, 0x8074, 0x8073, 0x8072, 0x8071, 0x806e, 0x5e6d, 0x806c,
+	0x5d6b, 0x5c6a, 0x5b69, 0x8067, 0x5a66, 0x5965, 0x5863, 0x575c,
+	0x565a, 0x5559, 0x8056, 0x8055, 0x5454, 0x5353, 0x5252, 0x5151,
+	0x504e, 0x4f4d, 0x804c, 0x804b, 0x4e4a, 0x4d49, 0x8047, 0x4c46,
+	0x8045, 0x8043, 0x803c, 0x803a, 0x8039, 0x8036, 0x4b35, 0x8034,
+	0x4a33, 0x4932, 0x4831, 0x802e, 0x472d, 0x462c, 0x452b, 0x442a,
+	0x4329, 0x4227, 0x8026, 0x8025, 0x4123, 0x401f, 0x3f1e, 0x3e1d,
+	0x3d1b, 0x3c18, 0x8017, 0x8010, 0x3b0f, 0x3a08, 0x8004, 0x3902,
+	0x8001, 0x8000, 0x8000, 0x3800, 0x3700, 0x3600, 0x8000, 0x3500,
+	0x8000, 0x8000, 0x8000, 0x3400, 0x8000, 0x8000, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x3300, 0x3200, 0x8000, 0x8000, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x3100, 0x3000, 0x8000, 0x8000, 0x2f00, 0x8000,
+	0x2e00, 0x2d00, 0x2c00, 0x8000, 0x8000, 0x8000, 0x2b00, 0x8000,
+	0x2a00, 0x2900, 0x2800, 0x8000, 0x2700, 0x2600, 0x2500, 0x2400,
+	0x2300, 0x2200, 0x8000, 0x8000, 0x2100, 0x2000, 0x1f00, 0x1e00,
+	0x1d00, 0x1c00, 0x8000, 0x8000, 0x1b00, 0x1a00, 0x8000, 0x1900,
+	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x1800, 0x8000,
+	0x1700, 0x1600, 0x1500, 0x8000, 0x1400, 0x1300, 0x1200, 0x1100,
+	0x1000, 0x0f00, 0x8000, 0x8000, 0x0e00, 0x0d00, 0x0c00, 0x0b00,
+	0x0a00, 0x0900, 0x8000, 0x8000, 0x0800, 0x0700, 0x8000, 0x0600,
+	0x8000, 0x8000, 0x8000, 0x0500, 0x0400, 0x0300, 0x8000, 0x0200,
+	0x8000, 0x8000, 0x8000, 0x0100, 0x8000, 0x8000, 0x8000, 0x8000,
+	0x8000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
 	0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
-	0x8000, 0x8000, 0x8000, 0x8000, 0x2071, 0x1894, 0x7003, 0x0002,
-	0x9006, 0x7016, 0x701a, 0x704a, 0x704e, 0x700e, 0x7042, 0x7046,
-	0x703b, 0x18b0, 0x703f, 0x18b0, 0x7007, 0x0001, 0x080c, 0x103b,
-	0x090c, 0x0d65, 0x2900, 0x706a, 0xa867, 0x0002, 0xa8ab, 0xdcb0,
-	0x080c, 0x103b, 0x090c, 0x0d65, 0x2900, 0x706e, 0xa867, 0x0002,
-	0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x1894, 0x7004, 0x0002, 0x32b3,
-	0x32b4, 0x32c7, 0x32db, 0x0005, 0x1004, 0x32c4, 0x0e04, 0x32c4,
-	0x2079, 0x0000, 0x0126, 0x2091, 0x8000, 0x700c, 0x9005, 0x1128,
-	0x700f, 0x0001, 0x012e, 0x0468, 0x0005, 0x012e, 0x0ce8, 0x2079,
-	0x0000, 0x2061, 0x18ae, 0x2c4c, 0xa86c, 0x908e, 0x0100, 0x0128,
-	0x9086, 0x0200, 0x0904, 0x33af, 0x0005, 0x7018, 0x2048, 0x2061,
-	0x1800, 0x701c, 0x0807, 0x7014, 0x2048, 0xa864, 0x9094, 0x00ff,
-	0x9296, 0x0029, 0x1120, 0xaa78, 0xd2fc, 0x0128, 0x0005, 0x9086,
-	0x0103, 0x0108, 0x0005, 0x2079, 0x0000, 0x2061, 0x1800, 0x701c,
-	0x0807, 0x2061, 0x1800, 0x7880, 0x908a, 0x0040, 0x1210, 0x61cc,
-	0x0042, 0x2100, 0x908a, 0x003f, 0x1a04, 0x33ac, 0x61cc, 0x0804,
-	0x3341, 0x3383, 0x33bb, 0x33c5, 0x33c9, 0x33d3, 0x33d9, 0x33dd,
-	0x33ed, 0x33f0, 0x33fa, 0x33ff, 0x3404, 0x340f, 0x341a, 0x3429,
-	0x3438, 0x3446, 0x345d, 0x3478, 0x33ac, 0x3521, 0x355f, 0x3604,
-	0x3615, 0x3638, 0x33ac, 0x33ac, 0x33ac, 0x3670, 0x3690, 0x3699,
-	0x36c5, 0x36cb, 0x33ac, 0x3711, 0x33ac, 0x33ac, 0x33ac, 0x33ac,
-	0x33ac, 0x371c, 0x3725, 0x372d, 0x372f, 0x33ac, 0x33ac, 0x33ac,
-	0x33ac, 0x33ac, 0x33ac, 0x375f, 0x33ac, 0x33ac, 0x33ac, 0x33ac,
-	0x33ac, 0x377c, 0x37d7, 0x33ac, 0x33ac, 0x33ac, 0x33ac, 0x33ac,
-	0x33ac, 0x0002, 0x3801, 0x3804, 0x3863, 0x387c, 0x38ac, 0x3b4e,
-	0x33ac, 0x4f57, 0x33ac, 0x33ac, 0x33ac, 0x33ac, 0x33ac, 0x33ac,
-	0x33ac, 0x33ac, 0x33fa, 0x33ff, 0x404d, 0x53aa, 0x4063, 0x4fe6,
-	0x5037, 0x513a, 0x33ac, 0x519c, 0x51d8, 0x5209, 0x5315, 0x5236,
-	0x5295, 0x33ac, 0x4067, 0x41f7, 0x420d, 0x4232, 0x4297, 0x430b,
-	0x432b, 0x43a2, 0x43fe, 0x445a, 0x445d, 0x4482, 0x44f5, 0x455f,
-	0x4567, 0x4699, 0x47fb, 0x482f, 0x4a79, 0x33ac, 0x4a97, 0x4b5a,
-	0x4c30, 0x33ac, 0x33ac, 0x33ac, 0x33ac, 0x4c96, 0x4cb1, 0x4567,
-	0x4ef7, 0x714c, 0x0000, 0x2021, 0x4000, 0x080c, 0x48ad, 0x0126,
-	0x2091, 0x8000, 0x0e04, 0x338d, 0x0010, 0x012e, 0x0cc0, 0x7c36,
-	0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833, 0x0010,
-	0x7c82, 0x7986, 0x7a8a, 0x7b8e, 0x2091, 0x4080, 0x2001, 0x0089,
-	0x2004, 0xd084, 0x190c, 0x11be, 0x7007, 0x0001, 0x2091, 0x5000,
-	0x700f, 0x0000, 0x012e, 0x0005, 0x2021, 0x4001, 0x08b0, 0x2021,
-	0x4002, 0x0898, 0x2021, 0x4003, 0x0880, 0x2021, 0x4005, 0x0868,
-	0x2021, 0x4006, 0x0850, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88,
-	0x7a8c, 0x7884, 0x7990, 0x0804, 0x48ba, 0x7883, 0x0004, 0x7884,
-	0x0807, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884,
-	0x7990, 0x0804, 0x48bd, 0x7984, 0x7888, 0x2114, 0x200a, 0x0804,
-	0x3383, 0x7984, 0x2114, 0x0804, 0x3383, 0x20e1, 0x0000, 0x2099,
-	0x0021, 0x20e9, 0x0000, 0x20a1, 0x0021, 0x20a9, 0x001f, 0x4003,
-	0x7984, 0x7a88, 0x7b8c, 0x0804, 0x3383, 0x7884, 0x2060, 0x04d8,
-	0x2009, 0x0003, 0x2011, 0x0002, 0x2019, 0x001a, 0x789b, 0x0317,
-	0x0804, 0x3383, 0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0800, 0x2039,
-	0x0001, 0x7d98, 0x7c9c, 0x0848, 0x79a0, 0x9182, 0x0040, 0x0210,
-	0x0804, 0x33b8, 0x2138, 0x7d98, 0x7c9c, 0x0804, 0x33bf, 0x79a0,
-	0x9182, 0x0040, 0x0210, 0x0804, 0x33b8, 0x2138, 0x7d98, 0x7c9c,
-	0x0804, 0x33cd, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x33b8,
-	0x21e8, 0x7984, 0x7888, 0x20a9, 0x0001, 0x21a0, 0x4004, 0x0804,
-	0x3383, 0x2061, 0x0800, 0xe10c, 0x9006, 0x2c15, 0x9200, 0x8c60,
-	0x8109, 0x1dd8, 0x2010, 0x9005, 0x0904, 0x3383, 0x0804, 0x33b2,
-	0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x33b8, 0x21e0, 0x20a9,
-	0x0001, 0x7984, 0x2198, 0x4012, 0x0804, 0x3383, 0x2069, 0x1853,
-	0x7884, 0x7990, 0x911a, 0x1a04, 0x33b8, 0x8019, 0x0904, 0x33b8,
-	0x684a, 0x6942, 0x788c, 0x6852, 0x7888, 0x6856, 0x9006, 0x685a,
-	0x685e, 0x080c, 0x73dd, 0x0804, 0x3383, 0x2069, 0x1853, 0x7884,
-	0x7994, 0x911a, 0x1a04, 0x33b8, 0x8019, 0x0904, 0x33b8, 0x684e,
-	0x6946, 0x788c, 0x6862, 0x7888, 0x6866, 0x9006, 0x686a, 0x686e,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x6762, 0x012e, 0x0804, 0x3383,
-	0x902e, 0x2520, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x33b5,
-	0x7984, 0x7b88, 0x7a8c, 0x20a9, 0x0005, 0x20e9, 0x0001, 0x20a1,
-	0x189c, 0x4101, 0x080c, 0x4871, 0x1120, 0x2009, 0x0002, 0x0804,
-	0x33b5, 0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c,
-	0x48ba, 0x701f, 0x349c, 0x0005, 0xa864, 0x2008, 0x9084, 0x00ff,
-	0x9096, 0x0011, 0x0168, 0x9096, 0x0019, 0x0150, 0x9096, 0x0015,
-	0x0138, 0x9096, 0x0048, 0x0120, 0x9096, 0x0029, 0x1904, 0x33b5,
-	0x810f, 0x918c, 0x00ff, 0x0904, 0x33b5, 0x7112, 0x7010, 0x8001,
-	0x0560, 0x7012, 0x080c, 0x4871, 0x1120, 0x2009, 0x0002, 0x0804,
-	0x33b5, 0x2009, 0x0020, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494,
-	0xa598, 0x9290, 0x0040, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9,
-	0x0000, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x48ba, 0x701f,
-	0x34da, 0x0005, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0002, 0x0120,
-	0x9096, 0x000a, 0x1904, 0x33b5, 0x0888, 0x7014, 0x2048, 0xa868,
-	0xc0fd, 0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0029, 0x1160,
-	0xc2fd, 0xaa7a, 0x080c, 0x5ddd, 0x0150, 0x0126, 0x2091, 0x8000,
-	0xa87a, 0xa982, 0x012e, 0x0050, 0x080c, 0x60f4, 0x1128, 0x7007,
-	0x0003, 0x701f, 0x3506, 0x0005, 0x080c, 0x6bac, 0x0126, 0x2091,
-	0x8000, 0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x189c, 0x400a,
-	0x2100, 0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000,
-	0xa85c, 0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60, 0x0804,
-	0x48bd, 0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010, 0x7883,
-	0x4000, 0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020, 0x2009,
-	0x017f, 0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100, 0x6200,
-	0x2061, 0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009, 0x04fd,
-	0x2104, 0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001, 0x0089,
-	0x2004, 0xd084, 0x0180, 0x2001, 0x19f3, 0x2004, 0x9005, 0x0128,
-	0x2001, 0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003,
-	0x0002, 0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427, 0x81ff,
-	0x1904, 0x33b5, 0x7984, 0x080c, 0x6269, 0x1904, 0x33b8, 0x7e98,
-	0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04, 0x33b8, 0x7c88, 0x7d8c,
-	0x080c, 0x649b, 0x080c, 0x642c, 0x1518, 0x2061, 0x1ddc, 0x0126,
-	0x2091, 0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d,
-	0x0130, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0150, 0x012e,
-	0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004, 0x9c02, 0x1a04, 0x33b5,
-	0x0c30, 0x080c, 0xb437, 0x012e, 0x0904, 0x33b5, 0x0804, 0x3383,
-	0x900e, 0x2001, 0x0005, 0x080c, 0x6bac, 0x0126, 0x2091, 0x8000,
-	0x080c, 0xbb30, 0x080c, 0x698f, 0x012e, 0x0804, 0x3383, 0x00a6,
-	0x2950, 0xb198, 0x080c, 0x6269, 0x1904, 0x35f1, 0xb6a4, 0x9684,
-	0x3fff, 0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0, 0x080c, 0x649b,
-	0x080c, 0x6446, 0x1520, 0x2061, 0x1ddc, 0x0126, 0x2091, 0x8000,
-	0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130, 0xa86c,
-	0x9406, 0x1118, 0xa870, 0x9506, 0x0158, 0x012e, 0x9ce0, 0x001c,
-	0x2001, 0x1819, 0x2004, 0x9c02, 0x2009, 0x000d, 0x12b0, 0x0c28,
-	0x080c, 0xb437, 0x012e, 0x2009, 0x0003, 0x0178, 0x00e0, 0x900e,
-	0x2001, 0x0005, 0x080c, 0x6bac, 0x0126, 0x2091, 0x8000, 0x080c,
-	0xbb30, 0x080c, 0x6983, 0x012e, 0x0070, 0xb097, 0x4005, 0xb19a,
-	0x0010, 0xb097, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030,
-	0x2a48, 0x00ae, 0x0005, 0xb097, 0x4000, 0x9006, 0x918d, 0x0001,
-	0x2008, 0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904, 0x33b5, 0x080c,
-	0x4888, 0x0904, 0x33b8, 0x080c, 0x6330, 0x0904, 0x33b5, 0x080c,
-	0x64a1, 0x0904, 0x33b5, 0x0804, 0x4322, 0x81ff, 0x1904, 0x33b5,
-	0x080c, 0x48a4, 0x0904, 0x33b8, 0x080c, 0x652f, 0x0904, 0x33b5,
-	0x2019, 0x0005, 0x79a8, 0x080c, 0x64bc, 0x0904, 0x33b5, 0x7888,
-	0x908a, 0x1000, 0x1a04, 0x33b8, 0x8003, 0x800b, 0x810b, 0x9108,
-	0x080c, 0x813f, 0x7984, 0xd184, 0x1904, 0x3383, 0x0804, 0x4322,
-	0x0126, 0x2091, 0x8000, 0x81ff, 0x0118, 0x2009, 0x0001, 0x0450,
-	0x2029, 0x07ff, 0x6458, 0x2400, 0x9506, 0x01f8, 0x2508, 0x080c,
-	0x6269, 0x11d8, 0x080c, 0x652f, 0x1128, 0x2009, 0x0002, 0x62bc,
-	0x2518, 0x00c0, 0x2019, 0x0004, 0x900e, 0x080c, 0x64bc, 0x1118,
-	0x2009, 0x0006, 0x0078, 0x7884, 0x908a, 0x1000, 0x1270, 0x8003,
-	0x800b, 0x810b, 0x9108, 0x080c, 0x813f, 0x8529, 0x1ae0, 0x012e,
-	0x0804, 0x3383, 0x012e, 0x0804, 0x33b5, 0x012e, 0x0804, 0x33b8,
-	0x080c, 0x4888, 0x0904, 0x33b8, 0x080c, 0x6330, 0x0904, 0x33b5,
-	0x080c, 0x98ad, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c,
-	0x8613, 0x0076, 0x903e, 0x080c, 0x8502, 0x900e, 0x080c, 0xcfa6,
-	0x007e, 0x00ce, 0x080c, 0x98c9, 0x080c, 0x649b, 0x0804, 0x3383,
-	0x080c, 0x4888, 0x0904, 0x33b8, 0x080c, 0x649b, 0x2208, 0x0804,
-	0x3383, 0x0156, 0x00d6, 0x00e6, 0x00c6, 0x2069, 0x1906, 0x6810,
-	0x6914, 0x910a, 0x1208, 0x900e, 0x6816, 0x9016, 0x901e, 0x2071,
-	0x19b8, 0x7028, 0x9065, 0x0118, 0x8210, 0x600c, 0x0cd8, 0x2300,
-	0x9218, 0x00ce, 0x00ee, 0x00de, 0x015e, 0x0804, 0x3383, 0x00f6,
-	0x0016, 0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff, 0x0110,
-	0x2178, 0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1906, 0x6910,
-	0x62b8, 0x0804, 0x3383, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-	0x33b5, 0x0126, 0x2091, 0x8000, 0x080c, 0x539a, 0x0128, 0x2009,
-	0x0007, 0x012e, 0x0804, 0x33b5, 0x012e, 0x6158, 0x9190, 0x3184,
-	0x2215, 0x9294, 0x00ff, 0x6378, 0x83ff, 0x0108, 0x627c, 0x67d8,
-	0x97c4, 0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001, 0x00e8,
-	0x97c4, 0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003, 0x00a8,
-	0x97c4, 0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002, 0x0068,
-	0x080c, 0x70ac, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c, 0x0120,
-	0x2009, 0x0005, 0x0804, 0x33b5, 0x9036, 0x7e9a, 0x7f9e, 0x0804,
-	0x3383, 0x6148, 0x624c, 0x2019, 0x1957, 0x231c, 0x2001, 0x1958,
-	0x2004, 0x789a, 0x0804, 0x3383, 0x0126, 0x2091, 0x8000, 0x6138,
-	0x623c, 0x6340, 0x012e, 0x0804, 0x3383, 0x080c, 0x48a4, 0x0904,
-	0x33b8, 0xba44, 0xbb38, 0x0804, 0x3383, 0x080c, 0x0d65, 0x080c,
-	0x48a4, 0x2110, 0x0904, 0x33b8, 0xb804, 0x908c, 0x00ff, 0x918e,
-	0x0006, 0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009, 0x0009,
-	0x1904, 0x33b5, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005, 0x00c6,
-	0x9066, 0x080c, 0x98ad, 0x080c, 0x94d9, 0x080c, 0x8613, 0x0076,
-	0x903e, 0x080c, 0x8502, 0x900e, 0x080c, 0xcfa6, 0x007e, 0x00ce,
-	0x080c, 0x98c9, 0xb807, 0x0407, 0x012e, 0x0804, 0x3383, 0x6148,
-	0x624c, 0x7884, 0x604a, 0x7b88, 0x634e, 0x2069, 0x1853, 0x831f,
-	0x9305, 0x6816, 0x788c, 0x2069, 0x1957, 0x2d1c, 0x206a, 0x7e98,
-	0x9682, 0x0014, 0x1210, 0x2031, 0x07d0, 0x2069, 0x1958, 0x2d04,
-	0x266a, 0x789a, 0x0804, 0x3383, 0x0126, 0x2091, 0x8000, 0x6138,
-	0x7884, 0x603a, 0x910e, 0xd1b4, 0x190c, 0x0eb4, 0xd0c4, 0x01a8,
-	0x00d6, 0x78a8, 0x2009, 0x196e, 0x200a, 0x78ac, 0x2011, 0x196f,
-	0x2012, 0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118, 0x2214,
-	0x6a5a, 0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0x603e, 0x2011,
-	0x0116, 0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0040, 0x0010,
-	0x918c, 0xff7f, 0x2112, 0x6140, 0x788c, 0x6042, 0x910e, 0xd1e4,
-	0x190c, 0x0ecf, 0x6040, 0xd0cc, 0x0120, 0x78b0, 0x2011, 0x0114,
-	0x2012, 0x012e, 0x0804, 0x3383, 0x00f6, 0x2079, 0x1800, 0x7a38,
-	0xa898, 0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084, 0xfebf, 0x8002,
-	0x9214, 0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a, 0xa897, 0x4000,
-	0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x00fe, 0x0005, 0x7898,
-	0x9005, 0x01a8, 0x7888, 0x9025, 0x0904, 0x33b8, 0x788c, 0x902d,
-	0x0904, 0x33b8, 0x900e, 0x080c, 0x6269, 0x1120, 0xba44, 0xbb38,
-	0xbc46, 0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108, 0x0ca0, 0x080c,
-	0x48a4, 0x0904, 0x33b8, 0x7888, 0x900d, 0x0904, 0x33b8, 0x788c,
-	0x9005, 0x0904, 0x33b8, 0xba44, 0xb946, 0xbb38, 0xb83a, 0x0804,
-	0x3383, 0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05, 0x080c, 0x539a,
-	0x1904, 0x33b5, 0x00c6, 0x2061, 0x0100, 0x7984, 0x9186, 0x00ff,
-	0x1130, 0x2001, 0x1817, 0x2004, 0x9085, 0xff00, 0x0088, 0x9182,
-	0x007f, 0x16e0, 0x9188, 0x3184, 0x210d, 0x918c, 0x00ff, 0x2001,
-	0x1817, 0x2004, 0x0026, 0x9116, 0x002e, 0x0580, 0x810f, 0x9105,
-	0x0126, 0x2091, 0x8000, 0x0006, 0x080c, 0x9b76, 0x000e, 0x0510,
-	0x602e, 0x620a, 0x7984, 0x00b6, 0x080c, 0x620f, 0x2b08, 0x00be,
-	0x1500, 0x6112, 0x6023, 0x0001, 0x080c, 0x4871, 0x01d0, 0x9006,
-	0xa866, 0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x701f,
-	0x385c, 0x2900, 0x6016, 0x2009, 0x0032, 0x080c, 0x9c6a, 0x012e,
-	0x00ce, 0x0005, 0x012e, 0x00ce, 0x0804, 0x33b5, 0x00ce, 0x0804,
-	0x33b8, 0x080c, 0x9bcc, 0x0cb0, 0xa830, 0x9086, 0x0100, 0x0904,
-	0x33b5, 0x0804, 0x3383, 0x2061, 0x1a3f, 0x0126, 0x2091, 0x8000,
-	0x6000, 0xd084, 0x0170, 0x6104, 0x6208, 0x2061, 0x1800, 0x6350,
-	0x6070, 0x789a, 0x60bc, 0x789e, 0x60b8, 0x78aa, 0x012e, 0x0804,
-	0x3383, 0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904, 0x33b5, 0x080c,
-	0x70ac, 0x0904, 0x33b5, 0x0126, 0x2091, 0x8000, 0x6250, 0x6070,
-	0x9202, 0x0248, 0x9085, 0x0001, 0x080c, 0x248d, 0x080c, 0x55b4,
-	0x012e, 0x0804, 0x3383, 0x012e, 0x0804, 0x33b8, 0x0006, 0x0016,
-	0x00c6, 0x00e6, 0x2001, 0x197a, 0x2070, 0x2061, 0x1853, 0x6008,
-	0x2072, 0x900e, 0x2011, 0x1400, 0x080c, 0x83f1, 0x7206, 0x00ee,
-	0x00ce, 0x001e, 0x000e, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff,
-	0x0128, 0x012e, 0x2021, 0x400b, 0x0804, 0x3385, 0x7884, 0xd0fc,
-	0x0148, 0x2001, 0x002a, 0x2004, 0x9082, 0x00e1, 0x0288, 0x012e,
-	0x0804, 0x33b8, 0x2001, 0x002a, 0x2004, 0x2069, 0x1853, 0x6908,
-	0x9102, 0x1230, 0x012e, 0x0804, 0x33b8, 0x012e, 0x0804, 0x33b5,
-	0x080c, 0x9b4b, 0x0dd0, 0x7884, 0xd0fc, 0x0904, 0x3927, 0x00c6,
-	0x080c, 0x4871, 0x00ce, 0x0d88, 0xa867, 0x0000, 0x7884, 0xa80a,
-	0x7898, 0xa80e, 0x789c, 0xa812, 0x2001, 0x002e, 0x2004, 0xa81a,
-	0x2001, 0x002f, 0x2004, 0xa81e, 0x2001, 0x0030, 0x2004, 0xa822,
-	0x2001, 0x0031, 0x2004, 0xa826, 0x2001, 0x0034, 0x2004, 0xa82a,
-	0x2001, 0x0035, 0x2004, 0xa82e, 0x2001, 0x002a, 0x2004, 0x9080,
-	0x0003, 0x9084, 0x00fc, 0x8004, 0xa816, 0x080c, 0x3ab1, 0x0928,
-	0x7014, 0x2048, 0xad2c, 0xac28, 0xab1c, 0xaa18, 0xa930, 0xa808,
-	0xd0b4, 0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006,
-	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x080c,
-	0x48ba, 0x701f, 0x39ee, 0x7023, 0x0001, 0x012e, 0x0005, 0x080c,
-	0x98ad, 0x0046, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6,
-	0x00e6, 0x00f6, 0x080c, 0x3896, 0x2001, 0x1970, 0x2003, 0x0000,
-	0x2021, 0x000a, 0x2061, 0x0100, 0x6104, 0x0016, 0x60bb, 0x0000,
-	0x60bf, 0x32e1, 0x60bf, 0x0012, 0x080c, 0x3b20, 0x080c, 0x3adf,
-	0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x19b8, 0x2079, 0x0090,
-	0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0140, 0x2001, 0x0035,
-	0x2004, 0x780e, 0x2001, 0x0034, 0x2004, 0x780a, 0x00de, 0x2011,
-	0x0001, 0x080c, 0x3e91, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x3dbe,
-	0x080c, 0x3ceb, 0x05b8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140,
-	0x1db8, 0x080c, 0x3f05, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe,
-	0x908c, 0x0070, 0x1560, 0x2071, 0x0200, 0x7037, 0x0000, 0x7050,
-	0x9084, 0xff00, 0x9086, 0x3200, 0x1510, 0x7037, 0x0001, 0x7050,
-	0x9084, 0xff00, 0x9086, 0xe100, 0x11d0, 0x7037, 0x0000, 0x7054,
-	0x7037, 0x0000, 0x715c, 0x9106, 0x1190, 0x2001, 0x181f, 0x2004,
-	0x9106, 0x1168, 0x00c6, 0x2061, 0x0100, 0x6024, 0x9084, 0x1e00,
-	0x00ce, 0x0138, 0x080c, 0x3cf5, 0x080c, 0x3ada, 0x0058, 0x080c,
-	0x3ada, 0x080c, 0x3e29, 0x080c, 0x3db4, 0x2001, 0x020b, 0x2004,
-	0xd0e4, 0x0dd8, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100,
-	0x6027, 0x0002, 0x001e, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020,
-	0x60bb, 0x0000, 0x60bf, 0x0108, 0x60bf, 0x0012, 0x2001, 0x0004,
-	0x200c, 0x918c, 0xfffd, 0x2102, 0x080c, 0x12d6, 0x2009, 0x0028,
-	0x080c, 0x2052, 0x2001, 0x0227, 0x200c, 0x2102, 0x080c, 0x98c9,
-	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e,
-	0x004e, 0x2001, 0x1970, 0x2004, 0x9005, 0x1118, 0x012e, 0x0804,
-	0x3383, 0x012e, 0x2021, 0x400c, 0x0804, 0x3385, 0x0016, 0x0026,
-	0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156,
-	0x7014, 0x2048, 0x7020, 0x20a8, 0x8000, 0x7022, 0xa804, 0x9005,
-	0x0904, 0x3a4a, 0x2048, 0x1f04, 0x39fe, 0x7068, 0x2040, 0xa28c,
-	0xa390, 0xa494, 0xa598, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029,
-	0x0000, 0x2021, 0x0000, 0x0096, 0x7014, 0x2048, 0xa864, 0x009e,
-	0x9086, 0x0103, 0x0170, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
-	0x9084, 0xffc0, 0x9080, 0x001b, 0x080c, 0x48ba, 0x701f, 0x39ee,
-	0x00b0, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-	0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006,
-	0x080c, 0x0f9f, 0x000e, 0x080c, 0x48bd, 0x701f, 0x39ee, 0x015e,
-	0x00de, 0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e,
-	0x001e, 0x0005, 0x7014, 0x2048, 0xa864, 0x9086, 0x0103, 0x1118,
-	0x701f, 0x3aaf, 0x0450, 0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a,
-	0x2009, 0x007f, 0x080c, 0x6209, 0x0110, 0x9006, 0x0030, 0xb813,
-	0x00ff, 0xb817, 0xfffd, 0x080c, 0xbd0f, 0x015e, 0x00de, 0x009e,
-	0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0904,
-	0x33b5, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086,
-	0x0096, 0x00d6, 0x0156, 0x701f, 0x3a81, 0x7007, 0x0003, 0x0804,
-	0x3a3f, 0xa830, 0x9086, 0x0100, 0x2021, 0x400c, 0x0904, 0x3385,
-	0x0076, 0xad10, 0xac0c, 0xab24, 0xaa20, 0xa930, 0xa808, 0xd0b4,
+	0x8000, 0x8000, 0x8000, 0x2071, 0x1894, 0x7003, 0x0002, 0x9006,
+	0x7016, 0x701a, 0x704a, 0x704e, 0x700e, 0x7042, 0x7046, 0x703b,
+	0x18b0, 0x703f, 0x18b0, 0x7007, 0x0001, 0x080c, 0x103b, 0x090c,
+	0x0d65, 0x2900, 0x706a, 0xa867, 0x0002, 0xa8ab, 0xdcb0, 0x080c,
+	0x103b, 0x090c, 0x0d65, 0x2900, 0x706e, 0xa867, 0x0002, 0xa8ab,
+	0xdcb0, 0x0005, 0x2071, 0x1894, 0x7004, 0x0002, 0x32ba, 0x32bb,
+	0x32ce, 0x32e2, 0x0005, 0x1004, 0x32cb, 0x0e04, 0x32cb, 0x2079,
+	0x0000, 0x0126, 0x2091, 0x8000, 0x700c, 0x9005, 0x1128, 0x700f,
+	0x0001, 0x012e, 0x0468, 0x0005, 0x012e, 0x0ce8, 0x2079, 0x0000,
+	0x2061, 0x18ae, 0x2c4c, 0xa86c, 0x908e, 0x0100, 0x0128, 0x9086,
+	0x0200, 0x0904, 0x33b6, 0x0005, 0x7018, 0x2048, 0x2061, 0x1800,
+	0x701c, 0x0807, 0x7014, 0x2048, 0xa864, 0x9094, 0x00ff, 0x9296,
+	0x0029, 0x1120, 0xaa78, 0xd2fc, 0x0128, 0x0005, 0x9086, 0x0103,
+	0x0108, 0x0005, 0x2079, 0x0000, 0x2061, 0x1800, 0x701c, 0x0807,
+	0x2061, 0x1800, 0x7880, 0x908a, 0x0040, 0x1210, 0x61cc, 0x0042,
+	0x2100, 0x908a, 0x003f, 0x1a04, 0x33b3, 0x61cc, 0x0804, 0x3348,
+	0x338a, 0x33c2, 0x33cc, 0x33d0, 0x33da, 0x33e0, 0x33e4, 0x33f4,
+	0x33f7, 0x3401, 0x3406, 0x340b, 0x3416, 0x3421, 0x3430, 0x343f,
+	0x344d, 0x3464, 0x347f, 0x33b3, 0x3528, 0x3566, 0x360b, 0x361c,
+	0x363f, 0x33b3, 0x33b3, 0x33b3, 0x3677, 0x3697, 0x36a0, 0x36cc,
+	0x36d2, 0x33b3, 0x3718, 0x33b3, 0x33b3, 0x33b3, 0x33b3, 0x33b3,
+	0x3723, 0x372c, 0x3734, 0x3736, 0x33b3, 0x33b3, 0x33b3, 0x33b3,
+	0x33b3, 0x33b3, 0x3766, 0x33b3, 0x33b3, 0x33b3, 0x33b3, 0x33b3,
+	0x3783, 0x37de, 0x33b3, 0x33b3, 0x33b3, 0x33b3, 0x33b3, 0x33b3,
+	0x0002, 0x3808, 0x380b, 0x386a, 0x3883, 0x38b3, 0x3b55, 0x33b3,
+	0x4f5e, 0x33b3, 0x33b3, 0x33b3, 0x33b3, 0x33b3, 0x33b3, 0x33b3,
+	0x33b3, 0x3401, 0x3406, 0x4054, 0x53b1, 0x406a, 0x4fed, 0x503e,
+	0x5141, 0x33b3, 0x51a3, 0x51df, 0x5210, 0x531c, 0x523d, 0x529c,
+	0x33b3, 0x406e, 0x41fe, 0x4214, 0x4239, 0x429e, 0x4312, 0x4332,
+	0x43a9, 0x4405, 0x4461, 0x4464, 0x4489, 0x44fc, 0x4566, 0x456e,
+	0x46a0, 0x4802, 0x4836, 0x4a80, 0x33b3, 0x4a9e, 0x4b61, 0x4c37,
+	0x33b3, 0x33b3, 0x33b3, 0x33b3, 0x4c9d, 0x4cb8, 0x456e, 0x4efe,
+	0x714c, 0x0000, 0x2021, 0x4000, 0x080c, 0x48b4, 0x0126, 0x2091,
+	0x8000, 0x0e04, 0x3394, 0x0010, 0x012e, 0x0cc0, 0x7c36, 0x9486,
+	0x4000, 0x0118, 0x7833, 0x0011, 0x0010, 0x7833, 0x0010, 0x7c82,
+	0x7986, 0x7a8a, 0x7b8e, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
+	0xd084, 0x190c, 0x11be, 0x7007, 0x0001, 0x2091, 0x5000, 0x700f,
+	0x0000, 0x012e, 0x0005, 0x2021, 0x4001, 0x08b0, 0x2021, 0x4002,
+	0x0898, 0x2021, 0x4003, 0x0880, 0x2021, 0x4005, 0x0868, 0x2021,
+	0x4006, 0x0850, 0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c,
+	0x7884, 0x7990, 0x0804, 0x48c1, 0x7883, 0x0004, 0x7884, 0x0807,
+	0x2039, 0x0001, 0x902e, 0x2520, 0x7b88, 0x7a8c, 0x7884, 0x7990,
+	0x0804, 0x48c4, 0x7984, 0x7888, 0x2114, 0x200a, 0x0804, 0x338a,
+	0x7984, 0x2114, 0x0804, 0x338a, 0x20e1, 0x0000, 0x2099, 0x0021,
+	0x20e9, 0x0000, 0x20a1, 0x0021, 0x20a9, 0x001f, 0x4003, 0x7984,
+	0x7a88, 0x7b8c, 0x0804, 0x338a, 0x7884, 0x2060, 0x04d8, 0x2009,
+	0x0003, 0x2011, 0x0002, 0x2019, 0x001c, 0x789b, 0x0317, 0x0804,
+	0x338a, 0x2039, 0x0001, 0x7d98, 0x7c9c, 0x0800, 0x2039, 0x0001,
+	0x7d98, 0x7c9c, 0x0848, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804,
+	0x33bf, 0x2138, 0x7d98, 0x7c9c, 0x0804, 0x33c6, 0x79a0, 0x9182,
+	0x0040, 0x0210, 0x0804, 0x33bf, 0x2138, 0x7d98, 0x7c9c, 0x0804,
+	0x33d4, 0x79a0, 0x9182, 0x0040, 0x0210, 0x0804, 0x33bf, 0x21e8,
+	0x7984, 0x7888, 0x20a9, 0x0001, 0x21a0, 0x4004, 0x0804, 0x338a,
+	0x2061, 0x0800, 0xe10c, 0x9006, 0x2c15, 0x9200, 0x8c60, 0x8109,
+	0x1dd8, 0x2010, 0x9005, 0x0904, 0x338a, 0x0804, 0x33b9, 0x79a0,
+	0x9182, 0x0040, 0x0210, 0x0804, 0x33bf, 0x21e0, 0x20a9, 0x0001,
+	0x7984, 0x2198, 0x4012, 0x0804, 0x338a, 0x2069, 0x1853, 0x7884,
+	0x7990, 0x911a, 0x1a04, 0x33bf, 0x8019, 0x0904, 0x33bf, 0x684a,
+	0x6942, 0x788c, 0x6852, 0x7888, 0x6856, 0x9006, 0x685a, 0x685e,
+	0x080c, 0x73e8, 0x0804, 0x338a, 0x2069, 0x1853, 0x7884, 0x7994,
+	0x911a, 0x1a04, 0x33bf, 0x8019, 0x0904, 0x33bf, 0x684e, 0x6946,
+	0x788c, 0x6862, 0x7888, 0x6866, 0x9006, 0x686a, 0x686e, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x6769, 0x012e, 0x0804, 0x338a, 0x902e,
+	0x2520, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x33bc, 0x7984,
+	0x7b88, 0x7a8c, 0x20a9, 0x0005, 0x20e9, 0x0001, 0x20a1, 0x189c,
+	0x4101, 0x080c, 0x4878, 0x1120, 0x2009, 0x0002, 0x0804, 0x33bc,
+	0x2009, 0x0020, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x48c1,
+	0x701f, 0x34a3, 0x0005, 0xa864, 0x2008, 0x9084, 0x00ff, 0x9096,
+	0x0011, 0x0168, 0x9096, 0x0019, 0x0150, 0x9096, 0x0015, 0x0138,
+	0x9096, 0x0048, 0x0120, 0x9096, 0x0029, 0x1904, 0x33bc, 0x810f,
+	0x918c, 0x00ff, 0x0904, 0x33bc, 0x7112, 0x7010, 0x8001, 0x0560,
+	0x7012, 0x080c, 0x4878, 0x1120, 0x2009, 0x0002, 0x0804, 0x33bc,
+	0x2009, 0x0020, 0x7068, 0x2040, 0xa28c, 0xa390, 0xa494, 0xa598,
+	0x9290, 0x0040, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000,
+	0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c, 0x48c1, 0x701f, 0x34e1,
+	0x0005, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0002, 0x0120, 0x9096,
+	0x000a, 0x1904, 0x33bc, 0x0888, 0x7014, 0x2048, 0xa868, 0xc0fd,
+	0xa86a, 0xa864, 0x9084, 0x00ff, 0x9096, 0x0029, 0x1160, 0xc2fd,
+	0xaa7a, 0x080c, 0x5de4, 0x0150, 0x0126, 0x2091, 0x8000, 0xa87a,
+	0xa982, 0x012e, 0x0050, 0x080c, 0x60fb, 0x1128, 0x7007, 0x0003,
+	0x701f, 0x350d, 0x0005, 0x080c, 0x6bb3, 0x0126, 0x2091, 0x8000,
+	0x20a9, 0x0005, 0x20e1, 0x0001, 0x2099, 0x189c, 0x400a, 0x2100,
+	0x9210, 0x9399, 0x0000, 0x94a1, 0x0000, 0x95a9, 0x0000, 0xa85c,
+	0x9080, 0x0019, 0x2009, 0x0020, 0x012e, 0xaf60, 0x0804, 0x48c4,
+	0x2091, 0x8000, 0x7837, 0x4000, 0x7833, 0x0010, 0x7883, 0x4000,
+	0x7887, 0x4953, 0x788b, 0x5020, 0x788f, 0x2020, 0x2009, 0x017f,
+	0x2104, 0x7892, 0x3f00, 0x7896, 0x2061, 0x0100, 0x6200, 0x2061,
+	0x0200, 0x603c, 0x8007, 0x9205, 0x789a, 0x2009, 0x04fd, 0x2104,
+	0x789e, 0x2091, 0x5000, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
+	0xd084, 0x0180, 0x2001, 0x19f3, 0x2004, 0x9005, 0x0128, 0x2001,
+	0x008b, 0x2004, 0xd0fc, 0x0dd8, 0x2001, 0x008a, 0x2003, 0x0002,
+	0x2003, 0x1001, 0x2071, 0x0080, 0x0804, 0x0427, 0x81ff, 0x1904,
+	0x33bc, 0x7984, 0x080c, 0x6270, 0x1904, 0x33bf, 0x7e98, 0x9684,
+	0x3fff, 0x9082, 0x4000, 0x1a04, 0x33bf, 0x7c88, 0x7d8c, 0x080c,
+	0x64a2, 0x080c, 0x6433, 0x1518, 0x2061, 0x1ddc, 0x0126, 0x2091,
+	0x8000, 0x6000, 0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130,
+	0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0150, 0x012e, 0x9ce0,
+	0x001c, 0x2001, 0x1819, 0x2004, 0x9c02, 0x1a04, 0x33bc, 0x0c30,
+	0x080c, 0xb452, 0x012e, 0x0904, 0x33bc, 0x0804, 0x338a, 0x900e,
+	0x2001, 0x0005, 0x080c, 0x6bb3, 0x0126, 0x2091, 0x8000, 0x080c,
+	0xbb4b, 0x080c, 0x6996, 0x012e, 0x0804, 0x338a, 0x00a6, 0x2950,
+	0xb198, 0x080c, 0x6270, 0x1904, 0x35f8, 0xb6a4, 0x9684, 0x3fff,
+	0x9082, 0x4000, 0x16e8, 0xb49c, 0xb5a0, 0x080c, 0x64a2, 0x080c,
+	0x644d, 0x1520, 0x2061, 0x1ddc, 0x0126, 0x2091, 0x8000, 0x6000,
+	0x9086, 0x0000, 0x0148, 0x6014, 0x904d, 0x0130, 0xa86c, 0x9406,
+	0x1118, 0xa870, 0x9506, 0x0158, 0x012e, 0x9ce0, 0x001c, 0x2001,
+	0x1819, 0x2004, 0x9c02, 0x2009, 0x000d, 0x12b0, 0x0c28, 0x080c,
+	0xb452, 0x012e, 0x2009, 0x0003, 0x0178, 0x00e0, 0x900e, 0x2001,
+	0x0005, 0x080c, 0x6bb3, 0x0126, 0x2091, 0x8000, 0x080c, 0xbb4b,
+	0x080c, 0x698a, 0x012e, 0x0070, 0xb097, 0x4005, 0xb19a, 0x0010,
+	0xb097, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x2a48,
+	0x00ae, 0x0005, 0xb097, 0x4000, 0x9006, 0x918d, 0x0001, 0x2008,
+	0x2a48, 0x00ae, 0x0005, 0x81ff, 0x1904, 0x33bc, 0x080c, 0x488f,
+	0x0904, 0x33bf, 0x080c, 0x6337, 0x0904, 0x33bc, 0x080c, 0x64a8,
+	0x0904, 0x33bc, 0x0804, 0x4329, 0x81ff, 0x1904, 0x33bc, 0x080c,
+	0x48ab, 0x0904, 0x33bf, 0x080c, 0x6536, 0x0904, 0x33bc, 0x2019,
+	0x0005, 0x79a8, 0x080c, 0x64c3, 0x0904, 0x33bc, 0x7888, 0x908a,
+	0x1000, 0x1a04, 0x33bf, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c,
+	0x8167, 0x7984, 0xd184, 0x1904, 0x338a, 0x0804, 0x4329, 0x0126,
+	0x2091, 0x8000, 0x81ff, 0x0118, 0x2009, 0x0001, 0x0450, 0x2029,
+	0x07ff, 0x6458, 0x2400, 0x9506, 0x01f8, 0x2508, 0x080c, 0x6270,
+	0x11d8, 0x080c, 0x6536, 0x1128, 0x2009, 0x0002, 0x62bc, 0x2518,
+	0x00c0, 0x2019, 0x0004, 0x900e, 0x080c, 0x64c3, 0x1118, 0x2009,
+	0x0006, 0x0078, 0x7884, 0x908a, 0x1000, 0x1270, 0x8003, 0x800b,
+	0x810b, 0x9108, 0x080c, 0x8167, 0x8529, 0x1ae0, 0x012e, 0x0804,
+	0x338a, 0x012e, 0x0804, 0x33bc, 0x012e, 0x0804, 0x33bf, 0x080c,
+	0x488f, 0x0904, 0x33bf, 0x080c, 0x6337, 0x0904, 0x33bc, 0x080c,
+	0x98c8, 0xbaa0, 0x2019, 0x0005, 0x00c6, 0x9066, 0x080c, 0x863b,
+	0x0076, 0x903e, 0x080c, 0x852a, 0x900e, 0x080c, 0xcfc8, 0x007e,
+	0x00ce, 0x080c, 0x98e4, 0x080c, 0x64a2, 0x0804, 0x338a, 0x080c,
+	0x488f, 0x0904, 0x33bf, 0x080c, 0x64a2, 0x2208, 0x0804, 0x338a,
+	0x0156, 0x00d6, 0x00e6, 0x00c6, 0x2069, 0x1906, 0x6810, 0x6914,
+	0x910a, 0x1208, 0x900e, 0x6816, 0x9016, 0x901e, 0x2071, 0x19b8,
+	0x7028, 0x9065, 0x0118, 0x8210, 0x600c, 0x0cd8, 0x2300, 0x9218,
+	0x00ce, 0x00ee, 0x00de, 0x015e, 0x0804, 0x338a, 0x00f6, 0x0016,
+	0x907d, 0x0138, 0x9006, 0x8000, 0x2f0c, 0x81ff, 0x0110, 0x2178,
+	0x0cd0, 0x001e, 0x00fe, 0x0005, 0x2069, 0x1906, 0x6910, 0x62b8,
+	0x0804, 0x338a, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x33bc,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x53a1, 0x0128, 0x2009, 0x0007,
+	0x012e, 0x0804, 0x33bc, 0x012e, 0x6158, 0x9190, 0x318b, 0x2215,
+	0x9294, 0x00ff, 0x6378, 0x83ff, 0x0108, 0x627c, 0x67d8, 0x97c4,
+	0x000a, 0x98c6, 0x000a, 0x1118, 0x2031, 0x0001, 0x00e8, 0x97c4,
+	0x0022, 0x98c6, 0x0022, 0x1118, 0x2031, 0x0003, 0x00a8, 0x97c4,
+	0x0012, 0x98c6, 0x0012, 0x1118, 0x2031, 0x0002, 0x0068, 0x080c,
+	0x70b7, 0x1118, 0x2031, 0x0004, 0x0038, 0xd79c, 0x0120, 0x2009,
+	0x0005, 0x0804, 0x33bc, 0x9036, 0x7e9a, 0x7f9e, 0x0804, 0x338a,
+	0x6148, 0x624c, 0x2019, 0x1957, 0x231c, 0x2001, 0x1958, 0x2004,
+	0x789a, 0x0804, 0x338a, 0x0126, 0x2091, 0x8000, 0x6138, 0x623c,
+	0x6340, 0x012e, 0x0804, 0x338a, 0x080c, 0x48ab, 0x0904, 0x33bf,
+	0xba44, 0xbb38, 0x0804, 0x338a, 0x080c, 0x0d65, 0x080c, 0x48ab,
+	0x2110, 0x0904, 0x33bf, 0xb804, 0x908c, 0x00ff, 0x918e, 0x0006,
+	0x0140, 0x9084, 0xff00, 0x9086, 0x0600, 0x2009, 0x0009, 0x1904,
+	0x33bc, 0x0126, 0x2091, 0x8000, 0x2019, 0x0005, 0x00c6, 0x9066,
+	0x080c, 0x98c8, 0x080c, 0x94f4, 0x080c, 0x863b, 0x0076, 0x903e,
+	0x080c, 0x852a, 0x900e, 0x080c, 0xcfc8, 0x007e, 0x00ce, 0x080c,
+	0x98e4, 0xb807, 0x0407, 0x012e, 0x0804, 0x338a, 0x6148, 0x624c,
+	0x7884, 0x604a, 0x7b88, 0x634e, 0x2069, 0x1853, 0x831f, 0x9305,
+	0x6816, 0x788c, 0x2069, 0x1957, 0x2d1c, 0x206a, 0x7e98, 0x9682,
+	0x0014, 0x1210, 0x2031, 0x07d0, 0x2069, 0x1958, 0x2d04, 0x266a,
+	0x789a, 0x0804, 0x338a, 0x0126, 0x2091, 0x8000, 0x6138, 0x7884,
+	0x603a, 0x910e, 0xd1b4, 0x190c, 0x0eb4, 0xd0c4, 0x01a8, 0x00d6,
+	0x78a8, 0x2009, 0x196e, 0x200a, 0x78ac, 0x2011, 0x196f, 0x2012,
+	0x2069, 0x0100, 0x6838, 0x9086, 0x0007, 0x1118, 0x2214, 0x6a5a,
+	0x0010, 0x210c, 0x695a, 0x00de, 0x7888, 0x603e, 0x2011, 0x0116,
+	0x220c, 0x7888, 0xd08c, 0x0118, 0x918d, 0x0040, 0x0010, 0x918c,
+	0xff7f, 0x2112, 0x6140, 0x788c, 0x6042, 0x910e, 0xd1e4, 0x190c,
+	0x0ecf, 0x6040, 0xd0cc, 0x0120, 0x78b0, 0x2011, 0x0114, 0x2012,
+	0x012e, 0x0804, 0x338a, 0x00f6, 0x2079, 0x1800, 0x7a38, 0xa898,
+	0x9084, 0xfebf, 0x9215, 0xa89c, 0x9084, 0xfebf, 0x8002, 0x9214,
+	0x7838, 0x9084, 0x0140, 0x9215, 0x7a3a, 0xa897, 0x4000, 0x900e,
+	0x9085, 0x0001, 0x2001, 0x0000, 0x00fe, 0x0005, 0x7898, 0x9005,
+	0x01a8, 0x7888, 0x9025, 0x0904, 0x33bf, 0x788c, 0x902d, 0x0904,
+	0x33bf, 0x900e, 0x080c, 0x6270, 0x1120, 0xba44, 0xbb38, 0xbc46,
+	0xbd3a, 0x9186, 0x07ff, 0x0190, 0x8108, 0x0ca0, 0x080c, 0x48ab,
+	0x0904, 0x33bf, 0x7888, 0x900d, 0x0904, 0x33bf, 0x788c, 0x9005,
+	0x0904, 0x33bf, 0xba44, 0xb946, 0xbb38, 0xb83a, 0x0804, 0x338a,
+	0x2011, 0xbc09, 0x0010, 0x2011, 0xbc05, 0x080c, 0x53a1, 0x1904,
+	0x33bc, 0x00c6, 0x2061, 0x0100, 0x7984, 0x9186, 0x00ff, 0x1130,
+	0x2001, 0x1817, 0x2004, 0x9085, 0xff00, 0x0088, 0x9182, 0x007f,
+	0x16e0, 0x9188, 0x318b, 0x210d, 0x918c, 0x00ff, 0x2001, 0x1817,
+	0x2004, 0x0026, 0x9116, 0x002e, 0x0580, 0x810f, 0x9105, 0x0126,
+	0x2091, 0x8000, 0x0006, 0x080c, 0x9b91, 0x000e, 0x0510, 0x602e,
+	0x620a, 0x7984, 0x00b6, 0x080c, 0x6216, 0x2b08, 0x00be, 0x1500,
+	0x6112, 0x6023, 0x0001, 0x080c, 0x4878, 0x01d0, 0x9006, 0xa866,
+	0x7007, 0x0003, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x701f, 0x3863,
+	0x2900, 0x6016, 0x2009, 0x0032, 0x080c, 0x9c85, 0x012e, 0x00ce,
+	0x0005, 0x012e, 0x00ce, 0x0804, 0x33bc, 0x00ce, 0x0804, 0x33bf,
+	0x080c, 0x9be7, 0x0cb0, 0xa830, 0x9086, 0x0100, 0x0904, 0x33bc,
+	0x0804, 0x338a, 0x2061, 0x1a3f, 0x0126, 0x2091, 0x8000, 0x6000,
+	0xd084, 0x0170, 0x6104, 0x6208, 0x2061, 0x1800, 0x6350, 0x6070,
+	0x789a, 0x60bc, 0x789e, 0x60b8, 0x78aa, 0x012e, 0x0804, 0x338a,
+	0x900e, 0x2110, 0x0c88, 0x81ff, 0x1904, 0x33bc, 0x080c, 0x70b7,
+	0x0904, 0x33bc, 0x0126, 0x2091, 0x8000, 0x6250, 0x6070, 0x9202,
+	0x0248, 0x9085, 0x0001, 0x080c, 0x248d, 0x080c, 0x55bb, 0x012e,
+	0x0804, 0x338a, 0x012e, 0x0804, 0x33bf, 0x0006, 0x0016, 0x00c6,
+	0x00e6, 0x2001, 0x197a, 0x2070, 0x2061, 0x1853, 0x6008, 0x2072,
+	0x900e, 0x2011, 0x1400, 0x080c, 0x8419, 0x7206, 0x00ee, 0x00ce,
+	0x001e, 0x000e, 0x0005, 0x0126, 0x2091, 0x8000, 0x81ff, 0x0128,
+	0x012e, 0x2021, 0x400b, 0x0804, 0x338c, 0x7884, 0xd0fc, 0x0148,
+	0x2001, 0x002a, 0x2004, 0x9082, 0x00e1, 0x0288, 0x012e, 0x0804,
+	0x33bf, 0x2001, 0x002a, 0x2004, 0x2069, 0x1853, 0x6908, 0x9102,
+	0x1230, 0x012e, 0x0804, 0x33bf, 0x012e, 0x0804, 0x33bc, 0x080c,
+	0x9b66, 0x0dd0, 0x7884, 0xd0fc, 0x0904, 0x392e, 0x00c6, 0x080c,
+	0x4878, 0x00ce, 0x0d88, 0xa867, 0x0000, 0x7884, 0xa80a, 0x7898,
+	0xa80e, 0x789c, 0xa812, 0x2001, 0x002e, 0x2004, 0xa81a, 0x2001,
+	0x002f, 0x2004, 0xa81e, 0x2001, 0x0030, 0x2004, 0xa822, 0x2001,
+	0x0031, 0x2004, 0xa826, 0x2001, 0x0034, 0x2004, 0xa82a, 0x2001,
+	0x0035, 0x2004, 0xa82e, 0x2001, 0x002a, 0x2004, 0x9080, 0x0003,
+	0x9084, 0x00fc, 0x8004, 0xa816, 0x080c, 0x3ab8, 0x0928, 0x7014,
+	0x2048, 0xad2c, 0xac28, 0xab1c, 0xaa18, 0xa930, 0xa808, 0xd0b4,
 	0x1120, 0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006, 0x8007,
-	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0,
-	0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c, 0x0f9f, 0x000e, 0x080c,
-	0x48bd, 0x007e, 0x701f, 0x39ee, 0x7023, 0x0001, 0x0005, 0x0804,
-	0x3383, 0x0156, 0x00c6, 0xa814, 0x908a, 0x001e, 0x0218, 0xa833,
-	0x001e, 0x0010, 0xa832, 0x0078, 0x81ff, 0x0168, 0x0016, 0x080c,
-	0x4871, 0x001e, 0x0130, 0xa800, 0x2040, 0xa008, 0xa80a, 0x2100,
-	0x0c58, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x015e, 0x0005,
-	0x0006, 0x00f6, 0x2079, 0x0000, 0x7880, 0x9086, 0x0044, 0x00fe,
-	0x000e, 0x0005, 0x2001, 0x1970, 0x2003, 0x0001, 0x0005, 0x00f6,
-	0x00e6, 0x00c6, 0x2061, 0x0200, 0x2001, 0x197b, 0x2004, 0x601a,
-	0x2061, 0x0100, 0x2001, 0x197a, 0x2004, 0x60ce, 0x6104, 0xc1ac,
-	0x6106, 0x080c, 0x4871, 0xa813, 0x0019, 0xa817, 0x0001, 0x2900,
-	0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f, 0x2004,
-	0xa86a, 0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x197a, 0x2004,
-	0x6036, 0x2009, 0x0040, 0x080c, 0x2052, 0x2001, 0x002a, 0x2004,
-	0x9084, 0xfff8, 0xa86e, 0x601a, 0xa873, 0x0000, 0x601f, 0x0000,
-	0x78ca, 0x9006, 0x600a, 0x600e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
-	0x00e6, 0x080c, 0x4871, 0x2940, 0xa013, 0x0019, 0xa017, 0x0001,
-	0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa866, 0x2001, 0x0031,
-	0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e,
-	0xa873, 0x0000, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x0300,
-	0x2003, 0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004,
-	0x200c, 0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091,
-	0x8000, 0x81ff, 0x0148, 0x080c, 0x2811, 0x1130, 0x9006, 0x080c,
-	0x276e, 0x9006, 0x080c, 0x2751, 0x7884, 0x9084, 0x0007, 0x0002,
-	0x3b6b, 0x3b74, 0x3b7d, 0x3b68, 0x3b68, 0x3b68, 0x3b68, 0x3b68,
-	0x012e, 0x0804, 0x33b8, 0x2009, 0x0114, 0x2104, 0x9085, 0x0800,
-	0x200a, 0x080c, 0x3d3f, 0x00c0, 0x2009, 0x0114, 0x2104, 0x9085,
-	0x4000, 0x200a, 0x080c, 0x3d3f, 0x0078, 0x080c, 0x70ac, 0x1128,
-	0x012e, 0x2009, 0x0016, 0x0804, 0x33b5, 0x81ff, 0x0128, 0x012e,
-	0x2021, 0x400b, 0x0804, 0x3385, 0x080c, 0x98ad, 0x0086, 0x0096,
-	0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x3896,
-	0x2009, 0x0101, 0x210c, 0x0016, 0x7ec8, 0x7dcc, 0x9006, 0x2068,
-	0x2060, 0x2058, 0x080c, 0x3fe0, 0x080c, 0x3f30, 0x903e, 0x2720,
-	0x00f6, 0x00e6, 0x0086, 0x2940, 0x2071, 0x19b8, 0x2079, 0x0090,
-	0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x68d4, 0x780e,
-	0x68d0, 0x780a, 0x00de, 0x2011, 0x0001, 0x080c, 0x3e91, 0x080c,
-	0x2819, 0x080c, 0x2819, 0x080c, 0x2819, 0x080c, 0x2819, 0x080c,
-	0x3e91, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x3dbe, 0x2009, 0x9c40,
-	0x8109, 0x11b0, 0x080c, 0x3cf5, 0x2001, 0x0004, 0x200c, 0x918c,
-	0xfffd, 0x2102, 0x001e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
-	0x00ae, 0x009e, 0x008e, 0x2009, 0x0017, 0x080c, 0x33b5, 0x0cf8,
-	0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1d10, 0x00f6, 0x2079,
-	0x0000, 0x7884, 0x00fe, 0xd0bc, 0x0178, 0x2001, 0x0201, 0x200c,
-	0x81ff, 0x0150, 0x080c, 0x3d9c, 0x2d00, 0x9c05, 0x9b05, 0x0120,
-	0x080c, 0x3cf5, 0x0804, 0x3c9e, 0x080c, 0x3f05, 0x080c, 0x3e29,
-	0x080c, 0x3d7f, 0x080c, 0x3db4, 0x00f6, 0x2079, 0x0100, 0x7824,
-	0xd0ac, 0x0130, 0x8b58, 0x080c, 0x3cf5, 0x00fe, 0x0804, 0x3c9e,
-	0x00fe, 0x080c, 0x3ceb, 0x1150, 0x8d68, 0x2001, 0x0032, 0x2602,
-	0x2001, 0x0033, 0x2502, 0x080c, 0x3cf5, 0x0080, 0x87ff, 0x0138,
-	0x2001, 0x0201, 0x2004, 0x9005, 0x1908, 0x8739, 0x0038, 0x2001,
-	0x1a3c, 0x2004, 0x9086, 0x0000, 0x1904, 0x3bee, 0x2001, 0x032f,
-	0x2003, 0x00f6, 0x8631, 0x1208, 0x8529, 0x2500, 0x9605, 0x0904,
-	0x3c9e, 0x7884, 0xd0bc, 0x0128, 0x2d00, 0x9c05, 0x9b05, 0x1904,
-	0x3c9e, 0xa013, 0x0019, 0x2001, 0x032a, 0x2003, 0x0004, 0x7884,
-	0xd0ac, 0x1148, 0x2001, 0x1a3c, 0x2003, 0x0003, 0x2001, 0x032a,
-	0x2003, 0x0009, 0x0030, 0xa017, 0x0001, 0x78b4, 0x9005, 0x0108,
-	0xa016, 0x2800, 0xa05a, 0x2009, 0x0040, 0x080c, 0x2052, 0x2900,
-	0xa85a, 0xa813, 0x0019, 0x7884, 0xd0a4, 0x1180, 0xa817, 0x0000,
-	0x00c6, 0x20a9, 0x0004, 0x2061, 0x0090, 0x602b, 0x0008, 0x2001,
-	0x0203, 0x2004, 0x1f04, 0x3c75, 0x00ce, 0x0030, 0xa817, 0x0001,
-	0x78b0, 0x9005, 0x0108, 0xa816, 0x00f6, 0x00c6, 0x2079, 0x0100,
-	0x2061, 0x0090, 0x7827, 0x0002, 0x2001, 0x002a, 0x2004, 0x9084,
-	0xfff8, 0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6,
-	0x000e, 0x78ca, 0x00ce, 0x00fe, 0x0804, 0x3ba8, 0x001e, 0x00c6,
-	0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002,
-	0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x2001, 0x0004, 0x200c,
-	0x918c, 0xfffd, 0x2102, 0x080c, 0x12d6, 0x7884, 0x9084, 0x0003,
-	0x9086, 0x0002, 0x01b0, 0x2009, 0x0028, 0x080c, 0x2052, 0x2001,
-	0x0227, 0x200c, 0x2102, 0x6050, 0x9084, 0xb7ff, 0x080c, 0x28d4,
-	0x6052, 0x602f, 0x0000, 0x604b, 0xf7f7, 0x6043, 0x0090, 0x6043,
-	0x0010, 0x080c, 0x98c9, 0x00ce, 0x2d08, 0x2c10, 0x2b18, 0x2b00,
-	0x9c05, 0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae,
-	0x009e, 0x008e, 0x1118, 0x012e, 0x0804, 0x3383, 0x012e, 0x2021,
-	0x400c, 0x0804, 0x3385, 0x9085, 0x0001, 0x1d04, 0x3cf4, 0x2091,
-	0x6000, 0x8420, 0x9486, 0x0064, 0x0005, 0x2001, 0x0105, 0x2003,
-	0x0010, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x1a3c, 0x2003,
-	0x0000, 0x0071, 0x2009, 0x0048, 0x080c, 0x2052, 0x2001, 0x0227,
-	0x2024, 0x2402, 0x2001, 0x0109, 0x2003, 0x4000, 0x9026, 0x0005,
-	0x00f6, 0x00e6, 0x2071, 0x19b8, 0x7054, 0x9086, 0x0000, 0x0520,
-	0x2079, 0x0090, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c,
-	0x9106, 0x1120, 0x2009, 0x0040, 0x080c, 0x2052, 0x782c, 0xd0fc,
-	0x0d88, 0x080c, 0x3f05, 0x7054, 0x9086, 0x0000, 0x1d58, 0x782b,
-	0x0004, 0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040, 0x080c, 0x2052,
-	0x782b, 0x0002, 0x7057, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x00f6,
-	0x2079, 0x0100, 0x2001, 0x1817, 0x200c, 0x7932, 0x7936, 0x080c,
-	0x246d, 0x080c, 0x2890, 0x080c, 0x28d4, 0x784b, 0xf7f7, 0x7843,
-	0x0090, 0x7843, 0x0010, 0x7850, 0xc0e5, 0x7852, 0x2019, 0x61a8,
-	0x7820, 0xd09c, 0x0110, 0x8319, 0x1dd8, 0x7850, 0xc0e4, 0x7852,
-	0x2011, 0x0048, 0x080c, 0x286d, 0x7843, 0x0040, 0x2019, 0x01f4,
-	0xa001, 0xa001, 0x8319, 0x1de0, 0x2001, 0x0100, 0x080c, 0x2833,
-	0x2011, 0x0020, 0x080c, 0x286d, 0x7843, 0x0000, 0x9006, 0x080c,
-	0x2833, 0x2011, 0x0048, 0x080c, 0x286d, 0x00fe, 0x0005, 0x7884,
-	0xd0ac, 0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a3c, 0x2079, 0x0320,
-	0x2001, 0x0201, 0x2004, 0x9005, 0x0160, 0x7000, 0x9086, 0x0000,
-	0x1140, 0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003, 0x0003, 0x782b,
-	0x0019, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0300, 0x78bc,
-	0x00fe, 0x908c, 0x0070, 0x0178, 0x2009, 0x0032, 0x260a, 0x2009,
-	0x0033, 0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac, 0x0108, 0x8d68,
-	0xd0a4, 0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079, 0x0200, 0x781c,
-	0xd084, 0x0110, 0x7837, 0x0050, 0x00fe, 0x0005, 0x00e6, 0x2071,
-	0x0100, 0x2001, 0x197b, 0x2004, 0x70e2, 0x080c, 0x3ad0, 0x1188,
-	0x2001, 0x181f, 0x2004, 0x2009, 0x181e, 0x210c, 0x918c, 0x00ff,
-	0x706e, 0x716a, 0x7066, 0x918d, 0x3200, 0x7162, 0x7073, 0xe109,
-	0x0080, 0x702c, 0x9085, 0x0002, 0x702e, 0x2009, 0x1817, 0x210c,
-	0x716e, 0x7063, 0x0100, 0x7166, 0x719e, 0x706b, 0x0000, 0x7073,
-	0x0809, 0x7077, 0x0008, 0x7078, 0x9080, 0x0100, 0x707a, 0x7080,
-	0x8000, 0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a, 0x708e, 0x707e,
-	0x70d6, 0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014, 0x9084, 0x1984,
-	0x9085, 0x0092, 0x7016, 0x080c, 0x3f05, 0x00f6, 0x2071, 0x1a3c,
-	0x2079, 0x0320, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120,
-	0x689c, 0x780e, 0x6898, 0x780a, 0x00de, 0x2009, 0x03e8, 0x8109,
-	0x1df0, 0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004, 0x2011, 0x0011,
-	0x080c, 0x3e91, 0x2011, 0x0001, 0x080c, 0x3e91, 0x00fe, 0x00ee,
-	0x0005, 0x00f6, 0x00e6, 0x2071, 0x1a3c, 0x2079, 0x0320, 0x792c,
-	0xd1fc, 0x0904, 0x3e8e, 0x782b, 0x0002, 0x9026, 0xd19c, 0x1904,
-	0x3e8a, 0x7000, 0x0002, 0x3e8e, 0x3e3f, 0x3e6f, 0x3e8a, 0xd1bc,
-	0x1170, 0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011, 0x0001, 0x080c,
-	0x3e91, 0x0904, 0x3e8e, 0x080c, 0x3e91, 0x0804, 0x3e8e, 0x00f6,
-	0x2079, 0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810, 0x7914, 0x782b,
-	0x0004, 0x7812, 0x7916, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0de8,
-	0x080c, 0x3d9c, 0x2009, 0x0001, 0x00f6, 0x2079, 0x0300, 0x78b8,
-	0x00fe, 0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a, 0x00f8, 0x8001,
-	0x7002, 0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc, 0x1904, 0x3e33,
-	0x2011, 0x0001, 0x00b1, 0x0090, 0xa010, 0x9092, 0x0004, 0x9086,
-	0x0015, 0x1120, 0xa000, 0xa05a, 0x2011, 0x0031, 0xa212, 0xd1dc,
-	0x1960, 0x0828, 0x782b, 0x0004, 0x7003, 0x0000, 0x00ee, 0x00fe,
-	0x0005, 0xa014, 0x9005, 0x0550, 0x8001, 0x0036, 0x0096, 0xa016,
-	0xa058, 0x2048, 0xa010, 0x2009, 0x0031, 0x911a, 0x831c, 0x831c,
-	0x938a, 0x0007, 0x1a0c, 0x0d65, 0x9398, 0x3ebf, 0x231d, 0x083f,
-	0x9080, 0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102, 0x009e, 0x003e,
-	0x908a, 0x0035, 0x1140, 0x0096, 0xa058, 0x2048, 0xa804, 0xa05a,
-	0x2001, 0x0019, 0x009e, 0xa012, 0x9085, 0x0001, 0x0005, 0x3efc,
-	0x3ef3, 0x3eea, 0x3ee1, 0x3ed8, 0x3ecf, 0x3ec6, 0xa964, 0x7902,
-	0xa968, 0x7906, 0xa96c, 0x7912, 0xa970, 0x7916, 0x0005, 0xa974,
-	0x7902, 0xa978, 0x7906, 0xa97c, 0x7912, 0xa980, 0x7916, 0x0005,
-	0xa984, 0x7902, 0xa988, 0x7906, 0xa98c, 0x7912, 0xa990, 0x7916,
-	0x0005, 0xa994, 0x7902, 0xa998, 0x7906, 0xa99c, 0x7912, 0xa9a0,
-	0x7916, 0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906, 0xa9ac, 0x7912,
-	0xa9b0, 0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8, 0x7906, 0xa9bc,
-	0x7912, 0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902, 0xa9c8, 0x7906,
-	0xa9cc, 0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6, 0x00e6, 0x0086,
-	0x2071, 0x19b8, 0x2079, 0x0090, 0x792c, 0xd1fc, 0x01e8, 0x782b,
-	0x0002, 0x2940, 0x9026, 0x7054, 0x0002, 0x3f2c, 0x3f18, 0x3f23,
-	0x8001, 0x7056, 0xd19c, 0x1180, 0x2011, 0x0001, 0x080c, 0x3e91,
-	0x190c, 0x3e91, 0x0048, 0x8001, 0x7056, 0x782c, 0xd0fc, 0x1d38,
-	0x2011, 0x0001, 0x080c, 0x3e91, 0x008e, 0x00ee, 0x00fe, 0x0005,
-	0x00f6, 0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200, 0x2001, 0x197b,
-	0x2004, 0x601a, 0x2061, 0x0100, 0x2001, 0x197a, 0x2004, 0x60ce,
-	0x6104, 0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004, 0x9005, 0x0520,
-	0x2038, 0x2001, 0x002e, 0x2024, 0x2001, 0x002f, 0x201c, 0x080c,
-	0x4871, 0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007,
-	0x0220, 0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096,
-	0xa858, 0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x3fa8,
-	0x1d68, 0x2900, 0xa85a, 0x00d0, 0x080c, 0x4871, 0xa813, 0x0019,
-	0xa817, 0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866,
-	0x2001, 0x002f, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084,
-	0xfff8, 0xa86e, 0x2001, 0x002b, 0x2004, 0xa872, 0x2061, 0x0090,
-	0x2079, 0x0100, 0x2001, 0x197a, 0x2004, 0x6036, 0x2009, 0x0040,
-	0x080c, 0x2052, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a,
-	0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca,
-	0x9006, 0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
-	0x00e6, 0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0, 0x20e1, 0x0000,
-	0x2099, 0x0088, 0x702b, 0x0026, 0x7402, 0x7306, 0x9006, 0x700a,
-	0x700e, 0x810b, 0x810b, 0x21a8, 0x810b, 0x7112, 0x702b, 0x0041,
-	0x702c, 0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b, 0x0040, 0x4005,
-	0x7400, 0x7304, 0x87ff, 0x0190, 0x0086, 0x0096, 0x2940, 0x0086,
-	0x080c, 0x4871, 0x008e, 0xa058, 0x00a6, 0x2050, 0x2900, 0xb006,
-	0xa05a, 0x00ae, 0x009e, 0x008e, 0x9085, 0x0001, 0x00ee, 0x0005,
-	0x00e6, 0x2001, 0x002d, 0x2004, 0x9005, 0x0528, 0x2038, 0x2001,
-	0x0030, 0x2024, 0x2001, 0x0031, 0x201c, 0x080c, 0x4871, 0x2940,
-	0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220,
-	0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858,
-	0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x3fa8, 0x1d68,
-	0x2900, 0xa85a, 0x00d8, 0x080c, 0x4871, 0x2940, 0xa013, 0x0019,
-	0xa017, 0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa066,
-	0x2001, 0x0031, 0x2004, 0xa06a, 0x2001, 0x002a, 0x2004, 0x9084,
-	0xfff8, 0xa06e, 0x2001, 0x002b, 0x2004, 0xa072, 0x2001, 0x032a,
-	0x2003, 0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001, 0x0101, 0x200c,
-	0x918d, 0x0200, 0x2102, 0xa017, 0x0000, 0x2001, 0x1a3c, 0x2003,
-	0x0003, 0x2001, 0x032a, 0x2003, 0x0009, 0x2001, 0x0300, 0x2003,
+	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x080c, 0x48c1,
+	0x701f, 0x39f5, 0x7023, 0x0001, 0x012e, 0x0005, 0x080c, 0x98c8,
+	0x0046, 0x0086, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6,
+	0x00f6, 0x080c, 0x389d, 0x2001, 0x1970, 0x2003, 0x0000, 0x2021,
+	0x000a, 0x2061, 0x0100, 0x6104, 0x0016, 0x60bb, 0x0000, 0x60bf,
+	0x32e1, 0x60bf, 0x0012, 0x080c, 0x3b27, 0x080c, 0x3ae6, 0x00f6,
+	0x00e6, 0x0086, 0x2940, 0x2071, 0x19b8, 0x2079, 0x0090, 0x00d6,
+	0x2069, 0x0000, 0x6884, 0xd0b4, 0x0140, 0x2001, 0x0035, 0x2004,
+	0x780e, 0x2001, 0x0034, 0x2004, 0x780a, 0x00de, 0x2011, 0x0001,
+	0x080c, 0x3e98, 0x008e, 0x00ee, 0x00fe, 0x080c, 0x3dc5, 0x080c,
+	0x3cf2, 0x05b8, 0x2001, 0x020b, 0x2004, 0x9084, 0x0140, 0x1db8,
+	0x080c, 0x3f0c, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe, 0x908c,
+	0x0070, 0x1560, 0x2071, 0x0200, 0x7037, 0x0000, 0x7050, 0x9084,
+	0xff00, 0x9086, 0x3200, 0x1510, 0x7037, 0x0001, 0x7050, 0x9084,
+	0xff00, 0x9086, 0xe100, 0x11d0, 0x7037, 0x0000, 0x7054, 0x7037,
+	0x0000, 0x715c, 0x9106, 0x1190, 0x2001, 0x181f, 0x2004, 0x9106,
+	0x1168, 0x00c6, 0x2061, 0x0100, 0x6024, 0x9084, 0x1e00, 0x00ce,
+	0x0138, 0x080c, 0x3cfc, 0x080c, 0x3ae1, 0x0058, 0x080c, 0x3ae1,
+	0x080c, 0x3e30, 0x080c, 0x3dbb, 0x2001, 0x020b, 0x2004, 0xd0e4,
+	0x0dd8, 0x2001, 0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027,
+	0x0002, 0x001e, 0x6106, 0x2011, 0x020d, 0x2013, 0x0020, 0x60bb,
+	0x0000, 0x60bf, 0x0108, 0x60bf, 0x0012, 0x2001, 0x0004, 0x200c,
+	0x918c, 0xfffd, 0x2102, 0x080c, 0x12d6, 0x2009, 0x0028, 0x080c,
+	0x2052, 0x2001, 0x0227, 0x200c, 0x2102, 0x080c, 0x98e4, 0x00fe,
+	0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e, 0x008e, 0x004e,
+	0x2001, 0x1970, 0x2004, 0x9005, 0x1118, 0x012e, 0x0804, 0x338a,
+	0x012e, 0x2021, 0x400c, 0x0804, 0x338c, 0x0016, 0x0026, 0x0036,
+	0x0046, 0x0056, 0x0076, 0x0086, 0x0096, 0x00d6, 0x0156, 0x7014,
+	0x2048, 0x7020, 0x20a8, 0x8000, 0x7022, 0xa804, 0x9005, 0x0904,
+	0x3a51, 0x2048, 0x1f04, 0x3a05, 0x7068, 0x2040, 0xa28c, 0xa390,
+	0xa494, 0xa598, 0xa930, 0xa808, 0xd0b4, 0x1120, 0x2029, 0x0000,
+	0x2021, 0x0000, 0x0096, 0x7014, 0x2048, 0xa864, 0x009e, 0x9086,
+	0x0103, 0x0170, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
+	0xffc0, 0x9080, 0x001b, 0x080c, 0x48c1, 0x701f, 0x39f5, 0x00b0,
+	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
+	0x001b, 0x21a8, 0x27e0, 0x2098, 0x27e8, 0x20a0, 0x0006, 0x080c,
+	0x0f9f, 0x000e, 0x080c, 0x48c4, 0x701f, 0x39f5, 0x015e, 0x00de,
+	0x009e, 0x008e, 0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e,
+	0x0005, 0x7014, 0x2048, 0xa864, 0x9086, 0x0103, 0x1118, 0x701f,
+	0x3ab6, 0x0450, 0x7014, 0x2048, 0xa868, 0xc0fd, 0xa86a, 0x2009,
+	0x007f, 0x080c, 0x6210, 0x0110, 0x9006, 0x0030, 0xb813, 0x00ff,
+	0xb817, 0xfffd, 0x080c, 0xbd2a, 0x015e, 0x00de, 0x009e, 0x008e,
+	0x007e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0904, 0x33bc,
+	0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0076, 0x0086, 0x0096,
+	0x00d6, 0x0156, 0x701f, 0x3a88, 0x7007, 0x0003, 0x0804, 0x3a46,
+	0xa830, 0x9086, 0x0100, 0x2021, 0x400c, 0x0904, 0x338c, 0x0076,
+	0xad10, 0xac0c, 0xab24, 0xaa20, 0xa930, 0xa808, 0xd0b4, 0x1120,
+	0x2029, 0x0000, 0x2021, 0x0000, 0x8906, 0x8006, 0x8007, 0x90bc,
+	0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x21a8, 0x27e0, 0x2098,
+	0x27e8, 0x20a0, 0x0006, 0x080c, 0x0f9f, 0x000e, 0x080c, 0x48c4,
+	0x007e, 0x701f, 0x39f5, 0x7023, 0x0001, 0x0005, 0x0804, 0x338a,
+	0x0156, 0x00c6, 0xa814, 0x908a, 0x001e, 0x0218, 0xa833, 0x001e,
+	0x0010, 0xa832, 0x0078, 0x81ff, 0x0168, 0x0016, 0x080c, 0x4878,
+	0x001e, 0x0130, 0xa800, 0x2040, 0xa008, 0xa80a, 0x2100, 0x0c58,
+	0x9006, 0x0010, 0x9085, 0x0001, 0x00ce, 0x015e, 0x0005, 0x0006,
+	0x00f6, 0x2079, 0x0000, 0x7880, 0x9086, 0x0044, 0x00fe, 0x000e,
+	0x0005, 0x2001, 0x1970, 0x2003, 0x0001, 0x0005, 0x00f6, 0x00e6,
+	0x00c6, 0x2061, 0x0200, 0x2001, 0x197b, 0x2004, 0x601a, 0x2061,
+	0x0100, 0x2001, 0x197a, 0x2004, 0x60ce, 0x6104, 0xc1ac, 0x6106,
+	0x080c, 0x4878, 0xa813, 0x0019, 0xa817, 0x0001, 0x2900, 0xa85a,
+	0x2001, 0x002e, 0x2004, 0xa866, 0x2001, 0x002f, 0x2004, 0xa86a,
+	0x2061, 0x0090, 0x2079, 0x0100, 0x2001, 0x197a, 0x2004, 0x6036,
+	0x2009, 0x0040, 0x080c, 0x2052, 0x2001, 0x002a, 0x2004, 0x9084,
+	0xfff8, 0xa86e, 0x601a, 0xa873, 0x0000, 0x601f, 0x0000, 0x78ca,
+	0x9006, 0x600a, 0x600e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6,
+	0x080c, 0x4878, 0x2940, 0xa013, 0x0019, 0xa017, 0x0001, 0x2800,
+	0xa05a, 0x2001, 0x0030, 0x2004, 0xa866, 0x2001, 0x0031, 0x2004,
+	0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0xa86e, 0xa873,
+	0x0000, 0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x0300, 0x2003,
 	0x0000, 0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c,
 	0x918d, 0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000,
-	0x20a9, 0x0013, 0x20a1, 0x1840, 0x20e9, 0x0001, 0x9006, 0x4004,
-	0x2009, 0x013c, 0x200a, 0x012e, 0x7880, 0x9086, 0x0052, 0x0108,
-	0x0005, 0x0804, 0x3383, 0x7d98, 0x7c9c, 0x0804, 0x347a, 0x080c,
-	0x70ac, 0x190c, 0x5c9a, 0x2069, 0x1853, 0x2d00, 0x2009, 0x0030,
-	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x48ba,
-	0x701f, 0x407b, 0x0005, 0x080c, 0x5395, 0x1130, 0x3b00, 0x3a08,
-	0xc194, 0xc095, 0x20d8, 0x21d0, 0x2069, 0x1853, 0x6800, 0x9005,
-	0x0904, 0x33b8, 0x6804, 0xd094, 0x00c6, 0x2061, 0x0100, 0x6104,
-	0x0138, 0x6200, 0x9292, 0x0005, 0x0218, 0x918c, 0xffdf, 0x0010,
-	0x918d, 0x0020, 0x6106, 0x00ce, 0xd08c, 0x00c6, 0x2061, 0x0100,
-	0x6104, 0x0118, 0x918d, 0x0010, 0x0010, 0x918c, 0xffef, 0x6106,
-	0x00ce, 0xd084, 0x0158, 0x6a28, 0x928a, 0x007f, 0x1a04, 0x33b8,
-	0x9288, 0x3184, 0x210d, 0x918c, 0x00ff, 0x6162, 0xd0dc, 0x0130,
-	0x6828, 0x908a, 0x007f, 0x1a04, 0x33b8, 0x605a, 0x6888, 0x9084,
-	0x0030, 0x8004, 0x8004, 0x8004, 0x8004, 0x0006, 0x2009, 0x1982,
-	0x9080, 0x2560, 0x2005, 0x200a, 0x2008, 0x2001, 0x0018, 0x080c,
-	0x989e, 0x2009, 0x0390, 0x200b, 0x0400, 0x000e, 0x2009, 0x1983,
-	0x9080, 0x2564, 0x2005, 0x200a, 0x6808, 0x908a, 0x0100, 0x0a04,
-	0x33b8, 0x908a, 0x0841, 0x1a04, 0x33b8, 0x9084, 0x0007, 0x1904,
-	0x33b8, 0x680c, 0x9005, 0x0904, 0x33b8, 0x6810, 0x9005, 0x0904,
-	0x33b8, 0x6848, 0x6940, 0x910a, 0x1a04, 0x33b8, 0x8001, 0x0904,
-	0x33b8, 0x684c, 0x6944, 0x910a, 0x1a04, 0x33b8, 0x8001, 0x0904,
-	0x33b8, 0x6814, 0x908c, 0x00ff, 0x614a, 0x8007, 0x9084, 0x00ff,
-	0x604e, 0x080c, 0x73dd, 0x080c, 0x672d, 0x080c, 0x6762, 0x6808,
-	0x602a, 0x080c, 0x1fc4, 0x2009, 0x0170, 0x200b, 0x0080, 0xa001,
-	0xa001, 0x200b, 0x0000, 0x0036, 0x6b08, 0x080c, 0x24c7, 0x003e,
-	0x6000, 0x9086, 0x0000, 0x1904, 0x41e7, 0x6818, 0x691c, 0x6a20,
-	0x6b24, 0x8007, 0x810f, 0x8217, 0x831f, 0x6016, 0x611a, 0x621e,
-	0x6322, 0x6c04, 0xd4f4, 0x0148, 0x6830, 0x6934, 0x6a38, 0x6b3c,
-	0x8007, 0x810f, 0x8217, 0x831f, 0x0010, 0x9084, 0xf0ff, 0x6006,
-	0x610a, 0x620e, 0x6312, 0x8007, 0x810f, 0x8217, 0x831f, 0x20a9,
-	0x0004, 0x20a1, 0x1984, 0x20e9, 0x0001, 0x4001, 0x20a9, 0x0004,
-	0x20a1, 0x199e, 0x20e9, 0x0001, 0x4001, 0x080c, 0x82a8, 0x00c6,
-	0x900e, 0x20a9, 0x0001, 0x6b70, 0xd384, 0x01c8, 0x0020, 0x839d,
-	0x12b0, 0x3508, 0x8109, 0x080c, 0x79b3, 0x6878, 0x6016, 0x6874,
-	0x2008, 0x9084, 0xff00, 0x8007, 0x600a, 0x9184, 0x00ff, 0x6006,
-	0x8108, 0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001, 0x1f04,
-	0x415f, 0x00ce, 0x00c6, 0x2061, 0x196d, 0x2063, 0x0001, 0x9006,
-	0x080c, 0x276e, 0x9006, 0x080c, 0x2751, 0x0000, 0x00ce, 0x00e6,
-	0x2c70, 0x080c, 0x0e9c, 0x00ee, 0x6888, 0xd0ec, 0x0130, 0x2011,
-	0x0114, 0x2204, 0x9085, 0x0180, 0x2012, 0x6a80, 0x9284, 0x0030,
-	0x9086, 0x0030, 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82,
-	0x2001, 0x194d, 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000, 0x0170,
-	0x928e, 0x0010, 0x0118, 0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa,
-	0x080c, 0x253c, 0x2001, 0x193e, 0x2102, 0x0008, 0x2102, 0x00c6,
-	0x2061, 0x0100, 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c,
-	0x70ac, 0x0128, 0x080c, 0x4c8a, 0x0110, 0x080c, 0x248d, 0x60d0,
-	0x9005, 0x01c0, 0x6003, 0x0001, 0x2009, 0x41cf, 0x00d0, 0x080c,
-	0x70ac, 0x1168, 0x2011, 0x6f22, 0x080c, 0x8131, 0x2011, 0x6f15,
-	0x080c, 0x8237, 0x080c, 0x73b1, 0x080c, 0x6fdd, 0x0040, 0x080c,
-	0x5b90, 0x0028, 0x6003, 0x0004, 0x2009, 0x41e7, 0x0010, 0x0804,
-	0x3383, 0x2001, 0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c,
-	0x1118, 0x2091, 0x31bd, 0x0817, 0x2091, 0x313d, 0x0817, 0x6000,
-	0x9086, 0x0000, 0x0904, 0x33b5, 0x2069, 0x1853, 0x7890, 0x6842,
-	0x7894, 0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c,
-	0x7d98, 0x2039, 0x0001, 0x0804, 0x48bd, 0x9006, 0x080c, 0x248d,
-	0x81ff, 0x1904, 0x33b5, 0x080c, 0x70ac, 0x11b0, 0x080c, 0x73ac,
-	0x080c, 0x5cd5, 0x080c, 0x317f, 0x0118, 0x6130, 0xc18d, 0x6132,
-	0x080c, 0xbf46, 0x0130, 0x080c, 0x70cf, 0x1118, 0x080c, 0x7080,
-	0x0038, 0x080c, 0x6fdd, 0x0020, 0x080c, 0x5c9a, 0x080c, 0x5b90,
-	0x0804, 0x3383, 0x81ff, 0x1904, 0x33b5, 0x080c, 0x70ac, 0x1110,
-	0x0804, 0x33b5, 0x6190, 0x81ff, 0x01a8, 0x704f, 0x0000, 0x2001,
-	0x1d80, 0x2009, 0x0040, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0126,
-	0x2091, 0x8000, 0x2039, 0x0001, 0x080c, 0x48bd, 0x701f, 0x3381,
-	0x012e, 0x0005, 0x704f, 0x0001, 0x00d6, 0x2069, 0x1d80, 0x20a9,
-	0x0040, 0x20e9, 0x0001, 0x20a1, 0x1d80, 0x2019, 0xffff, 0x4304,
-	0x6558, 0x9588, 0x3184, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e,
-	0x2011, 0x0002, 0x2100, 0x9506, 0x01a8, 0x080c, 0x6269, 0x1190,
-	0xb814, 0x821c, 0x0238, 0x9398, 0x1d80, 0x9085, 0xff00, 0x8007,
-	0x201a, 0x0038, 0x9398, 0x1d80, 0x2324, 0x94a4, 0xff00, 0x9405,
-	0x201a, 0x8210, 0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201,
-	0x8007, 0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1,
-	0x1d80, 0x2099, 0x1d80, 0x080c, 0x5c25, 0x0804, 0x423f, 0x080c,
-	0x48a4, 0x0904, 0x33b8, 0x080c, 0x4871, 0x1120, 0x2009, 0x0002,
-	0x0804, 0x33b5, 0x080c, 0x5386, 0xd0b4, 0x0558, 0x7884, 0x908e,
-	0x007e, 0x0538, 0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508,
-	0x080c, 0x317a, 0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084,
-	0x00ff, 0x9086, 0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd,
-	0xa86a, 0x080c, 0xb9fb, 0x1120, 0x2009, 0x0003, 0x0804, 0x33b5,
-	0x7007, 0x0003, 0x701f, 0x42cd, 0x0005, 0x080c, 0x48a4, 0x0904,
-	0x33b8, 0x20a9, 0x002b, 0xb8b4, 0x20e0, 0xb8b8, 0x2098, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008,
-	0x9080, 0x0006, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006,
-	0x2098, 0x080c, 0x0f9f, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080,
-	0x000a, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x000a, 0x2098,
-	0x080c, 0x0f9f, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c,
-	0x7d98, 0x0804, 0x48bd, 0x81ff, 0x1904, 0x33b5, 0x080c, 0x4888,
-	0x0904, 0x33b8, 0x080c, 0x64aa, 0x0904, 0x33b5, 0x0058, 0xa878,
-	0x9005, 0x0120, 0x2009, 0x0004, 0x0804, 0x33b5, 0xa974, 0xaa94,
-	0x0804, 0x3383, 0x080c, 0x538e, 0x0904, 0x3383, 0x701f, 0x4317,
-	0x7007, 0x0003, 0x0005, 0x81ff, 0x1904, 0x33b5, 0x7888, 0x908a,
-	0x1000, 0x1a04, 0x33b8, 0x080c, 0x48a4, 0x0904, 0x33b8, 0x080c,
-	0x6660, 0x0120, 0x080c, 0x6668, 0x1904, 0x33b8, 0x080c, 0x652f,
-	0x0904, 0x33b5, 0x2019, 0x0004, 0x900e, 0x080c, 0x64bc, 0x0904,
-	0x33b5, 0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000,
-	0x12f8, 0x080c, 0x48a2, 0x01e0, 0x080c, 0x6660, 0x0118, 0x080c,
-	0x6668, 0x11b0, 0x080c, 0x652f, 0x2009, 0x0002, 0x0168, 0x2009,
-	0x0002, 0x2019, 0x0004, 0x080c, 0x64bc, 0x2009, 0x0003, 0x0120,
-	0xa998, 0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010,
-	0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005,
-	0xa897, 0x4000, 0x080c, 0x538e, 0x0110, 0x9006, 0x0018, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110,
-	0x0071, 0x0060, 0x2029, 0x007e, 0x2061, 0x1800, 0x6458, 0x2400,
-	0x9506, 0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c,
-	0x6269, 0x1138, 0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c,
-	0x813f, 0x0005, 0x81ff, 0x1904, 0x33b5, 0x798c, 0x2001, 0x1951,
-	0x918c, 0x8000, 0x2102, 0x080c, 0x4888, 0x0904, 0x33b8, 0x080c,
-	0x6660, 0x0120, 0x080c, 0x6668, 0x1904, 0x33b8, 0x080c, 0x6330,
-	0x0904, 0x33b5, 0x080c, 0x64b3, 0x0904, 0x33b5, 0x2001, 0x1951,
-	0x2004, 0xd0fc, 0x1904, 0x3383, 0x0804, 0x4322, 0xa9a0, 0x2001,
-	0x1951, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4895, 0x01a0,
-	0x080c, 0x6660, 0x0118, 0x080c, 0x6668, 0x1170, 0x080c, 0x6330,
-	0x2009, 0x0002, 0x0128, 0x080c, 0x64b3, 0x1170, 0x2009, 0x0003,
-	0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-	0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1951,
-	0x2004, 0xd0fc, 0x1128, 0x080c, 0x538e, 0x0110, 0x9006, 0x0018,
-	0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904,
-	0x33b5, 0x798c, 0x2001, 0x1950, 0x918c, 0x8000, 0x2102, 0x080c,
-	0x4888, 0x0904, 0x33b8, 0x080c, 0x6660, 0x0120, 0x080c, 0x6668,
-	0x1904, 0x33b8, 0x080c, 0x6330, 0x0904, 0x33b5, 0x080c, 0x64a1,
-	0x0904, 0x33b5, 0x2001, 0x1950, 0x2004, 0xd0fc, 0x1904, 0x3383,
-	0x0804, 0x4322, 0xa9a0, 0x2001, 0x1950, 0x918c, 0x8000, 0xc18d,
-	0x2102, 0x080c, 0x4895, 0x01a0, 0x080c, 0x6660, 0x0118, 0x080c,
-	0x6668, 0x1170, 0x080c, 0x6330, 0x2009, 0x0002, 0x0128, 0x080c,
-	0x64a1, 0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010,
-	0xa897, 0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005,
-	0xa897, 0x4000, 0x2001, 0x1950, 0x2004, 0xd0fc, 0x1128, 0x080c,
-	0x538e, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001,
-	0x0000, 0x0005, 0x6100, 0x0804, 0x3383, 0x080c, 0x48a4, 0x0904,
-	0x33b8, 0x080c, 0x539a, 0x1904, 0x33b5, 0x79a8, 0xd184, 0x1158,
-	0xb834, 0x8007, 0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f,
-	0xba28, 0x8217, 0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007,
-	0x789a, 0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0200,
-	0x0804, 0x3383, 0x78a8, 0x909c, 0x0003, 0xd0b4, 0x1140, 0x939a,
-	0x0003, 0x1a04, 0x33b5, 0x6258, 0x7884, 0x9206, 0x1560, 0x2031,
-	0x1848, 0x2009, 0x013c, 0x2136, 0x2001, 0x1840, 0x2009, 0x000c,
-	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x0006, 0x78a8,
-	0x9084, 0x0080, 0x1118, 0x000e, 0x0804, 0x48bd, 0x000e, 0x2031,
-	0x0000, 0x2061, 0x18ae, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076,
-	0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c, 0x110c, 0x7007, 0x0002,
-	0x701f, 0x44db, 0x0005, 0x81ff, 0x1904, 0x33b5, 0x080c, 0x48a4,
-	0x0904, 0x33b8, 0x080c, 0x6660, 0x1904, 0x33b5, 0x00c6, 0x080c,
-	0x4871, 0x00ce, 0x0904, 0x33b5, 0xa867, 0x0000, 0xa868, 0xc0fd,
-	0xa86a, 0x7ea8, 0x080c, 0xb9a1, 0x0904, 0x33b5, 0x7007, 0x0003,
-	0x701f, 0x44df, 0x0005, 0x080c, 0x404d, 0x0804, 0x3383, 0xa830,
-	0x9086, 0x0100, 0x0904, 0x33b5, 0x8906, 0x8006, 0x8007, 0x90bc,
-	0x003f, 0x9084, 0xffc0, 0x9080, 0x001b, 0x2009, 0x000c, 0x7a8c,
-	0x7b88, 0x7c9c, 0x7d98, 0x0804, 0x48bd, 0x9006, 0x080c, 0x248d,
-	0x78a8, 0x9084, 0x00ff, 0x9086, 0x00ff, 0x0118, 0x81ff, 0x1904,
-	0x33b5, 0x080c, 0x70ac, 0x0110, 0x080c, 0x5c9a, 0x7888, 0x908a,
-	0x1000, 0x1a04, 0x33b8, 0x7984, 0x9186, 0x00ff, 0x0138, 0x9182,
-	0x007f, 0x1a04, 0x33b8, 0x2100, 0x080c, 0x2457, 0x0026, 0x00c6,
-	0x0126, 0x2091, 0x8000, 0x2061, 0x19d4, 0x601b, 0x0000, 0x601f,
-	0x0000, 0x6073, 0x0000, 0x6077, 0x0000, 0x080c, 0x70ac, 0x1158,
-	0x080c, 0x73ac, 0x080c, 0x5cd5, 0x9085, 0x0001, 0x080c, 0x70f3,
-	0x080c, 0x6fdd, 0x00f0, 0x080c, 0x98ad, 0x080c, 0x9b52, 0x080c,
-	0x98c9, 0x2061, 0x0100, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff,
-	0x810f, 0x9105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009,
-	0x196a, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5bc0, 0x080c,
-	0x81f5, 0x7984, 0x080c, 0x70ac, 0x1110, 0x2009, 0x00ff, 0x7a88,
-	0x080c, 0x4385, 0x012e, 0x00ce, 0x002e, 0x0804, 0x3383, 0x7984,
-	0x080c, 0x6209, 0x2b08, 0x1904, 0x33b8, 0x0804, 0x3383, 0x81ff,
-	0x0120, 0x2009, 0x0001, 0x0804, 0x33b5, 0x60d8, 0xd0ac, 0x1130,
-	0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x33b5, 0x080c, 0x4871,
-	0x1120, 0x2009, 0x0002, 0x0804, 0x33b5, 0x7984, 0x9192, 0x0021,
-	0x1a04, 0x33b8, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080,
-	0x0019, 0x702a, 0xaf60, 0x7736, 0x080c, 0x48ba, 0x701f, 0x4597,
-	0x7880, 0x9086, 0x006e, 0x0110, 0x701f, 0x4e3c, 0x0005, 0x2009,
-	0x0080, 0x080c, 0x6269, 0x1118, 0x080c, 0x6660, 0x0120, 0x2021,
-	0x400a, 0x0804, 0x3385, 0x00d6, 0x0096, 0xa964, 0xaa6c, 0xab70,
-	0xac74, 0xad78, 0xae7c, 0xa884, 0x90be, 0x0100, 0x0904, 0x4630,
-	0x90be, 0x0112, 0x0904, 0x4630, 0x90be, 0x0113, 0x0904, 0x4630,
-	0x90be, 0x0114, 0x0904, 0x4630, 0x90be, 0x0117, 0x0904, 0x4630,
-	0x90be, 0x011a, 0x0904, 0x4630, 0x90be, 0x011c, 0x0904, 0x4630,
-	0x90be, 0x0121, 0x0904, 0x4617, 0x90be, 0x0131, 0x0904, 0x4617,
-	0x90be, 0x0171, 0x0904, 0x4630, 0x90be, 0x0173, 0x0904, 0x4630,
-	0x90be, 0x01a1, 0x1128, 0xa894, 0x8007, 0xa896, 0x0804, 0x463b,
-	0x90be, 0x0212, 0x0904, 0x4624, 0x90be, 0x0213, 0x05e8, 0x90be,
-	0x0214, 0x0500, 0x90be, 0x0217, 0x0188, 0x90be, 0x021a, 0x1120,
-	0xa89c, 0x8007, 0xa89e, 0x04e0, 0x90be, 0x021f, 0x05c8, 0x90be,
-	0x0300, 0x05b0, 0x009e, 0x00de, 0x0804, 0x33b8, 0x7028, 0x9080,
-	0x0010, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0007,
-	0x080c, 0x4679, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0, 0x7034,
-	0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x4679, 0x00c8, 0x7028,
+	0x81ff, 0x0148, 0x080c, 0x2811, 0x1130, 0x9006, 0x080c, 0x276e,
+	0x9006, 0x080c, 0x2751, 0x7884, 0x9084, 0x0007, 0x0002, 0x3b72,
+	0x3b7b, 0x3b84, 0x3b6f, 0x3b6f, 0x3b6f, 0x3b6f, 0x3b6f, 0x012e,
+	0x0804, 0x33bf, 0x2009, 0x0114, 0x2104, 0x9085, 0x0800, 0x200a,
+	0x080c, 0x3d46, 0x00c0, 0x2009, 0x0114, 0x2104, 0x9085, 0x4000,
+	0x200a, 0x080c, 0x3d46, 0x0078, 0x080c, 0x70b7, 0x1128, 0x012e,
+	0x2009, 0x0016, 0x0804, 0x33bc, 0x81ff, 0x0128, 0x012e, 0x2021,
+	0x400b, 0x0804, 0x338c, 0x080c, 0x98c8, 0x0086, 0x0096, 0x00a6,
+	0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x080c, 0x389d, 0x2009,
+	0x0101, 0x210c, 0x0016, 0x7ec8, 0x7dcc, 0x9006, 0x2068, 0x2060,
+	0x2058, 0x080c, 0x3fe7, 0x080c, 0x3f37, 0x903e, 0x2720, 0x00f6,
+	0x00e6, 0x0086, 0x2940, 0x2071, 0x19b8, 0x2079, 0x0090, 0x00d6,
+	0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x68d4, 0x780e, 0x68d0,
+	0x780a, 0x00de, 0x2011, 0x0001, 0x080c, 0x3e98, 0x080c, 0x2819,
+	0x080c, 0x2819, 0x080c, 0x2819, 0x080c, 0x2819, 0x080c, 0x3e98,
+	0x008e, 0x00ee, 0x00fe, 0x080c, 0x3dc5, 0x2009, 0x9c40, 0x8109,
+	0x11b0, 0x080c, 0x3cfc, 0x2001, 0x0004, 0x200c, 0x918c, 0xfffd,
+	0x2102, 0x001e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae,
+	0x009e, 0x008e, 0x2009, 0x0017, 0x080c, 0x33bc, 0x0cf8, 0x2001,
+	0x020b, 0x2004, 0x9084, 0x0140, 0x1d10, 0x00f6, 0x2079, 0x0000,
+	0x7884, 0x00fe, 0xd0bc, 0x0178, 0x2001, 0x0201, 0x200c, 0x81ff,
+	0x0150, 0x080c, 0x3da3, 0x2d00, 0x9c05, 0x9b05, 0x0120, 0x080c,
+	0x3cfc, 0x0804, 0x3ca5, 0x080c, 0x3f0c, 0x080c, 0x3e30, 0x080c,
+	0x3d86, 0x080c, 0x3dbb, 0x00f6, 0x2079, 0x0100, 0x7824, 0xd0ac,
+	0x0130, 0x8b58, 0x080c, 0x3cfc, 0x00fe, 0x0804, 0x3ca5, 0x00fe,
+	0x080c, 0x3cf2, 0x1150, 0x8d68, 0x2001, 0x0032, 0x2602, 0x2001,
+	0x0033, 0x2502, 0x080c, 0x3cfc, 0x0080, 0x87ff, 0x0138, 0x2001,
+	0x0201, 0x2004, 0x9005, 0x1908, 0x8739, 0x0038, 0x2001, 0x1a3c,
+	0x2004, 0x9086, 0x0000, 0x1904, 0x3bf5, 0x2001, 0x032f, 0x2003,
+	0x00f6, 0x8631, 0x1208, 0x8529, 0x2500, 0x9605, 0x0904, 0x3ca5,
+	0x7884, 0xd0bc, 0x0128, 0x2d00, 0x9c05, 0x9b05, 0x1904, 0x3ca5,
+	0xa013, 0x0019, 0x2001, 0x032a, 0x2003, 0x0004, 0x7884, 0xd0ac,
+	0x1148, 0x2001, 0x1a3c, 0x2003, 0x0003, 0x2001, 0x032a, 0x2003,
+	0x0009, 0x0030, 0xa017, 0x0001, 0x78b4, 0x9005, 0x0108, 0xa016,
+	0x2800, 0xa05a, 0x2009, 0x0040, 0x080c, 0x2052, 0x2900, 0xa85a,
+	0xa813, 0x0019, 0x7884, 0xd0a4, 0x1180, 0xa817, 0x0000, 0x00c6,
+	0x20a9, 0x0004, 0x2061, 0x0090, 0x602b, 0x0008, 0x2001, 0x0203,
+	0x2004, 0x1f04, 0x3c7c, 0x00ce, 0x0030, 0xa817, 0x0001, 0x78b0,
+	0x9005, 0x0108, 0xa816, 0x00f6, 0x00c6, 0x2079, 0x0100, 0x2061,
+	0x0090, 0x7827, 0x0002, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
+	0x601a, 0x0006, 0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e,
+	0x78ca, 0x00ce, 0x00fe, 0x0804, 0x3baf, 0x001e, 0x00c6, 0x2001,
+	0x032a, 0x2003, 0x0004, 0x2061, 0x0100, 0x6027, 0x0002, 0x6106,
+	0x2011, 0x020d, 0x2013, 0x0020, 0x2001, 0x0004, 0x200c, 0x918c,
+	0xfffd, 0x2102, 0x080c, 0x12d6, 0x7884, 0x9084, 0x0003, 0x9086,
+	0x0002, 0x01b0, 0x2009, 0x0028, 0x080c, 0x2052, 0x2001, 0x0227,
+	0x200c, 0x2102, 0x6050, 0x9084, 0xb7ff, 0x080c, 0x28d4, 0x6052,
+	0x602f, 0x0000, 0x604b, 0xf7f7, 0x6043, 0x0090, 0x6043, 0x0010,
+	0x080c, 0x98e4, 0x00ce, 0x2d08, 0x2c10, 0x2b18, 0x2b00, 0x9c05,
+	0x9d05, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be, 0x00ae, 0x009e,
+	0x008e, 0x1118, 0x012e, 0x0804, 0x338a, 0x012e, 0x2021, 0x400c,
+	0x0804, 0x338c, 0x9085, 0x0001, 0x1d04, 0x3cfb, 0x2091, 0x6000,
+	0x8420, 0x9486, 0x0064, 0x0005, 0x2001, 0x0105, 0x2003, 0x0010,
+	0x2001, 0x032a, 0x2003, 0x0004, 0x2001, 0x1a3c, 0x2003, 0x0000,
+	0x0071, 0x2009, 0x0048, 0x080c, 0x2052, 0x2001, 0x0227, 0x2024,
+	0x2402, 0x2001, 0x0109, 0x2003, 0x4000, 0x9026, 0x0005, 0x00f6,
+	0x00e6, 0x2071, 0x19b8, 0x7054, 0x9086, 0x0000, 0x0520, 0x2079,
+	0x0090, 0x2009, 0x0206, 0x2104, 0x2009, 0x0203, 0x210c, 0x9106,
+	0x1120, 0x2009, 0x0040, 0x080c, 0x2052, 0x782c, 0xd0fc, 0x0d88,
+	0x080c, 0x3f0c, 0x7054, 0x9086, 0x0000, 0x1d58, 0x782b, 0x0004,
+	0x782c, 0xd0ac, 0x1de8, 0x2009, 0x0040, 0x080c, 0x2052, 0x782b,
+	0x0002, 0x7057, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079,
+	0x0100, 0x2001, 0x1817, 0x200c, 0x7932, 0x7936, 0x080c, 0x246d,
+	0x080c, 0x2890, 0x080c, 0x28d4, 0x784b, 0xf7f7, 0x7843, 0x0090,
+	0x7843, 0x0010, 0x7850, 0xc0e5, 0x7852, 0x2019, 0x61a8, 0x7820,
+	0xd09c, 0x0110, 0x8319, 0x1dd8, 0x7850, 0xc0e4, 0x7852, 0x2011,
+	0x0048, 0x080c, 0x286d, 0x7843, 0x0040, 0x2019, 0x01f4, 0xa001,
+	0xa001, 0x8319, 0x1de0, 0x2001, 0x0100, 0x080c, 0x2833, 0x2011,
+	0x0020, 0x080c, 0x286d, 0x7843, 0x0000, 0x9006, 0x080c, 0x2833,
+	0x2011, 0x0048, 0x080c, 0x286d, 0x00fe, 0x0005, 0x7884, 0xd0ac,
+	0x11c8, 0x00f6, 0x00e6, 0x2071, 0x1a3c, 0x2079, 0x0320, 0x2001,
+	0x0201, 0x2004, 0x9005, 0x0160, 0x7000, 0x9086, 0x0000, 0x1140,
+	0x0051, 0xd0bc, 0x0108, 0x8738, 0x7003, 0x0003, 0x782b, 0x0019,
+	0x00ee, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x0300, 0x78bc, 0x00fe,
+	0x908c, 0x0070, 0x0178, 0x2009, 0x0032, 0x260a, 0x2009, 0x0033,
+	0x250a, 0xd0b4, 0x0108, 0x8c60, 0xd0ac, 0x0108, 0x8d68, 0xd0a4,
+	0x0108, 0x8b58, 0x0005, 0x00f6, 0x2079, 0x0200, 0x781c, 0xd084,
+	0x0110, 0x7837, 0x0050, 0x00fe, 0x0005, 0x00e6, 0x2071, 0x0100,
+	0x2001, 0x197b, 0x2004, 0x70e2, 0x080c, 0x3ad7, 0x1188, 0x2001,
+	0x181f, 0x2004, 0x2009, 0x181e, 0x210c, 0x918c, 0x00ff, 0x706e,
+	0x716a, 0x7066, 0x918d, 0x3200, 0x7162, 0x7073, 0xe109, 0x0080,
+	0x702c, 0x9085, 0x0002, 0x702e, 0x2009, 0x1817, 0x210c, 0x716e,
+	0x7063, 0x0100, 0x7166, 0x719e, 0x706b, 0x0000, 0x7073, 0x0809,
+	0x7077, 0x0008, 0x7078, 0x9080, 0x0100, 0x707a, 0x7080, 0x8000,
+	0x7082, 0x7087, 0xaaaa, 0x9006, 0x708a, 0x708e, 0x707e, 0x70d6,
+	0x70ab, 0x0036, 0x70af, 0x95d5, 0x7014, 0x9084, 0x1984, 0x9085,
+	0x0092, 0x7016, 0x080c, 0x3f0c, 0x00f6, 0x2071, 0x1a3c, 0x2079,
+	0x0320, 0x00d6, 0x2069, 0x0000, 0x6884, 0xd0b4, 0x0120, 0x689c,
+	0x780e, 0x6898, 0x780a, 0x00de, 0x2009, 0x03e8, 0x8109, 0x1df0,
+	0x792c, 0xd1fc, 0x0110, 0x782b, 0x0004, 0x2011, 0x0011, 0x080c,
+	0x3e98, 0x2011, 0x0001, 0x080c, 0x3e98, 0x00fe, 0x00ee, 0x0005,
+	0x00f6, 0x00e6, 0x2071, 0x1a3c, 0x2079, 0x0320, 0x792c, 0xd1fc,
+	0x0904, 0x3e95, 0x782b, 0x0002, 0x9026, 0xd19c, 0x1904, 0x3e91,
+	0x7000, 0x0002, 0x3e95, 0x3e46, 0x3e76, 0x3e91, 0xd1bc, 0x1170,
+	0xd1dc, 0x1190, 0x8001, 0x7002, 0x2011, 0x0001, 0x080c, 0x3e98,
+	0x0904, 0x3e95, 0x080c, 0x3e98, 0x0804, 0x3e95, 0x00f6, 0x2079,
+	0x0300, 0x78bf, 0x0000, 0x00fe, 0x7810, 0x7914, 0x782b, 0x0004,
+	0x7812, 0x7916, 0x2001, 0x0201, 0x200c, 0x81ff, 0x0de8, 0x080c,
+	0x3da3, 0x2009, 0x0001, 0x00f6, 0x2079, 0x0300, 0x78b8, 0x00fe,
+	0xd0ec, 0x0110, 0x2009, 0x0011, 0x792a, 0x00f8, 0x8001, 0x7002,
+	0x9184, 0x0880, 0x1140, 0x782c, 0xd0fc, 0x1904, 0x3e3a, 0x2011,
+	0x0001, 0x00b1, 0x0090, 0xa010, 0x9092, 0x0004, 0x9086, 0x0015,
+	0x1120, 0xa000, 0xa05a, 0x2011, 0x0031, 0xa212, 0xd1dc, 0x1960,
+	0x0828, 0x782b, 0x0004, 0x7003, 0x0000, 0x00ee, 0x00fe, 0x0005,
+	0xa014, 0x9005, 0x0550, 0x8001, 0x0036, 0x0096, 0xa016, 0xa058,
+	0x2048, 0xa010, 0x2009, 0x0031, 0x911a, 0x831c, 0x831c, 0x938a,
+	0x0007, 0x1a0c, 0x0d65, 0x9398, 0x3ec6, 0x231d, 0x083f, 0x9080,
+	0x0004, 0x7a2a, 0x7100, 0x8108, 0x7102, 0x009e, 0x003e, 0x908a,
+	0x0035, 0x1140, 0x0096, 0xa058, 0x2048, 0xa804, 0xa05a, 0x2001,
+	0x0019, 0x009e, 0xa012, 0x9085, 0x0001, 0x0005, 0x3f03, 0x3efa,
+	0x3ef1, 0x3ee8, 0x3edf, 0x3ed6, 0x3ecd, 0xa964, 0x7902, 0xa968,
+	0x7906, 0xa96c, 0x7912, 0xa970, 0x7916, 0x0005, 0xa974, 0x7902,
+	0xa978, 0x7906, 0xa97c, 0x7912, 0xa980, 0x7916, 0x0005, 0xa984,
+	0x7902, 0xa988, 0x7906, 0xa98c, 0x7912, 0xa990, 0x7916, 0x0005,
+	0xa994, 0x7902, 0xa998, 0x7906, 0xa99c, 0x7912, 0xa9a0, 0x7916,
+	0x0005, 0xa9a4, 0x7902, 0xa9a8, 0x7906, 0xa9ac, 0x7912, 0xa9b0,
+	0x7916, 0x0005, 0xa9b4, 0x7902, 0xa9b8, 0x7906, 0xa9bc, 0x7912,
+	0xa9c0, 0x7916, 0x0005, 0xa9c4, 0x7902, 0xa9c8, 0x7906, 0xa9cc,
+	0x7912, 0xa9d0, 0x7916, 0x0005, 0x00f6, 0x00e6, 0x0086, 0x2071,
+	0x19b8, 0x2079, 0x0090, 0x792c, 0xd1fc, 0x01e8, 0x782b, 0x0002,
+	0x2940, 0x9026, 0x7054, 0x0002, 0x3f33, 0x3f1f, 0x3f2a, 0x8001,
+	0x7056, 0xd19c, 0x1180, 0x2011, 0x0001, 0x080c, 0x3e98, 0x190c,
+	0x3e98, 0x0048, 0x8001, 0x7056, 0x782c, 0xd0fc, 0x1d38, 0x2011,
+	0x0001, 0x080c, 0x3e98, 0x008e, 0x00ee, 0x00fe, 0x0005, 0x00f6,
+	0x00e6, 0x00c6, 0x0086, 0x2061, 0x0200, 0x2001, 0x197b, 0x2004,
+	0x601a, 0x2061, 0x0100, 0x2001, 0x197a, 0x2004, 0x60ce, 0x6104,
+	0xc1ac, 0x6106, 0x2001, 0x002c, 0x2004, 0x9005, 0x0520, 0x2038,
+	0x2001, 0x002e, 0x2024, 0x2001, 0x002f, 0x201c, 0x080c, 0x4878,
+	0xa813, 0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220,
+	0x2138, 0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858,
+	0x2048, 0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x3faf, 0x1d68,
+	0x2900, 0xa85a, 0x00d0, 0x080c, 0x4878, 0xa813, 0x0019, 0xa817,
+	0x0001, 0x2900, 0xa85a, 0x2001, 0x002e, 0x2004, 0xa866, 0x2001,
+	0x002f, 0x2004, 0xa86a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
+	0xa86e, 0x2001, 0x002b, 0x2004, 0xa872, 0x2061, 0x0090, 0x2079,
+	0x0100, 0x2001, 0x197a, 0x2004, 0x6036, 0x2009, 0x0040, 0x080c,
+	0x2052, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8, 0x601a, 0x0006,
+	0x2001, 0x002b, 0x2004, 0x601e, 0x78c6, 0x000e, 0x78ca, 0x9006,
+	0x600a, 0x600e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x00e6,
+	0x2071, 0x0080, 0xaa60, 0x22e8, 0x20a0, 0x20e1, 0x0000, 0x2099,
+	0x0088, 0x702b, 0x0026, 0x7402, 0x7306, 0x9006, 0x700a, 0x700e,
+	0x810b, 0x810b, 0x21a8, 0x810b, 0x7112, 0x702b, 0x0041, 0x702c,
+	0xd0fc, 0x0de8, 0x702b, 0x0002, 0x702b, 0x0040, 0x4005, 0x7400,
+	0x7304, 0x87ff, 0x0190, 0x0086, 0x0096, 0x2940, 0x0086, 0x080c,
+	0x4878, 0x008e, 0xa058, 0x00a6, 0x2050, 0x2900, 0xb006, 0xa05a,
+	0x00ae, 0x009e, 0x008e, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6,
+	0x2001, 0x002d, 0x2004, 0x9005, 0x0528, 0x2038, 0x2001, 0x0030,
+	0x2024, 0x2001, 0x0031, 0x201c, 0x080c, 0x4878, 0x2940, 0xa813,
+	0x0019, 0xaf16, 0x2900, 0xa85a, 0x978a, 0x0007, 0x0220, 0x2138,
+	0x2009, 0x0007, 0x0010, 0x2708, 0x903e, 0x0096, 0xa858, 0x2048,
+	0xa85c, 0x9080, 0x0019, 0x009e, 0x080c, 0x3faf, 0x1d68, 0x2900,
+	0xa85a, 0x00d8, 0x080c, 0x4878, 0x2940, 0xa013, 0x0019, 0xa017,
+	0x0001, 0x2800, 0xa05a, 0x2001, 0x0030, 0x2004, 0xa066, 0x2001,
+	0x0031, 0x2004, 0xa06a, 0x2001, 0x002a, 0x2004, 0x9084, 0xfff8,
+	0xa06e, 0x2001, 0x002b, 0x2004, 0xa072, 0x2001, 0x032a, 0x2003,
+	0x0004, 0x7884, 0xd0ac, 0x1180, 0x2001, 0x0101, 0x200c, 0x918d,
+	0x0200, 0x2102, 0xa017, 0x0000, 0x2001, 0x1a3c, 0x2003, 0x0003,
+	0x2001, 0x032a, 0x2003, 0x0009, 0x2001, 0x0300, 0x2003, 0x0000,
+	0x2001, 0x020d, 0x2003, 0x0000, 0x2001, 0x0004, 0x200c, 0x918d,
+	0x0002, 0x2102, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x20a9,
+	0x0013, 0x20a1, 0x1840, 0x20e9, 0x0001, 0x9006, 0x4004, 0x2009,
+	0x013c, 0x200a, 0x012e, 0x7880, 0x9086, 0x0052, 0x0108, 0x0005,
+	0x0804, 0x338a, 0x7d98, 0x7c9c, 0x0804, 0x3481, 0x080c, 0x70b7,
+	0x190c, 0x5ca1, 0x2069, 0x1853, 0x2d00, 0x2009, 0x0030, 0x7a8c,
+	0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x080c, 0x48c1, 0x701f,
+	0x4082, 0x0005, 0x080c, 0x539c, 0x1130, 0x3b00, 0x3a08, 0xc194,
+	0xc095, 0x20d8, 0x21d0, 0x2069, 0x1853, 0x6800, 0x9005, 0x0904,
+	0x33bf, 0x6804, 0xd094, 0x00c6, 0x2061, 0x0100, 0x6104, 0x0138,
+	0x6200, 0x9292, 0x0005, 0x0218, 0x918c, 0xffdf, 0x0010, 0x918d,
+	0x0020, 0x6106, 0x00ce, 0xd08c, 0x00c6, 0x2061, 0x0100, 0x6104,
+	0x0118, 0x918d, 0x0010, 0x0010, 0x918c, 0xffef, 0x6106, 0x00ce,
+	0xd084, 0x0158, 0x6a28, 0x928a, 0x007f, 0x1a04, 0x33bf, 0x9288,
+	0x318b, 0x210d, 0x918c, 0x00ff, 0x6162, 0xd0dc, 0x0130, 0x6828,
+	0x908a, 0x007f, 0x1a04, 0x33bf, 0x605a, 0x6888, 0x9084, 0x0030,
+	0x8004, 0x8004, 0x8004, 0x8004, 0x0006, 0x2009, 0x1982, 0x9080,
+	0x2560, 0x2005, 0x200a, 0x2008, 0x2001, 0x0018, 0x080c, 0x98b9,
+	0x2009, 0x0390, 0x200b, 0x0400, 0x000e, 0x2009, 0x1983, 0x9080,
+	0x2564, 0x2005, 0x200a, 0x6808, 0x908a, 0x0100, 0x0a04, 0x33bf,
+	0x908a, 0x0841, 0x1a04, 0x33bf, 0x9084, 0x0007, 0x1904, 0x33bf,
+	0x680c, 0x9005, 0x0904, 0x33bf, 0x6810, 0x9005, 0x0904, 0x33bf,
+	0x6848, 0x6940, 0x910a, 0x1a04, 0x33bf, 0x8001, 0x0904, 0x33bf,
+	0x684c, 0x6944, 0x910a, 0x1a04, 0x33bf, 0x8001, 0x0904, 0x33bf,
+	0x6814, 0x908c, 0x00ff, 0x614a, 0x8007, 0x9084, 0x00ff, 0x604e,
+	0x080c, 0x73e8, 0x080c, 0x6734, 0x080c, 0x6769, 0x6808, 0x602a,
+	0x080c, 0x1fc4, 0x2009, 0x0170, 0x200b, 0x0080, 0xa001, 0xa001,
+	0x200b, 0x0000, 0x0036, 0x6b08, 0x080c, 0x24c7, 0x003e, 0x6000,
+	0x9086, 0x0000, 0x1904, 0x41ee, 0x6818, 0x691c, 0x6a20, 0x6b24,
+	0x8007, 0x810f, 0x8217, 0x831f, 0x6016, 0x611a, 0x621e, 0x6322,
+	0x6c04, 0xd4f4, 0x0148, 0x6830, 0x6934, 0x6a38, 0x6b3c, 0x8007,
+	0x810f, 0x8217, 0x831f, 0x0010, 0x9084, 0xf0ff, 0x6006, 0x610a,
+	0x620e, 0x6312, 0x8007, 0x810f, 0x8217, 0x831f, 0x20a9, 0x0004,
+	0x20a1, 0x1984, 0x20e9, 0x0001, 0x4001, 0x20a9, 0x0004, 0x20a1,
+	0x199e, 0x20e9, 0x0001, 0x4001, 0x080c, 0x82d0, 0x00c6, 0x900e,
+	0x20a9, 0x0001, 0x6b70, 0xd384, 0x01c8, 0x0020, 0x839d, 0x12b0,
+	0x3508, 0x8109, 0x080c, 0x79be, 0x6878, 0x6016, 0x6874, 0x2008,
+	0x9084, 0xff00, 0x8007, 0x600a, 0x9184, 0x00ff, 0x6006, 0x8108,
+	0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001, 0x1f04, 0x4166,
+	0x00ce, 0x00c6, 0x2061, 0x196d, 0x2063, 0x0001, 0x9006, 0x080c,
+	0x276e, 0x9006, 0x080c, 0x2751, 0x0000, 0x00ce, 0x00e6, 0x2c70,
+	0x080c, 0x0e9c, 0x00ee, 0x6888, 0xd0ec, 0x0130, 0x2011, 0x0114,
+	0x2204, 0x9085, 0x0180, 0x2012, 0x6a80, 0x9284, 0x0030, 0x9086,
+	0x0030, 0x1128, 0x9294, 0xffcf, 0x9295, 0x0020, 0x6a82, 0x2001,
+	0x194d, 0x6a80, 0x9294, 0x0030, 0x928e, 0x0000, 0x0170, 0x928e,
+	0x0010, 0x0118, 0x928e, 0x0020, 0x0140, 0x2003, 0xaaaa, 0x080c,
+	0x253c, 0x2001, 0x193e, 0x2102, 0x0008, 0x2102, 0x00c6, 0x2061,
+	0x0100, 0x602f, 0x0040, 0x602f, 0x0000, 0x00ce, 0x080c, 0x70b7,
+	0x0128, 0x080c, 0x4c91, 0x0110, 0x080c, 0x248d, 0x60d0, 0x9005,
+	0x01c0, 0x6003, 0x0001, 0x2009, 0x41d6, 0x00d0, 0x080c, 0x70b7,
+	0x1168, 0x2011, 0x6f2d, 0x080c, 0x8159, 0x2011, 0x6f20, 0x080c,
+	0x825f, 0x080c, 0x73bc, 0x080c, 0x6fe8, 0x0040, 0x080c, 0x5b97,
+	0x0028, 0x6003, 0x0004, 0x2009, 0x41ee, 0x0010, 0x0804, 0x338a,
+	0x2001, 0x0170, 0x2004, 0x9084, 0x00ff, 0x9086, 0x004c, 0x1118,
+	0x2091, 0x31bd, 0x0817, 0x2091, 0x313d, 0x0817, 0x6000, 0x9086,
+	0x0000, 0x0904, 0x33bc, 0x2069, 0x1853, 0x7890, 0x6842, 0x7894,
+	0x6846, 0x2d00, 0x2009, 0x0030, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
+	0x2039, 0x0001, 0x0804, 0x48c4, 0x9006, 0x080c, 0x248d, 0x81ff,
+	0x1904, 0x33bc, 0x080c, 0x70b7, 0x11b0, 0x080c, 0x73b7, 0x080c,
+	0x5cdc, 0x080c, 0x3186, 0x0118, 0x6130, 0xc18d, 0x6132, 0x080c,
+	0xbf61, 0x0130, 0x080c, 0x70da, 0x1118, 0x080c, 0x708b, 0x0038,
+	0x080c, 0x6fe8, 0x0020, 0x080c, 0x5ca1, 0x080c, 0x5b97, 0x0804,
+	0x338a, 0x81ff, 0x1904, 0x33bc, 0x080c, 0x70b7, 0x1110, 0x0804,
+	0x33bc, 0x6190, 0x81ff, 0x01a8, 0x704f, 0x0000, 0x2001, 0x1d80,
+	0x2009, 0x0040, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x0126, 0x2091,
+	0x8000, 0x2039, 0x0001, 0x080c, 0x48c4, 0x701f, 0x3388, 0x012e,
+	0x0005, 0x704f, 0x0001, 0x00d6, 0x2069, 0x1d80, 0x20a9, 0x0040,
+	0x20e9, 0x0001, 0x20a1, 0x1d80, 0x2019, 0xffff, 0x4304, 0x6558,
+	0x9588, 0x318b, 0x210d, 0x918c, 0x00ff, 0x216a, 0x900e, 0x2011,
+	0x0002, 0x2100, 0x9506, 0x01a8, 0x080c, 0x6270, 0x1190, 0xb814,
+	0x821c, 0x0238, 0x9398, 0x1d80, 0x9085, 0xff00, 0x8007, 0x201a,
+	0x0038, 0x9398, 0x1d80, 0x2324, 0x94a4, 0xff00, 0x9405, 0x201a,
+	0x8210, 0x8108, 0x9182, 0x0080, 0x1208, 0x0c18, 0x8201, 0x8007,
+	0x2d0c, 0x9105, 0x206a, 0x00de, 0x20a9, 0x0040, 0x20a1, 0x1d80,
+	0x2099, 0x1d80, 0x080c, 0x5c2c, 0x0804, 0x4246, 0x080c, 0x48ab,
+	0x0904, 0x33bf, 0x080c, 0x4878, 0x1120, 0x2009, 0x0002, 0x0804,
+	0x33bc, 0x080c, 0x538d, 0xd0b4, 0x0558, 0x7884, 0x908e, 0x007e,
+	0x0538, 0x908e, 0x007f, 0x0520, 0x908e, 0x0080, 0x0508, 0x080c,
+	0x3181, 0x1148, 0xb800, 0xd08c, 0x11d8, 0xb804, 0x9084, 0x00ff,
+	0x9086, 0x0006, 0x11a8, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
+	0x080c, 0xba16, 0x1120, 0x2009, 0x0003, 0x0804, 0x33bc, 0x7007,
+	0x0003, 0x701f, 0x42d4, 0x0005, 0x080c, 0x48ab, 0x0904, 0x33bf,
+	0x20a9, 0x002b, 0xb8b4, 0x20e0, 0xb8b8, 0x2098, 0xa860, 0x20e8,
+	0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080,
+	0x0006, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098,
+	0x080c, 0x0f9f, 0x0070, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x000a,
+	0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x000a, 0x2098, 0x080c,
+	0x0f9f, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
+	0x9080, 0x0002, 0x2009, 0x002b, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
+	0x0804, 0x48c4, 0x81ff, 0x1904, 0x33bc, 0x080c, 0x488f, 0x0904,
+	0x33bf, 0x080c, 0x64b1, 0x0904, 0x33bc, 0x0058, 0xa878, 0x9005,
+	0x0120, 0x2009, 0x0004, 0x0804, 0x33bc, 0xa974, 0xaa94, 0x0804,
+	0x338a, 0x080c, 0x5395, 0x0904, 0x338a, 0x701f, 0x431e, 0x7007,
+	0x0003, 0x0005, 0x81ff, 0x1904, 0x33bc, 0x7888, 0x908a, 0x1000,
+	0x1a04, 0x33bf, 0x080c, 0x48ab, 0x0904, 0x33bf, 0x080c, 0x6667,
+	0x0120, 0x080c, 0x666f, 0x1904, 0x33bf, 0x080c, 0x6536, 0x0904,
+	0x33bc, 0x2019, 0x0004, 0x900e, 0x080c, 0x64c3, 0x0904, 0x33bc,
+	0x7984, 0x7a88, 0x04c9, 0x08a8, 0xa89c, 0x908a, 0x1000, 0x12f8,
+	0x080c, 0x48a9, 0x01e0, 0x080c, 0x6667, 0x0118, 0x080c, 0x666f,
+	0x11b0, 0x080c, 0x6536, 0x2009, 0x0002, 0x0168, 0x2009, 0x0002,
+	0x2019, 0x0004, 0x080c, 0x64c3, 0x2009, 0x0003, 0x0120, 0xa998,
+	0xaa9c, 0x00d1, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
+	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
+	0x4000, 0x080c, 0x5395, 0x0110, 0x9006, 0x0018, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0000, 0x0005, 0x9186, 0x00ff, 0x0110, 0x0071,
+	0x0060, 0x2029, 0x007e, 0x2061, 0x1800, 0x6458, 0x2400, 0x9506,
+	0x0110, 0x2508, 0x0019, 0x8529, 0x1ec8, 0x0005, 0x080c, 0x6270,
+	0x1138, 0x2200, 0x8003, 0x800b, 0x810b, 0x9108, 0x080c, 0x8167,
+	0x0005, 0x81ff, 0x1904, 0x33bc, 0x798c, 0x2001, 0x1951, 0x918c,
+	0x8000, 0x2102, 0x080c, 0x488f, 0x0904, 0x33bf, 0x080c, 0x6667,
+	0x0120, 0x080c, 0x666f, 0x1904, 0x33bf, 0x080c, 0x6337, 0x0904,
+	0x33bc, 0x080c, 0x64ba, 0x0904, 0x33bc, 0x2001, 0x1951, 0x2004,
+	0xd0fc, 0x1904, 0x338a, 0x0804, 0x4329, 0xa9a0, 0x2001, 0x1951,
+	0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x489c, 0x01a0, 0x080c,
+	0x6667, 0x0118, 0x080c, 0x666f, 0x1170, 0x080c, 0x6337, 0x2009,
+	0x0002, 0x0128, 0x080c, 0x64ba, 0x1170, 0x2009, 0x0003, 0xa897,
+	0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001,
+	0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x1951, 0x2004,
+	0xd0fc, 0x1128, 0x080c, 0x5395, 0x0110, 0x9006, 0x0018, 0x900e,
+	0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x81ff, 0x1904, 0x33bc,
+	0x798c, 0x2001, 0x1950, 0x918c, 0x8000, 0x2102, 0x080c, 0x488f,
+	0x0904, 0x33bf, 0x080c, 0x6667, 0x0120, 0x080c, 0x666f, 0x1904,
+	0x33bf, 0x080c, 0x6337, 0x0904, 0x33bc, 0x080c, 0x64a8, 0x0904,
+	0x33bc, 0x2001, 0x1950, 0x2004, 0xd0fc, 0x1904, 0x338a, 0x0804,
+	0x4329, 0xa9a0, 0x2001, 0x1950, 0x918c, 0x8000, 0xc18d, 0x2102,
+	0x080c, 0x489c, 0x01a0, 0x080c, 0x6667, 0x0118, 0x080c, 0x666f,
+	0x1170, 0x080c, 0x6337, 0x2009, 0x0002, 0x0128, 0x080c, 0x64a8,
+	0x1170, 0x2009, 0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897,
+	0x4006, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897,
+	0x4000, 0x2001, 0x1950, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x5395,
+	0x0110, 0x9006, 0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000,
+	0x0005, 0x6100, 0x0804, 0x338a, 0x080c, 0x48ab, 0x0904, 0x33bf,
+	0x080c, 0x53a1, 0x1904, 0x33bc, 0x79a8, 0xd184, 0x1158, 0xb834,
+	0x8007, 0x789e, 0xb830, 0x8007, 0x789a, 0xbb2c, 0x831f, 0xba28,
+	0x8217, 0x0050, 0xb824, 0x8007, 0x789e, 0xb820, 0x8007, 0x789a,
+	0xbb1c, 0x831f, 0xba18, 0x8217, 0xb900, 0x918c, 0x0200, 0x0804,
+	0x338a, 0x78a8, 0x909c, 0x0003, 0xd0b4, 0x1140, 0x939a, 0x0003,
+	0x1a04, 0x33bc, 0x6258, 0x7884, 0x9206, 0x1560, 0x2031, 0x1848,
+	0x2009, 0x013c, 0x2136, 0x2001, 0x1840, 0x2009, 0x000c, 0x7a8c,
+	0x7b88, 0x7c9c, 0x7d98, 0x2039, 0x0001, 0x0006, 0x78a8, 0x9084,
+	0x0080, 0x1118, 0x000e, 0x0804, 0x48c4, 0x000e, 0x2031, 0x0000,
+	0x2061, 0x18ae, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e,
+	0xa392, 0xa496, 0xa59a, 0x080c, 0x110c, 0x7007, 0x0002, 0x701f,
+	0x44e2, 0x0005, 0x81ff, 0x1904, 0x33bc, 0x080c, 0x48ab, 0x0904,
+	0x33bf, 0x080c, 0x6667, 0x1904, 0x33bc, 0x00c6, 0x080c, 0x4878,
+	0x00ce, 0x0904, 0x33bc, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
+	0x7ea8, 0x080c, 0xb9bc, 0x0904, 0x33bc, 0x7007, 0x0003, 0x701f,
+	0x44e6, 0x0005, 0x080c, 0x4054, 0x0804, 0x338a, 0xa830, 0x9086,
+	0x0100, 0x0904, 0x33bc, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f,
+	0x9084, 0xffc0, 0x9080, 0x001b, 0x2009, 0x000c, 0x7a8c, 0x7b88,
+	0x7c9c, 0x7d98, 0x0804, 0x48c4, 0x9006, 0x080c, 0x248d, 0x78a8,
+	0x9084, 0x00ff, 0x9086, 0x00ff, 0x0118, 0x81ff, 0x1904, 0x33bc,
+	0x080c, 0x70b7, 0x0110, 0x080c, 0x5ca1, 0x7888, 0x908a, 0x1000,
+	0x1a04, 0x33bf, 0x7984, 0x9186, 0x00ff, 0x0138, 0x9182, 0x007f,
+	0x1a04, 0x33bf, 0x2100, 0x080c, 0x2457, 0x0026, 0x00c6, 0x0126,
+	0x2091, 0x8000, 0x2061, 0x19d4, 0x601b, 0x0000, 0x601f, 0x0000,
+	0x6073, 0x0000, 0x6077, 0x0000, 0x080c, 0x70b7, 0x1158, 0x080c,
+	0x73b7, 0x080c, 0x5cdc, 0x9085, 0x0001, 0x080c, 0x70fe, 0x080c,
+	0x6fe8, 0x00f0, 0x080c, 0x98c8, 0x080c, 0x9b6d, 0x080c, 0x98e4,
+	0x2061, 0x0100, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff, 0x810f,
+	0x9105, 0x604a, 0x6043, 0x0090, 0x6043, 0x0010, 0x2009, 0x196a,
+	0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5bc7, 0x080c, 0x821d,
+	0x7984, 0x080c, 0x70b7, 0x1110, 0x2009, 0x00ff, 0x7a88, 0x080c,
+	0x438c, 0x012e, 0x00ce, 0x002e, 0x0804, 0x338a, 0x7984, 0x080c,
+	0x6210, 0x2b08, 0x1904, 0x33bf, 0x0804, 0x338a, 0x81ff, 0x0120,
+	0x2009, 0x0001, 0x0804, 0x33bc, 0x60d8, 0xd0ac, 0x1130, 0xd09c,
+	0x1120, 0x2009, 0x0005, 0x0804, 0x33bc, 0x080c, 0x4878, 0x1120,
+	0x2009, 0x0002, 0x0804, 0x33bc, 0x7984, 0x9192, 0x0021, 0x1a04,
+	0x33bf, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019,
+	0x702a, 0xaf60, 0x7736, 0x080c, 0x48c1, 0x701f, 0x459e, 0x7880,
+	0x9086, 0x006e, 0x0110, 0x701f, 0x4e43, 0x0005, 0x2009, 0x0080,
+	0x080c, 0x6270, 0x1118, 0x080c, 0x6667, 0x0120, 0x2021, 0x400a,
+	0x0804, 0x338c, 0x00d6, 0x0096, 0xa964, 0xaa6c, 0xab70, 0xac74,
+	0xad78, 0xae7c, 0xa884, 0x90be, 0x0100, 0x0904, 0x4637, 0x90be,
+	0x0112, 0x0904, 0x4637, 0x90be, 0x0113, 0x0904, 0x4637, 0x90be,
+	0x0114, 0x0904, 0x4637, 0x90be, 0x0117, 0x0904, 0x4637, 0x90be,
+	0x011a, 0x0904, 0x4637, 0x90be, 0x011c, 0x0904, 0x4637, 0x90be,
+	0x0121, 0x0904, 0x461e, 0x90be, 0x0131, 0x0904, 0x461e, 0x90be,
+	0x0171, 0x0904, 0x4637, 0x90be, 0x0173, 0x0904, 0x4637, 0x90be,
+	0x01a1, 0x1128, 0xa894, 0x8007, 0xa896, 0x0804, 0x4642, 0x90be,
+	0x0212, 0x0904, 0x462b, 0x90be, 0x0213, 0x05e8, 0x90be, 0x0214,
+	0x0500, 0x90be, 0x0217, 0x0188, 0x90be, 0x021a, 0x1120, 0xa89c,
+	0x8007, 0xa89e, 0x04e0, 0x90be, 0x021f, 0x05c8, 0x90be, 0x0300,
+	0x05b0, 0x009e, 0x00de, 0x0804, 0x33bf, 0x7028, 0x9080, 0x0010,
+	0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0007, 0x080c,
+	0x4680, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0, 0x7034, 0x20e0,
+	0x20e8, 0x20a9, 0x0001, 0x080c, 0x4680, 0x00c8, 0x7028, 0x9080,
+	0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001,
+	0x080c, 0x468d, 0x00b8, 0x7028, 0x9080, 0x000e, 0x2098, 0x20a0,
+	0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x468d, 0x7028,
 	0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9,
-	0x0001, 0x080c, 0x4686, 0x00b8, 0x7028, 0x9080, 0x000e, 0x2098,
-	0x20a0, 0x7034, 0x20e0, 0x20e8, 0x20a9, 0x0001, 0x080c, 0x4686,
-	0x7028, 0x9080, 0x000c, 0x2098, 0x20a0, 0x7034, 0x20e0, 0x20e8,
-	0x20a9, 0x0001, 0x04f1, 0x00c6, 0x080c, 0x4871, 0x0550, 0xa868,
-	0xc0fd, 0xa86a, 0xa867, 0x0119, 0x9006, 0xa882, 0xa87f, 0x0020,
-	0xa88b, 0x0001, 0x810b, 0xa9ae, 0xa8b2, 0xaab6, 0xabba, 0xacbe,
-	0xadc2, 0xa9c6, 0xa8ca, 0x00ce, 0x009e, 0x00de, 0xa866, 0xa822,
-	0xa868, 0xc0fd, 0xa86a, 0xa804, 0x2048, 0x080c, 0xb9bc, 0x1120,
-	0x2009, 0x0003, 0x0804, 0x33b5, 0x7007, 0x0003, 0x701f, 0x4670,
-	0x0005, 0x00ce, 0x009e, 0x00de, 0x2009, 0x0002, 0x0804, 0x33b5,
-	0xa820, 0x9086, 0x8001, 0x1904, 0x3383, 0x2009, 0x0004, 0x0804,
-	0x33b5, 0x0016, 0x0026, 0x3510, 0x20a9, 0x0002, 0x4002, 0x4104,
-	0x4004, 0x8211, 0x1dc8, 0x002e, 0x001e, 0x0005, 0x0016, 0x0026,
-	0x0036, 0x0046, 0x3520, 0x20a9, 0x0004, 0x4002, 0x4304, 0x4204,
-	0x4104, 0x4004, 0x8421, 0x1db8, 0x004e, 0x003e, 0x002e, 0x001e,
-	0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x33b5, 0x60d8,
-	0xd0ac, 0x1160, 0xd09c, 0x0120, 0x2009, 0x0016, 0x0804, 0x33b5,
-	0xd09c, 0x1120, 0x2009, 0x0005, 0x0804, 0x33b5, 0x7984, 0x78a8,
-	0x2040, 0x080c, 0x9b4b, 0x1120, 0x9182, 0x007f, 0x0a04, 0x33b8,
-	0x9186, 0x00ff, 0x0904, 0x33b8, 0x9182, 0x0800, 0x1a04, 0x33b8,
-	0x7a8c, 0x7b88, 0x6078, 0x9306, 0x1140, 0x607c, 0x924e, 0x0904,
-	0x33b8, 0x99cc, 0xff00, 0x0904, 0x33b8, 0x0126, 0x2091, 0x8000,
-	0x0026, 0x2011, 0x8008, 0x080c, 0x6684, 0x002e, 0x0140, 0x918d,
-	0x8000, 0x080c, 0x66ce, 0x1118, 0x2001, 0x4009, 0x0458, 0x080c,
-	0x478b, 0x0560, 0x90c6, 0x4000, 0x1170, 0x00c6, 0x0006, 0x900e,
-	0x080c, 0x6558, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
-	0x000e, 0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x0090,
-	0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0060, 0x90c6, 0x4009,
-	0x1108, 0x0040, 0x90c6, 0x4006, 0x1108, 0x0020, 0x2001, 0x4005,
-	0x2009, 0x000a, 0x2020, 0x012e, 0x0804, 0x3385, 0x2b00, 0x7026,
-	0x0016, 0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c, 0x9c3d, 0x0904,
-	0x4758, 0x2b00, 0x6012, 0x080c, 0xbcc0, 0x2e58, 0x00ee, 0x00e6,
-	0x00c6, 0x080c, 0x4871, 0x00ce, 0x2b70, 0x1158, 0x080c, 0x9bcc,
-	0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x2009, 0x0002, 0x0804,
-	0x33b5, 0x900e, 0xa966, 0xa96a, 0x2900, 0x6016, 0xa932, 0xa868,
-	0xc0fd, 0xd88c, 0x0108, 0xc0f5, 0xa86a, 0x080c, 0x3003, 0x6023,
-	0x0001, 0x9006, 0x080c, 0x61a6, 0x2001, 0x0002, 0x080c, 0x61ba,
-	0x2009, 0x0002, 0x080c, 0x9c6a, 0x78a8, 0xd094, 0x0138, 0x00ee,
-	0x7024, 0x00e6, 0x2058, 0xb8c4, 0xc08d, 0xb8c6, 0x9085, 0x0001,
-	0x00ee, 0x00ce, 0x00be, 0x001e, 0x012e, 0x1120, 0x2009, 0x0003,
-	0x0804, 0x33b5, 0x7007, 0x0003, 0x701f, 0x4767, 0x0005, 0xa830,
-	0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x3385,
-	0x9086, 0x0100, 0x7024, 0x2058, 0x1138, 0x2009, 0x0004, 0xba04,
-	0x9294, 0x00ff, 0x0804, 0x52e3, 0x900e, 0xa868, 0xd0f4, 0x1904,
-	0x3383, 0x080c, 0x6558, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0x0804, 0x3383, 0x00e6, 0x00d6, 0x0096, 0x83ff, 0x0904,
-	0x47d3, 0x902e, 0x080c, 0x9b4b, 0x0130, 0x9026, 0x20a9, 0x0800,
-	0x2071, 0x1000, 0x0030, 0x2021, 0x007f, 0x20a9, 0x0781, 0x2071,
-	0x107f, 0x2e04, 0x9005, 0x11b0, 0x2100, 0x9406, 0x15e8, 0x2428,
-	0x94ce, 0x007f, 0x1120, 0x92ce, 0xfffd, 0x1528, 0x0030, 0x94ce,
-	0x0080, 0x1130, 0x92ce, 0xfffc, 0x11f0, 0x93ce, 0x00ff, 0x11d8,
-	0xc5fd, 0x0450, 0x2058, 0xbf10, 0x2700, 0x9306, 0x11b8, 0xbe14,
-	0x2600, 0x9206, 0x1198, 0x2400, 0x9106, 0x1150, 0xd884, 0x0568,
-	0xd894, 0x1558, 0x080c, 0x6660, 0x1540, 0x2001, 0x4000, 0x0430,
-	0x2001, 0x4007, 0x0418, 0x2001, 0x4006, 0x0400, 0x2400, 0x9106,
-	0x1158, 0xbe14, 0x87ff, 0x1128, 0x86ff, 0x0948, 0x080c, 0x9b4b,
-	0x1930, 0x2001, 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04, 0x47a1,
-	0x85ff, 0x1130, 0x2001, 0x4009, 0x0048, 0x2001, 0x0001, 0x0030,
-	0x080c, 0x6209, 0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005, 0x009e,
-	0x00de, 0x00ee, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
-	0x33b5, 0x080c, 0x4871, 0x1120, 0x2009, 0x0002, 0x0804, 0x33b5,
-	0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005, 0x0904,
-	0x33b8, 0x9096, 0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04, 0x33b8,
-	0x2010, 0x2918, 0x080c, 0x2f9d, 0x1120, 0x2009, 0x0003, 0x0804,
-	0x33b5, 0x7007, 0x0003, 0x701f, 0x4826, 0x0005, 0xa830, 0x9086,
-	0x0100, 0x1904, 0x3383, 0x2009, 0x0004, 0x0804, 0x33b5, 0x7984,
-	0x080c, 0x9b4b, 0x1120, 0x9182, 0x007f, 0x0a04, 0x33b8, 0x9186,
-	0x00ff, 0x0904, 0x33b8, 0x9182, 0x0800, 0x1a04, 0x33b8, 0x2001,
-	0x9000, 0x080c, 0x533e, 0x1904, 0x33b5, 0x0804, 0x3383, 0xa998,
-	0x080c, 0x9b4b, 0x1118, 0x9182, 0x007f, 0x0280, 0x9186, 0x00ff,
-	0x0168, 0x9182, 0x0800, 0x1250, 0x2001, 0x9000, 0x080c, 0x533e,
-	0x11a8, 0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006,
-	0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000,
-	0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x2009, 0x000a,
-	0x0c48, 0x080c, 0x1022, 0x0198, 0x9006, 0xa802, 0x7014, 0x9005,
-	0x1120, 0x2900, 0x7016, 0x701a, 0x0040, 0x7018, 0xa802, 0x0086,
-	0x2040, 0x2900, 0xa006, 0x701a, 0x008e, 0x9085, 0x0001, 0x0005,
-	0x7984, 0x080c, 0x6269, 0x1130, 0x7e88, 0x9684, 0x3fff, 0x9082,
-	0x4000, 0x0208, 0x905e, 0x8bff, 0x0005, 0xa998, 0x080c, 0x6269,
-	0x1130, 0xae9c, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e,
-	0x8bff, 0x0005, 0xae98, 0x0008, 0x7e84, 0x2608, 0x080c, 0x6269,
-	0x1108, 0x0008, 0x905e, 0x8bff, 0x0005, 0x0016, 0x7114, 0x81ff,
-	0x0128, 0x2148, 0xa904, 0x080c, 0x1054, 0x0cc8, 0x7116, 0x711a,
-	0x001e, 0x0005, 0x2031, 0x0001, 0x0010, 0x2031, 0x0000, 0x2061,
-	0x18ae, 0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392,
-	0xa496, 0xa59a, 0x080c, 0x110c, 0x7007, 0x0002, 0x701f, 0x3383,
-	0x0005, 0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0000, 0x2001,
-	0x18a6, 0x2004, 0x9005, 0x1190, 0x0e04, 0x48ee, 0x7a36, 0x7833,
-	0x0012, 0x7a82, 0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001, 0x0089,
-	0x2004, 0xd084, 0x190c, 0x11be, 0x0804, 0x4954, 0x0016, 0x0086,
-	0x0096, 0x00c6, 0x00e6, 0x2071, 0x1894, 0x7044, 0x9005, 0x1540,
-	0x7148, 0x9182, 0x0010, 0x0288, 0x7038, 0x2060, 0x080c, 0x1022,
-	0x0904, 0x494c, 0xa84b, 0x0000, 0x2900, 0x7046, 0x2001, 0x0002,
-	0x9080, 0x1cf7, 0x2005, 0xa846, 0x0098, 0x7038, 0x90e0, 0x0004,
-	0x2001, 0x18b0, 0x9c82, 0x18f0, 0x0210, 0x2061, 0x18b0, 0x2c00,
-	0x703a, 0x7148, 0x81ff, 0x1108, 0x703e, 0x8108, 0x714a, 0x0460,
-	0x7148, 0x8108, 0x714a, 0x7044, 0x2040, 0xa144, 0x2105, 0x0016,
-	0x908a, 0x0036, 0x1a0c, 0x0d65, 0x2060, 0x001e, 0x8108, 0x2105,
-	0x9005, 0xa146, 0x1520, 0x080c, 0x1022, 0x1130, 0x8109, 0xa946,
-	0x7148, 0x8109, 0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a, 0xa046,
-	0x2800, 0xa802, 0x2900, 0xa006, 0x7046, 0x2001, 0x0002, 0x9080,
-	0x1cf7, 0x2005, 0xa846, 0x0058, 0x2262, 0x6306, 0x640a, 0x00ee,
-	0x00ce, 0x009e, 0x008e, 0x001e, 0x012e, 0x00fe, 0x0005, 0x2c00,
-	0x9082, 0x001b, 0x0002, 0x4976, 0x4976, 0x4978, 0x4976, 0x4976,
-	0x4976, 0x497c, 0x4976, 0x4976, 0x4976, 0x4980, 0x4976, 0x4976,
-	0x4976, 0x4984, 0x4976, 0x4976, 0x4976, 0x4988, 0x4976, 0x4976,
-	0x4976, 0x498c, 0x4976, 0x4976, 0x4976, 0x4991, 0x080c, 0x0d65,
-	0xa276, 0xa37a, 0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e, 0x0878,
-	0xa296, 0xa39a, 0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae, 0x0838,
-	0xa2b6, 0xa3ba, 0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce, 0x0804,
-	0x494f, 0xa2d6, 0xa3da, 0xa4de, 0x0804, 0x494f, 0x00e6, 0x2071,
-	0x1894, 0x7048, 0x9005, 0x0904, 0x4a28, 0x0126, 0x2091, 0x8000,
-	0x0e04, 0x4a27, 0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096, 0x0086,
-	0x0076, 0x9006, 0x2038, 0x7040, 0x2048, 0x9005, 0x0500, 0xa948,
-	0x2105, 0x0016, 0x908a, 0x0036, 0x1a0c, 0x0d65, 0x2060, 0x001e,
-	0x8108, 0x2105, 0x9005, 0xa94a, 0x1904, 0x4a2a, 0xa804, 0x9005,
-	0x090c, 0x0d65, 0x7042, 0x2938, 0x2040, 0xa003, 0x0000, 0x2001,
-	0x0002, 0x9080, 0x1cf7, 0x2005, 0xa04a, 0x0804, 0x4a2a, 0x703c,
-	0x2060, 0x2c14, 0x6304, 0x6408, 0x650c, 0x2200, 0x7836, 0x7833,
-	0x0012, 0x7882, 0x2300, 0x7886, 0x2400, 0x788a, 0x2091, 0x4080,
-	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x87ff, 0x0118,
-	0x2748, 0x080c, 0x1054, 0x7048, 0x8001, 0x704a, 0x9005, 0x1170,
-	0x7040, 0x2048, 0x9005, 0x0128, 0x080c, 0x1054, 0x9006, 0x7042,
-	0x7046, 0x703b, 0x18b0, 0x703f, 0x18b0, 0x0420, 0x7040, 0x9005,
-	0x1508, 0x7238, 0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004, 0x90fa,
-	0x18f0, 0x0210, 0x2001, 0x18b0, 0x703e, 0x00a0, 0x9006, 0x703e,
-	0x703a, 0x7044, 0x9005, 0x090c, 0x0d65, 0x2048, 0xa800, 0x9005,
-	0x1de0, 0x2900, 0x7042, 0x2001, 0x0002, 0x9080, 0x1cf7, 0x2005,
-	0xa84a, 0x0000, 0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe, 0x012e,
-	0x00ee, 0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4a49, 0x4a49,
-	0x4a4b, 0x4a49, 0x4a49, 0x4a49, 0x4a50, 0x4a49, 0x4a49, 0x4a49,
-	0x4a55, 0x4a49, 0x4a49, 0x4a49, 0x4a5a, 0x4a49, 0x4a49, 0x4a49,
-	0x4a5f, 0x4a49, 0x4a49, 0x4a49, 0x4a64, 0x4a49, 0x4a49, 0x4a49,
-	0x4a69, 0x080c, 0x0d65, 0xaa74, 0xab78, 0xac7c, 0x0804, 0x49d5,
-	0xaa84, 0xab88, 0xac8c, 0x0804, 0x49d5, 0xaa94, 0xab98, 0xac9c,
-	0x0804, 0x49d5, 0xaaa4, 0xaba8, 0xacac, 0x0804, 0x49d5, 0xaab4,
-	0xabb8, 0xacbc, 0x0804, 0x49d5, 0xaac4, 0xabc8, 0xaccc, 0x0804,
-	0x49d5, 0xaad4, 0xabd8, 0xacdc, 0x0804, 0x49d5, 0x0026, 0x080c,
-	0x5386, 0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c, 0x48d1, 0x002e,
-	0x0005, 0x81ff, 0x1904, 0x33b5, 0x0126, 0x2091, 0x8000, 0x6030,
-	0xc08d, 0xc085, 0xc0ac, 0x6032, 0x080c, 0x70ac, 0x1158, 0x080c,
-	0x73ac, 0x080c, 0x5cd5, 0x9085, 0x0001, 0x080c, 0x70f3, 0x080c,
-	0x6fdd, 0x0010, 0x080c, 0x5b90, 0x012e, 0x0804, 0x3383, 0x81ff,
-	0x0120, 0x2009, 0x0001, 0x0804, 0x33b5, 0x080c, 0x539a, 0x0120,
-	0x2009, 0x0007, 0x0804, 0x33b5, 0x080c, 0x6658, 0x0120, 0x2009,
-	0x0008, 0x0804, 0x33b5, 0x0026, 0x2011, 0x0010, 0x080c, 0x6684,
-	0x002e, 0x0140, 0x7984, 0x080c, 0x66ce, 0x1120, 0x2009, 0x4009,
-	0x0804, 0x33b5, 0x080c, 0x317a, 0x0128, 0x7984, 0x080c, 0x6209,
-	0x1904, 0x33b8, 0x080c, 0x48a4, 0x0904, 0x33b8, 0x2b00, 0x7026,
-	0x080c, 0x6660, 0x7888, 0x1170, 0x9084, 0x0005, 0x1158, 0x900e,
-	0x080c, 0x6558, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
-	0x0804, 0x3383, 0x080c, 0x4871, 0x0904, 0x33b5, 0x9006, 0xa866,
-	0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xba5e, 0x0904, 0x33b5,
-	0x7888, 0xd094, 0x0118, 0xb8c4, 0xc08d, 0xb8c6, 0x7007, 0x0003,
-	0x701f, 0x4b3f, 0x0005, 0x2061, 0x1800, 0x080c, 0x539a, 0x2009,
-	0x0007, 0x1578, 0x080c, 0x6658, 0x0118, 0x2009, 0x0008, 0x0448,
-	0x080c, 0x317a, 0x0120, 0xa998, 0x080c, 0x6209, 0x1530, 0x080c,
-	0x48a2, 0x0518, 0x080c, 0x6660, 0xa89c, 0x1168, 0x9084, 0x0005,
-	0x1150, 0x900e, 0x080c, 0x6558, 0x1108, 0xc185, 0xb800, 0xd0bc,
-	0x0108, 0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c, 0xba5e,
-	0x11e0, 0xa89c, 0xd094, 0x0118, 0xb8c4, 0xc08d, 0xb8c6, 0x2009,
-	0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0xa99a,
-	0x9006, 0x918d, 0x0001, 0x2008, 0x0005, 0x9006, 0x0005, 0xa830,
-	0x2008, 0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x3385,
-	0x9086, 0x0100, 0x7024, 0x2058, 0x1110, 0x0804, 0x52e3, 0x900e,
-	0x080c, 0x6558, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
-	0x0804, 0x3383, 0x080c, 0x539a, 0x0120, 0x2009, 0x0007, 0x0804,
-	0x33b5, 0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4871,
-	0x1120, 0x2009, 0x0002, 0x0804, 0x33b5, 0x900e, 0x2130, 0x7126,
-	0x7132, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005, 0x702a,
-	0x20a0, 0x080c, 0x6269, 0x1904, 0x4bdd, 0x080c, 0x6660, 0x0120,
-	0x080c, 0x6668, 0x1904, 0x4bdd, 0x080c, 0x6658, 0x1130, 0x080c,
-	0x6558, 0x1118, 0xd79c, 0x0904, 0x4bdd, 0xd794, 0x1110, 0xd784,
-	0x01a8, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098, 0x3400,
-	0xd794, 0x0160, 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0, 0x3d00,
-	0x20e0, 0x20a9, 0x0002, 0x080c, 0x4686, 0x0048, 0x20a9, 0x0004,
-	0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4686, 0x4104,
-	0xd794, 0x0528, 0xb8b4, 0x20e0, 0xb8b8, 0x2060, 0x9c80, 0x0000,
-	0x2098, 0x20a9, 0x0002, 0x4003, 0x9c80, 0x0003, 0x2098, 0x20a9,
-	0x0001, 0x4005, 0x9c80, 0x0004, 0x2098, 0x3400, 0x20a9, 0x0002,
-	0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4679, 0x9c80,
-	0x0026, 0x2098, 0xb8b4, 0x20e0, 0x20a9, 0x0002, 0x4003, 0xd794,
-	0x0110, 0x96b0, 0x000b, 0x96b0, 0x0005, 0x8108, 0x080c, 0x9b4b,
-	0x0118, 0x9186, 0x0800, 0x0040, 0xd78c, 0x0120, 0x9186, 0x0800,
-	0x0170, 0x0018, 0x9186, 0x007e, 0x0150, 0xd794, 0x0118, 0x9686,
-	0x0020, 0x0010, 0x9686, 0x0028, 0x0150, 0x0804, 0x4b79, 0x86ff,
-	0x1120, 0x7124, 0x810b, 0x0804, 0x3383, 0x7033, 0x0001, 0x7122,
-	0x7024, 0x9600, 0x7026, 0x772e, 0x2061, 0x18ae, 0x2c44, 0xa06b,
-	0x0000, 0xa67a, 0x7034, 0xa072, 0x7028, 0xa076, 0xa28e, 0xa392,
-	0xa496, 0xa59a, 0x080c, 0x110c, 0x7007, 0x0002, 0x701f, 0x4c19,
-	0x0005, 0x7030, 0x9005, 0x1180, 0x7120, 0x7028, 0x20a0, 0x772c,
-	0x9036, 0x7034, 0x20e8, 0x2061, 0x18ae, 0x2c44, 0xa28c, 0xa390,
-	0xa494, 0xa598, 0x0804, 0x4b79, 0x7124, 0x810b, 0x0804, 0x3383,
-	0x2029, 0x007e, 0x7984, 0x7a88, 0x7b8c, 0x7c98, 0x9184, 0xff00,
-	0x8007, 0x90e2, 0x0020, 0x0a04, 0x33b8, 0x9502, 0x0a04, 0x33b8,
-	0x9184, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x33b8, 0x9502, 0x0a04,
-	0x33b8, 0x9284, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x33b8,
-	0x9502, 0x0a04, 0x33b8, 0x9284, 0x00ff, 0x90e2, 0x0020, 0x0a04,
-	0x33b8, 0x9502, 0x0a04, 0x33b8, 0x9384, 0xff00, 0x8007, 0x90e2,
-	0x0020, 0x0a04, 0x33b8, 0x9502, 0x0a04, 0x33b8, 0x9384, 0x00ff,
-	0x90e2, 0x0020, 0x0a04, 0x33b8, 0x9502, 0x0a04, 0x33b8, 0x9484,
-	0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x33b8, 0x9502, 0x0a04,
-	0x33b8, 0x9484, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x33b8, 0x9502,
-	0x0a04, 0x33b8, 0x2061, 0x195a, 0x6102, 0x6206, 0x630a, 0x640e,
-	0x0804, 0x3383, 0x0006, 0x080c, 0x5386, 0xd0cc, 0x000e, 0x0005,
-	0x0006, 0x080c, 0x538a, 0xd0bc, 0x000e, 0x0005, 0x6170, 0x7a84,
-	0x6300, 0x82ff, 0x1118, 0x7986, 0x0804, 0x3383, 0x83ff, 0x1904,
-	0x33b8, 0x2001, 0xfff0, 0x9200, 0x1a04, 0x33b8, 0x2019, 0xffff,
-	0x6074, 0x9302, 0x9200, 0x0a04, 0x33b8, 0x7986, 0x6272, 0x0804,
-	0x3383, 0x080c, 0x539a, 0x1904, 0x33b5, 0x7c88, 0x7d84, 0x7e98,
-	0x7f8c, 0x080c, 0x4871, 0x0904, 0x33b5, 0x900e, 0x901e, 0x7326,
-	0x7332, 0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0003, 0x702a,
-	0x20a0, 0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6660,
-	0x0118, 0x080c, 0x6668, 0x1148, 0x20a9, 0x0001, 0xb814, 0x4004,
-	0xb810, 0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800,
-	0x0120, 0x9386, 0x003c, 0x0170, 0x0c20, 0x83ff, 0x1148, 0x7224,
-	0x900e, 0x2001, 0x0003, 0x080c, 0x83f1, 0x2208, 0x0804, 0x3383,
-	0x7033, 0x0001, 0x7122, 0x7024, 0x9300, 0x7026, 0x2061, 0x18ae,
-	0x2c44, 0xa06b, 0x0000, 0xa37a, 0x7028, 0xa076, 0x7034, 0xa072,
-	0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x110c, 0x7007, 0x0002,
-	0x701f, 0x4d0b, 0x0005, 0x7030, 0x9005, 0x1178, 0x7120, 0x7028,
-	0x20a0, 0x901e, 0x7034, 0x20e8, 0x2061, 0x18ae, 0x2c44, 0xa48c,
-	0xa590, 0xa694, 0xa798, 0x0804, 0x4cc9, 0x7224, 0x900e, 0x2001,
-	0x0003, 0x080c, 0x83f1, 0x2208, 0x0804, 0x3383, 0x00f6, 0x00e6,
-	0x080c, 0x539a, 0x2009, 0x0007, 0x1904, 0x4d9e, 0x2071, 0x1894,
-	0x745c, 0x84ff, 0x2009, 0x000e, 0x1904, 0x4d9e, 0xac9c, 0xad98,
-	0xaea4, 0xafa0, 0x0096, 0x080c, 0x103b, 0x2009, 0x0002, 0x0904,
-	0x4d9e, 0x2900, 0x705e, 0x900e, 0x901e, 0x7356, 0x7362, 0xa860,
-	0x7066, 0xa85c, 0x9080, 0x0003, 0x705a, 0x20a0, 0x91d8, 0x1000,
-	0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6660, 0x0118, 0x080c, 0x6668,
-	0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004, 0x4104,
-	0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c,
-	0x01e8, 0x0c20, 0x83ff, 0x11c0, 0x7254, 0x900e, 0x2001, 0x0003,
-	0x080c, 0x83f1, 0x2208, 0x009e, 0xa897, 0x4000, 0xa99a, 0x715c,
-	0x81ff, 0x090c, 0x0d65, 0x2148, 0x080c, 0x1054, 0x9006, 0x705e,
-	0x918d, 0x0001, 0x2008, 0x0418, 0x7063, 0x0001, 0x7152, 0x7054,
-	0x9300, 0x7056, 0x2061, 0x18af, 0x2c44, 0xa37a, 0x7058, 0xa076,
-	0x7064, 0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0xa09f, 0x4daa,
-	0x000e, 0xa0a2, 0x080c, 0x110c, 0x9006, 0x0048, 0x009e, 0xa897,
-	0x4005, 0xa99a, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x00ee,
-	0x00fe, 0x0005, 0x00f6, 0xa0a0, 0x904d, 0x090c, 0x0d65, 0x00e6,
-	0x2071, 0x1894, 0xa06c, 0x908e, 0x0100, 0x0138, 0xa87b, 0x0030,
-	0xa883, 0x0000, 0xa897, 0x4002, 0x00d8, 0x7060, 0x9005, 0x1158,
-	0x7150, 0x7058, 0x20a0, 0x901e, 0x7064, 0x20e8, 0xa48c, 0xa590,
-	0xa694, 0xa798, 0x0428, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897,
-	0x4000, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x83f1, 0xaa9a,
-	0x715c, 0x81ff, 0x090c, 0x0d65, 0x2148, 0x080c, 0x1054, 0x705f,
-	0x0000, 0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x698f,
-	0x012e, 0xa09f, 0x0000, 0xa0a3, 0x0000, 0x00ee, 0x00fe, 0x0005,
-	0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6660, 0x0118,
-	0x080c, 0x6668, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810,
+	0x0001, 0x04f1, 0x00c6, 0x080c, 0x4878, 0x0550, 0xa868, 0xc0fd,
+	0xa86a, 0xa867, 0x0119, 0x9006, 0xa882, 0xa87f, 0x0020, 0xa88b,
+	0x0001, 0x810b, 0xa9ae, 0xa8b2, 0xaab6, 0xabba, 0xacbe, 0xadc2,
+	0xa9c6, 0xa8ca, 0x00ce, 0x009e, 0x00de, 0xa866, 0xa822, 0xa868,
+	0xc0fd, 0xa86a, 0xa804, 0x2048, 0x080c, 0xb9d7, 0x1120, 0x2009,
+	0x0003, 0x0804, 0x33bc, 0x7007, 0x0003, 0x701f, 0x4677, 0x0005,
+	0x00ce, 0x009e, 0x00de, 0x2009, 0x0002, 0x0804, 0x33bc, 0xa820,
+	0x9086, 0x8001, 0x1904, 0x338a, 0x2009, 0x0004, 0x0804, 0x33bc,
+	0x0016, 0x0026, 0x3510, 0x20a9, 0x0002, 0x4002, 0x4104, 0x4004,
+	0x8211, 0x1dc8, 0x002e, 0x001e, 0x0005, 0x0016, 0x0026, 0x0036,
+	0x0046, 0x3520, 0x20a9, 0x0004, 0x4002, 0x4304, 0x4204, 0x4104,
+	0x4004, 0x8421, 0x1db8, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005,
+	0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x33bc, 0x60d8, 0xd0ac,
+	0x1160, 0xd09c, 0x0120, 0x2009, 0x0016, 0x0804, 0x33bc, 0xd09c,
+	0x1120, 0x2009, 0x0005, 0x0804, 0x33bc, 0x7984, 0x78a8, 0x2040,
+	0x080c, 0x9b66, 0x1120, 0x9182, 0x007f, 0x0a04, 0x33bf, 0x9186,
+	0x00ff, 0x0904, 0x33bf, 0x9182, 0x0800, 0x1a04, 0x33bf, 0x7a8c,
+	0x7b88, 0x6078, 0x9306, 0x1140, 0x607c, 0x924e, 0x0904, 0x33bf,
+	0x99cc, 0xff00, 0x0904, 0x33bf, 0x0126, 0x2091, 0x8000, 0x0026,
+	0x2011, 0x8008, 0x080c, 0x668b, 0x002e, 0x0140, 0x918d, 0x8000,
+	0x080c, 0x66d5, 0x1118, 0x2001, 0x4009, 0x0458, 0x080c, 0x4792,
+	0x0560, 0x90c6, 0x4000, 0x1170, 0x00c6, 0x0006, 0x900e, 0x080c,
+	0x655f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x000e,
+	0x00ce, 0x00b8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x0090, 0x90c6,
+	0x4008, 0x1118, 0x2708, 0x2610, 0x0060, 0x90c6, 0x4009, 0x1108,
+	0x0040, 0x90c6, 0x4006, 0x1108, 0x0020, 0x2001, 0x4005, 0x2009,
+	0x000a, 0x2020, 0x012e, 0x0804, 0x338c, 0x2b00, 0x7026, 0x0016,
+	0x00b6, 0x00c6, 0x00e6, 0x2c70, 0x080c, 0x9c58, 0x0904, 0x475f,
+	0x2b00, 0x6012, 0x080c, 0xbcdb, 0x2e58, 0x00ee, 0x00e6, 0x00c6,
+	0x080c, 0x4878, 0x00ce, 0x2b70, 0x1158, 0x080c, 0x9be7, 0x00ee,
+	0x00ce, 0x00be, 0x001e, 0x012e, 0x2009, 0x0002, 0x0804, 0x33bc,
+	0x900e, 0xa966, 0xa96a, 0x2900, 0x6016, 0xa932, 0xa868, 0xc0fd,
+	0xd88c, 0x0108, 0xc0f5, 0xa86a, 0x080c, 0x3006, 0x6023, 0x0001,
+	0x9006, 0x080c, 0x61ad, 0x2001, 0x0002, 0x080c, 0x61c1, 0x2009,
+	0x0002, 0x080c, 0x9c85, 0x78a8, 0xd094, 0x0138, 0x00ee, 0x7024,
+	0x00e6, 0x2058, 0xb8c4, 0xc08d, 0xb8c6, 0x9085, 0x0001, 0x00ee,
+	0x00ce, 0x00be, 0x001e, 0x012e, 0x1120, 0x2009, 0x0003, 0x0804,
+	0x33bc, 0x7007, 0x0003, 0x701f, 0x476e, 0x0005, 0xa830, 0x2008,
+	0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x338c, 0x9086,
+	0x0100, 0x7024, 0x2058, 0x1138, 0x2009, 0x0004, 0xba04, 0x9294,
+	0x00ff, 0x0804, 0x52ea, 0x900e, 0xa868, 0xd0f4, 0x1904, 0x338a,
+	0x080c, 0x655f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d,
+	0x0804, 0x338a, 0x00e6, 0x00d6, 0x0096, 0x83ff, 0x0904, 0x47da,
+	0x902e, 0x080c, 0x9b66, 0x0130, 0x9026, 0x20a9, 0x0800, 0x2071,
+	0x1000, 0x0030, 0x2021, 0x007f, 0x20a9, 0x0781, 0x2071, 0x107f,
+	0x2e04, 0x9005, 0x11b0, 0x2100, 0x9406, 0x15e8, 0x2428, 0x94ce,
+	0x007f, 0x1120, 0x92ce, 0xfffd, 0x1528, 0x0030, 0x94ce, 0x0080,
+	0x1130, 0x92ce, 0xfffc, 0x11f0, 0x93ce, 0x00ff, 0x11d8, 0xc5fd,
+	0x0450, 0x2058, 0xbf10, 0x2700, 0x9306, 0x11b8, 0xbe14, 0x2600,
+	0x9206, 0x1198, 0x2400, 0x9106, 0x1150, 0xd884, 0x0568, 0xd894,
+	0x1558, 0x080c, 0x6667, 0x1540, 0x2001, 0x4000, 0x0430, 0x2001,
+	0x4007, 0x0418, 0x2001, 0x4006, 0x0400, 0x2400, 0x9106, 0x1158,
+	0xbe14, 0x87ff, 0x1128, 0x86ff, 0x0948, 0x080c, 0x9b66, 0x1930,
+	0x2001, 0x4008, 0x0090, 0x8420, 0x8e70, 0x1f04, 0x47a8, 0x85ff,
+	0x1130, 0x2001, 0x4009, 0x0048, 0x2001, 0x0001, 0x0030, 0x080c,
+	0x6210, 0x1dd0, 0xbb12, 0xba16, 0x9006, 0x9005, 0x009e, 0x00de,
+	0x00ee, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x33bc,
+	0x080c, 0x4878, 0x1120, 0x2009, 0x0002, 0x0804, 0x33bc, 0xa867,
+	0x0000, 0xa868, 0xc0fd, 0xa86a, 0x7884, 0x9005, 0x0904, 0x33bf,
+	0x9096, 0x00ff, 0x0120, 0x9092, 0x0004, 0x1a04, 0x33bf, 0x2010,
+	0x2918, 0x080c, 0x2fa0, 0x1120, 0x2009, 0x0003, 0x0804, 0x33bc,
+	0x7007, 0x0003, 0x701f, 0x482d, 0x0005, 0xa830, 0x9086, 0x0100,
+	0x1904, 0x338a, 0x2009, 0x0004, 0x0804, 0x33bc, 0x7984, 0x080c,
+	0x9b66, 0x1120, 0x9182, 0x007f, 0x0a04, 0x33bf, 0x9186, 0x00ff,
+	0x0904, 0x33bf, 0x9182, 0x0800, 0x1a04, 0x33bf, 0x2001, 0x9000,
+	0x080c, 0x5345, 0x1904, 0x33bc, 0x0804, 0x338a, 0xa998, 0x080c,
+	0x9b66, 0x1118, 0x9182, 0x007f, 0x0280, 0x9186, 0x00ff, 0x0168,
+	0x9182, 0x0800, 0x1250, 0x2001, 0x9000, 0x080c, 0x5345, 0x11a8,
+	0x0060, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e,
+	0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x900e,
+	0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x2009, 0x000a, 0x0c48,
+	0x080c, 0x1022, 0x0198, 0x9006, 0xa802, 0x7014, 0x9005, 0x1120,
+	0x2900, 0x7016, 0x701a, 0x0040, 0x7018, 0xa802, 0x0086, 0x2040,
+	0x2900, 0xa006, 0x701a, 0x008e, 0x9085, 0x0001, 0x0005, 0x7984,
+	0x080c, 0x6270, 0x1130, 0x7e88, 0x9684, 0x3fff, 0x9082, 0x4000,
+	0x0208, 0x905e, 0x8bff, 0x0005, 0xa998, 0x080c, 0x6270, 0x1130,
+	0xae9c, 0x9684, 0x3fff, 0x9082, 0x4000, 0x0208, 0x905e, 0x8bff,
+	0x0005, 0xae98, 0x0008, 0x7e84, 0x2608, 0x080c, 0x6270, 0x1108,
+	0x0008, 0x905e, 0x8bff, 0x0005, 0x0016, 0x7114, 0x81ff, 0x0128,
+	0x2148, 0xa904, 0x080c, 0x1054, 0x0cc8, 0x7116, 0x711a, 0x001e,
+	0x0005, 0x2031, 0x0001, 0x0010, 0x2031, 0x0000, 0x2061, 0x18ae,
+	0x2c44, 0xa66a, 0xa17a, 0xa772, 0xa076, 0xa28e, 0xa392, 0xa496,
+	0xa59a, 0x080c, 0x110c, 0x7007, 0x0002, 0x701f, 0x338a, 0x0005,
+	0x00f6, 0x0126, 0x2091, 0x8000, 0x2079, 0x0000, 0x2001, 0x18a6,
+	0x2004, 0x9005, 0x1190, 0x0e04, 0x48f5, 0x7a36, 0x7833, 0x0012,
+	0x7a82, 0x7b86, 0x7c8a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
+	0xd084, 0x190c, 0x11be, 0x0804, 0x495b, 0x0016, 0x0086, 0x0096,
+	0x00c6, 0x00e6, 0x2071, 0x1894, 0x7044, 0x9005, 0x1540, 0x7148,
+	0x9182, 0x0010, 0x0288, 0x7038, 0x2060, 0x080c, 0x1022, 0x0904,
+	0x4953, 0xa84b, 0x0000, 0x2900, 0x7046, 0x2001, 0x0002, 0x9080,
+	0x1cf7, 0x2005, 0xa846, 0x0098, 0x7038, 0x90e0, 0x0004, 0x2001,
+	0x18b0, 0x9c82, 0x18f0, 0x0210, 0x2061, 0x18b0, 0x2c00, 0x703a,
+	0x7148, 0x81ff, 0x1108, 0x703e, 0x8108, 0x714a, 0x0460, 0x7148,
+	0x8108, 0x714a, 0x7044, 0x2040, 0xa144, 0x2105, 0x0016, 0x908a,
+	0x0036, 0x1a0c, 0x0d65, 0x2060, 0x001e, 0x8108, 0x2105, 0x9005,
+	0xa146, 0x1520, 0x080c, 0x1022, 0x1130, 0x8109, 0xa946, 0x7148,
+	0x8109, 0x714a, 0x00d8, 0x9006, 0xa806, 0xa84a, 0xa046, 0x2800,
+	0xa802, 0x2900, 0xa006, 0x7046, 0x2001, 0x0002, 0x9080, 0x1cf7,
+	0x2005, 0xa846, 0x0058, 0x2262, 0x6306, 0x640a, 0x00ee, 0x00ce,
+	0x009e, 0x008e, 0x001e, 0x012e, 0x00fe, 0x0005, 0x2c00, 0x9082,
+	0x001b, 0x0002, 0x497d, 0x497d, 0x497f, 0x497d, 0x497d, 0x497d,
+	0x4983, 0x497d, 0x497d, 0x497d, 0x4987, 0x497d, 0x497d, 0x497d,
+	0x498b, 0x497d, 0x497d, 0x497d, 0x498f, 0x497d, 0x497d, 0x497d,
+	0x4993, 0x497d, 0x497d, 0x497d, 0x4998, 0x080c, 0x0d65, 0xa276,
+	0xa37a, 0xa47e, 0x0898, 0xa286, 0xa38a, 0xa48e, 0x0878, 0xa296,
+	0xa39a, 0xa49e, 0x0858, 0xa2a6, 0xa3aa, 0xa4ae, 0x0838, 0xa2b6,
+	0xa3ba, 0xa4be, 0x0818, 0xa2c6, 0xa3ca, 0xa4ce, 0x0804, 0x4956,
+	0xa2d6, 0xa3da, 0xa4de, 0x0804, 0x4956, 0x00e6, 0x2071, 0x1894,
+	0x7048, 0x9005, 0x0904, 0x4a2f, 0x0126, 0x2091, 0x8000, 0x0e04,
+	0x4a2e, 0x00f6, 0x2079, 0x0000, 0x00c6, 0x0096, 0x0086, 0x0076,
+	0x9006, 0x2038, 0x7040, 0x2048, 0x9005, 0x0500, 0xa948, 0x2105,
+	0x0016, 0x908a, 0x0036, 0x1a0c, 0x0d65, 0x2060, 0x001e, 0x8108,
+	0x2105, 0x9005, 0xa94a, 0x1904, 0x4a31, 0xa804, 0x9005, 0x090c,
+	0x0d65, 0x7042, 0x2938, 0x2040, 0xa003, 0x0000, 0x2001, 0x0002,
+	0x9080, 0x1cf7, 0x2005, 0xa04a, 0x0804, 0x4a31, 0x703c, 0x2060,
+	0x2c14, 0x6304, 0x6408, 0x650c, 0x2200, 0x7836, 0x7833, 0x0012,
+	0x7882, 0x2300, 0x7886, 0x2400, 0x788a, 0x2091, 0x4080, 0x2001,
+	0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x87ff, 0x0118, 0x2748,
+	0x080c, 0x1054, 0x7048, 0x8001, 0x704a, 0x9005, 0x1170, 0x7040,
+	0x2048, 0x9005, 0x0128, 0x080c, 0x1054, 0x9006, 0x7042, 0x7046,
+	0x703b, 0x18b0, 0x703f, 0x18b0, 0x0420, 0x7040, 0x9005, 0x1508,
+	0x7238, 0x2c00, 0x9206, 0x0148, 0x9c80, 0x0004, 0x90fa, 0x18f0,
+	0x0210, 0x2001, 0x18b0, 0x703e, 0x00a0, 0x9006, 0x703e, 0x703a,
+	0x7044, 0x9005, 0x090c, 0x0d65, 0x2048, 0xa800, 0x9005, 0x1de0,
+	0x2900, 0x7042, 0x2001, 0x0002, 0x9080, 0x1cf7, 0x2005, 0xa84a,
+	0x0000, 0x007e, 0x008e, 0x009e, 0x00ce, 0x00fe, 0x012e, 0x00ee,
+	0x0005, 0x2c00, 0x9082, 0x001b, 0x0002, 0x4a50, 0x4a50, 0x4a52,
+	0x4a50, 0x4a50, 0x4a50, 0x4a57, 0x4a50, 0x4a50, 0x4a50, 0x4a5c,
+	0x4a50, 0x4a50, 0x4a50, 0x4a61, 0x4a50, 0x4a50, 0x4a50, 0x4a66,
+	0x4a50, 0x4a50, 0x4a50, 0x4a6b, 0x4a50, 0x4a50, 0x4a50, 0x4a70,
+	0x080c, 0x0d65, 0xaa74, 0xab78, 0xac7c, 0x0804, 0x49dc, 0xaa84,
+	0xab88, 0xac8c, 0x0804, 0x49dc, 0xaa94, 0xab98, 0xac9c, 0x0804,
+	0x49dc, 0xaaa4, 0xaba8, 0xacac, 0x0804, 0x49dc, 0xaab4, 0xabb8,
+	0xacbc, 0x0804, 0x49dc, 0xaac4, 0xabc8, 0xaccc, 0x0804, 0x49dc,
+	0xaad4, 0xabd8, 0xacdc, 0x0804, 0x49dc, 0x0026, 0x080c, 0x538d,
+	0xd0c4, 0x0120, 0x2011, 0x8014, 0x080c, 0x48d8, 0x002e, 0x0005,
+	0x81ff, 0x1904, 0x33bc, 0x0126, 0x2091, 0x8000, 0x6030, 0xc08d,
+	0xc085, 0xc0ac, 0x6032, 0x080c, 0x70b7, 0x1158, 0x080c, 0x73b7,
+	0x080c, 0x5cdc, 0x9085, 0x0001, 0x080c, 0x70fe, 0x080c, 0x6fe8,
+	0x0010, 0x080c, 0x5b97, 0x012e, 0x0804, 0x338a, 0x81ff, 0x0120,
+	0x2009, 0x0001, 0x0804, 0x33bc, 0x080c, 0x53a1, 0x0120, 0x2009,
+	0x0007, 0x0804, 0x33bc, 0x080c, 0x665f, 0x0120, 0x2009, 0x0008,
+	0x0804, 0x33bc, 0x0026, 0x2011, 0x0010, 0x080c, 0x668b, 0x002e,
+	0x0140, 0x7984, 0x080c, 0x66d5, 0x1120, 0x2009, 0x4009, 0x0804,
+	0x33bc, 0x080c, 0x3181, 0x0128, 0x7984, 0x080c, 0x6210, 0x1904,
+	0x33bf, 0x080c, 0x48ab, 0x0904, 0x33bf, 0x2b00, 0x7026, 0x080c,
+	0x6667, 0x7888, 0x1170, 0x9084, 0x0005, 0x1158, 0x900e, 0x080c,
+	0x655f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804,
+	0x338a, 0x080c, 0x4878, 0x0904, 0x33bc, 0x9006, 0xa866, 0xa832,
+	0xa868, 0xc0fd, 0xa86a, 0x080c, 0xba79, 0x0904, 0x33bc, 0x7888,
+	0xd094, 0x0118, 0xb8c4, 0xc08d, 0xb8c6, 0x7007, 0x0003, 0x701f,
+	0x4b46, 0x0005, 0x2061, 0x1800, 0x080c, 0x53a1, 0x2009, 0x0007,
+	0x1578, 0x080c, 0x665f, 0x0118, 0x2009, 0x0008, 0x0448, 0x080c,
+	0x3181, 0x0120, 0xa998, 0x080c, 0x6210, 0x1530, 0x080c, 0x48a9,
+	0x0518, 0x080c, 0x6667, 0xa89c, 0x1168, 0x9084, 0x0005, 0x1150,
+	0x900e, 0x080c, 0x655f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
+	0xc18d, 0x00d0, 0xa868, 0xc0fc, 0xa86a, 0x080c, 0xba79, 0x11e0,
+	0xa89c, 0xd094, 0x0118, 0xb8c4, 0xc08d, 0xb8c6, 0x2009, 0x0003,
+	0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
+	0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0xa99a, 0x9006,
+	0x918d, 0x0001, 0x2008, 0x0005, 0x9006, 0x0005, 0xa830, 0x2008,
+	0x918e, 0xdead, 0x1120, 0x2021, 0x4009, 0x0804, 0x338c, 0x9086,
+	0x0100, 0x7024, 0x2058, 0x1110, 0x0804, 0x52ea, 0x900e, 0x080c,
+	0x655f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0x0804,
+	0x338a, 0x080c, 0x53a1, 0x0120, 0x2009, 0x0007, 0x0804, 0x33bc,
+	0x7f84, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x4878, 0x1120,
+	0x2009, 0x0002, 0x0804, 0x33bc, 0x900e, 0x2130, 0x7126, 0x7132,
+	0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0005, 0x702a, 0x20a0,
+	0x080c, 0x6270, 0x1904, 0x4be4, 0x080c, 0x6667, 0x0120, 0x080c,
+	0x666f, 0x1904, 0x4be4, 0x080c, 0x665f, 0x1130, 0x080c, 0x655f,
+	0x1118, 0xd79c, 0x0904, 0x4be4, 0xd794, 0x1110, 0xd784, 0x01a8,
+	0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098, 0x3400, 0xd794,
+	0x0160, 0x20a9, 0x0008, 0x4003, 0x2098, 0x20a0, 0x3d00, 0x20e0,
+	0x20a9, 0x0002, 0x080c, 0x468d, 0x0048, 0x20a9, 0x0004, 0x4003,
+	0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x468d, 0x4104, 0xd794,
+	0x0528, 0xb8b4, 0x20e0, 0xb8b8, 0x2060, 0x9c80, 0x0000, 0x2098,
+	0x20a9, 0x0002, 0x4003, 0x9c80, 0x0003, 0x2098, 0x20a9, 0x0001,
+	0x4005, 0x9c80, 0x0004, 0x2098, 0x3400, 0x20a9, 0x0002, 0x4003,
+	0x2098, 0x20a0, 0x3d00, 0x20e0, 0x080c, 0x4680, 0x9c80, 0x0026,
+	0x2098, 0xb8b4, 0x20e0, 0x20a9, 0x0002, 0x4003, 0xd794, 0x0110,
+	0x96b0, 0x000b, 0x96b0, 0x0005, 0x8108, 0x080c, 0x9b66, 0x0118,
+	0x9186, 0x0800, 0x0040, 0xd78c, 0x0120, 0x9186, 0x0800, 0x0170,
+	0x0018, 0x9186, 0x007e, 0x0150, 0xd794, 0x0118, 0x9686, 0x0020,
+	0x0010, 0x9686, 0x0028, 0x0150, 0x0804, 0x4b80, 0x86ff, 0x1120,
+	0x7124, 0x810b, 0x0804, 0x338a, 0x7033, 0x0001, 0x7122, 0x7024,
+	0x9600, 0x7026, 0x772e, 0x2061, 0x18ae, 0x2c44, 0xa06b, 0x0000,
+	0xa67a, 0x7034, 0xa072, 0x7028, 0xa076, 0xa28e, 0xa392, 0xa496,
+	0xa59a, 0x080c, 0x110c, 0x7007, 0x0002, 0x701f, 0x4c20, 0x0005,
+	0x7030, 0x9005, 0x1180, 0x7120, 0x7028, 0x20a0, 0x772c, 0x9036,
+	0x7034, 0x20e8, 0x2061, 0x18ae, 0x2c44, 0xa28c, 0xa390, 0xa494,
+	0xa598, 0x0804, 0x4b80, 0x7124, 0x810b, 0x0804, 0x338a, 0x2029,
+	0x007e, 0x7984, 0x7a88, 0x7b8c, 0x7c98, 0x9184, 0xff00, 0x8007,
+	0x90e2, 0x0020, 0x0a04, 0x33bf, 0x9502, 0x0a04, 0x33bf, 0x9184,
+	0x00ff, 0x90e2, 0x0020, 0x0a04, 0x33bf, 0x9502, 0x0a04, 0x33bf,
+	0x9284, 0xff00, 0x8007, 0x90e2, 0x0020, 0x0a04, 0x33bf, 0x9502,
+	0x0a04, 0x33bf, 0x9284, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x33bf,
+	0x9502, 0x0a04, 0x33bf, 0x9384, 0xff00, 0x8007, 0x90e2, 0x0020,
+	0x0a04, 0x33bf, 0x9502, 0x0a04, 0x33bf, 0x9384, 0x00ff, 0x90e2,
+	0x0020, 0x0a04, 0x33bf, 0x9502, 0x0a04, 0x33bf, 0x9484, 0xff00,
+	0x8007, 0x90e2, 0x0020, 0x0a04, 0x33bf, 0x9502, 0x0a04, 0x33bf,
+	0x9484, 0x00ff, 0x90e2, 0x0020, 0x0a04, 0x33bf, 0x9502, 0x0a04,
+	0x33bf, 0x2061, 0x195a, 0x6102, 0x6206, 0x630a, 0x640e, 0x0804,
+	0x338a, 0x0006, 0x080c, 0x538d, 0xd0cc, 0x000e, 0x0005, 0x0006,
+	0x080c, 0x5391, 0xd0bc, 0x000e, 0x0005, 0x6170, 0x7a84, 0x6300,
+	0x82ff, 0x1118, 0x7986, 0x0804, 0x338a, 0x83ff, 0x1904, 0x33bf,
+	0x2001, 0xfff0, 0x9200, 0x1a04, 0x33bf, 0x2019, 0xffff, 0x6074,
+	0x9302, 0x9200, 0x0a04, 0x33bf, 0x7986, 0x6272, 0x0804, 0x338a,
+	0x080c, 0x53a1, 0x1904, 0x33bc, 0x7c88, 0x7d84, 0x7e98, 0x7f8c,
+	0x080c, 0x4878, 0x0904, 0x33bc, 0x900e, 0x901e, 0x7326, 0x7332,
+	0xa860, 0x20e8, 0x7036, 0xa85c, 0x9080, 0x0003, 0x702a, 0x20a0,
+	0x91d8, 0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6667, 0x0118,
+	0x080c, 0x666f, 0x1148, 0x20a9, 0x0001, 0xb814, 0x4004, 0xb810,
 	0x4004, 0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120,
-	0x9386, 0x003c, 0x0518, 0x0c20, 0x83ff, 0x11f0, 0x7154, 0x810c,
-	0xa99a, 0xa897, 0x4000, 0x715c, 0x81ff, 0x090c, 0x0d65, 0x2148,
-	0x080c, 0x1054, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008, 0xa0a0,
-	0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e, 0xa09f,
-	0x0000, 0xa0a3, 0x0000, 0x0070, 0x7063, 0x0001, 0x7152, 0x7054,
-	0x9300, 0x7056, 0xa37a, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c,
-	0x110c, 0x9006, 0x00ee, 0x0005, 0x0096, 0xa88c, 0x90be, 0x7000,
-	0x0148, 0x90be, 0x7100, 0x0130, 0x90be, 0x7200, 0x0118, 0x009e,
-	0x0804, 0x33b8, 0xa884, 0xa988, 0x080c, 0x2424, 0x1518, 0x080c,
-	0x6209, 0x1500, 0x7126, 0xbe12, 0xbd16, 0xae7c, 0x080c, 0x4871,
-	0x01c8, 0x080c, 0x4871, 0x01b0, 0x009e, 0xa867, 0x0000, 0xa868,
-	0xc0fd, 0xa86a, 0xa823, 0x0000, 0xa804, 0x2048, 0x080c, 0xb9dc,
-	0x1120, 0x2009, 0x0003, 0x0804, 0x33b5, 0x7007, 0x0003, 0x701f,
-	0x4e77, 0x0005, 0x009e, 0x2009, 0x0002, 0x0804, 0x33b5, 0x7124,
-	0x080c, 0x3113, 0xa820, 0x9086, 0x8001, 0x1120, 0x2009, 0x0004,
-	0x0804, 0x33b5, 0x2900, 0x7022, 0xa804, 0x0096, 0x2048, 0x8906,
-	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x009e, 0x9080,
-	0x0002, 0x0076, 0x0006, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9,
-	0x002a, 0x080c, 0x0f9f, 0xaa6c, 0xab70, 0xac74, 0xad78, 0x2061,
-	0x18ae, 0x2c44, 0xa06b, 0x0000, 0xae64, 0xaf8c, 0x97c6, 0x7000,
-	0x0118, 0x97c6, 0x7100, 0x1148, 0x96c2, 0x0004, 0x0600, 0x2009,
-	0x0004, 0x000e, 0x007e, 0x0804, 0x48bd, 0x97c6, 0x7200, 0x11b8,
-	0x96c2, 0x0054, 0x02a0, 0x000e, 0x007e, 0x2061, 0x18ae, 0x2c44,
-	0xa076, 0xa772, 0xa07b, 0x002a, 0xa28e, 0xa392, 0xa496, 0xa59a,
-	0x080c, 0x110c, 0x7007, 0x0002, 0x701f, 0x4ed3, 0x0005, 0x000e,
-	0x007e, 0x0804, 0x33b8, 0x7020, 0x2048, 0xa804, 0x2048, 0xa804,
-	0x2048, 0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0,
-	0x9080, 0x0002, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a,
-	0x080c, 0x0f9f, 0x2100, 0x2238, 0x2061, 0x18ae, 0x2c44, 0xa28c,
-	0xa390, 0xa494, 0xa598, 0x2009, 0x002a, 0x0804, 0x48bd, 0x81ff,
-	0x1904, 0x33b5, 0x798c, 0x2001, 0x194f, 0x918c, 0x8000, 0x2102,
-	0x080c, 0x4888, 0x0904, 0x33b8, 0x080c, 0x6660, 0x0120, 0x080c,
-	0x6668, 0x1904, 0x33b8, 0x080c, 0x6330, 0x0904, 0x33b5, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x64c5, 0x012e, 0x0904, 0x33b5, 0x2001,
-	0x194f, 0x2004, 0xd0fc, 0x1904, 0x3383, 0x0804, 0x4322, 0xa9a0,
-	0x2001, 0x194f, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x4895,
-	0x01a0, 0x080c, 0x6660, 0x0118, 0x080c, 0x6668, 0x1170, 0x080c,
-	0x6330, 0x2009, 0x0002, 0x0128, 0x080c, 0x64c5, 0x1170, 0x2009,
-	0x0003, 0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e,
-	0x9085, 0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001,
-	0x194f, 0x2004, 0xd0fc, 0x1128, 0x080c, 0x538e, 0x0110, 0x9006,
-	0x0018, 0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x78a8,
-	0xd08c, 0x1118, 0xd084, 0x0904, 0x4297, 0x080c, 0x48a4, 0x0904,
-	0x33b8, 0x080c, 0x4871, 0x1120, 0x2009, 0x0002, 0x0804, 0x33b5,
-	0x080c, 0x6660, 0x0130, 0x908e, 0x0004, 0x0118, 0x908e, 0x0005,
-	0x15a0, 0x78a8, 0xd08c, 0x0120, 0xb800, 0xc08c, 0xb802, 0x0028,
-	0x080c, 0x5386, 0xd0b4, 0x0904, 0x42d1, 0x7884, 0x908e, 0x007e,
-	0x0904, 0x42d1, 0x908e, 0x007f, 0x0904, 0x42d1, 0x908e, 0x0080,
-	0x0904, 0x42d1, 0xb800, 0xd08c, 0x1904, 0x42d1, 0xa867, 0x0000,
-	0xa868, 0xc0fd, 0xa86a, 0x080c, 0xb9fb, 0x1120, 0x2009, 0x0003,
-	0x0804, 0x33b5, 0x7007, 0x0003, 0x701f, 0x4f9f, 0x0005, 0x080c,
-	0x48a4, 0x0904, 0x33b8, 0x0804, 0x42d1, 0x080c, 0x317a, 0x0108,
-	0x0005, 0x2009, 0x1833, 0x210c, 0x81ff, 0x0120, 0x2009, 0x0001,
-	0x0804, 0x33b5, 0x080c, 0x539a, 0x0120, 0x2009, 0x0007, 0x0804,
-	0x33b5, 0x080c, 0x6658, 0x0120, 0x2009, 0x0008, 0x0804, 0x33b5,
-	0xb89c, 0xd0a4, 0x1118, 0xd0ac, 0x1904, 0x42d1, 0x9006, 0xa866,
-	0xa832, 0xa868, 0xc0fd, 0xa86a, 0x080c, 0xba5e, 0x1120, 0x2009,
-	0x0003, 0x0804, 0x33b5, 0x7007, 0x0003, 0x701f, 0x4fd8, 0x0005,
-	0xa830, 0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x52e3,
-	0x080c, 0x48a4, 0x0904, 0x33b8, 0x0804, 0x4f71, 0x81ff, 0x2009,
-	0x0001, 0x1904, 0x33b5, 0x080c, 0x539a, 0x2009, 0x0007, 0x1904,
-	0x33b5, 0x080c, 0x6658, 0x0120, 0x2009, 0x0008, 0x0804, 0x33b5,
-	0x080c, 0x48a4, 0x0904, 0x33b8, 0x080c, 0x6660, 0x2009, 0x0009,
-	0x1904, 0x33b5, 0x080c, 0x4871, 0x2009, 0x0002, 0x0904, 0x33b5,
-	0x9006, 0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x7988, 0x9194,
-	0xff00, 0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128, 0xc0ed, 0xa952,
-	0x798c, 0xa956, 0x0038, 0x928e, 0x0100, 0x1904, 0x33b8, 0xc0e5,
-	0xa952, 0xa956, 0xa83e, 0x080c, 0xbcc1, 0x2009, 0x0003, 0x0904,
-	0x33b5, 0x7007, 0x0003, 0x701f, 0x502e, 0x0005, 0xa830, 0x9086,
-	0x0100, 0x2009, 0x0004, 0x0904, 0x33b5, 0x0804, 0x3383, 0x7aa8,
-	0x9284, 0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c, 0x539a, 0x1188,
-	0x2009, 0x0014, 0x0804, 0x33b5, 0xd2dc, 0x1568, 0x81ff, 0x2009,
-	0x0001, 0x1904, 0x33b5, 0x080c, 0x539a, 0x2009, 0x0007, 0x1904,
-	0x33b5, 0xd2f4, 0x0130, 0x9284, 0x5000, 0x080c, 0x5361, 0x0804,
-	0x3383, 0xd2fc, 0x0158, 0x080c, 0x48a4, 0x0904, 0x33b8, 0x7984,
-	0x9284, 0x9000, 0x080c, 0x533e, 0x0804, 0x3383, 0x080c, 0x48a4,
-	0x0904, 0x33b8, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x2009,
-	0x0009, 0x1904, 0x5117, 0x080c, 0x4871, 0x2009, 0x0002, 0x0904,
-	0x5117, 0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009, 0x0008, 0x7a8c,
-	0x7b88, 0x7c9c, 0x7d98, 0x080c, 0x48ba, 0x701f, 0x5088, 0x0005,
-	0xa86c, 0x9086, 0x0500, 0x1138, 0xa870, 0x9005, 0x1120, 0xa874,
-	0x9084, 0xff00, 0x0110, 0x1904, 0x33b8, 0xa866, 0xa832, 0xa868,
-	0xc0fd, 0xa86a, 0x080c, 0x48a4, 0x1110, 0x0804, 0x33b8, 0x2009,
-	0x0043, 0x080c, 0xbd29, 0x2009, 0x0003, 0x0904, 0x5117, 0x7007,
-	0x0003, 0x701f, 0x50ac, 0x0005, 0xa830, 0x9086, 0x0100, 0x2009,
-	0x0004, 0x0904, 0x5117, 0x7984, 0x7aa8, 0x9284, 0x1000, 0x080c,
-	0x533e, 0x0804, 0x3383, 0x00c6, 0xaab0, 0x9284, 0xc000, 0x0140,
-	0xd2ec, 0x0168, 0x080c, 0x539a, 0x1150, 0x2009, 0x0014, 0x04f0,
-	0x2061, 0x1800, 0x080c, 0x539a, 0x2009, 0x0007, 0x15b8, 0xd2f4,
-	0x0128, 0x9284, 0x5000, 0x080c, 0x5361, 0x0050, 0xd2fc, 0x0178,
-	0x080c, 0x48a2, 0x0588, 0xa998, 0x9284, 0x9000, 0x080c, 0x533e,
-	0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0438, 0x080c,
-	0x48a2, 0x0510, 0x080c, 0x6660, 0x2009, 0x0009, 0x11b8, 0xa8c4,
-	0x9086, 0x0500, 0x11c8, 0xa8c8, 0x9005, 0x11b0, 0xa8cc, 0x9084,
-	0xff00, 0x1190, 0x080c, 0x48a2, 0x1108, 0x0070, 0x2009, 0x004b,
-	0x080c, 0xbd29, 0x2009, 0x0003, 0x0108, 0x0078, 0x0429, 0x19c0,
+	0x9386, 0x003c, 0x0170, 0x0c20, 0x83ff, 0x1148, 0x7224, 0x900e,
+	0x2001, 0x0003, 0x080c, 0x8419, 0x2208, 0x0804, 0x338a, 0x7033,
+	0x0001, 0x7122, 0x7024, 0x9300, 0x7026, 0x2061, 0x18ae, 0x2c44,
+	0xa06b, 0x0000, 0xa37a, 0x7028, 0xa076, 0x7034, 0xa072, 0xa48e,
+	0xa592, 0xa696, 0xa79a, 0x080c, 0x110c, 0x7007, 0x0002, 0x701f,
+	0x4d12, 0x0005, 0x7030, 0x9005, 0x1178, 0x7120, 0x7028, 0x20a0,
+	0x901e, 0x7034, 0x20e8, 0x2061, 0x18ae, 0x2c44, 0xa48c, 0xa590,
+	0xa694, 0xa798, 0x0804, 0x4cd0, 0x7224, 0x900e, 0x2001, 0x0003,
+	0x080c, 0x8419, 0x2208, 0x0804, 0x338a, 0x00f6, 0x00e6, 0x080c,
+	0x53a1, 0x2009, 0x0007, 0x1904, 0x4da5, 0x2071, 0x1894, 0x745c,
+	0x84ff, 0x2009, 0x000e, 0x1904, 0x4da5, 0xac9c, 0xad98, 0xaea4,
+	0xafa0, 0x0096, 0x080c, 0x103b, 0x2009, 0x0002, 0x0904, 0x4da5,
+	0x2900, 0x705e, 0x900e, 0x901e, 0x7356, 0x7362, 0xa860, 0x7066,
+	0xa85c, 0x9080, 0x0003, 0x705a, 0x20a0, 0x91d8, 0x1000, 0x2b5c,
+	0x8bff, 0x0178, 0x080c, 0x6667, 0x0118, 0x080c, 0x666f, 0x1148,
+	0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004, 0x4104, 0x9398,
+	0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386, 0x003c, 0x01e8,
+	0x0c20, 0x83ff, 0x11c0, 0x7254, 0x900e, 0x2001, 0x0003, 0x080c,
+	0x8419, 0x2208, 0x009e, 0xa897, 0x4000, 0xa99a, 0x715c, 0x81ff,
+	0x090c, 0x0d65, 0x2148, 0x080c, 0x1054, 0x9006, 0x705e, 0x918d,
+	0x0001, 0x2008, 0x0418, 0x7063, 0x0001, 0x7152, 0x7054, 0x9300,
+	0x7056, 0x2061, 0x18af, 0x2c44, 0xa37a, 0x7058, 0xa076, 0x7064,
+	0xa072, 0xa48e, 0xa592, 0xa696, 0xa79a, 0xa09f, 0x4db1, 0x000e,
+	0xa0a2, 0x080c, 0x110c, 0x9006, 0x0048, 0x009e, 0xa897, 0x4005,
+	0xa99a, 0x900e, 0x9085, 0x0001, 0x2001, 0x0030, 0x00ee, 0x00fe,
+	0x0005, 0x00f6, 0xa0a0, 0x904d, 0x090c, 0x0d65, 0x00e6, 0x2071,
+	0x1894, 0xa06c, 0x908e, 0x0100, 0x0138, 0xa87b, 0x0030, 0xa883,
+	0x0000, 0xa897, 0x4002, 0x00d8, 0x7060, 0x9005, 0x1158, 0x7150,
+	0x7058, 0x20a0, 0x901e, 0x7064, 0x20e8, 0xa48c, 0xa590, 0xa694,
+	0xa798, 0x0428, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
+	0x7254, 0x900e, 0x2001, 0x0003, 0x080c, 0x8419, 0xaa9a, 0x715c,
+	0x81ff, 0x090c, 0x0d65, 0x2148, 0x080c, 0x1054, 0x705f, 0x0000,
+	0xa0a0, 0x2048, 0x0126, 0x2091, 0x8000, 0x080c, 0x6996, 0x012e,
+	0xa09f, 0x0000, 0xa0a3, 0x0000, 0x00ee, 0x00fe, 0x0005, 0x91d8,
+	0x1000, 0x2b5c, 0x8bff, 0x0178, 0x080c, 0x6667, 0x0118, 0x080c,
+	0x666f, 0x1148, 0xb814, 0x20a9, 0x0001, 0x4004, 0xb810, 0x4004,
+	0x4104, 0x9398, 0x0003, 0x8108, 0x9182, 0x0800, 0x0120, 0x9386,
+	0x003c, 0x0518, 0x0c20, 0x83ff, 0x11f0, 0x7154, 0x810c, 0xa99a,
+	0xa897, 0x4000, 0x715c, 0x81ff, 0x090c, 0x0d65, 0x2148, 0x080c,
+	0x1054, 0x9006, 0x705e, 0x918d, 0x0001, 0x2008, 0xa0a0, 0x2048,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x6996, 0x012e, 0xa09f, 0x0000,
+	0xa0a3, 0x0000, 0x0070, 0x7063, 0x0001, 0x7152, 0x7054, 0x9300,
+	0x7056, 0xa37a, 0xa48e, 0xa592, 0xa696, 0xa79a, 0x080c, 0x110c,
+	0x9006, 0x00ee, 0x0005, 0x0096, 0xa88c, 0x90be, 0x7000, 0x0148,
+	0x90be, 0x7100, 0x0130, 0x90be, 0x7200, 0x0118, 0x009e, 0x0804,
+	0x33bf, 0xa884, 0xa988, 0x080c, 0x2424, 0x1518, 0x080c, 0x6210,
+	0x1500, 0x7126, 0xbe12, 0xbd16, 0xae7c, 0x080c, 0x4878, 0x01c8,
+	0x080c, 0x4878, 0x01b0, 0x009e, 0xa867, 0x0000, 0xa868, 0xc0fd,
+	0xa86a, 0xa823, 0x0000, 0xa804, 0x2048, 0x080c, 0xb9f7, 0x1120,
+	0x2009, 0x0003, 0x0804, 0x33bc, 0x7007, 0x0003, 0x701f, 0x4e7e,
+	0x0005, 0x009e, 0x2009, 0x0002, 0x0804, 0x33bc, 0x7124, 0x080c,
+	0x311a, 0xa820, 0x9086, 0x8001, 0x1120, 0x2009, 0x0004, 0x0804,
+	0x33bc, 0x2900, 0x7022, 0xa804, 0x0096, 0x2048, 0x8906, 0x8006,
+	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x009e, 0x9080, 0x0002,
+	0x0076, 0x0006, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a,
+	0x080c, 0x0f9f, 0xaa6c, 0xab70, 0xac74, 0xad78, 0x2061, 0x18ae,
+	0x2c44, 0xa06b, 0x0000, 0xae64, 0xaf8c, 0x97c6, 0x7000, 0x0118,
+	0x97c6, 0x7100, 0x1148, 0x96c2, 0x0004, 0x0600, 0x2009, 0x0004,
+	0x000e, 0x007e, 0x0804, 0x48c4, 0x97c6, 0x7200, 0x11b8, 0x96c2,
+	0x0054, 0x02a0, 0x000e, 0x007e, 0x2061, 0x18ae, 0x2c44, 0xa076,
+	0xa772, 0xa07b, 0x002a, 0xa28e, 0xa392, 0xa496, 0xa59a, 0x080c,
+	0x110c, 0x7007, 0x0002, 0x701f, 0x4eda, 0x0005, 0x000e, 0x007e,
+	0x0804, 0x33bf, 0x7020, 0x2048, 0xa804, 0x2048, 0xa804, 0x2048,
+	0x8906, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080,
+	0x0002, 0x2098, 0x20a0, 0x27e0, 0x27e8, 0x20a9, 0x002a, 0x080c,
+	0x0f9f, 0x2100, 0x2238, 0x2061, 0x18ae, 0x2c44, 0xa28c, 0xa390,
+	0xa494, 0xa598, 0x2009, 0x002a, 0x0804, 0x48c4, 0x81ff, 0x1904,
+	0x33bc, 0x798c, 0x2001, 0x194f, 0x918c, 0x8000, 0x2102, 0x080c,
+	0x488f, 0x0904, 0x33bf, 0x080c, 0x6667, 0x0120, 0x080c, 0x666f,
+	0x1904, 0x33bf, 0x080c, 0x6337, 0x0904, 0x33bc, 0x0126, 0x2091,
+	0x8000, 0x080c, 0x64cc, 0x012e, 0x0904, 0x33bc, 0x2001, 0x194f,
+	0x2004, 0xd0fc, 0x1904, 0x338a, 0x0804, 0x4329, 0xa9a0, 0x2001,
+	0x194f, 0x918c, 0x8000, 0xc18d, 0x2102, 0x080c, 0x489c, 0x01a0,
+	0x080c, 0x6667, 0x0118, 0x080c, 0x666f, 0x1170, 0x080c, 0x6337,
+	0x2009, 0x0002, 0x0128, 0x080c, 0x64cc, 0x1170, 0x2009, 0x0003,
 	0xa897, 0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085,
-	0x0001, 0x2001, 0x0030, 0x00ce, 0x0005, 0x9006, 0x0ce0, 0x7aa8,
-	0xd2dc, 0x0904, 0x33b5, 0x0016, 0x7984, 0x9284, 0x1000, 0xc0fd,
-	0x080c, 0x533e, 0x001e, 0x1904, 0x33b5, 0x0804, 0x3383, 0x00f6,
-	0x2d78, 0x0011, 0x00fe, 0x0005, 0xaab0, 0xd2dc, 0x0150, 0x0016,
-	0xa998, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x533e, 0x001e, 0x9085,
-	0x0001, 0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x33b5,
-	0x080c, 0x539a, 0x0120, 0x2009, 0x0007, 0x0804, 0x33b5, 0x7984,
-	0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x6269, 0x1904, 0x33b8, 0x9186,
-	0x007f, 0x0138, 0x080c, 0x6660, 0x0120, 0x2009, 0x0009, 0x0804,
-	0x33b5, 0x080c, 0x4871, 0x1120, 0x2009, 0x0002, 0x0804, 0x33b5,
-	0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001, 0x0100, 0x8007,
-	0xa80a, 0x080c, 0xba15, 0x1120, 0x2009, 0x0003, 0x0804, 0x33b5,
-	0x7007, 0x0003, 0x701f, 0x5175, 0x0005, 0xa808, 0x8007, 0x9086,
-	0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x33b5, 0xa8e0, 0xa866,
-	0xa810, 0x8007, 0x9084, 0x00ff, 0x800c, 0xa814, 0x8007, 0x9084,
-	0x00ff, 0x8004, 0x9080, 0x0002, 0x9108, 0x8906, 0x8006, 0x8007,
-	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0004, 0x7a8c, 0x7b88,
-	0x7c9c, 0x7d98, 0x0804, 0x48bd, 0x080c, 0x4871, 0x1120, 0x2009,
-	0x0002, 0x0804, 0x33b5, 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff,
-	0x8217, 0x82ff, 0x1118, 0x7023, 0x1984, 0x0040, 0x92c6, 0x0001,
-	0x1118, 0x7023, 0x199e, 0x0010, 0x0804, 0x33b8, 0x2009, 0x001a,
-	0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60,
-	0x080c, 0x48ba, 0x701f, 0x51c5, 0x0005, 0x2001, 0x182d, 0x2003,
-	0x0001, 0xa85c, 0x9080, 0x0019, 0x2098, 0xa860, 0x20e0, 0x20a9,
-	0x001a, 0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003, 0x0804, 0x3383,
-	0x080c, 0x4871, 0x1120, 0x2009, 0x0002, 0x0804, 0x33b5, 0x7984,
-	0x9194, 0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118, 0x2099,
-	0x1984, 0x0040, 0x92c6, 0x0001, 0x1118, 0x2099, 0x199e, 0x0010,
-	0x0804, 0x33b8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0xa860, 0x20e8,
-	0x20a9, 0x001a, 0x20e1, 0x0001, 0x4003, 0x2009, 0x001a, 0x7a8c,
-	0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x0804,
-	0x48bd, 0x7884, 0x908a, 0x1000, 0x1a04, 0x33b8, 0x0126, 0x2091,
-	0x8000, 0x8003, 0x800b, 0x810b, 0x9108, 0x00c6, 0x2061, 0x19d4,
-	0x6142, 0x00ce, 0x012e, 0x0804, 0x3383, 0x00c6, 0x080c, 0x70ac,
-	0x1160, 0x080c, 0x73ac, 0x080c, 0x5cd5, 0x9085, 0x0001, 0x080c,
-	0x70f3, 0x080c, 0x6fdd, 0x080c, 0x0d65, 0x2061, 0x1800, 0x6030,
-	0xc09d, 0x6032, 0x080c, 0x5b90, 0x00ce, 0x0005, 0x00c6, 0x2001,
-	0x1800, 0x2004, 0x908e, 0x0000, 0x0904, 0x33b5, 0x7884, 0x9005,
-	0x0188, 0x7888, 0x2061, 0x196d, 0x2c0c, 0x2062, 0x080c, 0x2801,
-	0x01a0, 0x080c, 0x2809, 0x0188, 0x080c, 0x2811, 0x0170, 0x2162,
-	0x0804, 0x33b8, 0x2061, 0x0100, 0x6038, 0x9086, 0x0007, 0x1118,
-	0x2009, 0x0001, 0x0010, 0x2009, 0x0000, 0x7884, 0x9086, 0x0002,
-	0x1588, 0x2061, 0x0100, 0x6028, 0xc09c, 0x602a, 0x080c, 0x98ad,
-	0x0026, 0x2011, 0x0003, 0x080c, 0x931e, 0x2011, 0x0002, 0x080c,
-	0x9328, 0x002e, 0x080c, 0x91eb, 0x0036, 0x901e, 0x080c, 0x926b,
-	0x003e, 0x080c, 0x98c9, 0x60e3, 0x0000, 0x080c, 0xd5d9, 0x080c,
-	0xd5f4, 0x9085, 0x0001, 0x080c, 0x70f3, 0x9006, 0x080c, 0x2833,
-	0x2001, 0x1800, 0x2003, 0x0004, 0x0026, 0x2011, 0x0008, 0x080c,
-	0x286d, 0x002e, 0x00ce, 0x0804, 0x3383, 0x81ff, 0x0120, 0x2009,
-	0x0001, 0x0804, 0x33b5, 0x080c, 0x539a, 0x0120, 0x2009, 0x0007,
-	0x0804, 0x33b5, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x6269,
-	0x1904, 0x33b8, 0x9186, 0x007f, 0x0138, 0x080c, 0x6660, 0x0120,
-	0x2009, 0x0009, 0x0804, 0x33b5, 0x080c, 0x4871, 0x1120, 0x2009,
-	0x0002, 0x0804, 0x33b5, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a,
-	0x080c, 0xba18, 0x1120, 0x2009, 0x0003, 0x0804, 0x33b5, 0x7007,
-	0x0003, 0x701f, 0x52cc, 0x0005, 0xa830, 0x9086, 0x0100, 0x1120,
-	0x2009, 0x0004, 0x0804, 0x33b5, 0xa8e0, 0xa866, 0xa834, 0x8007,
-	0x800c, 0xa85c, 0x9080, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98,
-	0xaf60, 0x0804, 0x48bd, 0xa898, 0x9086, 0x000d, 0x1904, 0x33b5,
-	0x2021, 0x4005, 0x0126, 0x2091, 0x8000, 0x0e04, 0x52f0, 0x0010,
-	0x012e, 0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011,
-	0x0010, 0x7833, 0x0010, 0x7883, 0x4005, 0xa998, 0x7986, 0xa9a4,
-	0x799a, 0xa9a8, 0x799e, 0x080c, 0x48ad, 0x2091, 0x4080, 0x2001,
-	0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x7007, 0x0001, 0x2091,
-	0x5000, 0x700f, 0x0000, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000,
-	0x00c6, 0x2061, 0x19d4, 0x7984, 0x6152, 0x614e, 0x6057, 0x0000,
-	0x604b, 0x0009, 0x7898, 0x606a, 0x789c, 0x6066, 0x7888, 0x6062,
-	0x788c, 0x605e, 0x2001, 0x19e2, 0x2044, 0x2001, 0x19e9, 0xa076,
-	0xa060, 0xa072, 0xa07b, 0x0001, 0xa07f, 0x0002, 0xa06b, 0x0000,
-	0xa09f, 0x0000, 0x00ce, 0x012e, 0x0804, 0x3383, 0x0126, 0x2091,
-	0x8000, 0x00b6, 0x00c6, 0x90e4, 0xc000, 0x0128, 0x0006, 0x080c,
-	0xb879, 0x000e, 0x1198, 0xd0e4, 0x0160, 0x9180, 0x1000, 0x2004,
-	0x905d, 0x0160, 0x080c, 0x5cef, 0x080c, 0x9b4b, 0x0110, 0xb817,
-	0x0000, 0x9006, 0x00ce, 0x00be, 0x012e, 0x0005, 0x9085, 0x0001,
-	0x0cc8, 0x0126, 0x2091, 0x8000, 0x0156, 0x2010, 0x900e, 0x20a9,
-	0x0800, 0x0016, 0x9180, 0x1000, 0x2004, 0x9005, 0x0180, 0x9186,
-	0x007e, 0x0168, 0x9186, 0x007f, 0x0150, 0x9186, 0x0080, 0x0138,
-	0x9186, 0x00ff, 0x0120, 0x0026, 0x2200, 0x0801, 0x002e, 0x001e,
-	0x8108, 0x1f04, 0x5369, 0x015e, 0x012e, 0x0005, 0x2001, 0x1854,
-	0x2004, 0x0005, 0x2001, 0x1873, 0x2004, 0x0005, 0x0006, 0x2001,
-	0x1810, 0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001, 0x180e, 0x2004,
-	0xd0b4, 0x0005, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x0005,
-	0x0016, 0x00e6, 0x2071, 0x1894, 0x7108, 0x910d, 0x710a, 0x00ee,
-	0x001e, 0x0005, 0x79a4, 0x9182, 0x0081, 0x1a04, 0x33b8, 0x810c,
-	0x0016, 0x080c, 0x4871, 0x080c, 0x0f2a, 0x2100, 0x2238, 0x7d84,
-	0x7c88, 0x7b8c, 0x7a90, 0x001e, 0x080c, 0x48ba, 0x701f, 0x53c1,
-	0x0005, 0x2079, 0x0000, 0x7d94, 0x7c98, 0x7ba8, 0x7aac, 0x79a4,
-	0x810c, 0x2061, 0x18ae, 0x2c44, 0xa770, 0xa074, 0x2071, 0x1894,
-	0x080c, 0x48bd, 0x701f, 0x53d5, 0x0005, 0x2061, 0x18ae, 0x2c44,
-	0x0016, 0x0026, 0xa270, 0xa174, 0x080c, 0x0f32, 0x002e, 0x001e,
-	0x080c, 0x0fdf, 0x9006, 0xa802, 0xa806, 0x0804, 0x3383, 0x0126,
-	0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6,
-	0x00f6, 0x2061, 0x0100, 0x2069, 0x0200, 0x2071, 0x1800, 0x6044,
-	0xd0a4, 0x11e8, 0xd084, 0x0118, 0x080c, 0x5590, 0x0068, 0xd08c,
-	0x0118, 0x080c, 0x5499, 0x0040, 0xd094, 0x0118, 0x080c, 0x5469,
-	0x0018, 0xd09c, 0x0108, 0x0099, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-	0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x012e, 0x0005, 0x0016,
-	0x6128, 0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e, 0x0c68, 0x0006,
-	0x7094, 0x9005, 0x000e, 0x0120, 0x7097, 0x0000, 0x708f, 0x0000,
-	0x624c, 0x9286, 0xf0f0, 0x1150, 0x6048, 0x9086, 0xf0f0, 0x0130,
-	0x624a, 0x6043, 0x0090, 0x6043, 0x0010, 0x0490, 0x9294, 0xff00,
-	0x9296, 0xf700, 0x0178, 0x7138, 0xd1a4, 0x1160, 0x6240, 0x9295,
-	0x0100, 0x6242, 0x9294, 0x0010, 0x0128, 0x2009, 0x00f7, 0x080c,
-	0x5c51, 0x00f0, 0x6040, 0x9084, 0x0010, 0x9085, 0x0140, 0x6042,
-	0x6043, 0x0000, 0x7083, 0x0000, 0x709f, 0x0001, 0x70c3, 0x0000,
-	0x70db, 0x0000, 0x2009, 0x1d80, 0x200b, 0x0000, 0x7093, 0x0000,
-	0x7087, 0x000f, 0x2009, 0x000f, 0x2011, 0x5b33, 0x080c, 0x81f5,
-	0x0005, 0x2001, 0x1875, 0x2004, 0xd08c, 0x0110, 0x705b, 0xffff,
-	0x7084, 0x9005, 0x1528, 0x2011, 0x5b33, 0x080c, 0x8131, 0x6040,
-	0x9094, 0x0010, 0x9285, 0x0020, 0x6042, 0x20a9, 0x00c8, 0x6044,
-	0xd08c, 0x1168, 0x1f04, 0x547f, 0x6242, 0x7097, 0x0000, 0x6040,
-	0x9094, 0x0010, 0x9285, 0x0080, 0x6042, 0x6242, 0x0048, 0x6242,
-	0x7097, 0x0000, 0x708b, 0x0000, 0x9006, 0x080c, 0x5cda, 0x0000,
-	0x0005, 0x7088, 0x908a, 0x0003, 0x1a0c, 0x0d65, 0x000b, 0x0005,
-	0x54a3, 0x54f4, 0x558f, 0x00f6, 0x0016, 0x6900, 0x918c, 0x0800,
-	0x708b, 0x0001, 0x2001, 0x015d, 0x2003, 0x0000, 0x6803, 0x00fc,
-	0x20a9, 0x0004, 0x6800, 0x9084, 0x00fc, 0x0120, 0x1f04, 0x54b2,
-	0x080c, 0x0d65, 0x68a0, 0x68a2, 0x689c, 0x689e, 0x6898, 0x689a,
-	0xa001, 0x918d, 0x1600, 0x6902, 0x001e, 0x6837, 0x0020, 0x080c,
-	0x5cb6, 0x2079, 0x1d00, 0x7833, 0x1101, 0x7837, 0x0000, 0x20e1,
-	0x0001, 0x2099, 0x1805, 0x20e9, 0x0001, 0x20a1, 0x1d0e, 0x20a9,
-	0x0004, 0x4003, 0x080c, 0x97df, 0x20e1, 0x0001, 0x2099, 0x1d00,
+	0x0001, 0x2001, 0x0030, 0x0005, 0xa897, 0x4000, 0x2001, 0x194f,
+	0x2004, 0xd0fc, 0x1128, 0x080c, 0x5395, 0x0110, 0x9006, 0x0018,
+	0x900e, 0x9085, 0x0001, 0x2001, 0x0000, 0x0005, 0x78a8, 0xd08c,
+	0x1118, 0xd084, 0x0904, 0x429e, 0x080c, 0x48ab, 0x0904, 0x33bf,
+	0x080c, 0x4878, 0x1120, 0x2009, 0x0002, 0x0804, 0x33bc, 0x080c,
+	0x6667, 0x0130, 0x908e, 0x0004, 0x0118, 0x908e, 0x0005, 0x15a0,
+	0x78a8, 0xd08c, 0x0120, 0xb800, 0xc08c, 0xb802, 0x0028, 0x080c,
+	0x538d, 0xd0b4, 0x0904, 0x42d8, 0x7884, 0x908e, 0x007e, 0x0904,
+	0x42d8, 0x908e, 0x007f, 0x0904, 0x42d8, 0x908e, 0x0080, 0x0904,
+	0x42d8, 0xb800, 0xd08c, 0x1904, 0x42d8, 0xa867, 0x0000, 0xa868,
+	0xc0fd, 0xa86a, 0x080c, 0xba16, 0x1120, 0x2009, 0x0003, 0x0804,
+	0x33bc, 0x7007, 0x0003, 0x701f, 0x4fa6, 0x0005, 0x080c, 0x48ab,
+	0x0904, 0x33bf, 0x0804, 0x42d8, 0x080c, 0x3181, 0x0108, 0x0005,
+	0x2009, 0x1833, 0x210c, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804,
+	0x33bc, 0x080c, 0x53a1, 0x0120, 0x2009, 0x0007, 0x0804, 0x33bc,
+	0x080c, 0x665f, 0x0120, 0x2009, 0x0008, 0x0804, 0x33bc, 0xb89c,
+	0xd0a4, 0x1118, 0xd0ac, 0x1904, 0x42d8, 0x9006, 0xa866, 0xa832,
+	0xa868, 0xc0fd, 0xa86a, 0x080c, 0xba79, 0x1120, 0x2009, 0x0003,
+	0x0804, 0x33bc, 0x7007, 0x0003, 0x701f, 0x4fdf, 0x0005, 0xa830,
+	0x9086, 0x0100, 0x1120, 0x2009, 0x0004, 0x0804, 0x52ea, 0x080c,
+	0x48ab, 0x0904, 0x33bf, 0x0804, 0x4f78, 0x81ff, 0x2009, 0x0001,
+	0x1904, 0x33bc, 0x080c, 0x53a1, 0x2009, 0x0007, 0x1904, 0x33bc,
+	0x080c, 0x665f, 0x0120, 0x2009, 0x0008, 0x0804, 0x33bc, 0x080c,
+	0x48ab, 0x0904, 0x33bf, 0x080c, 0x6667, 0x2009, 0x0009, 0x1904,
+	0x33bc, 0x080c, 0x4878, 0x2009, 0x0002, 0x0904, 0x33bc, 0x9006,
+	0xa866, 0xa832, 0xa868, 0xc0fd, 0xa86a, 0x7988, 0x9194, 0xff00,
+	0x918c, 0x00ff, 0x9006, 0x82ff, 0x1128, 0xc0ed, 0xa952, 0x798c,
+	0xa956, 0x0038, 0x928e, 0x0100, 0x1904, 0x33bf, 0xc0e5, 0xa952,
+	0xa956, 0xa83e, 0x080c, 0xbcdc, 0x2009, 0x0003, 0x0904, 0x33bc,
+	0x7007, 0x0003, 0x701f, 0x5035, 0x0005, 0xa830, 0x9086, 0x0100,
+	0x2009, 0x0004, 0x0904, 0x33bc, 0x0804, 0x338a, 0x7aa8, 0x9284,
+	0xc000, 0x0148, 0xd2ec, 0x01a0, 0x080c, 0x53a1, 0x1188, 0x2009,
+	0x0014, 0x0804, 0x33bc, 0xd2dc, 0x1568, 0x81ff, 0x2009, 0x0001,
+	0x1904, 0x33bc, 0x080c, 0x53a1, 0x2009, 0x0007, 0x1904, 0x33bc,
+	0xd2f4, 0x0130, 0x9284, 0x5000, 0x080c, 0x5368, 0x0804, 0x338a,
+	0xd2fc, 0x0158, 0x080c, 0x48ab, 0x0904, 0x33bf, 0x7984, 0x9284,
+	0x9000, 0x080c, 0x5345, 0x0804, 0x338a, 0x080c, 0x48ab, 0x0904,
+	0x33bf, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x2009, 0x0009,
+	0x1904, 0x511e, 0x080c, 0x4878, 0x2009, 0x0002, 0x0904, 0x511e,
+	0xa85c, 0x9080, 0x001b, 0xaf60, 0x2009, 0x0008, 0x7a8c, 0x7b88,
+	0x7c9c, 0x7d98, 0x080c, 0x48c1, 0x701f, 0x508f, 0x0005, 0xa86c,
+	0x9086, 0x0500, 0x1138, 0xa870, 0x9005, 0x1120, 0xa874, 0x9084,
+	0xff00, 0x0110, 0x1904, 0x33bf, 0xa866, 0xa832, 0xa868, 0xc0fd,
+	0xa86a, 0x080c, 0x48ab, 0x1110, 0x0804, 0x33bf, 0x2009, 0x0043,
+	0x080c, 0xbd44, 0x2009, 0x0003, 0x0904, 0x511e, 0x7007, 0x0003,
+	0x701f, 0x50b3, 0x0005, 0xa830, 0x9086, 0x0100, 0x2009, 0x0004,
+	0x0904, 0x511e, 0x7984, 0x7aa8, 0x9284, 0x1000, 0x080c, 0x5345,
+	0x0804, 0x338a, 0x00c6, 0xaab0, 0x9284, 0xc000, 0x0140, 0xd2ec,
+	0x0168, 0x080c, 0x53a1, 0x1150, 0x2009, 0x0014, 0x04f0, 0x2061,
+	0x1800, 0x080c, 0x53a1, 0x2009, 0x0007, 0x15b8, 0xd2f4, 0x0128,
+	0x9284, 0x5000, 0x080c, 0x5368, 0x0050, 0xd2fc, 0x0178, 0x080c,
+	0x48a9, 0x0588, 0xa998, 0x9284, 0x9000, 0x080c, 0x5345, 0xa87b,
+	0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0438, 0x080c, 0x48a9,
+	0x0510, 0x080c, 0x6667, 0x2009, 0x0009, 0x11b8, 0xa8c4, 0x9086,
+	0x0500, 0x11c8, 0xa8c8, 0x9005, 0x11b0, 0xa8cc, 0x9084, 0xff00,
+	0x1190, 0x080c, 0x48a9, 0x1108, 0x0070, 0x2009, 0x004b, 0x080c,
+	0xbd44, 0x2009, 0x0003, 0x0108, 0x0078, 0x0429, 0x19c0, 0xa897,
+	0x4005, 0xa99a, 0x0010, 0xa897, 0x4006, 0x900e, 0x9085, 0x0001,
+	0x2001, 0x0030, 0x00ce, 0x0005, 0x9006, 0x0ce0, 0x7aa8, 0xd2dc,
+	0x0904, 0x33bc, 0x0016, 0x7984, 0x9284, 0x1000, 0xc0fd, 0x080c,
+	0x5345, 0x001e, 0x1904, 0x33bc, 0x0804, 0x338a, 0x00f6, 0x2d78,
+	0x0011, 0x00fe, 0x0005, 0xaab0, 0xd2dc, 0x0150, 0x0016, 0xa998,
+	0x9284, 0x1000, 0xc0fd, 0x080c, 0x5345, 0x001e, 0x9085, 0x0001,
+	0x0005, 0x81ff, 0x0120, 0x2009, 0x0001, 0x0804, 0x33bc, 0x080c,
+	0x53a1, 0x0120, 0x2009, 0x0007, 0x0804, 0x33bc, 0x7984, 0x7ea8,
+	0x96b4, 0x00ff, 0x080c, 0x6270, 0x1904, 0x33bf, 0x9186, 0x007f,
+	0x0138, 0x080c, 0x6667, 0x0120, 0x2009, 0x0009, 0x0804, 0x33bc,
+	0x080c, 0x4878, 0x1120, 0x2009, 0x0002, 0x0804, 0x33bc, 0xa867,
+	0x0000, 0xa868, 0xc0fd, 0xa86a, 0x2001, 0x0100, 0x8007, 0xa80a,
+	0x080c, 0xba30, 0x1120, 0x2009, 0x0003, 0x0804, 0x33bc, 0x7007,
+	0x0003, 0x701f, 0x517c, 0x0005, 0xa808, 0x8007, 0x9086, 0x0100,
+	0x1120, 0x2009, 0x0004, 0x0804, 0x33bc, 0xa8e0, 0xa866, 0xa810,
+	0x8007, 0x9084, 0x00ff, 0x800c, 0xa814, 0x8007, 0x9084, 0x00ff,
+	0x8004, 0x9080, 0x0002, 0x9108, 0x8906, 0x8006, 0x8007, 0x90bc,
+	0x003f, 0x9084, 0xffc0, 0x9080, 0x0004, 0x7a8c, 0x7b88, 0x7c9c,
+	0x7d98, 0x0804, 0x48c4, 0x080c, 0x4878, 0x1120, 0x2009, 0x0002,
+	0x0804, 0x33bc, 0x7984, 0x9194, 0xff00, 0x918c, 0x00ff, 0x8217,
+	0x82ff, 0x1118, 0x7023, 0x1984, 0x0040, 0x92c6, 0x0001, 0x1118,
+	0x7023, 0x199e, 0x0010, 0x0804, 0x33bf, 0x2009, 0x001a, 0x7a8c,
+	0x7b88, 0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x080c,
+	0x48c1, 0x701f, 0x51cc, 0x0005, 0x2001, 0x182d, 0x2003, 0x0001,
+	0xa85c, 0x9080, 0x0019, 0x2098, 0xa860, 0x20e0, 0x20a9, 0x001a,
+	0x7020, 0x20a0, 0x20e9, 0x0001, 0x4003, 0x0804, 0x338a, 0x080c,
+	0x4878, 0x1120, 0x2009, 0x0002, 0x0804, 0x33bc, 0x7984, 0x9194,
+	0xff00, 0x918c, 0x00ff, 0x8217, 0x82ff, 0x1118, 0x2099, 0x1984,
+	0x0040, 0x92c6, 0x0001, 0x1118, 0x2099, 0x199e, 0x0010, 0x0804,
+	0x33bf, 0xa85c, 0x9080, 0x0019, 0x20a0, 0xa860, 0x20e8, 0x20a9,
+	0x001a, 0x20e1, 0x0001, 0x4003, 0x2009, 0x001a, 0x7a8c, 0x7b88,
+	0x7c9c, 0x7d98, 0xa85c, 0x9080, 0x0019, 0xaf60, 0x0804, 0x48c4,
+	0x7884, 0x908a, 0x1000, 0x1a04, 0x33bf, 0x0126, 0x2091, 0x8000,
+	0x8003, 0x800b, 0x810b, 0x9108, 0x00c6, 0x2061, 0x19d4, 0x6142,
+	0x00ce, 0x012e, 0x0804, 0x338a, 0x00c6, 0x080c, 0x70b7, 0x1160,
+	0x080c, 0x73b7, 0x080c, 0x5cdc, 0x9085, 0x0001, 0x080c, 0x70fe,
+	0x080c, 0x6fe8, 0x080c, 0x0d65, 0x2061, 0x1800, 0x6030, 0xc09d,
+	0x6032, 0x080c, 0x5b97, 0x00ce, 0x0005, 0x00c6, 0x2001, 0x1800,
+	0x2004, 0x908e, 0x0000, 0x0904, 0x33bc, 0x7884, 0x9005, 0x0188,
+	0x7888, 0x2061, 0x196d, 0x2c0c, 0x2062, 0x080c, 0x2801, 0x01a0,
+	0x080c, 0x2809, 0x0188, 0x080c, 0x2811, 0x0170, 0x2162, 0x0804,
+	0x33bf, 0x2061, 0x0100, 0x6038, 0x9086, 0x0007, 0x1118, 0x2009,
+	0x0001, 0x0010, 0x2009, 0x0000, 0x7884, 0x9086, 0x0002, 0x1588,
+	0x2061, 0x0100, 0x6028, 0xc09c, 0x602a, 0x080c, 0x98c8, 0x0026,
+	0x2011, 0x0003, 0x080c, 0x9339, 0x2011, 0x0002, 0x080c, 0x9343,
+	0x002e, 0x080c, 0x9206, 0x0036, 0x901e, 0x080c, 0x9286, 0x003e,
+	0x080c, 0x98e4, 0x60e3, 0x0000, 0x080c, 0xd5fb, 0x080c, 0xd616,
+	0x9085, 0x0001, 0x080c, 0x70fe, 0x9006, 0x080c, 0x2833, 0x2001,
+	0x1800, 0x2003, 0x0004, 0x0026, 0x2011, 0x0008, 0x080c, 0x286d,
+	0x002e, 0x00ce, 0x0804, 0x338a, 0x81ff, 0x0120, 0x2009, 0x0001,
+	0x0804, 0x33bc, 0x080c, 0x53a1, 0x0120, 0x2009, 0x0007, 0x0804,
+	0x33bc, 0x7984, 0x7ea8, 0x96b4, 0x00ff, 0x080c, 0x6270, 0x1904,
+	0x33bf, 0x9186, 0x007f, 0x0138, 0x080c, 0x6667, 0x0120, 0x2009,
+	0x0009, 0x0804, 0x33bc, 0x080c, 0x4878, 0x1120, 0x2009, 0x0002,
+	0x0804, 0x33bc, 0xa867, 0x0000, 0xa868, 0xc0fd, 0xa86a, 0x080c,
+	0xba33, 0x1120, 0x2009, 0x0003, 0x0804, 0x33bc, 0x7007, 0x0003,
+	0x701f, 0x52d3, 0x0005, 0xa830, 0x9086, 0x0100, 0x1120, 0x2009,
+	0x0004, 0x0804, 0x33bc, 0xa8e0, 0xa866, 0xa834, 0x8007, 0x800c,
+	0xa85c, 0x9080, 0x000c, 0x7a8c, 0x7b88, 0x7c9c, 0x7d98, 0xaf60,
+	0x0804, 0x48c4, 0xa898, 0x9086, 0x000d, 0x1904, 0x33bc, 0x2021,
+	0x4005, 0x0126, 0x2091, 0x8000, 0x0e04, 0x52f7, 0x0010, 0x012e,
+	0x0cc0, 0x7c36, 0x9486, 0x4000, 0x0118, 0x7833, 0x0011, 0x0010,
+	0x7833, 0x0010, 0x7883, 0x4005, 0xa998, 0x7986, 0xa9a4, 0x799a,
+	0xa9a8, 0x799e, 0x080c, 0x48b4, 0x2091, 0x4080, 0x2001, 0x0089,
+	0x2004, 0xd084, 0x190c, 0x11be, 0x7007, 0x0001, 0x2091, 0x5000,
+	0x700f, 0x0000, 0x012e, 0x0005, 0x0126, 0x2091, 0x8000, 0x00c6,
+	0x2061, 0x19d4, 0x7984, 0x6152, 0x614e, 0x6057, 0x0000, 0x604b,
+	0x0009, 0x7898, 0x606a, 0x789c, 0x6066, 0x7888, 0x6062, 0x788c,
+	0x605e, 0x2001, 0x19e2, 0x2044, 0x2001, 0x19e9, 0xa076, 0xa060,
+	0xa072, 0xa07b, 0x0001, 0xa07f, 0x0002, 0xa06b, 0x0000, 0xa09f,
+	0x0000, 0x00ce, 0x012e, 0x0804, 0x338a, 0x0126, 0x2091, 0x8000,
+	0x00b6, 0x00c6, 0x90e4, 0xc000, 0x0128, 0x0006, 0x080c, 0xb894,
+	0x000e, 0x1198, 0xd0e4, 0x0160, 0x9180, 0x1000, 0x2004, 0x905d,
+	0x0160, 0x080c, 0x5cf6, 0x080c, 0x9b66, 0x0110, 0xb817, 0x0000,
+	0x9006, 0x00ce, 0x00be, 0x012e, 0x0005, 0x9085, 0x0001, 0x0cc8,
+	0x0126, 0x2091, 0x8000, 0x0156, 0x2010, 0x900e, 0x20a9, 0x0800,
+	0x0016, 0x9180, 0x1000, 0x2004, 0x9005, 0x0180, 0x9186, 0x007e,
+	0x0168, 0x9186, 0x007f, 0x0150, 0x9186, 0x0080, 0x0138, 0x9186,
+	0x00ff, 0x0120, 0x0026, 0x2200, 0x0801, 0x002e, 0x001e, 0x8108,
+	0x1f04, 0x5370, 0x015e, 0x012e, 0x0005, 0x2001, 0x1854, 0x2004,
+	0x0005, 0x2001, 0x1873, 0x2004, 0x0005, 0x0006, 0x2001, 0x1810,
+	0x2004, 0xd0d4, 0x000e, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0b4,
+	0x0005, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x0005, 0x0016,
+	0x00e6, 0x2071, 0x1894, 0x7108, 0x910d, 0x710a, 0x00ee, 0x001e,
+	0x0005, 0x79a4, 0x9182, 0x0081, 0x1a04, 0x33bf, 0x810c, 0x0016,
+	0x080c, 0x4878, 0x080c, 0x0f2a, 0x2100, 0x2238, 0x7d84, 0x7c88,
+	0x7b8c, 0x7a90, 0x001e, 0x080c, 0x48c1, 0x701f, 0x53c8, 0x0005,
+	0x2079, 0x0000, 0x7d94, 0x7c98, 0x7ba8, 0x7aac, 0x79a4, 0x810c,
+	0x2061, 0x18ae, 0x2c44, 0xa770, 0xa074, 0x2071, 0x1894, 0x080c,
+	0x48c4, 0x701f, 0x53dc, 0x0005, 0x2061, 0x18ae, 0x2c44, 0x0016,
+	0x0026, 0xa270, 0xa174, 0x080c, 0x0f32, 0x002e, 0x001e, 0x080c,
+	0x0fdf, 0x9006, 0xa802, 0xa806, 0x0804, 0x338a, 0x0126, 0x0156,
+	0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
+	0x2061, 0x0100, 0x2069, 0x0200, 0x2071, 0x1800, 0x6044, 0xd0a4,
+	0x11e8, 0xd084, 0x0118, 0x080c, 0x5597, 0x0068, 0xd08c, 0x0118,
+	0x080c, 0x54a0, 0x0040, 0xd094, 0x0118, 0x080c, 0x5470, 0x0018,
+	0xd09c, 0x0108, 0x0099, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x01de,
+	0x01ce, 0x014e, 0x013e, 0x015e, 0x012e, 0x0005, 0x0016, 0x6128,
+	0xd19c, 0x1110, 0xc19d, 0x612a, 0x001e, 0x0c68, 0x0006, 0x7094,
+	0x9005, 0x000e, 0x0120, 0x7097, 0x0000, 0x708f, 0x0000, 0x624c,
+	0x9286, 0xf0f0, 0x1150, 0x6048, 0x9086, 0xf0f0, 0x0130, 0x624a,
+	0x6043, 0x0090, 0x6043, 0x0010, 0x0490, 0x9294, 0xff00, 0x9296,
+	0xf700, 0x0178, 0x7138, 0xd1a4, 0x1160, 0x6240, 0x9295, 0x0100,
+	0x6242, 0x9294, 0x0010, 0x0128, 0x2009, 0x00f7, 0x080c, 0x5c58,
+	0x00f0, 0x6040, 0x9084, 0x0010, 0x9085, 0x0140, 0x6042, 0x6043,
+	0x0000, 0x7083, 0x0000, 0x709f, 0x0001, 0x70c3, 0x0000, 0x70db,
+	0x0000, 0x2009, 0x1d80, 0x200b, 0x0000, 0x7093, 0x0000, 0x7087,
+	0x000f, 0x2009, 0x000f, 0x2011, 0x5b3a, 0x080c, 0x821d, 0x0005,
+	0x2001, 0x1875, 0x2004, 0xd08c, 0x0110, 0x705b, 0xffff, 0x7084,
+	0x9005, 0x1528, 0x2011, 0x5b3a, 0x080c, 0x8159, 0x6040, 0x9094,
+	0x0010, 0x9285, 0x0020, 0x6042, 0x20a9, 0x00c8, 0x6044, 0xd08c,
+	0x1168, 0x1f04, 0x5486, 0x6242, 0x7097, 0x0000, 0x6040, 0x9094,
+	0x0010, 0x9285, 0x0080, 0x6042, 0x6242, 0x0048, 0x6242, 0x7097,
+	0x0000, 0x708b, 0x0000, 0x9006, 0x080c, 0x5ce1, 0x0000, 0x0005,
+	0x7088, 0x908a, 0x0003, 0x1a0c, 0x0d65, 0x000b, 0x0005, 0x54aa,
+	0x54fb, 0x5596, 0x00f6, 0x0016, 0x6900, 0x918c, 0x0800, 0x708b,
+	0x0001, 0x2001, 0x015d, 0x2003, 0x0000, 0x6803, 0x00fc, 0x20a9,
+	0x0004, 0x6800, 0x9084, 0x00fc, 0x0120, 0x1f04, 0x54b9, 0x080c,
+	0x0d65, 0x68a0, 0x68a2, 0x689c, 0x689e, 0x6898, 0x689a, 0xa001,
+	0x918d, 0x1600, 0x6902, 0x001e, 0x6837, 0x0020, 0x080c, 0x5cbd,
+	0x2079, 0x1d00, 0x7833, 0x1101, 0x7837, 0x0000, 0x20e1, 0x0001,
+	0x2099, 0x1805, 0x20e9, 0x0001, 0x20a1, 0x1d0e, 0x20a9, 0x0004,
+	0x4003, 0x080c, 0x97fa, 0x20e1, 0x0001, 0x2099, 0x1d00, 0x20e9,
+	0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3, 0x000c,
+	0x600f, 0x0000, 0x080c, 0x5b6b, 0x00fe, 0x9006, 0x708e, 0x6043,
+	0x0008, 0x6042, 0x0005, 0x00f6, 0x708c, 0x708f, 0x0000, 0x9025,
+	0x0904, 0x5573, 0x6020, 0xd0b4, 0x1904, 0x5571, 0x719c, 0x81ff,
+	0x0904, 0x555f, 0x9486, 0x000c, 0x1904, 0x556c, 0x9480, 0x0018,
+	0x8004, 0x20a8, 0x080c, 0x5cb6, 0x2011, 0x0260, 0x2019, 0x1d00,
+	0x220c, 0x2304, 0x9106, 0x11e8, 0x8210, 0x8318, 0x1f04, 0x5518,
+	0x6043, 0x0004, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0,
+	0x2061, 0x0100, 0x6043, 0x0006, 0x708b, 0x0002, 0x7097, 0x0002,
+	0x2009, 0x07d0, 0x2011, 0x5b41, 0x080c, 0x821d, 0x080c, 0x5cbd,
+	0x04c0, 0x080c, 0x5cb6, 0x2079, 0x0260, 0x7930, 0x918e, 0x1101,
+	0x1558, 0x7834, 0x9005, 0x1540, 0x7900, 0x918c, 0x00ff, 0x1118,
+	0x7804, 0x9005, 0x0190, 0x080c, 0x5cb6, 0x2011, 0x026e, 0x2019,
+	0x1805, 0x20a9, 0x0004, 0x220c, 0x2304, 0x9102, 0x0230, 0x11a0,
+	0x8210, 0x8318, 0x1f04, 0x5553, 0x0078, 0x709f, 0x0000, 0x080c,
+	0x5cb6, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0001, 0x20a1,
+	0x1d00, 0x20a9, 0x0014, 0x4003, 0x6043, 0x0008, 0x6043, 0x0000,
+	0x0010, 0x00fe, 0x0005, 0x6040, 0x9085, 0x0100, 0x6042, 0x6020,
+	0xd0b4, 0x1db8, 0x080c, 0x97fa, 0x20e1, 0x0001, 0x2099, 0x1d00,
 	0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003, 0x60c3,
-	0x000c, 0x600f, 0x0000, 0x080c, 0x5b64, 0x00fe, 0x9006, 0x708e,
-	0x6043, 0x0008, 0x6042, 0x0005, 0x00f6, 0x708c, 0x708f, 0x0000,
-	0x9025, 0x0904, 0x556c, 0x6020, 0xd0b4, 0x1904, 0x556a, 0x719c,
-	0x81ff, 0x0904, 0x5558, 0x9486, 0x000c, 0x1904, 0x5565, 0x9480,
-	0x0018, 0x8004, 0x20a8, 0x080c, 0x5caf, 0x2011, 0x0260, 0x2019,
-	0x1d00, 0x220c, 0x2304, 0x9106, 0x11e8, 0x8210, 0x8318, 0x1f04,
-	0x5511, 0x6043, 0x0004, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f,
-	0xf0f0, 0x2061, 0x0100, 0x6043, 0x0006, 0x708b, 0x0002, 0x7097,
-	0x0002, 0x2009, 0x07d0, 0x2011, 0x5b3a, 0x080c, 0x81f5, 0x080c,
-	0x5cb6, 0x04c0, 0x080c, 0x5caf, 0x2079, 0x0260, 0x7930, 0x918e,
-	0x1101, 0x1558, 0x7834, 0x9005, 0x1540, 0x7900, 0x918c, 0x00ff,
-	0x1118, 0x7804, 0x9005, 0x0190, 0x080c, 0x5caf, 0x2011, 0x026e,
-	0x2019, 0x1805, 0x20a9, 0x0004, 0x220c, 0x2304, 0x9102, 0x0230,
-	0x11a0, 0x8210, 0x8318, 0x1f04, 0x554c, 0x0078, 0x709f, 0x0000,
-	0x080c, 0x5caf, 0x20e1, 0x0000, 0x2099, 0x0260, 0x20e9, 0x0001,
-	0x20a1, 0x1d00, 0x20a9, 0x0014, 0x4003, 0x6043, 0x0008, 0x6043,
-	0x0000, 0x0010, 0x00fe, 0x0005, 0x6040, 0x9085, 0x0100, 0x6042,
-	0x6020, 0xd0b4, 0x1db8, 0x080c, 0x97df, 0x20e1, 0x0001, 0x2099,
-	0x1d00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x0014, 0x4003,
-	0x60c3, 0x000c, 0x2011, 0x19c5, 0x2013, 0x0000, 0x708f, 0x0000,
-	0x60a3, 0x0056, 0x60a7, 0x9575, 0x080c, 0x8f8f, 0x08d8, 0x0005,
-	0x7094, 0x908a, 0x001d, 0x1a0c, 0x0d65, 0x000b, 0x0005, 0x55c1,
-	0x55d4, 0x55fd, 0x561d, 0x5643, 0x5672, 0x5698, 0x56d0, 0x56f6,
-	0x5724, 0x575f, 0x5797, 0x57b5, 0x57e0, 0x5802, 0x581d, 0x5827,
-	0x585b, 0x5881, 0x58b0, 0x58d6, 0x590e, 0x5952, 0x598f, 0x59b0,
-	0x5a09, 0x5a2b, 0x5a59, 0x5a59, 0x00c6, 0x2061, 0x1800, 0x6003,
-	0x0007, 0x2061, 0x0100, 0x6004, 0x9084, 0xfff9, 0x6006, 0x00ce,
-	0x0005, 0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061,
-	0x0100, 0x6043, 0x0002, 0x7097, 0x0001, 0x2009, 0x07d0, 0x2011,
-	0x5b3a, 0x080c, 0x81f5, 0x0005, 0x00f6, 0x708c, 0x9086, 0x0014,
-	0x1510, 0x6042, 0x6020, 0xd0b4, 0x11f0, 0x080c, 0x5caf, 0x2079,
-	0x0260, 0x7a30, 0x9296, 0x1102, 0x11a0, 0x7834, 0x9005, 0x1188,
-	0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001,
-	0x2011, 0x5b3a, 0x080c, 0x8131, 0x7097, 0x0010, 0x080c, 0x5827,
-	0x0010, 0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x0003,
-	0x6043, 0x0004, 0x2011, 0x5b3a, 0x080c, 0x8131, 0x080c, 0x5c33,
-	0x2079, 0x0240, 0x7833, 0x1102, 0x7837, 0x0000, 0x20a9, 0x0008,
-	0x9f88, 0x000e, 0x200b, 0x0000, 0x8108, 0x1f04, 0x5612, 0x60c3,
-	0x0014, 0x080c, 0x5b64, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005,
-	0x0500, 0x2011, 0x5b3a, 0x080c, 0x8131, 0x9086, 0x0014, 0x11b8,
-	0x080c, 0x5caf, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x1178,
-	0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005,
-	0x1110, 0x70c3, 0x0001, 0x7097, 0x0004, 0x0029, 0x0010, 0x080c,
-	0x5c8b, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x0005, 0x080c, 0x5c33,
-	0x2079, 0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x5caf,
-	0x080c, 0x5c92, 0x1170, 0x7080, 0x9005, 0x1158, 0x7158, 0x9186,
-	0xffff, 0x0138, 0x2011, 0x0008, 0x080c, 0x5ae7, 0x0168, 0x080c,
-	0x5c68, 0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9,
-	0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b64,
-	0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b3a,
-	0x080c, 0x8131, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5caf, 0x2079,
+	0x000c, 0x2011, 0x19c5, 0x2013, 0x0000, 0x708f, 0x0000, 0x60a3,
+	0x0056, 0x60a7, 0x9575, 0x080c, 0x8faa, 0x08d8, 0x0005, 0x7094,
+	0x908a, 0x001d, 0x1a0c, 0x0d65, 0x000b, 0x0005, 0x55c8, 0x55db,
+	0x5604, 0x5624, 0x564a, 0x5679, 0x569f, 0x56d7, 0x56fd, 0x572b,
+	0x5766, 0x579e, 0x57bc, 0x57e7, 0x5809, 0x5824, 0x582e, 0x5862,
+	0x5888, 0x58b7, 0x58dd, 0x5915, 0x5959, 0x5996, 0x59b7, 0x5a10,
+	0x5a32, 0x5a60, 0x5a60, 0x00c6, 0x2061, 0x1800, 0x6003, 0x0007,
+	0x2061, 0x0100, 0x6004, 0x9084, 0xfff9, 0x6006, 0x00ce, 0x0005,
+	0x2061, 0x0140, 0x605b, 0xbc94, 0x605f, 0xf0f0, 0x2061, 0x0100,
+	0x6043, 0x0002, 0x7097, 0x0001, 0x2009, 0x07d0, 0x2011, 0x5b41,
+	0x080c, 0x821d, 0x0005, 0x00f6, 0x708c, 0x9086, 0x0014, 0x1510,
+	0x6042, 0x6020, 0xd0b4, 0x11f0, 0x080c, 0x5cb6, 0x2079, 0x0260,
+	0x7a30, 0x9296, 0x1102, 0x11a0, 0x7834, 0x9005, 0x1188, 0x7a38,
+	0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x2011,
+	0x5b41, 0x080c, 0x8159, 0x7097, 0x0010, 0x080c, 0x582e, 0x0010,
+	0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x0003, 0x6043,
+	0x0004, 0x2011, 0x5b41, 0x080c, 0x8159, 0x080c, 0x5c3a, 0x2079,
+	0x0240, 0x7833, 0x1102, 0x7837, 0x0000, 0x20a9, 0x0008, 0x9f88,
+	0x000e, 0x200b, 0x0000, 0x8108, 0x1f04, 0x5619, 0x60c3, 0x0014,
+	0x080c, 0x5b6b, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005, 0x0500,
+	0x2011, 0x5b41, 0x080c, 0x8159, 0x9086, 0x0014, 0x11b8, 0x080c,
+	0x5cb6, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1102, 0x1178, 0x7834,
+	0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110,
+	0x70c3, 0x0001, 0x7097, 0x0004, 0x0029, 0x0010, 0x080c, 0x5c92,
+	0x00fe, 0x0005, 0x00f6, 0x7097, 0x0005, 0x080c, 0x5c3a, 0x2079,
+	0x0240, 0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x5cb6, 0x080c,
+	0x5c99, 0x1170, 0x7080, 0x9005, 0x1158, 0x7158, 0x9186, 0xffff,
+	0x0138, 0x2011, 0x0008, 0x080c, 0x5aee, 0x0168, 0x080c, 0x5c6f,
+	0x20a9, 0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
+	0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b6b, 0x00fe,
+	0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b41, 0x080c,
+	0x8159, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5cb6, 0x2079, 0x0260,
+	0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38,
+	0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097,
+	0x0006, 0x0029, 0x0010, 0x080c, 0x5c92, 0x00fe, 0x0005, 0x00f6,
+	0x7097, 0x0007, 0x080c, 0x5c3a, 0x2079, 0x0240, 0x7833, 0x1104,
+	0x7837, 0x0000, 0x080c, 0x5cb6, 0x080c, 0x5c99, 0x11b8, 0x7080,
+	0x9005, 0x11a0, 0x7160, 0x9186, 0xffff, 0x0180, 0x9180, 0x318b,
+	0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5aee,
+	0x0180, 0x080c, 0x4c97, 0x0110, 0x080c, 0x248d, 0x20a9, 0x0008,
+	0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e,
+	0x4003, 0x60c3, 0x0014, 0x080c, 0x5b6b, 0x00fe, 0x0005, 0x00f6,
+	0x708c, 0x9005, 0x0500, 0x2011, 0x5b41, 0x080c, 0x8159, 0x9086,
+	0x0014, 0x11b8, 0x080c, 0x5cb6, 0x2079, 0x0260, 0x7a30, 0x9296,
+	0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128,
+	0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x0008, 0x0029,
+	0x0010, 0x080c, 0x5c92, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x0009,
+	0x080c, 0x5c3a, 0x2079, 0x0240, 0x7833, 0x1105, 0x7837, 0x0100,
+	0x080c, 0x5c99, 0x1150, 0x7080, 0x9005, 0x1138, 0x080c, 0x5a61,
+	0x1188, 0x9085, 0x0001, 0x080c, 0x248d, 0x20a9, 0x0008, 0x080c,
+	0x5cb6, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
+	0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b6b, 0x0010, 0x080c,
+	0x55bb, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005, 0x05a8, 0x2011,
+	0x5b41, 0x080c, 0x8159, 0x9086, 0x0014, 0x1560, 0x080c, 0x5cb6,
+	0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1520, 0x7834, 0x9084,
+	0x0100, 0x2011, 0x0100, 0x921e, 0x1160, 0x7a38, 0xd2fc, 0x0128,
+	0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x000a, 0x00b1,
+	0x0098, 0x9005, 0x1178, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005,
+	0x1110, 0x70c3, 0x0001, 0x7093, 0x0000, 0x7097, 0x000e, 0x080c,
+	0x5809, 0x0010, 0x080c, 0x5c92, 0x00fe, 0x0005, 0x00f6, 0x7097,
+	0x000b, 0x2011, 0x1d0e, 0x20e9, 0x0001, 0x22a0, 0x20a9, 0x0040,
+	0x2019, 0xffff, 0x4304, 0x080c, 0x5c3a, 0x2079, 0x0240, 0x7833,
+	0x1106, 0x7837, 0x0000, 0x080c, 0x5c99, 0x0118, 0x2013, 0x0000,
+	0x0020, 0x705c, 0x9085, 0x0100, 0x2012, 0x20a9, 0x0040, 0x2009,
+	0x024e, 0x2011, 0x1d0e, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260,
+	0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04, 0x578b,
+	0x60c3, 0x0084, 0x080c, 0x5b6b, 0x00fe, 0x0005, 0x00f6, 0x708c,
+	0x9005, 0x01c0, 0x2011, 0x5b41, 0x080c, 0x8159, 0x9086, 0x0084,
+	0x1178, 0x080c, 0x5cb6, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1106,
+	0x1138, 0x7834, 0x9005, 0x1120, 0x7097, 0x000c, 0x0029, 0x0010,
+	0x080c, 0x5c92, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x000d, 0x080c,
+	0x5c3a, 0x2079, 0x0240, 0x7833, 0x1107, 0x7837, 0x0000, 0x080c,
+	0x5cb6, 0x20a9, 0x0040, 0x2011, 0x026e, 0x2009, 0x024e, 0x220e,
+	0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000, 0x6812,
+	0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260, 0x1f04,
+	0x57cf, 0x60c3, 0x0084, 0x080c, 0x5b6b, 0x00fe, 0x0005, 0x00f6,
+	0x708c, 0x9005, 0x01e0, 0x2011, 0x5b41, 0x080c, 0x8159, 0x9086,
+	0x0084, 0x1198, 0x080c, 0x5cb6, 0x2079, 0x0260, 0x7a30, 0x9296,
+	0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7093, 0x0001, 0x080c,
+	0x5c0c, 0x7097, 0x000e, 0x0029, 0x0010, 0x080c, 0x5c92, 0x00fe,
+	0x0005, 0x918d, 0x0001, 0x080c, 0x5ce1, 0x7097, 0x000f, 0x708f,
+	0x0000, 0x2061, 0x0140, 0x605b, 0xbc85, 0x605f, 0xb5b5, 0x2061,
+	0x0100, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009, 0x07d0, 0x2011,
+	0x5b41, 0x080c, 0x814d, 0x0005, 0x708c, 0x9005, 0x0130, 0x2011,
+	0x5b41, 0x080c, 0x8159, 0x7097, 0x0000, 0x0005, 0x7097, 0x0011,
+	0x080c, 0x97fa, 0x080c, 0x5cb6, 0x20e1, 0x0000, 0x2099, 0x0260,
+	0x20e9, 0x0000, 0x20a1, 0x0240, 0x748c, 0x9480, 0x0018, 0x9080,
+	0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x4003, 0x080c, 0x5c99,
+	0x11a0, 0x7178, 0x81ff, 0x0188, 0x900e, 0x707c, 0x9084, 0x00ff,
+	0x0160, 0x080c, 0x2424, 0x9186, 0x007e, 0x0138, 0x9186, 0x0080,
+	0x0120, 0x2011, 0x0008, 0x080c, 0x5aee, 0x60c3, 0x0014, 0x080c,
+	0x5b6b, 0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b41,
+	0x080c, 0x8159, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5cb6, 0x2079,
 	0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005, 0x1160,
 	0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001,
-	0x7097, 0x0006, 0x0029, 0x0010, 0x080c, 0x5c8b, 0x00fe, 0x0005,
-	0x00f6, 0x7097, 0x0007, 0x080c, 0x5c33, 0x2079, 0x0240, 0x7833,
-	0x1104, 0x7837, 0x0000, 0x080c, 0x5caf, 0x080c, 0x5c92, 0x11b8,
-	0x7080, 0x9005, 0x11a0, 0x7160, 0x9186, 0xffff, 0x0180, 0x9180,
-	0x3184, 0x200d, 0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c,
-	0x5ae7, 0x0180, 0x080c, 0x4c90, 0x0110, 0x080c, 0x248d, 0x20a9,
-	0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
-	0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b64, 0x00fe, 0x0005,
-	0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b3a, 0x080c, 0x8131,
-	0x9086, 0x0014, 0x11b8, 0x080c, 0x5caf, 0x2079, 0x0260, 0x7a30,
-	0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
-	0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x0008,
-	0x0029, 0x0010, 0x080c, 0x5c8b, 0x00fe, 0x0005, 0x00f6, 0x7097,
-	0x0009, 0x080c, 0x5c33, 0x2079, 0x0240, 0x7833, 0x1105, 0x7837,
-	0x0100, 0x080c, 0x5c92, 0x1150, 0x7080, 0x9005, 0x1138, 0x080c,
-	0x5a5a, 0x1188, 0x9085, 0x0001, 0x080c, 0x248d, 0x20a9, 0x0008,
-	0x080c, 0x5caf, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000,
-	0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b64, 0x0010,
-	0x080c, 0x55b4, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005, 0x05a8,
-	0x2011, 0x5b3a, 0x080c, 0x8131, 0x9086, 0x0014, 0x1560, 0x080c,
-	0x5caf, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1520, 0x7834,
-	0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1160, 0x7a38, 0xd2fc,
-	0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x000a,
-	0x00b1, 0x0098, 0x9005, 0x1178, 0x7a38, 0xd2fc, 0x0128, 0x70c0,
-	0x9005, 0x1110, 0x70c3, 0x0001, 0x7093, 0x0000, 0x7097, 0x000e,
-	0x080c, 0x5802, 0x0010, 0x080c, 0x5c8b, 0x00fe, 0x0005, 0x00f6,
-	0x7097, 0x000b, 0x2011, 0x1d0e, 0x20e9, 0x0001, 0x22a0, 0x20a9,
-	0x0040, 0x2019, 0xffff, 0x4304, 0x080c, 0x5c33, 0x2079, 0x0240,
-	0x7833, 0x1106, 0x7837, 0x0000, 0x080c, 0x5c92, 0x0118, 0x2013,
-	0x0000, 0x0020, 0x705c, 0x9085, 0x0100, 0x2012, 0x20a9, 0x0040,
-	0x2009, 0x024e, 0x2011, 0x1d0e, 0x220e, 0x8210, 0x8108, 0x9186,
-	0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x1f04,
-	0x5784, 0x60c3, 0x0084, 0x080c, 0x5b64, 0x00fe, 0x0005, 0x00f6,
-	0x708c, 0x9005, 0x01c0, 0x2011, 0x5b3a, 0x080c, 0x8131, 0x9086,
-	0x0084, 0x1178, 0x080c, 0x5caf, 0x2079, 0x0260, 0x7a30, 0x9296,
-	0x1106, 0x1138, 0x7834, 0x9005, 0x1120, 0x7097, 0x000c, 0x0029,
-	0x0010, 0x080c, 0x5c8b, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x000d,
-	0x080c, 0x5c33, 0x2079, 0x0240, 0x7833, 0x1107, 0x7837, 0x0000,
-	0x080c, 0x5caf, 0x20a9, 0x0040, 0x2011, 0x026e, 0x2009, 0x024e,
-	0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810, 0x8000,
-	0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011, 0x0260,
-	0x1f04, 0x57c8, 0x60c3, 0x0084, 0x080c, 0x5b64, 0x00fe, 0x0005,
-	0x00f6, 0x708c, 0x9005, 0x01e0, 0x2011, 0x5b3a, 0x080c, 0x8131,
-	0x9086, 0x0084, 0x1198, 0x080c, 0x5caf, 0x2079, 0x0260, 0x7a30,
-	0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7093, 0x0001,
-	0x080c, 0x5c05, 0x7097, 0x000e, 0x0029, 0x0010, 0x080c, 0x5c8b,
-	0x00fe, 0x0005, 0x918d, 0x0001, 0x080c, 0x5cda, 0x7097, 0x000f,
-	0x708f, 0x0000, 0x2061, 0x0140, 0x605b, 0xbc85, 0x605f, 0xb5b5,
-	0x2061, 0x0100, 0x6043, 0x0005, 0x6043, 0x0004, 0x2009, 0x07d0,
-	0x2011, 0x5b3a, 0x080c, 0x8125, 0x0005, 0x708c, 0x9005, 0x0130,
-	0x2011, 0x5b3a, 0x080c, 0x8131, 0x7097, 0x0000, 0x0005, 0x7097,
-	0x0011, 0x080c, 0x97df, 0x080c, 0x5caf, 0x20e1, 0x0000, 0x2099,
-	0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x748c, 0x9480, 0x0018,
-	0x9080, 0x0007, 0x9084, 0x03f8, 0x8004, 0x20a8, 0x4003, 0x080c,
-	0x5c92, 0x11a0, 0x7178, 0x81ff, 0x0188, 0x900e, 0x707c, 0x9084,
-	0x00ff, 0x0160, 0x080c, 0x2424, 0x9186, 0x007e, 0x0138, 0x9186,
-	0x0080, 0x0120, 0x2011, 0x0008, 0x080c, 0x5ae7, 0x60c3, 0x0014,
-	0x080c, 0x5b64, 0x0005, 0x00f6, 0x708c, 0x9005, 0x0500, 0x2011,
-	0x5b3a, 0x080c, 0x8131, 0x9086, 0x0014, 0x11b8, 0x080c, 0x5caf,
-	0x2079, 0x0260, 0x7a30, 0x9296, 0x1103, 0x1178, 0x7834, 0x9005,
-	0x1160, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3,
-	0x0001, 0x7097, 0x0012, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe,
-	0x0005, 0x00f6, 0x7097, 0x0013, 0x080c, 0x5c41, 0x2079, 0x0240,
-	0x7833, 0x1103, 0x7837, 0x0000, 0x080c, 0x5caf, 0x080c, 0x5c92,
-	0x1170, 0x7080, 0x9005, 0x1158, 0x7158, 0x9186, 0xffff, 0x0138,
-	0x2011, 0x0008, 0x080c, 0x5ae7, 0x0168, 0x080c, 0x5c68, 0x20a9,
-	0x0008, 0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1,
-	0x024e, 0x4003, 0x60c3, 0x0014, 0x080c, 0x5b64, 0x00fe, 0x0005,
-	0x00f6, 0x708c, 0x9005, 0x0500, 0x2011, 0x5b3a, 0x080c, 0x8131,
-	0x9086, 0x0014, 0x11b8, 0x080c, 0x5caf, 0x2079, 0x0260, 0x7a30,
-	0x9296, 0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc,
-	0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x0014,
-	0x0029, 0x0010, 0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x7097,
-	0x0015, 0x080c, 0x5c41, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837,
-	0x0000, 0x080c, 0x5caf, 0x080c, 0x5c92, 0x11b8, 0x7080, 0x9005,
-	0x11a0, 0x7160, 0x9186, 0xffff, 0x0180, 0x9180, 0x3184, 0x200d,
-	0x918c, 0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5ae7, 0x0180,
-	0x080c, 0x4c90, 0x0110, 0x080c, 0x248d, 0x20a9, 0x0008, 0x20e1,
-	0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003,
-	0x60c3, 0x0014, 0x080c, 0x5b64, 0x00fe, 0x0005, 0x00f6, 0x708c,
-	0x9005, 0x05f0, 0x2011, 0x5b3a, 0x080c, 0x8131, 0x9086, 0x0014,
-	0x15a8, 0x080c, 0x5caf, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105,
-	0x1568, 0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1168,
-	0x9085, 0x0001, 0x080c, 0x5cda, 0x7a38, 0xd2fc, 0x0128, 0x70c0,
-	0x9005, 0x1110, 0x70c3, 0x0001, 0x0080, 0x9005, 0x11b8, 0x7a38,
-	0xd2fc, 0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x9085,
-	0x0001, 0x080c, 0x5cda, 0x7093, 0x0000, 0x7a38, 0xd2f4, 0x0110,
-	0x70db, 0x0008, 0x7097, 0x0016, 0x0029, 0x0010, 0x708f, 0x0000,
-	0x00fe, 0x0005, 0x080c, 0x97df, 0x080c, 0x5caf, 0x20e1, 0x0000,
-	0x2099, 0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000e,
-	0x4003, 0x2011, 0x026d, 0x2204, 0x9084, 0x0100, 0x2011, 0x024d,
-	0x2012, 0x2011, 0x026e, 0x7097, 0x0017, 0x080c, 0x5c92, 0x1150,
-	0x7080, 0x9005, 0x1138, 0x080c, 0x5a5a, 0x1188, 0x9085, 0x0001,
-	0x080c, 0x248d, 0x20a9, 0x0008, 0x080c, 0x5caf, 0x20e1, 0x0000,
+	0x7097, 0x0012, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe, 0x0005,
+	0x00f6, 0x7097, 0x0013, 0x080c, 0x5c48, 0x2079, 0x0240, 0x7833,
+	0x1103, 0x7837, 0x0000, 0x080c, 0x5cb6, 0x080c, 0x5c99, 0x1170,
+	0x7080, 0x9005, 0x1158, 0x7158, 0x9186, 0xffff, 0x0138, 0x2011,
+	0x0008, 0x080c, 0x5aee, 0x0168, 0x080c, 0x5c6f, 0x20a9, 0x0008,
+	0x20e1, 0x0000, 0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e,
+	0x4003, 0x60c3, 0x0014, 0x080c, 0x5b6b, 0x00fe, 0x0005, 0x00f6,
+	0x708c, 0x9005, 0x0500, 0x2011, 0x5b41, 0x080c, 0x8159, 0x9086,
+	0x0014, 0x11b8, 0x080c, 0x5cb6, 0x2079, 0x0260, 0x7a30, 0x9296,
+	0x1104, 0x1178, 0x7834, 0x9005, 0x1160, 0x7a38, 0xd2fc, 0x0128,
+	0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x7097, 0x0014, 0x0029,
+	0x0010, 0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6, 0x7097, 0x0015,
+	0x080c, 0x5c48, 0x2079, 0x0240, 0x7833, 0x1104, 0x7837, 0x0000,
+	0x080c, 0x5cb6, 0x080c, 0x5c99, 0x11b8, 0x7080, 0x9005, 0x11a0,
+	0x7160, 0x9186, 0xffff, 0x0180, 0x9180, 0x318b, 0x200d, 0x918c,
+	0xff00, 0x810f, 0x2011, 0x0008, 0x080c, 0x5aee, 0x0180, 0x080c,
+	0x4c97, 0x0110, 0x080c, 0x248d, 0x20a9, 0x0008, 0x20e1, 0x0000,
 	0x2099, 0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3,
-	0x0014, 0x080c, 0x5b64, 0x0010, 0x080c, 0x55b4, 0x0005, 0x00f6,
-	0x708c, 0x9005, 0x01d8, 0x2011, 0x5b3a, 0x080c, 0x8131, 0x9086,
-	0x0084, 0x1190, 0x080c, 0x5caf, 0x2079, 0x0260, 0x7a30, 0x9296,
-	0x1106, 0x1150, 0x7834, 0x9005, 0x1138, 0x9006, 0x080c, 0x5cda,
-	0x7097, 0x0018, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe, 0x0005,
-	0x00f6, 0x7097, 0x0019, 0x080c, 0x5c41, 0x2079, 0x0240, 0x7833,
-	0x1106, 0x7837, 0x0000, 0x080c, 0x5caf, 0x2009, 0x026e, 0x2039,
-	0x1d0e, 0x20a9, 0x0040, 0x213e, 0x8738, 0x8108, 0x9186, 0x0280,
-	0x1128, 0x6814, 0x8000, 0x6816, 0x2009, 0x0260, 0x1f04, 0x59c3,
-	0x2039, 0x1d0e, 0x080c, 0x5c92, 0x11e8, 0x2728, 0x2514, 0x8207,
-	0x9084, 0x00ff, 0x8000, 0x2018, 0x9294, 0x00ff, 0x8007, 0x9205,
-	0x202a, 0x705c, 0x2310, 0x8214, 0x92a0, 0x1d0e, 0x2414, 0x938c,
-	0x0001, 0x0118, 0x9294, 0xff00, 0x0018, 0x9294, 0x00ff, 0x8007,
-	0x9215, 0x2222, 0x20a9, 0x0040, 0x2009, 0x024e, 0x270e, 0x8738,
-	0x8108, 0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009,
-	0x0240, 0x1f04, 0x59f6, 0x60c3, 0x0084, 0x080c, 0x5b64, 0x00fe,
-	0x0005, 0x00f6, 0x708c, 0x9005, 0x01e0, 0x2011, 0x5b3a, 0x080c,
-	0x8131, 0x9086, 0x0084, 0x1198, 0x080c, 0x5caf, 0x2079, 0x0260,
-	0x7a30, 0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7093,
-	0x0001, 0x080c, 0x5c05, 0x7097, 0x001a, 0x0029, 0x0010, 0x708f,
-	0x0000, 0x00fe, 0x0005, 0x9085, 0x0001, 0x080c, 0x5cda, 0x7097,
-	0x001b, 0x080c, 0x97df, 0x080c, 0x5caf, 0x2011, 0x0260, 0x2009,
-	0x0240, 0x748c, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8,
-	0x8004, 0x20a8, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150,
-	0x6810, 0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816,
-	0x2011, 0x0260, 0x1f04, 0x5a42, 0x60c3, 0x0084, 0x080c, 0x5b64,
-	0x0005, 0x0005, 0x0086, 0x0096, 0x2029, 0x1854, 0x252c, 0x20a9,
-	0x0008, 0x2041, 0x1d0e, 0x20e9, 0x0001, 0x28a0, 0x080c, 0x5caf,
-	0x20e1, 0x0000, 0x2099, 0x026e, 0x4003, 0x20a9, 0x0008, 0x2011,
-	0x0007, 0xd5d4, 0x0108, 0x9016, 0x2800, 0x9200, 0x200c, 0x91a6,
-	0xffff, 0x1148, 0xd5d4, 0x0110, 0x8210, 0x0008, 0x8211, 0x1f04,
-	0x5a74, 0x0804, 0x5ae3, 0x82ff, 0x1160, 0xd5d4, 0x0120, 0x91a6,
-	0x3fff, 0x0d90, 0x0020, 0x91a6, 0x3fff, 0x0904, 0x5ae3, 0x918d,
-	0xc000, 0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4, 0x0110, 0x2019,
-	0x0010, 0x2120, 0xd5d4, 0x0110, 0x8423, 0x0008, 0x8424, 0x1240,
-	0xd5d4, 0x0110, 0x8319, 0x0008, 0x8318, 0x1f04, 0x5a9a, 0x04d8,
-	0x23a8, 0x2021, 0x0001, 0x8426, 0x8425, 0x1f04, 0x5aac, 0x2328,
-	0x8529, 0x92be, 0x0007, 0x0158, 0x0006, 0x2039, 0x0007, 0x2200,
-	0x973a, 0x000e, 0x27a8, 0x95a8, 0x0010, 0x1f04, 0x5abb, 0x755a,
-	0x95c8, 0x3184, 0x292d, 0x95ac, 0x00ff, 0x757e, 0x6532, 0x6536,
-	0x0016, 0x2508, 0x080c, 0x246d, 0x001e, 0x60e7, 0x0000, 0x65ea,
-	0x2018, 0x2304, 0x9405, 0x201a, 0x7083, 0x0001, 0x20e9, 0x0000,
-	0x20a1, 0x024e, 0x20e1, 0x0001, 0x2898, 0x20a9, 0x0008, 0x4003,
-	0x9085, 0x0001, 0x0008, 0x9006, 0x009e, 0x008e, 0x0005, 0x0156,
-	0x01c6, 0x01d6, 0x0136, 0x0146, 0x22a8, 0x20e1, 0x0000, 0x2099,
-	0x026e, 0x20e9, 0x0000, 0x2011, 0x024e, 0x22a0, 0x4003, 0x014e,
-	0x013e, 0x01de, 0x01ce, 0x015e, 0x2118, 0x9026, 0x2001, 0x0007,
-	0x939a, 0x0010, 0x0218, 0x8420, 0x8001, 0x0cd0, 0x2118, 0x84ff,
-	0x0120, 0x939a, 0x0010, 0x8421, 0x1de0, 0x2021, 0x0001, 0x83ff,
-	0x0118, 0x8423, 0x8319, 0x1de8, 0x9238, 0x2029, 0x026e, 0x9528,
-	0x2504, 0x942c, 0x11b8, 0x9405, 0x203a, 0x715a, 0x91a0, 0x3184,
-	0x242d, 0x95ac, 0x00ff, 0x757e, 0x6532, 0x6536, 0x0016, 0x2508,
-	0x080c, 0x246d, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7083, 0x0001,
-	0x9084, 0x0000, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7087, 0x0000,
-	0x00ee, 0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071, 0x0140,
-	0x080c, 0x5bf4, 0x080c, 0x8f9c, 0x7004, 0x9084, 0x4000, 0x0110,
-	0x080c, 0x2843, 0x0126, 0x2091, 0x8000, 0x2071, 0x1825, 0x2073,
-	0x0000, 0x7840, 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c, 0x5c51,
-	0x001e, 0x9094, 0x0010, 0x9285, 0x0080, 0x7842, 0x7a42, 0x002e,
-	0x012e, 0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x27a2, 0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x2011,
-	0x19c5, 0x2013, 0x0000, 0x708f, 0x0000, 0x012e, 0x60a3, 0x0056,
-	0x60a7, 0x9575, 0x080c, 0x8f8f, 0x6144, 0xd184, 0x0120, 0x7194,
-	0x918d, 0x2000, 0x0018, 0x7188, 0x918d, 0x1000, 0x2011, 0x196a,
-	0x2112, 0x2009, 0x07d0, 0x2011, 0x5b3a, 0x080c, 0x81f5, 0x0005,
-	0x0016, 0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x98ad,
-	0x080c, 0x9b52, 0x080c, 0x98c9, 0x2009, 0x00f7, 0x080c, 0x5c51,
-	0x2061, 0x19d4, 0x900e, 0x611a, 0x611e, 0x6172, 0x6176, 0x2061,
-	0x1800, 0x6003, 0x0001, 0x2061, 0x0100, 0x6043, 0x0090, 0x6043,
-	0x0010, 0x2009, 0x196a, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011,
-	0x5bc0, 0x080c, 0x8125, 0x012e, 0x00ce, 0x002e, 0x001e, 0x0005,
-	0x00e6, 0x0006, 0x0126, 0x2091, 0x8000, 0x0471, 0x2071, 0x0100,
-	0x080c, 0x8f9c, 0x2071, 0x0140, 0x7004, 0x9084, 0x4000, 0x0110,
-	0x080c, 0x2843, 0x080c, 0x70b4, 0x0188, 0x080c, 0x70cf, 0x1170,
-	0x080c, 0x73b6, 0x0016, 0x080c, 0x253c, 0x2001, 0x193e, 0x2102,
-	0x001e, 0x080c, 0x73b1, 0x080c, 0x6fdd, 0x0050, 0x2009, 0x0001,
-	0x080c, 0x281f, 0x2001, 0x0001, 0x080c, 0x23c9, 0x080c, 0x5b90,
-	0x012e, 0x000e, 0x00ee, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0bc,
-	0x0158, 0x0026, 0x0036, 0x2011, 0x8017, 0x2001, 0x196a, 0x201c,
-	0x080c, 0x48d1, 0x003e, 0x002e, 0x0005, 0x20a9, 0x0012, 0x20e9,
-	0x0001, 0x20a1, 0x1d80, 0x080c, 0x5caf, 0x20e9, 0x0000, 0x2099,
-	0x026e, 0x0099, 0x20a9, 0x0020, 0x080c, 0x5ca9, 0x2099, 0x0260,
-	0x20a1, 0x1d92, 0x0051, 0x20a9, 0x000e, 0x080c, 0x5cac, 0x2099,
-	0x0260, 0x20a1, 0x1db2, 0x0009, 0x0005, 0x0016, 0x0026, 0x3410,
-	0x3308, 0x2104, 0x8007, 0x2012, 0x8108, 0x8210, 0x1f04, 0x5c29,
-	0x002e, 0x001e, 0x0005, 0x080c, 0x97df, 0x20e1, 0x0001, 0x2099,
-	0x1d00, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003,
-	0x0005, 0x080c, 0x97df, 0x080c, 0x5caf, 0x20e1, 0x0000, 0x2099,
-	0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003,
-	0x0005, 0x00c6, 0x0006, 0x2061, 0x0100, 0x810f, 0x2001, 0x1833,
-	0x2004, 0x9005, 0x1138, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff,
-	0x9105, 0x0010, 0x9185, 0x00f7, 0x604a, 0x000e, 0x00ce, 0x0005,
-	0x0016, 0x0046, 0x080c, 0x665c, 0x0158, 0x9006, 0x2020, 0x2009,
-	0x002a, 0x080c, 0xd251, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102,
-	0x2019, 0x002a, 0x900e, 0x080c, 0x2fc2, 0x080c, 0xbf46, 0x0140,
-	0x0036, 0x2019, 0xffff, 0x2021, 0x0007, 0x080c, 0x4a6e, 0x003e,
-	0x004e, 0x001e, 0x0005, 0x080c, 0x5b90, 0x7097, 0x0000, 0x708f,
-	0x0000, 0x0005, 0x0006, 0x2001, 0x180c, 0x2004, 0xd09c, 0x0100,
-	0x000e, 0x0005, 0x0006, 0x0016, 0x0126, 0x2091, 0x8000, 0x2001,
-	0x0101, 0x200c, 0x918d, 0x0006, 0x2102, 0x012e, 0x001e, 0x000e,
-	0x0005, 0x2009, 0x0001, 0x0020, 0x2009, 0x0002, 0x0008, 0x900e,
-	0x6814, 0x9084, 0xffc0, 0x910d, 0x6916, 0x0005, 0x00f6, 0x0156,
-	0x0146, 0x01d6, 0x9006, 0x20a9, 0x0080, 0x20e9, 0x0001, 0x20a1,
-	0x1d00, 0x4004, 0x2079, 0x1d00, 0x7803, 0x2200, 0x7807, 0x00ef,
-	0x780f, 0x00ef, 0x7813, 0x0138, 0x7823, 0xffff, 0x7827, 0xffff,
-	0x01de, 0x014e, 0x015e, 0x00fe, 0x0005, 0x2001, 0x1800, 0x2003,
-	0x0001, 0x0005, 0x2001, 0x1977, 0x0118, 0x2003, 0x0001, 0x0010,
-	0x2003, 0x0000, 0x0005, 0x0156, 0x20a9, 0x0800, 0x2009, 0x1000,
-	0x9006, 0x200a, 0x8108, 0x1f04, 0x5ce9, 0x015e, 0x0005, 0x00d6,
-	0x0036, 0x0156, 0x0136, 0x0146, 0x2069, 0x1853, 0x9006, 0xb802,
-	0xb8c6, 0xb807, 0x0707, 0xb80a, 0xb80e, 0xb812, 0x9198, 0x3184,
-	0x231d, 0x939c, 0x00ff, 0xbb16, 0x0016, 0x0026, 0xb886, 0x080c,
-	0x9b4b, 0x1120, 0x9192, 0x007e, 0x1208, 0xbb86, 0x20a9, 0x0004,
-	0xb8b4, 0x20e8, 0xb9b8, 0x9198, 0x0006, 0x9006, 0x23a0, 0x4004,
-	0x20a9, 0x0004, 0x9198, 0x000a, 0x23a0, 0x4004, 0x002e, 0x001e,
-	0xb83e, 0xb842, 0xb8be, 0xb8c2, 0xb85e, 0xb862, 0xb866, 0xb86a,
-	0xb86f, 0x0100, 0xb872, 0xb876, 0xb87a, 0xb88a, 0xb88e, 0xb893,
-	0x0008, 0xb896, 0xb89a, 0xb89e, 0xb8ae, 0xb9a2, 0x0096, 0xb8a4,
-	0x904d, 0x0110, 0x080c, 0x1054, 0xb8a7, 0x0000, 0x009e, 0x9006,
-	0xb84a, 0x6810, 0xb83a, 0x680c, 0xb846, 0x6814, 0x9084, 0x00ff,
-	0xb842, 0x014e, 0x013e, 0x015e, 0x003e, 0x00de, 0x0005, 0x0126,
-	0x2091, 0x8000, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000,
-	0x1a04, 0x5dad, 0x9182, 0x0800, 0x1a04, 0x5db1, 0x2001, 0x180c,
-	0x2004, 0x9084, 0x0003, 0x1904, 0x5db7, 0x9188, 0x1000, 0x2104,
-	0x905d, 0x0198, 0xb804, 0x9084, 0x00ff, 0x908e, 0x0006, 0x1188,
-	0xb8a4, 0x900d, 0x1904, 0x5dc9, 0x080c, 0x6123, 0x9006, 0x012e,
-	0x0005, 0x2001, 0x0005, 0x900e, 0x04b8, 0x2001, 0x0028, 0x900e,
-	0x0498, 0x9082, 0x0006, 0x1290, 0x080c, 0x9b4b, 0x1160, 0xb8a0,
-	0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0d10, 0x2001, 0x0029,
-	0x2009, 0x1000, 0x0408, 0x2001, 0x0028, 0x00a8, 0x2009, 0x180c,
-	0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0068, 0xd184, 0x0118,
-	0x2001, 0x0004, 0x0040, 0x2001, 0x0029, 0xb900, 0xd1fc, 0x0118,
-	0x2009, 0x1000, 0x0048, 0x900e, 0x0038, 0x2001, 0x0029, 0x900e,
-	0x0018, 0x2001, 0x0029, 0x900e, 0x9005, 0x012e, 0x0005, 0x2001,
-	0x180c, 0x2004, 0xd084, 0x19d0, 0x9188, 0x1000, 0x2104, 0x9065,
-	0x09a8, 0x080c, 0x6660, 0x1990, 0xb800, 0xd0bc, 0x0978, 0x0804,
-	0x5d70, 0x080c, 0x64d4, 0x0904, 0x5d79, 0x0804, 0x5d74, 0x00e6,
-	0x2071, 0x19b8, 0x7004, 0x9086, 0x0002, 0x1128, 0x7030, 0x9080,
-	0x0004, 0x2004, 0x9b06, 0x00ee, 0x0005, 0x00b6, 0x00e6, 0x0126,
-	0x2091, 0x8000, 0xa974, 0x9182, 0x0800, 0x1a04, 0x5e58, 0x9188,
-	0x1000, 0x2104, 0x905d, 0x0904, 0x5e30, 0xb8a0, 0x9086, 0x007f,
-	0x0178, 0x080c, 0x6668, 0x0160, 0xa994, 0x81ff, 0x0130, 0x908e,
-	0x0004, 0x0130, 0x908e, 0x0005, 0x0118, 0x080c, 0x6660, 0x1598,
-	0xa87c, 0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060, 0x0026,
-	0x2010, 0x080c, 0xb81a, 0x002e, 0x1120, 0x2001, 0x0008, 0x0804,
-	0x5e5a, 0x6020, 0x9086, 0x000a, 0x0120, 0x2001, 0x0008, 0x0804,
-	0x5e5a, 0x601a, 0x6003, 0x0008, 0x2900, 0x6016, 0x0058, 0x080c,
-	0x9b76, 0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b, 0xffff,
-	0x6023, 0x000a, 0x2009, 0x0003, 0x080c, 0x9c6a, 0x9006, 0x0458,
-	0x2001, 0x0028, 0x0438, 0x9082, 0x0006, 0x1290, 0x080c, 0x9b4b,
-	0x1160, 0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0900,
-	0x2001, 0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090,
-	0x2009, 0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050,
-	0xd184, 0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029, 0x0010,
-	0x2001, 0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001,
-	0x002c, 0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000, 0xa8e0,
-	0x9005, 0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8, 0x9005,
-	0x1518, 0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079, 0x1800,
-	0x9182, 0x0800, 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130, 0xaa98,
-	0xab94, 0xa878, 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c, 0x0118,
-	0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010,
-	0x2001, 0x0029, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018,
-	0x2001, 0x0029, 0x900e, 0x9006, 0x0008, 0x9005, 0x012e, 0x00be,
-	0x00fe, 0x0005, 0x5eef, 0x5eaa, 0x5ec1, 0x5eef, 0x5eef, 0x5eef,
-	0x5eef, 0x5eef, 0x2100, 0x9082, 0x007e, 0x1278, 0x080c, 0x6209,
-	0x0148, 0x9046, 0xb810, 0x9306, 0x1904, 0x5ef7, 0xb814, 0x9206,
-	0x15f0, 0x0028, 0xbb12, 0xba16, 0x0010, 0x080c, 0x478b, 0x0150,
-	0x04b0, 0x080c, 0x6269, 0x1598, 0xb810, 0x9306, 0x1580, 0xb814,
-	0x9206, 0x1568, 0x080c, 0x9b76, 0x0530, 0x2b00, 0x6012, 0x080c,
-	0xbcc0, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a, 0xa878,
-	0x9086, 0x0001, 0x1170, 0x080c, 0x3003, 0x9006, 0x080c, 0x61a6,
-	0x2001, 0x0002, 0x080c, 0x61ba, 0x2001, 0x0200, 0xb86e, 0xb893,
-	0x0002, 0x2009, 0x0003, 0x080c, 0x9c6a, 0x9006, 0x0068, 0x2001,
-	0x0001, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001,
-	0x0028, 0x900e, 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe, 0x0005,
-	0x00b6, 0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894, 0x90c6,
-	0x0015, 0x0904, 0x60cc, 0x90c6, 0x0056, 0x0904, 0x60d0, 0x90c6,
-	0x0066, 0x0904, 0x60d4, 0x90c6, 0x0067, 0x0904, 0x60d8, 0x90c6,
-	0x0068, 0x0904, 0x60dc, 0x90c6, 0x0071, 0x0904, 0x60e0, 0x90c6,
-	0x0074, 0x0904, 0x60e4, 0x90c6, 0x007c, 0x0904, 0x60e8, 0x90c6,
-	0x007e, 0x0904, 0x60ec, 0x90c6, 0x0037, 0x0904, 0x60f0, 0x9016,
-	0x2079, 0x1800, 0xa974, 0x9186, 0x00ff, 0x0904, 0x60c7, 0x9182,
-	0x0800, 0x1a04, 0x60c7, 0x080c, 0x6269, 0x1198, 0xb804, 0x9084,
-	0x00ff, 0x9082, 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f, 0x0148,
-	0x080c, 0x9b4b, 0x1904, 0x60b0, 0xb8a0, 0x9084, 0xff80, 0x1904,
-	0x60b0, 0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e, 0x0904,
-	0x6010, 0x90c6, 0x0064, 0x0904, 0x6039, 0x2008, 0x0804, 0x5fd3,
-	0xa998, 0xa8b0, 0x2040, 0x080c, 0x9b4b, 0x1120, 0x9182, 0x007f,
-	0x0a04, 0x5fd3, 0x9186, 0x00ff, 0x0904, 0x5fd3, 0x9182, 0x0800,
-	0x1a04, 0x5fd3, 0xaaa0, 0xab9c, 0x7878, 0x9306, 0x1188, 0x787c,
-	0x0096, 0x924e, 0x1128, 0x2208, 0x2310, 0x009e, 0x0804, 0x5fd3,
-	0x99cc, 0xff00, 0x009e, 0x1120, 0x2208, 0x2310, 0x0804, 0x5fd3,
-	0x080c, 0x478b, 0x0904, 0x5fdc, 0x900e, 0x9016, 0x90c6, 0x4000,
-	0x1558, 0x0006, 0x080c, 0x6558, 0x1108, 0xc185, 0xb800, 0xd0bc,
-	0x0108, 0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080,
-	0x0031, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098,
-	0x080c, 0x0f9f, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080,
-	0x0035, 0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x000a, 0x2098,
-	0x080c, 0x0f9f, 0x000e, 0x00c8, 0x90c6, 0x4007, 0x1110, 0x2408,
-	0x00a0, 0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0070, 0x90c6,
-	0x4009, 0x1108, 0x0050, 0x90c6, 0x4006, 0x0138, 0x2001, 0x4005,
-	0x2009, 0x000a, 0x0010, 0x2001, 0x4006, 0xa896, 0xa99a, 0xaa9e,
-	0x2001, 0x0030, 0x900e, 0x0470, 0x080c, 0x9b76, 0x1130, 0x2001,
-	0x4005, 0x2009, 0x0003, 0x9016, 0x0c80, 0x2b00, 0x6012, 0x080c,
-	0xbcc0, 0x2900, 0x6016, 0x6023, 0x0001, 0xa868, 0xd88c, 0x0108,
-	0xc0f5, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x3003, 0x012e,
-	0x9006, 0x080c, 0x61a6, 0x2001, 0x0002, 0x080c, 0x61ba, 0x2009,
-	0x0002, 0x080c, 0x9c6a, 0xa8b0, 0xd094, 0x0118, 0xb8c4, 0xc08d,
-	0xb8c6, 0x9006, 0x9005, 0x012e, 0x00ee, 0x00fe, 0x00be, 0x0005,
-	0x080c, 0x539a, 0x0118, 0x2009, 0x0007, 0x00f8, 0xa998, 0xaeb0,
-	0x080c, 0x6269, 0x1904, 0x5fce, 0x9186, 0x007f, 0x0130, 0x080c,
-	0x6660, 0x0118, 0x2009, 0x0009, 0x0080, 0x0096, 0x080c, 0x1022,
-	0x1120, 0x009e, 0x2009, 0x0002, 0x0040, 0x2900, 0x009e, 0xa806,
-	0x080c, 0xba18, 0x19b0, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804,
-	0x5fd5, 0xa998, 0xaeb0, 0x080c, 0x6269, 0x1904, 0x5fce, 0x0096,
-	0x080c, 0x1022, 0x1128, 0x009e, 0x2009, 0x0002, 0x0804, 0x608d,
-	0x2900, 0x009e, 0xa806, 0x0096, 0x2048, 0x20a9, 0x002b, 0xb8b4,
-	0x20e0, 0xb8b8, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
-	0x20a0, 0x4003, 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xbbb8,
-	0x9398, 0x0006, 0x2398, 0x080c, 0x0f9f, 0x009e, 0xa87b, 0x0000,
-	0xa883, 0x0000, 0xa897, 0x4000, 0xd684, 0x1168, 0x080c, 0x5386,
-	0xd0b4, 0x1118, 0xa89b, 0x000b, 0x00e0, 0xb800, 0xd08c, 0x0118,
-	0xa89b, 0x000c, 0x00b0, 0x080c, 0x6660, 0x0118, 0xa89b, 0x0009,
-	0x0080, 0x080c, 0x539a, 0x0118, 0xa89b, 0x0007, 0x0050, 0x080c,
-	0xb9fb, 0x1904, 0x6009, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804,
-	0x5fd5, 0xa87b, 0x0030, 0xa897, 0x4005, 0xa804, 0x8006, 0x8006,
-	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009,
-	0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041,
-	0x1266, 0x080c, 0xa0da, 0x1904, 0x6009, 0x2009, 0x0002, 0x08e8,
-	0x2001, 0x0028, 0x900e, 0x0804, 0x600a, 0x2009, 0x180c, 0x210c,
-	0xd18c, 0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001,
-	0x0004, 0x0010, 0x2001, 0x0029, 0x900e, 0x0804, 0x600a, 0x2001,
-	0x0029, 0x900e, 0x0804, 0x600a, 0x080c, 0x35a7, 0x0804, 0x600b,
-	0x080c, 0x50bb, 0x0804, 0x600b, 0x080c, 0x434d, 0x0804, 0x600b,
-	0x080c, 0x43c6, 0x0804, 0x600b, 0x080c, 0x4422, 0x0804, 0x600b,
-	0x080c, 0x4847, 0x0804, 0x600b, 0x080c, 0x4af3, 0x0804, 0x600b,
-	0x080c, 0x4d26, 0x0804, 0x600b, 0x080c, 0x4f1f, 0x0804, 0x600b,
-	0x080c, 0x37bc, 0x0804, 0x600b, 0x00b6, 0xa974, 0xae78, 0x9684,
-	0x3fff, 0x9082, 0x4000, 0x1608, 0x9182, 0x0800, 0x1258, 0x9188,
-	0x1000, 0x2104, 0x905d, 0x0130, 0x080c, 0x6660, 0x1138, 0x00d9,
-	0x9006, 0x00b0, 0x2001, 0x0028, 0x900e, 0x0090, 0x9082, 0x0006,
-	0x1240, 0xb900, 0xd1fc, 0x0d98, 0x2001, 0x0029, 0x2009, 0x1000,
-	0x0038, 0x2001, 0x0029, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e,
-	0x9005, 0x00be, 0x0005, 0xa877, 0x0000, 0xb8c0, 0x9005, 0x1904,
-	0x619a, 0xb888, 0x9005, 0x1904, 0x619a, 0xb838, 0xb93c, 0x9102,
-	0x1a04, 0x619a, 0x2b10, 0x080c, 0x9ba3, 0x0904, 0x6196, 0x8108,
-	0xb93e, 0x6212, 0x2900, 0x6016, 0x6023, 0x0003, 0x600b, 0xffff,
+	0x0014, 0x080c, 0x5b6b, 0x00fe, 0x0005, 0x00f6, 0x708c, 0x9005,
+	0x05f0, 0x2011, 0x5b41, 0x080c, 0x8159, 0x9086, 0x0014, 0x15a8,
+	0x080c, 0x5cb6, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1105, 0x1568,
+	0x7834, 0x9084, 0x0100, 0x2011, 0x0100, 0x921e, 0x1168, 0x9085,
+	0x0001, 0x080c, 0x5ce1, 0x7a38, 0xd2fc, 0x0128, 0x70c0, 0x9005,
+	0x1110, 0x70c3, 0x0001, 0x0080, 0x9005, 0x11b8, 0x7a38, 0xd2fc,
+	0x0128, 0x70c0, 0x9005, 0x1110, 0x70c3, 0x0001, 0x9085, 0x0001,
+	0x080c, 0x5ce1, 0x7093, 0x0000, 0x7a38, 0xd2f4, 0x0110, 0x70db,
+	0x0008, 0x7097, 0x0016, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe,
+	0x0005, 0x080c, 0x97fa, 0x080c, 0x5cb6, 0x20e1, 0x0000, 0x2099,
+	0x0260, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000e, 0x4003,
+	0x2011, 0x026d, 0x2204, 0x9084, 0x0100, 0x2011, 0x024d, 0x2012,
+	0x2011, 0x026e, 0x7097, 0x0017, 0x080c, 0x5c99, 0x1150, 0x7080,
+	0x9005, 0x1138, 0x080c, 0x5a61, 0x1188, 0x9085, 0x0001, 0x080c,
+	0x248d, 0x20a9, 0x0008, 0x080c, 0x5cb6, 0x20e1, 0x0000, 0x2099,
+	0x026e, 0x20e9, 0x0000, 0x20a1, 0x024e, 0x4003, 0x60c3, 0x0014,
+	0x080c, 0x5b6b, 0x0010, 0x080c, 0x55bb, 0x0005, 0x00f6, 0x708c,
+	0x9005, 0x01d8, 0x2011, 0x5b41, 0x080c, 0x8159, 0x9086, 0x0084,
+	0x1190, 0x080c, 0x5cb6, 0x2079, 0x0260, 0x7a30, 0x9296, 0x1106,
+	0x1150, 0x7834, 0x9005, 0x1138, 0x9006, 0x080c, 0x5ce1, 0x7097,
+	0x0018, 0x0029, 0x0010, 0x708f, 0x0000, 0x00fe, 0x0005, 0x00f6,
+	0x7097, 0x0019, 0x080c, 0x5c48, 0x2079, 0x0240, 0x7833, 0x1106,
+	0x7837, 0x0000, 0x080c, 0x5cb6, 0x2009, 0x026e, 0x2039, 0x1d0e,
+	0x20a9, 0x0040, 0x213e, 0x8738, 0x8108, 0x9186, 0x0280, 0x1128,
+	0x6814, 0x8000, 0x6816, 0x2009, 0x0260, 0x1f04, 0x59ca, 0x2039,
+	0x1d0e, 0x080c, 0x5c99, 0x11e8, 0x2728, 0x2514, 0x8207, 0x9084,
+	0x00ff, 0x8000, 0x2018, 0x9294, 0x00ff, 0x8007, 0x9205, 0x202a,
+	0x705c, 0x2310, 0x8214, 0x92a0, 0x1d0e, 0x2414, 0x938c, 0x0001,
+	0x0118, 0x9294, 0xff00, 0x0018, 0x9294, 0x00ff, 0x8007, 0x9215,
+	0x2222, 0x20a9, 0x0040, 0x2009, 0x024e, 0x270e, 0x8738, 0x8108,
+	0x9186, 0x0260, 0x1128, 0x6810, 0x8000, 0x6812, 0x2009, 0x0240,
+	0x1f04, 0x59fd, 0x60c3, 0x0084, 0x080c, 0x5b6b, 0x00fe, 0x0005,
+	0x00f6, 0x708c, 0x9005, 0x01e0, 0x2011, 0x5b41, 0x080c, 0x8159,
+	0x9086, 0x0084, 0x1198, 0x080c, 0x5cb6, 0x2079, 0x0260, 0x7a30,
+	0x9296, 0x1107, 0x1158, 0x7834, 0x9005, 0x1140, 0x7093, 0x0001,
+	0x080c, 0x5c0c, 0x7097, 0x001a, 0x0029, 0x0010, 0x708f, 0x0000,
+	0x00fe, 0x0005, 0x9085, 0x0001, 0x080c, 0x5ce1, 0x7097, 0x001b,
+	0x080c, 0x97fa, 0x080c, 0x5cb6, 0x2011, 0x0260, 0x2009, 0x0240,
+	0x748c, 0x9480, 0x0018, 0x9080, 0x0007, 0x9084, 0x03f8, 0x8004,
+	0x20a8, 0x220e, 0x8210, 0x8108, 0x9186, 0x0260, 0x1150, 0x6810,
+	0x8000, 0x6812, 0x2009, 0x0240, 0x6814, 0x8000, 0x6816, 0x2011,
+	0x0260, 0x1f04, 0x5a49, 0x60c3, 0x0084, 0x080c, 0x5b6b, 0x0005,
+	0x0005, 0x0086, 0x0096, 0x2029, 0x1854, 0x252c, 0x20a9, 0x0008,
+	0x2041, 0x1d0e, 0x20e9, 0x0001, 0x28a0, 0x080c, 0x5cb6, 0x20e1,
+	0x0000, 0x2099, 0x026e, 0x4003, 0x20a9, 0x0008, 0x2011, 0x0007,
+	0xd5d4, 0x0108, 0x9016, 0x2800, 0x9200, 0x200c, 0x91a6, 0xffff,
+	0x1148, 0xd5d4, 0x0110, 0x8210, 0x0008, 0x8211, 0x1f04, 0x5a7b,
+	0x0804, 0x5aea, 0x82ff, 0x1160, 0xd5d4, 0x0120, 0x91a6, 0x3fff,
+	0x0d90, 0x0020, 0x91a6, 0x3fff, 0x0904, 0x5aea, 0x918d, 0xc000,
+	0x20a9, 0x0010, 0x2019, 0x0001, 0xd5d4, 0x0110, 0x2019, 0x0010,
+	0x2120, 0xd5d4, 0x0110, 0x8423, 0x0008, 0x8424, 0x1240, 0xd5d4,
+	0x0110, 0x8319, 0x0008, 0x8318, 0x1f04, 0x5aa1, 0x04d8, 0x23a8,
+	0x2021, 0x0001, 0x8426, 0x8425, 0x1f04, 0x5ab3, 0x2328, 0x8529,
+	0x92be, 0x0007, 0x0158, 0x0006, 0x2039, 0x0007, 0x2200, 0x973a,
+	0x000e, 0x27a8, 0x95a8, 0x0010, 0x1f04, 0x5ac2, 0x755a, 0x95c8,
+	0x318b, 0x292d, 0x95ac, 0x00ff, 0x757e, 0x6532, 0x6536, 0x0016,
+	0x2508, 0x080c, 0x246d, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x2018,
+	0x2304, 0x9405, 0x201a, 0x7083, 0x0001, 0x20e9, 0x0000, 0x20a1,
+	0x024e, 0x20e1, 0x0001, 0x2898, 0x20a9, 0x0008, 0x4003, 0x9085,
+	0x0001, 0x0008, 0x9006, 0x009e, 0x008e, 0x0005, 0x0156, 0x01c6,
+	0x01d6, 0x0136, 0x0146, 0x22a8, 0x20e1, 0x0000, 0x2099, 0x026e,
+	0x20e9, 0x0000, 0x2011, 0x024e, 0x22a0, 0x4003, 0x014e, 0x013e,
+	0x01de, 0x01ce, 0x015e, 0x2118, 0x9026, 0x2001, 0x0007, 0x939a,
+	0x0010, 0x0218, 0x8420, 0x8001, 0x0cd0, 0x2118, 0x84ff, 0x0120,
+	0x939a, 0x0010, 0x8421, 0x1de0, 0x2021, 0x0001, 0x83ff, 0x0118,
+	0x8423, 0x8319, 0x1de8, 0x9238, 0x2029, 0x026e, 0x9528, 0x2504,
+	0x942c, 0x11b8, 0x9405, 0x203a, 0x715a, 0x91a0, 0x318b, 0x242d,
+	0x95ac, 0x00ff, 0x757e, 0x6532, 0x6536, 0x0016, 0x2508, 0x080c,
+	0x246d, 0x001e, 0x60e7, 0x0000, 0x65ea, 0x7083, 0x0001, 0x9084,
+	0x0000, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7087, 0x0000, 0x00ee,
+	0x0005, 0x00e6, 0x00f6, 0x2079, 0x0100, 0x2071, 0x0140, 0x080c,
+	0x5bfb, 0x080c, 0x8fb7, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c,
+	0x2843, 0x0126, 0x2091, 0x8000, 0x2071, 0x1825, 0x2073, 0x0000,
+	0x7840, 0x0026, 0x0016, 0x2009, 0x00f7, 0x080c, 0x5c58, 0x001e,
+	0x9094, 0x0010, 0x9285, 0x0080, 0x7842, 0x7a42, 0x002e, 0x012e,
+	0x00fe, 0x00ee, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x27a2,
+	0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x2011, 0x19c5,
+	0x2013, 0x0000, 0x708f, 0x0000, 0x012e, 0x60a3, 0x0056, 0x60a7,
+	0x9575, 0x080c, 0x8faa, 0x6144, 0xd184, 0x0120, 0x7194, 0x918d,
+	0x2000, 0x0018, 0x7188, 0x918d, 0x1000, 0x2011, 0x196a, 0x2112,
+	0x2009, 0x07d0, 0x2011, 0x5b41, 0x080c, 0x821d, 0x0005, 0x0016,
+	0x0026, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x98c8, 0x080c,
+	0x9b6d, 0x080c, 0x98e4, 0x2009, 0x00f7, 0x080c, 0x5c58, 0x2061,
+	0x19d4, 0x900e, 0x611a, 0x611e, 0x6172, 0x6176, 0x2061, 0x1800,
+	0x6003, 0x0001, 0x2061, 0x0100, 0x6043, 0x0090, 0x6043, 0x0010,
+	0x2009, 0x196a, 0x200b, 0x0000, 0x2009, 0x002d, 0x2011, 0x5bc7,
+	0x080c, 0x814d, 0x012e, 0x00ce, 0x002e, 0x001e, 0x0005, 0x00e6,
+	0x0006, 0x0126, 0x2091, 0x8000, 0x0471, 0x2071, 0x0100, 0x080c,
+	0x8fb7, 0x2071, 0x0140, 0x7004, 0x9084, 0x4000, 0x0110, 0x080c,
+	0x2843, 0x080c, 0x70bf, 0x0188, 0x080c, 0x70da, 0x1170, 0x080c,
+	0x73c1, 0x0016, 0x080c, 0x253c, 0x2001, 0x193e, 0x2102, 0x001e,
+	0x080c, 0x73bc, 0x080c, 0x6fe8, 0x0050, 0x2009, 0x0001, 0x080c,
+	0x281f, 0x2001, 0x0001, 0x080c, 0x23c9, 0x080c, 0x5b97, 0x012e,
+	0x000e, 0x00ee, 0x0005, 0x2001, 0x180e, 0x2004, 0xd0bc, 0x0158,
+	0x0026, 0x0036, 0x2011, 0x8017, 0x2001, 0x196a, 0x201c, 0x080c,
+	0x48d8, 0x003e, 0x002e, 0x0005, 0x20a9, 0x0012, 0x20e9, 0x0001,
+	0x20a1, 0x1d80, 0x080c, 0x5cb6, 0x20e9, 0x0000, 0x2099, 0x026e,
+	0x0099, 0x20a9, 0x0020, 0x080c, 0x5cb0, 0x2099, 0x0260, 0x20a1,
+	0x1d92, 0x0051, 0x20a9, 0x000e, 0x080c, 0x5cb3, 0x2099, 0x0260,
+	0x20a1, 0x1db2, 0x0009, 0x0005, 0x0016, 0x0026, 0x3410, 0x3308,
+	0x2104, 0x8007, 0x2012, 0x8108, 0x8210, 0x1f04, 0x5c30, 0x002e,
+	0x001e, 0x0005, 0x080c, 0x97fa, 0x20e1, 0x0001, 0x2099, 0x1d00,
+	0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005,
+	0x080c, 0x97fa, 0x080c, 0x5cb6, 0x20e1, 0x0000, 0x2099, 0x0260,
+	0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000c, 0x4003, 0x0005,
+	0x00c6, 0x0006, 0x2061, 0x0100, 0x810f, 0x2001, 0x1833, 0x2004,
+	0x9005, 0x1138, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff, 0x9105,
+	0x0010, 0x9185, 0x00f7, 0x604a, 0x000e, 0x00ce, 0x0005, 0x0016,
+	0x0046, 0x080c, 0x6663, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a,
+	0x080c, 0xd273, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019,
+	0x002a, 0x900e, 0x080c, 0x2fc5, 0x080c, 0xbf61, 0x0140, 0x0036,
+	0x2019, 0xffff, 0x2021, 0x0007, 0x080c, 0x4a75, 0x003e, 0x004e,
+	0x001e, 0x0005, 0x080c, 0x5b97, 0x7097, 0x0000, 0x708f, 0x0000,
+	0x0005, 0x0006, 0x2001, 0x180c, 0x2004, 0xd09c, 0x0100, 0x000e,
+	0x0005, 0x0006, 0x0016, 0x0126, 0x2091, 0x8000, 0x2001, 0x0101,
+	0x200c, 0x918d, 0x0006, 0x2102, 0x012e, 0x001e, 0x000e, 0x0005,
+	0x2009, 0x0001, 0x0020, 0x2009, 0x0002, 0x0008, 0x900e, 0x6814,
+	0x9084, 0xffc0, 0x910d, 0x6916, 0x0005, 0x00f6, 0x0156, 0x0146,
+	0x01d6, 0x9006, 0x20a9, 0x0080, 0x20e9, 0x0001, 0x20a1, 0x1d00,
+	0x4004, 0x2079, 0x1d00, 0x7803, 0x2200, 0x7807, 0x00ef, 0x780f,
+	0x00ef, 0x7813, 0x0138, 0x7823, 0xffff, 0x7827, 0xffff, 0x01de,
+	0x014e, 0x015e, 0x00fe, 0x0005, 0x2001, 0x1800, 0x2003, 0x0001,
+	0x0005, 0x2001, 0x1977, 0x0118, 0x2003, 0x0001, 0x0010, 0x2003,
+	0x0000, 0x0005, 0x0156, 0x20a9, 0x0800, 0x2009, 0x1000, 0x9006,
+	0x200a, 0x8108, 0x1f04, 0x5cf0, 0x015e, 0x0005, 0x00d6, 0x0036,
+	0x0156, 0x0136, 0x0146, 0x2069, 0x1853, 0x9006, 0xb802, 0xb8c6,
+	0xb807, 0x0707, 0xb80a, 0xb80e, 0xb812, 0x9198, 0x318b, 0x231d,
+	0x939c, 0x00ff, 0xbb16, 0x0016, 0x0026, 0xb886, 0x080c, 0x9b66,
+	0x1120, 0x9192, 0x007e, 0x1208, 0xbb86, 0x20a9, 0x0004, 0xb8b4,
+	0x20e8, 0xb9b8, 0x9198, 0x0006, 0x9006, 0x23a0, 0x4004, 0x20a9,
+	0x0004, 0x9198, 0x000a, 0x23a0, 0x4004, 0x002e, 0x001e, 0xb83e,
+	0xb842, 0xb8be, 0xb8c2, 0xb85e, 0xb862, 0xb866, 0xb86a, 0xb86f,
+	0x0100, 0xb872, 0xb876, 0xb87a, 0xb88a, 0xb88e, 0xb893, 0x0008,
+	0xb896, 0xb89a, 0xb89e, 0xb8ae, 0xb9a2, 0x0096, 0xb8a4, 0x904d,
+	0x0110, 0x080c, 0x1054, 0xb8a7, 0x0000, 0x009e, 0x9006, 0xb84a,
+	0x6810, 0xb83a, 0x680c, 0xb846, 0x6814, 0x9084, 0x00ff, 0xb842,
+	0x014e, 0x013e, 0x015e, 0x003e, 0x00de, 0x0005, 0x0126, 0x2091,
+	0x8000, 0xa974, 0xae78, 0x9684, 0x3fff, 0x9082, 0x4000, 0x1a04,
+	0x5db4, 0x9182, 0x0800, 0x1a04, 0x5db8, 0x2001, 0x180c, 0x2004,
+	0x9084, 0x0003, 0x1904, 0x5dbe, 0x9188, 0x1000, 0x2104, 0x905d,
+	0x0198, 0xb804, 0x9084, 0x00ff, 0x908e, 0x0006, 0x1188, 0xb8a4,
+	0x900d, 0x1904, 0x5dd0, 0x080c, 0x612a, 0x9006, 0x012e, 0x0005,
+	0x2001, 0x0005, 0x900e, 0x04b8, 0x2001, 0x0028, 0x900e, 0x0498,
+	0x9082, 0x0006, 0x1290, 0x080c, 0x9b66, 0x1160, 0xb8a0, 0x9084,
+	0xff80, 0x1140, 0xb900, 0xd1fc, 0x0d10, 0x2001, 0x0029, 0x2009,
+	0x1000, 0x0408, 0x2001, 0x0028, 0x00a8, 0x2009, 0x180c, 0x210c,
+	0xd18c, 0x0118, 0x2001, 0x0004, 0x0068, 0xd184, 0x0118, 0x2001,
+	0x0004, 0x0040, 0x2001, 0x0029, 0xb900, 0xd1fc, 0x0118, 0x2009,
+	0x1000, 0x0048, 0x900e, 0x0038, 0x2001, 0x0029, 0x900e, 0x0018,
+	0x2001, 0x0029, 0x900e, 0x9005, 0x012e, 0x0005, 0x2001, 0x180c,
+	0x2004, 0xd084, 0x19d0, 0x9188, 0x1000, 0x2104, 0x9065, 0x09a8,
+	0x080c, 0x6667, 0x1990, 0xb800, 0xd0bc, 0x0978, 0x0804, 0x5d77,
+	0x080c, 0x64db, 0x0904, 0x5d80, 0x0804, 0x5d7b, 0x00e6, 0x2071,
+	0x19b8, 0x7004, 0x9086, 0x0002, 0x1128, 0x7030, 0x9080, 0x0004,
+	0x2004, 0x9b06, 0x00ee, 0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091,
+	0x8000, 0xa974, 0x9182, 0x0800, 0x1a04, 0x5e5f, 0x9188, 0x1000,
+	0x2104, 0x905d, 0x0904, 0x5e37, 0xb8a0, 0x9086, 0x007f, 0x0178,
+	0x080c, 0x666f, 0x0160, 0xa994, 0x81ff, 0x0130, 0x908e, 0x0004,
+	0x0130, 0x908e, 0x0005, 0x0118, 0x080c, 0x6667, 0x1598, 0xa87c,
+	0xd0fc, 0x01e0, 0xa894, 0x9005, 0x01c8, 0x2060, 0x0026, 0x2010,
+	0x080c, 0xb835, 0x002e, 0x1120, 0x2001, 0x0008, 0x0804, 0x5e61,
+	0x6020, 0x9086, 0x000a, 0x0120, 0x2001, 0x0008, 0x0804, 0x5e61,
+	0x601a, 0x6003, 0x0008, 0x2900, 0x6016, 0x0058, 0x080c, 0x9b91,
+	0x05e8, 0x2b00, 0x6012, 0x2900, 0x6016, 0x600b, 0xffff, 0x6023,
+	0x000a, 0x2009, 0x0003, 0x080c, 0x9c85, 0x9006, 0x0458, 0x2001,
+	0x0028, 0x0438, 0x9082, 0x0006, 0x1290, 0x080c, 0x9b66, 0x1160,
+	0xb8a0, 0x9084, 0xff80, 0x1140, 0xb900, 0xd1fc, 0x0900, 0x2001,
+	0x0029, 0x2009, 0x1000, 0x00a8, 0x2001, 0x0028, 0x0090, 0x2009,
+	0x180c, 0x210c, 0xd18c, 0x0118, 0x2001, 0x0004, 0x0050, 0xd184,
+	0x0118, 0x2001, 0x0004, 0x0028, 0x2001, 0x0029, 0x0010, 0x2001,
+	0x0029, 0x9005, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2001, 0x002c,
+	0x0cc0, 0x00f6, 0x00b6, 0x0126, 0x2091, 0x8000, 0xa8e0, 0x9005,
+	0x1550, 0xa8dc, 0x9082, 0x0101, 0x1630, 0xa8c8, 0x9005, 0x1518,
+	0xa8c4, 0x9082, 0x0101, 0x12f8, 0xa974, 0x2079, 0x1800, 0x9182,
+	0x0800, 0x12e8, 0x7830, 0x9084, 0x0003, 0x1130, 0xaa98, 0xab94,
+	0xa878, 0x9084, 0x0007, 0x00ea, 0x7930, 0xd18c, 0x0118, 0x2001,
+	0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004, 0x0010, 0x2001,
+	0x0029, 0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001,
+	0x0029, 0x900e, 0x9006, 0x0008, 0x9005, 0x012e, 0x00be, 0x00fe,
+	0x0005, 0x5ef6, 0x5eb1, 0x5ec8, 0x5ef6, 0x5ef6, 0x5ef6, 0x5ef6,
+	0x5ef6, 0x2100, 0x9082, 0x007e, 0x1278, 0x080c, 0x6210, 0x0148,
+	0x9046, 0xb810, 0x9306, 0x1904, 0x5efe, 0xb814, 0x9206, 0x15f0,
+	0x0028, 0xbb12, 0xba16, 0x0010, 0x080c, 0x4792, 0x0150, 0x04b0,
+	0x080c, 0x6270, 0x1598, 0xb810, 0x9306, 0x1580, 0xb814, 0x9206,
+	0x1568, 0x080c, 0x9b91, 0x0530, 0x2b00, 0x6012, 0x080c, 0xbcdb,
+	0x2900, 0x6016, 0x600b, 0xffff, 0x6023, 0x000a, 0xa878, 0x9086,
+	0x0001, 0x1170, 0x080c, 0x3006, 0x9006, 0x080c, 0x61ad, 0x2001,
+	0x0002, 0x080c, 0x61c1, 0x2001, 0x0200, 0xb86e, 0xb893, 0x0002,
+	0x2009, 0x0003, 0x080c, 0x9c85, 0x9006, 0x0068, 0x2001, 0x0001,
+	0x900e, 0x0038, 0x2001, 0x002c, 0x900e, 0x0018, 0x2001, 0x0028,
+	0x900e, 0x9005, 0x0000, 0x012e, 0x00be, 0x00fe, 0x0005, 0x00b6,
+	0x00f6, 0x00e6, 0x0126, 0x2091, 0x8000, 0xa894, 0x90c6, 0x0015,
+	0x0904, 0x60d3, 0x90c6, 0x0056, 0x0904, 0x60d7, 0x90c6, 0x0066,
+	0x0904, 0x60db, 0x90c6, 0x0067, 0x0904, 0x60df, 0x90c6, 0x0068,
+	0x0904, 0x60e3, 0x90c6, 0x0071, 0x0904, 0x60e7, 0x90c6, 0x0074,
+	0x0904, 0x60eb, 0x90c6, 0x007c, 0x0904, 0x60ef, 0x90c6, 0x007e,
+	0x0904, 0x60f3, 0x90c6, 0x0037, 0x0904, 0x60f7, 0x9016, 0x2079,
+	0x1800, 0xa974, 0x9186, 0x00ff, 0x0904, 0x60ce, 0x9182, 0x0800,
+	0x1a04, 0x60ce, 0x080c, 0x6270, 0x1198, 0xb804, 0x9084, 0x00ff,
+	0x9082, 0x0006, 0x1268, 0xa894, 0x90c6, 0x006f, 0x0148, 0x080c,
+	0x9b66, 0x1904, 0x60b7, 0xb8a0, 0x9084, 0xff80, 0x1904, 0x60b7,
+	0xa894, 0x90c6, 0x006f, 0x0158, 0x90c6, 0x005e, 0x0904, 0x6017,
+	0x90c6, 0x0064, 0x0904, 0x6040, 0x2008, 0x0804, 0x5fda, 0xa998,
+	0xa8b0, 0x2040, 0x080c, 0x9b66, 0x1120, 0x9182, 0x007f, 0x0a04,
+	0x5fda, 0x9186, 0x00ff, 0x0904, 0x5fda, 0x9182, 0x0800, 0x1a04,
+	0x5fda, 0xaaa0, 0xab9c, 0x7878, 0x9306, 0x1188, 0x787c, 0x0096,
+	0x924e, 0x1128, 0x2208, 0x2310, 0x009e, 0x0804, 0x5fda, 0x99cc,
+	0xff00, 0x009e, 0x1120, 0x2208, 0x2310, 0x0804, 0x5fda, 0x080c,
+	0x4792, 0x0904, 0x5fe3, 0x900e, 0x9016, 0x90c6, 0x4000, 0x1558,
+	0x0006, 0x080c, 0x655f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
+	0xc18d, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031,
+	0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098, 0x080c,
+	0x0f9f, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0035,
+	0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x000a, 0x2098, 0x080c,
+	0x0f9f, 0x000e, 0x00c8, 0x90c6, 0x4007, 0x1110, 0x2408, 0x00a0,
+	0x90c6, 0x4008, 0x1118, 0x2708, 0x2610, 0x0070, 0x90c6, 0x4009,
+	0x1108, 0x0050, 0x90c6, 0x4006, 0x0138, 0x2001, 0x4005, 0x2009,
+	0x000a, 0x0010, 0x2001, 0x4006, 0xa896, 0xa99a, 0xaa9e, 0x2001,
+	0x0030, 0x900e, 0x0470, 0x080c, 0x9b91, 0x1130, 0x2001, 0x4005,
+	0x2009, 0x0003, 0x9016, 0x0c80, 0x2b00, 0x6012, 0x080c, 0xbcdb,
+	0x2900, 0x6016, 0x6023, 0x0001, 0xa868, 0xd88c, 0x0108, 0xc0f5,
+	0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x3006, 0x012e, 0x9006,
+	0x080c, 0x61ad, 0x2001, 0x0002, 0x080c, 0x61c1, 0x2009, 0x0002,
+	0x080c, 0x9c85, 0xa8b0, 0xd094, 0x0118, 0xb8c4, 0xc08d, 0xb8c6,
+	0x9006, 0x9005, 0x012e, 0x00ee, 0x00fe, 0x00be, 0x0005, 0x080c,
+	0x53a1, 0x0118, 0x2009, 0x0007, 0x00f8, 0xa998, 0xaeb0, 0x080c,
+	0x6270, 0x1904, 0x5fd5, 0x9186, 0x007f, 0x0130, 0x080c, 0x6667,
+	0x0118, 0x2009, 0x0009, 0x0080, 0x0096, 0x080c, 0x1022, 0x1120,
+	0x009e, 0x2009, 0x0002, 0x0040, 0x2900, 0x009e, 0xa806, 0x080c,
+	0xba33, 0x19b0, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804, 0x5fdc,
+	0xa998, 0xaeb0, 0x080c, 0x6270, 0x1904, 0x5fd5, 0x0096, 0x080c,
+	0x1022, 0x1128, 0x009e, 0x2009, 0x0002, 0x0804, 0x6094, 0x2900,
+	0x009e, 0xa806, 0x0096, 0x2048, 0x20a9, 0x002b, 0xb8b4, 0x20e0,
+	0xb8b8, 0x2098, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0,
+	0x4003, 0x20a9, 0x0008, 0x9080, 0x0006, 0x20a0, 0xbbb8, 0x9398,
+	0x0006, 0x2398, 0x080c, 0x0f9f, 0x009e, 0xa87b, 0x0000, 0xa883,
+	0x0000, 0xa897, 0x4000, 0xd684, 0x1168, 0x080c, 0x538d, 0xd0b4,
+	0x1118, 0xa89b, 0x000b, 0x00e0, 0xb800, 0xd08c, 0x0118, 0xa89b,
+	0x000c, 0x00b0, 0x080c, 0x6667, 0x0118, 0xa89b, 0x0009, 0x0080,
+	0x080c, 0x53a1, 0x0118, 0xa89b, 0x0007, 0x0050, 0x080c, 0xba16,
+	0x1904, 0x6010, 0x2009, 0x0003, 0x2001, 0x4005, 0x0804, 0x5fdc,
+	0xa87b, 0x0030, 0xa897, 0x4005, 0xa804, 0x8006, 0x8006, 0x8007,
+	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b,
+	0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x1266,
+	0x080c, 0xa0f5, 0x1904, 0x6010, 0x2009, 0x0002, 0x08e8, 0x2001,
+	0x0028, 0x900e, 0x0804, 0x6011, 0x2009, 0x180c, 0x210c, 0xd18c,
+	0x0118, 0x2001, 0x0004, 0x0038, 0xd184, 0x0118, 0x2001, 0x0004,
+	0x0010, 0x2001, 0x0029, 0x900e, 0x0804, 0x6011, 0x2001, 0x0029,
+	0x900e, 0x0804, 0x6011, 0x080c, 0x35ae, 0x0804, 0x6012, 0x080c,
+	0x50c2, 0x0804, 0x6012, 0x080c, 0x4354, 0x0804, 0x6012, 0x080c,
+	0x43cd, 0x0804, 0x6012, 0x080c, 0x4429, 0x0804, 0x6012, 0x080c,
+	0x484e, 0x0804, 0x6012, 0x080c, 0x4afa, 0x0804, 0x6012, 0x080c,
+	0x4d2d, 0x0804, 0x6012, 0x080c, 0x4f26, 0x0804, 0x6012, 0x080c,
+	0x37c3, 0x0804, 0x6012, 0x00b6, 0xa974, 0xae78, 0x9684, 0x3fff,
+	0x9082, 0x4000, 0x1608, 0x9182, 0x0800, 0x1258, 0x9188, 0x1000,
+	0x2104, 0x905d, 0x0130, 0x080c, 0x6667, 0x1138, 0x00d9, 0x9006,
+	0x00b0, 0x2001, 0x0028, 0x900e, 0x0090, 0x9082, 0x0006, 0x1240,
+	0xb900, 0xd1fc, 0x0d98, 0x2001, 0x0029, 0x2009, 0x1000, 0x0038,
+	0x2001, 0x0029, 0x900e, 0x0018, 0x2001, 0x0029, 0x900e, 0x9005,
+	0x00be, 0x0005, 0xa877, 0x0000, 0xb8c0, 0x9005, 0x1904, 0x61a1,
+	0xb888, 0x9005, 0x1904, 0x61a1, 0xb838, 0xb93c, 0x9102, 0x1a04,
+	0x61a1, 0x2b10, 0x080c, 0x9bbe, 0x0904, 0x619d, 0x8108, 0xb93e,
+	0x6212, 0x2900, 0x6016, 0x6023, 0x0003, 0x600b, 0xffff, 0x6007,
+	0x0040, 0xa878, 0x605e, 0xa880, 0x9084, 0x00ff, 0x6066, 0xa883,
+	0x0000, 0xa87c, 0xd0ac, 0x05c0, 0xc0dd, 0xa87e, 0xa888, 0x8001,
+	0x1568, 0x2001, 0x00f8, 0x8001, 0xa001, 0xa001, 0xa001, 0x1dd8,
+	0xa816, 0xa864, 0x9094, 0x00f7, 0x9296, 0x0011, 0x11f8, 0x9084,
+	0x00ff, 0xc0bd, 0x601e, 0xa8ac, 0xaab0, 0xa836, 0xaa3a, 0x2001,
+	0x000f, 0x8001, 0x1df0, 0x2001, 0x8004, 0x6003, 0x0004, 0x6046,
+	0x00f6, 0x2079, 0x0380, 0x7818, 0xd0bc, 0x1de8, 0x7833, 0x0010,
+	0x2c00, 0x7836, 0x781b, 0x8080, 0x00fe, 0x0005, 0x080c, 0x164f,
+	0x601c, 0xc0bd, 0x601e, 0x0c38, 0x0006, 0x2001, 0x00e8, 0x8001,
+	0xa001, 0xa001, 0xa001, 0x1dd8, 0x000e, 0xd0b4, 0x190c, 0x1ad2,
+	0x2001, 0x8004, 0x6003, 0x0002, 0x08d0, 0x81ff, 0x1110, 0xb88b,
+	0x0001, 0x2908, 0xb8bc, 0xb9be, 0x9005, 0x1110, 0xb9c2, 0x0020,
+	0x0096, 0x2048, 0xa902, 0x009e, 0x0005, 0x00b6, 0x0126, 0x00c6,
+	0x0026, 0x2091, 0x8000, 0x6210, 0x2258, 0xba00, 0x9005, 0x0110,
+	0xc285, 0x0008, 0xc284, 0xba02, 0x002e, 0x00ce, 0x012e, 0x00be,
+	0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210, 0x2258,
+	0xba04, 0x0006, 0x9086, 0x0006, 0x1170, 0xb89c, 0xd0ac, 0x0158,
+	0x080c, 0x6663, 0x0140, 0x9284, 0xff00, 0x8007, 0x9086, 0x0007,
+	0x1110, 0x2011, 0x0600, 0x000e, 0x9294, 0xff00, 0x9215, 0xba06,
+	0x0006, 0x9086, 0x0006, 0x1120, 0xba90, 0x82ff, 0x090c, 0x0d65,
+	0x000e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6,
+	0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006, 0x9086, 0x0006,
+	0x1168, 0xb89c, 0xd0a4, 0x0150, 0x080c, 0x665f, 0x1138, 0x9284,
+	0x00ff, 0x9086, 0x0007, 0x1110, 0x2011, 0x0006, 0x000e, 0x9294,
+	0x00ff, 0x8007, 0x9215, 0xba06, 0x00ce, 0x012e, 0x00be, 0x0005,
+	0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0005, 0x00d6, 0x0026,
+	0x9190, 0x1000, 0x2204, 0x905d, 0x1180, 0x0096, 0x080c, 0x1022,
+	0x2958, 0x009e, 0x0160, 0x2b00, 0x2012, 0xb85c, 0xb8ba, 0xb860,
+	0xb8b6, 0x9006, 0xb8a6, 0x080c, 0x5cf6, 0x9006, 0x0010, 0x9085,
+	0x0001, 0x002e, 0x00de, 0x0005, 0x00b6, 0x0096, 0x0126, 0x2091,
+	0x8000, 0x0026, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0458,
+	0x00d6, 0x9190, 0x1000, 0x2204, 0x905d, 0x0518, 0x2013, 0x0000,
+	0xb8a4, 0x904d, 0x0110, 0x080c, 0x1054, 0x00d6, 0x00c6, 0xb8ac,
+	0x2060, 0x8cff, 0x0168, 0x600c, 0x0006, 0x6014, 0x2048, 0x080c,
+	0xb847, 0x0110, 0x080c, 0x0fd4, 0x080c, 0x9be7, 0x00ce, 0x0c88,
+	0x00ce, 0x00de, 0x2b48, 0xb8b8, 0xb85e, 0xb8b4, 0xb862, 0x080c,
+	0x1064, 0x00de, 0x9006, 0x002e, 0x012e, 0x009e, 0x00be, 0x0005,
+	0x0016, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0030, 0x9188,
+	0x1000, 0x2104, 0x905d, 0x0dc0, 0x9006, 0x001e, 0x0005, 0x00d6,
+	0x0156, 0x0136, 0x0146, 0x9006, 0xb80a, 0xb80e, 0xb800, 0xc08c,
+	0xb802, 0x080c, 0x70b7, 0x1510, 0xb8a0, 0x9086, 0x007e, 0x0120,
+	0x080c, 0x9b66, 0x11d8, 0x0078, 0x7040, 0xd0e4, 0x01b8, 0x00c6,
+	0x2061, 0x1953, 0x7048, 0x2062, 0x704c, 0x6006, 0x7050, 0x600a,
+	0x7054, 0x600e, 0x00ce, 0x703c, 0x2069, 0x0140, 0x9005, 0x1110,
+	0x2001, 0x0001, 0x6886, 0x2069, 0x1800, 0x68b2, 0x7040, 0xb85e,
+	0x7048, 0xb862, 0x704c, 0xb866, 0x20e1, 0x0000, 0x2099, 0x0276,
+	0xb8b4, 0x20e8, 0xb8b8, 0x9088, 0x000a, 0x21a0, 0x20a9, 0x0004,
+	0x4003, 0x2099, 0x027a, 0x9088, 0x0006, 0x21a0, 0x20a9, 0x0004,
+	0x4003, 0x2069, 0x0200, 0x6817, 0x0001, 0x7040, 0xb86a, 0x7144,
+	0xb96e, 0x7048, 0xb872, 0x7050, 0xb876, 0x2069, 0x0200, 0x6817,
+	0x0000, 0xb8a0, 0x9086, 0x007e, 0x1110, 0x7144, 0xb96e, 0x9182,
+	0x0211, 0x1218, 0x2009, 0x0008, 0x0400, 0x9182, 0x0259, 0x1218,
+	0x2009, 0x0007, 0x00d0, 0x9182, 0x02c1, 0x1218, 0x2009, 0x0006,
+	0x00a0, 0x9182, 0x0349, 0x1218, 0x2009, 0x0005, 0x0070, 0x9182,
+	0x0421, 0x1218, 0x2009, 0x0004, 0x0040, 0x9182, 0x0581, 0x1218,
+	0x2009, 0x0003, 0x0010, 0x2009, 0x0002, 0xb992, 0x014e, 0x013e,
+	0x015e, 0x00de, 0x0005, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260,
+	0x7034, 0xb896, 0x703c, 0xb89a, 0x7054, 0xb89e, 0x0036, 0xbbc4,
+	0xc384, 0xba00, 0x2009, 0x1873, 0x210c, 0xd0bc, 0x0120, 0xd1ec,
+	0x0110, 0xc2ad, 0x0008, 0xc2ac, 0xd0c4, 0x0148, 0xd1e4, 0x0138,
+	0xc2bd, 0xd0cc, 0x0128, 0xd38c, 0x1108, 0xc385, 0x0008, 0xc2bc,
+	0xba02, 0xbbc6, 0x003e, 0x00ee, 0x002e, 0x001e, 0x0005, 0x0096,
+	0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0578, 0xa900, 0x81ff,
+	0x15c0, 0xaa04, 0x9282, 0x0010, 0x16c8, 0x0136, 0x0146, 0x01c6,
+	0x01d6, 0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084,
+	0xffc0, 0x9080, 0x0004, 0x2098, 0x2009, 0x0010, 0x20a9, 0x0001,
+	0x4002, 0x9086, 0xffff, 0x0120, 0x8109, 0x1dd0, 0x080c, 0x0d65,
+	0x3c00, 0x20e8, 0x3300, 0x8001, 0x20a0, 0x4604, 0x8210, 0xaa06,
+	0x01de, 0x01ce, 0x014e, 0x013e, 0x0060, 0x080c, 0x1022, 0x0170,
+	0x2900, 0xb8a6, 0xa803, 0x0000, 0x080c, 0x64fb, 0xa807, 0x0001,
+	0xae12, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8,
+	0x0126, 0x2091, 0x8000, 0x0096, 0xb8a4, 0x904d, 0x0188, 0xa800,
+	0x9005, 0x1150, 0x080c, 0x650a, 0x1158, 0xa804, 0x908a, 0x0002,
+	0x0218, 0x8001, 0xa806, 0x0020, 0x080c, 0x1054, 0xb8a7, 0x0000,
+	0x009e, 0x012e, 0x0005, 0x0096, 0x00c6, 0xb888, 0x9005, 0x1904,
+	0x63f4, 0xb8c0, 0x904d, 0x0904, 0x63f4, 0x080c, 0x9bbe, 0x0904,
+	0x63f0, 0x8210, 0xba3e, 0xa800, 0xb8c2, 0x9005, 0x1108, 0xb8be,
+	0x2b00, 0x6012, 0x2900, 0x6016, 0x6023, 0x0003, 0x600b, 0xffff,
 	0x6007, 0x0040, 0xa878, 0x605e, 0xa880, 0x9084, 0x00ff, 0x6066,
-	0xa883, 0x0000, 0xa87c, 0xd0ac, 0x05c0, 0xc0dd, 0xa87e, 0xa888,
-	0x8001, 0x1568, 0x2001, 0x00f8, 0x8001, 0xa001, 0xa001, 0xa001,
-	0x1dd8, 0xa816, 0xa864, 0x9094, 0x00f7, 0x9296, 0x0011, 0x11f8,
-	0x9084, 0x00ff, 0xc0bd, 0x601e, 0xa8ac, 0xaab0, 0xa836, 0xaa3a,
-	0x2001, 0x000f, 0x8001, 0x1df0, 0x2001, 0x8004, 0x6003, 0x0004,
-	0x6046, 0x00f6, 0x2079, 0x0380, 0x7818, 0xd0bc, 0x1de8, 0x7833,
-	0x0010, 0x2c00, 0x7836, 0x781b, 0x8080, 0x00fe, 0x0005, 0x080c,
-	0x164f, 0x601c, 0xc0bd, 0x601e, 0x0c38, 0x0006, 0x2001, 0x00e8,
-	0x8001, 0xa001, 0xa001, 0xa001, 0x1dd8, 0x000e, 0xd0b4, 0x190c,
-	0x1ad2, 0x2001, 0x8004, 0x6003, 0x0002, 0x08d0, 0x81ff, 0x1110,
-	0xb88b, 0x0001, 0x2908, 0xb8bc, 0xb9be, 0x9005, 0x1110, 0xb9c2,
-	0x0020, 0x0096, 0x2048, 0xa902, 0x009e, 0x0005, 0x00b6, 0x0126,
-	0x00c6, 0x0026, 0x2091, 0x8000, 0x6210, 0x2258, 0xba00, 0x9005,
-	0x0110, 0xc285, 0x0008, 0xc284, 0xba02, 0x002e, 0x00ce, 0x012e,
-	0x00be, 0x0005, 0x00b6, 0x0126, 0x00c6, 0x2091, 0x8000, 0x6210,
-	0x2258, 0xba04, 0x0006, 0x9086, 0x0006, 0x1170, 0xb89c, 0xd0ac,
-	0x0158, 0x080c, 0x665c, 0x0140, 0x9284, 0xff00, 0x8007, 0x9086,
-	0x0007, 0x1110, 0x2011, 0x0600, 0x000e, 0x9294, 0xff00, 0x9215,
-	0xba06, 0x0006, 0x9086, 0x0006, 0x1120, 0xba90, 0x82ff, 0x090c,
-	0x0d65, 0x000e, 0x00ce, 0x012e, 0x00be, 0x0005, 0x00b6, 0x0126,
-	0x00c6, 0x2091, 0x8000, 0x6210, 0x2258, 0xba04, 0x0006, 0x9086,
-	0x0006, 0x1168, 0xb89c, 0xd0a4, 0x0150, 0x080c, 0x6658, 0x1138,
-	0x9284, 0x00ff, 0x9086, 0x0007, 0x1110, 0x2011, 0x0006, 0x000e,
-	0x9294, 0x00ff, 0x8007, 0x9215, 0xba06, 0x00ce, 0x012e, 0x00be,
-	0x0005, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0005, 0x00d6,
-	0x0026, 0x9190, 0x1000, 0x2204, 0x905d, 0x1180, 0x0096, 0x080c,
-	0x1022, 0x2958, 0x009e, 0x0160, 0x2b00, 0x2012, 0xb85c, 0xb8ba,
-	0xb860, 0xb8b6, 0x9006, 0xb8a6, 0x080c, 0x5cef, 0x9006, 0x0010,
-	0x9085, 0x0001, 0x002e, 0x00de, 0x0005, 0x00b6, 0x0096, 0x0126,
-	0x2091, 0x8000, 0x0026, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001,
-	0x0458, 0x00d6, 0x9190, 0x1000, 0x2204, 0x905d, 0x0518, 0x2013,
-	0x0000, 0xb8a4, 0x904d, 0x0110, 0x080c, 0x1054, 0x00d6, 0x00c6,
-	0xb8ac, 0x2060, 0x8cff, 0x0168, 0x600c, 0x0006, 0x6014, 0x2048,
-	0x080c, 0xb82c, 0x0110, 0x080c, 0x0fd4, 0x080c, 0x9bcc, 0x00ce,
-	0x0c88, 0x00ce, 0x00de, 0x2b48, 0xb8b8, 0xb85e, 0xb8b4, 0xb862,
-	0x080c, 0x1064, 0x00de, 0x9006, 0x002e, 0x012e, 0x009e, 0x00be,
-	0x0005, 0x0016, 0x9182, 0x0800, 0x0218, 0x9085, 0x0001, 0x0030,
-	0x9188, 0x1000, 0x2104, 0x905d, 0x0dc0, 0x9006, 0x001e, 0x0005,
-	0x00d6, 0x0156, 0x0136, 0x0146, 0x9006, 0xb80a, 0xb80e, 0xb800,
-	0xc08c, 0xb802, 0x080c, 0x70ac, 0x1510, 0xb8a0, 0x9086, 0x007e,
-	0x0120, 0x080c, 0x9b4b, 0x11d8, 0x0078, 0x7040, 0xd0e4, 0x01b8,
-	0x00c6, 0x2061, 0x1953, 0x7048, 0x2062, 0x704c, 0x6006, 0x7050,
-	0x600a, 0x7054, 0x600e, 0x00ce, 0x703c, 0x2069, 0x0140, 0x9005,
-	0x1110, 0x2001, 0x0001, 0x6886, 0x2069, 0x1800, 0x68b2, 0x7040,
-	0xb85e, 0x7048, 0xb862, 0x704c, 0xb866, 0x20e1, 0x0000, 0x2099,
-	0x0276, 0xb8b4, 0x20e8, 0xb8b8, 0x9088, 0x000a, 0x21a0, 0x20a9,
-	0x0004, 0x4003, 0x2099, 0x027a, 0x9088, 0x0006, 0x21a0, 0x20a9,
-	0x0004, 0x4003, 0x2069, 0x0200, 0x6817, 0x0001, 0x7040, 0xb86a,
-	0x7144, 0xb96e, 0x7048, 0xb872, 0x7050, 0xb876, 0x2069, 0x0200,
-	0x6817, 0x0000, 0xb8a0, 0x9086, 0x007e, 0x1110, 0x7144, 0xb96e,
-	0x9182, 0x0211, 0x1218, 0x2009, 0x0008, 0x0400, 0x9182, 0x0259,
-	0x1218, 0x2009, 0x0007, 0x00d0, 0x9182, 0x02c1, 0x1218, 0x2009,
-	0x0006, 0x00a0, 0x9182, 0x0349, 0x1218, 0x2009, 0x0005, 0x0070,
-	0x9182, 0x0421, 0x1218, 0x2009, 0x0004, 0x0040, 0x9182, 0x0581,
-	0x1218, 0x2009, 0x0003, 0x0010, 0x2009, 0x0002, 0xb992, 0x014e,
-	0x013e, 0x015e, 0x00de, 0x0005, 0x0016, 0x0026, 0x00e6, 0x2071,
-	0x0260, 0x7034, 0xb896, 0x703c, 0xb89a, 0x7054, 0xb89e, 0x0036,
-	0xbbc4, 0xc384, 0xba00, 0x2009, 0x1873, 0x210c, 0xd0bc, 0x0120,
-	0xd1ec, 0x0110, 0xc2ad, 0x0008, 0xc2ac, 0xd0c4, 0x0148, 0xd1e4,
-	0x0138, 0xc2bd, 0xd0cc, 0x0128, 0xd38c, 0x1108, 0xc385, 0x0008,
-	0xc2bc, 0xba02, 0xbbc6, 0x003e, 0x00ee, 0x002e, 0x001e, 0x0005,
-	0x0096, 0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0578, 0xa900,
-	0x81ff, 0x15c0, 0xaa04, 0x9282, 0x0010, 0x16c8, 0x0136, 0x0146,
-	0x01c6, 0x01d6, 0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0,
-	0x9084, 0xffc0, 0x9080, 0x0004, 0x2098, 0x2009, 0x0010, 0x20a9,
-	0x0001, 0x4002, 0x9086, 0xffff, 0x0120, 0x8109, 0x1dd0, 0x080c,
-	0x0d65, 0x3c00, 0x20e8, 0x3300, 0x8001, 0x20a0, 0x4604, 0x8210,
-	0xaa06, 0x01de, 0x01ce, 0x014e, 0x013e, 0x0060, 0x080c, 0x1022,
-	0x0170, 0x2900, 0xb8a6, 0xa803, 0x0000, 0x080c, 0x64f4, 0xa807,
-	0x0001, 0xae12, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006,
-	0x0cd8, 0x0126, 0x2091, 0x8000, 0x0096, 0xb8a4, 0x904d, 0x0188,
-	0xa800, 0x9005, 0x1150, 0x080c, 0x6503, 0x1158, 0xa804, 0x908a,
-	0x0002, 0x0218, 0x8001, 0xa806, 0x0020, 0x080c, 0x1054, 0xb8a7,
-	0x0000, 0x009e, 0x012e, 0x0005, 0x0096, 0x00c6, 0xb888, 0x9005,
-	0x1904, 0x63ed, 0xb8c0, 0x904d, 0x0904, 0x63ed, 0x080c, 0x9ba3,
-	0x0904, 0x63e9, 0x8210, 0xba3e, 0xa800, 0xb8c2, 0x9005, 0x1108,
-	0xb8be, 0x2b00, 0x6012, 0x2900, 0x6016, 0x6023, 0x0003, 0x600b,
-	0xffff, 0x6007, 0x0040, 0xa878, 0x605e, 0xa880, 0x9084, 0x00ff,
-	0x6066, 0xa883, 0x0000, 0xa87c, 0xd0ac, 0x01c8, 0xc0dd, 0xa87e,
-	0xa888, 0x8001, 0x1568, 0xa816, 0xa864, 0x9094, 0x00f7, 0x9296,
-	0x0011, 0x1530, 0x9084, 0x00ff, 0xc0bd, 0x601e, 0xa8ac, 0xaab0,
-	0xa836, 0xaa3a, 0x2001, 0x8004, 0x6003, 0x0004, 0x0030, 0x080c,
-	0x1ad2, 0x2001, 0x8004, 0x6003, 0x0002, 0x6046, 0x2001, 0x0010,
-	0x2c08, 0x080c, 0x989e, 0xb838, 0xba3c, 0x9202, 0x0a04, 0x639a,
-	0x0020, 0x82ff, 0x1110, 0xb88b, 0x0001, 0x00ce, 0x009e, 0x0005,
-	0x080c, 0x164f, 0x601c, 0xc0bd, 0x601e, 0x08e0, 0x00b6, 0x0096,
-	0x0016, 0x20a9, 0x0800, 0x900e, 0x0016, 0x080c, 0x6269, 0x1158,
-	0xb8c0, 0x904d, 0x0140, 0x3e00, 0x9086, 0x0002, 0x1118, 0xb800,
-	0xd0bc, 0x1108, 0x0041, 0x001e, 0x8108, 0x1f04, 0x63fc, 0x001e,
-	0x00be, 0x009e, 0x0005, 0x0096, 0x0016, 0xb8c0, 0x904d, 0x0188,
-	0xa800, 0xb8c2, 0x9005, 0x1108, 0xb8be, 0x9006, 0xa802, 0xa867,
-	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xbb2a, 0x080c, 0x698f,
-	0x0c60, 0x001e, 0x009e, 0x0005, 0x0086, 0x9046, 0xb8c0, 0x904d,
-	0x0198, 0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0128, 0x2940,
-	0xa800, 0x904d, 0x0148, 0x0ca8, 0xa800, 0x88ff, 0x1110, 0xb8c2,
-	0x0008, 0xa002, 0xa803, 0x0000, 0x008e, 0x0005, 0x901e, 0x0010,
-	0x2019, 0x0001, 0x00e6, 0x0096, 0x00c6, 0x0086, 0x0026, 0x0126,
-	0x2091, 0x8000, 0x2071, 0x19b8, 0x9046, 0x7028, 0x9065, 0x01e8,
-	0x6014, 0x2068, 0x83ff, 0x0120, 0x605c, 0x9606, 0x0158, 0x0030,
-	0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0120, 0x2c40, 0x600c,
-	0x2060, 0x0c60, 0x600c, 0x0006, 0x0066, 0x2830, 0x080c, 0x90f5,
-	0x006e, 0x000e, 0x83ff, 0x0508, 0x0c08, 0x9046, 0xb8c0, 0x904d,
-	0x01e0, 0x83ff, 0x0120, 0xa878, 0x9606, 0x0158, 0x0030, 0xa86c,
-	0x9406, 0x1118, 0xa870, 0x9506, 0x0120, 0x2940, 0xa800, 0x2048,
-	0x0c70, 0xb8c0, 0xaa00, 0x0026, 0x9906, 0x1110, 0xbac2, 0x0008,
-	0xa202, 0x000e, 0x83ff, 0x0108, 0x0c10, 0x002e, 0x008e, 0x00ce,
-	0x009e, 0x00ee, 0x0005, 0x9016, 0x0489, 0x1110, 0x2011, 0x0001,
-	0x0005, 0x080c, 0x6558, 0x0128, 0x080c, 0xb8ed, 0x0010, 0x9085,
-	0x0001, 0x0005, 0x080c, 0x6558, 0x0128, 0x080c, 0xb88e, 0x0010,
-	0x9085, 0x0001, 0x0005, 0x080c, 0x6558, 0x0128, 0x080c, 0xb8ea,
-	0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x6558, 0x0128, 0x080c,
-	0xb8ad, 0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x6558, 0x0128,
-	0x080c, 0xb92e, 0x0010, 0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d,
-	0x1118, 0x9085, 0x0001, 0x0005, 0x0136, 0x01c6, 0xa800, 0x9005,
-	0x11b8, 0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184,
-	0xffc0, 0x9080, 0x0004, 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010,
-	0x4002, 0x9606, 0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0008,
-	0x9006, 0x01ce, 0x013e, 0x0005, 0x0146, 0x01d6, 0xa860, 0x20e8,
-	0xa85c, 0x9080, 0x0004, 0x20a0, 0x20a9, 0x0010, 0x2009, 0xffff,
-	0x4104, 0x01de, 0x014e, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8,
+	0xa883, 0x0000, 0xa87c, 0xd0ac, 0x01c8, 0xc0dd, 0xa87e, 0xa888,
+	0x8001, 0x1568, 0xa816, 0xa864, 0x9094, 0x00f7, 0x9296, 0x0011,
+	0x1530, 0x9084, 0x00ff, 0xc0bd, 0x601e, 0xa8ac, 0xaab0, 0xa836,
+	0xaa3a, 0x2001, 0x8004, 0x6003, 0x0004, 0x0030, 0x080c, 0x1ad2,
+	0x2001, 0x8004, 0x6003, 0x0002, 0x6046, 0x2001, 0x0010, 0x2c08,
+	0x080c, 0x98b9, 0xb838, 0xba3c, 0x9202, 0x0a04, 0x63a1, 0x0020,
+	0x82ff, 0x1110, 0xb88b, 0x0001, 0x00ce, 0x009e, 0x0005, 0x080c,
+	0x164f, 0x601c, 0xc0bd, 0x601e, 0x08e0, 0x00b6, 0x0096, 0x0016,
+	0x20a9, 0x0800, 0x900e, 0x0016, 0x080c, 0x6270, 0x1158, 0xb8c0,
+	0x904d, 0x0140, 0x3e00, 0x9086, 0x0002, 0x1118, 0xb800, 0xd0bc,
+	0x1108, 0x0041, 0x001e, 0x8108, 0x1f04, 0x6403, 0x001e, 0x00be,
+	0x009e, 0x0005, 0x0096, 0x0016, 0xb8c0, 0x904d, 0x0188, 0xa800,
+	0xb8c2, 0x9005, 0x1108, 0xb8be, 0x9006, 0xa802, 0xa867, 0x0103,
+	0xab7a, 0xa877, 0x0000, 0x080c, 0xbb45, 0x080c, 0x6996, 0x0c60,
+	0x001e, 0x009e, 0x0005, 0x0086, 0x9046, 0xb8c0, 0x904d, 0x0198,
+	0xa86c, 0x9406, 0x1118, 0xa870, 0x9506, 0x0128, 0x2940, 0xa800,
+	0x904d, 0x0148, 0x0ca8, 0xa800, 0x88ff, 0x1110, 0xb8c2, 0x0008,
+	0xa002, 0xa803, 0x0000, 0x008e, 0x0005, 0x901e, 0x0010, 0x2019,
+	0x0001, 0x00e6, 0x0096, 0x00c6, 0x0086, 0x0026, 0x0126, 0x2091,
+	0x8000, 0x2071, 0x19b8, 0x9046, 0x7028, 0x9065, 0x01e8, 0x6014,
+	0x2068, 0x83ff, 0x0120, 0x605c, 0x9606, 0x0158, 0x0030, 0xa86c,
+	0x9406, 0x1118, 0xa870, 0x9506, 0x0120, 0x2c40, 0x600c, 0x2060,
+	0x0c60, 0x600c, 0x0006, 0x0066, 0x2830, 0x080c, 0x9110, 0x006e,
+	0x000e, 0x83ff, 0x0508, 0x0c08, 0x9046, 0xb8c0, 0x904d, 0x01e0,
+	0x83ff, 0x0120, 0xa878, 0x9606, 0x0158, 0x0030, 0xa86c, 0x9406,
+	0x1118, 0xa870, 0x9506, 0x0120, 0x2940, 0xa800, 0x2048, 0x0c70,
+	0xb8c0, 0xaa00, 0x0026, 0x9906, 0x1110, 0xbac2, 0x0008, 0xa202,
+	0x000e, 0x83ff, 0x0108, 0x0c10, 0x002e, 0x008e, 0x00ce, 0x009e,
+	0x00ee, 0x0005, 0x9016, 0x0489, 0x1110, 0x2011, 0x0001, 0x0005,
+	0x080c, 0x655f, 0x0128, 0x080c, 0xb908, 0x0010, 0x9085, 0x0001,
+	0x0005, 0x080c, 0x655f, 0x0128, 0x080c, 0xb8a9, 0x0010, 0x9085,
+	0x0001, 0x0005, 0x080c, 0x655f, 0x0128, 0x080c, 0xb905, 0x0010,
+	0x9085, 0x0001, 0x0005, 0x080c, 0x655f, 0x0128, 0x080c, 0xb8c8,
+	0x0010, 0x9085, 0x0001, 0x0005, 0x080c, 0x655f, 0x0128, 0x080c,
+	0xb949, 0x0010, 0x9085, 0x0001, 0x0005, 0xb8a4, 0x900d, 0x1118,
+	0x9085, 0x0001, 0x0005, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8,
 	0x890e, 0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0,
 	0x9080, 0x0004, 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002,
-	0x9606, 0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0068, 0x0146,
-	0x01d6, 0x3300, 0x8001, 0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff,
-	0x4004, 0x01de, 0x014e, 0x9006, 0x01ce, 0x013e, 0x0005, 0x0096,
-	0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x1128, 0x080c, 0x1022,
-	0x0168, 0x2900, 0xb8a6, 0x080c, 0x64f4, 0xa803, 0x0001, 0xa807,
-	0x0000, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8,
-	0x0096, 0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7,
-	0x0000, 0x080c, 0x1054, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005,
-	0xb89c, 0xd0a4, 0x0005, 0x00b6, 0x00f6, 0x080c, 0x70ac, 0x01b0,
-	0x71c0, 0x81ff, 0x1198, 0x71d8, 0xd19c, 0x0180, 0x2001, 0x007e,
-	0x9080, 0x1000, 0x2004, 0x905d, 0x0148, 0xb804, 0x9084, 0x00ff,
-	0x9086, 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x2079, 0x1853,
-	0x7804, 0x00d0, 0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c,
-	0x6269, 0x1168, 0xb804, 0x9084, 0xff00, 0x8007, 0x9096, 0x0004,
-	0x0118, 0x9086, 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e,
-	0x8108, 0x1f04, 0x657e, 0x015e, 0x080c, 0x661e, 0x0120, 0x2001,
-	0x1956, 0x200c, 0x0030, 0x2079, 0x1853, 0x7804, 0x0030, 0x2009,
-	0x07d0, 0x2011, 0x65a8, 0x080c, 0x81f5, 0x00fe, 0x00be, 0x0005,
-	0x00b6, 0x2011, 0x65a8, 0x080c, 0x8131, 0x080c, 0x661e, 0x01d8,
-	0x2001, 0x107e, 0x2004, 0x2058, 0xb900, 0xc1ec, 0xb902, 0x080c,
-	0x665c, 0x0130, 0x2009, 0x07d0, 0x2011, 0x65a8, 0x080c, 0x81f5,
-	0x00e6, 0x2071, 0x1800, 0x9006, 0x707a, 0x705c, 0x707e, 0x080c,
-	0x2ddb, 0x00ee, 0x04d0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e,
-	0x0016, 0x080c, 0x6269, 0x1558, 0xb800, 0xd0ec, 0x0540, 0x0046,
-	0xbaa0, 0x2220, 0x9006, 0x2009, 0x0029, 0x080c, 0xd251, 0xb800,
-	0xc0e5, 0xc0ec, 0xb802, 0x080c, 0x6658, 0x2001, 0x0707, 0x1128,
-	0xb804, 0x9084, 0x00ff, 0x9085, 0x0700, 0xb806, 0x080c, 0x98ad,
-	0x2019, 0x0029, 0x080c, 0x8613, 0x0076, 0x903e, 0x080c, 0x8502,
-	0x900e, 0x080c, 0xcfa6, 0x007e, 0x004e, 0x080c, 0x98c9, 0x001e,
-	0x8108, 0x1f04, 0x65d0, 0x00ce, 0x015e, 0x00be, 0x0005, 0x00b6,
-	0x6010, 0x2058, 0xb800, 0xc0ec, 0xb802, 0x00be, 0x0005, 0x7810,
-	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0ac, 0x0005, 0x6010, 0x00b6,
-	0x905d, 0x0108, 0xb800, 0x00be, 0xd0bc, 0x0005, 0x00b6, 0x00f6,
-	0x2001, 0x107e, 0x2004, 0x905d, 0x0110, 0xb800, 0xd0ec, 0x00fe,
-	0x00be, 0x0005, 0x0126, 0x0026, 0x2091, 0x8000, 0x0006, 0xbaa0,
-	0x9290, 0x1000, 0x2204, 0x9b06, 0x190c, 0x0d65, 0x000e, 0xba00,
-	0x9005, 0x0110, 0xc2fd, 0x0008, 0xc2fc, 0xba02, 0x002e, 0x012e,
-	0x0005, 0x2011, 0x1836, 0x2204, 0xd0cc, 0x0138, 0x2001, 0x1954,
-	0x200c, 0x2011, 0x664e, 0x080c, 0x81f5, 0x0005, 0x2011, 0x664e,
-	0x080c, 0x8131, 0x2011, 0x1836, 0x2204, 0xc0cc, 0x2012, 0x0005,
-	0x080c, 0x5386, 0xd0ac, 0x0005, 0x080c, 0x5386, 0xd0a4, 0x0005,
-	0x0016, 0xb904, 0x9184, 0x00ff, 0x908e, 0x0006, 0x001e, 0x0005,
-	0x0016, 0xb904, 0x9184, 0xff00, 0x8007, 0x908e, 0x0006, 0x001e,
-	0x0005, 0x00b6, 0x00f6, 0x080c, 0xbf46, 0x0158, 0x70d8, 0x9084,
-	0x0028, 0x0138, 0x2001, 0x107f, 0x2004, 0x905d, 0x0110, 0xb8c4,
-	0xd094, 0x00fe, 0x00be, 0x0005, 0x0006, 0x0016, 0x0036, 0x0046,
-	0x0076, 0x00b6, 0x2001, 0x1817, 0x203c, 0x9780, 0x3184, 0x203d,
-	0x97bc, 0xff00, 0x873f, 0x9006, 0x2018, 0x2008, 0x9284, 0x8000,
-	0x0110, 0x2019, 0x0001, 0x9294, 0x7fff, 0x2100, 0x9706, 0x0190,
-	0x91a0, 0x1000, 0x2404, 0x905d, 0x0168, 0xb804, 0x9084, 0x00ff,
-	0x9086, 0x0006, 0x1138, 0x83ff, 0x0118, 0xb89c, 0xd0a4, 0x0110,
-	0x8211, 0x0158, 0x8108, 0x83ff, 0x0120, 0x9182, 0x0800, 0x0e28,
-	0x0068, 0x9182, 0x007e, 0x0e08, 0x0048, 0x00be, 0x007e, 0x004e,
-	0x003e, 0x001e, 0x9085, 0x0001, 0x000e, 0x0005, 0x00be, 0x007e,
-	0x004e, 0x003e, 0x001e, 0x9006, 0x000e, 0x0005, 0x0046, 0x0056,
-	0x0076, 0x00b6, 0x2100, 0x9084, 0x7fff, 0x9080, 0x1000, 0x2004,
-	0x905d, 0x0130, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x0550,
-	0x9184, 0x8000, 0x0580, 0x2001, 0x1817, 0x203c, 0x9780, 0x3184,
-	0x203d, 0x97bc, 0xff00, 0x873f, 0x9006, 0x2020, 0x2400, 0x9706,
-	0x01a0, 0x94a8, 0x1000, 0x2504, 0x905d, 0x0178, 0xb804, 0x9084,
-	0x00ff, 0x9086, 0x0006, 0x1148, 0xb89c, 0xd0a4, 0x0130, 0xb814,
-	0x9206, 0x1118, 0xb810, 0x9306, 0x0128, 0x8420, 0x9482, 0x0800,
-	0x0e28, 0x0048, 0x918c, 0x7fff, 0x00be, 0x007e, 0x005e, 0x004e,
-	0x9085, 0x0001, 0x0005, 0x918c, 0x7fff, 0x00be, 0x007e, 0x005e,
-	0x004e, 0x9006, 0x0005, 0x2071, 0x1906, 0x7003, 0x0001, 0x7007,
-	0x0000, 0x9006, 0x7012, 0x7016, 0x701a, 0x701e, 0x700a, 0x7046,
-	0x2001, 0x1919, 0x2003, 0x0000, 0x0005, 0x0016, 0x00e6, 0x2071,
-	0x191a, 0x900e, 0x710a, 0x080c, 0x5386, 0xd0fc, 0x1140, 0x080c,
-	0x5386, 0x900e, 0xd09c, 0x0108, 0x8108, 0x7102, 0x0400, 0x2001,
-	0x1873, 0x200c, 0x9184, 0x0007, 0x9006, 0x0002, 0x6737, 0x6737,
-	0x6737, 0x6737, 0x6737, 0x674e, 0x675c, 0x6737, 0x7003, 0x0003,
-	0x2009, 0x1874, 0x210c, 0x9184, 0xff00, 0x8007, 0x9005, 0x1110,
-	0x2001, 0x0002, 0x7006, 0x0018, 0x7003, 0x0005, 0x0c88, 0x00ee,
-	0x001e, 0x0005, 0x00e6, 0x2071, 0x0050, 0x684c, 0x9005, 0x1150,
-	0x00e6, 0x2071, 0x1906, 0x7028, 0xc085, 0x702a, 0x00ee, 0x9085,
-	0x0001, 0x0488, 0x6844, 0x9005, 0x0158, 0x080c, 0x741e, 0x6a60,
-	0x9200, 0x7002, 0x6864, 0x9101, 0x7006, 0x9006, 0x7012, 0x7016,
-	0x6860, 0x7002, 0x6864, 0x7006, 0x6868, 0x700a, 0x686c, 0x700e,
-	0x6844, 0x9005, 0x1110, 0x7012, 0x7016, 0x684c, 0x701a, 0x701c,
-	0x9085, 0x0040, 0x701e, 0x7037, 0x0019, 0x702b, 0x0001, 0x00e6,
-	0x2071, 0x1906, 0x7028, 0xc084, 0x702a, 0x7007, 0x0001, 0x700b,
-	0x0000, 0x00ee, 0x9006, 0x00ee, 0x0005, 0xa868, 0xd0fc, 0x11d8,
-	0x00e6, 0x0026, 0x2001, 0x191a, 0x2004, 0x9005, 0x0904, 0x6994,
-	0xa87c, 0xd0bc, 0x1904, 0x6994, 0xa978, 0xa874, 0x9105, 0x1904,
-	0x6994, 0x2001, 0x191a, 0x2004, 0x0002, 0x6994, 0x67e8, 0x6824,
-	0x6824, 0x6994, 0x6824, 0x0005, 0xa868, 0xd0fc, 0x1500, 0x00e6,
-	0x0026, 0x2009, 0x191a, 0x210c, 0x81ff, 0x0904, 0x6994, 0xa87c,
-	0xd0cc, 0x0904, 0x6994, 0xa880, 0x9084, 0x00ff, 0x9086, 0x0001,
-	0x1904, 0x6994, 0x9186, 0x0003, 0x0904, 0x6824, 0x9186, 0x0005,
-	0x0904, 0x6824, 0xa84f, 0x8021, 0xa853, 0x0017, 0x0028, 0x0005,
-	0xa84f, 0x8020, 0xa853, 0x0016, 0x2071, 0x1906, 0x701c, 0x9005,
-	0x1904, 0x6b37, 0x0e04, 0x6b82, 0x2071, 0x0000, 0xa84c, 0x7082,
-	0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0x2091,
-	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x2071,
-	0x1800, 0x2011, 0x0001, 0xa804, 0x900d, 0x702c, 0x1158, 0xa802,
-	0x2900, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x804c, 0x002e,
-	0x00ee, 0x0005, 0x0096, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-	0x81ff, 0x1dc8, 0x009e, 0x0c58, 0xa84f, 0x0000, 0x00f6, 0x2079,
-	0x0050, 0x2071, 0x1906, 0xa803, 0x0000, 0x7010, 0x9005, 0x1904,
-	0x6919, 0x782c, 0x908c, 0x0780, 0x190c, 0x6ca9, 0x8004, 0x8004,
-	0x8004, 0x9084, 0x0003, 0x0002, 0x6842, 0x6919, 0x6867, 0x68b4,
-	0x080c, 0x0d65, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d,
-	0x1170, 0x2071, 0x19d4, 0x703c, 0x9005, 0x1328, 0x2001, 0x191b,
-	0x2004, 0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016,
-	0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-	0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x804c, 0x0c10, 0x2071,
-	0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x15a8, 0x7824, 0x00e6,
-	0x2071, 0x0040, 0x712c, 0xd19c, 0x1170, 0x2009, 0x182f, 0x210c,
-	0x918a, 0x0040, 0x0240, 0x7022, 0x2001, 0x1dc0, 0x200c, 0x8108,
-	0x2102, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900,
-	0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x804c, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x6ca9, 0xd0a4, 0x19c8, 0x2071, 0x19d4, 0x703c,
-	0x9005, 0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe,
-	0x002e, 0x00ee, 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802,
-	0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be,
-	0x080c, 0x804c, 0x0804, 0x686e, 0x0096, 0x00e6, 0x7824, 0x2048,
-	0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000,
-	0x70be, 0x080c, 0x804c, 0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9,
-	0xd0a4, 0x1d60, 0x00ee, 0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9,
-	0xd09c, 0x11a0, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d, 0x1560,
-	0x2071, 0x19d4, 0x703c, 0x9005, 0x1328, 0x2001, 0x191b, 0x2004,
-	0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x009e, 0x2908,
-	0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902,
-	0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1170, 0x2071, 0x19d4,
-	0x703c, 0x9005, 0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e,
-	0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c,
-	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70bc, 0x9200, 0x70be, 0x080c, 0x804c, 0x00fe, 0x002e, 0x00ee,
-	0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a,
-	0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1904,
-	0x696e, 0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9, 0xd09c, 0x1198,
-	0x701c, 0x904d, 0x0180, 0x7010, 0x8001, 0x7012, 0x1108, 0x701a,
-	0xa800, 0x701e, 0x2900, 0x7822, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x6ca9, 0xd09c, 0x0d68, 0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9,
-	0xd0a4, 0x01b0, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c,
-	0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x804c,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9, 0xd0a4, 0x1d60, 0x00ee,
+	0x9606, 0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0008, 0x9006,
+	0x01ce, 0x013e, 0x0005, 0x0146, 0x01d6, 0xa860, 0x20e8, 0xa85c,
+	0x9080, 0x0004, 0x20a0, 0x20a9, 0x0010, 0x2009, 0xffff, 0x4104,
+	0x01de, 0x014e, 0x0136, 0x01c6, 0xa800, 0x9005, 0x11b8, 0x890e,
+	0x810e, 0x810f, 0x9184, 0x003f, 0x20e0, 0x9184, 0xffc0, 0x9080,
+	0x0004, 0x2098, 0x20a9, 0x0001, 0x2009, 0x0010, 0x4002, 0x9606,
+	0x0128, 0x8109, 0x1dd8, 0x9085, 0x0001, 0x0068, 0x0146, 0x01d6,
+	0x3300, 0x8001, 0x20a0, 0x3c00, 0x20e8, 0x2001, 0xffff, 0x4004,
+	0x01de, 0x014e, 0x9006, 0x01ce, 0x013e, 0x0005, 0x0096, 0x0126,
+	0x2091, 0x8000, 0xb8a4, 0x904d, 0x1128, 0x080c, 0x1022, 0x0168,
+	0x2900, 0xb8a6, 0x080c, 0x64fb, 0xa803, 0x0001, 0xa807, 0x0000,
+	0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0x9006, 0x0cd8, 0x0096,
+	0x0126, 0x2091, 0x8000, 0xb8a4, 0x904d, 0x0130, 0xb8a7, 0x0000,
+	0x080c, 0x1054, 0x9085, 0x0001, 0x012e, 0x009e, 0x0005, 0xb89c,
+	0xd0a4, 0x0005, 0x00b6, 0x00f6, 0x080c, 0x70b7, 0x01b0, 0x71c0,
+	0x81ff, 0x1198, 0x71d8, 0xd19c, 0x0180, 0x2001, 0x007e, 0x9080,
+	0x1000, 0x2004, 0x905d, 0x0148, 0xb804, 0x9084, 0x00ff, 0x9086,
+	0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x2079, 0x1853, 0x7804,
+	0x00d0, 0x0156, 0x20a9, 0x007f, 0x900e, 0x0016, 0x080c, 0x6270,
+	0x1168, 0xb804, 0x9084, 0xff00, 0x8007, 0x9096, 0x0004, 0x0118,
+	0x9086, 0x0006, 0x1118, 0xb800, 0xc0ed, 0xb802, 0x001e, 0x8108,
+	0x1f04, 0x6585, 0x015e, 0x080c, 0x6625, 0x0120, 0x2001, 0x1956,
+	0x200c, 0x0030, 0x2079, 0x1853, 0x7804, 0x0030, 0x2009, 0x07d0,
+	0x2011, 0x65af, 0x080c, 0x821d, 0x00fe, 0x00be, 0x0005, 0x00b6,
+	0x2011, 0x65af, 0x080c, 0x8159, 0x080c, 0x6625, 0x01d8, 0x2001,
+	0x107e, 0x2004, 0x2058, 0xb900, 0xc1ec, 0xb902, 0x080c, 0x6663,
+	0x0130, 0x2009, 0x07d0, 0x2011, 0x65af, 0x080c, 0x821d, 0x00e6,
+	0x2071, 0x1800, 0x9006, 0x707a, 0x705c, 0x707e, 0x080c, 0x2ddb,
+	0x00ee, 0x04d0, 0x0156, 0x00c6, 0x20a9, 0x007f, 0x900e, 0x0016,
+	0x080c, 0x6270, 0x1558, 0xb800, 0xd0ec, 0x0540, 0x0046, 0xbaa0,
+	0x2220, 0x9006, 0x2009, 0x0029, 0x080c, 0xd273, 0xb800, 0xc0e5,
+	0xc0ec, 0xb802, 0x080c, 0x665f, 0x2001, 0x0707, 0x1128, 0xb804,
+	0x9084, 0x00ff, 0x9085, 0x0700, 0xb806, 0x080c, 0x98c8, 0x2019,
+	0x0029, 0x080c, 0x863b, 0x0076, 0x903e, 0x080c, 0x852a, 0x900e,
+	0x080c, 0xcfc8, 0x007e, 0x004e, 0x080c, 0x98e4, 0x001e, 0x8108,
+	0x1f04, 0x65d7, 0x00ce, 0x015e, 0x00be, 0x0005, 0x00b6, 0x6010,
+	0x2058, 0xb800, 0xc0ec, 0xb802, 0x00be, 0x0005, 0x7810, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0ac, 0x0005, 0x6010, 0x00b6, 0x905d,
+	0x0108, 0xb800, 0x00be, 0xd0bc, 0x0005, 0x00b6, 0x00f6, 0x2001,
+	0x107e, 0x2004, 0x905d, 0x0110, 0xb800, 0xd0ec, 0x00fe, 0x00be,
+	0x0005, 0x0126, 0x0026, 0x2091, 0x8000, 0x0006, 0xbaa0, 0x9290,
+	0x1000, 0x2204, 0x9b06, 0x190c, 0x0d65, 0x000e, 0xba00, 0x9005,
+	0x0110, 0xc2fd, 0x0008, 0xc2fc, 0xba02, 0x002e, 0x012e, 0x0005,
+	0x2011, 0x1836, 0x2204, 0xd0cc, 0x0138, 0x2001, 0x1954, 0x200c,
+	0x2011, 0x6655, 0x080c, 0x821d, 0x0005, 0x2011, 0x6655, 0x080c,
+	0x8159, 0x2011, 0x1836, 0x2204, 0xc0cc, 0x2012, 0x0005, 0x080c,
+	0x538d, 0xd0ac, 0x0005, 0x080c, 0x538d, 0xd0a4, 0x0005, 0x0016,
+	0xb904, 0x9184, 0x00ff, 0x908e, 0x0006, 0x001e, 0x0005, 0x0016,
+	0xb904, 0x9184, 0xff00, 0x8007, 0x908e, 0x0006, 0x001e, 0x0005,
+	0x00b6, 0x00f6, 0x080c, 0xbf61, 0x0158, 0x70d8, 0x9084, 0x0028,
+	0x0138, 0x2001, 0x107f, 0x2004, 0x905d, 0x0110, 0xb8c4, 0xd094,
+	0x00fe, 0x00be, 0x0005, 0x0006, 0x0016, 0x0036, 0x0046, 0x0076,
+	0x00b6, 0x2001, 0x1817, 0x203c, 0x9780, 0x318b, 0x203d, 0x97bc,
+	0xff00, 0x873f, 0x9006, 0x2018, 0x2008, 0x9284, 0x8000, 0x0110,
+	0x2019, 0x0001, 0x9294, 0x7fff, 0x2100, 0x9706, 0x0190, 0x91a0,
+	0x1000, 0x2404, 0x905d, 0x0168, 0xb804, 0x9084, 0x00ff, 0x9086,
+	0x0006, 0x1138, 0x83ff, 0x0118, 0xb89c, 0xd0a4, 0x0110, 0x8211,
+	0x0158, 0x8108, 0x83ff, 0x0120, 0x9182, 0x0800, 0x0e28, 0x0068,
+	0x9182, 0x007e, 0x0e08, 0x0048, 0x00be, 0x007e, 0x004e, 0x003e,
+	0x001e, 0x9085, 0x0001, 0x000e, 0x0005, 0x00be, 0x007e, 0x004e,
+	0x003e, 0x001e, 0x9006, 0x000e, 0x0005, 0x0046, 0x0056, 0x0076,
+	0x00b6, 0x2100, 0x9084, 0x7fff, 0x9080, 0x1000, 0x2004, 0x905d,
+	0x0130, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x0550, 0x9184,
+	0x8000, 0x0580, 0x2001, 0x1817, 0x203c, 0x9780, 0x318b, 0x203d,
+	0x97bc, 0xff00, 0x873f, 0x9006, 0x2020, 0x2400, 0x9706, 0x01a0,
+	0x94a8, 0x1000, 0x2504, 0x905d, 0x0178, 0xb804, 0x9084, 0x00ff,
+	0x9086, 0x0006, 0x1148, 0xb89c, 0xd0a4, 0x0130, 0xb814, 0x9206,
+	0x1118, 0xb810, 0x9306, 0x0128, 0x8420, 0x9482, 0x0800, 0x0e28,
+	0x0048, 0x918c, 0x7fff, 0x00be, 0x007e, 0x005e, 0x004e, 0x9085,
+	0x0001, 0x0005, 0x918c, 0x7fff, 0x00be, 0x007e, 0x005e, 0x004e,
+	0x9006, 0x0005, 0x2071, 0x1906, 0x7003, 0x0001, 0x7007, 0x0000,
+	0x9006, 0x7012, 0x7016, 0x701a, 0x701e, 0x700a, 0x7046, 0x2001,
+	0x1919, 0x2003, 0x0000, 0x0005, 0x0016, 0x00e6, 0x2071, 0x191a,
+	0x900e, 0x710a, 0x080c, 0x538d, 0xd0fc, 0x1140, 0x080c, 0x538d,
+	0x900e, 0xd09c, 0x0108, 0x8108, 0x7102, 0x0400, 0x2001, 0x1873,
+	0x200c, 0x9184, 0x0007, 0x9006, 0x0002, 0x673e, 0x673e, 0x673e,
+	0x673e, 0x673e, 0x6755, 0x6763, 0x673e, 0x7003, 0x0003, 0x2009,
+	0x1874, 0x210c, 0x9184, 0xff00, 0x8007, 0x9005, 0x1110, 0x2001,
+	0x0002, 0x7006, 0x0018, 0x7003, 0x0005, 0x0c88, 0x00ee, 0x001e,
+	0x0005, 0x00e6, 0x2071, 0x0050, 0x684c, 0x9005, 0x1150, 0x00e6,
+	0x2071, 0x1906, 0x7028, 0xc085, 0x702a, 0x00ee, 0x9085, 0x0001,
+	0x0488, 0x6844, 0x9005, 0x0158, 0x080c, 0x7429, 0x6a60, 0x9200,
+	0x7002, 0x6864, 0x9101, 0x7006, 0x9006, 0x7012, 0x7016, 0x6860,
+	0x7002, 0x6864, 0x7006, 0x6868, 0x700a, 0x686c, 0x700e, 0x6844,
+	0x9005, 0x1110, 0x7012, 0x7016, 0x684c, 0x701a, 0x701c, 0x9085,
+	0x0040, 0x701e, 0x7037, 0x0019, 0x702b, 0x0001, 0x00e6, 0x2071,
+	0x1906, 0x7028, 0xc084, 0x702a, 0x7007, 0x0001, 0x700b, 0x0000,
+	0x00ee, 0x9006, 0x00ee, 0x0005, 0xa868, 0xd0fc, 0x11d8, 0x00e6,
+	0x0026, 0x2001, 0x191a, 0x2004, 0x9005, 0x0904, 0x699b, 0xa87c,
+	0xd0bc, 0x1904, 0x699b, 0xa978, 0xa874, 0x9105, 0x1904, 0x699b,
+	0x2001, 0x191a, 0x2004, 0x0002, 0x699b, 0x67ef, 0x682b, 0x682b,
+	0x699b, 0x682b, 0x0005, 0xa868, 0xd0fc, 0x1500, 0x00e6, 0x0026,
+	0x2009, 0x191a, 0x210c, 0x81ff, 0x0904, 0x699b, 0xa87c, 0xd0cc,
+	0x0904, 0x699b, 0xa880, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904,
+	0x699b, 0x9186, 0x0003, 0x0904, 0x682b, 0x9186, 0x0005, 0x0904,
+	0x682b, 0xa84f, 0x8021, 0xa853, 0x0017, 0x0028, 0x0005, 0xa84f,
+	0x8020, 0xa853, 0x0016, 0x2071, 0x1906, 0x701c, 0x9005, 0x1904,
+	0x6b3e, 0x0e04, 0x6b89, 0x2071, 0x0000, 0xa84c, 0x7082, 0xa850,
+	0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0x2091, 0x4080,
+	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x2071, 0x1800,
+	0x2011, 0x0001, 0xa804, 0x900d, 0x702c, 0x1158, 0xa802, 0x2900,
+	0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x8074, 0x002e, 0x00ee,
+	0x0005, 0x0096, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
+	0x1dc8, 0x009e, 0x0c58, 0xa84f, 0x0000, 0x00f6, 0x2079, 0x0050,
+	0x2071, 0x1906, 0xa803, 0x0000, 0x7010, 0x9005, 0x1904, 0x6920,
+	0x782c, 0x908c, 0x0780, 0x190c, 0x6cb0, 0x8004, 0x8004, 0x8004,
+	0x9084, 0x0003, 0x0002, 0x6849, 0x6920, 0x686e, 0x68bb, 0x080c,
+	0x0d65, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d, 0x1170,
 	0x2071, 0x19d4, 0x703c, 0x9005, 0x1328, 0x2001, 0x191b, 0x2004,
-	0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071,
-	0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-	0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x804c,
-	0x00ee, 0x0804, 0x6929, 0xa868, 0xd0fc, 0x1560, 0x0096, 0xa804,
-	0xa807, 0x0000, 0x904d, 0x190c, 0x0fd4, 0x009e, 0x0018, 0xa868,
-	0xd0fc, 0x1500, 0x00e6, 0x0026, 0xa84f, 0x0000, 0x00f6, 0x2079,
-	0x0050, 0x2071, 0x1906, 0xa803, 0x0000, 0x7010, 0x9005, 0x1904,
-	0x6ab1, 0x782c, 0x908c, 0x0780, 0x190c, 0x6ca9, 0x8004, 0x8004,
-	0x8004, 0x9084, 0x0003, 0x0002, 0x69b3, 0x6ab1, 0x69ce, 0x6a40,
-	0x080c, 0x0d65, 0x0005, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804,
-	0x900d, 0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016, 0x702c,
+	0x8005, 0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016, 0x702c,
 	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70bc, 0x9200, 0x70be, 0x080c, 0x804c, 0x0c60, 0x2071, 0x1800,
-	0x2900, 0x7822, 0xa804, 0x900d, 0x1904, 0x6a2f, 0x7830, 0xd0dc,
-	0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x7824, 0x00e6, 0x2071,
+	0x70bc, 0x9200, 0x70be, 0x080c, 0x8074, 0x0c10, 0x2071, 0x1800,
+	0x2900, 0x7822, 0xa804, 0x900d, 0x15a8, 0x7824, 0x00e6, 0x2071,
 	0x0040, 0x712c, 0xd19c, 0x1170, 0x2009, 0x182f, 0x210c, 0x918a,
 	0x0040, 0x0240, 0x7022, 0x2001, 0x1dc0, 0x200c, 0x8108, 0x2102,
 	0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e,
-	0x70bc, 0x8000, 0x70be, 0x080c, 0x804c, 0x782c, 0x9094, 0x0780,
-	0x190c, 0x6ca9, 0xd0a4, 0x19c8, 0x0e04, 0x6a26, 0x7838, 0x7938,
-	0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
-	0x00de, 0x2001, 0x1917, 0x200c, 0xc184, 0x2102, 0x2091, 0x4080,
-	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x2009, 0x1919,
-	0x200b, 0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2001, 0x1917,
-	0x200c, 0xc185, 0x2102, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016,
-	0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8,
-	0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x804c, 0x0804, 0x69dd,
-	0x0096, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802,
-	0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x804c, 0x782c,
-	0x9094, 0x0780, 0x190c, 0x6ca9, 0xd0a4, 0x1d60, 0x00ee, 0x0e04,
-	0x6a84, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000,
-	0x6836, 0x6833, 0x0013, 0x00de, 0x7044, 0xc084, 0x7046, 0x2091,
-	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x2009,
-	0x1919, 0x200b, 0x0000, 0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9,
-	0xd09c, 0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d, 0x11e0,
-	0x00fe, 0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x0c58,
-	0x009e, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a,
-	0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1120,
-	0x00fe, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c,
-	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
-	0x70bc, 0x9200, 0x70be, 0x080c, 0x804c, 0x00fe, 0x002e, 0x00ee,
-	0x0005, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a,
-	0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1904,
-	0x6b22, 0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9, 0xd09c, 0x11b0,
-	0x701c, 0x904d, 0x0198, 0xa84c, 0x9005, 0x1180, 0x7010, 0x8001,
-	0x7012, 0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822, 0x782c,
-	0x9094, 0x0780, 0x190c, 0x6ca9, 0xd09c, 0x0d50, 0x782c, 0x9094,
-	0x0780, 0x190c, 0x6ca9, 0xd0a4, 0x05c8, 0x00e6, 0x7824, 0x2048,
-	0x2071, 0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000,
-	0x70be, 0x080c, 0x804c, 0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9,
-	0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x6b1b, 0x7838, 0x7938, 0x910e,
+	0x70bc, 0x8000, 0x70be, 0x080c, 0x8074, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6cb0, 0xd0a4, 0x19c8, 0x2071, 0x19d4, 0x703c, 0x9005,
+	0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe, 0x002e,
+	0x00ee, 0x0005, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
+	0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c,
+	0x8074, 0x0804, 0x6875, 0x0096, 0x00e6, 0x7824, 0x2048, 0x2071,
+	0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be,
+	0x080c, 0x8074, 0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0, 0xd0a4,
+	0x1d60, 0x00ee, 0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0, 0xd09c,
+	0x11a0, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d, 0x1560, 0x2071,
+	0x19d4, 0x703c, 0x9005, 0x1328, 0x2001, 0x191b, 0x2004, 0x8005,
+	0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x009e, 0x2908, 0x7010,
+	0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008,
+	0x711e, 0x2148, 0xa804, 0x900d, 0x1170, 0x2071, 0x19d4, 0x703c,
+	0x9005, 0x1328, 0x2001, 0x191b, 0x2004, 0x8005, 0x703e, 0x00fe,
+	0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148,
+	0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc,
+	0x9200, 0x70be, 0x080c, 0x8074, 0x00fe, 0x002e, 0x00ee, 0x0005,
+	0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
+	0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1904, 0x6975,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0, 0xd09c, 0x1198, 0x701c,
+	0x904d, 0x0180, 0x7010, 0x8001, 0x7012, 0x1108, 0x701a, 0xa800,
+	0x701e, 0x2900, 0x7822, 0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0,
+	0xd09c, 0x0d68, 0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0, 0xd0a4,
+	0x01b0, 0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802,
+	0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x8074, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x6cb0, 0xd0a4, 0x1d60, 0x00ee, 0x2071,
+	0x19d4, 0x703c, 0x9005, 0x1328, 0x2001, 0x191b, 0x2004, 0x8005,
+	0x703e, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800,
+	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
+	0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x8074, 0x00ee,
+	0x0804, 0x6930, 0xa868, 0xd0fc, 0x1560, 0x0096, 0xa804, 0xa807,
+	0x0000, 0x904d, 0x190c, 0x0fd4, 0x009e, 0x0018, 0xa868, 0xd0fc,
+	0x1500, 0x00e6, 0x0026, 0xa84f, 0x0000, 0x00f6, 0x2079, 0x0050,
+	0x2071, 0x1906, 0xa803, 0x0000, 0x7010, 0x9005, 0x1904, 0x6ab8,
+	0x782c, 0x908c, 0x0780, 0x190c, 0x6cb0, 0x8004, 0x8004, 0x8004,
+	0x9084, 0x0003, 0x0002, 0x69ba, 0x6ab8, 0x69d5, 0x6a47, 0x080c,
+	0x0d65, 0x0005, 0x2071, 0x1800, 0x2900, 0x7822, 0xa804, 0x900d,
+	0x1120, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016, 0x702c, 0x2148,
+	0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc,
+	0x9200, 0x70be, 0x080c, 0x8074, 0x0c60, 0x2071, 0x1800, 0x2900,
+	0x7822, 0xa804, 0x900d, 0x1904, 0x6a36, 0x7830, 0xd0dc, 0x1120,
+	0x00fe, 0x002e, 0x00ee, 0x0005, 0x7824, 0x00e6, 0x2071, 0x0040,
+	0x712c, 0xd19c, 0x1170, 0x2009, 0x182f, 0x210c, 0x918a, 0x0040,
+	0x0240, 0x7022, 0x2001, 0x1dc0, 0x200c, 0x8108, 0x2102, 0x00ee,
+	0x0058, 0x00ee, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc,
+	0x8000, 0x70be, 0x080c, 0x8074, 0x782c, 0x9094, 0x0780, 0x190c,
+	0x6cb0, 0xd0a4, 0x19c8, 0x0e04, 0x6a2d, 0x7838, 0x7938, 0x910e,
 	0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de,
-	0x7044, 0xc084, 0x7046, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-	0xd084, 0x190c, 0x11be, 0x2009, 0x1919, 0x200b, 0x0000, 0x00fe,
-	0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x00fe, 0x002e,
-	0x00ee, 0x0005, 0x00e6, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148,
+	0x2001, 0x1917, 0x200c, 0xc184, 0x2102, 0x2091, 0x4080, 0x2001,
+	0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x2009, 0x1919, 0x200b,
+	0x0000, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x2001, 0x1917, 0x200c,
+	0xc185, 0x2102, 0x00fe, 0x002e, 0x00ee, 0x0005, 0x9016, 0x702c,
+	0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e,
+	0x70bc, 0x9200, 0x70be, 0x080c, 0x8074, 0x0804, 0x69e4, 0x0096,
+	0x00e6, 0x7824, 0x2048, 0x2071, 0x1800, 0x702c, 0xa802, 0x2900,
+	0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x8074, 0x782c, 0x9094,
+	0x0780, 0x190c, 0x6cb0, 0xd0a4, 0x1d60, 0x00ee, 0x0e04, 0x6a8b,
+	0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836,
+	0x6833, 0x0013, 0x00de, 0x7044, 0xc084, 0x7046, 0x2091, 0x4080,
+	0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x2009, 0x1919,
+	0x200b, 0x0000, 0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0, 0xd09c,
+	0x1170, 0x009e, 0x2900, 0x7822, 0xa804, 0x900d, 0x11e0, 0x00fe,
+	0x002e, 0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x0c58, 0x009e,
+	0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
+	0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1120, 0x00fe,
+	0x002e, 0x00ee, 0x0005, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148,
 	0xa904, 0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc,
-	0x9200, 0x70be, 0x080c, 0x804c, 0x00ee, 0x0804, 0x6ac1, 0x2071,
-	0x1906, 0xa803, 0x0000, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018,
-	0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804,
-	0x900d, 0x1128, 0x1e04, 0x6b62, 0x002e, 0x00ee, 0x0005, 0x2071,
+	0x9200, 0x70be, 0x080c, 0x8074, 0x00fe, 0x002e, 0x00ee, 0x0005,
+	0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110,
+	0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d, 0x1904, 0x6b29,
+	0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0, 0xd09c, 0x11b0, 0x701c,
+	0x904d, 0x0198, 0xa84c, 0x9005, 0x1180, 0x7010, 0x8001, 0x7012,
+	0x1108, 0x701a, 0xa800, 0x701e, 0x2900, 0x7822, 0x782c, 0x9094,
+	0x0780, 0x190c, 0x6cb0, 0xd09c, 0x0d50, 0x782c, 0x9094, 0x0780,
+	0x190c, 0x6cb0, 0xd0a4, 0x05c8, 0x00e6, 0x7824, 0x2048, 0x2071,
+	0x1800, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be,
+	0x080c, 0x8074, 0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0, 0xd0a4,
+	0x1d60, 0x00ee, 0x0e04, 0x6b22, 0x7838, 0x7938, 0x910e, 0x1de0,
+	0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x7044,
+	0xc084, 0x7046, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
+	0x190c, 0x11be, 0x2009, 0x1919, 0x200b, 0x0000, 0x00fe, 0x002e,
+	0x00ee, 0x0005, 0x7044, 0xc085, 0x7046, 0x00fe, 0x002e, 0x00ee,
+	0x0005, 0x00e6, 0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904,
+	0xa802, 0x8210, 0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200,
+	0x70be, 0x080c, 0x8074, 0x00ee, 0x0804, 0x6ac8, 0x2071, 0x1906,
+	0xa803, 0x0000, 0x2908, 0x7010, 0x8000, 0x7012, 0x7018, 0x904d,
+	0x711a, 0x0110, 0xa902, 0x0008, 0x711e, 0x2148, 0xa804, 0x900d,
+	0x1128, 0x1e04, 0x6b69, 0x002e, 0x00ee, 0x0005, 0x2071, 0x1800,
+	0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900, 0x81ff,
+	0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x8074, 0x0e04,
+	0x6b53, 0x2071, 0x1906, 0x701c, 0x2048, 0xa84c, 0x900d, 0x0d18,
+	0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036,
+	0xa870, 0x708a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
+	0x190c, 0x11be, 0x2071, 0x1906, 0x080c, 0x6c9c, 0x002e, 0x00ee,
+	0x0005, 0x2071, 0x1906, 0xa803, 0x0000, 0x2908, 0x7010, 0x8000,
+	0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008, 0x711e,
+	0x2148, 0xa804, 0x900d, 0x1118, 0x002e, 0x00ee, 0x0005, 0x2071,
 	0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210, 0x2900,
-	0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x804c,
-	0x0e04, 0x6b4c, 0x2071, 0x1906, 0x701c, 0x2048, 0xa84c, 0x900d,
-	0x0d18, 0x2071, 0x0000, 0x7182, 0xa850, 0x7032, 0xa86c, 0x7086,
-	0x7036, 0xa870, 0x708a, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
-	0xd084, 0x190c, 0x11be, 0x2071, 0x1906, 0x080c, 0x6c95, 0x002e,
-	0x00ee, 0x0005, 0x2071, 0x1906, 0xa803, 0x0000, 0x2908, 0x7010,
-	0x8000, 0x7012, 0x7018, 0x904d, 0x711a, 0x0110, 0xa902, 0x0008,
-	0x711e, 0x2148, 0xa804, 0x900d, 0x1118, 0x002e, 0x00ee, 0x0005,
-	0x2071, 0x1800, 0x9016, 0x702c, 0x2148, 0xa904, 0xa802, 0x8210,
-	0x2900, 0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c,
-	0x804c, 0x002e, 0x00ee, 0x0005, 0x0006, 0xa87c, 0x0006, 0xa867,
-	0x0103, 0x20a9, 0x001c, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001d,
-	0x20a0, 0x9006, 0x4004, 0x000e, 0x9084, 0x00ff, 0xa87e, 0x000e,
-	0xa87a, 0xa982, 0x0005, 0x2071, 0x1906, 0x7004, 0x0002, 0x6bcd,
-	0x6bce, 0x6c94, 0x6bce, 0x0d65, 0x6c94, 0x0005, 0x2001, 0x191a,
-	0x2004, 0x0002, 0x6bd8, 0x6bd8, 0x6c2d, 0x6c2e, 0x6bd8, 0x6c2e,
-	0x0126, 0x2091, 0x8000, 0x1e0c, 0x6cb4, 0x701c, 0x904d, 0x01e0,
-	0xa84c, 0x9005, 0x01d8, 0x0e04, 0x6bfc, 0xa94c, 0x2071, 0x0000,
-	0x7182, 0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a,
-	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be,
-	0x2071, 0x1906, 0x080c, 0x6c95, 0x012e, 0x0470, 0x2001, 0x005b,
-	0x2004, 0x9094, 0x0780, 0x190c, 0x6ca9, 0xd09c, 0x2071, 0x1906,
-	0x1510, 0x2071, 0x1906, 0x700f, 0x0001, 0xa964, 0x9184, 0x00ff,
-	0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101, 0x0108,
-	0x710e, 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de, 0x2071,
-	0x1906, 0x701c, 0x2048, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e,
-	0x9005, 0x1108, 0x701a, 0x012e, 0x0005, 0x0005, 0x00d6, 0x2008,
-	0x2069, 0x19d4, 0x683c, 0x9005, 0x0760, 0x0158, 0x9186, 0x0003,
-	0x0540, 0x2001, 0x1814, 0x2004, 0x2009, 0x1b1e, 0x210c, 0x9102,
-	0x1500, 0x0126, 0x2091, 0x8000, 0x2069, 0x0050, 0x693c, 0x6838,
-	0x9106, 0x0190, 0x0e04, 0x6c60, 0x2069, 0x0000, 0x6837, 0x8040,
-	0x6833, 0x0012, 0x6883, 0x8040, 0x2091, 0x4080, 0x2001, 0x0089,
-	0x2004, 0xd084, 0x190c, 0x11be, 0x2069, 0x19d4, 0x683f, 0xffff,
-	0x012e, 0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x6d2a, 0x701c,
-	0x904d, 0x0540, 0x2001, 0x005b, 0x2004, 0x9094, 0x0780, 0x15c9,
-	0xd09c, 0x1500, 0x2071, 0x1906, 0x700f, 0x0001, 0xa964, 0x9184,
-	0x00ff, 0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101,
-	0x0108, 0x710e, 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de,
+	0x81ff, 0x1dc8, 0x702e, 0x70bc, 0x9200, 0x70be, 0x080c, 0x8074,
+	0x002e, 0x00ee, 0x0005, 0x0006, 0xa87c, 0x0006, 0xa867, 0x0103,
+	0x20a9, 0x001c, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x001d, 0x20a0,
+	0x9006, 0x4004, 0x000e, 0x9084, 0x00ff, 0xa87e, 0x000e, 0xa87a,
+	0xa982, 0x0005, 0x2071, 0x1906, 0x7004, 0x0002, 0x6bd4, 0x6bd5,
+	0x6c9b, 0x6bd5, 0x0d65, 0x6c9b, 0x0005, 0x2001, 0x191a, 0x2004,
+	0x0002, 0x6bdf, 0x6bdf, 0x6c34, 0x6c35, 0x6bdf, 0x6c35, 0x0126,
+	0x2091, 0x8000, 0x1e0c, 0x6cbb, 0x701c, 0x904d, 0x01e0, 0xa84c,
+	0x9005, 0x01d8, 0x0e04, 0x6c03, 0xa94c, 0x2071, 0x0000, 0x7182,
+	0xa850, 0x7032, 0xa86c, 0x7086, 0x7036, 0xa870, 0x708a, 0x2091,
+	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x2071,
+	0x1906, 0x080c, 0x6c9c, 0x012e, 0x0470, 0x2001, 0x005b, 0x2004,
+	0x9094, 0x0780, 0x190c, 0x6cb0, 0xd09c, 0x2071, 0x1906, 0x1510,
+	0x2071, 0x1906, 0x700f, 0x0001, 0xa964, 0x9184, 0x00ff, 0x9086,
+	0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101, 0x0108, 0x710e,
+	0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de, 0x2071, 0x1906,
 	0x701c, 0x2048, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005,
-	0x1108, 0x701a, 0x012e, 0x0005, 0x0005, 0x0126, 0x2091, 0x8000,
-	0x701c, 0x904d, 0x0160, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e,
-	0x9005, 0x1108, 0x701a, 0x012e, 0x080c, 0x1054, 0x0005, 0x012e,
-	0x0005, 0x2091, 0x8000, 0x0e04, 0x6cab, 0x0006, 0x0016, 0x2001,
-	0x8004, 0x0006, 0x0804, 0x0d6e, 0x0096, 0x00f6, 0x2079, 0x0050,
-	0x7044, 0xd084, 0x01e0, 0xc084, 0x7046, 0x7838, 0x7938, 0x910e,
-	0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de,
-	0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be,
-	0x2009, 0x1919, 0x200b, 0x0000, 0x00fe, 0x009e, 0x0005, 0x782c,
-	0x9094, 0x0780, 0x1971, 0xd0a4, 0x0db8, 0x2009, 0x1919, 0x2104,
-	0x8000, 0x200a, 0x9082, 0x000f, 0x0e78, 0x00e6, 0x2071, 0x1800,
-	0x7824, 0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1170, 0x2009,
-	0x182f, 0x210c, 0x918a, 0x0040, 0x0240, 0x7022, 0x2001, 0x1dc0,
-	0x200c, 0x8108, 0x2102, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c,
-	0xa802, 0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x804c,
-	0x782c, 0x9094, 0x0780, 0x190c, 0x6ca9, 0xd0a4, 0x19c8, 0x7838,
-	0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833,
-	0x0013, 0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084,
-	0x190c, 0x11be, 0x2009, 0x1919, 0x200b, 0x0000, 0x00ee, 0x00fe,
-	0x009e, 0x0005, 0x00f6, 0x2079, 0x0050, 0x7044, 0xd084, 0x01b8,
-	0xc084, 0x7046, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069,
-	0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x2091, 0x4080, 0x2001,
-	0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x00fe, 0x0005, 0x782c,
-	0x9094, 0x0780, 0x190c, 0x6ca9, 0xd0a4, 0x0db8, 0x00e6, 0x2071,
-	0x1800, 0x7824, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc,
-	0x8000, 0x70be, 0x080c, 0x804c, 0x782c, 0x9094, 0x0780, 0x190c,
-	0x6ca9, 0xd0a4, 0x1d70, 0x00d6, 0x2069, 0x0050, 0x693c, 0x2069,
-	0x191a, 0x6808, 0x690a, 0x2069, 0x19d4, 0x9102, 0x1118, 0x683c,
-	0x9005, 0x1328, 0x2001, 0x191b, 0x200c, 0x810d, 0x693e, 0x00de,
-	0x00ee, 0x00fe, 0x0005, 0x7094, 0x908a, 0x0029, 0x1a0c, 0x0d65,
-	0x9082, 0x001d, 0x003b, 0x0026, 0x2011, 0x1e00, 0x080c, 0x286d,
-	0x002e, 0x0005, 0x6e52, 0x6ddc, 0x6df8, 0x6e20, 0x6e41, 0x6e81,
-	0x6e93, 0x6df8, 0x6e69, 0x6d97, 0x6dc5, 0x6d96, 0x0005, 0x00d6,
-	0x2069, 0x0200, 0x6804, 0x9005, 0x1180, 0x6808, 0x9005, 0x1518,
-	0x7097, 0x0028, 0x2069, 0x1960, 0x2d04, 0x7002, 0x080c, 0x71ed,
-	0x6028, 0x9085, 0x0600, 0x602a, 0x00b0, 0x7097, 0x0028, 0x2069,
-	0x1960, 0x2d04, 0x7002, 0x6028, 0x9085, 0x0600, 0x602a, 0x00e6,
-	0x0036, 0x0046, 0x0056, 0x2071, 0x1a3c, 0x080c, 0x195f, 0x005e,
-	0x004e, 0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6, 0x2069, 0x0200,
-	0x6804, 0x9005, 0x1178, 0x6808, 0x9005, 0x1160, 0x7097, 0x0028,
-	0x2069, 0x1960, 0x2d04, 0x7002, 0x080c, 0x728f, 0x6028, 0x9085,
-	0x0600, 0x602a, 0x00de, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c,
-	0x2833, 0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x6f04, 0xd1d4,
-	0x1160, 0xd1dc, 0x1138, 0xd1cc, 0x0150, 0x7097, 0x0020, 0x080c,
-	0x6f04, 0x0028, 0x7097, 0x001d, 0x0010, 0x7097, 0x001f, 0x0005,
-	0x2001, 0x0088, 0x080c, 0x2833, 0x6124, 0xd1cc, 0x11d8, 0xd1dc,
-	0x11b0, 0xd1e4, 0x1188, 0x9184, 0x1e00, 0x11c8, 0x60e3, 0x0001,
-	0x600c, 0xc0b4, 0x600e, 0x080c, 0x70d8, 0x2001, 0x0080, 0x080c,
-	0x2833, 0x7097, 0x0028, 0x0058, 0x7097, 0x001e, 0x0040, 0x7097,
-	0x001d, 0x0028, 0x7097, 0x0020, 0x0010, 0x7097, 0x001f, 0x0005,
-	0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x70d8, 0x2001,
-	0x0080, 0x080c, 0x2833, 0x6124, 0xd1d4, 0x1180, 0xd1dc, 0x1158,
-	0xd1e4, 0x1130, 0x9184, 0x1e00, 0x1158, 0x7097, 0x0028, 0x0040,
-	0x7097, 0x001e, 0x0028, 0x7097, 0x001d, 0x0010, 0x7097, 0x001f,
-	0x0005, 0x2001, 0x00a0, 0x080c, 0x2833, 0x6124, 0xd1dc, 0x1138,
-	0xd1e4, 0x0138, 0x080c, 0x1989, 0x7097, 0x001e, 0x0010, 0x7097,
-	0x001d, 0x0005, 0x080c, 0x6f8d, 0x6124, 0xd1dc, 0x1188, 0x080c,
-	0x6f04, 0x0016, 0x080c, 0x1989, 0x001e, 0xd1d4, 0x1128, 0xd1e4,
-	0x0138, 0x7097, 0x001e, 0x0020, 0x7097, 0x001f, 0x080c, 0x6f04,
-	0x0005, 0x0006, 0x2001, 0x00a0, 0x080c, 0x2833, 0x000e, 0x6124,
-	0xd1d4, 0x1160, 0xd1cc, 0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140,
-	0x7097, 0x001e, 0x0028, 0x7097, 0x001d, 0x0010, 0x7097, 0x0021,
-	0x0005, 0x080c, 0x6f8d, 0x6124, 0xd1d4, 0x1150, 0xd1dc, 0x1128,
-	0xd1e4, 0x0140, 0x7097, 0x001e, 0x0028, 0x7097, 0x001d, 0x0010,
-	0x7097, 0x001f, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c, 0x2833,
-	0x000e, 0x6124, 0xd1d4, 0x1178, 0xd1cc, 0x1150, 0xd1dc, 0x1128,
-	0xd1e4, 0x0158, 0x7097, 0x001e, 0x0040, 0x7097, 0x001d, 0x0028,
-	0x7097, 0x0020, 0x0010, 0x7097, 0x001f, 0x0005, 0x0016, 0x00c6,
-	0x00d6, 0x00e6, 0x0126, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071,
-	0x1800, 0x2091, 0x8000, 0x080c, 0x70ac, 0x11f8, 0x2001, 0x180c,
-	0x200c, 0xd1b4, 0x01d0, 0xc1b4, 0x2102, 0x0026, 0x2011, 0x0200,
-	0x080c, 0x286d, 0x002e, 0x080c, 0x2819, 0x6024, 0xd0cc, 0x0148,
-	0x2001, 0x00a0, 0x080c, 0x2833, 0x080c, 0x73ac, 0x080c, 0x5cd5,
-	0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408, 0x080c, 0x70c6, 0x0150,
-	0x080c, 0x70bd, 0x1138, 0x2001, 0x0001, 0x080c, 0x23c9, 0x080c,
-	0x7080, 0x00a0, 0x080c, 0x6f8a, 0x0178, 0x2001, 0x0001, 0x080c,
-	0x23c9, 0x7094, 0x9086, 0x001e, 0x0120, 0x7094, 0x9086, 0x0022,
-	0x1118, 0x7097, 0x0025, 0x0010, 0x7097, 0x0021, 0x012e, 0x00ee,
-	0x00de, 0x00ce, 0x001e, 0x0005, 0x0026, 0x2011, 0x6f15, 0x080c,
-	0x8237, 0x002e, 0x0016, 0x0026, 0x2009, 0x0064, 0x2011, 0x6f15,
-	0x080c, 0x822e, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00f6, 0x0016,
-	0x080c, 0x8f9c, 0x2071, 0x1800, 0x080c, 0x6eae, 0x001e, 0x00fe,
-	0x00ee, 0x0005, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6,
-	0x00f6, 0x0126, 0x080c, 0x8f9c, 0x2061, 0x0100, 0x2069, 0x0140,
-	0x2071, 0x1800, 0x2091, 0x8000, 0x6028, 0xc09c, 0x602a, 0x080c,
-	0x98ad, 0x2011, 0x0003, 0x080c, 0x931e, 0x2011, 0x0002, 0x080c,
-	0x9328, 0x080c, 0x91eb, 0x080c, 0x81e3, 0x0036, 0x901e, 0x080c,
-	0x926b, 0x003e, 0x080c, 0x98c9, 0x60e3, 0x0000, 0x080c, 0xd5d9,
-	0x080c, 0xd5f4, 0x2009, 0x0004, 0x080c, 0x281f, 0x080c, 0x273f,
-	0x2001, 0x1800, 0x2003, 0x0004, 0x2011, 0x0008, 0x080c, 0x286d,
-	0x2011, 0x6f15, 0x080c, 0x8237, 0x080c, 0x70c6, 0x0118, 0x9006,
-	0x080c, 0x2833, 0x080c, 0x0bab, 0x2001, 0x0001, 0x080c, 0x23c9,
-	0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
-	0x0005, 0x0026, 0x00e6, 0x2011, 0x6f22, 0x2071, 0x19d4, 0x701c,
-	0x9206, 0x1118, 0x7018, 0x9005, 0x0110, 0x9085, 0x0001, 0x00ee,
-	0x002e, 0x0005, 0x6020, 0xd09c, 0x0005, 0x6800, 0x9084, 0xfffe,
-	0x9086, 0x00c0, 0x01b8, 0x2001, 0x00c0, 0x080c, 0x2833, 0x0156,
-	0x20a9, 0x002d, 0x1d04, 0x6f9a, 0x2091, 0x6000, 0x1f04, 0x6f9a,
-	0x015e, 0x00d6, 0x2069, 0x1800, 0x6898, 0x8001, 0x0220, 0x0118,
-	0x689a, 0x00de, 0x0005, 0x689b, 0x0014, 0x68e8, 0xd0dc, 0x0dc8,
-	0x6800, 0x9086, 0x0001, 0x1da8, 0x080c, 0x8243, 0x0c90, 0x00c6,
-	0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800,
-	0x080c, 0x73bb, 0x2001, 0x193e, 0x2003, 0x0000, 0x9006, 0x7096,
-	0x60e2, 0x6886, 0x080c, 0x2498, 0x9006, 0x080c, 0x2833, 0x080c,
-	0x5b90, 0x0026, 0x2011, 0xffff, 0x080c, 0x286d, 0x002e, 0x602b,
-	0x182c, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6,
-	0x2061, 0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2001, 0x194e,
-	0x200c, 0x9186, 0x0000, 0x0158, 0x9186, 0x0001, 0x0158, 0x9186,
-	0x0002, 0x0158, 0x9186, 0x0003, 0x0158, 0x0804, 0x7070, 0x7097,
-	0x0022, 0x0040, 0x7097, 0x0021, 0x0028, 0x7097, 0x0023, 0x0010,
-	0x7097, 0x0024, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001,
-	0x080c, 0x2498, 0x080c, 0x98ad, 0x0026, 0x080c, 0x9b52, 0x002e,
-	0x080c, 0x98c9, 0x7000, 0x908e, 0x0004, 0x0118, 0x602b, 0x0028,
-	0x0010, 0x602b, 0x0020, 0x0156, 0x0126, 0x2091, 0x8000, 0x20a9,
-	0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e, 0x015e, 0x080c, 0xbf46,
-	0x0118, 0x9006, 0x080c, 0x285d, 0x0804, 0x707c, 0x6800, 0x9084,
-	0x00a1, 0xc0bd, 0x6802, 0x080c, 0x2819, 0x6904, 0xd1d4, 0x1140,
-	0x2001, 0x0100, 0x080c, 0x2833, 0x1f04, 0x7021, 0x080c, 0x7103,
-	0x012e, 0x015e, 0x080c, 0x70bd, 0x0170, 0x6044, 0x9005, 0x0130,
-	0x080c, 0x7103, 0x9006, 0x8001, 0x1df0, 0x0028, 0x6804, 0xd0d4,
-	0x1110, 0x080c, 0x7103, 0x080c, 0xbf46, 0x0118, 0x9006, 0x080c,
-	0x285d, 0x0016, 0x0026, 0x7000, 0x908e, 0x0004, 0x0130, 0x2009,
-	0x00c8, 0x2011, 0x6f22, 0x080c, 0x81f5, 0x002e, 0x001e, 0x080c,
-	0x8043, 0x7034, 0xc085, 0x7036, 0x2001, 0x194e, 0x2003, 0x0004,
-	0x080c, 0x6d7b, 0x080c, 0x70bd, 0x0138, 0x6804, 0xd0d4, 0x1120,
-	0xd0dc, 0x1100, 0x080c, 0x73b1, 0x00ee, 0x00de, 0x00ce, 0x0005,
+	0x1108, 0x701a, 0x012e, 0x0005, 0x0005, 0x00d6, 0x2008, 0x2069,
+	0x19d4, 0x683c, 0x9005, 0x0760, 0x0158, 0x9186, 0x0003, 0x0540,
+	0x2001, 0x1814, 0x2004, 0x2009, 0x1b1e, 0x210c, 0x9102, 0x1500,
+	0x0126, 0x2091, 0x8000, 0x2069, 0x0050, 0x693c, 0x6838, 0x9106,
+	0x0190, 0x0e04, 0x6c67, 0x2069, 0x0000, 0x6837, 0x8040, 0x6833,
+	0x0012, 0x6883, 0x8040, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004,
+	0xd084, 0x190c, 0x11be, 0x2069, 0x19d4, 0x683f, 0xffff, 0x012e,
+	0x00de, 0x0126, 0x2091, 0x8000, 0x1e0c, 0x6d31, 0x701c, 0x904d,
+	0x0540, 0x2001, 0x005b, 0x2004, 0x9094, 0x0780, 0x15c9, 0xd09c,
+	0x1500, 0x2071, 0x1906, 0x700f, 0x0001, 0xa964, 0x9184, 0x00ff,
+	0x9086, 0x0003, 0x1130, 0x810f, 0x918c, 0x00ff, 0x8101, 0x0108,
+	0x710e, 0x2900, 0x00d6, 0x2069, 0x0050, 0x6822, 0x00de, 0x701c,
+	0x2048, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005, 0x1108,
+	0x701a, 0x012e, 0x0005, 0x0005, 0x0126, 0x2091, 0x8000, 0x701c,
+	0x904d, 0x0160, 0x7010, 0x8001, 0x7012, 0xa800, 0x701e, 0x9005,
+	0x1108, 0x701a, 0x012e, 0x080c, 0x1054, 0x0005, 0x012e, 0x0005,
+	0x2091, 0x8000, 0x0e04, 0x6cb2, 0x0006, 0x0016, 0x2001, 0x8004,
+	0x0006, 0x0804, 0x0d6e, 0x0096, 0x00f6, 0x2079, 0x0050, 0x7044,
+	0xd084, 0x01e0, 0xc084, 0x7046, 0x7838, 0x7938, 0x910e, 0x1de0,
+	0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013, 0x00de, 0x2091,
+	0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c, 0x11be, 0x2009,
+	0x1919, 0x200b, 0x0000, 0x00fe, 0x009e, 0x0005, 0x782c, 0x9094,
+	0x0780, 0x1971, 0xd0a4, 0x0db8, 0x2009, 0x1919, 0x2104, 0x8000,
+	0x200a, 0x9082, 0x000f, 0x0e78, 0x00e6, 0x2071, 0x1800, 0x7824,
+	0x00e6, 0x2071, 0x0040, 0x712c, 0xd19c, 0x1170, 0x2009, 0x182f,
+	0x210c, 0x918a, 0x0040, 0x0240, 0x7022, 0x2001, 0x1dc0, 0x200c,
+	0x8108, 0x2102, 0x00ee, 0x0058, 0x00ee, 0x2048, 0x702c, 0xa802,
+	0x2900, 0x702e, 0x70bc, 0x8000, 0x70be, 0x080c, 0x8074, 0x782c,
+	0x9094, 0x0780, 0x190c, 0x6cb0, 0xd0a4, 0x19c8, 0x7838, 0x7938,
+	0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000, 0x6836, 0x6833, 0x0013,
+	0x00de, 0x2091, 0x4080, 0x2001, 0x0089, 0x2004, 0xd084, 0x190c,
+	0x11be, 0x2009, 0x1919, 0x200b, 0x0000, 0x00ee, 0x00fe, 0x009e,
+	0x0005, 0x00f6, 0x2079, 0x0050, 0x7044, 0xd084, 0x01b8, 0xc084,
+	0x7046, 0x7838, 0x7938, 0x910e, 0x1de0, 0x00d6, 0x2069, 0x0000,
+	0x6836, 0x6833, 0x0013, 0x00de, 0x2091, 0x4080, 0x2001, 0x0089,
+	0x2004, 0xd084, 0x190c, 0x11be, 0x00fe, 0x0005, 0x782c, 0x9094,
+	0x0780, 0x190c, 0x6cb0, 0xd0a4, 0x0db8, 0x00e6, 0x2071, 0x1800,
+	0x7824, 0x2048, 0x702c, 0xa802, 0x2900, 0x702e, 0x70bc, 0x8000,
+	0x70be, 0x080c, 0x8074, 0x782c, 0x9094, 0x0780, 0x190c, 0x6cb0,
+	0xd0a4, 0x1d70, 0x00d6, 0x2069, 0x0050, 0x693c, 0x2069, 0x191a,
+	0x6808, 0x690a, 0x2069, 0x19d4, 0x9102, 0x1118, 0x683c, 0x9005,
+	0x1328, 0x2001, 0x191b, 0x200c, 0x810d, 0x693e, 0x00de, 0x00ee,
+	0x00fe, 0x0005, 0x7094, 0x908a, 0x0029, 0x1a0c, 0x0d65, 0x9082,
+	0x001d, 0x003b, 0x0026, 0x2011, 0x1e00, 0x080c, 0x286d, 0x002e,
+	0x0005, 0x6e5d, 0x6de3, 0x6dff, 0x6e29, 0x6e4c, 0x6e8c, 0x6e9e,
+	0x6dff, 0x6e74, 0x6d9e, 0x6dcc, 0x6d9d, 0x0005, 0x00d6, 0x2069,
+	0x0200, 0x6804, 0x9005, 0x1180, 0x6808, 0x9005, 0x1518, 0x7097,
+	0x0028, 0x2069, 0x1960, 0x2d04, 0x7002, 0x080c, 0x71f8, 0x6028,
+	0x9085, 0x0600, 0x602a, 0x00b0, 0x7097, 0x0028, 0x2069, 0x1960,
+	0x2d04, 0x7002, 0x6028, 0x9085, 0x0600, 0x602a, 0x00e6, 0x0036,
+	0x0046, 0x0056, 0x2071, 0x1a3c, 0x080c, 0x195f, 0x005e, 0x004e,
+	0x003e, 0x00ee, 0x00de, 0x0005, 0x00d6, 0x2069, 0x0200, 0x6804,
+	0x9005, 0x1178, 0x6808, 0x9005, 0x1160, 0x7097, 0x0028, 0x2069,
+	0x1960, 0x2d04, 0x7002, 0x080c, 0x729a, 0x6028, 0x9085, 0x0600,
+	0x602a, 0x00de, 0x0005, 0x0006, 0x2001, 0x0090, 0x080c, 0x2833,
+	0x000e, 0x6124, 0xd1e4, 0x1190, 0x080c, 0x6f0f, 0xd1d4, 0x1160,
+	0xd1dc, 0x1138, 0xd1cc, 0x0150, 0x7097, 0x0020, 0x080c, 0x6f0f,
+	0x0028, 0x7097, 0x001d, 0x0010, 0x7097, 0x001f, 0x0005, 0x2001,
+	0x0088, 0x080c, 0x2833, 0x6124, 0xd1cc, 0x11e8, 0xd1dc, 0x11c0,
+	0xd1e4, 0x1198, 0x9184, 0x1e00, 0x11d8, 0x080c, 0x1989, 0x60e3,
+	0x0001, 0x600c, 0xc0b4, 0x600e, 0x080c, 0x70e3, 0x2001, 0x0080,
+	0x080c, 0x2833, 0x7097, 0x0028, 0x0058, 0x7097, 0x001e, 0x0040,
+	0x7097, 0x001d, 0x0028, 0x7097, 0x0020, 0x0010, 0x7097, 0x001f,
+	0x0005, 0x080c, 0x1989, 0x60e3, 0x0001, 0x600c, 0xc0b4, 0x600e,
+	0x080c, 0x70e3, 0x2001, 0x0080, 0x080c, 0x2833, 0x6124, 0xd1d4,
+	0x1180, 0xd1dc, 0x1158, 0xd1e4, 0x1130, 0x9184, 0x1e00, 0x1158,
+	0x7097, 0x0028, 0x0040, 0x7097, 0x001e, 0x0028, 0x7097, 0x001d,
+	0x0010, 0x7097, 0x001f, 0x0005, 0x2001, 0x00a0, 0x080c, 0x2833,
+	0x6124, 0xd1dc, 0x1138, 0xd1e4, 0x0138, 0x080c, 0x1989, 0x7097,
+	0x001e, 0x0010, 0x7097, 0x001d, 0x0005, 0x080c, 0x6f98, 0x6124,
+	0xd1dc, 0x1188, 0x080c, 0x6f0f, 0x0016, 0x080c, 0x1989, 0x001e,
+	0xd1d4, 0x1128, 0xd1e4, 0x0138, 0x7097, 0x001e, 0x0020, 0x7097,
+	0x001f, 0x080c, 0x6f0f, 0x0005, 0x0006, 0x2001, 0x00a0, 0x080c,
+	0x2833, 0x000e, 0x6124, 0xd1d4, 0x1160, 0xd1cc, 0x1150, 0xd1dc,
+	0x1128, 0xd1e4, 0x0140, 0x7097, 0x001e, 0x0028, 0x7097, 0x001d,
+	0x0010, 0x7097, 0x0021, 0x0005, 0x080c, 0x6f98, 0x6124, 0xd1d4,
+	0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0140, 0x7097, 0x001e, 0x0028,
+	0x7097, 0x001d, 0x0010, 0x7097, 0x001f, 0x0005, 0x0006, 0x2001,
+	0x0090, 0x080c, 0x2833, 0x000e, 0x6124, 0xd1d4, 0x1178, 0xd1cc,
+	0x1150, 0xd1dc, 0x1128, 0xd1e4, 0x0158, 0x7097, 0x001e, 0x0040,
+	0x7097, 0x001d, 0x0028, 0x7097, 0x0020, 0x0010, 0x7097, 0x001f,
+	0x0005, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x0126, 0x2061, 0x0100,
+	0x2069, 0x0140, 0x2071, 0x1800, 0x2091, 0x8000, 0x080c, 0x70b7,
+	0x11f8, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x01d0, 0xc1b4, 0x2102,
+	0x0026, 0x2011, 0x0200, 0x080c, 0x286d, 0x002e, 0x080c, 0x2819,
+	0x6024, 0xd0cc, 0x0148, 0x2001, 0x00a0, 0x080c, 0x2833, 0x080c,
+	0x73b7, 0x080c, 0x5cdc, 0x0428, 0x6028, 0xc0cd, 0x602a, 0x0408,
+	0x080c, 0x70d1, 0x0150, 0x080c, 0x70c8, 0x1138, 0x2001, 0x0001,
+	0x080c, 0x23c9, 0x080c, 0x708b, 0x00a0, 0x080c, 0x6f95, 0x0178,
+	0x2001, 0x0001, 0x080c, 0x23c9, 0x7094, 0x9086, 0x001e, 0x0120,
+	0x7094, 0x9086, 0x0022, 0x1118, 0x7097, 0x0025, 0x0010, 0x7097,
+	0x0021, 0x012e, 0x00ee, 0x00de, 0x00ce, 0x001e, 0x0005, 0x0026,
+	0x2011, 0x6f20, 0x080c, 0x825f, 0x002e, 0x0016, 0x0026, 0x2009,
+	0x0064, 0x2011, 0x6f20, 0x080c, 0x8256, 0x002e, 0x001e, 0x0005,
+	0x00e6, 0x00f6, 0x0016, 0x080c, 0x8fb7, 0x2071, 0x1800, 0x080c,
+	0x6eb9, 0x001e, 0x00fe, 0x00ee, 0x0005, 0x0016, 0x0026, 0x0036,
+	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x0126, 0x080c, 0x8fb7, 0x2061,
+	0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x2091, 0x8000, 0x6028,
+	0xc09c, 0x602a, 0x080c, 0x98c8, 0x2011, 0x0003, 0x080c, 0x9339,
+	0x2011, 0x0002, 0x080c, 0x9343, 0x080c, 0x9206, 0x080c, 0x820b,
+	0x0036, 0x901e, 0x080c, 0x9286, 0x003e, 0x080c, 0x98e4, 0x60e3,
+	0x0000, 0x080c, 0xd5fb, 0x080c, 0xd616, 0x2009, 0x0004, 0x080c,
+	0x281f, 0x080c, 0x273f, 0x2001, 0x1800, 0x2003, 0x0004, 0x2011,
+	0x0008, 0x080c, 0x286d, 0x2011, 0x6f20, 0x080c, 0x825f, 0x080c,
+	0x70d1, 0x0118, 0x9006, 0x080c, 0x2833, 0x080c, 0x0bab, 0x2001,
+	0x0001, 0x080c, 0x23c9, 0x012e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
+	0x003e, 0x002e, 0x001e, 0x0005, 0x0026, 0x00e6, 0x2011, 0x6f2d,
+	0x2071, 0x19d4, 0x701c, 0x9206, 0x1118, 0x7018, 0x9005, 0x0110,
+	0x9085, 0x0001, 0x00ee, 0x002e, 0x0005, 0x6020, 0xd09c, 0x0005,
+	0x6800, 0x9084, 0xfffe, 0x9086, 0x00c0, 0x01b8, 0x2001, 0x00c0,
+	0x080c, 0x2833, 0x0156, 0x20a9, 0x002d, 0x1d04, 0x6fa5, 0x2091,
+	0x6000, 0x1f04, 0x6fa5, 0x015e, 0x00d6, 0x2069, 0x1800, 0x6898,
+	0x8001, 0x0220, 0x0118, 0x689a, 0x00de, 0x0005, 0x689b, 0x0014,
+	0x68e8, 0xd0dc, 0x0dc8, 0x6800, 0x9086, 0x0001, 0x1da8, 0x080c,
+	0x826b, 0x0c90, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x2071, 0x1800, 0x080c, 0x73c6, 0x2001, 0x193e, 0x2003,
+	0x0000, 0x9006, 0x7096, 0x60e2, 0x6886, 0x080c, 0x2498, 0x9006,
+	0x080c, 0x2833, 0x080c, 0x5b97, 0x0026, 0x2011, 0xffff, 0x080c,
+	0x286d, 0x002e, 0x602b, 0x182c, 0x00ee, 0x00de, 0x00ce, 0x0005,
 	0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140, 0x2071,
-	0x1800, 0x080c, 0x805a, 0x080c, 0x804c, 0x080c, 0x73bb, 0x2001,
-	0x193e, 0x2003, 0x0000, 0x9006, 0x7096, 0x60e2, 0x6886, 0x080c,
-	0x2498, 0x9006, 0x080c, 0x2833, 0x6043, 0x0090, 0x6043, 0x0010,
-	0x0026, 0x2011, 0xffff, 0x080c, 0x286d, 0x002e, 0x602b, 0x182c,
-	0x00ee, 0x00de, 0x00ce, 0x0005, 0x0006, 0x2001, 0x194d, 0x2004,
-	0x9086, 0xaaaa, 0x000e, 0x0005, 0x0006, 0x080c, 0x538a, 0x9084,
-	0x0030, 0x9086, 0x0000, 0x000e, 0x0005, 0x0006, 0x080c, 0x538a,
-	0x9084, 0x0030, 0x9086, 0x0030, 0x000e, 0x0005, 0x0006, 0x080c,
-	0x538a, 0x9084, 0x0030, 0x9086, 0x0010, 0x000e, 0x0005, 0x0006,
-	0x080c, 0x538a, 0x9084, 0x0030, 0x9086, 0x0020, 0x000e, 0x0005,
-	0x0036, 0x0016, 0x2001, 0x180c, 0x2004, 0x908c, 0x0013, 0x0180,
-	0x0020, 0x080c, 0x24b8, 0x900e, 0x0028, 0x080c, 0x6658, 0x1dc8,
-	0x2009, 0x0002, 0x2019, 0x0028, 0x080c, 0x2fc2, 0x9006, 0x0019,
-	0x001e, 0x003e, 0x0005, 0x00e6, 0x2071, 0x180c, 0x2e04, 0x0130,
-	0x080c, 0xbf3f, 0x1128, 0x9085, 0x0010, 0x0010, 0x9084, 0xffef,
-	0x2072, 0x00ee, 0x0005, 0x6050, 0x0006, 0x60ec, 0x0006, 0x600c,
-	0x0006, 0x6004, 0x0006, 0x6028, 0x0006, 0x602f, 0x0100, 0x602f,
-	0x0000, 0x602f, 0x0040, 0x602f, 0x0000, 0x20a9, 0x0002, 0x080c,
-	0x27fa, 0x0026, 0x2011, 0x0040, 0x080c, 0x286d, 0x002e, 0x000e,
-	0x602a, 0x000e, 0x6006, 0x000e, 0x600e, 0x000e, 0x60ee, 0x60e3,
-	0x0000, 0x6887, 0x0001, 0x2001, 0x0001, 0x080c, 0x2498, 0x2001,
-	0x00a0, 0x0006, 0x080c, 0xbf46, 0x000e, 0x0130, 0x080c, 0x2851,
-	0x9006, 0x080c, 0x285d, 0x0010, 0x080c, 0x2833, 0x000e, 0x6052,
-	0x6050, 0x0006, 0xc0e5, 0x6052, 0x00f6, 0x2079, 0x0100, 0x080c,
-	0x27aa, 0x00fe, 0x000e, 0x6052, 0x0005, 0x0156, 0x0016, 0x0026,
-	0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2069, 0x0140,
-	0x2071, 0x1800, 0x080c, 0x990b, 0x0158, 0x2001, 0x0386, 0x2004,
-	0xd0b4, 0x1130, 0x2001, 0x0016, 0x080c, 0x989e, 0x0804, 0x71df,
-	0x2001, 0x180c, 0x200c, 0xc1c4, 0x2102, 0x6028, 0x9084, 0xe1ff,
-	0x602a, 0x2011, 0x0200, 0x080c, 0x286d, 0x2001, 0x0090, 0x080c,
-	0x2833, 0x20a9, 0x0366, 0x6024, 0xd0cc, 0x1558, 0x1d04, 0x717b,
-	0x2091, 0x6000, 0x1f04, 0x717b, 0x080c, 0x98ad, 0x2011, 0x0003,
-	0x080c, 0x931e, 0x2011, 0x0002, 0x080c, 0x9328, 0x080c, 0x91eb,
-	0x901e, 0x080c, 0x926b, 0x2001, 0x0386, 0x2003, 0x7000, 0x080c,
-	0x98c9, 0x2001, 0x00a0, 0x080c, 0x2833, 0x080c, 0x73ac, 0x080c,
-	0x5cd5, 0x080c, 0xbf46, 0x0110, 0x080c, 0x0cd1, 0x9085, 0x0001,
-	0x04e0, 0x2001, 0x0386, 0x2004, 0xd0ac, 0x0110, 0x080c, 0x1989,
-	0x60e3, 0x0000, 0x2001, 0x0002, 0x080c, 0x2498, 0x60e2, 0x2001,
-	0x0080, 0x080c, 0x2833, 0x20a9, 0x0366, 0x2011, 0x1e00, 0x080c,
-	0x286d, 0x2009, 0x1e00, 0x080c, 0x2819, 0x6024, 0x910c, 0x0140,
-	0x1d04, 0x71bd, 0x2091, 0x6000, 0x1f04, 0x71bd, 0x0804, 0x7184,
-	0x2001, 0x0386, 0x2003, 0x7000, 0x6028, 0x9085, 0x1e00, 0x602a,
-	0x70b0, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x080c,
-	0xbf46, 0x0110, 0x080c, 0x0cd1, 0x9006, 0x00ee, 0x00de, 0x00ce,
-	0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026,
-	0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800,
-	0x7000, 0x9086, 0x0003, 0x1168, 0x2001, 0x020b, 0x2004, 0x9084,
-	0x5540, 0x9086, 0x5540, 0x1128, 0x2069, 0x1a47, 0x2d04, 0x8000,
-	0x206a, 0x2069, 0x0140, 0x6020, 0x9084, 0x00c0, 0x0120, 0x6884,
-	0x9005, 0x1904, 0x7256, 0x2001, 0x0088, 0x080c, 0x2833, 0x9006,
-	0x60e2, 0x6886, 0x080c, 0x2498, 0x2069, 0x0200, 0x6804, 0x9005,
-	0x1118, 0x6808, 0x9005, 0x01d0, 0x6028, 0x9084, 0xfbff, 0x602a,
-	0x2011, 0x0400, 0x080c, 0x286d, 0x2069, 0x1960, 0x7000, 0x206a,
-	0x7097, 0x0026, 0x7003, 0x0001, 0x20a9, 0x0002, 0x1d04, 0x7236,
-	0x2091, 0x6000, 0x1f04, 0x7236, 0x0804, 0x7287, 0x2069, 0x0140,
-	0x20a9, 0x0384, 0x2011, 0x1e00, 0x080c, 0x286d, 0x2009, 0x1e00,
-	0x080c, 0x2819, 0x6024, 0x910c, 0x0528, 0x9084, 0x1a00, 0x1510,
-	0x1d04, 0x7242, 0x2091, 0x6000, 0x1f04, 0x7242, 0x080c, 0x98ad,
-	0x2011, 0x0003, 0x080c, 0x931e, 0x2011, 0x0002, 0x080c, 0x9328,
-	0x080c, 0x91eb, 0x901e, 0x080c, 0x926b, 0x080c, 0x98c9, 0x2001,
-	0x00a0, 0x080c, 0x2833, 0x080c, 0x73ac, 0x080c, 0x5cd5, 0x9085,
-	0x0001, 0x00a8, 0x2001, 0x0080, 0x080c, 0x2833, 0x2069, 0x0140,
-	0x60e3, 0x0000, 0x70b0, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008,
-	0x6886, 0x2001, 0x0002, 0x080c, 0x2498, 0x60e2, 0x9006, 0x00ee,
-	0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x0156,
-	0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100,
-	0x2071, 0x1800, 0x6020, 0x9084, 0x00c0, 0x01e8, 0x080c, 0x98ad,
-	0x2011, 0x0003, 0x080c, 0x931e, 0x2011, 0x0002, 0x080c, 0x9328,
-	0x080c, 0x91eb, 0x901e, 0x080c, 0x926b, 0x080c, 0x98c9, 0x2069,
-	0x0140, 0x2001, 0x00a0, 0x080c, 0x2833, 0x080c, 0x73ac, 0x080c,
-	0x5cd5, 0x0804, 0x7329, 0x2001, 0x180c, 0x200c, 0xd1b4, 0x1160,
-	0xc1b5, 0x2102, 0x080c, 0x6f0a, 0x2069, 0x0140, 0x2001, 0x0080,
-	0x080c, 0x2833, 0x60e3, 0x0000, 0x2069, 0x0200, 0x6804, 0x9005,
-	0x1118, 0x6808, 0x9005, 0x0190, 0x6028, 0x9084, 0xfdff, 0x602a,
-	0x2011, 0x0200, 0x080c, 0x286d, 0x2069, 0x1960, 0x7000, 0x206a,
-	0x7097, 0x0027, 0x7003, 0x0001, 0x0804, 0x7329, 0x2011, 0x1e00,
-	0x080c, 0x286d, 0x2009, 0x1e00, 0x080c, 0x2819, 0x6024, 0x910c,
-	0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04, 0x72e6, 0x0006, 0x0016,
-	0x00c6, 0x00d6, 0x00e6, 0x080c, 0x808b, 0x00ee, 0x00de, 0x00ce,
-	0x001e, 0x000e, 0x00e6, 0x2071, 0x19d4, 0x7018, 0x00ee, 0x9005,
-	0x19e8, 0x01f8, 0x0026, 0x2011, 0x6f22, 0x080c, 0x8131, 0x2011,
-	0x6f15, 0x080c, 0x8237, 0x002e, 0x2069, 0x0140, 0x60e3, 0x0000,
-	0x70b0, 0x9005, 0x1118, 0x6887, 0x0001, 0x0008, 0x6886, 0x2001,
-	0x0002, 0x080c, 0x2498, 0x60e2, 0x2001, 0x180c, 0x200c, 0xc1b4,
-	0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e,
-	0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x0046, 0x00c6, 0x00e6,
-	0x2061, 0x0100, 0x2071, 0x1800, 0x080c, 0xbf3f, 0x1904, 0x7396,
-	0x7130, 0xd184, 0x1170, 0x080c, 0x317f, 0x0138, 0xc18d, 0x7132,
-	0x2011, 0x1854, 0x2214, 0xd2ac, 0x1120, 0x7030, 0xd08c, 0x0904,
-	0x7396, 0x2011, 0x1854, 0x220c, 0x0438, 0x0016, 0x2019, 0x000e,
-	0x080c, 0xd1c9, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x9186,
-	0x007e, 0x01a0, 0x9186, 0x0080, 0x0188, 0x080c, 0x6269, 0x1170,
-	0x2120, 0x9006, 0x0016, 0x2009, 0x000e, 0x080c, 0xd251, 0x2009,
-	0x0001, 0x2011, 0x0100, 0x080c, 0x83c3, 0x001e, 0x8108, 0x1f04,
-	0x735f, 0x00be, 0x015e, 0x001e, 0xd1ac, 0x1148, 0x0016, 0x2009,
-	0x0002, 0x2019, 0x0004, 0x080c, 0x2fc2, 0x001e, 0x0078, 0x0156,
-	0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c, 0x6269, 0x1110, 0x080c,
-	0x5cef, 0x8108, 0x1f04, 0x738c, 0x00be, 0x015e, 0x080c, 0x1989,
-	0x080c, 0x98ad, 0x080c, 0x9b52, 0x080c, 0x98c9, 0x60e3, 0x0000,
-	0x080c, 0x5cd5, 0x080c, 0x6fdd, 0x00ee, 0x00ce, 0x004e, 0x003e,
-	0x002e, 0x001e, 0x015e, 0x0005, 0x2001, 0x194e, 0x2003, 0x0001,
-	0x0005, 0x2001, 0x194e, 0x2003, 0x0000, 0x0005, 0x2001, 0x194d,
-	0x2003, 0xaaaa, 0x0005, 0x2001, 0x194d, 0x2003, 0x0000, 0x0005,
-	0x2071, 0x18f0, 0x7003, 0x0000, 0x7007, 0x0000, 0x080c, 0x103b,
-	0x090c, 0x0d65, 0xa8ab, 0xdcb0, 0x2900, 0x704e, 0x080c, 0x103b,
-	0x090c, 0x0d65, 0xa8ab, 0xdcb0, 0x2900, 0x7052, 0xa867, 0x0000,
-	0xa86b, 0x0001, 0xa89f, 0x0000, 0x0005, 0x00e6, 0x2071, 0x0040,
-	0x6848, 0x9005, 0x1118, 0x9085, 0x0001, 0x04b0, 0x6840, 0x9005,
-	0x0150, 0x04a1, 0x6a50, 0x9200, 0x7002, 0x6854, 0x9101, 0x7006,
-	0x9006, 0x7012, 0x7016, 0x6850, 0x7002, 0x6854, 0x7006, 0x6858,
-	0x700a, 0x685c, 0x700e, 0x6840, 0x9005, 0x1110, 0x7012, 0x7016,
-	0x6848, 0x701a, 0x701c, 0x9085, 0x0040, 0x701e, 0x2001, 0x0019,
-	0x7036, 0x702b, 0x0001, 0x2001, 0x0004, 0x200c, 0x918c, 0xfff7,
-	0x918d, 0x8000, 0x2102, 0x00d6, 0x2069, 0x18f0, 0x6807, 0x0001,
-	0x00de, 0x080c, 0x79b8, 0x9006, 0x00ee, 0x0005, 0x900e, 0x0156,
-	0x20a9, 0x0006, 0x8003, 0x818d, 0x1f04, 0x7422, 0x015e, 0x0005,
-	0x2079, 0x0040, 0x2071, 0x18f0, 0x7004, 0x0002, 0x7438, 0x7439,
-	0x7484, 0x74df, 0x7620, 0x7436, 0x7436, 0x764a, 0x080c, 0x0d65,
-	0x0005, 0x2079, 0x0040, 0x2001, 0x1dc0, 0x2003, 0x0000, 0x782c,
-	0x908c, 0x0780, 0x190c, 0x7a44, 0xd0a4, 0x0570, 0x2001, 0x1dc0,
-	0x2004, 0x9082, 0x0080, 0x1640, 0x1d04, 0x7456, 0x2001, 0x19d7,
-	0x200c, 0x8109, 0x0508, 0x2091, 0x6000, 0x2102, 0x7824, 0x2048,
-	0x9006, 0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a, 0x0040,
-	0x0608, 0x00b8, 0x2001, 0x1800, 0x200c, 0x9186, 0x0003, 0x1160,
-	0x7104, 0x9186, 0x0004, 0x0140, 0x9186, 0x0007, 0x0128, 0x9186,
-	0x0003, 0x1968, 0x080c, 0x74df, 0x782c, 0xd09c, 0x090c, 0x79b8,
-	0x0005, 0x9082, 0x005a, 0x1218, 0x2100, 0x003b, 0x0c18, 0x080c,
-	0x7515, 0x0c90, 0x00e3, 0x08f0, 0x0005, 0x7515, 0x7515, 0x7515,
-	0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7537, 0x7515, 0x7515,
-	0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515,
-	0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515,
-	0x7515, 0x7521, 0x7515, 0x771f, 0x7515, 0x7515, 0x7515, 0x7537,
-	0x7515, 0x7521, 0x7760, 0x77a1, 0x77e8, 0x77fc, 0x7515, 0x7515,
-	0x7537, 0x7521, 0x7515, 0x7515, 0x75f4, 0x78a7, 0x78c2, 0x7515,
-	0x7537, 0x7515, 0x7515, 0x7515, 0x7515, 0x75ea, 0x78c2, 0x7515,
-	0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515,
-	0x754b, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515,
-	0x7515, 0x7515, 0x79e8, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515,
-	0x755f, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x7515, 0x2079,
-	0x0040, 0x7004, 0x9086, 0x0003, 0x1198, 0x782c, 0x080c, 0x79e1,
-	0xd0a4, 0x0170, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806, 0xa864,
-	0x9084, 0x00ff, 0x908a, 0x001a, 0x1210, 0x002b, 0x0c50, 0x00e9,
-	0x080c, 0x79b8, 0x0005, 0x7515, 0x7521, 0x770b, 0x7515, 0x7521,
-	0x7515, 0x7521, 0x7521, 0x7515, 0x7521, 0x770b, 0x7521, 0x7521,
-	0x7521, 0x7521, 0x7521, 0x7515, 0x7521, 0x770b, 0x7515, 0x7515,
-	0x7521, 0x7515, 0x7515, 0x7515, 0x7521, 0x00e6, 0x2071, 0x18f0,
-	0x2009, 0x0400, 0x0071, 0x00ee, 0x0005, 0x2009, 0x1000, 0x0049,
-	0x0005, 0x2009, 0x2000, 0x0029, 0x0005, 0x2009, 0x0800, 0x0009,
-	0x0005, 0x7007, 0x0001, 0xa868, 0x9084, 0x00ff, 0x9105, 0xa86a,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e, 0x0005, 0xa864,
-	0x8007, 0x9084, 0x00ff, 0x0d08, 0x8001, 0x1120, 0x7007, 0x0001,
-	0x0804, 0x76c9, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a,
-	0x704b, 0x76c9, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0968,
-	0x8001, 0x1120, 0x7007, 0x0001, 0x0804, 0x76e4, 0x7007, 0x0003,
-	0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x76e4, 0x0005, 0xa864,
-	0x8007, 0x9084, 0x00ff, 0x9086, 0x0001, 0x1904, 0x751d, 0x7007,
-	0x0001, 0x2009, 0x1833, 0x210c, 0x81ff, 0x1904, 0x75c1, 0xa994,
-	0x9186, 0x006f, 0x0188, 0x9186, 0x0074, 0x15b0, 0x0026, 0x2011,
-	0x0010, 0x080c, 0x6684, 0x002e, 0x0578, 0x0016, 0xa998, 0x080c,
-	0x66ce, 0x001e, 0x1548, 0x0400, 0x080c, 0x70ac, 0x0140, 0xa897,
-	0x4005, 0xa89b, 0x0016, 0x2001, 0x0030, 0x900e, 0x0438, 0x0026,
-	0x2011, 0x8008, 0x080c, 0x6684, 0x002e, 0x01b0, 0x0016, 0x0026,
-	0x0036, 0xa998, 0xaaa0, 0xab9c, 0x918d, 0x8000, 0x080c, 0x66ce,
-	0x003e, 0x002e, 0x001e, 0x1140, 0xa897, 0x4005, 0xa89b, 0x4009,
-	0x2001, 0x0030, 0x900e, 0x0050, 0xa868, 0x9084, 0x00ff, 0xa86a,
-	0xa883, 0x0000, 0x080c, 0x5f00, 0x1108, 0x0005, 0x0126, 0x2091,
-	0x8000, 0xa867, 0x0139, 0xa87a, 0xa982, 0x080c, 0x698f, 0x012e,
-	0x0ca0, 0xa994, 0x9186, 0x0071, 0x0904, 0x756f, 0x9186, 0x0064,
-	0x0904, 0x756f, 0x9186, 0x007c, 0x0904, 0x756f, 0x9186, 0x0028,
-	0x0904, 0x756f, 0x9186, 0x0038, 0x0904, 0x756f, 0x9186, 0x0078,
-	0x0904, 0x756f, 0x9186, 0x005f, 0x0904, 0x756f, 0x9186, 0x0056,
-	0x0904, 0x756f, 0xa897, 0x4005, 0xa89b, 0x0001, 0x2001, 0x0030,
-	0x900e, 0x0860, 0xa87c, 0x9084, 0x00c0, 0x9086, 0x00c0, 0x1120,
-	0x7007, 0x0001, 0x0804, 0x78d9, 0x2900, 0x7016, 0x701a, 0x20a9,
-	0x0004, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0030, 0x2098, 0x7050,
-	0x2040, 0xa060, 0x20e8, 0xa05c, 0x9080, 0x0023, 0x20a0, 0x4003,
-	0xa888, 0x7012, 0x9082, 0x0401, 0x1a04, 0x7525, 0xaab4, 0x928a,
-	0x0002, 0x1a04, 0x7525, 0x82ff, 0x1138, 0xa8b8, 0xa9bc, 0x9105,
-	0x0118, 0x2001, 0x7687, 0x0018, 0x9280, 0x767d, 0x2005, 0x7056,
-	0x7010, 0x9015, 0x0904, 0x7668, 0x080c, 0x103b, 0x1118, 0x7007,
-	0x0004, 0x0005, 0x2900, 0x7022, 0x7054, 0x2060, 0xe000, 0xa866,
-	0x7050, 0x2040, 0xa95c, 0xe004, 0x9100, 0xa076, 0xa860, 0xa072,
-	0xe008, 0x920a, 0x1210, 0x900e, 0x2200, 0x7112, 0xe20c, 0x8003,
-	0x800b, 0x9296, 0x0004, 0x0108, 0x9108, 0xa17a, 0x810b, 0xa17e,
-	0x080c, 0x110c, 0xa06c, 0x908e, 0x0100, 0x0170, 0x9086, 0x0200,
-	0x0118, 0x7007, 0x0007, 0x0005, 0x7020, 0x2048, 0x080c, 0x1054,
-	0x7014, 0x2048, 0x0804, 0x7525, 0x7020, 0x2048, 0x7018, 0xa802,
-	0xa807, 0x0000, 0x2908, 0x2048, 0xa906, 0x711a, 0x0804, 0x7620,
-	0x7014, 0x2048, 0x7007, 0x0001, 0xa8b4, 0x9005, 0x1128, 0xa8b8,
-	0xa9bc, 0x9105, 0x0108, 0x00b9, 0xa864, 0x9084, 0x00ff, 0x9086,
-	0x001e, 0x0904, 0x78d9, 0x0804, 0x76c9, 0x767f, 0x7683, 0x0002,
-	0x001d, 0x0007, 0x0004, 0x000a, 0x001b, 0x0005, 0x0006, 0x000a,
-	0x001d, 0x0005, 0x0004, 0x0076, 0x0066, 0xafb8, 0xaebc, 0xa804,
-	0x2050, 0xb0c0, 0xb0e2, 0xb0bc, 0xb0de, 0xb0b8, 0xb0d2, 0xb0b4,
-	0xb0ce, 0xb6da, 0xb7d6, 0xb0b0, 0xb0ca, 0xb0ac, 0xb0c6, 0xb0a8,
-	0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2, 0xb7be, 0xb0a0, 0xb0b2, 0xb09c,
-	0xb0ae, 0xb098, 0xb0a2, 0xb094, 0xb09e, 0xb6aa, 0xb7a6, 0xb090,
-	0xb09a, 0xb08c, 0xb096, 0xb088, 0xb08a, 0xb084, 0xb086, 0xb692,
-	0xb78e, 0xb080, 0xb082, 0xb07c, 0xb07e, 0xb078, 0xb072, 0xb074,
-	0xb06e, 0xb67a, 0xb776, 0xb004, 0x9055, 0x1958, 0x006e, 0x007e,
-	0x0005, 0x2009, 0x1833, 0x210c, 0x81ff, 0x1178, 0x080c, 0x5d4f,
-	0x1108, 0x0005, 0x080c, 0x6bac, 0x0126, 0x2091, 0x8000, 0x080c,
-	0xbb2a, 0x080c, 0x698f, 0x012e, 0x0ca0, 0x080c, 0xbf3f, 0x1d70,
-	0x2001, 0x0028, 0x900e, 0x0c70, 0x2009, 0x1833, 0x210c, 0x81ff,
-	0x11d8, 0xa888, 0x9005, 0x01e0, 0xa883, 0x0000, 0xa87c, 0xd0f4,
-	0x0120, 0x080c, 0x5e62, 0x1138, 0x0005, 0x9006, 0xa87a, 0x080c,
-	0x5ddd, 0x1108, 0x0005, 0x0126, 0x2091, 0x8000, 0xa87a, 0xa982,
-	0x080c, 0x698f, 0x012e, 0x0cb0, 0x2001, 0x0028, 0x900e, 0x0c98,
-	0x2001, 0x0000, 0x0c80, 0x7018, 0xa802, 0x2908, 0x2048, 0xa906,
-	0x711a, 0x7010, 0x8001, 0x7012, 0x0118, 0x7007, 0x0003, 0x0030,
-	0x7014, 0x2048, 0x7007, 0x0001, 0x7048, 0x080f, 0x0005, 0x00b6,
-	0x7007, 0x0001, 0xa974, 0xa878, 0x9084, 0x00ff, 0x9096, 0x0004,
-	0x0540, 0x20a9, 0x0001, 0x9096, 0x0001, 0x0190, 0x900e, 0x20a9,
-	0x0800, 0x9096, 0x0002, 0x0160, 0x9005, 0x11d8, 0xa974, 0x080c,
-	0x6269, 0x11b8, 0x0066, 0xae80, 0x080c, 0x6379, 0x006e, 0x0088,
-	0x0046, 0x2011, 0x180c, 0x2224, 0xc484, 0x2412, 0x004e, 0x00c6,
-	0x080c, 0x6269, 0x1110, 0x080c, 0x6548, 0x8108, 0x1f04, 0x7748,
-	0x00ce, 0xa87c, 0xd084, 0x1120, 0x080c, 0x1054, 0x00be, 0x0005,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e, 0x00be, 0x0005,
-	0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x080c, 0x665c, 0x0580,
-	0x2061, 0x1a3f, 0x6100, 0xd184, 0x0178, 0xa888, 0x9084, 0x00ff,
-	0x1550, 0x6000, 0xd084, 0x0520, 0x6004, 0x9005, 0x1538, 0x6003,
-	0x0000, 0x600b, 0x0000, 0x00c8, 0x2011, 0x0001, 0xa890, 0x9005,
-	0x1110, 0x2001, 0x001e, 0x8000, 0x6016, 0xa888, 0x9084, 0x00ff,
-	0x0178, 0x6006, 0xa888, 0x8007, 0x9084, 0x00ff, 0x0148, 0x600a,
-	0xa888, 0x8000, 0x1108, 0xc28d, 0x6202, 0x012e, 0x0804, 0x79a2,
-	0x012e, 0x0804, 0x799c, 0x012e, 0x0804, 0x7996, 0x012e, 0x0804,
-	0x7999, 0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x080c, 0x665c,
-	0x05e0, 0x2061, 0x1a3f, 0x6000, 0xd084, 0x05b8, 0x6204, 0x6308,
-	0xd08c, 0x1530, 0xac78, 0x9484, 0x0003, 0x0170, 0xa988, 0x918c,
-	0x00ff, 0x8001, 0x1120, 0x2100, 0x9210, 0x0620, 0x0028, 0x8001,
-	0x1508, 0x2100, 0x9212, 0x02f0, 0x9484, 0x000c, 0x0188, 0xa988,
-	0x810f, 0x918c, 0x00ff, 0x9082, 0x0004, 0x1120, 0x2100, 0x9318,
-	0x0288, 0x0030, 0x9082, 0x0004, 0x1168, 0x2100, 0x931a, 0x0250,
-	0xa890, 0x9005, 0x0110, 0x8000, 0x6016, 0x6206, 0x630a, 0x012e,
-	0x0804, 0x79a2, 0x012e, 0x0804, 0x799f, 0x012e, 0x0804, 0x799c,
-	0x0126, 0x2091, 0x8000, 0x7007, 0x0001, 0x2061, 0x1a3f, 0x6300,
-	0xd38c, 0x1120, 0x6308, 0x8318, 0x0220, 0x630a, 0x012e, 0x0804,
-	0x79b0, 0x012e, 0x0804, 0x799f, 0x00b6, 0x0126, 0x00c6, 0x2091,
-	0x8000, 0x7007, 0x0001, 0xa87c, 0xd0ac, 0x0148, 0x00c6, 0x2061,
-	0x1a3f, 0x6000, 0x9084, 0xfcff, 0x6002, 0x00ce, 0x0440, 0xa888,
-	0x9005, 0x05d8, 0xa88c, 0x9065, 0x0598, 0x2001, 0x1833, 0x2004,
-	0x9005, 0x0118, 0x080c, 0x9c06, 0x0068, 0x6017, 0xf400, 0x6063,
-	0x0000, 0xa97c, 0xd1a4, 0x0110, 0xa980, 0x6162, 0x2009, 0x0041,
-	0x080c, 0x9c6a, 0xa988, 0x918c, 0xff00, 0x9186, 0x2000, 0x1138,
-	0x0026, 0x900e, 0x2011, 0xfdff, 0x080c, 0x83c3, 0x002e, 0xa87c,
-	0xd0c4, 0x0148, 0x2061, 0x1a3f, 0x6000, 0xd08c, 0x1120, 0x6008,
-	0x8000, 0x0208, 0x600a, 0x00ce, 0x012e, 0x00be, 0x0804, 0x79a2,
-	0x00ce, 0x012e, 0x00be, 0x0804, 0x799c, 0xa984, 0x9186, 0x002e,
-	0x0d30, 0x9186, 0x002d, 0x0d18, 0x9186, 0x0045, 0x0510, 0x9186,
-	0x002a, 0x1130, 0x2001, 0x180c, 0x200c, 0xc194, 0x2102, 0x08b8,
-	0x9186, 0x0020, 0x0158, 0x9186, 0x0029, 0x1d10, 0xa974, 0x080c,
-	0x6269, 0x1968, 0xb800, 0xc0e4, 0xb802, 0x0848, 0xa88c, 0x9065,
-	0x09b8, 0x6007, 0x0024, 0x2001, 0x1957, 0x2004, 0x601a, 0x0804,
-	0x7837, 0xa88c, 0x9065, 0x0960, 0x00e6, 0xa890, 0x9075, 0x2001,
-	0x1833, 0x2004, 0x9005, 0x0150, 0x080c, 0x9c06, 0x8eff, 0x0118,
-	0x2e60, 0x080c, 0x9c06, 0x00ee, 0x0804, 0x7837, 0x6024, 0xc0dc,
-	0xc0d5, 0x6026, 0x2e60, 0x6007, 0x003a, 0xa8a0, 0x9005, 0x0130,
-	0x6007, 0x003b, 0xa8a4, 0x602e, 0xa8a8, 0x6016, 0x6003, 0x0001,
-	0x2009, 0x8020, 0x080c, 0x84a9, 0x00ee, 0x0804, 0x7837, 0x2061,
-	0x1a3f, 0x6000, 0xd084, 0x0190, 0xd08c, 0x1904, 0x79b0, 0x0126,
-	0x2091, 0x8000, 0x6204, 0x8210, 0x0220, 0x6206, 0x012e, 0x0804,
-	0x79b0, 0x012e, 0xa883, 0x0016, 0x0804, 0x79a9, 0xa883, 0x0007,
-	0x0804, 0x79a9, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0130, 0x8001,
-	0x1138, 0x7007, 0x0001, 0x0069, 0x0005, 0x080c, 0x751d, 0x0040,
-	0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b, 0x78d9,
-	0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091, 0x8000, 0x903e, 0x2061,
-	0x1800, 0x61cc, 0x81ff, 0x1904, 0x795b, 0x6130, 0xd194, 0x1904,
-	0x7985, 0xa878, 0x2070, 0x9e82, 0x1ddc, 0x0a04, 0x794f, 0x6064,
-	0x9e02, 0x1a04, 0x794f, 0x7120, 0x9186, 0x0006, 0x1904, 0x7941,
-	0x7010, 0x905d, 0x0904, 0x795b, 0xb800, 0xd0e4, 0x1904, 0x797f,
-	0x2061, 0x1a3f, 0x6100, 0x9184, 0x0301, 0x9086, 0x0001, 0x15a0,
-	0x7024, 0xd0dc, 0x1904, 0x7988, 0xa883, 0x0000, 0xa803, 0x0000,
-	0x2908, 0x7014, 0x9005, 0x1198, 0x7116, 0xa87c, 0xd0f4, 0x1904,
-	0x798b, 0x080c, 0x5386, 0xd09c, 0x1118, 0xa87c, 0xc0cc, 0xa87e,
-	0x2e60, 0x080c, 0x82b6, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2048,
-	0xa800, 0x9005, 0x1de0, 0xa902, 0x2148, 0xa87c, 0xd0f4, 0x1904,
-	0x798b, 0x012e, 0x00ee, 0x00be, 0x0005, 0x012e, 0x00ee, 0xa883,
-	0x0006, 0x00be, 0x0804, 0x79a9, 0xd184, 0x0db8, 0xd1c4, 0x1190,
-	0x00a0, 0xa974, 0x080c, 0x6269, 0x15d0, 0xb800, 0xd0e4, 0x15b8,
-	0x7120, 0x9186, 0x0007, 0x1118, 0xa883, 0x0002, 0x0490, 0xa883,
-	0x0008, 0x0478, 0xa883, 0x000e, 0x0460, 0xa883, 0x0017, 0x0448,
-	0xa883, 0x0035, 0x0430, 0x080c, 0x538a, 0xd0fc, 0x01e8, 0xa878,
-	0x2070, 0x9e82, 0x1ddc, 0x02c0, 0x6064, 0x9e02, 0x12a8, 0x7120,
-	0x9186, 0x0006, 0x1188, 0x7010, 0x905d, 0x0170, 0xb800, 0xd0bc,
-	0x0158, 0x2039, 0x0001, 0x7000, 0x9086, 0x0007, 0x1904, 0x78e5,
-	0x7003, 0x0002, 0x0804, 0x78e5, 0xa883, 0x0028, 0x0010, 0xa883,
-	0x0029, 0x012e, 0x00ee, 0x00be, 0x0420, 0xa883, 0x002a, 0x0cc8,
-	0xa883, 0x0045, 0x0cb0, 0x2e60, 0x2019, 0x0002, 0x601b, 0x0014,
-	0x080c, 0xcdd9, 0x012e, 0x00ee, 0x00be, 0x0005, 0x2009, 0x003e,
-	0x0058, 0x2009, 0x0004, 0x0040, 0x2009, 0x0006, 0x0028, 0x2009,
-	0x0016, 0x0010, 0x2009, 0x0001, 0xa884, 0x9084, 0xff00, 0x9105,
-	0xa886, 0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e, 0x0005,
-	0x080c, 0x1054, 0x0005, 0x00d6, 0x080c, 0x82ad, 0x00de, 0x0005,
-	0x00d6, 0x00e6, 0x0126, 0x2091, 0x8000, 0x2071, 0x0040, 0x702c,
-	0xd084, 0x01d8, 0x908c, 0x0780, 0x190c, 0x7a44, 0xd09c, 0x11a8,
-	0x2071, 0x1800, 0x70bc, 0x90ea, 0x0040, 0x0278, 0x8001, 0x70be,
-	0x702c, 0x2048, 0xa800, 0x702e, 0x9006, 0xa802, 0xa806, 0x2071,
-	0x0040, 0x2900, 0x7022, 0x702c, 0x0c28, 0x012e, 0x00ee, 0x00de,
-	0x0005, 0x0006, 0x9084, 0x0780, 0x190c, 0x7a44, 0x000e, 0x0005,
-	0x00d6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x00b6, 0x7007, 0x0001,
-	0xaa74, 0x9282, 0x0004, 0x1a04, 0x7a35, 0xa97c, 0x9188, 0x1000,
-	0x2104, 0x905d, 0xb804, 0xd284, 0x0140, 0x05e8, 0x8007, 0x9084,
-	0x00ff, 0x9084, 0x0006, 0x1108, 0x04b0, 0x2b10, 0x080c, 0x9b76,
-	0x1118, 0x080c, 0x9c3d, 0x05a8, 0x6212, 0xa874, 0x0002, 0x7a13,
-	0x7a18, 0x7a1b, 0x7a21, 0x2019, 0x0002, 0x080c, 0xd1c9, 0x0060,
-	0x080c, 0xd159, 0x0048, 0x2019, 0x0002, 0xa980, 0x080c, 0xd178,
-	0x0018, 0xa980, 0x080c, 0xd159, 0x080c, 0x9bcc, 0xa887, 0x0000,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e, 0x00be, 0x001e,
-	0x002e, 0x003e, 0x00ce, 0x00de, 0x0005, 0xa887, 0x0006, 0x0c80,
-	0xa887, 0x0002, 0x0c68, 0xa887, 0x0005, 0x0c50, 0xa887, 0x0004,
-	0x0c38, 0xa887, 0x0007, 0x0c20, 0x2091, 0x8000, 0x0e04, 0x7a46,
-	0x0006, 0x0016, 0x2001, 0x8003, 0x0006, 0x0804, 0x0d6e, 0x2001,
-	0x1833, 0x2004, 0x9005, 0x0005, 0x0005, 0x00f6, 0x2079, 0x0300,
-	0x2001, 0x0200, 0x200c, 0xc1e5, 0xc1dc, 0x2102, 0x2009, 0x0218,
-	0x210c, 0xd1ec, 0x1120, 0x080c, 0x152d, 0x00fe, 0x0005, 0x2001,
-	0x020d, 0x2003, 0x0020, 0x781f, 0x0300, 0x00fe, 0x0005, 0x781c,
-	0xd08c, 0x0904, 0x7ac7, 0x68bc, 0x90aa, 0x0005, 0x0a04, 0x8043,
-	0x7d44, 0x7c40, 0xd59c, 0x190c, 0x0d65, 0x9584, 0x00f6, 0x1508,
-	0x9484, 0x7000, 0x0138, 0x908a, 0x2000, 0x1258, 0x9584, 0x0700,
-	0x8007, 0x04f0, 0x7000, 0x9084, 0xff00, 0x9086, 0x8100, 0x0db0,
-	0x00b0, 0x9484, 0x0fff, 0x1130, 0x7000, 0x9084, 0xff00, 0x9086,
-	0x8100, 0x11c0, 0x080c, 0xd5b1, 0x080c, 0x7f8a, 0x7817, 0x0140,
-	0x00a8, 0x9584, 0x0076, 0x1118, 0x080c, 0x7fe6, 0x19c8, 0xd5a4,
-	0x0148, 0x0046, 0x0056, 0x080c, 0x7b17, 0x080c, 0x1fb7, 0x005e,
-	0x004e, 0x0020, 0x080c, 0xd5b1, 0x7817, 0x0140, 0x080c, 0x70ac,
-	0x0168, 0x2001, 0x0111, 0x2004, 0xd08c, 0x0140, 0x688f, 0x0000,
-	0x2001, 0x0110, 0x2003, 0x0008, 0x2003, 0x0000, 0x0489, 0x0005,
-	0x0002, 0x7ad4, 0x7dac, 0x7ad1, 0x7ad1, 0x7ad1, 0x7ad1, 0x7ad1,
-	0x7ad1, 0x7817, 0x0140, 0x0005, 0x7000, 0x908c, 0xff00, 0x9194,
-	0xf000, 0x810f, 0x9484, 0x0fff, 0x688e, 0x9286, 0x2000, 0x1150,
-	0x6800, 0x9086, 0x0001, 0x1118, 0x080c, 0x53e7, 0x0070, 0x080c,
-	0x7b37, 0x0058, 0x9286, 0x3000, 0x1118, 0x080c, 0x7ce9, 0x0028,
-	0x9286, 0x8000, 0x1110, 0x080c, 0x7ec0, 0x7817, 0x0140, 0x0005,
-	0x2001, 0x1810, 0x2004, 0xd08c, 0x0178, 0x2001, 0x1800, 0x2004,
-	0x9086, 0x0003, 0x1148, 0x0026, 0x0036, 0x2011, 0x8048, 0x2518,
-	0x080c, 0x48d1, 0x003e, 0x002e, 0x0005, 0x0036, 0x0046, 0x0056,
-	0x00f6, 0x2079, 0x0200, 0x2019, 0xfffe, 0x7c30, 0x0050, 0x0036,
-	0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x7d44, 0x7c40, 0x2019,
-	0xffff, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0160, 0x2001, 0x1800,
-	0x2004, 0x9086, 0x0003, 0x1130, 0x0026, 0x2011, 0x8048, 0x080c,
-	0x48d1, 0x002e, 0x00fe, 0x005e, 0x004e, 0x003e, 0x0005, 0x00b6,
-	0x00c6, 0x7010, 0x9084, 0xff00, 0x8007, 0x9096, 0x0001, 0x0120,
-	0x9096, 0x0023, 0x1904, 0x7cba, 0x9186, 0x0023, 0x15c0, 0x080c,
-	0x7f55, 0x0904, 0x7cba, 0x6120, 0x9186, 0x0001, 0x0150, 0x9186,
-	0x0004, 0x0138, 0x9186, 0x0008, 0x0120, 0x9186, 0x000a, 0x1904,
-	0x7cba, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200, 0x1130, 0x2009,
-	0x0015, 0x080c, 0x9c6a, 0x0804, 0x7cba, 0x908e, 0x0214, 0x0118,
-	0x908e, 0x0210, 0x1130, 0x2009, 0x0015, 0x080c, 0x9c6a, 0x0804,
-	0x7cba, 0x908e, 0x0100, 0x1904, 0x7cba, 0x7034, 0x9005, 0x1904,
-	0x7cba, 0x2009, 0x0016, 0x080c, 0x9c6a, 0x0804, 0x7cba, 0x9186,
-	0x0022, 0x1904, 0x7cba, 0x7030, 0x908e, 0x0300, 0x1580, 0x68d8,
-	0xd0a4, 0x0528, 0xc0b5, 0x68da, 0x7100, 0x918c, 0x00ff, 0x697a,
-	0x7004, 0x687e, 0x00f6, 0x2079, 0x0100, 0x79e6, 0x78ea, 0x0006,
-	0x9084, 0x00ff, 0x0016, 0x2008, 0x080c, 0x246d, 0x7932, 0x7936,
-	0x001e, 0x000e, 0x00fe, 0x080c, 0x2424, 0x695a, 0x703c, 0x00e6,
-	0x2071, 0x0140, 0x7086, 0x2071, 0x1800, 0x70b2, 0x00ee, 0x7034,
-	0x9005, 0x1904, 0x7cba, 0x2009, 0x0017, 0x0804, 0x7c87, 0x908e,
-	0x0400, 0x1190, 0x7034, 0x9005, 0x1904, 0x7cba, 0x080c, 0x70ac,
-	0x0120, 0x2009, 0x001d, 0x0804, 0x7c87, 0x68d8, 0xc0a5, 0x68da,
-	0x2009, 0x0030, 0x0804, 0x7c87, 0x908e, 0x0500, 0x1140, 0x7034,
-	0x9005, 0x1904, 0x7cba, 0x2009, 0x0018, 0x0804, 0x7c87, 0x908e,
-	0x2010, 0x1120, 0x2009, 0x0019, 0x0804, 0x7c87, 0x908e, 0x2110,
-	0x1120, 0x2009, 0x001a, 0x0804, 0x7c87, 0x908e, 0x5200, 0x1140,
-	0x7034, 0x9005, 0x1904, 0x7cba, 0x2009, 0x001b, 0x0804, 0x7c87,
-	0x908e, 0x5000, 0x1140, 0x7034, 0x9005, 0x1904, 0x7cba, 0x2009,
-	0x001c, 0x0804, 0x7c87, 0x908e, 0x1300, 0x1120, 0x2009, 0x0034,
-	0x0804, 0x7c87, 0x908e, 0x1200, 0x1140, 0x7034, 0x9005, 0x1904,
-	0x7cba, 0x2009, 0x0024, 0x0804, 0x7c87, 0x908c, 0xff00, 0x918e,
-	0x2400, 0x1170, 0x2009, 0x002d, 0x2001, 0x1810, 0x2004, 0xd09c,
-	0x0904, 0x7c87, 0x080c, 0xc613, 0x1904, 0x7cba, 0x0804, 0x7c85,
-	0x908c, 0xff00, 0x918e, 0x5300, 0x1120, 0x2009, 0x002a, 0x0804,
-	0x7c87, 0x908e, 0x0f00, 0x1120, 0x2009, 0x0020, 0x0804, 0x7c87,
-	0x908e, 0x6104, 0x1528, 0x2029, 0x0205, 0x2011, 0x026d, 0x8208,
-	0x2204, 0x9082, 0x0004, 0x8004, 0x8004, 0x20a8, 0x2011, 0x8015,
-	0x211c, 0x8108, 0x0046, 0x2124, 0x080c, 0x48d1, 0x004e, 0x8108,
-	0x0f04, 0x7c53, 0x9186, 0x0280, 0x1d88, 0x2504, 0x8000, 0x202a,
-	0x2009, 0x0260, 0x0c58, 0x202b, 0x0000, 0x2009, 0x0023, 0x0478,
-	0x908e, 0x6000, 0x1118, 0x2009, 0x003f, 0x0448, 0x908e, 0x7800,
-	0x1118, 0x2009, 0x0045, 0x0418, 0x908e, 0x1000, 0x1118, 0x2009,
-	0x004e, 0x00e8, 0x908e, 0x6300, 0x1118, 0x2009, 0x004a, 0x00b8,
-	0x908c, 0xff00, 0x918e, 0x5600, 0x1118, 0x2009, 0x004f, 0x0078,
-	0x908c, 0xff00, 0x918e, 0x5700, 0x1118, 0x2009, 0x0050, 0x0038,
-	0x2009, 0x001d, 0x6838, 0xd0d4, 0x0110, 0x2009, 0x004c, 0x0016,
-	0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2424, 0x1568,
-	0x080c, 0x6209, 0x1550, 0xbe12, 0xbd16, 0x001e, 0x0016, 0xb884,
+	0x1800, 0x2001, 0x194e, 0x200c, 0x9186, 0x0000, 0x0158, 0x9186,
+	0x0001, 0x0158, 0x9186, 0x0002, 0x0158, 0x9186, 0x0003, 0x0158,
+	0x0804, 0x707b, 0x7097, 0x0022, 0x0040, 0x7097, 0x0021, 0x0028,
+	0x7097, 0x0023, 0x0010, 0x7097, 0x0024, 0x60e3, 0x0000, 0x6887,
+	0x0001, 0x2001, 0x0001, 0x080c, 0x2498, 0x080c, 0x98c8, 0x0026,
+	0x080c, 0x9b6d, 0x002e, 0x080c, 0x98e4, 0x7000, 0x908e, 0x0004,
+	0x0118, 0x602b, 0x0028, 0x0010, 0x602b, 0x0020, 0x0156, 0x0126,
+	0x2091, 0x8000, 0x20a9, 0x0005, 0x6024, 0xd0ac, 0x0150, 0x012e,
+	0x015e, 0x080c, 0xbf61, 0x0118, 0x9006, 0x080c, 0x285d, 0x0804,
+	0x7087, 0x6800, 0x9084, 0x00a1, 0xc0bd, 0x6802, 0x080c, 0x2819,
+	0x6904, 0xd1d4, 0x1140, 0x2001, 0x0100, 0x080c, 0x2833, 0x1f04,
+	0x702c, 0x080c, 0x710e, 0x012e, 0x015e, 0x080c, 0x70c8, 0x0170,
+	0x6044, 0x9005, 0x0130, 0x080c, 0x710e, 0x9006, 0x8001, 0x1df0,
+	0x0028, 0x6804, 0xd0d4, 0x1110, 0x080c, 0x710e, 0x080c, 0xbf61,
+	0x0118, 0x9006, 0x080c, 0x285d, 0x0016, 0x0026, 0x7000, 0x908e,
+	0x0004, 0x0130, 0x2009, 0x00c8, 0x2011, 0x6f2d, 0x080c, 0x821d,
+	0x002e, 0x001e, 0x080c, 0x806b, 0x7034, 0xc085, 0x7036, 0x2001,
+	0x194e, 0x2003, 0x0004, 0x080c, 0x6d82, 0x080c, 0x70c8, 0x0138,
+	0x6804, 0xd0d4, 0x1120, 0xd0dc, 0x1100, 0x080c, 0x73bc, 0x00ee,
+	0x00de, 0x00ce, 0x0005, 0x00c6, 0x00d6, 0x00e6, 0x2061, 0x0100,
+	0x2069, 0x0140, 0x2071, 0x1800, 0x080c, 0x8082, 0x080c, 0x8074,
+	0x080c, 0x73c6, 0x2001, 0x193e, 0x2003, 0x0000, 0x9006, 0x7096,
+	0x60e2, 0x6886, 0x080c, 0x2498, 0x9006, 0x080c, 0x2833, 0x6043,
+	0x0090, 0x6043, 0x0010, 0x0026, 0x2011, 0xffff, 0x080c, 0x286d,
+	0x002e, 0x602b, 0x182c, 0x00ee, 0x00de, 0x00ce, 0x0005, 0x0006,
+	0x2001, 0x194d, 0x2004, 0x9086, 0xaaaa, 0x000e, 0x0005, 0x0006,
+	0x080c, 0x5391, 0x9084, 0x0030, 0x9086, 0x0000, 0x000e, 0x0005,
+	0x0006, 0x080c, 0x5391, 0x9084, 0x0030, 0x9086, 0x0030, 0x000e,
+	0x0005, 0x0006, 0x080c, 0x5391, 0x9084, 0x0030, 0x9086, 0x0010,
+	0x000e, 0x0005, 0x0006, 0x080c, 0x5391, 0x9084, 0x0030, 0x9086,
+	0x0020, 0x000e, 0x0005, 0x0036, 0x0016, 0x2001, 0x180c, 0x2004,
+	0x908c, 0x0013, 0x0180, 0x0020, 0x080c, 0x24b8, 0x900e, 0x0028,
+	0x080c, 0x665f, 0x1dc8, 0x2009, 0x0002, 0x2019, 0x0028, 0x080c,
+	0x2fc5, 0x9006, 0x0019, 0x001e, 0x003e, 0x0005, 0x00e6, 0x2071,
+	0x180c, 0x2e04, 0x0130, 0x080c, 0xbf5a, 0x1128, 0x9085, 0x0010,
+	0x0010, 0x9084, 0xffef, 0x2072, 0x00ee, 0x0005, 0x6050, 0x0006,
+	0x60ec, 0x0006, 0x600c, 0x0006, 0x6004, 0x0006, 0x6028, 0x0006,
+	0x602f, 0x0100, 0x602f, 0x0000, 0x602f, 0x0040, 0x602f, 0x0000,
+	0x20a9, 0x0002, 0x080c, 0x27fa, 0x0026, 0x2011, 0x0040, 0x080c,
+	0x286d, 0x002e, 0x000e, 0x602a, 0x000e, 0x6006, 0x000e, 0x600e,
+	0x000e, 0x60ee, 0x60e3, 0x0000, 0x6887, 0x0001, 0x2001, 0x0001,
+	0x080c, 0x2498, 0x2001, 0x00a0, 0x0006, 0x080c, 0xbf61, 0x000e,
+	0x0130, 0x080c, 0x2851, 0x9006, 0x080c, 0x285d, 0x0010, 0x080c,
+	0x2833, 0x000e, 0x6052, 0x6050, 0x0006, 0xc0e5, 0x6052, 0x00f6,
+	0x2079, 0x0100, 0x080c, 0x27aa, 0x00fe, 0x000e, 0x6052, 0x0005,
+	0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061,
+	0x0100, 0x2069, 0x0140, 0x2071, 0x1800, 0x080c, 0x9926, 0x0158,
+	0x2001, 0x0386, 0x2004, 0xd0b4, 0x1130, 0x2001, 0x0016, 0x080c,
+	0x98b9, 0x0804, 0x71ea, 0x2001, 0x180c, 0x200c, 0xc1c4, 0x2102,
+	0x6028, 0x9084, 0xe1ff, 0x602a, 0x2011, 0x0200, 0x080c, 0x286d,
+	0x2001, 0x0090, 0x080c, 0x2833, 0x20a9, 0x0366, 0x6024, 0xd0cc,
+	0x1558, 0x1d04, 0x7186, 0x2091, 0x6000, 0x1f04, 0x7186, 0x080c,
+	0x98c8, 0x2011, 0x0003, 0x080c, 0x9339, 0x2011, 0x0002, 0x080c,
+	0x9343, 0x080c, 0x9206, 0x901e, 0x080c, 0x9286, 0x2001, 0x0386,
+	0x2003, 0x7000, 0x080c, 0x98e4, 0x2001, 0x00a0, 0x080c, 0x2833,
+	0x080c, 0x73b7, 0x080c, 0x5cdc, 0x080c, 0xbf61, 0x0110, 0x080c,
+	0x0cd1, 0x9085, 0x0001, 0x04e0, 0x2001, 0x0386, 0x2004, 0xd0ac,
+	0x0110, 0x080c, 0x1989, 0x60e3, 0x0000, 0x2001, 0x0002, 0x080c,
+	0x2498, 0x60e2, 0x2001, 0x0080, 0x080c, 0x2833, 0x20a9, 0x0366,
+	0x2011, 0x1e00, 0x080c, 0x286d, 0x2009, 0x1e00, 0x080c, 0x2819,
+	0x6024, 0x910c, 0x0140, 0x1d04, 0x71c8, 0x2091, 0x6000, 0x1f04,
+	0x71c8, 0x0804, 0x718f, 0x2001, 0x0386, 0x2003, 0x7000, 0x6028,
+	0x9085, 0x1e00, 0x602a, 0x70b0, 0x9005, 0x1118, 0x6887, 0x0001,
+	0x0008, 0x6886, 0x080c, 0xbf61, 0x0110, 0x080c, 0x0cd1, 0x9006,
+	0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005,
+	0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6, 0x00e6, 0x2061,
+	0x0100, 0x2071, 0x1800, 0x7000, 0x9086, 0x0003, 0x1168, 0x2001,
+	0x020b, 0x2004, 0x9084, 0x5540, 0x9086, 0x5540, 0x1128, 0x2069,
+	0x1a47, 0x2d04, 0x8000, 0x206a, 0x2069, 0x0140, 0x6020, 0x9084,
+	0x00c0, 0x0120, 0x6884, 0x9005, 0x1904, 0x7261, 0x2001, 0x0088,
+	0x080c, 0x2833, 0x9006, 0x60e2, 0x6886, 0x080c, 0x2498, 0x2069,
+	0x0200, 0x6804, 0x9005, 0x1118, 0x6808, 0x9005, 0x01d0, 0x6028,
+	0x9084, 0xfbff, 0x602a, 0x2011, 0x0400, 0x080c, 0x286d, 0x2069,
+	0x1960, 0x7000, 0x206a, 0x7097, 0x0026, 0x7003, 0x0001, 0x20a9,
+	0x0002, 0x1d04, 0x7241, 0x2091, 0x6000, 0x1f04, 0x7241, 0x0804,
+	0x7292, 0x2069, 0x0140, 0x20a9, 0x0384, 0x2011, 0x1e00, 0x080c,
+	0x286d, 0x2009, 0x1e00, 0x080c, 0x2819, 0x6024, 0x910c, 0x0528,
+	0x9084, 0x1a00, 0x1510, 0x1d04, 0x724d, 0x2091, 0x6000, 0x1f04,
+	0x724d, 0x080c, 0x98c8, 0x2011, 0x0003, 0x080c, 0x9339, 0x2011,
+	0x0002, 0x080c, 0x9343, 0x080c, 0x9206, 0x901e, 0x080c, 0x9286,
+	0x080c, 0x98e4, 0x2001, 0x00a0, 0x080c, 0x2833, 0x080c, 0x73b7,
+	0x080c, 0x5cdc, 0x9085, 0x0001, 0x00a8, 0x2001, 0x0080, 0x080c,
+	0x2833, 0x2069, 0x0140, 0x60e3, 0x0000, 0x70b0, 0x9005, 0x1118,
+	0x6887, 0x0001, 0x0008, 0x6886, 0x2001, 0x0002, 0x080c, 0x2498,
+	0x60e2, 0x9006, 0x00ee, 0x00de, 0x00ce, 0x003e, 0x002e, 0x001e,
+	0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036, 0x00c6, 0x00d6,
+	0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x6020, 0x9084, 0x00c0,
+	0x01e8, 0x080c, 0x98c8, 0x2011, 0x0003, 0x080c, 0x9339, 0x2011,
+	0x0002, 0x080c, 0x9343, 0x080c, 0x9206, 0x901e, 0x080c, 0x9286,
+	0x080c, 0x98e4, 0x2069, 0x0140, 0x2001, 0x00a0, 0x080c, 0x2833,
+	0x080c, 0x73b7, 0x080c, 0x5cdc, 0x0804, 0x7334, 0x2001, 0x180c,
+	0x200c, 0xd1b4, 0x1160, 0xc1b5, 0x2102, 0x080c, 0x6f15, 0x2069,
+	0x0140, 0x2001, 0x0080, 0x080c, 0x2833, 0x60e3, 0x0000, 0x2069,
+	0x0200, 0x6804, 0x9005, 0x1118, 0x6808, 0x9005, 0x0190, 0x6028,
+	0x9084, 0xfdff, 0x602a, 0x2011, 0x0200, 0x080c, 0x286d, 0x2069,
+	0x1960, 0x7000, 0x206a, 0x7097, 0x0027, 0x7003, 0x0001, 0x0804,
+	0x7334, 0x2011, 0x1e00, 0x080c, 0x286d, 0x2009, 0x1e00, 0x080c,
+	0x2819, 0x6024, 0x910c, 0x01c8, 0x9084, 0x1c00, 0x11b0, 0x1d04,
+	0x72f1, 0x0006, 0x0016, 0x00c6, 0x00d6, 0x00e6, 0x080c, 0x80b3,
+	0x00ee, 0x00de, 0x00ce, 0x001e, 0x000e, 0x00e6, 0x2071, 0x19d4,
+	0x7018, 0x00ee, 0x9005, 0x19e8, 0x01f8, 0x0026, 0x2011, 0x6f2d,
+	0x080c, 0x8159, 0x2011, 0x6f20, 0x080c, 0x825f, 0x002e, 0x2069,
+	0x0140, 0x60e3, 0x0000, 0x70b0, 0x9005, 0x1118, 0x6887, 0x0001,
+	0x0008, 0x6886, 0x2001, 0x0002, 0x080c, 0x2498, 0x60e2, 0x2001,
+	0x180c, 0x200c, 0xc1b4, 0x2102, 0x00ee, 0x00de, 0x00ce, 0x003e,
+	0x002e, 0x001e, 0x015e, 0x0005, 0x0156, 0x0016, 0x0026, 0x0036,
+	0x0046, 0x00c6, 0x00e6, 0x2061, 0x0100, 0x2071, 0x1800, 0x080c,
+	0xbf5a, 0x1904, 0x73a1, 0x7130, 0xd184, 0x1170, 0x080c, 0x3186,
+	0x0138, 0xc18d, 0x7132, 0x2011, 0x1854, 0x2214, 0xd2ac, 0x1120,
+	0x7030, 0xd08c, 0x0904, 0x73a1, 0x2011, 0x1854, 0x220c, 0x0438,
+	0x0016, 0x2019, 0x000e, 0x080c, 0xd1eb, 0x0156, 0x00b6, 0x20a9,
+	0x007f, 0x900e, 0x9186, 0x007e, 0x01a0, 0x9186, 0x0080, 0x0188,
+	0x080c, 0x6270, 0x1170, 0x2120, 0x9006, 0x0016, 0x2009, 0x000e,
+	0x080c, 0xd273, 0x2009, 0x0001, 0x2011, 0x0100, 0x080c, 0x83eb,
+	0x001e, 0x8108, 0x1f04, 0x736a, 0x00be, 0x015e, 0x001e, 0xd1ac,
+	0x1148, 0x0016, 0x2009, 0x0002, 0x2019, 0x0004, 0x080c, 0x2fc5,
+	0x001e, 0x0078, 0x0156, 0x00b6, 0x20a9, 0x007f, 0x900e, 0x080c,
+	0x6270, 0x1110, 0x080c, 0x5cf6, 0x8108, 0x1f04, 0x7397, 0x00be,
+	0x015e, 0x080c, 0x1989, 0x080c, 0x98c8, 0x080c, 0x9b6d, 0x080c,
+	0x98e4, 0x60e3, 0x0000, 0x080c, 0x5cdc, 0x080c, 0x6fe8, 0x00ee,
+	0x00ce, 0x004e, 0x003e, 0x002e, 0x001e, 0x015e, 0x0005, 0x2001,
+	0x194e, 0x2003, 0x0001, 0x0005, 0x2001, 0x194e, 0x2003, 0x0000,
+	0x0005, 0x2001, 0x194d, 0x2003, 0xaaaa, 0x0005, 0x2001, 0x194d,
+	0x2003, 0x0000, 0x0005, 0x2071, 0x18f0, 0x7003, 0x0000, 0x7007,
+	0x0000, 0x080c, 0x103b, 0x090c, 0x0d65, 0xa8ab, 0xdcb0, 0x2900,
+	0x704e, 0x080c, 0x103b, 0x090c, 0x0d65, 0xa8ab, 0xdcb0, 0x2900,
+	0x7052, 0xa867, 0x0000, 0xa86b, 0x0001, 0xa89f, 0x0000, 0x0005,
+	0x00e6, 0x2071, 0x0040, 0x6848, 0x9005, 0x1118, 0x9085, 0x0001,
+	0x04b0, 0x6840, 0x9005, 0x0150, 0x04a1, 0x6a50, 0x9200, 0x7002,
+	0x6854, 0x9101, 0x7006, 0x9006, 0x7012, 0x7016, 0x6850, 0x7002,
+	0x6854, 0x7006, 0x6858, 0x700a, 0x685c, 0x700e, 0x6840, 0x9005,
+	0x1110, 0x7012, 0x7016, 0x6848, 0x701a, 0x701c, 0x9085, 0x0040,
+	0x701e, 0x2001, 0x0019, 0x7036, 0x702b, 0x0001, 0x2001, 0x0004,
+	0x200c, 0x918c, 0xfff7, 0x918d, 0x8000, 0x2102, 0x00d6, 0x2069,
+	0x18f0, 0x6807, 0x0001, 0x00de, 0x080c, 0x79c3, 0x9006, 0x00ee,
+	0x0005, 0x900e, 0x0156, 0x20a9, 0x0006, 0x8003, 0x818d, 0x1f04,
+	0x742d, 0x015e, 0x0005, 0x2079, 0x0040, 0x2071, 0x18f0, 0x7004,
+	0x0002, 0x7443, 0x7444, 0x748f, 0x74ea, 0x762b, 0x7441, 0x7441,
+	0x7655, 0x080c, 0x0d65, 0x0005, 0x2079, 0x0040, 0x2001, 0x1dc0,
+	0x2003, 0x0000, 0x782c, 0x908c, 0x0780, 0x190c, 0x7a4f, 0xd0a4,
+	0x0570, 0x2001, 0x1dc0, 0x2004, 0x9082, 0x0080, 0x1640, 0x1d04,
+	0x7461, 0x2001, 0x19d7, 0x200c, 0x8109, 0x0508, 0x2091, 0x6000,
+	0x2102, 0x7824, 0x2048, 0x9006, 0xa802, 0xa806, 0xa864, 0x9084,
+	0x00ff, 0x908a, 0x0040, 0x0608, 0x00b8, 0x2001, 0x1800, 0x200c,
+	0x9186, 0x0003, 0x1160, 0x7104, 0x9186, 0x0004, 0x0140, 0x9186,
+	0x0007, 0x0128, 0x9186, 0x0003, 0x1968, 0x080c, 0x74ea, 0x782c,
+	0xd09c, 0x090c, 0x79c3, 0x0005, 0x9082, 0x005a, 0x1218, 0x2100,
+	0x003b, 0x0c18, 0x080c, 0x7520, 0x0c90, 0x00e3, 0x08f0, 0x0005,
+	0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520,
+	0x7542, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520,
+	0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520,
+	0x7520, 0x7520, 0x7520, 0x7520, 0x752c, 0x7520, 0x772a, 0x7520,
+	0x7520, 0x7520, 0x7542, 0x7520, 0x752c, 0x776b, 0x77ac, 0x77f3,
+	0x7807, 0x7520, 0x7520, 0x7542, 0x752c, 0x7520, 0x7520, 0x75ff,
+	0x78b2, 0x78cd, 0x7520, 0x7542, 0x7520, 0x7520, 0x7520, 0x7520,
+	0x75f5, 0x78cd, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x7520,
+	0x7520, 0x7520, 0x7520, 0x7556, 0x7520, 0x7520, 0x7520, 0x7520,
+	0x7520, 0x7520, 0x7520, 0x7520, 0x7520, 0x79f3, 0x7520, 0x7520,
+	0x7520, 0x7520, 0x7520, 0x756a, 0x7520, 0x7520, 0x7520, 0x7520,
+	0x7520, 0x7520, 0x2079, 0x0040, 0x7004, 0x9086, 0x0003, 0x1198,
+	0x782c, 0x080c, 0x79ec, 0xd0a4, 0x0170, 0x7824, 0x2048, 0x9006,
+	0xa802, 0xa806, 0xa864, 0x9084, 0x00ff, 0x908a, 0x001a, 0x1210,
+	0x002b, 0x0c50, 0x00e9, 0x080c, 0x79c3, 0x0005, 0x7520, 0x752c,
+	0x7716, 0x7520, 0x752c, 0x7520, 0x752c, 0x752c, 0x7520, 0x752c,
+	0x7716, 0x752c, 0x752c, 0x752c, 0x752c, 0x752c, 0x7520, 0x752c,
+	0x7716, 0x7520, 0x7520, 0x752c, 0x7520, 0x7520, 0x7520, 0x752c,
+	0x00e6, 0x2071, 0x18f0, 0x2009, 0x0400, 0x0071, 0x00ee, 0x0005,
+	0x2009, 0x1000, 0x0049, 0x0005, 0x2009, 0x2000, 0x0029, 0x0005,
+	0x2009, 0x0800, 0x0009, 0x0005, 0x7007, 0x0001, 0xa868, 0x9084,
+	0x00ff, 0x9105, 0xa86a, 0x0126, 0x2091, 0x8000, 0x080c, 0x6996,
+	0x012e, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x0d08, 0x8001,
+	0x1120, 0x7007, 0x0001, 0x0804, 0x76d4, 0x7007, 0x0003, 0x7012,
+	0x2900, 0x7016, 0x701a, 0x704b, 0x76d4, 0x0005, 0xa864, 0x8007,
+	0x9084, 0x00ff, 0x0968, 0x8001, 0x1120, 0x7007, 0x0001, 0x0804,
+	0x76ef, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016, 0x701a, 0x704b,
+	0x76ef, 0x0005, 0xa864, 0x8007, 0x9084, 0x00ff, 0x9086, 0x0001,
+	0x1904, 0x7528, 0x7007, 0x0001, 0x2009, 0x1833, 0x210c, 0x81ff,
+	0x1904, 0x75cc, 0xa994, 0x9186, 0x006f, 0x0188, 0x9186, 0x0074,
+	0x15b0, 0x0026, 0x2011, 0x0010, 0x080c, 0x668b, 0x002e, 0x0578,
+	0x0016, 0xa998, 0x080c, 0x66d5, 0x001e, 0x1548, 0x0400, 0x080c,
+	0x70b7, 0x0140, 0xa897, 0x4005, 0xa89b, 0x0016, 0x2001, 0x0030,
+	0x900e, 0x0438, 0x0026, 0x2011, 0x8008, 0x080c, 0x668b, 0x002e,
+	0x01b0, 0x0016, 0x0026, 0x0036, 0xa998, 0xaaa0, 0xab9c, 0x918d,
+	0x8000, 0x080c, 0x66d5, 0x003e, 0x002e, 0x001e, 0x1140, 0xa897,
+	0x4005, 0xa89b, 0x4009, 0x2001, 0x0030, 0x900e, 0x0050, 0xa868,
+	0x9084, 0x00ff, 0xa86a, 0xa883, 0x0000, 0x080c, 0x5f07, 0x1108,
+	0x0005, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139, 0xa87a, 0xa982,
+	0x080c, 0x6996, 0x012e, 0x0ca0, 0xa994, 0x9186, 0x0071, 0x0904,
+	0x757a, 0x9186, 0x0064, 0x0904, 0x757a, 0x9186, 0x007c, 0x0904,
+	0x757a, 0x9186, 0x0028, 0x0904, 0x757a, 0x9186, 0x0038, 0x0904,
+	0x757a, 0x9186, 0x0078, 0x0904, 0x757a, 0x9186, 0x005f, 0x0904,
+	0x757a, 0x9186, 0x0056, 0x0904, 0x757a, 0xa897, 0x4005, 0xa89b,
+	0x0001, 0x2001, 0x0030, 0x900e, 0x0860, 0xa87c, 0x9084, 0x00c0,
+	0x9086, 0x00c0, 0x1120, 0x7007, 0x0001, 0x0804, 0x78e4, 0x2900,
+	0x7016, 0x701a, 0x20a9, 0x0004, 0xa860, 0x20e0, 0xa85c, 0x9080,
+	0x0030, 0x2098, 0x7050, 0x2040, 0xa060, 0x20e8, 0xa05c, 0x9080,
+	0x0023, 0x20a0, 0x4003, 0xa888, 0x7012, 0x9082, 0x0401, 0x1a04,
+	0x7530, 0xaab4, 0x928a, 0x0002, 0x1a04, 0x7530, 0x82ff, 0x1138,
+	0xa8b8, 0xa9bc, 0x9105, 0x0118, 0x2001, 0x7692, 0x0018, 0x9280,
+	0x7688, 0x2005, 0x7056, 0x7010, 0x9015, 0x0904, 0x7673, 0x080c,
+	0x103b, 0x1118, 0x7007, 0x0004, 0x0005, 0x2900, 0x7022, 0x7054,
+	0x2060, 0xe000, 0xa866, 0x7050, 0x2040, 0xa95c, 0xe004, 0x9100,
+	0xa076, 0xa860, 0xa072, 0xe008, 0x920a, 0x1210, 0x900e, 0x2200,
+	0x7112, 0xe20c, 0x8003, 0x800b, 0x9296, 0x0004, 0x0108, 0x9108,
+	0xa17a, 0x810b, 0xa17e, 0x080c, 0x110c, 0xa06c, 0x908e, 0x0100,
+	0x0170, 0x9086, 0x0200, 0x0118, 0x7007, 0x0007, 0x0005, 0x7020,
+	0x2048, 0x080c, 0x1054, 0x7014, 0x2048, 0x0804, 0x7530, 0x7020,
+	0x2048, 0x7018, 0xa802, 0xa807, 0x0000, 0x2908, 0x2048, 0xa906,
+	0x711a, 0x0804, 0x762b, 0x7014, 0x2048, 0x7007, 0x0001, 0xa8b4,
+	0x9005, 0x1128, 0xa8b8, 0xa9bc, 0x9105, 0x0108, 0x00b9, 0xa864,
+	0x9084, 0x00ff, 0x9086, 0x001e, 0x0904, 0x78e4, 0x0804, 0x76d4,
+	0x768a, 0x768e, 0x0002, 0x001d, 0x0007, 0x0004, 0x000a, 0x001b,
+	0x0005, 0x0006, 0x000a, 0x001d, 0x0005, 0x0004, 0x0076, 0x0066,
+	0xafb8, 0xaebc, 0xa804, 0x2050, 0xb0c0, 0xb0e2, 0xb0bc, 0xb0de,
+	0xb0b8, 0xb0d2, 0xb0b4, 0xb0ce, 0xb6da, 0xb7d6, 0xb0b0, 0xb0ca,
+	0xb0ac, 0xb0c6, 0xb0a8, 0xb0ba, 0xb0a4, 0xb0b6, 0xb6c2, 0xb7be,
+	0xb0a0, 0xb0b2, 0xb09c, 0xb0ae, 0xb098, 0xb0a2, 0xb094, 0xb09e,
+	0xb6aa, 0xb7a6, 0xb090, 0xb09a, 0xb08c, 0xb096, 0xb088, 0xb08a,
+	0xb084, 0xb086, 0xb692, 0xb78e, 0xb080, 0xb082, 0xb07c, 0xb07e,
+	0xb078, 0xb072, 0xb074, 0xb06e, 0xb67a, 0xb776, 0xb004, 0x9055,
+	0x1958, 0x006e, 0x007e, 0x0005, 0x2009, 0x1833, 0x210c, 0x81ff,
+	0x1178, 0x080c, 0x5d56, 0x1108, 0x0005, 0x080c, 0x6bb3, 0x0126,
+	0x2091, 0x8000, 0x080c, 0xbb45, 0x080c, 0x6996, 0x012e, 0x0ca0,
+	0x080c, 0xbf5a, 0x1d70, 0x2001, 0x0028, 0x900e, 0x0c70, 0x2009,
+	0x1833, 0x210c, 0x81ff, 0x11d8, 0xa888, 0x9005, 0x01e0, 0xa883,
+	0x0000, 0xa87c, 0xd0f4, 0x0120, 0x080c, 0x5e69, 0x1138, 0x0005,
+	0x9006, 0xa87a, 0x080c, 0x5de4, 0x1108, 0x0005, 0x0126, 0x2091,
+	0x8000, 0xa87a, 0xa982, 0x080c, 0x6996, 0x012e, 0x0cb0, 0x2001,
+	0x0028, 0x900e, 0x0c98, 0x2001, 0x0000, 0x0c80, 0x7018, 0xa802,
+	0x2908, 0x2048, 0xa906, 0x711a, 0x7010, 0x8001, 0x7012, 0x0118,
+	0x7007, 0x0003, 0x0030, 0x7014, 0x2048, 0x7007, 0x0001, 0x7048,
+	0x080f, 0x0005, 0x00b6, 0x7007, 0x0001, 0xa974, 0xa878, 0x9084,
+	0x00ff, 0x9096, 0x0004, 0x0540, 0x20a9, 0x0001, 0x9096, 0x0001,
+	0x0190, 0x900e, 0x20a9, 0x0800, 0x9096, 0x0002, 0x0160, 0x9005,
+	0x11d8, 0xa974, 0x080c, 0x6270, 0x11b8, 0x0066, 0xae80, 0x080c,
+	0x6380, 0x006e, 0x0088, 0x0046, 0x2011, 0x180c, 0x2224, 0xc484,
+	0x2412, 0x004e, 0x00c6, 0x080c, 0x6270, 0x1110, 0x080c, 0x654f,
+	0x8108, 0x1f04, 0x7753, 0x00ce, 0xa87c, 0xd084, 0x1120, 0x080c,
+	0x1054, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x080c, 0x6996,
+	0x012e, 0x00be, 0x0005, 0x0126, 0x2091, 0x8000, 0x7007, 0x0001,
+	0x080c, 0x6663, 0x0580, 0x2061, 0x1a3f, 0x6100, 0xd184, 0x0178,
+	0xa888, 0x9084, 0x00ff, 0x1550, 0x6000, 0xd084, 0x0520, 0x6004,
+	0x9005, 0x1538, 0x6003, 0x0000, 0x600b, 0x0000, 0x00c8, 0x2011,
+	0x0001, 0xa890, 0x9005, 0x1110, 0x2001, 0x001e, 0x8000, 0x6016,
+	0xa888, 0x9084, 0x00ff, 0x0178, 0x6006, 0xa888, 0x8007, 0x9084,
+	0x00ff, 0x0148, 0x600a, 0xa888, 0x8000, 0x1108, 0xc28d, 0x6202,
+	0x012e, 0x0804, 0x79ad, 0x012e, 0x0804, 0x79a7, 0x012e, 0x0804,
+	0x79a1, 0x012e, 0x0804, 0x79a4, 0x0126, 0x2091, 0x8000, 0x7007,
+	0x0001, 0x080c, 0x6663, 0x05e0, 0x2061, 0x1a3f, 0x6000, 0xd084,
+	0x05b8, 0x6204, 0x6308, 0xd08c, 0x1530, 0xac78, 0x9484, 0x0003,
+	0x0170, 0xa988, 0x918c, 0x00ff, 0x8001, 0x1120, 0x2100, 0x9210,
+	0x0620, 0x0028, 0x8001, 0x1508, 0x2100, 0x9212, 0x02f0, 0x9484,
+	0x000c, 0x0188, 0xa988, 0x810f, 0x918c, 0x00ff, 0x9082, 0x0004,
+	0x1120, 0x2100, 0x9318, 0x0288, 0x0030, 0x9082, 0x0004, 0x1168,
+	0x2100, 0x931a, 0x0250, 0xa890, 0x9005, 0x0110, 0x8000, 0x6016,
+	0x6206, 0x630a, 0x012e, 0x0804, 0x79ad, 0x012e, 0x0804, 0x79aa,
+	0x012e, 0x0804, 0x79a7, 0x0126, 0x2091, 0x8000, 0x7007, 0x0001,
+	0x2061, 0x1a3f, 0x6300, 0xd38c, 0x1120, 0x6308, 0x8318, 0x0220,
+	0x630a, 0x012e, 0x0804, 0x79bb, 0x012e, 0x0804, 0x79aa, 0x00b6,
+	0x0126, 0x00c6, 0x2091, 0x8000, 0x7007, 0x0001, 0xa87c, 0xd0ac,
+	0x0148, 0x00c6, 0x2061, 0x1a3f, 0x6000, 0x9084, 0xfcff, 0x6002,
+	0x00ce, 0x0440, 0xa888, 0x9005, 0x05d8, 0xa88c, 0x9065, 0x0598,
+	0x2001, 0x1833, 0x2004, 0x9005, 0x0118, 0x080c, 0x9c21, 0x0068,
+	0x6017, 0xf400, 0x6063, 0x0000, 0xa97c, 0xd1a4, 0x0110, 0xa980,
+	0x6162, 0x2009, 0x0041, 0x080c, 0x9c85, 0xa988, 0x918c, 0xff00,
+	0x9186, 0x2000, 0x1138, 0x0026, 0x900e, 0x2011, 0xfdff, 0x080c,
+	0x83eb, 0x002e, 0xa87c, 0xd0c4, 0x0148, 0x2061, 0x1a3f, 0x6000,
+	0xd08c, 0x1120, 0x6008, 0x8000, 0x0208, 0x600a, 0x00ce, 0x012e,
+	0x00be, 0x0804, 0x79ad, 0x00ce, 0x012e, 0x00be, 0x0804, 0x79a7,
+	0xa984, 0x9186, 0x002e, 0x0d30, 0x9186, 0x002d, 0x0d18, 0x9186,
+	0x0045, 0x0510, 0x9186, 0x002a, 0x1130, 0x2001, 0x180c, 0x200c,
+	0xc194, 0x2102, 0x08b8, 0x9186, 0x0020, 0x0158, 0x9186, 0x0029,
+	0x1d10, 0xa974, 0x080c, 0x6270, 0x1968, 0xb800, 0xc0e4, 0xb802,
+	0x0848, 0xa88c, 0x9065, 0x09b8, 0x6007, 0x0024, 0x2001, 0x1957,
+	0x2004, 0x601a, 0x0804, 0x7842, 0xa88c, 0x9065, 0x0960, 0x00e6,
+	0xa890, 0x9075, 0x2001, 0x1833, 0x2004, 0x9005, 0x0150, 0x080c,
+	0x9c21, 0x8eff, 0x0118, 0x2e60, 0x080c, 0x9c21, 0x00ee, 0x0804,
+	0x7842, 0x6024, 0xc0dc, 0xc0d5, 0x6026, 0x2e60, 0x6007, 0x003a,
+	0xa8a0, 0x9005, 0x0130, 0x6007, 0x003b, 0xa8a4, 0x602e, 0xa8a8,
+	0x6016, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x84d1, 0x00ee,
+	0x0804, 0x7842, 0x2061, 0x1a3f, 0x6000, 0xd084, 0x0190, 0xd08c,
+	0x1904, 0x79bb, 0x0126, 0x2091, 0x8000, 0x6204, 0x8210, 0x0220,
+	0x6206, 0x012e, 0x0804, 0x79bb, 0x012e, 0xa883, 0x0016, 0x0804,
+	0x79b4, 0xa883, 0x0007, 0x0804, 0x79b4, 0xa864, 0x8007, 0x9084,
+	0x00ff, 0x0130, 0x8001, 0x1138, 0x7007, 0x0001, 0x0069, 0x0005,
+	0x080c, 0x7528, 0x0040, 0x7007, 0x0003, 0x7012, 0x2900, 0x7016,
+	0x701a, 0x704b, 0x78e4, 0x0005, 0x00b6, 0x00e6, 0x0126, 0x2091,
+	0x8000, 0x903e, 0x2061, 0x1800, 0x61cc, 0x81ff, 0x1904, 0x7966,
+	0x6130, 0xd194, 0x1904, 0x7990, 0xa878, 0x2070, 0x9e82, 0x1ddc,
+	0x0a04, 0x795a, 0x6064, 0x9e02, 0x1a04, 0x795a, 0x7120, 0x9186,
+	0x0006, 0x1904, 0x794c, 0x7010, 0x905d, 0x0904, 0x7966, 0xb800,
+	0xd0e4, 0x1904, 0x798a, 0x2061, 0x1a3f, 0x6100, 0x9184, 0x0301,
+	0x9086, 0x0001, 0x15a0, 0x7024, 0xd0dc, 0x1904, 0x7993, 0xa883,
+	0x0000, 0xa803, 0x0000, 0x2908, 0x7014, 0x9005, 0x1198, 0x7116,
+	0xa87c, 0xd0f4, 0x1904, 0x7996, 0x080c, 0x538d, 0xd09c, 0x1118,
+	0xa87c, 0xc0cc, 0xa87e, 0x2e60, 0x080c, 0x82de, 0x012e, 0x00ee,
+	0x00be, 0x0005, 0x2048, 0xa800, 0x9005, 0x1de0, 0xa902, 0x2148,
+	0xa87c, 0xd0f4, 0x1904, 0x7996, 0x012e, 0x00ee, 0x00be, 0x0005,
+	0x012e, 0x00ee, 0xa883, 0x0006, 0x00be, 0x0804, 0x79b4, 0xd184,
+	0x0db8, 0xd1c4, 0x1190, 0x00a0, 0xa974, 0x080c, 0x6270, 0x15d0,
+	0xb800, 0xd0e4, 0x15b8, 0x7120, 0x9186, 0x0007, 0x1118, 0xa883,
+	0x0002, 0x0490, 0xa883, 0x0008, 0x0478, 0xa883, 0x000e, 0x0460,
+	0xa883, 0x0017, 0x0448, 0xa883, 0x0035, 0x0430, 0x080c, 0x5391,
+	0xd0fc, 0x01e8, 0xa878, 0x2070, 0x9e82, 0x1ddc, 0x02c0, 0x6064,
+	0x9e02, 0x12a8, 0x7120, 0x9186, 0x0006, 0x1188, 0x7010, 0x905d,
+	0x0170, 0xb800, 0xd0bc, 0x0158, 0x2039, 0x0001, 0x7000, 0x9086,
+	0x0007, 0x1904, 0x78f0, 0x7003, 0x0002, 0x0804, 0x78f0, 0xa883,
+	0x0028, 0x0010, 0xa883, 0x0029, 0x012e, 0x00ee, 0x00be, 0x0420,
+	0xa883, 0x002a, 0x0cc8, 0xa883, 0x0045, 0x0cb0, 0x2e60, 0x2019,
+	0x0002, 0x601b, 0x0014, 0x080c, 0xcdf9, 0x012e, 0x00ee, 0x00be,
+	0x0005, 0x2009, 0x003e, 0x0058, 0x2009, 0x0004, 0x0040, 0x2009,
+	0x0006, 0x0028, 0x2009, 0x0016, 0x0010, 0x2009, 0x0001, 0xa884,
+	0x9084, 0xff00, 0x9105, 0xa886, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6996, 0x012e, 0x0005, 0x080c, 0x1054, 0x0005, 0x00d6, 0x080c,
+	0x82d5, 0x00de, 0x0005, 0x00d6, 0x00e6, 0x0126, 0x2091, 0x8000,
+	0x2071, 0x0040, 0x702c, 0xd084, 0x01d8, 0x908c, 0x0780, 0x190c,
+	0x7a4f, 0xd09c, 0x11a8, 0x2071, 0x1800, 0x70bc, 0x90ea, 0x0040,
+	0x0278, 0x8001, 0x70be, 0x702c, 0x2048, 0xa800, 0x702e, 0x9006,
+	0xa802, 0xa806, 0x2071, 0x0040, 0x2900, 0x7022, 0x702c, 0x0c28,
+	0x012e, 0x00ee, 0x00de, 0x0005, 0x0006, 0x9084, 0x0780, 0x190c,
+	0x7a4f, 0x000e, 0x0005, 0x00d6, 0x00c6, 0x0036, 0x0026, 0x0016,
+	0x00b6, 0x7007, 0x0001, 0xaa74, 0x9282, 0x0004, 0x1a04, 0x7a40,
+	0xa97c, 0x9188, 0x1000, 0x2104, 0x905d, 0xb804, 0xd284, 0x0140,
+	0x05e8, 0x8007, 0x9084, 0x00ff, 0x9084, 0x0006, 0x1108, 0x04b0,
+	0x2b10, 0x080c, 0x9b91, 0x1118, 0x080c, 0x9c58, 0x05a8, 0x6212,
+	0xa874, 0x0002, 0x7a1e, 0x7a23, 0x7a26, 0x7a2c, 0x2019, 0x0002,
+	0x080c, 0xd1eb, 0x0060, 0x080c, 0xd17b, 0x0048, 0x2019, 0x0002,
+	0xa980, 0x080c, 0xd19a, 0x0018, 0xa980, 0x080c, 0xd17b, 0x080c,
+	0x9be7, 0xa887, 0x0000, 0x0126, 0x2091, 0x8000, 0x080c, 0x6996,
+	0x012e, 0x00be, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00de, 0x0005,
+	0xa887, 0x0006, 0x0c80, 0xa887, 0x0002, 0x0c68, 0xa887, 0x0005,
+	0x0c50, 0xa887, 0x0004, 0x0c38, 0xa887, 0x0007, 0x0c20, 0x2091,
+	0x8000, 0x0e04, 0x7a51, 0x0006, 0x0016, 0x2001, 0x8003, 0x0006,
+	0x0804, 0x0d6e, 0x2001, 0x1833, 0x2004, 0x9005, 0x0005, 0x0005,
+	0x00f6, 0x2079, 0x0300, 0x2001, 0x0200, 0x200c, 0xc1e5, 0xc1dc,
+	0x2102, 0x2009, 0x0218, 0x210c, 0xd1ec, 0x1120, 0x080c, 0x152d,
+	0x00fe, 0x0005, 0x2001, 0x020d, 0x2003, 0x0020, 0x781f, 0x0300,
+	0x00fe, 0x0005, 0x781c, 0xd08c, 0x0904, 0x7ad2, 0x68bc, 0x90aa,
+	0x0005, 0x0a04, 0x806b, 0x7d44, 0x7c40, 0xd59c, 0x190c, 0x0d65,
+	0x9584, 0x00f6, 0x1508, 0x9484, 0x7000, 0x0138, 0x908a, 0x2000,
+	0x1258, 0x9584, 0x0700, 0x8007, 0x04f0, 0x7000, 0x9084, 0xff00,
+	0x9086, 0x8100, 0x0db0, 0x00b0, 0x9484, 0x0fff, 0x1130, 0x7000,
+	0x9084, 0xff00, 0x9086, 0x8100, 0x11c0, 0x080c, 0xd5d3, 0x080c,
+	0x7fb2, 0x7817, 0x0140, 0x00a8, 0x9584, 0x0076, 0x1118, 0x080c,
+	0x800e, 0x19c8, 0xd5a4, 0x0148, 0x0046, 0x0056, 0x080c, 0x7b22,
+	0x080c, 0x1fb7, 0x005e, 0x004e, 0x0020, 0x080c, 0xd5d3, 0x7817,
+	0x0140, 0x080c, 0x70b7, 0x0168, 0x2001, 0x0111, 0x2004, 0xd08c,
+	0x0140, 0x688f, 0x0000, 0x2001, 0x0110, 0x2003, 0x0008, 0x2003,
+	0x0000, 0x0489, 0x0005, 0x0002, 0x7adf, 0x7dd4, 0x7adc, 0x7adc,
+	0x7adc, 0x7adc, 0x7adc, 0x7adc, 0x7817, 0x0140, 0x0005, 0x7000,
+	0x908c, 0xff00, 0x9194, 0xf000, 0x810f, 0x9484, 0x0fff, 0x688e,
+	0x9286, 0x2000, 0x1150, 0x6800, 0x9086, 0x0001, 0x1118, 0x080c,
+	0x53ee, 0x0070, 0x080c, 0x7b42, 0x0058, 0x9286, 0x3000, 0x1118,
+	0x080c, 0x7d11, 0x0028, 0x9286, 0x8000, 0x1110, 0x080c, 0x7ee8,
+	0x7817, 0x0140, 0x0005, 0x2001, 0x1810, 0x2004, 0xd08c, 0x0178,
+	0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1148, 0x0026, 0x0036,
+	0x2011, 0x8048, 0x2518, 0x080c, 0x48d8, 0x003e, 0x002e, 0x0005,
+	0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200, 0x2019, 0xfffe,
+	0x7c30, 0x0050, 0x0036, 0x0046, 0x0056, 0x00f6, 0x2079, 0x0200,
+	0x7d44, 0x7c40, 0x2019, 0xffff, 0x2001, 0x1810, 0x2004, 0xd08c,
+	0x0160, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1130, 0x0026,
+	0x2011, 0x8048, 0x080c, 0x48d8, 0x002e, 0x00fe, 0x005e, 0x004e,
+	0x003e, 0x0005, 0x00b6, 0x00c6, 0x7010, 0x9084, 0xff00, 0x8007,
+	0x9096, 0x0001, 0x0120, 0x9096, 0x0023, 0x1904, 0x7ce2, 0x9186,
+	0x0023, 0x15c0, 0x080c, 0x7f7d, 0x0904, 0x7ce2, 0x6120, 0x9186,
+	0x0001, 0x0150, 0x9186, 0x0004, 0x0138, 0x9186, 0x0008, 0x0120,
+	0x9186, 0x000a, 0x1904, 0x7ce2, 0x7124, 0x610a, 0x7030, 0x908e,
+	0x0200, 0x1130, 0x2009, 0x0015, 0x080c, 0x9c85, 0x0804, 0x7ce2,
+	0x908e, 0x0214, 0x0118, 0x908e, 0x0210, 0x1130, 0x2009, 0x0015,
+	0x080c, 0x9c85, 0x0804, 0x7ce2, 0x908e, 0x0100, 0x1904, 0x7ce2,
+	0x7034, 0x9005, 0x1904, 0x7ce2, 0x2009, 0x0016, 0x080c, 0x9c85,
+	0x0804, 0x7ce2, 0x9186, 0x0022, 0x1904, 0x7ce2, 0x7030, 0x908e,
+	0x0300, 0x1580, 0x68d8, 0xd0a4, 0x0528, 0xc0b5, 0x68da, 0x7100,
+	0x918c, 0x00ff, 0x697a, 0x7004, 0x687e, 0x00f6, 0x2079, 0x0100,
+	0x79e6, 0x78ea, 0x0006, 0x9084, 0x00ff, 0x0016, 0x2008, 0x080c,
+	0x246d, 0x7932, 0x7936, 0x001e, 0x000e, 0x00fe, 0x080c, 0x2424,
+	0x695a, 0x703c, 0x00e6, 0x2071, 0x0140, 0x7086, 0x2071, 0x1800,
+	0x70b2, 0x00ee, 0x7034, 0x9005, 0x1904, 0x7ce2, 0x2009, 0x0017,
+	0x0804, 0x7c92, 0x908e, 0x0400, 0x1190, 0x7034, 0x9005, 0x1904,
+	0x7ce2, 0x080c, 0x70b7, 0x0120, 0x2009, 0x001d, 0x0804, 0x7c92,
+	0x68d8, 0xc0a5, 0x68da, 0x2009, 0x0030, 0x0804, 0x7c92, 0x908e,
+	0x0500, 0x1140, 0x7034, 0x9005, 0x1904, 0x7ce2, 0x2009, 0x0018,
+	0x0804, 0x7c92, 0x908e, 0x2010, 0x1120, 0x2009, 0x0019, 0x0804,
+	0x7c92, 0x908e, 0x2110, 0x1120, 0x2009, 0x001a, 0x0804, 0x7c92,
+	0x908e, 0x5200, 0x1140, 0x7034, 0x9005, 0x1904, 0x7ce2, 0x2009,
+	0x001b, 0x0804, 0x7c92, 0x908e, 0x5000, 0x1140, 0x7034, 0x9005,
+	0x1904, 0x7ce2, 0x2009, 0x001c, 0x0804, 0x7c92, 0x908e, 0x1300,
+	0x1120, 0x2009, 0x0034, 0x0804, 0x7c92, 0x908e, 0x1200, 0x1140,
+	0x7034, 0x9005, 0x1904, 0x7ce2, 0x2009, 0x0024, 0x0804, 0x7c92,
+	0x908c, 0xff00, 0x918e, 0x2400, 0x1170, 0x2009, 0x002d, 0x2001,
+	0x1810, 0x2004, 0xd09c, 0x0904, 0x7c92, 0x080c, 0xc62f, 0x1904,
+	0x7ce2, 0x0804, 0x7c90, 0x908c, 0xff00, 0x918e, 0x5300, 0x1120,
+	0x2009, 0x002a, 0x0804, 0x7c92, 0x908e, 0x0f00, 0x1120, 0x2009,
+	0x0020, 0x0804, 0x7c92, 0x908e, 0x6104, 0x1528, 0x2029, 0x0205,
+	0x2011, 0x026d, 0x8208, 0x2204, 0x9082, 0x0004, 0x8004, 0x8004,
+	0x20a8, 0x2011, 0x8015, 0x211c, 0x8108, 0x0046, 0x2124, 0x080c,
+	0x48d8, 0x004e, 0x8108, 0x0f04, 0x7c5e, 0x9186, 0x0280, 0x1d88,
+	0x2504, 0x8000, 0x202a, 0x2009, 0x0260, 0x0c58, 0x202b, 0x0000,
+	0x2009, 0x0023, 0x0478, 0x908e, 0x6000, 0x1118, 0x2009, 0x003f,
+	0x0448, 0x908e, 0x7800, 0x1118, 0x2009, 0x0045, 0x0418, 0x908e,
+	0x1000, 0x1118, 0x2009, 0x004e, 0x00e8, 0x908e, 0x6300, 0x1118,
+	0x2009, 0x004a, 0x00b8, 0x908c, 0xff00, 0x918e, 0x5600, 0x1118,
+	0x2009, 0x004f, 0x0078, 0x908c, 0xff00, 0x918e, 0x5700, 0x1118,
+	0x2009, 0x0050, 0x0038, 0x2009, 0x001d, 0x6838, 0xd0d4, 0x0110,
+	0x2009, 0x004c, 0x0016, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
+	0x080c, 0x2424, 0x1904, 0x7ce5, 0x080c, 0x6210, 0x1904, 0x7ce5,
+	0xbe12, 0xbd16, 0x001e, 0x0016, 0x080c, 0x70b7, 0x01c0, 0x68d8,
+	0xd08c, 0x1148, 0x7000, 0x9084, 0x00ff, 0x1188, 0x7004, 0x9084,
+	0xff00, 0x1168, 0x0040, 0x6878, 0x9606, 0x1148, 0x687c, 0x9506,
+	0x9084, 0xff00, 0x1120, 0x9584, 0x00ff, 0xb886, 0x0080, 0xb884,
 	0x9005, 0x1168, 0x9186, 0x0046, 0x1150, 0x6878, 0x9606, 0x1138,
 	0x687c, 0x9506, 0x9084, 0xff00, 0x1110, 0x001e, 0x0098, 0x080c,
-	0x9b76, 0x01a8, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a,
+	0x9b91, 0x01a8, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120, 0x610a,
 	0x001e, 0x9186, 0x004c, 0x1110, 0x6023, 0x000a, 0x0016, 0x001e,
-	0x080c, 0x9c6a, 0x00ce, 0x00be, 0x0005, 0x001e, 0x0cd8, 0x2001,
-	0x180e, 0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d1,
-	0x080c, 0x9c3d, 0x0d90, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120,
+	0x080c, 0x9c85, 0x00ce, 0x00be, 0x0005, 0x001e, 0x0cd8, 0x2001,
+	0x180e, 0x2004, 0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d8,
+	0x080c, 0x9c58, 0x0d90, 0x2b08, 0x6112, 0x6023, 0x0004, 0x7120,
 	0x610a, 0x001e, 0x0016, 0x9186, 0x0017, 0x0118, 0x9186, 0x0030,
 	0x1128, 0x6007, 0x0009, 0x6017, 0x2900, 0x0020, 0x6007, 0x0051,
-	0x6017, 0x0000, 0x602f, 0x0009, 0x6003, 0x0001, 0x080c, 0x84b0,
-	0x08a0, 0x080c, 0x3149, 0x1140, 0x7010, 0x9084, 0xff00, 0x8007,
+	0x6017, 0x0000, 0x602f, 0x0009, 0x6003, 0x0001, 0x080c, 0x84d8,
+	0x08a0, 0x080c, 0x3150, 0x1140, 0x7010, 0x9084, 0xff00, 0x8007,
 	0x908e, 0x0008, 0x1108, 0x0009, 0x0005, 0x00b6, 0x00c6, 0x0046,
 	0x7000, 0x908c, 0xff00, 0x810f, 0x9186, 0x0033, 0x11e8, 0x080c,
-	0x7f55, 0x0904, 0x7d44, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200,
-	0x1140, 0x7034, 0x9005, 0x15c0, 0x2009, 0x0015, 0x080c, 0x9c6a,
+	0x7f7d, 0x0904, 0x7d6c, 0x7124, 0x610a, 0x7030, 0x908e, 0x0200,
+	0x1140, 0x7034, 0x9005, 0x15c0, 0x2009, 0x0015, 0x080c, 0x9c85,
 	0x0498, 0x908e, 0x0100, 0x1580, 0x7034, 0x9005, 0x1568, 0x2009,
-	0x0016, 0x080c, 0x9c6a, 0x0440, 0x9186, 0x0032, 0x1528, 0x7030,
+	0x0016, 0x080c, 0x9c85, 0x0440, 0x9186, 0x0032, 0x1528, 0x7030,
 	0x908e, 0x1400, 0x1508, 0x2009, 0x0038, 0x0016, 0x2011, 0x0263,
-	0x2204, 0x8211, 0x220c, 0x080c, 0x2424, 0x11a8, 0x080c, 0x6209,
-	0x1190, 0xbe12, 0xbd16, 0x080c, 0x9b76, 0x0168, 0x2b08, 0x6112,
-	0x080c, 0xbcc0, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x080c,
-	0x9c6a, 0x0010, 0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be, 0x0005,
+	0x2204, 0x8211, 0x220c, 0x080c, 0x2424, 0x11a8, 0x080c, 0x6210,
+	0x1190, 0xbe12, 0xbd16, 0x080c, 0x9b91, 0x0168, 0x2b08, 0x6112,
+	0x080c, 0xbcdb, 0x6023, 0x0004, 0x7120, 0x610a, 0x001e, 0x080c,
+	0x9c85, 0x0010, 0x00ce, 0x001e, 0x004e, 0x00ce, 0x00be, 0x0005,
 	0x00b6, 0x0046, 0x00e6, 0x00d6, 0x2028, 0x2130, 0x9696, 0x00ff,
 	0x11b8, 0x9592, 0xfffc, 0x02a0, 0x9596, 0xfffd, 0x1120, 0x2009,
-	0x007f, 0x0804, 0x7da6, 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e,
-	0x0804, 0x7da6, 0x9596, 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0,
+	0x007f, 0x0804, 0x7dce, 0x9596, 0xfffe, 0x1120, 0x2009, 0x007e,
+	0x0804, 0x7dce, 0x9596, 0xfffc, 0x1118, 0x2009, 0x0080, 0x04f0,
 	0x2011, 0x0000, 0x2019, 0x1836, 0x231c, 0xd3ac, 0x0130, 0x9026,
 	0x20a9, 0x0800, 0x2071, 0x1000, 0x0030, 0x2021, 0x0081, 0x20a9,
 	0x077f, 0x2071, 0x1081, 0x2e1c, 0x93dd, 0x0000, 0x1140, 0x82ff,
 	0x11d0, 0x9496, 0x00ff, 0x01b8, 0x2410, 0xc2fd, 0x00a0, 0xbf10,
 	0x2600, 0x9706, 0xb814, 0x1120, 0x9546, 0x1110, 0x2408, 0x00b0,
 	0x9745, 0x1148, 0x94c6, 0x007e, 0x0130, 0x94c6, 0x007f, 0x0118,
-	0x94c6, 0x0080, 0x1d20, 0x8420, 0x8e70, 0x1f04, 0x7d7b, 0x82ff,
+	0x94c6, 0x0080, 0x1d20, 0x8420, 0x8e70, 0x1f04, 0x7da3, 0x82ff,
 	0x1118, 0x9085, 0x0001, 0x0018, 0xc2fc, 0x2208, 0x9006, 0x00de,
 	0x00ee, 0x004e, 0x00be, 0x0005, 0x7000, 0x908c, 0xff00, 0x810f,
-	0x9184, 0x000f, 0x0002, 0x7dc3, 0x7dc3, 0x7dc3, 0x7f67, 0x7dc3,
-	0x7dc6, 0x7deb, 0x7e74, 0x7dc3, 0x7dc3, 0x7dc3, 0x7dc3, 0x7dc3,
-	0x7dc3, 0x7dc3, 0x7dc3, 0x7817, 0x0140, 0x0005, 0x00b6, 0x7110,
+	0x9184, 0x000f, 0x0002, 0x7deb, 0x7deb, 0x7deb, 0x7f8f, 0x7deb,
+	0x7dee, 0x7e13, 0x7e9c, 0x7deb, 0x7deb, 0x7deb, 0x7deb, 0x7deb,
+	0x7deb, 0x7deb, 0x7deb, 0x7817, 0x0140, 0x0005, 0x00b6, 0x7110,
 	0xd1bc, 0x01e8, 0x7120, 0x2160, 0x9c8c, 0x0003, 0x11c0, 0x9c8a,
 	0x1ddc, 0x02a8, 0x6864, 0x9c02, 0x1290, 0x7008, 0x9084, 0x00ff,
 	0x6110, 0x2158, 0xb910, 0x9106, 0x1150, 0x700c, 0xb914, 0x9106,
-	0x1130, 0x7124, 0x610a, 0x2009, 0x0046, 0x080c, 0x9c6a, 0x7817,
+	0x1130, 0x7124, 0x610a, 0x2009, 0x0046, 0x080c, 0x9c85, 0x7817,
 	0x0140, 0x00be, 0x0005, 0x00b6, 0x00c6, 0x9484, 0x0fff, 0x0904,
-	0x7e50, 0x7110, 0xd1bc, 0x1904, 0x7e50, 0x7108, 0x700c, 0x2028,
+	0x7e78, 0x7110, 0xd1bc, 0x1904, 0x7e78, 0x7108, 0x700c, 0x2028,
 	0x918c, 0x00ff, 0x2130, 0x9094, 0xff00, 0x15c8, 0x81ff, 0x15b8,
-	0x9080, 0x3184, 0x200d, 0x918c, 0xff00, 0x810f, 0x2001, 0x0080,
-	0x9106, 0x0904, 0x7e50, 0x9182, 0x0801, 0x1a04, 0x7e50, 0x9190,
+	0x9080, 0x318b, 0x200d, 0x918c, 0xff00, 0x810f, 0x2001, 0x0080,
+	0x9106, 0x0904, 0x7e78, 0x9182, 0x0801, 0x1a04, 0x7e78, 0x9190,
 	0x1000, 0x2204, 0x905d, 0x05e0, 0xbe12, 0xbd16, 0xb800, 0xd0ec,
 	0x15b8, 0xba04, 0x9294, 0xff00, 0x9286, 0x0600, 0x1190, 0x080c,
-	0x9b76, 0x0598, 0x2b08, 0x7028, 0x6052, 0x702c, 0x604e, 0x6112,
-	0x6023, 0x0006, 0x7120, 0x610a, 0x7130, 0x615e, 0x080c, 0xc873,
-	0x00f8, 0x080c, 0x6660, 0x1138, 0xb807, 0x0606, 0x0c40, 0x190c,
-	0x7d48, 0x11b0, 0x0880, 0x080c, 0x9b76, 0x2b08, 0x0188, 0x6112,
+	0x9b91, 0x0598, 0x2b08, 0x7028, 0x6052, 0x702c, 0x604e, 0x6112,
+	0x6023, 0x0006, 0x7120, 0x610a, 0x7130, 0x615e, 0x080c, 0xc893,
+	0x00f8, 0x080c, 0x6667, 0x1138, 0xb807, 0x0606, 0x0c40, 0x190c,
+	0x7d70, 0x11b0, 0x0880, 0x080c, 0x9b91, 0x2b08, 0x0188, 0x6112,
 	0x6023, 0x0004, 0x7120, 0x610a, 0x9286, 0x0400, 0x1118, 0x6007,
-	0x0005, 0x0010, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x84b0,
+	0x0005, 0x0010, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x84d8,
 	0x7817, 0x0140, 0x00ce, 0x00be, 0x0005, 0x2001, 0x180e, 0x2004,
-	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d1, 0x080c, 0x9c3d,
+	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d8, 0x080c, 0x9c58,
 	0x0d78, 0x2b08, 0x6112, 0x6023, 0x0006, 0x7120, 0x610a, 0x7130,
 	0x615e, 0x6017, 0xf300, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009,
-	0xa022, 0x080c, 0x84a9, 0x08e0, 0x00b6, 0x7110, 0xd1bc, 0x05d0,
+	0xa022, 0x080c, 0x84d1, 0x08e0, 0x00b6, 0x7110, 0xd1bc, 0x05d0,
 	0x7020, 0x2060, 0x9c84, 0x0003, 0x15a8, 0x9c82, 0x1ddc, 0x0690,
 	0x6864, 0x9c02, 0x1678, 0x9484, 0x0fff, 0x9082, 0x000c, 0x0650,
 	0x7008, 0x9084, 0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1510,
@@ -3848,55 +3853,55 @@
 	0x11c8, 0x2001, 0x0271, 0x2004, 0x9005, 0x1180, 0x9484, 0x0fff,
 	0x9082, 0x000c, 0x0158, 0x0066, 0x2031, 0x0100, 0xa001, 0xa001,
 	0x8631, 0x1de0, 0x006e, 0x601c, 0xd0fc, 0x1120, 0x2009, 0x0045,
-	0x080c, 0x9c6a, 0x7817, 0x0140, 0x00be, 0x0005, 0x6120, 0x9186,
+	0x080c, 0x9c85, 0x7817, 0x0140, 0x00be, 0x0005, 0x6120, 0x9186,
 	0x0002, 0x0128, 0x9186, 0x0005, 0x0110, 0x9085, 0x0001, 0x0005,
-	0x080c, 0x3149, 0x1168, 0x7010, 0x9084, 0xff00, 0x8007, 0x9086,
+	0x080c, 0x3150, 0x1168, 0x7010, 0x9084, 0xff00, 0x8007, 0x9086,
 	0x0000, 0x1130, 0x9184, 0x000f, 0x908a, 0x0006, 0x1208, 0x000b,
-	0x0005, 0x7ed7, 0x7ed8, 0x7ed7, 0x7ed7, 0x7f37, 0x7f46, 0x0005,
-	0x00b6, 0x7110, 0xd1bc, 0x0120, 0x702c, 0xd084, 0x0904, 0x7f35,
-	0x700c, 0x7108, 0x080c, 0x2424, 0x1904, 0x7f35, 0x080c, 0x6209,
-	0x1904, 0x7f35, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x01d8, 0x080c,
-	0x6660, 0x0118, 0x9086, 0x0004, 0x1588, 0x00c6, 0x080c, 0x7f55,
-	0x00ce, 0x05d8, 0x080c, 0x9b76, 0x2b08, 0x05b8, 0x6112, 0x080c,
-	0xbcc0, 0x6023, 0x0002, 0x7120, 0x610a, 0x2009, 0x0088, 0x080c,
-	0x9c6a, 0x0458, 0x080c, 0x6660, 0x0148, 0x9086, 0x0004, 0x0130,
-	0x080c, 0x6668, 0x0118, 0x9086, 0x0004, 0x1180, 0x080c, 0x9b76,
-	0x2b08, 0x01d8, 0x6112, 0x080c, 0xbcc0, 0x6023, 0x0005, 0x7120,
-	0x610a, 0x2009, 0x0088, 0x080c, 0x9c6a, 0x0078, 0x080c, 0x9b76,
-	0x2b08, 0x0158, 0x6112, 0x080c, 0xbcc0, 0x6023, 0x0004, 0x7120,
-	0x610a, 0x2009, 0x0001, 0x080c, 0x9c6a, 0x00be, 0x0005, 0x7110,
-	0xd1bc, 0x0158, 0x00d1, 0x0148, 0x080c, 0x7eb6, 0x1130, 0x7124,
-	0x610a, 0x2009, 0x0089, 0x080c, 0x9c6a, 0x0005, 0x7110, 0xd1bc,
-	0x0158, 0x0059, 0x0148, 0x080c, 0x7eb6, 0x1130, 0x7124, 0x610a,
-	0x2009, 0x008a, 0x080c, 0x9c6a, 0x0005, 0x7020, 0x2060, 0x9c84,
+	0x0005, 0x7eff, 0x7f00, 0x7eff, 0x7eff, 0x7f5f, 0x7f6e, 0x0005,
+	0x00b6, 0x7110, 0xd1bc, 0x0120, 0x702c, 0xd084, 0x0904, 0x7f5d,
+	0x700c, 0x7108, 0x080c, 0x2424, 0x1904, 0x7f5d, 0x080c, 0x6210,
+	0x1904, 0x7f5d, 0xbe12, 0xbd16, 0x7110, 0xd1bc, 0x01d8, 0x080c,
+	0x6667, 0x0118, 0x9086, 0x0004, 0x1588, 0x00c6, 0x080c, 0x7f7d,
+	0x00ce, 0x05d8, 0x080c, 0x9b91, 0x2b08, 0x05b8, 0x6112, 0x080c,
+	0xbcdb, 0x6023, 0x0002, 0x7120, 0x610a, 0x2009, 0x0088, 0x080c,
+	0x9c85, 0x0458, 0x080c, 0x6667, 0x0148, 0x9086, 0x0004, 0x0130,
+	0x080c, 0x666f, 0x0118, 0x9086, 0x0004, 0x1180, 0x080c, 0x9b91,
+	0x2b08, 0x01d8, 0x6112, 0x080c, 0xbcdb, 0x6023, 0x0005, 0x7120,
+	0x610a, 0x2009, 0x0088, 0x080c, 0x9c85, 0x0078, 0x080c, 0x9b91,
+	0x2b08, 0x0158, 0x6112, 0x080c, 0xbcdb, 0x6023, 0x0004, 0x7120,
+	0x610a, 0x2009, 0x0001, 0x080c, 0x9c85, 0x00be, 0x0005, 0x7110,
+	0xd1bc, 0x0158, 0x00d1, 0x0148, 0x080c, 0x7ede, 0x1130, 0x7124,
+	0x610a, 0x2009, 0x0089, 0x080c, 0x9c85, 0x0005, 0x7110, 0xd1bc,
+	0x0158, 0x0059, 0x0148, 0x080c, 0x7ede, 0x1130, 0x7124, 0x610a,
+	0x2009, 0x008a, 0x080c, 0x9c85, 0x0005, 0x7020, 0x2060, 0x9c84,
 	0x0003, 0x1158, 0x9c82, 0x1ddc, 0x0240, 0x2001, 0x1819, 0x2004,
 	0x9c02, 0x1218, 0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x00b6,
 	0x7110, 0xd1bc, 0x11d8, 0x7024, 0x2060, 0x9c84, 0x0003, 0x11b0,
 	0x9c82, 0x1ddc, 0x0298, 0x6864, 0x9c02, 0x1280, 0x7008, 0x9084,
 	0x00ff, 0x6110, 0x2158, 0xb910, 0x9106, 0x1140, 0x700c, 0xb914,
-	0x9106, 0x1120, 0x2009, 0x0051, 0x080c, 0x9c6a, 0x7817, 0x0140,
+	0x9106, 0x1120, 0x2009, 0x0051, 0x080c, 0x9c85, 0x7817, 0x0140,
 	0x00be, 0x0005, 0x2031, 0x0105, 0x0069, 0x0005, 0x2031, 0x0206,
 	0x0049, 0x0005, 0x2031, 0x0207, 0x0029, 0x0005, 0x2031, 0x0213,
 	0x0009, 0x0005, 0x00c6, 0x0096, 0x00f6, 0x7000, 0x9084, 0xf000,
-	0x9086, 0xc000, 0x05c0, 0x080c, 0x9b76, 0x05a8, 0x0066, 0x00c6,
+	0x9086, 0xc000, 0x05c0, 0x080c, 0x9b91, 0x05a8, 0x0066, 0x00c6,
 	0x0046, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2424,
-	0x1590, 0x080c, 0x6209, 0x1578, 0xbe12, 0xbd16, 0x2b00, 0x004e,
-	0x00ce, 0x6012, 0x080c, 0xbcc0, 0x080c, 0x1022, 0x0500, 0x2900,
+	0x1590, 0x080c, 0x6210, 0x1578, 0xbe12, 0xbd16, 0x2b00, 0x004e,
+	0x00ce, 0x6012, 0x080c, 0xbcdb, 0x080c, 0x1022, 0x0500, 0x2900,
 	0x6062, 0x9006, 0xa802, 0xa866, 0xac6a, 0xa85c, 0x90f8, 0x001b,
 	0x20a9, 0x000e, 0xa860, 0x20e8, 0x20e1, 0x0000, 0x2fa0, 0x2e98,
 	0x4003, 0x006e, 0x6616, 0x6007, 0x003e, 0x6023, 0x0001, 0x6003,
-	0x0001, 0x080c, 0x84b0, 0x00fe, 0x009e, 0x00ce, 0x0005, 0x080c,
-	0x9bcc, 0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6, 0x7000,
+	0x0001, 0x080c, 0x84d8, 0x00fe, 0x009e, 0x00ce, 0x0005, 0x080c,
+	0x9be7, 0x006e, 0x0cc0, 0x004e, 0x00ce, 0x0cc8, 0x00c6, 0x7000,
 	0x908c, 0xff00, 0x9184, 0xf000, 0x810f, 0x9086, 0x2000, 0x1904,
-	0x803d, 0x9186, 0x0022, 0x15f0, 0x2001, 0x0111, 0x2004, 0x9005,
-	0x1904, 0x803f, 0x7030, 0x908e, 0x0400, 0x0904, 0x803f, 0x908e,
+	0x8065, 0x9186, 0x0022, 0x15f0, 0x2001, 0x0111, 0x2004, 0x9005,
+	0x1904, 0x8067, 0x7030, 0x908e, 0x0400, 0x0904, 0x8067, 0x908e,
 	0x6000, 0x05e8, 0x908e, 0x5400, 0x05d0, 0x908e, 0x0300, 0x11d8,
 	0x2009, 0x1836, 0x210c, 0xd18c, 0x1590, 0xd1a4, 0x1580, 0x080c,
-	0x661e, 0x0558, 0x68ac, 0x9084, 0x00ff, 0x7100, 0x918c, 0x00ff,
+	0x6625, 0x0558, 0x68ac, 0x9084, 0x00ff, 0x7100, 0x918c, 0x00ff,
 	0x9106, 0x1518, 0x687c, 0x69ac, 0x918c, 0xff00, 0x9105, 0x7104,
 	0x9106, 0x11d8, 0x00e0, 0x2009, 0x0103, 0x210c, 0xd1b4, 0x11a8,
 	0x908e, 0x5200, 0x09e8, 0x908e, 0x0500, 0x09d0, 0x908e, 0x5000,
-	0x09b8, 0x0058, 0x9186, 0x0023, 0x1140, 0x080c, 0x7f55, 0x0128,
+	0x09b8, 0x0058, 0x9186, 0x0023, 0x1140, 0x080c, 0x7f7d, 0x0128,
 	0x6004, 0x9086, 0x0002, 0x0118, 0x0000, 0x9006, 0x0010, 0x9085,
 	0x0001, 0x00ce, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7800, 0xc0e5,
 	0xc0cc, 0x7802, 0x00fe, 0x0005, 0x00f6, 0x2079, 0x1800, 0x7834,
@@ -3904,21 +3909,21 @@
 	0x00fe, 0x0005, 0x00e6, 0x2071, 0x1800, 0x7034, 0xc084, 0x7036,
 	0x00ee, 0x0005, 0x2071, 0x19d4, 0x7003, 0x0003, 0x700f, 0x0361,
 	0x9006, 0x701a, 0x7072, 0x7012, 0x7017, 0x1ddc, 0x7007, 0x0000,
-	0x7026, 0x702b, 0x8fbe, 0x7032, 0x7037, 0x903b, 0x703f, 0xffff,
-	0x7042, 0x7047, 0x521d, 0x704a, 0x705b, 0x81fe, 0x080c, 0x103b,
+	0x7026, 0x702b, 0x8fd9, 0x7032, 0x7037, 0x9056, 0x703f, 0xffff,
+	0x7042, 0x7047, 0x5224, 0x704a, 0x705b, 0x8226, 0x080c, 0x103b,
 	0x090c, 0x0d65, 0x2900, 0x703a, 0xa867, 0x0003, 0xa86f, 0x0100,
-	0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x19d4, 0x1d04, 0x8120, 0x2091,
+	0xa8ab, 0xdcb0, 0x0005, 0x2071, 0x19d4, 0x1d04, 0x8148, 0x2091,
 	0x6000, 0x700c, 0x8001, 0x700e, 0x1560, 0x2001, 0x1875, 0x2004,
 	0xd0c4, 0x0158, 0x3a00, 0xd08c, 0x1140, 0x20d1, 0x0000, 0x20d1,
 	0x0001, 0x20d1, 0x0000, 0x080c, 0x0d65, 0x700f, 0x0361, 0x7007,
 	0x0001, 0x0126, 0x2091, 0x8000, 0x2069, 0x1800, 0x69e8, 0xd1e4,
-	0x1138, 0xd1dc, 0x1118, 0x080c, 0x826c, 0x0010, 0x080c, 0x8243,
+	0x1138, 0xd1dc, 0x1118, 0x080c, 0x8294, 0x0010, 0x080c, 0x826b,
 	0x7040, 0x900d, 0x0148, 0x8109, 0x7142, 0x1130, 0x7044, 0x080f,
 	0x0018, 0x0126, 0x2091, 0x8000, 0x7024, 0x900d, 0x0188, 0x7020,
 	0x8001, 0x7022, 0x1168, 0x7023, 0x0009, 0x8109, 0x7126, 0x9186,
 	0x03e8, 0x1110, 0x7028, 0x080f, 0x81ff, 0x1110, 0x7028, 0x080f,
 	0x7030, 0x900d, 0x0180, 0x702c, 0x8001, 0x702e, 0x1160, 0x702f,
-	0x0009, 0x8109, 0x7132, 0x0128, 0x9184, 0x007f, 0x090c, 0x90c3,
+	0x0009, 0x8109, 0x7132, 0x0128, 0x9184, 0x007f, 0x090c, 0x90de,
 	0x0010, 0x7034, 0x080f, 0x703c, 0x9005, 0x0118, 0x0310, 0x8001,
 	0x703e, 0x704c, 0x900d, 0x0168, 0x7048, 0x8001, 0x704a, 0x1148,
 	0x704b, 0x0009, 0x8109, 0x714e, 0x1120, 0x7150, 0x714e, 0x7058,
@@ -3926,29 +3931,29 @@
 	0x706c, 0x8001, 0x706e, 0x1138, 0x706f, 0x0009, 0x8109, 0x7172,
 	0x1110, 0x7074, 0x080f, 0x001e, 0x7008, 0x8001, 0x700a, 0x1138,
 	0x700b, 0x0009, 0x8109, 0x711a, 0x1110, 0x701c, 0x080f, 0x012e,
-	0x7004, 0x0002, 0x8148, 0x8149, 0x8173, 0x00e6, 0x2071, 0x19d4,
+	0x7004, 0x0002, 0x8170, 0x8171, 0x819b, 0x00e6, 0x2071, 0x19d4,
 	0x7018, 0x9005, 0x1120, 0x711a, 0x721e, 0x700b, 0x0009, 0x00ee,
 	0x0005, 0x00e6, 0x0006, 0x2071, 0x19d4, 0x701c, 0x9206, 0x1120,
 	0x701a, 0x701e, 0x7072, 0x7076, 0x000e, 0x00ee, 0x0005, 0x00e6,
 	0x2071, 0x19d4, 0xb888, 0x9102, 0x0208, 0xb98a, 0x00ee, 0x0005,
-	0x0005, 0x00b6, 0x2031, 0x0010, 0x7110, 0x080c, 0x6269, 0x11a8,
+	0x0005, 0x00b6, 0x2031, 0x0010, 0x7110, 0x080c, 0x6270, 0x11a8,
 	0xb888, 0x8001, 0x0290, 0xb88a, 0x1180, 0x0126, 0x2091, 0x8000,
 	0x0066, 0xb8c0, 0x9005, 0x0138, 0x0026, 0xba3c, 0x0016, 0x080c,
-	0x6394, 0x001e, 0x002e, 0x006e, 0x012e, 0x8108, 0x9182, 0x0800,
+	0x639b, 0x001e, 0x002e, 0x006e, 0x012e, 0x8108, 0x9182, 0x0800,
 	0x1220, 0x8631, 0x0128, 0x7112, 0x0c00, 0x900e, 0x7007, 0x0002,
 	0x7112, 0x00be, 0x0005, 0x2031, 0x0010, 0x7014, 0x2060, 0x0126,
 	0x2091, 0x8000, 0x6048, 0x9005, 0x0128, 0x8001, 0x604a, 0x1110,
-	0x080c, 0xbb41, 0x6018, 0x9005, 0x0904, 0x81c5, 0x00f6, 0x2079,
-	0x0300, 0x7918, 0xd1b4, 0x1904, 0x81d8, 0x781b, 0x2020, 0xa001,
-	0x7918, 0xd1b4, 0x0120, 0x781b, 0x2000, 0x0804, 0x81d8, 0x8001,
+	0x080c, 0xbb5c, 0x6018, 0x9005, 0x0904, 0x81ed, 0x00f6, 0x2079,
+	0x0300, 0x7918, 0xd1b4, 0x1904, 0x8200, 0x781b, 0x2020, 0xa001,
+	0x7918, 0xd1b4, 0x0120, 0x781b, 0x2000, 0x0804, 0x8200, 0x8001,
 	0x601a, 0x0106, 0x781b, 0x2000, 0xa001, 0x7918, 0xd1ac, 0x1dd0,
 	0x010e, 0x00fe, 0x1510, 0x6120, 0x9186, 0x0003, 0x0118, 0x9186,
-	0x0006, 0x11c8, 0x080c, 0xb82c, 0x01b0, 0x6014, 0x2048, 0xa884,
+	0x0006, 0x11c8, 0x080c, 0xb847, 0x01b0, 0x6014, 0x2048, 0xa884,
 	0x908a, 0x199a, 0x0280, 0x9082, 0x1999, 0xa886, 0x908a, 0x199a,
 	0x0210, 0x2001, 0x1999, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a,
-	0x080c, 0xbf72, 0x0110, 0x080c, 0xb52a, 0x012e, 0x9c88, 0x001c,
+	0x080c, 0xbf8d, 0x0110, 0x080c, 0xb545, 0x012e, 0x9c88, 0x001c,
 	0x7116, 0x2001, 0x1819, 0x2004, 0x9102, 0x1228, 0x8631, 0x0138,
-	0x2160, 0x0804, 0x8177, 0x7017, 0x1ddc, 0x7007, 0x0000, 0x0005,
+	0x2160, 0x0804, 0x819f, 0x7017, 0x1ddc, 0x7007, 0x0000, 0x0005,
 	0x00fe, 0x0c58, 0x00e6, 0x2071, 0x19d4, 0x7027, 0x07d0, 0x7023,
 	0x0009, 0x00ee, 0x0005, 0x2001, 0x19dd, 0x2003, 0x0000, 0x0005,
 	0x00e6, 0x2071, 0x19d4, 0x7132, 0x702f, 0x0009, 0x00ee, 0x0005,
@@ -3958,7 +3963,7 @@
 	0x0000, 0x0150, 0x7068, 0xa09a, 0x7064, 0xa096, 0x7060, 0xa092,
 	0x705c, 0xa08e, 0x080c, 0x110c, 0x002e, 0x008e, 0x0005, 0x0006,
 	0x0016, 0x0096, 0x00a6, 0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6,
-	0x0156, 0x080c, 0x808b, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
+	0x0156, 0x080c, 0x80b3, 0x015e, 0x00fe, 0x00ee, 0x00de, 0x00ce,
 	0x00be, 0x00ae, 0x009e, 0x001e, 0x000e, 0x0005, 0x00e6, 0x2071,
 	0x19d4, 0x7172, 0x7276, 0x706f, 0x0009, 0x00ee, 0x0005, 0x00e6,
 	0x0006, 0x2071, 0x19d4, 0x7074, 0x9206, 0x1110, 0x7072, 0x7076,
@@ -3980,8 +3985,8 @@
 	0x199a, 0x1638, 0x9005, 0x1150, 0x00c6, 0x2061, 0x1a3f, 0x6014,
 	0x00ce, 0x9005, 0x1130, 0x2001, 0x001e, 0x0018, 0x908e, 0xffff,
 	0x01b0, 0x8003, 0x800b, 0x810b, 0x9108, 0x611a, 0xa87c, 0x908c,
-	0x00c0, 0x918e, 0x00c0, 0x0904, 0x836d, 0xd0b4, 0x1168, 0xd0bc,
-	0x1904, 0x8346, 0x2009, 0x0006, 0x080c, 0x839a, 0x0005, 0x900e,
+	0x00c0, 0x918e, 0x00c0, 0x0904, 0x8395, 0xd0b4, 0x1168, 0xd0bc,
+	0x1904, 0x836e, 0x2009, 0x0006, 0x080c, 0x83c2, 0x0005, 0x900e,
 	0x0c60, 0x2001, 0x1999, 0x08b0, 0xd0fc, 0x05c8, 0x908c, 0x2023,
 	0x1550, 0x87ff, 0x1540, 0x6124, 0x918c, 0x0500, 0x1520, 0x6100,
 	0x918e, 0x0007, 0x1500, 0x2009, 0x1875, 0x210c, 0xd184, 0x11d8,
@@ -3989,44 +3994,44 @@
 	0xa87c, 0xc0dd, 0xa87e, 0x600f, 0x0000, 0x00f6, 0x2079, 0x0380,
 	0x7818, 0xd0bc, 0x1de8, 0x7833, 0x0013, 0x2c00, 0x7836, 0x781b,
 	0x8080, 0x00fe, 0x0005, 0x908c, 0x0003, 0x0120, 0x918e, 0x0003,
-	0x1904, 0x8394, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8, 0x6024,
+	0x1904, 0x83bc, 0x908c, 0x2020, 0x918e, 0x2020, 0x01a8, 0x6024,
 	0xd0d4, 0x11e8, 0x2009, 0x1875, 0x2104, 0xd084, 0x1138, 0x87ff,
-	0x1120, 0x2009, 0x0043, 0x0804, 0x9c6a, 0x0005, 0x87ff, 0x1de8,
-	0x2009, 0x0042, 0x0804, 0x9c6a, 0x6110, 0x00b6, 0x2158, 0xb900,
+	0x1120, 0x2009, 0x0043, 0x0804, 0x9c85, 0x0005, 0x87ff, 0x1de8,
+	0x2009, 0x0042, 0x0804, 0x9c85, 0x6110, 0x00b6, 0x2158, 0xb900,
 	0x00be, 0xd1ac, 0x0d20, 0x6024, 0xc0cd, 0x6026, 0x0c00, 0xc0d4,
 	0x6026, 0xa890, 0x602e, 0xa88c, 0x6032, 0x08e0, 0xd0fc, 0x0160,
-	0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x8394, 0x908c,
+	0x908c, 0x0003, 0x0120, 0x918e, 0x0003, 0x1904, 0x83bc, 0x908c,
 	0x2020, 0x918e, 0x2020, 0x0170, 0x0076, 0x00f6, 0x2c78, 0x080c,
 	0x164f, 0x00fe, 0x007e, 0x87ff, 0x1120, 0x2009, 0x0042, 0x080c,
-	0x9c6a, 0x0005, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac,
+	0x9c85, 0x0005, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac,
 	0x0d58, 0x6124, 0xc1cd, 0x6126, 0x0c38, 0xd0fc, 0x0188, 0x908c,
 	0x2020, 0x918e, 0x2020, 0x01a8, 0x9084, 0x0003, 0x908e, 0x0002,
-	0x0148, 0x87ff, 0x1120, 0x2009, 0x0041, 0x080c, 0x9c6a, 0x0005,
-	0x00b9, 0x0ce8, 0x87ff, 0x1dd8, 0x2009, 0x0043, 0x080c, 0x9c6a,
+	0x0148, 0x87ff, 0x1120, 0x2009, 0x0041, 0x080c, 0x9c85, 0x0005,
+	0x00b9, 0x0ce8, 0x87ff, 0x1dd8, 0x2009, 0x0043, 0x080c, 0x9c85,
 	0x0cb0, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1ac, 0x0d20,
 	0x6124, 0xc1cd, 0x6126, 0x0c00, 0x2009, 0x0004, 0x0019, 0x0005,
-	0x2009, 0x0001, 0x0096, 0x080c, 0xb82c, 0x0518, 0x6014, 0x2048,
+	0x2009, 0x0001, 0x0096, 0x080c, 0xb847, 0x0518, 0x6014, 0x2048,
 	0xa982, 0xa800, 0x6016, 0x9186, 0x0001, 0x1188, 0xa97c, 0x918c,
 	0x8100, 0x918e, 0x8100, 0x1158, 0x00c6, 0x2061, 0x1a3f, 0x6200,
 	0xd28c, 0x1120, 0x6204, 0x8210, 0x0208, 0x6206, 0x00ce, 0x080c,
-	0x67c4, 0x6014, 0x904d, 0x0076, 0x2039, 0x0000, 0x190c, 0x82b6,
+	0x67cb, 0x6014, 0x904d, 0x0076, 0x2039, 0x0000, 0x190c, 0x82de,
 	0x007e, 0x009e, 0x0005, 0x0156, 0x00c6, 0x2061, 0x1a3f, 0x6000,
 	0x81ff, 0x0110, 0x9205, 0x0008, 0x9204, 0x6002, 0x00ce, 0x015e,
 	0x0005, 0x6800, 0xd08c, 0x1138, 0x6808, 0x9005, 0x0120, 0x8001,
 	0x680a, 0x9085, 0x0001, 0x0005, 0x0126, 0x2091, 0x8000, 0x0036,
 	0x0046, 0x20a9, 0x0010, 0x9006, 0x8004, 0x8086, 0x818e, 0x1208,
-	0x9200, 0x1f04, 0x83e5, 0x8086, 0x818e, 0x004e, 0x003e, 0x012e,
+	0x9200, 0x1f04, 0x840d, 0x8086, 0x818e, 0x004e, 0x003e, 0x012e,
 	0x0005, 0x0126, 0x2091, 0x8000, 0x0076, 0x0156, 0x20a9, 0x0010,
 	0x9005, 0x01c8, 0x911a, 0x12b8, 0x8213, 0x818d, 0x0228, 0x911a,
-	0x1220, 0x1f04, 0x83fc, 0x0028, 0x911a, 0x2308, 0x8210, 0x1f04,
-	0x83fc, 0x0006, 0x3200, 0x9084, 0xefff, 0x2080, 0x000e, 0x015e,
+	0x1220, 0x1f04, 0x8424, 0x0028, 0x911a, 0x2308, 0x8210, 0x1f04,
+	0x8424, 0x0006, 0x3200, 0x9084, 0xefff, 0x2080, 0x000e, 0x015e,
 	0x007e, 0x012e, 0x0005, 0x0006, 0x3200, 0x9085, 0x1000, 0x0ca8,
 	0x0126, 0x2091, 0x2800, 0x2079, 0x19b8, 0x012e, 0x00d6, 0x2069,
 	0x19b8, 0x6803, 0x0005, 0x0156, 0x0146, 0x01d6, 0x20e9, 0x0000,
-	0x2069, 0x0200, 0x080c, 0x97df, 0x04a9, 0x080c, 0x97ca, 0x0491,
-	0x080c, 0x97cd, 0x0479, 0x080c, 0x97d0, 0x0461, 0x080c, 0x97d3,
-	0x0449, 0x080c, 0x97d6, 0x0431, 0x080c, 0x97d9, 0x0419, 0x080c,
-	0x97dc, 0x0401, 0x01de, 0x014e, 0x015e, 0x6857, 0x0000, 0x00f6,
+	0x2069, 0x0200, 0x080c, 0x97fa, 0x04a9, 0x080c, 0x97e5, 0x0491,
+	0x080c, 0x97e8, 0x0479, 0x080c, 0x97eb, 0x0461, 0x080c, 0x97ee,
+	0x0449, 0x080c, 0x97f1, 0x0431, 0x080c, 0x97f4, 0x0419, 0x080c,
+	0x97f7, 0x0401, 0x01de, 0x014e, 0x015e, 0x6857, 0x0000, 0x00f6,
 	0x2079, 0x0380, 0x00f9, 0x7807, 0x0003, 0x7803, 0x0000, 0x7803,
 	0x0001, 0x2069, 0x0004, 0x2d04, 0x9084, 0xfffe, 0x9085, 0x8000,
 	0x206a, 0x2069, 0x0100, 0x6828, 0x9084, 0xfffc, 0x682a, 0x00fe,
@@ -4039,256 +4044,256 @@
 	0x9086, 0x0001, 0x01b0, 0x00c6, 0x6146, 0x600f, 0x0000, 0x2c08,
 	0x2061, 0x19b8, 0x602c, 0x8000, 0x602e, 0x601c, 0x9005, 0x0130,
 	0x9080, 0x0003, 0x2102, 0x611e, 0x00ce, 0x0005, 0x6122, 0x611e,
-	0x0cd8, 0x6146, 0x2c08, 0x2001, 0x0012, 0x080c, 0x989e, 0x0005,
+	0x0cd8, 0x6146, 0x2c08, 0x2001, 0x0012, 0x080c, 0x98b9, 0x0005,
 	0x0016, 0x2009, 0x8020, 0x6146, 0x2c08, 0x2001, 0x0382, 0x2004,
 	0x9084, 0x0007, 0x9086, 0x0001, 0x1128, 0x2001, 0x0019, 0x080c,
-	0x989e, 0x0088, 0x00c6, 0x2061, 0x19b8, 0x602c, 0x8000, 0x602e,
+	0x98b9, 0x0088, 0x00c6, 0x2061, 0x19b8, 0x602c, 0x8000, 0x602e,
 	0x600c, 0x9005, 0x0128, 0x9080, 0x0003, 0x2102, 0x610e, 0x0010,
 	0x6112, 0x610e, 0x00ce, 0x001e, 0x0005, 0x2001, 0x0382, 0x2004,
 	0x9084, 0x0007, 0x9086, 0x0001, 0x0198, 0x00c6, 0x6146, 0x600f,
 	0x0000, 0x2c08, 0x2061, 0x19b8, 0x6044, 0x9005, 0x0130, 0x9080,
 	0x0003, 0x2102, 0x6146, 0x00ce, 0x0005, 0x614a, 0x6146, 0x0cd8,
-	0x6146, 0x600f, 0x0000, 0x2c08, 0x2001, 0x0013, 0x080c, 0x989e,
+	0x6146, 0x600f, 0x0000, 0x2c08, 0x2001, 0x0013, 0x080c, 0x98b9,
 	0x0005, 0x6044, 0xd0dc, 0x0128, 0x9006, 0x7007, 0x0000, 0x700a,
 	0x7032, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00b6, 0x0096,
 	0x0076, 0x0066, 0x0056, 0x0036, 0x0026, 0x0016, 0x0006, 0x0126,
 	0x902e, 0x2071, 0x19b8, 0x7648, 0x2660, 0x2678, 0x2091, 0x8000,
-	0x8cff, 0x0904, 0x857b, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904,
-	0x8576, 0x87ff, 0x0120, 0x605c, 0x9106, 0x1904, 0x8576, 0x704c,
-	0x9c06, 0x1178, 0x0036, 0x2019, 0x0001, 0x080c, 0x926b, 0x703f,
+	0x8cff, 0x0904, 0x85a3, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904,
+	0x859e, 0x87ff, 0x0120, 0x605c, 0x9106, 0x1904, 0x859e, 0x704c,
+	0x9c06, 0x1178, 0x0036, 0x2019, 0x0001, 0x080c, 0x9286, 0x703f,
 	0x0000, 0x9006, 0x704e, 0x706a, 0x7052, 0x706e, 0x003e, 0x2029,
-	0x0001, 0x080c, 0x84f9, 0x7048, 0x9c36, 0x1110, 0x660c, 0x764a,
+	0x0001, 0x080c, 0x8521, 0x7048, 0x9c36, 0x1110, 0x660c, 0x764a,
 	0x7044, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7046,
 	0x0010, 0x7047, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110,
-	0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xb82c, 0x01c8,
+	0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xb847, 0x01c8,
 	0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1560, 0xa867, 0x0103,
-	0xab7a, 0xa877, 0x0000, 0x0016, 0x0036, 0x0076, 0x080c, 0xbb2a,
-	0x080c, 0xd4f8, 0x080c, 0x698f, 0x007e, 0x003e, 0x001e, 0x080c,
-	0xba1b, 0x080c, 0x9c06, 0x00ce, 0x0804, 0x8518, 0x2c78, 0x600c,
-	0x2060, 0x0804, 0x8518, 0x012e, 0x000e, 0x001e, 0x002e, 0x003e,
+	0xab7a, 0xa877, 0x0000, 0x0016, 0x0036, 0x0076, 0x080c, 0xbb45,
+	0x080c, 0xd51a, 0x080c, 0x6996, 0x007e, 0x003e, 0x001e, 0x080c,
+	0xba36, 0x080c, 0x9c21, 0x00ce, 0x0804, 0x8540, 0x2c78, 0x600c,
+	0x2060, 0x0804, 0x8540, 0x012e, 0x000e, 0x001e, 0x002e, 0x003e,
 	0x005e, 0x006e, 0x007e, 0x009e, 0x00be, 0x00ce, 0x00de, 0x00ee,
 	0x00fe, 0x0005, 0x6020, 0x9086, 0x0006, 0x1158, 0x0016, 0x0036,
-	0x0076, 0x080c, 0xd4f8, 0x080c, 0xd1fc, 0x007e, 0x003e, 0x001e,
+	0x0076, 0x080c, 0xd51a, 0x080c, 0xd21e, 0x007e, 0x003e, 0x001e,
 	0x08c0, 0x6020, 0x9086, 0x000a, 0x0918, 0x0800, 0x0006, 0x0066,
 	0x0096, 0x00c6, 0x00d6, 0x00f6, 0x9036, 0x0126, 0x2091, 0x8000,
-	0x2079, 0x19b8, 0x7848, 0x9065, 0x0904, 0x85fd, 0x600c, 0x0006,
+	0x2079, 0x19b8, 0x7848, 0x9065, 0x0904, 0x8625, 0x600c, 0x0006,
 	0x600f, 0x0000, 0x784c, 0x9c06, 0x11a0, 0x0036, 0x2019, 0x0001,
-	0x080c, 0x926b, 0x783f, 0x0000, 0x901e, 0x7b4e, 0x7b6a, 0x7b52,
+	0x080c, 0x9286, 0x783f, 0x0000, 0x901e, 0x7b4e, 0x7b6a, 0x7b52,
 	0x7b6e, 0x003e, 0x000e, 0x9005, 0x1118, 0x600c, 0x600f, 0x0000,
-	0x0006, 0x00e6, 0x2f70, 0x080c, 0x84f9, 0x00ee, 0x080c, 0xb82c,
+	0x0006, 0x00e6, 0x2f70, 0x080c, 0x8521, 0x00ee, 0x080c, 0xb847,
 	0x0520, 0x6014, 0x2048, 0x6020, 0x9086, 0x0003, 0x1580, 0x3e08,
 	0x918e, 0x0002, 0x1188, 0x6010, 0x9005, 0x0170, 0x00b6, 0x2058,
 	0xb800, 0x00be, 0xd0bc, 0x0140, 0x6048, 0x9005, 0x1198, 0x2001,
 	0x1959, 0x2004, 0x604a, 0x0070, 0xa867, 0x0103, 0xab7a, 0xa877,
-	0x0000, 0x080c, 0x6983, 0x080c, 0xba1b, 0x6044, 0xc0fc, 0x6046,
-	0x080c, 0x9c06, 0x000e, 0x0804, 0x85ab, 0x7e4a, 0x7e46, 0x012e,
+	0x0000, 0x080c, 0x698a, 0x080c, 0xba36, 0x6044, 0xc0fc, 0x6046,
+	0x080c, 0x9c21, 0x000e, 0x0804, 0x85d3, 0x7e4a, 0x7e46, 0x012e,
 	0x00fe, 0x00de, 0x00ce, 0x009e, 0x006e, 0x000e, 0x0005, 0x6020,
-	0x9086, 0x0006, 0x1118, 0x080c, 0xd1fc, 0x0c38, 0x6020, 0x9086,
+	0x9086, 0x0006, 0x1118, 0x080c, 0xd21e, 0x0c38, 0x6020, 0x9086,
 	0x000a, 0x09e0, 0x08c8, 0x0016, 0x0026, 0x0086, 0x9046, 0x00a9,
-	0x080c, 0x8704, 0x008e, 0x002e, 0x001e, 0x0005, 0x00f6, 0x0126,
-	0x2079, 0x19b8, 0x2091, 0x8000, 0x080c, 0x874d, 0x080c, 0x87e1,
-	0x080c, 0x63f6, 0x012e, 0x00fe, 0x0005, 0x00b6, 0x0096, 0x00f6,
+	0x080c, 0x872c, 0x008e, 0x002e, 0x001e, 0x0005, 0x00f6, 0x0126,
+	0x2079, 0x19b8, 0x2091, 0x8000, 0x080c, 0x8775, 0x080c, 0x8809,
+	0x080c, 0x63fd, 0x012e, 0x00fe, 0x0005, 0x00b6, 0x0096, 0x00f6,
 	0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0016, 0x0006, 0x0126, 0x2091,
 	0x8000, 0x2071, 0x19b8, 0x7620, 0x2660, 0x2678, 0x8cff, 0x0904,
-	0x86c9, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x86c4, 0x88ff,
-	0x0120, 0x605c, 0x9106, 0x1904, 0x86c4, 0x7030, 0x9c06, 0x1570,
-	0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508, 0x080c, 0x81e3, 0x080c,
-	0x8f9c, 0x68c3, 0x0000, 0x080c, 0x9487, 0x7033, 0x0000, 0x0036,
+	0x86f1, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x1904, 0x86ec, 0x88ff,
+	0x0120, 0x605c, 0x9106, 0x1904, 0x86ec, 0x7030, 0x9c06, 0x1570,
+	0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508, 0x080c, 0x820b, 0x080c,
+	0x8fb7, 0x68c3, 0x0000, 0x080c, 0x94a2, 0x7033, 0x0000, 0x0036,
 	0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100,
 	0x080c, 0x2833, 0x9006, 0x080c, 0x2833, 0x2069, 0x0100, 0x6824,
 	0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0040, 0x7008, 0xc0ad,
-	0x700a, 0x6003, 0x0009, 0x630a, 0x0804, 0x86c4, 0x7020, 0x9c36,
+	0x700a, 0x6003, 0x0009, 0x630a, 0x0804, 0x86ec, 0x7020, 0x9c36,
 	0x1110, 0x660c, 0x7622, 0x701c, 0x9c36, 0x1140, 0x2c00, 0x9f36,
 	0x0118, 0x2f00, 0x701e, 0x0010, 0x701f, 0x0000, 0x660c, 0x0066,
 	0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
-	0x6044, 0xc0fc, 0x6046, 0x6014, 0x2048, 0x080c, 0xb82c, 0x01e8,
-	0x6020, 0x9086, 0x0003, 0x1580, 0x080c, 0xba41, 0x1118, 0x080c,
-	0xa574, 0x0098, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016,
-	0x0036, 0x0086, 0x080c, 0xbb2a, 0x080c, 0xd4f8, 0x080c, 0x698f,
-	0x008e, 0x003e, 0x001e, 0x080c, 0xba1b, 0x080c, 0x9c06, 0x080c,
-	0x935d, 0x00ce, 0x0804, 0x863e, 0x2c78, 0x600c, 0x2060, 0x0804,
-	0x863e, 0x012e, 0x000e, 0x001e, 0x006e, 0x00ce, 0x00de, 0x00ee,
+	0x6044, 0xc0fc, 0x6046, 0x6014, 0x2048, 0x080c, 0xb847, 0x01e8,
+	0x6020, 0x9086, 0x0003, 0x1580, 0x080c, 0xba5c, 0x1118, 0x080c,
+	0xa58f, 0x0098, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016,
+	0x0036, 0x0086, 0x080c, 0xbb45, 0x080c, 0xd51a, 0x080c, 0x6996,
+	0x008e, 0x003e, 0x001e, 0x080c, 0xba36, 0x080c, 0x9c21, 0x080c,
+	0x9378, 0x00ce, 0x0804, 0x8666, 0x2c78, 0x600c, 0x2060, 0x0804,
+	0x8666, 0x012e, 0x000e, 0x001e, 0x006e, 0x00ce, 0x00de, 0x00ee,
 	0x00fe, 0x009e, 0x00be, 0x0005, 0x6020, 0x9086, 0x0006, 0x1158,
-	0x0016, 0x0036, 0x0086, 0x080c, 0xd4f8, 0x080c, 0xd1fc, 0x008e,
-	0x003e, 0x001e, 0x08d0, 0x080c, 0xa574, 0x6020, 0x9086, 0x0002,
-	0x1160, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0904, 0x86aa,
-	0x9086, 0x008b, 0x0904, 0x86aa, 0x0840, 0x6020, 0x9086, 0x0005,
+	0x0016, 0x0036, 0x0086, 0x080c, 0xd51a, 0x080c, 0xd21e, 0x008e,
+	0x003e, 0x001e, 0x08d0, 0x080c, 0xa58f, 0x6020, 0x9086, 0x0002,
+	0x1160, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0904, 0x86d2,
+	0x9086, 0x008b, 0x0904, 0x86d2, 0x0840, 0x6020, 0x9086, 0x0005,
 	0x1920, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x09c8, 0x9086,
-	0x008b, 0x09b0, 0x0804, 0x86bd, 0x0006, 0x00f6, 0x00e6, 0x0096,
+	0x008b, 0x09b0, 0x0804, 0x86e5, 0x0006, 0x00f6, 0x00e6, 0x0096,
 	0x00b6, 0x00c6, 0x0066, 0x0016, 0x0126, 0x2091, 0x8000, 0x9280,
 	0x1000, 0x2004, 0x905d, 0x2079, 0x19b8, 0x9036, 0x7828, 0x2060,
 	0x8cff, 0x0538, 0x6010, 0x9b06, 0x1500, 0x6043, 0xffff, 0x080c,
-	0x9a69, 0x01d8, 0x610c, 0x0016, 0x080c, 0x90f5, 0x6014, 0x2048,
+	0x9a84, 0x01d8, 0x610c, 0x0016, 0x080c, 0x9110, 0x6014, 0x2048,
 	0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x0016, 0x0036, 0x0086,
-	0x080c, 0xbb2a, 0x080c, 0xd4f8, 0x080c, 0x698f, 0x008e, 0x003e,
-	0x001e, 0x080c, 0x9c06, 0x00ce, 0x08d8, 0x2c30, 0x600c, 0x2060,
-	0x08b8, 0x080c, 0x6413, 0x012e, 0x001e, 0x006e, 0x00ce, 0x00be,
+	0x080c, 0xbb45, 0x080c, 0xd51a, 0x080c, 0x6996, 0x008e, 0x003e,
+	0x001e, 0x080c, 0x9c21, 0x00ce, 0x08d8, 0x2c30, 0x600c, 0x2060,
+	0x08b8, 0x080c, 0x641a, 0x012e, 0x001e, 0x006e, 0x00ce, 0x00be,
 	0x009e, 0x00ee, 0x00fe, 0x000e, 0x0005, 0x0096, 0x0006, 0x0066,
-	0x00c6, 0x00d6, 0x9036, 0x7820, 0x9065, 0x0904, 0x87b4, 0x600c,
+	0x00c6, 0x00d6, 0x9036, 0x7820, 0x9065, 0x0904, 0x87dc, 0x600c,
 	0x0006, 0x6044, 0xc0fc, 0x6046, 0x600f, 0x0000, 0x7830, 0x9c06,
-	0x1588, 0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508, 0x080c, 0x81e3,
-	0x080c, 0x8f9c, 0x68c3, 0x0000, 0x080c, 0x9487, 0x7833, 0x0000,
+	0x1588, 0x2069, 0x0100, 0x6820, 0xd0a4, 0x1508, 0x080c, 0x820b,
+	0x080c, 0x8fb7, 0x68c3, 0x0000, 0x080c, 0x94a2, 0x7833, 0x0000,
 	0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001,
 	0x0100, 0x080c, 0x2833, 0x9006, 0x080c, 0x2833, 0x2069, 0x0100,
 	0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x0058, 0x080c,
-	0x6616, 0x1538, 0x6003, 0x0009, 0x630a, 0x7808, 0xc0ad, 0x780a,
-	0x2c30, 0x00f8, 0x6014, 0x2048, 0x080c, 0xb82a, 0x01b0, 0x6020,
-	0x9086, 0x0003, 0x1508, 0x080c, 0xba41, 0x1118, 0x080c, 0xa574,
-	0x0060, 0x080c, 0x6616, 0x1168, 0xa867, 0x0103, 0xab7a, 0xa877,
-	0x0000, 0x080c, 0x698f, 0x080c, 0xba1b, 0x080c, 0x9c06, 0x080c,
-	0x935d, 0x000e, 0x0804, 0x8754, 0x7e22, 0x7e1e, 0x00de, 0x00ce,
+	0x661d, 0x1538, 0x6003, 0x0009, 0x630a, 0x7808, 0xc0ad, 0x780a,
+	0x2c30, 0x00f8, 0x6014, 0x2048, 0x080c, 0xb845, 0x01b0, 0x6020,
+	0x9086, 0x0003, 0x1508, 0x080c, 0xba5c, 0x1118, 0x080c, 0xa58f,
+	0x0060, 0x080c, 0x661d, 0x1168, 0xa867, 0x0103, 0xab7a, 0xa877,
+	0x0000, 0x080c, 0x6996, 0x080c, 0xba36, 0x080c, 0x9c21, 0x080c,
+	0x9378, 0x000e, 0x0804, 0x877c, 0x7e22, 0x7e1e, 0x00de, 0x00ce,
 	0x006e, 0x000e, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1118,
-	0x080c, 0xd1fc, 0x0c50, 0x080c, 0xa574, 0x6020, 0x9086, 0x0002,
+	0x080c, 0xd21e, 0x0c50, 0x080c, 0xa58f, 0x6020, 0x9086, 0x0002,
 	0x1150, 0x6004, 0x0006, 0x9086, 0x0085, 0x000e, 0x0990, 0x9086,
 	0x008b, 0x0978, 0x08d0, 0x6020, 0x9086, 0x0005, 0x19b0, 0x6004,
 	0x0006, 0x9086, 0x0085, 0x000e, 0x0d18, 0x9086, 0x008b, 0x0d00,
 	0x0860, 0x0006, 0x0096, 0x00b6, 0x00c6, 0x0066, 0x9036, 0x7828,
 	0x9065, 0x0510, 0x6010, 0x2058, 0x600c, 0x0006, 0x3e08, 0x918e,
 	0x0002, 0x1118, 0xb800, 0xd0bc, 0x11a8, 0x6043, 0xffff, 0x080c,
-	0x9a69, 0x0180, 0x610c, 0x080c, 0x90f5, 0x6014, 0x2048, 0xa867,
-	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x698f, 0x080c, 0x9c06,
+	0x9a84, 0x0180, 0x610c, 0x080c, 0x9110, 0x6014, 0x2048, 0xa867,
+	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6996, 0x080c, 0x9c21,
 	0x000e, 0x08f0, 0x2c30, 0x0ce0, 0x006e, 0x00ce, 0x00be, 0x009e,
-	0x000e, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x0066, 0x080c, 0x5dcf,
+	0x000e, 0x0005, 0x00e6, 0x00d6, 0x0096, 0x0066, 0x080c, 0x5dd6,
 	0x11b0, 0x2071, 0x19b8, 0x7030, 0x9080, 0x0005, 0x2004, 0x904d,
 	0x0170, 0xa878, 0x9606, 0x1158, 0x2071, 0x19b8, 0x7030, 0x9035,
 	0x0130, 0x9080, 0x0005, 0x2004, 0x9906, 0x1108, 0x0029, 0x006e,
 	0x009e, 0x00de, 0x00ee, 0x0005, 0x00c6, 0x2660, 0x6043, 0xffff,
-	0x080c, 0x9a69, 0x0178, 0x080c, 0x90f5, 0x6014, 0x2048, 0xa867,
-	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xbb2a, 0x080c, 0x698f,
-	0x080c, 0x9c06, 0x00ce, 0x0005, 0x00b6, 0x00e6, 0x00c6, 0x080c,
-	0x990b, 0x0106, 0x190c, 0x98ad, 0x2071, 0x0101, 0x2e04, 0xc0c4,
-	0x2072, 0x6044, 0xd0fc, 0x1138, 0x010e, 0x190c, 0x98c9, 0x00ce,
+	0x080c, 0x9a84, 0x0178, 0x080c, 0x9110, 0x6014, 0x2048, 0xa867,
+	0x0103, 0xab7a, 0xa877, 0x0000, 0x080c, 0xbb45, 0x080c, 0x6996,
+	0x080c, 0x9c21, 0x00ce, 0x0005, 0x00b6, 0x00e6, 0x00c6, 0x080c,
+	0x9926, 0x0106, 0x190c, 0x98c8, 0x2071, 0x0101, 0x2e04, 0xc0c4,
+	0x2072, 0x6044, 0xd0fc, 0x1138, 0x010e, 0x190c, 0x98e4, 0x00ce,
 	0x00ee, 0x00be, 0x0005, 0x2071, 0x19b8, 0x7030, 0x9005, 0x0da0,
-	0x9c06, 0x190c, 0x0d65, 0x7036, 0x080c, 0x81e3, 0x7004, 0x9084,
-	0x0007, 0x0002, 0x887c, 0x887e, 0x8885, 0x888f, 0x889d, 0x887c,
-	0x8885, 0x887a, 0x080c, 0x0d65, 0x0428, 0x0005, 0x080c, 0x9a54,
+	0x9c06, 0x190c, 0x0d65, 0x7036, 0x080c, 0x820b, 0x7004, 0x9084,
+	0x0007, 0x0002, 0x88a4, 0x88a6, 0x88ad, 0x88b7, 0x88c5, 0x88a4,
+	0x88ad, 0x88a2, 0x080c, 0x0d65, 0x0428, 0x0005, 0x080c, 0x9a6f,
 	0x7007, 0x0000, 0x7033, 0x0000, 0x00e8, 0x0066, 0x9036, 0x080c,
-	0x90f5, 0x006e, 0x7007, 0x0000, 0x7033, 0x0000, 0x0098, 0x080c,
-	0x9a3f, 0x0140, 0x080c, 0x9a54, 0x0128, 0x0066, 0x9036, 0x080c,
-	0x90f5, 0x006e, 0x7033, 0x0000, 0x0028, 0x080c, 0x9a3f, 0x080c,
-	0x9487, 0x0000, 0x010e, 0x190c, 0x98c9, 0x00ce, 0x00ee, 0x00be,
-	0x0005, 0x00d6, 0x00c6, 0x080c, 0x990b, 0x0106, 0x190c, 0x98ad,
-	0x6044, 0xd0fc, 0x1130, 0x010e, 0x190c, 0x98c9, 0x00ce, 0x00de,
+	0x9110, 0x006e, 0x7007, 0x0000, 0x7033, 0x0000, 0x0098, 0x080c,
+	0x9a5a, 0x0140, 0x080c, 0x9a6f, 0x0128, 0x0066, 0x9036, 0x080c,
+	0x9110, 0x006e, 0x7033, 0x0000, 0x0028, 0x080c, 0x9a5a, 0x080c,
+	0x94a2, 0x0000, 0x010e, 0x190c, 0x98e4, 0x00ce, 0x00ee, 0x00be,
+	0x0005, 0x00d6, 0x00c6, 0x080c, 0x9926, 0x0106, 0x190c, 0x98c8,
+	0x6044, 0xd0fc, 0x1130, 0x010e, 0x190c, 0x98e4, 0x00ce, 0x00de,
 	0x0005, 0x2069, 0x19b8, 0x684c, 0x9005, 0x0da8, 0x9c06, 0x190c,
-	0x0d65, 0x6852, 0x00e6, 0x2d70, 0x080c, 0x84f9, 0x00ee, 0x080c,
-	0x81f0, 0x0016, 0x2009, 0x0040, 0x080c, 0x2052, 0x001e, 0x683c,
-	0x9084, 0x0003, 0x0002, 0x88d9, 0x88da, 0x88f8, 0x88d7, 0x080c,
+	0x0d65, 0x6852, 0x00e6, 0x2d70, 0x080c, 0x8521, 0x00ee, 0x080c,
+	0x8218, 0x0016, 0x2009, 0x0040, 0x080c, 0x2052, 0x001e, 0x683c,
+	0x9084, 0x0003, 0x0002, 0x8901, 0x8902, 0x8920, 0x88ff, 0x080c,
 	0x0d65, 0x0460, 0x6868, 0x9086, 0x0001, 0x0190, 0x600c, 0x9015,
 	0x0160, 0x6a4a, 0x600f, 0x0000, 0x6044, 0xc0fc, 0x6046, 0x9006,
 	0x7042, 0x684e, 0x683f, 0x0000, 0x00c8, 0x684a, 0x6846, 0x0ca0,
 	0x686b, 0x0000, 0x6848, 0x9065, 0x0d78, 0x6003, 0x0002, 0x0c60,
 	0x9006, 0x686a, 0x6852, 0x686e, 0x600c, 0x9015, 0x0120, 0x6a4a,
 	0x600f, 0x0000, 0x0018, 0x684e, 0x684a, 0x6846, 0x684f, 0x0000,
-	0x010e, 0x190c, 0x98c9, 0x00ce, 0x00de, 0x0005, 0x0005, 0x6020,
-	0x9084, 0x000f, 0x000b, 0x0005, 0x8924, 0x8927, 0x8d80, 0x8e0f,
-	0x8927, 0x8d80, 0x8e0f, 0x8924, 0x8927, 0x8924, 0x8924, 0x8924,
-	0x8924, 0x8924, 0x8924, 0x8924, 0x080c, 0x884c, 0x0005, 0x00b6,
+	0x010e, 0x190c, 0x98e4, 0x00ce, 0x00de, 0x0005, 0x0005, 0x6020,
+	0x9084, 0x000f, 0x000b, 0x0005, 0x894c, 0x894f, 0x8da8, 0x8e37,
+	0x894f, 0x8da8, 0x8e37, 0x894c, 0x894f, 0x894c, 0x894c, 0x894c,
+	0x894c, 0x894c, 0x894c, 0x894c, 0x080c, 0x8874, 0x0005, 0x00b6,
 	0x0156, 0x0136, 0x0146, 0x01c6, 0x01d6, 0x00c6, 0x00d6, 0x00e6,
 	0x00f6, 0x2069, 0x0200, 0x2071, 0x0240, 0x6004, 0x908a, 0x0053,
 	0x1a0c, 0x0d65, 0x6110, 0x2158, 0xb984, 0x2c78, 0x2061, 0x0100,
-	0x619a, 0x908a, 0x0040, 0x1a04, 0x8993, 0x005b, 0x00fe, 0x00ee,
+	0x619a, 0x908a, 0x0040, 0x1a04, 0x89bb, 0x005b, 0x00fe, 0x00ee,
 	0x00de, 0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be,
-	0x0005, 0x8b0a, 0x8b45, 0x8b6e, 0x8c11, 0x8c32, 0x8c38, 0x8c45,
-	0x8c4d, 0x8c59, 0x8c5f, 0x8c70, 0x8c5f, 0x8cc7, 0x8c4d, 0x8cd3,
-	0x8cd9, 0x8c59, 0x8cd9, 0x8ce5, 0x8991, 0x8991, 0x8991, 0x8991,
-	0x8991, 0x8991, 0x8991, 0x8991, 0x8991, 0x8991, 0x8991, 0x9116,
-	0x9139, 0x914a, 0x916a, 0x919c, 0x8c45, 0x8991, 0x8c45, 0x8c5f,
-	0x8991, 0x8b6e, 0x8c11, 0x8991, 0x957a, 0x8c5f, 0x8991, 0x9596,
-	0x8c5f, 0x8991, 0x8c59, 0x8b04, 0x89b4, 0x8991, 0x95b2, 0x961f,
-	0x96ff, 0x8991, 0x970c, 0x8c42, 0x9737, 0x8991, 0x91a6, 0x9743,
-	0x8991, 0x080c, 0x0d65, 0x2100, 0x005b, 0x00fe, 0x00ee, 0x00de,
+	0x0005, 0x8b32, 0x8b6d, 0x8b96, 0x8c39, 0x8c5a, 0x8c60, 0x8c6d,
+	0x8c75, 0x8c81, 0x8c87, 0x8c98, 0x8c87, 0x8cef, 0x8c75, 0x8cfb,
+	0x8d01, 0x8c81, 0x8d01, 0x8d0d, 0x89b9, 0x89b9, 0x89b9, 0x89b9,
+	0x89b9, 0x89b9, 0x89b9, 0x89b9, 0x89b9, 0x89b9, 0x89b9, 0x9131,
+	0x9154, 0x9165, 0x9185, 0x91b7, 0x8c6d, 0x89b9, 0x8c6d, 0x8c87,
+	0x89b9, 0x8b96, 0x8c39, 0x89b9, 0x9595, 0x8c87, 0x89b9, 0x95b1,
+	0x8c87, 0x89b9, 0x8c81, 0x8b2c, 0x89dc, 0x89b9, 0x95cd, 0x963a,
+	0x971a, 0x89b9, 0x9727, 0x8c6a, 0x9752, 0x89b9, 0x91c1, 0x975e,
+	0x89b9, 0x080c, 0x0d65, 0x2100, 0x005b, 0x00fe, 0x00ee, 0x00de,
 	0x00ce, 0x01de, 0x01ce, 0x014e, 0x013e, 0x015e, 0x00be, 0x0005,
-	0x89b2, 0x89b2, 0x89b2, 0x89db, 0x8a87, 0x8a92, 0x89b2, 0x89b2,
-	0x89b2, 0x8ad9, 0x8ae5, 0x89f6, 0x89b2, 0x8a11, 0x8a45, 0x9abf,
-	0x9b04, 0x8c5f, 0x080c, 0x0d65, 0x00d6, 0x0096, 0x080c, 0x8cf8,
+	0x89da, 0x89da, 0x89da, 0x8a03, 0x8aaf, 0x8aba, 0x89da, 0x89da,
+	0x89da, 0x8b01, 0x8b0d, 0x8a1e, 0x89da, 0x8a39, 0x8a6d, 0x9ada,
+	0x9b1f, 0x8c87, 0x080c, 0x0d65, 0x00d6, 0x0096, 0x080c, 0x8d20,
 	0x7003, 0x2414, 0x7007, 0x0018, 0x700b, 0x0800, 0x7814, 0x2048,
 	0xa83c, 0x700e, 0xa850, 0x7022, 0xa854, 0x7026, 0x60c3, 0x0018,
-	0x080c, 0x8f6c, 0x009e, 0x00de, 0x0005, 0x7810, 0x00b6, 0x2058,
-	0xb8a0, 0x00be, 0x080c, 0x9b4b, 0x1118, 0x9084, 0xff80, 0x0110,
-	0x9085, 0x0001, 0x0005, 0x00d6, 0x0096, 0x080c, 0x8cf8, 0x7003,
+	0x080c, 0x8f87, 0x009e, 0x00de, 0x0005, 0x7810, 0x00b6, 0x2058,
+	0xb8a0, 0x00be, 0x080c, 0x9b66, 0x1118, 0x9084, 0xff80, 0x0110,
+	0x9085, 0x0001, 0x0005, 0x00d6, 0x0096, 0x080c, 0x8d20, 0x7003,
 	0x0500, 0x7814, 0x2048, 0xa874, 0x700a, 0xa878, 0x700e, 0xa87c,
 	0x7012, 0xa880, 0x7016, 0xa884, 0x701a, 0xa888, 0x701e, 0x60c3,
-	0x0010, 0x080c, 0x8f6c, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096,
-	0x080c, 0x8cf8, 0x7003, 0x0500, 0x7814, 0x2048, 0xa8cc, 0x700a,
+	0x0010, 0x080c, 0x8f87, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096,
+	0x080c, 0x8d20, 0x7003, 0x0500, 0x7814, 0x2048, 0xa8cc, 0x700a,
 	0xa8d0, 0x700e, 0xa8d4, 0x7012, 0xa8d8, 0x7016, 0xa8dc, 0x701a,
-	0xa8e0, 0x701e, 0x60c3, 0x0010, 0x080c, 0x8f6c, 0x009e, 0x00de,
-	0x0005, 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x8cf8,
+	0xa8e0, 0x701e, 0x60c3, 0x0010, 0x080c, 0x8f87, 0x009e, 0x00de,
+	0x0005, 0x00d6, 0x0096, 0x0126, 0x2091, 0x8000, 0x080c, 0x8d20,
 	0x20e9, 0x0000, 0x2001, 0x1974, 0x2003, 0x0000, 0x7814, 0x2048,
 	0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c,
 	0x9080, 0x001b, 0x2098, 0x2001, 0x1974, 0x0016, 0x200c, 0x2001,
-	0x0001, 0x080c, 0x2037, 0x080c, 0xc575, 0x9006, 0x080c, 0x2037,
+	0x0001, 0x080c, 0x2037, 0x080c, 0xc591, 0x9006, 0x080c, 0x2037,
 	0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c28, 0x04d9, 0x080c,
-	0x8f6c, 0x012e, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x8d43, 0x20e9, 0x0000, 0x2001, 0x1974,
+	0x8f87, 0x012e, 0x009e, 0x00de, 0x0005, 0x00d6, 0x0096, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x8d6b, 0x20e9, 0x0000, 0x2001, 0x1974,
 	0x2003, 0x0000, 0x7814, 0x2048, 0xa86f, 0x0200, 0xa873, 0x0000,
 	0xa814, 0x8003, 0x60c2, 0xa830, 0x20a8, 0xa860, 0x20e0, 0xa85c,
 	0x9080, 0x001b, 0x2098, 0x2001, 0x1974, 0x0016, 0x200c, 0x080c,
-	0xc575, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c60, 0x0051,
-	0x7814, 0x2048, 0x080c, 0x0fd4, 0x080c, 0x8f6c, 0x012e, 0x009e,
+	0xc591, 0x001e, 0xa804, 0x9005, 0x0110, 0x2048, 0x0c60, 0x0051,
+	0x7814, 0x2048, 0x080c, 0x0fd4, 0x080c, 0x8f87, 0x012e, 0x009e,
 	0x00de, 0x0005, 0x60c0, 0x8004, 0x9084, 0x0003, 0x9005, 0x0130,
 	0x9082, 0x0004, 0x20a3, 0x0000, 0x8000, 0x1de0, 0x0005, 0x080c,
-	0x8cf8, 0x7003, 0x7800, 0x7808, 0x8007, 0x700a, 0x60c3, 0x0008,
-	0x0804, 0x8f6c, 0x00d6, 0x00e6, 0x080c, 0x8d43, 0x7814, 0x9084,
+	0x8d20, 0x7003, 0x7800, 0x7808, 0x8007, 0x700a, 0x60c3, 0x0008,
+	0x0804, 0x8f87, 0x00d6, 0x00e6, 0x080c, 0x8d6b, 0x7814, 0x9084,
 	0xff00, 0x2073, 0x0200, 0x8e70, 0x8e70, 0x9095, 0x0010, 0x2272,
 	0x8e70, 0x2073, 0x0034, 0x8e70, 0x2069, 0x1805, 0x20a9, 0x0004,
-	0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x8aa8, 0x2069, 0x1801, 0x20a9,
-	0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x8ab1, 0x2069, 0x1984,
+	0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x8ad0, 0x2069, 0x1801, 0x20a9,
+	0x0004, 0x2d76, 0x8d68, 0x8e70, 0x1f04, 0x8ad9, 0x2069, 0x1984,
 	0x9086, 0xdf00, 0x0110, 0x2069, 0x199e, 0x20a9, 0x001a, 0x9e86,
 	0x0260, 0x1148, 0x00c6, 0x2061, 0x0200, 0x6010, 0x8000, 0x6012,
 	0x00ce, 0x2071, 0x0240, 0x2d04, 0x8007, 0x2072, 0x8d68, 0x8e70,
-	0x1f04, 0x8abf, 0x60c3, 0x004c, 0x080c, 0x8f6c, 0x00ee, 0x00de,
-	0x0005, 0x080c, 0x8cf8, 0x7003, 0x6300, 0x7007, 0x0028, 0x7808,
-	0x700e, 0x60c3, 0x0008, 0x0804, 0x8f6c, 0x00d6, 0x0026, 0x0016,
-	0x080c, 0x8d43, 0x7003, 0x0200, 0x7814, 0x700e, 0x00e6, 0x9ef0,
+	0x1f04, 0x8ae7, 0x60c3, 0x004c, 0x080c, 0x8f87, 0x00ee, 0x00de,
+	0x0005, 0x080c, 0x8d20, 0x7003, 0x6300, 0x7007, 0x0028, 0x7808,
+	0x700e, 0x60c3, 0x0008, 0x0804, 0x8f87, 0x00d6, 0x0026, 0x0016,
+	0x080c, 0x8d6b, 0x7003, 0x0200, 0x7814, 0x700e, 0x00e6, 0x9ef0,
 	0x0004, 0x2009, 0x0001, 0x2011, 0x000c, 0x2073, 0x0800, 0x8e70,
-	0x2073, 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0x8f6c,
+	0x2073, 0x0000, 0x00ee, 0x7206, 0x710a, 0x62c2, 0x080c, 0x8f87,
 	0x001e, 0x002e, 0x00de, 0x0005, 0x2001, 0x1817, 0x2004, 0x609a,
-	0x0804, 0x8f6c, 0x080c, 0x8cf8, 0x7003, 0x5200, 0x2069, 0x1853,
+	0x0804, 0x8f87, 0x080c, 0x8d20, 0x7003, 0x5200, 0x2069, 0x1853,
 	0x6804, 0xd084, 0x0130, 0x6828, 0x0016, 0x080c, 0x2457, 0x710e,
 	0x001e, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9,
 	0x0000, 0x20a1, 0x0250, 0x4003, 0x20a9, 0x0004, 0x2099, 0x1801,
-	0x20a1, 0x0254, 0x4003, 0x080c, 0x9b4b, 0x1120, 0xb8a0, 0x9082,
+	0x20a1, 0x0254, 0x4003, 0x080c, 0x9b66, 0x1120, 0xb8a0, 0x9082,
 	0x007f, 0x0248, 0x2001, 0x181e, 0x2004, 0x7032, 0x2001, 0x181f,
 	0x2004, 0x7036, 0x0030, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff,
-	0x7036, 0x60c3, 0x001c, 0x0804, 0x8f6c, 0x080c, 0x8cf8, 0x7003,
-	0x0500, 0x080c, 0x9b4b, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
+	0x7036, 0x60c3, 0x001c, 0x0804, 0x8f87, 0x080c, 0x8d20, 0x7003,
+	0x0500, 0x080c, 0x9b66, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248,
 	0x2001, 0x181e, 0x2004, 0x700a, 0x2001, 0x181f, 0x2004, 0x700e,
 	0x0030, 0x2001, 0x1817, 0x2004, 0x9084, 0x00ff, 0x700e, 0x20a9,
 	0x0004, 0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1,
-	0x0250, 0x4003, 0x60c3, 0x0010, 0x0804, 0x8f6c, 0x080c, 0x8cf8,
-	0x9006, 0x080c, 0x662a, 0xb8a0, 0x9086, 0x007e, 0x1130, 0x7003,
+	0x0250, 0x4003, 0x60c3, 0x0010, 0x0804, 0x8f87, 0x080c, 0x8d20,
+	0x9006, 0x080c, 0x6631, 0xb8a0, 0x9086, 0x007e, 0x1130, 0x7003,
 	0x0400, 0x620c, 0xc2b4, 0x620e, 0x0058, 0x7814, 0x0096, 0x904d,
 	0x0120, 0x9006, 0xa89a, 0xa8a6, 0xa8aa, 0x009e, 0x7003, 0x0300,
-	0xb8a0, 0x9086, 0x007e, 0x1904, 0x8bd9, 0x00d6, 0x2069, 0x193d,
+	0xb8a0, 0x9086, 0x007e, 0x1904, 0x8c01, 0x00d6, 0x2069, 0x193d,
 	0x2001, 0x1836, 0x2004, 0xd0a4, 0x0178, 0x6800, 0x700a, 0x6808,
 	0x9084, 0x2000, 0x7012, 0x680c, 0x7016, 0x701f, 0x2710, 0x6818,
 	0x7022, 0x681c, 0x7026, 0x0080, 0x6800, 0x700a, 0x6804, 0x700e,
-	0x6808, 0x080c, 0x70ac, 0x1118, 0x9084, 0x37ff, 0x0010, 0x9084,
+	0x6808, 0x080c, 0x70b7, 0x1118, 0x9084, 0x37ff, 0x0010, 0x9084,
 	0x3fff, 0x7012, 0x680c, 0x7016, 0x00de, 0x20a9, 0x0004, 0x20e1,
 	0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003,
 	0x20a9, 0x0004, 0x2099, 0x1801, 0x20a1, 0x025a, 0x4003, 0x00d6,
-	0x080c, 0x97ca, 0x2069, 0x1945, 0x2071, 0x024e, 0x6800, 0xc0dd,
-	0x7002, 0x080c, 0x538a, 0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de,
+	0x080c, 0x97e5, 0x2069, 0x1945, 0x2071, 0x024e, 0x6800, 0xc0dd,
+	0x7002, 0x080c, 0x5391, 0xd0e4, 0x0110, 0x680c, 0x700e, 0x00de,
 	0x04a0, 0x2001, 0x1836, 0x2004, 0xd0a4, 0x0168, 0x0016, 0x2009,
 	0x0002, 0x60e0, 0x9106, 0x0130, 0x2100, 0x60e3, 0x0000, 0x080c,
 	0x2498, 0x61e2, 0x001e, 0x20e1, 0x0001, 0x2099, 0x193d, 0x20e9,
 	0x0000, 0x20a1, 0x024e, 0x20a9, 0x0008, 0x4003, 0x20a9, 0x0004,
 	0x2099, 0x1805, 0x20a1, 0x0256, 0x4003, 0x20a9, 0x0004, 0x2099,
-	0x1801, 0x20a1, 0x025a, 0x4003, 0x080c, 0x97ca, 0x20a1, 0x024e,
+	0x1801, 0x20a1, 0x025a, 0x4003, 0x080c, 0x97e5, 0x20a1, 0x024e,
 	0x20a9, 0x0008, 0x2099, 0x1945, 0x4003, 0x60c3, 0x0074, 0x0804,
-	0x8f6c, 0x080c, 0x8cf8, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b,
+	0x8f87, 0x080c, 0x8d20, 0x7003, 0x2010, 0x7007, 0x0014, 0x700b,
 	0x0800, 0x700f, 0x2000, 0x9006, 0x00f6, 0x2079, 0x1853, 0x7904,
 	0x00fe, 0xd1ac, 0x1110, 0x9085, 0x0020, 0x0010, 0x9085, 0x0010,
-	0x9085, 0x0002, 0x00d6, 0x0804, 0x8ca8, 0x7026, 0x60c3, 0x0014,
-	0x0804, 0x8f6c, 0x080c, 0x8cf8, 0x7003, 0x5000, 0x0804, 0x8b88,
-	0x080c, 0x8cf8, 0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014,
-	0x0804, 0x8f6c, 0x080c, 0x8d3a, 0x0010, 0x080c, 0x8d43, 0x7003,
-	0x0200, 0x60c3, 0x0004, 0x0804, 0x8f6c, 0x080c, 0x8d43, 0x7003,
+	0x9085, 0x0002, 0x00d6, 0x0804, 0x8cd0, 0x7026, 0x60c3, 0x0014,
+	0x0804, 0x8f87, 0x080c, 0x8d20, 0x7003, 0x5000, 0x0804, 0x8bb0,
+	0x080c, 0x8d20, 0x7003, 0x2110, 0x7007, 0x0014, 0x60c3, 0x0014,
+	0x0804, 0x8f87, 0x080c, 0x8d62, 0x0010, 0x080c, 0x8d6b, 0x7003,
+	0x0200, 0x60c3, 0x0004, 0x0804, 0x8f87, 0x080c, 0x8d6b, 0x7003,
 	0x0100, 0x700b, 0x0003, 0x700f, 0x2a00, 0x60c3, 0x0008, 0x0804,
-	0x8f6c, 0x080c, 0x8d43, 0x7003, 0x0200, 0x0804, 0x8b88, 0x080c,
-	0x8d43, 0x7003, 0x0100, 0x782c, 0x9005, 0x0110, 0x700a, 0x0010,
-	0x700b, 0x0003, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x8f6c,
-	0x00d6, 0x080c, 0x8d43, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b,
+	0x8f87, 0x080c, 0x8d6b, 0x7003, 0x0200, 0x0804, 0x8bb0, 0x080c,
+	0x8d6b, 0x7003, 0x0100, 0x782c, 0x9005, 0x0110, 0x700a, 0x0010,
+	0x700b, 0x0003, 0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x8f87,
+	0x00d6, 0x080c, 0x8d6b, 0x7003, 0x0210, 0x7007, 0x0014, 0x700b,
 	0x0800, 0xb894, 0x9086, 0x0014, 0x1198, 0xb99c, 0x9184, 0x0030,
 	0x0190, 0xb998, 0x9184, 0xc000, 0x1140, 0xd1ec, 0x0118, 0x700f,
 	0x2100, 0x0058, 0x700f, 0x0100, 0x0040, 0x700f, 0x0400, 0x0028,
@@ -4298,2359 +4303,2358 @@
 	0x0026, 0x2009, 0x1873, 0x210c, 0xd1e4, 0x0150, 0xc0c5, 0xbac4,
 	0xd28c, 0x1108, 0xc0cd, 0x9094, 0x0030, 0x9296, 0x0010, 0x0140,
 	0xd1ec, 0x0130, 0x9094, 0x0030, 0x9296, 0x0010, 0x0108, 0xc0bd,
-	0x002e, 0x7026, 0x60c3, 0x0014, 0x00de, 0x0804, 0x8f6c, 0x080c,
-	0x8d43, 0x7003, 0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3,
-	0x0014, 0x0804, 0x8f6c, 0x080c, 0x8d43, 0x7003, 0x0200, 0x0804,
-	0x8b0e, 0x080c, 0x8d43, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f,
-	0x2a00, 0x60c3, 0x0008, 0x0804, 0x8f6c, 0x080c, 0x8d43, 0x7003,
-	0x0100, 0x700b, 0x000b, 0x60c3, 0x0008, 0x0804, 0x8f6c, 0x0026,
+	0x002e, 0x7026, 0x60c3, 0x0014, 0x00de, 0x0804, 0x8f87, 0x080c,
+	0x8d6b, 0x7003, 0x0210, 0x7007, 0x0014, 0x700f, 0x0100, 0x60c3,
+	0x0014, 0x0804, 0x8f87, 0x080c, 0x8d6b, 0x7003, 0x0200, 0x0804,
+	0x8b36, 0x080c, 0x8d6b, 0x7003, 0x0100, 0x700b, 0x0003, 0x700f,
+	0x2a00, 0x60c3, 0x0008, 0x0804, 0x8f87, 0x080c, 0x8d6b, 0x7003,
+	0x0100, 0x700b, 0x000b, 0x60c3, 0x0008, 0x0804, 0x8f87, 0x0026,
 	0x00d6, 0x0036, 0x0046, 0x2019, 0x3200, 0x2021, 0x0800, 0x0040,
 	0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x2200, 0x2021, 0x0100,
-	0x080c, 0x97df, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069,
+	0x080c, 0x97fa, 0xb810, 0x9305, 0x7002, 0xb814, 0x7006, 0x2069,
 	0x1800, 0x6878, 0x700a, 0x687c, 0x700e, 0x9485, 0x0029, 0x7012,
-	0x004e, 0x003e, 0x00de, 0x080c, 0x8f60, 0x721a, 0x9f95, 0x0000,
+	0x004e, 0x003e, 0x00de, 0x080c, 0x8f7b, 0x721a, 0x9f95, 0x0000,
 	0x7222, 0x7027, 0xffff, 0x2071, 0x024c, 0x002e, 0x0005, 0x0026,
-	0x080c, 0x97df, 0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069,
+	0x080c, 0x97fa, 0x7003, 0x02ff, 0x7007, 0xfffc, 0x00d6, 0x2069,
 	0x1800, 0x6878, 0x700a, 0x687c, 0x700e, 0x00de, 0x7013, 0x2029,
 	0x0c10, 0x7003, 0x0100, 0x7007, 0x0000, 0x700b, 0xfc02, 0x700f,
 	0x0000, 0x0005, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019, 0x3300,
 	0x2021, 0x0800, 0x0040, 0x0026, 0x00d6, 0x0036, 0x0046, 0x2019,
-	0x2300, 0x2021, 0x0100, 0x080c, 0x97df, 0xb810, 0x9305, 0x7002,
+	0x2300, 0x2021, 0x0100, 0x080c, 0x97fa, 0xb810, 0x9305, 0x7002,
 	0xb814, 0x7006, 0x2069, 0x1800, 0xb810, 0x9005, 0x1140, 0xb814,
 	0x9005, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0020, 0x6878,
 	0x700a, 0x687c, 0x700e, 0x0000, 0x9485, 0x0098, 0x7012, 0x004e,
-	0x003e, 0x00de, 0x080c, 0x8f60, 0x721a, 0x7a08, 0x7222, 0x2f10,
-	0x7226, 0x2071, 0x024c, 0x002e, 0x0005, 0x080c, 0x8f60, 0x721a,
+	0x003e, 0x00de, 0x080c, 0x8f7b, 0x721a, 0x7a08, 0x7222, 0x2f10,
+	0x7226, 0x2071, 0x024c, 0x002e, 0x0005, 0x080c, 0x8f7b, 0x721a,
 	0x7a08, 0x7222, 0x7814, 0x7026, 0x2071, 0x024c, 0x002e, 0x0005,
 	0x00b6, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2069, 0x0200, 0x2071,
 	0x0240, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0d65, 0x908a, 0x0092,
 	0x1a0c, 0x0d65, 0x6110, 0x2158, 0xb984, 0x2c78, 0x2061, 0x0100,
 	0x619a, 0x9082, 0x0085, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce,
-	0x00be, 0x0005, 0x8db1, 0x8dc0, 0x8dcb, 0x8daf, 0x8daf, 0x8daf,
-	0x8db1, 0x8daf, 0x8daf, 0x8daf, 0x8daf, 0x8daf, 0x8daf, 0x080c,
+	0x00be, 0x0005, 0x8dd9, 0x8de8, 0x8df3, 0x8dd7, 0x8dd7, 0x8dd7,
+	0x8dd9, 0x8dd7, 0x8dd7, 0x8dd7, 0x8dd7, 0x8dd7, 0x8dd7, 0x080c,
 	0x0d65, 0x0411, 0x60c3, 0x0000, 0x0026, 0x080c, 0x27a2, 0x0228,
-	0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0x8f6c,
+	0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x0804, 0x8f87,
 	0x0431, 0x7808, 0x700a, 0x7814, 0x700e, 0x7017, 0xffff, 0x60c3,
-	0x000c, 0x0804, 0x8f6c, 0x0479, 0x7003, 0x0003, 0x7007, 0x0300,
-	0x60c3, 0x0004, 0x0804, 0x8f6c, 0x0026, 0x080c, 0x97df, 0xb810,
+	0x000c, 0x0804, 0x8f87, 0x0479, 0x7003, 0x0003, 0x7007, 0x0300,
+	0x60c3, 0x0004, 0x0804, 0x8f87, 0x0026, 0x080c, 0x97fa, 0xb810,
 	0x9085, 0x8100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6878,
-	0x700a, 0x687c, 0x700e, 0x7013, 0x0009, 0x0804, 0x8d13, 0x0026,
-	0x080c, 0x97df, 0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006,
+	0x700a, 0x687c, 0x700e, 0x7013, 0x0009, 0x0804, 0x8d3b, 0x0026,
+	0x080c, 0x97fa, 0xb810, 0x9085, 0x8400, 0x7002, 0xb814, 0x7006,
 	0x2069, 0x1800, 0x6878, 0x700a, 0x687c, 0x700e, 0x2001, 0x0099,
-	0x7012, 0x0804, 0x8d75, 0x0026, 0x080c, 0x97df, 0xb810, 0x9085,
+	0x7012, 0x0804, 0x8d9d, 0x0026, 0x080c, 0x97fa, 0xb810, 0x9085,
 	0x8500, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6878, 0x700a,
-	0x687c, 0x700e, 0x2001, 0x0099, 0x7012, 0x0804, 0x8d75, 0x00b6,
+	0x687c, 0x700e, 0x2001, 0x0099, 0x7012, 0x0804, 0x8d9d, 0x00b6,
 	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2c78, 0x2069, 0x0200, 0x2071,
 	0x0240, 0x7804, 0x908a, 0x0040, 0x0a0c, 0x0d65, 0x908a, 0x0057,
 	0x1a0c, 0x0d65, 0x7910, 0x2158, 0xb984, 0x2061, 0x0100, 0x619a,
 	0x9082, 0x0040, 0x0033, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x00be,
-	0x0005, 0x8e44, 0x8e44, 0x8e44, 0x8e68, 0x8e44, 0x8e44, 0x8e44,
-	0x8e44, 0x8e44, 0x8e44, 0x8e44, 0x933a, 0x9342, 0x934a, 0x9352,
-	0x8e44, 0x8e44, 0x8e44, 0x9332, 0x080c, 0x0d65, 0x6813, 0x0008,
+	0x0005, 0x8e6c, 0x8e6c, 0x8e6c, 0x8e92, 0x8e6c, 0x8e6c, 0x8e6c,
+	0x8e6c, 0x8e6c, 0x8e6c, 0x8e6c, 0x9355, 0x935d, 0x9365, 0x936d,
+	0x8e6c, 0x8e6c, 0x8e6c, 0x934d, 0x080c, 0x0d65, 0x6813, 0x0008,
 	0xba8c, 0x8210, 0xb8c4, 0xd084, 0x0128, 0x7a4e, 0x7b14, 0x7b52,
 	0x722e, 0x732a, 0x9294, 0x00ff, 0xba8e, 0x8217, 0x721a, 0xba10,
-	0x9295, 0x0600, 0x7202, 0xba14, 0x7206, 0x6a78, 0x720a, 0x6a7c,
-	0x720e, 0x7013, 0x0829, 0x2f10, 0x7222, 0x7027, 0xffff, 0x0005,
-	0x0016, 0x7814, 0x9084, 0x0700, 0x8007, 0x0013, 0x001e, 0x0005,
-	0x8e78, 0x8e78, 0x8e7a, 0x8e78, 0x8e78, 0x8e78, 0x8e94, 0x8e78,
-	0x080c, 0x0d65, 0x7914, 0x918c, 0x08ff, 0x918d, 0xf600, 0x7916,
-	0x2009, 0x0003, 0x00b9, 0x2069, 0x1853, 0x6804, 0xd0bc, 0x0130,
-	0x682c, 0x9084, 0x00ff, 0x8007, 0x7032, 0x0010, 0x7033, 0x3f00,
-	0x60c3, 0x0001, 0x0804, 0x8f6c, 0x2009, 0x0003, 0x0019, 0x7033,
-	0x7f00, 0x0cb0, 0x0016, 0x080c, 0x97df, 0x001e, 0xb810, 0x9085,
-	0x0100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800, 0x6a78, 0x720a,
-	0x6a7c, 0x720e, 0x7013, 0x0888, 0x918d, 0x0008, 0x7116, 0x080c,
-	0x8f60, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226, 0x0005, 0x00b6,
-	0x0096, 0x00e6, 0x00d6, 0x00c6, 0x0056, 0x0046, 0x0036, 0x2061,
-	0x0100, 0x2071, 0x1800, 0x7810, 0x2058, 0xb8a0, 0x2028, 0xb910,
-	0xba14, 0x7378, 0x747c, 0x7820, 0x0002, 0x8edc, 0x8edc, 0x8edc,
-	0x8edc, 0x8edc, 0x8edc, 0x8edc, 0x8edc, 0x8edc, 0x8edc, 0x8ede,
-	0x8edc, 0x8edc, 0x8edc, 0x8edc, 0x080c, 0x0d65, 0x609f, 0x0000,
-	0x7814, 0x2048, 0xa87c, 0xd0fc, 0x05d0, 0xaf90, 0x9784, 0xff00,
-	0x9105, 0x6062, 0x873f, 0x9784, 0xff00, 0x0006, 0x7814, 0x2048,
-	0xa878, 0xc0fc, 0x9005, 0x000e, 0x1160, 0xaf94, 0x87ff, 0x0510,
-	0x2039, 0x0098, 0x9705, 0x6072, 0x7808, 0x6082, 0x2f00, 0x6086,
-	0x0038, 0x9185, 0x2200, 0x6062, 0x6073, 0x0129, 0x6077, 0x0000,
-	0x609f, 0x0000, 0x2001, 0x1836, 0x2004, 0xd0ac, 0x11a8, 0xd09c,
-	0x0130, 0x7814, 0x2048, 0xa874, 0x9082, 0x0080, 0x1268, 0xb814,
-	0x609e, 0x0050, 0x2039, 0x0029, 0x9705, 0x6072, 0x0c48, 0x9185,
-	0x0200, 0x6062, 0x6073, 0x2029, 0xa87c, 0xd0fc, 0x0118, 0xaf94,
-	0x87ff, 0x1120, 0x2f00, 0x6082, 0x7808, 0x6086, 0x6266, 0x636a,
-	0x646e, 0x6077, 0x0000, 0xb88c, 0x8000, 0x9084, 0x00ff, 0xb88e,
-	0x8007, 0x607a, 0x607f, 0x0000, 0xa848, 0x608a, 0xa844, 0x608e,
-	0xa838, 0x60c6, 0xa834, 0x60ca, 0xb86c, 0x60ce, 0x60af, 0x95d5,
-	0x60d7, 0x0000, 0x080c, 0x97bf, 0x2009, 0x07d0, 0x60c4, 0x9084,
-	0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58, 0x080c, 0x81e8, 0x003e,
-	0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee, 0x009e, 0x00be, 0x0005,
-	0x7a40, 0x9294, 0x00ff, 0x8217, 0x0005, 0x00d6, 0x2069, 0x19b8,
-	0x686b, 0x0001, 0x00de, 0x0005, 0x60a3, 0x0056, 0x60a7, 0x9575,
-	0x00f1, 0x080c, 0x81da, 0x0005, 0x0016, 0x2001, 0x180c, 0x200c,
-	0x9184, 0x0600, 0x9086, 0x0600, 0x0128, 0x0089, 0x080c, 0x81da,
-	0x001e, 0x0005, 0xc1e5, 0x2001, 0x180c, 0x2102, 0x2001, 0x19b9,
-	0x2003, 0x0000, 0x2001, 0x19c4, 0x2003, 0x0000, 0x0c88, 0x0006,
-	0x0016, 0x0026, 0x2009, 0x1804, 0x2011, 0x0009, 0x080c, 0x287c,
-	0x002e, 0x001e, 0x000e, 0x0005, 0x0016, 0x00c6, 0x0006, 0x080c,
-	0x990b, 0x0106, 0x190c, 0x98ad, 0x2061, 0x0100, 0x61a4, 0x60a7,
-	0x95f5, 0x0016, 0x0026, 0x2009, 0x1804, 0x2011, 0x0008, 0x080c,
-	0x287c, 0x002e, 0x001e, 0x010e, 0x190c, 0x98c9, 0x000e, 0xa001,
-	0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e, 0x0005, 0x00c6, 0x00d6,
-	0x0016, 0x0026, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c, 0x70ac,
-	0x1510, 0x2001, 0x19dd, 0x2004, 0x9005, 0x1904, 0x901d, 0x080c,
-	0x714d, 0x11a8, 0x2069, 0x0380, 0x6843, 0x0101, 0x6844, 0xd084,
-	0x1de8, 0x2061, 0x0100, 0x6020, 0xd0b4, 0x1120, 0x6024, 0xd084,
-	0x090c, 0x0d65, 0x6843, 0x0100, 0x080c, 0x81da, 0x04b0, 0x00c6,
-	0x2061, 0x19b8, 0x00f0, 0x6904, 0x9194, 0x4000, 0x0598, 0x080c,
-	0x8f9c, 0x080c, 0x2843, 0x00c6, 0x2061, 0x19b8, 0x6134, 0x9192,
-	0x0008, 0x1278, 0x8108, 0x6136, 0x080c, 0x98ad, 0x6130, 0x080c,
-	0x98c9, 0x00ce, 0x81ff, 0x01c8, 0x080c, 0x81da, 0x080c, 0x8f8f,
-	0x00a0, 0x080c, 0x98ad, 0x6130, 0x91e5, 0x0000, 0x0150, 0x080c,
-	0xd5ee, 0x080c, 0x81e3, 0x6003, 0x0001, 0x2009, 0x0014, 0x080c,
-	0x9c6a, 0x080c, 0x98c9, 0x00ce, 0x0000, 0x002e, 0x001e, 0x00de,
-	0x00ce, 0x0005, 0x2001, 0x19dd, 0x2004, 0x9005, 0x1db0, 0x00c6,
-	0x2061, 0x19b8, 0x6134, 0x9192, 0x0003, 0x1ad8, 0x8108, 0x6136,
-	0x00ce, 0x080c, 0x81da, 0x080c, 0x5b90, 0x2009, 0x1852, 0x2114,
-	0x8210, 0x220a, 0x0c10, 0x0096, 0x00c6, 0x00d6, 0x00e6, 0x0016,
-	0x0026, 0x080c, 0x81f0, 0x080c, 0x98ad, 0x2001, 0x0387, 0x2003,
-	0x0202, 0x2071, 0x19b8, 0x714c, 0x81ff, 0x0904, 0x90b1, 0x2061,
-	0x0100, 0x2069, 0x0140, 0x080c, 0x70ac, 0x11c0, 0x0036, 0x2019,
-	0x0002, 0x080c, 0x926b, 0x003e, 0x714c, 0x2160, 0x080c, 0xd5ee,
-	0x2009, 0x004a, 0x6003, 0x0003, 0x080c, 0x9c6a, 0x2001, 0x0386,
-	0x2003, 0x5040, 0x080c, 0x714d, 0x0804, 0x90b1, 0x6904, 0xd1f4,
-	0x0904, 0x90be, 0x080c, 0x2843, 0x00c6, 0x704c, 0x9065, 0x090c,
-	0x0d65, 0x6020, 0x00ce, 0x9086, 0x0006, 0x1518, 0x61c8, 0x60c4,
-	0x9105, 0x11f8, 0x2009, 0x180c, 0x2104, 0xd0d4, 0x01d0, 0x6214,
-	0x9294, 0x1800, 0x1128, 0x6224, 0x9294, 0x0002, 0x1510, 0x0010,
-	0xc0d4, 0x200a, 0x6014, 0x9084, 0xe7fd, 0x9085, 0x0010, 0x6016,
-	0x704c, 0x2060, 0x080c, 0x88a9, 0x2009, 0x0049, 0x080c, 0x9c6a,
-	0x0080, 0x0036, 0x2019, 0x0001, 0x080c, 0x926b, 0x003e, 0x714c,
-	0x2160, 0x080c, 0xd5ee, 0x2009, 0x004a, 0x6003, 0x0003, 0x080c,
-	0x9c6a, 0x2001, 0x0387, 0x2003, 0x0200, 0x080c, 0x98c9, 0x002e,
-	0x001e, 0x00ee, 0x00de, 0x00ce, 0x009e, 0x0005, 0xd1ec, 0x1904,
-	0x9072, 0x0804, 0x9074, 0x0026, 0x00e6, 0x2071, 0x19b8, 0x706c,
-	0xd084, 0x01d0, 0xc084, 0x706e, 0x714c, 0x81ff, 0x01a8, 0x2071,
-	0x0100, 0x9188, 0x0008, 0x2114, 0x928e, 0x0006, 0x1138, 0x2009,
-	0x1984, 0x2011, 0x0012, 0x080c, 0x287c, 0x0030, 0x2009, 0x1984,
-	0x2011, 0x0016, 0x080c, 0x287c, 0x00ee, 0x002e, 0x0005, 0x9036,
-	0x2001, 0x19c2, 0x2004, 0x9005, 0x0128, 0x9c06, 0x0128, 0x2c30,
-	0x600c, 0x0cc8, 0x9085, 0x0001, 0x0005, 0x00f6, 0x2079, 0x19b8,
-	0x610c, 0x9006, 0x600e, 0x6044, 0xc0fc, 0x6046, 0x86ff, 0x1140,
-	0x7824, 0x9c06, 0x1118, 0x7826, 0x782a, 0x0050, 0x792a, 0x0040,
-	0x00c6, 0x2660, 0x610e, 0x00ce, 0x7824, 0x9c06, 0x1108, 0x7e26,
-	0x080c, 0x935d, 0x080c, 0xba1b, 0x00fe, 0x0005, 0x080c, 0x8cf8,
-	0x7003, 0x1200, 0x7838, 0x7012, 0x783c, 0x7016, 0x00c6, 0x7820,
-	0x9086, 0x0004, 0x1148, 0x7810, 0x9005, 0x0130, 0x00b6, 0x2058,
-	0xb810, 0xb914, 0x00be, 0x0020, 0x2061, 0x1800, 0x6078, 0x617c,
-	0x9084, 0x00ff, 0x700a, 0x710e, 0x00ce, 0x60c3, 0x002c, 0x0804,
-	0x8f6c, 0x080c, 0x8cf8, 0x7003, 0x0f00, 0x7808, 0xd09c, 0x0128,
-	0xb810, 0x9084, 0x00ff, 0x700a, 0xb814, 0x700e, 0x60c3, 0x0008,
-	0x0804, 0x8f6c, 0x0156, 0x080c, 0x8d43, 0x7003, 0x0200, 0x2011,
-	0x1848, 0x63f0, 0x2312, 0x20a9, 0x0006, 0x2011, 0x1840, 0x2019,
-	0x1841, 0x9ef0, 0x0002, 0x2376, 0x8e70, 0x2276, 0x8e70, 0x9398,
-	0x0002, 0x9290, 0x0002, 0x1f04, 0x915b, 0x60c3, 0x001c, 0x015e,
-	0x0804, 0x8f6c, 0x0016, 0x0026, 0x080c, 0x8d1f, 0x080c, 0x8d31,
-	0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0, 0x7814, 0x0096, 0x2048,
-	0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0021, 0x2098,
-	0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x9192, 0x0010, 0x1250,
-	0x4003, 0x9080, 0x0004, 0x8003, 0x60c2, 0x080c, 0x8f6c, 0x002e,
-	0x001e, 0x0005, 0x20a9, 0x0010, 0x4003, 0x080c, 0x97ca, 0x20a1,
-	0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c, 0x8cf8, 0x7003, 0x6200,
-	0x7808, 0x700e, 0x60c3, 0x0008, 0x0804, 0x8f6c, 0x0016, 0x0026,
-	0x080c, 0x8cf8, 0x20e9, 0x0000, 0x20a1, 0x024c, 0x7814, 0x0096,
-	0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x0023,
-	0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8, 0x4003, 0x8003,
-	0x60c2, 0x080c, 0x8f6c, 0x002e, 0x001e, 0x0005, 0x00e6, 0x00c6,
-	0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x7010, 0x2060,
-	0x8cff, 0x0188, 0x080c, 0xba41, 0x1110, 0x080c, 0xa574, 0x600c,
-	0x0006, 0x080c, 0xbcb8, 0x600f, 0x0000, 0x080c, 0x9bcc, 0x080c,
-	0x935d, 0x00ce, 0x0c68, 0x2c00, 0x7012, 0x700e, 0x012e, 0x000e,
-	0x00ce, 0x00ee, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6,
-	0x00c6, 0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000, 0x2001,
-	0x180c, 0x200c, 0x918c, 0xe7ff, 0x2102, 0x2069, 0x0100, 0x2079,
-	0x0140, 0x2071, 0x19b8, 0x7030, 0x2060, 0x8cff, 0x0548, 0x080c,
-	0x8f9c, 0x6ac0, 0x68c3, 0x0000, 0x080c, 0x81e3, 0x00c6, 0x2061,
-	0x0100, 0x080c, 0x97e3, 0x00ce, 0x20a9, 0x01f4, 0x04b1, 0x080c,
-	0x884c, 0x6044, 0xd0ac, 0x1128, 0x2001, 0x1959, 0x2004, 0x604a,
-	0x0020, 0x2009, 0x0013, 0x080c, 0x9c6a, 0x000e, 0x001e, 0x002e,
-	0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005,
-	0x2001, 0x1800, 0x2004, 0x9096, 0x0001, 0x0d78, 0x9096, 0x0004,
-	0x0d60, 0x080c, 0x81e3, 0x6814, 0x9084, 0x0001, 0x0110, 0x68a7,
-	0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000, 0x2011, 0x5b3a, 0x080c,
-	0x8131, 0x20a9, 0x01f4, 0x0009, 0x08c0, 0x6824, 0xd094, 0x0140,
-	0x6827, 0x0004, 0x7804, 0x9084, 0x4000, 0x190c, 0x2843, 0x0090,
-	0xd084, 0x0118, 0x6827, 0x0001, 0x0010, 0x1f04, 0x924d, 0x7804,
-	0x9084, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2833, 0x9006,
-	0x080c, 0x2833, 0x0005, 0x0126, 0x0156, 0x00f6, 0x00e6, 0x00d6,
-	0x00c6, 0x0066, 0x0026, 0x0016, 0x0006, 0x2091, 0x8000, 0x2001,
-	0x180c, 0x200c, 0x918c, 0xdbff, 0x2102, 0x2069, 0x0100, 0x2079,
-	0x0140, 0x2071, 0x0380, 0x701c, 0x0006, 0x701f, 0x0202, 0x2071,
-	0x19b8, 0x704c, 0x2060, 0x8cff, 0x0904, 0x930c, 0x9386, 0x0002,
-	0x1128, 0x6814, 0x9084, 0x0002, 0x0904, 0x930c, 0x68af, 0x95f5,
-	0x6817, 0x0010, 0x2009, 0x00fa, 0x8109, 0x1df0, 0x69c6, 0x68cb,
-	0x0008, 0x080c, 0x81f0, 0x080c, 0x1c7a, 0x0046, 0x2009, 0x00a5,
-	0x080c, 0x0e3d, 0x2021, 0x0169, 0x2404, 0x9084, 0x000f, 0x9086,
-	0x0004, 0x11f8, 0x68af, 0x95f5, 0x68c6, 0x68cb, 0x0008, 0x00e6,
-	0x00f6, 0x2079, 0x0090, 0x2071, 0x19b8, 0x6814, 0x9084, 0x1984,
-	0x9085, 0x0012, 0x6816, 0x782b, 0x0008, 0x7057, 0x0000, 0x00fe,
-	0x00ee, 0x9386, 0x0002, 0x1128, 0x7884, 0x9005, 0x1110, 0x7887,
-	0x0001, 0x0016, 0x2009, 0x0040, 0x080c, 0x2052, 0x001e, 0x2009,
-	0x0000, 0x080c, 0x0e3d, 0x004e, 0x20a9, 0x03e8, 0x6824, 0xd094,
-	0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000, 0x190c, 0x2843,
-	0x0090, 0xd08c, 0x0118, 0x6827, 0x0002, 0x0010, 0x1f04, 0x92de,
-	0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2833,
-	0x9006, 0x080c, 0x2833, 0x6827, 0x4000, 0x6824, 0x83ff, 0x1160,
-	0x2009, 0x0049, 0x080c, 0x88a9, 0x6044, 0xd0ac, 0x1118, 0x6003,
-	0x0002, 0x0010, 0x080c, 0x9c6a, 0x000e, 0x2071, 0x0380, 0xd08c,
-	0x1110, 0x701f, 0x0200, 0x000e, 0x001e, 0x002e, 0x006e, 0x00ce,
-	0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e, 0x0005, 0x00d6, 0x0126,
-	0x2091, 0x8000, 0x2069, 0x19b8, 0x6a06, 0x012e, 0x00de, 0x0005,
-	0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19b8, 0x6a3e, 0x012e,
-	0x00de, 0x0005, 0x080c, 0x8e46, 0x785c, 0x7032, 0x7042, 0x7047,
-	0x1000, 0x00f8, 0x080c, 0x8e46, 0x785c, 0x7032, 0x7042, 0x7047,
-	0x4000, 0x00b8, 0x080c, 0x8e46, 0x785c, 0x7032, 0x7042, 0x7047,
-	0x2000, 0x0078, 0x080c, 0x8e46, 0x785c, 0x7032, 0x7042, 0x7047,
-	0x0400, 0x0038, 0x080c, 0x8e46, 0x785c, 0x7032, 0x7042, 0x7047,
-	0x0200, 0x60c3, 0x0020, 0x0804, 0x8f6c, 0x00e6, 0x2071, 0x19b8,
-	0x702c, 0x9005, 0x0110, 0x8001, 0x702e, 0x00ee, 0x0005, 0x00f6,
-	0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066, 0x0006, 0x0126, 0x2091,
-	0x8000, 0x2071, 0x19b8, 0x7620, 0x2660, 0x2678, 0x2039, 0x0001,
-	0x87ff, 0x0904, 0x9402, 0x8cff, 0x0904, 0x9402, 0x6020, 0x9086,
-	0x0006, 0x1904, 0x93fd, 0x88ff, 0x0138, 0x2800, 0x9c06, 0x1904,
-	0x93fd, 0x2039, 0x0000, 0x0050, 0x6010, 0x9b06, 0x1904, 0x93fd,
-	0x85ff, 0x0120, 0x605c, 0x9106, 0x1904, 0x93fd, 0x7030, 0x9c06,
-	0x15b0, 0x2069, 0x0100, 0x68c0, 0x9005, 0x1160, 0x6824, 0xd084,
-	0x0148, 0x6827, 0x0001, 0x080c, 0x81e3, 0x080c, 0x9487, 0x7033,
-	0x0000, 0x0428, 0x080c, 0x81e3, 0x6820, 0xd0b4, 0x0110, 0x68a7,
-	0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000, 0x080c, 0x9487, 0x7033,
+	0x9295, 0x0600, 0x7202, 0xba14, 0x7206, 0x2069, 0x1800, 0x6a78,
+	0x720a, 0x6a7c, 0x720e, 0x7013, 0x0829, 0x2f10, 0x7222, 0x7027,
+	0xffff, 0x0005, 0x0016, 0x7814, 0x9084, 0x0700, 0x8007, 0x0013,
+	0x001e, 0x0005, 0x8ea2, 0x8ea2, 0x8ea4, 0x8ea2, 0x8ea2, 0x8ea2,
+	0x8ebe, 0x8ea2, 0x080c, 0x0d65, 0x7914, 0x918c, 0x08ff, 0x918d,
+	0xf600, 0x7916, 0x2009, 0x0003, 0x00b9, 0x2069, 0x1853, 0x6804,
+	0xd0bc, 0x0130, 0x682c, 0x9084, 0x00ff, 0x8007, 0x7032, 0x0010,
+	0x7033, 0x3f00, 0x60c3, 0x0001, 0x0804, 0x8f87, 0x2009, 0x0003,
+	0x0019, 0x7033, 0x7f00, 0x0cb0, 0x0016, 0x080c, 0x97fa, 0x001e,
+	0xb810, 0x9085, 0x0100, 0x7002, 0xb814, 0x7006, 0x2069, 0x1800,
+	0x6a78, 0x720a, 0x6a7c, 0x720e, 0x7013, 0x0888, 0x918d, 0x0008,
+	0x7116, 0x080c, 0x8f7b, 0x721a, 0x7a08, 0x7222, 0x2f10, 0x7226,
+	0x0005, 0x00b6, 0x0096, 0x00e6, 0x00d6, 0x00c6, 0x0056, 0x0046,
+	0x0036, 0x2061, 0x0100, 0x2071, 0x1800, 0x7810, 0x2058, 0xb8a0,
+	0x2028, 0xb910, 0xba14, 0x7378, 0x747c, 0x7820, 0x0002, 0x8f06,
+	0x8f06, 0x8f06, 0x8f06, 0x8f06, 0x8f06, 0x8f06, 0x8f06, 0x8f06,
+	0x8f06, 0x8f08, 0x8f06, 0x8f06, 0x8f06, 0x8f06, 0x080c, 0x0d65,
+	0xb884, 0x609e, 0x7814, 0x2048, 0xa87c, 0xd0fc, 0x0558, 0xaf90,
+	0x9784, 0xff00, 0x9105, 0x6062, 0x873f, 0x9784, 0xff00, 0x0006,
+	0x7814, 0x2048, 0xa878, 0xc0fc, 0x9005, 0x000e, 0x1160, 0xaf94,
+	0x87ff, 0x0198, 0x2039, 0x0098, 0x9705, 0x6072, 0x7808, 0x6082,
+	0x2f00, 0x6086, 0x0038, 0x9185, 0x2200, 0x6062, 0x6073, 0x0129,
+	0x6077, 0x0000, 0xb884, 0x609e, 0x0050, 0x2039, 0x0029, 0x9705,
+	0x6072, 0x0cc0, 0x9185, 0x0200, 0x6062, 0x6073, 0x2029, 0xa87c,
+	0xd0fc, 0x0118, 0xaf94, 0x87ff, 0x1120, 0x2f00, 0x6082, 0x7808,
+	0x6086, 0x6266, 0x636a, 0x646e, 0x6077, 0x0000, 0xb88c, 0x8000,
+	0x9084, 0x00ff, 0xb88e, 0x8007, 0x607a, 0x607f, 0x0000, 0xa848,
+	0x608a, 0xa844, 0x608e, 0xa838, 0x60c6, 0xa834, 0x60ca, 0xb86c,
+	0x60ce, 0x60af, 0x95d5, 0x60d7, 0x0000, 0x080c, 0x97da, 0x2009,
+	0x07d0, 0x60c4, 0x9084, 0xfff0, 0x9005, 0x0110, 0x2009, 0x1b58,
+	0x080c, 0x8210, 0x003e, 0x004e, 0x005e, 0x00ce, 0x00de, 0x00ee,
+	0x009e, 0x00be, 0x0005, 0x7a40, 0x9294, 0x00ff, 0x8217, 0x0005,
+	0x00d6, 0x2069, 0x19b8, 0x686b, 0x0001, 0x00de, 0x0005, 0x60a3,
+	0x0056, 0x60a7, 0x9575, 0x00f1, 0x080c, 0x8202, 0x0005, 0x0016,
+	0x2001, 0x180c, 0x200c, 0x9184, 0x0600, 0x9086, 0x0600, 0x0128,
+	0x0089, 0x080c, 0x8202, 0x001e, 0x0005, 0xc1e5, 0x2001, 0x180c,
+	0x2102, 0x2001, 0x19b9, 0x2003, 0x0000, 0x2001, 0x19c4, 0x2003,
+	0x0000, 0x0c88, 0x0006, 0x0016, 0x0026, 0x2009, 0x1804, 0x2011,
+	0x0009, 0x080c, 0x287c, 0x002e, 0x001e, 0x000e, 0x0005, 0x0016,
+	0x00c6, 0x0006, 0x080c, 0x9926, 0x0106, 0x190c, 0x98c8, 0x2061,
+	0x0100, 0x61a4, 0x60a7, 0x95f5, 0x0016, 0x0026, 0x2009, 0x1804,
+	0x2011, 0x0008, 0x080c, 0x287c, 0x002e, 0x001e, 0x010e, 0x190c,
+	0x98e4, 0x000e, 0xa001, 0xa001, 0xa001, 0x61a6, 0x00ce, 0x001e,
+	0x0005, 0x00c6, 0x00d6, 0x0016, 0x0026, 0x2061, 0x0100, 0x2069,
+	0x0140, 0x080c, 0x70b7, 0x1510, 0x2001, 0x19dd, 0x2004, 0x9005,
+	0x1904, 0x9038, 0x080c, 0x7158, 0x11a8, 0x2069, 0x0380, 0x6843,
+	0x0101, 0x6844, 0xd084, 0x1de8, 0x2061, 0x0100, 0x6020, 0xd0b4,
+	0x1120, 0x6024, 0xd084, 0x090c, 0x0d65, 0x6843, 0x0100, 0x080c,
+	0x8202, 0x04b0, 0x00c6, 0x2061, 0x19b8, 0x00f0, 0x6904, 0x9194,
+	0x4000, 0x0598, 0x080c, 0x8fb7, 0x080c, 0x2843, 0x00c6, 0x2061,
+	0x19b8, 0x6134, 0x9192, 0x0008, 0x1278, 0x8108, 0x6136, 0x080c,
+	0x98c8, 0x6130, 0x080c, 0x98e4, 0x00ce, 0x81ff, 0x01c8, 0x080c,
+	0x8202, 0x080c, 0x8faa, 0x00a0, 0x080c, 0x98c8, 0x6130, 0x91e5,
+	0x0000, 0x0150, 0x080c, 0xd610, 0x080c, 0x820b, 0x6003, 0x0001,
+	0x2009, 0x0014, 0x080c, 0x9c85, 0x080c, 0x98e4, 0x00ce, 0x0000,
+	0x002e, 0x001e, 0x00de, 0x00ce, 0x0005, 0x2001, 0x19dd, 0x2004,
+	0x9005, 0x1db0, 0x00c6, 0x2061, 0x19b8, 0x6134, 0x9192, 0x0003,
+	0x1ad8, 0x8108, 0x6136, 0x00ce, 0x080c, 0x8202, 0x080c, 0x5b97,
+	0x2009, 0x1852, 0x2114, 0x8210, 0x220a, 0x0c10, 0x0096, 0x00c6,
+	0x00d6, 0x00e6, 0x0016, 0x0026, 0x080c, 0x8218, 0x080c, 0x98c8,
+	0x2001, 0x0387, 0x2003, 0x0202, 0x2071, 0x19b8, 0x714c, 0x81ff,
+	0x0904, 0x90cc, 0x2061, 0x0100, 0x2069, 0x0140, 0x080c, 0x70b7,
+	0x11c0, 0x0036, 0x2019, 0x0002, 0x080c, 0x9286, 0x003e, 0x714c,
+	0x2160, 0x080c, 0xd610, 0x2009, 0x004a, 0x6003, 0x0003, 0x080c,
+	0x9c85, 0x2001, 0x0386, 0x2003, 0x5040, 0x080c, 0x7158, 0x0804,
+	0x90cc, 0x6904, 0xd1f4, 0x0904, 0x90d9, 0x080c, 0x2843, 0x00c6,
+	0x704c, 0x9065, 0x090c, 0x0d65, 0x6020, 0x00ce, 0x9086, 0x0006,
+	0x1518, 0x61c8, 0x60c4, 0x9105, 0x11f8, 0x2009, 0x180c, 0x2104,
+	0xd0d4, 0x01d0, 0x6214, 0x9294, 0x1800, 0x1128, 0x6224, 0x9294,
+	0x0002, 0x1510, 0x0010, 0xc0d4, 0x200a, 0x6014, 0x9084, 0xe7fd,
+	0x9085, 0x0010, 0x6016, 0x704c, 0x2060, 0x080c, 0x88d1, 0x2009,
+	0x0049, 0x080c, 0x9c85, 0x0080, 0x0036, 0x2019, 0x0001, 0x080c,
+	0x9286, 0x003e, 0x714c, 0x2160, 0x080c, 0xd610, 0x2009, 0x004a,
+	0x6003, 0x0003, 0x080c, 0x9c85, 0x2001, 0x0387, 0x2003, 0x0200,
+	0x080c, 0x98e4, 0x002e, 0x001e, 0x00ee, 0x00de, 0x00ce, 0x009e,
+	0x0005, 0xd1ec, 0x1904, 0x908d, 0x0804, 0x908f, 0x0026, 0x00e6,
+	0x2071, 0x19b8, 0x706c, 0xd084, 0x01d0, 0xc084, 0x706e, 0x714c,
+	0x81ff, 0x01a8, 0x2071, 0x0100, 0x9188, 0x0008, 0x2114, 0x928e,
+	0x0006, 0x1138, 0x2009, 0x1984, 0x2011, 0x0012, 0x080c, 0x287c,
+	0x0030, 0x2009, 0x1984, 0x2011, 0x0016, 0x080c, 0x287c, 0x00ee,
+	0x002e, 0x0005, 0x9036, 0x2001, 0x19c2, 0x2004, 0x9005, 0x0128,
+	0x9c06, 0x0128, 0x2c30, 0x600c, 0x0cc8, 0x9085, 0x0001, 0x0005,
+	0x00f6, 0x2079, 0x19b8, 0x610c, 0x9006, 0x600e, 0x6044, 0xc0fc,
+	0x6046, 0x86ff, 0x1140, 0x7824, 0x9c06, 0x1118, 0x7826, 0x782a,
+	0x0050, 0x792a, 0x0040, 0x00c6, 0x2660, 0x610e, 0x00ce, 0x7824,
+	0x9c06, 0x1108, 0x7e26, 0x080c, 0x9378, 0x080c, 0xba36, 0x00fe,
+	0x0005, 0x080c, 0x8d20, 0x7003, 0x1200, 0x7838, 0x7012, 0x783c,
+	0x7016, 0x00c6, 0x7820, 0x9086, 0x0004, 0x1148, 0x7810, 0x9005,
+	0x0130, 0x00b6, 0x2058, 0xb810, 0xb914, 0x00be, 0x0020, 0x2061,
+	0x1800, 0x6078, 0x617c, 0x9084, 0x00ff, 0x700a, 0x710e, 0x00ce,
+	0x60c3, 0x002c, 0x0804, 0x8f87, 0x080c, 0x8d20, 0x7003, 0x0f00,
+	0x7808, 0xd09c, 0x0128, 0xb810, 0x9084, 0x00ff, 0x700a, 0xb814,
+	0x700e, 0x60c3, 0x0008, 0x0804, 0x8f87, 0x0156, 0x080c, 0x8d6b,
+	0x7003, 0x0200, 0x2011, 0x1848, 0x63f0, 0x2312, 0x20a9, 0x0006,
+	0x2011, 0x1840, 0x2019, 0x1841, 0x9ef0, 0x0002, 0x2376, 0x8e70,
+	0x2276, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0x9176,
+	0x60c3, 0x001c, 0x015e, 0x0804, 0x8f87, 0x0016, 0x0026, 0x080c,
+	0x8d47, 0x080c, 0x8d59, 0x9e80, 0x0004, 0x20e9, 0x0000, 0x20a0,
+	0x7814, 0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0, 0xa85c,
+	0x9080, 0x0021, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002, 0x21a8,
+	0x9192, 0x0010, 0x1250, 0x4003, 0x9080, 0x0004, 0x8003, 0x60c2,
+	0x080c, 0x8f87, 0x002e, 0x001e, 0x0005, 0x20a9, 0x0010, 0x4003,
+	0x080c, 0x97e5, 0x20a1, 0x0240, 0x22a8, 0x4003, 0x0c68, 0x080c,
+	0x8d20, 0x7003, 0x6200, 0x7808, 0x700e, 0x60c3, 0x0008, 0x0804,
+	0x8f87, 0x0016, 0x0026, 0x080c, 0x8d20, 0x20e9, 0x0000, 0x20a1,
+	0x024c, 0x7814, 0x0096, 0x2048, 0xa800, 0x2048, 0xa860, 0x20e0,
+	0xa85c, 0x9080, 0x0023, 0x2098, 0x009e, 0x7808, 0x9088, 0x0002,
+	0x21a8, 0x4003, 0x8003, 0x60c2, 0x080c, 0x8f87, 0x002e, 0x001e,
+	0x0005, 0x00e6, 0x00c6, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071,
+	0x19b8, 0x7010, 0x2060, 0x8cff, 0x0188, 0x080c, 0xba5c, 0x1110,
+	0x080c, 0xa58f, 0x600c, 0x0006, 0x080c, 0xbcd3, 0x600f, 0x0000,
+	0x080c, 0x9be7, 0x080c, 0x9378, 0x00ce, 0x0c68, 0x2c00, 0x7012,
+	0x700e, 0x012e, 0x000e, 0x00ce, 0x00ee, 0x0005, 0x0126, 0x0156,
+	0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006,
+	0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c, 0xe7ff, 0x2102,
+	0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x19b8, 0x7030, 0x2060,
+	0x8cff, 0x0548, 0x080c, 0x8fb7, 0x6ac0, 0x68c3, 0x0000, 0x080c,
+	0x820b, 0x00c6, 0x2061, 0x0100, 0x080c, 0x97fe, 0x00ce, 0x20a9,
+	0x01f4, 0x04b1, 0x080c, 0x8874, 0x6044, 0xd0ac, 0x1128, 0x2001,
+	0x1959, 0x2004, 0x604a, 0x0020, 0x2009, 0x0013, 0x080c, 0x9c85,
+	0x000e, 0x001e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe,
+	0x015e, 0x012e, 0x0005, 0x2001, 0x1800, 0x2004, 0x9096, 0x0001,
+	0x0d78, 0x9096, 0x0004, 0x0d60, 0x080c, 0x820b, 0x6814, 0x9084,
+	0x0001, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000,
+	0x2011, 0x5b41, 0x080c, 0x8159, 0x20a9, 0x01f4, 0x0009, 0x08c0,
+	0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084, 0x4000,
+	0x190c, 0x2843, 0x0090, 0xd084, 0x0118, 0x6827, 0x0001, 0x0010,
+	0x1f04, 0x9268, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001, 0x0100,
+	0x080c, 0x2833, 0x9006, 0x080c, 0x2833, 0x0005, 0x0126, 0x0156,
+	0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026, 0x0016, 0x0006,
+	0x2091, 0x8000, 0x2001, 0x180c, 0x200c, 0x918c, 0xdbff, 0x2102,
+	0x2069, 0x0100, 0x2079, 0x0140, 0x2071, 0x0380, 0x701c, 0x0006,
+	0x701f, 0x0202, 0x2071, 0x19b8, 0x704c, 0x2060, 0x8cff, 0x0904,
+	0x9327, 0x9386, 0x0002, 0x1128, 0x6814, 0x9084, 0x0002, 0x0904,
+	0x9327, 0x68af, 0x95f5, 0x6817, 0x0010, 0x2009, 0x00fa, 0x8109,
+	0x1df0, 0x69c6, 0x68cb, 0x0008, 0x080c, 0x8218, 0x080c, 0x1c7a,
+	0x0046, 0x2009, 0x00a5, 0x080c, 0x0e3d, 0x2021, 0x0169, 0x2404,
+	0x9084, 0x000f, 0x9086, 0x0004, 0x11f8, 0x68af, 0x95f5, 0x68c6,
+	0x68cb, 0x0008, 0x00e6, 0x00f6, 0x2079, 0x0090, 0x2071, 0x19b8,
+	0x6814, 0x9084, 0x1984, 0x9085, 0x0012, 0x6816, 0x782b, 0x0008,
+	0x7057, 0x0000, 0x00fe, 0x00ee, 0x9386, 0x0002, 0x1128, 0x7884,
+	0x9005, 0x1110, 0x7887, 0x0001, 0x0016, 0x2009, 0x0040, 0x080c,
+	0x2052, 0x001e, 0x2009, 0x0000, 0x080c, 0x0e3d, 0x004e, 0x20a9,
+	0x03e8, 0x6824, 0xd094, 0x0140, 0x6827, 0x0004, 0x7804, 0x9084,
+	0x4000, 0x190c, 0x2843, 0x0090, 0xd08c, 0x0118, 0x6827, 0x0002,
+	0x0010, 0x1f04, 0x92f9, 0x7804, 0x9084, 0x1000, 0x0138, 0x2001,
+	0x0100, 0x080c, 0x2833, 0x9006, 0x080c, 0x2833, 0x6827, 0x4000,
+	0x6824, 0x83ff, 0x1160, 0x2009, 0x0049, 0x080c, 0x88d1, 0x6044,
+	0xd0ac, 0x1118, 0x6003, 0x0002, 0x0010, 0x080c, 0x9c85, 0x000e,
+	0x2071, 0x0380, 0xd08c, 0x1110, 0x701f, 0x0200, 0x000e, 0x001e,
+	0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x015e, 0x012e,
+	0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069, 0x19b8, 0x6a06,
+	0x012e, 0x00de, 0x0005, 0x00d6, 0x0126, 0x2091, 0x8000, 0x2069,
+	0x19b8, 0x6a3e, 0x012e, 0x00de, 0x0005, 0x080c, 0x8e6e, 0x785c,
+	0x7032, 0x7042, 0x7047, 0x1000, 0x00f8, 0x080c, 0x8e6e, 0x785c,
+	0x7032, 0x7042, 0x7047, 0x4000, 0x00b8, 0x080c, 0x8e6e, 0x785c,
+	0x7032, 0x7042, 0x7047, 0x2000, 0x0078, 0x080c, 0x8e6e, 0x785c,
+	0x7032, 0x7042, 0x7047, 0x0400, 0x0038, 0x080c, 0x8e6e, 0x785c,
+	0x7032, 0x7042, 0x7047, 0x0200, 0x60c3, 0x0020, 0x0804, 0x8f87,
+	0x00e6, 0x2071, 0x19b8, 0x702c, 0x9005, 0x0110, 0x8001, 0x702e,
+	0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066,
+	0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x7620, 0x2660,
+	0x2678, 0x2039, 0x0001, 0x87ff, 0x0904, 0x941d, 0x8cff, 0x0904,
+	0x941d, 0x6020, 0x9086, 0x0006, 0x1904, 0x9418, 0x88ff, 0x0138,
+	0x2800, 0x9c06, 0x1904, 0x9418, 0x2039, 0x0000, 0x0050, 0x6010,
+	0x9b06, 0x1904, 0x9418, 0x85ff, 0x0120, 0x605c, 0x9106, 0x1904,
+	0x9418, 0x7030, 0x9c06, 0x15b0, 0x2069, 0x0100, 0x68c0, 0x9005,
+	0x1160, 0x6824, 0xd084, 0x0148, 0x6827, 0x0001, 0x080c, 0x820b,
+	0x080c, 0x94a2, 0x7033, 0x0000, 0x0428, 0x080c, 0x820b, 0x6820,
+	0xd0b4, 0x0110, 0x68a7, 0x95f5, 0x6817, 0x0008, 0x68c3, 0x0000,
+	0x080c, 0x94a2, 0x7033, 0x0000, 0x0036, 0x2069, 0x0140, 0x6b04,
+	0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2833, 0x9006,
+	0x080c, 0x2833, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827,
+	0x0001, 0x003e, 0x7020, 0x9c36, 0x1110, 0x660c, 0x7622, 0x701c,
+	0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x701e, 0x0010,
+	0x701f, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e,
+	0x0008, 0x2678, 0x89ff, 0x1168, 0x600f, 0x0000, 0x6014, 0x0096,
+	0x2048, 0x080c, 0xb845, 0x0110, 0x080c, 0xd21e, 0x009e, 0x080c,
+	0x9c21, 0x080c, 0x9378, 0x88ff, 0x1190, 0x00ce, 0x0804, 0x9393,
+	0x2c78, 0x600c, 0x2060, 0x0804, 0x9393, 0x9006, 0x012e, 0x000e,
+	0x006e, 0x007e, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b,
+	0x0000, 0x00ce, 0x98c5, 0x0001, 0x0c88, 0x00f6, 0x00e6, 0x00d6,
+	0x0096, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000,
+	0x2071, 0x19b8, 0x7648, 0x2660, 0x2678, 0x8cff, 0x0904, 0x9491,
+	0x6020, 0x9086, 0x0006, 0x1904, 0x948c, 0x87ff, 0x0128, 0x2700,
+	0x9c06, 0x1904, 0x948c, 0x0040, 0x6010, 0x9b06, 0x15e8, 0x85ff,
+	0x0118, 0x605c, 0x9106, 0x15c0, 0x704c, 0x9c06, 0x1168, 0x0036,
+	0x2019, 0x0001, 0x080c, 0x9286, 0x703f, 0x0000, 0x9006, 0x704e,
+	0x706a, 0x7052, 0x706e, 0x003e, 0x7048, 0x9c36, 0x1110, 0x660c,
+	0x764a, 0x7044, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
+	0x7046, 0x0010, 0x7047, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
+	0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x6014, 0x2048,
+	0x080c, 0xb845, 0x0110, 0x080c, 0xd21e, 0x080c, 0x9c21, 0x87ff,
+	0x1198, 0x00ce, 0x0804, 0x943d, 0x2c78, 0x600c, 0x2060, 0x0804,
+	0x943d, 0x9006, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x009e,
+	0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce, 0x97bd,
+	0x0001, 0x0c80, 0x00e6, 0x2071, 0x19b8, 0x7033, 0x0000, 0x7004,
+	0x9086, 0x0003, 0x0158, 0x2001, 0x1800, 0x2004, 0x9086, 0x0002,
+	0x1118, 0x7007, 0x0005, 0x0010, 0x7007, 0x0000, 0x00ee, 0x0005,
+	0x00f6, 0x00e6, 0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091,
+	0x8000, 0x2071, 0x19b8, 0x2c10, 0x7648, 0x2660, 0x2678, 0x8cff,
+	0x0518, 0x2200, 0x9c06, 0x11e0, 0x7048, 0x9c36, 0x1110, 0x660c,
+	0x764a, 0x7044, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
+	0x7046, 0x0010, 0x7047, 0x0000, 0x660c, 0x2c00, 0x9f06, 0x0110,
+	0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x9085, 0x0001, 0x0020,
+	0x2c78, 0x600c, 0x2060, 0x08d8, 0x012e, 0x000e, 0x002e, 0x006e,
+	0x00ce, 0x00ee, 0x00fe, 0x0005, 0x0096, 0x00f6, 0x00e6, 0x00d6,
+	0x00c6, 0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071,
+	0x19b8, 0x7610, 0x2660, 0x2678, 0x8cff, 0x0904, 0x9584, 0x6010,
+	0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x1904, 0x957f, 0x7030,
+	0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0x955b,
+	0x080c, 0x8fb7, 0x68c3, 0x0000, 0x080c, 0x94a2, 0x7033, 0x0000,
+	0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001,
+	0x0100, 0x080c, 0x2833, 0x9006, 0x080c, 0x2833, 0x2069, 0x0100,
+	0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x7010, 0x9c36,
+	0x1110, 0x660c, 0x7612, 0x700c, 0x9c36, 0x1140, 0x2c00, 0x9f36,
+	0x0118, 0x2f00, 0x700e, 0x0010, 0x700f, 0x0000, 0x660c, 0x0066,
+	0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000,
+	0x080c, 0xba4b, 0x1158, 0x080c, 0x303b, 0x080c, 0xba5c, 0x11f0,
+	0x080c, 0xa58f, 0x00d8, 0x080c, 0x94a2, 0x08c0, 0x080c, 0xba5c,
+	0x1118, 0x080c, 0xa58f, 0x0090, 0x6014, 0x2048, 0x080c, 0xb845,
+	0x0168, 0x6020, 0x9086, 0x0003, 0x1508, 0xa867, 0x0103, 0xab7a,
+	0xa877, 0x0000, 0x080c, 0x698a, 0x080c, 0xba36, 0x080c, 0xbcd3,
+	0x080c, 0x9c21, 0x080c, 0x9378, 0x00ce, 0x0804, 0x9504, 0x2c78,
+	0x600c, 0x2060, 0x0804, 0x9504, 0x012e, 0x000e, 0x002e, 0x006e,
+	0x00ce, 0x00de, 0x00ee, 0x00fe, 0x009e, 0x0005, 0x6020, 0x9086,
+	0x0006, 0x1d20, 0x080c, 0xd21e, 0x0c08, 0x00d6, 0x080c, 0x8d6b,
+	0x7003, 0x0200, 0x7007, 0x0014, 0x60c3, 0x0014, 0x20e1, 0x0001,
+	0x2099, 0x195a, 0x20e9, 0x0000, 0x20a1, 0x0250, 0x20a9, 0x0004,
+	0x4003, 0x7023, 0x0004, 0x7027, 0x7878, 0x080c, 0x8f87, 0x00de,
+	0x0005, 0x080c, 0x8d6b, 0x700b, 0x0800, 0x7814, 0x9084, 0xff00,
+	0x700e, 0x7814, 0x9084, 0x00ff, 0x7022, 0x782c, 0x7026, 0x7860,
+	0x9084, 0x00ff, 0x9085, 0x0200, 0x7002, 0x7860, 0x9084, 0xff00,
+	0x8007, 0x7006, 0x60c2, 0x0804, 0x8f87, 0x00b6, 0x00d6, 0x0016,
+	0x00d6, 0x2f68, 0x2009, 0x0035, 0x080c, 0xbed9, 0x00de, 0x1904,
+	0x9632, 0x080c, 0x8d20, 0x7003, 0x1300, 0x782c, 0x080c, 0x973d,
+	0x2068, 0x6820, 0x9086, 0x0003, 0x0560, 0x7810, 0x2058, 0xbaa0,
+	0x080c, 0x9b66, 0x11d8, 0x9286, 0x007e, 0x1128, 0x700b, 0x00ff,
+	0x700f, 0xfffe, 0x0498, 0x9286, 0x007f, 0x1128, 0x700b, 0x00ff,
+	0x700f, 0xfffd, 0x0458, 0x9284, 0xff80, 0x0180, 0x9286, 0x0080,
+	0x1128, 0x700b, 0x00ff, 0x700f, 0xfffc, 0x0400, 0x92d8, 0x1000,
+	0x2b5c, 0xb810, 0x700a, 0xb814, 0x700e, 0x00c0, 0xb884, 0x700e,
+	0x00a8, 0x080c, 0x9b66, 0x1130, 0x7810, 0x2058, 0xb8a0, 0x9082,
+	0x007e, 0x0250, 0x00d6, 0x2069, 0x181e, 0x2d04, 0x700a, 0x8d68,
+	0x2d04, 0x700e, 0x00de, 0x0010, 0x6034, 0x700e, 0x7838, 0x7012,
+	0x783c, 0x7016, 0x60c3, 0x000c, 0x001e, 0x00de, 0x080c, 0x8f87,
+	0x00be, 0x0005, 0x781b, 0x0001, 0x7803, 0x0006, 0x001e, 0x00de,
+	0x00be, 0x0005, 0x792c, 0x9180, 0x0008, 0x200c, 0x9186, 0x0006,
+	0x01c0, 0x9186, 0x0003, 0x0904, 0x96b0, 0x9186, 0x0005, 0x0904,
+	0x9698, 0x9186, 0x0004, 0x05f0, 0x9186, 0x0008, 0x0904, 0x96a1,
+	0x7807, 0x0037, 0x782f, 0x0003, 0x7817, 0x1700, 0x080c, 0x971a,
+	0x0005, 0x080c, 0x96db, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009,
+	0x4000, 0x6800, 0x6a44, 0xd2fc, 0x11f8, 0x0002, 0x9679, 0x9684,
+	0x967b, 0x9684, 0x9680, 0x9679, 0x9679, 0x9684, 0x9684, 0x9684,
+	0x9684, 0x9679, 0x9679, 0x9679, 0x9679, 0x9679, 0x9684, 0x9679,
+	0x9684, 0x080c, 0x0d65, 0x6824, 0xd0e4, 0x0110, 0xd0cc, 0x0110,
+	0x900e, 0x0010, 0x2009, 0x2000, 0x682c, 0x7022, 0x6830, 0x7026,
+	0x0804, 0x96d4, 0x080c, 0x96db, 0x00d6, 0x0026, 0x792c, 0x2168,
+	0x2009, 0x4000, 0x6a00, 0x9286, 0x0002, 0x1108, 0x900e, 0x04e0,
+	0x080c, 0x96db, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000,
+	0x0498, 0x04c9, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000,
+	0x9286, 0x0005, 0x0118, 0x9286, 0x0002, 0x1108, 0x900e, 0x0420,
+	0x0451, 0x00d6, 0x0026, 0x792c, 0x2168, 0x6814, 0x0096, 0x2048,
+	0xa9ac, 0xa834, 0x9112, 0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022,
+	0x7226, 0x792c, 0x9180, 0x0011, 0x2004, 0xd0fc, 0x1148, 0x9180,
+	0x0000, 0x2004, 0x908e, 0x0002, 0x0130, 0x908e, 0x0004, 0x0118,
+	0x2009, 0x4000, 0x0008, 0x900e, 0x712a, 0x60c3, 0x0018, 0x002e,
+	0x00de, 0x0804, 0x8f87, 0x00b6, 0x0036, 0x0046, 0x0056, 0x0066,
+	0x080c, 0x8d6b, 0x9006, 0x7003, 0x0200, 0x7938, 0x710a, 0x793c,
+	0x710e, 0x7810, 0x2058, 0xb8a0, 0x080c, 0x9b66, 0x1118, 0x9092,
+	0x007e, 0x0268, 0x00d6, 0x2069, 0x181e, 0x2d2c, 0x8d68, 0x2d34,
+	0x90d8, 0x1000, 0x2b5c, 0xbb10, 0xbc14, 0x00de, 0x0028, 0x901e,
+	0xbc84, 0x2029, 0x0000, 0x6634, 0x782c, 0x9080, 0x0008, 0x2004,
+	0x9086, 0x0003, 0x1128, 0x7512, 0x7616, 0x731a, 0x741e, 0x0020,
+	0x7312, 0x7416, 0x751a, 0x761e, 0x006e, 0x005e, 0x004e, 0x003e,
+	0x00be, 0x0005, 0x080c, 0x8d6b, 0x7003, 0x0100, 0x782c, 0x700a,
+	0x7814, 0x700e, 0x700e, 0x60c3, 0x0008, 0x0804, 0x8f87, 0x080c,
+	0x8d17, 0x7003, 0x1400, 0x7838, 0x700a, 0x0079, 0x783c, 0x700e,
+	0x782c, 0x7012, 0x7830, 0x7016, 0x7834, 0x9084, 0x00ff, 0x8007,
+	0x701a, 0x60c3, 0x0010, 0x0804, 0x8f87, 0x00e6, 0x2071, 0x0240,
+	0x0006, 0x00f6, 0x2078, 0x7810, 0x00b6, 0x2058, 0xb8c4, 0xd084,
+	0x0120, 0x7850, 0x702a, 0x784c, 0x702e, 0x00be, 0x00fe, 0x000e,
+	0x00ee, 0x0005, 0x080c, 0x8d62, 0x7003, 0x0100, 0x782c, 0x700a,
+	0x7814, 0x700e, 0x60c3, 0x0008, 0x0804, 0x8f87, 0x00a9, 0x7914,
+	0x712a, 0x60c3, 0x0000, 0x60a7, 0x9575, 0x0026, 0x080c, 0x27a2,
+	0x0228, 0x2011, 0x0101, 0x2204, 0xc0c5, 0x2012, 0x002e, 0x080c,
+	0x8faa, 0x080c, 0x8202, 0x0005, 0x0036, 0x0096, 0x00d6, 0x00e6,
+	0x7860, 0x2048, 0xaa7c, 0x9296, 0x00c0, 0x9294, 0xfffd, 0xaa7e,
+	0xaa80, 0x9294, 0x0300, 0xaa82, 0xa96c, 0x9194, 0x00ff, 0xab74,
+	0x9384, 0x00ff, 0x908d, 0xc200, 0xa96e, 0x9384, 0xff00, 0x9215,
+	0xaa76, 0xa870, 0xaa78, 0xa87a, 0xaa72, 0x00d6, 0x2069, 0x0200,
+	0x080c, 0x97fa, 0x00de, 0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9,
+	0x000a, 0xa860, 0x20e0, 0xa85c, 0x9080, 0x001b, 0x2098, 0x4003,
+	0x60a3, 0x0035, 0xaa68, 0x9294, 0x7000, 0x9286, 0x3000, 0x0110,
+	0x60a3, 0x0037, 0x00ee, 0x00de, 0x009e, 0x003e, 0x0005, 0x900e,
+	0x7814, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x01c0, 0x9084, 0x0003,
+	0x11a8, 0x2001, 0x180c, 0x2004, 0xd0bc, 0x0180, 0x7824, 0xd0cc,
+	0x1168, 0xd0c4, 0x1158, 0xa8a8, 0x9005, 0x1140, 0x2001, 0x180c,
+	0x200c, 0xc1d5, 0x2102, 0x2009, 0x1983, 0x210c, 0x009e, 0x918d,
+	0x0092, 0x0010, 0x2009, 0x0096, 0x60ab, 0x0036, 0x0026, 0x2110,
+	0x900e, 0x080c, 0x287c, 0x002e, 0x0005, 0x2009, 0x0009, 0x00a0,
+	0x2009, 0x000a, 0x0088, 0x2009, 0x000b, 0x0070, 0x2009, 0x000c,
+	0x0058, 0x2009, 0x000d, 0x0040, 0x2009, 0x000e, 0x0028, 0x2009,
+	0x000f, 0x0010, 0x2009, 0x0008, 0x6912, 0x0005, 0x00d6, 0x9290,
+	0x0018, 0x8214, 0x20e9, 0x0000, 0x2069, 0x0200, 0x6813, 0x0000,
+	0x22a8, 0x9284, 0x00e0, 0x0128, 0x20a9, 0x0020, 0x9292, 0x0020,
+	0x0008, 0x9016, 0x20a1, 0x0240, 0x9006, 0x4004, 0x82ff, 0x0120,
+	0x6810, 0x8000, 0x6812, 0x0c60, 0x00de, 0x0005, 0x00f6, 0x00e6,
+	0x00d6, 0x00c6, 0x00a6, 0x0096, 0x0066, 0x0126, 0x2091, 0x8000,
+	0x2071, 0x19b8, 0x7610, 0x2660, 0x2678, 0x8cff, 0x0904, 0x98a5,
+	0x7030, 0x9c06, 0x1520, 0x2069, 0x0100, 0x68c0, 0x9005, 0x0904,
+	0x987c, 0x080c, 0x8fb7, 0x68c3, 0x0000, 0x080c, 0x94a2, 0x7033,
 	0x0000, 0x0036, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000, 0x0138,
 	0x2001, 0x0100, 0x080c, 0x2833, 0x9006, 0x080c, 0x2833, 0x2069,
-	0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x7020,
-	0x9c36, 0x1110, 0x660c, 0x7622, 0x701c, 0x9c36, 0x1140, 0x2c00,
-	0x9f36, 0x0118, 0x2f00, 0x701e, 0x0010, 0x701f, 0x0000, 0x660c,
-	0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x89ff,
-	0x1168, 0x600f, 0x0000, 0x6014, 0x0096, 0x2048, 0x080c, 0xb82a,
-	0x0110, 0x080c, 0xd1fc, 0x009e, 0x080c, 0x9c06, 0x080c, 0x935d,
-	0x88ff, 0x1190, 0x00ce, 0x0804, 0x9378, 0x2c78, 0x600c, 0x2060,
-	0x0804, 0x9378, 0x9006, 0x012e, 0x000e, 0x006e, 0x007e, 0x00ce,
-	0x00de, 0x00ee, 0x00fe, 0x0005, 0x601b, 0x0000, 0x00ce, 0x98c5,
-	0x0001, 0x0c88, 0x00f6, 0x00e6, 0x00d6, 0x0096, 0x00c6, 0x0066,
-	0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x7648,
-	0x2660, 0x2678, 0x8cff, 0x0904, 0x9476, 0x6020, 0x9086, 0x0006,
-	0x1904, 0x9471, 0x87ff, 0x0128, 0x2700, 0x9c06, 0x1904, 0x9471,
-	0x0040, 0x6010, 0x9b06, 0x15e8, 0x85ff, 0x0118, 0x605c, 0x9106,
-	0x15c0, 0x704c, 0x9c06, 0x1168, 0x0036, 0x2019, 0x0001, 0x080c,
-	0x926b, 0x703f, 0x0000, 0x9006, 0x704e, 0x706a, 0x7052, 0x706e,
-	0x003e, 0x7048, 0x9c36, 0x1110, 0x660c, 0x764a, 0x7044, 0x9c36,
-	0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7046, 0x0010, 0x7047,
-	0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008,
-	0x2678, 0x600f, 0x0000, 0x6014, 0x2048, 0x080c, 0xb82a, 0x0110,
-	0x080c, 0xd1fc, 0x080c, 0x9c06, 0x87ff, 0x1198, 0x00ce, 0x0804,
-	0x9422, 0x2c78, 0x600c, 0x2060, 0x0804, 0x9422, 0x9006, 0x012e,
-	0x000e, 0x002e, 0x006e, 0x00ce, 0x009e, 0x00de, 0x00ee, 0x00fe,
-	0x0005, 0x601b, 0x0000, 0x00ce, 0x97bd, 0x0001, 0x0c80, 0x00e6,
-	0x2071, 0x19b8, 0x7033, 0x0000, 0x7004, 0x9086, 0x0003, 0x0158,
-	0x2001, 0x1800, 0x2004, 0x9086, 0x0002, 0x1118, 0x7007, 0x0005,
-	0x0010, 0x7007, 0x0000, 0x00ee, 0x0005, 0x00f6, 0x00e6, 0x00c6,
-	0x0066, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8,
-	0x2c10, 0x7648, 0x2660, 0x2678, 0x8cff, 0x0518, 0x2200, 0x9c06,
-	0x11e0, 0x7048, 0x9c36, 0x1110, 0x660c, 0x764a, 0x7044, 0x9c36,
-	0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x7046, 0x0010, 0x7047,
-	0x0000, 0x660c, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678,
-	0x600f, 0x0000, 0x9085, 0x0001, 0x0020, 0x2c78, 0x600c, 0x2060,
-	0x08d8, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00ee, 0x00fe,
-	0x0005, 0x0096, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x0066, 0x0026,
-	0x0006, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x7610, 0x2660,
-	0x2678, 0x8cff, 0x0904, 0x9569, 0x6010, 0x00b6, 0x2058, 0xb8a0,
-	0x00be, 0x9206, 0x1904, 0x9564, 0x7030, 0x9c06, 0x1520, 0x2069,
-	0x0100, 0x68c0, 0x9005, 0x0904, 0x9540, 0x080c, 0x8f9c, 0x68c3,
-	0x0000, 0x080c, 0x9487, 0x7033, 0x0000, 0x0036, 0x2069, 0x0140,
+	0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x003e, 0x7010,
+	0x9c36, 0x1110, 0x660c, 0x7612, 0x700c, 0x9c36, 0x1140, 0x2c00,
+	0x9f36, 0x0118, 0x2f00, 0x700e, 0x0010, 0x700f, 0x0000, 0x660c,
+	0x0066, 0x2c00, 0x9f06, 0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f,
+	0x0000, 0x080c, 0xba4b, 0x1158, 0x080c, 0x303b, 0x080c, 0xba5c,
+	0x11f0, 0x080c, 0xa58f, 0x00d8, 0x080c, 0x94a2, 0x08c0, 0x080c,
+	0xba5c, 0x1118, 0x080c, 0xa58f, 0x0090, 0x6014, 0x2048, 0x080c,
+	0xb845, 0x0168, 0x6020, 0x9086, 0x0003, 0x1520, 0xa867, 0x0103,
+	0xab7a, 0xa877, 0x0000, 0x080c, 0x6996, 0x080c, 0xba36, 0x080c,
+	0xbcd3, 0x080c, 0x9c21, 0x080c, 0x9378, 0x00ce, 0x0804, 0x982d,
+	0x2c78, 0x600c, 0x2060, 0x0804, 0x982d, 0x7013, 0x0000, 0x700f,
+	0x0000, 0x012e, 0x006e, 0x009e, 0x00ae, 0x00ce, 0x00de, 0x00ee,
+	0x00fe, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d08, 0x080c, 0xd21e,
+	0x08f0, 0x00f6, 0x0036, 0x2079, 0x0380, 0x7b18, 0xd3bc, 0x1de8,
+	0x7832, 0x7936, 0x7a3a, 0x781b, 0x8080, 0x003e, 0x00fe, 0x0005,
+	0x0016, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0001,
+	0x1188, 0x2001, 0x0015, 0x0c29, 0x2009, 0x1000, 0x2001, 0x0382,
+	0x2004, 0x9084, 0x0007, 0x9086, 0x0003, 0x0120, 0x8109, 0x1db0,
+	0x080c, 0x0d65, 0x001e, 0x0005, 0x2001, 0x0382, 0x2004, 0x9084,
+	0x0007, 0x9086, 0x0003, 0x1120, 0x2001, 0x0380, 0x2003, 0x0001,
+	0x0005, 0x0156, 0x0016, 0x0026, 0x00e6, 0x900e, 0x2071, 0x19b8,
+	0x0469, 0x0106, 0x0190, 0x7004, 0x9086, 0x0003, 0x0148, 0x20a9,
+	0x1000, 0x6044, 0xd0fc, 0x01d8, 0x1f04, 0x9901, 0x080c, 0x0d65,
+	0x080c, 0x98c8, 0x6044, 0xd0fc, 0x0190, 0x7030, 0x9c06, 0x1148,
+	0x080c, 0x8874, 0x6044, 0xd0dc, 0x0150, 0xc0dc, 0x6046, 0x700a,
+	0x7042, 0x704c, 0x9c06, 0x190c, 0x0d65, 0x080c, 0x88d1, 0x010e,
+	0x1919, 0x00ee, 0x002e, 0x001e, 0x015e, 0x0005, 0x2001, 0x0382,
+	0x2004, 0x9084, 0x0007, 0x9086, 0x0003, 0x0005, 0x0126, 0x2091,
+	0x2400, 0x7808, 0xd0a4, 0x190c, 0x0d5e, 0xd09c, 0x0128, 0x7820,
+	0x908c, 0xf000, 0x11b8, 0x0012, 0x012e, 0x0005, 0x994e, 0x998c,
+	0x99b3, 0x99e3, 0x99f3, 0x9a04, 0x9a13, 0x9a21, 0x9a32, 0x9a36,
+	0x994e, 0x994e, 0x994e, 0x994e, 0x994e, 0x994e, 0x080c, 0x0d65,
+	0x012e, 0x0005, 0x2060, 0x6044, 0xd0bc, 0x0140, 0xc0bc, 0x6046,
+	0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d65, 0x0012, 0x012e, 0x0005,
+	0x9973, 0x9975, 0x9973, 0x997b, 0x9973, 0x9973, 0x9973, 0x9973,
+	0x9973, 0x9975, 0x9973, 0x9975, 0x9973, 0x9975, 0x9973, 0x9973,
+	0x9973, 0x9975, 0x9973, 0x080c, 0x0d65, 0x2009, 0x0013, 0x080c,
+	0x9c85, 0x012e, 0x0005, 0x6014, 0x2048, 0xa87c, 0xd0dc, 0x0130,
+	0x080c, 0x83c0, 0x080c, 0x9be7, 0x012e, 0x0005, 0x2009, 0x0049,
+	0x080c, 0x9c85, 0x012e, 0x0005, 0x080c, 0x98c8, 0x2001, 0x19dd,
+	0x2003, 0x0000, 0x7030, 0x9065, 0x090c, 0x0d65, 0x7034, 0x9092,
+	0x00c8, 0x1258, 0x8000, 0x7036, 0x7004, 0x9086, 0x0003, 0x0110,
+	0x7007, 0x0000, 0x781f, 0x0808, 0x0040, 0x080c, 0xd610, 0x6003,
+	0x0001, 0x2009, 0x0014, 0x080c, 0x9c85, 0x781f, 0x0100, 0x080c,
+	0x98e4, 0x012e, 0x0005, 0x080c, 0x98c8, 0x714c, 0x81ff, 0x1128,
+	0x2011, 0x19e0, 0x2013, 0x0000, 0x0400, 0x2061, 0x0100, 0x7150,
+	0x9192, 0x7530, 0x12b8, 0x8108, 0x7152, 0x714c, 0x9188, 0x0008,
+	0x210c, 0x918e, 0x0006, 0x1138, 0x6014, 0x9084, 0x1984, 0x9085,
+	0x0012, 0x6016, 0x0050, 0x6014, 0x9084, 0x1984, 0x9085, 0x0016,
+	0x6016, 0x0018, 0x706c, 0xc085, 0x706e, 0x781f, 0x0200, 0x080c,
+	0x98e4, 0x012e, 0x0005, 0x080c, 0x98c8, 0x714c, 0x2160, 0x6003,
+	0x0003, 0x2009, 0x004a, 0x080c, 0x9c85, 0x781f, 0x0200, 0x080c,
+	0x98e4, 0x012e, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x2060,
+	0x6003, 0x0003, 0x080c, 0x98c8, 0x080c, 0x1c02, 0x781f, 0x0400,
+	0x080c, 0x98e4, 0x012e, 0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820,
+	0x2060, 0x080c, 0x98c8, 0x080c, 0x1c4a, 0x781f, 0x0400, 0x080c,
+	0x98e4, 0x012e, 0x0005, 0x7030, 0x9065, 0x0148, 0x6044, 0xc0bc,
+	0x6046, 0x7104, 0x9186, 0x0003, 0x0110, 0x080c, 0x8937, 0x012e,
+	0x0005, 0x00f6, 0x703c, 0x9086, 0x0002, 0x0148, 0x704c, 0x907d,
+	0x0130, 0x7844, 0xc0bc, 0x7846, 0x080c, 0x8ee1, 0x0000, 0x00fe,
+	0x012e, 0x0005, 0x080c, 0x7158, 0x012e, 0x0005, 0x080c, 0x0d65,
+	0x0005, 0x00e6, 0x2071, 0x19b8, 0x6044, 0xc0bc, 0x6046, 0xd0fc,
+	0x01b8, 0x704c, 0x9c06, 0x1190, 0x2019, 0x0001, 0x080c, 0x9286,
+	0x704f, 0x0000, 0x2001, 0x0109, 0x2004, 0xd08c, 0x1138, 0x2001,
+	0x0108, 0x2004, 0xd0bc, 0x1110, 0x703f, 0x0000, 0x080c, 0x94b8,
+	0x00ee, 0x0005, 0x0026, 0x7010, 0x9c06, 0x1178, 0x080c, 0x9378,
+	0x6044, 0xc0fc, 0x6046, 0x600c, 0x9015, 0x0120, 0x7212, 0x600f,
+	0x0000, 0x0010, 0x7212, 0x720e, 0x9006, 0x002e, 0x0005, 0x0026,
+	0x7020, 0x9c06, 0x1178, 0x080c, 0x9378, 0x6044, 0xc0fc, 0x6046,
+	0x600c, 0x9015, 0x0120, 0x7222, 0x600f, 0x0000, 0x0010, 0x7222,
+	0x721e, 0x9006, 0x002e, 0x0005, 0x00d6, 0x0036, 0x7830, 0x9c06,
+	0x1558, 0x2069, 0x0100, 0x68c0, 0x9005, 0x01f8, 0x080c, 0x820b,
+	0x080c, 0x8fb7, 0x68c3, 0x0000, 0x080c, 0x94a2, 0x2069, 0x0140,
 	0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c, 0x2833,
 	0x9006, 0x080c, 0x2833, 0x2069, 0x0100, 0x6824, 0xd084, 0x0110,
-	0x6827, 0x0001, 0x003e, 0x7010, 0x9c36, 0x1110, 0x660c, 0x7612,
-	0x700c, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00, 0x700e,
-	0x0010, 0x700f, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06, 0x0110,
-	0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xba30, 0x1158,
-	0x080c, 0x3034, 0x080c, 0xba41, 0x11f0, 0x080c, 0xa574, 0x00d8,
-	0x080c, 0x9487, 0x08c0, 0x080c, 0xba41, 0x1118, 0x080c, 0xa574,
-	0x0090, 0x6014, 0x2048, 0x080c, 0xb82a, 0x0168, 0x6020, 0x9086,
-	0x0003, 0x1508, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000, 0x080c,
-	0x6983, 0x080c, 0xba1b, 0x080c, 0xbcb8, 0x080c, 0x9c06, 0x080c,
-	0x935d, 0x00ce, 0x0804, 0x94e9, 0x2c78, 0x600c, 0x2060, 0x0804,
-	0x94e9, 0x012e, 0x000e, 0x002e, 0x006e, 0x00ce, 0x00de, 0x00ee,
-	0x00fe, 0x009e, 0x0005, 0x6020, 0x9086, 0x0006, 0x1d20, 0x080c,
-	0xd1fc, 0x0c08, 0x00d6, 0x080c, 0x8d43, 0x7003, 0x0200, 0x7007,
-	0x0014, 0x60c3, 0x0014, 0x20e1, 0x0001, 0x2099, 0x195a, 0x20e9,
-	0x0000, 0x20a1, 0x0250, 0x20a9, 0x0004, 0x4003, 0x7023, 0x0004,
-	0x7027, 0x7878, 0x080c, 0x8f6c, 0x00de, 0x0005, 0x080c, 0x8d43,
-	0x700b, 0x0800, 0x7814, 0x9084, 0xff00, 0x700e, 0x7814, 0x9084,
-	0x00ff, 0x7022, 0x782c, 0x7026, 0x7860, 0x9084, 0x00ff, 0x9085,
-	0x0200, 0x7002, 0x7860, 0x9084, 0xff00, 0x8007, 0x7006, 0x60c2,
-	0x0804, 0x8f6c, 0x00b6, 0x00d6, 0x0016, 0x00d6, 0x2f68, 0x2009,
-	0x0035, 0x080c, 0xbebe, 0x00de, 0x1904, 0x9617, 0x080c, 0x8cf8,
-	0x7003, 0x1300, 0x782c, 0x080c, 0x9722, 0x2068, 0x6820, 0x9086,
-	0x0003, 0x0560, 0x7810, 0x2058, 0xbaa0, 0x080c, 0x9b4b, 0x11d8,
-	0x9286, 0x007e, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffe, 0x0498,
-	0x9286, 0x007f, 0x1128, 0x700b, 0x00ff, 0x700f, 0xfffd, 0x0458,
-	0x9284, 0xff80, 0x0180, 0x9286, 0x0080, 0x1128, 0x700b, 0x00ff,
-	0x700f, 0xfffc, 0x0400, 0x92d8, 0x1000, 0x2b5c, 0xb810, 0x700a,
-	0xb814, 0x700e, 0x00c0, 0xb884, 0x700e, 0x00a8, 0x080c, 0x9b4b,
-	0x1130, 0x7810, 0x2058, 0xb8a0, 0x9082, 0x007e, 0x0250, 0x00d6,
-	0x2069, 0x181e, 0x2d04, 0x700a, 0x8d68, 0x2d04, 0x700e, 0x00de,
-	0x0010, 0x6034, 0x700e, 0x7838, 0x7012, 0x783c, 0x7016, 0x60c3,
-	0x000c, 0x001e, 0x00de, 0x080c, 0x8f6c, 0x00be, 0x0005, 0x781b,
-	0x0001, 0x7803, 0x0006, 0x001e, 0x00de, 0x00be, 0x0005, 0x792c,
-	0x9180, 0x0008, 0x200c, 0x9186, 0x0006, 0x01c0, 0x9186, 0x0003,
-	0x0904, 0x9695, 0x9186, 0x0005, 0x0904, 0x967d, 0x9186, 0x0004,
-	0x05f0, 0x9186, 0x0008, 0x0904, 0x9686, 0x7807, 0x0037, 0x782f,
-	0x0003, 0x7817, 0x1700, 0x080c, 0x96ff, 0x0005, 0x080c, 0x96c0,
-	0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x6800, 0x6a44,
-	0xd2fc, 0x11f8, 0x0002, 0x965e, 0x9669, 0x9660, 0x9669, 0x9665,
-	0x965e, 0x965e, 0x9669, 0x9669, 0x9669, 0x9669, 0x965e, 0x965e,
-	0x965e, 0x965e, 0x965e, 0x9669, 0x965e, 0x9669, 0x080c, 0x0d65,
-	0x6824, 0xd0e4, 0x0110, 0xd0cc, 0x0110, 0x900e, 0x0010, 0x2009,
-	0x2000, 0x682c, 0x7022, 0x6830, 0x7026, 0x0804, 0x96b9, 0x080c,
-	0x96c0, 0x00d6, 0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x6a00,
-	0x9286, 0x0002, 0x1108, 0x900e, 0x04e0, 0x080c, 0x96c0, 0x00d6,
-	0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x0498, 0x04c9, 0x00d6,
-	0x0026, 0x792c, 0x2168, 0x2009, 0x4000, 0x9286, 0x0005, 0x0118,
-	0x9286, 0x0002, 0x1108, 0x900e, 0x0420, 0x0451, 0x00d6, 0x0026,
-	0x792c, 0x2168, 0x6814, 0x0096, 0x2048, 0xa9ac, 0xa834, 0x9112,
-	0xa9b0, 0xa838, 0x009e, 0x9103, 0x7022, 0x7226, 0x792c, 0x9180,
-	0x0011, 0x2004, 0xd0fc, 0x1148, 0x9180, 0x0000, 0x2004, 0x908e,
-	0x0002, 0x0130, 0x908e, 0x0004, 0x0118, 0x2009, 0x4000, 0x0008,
-	0x900e, 0x712a, 0x60c3, 0x0018, 0x002e, 0x00de, 0x0804, 0x8f6c,
-	0x00b6, 0x0036, 0x0046, 0x0056, 0x0066, 0x080c, 0x8d43, 0x9006,
-	0x7003, 0x0200, 0x7938, 0x710a, 0x793c, 0x710e, 0x7810, 0x2058,
-	0xb8a0, 0x080c, 0x9b4b, 0x1118, 0x9092, 0x007e, 0x0268, 0x00d6,
-	0x2069, 0x181e, 0x2d2c, 0x8d68, 0x2d34, 0x90d8, 0x1000, 0x2b5c,
-	0xbb10, 0xbc14, 0x00de, 0x0028, 0x901e, 0xbc84, 0x2029, 0x0000,
-	0x6634, 0x782c, 0x9080, 0x0008, 0x2004, 0x9086, 0x0003, 0x1128,
-	0x7512, 0x7616, 0x731a, 0x741e, 0x0020, 0x7312, 0x7416, 0x751a,
-	0x761e, 0x006e, 0x005e, 0x004e, 0x003e, 0x00be, 0x0005, 0x080c,
-	0x8d43, 0x7003, 0x0100, 0x782c, 0x700a, 0x7814, 0x700e, 0x700e,
-	0x60c3, 0x0008, 0x0804, 0x8f6c, 0x080c, 0x8cef, 0x7003, 0x1400,
-	0x7838, 0x700a, 0x0079, 0x783c, 0x700e, 0x782c, 0x7012, 0x7830,
-	0x7016, 0x7834, 0x9084, 0x00ff, 0x8007, 0x701a, 0x60c3, 0x0010,
-	0x0804, 0x8f6c, 0x00e6, 0x2071, 0x0240, 0x0006, 0x00f6, 0x2078,
-	0x7810, 0x00b6, 0x2058, 0xb8c4, 0xd084, 0x0120, 0x7850, 0x702a,
-	0x784c, 0x702e, 0x00be, 0x00fe, 0x000e, 0x00ee, 0x0005, 0x080c,
-	0x8d3a, 0x7003, 0x0100, 0x782c, 0x700a, 0x7814, 0x700e, 0x60c3,
-	0x0008, 0x0804, 0x8f6c, 0x00a9, 0x7914, 0x712a, 0x60c3, 0x0000,
-	0x60a7, 0x9575, 0x0026, 0x080c, 0x27a2, 0x0228, 0x2011, 0x0101,
-	0x2204, 0xc0c5, 0x2012, 0x002e, 0x080c, 0x8f8f, 0x080c, 0x81da,
-	0x0005, 0x0036, 0x0096, 0x00d6, 0x00e6, 0x7860, 0x2048, 0xaa7c,
-	0x9296, 0x00c0, 0x9294, 0xfffd, 0xaa7e, 0xaa80, 0x9294, 0x0300,
-	0xaa82, 0xa96c, 0x9194, 0x00ff, 0xab74, 0x9384, 0x00ff, 0x908d,
-	0xc200, 0xa96e, 0x9384, 0xff00, 0x9215, 0xaa76, 0xa870, 0xaa78,
-	0xa87a, 0xaa72, 0x00d6, 0x2069, 0x0200, 0x080c, 0x97df, 0x00de,
-	0x20e9, 0x0000, 0x20a1, 0x0240, 0x20a9, 0x000a, 0xa860, 0x20e0,
-	0xa85c, 0x9080, 0x001b, 0x2098, 0x4003, 0x60a3, 0x0035, 0xaa68,
-	0x9294, 0x7000, 0x9286, 0x3000, 0x0110, 0x60a3, 0x0037, 0x00ee,
-	0x00de, 0x009e, 0x003e, 0x0005, 0x900e, 0x7814, 0x0096, 0x2048,
-	0xa87c, 0xd0fc, 0x01c0, 0x9084, 0x0003, 0x11a8, 0x2001, 0x180c,
-	0x2004, 0xd0bc, 0x0180, 0x7824, 0xd0cc, 0x1168, 0xd0c4, 0x1158,
-	0xa8a8, 0x9005, 0x1140, 0x2001, 0x180c, 0x200c, 0xc1d5, 0x2102,
-	0x2009, 0x1983, 0x210c, 0x009e, 0x918d, 0x0092, 0x0010, 0x2009,
-	0x0096, 0x60ab, 0x0036, 0x0026, 0x2110, 0x900e, 0x080c, 0x287c,
-	0x002e, 0x0005, 0x2009, 0x0009, 0x00a0, 0x2009, 0x000a, 0x0088,
-	0x2009, 0x000b, 0x0070, 0x2009, 0x000c, 0x0058, 0x2009, 0x000d,
-	0x0040, 0x2009, 0x000e, 0x0028, 0x2009, 0x000f, 0x0010, 0x2009,
-	0x0008, 0x6912, 0x0005, 0x00d6, 0x9290, 0x0018, 0x8214, 0x20e9,
-	0x0000, 0x2069, 0x0200, 0x6813, 0x0000, 0x22a8, 0x9284, 0x00e0,
-	0x0128, 0x20a9, 0x0020, 0x9292, 0x0020, 0x0008, 0x9016, 0x20a1,
-	0x0240, 0x9006, 0x4004, 0x82ff, 0x0120, 0x6810, 0x8000, 0x6812,
-	0x0c60, 0x00de, 0x0005, 0x00f6, 0x00e6, 0x00d6, 0x00c6, 0x00a6,
-	0x0096, 0x0066, 0x0126, 0x2091, 0x8000, 0x2071, 0x19b8, 0x7610,
-	0x2660, 0x2678, 0x8cff, 0x0904, 0x988a, 0x7030, 0x9c06, 0x1520,
-	0x2069, 0x0100, 0x68c0, 0x9005, 0x0904, 0x9861, 0x080c, 0x8f9c,
-	0x68c3, 0x0000, 0x080c, 0x9487, 0x7033, 0x0000, 0x0036, 0x2069,
-	0x0140, 0x6b04, 0x9384, 0x1000, 0x0138, 0x2001, 0x0100, 0x080c,
-	0x2833, 0x9006, 0x080c, 0x2833, 0x2069, 0x0100, 0x6824, 0xd084,
-	0x0110, 0x6827, 0x0001, 0x003e, 0x7010, 0x9c36, 0x1110, 0x660c,
-	0x7612, 0x700c, 0x9c36, 0x1140, 0x2c00, 0x9f36, 0x0118, 0x2f00,
-	0x700e, 0x0010, 0x700f, 0x0000, 0x660c, 0x0066, 0x2c00, 0x9f06,
-	0x0110, 0x7e0e, 0x0008, 0x2678, 0x600f, 0x0000, 0x080c, 0xba30,
-	0x1158, 0x080c, 0x3034, 0x080c, 0xba41, 0x11f0, 0x080c, 0xa574,
-	0x00d8, 0x080c, 0x9487, 0x08c0, 0x080c, 0xba41, 0x1118, 0x080c,
-	0xa574, 0x0090, 0x6014, 0x2048, 0x080c, 0xb82a, 0x0168, 0x6020,
-	0x9086, 0x0003, 0x1520, 0xa867, 0x0103, 0xab7a, 0xa877, 0x0000,
-	0x080c, 0x698f, 0x080c, 0xba1b, 0x080c, 0xbcb8, 0x080c, 0x9c06,
-	0x080c, 0x935d, 0x00ce, 0x0804, 0x9812, 0x2c78, 0x600c, 0x2060,
-	0x0804, 0x9812, 0x7013, 0x0000, 0x700f, 0x0000, 0x012e, 0x006e,
-	0x009e, 0x00ae, 0x00ce, 0x00de, 0x00ee, 0x00fe, 0x0005, 0x6020,
-	0x9086, 0x0006, 0x1d08, 0x080c, 0xd1fc, 0x08f0, 0x00f6, 0x0036,
-	0x2079, 0x0380, 0x7b18, 0xd3bc, 0x1de8, 0x7832, 0x7936, 0x7a3a,
-	0x781b, 0x8080, 0x003e, 0x00fe, 0x0005, 0x0016, 0x2001, 0x0382,
-	0x2004, 0x9084, 0x0007, 0x9086, 0x0001, 0x1188, 0x2001, 0x0015,
-	0x0c29, 0x2009, 0x1000, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007,
-	0x9086, 0x0003, 0x0120, 0x8109, 0x1db0, 0x080c, 0x0d65, 0x001e,
-	0x0005, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007, 0x9086, 0x0003,
-	0x1120, 0x2001, 0x0380, 0x2003, 0x0001, 0x0005, 0x0156, 0x0016,
-	0x0026, 0x00e6, 0x900e, 0x2071, 0x19b8, 0x0469, 0x0106, 0x0190,
-	0x7004, 0x9086, 0x0003, 0x0148, 0x20a9, 0x1000, 0x6044, 0xd0fc,
-	0x01d8, 0x1f04, 0x98e6, 0x080c, 0x0d65, 0x080c, 0x98ad, 0x6044,
-	0xd0fc, 0x0190, 0x7030, 0x9c06, 0x1148, 0x080c, 0x884c, 0x6044,
-	0xd0dc, 0x0150, 0xc0dc, 0x6046, 0x700a, 0x7042, 0x704c, 0x9c06,
-	0x190c, 0x0d65, 0x080c, 0x88a9, 0x010e, 0x1919, 0x00ee, 0x002e,
-	0x001e, 0x015e, 0x0005, 0x2001, 0x0382, 0x2004, 0x9084, 0x0007,
-	0x9086, 0x0003, 0x0005, 0x0126, 0x2091, 0x2400, 0x7808, 0xd0a4,
-	0x190c, 0x0d5e, 0xd09c, 0x0128, 0x7820, 0x908c, 0xf000, 0x11b8,
-	0x0012, 0x012e, 0x0005, 0x9933, 0x9971, 0x9998, 0x99c8, 0x99d8,
-	0x99e9, 0x99f8, 0x9a06, 0x9a17, 0x9a1b, 0x9933, 0x9933, 0x9933,
-	0x9933, 0x9933, 0x9933, 0x080c, 0x0d65, 0x012e, 0x0005, 0x2060,
-	0x6044, 0xd0bc, 0x0140, 0xc0bc, 0x6046, 0x6000, 0x908a, 0x0016,
-	0x1a0c, 0x0d65, 0x0012, 0x012e, 0x0005, 0x9958, 0x995a, 0x9958,
-	0x9960, 0x9958, 0x9958, 0x9958, 0x9958, 0x9958, 0x995a, 0x9958,
-	0x995a, 0x9958, 0x995a, 0x9958, 0x9958, 0x9958, 0x995a, 0x9958,
-	0x080c, 0x0d65, 0x2009, 0x0013, 0x080c, 0x9c6a, 0x012e, 0x0005,
-	0x6014, 0x2048, 0xa87c, 0xd0dc, 0x0130, 0x080c, 0x8398, 0x080c,
-	0x9bcc, 0x012e, 0x0005, 0x2009, 0x0049, 0x080c, 0x9c6a, 0x012e,
-	0x0005, 0x080c, 0x98ad, 0x2001, 0x19dd, 0x2003, 0x0000, 0x7030,
-	0x9065, 0x090c, 0x0d65, 0x7034, 0x9092, 0x00c8, 0x1258, 0x8000,
-	0x7036, 0x7004, 0x9086, 0x0003, 0x0110, 0x7007, 0x0000, 0x781f,
-	0x0808, 0x0040, 0x080c, 0xd5ee, 0x6003, 0x0001, 0x2009, 0x0014,
-	0x080c, 0x9c6a, 0x781f, 0x0100, 0x080c, 0x98c9, 0x012e, 0x0005,
-	0x080c, 0x98ad, 0x714c, 0x81ff, 0x1128, 0x2011, 0x19e0, 0x2013,
-	0x0000, 0x0400, 0x2061, 0x0100, 0x7150, 0x9192, 0x7530, 0x12b8,
-	0x8108, 0x7152, 0x714c, 0x9188, 0x0008, 0x210c, 0x918e, 0x0006,
-	0x1138, 0x6014, 0x9084, 0x1984, 0x9085, 0x0012, 0x6016, 0x0050,
-	0x6014, 0x9084, 0x1984, 0x9085, 0x0016, 0x6016, 0x0018, 0x706c,
-	0xc085, 0x706e, 0x781f, 0x0200, 0x080c, 0x98c9, 0x012e, 0x0005,
-	0x080c, 0x98ad, 0x714c, 0x2160, 0x6003, 0x0003, 0x2009, 0x004a,
-	0x080c, 0x9c6a, 0x781f, 0x0200, 0x080c, 0x98c9, 0x012e, 0x0005,
-	0x7808, 0xd09c, 0x0de8, 0x7820, 0x2060, 0x6003, 0x0003, 0x080c,
-	0x98ad, 0x080c, 0x1c02, 0x781f, 0x0400, 0x080c, 0x98c9, 0x012e,
-	0x0005, 0x7808, 0xd09c, 0x0de8, 0x7820, 0x2060, 0x080c, 0x98ad,
-	0x080c, 0x1c4a, 0x781f, 0x0400, 0x080c, 0x98c9, 0x012e, 0x0005,
-	0x7030, 0x9065, 0x0148, 0x6044, 0xc0bc, 0x6046, 0x7104, 0x9186,
-	0x0003, 0x0110, 0x080c, 0x890f, 0x012e, 0x0005, 0x00f6, 0x703c,
-	0x9086, 0x0002, 0x0148, 0x704c, 0x907d, 0x0130, 0x7844, 0xc0bc,
-	0x7846, 0x080c, 0x8eb7, 0x0000, 0x00fe, 0x012e, 0x0005, 0x080c,
-	0x714d, 0x012e, 0x0005, 0x080c, 0x0d65, 0x0005, 0x00e6, 0x2071,
-	0x19b8, 0x6044, 0xc0bc, 0x6046, 0xd0fc, 0x01b8, 0x704c, 0x9c06,
-	0x1190, 0x2019, 0x0001, 0x080c, 0x926b, 0x704f, 0x0000, 0x2001,
-	0x0109, 0x2004, 0xd08c, 0x1138, 0x2001, 0x0108, 0x2004, 0xd0bc,
-	0x1110, 0x703f, 0x0000, 0x080c, 0x949d, 0x00ee, 0x0005, 0x0026,
-	0x7010, 0x9c06, 0x1178, 0x080c, 0x935d, 0x6044, 0xc0fc, 0x6046,
-	0x600c, 0x9015, 0x0120, 0x7212, 0x600f, 0x0000, 0x0010, 0x7212,
-	0x720e, 0x9006, 0x002e, 0x0005, 0x0026, 0x7020, 0x9c06, 0x1178,
-	0x080c, 0x935d, 0x6044, 0xc0fc, 0x6046, 0x600c, 0x9015, 0x0120,
-	0x7222, 0x600f, 0x0000, 0x0010, 0x7222, 0x721e, 0x9006, 0x002e,
-	0x0005, 0x00d6, 0x0036, 0x7830, 0x9c06, 0x1558, 0x2069, 0x0100,
-	0x68c0, 0x9005, 0x01f8, 0x080c, 0x81e3, 0x080c, 0x8f9c, 0x68c3,
-	0x0000, 0x080c, 0x9487, 0x2069, 0x0140, 0x6b04, 0x9384, 0x1000,
-	0x0138, 0x2001, 0x0100, 0x080c, 0x2833, 0x9006, 0x080c, 0x2833,
-	0x2069, 0x0100, 0x6824, 0xd084, 0x0110, 0x6827, 0x0001, 0x9085,
-	0x0001, 0x0038, 0x7808, 0xc0ad, 0x780a, 0x6003, 0x0009, 0x630a,
-	0x9006, 0x003e, 0x00de, 0x0005, 0x0016, 0x0026, 0x0036, 0x6100,
-	0x2019, 0x0100, 0x2001, 0x0382, 0x2004, 0xd09c, 0x0190, 0x00c6,
-	0x0126, 0x2091, 0x2800, 0x0016, 0x0036, 0x080c, 0x9913, 0x003e,
-	0x001e, 0x012e, 0x00ce, 0x6200, 0x2200, 0x9106, 0x0d58, 0x2200,
-	0x0010, 0x8319, 0x1d38, 0x003e, 0x002e, 0x001e, 0x0005, 0x00d6,
-	0x0156, 0x080c, 0x8d43, 0x7a14, 0x82ff, 0x0138, 0x7003, 0x0100,
-	0x700b, 0x0003, 0x60c3, 0x0008, 0x0490, 0x7003, 0x0200, 0x7007,
-	0x0000, 0x2069, 0x1800, 0x901e, 0x6800, 0x9086, 0x0004, 0x1110,
-	0xc38d, 0x0060, 0x080c, 0x70ac, 0x1110, 0xc3ad, 0x0008, 0xc3a5,
-	0x6ad8, 0xd29c, 0x1110, 0xd2ac, 0x0108, 0xc39d, 0x730e, 0x2011,
-	0x1848, 0x63f0, 0x2312, 0x20a9, 0x0006, 0x2011, 0x1840, 0x2019,
-	0x1841, 0x2071, 0x0250, 0x2376, 0x8e70, 0x2276, 0x8e70, 0x9398,
-	0x0002, 0x9290, 0x0002, 0x1f04, 0x9af3, 0x60c3, 0x0020, 0x080c,
-	0x8f6c, 0x015e, 0x00de, 0x0005, 0x0156, 0x080c, 0x8d43, 0x7a14,
-	0x82ff, 0x0168, 0x9286, 0xffff, 0x0118, 0x9282, 0x000e, 0x1238,
-	0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008, 0x0488, 0x7003,
-	0x0200, 0x7007, 0x001c, 0x700f, 0x0001, 0x2011, 0x198e, 0x2204,
-	0x8007, 0x701a, 0x8210, 0x2204, 0x8007, 0x701e, 0x0421, 0x1120,
-	0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001, 0x181e, 0x2004, 0x7022,
-	0x2001, 0x181f, 0x2004, 0x7026, 0x0030, 0x2001, 0x1817, 0x2004,
-	0x9084, 0x00ff, 0x7026, 0x20a9, 0x0004, 0x20e1, 0x0001, 0x2099,
-	0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256, 0x4003, 0x60c3, 0x001c,
-	0x015e, 0x0804, 0x8f6c, 0x0006, 0x2001, 0x1836, 0x2004, 0xd0ac,
-	0x000e, 0x0005, 0x2011, 0x0003, 0x080c, 0x931e, 0x2011, 0x0002,
-	0x080c, 0x9328, 0x080c, 0x91eb, 0x0036, 0x901e, 0x080c, 0x926b,
-	0x003e, 0x0005, 0x2071, 0x1883, 0x7000, 0x9005, 0x0140, 0x2001,
-	0x0812, 0x2071, 0x1800, 0x7072, 0x7076, 0x7067, 0xffd4, 0x2071,
-	0x1800, 0x7070, 0x7052, 0x7057, 0x1ddc, 0x0005, 0x00e6, 0x0126,
-	0x2071, 0x1800, 0x2091, 0x8000, 0x7550, 0x9582, 0x0010, 0x0608,
-	0x7054, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c,
-	0x7064, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003,
-	0x0008, 0x8529, 0x7552, 0x9ca8, 0x001c, 0x7064, 0x9502, 0x1230,
-	0x7556, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x7057, 0x1ddc,
-	0x0cc0, 0x9006, 0x0cc0, 0x00e6, 0x2071, 0x1800, 0x7550, 0x9582,
-	0x0010, 0x0600, 0x7054, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148,
+	0x6827, 0x0001, 0x9085, 0x0001, 0x0038, 0x7808, 0xc0ad, 0x780a,
+	0x6003, 0x0009, 0x630a, 0x9006, 0x003e, 0x00de, 0x0005, 0x0016,
+	0x0026, 0x0036, 0x6100, 0x2019, 0x0100, 0x2001, 0x0382, 0x2004,
+	0xd09c, 0x0190, 0x00c6, 0x0126, 0x2091, 0x2800, 0x0016, 0x0036,
+	0x080c, 0x992e, 0x003e, 0x001e, 0x012e, 0x00ce, 0x6200, 0x2200,
+	0x9106, 0x0d58, 0x2200, 0x0010, 0x8319, 0x1d38, 0x003e, 0x002e,
+	0x001e, 0x0005, 0x00d6, 0x0156, 0x080c, 0x8d6b, 0x7a14, 0x82ff,
+	0x0138, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3, 0x0008, 0x0490,
+	0x7003, 0x0200, 0x7007, 0x0000, 0x2069, 0x1800, 0x901e, 0x6800,
+	0x9086, 0x0004, 0x1110, 0xc38d, 0x0060, 0x080c, 0x70b7, 0x1110,
+	0xc3ad, 0x0008, 0xc3a5, 0x6ad8, 0xd29c, 0x1110, 0xd2ac, 0x0108,
+	0xc39d, 0x730e, 0x2011, 0x1848, 0x63f0, 0x2312, 0x20a9, 0x0006,
+	0x2011, 0x1840, 0x2019, 0x1841, 0x2071, 0x0250, 0x2376, 0x8e70,
+	0x2276, 0x8e70, 0x9398, 0x0002, 0x9290, 0x0002, 0x1f04, 0x9b0e,
+	0x60c3, 0x0020, 0x080c, 0x8f87, 0x015e, 0x00de, 0x0005, 0x0156,
+	0x080c, 0x8d6b, 0x7a14, 0x82ff, 0x0168, 0x9286, 0xffff, 0x0118,
+	0x9282, 0x000e, 0x1238, 0x7003, 0x0100, 0x700b, 0x0003, 0x60c3,
+	0x0008, 0x0488, 0x7003, 0x0200, 0x7007, 0x001c, 0x700f, 0x0001,
+	0x2011, 0x198e, 0x2204, 0x8007, 0x701a, 0x8210, 0x2204, 0x8007,
+	0x701e, 0x0421, 0x1120, 0xb8a0, 0x9082, 0x007f, 0x0248, 0x2001,
+	0x181e, 0x2004, 0x7022, 0x2001, 0x181f, 0x2004, 0x7026, 0x0030,
+	0x2001, 0x1817, 0x2004, 0x9084, 0x00ff, 0x7026, 0x20a9, 0x0004,
+	0x20e1, 0x0001, 0x2099, 0x1805, 0x20e9, 0x0000, 0x20a1, 0x0256,
+	0x4003, 0x60c3, 0x001c, 0x015e, 0x0804, 0x8f87, 0x0006, 0x2001,
+	0x1836, 0x2004, 0xd0ac, 0x000e, 0x0005, 0x2011, 0x0003, 0x080c,
+	0x9339, 0x2011, 0x0002, 0x080c, 0x9343, 0x080c, 0x9206, 0x0036,
+	0x901e, 0x080c, 0x9286, 0x003e, 0x0005, 0x2071, 0x1883, 0x7000,
+	0x9005, 0x0140, 0x2001, 0x0812, 0x2071, 0x1800, 0x7072, 0x7076,
+	0x7067, 0xffd4, 0x2071, 0x1800, 0x7070, 0x7052, 0x7057, 0x1ddc,
+	0x0005, 0x00e6, 0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7550,
+	0x9582, 0x0010, 0x0608, 0x7054, 0x2060, 0x6000, 0x9086, 0x0000,
+	0x0148, 0x9ce0, 0x001c, 0x7064, 0x9c02, 0x1208, 0x0cb0, 0x2061,
+	0x1ddc, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7552, 0x9ca8, 0x001c,
+	0x7064, 0x9502, 0x1230, 0x7556, 0x9085, 0x0001, 0x012e, 0x00ee,
+	0x0005, 0x7057, 0x1ddc, 0x0cc0, 0x9006, 0x0cc0, 0x00e6, 0x2071,
+	0x1800, 0x7550, 0x9582, 0x0010, 0x0600, 0x7054, 0x2060, 0x6000,
+	0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c, 0x7064, 0x9c02, 0x1208,
+	0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003, 0x0008, 0x8529, 0x7552,
+	0x9ca8, 0x001c, 0x7064, 0x9502, 0x1228, 0x7556, 0x9085, 0x0001,
+	0x00ee, 0x0005, 0x7057, 0x1ddc, 0x0cc8, 0x9006, 0x0cc8, 0x9c82,
+	0x1ddc, 0x0a0c, 0x0d65, 0x2001, 0x1819, 0x2004, 0x9c02, 0x1a0c,
+	0x0d65, 0x9006, 0x6006, 0x600a, 0x600e, 0x6016, 0x601a, 0x6012,
+	0x6023, 0x0000, 0x6003, 0x0000, 0x601e, 0x605e, 0x6062, 0x6026,
+	0x602a, 0x602e, 0x6032, 0x6036, 0x603a, 0x603e, 0x604a, 0x6046,
+	0x6042, 0x2061, 0x1800, 0x6050, 0x8000, 0x6052, 0x0005, 0x9006,
+	0x600e, 0x6016, 0x601a, 0x6012, 0x6022, 0x6002, 0x601e, 0x605e,
+	0x6062, 0x604a, 0x6046, 0x2061, 0x1800, 0x6050, 0x8000, 0x6052,
+	0x0005, 0x0006, 0x6000, 0x9086, 0x0000, 0x01d0, 0x601c, 0xd084,
+	0x190c, 0x1914, 0x6023, 0x0007, 0x2001, 0x1957, 0x2004, 0x0006,
+	0x9082, 0x0051, 0x000e, 0x0208, 0x8004, 0x601a, 0x080c, 0xd4ce,
+	0x604b, 0x0000, 0x6044, 0xd0fc, 0x1129, 0x9006, 0x6046, 0x6016,
+	0x000e, 0x0005, 0x080c, 0x9926, 0x0106, 0x190c, 0x98c8, 0x2001,
+	0x19cb, 0x2004, 0x9c06, 0x1130, 0x0036, 0x2019, 0x0001, 0x080c,
+	0x9286, 0x003e, 0x080c, 0x94b8, 0x010e, 0x190c, 0x98e4, 0x0005,
+	0x00e6, 0x0126, 0x2071, 0x1800, 0x2091, 0x8000, 0x7550, 0x9582,
+	0x0001, 0x0608, 0x7054, 0x2060, 0x6000, 0x9086, 0x0000, 0x0148,
 	0x9ce0, 0x001c, 0x7064, 0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc,
 	0x0c98, 0x6003, 0x0008, 0x8529, 0x7552, 0x9ca8, 0x001c, 0x7064,
-	0x9502, 0x1228, 0x7556, 0x9085, 0x0001, 0x00ee, 0x0005, 0x7057,
-	0x1ddc, 0x0cc8, 0x9006, 0x0cc8, 0x9c82, 0x1ddc, 0x0a0c, 0x0d65,
-	0x2001, 0x1819, 0x2004, 0x9c02, 0x1a0c, 0x0d65, 0x9006, 0x6006,
-	0x600a, 0x600e, 0x6016, 0x601a, 0x6012, 0x6023, 0x0000, 0x6003,
-	0x0000, 0x601e, 0x605e, 0x6062, 0x6026, 0x602a, 0x602e, 0x6032,
-	0x6036, 0x603a, 0x603e, 0x604a, 0x6046, 0x6042, 0x2061, 0x1800,
-	0x6050, 0x8000, 0x6052, 0x0005, 0x9006, 0x600e, 0x6016, 0x601a,
-	0x6012, 0x6022, 0x6002, 0x601e, 0x605e, 0x6062, 0x604a, 0x6046,
-	0x2061, 0x1800, 0x6050, 0x8000, 0x6052, 0x0005, 0x0006, 0x6000,
-	0x9086, 0x0000, 0x01d0, 0x601c, 0xd084, 0x190c, 0x1914, 0x6023,
-	0x0007, 0x2001, 0x1957, 0x2004, 0x0006, 0x9082, 0x0051, 0x000e,
-	0x0208, 0x8004, 0x601a, 0x080c, 0xd4ac, 0x604b, 0x0000, 0x6044,
-	0xd0fc, 0x1129, 0x9006, 0x6046, 0x6016, 0x000e, 0x0005, 0x080c,
-	0x990b, 0x0106, 0x190c, 0x98ad, 0x2001, 0x19cb, 0x2004, 0x9c06,
-	0x1130, 0x0036, 0x2019, 0x0001, 0x080c, 0x926b, 0x003e, 0x080c,
-	0x949d, 0x010e, 0x190c, 0x98c9, 0x0005, 0x00e6, 0x0126, 0x2071,
-	0x1800, 0x2091, 0x8000, 0x7550, 0x9582, 0x0001, 0x0608, 0x7054,
-	0x2060, 0x6000, 0x9086, 0x0000, 0x0148, 0x9ce0, 0x001c, 0x7064,
-	0x9c02, 0x1208, 0x0cb0, 0x2061, 0x1ddc, 0x0c98, 0x6003, 0x0008,
-	0x8529, 0x7552, 0x9ca8, 0x001c, 0x7064, 0x9502, 0x1230, 0x7556,
-	0x9085, 0x0001, 0x012e, 0x00ee, 0x0005, 0x7057, 0x1ddc, 0x0cc0,
-	0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f, 0x0002, 0x9c7e, 0x9c88,
-	0x9ca3, 0x9cbe, 0xbf90, 0xbfad, 0xbfc8, 0x9c7e, 0x9c88, 0x9c7e,
-	0x9cda, 0x9c7e, 0x9c7e, 0x9c7e, 0x9c7e, 0x9c7e, 0x9186, 0x0013,
-	0x1130, 0x6044, 0xd0fc, 0x0110, 0x080c, 0x884c, 0x0005, 0x0005,
-	0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d65, 0x0013, 0x006e,
-	0x0005, 0x9ca1, 0xa3e9, 0xa5bb, 0x9ca1, 0xa649, 0x9fa3, 0x9ca1,
-	0x9ca1, 0xa36b, 0xabee, 0x9ca1, 0x9ca1, 0x9ca1, 0x9ca1, 0x9ca1,
-	0x9ca1, 0x080c, 0x0d65, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c,
-	0x0d65, 0x0013, 0x006e, 0x0005, 0x9cbc, 0xb1f9, 0x9cbc, 0x9cbc,
-	0x9cbc, 0x9cbc, 0x9cbc, 0x9cbc, 0xb19e, 0xb37c, 0x9cbc, 0xb236,
-	0xb2ba, 0xb236, 0xb2ba, 0x9cbc, 0x080c, 0x0d65, 0x6000, 0x9082,
-	0x0016, 0x1a0c, 0x0d65, 0x6000, 0x0002, 0x9cd8, 0xac38, 0xaccf,
-	0xae4f, 0xaebe, 0x9cd8, 0x9cd8, 0x9cd8, 0xac07, 0xb11f, 0xb122,
-	0x9cd8, 0x9cd8, 0x9cd8, 0x9cd8, 0xb152, 0x9cd8, 0x9cd8, 0x9cd8,
-	0x080c, 0x0d65, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d65,
-	0x0013, 0x006e, 0x0005, 0x9cf3, 0x9cf3, 0x9d31, 0x9dd0, 0x9e50,
-	0x9cf3, 0x9cf3, 0x9cf3, 0x9cf5, 0x9cf3, 0x9cf3, 0x9cf3, 0x9cf3,
-	0x9cf3, 0x9cf3, 0x9cf3, 0x080c, 0x0d65, 0x9186, 0x004c, 0x0560,
-	0x9186, 0x0003, 0x190c, 0x0d65, 0x0096, 0x601c, 0xc0ed, 0x601e,
-	0x6003, 0x0003, 0x6106, 0x6014, 0x2048, 0xa87c, 0x9084, 0xa000,
-	0xc0b5, 0xa87e, 0xa8ac, 0xa836, 0xa8b0, 0xa83a, 0x9006, 0xa846,
-	0xa84a, 0xa884, 0x9092, 0x199a, 0x0210, 0x2001, 0x1999, 0x8003,
-	0x8013, 0x8213, 0x9210, 0x621a, 0x009e, 0x080c, 0x1a64, 0x2009,
-	0x8030, 0x080c, 0x84f0, 0x0005, 0x6010, 0x00b6, 0x2058, 0xbca0,
-	0x00be, 0x2c00, 0x080c, 0x9e72, 0x080c, 0xbf5e, 0x6003, 0x0007,
-	0x0005, 0x00d6, 0x0096, 0x00f6, 0x2079, 0x1800, 0x7a8c, 0x6014,
-	0x2048, 0xa87c, 0xd0ec, 0x1110, 0x9290, 0x0018, 0xac78, 0xc4fc,
-	0x0046, 0xa8e0, 0x9005, 0x1140, 0xa8dc, 0x921a, 0x0140, 0x0220,
-	0xa87b, 0x0007, 0x2010, 0x0028, 0xa87b, 0x0015, 0x0010, 0xa87b,
-	0x0000, 0x8214, 0xa883, 0x0000, 0xaa02, 0x0006, 0x0016, 0x0026,
-	0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2400, 0x9005, 0x1108, 0x009a,
-	0x2100, 0x9086, 0x0015, 0x1118, 0x2001, 0x0001, 0x0038, 0x2100,
-	0x9086, 0x0016, 0x0118, 0x2001, 0x0001, 0x002a, 0x94a4, 0x0007,
-	0x8423, 0x9405, 0x0002, 0x9d98, 0x9d98, 0x9d93, 0x9d96, 0x9d98,
-	0x9d90, 0x9d83, 0x9d83, 0x9d83, 0x9d83, 0x9d83, 0x9d83, 0x9d83,
-	0x9d83, 0x9d83, 0x9d83, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e,
-	0x001e, 0x000e, 0x004e, 0x00fe, 0x009e, 0x00de, 0x080c, 0x0d65,
-	0x080c, 0xa82a, 0x0028, 0x080c, 0xa94d, 0x0010, 0x080c, 0xaa3c,
-	0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e, 0x001e, 0x2c00, 0xa896,
-	0x000e, 0x080c, 0x9f30, 0x0530, 0xa804, 0xa80e, 0x00a6, 0x2050,
-	0xb100, 0x00ae, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
-	0xffc0, 0x9080, 0x0002, 0xaacc, 0xabd0, 0xacd4, 0xadd8, 0x2031,
-	0x0000, 0x2041, 0x1280, 0x080c, 0xa0da, 0x0160, 0x000e, 0x9005,
-	0x0120, 0x00fe, 0x009e, 0x00de, 0x0005, 0x00fe, 0x009e, 0x00de,
-	0x0804, 0x9bcc, 0x2001, 0x002c, 0x900e, 0x080c, 0x9f96, 0x0c70,
-	0x91b6, 0x0015, 0x0170, 0x91b6, 0x0016, 0x0158, 0x91b2, 0x0047,
-	0x0a0c, 0x0d65, 0x91b2, 0x0050, 0x1a0c, 0x0d65, 0x9182, 0x0047,
-	0x0042, 0x080c, 0x9a9c, 0x0120, 0x9086, 0x0002, 0x0904, 0x9d31,
-	0x0005, 0x9df2, 0x9df2, 0x9df4, 0x9e26, 0x9df2, 0x9df2, 0x9df2,
-	0x9df2, 0x9e39, 0x080c, 0x0d65, 0x00d6, 0x0016, 0x0096, 0x6003,
-	0x0004, 0x6114, 0x2148, 0xa87c, 0xd0fc, 0x01c0, 0xa878, 0xc0fc,
-	0x9005, 0x1158, 0xa894, 0x9005, 0x0140, 0x2001, 0x0000, 0x900e,
-	0x080c, 0x9f96, 0x080c, 0x9bcc, 0x00a8, 0x6003, 0x0002, 0xa8a4,
-	0xa9a8, 0x9105, 0x1178, 0xa8ae, 0xa8b2, 0x0c78, 0xa87f, 0x0020,
-	0xa88c, 0xa88a, 0xa8a4, 0xa8ae, 0xa8a8, 0xa8b2, 0xa8c7, 0x0000,
-	0xa8cb, 0x0000, 0x009e, 0x001e, 0x00de, 0x0005, 0x080c, 0x88a9,
-	0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xb82c, 0x0120, 0xa87b,
-	0x0006, 0x080c, 0x698f, 0x009e, 0x00de, 0x080c, 0x9bcc, 0x0804,
-	0x890e, 0x080c, 0x88a9, 0x080c, 0x3003, 0x080c, 0xbf5b, 0x00d6,
-	0x0096, 0x6114, 0x2148, 0x080c, 0xb82c, 0x0120, 0xa87b, 0x0029,
-	0x080c, 0x698f, 0x009e, 0x00de, 0x080c, 0x9bcc, 0x0804, 0x890e,
-	0x9182, 0x0047, 0x0002, 0x9e60, 0x9e62, 0x9e60, 0x9e60, 0x9e60,
-	0x9e60, 0x9e60, 0x9e60, 0x9e60, 0x9e60, 0x9e60, 0x9e60, 0x9e62,
-	0x080c, 0x0d65, 0x00d6, 0x0096, 0x080c, 0x1595, 0x6114, 0x2148,
-	0xa87b, 0x0000, 0xa883, 0x0000, 0x080c, 0x698f, 0x009e, 0x00de,
-	0x0804, 0x9bcc, 0x0026, 0x0036, 0x0056, 0x0066, 0x0096, 0x00a6,
-	0x00f6, 0x0006, 0x080c, 0x1022, 0x000e, 0x090c, 0x0d65, 0xa960,
-	0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020,
-	0x4104, 0xa87a, 0x2079, 0x1800, 0x798c, 0x9188, 0x0018, 0x918c,
-	0x0fff, 0xa972, 0xac76, 0x2950, 0x00a6, 0x2001, 0x0205, 0x2003,
-	0x0000, 0x901e, 0x2029, 0x0001, 0x9182, 0x0034, 0x1228, 0x2011,
-	0x001f, 0x080c, 0xb3ff, 0x04c0, 0x2130, 0x2009, 0x0034, 0x2011,
-	0x001f, 0x080c, 0xb3ff, 0x96b2, 0x0034, 0xb004, 0x904d, 0x0110,
-	0x080c, 0x0fd4, 0x080c, 0x1022, 0x01d0, 0x8528, 0xa867, 0x0110,
-	0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1230, 0x2608,
-	0x2011, 0x001b, 0x080c, 0xb3ff, 0x00b8, 0x96b2, 0x003c, 0x2009,
-	0x003c, 0x2950, 0x2011, 0x001b, 0x080c, 0xb3ff, 0x0c18, 0x2001,
+	0x9502, 0x1230, 0x7556, 0x9085, 0x0001, 0x012e, 0x00ee, 0x0005,
+	0x7057, 0x1ddc, 0x0cc0, 0x9006, 0x0cc0, 0x6020, 0x9084, 0x000f,
+	0x0002, 0x9c99, 0x9ca3, 0x9cbe, 0x9cd9, 0xbfab, 0xbfc8, 0xbfe3,
+	0x9c99, 0x9ca3, 0x9c99, 0x9cf5, 0x9c99, 0x9c99, 0x9c99, 0x9c99,
+	0x9c99, 0x9186, 0x0013, 0x1130, 0x6044, 0xd0fc, 0x0110, 0x080c,
+	0x8874, 0x0005, 0x0005, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c,
+	0x0d65, 0x0013, 0x006e, 0x0005, 0x9cbc, 0xa404, 0xa5d6, 0x9cbc,
+	0xa664, 0x9fbe, 0x9cbc, 0x9cbc, 0xa386, 0xac09, 0x9cbc, 0x9cbc,
+	0x9cbc, 0x9cbc, 0x9cbc, 0x9cbc, 0x080c, 0x0d65, 0x0066, 0x6000,
+	0x90b2, 0x0016, 0x1a0c, 0x0d65, 0x0013, 0x006e, 0x0005, 0x9cd7,
+	0xb214, 0x9cd7, 0x9cd7, 0x9cd7, 0x9cd7, 0x9cd7, 0x9cd7, 0xb1b9,
+	0xb397, 0x9cd7, 0xb251, 0xb2d5, 0xb251, 0xb2d5, 0x9cd7, 0x080c,
+	0x0d65, 0x6000, 0x9082, 0x0016, 0x1a0c, 0x0d65, 0x6000, 0x0002,
+	0x9cf3, 0xac53, 0xacea, 0xae6a, 0xaed9, 0x9cf3, 0x9cf3, 0x9cf3,
+	0xac22, 0xb13a, 0xb13d, 0x9cf3, 0x9cf3, 0x9cf3, 0x9cf3, 0xb16d,
+	0x9cf3, 0x9cf3, 0x9cf3, 0x080c, 0x0d65, 0x0066, 0x6000, 0x90b2,
+	0x0016, 0x1a0c, 0x0d65, 0x0013, 0x006e, 0x0005, 0x9d0e, 0x9d0e,
+	0x9d4c, 0x9deb, 0x9e6b, 0x9d0e, 0x9d0e, 0x9d0e, 0x9d10, 0x9d0e,
+	0x9d0e, 0x9d0e, 0x9d0e, 0x9d0e, 0x9d0e, 0x9d0e, 0x080c, 0x0d65,
+	0x9186, 0x004c, 0x0560, 0x9186, 0x0003, 0x190c, 0x0d65, 0x0096,
+	0x601c, 0xc0ed, 0x601e, 0x6003, 0x0003, 0x6106, 0x6014, 0x2048,
+	0xa87c, 0x9084, 0xa000, 0xc0b5, 0xa87e, 0xa8ac, 0xa836, 0xa8b0,
+	0xa83a, 0x9006, 0xa846, 0xa84a, 0xa884, 0x9092, 0x199a, 0x0210,
+	0x2001, 0x1999, 0x8003, 0x8013, 0x8213, 0x9210, 0x621a, 0x009e,
+	0x080c, 0x1a64, 0x2009, 0x8030, 0x080c, 0x8518, 0x0005, 0x6010,
+	0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x080c, 0x9e8d, 0x080c,
+	0xbf79, 0x6003, 0x0007, 0x0005, 0x00d6, 0x0096, 0x00f6, 0x2079,
+	0x1800, 0x7a8c, 0x6014, 0x2048, 0xa87c, 0xd0ec, 0x1110, 0x9290,
+	0x0018, 0xac78, 0xc4fc, 0x0046, 0xa8e0, 0x9005, 0x1140, 0xa8dc,
+	0x921a, 0x0140, 0x0220, 0xa87b, 0x0007, 0x2010, 0x0028, 0xa87b,
+	0x0015, 0x0010, 0xa87b, 0x0000, 0x8214, 0xa883, 0x0000, 0xaa02,
+	0x0006, 0x0016, 0x0026, 0x00c6, 0x00d6, 0x00e6, 0x00f6, 0x2400,
+	0x9005, 0x1108, 0x009a, 0x2100, 0x9086, 0x0015, 0x1118, 0x2001,
+	0x0001, 0x0038, 0x2100, 0x9086, 0x0016, 0x0118, 0x2001, 0x0001,
+	0x002a, 0x94a4, 0x0007, 0x8423, 0x9405, 0x0002, 0x9db3, 0x9db3,
+	0x9dae, 0x9db1, 0x9db3, 0x9dab, 0x9d9e, 0x9d9e, 0x9d9e, 0x9d9e,
+	0x9d9e, 0x9d9e, 0x9d9e, 0x9d9e, 0x9d9e, 0x9d9e, 0x00fe, 0x00ee,
+	0x00de, 0x00ce, 0x002e, 0x001e, 0x000e, 0x004e, 0x00fe, 0x009e,
+	0x00de, 0x080c, 0x0d65, 0x080c, 0xa845, 0x0028, 0x080c, 0xa968,
+	0x0010, 0x080c, 0xaa57, 0x00fe, 0x00ee, 0x00de, 0x00ce, 0x002e,
+	0x001e, 0x2c00, 0xa896, 0x000e, 0x080c, 0x9f4b, 0x0530, 0xa804,
+	0xa80e, 0x00a6, 0x2050, 0xb100, 0x00ae, 0x8006, 0x8006, 0x8007,
+	0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0xaacc, 0xabd0,
+	0xacd4, 0xadd8, 0x2031, 0x0000, 0x2041, 0x1280, 0x080c, 0xa0f5,
+	0x0160, 0x000e, 0x9005, 0x0120, 0x00fe, 0x009e, 0x00de, 0x0005,
+	0x00fe, 0x009e, 0x00de, 0x0804, 0x9be7, 0x2001, 0x002c, 0x900e,
+	0x080c, 0x9fb1, 0x0c70, 0x91b6, 0x0015, 0x0170, 0x91b6, 0x0016,
+	0x0158, 0x91b2, 0x0047, 0x0a0c, 0x0d65, 0x91b2, 0x0050, 0x1a0c,
+	0x0d65, 0x9182, 0x0047, 0x0042, 0x080c, 0x9ab7, 0x0120, 0x9086,
+	0x0002, 0x0904, 0x9d4c, 0x0005, 0x9e0d, 0x9e0d, 0x9e0f, 0x9e41,
+	0x9e0d, 0x9e0d, 0x9e0d, 0x9e0d, 0x9e54, 0x080c, 0x0d65, 0x00d6,
+	0x0016, 0x0096, 0x6003, 0x0004, 0x6114, 0x2148, 0xa87c, 0xd0fc,
+	0x01c0, 0xa878, 0xc0fc, 0x9005, 0x1158, 0xa894, 0x9005, 0x0140,
+	0x2001, 0x0000, 0x900e, 0x080c, 0x9fb1, 0x080c, 0x9be7, 0x00a8,
+	0x6003, 0x0002, 0xa8a4, 0xa9a8, 0x9105, 0x1178, 0xa8ae, 0xa8b2,
+	0x0c78, 0xa87f, 0x0020, 0xa88c, 0xa88a, 0xa8a4, 0xa8ae, 0xa8a8,
+	0xa8b2, 0xa8c7, 0x0000, 0xa8cb, 0x0000, 0x009e, 0x001e, 0x00de,
+	0x0005, 0x080c, 0x88d1, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c,
+	0xb847, 0x0120, 0xa87b, 0x0006, 0x080c, 0x6996, 0x009e, 0x00de,
+	0x080c, 0x9be7, 0x0804, 0x8936, 0x080c, 0x88d1, 0x080c, 0x3006,
+	0x080c, 0xbf76, 0x00d6, 0x0096, 0x6114, 0x2148, 0x080c, 0xb847,
+	0x0120, 0xa87b, 0x0029, 0x080c, 0x6996, 0x009e, 0x00de, 0x080c,
+	0x9be7, 0x0804, 0x8936, 0x9182, 0x0047, 0x0002, 0x9e7b, 0x9e7d,
+	0x9e7b, 0x9e7b, 0x9e7b, 0x9e7b, 0x9e7b, 0x9e7b, 0x9e7b, 0x9e7b,
+	0x9e7b, 0x9e7b, 0x9e7d, 0x080c, 0x0d65, 0x00d6, 0x0096, 0x080c,
+	0x1595, 0x6114, 0x2148, 0xa87b, 0x0000, 0xa883, 0x0000, 0x080c,
+	0x6996, 0x009e, 0x00de, 0x0804, 0x9be7, 0x0026, 0x0036, 0x0056,
+	0x0066, 0x0096, 0x00a6, 0x00f6, 0x0006, 0x080c, 0x1022, 0x000e,
+	0x090c, 0x0d65, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0,
+	0x900e, 0x20a9, 0x0020, 0x4104, 0xa87a, 0x2079, 0x1800, 0x798c,
+	0x9188, 0x0018, 0x918c, 0x0fff, 0xa972, 0xac76, 0x2950, 0x00a6,
+	0x2001, 0x0205, 0x2003, 0x0000, 0x901e, 0x2029, 0x0001, 0x9182,
+	0x0034, 0x1228, 0x2011, 0x001f, 0x080c, 0xb41a, 0x04c0, 0x2130,
+	0x2009, 0x0034, 0x2011, 0x001f, 0x080c, 0xb41a, 0x96b2, 0x0034,
+	0xb004, 0x904d, 0x0110, 0x080c, 0x0fd4, 0x080c, 0x1022, 0x01d0,
+	0x8528, 0xa867, 0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a,
+	0x003d, 0x1230, 0x2608, 0x2011, 0x001b, 0x080c, 0xb41a, 0x00b8,
+	0x96b2, 0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x080c,
+	0xb41a, 0x0c18, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f,
+	0x95ad, 0x0050, 0xb566, 0xb070, 0xc0fd, 0xb072, 0x0048, 0x2001,
 	0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566,
-	0xb070, 0xc0fd, 0xb072, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000,
-	0x00ae, 0x852f, 0x95ad, 0x0050, 0xb566, 0x2a48, 0xa804, 0xa807,
-	0x0000, 0x0006, 0x080c, 0x698f, 0x000e, 0x2048, 0x9005, 0x1db0,
-	0x00fe, 0x00ae, 0x009e, 0x006e, 0x005e, 0x003e, 0x002e, 0x0005,
-	0x00d6, 0x00f6, 0x0096, 0x0006, 0x080c, 0x1022, 0x000e, 0x090c,
-	0x0d65, 0xa960, 0x21e8, 0xa95c, 0x9188, 0x0019, 0x21a0, 0x900e,
-	0x20a9, 0x0020, 0x4104, 0xaa66, 0xa87a, 0x2079, 0x1800, 0x798c,
-	0x810c, 0x9188, 0x000c, 0x9182, 0x001a, 0x0210, 0x2009, 0x001a,
-	0x21a8, 0x810b, 0xa972, 0xac76, 0x2e98, 0xa85c, 0x9080, 0x001f,
-	0x20a0, 0x2001, 0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x4003,
-	0x2003, 0x0000, 0x080c, 0x698f, 0x009e, 0x00fe, 0x00de, 0x0005,
-	0x0016, 0x00d6, 0x00f6, 0x0096, 0x0016, 0x2001, 0x0205, 0x200c,
-	0x918d, 0x0080, 0x2102, 0x001e, 0x2079, 0x0200, 0x2e98, 0xa87c,
-	0xd0ec, 0x0118, 0x9e80, 0x000c, 0x2098, 0x2021, 0x003e, 0x901e,
-	0x9282, 0x0020, 0x0218, 0x2011, 0x0020, 0x2018, 0x9486, 0x003e,
-	0x1170, 0x0096, 0x080c, 0x1022, 0x2900, 0x009e, 0x05c0, 0xa806,
-	0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x3300,
-	0x908e, 0x0260, 0x0140, 0x2009, 0x0280, 0x9102, 0x920a, 0x0218,
-	0x2010, 0x2100, 0x9318, 0x2200, 0x9402, 0x1228, 0x2400, 0x9202,
-	0x2410, 0x9318, 0x9006, 0x2020, 0x22a8, 0xa800, 0x9200, 0xa802,
-	0x20e1, 0x0000, 0x4003, 0x83ff, 0x0180, 0x3300, 0x9086, 0x0280,
-	0x1130, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816, 0x2e98, 0x2310,
-	0x84ff, 0x0904, 0x9f45, 0x0804, 0x9f47, 0x9085, 0x0001, 0x7817,
-	0x0000, 0x009e, 0x00fe, 0x00de, 0x001e, 0x0005, 0x00d6, 0x0036,
-	0x0096, 0x6314, 0x2348, 0xa87a, 0xa982, 0x080c, 0x6983, 0x009e,
-	0x003e, 0x00de, 0x0005, 0x91b6, 0x0015, 0x1118, 0x080c, 0x9bcc,
-	0x0030, 0x91b6, 0x0016, 0x190c, 0x0d65, 0x080c, 0x9bcc, 0x0005,
-	0x20a9, 0x000e, 0x20e1, 0x0000, 0x2e98, 0x6014, 0x0096, 0x2048,
-	0xa860, 0x20e8, 0xa85c, 0x20a0, 0x009e, 0x4003, 0x0136, 0x9080,
-	0x001b, 0x2011, 0x0006, 0x20a9, 0x0001, 0x3418, 0x8318, 0x23a0,
-	0x4003, 0x3318, 0x8318, 0x2398, 0x8211, 0x1db8, 0x2011, 0x0006,
-	0x013e, 0x20a0, 0x3318, 0x8318, 0x2398, 0x4003, 0x3418, 0x8318,
-	0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c, 0xb82c, 0x0130, 0x6014,
-	0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0x009e, 0x0804, 0x9bcc,
-	0x0096, 0x00d6, 0x0036, 0x7330, 0x9386, 0x0200, 0x11a8, 0x6010,
-	0x00b6, 0x2058, 0xb8c7, 0x0000, 0x00be, 0x6014, 0x9005, 0x0130,
-	0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xab32, 0x080c, 0x9bcc,
-	0x003e, 0x00de, 0x009e, 0x0005, 0x0011, 0x1d48, 0x0cc8, 0x0006,
-	0x0016, 0x080c, 0xbf46, 0x0188, 0x6014, 0x9005, 0x1170, 0x600b,
-	0x0003, 0x601b, 0x0000, 0x604b, 0x0000, 0x2009, 0x0022, 0x080c,
-	0xa3c1, 0x9006, 0x001e, 0x000e, 0x0005, 0x9085, 0x0001, 0x0cd0,
-	0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80, 0x000c, 0x20e1, 0x0000,
-	0x2098, 0x6014, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002,
-	0x20a0, 0x4003, 0x2001, 0x0205, 0x2003, 0x0001, 0x2099, 0x0260,
-	0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a, 0xa804, 0x2048, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205,
-	0x2003, 0x0002, 0x2099, 0x0260, 0x20a9, 0x0020, 0x4003, 0x2003,
-	0x0000, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x080c,
-	0x9bcc, 0x001e, 0x009e, 0x0005, 0x0096, 0x0016, 0x900e, 0x7030,
-	0x9086, 0x0100, 0x0140, 0x7038, 0x9084, 0x00ff, 0x800c, 0x703c,
-	0x9084, 0x00ff, 0x8004, 0x9080, 0x0004, 0x9108, 0x810b, 0x2011,
-	0x0002, 0x2019, 0x000c, 0x6014, 0x2048, 0x080c, 0xb3ff, 0x080c,
-	0xb82c, 0x0140, 0x6014, 0x2048, 0xa807, 0x0000, 0xa864, 0xa8e2,
-	0xa867, 0x0103, 0x080c, 0x9bcc, 0x001e, 0x009e, 0x0005, 0x0016,
-	0x0096, 0x7030, 0x9086, 0x0100, 0x1118, 0x2009, 0x0004, 0x0010,
-	0x7034, 0x800c, 0x810b, 0x2011, 0x000c, 0x2019, 0x000c, 0x6014,
-	0x2048, 0xa804, 0x0096, 0x9005, 0x0108, 0x2048, 0x080c, 0xb3ff,
-	0x009e, 0x080c, 0xb82c, 0x0148, 0xa804, 0x9005, 0x1158, 0xa807,
-	0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0x9bcc, 0x009e,
-	0x001e, 0x0005, 0x0086, 0x2040, 0xa030, 0x8007, 0x9086, 0x0100,
-	0x1118, 0x080c, 0xa574, 0x00e0, 0xa034, 0x8007, 0x800c, 0x8806,
-	0x8006, 0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x000c,
-	0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0xaaa0, 0xab9c,
-	0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x1266, 0x0019, 0x0d08,
-	0x008e, 0x0898, 0x0096, 0x0006, 0x080c, 0x1022, 0x000e, 0x01b0,
-	0xa8ab, 0x0dcb, 0xa876, 0x000e, 0xa8a2, 0x0006, 0xae6a, 0x2800,
-	0xa89e, 0xa97a, 0xaf72, 0xaa8e, 0xab92, 0xac96, 0xad9a, 0x0086,
-	0x2940, 0x080c, 0x110c, 0x008e, 0x9085, 0x0001, 0x009e, 0x0005,
-	0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6,
-	0x2258, 0xba10, 0x00be, 0x9206, 0x1520, 0x700c, 0x6210, 0x00b6,
-	0x2258, 0xba14, 0x00be, 0x9206, 0x11e0, 0x604b, 0x0000, 0x2c68,
-	0x0016, 0x2009, 0x0035, 0x080c, 0xbebe, 0x001e, 0x1158, 0x622c,
-	0x2268, 0x2071, 0x026c, 0x6b20, 0x9386, 0x0003, 0x0130, 0x9386,
-	0x0006, 0x0128, 0x080c, 0x9bcc, 0x0020, 0x0039, 0x0010, 0x080c,
-	0xa1f6, 0x002e, 0x00de, 0x00ee, 0x0005, 0x0096, 0x6814, 0x2048,
-	0x9186, 0x0015, 0x0904, 0xa1d5, 0x918e, 0x0016, 0x1904, 0xa1f4,
-	0x700c, 0x908c, 0xff00, 0x9186, 0x1700, 0x0120, 0x9186, 0x0300,
-	0x1904, 0xa1af, 0x89ff, 0x1138, 0x6800, 0x9086, 0x000f, 0x0904,
-	0xa191, 0x0804, 0xa1f2, 0x6808, 0x9086, 0xffff, 0x1904, 0xa1d7,
-	0xa87c, 0x9084, 0x0060, 0x9086, 0x0020, 0x1128, 0xa83c, 0xa940,
-	0x9105, 0x1904, 0xa1d7, 0x6824, 0xd0b4, 0x1904, 0xa1d7, 0x080c,
-	0xba1b, 0x6864, 0xa882, 0xa87c, 0xc0dc, 0xc0f4, 0xc0d4, 0xa87e,
-	0x0026, 0x900e, 0x6a18, 0x2001, 0x000a, 0x080c, 0x83f1, 0xa884,
-	0x920a, 0x0208, 0x8011, 0xaa86, 0x82ff, 0x002e, 0x1138, 0x00c6,
-	0x2d60, 0x080c, 0xb552, 0x00ce, 0x0804, 0xa1f2, 0x00c6, 0xa868,
-	0xd0fc, 0x1118, 0x080c, 0x5d4f, 0x0010, 0x080c, 0x60f4, 0x00ce,
-	0x1904, 0xa1d7, 0x00c6, 0x2d60, 0x080c, 0x9bcc, 0x00ce, 0x0804,
-	0xa1f2, 0x00c6, 0x080c, 0x9c3d, 0x0198, 0x6017, 0x0000, 0x6810,
-	0x6012, 0x080c, 0xbcc0, 0x6023, 0x0003, 0x6904, 0x00c6, 0x2d60,
-	0x080c, 0x9bcc, 0x00ce, 0x080c, 0x9c6a, 0x00ce, 0x0804, 0xa1f2,
-	0x2001, 0x1959, 0x2004, 0x684a, 0x00ce, 0x0804, 0xa1f2, 0x7008,
-	0x9086, 0x000b, 0x11c8, 0x6010, 0x00b6, 0x2058, 0xb900, 0xc1bc,
-	0xb902, 0x00be, 0x00c6, 0x2d60, 0xa87b, 0x0003, 0x080c, 0xbf00,
-	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009, 0x8020,
-	0x080c, 0x84a9, 0x00ce, 0x0430, 0x700c, 0x9086, 0x2a00, 0x1138,
-	0x2001, 0x1959, 0x2004, 0x684a, 0x00e8, 0x04c1, 0x00e8, 0x89ff,
-	0x090c, 0x0d65, 0x00c6, 0x00d6, 0x2d60, 0xa867, 0x0103, 0xa87b,
-	0x0003, 0x080c, 0x67a5, 0x080c, 0xba1b, 0x080c, 0x9c06, 0x0026,
-	0x6010, 0x00b6, 0x2058, 0xba3c, 0x080c, 0x6394, 0x00be, 0x002e,
-	0x00de, 0x00ce, 0x080c, 0x9bcc, 0x009e, 0x0005, 0x9186, 0x0015,
-	0x1128, 0x2001, 0x1959, 0x2004, 0x684a, 0x0068, 0x918e, 0x0016,
-	0x1160, 0x00c6, 0x2d00, 0x2060, 0x080c, 0xd4ac, 0x080c, 0x8398,
-	0x080c, 0x9bcc, 0x00ce, 0x080c, 0x9bcc, 0x0005, 0x0026, 0x0036,
-	0x0046, 0x7228, 0xacb0, 0xabac, 0xd2f4, 0x0130, 0x2001, 0x1959,
-	0x2004, 0x684a, 0x0804, 0xa270, 0x00c6, 0x2d60, 0x080c, 0xb42a,
-	0x00ce, 0x6804, 0x9086, 0x0050, 0x1168, 0x00c6, 0x2d00, 0x2060,
-	0x6003, 0x0001, 0x6007, 0x0050, 0x2009, 0x8023, 0x080c, 0x84a9,
-	0x00ce, 0x04f0, 0x6800, 0x9086, 0x000f, 0x01a8, 0x89ff, 0x090c,
-	0x0d65, 0x6800, 0x9086, 0x0004, 0x1190, 0xa87c, 0xd0ac, 0x0178,
-	0xa843, 0x0fff, 0xa83f, 0x0fff, 0xa880, 0xc0fc, 0xa882, 0x2001,
-	0x0001, 0x6832, 0x0400, 0x2001, 0x0007, 0x6832, 0x00e0, 0xa87c,
-	0xd0b4, 0x1150, 0xd0ac, 0x0db8, 0x6824, 0xd0f4, 0x1d48, 0xa838,
-	0xa934, 0x9105, 0x0d80, 0x0c20, 0xd2ec, 0x1d68, 0x7024, 0x9306,
-	0x1118, 0x7020, 0x9406, 0x0d38, 0x7020, 0x683e, 0x7024, 0x683a,
-	0x2001, 0x0005, 0x6832, 0x080c, 0xbbaa, 0x080c, 0x890e, 0x0010,
-	0x080c, 0x9bcc, 0x004e, 0x003e, 0x002e, 0x0005, 0x00e6, 0x00d6,
-	0x0026, 0x7008, 0x9084, 0x00ff, 0x6210, 0x00b6, 0x2258, 0xba10,
-	0x00be, 0x9206, 0x1904, 0xa2db, 0x700c, 0x6210, 0x00b6, 0x2258,
-	0xba14, 0x00be, 0x9206, 0x1904, 0xa2db, 0x6038, 0x2068, 0x6824,
-	0xc0dc, 0x6826, 0x6a20, 0x9286, 0x0007, 0x0904, 0xa2db, 0x9286,
-	0x0002, 0x0904, 0xa2db, 0x9286, 0x0000, 0x05e8, 0x6808, 0x633c,
-	0x9306, 0x15c8, 0x2071, 0x026c, 0x9186, 0x0015, 0x0570, 0x918e,
-	0x0016, 0x1100, 0x00c6, 0x6038, 0x2060, 0x6104, 0x9186, 0x004b,
-	0x01c0, 0x9186, 0x004c, 0x01a8, 0x9186, 0x004d, 0x0190, 0x9186,
-	0x004e, 0x0178, 0x9186, 0x0052, 0x0160, 0x6014, 0x0096, 0x2048,
-	0x080c, 0xb82c, 0x090c, 0x0d65, 0xa87b, 0x0003, 0x009e, 0x080c,
-	0xbf00, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009,
-	0x8020, 0x080c, 0x84a9, 0x00ce, 0x0030, 0x6038, 0x2070, 0x2001,
-	0x1959, 0x2004, 0x704a, 0x080c, 0x9bcc, 0x002e, 0x00de, 0x00ee,
-	0x0005, 0x00b6, 0x0096, 0x00f6, 0x6014, 0x2048, 0x6010, 0x2058,
-	0x91b6, 0x0015, 0x0130, 0xba08, 0xbb0c, 0xbc00, 0xc48c, 0xbc02,
-	0x0460, 0x0096, 0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0010,
-	0x2019, 0x000a, 0x20a9, 0x0004, 0x080c, 0xabc4, 0x002e, 0x003e,
-	0x015e, 0x009e, 0x1904, 0xa34a, 0x0096, 0x0156, 0x0036, 0x0026,
-	0x2b48, 0x9e90, 0x0014, 0x2019, 0x0006, 0x20a9, 0x0004, 0x080c,
-	0xabc4, 0x002e, 0x003e, 0x015e, 0x009e, 0x15a0, 0x7238, 0xba0a,
-	0x733c, 0xbb0e, 0xbc00, 0xc48d, 0xbc02, 0xa804, 0x9005, 0x1128,
-	0x00fe, 0x009e, 0x00be, 0x0804, 0x9fdb, 0x0096, 0x2048, 0xaa12,
-	0xab16, 0xac0a, 0x009e, 0x8006, 0x8006, 0x8007, 0x90bc, 0x003f,
-	0x9084, 0xffc0, 0x9080, 0x0002, 0x2009, 0x002b, 0xaaa0, 0xab9c,
-	0xaca8, 0xada4, 0x2031, 0x0000, 0x2041, 0x1266, 0x080c, 0xa0da,
-	0x0130, 0x00fe, 0x009e, 0x080c, 0x9bcc, 0x00be, 0x0005, 0x080c,
-	0xa574, 0x0cb8, 0x2b78, 0x00f6, 0x080c, 0x3003, 0x080c, 0xbf5b,
-	0x00fe, 0x00c6, 0x080c, 0x9b76, 0x2f00, 0x6012, 0x6017, 0x0000,
-	0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x2001, 0x0007,
-	0x080c, 0x61ba, 0x080c, 0x61e6, 0x080c, 0x84b0, 0x080c, 0x890e,
-	0x00ce, 0x0804, 0xa31d, 0x2100, 0x91b2, 0x0053, 0x1a0c, 0x0d65,
-	0x91b2, 0x0040, 0x1a04, 0xa3d3, 0x0002, 0xa3c1, 0xa3c1, 0xa3b7,
-	0xa3c1, 0xa3c1, 0xa3c1, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5,
-	0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5,
-	0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5,
-	0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3c1, 0xa3b5, 0xa3c1, 0xa3c1,
-	0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b7, 0xa3b5, 0xa3b5,
-	0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3c1,
-	0xa3c1, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5, 0xa3b5,
-	0xa3b5, 0xa3b5, 0xa3c1, 0xa3b5, 0xa3b5, 0x080c, 0x0d65, 0x0066,
-	0x00b6, 0x6610, 0x2658, 0xb8c4, 0xc08c, 0xb8c6, 0x00be, 0x006e,
-	0x0000, 0x6003, 0x0001, 0x6106, 0x9186, 0x0032, 0x0118, 0x080c,
-	0x84b0, 0x0010, 0x080c, 0x84a9, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x890e, 0x012e, 0x0005, 0x2600, 0x0002, 0xa3e7, 0xa3e7, 0xa3e7,
-	0xa3c1, 0xa3c1, 0xa3e7, 0xa3e7, 0xa3e7, 0xa3e7, 0xa3c1, 0xa3e7,
-	0xa3c1, 0xa3e7, 0xa3c1, 0xa3e7, 0xa3e7, 0xa3e7, 0xa3e7, 0x080c,
-	0x0d65, 0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0d65, 0x91b6, 0x0013,
-	0x0904, 0xa4be, 0x91b6, 0x0027, 0x1904, 0xa46a, 0x080c, 0x884c,
-	0x6004, 0x080c, 0xba30, 0x01b0, 0x080c, 0xba41, 0x01a8, 0x908e,
-	0x0021, 0x0904, 0xa467, 0x908e, 0x0022, 0x1130, 0x080c, 0xa007,
-	0x0904, 0xa463, 0x0804, 0xa464, 0x908e, 0x003d, 0x0904, 0xa467,
-	0x0804, 0xa45d, 0x080c, 0x3034, 0x2001, 0x0007, 0x080c, 0x61ba,
-	0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xa574, 0x9186,
-	0x007e, 0x1148, 0x2001, 0x1836, 0x2014, 0xc285, 0x080c, 0x70ac,
-	0x1108, 0xc2ad, 0x2202, 0x080c, 0x98ad, 0x0036, 0x0026, 0x2019,
-	0x0028, 0x2110, 0x080c, 0xd507, 0x002e, 0x003e, 0x0016, 0x0026,
-	0x0036, 0x2110, 0x2019, 0x0028, 0x080c, 0x8613, 0x0076, 0x903e,
-	0x080c, 0x8502, 0x6010, 0x00b6, 0x905d, 0x0100, 0x00be, 0x2c08,
-	0x080c, 0xcfa6, 0x007e, 0x003e, 0x002e, 0x001e, 0x080c, 0x98c9,
-	0x080c, 0xbf5b, 0x0016, 0x080c, 0xbcb8, 0x080c, 0x9bcc, 0x001e,
-	0x080c, 0x3113, 0x080c, 0x890e, 0x0030, 0x080c, 0xbcb8, 0x080c,
-	0x9bcc, 0x080c, 0x890e, 0x0005, 0x080c, 0xa574, 0x0cb0, 0x080c,
-	0xa5b0, 0x0c98, 0x9186, 0x0015, 0x0118, 0x9186, 0x0016, 0x1140,
-	0x080c, 0x9a9c, 0x0d80, 0x9086, 0x0002, 0x0904, 0xa5bb, 0x0c58,
-	0x9186, 0x0014, 0x1d40, 0x080c, 0x884c, 0x6004, 0x908e, 0x0022,
-	0x1118, 0x080c, 0xa007, 0x09f8, 0x080c, 0x3003, 0x080c, 0xbf5b,
-	0x080c, 0xba30, 0x1190, 0x080c, 0x3034, 0x6010, 0x00b6, 0x2058,
-	0xb9a0, 0x00be, 0x080c, 0xa574, 0x9186, 0x007e, 0x1128, 0x2001,
-	0x1836, 0x200c, 0xc185, 0x2102, 0x0800, 0x080c, 0xba41, 0x1120,
-	0x080c, 0xa574, 0x0804, 0xa45d, 0x6004, 0x908e, 0x0032, 0x1160,
-	0x00e6, 0x00f6, 0x2071, 0x1894, 0x2079, 0x0000, 0x080c, 0x33b5,
-	0x00fe, 0x00ee, 0x0804, 0xa45d, 0x6004, 0x908e, 0x0021, 0x0d40,
-	0x908e, 0x0022, 0x090c, 0xa574, 0x0804, 0xa45d, 0x90b2, 0x0040,
-	0x1a04, 0xa55d, 0x2008, 0x0002, 0xa506, 0xa507, 0xa50a, 0xa50d,
-	0xa510, 0xa513, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504,
-	0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504,
-	0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504,
-	0xa504, 0xa504, 0xa516, 0xa51f, 0xa504, 0xa520, 0xa51f, 0xa504,
-	0xa504, 0xa504, 0xa504, 0xa504, 0xa51f, 0xa51f, 0xa504, 0xa504,
-	0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa504, 0xa548, 0xa51f,
-	0xa504, 0xa51b, 0xa504, 0xa504, 0xa504, 0xa51c, 0xa504, 0xa504,
-	0xa504, 0xa51f, 0xa543, 0xa504, 0x080c, 0x0d65, 0x00c0, 0x2001,
-	0x000b, 0x00e8, 0x2001, 0x0003, 0x00d0, 0x2001, 0x0005, 0x00b8,
-	0x2001, 0x0001, 0x00a0, 0x2001, 0x0009, 0x0088, 0x6003, 0x0005,
-	0x080c, 0x890e, 0x0058, 0x0018, 0x0010, 0x080c, 0x61ba, 0x04b8,
-	0x080c, 0xbf5e, 0x6003, 0x0004, 0x080c, 0x890e, 0x0005, 0x080c,
-	0x61ba, 0x6003, 0x0002, 0x0036, 0x2019, 0x185e, 0x2304, 0x9084,
-	0xff00, 0x1120, 0x2001, 0x1957, 0x201c, 0x0040, 0x8007, 0x909a,
-	0x0004, 0x0ec0, 0x8003, 0x801b, 0x831b, 0x9318, 0x631a, 0x003e,
-	0x080c, 0x890e, 0x0c18, 0x080c, 0xbcb8, 0x080c, 0x9bcc, 0x08f0,
-	0x00e6, 0x00f6, 0x2071, 0x1894, 0x2079, 0x0000, 0x080c, 0x33b5,
-	0x00fe, 0x00ee, 0x080c, 0x884c, 0x080c, 0x9bcc, 0x0878, 0x6003,
-	0x0002, 0x080c, 0xbf5e, 0x0804, 0x890e, 0x2600, 0x2008, 0x0002,
-	0xa572, 0xa572, 0xa572, 0xa557, 0xa557, 0xa572, 0xa572, 0xa572,
-	0xa572, 0xa557, 0xa572, 0xa557, 0xa572, 0xa557, 0xa572, 0xa572,
-	0xa572, 0xa572, 0x080c, 0x0d65, 0x00e6, 0x0096, 0x0026, 0x0016,
-	0x080c, 0xb82c, 0x0568, 0x6014, 0x2048, 0xa864, 0x9086, 0x0139,
-	0x11a8, 0xa894, 0x9086, 0x0056, 0x1148, 0x080c, 0x5127, 0x0130,
-	0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x0028, 0x2001, 0x0030,
-	0x900e, 0x2011, 0x4005, 0x080c, 0xbe25, 0x0090, 0xa868, 0xd0fc,
-	0x0178, 0xa807, 0x0000, 0x0016, 0x6004, 0x908e, 0x0021, 0x0168,
-	0x908e, 0x003d, 0x0150, 0x001e, 0xa867, 0x0103, 0xa833, 0x0100,
-	0x001e, 0x002e, 0x009e, 0x00ee, 0x0005, 0x001e, 0x0009, 0x0cc0,
-	0x0096, 0x6014, 0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0xa823,
-	0x8001, 0x009e, 0x0005, 0x00b6, 0x6610, 0x2658, 0xb804, 0x9084,
-	0x00ff, 0x90b2, 0x000c, 0x1a0c, 0x0d65, 0x6604, 0x96b6, 0x004d,
-	0x1120, 0x080c, 0xbd44, 0x0804, 0xa638, 0x6604, 0x96b6, 0x0043,
-	0x1120, 0x080c, 0xbd8d, 0x0804, 0xa638, 0x6604, 0x96b6, 0x004b,
-	0x1120, 0x080c, 0xbdb9, 0x0804, 0xa638, 0x6604, 0x96b6, 0x0033,
-	0x1120, 0x080c, 0xbcda, 0x0804, 0xa638, 0x6604, 0x96b6, 0x0028,
-	0x1120, 0x080c, 0xba7a, 0x0804, 0xa638, 0x6604, 0x96b6, 0x0029,
-	0x1120, 0x080c, 0xbabb, 0x0804, 0xa638, 0x6604, 0x96b6, 0x001f,
-	0x1118, 0x080c, 0x9fb0, 0x04e0, 0x6604, 0x96b6, 0x0000, 0x1118,
-	0x080c, 0xa2e1, 0x04a8, 0x6604, 0x96b6, 0x0022, 0x1118, 0x080c,
-	0x9fe8, 0x0470, 0x6604, 0x96b6, 0x0035, 0x1118, 0x080c, 0xa0f8,
-	0x0438, 0x6604, 0x96b6, 0x0039, 0x1118, 0x080c, 0xa276, 0x0400,
-	0x6604, 0x96b6, 0x003d, 0x1118, 0x080c, 0xa020, 0x00c8, 0x6604,
-	0x96b6, 0x0044, 0x1118, 0x080c, 0xa05c, 0x0090, 0x6604, 0x96b6,
-	0x0049, 0x1118, 0x080c, 0xa087, 0x0058, 0x91b6, 0x0015, 0x1110,
-	0x0063, 0x0030, 0x91b6, 0x0016, 0x1128, 0x00be, 0x0804, 0xa8f6,
-	0x00be, 0x0005, 0x080c, 0x9c87, 0x0cd8, 0xa655, 0xa658, 0xa655,
-	0xa69c, 0xa655, 0xa82a, 0xa903, 0xa655, 0xa655, 0xa8d0, 0xa655,
-	0xa8e4, 0x0096, 0x080c, 0x1595, 0x6014, 0x2048, 0xa800, 0x2048,
-	0xa867, 0x0103, 0x009e, 0x0804, 0x9bcc, 0xa001, 0xa001, 0x0005,
-	0x00e6, 0x2071, 0x1800, 0x708c, 0x9086, 0x0074, 0x1540, 0x080c,
-	0xcf77, 0x11b0, 0x6010, 0x00b6, 0x2058, 0x7030, 0xd08c, 0x0128,
-	0xb800, 0xd0bc, 0x0110, 0xc0c5, 0xb802, 0x00e9, 0x00be, 0x2001,
-	0x0006, 0x080c, 0x61ba, 0x080c, 0x3034, 0x080c, 0x9bcc, 0x0088,
-	0x2001, 0x000a, 0x080c, 0x61ba, 0x080c, 0x3034, 0x6003, 0x0001,
-	0x6007, 0x0001, 0x080c, 0x84b0, 0x080c, 0x890e, 0x0010, 0x080c,
-	0xa815, 0x00ee, 0x0005, 0x00d6, 0xb800, 0xd084, 0x0158, 0x9006,
-	0x080c, 0x61a6, 0x2069, 0x1853, 0x6804, 0x0020, 0x2001, 0x0006,
-	0x080c, 0x61e6, 0x00de, 0x0005, 0x00b6, 0x0096, 0x00d6, 0x2011,
-	0x1823, 0x2204, 0x9086, 0x0074, 0x1904, 0xa7ee, 0x6010, 0x2058,
-	0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c, 0xaa47, 0x0804, 0xa753,
-	0x00d6, 0x080c, 0x70ac, 0x0198, 0x0026, 0x2011, 0x0010, 0x080c,
-	0x6684, 0x002e, 0x05c8, 0x080c, 0x539a, 0x1540, 0x6014, 0x2048,
+	0x2a48, 0xa804, 0xa807, 0x0000, 0x0006, 0x080c, 0x6996, 0x000e,
+	0x2048, 0x9005, 0x1db0, 0x00fe, 0x00ae, 0x009e, 0x006e, 0x005e,
+	0x003e, 0x002e, 0x0005, 0x00d6, 0x00f6, 0x0096, 0x0006, 0x080c,
+	0x1022, 0x000e, 0x090c, 0x0d65, 0xa960, 0x21e8, 0xa95c, 0x9188,
+	0x0019, 0x21a0, 0x900e, 0x20a9, 0x0020, 0x4104, 0xaa66, 0xa87a,
+	0x2079, 0x1800, 0x798c, 0x810c, 0x9188, 0x000c, 0x9182, 0x001a,
+	0x0210, 0x2009, 0x001a, 0x21a8, 0x810b, 0xa972, 0xac76, 0x2e98,
+	0xa85c, 0x9080, 0x001f, 0x20a0, 0x2001, 0x0205, 0x200c, 0x918d,
+	0x0080, 0x2102, 0x4003, 0x2003, 0x0000, 0x080c, 0x6996, 0x009e,
+	0x00fe, 0x00de, 0x0005, 0x0016, 0x00d6, 0x00f6, 0x0096, 0x0016,
+	0x2001, 0x0205, 0x200c, 0x918d, 0x0080, 0x2102, 0x001e, 0x2079,
+	0x0200, 0x2e98, 0xa87c, 0xd0ec, 0x0118, 0x9e80, 0x000c, 0x2098,
+	0x2021, 0x003e, 0x901e, 0x9282, 0x0020, 0x0218, 0x2011, 0x0020,
+	0x2018, 0x9486, 0x003e, 0x1170, 0x0096, 0x080c, 0x1022, 0x2900,
+	0x009e, 0x05c0, 0xa806, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x0002, 0x20a0, 0x3300, 0x908e, 0x0260, 0x0140, 0x2009, 0x0280,
+	0x9102, 0x920a, 0x0218, 0x2010, 0x2100, 0x9318, 0x2200, 0x9402,
+	0x1228, 0x2400, 0x9202, 0x2410, 0x9318, 0x9006, 0x2020, 0x22a8,
+	0xa800, 0x9200, 0xa802, 0x20e1, 0x0000, 0x4003, 0x83ff, 0x0180,
+	0x3300, 0x9086, 0x0280, 0x1130, 0x7814, 0x8000, 0x9085, 0x0080,
+	0x7816, 0x2e98, 0x2310, 0x84ff, 0x0904, 0x9f60, 0x0804, 0x9f62,
+	0x9085, 0x0001, 0x7817, 0x0000, 0x009e, 0x00fe, 0x00de, 0x001e,
+	0x0005, 0x00d6, 0x0036, 0x0096, 0x6314, 0x2348, 0xa87a, 0xa982,
+	0x080c, 0x698a, 0x009e, 0x003e, 0x00de, 0x0005, 0x91b6, 0x0015,
+	0x1118, 0x080c, 0x9be7, 0x0030, 0x91b6, 0x0016, 0x190c, 0x0d65,
+	0x080c, 0x9be7, 0x0005, 0x20a9, 0x000e, 0x20e1, 0x0000, 0x2e98,
+	0x6014, 0x0096, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x20a0, 0x009e,
+	0x4003, 0x0136, 0x9080, 0x001b, 0x2011, 0x0006, 0x20a9, 0x0001,
+	0x3418, 0x8318, 0x23a0, 0x4003, 0x3318, 0x8318, 0x2398, 0x8211,
+	0x1db8, 0x2011, 0x0006, 0x013e, 0x20a0, 0x3318, 0x8318, 0x2398,
+	0x4003, 0x3418, 0x8318, 0x23a0, 0x8211, 0x1db8, 0x0096, 0x080c,
+	0xb847, 0x0130, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103,
+	0x009e, 0x0804, 0x9be7, 0x0096, 0x00d6, 0x0036, 0x7330, 0x9386,
+	0x0200, 0x11a8, 0x6010, 0x00b6, 0x2058, 0xb8c7, 0x0000, 0x00be,
+	0x6014, 0x9005, 0x0130, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103,
+	0xab32, 0x080c, 0x9be7, 0x003e, 0x00de, 0x009e, 0x0005, 0x0011,
+	0x1d48, 0x0cc8, 0x0006, 0x0016, 0x080c, 0xbf61, 0x0188, 0x6014,
+	0x9005, 0x1170, 0x600b, 0x0003, 0x601b, 0x0000, 0x604b, 0x0000,
+	0x2009, 0x0022, 0x080c, 0xa3dc, 0x9006, 0x001e, 0x000e, 0x0005,
+	0x9085, 0x0001, 0x0cd0, 0x0096, 0x0016, 0x20a9, 0x0014, 0x9e80,
+	0x000c, 0x20e1, 0x0000, 0x2098, 0x6014, 0x2048, 0xa860, 0x20e8,
+	0xa85c, 0x9080, 0x0002, 0x20a0, 0x4003, 0x2001, 0x0205, 0x2003,
+	0x0001, 0x2099, 0x0260, 0x20a9, 0x0016, 0x4003, 0x20a9, 0x000a,
+	0xa804, 0x2048, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0002, 0x20a0,
+	0x4003, 0x2001, 0x0205, 0x2003, 0x0002, 0x2099, 0x0260, 0x20a9,
+	0x0020, 0x4003, 0x2003, 0x0000, 0x6014, 0x2048, 0xa800, 0x2048,
+	0xa867, 0x0103, 0x080c, 0x9be7, 0x001e, 0x009e, 0x0005, 0x0096,
+	0x0016, 0x900e, 0x7030, 0x9086, 0x0100, 0x0140, 0x7038, 0x9084,
+	0x00ff, 0x800c, 0x703c, 0x9084, 0x00ff, 0x8004, 0x9080, 0x0004,
+	0x9108, 0x810b, 0x2011, 0x0002, 0x2019, 0x000c, 0x6014, 0x2048,
+	0x080c, 0xb41a, 0x080c, 0xb847, 0x0140, 0x6014, 0x2048, 0xa807,
+	0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103, 0x080c, 0x9be7, 0x001e,
+	0x009e, 0x0005, 0x0016, 0x0096, 0x7030, 0x9086, 0x0100, 0x1118,
+	0x2009, 0x0004, 0x0010, 0x7034, 0x800c, 0x810b, 0x2011, 0x000c,
+	0x2019, 0x000c, 0x6014, 0x2048, 0xa804, 0x0096, 0x9005, 0x0108,
+	0x2048, 0x080c, 0xb41a, 0x009e, 0x080c, 0xb847, 0x0148, 0xa804,
+	0x9005, 0x1158, 0xa807, 0x0000, 0xa864, 0xa8e2, 0xa867, 0x0103,
+	0x080c, 0x9be7, 0x009e, 0x001e, 0x0005, 0x0086, 0x2040, 0xa030,
+	0x8007, 0x9086, 0x0100, 0x1118, 0x080c, 0xa58f, 0x00e0, 0xa034,
+	0x8007, 0x800c, 0x8806, 0x8006, 0x8007, 0x90bc, 0x003f, 0x9084,
+	0xffc0, 0x9080, 0x000c, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897,
+	0x4000, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041,
+	0x1266, 0x0019, 0x0d08, 0x008e, 0x0898, 0x0096, 0x0006, 0x080c,
+	0x1022, 0x000e, 0x01b0, 0xa8ab, 0x0dcb, 0xa876, 0x000e, 0xa8a2,
+	0x0006, 0xae6a, 0x2800, 0xa89e, 0xa97a, 0xaf72, 0xaa8e, 0xab92,
+	0xac96, 0xad9a, 0x0086, 0x2940, 0x080c, 0x110c, 0x008e, 0x9085,
+	0x0001, 0x009e, 0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084,
+	0x00ff, 0x6210, 0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1520,
+	0x700c, 0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x11e0,
+	0x604b, 0x0000, 0x2c68, 0x0016, 0x2009, 0x0035, 0x080c, 0xbed9,
+	0x001e, 0x1158, 0x622c, 0x2268, 0x2071, 0x026c, 0x6b20, 0x9386,
+	0x0003, 0x0130, 0x9386, 0x0006, 0x0128, 0x080c, 0x9be7, 0x0020,
+	0x0039, 0x0010, 0x080c, 0xa211, 0x002e, 0x00de, 0x00ee, 0x0005,
+	0x0096, 0x6814, 0x2048, 0x9186, 0x0015, 0x0904, 0xa1f0, 0x918e,
+	0x0016, 0x1904, 0xa20f, 0x700c, 0x908c, 0xff00, 0x9186, 0x1700,
+	0x0120, 0x9186, 0x0300, 0x1904, 0xa1ca, 0x89ff, 0x1138, 0x6800,
+	0x9086, 0x000f, 0x0904, 0xa1ac, 0x0804, 0xa20d, 0x6808, 0x9086,
+	0xffff, 0x1904, 0xa1f2, 0xa87c, 0x9084, 0x0060, 0x9086, 0x0020,
+	0x1128, 0xa83c, 0xa940, 0x9105, 0x1904, 0xa1f2, 0x6824, 0xd0b4,
+	0x1904, 0xa1f2, 0x080c, 0xba36, 0x6864, 0xa882, 0xa87c, 0xc0dc,
+	0xc0f4, 0xc0d4, 0xa87e, 0x0026, 0x900e, 0x6a18, 0x2001, 0x000a,
+	0x080c, 0x8419, 0xa884, 0x920a, 0x0208, 0x8011, 0xaa86, 0x82ff,
+	0x002e, 0x1138, 0x00c6, 0x2d60, 0x080c, 0xb56d, 0x00ce, 0x0804,
+	0xa20d, 0x00c6, 0xa868, 0xd0fc, 0x1118, 0x080c, 0x5d56, 0x0010,
+	0x080c, 0x60fb, 0x00ce, 0x1904, 0xa1f2, 0x00c6, 0x2d60, 0x080c,
+	0x9be7, 0x00ce, 0x0804, 0xa20d, 0x00c6, 0x080c, 0x9c58, 0x0198,
+	0x6017, 0x0000, 0x6810, 0x6012, 0x080c, 0xbcdb, 0x6023, 0x0003,
+	0x6904, 0x00c6, 0x2d60, 0x080c, 0x9be7, 0x00ce, 0x080c, 0x9c85,
+	0x00ce, 0x0804, 0xa20d, 0x2001, 0x1959, 0x2004, 0x684a, 0x00ce,
+	0x0804, 0xa20d, 0x7008, 0x9086, 0x000b, 0x11c8, 0x6010, 0x00b6,
+	0x2058, 0xb900, 0xc1bc, 0xb902, 0x00be, 0x00c6, 0x2d60, 0xa87b,
+	0x0003, 0x080c, 0xbf1b, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
+	0x0002, 0x2009, 0x8020, 0x080c, 0x84d1, 0x00ce, 0x0430, 0x700c,
+	0x9086, 0x2a00, 0x1138, 0x2001, 0x1959, 0x2004, 0x684a, 0x00e8,
+	0x04c1, 0x00e8, 0x89ff, 0x090c, 0x0d65, 0x00c6, 0x00d6, 0x2d60,
+	0xa867, 0x0103, 0xa87b, 0x0003, 0x080c, 0x67ac, 0x080c, 0xba36,
+	0x080c, 0x9c21, 0x0026, 0x6010, 0x00b6, 0x2058, 0xba3c, 0x080c,
+	0x639b, 0x00be, 0x002e, 0x00de, 0x00ce, 0x080c, 0x9be7, 0x009e,
+	0x0005, 0x9186, 0x0015, 0x1128, 0x2001, 0x1959, 0x2004, 0x684a,
+	0x0068, 0x918e, 0x0016, 0x1160, 0x00c6, 0x2d00, 0x2060, 0x080c,
+	0xd4ce, 0x080c, 0x83c0, 0x080c, 0x9be7, 0x00ce, 0x080c, 0x9be7,
+	0x0005, 0x0026, 0x0036, 0x0046, 0x7228, 0xacb0, 0xabac, 0xd2f4,
+	0x0130, 0x2001, 0x1959, 0x2004, 0x684a, 0x0804, 0xa28b, 0x00c6,
+	0x2d60, 0x080c, 0xb445, 0x00ce, 0x6804, 0x9086, 0x0050, 0x1168,
+	0x00c6, 0x2d00, 0x2060, 0x6003, 0x0001, 0x6007, 0x0050, 0x2009,
+	0x8023, 0x080c, 0x84d1, 0x00ce, 0x04f0, 0x6800, 0x9086, 0x000f,
+	0x01a8, 0x89ff, 0x090c, 0x0d65, 0x6800, 0x9086, 0x0004, 0x1190,
+	0xa87c, 0xd0ac, 0x0178, 0xa843, 0x0fff, 0xa83f, 0x0fff, 0xa880,
+	0xc0fc, 0xa882, 0x2001, 0x0001, 0x6832, 0x0400, 0x2001, 0x0007,
+	0x6832, 0x00e0, 0xa87c, 0xd0b4, 0x1150, 0xd0ac, 0x0db8, 0x6824,
+	0xd0f4, 0x1d48, 0xa838, 0xa934, 0x9105, 0x0d80, 0x0c20, 0xd2ec,
+	0x1d68, 0x7024, 0x9306, 0x1118, 0x7020, 0x9406, 0x0d38, 0x7020,
+	0x683e, 0x7024, 0x683a, 0x2001, 0x0005, 0x6832, 0x080c, 0xbbc5,
+	0x080c, 0x8936, 0x0010, 0x080c, 0x9be7, 0x004e, 0x003e, 0x002e,
+	0x0005, 0x00e6, 0x00d6, 0x0026, 0x7008, 0x9084, 0x00ff, 0x6210,
+	0x00b6, 0x2258, 0xba10, 0x00be, 0x9206, 0x1904, 0xa2f6, 0x700c,
+	0x6210, 0x00b6, 0x2258, 0xba14, 0x00be, 0x9206, 0x1904, 0xa2f6,
+	0x6038, 0x2068, 0x6824, 0xc0dc, 0x6826, 0x6a20, 0x9286, 0x0007,
+	0x0904, 0xa2f6, 0x9286, 0x0002, 0x0904, 0xa2f6, 0x9286, 0x0000,
+	0x05e8, 0x6808, 0x633c, 0x9306, 0x15c8, 0x2071, 0x026c, 0x9186,
+	0x0015, 0x0570, 0x918e, 0x0016, 0x1100, 0x00c6, 0x6038, 0x2060,
+	0x6104, 0x9186, 0x004b, 0x01c0, 0x9186, 0x004c, 0x01a8, 0x9186,
+	0x004d, 0x0190, 0x9186, 0x004e, 0x0178, 0x9186, 0x0052, 0x0160,
+	0x6014, 0x0096, 0x2048, 0x080c, 0xb847, 0x090c, 0x0d65, 0xa87b,
+	0x0003, 0x009e, 0x080c, 0xbf1b, 0x6007, 0x0085, 0x6003, 0x000b,
+	0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x84d1, 0x00ce, 0x0030,
+	0x6038, 0x2070, 0x2001, 0x1959, 0x2004, 0x704a, 0x080c, 0x9be7,
+	0x002e, 0x00de, 0x00ee, 0x0005, 0x00b6, 0x0096, 0x00f6, 0x6014,
+	0x2048, 0x6010, 0x2058, 0x91b6, 0x0015, 0x0130, 0xba08, 0xbb0c,
+	0xbc00, 0xc48c, 0xbc02, 0x0460, 0x0096, 0x0156, 0x0036, 0x0026,
+	0x2b48, 0x9e90, 0x0010, 0x2019, 0x000a, 0x20a9, 0x0004, 0x080c,
+	0xabdf, 0x002e, 0x003e, 0x015e, 0x009e, 0x1904, 0xa365, 0x0096,
+	0x0156, 0x0036, 0x0026, 0x2b48, 0x9e90, 0x0014, 0x2019, 0x0006,
+	0x20a9, 0x0004, 0x080c, 0xabdf, 0x002e, 0x003e, 0x015e, 0x009e,
+	0x15a0, 0x7238, 0xba0a, 0x733c, 0xbb0e, 0xbc00, 0xc48d, 0xbc02,
+	0xa804, 0x9005, 0x1128, 0x00fe, 0x009e, 0x00be, 0x0804, 0x9ff6,
+	0x0096, 0x2048, 0xaa12, 0xab16, 0xac0a, 0x009e, 0x8006, 0x8006,
+	0x8007, 0x90bc, 0x003f, 0x9084, 0xffc0, 0x9080, 0x0002, 0x2009,
+	0x002b, 0xaaa0, 0xab9c, 0xaca8, 0xada4, 0x2031, 0x0000, 0x2041,
+	0x1266, 0x080c, 0xa0f5, 0x0130, 0x00fe, 0x009e, 0x080c, 0x9be7,
+	0x00be, 0x0005, 0x080c, 0xa58f, 0x0cb8, 0x2b78, 0x00f6, 0x080c,
+	0x3006, 0x080c, 0xbf76, 0x00fe, 0x00c6, 0x080c, 0x9b91, 0x2f00,
+	0x6012, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001, 0x6003,
+	0x0001, 0x2001, 0x0007, 0x080c, 0x61c1, 0x080c, 0x61ed, 0x080c,
+	0x84d8, 0x080c, 0x8936, 0x00ce, 0x0804, 0xa338, 0x2100, 0x91b2,
+	0x0053, 0x1a0c, 0x0d65, 0x91b2, 0x0040, 0x1a04, 0xa3ee, 0x0002,
+	0xa3dc, 0xa3dc, 0xa3d2, 0xa3dc, 0xa3dc, 0xa3dc, 0xa3d0, 0xa3d0,
+	0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0,
+	0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0,
+	0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3dc,
+	0xa3d0, 0xa3dc, 0xa3dc, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0,
+	0xa3d2, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0,
+	0xa3d0, 0xa3d0, 0xa3dc, 0xa3dc, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0,
+	0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3d0, 0xa3dc, 0xa3d0, 0xa3d0,
+	0x080c, 0x0d65, 0x0066, 0x00b6, 0x6610, 0x2658, 0xb8c4, 0xc08c,
+	0xb8c6, 0x00be, 0x006e, 0x0000, 0x6003, 0x0001, 0x6106, 0x9186,
+	0x0032, 0x0118, 0x080c, 0x84d8, 0x0010, 0x080c, 0x84d1, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x8936, 0x012e, 0x0005, 0x2600, 0x0002,
+	0xa402, 0xa402, 0xa402, 0xa3dc, 0xa3dc, 0xa402, 0xa402, 0xa402,
+	0xa402, 0xa3dc, 0xa402, 0xa3dc, 0xa402, 0xa3dc, 0xa402, 0xa402,
+	0xa402, 0xa402, 0x080c, 0x0d65, 0x6004, 0x90b2, 0x0053, 0x1a0c,
+	0x0d65, 0x91b6, 0x0013, 0x0904, 0xa4d9, 0x91b6, 0x0027, 0x1904,
+	0xa485, 0x080c, 0x8874, 0x6004, 0x080c, 0xba4b, 0x01b0, 0x080c,
+	0xba5c, 0x01a8, 0x908e, 0x0021, 0x0904, 0xa482, 0x908e, 0x0022,
+	0x1130, 0x080c, 0xa022, 0x0904, 0xa47e, 0x0804, 0xa47f, 0x908e,
+	0x003d, 0x0904, 0xa482, 0x0804, 0xa478, 0x080c, 0x303b, 0x2001,
+	0x0007, 0x080c, 0x61c1, 0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be,
+	0x080c, 0xa58f, 0x9186, 0x007e, 0x1148, 0x2001, 0x1836, 0x2014,
+	0xc285, 0x080c, 0x70b7, 0x1108, 0xc2ad, 0x2202, 0x080c, 0x98c8,
+	0x0036, 0x0026, 0x2019, 0x0028, 0x2110, 0x080c, 0xd529, 0x002e,
+	0x003e, 0x0016, 0x0026, 0x0036, 0x2110, 0x2019, 0x0028, 0x080c,
+	0x863b, 0x0076, 0x903e, 0x080c, 0x852a, 0x6010, 0x00b6, 0x905d,
+	0x0100, 0x00be, 0x2c08, 0x080c, 0xcfc8, 0x007e, 0x003e, 0x002e,
+	0x001e, 0x080c, 0x98e4, 0x080c, 0xbf76, 0x0016, 0x080c, 0xbcd3,
+	0x080c, 0x9be7, 0x001e, 0x080c, 0x311a, 0x080c, 0x8936, 0x0030,
+	0x080c, 0xbcd3, 0x080c, 0x9be7, 0x080c, 0x8936, 0x0005, 0x080c,
+	0xa58f, 0x0cb0, 0x080c, 0xa5cb, 0x0c98, 0x9186, 0x0015, 0x0118,
+	0x9186, 0x0016, 0x1140, 0x080c, 0x9ab7, 0x0d80, 0x9086, 0x0002,
+	0x0904, 0xa5d6, 0x0c58, 0x9186, 0x0014, 0x1d40, 0x080c, 0x8874,
+	0x6004, 0x908e, 0x0022, 0x1118, 0x080c, 0xa022, 0x09f8, 0x080c,
+	0x3006, 0x080c, 0xbf76, 0x080c, 0xba4b, 0x1190, 0x080c, 0x303b,
+	0x6010, 0x00b6, 0x2058, 0xb9a0, 0x00be, 0x080c, 0xa58f, 0x9186,
+	0x007e, 0x1128, 0x2001, 0x1836, 0x200c, 0xc185, 0x2102, 0x0800,
+	0x080c, 0xba5c, 0x1120, 0x080c, 0xa58f, 0x0804, 0xa478, 0x6004,
+	0x908e, 0x0032, 0x1160, 0x00e6, 0x00f6, 0x2071, 0x1894, 0x2079,
+	0x0000, 0x080c, 0x33bc, 0x00fe, 0x00ee, 0x0804, 0xa478, 0x6004,
+	0x908e, 0x0021, 0x0d40, 0x908e, 0x0022, 0x090c, 0xa58f, 0x0804,
+	0xa478, 0x90b2, 0x0040, 0x1a04, 0xa578, 0x2008, 0x0002, 0xa521,
+	0xa522, 0xa525, 0xa528, 0xa52b, 0xa52e, 0xa51f, 0xa51f, 0xa51f,
+	0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f,
+	0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f,
+	0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa531, 0xa53a, 0xa51f,
+	0xa53b, 0xa53a, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa53a,
+	0xa53a, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f, 0xa51f,
+	0xa51f, 0xa563, 0xa53a, 0xa51f, 0xa536, 0xa51f, 0xa51f, 0xa51f,
+	0xa537, 0xa51f, 0xa51f, 0xa51f, 0xa53a, 0xa55e, 0xa51f, 0x080c,
+	0x0d65, 0x00c0, 0x2001, 0x000b, 0x00e8, 0x2001, 0x0003, 0x00d0,
+	0x2001, 0x0005, 0x00b8, 0x2001, 0x0001, 0x00a0, 0x2001, 0x0009,
+	0x0088, 0x6003, 0x0005, 0x080c, 0x8936, 0x0058, 0x0018, 0x0010,
+	0x080c, 0x61c1, 0x04b8, 0x080c, 0xbf79, 0x6003, 0x0004, 0x080c,
+	0x8936, 0x0005, 0x080c, 0x61c1, 0x6003, 0x0002, 0x0036, 0x2019,
+	0x185e, 0x2304, 0x9084, 0xff00, 0x1120, 0x2001, 0x1957, 0x201c,
+	0x0040, 0x8007, 0x909a, 0x0004, 0x0ec0, 0x8003, 0x801b, 0x831b,
+	0x9318, 0x631a, 0x003e, 0x080c, 0x8936, 0x0c18, 0x080c, 0xbcd3,
+	0x080c, 0x9be7, 0x08f0, 0x00e6, 0x00f6, 0x2071, 0x1894, 0x2079,
+	0x0000, 0x080c, 0x33bc, 0x00fe, 0x00ee, 0x080c, 0x8874, 0x080c,
+	0x9be7, 0x0878, 0x6003, 0x0002, 0x080c, 0xbf79, 0x0804, 0x8936,
+	0x2600, 0x2008, 0x0002, 0xa58d, 0xa58d, 0xa58d, 0xa572, 0xa572,
+	0xa58d, 0xa58d, 0xa58d, 0xa58d, 0xa572, 0xa58d, 0xa572, 0xa58d,
+	0xa572, 0xa58d, 0xa58d, 0xa58d, 0xa58d, 0x080c, 0x0d65, 0x00e6,
+	0x0096, 0x0026, 0x0016, 0x080c, 0xb847, 0x0568, 0x6014, 0x2048,
+	0xa864, 0x9086, 0x0139, 0x11a8, 0xa894, 0x9086, 0x0056, 0x1148,
+	0x080c, 0x512e, 0x0130, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000,
+	0x0028, 0x2001, 0x0030, 0x900e, 0x2011, 0x4005, 0x080c, 0xbe40,
+	0x0090, 0xa868, 0xd0fc, 0x0178, 0xa807, 0x0000, 0x0016, 0x6004,
+	0x908e, 0x0021, 0x0168, 0x908e, 0x003d, 0x0150, 0x001e, 0xa867,
+	0x0103, 0xa833, 0x0100, 0x001e, 0x002e, 0x009e, 0x00ee, 0x0005,
+	0x001e, 0x0009, 0x0cc0, 0x0096, 0x6014, 0x2048, 0xa800, 0x2048,
+	0xa867, 0x0103, 0xa823, 0x8001, 0x009e, 0x0005, 0x00b6, 0x6610,
+	0x2658, 0xb804, 0x9084, 0x00ff, 0x90b2, 0x000c, 0x1a0c, 0x0d65,
+	0x6604, 0x96b6, 0x004d, 0x1120, 0x080c, 0xbd5f, 0x0804, 0xa653,
+	0x6604, 0x96b6, 0x0043, 0x1120, 0x080c, 0xbda8, 0x0804, 0xa653,
+	0x6604, 0x96b6, 0x004b, 0x1120, 0x080c, 0xbdd4, 0x0804, 0xa653,
+	0x6604, 0x96b6, 0x0033, 0x1120, 0x080c, 0xbcf5, 0x0804, 0xa653,
+	0x6604, 0x96b6, 0x0028, 0x1120, 0x080c, 0xba95, 0x0804, 0xa653,
+	0x6604, 0x96b6, 0x0029, 0x1120, 0x080c, 0xbad6, 0x0804, 0xa653,
+	0x6604, 0x96b6, 0x001f, 0x1118, 0x080c, 0x9fcb, 0x04e0, 0x6604,
+	0x96b6, 0x0000, 0x1118, 0x080c, 0xa2fc, 0x04a8, 0x6604, 0x96b6,
+	0x0022, 0x1118, 0x080c, 0xa003, 0x0470, 0x6604, 0x96b6, 0x0035,
+	0x1118, 0x080c, 0xa113, 0x0438, 0x6604, 0x96b6, 0x0039, 0x1118,
+	0x080c, 0xa291, 0x0400, 0x6604, 0x96b6, 0x003d, 0x1118, 0x080c,
+	0xa03b, 0x00c8, 0x6604, 0x96b6, 0x0044, 0x1118, 0x080c, 0xa077,
+	0x0090, 0x6604, 0x96b6, 0x0049, 0x1118, 0x080c, 0xa0a2, 0x0058,
+	0x91b6, 0x0015, 0x1110, 0x0063, 0x0030, 0x91b6, 0x0016, 0x1128,
+	0x00be, 0x0804, 0xa911, 0x00be, 0x0005, 0x080c, 0x9ca2, 0x0cd8,
+	0xa670, 0xa673, 0xa670, 0xa6b7, 0xa670, 0xa845, 0xa91e, 0xa670,
+	0xa670, 0xa8eb, 0xa670, 0xa8ff, 0x0096, 0x080c, 0x1595, 0x6014,
+	0x2048, 0xa800, 0x2048, 0xa867, 0x0103, 0x009e, 0x0804, 0x9be7,
+	0xa001, 0xa001, 0x0005, 0x00e6, 0x2071, 0x1800, 0x708c, 0x9086,
+	0x0074, 0x1540, 0x080c, 0xcf99, 0x11b0, 0x6010, 0x00b6, 0x2058,
+	0x7030, 0xd08c, 0x0128, 0xb800, 0xd0bc, 0x0110, 0xc0c5, 0xb802,
+	0x00e9, 0x00be, 0x2001, 0x0006, 0x080c, 0x61c1, 0x080c, 0x303b,
+	0x080c, 0x9be7, 0x0088, 0x2001, 0x000a, 0x080c, 0x61c1, 0x080c,
+	0x303b, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x84d8, 0x080c,
+	0x8936, 0x0010, 0x080c, 0xa830, 0x00ee, 0x0005, 0x00d6, 0xb800,
+	0xd084, 0x0158, 0x9006, 0x080c, 0x61ad, 0x2069, 0x1853, 0x6804,
+	0x0020, 0x2001, 0x0006, 0x080c, 0x61ed, 0x00de, 0x0005, 0x00b6,
+	0x0096, 0x00d6, 0x2011, 0x1823, 0x2204, 0x9086, 0x0074, 0x1904,
+	0xa809, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x007e, 0x1120, 0x080c,
+	0xaa62, 0x0804, 0xa76e, 0x00d6, 0x080c, 0x70b7, 0x0198, 0x0026,
+	0x2011, 0x0010, 0x080c, 0x668b, 0x002e, 0x05c8, 0x080c, 0x53a1,
+	0x1540, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
+	0xdead, 0x00f8, 0x0026, 0x2011, 0x8008, 0x080c, 0x668b, 0x002e,
+	0x0530, 0x6014, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
+	0x1140, 0x2001, 0x0030, 0x900e, 0x2011, 0x4009, 0x080c, 0xbe40,
+	0x0040, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833,
+	0xdead, 0x6010, 0x2058, 0xb9a0, 0x0016, 0x080c, 0x303b, 0x080c,
+	0x9be7, 0x001e, 0x080c, 0x311a, 0x00de, 0x0804, 0xa80a, 0x00de,
+	0x080c, 0xaa57, 0x6010, 0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510,
+	0x6014, 0x9005, 0x01a8, 0x2048, 0xa864, 0x9084, 0x00ff, 0x9086,
+	0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c,
+	0xbe40, 0x0030, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
+	0x2001, 0x0006, 0x080c, 0x61c1, 0x080c, 0x303b, 0x080c, 0x9be7,
+	0x0804, 0xa80a, 0x080c, 0xa818, 0x6014, 0x9005, 0x0190, 0x2048,
+	0xa868, 0xd0f4, 0x01e8, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
+	0x1d08, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xbe40,
+	0x08f8, 0x080c, 0xa80e, 0x0160, 0x9006, 0x080c, 0x61ad, 0x2001,
+	0x0004, 0x080c, 0x61ed, 0x2001, 0x0007, 0x080c, 0x61c1, 0x08a0,
+	0x2001, 0x0004, 0x080c, 0x61c1, 0x6003, 0x0001, 0x6007, 0x0003,
+	0x080c, 0x84d8, 0x080c, 0x8936, 0x0804, 0xa80a, 0xb85c, 0xd0e4,
+	0x01d0, 0x080c, 0xbc6d, 0x080c, 0x70b7, 0x0118, 0xd0dc, 0x1904,
+	0xa730, 0x2011, 0x1836, 0x2204, 0xc0ad, 0x2012, 0x2001, 0x0002,
+	0x00f6, 0x2079, 0x0100, 0x78e3, 0x0000, 0x080c, 0x2498, 0x78e2,
+	0x00fe, 0x0804, 0xa730, 0x080c, 0xbcae, 0x2011, 0x1836, 0x2204,
+	0xc0a5, 0x2012, 0x0006, 0x080c, 0xd0fe, 0x000e, 0x1904, 0xa730,
+	0xc0b5, 0x2012, 0x2001, 0x0006, 0x080c, 0x61c1, 0x9006, 0x080c,
+	0x61ad, 0x00c6, 0x2001, 0x180f, 0x2004, 0xd09c, 0x0520, 0x00f6,
+	0x2079, 0x0100, 0x00e6, 0x2071, 0x1800, 0x700c, 0x9084, 0x00ff,
+	0x78e6, 0x707a, 0x7010, 0x78ea, 0x707e, 0x908c, 0x00ff, 0x00ee,
+	0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x246d, 0x00f6, 0x2100,
+	0x900e, 0x080c, 0x2424, 0x795a, 0x00fe, 0x9186, 0x0081, 0x01d8,
+	0x2009, 0x0081, 0x00c8, 0x2009, 0x00ef, 0x00f6, 0x2079, 0x0100,
+	0x79ea, 0x7932, 0x7936, 0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c,
+	0x246d, 0x00f6, 0x2079, 0x1800, 0x797e, 0x2100, 0x900e, 0x080c,
+	0x2424, 0x795a, 0x00fe, 0x8108, 0x080c, 0x6210, 0x2b00, 0x00ce,
+	0x1904, 0xa730, 0x6012, 0x2009, 0x180f, 0x210c, 0xd19c, 0x0150,
+	0x2009, 0x027c, 0x210c, 0x918c, 0x00ff, 0xb912, 0x2009, 0x027d,
+	0x210c, 0xb916, 0x2001, 0x0002, 0x080c, 0x61c1, 0x6023, 0x0001,
+	0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x84d8, 0x080c, 0x8936,
+	0x0008, 0x0431, 0x00de, 0x009e, 0x00be, 0x0005, 0x2001, 0x1810,
+	0x2004, 0xd0a4, 0x0120, 0x2001, 0x1854, 0x2004, 0xd0ac, 0x0005,
+	0x00e6, 0x080c, 0xd582, 0x0190, 0x2071, 0x0260, 0x7108, 0x720c,
+	0x918c, 0x00ff, 0x1118, 0x9284, 0xff00, 0x0140, 0x6010, 0x2058,
+	0xb8a0, 0x9084, 0xff80, 0x1110, 0xb912, 0xba16, 0x00ee, 0x0005,
+	0x2030, 0x2001, 0x0007, 0x080c, 0x61c1, 0x080c, 0x53a1, 0x1120,
+	0x2001, 0x0007, 0x080c, 0x61ed, 0x080c, 0x303b, 0x6020, 0x9086,
+	0x000a, 0x1108, 0x0005, 0x0804, 0x9be7, 0x00b6, 0x00e6, 0x0026,
+	0x0016, 0x2071, 0x1800, 0x708c, 0x9086, 0x0014, 0x1904, 0xa8e2,
+	0x00d6, 0x080c, 0x70b7, 0x0198, 0x0026, 0x2011, 0x0010, 0x080c,
+	0x668b, 0x002e, 0x05c8, 0x080c, 0x53a1, 0x1540, 0x6014, 0x2048,
 	0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x00f8, 0x0026,
-	0x2011, 0x8008, 0x080c, 0x6684, 0x002e, 0x0530, 0x6014, 0x2048,
+	0x2011, 0x8008, 0x080c, 0x668b, 0x002e, 0x0530, 0x6014, 0x2048,
 	0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0030,
-	0x900e, 0x2011, 0x4009, 0x080c, 0xbe25, 0x0040, 0x6014, 0x2048,
+	0x900e, 0x2011, 0x4009, 0x080c, 0xbe40, 0x0040, 0x6014, 0x2048,
 	0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0xdead, 0x6010, 0x2058,
-	0xb9a0, 0x0016, 0x080c, 0x3034, 0x080c, 0x9bcc, 0x001e, 0x080c,
-	0x3113, 0x00de, 0x0804, 0xa7ef, 0x00de, 0x080c, 0xaa3c, 0x6010,
-	0x2058, 0xbaa0, 0x9286, 0x0080, 0x1510, 0x6014, 0x9005, 0x01a8,
-	0x2048, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1140, 0x2001,
-	0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xbe25, 0x0030, 0xa807,
-	0x0000, 0xa867, 0x0103, 0xa833, 0x0200, 0x2001, 0x0006, 0x080c,
-	0x61ba, 0x080c, 0x3034, 0x080c, 0x9bcc, 0x0804, 0xa7ef, 0x080c,
-	0xa7fd, 0x6014, 0x9005, 0x0190, 0x2048, 0xa868, 0xd0f4, 0x01e8,
-	0xa864, 0x9084, 0x00ff, 0x9086, 0x0039, 0x1d08, 0x2001, 0x0000,
-	0x900e, 0x2011, 0x4000, 0x080c, 0xbe25, 0x08f8, 0x080c, 0xa7f3,
-	0x0160, 0x9006, 0x080c, 0x61a6, 0x2001, 0x0004, 0x080c, 0x61e6,
-	0x2001, 0x0007, 0x080c, 0x61ba, 0x08a0, 0x2001, 0x0004, 0x080c,
-	0x61ba, 0x6003, 0x0001, 0x6007, 0x0003, 0x080c, 0x84b0, 0x080c,
-	0x890e, 0x0804, 0xa7ef, 0xb85c, 0xd0e4, 0x01d0, 0x080c, 0xbc52,
-	0x080c, 0x70ac, 0x0118, 0xd0dc, 0x1904, 0xa715, 0x2011, 0x1836,
-	0x2204, 0xc0ad, 0x2012, 0x2001, 0x0002, 0x00f6, 0x2079, 0x0100,
-	0x78e3, 0x0000, 0x080c, 0x2498, 0x78e2, 0x00fe, 0x0804, 0xa715,
-	0x080c, 0xbc93, 0x2011, 0x1836, 0x2204, 0xc0a5, 0x2012, 0x0006,
-	0x080c, 0xd0dc, 0x000e, 0x1904, 0xa715, 0xc0b5, 0x2012, 0x2001,
-	0x0006, 0x080c, 0x61ba, 0x9006, 0x080c, 0x61a6, 0x00c6, 0x2001,
-	0x180f, 0x2004, 0xd09c, 0x0520, 0x00f6, 0x2079, 0x0100, 0x00e6,
-	0x2071, 0x1800, 0x700c, 0x9084, 0x00ff, 0x78e6, 0x707a, 0x7010,
-	0x78ea, 0x707e, 0x908c, 0x00ff, 0x00ee, 0x780c, 0xc0b5, 0x780e,
-	0x00fe, 0x080c, 0x246d, 0x00f6, 0x2100, 0x900e, 0x080c, 0x2424,
-	0x795a, 0x00fe, 0x9186, 0x0081, 0x01d8, 0x2009, 0x0081, 0x00c8,
-	0x2009, 0x00ef, 0x00f6, 0x2079, 0x0100, 0x79ea, 0x7932, 0x7936,
-	0x780c, 0xc0b5, 0x780e, 0x00fe, 0x080c, 0x246d, 0x00f6, 0x2079,
-	0x1800, 0x797e, 0x2100, 0x900e, 0x080c, 0x2424, 0x795a, 0x00fe,
-	0x8108, 0x080c, 0x6209, 0x2b00, 0x00ce, 0x1904, 0xa715, 0x6012,
-	0x2009, 0x180f, 0x210c, 0xd19c, 0x0150, 0x2009, 0x027c, 0x210c,
-	0x918c, 0x00ff, 0xb912, 0x2009, 0x027d, 0x210c, 0xb916, 0x2001,
-	0x0002, 0x080c, 0x61ba, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007,
-	0x0002, 0x080c, 0x84b0, 0x080c, 0x890e, 0x0008, 0x0431, 0x00de,
-	0x009e, 0x00be, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0a4, 0x0120,
-	0x2001, 0x1854, 0x2004, 0xd0ac, 0x0005, 0x00e6, 0x080c, 0xd560,
-	0x0190, 0x2071, 0x0260, 0x7108, 0x720c, 0x918c, 0x00ff, 0x1118,
-	0x9284, 0xff00, 0x0140, 0x6010, 0x2058, 0xb8a0, 0x9084, 0xff80,
-	0x1110, 0xb912, 0xba16, 0x00ee, 0x0005, 0x2030, 0x2001, 0x0007,
-	0x080c, 0x61ba, 0x080c, 0x539a, 0x1120, 0x2001, 0x0007, 0x080c,
-	0x61e6, 0x080c, 0x3034, 0x6020, 0x9086, 0x000a, 0x1108, 0x0005,
-	0x0804, 0x9bcc, 0x00b6, 0x00e6, 0x0026, 0x0016, 0x2071, 0x1800,
-	0x708c, 0x9086, 0x0014, 0x1904, 0xa8c7, 0x00d6, 0x080c, 0x70ac,
-	0x0198, 0x0026, 0x2011, 0x0010, 0x080c, 0x6684, 0x002e, 0x05c8,
-	0x080c, 0x539a, 0x1540, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867,
-	0x0103, 0xa833, 0xdead, 0x00f8, 0x0026, 0x2011, 0x8008, 0x080c,
-	0x6684, 0x002e, 0x0530, 0x6014, 0x2048, 0xa864, 0x9084, 0x00ff,
-	0x9086, 0x0039, 0x1140, 0x2001, 0x0030, 0x900e, 0x2011, 0x4009,
-	0x080c, 0xbe25, 0x0040, 0x6014, 0x2048, 0xa807, 0x0000, 0xa867,
-	0x0103, 0xa833, 0xdead, 0x6010, 0x2058, 0xb9a0, 0x0016, 0x080c,
-	0x3034, 0x080c, 0x9bcc, 0x001e, 0x080c, 0x3113, 0x00de, 0x0804,
-	0xa8cb, 0x00de, 0x080c, 0x539a, 0x1170, 0x6014, 0x9005, 0x1158,
-	0x0036, 0x0046, 0x6010, 0x2058, 0xbba0, 0x2021, 0x0006, 0x080c,
-	0x4a6e, 0x004e, 0x003e, 0x00d6, 0x6010, 0x2058, 0x080c, 0x6304,
-	0x080c, 0xa68b, 0x00de, 0x080c, 0xab0d, 0x1588, 0x6010, 0x2058,
-	0xb890, 0x9005, 0x0560, 0x2001, 0x0006, 0x080c, 0x61ba, 0x0096,
-	0x6014, 0x904d, 0x01d0, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0039,
-	0x1140, 0x2001, 0x0000, 0x900e, 0x2011, 0x4000, 0x080c, 0xbe25,
-	0x0060, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0029, 0x0130, 0xa807,
-	0x0000, 0xa867, 0x0103, 0xa833, 0x0200, 0x009e, 0x080c, 0x3034,
-	0x6020, 0x9086, 0x000a, 0x0138, 0x080c, 0x9bcc, 0x0020, 0x080c,
-	0xa574, 0x080c, 0xa815, 0x001e, 0x002e, 0x00ee, 0x00be, 0x0005,
-	0x2011, 0x1823, 0x2204, 0x9086, 0x0014, 0x1160, 0x2001, 0x0002,
-	0x080c, 0x61ba, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x84b0,
-	0x0804, 0x890e, 0x0804, 0xa815, 0x2030, 0x2011, 0x1823, 0x2204,
-	0x9086, 0x0004, 0x1148, 0x96b6, 0x000b, 0x1120, 0x2001, 0x0007,
-	0x080c, 0x61ba, 0x0804, 0x9bcc, 0x0804, 0xa815, 0x0002, 0xa655,
-	0xa90e, 0xa655, 0xa94d, 0xa655, 0xa9f8, 0xa903, 0xa655, 0xa655,
-	0xaa0b, 0xa655, 0xaa1b, 0x6604, 0x9686, 0x0003, 0x0904, 0xa82a,
-	0x96b6, 0x001e, 0x1110, 0x080c, 0x9bcc, 0x0005, 0x00b6, 0x00d6,
-	0x00c6, 0x080c, 0xaa2b, 0x11a0, 0x9006, 0x080c, 0x61a6, 0x080c,
-	0x3003, 0x080c, 0xbf5b, 0x2001, 0x0002, 0x080c, 0x61ba, 0x6003,
-	0x0001, 0x6007, 0x0002, 0x080c, 0x84b0, 0x080c, 0x890e, 0x0408,
-	0x2009, 0x026e, 0x2104, 0x9086, 0x0009, 0x1160, 0x6010, 0x2058,
-	0xb840, 0x9084, 0x00ff, 0x9005, 0x0170, 0x8001, 0xb842, 0x601b,
-	0x000a, 0x0078, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x9086,
-	0x1900, 0x1108, 0x08a0, 0x080c, 0x3003, 0x080c, 0xbf5b, 0x080c,
-	0xa815, 0x00ce, 0x00de, 0x00be, 0x0005, 0x0096, 0x00b6, 0x0026,
-	0x9016, 0x080c, 0xaa39, 0x00d6, 0x2069, 0x194d, 0x2d04, 0x9005,
-	0x0168, 0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1138, 0x2069,
-	0x181f, 0x2d04, 0x8000, 0x206a, 0x00de, 0x0010, 0x00de, 0x0088,
-	0x9006, 0x080c, 0x61a6, 0x2001, 0x0002, 0x080c, 0x61ba, 0x6003,
-	0x0001, 0x6007, 0x0002, 0x080c, 0x84b0, 0x080c, 0x890e, 0x0804,
-	0xa9c8, 0x080c, 0xb82c, 0x01b0, 0x6014, 0x2048, 0xa864, 0x2010,
-	0x9086, 0x0139, 0x1138, 0x6007, 0x0016, 0x2001, 0x0002, 0x080c,
-	0xbe7f, 0x00b0, 0x6014, 0x2048, 0xa864, 0xd0fc, 0x0118, 0x2001,
-	0x0001, 0x0ca8, 0x2001, 0x180e, 0x2004, 0xd0dc, 0x0148, 0x6010,
-	0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x1110, 0x9006, 0x0c38,
-	0x080c, 0xa574, 0x2009, 0x026e, 0x2134, 0x96b4, 0x00ff, 0x9686,
-	0x0005, 0x0510, 0x9686, 0x000b, 0x01c8, 0x2009, 0x026f, 0x2104,
-	0x9084, 0xff00, 0x1118, 0x9686, 0x0009, 0x01b0, 0x9086, 0x1900,
-	0x1168, 0x9686, 0x0009, 0x0180, 0x2001, 0x0004, 0x080c, 0x61ba,
-	0x2001, 0x0028, 0x601a, 0x6007, 0x0052, 0x0010, 0x080c, 0xa815,
-	0x002e, 0x00be, 0x009e, 0x0005, 0x9286, 0x0139, 0x0160, 0x6014,
-	0x2048, 0x080c, 0xb82c, 0x0140, 0xa864, 0x9086, 0x0139, 0x0118,
-	0xa868, 0xd0fc, 0x0108, 0x0c50, 0x6010, 0x2058, 0xb840, 0x9084,
-	0x00ff, 0x9005, 0x0138, 0x8001, 0xb842, 0x601b, 0x000a, 0x6007,
-	0x0016, 0x08f0, 0xb8a0, 0x9086, 0x007e, 0x1138, 0x00e6, 0x2071,
-	0x1800, 0x080c, 0x5c68, 0x00ee, 0x0010, 0x080c, 0x3003, 0x0870,
-	0x080c, 0xaa39, 0x1160, 0x2001, 0x0004, 0x080c, 0x61ba, 0x6003,
-	0x0001, 0x6007, 0x0003, 0x080c, 0x84b0, 0x0804, 0x890e, 0x080c,
-	0xa574, 0x0804, 0xa815, 0x0469, 0x1160, 0x2001, 0x0008, 0x080c,
-	0x61ba, 0x6003, 0x0001, 0x6007, 0x0005, 0x080c, 0x84b0, 0x0804,
-	0x890e, 0x0804, 0xa815, 0x00e9, 0x1160, 0x2001, 0x000a, 0x080c,
-	0x61ba, 0x6003, 0x0001, 0x6007, 0x0001, 0x080c, 0x84b0, 0x0804,
-	0x890e, 0x0804, 0xa815, 0x2009, 0x026e, 0x2104, 0x9086, 0x0003,
-	0x1138, 0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x9086, 0x2a00,
-	0x0005, 0x9085, 0x0001, 0x0005, 0x00b6, 0x00c6, 0x0016, 0x6110,
-	0x2158, 0x080c, 0x6278, 0x001e, 0x00ce, 0x00be, 0x0005, 0x00b6,
-	0x00f6, 0x00e6, 0x00d6, 0x0036, 0x0016, 0x6010, 0x2058, 0x2009,
-	0x1836, 0x2104, 0x9085, 0x0003, 0x200a, 0x080c, 0xaadf, 0x0560,
-	0x2009, 0x1836, 0x2104, 0xc0cd, 0x200a, 0x080c, 0x665c, 0x0158,
-	0x9006, 0x2020, 0x2009, 0x002a, 0x080c, 0xd251, 0x2001, 0x180c,
-	0x200c, 0xc195, 0x2102, 0x2019, 0x002a, 0x2009, 0x0001, 0x080c,
-	0x2fc2, 0x00e6, 0x2071, 0x1800, 0x080c, 0x2ddb, 0x00ee, 0x00c6,
-	0x0156, 0x20a9, 0x0781, 0x2009, 0x007f, 0x080c, 0x3113, 0x8108,
-	0x1f04, 0xaa7d, 0x015e, 0x00ce, 0x080c, 0xaa3c, 0x2071, 0x0260,
-	0x2079, 0x0200, 0x7817, 0x0001, 0x2001, 0x1836, 0x200c, 0xc1c5,
-	0x7018, 0xd0fc, 0x0110, 0xd0dc, 0x0118, 0x7038, 0xd0dc, 0x1108,
-	0xc1c4, 0x7817, 0x0000, 0x2001, 0x1836, 0x2102, 0x2079, 0x0100,
-	0x2e04, 0x9084, 0x00ff, 0x2069, 0x181e, 0x206a, 0x78e6, 0x0006,
-	0x8e70, 0x2e04, 0x2069, 0x181f, 0x206a, 0x78ea, 0x7832, 0x7836,
-	0x2010, 0x9084, 0xff00, 0x001e, 0x9105, 0x2009, 0x182b, 0x200a,
-	0x2200, 0x9084, 0x00ff, 0x2008, 0x080c, 0x246d, 0x080c, 0x70ac,
-	0x0170, 0x2071, 0x0260, 0x2069, 0x1953, 0x7048, 0x206a, 0x704c,
-	0x6806, 0x7050, 0x680a, 0x7054, 0x680e, 0x080c, 0xbc52, 0x0040,
-	0x2001, 0x0006, 0x080c, 0x61ba, 0x080c, 0x3034, 0x080c, 0x9bcc,
-	0x001e, 0x003e, 0x00de, 0x00ee, 0x00fe, 0x00be, 0x0005, 0x0096,
-	0x0026, 0x0036, 0x00e6, 0x0156, 0x2019, 0x182b, 0x231c, 0x83ff,
-	0x01f0, 0x2071, 0x0260, 0x7200, 0x9294, 0x00ff, 0x7004, 0x9084,
-	0xff00, 0x9205, 0x9306, 0x1198, 0x2011, 0x0276, 0x20a9, 0x0004,
-	0x2b48, 0x2019, 0x000a, 0x080c, 0xabc4, 0x1148, 0x2011, 0x027a,
-	0x20a9, 0x0004, 0x2019, 0x0006, 0x080c, 0xabc4, 0x1100, 0x015e,
-	0x00ee, 0x003e, 0x002e, 0x009e, 0x0005, 0x00e6, 0x2071, 0x0260,
-	0x7034, 0x9086, 0x0014, 0x11a8, 0x7038, 0x9086, 0x0800, 0x1188,
-	0x703c, 0xd0ec, 0x0160, 0x9084, 0x0f00, 0x9086, 0x0100, 0x1138,
-	0x7054, 0xd0a4, 0x1110, 0xd0ac, 0x0110, 0x9006, 0x0010, 0x9085,
-	0x0001, 0x00ee, 0x0005, 0x00e6, 0x0096, 0x00c6, 0x0076, 0x0056,
-	0x0046, 0x0026, 0x0006, 0x0126, 0x2091, 0x8000, 0x2029, 0x19c4,
-	0x252c, 0x2021, 0x19cb, 0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800,
-	0x7250, 0x7070, 0x9202, 0x1a04, 0xab9c, 0x080c, 0xd282, 0x0904,
-	0xab95, 0x6720, 0x9786, 0x0007, 0x0904, 0xab95, 0x2500, 0x9c06,
-	0x0904, 0xab95, 0x2400, 0x9c06, 0x0904, 0xab95, 0x3e08, 0x9186,
-	0x0002, 0x1148, 0x6010, 0x9005, 0x0130, 0x00b6, 0x2058, 0xb800,
-	0x00be, 0xd0bc, 0x1590, 0x00c6, 0x6043, 0xffff, 0x6000, 0x9086,
-	0x0004, 0x1110, 0x080c, 0x1914, 0x9786, 0x000a, 0x0148, 0x080c,
-	0xba41, 0x1130, 0x00ce, 0x080c, 0xa574, 0x080c, 0x9c06, 0x00e8,
-	0x6014, 0x2048, 0x080c, 0xb82c, 0x01a8, 0x9786, 0x0003, 0x1530,
-	0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048,
-	0x080c, 0x0fd4, 0x009e, 0xab7a, 0xa877, 0x0000, 0x080c, 0x6983,
-	0x080c, 0xba1b, 0x080c, 0x9c06, 0x00ce, 0x9ce0, 0x001c, 0x7064,
-	0x9c02, 0x1210, 0x0804, 0xab40, 0x012e, 0x000e, 0x002e, 0x004e,
-	0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee, 0x0005, 0x9786, 0x0006,
-	0x1118, 0x080c, 0xd1fc, 0x0c30, 0x9786, 0x000a, 0x0998, 0x0880,
-	0x220c, 0x2304, 0x9106, 0x1130, 0x8210, 0x8318, 0x1f04, 0xabb0,
-	0x9006, 0x0005, 0x2304, 0x9102, 0x0218, 0x2001, 0x0001, 0x0008,
-	0x9006, 0x918d, 0x0001, 0x0005, 0x0136, 0x01c6, 0x0016, 0x8906,
-	0x8006, 0x8007, 0x908c, 0x003f, 0x21e0, 0x9084, 0xffc0, 0x9300,
-	0x2098, 0x3518, 0x20a9, 0x0001, 0x220c, 0x4002, 0x910e, 0x1140,
-	0x8210, 0x8319, 0x1dc8, 0x9006, 0x001e, 0x01ce, 0x013e, 0x0005,
-	0x220c, 0x9102, 0x0218, 0x2001, 0x0001, 0x0010, 0x2001, 0x0000,
-	0x918d, 0x0001, 0x001e, 0x01ce, 0x013e, 0x0005, 0x6004, 0x908a,
-	0x0053, 0x1a0c, 0x0d65, 0x080c, 0xba30, 0x0120, 0x080c, 0xba41,
-	0x0158, 0x0028, 0x080c, 0x3034, 0x080c, 0xba41, 0x0128, 0x080c,
-	0x884c, 0x080c, 0x9bcc, 0x0005, 0x080c, 0xa574, 0x0cc0, 0x9182,
-	0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xac26,
-	0xac26, 0xac26, 0xac26, 0xac26, 0xac26, 0xac26, 0xac26, 0xac26,
-	0xac26, 0xac26, 0xac28, 0xac28, 0xac28, 0xac28, 0xac26, 0xac26,
-	0xac26, 0xac28, 0xac26, 0xac26, 0xac26, 0xac26, 0x080c, 0x0d65,
-	0x600b, 0xffff, 0x6003, 0x000f, 0x6106, 0x0126, 0x2091, 0x8000,
-	0x080c, 0xbf5e, 0x2009, 0x8000, 0x080c, 0x84a9, 0x012e, 0x0005,
-	0x9186, 0x0013, 0x1128, 0x6004, 0x9082, 0x0040, 0x0804, 0xacad,
-	0x9186, 0x0027, 0x1520, 0x080c, 0x884c, 0x080c, 0x3003, 0x080c,
-	0xbf5b, 0x0096, 0x6114, 0x2148, 0x080c, 0xb82c, 0x0198, 0x080c,
-	0xba41, 0x1118, 0x080c, 0xa574, 0x0068, 0xa867, 0x0103, 0xa87b,
-	0x0029, 0xa877, 0x0000, 0xa97c, 0xc1c5, 0xa97e, 0x080c, 0x698f,
-	0x080c, 0xba1b, 0x009e, 0x080c, 0x9bcc, 0x0804, 0x890e, 0x9186,
-	0x0014, 0x1120, 0x6004, 0x9082, 0x0040, 0x0018, 0x080c, 0x0d65,
-	0x0005, 0x0002, 0xac8b, 0xac89, 0xac89, 0xac89, 0xac89, 0xac89,
-	0xac89, 0xac89, 0xac89, 0xac89, 0xac89, 0xaca4, 0xaca4, 0xaca4,
-	0xaca4, 0xac89, 0xaca4, 0xac89, 0xaca4, 0xac89, 0xac89, 0xac89,
-	0xac89, 0x080c, 0x0d65, 0x080c, 0x884c, 0x0096, 0x6114, 0x2148,
-	0x080c, 0xb82c, 0x0168, 0xa867, 0x0103, 0xa87b, 0x0006, 0xa877,
-	0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c, 0x698f, 0x080c, 0xba1b,
-	0x009e, 0x080c, 0x9bcc, 0x0005, 0x080c, 0x884c, 0x080c, 0xba41,
-	0x090c, 0xa574, 0x080c, 0x9bcc, 0x0005, 0x0002, 0xacc7, 0xacc5,
-	0xacc5, 0xacc5, 0xacc5, 0xacc5, 0xacc5, 0xacc5, 0xacc5, 0xacc5,
-	0xacc5, 0xacc9, 0xacc9, 0xacc9, 0xacc9, 0xacc5, 0xaccb, 0xacc5,
-	0xacc9, 0xacc5, 0xacc5, 0xacc5, 0xacc5, 0x080c, 0x0d65, 0x080c,
-	0x0d65, 0x080c, 0x0d65, 0x080c, 0x9bcc, 0x0804, 0x890e, 0x9182,
-	0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xacee,
-	0xacee, 0xacee, 0xacee, 0xacee, 0xad27, 0xae16, 0xacee, 0xae22,
-	0xacee, 0xacee, 0xacee, 0xacee, 0xacee, 0xacee, 0xacee, 0xacee,
-	0xacee, 0xacee, 0xae22, 0xacf0, 0xacee, 0xae20, 0x080c, 0x0d65,
-	0x00b6, 0x0096, 0x6114, 0x2148, 0x6010, 0x2058, 0xb800, 0xd0bc,
-	0x1508, 0xa87b, 0x0000, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87c,
-	0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xaea7, 0x080c,
-	0x67a5, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e,
-	0xb8c0, 0x9005, 0x0110, 0x080c, 0x6394, 0x080c, 0x9bcc, 0x009e,
-	0x00be, 0x0005, 0xa87c, 0xd0ac, 0x09e0, 0xa838, 0xa934, 0x9105,
-	0x09c0, 0xa880, 0xd0bc, 0x19a8, 0x080c, 0xbb71, 0x0c80, 0x00b6,
-	0x0096, 0x6114, 0x2148, 0x601c, 0xd0fc, 0x1110, 0x7644, 0x0008,
-	0x9036, 0x96b4, 0x0fff, 0x86ff, 0x1590, 0x6010, 0x2058, 0xb800,
-	0xd0bc, 0x1904, 0xae05, 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76,
-	0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xaea7,
-	0x080c, 0x67a5, 0x6210, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211,
-	0xba3e, 0xb8c0, 0x9005, 0x0110, 0x080c, 0x6394, 0x601c, 0xd0fc,
-	0x1148, 0x7044, 0xd0e4, 0x1904, 0xade9, 0x080c, 0x9bcc, 0x009e,
-	0x00be, 0x0005, 0x2009, 0x0211, 0x210c, 0x080c, 0x0d65, 0x968c,
-	0x0c00, 0x0150, 0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xaded,
-	0x7348, 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186, 0x0002,
-	0x0508, 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00e8, 0xd6dc,
-	0x01a0, 0xa87b, 0x0015, 0xa87c, 0xd0ac, 0x0170, 0xa938, 0xaa34,
-	0x2100, 0x9205, 0x0148, 0x7048, 0x9106, 0x1118, 0x704c, 0x9206,
-	0x0118, 0xa992, 0xaa8e, 0xc6dc, 0x0038, 0xd6d4, 0x0118, 0xa87b,
-	0x0007, 0x0010, 0xa87b, 0x0000, 0xa867, 0x0103, 0xae76, 0x901e,
-	0xd6c4, 0x01d8, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118,
-	0xc6c4, 0x0804, 0xad33, 0x735c, 0xab86, 0x83ff, 0x0170, 0x938a,
-	0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019, 0x0018,
-	0x2011, 0x0025, 0x080c, 0xb3ff, 0x003e, 0xd6cc, 0x0904, 0xad48,
-	0x7154, 0xa98a, 0x81ff, 0x0904, 0xad48, 0x9192, 0x0021, 0x1278,
-	0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xb3ff, 0x2011,
-	0x0205, 0x2013, 0x0000, 0x080c, 0xbeeb, 0x0804, 0xad48, 0xa868,
-	0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a, 0x0c50, 0x00a6, 0x2950,
-	0x080c, 0xb39e, 0x00ae, 0x080c, 0xbeeb, 0x080c, 0xb3ef, 0x0804,
-	0xad4a, 0x080c, 0xbb34, 0x0804, 0xad5f, 0xa87c, 0xd0ac, 0x0904,
-	0xad70, 0xa880, 0xd0bc, 0x1904, 0xad70, 0x7348, 0xa838, 0x9306,
-	0x11c8, 0x734c, 0xa834, 0x931e, 0x0904, 0xad70, 0xd6d4, 0x0190,
-	0xab38, 0x9305, 0x0904, 0xad70, 0x0068, 0xa87c, 0xd0ac, 0x0904,
-	0xad3b, 0xa838, 0xa934, 0x9105, 0x0904, 0xad3b, 0xa880, 0xd0bc,
-	0x1904, 0xad3b, 0x080c, 0xbb71, 0x0804, 0xad5f, 0x00f6, 0x2079,
-	0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08, 0x00fe, 0x0021, 0x0005,
-	0x0011, 0x0005, 0x0005, 0x0096, 0x6003, 0x0002, 0x6007, 0x0043,
-	0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0128, 0x009e, 0x0005, 0x2130,
-	0x2228, 0x0058, 0x2400, 0xa9ac, 0x910a, 0x2300, 0xaab0, 0x9213,
-	0x2600, 0x9102, 0x2500, 0x9203, 0x0e90, 0xac46, 0xab4a, 0xae36,
-	0xad3a, 0x6044, 0xd0fc, 0x190c, 0x98d6, 0x604b, 0x0000, 0x080c,
-	0x1ad2, 0x1118, 0x6144, 0x080c, 0x84d5, 0x009e, 0x0005, 0x9182,
-	0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xae6e,
-	0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae6e,
-	0xae6e, 0xae70, 0xae6e, 0xae6e, 0xae6e, 0xae6e, 0xae81, 0xae6e,
-	0xae6e, 0xae6e, 0xae6e, 0xaea5, 0xae6e, 0xae6e, 0x080c, 0x0d65,
-	0x6004, 0x9086, 0x0040, 0x1110, 0x080c, 0x884c, 0x2019, 0x0001,
-	0x080c, 0x926b, 0x6003, 0x0002, 0x080c, 0xbf63, 0x080c, 0x88a9,
-	0x0005, 0x6004, 0x9086, 0x0040, 0x1110, 0x080c, 0x884c, 0x2019,
-	0x0001, 0x080c, 0x926b, 0x080c, 0x88a9, 0x080c, 0x3003, 0x080c,
-	0xbf5b, 0x0096, 0x6114, 0x2148, 0x080c, 0xb82c, 0x0150, 0xa867,
-	0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0x080c, 0x698f, 0x080c,
-	0xba1b, 0x009e, 0x080c, 0x9bcc, 0x0005, 0x080c, 0x0d65, 0xa87b,
-	0x0015, 0xd1fc, 0x0180, 0xa87b, 0x0007, 0x8002, 0x8000, 0x810a,
-	0x9189, 0x0000, 0x0006, 0x0016, 0x2009, 0x1a48, 0x2104, 0x8000,
-	0x200a, 0x001e, 0x000e, 0xa992, 0xa88e, 0x0005, 0x9182, 0x0057,
-	0x1220, 0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xaedd, 0xaedd,
-	0xaedd, 0xaedd, 0xaedd, 0xaedf, 0xaedd, 0xaedd, 0xaf9c, 0xaedd,
-	0xaedd, 0xaedd, 0xaedd, 0xaedd, 0xaedd, 0xaedd, 0xaedd, 0xaedd,
-	0xaedd, 0xb0e0, 0xaedd, 0xb0ea, 0xaedd, 0x080c, 0x0d65, 0x601c,
-	0xd0bc, 0x0178, 0xd084, 0x0168, 0xd0f4, 0x0120, 0xc084, 0x601e,
-	0x0804, 0xaccf, 0x6114, 0x0096, 0x2148, 0xa87c, 0xc0e5, 0xa87e,
-	0x009e, 0x0076, 0x00a6, 0x00e6, 0x0096, 0x2071, 0x0260, 0x6114,
-	0x2150, 0x601c, 0xd0fc, 0x1110, 0x7644, 0x0008, 0x9036, 0xb676,
-	0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e, 0x6210, 0x00b6, 0x2258,
-	0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0x00be, 0x86ff, 0x0904,
-	0xaf95, 0x9694, 0xff00, 0x9284, 0x0c00, 0x0120, 0x7048, 0xb092,
-	0x704c, 0xb08e, 0x9284, 0x0300, 0x0904, 0xaf95, 0x9686, 0x0100,
-	0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4, 0xb676, 0x0c38, 0x080c,
-	0x1022, 0x090c, 0x0d65, 0x2900, 0xb07a, 0xb77c, 0x97bd, 0x0200,
-	0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a, 0xb06c, 0xa86e, 0xb070,
-	0xa872, 0x7044, 0x9084, 0xf000, 0x9635, 0xae76, 0x968c, 0x0c00,
-	0x0120, 0x7348, 0xab92, 0x734c, 0xab8e, 0x968c, 0x00ff, 0x9186,
-	0x0002, 0x0180, 0x9186, 0x0028, 0x1118, 0xa87b, 0x001c, 0x0060,
-	0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038, 0xd6d4, 0x0118, 0xa87b,
-	0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e, 0xb080, 0xa882, 0xb084,
-	0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c, 0xab86, 0x83ff, 0x0170,
-	0x938a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036, 0x2308, 0x2019,
-	0x0018, 0x2011, 0x0025, 0x080c, 0xb3ff, 0x003e, 0xd6cc, 0x01e8,
-	0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192, 0x0021, 0x1260, 0x8304,
-	0x9098, 0x0018, 0x2011, 0x0029, 0x080c, 0xb3ff, 0x2011, 0x0205,
-	0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc, 0x0120, 0x2009, 0x0020,
-	0xa98a, 0x0c68, 0x2950, 0x080c, 0xb39e, 0x080c, 0x18f2, 0x009e,
-	0x00ee, 0x00ae, 0x007e, 0x0005, 0x2001, 0x1959, 0x2004, 0x604a,
-	0x0096, 0x6114, 0x2148, 0xa83c, 0xa940, 0x9105, 0x1118, 0xa87c,
-	0xc0dc, 0xa87e, 0x6003, 0x0002, 0x080c, 0xbf6c, 0x0904, 0xb0db,
-	0x604b, 0x0000, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-	0x1500, 0xd1cc, 0x0904, 0xb09a, 0xa978, 0xa868, 0xd0fc, 0x0904,
-	0xb05b, 0x0016, 0xa87c, 0x0006, 0xa880, 0x0006, 0x00a6, 0x2150,
-	0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x0904, 0xb029, 0x9086,
-	0x0028, 0x1904, 0xb015, 0xa87b, 0x001c, 0xb07b, 0x001c, 0x0804,
-	0xb031, 0x6024, 0xd0f4, 0x11d0, 0xa838, 0xaa34, 0x9205, 0x09c8,
-	0xa838, 0xaa90, 0x9206, 0x1120, 0xa88c, 0xaa34, 0x9206, 0x0988,
-	0x6024, 0xd0d4, 0x1148, 0xa9ac, 0xa834, 0x9102, 0x603a, 0xa9b0,
-	0xa838, 0x9103, 0x603e, 0x6024, 0xc0f5, 0x6026, 0x6010, 0x00b6,
-	0x2058, 0xb83c, 0x8000, 0xb83e, 0x00be, 0x601c, 0xc0fc, 0x601e,
-	0x9006, 0xa876, 0xa892, 0xa88e, 0xa87c, 0xc0e4, 0xa87e, 0xd0cc,
-	0x0140, 0xc0cc, 0xa87e, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fd4,
-	0x009e, 0x080c, 0xbb71, 0x0804, 0xb0db, 0xd1dc, 0x0158, 0xa87b,
-	0x0015, 0xb07b, 0x0015, 0x080c, 0xbe0e, 0x0118, 0xb174, 0xc1dc,
-	0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007,
-	0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c,
-	0xaea7, 0xa87c, 0xb07e, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa860,
-	0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0, 0x20a9, 0x0020, 0x8a06,
-	0x8006, 0x8007, 0x9094, 0x003f, 0x22e0, 0x9084, 0xffc0, 0x9080,
-	0x0019, 0x2098, 0x4003, 0x00ae, 0x000e, 0xa882, 0x000e, 0xa87e,
-	0x080c, 0xbeeb, 0x001e, 0xa874, 0x0006, 0x2148, 0x080c, 0x0fd4,
-	0x001e, 0x0804, 0xb0c7, 0x0016, 0x00a6, 0x2150, 0xb174, 0x9184,
-	0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086, 0x0028, 0x1128, 0xa87b,
-	0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc, 0x0158, 0xa87b, 0x0015,
-	0xb07b, 0x0015, 0x080c, 0xbe0e, 0x0118, 0xb174, 0xc1dc, 0xb176,
-	0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007, 0xb07b, 0x0007, 0x0040,
-	0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115, 0x190c, 0xaea7,
-	0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c, 0xb07e, 0x00ae, 0x080c,
-	0x0fd4, 0x009e, 0x080c, 0xbeeb, 0xa974, 0x0016, 0x080c, 0xb3ef,
-	0x001e, 0x0468, 0xa867, 0x0103, 0xa974, 0x9184, 0x00ff, 0x90b6,
-	0x0002, 0x01b0, 0x9086, 0x0028, 0x1118, 0xa87b, 0x001c, 0x00d0,
-	0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c, 0xbe0e, 0x0118, 0xa974,
-	0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118, 0xa87b, 0x0007, 0x0050,
-	0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115,
-	0x190c, 0xaea7, 0xa974, 0x0016, 0x080c, 0x67a5, 0x001e, 0x6010,
-	0x00b6, 0x2058, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e, 0xb8c0,
-	0x9005, 0x0120, 0x0016, 0x080c, 0x6394, 0x001e, 0x00be, 0xd1e4,
-	0x1120, 0x080c, 0x9bcc, 0x009e, 0x0005, 0x080c, 0xbb34, 0x0cd8,
-	0x6114, 0x0096, 0x2148, 0xa97c, 0x080c, 0xbf6c, 0x190c, 0x1900,
-	0x009e, 0x0005, 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940, 0x9105,
-	0x01e8, 0xa877, 0x0000, 0xa87b, 0x0000, 0xa867, 0x0103, 0x00b6,
-	0x6010, 0x2058, 0xa834, 0xa938, 0x9115, 0x11a0, 0x080c, 0x67a5,
-	0xba3c, 0x8211, 0x0208, 0xba3e, 0xb8c0, 0x9005, 0x0110, 0x080c,
-	0x6394, 0x080c, 0x9bcc, 0x00be, 0x009e, 0x0005, 0xa87c, 0xc0dc,
-	0xa87e, 0x08f8, 0xb800, 0xd0bc, 0x1120, 0xa834, 0x080c, 0xaea7,
-	0x0c28, 0xa880, 0xd0bc, 0x1dc8, 0x080c, 0xbb71, 0x0c60, 0x080c,
-	0x884c, 0x0010, 0x080c, 0x88a9, 0x601c, 0xd084, 0x0110, 0x080c,
-	0x1914, 0x080c, 0xb82c, 0x01f0, 0x0096, 0x6114, 0x2148, 0x080c,
-	0xba41, 0x1118, 0x080c, 0xa574, 0x00a0, 0xa867, 0x0103, 0x2009,
-	0x180c, 0x210c, 0xd18c, 0x1198, 0xd184, 0x1170, 0x6108, 0xa97a,
-	0x918e, 0x0029, 0x1110, 0x080c, 0xd4f8, 0xa877, 0x0000, 0x080c,
-	0x698f, 0x009e, 0x0804, 0x9c06, 0xa87b, 0x0004, 0x0cb0, 0xa87b,
-	0x0004, 0x0c98, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208,
-	0x000a, 0x0005, 0xb171, 0xb171, 0xb171, 0xb171, 0xb171, 0xb173,
-	0xb171, 0xb171, 0xb171, 0xb171, 0xb171, 0xb171, 0xb171, 0xb171,
-	0xb171, 0xb171, 0xb171, 0xb171, 0xb171, 0xb171, 0xb197, 0xb171,
-	0xb171, 0x080c, 0x0d65, 0x080c, 0x538e, 0x01f8, 0x6014, 0x7144,
-	0x918c, 0x0fff, 0x9016, 0xd1c4, 0x0118, 0x7264, 0x9294, 0x00ff,
-	0x0096, 0x904d, 0x0188, 0xa87b, 0x0000, 0xa864, 0x9086, 0x0139,
-	0x0128, 0xa867, 0x0103, 0xa976, 0xaa96, 0x0030, 0xa897, 0x4000,
-	0xa99a, 0xaa9e, 0x080c, 0x698f, 0x009e, 0x0804, 0x9bcc, 0x080c,
-	0x538e, 0x0dd8, 0x6014, 0x900e, 0x9016, 0x0c10, 0x9182, 0x0085,
-	0x0002, 0xb1b0, 0xb1ae, 0xb1ae, 0xb1bc, 0xb1ae, 0xb1ae, 0xb1ae,
-	0xb1ae, 0xb1ae, 0xb1ae, 0xb1ae, 0xb1ae, 0xb1ae, 0x080c, 0x0d65,
-	0x6003, 0x0001, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0x8020,
-	0x080c, 0x84a9, 0x012e, 0x0005, 0x0026, 0x0056, 0x00d6, 0x00e6,
-	0x2071, 0x0260, 0x7224, 0x6216, 0x7220, 0x080c, 0xb81a, 0x01a0,
-	0x2268, 0x6800, 0x9086, 0x0000, 0x0178, 0x6010, 0x6d10, 0x952e,
-	0x1158, 0x00c6, 0x2d60, 0x080c, 0xb42a, 0x00ce, 0x0128, 0x6803,
-	0x0002, 0x6007, 0x0086, 0x0010, 0x6007, 0x0087, 0x6003, 0x0001,
-	0x2009, 0x8020, 0x080c, 0x84a9, 0x9280, 0x0004, 0x00b6, 0x2058,
-	0xb800, 0x00be, 0xd0bc, 0x0140, 0x6824, 0xd0ec, 0x0128, 0x00c6,
-	0x2260, 0x080c, 0xbb71, 0x00ce, 0x00ee, 0x00de, 0x005e, 0x002e,
-	0x0005, 0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c,
-	0x0d65, 0x908a, 0x0092, 0x1a0c, 0x0d65, 0x9082, 0x0085, 0x00e2,
-	0x9186, 0x0027, 0x0120, 0x9186, 0x0014, 0x190c, 0x0d65, 0x080c,
-	0x884c, 0x0096, 0x6014, 0x2048, 0x080c, 0xb82c, 0x0140, 0xa867,
-	0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x698f, 0x009e,
-	0x080c, 0x9c06, 0x0804, 0x890e, 0xb231, 0xb233, 0xb233, 0xb231,
-	0xb231, 0xb231, 0xb231, 0xb231, 0xb231, 0xb231, 0xb231, 0xb231,
-	0xb231, 0x080c, 0x0d65, 0x080c, 0x9c06, 0x0005, 0x9186, 0x0013,
-	0x1130, 0x6004, 0x9082, 0x0085, 0x2008, 0x0804, 0xb282, 0x9186,
-	0x0027, 0x1558, 0x080c, 0x884c, 0x080c, 0x3003, 0x080c, 0xbf5b,
-	0x0096, 0x6014, 0x2048, 0x080c, 0xb82c, 0x0150, 0xa867, 0x0103,
-	0xa877, 0x0000, 0xa87b, 0x0029, 0x080c, 0x698f, 0x080c, 0xba1b,
-	0x009e, 0x080c, 0x9bcc, 0x0005, 0x9186, 0x0089, 0x0118, 0x9186,
-	0x008a, 0x1140, 0x080c, 0x9a9c, 0x0128, 0x9086, 0x000c, 0x0904,
-	0xb2ba, 0x0000, 0x080c, 0x9c87, 0x0c70, 0x9186, 0x0014, 0x1d60,
-	0x080c, 0x884c, 0x0096, 0x6014, 0x2048, 0x080c, 0xb82c, 0x0d00,
-	0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0006, 0xa880, 0xc0ec,
-	0xa882, 0x0890, 0x0002, 0xb292, 0xb290, 0xb290, 0xb290, 0xb290,
-	0xb290, 0xb2a6, 0xb290, 0xb290, 0xb290, 0xb290, 0xb290, 0xb290,
-	0x080c, 0x0d65, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
-	0x0118, 0x9186, 0x0035, 0x1118, 0x2001, 0x1957, 0x0010, 0x2001,
-	0x1958, 0x2004, 0x601a, 0x6003, 0x000c, 0x0005, 0x6034, 0x908c,
-	0xff00, 0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118,
-	0x2001, 0x1957, 0x0010, 0x2001, 0x1958, 0x2004, 0x601a, 0x6003,
-	0x000e, 0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208,
-	0x0012, 0x0804, 0x9c87, 0xb2d0, 0xb2d0, 0xb2d0, 0xb2d0, 0xb2d2,
-	0xb31f, 0xb2d0, 0xb2d0, 0xb2d0, 0xb2d0, 0xb2d0, 0xb2d0, 0xb2d0,
-	0x080c, 0x0d65, 0x0096, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
-	0xd0bc, 0x0168, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
-	0x0118, 0x9186, 0x0035, 0x1118, 0x009e, 0x0804, 0xb333, 0x080c,
-	0xb82c, 0x1118, 0x080c, 0xba1b, 0x0068, 0x6014, 0x2048, 0x080c,
-	0xbf72, 0x1110, 0x080c, 0xba1b, 0xa867, 0x0103, 0x080c, 0xbf26,
-	0x080c, 0x698f, 0x00d6, 0x2c68, 0x080c, 0x9b76, 0x01d0, 0x6003,
-	0x0001, 0x6007, 0x001e, 0x600b, 0xffff, 0x2009, 0x026e, 0x210c,
-	0x613a, 0x2009, 0x026f, 0x210c, 0x613e, 0x6910, 0x6112, 0x080c,
-	0xbcc0, 0x695c, 0x615e, 0x6023, 0x0001, 0x2009, 0x8020, 0x080c,
-	0x84a9, 0x2d60, 0x00de, 0x080c, 0x9bcc, 0x009e, 0x0005, 0x6010,
-	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x05a0, 0x6034, 0x908c,
-	0xff00, 0x810f, 0x9186, 0x0035, 0x0130, 0x9186, 0x001e, 0x0118,
-	0x9186, 0x0039, 0x1538, 0x00d6, 0x2c68, 0x080c, 0xbebe, 0x11f0,
-	0x080c, 0x9b76, 0x01d8, 0x6106, 0x6003, 0x0001, 0x6023, 0x0001,
-	0x6910, 0x6112, 0x692c, 0x612e, 0x6930, 0x6132, 0x6934, 0x918c,
-	0x00ff, 0x6136, 0x6938, 0x613a, 0x693c, 0x613e, 0x695c, 0x615e,
-	0x080c, 0xbcc0, 0x2009, 0x8020, 0x080c, 0x84a9, 0x2d60, 0x00de,
-	0x0804, 0x9bcc, 0x0096, 0x6014, 0x2048, 0x080c, 0xb82c, 0x01c8,
-	0xa867, 0x0103, 0xa880, 0xd0b4, 0x0128, 0xc0ec, 0xa882, 0xa87b,
-	0x0006, 0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b,
-	0x0005, 0x080c, 0xbb30, 0xa877, 0x0000, 0x080c, 0x698f, 0x080c,
-	0xba1b, 0x009e, 0x0804, 0x9bcc, 0x0016, 0x0096, 0x6014, 0x2048,
-	0x080c, 0xb82c, 0x0140, 0xa867, 0x0103, 0xa87b, 0x0028, 0xa877,
-	0x0000, 0x080c, 0x698f, 0x009e, 0x001e, 0x9186, 0x0013, 0x0158,
-	0x9186, 0x0014, 0x0130, 0x9186, 0x0027, 0x0118, 0x080c, 0x9c87,
-	0x0020, 0x080c, 0x884c, 0x080c, 0x9c06, 0x0005, 0x0056, 0x0066,
-	0x0096, 0x00a6, 0x2029, 0x0001, 0x9182, 0x0101, 0x1208, 0x0010,
-	0x2009, 0x0100, 0x2130, 0x8304, 0x9098, 0x0018, 0x2009, 0x0020,
-	0x2011, 0x0029, 0x080c, 0xb3ff, 0x96b2, 0x0020, 0xb004, 0x904d,
-	0x0110, 0x080c, 0x0fd4, 0x080c, 0x1022, 0x0520, 0x8528, 0xa867,
-	0x0110, 0xa86b, 0x0000, 0x2920, 0xb406, 0x968a, 0x003d, 0x1228,
-	0x2608, 0x2011, 0x001b, 0x0499, 0x00a8, 0x96b2, 0x003c, 0x2009,
-	0x003c, 0x2950, 0x2011, 0x001b, 0x0451, 0x0c28, 0x2001, 0x0205,
-	0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x95ac,
-	0x0000, 0x0048, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f,
-	0x95ad, 0x0003, 0xb566, 0x009e, 0x006e, 0x005e, 0x0005, 0x00a6,
-	0x89ff, 0x0158, 0xa804, 0x9055, 0x0130, 0xa807, 0x0000, 0x080c,
-	0x698f, 0x2a48, 0x0cb8, 0x080c, 0x698f, 0x00ae, 0x0005, 0x00f6,
-	0x2079, 0x0200, 0x7814, 0x9085, 0x0080, 0x7816, 0xd184, 0x0108,
-	0x8108, 0x810c, 0x20a9, 0x0001, 0xa860, 0x20e8, 0xa85c, 0x9200,
-	0x20a0, 0x20e1, 0x0000, 0x2300, 0x9e00, 0x2098, 0x4003, 0x8318,
-	0x9386, 0x0020, 0x1148, 0x2018, 0x2300, 0x9e00, 0x2098, 0x7814,
-	0x8000, 0x9085, 0x0080, 0x7816, 0x8109, 0x1d80, 0x7817, 0x0000,
-	0x00fe, 0x0005, 0x0066, 0x0126, 0x2091, 0x8000, 0x2031, 0x0001,
-	0x6020, 0x9084, 0x000f, 0x0083, 0x012e, 0x006e, 0x0005, 0x0126,
-	0x2091, 0x8000, 0x0066, 0x2031, 0x0000, 0x6020, 0x9084, 0x000f,
-	0x001b, 0x006e, 0x012e, 0x0005, 0xb47c, 0xb47c, 0xb477, 0xb4a0,
-	0xb454, 0xb477, 0xb456, 0xb477, 0xb454, 0xb454, 0xb477, 0xb477,
-	0xb477, 0xb454, 0xb454, 0xb454, 0x080c, 0x0d65, 0x6010, 0x9080,
-	0x0000, 0x2004, 0xd0bc, 0x190c, 0xb4a0, 0x0036, 0x6014, 0x0096,
-	0x2048, 0xa880, 0x009e, 0xd0cc, 0x0118, 0x2019, 0x000c, 0x0038,
-	0xd094, 0x0118, 0x2019, 0x000d, 0x0010, 0x2019, 0x0010, 0x080c,
-	0xcdd9, 0x6023, 0x0006, 0x6003, 0x0007, 0x003e, 0x0005, 0x9006,
-	0x0005, 0x9085, 0x0001, 0x0005, 0x0096, 0x86ff, 0x11e8, 0x6014,
-	0x2048, 0x080c, 0xb82c, 0x01d0, 0x6043, 0xffff, 0xa864, 0x9086,
-	0x0139, 0x1128, 0xa87b, 0x0005, 0xa883, 0x0000, 0x0028, 0x900e,
-	0x2001, 0x0005, 0x080c, 0x6bac, 0x080c, 0xbb30, 0x080c, 0x6983,
-	0x080c, 0x9c06, 0x9085, 0x0001, 0x009e, 0x0005, 0x9006, 0x0ce0,
-	0x080c, 0x98ad, 0x080c, 0xbf80, 0x6000, 0x908a, 0x0016, 0x1a0c,
-	0x0d65, 0x002b, 0x0106, 0x080c, 0x98c9, 0x010e, 0x0005, 0xb4bf,
-	0xb4ed, 0xb4c1, 0xb514, 0xb4e8, 0xb4bf, 0xb477, 0xb47c, 0xb47c,
-	0xb477, 0xb477, 0xb477, 0xb477, 0xb477, 0xb477, 0xb477, 0x080c,
-	0x0d65, 0x86ff, 0x1510, 0x6020, 0x9086, 0x0006, 0x01f0, 0x0096,
-	0x6014, 0x2048, 0x080c, 0xb82c, 0x0158, 0xa87c, 0xd0cc, 0x0130,
-	0x0096, 0xa878, 0x2048, 0x080c, 0x0fd4, 0x009e, 0x080c, 0xbb30,
-	0x009e, 0x080c, 0xbf00, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-	0x0002, 0x2009, 0x8020, 0x080c, 0x848b, 0x9085, 0x0001, 0x0005,
-	0x0066, 0x080c, 0x1914, 0x006e, 0x08a0, 0x00e6, 0x2071, 0x19b8,
-	0x7030, 0x9c06, 0x1120, 0x080c, 0x91eb, 0x00ee, 0x0850, 0x6020,
-	0x9084, 0x000f, 0x9086, 0x0006, 0x1150, 0x0086, 0x0096, 0x2049,
-	0x0001, 0x2c40, 0x080c, 0x9367, 0x009e, 0x008e, 0x0040, 0x0066,
-	0x080c, 0x90e7, 0x190c, 0x0d65, 0x080c, 0x90f5, 0x006e, 0x00ee,
-	0x1904, 0xb4c1, 0x0804, 0xb477, 0x0036, 0x00e6, 0x2071, 0x19b8,
-	0x704c, 0x9c06, 0x1138, 0x901e, 0x080c, 0x926b, 0x00ee, 0x003e,
-	0x0804, 0xb4c1, 0x080c, 0x949d, 0x00ee, 0x003e, 0x1904, 0xb4c1,
-	0x0804, 0xb477, 0x00c6, 0x0066, 0x6020, 0x9084, 0x000f, 0x001b,
-	0x006e, 0x00ce, 0x0005, 0xb54a, 0xb60c, 0xb773, 0xb552, 0x9c06,
-	0xb54a, 0xcdcb, 0xbf68, 0xb60c, 0xb543, 0xb7f2, 0xb543, 0xb543,
-	0xb543, 0xb543, 0xb543, 0x080c, 0x0d65, 0x080c, 0xba41, 0x1110,
-	0x080c, 0xa574, 0x0005, 0x080c, 0x884c, 0x0804, 0x9bcc, 0x601b,
-	0x0001, 0x0005, 0x080c, 0xb82c, 0x0130, 0x6014, 0x0096, 0x2048,
-	0x2c00, 0xa896, 0x009e, 0x080c, 0x98ad, 0x080c, 0xbf80, 0x6000,
-	0x908a, 0x0016, 0x1a0c, 0x0d65, 0x0013, 0x0804, 0x98c9, 0xb577,
-	0xb579, 0xb5a3, 0xb5b7, 0xb5e2, 0xb577, 0xb54a, 0xb54a, 0xb54a,
-	0xb5be, 0xb5be, 0xb577, 0xb577, 0xb577, 0xb577, 0xb5c8, 0x080c,
-	0x0d65, 0x00e6, 0x6014, 0x0096, 0x2048, 0xa880, 0xc0b5, 0xa882,
-	0x009e, 0x2071, 0x19b8, 0x7030, 0x9c06, 0x01d0, 0x0066, 0x080c,
-	0x90e7, 0x190c, 0x0d65, 0x080c, 0x90f5, 0x006e, 0x080c, 0xbf00,
-	0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2001, 0x1958,
-	0x2004, 0x601a, 0x2009, 0x8020, 0x080c, 0x848b, 0x00ee, 0x0005,
-	0x601b, 0x0001, 0x0cd8, 0x0096, 0x6014, 0x2048, 0xa880, 0xc0b5,
-	0xa882, 0x009e, 0x080c, 0xbf00, 0x6007, 0x0085, 0x6003, 0x000b,
-	0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x848b, 0x0005, 0x080c,
-	0x98ad, 0x080c, 0x9a1e, 0x080c, 0x98c9, 0x0c28, 0x0096, 0x601b,
-	0x0001, 0x6014, 0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x0005,
-	0x080c, 0x538e, 0x01a8, 0x6014, 0x0096, 0x904d, 0x0180, 0xa864,
-	0xa867, 0x0103, 0xa87b, 0x0006, 0x9086, 0x0139, 0x1140, 0xa867,
-	0x0139, 0xa897, 0x4005, 0xa89b, 0x0004, 0x080c, 0x698f, 0x009e,
-	0x0804, 0x9bcc, 0x6014, 0x0096, 0x904d, 0x0508, 0x080c, 0xbf6c,
-	0x01f0, 0x080c, 0x98c9, 0x2001, 0x180f, 0x2004, 0xd0c4, 0x0110,
-	0x009e, 0x0005, 0xa884, 0x009e, 0x8003, 0x800b, 0x810b, 0x9108,
-	0x611a, 0x2001, 0x0037, 0x2c08, 0x080c, 0x159e, 0x6000, 0x9086,
-	0x0004, 0x1120, 0x2009, 0x0048, 0x080c, 0x9c6a, 0x0005, 0x009e,
-	0x080c, 0x1914, 0x0804, 0xb5a3, 0x6000, 0x908a, 0x0016, 0x1a0c,
-	0x0d65, 0x000b, 0x0005, 0xb623, 0xb54f, 0xb625, 0xb623, 0xb625,
-	0xb625, 0xb54b, 0xb623, 0xb545, 0xb545, 0xb623, 0xb623, 0xb623,
-	0xb623, 0xb623, 0xb623, 0x080c, 0x0d65, 0x6010, 0x00b6, 0x2058,
-	0xb804, 0x9084, 0x00ff, 0x00be, 0x908a, 0x000c, 0x1a0c, 0x0d65,
-	0x00b6, 0x0013, 0x00be, 0x0005, 0xb640, 0xb70d, 0xb642, 0xb682,
-	0xb642, 0xb682, 0xb642, 0xb650, 0xb640, 0xb682, 0xb640, 0xb671,
-	0x080c, 0x0d65, 0x6004, 0x908e, 0x0016, 0x05c0, 0x908e, 0x0004,
-	0x05a8, 0x908e, 0x0002, 0x0590, 0x908e, 0x0052, 0x0904, 0xb709,
-	0x6004, 0x080c, 0xba41, 0x0904, 0xb726, 0x908e, 0x0004, 0x1110,
-	0x080c, 0x3034, 0x908e, 0x0021, 0x0904, 0xb72a, 0x908e, 0x0022,
-	0x0904, 0xb76e, 0x908e, 0x003d, 0x0904, 0xb72a, 0x908e, 0x0039,
-	0x0904, 0xb72e, 0x908e, 0x0035, 0x0904, 0xb72e, 0x908e, 0x001e,
-	0x0178, 0x908e, 0x0001, 0x1140, 0x6010, 0x2058, 0xb804, 0x9084,
-	0x00ff, 0x9086, 0x0006, 0x0110, 0x080c, 0x3003, 0x080c, 0xa574,
-	0x0804, 0x9c06, 0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0904,
-	0xb6fa, 0x9186, 0x0002, 0x1904, 0xb6cf, 0x2001, 0x1836, 0x2004,
-	0xd08c, 0x11c8, 0x080c, 0x70ac, 0x11b0, 0x080c, 0xbf46, 0x0138,
-	0x080c, 0x70cf, 0x1120, 0x080c, 0x6fb7, 0x0804, 0xb757, 0x2001,
-	0x194e, 0x2003, 0x0001, 0x2001, 0x1800, 0x2003, 0x0001, 0x080c,
-	0x6fdd, 0x0804, 0xb757, 0x6010, 0x2058, 0x2001, 0x1836, 0x2004,
-	0xd0ac, 0x1904, 0xb757, 0xb8a0, 0x9084, 0xff80, 0x1904, 0xb757,
-	0xb840, 0x9084, 0x00ff, 0x9005, 0x0190, 0x8001, 0xb842, 0x6017,
-	0x0000, 0x6023, 0x0007, 0x601b, 0x0398, 0x604b, 0x0000, 0x080c,
-	0x9b76, 0x0128, 0x2b00, 0x6012, 0x6023, 0x0001, 0x0458, 0x00de,
-	0x00ce, 0x6004, 0x908e, 0x0002, 0x11a0, 0x6010, 0x2058, 0xb8a0,
-	0x9086, 0x007e, 0x1170, 0x2009, 0x1836, 0x2104, 0xc085, 0x200a,
-	0x00e6, 0x2071, 0x1800, 0x080c, 0x5c68, 0x00ee, 0x080c, 0xa574,
-	0x0030, 0x080c, 0xa574, 0x080c, 0x3003, 0x080c, 0xbf5b, 0x00e6,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x3034, 0x012e, 0x00ee, 0x080c,
-	0x9c06, 0x0005, 0x2001, 0x0002, 0x080c, 0x61ba, 0x6003, 0x0001,
-	0x6007, 0x0002, 0x080c, 0x84b0, 0x080c, 0x890e, 0x00de, 0x00ce,
-	0x0c80, 0x080c, 0x3034, 0x0804, 0xb67e, 0x00c6, 0x00d6, 0x6104,
-	0x9186, 0x0016, 0x0d38, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff,
-	0x9005, 0x0904, 0xb6cf, 0x8001, 0xb842, 0x6003, 0x0001, 0x080c,
-	0x84b0, 0x080c, 0x890e, 0x00de, 0x00ce, 0x0898, 0x080c, 0xa574,
-	0x0804, 0xb680, 0x080c, 0xa5b0, 0x0804, 0xb680, 0x00d6, 0x2c68,
-	0x6104, 0x080c, 0xbebe, 0x00de, 0x0118, 0x080c, 0x9bcc, 0x00f0,
-	0x6004, 0x8007, 0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007,
-	0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x603c, 0x600a, 0x2001,
-	0x1958, 0x2004, 0x601a, 0x602c, 0x2c08, 0x2060, 0x6024, 0xc0b5,
-	0x6026, 0x2160, 0x2009, 0x8020, 0x080c, 0x84a9, 0x0005, 0x00de,
-	0x00ce, 0x080c, 0xa574, 0x080c, 0x3003, 0x00e6, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x3034, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b,
-	0x0398, 0x604b, 0x0000, 0x012e, 0x00ee, 0x0005, 0x080c, 0xa007,
-	0x1904, 0xb726, 0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d65,
-	0x0096, 0x00d6, 0x001b, 0x00de, 0x009e, 0x0005, 0xb78e, 0xb78e,
-	0xb78e, 0xb78e, 0xb78e, 0xb78e, 0xb78e, 0xb78e, 0xb78e, 0xb54a,
-	0xb78e, 0xb54f, 0xb790, 0xb54f, 0xb79d, 0xb78e, 0x080c, 0x0d65,
-	0x6004, 0x9086, 0x008b, 0x0148, 0x6007, 0x008b, 0x6003, 0x000d,
-	0x2009, 0x8020, 0x080c, 0x84a9, 0x0005, 0x080c, 0xbf3a, 0x0118,
-	0x080c, 0xbf4d, 0x0010, 0x080c, 0xbf5b, 0x080c, 0xba1b, 0x080c,
-	0xb82c, 0x0570, 0x080c, 0x3003, 0x080c, 0xb82c, 0x0168, 0x6014,
-	0x2048, 0xa867, 0x0103, 0xa87b, 0x0006, 0xa877, 0x0000, 0xa880,
-	0xc0ed, 0xa882, 0x080c, 0x698f, 0x2c68, 0x080c, 0x9b76, 0x0150,
-	0x6810, 0x6012, 0x080c, 0xbcc0, 0x00c6, 0x2d60, 0x080c, 0x9c06,
-	0x00ce, 0x0008, 0x2d60, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007,
-	0x0001, 0x6003, 0x0001, 0x080c, 0x84b0, 0x080c, 0x890e, 0x00c8,
-	0x080c, 0xbf3a, 0x0138, 0x6034, 0x9086, 0x4000, 0x1118, 0x080c,
-	0x3003, 0x08d0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039,
-	0x0118, 0x9186, 0x0035, 0x1118, 0x080c, 0x3003, 0x0868, 0x080c,
-	0x9c06, 0x0005, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d65, 0x0002,
-	0xb808, 0xb808, 0xb80a, 0xb80a, 0xb80a, 0xb808, 0xb808, 0x9c06,
-	0xb808, 0xb808, 0xb808, 0xb808, 0xb808, 0xb808, 0xb808, 0xb808,
-	0x080c, 0x0d65, 0x080c, 0x98ad, 0x080c, 0x9a1e, 0x080c, 0x98c9,
-	0x6114, 0x0096, 0x2148, 0xa87b, 0x0006, 0x080c, 0x698f, 0x009e,
-	0x0804, 0x9bcc, 0x9284, 0x0003, 0x1158, 0x9282, 0x1ddc, 0x0240,
-	0x2001, 0x1819, 0x2004, 0x9202, 0x1218, 0x9085, 0x0001, 0x0005,
-	0x9006, 0x0ce8, 0x0096, 0x0028, 0x0096, 0x0006, 0x6014, 0x2048,
-	0x000e, 0x0006, 0x9984, 0xf000, 0x9086, 0xf000, 0x0110, 0x080c,
-	0x10cd, 0x000e, 0x009e, 0x0005, 0x00e6, 0x00c6, 0x0036, 0x0006,
-	0x0126, 0x2091, 0x8000, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7350,
-	0x7070, 0x9302, 0x1640, 0x6020, 0x9206, 0x11f8, 0x080c, 0xbf46,
-	0x0180, 0x9286, 0x0001, 0x1168, 0x6004, 0x9086, 0x0004, 0x1148,
-	0x080c, 0x3003, 0x080c, 0xbf5b, 0x00c6, 0x080c, 0x9c06, 0x00ce,
-	0x0060, 0x080c, 0xbc32, 0x0148, 0x080c, 0xba41, 0x1110, 0x080c,
-	0xa574, 0x00c6, 0x080c, 0x9bcc, 0x00ce, 0x9ce0, 0x001c, 0x7064,
-	0x9c02, 0x1208, 0x08a0, 0x012e, 0x000e, 0x003e, 0x00ce, 0x00ee,
-	0x0005, 0x00e6, 0x00c6, 0x0016, 0x9188, 0x1000, 0x210c, 0x81ff,
-	0x0128, 0x2061, 0x1b02, 0x6112, 0x080c, 0x3003, 0x9006, 0x0010,
-	0x9085, 0x0001, 0x001e, 0x00ce, 0x00ee, 0x0005, 0x00c6, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x9b76, 0x01b0, 0x665e, 0x2b00, 0x6012,
-	0x080c, 0x538e, 0x0118, 0x080c, 0xb95d, 0x0168, 0x080c, 0xbcc0,
-	0x6023, 0x0003, 0x2009, 0x004b, 0x080c, 0x9c6a, 0x9085, 0x0001,
-	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091,
-	0x8000, 0xbaa0, 0x080c, 0x9c3d, 0x0580, 0x605f, 0x0000, 0x2b00,
-	0x6012, 0x080c, 0xbcc0, 0x6023, 0x0003, 0x0016, 0x080c, 0x98ad,
-	0x080c, 0x8613, 0x0076, 0x903e, 0x080c, 0x8502, 0x2c08, 0x080c,
-	0xcfa6, 0x007e, 0x080c, 0x98c9, 0x001e, 0xd184, 0x0128, 0x080c,
-	0x9bcc, 0x9085, 0x0001, 0x0070, 0x080c, 0x538e, 0x0128, 0xd18c,
-	0x1170, 0x080c, 0xb95d, 0x0148, 0x2009, 0x004c, 0x080c, 0x9c6a,
-	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2900,
-	0x6016, 0x0c90, 0x2009, 0x004d, 0x0010, 0x2009, 0x004e, 0x00f6,
-	0x00c6, 0x0046, 0x0016, 0x080c, 0x9b76, 0x2c78, 0x0590, 0x7e5e,
-	0x2b00, 0x7812, 0x7823, 0x0003, 0x2021, 0x0005, 0x080c, 0xb96f,
-	0x9186, 0x004d, 0x0118, 0x9186, 0x004e, 0x0148, 0x2001, 0x1951,
-	0x200c, 0xd1fc, 0x0168, 0x2f60, 0x080c, 0x9bcc, 0x00d0, 0x2001,
-	0x1950, 0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c, 0x9bcc, 0x0088,
-	0x2f60, 0x080c, 0x538e, 0x0138, 0xd18c, 0x1118, 0x04f1, 0x0148,
-	0x0010, 0x2900, 0x7816, 0x001e, 0x0016, 0x080c, 0x9c6a, 0x9085,
-	0x0001, 0x001e, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x00f6, 0x00c6,
-	0x0046, 0x080c, 0x9b76, 0x2c78, 0x0508, 0x7e5e, 0x2b00, 0x7812,
-	0x7823, 0x0003, 0x0096, 0x2021, 0x0004, 0x0489, 0x009e, 0x2001,
-	0x194f, 0x200c, 0xd1fc, 0x0120, 0x2f60, 0x080c, 0x9bcc, 0x0060,
-	0x2f60, 0x080c, 0x538e, 0x0120, 0xd18c, 0x1160, 0x0071, 0x0130,
-	0x2009, 0x0052, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x004e, 0x00ce,
-	0x00fe, 0x0005, 0x2900, 0x7816, 0x0c98, 0x00c6, 0x080c, 0x4871,
-	0x00ce, 0x1120, 0x080c, 0x9bcc, 0x9006, 0x0005, 0xa867, 0x0000,
-	0xa86b, 0x8000, 0x2900, 0x6016, 0x9085, 0x0001, 0x0005, 0x0096,
-	0x0076, 0x0126, 0x2091, 0x8000, 0x080c, 0x98ad, 0x080c, 0x6448,
-	0x0158, 0x2001, 0xb976, 0x0006, 0x900e, 0x2400, 0x080c, 0x6bac,
-	0x080c, 0x698f, 0x000e, 0x0807, 0x2418, 0x080c, 0x8812, 0xbaa0,
-	0x0086, 0x2041, 0x0001, 0x2039, 0x0001, 0x2608, 0x080c, 0x862d,
-	0x008e, 0x080c, 0x8502, 0x2f08, 0x2648, 0x080c, 0xcfa6, 0xb93c,
-	0x81ff, 0x090c, 0x8704, 0x080c, 0x98c9, 0x012e, 0x007e, 0x009e,
-	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9b76, 0x0190,
-	0x660a, 0x2b08, 0x6112, 0x080c, 0xbcc0, 0x6023, 0x0001, 0x2900,
-	0x6016, 0x2009, 0x001f, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x012e,
+	0xb9a0, 0x0016, 0x080c, 0x303b, 0x080c, 0x9be7, 0x001e, 0x080c,
+	0x311a, 0x00de, 0x0804, 0xa8e6, 0x00de, 0x080c, 0x53a1, 0x1170,
+	0x6014, 0x9005, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0,
+	0x2021, 0x0006, 0x080c, 0x4a75, 0x004e, 0x003e, 0x00d6, 0x6010,
+	0x2058, 0x080c, 0x630b, 0x080c, 0xa6a6, 0x00de, 0x080c, 0xab28,
+	0x1588, 0x6010, 0x2058, 0xb890, 0x9005, 0x0560, 0x2001, 0x0006,
+	0x080c, 0x61c1, 0x0096, 0x6014, 0x904d, 0x01d0, 0xa864, 0x9084,
+	0x00ff, 0x9086, 0x0039, 0x1140, 0x2001, 0x0000, 0x900e, 0x2011,
+	0x4000, 0x080c, 0xbe40, 0x0060, 0xa864, 0x9084, 0x00ff, 0x9086,
+	0x0029, 0x0130, 0xa807, 0x0000, 0xa867, 0x0103, 0xa833, 0x0200,
+	0x009e, 0x080c, 0x303b, 0x6020, 0x9086, 0x000a, 0x0138, 0x080c,
+	0x9be7, 0x0020, 0x080c, 0xa58f, 0x080c, 0xa830, 0x001e, 0x002e,
+	0x00ee, 0x00be, 0x0005, 0x2011, 0x1823, 0x2204, 0x9086, 0x0014,
+	0x1160, 0x2001, 0x0002, 0x080c, 0x61c1, 0x6003, 0x0001, 0x6007,
+	0x0001, 0x080c, 0x84d8, 0x0804, 0x8936, 0x0804, 0xa830, 0x2030,
+	0x2011, 0x1823, 0x2204, 0x9086, 0x0004, 0x1148, 0x96b6, 0x000b,
+	0x1120, 0x2001, 0x0007, 0x080c, 0x61c1, 0x0804, 0x9be7, 0x0804,
+	0xa830, 0x0002, 0xa670, 0xa929, 0xa670, 0xa968, 0xa670, 0xaa13,
+	0xa91e, 0xa670, 0xa670, 0xaa26, 0xa670, 0xaa36, 0x6604, 0x9686,
+	0x0003, 0x0904, 0xa845, 0x96b6, 0x001e, 0x1110, 0x080c, 0x9be7,
+	0x0005, 0x00b6, 0x00d6, 0x00c6, 0x080c, 0xaa46, 0x11a0, 0x9006,
+	0x080c, 0x61ad, 0x080c, 0x3006, 0x080c, 0xbf76, 0x2001, 0x0002,
+	0x080c, 0x61c1, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x84d8,
+	0x080c, 0x8936, 0x0408, 0x2009, 0x026e, 0x2104, 0x9086, 0x0009,
+	0x1160, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0170,
+	0x8001, 0xb842, 0x601b, 0x000a, 0x0078, 0x2009, 0x026f, 0x2104,
+	0x9084, 0xff00, 0x9086, 0x1900, 0x1108, 0x08a0, 0x080c, 0x3006,
+	0x080c, 0xbf76, 0x080c, 0xa830, 0x00ce, 0x00de, 0x00be, 0x0005,
+	0x0096, 0x00b6, 0x0026, 0x9016, 0x080c, 0xaa54, 0x00d6, 0x2069,
+	0x194d, 0x2d04, 0x9005, 0x0168, 0x6010, 0x2058, 0xb8a0, 0x9086,
+	0x007e, 0x1138, 0x2069, 0x181f, 0x2d04, 0x8000, 0x206a, 0x00de,
+	0x0010, 0x00de, 0x0088, 0x9006, 0x080c, 0x61ad, 0x2001, 0x0002,
+	0x080c, 0x61c1, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x84d8,
+	0x080c, 0x8936, 0x0804, 0xa9e3, 0x080c, 0xb847, 0x01b0, 0x6014,
+	0x2048, 0xa864, 0x2010, 0x9086, 0x0139, 0x1138, 0x6007, 0x0016,
+	0x2001, 0x0002, 0x080c, 0xbe9a, 0x00b0, 0x6014, 0x2048, 0xa864,
+	0xd0fc, 0x0118, 0x2001, 0x0001, 0x0ca8, 0x2001, 0x180e, 0x2004,
+	0xd0dc, 0x0148, 0x6010, 0x2058, 0xb840, 0x9084, 0x00ff, 0x9005,
+	0x1110, 0x9006, 0x0c38, 0x080c, 0xa58f, 0x2009, 0x026e, 0x2134,
+	0x96b4, 0x00ff, 0x9686, 0x0005, 0x0510, 0x9686, 0x000b, 0x01c8,
+	0x2009, 0x026f, 0x2104, 0x9084, 0xff00, 0x1118, 0x9686, 0x0009,
+	0x01b0, 0x9086, 0x1900, 0x1168, 0x9686, 0x0009, 0x0180, 0x2001,
+	0x0004, 0x080c, 0x61c1, 0x2001, 0x0028, 0x601a, 0x6007, 0x0052,
+	0x0010, 0x080c, 0xa830, 0x002e, 0x00be, 0x009e, 0x0005, 0x9286,
+	0x0139, 0x0160, 0x6014, 0x2048, 0x080c, 0xb847, 0x0140, 0xa864,
+	0x9086, 0x0139, 0x0118, 0xa868, 0xd0fc, 0x0108, 0x0c50, 0x6010,
+	0x2058, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0138, 0x8001, 0xb842,
+	0x601b, 0x000a, 0x6007, 0x0016, 0x08f0, 0xb8a0, 0x9086, 0x007e,
+	0x1138, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5c6f, 0x00ee, 0x0010,
+	0x080c, 0x3006, 0x0870, 0x080c, 0xaa54, 0x1160, 0x2001, 0x0004,
+	0x080c, 0x61c1, 0x6003, 0x0001, 0x6007, 0x0003, 0x080c, 0x84d8,
+	0x0804, 0x8936, 0x080c, 0xa58f, 0x0804, 0xa830, 0x0469, 0x1160,
+	0x2001, 0x0008, 0x080c, 0x61c1, 0x6003, 0x0001, 0x6007, 0x0005,
+	0x080c, 0x84d8, 0x0804, 0x8936, 0x0804, 0xa830, 0x00e9, 0x1160,
+	0x2001, 0x000a, 0x080c, 0x61c1, 0x6003, 0x0001, 0x6007, 0x0001,
+	0x080c, 0x84d8, 0x0804, 0x8936, 0x0804, 0xa830, 0x2009, 0x026e,
+	0x2104, 0x9086, 0x0003, 0x1138, 0x2009, 0x026f, 0x2104, 0x9084,
+	0xff00, 0x9086, 0x2a00, 0x0005, 0x9085, 0x0001, 0x0005, 0x00b6,
+	0x00c6, 0x0016, 0x6110, 0x2158, 0x080c, 0x627f, 0x001e, 0x00ce,
+	0x00be, 0x0005, 0x00b6, 0x00f6, 0x00e6, 0x00d6, 0x0036, 0x0016,
+	0x6010, 0x2058, 0x2009, 0x1836, 0x2104, 0x9085, 0x0003, 0x200a,
+	0x080c, 0xaafa, 0x0560, 0x2009, 0x1836, 0x2104, 0xc0cd, 0x200a,
+	0x080c, 0x6663, 0x0158, 0x9006, 0x2020, 0x2009, 0x002a, 0x080c,
+	0xd273, 0x2001, 0x180c, 0x200c, 0xc195, 0x2102, 0x2019, 0x002a,
+	0x2009, 0x0001, 0x080c, 0x2fc5, 0x00e6, 0x2071, 0x1800, 0x080c,
+	0x2ddb, 0x00ee, 0x00c6, 0x0156, 0x20a9, 0x0781, 0x2009, 0x007f,
+	0x080c, 0x311a, 0x8108, 0x1f04, 0xaa98, 0x015e, 0x00ce, 0x080c,
+	0xaa57, 0x2071, 0x0260, 0x2079, 0x0200, 0x7817, 0x0001, 0x2001,
+	0x1836, 0x200c, 0xc1c5, 0x7018, 0xd0fc, 0x0110, 0xd0dc, 0x0118,
+	0x7038, 0xd0dc, 0x1108, 0xc1c4, 0x7817, 0x0000, 0x2001, 0x1836,
+	0x2102, 0x2079, 0x0100, 0x2e04, 0x9084, 0x00ff, 0x2069, 0x181e,
+	0x206a, 0x78e6, 0x0006, 0x8e70, 0x2e04, 0x2069, 0x181f, 0x206a,
+	0x78ea, 0x7832, 0x7836, 0x2010, 0x9084, 0xff00, 0x001e, 0x9105,
+	0x2009, 0x182b, 0x200a, 0x2200, 0x9084, 0x00ff, 0x2008, 0x080c,
+	0x246d, 0x080c, 0x70b7, 0x0170, 0x2071, 0x0260, 0x2069, 0x1953,
+	0x7048, 0x206a, 0x704c, 0x6806, 0x7050, 0x680a, 0x7054, 0x680e,
+	0x080c, 0xbc6d, 0x0040, 0x2001, 0x0006, 0x080c, 0x61c1, 0x080c,
+	0x303b, 0x080c, 0x9be7, 0x001e, 0x003e, 0x00de, 0x00ee, 0x00fe,
+	0x00be, 0x0005, 0x0096, 0x0026, 0x0036, 0x00e6, 0x0156, 0x2019,
+	0x182b, 0x231c, 0x83ff, 0x01f0, 0x2071, 0x0260, 0x7200, 0x9294,
+	0x00ff, 0x7004, 0x9084, 0xff00, 0x9205, 0x9306, 0x1198, 0x2011,
+	0x0276, 0x20a9, 0x0004, 0x2b48, 0x2019, 0x000a, 0x080c, 0xabdf,
+	0x1148, 0x2011, 0x027a, 0x20a9, 0x0004, 0x2019, 0x0006, 0x080c,
+	0xabdf, 0x1100, 0x015e, 0x00ee, 0x003e, 0x002e, 0x009e, 0x0005,
+	0x00e6, 0x2071, 0x0260, 0x7034, 0x9086, 0x0014, 0x11a8, 0x7038,
+	0x9086, 0x0800, 0x1188, 0x703c, 0xd0ec, 0x0160, 0x9084, 0x0f00,
+	0x9086, 0x0100, 0x1138, 0x7054, 0xd0a4, 0x1110, 0xd0ac, 0x0110,
+	0x9006, 0x0010, 0x9085, 0x0001, 0x00ee, 0x0005, 0x00e6, 0x0096,
+	0x00c6, 0x0076, 0x0056, 0x0046, 0x0026, 0x0006, 0x0126, 0x2091,
+	0x8000, 0x2029, 0x19c4, 0x252c, 0x2021, 0x19cb, 0x2424, 0x2061,
+	0x1ddc, 0x2071, 0x1800, 0x7250, 0x7070, 0x9202, 0x1a04, 0xabb7,
+	0x080c, 0xd2a4, 0x0904, 0xabb0, 0x6720, 0x9786, 0x0007, 0x0904,
+	0xabb0, 0x2500, 0x9c06, 0x0904, 0xabb0, 0x2400, 0x9c06, 0x0904,
+	0xabb0, 0x3e08, 0x9186, 0x0002, 0x1148, 0x6010, 0x9005, 0x0130,
+	0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x1590, 0x00c6, 0x6043,
+	0xffff, 0x6000, 0x9086, 0x0004, 0x1110, 0x080c, 0x1914, 0x9786,
+	0x000a, 0x0148, 0x080c, 0xba5c, 0x1130, 0x00ce, 0x080c, 0xa58f,
+	0x080c, 0x9c21, 0x00e8, 0x6014, 0x2048, 0x080c, 0xb847, 0x01a8,
+	0x9786, 0x0003, 0x1530, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130,
+	0x0096, 0xa878, 0x2048, 0x080c, 0x0fd4, 0x009e, 0xab7a, 0xa877,
+	0x0000, 0x080c, 0x698a, 0x080c, 0xba36, 0x080c, 0x9c21, 0x00ce,
+	0x9ce0, 0x001c, 0x7064, 0x9c02, 0x1210, 0x0804, 0xab5b, 0x012e,
+	0x000e, 0x002e, 0x004e, 0x005e, 0x007e, 0x00ce, 0x009e, 0x00ee,
+	0x0005, 0x9786, 0x0006, 0x1118, 0x080c, 0xd21e, 0x0c30, 0x9786,
+	0x000a, 0x0998, 0x0880, 0x220c, 0x2304, 0x9106, 0x1130, 0x8210,
+	0x8318, 0x1f04, 0xabcb, 0x9006, 0x0005, 0x2304, 0x9102, 0x0218,
+	0x2001, 0x0001, 0x0008, 0x9006, 0x918d, 0x0001, 0x0005, 0x0136,
+	0x01c6, 0x0016, 0x8906, 0x8006, 0x8007, 0x908c, 0x003f, 0x21e0,
+	0x9084, 0xffc0, 0x9300, 0x2098, 0x3518, 0x20a9, 0x0001, 0x220c,
+	0x4002, 0x910e, 0x1140, 0x8210, 0x8319, 0x1dc8, 0x9006, 0x001e,
+	0x01ce, 0x013e, 0x0005, 0x220c, 0x9102, 0x0218, 0x2001, 0x0001,
+	0x0010, 0x2001, 0x0000, 0x918d, 0x0001, 0x001e, 0x01ce, 0x013e,
+	0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d65, 0x080c, 0xba4b,
+	0x0120, 0x080c, 0xba5c, 0x0158, 0x0028, 0x080c, 0x303b, 0x080c,
+	0xba5c, 0x0128, 0x080c, 0x8874, 0x080c, 0x9be7, 0x0005, 0x080c,
+	0xa58f, 0x0cc0, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208,
+	0x000a, 0x0005, 0xac41, 0xac41, 0xac41, 0xac41, 0xac41, 0xac41,
+	0xac41, 0xac41, 0xac41, 0xac41, 0xac41, 0xac43, 0xac43, 0xac43,
+	0xac43, 0xac41, 0xac41, 0xac41, 0xac43, 0xac41, 0xac41, 0xac41,
+	0xac41, 0x080c, 0x0d65, 0x600b, 0xffff, 0x6003, 0x000f, 0x6106,
+	0x0126, 0x2091, 0x8000, 0x080c, 0xbf79, 0x2009, 0x8000, 0x080c,
+	0x84d1, 0x012e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004, 0x9082,
+	0x0040, 0x0804, 0xacc8, 0x9186, 0x0027, 0x1520, 0x080c, 0x8874,
+	0x080c, 0x3006, 0x080c, 0xbf76, 0x0096, 0x6114, 0x2148, 0x080c,
+	0xb847, 0x0198, 0x080c, 0xba5c, 0x1118, 0x080c, 0xa58f, 0x0068,
+	0xa867, 0x0103, 0xa87b, 0x0029, 0xa877, 0x0000, 0xa97c, 0xc1c5,
+	0xa97e, 0x080c, 0x6996, 0x080c, 0xba36, 0x009e, 0x080c, 0x9be7,
+	0x0804, 0x8936, 0x9186, 0x0014, 0x1120, 0x6004, 0x9082, 0x0040,
+	0x0018, 0x080c, 0x0d65, 0x0005, 0x0002, 0xaca6, 0xaca4, 0xaca4,
+	0xaca4, 0xaca4, 0xaca4, 0xaca4, 0xaca4, 0xaca4, 0xaca4, 0xaca4,
+	0xacbf, 0xacbf, 0xacbf, 0xacbf, 0xaca4, 0xacbf, 0xaca4, 0xacbf,
+	0xaca4, 0xaca4, 0xaca4, 0xaca4, 0x080c, 0x0d65, 0x080c, 0x8874,
+	0x0096, 0x6114, 0x2148, 0x080c, 0xb847, 0x0168, 0xa867, 0x0103,
+	0xa87b, 0x0006, 0xa877, 0x0000, 0xa880, 0xc0ec, 0xa882, 0x080c,
+	0x6996, 0x080c, 0xba36, 0x009e, 0x080c, 0x9be7, 0x0005, 0x080c,
+	0x8874, 0x080c, 0xba5c, 0x090c, 0xa58f, 0x080c, 0x9be7, 0x0005,
+	0x0002, 0xace2, 0xace0, 0xace0, 0xace0, 0xace0, 0xace0, 0xace0,
+	0xace0, 0xace0, 0xace0, 0xace0, 0xace4, 0xace4, 0xace4, 0xace4,
+	0xace0, 0xace6, 0xace0, 0xace4, 0xace0, 0xace0, 0xace0, 0xace0,
+	0x080c, 0x0d65, 0x080c, 0x0d65, 0x080c, 0x0d65, 0x080c, 0x9be7,
+	0x0804, 0x8936, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208,
+	0x000a, 0x0005, 0xad09, 0xad09, 0xad09, 0xad09, 0xad09, 0xad42,
+	0xae31, 0xad09, 0xae3d, 0xad09, 0xad09, 0xad09, 0xad09, 0xad09,
+	0xad09, 0xad09, 0xad09, 0xad09, 0xad09, 0xae3d, 0xad0b, 0xad09,
+	0xae3b, 0x080c, 0x0d65, 0x00b6, 0x0096, 0x6114, 0x2148, 0x6010,
+	0x2058, 0xb800, 0xd0bc, 0x1508, 0xa87b, 0x0000, 0xa867, 0x0103,
+	0xa877, 0x0000, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938, 0x9115,
+	0x190c, 0xaec2, 0x080c, 0x67ac, 0x6210, 0x2258, 0xba3c, 0x82ff,
+	0x0110, 0x8211, 0xba3e, 0xb8c0, 0x9005, 0x0110, 0x080c, 0x639b,
+	0x080c, 0x9be7, 0x009e, 0x00be, 0x0005, 0xa87c, 0xd0ac, 0x09e0,
+	0xa838, 0xa934, 0x9105, 0x09c0, 0xa880, 0xd0bc, 0x19a8, 0x080c,
+	0xbb8c, 0x0c80, 0x00b6, 0x0096, 0x6114, 0x2148, 0x601c, 0xd0fc,
+	0x1110, 0x7644, 0x0008, 0x9036, 0x96b4, 0x0fff, 0x86ff, 0x1590,
+	0x6010, 0x2058, 0xb800, 0xd0bc, 0x1904, 0xae20, 0xa87b, 0x0000,
+	0xa867, 0x0103, 0xae76, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
+	0x9115, 0x190c, 0xaec2, 0x080c, 0x67ac, 0x6210, 0x2258, 0xba3c,
+	0x82ff, 0x0110, 0x8211, 0xba3e, 0xb8c0, 0x9005, 0x0110, 0x080c,
+	0x639b, 0x601c, 0xd0fc, 0x1148, 0x7044, 0xd0e4, 0x1904, 0xae04,
+	0x080c, 0x9be7, 0x009e, 0x00be, 0x0005, 0x2009, 0x0211, 0x210c,
+	0x080c, 0x0d65, 0x968c, 0x0c00, 0x0150, 0x6010, 0x2058, 0xb800,
+	0xd0bc, 0x1904, 0xae08, 0x7348, 0xab92, 0x734c, 0xab8e, 0x968c,
+	0x00ff, 0x9186, 0x0002, 0x0508, 0x9186, 0x0028, 0x1118, 0xa87b,
+	0x001c, 0x00e8, 0xd6dc, 0x01a0, 0xa87b, 0x0015, 0xa87c, 0xd0ac,
+	0x0170, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0148, 0x7048, 0x9106,
+	0x1118, 0x704c, 0x9206, 0x0118, 0xa992, 0xaa8e, 0xc6dc, 0x0038,
+	0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xa867,
+	0x0103, 0xae76, 0x901e, 0xd6c4, 0x01d8, 0x9686, 0x0100, 0x1130,
+	0x7064, 0x9005, 0x1118, 0xc6c4, 0x0804, 0xad4e, 0x735c, 0xab86,
+	0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008, 0x0036,
+	0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xb41a, 0x003e,
+	0xd6cc, 0x0904, 0xad63, 0x7154, 0xa98a, 0x81ff, 0x0904, 0xad63,
+	0x9192, 0x0021, 0x1278, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029,
+	0x080c, 0xb41a, 0x2011, 0x0205, 0x2013, 0x0000, 0x080c, 0xbf06,
+	0x0804, 0xad63, 0xa868, 0xd0fc, 0x0120, 0x2009, 0x0020, 0xa98a,
+	0x0c50, 0x00a6, 0x2950, 0x080c, 0xb3b9, 0x00ae, 0x080c, 0xbf06,
+	0x080c, 0xb40a, 0x0804, 0xad65, 0x080c, 0xbb4f, 0x0804, 0xad7a,
+	0xa87c, 0xd0ac, 0x0904, 0xad8b, 0xa880, 0xd0bc, 0x1904, 0xad8b,
+	0x7348, 0xa838, 0x9306, 0x11c8, 0x734c, 0xa834, 0x931e, 0x0904,
+	0xad8b, 0xd6d4, 0x0190, 0xab38, 0x9305, 0x0904, 0xad8b, 0x0068,
+	0xa87c, 0xd0ac, 0x0904, 0xad56, 0xa838, 0xa934, 0x9105, 0x0904,
+	0xad56, 0xa880, 0xd0bc, 0x1904, 0xad56, 0x080c, 0xbb8c, 0x0804,
+	0xad7a, 0x00f6, 0x2079, 0x026c, 0x7c04, 0x7b00, 0x7e0c, 0x7d08,
+	0x00fe, 0x0021, 0x0005, 0x0011, 0x0005, 0x0005, 0x0096, 0x6003,
+	0x0002, 0x6007, 0x0043, 0x6014, 0x2048, 0xa87c, 0xd0ac, 0x0128,
+	0x009e, 0x0005, 0x2130, 0x2228, 0x0058, 0x2400, 0xa9ac, 0x910a,
+	0x2300, 0xaab0, 0x9213, 0x2600, 0x9102, 0x2500, 0x9203, 0x0e90,
+	0xac46, 0xab4a, 0xae36, 0xad3a, 0x6044, 0xd0fc, 0x190c, 0x98f1,
+	0x604b, 0x0000, 0x080c, 0x1ad2, 0x1118, 0x6144, 0x080c, 0x84fd,
+	0x009e, 0x0005, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208,
+	0x000a, 0x0005, 0xae89, 0xae89, 0xae89, 0xae89, 0xae89, 0xae89,
+	0xae89, 0xae89, 0xae89, 0xae89, 0xae8b, 0xae89, 0xae89, 0xae89,
+	0xae89, 0xae9c, 0xae89, 0xae89, 0xae89, 0xae89, 0xaec0, 0xae89,
+	0xae89, 0x080c, 0x0d65, 0x6004, 0x9086, 0x0040, 0x1110, 0x080c,
+	0x8874, 0x2019, 0x0001, 0x080c, 0x9286, 0x6003, 0x0002, 0x080c,
+	0xbf7e, 0x080c, 0x88d1, 0x0005, 0x6004, 0x9086, 0x0040, 0x1110,
+	0x080c, 0x8874, 0x2019, 0x0001, 0x080c, 0x9286, 0x080c, 0x88d1,
+	0x080c, 0x3006, 0x080c, 0xbf76, 0x0096, 0x6114, 0x2148, 0x080c,
+	0xb847, 0x0150, 0xa867, 0x0103, 0xa87b, 0x0029, 0xa877, 0x0000,
+	0x080c, 0x6996, 0x080c, 0xba36, 0x009e, 0x080c, 0x9be7, 0x0005,
+	0x080c, 0x0d65, 0xa87b, 0x0015, 0xd1fc, 0x0180, 0xa87b, 0x0007,
+	0x8002, 0x8000, 0x810a, 0x9189, 0x0000, 0x0006, 0x0016, 0x2009,
+	0x1a48, 0x2104, 0x8000, 0x200a, 0x001e, 0x000e, 0xa992, 0xa88e,
+	0x0005, 0x9182, 0x0057, 0x1220, 0x9182, 0x0040, 0x0208, 0x000a,
+	0x0005, 0xaef8, 0xaef8, 0xaef8, 0xaef8, 0xaef8, 0xaefa, 0xaef8,
+	0xaef8, 0xafb7, 0xaef8, 0xaef8, 0xaef8, 0xaef8, 0xaef8, 0xaef8,
+	0xaef8, 0xaef8, 0xaef8, 0xaef8, 0xb0fb, 0xaef8, 0xb105, 0xaef8,
+	0x080c, 0x0d65, 0x601c, 0xd0bc, 0x0178, 0xd084, 0x0168, 0xd0f4,
+	0x0120, 0xc084, 0x601e, 0x0804, 0xacea, 0x6114, 0x0096, 0x2148,
+	0xa87c, 0xc0e5, 0xa87e, 0x009e, 0x0076, 0x00a6, 0x00e6, 0x0096,
+	0x2071, 0x0260, 0x6114, 0x2150, 0x601c, 0xd0fc, 0x1110, 0x7644,
+	0x0008, 0x9036, 0xb676, 0x96b4, 0x0fff, 0xb77c, 0xc7e5, 0xb77e,
+	0x6210, 0x00b6, 0x2258, 0xba3c, 0x82ff, 0x0110, 0x8211, 0xba3e,
+	0x00be, 0x86ff, 0x0904, 0xafb0, 0x9694, 0xff00, 0x9284, 0x0c00,
+	0x0120, 0x7048, 0xb092, 0x704c, 0xb08e, 0x9284, 0x0300, 0x0904,
+	0xafb0, 0x9686, 0x0100, 0x1130, 0x7064, 0x9005, 0x1118, 0xc6c4,
+	0xb676, 0x0c38, 0x080c, 0x1022, 0x090c, 0x0d65, 0x2900, 0xb07a,
+	0xb77c, 0x97bd, 0x0200, 0xb77e, 0xa867, 0x0103, 0xb068, 0xa86a,
+	0xb06c, 0xa86e, 0xb070, 0xa872, 0x7044, 0x9084, 0xf000, 0x9635,
+	0xae76, 0x968c, 0x0c00, 0x0120, 0x7348, 0xab92, 0x734c, 0xab8e,
+	0x968c, 0x00ff, 0x9186, 0x0002, 0x0180, 0x9186, 0x0028, 0x1118,
+	0xa87b, 0x001c, 0x0060, 0xd6dc, 0x0118, 0xa87b, 0x0015, 0x0038,
+	0xd6d4, 0x0118, 0xa87b, 0x0007, 0x0010, 0xa87b, 0x0000, 0xaf7e,
+	0xb080, 0xa882, 0xb084, 0xa886, 0x901e, 0xd6c4, 0x0190, 0x735c,
+	0xab86, 0x83ff, 0x0170, 0x938a, 0x0009, 0x0210, 0x2019, 0x0008,
+	0x0036, 0x2308, 0x2019, 0x0018, 0x2011, 0x0025, 0x080c, 0xb41a,
+	0x003e, 0xd6cc, 0x01e8, 0x7154, 0xa98a, 0x81ff, 0x01c8, 0x9192,
+	0x0021, 0x1260, 0x8304, 0x9098, 0x0018, 0x2011, 0x0029, 0x080c,
+	0xb41a, 0x2011, 0x0205, 0x2013, 0x0000, 0x0050, 0xb068, 0xd0fc,
+	0x0120, 0x2009, 0x0020, 0xa98a, 0x0c68, 0x2950, 0x080c, 0xb3b9,
+	0x080c, 0x18f2, 0x009e, 0x00ee, 0x00ae, 0x007e, 0x0005, 0x2001,
+	0x1959, 0x2004, 0x604a, 0x0096, 0x6114, 0x2148, 0xa83c, 0xa940,
+	0x9105, 0x1118, 0xa87c, 0xc0dc, 0xa87e, 0x6003, 0x0002, 0x080c,
+	0xbf87, 0x0904, 0xb0f6, 0x604b, 0x0000, 0x6010, 0x00b6, 0x2058,
+	0xb800, 0x00be, 0xd0bc, 0x1500, 0xd1cc, 0x0904, 0xb0b5, 0xa978,
+	0xa868, 0xd0fc, 0x0904, 0xb076, 0x0016, 0xa87c, 0x0006, 0xa880,
+	0x0006, 0x00a6, 0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002,
+	0x0904, 0xb044, 0x9086, 0x0028, 0x1904, 0xb030, 0xa87b, 0x001c,
+	0xb07b, 0x001c, 0x0804, 0xb04c, 0x6024, 0xd0f4, 0x11d0, 0xa838,
+	0xaa34, 0x9205, 0x09c8, 0xa838, 0xaa90, 0x9206, 0x1120, 0xa88c,
+	0xaa34, 0x9206, 0x0988, 0x6024, 0xd0d4, 0x1148, 0xa9ac, 0xa834,
+	0x9102, 0x603a, 0xa9b0, 0xa838, 0x9103, 0x603e, 0x6024, 0xc0f5,
+	0x6026, 0x6010, 0x00b6, 0x2058, 0xb83c, 0x8000, 0xb83e, 0x00be,
+	0x601c, 0xc0fc, 0x601e, 0x9006, 0xa876, 0xa892, 0xa88e, 0xa87c,
+	0xc0e4, 0xa87e, 0xd0cc, 0x0140, 0xc0cc, 0xa87e, 0x0096, 0xa878,
+	0x2048, 0x080c, 0x0fd4, 0x009e, 0x080c, 0xbb8c, 0x0804, 0xb0f6,
+	0xd1dc, 0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xbe29,
+	0x0118, 0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b,
+	0x0007, 0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834,
+	0xa938, 0x9115, 0x190c, 0xaec2, 0xa87c, 0xb07e, 0xa890, 0xb092,
+	0xa88c, 0xb08e, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0019, 0x20a0,
+	0x20a9, 0x0020, 0x8a06, 0x8006, 0x8007, 0x9094, 0x003f, 0x22e0,
+	0x9084, 0xffc0, 0x9080, 0x0019, 0x2098, 0x4003, 0x00ae, 0x000e,
+	0xa882, 0x000e, 0xa87e, 0x080c, 0xbf06, 0x001e, 0xa874, 0x0006,
+	0x2148, 0x080c, 0x0fd4, 0x001e, 0x0804, 0xb0e2, 0x0016, 0x00a6,
+	0x2150, 0xb174, 0x9184, 0x00ff, 0x90b6, 0x0002, 0x01e0, 0x9086,
+	0x0028, 0x1128, 0xa87b, 0x001c, 0xb07b, 0x001c, 0x00e0, 0xd1dc,
+	0x0158, 0xa87b, 0x0015, 0xb07b, 0x0015, 0x080c, 0xbe29, 0x0118,
+	0xb174, 0xc1dc, 0xb176, 0x0078, 0xd1d4, 0x0128, 0xa87b, 0x0007,
+	0xb07b, 0x0007, 0x0040, 0xa87c, 0xd0ac, 0x0128, 0xa834, 0xa938,
+	0x9115, 0x190c, 0xaec2, 0xa890, 0xb092, 0xa88c, 0xb08e, 0xa87c,
+	0xb07e, 0x00ae, 0x080c, 0x0fd4, 0x009e, 0x080c, 0xbf06, 0xa974,
+	0x0016, 0x080c, 0xb40a, 0x001e, 0x0468, 0xa867, 0x0103, 0xa974,
+	0x9184, 0x00ff, 0x90b6, 0x0002, 0x01b0, 0x9086, 0x0028, 0x1118,
+	0xa87b, 0x001c, 0x00d0, 0xd1dc, 0x0148, 0xa87b, 0x0015, 0x080c,
+	0xbe29, 0x0118, 0xa974, 0xc1dc, 0xa976, 0x0078, 0xd1d4, 0x0118,
+	0xa87b, 0x0007, 0x0050, 0xa87b, 0x0000, 0xa87c, 0xd0ac, 0x0128,
+	0xa834, 0xa938, 0x9115, 0x190c, 0xaec2, 0xa974, 0x0016, 0x080c,
+	0x67ac, 0x001e, 0x6010, 0x00b6, 0x2058, 0xba3c, 0x82ff, 0x0110,
+	0x8211, 0xba3e, 0xb8c0, 0x9005, 0x0120, 0x0016, 0x080c, 0x639b,
+	0x001e, 0x00be, 0xd1e4, 0x1120, 0x080c, 0x9be7, 0x009e, 0x0005,
+	0x080c, 0xbb4f, 0x0cd8, 0x6114, 0x0096, 0x2148, 0xa97c, 0x080c,
+	0xbf87, 0x190c, 0x1900, 0x009e, 0x0005, 0x0096, 0x6114, 0x2148,
+	0xa83c, 0xa940, 0x9105, 0x01e8, 0xa877, 0x0000, 0xa87b, 0x0000,
+	0xa867, 0x0103, 0x00b6, 0x6010, 0x2058, 0xa834, 0xa938, 0x9115,
+	0x11a0, 0x080c, 0x67ac, 0xba3c, 0x8211, 0x0208, 0xba3e, 0xb8c0,
+	0x9005, 0x0110, 0x080c, 0x639b, 0x080c, 0x9be7, 0x00be, 0x009e,
+	0x0005, 0xa87c, 0xc0dc, 0xa87e, 0x08f8, 0xb800, 0xd0bc, 0x1120,
+	0xa834, 0x080c, 0xaec2, 0x0c28, 0xa880, 0xd0bc, 0x1dc8, 0x080c,
+	0xbb8c, 0x0c60, 0x080c, 0x8874, 0x0010, 0x080c, 0x88d1, 0x601c,
+	0xd084, 0x0110, 0x080c, 0x1914, 0x080c, 0xb847, 0x01f0, 0x0096,
+	0x6114, 0x2148, 0x080c, 0xba5c, 0x1118, 0x080c, 0xa58f, 0x00a0,
+	0xa867, 0x0103, 0x2009, 0x180c, 0x210c, 0xd18c, 0x1198, 0xd184,
+	0x1170, 0x6108, 0xa97a, 0x918e, 0x0029, 0x1110, 0x080c, 0xd51a,
+	0xa877, 0x0000, 0x080c, 0x6996, 0x009e, 0x0804, 0x9c21, 0xa87b,
+	0x0004, 0x0cb0, 0xa87b, 0x0004, 0x0c98, 0x9182, 0x0057, 0x1220,
+	0x9182, 0x0040, 0x0208, 0x000a, 0x0005, 0xb18c, 0xb18c, 0xb18c,
+	0xb18c, 0xb18c, 0xb18e, 0xb18c, 0xb18c, 0xb18c, 0xb18c, 0xb18c,
+	0xb18c, 0xb18c, 0xb18c, 0xb18c, 0xb18c, 0xb18c, 0xb18c, 0xb18c,
+	0xb18c, 0xb1b2, 0xb18c, 0xb18c, 0x080c, 0x0d65, 0x080c, 0x5395,
+	0x01f8, 0x6014, 0x7144, 0x918c, 0x0fff, 0x9016, 0xd1c4, 0x0118,
+	0x7264, 0x9294, 0x00ff, 0x0096, 0x904d, 0x0188, 0xa87b, 0x0000,
+	0xa864, 0x9086, 0x0139, 0x0128, 0xa867, 0x0103, 0xa976, 0xaa96,
+	0x0030, 0xa897, 0x4000, 0xa99a, 0xaa9e, 0x080c, 0x6996, 0x009e,
+	0x0804, 0x9be7, 0x080c, 0x5395, 0x0dd8, 0x6014, 0x900e, 0x9016,
+	0x0c10, 0x9182, 0x0085, 0x0002, 0xb1cb, 0xb1c9, 0xb1c9, 0xb1d7,
+	0xb1c9, 0xb1c9, 0xb1c9, 0xb1c9, 0xb1c9, 0xb1c9, 0xb1c9, 0xb1c9,
+	0xb1c9, 0x080c, 0x0d65, 0x6003, 0x0001, 0x6106, 0x0126, 0x2091,
+	0x8000, 0x2009, 0x8020, 0x080c, 0x84d1, 0x012e, 0x0005, 0x0026,
+	0x0056, 0x00d6, 0x00e6, 0x2071, 0x0260, 0x7224, 0x6216, 0x7220,
+	0x080c, 0xb835, 0x01a0, 0x2268, 0x6800, 0x9086, 0x0000, 0x0178,
+	0x6010, 0x6d10, 0x952e, 0x1158, 0x00c6, 0x2d60, 0x080c, 0xb445,
+	0x00ce, 0x0128, 0x6803, 0x0002, 0x6007, 0x0086, 0x0010, 0x6007,
+	0x0087, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x84d1, 0x9280,
+	0x0004, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0140, 0x6824,
+	0xd0ec, 0x0128, 0x00c6, 0x2260, 0x080c, 0xbb8c, 0x00ce, 0x00ee,
+	0x00de, 0x005e, 0x002e, 0x0005, 0x9186, 0x0013, 0x1160, 0x6004,
+	0x908a, 0x0085, 0x0a0c, 0x0d65, 0x908a, 0x0092, 0x1a0c, 0x0d65,
+	0x9082, 0x0085, 0x00e2, 0x9186, 0x0027, 0x0120, 0x9186, 0x0014,
+	0x190c, 0x0d65, 0x080c, 0x8874, 0x0096, 0x6014, 0x2048, 0x080c,
+	0xb847, 0x0140, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029,
+	0x080c, 0x6996, 0x009e, 0x080c, 0x9c21, 0x0804, 0x8936, 0xb24c,
+	0xb24e, 0xb24e, 0xb24c, 0xb24c, 0xb24c, 0xb24c, 0xb24c, 0xb24c,
+	0xb24c, 0xb24c, 0xb24c, 0xb24c, 0x080c, 0x0d65, 0x080c, 0x9c21,
+	0x0005, 0x9186, 0x0013, 0x1130, 0x6004, 0x9082, 0x0085, 0x2008,
+	0x0804, 0xb29d, 0x9186, 0x0027, 0x1558, 0x080c, 0x8874, 0x080c,
+	0x3006, 0x080c, 0xbf76, 0x0096, 0x6014, 0x2048, 0x080c, 0xb847,
+	0x0150, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b, 0x0029, 0x080c,
+	0x6996, 0x080c, 0xba36, 0x009e, 0x080c, 0x9be7, 0x0005, 0x9186,
+	0x0089, 0x0118, 0x9186, 0x008a, 0x1140, 0x080c, 0x9ab7, 0x0128,
+	0x9086, 0x000c, 0x0904, 0xb2d5, 0x0000, 0x080c, 0x9ca2, 0x0c70,
+	0x9186, 0x0014, 0x1d60, 0x080c, 0x8874, 0x0096, 0x6014, 0x2048,
+	0x080c, 0xb847, 0x0d00, 0xa867, 0x0103, 0xa877, 0x0000, 0xa87b,
+	0x0006, 0xa880, 0xc0ec, 0xa882, 0x0890, 0x0002, 0xb2ad, 0xb2ab,
+	0xb2ab, 0xb2ab, 0xb2ab, 0xb2ab, 0xb2c1, 0xb2ab, 0xb2ab, 0xb2ab,
+	0xb2ab, 0xb2ab, 0xb2ab, 0x080c, 0x0d65, 0x6034, 0x908c, 0xff00,
+	0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x2001,
+	0x1957, 0x0010, 0x2001, 0x1958, 0x2004, 0x601a, 0x6003, 0x000c,
+	0x0005, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0039, 0x0118,
+	0x9186, 0x0035, 0x1118, 0x2001, 0x1957, 0x0010, 0x2001, 0x1958,
+	0x2004, 0x601a, 0x6003, 0x000e, 0x0005, 0x9182, 0x0092, 0x1220,
+	0x9182, 0x0085, 0x0208, 0x0012, 0x0804, 0x9ca2, 0xb2eb, 0xb2eb,
+	0xb2eb, 0xb2eb, 0xb2ed, 0xb33a, 0xb2eb, 0xb2eb, 0xb2eb, 0xb2eb,
+	0xb2eb, 0xb2eb, 0xb2eb, 0x080c, 0x0d65, 0x0096, 0x6010, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0bc, 0x0168, 0x6034, 0x908c, 0xff00,
+	0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x009e,
+	0x0804, 0xb34e, 0x080c, 0xb847, 0x1118, 0x080c, 0xba36, 0x0068,
+	0x6014, 0x2048, 0x080c, 0xbf8d, 0x1110, 0x080c, 0xba36, 0xa867,
+	0x0103, 0x080c, 0xbf41, 0x080c, 0x6996, 0x00d6, 0x2c68, 0x080c,
+	0x9b91, 0x01d0, 0x6003, 0x0001, 0x6007, 0x001e, 0x600b, 0xffff,
+	0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f, 0x210c, 0x613e,
+	0x6910, 0x6112, 0x080c, 0xbcdb, 0x695c, 0x615e, 0x6023, 0x0001,
+	0x2009, 0x8020, 0x080c, 0x84d1, 0x2d60, 0x00de, 0x080c, 0x9be7,
+	0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
+	0x05a0, 0x6034, 0x908c, 0xff00, 0x810f, 0x9186, 0x0035, 0x0130,
+	0x9186, 0x001e, 0x0118, 0x9186, 0x0039, 0x1538, 0x00d6, 0x2c68,
+	0x080c, 0xbed9, 0x11f0, 0x080c, 0x9b91, 0x01d8, 0x6106, 0x6003,
+	0x0001, 0x6023, 0x0001, 0x6910, 0x6112, 0x692c, 0x612e, 0x6930,
+	0x6132, 0x6934, 0x918c, 0x00ff, 0x6136, 0x6938, 0x613a, 0x693c,
+	0x613e, 0x695c, 0x615e, 0x080c, 0xbcdb, 0x2009, 0x8020, 0x080c,
+	0x84d1, 0x2d60, 0x00de, 0x0804, 0x9be7, 0x0096, 0x6014, 0x2048,
+	0x080c, 0xb847, 0x01c8, 0xa867, 0x0103, 0xa880, 0xd0b4, 0x0128,
+	0xc0ec, 0xa882, 0xa87b, 0x0006, 0x0048, 0xd0bc, 0x0118, 0xa87b,
+	0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xbb4b, 0xa877, 0x0000,
+	0x080c, 0x6996, 0x080c, 0xba36, 0x009e, 0x0804, 0x9be7, 0x0016,
+	0x0096, 0x6014, 0x2048, 0x080c, 0xb847, 0x0140, 0xa867, 0x0103,
+	0xa87b, 0x0028, 0xa877, 0x0000, 0x080c, 0x6996, 0x009e, 0x001e,
+	0x9186, 0x0013, 0x0158, 0x9186, 0x0014, 0x0130, 0x9186, 0x0027,
+	0x0118, 0x080c, 0x9ca2, 0x0020, 0x080c, 0x8874, 0x080c, 0x9c21,
+	0x0005, 0x0056, 0x0066, 0x0096, 0x00a6, 0x2029, 0x0001, 0x9182,
+	0x0101, 0x1208, 0x0010, 0x2009, 0x0100, 0x2130, 0x8304, 0x9098,
+	0x0018, 0x2009, 0x0020, 0x2011, 0x0029, 0x080c, 0xb41a, 0x96b2,
+	0x0020, 0xb004, 0x904d, 0x0110, 0x080c, 0x0fd4, 0x080c, 0x1022,
+	0x0520, 0x8528, 0xa867, 0x0110, 0xa86b, 0x0000, 0x2920, 0xb406,
+	0x968a, 0x003d, 0x1228, 0x2608, 0x2011, 0x001b, 0x0499, 0x00a8,
+	0x96b2, 0x003c, 0x2009, 0x003c, 0x2950, 0x2011, 0x001b, 0x0451,
+	0x0c28, 0x2001, 0x0205, 0x2003, 0x0000, 0x00ae, 0x852f, 0x95ad,
+	0x0003, 0xb566, 0x95ac, 0x0000, 0x0048, 0x2001, 0x0205, 0x2003,
+	0x0000, 0x00ae, 0x852f, 0x95ad, 0x0003, 0xb566, 0x009e, 0x006e,
+	0x005e, 0x0005, 0x00a6, 0x89ff, 0x0158, 0xa804, 0x9055, 0x0130,
+	0xa807, 0x0000, 0x080c, 0x6996, 0x2a48, 0x0cb8, 0x080c, 0x6996,
+	0x00ae, 0x0005, 0x00f6, 0x2079, 0x0200, 0x7814, 0x9085, 0x0080,
+	0x7816, 0xd184, 0x0108, 0x8108, 0x810c, 0x20a9, 0x0001, 0xa860,
+	0x20e8, 0xa85c, 0x9200, 0x20a0, 0x20e1, 0x0000, 0x2300, 0x9e00,
+	0x2098, 0x4003, 0x8318, 0x9386, 0x0020, 0x1148, 0x2018, 0x2300,
+	0x9e00, 0x2098, 0x7814, 0x8000, 0x9085, 0x0080, 0x7816, 0x8109,
+	0x1d80, 0x7817, 0x0000, 0x00fe, 0x0005, 0x0066, 0x0126, 0x2091,
+	0x8000, 0x2031, 0x0001, 0x6020, 0x9084, 0x000f, 0x0083, 0x012e,
+	0x006e, 0x0005, 0x0126, 0x2091, 0x8000, 0x0066, 0x2031, 0x0000,
+	0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x012e, 0x0005, 0xb497,
+	0xb497, 0xb492, 0xb4bb, 0xb46f, 0xb492, 0xb471, 0xb492, 0xb46f,
+	0xb46f, 0xb492, 0xb492, 0xb492, 0xb46f, 0xb46f, 0xb46f, 0x080c,
+	0x0d65, 0x6010, 0x9080, 0x0000, 0x2004, 0xd0bc, 0x190c, 0xb4bb,
+	0x0036, 0x6014, 0x0096, 0x2048, 0xa880, 0x009e, 0xd0cc, 0x0118,
+	0x2019, 0x000c, 0x0038, 0xd094, 0x0118, 0x2019, 0x000d, 0x0010,
+	0x2019, 0x0010, 0x080c, 0xcdf9, 0x6023, 0x0006, 0x6003, 0x0007,
+	0x003e, 0x0005, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x0096,
+	0x86ff, 0x11e8, 0x6014, 0x2048, 0x080c, 0xb847, 0x01d0, 0x6043,
+	0xffff, 0xa864, 0x9086, 0x0139, 0x1128, 0xa87b, 0x0005, 0xa883,
+	0x0000, 0x0028, 0x900e, 0x2001, 0x0005, 0x080c, 0x6bb3, 0x080c,
+	0xbb4b, 0x080c, 0x698a, 0x080c, 0x9c21, 0x9085, 0x0001, 0x009e,
+	0x0005, 0x9006, 0x0ce0, 0x080c, 0x98c8, 0x080c, 0xbf9b, 0x6000,
+	0x908a, 0x0016, 0x1a0c, 0x0d65, 0x002b, 0x0106, 0x080c, 0x98e4,
+	0x010e, 0x0005, 0xb4da, 0xb508, 0xb4dc, 0xb52f, 0xb503, 0xb4da,
+	0xb492, 0xb497, 0xb497, 0xb492, 0xb492, 0xb492, 0xb492, 0xb492,
+	0xb492, 0xb492, 0x080c, 0x0d65, 0x86ff, 0x1510, 0x6020, 0x9086,
+	0x0006, 0x01f0, 0x0096, 0x6014, 0x2048, 0x080c, 0xb847, 0x0158,
+	0xa87c, 0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fd4,
+	0x009e, 0x080c, 0xbb4b, 0x009e, 0x080c, 0xbf1b, 0x6007, 0x0085,
+	0x6003, 0x000b, 0x6023, 0x0002, 0x2009, 0x8020, 0x080c, 0x84b3,
+	0x9085, 0x0001, 0x0005, 0x0066, 0x080c, 0x1914, 0x006e, 0x08a0,
+	0x00e6, 0x2071, 0x19b8, 0x7030, 0x9c06, 0x1120, 0x080c, 0x9206,
+	0x00ee, 0x0850, 0x6020, 0x9084, 0x000f, 0x9086, 0x0006, 0x1150,
+	0x0086, 0x0096, 0x2049, 0x0001, 0x2c40, 0x080c, 0x9382, 0x009e,
+	0x008e, 0x0040, 0x0066, 0x080c, 0x9102, 0x190c, 0x0d65, 0x080c,
+	0x9110, 0x006e, 0x00ee, 0x1904, 0xb4dc, 0x0804, 0xb492, 0x0036,
+	0x00e6, 0x2071, 0x19b8, 0x704c, 0x9c06, 0x1138, 0x901e, 0x080c,
+	0x9286, 0x00ee, 0x003e, 0x0804, 0xb4dc, 0x080c, 0x94b8, 0x00ee,
+	0x003e, 0x1904, 0xb4dc, 0x0804, 0xb492, 0x00c6, 0x0066, 0x6020,
+	0x9084, 0x000f, 0x001b, 0x006e, 0x00ce, 0x0005, 0xb565, 0xb627,
+	0xb78e, 0xb56d, 0x9c21, 0xb565, 0xcdeb, 0xbf83, 0xb627, 0xb55e,
+	0xb80d, 0xb55e, 0xb55e, 0xb55e, 0xb55e, 0xb55e, 0x080c, 0x0d65,
+	0x080c, 0xba5c, 0x1110, 0x080c, 0xa58f, 0x0005, 0x080c, 0x8874,
+	0x0804, 0x9be7, 0x601b, 0x0001, 0x0005, 0x080c, 0xb847, 0x0130,
+	0x6014, 0x0096, 0x2048, 0x2c00, 0xa896, 0x009e, 0x080c, 0x98c8,
+	0x080c, 0xbf9b, 0x6000, 0x908a, 0x0016, 0x1a0c, 0x0d65, 0x0013,
+	0x0804, 0x98e4, 0xb592, 0xb594, 0xb5be, 0xb5d2, 0xb5fd, 0xb592,
+	0xb565, 0xb565, 0xb565, 0xb5d9, 0xb5d9, 0xb592, 0xb592, 0xb592,
+	0xb592, 0xb5e3, 0x080c, 0x0d65, 0x00e6, 0x6014, 0x0096, 0x2048,
+	0xa880, 0xc0b5, 0xa882, 0x009e, 0x2071, 0x19b8, 0x7030, 0x9c06,
+	0x01d0, 0x0066, 0x080c, 0x9102, 0x190c, 0x0d65, 0x080c, 0x9110,
+	0x006e, 0x080c, 0xbf1b, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
+	0x0002, 0x2001, 0x1958, 0x2004, 0x601a, 0x2009, 0x8020, 0x080c,
+	0x84b3, 0x00ee, 0x0005, 0x601b, 0x0001, 0x0cd8, 0x0096, 0x6014,
+	0x2048, 0xa880, 0xc0b5, 0xa882, 0x009e, 0x080c, 0xbf1b, 0x6007,
+	0x0085, 0x6003, 0x000b, 0x6023, 0x0002, 0x2009, 0x8020, 0x080c,
+	0x84b3, 0x0005, 0x080c, 0x98c8, 0x080c, 0x9a39, 0x080c, 0x98e4,
+	0x0c28, 0x0096, 0x601b, 0x0001, 0x6014, 0x2048, 0xa880, 0xc0b5,
+	0xa882, 0x009e, 0x0005, 0x080c, 0x5395, 0x01a8, 0x6014, 0x0096,
+	0x904d, 0x0180, 0xa864, 0xa867, 0x0103, 0xa87b, 0x0006, 0x9086,
+	0x0139, 0x1140, 0xa867, 0x0139, 0xa897, 0x4005, 0xa89b, 0x0004,
+	0x080c, 0x6996, 0x009e, 0x0804, 0x9be7, 0x6014, 0x0096, 0x904d,
+	0x0508, 0x080c, 0xbf87, 0x01f0, 0x080c, 0x98e4, 0x2001, 0x180f,
+	0x2004, 0xd0c4, 0x0110, 0x009e, 0x0005, 0xa884, 0x009e, 0x8003,
+	0x800b, 0x810b, 0x9108, 0x611a, 0x2001, 0x0037, 0x2c08, 0x080c,
+	0x159e, 0x6000, 0x9086, 0x0004, 0x1120, 0x2009, 0x0048, 0x080c,
+	0x9c85, 0x0005, 0x009e, 0x080c, 0x1914, 0x0804, 0xb5be, 0x6000,
+	0x908a, 0x0016, 0x1a0c, 0x0d65, 0x000b, 0x0005, 0xb63e, 0xb56a,
+	0xb640, 0xb63e, 0xb640, 0xb640, 0xb566, 0xb63e, 0xb560, 0xb560,
+	0xb63e, 0xb63e, 0xb63e, 0xb63e, 0xb63e, 0xb63e, 0x080c, 0x0d65,
+	0x6010, 0x00b6, 0x2058, 0xb804, 0x9084, 0x00ff, 0x00be, 0x908a,
+	0x000c, 0x1a0c, 0x0d65, 0x00b6, 0x0013, 0x00be, 0x0005, 0xb65b,
+	0xb728, 0xb65d, 0xb69d, 0xb65d, 0xb69d, 0xb65d, 0xb66b, 0xb65b,
+	0xb69d, 0xb65b, 0xb68c, 0x080c, 0x0d65, 0x6004, 0x908e, 0x0016,
+	0x05c0, 0x908e, 0x0004, 0x05a8, 0x908e, 0x0002, 0x0590, 0x908e,
+	0x0052, 0x0904, 0xb724, 0x6004, 0x080c, 0xba5c, 0x0904, 0xb741,
+	0x908e, 0x0004, 0x1110, 0x080c, 0x303b, 0x908e, 0x0021, 0x0904,
+	0xb745, 0x908e, 0x0022, 0x0904, 0xb789, 0x908e, 0x003d, 0x0904,
+	0xb745, 0x908e, 0x0039, 0x0904, 0xb749, 0x908e, 0x0035, 0x0904,
+	0xb749, 0x908e, 0x001e, 0x0178, 0x908e, 0x0001, 0x1140, 0x6010,
+	0x2058, 0xb804, 0x9084, 0x00ff, 0x9086, 0x0006, 0x0110, 0x080c,
+	0x3006, 0x080c, 0xa58f, 0x0804, 0x9c21, 0x00c6, 0x00d6, 0x6104,
+	0x9186, 0x0016, 0x0904, 0xb715, 0x9186, 0x0002, 0x1904, 0xb6ea,
+	0x2001, 0x1836, 0x2004, 0xd08c, 0x11c8, 0x080c, 0x70b7, 0x11b0,
+	0x080c, 0xbf61, 0x0138, 0x080c, 0x70da, 0x1120, 0x080c, 0x6fc2,
+	0x0804, 0xb772, 0x2001, 0x194e, 0x2003, 0x0001, 0x2001, 0x1800,
+	0x2003, 0x0001, 0x080c, 0x6fe8, 0x0804, 0xb772, 0x6010, 0x2058,
+	0x2001, 0x1836, 0x2004, 0xd0ac, 0x1904, 0xb772, 0xb8a0, 0x9084,
+	0xff80, 0x1904, 0xb772, 0xb840, 0x9084, 0x00ff, 0x9005, 0x0190,
+	0x8001, 0xb842, 0x6017, 0x0000, 0x6023, 0x0007, 0x601b, 0x0398,
+	0x604b, 0x0000, 0x080c, 0x9b91, 0x0128, 0x2b00, 0x6012, 0x6023,
+	0x0001, 0x0458, 0x00de, 0x00ce, 0x6004, 0x908e, 0x0002, 0x11a0,
+	0x6010, 0x2058, 0xb8a0, 0x9086, 0x007e, 0x1170, 0x2009, 0x1836,
+	0x2104, 0xc085, 0x200a, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5c6f,
+	0x00ee, 0x080c, 0xa58f, 0x0030, 0x080c, 0xa58f, 0x080c, 0x3006,
+	0x080c, 0xbf76, 0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x303b,
+	0x012e, 0x00ee, 0x080c, 0x9c21, 0x0005, 0x2001, 0x0002, 0x080c,
+	0x61c1, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x84d8, 0x080c,
+	0x8936, 0x00de, 0x00ce, 0x0c80, 0x080c, 0x303b, 0x0804, 0xb699,
+	0x00c6, 0x00d6, 0x6104, 0x9186, 0x0016, 0x0d38, 0x6010, 0x2058,
+	0xb840, 0x9084, 0x00ff, 0x9005, 0x0904, 0xb6ea, 0x8001, 0xb842,
+	0x6003, 0x0001, 0x080c, 0x84d8, 0x080c, 0x8936, 0x00de, 0x00ce,
+	0x0898, 0x080c, 0xa58f, 0x0804, 0xb69b, 0x080c, 0xa5cb, 0x0804,
+	0xb69b, 0x00d6, 0x2c68, 0x6104, 0x080c, 0xbed9, 0x00de, 0x0118,
+	0x080c, 0x9be7, 0x00f0, 0x6004, 0x8007, 0x6134, 0x918c, 0x00ff,
+	0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023, 0x0002,
+	0x603c, 0x600a, 0x2001, 0x1958, 0x2004, 0x601a, 0x602c, 0x2c08,
+	0x2060, 0x6024, 0xc0b5, 0x6026, 0x2160, 0x2009, 0x8020, 0x080c,
+	0x84d1, 0x0005, 0x00de, 0x00ce, 0x080c, 0xa58f, 0x080c, 0x3006,
+	0x00e6, 0x0126, 0x2091, 0x8000, 0x080c, 0x303b, 0x6017, 0x0000,
+	0x6023, 0x0007, 0x601b, 0x0398, 0x604b, 0x0000, 0x012e, 0x00ee,
+	0x0005, 0x080c, 0xa022, 0x1904, 0xb741, 0x0005, 0x6000, 0x908a,
+	0x0016, 0x1a0c, 0x0d65, 0x0096, 0x00d6, 0x001b, 0x00de, 0x009e,
+	0x0005, 0xb7a9, 0xb7a9, 0xb7a9, 0xb7a9, 0xb7a9, 0xb7a9, 0xb7a9,
+	0xb7a9, 0xb7a9, 0xb565, 0xb7a9, 0xb56a, 0xb7ab, 0xb56a, 0xb7b8,
+	0xb7a9, 0x080c, 0x0d65, 0x6004, 0x9086, 0x008b, 0x0148, 0x6007,
+	0x008b, 0x6003, 0x000d, 0x2009, 0x8020, 0x080c, 0x84d1, 0x0005,
+	0x080c, 0xbf55, 0x0118, 0x080c, 0xbf68, 0x0010, 0x080c, 0xbf76,
+	0x080c, 0xba36, 0x080c, 0xb847, 0x0570, 0x080c, 0x3006, 0x080c,
+	0xb847, 0x0168, 0x6014, 0x2048, 0xa867, 0x0103, 0xa87b, 0x0006,
+	0xa877, 0x0000, 0xa880, 0xc0ed, 0xa882, 0x080c, 0x6996, 0x2c68,
+	0x080c, 0x9b91, 0x0150, 0x6810, 0x6012, 0x080c, 0xbcdb, 0x00c6,
+	0x2d60, 0x080c, 0x9c21, 0x00ce, 0x0008, 0x2d60, 0x6017, 0x0000,
+	0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x84d8,
+	0x080c, 0x8936, 0x00c8, 0x080c, 0xbf55, 0x0138, 0x6034, 0x9086,
+	0x4000, 0x1118, 0x080c, 0x3006, 0x08d0, 0x6034, 0x908c, 0xff00,
+	0x810f, 0x9186, 0x0039, 0x0118, 0x9186, 0x0035, 0x1118, 0x080c,
+	0x3006, 0x0868, 0x080c, 0x9c21, 0x0005, 0x6000, 0x908a, 0x0016,
+	0x1a0c, 0x0d65, 0x0002, 0xb823, 0xb823, 0xb825, 0xb825, 0xb825,
+	0xb823, 0xb823, 0x9c21, 0xb823, 0xb823, 0xb823, 0xb823, 0xb823,
+	0xb823, 0xb823, 0xb823, 0x080c, 0x0d65, 0x080c, 0x98c8, 0x080c,
+	0x9a39, 0x080c, 0x98e4, 0x6114, 0x0096, 0x2148, 0xa87b, 0x0006,
+	0x080c, 0x6996, 0x009e, 0x0804, 0x9be7, 0x9284, 0x0003, 0x1158,
+	0x9282, 0x1ddc, 0x0240, 0x2001, 0x1819, 0x2004, 0x9202, 0x1218,
+	0x9085, 0x0001, 0x0005, 0x9006, 0x0ce8, 0x0096, 0x0028, 0x0096,
+	0x0006, 0x6014, 0x2048, 0x000e, 0x0006, 0x9984, 0xf000, 0x9086,
+	0xf000, 0x0110, 0x080c, 0x10cd, 0x000e, 0x009e, 0x0005, 0x00e6,
+	0x00c6, 0x0036, 0x0006, 0x0126, 0x2091, 0x8000, 0x2061, 0x1ddc,
+	0x2071, 0x1800, 0x7350, 0x7070, 0x9302, 0x1640, 0x6020, 0x9206,
+	0x11f8, 0x080c, 0xbf61, 0x0180, 0x9286, 0x0001, 0x1168, 0x6004,
+	0x9086, 0x0004, 0x1148, 0x080c, 0x3006, 0x080c, 0xbf76, 0x00c6,
+	0x080c, 0x9c21, 0x00ce, 0x0060, 0x080c, 0xbc4d, 0x0148, 0x080c,
+	0xba5c, 0x1110, 0x080c, 0xa58f, 0x00c6, 0x080c, 0x9be7, 0x00ce,
+	0x9ce0, 0x001c, 0x7064, 0x9c02, 0x1208, 0x08a0, 0x012e, 0x000e,
+	0x003e, 0x00ce, 0x00ee, 0x0005, 0x00e6, 0x00c6, 0x0016, 0x9188,
+	0x1000, 0x210c, 0x81ff, 0x0128, 0x2061, 0x1b02, 0x6112, 0x080c,
+	0x3006, 0x9006, 0x0010, 0x9085, 0x0001, 0x001e, 0x00ce, 0x00ee,
+	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9b91, 0x01b0,
+	0x665e, 0x2b00, 0x6012, 0x080c, 0x5395, 0x0118, 0x080c, 0xb978,
+	0x0168, 0x080c, 0xbcdb, 0x6023, 0x0003, 0x2009, 0x004b, 0x080c,
+	0x9c85, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
+	0x00c6, 0x0126, 0x2091, 0x8000, 0xbaa0, 0x080c, 0x9c58, 0x0580,
+	0x605f, 0x0000, 0x2b00, 0x6012, 0x080c, 0xbcdb, 0x6023, 0x0003,
+	0x0016, 0x080c, 0x98c8, 0x080c, 0x863b, 0x0076, 0x903e, 0x080c,
+	0x852a, 0x2c08, 0x080c, 0xcfc8, 0x007e, 0x080c, 0x98e4, 0x001e,
+	0xd184, 0x0128, 0x080c, 0x9be7, 0x9085, 0x0001, 0x0070, 0x080c,
+	0x5395, 0x0128, 0xd18c, 0x1170, 0x080c, 0xb978, 0x0148, 0x2009,
+	0x004c, 0x080c, 0x9c85, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
+	0x9006, 0x0cd8, 0x2900, 0x6016, 0x0c90, 0x2009, 0x004d, 0x0010,
+	0x2009, 0x004e, 0x00f6, 0x00c6, 0x0046, 0x0016, 0x080c, 0x9b91,
+	0x2c78, 0x0590, 0x7e5e, 0x2b00, 0x7812, 0x7823, 0x0003, 0x2021,
+	0x0005, 0x080c, 0xb98a, 0x9186, 0x004d, 0x0118, 0x9186, 0x004e,
+	0x0148, 0x2001, 0x1951, 0x200c, 0xd1fc, 0x0168, 0x2f60, 0x080c,
+	0x9be7, 0x00d0, 0x2001, 0x1950, 0x200c, 0xd1fc, 0x0120, 0x2f60,
+	0x080c, 0x9be7, 0x0088, 0x2f60, 0x080c, 0x5395, 0x0138, 0xd18c,
+	0x1118, 0x04f1, 0x0148, 0x0010, 0x2900, 0x7816, 0x001e, 0x0016,
+	0x080c, 0x9c85, 0x9085, 0x0001, 0x001e, 0x004e, 0x00ce, 0x00fe,
+	0x0005, 0x00f6, 0x00c6, 0x0046, 0x080c, 0x9b91, 0x2c78, 0x0508,
+	0x7e5e, 0x2b00, 0x7812, 0x7823, 0x0003, 0x0096, 0x2021, 0x0004,
+	0x0489, 0x009e, 0x2001, 0x194f, 0x200c, 0xd1fc, 0x0120, 0x2f60,
+	0x080c, 0x9be7, 0x0060, 0x2f60, 0x080c, 0x5395, 0x0120, 0xd18c,
+	0x1160, 0x0071, 0x0130, 0x2009, 0x0052, 0x080c, 0x9c85, 0x9085,
+	0x0001, 0x004e, 0x00ce, 0x00fe, 0x0005, 0x2900, 0x7816, 0x0c98,
+	0x00c6, 0x080c, 0x4878, 0x00ce, 0x1120, 0x080c, 0x9be7, 0x9006,
+	0x0005, 0xa867, 0x0000, 0xa86b, 0x8000, 0x2900, 0x6016, 0x9085,
+	0x0001, 0x0005, 0x0096, 0x0076, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x98c8, 0x080c, 0x644f, 0x0158, 0x2001, 0xb991, 0x0006, 0x900e,
+	0x2400, 0x080c, 0x6bb3, 0x080c, 0x6996, 0x000e, 0x0807, 0x2418,
+	0x080c, 0x883a, 0xbaa0, 0x0086, 0x2041, 0x0001, 0x2039, 0x0001,
+	0x2608, 0x080c, 0x8655, 0x008e, 0x080c, 0x852a, 0x2f08, 0x2648,
+	0x080c, 0xcfc8, 0xb93c, 0x81ff, 0x090c, 0x872c, 0x080c, 0x98e4,
+	0x012e, 0x007e, 0x009e, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x9b91, 0x0190, 0x660a, 0x2b08, 0x6112, 0x080c, 0xbcdb,
+	0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x001f, 0x080c, 0x9c85,
+	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x9c58, 0x01b8, 0x660a, 0x2b08,
+	0x6112, 0x080c, 0xbcdb, 0x6023, 0x0008, 0x2900, 0x6016, 0x00f6,
+	0x2c78, 0x080c, 0x164f, 0x00fe, 0x2009, 0x0021, 0x080c, 0x9c85,
+	0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009,
+	0x003d, 0x00c6, 0x0126, 0x0016, 0x2091, 0x8000, 0x080c, 0x9b91,
+	0x0198, 0x660a, 0x2b08, 0x6112, 0x080c, 0xbcdb, 0x6023, 0x0001,
+	0x2900, 0x6016, 0x001e, 0x0016, 0x080c, 0x9c85, 0x9085, 0x0001,
+	0x001e, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd0, 0x00c6, 0x0126,
+	0x2091, 0x8000, 0x080c, 0x9c58, 0x0188, 0x2b08, 0x6112, 0x080c,
+	0xbcdb, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x0000, 0x080c,
+	0x9c85, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8,
+	0x2009, 0x0044, 0x0830, 0x2009, 0x0049, 0x0818, 0x0026, 0x00b6,
+	0x6210, 0x2258, 0xba3c, 0x82ff, 0x0118, 0x8211, 0xba3e, 0x1140,
+	0xb8c0, 0x9005, 0x0128, 0xb888, 0x9005, 0x1110, 0xb88b, 0x0001,
+	0x00be, 0x002e, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e, 0x0002,
+	0x0140, 0x908e, 0x0003, 0x0128, 0x908e, 0x0004, 0x0110, 0x9085,
+	0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0096, 0x6020, 0x9086,
+	0x0004, 0x0190, 0x6014, 0x904d, 0x080c, 0xb847, 0x0168, 0xa864,
+	0x9086, 0x0139, 0x0158, 0x6020, 0x9086, 0x0003, 0x0128, 0xa868,
+	0xd0fc, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x009e, 0x000e,
+	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9c58, 0x0198,
+	0x2b08, 0x6112, 0x080c, 0xbcdb, 0x6023, 0x0001, 0x2900, 0x6016,
+	0x080c, 0x3006, 0x2009, 0x0028, 0x080c, 0x9c85, 0x9085, 0x0001,
+	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x9186, 0x0015, 0x11a8,
+	0x2011, 0x1823, 0x2204, 0x9086, 0x0074, 0x1178, 0x00b6, 0x080c,
+	0xa818, 0x00be, 0x080c, 0xaa57, 0x6003, 0x0001, 0x6007, 0x0029,
+	0x080c, 0x84d8, 0x080c, 0x8936, 0x0078, 0x6014, 0x0096, 0x2048,
+	0xa868, 0x009e, 0xd0fc, 0x0148, 0x2001, 0x0001, 0x080c, 0xbe9a,
+	0x080c, 0xa58f, 0x080c, 0x9be7, 0x0005, 0x0096, 0x6014, 0x904d,
+	0x090c, 0x0d65, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005,
+	0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6996, 0x012e, 0x009e, 0x080c, 0x9be7, 0x0c30, 0x0096, 0x9186,
+	0x0016, 0x1128, 0x2001, 0x0004, 0x080c, 0x61c1, 0x00e8, 0x9186,
+	0x0015, 0x1510, 0x2011, 0x1823, 0x2204, 0x9086, 0x0014, 0x11e0,
+	0x6010, 0x00b6, 0x2058, 0x080c, 0x630b, 0x00be, 0x080c, 0xab28,
+	0x1198, 0x6010, 0x00b6, 0x2058, 0xb890, 0x00be, 0x9005, 0x0160,
+	0x2001, 0x0006, 0x080c, 0x61c1, 0x6014, 0x2048, 0xa868, 0xd0fc,
+	0x0170, 0x080c, 0x9ff6, 0x0048, 0x6014, 0x2048, 0xa868, 0xd0fc,
+	0x0528, 0x080c, 0xa58f, 0x080c, 0x9be7, 0x009e, 0x0005, 0x6014,
+	0x6310, 0x2358, 0x904d, 0x090c, 0x0d65, 0xa87b, 0x0000, 0xa883,
+	0x0000, 0xa897, 0x4000, 0x900e, 0x080c, 0x655f, 0x1108, 0xc185,
+	0xb800, 0xd0bc, 0x0108, 0xc18d, 0xa99a, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x6996, 0x012e, 0x080c, 0x9be7, 0x08f8, 0x6014, 0x904d,
+	0x090c, 0x0d65, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897, 0x4005,
+	0xa89b, 0x0004, 0xa867, 0x0139, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6996, 0x012e, 0x080c, 0x9be7, 0x0840, 0xa878, 0x9086, 0x0005,
+	0x1108, 0x0009, 0x0005, 0xa880, 0xc0ad, 0xa882, 0x0005, 0x604b,
+	0x0000, 0x6017, 0x0000, 0x6003, 0x0001, 0x6007, 0x0050, 0x2009,
+	0x8023, 0x080c, 0x84d1, 0x0005, 0x00c6, 0x6010, 0x00b6, 0x2058,
+	0xb800, 0x00be, 0xd0bc, 0x0130, 0x0066, 0x6020, 0x9084, 0x000f,
+	0x001b, 0x006e, 0x00ce, 0x0005, 0xb565, 0xbb7e, 0xbb7e, 0xbb81,
+	0xd2c2, 0xd2dd, 0xd2e0, 0xb565, 0xb565, 0xb565, 0xb565, 0xb565,
+	0xb565, 0xb565, 0xb565, 0xb565, 0x080c, 0x0d65, 0xa001, 0xa001,
+	0x0005, 0x0096, 0x6014, 0x904d, 0x0118, 0xa87c, 0xd0e4, 0x1110,
+	0x009e, 0x0010, 0x009e, 0x0005, 0x6010, 0x00b6, 0x2058, 0xb800,
+	0x00be, 0xd0bc, 0x0550, 0x2001, 0x1833, 0x2004, 0x9005, 0x1540,
+	0x00f6, 0x2c78, 0x080c, 0x9b91, 0x0508, 0x7810, 0x6012, 0x080c,
+	0xbcdb, 0x7820, 0x9086, 0x0003, 0x0128, 0x7808, 0x603a, 0x2f00,
+	0x603e, 0x0020, 0x7808, 0x603e, 0x2f00, 0x603a, 0x602e, 0x6023,
+	0x0001, 0x6007, 0x0035, 0x6003, 0x0001, 0x795c, 0x615e, 0x2009,
+	0x8020, 0x080c, 0x84d1, 0x2f60, 0x00fe, 0x0005, 0x2f60, 0x00fe,
+	0x2001, 0x1959, 0x2004, 0x604a, 0x0005, 0x0016, 0x0096, 0x6814,
+	0x2048, 0x681c, 0xd0fc, 0xc0fc, 0x681e, 0xa87c, 0x1108, 0xd0e4,
+	0x0180, 0xc0e4, 0xa87e, 0xa877, 0x0000, 0xa893, 0x0000, 0xa88f,
+	0x0000, 0xd0cc, 0x0130, 0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c,
+	0x0fd4, 0x6830, 0x6036, 0x908e, 0x0001, 0x0148, 0x6803, 0x0002,
+	0x9086, 0x0005, 0x0170, 0x9006, 0x602e, 0x6032, 0x00d0, 0x681c,
+	0xc085, 0x681e, 0x6803, 0x0004, 0x6824, 0xc0f4, 0x9085, 0x0c00,
+	0x6826, 0x6814, 0x2048, 0xa8ac, 0x6938, 0x9102, 0xa8b0, 0x693c,
+	0x9103, 0x1e48, 0x683c, 0x602e, 0x6838, 0x9084, 0xfffc, 0x683a,
+	0x6032, 0x2d00, 0x603a, 0x6808, 0x603e, 0x6910, 0x6112, 0x695c,
+	0x615e, 0x6023, 0x0001, 0x6007, 0x0039, 0x6003, 0x0001, 0x2009,
+	0x8020, 0x080c, 0x84d1, 0x009e, 0x001e, 0x0005, 0x6024, 0xd0d4,
+	0x0510, 0xd0f4, 0x11f8, 0x6038, 0x940a, 0x603c, 0x9303, 0x0230,
+	0x9105, 0x0120, 0x6024, 0xc0d4, 0xc0f5, 0x0098, 0x643a, 0x633e,
+	0xac3e, 0xab42, 0x0046, 0x0036, 0x2400, 0xacac, 0x9402, 0xa836,
+	0x2300, 0xabb0, 0x9303, 0xa83a, 0x003e, 0x004e, 0x6024, 0xc0d4,
+	0x0000, 0x6026, 0x0005, 0xd0f4, 0x1138, 0xa83c, 0x603a, 0xa840,
+	0x603e, 0x6024, 0xc0f5, 0x6026, 0x0005, 0x0006, 0x0016, 0x6004,
+	0x908e, 0x0034, 0x01b8, 0x908e, 0x0035, 0x01a0, 0x908e, 0x0036,
+	0x0188, 0x908e, 0x0037, 0x0170, 0x908e, 0x0038, 0x0158, 0x908e,
+	0x0039, 0x0140, 0x908e, 0x003a, 0x0128, 0x908e, 0x003b, 0x0110,
+	0x9085, 0x0001, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026,
+	0x0036, 0x00e6, 0x2001, 0x1953, 0x200c, 0x8000, 0x2014, 0x2001,
+	0x0032, 0x080c, 0x8419, 0x2001, 0x1957, 0x82ff, 0x1110, 0x2011,
+	0x0014, 0x2202, 0x2001, 0x1955, 0x200c, 0x8000, 0x2014, 0x2071,
+	0x193d, 0x711a, 0x721e, 0x2001, 0x0064, 0x080c, 0x8419, 0x2001,
+	0x1958, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001, 0x1959,
+	0x9288, 0x000a, 0x2102, 0x2001, 0x0017, 0x080c, 0x98b9, 0x2001,
+	0x1a59, 0x2102, 0x2001, 0x0032, 0x080c, 0x159e, 0x080c, 0x6648,
+	0x00ee, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016,
+	0x00e6, 0x2001, 0x1957, 0x2003, 0x0028, 0x2001, 0x1958, 0x2003,
+	0x0014, 0x2071, 0x193d, 0x701b, 0x0000, 0x701f, 0x07d0, 0x2001,
+	0x1959, 0x2009, 0x001e, 0x2102, 0x2001, 0x0017, 0x080c, 0x98b9,
+	0x2001, 0x1a59, 0x2102, 0x2001, 0x0032, 0x080c, 0x159e, 0x00ee,
+	0x001e, 0x000e, 0x0005, 0x0096, 0x6060, 0x904d, 0x0110, 0x080c,
+	0x1054, 0x009e, 0x0005, 0x0005, 0x00c6, 0x0126, 0x2091, 0x8000,
+	0x080c, 0x9b91, 0x0180, 0x2b08, 0x6112, 0x0ca9, 0x6023, 0x0001,
+	0x2900, 0x6016, 0x2009, 0x0033, 0x080c, 0x9c85, 0x9085, 0x0001,
+	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x0096, 0x00e6, 0x00f6,
+	0x2071, 0x1800, 0x9186, 0x0015, 0x1500, 0x708c, 0x9086, 0x0018,
+	0x11e0, 0x6014, 0x2048, 0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c,
+	0x89f5, 0x01d8, 0x7078, 0xaa50, 0x9206, 0x1160, 0x707c, 0xaa54,
+	0x9206, 0x1140, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e,
+	0x080c, 0x305b, 0x080c, 0x9ff6, 0x0020, 0x080c, 0xa58f, 0x080c,
+	0x9be7, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c, 0xaa54, 0x9206,
+	0x0d48, 0x0c80, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9b91,
+	0x0188, 0x2b08, 0x6112, 0x080c, 0xbcdb, 0x6023, 0x0001, 0x2900,
+	0x6016, 0x2009, 0x004d, 0x080c, 0x9c85, 0x9085, 0x0001, 0x012e,
 	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000,
-	0x080c, 0x9c3d, 0x01b8, 0x660a, 0x2b08, 0x6112, 0x080c, 0xbcc0,
-	0x6023, 0x0008, 0x2900, 0x6016, 0x00f6, 0x2c78, 0x080c, 0x164f,
-	0x00fe, 0x2009, 0x0021, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x012e,
-	0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x003d, 0x00c6, 0x0126,
-	0x0016, 0x2091, 0x8000, 0x080c, 0x9b76, 0x0198, 0x660a, 0x2b08,
-	0x6112, 0x080c, 0xbcc0, 0x6023, 0x0001, 0x2900, 0x6016, 0x001e,
-	0x0016, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x001e, 0x012e, 0x00ce,
-	0x0005, 0x9006, 0x0cd0, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c,
-	0x9c3d, 0x0188, 0x2b08, 0x6112, 0x080c, 0xbcc0, 0x6023, 0x0001,
-	0x2900, 0x6016, 0x2009, 0x0000, 0x080c, 0x9c6a, 0x9085, 0x0001,
-	0x012e, 0x00ce, 0x0005, 0x9006, 0x0cd8, 0x2009, 0x0044, 0x0830,
-	0x2009, 0x0049, 0x0818, 0x0026, 0x00b6, 0x6210, 0x2258, 0xba3c,
-	0x82ff, 0x0118, 0x8211, 0xba3e, 0x1140, 0xb8c0, 0x9005, 0x0128,
-	0xb888, 0x9005, 0x1110, 0xb88b, 0x0001, 0x00be, 0x002e, 0x0005,
-	0x0006, 0x0016, 0x6004, 0x908e, 0x0002, 0x0140, 0x908e, 0x0003,
-	0x0128, 0x908e, 0x0004, 0x0110, 0x9085, 0x0001, 0x001e, 0x000e,
-	0x0005, 0x0006, 0x0096, 0x6020, 0x9086, 0x0004, 0x0190, 0x6014,
-	0x904d, 0x080c, 0xb82c, 0x0168, 0xa864, 0x9086, 0x0139, 0x0158,
-	0x6020, 0x9086, 0x0003, 0x0128, 0xa868, 0xd0fc, 0x0110, 0x9006,
-	0x0010, 0x9085, 0x0001, 0x009e, 0x000e, 0x0005, 0x00c6, 0x0126,
-	0x2091, 0x8000, 0x080c, 0x9c3d, 0x0198, 0x2b08, 0x6112, 0x080c,
-	0xbcc0, 0x6023, 0x0001, 0x2900, 0x6016, 0x080c, 0x3003, 0x2009,
-	0x0028, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-	0x9006, 0x0cd8, 0x9186, 0x0015, 0x11a8, 0x2011, 0x1823, 0x2204,
-	0x9086, 0x0074, 0x1178, 0x00b6, 0x080c, 0xa7fd, 0x00be, 0x080c,
-	0xaa3c, 0x6003, 0x0001, 0x6007, 0x0029, 0x080c, 0x84b0, 0x080c,
-	0x890e, 0x0078, 0x6014, 0x0096, 0x2048, 0xa868, 0x009e, 0xd0fc,
-	0x0148, 0x2001, 0x0001, 0x080c, 0xbe7f, 0x080c, 0xa574, 0x080c,
-	0x9bcc, 0x0005, 0x0096, 0x6014, 0x904d, 0x090c, 0x0d65, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867,
-	0x0139, 0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e, 0x009e,
-	0x080c, 0x9bcc, 0x0c30, 0x0096, 0x9186, 0x0016, 0x1128, 0x2001,
-	0x0004, 0x080c, 0x61ba, 0x00e8, 0x9186, 0x0015, 0x1510, 0x2011,
-	0x1823, 0x2204, 0x9086, 0x0014, 0x11e0, 0x6010, 0x00b6, 0x2058,
-	0x080c, 0x6304, 0x00be, 0x080c, 0xab0d, 0x1198, 0x6010, 0x00b6,
-	0x2058, 0xb890, 0x00be, 0x9005, 0x0160, 0x2001, 0x0006, 0x080c,
-	0x61ba, 0x6014, 0x2048, 0xa868, 0xd0fc, 0x0170, 0x080c, 0x9fdb,
-	0x0048, 0x6014, 0x2048, 0xa868, 0xd0fc, 0x0528, 0x080c, 0xa574,
-	0x080c, 0x9bcc, 0x009e, 0x0005, 0x6014, 0x6310, 0x2358, 0x904d,
-	0x090c, 0x0d65, 0xa87b, 0x0000, 0xa883, 0x0000, 0xa897, 0x4000,
-	0x900e, 0x080c, 0x6558, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108,
-	0xc18d, 0xa99a, 0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e,
-	0x080c, 0x9bcc, 0x08f8, 0x6014, 0x904d, 0x090c, 0x0d65, 0xa87b,
-	0x0030, 0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0xa867,
-	0x0139, 0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e, 0x080c,
-	0x9bcc, 0x0840, 0xa878, 0x9086, 0x0005, 0x1108, 0x0009, 0x0005,
-	0xa880, 0xc0ad, 0xa882, 0x0005, 0x604b, 0x0000, 0x6017, 0x0000,
-	0x6003, 0x0001, 0x6007, 0x0050, 0x2009, 0x8023, 0x080c, 0x84a9,
-	0x0005, 0x00c6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc,
-	0x0130, 0x0066, 0x6020, 0x9084, 0x000f, 0x001b, 0x006e, 0x00ce,
-	0x0005, 0xb54a, 0xbb63, 0xbb63, 0xbb66, 0xd2a0, 0xd2bb, 0xd2be,
-	0xb54a, 0xb54a, 0xb54a, 0xb54a, 0xb54a, 0xb54a, 0xb54a, 0xb54a,
-	0xb54a, 0x080c, 0x0d65, 0xa001, 0xa001, 0x0005, 0x0096, 0x6014,
-	0x904d, 0x0118, 0xa87c, 0xd0e4, 0x1110, 0x009e, 0x0010, 0x009e,
-	0x0005, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0550,
-	0x2001, 0x1833, 0x2004, 0x9005, 0x1540, 0x00f6, 0x2c78, 0x080c,
-	0x9b76, 0x0508, 0x7810, 0x6012, 0x080c, 0xbcc0, 0x7820, 0x9086,
-	0x0003, 0x0128, 0x7808, 0x603a, 0x2f00, 0x603e, 0x0020, 0x7808,
-	0x603e, 0x2f00, 0x603a, 0x602e, 0x6023, 0x0001, 0x6007, 0x0035,
-	0x6003, 0x0001, 0x795c, 0x615e, 0x2009, 0x8020, 0x080c, 0x84a9,
-	0x2f60, 0x00fe, 0x0005, 0x2f60, 0x00fe, 0x2001, 0x1959, 0x2004,
-	0x604a, 0x0005, 0x0016, 0x0096, 0x6814, 0x2048, 0x681c, 0xd0fc,
-	0xc0fc, 0x681e, 0xa87c, 0x1108, 0xd0e4, 0x0180, 0xc0e4, 0xa87e,
-	0xa877, 0x0000, 0xa893, 0x0000, 0xa88f, 0x0000, 0xd0cc, 0x0130,
-	0xc0cc, 0xa87e, 0xa878, 0x2048, 0x080c, 0x0fd4, 0x6830, 0x6036,
-	0x908e, 0x0001, 0x0148, 0x6803, 0x0002, 0x9086, 0x0005, 0x0170,
-	0x9006, 0x602e, 0x6032, 0x00d0, 0x681c, 0xc085, 0x681e, 0x6803,
-	0x0004, 0x6824, 0xc0f4, 0x9085, 0x0c00, 0x6826, 0x6814, 0x2048,
-	0xa8ac, 0x6938, 0x9102, 0xa8b0, 0x693c, 0x9103, 0x1e48, 0x683c,
-	0x602e, 0x6838, 0x9084, 0xfffc, 0x683a, 0x6032, 0x2d00, 0x603a,
-	0x6808, 0x603e, 0x6910, 0x6112, 0x695c, 0x615e, 0x6023, 0x0001,
-	0x6007, 0x0039, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x84a9,
-	0x009e, 0x001e, 0x0005, 0x6024, 0xd0d4, 0x0510, 0xd0f4, 0x11f8,
-	0x6038, 0x940a, 0x603c, 0x9303, 0x0230, 0x9105, 0x0120, 0x6024,
-	0xc0d4, 0xc0f5, 0x0098, 0x643a, 0x633e, 0xac3e, 0xab42, 0x0046,
-	0x0036, 0x2400, 0xacac, 0x9402, 0xa836, 0x2300, 0xabb0, 0x9303,
-	0xa83a, 0x003e, 0x004e, 0x6024, 0xc0d4, 0x0000, 0x6026, 0x0005,
-	0xd0f4, 0x1138, 0xa83c, 0x603a, 0xa840, 0x603e, 0x6024, 0xc0f5,
-	0x6026, 0x0005, 0x0006, 0x0016, 0x6004, 0x908e, 0x0034, 0x01b8,
-	0x908e, 0x0035, 0x01a0, 0x908e, 0x0036, 0x0188, 0x908e, 0x0037,
-	0x0170, 0x908e, 0x0038, 0x0158, 0x908e, 0x0039, 0x0140, 0x908e,
-	0x003a, 0x0128, 0x908e, 0x003b, 0x0110, 0x9085, 0x0001, 0x001e,
-	0x000e, 0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00e6, 0x2001,
-	0x1953, 0x200c, 0x8000, 0x2014, 0x2001, 0x0032, 0x080c, 0x83f1,
-	0x2001, 0x1957, 0x82ff, 0x1110, 0x2011, 0x0014, 0x2202, 0x2001,
-	0x1955, 0x200c, 0x8000, 0x2014, 0x2071, 0x193d, 0x711a, 0x721e,
-	0x2001, 0x0064, 0x080c, 0x83f1, 0x2001, 0x1958, 0x82ff, 0x1110,
-	0x2011, 0x0014, 0x2202, 0x2001, 0x1959, 0x9288, 0x000a, 0x2102,
-	0x2001, 0x0017, 0x080c, 0x989e, 0x2001, 0x1a59, 0x2102, 0x2001,
-	0x0032, 0x080c, 0x159e, 0x080c, 0x6641, 0x00ee, 0x003e, 0x002e,
-	0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x00e6, 0x2001, 0x1957,
-	0x2003, 0x0028, 0x2001, 0x1958, 0x2003, 0x0014, 0x2071, 0x193d,
-	0x701b, 0x0000, 0x701f, 0x07d0, 0x2001, 0x1959, 0x2009, 0x001e,
-	0x2102, 0x2001, 0x0017, 0x080c, 0x989e, 0x2001, 0x1a59, 0x2102,
-	0x2001, 0x0032, 0x080c, 0x159e, 0x00ee, 0x001e, 0x000e, 0x0005,
-	0x0096, 0x6060, 0x904d, 0x0110, 0x080c, 0x1054, 0x009e, 0x0005,
-	0x0005, 0x00c6, 0x0126, 0x2091, 0x8000, 0x080c, 0x9b76, 0x0180,
-	0x2b08, 0x6112, 0x0ca9, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009,
-	0x0033, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005,
-	0x9006, 0x0cd8, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186,
-	0x0015, 0x1500, 0x708c, 0x9086, 0x0018, 0x11e0, 0x6014, 0x2048,
-	0xaa3c, 0xd2e4, 0x1160, 0x2c78, 0x080c, 0x89cd, 0x01d8, 0x7078,
-	0xaa50, 0x9206, 0x1160, 0x707c, 0xaa54, 0x9206, 0x1140, 0x6210,
-	0x00b6, 0x2258, 0xbaa0, 0x00be, 0x900e, 0x080c, 0x3054, 0x080c,
-	0x9fdb, 0x0020, 0x080c, 0xa574, 0x080c, 0x9bcc, 0x00fe, 0x00ee,
-	0x009e, 0x0005, 0x705c, 0xaa54, 0x9206, 0x0d48, 0x0c80, 0x00c6,
-	0x0126, 0x2091, 0x8000, 0x080c, 0x9b76, 0x0188, 0x2b08, 0x6112,
-	0x080c, 0xbcc0, 0x6023, 0x0001, 0x2900, 0x6016, 0x2009, 0x004d,
-	0x080c, 0x9c6a, 0x9085, 0x0001, 0x012e, 0x00ce, 0x0005, 0x9006,
-	0x0cd8, 0x00c6, 0x0126, 0x2091, 0x8000, 0x0016, 0x080c, 0x9b76,
-	0x0180, 0x2b08, 0x6112, 0x080c, 0xbcc0, 0x6023, 0x0001, 0x2900,
-	0x6016, 0x001e, 0x080c, 0x9c6a, 0x9085, 0x0001, 0x012e, 0x00ce,
-	0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016, 0x0026, 0x0036, 0x0046,
-	0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186,
-	0x0015, 0x1568, 0x718c, 0x6014, 0x2048, 0xa814, 0x8003, 0x9106,
-	0x1530, 0x20e1, 0x0000, 0x2001, 0x1971, 0x2003, 0x0000, 0x6014,
-	0x2048, 0xa830, 0x20a8, 0x8906, 0x8006, 0x8007, 0x9094, 0x003f,
-	0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b, 0x20a0, 0x2001, 0x1971,
-	0x0016, 0x200c, 0x080c, 0xc529, 0x001e, 0xa804, 0x9005, 0x0110,
-	0x2048, 0x0c38, 0x6014, 0x2048, 0xa867, 0x0103, 0x0010, 0x080c,
-	0xa574, 0x080c, 0x9bcc, 0x00fe, 0x00ee, 0x009e, 0x006e, 0x005e,
-	0x004e, 0x003e, 0x002e, 0x001e, 0x0005, 0x0096, 0x00e6, 0x00f6,
-	0x2071, 0x1800, 0x9186, 0x0015, 0x11b8, 0x708c, 0x9086, 0x0004,
-	0x1198, 0x6014, 0x2048, 0x2c78, 0x080c, 0x89cd, 0x01a8, 0x7078,
-	0xaa74, 0x9206, 0x1130, 0x707c, 0xaa78, 0x9206, 0x1110, 0x080c,
-	0x3003, 0x080c, 0x9fdb, 0x0020, 0x080c, 0xa574, 0x080c, 0x9bcc,
-	0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c, 0xaa78, 0x9206, 0x0d78,
-	0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015,
-	0x1550, 0x708c, 0x9086, 0x0004, 0x1530, 0x6014, 0x2048, 0x2c78,
-	0x080c, 0x89cd, 0x05f0, 0x7078, 0xaacc, 0x9206, 0x1180, 0x707c,
-	0xaad0, 0x9206, 0x1160, 0x080c, 0x3003, 0x0016, 0xa998, 0xaab0,
-	0x9284, 0x1000, 0xc0fd, 0x080c, 0x533e, 0x001e, 0x0010, 0x080c,
-	0x5127, 0x080c, 0xb82c, 0x0508, 0xa87b, 0x0000, 0xa883, 0x0000,
-	0xa897, 0x4000, 0x0080, 0x080c, 0xb82c, 0x01b8, 0x6014, 0x2048,
-	0x080c, 0x5127, 0x1d70, 0xa87b, 0x0030, 0xa883, 0x0000, 0xa897,
-	0x4005, 0xa89b, 0x0004, 0x0126, 0x2091, 0x8000, 0xa867, 0x0139,
-	0x080c, 0x698f, 0x012e, 0x080c, 0x9bcc, 0x00fe, 0x00ee, 0x009e,
-	0x0005, 0x705c, 0xaad0, 0x9206, 0x0930, 0x0888, 0x0016, 0x0026,
-	0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34, 0x2100, 0x9205, 0x0150,
-	0xa890, 0x9106, 0x1118, 0xa88c, 0x9206, 0x0120, 0xa992, 0xaa8e,
-	0x9085, 0x0001, 0x002e, 0x001e, 0x0005, 0x00b6, 0x00d6, 0x0036,
-	0x080c, 0xb82c, 0x0904, 0xbe7b, 0x0096, 0x6314, 0x2348, 0xa87a,
-	0xa982, 0x929e, 0x4000, 0x1580, 0x6310, 0x00c6, 0x2358, 0x2009,
-	0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c, 0x6558, 0x1108, 0xc185,
-	0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96, 0xa99a, 0x20a9, 0x0004,
-	0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031, 0x20a0, 0xb8b4, 0x20e0,
-	0xb8b8, 0x9080, 0x0006, 0x2098, 0x080c, 0x0f9f, 0x20a9, 0x0004,
-	0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8b8, 0x9080, 0x000a, 0x2098,
-	0x080c, 0x0f9f, 0x00ce, 0x0090, 0xaa96, 0x3918, 0x9398, 0x0007,
-	0x231c, 0x6004, 0x9086, 0x0016, 0x0110, 0xa89b, 0x0004, 0xaba2,
-	0x6310, 0x2358, 0xb804, 0x9084, 0x00ff, 0xa89e, 0x080c, 0x6983,
-	0x6017, 0x0000, 0x009e, 0x003e, 0x00de, 0x00be, 0x0005, 0x0026,
-	0x0036, 0x0046, 0x00b6, 0x0096, 0x00f6, 0x6214, 0x2248, 0x6210,
-	0x2258, 0x2079, 0x0260, 0x9096, 0x0000, 0x11a0, 0xb814, 0x9084,
-	0x00ff, 0x900e, 0x080c, 0x2424, 0x2118, 0x831f, 0x939c, 0xff00,
-	0x7838, 0x9084, 0x00ff, 0x931d, 0x7c3c, 0x2011, 0x8018, 0x080c,
-	0x48d1, 0x00a8, 0x9096, 0x0001, 0x1148, 0x89ff, 0x0180, 0xa89b,
-	0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x0048, 0x9096, 0x0002,
-	0x1130, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa, 0x00fe,
-	0x009e, 0x00be, 0x004e, 0x003e, 0x002e, 0x0005, 0x00c6, 0x0026,
-	0x0016, 0x9186, 0x0035, 0x0110, 0x6a38, 0x0008, 0x6a2c, 0x080c,
-	0xb81a, 0x01f0, 0x2260, 0x6120, 0x9186, 0x0003, 0x0118, 0x9186,
-	0x0006, 0x1190, 0x6838, 0x9206, 0x0140, 0x683c, 0x9206, 0x1160,
-	0x6108, 0x6838, 0x9106, 0x1140, 0x0020, 0x6008, 0x693c, 0x9106,
-	0x1118, 0x6010, 0x6910, 0x9106, 0x001e, 0x002e, 0x00ce, 0x0005,
-	0x9085, 0x0001, 0x0cc8, 0xa974, 0xd1cc, 0x0188, 0x918c, 0x00ff,
-	0x918e, 0x0002, 0x1160, 0xa9a8, 0x918c, 0x0f00, 0x810f, 0x918e,
-	0x0001, 0x1128, 0xa834, 0xa938, 0x9115, 0x190c, 0xaea7, 0x0005,
-	0x0036, 0x2019, 0x0001, 0x0010, 0x0036, 0x901e, 0x0499, 0x01e0,
-	0x080c, 0xb82c, 0x01c8, 0x080c, 0xba1b, 0x6037, 0x4000, 0x6014,
-	0x6017, 0x0000, 0x0096, 0x2048, 0xa87c, 0x080c, 0xba41, 0x1118,
-	0x080c, 0xa574, 0x0040, 0xa867, 0x0103, 0xa877, 0x0000, 0x83ff,
-	0x1129, 0x080c, 0x698f, 0x009e, 0x003e, 0x0005, 0xa880, 0xd0b4,
-	0x0128, 0xa87b, 0x0006, 0xc0ec, 0xa882, 0x0048, 0xd0bc, 0x0118,
-	0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005, 0x080c, 0xbb30, 0xa877,
-	0x0000, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0ec, 0x0005, 0x0006,
-	0x2001, 0x1810, 0x2004, 0xd0f4, 0x000e, 0x0005, 0x0006, 0x2001,
-	0x1810, 0x2004, 0xd0e4, 0x000e, 0x0005, 0x0036, 0x0046, 0x6010,
-	0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0007, 0x080c, 0x4a6e,
-	0x004e, 0x003e, 0x0005, 0x0c51, 0x1d81, 0x0005, 0x2001, 0x1957,
-	0x2004, 0x601a, 0x0005, 0x2001, 0x1959, 0x2004, 0x604a, 0x0005,
-	0x080c, 0x9bcc, 0x0804, 0x890e, 0x611c, 0xd1fc, 0xa97c, 0x1108,
-	0xd1e4, 0x0005, 0x601c, 0xd0fc, 0xa87c, 0x1108, 0xd0e4, 0x0005,
-	0x601c, 0xd0fc, 0xc0fc, 0x601e, 0xa87c, 0x1108, 0xd0e4, 0x0005,
-	0x6044, 0xd0fc, 0x0160, 0xd0dc, 0x1128, 0x908c, 0x000f, 0x9186,
-	0x0005, 0x1118, 0x6003, 0x0003, 0x0010, 0x6003, 0x0001, 0x0005,
-	0x00b6, 0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d65, 0x001b,
-	0x006e, 0x00be, 0x0005, 0xbfab, 0xc684, 0xc7d3, 0xbfab, 0xbfab,
-	0xbfab, 0xbfab, 0xbfab, 0xbfe2, 0xc851, 0xbfab, 0xbfab, 0xbfab,
-	0xbfab, 0xbfab, 0xbfab, 0x080c, 0x0d65, 0x0066, 0x6000, 0x90b2,
-	0x0016, 0x1a0c, 0x0d65, 0x0013, 0x006e, 0x0005, 0xbfc6, 0xcd68,
-	0xbfc6, 0xbfc6, 0xbfc6, 0xbfc6, 0xbfc6, 0xbfc6, 0xcd17, 0xcdba,
-	0xbfc6, 0xd3db, 0xd40f, 0xd3db, 0xd40f, 0xbfc6, 0x080c, 0x0d65,
-	0x6000, 0x9082, 0x0016, 0x1a0c, 0x0d65, 0x6000, 0x000a, 0x0005,
-	0xbfe0, 0xca2d, 0xcaf6, 0xcb18, 0xcb93, 0xbfe0, 0xcc8d, 0xcc1b,
-	0xc85b, 0xccef, 0xcd04, 0xbfe0, 0xbfe0, 0xbfe0, 0xbfe0, 0xbfe0,
-	0x080c, 0x0d65, 0x91b2, 0x0053, 0x1a0c, 0x0d65, 0x2100, 0x91b2,
-	0x0040, 0x1a04, 0xc427, 0x0002, 0xc02c, 0xc218, 0xc02c, 0xc02c,
-	0xc02c, 0xc221, 0xc02c, 0xc02c, 0xc02c, 0xc02c, 0xc02c, 0xc02c,
-	0xc02c, 0xc02c, 0xc02c, 0xc02c, 0xc02c, 0xc02c, 0xc02c, 0xc02c,
-	0xc02c, 0xc02c, 0xc02c, 0xc02e, 0xc095, 0xc0a4, 0xc108, 0xc133,
-	0xc1ab, 0xc203, 0xc02c, 0xc02c, 0xc224, 0xc02c, 0xc02c, 0xc239,
-	0xc246, 0xc02c, 0xc02c, 0xc02c, 0xc02c, 0xc02c, 0xc2c9, 0xc02c,
-	0xc02c, 0xc2dd, 0xc02c, 0xc02c, 0xc298, 0xc02c, 0xc02c, 0xc02c,
-	0xc2f5, 0xc02c, 0xc02c, 0xc02c, 0xc372, 0xc02c, 0xc02c, 0xc02c,
-	0xc02c, 0xc02c, 0xc02c, 0xc3ef, 0x080c, 0x0d65, 0x080c, 0x661e,
-	0x1150, 0x2001, 0x1836, 0x2004, 0xd0cc, 0x1128, 0x9084, 0x0009,
-	0x9086, 0x0008, 0x1140, 0x6007, 0x0009, 0x602f, 0x0009, 0x6017,
-	0x0000, 0x0804, 0xc211, 0x080c, 0x6607, 0x00e6, 0x00c6, 0x0036,
-	0x0026, 0x0016, 0x6210, 0x2258, 0xbaa0, 0x0026, 0x2019, 0x0029,
-	0x080c, 0x98ad, 0x080c, 0x8613, 0x0076, 0x903e, 0x080c, 0x8502,
-	0x2c08, 0x080c, 0xcfa6, 0x007e, 0x001e, 0x080c, 0x98c9, 0x001e,
-	0x002e, 0x003e, 0x00ce, 0x00ee, 0x6610, 0x2658, 0x080c, 0x6278,
-	0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1268, 0x0016, 0x0026,
-	0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be, 0x2c08, 0x080c, 0xd587,
-	0x002e, 0x001e, 0x1178, 0x080c, 0xced5, 0x1904, 0xc100, 0x080c,
-	0xce71, 0x1120, 0x6007, 0x0008, 0x0804, 0xc211, 0x6007, 0x0009,
-	0x0804, 0xc211, 0x080c, 0xd0dc, 0x0128, 0x080c, 0xced5, 0x0d78,
-	0x0804, 0xc100, 0x6017, 0x1900, 0x0c88, 0x080c, 0x3149, 0x1904,
-	0xc424, 0x6106, 0x080c, 0xce24, 0x6007, 0x0006, 0x0804, 0xc211,
-	0x6007, 0x0007, 0x0804, 0xc211, 0x080c, 0xd44b, 0x1904, 0xc424,
-	0x080c, 0x3149, 0x1904, 0xc424, 0x00d6, 0x6610, 0x2658, 0xbe04,
-	0x9684, 0x00ff, 0x9082, 0x0006, 0x1220, 0x2001, 0x0001, 0x080c,
-	0x61a6, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0188, 0x9686,
-	0x0004, 0x0170, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0140,
-	0x9686, 0x0004, 0x0128, 0x9686, 0x0005, 0x0110, 0x00de, 0x0480,
-	0x00e6, 0x2071, 0x0260, 0x7034, 0x9084, 0x0003, 0x1140, 0x7034,
-	0x9082, 0x0014, 0x0220, 0x7030, 0x9084, 0x0003, 0x0130, 0x00ee,
-	0x6017, 0x0000, 0x602f, 0x0007, 0x00b0, 0x00ee, 0x080c, 0xcf3c,
-	0x1190, 0x9686, 0x0006, 0x1140, 0x0026, 0x6210, 0x2258, 0xbaa0,
-	0x900e, 0x080c, 0x3054, 0x002e, 0x080c, 0x6304, 0x6007, 0x000a,
-	0x00de, 0x0804, 0xc211, 0x6007, 0x000b, 0x00de, 0x0804, 0xc211,
-	0x080c, 0x3003, 0x080c, 0xbf5b, 0x6007, 0x0001, 0x0804, 0xc211,
-	0x080c, 0xd44b, 0x1904, 0xc424, 0x080c, 0x3149, 0x1904, 0xc424,
-	0x2071, 0x0260, 0x7034, 0x90b4, 0x0003, 0x1948, 0x90b2, 0x0014,
-	0x0a30, 0x7030, 0x9084, 0x0003, 0x1910, 0x6610, 0x2658, 0xbe04,
-	0x9686, 0x0707, 0x09e8, 0x0026, 0x6210, 0x2258, 0xbaa0, 0x900e,
-	0x080c, 0x3054, 0x002e, 0x6007, 0x000c, 0x2001, 0x0001, 0x080c,
-	0xd567, 0x0804, 0xc211, 0x080c, 0x661e, 0x1140, 0x2001, 0x1836,
-	0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804, 0xc03b,
-	0x080c, 0x6607, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082,
-	0x0006, 0x06c0, 0x1138, 0x0026, 0x2001, 0x0006, 0x080c, 0x61e6,
-	0x002e, 0x0050, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120,
-	0x9686, 0x0006, 0x1904, 0xc100, 0x080c, 0xcf49, 0x1120, 0x6007,
-	0x000e, 0x0804, 0xc211, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046,
-	0x080c, 0x3003, 0x080c, 0xbf5b, 0x004e, 0x0016, 0x9006, 0x2009,
-	0x1854, 0x210c, 0x0048, 0x2009, 0x0029, 0x080c, 0xd251, 0x6010,
-	0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007, 0x0001,
-	0x0804, 0xc211, 0x2001, 0x0001, 0x080c, 0x61a6, 0x0156, 0x0016,
-	0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0270,
-	0x080c, 0xabb0, 0x003e, 0x002e, 0x001e, 0x015e, 0x9005, 0x0168,
-	0x96b4, 0xff00, 0x8637, 0x9682, 0x0004, 0x0a04, 0xc100, 0x9682,
-	0x0007, 0x0a04, 0xc15c, 0x0804, 0xc100, 0x6017, 0x1900, 0x6007,
-	0x0009, 0x0804, 0xc211, 0x080c, 0x661e, 0x1140, 0x2001, 0x1836,
-	0x2004, 0x9084, 0x0009, 0x9086, 0x0008, 0x1110, 0x0804, 0xc03b,
-	0x080c, 0x6607, 0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082,
-	0x0006, 0x0688, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0004, 0x0120,
-	0x9686, 0x0006, 0x1904, 0xc100, 0x080c, 0xcf77, 0x1130, 0x080c,
-	0xce71, 0x1118, 0x6007, 0x0010, 0x04e0, 0x0046, 0x6410, 0x2458,
-	0xbca0, 0x0046, 0x080c, 0x3003, 0x080c, 0xbf5b, 0x004e, 0x0016,
-	0x9006, 0x2009, 0x1854, 0x210c, 0x0048, 0x2009, 0x0029, 0x080c,
-	0xd251, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e, 0x004e,
-	0x6007, 0x0001, 0x00f0, 0x080c, 0xd0dc, 0x0140, 0x96b4, 0xff00,
-	0x8637, 0x9686, 0x0006, 0x0980, 0x0804, 0xc100, 0x6017, 0x1900,
-	0x6007, 0x0009, 0x0070, 0x080c, 0x3149, 0x1904, 0xc424, 0x080c,
-	0xd44b, 0x1904, 0xc424, 0x080c, 0xc5c4, 0x1904, 0xc100, 0x6007,
-	0x0012, 0x6003, 0x0001, 0x080c, 0x84b0, 0x080c, 0x890e, 0x0005,
-	0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x84b0, 0x080c, 0x890e,
-	0x0cb0, 0x6007, 0x0005, 0x0c68, 0x080c, 0xd44b, 0x1904, 0xc424,
-	0x080c, 0x3149, 0x1904, 0xc424, 0x080c, 0xc5c4, 0x1904, 0xc100,
-	0x6007, 0x0020, 0x6003, 0x0001, 0x080c, 0x84b0, 0x080c, 0x890e,
-	0x0005, 0x080c, 0x3149, 0x1904, 0xc424, 0x6007, 0x0023, 0x6003,
-	0x0001, 0x080c, 0x84b0, 0x080c, 0x890e, 0x0005, 0x080c, 0xd44b,
-	0x1904, 0xc424, 0x080c, 0x3149, 0x1904, 0xc424, 0x080c, 0xc5c4,
-	0x1904, 0xc100, 0x0016, 0x0026, 0x00e6, 0x2071, 0x0260, 0x7244,
-	0x9286, 0xffff, 0x0180, 0x2c08, 0x080c, 0xb81a, 0x01b0, 0x2260,
-	0x7240, 0x6008, 0x9206, 0x1188, 0x6010, 0x9190, 0x0004, 0x2214,
-	0x9206, 0x01b8, 0x0050, 0x7240, 0x2c08, 0x9006, 0x080c, 0xd223,
-	0x1180, 0x7244, 0x9286, 0xffff, 0x01b0, 0x2160, 0x6007, 0x0026,
-	0x6017, 0x1700, 0x7214, 0x9296, 0xffff, 0x1180, 0x6007, 0x0025,
-	0x0068, 0x6020, 0x9086, 0x0007, 0x1d80, 0x6004, 0x9086, 0x0024,
-	0x1110, 0x080c, 0x9bcc, 0x2160, 0x6007, 0x0025, 0x6003, 0x0001,
-	0x080c, 0x84b0, 0x080c, 0x890e, 0x00ee, 0x002e, 0x001e, 0x0005,
-	0x2001, 0x0001, 0x080c, 0x61a6, 0x0156, 0x0016, 0x0026, 0x0036,
-	0x20a9, 0x0004, 0x2019, 0x1805, 0x2011, 0x0276, 0x080c, 0xabb0,
-	0x003e, 0x002e, 0x001e, 0x015e, 0x0120, 0x6007, 0x0031, 0x0804,
-	0xc211, 0x080c, 0xa815, 0x080c, 0x70ac, 0x1190, 0x0006, 0x0026,
-	0x0036, 0x080c, 0x70c6, 0x1138, 0x080c, 0x73ac, 0x080c, 0x5cd5,
-	0x080c, 0x6fdd, 0x0010, 0x080c, 0x7080, 0x003e, 0x002e, 0x000e,
-	0x0005, 0x080c, 0x3149, 0x1904, 0xc424, 0x080c, 0xc5c4, 0x1904,
-	0xc100, 0x6106, 0x080c, 0xc5e0, 0x1120, 0x6007, 0x002b, 0x0804,
-	0xc211, 0x6007, 0x002c, 0x0804, 0xc211, 0x080c, 0xd44b, 0x1904,
-	0xc424, 0x080c, 0x3149, 0x1904, 0xc424, 0x080c, 0xc5c4, 0x1904,
-	0xc100, 0x6106, 0x080c, 0xc5e5, 0x1120, 0x6007, 0x002e, 0x0804,
-	0xc211, 0x6007, 0x002f, 0x0804, 0xc211, 0x080c, 0x3149, 0x1904,
-	0xc424, 0x00e6, 0x00d6, 0x00c6, 0x6010, 0x2058, 0xb904, 0x9184,
-	0x00ff, 0x9086, 0x0006, 0x0158, 0x9184, 0xff00, 0x8007, 0x9086,
-	0x0006, 0x0128, 0x00ce, 0x00de, 0x00ee, 0x0804, 0xc218, 0x080c,
-	0x538a, 0xd0e4, 0x0904, 0xc36f, 0x2071, 0x026c, 0x7010, 0x603a,
-	0x7014, 0x603e, 0x7108, 0x720c, 0x080c, 0x665c, 0x0140, 0x6010,
-	0x2058, 0xb810, 0x9106, 0x1118, 0xb814, 0x9206, 0x0510, 0x080c,
-	0x6658, 0x15b8, 0x2069, 0x1800, 0x687c, 0x9206, 0x1590, 0x6878,
-	0x9106, 0x1578, 0x7210, 0x080c, 0xb81a, 0x0590, 0x080c, 0xc4af,
-	0x0578, 0x080c, 0xd2cd, 0x0560, 0x622e, 0x6007, 0x0036, 0x6003,
-	0x0001, 0x2009, 0x8020, 0x080c, 0x84a9, 0x00ce, 0x00de, 0x00ee,
-	0x0005, 0x7214, 0x9286, 0xffff, 0x0150, 0x080c, 0xb81a, 0x01c0,
-	0x9280, 0x0002, 0x2004, 0x7110, 0x9106, 0x1190, 0x08e0, 0x7210,
-	0x2c08, 0x9085, 0x0001, 0x080c, 0xd223, 0x2c10, 0x2160, 0x0140,
-	0x0890, 0x6007, 0x0037, 0x602f, 0x0009, 0x6017, 0x1500, 0x08b8,
-	0x6007, 0x0037, 0x602f, 0x0003, 0x6017, 0x1700, 0x0880, 0x6007,
-	0x0012, 0x0868, 0x080c, 0x3149, 0x1904, 0xc424, 0x6010, 0x2058,
-	0xb804, 0x9084, 0xff00, 0x8007, 0x9086, 0x0006, 0x1904, 0xc218,
-	0x00e6, 0x00d6, 0x00c6, 0x080c, 0x538a, 0xd0e4, 0x0904, 0xc3e7,
-	0x2069, 0x1800, 0x2071, 0x026c, 0x7008, 0x603a, 0x720c, 0x623e,
-	0x9286, 0xffff, 0x1150, 0x7208, 0x00c6, 0x2c08, 0x9085, 0x0001,
-	0x080c, 0xd223, 0x2c10, 0x00ce, 0x05e8, 0x080c, 0xb81a, 0x05d0,
-	0x7108, 0x9280, 0x0002, 0x2004, 0x9106, 0x15a0, 0x00c6, 0x0026,
-	0x2260, 0x080c, 0xb42a, 0x002e, 0x00ce, 0x7118, 0x918c, 0xff00,
-	0x810f, 0x9186, 0x0001, 0x0178, 0x9186, 0x0005, 0x0118, 0x9186,
-	0x0007, 0x1198, 0x9280, 0x0005, 0x2004, 0x9005, 0x0170, 0x080c,
-	0xc4af, 0x0904, 0xc368, 0x0056, 0x7510, 0x7614, 0x080c, 0xd2e6,
-	0x005e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x6007, 0x003b, 0x602f,
-	0x0009, 0x6017, 0x2a00, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c,
-	0x84a9, 0x0c78, 0x6007, 0x003b, 0x602f, 0x0003, 0x6017, 0x0300,
-	0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x84a9, 0x0c10, 0x6007,
-	0x003b, 0x602f, 0x000b, 0x6017, 0x0000, 0x0804, 0xc33f, 0x00e6,
-	0x0026, 0x080c, 0x661e, 0x0550, 0x080c, 0x6607, 0x080c, 0xd4bd,
-	0x1518, 0x2071, 0x1800, 0x70d8, 0x9085, 0x0003, 0x70da, 0x00f6,
-	0x2079, 0x0100, 0x72ac, 0x9284, 0x00ff, 0x707a, 0x78e6, 0x9284,
-	0xff00, 0x727c, 0x9205, 0x707e, 0x78ea, 0x00fe, 0x70e3, 0x0000,
-	0x080c, 0x665c, 0x0120, 0x2011, 0x19da, 0x2013, 0x07d0, 0xd0ac,
-	0x1128, 0x080c, 0x2ddb, 0x0010, 0x080c, 0xd4ef, 0x002e, 0x00ee,
-	0x080c, 0x9bcc, 0x0804, 0xc217, 0x080c, 0x9bcc, 0x0005, 0x2600,
-	0x0002, 0xc43b, 0xc43b, 0xc43b, 0xc43b, 0xc43b, 0xc43d, 0xc43b,
-	0xc43b, 0xc43b, 0xc43b, 0xc45a, 0xc43b, 0xc43b, 0xc43b, 0xc46c,
-	0xc479, 0xc4aa, 0xc43b, 0x080c, 0x0d65, 0x080c, 0xd44b, 0x1d20,
-	0x080c, 0x3149, 0x1d08, 0x080c, 0xc5c4, 0x1148, 0x7038, 0x6016,
-	0x6007, 0x0045, 0x6003, 0x0001, 0x080c, 0x84b0, 0x0005, 0x080c,
-	0x3003, 0x080c, 0xbf5b, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c,
-	0x84b0, 0x0005, 0x080c, 0xd44b, 0x1938, 0x080c, 0x3149, 0x1920,
-	0x080c, 0xc5c4, 0x1d60, 0x703c, 0x6016, 0x6007, 0x004a, 0x6003,
-	0x0001, 0x080c, 0x84b0, 0x0005, 0x080c, 0xc4cc, 0x0904, 0xc424,
-	0x6007, 0x004e, 0x6003, 0x0001, 0x080c, 0x84b0, 0x080c, 0x890e,
-	0x0005, 0x6007, 0x004f, 0x6017, 0x0000, 0x7134, 0x918c, 0x00ff,
-	0x81ff, 0x0508, 0x9186, 0x0001, 0x1160, 0x7140, 0x2001, 0x198e,
-	0x2004, 0x9106, 0x11b0, 0x7144, 0x2001, 0x198f, 0x2004, 0x9106,
-	0x0190, 0x9186, 0x0002, 0x1168, 0x2011, 0x0276, 0x20a9, 0x0004,
-	0x6010, 0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xabc4, 0x009e,
-	0x0110, 0x6017, 0x0001, 0x6003, 0x0001, 0x080c, 0x84b0, 0x080c,
-	0x890e, 0x0005, 0x6007, 0x0050, 0x703c, 0x6016, 0x0ca0, 0x0016,
-	0x00e6, 0x2071, 0x0260, 0x00b6, 0x00c6, 0x2260, 0x6010, 0x2058,
-	0xb8c4, 0xd084, 0x0150, 0x7128, 0x6050, 0x9106, 0x1120, 0x712c,
-	0x604c, 0x9106, 0x0110, 0x9006, 0x0010, 0x9085, 0x0001, 0x00ce,
-	0x00be, 0x00ee, 0x001e, 0x0005, 0x0016, 0x0096, 0x0086, 0x00e6,
-	0x01c6, 0x01d6, 0x0126, 0x2091, 0x8000, 0x2071, 0x1800, 0x708c,
-	0x908a, 0x00f9, 0x16e8, 0x20e1, 0x0000, 0x2001, 0x1971, 0x2003,
-	0x0000, 0x080c, 0x103b, 0x05a0, 0x2900, 0x6016, 0x708c, 0x8004,
-	0xa816, 0x908a, 0x001e, 0x02d0, 0xa833, 0x001e, 0x20a9, 0x001e,
-	0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x1971,
-	0x0016, 0x200c, 0x0471, 0x001e, 0x2940, 0x080c, 0x103b, 0x01c0,
-	0x2900, 0xa006, 0x2100, 0x81ff, 0x0180, 0x0c18, 0xa832, 0x20a8,
-	0xa860, 0x20e8, 0xa85c, 0x9080, 0x001b, 0x20a0, 0x2001, 0x1971,
-	0x0016, 0x200c, 0x00b1, 0x001e, 0x0000, 0x9085, 0x0001, 0x0048,
-	0x2071, 0x1800, 0x708f, 0x0000, 0x6014, 0x2048, 0x080c, 0x0fd4,
-	0x9006, 0x012e, 0x01de, 0x01ce, 0x00ee, 0x008e, 0x009e, 0x001e,
-	0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x918c, 0xffff,
-	0x11a8, 0x080c, 0x202b, 0x2099, 0x026c, 0x2001, 0x0014, 0x3518,
-	0x9312, 0x1218, 0x23a8, 0x4003, 0x00f8, 0x20a8, 0x4003, 0x22a8,
-	0x8108, 0x080c, 0x202b, 0x2099, 0x0260, 0x0ca8, 0x080c, 0x202b,
-	0x2061, 0x1971, 0x6004, 0x2098, 0x6008, 0x3518, 0x9312, 0x1218,
-	0x23a8, 0x4003, 0x0048, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c,
-	0x202b, 0x2099, 0x0260, 0x0ca8, 0x2061, 0x1971, 0x2019, 0x0280,
-	0x3300, 0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0260, 0x6006,
-	0x8108, 0x2162, 0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce,
-	0x003e, 0x002e, 0x001e, 0x000e, 0x0005, 0x0006, 0x0016, 0x0026,
-	0x0036, 0x00c6, 0x81ff, 0x11b8, 0x080c, 0x2043, 0x20a1, 0x024c,
-	0x2001, 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0418,
-	0x20a8, 0x4003, 0x82ff, 0x01f8, 0x22a8, 0x8108, 0x080c, 0x2043,
-	0x20a1, 0x0240, 0x0c98, 0x080c, 0x2043, 0x2061, 0x1974, 0x6004,
-	0x20a0, 0x6008, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0058,
-	0x20a8, 0x4003, 0x82ff, 0x0138, 0x22a8, 0x8108, 0x080c, 0x2043,
-	0x20a1, 0x0240, 0x0c98, 0x2061, 0x1974, 0x2019, 0x0260, 0x3400,
-	0x931e, 0x0110, 0x6006, 0x0020, 0x2001, 0x0240, 0x6006, 0x8108,
-	0x2162, 0x9292, 0x0021, 0x9296, 0xffff, 0x620a, 0x00ce, 0x003e,
-	0x002e, 0x001e, 0x000e, 0x0005, 0x00b6, 0x0066, 0x6610, 0x2658,
-	0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0170, 0x9686,
-	0x0004, 0x0158, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x0128,
-	0x9686, 0x0004, 0x0110, 0x9085, 0x0001, 0x006e, 0x00be, 0x0005,
-	0x00d6, 0x080c, 0xc65a, 0x00de, 0x0005, 0x00d6, 0x080c, 0xc667,
-	0x1520, 0x680c, 0x908c, 0xff00, 0x6820, 0x9084, 0x00ff, 0x9115,
-	0x6216, 0x6824, 0x602e, 0xd1e4, 0x0130, 0x9006, 0x080c, 0xd567,
-	0x2009, 0x0001, 0x0078, 0xd1ec, 0x0180, 0x6920, 0x918c, 0x00ff,
-	0x6824, 0x080c, 0x2424, 0x1148, 0x2001, 0x0001, 0x080c, 0xd567,
-	0x2110, 0x900e, 0x080c, 0x3054, 0x0018, 0x9085, 0x0001, 0x0008,
-	0x9006, 0x00de, 0x0005, 0x00b6, 0x00c6, 0x080c, 0x9c3d, 0x0598,
-	0x0016, 0x0026, 0x00c6, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
-	0x080c, 0x2424, 0x1568, 0x080c, 0x6209, 0x1550, 0xbe12, 0xbd16,
-	0x00ce, 0x002e, 0x001e, 0x2b00, 0x6012, 0x080c, 0xd44b, 0x11c8,
-	0x080c, 0x3149, 0x11b0, 0x080c, 0xc5c4, 0x0500, 0x2001, 0x0007,
-	0x080c, 0x61ba, 0x2001, 0x0007, 0x080c, 0x61e6, 0x6017, 0x0000,
-	0x6023, 0x0001, 0x6007, 0x0001, 0x6003, 0x0001, 0x080c, 0x84b0,
-	0x0010, 0x080c, 0x9bcc, 0x9085, 0x0001, 0x00ce, 0x00be, 0x0005,
-	0x080c, 0x9bcc, 0x00ce, 0x002e, 0x001e, 0x0ca8, 0x080c, 0x9bcc,
-	0x9006, 0x0c98, 0x2069, 0x026d, 0x6800, 0x9082, 0x0010, 0x1228,
-	0x6017, 0x0000, 0x9085, 0x0001, 0x0008, 0x9006, 0x0005, 0x6017,
-	0x0000, 0x2069, 0x026c, 0x6808, 0x9084, 0xff00, 0x9086, 0x0800,
-	0x1190, 0x6904, 0x9186, 0x0018, 0x0118, 0x9186, 0x0014, 0x1158,
-	0x810f, 0x6800, 0x9084, 0x00ff, 0x910d, 0x6162, 0x908e, 0x0014,
-	0x0110, 0x908e, 0x0010, 0x0005, 0x6004, 0x90b2, 0x0053, 0x1a0c,
-	0x0d65, 0x91b6, 0x0013, 0x1130, 0x2008, 0x91b2, 0x0040, 0x1a04,
-	0xc7a7, 0x0092, 0x91b6, 0x0027, 0x0120, 0x91b6, 0x0014, 0x190c,
-	0x0d65, 0x2001, 0x0007, 0x080c, 0x61e6, 0x080c, 0x884c, 0x080c,
-	0x9c06, 0x080c, 0x890e, 0x0005, 0xc6e4, 0xc6e6, 0xc6e4, 0xc6e4,
-	0xc6e4, 0xc6e6, 0xc6f3, 0xc7a4, 0xc743, 0xc7a4, 0xc755, 0xc7a4,
-	0xc6f3, 0xc7a4, 0xc79c, 0xc7a4, 0xc79c, 0xc7a4, 0xc7a4, 0xc6e4,
-	0xc6e4, 0xc6e4, 0xc6e4, 0xc6e4, 0xc6e4, 0xc6e4, 0xc6e4, 0xc6e4,
-	0xc6e4, 0xc6e4, 0xc6e6, 0xc6e4, 0xc7a4, 0xc6e4, 0xc6e4, 0xc7a4,
-	0xc6e4, 0xc7a1, 0xc7a4, 0xc6e4, 0xc6e4, 0xc6e4, 0xc6e4, 0xc7a4,
-	0xc7a4, 0xc6e4, 0xc7a4, 0xc7a4, 0xc6e4, 0xc6ee, 0xc6e4, 0xc6e4,
-	0xc6e4, 0xc6e4, 0xc7a0, 0xc7a4, 0xc6e4, 0xc6e4, 0xc7a4, 0xc7a4,
-	0xc6e4, 0xc6e4, 0xc6e4, 0xc6e4, 0x080c, 0x0d65, 0x080c, 0xbf5e,
-	0x6003, 0x0002, 0x080c, 0x890e, 0x0804, 0xc7a6, 0x9006, 0x080c,
-	0x61a6, 0x0804, 0xc7a4, 0x080c, 0x6658, 0x1904, 0xc7a4, 0x9006,
-	0x080c, 0x61a6, 0x6010, 0x2058, 0xb810, 0x9086, 0x00ff, 0x1140,
-	0x00f6, 0x2079, 0x1800, 0x78a4, 0x8000, 0x78a6, 0x00fe, 0x0428,
-	0x6010, 0x2058, 0xb884, 0x9005, 0x1178, 0x080c, 0xbf46, 0x1904,
-	0xc7a4, 0x0036, 0x0046, 0xbba0, 0x2021, 0x0007, 0x080c, 0x4a6e,
-	0x004e, 0x003e, 0x0804, 0xc7a4, 0x080c, 0x317a, 0x1904, 0xc7a4,
-	0x2001, 0x1800, 0x2004, 0x9086, 0x0002, 0x1138, 0x00f6, 0x2079,
-	0x1800, 0x78a4, 0x8000, 0x78a6, 0x00fe, 0x2001, 0x0002, 0x080c,
-	0x61ba, 0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c,
-	0x84b0, 0x080c, 0x890e, 0x6110, 0x2158, 0x2009, 0x0001, 0x080c,
-	0x813f, 0x0804, 0xc7a6, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00,
-	0x8637, 0x9686, 0x0006, 0x0904, 0xc7a4, 0x9686, 0x0004, 0x0904,
-	0xc7a4, 0x2001, 0x0004, 0x0804, 0xc7a2, 0x2001, 0x1800, 0x2004,
-	0x9086, 0x0003, 0x1158, 0x0036, 0x0046, 0x6010, 0x2058, 0xbba0,
-	0x2021, 0x0006, 0x080c, 0x4a6e, 0x004e, 0x003e, 0x2001, 0x0006,
-	0x080c, 0xc7c0, 0x6610, 0x2658, 0xbe04, 0x0066, 0x96b4, 0xff00,
-	0x8637, 0x9686, 0x0006, 0x006e, 0x0168, 0x2001, 0x0006, 0x080c,
-	0x61e6, 0x9284, 0x00ff, 0x908e, 0x0007, 0x1120, 0x2001, 0x0006,
-	0x080c, 0x61ba, 0x080c, 0x6658, 0x11f8, 0x2001, 0x1836, 0x2004,
-	0xd0a4, 0x01d0, 0xbe04, 0x96b4, 0x00ff, 0x9686, 0x0006, 0x01a0,
-	0x00f6, 0x2079, 0x1800, 0x78a4, 0x8000, 0x78a6, 0x00fe, 0x0804,
-	0xc72d, 0x2001, 0x0004, 0x0030, 0x2001, 0x0006, 0x0409, 0x0020,
-	0x0018, 0x0010, 0x080c, 0x61e6, 0x080c, 0x9bcc, 0x0005, 0x2600,
-	0x0002, 0xc7bb, 0xc7bb, 0xc7bb, 0xc7bb, 0xc7bb, 0xc7bd, 0xc7bb,
-	0xc7bb, 0xc7bb, 0xc7bb, 0xc7bd, 0xc7bb, 0xc7bb, 0xc7bb, 0xc7bd,
-	0xc7bd, 0xc7bd, 0xc7bd, 0x080c, 0x0d65, 0x080c, 0x9bcc, 0x0005,
-	0x0016, 0x00b6, 0x00d6, 0x6110, 0x2158, 0xb900, 0xd184, 0x0138,
-	0x080c, 0x61ba, 0x9006, 0x080c, 0x61a6, 0x080c, 0x3034, 0x00de,
-	0x00be, 0x001e, 0x0005, 0x6610, 0x2658, 0xb804, 0x9084, 0xff00,
-	0x8007, 0x90b2, 0x000c, 0x1a0c, 0x0d65, 0x91b6, 0x0015, 0x1110,
-	0x003b, 0x0028, 0x91b6, 0x0016, 0x190c, 0x0d65, 0x006b, 0x0005,
-	0xa655, 0xa655, 0xa655, 0xa655, 0xa655, 0xa655, 0xc83b, 0xc800,
-	0xa655, 0xa655, 0xa655, 0xa655, 0xa655, 0xa655, 0xa655, 0xa655,
-	0xa655, 0xa655, 0xc83b, 0xc842, 0xa655, 0xa655, 0xa655, 0xa655,
-	0x00f6, 0x080c, 0x6658, 0x11d8, 0x080c, 0xbf46, 0x11c0, 0x6010,
-	0x905d, 0x01a8, 0xb884, 0x9005, 0x0190, 0x9006, 0x080c, 0x61a6,
-	0x2001, 0x0002, 0x080c, 0x61ba, 0x6023, 0x0001, 0x6003, 0x0001,
-	0x6007, 0x0002, 0x080c, 0x84b0, 0x080c, 0x890e, 0x00d0, 0x2011,
-	0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2424, 0x1190, 0x080c,
-	0x6269, 0x0118, 0x080c, 0x9bcc, 0x0060, 0xb810, 0x0006, 0xb814,
-	0x0006, 0x080c, 0x5cef, 0x000e, 0xb816, 0x000e, 0xb812, 0x080c,
-	0x9bcc, 0x00fe, 0x0005, 0x6604, 0x96b6, 0x001e, 0x1110, 0x080c,
-	0x9bcc, 0x0005, 0x080c, 0xaa39, 0x1148, 0x6003, 0x0001, 0x6007,
-	0x0001, 0x080c, 0x84b0, 0x080c, 0x890e, 0x0010, 0x080c, 0x9bcc,
-	0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d65, 0x080c, 0x884c,
-	0x080c, 0x9c06, 0x0005, 0x9182, 0x0040, 0x0002, 0xc871, 0xc871,
-	0xc871, 0xc871, 0xc873, 0xc871, 0xc871, 0xc871, 0xc871, 0xc871,
-	0xc871, 0xc871, 0xc871, 0xc871, 0xc871, 0xc871, 0xc871, 0xc871,
-	0xc871, 0x080c, 0x0d65, 0x0096, 0x00b6, 0x00d6, 0x00e6, 0x00f6,
+	0x0016, 0x080c, 0x9b91, 0x0180, 0x2b08, 0x6112, 0x080c, 0xbcdb,
+	0x6023, 0x0001, 0x2900, 0x6016, 0x001e, 0x080c, 0x9c85, 0x9085,
+	0x0001, 0x012e, 0x00ce, 0x0005, 0x001e, 0x9006, 0x0cd0, 0x0016,
+	0x0026, 0x0036, 0x0046, 0x0056, 0x0066, 0x0096, 0x00e6, 0x00f6,
+	0x2071, 0x1800, 0x9186, 0x0015, 0x1568, 0x718c, 0x6014, 0x2048,
+	0xa814, 0x8003, 0x9106, 0x1530, 0x20e1, 0x0000, 0x2001, 0x1971,
+	0x2003, 0x0000, 0x6014, 0x2048, 0xa830, 0x20a8, 0x8906, 0x8006,
+	0x8007, 0x9094, 0x003f, 0x22e8, 0x9084, 0xffc0, 0x9080, 0x001b,
+	0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x080c, 0xc545, 0x001e,
+	0xa804, 0x9005, 0x0110, 0x2048, 0x0c38, 0x6014, 0x2048, 0xa867,
+	0x0103, 0x0010, 0x080c, 0xa58f, 0x080c, 0x9be7, 0x00fe, 0x00ee,
+	0x009e, 0x006e, 0x005e, 0x004e, 0x003e, 0x002e, 0x001e, 0x0005,
+	0x0096, 0x00e6, 0x00f6, 0x2071, 0x1800, 0x9186, 0x0015, 0x11b8,
+	0x708c, 0x9086, 0x0004, 0x1198, 0x6014, 0x2048, 0x2c78, 0x080c,
+	0x89f5, 0x01a8, 0x7078, 0xaa74, 0x9206, 0x1130, 0x707c, 0xaa78,
+	0x9206, 0x1110, 0x080c, 0x3006, 0x080c, 0x9ff6, 0x0020, 0x080c,
+	0xa58f, 0x080c, 0x9be7, 0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c,
+	0xaa78, 0x9206, 0x0d78, 0x0c80, 0x0096, 0x00e6, 0x00f6, 0x2071,
+	0x1800, 0x9186, 0x0015, 0x1550, 0x708c, 0x9086, 0x0004, 0x1530,
+	0x6014, 0x2048, 0x2c78, 0x080c, 0x89f5, 0x05f0, 0x7078, 0xaacc,
+	0x9206, 0x1180, 0x707c, 0xaad0, 0x9206, 0x1160, 0x080c, 0x3006,
+	0x0016, 0xa998, 0xaab0, 0x9284, 0x1000, 0xc0fd, 0x080c, 0x5345,
+	0x001e, 0x0010, 0x080c, 0x512e, 0x080c, 0xb847, 0x0508, 0xa87b,
+	0x0000, 0xa883, 0x0000, 0xa897, 0x4000, 0x0080, 0x080c, 0xb847,
+	0x01b8, 0x6014, 0x2048, 0x080c, 0x512e, 0x1d70, 0xa87b, 0x0030,
+	0xa883, 0x0000, 0xa897, 0x4005, 0xa89b, 0x0004, 0x0126, 0x2091,
+	0x8000, 0xa867, 0x0139, 0x080c, 0x6996, 0x012e, 0x080c, 0x9be7,
+	0x00fe, 0x00ee, 0x009e, 0x0005, 0x705c, 0xaad0, 0x9206, 0x0930,
+	0x0888, 0x0016, 0x0026, 0xa87c, 0xd0ac, 0x0178, 0xa938, 0xaa34,
+	0x2100, 0x9205, 0x0150, 0xa890, 0x9106, 0x1118, 0xa88c, 0x9206,
+	0x0120, 0xa992, 0xaa8e, 0x9085, 0x0001, 0x002e, 0x001e, 0x0005,
+	0x00b6, 0x00d6, 0x0036, 0x080c, 0xb847, 0x0904, 0xbe96, 0x0096,
+	0x6314, 0x2348, 0xa87a, 0xa982, 0x929e, 0x4000, 0x1580, 0x6310,
+	0x00c6, 0x2358, 0x2009, 0x0000, 0xa868, 0xd0f4, 0x1140, 0x080c,
+	0x655f, 0x1108, 0xc185, 0xb800, 0xd0bc, 0x0108, 0xc18d, 0xaa96,
+	0xa99a, 0x20a9, 0x0004, 0xa860, 0x20e8, 0xa85c, 0x9080, 0x0031,
+	0x20a0, 0xb8b4, 0x20e0, 0xb8b8, 0x9080, 0x0006, 0x2098, 0x080c,
+	0x0f9f, 0x20a9, 0x0004, 0xa85c, 0x9080, 0x0035, 0x20a0, 0xb8b8,
+	0x9080, 0x000a, 0x2098, 0x080c, 0x0f9f, 0x00ce, 0x0090, 0xaa96,
+	0x3918, 0x9398, 0x0007, 0x231c, 0x6004, 0x9086, 0x0016, 0x0110,
+	0xa89b, 0x0004, 0xaba2, 0x6310, 0x2358, 0xb804, 0x9084, 0x00ff,
+	0xa89e, 0x080c, 0x698a, 0x6017, 0x0000, 0x009e, 0x003e, 0x00de,
+	0x00be, 0x0005, 0x0026, 0x0036, 0x0046, 0x00b6, 0x0096, 0x00f6,
+	0x6214, 0x2248, 0x6210, 0x2258, 0x2079, 0x0260, 0x9096, 0x0000,
+	0x11a0, 0xb814, 0x9084, 0x00ff, 0x900e, 0x080c, 0x2424, 0x2118,
+	0x831f, 0x939c, 0xff00, 0x7838, 0x9084, 0x00ff, 0x931d, 0x7c3c,
+	0x2011, 0x8018, 0x080c, 0x48d8, 0x00a8, 0x9096, 0x0001, 0x1148,
+	0x89ff, 0x0180, 0xa89b, 0x000d, 0x7838, 0xa8a6, 0x783c, 0xa8aa,
+	0x0048, 0x9096, 0x0002, 0x1130, 0xa89b, 0x000d, 0x7838, 0xa8a6,
+	0x783c, 0xa8aa, 0x00fe, 0x009e, 0x00be, 0x004e, 0x003e, 0x002e,
+	0x0005, 0x00c6, 0x0026, 0x0016, 0x9186, 0x0035, 0x0110, 0x6a38,
+	0x0008, 0x6a2c, 0x080c, 0xb835, 0x01f0, 0x2260, 0x6120, 0x9186,
+	0x0003, 0x0118, 0x9186, 0x0006, 0x1190, 0x6838, 0x9206, 0x0140,
+	0x683c, 0x9206, 0x1160, 0x6108, 0x6838, 0x9106, 0x1140, 0x0020,
+	0x6008, 0x693c, 0x9106, 0x1118, 0x6010, 0x6910, 0x9106, 0x001e,
+	0x002e, 0x00ce, 0x0005, 0x9085, 0x0001, 0x0cc8, 0xa974, 0xd1cc,
+	0x0188, 0x918c, 0x00ff, 0x918e, 0x0002, 0x1160, 0xa9a8, 0x918c,
+	0x0f00, 0x810f, 0x918e, 0x0001, 0x1128, 0xa834, 0xa938, 0x9115,
+	0x190c, 0xaec2, 0x0005, 0x0036, 0x2019, 0x0001, 0x0010, 0x0036,
+	0x901e, 0x0499, 0x01e0, 0x080c, 0xb847, 0x01c8, 0x080c, 0xba36,
+	0x6037, 0x4000, 0x6014, 0x6017, 0x0000, 0x0096, 0x2048, 0xa87c,
+	0x080c, 0xba5c, 0x1118, 0x080c, 0xa58f, 0x0040, 0xa867, 0x0103,
+	0xa877, 0x0000, 0x83ff, 0x1129, 0x080c, 0x6996, 0x009e, 0x003e,
+	0x0005, 0xa880, 0xd0b4, 0x0128, 0xa87b, 0x0006, 0xc0ec, 0xa882,
+	0x0048, 0xd0bc, 0x0118, 0xa87b, 0x0002, 0x0020, 0xa87b, 0x0005,
+	0x080c, 0xbb4b, 0xa877, 0x0000, 0x0005, 0x2001, 0x1810, 0x2004,
+	0xd0ec, 0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0f4, 0x000e,
+	0x0005, 0x0006, 0x2001, 0x1810, 0x2004, 0xd0e4, 0x000e, 0x0005,
+	0x0036, 0x0046, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021,
+	0x0007, 0x080c, 0x4a75, 0x004e, 0x003e, 0x0005, 0x0c51, 0x1d81,
+	0x0005, 0x2001, 0x1957, 0x2004, 0x601a, 0x0005, 0x2001, 0x1959,
+	0x2004, 0x604a, 0x0005, 0x080c, 0x9be7, 0x0804, 0x8936, 0x611c,
+	0xd1fc, 0xa97c, 0x1108, 0xd1e4, 0x0005, 0x601c, 0xd0fc, 0xa87c,
+	0x1108, 0xd0e4, 0x0005, 0x601c, 0xd0fc, 0xc0fc, 0x601e, 0xa87c,
+	0x1108, 0xd0e4, 0x0005, 0x6044, 0xd0fc, 0x0160, 0xd0dc, 0x1128,
+	0x908c, 0x000f, 0x9186, 0x0005, 0x1118, 0x6003, 0x0003, 0x0010,
+	0x6003, 0x0001, 0x0005, 0x00b6, 0x0066, 0x6000, 0x90b2, 0x0016,
+	0x1a0c, 0x0d65, 0x001b, 0x006e, 0x00be, 0x0005, 0xbfc6, 0xc6a0,
+	0xc7ef, 0xbfc6, 0xbfc6, 0xbfc6, 0xbfc6, 0xbfc6, 0xbffd, 0xc871,
+	0xbfc6, 0xbfc6, 0xbfc6, 0xbfc6, 0xbfc6, 0xbfc6, 0x080c, 0x0d65,
+	0x0066, 0x6000, 0x90b2, 0x0016, 0x1a0c, 0x0d65, 0x0013, 0x006e,
+	0x0005, 0xbfe1, 0xcd88, 0xbfe1, 0xbfe1, 0xbfe1, 0xbfe1, 0xbfe1,
+	0xbfe1, 0xcd37, 0xcdda, 0xbfe1, 0xd3fd, 0xd431, 0xd3fd, 0xd431,
+	0xbfe1, 0x080c, 0x0d65, 0x6000, 0x9082, 0x0016, 0x1a0c, 0x0d65,
+	0x6000, 0x000a, 0x0005, 0xbffb, 0xca4d, 0xcb16, 0xcb38, 0xcbb3,
+	0xbffb, 0xccad, 0xcc3b, 0xc87b, 0xcd0f, 0xcd24, 0xbffb, 0xbffb,
+	0xbffb, 0xbffb, 0xbffb, 0x080c, 0x0d65, 0x91b2, 0x0053, 0x1a0c,
+	0x0d65, 0x2100, 0x91b2, 0x0040, 0x1a04, 0xc443, 0x0002, 0xc047,
+	0xc234, 0xc047, 0xc047, 0xc047, 0xc23d, 0xc047, 0xc047, 0xc047,
+	0xc047, 0xc047, 0xc047, 0xc047, 0xc047, 0xc047, 0xc047, 0xc047,
+	0xc047, 0xc047, 0xc047, 0xc047, 0xc047, 0xc047, 0xc049, 0xc0b0,
+	0xc0bf, 0xc123, 0xc14e, 0xc1c6, 0xc21f, 0xc047, 0xc047, 0xc240,
+	0xc047, 0xc047, 0xc255, 0xc262, 0xc047, 0xc047, 0xc047, 0xc047,
+	0xc047, 0xc2e5, 0xc047, 0xc047, 0xc2f9, 0xc047, 0xc047, 0xc2b4,
+	0xc047, 0xc047, 0xc047, 0xc311, 0xc047, 0xc047, 0xc047, 0xc38e,
+	0xc047, 0xc047, 0xc047, 0xc047, 0xc047, 0xc047, 0xc40b, 0x080c,
+	0x0d65, 0x080c, 0x6625, 0x1150, 0x2001, 0x1836, 0x2004, 0xd0cc,
+	0x1128, 0x9084, 0x0009, 0x9086, 0x0008, 0x1140, 0x6007, 0x0009,
+	0x602f, 0x0009, 0x6017, 0x0000, 0x0804, 0xc22d, 0x080c, 0x660e,
+	0x00e6, 0x00c6, 0x0036, 0x0026, 0x0016, 0x6210, 0x2258, 0xbaa0,
+	0x0026, 0x2019, 0x0029, 0x080c, 0x98c8, 0x080c, 0x863b, 0x0076,
+	0x903e, 0x080c, 0x852a, 0x2c08, 0x080c, 0xcfc8, 0x007e, 0x001e,
+	0x080c, 0x98e4, 0x001e, 0x002e, 0x003e, 0x00ce, 0x00ee, 0x6610,
+	0x2658, 0x080c, 0x627f, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006,
+	0x1268, 0x0016, 0x0026, 0x6210, 0x00b6, 0x2258, 0xbaa0, 0x00be,
+	0x2c08, 0x080c, 0xd5a9, 0x002e, 0x001e, 0x1178, 0x080c, 0xcef7,
+	0x1904, 0xc11b, 0x080c, 0xce93, 0x1120, 0x6007, 0x0008, 0x0804,
+	0xc22d, 0x6007, 0x0009, 0x0804, 0xc22d, 0x080c, 0xd0fe, 0x0128,
+	0x080c, 0xcef7, 0x0d78, 0x0804, 0xc11b, 0x6017, 0x1900, 0x0c88,
+	0x080c, 0x3150, 0x1904, 0xc440, 0x6106, 0x080c, 0xce44, 0x6007,
+	0x0006, 0x0804, 0xc22d, 0x6007, 0x0007, 0x0804, 0xc22d, 0x080c,
+	0xd46d, 0x1904, 0xc440, 0x080c, 0x3150, 0x1904, 0xc440, 0x00d6,
+	0x6610, 0x2658, 0xbe04, 0x9684, 0x00ff, 0x9082, 0x0006, 0x1220,
+	0x2001, 0x0001, 0x080c, 0x61ad, 0x96b4, 0xff00, 0x8637, 0x9686,
+	0x0006, 0x0188, 0x9686, 0x0004, 0x0170, 0xbe04, 0x96b4, 0x00ff,
+	0x9686, 0x0006, 0x0140, 0x9686, 0x0004, 0x0128, 0x9686, 0x0005,
+	0x0110, 0x00de, 0x0480, 0x00e6, 0x2071, 0x0260, 0x7034, 0x9084,
+	0x0003, 0x1140, 0x7034, 0x9082, 0x0014, 0x0220, 0x7030, 0x9084,
+	0x0003, 0x0130, 0x00ee, 0x6017, 0x0000, 0x602f, 0x0007, 0x00b0,
+	0x00ee, 0x080c, 0xcf5e, 0x1190, 0x9686, 0x0006, 0x1140, 0x0026,
+	0x6210, 0x2258, 0xbaa0, 0x900e, 0x080c, 0x305b, 0x002e, 0x080c,
+	0x630b, 0x6007, 0x000a, 0x00de, 0x0804, 0xc22d, 0x6007, 0x000b,
+	0x00de, 0x0804, 0xc22d, 0x080c, 0x3006, 0x080c, 0xbf76, 0x6007,
+	0x0001, 0x0804, 0xc22d, 0x080c, 0xd46d, 0x1904, 0xc440, 0x080c,
+	0x3150, 0x1904, 0xc440, 0x2071, 0x0260, 0x7034, 0x90b4, 0x0003,
+	0x1948, 0x90b2, 0x0014, 0x0a30, 0x7030, 0x9084, 0x0003, 0x1910,
+	0x6610, 0x2658, 0xbe04, 0x9686, 0x0707, 0x09e8, 0x0026, 0x6210,
+	0x2258, 0xbaa0, 0x900e, 0x080c, 0x305b, 0x002e, 0x6007, 0x000c,
+	0x2001, 0x0001, 0x080c, 0xd589, 0x0804, 0xc22d, 0x080c, 0x6625,
+	0x1140, 0x2001, 0x1836, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008,
+	0x1110, 0x0804, 0xc056, 0x080c, 0x660e, 0x6610, 0x2658, 0xbe04,
+	0x9684, 0x00ff, 0x9082, 0x0006, 0x06c0, 0x1138, 0x0026, 0x2001,
+	0x0006, 0x080c, 0x61ed, 0x002e, 0x0050, 0x96b4, 0xff00, 0x8637,
+	0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xc11b, 0x080c,
+	0xcf6b, 0x1120, 0x6007, 0x000e, 0x0804, 0xc22d, 0x0046, 0x6410,
+	0x2458, 0xbca0, 0x0046, 0x080c, 0x3006, 0x080c, 0xbf76, 0x004e,
+	0x0016, 0x9006, 0x2009, 0x1854, 0x210c, 0x0048, 0x2009, 0x0029,
+	0x080c, 0xd273, 0x6010, 0x2058, 0xb800, 0xc0e5, 0xb802, 0x001e,
+	0x004e, 0x6007, 0x0001, 0x0804, 0xc22d, 0x2001, 0x0001, 0x080c,
+	0x61ad, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019,
+	0x1805, 0x2011, 0x0270, 0x080c, 0xabcb, 0x003e, 0x002e, 0x001e,
+	0x015e, 0x9005, 0x0168, 0x96b4, 0xff00, 0x8637, 0x9682, 0x0004,
+	0x0a04, 0xc11b, 0x9682, 0x0007, 0x0a04, 0xc177, 0x0804, 0xc11b,
+	0x6017, 0x1900, 0x6007, 0x0009, 0x0804, 0xc22d, 0x080c, 0x6625,
+	0x1140, 0x2001, 0x1836, 0x2004, 0x9084, 0x0009, 0x9086, 0x0008,
+	0x1110, 0x0804, 0xc056, 0x080c, 0x660e, 0x6610, 0x2658, 0xbe04,
+	0x9684, 0x00ff, 0x9082, 0x0006, 0x0690, 0x0150, 0x96b4, 0xff00,
+	0x8637, 0x9686, 0x0004, 0x0120, 0x9686, 0x0006, 0x1904, 0xc11b,
+	0x080c, 0xcf99, 0x1130, 0x080c, 0xce93, 0x1118, 0x6007, 0x0010,
+	0x04e0, 0x0046, 0x6410, 0x2458, 0xbca0, 0x0046, 0x080c, 0x3006,
+	0x080c, 0xbf76, 0x004e, 0x0016, 0x9006, 0x2009, 0x1854, 0x210c,
+	0x0048, 0x2009, 0x0029, 0x080c, 0xd273, 0x6010, 0x2058, 0xb800,
+	0xc0e5, 0xb802, 0x001e, 0x004e, 0x6007, 0x0001, 0x00f0, 0x080c,
+	0xd0fe, 0x0140, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0980,
+	0x0804, 0xc11b, 0x6017, 0x1900, 0x6007, 0x0009, 0x0070, 0x080c,
+	0x3150, 0x1904, 0xc440, 0x080c, 0xd46d, 0x1904, 0xc440, 0x080c,
+	0xc5e0, 0x1904, 0xc11b, 0x6007, 0x0012, 0x6003, 0x0001, 0x080c,
+	0x84d8, 0x080c, 0x8936, 0x0005, 0x6007, 0x0001, 0x6003, 0x0001,
+	0x080c, 0x84d8, 0x080c, 0x8936, 0x0cb0, 0x6007, 0x0005, 0x0c68,
+	0x080c, 0xd46d, 0x1904, 0xc440, 0x080c, 0x3150, 0x1904, 0xc440,
+	0x080c, 0xc5e0, 0x1904, 0xc11b, 0x6007, 0x0020, 0x6003, 0x0001,
+	0x080c, 0x84d8, 0x080c, 0x8936, 0x0005, 0x080c, 0x3150, 0x1904,
+	0xc440, 0x6007, 0x0023, 0x6003, 0x0001, 0x080c, 0x84d8, 0x080c,
+	0x8936, 0x0005, 0x080c, 0xd46d, 0x1904, 0xc440, 0x080c, 0x3150,
+	0x1904, 0xc440, 0x080c, 0xc5e0, 0x1904, 0xc11b, 0x0016, 0x0026,
+	0x00e6, 0x2071, 0x0260, 0x7244, 0x9286, 0xffff, 0x0180, 0x2c08,
+	0x080c, 0xb835, 0x01b0, 0x2260, 0x7240, 0x6008, 0x9206, 0x1188,
+	0x6010, 0x9190, 0x0004, 0x2214, 0x9206, 0x01b8, 0x0050, 0x7240,
+	0x2c08, 0x9006, 0x080c, 0xd245, 0x1180, 0x7244, 0x9286, 0xffff,
+	0x01b0, 0x2160, 0x6007, 0x0026, 0x6017, 0x1700, 0x7214, 0x9296,
+	0xffff, 0x1180, 0x6007, 0x0025, 0x0068, 0x6020, 0x9086, 0x0007,
+	0x1d80, 0x6004, 0x9086, 0x0024, 0x1110, 0x080c, 0x9be7, 0x2160,
+	0x6007, 0x0025, 0x6003, 0x0001, 0x080c, 0x84d8, 0x080c, 0x8936,
+	0x00ee, 0x002e, 0x001e, 0x0005, 0x2001, 0x0001, 0x080c, 0x61ad,
+	0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805,
+	0x2011, 0x0276, 0x080c, 0xabcb, 0x003e, 0x002e, 0x001e, 0x015e,
+	0x0120, 0x6007, 0x0031, 0x0804, 0xc22d, 0x080c, 0xa830, 0x080c,
+	0x70b7, 0x1190, 0x0006, 0x0026, 0x0036, 0x080c, 0x70d1, 0x1138,
+	0x080c, 0x73b7, 0x080c, 0x5cdc, 0x080c, 0x6fe8, 0x0010, 0x080c,
+	0x708b, 0x003e, 0x002e, 0x000e, 0x0005, 0x080c, 0x3150, 0x1904,
+	0xc440, 0x080c, 0xc5e0, 0x1904, 0xc11b, 0x6106, 0x080c, 0xc5fc,
+	0x1120, 0x6007, 0x002b, 0x0804, 0xc22d, 0x6007, 0x002c, 0x0804,
+	0xc22d, 0x080c, 0xd46d, 0x1904, 0xc440, 0x080c, 0x3150, 0x1904,
+	0xc440, 0x080c, 0xc5e0, 0x1904, 0xc11b, 0x6106, 0x080c, 0xc601,
+	0x1120, 0x6007, 0x002e, 0x0804, 0xc22d, 0x6007, 0x002f, 0x0804,
+	0xc22d, 0x080c, 0x3150, 0x1904, 0xc440, 0x00e6, 0x00d6, 0x00c6,
+	0x6010, 0x2058, 0xb904, 0x9184, 0x00ff, 0x9086, 0x0006, 0x0158,
+	0x9184, 0xff00, 0x8007, 0x9086, 0x0006, 0x0128, 0x00ce, 0x00de,
+	0x00ee, 0x0804, 0xc234, 0x080c, 0x5391, 0xd0e4, 0x0904, 0xc38b,
+	0x2071, 0x026c, 0x7010, 0x603a, 0x7014, 0x603e, 0x7108, 0x720c,
+	0x080c, 0x6663, 0x0140, 0x6010, 0x2058, 0xb810, 0x9106, 0x1118,
+	0xb814, 0x9206, 0x0510, 0x080c, 0x665f, 0x15b8, 0x2069, 0x1800,
+	0x687c, 0x9206, 0x1590, 0x6878, 0x9106, 0x1578, 0x7210, 0x080c,
+	0xb835, 0x0590, 0x080c, 0xc4cb, 0x0578, 0x080c, 0xd2ef, 0x0560,
+	0x622e, 0x6007, 0x0036, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c,
+	0x84d1, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x7214, 0x9286, 0xffff,
+	0x0150, 0x080c, 0xb835, 0x01c0, 0x9280, 0x0002, 0x2004, 0x7110,
+	0x9106, 0x1190, 0x08e0, 0x7210, 0x2c08, 0x9085, 0x0001, 0x080c,
+	0xd245, 0x2c10, 0x2160, 0x0140, 0x0890, 0x6007, 0x0037, 0x602f,
+	0x0009, 0x6017, 0x1500, 0x08b8, 0x6007, 0x0037, 0x602f, 0x0003,
+	0x6017, 0x1700, 0x0880, 0x6007, 0x0012, 0x0868, 0x080c, 0x3150,
+	0x1904, 0xc440, 0x6010, 0x2058, 0xb804, 0x9084, 0xff00, 0x8007,
+	0x9086, 0x0006, 0x1904, 0xc234, 0x00e6, 0x00d6, 0x00c6, 0x080c,
+	0x5391, 0xd0e4, 0x0904, 0xc403, 0x2069, 0x1800, 0x2071, 0x026c,
+	0x7008, 0x603a, 0x720c, 0x623e, 0x9286, 0xffff, 0x1150, 0x7208,
+	0x00c6, 0x2c08, 0x9085, 0x0001, 0x080c, 0xd245, 0x2c10, 0x00ce,
+	0x05e8, 0x080c, 0xb835, 0x05d0, 0x7108, 0x9280, 0x0002, 0x2004,
+	0x9106, 0x15a0, 0x00c6, 0x0026, 0x2260, 0x080c, 0xb445, 0x002e,
+	0x00ce, 0x7118, 0x918c, 0xff00, 0x810f, 0x9186, 0x0001, 0x0178,
+	0x9186, 0x0005, 0x0118, 0x9186, 0x0007, 0x1198, 0x9280, 0x0005,
+	0x2004, 0x9005, 0x0170, 0x080c, 0xc4cb, 0x0904, 0xc384, 0x0056,
+	0x7510, 0x7614, 0x080c, 0xd308, 0x005e, 0x00ce, 0x00de, 0x00ee,
+	0x0005, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017, 0x2a00, 0x6003,
+	0x0001, 0x2009, 0x8020, 0x080c, 0x84d1, 0x0c78, 0x6007, 0x003b,
+	0x602f, 0x0003, 0x6017, 0x0300, 0x6003, 0x0001, 0x2009, 0x8020,
+	0x080c, 0x84d1, 0x0c10, 0x6007, 0x003b, 0x602f, 0x000b, 0x6017,
+	0x0000, 0x0804, 0xc35b, 0x00e6, 0x0026, 0x080c, 0x6625, 0x0550,
+	0x080c, 0x660e, 0x080c, 0xd4df, 0x1518, 0x2071, 0x1800, 0x70d8,
+	0x9085, 0x0003, 0x70da, 0x00f6, 0x2079, 0x0100, 0x72ac, 0x9284,
+	0x00ff, 0x707a, 0x78e6, 0x9284, 0xff00, 0x727c, 0x9205, 0x707e,
+	0x78ea, 0x00fe, 0x70e3, 0x0000, 0x080c, 0x6663, 0x0120, 0x2011,
+	0x19da, 0x2013, 0x07d0, 0xd0ac, 0x1128, 0x080c, 0x2ddb, 0x0010,
+	0x080c, 0xd511, 0x002e, 0x00ee, 0x080c, 0x9be7, 0x0804, 0xc233,
+	0x080c, 0x9be7, 0x0005, 0x2600, 0x0002, 0xc457, 0xc457, 0xc457,
+	0xc457, 0xc457, 0xc459, 0xc457, 0xc457, 0xc457, 0xc457, 0xc476,
+	0xc457, 0xc457, 0xc457, 0xc488, 0xc495, 0xc4c6, 0xc457, 0x080c,
+	0x0d65, 0x080c, 0xd46d, 0x1d20, 0x080c, 0x3150, 0x1d08, 0x080c,
+	0xc5e0, 0x1148, 0x7038, 0x6016, 0x6007, 0x0045, 0x6003, 0x0001,
+	0x080c, 0x84d8, 0x0005, 0x080c, 0x3006, 0x080c, 0xbf76, 0x6007,
+	0x0001, 0x6003, 0x0001, 0x080c, 0x84d8, 0x0005, 0x080c, 0xd46d,
+	0x1938, 0x080c, 0x3150, 0x1920, 0x080c, 0xc5e0, 0x1d60, 0x703c,
+	0x6016, 0x6007, 0x004a, 0x6003, 0x0001, 0x080c, 0x84d8, 0x0005,
+	0x080c, 0xc4e8, 0x0904, 0xc440, 0x6007, 0x004e, 0x6003, 0x0001,
+	0x080c, 0x84d8, 0x080c, 0x8936, 0x0005, 0x6007, 0x004f, 0x6017,
+	0x0000, 0x7134, 0x918c, 0x00ff, 0x81ff, 0x0508, 0x9186, 0x0001,
+	0x1160, 0x7140, 0x2001, 0x198e, 0x2004, 0x9106, 0x11b0, 0x7144,
+	0x2001, 0x198f, 0x2004, 0x9106, 0x0190, 0x9186, 0x0002, 0x1168,
+	0x2011, 0x0276, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019,
+	0x000a, 0x080c, 0xabdf, 0x009e, 0x0110, 0x6017, 0x0001, 0x6003,
+	0x0001, 0x080c, 0x84d8, 0x080c, 0x8936, 0x0005, 0x6007, 0x0050,
+	0x703c, 0x6016, 0x0ca0, 0x0016, 0x00e6, 0x2071, 0x0260, 0x00b6,
+	0x00c6, 0x2260, 0x6010, 0x2058, 0xb8c4, 0xd084, 0x0150, 0x7128,
+	0x6050, 0x9106, 0x1120, 0x712c, 0x604c, 0x9106, 0x0110, 0x9006,
+	0x0010, 0x9085, 0x0001, 0x00ce, 0x00be, 0x00ee, 0x001e, 0x0005,
+	0x0016, 0x0096, 0x0086, 0x00e6, 0x01c6, 0x01d6, 0x0126, 0x2091,
+	0x8000, 0x2071, 0x1800, 0x708c, 0x908a, 0x00f9, 0x16e8, 0x20e1,
+	0x0000, 0x2001, 0x1971, 0x2003, 0x0000, 0x080c, 0x103b, 0x05a0,
+	0x2900, 0x6016, 0x708c, 0x8004, 0xa816, 0x908a, 0x001e, 0x02d0,
+	0xa833, 0x001e, 0x20a9, 0x001e, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x001b, 0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x0471, 0x001e,
+	0x2940, 0x080c, 0x103b, 0x01c0, 0x2900, 0xa006, 0x2100, 0x81ff,
+	0x0180, 0x0c18, 0xa832, 0x20a8, 0xa860, 0x20e8, 0xa85c, 0x9080,
+	0x001b, 0x20a0, 0x2001, 0x1971, 0x0016, 0x200c, 0x00b1, 0x001e,
+	0x0000, 0x9085, 0x0001, 0x0048, 0x2071, 0x1800, 0x708f, 0x0000,
+	0x6014, 0x2048, 0x080c, 0x0fd4, 0x9006, 0x012e, 0x01de, 0x01ce,
+	0x00ee, 0x008e, 0x009e, 0x001e, 0x0005, 0x0006, 0x0016, 0x0026,
+	0x0036, 0x00c6, 0x918c, 0xffff, 0x11a8, 0x080c, 0x202b, 0x2099,
+	0x026c, 0x2001, 0x0014, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003,
+	0x00f8, 0x20a8, 0x4003, 0x22a8, 0x8108, 0x080c, 0x202b, 0x2099,
+	0x0260, 0x0ca8, 0x080c, 0x202b, 0x2061, 0x1971, 0x6004, 0x2098,
+	0x6008, 0x3518, 0x9312, 0x1218, 0x23a8, 0x4003, 0x0048, 0x20a8,
+	0x4003, 0x22a8, 0x8108, 0x080c, 0x202b, 0x2099, 0x0260, 0x0ca8,
+	0x2061, 0x1971, 0x2019, 0x0280, 0x3300, 0x931e, 0x0110, 0x6006,
+	0x0020, 0x2001, 0x0260, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021,
+	0x9296, 0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e,
+	0x0005, 0x0006, 0x0016, 0x0026, 0x0036, 0x00c6, 0x81ff, 0x11b8,
+	0x080c, 0x2043, 0x20a1, 0x024c, 0x2001, 0x0014, 0x3518, 0x9312,
+	0x1218, 0x23a8, 0x4003, 0x0418, 0x20a8, 0x4003, 0x82ff, 0x01f8,
+	0x22a8, 0x8108, 0x080c, 0x2043, 0x20a1, 0x0240, 0x0c98, 0x080c,
+	0x2043, 0x2061, 0x1974, 0x6004, 0x20a0, 0x6008, 0x3518, 0x9312,
+	0x1218, 0x23a8, 0x4003, 0x0058, 0x20a8, 0x4003, 0x82ff, 0x0138,
+	0x22a8, 0x8108, 0x080c, 0x2043, 0x20a1, 0x0240, 0x0c98, 0x2061,
+	0x1974, 0x2019, 0x0260, 0x3400, 0x931e, 0x0110, 0x6006, 0x0020,
+	0x2001, 0x0240, 0x6006, 0x8108, 0x2162, 0x9292, 0x0021, 0x9296,
+	0xffff, 0x620a, 0x00ce, 0x003e, 0x002e, 0x001e, 0x000e, 0x0005,
+	0x00b6, 0x0066, 0x6610, 0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637,
+	0x9686, 0x0006, 0x0170, 0x9686, 0x0004, 0x0158, 0xbe04, 0x96b4,
+	0x00ff, 0x9686, 0x0006, 0x0128, 0x9686, 0x0004, 0x0110, 0x9085,
+	0x0001, 0x006e, 0x00be, 0x0005, 0x00d6, 0x080c, 0xc676, 0x00de,
+	0x0005, 0x00d6, 0x080c, 0xc683, 0x1520, 0x680c, 0x908c, 0xff00,
+	0x6820, 0x9084, 0x00ff, 0x9115, 0x6216, 0x6824, 0x602e, 0xd1e4,
+	0x0130, 0x9006, 0x080c, 0xd589, 0x2009, 0x0001, 0x0078, 0xd1ec,
+	0x0180, 0x6920, 0x918c, 0x00ff, 0x6824, 0x080c, 0x2424, 0x1148,
+	0x2001, 0x0001, 0x080c, 0xd589, 0x2110, 0x900e, 0x080c, 0x305b,
+	0x0018, 0x9085, 0x0001, 0x0008, 0x9006, 0x00de, 0x0005, 0x00b6,
+	0x00c6, 0x080c, 0x9c58, 0x0598, 0x0016, 0x0026, 0x00c6, 0x2011,
+	0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2424, 0x1568, 0x080c,
+	0x6210, 0x1550, 0xbe12, 0xbd16, 0x00ce, 0x002e, 0x001e, 0x2b00,
+	0x6012, 0x080c, 0xd46d, 0x11c8, 0x080c, 0x3150, 0x11b0, 0x080c,
+	0xc5e0, 0x0500, 0x2001, 0x0007, 0x080c, 0x61c1, 0x2001, 0x0007,
+	0x080c, 0x61ed, 0x6017, 0x0000, 0x6023, 0x0001, 0x6007, 0x0001,
+	0x6003, 0x0001, 0x080c, 0x84d8, 0x0010, 0x080c, 0x9be7, 0x9085,
+	0x0001, 0x00ce, 0x00be, 0x0005, 0x080c, 0x9be7, 0x00ce, 0x002e,
+	0x001e, 0x0ca8, 0x080c, 0x9be7, 0x9006, 0x0c98, 0x2069, 0x026d,
+	0x6800, 0x9082, 0x0010, 0x1228, 0x6017, 0x0000, 0x9085, 0x0001,
+	0x0008, 0x9006, 0x0005, 0x6017, 0x0000, 0x2069, 0x026c, 0x6808,
+	0x9084, 0xff00, 0x9086, 0x0800, 0x1190, 0x6904, 0x9186, 0x0018,
+	0x0118, 0x9186, 0x0014, 0x1158, 0x810f, 0x6800, 0x9084, 0x00ff,
+	0x910d, 0x6162, 0x908e, 0x0014, 0x0110, 0x908e, 0x0010, 0x0005,
+	0x6004, 0x90b2, 0x0053, 0x1a0c, 0x0d65, 0x91b6, 0x0013, 0x1130,
+	0x2008, 0x91b2, 0x0040, 0x1a04, 0xc7c3, 0x0092, 0x91b6, 0x0027,
+	0x0120, 0x91b6, 0x0014, 0x190c, 0x0d65, 0x2001, 0x0007, 0x080c,
+	0x61ed, 0x080c, 0x8874, 0x080c, 0x9c21, 0x080c, 0x8936, 0x0005,
+	0xc700, 0xc702, 0xc700, 0xc700, 0xc700, 0xc702, 0xc70f, 0xc7c0,
+	0xc75f, 0xc7c0, 0xc771, 0xc7c0, 0xc70f, 0xc7c0, 0xc7b8, 0xc7c0,
+	0xc7b8, 0xc7c0, 0xc7c0, 0xc700, 0xc700, 0xc700, 0xc700, 0xc700,
+	0xc700, 0xc700, 0xc700, 0xc700, 0xc700, 0xc700, 0xc702, 0xc700,
+	0xc7c0, 0xc700, 0xc700, 0xc7c0, 0xc700, 0xc7bd, 0xc7c0, 0xc700,
+	0xc700, 0xc700, 0xc700, 0xc7c0, 0xc7c0, 0xc700, 0xc7c0, 0xc7c0,
+	0xc700, 0xc70a, 0xc700, 0xc700, 0xc700, 0xc700, 0xc7bc, 0xc7c0,
+	0xc700, 0xc700, 0xc7c0, 0xc7c0, 0xc700, 0xc700, 0xc700, 0xc700,
+	0x080c, 0x0d65, 0x080c, 0xbf79, 0x6003, 0x0002, 0x080c, 0x8936,
+	0x0804, 0xc7c2, 0x9006, 0x080c, 0x61ad, 0x0804, 0xc7c0, 0x080c,
+	0x665f, 0x1904, 0xc7c0, 0x9006, 0x080c, 0x61ad, 0x6010, 0x2058,
+	0xb810, 0x9086, 0x00ff, 0x1140, 0x00f6, 0x2079, 0x1800, 0x78a4,
+	0x8000, 0x78a6, 0x00fe, 0x0428, 0x6010, 0x2058, 0xb884, 0x9005,
+	0x1178, 0x080c, 0xbf61, 0x1904, 0xc7c0, 0x0036, 0x0046, 0xbba0,
+	0x2021, 0x0007, 0x080c, 0x4a75, 0x004e, 0x003e, 0x0804, 0xc7c0,
+	0x080c, 0x3181, 0x1904, 0xc7c0, 0x2001, 0x1800, 0x2004, 0x9086,
+	0x0002, 0x1138, 0x00f6, 0x2079, 0x1800, 0x78a4, 0x8000, 0x78a6,
+	0x00fe, 0x2001, 0x0002, 0x080c, 0x61c1, 0x6023, 0x0001, 0x6003,
+	0x0001, 0x6007, 0x0002, 0x080c, 0x84d8, 0x080c, 0x8936, 0x6110,
+	0x2158, 0x2009, 0x0001, 0x080c, 0x8167, 0x0804, 0xc7c2, 0x6610,
+	0x2658, 0xbe04, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x0904,
+	0xc7c0, 0x9686, 0x0004, 0x0904, 0xc7c0, 0x2001, 0x0004, 0x0804,
+	0xc7be, 0x2001, 0x1800, 0x2004, 0x9086, 0x0003, 0x1158, 0x0036,
+	0x0046, 0x6010, 0x2058, 0xbba0, 0x2021, 0x0006, 0x080c, 0x4a75,
+	0x004e, 0x003e, 0x2001, 0x0006, 0x080c, 0xc7dc, 0x6610, 0x2658,
+	0xbe04, 0x0066, 0x96b4, 0xff00, 0x8637, 0x9686, 0x0006, 0x006e,
+	0x0168, 0x2001, 0x0006, 0x080c, 0x61ed, 0x9284, 0x00ff, 0x908e,
+	0x0007, 0x1120, 0x2001, 0x0006, 0x080c, 0x61c1, 0x080c, 0x665f,
+	0x11f8, 0x2001, 0x1836, 0x2004, 0xd0a4, 0x01d0, 0xbe04, 0x96b4,
+	0x00ff, 0x9686, 0x0006, 0x01a0, 0x00f6, 0x2079, 0x1800, 0x78a4,
+	0x8000, 0x78a6, 0x00fe, 0x0804, 0xc749, 0x2001, 0x0004, 0x0030,
+	0x2001, 0x0006, 0x0409, 0x0020, 0x0018, 0x0010, 0x080c, 0x61ed,
+	0x080c, 0x9be7, 0x0005, 0x2600, 0x0002, 0xc7d7, 0xc7d7, 0xc7d7,
+	0xc7d7, 0xc7d7, 0xc7d9, 0xc7d7, 0xc7d7, 0xc7d7, 0xc7d7, 0xc7d9,
+	0xc7d7, 0xc7d7, 0xc7d7, 0xc7d9, 0xc7d9, 0xc7d9, 0xc7d9, 0x080c,
+	0x0d65, 0x080c, 0x9be7, 0x0005, 0x0016, 0x00b6, 0x00d6, 0x6110,
+	0x2158, 0xb900, 0xd184, 0x0138, 0x080c, 0x61c1, 0x9006, 0x080c,
+	0x61ad, 0x080c, 0x303b, 0x00de, 0x00be, 0x001e, 0x0005, 0x6610,
+	0x2658, 0xb804, 0x9084, 0xff00, 0x8007, 0x90b2, 0x000c, 0x1a0c,
+	0x0d65, 0x91b6, 0x0015, 0x1110, 0x003b, 0x0028, 0x91b6, 0x0016,
+	0x190c, 0x0d65, 0x006b, 0x0005, 0xa670, 0xa670, 0xa670, 0xa670,
+	0xa670, 0xa670, 0xc85b, 0xc81c, 0xa670, 0xa670, 0xa670, 0xa670,
+	0xa670, 0xa670, 0xa670, 0xa670, 0xa670, 0xa670, 0xc85b, 0xc862,
+	0xa670, 0xa670, 0xa670, 0xa670, 0x00f6, 0x080c, 0x665f, 0x11d8,
+	0x080c, 0xbf61, 0x11c0, 0x6010, 0x905d, 0x01a8, 0xb884, 0x9005,
+	0x0190, 0x9006, 0x080c, 0x61ad, 0x2001, 0x0002, 0x080c, 0x61c1,
+	0x6023, 0x0001, 0x6003, 0x0001, 0x6007, 0x0002, 0x080c, 0x84d8,
+	0x080c, 0x8936, 0x00f0, 0x2011, 0x0263, 0x2204, 0x8211, 0x220c,
+	0x080c, 0x2424, 0x11b0, 0x080c, 0x6270, 0x0118, 0x080c, 0x9be7,
+	0x0080, 0xb810, 0x0006, 0xb814, 0x0006, 0xb884, 0x0006, 0x080c,
+	0x5cf6, 0x000e, 0xb886, 0x000e, 0xb816, 0x000e, 0xb812, 0x080c,
+	0x9be7, 0x00fe, 0x0005, 0x6604, 0x96b6, 0x001e, 0x1110, 0x080c,
+	0x9be7, 0x0005, 0x080c, 0xaa54, 0x1148, 0x6003, 0x0001, 0x6007,
+	0x0001, 0x080c, 0x84d8, 0x080c, 0x8936, 0x0010, 0x080c, 0x9be7,
+	0x0005, 0x6004, 0x908a, 0x0053, 0x1a0c, 0x0d65, 0x080c, 0x8874,
+	0x080c, 0x9c21, 0x0005, 0x9182, 0x0040, 0x0002, 0xc891, 0xc891,
+	0xc891, 0xc891, 0xc893, 0xc891, 0xc891, 0xc891, 0xc891, 0xc891,
+	0xc891, 0xc891, 0xc891, 0xc891, 0xc891, 0xc891, 0xc891, 0xc891,
+	0xc891, 0x080c, 0x0d65, 0x0096, 0x00b6, 0x00d6, 0x00e6, 0x00f6,
 	0x0046, 0x0026, 0x6210, 0x2258, 0xb8ac, 0x9005, 0x11b0, 0x6007,
-	0x0044, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904, 0xc8da,
-	0x080c, 0xd55b, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009, 0x0001,
-	0x2011, 0x0200, 0x080c, 0x83c3, 0x0020, 0x9026, 0x080c, 0xd490,
+	0x0044, 0x2071, 0x0260, 0x7444, 0x94a4, 0xff00, 0x0904, 0xc8fa,
+	0x080c, 0xd57d, 0x1170, 0x9486, 0x2000, 0x1158, 0x2009, 0x0001,
+	0x2011, 0x0200, 0x080c, 0x83eb, 0x0020, 0x9026, 0x080c, 0xd4b2,
 	0x0c30, 0x080c, 0x1022, 0x090c, 0x0d65, 0x6003, 0x0007, 0xa867,
 	0x010d, 0x9006, 0xa802, 0xa86a, 0xac8a, 0x2c00, 0xa88e, 0x6008,
 	0xa8e2, 0x6010, 0x2058, 0xb8a0, 0x7130, 0xa97a, 0x0016, 0xa876,
-	0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c, 0x698f,
-	0x001e, 0x080c, 0xd55b, 0x1904, 0xc93a, 0x9486, 0x2000, 0x1130,
-	0x2019, 0x0017, 0x080c, 0xd1c9, 0x0804, 0xc93a, 0x9486, 0x0200,
-	0x1120, 0x080c, 0xd159, 0x0804, 0xc93a, 0x9486, 0x0400, 0x0120,
-	0x9486, 0x1000, 0x1904, 0xc93a, 0x2019, 0x0002, 0x080c, 0xd178,
-	0x0804, 0xc93a, 0x2069, 0x1a3f, 0x6a00, 0xd284, 0x0904, 0xc9a4,
-	0x9284, 0x0300, 0x1904, 0xc99d, 0x6804, 0x9005, 0x0904, 0xc985,
-	0x2d78, 0x6003, 0x0007, 0x080c, 0x103b, 0x0904, 0xc946, 0x7800,
+	0xa87f, 0x0000, 0xa883, 0x0000, 0xa887, 0x0036, 0x080c, 0x6996,
+	0x001e, 0x080c, 0xd57d, 0x1904, 0xc95a, 0x9486, 0x2000, 0x1130,
+	0x2019, 0x0017, 0x080c, 0xd1eb, 0x0804, 0xc95a, 0x9486, 0x0200,
+	0x1120, 0x080c, 0xd17b, 0x0804, 0xc95a, 0x9486, 0x0400, 0x0120,
+	0x9486, 0x1000, 0x1904, 0xc95a, 0x2019, 0x0002, 0x080c, 0xd19a,
+	0x0804, 0xc95a, 0x2069, 0x1a3f, 0x6a00, 0xd284, 0x0904, 0xc9c4,
+	0x9284, 0x0300, 0x1904, 0xc9bd, 0x6804, 0x9005, 0x0904, 0xc9a5,
+	0x2d78, 0x6003, 0x0007, 0x080c, 0x103b, 0x0904, 0xc966, 0x7800,
 	0xd08c, 0x1118, 0x7804, 0x8001, 0x7806, 0x6017, 0x0000, 0x2001,
-	0x180f, 0x2004, 0xd084, 0x1904, 0xc9a8, 0x9006, 0xa802, 0xa867,
+	0x180f, 0x2004, 0xd084, 0x1904, 0xc9c8, 0x9006, 0xa802, 0xa867,
 	0x0116, 0xa86a, 0x6008, 0xa8e2, 0x2c00, 0xa87a, 0x6010, 0x2058,
 	0xb8a0, 0x7130, 0xa9b6, 0xa876, 0xb928, 0xa9ba, 0xb92c, 0xa9be,
 	0xb930, 0xa9c2, 0xb934, 0xa9c6, 0xa883, 0x003d, 0x7044, 0x9084,
-	0x0003, 0x9080, 0xc942, 0x2005, 0xa87e, 0x20a9, 0x000a, 0x2001,
+	0x0003, 0x9080, 0xc962, 0x2005, 0xa87e, 0x20a9, 0x000a, 0x2001,
 	0x0270, 0xaa5c, 0x9290, 0x0021, 0x2009, 0x0205, 0x200b, 0x0080,
 	0x20e1, 0x0000, 0xab60, 0x23e8, 0x2098, 0x22a0, 0x4003, 0x200b,
 	0x0000, 0x2001, 0x027a, 0x200c, 0xa9b2, 0x8000, 0x200c, 0xa9ae,
-	0x080c, 0x6992, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de, 0x00be,
+	0x080c, 0x6999, 0x002e, 0x004e, 0x00fe, 0x00ee, 0x00de, 0x00be,
 	0x009e, 0x0005, 0x0000, 0x0080, 0x0040, 0x0000, 0x2001, 0x1810,
-	0x2004, 0xd084, 0x0120, 0x080c, 0x1022, 0x1904, 0xc8ef, 0x6017,
+	0x2004, 0xd084, 0x0120, 0x080c, 0x1022, 0x1904, 0xc90f, 0x6017,
 	0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009, 0xa022, 0x080c,
-	0x84a9, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00, 0x9086,
+	0x84d1, 0x0c00, 0x2069, 0x0260, 0x6848, 0x9084, 0xff00, 0x9086,
 	0x1200, 0x1198, 0x686c, 0x9084, 0x00ff, 0x0016, 0x6114, 0x918c,
 	0xf700, 0x910d, 0x6116, 0x001e, 0x6003, 0x0001, 0x6007, 0x0043,
-	0x2009, 0xa025, 0x080c, 0x84a9, 0x0828, 0x6868, 0x602e, 0x686c,
+	0x2009, 0xa025, 0x080c, 0x84d1, 0x0828, 0x6868, 0x602e, 0x686c,
 	0x6032, 0x6017, 0xf200, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009,
-	0xa022, 0x080c, 0x84a9, 0x0804, 0xc93a, 0x2001, 0x180e, 0x2004,
-	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d1, 0x6017, 0xf300,
+	0xa022, 0x080c, 0x84d1, 0x0804, 0xc95a, 0x2001, 0x180e, 0x2004,
+	0xd0ec, 0x0120, 0x2011, 0x8049, 0x080c, 0x48d8, 0x6017, 0xf300,
 	0x0010, 0x6017, 0xf100, 0x6003, 0x0001, 0x6007, 0x0041, 0x2009,
-	0xa022, 0x080c, 0x84a9, 0x0804, 0xc93a, 0x6017, 0xf500, 0x0c98,
-	0x6017, 0xf600, 0x0804, 0xc95a, 0x6017, 0xf200, 0x0804, 0xc95a,
+	0xa022, 0x080c, 0x84d1, 0x0804, 0xc95a, 0x6017, 0xf500, 0x0c98,
+	0x6017, 0xf600, 0x0804, 0xc97a, 0x6017, 0xf200, 0x0804, 0xc97a,
 	0xa867, 0x0146, 0xa86b, 0x0000, 0x6008, 0xa886, 0x2c00, 0xa87a,
-	0x7044, 0x9084, 0x0003, 0x9080, 0xc942, 0x2005, 0xa87e, 0x2928,
+	0x7044, 0x9084, 0x0003, 0x9080, 0xc962, 0x2005, 0xa87e, 0x2928,
 	0x6010, 0x2058, 0xb8a0, 0xa876, 0xb828, 0xa88a, 0xb82c, 0xa88e,
 	0xb830, 0xa892, 0xb834, 0xa896, 0xa883, 0x003d, 0x2009, 0x0205,
 	0x2104, 0x9085, 0x0080, 0x200a, 0x20e1, 0x0000, 0x2011, 0x0210,
 	0x2214, 0x9294, 0x0fff, 0xaaa2, 0x9282, 0x0111, 0x1a0c, 0x0d65,
 	0x8210, 0x821c, 0x2001, 0x026c, 0x2098, 0xa860, 0x20e8, 0xa85c,
-	0x9080, 0x0029, 0x20a0, 0x2011, 0xca24, 0x2041, 0x0001, 0x223d,
+	0x9080, 0x0029, 0x20a0, 0x2011, 0xca44, 0x2041, 0x0001, 0x223d,
 	0x9784, 0x00ff, 0x9322, 0x1208, 0x2300, 0x20a8, 0x4003, 0x931a,
 	0x0530, 0x8210, 0xd7fc, 0x1130, 0x8d68, 0x2d0a, 0x2001, 0x0260,
 	0x2098, 0x0c68, 0x2950, 0x080c, 0x103b, 0x0170, 0x2900, 0xb002,
 	0xa867, 0x0147, 0xa86b, 0x0000, 0xa860, 0x20e8, 0xa85c, 0x9080,
 	0x001b, 0x20a0, 0x8840, 0x08d8, 0x2548, 0xa800, 0x902d, 0x0118,
-	0x080c, 0x1054, 0x0cc8, 0x080c, 0x1054, 0x0804, 0xc946, 0x2548,
+	0x080c, 0x1054, 0x0cc8, 0x080c, 0x1054, 0x0804, 0xc966, 0x2548,
 	0x8847, 0x9885, 0x0046, 0xa866, 0x2009, 0x0205, 0x200b, 0x0000,
-	0x080c, 0xd1fc, 0x0804, 0xc93a, 0x8010, 0x0004, 0x801a, 0x0006,
+	0x080c, 0xd21e, 0x0804, 0xc95a, 0x8010, 0x0004, 0x801a, 0x0006,
 	0x8018, 0x0008, 0x8016, 0x000a, 0x8014, 0x9186, 0x0013, 0x1160,
 	0x6004, 0x908a, 0x0057, 0x1a0c, 0x0d65, 0x9082, 0x0040, 0x0a0c,
-	0x0d65, 0x2008, 0x0804, 0xcaaf, 0x9186, 0x0051, 0x0108, 0x0040,
-	0x080c, 0x9a9c, 0x01e8, 0x9086, 0x0002, 0x0904, 0xcaf6, 0x00c0,
+	0x0d65, 0x2008, 0x0804, 0xcacf, 0x9186, 0x0051, 0x0108, 0x0040,
+	0x080c, 0x9ab7, 0x01e8, 0x9086, 0x0002, 0x0904, 0xcb16, 0x00c0,
 	0x9186, 0x0027, 0x0180, 0x9186, 0x0048, 0x0128, 0x9186, 0x0014,
-	0x0150, 0x190c, 0x0d65, 0x080c, 0x9a9c, 0x0150, 0x9086, 0x0004,
-	0x0904, 0xcb93, 0x0028, 0x6004, 0x9082, 0x0040, 0x2008, 0x001a,
-	0x080c, 0x9c87, 0x0005, 0xca76, 0xca78, 0xca78, 0xca9f, 0xca76,
-	0xca76, 0xca76, 0xca76, 0xca76, 0xca76, 0xca76, 0xca76, 0xca76,
-	0xca76, 0xca76, 0xca76, 0xca76, 0xca76, 0xca76, 0x080c, 0x0d65,
-	0x080c, 0x884c, 0x080c, 0x890e, 0x0036, 0x0096, 0x6014, 0x904d,
-	0x01d8, 0x080c, 0xb82c, 0x01c0, 0x6003, 0x0002, 0x6010, 0x00b6,
+	0x0150, 0x190c, 0x0d65, 0x080c, 0x9ab7, 0x0150, 0x9086, 0x0004,
+	0x0904, 0xcbb3, 0x0028, 0x6004, 0x9082, 0x0040, 0x2008, 0x001a,
+	0x080c, 0x9ca2, 0x0005, 0xca96, 0xca98, 0xca98, 0xcabf, 0xca96,
+	0xca96, 0xca96, 0xca96, 0xca96, 0xca96, 0xca96, 0xca96, 0xca96,
+	0xca96, 0xca96, 0xca96, 0xca96, 0xca96, 0xca96, 0x080c, 0x0d65,
+	0x080c, 0x8874, 0x080c, 0x8936, 0x0036, 0x0096, 0x6014, 0x904d,
+	0x01d8, 0x080c, 0xb847, 0x01c0, 0x6003, 0x0002, 0x6010, 0x00b6,
 	0x2058, 0xb800, 0x00be, 0xd0bc, 0x1178, 0x2019, 0x0004, 0x080c,
-	0xd1fc, 0x6017, 0x0000, 0x6018, 0x9005, 0x1120, 0x2001, 0x1958,
+	0xd21e, 0x6017, 0x0000, 0x6018, 0x9005, 0x1120, 0x2001, 0x1958,
 	0x2004, 0x601a, 0x6003, 0x0007, 0x009e, 0x003e, 0x0005, 0x0096,
-	0x080c, 0x884c, 0x080c, 0x890e, 0x080c, 0xb82c, 0x0120, 0x6014,
-	0x2048, 0x080c, 0x1054, 0x080c, 0x9c06, 0x009e, 0x0005, 0x0002,
-	0xcac3, 0xcad8, 0xcac5, 0xcaed, 0xcac3, 0xcac3, 0xcac3, 0xcac3,
-	0xcac3, 0xcac3, 0xcac3, 0xcac3, 0xcac3, 0xcac3, 0xcac3, 0xcac3,
-	0xcac3, 0xcac3, 0xcac3, 0x080c, 0x0d65, 0x0096, 0x6014, 0x2048,
+	0x080c, 0x8874, 0x080c, 0x8936, 0x080c, 0xb847, 0x0120, 0x6014,
+	0x2048, 0x080c, 0x1054, 0x080c, 0x9c21, 0x009e, 0x0005, 0x0002,
+	0xcae3, 0xcaf8, 0xcae5, 0xcb0d, 0xcae3, 0xcae3, 0xcae3, 0xcae3,
+	0xcae3, 0xcae3, 0xcae3, 0xcae3, 0xcae3, 0xcae3, 0xcae3, 0xcae3,
+	0xcae3, 0xcae3, 0xcae3, 0x080c, 0x0d65, 0x0096, 0x6014, 0x2048,
 	0xa87c, 0xd0b4, 0x0138, 0x6003, 0x0007, 0x2009, 0x0043, 0x080c,
-	0x9c6a, 0x0010, 0x6003, 0x0004, 0x080c, 0x890e, 0x009e, 0x0005,
-	0x080c, 0xb82c, 0x0138, 0x6114, 0x0096, 0x2148, 0xa97c, 0x009e,
-	0xd1ec, 0x1138, 0x080c, 0x8398, 0x080c, 0x9bcc, 0x080c, 0x890e,
-	0x0005, 0x080c, 0xd454, 0x0db0, 0x0cc8, 0x6003, 0x0001, 0x6007,
-	0x0041, 0x2009, 0xa022, 0x080c, 0x84a9, 0x0005, 0x9182, 0x0040,
-	0x0002, 0xcb0c, 0xcb0e, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c,
-	0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c, 0xcb0c,
-	0xcb0c, 0xcb0c, 0xcb0f, 0xcb0c, 0x080c, 0x0d65, 0x0005, 0x00d6,
-	0x080c, 0x8398, 0x00de, 0x080c, 0xd4ac, 0x080c, 0x9bcc, 0x0005,
-	0x9182, 0x0040, 0x0002, 0xcb2e, 0xcb2e, 0xcb2e, 0xcb2e, 0xcb2e,
-	0xcb2e, 0xcb2e, 0xcb2e, 0xcb2e, 0xcb30, 0xcb5b, 0xcb2e, 0xcb2e,
-	0xcb2e, 0xcb2e, 0xcb5b, 0xcb2e, 0xcb2e, 0xcb2e, 0x080c, 0x0d65,
+	0x9c85, 0x0010, 0x6003, 0x0004, 0x080c, 0x8936, 0x009e, 0x0005,
+	0x080c, 0xb847, 0x0138, 0x6114, 0x0096, 0x2148, 0xa97c, 0x009e,
+	0xd1ec, 0x1138, 0x080c, 0x83c0, 0x080c, 0x9be7, 0x080c, 0x8936,
+	0x0005, 0x080c, 0xd476, 0x0db0, 0x0cc8, 0x6003, 0x0001, 0x6007,
+	0x0041, 0x2009, 0xa022, 0x080c, 0x84d1, 0x0005, 0x9182, 0x0040,
+	0x0002, 0xcb2c, 0xcb2e, 0xcb2c, 0xcb2c, 0xcb2c, 0xcb2c, 0xcb2c,
+	0xcb2c, 0xcb2c, 0xcb2c, 0xcb2c, 0xcb2c, 0xcb2c, 0xcb2c, 0xcb2c,
+	0xcb2c, 0xcb2c, 0xcb2f, 0xcb2c, 0x080c, 0x0d65, 0x0005, 0x00d6,
+	0x080c, 0x83c0, 0x00de, 0x080c, 0xd4ce, 0x080c, 0x9be7, 0x0005,
+	0x9182, 0x0040, 0x0002, 0xcb4e, 0xcb4e, 0xcb4e, 0xcb4e, 0xcb4e,
+	0xcb4e, 0xcb4e, 0xcb4e, 0xcb4e, 0xcb50, 0xcb7b, 0xcb4e, 0xcb4e,
+	0xcb4e, 0xcb4e, 0xcb7b, 0xcb4e, 0xcb4e, 0xcb4e, 0x080c, 0x0d65,
 	0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x908c, 0x0003,
 	0x918e, 0x0002, 0x0180, 0x6144, 0xd1e4, 0x1168, 0x2009, 0x0041,
-	0x009e, 0x0804, 0xcc1b, 0x6003, 0x0007, 0x601b, 0x0000, 0x080c,
-	0x8398, 0x009e, 0x0005, 0x6014, 0x2048, 0xa97c, 0xd1ec, 0x1130,
-	0x080c, 0x8398, 0x080c, 0x9bcc, 0x009e, 0x0005, 0x080c, 0xd454,
+	0x009e, 0x0804, 0xcc3b, 0x6003, 0x0007, 0x601b, 0x0000, 0x080c,
+	0x83c0, 0x009e, 0x0005, 0x6014, 0x2048, 0xa97c, 0xd1ec, 0x1130,
+	0x080c, 0x83c0, 0x080c, 0x9be7, 0x009e, 0x0005, 0x080c, 0xd476,
 	0x0db8, 0x009e, 0x0005, 0x2001, 0x180c, 0x200c, 0xc1d4, 0x2102,
-	0x0036, 0x080c, 0x88a9, 0x080c, 0x890e, 0x6014, 0x0096, 0x2048,
+	0x0036, 0x080c, 0x88d1, 0x080c, 0x8936, 0x6014, 0x0096, 0x2048,
 	0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0bc, 0x0188, 0xa87c,
 	0x9084, 0x0003, 0x9086, 0x0002, 0x0140, 0xa8ac, 0x6330, 0x931a,
 	0x6332, 0xa8b0, 0x632c, 0x931b, 0x632e, 0x6003, 0x0002, 0x0080,
-	0x2019, 0x0004, 0x080c, 0xd1fc, 0x6018, 0x9005, 0x1128, 0x2001,
+	0x2019, 0x0004, 0x080c, 0xd21e, 0x6018, 0x9005, 0x1128, 0x2001,
 	0x1958, 0x2004, 0x8003, 0x601a, 0x6017, 0x0000, 0x6003, 0x0007,
-	0x009e, 0x003e, 0x0005, 0x9182, 0x0040, 0x0002, 0xcbaa, 0xcbaa,
-	0xcbaa, 0xcbaa, 0xcbaa, 0xcbaa, 0xcbaa, 0xcbaa, 0xcbac, 0xcbaa,
-	0xcbaa, 0xcbaa, 0xcbaa, 0xcbaa, 0xcbaa, 0xcbaa, 0xcbaa, 0xcbaa,
-	0xcbaa, 0xcbf7, 0x080c, 0x0d65, 0x6014, 0x0096, 0x2048, 0xa834,
+	0x009e, 0x003e, 0x0005, 0x9182, 0x0040, 0x0002, 0xcbca, 0xcbca,
+	0xcbca, 0xcbca, 0xcbca, 0xcbca, 0xcbca, 0xcbca, 0xcbcc, 0xcbca,
+	0xcbca, 0xcbca, 0xcbca, 0xcbca, 0xcbca, 0xcbca, 0xcbca, 0xcbca,
+	0xcbca, 0xcc17, 0x080c, 0x0d65, 0x6014, 0x0096, 0x2048, 0xa834,
 	0xaa38, 0x6110, 0x00b6, 0x2158, 0xb900, 0x00be, 0xd1bc, 0x1190,
 	0x920d, 0x1518, 0xa87c, 0xd0fc, 0x0128, 0x2009, 0x0041, 0x009e,
-	0x0804, 0xcc1b, 0x6003, 0x0007, 0x601b, 0x0000, 0x080c, 0x8398,
+	0x0804, 0xcc3b, 0x6003, 0x0007, 0x601b, 0x0000, 0x080c, 0x83c0,
 	0x009e, 0x0005, 0x6124, 0xd1f4, 0x1d58, 0x0006, 0x0046, 0xacac,
 	0x9422, 0xa9b0, 0x2200, 0x910b, 0x6030, 0x9420, 0x6432, 0x602c,
 	0x9109, 0x612e, 0x004e, 0x000e, 0x08d8, 0x6110, 0x00b6, 0x2158,
 	0xb900, 0x00be, 0xd1bc, 0x1178, 0x2009, 0x180e, 0x210c, 0xd19c,
 	0x0118, 0x6003, 0x0007, 0x0010, 0x6003, 0x0006, 0x00e9, 0x080c,
-	0x839a, 0x009e, 0x0005, 0x6003, 0x0002, 0x009e, 0x0005, 0x6024,
-	0xd0f4, 0x0128, 0x080c, 0x1595, 0x1904, 0xcbac, 0x0005, 0x6014,
+	0x83c2, 0x009e, 0x0005, 0x6003, 0x0002, 0x009e, 0x0005, 0x6024,
+	0xd0f4, 0x0128, 0x080c, 0x1595, 0x1904, 0xcbcc, 0x0005, 0x6014,
 	0x0096, 0x2048, 0xa834, 0xa938, 0x009e, 0x9105, 0x1120, 0x080c,
-	0x1595, 0x1904, 0xcbac, 0x0005, 0xd2fc, 0x0140, 0x8002, 0x8000,
+	0x1595, 0x1904, 0xcbcc, 0x0005, 0xd2fc, 0x0140, 0x8002, 0x8000,
 	0x8212, 0x9291, 0x0000, 0x2009, 0x0009, 0x0010, 0x2009, 0x0015,
 	0xaa9a, 0xa896, 0x0005, 0x9182, 0x0040, 0x0208, 0x0062, 0x9186,
 	0x0013, 0x0120, 0x9186, 0x0014, 0x190c, 0x0d65, 0x6024, 0xd0dc,
-	0x090c, 0x0d65, 0x0005, 0xcc3e, 0xcc4a, 0xcc56, 0xcc62, 0xcc3e,
-	0xcc3e, 0xcc3e, 0xcc3e, 0xcc45, 0xcc40, 0xcc40, 0xcc3e, 0xcc3e,
-	0xcc3e, 0xcc3e, 0xcc40, 0xcc3e, 0xcc40, 0xcc3e, 0x080c, 0x0d65,
+	0x090c, 0x0d65, 0x0005, 0xcc5e, 0xcc6a, 0xcc76, 0xcc82, 0xcc5e,
+	0xcc5e, 0xcc5e, 0xcc5e, 0xcc65, 0xcc60, 0xcc60, 0xcc5e, 0xcc5e,
+	0xcc5e, 0xcc5e, 0xcc60, 0xcc5e, 0xcc60, 0xcc5e, 0x080c, 0x0d65,
 	0x6024, 0xd0dc, 0x090c, 0x0d65, 0x0005, 0x6014, 0x9005, 0x190c,
 	0x0d65, 0x0005, 0x6003, 0x0001, 0x6106, 0x0126, 0x2091, 0x8000,
-	0x2009, 0xa022, 0x080c, 0x848b, 0x012e, 0x0005, 0x6003, 0x0004,
-	0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa001, 0x080c, 0x84a9,
+	0x2009, 0xa022, 0x080c, 0x84b3, 0x012e, 0x0005, 0x6003, 0x0004,
+	0x6106, 0x0126, 0x2091, 0x8000, 0x2009, 0xa001, 0x080c, 0x84d1,
 	0x012e, 0x0005, 0x6003, 0x0003, 0x6106, 0x080c, 0x1aa5, 0x0126,
 	0x2091, 0x8000, 0x6014, 0x0096, 0x2048, 0xa87c, 0xd0fc, 0x0188,
 	0x9084, 0x0003, 0x9086, 0x0002, 0x01a0, 0x6024, 0xd0cc, 0x1148,
 	0xd0c4, 0x1138, 0xa8a8, 0x9005, 0x1120, 0x6144, 0x918d, 0xb035,
-	0x0018, 0x6144, 0x918d, 0xa035, 0x009e, 0x080c, 0x84f0, 0x012e,
+	0x0018, 0x6144, 0x918d, 0xa035, 0x009e, 0x080c, 0x8518, 0x012e,
 	0x0005, 0x6144, 0x918d, 0xa032, 0x0cb8, 0x0126, 0x2091, 0x8000,
 	0x0036, 0x0096, 0x9182, 0x0040, 0x0023, 0x009e, 0x003e, 0x012e,
-	0x0005, 0xcca9, 0xccab, 0xccc0, 0xccda, 0xcca9, 0xcca9, 0xcca9,
-	0xcca9, 0xcca9, 0xcca9, 0xcca9, 0xcca9, 0xcca9, 0xcca9, 0xcca9,
-	0xcca9, 0x080c, 0x0d65, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0510,
+	0x0005, 0xccc9, 0xcccb, 0xcce0, 0xccfa, 0xccc9, 0xccc9, 0xccc9,
+	0xccc9, 0xccc9, 0xccc9, 0xccc9, 0xccc9, 0xccc9, 0xccc9, 0xccc9,
+	0xccc9, 0x080c, 0x0d65, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0510,
 	0x909c, 0x0003, 0x939e, 0x0003, 0x01e8, 0x6003, 0x0001, 0x6106,
-	0x0126, 0x2091, 0x8000, 0x2009, 0xa022, 0x080c, 0x84a9, 0x0470,
+	0x0126, 0x2091, 0x8000, 0x2009, 0xa022, 0x080c, 0x84d1, 0x0470,
 	0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0168, 0x909c, 0x0003, 0x939e,
 	0x0003, 0x0140, 0x6003, 0x0001, 0x6106, 0x2009, 0xa001, 0x080c,
-	0x84a9, 0x00e0, 0x901e, 0x6316, 0x631a, 0x2019, 0x0004, 0x080c,
-	0xd1fc, 0x00a0, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0d98, 0x909c,
+	0x84d1, 0x00e0, 0x901e, 0x6316, 0x631a, 0x2019, 0x0004, 0x080c,
+	0xd21e, 0x00a0, 0x6014, 0x2048, 0xa87c, 0xd0fc, 0x0d98, 0x909c,
 	0x0003, 0x939e, 0x0003, 0x0d70, 0x6003, 0x0003, 0x6106, 0x080c,
-	0x1aa5, 0x6144, 0x918d, 0xa035, 0x080c, 0x84f0, 0x0005, 0x080c,
-	0x884c, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xd4f8,
-	0x0036, 0x2019, 0x0029, 0x080c, 0xd1fc, 0x003e, 0x009e, 0x080c,
-	0x9c06, 0x080c, 0x890e, 0x0005, 0x080c, 0x88a9, 0x6114, 0x81ff,
-	0x0158, 0x0096, 0x2148, 0x080c, 0xd4f8, 0x0036, 0x2019, 0x0029,
-	0x080c, 0xd1fc, 0x003e, 0x009e, 0x080c, 0x9c06, 0x0005, 0x9182,
-	0x0085, 0x0002, 0xcd29, 0xcd27, 0xcd27, 0xcd35, 0xcd27, 0xcd27,
-	0xcd27, 0xcd27, 0xcd27, 0xcd27, 0xcd27, 0xcd27, 0xcd27, 0x080c,
+	0x1aa5, 0x6144, 0x918d, 0xa035, 0x080c, 0x8518, 0x0005, 0x080c,
+	0x8874, 0x6114, 0x81ff, 0x0158, 0x0096, 0x2148, 0x080c, 0xd51a,
+	0x0036, 0x2019, 0x0029, 0x080c, 0xd21e, 0x003e, 0x009e, 0x080c,
+	0x9c21, 0x080c, 0x8936, 0x0005, 0x080c, 0x88d1, 0x6114, 0x81ff,
+	0x0158, 0x0096, 0x2148, 0x080c, 0xd51a, 0x0036, 0x2019, 0x0029,
+	0x080c, 0xd21e, 0x003e, 0x009e, 0x080c, 0x9c21, 0x0005, 0x9182,
+	0x0085, 0x0002, 0xcd49, 0xcd47, 0xcd47, 0xcd55, 0xcd47, 0xcd47,
+	0xcd47, 0xcd47, 0xcd47, 0xcd47, 0xcd47, 0xcd47, 0xcd47, 0x080c,
 	0x0d65, 0x6003, 0x000b, 0x6106, 0x0126, 0x2091, 0x8000, 0x2009,
-	0x8020, 0x080c, 0x84a9, 0x012e, 0x0005, 0x0026, 0x00e6, 0x080c,
-	0xd44b, 0x0118, 0x080c, 0x9bcc, 0x0440, 0x2071, 0x0260, 0x7224,
+	0x8020, 0x080c, 0x84d1, 0x012e, 0x0005, 0x0026, 0x00e6, 0x080c,
+	0xd46d, 0x0118, 0x080c, 0x9be7, 0x0440, 0x2071, 0x0260, 0x7224,
 	0x6216, 0x2001, 0x180e, 0x2004, 0xd0e4, 0x0150, 0x6010, 0x00b6,
-	0x2058, 0xbca0, 0x00be, 0x2c00, 0x2011, 0x014e, 0x080c, 0x9ef8,
-	0x7220, 0x080c, 0xd092, 0x0118, 0x6007, 0x0086, 0x0040, 0x6007,
+	0x2058, 0xbca0, 0x00be, 0x2c00, 0x2011, 0x014e, 0x080c, 0x9f13,
+	0x7220, 0x080c, 0xd0b4, 0x0118, 0x6007, 0x0086, 0x0040, 0x6007,
 	0x0087, 0x7224, 0x9296, 0xffff, 0x1110, 0x6007, 0x0086, 0x6003,
-	0x0001, 0x2009, 0x8020, 0x080c, 0x84a9, 0x00ee, 0x002e, 0x0005,
+	0x0001, 0x2009, 0x8020, 0x080c, 0x84d1, 0x00ee, 0x002e, 0x0005,
 	0x9186, 0x0013, 0x1160, 0x6004, 0x908a, 0x0085, 0x0a0c, 0x0d65,
 	0x908a, 0x0092, 0x1a0c, 0x0d65, 0x9082, 0x0085, 0x00a2, 0x9186,
-	0x0027, 0x0130, 0x9186, 0x0014, 0x0118, 0x080c, 0x9c87, 0x0050,
-	0x2001, 0x0007, 0x080c, 0x61e6, 0x080c, 0x884c, 0x080c, 0x9c06,
-	0x080c, 0x890e, 0x0005, 0xcd98, 0xcd9a, 0xcd9a, 0xcd98, 0xcd98,
-	0xcd98, 0xcd98, 0xcd98, 0xcd98, 0xcd98, 0xcd98, 0xcd98, 0xcd98,
-	0x080c, 0x0d65, 0x080c, 0x9c06, 0x080c, 0x890e, 0x0005, 0x9182,
+	0x0027, 0x0130, 0x9186, 0x0014, 0x0118, 0x080c, 0x9ca2, 0x0050,
+	0x2001, 0x0007, 0x080c, 0x61ed, 0x080c, 0x8874, 0x080c, 0x9c21,
+	0x080c, 0x8936, 0x0005, 0xcdb8, 0xcdba, 0xcdba, 0xcdb8, 0xcdb8,
+	0xcdb8, 0xcdb8, 0xcdb8, 0xcdb8, 0xcdb8, 0xcdb8, 0xcdb8, 0xcdb8,
+	0x080c, 0x0d65, 0x080c, 0x9c21, 0x080c, 0x8936, 0x0005, 0x9182,
 	0x0085, 0x0a0c, 0x0d65, 0x9182, 0x0092, 0x1a0c, 0x0d65, 0x9182,
-	0x0085, 0x0002, 0xcdb7, 0xcdb7, 0xcdb7, 0xcdb9, 0xcdb7, 0xcdb7,
-	0xcdb7, 0xcdb7, 0xcdb7, 0xcdb7, 0xcdb7, 0xcdb7, 0xcdb7, 0x080c,
+	0x0085, 0x0002, 0xcdd7, 0xcdd7, 0xcdd7, 0xcdd9, 0xcdd7, 0xcdd7,
+	0xcdd7, 0xcdd7, 0xcdd7, 0xcdd7, 0xcdd7, 0xcdd7, 0xcdd7, 0x080c,
 	0x0d65, 0x0005, 0x9186, 0x0013, 0x0148, 0x9186, 0x0014, 0x0130,
-	0x9186, 0x0027, 0x0118, 0x080c, 0x9c87, 0x0020, 0x080c, 0x884c,
-	0x080c, 0x9c06, 0x0005, 0x0036, 0x080c, 0xd4ac, 0x604b, 0x0000,
+	0x9186, 0x0027, 0x0118, 0x080c, 0x9ca2, 0x0020, 0x080c, 0x8874,
+	0x080c, 0x9c21, 0x0005, 0x0036, 0x080c, 0xd4ce, 0x604b, 0x0000,
 	0x2019, 0x000b, 0x0031, 0x6023, 0x0006, 0x6003, 0x0007, 0x003e,
 	0x0005, 0x0126, 0x0036, 0x2091, 0x8000, 0x2001, 0x0382, 0x2004,
-	0x9084, 0x0007, 0x0006, 0x9086, 0x0003, 0x0110, 0x080c, 0x98ad,
-	0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0x9367, 0x009e, 0x008e,
-	0x1550, 0x0076, 0x2c38, 0x080c, 0x9412, 0x007e, 0x1520, 0x6000,
+	0x9084, 0x0007, 0x0006, 0x9086, 0x0003, 0x0110, 0x080c, 0x98c8,
+	0x0086, 0x2c40, 0x0096, 0x904e, 0x080c, 0x9382, 0x009e, 0x008e,
+	0x1550, 0x0076, 0x2c38, 0x080c, 0x942d, 0x007e, 0x1520, 0x6000,
 	0x9086, 0x0000, 0x0500, 0x6020, 0x9086, 0x0007, 0x01e0, 0x0096,
-	0x601c, 0xd084, 0x0140, 0x080c, 0xd4ac, 0x080c, 0xbf5e, 0x080c,
-	0x1914, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xb82c, 0x0110,
-	0x080c, 0xd1fc, 0x009e, 0x6017, 0x0000, 0x080c, 0xd4ac, 0x6023,
-	0x0007, 0x080c, 0xbf5e, 0x000e, 0x9086, 0x0003, 0x0110, 0x080c,
-	0x98c9, 0x003e, 0x012e, 0x0005, 0x00f6, 0x00c6, 0x00b6, 0x0036,
-	0x0156, 0x2079, 0x0260, 0x7938, 0x783c, 0x080c, 0x2424, 0x15d8,
-	0x0016, 0x00c6, 0x080c, 0x6269, 0x15a0, 0x001e, 0x00c6, 0x2160,
-	0x080c, 0xbf5b, 0x00ce, 0x002e, 0x0026, 0x0016, 0x080c, 0x98ad,
-	0x2019, 0x0029, 0x080c, 0x94d9, 0x080c, 0x8613, 0x0076, 0x903e,
-	0x080c, 0x8502, 0x007e, 0x001e, 0x0076, 0x903e, 0x080c, 0xcfa6,
-	0x007e, 0x080c, 0x98c9, 0x0026, 0xba04, 0x9294, 0xff00, 0x8217,
+	0x601c, 0xd084, 0x0140, 0x080c, 0xd4ce, 0x080c, 0xbf79, 0x080c,
+	0x1914, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c, 0xb847, 0x0110,
+	0x080c, 0xd21e, 0x009e, 0x6017, 0x0000, 0x080c, 0xd4ce, 0x6023,
+	0x0007, 0x080c, 0xbf79, 0x000e, 0x9086, 0x0003, 0x0110, 0x080c,
+	0x98e4, 0x003e, 0x012e, 0x0005, 0x00f6, 0x00c6, 0x00b6, 0x0036,
+	0x0156, 0x2079, 0x0260, 0x7938, 0x783c, 0x080c, 0x2424, 0x15e8,
+	0x0016, 0x00c6, 0x080c, 0x6270, 0x15b0, 0x001e, 0x00c6, 0x2160,
+	0x080c, 0xbf76, 0x00ce, 0x002e, 0x0026, 0x0016, 0x080c, 0x98c8,
+	0x2019, 0x0029, 0x080c, 0x94f4, 0x080c, 0x863b, 0x0076, 0x903e,
+	0x080c, 0x852a, 0x007e, 0x001e, 0x0076, 0x903e, 0x080c, 0xcfc8,
+	0x007e, 0x080c, 0x98e4, 0x0026, 0xba04, 0x9294, 0xff00, 0x8217,
 	0x9286, 0x0006, 0x0118, 0x9286, 0x0004, 0x1118, 0xbaa0, 0x080c,
-	0x30d5, 0x002e, 0x001e, 0x080c, 0x5cef, 0xbe12, 0xbd16, 0x9006,
-	0x0010, 0x00ce, 0x001e, 0x015e, 0x003e, 0x00be, 0x00ce, 0x00fe,
-	0x0005, 0x00c6, 0x00d6, 0x00b6, 0x0016, 0x2009, 0x1823, 0x2104,
-	0x9086, 0x0074, 0x1904, 0xceca, 0x2069, 0x0260, 0x6944, 0x9182,
-	0x0100, 0x06e0, 0x6940, 0x9184, 0x8000, 0x0904, 0xcec7, 0x2001,
-	0x194d, 0x2004, 0x9005, 0x1140, 0x6010, 0x2058, 0xb884, 0x9005,
-	0x0118, 0x9184, 0x0800, 0x0598, 0x6948, 0x918a, 0x0001, 0x0648,
-	0x080c, 0xd560, 0x0118, 0x6978, 0xd1fc, 0x11b8, 0x2009, 0x0205,
-	0x200b, 0x0001, 0x693c, 0x81ff, 0x1198, 0x6944, 0x9182, 0x0100,
-	0x02a8, 0x6940, 0x81ff, 0x1178, 0x6948, 0x918a, 0x0001, 0x0288,
-	0x6950, 0x918a, 0x0001, 0x0298, 0x00d0, 0x6017, 0x0100, 0x00a0,
-	0x6017, 0x0300, 0x0088, 0x6017, 0x0500, 0x0070, 0x6017, 0x0700,
-	0x0058, 0x6017, 0x0900, 0x0040, 0x6017, 0x0b00, 0x0028, 0x6017,
-	0x0f00, 0x0010, 0x6017, 0x2d00, 0x9085, 0x0001, 0x0008, 0x9006,
-	0x001e, 0x00be, 0x00de, 0x00ce, 0x0005, 0x00c6, 0x00b6, 0x0026,
-	0x0036, 0x0156, 0x6210, 0x2258, 0xbb04, 0x9394, 0x00ff, 0x9286,
-	0x0006, 0x0180, 0x9286, 0x0004, 0x0168, 0x9394, 0xff00, 0x8217,
-	0x9286, 0x0006, 0x0138, 0x9286, 0x0004, 0x0120, 0x080c, 0x6278,
-	0x0804, 0xcf35, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48,
-	0x2019, 0x000a, 0x080c, 0xabc4, 0x009e, 0x15c0, 0x2011, 0x027a,
-	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xabc4,
-	0x009e, 0x1560, 0x0046, 0x0016, 0xbaa0, 0x2220, 0x9006, 0x2009,
-	0x1854, 0x210c, 0x0038, 0x2009, 0x0029, 0x080c, 0xd251, 0xb800,
-	0xc0e5, 0xb802, 0x080c, 0x98ad, 0x2019, 0x0029, 0x080c, 0x8613,
-	0x0076, 0x2039, 0x0000, 0x080c, 0x8502, 0x2c08, 0x080c, 0xcfa6,
-	0x007e, 0x080c, 0x98c9, 0x2001, 0x0007, 0x080c, 0x61e6, 0x2001,
-	0x0007, 0x080c, 0x61ba, 0x001e, 0x004e, 0x9006, 0x015e, 0x003e,
-	0x002e, 0x00be, 0x00ce, 0x0005, 0x00d6, 0x2069, 0x026e, 0x6800,
-	0x9086, 0x0800, 0x0118, 0x6017, 0x0000, 0x0008, 0x9006, 0x00de,
-	0x0005, 0x00b6, 0x00f6, 0x0016, 0x0026, 0x0036, 0x0156, 0x2079,
-	0x026c, 0x7930, 0x7834, 0x080c, 0x2424, 0x11d0, 0x080c, 0x6269,
-	0x11b8, 0x2011, 0x0270, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019,
-	0x000a, 0x080c, 0xabc4, 0x009e, 0x1158, 0x2011, 0x0274, 0x20a9,
-	0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xabc4, 0x009e,
-	0x015e, 0x003e, 0x002e, 0x001e, 0x00fe, 0x00be, 0x0005, 0x00b6,
-	0x0006, 0x0016, 0x0026, 0x0036, 0x0156, 0x2011, 0x0263, 0x2204,
-	0x8211, 0x220c, 0x080c, 0x2424, 0x11d0, 0x080c, 0x6269, 0x11b8,
-	0x2011, 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x000a,
-	0x080c, 0xabc4, 0x009e, 0x1158, 0x2011, 0x027a, 0x20a9, 0x0004,
-	0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xabc4, 0x009e, 0x015e,
-	0x003e, 0x002e, 0x001e, 0x000e, 0x00be, 0x0005, 0x00e6, 0x00c6,
-	0x0086, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0126, 0x2091,
-	0x8000, 0x080c, 0x990b, 0x0106, 0x190c, 0x98ad, 0x2740, 0x2029,
-	0x19c4, 0x252c, 0x2021, 0x19cb, 0x2424, 0x2061, 0x1ddc, 0x2071,
-	0x1800, 0x7650, 0x7070, 0x81ff, 0x0150, 0x0006, 0x9186, 0x1b02,
-	0x000e, 0x0128, 0x8001, 0x9602, 0x1a04, 0xd047, 0x0018, 0x9606,
-	0x0904, 0xd047, 0x2100, 0x9c06, 0x0904, 0xd03e, 0x080c, 0xd292,
-	0x1904, 0xd03e, 0x080c, 0xd57d, 0x0904, 0xd03e, 0x080c, 0xd282,
-	0x0904, 0xd03e, 0x6720, 0x9786, 0x0001, 0x1148, 0x080c, 0x317a,
-	0x0904, 0xd066, 0x6004, 0x9086, 0x0000, 0x1904, 0xd066, 0x9786,
-	0x0004, 0x0904, 0xd066, 0x9786, 0x0007, 0x0904, 0xd03e, 0x2500,
-	0x9c06, 0x0904, 0xd03e, 0x2400, 0x9c06, 0x0904, 0xd03e, 0x88ff,
-	0x0118, 0x605c, 0x9906, 0x15d0, 0x0096, 0x6043, 0xffff, 0x6000,
-	0x9086, 0x0004, 0x1120, 0x0016, 0x080c, 0x1914, 0x001e, 0x9786,
-	0x000a, 0x0148, 0x080c, 0xba41, 0x1130, 0x080c, 0xa574, 0x009e,
-	0x080c, 0x9c06, 0x0418, 0x6014, 0x2048, 0x080c, 0xb82c, 0x01d8,
-	0x9786, 0x0003, 0x1588, 0xa867, 0x0103, 0xa87c, 0xd0cc, 0x0130,
-	0x0096, 0xa878, 0x2048, 0x080c, 0x0fd4, 0x009e, 0xab7a, 0xa877,
-	0x0000, 0x080c, 0xd4f8, 0x0016, 0x080c, 0xbb2a, 0x080c, 0x6983,
-	0x001e, 0x080c, 0xba1b, 0x009e, 0x080c, 0x9c06, 0x9ce0, 0x001c,
-	0x2001, 0x1819, 0x2004, 0x9c02, 0x1210, 0x0804, 0xcfbf, 0x010e,
-	0x190c, 0x98c9, 0x012e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e,
-	0x008e, 0x00ce, 0x00ee, 0x0005, 0x9786, 0x0006, 0x1150, 0x9386,
-	0x0005, 0x0128, 0x080c, 0xd4f8, 0x080c, 0xd1fc, 0x08e0, 0x009e,
-	0x08e8, 0x9786, 0x000a, 0x0908, 0x0804, 0xd023, 0x81ff, 0x09b0,
-	0x9180, 0x0001, 0x2004, 0x9086, 0x0018, 0x0130, 0x9180, 0x0001,
-	0x2004, 0x9086, 0x002d, 0x1950, 0x6000, 0x9086, 0x0002, 0x1930,
-	0x080c, 0xba30, 0x0130, 0x080c, 0xba41, 0x1900, 0x080c, 0xa574,
-	0x0038, 0x080c, 0x3034, 0x080c, 0xba41, 0x1110, 0x080c, 0xa574,
-	0x080c, 0x9c06, 0x0804, 0xd03e, 0xa864, 0x9084, 0x00ff, 0x9086,
-	0x0039, 0x0005, 0x00c6, 0x00e6, 0x0016, 0x2c08, 0x2170, 0x9006,
-	0x080c, 0xd223, 0x001e, 0x0120, 0x6020, 0x9084, 0x000f, 0x001b,
-	0x00ee, 0x00ce, 0x0005, 0xd0b1, 0xd0b1, 0xd0b1, 0xd0b1, 0xd0b1,
-	0xd0b1, 0xd0b3, 0xd0b1, 0xd0b1, 0xd0b1, 0xd0b1, 0x9c06, 0x9c06,
-	0xd0b1, 0x9006, 0x0005, 0x0036, 0x0046, 0x0016, 0x7010, 0x00b6,
-	0x2058, 0xbca0, 0x00be, 0x2c00, 0x2009, 0x0020, 0x080c, 0xd251,
-	0x001e, 0x004e, 0x2019, 0x0002, 0x080c, 0xcdd9, 0x003e, 0x9085,
-	0x0001, 0x0005, 0x0096, 0x080c, 0xb82c, 0x0140, 0x6014, 0x904d,
-	0x080c, 0xb437, 0x687b, 0x0005, 0x080c, 0x698f, 0x009e, 0x080c,
-	0x9c06, 0x9085, 0x0001, 0x0005, 0x2001, 0x0001, 0x080c, 0x61a6,
-	0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004, 0x2019, 0x1805,
-	0x2011, 0x0276, 0x080c, 0xabb0, 0x003e, 0x002e, 0x001e, 0x015e,
-	0x9005, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066,
-	0x00b6, 0x0126, 0x2091, 0x8000, 0x2740, 0x2061, 0x1ddc, 0x2079,
-	0x0001, 0x8fff, 0x0904, 0xd14c, 0x2071, 0x1800, 0x7650, 0x7070,
-	0x8001, 0x9602, 0x1a04, 0xd14c, 0x88ff, 0x0120, 0x2800, 0x9c06,
-	0x1590, 0x2078, 0x080c, 0xd282, 0x0570, 0x2400, 0x9c06, 0x0558,
-	0x6720, 0x9786, 0x0006, 0x1538, 0x9786, 0x0007, 0x0520, 0x88ff,
-	0x1140, 0x6010, 0x9b06, 0x11f8, 0x85ff, 0x0118, 0x605c, 0x9106,
-	0x11d0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c, 0xd4ac, 0x080c,
-	0xbf5e, 0x080c, 0x1914, 0x6023, 0x0007, 0x6014, 0x2048, 0x080c,
-	0xb82c, 0x0120, 0x0046, 0x080c, 0xd1fc, 0x004e, 0x009e, 0x080c,
-	0x9c06, 0x88ff, 0x1198, 0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004,
-	0x9c02, 0x1210, 0x0804, 0xd101, 0x9006, 0x012e, 0x00be, 0x006e,
-	0x007e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005, 0x98c5, 0x0001,
-	0x0ca0, 0x080c, 0x98ad, 0x00b6, 0x0076, 0x0056, 0x0086, 0x9046,
-	0x2029, 0x0001, 0x2c20, 0x2019, 0x0002, 0x6210, 0x2258, 0x0096,
-	0x904e, 0x080c, 0x9367, 0x009e, 0x008e, 0x903e, 0x080c, 0x9412,
-	0x080c, 0xd0f2, 0x005e, 0x007e, 0x00be, 0x080c, 0x98c9, 0x0005,
-	0x080c, 0x98ad, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6, 0x0156,
-	0x2c20, 0x2128, 0x20a9, 0x007f, 0x900e, 0x0016, 0x0036, 0x080c,
-	0x6269, 0x1190, 0x0056, 0x0086, 0x9046, 0x2508, 0x2029, 0x0001,
-	0x0096, 0x904e, 0x080c, 0x9367, 0x009e, 0x008e, 0x903e, 0x080c,
-	0x9412, 0x080c, 0xd0f2, 0x005e, 0x003e, 0x001e, 0x8108, 0x1f04,
-	0xd185, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e, 0x00be, 0x080c,
-	0x98c9, 0x0005, 0x080c, 0x98ad, 0x00b6, 0x0076, 0x0056, 0x6210,
-	0x2258, 0x0086, 0x9046, 0x2029, 0x0001, 0x2019, 0x0048, 0x0096,
-	0x904e, 0x080c, 0x9367, 0x009e, 0x008e, 0x903e, 0x080c, 0x9412,
-	0x2c20, 0x080c, 0xd0f2, 0x005e, 0x007e, 0x00be, 0x080c, 0x98c9,
-	0x0005, 0x080c, 0x98ad, 0x00b6, 0x0046, 0x0056, 0x0076, 0x00c6,
-	0x0156, 0x2c20, 0x20a9, 0x0800, 0x900e, 0x0016, 0x0036, 0x080c,
-	0x6269, 0x11a0, 0x0086, 0x9046, 0x2828, 0x0046, 0x2021, 0x0001,
-	0x080c, 0xd490, 0x004e, 0x0096, 0x904e, 0x080c, 0x9367, 0x009e,
-	0x008e, 0x903e, 0x080c, 0x9412, 0x080c, 0xd0f2, 0x003e, 0x001e,
-	0x8108, 0x1f04, 0xd1d5, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e,
-	0x00be, 0x080c, 0x98c9, 0x0005, 0x0016, 0x00f6, 0x080c, 0xb82a,
-	0x0198, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0046, 0x0180, 0xa800,
-	0x907d, 0x0138, 0xa803, 0x0000, 0xab82, 0x080c, 0x698f, 0x2f48,
-	0x0cb0, 0xab82, 0x080c, 0x698f, 0x00fe, 0x001e, 0x0005, 0xa800,
-	0x907d, 0x0130, 0xa803, 0x0000, 0x080c, 0x698f, 0x2f48, 0x0cb8,
-	0x080c, 0x698f, 0x0c88, 0x00e6, 0x0046, 0x0036, 0x2061, 0x1ddc,
-	0x9005, 0x1138, 0x2071, 0x1800, 0x7450, 0x7070, 0x8001, 0x9402,
-	0x12d8, 0x2100, 0x9c06, 0x0168, 0x6000, 0x9086, 0x0000, 0x0148,
-	0x6008, 0x9206, 0x1130, 0x6010, 0x91a0, 0x0004, 0x2424, 0x9406,
-	0x0140, 0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004, 0x9c02, 0x1220,
-	0x0c40, 0x9085, 0x0001, 0x0008, 0x9006, 0x003e, 0x004e, 0x00ee,
-	0x0005, 0x0096, 0x0006, 0x080c, 0x1022, 0x000e, 0x090c, 0x0d65,
-	0xaae2, 0xa867, 0x010d, 0xa88e, 0x0026, 0x2010, 0x080c, 0xb81a,
-	0x2001, 0x0000, 0x0120, 0x2200, 0x9080, 0x0017, 0x2004, 0x002e,
-	0xa87a, 0x9186, 0x0020, 0x0110, 0xa8e3, 0xffff, 0xa986, 0xac76,
-	0xa87f, 0x0000, 0x2001, 0x195f, 0x2004, 0xa882, 0x9006, 0xa802,
-	0xa86a, 0xa88a, 0x0126, 0x2091, 0x8000, 0x080c, 0x698f, 0x012e,
-	0x009e, 0x0005, 0x6700, 0x9786, 0x0000, 0x0158, 0x9786, 0x0001,
-	0x0140, 0x9786, 0x000a, 0x0128, 0x9786, 0x0009, 0x0110, 0x9085,
-	0x0001, 0x0005, 0x00e6, 0x6010, 0x9075, 0x0138, 0x00b6, 0x2058,
-	0xb8a0, 0x00be, 0x9206, 0x00ee, 0x0005, 0x9085, 0x0001, 0x0cd8,
-	0x0016, 0x6004, 0x908e, 0x001e, 0x11a0, 0x8007, 0x6134, 0x918c,
-	0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003, 0x000b, 0x6023,
-	0x0005, 0x2001, 0x1958, 0x2004, 0x601a, 0x2009, 0x8020, 0x080c,
-	0x84a9, 0x001e, 0x0005, 0xa001, 0xa001, 0x0005, 0x6024, 0xd0e4,
-	0x0158, 0xd0cc, 0x0118, 0x080c, 0xbb71, 0x0030, 0x080c, 0xd4ac,
-	0x080c, 0x8398, 0x080c, 0x9bcc, 0x0005, 0x9280, 0x0008, 0x2004,
-	0x9084, 0x000f, 0x0002, 0xd2e1, 0xd2e1, 0xd2e1, 0xd2e3, 0xd2e1,
-	0xd2e3, 0xd2e3, 0xd2e1, 0xd2e3, 0xd2e1, 0xd2e1, 0xd2e1, 0xd2e1,
-	0xd2e1, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005, 0x9280, 0x0008,
-	0x2004, 0x9084, 0x000f, 0x0002, 0xd2fa, 0xd2fa, 0xd2fa, 0xd2fa,
-	0xd2fa, 0xd2fa, 0xd307, 0xd2fa, 0xd2fa, 0xd2fa, 0xd2fa, 0xd2fa,
-	0xd2fa, 0xd2fa, 0x6007, 0x003b, 0x602f, 0x0009, 0x6017, 0x2a00,
-	0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x84a9, 0x0005, 0x0096,
-	0x00c6, 0x2260, 0x080c, 0xd4ac, 0x604b, 0x0000, 0x6024, 0xc0f4,
-	0xc0e4, 0x6026, 0x603b, 0x0000, 0x00ce, 0x00d6, 0x2268, 0x9186,
-	0x0007, 0x1904, 0xd360, 0x6814, 0x9005, 0x0138, 0x2048, 0xa87c,
-	0xd0fc, 0x1118, 0x00de, 0x009e, 0x08a8, 0x6007, 0x003a, 0x6003,
-	0x0001, 0x2009, 0x8020, 0x080c, 0x84a9, 0x00c6, 0x2d60, 0x6100,
-	0x9186, 0x0002, 0x1904, 0xd3d7, 0x6014, 0x9005, 0x1138, 0x6000,
-	0x9086, 0x0007, 0x190c, 0x0d65, 0x0804, 0xd3d7, 0x2048, 0x080c,
-	0xb82c, 0x1130, 0x0028, 0x2048, 0xa800, 0x9005, 0x1de0, 0x2900,
-	0x2048, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002, 0x1168, 0xa87c,
-	0xc0dc, 0xc0f4, 0xa87e, 0xa880, 0xc0fc, 0xa882, 0x2009, 0x0043,
-	0x080c, 0xcc1b, 0x0804, 0xd3d7, 0x2009, 0x0041, 0x0804, 0xd3d1,
-	0x9186, 0x0005, 0x15a0, 0x6814, 0x2048, 0xa87c, 0xd0bc, 0x1120,
-	0x00de, 0x009e, 0x0804, 0xd2fa, 0xd0b4, 0x0128, 0xd0fc, 0x090c,
-	0x0d65, 0x0804, 0xd31b, 0x6007, 0x003a, 0x6003, 0x0001, 0x2009,
-	0x8020, 0x080c, 0x84a9, 0x00c6, 0x2d60, 0x6100, 0x9186, 0x0002,
-	0x0120, 0x9186, 0x0004, 0x1904, 0xd3d7, 0x6814, 0x2048, 0xa97c,
-	0xc1f4, 0xc1dc, 0xa97e, 0xa980, 0xc1fc, 0xc1bc, 0xa982, 0x00f6,
-	0x2c78, 0x080c, 0x164f, 0x00fe, 0x2009, 0x0042, 0x04d0, 0x0036,
-	0x080c, 0x1022, 0x090c, 0x0d65, 0xa867, 0x010d, 0x9006, 0xa802,
-	0xa86a, 0xa88a, 0x2d18, 0xab8e, 0xa887, 0x0045, 0x2c00, 0xa892,
-	0x6038, 0xa8a2, 0x2360, 0x6024, 0xc0dd, 0x6026, 0x6010, 0x00b6,
-	0x2058, 0xb8a0, 0x00be, 0x2004, 0x635c, 0xab7a, 0xa876, 0x9006,
-	0xa87e, 0xa882, 0xad9a, 0xae96, 0xa89f, 0x0001, 0x080c, 0x698f,
-	0x2019, 0x0045, 0x6008, 0x2068, 0x080c, 0xcdd9, 0x2d00, 0x600a,
-	0x6023, 0x0006, 0x6003, 0x0007, 0x901e, 0x631a, 0x634a, 0x003e,
-	0x0038, 0x604b, 0x0000, 0x6003, 0x0007, 0x080c, 0xcc1b, 0x00ce,
-	0x00de, 0x009e, 0x0005, 0x9186, 0x0013, 0x1128, 0x6004, 0x9082,
-	0x0085, 0x2008, 0x00c2, 0x9186, 0x0027, 0x1178, 0x080c, 0x884c,
-	0x0036, 0x0096, 0x6014, 0x2048, 0x2019, 0x0004, 0x080c, 0xd1fc,
-	0x009e, 0x003e, 0x080c, 0x890e, 0x0005, 0x9186, 0x0014, 0x0d70,
-	0x080c, 0x9c87, 0x0005, 0xd40a, 0xd408, 0xd408, 0xd408, 0xd408,
-	0xd408, 0xd40a, 0xd408, 0xd408, 0xd408, 0xd408, 0xd408, 0xd408,
-	0x080c, 0x0d65, 0x6003, 0x000c, 0x080c, 0x890e, 0x0005, 0x9182,
-	0x0092, 0x1220, 0x9182, 0x0085, 0x0208, 0x001a, 0x080c, 0x9c87,
-	0x0005, 0xd426, 0xd426, 0xd426, 0xd426, 0xd428, 0xd448, 0xd426,
-	0xd426, 0xd426, 0xd426, 0xd426, 0xd426, 0xd426, 0x080c, 0x0d65,
-	0x00d6, 0x2c68, 0x080c, 0x9b76, 0x01b0, 0x6003, 0x0001, 0x6007,
-	0x001e, 0x2009, 0x026e, 0x210c, 0x613a, 0x2009, 0x026f, 0x210c,
-	0x613e, 0x600b, 0xffff, 0x6910, 0x6112, 0x6023, 0x0004, 0x2009,
-	0x8020, 0x080c, 0x84a9, 0x2d60, 0x080c, 0x9bcc, 0x00de, 0x0005,
-	0x080c, 0x9bcc, 0x0005, 0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800,
-	0x00be, 0xd0ec, 0x00ee, 0x0005, 0x2009, 0x1873, 0x210c, 0xd1ec,
-	0x05b0, 0x6003, 0x0002, 0x6024, 0xc0e5, 0x6026, 0xd0cc, 0x0150,
-	0x2001, 0x1959, 0x2004, 0x604a, 0x2009, 0x1873, 0x210c, 0xd1f4,
-	0x1520, 0x00a0, 0x2009, 0x1873, 0x210c, 0xd1f4, 0x0128, 0x6024,
-	0xc0e4, 0x6026, 0x9006, 0x00d8, 0x2001, 0x1959, 0x200c, 0x2001,
-	0x1957, 0x2004, 0x9100, 0x9080, 0x000a, 0x604a, 0x6010, 0x00b6,
-	0x2058, 0xb8ac, 0x00be, 0x0008, 0x2104, 0x9005, 0x0118, 0x9088,
-	0x0003, 0x0cd0, 0x2c0a, 0x600f, 0x0000, 0x9085, 0x0001, 0x0005,
-	0x0016, 0x00c6, 0x00e6, 0x615c, 0xb8ac, 0x2060, 0x8cff, 0x0180,
-	0x84ff, 0x1118, 0x605c, 0x9106, 0x1138, 0x600c, 0x2072, 0x080c,
-	0x8398, 0x080c, 0x9bcc, 0x0010, 0x9cf0, 0x0003, 0x2e64, 0x0c70,
-	0x00ee, 0x00ce, 0x001e, 0x0005, 0x00d6, 0x00b6, 0x6010, 0x2058,
-	0xb8ac, 0x2068, 0x9005, 0x0130, 0x9c06, 0x0110, 0x680c, 0x0cd0,
-	0x600c, 0x680e, 0x00be, 0x00de, 0x0005, 0x0026, 0x0036, 0x0156,
-	0x2011, 0x182b, 0x2204, 0x9084, 0x00ff, 0x2019, 0x026e, 0x2334,
-	0x9636, 0x1508, 0x8318, 0x2334, 0x2204, 0x9084, 0xff00, 0x9636,
-	0x11d0, 0x2011, 0x0270, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048,
-	0x2019, 0x000a, 0x080c, 0xabc4, 0x009e, 0x1168, 0x2011, 0x0274,
-	0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019, 0x0006, 0x080c,
-	0xabc4, 0x009e, 0x1100, 0x015e, 0x003e, 0x002e, 0x0005, 0x00e6,
-	0x2071, 0x1800, 0x080c, 0x5c68, 0x080c, 0x2ddb, 0x00ee, 0x0005,
-	0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be, 0xd0fc, 0x0108,
-	0x0011, 0x00ee, 0x0005, 0xa880, 0xc0e5, 0xa882, 0x0005, 0x00e6,
-	0x00d6, 0x00c6, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026, 0x0016,
-	0x0126, 0x2091, 0x8000, 0x2029, 0x19c4, 0x252c, 0x2021, 0x19cb,
-	0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7650, 0x7070, 0x9606,
-	0x0578, 0x6720, 0x9786, 0x0001, 0x0118, 0x9786, 0x0008, 0x1500,
-	0x2500, 0x9c06, 0x01e8, 0x2400, 0x9c06, 0x01d0, 0x080c, 0xd282,
-	0x01b8, 0x080c, 0xd292, 0x11a0, 0x6000, 0x9086, 0x0004, 0x1120,
-	0x0016, 0x080c, 0x1914, 0x001e, 0x080c, 0xba30, 0x1110, 0x080c,
-	0x3034, 0x080c, 0xba41, 0x1110, 0x080c, 0xa574, 0x080c, 0x9c06,
-	0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004, 0x9c02, 0x1208, 0x0858,
-	0x012e, 0x001e, 0x002e, 0x004e, 0x005e, 0x006e, 0x007e, 0x00ce,
-	0x00de, 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004, 0xd0dc, 0x0005,
-	0x0006, 0x2001, 0x1836, 0x2004, 0xd09c, 0x000e, 0x0005, 0x0006,
-	0x0036, 0x0046, 0x080c, 0xbf46, 0x0168, 0x2019, 0xffff, 0x9005,
-	0x0128, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be, 0x2021, 0x0004,
-	0x080c, 0x4a6e, 0x004e, 0x003e, 0x000e, 0x6004, 0x9086, 0x0001,
-	0x1128, 0x080c, 0x94d9, 0x080c, 0x9c06, 0x9006, 0x0005, 0x00e6,
-	0x00c6, 0x00b6, 0x0046, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7450,
-	0x7070, 0x8001, 0x9402, 0x12b8, 0x2100, 0x9c06, 0x0148, 0x6000,
-	0x9086, 0x0000, 0x0128, 0x6010, 0x2058, 0xb8a0, 0x9206, 0x0140,
-	0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004, 0x9c02, 0x1220, 0x0c60,
-	0x9085, 0x0001, 0x0008, 0x9006, 0x004e, 0x00be, 0x00ce, 0x00ee,
-	0x0005, 0x0126, 0x0006, 0x00e6, 0x0016, 0x2091, 0x8000, 0x2071,
-	0x1840, 0xd5a4, 0x0118, 0x7034, 0x8000, 0x7036, 0xd5b4, 0x0118,
-	0x7030, 0x8000, 0x7032, 0xd5ac, 0x0178, 0x2500, 0x9084, 0x0007,
-	0x908e, 0x0003, 0x0148, 0x908e, 0x0004, 0x0130, 0x908e, 0x0005,
-	0x0118, 0x2071, 0x184a, 0x0089, 0x001e, 0x00ee, 0x000e, 0x012e,
-	0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071, 0x1842,
-	0x0021, 0x00ee, 0x000e, 0x012e, 0x0005, 0x2e04, 0x8000, 0x2072,
-	0x1220, 0x8e70, 0x2e04, 0x8000, 0x2072, 0x0005, 0x00e6, 0x2071,
-	0x1840, 0x0c99, 0x00ee, 0x0005, 0x00e6, 0x2071, 0x1844, 0x0c69,
-	0x00ee, 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000, 0x2071,
-	0x1840, 0x7044, 0x8000, 0x7046, 0x00ee, 0x000e, 0x012e, 0x0005,
-	0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
-	0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000,
-	0x7c76
+	0x30dc, 0x002e, 0xbc84, 0x001e, 0x080c, 0x5cf6, 0xbe12, 0xbd16,
+	0xbc86, 0x9006, 0x0010, 0x00ce, 0x001e, 0x015e, 0x003e, 0x00be,
+	0x00ce, 0x00fe, 0x0005, 0x00c6, 0x00d6, 0x00b6, 0x0016, 0x2009,
+	0x1823, 0x2104, 0x9086, 0x0074, 0x1904, 0xceec, 0x2069, 0x0260,
+	0x6944, 0x9182, 0x0100, 0x06e0, 0x6940, 0x9184, 0x8000, 0x0904,
+	0xcee9, 0x2001, 0x194d, 0x2004, 0x9005, 0x1140, 0x6010, 0x2058,
+	0xb884, 0x9005, 0x0118, 0x9184, 0x0800, 0x0598, 0x6948, 0x918a,
+	0x0001, 0x0648, 0x080c, 0xd582, 0x0118, 0x6978, 0xd1fc, 0x11b8,
+	0x2009, 0x0205, 0x200b, 0x0001, 0x693c, 0x81ff, 0x1198, 0x6944,
+	0x9182, 0x0100, 0x02a8, 0x6940, 0x81ff, 0x1178, 0x6948, 0x918a,
+	0x0001, 0x0288, 0x6950, 0x918a, 0x0001, 0x0298, 0x00d0, 0x6017,
+	0x0100, 0x00a0, 0x6017, 0x0300, 0x0088, 0x6017, 0x0500, 0x0070,
+	0x6017, 0x0700, 0x0058, 0x6017, 0x0900, 0x0040, 0x6017, 0x0b00,
+	0x0028, 0x6017, 0x0f00, 0x0010, 0x6017, 0x2d00, 0x9085, 0x0001,
+	0x0008, 0x9006, 0x001e, 0x00be, 0x00de, 0x00ce, 0x0005, 0x00c6,
+	0x00b6, 0x0026, 0x0036, 0x0156, 0x6210, 0x2258, 0xbb04, 0x9394,
+	0x00ff, 0x9286, 0x0006, 0x0180, 0x9286, 0x0004, 0x0168, 0x9394,
+	0xff00, 0x8217, 0x9286, 0x0006, 0x0138, 0x9286, 0x0004, 0x0120,
+	0x080c, 0x627f, 0x0804, 0xcf57, 0x2011, 0x0276, 0x20a9, 0x0004,
+	0x0096, 0x2b48, 0x2019, 0x000a, 0x080c, 0xabdf, 0x009e, 0x15c0,
+	0x2011, 0x027a, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006,
+	0x080c, 0xabdf, 0x009e, 0x1560, 0x0046, 0x0016, 0xbaa0, 0x2220,
+	0x9006, 0x2009, 0x1854, 0x210c, 0x0038, 0x2009, 0x0029, 0x080c,
+	0xd273, 0xb800, 0xc0e5, 0xb802, 0x080c, 0x98c8, 0x2019, 0x0029,
+	0x080c, 0x863b, 0x0076, 0x2039, 0x0000, 0x080c, 0x852a, 0x2c08,
+	0x080c, 0xcfc8, 0x007e, 0x080c, 0x98e4, 0x2001, 0x0007, 0x080c,
+	0x61ed, 0x2001, 0x0007, 0x080c, 0x61c1, 0x001e, 0x004e, 0x9006,
+	0x015e, 0x003e, 0x002e, 0x00be, 0x00ce, 0x0005, 0x00d6, 0x2069,
+	0x026e, 0x6800, 0x9086, 0x0800, 0x0118, 0x6017, 0x0000, 0x0008,
+	0x9006, 0x00de, 0x0005, 0x00b6, 0x00f6, 0x0016, 0x0026, 0x0036,
+	0x0156, 0x2079, 0x026c, 0x7930, 0x7834, 0x080c, 0x2424, 0x11d0,
+	0x080c, 0x6270, 0x11b8, 0x2011, 0x0270, 0x20a9, 0x0004, 0x0096,
+	0x2b48, 0x2019, 0x000a, 0x080c, 0xabdf, 0x009e, 0x1158, 0x2011,
+	0x0274, 0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c,
+	0xabdf, 0x009e, 0x015e, 0x003e, 0x002e, 0x001e, 0x00fe, 0x00be,
+	0x0005, 0x00b6, 0x0006, 0x0016, 0x0026, 0x0036, 0x0156, 0x2011,
+	0x0263, 0x2204, 0x8211, 0x220c, 0x080c, 0x2424, 0x11d0, 0x080c,
+	0x6270, 0x11b8, 0x2011, 0x0276, 0x20a9, 0x0004, 0x0096, 0x2b48,
+	0x2019, 0x000a, 0x080c, 0xabdf, 0x009e, 0x1158, 0x2011, 0x027a,
+	0x20a9, 0x0004, 0x0096, 0x2b48, 0x2019, 0x0006, 0x080c, 0xabdf,
+	0x009e, 0x015e, 0x003e, 0x002e, 0x001e, 0x000e, 0x00be, 0x0005,
+	0x00e6, 0x00c6, 0x0086, 0x0076, 0x0066, 0x0056, 0x0046, 0x0026,
+	0x0126, 0x2091, 0x8000, 0x080c, 0x9926, 0x0106, 0x190c, 0x98c8,
+	0x2740, 0x2029, 0x19c4, 0x252c, 0x2021, 0x19cb, 0x2424, 0x2061,
+	0x1ddc, 0x2071, 0x1800, 0x7650, 0x7070, 0x81ff, 0x0150, 0x0006,
+	0x9186, 0x1b02, 0x000e, 0x0128, 0x8001, 0x9602, 0x1a04, 0xd069,
+	0x0018, 0x9606, 0x0904, 0xd069, 0x2100, 0x9c06, 0x0904, 0xd060,
+	0x080c, 0xd2b4, 0x1904, 0xd060, 0x080c, 0xd59f, 0x0904, 0xd060,
+	0x080c, 0xd2a4, 0x0904, 0xd060, 0x6720, 0x9786, 0x0001, 0x1148,
+	0x080c, 0x3181, 0x0904, 0xd088, 0x6004, 0x9086, 0x0000, 0x1904,
+	0xd088, 0x9786, 0x0004, 0x0904, 0xd088, 0x9786, 0x0007, 0x0904,
+	0xd060, 0x2500, 0x9c06, 0x0904, 0xd060, 0x2400, 0x9c06, 0x0904,
+	0xd060, 0x88ff, 0x0118, 0x605c, 0x9906, 0x15d0, 0x0096, 0x6043,
+	0xffff, 0x6000, 0x9086, 0x0004, 0x1120, 0x0016, 0x080c, 0x1914,
+	0x001e, 0x9786, 0x000a, 0x0148, 0x080c, 0xba5c, 0x1130, 0x080c,
+	0xa58f, 0x009e, 0x080c, 0x9c21, 0x0418, 0x6014, 0x2048, 0x080c,
+	0xb847, 0x01d8, 0x9786, 0x0003, 0x1588, 0xa867, 0x0103, 0xa87c,
+	0xd0cc, 0x0130, 0x0096, 0xa878, 0x2048, 0x080c, 0x0fd4, 0x009e,
+	0xab7a, 0xa877, 0x0000, 0x080c, 0xd51a, 0x0016, 0x080c, 0xbb45,
+	0x080c, 0x698a, 0x001e, 0x080c, 0xba36, 0x009e, 0x080c, 0x9c21,
+	0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004, 0x9c02, 0x1210, 0x0804,
+	0xcfe1, 0x010e, 0x190c, 0x98e4, 0x012e, 0x002e, 0x004e, 0x005e,
+	0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x0005, 0x9786, 0x0006,
+	0x1150, 0x9386, 0x0005, 0x0128, 0x080c, 0xd51a, 0x080c, 0xd21e,
+	0x08e0, 0x009e, 0x08e8, 0x9786, 0x000a, 0x0908, 0x0804, 0xd045,
+	0x81ff, 0x09b0, 0x9180, 0x0001, 0x2004, 0x9086, 0x0018, 0x0130,
+	0x9180, 0x0001, 0x2004, 0x9086, 0x002d, 0x1950, 0x6000, 0x9086,
+	0x0002, 0x1930, 0x080c, 0xba4b, 0x0130, 0x080c, 0xba5c, 0x1900,
+	0x080c, 0xa58f, 0x0038, 0x080c, 0x303b, 0x080c, 0xba5c, 0x1110,
+	0x080c, 0xa58f, 0x080c, 0x9c21, 0x0804, 0xd060, 0xa864, 0x9084,
+	0x00ff, 0x9086, 0x0039, 0x0005, 0x00c6, 0x00e6, 0x0016, 0x2c08,
+	0x2170, 0x9006, 0x080c, 0xd245, 0x001e, 0x0120, 0x6020, 0x9084,
+	0x000f, 0x001b, 0x00ee, 0x00ce, 0x0005, 0xd0d3, 0xd0d3, 0xd0d3,
+	0xd0d3, 0xd0d3, 0xd0d3, 0xd0d5, 0xd0d3, 0xd0d3, 0xd0d3, 0xd0d3,
+	0x9c21, 0x9c21, 0xd0d3, 0x9006, 0x0005, 0x0036, 0x0046, 0x0016,
+	0x7010, 0x00b6, 0x2058, 0xbca0, 0x00be, 0x2c00, 0x2009, 0x0020,
+	0x080c, 0xd273, 0x001e, 0x004e, 0x2019, 0x0002, 0x080c, 0xcdf9,
+	0x003e, 0x9085, 0x0001, 0x0005, 0x0096, 0x080c, 0xb847, 0x0140,
+	0x6014, 0x904d, 0x080c, 0xb452, 0x687b, 0x0005, 0x080c, 0x6996,
+	0x009e, 0x080c, 0x9c21, 0x9085, 0x0001, 0x0005, 0x2001, 0x0001,
+	0x080c, 0x61ad, 0x0156, 0x0016, 0x0026, 0x0036, 0x20a9, 0x0004,
+	0x2019, 0x1805, 0x2011, 0x0276, 0x080c, 0xabcb, 0x003e, 0x002e,
+	0x001e, 0x015e, 0x9005, 0x0005, 0x00f6, 0x00e6, 0x00c6, 0x0086,
+	0x0076, 0x0066, 0x00b6, 0x0126, 0x2091, 0x8000, 0x2740, 0x2061,
+	0x1ddc, 0x2079, 0x0001, 0x8fff, 0x0904, 0xd16e, 0x2071, 0x1800,
+	0x7650, 0x7070, 0x8001, 0x9602, 0x1a04, 0xd16e, 0x88ff, 0x0120,
+	0x2800, 0x9c06, 0x1590, 0x2078, 0x080c, 0xd2a4, 0x0570, 0x2400,
+	0x9c06, 0x0558, 0x6720, 0x9786, 0x0006, 0x1538, 0x9786, 0x0007,
+	0x0520, 0x88ff, 0x1140, 0x6010, 0x9b06, 0x11f8, 0x85ff, 0x0118,
+	0x605c, 0x9106, 0x11d0, 0x0096, 0x601c, 0xd084, 0x0140, 0x080c,
+	0xd4ce, 0x080c, 0xbf79, 0x080c, 0x1914, 0x6023, 0x0007, 0x6014,
+	0x2048, 0x080c, 0xb847, 0x0120, 0x0046, 0x080c, 0xd21e, 0x004e,
+	0x009e, 0x080c, 0x9c21, 0x88ff, 0x1198, 0x9ce0, 0x001c, 0x2001,
+	0x1819, 0x2004, 0x9c02, 0x1210, 0x0804, 0xd123, 0x9006, 0x012e,
+	0x00be, 0x006e, 0x007e, 0x008e, 0x00ce, 0x00ee, 0x00fe, 0x0005,
+	0x98c5, 0x0001, 0x0ca0, 0x080c, 0x98c8, 0x00b6, 0x0076, 0x0056,
+	0x0086, 0x9046, 0x2029, 0x0001, 0x2c20, 0x2019, 0x0002, 0x6210,
+	0x2258, 0x0096, 0x904e, 0x080c, 0x9382, 0x009e, 0x008e, 0x903e,
+	0x080c, 0x942d, 0x080c, 0xd114, 0x005e, 0x007e, 0x00be, 0x080c,
+	0x98e4, 0x0005, 0x080c, 0x98c8, 0x00b6, 0x0046, 0x0056, 0x0076,
+	0x00c6, 0x0156, 0x2c20, 0x2128, 0x20a9, 0x007f, 0x900e, 0x0016,
+	0x0036, 0x080c, 0x6270, 0x1190, 0x0056, 0x0086, 0x9046, 0x2508,
+	0x2029, 0x0001, 0x0096, 0x904e, 0x080c, 0x9382, 0x009e, 0x008e,
+	0x903e, 0x080c, 0x942d, 0x080c, 0xd114, 0x005e, 0x003e, 0x001e,
+	0x8108, 0x1f04, 0xd1a7, 0x015e, 0x00ce, 0x007e, 0x005e, 0x004e,
+	0x00be, 0x080c, 0x98e4, 0x0005, 0x080c, 0x98c8, 0x00b6, 0x0076,
+	0x0056, 0x6210, 0x2258, 0x0086, 0x9046, 0x2029, 0x0001, 0x2019,
+	0x0048, 0x0096, 0x904e, 0x080c, 0x9382, 0x009e, 0x008e, 0x903e,
+	0x080c, 0x942d, 0x2c20, 0x080c, 0xd114, 0x005e, 0x007e, 0x00be,
+	0x080c, 0x98e4, 0x0005, 0x080c, 0x98c8, 0x00b6, 0x0046, 0x0056,
+	0x0076, 0x00c6, 0x0156, 0x2c20, 0x20a9, 0x0800, 0x900e, 0x0016,
+	0x0036, 0x080c, 0x6270, 0x11a0, 0x0086, 0x9046, 0x2828, 0x0046,
+	0x2021, 0x0001, 0x080c, 0xd4b2, 0x004e, 0x0096, 0x904e, 0x080c,
+	0x9382, 0x009e, 0x008e, 0x903e, 0x080c, 0x942d, 0x080c, 0xd114,
+	0x003e, 0x001e, 0x8108, 0x1f04, 0xd1f7, 0x015e, 0x00ce, 0x007e,
+	0x005e, 0x004e, 0x00be, 0x080c, 0x98e4, 0x0005, 0x0016, 0x00f6,
+	0x080c, 0xb845, 0x0198, 0xa864, 0x9084, 0x00ff, 0x9086, 0x0046,
+	0x0180, 0xa800, 0x907d, 0x0138, 0xa803, 0x0000, 0xab82, 0x080c,
+	0x6996, 0x2f48, 0x0cb0, 0xab82, 0x080c, 0x6996, 0x00fe, 0x001e,
+	0x0005, 0xa800, 0x907d, 0x0130, 0xa803, 0x0000, 0x080c, 0x6996,
+	0x2f48, 0x0cb8, 0x080c, 0x6996, 0x0c88, 0x00e6, 0x0046, 0x0036,
+	0x2061, 0x1ddc, 0x9005, 0x1138, 0x2071, 0x1800, 0x7450, 0x7070,
+	0x8001, 0x9402, 0x12d8, 0x2100, 0x9c06, 0x0168, 0x6000, 0x9086,
+	0x0000, 0x0148, 0x6008, 0x9206, 0x1130, 0x6010, 0x91a0, 0x0004,
+	0x2424, 0x9406, 0x0140, 0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004,
+	0x9c02, 0x1220, 0x0c40, 0x9085, 0x0001, 0x0008, 0x9006, 0x003e,
+	0x004e, 0x00ee, 0x0005, 0x0096, 0x0006, 0x080c, 0x1022, 0x000e,
+	0x090c, 0x0d65, 0xaae2, 0xa867, 0x010d, 0xa88e, 0x0026, 0x2010,
+	0x080c, 0xb835, 0x2001, 0x0000, 0x0120, 0x2200, 0x9080, 0x0017,
+	0x2004, 0x002e, 0xa87a, 0x9186, 0x0020, 0x0110, 0xa8e3, 0xffff,
+	0xa986, 0xac76, 0xa87f, 0x0000, 0x2001, 0x195f, 0x2004, 0xa882,
+	0x9006, 0xa802, 0xa86a, 0xa88a, 0x0126, 0x2091, 0x8000, 0x080c,
+	0x6996, 0x012e, 0x009e, 0x0005, 0x6700, 0x9786, 0x0000, 0x0158,
+	0x9786, 0x0001, 0x0140, 0x9786, 0x000a, 0x0128, 0x9786, 0x0009,
+	0x0110, 0x9085, 0x0001, 0x0005, 0x00e6, 0x6010, 0x9075, 0x0138,
+	0x00b6, 0x2058, 0xb8a0, 0x00be, 0x9206, 0x00ee, 0x0005, 0x9085,
+	0x0001, 0x0cd8, 0x0016, 0x6004, 0x908e, 0x001e, 0x11a0, 0x8007,
+	0x6134, 0x918c, 0x00ff, 0x9105, 0x6036, 0x6007, 0x0085, 0x6003,
+	0x000b, 0x6023, 0x0005, 0x2001, 0x1958, 0x2004, 0x601a, 0x2009,
+	0x8020, 0x080c, 0x84d1, 0x001e, 0x0005, 0xa001, 0xa001, 0x0005,
+	0x6024, 0xd0e4, 0x0158, 0xd0cc, 0x0118, 0x080c, 0xbb8c, 0x0030,
+	0x080c, 0xd4ce, 0x080c, 0x83c0, 0x080c, 0x9be7, 0x0005, 0x9280,
+	0x0008, 0x2004, 0x9084, 0x000f, 0x0002, 0xd303, 0xd303, 0xd303,
+	0xd305, 0xd303, 0xd305, 0xd305, 0xd303, 0xd305, 0xd303, 0xd303,
+	0xd303, 0xd303, 0xd303, 0x9006, 0x0005, 0x9085, 0x0001, 0x0005,
+	0x9280, 0x0008, 0x2004, 0x9084, 0x000f, 0x0002, 0xd31c, 0xd31c,
+	0xd31c, 0xd31c, 0xd31c, 0xd31c, 0xd329, 0xd31c, 0xd31c, 0xd31c,
+	0xd31c, 0xd31c, 0xd31c, 0xd31c, 0x6007, 0x003b, 0x602f, 0x0009,
+	0x6017, 0x2a00, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x84d1,
+	0x0005, 0x0096, 0x00c6, 0x2260, 0x080c, 0xd4ce, 0x604b, 0x0000,
+	0x6024, 0xc0f4, 0xc0e4, 0x6026, 0x603b, 0x0000, 0x00ce, 0x00d6,
+	0x2268, 0x9186, 0x0007, 0x1904, 0xd382, 0x6814, 0x9005, 0x0138,
+	0x2048, 0xa87c, 0xd0fc, 0x1118, 0x00de, 0x009e, 0x08a8, 0x6007,
+	0x003a, 0x6003, 0x0001, 0x2009, 0x8020, 0x080c, 0x84d1, 0x00c6,
+	0x2d60, 0x6100, 0x9186, 0x0002, 0x1904, 0xd3f9, 0x6014, 0x9005,
+	0x1138, 0x6000, 0x9086, 0x0007, 0x190c, 0x0d65, 0x0804, 0xd3f9,
+	0x2048, 0x080c, 0xb847, 0x1130, 0x0028, 0x2048, 0xa800, 0x9005,
+	0x1de0, 0x2900, 0x2048, 0xa87c, 0x9084, 0x0003, 0x9086, 0x0002,
+	0x1168, 0xa87c, 0xc0dc, 0xc0f4, 0xa87e, 0xa880, 0xc0fc, 0xa882,
+	0x2009, 0x0043, 0x080c, 0xcc3b, 0x0804, 0xd3f9, 0x2009, 0x0041,
+	0x0804, 0xd3f3, 0x9186, 0x0005, 0x15a0, 0x6814, 0x2048, 0xa87c,
+	0xd0bc, 0x1120, 0x00de, 0x009e, 0x0804, 0xd31c, 0xd0b4, 0x0128,
+	0xd0fc, 0x090c, 0x0d65, 0x0804, 0xd33d, 0x6007, 0x003a, 0x6003,
+	0x0001, 0x2009, 0x8020, 0x080c, 0x84d1, 0x00c6, 0x2d60, 0x6100,
+	0x9186, 0x0002, 0x0120, 0x9186, 0x0004, 0x1904, 0xd3f9, 0x6814,
+	0x2048, 0xa97c, 0xc1f4, 0xc1dc, 0xa97e, 0xa980, 0xc1fc, 0xc1bc,
+	0xa982, 0x00f6, 0x2c78, 0x080c, 0x164f, 0x00fe, 0x2009, 0x0042,
+	0x04d0, 0x0036, 0x080c, 0x1022, 0x090c, 0x0d65, 0xa867, 0x010d,
+	0x9006, 0xa802, 0xa86a, 0xa88a, 0x2d18, 0xab8e, 0xa887, 0x0045,
+	0x2c00, 0xa892, 0x6038, 0xa8a2, 0x2360, 0x6024, 0xc0dd, 0x6026,
+	0x6010, 0x00b6, 0x2058, 0xb8a0, 0x00be, 0x2004, 0x635c, 0xab7a,
+	0xa876, 0x9006, 0xa87e, 0xa882, 0xad9a, 0xae96, 0xa89f, 0x0001,
+	0x080c, 0x6996, 0x2019, 0x0045, 0x6008, 0x2068, 0x080c, 0xcdf9,
+	0x2d00, 0x600a, 0x6023, 0x0006, 0x6003, 0x0007, 0x901e, 0x631a,
+	0x634a, 0x003e, 0x0038, 0x604b, 0x0000, 0x6003, 0x0007, 0x080c,
+	0xcc3b, 0x00ce, 0x00de, 0x009e, 0x0005, 0x9186, 0x0013, 0x1128,
+	0x6004, 0x9082, 0x0085, 0x2008, 0x00c2, 0x9186, 0x0027, 0x1178,
+	0x080c, 0x8874, 0x0036, 0x0096, 0x6014, 0x2048, 0x2019, 0x0004,
+	0x080c, 0xd21e, 0x009e, 0x003e, 0x080c, 0x8936, 0x0005, 0x9186,
+	0x0014, 0x0d70, 0x080c, 0x9ca2, 0x0005, 0xd42c, 0xd42a, 0xd42a,
+	0xd42a, 0xd42a, 0xd42a, 0xd42c, 0xd42a, 0xd42a, 0xd42a, 0xd42a,
+	0xd42a, 0xd42a, 0x080c, 0x0d65, 0x6003, 0x000c, 0x080c, 0x8936,
+	0x0005, 0x9182, 0x0092, 0x1220, 0x9182, 0x0085, 0x0208, 0x001a,
+	0x080c, 0x9ca2, 0x0005, 0xd448, 0xd448, 0xd448, 0xd448, 0xd44a,
+	0xd46a, 0xd448, 0xd448, 0xd448, 0xd448, 0xd448, 0xd448, 0xd448,
+	0x080c, 0x0d65, 0x00d6, 0x2c68, 0x080c, 0x9b91, 0x01b0, 0x6003,
+	0x0001, 0x6007, 0x001e, 0x2009, 0x026e, 0x210c, 0x613a, 0x2009,
+	0x026f, 0x210c, 0x613e, 0x600b, 0xffff, 0x6910, 0x6112, 0x6023,
+	0x0004, 0x2009, 0x8020, 0x080c, 0x84d1, 0x2d60, 0x080c, 0x9be7,
+	0x00de, 0x0005, 0x080c, 0x9be7, 0x0005, 0x00e6, 0x6010, 0x00b6,
+	0x2058, 0xb800, 0x00be, 0xd0ec, 0x00ee, 0x0005, 0x2009, 0x1873,
+	0x210c, 0xd1ec, 0x05b0, 0x6003, 0x0002, 0x6024, 0xc0e5, 0x6026,
+	0xd0cc, 0x0150, 0x2001, 0x1959, 0x2004, 0x604a, 0x2009, 0x1873,
+	0x210c, 0xd1f4, 0x1520, 0x00a0, 0x2009, 0x1873, 0x210c, 0xd1f4,
+	0x0128, 0x6024, 0xc0e4, 0x6026, 0x9006, 0x00d8, 0x2001, 0x1959,
+	0x200c, 0x2001, 0x1957, 0x2004, 0x9100, 0x9080, 0x000a, 0x604a,
+	0x6010, 0x00b6, 0x2058, 0xb8ac, 0x00be, 0x0008, 0x2104, 0x9005,
+	0x0118, 0x9088, 0x0003, 0x0cd0, 0x2c0a, 0x600f, 0x0000, 0x9085,
+	0x0001, 0x0005, 0x0016, 0x00c6, 0x00e6, 0x615c, 0xb8ac, 0x2060,
+	0x8cff, 0x0180, 0x84ff, 0x1118, 0x605c, 0x9106, 0x1138, 0x600c,
+	0x2072, 0x080c, 0x83c0, 0x080c, 0x9be7, 0x0010, 0x9cf0, 0x0003,
+	0x2e64, 0x0c70, 0x00ee, 0x00ce, 0x001e, 0x0005, 0x00d6, 0x00b6,
+	0x6010, 0x2058, 0xb8ac, 0x2068, 0x9005, 0x0130, 0x9c06, 0x0110,
+	0x680c, 0x0cd0, 0x600c, 0x680e, 0x00be, 0x00de, 0x0005, 0x0026,
+	0x0036, 0x0156, 0x2011, 0x182b, 0x2204, 0x9084, 0x00ff, 0x2019,
+	0x026e, 0x2334, 0x9636, 0x1508, 0x8318, 0x2334, 0x2204, 0x9084,
+	0xff00, 0x9636, 0x11d0, 0x2011, 0x0270, 0x20a9, 0x0004, 0x6010,
+	0x0096, 0x2048, 0x2019, 0x000a, 0x080c, 0xabdf, 0x009e, 0x1168,
+	0x2011, 0x0274, 0x20a9, 0x0004, 0x6010, 0x0096, 0x2048, 0x2019,
+	0x0006, 0x080c, 0xabdf, 0x009e, 0x1100, 0x015e, 0x003e, 0x002e,
+	0x0005, 0x00e6, 0x2071, 0x1800, 0x080c, 0x5c6f, 0x080c, 0x2ddb,
+	0x00ee, 0x0005, 0x00e6, 0x6010, 0x00b6, 0x2058, 0xb800, 0x00be,
+	0xd0fc, 0x0108, 0x0011, 0x00ee, 0x0005, 0xa880, 0xc0e5, 0xa882,
+	0x0005, 0x00e6, 0x00d6, 0x00c6, 0x0076, 0x0066, 0x0056, 0x0046,
+	0x0026, 0x0016, 0x0126, 0x2091, 0x8000, 0x2029, 0x19c4, 0x252c,
+	0x2021, 0x19cb, 0x2424, 0x2061, 0x1ddc, 0x2071, 0x1800, 0x7650,
+	0x7070, 0x9606, 0x0578, 0x6720, 0x9786, 0x0001, 0x0118, 0x9786,
+	0x0008, 0x1500, 0x2500, 0x9c06, 0x01e8, 0x2400, 0x9c06, 0x01d0,
+	0x080c, 0xd2a4, 0x01b8, 0x080c, 0xd2b4, 0x11a0, 0x6000, 0x9086,
+	0x0004, 0x1120, 0x0016, 0x080c, 0x1914, 0x001e, 0x080c, 0xba4b,
+	0x1110, 0x080c, 0x303b, 0x080c, 0xba5c, 0x1110, 0x080c, 0xa58f,
+	0x080c, 0x9c21, 0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004, 0x9c02,
+	0x1208, 0x0858, 0x012e, 0x001e, 0x002e, 0x004e, 0x005e, 0x006e,
+	0x007e, 0x00ce, 0x00de, 0x00ee, 0x0005, 0x2001, 0x1810, 0x2004,
+	0xd0dc, 0x0005, 0x0006, 0x2001, 0x1836, 0x2004, 0xd09c, 0x000e,
+	0x0005, 0x0006, 0x0036, 0x0046, 0x080c, 0xbf61, 0x0168, 0x2019,
+	0xffff, 0x9005, 0x0128, 0x6010, 0x00b6, 0x2058, 0xbba0, 0x00be,
+	0x2021, 0x0004, 0x080c, 0x4a75, 0x004e, 0x003e, 0x000e, 0x6004,
+	0x9086, 0x0001, 0x1128, 0x080c, 0x94f4, 0x080c, 0x9c21, 0x9006,
+	0x0005, 0x00e6, 0x00c6, 0x00b6, 0x0046, 0x2061, 0x1ddc, 0x2071,
+	0x1800, 0x7450, 0x7070, 0x8001, 0x9402, 0x12b8, 0x2100, 0x9c06,
+	0x0148, 0x6000, 0x9086, 0x0000, 0x0128, 0x6010, 0x2058, 0xb8a0,
+	0x9206, 0x0140, 0x9ce0, 0x001c, 0x2001, 0x1819, 0x2004, 0x9c02,
+	0x1220, 0x0c60, 0x9085, 0x0001, 0x0008, 0x9006, 0x004e, 0x00be,
+	0x00ce, 0x00ee, 0x0005, 0x0126, 0x0006, 0x00e6, 0x0016, 0x2091,
+	0x8000, 0x2071, 0x1840, 0xd5a4, 0x0118, 0x7034, 0x8000, 0x7036,
+	0xd5b4, 0x0118, 0x7030, 0x8000, 0x7032, 0xd5ac, 0x0178, 0x2500,
+	0x9084, 0x0007, 0x908e, 0x0003, 0x0148, 0x908e, 0x0004, 0x0130,
+	0x908e, 0x0005, 0x0118, 0x2071, 0x184a, 0x0089, 0x001e, 0x00ee,
+	0x000e, 0x012e, 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091, 0x8000,
+	0x2071, 0x1842, 0x0021, 0x00ee, 0x000e, 0x012e, 0x0005, 0x2e04,
+	0x8000, 0x2072, 0x1220, 0x8e70, 0x2e04, 0x8000, 0x2072, 0x0005,
+	0x00e6, 0x2071, 0x1840, 0x0c99, 0x00ee, 0x0005, 0x00e6, 0x2071,
+	0x1844, 0x0c69, 0x00ee, 0x0005, 0x0126, 0x0006, 0x00e6, 0x2091,
+	0x8000, 0x2071, 0x1840, 0x7044, 0x8000, 0x7046, 0x00ee, 0x000e,
+	0x012e, 0x0005, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020,
+	0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000,
+	0x4000, 0x8000, 0xfddb
 };
 #ifdef UNIQUE_FW_NAME
-unsigned short fw2322flx_length01 = 0xce19;
+unsigned short fw2322flx_length01 = 0xce3b;
 #else
-unsigned short risc_code_length01 = 0xce19;
+unsigned short risc_code_length01 = 0xce3b;
 #endif
 
 /*
diff -Nru a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
--- a/drivers/scsi/qla2xxx/qla_dbg.c	Tue Jun 15 22:20:59 2004
+++ b/drivers/scsi/qla2xxx/qla_dbg.c	Tue Jun 15 22:20:59 2004
@@ -53,7 +53,7 @@
 		qla_printk(KERN_WARNING, ha,
 		    "Firmware has been previously dumped (%p) -- ignoring "
 		    "request...\n", ha->fw_dump);
-		return;
+		goto qla2300_fw_dump_failed;
 	}
 
 	/* Allocate (large) dump buffer. */
@@ -64,7 +64,7 @@
 		qla_printk(KERN_WARNING, ha,
 		    "Unable to allocated memory for firmware dump (%d/%Zd).\n",
 		    ha->fw_dump_order, sizeof(struct qla2300_fw_dump));
-		return;
+		goto qla2300_fw_dump_failed;
 	}
 	fw = ha->fw_dump;
 
@@ -360,7 +360,7 @@
 
 	if (rval != QLA_SUCCESS) {
 		qla_printk(KERN_WARNING, ha,
-		    "Failed to dump firmware (%d)!!!\n", rval);
+		    "Failed to dump firmware (%x)!!!\n", rval);
 
 		free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order);
 		ha->fw_dump = NULL;
@@ -370,6 +370,7 @@
 		    ha->host_no, ha->fw_dump);
 	}
 
+qla2300_fw_dump_failed:
 	if (!hardware_locked)
 		spin_unlock_irqrestore(&ha->hardware_lock, flags);
 }
@@ -569,7 +570,7 @@
 {
 	int		rval;
 	uint32_t	cnt, timer;
-	uint32_t	risc_address;
+	uint16_t	risc_address;
 	uint16_t	mb0, mb2;
 
 	device_reg_t	*reg;
@@ -589,7 +590,7 @@
 		qla_printk(KERN_WARNING, ha,
 		    "Firmware has been previously dumped (%p) -- ignoring "
 		    "request...\n", ha->fw_dump);
-		return;
+		goto qla2100_fw_dump_failed;
 	}
 
 	/* Allocate (large) dump buffer. */
@@ -600,7 +601,7 @@
 		qla_printk(KERN_WARNING, ha,
 		    "Unable to allocated memory for firmware dump (%d/%Zd).\n",
 		    ha->fw_dump_order, sizeof(struct qla2100_fw_dump));
-		return;
+		goto qla2100_fw_dump_failed;
 	}
 	fw = ha->fw_dump;
 
@@ -616,7 +617,6 @@
 		else
 			rval = QLA_FUNCTION_TIMEOUT;
 	}
-
 	if (rval == QLA_SUCCESS) {
 		dmp_reg = (uint16_t *)(reg + 0);
 		for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++) 
@@ -694,18 +694,8 @@
 		for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++) 
 			fw->fpm_b1_reg[cnt] = RD_REG_WORD(dmp_reg++);
 
-		/* Disable ISP interrupts. */
-		WRT_REG_WORD(&reg->ictrl, 0);
-
-		/* Reset RISC module. */
-		WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC);
-
-		/* Release RISC module. */
-		WRT_REG_WORD(&reg->hccr, HCCR_RELEASE_RISC); 
-
-		/* Insure mailbox registers are free. */
-		WRT_REG_WORD(&reg->hccr, HCCR_CLR_RISC_INT); 
-		WRT_REG_WORD(&reg->hccr, HCCR_CLR_HOST_INT); 
+		/* Reset the ISP. */
+		WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
 	}
 
 	for (cnt = 30000; RD_MAILBOX_REG(ha, reg, 0) != 0 &&
@@ -729,7 +719,6 @@
 			else
 				rval = QLA_FUNCTION_TIMEOUT;
 		}
-
 		if (rval == QLA_SUCCESS) {
 			/* Set memory configuration and timing. */
 			if (IS_QLA2100(ha))
@@ -750,7 +739,7 @@
 	}
 	for (cnt = 0; cnt < sizeof(fw->risc_ram) / 2 && rval == QLA_SUCCESS;
 	    cnt++, risc_address++) {
- 		WRT_MAILBOX_REG(ha, reg, 1, (uint16_t)risc_address);
+ 		WRT_MAILBOX_REG(ha, reg, 1, risc_address);
 		WRT_REG_WORD(&reg->hccr, HCCR_SET_HOST_INT);
 
 		for (timer = 6000000; timer != 0; timer--) {
@@ -783,7 +772,7 @@
 
 	if (rval != QLA_SUCCESS) {
 		qla_printk(KERN_WARNING, ha,
-		    "Failed to dump firmware (%d)!!!\n", rval);
+		    "Failed to dump firmware (%x)!!!\n", rval);
 
 		free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order);
 		ha->fw_dump = NULL;
@@ -793,6 +782,7 @@
 		    ha->host_no, ha->fw_dump);
 	}
 
+qla2100_fw_dump_failed:
 	if (!hardware_locked)
 		spin_unlock_irqrestore(&ha->hardware_lock, flags);
 }
diff -Nru a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
--- a/drivers/scsi/qla2xxx/qla_def.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/qla2xxx/qla_def.h	Tue Jun 15 22:20:41 2004
@@ -154,6 +154,9 @@
 #define RD_REG_BYTE(addr)		readb(addr)
 #define RD_REG_WORD(addr)		readw(addr)
 #define RD_REG_DWORD(addr)		readl(addr)
+#define RD_REG_BYTE_RELAXED(addr)	readb_relaxed(addr)
+#define RD_REG_WORD_RELAXED(addr)	readw_relaxed(addr)
+#define RD_REG_DWORD_RELAXED(addr)	readl_relaxed(addr)
 #define WRT_REG_BYTE(addr, data)	writeb(data,addr)
 #define WRT_REG_WORD(addr, data)	writew(data,addr)
 #define WRT_REG_DWORD(addr, data)	writel(data,addr)
@@ -209,20 +212,11 @@
 #define MAX_OUTSTANDING_COMMANDS	1024
 
 /* ISP request and response entry counts (37-65535) */
-#define REQUEST_ENTRY_CNT		2048	/* Number of request entries. */
+#define REQUEST_ENTRY_CNT_2100		128	/* Number of request entries. */
+#define REQUEST_ENTRY_CNT_2200		2048	/* Number of request entries. */
 #define RESPONSE_ENTRY_CNT_2100		64	/* Number of response entries.*/
 #define RESPONSE_ENTRY_CNT_2300		512	/* Number of response entries.*/
 
-/* Calculations for SG segments */
-#define SEGS_PER_REQUEST_32	3 
-#define SEGS_PER_CONT_32	7
-#define SG_SEGMENTS_32 (SEGS_PER_REQUEST_32 + \
-    (SEGS_PER_CONT_32 * (REQUEST_ENTRY_CNT - 2)))     
-#define SEGS_PER_REQUEST_64	2 
-#define SEGS_PER_CONT_64	5
-#define SG_SEGMENTS_64 (SEGS_PER_REQUEST_64 + \
-    (SEGS_PER_CONT_64 * (REQUEST_ENTRY_CNT - 2)))     
-
 /*
  * SCSI Request Block 
  */
@@ -294,7 +288,8 @@
 
 #define SRB_BUSY		BIT_8	/* Command is in busy retry state */
 #define SRB_FO_CANCEL		BIT_9	/* Command don't need to do failover */
-#define	SRB_IOCTL		BIT_10	/* IOCTL command. */
+#define SRB_IOCTL		BIT_10	/* IOCTL command. */
+#define SRB_TAPE		BIT_11	/* FCP2 (Tape) command. */
 
 /*
  * SRB state definitions
@@ -1931,10 +1926,6 @@
 #define	RFT_ID_SNS_CMD_SIZE	60
 #define	RFT_ID_SNS_DATA_SIZE	16
 
-#define	RFF_ID_SNS_SCMD_LEN	8
-#define	RFF_ID_SNS_CMD_SIZE	32
-#define	RFF_ID_SNS_DATA_SIZE	16
-
 #define	RNN_ID_SNS_SCMD_LEN	10
 #define	RNN_ID_SNS_CMD_SIZE	36
 #define	RNN_ID_SNS_DATA_SIZE	16
@@ -1970,7 +1961,6 @@
 		} cmd;
 
 		uint8_t rft_data[RFT_ID_SNS_DATA_SIZE];
-		uint8_t rff_data[RFF_ID_SNS_DATA_SIZE];
 		uint8_t rnn_data[RNN_ID_SNS_DATA_SIZE];
 		uint8_t gan_data[GA_NXT_SNS_DATA_SIZE];
 		uint8_t gid_data[GID_PT_SNS_DATA_SIZE];
@@ -2123,6 +2113,7 @@
 	request_t       *request_ring_ptr;  /* Current address. */
 	uint16_t        req_ring_index;     /* Current index. */
 	uint16_t        req_q_cnt;          /* Number of available entries. */
+	uint16_t	request_q_length;
 
 	dma_addr_t	response_dma;       /* Physical address. */
 	response_t      *response_ring;     /* Base virtual address */
@@ -2340,8 +2331,6 @@
 
 	uint8_t     node_name[WWN_SIZE];
 	uint8_t     nvram_version; 
-	uint8_t     optrom_major; 
-	uint8_t     optrom_minor; 
 	uint32_t    isp_abort_cnt;
 
 	/* Adapter I/O statistics for failover */
diff -Nru a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
--- a/drivers/scsi/qla2xxx/qla_gbl.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/scsi/qla2xxx/qla_gbl.h	Tue Jun 15 22:21:05 2004
@@ -198,7 +198,7 @@
 qla2x00_get_port_name(scsi_qla_host_t *, uint16_t, uint8_t *, uint8_t);
 
 extern uint8_t
-qla2x00_get_link_status(scsi_qla_host_t *, uint8_t, link_stat_t *, uint16_t *);
+qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, link_stat_t *, uint16_t *);
 
 extern int
 qla2x00_lip_reset(scsi_qla_host_t *);
@@ -255,14 +255,6 @@
 extern void qla2x00_unlock_nvram_access(scsi_qla_host_t *);
 extern uint16_t qla2x00_get_nvram_word(scsi_qla_host_t *, uint32_t);
 extern void qla2x00_write_nvram_word(scsi_qla_host_t *, uint32_t, uint16_t);
-extern void qla2x00_flash_enable(scsi_qla_host_t *);
-extern void qla2x00_flash_disable(scsi_qla_host_t *);
-extern uint8_t qla2x00_read_flash_byte(scsi_qla_host_t *, uint32_t);
-extern uint8_t qla2x00_get_flash_manufacturer(scsi_qla_host_t *);
-extern uint16_t qla2x00_get_flash_version(scsi_qla_host_t *);
-extern uint16_t qla2x00_get_flash_image(scsi_qla_host_t *, uint8_t *);
-extern uint16_t qla2x00_set_flash_image(scsi_qla_host_t *, uint8_t *);
-
 /*
  * Global Function Prototypes in qla_dbg.c source file.
  */
diff -Nru a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
--- a/drivers/scsi/qla2xxx/qla_gs.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/scsi/qla2xxx/qla_gs.c	Tue Jun 15 22:20:38 2004
@@ -34,7 +34,6 @@
 static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *);
 static int qla2x00_sns_gnn_id(scsi_qla_host_t *, sw_info_t *);
 static int qla2x00_sns_rft_id(scsi_qla_host_t *);
-static int qla2x00_sns_rff_id(scsi_qla_host_t *);
 static int qla2x00_sns_rnn_id(scsi_qla_host_t *);
 
 /**
@@ -113,7 +112,7 @@
 	struct ct_sns_req	*ct_req;
 	struct ct_sns_rsp	*ct_rsp;
 
-	if (IS_QLA2200(ha)) {
+	if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 		return (qla2x00_sns_ga_nxt(ha, fcport));
 	}
 
@@ -201,7 +200,7 @@
 
 	struct ct_sns_gid_pt_data *gid_data;
 
-	if (IS_QLA2200(ha)) {
+	if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 		return (qla2x00_sns_gid_pt(ha, list));
 	}
 
@@ -278,7 +277,7 @@
 	struct ct_sns_req	*ct_req;
 	struct ct_sns_rsp	*ct_rsp;
 
-	if (IS_QLA2200(ha)) {
+	if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 		return (qla2x00_sns_gpn_id(ha, list));
 	}
 
@@ -343,7 +342,7 @@
 	struct ct_sns_req	*ct_req;
 	struct ct_sns_rsp	*ct_rsp;
 
-	if (IS_QLA2200(ha)) {
+	if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 		return (qla2x00_sns_gnn_id(ha, list));
 	}
 
@@ -422,7 +421,7 @@
 	struct ct_sns_req	*ct_req;
 	struct ct_sns_rsp	*ct_rsp;
 
-	if (IS_QLA2200(ha)) {
+	if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 		return (qla2x00_sns_rft_id(ha));
 	}
 
@@ -479,8 +478,10 @@
 	struct ct_sns_req	*ct_req;
 	struct ct_sns_rsp	*ct_rsp;
 
-	if (IS_QLA2200(ha)) {
-		return (qla2x00_sns_rff_id(ha));
+	if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
+		DEBUG2(printk("scsi(%ld): RFF_ID call unsupported on "
+		    "ISP2100/ISP2200.\n", ha->host_no));
+		return (QLA_SUCCESS);
 	}
 
 	/* Issue RFF_ID */
@@ -536,7 +537,7 @@
 	struct ct_sns_req	*ct_req;
 	struct ct_sns_rsp	*ct_rsp;
 
-	if (IS_QLA2200(ha)) {
+	if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 		return (qla2x00_sns_rnn_id(ha));
 	}
 
@@ -595,9 +596,9 @@
 	struct ct_sns_req	*ct_req;
 	struct ct_sns_rsp	*ct_rsp;
 
-	if (IS_QLA2200(ha)) {
+	if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 		DEBUG2(printk("scsi(%ld): RSNN_ID call unsupported on "
-		    "ISP2200.\n", ha->host_no));
+		    "ISP2100/ISP2200.\n", ha->host_no));
 		return (QLA_SUCCESS);
 	}
 
@@ -997,55 +998,6 @@
 		rval = QLA_FUNCTION_FAILED;
 	} else {
 		DEBUG2(printk("scsi(%ld): RFT_ID exiting normally.\n",
-		    ha->host_no));
-	}
-
-	return (rval);
-}
-
-/**
- * qla2x00_sns_rff_id() - SNS Register FC-4 Features (RFF_ID) supported by the
- * HBA.
- * @ha: HA context
- *
- * This command uses the old Exectute SNS Command mailbox routine.
- *
- * Returns 0 on success.
- */
-static int
-qla2x00_sns_rff_id(scsi_qla_host_t *ha)
-{
-	int		rval;
-
-	struct sns_cmd_pkt	*sns_cmd;
-
-	/* Issue RFF_ID. */
-	/* Prepare SNS command request. */
-	sns_cmd = qla2x00_prep_sns_cmd(ha, RFF_ID_CMD, RFF_ID_SNS_SCMD_LEN,
-	    RFF_ID_SNS_DATA_SIZE);
-
-	/* Prepare SNS command arguments -- port_id, FC-4 feature, FC-4 type */
-	sns_cmd->p.cmd.param[0] = ha->d_id.b.al_pa;
-	sns_cmd->p.cmd.param[1] = ha->d_id.b.area;
-	sns_cmd->p.cmd.param[2] = ha->d_id.b.domain;
-
-	sns_cmd->p.cmd.param[6] = 0x08;			/* SCSI - FCP */
-
-	/* Execute SNS command. */
-	rval = qla2x00_send_sns(ha, ha->sns_cmd_dma, RFF_ID_SNS_CMD_SIZE / 2,
-	    sizeof(struct sns_cmd_pkt));
-	if (rval != QLA_SUCCESS) {
-		/*EMPTY*/
-		DEBUG2_3(printk("scsi(%ld): RFF_ID Send SNS failed (%d).\n",
-		    ha->host_no, rval));
-	} else if (sns_cmd->p.rff_data[8] != 0x80 ||
-	    sns_cmd->p.rff_data[9] != 0x02) {
-		DEBUG2_3(printk("scsi(%ld): RFF_ID failed, rejected request, "
-		    "rff_rsp:\n", ha->host_no));
-		DEBUG2_3(qla2x00_dump_buffer(sns_cmd->p.rff_data, 16));
-		rval = QLA_FUNCTION_FAILED;
-	} else {
-		DEBUG2(printk("scsi(%ld): RFF_ID exiting normally.\n",
 		    ha->host_no));
 	}
 
diff -Nru a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
--- a/drivers/scsi/qla2xxx/qla_init.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/scsi/qla2xxx/qla_init.c	Tue Jun 15 22:21:02 2004
@@ -102,9 +102,9 @@
 qla2x00_initialize_adapter(scsi_qla_host_t *ha)
 {
 	int	rval;
-	uint8_t	isp_init = 0;
 	uint8_t	restart_risc = 0;
 	uint8_t	retry;
+	uint32_t wait_time;
 
 	/* Clear adapter flags. */
 	ha->flags.online = FALSE;
@@ -133,14 +133,9 @@
 	/* Initialize target map database. */
 	qla2x00_init_tgt_map(ha);
 
-	/* Get Flash Version */
-	qla2x00_get_flash_version(ha);
-
 	qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n");
 	qla2x00_nvram_config(ha);
 
-	ha->retry_count = ql2xretrycount;
-
 	qla_printk(KERN_INFO, ha, "Verifying loaded RISC code...\n");
 
 #if 0
@@ -161,7 +156,6 @@
 	 */
 	do {
 		restart_risc = 0;
-		isp_init = 0;
 
 		/* If firmware needs to be loaded */
 		if (qla2x00_isp_firmware(ha) != QLA_SUCCESS) {
@@ -180,21 +174,22 @@
 			 * value OR a minimum of 4 seconds OR If no 
 			 * cable, only 5 seconds.
 			 */
-			if (!qla2x00_fw_ready(ha)) {
+			rval = qla2x00_fw_ready(ha);
+			if (rval == QLA_SUCCESS) {
 				clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
 
 				/*
-				 * Go setup flash database devices with proper
-				 * Loop ID's.
+				 * Wait at most MAX_TARGET RSCNs for a stable
+				 * link.
 				 */
+				wait_time = 256;
 				do {
 					clear_bit(LOOP_RESYNC_NEEDED,
 					    &ha->dpc_flags);
 					rval = qla2x00_configure_loop(ha);
 
-					if (test_bit(ISP_ABORT_NEEDED,
+					if (test_and_clear_bit(ISP_ABORT_NEEDED,
 					    &ha->dpc_flags)) {
-
 						restart_risc = 1;
 						break;
 					}
@@ -209,20 +204,22 @@
 					    LOOP_DOWN && retry--) {
 						goto check_fw_ready_again;
 					}
+					wait_time--;
 				} while (!atomic_read(&ha->loop_down_timer) &&
 				    retry &&
-				    (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)));
+				    wait_time &&
+				    (test_bit(LOOP_RESYNC_NEEDED,
+					&ha->dpc_flags)));
+
+				if (wait_time == 0)
+					rval = QLA_FUNCTION_FAILED;
+				if (ha->mem_err)
+					restart_risc = 1;
 			}
-
-			if (ha->mem_err) {
-				restart_risc = 1;
-			}
-			isp_init = 1;
-
 		}
 	} while (restart_risc && retry--);
 
-	if (isp_init) {
+	if (rval == QLA_SUCCESS) {
 		/* Retrieve firmware information */
 		qla2x00_get_fw_version(ha, &ha->fw_major_version,
 		    &ha->fw_minor_version, &ha->fw_subminor_version,
@@ -234,9 +231,7 @@
 		ha->marker_needed = 0;
 
 		ha->flags.online = TRUE;
-	}
-
-	if (rval) {
+	} else {
 		DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));
 	}
 
@@ -290,7 +285,7 @@
 		/* PCI Specification Revision 2.3 changes */
 		if (IS_QLA2322(ha) || IS_QLA6322(ha))
 			/* Command Register - Reset Interrupt Disable. */
-			w &= ~BIT_10;
+			w &= ~PCI_COMMAND_INTX_DISABLE;
 
 		/*
 		 * If this is a 2300 card and not 2312, reset the
@@ -603,10 +598,11 @@
 	ha->product_id[3] = mb[4];
 
 	/* Adjust fw RISC transfer size */
-	if (REQUEST_ENTRY_CNT > 1024)
+	if (ha->request_q_length > 1024)
 		ha->fw_transfer_size = REQUEST_ENTRY_SIZE * 1024;
 	else
-		ha->fw_transfer_size = REQUEST_ENTRY_SIZE * REQUEST_ENTRY_CNT;
+		ha->fw_transfer_size = REQUEST_ENTRY_SIZE *
+		    ha->request_q_length;
 
 	if (IS_QLA2200(ha) &&
 	    RD_MAILBOX_REG(ha, reg, 7) == QLA2200A_RISC_ROM_VER) {
@@ -774,6 +770,54 @@
 }
 
 /**
+ * qla2x00_update_fw_options() - Read and process firmware options.
+ * @ha: HA context
+ *
+ * Returns 0 on success.
+ */
+static void
+qla2x00_update_fw_options(scsi_qla_host_t *ha)
+{
+	/* Setup seriallink options */
+	uint16_t swing, emphasis;
+
+	memset(ha->fw_options, 0, sizeof(ha->fw_options));
+	qla2x00_get_fw_options(ha, ha->fw_options);
+
+	if (IS_QLA2100(ha) || IS_QLA2200(ha))
+		return;
+
+	/* Serial Link options. */
+	DEBUG3(printk("scsi(%ld): Serial link options:\n",
+	    ha->host_no));
+	DEBUG3(qla2x00_dump_buffer((uint8_t *)&ha->fw_seriallink_options,
+	    sizeof(ha->fw_seriallink_options)));
+
+	ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
+	if (ha->fw_seriallink_options[1] & BIT_2)
+		ha->fw_options[1] |= FO1_SET_EMPHASIS_SWING;
+
+	/*  1G settings */
+	swing = ha->fw_seriallink_options[0] & (BIT_2 | BIT_1 | BIT_0);
+	emphasis = ha->fw_seriallink_options[0] & (BIT_4 | BIT_3);
+	emphasis >>= 3;
+	ha->fw_options[10] = (emphasis << 14) | (swing << 8) | 0x3;
+
+	/*  2G settings */
+	swing = ha->fw_seriallink_options[0] & (BIT_7 | BIT_6 | BIT_5);
+	swing >>= 5;
+	emphasis = ha->fw_seriallink_options[1] & (BIT_1 | BIT_0);
+	ha->fw_options[11] = (emphasis << 14) | (swing << 8) | 0x3;
+
+	/* FCP2 options. */
+	/*  Return command IOCBs without waiting for an ABTS to complete. */
+	ha->fw_options[3] |= BIT_13;
+
+	/* Update Serial Link options. */
+	qla2x00_set_fw_options(ha, ha->fw_options);
+}
+
+/**
  * qla2x00_init_rings() - Initializes firmware.
  * @ha: HA context
  *
@@ -805,7 +849,7 @@
 	/* Initialize firmware. */
 	ha->request_ring_ptr  = ha->request_ring;
 	ha->req_ring_index    = 0;
-	ha->req_q_cnt         = REQUEST_ENTRY_CNT;
+	ha->req_q_cnt         = ha->request_q_length;
 	ha->response_ring_ptr = ha->response_ring;
 	ha->rsp_ring_index    = 0;
 
@@ -826,35 +870,8 @@
 		DEBUG2_3(printk("scsi(%ld): Init firmware **** FAILED ****.\n",
 		    ha->host_no));
 	} else {
-		/* Setup seriallink options */
-		uint16_t swing, emphasis;
-
-		DEBUG3(printk("scsi(%ld): Serial link options:\n",
-		    ha->host_no));
-		DEBUG3(qla2x00_dump_buffer(
-		    (uint8_t *)&ha->fw_seriallink_options,
-		    sizeof(ha->fw_seriallink_options)));
-
-		memset(ha->fw_options, 0, sizeof(ha->fw_options));
-		qla2x00_get_fw_options(ha, ha->fw_options);
-
-		ha->fw_options[1] &= ~FO1_SET_EMPHASIS_SWING;
-		if (ha->fw_seriallink_options[1] & BIT_2)
-			ha->fw_options[1] |= FO1_SET_EMPHASIS_SWING;
-
-		/* 1G settings */
-		swing = ha->fw_seriallink_options[0] & (BIT_2 | BIT_1 | BIT_0);
-		emphasis = ha->fw_seriallink_options[0] & (BIT_4 | BIT_3);
-		emphasis >>= 3;
-		ha->fw_options[10] = (emphasis << 14) | (swing << 8) | 0x3;
-
-		/* 2G settings */
-		swing = ha->fw_seriallink_options[0] & (BIT_7 | BIT_6 | BIT_5);
-		swing >>= 5;
-		emphasis = ha->fw_seriallink_options[1] & (BIT_1 | BIT_0);
-		ha->fw_options[11] = (emphasis << 14) | (swing << 8) | 0x3;
-
-		qla2x00_set_fw_options(ha, ha->fw_options);
+		/* Update any ISP specific firmware options. */
+		qla2x00_update_fw_options(ha);
 
 		DEBUG3(printk("scsi(%ld): Init firmware -- success.\n",
 		    ha->host_no));
@@ -946,7 +963,7 @@
 			break;
 
 		/* Delay for a while */
-		set_current_state(TASK_INTERRUPTIBLE);
+		set_current_state(TASK_UNINTERRUPTIBLE);
 		schedule_timeout(HZ / 2);
 
 		DEBUG3(printk("scsi(%ld): fw_state=%x curr time=%lx.\n",
@@ -1005,10 +1022,6 @@
 
 	ha->loop_id = loop_id;
 
-	/* Make sure 2100 only has loop, in case of any firmware bug. */
-	if (IS_QLA2100(ha))
-		topo = 0;
-
 	/* initialize */
 	ha->min_external_loopid = SNS_FIRST_LOOP_ID;
 	ha->operating_mode = LOOP;
@@ -1381,7 +1394,7 @@
 	 */
 	icb->request_q_outpointer = __constant_cpu_to_le16(0);
 	icb->response_q_inpointer = __constant_cpu_to_le16(0);
-	icb->request_q_length = __constant_cpu_to_le16(REQUEST_ENTRY_CNT);
+	icb->request_q_length = cpu_to_le16(ha->request_q_length);
 	icb->response_q_length = cpu_to_le16(ha->response_q_length);
 	icb->request_q_address[0] = cpu_to_le32(LSD(ha->request_dma));
 	icb->request_q_address[1] = cpu_to_le32(MSD(ha->request_dma));
@@ -1496,24 +1509,24 @@
 qla2x00_configure_loop(scsi_qla_host_t *ha) 
 {
 	int  rval;
-	uint8_t  rval1 = 0;
 	unsigned long flags, save_flags;
 
 	rval = QLA_SUCCESS;
 
 	/* Get Initiator ID */
-	if (qla2x00_configure_hba(ha)) {
-		DEBUG(printk("scsi(%ld): Unable to configure HBA.\n",
-		    ha->host_no));
-		return (QLA_FUNCTION_FAILED);
+	if (test_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags)) {
+		rval = qla2x00_configure_hba(ha);
+		if (rval != QLA_SUCCESS) {
+			DEBUG(printk("scsi(%ld): Unable to configure HBA.\n",
+			    ha->host_no));
+			return (rval);
+		}
 	}
 
 	save_flags = flags = ha->dpc_flags;
 	DEBUG(printk("scsi(%ld): Configure loop -- dpc flags =0x%lx\n",
 	    ha->host_no, flags));
 
-	/* dg 02/26/02 ha->dpc_flags &= ~(LOCAL_LOOP_UPDATE | RSCN_UPDATE); */
-
 	/*
 	 * If we have both an RSCN and PORT UPDATE pending then handle them
 	 * both at the same time.
@@ -1544,50 +1557,32 @@
 		set_bit(LOCAL_LOOP_UPDATE, &flags);
 	}
 
-	do {
-		if (test_bit(LOCAL_LOOP_UPDATE, &flags)) {
-			rval = rval | qla2x00_configure_local_loop(ha);
-		}
-
-		if (test_bit(RSCN_UPDATE, &flags)) {
-			rval1 = qla2x00_configure_fabric(ha);
-			if ((rval1 & BIT_0) && ha->sns_retry_cnt < 8) {
-				ha->sns_retry_cnt++;
-				set_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags);
-			}
+	if (test_bit(LOCAL_LOOP_UPDATE, &flags)) {
+		if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {
+			rval = QLA_FUNCTION_FAILED;
+		} else {
+			rval = qla2x00_configure_local_loop(ha);
 		}
+	}
 
-		/* Isolate error status. */
-		if (rval & BIT_0) {
-			rval = 1;
+	if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) {
+		if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {
+			rval = QLA_FUNCTION_FAILED;
 		} else {
-			rval = QLA_SUCCESS;
+			rval = qla2x00_configure_fabric(ha);
 		}
+	}
 
-	} while (rval != QLA_SUCCESS);
-
-	if (!atomic_read(&ha->loop_down_timer) &&
-	    !(test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags))) {
-
-		qla2x00_config_os(ha);
-
-		/* If we found all devices then go ready */
-		if (!(test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags))) {
+	if (rval == QLA_SUCCESS) {
+		if (atomic_read(&ha->loop_down_timer) ||
+		    test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {
+			rval = QLA_FUNCTION_FAILED;
+		} else {
+			qla2x00_config_os(ha);
 			atomic_set(&ha->loop_state, LOOP_READY);
 
 			DEBUG(printk("scsi(%ld): LOOP READY\n", ha->host_no));
-		} else {
-			if (test_bit(LOCAL_LOOP_UPDATE, &save_flags))
-				set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
-			if (test_bit(RSCN_UPDATE, &save_flags))
-				set_bit(RSCN_UPDATE, &ha->dpc_flags);
 		}
-	} else {
-		DEBUG(printk("scsi(%ld): Loop down counter running= %d or "
-		    "Resync needed- dpc flags= %ld\n",
-		    ha->host_no,
-		    atomic_read(&ha->loop_down_timer), ha->dpc_flags));
-		/* ???? dg 02/26/02  rval = 1; */
 	}
 
 	if (rval) {
@@ -1619,7 +1614,6 @@
  *
  * Returns:
  *	0 = success.
- *	BIT_0 = error.
  */
 static int
 qla2x00_configure_local_loop(scsi_qla_host_t *ha) 
@@ -1644,19 +1638,9 @@
 	uint16_t	loop_id;
 	uint8_t		domain, area, al_pa;
 
-	rval = QLA_SUCCESS;
 	found_devs = 0;
 	new_fcport = NULL;
 
-	/*
-	 * No point in continuing if the loop is in a volatile state -- 
-	 * reschedule LOCAL_LOOP_UPDATE for later processing
-	 */
-	if (test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) {
-		set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
-		return (rval);
-	}
-
 	entries = MAX_FIBRE_DEVICES;
 	id_list = pci_alloc_consistent(ha->pdev, MAX_ID_LIST_SIZE,
 	    &id_list_dma);
@@ -1668,7 +1652,7 @@
 		    "Memory Allocation failed - port_list");
 
 		ha->mem_err++;
-		return (BIT_0);
+		return (QLA_MEMORY_ALLOC_FAILED);
 	}
 	memset(id_list, 0, MAX_ID_LIST_SIZE);
 
@@ -1677,8 +1661,7 @@
 
 	/* Get list of logged in devices. */
 	rval = qla2x00_get_id_list(ha, id_list, id_list_dma, &entries);
-	if (rval) {
-		rval = BIT_0;
+	if (rval != QLA_SUCCESS) {
 		goto cleanup_allocation;
 	}
 
@@ -1690,7 +1673,7 @@
 	/* Allocate temporary fcport for any new fcports discovered. */
 	new_fcport = qla2x00_alloc_fcport(ha, GFP_KERNEL);
 	if (new_fcport == NULL) {
-		rval = BIT_0;
+		rval = QLA_MEMORY_ALLOC_FAILED;
 		goto cleanup_allocation;
 	}
 	new_fcport->flags &= ~FCF_FABRIC_DEVICE;
@@ -1783,7 +1766,7 @@
 			fcport = new_fcport;
 			new_fcport = qla2x00_alloc_fcport(ha, GFP_KERNEL);
 			if (new_fcport == NULL) {
-				rval = BIT_0;
+				rval = QLA_MEMORY_ALLOC_FAILED;
 				goto cleanup_allocation;
 			}
 			new_fcport->flags &= ~FCF_FABRIC_DEVICE;
@@ -1800,7 +1783,7 @@
 	if (new_fcport)
 		kfree(new_fcport);
 
-	if (rval & BIT_0) {
+	if (rval != QLA_SUCCESS) {
 		DEBUG2(printk("scsi(%ld): Configure local loop error exit: "
 		    "rval=%x\n", ha->host_no, rval));
 	}
@@ -2339,7 +2322,7 @@
 	/* Mark devices that need re-synchronization. */
 	rval2 = qla2x00_device_resync(ha);
 	if (rval2 == QLA_RSCNS_HANDLED) {
-		/* No, point doing the scan, just continue. */
+		/* No point doing the scan, just continue. */
 		return (QLA_SUCCESS);
 	}
 	do {
@@ -2489,7 +2472,6 @@
  *
  * Returns:
  *	0 = success.
- *	BIT_0 = error.
  *
  * Context:
  *	Kernel context.
@@ -3082,6 +3064,7 @@
 qla2x00_loop_resync(scsi_qla_host_t *ha) 
 {
 	int   rval;
+	uint32_t wait_time;
 
 	rval = QLA_SUCCESS;
 
@@ -3090,6 +3073,8 @@
 	clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags);
 	if (ha->flags.online) {
 		if (!(rval = qla2x00_fw_ready(ha))) {
+			/* Wait at most MAX_TARGET RSCNs for a stable link. */
+			wait_time = 256;
 			do {
 				/* v2.19.05b6 */
 				atomic_set(&ha->loop_state, LOOP_UPDATE);
@@ -3104,12 +3089,13 @@
 				clear_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
 
 				qla2x00_configure_loop(ha);
-
+				wait_time--;
 			} while (!atomic_read(&ha->loop_down_timer) &&
 				!(test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) &&
+				wait_time &&
 				(test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)));
 		}
-		qla2x00_restart_queues(ha,TRUE);
+		qla2x00_restart_queues(ha, TRUE);
 	}
 
 	if (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) {
@@ -3150,6 +3136,10 @@
 		spin_lock_irqsave(&ha->list_lock,flags);
 		list_for_each_safe(list, temp, &ha->pending_queue) {
 			sp = list_entry(list, srb_t, list);
+
+			if ((sp->flags & SRB_TAPE))
+				continue;
+			 
 			/* 
 			 * When time expire return request back to OS as BUSY 
 			 */
@@ -3292,6 +3282,7 @@
 static uint16_t
 qla2x00_fcport_bind(scsi_qla_host_t *ha, fc_port_t *fcport) 
 {
+	int		found;
 	uint16_t	tgt;
 	os_tgt_t	*tq;
 
@@ -3300,18 +3291,32 @@
 		if ((tq = TGT_Q(ha, tgt)) == NULL)
 			continue;
 
-		if (ha->binding_type == BIND_BY_PORT_ID &&
-		    fcport->d_id.b24 == tq->d_id.b24) {
-			memcpy(tq->node_name, fcport->node_name, WWN_SIZE);
-			memcpy(tq->port_name, fcport->port_name, WWN_SIZE);
+		found = 0;
+		switch (ha->binding_type) {
+		case BIND_BY_PORT_ID:
+			if (fcport->d_id.b24 == tq->d_id.b24) {
+				memcpy(tq->node_name, fcport->node_name,
+				    WWN_SIZE);
+				memcpy(tq->port_name, fcport->port_name,
+				    WWN_SIZE);
+				found++;
+			}
 			break;
-		}
-
-		if (memcmp(fcport->port_name, tq->port_name, WWN_SIZE) == 0) {
-			/* In case of persistent binding, update the WWNN */
-			memcpy(tq->node_name, fcport->node_name, WWN_SIZE);
+		case BIND_BY_PORT_NAME:    
+			if (memcmp(fcport->port_name, tq->port_name,
+			    WWN_SIZE) == 0) {
+				/*
+				 * In case of persistent binding, update the
+				 * WWNN.
+				 */
+				memcpy(tq->node_name, fcport->node_name,
+				    WWN_SIZE);
+				found++;
+			}
 			break;
 		}
+		if (found)
+		    break;	
 	}
 
 	/* TODO: honor the ConfigRequired flag */
@@ -4226,6 +4231,7 @@
 	uint8_t		status = 0;
 	device_reg_t	*reg;
 	unsigned long	flags = 0;
+	uint32_t wait_time;
 
 	/* If firmware needs to be loaded */
 	if (qla2x00_isp_firmware(ha)) {
@@ -4269,11 +4275,15 @@
 					__func__,
 					status);)
 			ha->flags.online = TRUE;
+			/* Wait at most MAX_TARGET RSCNs for a stable link. */
+			wait_time = 256;
 			do {
 				clear_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
 				qla2x00_configure_loop(ha);
+				wait_time--;
 			} while (!atomic_read(&ha->loop_down_timer) &&
 				!(test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags)) &&
+				wait_time &&
 				(test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)));
 		}
 
diff -Nru a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
--- a/drivers/scsi/qla2xxx/qla_iocb.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/qla2xxx/qla_iocb.c	Tue Jun 15 22:20:42 2004
@@ -124,7 +124,7 @@
 
 	/* Adjust ring index. */
 	ha->req_ring_index++;
-	if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
+	if (ha->req_ring_index == ha->request_q_length) {
 		ha->req_ring_index = 0;
 		ha->request_ring_ptr = ha->request_ring;
 	} else {
@@ -153,7 +153,7 @@
 
 	/* Adjust ring index. */
 	ha->req_ring_index++;
-	if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
+	if (ha->req_ring_index == ha->request_q_length) {
 		ha->req_ring_index = 0;
 		ha->request_ring_ptr = ha->request_ring;
 	} else {
@@ -390,11 +390,11 @@
 
 	if (ha->req_q_cnt < (sp->req_cnt + 2)) {
 		/* Calculate number of free request entries */
-		cnt = RD_REG_WORD(ISP_REQ_Q_OUT(ha, reg));
+		cnt = RD_REG_WORD_RELAXED(ISP_REQ_Q_OUT(ha, reg));
 		if (ha->req_ring_index < cnt)
 			ha->req_q_cnt = cnt - ha->req_ring_index;
 		else
-			ha->req_q_cnt = REQUEST_ENTRY_CNT -
+			ha->req_q_cnt = ha->request_q_length -
 			    (ha->req_ring_index - cnt);
 	}
 
@@ -484,7 +484,7 @@
 
 	/* Adjust ring index. */
 	ha->req_ring_index++;
-	if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
+	if (ha->req_ring_index == ha->request_q_length) {
 		ha->req_ring_index = 0;
 		ha->request_ring_ptr = ha->request_ring;
 	} else
@@ -499,7 +499,7 @@
 
 	/* Set chip new ring index. */
 	WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index);
-	RD_REG_WORD(ISP_REQ_Q_IN(ha, reg));	/* PCI Posting. */
+	RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg));	/* PCI Posting. */
 
 	spin_unlock_irqrestore(&ha->hardware_lock, flags);
 	return (QLA_SUCCESS);
@@ -588,7 +588,7 @@
 			if  (ha->req_ring_index < cnt)
 				ha->req_q_cnt = cnt - ha->req_ring_index;
 			else
-				ha->req_q_cnt = REQUEST_ENTRY_CNT -
+				ha->req_q_cnt = ha->request_q_length -
 				    (ha->req_ring_index - cnt);
 		}
 		/* If room for request in request ring. */
@@ -658,7 +658,7 @@
 			if (ha->req_ring_index < cnt) {
 				ha->req_q_cnt = cnt - ha->req_ring_index;
 			} else {
-				ha->req_q_cnt = REQUEST_ENTRY_CNT -
+				ha->req_q_cnt = ha->request_q_length -
 				    (ha->req_ring_index - cnt);
 			}
 		}
@@ -740,7 +740,7 @@
 
 	/* Adjust ring index. */
 	ha->req_ring_index++;
-	if (ha->req_ring_index == REQUEST_ENTRY_CNT) {
+	if (ha->req_ring_index == ha->request_q_length) {
 		ha->req_ring_index = 0;
 		ha->request_ring_ptr = ha->request_ring;
 	} else
@@ -748,5 +748,5 @@
 
 	/* Set chip new ring index. */
 	WRT_REG_WORD(ISP_REQ_Q_IN(ha, reg), ha->req_ring_index);
-	RD_REG_WORD(ISP_REQ_Q_IN(ha, reg));	/* PCI Posting. */
+	RD_REG_WORD_RELAXED(ISP_REQ_Q_IN(ha, reg));	/* PCI Posting. */
 }
diff -Nru a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
--- a/drivers/scsi/qla2xxx/qla_isr.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/scsi/qla2xxx/qla_isr.c	Tue Jun 15 22:21:05 2004
@@ -165,7 +165,7 @@
 				break;
 			}
 			WRT_REG_WORD(&reg->hccr, HCCR_CLR_RISC_INT);
-			RD_REG_WORD(&reg->hccr);
+			RD_REG_WORD_RELAXED(&reg->hccr);
 		}
 	}
 
@@ -907,7 +907,7 @@
 	 * If loop is in transient state Report DID_BUS_BUSY
 	 */
 	if ((comp_status != CS_COMPLETE || scsi_status != 0)) {
-		if (!(sp->flags & SRB_IOCTL) &&
+		if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
 		    (atomic_read(&ha->loop_down_timer) ||
 			atomic_read(&ha->loop_state) != LOOP_READY)) {
 
@@ -986,7 +986,7 @@
 		if (sp->request_sense_length != 0)
 			ha->status_srb = sp;
 
-		if (!(sp->flags & SRB_IOCTL) &&
+		if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
 		    qla2x00_check_sense(cp, lq) == QLA_SUCCESS) {
 			/* Throw away status_cont if any */
 			ha->status_srb = NULL;
@@ -1053,7 +1053,7 @@
 			if (sp->request_sense_length != 0)
 				ha->status_srb = sp;
 
-			if (!(sp->flags & SRB_IOCTL) &&
+			if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
 			    (qla2x00_check_sense(cp, lq) == QLA_SUCCESS)) {
 				ha->status_srb = NULL;
 				add_to_scsi_retry_queue(ha, sp);
@@ -1137,7 +1137,7 @@
 		    ha->host_no, t, l, cp->serial_number, comp_status,
 		    atomic_read(&fcport->state)));
 
-		if ((sp->flags & SRB_IOCTL) ||
+		if ((sp->flags & (SRB_IOCTL | SRB_TAPE)) ||
 		    atomic_read(&fcport->state) == FCS_DEVICE_DEAD) {
 			cp->result = DID_NO_CONNECT << 16;
 			if (atomic_read(&ha->loop_state) == LOOP_DOWN) 
@@ -1162,7 +1162,7 @@
 		    "scsi(%ld): RESET status detected 0x%x-0x%x.\n",
 		    ha->host_no, comp_status, scsi_status));
 
-		if (sp->flags & SRB_IOCTL) {
+		if (sp->flags & (SRB_IOCTL | SRB_TAPE)) {
 			cp->result = DID_RESET << 16;
 		} else {
 			qla2x00_extend_timeout(cp, EXTEND_CMD_TIMEOUT);
diff -Nru a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
--- a/drivers/scsi/qla2xxx/qla_mbx.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/qla2xxx/qla_mbx.c	Tue Jun 15 22:20:40 2004
@@ -279,6 +279,9 @@
 			DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): "
 			    "timeout schedule isp_abort_needed.\n",
 			    ha->host_no);)
+			qla_printk(KERN_WARNING, ha,
+			    "Mailbox command timeout occured. Scheduling ISP "
+			    "abort.\n");
 			set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
 			if (ha->dpc_wait && !ha->dpc_active) 
 				up(ha->dpc_wait);
@@ -290,6 +293,9 @@
 			    "calling abort_isp\n", ha->host_no);)
 			DEBUG2_3_11(printk("qla2x00_mailbox_command(%ld): "
 			    "timeout calling abort_isp\n", ha->host_no);)
+			qla_printk(KERN_WARNING, ha,
+			    "Mailbox command timeout occured. Issuing ISP "
+			    "abort.\n");
 
 			set_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
 			clear_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
@@ -981,7 +987,6 @@
 
 	if (atomic_read(&ha->loop_state) == LOOP_DOWN ||
 	    atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
-		/* v2.19.8 Ignore abort request if port is down */
 		return 1;
 	}
 
@@ -1062,6 +1067,9 @@
 	qla2x00_marker(ha, loop_id, lun, MK_SYNC_ID_LUN);
 
 	if (rval != QLA_SUCCESS) {
+		qla_printk(KERN_WARNING, ha,
+		    "Failed Abort Device Mailbox command. Scheduling ISP "
+		    "abort.\n");
 		set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
 		if (ha->dpc_wait && !ha->dpc_active) 
 			up(ha->dpc_wait);
@@ -1598,7 +1606,7 @@
  *	BIT_1 = mailbox error.
  */
 uint8_t
-qla2x00_get_link_status(scsi_qla_host_t *ha, uint8_t loop_id,
+qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
     link_stat_t *ret_buf, uint16_t *status)
 {
 	int rval;
diff -Nru a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/scsi/qla2xxx/qla_os.c	Tue Jun 15 22:21:04 2004
@@ -168,7 +168,6 @@
 	.slave_configure	= qla2xxx_slave_configure,
 
 	.this_id		= -1,
-	.can_queue		= REQUEST_ENTRY_CNT+128,
 	.cmd_per_lun		= 3,
 	.use_clustering		= ENABLE_CLUSTERING,
 	.sg_tablesize		= SG_ALL,
@@ -776,10 +775,13 @@
 
 	/* Only modify the allowed count if the target is a *non* tape device */
 	if ((fcport->flags & FCF_TAPE_PRESENT) == 0) {
+		sp->flags &= ~SRB_TAPE;
 		if (cmd->allowed < ql2xretrycount) {
 			cmd->allowed = ql2xretrycount;
 		}
-	}
+	} else
+		sp->flags |= SRB_TAPE;
+
 
 	DEBUG5(printk("scsi(%ld:%2d:%2d): (queuecmd) queue sp = %p, "
 	    "flags=0x%x fo retry=%d, pid=%ld\n",
@@ -808,7 +810,7 @@
 	    atomic_read(&ha2->loop_state) == LOOP_DEAD) {
 		/*
 		 * Add the command to the done-queue for later failover
-		 * processing
+		 * processing.
 		 */
 		cmd->result = DID_NO_CONNECT << 16;
 		if (atomic_read(&ha2->loop_state) == LOOP_DOWN) 
@@ -822,7 +824,8 @@
 		spin_lock_irq(ha->host->host_lock);
 		return (0);
 	}
-	if (tq && test_bit(TQF_SUSPENDED, &tq->flags)) {
+	if (tq && test_bit(TQF_SUSPENDED, &tq->flags) &&
+	    (sp->flags & SRB_TAPE) == 0) {
 		/* If target suspended put incoming I/O in retry_q. */
 		qla2x00_extend_timeout(sp->cmd, 10);
 		add_to_scsi_retry_queue(ha, sp);
@@ -834,7 +837,7 @@
 		device_reg_t *reg;
 		reg = ha->iobase;
 		
-		if (RD_REG_WORD(ISP_RSP_Q_IN(ha, reg)) != ha->rsp_ring_index) {
+		if (ha->response_ring_ptr->signature != RESPONSE_PROCESSED) {
 			spin_lock_irqsave(&ha->hardware_lock, flags);	
 			qla2x00_process_response_queue(ha);
 			spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -914,7 +917,7 @@
 
 		spin_unlock_irq(ha->host->host_lock);
 
-		set_current_state(TASK_INTERRUPTIBLE);
+		set_current_state(TASK_UNINTERRUPTIBLE);
 		schedule_timeout(2*HZ);
 
 		spin_lock_irq(ha->host->host_lock);
@@ -962,7 +965,7 @@
 	    test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) &&
 		time_before(jiffies, wait_online)) {
 
-		set_current_state(TASK_INTERRUPTIBLE);
+		set_current_state(TASK_UNINTERRUPTIBLE);
 		schedule_timeout(HZ);
 	}
 	if (ha->flags.online == TRUE) 
@@ -1005,7 +1008,7 @@
 	    atomic_read(&ha->loop_state) == LOOP_DOWN) ||
 	    test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
 	    atomic_read(&ha->loop_state) != LOOP_READY) {
-		set_current_state(TASK_INTERRUPTIBLE);
+		set_current_state(TASK_UNINTERRUPTIBLE);
 		schedule_timeout(HZ);
 		if (time_after_eq(jiffies, loop_timeout)) {
 			return_status = QLA_FUNCTION_FAILED;
@@ -1783,10 +1786,9 @@
 		queue_depth = 32;
 
 	if (sdev->tagged_supported) {
-#if defined(MODULE)
-		if (!(ql2xmaxqdepth == 0 || ql2xmaxqdepth > 256))
+		if (ql2xmaxqdepth != 0 && ql2xmaxqdepth <= 0xffffU)
 			queue_depth = ql2xmaxqdepth;
-#endif 
+
 		ql2xmaxqdepth = queue_depth;
 
 		scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
@@ -1983,19 +1985,24 @@
 	if (IS_QLA2100(ha)) {
 		ha->max_targets = MAX_TARGETS_2100;
 		ha->mbx_count = MAILBOX_REGISTER_COUNT_2100;
+		ha->request_q_length = REQUEST_ENTRY_CNT_2100;
 		ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
 		ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
+		host->sg_tablesize = 32;
 	} else if (IS_QLA2200(ha)) {
 		ha->max_targets = MAX_TARGETS_2200;
 		ha->mbx_count = MAILBOX_REGISTER_COUNT;
+		ha->request_q_length = REQUEST_ENTRY_CNT_2200;
 		ha->response_q_length = RESPONSE_ENTRY_CNT_2100;
 		ha->last_loop_id = SNS_LAST_LOOP_ID_2100;
 	} else /*if (IS_QLA2300(ha))*/ {
 		ha->max_targets = MAX_TARGETS_2200;
 		ha->mbx_count = MAILBOX_REGISTER_COUNT;
+		ha->request_q_length = REQUEST_ENTRY_CNT_2200;
 		ha->response_q_length = RESPONSE_ENTRY_CNT_2300;
 		ha->last_loop_id = SNS_LAST_LOOP_ID_2300;
 	}
+	host->can_queue = ha->request_q_length + 128;
 
 	/* load the F/W, read paramaters, and init the H/W */
 	ha->instance = num_hosts;
@@ -2020,6 +2027,7 @@
 	spin_lock_init(&ha->mbx_reg_lock);
 	spin_lock_init(&ha->list_lock);
 
+	ha->dpc_pid = -1;
 	init_completion(&ha->dpc_inited);
 	init_completion(&ha->dpc_exited);
 
@@ -2125,8 +2133,8 @@
 
 		qla2x00_check_fabric_devices(ha);
 
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(5);
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(HZ/100);
 	}
 
 	pci_set_drvdata(pdev, ha);
@@ -2313,18 +2321,17 @@
     char **start, off_t offset, int length, int inout)
 {
 	struct info_str	info;
-	int		i;
 	int             retval = -EINVAL;
 	os_lun_t	*up;
-	fc_port_t	*fcport;
+	os_tgt_t	*tq;
 	unsigned int	t, l;
 	uint32_t        tmp_sn;
-	unsigned long   *flags;
+	uint32_t	*flags;
 	uint8_t		*loop_state;
 	int	found;
 	scsi_qla_host_t *ha;
 	char fw_info[30];
-
+ 
 	DEBUG3(printk(KERN_INFO
 	    "Entering proc_info buff_in=%p, offset=0x%lx, length=0x%x\n",
 	    buffer, offset, length);)
@@ -2390,8 +2397,8 @@
 		(unsigned long long)ha->response_dma);
 
 	copy_info(&info,
-	    "Request Queue count = %ld, Response Queue count = %ld\n",
-	    (long)REQUEST_ENTRY_CNT, (long)ha->response_q_length);
+	    "Request Queue count = %d, Response Queue count = %d\n",
+	    ha->request_q_length, ha->response_q_length);
 
 	copy_info(&info,
 	    "Total number of active commands = %ld\n",
@@ -2428,7 +2435,7 @@
 	    ha->done_q_cnt, ha->scsi_retry_q_cnt);
 
 
-	flags = (unsigned long *) &ha->flags;
+	flags = (uint32_t *) &ha->flags;
 
 	if (atomic_read(&ha->loop_state) == LOOP_DOWN) {
 		loop_state = "DOWN";
@@ -2502,24 +2509,19 @@
 	    ha->init_cb->port_name[7]);
 
 	/* Print out device port names */
-	i = 0;
- 	list_for_each_entry(fcport, &ha->fcports, list) {
-		if (fcport->port_type != FCT_TARGET)
+	for (t = 0; t < MAX_FIBRE_DEVICES; t++) {
+		if ((tq = TGT_Q(ha, t)) == NULL)
 			continue;
 
 		copy_info(&info,
 		    "scsi-qla%d-target-%d="
-		    "%02x%02x%02x%02x%02x%02x%02x%02x:%02x%02x%02x;\n",
-		    (int)ha->instance, i,
-		    fcport->port_name[0], fcport->port_name[1],
-		    fcport->port_name[2], fcport->port_name[3],
-		    fcport->port_name[4], fcport->port_name[5],
-		    fcport->port_name[6], fcport->port_name[7],
-		    fcport->d_id.b.domain, fcport->d_id.b.area,
-		    fcport->d_id.b.al_pa);
-		i++;
+		    "%02x%02x%02x%02x%02x%02x%02x%02x;\n",
+		    (int)ha->instance, t,
+		    tq->port_name[0], tq->port_name[1],
+		    tq->port_name[2], tq->port_name[3],
+		    tq->port_name[4], tq->port_name[5],
+		    tq->port_name[6], tq->port_name[7]);
 	}
-
 	copy_info(&info, "\nSCSI LUN Information:\n");
 	copy_info(&info,
 	    "(Id:Lun)  * - indicates lun is not registered with the OS.\n");
@@ -2861,14 +2863,14 @@
 		 * little delay and a retry.
 		 */
 		ha->request_ring = pci_alloc_consistent(ha->pdev,
-		    ((REQUEST_ENTRY_CNT + 1) * (sizeof(request_t))),
+		    ((ha->request_q_length + 1) * (sizeof(request_t))),
 		    &ha->request_dma);
 		if (ha->request_ring == NULL) {
 			qla_printk(KERN_WARNING, ha,
 			    "Memory Allocation failed - request_ring\n");
 
 			qla2x00_mem_free(ha);
-			set_current_state(TASK_INTERRUPTIBLE);
+			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(HZ/10);
 
 			continue;
@@ -2882,7 +2884,7 @@
 			    "Memory Allocation failed - response_ring\n");
 
 			qla2x00_mem_free(ha);
-			set_current_state(TASK_INTERRUPTIBLE);
+			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(HZ/10);
 
 			continue;
@@ -2896,7 +2898,7 @@
 			    "Memory Allocation failed - init_cb\n");
 
 			qla2x00_mem_free(ha);
-			set_current_state(TASK_INTERRUPTIBLE);
+			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(HZ/10);
 
 			continue;
@@ -2909,7 +2911,7 @@
 			    "Memory Allocation failed - ioctl_mem\n");
 
 			qla2x00_mem_free(ha);
-			set_current_state(TASK_INTERRUPTIBLE);
+			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(HZ/10);
 
 			continue;
@@ -2921,14 +2923,14 @@
 			    "qla2x00_allocate_sp_pool()\n");
 
 			qla2x00_mem_free(ha);
-			set_current_state(TASK_INTERRUPTIBLE);
+			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(HZ/10);
 
 			continue;
 		}
 
 		/* Allocate memory for SNS commands */
-		if (IS_QLA2200(ha)) {
+		if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 			/* Get consistent memory allocated for SNS commands */
 			ha->sns_cmd = pci_alloc_consistent(ha->pdev,
 			    sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma);
@@ -2938,13 +2940,13 @@
 				    "Memory Allocation failed - sns_cmd\n");
 
 				qla2x00_mem_free(ha);
-				set_current_state(TASK_INTERRUPTIBLE);
+				set_current_state(TASK_UNINTERRUPTIBLE);
 				schedule_timeout(HZ/10);
 
 				continue;
 			}
 			memset(ha->sns_cmd, 0, sizeof(struct sns_cmd_pkt));
-		} else if (!IS_QLA2100(ha)) {
+		} else {
 			/* Get consistent memory allocated for MS IOCB */
 			ha->ms_iocb = pci_alloc_consistent(ha->pdev,
 			    sizeof(ms_iocb_entry_t), &ha->ms_iocb_dma);
@@ -2954,7 +2956,7 @@
 				    "Memory Allocation failed - ms_iocb\n");
 
 				qla2x00_mem_free(ha);
-				set_current_state(TASK_INTERRUPTIBLE);
+				set_current_state(TASK_UNINTERRUPTIBLE);
 				schedule_timeout(HZ/10);
 
 				continue;
@@ -2973,7 +2975,7 @@
 				    "Memory Allocation failed - ct_sns\n");
 
 				qla2x00_mem_free(ha);
-				set_current_state(TASK_INTERRUPTIBLE);
+				set_current_state(TASK_UNINTERRUPTIBLE);
 				schedule_timeout(HZ/10);
 
 				continue;
@@ -2990,7 +2992,7 @@
 			    "Memory Allocation failed - iodesc_pd\n");
 
 			qla2x00_mem_free(ha);
-			set_current_state(TASK_INTERRUPTIBLE);
+			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(HZ/10);
 
 			continue;
@@ -3077,7 +3079,7 @@
 
 	if (ha->request_ring) {
 		pci_free_consistent(ha->pdev,
-		    ((REQUEST_ENTRY_CNT + 1) * (sizeof(request_t))),
+		    ((ha->request_q_length + 1) * (sizeof(request_t))),
 		    ha->request_ring, ha->request_dma);
 	}
 
@@ -3852,6 +3854,8 @@
 				DEBUG(printk("scsi(%ld): Loop down - "
 				    "aborting ISP.\n",
 				    ha->host_no));
+				qla_printk(KERN_WARNING, ha,
+				    "Loop down - aborting ISP.\n");
 
 				set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
 			}
@@ -3936,8 +3940,8 @@
 	int processed;
 	scsi_qla_host_t *vis_ha, *dest_ha;
 	struct scsi_cmnd *cmd;
-	ulong      flags;
-	fc_port_t	*fcport;
+	unsigned long flags, cpu_flags;
+	fc_port_t *fcport;
 
 	cmd = sp->cmd;
 	vis_ha = (scsi_qla_host_t *)cmd->device->host->hostdata;
@@ -4032,6 +4036,64 @@
 		 return;
 	}
 
+	spin_lock_irqsave(&dest_ha->list_lock, cpu_flags);
+	if (sp->state == SRB_DONE_STATE) {
+		/* IO in done_q  -- leave it */
+		DEBUG(printk("scsi(%ld): Found in Done queue pid %ld sp=%p.\n",
+		    dest_ha->host_no, cmd->serial_number, sp));
+	} else if (sp->state == SRB_SUSPENDED_STATE) {
+		DEBUG(printk("scsi(%ld): Found SP %p in suspended state  "
+		    "- pid %ld:\n",
+		    dest_ha->host_no, sp, cmd->serial_number));
+		DEBUG(qla2x00_dump_buffer((uint8_t *)sp, sizeof(srb_t));)
+	} else if (sp->state == SRB_ACTIVE_STATE) {
+		/*
+		 * IO is with ISP find the command in our active list.
+		 */
+		spin_unlock_irqrestore(&dest_ha->list_lock, cpu_flags);
+		spin_lock_irqsave(&dest_ha->hardware_lock, flags);
+		if (sp == dest_ha->outstanding_cmds[
+		    (unsigned long)sp->cmd->host_scribble]) {
+
+			DEBUG(printk("cmd_timeout: Found in ISP \n"));
+
+			if (sp->flags & SRB_TAPE) {
+				/*
+				 * We cannot allow the midlayer error handler
+				 * to wakeup and begin the abort process.
+				 * Extend the timer so that the firmware can
+				 * properly return the IOCB.
+				 */
+				DEBUG(printk("cmd_timeout: Extending timeout "
+				    "of FCP2 tape command!\n"));
+				qla2x00_extend_timeout(sp->cmd,
+				    EXTEND_CMD_TIMEOUT);
+			}
+			sp->state = SRB_ACTIVE_TIMEOUT_STATE;
+			spin_unlock_irqrestore(&dest_ha->hardware_lock, flags);
+		} else {
+			spin_unlock_irqrestore(&dest_ha->hardware_lock, flags);
+			printk(KERN_INFO 
+				"qla_cmd_timeout: State indicates it is with "
+				"ISP, But not in active array\n");
+		}
+		spin_lock_irqsave(&dest_ha->list_lock, cpu_flags);
+	} else if (sp->state == SRB_ACTIVE_TIMEOUT_STATE) {
+		DEBUG(printk("qla2100%ld: Found in Active timeout state"
+				"pid %ld, State = %x., \n",
+				dest_ha->host_no,
+				sp->cmd->serial_number, sp->state);)
+	} else {
+		/* EMPTY */
+		DEBUG2(printk("cmd_timeout%ld: LOST command state = "
+				"0x%x, sp=%p\n",
+				vis_ha->host_no, sp->state,sp);)
+
+		qla_printk(KERN_INFO, vis_ha,
+			"cmd_timeout: LOST command state = 0x%x\n", sp->state);
+	}
+	spin_unlock_irqrestore(&dest_ha->list_lock, cpu_flags);
+
 	DEBUG3(printk("cmd_timeout: Leaving\n");)
 }
 
@@ -4180,9 +4242,6 @@
 	spin_lock_irqsave(&ha->hardware_lock,flags);
 	qla2x00_process_response_queue(ha);
 	spin_unlock_irqrestore(&ha->hardware_lock, flags);
-
-	if (!list_empty(&ha->done_queue))
-		qla2x00_done(ha);
 }
 
 /*
@@ -4261,7 +4320,7 @@
 		 * continues until the LOOP DOWN time expires or the condition
 		 * goes away.
 		 */
-	 	if (!(sp->flags & SRB_IOCTL) &&
+		if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
 		    (atomic_read(&fcport->state) != FCS_ONLINE ||
 			test_bit(ABORT_ISP_ACTIVE, &dest_ha->dpc_flags) ||
 			atomic_read(&dest_ha->loop_state) != LOOP_READY)) {
@@ -4286,7 +4345,7 @@
 		 * If this request's lun is suspended then put the request on
 		 * the  scsi_retry queue. 
 		 */
-	 	if (!(sp->flags & SRB_IOCTL) &&
+	 	if (!(sp->flags & (SRB_IOCTL | SRB_TAPE)) &&
 		    sp->lun_queue->q_state == LUN_STATE_WAIT) {
 			DEBUG3(printk("scsi(%ld): lun wait state - pid=%ld, "
 			    "opcode=%d, allowed=%d, retries=%d\n",
diff -Nru a/drivers/scsi/qla2xxx/qla_rscn.c b/drivers/scsi/qla2xxx/qla_rscn.c
--- a/drivers/scsi/qla2xxx/qla_rscn.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/qla2xxx/qla_rscn.c	Tue Jun 15 22:20:39 2004
@@ -283,6 +283,8 @@
 
 	qla2x00_free_iodesc(iodesc);
 
+	qla_printk(KERN_WARNING, iodesc->ha,
+	    "IO descriptor timeout. Scheduling ISP abort.\n");
 	set_bit(ISP_ABORT_NEEDED, &iodesc->ha->dpc_flags);
 }
 
@@ -385,7 +387,7 @@
 		if  (ha->req_ring_index < cnt)
 			ha->req_q_cnt = cnt - ha->req_ring_index;
 		else
-			ha->req_q_cnt = REQUEST_ENTRY_CNT -
+			ha->req_q_cnt = ha->request_q_length -
 			    (ha->req_ring_index - cnt);
 	}
 	if (ha->req_q_cnt >= 3) {
diff -Nru a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
--- a/drivers/scsi/qla2xxx/qla_sup.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/qla2xxx/qla_sup.c	Tue Jun 15 22:20:36 2004
@@ -24,20 +24,6 @@
 static void qla2x00_nv_deselect(scsi_qla_host_t *);
 static void qla2x00_nv_write(scsi_qla_host_t *, uint16_t);
 
-uint8_t qla2x00_read_flash_byte(scsi_qla_host_t *, uint32_t);
-static void qla2x00_write_flash_byte(scsi_qla_host_t *, uint32_t, uint8_t);
-static uint8_t qla2x00_poll_flash(scsi_qla_host_t *ha,
-		uint32_t addr, uint8_t poll_data, uint8_t mid);
-static uint8_t qla2x00_program_flash_address(scsi_qla_host_t *ha,
-		uint32_t addr, uint8_t data, uint8_t mid);
-static uint8_t qla2x00_erase_flash_sector(scsi_qla_host_t *ha,
-		uint32_t addr, uint32_t sec_mask, uint8_t mid);
-
-uint8_t qla2x00_get_flash_manufacturer(scsi_qla_host_t *ha);
-uint16_t qla2x00_get_flash_version(scsi_qla_host_t *);
-uint16_t qla2x00_get_flash_image(scsi_qla_host_t *ha, uint8_t *image);
-uint16_t qla2x00_set_flash_image(scsi_qla_host_t *ha, uint8_t *image);
-
 
 /*
  * NVRAM support routines
@@ -279,435 +265,3 @@
 	RD_REG_WORD(&reg->nvram);		/* PCI Posting. */
 }
 
-/*
- * Flash support routines
- */
-
-/**
- * qla2x00_flash_enable() - Setup flash for reading and writing.
- * @ha: HA context
- */
-void
-qla2x00_flash_enable(scsi_qla_host_t *ha)
-{
-	uint16_t	data;
-	device_reg_t	*reg = ha->iobase;
-
-	data = RD_REG_WORD(&reg->ctrl_status);
-	data |= CSR_FLASH_ENABLE;
-	WRT_REG_WORD(&reg->ctrl_status, data);
-	RD_REG_WORD(&reg->ctrl_status);		/* PCI Posting. */
-}
-
-/**
- * qla2x00_flash_disable() - Disable flash and allow RISC to run.
- * @ha: HA context
- */
-void
-qla2x00_flash_disable(scsi_qla_host_t *ha)
-{
-	uint16_t	data;
-	device_reg_t	*reg = ha->iobase;
-
-	data = RD_REG_WORD(&reg->ctrl_status);
-	data &= ~(CSR_FLASH_ENABLE);
-	WRT_REG_WORD(&reg->ctrl_status, data);
-	RD_REG_WORD(&reg->ctrl_status);		/* PCI Posting. */
-}
-
-/**
- * qla2x00_read_flash_byte() - Reads a byte from flash
- * @ha: HA context
- * @addr: Address in flash to read
- *
- * A word is read from the chip, but, only the lower byte is valid.
- *
- * Returns the byte read from flash @addr.
- */
-uint8_t
-qla2x00_read_flash_byte(scsi_qla_host_t *ha, uint32_t addr)
-{
-	uint16_t	data;
-	uint16_t	bank_select;
-	device_reg_t	*reg = ha->iobase;
-
-	/* Setup bit 16 of flash address. */
-	bank_select = RD_REG_WORD(&reg->ctrl_status);
-	if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
-		bank_select |= CSR_FLASH_64K_BANK;
-		WRT_REG_WORD(&reg->ctrl_status, bank_select);
-		RD_REG_WORD(&reg->ctrl_status);	/* PCI Posting. */
-	} else if (((addr & BIT_16) == 0) &&
-	    (bank_select & CSR_FLASH_64K_BANK)) {
-		bank_select &= ~(CSR_FLASH_64K_BANK);
-		WRT_REG_WORD(&reg->ctrl_status, bank_select);
-		RD_REG_WORD(&reg->ctrl_status);	/* PCI Posting. */
-	}
-
-	/* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
-	if (IS_QLA2312(ha) && ha->product_id[3] == 0x2 && ha->pio_address) {
-		uint16_t data2;
-
-		reg = (device_reg_t *)ha->pio_address;
-		outw((uint16_t)addr, (unsigned long)(&reg->flash_address));
-		do {
-			data = inw((unsigned long)(&reg->flash_data));
-			barrier();
-			cpu_relax();
-			data2 = inw((unsigned long)(&reg->flash_data));
-		} while (data != data2);
-	} else {
-		WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-		data = qla2x00_debounce_register(&reg->flash_data);
-	}
-
-	return ((uint8_t)data);
-}
-
-/**
- * qla2x00_write_flash_byte() - Write a byte to flash
- * @ha: HA context
- * @addr: Address in flash to write
- * @data: Data to write
- */
-static void
-qla2x00_write_flash_byte(scsi_qla_host_t *ha, uint32_t addr, uint8_t data)
-{
-	uint16_t	bank_select;
-	device_reg_t	*reg = ha->iobase;
-
-	/* Setup bit 16 of flash address. */
-	bank_select = RD_REG_WORD(&reg->ctrl_status);
-	if ((addr & BIT_16) && ((bank_select & CSR_FLASH_64K_BANK) == 0)) {
-		bank_select |= CSR_FLASH_64K_BANK;
-		WRT_REG_WORD(&reg->ctrl_status, bank_select);
-		RD_REG_WORD(&reg->ctrl_status);	/* PCI Posting. */
-	} else if (((addr & BIT_16) == 0) &&
-	    (bank_select & CSR_FLASH_64K_BANK)) {
-		bank_select &= ~(CSR_FLASH_64K_BANK);
-		WRT_REG_WORD(&reg->ctrl_status, bank_select);
-		RD_REG_WORD(&reg->ctrl_status);	/* PCI Posting. */
-	}
-
-	/* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
-	if (IS_QLA2312(ha) && ha->product_id[3] == 0x2 && ha->pio_address) {
-		reg = (device_reg_t *)ha->pio_address;
-		outw((uint16_t)addr, (unsigned long)(&reg->flash_address));
-		outw((uint16_t)data, (unsigned long)(&reg->flash_data));
-	} else {
-		WRT_REG_WORD(&reg->flash_address, (uint16_t)addr);
-		RD_REG_WORD(&reg->ctrl_status);		/* PCI Posting. */
-		WRT_REG_WORD(&reg->flash_data, (uint16_t)data);
-		RD_REG_WORD(&reg->ctrl_status);		/* PCI Posting. */
-	}
-}
-
-/**
- * qla2x00_poll_flash() - Polls flash for completion.
- * @ha: HA context
- * @addr: Address in flash to poll
- * @poll_data: Data to be polled
- * @mid: Flash manufacturer ID
- *
- * This function polls the device until bit 7 of what is read matches data
- * bit 7 or until data bit 5 becomes a 1.  If that hapens, the flash ROM timed
- * out (a fatal error).  The flash book recommeds reading bit 7 again after
- * reading bit 5 as a 1.
- *
- * Returns 0 on success, else non-zero.
- */
-static uint8_t
-qla2x00_poll_flash(scsi_qla_host_t *ha,
-    uint32_t addr, uint8_t poll_data, uint8_t mid)
-{
-	uint8_t		status;
-	uint8_t		flash_data;
-	uint32_t	cnt;
-	int		failed_pass;
-
-	status = 1;
-	failed_pass = 1;
-
-	/* Wait for 30 seconds for command to finish. */
-	poll_data &= BIT_7;
-	for (cnt = 3000000; cnt; cnt--) {
-		flash_data = qla2x00_read_flash_byte(ha, addr);
-		if ((flash_data & BIT_7) == poll_data) {
-			status = 0;
-			break;
-		}
-
-		if (mid != 0x40 && mid != 0xda) {
-			if (flash_data & BIT_5)
-				failed_pass--;
-			if (failed_pass < 0)
-				break;
-		}
-		udelay(10);
-		barrier();
-	}
-	return (status);
-}
-
-/**
- * qla2x00_program_flash_address() - Programs a flash address
- * @ha: HA context
- * @addr: Address in flash to program
- * @data: Data to be written in flash
- * @mid: Flash manufacturer ID
- *
- * Returns 0 on success, else non-zero.
- */
-static uint8_t
-qla2x00_program_flash_address(scsi_qla_host_t *ha,
-    uint32_t addr, uint8_t data, uint8_t mid)
-{
-	/* Write Program Command Sequence */
-	qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-	qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-	qla2x00_write_flash_byte(ha, 0x5555, 0xa0);
-	qla2x00_write_flash_byte(ha, addr, data);
-
-	/* Wait for write to complete. */
-	return (qla2x00_poll_flash(ha, addr, data, mid));
-}
-
-/**
- * qla2x00_erase_flash_sector() - Erase a flash sector.
- * @ha: HA context
- * @addr: Flash sector to erase
- * @sec_mask: Sector address mask
- * @mid: Flash manufacturer ID
- *
- * Returns 0 on success, else non-zero.
- */
-static uint8_t
-qla2x00_erase_flash_sector(scsi_qla_host_t *ha,
-    uint32_t addr, uint32_t sec_mask, uint8_t mid)
-{
-	/* Individual Sector Erase Command Sequence */
-	qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-	qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-	qla2x00_write_flash_byte(ha, 0x5555, 0x80);
-	qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-	qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-
-	if (mid == 0xda)
-		qla2x00_write_flash_byte(ha, addr & sec_mask, 0x10);
-	else
-		qla2x00_write_flash_byte(ha, addr & sec_mask, 0x30);
-
-	udelay(150);
-
-	/* Wait for erase to complete. */
-	return (qla2x00_poll_flash(ha, addr, 0x80, mid));
-}
-
-/**
- * qla2x00_get_flash_manufacturer() - Read manufacturer ID from flash chip.
- * @ha: HA context
- *
- * Returns the manufacturer's ID read from the flash chip.
- */
-uint8_t
-qla2x00_get_flash_manufacturer(scsi_qla_host_t *ha)
-{
-	uint8_t	manuf_id;
-
-	qla2x00_write_flash_byte(ha, 0x5555, 0xaa);
-	qla2x00_write_flash_byte(ha, 0x2aaa, 0x55);
-	qla2x00_write_flash_byte(ha, 0x5555, 0x90);
-	manuf_id = qla2x00_read_flash_byte(ha, 0x0001);
-
-	return (manuf_id);
-}
-
-/**
- * qla2x00_get_flash_version() - Read version information from flash.
- * @ha: HA context
- *
- * Returns QLA_SUCCESS on successful retrieval of flash version.
- */
-uint16_t
-qla2x00_get_flash_version(scsi_qla_host_t *ha)
-{
-	uint16_t	ret = QLA_SUCCESS;
-	uint32_t	loop_cnt = 1;  /* this is for error exit only */
-	uint32_t	pcir_adr;
-
-	/* The ISP2312 v2 chip cannot access the FLASH registers via MMIO. */
-	if (IS_QLA2312(ha) && ha->product_id[3] == 0x2 && !ha->pio_address)
-		ret = QLA_FUNCTION_FAILED;
-
-	qla2x00_flash_enable(ha);
-	do {	/* Loop once to provide quick error exit */
-		/* Match signature */
-		if (!(qla2x00_read_flash_byte(ha, 0) == 0x55 &&
-		    qla2x00_read_flash_byte(ha, 1) == 0xaa)) {
-			/* No signature */
-			DEBUG2(printk("scsi(%ld): No matching FLASH "
-			    "signature.\n", ha->host_no));
-			ret = QLA_FUNCTION_FAILED;
-			break;
-		}
-
-		pcir_adr = qla2x00_read_flash_byte(ha, 0x18) & 0xff;
-
-		/* validate signature of PCI data structure */
-		if ((qla2x00_read_flash_byte(ha, pcir_adr)) == 'P' &&
-		    (qla2x00_read_flash_byte(ha, pcir_adr + 1)) == 'C' &&
-		    (qla2x00_read_flash_byte(ha, pcir_adr + 2)) == 'I' &&
-		    (qla2x00_read_flash_byte(ha, pcir_adr + 3)) == 'R') {
-
-			/* Read version */
-			ha->optrom_minor =
-			    qla2x00_read_flash_byte(ha, pcir_adr + 0x12);
-			ha->optrom_major =
-			    qla2x00_read_flash_byte(ha, pcir_adr + 0x13);
-			DEBUG3(printk("%s(): got %d.%d.\n",
-			    __func__, ha->optrom_major, ha->optrom_minor));
-		} else {
-			/* error */
-			DEBUG2(printk("%s(): PCI data struct not found. "
-			    "pcir_adr=%x.\n",
-			    __func__, pcir_adr));
-			ret = QLA_FUNCTION_FAILED;
-			break;
-		}
-
-	} while (--loop_cnt);
-	qla2x00_flash_disable(ha);
-
-	return (ret);
-}
-
-/**
- * qla2x00_get_flash_image() - Read image from flash chip.
- * @ha: HA context
- * @image: Buffer to receive flash image
- *
- * Returns 0 on success, else non-zero.
- */
-uint16_t
-qla2x00_get_flash_image(scsi_qla_host_t *ha, uint8_t *image)
-{
-	uint32_t	addr;
-	uint32_t	midpoint;
-	uint8_t		*data;
-	device_reg_t	*reg = ha->iobase;
-
-	midpoint = FLASH_IMAGE_SIZE / 2;
-
-	qla2x00_flash_enable(ha);
-	WRT_REG_WORD(&reg->nvram, 0);
-	RD_REG_WORD(&reg->nvram);		/* PCI Posting. */
-	for (addr = 0, data = image; addr < FLASH_IMAGE_SIZE; addr++, data++) {
-		if (addr == midpoint)
-			WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-
-		*data = qla2x00_read_flash_byte(ha, addr);
-	}
-	qla2x00_flash_disable(ha);
-
-	return (0);
-}
-
-/**
- * qla2x00_set_flash_image() - Write image to flash chip.
- * @ha: HA context
- * @image: Source image to write to flash
- *
- * Returns 0 on success, else non-zero.
- */
-uint16_t
-qla2x00_set_flash_image(scsi_qla_host_t *ha, uint8_t *image)
-{
-	uint16_t	status;
-	uint32_t	addr;
-	uint32_t	midpoint;
-	uint32_t	sec_mask;
-	uint32_t	rest_addr;
-	uint8_t		mid;
-	uint8_t		sec_number;
-	uint8_t		data;
-	device_reg_t	*reg = ha->iobase;
-
-	status = 0;
-	sec_number = 0;
-
-	/* Reset ISP chip. */
-	WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
-	RD_REG_WORD(&reg->ctrl_status);		/* PCI Posting. */
-
-	qla2x00_flash_enable(ha);
-	do {	/* Loop once to provide quick error exit */
-		/* Structure of flash memory based on manufacturer */
-		mid = qla2x00_get_flash_manufacturer(ha);
-		if (mid == 0x6d) {
-			// Am29LV001 part
-			rest_addr = 0x1fff;
-			sec_mask = 0x1e000;
-		} else if (mid == 0x40) {
-			// Mostel v29c51001 part
-			rest_addr = 0x1ff;
-			sec_mask = 0x1fe00;
-		} else if (mid == 0xbf) {
-			// SST39sf10 part
-			rest_addr = 0xfff;
-			sec_mask = 0x1f000;
-		} else if (mid == 0xda) {
-			// Winbond W29EE011 part
-			rest_addr = 0x7f;
-			sec_mask = 0x1ff80;
-			addr = 0;
-			if (qla2x00_erase_flash_sector(ha, addr, sec_mask,
-			    mid)) {
-				status = 1;
-				break;
-			}
-		} else {
-			// Am29F010 part
-			rest_addr = 0x3fff;
-			sec_mask = 0x1c000;
-		}
-
-		midpoint = FLASH_IMAGE_SIZE / 2;
-		for (addr = 0; addr < FLASH_IMAGE_SIZE; addr++) {
-			data = *image++;
-			/* Are we at the beginning of a sector? */
-			if (!(addr & rest_addr)) {
-				if (addr == midpoint)
-					WRT_REG_WORD(&reg->nvram, NVR_SELECT);
-
-				/* Then erase it */
-				if (qla2x00_erase_flash_sector(ha, addr,
-				    sec_mask, mid)) {
-					status = 1;
-					break;
-				}
-
-				sec_number++;
-			}
-			if (mid == 0x6d) {
-				if (sec_number == 1 &&
-				    (addr == (rest_addr - 1))) {
-					rest_addr = 0x0fff;
-					sec_mask   = 0x1f000;
-				} else if (sec_number == 3 && (addr & 0x7ffe)) {
-					rest_addr = 0x3fff;
-					sec_mask   = 0x1c000;
-				}
-			}
-
-			if (qla2x00_program_flash_address(ha, addr, data,
-			    mid)) {
-				status = 1;
-				break;
-			}
-		}
-	} while (0);
-
-	qla2x00_flash_disable(ha);
-
-	return (status);
-}
diff -Nru a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
--- a/drivers/scsi/qla2xxx/qla_version.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/qla2xxx/qla_version.h	Tue Jun 15 22:20:40 2004
@@ -19,9 +19,9 @@
 /*
  * Driver version 
  */
-#define QLA2XXX_VERSION      "8.00.00b11-k"
+#define QLA2XXX_VERSION      "8.00.00b12-k"
 
 #define QLA_DRIVER_MAJOR_VER	8
 #define QLA_DRIVER_MINOR_VER	0
 #define QLA_DRIVER_PATCH_VER	0
-#define QLA_DRIVER_BETA_VER	11
+#define QLA_DRIVER_BETA_VER	12
diff -Nru a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c
--- a/drivers/scsi/qlogicfas.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/scsi/qlogicfas.c	Tue Jun 15 22:21:05 2004
@@ -1,43 +1,19 @@
-/*----------------------------------------------------------------*/
 /*
-   Qlogic linux driver - work in progress. No Warranty express or implied.
-   Use at your own risk.  Support Tort Reform so you won't have to read all
-   these silly disclaimers.
-
-   Copyright 1994, Tom Zerucha.   
-   tz@execpc.com
-   
-   Additional Code, and much appreciated help by
-   Michael A. Griffith
-   grif@cs.ucr.edu
-
-   Thanks to Eric Youngdale and Dave Hinds for loadable module and PCMCIA
-   help respectively, and for suffering through my foolishness during the
-   debugging process.
-
-   Reference Qlogic FAS408 Technical Manual, 53408-510-00A, May 10, 1994
-   (you can reference it, but it is incomplete and inaccurate in places)
-
-   Version 0.46 1/30/97 - kernel 1.2.0+
-
-   Functions as standalone, loadable, and PCMCIA driver, the latter from
-   Dave Hinds' PCMCIA package.
-   
-   Cleaned up 26/10/2002 by Alan Cox <alan@redhat.com> as part of the 2.5
-   SCSI driver cleanup and audit. This driver still needs work on the
-   following
-   	-	Non terminating hardware waits
-   	-	Some layering violations with its pcmcia stub
-
-   Redistributable under terms of the GNU General Public License
-
-   For the avoidance of doubt the "preferred form" of this code is one which
-   is in an open non patent encumbered format. Where cryptographic key signing
-   forms part of the process of creating an executable the information
-   including keys needed to generate an equivalently functional executable
-   are deemed to be part of the source code.
-
-*/
+ * Qlogic FAS408 ISA card driver
+ *
+ * Copyright 1994, Tom Zerucha.   
+ * tz@execpc.com
+ * 
+ * Redistributable under terms of the GNU General Public License
+ *
+ * For the avoidance of doubt the "preferred form" of this code is one which
+ * is in an open non patent encumbered format. Where cryptographic key signing
+ * forms part of the process of creating an executable the information
+ * including keys needed to generate an equivalently functional executable
+ * are deemed to be part of the source code.
+ *
+ * Check qlogicfas408.c for more credits and info.
+ */
 
 #include <linux/module.h>
 #include <linux/blkdev.h>		/* to get disk capacity */
@@ -57,429 +33,28 @@
 
 #include "scsi.h"
 #include "hosts.h"
-#include "qlogicfas.h"
-
-/*----------------------------------------------------------------*/
-int qlcfg5 = (XTALFREQ << 5);	/* 15625/512 */
-int qlcfg6 = SYNCXFRPD;
-int qlcfg7 = SYNCOFFST;
-int qlcfg8 = (SLOWCABLE << 7) | (QL_ENABLE_PARITY << 4);
-int qlcfg9 = ((XTALFREQ + 4) / 5);
-int qlcfgc = (FASTCLK << 3) | (FASTSCSI << 4);
-
-static char qlogicfas_name[] = "qlogicfas";
-
-int qlogicfas_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *));
-
-/*----------------------------------------------------------------*/
-
-/*----------------------------------------------------------------*/
-/* local functions */
-/*----------------------------------------------------------------*/
-
-/* error recovery - reset everything */
-
-static void ql_zap(qlogicfas_priv_t priv)
-{
-	int x;
-	int qbase = priv->qbase;
-
-	x = inb(qbase + 0xd);
-	REG0;
-	outb(3, qbase + 3);	/* reset SCSI */
-	outb(2, qbase + 3);	/* reset chip */
-	if (x & 0x80)
-		REG1;
-}
-
-/*
- *	Do a pseudo-dma tranfer
- */
- 
-static int ql_pdma(qlogicfas_priv_t priv, int phase, char *request, int reqlen)
-{
-	int j;
-	int qbase = priv->qbase;
-	j = 0;
-	if (phase & 1) {	/* in */
-#if QL_TURBO_PDMA
-		rtrc(4)
-		/* empty fifo in large chunks */
-		if (reqlen >= 128 && (inb(qbase + 8) & 2)) {	/* full */
-			insl(qbase + 4, request, 32);
-			reqlen -= 128;
-			request += 128;
-		}
-		while (reqlen >= 84 && !(j & 0xc0))	/* 2/3 */
-			if ((j = inb(qbase + 8)) & 4) 
-			{
-				insl(qbase + 4, request, 21);
-				reqlen -= 84;
-				request += 84;
-			}
-		if (reqlen >= 44 && (inb(qbase + 8) & 8)) {	/* 1/3 */
-			insl(qbase + 4, request, 11);
-			reqlen -= 44;
-			request += 44;
-		}
-#endif
-		/* until both empty and int (or until reclen is 0) */
-		rtrc(7)
-		j = 0;
-		while (reqlen && !((j & 0x10) && (j & 0xc0))) 
-		{
-			/* while bytes to receive and not empty */
-			j &= 0xc0;
-			while (reqlen && !((j = inb(qbase + 8)) & 0x10)) 
-			{
-				*request++ = inb(qbase + 4);
-				reqlen--;
-			}
-			if (j & 0x10)
-				j = inb(qbase + 8);
-
-		}
-	} else {		/* out */
-#if QL_TURBO_PDMA
-		rtrc(4)
-		    if (reqlen >= 128 && inb(qbase + 8) & 0x10) {	/* empty */
-			outsl(qbase + 4, request, 32);
-			reqlen -= 128;
-			request += 128;
-		}
-		while (reqlen >= 84 && !(j & 0xc0))	/* 1/3 */
-			if (!((j = inb(qbase + 8)) & 8)) {
-				outsl(qbase + 4, request, 21);
-				reqlen -= 84;
-				request += 84;
-			}
-		if (reqlen >= 40 && !(inb(qbase + 8) & 4)) {	/* 2/3 */
-			outsl(qbase + 4, request, 10);
-			reqlen -= 40;
-			request += 40;
-		}
-#endif
-		/* until full and int (or until reclen is 0) */
-		rtrc(7)
-		    j = 0;
-		while (reqlen && !((j & 2) && (j & 0xc0))) {
-			/* while bytes to send and not full */
-			while (reqlen && !((j = inb(qbase + 8)) & 2)) 
-			{
-				outb(*request++, qbase + 4);
-				reqlen--;
-			}
-			if (j & 2)
-				j = inb(qbase + 8);
-		}
-	}
-	/* maybe return reqlen */
-	return inb(qbase + 8) & 0xc0;
-}
-
-/*
- *	Wait for interrupt flag (polled - not real hardware interrupt) 
- */
-
-static int ql_wai(qlogicfas_priv_t priv)
-{
-	int k;
-	int qbase = priv->qbase;
-	unsigned long i;
-
-	k = 0;
-	i = jiffies + WATCHDOG;
-	while (time_before(jiffies, i) && !priv->qabort &&
-					!((k = inb(qbase + 4)) & 0xe0)) {
-		barrier();
-		cpu_relax();
-	}
-	if (time_after_eq(jiffies, i))
-		return (DID_TIME_OUT);
-	if (priv->qabort)
-		return (priv->qabort == 1 ? DID_ABORT : DID_RESET);
-	if (k & 0x60)
-		ql_zap(priv);
-	if (k & 0x20)
-		return (DID_PARITY);
-	if (k & 0x40)
-		return (DID_ERROR);
-	return 0;
-}
-
-/*
- *	Initiate scsi command - queueing handler 
- *	caller must hold host lock
- */
-
-static void ql_icmd(Scsi_Cmnd * cmd)
-{
-	qlogicfas_priv_t priv = (qlogicfas_priv_t)&(cmd->device->host->hostdata[0]);
-	int 	qbase = priv->qbase;
-	unsigned int i;
-
-	priv->qabort = 0;
-
-	REG0;
-	/* clearing of interrupts and the fifo is needed */
-
-	inb(qbase + 5);		/* clear interrupts */
-	if (inb(qbase + 5))	/* if still interrupting */
-		outb(2, qbase + 3);	/* reset chip */
-	else if (inb(qbase + 7) & 0x1f)
-		outb(1, qbase + 3);	/* clear fifo */
-	while (inb(qbase + 5));	/* clear ints */
-	REG1;
-	outb(1, qbase + 8);	/* set for PIO pseudo DMA */
-	outb(0, qbase + 0xb);	/* disable ints */
-	inb(qbase + 8);		/* clear int bits */
-	REG0;
-	outb(0x40, qbase + 0xb);	/* enable features */
-
-	/* configurables */
-	outb(qlcfgc, qbase + 0xc);
-	/* config: no reset interrupt, (initiator) bus id */
-	outb(0x40 | qlcfg8 | priv->qinitid, qbase + 8);
-	outb(qlcfg7, qbase + 7);
-	outb(qlcfg6, qbase + 6);
-	 /**/ outb(qlcfg5, qbase + 5);	/* select timer */
-	outb(qlcfg9 & 7, qbase + 9);	/* prescaler */
-/*	outb(0x99, qbase + 5);	*/
-	outb(cmd->device->id, qbase + 4);
-
-	for (i = 0; i < cmd->cmd_len; i++)
-		outb(cmd->cmnd[i], qbase + 2);
-
-	priv->qlcmd = cmd;
-	outb(0x41, qbase + 3);	/* select and send command */
-}
-
-/*
- *	Process scsi command - usually after interrupt 
- */
-
-static unsigned int ql_pcmd(Scsi_Cmnd * cmd)
-{
-	unsigned int i, j;
-	unsigned long k;
-	unsigned int result;	/* ultimate return result */
-	unsigned int status;	/* scsi returned status */
-	unsigned int message;	/* scsi returned message */
-	unsigned int phase;	/* recorded scsi phase */
-	unsigned int reqlen;	/* total length of transfer */
-	struct scatterlist *sglist;	/* scatter-gather list pointer */
-	unsigned int sgcount;	/* sg counter */
-	char *buf;
-	qlogicfas_priv_t priv = (qlogicfas_priv_t)&(cmd->device->host->hostdata[0]);
-	int qbase = priv->qbase;
-
-	rtrc(1)
-	j = inb(qbase + 6);
-	i = inb(qbase + 5);
-	if (i == 0x20) {
-		return (DID_NO_CONNECT << 16);
-	}
-	i |= inb(qbase + 5);	/* the 0x10 bit can be set after the 0x08 */
-	if (i != 0x18) {
-		printk(KERN_ERR "Ql:Bad Interrupt status:%02x\n", i);
-		ql_zap(priv);
-		return (DID_BAD_INTR << 16);
-	}
-	j &= 7;			/* j = inb( qbase + 7 ) >> 5; */
-
-	/* correct status is supposed to be step 4 */
-	/* it sometimes returns step 3 but with 0 bytes left to send */
-	/* We can try stuffing the FIFO with the max each time, but we will get a
-	   sequence of 3 if any bytes are left (but we do flush the FIFO anyway */
-
-	if (j != 3 && j != 4) {
-		printk(KERN_ERR "Ql:Bad sequence for command %d, int %02X, cmdleft = %d\n",
-		     j, i, inb(qbase + 7) & 0x1f);
-		ql_zap(priv);
-		return (DID_ERROR << 16);
-	}
-	result = DID_OK;
-	if (inb(qbase + 7) & 0x1f)	/* if some bytes in fifo */
-		outb(1, qbase + 3);	/* clear fifo */
-	/* note that request_bufflen is the total xfer size when sg is used */
-	reqlen = cmd->request_bufflen;
-	/* note that it won't work if transfers > 16M are requested */
-	if (reqlen && !((phase = inb(qbase + 4)) & 6)) {	/* data phase */
-		rtrc(2)
-		outb(reqlen, qbase);	/* low-mid xfer cnt */
-		outb(reqlen >> 8, qbase + 1);	/* low-mid xfer cnt */
-		outb(reqlen >> 16, qbase + 0xe);	/* high xfer cnt */
-		outb(0x90, qbase + 3);	/* command do xfer */
-		/* PIO pseudo DMA to buffer or sglist */
-		REG1;
-		if (!cmd->use_sg)
-			ql_pdma(priv, phase, cmd->request_buffer,
-				cmd->request_bufflen);
-		else {
-			sgcount = cmd->use_sg;
-			sglist = cmd->request_buffer;
-			while (sgcount--) {
-				if (priv->qabort) {
-					REG0;
-					return ((priv->qabort == 1 ?
-						DID_ABORT : DID_RESET) << 16);
-				}
-				buf = page_address(sglist->page) + sglist->offset;
-				if (ql_pdma(priv, phase, buf, sglist->length))
-					break;
-				sglist++;
-			}
-		}
-		REG0;
-		rtrc(2)
-		/*
-		 *	Wait for irq (split into second state of irq handler
-		 *	if this can take time) 
-		 */
-		if ((k = ql_wai(priv)))
-			return (k << 16);
-		k = inb(qbase + 5);	/* should be 0x10, bus service */
-	}
-
-	/*
-	 *	Enter Status (and Message In) Phase 
-	 */
-	 
-	k = jiffies + WATCHDOG;
-
-	while (time_before(jiffies, k) && !priv->qabort &&
-						!(inb(qbase + 4) & 6))
-		cpu_relax();	/* wait for status phase */
-
-	if (time_after_eq(jiffies, k)) {
-		ql_zap(priv);
-		return (DID_TIME_OUT << 16);
-	}
-
-	/* FIXME: timeout ?? */
-	while (inb(qbase + 5))
-		cpu_relax();	/* clear pending ints */
-
-	if (priv->qabort)
-		return ((priv->qabort == 1 ? DID_ABORT : DID_RESET) << 16);
-
-	outb(0x11, qbase + 3);	/* get status and message */
-	if ((k = ql_wai(priv)))
-		return (k << 16);
-	i = inb(qbase + 5);	/* get chip irq stat */
-	j = inb(qbase + 7) & 0x1f;	/* and bytes rec'd */
-	status = inb(qbase + 2);
-	message = inb(qbase + 2);
-
-	/*
-	 *	Should get function complete int if Status and message, else 
-	 *	bus serv if only status 
-	 */
-	if (!((i == 8 && j == 2) || (i == 0x10 && j == 1))) {
-		printk(KERN_ERR "Ql:Error during status phase, int=%02X, %d bytes recd\n", i, j);
-		result = DID_ERROR;
-	}
-	outb(0x12, qbase + 3);	/* done, disconnect */
-	rtrc(1)
-	if ((k = ql_wai(priv)))
-		return (k << 16);
-
-	/*
-	 *	Should get bus service interrupt and disconnect interrupt 
-	 */
-	 
-	i = inb(qbase + 5);	/* should be bus service */
-	while (!priv->qabort && ((i & 0x20) != 0x20)) {
-		barrier();
-		cpu_relax();
-		i |= inb(qbase + 5);
-	}
-	rtrc(0)
-
-	if (priv->qabort)
-		return ((priv->qabort == 1 ? DID_ABORT : DID_RESET) << 16);
-		
-	return (result << 16) | (message << 8) | (status & STATUS_MASK);
-}
+#include "qlogicfas408.h"
 
-/*
- *	Interrupt handler 
+/* Set the following to 2 to use normal interrupt (active high/totempole-
+ * tristate), otherwise use 0 (REQUIRED FOR PCMCIA) for active low, open
+ * drain
  */
+#define INT_TYPE	2
 
-static void ql_ihandl(int irq, void *dev_id, struct pt_regs *regs)
-{
-	Scsi_Cmnd *icmd;
-	struct Scsi_Host *host = (struct Scsi_Host *)dev_id;
-	qlogicfas_priv_t priv = (qlogicfas_priv_t)&(host->hostdata[0]);
-	int qbase = priv->qbase;
-	REG0;
-
-	if (!(inb(qbase + 4) & 0x80))	/* false alarm? */
-		return;
-
-	if (priv->qlcmd == NULL) {	/* no command to process? */
-		int i;
-		i = 16;
-		while (i-- && inb(qbase + 5));	/* maybe also ql_zap() */
-		return;
-	}
-	icmd = priv->qlcmd;
-	icmd->result = ql_pcmd(icmd);
-	priv->qlcmd = NULL;
-	/*
-	 *	If result is CHECK CONDITION done calls qcommand to request 
-	 *	sense 
-	 */
-	(icmd->scsi_done) (icmd);
-}
-
-irqreturn_t do_ql_ihandl(int irq, void *dev_id, struct pt_regs *regs)
-{
-	unsigned long flags;
-	struct Scsi_Host *host = dev_id;
-
-	spin_lock_irqsave(host->host_lock, flags);
-	ql_ihandl(irq, dev_id, regs);
-	spin_unlock_irqrestore(host->host_lock, flags);
-	return IRQ_HANDLED;
-}
-
-/*
- *	Queued command
- */
-
-int qlogicfas_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
-{
-	qlogicfas_priv_t priv = (qlogicfas_priv_t)&(cmd->device->host->hostdata[0]);
-	if (cmd->device->id == priv->qinitid) {
-		cmd->result = DID_BAD_TARGET << 16;
-		done(cmd);
-		return 0;
-	}
-
-	cmd->scsi_done = done;
-	/* wait for the last command's interrupt to finish */
-	while (priv->qlcmd != NULL) {
-		barrier();
-		cpu_relax();
-	}
-	ql_icmd(cmd);
-	return 0;
-}
+static char qlogicfas_name[] = "qlogicfas";
 
-#ifndef PCMCIA
 /*
  *	Look for qlogic card and init if found 
  */
  
-struct Scsi_Host *__qlogicfas_detect(Scsi_Host_Template *host, int qbase,
+static struct Scsi_Host *__qlogicfas_detect(Scsi_Host_Template *host,
+								int qbase,
 								int qlirq)
 {
-	int i, j;		/* these are only used by IRQ detect */
 	int qltyp;		/* type of chip */
 	int qinitid;
 	struct Scsi_Host *hreg;	/* registered host structure */
-	qlogicfas_priv_t priv;
+	struct qlogicfas408_priv *priv;
 
 	/*	Qlogic Cards only exist at 0x230 or 0x330 (the chip itself
 	 *	decodes the address - I check 230 first since MIDI cards are
@@ -490,70 +65,36 @@
 	 *	the second card, but I haven't tested this.
 	 */
 
-	if (!qbase) {
-		for (qbase = 0x230; qbase < 0x430; qbase += 0x100) {
-			if (!request_region(qbase, 0x10, qlogicfas_name))
-				continue;
-			REG1;
-			if (((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7)
-			    && ((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7))
-				break;
-			release_region(qbase, 0x10);
-		}
-		if (qbase == 0x430)
-			return NULL;
-	} else
-		printk(KERN_INFO "Ql: Using preset base address of %03x\n", qbase);
+	if (!qbase || qlirq == -1)
+		goto err;
+
+	if (!request_region(qbase, 0x10, qlogicfas_name)) {
+		printk(KERN_INFO "%s: address %#x is busy\n", qlogicfas_name,
+							      qbase);
+		goto err;
+	}
+
+	if (!qlogicfas408_detect(qbase, INT_TYPE)) {
+		printk(KERN_WARNING "%s: probe failed for %#x\n",
+								qlogicfas_name,
+								qbase);
+		goto err_release_mem;
+	}
 
-	qltyp = inb(qbase + 0xe) & 0xf8;
+	printk(KERN_INFO "%s: Using preset base address of %03x,"
+			 " IRQ %d\n", qlogicfas_name, qbase, qlirq);
+
+	qltyp = qlogicfas408_get_chip_type(qbase, INT_TYPE);
 	qinitid = host->this_id;
 	if (qinitid < 0)
 		qinitid = 7;	/* if no ID, use 7 */
-	outb(1, qbase + 8);	/* set for PIO pseudo DMA */
-	REG0;
-	outb(0x40 | qlcfg8 | qinitid, qbase + 8);	/* (ini) bus id, disable scsi rst */
-	outb(qlcfg5, qbase + 5);	/* select timer */
-	outb(qlcfg9, qbase + 9);	/* prescaler */
-
-#if QL_RESET_AT_START
-	outb(3, qbase + 3);
-	REG1;
-	/* FIXME: timeout */
-	while (inb(qbase + 0xf) & 4)
-		cpu_relax();
-	REG0;
-#endif
-
-	/*
-	 *	IRQ probe - toggle pin and check request pending 
-	 */
 
-	if (qlirq == -1) {
-		i = 0xffff;
-		j = 3;
-		outb(0x90, qbase + 3);	/* illegal command - cause interrupt */
-		REG1;
-		outb(10, 0x20);	/* access pending interrupt map */
-		outb(10, 0xa0);
-		while (j--) {
-			outb(0xb0 | QL_INT_ACTIVE_HIGH, qbase + 0xd);	/* int pin off */
-			i &= ~(inb(0x20) | (inb(0xa0) << 8));		/* find IRQ off */
-			outb(0xb4 | QL_INT_ACTIVE_HIGH, qbase + 0xd);	/* int pin on */
-			i &= inb(0x20) | (inb(0xa0) << 8);		/* find IRQ on */
-		}
-		REG0;
-		while (inb(qbase + 5));	/* purge int */
-		j = -1;
-		while (i)	/* find on bit */
-			i >>= 1, j++;	/* should check for exactly 1 on */
-		qlirq = j;
-	} else
-		printk(KERN_INFO "Ql: Using preset IRQ %d\n", qlirq);
+	qlogicfas408_setup(qbase, qinitid, INT_TYPE);
 
-	hreg = scsi_host_alloc(host, sizeof(struct qlogicfas_priv));
+	hreg = scsi_host_alloc(host, sizeof(struct qlogicfas408_priv));
 	if (!hreg)
 		goto err_release_mem;
-	priv = (qlogicfas_priv_t)&(hreg->hostdata[0]);
+	priv = get_priv_by_host(hreg);
 	hreg->io_port = qbase;
 	hreg->n_io_port = 16;
 	hreg->dma_channel = -1;
@@ -563,13 +104,14 @@
 	priv->qlirq = qlirq;
 	priv->qinitid = qinitid;
 	priv->shost = hreg;
+	priv->int_type = INT_TYPE;
 
 	sprintf(priv->qinfo,
 		"Qlogicfas Driver version 0.46, chip %02X at %03X, IRQ %d, TPdma:%d",
 		qltyp, qbase, qlirq, QL_TURBO_PDMA);
 	host->name = qlogicfas_name;
 
-	if (request_irq(qlirq, do_ql_ihandl, 0, qlogicfas_name, hreg))
+	if (request_irq(qlirq, qlogicfas408_ihandl, 0, qlogicfas_name, hreg))
 		goto free_scsi_host;
 
 	if (scsi_add_host(hreg, NULL))
@@ -587,11 +129,12 @@
 
 err_release_mem:
 	release_region(qbase, 0x10);
+err:
 	return NULL;
 }
 
 #define MAX_QLOGICFAS	8
-static qlogicfas_priv_t cards;
+static struct qlogicfas408_priv *cards;
 static int iobase[MAX_QLOGICFAS];
 static int irq[MAX_QLOGICFAS] = { [0 ... MAX_QLOGICFAS-1] = -1 };
 MODULE_PARM(iobase, "1-" __MODULE_STRING(MAX_QLOGICFAS) "i");
@@ -599,23 +142,21 @@
 MODULE_PARM_DESC(iobase, "I/O address");
 MODULE_PARM_DESC(irq, "IRQ");
 
-int __devinit qlogicfas_detect(Scsi_Host_Template *sht)
+static int __devinit qlogicfas_detect(Scsi_Host_Template *sht)
 {
-	struct Scsi_Host	*shost;
-	qlogicfas_priv_t	priv;
-	int	i,
-		num = 0;
+	struct Scsi_Host *shost;
+	struct qlogicfas408_priv *priv;
+	int num;
 
-	for (i = 0; i < MAX_QLOGICFAS; i++) {
+	for (num = 0; num < MAX_QLOGICFAS; num++) {
 		shost = __qlogicfas_detect(sht, iobase[num], irq[num]);
 		if (shost == NULL) {
 			/* no more devices */
 			break;
 		}
-		priv = (qlogicfas_priv_t)&(shost->hostdata[0]);
+		priv = get_priv_by_host(shost);
 		priv->next = cards;
 		cards = priv;
-		num++;
 	}
 
 	return num;
@@ -623,13 +164,10 @@
 
 static int qlogicfas_release(struct Scsi_Host *shost)
 {
-	qlogicfas_priv_t priv = (qlogicfas_priv_t)&(shost->hostdata[0]);
-	int qbase = priv->qbase;
+	struct qlogicfas408_priv *priv = get_priv_by_host(shost);
 
 	if (shost->irq) {
-		REG1;
-		outb(0, qbase + 0xb);	/* disable ints */
-	
+		qlogicfas408_disable_ints(priv);	
 		free_irq(shost->irq, shost);
 	}
 	if (shost->dma_channel != 0xff)
@@ -641,100 +179,21 @@
 
 	return 0;
 }
-#endif	/* ifndef PCMCIA */
-
-/* 
- *	Return bios parameters 
- */
-
-int qlogicfas_biosparam(struct scsi_device * disk,
-		        struct block_device *dev,
-			sector_t capacity, int ip[])
-{
-/* This should mimic the DOS Qlogic driver's behavior exactly */
-	ip[0] = 0x40;
-	ip[1] = 0x20;
-	ip[2] = (unsigned long) capacity / (ip[0] * ip[1]);
-	if (ip[2] > 1024) {
-		ip[0] = 0xff;
-		ip[1] = 0x3f;
-		ip[2] = (unsigned long) capacity / (ip[0] * ip[1]);
-#if 0
-		if (ip[2] > 1023)
-			ip[2] = 1023;
-#endif
-	}
-	return 0;
-}
-
-/*
- *	Abort a command in progress
- */
- 
-static int qlogicfas_abort(Scsi_Cmnd * cmd)
-{
-	qlogicfas_priv_t priv = (qlogicfas_priv_t)&(cmd->device->host->hostdata[0]);
-	priv->qabort = 1;
-	ql_zap(priv);
-	return SUCCESS;
-}
-
-/* 
- *	Reset SCSI bus
- *	FIXME: This function is invoked with cmd = NULL directly by
- *	the PCMCIA qlogic_stub code. This wants fixing
- */
-
-int qlogicfas_bus_reset(Scsi_Cmnd * cmd)
-{
-	qlogicfas_priv_t priv = (qlogicfas_priv_t)&(cmd->device->host->hostdata[0]);
-	priv->qabort = 2;
-	ql_zap(priv);
-	return SUCCESS;
-}
-
-/* 
- *	Reset SCSI host controller
- */
-
-static int qlogicfas_host_reset(Scsi_Cmnd * cmd)
-{
-	return FAILED;
-}
-
-/* 
- *	Reset SCSI device
- */
-
-static int qlogicfas_device_reset(Scsi_Cmnd * cmd)
-{
-	return FAILED;
-}
-
-/*
- *	Return info string
- */
-
-static const char *qlogicfas_info(struct Scsi_Host *host)
-{
-	qlogicfas_priv_t priv = (qlogicfas_priv_t)&(host->hostdata[0]);
-	return priv->qinfo;
-}
 
 /*
  *	The driver template is also needed for PCMCIA
  */
-Scsi_Host_Template qlogicfas_driver_template = {
+static Scsi_Host_Template qlogicfas_driver_template = {
 	.module			= THIS_MODULE,
 	.name			= qlogicfas_name,
 	.proc_name		= qlogicfas_name,
-	.info			= qlogicfas_info,
-	.queuecommand		= qlogicfas_queuecommand,
-	.eh_abort_handler	= qlogicfas_abort,
-	.eh_bus_reset_handler	= qlogicfas_bus_reset,
-	.eh_device_reset_handler= qlogicfas_device_reset,
-	.eh_host_reset_handler	= qlogicfas_host_reset,
-	.bios_param		= qlogicfas_biosparam,
+	.info			= qlogicfas408_info,
+	.queuecommand		= qlogicfas408_queuecommand,
+	.eh_abort_handler	= qlogicfas408_abort,
+	.eh_bus_reset_handler	= qlogicfas408_bus_reset,
+	.eh_device_reset_handler= qlogicfas408_device_reset,
+	.eh_host_reset_handler	= qlogicfas408_host_reset,
+	.bios_param		= qlogicfas408_biosparam,
 	.can_queue		= 1,
 	.this_id		= -1,
 	.sg_tablesize		= SG_ALL,
@@ -742,11 +201,13 @@
 	.use_clustering		= DISABLE_CLUSTERING,
 };
 
-#ifndef PCMCIA
 static __init int qlogicfas_init(void)
 {
 	if (!qlogicfas_detect(&qlogicfas_driver_template)) {
 		/* no cards found */
+		printk(KERN_INFO "%s: no cards were found, please specify "
+				 "I/O address and IRQ using iobase= and irq= "
+				 "options", qlogicfas_name);
 		return -ENODEV;
 	}
 
@@ -755,16 +216,15 @@
 
 static __exit void qlogicfas_exit(void)
 {
-	qlogicfas_priv_t	priv;
+	struct qlogicfas408_priv *priv;
 
 	for (priv = cards; priv != NULL; priv = priv->next)
 		qlogicfas_release(priv->shost);
 }
 
 MODULE_AUTHOR("Tom Zerucha, Michael Griffith");
-MODULE_DESCRIPTION("Driver for the Qlogic FAS SCSI controllers");
+MODULE_DESCRIPTION("Driver for the Qlogic FAS408 based ISA card");
 MODULE_LICENSE("GPL");
 module_init(qlogicfas_init);
 module_exit(qlogicfas_exit);
-#endif	/* ifndef PCMCIA */
 
diff -Nru a/drivers/scsi/qlogicfas.h b/drivers/scsi/qlogicfas.h
--- a/drivers/scsi/qlogicfas.h	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,124 +0,0 @@
-/* to be used by qlogicfas and qlogic_cs */
-#ifndef __QLOGICFAS_H
-#define __QLOGICFAS_H
-
-/*----------------------------------------------------------------*/
-/* Configuration */
-
-/* Set the following to 2 to use normal interrupt (active high/totempole-
-   tristate), otherwise use 0 (REQUIRED FOR PCMCIA) for active low, open
-   drain */
-
-#define QL_INT_ACTIVE_HIGH 2
-
-/* Set the following to max out the speed of the PIO PseudoDMA transfers,
-   again, 0 tends to be slower, but more stable.  */
-
-#define QL_TURBO_PDMA 1
-
-/* This should be 1 to enable parity detection */
-
-#define QL_ENABLE_PARITY 1
-
-/* This will reset all devices when the driver is initialized (during bootup).
-   The other linux drivers don't do this, but the DOS drivers do, and after
-   using DOS or some kind of crash or lockup this will bring things back
-   without requiring a cold boot.  It does take some time to recover from a
-   reset, so it is slower, and I have seen timeouts so that devices weren't
-   recognized when this was set. */
-
-#define QL_RESET_AT_START 0
-
-/* crystal frequency in megahertz (for offset 5 and 9)
-   Please set this for your card.  Most Qlogic cards are 40 Mhz.  The
-   Control Concepts ISA (not VLB) is 24 Mhz */
-
-#define XTALFREQ	40
-
-/**********/
-/* DANGER! modify these at your own risk */
-/* SLOWCABLE can usually be reset to zero if you have a clean setup and
-   proper termination.  The rest are for synchronous transfers and other
-   advanced features if your device can transfer faster than 5Mb/sec.
-   If you are really curious, email me for a quick howto until I have
-   something official */
-/**********/
-
-/*****/
-/* config register 1 (offset 8) options */
-/* This needs to be set to 1 if your cabling is long or noisy */
-#define SLOWCABLE 1
-
-/*****/
-/* offset 0xc */
-/* This will set fast (10Mhz) synchronous timing when set to 1
-   For this to have an effect, FASTCLK must also be 1 */
-#define FASTSCSI 0
-
-/* This when set to 1 will set a faster sync transfer rate */
-#define FASTCLK 0	/*(XTALFREQ>25?1:0)*/
-
-/*****/
-/* offset 6 */
-/* This is the sync transfer divisor, XTALFREQ/X will be the maximum
-   achievable data rate (assuming the rest of the system is capable
-   and set properly) */
-#define SYNCXFRPD 5	/*(XTALFREQ/5)*/
-
-/*****/
-/* offset 7 */
-/* This is the count of how many synchronous transfers can take place
-	i.e. how many reqs can occur before an ack is given.
-	The maximum value for this is 15, the upper bits can modify
-	REQ/ACK assertion and deassertion during synchronous transfers
-	If this is 0, the bus will only transfer asynchronously */
-#define SYNCOFFST 0
-/* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles
-	of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will
-	cause the deassertion to be early by 1/2 clock.  Bits 5&4 control
-	the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */
-
-/*----------------------------------------------------------------*/
-#ifdef PCMCIA
-#undef QL_INT_ACTIVE_HIGH
-#define QL_INT_ACTIVE_HIGH 0
-#endif
-
-struct qlogicfas_priv;
-typedef struct qlogicfas_priv *qlogicfas_priv_t;
-struct qlogicfas_priv {
-	 int		qbase;		/* Port */
-	 int		qinitid;	/* initiator ID */
-	 int		qabort;		/* Flag to cause an abort */
-	 int		qlirq;		/* IRQ being used */
-	 char		qinfo[80];	/* description */
-	 Scsi_Cmnd 	*qlcmd;		/* current command being processed */
-	 struct Scsi_Host	*shost;	/* pointer back to host */
-	 qlogicfas_priv_t	next;	/* next private struct */
-};
-
-extern int qlcfg5;
-extern int qlcfg6;
-extern int qlcfg7;
-extern int qlcfg8;
-extern int qlcfg9;
-extern int qlcfgc;
-
-/* The qlogic card uses two register maps - These macros select which one */
-#define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd ))
-#define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | QL_INT_ACTIVE_HIGH , qbase + 0xd ))
-
-/* following is watchdog timeout in microseconds */
-#define WATCHDOG 5000000
-
-/*----------------------------------------------------------------*/
-/* the following will set the monitor border color (useful to find
-   where something crashed or gets stuck at and as a simple profiler) */
-
-#if 0
-#define rtrc(i) {inb(0x3da);outb(0x31,0x3c0);outb((i),0x3c0);}
-#else
-#define rtrc(i) {}
-#endif
-#endif	/* __QLOGICFAS_H */
-
diff -Nru a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/qlogicfas408.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,637 @@
+/*----------------------------------------------------------------*/
+/*
+   Qlogic linux driver - work in progress. No Warranty express or implied.
+   Use at your own risk.  Support Tort Reform so you won't have to read all
+   these silly disclaimers.
+
+   Copyright 1994, Tom Zerucha.   
+   tz@execpc.com
+   
+   Additional Code, and much appreciated help by
+   Michael A. Griffith
+   grif@cs.ucr.edu
+
+   Thanks to Eric Youngdale and Dave Hinds for loadable module and PCMCIA
+   help respectively, and for suffering through my foolishness during the
+   debugging process.
+
+   Reference Qlogic FAS408 Technical Manual, 53408-510-00A, May 10, 1994
+   (you can reference it, but it is incomplete and inaccurate in places)
+
+   Version 0.46 1/30/97 - kernel 1.2.0+
+
+   Functions as standalone, loadable, and PCMCIA driver, the latter from
+   Dave Hinds' PCMCIA package.
+   
+   Cleaned up 26/10/2002 by Alan Cox <alan@redhat.com> as part of the 2.5
+   SCSI driver cleanup and audit. This driver still needs work on the
+   following
+   	-	Non terminating hardware waits
+   	-	Some layering violations with its pcmcia stub
+
+   Redistributable under terms of the GNU General Public License
+
+   For the avoidance of doubt the "preferred form" of this code is one which
+   is in an open non patent encumbered format. Where cryptographic key signing
+   forms part of the process of creating an executable the information
+   including keys needed to generate an equivalently functional executable
+   are deemed to be part of the source code.
+
+*/
+
+#include <linux/module.h>
+#include <linux/blkdev.h>		/* to get disk capacity */
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/ioport.h>
+#include <linux/proc_fs.h>
+#include <linux/unistd.h>
+#include <linux/spinlock.h>
+#include <linux/stat.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/dma.h>
+
+#include "scsi.h"
+#include "hosts.h"
+#include "qlogicfas408.h"
+
+/*----------------------------------------------------------------*/
+static int qlcfg5 = (XTALFREQ << 5);	/* 15625/512 */
+static int qlcfg6 = SYNCXFRPD;
+static int qlcfg7 = SYNCOFFST;
+static int qlcfg8 = (SLOWCABLE << 7) | (QL_ENABLE_PARITY << 4);
+static int qlcfg9 = ((XTALFREQ + 4) / 5);
+static int qlcfgc = (FASTCLK << 3) | (FASTSCSI << 4);
+
+/*----------------------------------------------------------------*/
+
+/*----------------------------------------------------------------*/
+/* local functions */
+/*----------------------------------------------------------------*/
+
+/* error recovery - reset everything */
+
+static void ql_zap(struct qlogicfas408_priv *priv)
+{
+	int x;
+	int qbase = priv->qbase;
+	int int_type = priv->int_type;
+
+	x = inb(qbase + 0xd);
+	REG0;
+	outb(3, qbase + 3);	/* reset SCSI */
+	outb(2, qbase + 3);	/* reset chip */
+	if (x & 0x80)
+		REG1;
+}
+
+/*
+ *	Do a pseudo-dma tranfer
+ */
+ 
+static int ql_pdma(struct qlogicfas408_priv *priv, int phase, char *request, int reqlen)
+{
+	int j;
+	int qbase = priv->qbase;
+	j = 0;
+	if (phase & 1) {	/* in */
+#if QL_TURBO_PDMA
+		rtrc(4)
+		/* empty fifo in large chunks */
+		if (reqlen >= 128 && (inb(qbase + 8) & 2)) {	/* full */
+			insl(qbase + 4, request, 32);
+			reqlen -= 128;
+			request += 128;
+		}
+		while (reqlen >= 84 && !(j & 0xc0))	/* 2/3 */
+			if ((j = inb(qbase + 8)) & 4) 
+			{
+				insl(qbase + 4, request, 21);
+				reqlen -= 84;
+				request += 84;
+			}
+		if (reqlen >= 44 && (inb(qbase + 8) & 8)) {	/* 1/3 */
+			insl(qbase + 4, request, 11);
+			reqlen -= 44;
+			request += 44;
+		}
+#endif
+		/* until both empty and int (or until reclen is 0) */
+		rtrc(7)
+		j = 0;
+		while (reqlen && !((j & 0x10) && (j & 0xc0))) 
+		{
+			/* while bytes to receive and not empty */
+			j &= 0xc0;
+			while (reqlen && !((j = inb(qbase + 8)) & 0x10)) 
+			{
+				*request++ = inb(qbase + 4);
+				reqlen--;
+			}
+			if (j & 0x10)
+				j = inb(qbase + 8);
+
+		}
+	} else {		/* out */
+#if QL_TURBO_PDMA
+		rtrc(4)
+		    if (reqlen >= 128 && inb(qbase + 8) & 0x10) {	/* empty */
+			outsl(qbase + 4, request, 32);
+			reqlen -= 128;
+			request += 128;
+		}
+		while (reqlen >= 84 && !(j & 0xc0))	/* 1/3 */
+			if (!((j = inb(qbase + 8)) & 8)) {
+				outsl(qbase + 4, request, 21);
+				reqlen -= 84;
+				request += 84;
+			}
+		if (reqlen >= 40 && !(inb(qbase + 8) & 4)) {	/* 2/3 */
+			outsl(qbase + 4, request, 10);
+			reqlen -= 40;
+			request += 40;
+		}
+#endif
+		/* until full and int (or until reclen is 0) */
+		rtrc(7)
+		    j = 0;
+		while (reqlen && !((j & 2) && (j & 0xc0))) {
+			/* while bytes to send and not full */
+			while (reqlen && !((j = inb(qbase + 8)) & 2)) 
+			{
+				outb(*request++, qbase + 4);
+				reqlen--;
+			}
+			if (j & 2)
+				j = inb(qbase + 8);
+		}
+	}
+	/* maybe return reqlen */
+	return inb(qbase + 8) & 0xc0;
+}
+
+/*
+ *	Wait for interrupt flag (polled - not real hardware interrupt) 
+ */
+
+static int ql_wai(struct qlogicfas408_priv *priv)
+{
+	int k;
+	int qbase = priv->qbase;
+	unsigned long i;
+
+	k = 0;
+	i = jiffies + WATCHDOG;
+	while (time_before(jiffies, i) && !priv->qabort &&
+					!((k = inb(qbase + 4)) & 0xe0)) {
+		barrier();
+		cpu_relax();
+	}
+	if (time_after_eq(jiffies, i))
+		return (DID_TIME_OUT);
+	if (priv->qabort)
+		return (priv->qabort == 1 ? DID_ABORT : DID_RESET);
+	if (k & 0x60)
+		ql_zap(priv);
+	if (k & 0x20)
+		return (DID_PARITY);
+	if (k & 0x40)
+		return (DID_ERROR);
+	return 0;
+}
+
+/*
+ *	Initiate scsi command - queueing handler 
+ *	caller must hold host lock
+ */
+
+static void ql_icmd(Scsi_Cmnd * cmd)
+{
+	struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
+	int 	qbase = priv->qbase;
+	int	int_type = priv->int_type;
+	unsigned int i;
+
+	priv->qabort = 0;
+
+	REG0;
+	/* clearing of interrupts and the fifo is needed */
+
+	inb(qbase + 5);		/* clear interrupts */
+	if (inb(qbase + 5))	/* if still interrupting */
+		outb(2, qbase + 3);	/* reset chip */
+	else if (inb(qbase + 7) & 0x1f)
+		outb(1, qbase + 3);	/* clear fifo */
+	while (inb(qbase + 5));	/* clear ints */
+	REG1;
+	outb(1, qbase + 8);	/* set for PIO pseudo DMA */
+	outb(0, qbase + 0xb);	/* disable ints */
+	inb(qbase + 8);		/* clear int bits */
+	REG0;
+	outb(0x40, qbase + 0xb);	/* enable features */
+
+	/* configurables */
+	outb(qlcfgc, qbase + 0xc);
+	/* config: no reset interrupt, (initiator) bus id */
+	outb(0x40 | qlcfg8 | priv->qinitid, qbase + 8);
+	outb(qlcfg7, qbase + 7);
+	outb(qlcfg6, qbase + 6);
+	 /**/ outb(qlcfg5, qbase + 5);	/* select timer */
+	outb(qlcfg9 & 7, qbase + 9);	/* prescaler */
+/*	outb(0x99, qbase + 5);	*/
+	outb(cmd->device->id, qbase + 4);
+
+	for (i = 0; i < cmd->cmd_len; i++)
+		outb(cmd->cmnd[i], qbase + 2);
+
+	priv->qlcmd = cmd;
+	outb(0x41, qbase + 3);	/* select and send command */
+}
+
+/*
+ *	Process scsi command - usually after interrupt 
+ */
+
+static unsigned int ql_pcmd(Scsi_Cmnd * cmd)
+{
+	unsigned int i, j;
+	unsigned long k;
+	unsigned int result;	/* ultimate return result */
+	unsigned int status;	/* scsi returned status */
+	unsigned int message;	/* scsi returned message */
+	unsigned int phase;	/* recorded scsi phase */
+	unsigned int reqlen;	/* total length of transfer */
+	struct scatterlist *sglist;	/* scatter-gather list pointer */
+	unsigned int sgcount;	/* sg counter */
+	char *buf;
+	struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
+	int qbase = priv->qbase;
+	int int_type = priv->int_type;
+
+	rtrc(1)
+	j = inb(qbase + 6);
+	i = inb(qbase + 5);
+	if (i == 0x20) {
+		return (DID_NO_CONNECT << 16);
+	}
+	i |= inb(qbase + 5);	/* the 0x10 bit can be set after the 0x08 */
+	if (i != 0x18) {
+		printk(KERN_ERR "Ql:Bad Interrupt status:%02x\n", i);
+		ql_zap(priv);
+		return (DID_BAD_INTR << 16);
+	}
+	j &= 7;			/* j = inb( qbase + 7 ) >> 5; */
+
+	/* correct status is supposed to be step 4 */
+	/* it sometimes returns step 3 but with 0 bytes left to send */
+	/* We can try stuffing the FIFO with the max each time, but we will get a
+	   sequence of 3 if any bytes are left (but we do flush the FIFO anyway */
+
+	if (j != 3 && j != 4) {
+		printk(KERN_ERR "Ql:Bad sequence for command %d, int %02X, cmdleft = %d\n",
+		     j, i, inb(qbase + 7) & 0x1f);
+		ql_zap(priv);
+		return (DID_ERROR << 16);
+	}
+	result = DID_OK;
+	if (inb(qbase + 7) & 0x1f)	/* if some bytes in fifo */
+		outb(1, qbase + 3);	/* clear fifo */
+	/* note that request_bufflen is the total xfer size when sg is used */
+	reqlen = cmd->request_bufflen;
+	/* note that it won't work if transfers > 16M are requested */
+	if (reqlen && !((phase = inb(qbase + 4)) & 6)) {	/* data phase */
+		rtrc(2)
+		outb(reqlen, qbase);	/* low-mid xfer cnt */
+		outb(reqlen >> 8, qbase + 1);	/* low-mid xfer cnt */
+		outb(reqlen >> 16, qbase + 0xe);	/* high xfer cnt */
+		outb(0x90, qbase + 3);	/* command do xfer */
+		/* PIO pseudo DMA to buffer or sglist */
+		REG1;
+		if (!cmd->use_sg)
+			ql_pdma(priv, phase, cmd->request_buffer,
+				cmd->request_bufflen);
+		else {
+			sgcount = cmd->use_sg;
+			sglist = cmd->request_buffer;
+			while (sgcount--) {
+				if (priv->qabort) {
+					REG0;
+					return ((priv->qabort == 1 ?
+						DID_ABORT : DID_RESET) << 16);
+				}
+				buf = page_address(sglist->page) + sglist->offset;
+				if (ql_pdma(priv, phase, buf, sglist->length))
+					break;
+				sglist++;
+			}
+		}
+		REG0;
+		rtrc(2)
+		/*
+		 *	Wait for irq (split into second state of irq handler
+		 *	if this can take time) 
+		 */
+		if ((k = ql_wai(priv)))
+			return (k << 16);
+		k = inb(qbase + 5);	/* should be 0x10, bus service */
+	}
+
+	/*
+	 *	Enter Status (and Message In) Phase 
+	 */
+	 
+	k = jiffies + WATCHDOG;
+
+	while (time_before(jiffies, k) && !priv->qabort &&
+						!(inb(qbase + 4) & 6))
+		cpu_relax();	/* wait for status phase */
+
+	if (time_after_eq(jiffies, k)) {
+		ql_zap(priv);
+		return (DID_TIME_OUT << 16);
+	}
+
+	/* FIXME: timeout ?? */
+	while (inb(qbase + 5))
+		cpu_relax();	/* clear pending ints */
+
+	if (priv->qabort)
+		return ((priv->qabort == 1 ? DID_ABORT : DID_RESET) << 16);
+
+	outb(0x11, qbase + 3);	/* get status and message */
+	if ((k = ql_wai(priv)))
+		return (k << 16);
+	i = inb(qbase + 5);	/* get chip irq stat */
+	j = inb(qbase + 7) & 0x1f;	/* and bytes rec'd */
+	status = inb(qbase + 2);
+	message = inb(qbase + 2);
+
+	/*
+	 *	Should get function complete int if Status and message, else 
+	 *	bus serv if only status 
+	 */
+	if (!((i == 8 && j == 2) || (i == 0x10 && j == 1))) {
+		printk(KERN_ERR "Ql:Error during status phase, int=%02X, %d bytes recd\n", i, j);
+		result = DID_ERROR;
+	}
+	outb(0x12, qbase + 3);	/* done, disconnect */
+	rtrc(1)
+	if ((k = ql_wai(priv)))
+		return (k << 16);
+
+	/*
+	 *	Should get bus service interrupt and disconnect interrupt 
+	 */
+	 
+	i = inb(qbase + 5);	/* should be bus service */
+	while (!priv->qabort && ((i & 0x20) != 0x20)) {
+		barrier();
+		cpu_relax();
+		i |= inb(qbase + 5);
+	}
+	rtrc(0)
+
+	if (priv->qabort)
+		return ((priv->qabort == 1 ? DID_ABORT : DID_RESET) << 16);
+		
+	return (result << 16) | (message << 8) | (status & STATUS_MASK);
+}
+
+/*
+ *	Interrupt handler 
+ */
+
+static void ql_ihandl(int irq, void *dev_id, struct pt_regs *regs)
+{
+	Scsi_Cmnd *icmd;
+	struct Scsi_Host *host = (struct Scsi_Host *)dev_id;
+	struct qlogicfas408_priv *priv = get_priv_by_host(host);
+	int qbase = priv->qbase;
+	REG0;
+
+	if (!(inb(qbase + 4) & 0x80))	/* false alarm? */
+		return;
+
+	if (priv->qlcmd == NULL) {	/* no command to process? */
+		int i;
+		i = 16;
+		while (i-- && inb(qbase + 5));	/* maybe also ql_zap() */
+		return;
+	}
+	icmd = priv->qlcmd;
+	icmd->result = ql_pcmd(icmd);
+	priv->qlcmd = NULL;
+	/*
+	 *	If result is CHECK CONDITION done calls qcommand to request 
+	 *	sense 
+	 */
+	(icmd->scsi_done) (icmd);
+}
+
+irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id, struct pt_regs *regs)
+{
+	unsigned long flags;
+	struct Scsi_Host *host = dev_id;
+
+	spin_lock_irqsave(host->host_lock, flags);
+	ql_ihandl(irq, dev_id, regs);
+	spin_unlock_irqrestore(host->host_lock, flags);
+	return IRQ_HANDLED;
+}
+
+/*
+ *	Queued command
+ */
+
+int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
+{
+	struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
+	if (cmd->device->id == priv->qinitid) {
+		cmd->result = DID_BAD_TARGET << 16;
+		done(cmd);
+		return 0;
+	}
+
+	cmd->scsi_done = done;
+	/* wait for the last command's interrupt to finish */
+	while (priv->qlcmd != NULL) {
+		barrier();
+		cpu_relax();
+	}
+	ql_icmd(cmd);
+	return 0;
+}
+
+/* 
+ *	Return bios parameters 
+ */
+
+int qlogicfas408_biosparam(struct scsi_device * disk,
+		        struct block_device *dev,
+			sector_t capacity, int ip[])
+{
+/* This should mimic the DOS Qlogic driver's behavior exactly */
+	ip[0] = 0x40;
+	ip[1] = 0x20;
+	ip[2] = (unsigned long) capacity / (ip[0] * ip[1]);
+	if (ip[2] > 1024) {
+		ip[0] = 0xff;
+		ip[1] = 0x3f;
+		ip[2] = (unsigned long) capacity / (ip[0] * ip[1]);
+#if 0
+		if (ip[2] > 1023)
+			ip[2] = 1023;
+#endif
+	}
+	return 0;
+}
+
+/*
+ *	Abort a command in progress
+ */
+ 
+int qlogicfas408_abort(Scsi_Cmnd * cmd)
+{
+	struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
+	priv->qabort = 1;
+	ql_zap(priv);
+	return SUCCESS;
+}
+
+/* 
+ *	Reset SCSI bus
+ *	FIXME: This function is invoked with cmd = NULL directly by
+ *	the PCMCIA qlogic_stub code. This wants fixing
+ */
+
+int qlogicfas408_bus_reset(Scsi_Cmnd * cmd)
+{
+	struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
+	priv->qabort = 2;
+	ql_zap(priv);
+	return SUCCESS;
+}
+
+/* 
+ *	Reset SCSI host controller
+ */
+
+int qlogicfas408_host_reset(Scsi_Cmnd * cmd)
+{
+	return FAILED;
+}
+
+/* 
+ *	Reset SCSI device
+ */
+
+int qlogicfas408_device_reset(Scsi_Cmnd * cmd)
+{
+	return FAILED;
+}
+
+/*
+ *	Return info string
+ */
+
+const char *qlogicfas408_info(struct Scsi_Host *host)
+{
+	struct qlogicfas408_priv *priv = get_priv_by_host(host);
+	return priv->qinfo;
+}
+
+/*
+ *	Get type of chip
+ */
+
+int qlogicfas408_get_chip_type(int qbase, int int_type)
+{
+	REG1;
+	return inb(qbase + 0xe) & 0xf8;
+}
+
+/*
+ *	Perform initialization tasks
+ */
+
+void qlogicfas408_setup(int qbase, int id, int int_type)
+{
+	outb(1, qbase + 8);	/* set for PIO pseudo DMA */
+	REG0;
+	outb(0x40 | qlcfg8 | id, qbase + 8);	/* (ini) bus id, disable scsi rst */
+	outb(qlcfg5, qbase + 5);	/* select timer */
+	outb(qlcfg9, qbase + 9);	/* prescaler */
+
+#if QL_RESET_AT_START
+	outb(3, qbase + 3);
+
+	REG1;
+	/* FIXME: timeout */
+	while (inb(qbase + 0xf) & 4)
+		cpu_relax();
+
+	REG0;
+#endif
+}
+
+/*
+ *	Checks if this is a QLogic FAS 408
+ */
+
+int qlogicfas408_detect(int qbase, int int_type)
+{
+        REG1;
+	return (((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7) &&
+	       ((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7));		
+}
+
+/*
+ *	Disable interrupts
+ */
+
+void qlogicfas408_disable_ints(struct qlogicfas408_priv *priv)
+{
+	int qbase = priv->qbase;
+	int int_type = priv->int_type;
+
+	REG1;
+	outb(0, qbase + 0xb);	/* disable ints */
+}
+
+/*
+ *	Init and exit functions
+ */
+
+static int __init qlogicfas408_init(void)
+{
+	return 0;
+}
+
+static void __exit qlogicfas408_exit(void)
+{
+
+}
+
+MODULE_AUTHOR("Tom Zerucha, Michael Griffith");
+MODULE_DESCRIPTION("Driver for the Qlogic FAS SCSI controllers");
+MODULE_LICENSE("GPL");
+module_init(qlogicfas408_init);
+module_exit(qlogicfas408_exit);
+
+EXPORT_SYMBOL(qlogicfas408_info);
+EXPORT_SYMBOL(qlogicfas408_queuecommand);
+EXPORT_SYMBOL(qlogicfas408_abort);
+EXPORT_SYMBOL(qlogicfas408_bus_reset);
+EXPORT_SYMBOL(qlogicfas408_device_reset);
+EXPORT_SYMBOL(qlogicfas408_host_reset);
+EXPORT_SYMBOL(qlogicfas408_biosparam);
+EXPORT_SYMBOL(qlogicfas408_ihandl);
+EXPORT_SYMBOL(qlogicfas408_get_chip_type);
+EXPORT_SYMBOL(qlogicfas408_setup);
+EXPORT_SYMBOL(qlogicfas408_detect);
+EXPORT_SYMBOL(qlogicfas408_disable_ints);
+
diff -Nru a/drivers/scsi/qlogicfas408.h b/drivers/scsi/qlogicfas408.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/qlogicfas408.h	Tue Jun 15 22:20:37 2004
@@ -0,0 +1,120 @@
+/* to be used by qlogicfas and qlogic_cs */
+#ifndef __QLOGICFAS408_H
+#define __QLOGICFAS408_H
+
+/*----------------------------------------------------------------*/
+/* Configuration */
+
+/* Set the following to max out the speed of the PIO PseudoDMA transfers,
+   again, 0 tends to be slower, but more stable.  */
+
+#define QL_TURBO_PDMA 1
+
+/* This should be 1 to enable parity detection */
+
+#define QL_ENABLE_PARITY 1
+
+/* This will reset all devices when the driver is initialized (during bootup).
+   The other linux drivers don't do this, but the DOS drivers do, and after
+   using DOS or some kind of crash or lockup this will bring things back
+   without requiring a cold boot.  It does take some time to recover from a
+   reset, so it is slower, and I have seen timeouts so that devices weren't
+   recognized when this was set. */
+
+#define QL_RESET_AT_START 0
+
+/* crystal frequency in megahertz (for offset 5 and 9)
+   Please set this for your card.  Most Qlogic cards are 40 Mhz.  The
+   Control Concepts ISA (not VLB) is 24 Mhz */
+
+#define XTALFREQ	40
+
+/**********/
+/* DANGER! modify these at your own risk */
+/* SLOWCABLE can usually be reset to zero if you have a clean setup and
+   proper termination.  The rest are for synchronous transfers and other
+   advanced features if your device can transfer faster than 5Mb/sec.
+   If you are really curious, email me for a quick howto until I have
+   something official */
+/**********/
+
+/*****/
+/* config register 1 (offset 8) options */
+/* This needs to be set to 1 if your cabling is long or noisy */
+#define SLOWCABLE 1
+
+/*****/
+/* offset 0xc */
+/* This will set fast (10Mhz) synchronous timing when set to 1
+   For this to have an effect, FASTCLK must also be 1 */
+#define FASTSCSI 0
+
+/* This when set to 1 will set a faster sync transfer rate */
+#define FASTCLK 0	/*(XTALFREQ>25?1:0)*/
+
+/*****/
+/* offset 6 */
+/* This is the sync transfer divisor, XTALFREQ/X will be the maximum
+   achievable data rate (assuming the rest of the system is capable
+   and set properly) */
+#define SYNCXFRPD 5	/*(XTALFREQ/5)*/
+
+/*****/
+/* offset 7 */
+/* This is the count of how many synchronous transfers can take place
+	i.e. how many reqs can occur before an ack is given.
+	The maximum value for this is 15, the upper bits can modify
+	REQ/ACK assertion and deassertion during synchronous transfers
+	If this is 0, the bus will only transfer asynchronously */
+#define SYNCOFFST 0
+/* for the curious, bits 7&6 control the deassertion delay in 1/2 cycles
+	of the 40Mhz clock. If FASTCLK is 1, specifying 01 (1/2) will
+	cause the deassertion to be early by 1/2 clock.  Bits 5&4 control
+	the assertion delay, also in 1/2 clocks (FASTCLK is ignored here). */
+
+/*----------------------------------------------------------------*/
+
+struct qlogicfas408_priv {
+	 int		qbase;		/* Port */
+	 int		qinitid;	/* initiator ID */
+	 int		qabort;		/* Flag to cause an abort */
+	 int		qlirq;		/* IRQ being used */
+	 int		int_type;	/* type of irq, 2 for ISA board, 0 for PCMCIA */
+	 char		qinfo[80];	/* description */
+	 Scsi_Cmnd 	*qlcmd;		/* current command being processed */
+	 struct Scsi_Host *shost;	/* pointer back to host */
+	 struct qlogicfas408_priv *next; /* next private struct */
+};
+
+/* The qlogic card uses two register maps - These macros select which one */
+#define REG0 ( outb( inb( qbase + 0xd ) & 0x7f , qbase + 0xd ), outb( 4 , qbase + 0xd ))
+#define REG1 ( outb( inb( qbase + 0xd ) | 0x80 , qbase + 0xd ), outb( 0xb4 | int_type, qbase + 0xd ))
+
+/* following is watchdog timeout in microseconds */
+#define WATCHDOG 5000000
+
+/*----------------------------------------------------------------*/
+/* the following will set the monitor border color (useful to find
+   where something crashed or gets stuck at and as a simple profiler) */
+
+#define rtrc(i) {}
+
+#define get_priv_by_cmd(x) (struct qlogicfas408_priv *)&((x)->device->host->hostdata[0])
+#define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0])
+
+irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id, struct pt_regs *regs);
+int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *));
+int qlogicfas408_biosparam(struct scsi_device * disk,
+		        struct block_device *dev,
+			sector_t capacity, int ip[]);
+int qlogicfas408_abort(Scsi_Cmnd * cmd);
+int qlogicfas408_bus_reset(Scsi_Cmnd * cmd);
+int qlogicfas408_host_reset(Scsi_Cmnd * cmd);
+int qlogicfas408_device_reset(Scsi_Cmnd * cmd);
+const char *qlogicfas408_info(struct Scsi_Host *host);
+int qlogicfas408_get_chip_type(int qbase, int int_type);
+void qlogicfas408_setup(int qbase, int id, int int_type);
+int qlogicfas408_detect(int qbase, int int_type);
+void qlogicfas408_disable_ints(struct qlogicfas408_priv *priv);
+#endif	/* __QLOGICFAS408_H */
+
diff -Nru a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
--- a/drivers/scsi/qlogicpti.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/qlogicpti.c	Tue Jun 15 22:20:42 2004
@@ -23,11 +23,10 @@
 #include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
+#include <linux/module.h>
 
 #include <asm/byteorder.h>
 
-#include "scsi.h"
-#include "hosts.h"
 #include "qlogicpti.h"
 
 #include <asm/sbus.h>
@@ -39,7 +38,15 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#include <linux/module.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_eh.h>
+#include <scsi/scsi_request.h>
+#include <scsi/scsi_tcq.h>
+#include <scsi/scsi_host.h>
+
+
 
 #define MAX_TARGETS	16
 #define MAX_LUNS	8	/* 32 for 1.31 F/W */
@@ -809,7 +816,7 @@
 }
 
 /* Detect all PTI Qlogic ISP's in the machine. */
-static int __init qlogicpti_detect(Scsi_Host_Template *tpnt)
+static int __init qlogicpti_detect(struct scsi_host_template *tpnt)
 {
 	struct qlogicpti *qpti;
 	struct Scsi_Host *qpti_host;
@@ -878,7 +885,7 @@
 			qpti_get_bursts(qpti);
 			qpti_get_clock(qpti);
 
-			/* Clear out Scsi_Cmnd array. */
+			/* Clear out scsi_cmnd array. */
 			memset(qpti->cmd_slots, 0, sizeof(qpti->cmd_slots));
 
 			if (qpti_map_queues(qpti) < 0)
@@ -997,7 +1004,7 @@
 	marker->rsvd = 0;
 }
 
-static inline void cmd_frob(struct Command_Entry *cmd, Scsi_Cmnd *Cmnd,
+static inline void cmd_frob(struct Command_Entry *cmd, struct scsi_cmnd *Cmnd,
 			    struct qlogicpti *qpti)
 {
 	memset(cmd, 0, sizeof(struct Command_Entry));
@@ -1027,7 +1034,7 @@
 }
 
 /* Do it to it baby. */
-static inline int load_cmd(Scsi_Cmnd *Cmnd, struct Command_Entry *cmd,
+static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
 			   struct qlogicpti *qpti, u_int in_ptr, u_int out_ptr)
 {
 	struct dataseg *ds;
@@ -1038,7 +1045,7 @@
 		int sg_count;
 
 		sg = (struct scatterlist *) Cmnd->buffer;
-		sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, scsi_to_sbus_dma_dir(Cmnd->sc_data_direction));
+		sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, Cmnd->sc_data_direction);
 
 		ds = cmd->dataseg;
 		cmd->segment_cnt = sg_count;
@@ -1081,7 +1088,7 @@
 			sbus_map_single(qpti->sdev,
 					Cmnd->request_buffer,
 					Cmnd->request_bufflen,
-					scsi_to_sbus_dma_dir(Cmnd->sc_data_direction));
+					Cmnd->sc_data_direction);
 
 		cmd->dataseg[0].d_base = (u32) ((unsigned long)Cmnd->SCp.ptr);
 		cmd->dataseg[0].d_count = Cmnd->request_bufflen;
@@ -1115,11 +1122,11 @@
 /*
  * Until we scan the entire bus with inquiries, go throught this fella...
  */
-static void ourdone(Scsi_Cmnd *Cmnd)
+static void ourdone(struct scsi_cmnd *Cmnd)
 {
 	struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata;
 	int tgt = Cmnd->device->id;
-	void (*done) (Scsi_Cmnd *);
+	void (*done) (struct scsi_cmnd *);
 
 	/* This grot added by DaveM, blame him for ugliness.
 	 * The issue is that in the 2.3.x driver we use the
@@ -1127,7 +1134,7 @@
 	 * completion linked list at interrupt service time,
 	 * so we have to store the done function pointer elsewhere.
 	 */
-	done = (void (*)(Scsi_Cmnd *))
+	done = (void (*)(struct scsi_cmnd *))
 		(((unsigned long) Cmnd->SCp.Message)
 #ifdef __sparc_v9__
 		 | ((unsigned long) Cmnd->SCp.Status << 32UL)
@@ -1164,10 +1171,10 @@
 	done(Cmnd);
 }
 
-static int qlogicpti_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *));
+static int qlogicpti_queuecommand(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *));
 
-static int qlogicpti_queuecommand_slow(Scsi_Cmnd *Cmnd,
-				       void (*done)(Scsi_Cmnd *))
+static int qlogicpti_queuecommand_slow(struct scsi_cmnd *Cmnd,
+				       void (*done)(struct scsi_cmnd *))
 {
 	struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata;
 
@@ -1238,7 +1245,7 @@
  *
  * "This code must fly." -davem
  */
-static int qlogicpti_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *))
+static int qlogicpti_queuecommand(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *))
 {
 	struct Scsi_Host *host = Cmnd->device->host;
 	struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;
@@ -1351,9 +1358,9 @@
 	return (sts->scsi_status & STATUS_MASK) | (host_status << 16);
 }
 
-static Scsi_Cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
+static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
 {
-	Scsi_Cmnd *Cmnd, *done_queue = NULL;
+	struct scsi_cmnd *Cmnd, *done_queue = NULL;
 	struct Status_Entry *sts;
 	u_int in_ptr, out_ptr;
 
@@ -1412,12 +1419,12 @@
 			sbus_unmap_sg(qpti->sdev,
 				      (struct scatterlist *)Cmnd->buffer,
 				      Cmnd->use_sg,
-				      scsi_to_sbus_dma_dir(Cmnd->sc_data_direction));
+				      Cmnd->sc_data_direction);
 		} else {
 			sbus_unmap_single(qpti->sdev,
 					  (__u32)((unsigned long)Cmnd->SCp.ptr),
 					  Cmnd->request_bufflen,
-					  scsi_to_sbus_dma_dir(Cmnd->sc_data_direction));
+					  Cmnd->sc_data_direction);
 		}
 		qpti->cmd_count[Cmnd->device->id]--;
 		sbus_writew(out_ptr, qpti->qregs + MBOX5);
@@ -1433,16 +1440,16 @@
 {
 	struct qlogicpti *qpti = dev_id;
 	unsigned long flags;
-	Scsi_Cmnd *dq;
+	struct scsi_cmnd *dq;
 
 	spin_lock_irqsave(qpti->qhost->host_lock, flags);
 	dq = qlogicpti_intr_handler(qpti);
 
 	if (dq != NULL) {
 		do {
-			Scsi_Cmnd *next;
+			struct scsi_cmnd *next;
 
-			next = (Scsi_Cmnd *) dq->host_scribble;
+			next = (struct scsi_cmnd *) dq->host_scribble;
 			dq->scsi_done(dq);
 			dq = next;
 		} while (dq != NULL);
@@ -1452,7 +1459,7 @@
 	return IRQ_HANDLED;
 }
 
-static int qlogicpti_abort(Scsi_Cmnd *Cmnd)
+static int qlogicpti_abort(struct scsi_cmnd *Cmnd)
 {
 	u_short param[6];
 	struct Scsi_Host *host = Cmnd->device->host;
@@ -1489,7 +1496,7 @@
 	return return_status;
 }
 
-static int qlogicpti_reset(Scsi_Cmnd *Cmnd)
+static int qlogicpti_reset(struct scsi_cmnd *Cmnd)
 {
 	u_short param[6];
 	struct Scsi_Host *host = Cmnd->device->host;
@@ -1513,7 +1520,7 @@
 	return return_status;
 }
 
-static Scsi_Host_Template driver_template = {
+static struct scsi_host_template driver_template = {
 	.detect			= qlogicpti_detect,
 	.release		= qlogicpti_release,
 	.info			= qlogicpti_info,
diff -Nru a/drivers/scsi/qlogicpti.h b/drivers/scsi/qlogicpti.h
--- a/drivers/scsi/qlogicpti.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/scsi/qlogicpti.h	Tue Jun 15 22:20:37 2004
@@ -6,8 +6,6 @@
 #ifndef _QLOGICPTI_H
 #define _QLOGICPTI_H
 
-#include <linux/config.h>
-
 /* Qlogic/SBUS controller registers. */
 #define SBUS_CFG1	0x006UL
 #define SBUS_CTRL	0x008UL
@@ -332,6 +330,8 @@
 	char __opaque[QUEUE_ENTRY_LEN];
 };
 
+struct scsi_cmnd;
+
 /* Software state for the driver. */
 struct qlogicpti {
 	/* These are the hot elements in the cache, so they come first. */
@@ -352,7 +352,7 @@
 	 * Ex000 sparc64 machines with >4GB of ram we just keep track of the
 	 * scsi command pointers here.  This is essentially what Matt Jacob does. -DaveM
 	 */
-	Scsi_Cmnd                *cmd_slots[QLOGICPTI_REQ_QUEUE_LEN + 1];
+	struct scsi_cmnd         *cmd_slots[QLOGICPTI_REQ_QUEUE_LEN + 1];
 
 	/* The rest of the elements are unimportant for performance. */
 	struct qlogicpti         *next;
diff -Nru a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
--- a/drivers/scsi/sata_promise.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/sata_promise.c	Tue Jun 15 22:20:42 2004
@@ -1,6 +1,10 @@
 /*
  *  sata_promise.c - Promise SATA
  *
+ *  Maintained by:  Jeff Garzik <jgarzik@pobox.com>
+ *  		    Please ALWAYS copy linux-ide@vger.kernel.org
+ *		    on emails.
+ *
  *  Copyright 2003-2004 Red Hat, Inc.
  *
  *  The contents of this file are subject to the Open
@@ -30,19 +34,17 @@
 #include <linux/interrupt.h>
 #include <linux/sched.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 #include <asm/io.h>
+#include "sata_promise.h"
 
 #define DRV_NAME	"sata_promise"
-#define DRV_VERSION	"0.92"
+#define DRV_VERSION	"1.00"
 
 
 enum {
-	PDC_PRD_TBL		= 0x44,	/* Direct command DMA table addr */
-
 	PDC_PKT_SUBMIT		= 0x40, /* Command packet pointer addr */
-	PDC_HDMA_PKT_SUBMIT	= 0x100, /* Host DMA packet pointer addr */
 	PDC_INT_SEQMASK		= 0x40,	/* Mask of asserted SEQ INTs */
 	PDC_TBG_MODE		= 0x41,	/* TBG mode */
 	PDC_FLASH_CTL		= 0x44, /* Flash control register */
@@ -51,141 +53,39 @@
 	PDC_CTLSTAT		= 0x60,	/* IDE control and status (per port) */
 	PDC_SATA_PLUG_CSR	= 0x6C, /* SATA Plug control/status reg */
 	PDC_SLEW_CTL		= 0x470, /* slew rate control reg */
-	PDC_HDMA_CTLSTAT	= 0x12C, /* Host DMA control / status */
-
-	PDC_20621_SEQCTL	= 0x400,
-	PDC_20621_SEQMASK	= 0x480,
-	PDC_20621_GENERAL_CTL	= 0x484,
-	PDC_20621_PAGE_SIZE	= (32 * 1024),
-
-	/* chosen, not constant, values; we design our own DIMM mem map */
-	PDC_20621_DIMM_WINDOW	= 0x0C,	/* page# for 32K DIMM window */
-	PDC_20621_DIMM_BASE	= 0x00200000,
-	PDC_20621_DIMM_DATA	= (64 * 1024),
-	PDC_DIMM_DATA_STEP	= (256 * 1024),
-	PDC_DIMM_WINDOW_STEP	= (8 * 1024),
-	PDC_DIMM_HOST_PRD	= (6 * 1024),
-	PDC_DIMM_HOST_PKT	= (128 * 0),
-	PDC_DIMM_HPKT_PRD	= (128 * 1),
-	PDC_DIMM_ATA_PKT	= (128 * 2),
-	PDC_DIMM_APKT_PRD	= (128 * 3),
-	PDC_DIMM_HEADER_SZ	= PDC_DIMM_APKT_PRD + 128,
-	PDC_PAGE_WINDOW		= 0x40,
-	PDC_PAGE_DATA		= PDC_PAGE_WINDOW +
-				  (PDC_20621_DIMM_DATA / PDC_20621_PAGE_SIZE),
-	PDC_PAGE_SET		= PDC_DIMM_DATA_STEP / PDC_20621_PAGE_SIZE,
 
-	PDC_CHIP0_OFS		= 0xC0000, /* offset of chip #0 */
-
-	PDC_20621_ERR_MASK	= (1<<19) | (1<<20) | (1<<21) | (1<<22) |
-				  (1<<23),
 	PDC_ERR_MASK		= (1<<19) | (1<<20) | (1<<21) | (1<<22) |
 				  (1<<8) | (1<<9) | (1<<10),
 
 	board_2037x		= 0,	/* FastTrak S150 TX2plus */
 	board_20319		= 1,	/* FastTrak S150 TX4 */
-	board_20621		= 2,	/* FastTrak S150 SX4 */
 
 	PDC_HAS_PATA		= (1 << 1), /* PDC20375 has PATA */
 
-	PDC_FLAG_20621		= (1 << 30), /* we have a 20621 */
 	PDC_RESET		= (1 << 11), /* HDMA reset */
-
-	PDC_MAX_HDMA		= 32,
-	PDC_HDMA_Q_MASK		= (PDC_MAX_HDMA - 1),
-
-	PDC_DIMM0_SPD_DEV_ADDRESS     = 0x50,
-	PDC_DIMM1_SPD_DEV_ADDRESS     = 0x51,
-	PDC_MAX_DIMM_MODULE           = 0x02,
-	PDC_I2C_CONTROL_OFFSET        = 0x48,
-	PDC_I2C_ADDR_DATA_OFFSET      = 0x4C,
-	PDC_DIMM0_CONTROL_OFFSET      = 0x80,
-	PDC_DIMM1_CONTROL_OFFSET      = 0x84,
-	PDC_SDRAM_CONTROL_OFFSET      = 0x88,
-	PDC_I2C_WRITE                 = 0x00000000,
-	PDC_I2C_READ                  = 0x00000040,	
-	PDC_I2C_START                 = 0x00000080,
-	PDC_I2C_MASK_INT              = 0x00000020,
-	PDC_I2C_COMPLETE              = 0x00010000,
-	PDC_I2C_NO_ACK                = 0x00100000,
-	PDC_DIMM_SPD_SUBADDRESS_START = 0x00,
-	PDC_DIMM_SPD_SUBADDRESS_END   = 0x7F,
-	PDC_DIMM_SPD_ROW_NUM          = 3,
-	PDC_DIMM_SPD_COLUMN_NUM       = 4,
-	PDC_DIMM_SPD_MODULE_ROW       = 5,
-	PDC_DIMM_SPD_TYPE             = 11,
-	PDC_DIMM_SPD_FRESH_RATE       = 12,         
-	PDC_DIMM_SPD_BANK_NUM         = 17,	
-	PDC_DIMM_SPD_CAS_LATENCY      = 18,
-	PDC_DIMM_SPD_ATTRIBUTE        = 21,    
-	PDC_DIMM_SPD_ROW_PRE_CHARGE   = 27,
-	PDC_DIMM_SPD_ROW_ACTIVE_DELAY = 28,      
-	PDC_DIMM_SPD_RAS_CAS_DELAY    = 29,
-	PDC_DIMM_SPD_ACTIVE_PRECHARGE = 30,
-	PDC_DIMM_SPD_SYSTEM_FREQ      = 126,
-	PDC_CTL_STATUS		      = 0x08,	
-	PDC_DIMM_WINDOW_CTLR	      = 0x0C,
-	PDC_TIME_CONTROL              = 0x3C,
-	PDC_TIME_PERIOD               = 0x40,
-	PDC_TIME_COUNTER              = 0x44,
-	PDC_GENERAL_CTLR	      = 0x484,
-	PCI_PLL_INIT                  = 0x8A531824,
-	PCI_X_TCOUNT                  = 0xEE1E5CFF
 };
 
 
 struct pdc_port_priv {
-	u8			dimm_buf[(ATA_PRD_SZ * ATA_MAX_PRD) + 512];
 	u8			*pkt;
 	dma_addr_t		pkt_dma;
 };
 
-struct pdc_host_priv {
-	void			*dimm_mmio;
-
-	unsigned int		doing_hdma;
-	unsigned int		hdma_prod;
-	unsigned int		hdma_cons;
-	struct {
-		struct ata_queued_cmd *qc;
-		unsigned int	seq;
-		unsigned long	pkt_ofs;
-	} hdma[32];
-};
-
-
 static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg);
 static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
+static void pdc_dma_setup(struct ata_queued_cmd *qc);
 static void pdc_dma_start(struct ata_queued_cmd *qc);
-static void pdc20621_dma_start(struct ata_queued_cmd *qc);
 static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
-static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
 static void pdc_eng_timeout(struct ata_port *ap);
-static void pdc_20621_phy_reset (struct ata_port *ap);
 static int pdc_port_start(struct ata_port *ap);
 static void pdc_port_stop(struct ata_port *ap);
 static void pdc_phy_reset(struct ata_port *ap);
 static void pdc_fill_sg(struct ata_queued_cmd *qc);
-static void pdc20621_fill_sg(struct ata_queued_cmd *qc);
 static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf);
 static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
-static void pdc20621_host_stop(struct ata_host_set *host_set);
 static inline void pdc_dma_complete (struct ata_port *ap,
                                      struct ata_queued_cmd *qc, int have_err);
-static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe);
-static int pdc20621_detect_dimm(struct ata_probe_ent *pe);
-static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, 
-				      u32 device, u32 subaddr, u32 *pdata);
-static int pdc20621_prog_dimm0(struct ata_probe_ent *pe);
-static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe);
-#ifdef ATA_VERBOSE_DEBUG
-static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, 
-				   void *psource, u32 offset, u32 size);
-#endif
-static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, 
-				 void *psource, u32 offset, u32 size);
-
 
 static Scsi_Host_Template pdc_sata_sht = {
 	.module			= THIS_MODULE,
@@ -212,6 +112,7 @@
 	.check_status		= ata_check_status_mmio,
 	.exec_command		= pdc_exec_command_mmio,
 	.phy_reset		= pdc_phy_reset,
+	.bmdma_setup            = pdc_dma_setup,
 	.bmdma_start            = pdc_dma_start,
 	.fill_sg		= pdc_fill_sg,
 	.eng_timeout		= pdc_eng_timeout,
@@ -222,22 +123,6 @@
 	.port_stop		= pdc_port_stop,
 };
 
-static struct ata_port_operations pdc_20621_ops = {
-	.port_disable		= ata_port_disable,
-	.tf_load		= pdc_tf_load_mmio,
-	.tf_read		= ata_tf_read_mmio,
-	.check_status		= ata_check_status_mmio,
-	.exec_command		= pdc_exec_command_mmio,
-	.phy_reset		= pdc_20621_phy_reset,
-	.bmdma_start            = pdc20621_dma_start,
-	.fill_sg		= pdc20621_fill_sg,
-	.eng_timeout		= pdc_eng_timeout,
-	.irq_handler		= pdc20621_interrupt,
-	.port_start		= pdc_port_start,
-	.port_stop		= pdc_port_stop,
-	.host_stop		= pdc20621_host_stop,
-};
-
 static struct ata_port_info pdc_port_info[] = {
 	/* board_2037x */
 	{
@@ -258,18 +143,6 @@
 		.udma_mask	= 0x7f, /* udma0-6 ; FIXME */
 		.port_ops	= &pdc_sata_ops,
 	},
-
-	/* board_20621 */
-	{
-		.sht		= &pdc_sata_sht,
-		.host_flags	= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-				  ATA_FLAG_SRST | ATA_FLAG_MMIO |
-				  PDC_FLAG_20621,
-		.pio_mask	= 0x03, /* pio3-4 */
-		.udma_mask	= 0x7f, /* udma0-6 ; FIXME */
-		.port_ops	= &pdc_20621_ops,
-	},
-
 };
 
 static struct pci_device_id pdc_sata_pci_tbl[] = {
@@ -285,8 +158,6 @@
 	  board_20319 },
 	{ PCI_VENDOR_ID_PROMISE, 0x3319, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 	  board_20319 },
-	{ PCI_VENDOR_ID_PROMISE, 0x6622, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-	  board_20621 },
 	{ }	/* terminate list */
 };
 
@@ -299,15 +170,6 @@
 };
 
 
-static void pdc20621_host_stop(struct ata_host_set *host_set)
-{
-	struct pdc_host_priv *hpriv = host_set->private_data;
-	void *dimm_mmio = hpriv->dimm_mmio;
-
-	iounmap(dimm_mmio);
-	kfree(hpriv);
-}
-
 static int pdc_port_start(struct ata_port *ap)
 {
 	struct pci_dev *pdev = ap->host_set->pdev;
@@ -355,14 +217,6 @@
 }
 
 
-static void pdc_20621_phy_reset (struct ata_port *ap)
-{
-	VPRINTK("ENTER\n");
-        ap->cbl = ATA_CBL_SATA;
-        ata_port_probe(ap);
-        ata_bus_reset(ap);
-}
-
 static void pdc_reset_port(struct ata_port *ap)
 {
 	void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT;
@@ -407,587 +261,6 @@
 	writel(val, (void *) ap->ioaddr.scr_addr + (sc_reg * 4));
 }
 
-enum pdc_packet_bits {
-	PDC_PKT_READ		= (1 << 2),
-	PDC_PKT_NODATA		= (1 << 3),
-
-	PDC_PKT_SIZEMASK	= (1 << 7) | (1 << 6) | (1 << 5),
-	PDC_PKT_CLEAR_BSY	= (1 << 4),
-	PDC_PKT_WAIT_DRDY	= (1 << 3) | (1 << 4),
-	PDC_LAST_REG		= (1 << 3),
-
-	PDC_REG_DEVCTL		= (1 << 3) | (1 << 2) | (1 << 1),
-};
-
-static inline unsigned int pdc_pkt_header(struct ata_taskfile *tf,
-					  dma_addr_t sg_table,
-					  unsigned int devno, u8 *buf)
-{
-	u8 dev_reg;
-	u32 *buf32 = (u32 *) buf;
-
-	/* set control bits (byte 0), zero delay seq id (byte 3),
-	 * and seq id (byte 2)
-	 */
-	switch (tf->protocol) {
-	case ATA_PROT_DMA:
-		if (!(tf->flags & ATA_TFLAG_WRITE))
-			buf32[0] = cpu_to_le32(PDC_PKT_READ);
-		else
-			buf32[0] = 0;
-		break;
-
-	case ATA_PROT_NODATA:
-		buf32[0] = cpu_to_le32(PDC_PKT_NODATA);
-		break;
-
-	default:
-		BUG();
-		break;
-	}
-
-	buf32[1] = cpu_to_le32(sg_table);	/* S/G table addr */
-	buf32[2] = 0;				/* no next-packet */
-
-	if (devno == 0)
-		dev_reg = ATA_DEVICE_OBS;
-	else
-		dev_reg = ATA_DEVICE_OBS | ATA_DEV1;
-
-	/* select device */
-	buf[12] = (1 << 5) | PDC_PKT_CLEAR_BSY | ATA_REG_DEVICE;
-	buf[13] = dev_reg;
-
-	/* device control register */
-	buf[14] = (1 << 5) | PDC_REG_DEVCTL;
-	buf[15] = tf->ctl;
-
-	return 16; 	/* offset of next byte */
-}
-
-static inline unsigned int pdc_pkt_footer(struct ata_taskfile *tf, u8 *buf,
-				  unsigned int i)
-{
-	if (tf->flags & ATA_TFLAG_DEVICE) {
-		buf[i++] = (1 << 5) | ATA_REG_DEVICE;
-		buf[i++] = tf->device;
-	}
-
-	/* and finally the command itself; also includes end-of-pkt marker */
-	buf[i++] = (1 << 5) | PDC_LAST_REG | ATA_REG_CMD;
-	buf[i++] = tf->command;
-
-	return i;
-}
-
-static inline unsigned int pdc_prep_lba28(struct ata_taskfile *tf, u8 *buf, unsigned int i)
-{
-	/* the "(1 << 5)" should be read "(count << 5)" */
-
-	/* ATA command block registers */
-	buf[i++] = (1 << 5) | ATA_REG_FEATURE;
-	buf[i++] = tf->feature;
-
-	buf[i++] = (1 << 5) | ATA_REG_NSECT;
-	buf[i++] = tf->nsect;
-
-	buf[i++] = (1 << 5) | ATA_REG_LBAL;
-	buf[i++] = tf->lbal;
-
-	buf[i++] = (1 << 5) | ATA_REG_LBAM;
-	buf[i++] = tf->lbam;
-
-	buf[i++] = (1 << 5) | ATA_REG_LBAH;
-	buf[i++] = tf->lbah;
-
-	return i;
-}
-
-static inline unsigned int pdc_prep_lba48(struct ata_taskfile *tf, u8 *buf, unsigned int i)
-{
-	/* the "(2 << 5)" should be read "(count << 5)" */
-
-	/* ATA command block registers */
-	buf[i++] = (2 << 5) | ATA_REG_FEATURE;
-	buf[i++] = tf->hob_feature;
-	buf[i++] = tf->feature;
-
-	buf[i++] = (2 << 5) | ATA_REG_NSECT;
-	buf[i++] = tf->hob_nsect;
-	buf[i++] = tf->nsect;
-
-	buf[i++] = (2 << 5) | ATA_REG_LBAL;
-	buf[i++] = tf->hob_lbal;
-	buf[i++] = tf->lbal;
-
-	buf[i++] = (2 << 5) | ATA_REG_LBAM;
-	buf[i++] = tf->hob_lbam;
-	buf[i++] = tf->lbam;
-
-	buf[i++] = (2 << 5) | ATA_REG_LBAH;
-	buf[i++] = tf->hob_lbah;
-	buf[i++] = tf->lbah;
-
-	return i;
-}
-
-static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf,
-				    	   unsigned int portno,
-					   unsigned int total_len)
-{
-	u32 addr;
-	unsigned int dw = PDC_DIMM_APKT_PRD >> 2;
-	u32 *buf32 = (u32 *) buf;
-
-	/* output ATA packet S/G table */
-	addr = PDC_20621_DIMM_BASE + PDC_20621_DIMM_DATA +
-	       (PDC_DIMM_DATA_STEP * portno);
-	VPRINTK("ATA sg addr 0x%x, %d\n", addr, addr);
-	buf32[dw] = cpu_to_le32(addr);
-	buf32[dw + 1] = cpu_to_le32(total_len | ATA_PRD_EOT);
-
-	VPRINTK("ATA PSG @ %x == (0x%x, 0x%x)\n",
-		PDC_20621_DIMM_BASE +
-		       (PDC_DIMM_WINDOW_STEP * portno) +
-		       PDC_DIMM_APKT_PRD,
-		buf32[dw], buf32[dw + 1]);
-}
-
-static inline void pdc20621_host_sg(struct ata_taskfile *tf, u8 *buf,
-				    	    unsigned int portno,
-					    unsigned int total_len)
-{
-	u32 addr;
-	unsigned int dw = PDC_DIMM_HPKT_PRD >> 2;
-	u32 *buf32 = (u32 *) buf;
-
-	/* output Host DMA packet S/G table */
-	addr = PDC_20621_DIMM_BASE + PDC_20621_DIMM_DATA +
-	       (PDC_DIMM_DATA_STEP * portno);
-
-	buf32[dw] = cpu_to_le32(addr);
-	buf32[dw + 1] = cpu_to_le32(total_len | ATA_PRD_EOT);
-
-	VPRINTK("HOST PSG @ %x == (0x%x, 0x%x)\n",
-		PDC_20621_DIMM_BASE +
-		       (PDC_DIMM_WINDOW_STEP * portno) +
-		       PDC_DIMM_HPKT_PRD,
-		buf32[dw], buf32[dw + 1]);
-}
-
-static inline unsigned int pdc20621_ata_pkt(struct ata_taskfile *tf,
-					    unsigned int devno, u8 *buf,
-					    unsigned int portno)
-{
-	unsigned int i, dw;
-	u32 *buf32 = (u32 *) buf;
-	u8 dev_reg;
-
-	unsigned int dimm_sg = PDC_20621_DIMM_BASE +
-			       (PDC_DIMM_WINDOW_STEP * portno) +
-			       PDC_DIMM_APKT_PRD;
-	VPRINTK("ENTER, dimm_sg == 0x%x, %d\n", dimm_sg, dimm_sg);
-
-	i = PDC_DIMM_ATA_PKT;
-
-	/*
-	 * Set up ATA packet
-	 */
-	if ((tf->protocol == ATA_PROT_DMA) && (!(tf->flags & ATA_TFLAG_WRITE)))
-		buf[i++] = PDC_PKT_READ;
-	else if (tf->protocol == ATA_PROT_NODATA)
-		buf[i++] = PDC_PKT_NODATA;
-	else
-		buf[i++] = 0;
-	buf[i++] = 0;			/* reserved */
-	buf[i++] = portno + 1;		/* seq. id */
-	buf[i++] = 0xff;		/* delay seq. id */
-
-	/* dimm dma S/G, and next-pkt */
-	dw = i >> 2;
-	buf32[dw] = cpu_to_le32(dimm_sg);
-	buf32[dw + 1] = 0;
-	i += 8;
-
-	if (devno == 0)
-		dev_reg = ATA_DEVICE_OBS;
-	else
-		dev_reg = ATA_DEVICE_OBS | ATA_DEV1;
-
-	/* select device */
-	buf[i++] = (1 << 5) | PDC_PKT_CLEAR_BSY | ATA_REG_DEVICE;
-	buf[i++] = dev_reg;
-
-	/* device control register */
-	buf[i++] = (1 << 5) | PDC_REG_DEVCTL;
-	buf[i++] = tf->ctl;
-
-	return i;
-}
-
-static inline void pdc20621_host_pkt(struct ata_taskfile *tf, u8 *buf,
-				     unsigned int portno)
-{
-	unsigned int dw;
-	u32 tmp, *buf32 = (u32 *) buf;
-
-	unsigned int host_sg = PDC_20621_DIMM_BASE +
-			       (PDC_DIMM_WINDOW_STEP * portno) +
-			       PDC_DIMM_HOST_PRD;
-	unsigned int dimm_sg = PDC_20621_DIMM_BASE +
-			       (PDC_DIMM_WINDOW_STEP * portno) +
-			       PDC_DIMM_HPKT_PRD;
-	VPRINTK("ENTER, dimm_sg == 0x%x, %d\n", dimm_sg, dimm_sg);
-	VPRINTK("host_sg == 0x%x, %d\n", host_sg, host_sg);
-
-	dw = PDC_DIMM_HOST_PKT >> 2;
-
-	/*
-	 * Set up Host DMA packet
-	 */
-	if ((tf->protocol == ATA_PROT_DMA) && (!(tf->flags & ATA_TFLAG_WRITE)))
-		tmp = PDC_PKT_READ;
-	else
-		tmp = 0;
-	tmp |= ((portno + 1 + 4) << 16);	/* seq. id */
-	tmp |= (0xff << 24);			/* delay seq. id */
-	buf32[dw + 0] = cpu_to_le32(tmp);
-	buf32[dw + 1] = cpu_to_le32(host_sg);
-	buf32[dw + 2] = cpu_to_le32(dimm_sg);
-	buf32[dw + 3] = 0;
-
-	VPRINTK("HOST PKT @ %x == (0x%x 0x%x 0x%x 0x%x)\n",
-		PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * portno) +
-			PDC_DIMM_HOST_PKT,
-		buf32[dw + 0],
-		buf32[dw + 1],
-		buf32[dw + 2],
-		buf32[dw + 3]);
-}
-
-static void pdc20621_fill_sg(struct ata_queued_cmd *qc)
-{
-	struct scatterlist *sg = qc->sg;
-	struct ata_port *ap = qc->ap;
-	struct pdc_port_priv *pp = ap->private_data;
-	void *mmio = ap->host_set->mmio_base;
-	struct pdc_host_priv *hpriv = ap->host_set->private_data;
-	void *dimm_mmio = hpriv->dimm_mmio;
-	unsigned int portno = ap->port_no;
-	unsigned int i, last, idx, total_len = 0, sgt_len;
-	u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ];
-
-	VPRINTK("ata%u: ENTER\n", ap->id);
-
-	/* hard-code chip #0 */
-	mmio += PDC_CHIP0_OFS;
-
-	/*
-	 * Build S/G table
-	 */
-	last = qc->n_elem;
-	idx = 0;
-	for (i = 0; i < last; i++) {
-		buf[idx++] = cpu_to_le32(sg_dma_address(&sg[i]));
-		buf[idx++] = cpu_to_le32(sg_dma_len(&sg[i]));
-		total_len += sg[i].length;
-	}
-	buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT);
-	sgt_len = idx * 4;
-
-	/*
-	 * Build ATA, host DMA packets
-	 */
-	pdc20621_host_sg(&qc->tf, &pp->dimm_buf[0], portno, total_len);
-	pdc20621_host_pkt(&qc->tf, &pp->dimm_buf[0], portno);
-
-	pdc20621_ata_sg(&qc->tf, &pp->dimm_buf[0], portno, total_len);
-	i = pdc20621_ata_pkt(&qc->tf, qc->dev->devno, &pp->dimm_buf[0], portno);
-
-	if (qc->tf.flags & ATA_TFLAG_LBA48)
-		i = pdc_prep_lba48(&qc->tf, &pp->dimm_buf[0], i);
-	else
-		i = pdc_prep_lba28(&qc->tf, &pp->dimm_buf[0], i);
-
-	pdc_pkt_footer(&qc->tf, &pp->dimm_buf[0], i);
-
-	/* copy three S/G tables and two packets to DIMM MMIO window */
-	memcpy_toio(dimm_mmio + (portno * PDC_DIMM_WINDOW_STEP),
-		    &pp->dimm_buf, PDC_DIMM_HEADER_SZ);
-	memcpy_toio(dimm_mmio + (portno * PDC_DIMM_WINDOW_STEP) +
-		    PDC_DIMM_HOST_PRD,
-		    &pp->dimm_buf[PDC_DIMM_HEADER_SZ], sgt_len);
-
-	/* force host FIFO dump */
-	writel(0x00000001, mmio + PDC_20621_GENERAL_CTL);
-
-	readl(dimm_mmio);	/* MMIO PCI posting flush */
-
-	VPRINTK("ata pkt buf ofs %u, prd size %u, mmio copied\n", i, sgt_len);
-}
-
-static void __pdc20621_push_hdma(struct ata_queued_cmd *qc,
-				 unsigned int seq,
-				 u32 pkt_ofs)
-{
-	struct ata_port *ap = qc->ap;
-	struct ata_host_set *host_set = ap->host_set;
-	void *mmio = host_set->mmio_base;
-
-	/* hard-code chip #0 */
-	mmio += PDC_CHIP0_OFS;
-
-	writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4));
-	readl(mmio + PDC_20621_SEQCTL + (seq * 4));	/* flush */
-
-	writel(pkt_ofs, mmio + PDC_HDMA_PKT_SUBMIT);
-	readl(mmio + PDC_HDMA_PKT_SUBMIT);	/* flush */
-}
-
-static void pdc20621_push_hdma(struct ata_queued_cmd *qc,
-				unsigned int seq,
-				u32 pkt_ofs)
-{
-	struct ata_port *ap = qc->ap;
-	struct pdc_host_priv *pp = ap->host_set->private_data;
-	unsigned int idx = pp->hdma_prod & PDC_HDMA_Q_MASK;
-
-	if (!pp->doing_hdma) {
-		__pdc20621_push_hdma(qc, seq, pkt_ofs);
-		pp->doing_hdma = 1;
-		return;
-	}
-
-	pp->hdma[idx].qc = qc;
-	pp->hdma[idx].seq = seq;
-	pp->hdma[idx].pkt_ofs = pkt_ofs;
-	pp->hdma_prod++;
-}
-
-static void pdc20621_pop_hdma(struct ata_queued_cmd *qc)
-{
-	struct ata_port *ap = qc->ap;
-	struct pdc_host_priv *pp = ap->host_set->private_data;
-	unsigned int idx = pp->hdma_cons & PDC_HDMA_Q_MASK;
-
-	/* if nothing on queue, we're done */
-	if (pp->hdma_prod == pp->hdma_cons) {
-		pp->doing_hdma = 0;
-		return;
-	}
-
-	__pdc20621_push_hdma(pp->hdma[idx].qc, pp->hdma[idx].seq,
-			     pp->hdma[idx].pkt_ofs);
-	pp->hdma_cons++;
-}
-
-#ifdef ATA_VERBOSE_DEBUG
-static void pdc20621_dump_hdma(struct ata_queued_cmd *qc)
-{
-	struct ata_port *ap = qc->ap;
-	unsigned int port_no = ap->port_no;
-	struct pdc_host_priv *hpriv = ap->host_set->private_data;
-	void *dimm_mmio = hpriv->dimm_mmio;
-
-	dimm_mmio += (port_no * PDC_DIMM_WINDOW_STEP);
-	dimm_mmio += PDC_DIMM_HOST_PKT;
-
-	printk(KERN_ERR "HDMA[0] == 0x%08X\n", readl(dimm_mmio));
-	printk(KERN_ERR "HDMA[1] == 0x%08X\n", readl(dimm_mmio + 4));
-	printk(KERN_ERR "HDMA[2] == 0x%08X\n", readl(dimm_mmio + 8));
-	printk(KERN_ERR "HDMA[3] == 0x%08X\n", readl(dimm_mmio + 12));
-}
-#else
-static inline void pdc20621_dump_hdma(struct ata_queued_cmd *qc) { }
-#endif /* ATA_VERBOSE_DEBUG */
-
-static void pdc20621_dma_start(struct ata_queued_cmd *qc)
-{
-	struct ata_port *ap = qc->ap;
-	struct ata_host_set *host_set = ap->host_set;
-	unsigned int port_no = ap->port_no;
-	void *mmio = host_set->mmio_base;
-	unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
-	u8 seq = (u8) (port_no + 1);
-	unsigned int doing_hdma = 0, port_ofs;
-
-	/* hard-code chip #0 */
-	mmio += PDC_CHIP0_OFS;
-
-	VPRINTK("ata%u: ENTER\n", ap->id);
-
-	port_ofs = PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * port_no);
-
-	/* if writing, we (1) DMA to DIMM, then (2) do ATA command */
-	if (rw) {
-		doing_hdma = 1;
-		seq += 4;
-	}
-
-	wmb();			/* flush PRD, pkt writes */
-
-	if (doing_hdma) {
-		pdc20621_dump_hdma(qc);
-		pdc20621_push_hdma(qc, seq, port_ofs + PDC_DIMM_HOST_PKT);
-		VPRINTK("queued ofs 0x%x (%u), seq %u\n",
-			port_ofs + PDC_DIMM_HOST_PKT,
-			port_ofs + PDC_DIMM_HOST_PKT,
-			seq);
-	} else {
-		writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4));
-		readl(mmio + PDC_20621_SEQCTL + (seq * 4));	/* flush */
-
-		writel(port_ofs + PDC_DIMM_ATA_PKT,
-		       (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
-		readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
-		VPRINTK("submitted ofs 0x%x (%u), seq %u\n",
-			port_ofs + PDC_DIMM_ATA_PKT,
-			port_ofs + PDC_DIMM_ATA_PKT,
-			seq);
-	}
-}
-
-static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
-                                          struct ata_queued_cmd *qc,
-					  unsigned int doing_hdma,
-					  void *mmio)
-{
-	unsigned int port_no = ap->port_no;
-	unsigned int port_ofs =
-		PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * port_no);
-	u8 status;
-	unsigned int handled = 0;
-
-	VPRINTK("ENTER\n");
-
-	if ((qc->tf.protocol == ATA_PROT_DMA) &&	/* read */
-	    (!(qc->tf.flags & ATA_TFLAG_WRITE))) {
-
-		/* step two - DMA from DIMM to host */
-		if (doing_hdma) {
-			VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id,
-				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
-			pdc_dma_complete(ap, qc, 0);
-			pdc20621_pop_hdma(qc);
-		}
-
-		/* step one - exec ATA command */
-		else {
-			u8 seq = (u8) (port_no + 1 + 4);
-			VPRINTK("ata%u: read ata, 0x%x 0x%x\n", ap->id,
-				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
-
-			/* submit hdma pkt */
-			pdc20621_dump_hdma(qc);
-			pdc20621_push_hdma(qc, seq,
-					   port_ofs + PDC_DIMM_HOST_PKT);
-		}
-		handled = 1;
-
-	} else if (qc->tf.protocol == ATA_PROT_DMA) {	/* write */
-
-		/* step one - DMA from host to DIMM */
-		if (doing_hdma) {
-			u8 seq = (u8) (port_no + 1);
-			VPRINTK("ata%u: write hdma, 0x%x 0x%x\n", ap->id,
-				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
-
-			/* submit ata pkt */
-			writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4));
-			readl(mmio + PDC_20621_SEQCTL + (seq * 4));
-			writel(port_ofs + PDC_DIMM_ATA_PKT,
-			       (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
-			readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
-		}
-
-		/* step two - execute ATA command */
-		else {
-			VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id,
-				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
-			pdc_dma_complete(ap, qc, 0);
-			pdc20621_pop_hdma(qc);
-		}
-		handled = 1;
-
-	/* command completion, but no data xfer */
-	} else if (qc->tf.protocol == ATA_PROT_NODATA) {
-
-		status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
-		DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
-		ata_qc_complete(qc, status, 0);
-		handled = 1;
-
-	} else {
-		ap->stats.idle_irq++;
-	}
-
-	return handled;
-}
-
-static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
-{
-	struct ata_host_set *host_set = dev_instance;
-	struct ata_port *ap;
-	u32 mask = 0;
-	unsigned int i, tmp, port_no;
-	unsigned int handled = 0;
-	void *mmio_base;
-
-	VPRINTK("ENTER\n");
-
-	if (!host_set || !host_set->mmio_base) {
-		VPRINTK("QUICK EXIT\n");
-		return IRQ_NONE;
-	}
-
-	mmio_base = host_set->mmio_base;
-
-	/* reading should also clear interrupts */
-	mmio_base += PDC_CHIP0_OFS;
-	mask = readl(mmio_base + PDC_20621_SEQMASK);
-	VPRINTK("mask == 0x%x\n", mask);
-
-	if (mask == 0xffffffff) {
-		VPRINTK("QUICK EXIT 2\n");
-		return IRQ_NONE;
-	}
-	mask &= 0xffff;		/* only 16 tags possible */
-	if (!mask) {
-		VPRINTK("QUICK EXIT 3\n");
-		return IRQ_NONE;
-	}
-
-        spin_lock(&host_set->lock);
-
-        for (i = 1; i < 9; i++) {
-		port_no = i - 1;
-		if (port_no > 3)
-			port_no -= 4;
-		if (port_no >= host_set->n_ports)
-			ap = NULL;
-		else
-			ap = host_set->ports[port_no];
-		tmp = mask & (1 << i);
-		VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp);
-		if (tmp && ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) {
-			struct ata_queued_cmd *qc;
-
-			qc = ata_qc_from_tag(ap, ap->active_tag);
-			if (qc && ((qc->flags & ATA_QCFLAG_POLL) == 0))
-				handled += pdc20621_host_intr(ap, qc, (i > 4),
-							      mmio_base);
-		}
-	}
-
-        spin_unlock(&host_set->lock);
-
-	VPRINTK("mask == 0x%x\n", mask);
-
-	VPRINTK("EXIT\n");
-
-	return IRQ_RETVAL(handled);
-}
-
 static void pdc_fill_sg(struct ata_queued_cmd *qc)
 {
 	struct pdc_port_priv *pp = qc->ap->private_data;
@@ -1014,8 +287,7 @@
 	u8 err_bit = have_err ? ATA_ERR : 0;
 
 	/* get drive status; clear intr; complete txn */
-	ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag),
-			ata_wait_idle(ap) | err_bit, 0);
+	ata_qc_complete(qc, ata_wait_idle(ap) | err_bit);
 }
 
 static void pdc_eng_timeout(struct ata_port *ap)
@@ -1043,8 +315,7 @@
 	switch (qc->tf.protocol) {
 	case ATA_PROT_DMA:
 		printk(KERN_ERR "ata%u: DMA timeout\n", ap->id);
-		ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag),
-			        ata_wait_idle(ap) | ATA_ERR, 0);
+		ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR);
 		break;
 
 	case ATA_PROT_NODATA:
@@ -1053,7 +324,7 @@
 		printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n",
 		       ap->id, qc->tf.command, drv_stat);
 
-		ata_qc_complete(qc, drv_stat, 1);
+		ata_qc_complete(qc, drv_stat);
 		break;
 
 	default:
@@ -1062,7 +333,7 @@
 		printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
 		       ap->id, qc->tf.command, drv_stat);
 
-		ata_qc_complete(qc, drv_stat, 1);
+		ata_qc_complete(qc, drv_stat);
 		break;
 	}
 
@@ -1095,7 +366,7 @@
 		DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
 		if (have_err)
 			status |= ATA_ERR;
-		ata_qc_complete(qc, status, 0);
+		ata_qc_complete(qc, status);
 		handled = 1;
 		break;
 
@@ -1148,7 +419,7 @@
 			struct ata_queued_cmd *qc;
 
 			qc = ata_qc_from_tag(ap, ap->active_tag);
-			if (qc && ((qc->flags & ATA_QCFLAG_POLL) == 0))
+			if (qc && (!(qc->tf.ctl & ATA_NIEN)))
 				handled += pdc_host_intr(ap, qc);
 		}
 	}
@@ -1160,6 +431,12 @@
 	return IRQ_RETVAL(handled);
 }
 
+static void pdc_dma_setup(struct ata_queued_cmd *qc)
+{
+	/* nothing for now.  later, we will call standard
+	 * code in libata-core for ATAPI here */
+}
+
 static void pdc_dma_start(struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
@@ -1180,14 +457,14 @@
 
 static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
 {
-	if (tf->protocol == ATA_PROT_PIO)
+	if (tf->protocol != ATA_PROT_DMA)
 		ata_tf_load_mmio(ap, tf);
 }
 
 
 static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
 {
-	if (tf->protocol == ATA_PROT_PIO)
+	if (tf->protocol != ATA_PROT_DMA)
 		ata_exec_command_mmio(ap, tf);
 }
 
@@ -1210,456 +487,11 @@
 }
 
 
-#ifdef ATA_VERBOSE_DEBUG
-static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource, 
-				   u32 offset, u32 size)
-{
-	u32 window_size;
-	u16 idx;
-	u8 page_mask;
-	long dist;
-	void *mmio = pe->mmio_base;
-	struct pdc_host_priv *hpriv = pe->private_data;
-	void *dimm_mmio = hpriv->dimm_mmio;
-
-	/* hard-code chip #0 */
-	mmio += PDC_CHIP0_OFS;
-
-	page_mask = 0x00;	
-   	window_size = 0x2000 * 4; /* 32K byte uchar size */  
-	idx = (u16) (offset / window_size); 
-
-	writel(0x01, mmio + PDC_GENERAL_CTLR);
-	readl(mmio + PDC_GENERAL_CTLR);
-	writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
-	readl(mmio + PDC_DIMM_WINDOW_CTLR);
-
-	offset -= (idx * window_size);
-	idx++;
-	dist = ((long) (window_size - (offset + size))) >= 0 ? size : 
-		(long) (window_size - offset);
-	memcpy_fromio((char *) psource, (char *) (dimm_mmio + offset / 4), 
-		      dist);
-
-	psource += dist;    
-	size -= dist;
-	for (; (long) size >= (long) window_size ;) {
-		writel(0x01, mmio + PDC_GENERAL_CTLR);
-		readl(mmio + PDC_GENERAL_CTLR);
-		writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
-		readl(mmio + PDC_DIMM_WINDOW_CTLR);
-		memcpy_fromio((char *) psource, (char *) (dimm_mmio), 
-			      window_size / 4);
-		psource += window_size;
-		size -= window_size;
-		idx ++;
-	}
-
-	if (size) {
-		writel(0x01, mmio + PDC_GENERAL_CTLR);
-		readl(mmio + PDC_GENERAL_CTLR);
-		writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
-		readl(mmio + PDC_DIMM_WINDOW_CTLR);
-		memcpy_fromio((char *) psource, (char *) (dimm_mmio), 
-			      size / 4);
-	}
-}
-#endif
-
-
-static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, 
-				 u32 offset, u32 size)
-{
-	u32 window_size;
-	u16 idx;
-	u8 page_mask;
-	long dist;
-	void *mmio = pe->mmio_base;
-	struct pdc_host_priv *hpriv = pe->private_data;
-	void *dimm_mmio = hpriv->dimm_mmio;
-
-	/* hard-code chip #0 */   
-	mmio += PDC_CHIP0_OFS;
-
-	page_mask = 0x00;	
-   	window_size = 0x2000 * 4;       /* 32K byte uchar size */  
-	idx = (u16) (offset / window_size);
-
-	writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
-	readl(mmio + PDC_DIMM_WINDOW_CTLR);
-	offset -= (idx * window_size); 
-	idx++;
-	dist = ((long) (window_size - (offset + size))) >= 0 ? size : 
-		(long) (window_size - offset);
-	memcpy_toio((char *) (dimm_mmio + offset / 4), (char *) psource, dist);
-	writel(0x01, mmio + PDC_GENERAL_CTLR);
-	readl(mmio + PDC_GENERAL_CTLR);
-
-	psource += dist;    
-	size -= dist;
-	for (; (long) size >= (long) window_size ;) {
-		writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
-		readl(mmio + PDC_DIMM_WINDOW_CTLR);
-		memcpy_toio((char *) (dimm_mmio), (char *) psource, 
-			    window_size / 4);
-		writel(0x01, mmio + PDC_GENERAL_CTLR);
-		readl(mmio + PDC_GENERAL_CTLR);
-		psource += window_size;
-		size -= window_size;
-		idx ++;
-	}
-    
-	if (size) {
-		writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
-		readl(mmio + PDC_DIMM_WINDOW_CTLR);
-		memcpy_toio((char *) (dimm_mmio), (char *) psource, size / 4);
-		writel(0x01, mmio + PDC_GENERAL_CTLR);
-		readl(mmio + PDC_GENERAL_CTLR);
-	}
-}
-
-
-static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device, 
-				      u32 subaddr, u32 *pdata)
-{
-	void *mmio = pe->mmio_base;
-	u32 i2creg  = 0;
-	u32 status;     
-	u32 count =0;
-
-	/* hard-code chip #0 */
-	mmio += PDC_CHIP0_OFS;
-
-	i2creg |= device << 24;
-	i2creg |= subaddr << 16;
-
-	/* Set the device and subaddress */
-	writel(i2creg, mmio + PDC_I2C_ADDR_DATA_OFFSET);
-	readl(mmio + PDC_I2C_ADDR_DATA_OFFSET);
-
-	/* Write Control to perform read operation, mask int */
-	writel(PDC_I2C_READ | PDC_I2C_START | PDC_I2C_MASK_INT, 
-	       mmio + PDC_I2C_CONTROL_OFFSET);
-
-	for (count = 0; count <= 1000; count ++) {
-		status = readl(mmio + PDC_I2C_CONTROL_OFFSET);
-		if (status & PDC_I2C_COMPLETE) {
-			status = readl(mmio + PDC_I2C_ADDR_DATA_OFFSET);
-			break;
-		} else if (count == 1000)
-			return 0;
-	}
-
-	*pdata = (status >> 8) & 0x000000ff;
-	return 1;           
-}
-
-
-static int pdc20621_detect_dimm(struct ata_probe_ent *pe)
-{
-	u32 data=0 ;
-  	if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 
-			     PDC_DIMM_SPD_SYSTEM_FREQ, &data)) {
-   		if (data == 100)
-			return 100;
-  	} else
-		return 0;
- 	
-   	if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) {
-		if(data <= 0x75) 
-			return 133;
-   	} else
-		return 0;
-   	
-   	return 0;
-}
-
-
-static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
-{
-	u32 spd0[50];
-	u32 data = 0;
-   	int size, i;
-   	u8 bdimmsize; 
-   	void *mmio = pe->mmio_base;
-	static const struct {
-		unsigned int reg;
-		unsigned int ofs;
-	} pdc_i2c_read_data [] = {
-		{ PDC_DIMM_SPD_TYPE, 11 },		
-		{ PDC_DIMM_SPD_FRESH_RATE, 12 },
-		{ PDC_DIMM_SPD_COLUMN_NUM, 4 }, 
-		{ PDC_DIMM_SPD_ATTRIBUTE, 21 },
-		{ PDC_DIMM_SPD_ROW_NUM, 3 },
-		{ PDC_DIMM_SPD_BANK_NUM, 17 },
-		{ PDC_DIMM_SPD_MODULE_ROW, 5 },
-		{ PDC_DIMM_SPD_ROW_PRE_CHARGE, 27 },
-		{ PDC_DIMM_SPD_ROW_ACTIVE_DELAY, 28 },
-		{ PDC_DIMM_SPD_RAS_CAS_DELAY, 29 },
-		{ PDC_DIMM_SPD_ACTIVE_PRECHARGE, 30 },
-		{ PDC_DIMM_SPD_CAS_LATENCY, 18 },       
-	};
-
-	/* hard-code chip #0 */
-	mmio += PDC_CHIP0_OFS;
-
-	for(i=0; i<ARRAY_SIZE(pdc_i2c_read_data); i++)
-		pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS,
-				  pdc_i2c_read_data[i].reg, 
-				  &spd0[pdc_i2c_read_data[i].ofs]);
-  
-   	data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4);
-   	data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) | 
-		((((spd0[27] + 9) / 10) - 1) << 8) ;
-   	data |= (((((spd0[29] > spd0[28]) 
-		    ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10; 
-   	data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12;
-   
-   	if (spd0[18] & 0x08) 
-		data |= ((0x03) << 14);
-   	else if (spd0[18] & 0x04)
-		data |= ((0x02) << 14);
-   	else if (spd0[18] & 0x01)
-		data |= ((0x01) << 14);
-   	else
-		data |= (0 << 14);
-
-  	/* 
-	   Calculate the size of bDIMMSize (power of 2) and
-	   merge the DIMM size by program start/end address.
-	*/
-
-   	bdimmsize = spd0[4] + (spd0[5] / 2) + spd0[3] + (spd0[17] / 2) + 3;
-   	size = (1 << bdimmsize) >> 20;	/* size = xxx(MB) */
-   	data |= (((size / 16) - 1) << 16);
-   	data |= (0 << 23);
-	data |= 8;
-   	writel(data, mmio + PDC_DIMM0_CONTROL_OFFSET); 
-	readl(mmio + PDC_DIMM0_CONTROL_OFFSET);
-   	return size;                          
-}
-
-
-static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe)
-{
-	u32 data, spd0;
-   	int error, i;
-   	void *mmio = pe->mmio_base;
-
-	/* hard-code chip #0 */
-   	mmio += PDC_CHIP0_OFS;
-
-   	/*
-	  Set To Default : DIMM Module Global Control Register (0x022259F1)
-	  DIMM Arbitration Disable (bit 20)
-	  DIMM Data/Control Output Driving Selection (bit12 - bit15)
-	  Refresh Enable (bit 17)
-	*/
-
-	data = 0x022259F1;   
-	writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET);
-	readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
-
-	/* Turn on for ECC */
-	pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 
-			  PDC_DIMM_SPD_TYPE, &spd0);
-	if (spd0 == 0x02) {
-		data |= (0x01 << 16);
-		writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET);
-		readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
-		printk(KERN_ERR "Local DIMM ECC Enabled\n");
-   	}
-
-   	/* DIMM Initialization Select/Enable (bit 18/19) */
-   	data &= (~(1<<18));
-   	data |= (1<<19);
-   	writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET);
-
-   	error = 1;                     
-   	for (i = 1; i <= 10; i++) {   /* polling ~5 secs */
-		data = readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
-		if (!(data & (1<<19))) {
-	   		error = 0;
-	   		break;     
-		}
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout((i * 100) * HZ / 1000);
-   	}
-   	return error;
-}
-	
-
-static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
-{
-	int speed, size, length; 
-	u32 addr,spd0,pci_status;
-	u32 tmp=0;
-	u32 time_period=0;
-	u32 tcount=0;
-	u32 ticks=0;
-	u32 clock=0;
-	u32 fparam=0;
-   	void *mmio = pe->mmio_base;
-
-	/* hard-code chip #0 */
-   	mmio += PDC_CHIP0_OFS;
-
-	/* Initialize PLL based upon PCI Bus Frequency */
-
-	/* Initialize Time Period Register */
-	writel(0xffffffff, mmio + PDC_TIME_PERIOD);
-	time_period = readl(mmio + PDC_TIME_PERIOD);
-	VPRINTK("Time Period Register (0x40): 0x%x\n", time_period);
-
-	/* Enable timer */
-	writel(0x00001a0, mmio + PDC_TIME_CONTROL);
-	readl(mmio + PDC_TIME_CONTROL);
-
-	/* Wait 3 seconds */
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(3 * HZ);
-
-	/* 
-	   When timer is enabled, counter is decreased every internal
-	   clock cycle.
-	*/
-
-	tcount = readl(mmio + PDC_TIME_COUNTER);
-	VPRINTK("Time Counter Register (0x44): 0x%x\n", tcount);
-
-	/* 
-	   If SX4 is on PCI-X bus, after 3 seconds, the timer counter
-	   register should be >= (0xffffffff - 3x10^8).
-	*/
-	if(tcount >= PCI_X_TCOUNT) {
-		ticks = (time_period - tcount);
-		VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks);
-	
-		clock = (ticks / 300000);
-		VPRINTK("10 * Internal clk = 0x%x (%d)\n", clock, clock);
-		
-		clock = (clock * 33);
-		VPRINTK("10 * Internal clk * 33 = 0x%x (%d)\n", clock, clock);
-
-		/* PLL F Param (bit 22:16) */
-		fparam = (1400000 / clock) - 2;
-		VPRINTK("PLL F Param: 0x%x (%d)\n", fparam, fparam);
-		
-		/* OD param = 0x2 (bit 31:30), R param = 0x5 (bit 29:25) */
-		pci_status = (0x8a001824 | (fparam << 16));
-	} else
-		pci_status = PCI_PLL_INIT;
-
-	/* Initialize PLL. */
-	VPRINTK("pci_status: 0x%x\n", pci_status);
-	writel(pci_status, mmio + PDC_CTL_STATUS);
-	readl(mmio + PDC_CTL_STATUS);
-
-	/* 
-	   Read SPD of DIMM by I2C interface,
-	   and program the DIMM Module Controller.
-	*/
- 	if (!(speed = pdc20621_detect_dimm(pe))) {
-		printk(KERN_ERR "Detect Local DIMM Fail\n");  
-		return 1;	/* DIMM error */
-   	}
-   	VPRINTK("Local DIMM Speed = %d\n", speed);
-
-   	/* Programming DIMM0 Module Control Register (index_CID0:80h) */ 
-   	size = pdc20621_prog_dimm0(pe);
-   	VPRINTK("Local DIMM Size = %dMB\n",size);
-
-   	/* Programming DIMM Module Global Control Register (index_CID0:88h) */ 
-   	if (pdc20621_prog_dimm_global(pe)) {
-		printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n");
-		return 1;
-   	}
-
-#ifdef ATA_VERBOSE_DEBUG
-	{
-		u8 test_parttern1[40] = {0x55,0xAA,'P','r','o','m','i','s','e',' ',
-  				'N','o','t',' ','Y','e','t',' ','D','e','f','i','n','e','d',' ',
- 				 '1','.','1','0',
-  				'9','8','0','3','1','6','1','2',0,0};
-		u8 test_parttern2[40] = {0};
-
-		pdc20621_put_to_dimm(pe, (void *) test_parttern2, 0x10040, 40);
-		pdc20621_put_to_dimm(pe, (void *) test_parttern2, 0x40, 40);
-
-		pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x10040, 40);
-		pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40);
-		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 
-		       test_parttern2[1], &(test_parttern2[2]));
-		pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x10040, 
-				       40);
-		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 
-		       test_parttern2[1], &(test_parttern2[2]));
-
-		pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x40, 40);
-		pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40);
-		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 
-		       test_parttern2[1], &(test_parttern2[2]));
-	}
-#endif
-
-	/* ECC initiliazation. */
-
-	pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 
-			  PDC_DIMM_SPD_TYPE, &spd0);
-	if (spd0 == 0x02) {
-		VPRINTK("Start ECC initialization\n");
-		addr = 0;
-		length = size * 1024 * 1024;
-		while (addr < length) {
-			pdc20621_put_to_dimm(pe, (void *) &tmp, addr, 
-					     sizeof(u32));
-			addr += sizeof(u32);
-		}
-		VPRINTK("Finish ECC initialization\n");
-	}
-	return 0;
-}
-
-
-static void pdc_20621_init(struct ata_probe_ent *pe)
-{
-	u32 tmp;
-	void *mmio = pe->mmio_base;
-
-	/* hard-code chip #0 */
-	mmio += PDC_CHIP0_OFS;
-
-	/*
-	 * Select page 0x40 for our 32k DIMM window
-	 */
-	tmp = readl(mmio + PDC_20621_DIMM_WINDOW) & 0xffff0000;
-	tmp |= PDC_PAGE_WINDOW;	/* page 40h; arbitrarily selected */
-	writel(tmp, mmio + PDC_20621_DIMM_WINDOW);
-
-	/*
-	 * Reset Host DMA
-	 */
-	tmp = readl(mmio + PDC_HDMA_CTLSTAT);
-	tmp |= PDC_RESET;
-	writel(tmp, mmio + PDC_HDMA_CTLSTAT);
-	readl(mmio + PDC_HDMA_CTLSTAT);		/* flush */
-
-	udelay(10);
-
-	tmp = readl(mmio + PDC_HDMA_CTLSTAT);
-	tmp &= ~PDC_RESET;
-	writel(tmp, mmio + PDC_HDMA_CTLSTAT);
-	readl(mmio + PDC_HDMA_CTLSTAT);		/* flush */
-}
-
 static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
 {
 	void *mmio = pe->mmio_base;
 	u32 tmp;
 
-	if (chip_id == board_20621)
-		BUG();
-
 	/*
 	 * Except for the hotplug stuff, this is voodoo from the
 	 * Promise driver.  Label this entire section
@@ -1687,7 +519,7 @@
 
 	readl(mmio + PDC_TBG_MODE);	/* flush */
 	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(10));
+	schedule_timeout(msecs_to_jiffies(10) + 1);
 
 	/* adjust slew rate control register. */
 	tmp = readl(mmio + PDC_SLEW_CTL);
@@ -1701,10 +533,8 @@
 	static int printed_version;
 	struct ata_probe_ent *probe_ent = NULL;
 	unsigned long base;
-	void *mmio_base, *dimm_mmio = NULL;
-	struct pdc_host_priv *hpriv = NULL;
+	void *mmio_base;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
-	unsigned int have_20621 = (board_idx == board_20621);
 	int rc;
 
 	if (!printed_version++)
@@ -1747,25 +577,6 @@
 	}
 	base = (unsigned long) mmio_base;
 
-	if (have_20621) {
-		hpriv = kmalloc(sizeof(*hpriv), GFP_KERNEL);
-		if (!hpriv) {
-			rc = -ENOMEM;
-			goto err_out_iounmap;
-		}
-		memset(hpriv, 0, sizeof(*hpriv));
-
-		dimm_mmio = ioremap(pci_resource_start(pdev, 4),
-				    pci_resource_len(pdev, 4));
-		if (!dimm_mmio) {
-			kfree(hpriv);
-			rc = -ENOMEM;
-			goto err_out_iounmap;
-		}
-
-		hpriv->dimm_mmio = dimm_mmio;
-	}
-
 	probe_ent->sht		= pdc_port_info[board_idx].sht;
 	probe_ent->host_flags	= pdc_port_info[board_idx].host_flags;
 	probe_ent->pio_mask	= pdc_port_info[board_idx].pio_mask;
@@ -1776,32 +587,22 @@
        	probe_ent->irq_flags = SA_SHIRQ;
 	probe_ent->mmio_base = mmio_base;
 
-	if (have_20621) {
-		probe_ent->private_data = hpriv;
-		base += PDC_CHIP0_OFS;
-	}
-
 	pdc_sata_setup_port(&probe_ent->port[0], base + 0x200);
 	pdc_sata_setup_port(&probe_ent->port[1], base + 0x280);
 
-	if (!have_20621) {
-		probe_ent->port[0].scr_addr = base + 0x400;
-		probe_ent->port[1].scr_addr = base + 0x500;
-	}
+	probe_ent->port[0].scr_addr = base + 0x400;
+	probe_ent->port[1].scr_addr = base + 0x500;
 
 	/* notice 4-port boards */
 	switch (board_idx) {
 	case board_20319:
-	case board_20621:
        		probe_ent->n_ports = 4;
 
 		pdc_sata_setup_port(&probe_ent->port[2], base + 0x300);
 		pdc_sata_setup_port(&probe_ent->port[3], base + 0x380);
 
-		if (!have_20621) {
-			probe_ent->port[2].scr_addr = base + 0x600;
-			probe_ent->port[3].scr_addr = base + 0x700;
-		}
+		probe_ent->port[2].scr_addr = base + 0x600;
+		probe_ent->port[3].scr_addr = base + 0x700;
 		break;
 	case board_2037x:
        		probe_ent->n_ports = 2;
@@ -1814,15 +615,7 @@
 	pci_set_master(pdev);
 
 	/* initialize adapter */
-	if (have_20621) {
-		/* initialize local dimm */
-		if (pdc20621_dimm_init(probe_ent)) {
-			rc = -ENOMEM;
-			goto err_out_iounmap_dimm;
-		}
-		pdc_20621_init(probe_ent);
-	} else
-		pdc_host_init(board_idx, probe_ent);
+	pdc_host_init(board_idx, probe_ent);
 
 	/* FIXME: check ata_device_add return value */
 	ata_device_add(probe_ent);
@@ -1830,11 +623,6 @@
 
 	return 0;
 
-err_out_iounmap_dimm:		/* only get to this label if 20621 */
-	kfree(hpriv);
-	iounmap(dimm_mmio);
-err_out_iounmap:
-	iounmap(mmio_base);
 err_out_free_ent:
 	kfree(probe_ent);
 err_out_regions:
@@ -1858,7 +646,7 @@
 
 
 MODULE_AUTHOR("Jeff Garzik");
-MODULE_DESCRIPTION("Promise SATA low-level driver");
+MODULE_DESCRIPTION("Promise SATA TX2/TX4 low-level driver");
 MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(pci, pdc_sata_pci_tbl);
 
diff -Nru a/drivers/scsi/sata_promise.h b/drivers/scsi/sata_promise.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/sata_promise.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,154 @@
+/*
+ *  sata_promise.h - Promise SATA common definitions and inline funcs
+ *
+ *  Copyright 2003-2004 Red Hat, Inc.
+ *
+ *  The contents of this file are subject to the Open
+ *  Software License version 1.1 that can be found at
+ *  http://www.opensource.org/licenses/osl-1.1.txt and is included herein
+ *  by reference.
+ *
+ *  Alternatively, the contents of this file may be used under the terms
+ *  of the GNU General Public License version 2 (the "GPL") as distributed
+ *  in the kernel source COPYING file, in which case the provisions of
+ *  the GPL are applicable instead of the above.  If you wish to allow
+ *  the use of your version of this file only under the terms of the
+ *  GPL and not to allow others to use your version of this file under
+ *  the OSL, indicate your decision by deleting the provisions above and
+ *  replace them with the notice and other provisions required by the GPL.
+ *  If you do not delete the provisions above, a recipient may use your
+ *  version of this file under either the OSL or the GPL.
+ *
+ */
+
+#ifndef __SATA_PROMISE_H__
+#define __SATA_PROMISE_H__
+
+#include <linux/ata.h>
+
+enum pdc_packet_bits {
+	PDC_PKT_READ		= (1 << 2),
+	PDC_PKT_NODATA		= (1 << 3),
+
+	PDC_PKT_SIZEMASK	= (1 << 7) | (1 << 6) | (1 << 5),
+	PDC_PKT_CLEAR_BSY	= (1 << 4),
+	PDC_PKT_WAIT_DRDY	= (1 << 3) | (1 << 4),
+	PDC_LAST_REG		= (1 << 3),
+
+	PDC_REG_DEVCTL		= (1 << 3) | (1 << 2) | (1 << 1),
+};
+
+static inline unsigned int pdc_pkt_header(struct ata_taskfile *tf,
+					  dma_addr_t sg_table,
+					  unsigned int devno, u8 *buf)
+{
+	u8 dev_reg;
+	u32 *buf32 = (u32 *) buf;
+
+	/* set control bits (byte 0), zero delay seq id (byte 3),
+	 * and seq id (byte 2)
+	 */
+	switch (tf->protocol) {
+	case ATA_PROT_DMA:
+		if (!(tf->flags & ATA_TFLAG_WRITE))
+			buf32[0] = cpu_to_le32(PDC_PKT_READ);
+		else
+			buf32[0] = 0;
+		break;
+
+	case ATA_PROT_NODATA:
+		buf32[0] = cpu_to_le32(PDC_PKT_NODATA);
+		break;
+
+	default:
+		BUG();
+		break;
+	}
+
+	buf32[1] = cpu_to_le32(sg_table);	/* S/G table addr */
+	buf32[2] = 0;				/* no next-packet */
+
+	if (devno == 0)
+		dev_reg = ATA_DEVICE_OBS;
+	else
+		dev_reg = ATA_DEVICE_OBS | ATA_DEV1;
+
+	/* select device */
+	buf[12] = (1 << 5) | PDC_PKT_CLEAR_BSY | ATA_REG_DEVICE;
+	buf[13] = dev_reg;
+
+	/* device control register */
+	buf[14] = (1 << 5) | PDC_REG_DEVCTL;
+	buf[15] = tf->ctl;
+
+	return 16; 	/* offset of next byte */
+}
+
+static inline unsigned int pdc_pkt_footer(struct ata_taskfile *tf, u8 *buf,
+				  unsigned int i)
+{
+	if (tf->flags & ATA_TFLAG_DEVICE) {
+		buf[i++] = (1 << 5) | ATA_REG_DEVICE;
+		buf[i++] = tf->device;
+	}
+
+	/* and finally the command itself; also includes end-of-pkt marker */
+	buf[i++] = (1 << 5) | PDC_LAST_REG | ATA_REG_CMD;
+	buf[i++] = tf->command;
+
+	return i;
+}
+
+static inline unsigned int pdc_prep_lba28(struct ata_taskfile *tf, u8 *buf, unsigned int i)
+{
+	/* the "(1 << 5)" should be read "(count << 5)" */
+
+	/* ATA command block registers */
+	buf[i++] = (1 << 5) | ATA_REG_FEATURE;
+	buf[i++] = tf->feature;
+
+	buf[i++] = (1 << 5) | ATA_REG_NSECT;
+	buf[i++] = tf->nsect;
+
+	buf[i++] = (1 << 5) | ATA_REG_LBAL;
+	buf[i++] = tf->lbal;
+
+	buf[i++] = (1 << 5) | ATA_REG_LBAM;
+	buf[i++] = tf->lbam;
+
+	buf[i++] = (1 << 5) | ATA_REG_LBAH;
+	buf[i++] = tf->lbah;
+
+	return i;
+}
+
+static inline unsigned int pdc_prep_lba48(struct ata_taskfile *tf, u8 *buf, unsigned int i)
+{
+	/* the "(2 << 5)" should be read "(count << 5)" */
+
+	/* ATA command block registers */
+	buf[i++] = (2 << 5) | ATA_REG_FEATURE;
+	buf[i++] = tf->hob_feature;
+	buf[i++] = tf->feature;
+
+	buf[i++] = (2 << 5) | ATA_REG_NSECT;
+	buf[i++] = tf->hob_nsect;
+	buf[i++] = tf->nsect;
+
+	buf[i++] = (2 << 5) | ATA_REG_LBAL;
+	buf[i++] = tf->hob_lbal;
+	buf[i++] = tf->lbal;
+
+	buf[i++] = (2 << 5) | ATA_REG_LBAM;
+	buf[i++] = tf->hob_lbam;
+	buf[i++] = tf->lbam;
+
+	buf[i++] = (2 << 5) | ATA_REG_LBAH;
+	buf[i++] = tf->hob_lbah;
+	buf[i++] = tf->lbah;
+
+	return i;
+}
+
+
+#endif /* __SATA_PROMISE_H__ */
diff -Nru a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
--- a/drivers/scsi/sata_sil.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/sata_sil.c	Tue Jun 15 22:20:36 2004
@@ -1,5 +1,9 @@
 /*
- *  ata_sil.c - Silicon Image SATA
+ *  sata_sil.c - Silicon Image SATA
+ *
+ *  Maintained by:  Jeff Garzik <jgarzik@pobox.com>
+ *  		    Please ALWAYS copy linux-ide@vger.kernel.org
+ *		    on emails.
  *
  *  Copyright 2003 Red Hat, Inc.
  *  Copyright 2003 Benjamin Herrenschmidt <benh@kernel.crashing.org>
@@ -30,7 +34,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME	"sata_sil"
@@ -125,6 +129,7 @@
 	.exec_command		= ata_exec_command_mmio,
 	.phy_reset		= sata_phy_reset,
 	.post_set_mode		= sil_post_set_mode,
+	.bmdma_setup            = ata_bmdma_setup_mmio,
 	.bmdma_start            = ata_bmdma_start_mmio,
 	.fill_sg		= ata_fill_sg,
 	.eng_timeout		= ata_eng_timeout,
@@ -262,7 +267,7 @@
  *
  *	20040111 - Seagate drives affected by the Mod15Write bug are blacklisted
  *	The Maxtor quirk is in the blacklist, but I'm keeping the original
- *	pessimistic fix for the following reasons:
+ *	pessimistic fix for the following reasons...
  *	- There seems to be less info on it, only one device gleaned off the
  *	Windows	driver, maybe only one is affected.  More info would be greatly
  *	appreciated.
@@ -271,8 +276,14 @@
 static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
 {
 	unsigned int n, quirks = 0;
-	const char *s = &dev->product[0];
-	unsigned int len = strnlen(s, sizeof(dev->product));
+	unsigned char model_num[40];
+	const char *s;
+	unsigned int len;
+
+	ata_dev_id_string(dev, model_num, ATA_ID_PROD_OFS,
+			  sizeof(model_num));
+	s = &model_num[0];
+	len = strnlen(s, sizeof(model_num));
 
 	/* ATAPI specifies that empty space is blank-filled; remove blanks */
 	while ((len > 0) && (s[len - 1] == ' '))
diff -Nru a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
--- a/drivers/scsi/sata_sis.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/sata_sis.c	Tue Jun 15 22:20:41 2004
@@ -1,6 +1,10 @@
 /*
  *  sata_sis.c - Silicon Integrated Systems SATA
  *
+ *  Maintained by:  Uwe Koziolek
+ *  		    Please ALWAYS copy linux-ide@vger.kernel.org
+ *		    on emails.
+ *
  *  Copyright 2004 Uwe Koziolek
  *
  *  The contents of this file are subject to the Open
@@ -30,7 +34,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME	"sata_sis"
@@ -56,7 +60,8 @@
 static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
 
 static struct pci_device_id sis_pci_tbl[] = {
-	{ PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
+	{ PCI_VENDOR_ID_SI, 0x180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
+	{ PCI_VENDOR_ID_SI, 0x181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
 	{ }	/* terminate list */
 };
 
@@ -93,6 +98,7 @@
 	.check_status		= ata_check_status_pio,
 	.exec_command		= ata_exec_command_pio,
 	.phy_reset		= sata_phy_reset,
+	.bmdma_setup            = ata_bmdma_setup_pio,
 	.bmdma_start            = ata_bmdma_start_pio,
 	.fill_sg		= ata_fill_sg,
 	.eng_timeout		= ata_eng_timeout,
diff -Nru a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
--- a/drivers/scsi/sata_svw.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/sata_svw.c	Tue Jun 15 22:20:41 2004
@@ -1,5 +1,10 @@
 /*
- *  ata_k2.c - Broadcom (Apple K2) SATA
+ *  sata_svw.c - ServerWorks / Apple K2 SATA
+ *
+ *  Maintained by: Benjamin Herrenschmidt <benh@kernel.crashing.org> and
+ *		   Jeff Garzik <jgarzik@pobox.com>
+ *  		    Please ALWAYS copy linux-ide@vger.kernel.org
+ *		    on emails.
  *
  *  Copyright 2003 Benjamin Herrenschmidt <benh@kernel.crashing.org>
  *
@@ -35,7 +40,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #ifdef CONFIG_PPC_OF
@@ -226,6 +231,7 @@
 	.check_status		= k2_stat_check_status,
 	.exec_command		= ata_exec_command_mmio,
 	.phy_reset		= sata_phy_reset,
+	.bmdma_setup            = ata_bmdma_setup_mmio,
 	.bmdma_start            = ata_bmdma_start_mmio,
 	.fill_sg		= ata_fill_sg,
 	.eng_timeout		= ata_eng_timeout,
diff -Nru a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/scsi/sata_sx4.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1446 @@
+/*
+ *  sata_sx4.c - Promise SATA
+ *
+ *  Maintained by:  Jeff Garzik <jgarzik@pobox.com>
+ *  		    Please ALWAYS copy linux-ide@vger.kernel.org
+ *		    on emails.
+ *
+ *  Copyright 2003-2004 Red Hat, Inc.
+ *
+ *  The contents of this file are subject to the Open
+ *  Software License version 1.1 that can be found at
+ *  http://www.opensource.org/licenses/osl-1.1.txt and is included herein
+ *  by reference.
+ *
+ *  Alternatively, the contents of this file may be used under the terms
+ *  of the GNU General Public License version 2 (the "GPL") as distributed
+ *  in the kernel source COPYING file, in which case the provisions of
+ *  the GPL are applicable instead of the above.  If you wish to allow
+ *  the use of your version of this file only under the terms of the
+ *  GPL and not to allow others to use your version of this file under
+ *  the OSL, indicate your decision by deleting the provisions above and
+ *  replace them with the notice and other provisions required by the GPL.
+ *  If you do not delete the provisions above, a recipient may use your
+ *  version of this file under either the OSL or the GPL.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+#include <linux/blkdev.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/sched.h>
+#include "scsi.h"
+#include <scsi/scsi_host.h>
+#include <linux/libata.h>
+#include <asm/io.h>
+#include "sata_promise.h"
+
+#define DRV_NAME	"sata_sx4"
+#define DRV_VERSION	"0.50"
+
+
+enum {
+	PDC_PRD_TBL		= 0x44,	/* Direct command DMA table addr */
+
+	PDC_PKT_SUBMIT		= 0x40, /* Command packet pointer addr */
+	PDC_HDMA_PKT_SUBMIT	= 0x100, /* Host DMA packet pointer addr */
+	PDC_INT_SEQMASK		= 0x40,	/* Mask of asserted SEQ INTs */
+	PDC_HDMA_CTLSTAT	= 0x12C, /* Host DMA control / status */
+
+	PDC_20621_SEQCTL	= 0x400,
+	PDC_20621_SEQMASK	= 0x480,
+	PDC_20621_GENERAL_CTL	= 0x484,
+	PDC_20621_PAGE_SIZE	= (32 * 1024),
+
+	/* chosen, not constant, values; we design our own DIMM mem map */
+	PDC_20621_DIMM_WINDOW	= 0x0C,	/* page# for 32K DIMM window */
+	PDC_20621_DIMM_BASE	= 0x00200000,
+	PDC_20621_DIMM_DATA	= (64 * 1024),
+	PDC_DIMM_DATA_STEP	= (256 * 1024),
+	PDC_DIMM_WINDOW_STEP	= (8 * 1024),
+	PDC_DIMM_HOST_PRD	= (6 * 1024),
+	PDC_DIMM_HOST_PKT	= (128 * 0),
+	PDC_DIMM_HPKT_PRD	= (128 * 1),
+	PDC_DIMM_ATA_PKT	= (128 * 2),
+	PDC_DIMM_APKT_PRD	= (128 * 3),
+	PDC_DIMM_HEADER_SZ	= PDC_DIMM_APKT_PRD + 128,
+	PDC_PAGE_WINDOW		= 0x40,
+	PDC_PAGE_DATA		= PDC_PAGE_WINDOW +
+				  (PDC_20621_DIMM_DATA / PDC_20621_PAGE_SIZE),
+	PDC_PAGE_SET		= PDC_DIMM_DATA_STEP / PDC_20621_PAGE_SIZE,
+
+	PDC_CHIP0_OFS		= 0xC0000, /* offset of chip #0 */
+
+	PDC_20621_ERR_MASK	= (1<<19) | (1<<20) | (1<<21) | (1<<22) |
+				  (1<<23),
+
+	board_20621		= 0,	/* FastTrak S150 SX4 */
+
+	PDC_RESET		= (1 << 11), /* HDMA reset */
+
+	PDC_MAX_HDMA		= 32,
+	PDC_HDMA_Q_MASK		= (PDC_MAX_HDMA - 1),
+
+	PDC_DIMM0_SPD_DEV_ADDRESS     = 0x50,
+	PDC_DIMM1_SPD_DEV_ADDRESS     = 0x51,
+	PDC_MAX_DIMM_MODULE           = 0x02,
+	PDC_I2C_CONTROL_OFFSET        = 0x48,
+	PDC_I2C_ADDR_DATA_OFFSET      = 0x4C,
+	PDC_DIMM0_CONTROL_OFFSET      = 0x80,
+	PDC_DIMM1_CONTROL_OFFSET      = 0x84,
+	PDC_SDRAM_CONTROL_OFFSET      = 0x88,
+	PDC_I2C_WRITE                 = 0x00000000,
+	PDC_I2C_READ                  = 0x00000040,	
+	PDC_I2C_START                 = 0x00000080,
+	PDC_I2C_MASK_INT              = 0x00000020,
+	PDC_I2C_COMPLETE              = 0x00010000,
+	PDC_I2C_NO_ACK                = 0x00100000,
+	PDC_DIMM_SPD_SUBADDRESS_START = 0x00,
+	PDC_DIMM_SPD_SUBADDRESS_END   = 0x7F,
+	PDC_DIMM_SPD_ROW_NUM          = 3,
+	PDC_DIMM_SPD_COLUMN_NUM       = 4,
+	PDC_DIMM_SPD_MODULE_ROW       = 5,
+	PDC_DIMM_SPD_TYPE             = 11,
+	PDC_DIMM_SPD_FRESH_RATE       = 12,         
+	PDC_DIMM_SPD_BANK_NUM         = 17,	
+	PDC_DIMM_SPD_CAS_LATENCY      = 18,
+	PDC_DIMM_SPD_ATTRIBUTE        = 21,    
+	PDC_DIMM_SPD_ROW_PRE_CHARGE   = 27,
+	PDC_DIMM_SPD_ROW_ACTIVE_DELAY = 28,      
+	PDC_DIMM_SPD_RAS_CAS_DELAY    = 29,
+	PDC_DIMM_SPD_ACTIVE_PRECHARGE = 30,
+	PDC_DIMM_SPD_SYSTEM_FREQ      = 126,
+	PDC_CTL_STATUS		      = 0x08,	
+	PDC_DIMM_WINDOW_CTLR	      = 0x0C,
+	PDC_TIME_CONTROL              = 0x3C,
+	PDC_TIME_PERIOD               = 0x40,
+	PDC_TIME_COUNTER              = 0x44,
+	PDC_GENERAL_CTLR	      = 0x484,
+	PCI_PLL_INIT                  = 0x8A531824,
+	PCI_X_TCOUNT                  = 0xEE1E5CFF
+};
+
+
+struct pdc_port_priv {
+	u8			dimm_buf[(ATA_PRD_SZ * ATA_MAX_PRD) + 512];
+	u8			*pkt;
+	dma_addr_t		pkt_dma;
+};
+
+struct pdc_host_priv {
+	void			*dimm_mmio;
+
+	unsigned int		doing_hdma;
+	unsigned int		hdma_prod;
+	unsigned int		hdma_cons;
+	struct {
+		struct ata_queued_cmd *qc;
+		unsigned int	seq;
+		unsigned long	pkt_ofs;
+	} hdma[32];
+};
+
+
+static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
+static void pdc20621_dma_setup(struct ata_queued_cmd *qc);
+static void pdc20621_dma_start(struct ata_queued_cmd *qc);
+static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
+static void pdc_eng_timeout(struct ata_port *ap);
+static void pdc_20621_phy_reset (struct ata_port *ap);
+static int pdc_port_start(struct ata_port *ap);
+static void pdc_port_stop(struct ata_port *ap);
+static void pdc20621_fill_sg(struct ata_queued_cmd *qc);
+static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf);
+static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
+static void pdc20621_host_stop(struct ata_host_set *host_set);
+static inline void pdc_dma_complete (struct ata_port *ap,
+                                     struct ata_queued_cmd *qc, int have_err);
+static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe);
+static int pdc20621_detect_dimm(struct ata_probe_ent *pe);
+static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, 
+				      u32 device, u32 subaddr, u32 *pdata);
+static int pdc20621_prog_dimm0(struct ata_probe_ent *pe);
+static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe);
+#ifdef ATA_VERBOSE_DEBUG
+static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, 
+				   void *psource, u32 offset, u32 size);
+#endif
+static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, 
+				 void *psource, u32 offset, u32 size);
+
+
+static Scsi_Host_Template pdc_sata_sht = {
+	.module			= THIS_MODULE,
+	.name			= DRV_NAME,
+	.queuecommand		= ata_scsi_queuecmd,
+	.eh_strategy_handler	= ata_scsi_error,
+	.can_queue		= ATA_DEF_QUEUE,
+	.this_id		= ATA_SHT_THIS_ID,
+	.sg_tablesize		= LIBATA_MAX_PRD,
+	.max_sectors		= ATA_MAX_SECTORS,
+	.cmd_per_lun		= ATA_SHT_CMD_PER_LUN,
+	.emulated		= ATA_SHT_EMULATED,
+	.use_clustering		= ATA_SHT_USE_CLUSTERING,
+	.proc_name		= DRV_NAME,
+	.dma_boundary		= ATA_DMA_BOUNDARY,
+	.slave_configure	= ata_scsi_slave_config,
+	.bios_param		= ata_std_bios_param,
+};
+
+static struct ata_port_operations pdc_20621_ops = {
+	.port_disable		= ata_port_disable,
+	.tf_load		= pdc_tf_load_mmio,
+	.tf_read		= ata_tf_read_mmio,
+	.check_status		= ata_check_status_mmio,
+	.exec_command		= pdc_exec_command_mmio,
+	.phy_reset		= pdc_20621_phy_reset,
+	.bmdma_setup            = pdc20621_dma_setup,
+	.bmdma_start            = pdc20621_dma_start,
+	.fill_sg		= pdc20621_fill_sg,
+	.eng_timeout		= pdc_eng_timeout,
+	.irq_handler		= pdc20621_interrupt,
+	.port_start		= pdc_port_start,
+	.port_stop		= pdc_port_stop,
+	.host_stop		= pdc20621_host_stop,
+};
+
+static struct ata_port_info pdc_port_info[] = {
+	/* board_20621 */
+	{
+		.sht		= &pdc_sata_sht,
+		.host_flags	= ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+				  ATA_FLAG_SRST | ATA_FLAG_MMIO,
+		.pio_mask	= 0x03, /* pio3-4 */
+		.udma_mask	= 0x7f, /* udma0-6 ; FIXME */
+		.port_ops	= &pdc_20621_ops,
+	},
+
+};
+
+static struct pci_device_id pdc_sata_pci_tbl[] = {
+	{ PCI_VENDOR_ID_PROMISE, 0x6622, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+	  board_20621 },
+	{ }	/* terminate list */
+};
+
+
+static struct pci_driver pdc_sata_pci_driver = {
+	.name			= DRV_NAME,
+	.id_table		= pdc_sata_pci_tbl,
+	.probe			= pdc_sata_init_one,
+	.remove			= ata_pci_remove_one,
+};
+
+
+static void pdc20621_host_stop(struct ata_host_set *host_set)
+{
+	struct pdc_host_priv *hpriv = host_set->private_data;
+	void *dimm_mmio = hpriv->dimm_mmio;
+
+	iounmap(dimm_mmio);
+	kfree(hpriv);
+}
+
+static int pdc_port_start(struct ata_port *ap)
+{
+	struct pci_dev *pdev = ap->host_set->pdev;
+	struct pdc_port_priv *pp;
+	int rc;
+
+	rc = ata_port_start(ap);
+	if (rc)
+		return rc;
+
+	pp = kmalloc(sizeof(*pp), GFP_KERNEL);
+	if (!pp) {
+		rc = -ENOMEM;
+		goto err_out;
+	}
+	memset(pp, 0, sizeof(*pp));
+
+	pp->pkt = pci_alloc_consistent(pdev, 128, &pp->pkt_dma);
+	if (!pp->pkt) {
+		rc = -ENOMEM;
+		goto err_out_kfree;
+	}
+
+	ap->private_data = pp;
+
+	return 0;
+
+err_out_kfree:
+	kfree(pp);
+err_out:
+	ata_port_stop(ap);
+	return rc;
+}
+
+
+static void pdc_port_stop(struct ata_port *ap)
+{
+	struct pci_dev *pdev = ap->host_set->pdev;
+	struct pdc_port_priv *pp = ap->private_data;
+
+	ap->private_data = NULL;
+	pci_free_consistent(pdev, 128, pp->pkt, pp->pkt_dma);
+	kfree(pp);
+	ata_port_stop(ap);
+}
+
+
+static void pdc_20621_phy_reset (struct ata_port *ap)
+{
+	VPRINTK("ENTER\n");
+        ap->cbl = ATA_CBL_SATA;
+        ata_port_probe(ap);
+        ata_bus_reset(ap);
+}
+
+static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf,
+				    	   unsigned int portno,
+					   unsigned int total_len)
+{
+	u32 addr;
+	unsigned int dw = PDC_DIMM_APKT_PRD >> 2;
+	u32 *buf32 = (u32 *) buf;
+
+	/* output ATA packet S/G table */
+	addr = PDC_20621_DIMM_BASE + PDC_20621_DIMM_DATA +
+	       (PDC_DIMM_DATA_STEP * portno);
+	VPRINTK("ATA sg addr 0x%x, %d\n", addr, addr);
+	buf32[dw] = cpu_to_le32(addr);
+	buf32[dw + 1] = cpu_to_le32(total_len | ATA_PRD_EOT);
+
+	VPRINTK("ATA PSG @ %x == (0x%x, 0x%x)\n",
+		PDC_20621_DIMM_BASE +
+		       (PDC_DIMM_WINDOW_STEP * portno) +
+		       PDC_DIMM_APKT_PRD,
+		buf32[dw], buf32[dw + 1]);
+}
+
+static inline void pdc20621_host_sg(struct ata_taskfile *tf, u8 *buf,
+				    	    unsigned int portno,
+					    unsigned int total_len)
+{
+	u32 addr;
+	unsigned int dw = PDC_DIMM_HPKT_PRD >> 2;
+	u32 *buf32 = (u32 *) buf;
+
+	/* output Host DMA packet S/G table */
+	addr = PDC_20621_DIMM_BASE + PDC_20621_DIMM_DATA +
+	       (PDC_DIMM_DATA_STEP * portno);
+
+	buf32[dw] = cpu_to_le32(addr);
+	buf32[dw + 1] = cpu_to_le32(total_len | ATA_PRD_EOT);
+
+	VPRINTK("HOST PSG @ %x == (0x%x, 0x%x)\n",
+		PDC_20621_DIMM_BASE +
+		       (PDC_DIMM_WINDOW_STEP * portno) +
+		       PDC_DIMM_HPKT_PRD,
+		buf32[dw], buf32[dw + 1]);
+}
+
+static inline unsigned int pdc20621_ata_pkt(struct ata_taskfile *tf,
+					    unsigned int devno, u8 *buf,
+					    unsigned int portno)
+{
+	unsigned int i, dw;
+	u32 *buf32 = (u32 *) buf;
+	u8 dev_reg;
+
+	unsigned int dimm_sg = PDC_20621_DIMM_BASE +
+			       (PDC_DIMM_WINDOW_STEP * portno) +
+			       PDC_DIMM_APKT_PRD;
+	VPRINTK("ENTER, dimm_sg == 0x%x, %d\n", dimm_sg, dimm_sg);
+
+	i = PDC_DIMM_ATA_PKT;
+
+	/*
+	 * Set up ATA packet
+	 */
+	if ((tf->protocol == ATA_PROT_DMA) && (!(tf->flags & ATA_TFLAG_WRITE)))
+		buf[i++] = PDC_PKT_READ;
+	else if (tf->protocol == ATA_PROT_NODATA)
+		buf[i++] = PDC_PKT_NODATA;
+	else
+		buf[i++] = 0;
+	buf[i++] = 0;			/* reserved */
+	buf[i++] = portno + 1;		/* seq. id */
+	buf[i++] = 0xff;		/* delay seq. id */
+
+	/* dimm dma S/G, and next-pkt */
+	dw = i >> 2;
+	buf32[dw] = cpu_to_le32(dimm_sg);
+	buf32[dw + 1] = 0;
+	i += 8;
+
+	if (devno == 0)
+		dev_reg = ATA_DEVICE_OBS;
+	else
+		dev_reg = ATA_DEVICE_OBS | ATA_DEV1;
+
+	/* select device */
+	buf[i++] = (1 << 5) | PDC_PKT_CLEAR_BSY | ATA_REG_DEVICE;
+	buf[i++] = dev_reg;
+
+	/* device control register */
+	buf[i++] = (1 << 5) | PDC_REG_DEVCTL;
+	buf[i++] = tf->ctl;
+
+	return i;
+}
+
+static inline void pdc20621_host_pkt(struct ata_taskfile *tf, u8 *buf,
+				     unsigned int portno)
+{
+	unsigned int dw;
+	u32 tmp, *buf32 = (u32 *) buf;
+
+	unsigned int host_sg = PDC_20621_DIMM_BASE +
+			       (PDC_DIMM_WINDOW_STEP * portno) +
+			       PDC_DIMM_HOST_PRD;
+	unsigned int dimm_sg = PDC_20621_DIMM_BASE +
+			       (PDC_DIMM_WINDOW_STEP * portno) +
+			       PDC_DIMM_HPKT_PRD;
+	VPRINTK("ENTER, dimm_sg == 0x%x, %d\n", dimm_sg, dimm_sg);
+	VPRINTK("host_sg == 0x%x, %d\n", host_sg, host_sg);
+
+	dw = PDC_DIMM_HOST_PKT >> 2;
+
+	/*
+	 * Set up Host DMA packet
+	 */
+	if ((tf->protocol == ATA_PROT_DMA) && (!(tf->flags & ATA_TFLAG_WRITE)))
+		tmp = PDC_PKT_READ;
+	else
+		tmp = 0;
+	tmp |= ((portno + 1 + 4) << 16);	/* seq. id */
+	tmp |= (0xff << 24);			/* delay seq. id */
+	buf32[dw + 0] = cpu_to_le32(tmp);
+	buf32[dw + 1] = cpu_to_le32(host_sg);
+	buf32[dw + 2] = cpu_to_le32(dimm_sg);
+	buf32[dw + 3] = 0;
+
+	VPRINTK("HOST PKT @ %x == (0x%x 0x%x 0x%x 0x%x)\n",
+		PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * portno) +
+			PDC_DIMM_HOST_PKT,
+		buf32[dw + 0],
+		buf32[dw + 1],
+		buf32[dw + 2],
+		buf32[dw + 3]);
+}
+
+static void pdc20621_fill_sg(struct ata_queued_cmd *qc)
+{
+	struct scatterlist *sg = qc->sg;
+	struct ata_port *ap = qc->ap;
+	struct pdc_port_priv *pp = ap->private_data;
+	void *mmio = ap->host_set->mmio_base;
+	struct pdc_host_priv *hpriv = ap->host_set->private_data;
+	void *dimm_mmio = hpriv->dimm_mmio;
+	unsigned int portno = ap->port_no;
+	unsigned int i, last, idx, total_len = 0, sgt_len;
+	u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ];
+
+	VPRINTK("ata%u: ENTER\n", ap->id);
+
+	/* hard-code chip #0 */
+	mmio += PDC_CHIP0_OFS;
+
+	/*
+	 * Build S/G table
+	 */
+	last = qc->n_elem;
+	idx = 0;
+	for (i = 0; i < last; i++) {
+		buf[idx++] = cpu_to_le32(sg_dma_address(&sg[i]));
+		buf[idx++] = cpu_to_le32(sg_dma_len(&sg[i]));
+		total_len += sg[i].length;
+	}
+	buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT);
+	sgt_len = idx * 4;
+
+	/*
+	 * Build ATA, host DMA packets
+	 */
+	pdc20621_host_sg(&qc->tf, &pp->dimm_buf[0], portno, total_len);
+	pdc20621_host_pkt(&qc->tf, &pp->dimm_buf[0], portno);
+
+	pdc20621_ata_sg(&qc->tf, &pp->dimm_buf[0], portno, total_len);
+	i = pdc20621_ata_pkt(&qc->tf, qc->dev->devno, &pp->dimm_buf[0], portno);
+
+	if (qc->tf.flags & ATA_TFLAG_LBA48)
+		i = pdc_prep_lba48(&qc->tf, &pp->dimm_buf[0], i);
+	else
+		i = pdc_prep_lba28(&qc->tf, &pp->dimm_buf[0], i);
+
+	pdc_pkt_footer(&qc->tf, &pp->dimm_buf[0], i);
+
+	/* copy three S/G tables and two packets to DIMM MMIO window */
+	memcpy_toio(dimm_mmio + (portno * PDC_DIMM_WINDOW_STEP),
+		    &pp->dimm_buf, PDC_DIMM_HEADER_SZ);
+	memcpy_toio(dimm_mmio + (portno * PDC_DIMM_WINDOW_STEP) +
+		    PDC_DIMM_HOST_PRD,
+		    &pp->dimm_buf[PDC_DIMM_HEADER_SZ], sgt_len);
+
+	/* force host FIFO dump */
+	writel(0x00000001, mmio + PDC_20621_GENERAL_CTL);
+
+	readl(dimm_mmio);	/* MMIO PCI posting flush */
+
+	VPRINTK("ata pkt buf ofs %u, prd size %u, mmio copied\n", i, sgt_len);
+}
+
+static void __pdc20621_push_hdma(struct ata_queued_cmd *qc,
+				 unsigned int seq,
+				 u32 pkt_ofs)
+{
+	struct ata_port *ap = qc->ap;
+	struct ata_host_set *host_set = ap->host_set;
+	void *mmio = host_set->mmio_base;
+
+	/* hard-code chip #0 */
+	mmio += PDC_CHIP0_OFS;
+
+	writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4));
+	readl(mmio + PDC_20621_SEQCTL + (seq * 4));	/* flush */
+
+	writel(pkt_ofs, mmio + PDC_HDMA_PKT_SUBMIT);
+	readl(mmio + PDC_HDMA_PKT_SUBMIT);	/* flush */
+}
+
+static void pdc20621_push_hdma(struct ata_queued_cmd *qc,
+				unsigned int seq,
+				u32 pkt_ofs)
+{
+	struct ata_port *ap = qc->ap;
+	struct pdc_host_priv *pp = ap->host_set->private_data;
+	unsigned int idx = pp->hdma_prod & PDC_HDMA_Q_MASK;
+
+	if (!pp->doing_hdma) {
+		__pdc20621_push_hdma(qc, seq, pkt_ofs);
+		pp->doing_hdma = 1;
+		return;
+	}
+
+	pp->hdma[idx].qc = qc;
+	pp->hdma[idx].seq = seq;
+	pp->hdma[idx].pkt_ofs = pkt_ofs;
+	pp->hdma_prod++;
+}
+
+static void pdc20621_pop_hdma(struct ata_queued_cmd *qc)
+{
+	struct ata_port *ap = qc->ap;
+	struct pdc_host_priv *pp = ap->host_set->private_data;
+	unsigned int idx = pp->hdma_cons & PDC_HDMA_Q_MASK;
+
+	/* if nothing on queue, we're done */
+	if (pp->hdma_prod == pp->hdma_cons) {
+		pp->doing_hdma = 0;
+		return;
+	}
+
+	__pdc20621_push_hdma(pp->hdma[idx].qc, pp->hdma[idx].seq,
+			     pp->hdma[idx].pkt_ofs);
+	pp->hdma_cons++;
+}
+
+#ifdef ATA_VERBOSE_DEBUG
+static void pdc20621_dump_hdma(struct ata_queued_cmd *qc)
+{
+	struct ata_port *ap = qc->ap;
+	unsigned int port_no = ap->port_no;
+	struct pdc_host_priv *hpriv = ap->host_set->private_data;
+	void *dimm_mmio = hpriv->dimm_mmio;
+
+	dimm_mmio += (port_no * PDC_DIMM_WINDOW_STEP);
+	dimm_mmio += PDC_DIMM_HOST_PKT;
+
+	printk(KERN_ERR "HDMA[0] == 0x%08X\n", readl(dimm_mmio));
+	printk(KERN_ERR "HDMA[1] == 0x%08X\n", readl(dimm_mmio + 4));
+	printk(KERN_ERR "HDMA[2] == 0x%08X\n", readl(dimm_mmio + 8));
+	printk(KERN_ERR "HDMA[3] == 0x%08X\n", readl(dimm_mmio + 12));
+}
+#else
+static inline void pdc20621_dump_hdma(struct ata_queued_cmd *qc) { }
+#endif /* ATA_VERBOSE_DEBUG */
+
+static void pdc20621_dma_setup(struct ata_queued_cmd *qc)
+{
+	/* nothing for now.  later, we will call standard
+	 * code in libata-core for ATAPI here */
+}
+
+static void pdc20621_dma_start(struct ata_queued_cmd *qc)
+{
+	struct ata_port *ap = qc->ap;
+	struct ata_host_set *host_set = ap->host_set;
+	unsigned int port_no = ap->port_no;
+	void *mmio = host_set->mmio_base;
+	unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
+	u8 seq = (u8) (port_no + 1);
+	unsigned int doing_hdma = 0, port_ofs;
+
+	/* hard-code chip #0 */
+	mmio += PDC_CHIP0_OFS;
+
+	VPRINTK("ata%u: ENTER\n", ap->id);
+
+	port_ofs = PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * port_no);
+
+	/* if writing, we (1) DMA to DIMM, then (2) do ATA command */
+	if (rw) {
+		doing_hdma = 1;
+		seq += 4;
+	}
+
+	wmb();			/* flush PRD, pkt writes */
+
+	if (doing_hdma) {
+		pdc20621_dump_hdma(qc);
+		pdc20621_push_hdma(qc, seq, port_ofs + PDC_DIMM_HOST_PKT);
+		VPRINTK("queued ofs 0x%x (%u), seq %u\n",
+			port_ofs + PDC_DIMM_HOST_PKT,
+			port_ofs + PDC_DIMM_HOST_PKT,
+			seq);
+	} else {
+		writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4));
+		readl(mmio + PDC_20621_SEQCTL + (seq * 4));	/* flush */
+
+		writel(port_ofs + PDC_DIMM_ATA_PKT,
+		       (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
+		readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
+		VPRINTK("submitted ofs 0x%x (%u), seq %u\n",
+			port_ofs + PDC_DIMM_ATA_PKT,
+			port_ofs + PDC_DIMM_ATA_PKT,
+			seq);
+	}
+}
+
+static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
+                                          struct ata_queued_cmd *qc,
+					  unsigned int doing_hdma,
+					  void *mmio)
+{
+	unsigned int port_no = ap->port_no;
+	unsigned int port_ofs =
+		PDC_20621_DIMM_BASE + (PDC_DIMM_WINDOW_STEP * port_no);
+	u8 status;
+	unsigned int handled = 0;
+
+	VPRINTK("ENTER\n");
+
+	if ((qc->tf.protocol == ATA_PROT_DMA) &&	/* read */
+	    (!(qc->tf.flags & ATA_TFLAG_WRITE))) {
+
+		/* step two - DMA from DIMM to host */
+		if (doing_hdma) {
+			VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id,
+				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
+			pdc_dma_complete(ap, qc, 0);
+			pdc20621_pop_hdma(qc);
+		}
+
+		/* step one - exec ATA command */
+		else {
+			u8 seq = (u8) (port_no + 1 + 4);
+			VPRINTK("ata%u: read ata, 0x%x 0x%x\n", ap->id,
+				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
+
+			/* submit hdma pkt */
+			pdc20621_dump_hdma(qc);
+			pdc20621_push_hdma(qc, seq,
+					   port_ofs + PDC_DIMM_HOST_PKT);
+		}
+		handled = 1;
+
+	} else if (qc->tf.protocol == ATA_PROT_DMA) {	/* write */
+
+		/* step one - DMA from host to DIMM */
+		if (doing_hdma) {
+			u8 seq = (u8) (port_no + 1);
+			VPRINTK("ata%u: write hdma, 0x%x 0x%x\n", ap->id,
+				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
+
+			/* submit ata pkt */
+			writel(0x00000001, mmio + PDC_20621_SEQCTL + (seq * 4));
+			readl(mmio + PDC_20621_SEQCTL + (seq * 4));
+			writel(port_ofs + PDC_DIMM_ATA_PKT,
+			       (void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
+			readl((void *) ap->ioaddr.cmd_addr + PDC_PKT_SUBMIT);
+		}
+
+		/* step two - execute ATA command */
+		else {
+			VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id,
+				readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT));
+			pdc_dma_complete(ap, qc, 0);
+			pdc20621_pop_hdma(qc);
+		}
+		handled = 1;
+
+	/* command completion, but no data xfer */
+	} else if (qc->tf.protocol == ATA_PROT_NODATA) {
+
+		status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
+		DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
+		ata_qc_complete(qc, status);
+		handled = 1;
+
+	} else {
+		ap->stats.idle_irq++;
+	}
+
+	return handled;
+}
+
+static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_regs *regs)
+{
+	struct ata_host_set *host_set = dev_instance;
+	struct ata_port *ap;
+	u32 mask = 0;
+	unsigned int i, tmp, port_no;
+	unsigned int handled = 0;
+	void *mmio_base;
+
+	VPRINTK("ENTER\n");
+
+	if (!host_set || !host_set->mmio_base) {
+		VPRINTK("QUICK EXIT\n");
+		return IRQ_NONE;
+	}
+
+	mmio_base = host_set->mmio_base;
+
+	/* reading should also clear interrupts */
+	mmio_base += PDC_CHIP0_OFS;
+	mask = readl(mmio_base + PDC_20621_SEQMASK);
+	VPRINTK("mask == 0x%x\n", mask);
+
+	if (mask == 0xffffffff) {
+		VPRINTK("QUICK EXIT 2\n");
+		return IRQ_NONE;
+	}
+	mask &= 0xffff;		/* only 16 tags possible */
+	if (!mask) {
+		VPRINTK("QUICK EXIT 3\n");
+		return IRQ_NONE;
+	}
+
+        spin_lock(&host_set->lock);
+
+        for (i = 1; i < 9; i++) {
+		port_no = i - 1;
+		if (port_no > 3)
+			port_no -= 4;
+		if (port_no >= host_set->n_ports)
+			ap = NULL;
+		else
+			ap = host_set->ports[port_no];
+		tmp = mask & (1 << i);
+		VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp);
+		if (tmp && ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) {
+			struct ata_queued_cmd *qc;
+
+			qc = ata_qc_from_tag(ap, ap->active_tag);
+			if (qc && (!(qc->tf.ctl & ATA_NIEN)))
+				handled += pdc20621_host_intr(ap, qc, (i > 4),
+							      mmio_base);
+		}
+	}
+
+        spin_unlock(&host_set->lock);
+
+	VPRINTK("mask == 0x%x\n", mask);
+
+	VPRINTK("EXIT\n");
+
+	return IRQ_RETVAL(handled);
+}
+
+static inline void pdc_dma_complete (struct ata_port *ap,
+                                     struct ata_queued_cmd *qc,
+				     int have_err)
+{
+	u8 err_bit = have_err ? ATA_ERR : 0;
+
+	/* get drive status; clear intr; complete txn */
+	ata_qc_complete(qc, ata_wait_idle(ap) | err_bit);
+}
+
+static void pdc_eng_timeout(struct ata_port *ap)
+{
+	u8 drv_stat;
+	struct ata_queued_cmd *qc;
+
+	DPRINTK("ENTER\n");
+
+	qc = ata_qc_from_tag(ap, ap->active_tag);
+	if (!qc) {
+		printk(KERN_ERR "ata%u: BUG: timeout without command\n",
+		       ap->id);
+		goto out;
+	}
+
+	/* hack alert!  We cannot use the supplied completion
+	 * function from inside the ->eh_strategy_handler() thread.
+	 * libata is the only user of ->eh_strategy_handler() in
+	 * any kernel, so the default scsi_done() assumes it is
+	 * not being called from the SCSI EH.
+	 */
+	qc->scsidone = scsi_finish_command;
+
+	switch (qc->tf.protocol) {
+	case ATA_PROT_DMA:
+		printk(KERN_ERR "ata%u: DMA timeout\n", ap->id);
+		ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR);
+		break;
+
+	case ATA_PROT_NODATA:
+		drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
+
+		printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n",
+		       ap->id, qc->tf.command, drv_stat);
+
+		ata_qc_complete(qc, drv_stat);
+		break;
+
+	default:
+		drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
+
+		printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
+		       ap->id, qc->tf.command, drv_stat);
+
+		ata_qc_complete(qc, drv_stat);
+		break;
+	}
+
+out:
+	DPRINTK("EXIT\n");
+}
+
+static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
+{
+	if (tf->protocol != ATA_PROT_DMA)
+		ata_tf_load_mmio(ap, tf);
+}
+
+
+static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
+{
+	if (tf->protocol != ATA_PROT_DMA)
+		ata_exec_command_mmio(ap, tf);
+}
+
+
+static void pdc_sata_setup_port(struct ata_ioports *port, unsigned long base)
+{
+	port->cmd_addr		= base;
+	port->data_addr		= base;
+	port->feature_addr	=
+	port->error_addr	= base + 0x4;
+	port->nsect_addr	= base + 0x8;
+	port->lbal_addr		= base + 0xc;
+	port->lbam_addr		= base + 0x10;
+	port->lbah_addr		= base + 0x14;
+	port->device_addr	= base + 0x18;
+	port->command_addr	=
+	port->status_addr	= base + 0x1c;
+	port->altstatus_addr	=
+	port->ctl_addr		= base + 0x38;
+}
+
+
+#ifdef ATA_VERBOSE_DEBUG
+static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource, 
+				   u32 offset, u32 size)
+{
+	u32 window_size;
+	u16 idx;
+	u8 page_mask;
+	long dist;
+	void *mmio = pe->mmio_base;
+	struct pdc_host_priv *hpriv = pe->private_data;
+	void *dimm_mmio = hpriv->dimm_mmio;
+
+	/* hard-code chip #0 */
+	mmio += PDC_CHIP0_OFS;
+
+	page_mask = 0x00;	
+   	window_size = 0x2000 * 4; /* 32K byte uchar size */  
+	idx = (u16) (offset / window_size); 
+
+	writel(0x01, mmio + PDC_GENERAL_CTLR);
+	readl(mmio + PDC_GENERAL_CTLR);
+	writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
+	readl(mmio + PDC_DIMM_WINDOW_CTLR);
+
+	offset -= (idx * window_size);
+	idx++;
+	dist = ((long) (window_size - (offset + size))) >= 0 ? size : 
+		(long) (window_size - offset);
+	memcpy_fromio((char *) psource, (char *) (dimm_mmio + offset / 4), 
+		      dist);
+
+	psource += dist;    
+	size -= dist;
+	for (; (long) size >= (long) window_size ;) {
+		writel(0x01, mmio + PDC_GENERAL_CTLR);
+		readl(mmio + PDC_GENERAL_CTLR);
+		writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
+		readl(mmio + PDC_DIMM_WINDOW_CTLR);
+		memcpy_fromio((char *) psource, (char *) (dimm_mmio), 
+			      window_size / 4);
+		psource += window_size;
+		size -= window_size;
+		idx ++;
+	}
+
+	if (size) {
+		writel(0x01, mmio + PDC_GENERAL_CTLR);
+		readl(mmio + PDC_GENERAL_CTLR);
+		writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
+		readl(mmio + PDC_DIMM_WINDOW_CTLR);
+		memcpy_fromio((char *) psource, (char *) (dimm_mmio), 
+			      size / 4);
+	}
+}
+#endif
+
+
+static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, 
+				 u32 offset, u32 size)
+{
+	u32 window_size;
+	u16 idx;
+	u8 page_mask;
+	long dist;
+	void *mmio = pe->mmio_base;
+	struct pdc_host_priv *hpriv = pe->private_data;
+	void *dimm_mmio = hpriv->dimm_mmio;
+
+	/* hard-code chip #0 */   
+	mmio += PDC_CHIP0_OFS;
+
+	page_mask = 0x00;	
+   	window_size = 0x2000 * 4;       /* 32K byte uchar size */  
+	idx = (u16) (offset / window_size);
+
+	writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
+	readl(mmio + PDC_DIMM_WINDOW_CTLR);
+	offset -= (idx * window_size); 
+	idx++;
+	dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size :
+		(long) (window_size - offset);
+	memcpy_toio((char *) (dimm_mmio + offset / 4), (char *) psource, dist);
+	writel(0x01, mmio + PDC_GENERAL_CTLR);
+	readl(mmio + PDC_GENERAL_CTLR);
+
+	psource += dist;    
+	size -= dist;
+	for (; (long) size >= (long) window_size ;) {
+		writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
+		readl(mmio + PDC_DIMM_WINDOW_CTLR);
+		memcpy_toio((char *) (dimm_mmio), (char *) psource, 
+			    window_size / 4);
+		writel(0x01, mmio + PDC_GENERAL_CTLR);
+		readl(mmio + PDC_GENERAL_CTLR);
+		psource += window_size;
+		size -= window_size;
+		idx ++;
+	}
+    
+	if (size) {
+		writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
+		readl(mmio + PDC_DIMM_WINDOW_CTLR);
+		memcpy_toio((char *) (dimm_mmio), (char *) psource, size / 4);
+		writel(0x01, mmio + PDC_GENERAL_CTLR);
+		readl(mmio + PDC_GENERAL_CTLR);
+	}
+}
+
+
+static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device, 
+				      u32 subaddr, u32 *pdata)
+{
+	void *mmio = pe->mmio_base;
+	u32 i2creg  = 0;
+	u32 status;     
+	u32 count =0;
+
+	/* hard-code chip #0 */
+	mmio += PDC_CHIP0_OFS;
+
+	i2creg |= device << 24;
+	i2creg |= subaddr << 16;
+
+	/* Set the device and subaddress */
+	writel(i2creg, mmio + PDC_I2C_ADDR_DATA_OFFSET);
+	readl(mmio + PDC_I2C_ADDR_DATA_OFFSET);
+
+	/* Write Control to perform read operation, mask int */
+	writel(PDC_I2C_READ | PDC_I2C_START | PDC_I2C_MASK_INT, 
+	       mmio + PDC_I2C_CONTROL_OFFSET);
+
+	for (count = 0; count <= 1000; count ++) {
+		status = readl(mmio + PDC_I2C_CONTROL_OFFSET);
+		if (status & PDC_I2C_COMPLETE) {
+			status = readl(mmio + PDC_I2C_ADDR_DATA_OFFSET);
+			break;
+		} else if (count == 1000)
+			return 0;
+	}
+
+	*pdata = (status >> 8) & 0x000000ff;
+	return 1;           
+}
+
+
+static int pdc20621_detect_dimm(struct ata_probe_ent *pe)
+{
+	u32 data=0 ;
+  	if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 
+			     PDC_DIMM_SPD_SYSTEM_FREQ, &data)) {
+   		if (data == 100)
+			return 100;
+  	} else
+		return 0;
+ 	
+   	if (pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 9, &data)) {
+		if(data <= 0x75) 
+			return 133;
+   	} else
+		return 0;
+   	
+   	return 0;
+}
+
+
+static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
+{
+	u32 spd0[50];
+	u32 data = 0;
+   	int size, i;
+   	u8 bdimmsize; 
+   	void *mmio = pe->mmio_base;
+	static const struct {
+		unsigned int reg;
+		unsigned int ofs;
+	} pdc_i2c_read_data [] = {
+		{ PDC_DIMM_SPD_TYPE, 11 },		
+		{ PDC_DIMM_SPD_FRESH_RATE, 12 },
+		{ PDC_DIMM_SPD_COLUMN_NUM, 4 }, 
+		{ PDC_DIMM_SPD_ATTRIBUTE, 21 },
+		{ PDC_DIMM_SPD_ROW_NUM, 3 },
+		{ PDC_DIMM_SPD_BANK_NUM, 17 },
+		{ PDC_DIMM_SPD_MODULE_ROW, 5 },
+		{ PDC_DIMM_SPD_ROW_PRE_CHARGE, 27 },
+		{ PDC_DIMM_SPD_ROW_ACTIVE_DELAY, 28 },
+		{ PDC_DIMM_SPD_RAS_CAS_DELAY, 29 },
+		{ PDC_DIMM_SPD_ACTIVE_PRECHARGE, 30 },
+		{ PDC_DIMM_SPD_CAS_LATENCY, 18 },       
+	};
+
+	/* hard-code chip #0 */
+	mmio += PDC_CHIP0_OFS;
+
+	for(i=0; i<ARRAY_SIZE(pdc_i2c_read_data); i++)
+		pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS,
+				  pdc_i2c_read_data[i].reg, 
+				  &spd0[pdc_i2c_read_data[i].ofs]);
+  
+   	data |= (spd0[4] - 8) | ((spd0[21] != 0) << 3) | ((spd0[3]-11) << 4);
+   	data |= ((spd0[17] / 4) << 6) | ((spd0[5] / 2) << 7) | 
+		((((spd0[27] + 9) / 10) - 1) << 8) ;
+   	data |= (((((spd0[29] > spd0[28]) 
+		    ? spd0[29] : spd0[28]) + 9) / 10) - 1) << 10; 
+   	data |= ((spd0[30] - spd0[29] + 9) / 10 - 2) << 12;
+   
+   	if (spd0[18] & 0x08) 
+		data |= ((0x03) << 14);
+   	else if (spd0[18] & 0x04)
+		data |= ((0x02) << 14);
+   	else if (spd0[18] & 0x01)
+		data |= ((0x01) << 14);
+   	else
+		data |= (0 << 14);
+
+  	/* 
+	   Calculate the size of bDIMMSize (power of 2) and
+	   merge the DIMM size by program start/end address.
+	*/
+
+   	bdimmsize = spd0[4] + (spd0[5] / 2) + spd0[3] + (spd0[17] / 2) + 3;
+   	size = (1 << bdimmsize) >> 20;	/* size = xxx(MB) */
+   	data |= (((size / 16) - 1) << 16);
+   	data |= (0 << 23);
+	data |= 8;
+   	writel(data, mmio + PDC_DIMM0_CONTROL_OFFSET); 
+	readl(mmio + PDC_DIMM0_CONTROL_OFFSET);
+   	return size;                          
+}
+
+
+static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe)
+{
+	u32 data, spd0;
+   	int error, i;
+   	void *mmio = pe->mmio_base;
+
+	/* hard-code chip #0 */
+   	mmio += PDC_CHIP0_OFS;
+
+   	/*
+	  Set To Default : DIMM Module Global Control Register (0x022259F1)
+	  DIMM Arbitration Disable (bit 20)
+	  DIMM Data/Control Output Driving Selection (bit12 - bit15)
+	  Refresh Enable (bit 17)
+	*/
+
+	data = 0x022259F1;   
+	writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET);
+	readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
+
+	/* Turn on for ECC */
+	pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 
+			  PDC_DIMM_SPD_TYPE, &spd0);
+	if (spd0 == 0x02) {
+		data |= (0x01 << 16);
+		writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET);
+		readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
+		printk(KERN_ERR "Local DIMM ECC Enabled\n");
+   	}
+
+   	/* DIMM Initialization Select/Enable (bit 18/19) */
+   	data &= (~(1<<18));
+   	data |= (1<<19);
+   	writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET);
+
+   	error = 1;                     
+   	for (i = 1; i <= 10; i++) {   /* polling ~5 secs */
+		data = readl(mmio + PDC_SDRAM_CONTROL_OFFSET);
+		if (!(data & (1<<19))) {
+	   		error = 0;
+	   		break;     
+		}
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout((i * 100) * HZ / 1000 + 1);
+   	}
+   	return error;
+}
+	
+
+static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
+{
+	int speed, size, length; 
+	u32 addr,spd0,pci_status;
+	u32 tmp=0;
+	u32 time_period=0;
+	u32 tcount=0;
+	u32 ticks=0;
+	u32 clock=0;
+	u32 fparam=0;
+   	void *mmio = pe->mmio_base;
+
+	/* hard-code chip #0 */
+   	mmio += PDC_CHIP0_OFS;
+
+	/* Initialize PLL based upon PCI Bus Frequency */
+
+	/* Initialize Time Period Register */
+	writel(0xffffffff, mmio + PDC_TIME_PERIOD);
+	time_period = readl(mmio + PDC_TIME_PERIOD);
+	VPRINTK("Time Period Register (0x40): 0x%x\n", time_period);
+
+	/* Enable timer */
+	writel(0x00001a0, mmio + PDC_TIME_CONTROL);
+	readl(mmio + PDC_TIME_CONTROL);
+
+	/* Wait 3 seconds */
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_timeout(3 * HZ);
+
+	/* 
+	   When timer is enabled, counter is decreased every internal
+	   clock cycle.
+	*/
+
+	tcount = readl(mmio + PDC_TIME_COUNTER);
+	VPRINTK("Time Counter Register (0x44): 0x%x\n", tcount);
+
+	/* 
+	   If SX4 is on PCI-X bus, after 3 seconds, the timer counter
+	   register should be >= (0xffffffff - 3x10^8).
+	*/
+	if(tcount >= PCI_X_TCOUNT) {
+		ticks = (time_period - tcount);
+		VPRINTK("Num counters 0x%x (%d)\n", ticks, ticks);
+	
+		clock = (ticks / 300000);
+		VPRINTK("10 * Internal clk = 0x%x (%d)\n", clock, clock);
+		
+		clock = (clock * 33);
+		VPRINTK("10 * Internal clk * 33 = 0x%x (%d)\n", clock, clock);
+
+		/* PLL F Param (bit 22:16) */
+		fparam = (1400000 / clock) - 2;
+		VPRINTK("PLL F Param: 0x%x (%d)\n", fparam, fparam);
+		
+		/* OD param = 0x2 (bit 31:30), R param = 0x5 (bit 29:25) */
+		pci_status = (0x8a001824 | (fparam << 16));
+	} else
+		pci_status = PCI_PLL_INIT;
+
+	/* Initialize PLL. */
+	VPRINTK("pci_status: 0x%x\n", pci_status);
+	writel(pci_status, mmio + PDC_CTL_STATUS);
+	readl(mmio + PDC_CTL_STATUS);
+
+	/* 
+	   Read SPD of DIMM by I2C interface,
+	   and program the DIMM Module Controller.
+	*/
+ 	if (!(speed = pdc20621_detect_dimm(pe))) {
+		printk(KERN_ERR "Detect Local DIMM Fail\n");  
+		return 1;	/* DIMM error */
+   	}
+   	VPRINTK("Local DIMM Speed = %d\n", speed);
+
+   	/* Programming DIMM0 Module Control Register (index_CID0:80h) */ 
+   	size = pdc20621_prog_dimm0(pe);
+   	VPRINTK("Local DIMM Size = %dMB\n",size);
+
+   	/* Programming DIMM Module Global Control Register (index_CID0:88h) */ 
+   	if (pdc20621_prog_dimm_global(pe)) {
+		printk(KERN_ERR "Programming DIMM Module Global Control Register Fail\n");
+		return 1;
+   	}
+
+#ifdef ATA_VERBOSE_DEBUG
+	{
+		u8 test_parttern1[40] = {0x55,0xAA,'P','r','o','m','i','s','e',' ',
+  				'N','o','t',' ','Y','e','t',' ','D','e','f','i','n','e','d',' ',
+ 				 '1','.','1','0',
+  				'9','8','0','3','1','6','1','2',0,0};
+		u8 test_parttern2[40] = {0};
+
+		pdc20621_put_to_dimm(pe, (void *) test_parttern2, 0x10040, 40);
+		pdc20621_put_to_dimm(pe, (void *) test_parttern2, 0x40, 40);
+
+		pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x10040, 40);
+		pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40);
+		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 
+		       test_parttern2[1], &(test_parttern2[2]));
+		pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x10040, 
+				       40);
+		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 
+		       test_parttern2[1], &(test_parttern2[2]));
+
+		pdc20621_put_to_dimm(pe, (void *) test_parttern1, 0x40, 40);
+		pdc20621_get_from_dimm(pe, (void *) test_parttern2, 0x40, 40);
+		printk(KERN_ERR "%x, %x, %s\n", test_parttern2[0], 
+		       test_parttern2[1], &(test_parttern2[2]));
+	}
+#endif
+
+	/* ECC initiliazation. */
+
+	pdc20621_i2c_read(pe, PDC_DIMM0_SPD_DEV_ADDRESS, 
+			  PDC_DIMM_SPD_TYPE, &spd0);
+	if (spd0 == 0x02) {
+		VPRINTK("Start ECC initialization\n");
+		addr = 0;
+		length = size * 1024 * 1024;
+		while (addr < length) {
+			pdc20621_put_to_dimm(pe, (void *) &tmp, addr, 
+					     sizeof(u32));
+			addr += sizeof(u32);
+		}
+		VPRINTK("Finish ECC initialization\n");
+	}
+	return 0;
+}
+
+
+static void pdc_20621_init(struct ata_probe_ent *pe)
+{
+	u32 tmp;
+	void *mmio = pe->mmio_base;
+
+	/* hard-code chip #0 */
+	mmio += PDC_CHIP0_OFS;
+
+	/*
+	 * Select page 0x40 for our 32k DIMM window
+	 */
+	tmp = readl(mmio + PDC_20621_DIMM_WINDOW) & 0xffff0000;
+	tmp |= PDC_PAGE_WINDOW;	/* page 40h; arbitrarily selected */
+	writel(tmp, mmio + PDC_20621_DIMM_WINDOW);
+
+	/*
+	 * Reset Host DMA
+	 */
+	tmp = readl(mmio + PDC_HDMA_CTLSTAT);
+	tmp |= PDC_RESET;
+	writel(tmp, mmio + PDC_HDMA_CTLSTAT);
+	readl(mmio + PDC_HDMA_CTLSTAT);		/* flush */
+
+	udelay(10);
+
+	tmp = readl(mmio + PDC_HDMA_CTLSTAT);
+	tmp &= ~PDC_RESET;
+	writel(tmp, mmio + PDC_HDMA_CTLSTAT);
+	readl(mmio + PDC_HDMA_CTLSTAT);		/* flush */
+}
+
+static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+	static int printed_version;
+	struct ata_probe_ent *probe_ent = NULL;
+	unsigned long base;
+	void *mmio_base, *dimm_mmio = NULL;
+	struct pdc_host_priv *hpriv = NULL;
+	unsigned int board_idx = (unsigned int) ent->driver_data;
+	int rc;
+
+	if (!printed_version++)
+		printk(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");
+
+	/*
+	 * If this driver happens to only be useful on Apple's K2, then
+	 * we should check that here as it has a normal Serverworks ID
+	 */
+	rc = pci_enable_device(pdev);
+	if (rc)
+		return rc;
+
+	rc = pci_request_regions(pdev, DRV_NAME);
+	if (rc)
+		goto err_out;
+
+	rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
+	if (rc)
+		goto err_out_regions;
+	rc = pci_set_consistent_dma_mask(pdev, ATA_DMA_MASK);
+	if (rc)
+		goto err_out_regions;
+
+	probe_ent = kmalloc(sizeof(*probe_ent), GFP_KERNEL);
+	if (probe_ent == NULL) {
+		rc = -ENOMEM;
+		goto err_out_regions;
+	}
+
+	memset(probe_ent, 0, sizeof(*probe_ent));
+	probe_ent->pdev = pdev;
+	INIT_LIST_HEAD(&probe_ent->node);
+
+	mmio_base = ioremap(pci_resource_start(pdev, 3),
+		            pci_resource_len(pdev, 3));
+	if (mmio_base == NULL) {
+		rc = -ENOMEM;
+		goto err_out_free_ent;
+	}
+	base = (unsigned long) mmio_base;
+
+	hpriv = kmalloc(sizeof(*hpriv), GFP_KERNEL);
+	if (!hpriv) {
+		rc = -ENOMEM;
+		goto err_out_iounmap;
+	}
+	memset(hpriv, 0, sizeof(*hpriv));
+
+	dimm_mmio = ioremap(pci_resource_start(pdev, 4),
+			    pci_resource_len(pdev, 4));
+	if (!dimm_mmio) {
+		kfree(hpriv);
+		rc = -ENOMEM;
+		goto err_out_iounmap;
+	}
+
+	hpriv->dimm_mmio = dimm_mmio;
+
+	probe_ent->sht		= pdc_port_info[board_idx].sht;
+	probe_ent->host_flags	= pdc_port_info[board_idx].host_flags;
+	probe_ent->pio_mask	= pdc_port_info[board_idx].pio_mask;
+	probe_ent->udma_mask	= pdc_port_info[board_idx].udma_mask;
+	probe_ent->port_ops	= pdc_port_info[board_idx].port_ops;
+
+       	probe_ent->irq = pdev->irq;
+       	probe_ent->irq_flags = SA_SHIRQ;
+	probe_ent->mmio_base = mmio_base;
+
+	probe_ent->private_data = hpriv;
+	base += PDC_CHIP0_OFS;
+
+	pdc_sata_setup_port(&probe_ent->port[0], base + 0x200);
+	pdc_sata_setup_port(&probe_ent->port[1], base + 0x280);
+
+	/* notice 4-port boards */
+	switch (board_idx) {
+	case board_20621:
+       		probe_ent->n_ports = 4;
+
+		pdc_sata_setup_port(&probe_ent->port[2], base + 0x300);
+		pdc_sata_setup_port(&probe_ent->port[3], base + 0x380);
+		break;
+	default:
+		BUG();
+		break;
+	}
+
+	pci_set_master(pdev);
+
+	/* initialize adapter */
+	/* initialize local dimm */
+	if (pdc20621_dimm_init(probe_ent)) {
+		rc = -ENOMEM;
+		goto err_out_iounmap_dimm;
+	}
+	pdc_20621_init(probe_ent);
+
+	/* FIXME: check ata_device_add return value */
+	ata_device_add(probe_ent);
+	kfree(probe_ent);
+
+	return 0;
+
+err_out_iounmap_dimm:		/* only get to this label if 20621 */
+	kfree(hpriv);
+	iounmap(dimm_mmio);
+err_out_iounmap:
+	iounmap(mmio_base);
+err_out_free_ent:
+	kfree(probe_ent);
+err_out_regions:
+	pci_release_regions(pdev);
+err_out:
+	pci_disable_device(pdev);
+	return rc;
+}
+
+
+static int __init pdc_sata_init(void)
+{
+	return pci_module_init(&pdc_sata_pci_driver);
+}
+
+
+static void __exit pdc_sata_exit(void)
+{
+	pci_unregister_driver(&pdc_sata_pci_driver);
+}
+
+
+MODULE_AUTHOR("Jeff Garzik");
+MODULE_DESCRIPTION("Promise SATA low-level driver");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(pci, pdc_sata_pci_tbl);
+
+module_init(pdc_sata_init);
+module_exit(pdc_sata_exit);
diff -Nru a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
--- a/drivers/scsi/sata_via.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/scsi/sata_via.c	Tue Jun 15 22:20:37 2004
@@ -1,6 +1,10 @@
 /*
    sata_via.c - VIA Serial ATA controllers
 
+   Maintained by:  Jeff Garzik <jgarzik@pobox.com>
+   		   Please ALWAYS copy linux-ide@vger.kernel.org
+ 		   on emails.
+
    Copyright 2003-2004 Red Hat, Inc.  All rights reserved.
    Copyright 2003-2004 Jeff Garzik
 
@@ -29,7 +33,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 #include <asm/io.h>
 
@@ -102,6 +106,7 @@
 
 	.phy_reset		= sata_phy_reset,
 
+	.bmdma_setup            = ata_bmdma_setup_pio,
 	.bmdma_start            = ata_bmdma_start_pio,
 	.fill_sg		= ata_fill_sg,
 	.eng_timeout		= ata_eng_timeout,
@@ -143,17 +148,6 @@
 	return addr + (port * 128);
 }
 
-/**
- *	svia_init_one -
- *	@pdev:
- *	@ent:
- *
- *	LOCKING:
- *
- *	RETURNS:
- *
- */
-
 static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	static int printed_version;
@@ -284,26 +278,10 @@
 	return rc;
 }
 
-/**
- *	svia_init -
- *
- *	LOCKING:
- *
- *	RETURNS:
- *
- */
-
 static int __init svia_init(void)
 {
 	return pci_module_init(&svia_pci_driver);
 }
-
-/**
- *	svia_exit -
- *
- *	LOCKING:
- *
- */
 
 static void __exit svia_exit(void)
 {
diff -Nru a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
--- a/drivers/scsi/sata_vsc.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/sata_vsc.c	Tue Jun 15 22:20:41 2004
@@ -1,6 +1,10 @@
 /*
  *  sata_vsc.c - Vitesse VSC7174 4 port DPA SATA
  *
+ *  Maintained by:  Jeremy Higdon @ SGI
+ * 		    Please ALWAYS copy linux-ide@vger.kernel.org
+ *		    on emails.
+ *
  *  Copyright 2004 SGI
  *
  *  Bits from Jeff Garzik, Copyright RedHat, Inc.
@@ -18,7 +22,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include <linux/libata.h>
 
 #define DRV_NAME	"sata_vsc"
@@ -171,7 +175,7 @@
 				struct ata_queued_cmd *qc;
 
 				qc = ata_qc_from_tag(ap, ap->active_tag);
-				if (qc && ((qc->flags & ATA_QCFLAG_POLL) == 0))
+				if (qc && (!(qc->tf.ctl & ATA_NIEN)))
 					handled += ata_host_intr(ap, qc);
 			}
 		}
@@ -209,6 +213,7 @@
 	.exec_command		= ata_exec_command_mmio,
 	.check_status		= ata_check_status_mmio,
 	.phy_reset		= sata_phy_reset,
+	.bmdma_setup            = ata_bmdma_setup_mmio,
 	.bmdma_start            = ata_bmdma_start_mmio,
 	.fill_sg		= ata_fill_sg,
 	.eng_timeout		= ata_eng_timeout,
diff -Nru a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/scsi.c	Tue Jun 15 22:20:40 2004
@@ -977,8 +977,6 @@
  */
 int scsi_device_get(struct scsi_device *sdev)
 {
-	if(!sdev)
-		return -ENXIO;
 	if (sdev->sdev_state == SDEV_DEL || sdev->sdev_state == SDEV_CANCEL)
 		return -ENXIO;
 	if (!get_device(&sdev->sdev_gendev))
diff -Nru a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
--- a/drivers/scsi/scsi_debug.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/scsi_debug.c	Tue Jun 15 22:20:41 2004
@@ -1461,7 +1461,7 @@
 DRIVER_ATTR(add_host, S_IRUGO | S_IWUSR, sdebug_add_host_show, 
 	    sdebug_add_host_store)
 
-static void do_create_driverfs_files()
+static void do_create_driverfs_files(void)
 {
 	driver_create_file(&sdebug_driverfs_driver, &driver_attr_delay);
 	driver_create_file(&sdebug_driverfs_driver, &driver_attr_opts);
@@ -1473,7 +1473,7 @@
 	driver_create_file(&sdebug_driverfs_driver, &driver_attr_add_host);
 }
 
-static void do_remove_driverfs_files()
+static void do_remove_driverfs_files(void)
 {
 	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_add_host);
 	driver_remove_file(&sdebug_driverfs_driver, &driver_attr_scsi_level);
@@ -1594,7 +1594,7 @@
         kfree(sdbg_host);
 }
 
-static int sdebug_add_adapter()
+static int sdebug_add_adapter(void)
 {
 	int k, devs_per_host;
         int error = 0;
@@ -1657,7 +1657,7 @@
         return error;
 }
 
-static void sdebug_remove_adapter()
+static void sdebug_remove_adapter(void)
 {
         struct sdebug_host_info * sdbg_host = NULL;
 
diff -Nru a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
--- a/drivers/scsi/scsi_devinfo.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/scsi/scsi_devinfo.c	Tue Jun 15 22:20:38 2004
@@ -433,7 +433,7 @@
  * To add a black/white list entry for vendor and model with an integer
  * value of flag to the scsi device info list.
  */
-static int proc_scsi_devinfo_write(struct file *file, const char *buf,
+static int proc_scsi_devinfo_write(struct file *file, const char __user *buf,
 				   unsigned long length, void *data)
 {
 	char *buffer;
diff -Nru a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
--- a/drivers/scsi/scsi_ioctl.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/scsi/scsi_ioctl.c	Tue Jun 15 22:21:03 2004
@@ -42,14 +42,14 @@
  * (int *) arg
  */
 
-static int ioctl_probe(struct Scsi_Host *host, void *buffer)
+static int ioctl_probe(struct Scsi_Host *host, void __user *buffer)
 {
 	unsigned int len, slen;
 	const char *string;
 	int temp = host->hostt->present;
 
 	if (temp && buffer) {
-		if (get_user(len, (unsigned int *) buffer))
+		if (get_user(len, (unsigned int __user *) buffer))
 			return -EFAULT;
 
 		if (host->hostt->info)
@@ -204,11 +204,11 @@
 #define OMAX_SB_LEN 16		/* Old sense buffer length */
 
 int scsi_ioctl_send_command(struct scsi_device *sdev,
-			    struct scsi_ioctl_command *sic)
+			    struct scsi_ioctl_command __user *sic)
 {
 	char *buf;
 	unsigned char cmd[MAX_COMMAND_SIZE];
-	char *cmd_in;
+	char __user *cmd_in;
 	struct scsi_request *sreq;
 	unsigned char opcode;
 	unsigned int inlen, outlen, cmdlen;
@@ -361,7 +361,7 @@
  *                  device)
  *          any copy_to_user() error on failure there
  */
-static int scsi_ioctl_get_pci(struct scsi_device *sdev, void *arg)
+static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg)
 {
 	struct device *dev = scsi_get_device(sdev->host);
 
@@ -376,7 +376,7 @@
  * not take a major/minor number as the dev field.  Rather, it takes
  * a pointer to a scsi_devices[] element, a structure. 
  */
-int scsi_ioctl(struct scsi_device *sdev, int cmd, void *arg)
+int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
 {
 	char scsi_cmd[MAX_COMMAND_SIZE];
 
@@ -402,19 +402,18 @@
 			 + ((sdev->lun & 0xff) << 8)
 			 + ((sdev->channel & 0xff) << 16)
 			 + ((sdev->host->host_no & 0xff) << 24),
-			 &((struct scsi_idlun *)arg)->dev_id);
+			 &((struct scsi_idlun __user *)arg)->dev_id);
 		__put_user(sdev->host->unique_id,
-			 &((struct scsi_idlun *)arg)->host_unique_id);
+			 &((struct scsi_idlun __user *)arg)->host_unique_id);
 		return 0;
 	case SCSI_IOCTL_GET_BUS_NUMBER:
-		return put_user(sdev->host->host_no, (int *)arg);
+		return put_user(sdev->host->host_no, (int __user *)arg);
 	case SCSI_IOCTL_PROBE_HOST:
 		return ioctl_probe(sdev->host, arg);
 	case SCSI_IOCTL_SEND_COMMAND:
 		if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
 			return -EACCES;
-		return scsi_ioctl_send_command(sdev,
-				(struct scsi_ioctl_command *)arg);
+		return scsi_ioctl_send_command(sdev, arg);
 	case SCSI_IOCTL_DOORLOCK:
 		return scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT);
 	case SCSI_IOCTL_DOORUNLOCK:
diff -Nru a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/scsi_lib.c	Tue Jun 15 22:20:40 2004
@@ -1610,7 +1610,9 @@
 
 	case SDEV_CANCEL:
 		switch (oldstate) {
+		case SDEV_CREATED:
 		case SDEV_RUNNING:
+		case SDEV_OFFLINE:
 			break;
 		default:
 			goto illegal;
@@ -1619,9 +1621,7 @@
 
 	case SDEV_DEL:
 		switch (oldstate) {
-		case SDEV_CREATED:
 		case SDEV_CANCEL:
-		case SDEV_OFFLINE:
 			break;
 		default:
 			goto illegal;
diff -Nru a/drivers/scsi/scsi_logging.h b/drivers/scsi/scsi_logging.h
--- a/drivers/scsi/scsi_logging.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/scsi_logging.h	Tue Jun 15 22:20:36 2004
@@ -46,7 +46,7 @@
 
 #define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD)		\
 {								\
-        if ((SCSI_LOG_LEVEL(SHIFT, BITS)) > (LEVEL))		\
+        if (unlikely((SCSI_LOG_LEVEL(SHIFT, BITS)) > (LEVEL)))	\
 		(CMD);						\
 }
 #else
diff -Nru a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
--- a/drivers/scsi/scsi_proc.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/scsi_proc.c	Tue Jun 15 22:20:36 2004
@@ -54,7 +54,7 @@
 	return n;
 }
 
-static int proc_scsi_write_proc(struct file *file, const char *buf,
+static int proc_scsi_write_proc(struct file *file, const char __user *buf,
                            unsigned long count, void *data)
 {
 	struct Scsi_Host *shost = data;
diff -Nru a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
--- a/drivers/scsi/scsi_scan.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/scsi/scsi_scan.c	Tue Jun 15 22:20:43 2004
@@ -80,7 +80,6 @@
 MODULE_PARM_DESC(max_luns,
 		 "last scsi LUN (should be between 1 and 2^32-1)");
 
-#ifdef CONFIG_SCSI_REPORT_LUNS
 /*
  * max_scsi_report_luns: the maximum number of LUNS that will be
  * returned from the REPORT LUNS command. 8 times this value must
@@ -88,13 +87,19 @@
  * in practice, the maximum number of LUNs suppored by any device
  * is about 16k.
  */
-static unsigned int max_scsi_report_luns = 128;
+static unsigned int max_scsi_report_luns = 511;
 
 module_param_named(max_report_luns, max_scsi_report_luns, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(max_report_luns,
 		 "REPORT LUNS maximum number of LUNS received (should be"
 		 " between 1 and 16384)");
-#endif
+
+static unsigned int scsi_inq_timeout = SCSI_TIMEOUT/HZ+3;
+
+module_param_named(inq_timeout, scsi_inq_timeout, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(inq_timeout, 
+		 "Timeout (in seconds) waiting for devices to answer INQUIRY."
+		 " Default is 5. Some non-compliant devices need more.");
 
 /**
  * scsi_unlock_floptical - unlock device via a special MODE SENSE command
@@ -212,6 +217,11 @@
 	INIT_LIST_HEAD(&sdev->starved_entry);
 	spin_lock_init(&sdev->list_lock);
 
+
+	/* if the device needs this changing, it may do so in the
+	 * slave_configure function */
+	sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
+
 	/*
 	 * Some low level driver could use device->type
 	 */
@@ -330,6 +340,7 @@
 	struct scsi_device *sdev = sreq->sr_device;	/* a bit ugly */
 	unsigned char scsi_cmd[MAX_COMMAND_SIZE];
 	int possible_inq_resp_len;
+	int count = 0;
 
 	*bflags = 0;
  repeat_inquiry:
@@ -345,24 +356,29 @@
 
 	memset(inq_result, 0, 36);
 	scsi_wait_req(sreq, (void *) scsi_cmd, (void *) inq_result, 36,
-		      SCSI_TIMEOUT + 4 * HZ, 3);
+		      HZ/2 + HZ*scsi_inq_timeout, 3);
 
 	SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: 1st INQUIRY %s with"
 			" code 0x%x\n", sreq->sr_result ?
 			"failed" : "successful", sreq->sr_result));
+	++count;
 
 	if (sreq->sr_result) {
 		if ((driver_byte(sreq->sr_result) & DRIVER_SENSE) != 0 &&
 		    (sreq->sr_sense_buffer[2] & 0xf) == UNIT_ATTENTION &&
-		    sreq->sr_sense_buffer[12] == 0x28 &&
+		    (sreq->sr_sense_buffer[12] == 0x28 ||
+		     sreq->sr_sense_buffer[12] == 0x29) &&
 		    sreq->sr_sense_buffer[13] == 0) {
-			/* not-ready to ready transition - good */
+			/* not-ready to ready transition or power-on - good */
 			/* dpg: bogus? INQUIRY never returns UNIT_ATTENTION */
-		} else
-			/*
-			 * assume no peripheral if any other sort of error
-			 */
-			return;
+			/* Supposedly, but many buggy devices do so anyway */
+			if (count < 3)
+				goto repeat_inquiry;
+		}
+		/*
+		 * assume no peripheral if any other sort of error
+		 */
+		return;
 	}
 
 	/*
@@ -394,7 +410,7 @@
 		memset(inq_result, 0, possible_inq_resp_len);
 		scsi_wait_req(sreq, (void *) scsi_cmd,
 			      (void *) inq_result,
-			      possible_inq_resp_len, SCSI_TIMEOUT + 4 * HZ, 3);
+			      possible_inq_resp_len, (1+scsi_inq_timeout)*(HZ/2), 3);
 		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: 2nd INQUIRY"
 				" %s with code 0x%x\n", sreq->sr_result ?
 				"failed" : "successful", sreq->sr_result));
@@ -543,17 +559,12 @@
 	 * 011 the same. Stay compatible with previous code, and create a
 	 * Scsi_Device for a PQ of 1
 	 *
-	 * XXX Save the PQ field let the upper layers figure out if they
-	 * want to attach or not to this device, do not set online FALSE;
-	 * otherwise, offline devices still get an sd allocated, and they
-	 * use up an sd slot.
-	 */
-	if (((inq_result[0] >> 5) & 7) == 1) {
-		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: peripheral"
-				" qualifier of 1, device offlined\n"));
-		scsi_device_set_state(sdev, SDEV_OFFLINE);
-	}
+	 * Don't set the device offline here; rather let the upper
+	 * level drivers eval the PQ to decide whether they should
+	 * attach. So remove ((inq_result[0] >> 5) & 7) == 1 check.
+	 */ 
 
+	sdev->inq_periph_qual = (inq_result[0] >> 5) & 7;
 	sdev->removable = (0x80 & inq_result[1]) >> 7;
 	sdev->lockable = sdev->removable;
 	sdev->soft_reset = (inq_result[7] & 1) && ((inq_result[3] & 7) == 2);
@@ -627,10 +638,6 @@
 		spin_unlock_irqrestore(sdev->host->host_lock, flags);
 	}
 
-	/* if the device needs this changing, it may do so in the detect
-	 * function */
-	sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
-
 	sdev->use_10_for_rw = 1;
 
 	if (*bflags & BLIST_MS_SKIP_PAGE_08)
@@ -862,7 +869,6 @@
 			return;
 }
 
-#ifdef CONFIG_SCSI_REPORT_LUNS
 /**
  * scsilun_to_int: convert a scsi_lun to an int
  * @scsilun:	struct scsi_lun to be converted.
@@ -923,9 +929,14 @@
 	u8 *data;
 
 	/*
-	 * Only support SCSI-3 and up devices.
-	 */
-	if (sdev->scsi_level < SCSI_3)
+	 * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set.
+	 * Also allow SCSI-2 if BLIST_REPORTLUN2 is set and host adapter does
+	 * support more than 8 LUNs.
+	 */
+	if ((bflags & BLIST_NOREPORTLUN) || 
+	     sdev->scsi_level < SCSI_2 ||
+	    (sdev->scsi_level < SCSI_3 && 
+	     (!(bflags & BLIST_REPORTLUN2) || sdev->host->max_lun <= 8)) )
 		return 1;
 	if (bflags & BLIST_NOLUN)
 		return 0;
@@ -1089,9 +1100,6 @@
 	printk(ALLOC_FAILURE_MSG, __FUNCTION__);
 	return 0;
 }
-#else
-# define scsi_report_lun_scan(sdev, blags, rescan)	(1)
-#endif	/* CONFIG_SCSI_REPORT_LUNS */
 
 struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
 				    uint channel, uint id, uint lun)
diff -Nru a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
--- a/drivers/scsi/scsi_sysfs.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/scsi/scsi_sysfs.c	Tue Jun 15 22:20:37 2004
@@ -181,7 +181,8 @@
 /* all probing is done in the individual ->probe routines */
 static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
 {
-	return 1;
+	struct scsi_device *sdp = to_scsi_device(dev);
+	return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
 }
 
 struct bus_type scsi_bus_type = {
@@ -302,6 +303,26 @@
 sdev_rd_attr (rev, "%.4s\n");
 
 static ssize_t
+sdev_show_timeout (struct device *dev, char *buf)
+{
+	struct scsi_device *sdev;
+	sdev = to_scsi_device(dev);
+	return snprintf (buf, 20, "%d\n", sdev->timeout / HZ);
+}
+
+static ssize_t
+sdev_store_timeout (struct device *dev, const char *buf, size_t count)
+{
+	struct scsi_device *sdev;
+	int timeout;
+	sdev = to_scsi_device(dev);
+	sscanf (buf, "%d\n", &timeout);
+	sdev->timeout = timeout * HZ;
+	return count;
+}
+static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout)
+
+static ssize_t
 store_rescan_field (struct device *dev, const char *buf, size_t count) 
 {
 	scsi_rescan_device(dev);
@@ -367,6 +388,7 @@
 	&dev_attr_rescan,
 	&dev_attr_delete,
 	&dev_attr_state,
+	&dev_attr_timeout,
 	NULL
 };
 
diff -Nru a/drivers/scsi/scsiiom.c b/drivers/scsi/scsiiom.c
--- a/drivers/scsi/scsiiom.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/scsi/scsiiom.c	Tue Jun 15 22:20:36 2004
@@ -15,7 +15,7 @@
 };
 
 
-UCHAR
+static UCHAR
 dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB )
 {
     UCHAR cmd; UCHAR  disc_allowed, try_sync_nego;
@@ -227,7 +227,7 @@
 #if DMA_INT
     UCHAR  dstatus;
 #endif
-    DC390_AFLAGS DC390_IFLAGS; //DC390_DFLAGS
+    DC390_IFLAGS;
 
     pACB = (PACB)dev_id;
     for (pACB2 = dc390_pACB_start; (pACB2 && pACB2 != pACB); pACB2 = pACB2->pNextACB);
@@ -237,26 +237,21 @@
 	return IRQ_NONE;
     }
     
-    //DC390_LOCK_DRV;
-
     sstatus = DC390_read8 (Scsi_Status);
     if( !(sstatus & INTERRUPT) )
-	{ /*DC390_UNLOCK_DRV;*/ return IRQ_NONE; };
+	return IRQ_NONE;
 
     DEBUG1(printk (KERN_DEBUG "sstatus=%02x,", sstatus));
 
 #if DMA_INT
     DC390_LOCK_IO(pACB->pScsiHost);
-    DC390_LOCK_ACB;
     dstatus = dc390_dma_intr (pACB);
-    DC390_UNLOCK_ACB;
     DC390_UNLOCK_IO(pACB->pScsiHost);
 
     DEBUG1(printk (KERN_DEBUG "dstatus=%02x,", dstatus));
     if (! (dstatus & SCSI_INTERRUPT))
       {
 	DEBUG0(printk (KERN_WARNING "DC390 Int w/o SCSI actions (only DMA?)\n"));
-	//DC390_UNLOCK_DRV;
 	return IRQ_NONE;
       };
 #else
@@ -266,8 +261,6 @@
 #endif
 
     DC390_LOCK_IO(pACB->pScsiHost);
-    DC390_LOCK_ACB;
-    //DC390_UNLOCK_DRV_NI; /* Allow _other_ CPUs to process IRQ (useful for shared IRQs) */
 
     istate = DC390_read8 (Intern_State);
     istatus = DC390_read8 (INT_Status); /* This clears Scsi_Status, Intern_State and INT_Status ! */
@@ -339,14 +332,11 @@
     }
 
  unlock:
-    //DC390_LOCK_DRV_NI;
-    DC390_UNLOCK_ACB;
     DC390_UNLOCK_IO(pACB->pScsiHost);
-    //DC390_UNLOCK_DRV; /* Restore initial flags */
     return IRQ_HANDLED;
 }
 
-irqreturn_t do_DC390_Interrupt( int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t do_DC390_Interrupt( int irq, void *dev_id, struct pt_regs *regs)
 {
     irqreturn_t ret;
     DEBUG1(printk (KERN_INFO "DC390: Irq (%i) caught: ", irq));
@@ -356,7 +346,7 @@
     return ret;
 }
 
-void
+static void
 dc390_DataOut_0( PACB pACB, PSRB pSRB, PUCHAR psstatus)
 {
     UCHAR   sstatus;
@@ -410,7 +400,7 @@
     }	    
 }
 
-void
+static void
 dc390_DataIn_0( PACB pACB, PSRB pSRB, PUCHAR psstatus)
 {
     UCHAR   sstatus, residual, bval;
@@ -521,7 +511,7 @@
     {
 	    DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
 	    DC390_write8 (DMA_Cmd, READ_DIRECTION+DMA_IDLE_CMD); /* | DMA_INT */
-    }	    
+    }
 }
 
 static void
@@ -740,9 +730,9 @@
 	psgl = pSRB->pSegmentList;
 	//dc390_pci_sync(pSRB);
 
-	while (pSRB->TotalXferredLen + (ULONG) psgl->length < pSRB->Saved_Ptr)
+	while (pSRB->TotalXferredLen + (ULONG) sg_dma_len(psgl) < pSRB->Saved_Ptr)
 	{
-	    pSRB->TotalXferredLen += (ULONG) psgl->length;
+	    pSRB->TotalXferredLen += (ULONG) sg_dma_len(psgl);
 	    pSRB->SGIndex++;
 	    if( pSRB->SGIndex < pSRB->SGcount )
 	    {
@@ -762,7 +752,7 @@
     } else if(pcmd->request_buffer) {
 	//dc390_pci_sync(pSRB);
 
-	pSRB->Segmentx.length = pcmd->request_bufflen - pSRB->Saved_Ptr;
+	sg_dma_len(&pSRB->Segmentx) = pcmd->request_bufflen - pSRB->Saved_Ptr;
 	pSRB->SGcount = 1;
 	pSRB->pSegmentList = (PSGL) &pSRB->Segmentx;
     } else {
@@ -873,7 +863,7 @@
 }
 
 
-void
+static void
 dc390_DataIO_Comm( PACB pACB, PSRB pSRB, UCHAR ioDir)
 {
     PSGL   psgl;
@@ -885,6 +875,8 @@
 	if (pDCB) printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (%02i-%i)\n",
 			  pDCB->TargetID, pDCB->TargetLUN);
 	else printk (KERN_ERR "DC390: pSRB == pTmpSRB! (TagQ Error?) (DCB 0!)\n");
+
+	pSRB->pSRBDCB = pDCB;
 	dc390_EnableMsgOut_Abort (pACB, pSRB);
 	if (pDCB) pDCB->DCBFlag |= ABORT_DEV;
 	return;
@@ -1150,7 +1142,6 @@
 	    pSRB = psrb;
 	}
 	pDCB->pGoingSRB = 0;
-	dc390_Query_to_Waiting (pACB);
 	dc390_Waiting_process (pACB);
     }
     else
@@ -1466,7 +1457,7 @@
 		ptr2 = pSRB->pSegmentList;
 		for( i=pSRB->SGIndex; i < bval; i++)
 		{
-		    swlval += ptr2->length;
+		    swlval += sg_dma_len(ptr2);
 		    ptr2++;
 		}
 		REMOVABLEDEBUG(printk(KERN_INFO "XferredLen=%08x,NotXferLen=%08x\n",\
@@ -1619,20 +1610,15 @@
 	  pACB->scan_devices = 0;
      };
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,30)
     pcmd->resid = pcmd->request_bufflen - pSRB->TotalXferredLen;
-#endif
 
     if (!DCB_removed) dc390_Going_remove (pDCB, pSRB);
     /* Add to free list */
     dc390_Free_insert (pACB, pSRB);
 
     DEBUG0(printk (KERN_DEBUG "DC390: SRBdone: done pid %li\n", pcmd->pid));
-    DC390_UNLOCK_ACB_NI;
     pcmd->scsi_done (pcmd);
-    DC390_LOCK_ACB_NI;
 
-    dc390_Query_to_Waiting (pACB);
     dc390_Waiting_process (pACB);
     return;
 }
@@ -1668,9 +1654,7 @@
 /*	    ReleaseSRB( pDCB, pSRB ); */
 
 	    DEBUG0(printk (KERN_DEBUG "DC390: DoingSRB_Done: done pid %li\n", pcmd->pid));
-	    DC390_UNLOCK_ACB_NI;
 	    pcmd->scsi_done( pcmd );
-	    DC390_LOCK_ACB_NI;
 #endif	
 	    psrb  = psrb2;
 	}
@@ -1679,7 +1663,6 @@
 	pdcb->TagMask = 0;
 	pdcb = pdcb->pNextDCB;
     } while( pdcb != pDCB );
-    dc390_Query_to_Waiting (pACB);
 }
 
 
diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c
--- a/drivers/scsi/sd.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/scsi/sd.c	Tue Jun 15 22:20:43 2004
@@ -179,7 +179,16 @@
 		goto out;
 	sdkp = scsi_disk(disk);
 	if (!kref_get(&sdkp->kref))
-		sdkp = NULL;
+		goto out_sdkp;
+	if (scsi_device_get(sdkp->device))
+		goto out_put;
+	up(&sd_ref_sem);
+	return sdkp;
+
+ out_put:
+	kref_put(&sdkp->kref);
+ out_sdkp:
+	sdkp = NULL;
  out:
 	up(&sd_ref_sem);
 	return sdkp;
@@ -188,6 +197,7 @@
 static void scsi_disk_put(struct scsi_disk *sdkp)
 {
 	down(&sd_ref_sem);
+	scsi_device_put(sdkp->device);
 	kref_put(&sdkp->kref);
 	up(&sd_ref_sem);
 }
@@ -207,9 +217,7 @@
 	sector_t block;
 	struct scsi_device *sdp = SCpnt->device;
 
-	timeout = SD_TIMEOUT;
-	if (SCpnt->device->type != TYPE_DISK)
-		timeout = SD_MOD_TIMEOUT;
+	timeout = sdp->timeout;
 
 	/*
 	 * these are already setup, just copy cdb basically
@@ -503,7 +511,7 @@
 	return 0;
 }
 
-static int sd_hdio_getgeo(struct block_device *bdev, struct hd_geometry *loc)
+static int sd_hdio_getgeo(struct block_device *bdev, struct hd_geometry __user *loc)
 {
 	struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk);
 	struct scsi_device *sdp = sdkp->device;
@@ -528,7 +536,7 @@
 	if (put_user(diskinfo[2], &loc->cylinders))
 		return -EFAULT;
 	if (put_user((unsigned)get_start_sect(bdev),
-	             (unsigned long *)&loc->start))
+	             (unsigned long __user *)&loc->start))
 		return -EFAULT;
 	return 0;
 }
@@ -553,6 +561,7 @@
 	struct block_device *bdev = inode->i_bdev;
 	struct gendisk *disk = bdev->bd_disk;
 	struct scsi_device *sdp = scsi_disk(disk)->device;
+	void __user *p = (void __user *)arg;
 	int error;
     
 	SCSI_LOG_IOCTL(1, printk("sd_ioctl: disk=%s, cmd=0x%x\n",
@@ -570,7 +579,7 @@
 	if (cmd == HDIO_GETGEO) {
 		if (!arg)
 			return -EINVAL;
-		return sd_hdio_getgeo(bdev, (struct hd_geometry *)arg);
+		return sd_hdio_getgeo(bdev, p);
 	}
 
 	/*
@@ -581,13 +590,13 @@
 	switch (cmd) {
 		case SCSI_IOCTL_GET_IDLUN:
 		case SCSI_IOCTL_GET_BUS_NUMBER:
-			return scsi_ioctl(sdp, cmd, (void *)arg);
+			return scsi_ioctl(sdp, cmd, p);
 		default:
-			error = scsi_cmd_ioctl(disk, cmd, arg);
+			error = scsi_cmd_ioctl(disk, cmd, p);
 			if (error != -ENOTTY)
 				return error;
 	}
-	return scsi_ioctl(sdp, cmd, (void *)arg);
+	return scsi_ioctl(sdp, cmd, p);
 }
 
 static void set_media_not_present(struct scsi_disk *sdkp)
@@ -1342,16 +1351,13 @@
 	if ((sdp->type != TYPE_DISK) && (sdp->type != TYPE_MOD))
 		goto out;
 
-	if ((error = scsi_device_get(sdp)) != 0)
-		goto out;
-
 	SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n", 
 			 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun));
 
 	error = -ENOMEM;
 	sdkp = kmalloc(sizeof(*sdkp), GFP_KERNEL);
 	if (!sdkp)
-		goto out_put_sdev;
+		goto out;
 
 	memset (sdkp, 0, sizeof(*sdkp));
 	kref_init(&sdkp->kref, scsi_disk_release);
@@ -1382,6 +1388,13 @@
 	sdkp->index = index;
 	sdkp->openers = 0;
 
+	if (!sdp->timeout) {
+		if (sdp->type == TYPE_DISK)
+			sdp->timeout = SD_TIMEOUT;
+		else
+			sdp->timeout = SD_MOD_TIMEOUT;
+	}
+
 	devno = make_sd_dev(index, 0);
 	gd->major = MAJOR(devno);
 	gd->first_minor = MINOR(devno);
@@ -1427,8 +1440,6 @@
 	put_disk(gd);
 out_free:
 	kfree(sdkp);
-out_put_sdev:
-	scsi_device_put(sdp);
 out:
 	return error;
 }
@@ -1450,7 +1461,9 @@
 
 	del_gendisk(sdkp->disk);
 	sd_shutdown(dev);
-	scsi_disk_put(sdkp);
+	down(&sd_ref_sem);
+	kref_put(&sdkp->kref);
+	up(&sd_ref_sem);
 
 	return 0;
 }
@@ -1467,7 +1480,6 @@
 static void scsi_disk_release(struct kref *kref)
 {
 	struct scsi_disk *sdkp = to_scsi_disk(kref);
-	struct scsi_device *sdev = sdkp->device;
 	struct gendisk *disk = sdkp->disk;
 	
 	spin_lock(&sd_index_lock);
@@ -1479,8 +1491,6 @@
 	put_disk(disk);
 
 	kfree(sdkp);
-
-	scsi_device_put(sdev);
 }
 
 /*
diff -Nru a/drivers/scsi/sg.c b/drivers/scsi/sg.c
--- a/drivers/scsi/sg.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/sg.c	Tue Jun 15 22:20:40 2004
@@ -7,7 +7,7 @@
  * Original driver (sg.c):
  *        Copyright (C) 1992 Lawrence Foard
  * Version 2 and 3 extensions to driver:
- *        Copyright (C) 1998 - 2002 Douglas Gilbert
+ *        Copyright (C) 1998 - 2004 Douglas Gilbert
  *
  *  Modified  19-JAN-1998  Richard Gooch <rgooch@atnf.csiro.au>  Devfs support
  *
@@ -17,27 +17,18 @@
  * any later version.
  *
  */
-#include <linux/config.h>
-static int sg_version_num = 30530;	/* 2 digits for each component */
+
+static int sg_version_num = 30531;	/* 2 digits for each component */
+#define SG_VERSION_STR "3.5.31"
+
 /*
  *  D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:
  *      - scsi logging is available via SCSI_LOG_TIMEOUT macros. First
  *        the kernel/module needs to be built with CONFIG_SCSI_LOGGING
  *        (otherwise the macros compile to empty statements).
- *        Then before running the program to be debugged enter:
- *          # echo "scsi log timeout 7" > /proc/scsi/scsi
- *        This will send copious output to the console and the log which
- *        is usually /var/log/messages. To turn off debugging enter:
- *          # echo "scsi log timeout 0" > /proc/scsi/scsi
- *        The 'timeout' token was chosen because it is relatively unused.
- *        The token 'hlcomplete' should be used but that triggers too
- *        much output from the sd device driver. To dump the current
- *        state of the SCSI mid level data structures enter:
- *          # echo "scsi dump 1" > /proc/scsi/scsi
- *        To dump the state of sg's data structures use:
- *          # cat /proc/scsi/sg/debug
  *
  */
+#include <linux/config.h>
 #include <linux/module.h>
 
 #include <linux/fs.h>
@@ -69,7 +60,7 @@
 
 #ifdef CONFIG_SCSI_PROC_FS
 #include <linux/proc_fs.h>
-static char *sg_version_str = "3.5.30 [20040124]";
+static char *sg_version_date = "20040513";
 
 static int sg_proc_init(void);
 static void sg_proc_cleanup(void);
@@ -110,7 +101,7 @@
 #define SG_SECTOR_SZ 512
 #define SG_SECTOR_MSK (SG_SECTOR_SZ - 1)
 
-#define SG_DEV_ARR_LUMP 6	/* amount to over allocate sg_dev_arr by */
+#define SG_DEV_ARR_LUMP 32	/* amount to over allocate sg_dev_arr by */
 
 static int sg_add(struct class_device *);
 static void sg_remove(struct class_device *);
@@ -191,17 +182,17 @@
 static int sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size);
 static int sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp,
 			 int tablesize);
-static ssize_t sg_new_read(Sg_fd * sfp, char *buf, size_t count,
+static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count,
 			   Sg_request * srp);
-static ssize_t sg_new_write(Sg_fd * sfp, const char *buf, size_t count,
+static ssize_t sg_new_write(Sg_fd * sfp, const char __user *buf, size_t count,
 			    int blocking, int read_only, Sg_request ** o_srp);
 static int sg_common_write(Sg_fd * sfp, Sg_request * srp,
 			   unsigned char *cmnd, int timeout, int blocking);
 static int sg_u_iovec(sg_io_hdr_t * hp, int sg_num, int ind,
-		      int wr_xf, int *countp, unsigned char **up);
+		      int wr_xf, int *countp, unsigned char __user **up);
 static int sg_write_xfer(Sg_request * srp);
 static int sg_read_xfer(Sg_request * srp);
-static int sg_read_oxfer(Sg_request * srp, char *outp, int num_read_xfer);
+static int sg_read_oxfer(Sg_request * srp, char __user *outp, int num_read_xfer);
 static void sg_remove_scat(Sg_scatter_hold * schp);
 static void sg_build_reserve(Sg_fd * sfp, int req_size);
 static void sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size);
@@ -338,7 +329,7 @@
 }
 
 static ssize_t
-sg_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
+sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
 {
 	int k, res;
 	Sg_device *sdp;
@@ -452,7 +443,7 @@
 }
 
 static ssize_t
-sg_new_read(Sg_fd * sfp, char *buf, size_t count, Sg_request * srp)
+sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
 {
 	sg_io_hdr_t *hp = &srp->header;
 	int err = 0;
@@ -490,7 +481,7 @@
 }
 
 static ssize_t
-sg_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
+sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 {
 	int mxsize, cmd_size, k;
 	int input_size, blocking;
@@ -567,7 +558,7 @@
 	else
 		hp->dxfer_direction = (mxsize > 0) ? SG_DXFER_FROM_DEV : SG_DXFER_NONE;
 	hp->dxfer_len = mxsize;
-	hp->dxferp = (unsigned char *) buf + cmd_size;
+	hp->dxferp = (char __user *)buf + cmd_size;
 	hp->sbp = NULL;
 	hp->timeout = old_hdr.reply_len;	/* structure abuse ... */
 	hp->flags = input_size;	/* structure abuse ... */
@@ -580,7 +571,7 @@
 }
 
 static ssize_t
-sg_new_write(Sg_fd * sfp, const char *buf, size_t count,
+sg_new_write(Sg_fd * sfp, const char __user *buf, size_t count,
 	     int blocking, int read_only, Sg_request ** o_srp)
 {
 	int k;
@@ -735,6 +726,8 @@
 sg_ioctl(struct inode *inode, struct file *filp,
 	 unsigned int cmd_in, unsigned long arg)
 {
+	void __user *p = (void __user *)arg;
+	int __user *ip = p;
 	int result, val, read_only;
 	Sg_device *sdp;
 	Sg_fd *sfp;
@@ -756,12 +749,11 @@
 				return -ENODEV;
 			if (!scsi_block_when_processing_errors(sdp->device))
 				return -ENXIO;
-			result = verify_area(VERIFY_WRITE, (void *) arg,
-					SZ_SG_IO_HDR);
+			result = verify_area(VERIFY_WRITE, p, SZ_SG_IO_HDR);
 			if (result)
 				return result;
 			result =
-			    sg_new_write(sfp, (const char *) arg, SZ_SG_IO_HDR,
+			    sg_new_write(sfp, p, SZ_SG_IO_HDR,
 					 blocking, read_only, &srp);
 			if (result < 0)
 				return result;
@@ -781,11 +773,11 @@
 				return result;	/* -ERESTARTSYS because signal hit process */
 			}
 			srp->done = 2;
-			result = sg_new_read(sfp, (char *) arg, SZ_SG_IO_HDR, srp);
+			result = sg_new_read(sfp, p, SZ_SG_IO_HDR, srp);
 			return (result < 0) ? result : 0;
 		}
 	case SG_SET_TIMEOUT:
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
 		if (val < 0)
@@ -800,7 +792,7 @@
 				/* strange ..., for backward compatibility */
 		return sfp->timeout_user;
 	case SG_SET_FORCE_LOW_DMA:
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
 		if (val) {
@@ -817,15 +809,14 @@
 		}
 		return 0;
 	case SG_GET_LOW_DMA:
-		return put_user((int) sfp->low_dma, (int *) arg);
+		return put_user((int) sfp->low_dma, ip);
 	case SG_GET_SCSI_ID:
 		result =
-		    verify_area(VERIFY_WRITE, (void *) arg,
-				sizeof (sg_scsi_id_t));
+		    verify_area(VERIFY_WRITE, p, sizeof (sg_scsi_id_t));
 		if (result)
 			return result;
 		else {
-			sg_scsi_id_t *sg_idp = (sg_scsi_id_t *) arg;
+			sg_scsi_id_t __user *sg_idp = p;
 
 			if (sdp->detached)
 				return -ENODEV;
@@ -845,13 +836,13 @@
 			return 0;
 		}
 	case SG_SET_FORCE_PACK_ID:
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
 		sfp->force_packid = val ? 1 : 0;
 		return 0;
 	case SG_GET_PACK_ID:
-		result = verify_area(VERIFY_WRITE, (void *) arg, sizeof (int));
+		result = verify_area(VERIFY_WRITE, ip, sizeof (int));
 		if (result)
 			return result;
 		read_lock_irqsave(&sfp->rq_list_lock, iflags);
@@ -859,12 +850,12 @@
 			if ((1 == srp->done) && (!srp->sg_io_owned)) {
 				read_unlock_irqrestore(&sfp->rq_list_lock,
 						       iflags);
-				__put_user(srp->header.pack_id, (int *) arg);
+				__put_user(srp->header.pack_id, ip);
 				return 0;
 			}
 		}
 		read_unlock_irqrestore(&sfp->rq_list_lock, iflags);
-		__put_user(-1, (int *) arg);
+		__put_user(-1, ip);
 		return 0;
 	case SG_GET_NUM_WAITING:
 		read_lock_irqsave(&sfp->rq_list_lock, iflags);
@@ -873,11 +864,11 @@
 				++val;
 		}
 		read_unlock_irqrestore(&sfp->rq_list_lock, iflags);
-		return put_user(val, (int *) arg);
+		return put_user(val, ip);
 	case SG_GET_SG_TABLESIZE:
-		return put_user(sdp->sg_tablesize, (int *) arg);
+		return put_user(sdp->sg_tablesize, ip);
 	case SG_SET_RESERVED_SIZE:
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
                 if (val < 0)
@@ -891,37 +882,37 @@
 		return 0;
 	case SG_GET_RESERVED_SIZE:
 		val = (int) sfp->reserve.bufflen;
-		return put_user(val, (int *) arg);
+		return put_user(val, ip);
 	case SG_SET_COMMAND_Q:
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
 		sfp->cmd_q = val ? 1 : 0;
 		return 0;
 	case SG_GET_COMMAND_Q:
-		return put_user((int) sfp->cmd_q, (int *) arg);
+		return put_user((int) sfp->cmd_q, ip);
 	case SG_SET_KEEP_ORPHAN:
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
 		sfp->keep_orphan = val;
 		return 0;
 	case SG_GET_KEEP_ORPHAN:
-		return put_user((int) sfp->keep_orphan, (int *) arg);
+		return put_user((int) sfp->keep_orphan, ip);
 	case SG_NEXT_CMD_LEN:
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
 		sfp->next_cmd_len = (val > 0) ? val : 0;
 		return 0;
 	case SG_GET_VERSION_NUM:
-		return put_user(sg_version_num, (int *) arg);
+		return put_user(sg_version_num, ip);
 	case SG_GET_ACCESS_COUNT:
 		/* faked - we don't have a real access count anymore */
 		val = (sdp->device ? 1 : 0);
-		return put_user(val, (int *) arg);
+		return put_user(val, ip);
 	case SG_GET_REQUEST_TABLE:
-		result = verify_area(VERIFY_WRITE, (void *) arg,
+		result = verify_area(VERIFY_WRITE, p,
 				     SZ_SG_REQ_INFO * SG_MAX_QUEUE);
 		if (result)
 			return result;
@@ -949,13 +940,13 @@
 				}
 			}
 			read_unlock_irqrestore(&sfp->rq_list_lock, iflags);
-			return (__copy_to_user((void *) arg, rinfo,
+			return (__copy_to_user(p, rinfo,
 			        SZ_SG_REQ_INFO * SG_MAX_QUEUE) ? -EFAULT : 0);
 		}
 	case SG_EMULATED_HOST:
 		if (sdp->detached)
 			return -ENODEV;
-		return put_user(sdp->device->host->hostt->emulated, (int *) arg);
+		return put_user(sdp->device->host->hostt->emulated, ip);
 	case SG_SCSI_RESET:
 		if (sdp->detached)
 			return -ENODEV;
@@ -965,7 +956,7 @@
 				return -EBUSY;
 		} else if (!scsi_block_when_processing_errors(sdp->device))
 			return -EBUSY;
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
 		if (SG_SCSI_RESET_NOTHING == val)
@@ -992,16 +983,16 @@
 			return -ENODEV;
 		if (read_only) {
 			unsigned char opcode = WRITE_6;
-			Scsi_Ioctl_Command *siocp = (void *) arg;
+			Scsi_Ioctl_Command __user *siocp = p;
 
 			if (copy_from_user(&opcode, siocp->data, 1))
 				return -EFAULT;
 			if (!sg_allow_access(opcode, sdp->device->type))
 				return -EPERM;
 		}
-		return scsi_ioctl_send_command(sdp->device, (void *) arg);
+		return scsi_ioctl_send_command(sdp->device, p);
 	case SG_SET_DEBUG:
-		result = get_user(val, (int *) arg);
+		result = get_user(val, ip);
 		if (result)
 			return result;
 		sdp->sgdebug = (char) val;
@@ -1012,11 +1003,11 @@
 	case SG_GET_TRANSFORM:
 		if (sdp->detached)
 			return -ENODEV;
-		return scsi_ioctl(sdp->device, cmd_in, (void *) arg);
+		return scsi_ioctl(sdp->device, cmd_in, p);
 	default:
 		if (read_only)
 			return -EPERM;	/* don't know so take safe approach */
-		return scsi_ioctl(sdp->device, cmd_in, (void *) arg);
+		return scsi_ioctl(sdp->device, cmd_in, p);
 	}
 }
 
@@ -1099,10 +1090,10 @@
 				page_ptr = sg_scatg2virt(sclp) + m;
 				page = virt_to_page(page_ptr);
 				if (startFinish)
-					atomic_inc(&page->count);
+					get_page(page);
 				else {
 					if (page_count(page) > 0)
-						atomic_dec(&page->count);
+						__put_page(page);
 				}
 			}
 		}
@@ -1111,10 +1102,10 @@
 			page_ptr = (unsigned char *) rsv_schp->buffer + m;
 			page = virt_to_page(page_ptr);
 			if (startFinish)
-				atomic_inc(&page->count);
+				get_page(page);
 			else {
 				if (page_count(page) > 0)
-					atomic_dec(&page->count);
+					__put_page(page);
 			}
 		}
 	}
@@ -1333,85 +1324,44 @@
 
 static int sg_sysfs_valid = 0;
 
-static int
-sg_add(struct class_device *cl_dev)
+static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
 {
-	struct scsi_device *scsidp = to_scsi_device(cl_dev->dev);
-	struct gendisk *disk;
-	Sg_device *sdp = NULL;
+	Sg_device *sdp;
 	unsigned long iflags;
-	struct cdev * cdev = NULL;
+	void *old_sg_dev_arr = NULL;
 	int k, error;
 
-	disk = alloc_disk(1);
-	if (!disk)
+	sdp = vmalloc(sizeof(Sg_device));
+	if (!sdp)
 		return -ENOMEM;
 
-	cdev = cdev_alloc();
-	if (! cdev)
-		return -ENOMEM;
 	write_lock_irqsave(&sg_dev_arr_lock, iflags);
-	if (sg_nr_dev >= sg_dev_max) {	/* try to resize */
+	if (unlikely(sg_nr_dev >= sg_dev_max)) {	/* try to resize */
 		Sg_device **tmp_da;
 		int tmp_dev_max = sg_nr_dev + SG_DEV_ARR_LUMP;
-
 		write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
-		tmp_da = (Sg_device **)vmalloc(
-				tmp_dev_max * sizeof(Sg_device *));
-		if (NULL == tmp_da) {
-			printk(KERN_ERR
-			       "sg_add: device array cannot be resized\n");
-			error = -ENOMEM;
-			goto out;
-		}
+
+		tmp_da = vmalloc(tmp_dev_max * sizeof(Sg_device *));
+		if (unlikely(!tmp_da))
+			goto expand_failed;
+
 		write_lock_irqsave(&sg_dev_arr_lock, iflags);
-		memset(tmp_da, 0, tmp_dev_max * sizeof (Sg_device *));
-		memcpy(tmp_da, sg_dev_arr,
-		       sg_dev_max * sizeof (Sg_device *));
-		vfree((char *) sg_dev_arr);
+		memset(tmp_da, 0, tmp_dev_max * sizeof(Sg_device *));
+		memcpy(tmp_da, sg_dev_arr, sg_dev_max * sizeof(Sg_device *));
+		old_sg_dev_arr = sg_dev_arr;
 		sg_dev_arr = tmp_da;
 		sg_dev_max = tmp_dev_max;
 	}
 
-find_empty_slot:
 	for (k = 0; k < sg_dev_max; k++)
 		if (!sg_dev_arr[k])
 			break;
-	if (k >= SG_MAX_DEVS) {
-		write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
-		printk(KERN_WARNING
-		       "Unable to attach sg device <%d, %d, %d, %d>"
-		       " type=%d, minor number exceeds %d\n",
-		       scsidp->host->host_no, scsidp->channel, scsidp->id,
-		       scsidp->lun, scsidp->type, SG_MAX_DEVS - 1);
-		if (NULL != sdp)
-			vfree((char *) sdp);
-		error = -ENODEV;
-		goto out;
-	}
-	if (k < sg_dev_max) {
-		if (NULL == sdp) {
-			write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
-			sdp = (Sg_device *)vmalloc(sizeof(Sg_device));
-			write_lock_irqsave(&sg_dev_arr_lock, iflags);
-			if (!sg_dev_arr[k])
-				goto find_empty_slot;
-		}
-	} else
-		sdp = NULL;
-	if (NULL == sdp) {
-		write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
-		printk(KERN_ERR "sg_add: Sg_device cannot be allocated\n");
-		error = -ENOMEM;
-		goto out;
-	}
+	if (unlikely(k >= SG_MAX_DEVS))
+		goto overflow;
 
-	SCSI_LOG_TIMEOUT(3, printk("sg_add: dev=%d \n", k));
 	memset(sdp, 0, sizeof(*sdp));
+	SCSI_LOG_TIMEOUT(3, printk("sg_alloc: dev=%d \n", k));
 	sprintf(disk->disk_name, "sg%d", k);
-	cdev->owner = THIS_MODULE;
-	cdev->ops = &sg_fops;
-	disk->major = SCSI_GENERIC_MAJOR;
 	disk->first_minor = k;
 	sdp->disk = disk;
 	sdp->device = scsidp;
@@ -1421,6 +1371,55 @@
 	sg_nr_dev++;
 	sg_dev_arr[k] = sdp;
 	write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
+	error = k;
+
+ out:
+	if (error < 0)
+		vfree(sdp);
+	vfree(old_sg_dev_arr);
+	return error;
+
+ expand_failed:
+	printk(KERN_ERR "sg_alloc: device array cannot be resized\n");
+	error = -ENOMEM;
+	goto out;
+
+ overflow:
+	write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
+	printk(KERN_WARNING
+	       "Unable to attach sg device <%d, %d, %d, %d> type=%d, minor "
+	       "number exceeds %d\n", scsidp->host->host_no, scsidp->channel,
+	       scsidp->id, scsidp->lun, scsidp->type, SG_MAX_DEVS - 1);
+	error = -ENODEV;
+	goto out;
+}
+
+static int
+sg_add(struct class_device *cl_dev)
+{
+	struct scsi_device *scsidp = to_scsi_device(cl_dev->dev);
+	struct gendisk *disk;
+	Sg_device *sdp = NULL;
+	struct cdev * cdev = NULL;
+	int error, k;
+
+	disk = alloc_disk(1);
+	if (!disk)
+		return -ENOMEM;
+	disk->major = SCSI_GENERIC_MAJOR;
+
+	error = -ENOMEM;
+	cdev = cdev_alloc();
+	if (!cdev)
+		goto out;
+	cdev->owner = THIS_MODULE;
+	cdev->ops = &sg_fops;
+
+	error = sg_alloc(disk, scsidp);
+	if (error < 0)
+		goto out;
+	k = error;
+	sdp = sg_dev_arr[k];
 
 	devfs_mk_cdev(MKDEV(SCSI_GENERIC_MAJOR, k),
 			S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
@@ -1543,6 +1542,7 @@
 MODULE_AUTHOR("Douglas Gilbert");
 MODULE_DESCRIPTION("SCSI generic (sg) driver");
 MODULE_LICENSE("GPL");
+MODULE_VERSION(SG_VERSION_STR);
 
 MODULE_PARM_DESC(def_reserved_size, "size of buffer reserved for each fd");
 MODULE_PARM_DESC(allow_dio, "allow direct I/O (default: 0 (disallow))");
@@ -1901,7 +1901,7 @@
 	int iovec_count = (int) hp->iovec_count;
 	int dxfer_dir = hp->dxfer_direction;
 	unsigned char *p;
-	unsigned char *up;
+	unsigned char __user *up;
 	int new_interface = ('\0' == hp->interface_id) ? 0 : 1;
 
 	if ((SG_DXFER_UNKNOWN == dxfer_dir) || (SG_DXFER_TO_DEV == dxfer_dir) ||
@@ -1987,26 +1987,23 @@
 
 static int
 sg_u_iovec(sg_io_hdr_t * hp, int sg_num, int ind,
-	   int wr_xf, int *countp, unsigned char **up)
+	   int wr_xf, int *countp, unsigned char __user **up)
 {
 	int num_xfer = (int) hp->dxfer_len;
-	unsigned char *p;
+	unsigned char __user *p = hp->dxferp;
 	int count, k;
-	sg_iovec_t u_iovec;
 
 	if (0 == sg_num) {
-		p = (unsigned char *) hp->dxferp;
 		if (wr_xf && ('\0' == hp->interface_id))
 			count = (int) hp->flags;	/* holds "old" input_size */
 		else
 			count = num_xfer;
 	} else {
-		if (__copy_from_user(&u_iovec,
-				     (unsigned char *) hp->dxferp +
-				     (ind * SZ_SG_IOVEC), SZ_SG_IOVEC))
+		sg_iovec_t iovec;
+		if (__copy_from_user(&iovec, p + ind*SZ_SG_IOVEC, SZ_SG_IOVEC))
 			return -EFAULT;
-		p = (unsigned char *) u_iovec.iov_base;
-		count = (int) u_iovec.iov_len;
+		p = iovec.iov_base;
+		count = (int) iovec.iov_len;
 	}
 	if ((k = verify_area(wr_xf ? VERIFY_READ : VERIFY_WRITE, p, count)))
 		return k;
@@ -2058,7 +2055,7 @@
 	int iovec_count = (int) hp->iovec_count;
 	int dxfer_dir = hp->dxfer_direction;
 	unsigned char *p;
-	unsigned char *up;
+	unsigned char __user *up;
 	int new_interface = ('\0' == hp->interface_id) ? 0 : 1;
 
 	if ((SG_DXFER_UNKNOWN == dxfer_dir) || (SG_DXFER_FROM_DEV == dxfer_dir)
@@ -2143,7 +2140,7 @@
 }
 
 static int
-sg_read_oxfer(Sg_request * srp, char *outp, int num_read_xfer)
+sg_read_oxfer(Sg_request * srp, char __user *outp, int num_read_xfer)
 {
 	Sg_scatter_hold *schp = &srp->data;
 
@@ -2844,7 +2841,8 @@
 
 static int sg_proc_seq_show_version(struct seq_file *s, void *v)
 {
-	seq_printf(s, "%d\t%s\n", sg_version_num, sg_version_str);
+	seq_printf(s, "%d\t%s [%s]\n", sg_version_num, SG_VERSION_STR,
+		   sg_version_date);
 	return 0;
 }
 
diff -Nru a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c
--- a/drivers/scsi/sgiwd93.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/scsi/sgiwd93.c	Tue Jun 15 22:21:03 2004
@@ -1,32 +1,32 @@
 /*
- * sgiwd93.c: SGI WD93 scsi driver.
+ * 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) 1996 David S. Miller (dm@engr.sgi.com)
- *		 1999 Andrew R. Baker (andrewb@uab.edu)
- *		      - Support for 2nd SCSI controller on Indigo2
- *		 2001 Florian Lohoff (flo@rfc822.org)
- *		      - Delete HPC scatter gather (Read corruption on 
- *		        multiple disks)
- *		      - Cleanup wback cache handling
+ * Copyright (C) 1999 Andrew R. Baker (andrewb@uab.edu)
+ * Copyright (C) 2001 Florian Lohoff (flo@rfc822.org)
+ * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
  * 
  * (In all truth, Jed Schimmel wrote all this code.)
- *
  */
 #include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/mm.h>
 #include <linux/blkdev.h>
 #include <linux/version.h>
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
 #include <linux/spinlock.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/sgialib.h>
 #include <asm/sgi/sgi.h>
-#include <asm/sgi/sgimc.h>
-#include <asm/sgi/sgihpc.h>
-#include <asm/sgi/sgint23.h>
+#include <asm/sgi/mc.h>
+#include <asm/sgi/hpc3.h>
+#include <asm/sgi/ip22.h>
 #include <asm/irq.h>
 #include <asm/io.h>
 
@@ -37,95 +37,130 @@
 
 #include <linux/stat.h>
 
+#if 0
+#define DPRINTK(args...)	printk(args)
+#else
+#define DPRINTK(args...)
+#endif
+
+#define HDATA(ptr) ((struct ip22_hostdata *)((ptr)->hostdata))
+
+struct ip22_hostdata {
+	struct WD33C93_hostdata wh;
+	struct hpc_data {
+		dma_addr_t      dma;
+		void            * cpu;
+	} hd;
+};
+
 struct hpc_chunk {
 	struct hpc_dma_desc desc;
 	u32 _padding;	/* align to quadword boundary */
 };
 
-struct Scsi_Host *sgiwd93_host = NULL;
-struct Scsi_Host *sgiwd93_host1 = NULL;
+struct Scsi_Host *sgiwd93_host;
+struct Scsi_Host *sgiwd93_host1;
 
 /* Wuff wuff, wuff, wd33c93.c, wuff wuff, object oriented, bow wow. */
+static inline void write_wd33c93_count(const wd33c93_regs regs,
+                                      unsigned long value)
+{
+	*regs.SASR = WD_TRANSFER_COUNT_MSB;
+	mb();
+	*regs.SCMD = ((value >> 16) & 0xff);
+	*regs.SCMD = ((value >>  8) & 0xff);
+	*regs.SCMD = ((value >>  0) & 0xff);
+	mb();
+}
 
-/* XXX woof! */
-static void sgiwd93_intr(int irq, void *dev_id, struct pt_regs *regs)
+static inline unsigned long read_wd33c93_count(const wd33c93_regs regs)
 {
-	unsigned long flags;
-	struct Scsi_Host *dev = dev_id;
-	
-	spin_lock_irqsave(dev->host_lock, flags);
-	wd33c93_intr((struct Scsi_Host *) dev_id);
-	spin_unlock_irqrestore(dev->host_lock, flags);
+	unsigned long value;
+
+	*regs.SASR = WD_TRANSFER_COUNT_MSB;
+	mb();
+	value =  ((*regs.SCMD & 0xff) << 16);
+	value |= ((*regs.SCMD & 0xff) <<  8);
+	value |= ((*regs.SCMD & 0xff) <<  0);
+	mb();
+	return value;
 }
 
-#undef DEBUG_DMA
+static irqreturn_t sgiwd93_intr(int irq, void *dev_id, struct pt_regs *regs)
+{
+	struct Scsi_Host * host = (struct Scsi_Host *) dev_id;
+	unsigned long flags;
+
+	spin_lock_irqsave(host->host_lock, flags);
+	wd33c93_intr(host);
+	spin_unlock_irqrestore(host->host_lock, flags);
+
+	return IRQ_HANDLED;
+}
 
 static inline
-void fill_hpc_entries (struct hpc_chunk **hcp, char *addr, unsigned long len)
+void fill_hpc_entries(struct hpc_chunk *hcp, Scsi_Cmnd *cmd, int datainp)
 {
-	unsigned long physaddr;
+	unsigned long len = cmd->SCp.this_residual;
+	void *addr = cmd->SCp.ptr;
+	dma_addr_t physaddr;
 	unsigned long count;
-	
-	physaddr = PHYSADDR(addr);
+
+	physaddr = dma_map_single(NULL, addr, len, cmd->sc_data_direction);
+	cmd->SCp.dma_handle = physaddr;
+
 	while (len) {
 		/*
 		 * even cntinfo could be up to 16383, without
 		 * magic only 8192 works correctly
 		 */
 		count = len > 8192 ? 8192 : len;
-		(*hcp)->desc.pbuf = physaddr;
-		(*hcp)->desc.cntinfo = count;
-		(*hcp)++;
+		hcp->desc.pbuf = physaddr;
+		hcp->desc.cntinfo = count;
+		hcp++;
 		len -= count;
 		physaddr += count;
 	}
+
+	/*
+	 * To make sure, if we trip an HPC bug, that we transfer every single
+	 * byte, we tag on an extra zero length dma descriptor at the end of
+	 * the chain.
+	 */
+	hcp->desc.pbuf = 0;
+	hcp->desc.cntinfo = HPCDMA_EOX;
 }
 
 static int dma_setup(Scsi_Cmnd *cmd, int datainp)
 {
-	struct WD33C93_hostdata *hdata = (struct WD33C93_hostdata *)cmd->host->hostdata;
-	struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) cmd->host->base;
-	struct hpc_chunk *hcp = (struct hpc_chunk *) hdata->dma_bounce_buffer;
-
-#ifdef DEBUG_DMA
-	printk("dma_setup: datainp<%d> hcp<%p> ",
-	       datainp, hcp);
-#endif
+	struct ip22_hostdata *hdata = HDATA(cmd->device->host);
+	struct hpc3_scsiregs *hregs =
+		(struct hpc3_scsiregs *) cmd->device->host->base;
+	struct hpc_chunk *hcp = (struct hpc_chunk *) hdata->hd.cpu;
+
+	DPRINTK("dma_setup: datainp<%d> hcp<%p> ", datainp, hcp);
 
-	hdata->dma_dir = datainp;
+	hdata->wh.dma_dir = datainp;
 
 	/*
-	 * wd33c93 shouldn't pass us bogus dma_setups, but
-	 * it does:-( The other wd33c93 drivers deal with
-	 * it the same way (which isn't that obvious).
-	 * IMHO a better fix would be, not to do these
-	 * dma setups in the first place
+	 * wd33c93 shouldn't pass us bogus dma_setups, but it does:-(  The
+	 * other wd33c93 drivers deal with it the same way (which isn't that
+	 * obvious).  IMHO a better fix would be, not to do these dma setups
+	 * in the first place.
 	 */
-	if (cmd->SCp.ptr == NULL)
+	if (cmd->SCp.ptr == NULL || cmd->SCp.this_residual == 0)
 		return 1;
 
-	fill_hpc_entries (&hcp, cmd->SCp.ptr,cmd->SCp.this_residual);
+	fill_hpc_entries(hcp, cmd, datainp);
 
-	/* To make sure, if we trip an HPC bug, that we transfer
-	 * every single byte, we tag on an extra zero length dma
-	 * descriptor at the end of the chain.
-	 */
-	hcp->desc.pbuf = 0;
-	hcp->desc.cntinfo = (HPCDMA_EOX);
-
-#ifdef DEBUG_DMA
-	printk(" HPCGO\n");
-#endif
+	DPRINTK(" HPCGO\n");
 
 	/* Start up the HPC. */
-	hregs->ndptr = PHYSADDR(hdata->dma_bounce_buffer);
-	if(datainp) {
-		dma_cache_inv((unsigned long) cmd->SCp.ptr, cmd->SCp.this_residual);
-		hregs->ctrl = (HPC3_SCTRL_ACTIVE);
-	} else {
-		dma_cache_wback_inv((unsigned long) cmd->SCp.ptr, cmd->SCp.this_residual);
-		hregs->ctrl = (HPC3_SCTRL_ACTIVE | HPC3_SCTRL_DIR);
-	}
+	hregs->ndptr = hdata->hd.dma;
+	if (datainp)
+		hregs->ctrl = HPC3_SCTRL_ACTIVE;
+	else
+		hregs->ctrl = HPC3_SCTRL_ACTIVE | HPC3_SCTRL_DIR;
 
 	return 0;
 }
@@ -133,29 +168,27 @@
 static void dma_stop(struct Scsi_Host *instance, Scsi_Cmnd *SCpnt,
 		     int status)
 {
-	struct WD33C93_hostdata *hdata = (struct WD33C93_hostdata *)instance->hostdata;
+	struct ip22_hostdata *hdata = HDATA(instance);
 	struct hpc3_scsiregs *hregs;
 
 	if (!SCpnt)
 		return;
 
-	hregs = (struct hpc3_scsiregs *) SCpnt->host->base;
+	hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base;
 
-#ifdef DEBUG_DMA
-	printk("dma_stop: status<%d> ", status);
-#endif
+	DPRINTK("dma_stop: status<%d> ", status);
 
 	/* First stop the HPC and flush it's FIFO. */
-	if(hdata->dma_dir) {
+	if (hdata->wh.dma_dir) {
 		hregs->ctrl |= HPC3_SCTRL_FLUSH;
-		while(hregs->ctrl & HPC3_SCTRL_ACTIVE)
+		while (hregs->ctrl & HPC3_SCTRL_ACTIVE)
 			barrier();
 	}
 	hregs->ctrl = 0;
+	dma_unmap_single(NULL, SCpnt->SCp.dma_handle, SCpnt->SCp.this_residual,
+	                 SCpnt->sc_data_direction);
 
-#ifdef DEBUG_DMA
-	printk("\n");
-#endif
+	DPRINTK("\n");
 }
 
 void sgiwd93_reset(unsigned long base)
@@ -163,142 +196,142 @@
 	struct hpc3_scsiregs *hregs = (struct hpc3_scsiregs *) base;
 
 	hregs->ctrl = HPC3_SCTRL_CRESET;
-	udelay (50);
+	udelay(50);
 	hregs->ctrl = 0;
 }
 
-static inline void init_hpc_chain(uchar *buf)
+static inline void init_hpc_chain(struct hpc_data *hd)
 {
-	struct hpc_chunk *hcp = (struct hpc_chunk *) buf;
+	struct hpc_chunk *hcp = (struct hpc_chunk *) hd->cpu;
+	struct hpc_chunk *dma = (struct hpc_chunk *) hd->dma;
 	unsigned long start, end;
 
-	start = (unsigned long) buf;
+	start = (unsigned long) hcp;
 	end = start + PAGE_SIZE;
-	while(start < end) {
-		hcp->desc.pnext = PHYSADDR((hcp + 1));
+	while (start < end) {
+		hcp->desc.pnext = (u32) (dma + 1);
 		hcp->desc.cntinfo = HPCDMA_EOX;
-		hcp++;
+		hcp++; dma++;
 		start += sizeof(struct hpc_chunk);
 	};
 	hcp--;
-	hcp->desc.pnext = PHYSADDR(buf);
-
-	/* Force flush to memory */
-	dma_cache_wback_inv((unsigned long) buf, PAGE_SIZE);
+	hcp->desc.pnext = hd->dma;
 }
 
-int __init sgiwd93_detect(Scsi_Host_Template *SGIblows)
+static struct Scsi_Host * __init sgiwd93_setup_scsi(
+	Scsi_Host_Template *SGIblows, int unit, int irq,
+	struct hpc3_scsiregs *hregs, unsigned char *wdregs)
 {
-	static unsigned char called = 0;
-	struct hpc3_scsiregs *hregs = &hpc3c0->scsi_chan0;
-	struct hpc3_scsiregs *hregs1 = &hpc3c0->scsi_chan1;
-	struct WD33C93_hostdata *hdata;
-	struct WD33C93_hostdata *hdata1;
+	struct ip22_hostdata *hdata;
+	struct Scsi_Host *host;
 	wd33c93_regs regs;
-	uchar *buf;
-	
-	if(called)
-		return 0; /* Should bitch on the console about this... */
-
-	SGIblows->proc_name = "SGIWD93";
 
-	sgiwd93_host = scsi_register(SGIblows, sizeof(struct WD33C93_hostdata));
-	if(sgiwd93_host == NULL)
-		return 0;
-	sgiwd93_host->base = (unsigned long) hregs;
-	sgiwd93_host->irq = SGI_WD93_0_IRQ;
-
-	buf = (uchar *) get_zeroed_page(GFP_KERNEL);
-	if (!buf) {
-		printk(KERN_WARNING "sgiwd93: Could not allocate memory for host0 buffer.\n");
-		scsi_unregister(sgiwd93_host);
-		return 0;
+	host = scsi_register(SGIblows, sizeof(struct ip22_hostdata));
+	if (!host)
+		return NULL;
+
+	host->base = (unsigned long) hregs;
+	host->irq = irq;
+
+	hdata = HDATA(host);
+	hdata->hd.cpu = dma_alloc_coherent(NULL, PAGE_SIZE, &hdata->hd.dma,
+	                                   GFP_KERNEL);
+	if (!hdata->hd.cpu) {
+		printk(KERN_WARNING "sgiwd93: Could not allocate memory for "
+		       "host %d buffer.\n", unit);
+		goto out_unregister;
 	}
-	init_hpc_chain(buf);
-	
-	/* HPC_SCSI_REG0 | 0x03 | KSEG1 */
-	regs.SASR = (unsigned char*) KSEG1ADDR (0x1fbc0003);
-	regs.SCMD = (unsigned char*) KSEG1ADDR (0x1fbc0007);
-	wd33c93_init(sgiwd93_host, regs, dma_setup, dma_stop, WD33C93_FS_16_20);
-
-	hdata = (struct WD33C93_hostdata *)sgiwd93_host->hostdata;
-	hdata->no_sync = 0;
-	hdata->dma_bounce_buffer = (uchar *) (KSEG1ADDR(buf));
-
-	if (request_irq(SGI_WD93_0_IRQ, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host)) {
-		printk(KERN_WARNING "sgiwd93: Could not register IRQ %d (for host 0).\n", SGI_WD93_0_IRQ);
-		wd33c93_release();
-		free_page((unsigned long)buf);
-		scsi_unregister(sgiwd93_host);
-		return 0;
+	init_hpc_chain(&hdata->hd);
+
+	regs.SASR = wdregs + 3;
+	regs.SCMD = wdregs + 7;
+
+	wd33c93_init(host, regs, dma_setup, dma_stop, WD33C93_FS_16_20);
+
+	hdata->wh.no_sync = 0;
+
+	if (request_irq(irq, sgiwd93_intr, 0, "SGI WD93", (void *) host)) {
+		printk(KERN_WARNING "sgiwd93: Could not register irq %d "
+		       "for host %d.\n", irq, unit);
+		goto out_free;
 	}
-        /* set up second controller on the Indigo2 */
-	if(!sgi_guiness) {
-		sgiwd93_host1 = scsi_register(SGIblows, sizeof(struct WD33C93_hostdata));
-		if(sgiwd93_host1 != NULL)
-		{
-			sgiwd93_host1->base = (unsigned long) hregs1;
-			sgiwd93_host1->irq = SGI_WD93_1_IRQ;
-	
-			buf = (uchar *) get_zeroed_page(GFP_KERNEL);
-			if (!buf) {
-				printk(KERN_WARNING "sgiwd93: Could not allocate memory for host1 buffer.\n");
-				scsi_unregister(sgiwd93_host1);
-				called = 1;
-				return 1; /* We registered host0 so return success*/
-			}
-			init_hpc_chain(buf);
-
-			/* HPC_SCSI_REG1 | 0x03 | KSEG1 */
-			regs.SASR = (unsigned char*) KSEG1ADDR(0x1fbc8003);
-			regs.SCMD = (unsigned char*) KSEG1ADDR(0x1fbc8007);
-			wd33c93_init(sgiwd93_host1, regs, dma_setup, dma_stop,
-			             WD33C93_FS_16_20);
-	
-			hdata1 = (struct WD33C93_hostdata *)sgiwd93_host1->hostdata;
-			hdata1->no_sync = 0;
-			hdata1->dma_bounce_buffer = (uchar *) (KSEG1ADDR(buf));
-	
-			if (request_irq(SGI_WD93_1_IRQ, sgiwd93_intr, 0, "SGI WD93", (void *) sgiwd93_host1)) {
-				printk(KERN_WARNING "sgiwd93: Could not allocate irq %d (for host1).\n", SGI_WD93_1_IRQ);
-				wd33c93_release();
-				free_page((unsigned long)buf);
-				scsi_unregister(sgiwd93_host1);
-				/* Fall through since host0 registered OK */
-			}
-		}
+	return host;
+
+out_free:
+	dma_free_coherent(NULL, PAGE_SIZE, hdata->hd.cpu, hdata->hd.dma);
+	wd33c93_release();
+
+out_unregister:
+	scsi_unregister(host);
+
+	return NULL;
+}
+
+int __init sgiwd93_detect(Scsi_Host_Template *SGIblows)
+{
+	int found = 0;
+
+	SGIblows->proc_name = "SGIWD93";
+	sgiwd93_host = sgiwd93_setup_scsi(SGIblows, 0, SGI_WD93_0_IRQ,
+	                                  &hpc3c0->scsi_chan0,
+	                                  (unsigned char *)hpc3c0->scsi0_ext);
+	if (sgiwd93_host)
+		found++;
+
+	/* Set up second controller on the Indigo2 */
+	if (ip22_is_fullhouse()) {
+		sgiwd93_host1 = sgiwd93_setup_scsi(SGIblows, 1, SGI_WD93_1_IRQ,
+		                          &hpc3c0->scsi_chan1,
+		                          (unsigned char *)hpc3c0->scsi1_ext);
+		if (sgiwd93_host1)
+			found++;
 	}
-	
-	called = 1;
 
-	return 1; /* Found one. */
+	return found;
 }
 
 int sgiwd93_release(struct Scsi_Host *instance)
 {
-	free_irq(SGI_WD93_0_IRQ, sgiwd93_intr);
-	free_page(KSEG0ADDR(hdata->dma_bounce_buffer));
+	struct ip22_hostdata *hdata = HDATA(instance);
+	int irq = 0;
+
+	if (sgiwd93_host && sgiwd93_host == instance)
+		irq = SGI_WD93_0_IRQ;
+	else if (sgiwd93_host1 && sgiwd93_host1 == instance)
+		irq = SGI_WD93_1_IRQ;
+
+	free_irq(irq, sgiwd93_intr);
+	dma_free_coherent(NULL, PAGE_SIZE, hdata->hd.cpu, hdata->hd.dma);
 	wd33c93_release();
-	if(!sgi_guiness) {
-		free_irq(SGI_WD93_1_IRQ, sgiwd93_intr);
-		free_page(KSEG0ADDR(hdata1->dma_bounce_buffer));
-		wd33c93_release();
-	}
+
 	return 1;
 }
 
+static int sgiwd93_bus_reset(Scsi_Cmnd *cmd)
+{
+	/* FIXME perform bus-specific reset */
+	wd33c93_host_reset(cmd);
+	return SUCCESS;
+}
+
+/*
+ * Kludge alert - the SCSI code calls the abort and reset method with int
+ * arguments not with pointers.  So this is going to blow up beautyfully
+ * on 64-bit systems with memory outside the compat address spaces.
+ */
 static Scsi_Host_Template driver_template = {
-	.proc_name	     = "SGIWD93",
-	.name                = "SGI WD93",
-	.detect              = sgiwd93_detect,
-	.release             = sgiwd93_release,
-	.queuecommand        = wd33c93_queuecommand,
-	.abort               = wd33c93_abort,
-	.reset               = wd33c93_reset,
-	.can_queue           = CAN_QUEUE,
-	.this_id             = 7,
-	.sg_tablesize        = SG_ALL,
-	.cmd_per_lun	     = CMD_PER_LUN,
-	.use_clustering      = DISABLE_CLUSTERING,
+	.proc_name		= "SGIWD93",
+	.name			= "SGI WD93",
+	.detect			= sgiwd93_detect,
+	.release		= sgiwd93_release,
+	.queuecommand		= wd33c93_queuecommand,
+	.eh_abort_handler	= wd33c93_abort,
+	.eh_bus_reset_handler	= sgiwd93_bus_reset,
+	.eh_host_reset_handler	= wd33c93_host_reset,
+	.can_queue		= CAN_QUEUE,
+	.this_id		= 7,
+	.sg_tablesize		= SG_ALL,
+	.cmd_per_lun		= CMD_PER_LUN,
+	.use_clustering		= DISABLE_CLUSTERING,
 };
 #include "scsi_module.c"
diff -Nru a/drivers/scsi/sgiwd93.h b/drivers/scsi/sgiwd93.h
--- a/drivers/scsi/sgiwd93.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/sgiwd93.h	Tue Jun 15 22:20:39 2004
@@ -19,6 +19,6 @@
 const char *wd33c93_info(void);
 int wd33c93_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
 int wd33c93_abort(Scsi_Cmnd *);
-int wd33c93_reset(Scsi_Cmnd *, unsigned int);
+int wd33c93_host_reset(Scsi_Cmnd * SCpnt);
 
 #endif /* !(_SGIWD93_H) */
diff -Nru a/drivers/scsi/sr.c b/drivers/scsi/sr.c
--- a/drivers/scsi/sr.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/scsi/sr.c	Tue Jun 15 22:20:38 2004
@@ -99,7 +99,7 @@
 static void get_capabilities(struct scsi_cd *);
 
 static int sr_media_change(struct cdrom_device_info *, int);
-static int sr_packet(struct cdrom_device_info *, struct cdrom_generic_command *);
+static int sr_packet(struct cdrom_device_info *, struct packet_command *);
 
 static struct cdrom_device_ops sr_dops = {
 	.open			= sr_open,
@@ -138,7 +138,15 @@
 		goto out;
 	cd = scsi_cd(disk);
 	if (!kref_get(&cd->kref))
-		cd = NULL;
+		goto out_null;
+	if (scsi_device_get(cd->device))
+		goto out_put;
+	goto out;
+
+ out_put:
+	kref_put(&cd->kref);
+ out_null:
+	cd = NULL;
  out:
 	up(&sr_ref_sem);
 	return cd;
@@ -147,6 +155,7 @@
 static inline void scsi_cd_put(struct scsi_cd *cd)
 {
 	down(&sr_ref_sem);
+	scsi_device_put(cd->device);
 	kref_put(&cd->kref);
 	up(&sr_ref_sem);
 }
@@ -490,7 +499,7 @@
         switch (cmd) {
                 case SCSI_IOCTL_GET_IDLUN:
                 case SCSI_IOCTL_GET_BUS_NUMBER:
-                        return scsi_ioctl(sdev, cmd, (void *)arg);
+                        return scsi_ioctl(sdev, cmd, (void __user *)arg);
 	}
 	return cdrom_ioctl(&cd->cdi, inode, cmd, arg);
 }
@@ -558,13 +567,10 @@
 	if (sdev->type != TYPE_ROM && sdev->type != TYPE_WORM)
 		goto fail;
 
-	if ((error = scsi_device_get(sdev)) != 0)
-		goto fail;
-
 	error = -ENOMEM;
 	cd = kmalloc(sizeof(*cd), GFP_KERNEL);
 	if (!cd)
-		goto fail_put_sdev;
+		goto fail;
 	memset(cd, 0, sizeof(*cd));
 
 	kref_init(&cd->kref, sr_kref_release);
@@ -637,8 +643,6 @@
 	put_disk(disk);
 fail_free:
 	kfree(cd);
-fail_put_sdev:
-	scsi_device_put(sdev);
 fail:
 	return error;
 }
@@ -904,7 +908,7 @@
  * by the Uniform CD-ROM layer. 
  */
 static int sr_packet(struct cdrom_device_info *cdi,
-		struct cdrom_generic_command *cgc)
+		struct packet_command *cgc)
 {
 	if (cgc->timeout <= 0)
 		cgc->timeout = IOCTL_TIMEOUT;
@@ -926,7 +930,6 @@
 static void sr_kref_release(struct kref *kref)
 {
 	struct scsi_cd *cd = container_of(kref, struct scsi_cd, kref);
-	struct scsi_device *sdev = cd->device;
 	struct gendisk *disk = cd->disk;
 
 	spin_lock(&sr_index_lock);
@@ -940,8 +943,6 @@
 	put_disk(disk);
 
 	kfree(cd);
-
-	scsi_device_put(sdev);
 }
 
 static int sr_remove(struct device *dev)
@@ -950,7 +951,9 @@
 
 	del_gendisk(cd->disk);
 
-	scsi_cd_put(cd);
+	down(&sr_ref_sem);
+	kref_put(&cd->kref);
+	up(&sr_ref_sem);
 
 	return 0;
 }
diff -Nru a/drivers/scsi/sr.h b/drivers/scsi/sr.h
--- a/drivers/scsi/sr.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/scsi/sr.h	Tue Jun 15 22:20:39 2004
@@ -43,7 +43,7 @@
 	struct gendisk *disk;
 } Scsi_CD;
 
-int sr_do_ioctl(Scsi_CD *, struct cdrom_generic_command *);
+int sr_do_ioctl(Scsi_CD *, struct packet_command *);
 
 int sr_lock_door(struct cdrom_device_info *, int);
 int sr_tray_move(struct cdrom_device_info *, int);
diff -Nru a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
--- a/drivers/scsi/sr_ioctl.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/sr_ioctl.c	Tue Jun 15 22:20:42 2004
@@ -34,7 +34,7 @@
 {
 	struct cdrom_tocentry trk0_te, trk1_te;
 	struct cdrom_tochdr tochdr;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	int ntracks, ret;
 
 	if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCHDR, &tochdr)))
@@ -57,7 +57,7 @@
 	if ((ret = sr_audio_ioctl(cdi, CDROMREADTOCENTRY, &trk1_te)))
 		return ret;
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.cmd[0] = GPCMD_PLAY_AUDIO_MSF;
 	cgc.cmd[3] = trk0_te.cdte_addr.msf.minute;
 	cgc.cmd[4] = trk0_te.cdte_addr.msf.second;
@@ -74,7 +74,7 @@
    error code is.  Normally the UNIT_ATTENTION code will automatically
    clear after one error */
 
-int sr_do_ioctl(Scsi_CD *cd, struct cdrom_generic_command *cgc)
+int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
 {
 	struct scsi_request *SRpnt;
 	struct scsi_device *SDev;
@@ -178,9 +178,9 @@
 
 static int test_unit_ready(Scsi_CD *cd)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.cmd[0] = GPCMD_TEST_UNIT_READY;
 	cgc.quiet = 1;
 	cgc.data_direction = SCSI_DATA_NONE;
@@ -191,9 +191,9 @@
 int sr_tray_move(struct cdrom_device_info *cdi, int pos)
 {
 	Scsi_CD *cd = cdi->handle;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.cmd[0] = GPCMD_START_STOP_UNIT;
 	cgc.cmd[4] = (pos == 0) ? 0x03 /* close */ : 0x02 /* eject */ ;
 	cgc.data_direction = SCSI_DATA_NONE;
@@ -269,11 +269,11 @@
 int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn)
 {
 	Scsi_CD *cd = cdi->handle;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
 	int result;
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.cmd[0] = GPCMD_READ_SUBCHANNEL;
 	cgc.cmd[2] = 0x40;	/* I do want the subchannel info */
 	cgc.cmd[3] = 0x02;	/* Give me medium catalog number info */
@@ -299,14 +299,14 @@
 int sr_select_speed(struct cdrom_device_info *cdi, int speed)
 {
 	Scsi_CD *cd = cdi->handle;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 
 	if (speed == 0)
 		speed = 0xffff;	/* set to max */
 	else
 		speed *= 177;	/* Nx to kbyte/s */
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.cmd[0] = GPCMD_SET_SPEED;	/* SET CD SPEED */
 	cgc.cmd[2] = (speed >> 8) & 0xff;	/* MSB for speed (in kbytes/sec) */
 	cgc.cmd[3] = speed & 0xff;	/* LSB */
@@ -327,11 +327,11 @@
 int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg)
 {
 	Scsi_CD *cd = cdi->handle;
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	int result;
 	unsigned char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.timeout = IOCTL_TIMEOUT;
 
 	switch (cmd) {
@@ -428,14 +428,14 @@
 
 static int sr_read_cd(Scsi_CD *cd, unsigned char *dest, int lba, int format, int blksize)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 
 #ifdef DEBUG
 	printk("%s: sr_read_cd lba=%d format=%d blksize=%d\n",
 	       cd->cdi.name, lba, format, blksize);
 #endif
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.cmd[0] = GPCMD_READ_CD;	/* READ_CD */
 	cgc.cmd[1] = ((format & 7) << 2);
 	cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff;
@@ -470,7 +470,7 @@
 
 static int sr_read_sector(Scsi_CD *cd, int lba, int blksize, unsigned char *dest)
 {
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	int rc;
 
 	/* we try the READ CD command first... */
@@ -491,7 +491,7 @@
 	printk("%s: sr_read_sector lba=%d blksize=%d\n", cd->cdi.name, lba, blksize);
 #endif
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.cmd[0] = GPCMD_READ_10;
 	cgc.cmd[2] = (unsigned char) (lba >> 24) & 0xff;
 	cgc.cmd[3] = (unsigned char) (lba >> 16) & 0xff;
@@ -541,5 +541,5 @@
 		 unsigned int cmd, unsigned long arg)
 {
 	Scsi_CD *cd = cdi->handle;
-	return scsi_ioctl(cd->device, cmd, (void *)arg);
+	return scsi_ioctl(cd->device, cmd, (void __user *)arg);
 }
diff -Nru a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c
--- a/drivers/scsi/sr_vendor.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/scsi/sr_vendor.c	Tue Jun 15 22:20:40 2004
@@ -107,7 +107,7 @@
 int sr_set_blocklength(Scsi_CD *cd, int blocklength)
 {
 	unsigned char *buffer;	/* the buffer for the ioctl */
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	struct ccs_modesel_head *modesel;
 	int rc, density = 0;
 
@@ -123,7 +123,7 @@
 #ifdef DEBUG
 	printk("%s: MODE SELECT 0x%x/%d\n", cd->cdi.name, density, blocklength);
 #endif
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 	cgc.cmd[0] = MODE_SELECT;
 	cgc.cmd[1] = (1 << 4);
 	cgc.cmd[4] = 12;
@@ -157,7 +157,7 @@
 	Scsi_CD *cd = cdi->handle;
 	unsigned long sector;
 	unsigned char *buffer;	/* the buffer for the ioctl */
-	struct cdrom_generic_command cgc;
+	struct packet_command cgc;
 	int rc, no_multi;
 
 	if (cd->cdi.mask & CDC_MULTI_SESSION)
@@ -171,7 +171,7 @@
 	no_multi = 0;		/* flag: the drive can't handle multisession */
 	rc = 0;
 
-	memset(&cgc, 0, sizeof(struct cdrom_generic_command));
+	memset(&cgc, 0, sizeof(struct packet_command));
 
 	switch (cd->vendor) {
 
diff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/scsi/st.c	Tue Jun 15 22:20:42 2004
@@ -17,7 +17,7 @@
    Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
  */
 
-static char *verstr = "20040318";
+static char *verstr = "20040403";
 
 #include <linux/module.h>
 
@@ -176,8 +176,8 @@
 static ST_buffer *new_tape_buffer(int, int, int);
 static int enlarge_buffer(ST_buffer *, int, int);
 static void normalize_buffer(ST_buffer *);
-static int append_to_buffer(const char *, ST_buffer *, int);
-static int from_buffer(ST_buffer *, char *, int);
+static int append_to_buffer(const char __user *, ST_buffer *, int);
+static int from_buffer(ST_buffer *, char __user *, int);
 static void move_buffer_data(ST_buffer *, int);
 static void buf_to_sg(ST_buffer *, unsigned int);
 
@@ -486,7 +486,7 @@
 		   tape_name(STp), forward ? "forward" : "backward"));
 
 	SRpnt = st_do_scsi(NULL, STp, cmd, 0, SCSI_DATA_NONE,
-			   STp->timeout, MAX_RETRIES, TRUE);
+			   STp->device->timeout, MAX_RETRIES, TRUE);
 	if (!SRpnt)
 		return (STp->buffer)->syscall_result;
 
@@ -544,7 +544,7 @@
 		cmd[4] = blks;
 
 		SRpnt = st_do_scsi(NULL, STp, cmd, transfer, SCSI_DATA_WRITE,
-				   STp->timeout, MAX_WRITE_RETRIES, TRUE);
+				   STp->device->timeout, MAX_WRITE_RETRIES, TRUE);
 		if (!SRpnt)
 			return (STp->buffer)->syscall_result;
 
@@ -867,7 +867,7 @@
 		memset((void *) &cmd[0], 0, MAX_COMMAND_SIZE);
 		cmd[0] = READ_BLOCK_LIMITS;
 
-		SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, SCSI_DATA_READ, STp->timeout,
+		SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, SCSI_DATA_READ, STp->device->timeout,
 				   MAX_READY_RETRIES, TRUE);
 		if (!SRpnt) {
 			retval = (STp->buffer)->syscall_result;
@@ -894,7 +894,7 @@
 	cmd[0] = MODE_SENSE;
 	cmd[4] = 12;
 
-	SRpnt = st_do_scsi(SRpnt, STp, cmd, 12, SCSI_DATA_READ, STp->timeout,
+	SRpnt = st_do_scsi(SRpnt, STp, cmd, 12, SCSI_DATA_READ, STp->device->timeout,
 			   MAX_READY_RETRIES, TRUE);
 	if (!SRpnt) {
 		retval = (STp->buffer)->syscall_result;
@@ -1031,7 +1031,8 @@
 
 	/* See that we have at least a one page buffer available */
 	if (!enlarge_buffer(STp->buffer, PAGE_SIZE, STp->restr_dma)) {
-		printk(KERN_WARNING "%s: Can't allocate tape buffer.\n", name);
+		printk(KERN_WARNING "%s: Can't allocate one page tape buffer.\n",
+		       name);
 		retval = (-EOVERFLOW);
 		goto err_out;
 	}
@@ -1115,7 +1116,7 @@
 		cmd[4] = 1 + STp->two_fm;
 
 		SRpnt = st_do_scsi(NULL, STp, cmd, 0, SCSI_DATA_NONE,
-				   STp->timeout, MAX_WRITE_RETRIES, TRUE);
+				   STp->device->timeout, MAX_WRITE_RETRIES, TRUE);
 		if (!SRpnt) {
 			result = (STp->buffer)->syscall_result;
 			goto out;
@@ -1275,7 +1276,7 @@
 }
 
 
-static int setup_buffering(Scsi_Tape *STp, const char *buf, size_t count, int is_read)
+static int setup_buffering(Scsi_Tape *STp, const char __user *buf, size_t count, int is_read)
 {
 	int i, bufsize, retval = 0;
 	ST_buffer *STbp = STp->buffer;
@@ -1318,6 +1319,8 @@
 			bufsize = count;
 		if (bufsize > STbp->buffer_size &&
 		    !enlarge_buffer(STbp, bufsize, STp->restr_dma)) {
+			printk(KERN_WARNING "%s: Can't allocate %d byte tape buffer.\n",
+			       tape_name(STp), bufsize);
 			retval = (-EOVERFLOW);
 			goto out;
 		}
@@ -1345,7 +1348,7 @@
 
 /* Write command */
 static ssize_t
- st_write(struct file *filp, const char *buf, size_t count, loff_t * ppos)
+st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 {
 	ssize_t total;
 	ssize_t i, do_count, blks, transfer;
@@ -1353,7 +1356,7 @@
 	int undone, retry_eot = 0, scode;
 	int async_write;
 	unsigned char cmd[MAX_COMMAND_SIZE];
-	const char *b_point;
+	const char __user *b_point;
 	Scsi_Request *SRpnt = NULL;
 	Scsi_Tape *STp = filp->private_data;
 	ST_mode *STm;
@@ -1506,7 +1509,7 @@
 		cmd[4] = blks;
 
 		SRpnt = st_do_scsi(SRpnt, STp, cmd, transfer, SCSI_DATA_WRITE,
-				   STp->timeout, MAX_WRITE_RETRIES, !async_write);
+				   STp->device->timeout, MAX_WRITE_RETRIES, !async_write);
 		if (!SRpnt) {
 			retval = STbp->syscall_result;
 			goto out;
@@ -1676,7 +1679,7 @@
 
 	SRpnt = *aSRpnt;
 	SRpnt = st_do_scsi(SRpnt, STp, cmd, bytes, SCSI_DATA_READ,
-			   STp->timeout, MAX_RETRIES, TRUE);
+			   STp->device->timeout, MAX_RETRIES, TRUE);
 	release_buffering(STp);
 	*aSRpnt = SRpnt;
 	if (!SRpnt)
@@ -1814,7 +1817,7 @@
 
 /* Read command */
 static ssize_t
- st_read(struct file *filp, char *buf, size_t count, loff_t * ppos)
+st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
 {
 	ssize_t total;
 	ssize_t retval = 0;
@@ -1960,26 +1963,29 @@
 
 
 
+DEB(
 /* Set the driver options */
 static void st_log_options(Scsi_Tape * STp, ST_mode * STm, char *name)
 {
-	printk(KERN_INFO
-	       "%s: Mode %d options: buffer writes: %d, async writes: %d, read ahead: %d\n",
-	       name, STp->current_mode, STm->do_buffer_writes, STm->do_async_writes,
-	       STm->do_read_ahead);
-	printk(KERN_INFO
-	       "%s:    can bsr: %d, two FMs: %d, fast mteom: %d, auto lock: %d,\n",
-	       name, STp->can_bsr, STp->two_fm, STp->fast_mteom, STp->do_auto_lock);
-	printk(KERN_INFO
-	       "%s:    defs for wr: %d, no block limits: %d, partitions: %d, s2 log: %d\n",
-	       name, STm->defaults_for_writes, STp->omit_blklims, STp->can_partitions,
-	       STp->scsi2_logical);
-	printk(KERN_INFO
-	       "%s:    sysv: %d nowait: %d\n", name, STm->sysv, STp->immediate);
-        DEB(printk(KERN_INFO
-                   "%s:    debugging: %d\n",
-                   name, debugging);)
+	if (debugging) {
+		printk(KERN_INFO
+		       "%s: Mode %d options: buffer writes: %d, async writes: %d, read ahead: %d\n",
+		       name, STp->current_mode, STm->do_buffer_writes, STm->do_async_writes,
+		       STm->do_read_ahead);
+		printk(KERN_INFO
+		       "%s:    can bsr: %d, two FMs: %d, fast mteom: %d, auto lock: %d,\n",
+		       name, STp->can_bsr, STp->two_fm, STp->fast_mteom, STp->do_auto_lock);
+		printk(KERN_INFO
+		       "%s:    defs for wr: %d, no block limits: %d, partitions: %d, s2 log: %d\n",
+		       name, STm->defaults_for_writes, STp->omit_blklims, STp->can_partitions,
+		       STp->scsi2_logical);
+		printk(KERN_INFO
+		       "%s:    sysv: %d nowait: %d\n", name, STm->sysv, STp->immediate);
+		printk(KERN_INFO "%s:    debugging: %d\n",
+		       name, debugging);
+	}
 }
+	)
 
 
 static int st_set_options(Scsi_Tape *STp, long options)
@@ -2017,8 +2023,8 @@
 		STp->scsi2_logical = (options & MT_ST_SCSI2LOGICAL) != 0;
 		STp->immediate = (options & MT_ST_NOWAIT) != 0;
 		STm->sysv = (options & MT_ST_SYSV) != 0;
-		DEB( debugging = (options & MT_ST_DEBUGGING) != 0; )
-		st_log_options(STp, STm, name);
+		DEB( debugging = (options & MT_ST_DEBUGGING) != 0;
+		     st_log_options(STp, STm, name); )
 	} else if (code == MT_ST_SETBOOLEANS || code == MT_ST_CLEARBOOLEANS) {
 		value = (code == MT_ST_SETBOOLEANS);
 		if ((options & MT_ST_BUFFER_WRITES) != 0)
@@ -2050,19 +2056,19 @@
 			STm->sysv = value;
                 DEB(
 		if ((options & MT_ST_DEBUGGING) != 0)
-			debugging = value; )
-		st_log_options(STp, STm, name);
+			debugging = value;
+			st_log_options(STp, STm, name); )
 	} else if (code == MT_ST_WRITE_THRESHOLD) {
 		/* Retained for compatibility */
 	} else if (code == MT_ST_DEF_BLKSIZE) {
 		value = (options & ~MT_ST_OPTIONS);
 		if (value == ~MT_ST_OPTIONS) {
 			STm->default_blksize = (-1);
-			printk(KERN_INFO "%s: Default block size disabled.\n", name);
+			DEBC( printk(KERN_INFO "%s: Default block size disabled.\n", name));
 		} else {
 			STm->default_blksize = value;
-			printk(KERN_INFO "%s: Default block size set to %d bytes.\n",
-			       name, STm->default_blksize);
+			DEBC( printk(KERN_INFO "%s: Default block size set to %d bytes.\n",
+			       name, STm->default_blksize));
 			if (STp->ready == ST_READY) {
 				STp->blksize_changed = FALSE;
 				set_mode_densblk(STp, STm);
@@ -2072,12 +2078,12 @@
 		value = (options & ~MT_ST_OPTIONS);
 		if ((value & MT_ST_SET_LONG_TIMEOUT) != 0) {
 			STp->long_timeout = (value & ~MT_ST_SET_LONG_TIMEOUT) * HZ;
-			printk(KERN_INFO "%s: Long timeout set to %d seconds.\n", name,
-			       (value & ~MT_ST_SET_LONG_TIMEOUT));
+			DEBC( printk(KERN_INFO "%s: Long timeout set to %d seconds.\n", name,
+			       (value & ~MT_ST_SET_LONG_TIMEOUT)));
 		} else {
-			STp->timeout = value * HZ;
-			printk(KERN_INFO "%s: Normal timeout set to %d seconds.\n",
-                               name, value);
+			STp->device->timeout = value * HZ;
+			DEBC( printk(KERN_INFO "%s: Normal timeout set to %d seconds.\n",
+				name, value) );
 		}
 	} else if (code == MT_ST_SET_CLN) {
 		value = (options & ~MT_ST_OPTIONS) & 0xff;
@@ -2096,12 +2102,12 @@
 		if (code == MT_ST_DEF_DENSITY) {
 			if (value == MT_ST_CLEAR_DEFAULT) {
 				STm->default_density = (-1);
-				printk(KERN_INFO "%s: Density default disabled.\n",
-                                       name);
+				DEBC( printk(KERN_INFO "%s: Density default disabled.\n",
+                                       name));
 			} else {
 				STm->default_density = value & 0xff;
-				printk(KERN_INFO "%s: Density default set to %x\n",
-				       name, STm->default_density);
+				DEBC( printk(KERN_INFO "%s: Density default set to %x\n",
+				       name, STm->default_density));
 				if (STp->ready == ST_READY) {
 					STp->density_changed = FALSE;
 					set_mode_densblk(STp, STm);
@@ -2110,31 +2116,31 @@
 		} else if (code == MT_ST_DEF_DRVBUFFER) {
 			if (value == MT_ST_CLEAR_DEFAULT) {
 				STp->default_drvbuffer = 0xff;
-				printk(KERN_INFO
-                                       "%s: Drive buffer default disabled.\n", name);
+				DEBC( printk(KERN_INFO
+                                       "%s: Drive buffer default disabled.\n", name));
 			} else {
 				STp->default_drvbuffer = value & 7;
-				printk(KERN_INFO
+				DEBC( printk(KERN_INFO
                                        "%s: Drive buffer default set to %x\n",
-				       name, STp->default_drvbuffer);
+				       name, STp->default_drvbuffer));
 				if (STp->ready == ST_READY)
 					st_int_ioctl(STp, MTSETDRVBUFFER, STp->default_drvbuffer);
 			}
 		} else if (code == MT_ST_DEF_COMPRESSION) {
 			if (value == MT_ST_CLEAR_DEFAULT) {
 				STm->default_compression = ST_DONT_TOUCH;
-				printk(KERN_INFO
-                                       "%s: Compression default disabled.\n", name);
+				DEBC( printk(KERN_INFO
+                                       "%s: Compression default disabled.\n", name));
 			} else {
 				if ((value & 0xff00) != 0) {
 					STp->c_algo = (value & 0xff00) >> 8;
-					printk(KERN_INFO "%s: Compression algorithm set to 0x%x.\n",
-					       name, STp->c_algo);
+					DEBC( printk(KERN_INFO "%s: Compression algorithm set to 0x%x.\n",
+					       name, STp->c_algo));
 				}
 				if ((value & 0xff) != 0xff) {
 					STm->default_compression = (value & 1 ? ST_YES : ST_NO);
-					printk(KERN_INFO "%s: Compression default set to %x\n",
-					       name, (value & 1));
+					DEBC( printk(KERN_INFO "%s: Compression default set to %x\n",
+					       name, (value & 1)));
 					if (STp->ready == ST_READY) {
 						STp->compression_changed = FALSE;
 						st_compression(STp, (STm->default_compression == ST_YES));
@@ -2183,7 +2189,7 @@
 	cmd[4] = 255;
 
 	SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], SCSI_DATA_READ,
-			   STp->timeout, 0, TRUE);
+			   STp->device->timeout, 0, TRUE);
 	if (SRpnt == NULL)
 		return (STp->buffer)->syscall_result;
 
@@ -2214,7 +2220,7 @@
 	(STp->buffer)->b_data[pgo + MP_OFF_PAGE_NBR] &= MP_MSK_PAGE_NBR;
 
 	SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], SCSI_DATA_WRITE,
-			   (slow ? STp->long_timeout : STp->timeout), 0, TRUE);
+			   (slow ? STp->long_timeout : STp->device->timeout), 0, TRUE);
 	if (SRpnt == NULL)
 		return (STp->buffer)->syscall_result;
 
@@ -2326,7 +2332,7 @@
 	}
 	if (STp->immediate) {
 		cmd[1] = 1;	/* Don't wait for completion */
-		timeout = STp->timeout;
+		timeout = STp->device->timeout;
 	}
 	else
 		timeout = STp->long_timeout;
@@ -2506,7 +2512,7 @@
 		cmd[2] = (arg >> 16);
 		cmd[3] = (arg >> 8);
 		cmd[4] = arg;
-		timeout = STp->timeout;
+		timeout = STp->device->timeout;
                 DEBC(
                      if (cmd_in == MTWEOF)
                                printk(ST_DEB_MSG "%s: Writing %d filemarks.\n", name,
@@ -2524,7 +2530,7 @@
 		cmd[0] = REZERO_UNIT;
 		if (STp->immediate) {
 			cmd[1] = 1;	/* Don't wait for completion */
-			timeout = STp->timeout;
+			timeout = STp->device->timeout;
 		}
                 DEBC(printk(ST_DEB_MSG "%s: Rewinding tape.\n", name));
 		fileno = blkno = at_sm = 0;
@@ -2537,7 +2543,7 @@
 		cmd[0] = START_STOP;
 		if (STp->immediate) {
 			cmd[1] = 1;	/* Don't wait for completion */
-			timeout = STp->timeout;
+			timeout = STp->device->timeout;
 		}
 		cmd[4] = 3;
                 DEBC(printk(ST_DEB_MSG "%s: Retensioning tape.\n", name));
@@ -2570,7 +2576,7 @@
 		cmd[1] = (arg ? 1 : 0);	/* Long erase with non-zero argument */
 		if (STp->immediate) {
 			cmd[1] |= 2;	/* Don't wait for completion */
-			timeout = STp->timeout;
+			timeout = STp->device->timeout;
 		}
 		else
 			timeout = STp->long_timeout * 8;
@@ -2622,7 +2628,7 @@
 		(STp->buffer)->b_data[9] = (ltmp >> 16);
 		(STp->buffer)->b_data[10] = (ltmp >> 8);
 		(STp->buffer)->b_data[11] = ltmp;
-		timeout = STp->timeout;
+		timeout = STp->device->timeout;
                 DEBC(
 			if (cmd_in == MTSETBLK || cmd_in == SET_DENS_AND_BLK)
 				printk(ST_DEB_MSG
@@ -2803,7 +2809,7 @@
 		if (!logical && !STp->scsi2_logical)
 			scmd[1] = 1;
 	}
-	SRpnt = st_do_scsi(NULL, STp, scmd, 20, SCSI_DATA_READ, STp->timeout,
+	SRpnt = st_do_scsi(NULL, STp, scmd, 20, SCSI_DATA_READ, STp->device->timeout,
 			   MAX_READY_RETRIES, TRUE);
 	if (!SRpnt)
 		return (STp->buffer)->syscall_result;
@@ -2905,7 +2911,7 @@
 	}
 	if (STp->immediate) {
 		scmd[1] |= 1;		/* Don't wait for completion */
-		timeout = STp->timeout;
+		timeout = STp->device->timeout;
 	}
 
 	SRpnt = st_do_scsi(NULL, STp, scmd, 0, SCSI_DATA_NONE,
@@ -3103,6 +3109,7 @@
 	ST_mode *STm;
 	ST_partstat *STps;
 	char *name = tape_name(STp);
+	void __user *p = (void __user *)arg;
 
 	if (down_interruptible(&STp->lock))
 		return -ERESTARTSYS;
@@ -3138,7 +3145,7 @@
 			goto out;
 		}
 
-		i = copy_from_user((char *) &mtc, (char *) arg, sizeof(struct mtop));
+		i = copy_from_user(&mtc, p, sizeof(struct mtop));
 		if (i) {
 			retval = (-EFAULT);
 			goto out;
@@ -3374,8 +3381,7 @@
 		if (STp->cleaning_req)
 			mt_status.mt_gstat |= GMT_CLN(0xffffffff);
 
-		i = copy_to_user((char *) arg, (char *) &(mt_status),
-				 sizeof(struct mtget));
+		i = copy_to_user(p, &mt_status, sizeof(struct mtget));
 		if (i) {
 			retval = (-EFAULT);
 			goto out;
@@ -3396,17 +3402,23 @@
 			goto out;
 		}
 		mt_pos.mt_blkno = blk;
-		i = copy_to_user((char *) arg, (char *) (&mt_pos), sizeof(struct mtpos));
+		i = copy_to_user(p, &mt_pos, sizeof(struct mtpos));
 		if (i)
 			retval = (-EFAULT);
 		goto out;
 	}
 	up(&STp->lock);
-	i = scsi_cmd_ioctl(STp->disk, cmd_in, arg);
-	if (i != -ENOTTY)
-		return i;
-	else
-		return scsi_ioctl(STp->device, cmd_in, (void *) arg);
+	switch (cmd_in) {
+		case SCSI_IOCTL_GET_IDLUN:
+		case SCSI_IOCTL_GET_BUS_NUMBER:
+			break;
+		default:
+			i = scsi_cmd_ioctl(STp->disk, cmd_in, p);
+			if (i != -ENOTTY)
+				return i;
+			break;
+	}
+	return scsi_ioctl(STp->device, cmd_in, p);
 
  out:
 	up(&STp->lock);
@@ -3465,7 +3477,7 @@
 	if (nbr <= 0)
 		return FALSE;
 
-	priority = GFP_KERNEL;
+	priority = GFP_KERNEL | __GFP_NOWARN;
 	if (need_dma)
 		priority |= GFP_DMA;
 	for (b_size = PAGE_SIZE, order=0;
@@ -3482,8 +3494,6 @@
 				order--;
 				continue;
 			}
-			printk(KERN_NOTICE "st: failed to enlarge buffer to %d bytes.\n",
-			       new_size);
 			DEB(STbuffer->buffer_size = got);
 			normalize_buffer(STbuffer);
 			return FALSE;
@@ -3495,9 +3505,6 @@
 		segs++;
 	}
 	STbuffer->b_data = page_address(STbuffer->frp[0].page);
-        DEBC(printk(ST_DEB_MSG
-                    "st: Succeeded to enlarge buffer at %p to %d bytes (segs %d->%d, %d).\n",
-                    STbuffer, got, STbuffer->orig_frp_segs, STbuffer->frp_segs, b_size));
 
 	return TRUE;
 }
@@ -3513,11 +3520,6 @@
 		__free_pages(STbuffer->frp[i].page, order);
 		STbuffer->buffer_size -= STbuffer->frp[i].length;
 	}
-        DEB(
-	if (debugging && STbuffer->orig_frp_segs < STbuffer->frp_segs)
-		printk(ST_DEB_MSG "st: Buffer at %p normalized to %d bytes (segs %d->%d).\n",
-		       STbuffer, STbuffer->buffer_size, STbuffer->frp_segs, STbuffer->orig_frp_segs);
-        ) /* end DEB */
 	STbuffer->frp_segs = STbuffer->orig_frp_segs;
 	STbuffer->frp_sg_current = 0;
 }
@@ -3525,7 +3527,7 @@
 
 /* Move data from the user buffer to the tape buffer. Returns zero (success) or
    negative error code. */
-static int append_to_buffer(const char *ubp, ST_buffer * st_bp, int do_count)
+static int append_to_buffer(const char __user *ubp, ST_buffer * st_bp, int do_count)
 {
 	int i, cnt, res, offset;
 
@@ -3547,18 +3549,16 @@
 		ubp += cnt;
 		offset = 0;
 	}
-	if (do_count) {		/* Should never happen */
-		printk(KERN_WARNING "st: append_to_buffer overflow (left %d).\n",
-		       do_count);
+	if (do_count) /* Should never happen */
 		return (-EIO);
-	}
+
 	return 0;
 }
 
 
 /* Move data from the tape buffer to the user buffer. Returns zero (success) or
    negative error code. */
-static int from_buffer(ST_buffer * st_bp, char *ubp, int do_count)
+static int from_buffer(ST_buffer * st_bp, char __user *ubp, int do_count)
 {
 	int i, cnt, res, offset;
 
@@ -3581,11 +3581,9 @@
 		ubp += cnt;
 		offset = 0;
 	}
-	if (do_count) {		/* Should never happen */
-		printk(KERN_WARNING "st: from_buffer overflow (left %d).\n",
-		       do_count);
+	if (do_count) /* Should never happen */
 		return (-EIO);
-	}
+
 	return 0;
 }
 
@@ -3606,10 +3604,6 @@
 			break;
 		offset -= st_bp->frp[src_seg].length;
 	}
-	if (src_seg == st_bp->frp_segs) {	/* Should never happen */
-		printk(KERN_WARNING "st: move_buffer offset overflow.\n");
-		return;
-	}
 
 	st_bp->buffer_bytes = st_bp->read_pointer = total;
 	for (dst_seg=dst_offset=0; total > 0; ) {
@@ -3844,7 +3838,7 @@
 	tpnt->partition = 0;
 	tpnt->new_partition = 0;
 	tpnt->nbr_partitions = 0;
-	tpnt->timeout = ST_TIMEOUT;
+	tpnt->device->timeout = ST_TIMEOUT;
 	tpnt->long_timeout = ST_LONG_TIMEOUT;
 	tpnt->try_dio = try_direct_io && !SDp->host->unchecked_isa_dma;
 
diff -Nru a/drivers/scsi/st.h b/drivers/scsi/st.h
--- a/drivers/scsi/st.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/scsi/st.h	Tue Jun 15 22:20:43 2004
@@ -100,7 +100,6 @@
 	unsigned char c_algo;			/* compression algorithm */
 	unsigned char pos_unknown;			/* after reset position unknown */
 	int tape_type;
-	int timeout;		/* timeout for normal commands */
 	int long_timeout;	/* timeout for commands known to take long time */
 
 	unsigned long max_pfn;	/* the maximum page number reachable by the HBA */
diff -Nru a/drivers/scsi/sym53c8xx_comm.h b/drivers/scsi/sym53c8xx_comm.h
--- a/drivers/scsi/sym53c8xx_comm.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/scsi/sym53c8xx_comm.h	Tue Jun 15 22:20:41 2004
@@ -59,11 +59,8 @@
 **	sym53c8xx and ncr53c8xx drivers should share.
 **	The sharing will be achieved in a further version  
 **	of the driver bundle. For now, only the ncr53c8xx 
-**	driver includes	this file.
+**	driver includes this file.
 */
-
-#define MIN(a,b)        (((a) < (b)) ? (a) : (b))
-#define MAX(a,b)        (((a) > (b)) ? (a) : (b))
 
 /*==========================================================
 **
diff -Nru a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
--- a/drivers/scsi/tmscsim.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/scsi/tmscsim.c	Tue Jun 15 22:21:05 2004
@@ -168,6 +168,10 @@
  *	2.1a  03/11/29  GL, KG	Initial fixing for 2.6. Convert to	*
  *				use the current PCI-mapping API, update	*
  *				command-queuing.			*
+ *	2.1b  04/04/13  GL	Fix for 64-bit platforms		*
+ *	2.1b1 04/01/31	GL	(applied 05.04) Remove internal		*
+ *				command-queuing.			*
+ *	2.1b2 04/02/01	CH	(applied 05.04) Fix error-handling	*
  ***********************************************************************/
 
 /* Uncomment SA_INTERRUPT, if the driver refuses to share its IRQ with other devices */
@@ -260,16 +264,10 @@
  * undef  : traditional save_flags; cli; restore_flags;
  */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30)
-# include <linux/init.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
-# include <linux/spinlock.h>
-#else
-# include <asm/spinlock.h>
-#endif
-#endif
+#include <linux/init.h>
+#include <linux/spinlock.h>
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,99) && defined(MODULE)
+#if defined(MODULE)
 static struct pci_device_id tmscsim_pci_tbl[] = {
 	{
 		.vendor		= PCI_VENDOR_ID_AMD,
@@ -283,23 +281,10 @@
 #endif
 	
 #define USE_SPINLOCKS 1
-#define NEW_PCI 1
 
-#define DC390_AFLAGS 
 #define DC390_IFLAGS unsigned long iflags
-#define DC390_DFLAGS unsigned long dflags
-spinlock_t dc390_drvlock = SPIN_LOCK_UNLOCKED;
 #define DC390_LOCK_IO(dev) spin_lock_irqsave (((struct Scsi_Host *)dev)->host_lock, iflags)
 #define DC390_UNLOCK_IO(dev) spin_unlock_irqrestore (((struct Scsi_Host *)dev)->host_lock, iflags)
-#define DC390_LOCK_DRV spin_lock_irqsave (&dc390_drvlock, dflags)
-#define DC390_UNLOCK_DRV spin_unlock_irqrestore (&dc390_drvlock, dflags)
-#define DC390_LOCK_DRV_NI spin_lock (&dc390_drvlock)
-#define DC390_UNLOCK_DRV_NI spin_unlock (&dc390_drvlock)
-#define DC390_LOCK_ACB /* DC390_LOCK_IO */
-#define DC390_UNLOCK_ACB /* DC390_UNLOCK_IO */
-#define DC390_LOCK_ACB_NI /* spin_lock (&(pACB->lock)) */
-#define DC390_UNLOCK_ACB_NI /* spin_unlock (&(pACB->lock)) */
-#define DC390_LOCKA_INIT /* DC390_LOCKA_INIT */
 
 /* These macros are used for uniform access to 2.0.x and 2.1.x PCI config space*/
 
@@ -313,10 +298,7 @@
 #define PCI_READ_CONFIG_BYTE(pd, rv, bv) pci_read_config_byte (pd, rv, bv)
 #define PCI_WRITE_CONFIG_WORD(pd, rv, bv) pci_write_config_word (pd, rv, bv)
 #define PCI_READ_CONFIG_WORD(pd, rv, bv) pci_read_config_word (pd, rv, bv)
-#define PCI_BUS_DEV pdev->bus->number, pdev->devfn
 #define PCI_PRESENT (1)
-#define PCI_SET_MASTER pci_set_master (pdev)
-#define PCI_FIND_DEVICE(vend, id) (pdev = pci_find_device (vend, id, pdev))
 #define PCI_GET_IO_AND_IRQ do{io_port = pci_resource_start (pdev, 0); irq = pdev->irq;} while(0)
 
 #include "tmscsim.h"
@@ -325,46 +307,42 @@
 # define __init
 #endif
 
-UCHAR dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB );
-void dc390_DataOut_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
-void dc390_DataIn_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
+static UCHAR dc390_StartSCSI( PACB pACB, PDCB pDCB, PSRB pSRB );
+static void dc390_DataOut_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
+static void dc390_DataIn_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_Command_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_Status_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_MsgOut_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
-void dc390_MsgIn_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
+static void dc390_MsgIn_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_DataOutPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_DataInPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus);
-void dc390_CommandPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus);
+static void dc390_CommandPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_StatusPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus);
-void dc390_MsgOutPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus);
+static void dc390_MsgOutPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_MsgInPhase( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_Nop_0( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 static void dc390_Nop_1( PACB pACB, PSRB pSRB, PUCHAR psstatus);
 
 static void dc390_SetXferRate( PACB pACB, PDCB pDCB );
-void dc390_Disconnect( PACB pACB );
-void dc390_Reselect( PACB pACB );
-void dc390_SRBdone( PACB pACB, PDCB pDCB, PSRB pSRB );
-void dc390_DoingSRB_Done( PACB pACB, PSCSICMD cmd );
+static void dc390_Disconnect( PACB pACB );
+static void dc390_Reselect( PACB pACB );
+static void dc390_SRBdone( PACB pACB, PDCB pDCB, PSRB pSRB );
+static void dc390_DoingSRB_Done( PACB pACB, PSCSICMD cmd );
 static void dc390_ScsiRstDetect( PACB pACB );
 static void dc390_ResetSCSIBus( PACB pACB );
 static void __inline__ dc390_RequestSense( PACB pACB, PDCB pDCB, PSRB pSRB );
 static void __inline__ dc390_InvalidCmd( PACB pACB );
 static void __inline__ dc390_EnableMsgOut_Abort (PACB, PSRB);
 static void dc390_remove_dev (PACB pACB, PDCB pDCB);
-irqreturn_t do_DC390_Interrupt( int, void *, struct pt_regs *);
+static irqreturn_t do_DC390_Interrupt( int, void *, struct pt_regs *);
 
-int    dc390_initAdapter( PSH psh, ULONG io_port, UCHAR Irq, UCHAR index );
-void   dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun);
-void   dc390_updateDCB (PACB pACB, PDCB pDCB);
+static int    dc390_initAdapter( PSH psh, ULONG io_port, UCHAR Irq, UCHAR index );
+static void   dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun);
+static void   dc390_updateDCB (PACB pACB, PDCB pDCB);
 
 static int DC390_release(struct Scsi_Host *host);
 static int dc390_shutdown (struct Scsi_Host *host);
 
-
-//static PSHT	dc390_pSHT_start = NULL;
-//static PSH	dc390_pSH_start = NULL;
-//static PSH	dc390_pSH_current = NULL;
 static PACB	dc390_pACB_start= NULL;
 static PACB	dc390_pACB_current = NULL;
 static ULONG	dc390_lastabortedpid = 0;
@@ -372,14 +350,11 @@
 static UCHAR	dc390_adapterCnt = 0;
 
 /* Startup values, to be overriden on the commandline */
-int tmscsim[] = {-2, -2, -2, -2, -2, -2};
+static int tmscsim[] = {-2, -2, -2, -2, -2, -2};
 
-# if defined(MODULE) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30)
+#if defined(MODULE)
 MODULE_PARM(tmscsim, "1-6i");
 MODULE_PARM_DESC(tmscsim, "Host SCSI ID, Speed (0=10MHz), Device Flags, Adapter Flags, Max Tags (log2(tags)-1), DelayReset (s)");
-# endif
-
-#if defined(MODULE) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30)
 MODULE_AUTHOR("C.L. Huang / Kurt Garloff");
 MODULE_DESCRIPTION("SCSI host adapter driver for Tekram DC390 and other AMD53C974A based PCI SCSI adapters");
 MODULE_LICENSE("GPL");
@@ -438,22 +413,15 @@
 #endif   
 
 /* Devices erroneously pretending to be able to do TagQ */
-UCHAR  dc390_baddevname1[2][28] ={
+static UCHAR  dc390_baddevname1[2][28] ={
        "SEAGATE ST3390N         9546",
        "HP      C3323-300       4269"};
 #define BADDEVCNT	2
 
 static char*  dc390_adapname = "DC390";
-UCHAR  dc390_eepromBuf[MAX_ADAPTER_NUM][EE_LEN];
-UCHAR  dc390_clock_period1[] = {4, 5, 6, 7, 8, 10, 13, 20};
-UCHAR  dc390_clock_speed[] = {100,80,67,57,50, 40, 31, 20};
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,30)
-struct proc_dir_entry	DC390_proc_scsi_tmscsim ={
-       PROC_SCSI_DC390T, 7 ,"tmscsim",
-       S_IFDIR | S_IRUGO | S_IXUGO, 2
-       };
-#endif
+static UCHAR  dc390_eepromBuf[MAX_ADAPTER_NUM][EE_LEN];
+static UCHAR  dc390_clock_period1[] = {4, 5, 6, 7, 8, 10, 13, 20};
+static UCHAR  dc390_clock_speed[] = {100,80,67,57,50, 40, 31, 20};
 
 /***********************************************************************
  * Functions for access to DC390 EEPROM
@@ -518,7 +486,7 @@
 }
 
 
-int __initdata tmscsim_def[] = {7, 0 /* 10MHz */,
+static int __initdata tmscsim_def[] = {7, 0 /* 10MHz */,
 		PARITY_CHK_ | SEND_START_ | EN_DISCONNECT_
 		| SYNC_NEGO_ | TAG_QUEUEING_,
 		MORE2_DRV | GREATER_1G | RST_SCSI_BUS | ACTIVE_NEGATION
@@ -549,8 +517,7 @@
 /* Override defaults on cmdline:
  * tmscsim: AdaptID, MaxSpeed (Index), DevMode (Bitmapped), AdaptMode (Bitmapped)
  */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,13)
-int __init dc390_setup (char *str)
+static int __init dc390_setup (char *str)
 {	
 	int ints[8];
 	int i, im;
@@ -570,24 +537,6 @@
 __setup("tmscsim=", dc390_setup);
 #endif
 
-#else
-void __init dc390_setup (char *str, int *ints)
-{
-	int i, im;
-	im = ints[0];
-	if (im > 6)
-	{
-		printk (KERN_NOTICE "DC390: ignore extra params!\n");
-		im = 6;
-	}
-	for (i = 0; i < im; i++)
-		tmscsim[i] = ints[i+1];
-	/* dc390_checkparams (); */
-}
-#endif
-
-
-
 static void __init dc390_EEpromOutDI( PDEVDECL, PUCHAR regval, UCHAR Carry )
 {
     UCHAR bval;
@@ -751,37 +700,6 @@
     return q;
 }
 #endif
-    
-
-/* Append to Query List */
-static void dc390_Query_append( PSCSICMD cmd, PACB pACB )
-{
-	dc390_cmd_scp_t *cmdq = (dc390_cmd_scp_t *)&cmd->SCp;
-
-	DEBUG0(printk ("DC390: Append cmd %li to Query\n", cmd->pid));
-
-	list_add_tail(&cmdq->list, &pACB->cmdq);
-	pACB->QueryCnt++;
-	pACB->CmdOutOfSRB++;
-}
-
-
-/* Return next cmd from Query list */
-static PSCSICMD dc390_Query_get ( PACB pACB )
-{
-	PSCSICMD  pcmd;
-	dc390_cmd_scp_t *cmdq;
-	if (list_empty(&pACB->cmdq))
-		return NULL;
-
-	pcmd = (PSCSICMD) list_entry(pACB->cmdq.next, struct scsi_cmnd_list, scp.list);
-	DEBUG0(printk ("DC390: Get cmd %li from Query\n", pcmd->pid));
-	cmdq = (dc390_cmd_scp_t *)&pcmd->SCp;
-	list_del(&cmdq->list);
-	pACB->QueryCnt--;
-	return pcmd;
-}
-
 
 /* Return next free SRB */
 static __inline__ PSRB dc390_Free_get ( PACB pACB )
@@ -891,17 +809,7 @@
 	dc390_Going_append (pDCB, pSRB);
 }
 
-/* 2.0 timer compatibility */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,30)
- static inline int timer_pending(struct timer_list * timer)
- {
-	return timer->prev != NULL;
- }
- #define time_after(a,b)         ((long)(b) - (long)(a) < 0)
- #define time_before(a,b)        time_after(b,a)
-#endif
-
-void DC390_waiting_timed_out (unsigned long ptr);
+static void DC390_waiting_timed_out (unsigned long ptr);
 /* Sets the timer to wake us up */
 static void dc390_waiting_timer (PACB pACB, unsigned long to)
 {
@@ -954,16 +862,13 @@
 }
 
 /* Wake up waiting queue */
-void DC390_waiting_timed_out (unsigned long ptr)
+static void DC390_waiting_timed_out (unsigned long ptr)
 {
 	PACB pACB = (PACB)ptr;
 	DC390_IFLAGS;
-	DC390_AFLAGS;
 	DEBUG0(printk ("DC390: Debug: Waiting queue woken up by timer!\n"));
 	DC390_LOCK_IO(pACB->pScsiHost);
-	DC390_LOCK_ACB;
 	dc390_Waiting_process (pACB);
-	DC390_UNLOCK_ACB;
 	DC390_UNLOCK_IO(pACB->pScsiHost);
 }
 
@@ -1022,7 +927,7 @@
 			pci_map_page(pdev, virt_to_page(pcmd->sense_buffer),
 				     (unsigned long)pcmd->sense_buffer & ~PAGE_MASK, sizeof(pcmd->sense_buffer),
 				     DMA_FROM_DEVICE);
-		pSRB->Segmentx.length = sizeof(pcmd->sense_buffer);
+		sg_dma_len(&pSRB->Segmentx) = sizeof(pcmd->sense_buffer);
 		pSRB->SGcount = 1;
 		pSRB->pSegmentList = (PSGL) &pSRB->Segmentx;
 		DEBUG1(printk("%s(): Mapped sense buffer %p at %x\n", __FUNCTION__, pcmd->sense_buffer, cmdp->saved_dma_handle));
@@ -1043,7 +948,7 @@
 				     (unsigned long)pcmd->request_buffer & ~PAGE_MASK,
 				     pcmd->request_bufflen, scsi_to_pci_dma_dir(pcmd->sc_data_direction));
 		/* TODO: error handling */
-		pSRB->Segmentx.length = pcmd->request_bufflen;
+		sg_dma_len(&pSRB->Segmentx) = pcmd->request_bufflen;
 		pSRB->SGcount = 1;
 		pSRB->pSegmentList = (PSGL) &pSRB->Segmentx;
 		DEBUG1(printk("%s(): Mapped request buffer %p at %x\n", __FUNCTION__, pcmd->request_buffer, cmdp->saved_dma_handle));
@@ -1113,37 +1018,6 @@
     /* KG: deferred PCI mapping to dc390_StartSCSI */
 }
 
-/* Put cmnd from Query to Waiting list and send next Waiting cmnd */
-static void dc390_Query_to_Waiting (PACB pACB)
-{
-    Scsi_Cmnd *pcmd;
-    PSRB   pSRB;
-    PDCB   pDCB;
-
-    if( pACB->ACBFlag & (RESET_DETECT+RESET_DONE+RESET_DEV) )
-	return;
-
-    while (pACB->QueryCnt)
-    {
-	pSRB = dc390_Free_get ( pACB );
-	if (!pSRB) return;
-	pcmd = dc390_Query_get ( pACB );
-	if (!pcmd) { dc390_Free_insert (pACB, pSRB); return; } /* should not happen */
-	pDCB = dc390_findDCB (pACB, pcmd->device->id, pcmd->device->lun);
-	if (!pDCB) 
-	{ 
-		dc390_Free_insert (pACB, pSRB);
-		printk (KERN_ERR "DC390: Command in queue to non-existing device!\n");
-		pcmd->result = MK_RES(DRIVER_ERROR,DID_ERROR,0,0);
-		DC390_UNLOCK_ACB_NI;
-		pcmd->done (pcmd);
-		DC390_LOCK_ACB_NI;
-	}
-	dc390_BuildSRB (pcmd, pDCB, pSRB);
-	dc390_Waiting_append ( pDCB, pSRB );
-    }
-}
-
 /***********************************************************************
  * Function : static int DC390_queue_command (Scsi_Cmnd *cmd,
  *					       void (*done)(Scsi_Cmnd *))
@@ -1163,24 +1037,17 @@
  *
  ***********************************************************************/
 
-int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
+static int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
 {
     PDCB   pDCB;
     PSRB   pSRB;
     PACB   pACB = (PACB) cmd->device->host->hostdata;
-    DC390_AFLAGS;
-
 
     DEBUG0(/*  if(pACB->scan_devices) */	\
 	printk(KERN_INFO "DC390: Queue Cmd=%02x,Tgt=%d,LUN=%d (pid=%li), buffer=%p\n",\
 	       cmd->cmnd[0],cmd->device->id,cmd->device->lun,cmd->pid, cmd->buffer));
 
-    DC390_LOCK_ACB;
-    
-    /* Assume BAD_TARGET; will be cleared later */
-    cmd->result = DID_BAD_TARGET << 16;
-   
-    /* TODO: Change the policy: Alway accept TEST_UNIT_READY or INQUIRY 
+    /* TODO: Change the policy: Always accept TEST_UNIT_READY or INQUIRY 
      * commands and alloc a DCB for the device if not yet there. DCB will
      * be removed in dc390_SRBdone if SEL_TIMEOUT */
 
@@ -1190,17 +1057,6 @@
     else if( (pACB->scan_devices) && (cmd->cmnd[0] == READ_6) )
 	pACB->scan_devices = 0;
 
-    if ( ( cmd->device->id >= pACB->pScsiHost->max_id ) || 
-	 (cmd->device->lun >= pACB->pScsiHost->max_lun) )
-    {
-/*	printk ("DC390: Ignore target %d lun %d\n",
-		cmd->device->id, cmd->device->lun); */
-	DC390_UNLOCK_ACB;
-	//return (1);
-	done (cmd);
-	return (0);
-    }
-
     if( (pACB->scan_devices || cmd->cmnd[0] == TEST_UNIT_READY || cmd->cmnd[0] == INQUIRY) && 
        !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun)) )
     {
@@ -1211,14 +1067,7 @@
 	  {
 	    printk (KERN_ERR "DC390: kmalloc for DCB failed, target %02x lun %02x\n", 
 		    cmd->device->id, cmd->device->lun);
-	    DC390_UNLOCK_ACB;
-	    printk ("DC390: No DCB in queue_command!\n");
-#ifdef USE_NEW_EH
-	    return (1);
-#else
-	    done (cmd);
-	    return (0);
-#endif
+	    goto fail;
 	  }
             
     }
@@ -1226,10 +1075,7 @@
     {
 	printk(KERN_INFO "DC390: Ignore target %02x lun %02x\n",
 		cmd->device->id, cmd->device->lun); 
-	DC390_UNLOCK_ACB;
-	//return (1);
-	done (cmd);
-	return (0);
+	goto fail;
     }
     else
     {
@@ -1238,60 +1084,34 @@
 	 {  /* should never happen */
 	    printk (KERN_ERR "DC390: no DCB failed, target %02x lun %02x\n", 
 		    cmd->device->id, cmd->device->lun);
-	    DC390_UNLOCK_ACB;
-	    printk ("DC390: No DCB in queuecommand (2)!\n");
-#ifdef USE_NEW_EH
-	    return (1);
-#else
-	    done (cmd);
-	    return (0);
-#endif
+	    goto fail;
 	 }
     }
 
     pACB->Cmds++;
     cmd->scsi_done = done;
     cmd->result = 0;
-	
-    dc390_Query_to_Waiting (pACB);
 
-    if( pACB->QueryCnt ) /* Unsent commands ? */
-    {
-	DEBUG0(printk ("DC390: QueryCnt != 0\n"));
-	dc390_Query_append ( cmd, pACB );
-	dc390_Waiting_process (pACB);
-    }
-    else if (pDCB->pWaitingSRB)
-    {
- 	pSRB = dc390_Free_get ( pACB );
-	DEBUG0(if (!pSRB) printk ("DC390: No free SRB but Waiting\n"); else printk ("DC390: Free SRB w/ Waiting\n"));
-	if (!pSRB) dc390_Query_append (cmd, pACB);
-	else 
-	  {
-	    dc390_BuildSRB (cmd, pDCB, pSRB);
-	    dc390_Waiting_append (pDCB, pSRB);
-	  }
-	dc390_Waiting_process (pACB);
-    }
-    else
-    {
- 	pSRB = dc390_Free_get ( pACB );
-	DEBUG0(if (!pSRB) printk ("DC390: No free SRB w/o Waiting\n"); else printk ("DC390: Free SRB w/o Waiting\n"));
-	if (!pSRB)
-	{
-	    dc390_Query_append (cmd, pACB);
-	    dc390_Waiting_process (pACB);
-	}
-	else 
-	{
-	    dc390_BuildSRB (cmd, pDCB, pSRB);
-	    dc390_SendSRB (pACB, pSRB);
-	}
-    }
+    pSRB = dc390_Free_get(pACB);
+    if (!pSRB)
+	    goto requeue;
+
+    dc390_BuildSRB(cmd, pDCB, pSRB);
+    if (pDCB->pWaitingSRB) {
+	    dc390_Waiting_append(pDCB, pSRB);
+	    dc390_Waiting_process(pACB);
+    } else
+	    dc390_SendSRB(pACB, pSRB);
 
-    DC390_UNLOCK_ACB;
     DEBUG1(printk (KERN_DEBUG " ... command (pid %li) queued successfully.\n", cmd->pid));
     return(0);
+
+ requeue:
+    return 1;
+ fail:
+    cmd->result = DID_BAD_TARGET << 16;
+    done(cmd);
+    return 0;
 }
 
 /* We ignore mapping problems, as we expect everybody to respect 
@@ -1384,8 +1204,8 @@
  * Note:
  *   In contrary to other externally callable funcs (DC390_), we don't lock
  ***********************************************************************/
-int DC390_bios_param (struct scsi_device *sdev, struct block_device *bdev,
-		sector_t capacity, int geom[])
+static int DC390_bios_param (struct scsi_device *sdev, struct block_device *bdev,
+			     sector_t capacity, int geom[])
 {
     int heads, sectors, cylinders;
     PACB pACB = (PACB) sdev->host->hostdata;
@@ -1421,15 +1241,14 @@
     return (0);
 }
 #else
-int DC390_bios_param (struct scsi_device *sdev, struct block_device *bdev,
-		sector_t capacity, int geom[])
+static int DC390_bios_param (struct scsi_device *sdev, struct block_device *bdev,
+			     sector_t capacity, int geom[])
 {
     return scsicam_bios_param (bdev, capacity, geom);
 }
 #endif
 
-
-void dc390_dumpinfo (PACB pACB, PDCB pDCB, PSRB pSRB)
+static void dc390_dumpinfo (PACB pACB, PDCB pDCB, PSRB pSRB)
 {
     USHORT pstat; PDEVDECL1;
     if (!pDCB) pDCB = pACB->pActiveDCB;
@@ -1483,7 +1302,7 @@
  * Status: Buggy !
  ***********************************************************************/
 
-int DC390_abort (Scsi_Cmnd *cmd)
+static int DC390_abort (Scsi_Cmnd *cmd)
 {
     PDCB  pDCB;
     PSRB  pSRB, psrb;
@@ -1491,28 +1310,10 @@
     int   status;
     //ULONG sbac;
     PACB  pACB = (PACB) cmd->device->host->hostdata;
-    DC390_AFLAGS;
-
-    DC390_LOCK_ACB;
 
     printk ("DC390: Abort command (pid %li, Device %02i-%02i)\n",
 	    cmd->pid, cmd->device->id, cmd->device->lun);
 
-    /* First scan Query list */
-    if( pACB->QueryCnt )
-    {
-	struct scsi_cmnd_list *t, *pcmd_l;
-	list_for_each_entry_safe(pcmd_l, t, &pACB->cmdq, scp.list)
-		if( (struct scsi_cmnd*)pcmd_l == cmd )
-		{
-			/* Found: Dequeue */
-			list_del(&pcmd_l->scp.list);
-			pACB->QueryCnt--;
-			status = SCSI_ABORT_SUCCESS;
-			goto  ABO_X;
-		}
-    }
-	
     pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun);
     if( !pDCB ) goto  NOT_RUN;
 
@@ -1625,7 +1426,6 @@
     }
 #endif
     dc390_lastabortedpid = cmd->pid;
-    DC390_UNLOCK_ACB;
     //do_DC390_Interrupt (pACB->IRQLevel, 0, 0);
 #ifndef USE_NEW_EH	
     if (status == SCSI_ABORT_SUCCESS) cmd->scsi_done(cmd);
@@ -1708,15 +1508,13 @@
  * Returns : 0 on success.
  ***********************************************************************/
 
-int DC390_reset (Scsi_Cmnd *cmd)
+static int DC390_reset (Scsi_Cmnd *cmd)
 {
     UCHAR   bval;
     PACB    pACB = (PACB) cmd->device->host->hostdata;
-    DC390_AFLAGS;
 
     printk(KERN_INFO "DC390: RESET ... ");
 
-    DC390_LOCK_ACB;
     if (timer_pending (&pACB->Waiting_Timer)) del_timer (&pACB->Waiting_Timer);
     bval = DC390_read8 (CtrlReg1);
     bval |= DIS_INT_ON_SCSI_RST;
@@ -1745,7 +1543,6 @@
     dc390_Waiting_process( pACB );
 
     printk("done\n");
-    DC390_UNLOCK_ACB;
     return( SCSI_RESET_SUCCESS );
 }
 
@@ -1760,14 +1557,14 @@
  * Inputs : SCSI id and lun
  ***********************************************************************/
 
-void dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun )
+static void dc390_initDCB( PACB pACB, PDCB *ppDCB, UCHAR id, UCHAR lun )
 {
     PEEprom	prom;
     UCHAR	index;
     PDCB pDCB, pDCB2;
 
     pDCB = kmalloc (sizeof(DC390_DCB), GFP_ATOMIC);
-    DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): %p\n"	\
+    DCBDEBUG(printk (KERN_INFO "DC390: alloc mem for DCB (ID %i, LUN %i): %p\n",	\
 		     id, lun, pDCB));
  
     *ppDCB = pDCB;
@@ -1845,7 +1642,7 @@
  * Purpose :  Set the configuration dependent DCB parameters
  ***********************************************************************/
 
-void dc390_updateDCB (PACB pACB, PDCB pDCB)
+static void dc390_updateDCB (PACB pACB, PDCB pDCB)
 {
   pDCB->SyncMode &= EN_TAG_QUEUEING | SYNC_NEGO_DONE /*| EN_ATN_STOP*/;
   if (pDCB->DevMode & TAG_QUEUEING_) {
@@ -1869,25 +1666,6 @@
 	pDCB->CtrlR1 |= PARITY_ERR_REPO;
 }  
 
-
-/***********************************************************************
- * Function : static void dc390_updateDCBs ()
- *
- * Purpose :  Set the configuration dependent DCB params for all DCBs
- ***********************************************************************/
-
-static void dc390_updateDCBs (PACB pACB)
-{
-  int i;
-  PDCB pDCB = pACB->pLinkDCB;
-  for (i = 0; i < pACB->DCBCnt; i++)
-    {
-      dc390_updateDCB (pACB, pDCB);
-      pDCB = pDCB->pNextDCB;
-    }
-}
-  
-
 /***********************************************************************
  * Function : static void dc390_initSRB()
  *
@@ -1902,7 +1680,7 @@
 }
 
 
-void dc390_linkSRB( PACB pACB )
+static void dc390_linkSRB( PACB pACB )
 {
     UINT   count, i;
 
@@ -1927,11 +1705,10 @@
  *	    io_port, Irq, index: Resources and adapter index
  ***********************************************************************/
 
-void __init dc390_initACB (PSH psh, ULONG io_port, UCHAR Irq, UCHAR index)
+static void __init dc390_initACB (PSH psh, ULONG io_port, UCHAR Irq, UCHAR index)
 {
     PACB    pACB;
     UCHAR   i;
-    DC390_AFLAGS;
 
     psh->can_queue = MAX_CMD_QUEUE;
     psh->cmd_per_lun = MAX_CMD_PER_LUN;
@@ -1939,11 +1716,7 @@
     psh->io_port = io_port;
     psh->n_io_port = 0x80;
     psh->irq = Irq;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,50)
     psh->base = io_port;
-#else
-    psh->base = (char*)io_port;
-#endif	
     psh->unique_id = io_port;
     psh->dma_channel = -1;
     psh->last_reset = jiffies;
@@ -1970,8 +1743,6 @@
     pACB->pActiveDCB = NULL;
     pACB->pFreeSRB = pACB->SRB_array;
     pACB->SRBCount = MAX_SRB_CNT;
-    pACB->QueryCnt = 0;
-    INIT_LIST_HEAD(&pACB->cmdq);
     pACB->AdapterIndex = index;
     pACB->status = 0;
     psh->this_id = dc390_eepromBuf[index][EE_ADAPT_SCSI_ID];
@@ -2007,7 +1778,7 @@
  * Outputs: 0 on success, -1 on error
  ***********************************************************************/
 
-int __init dc390_initAdapter (PSH psh, ULONG io_port, UCHAR Irq, UCHAR index)
+static int __init dc390_initAdapter (PSH psh, ULONG io_port, UCHAR Irq, UCHAR index)
 {
     PACB   pACB, pACB2;
     UCHAR  dstate;
@@ -2086,7 +1857,7 @@
  * Inputs : host - pointer to this host adapter's structure
  *	    io_port - IO ports mapped to this adapter
  *	    Irq - IRQ assigned to this adpater
- *	    PDEVDECL - PCI access handle
+ *	    struct pci_dev - PCI access handle
  *	    index - Adapter index
  *
  * Outputs: 0 on success, -1 on error
@@ -2095,12 +1866,11 @@
  *	not in DC390_detect, called from outside 
  ***********************************************************************/
 
-static int __init DC390_init (PSHT psht, ULONG io_port, UCHAR Irq, PDEVDECL, UCHAR index)
+static int __init DC390_init (PSHT psht, ULONG io_port, UCHAR Irq, struct pci_dev *pdev, UCHAR index)
 {
     PSH   psh;
     PACB  pACB;
-    DC390_AFLAGS;
-    
+
     if (dc390_CheckEEpromCheckSum (PDEV, index))
     {
 	int speed;
@@ -2126,21 +1896,6 @@
 	
     scsi_set_device(psh, &pdev->dev);
     pACB = (PACB) psh->hostdata;
-    DC390_LOCKA_INIT;
-    DC390_LOCK_ACB;
-
-#if 0
-    if( !dc390_pSH_start )
-    {
-        dc390_pSH_start = psh;
-        dc390_pSH_current = psh;
-    }
-    else
-    {
-        dc390_pSH_current->next = psh;
-        dc390_pSH_current = psh;
-    }
-#endif
 
     DEBUG0(printk(KERN_INFO "DC390: pSH = %8x, Index %02i\n", (UINT) psh, index));
 
@@ -2154,59 +1909,15 @@
 		      (UINT) pACB, (UINT) pACB->DCBmap, (UINT) pACB->SRB_array));
 	DEBUG0(printk("DC390: ACB size= %4x, DCB size= %4x, SRB size= %4x\n",\
 		      sizeof(DC390_ACB), sizeof(DC390_DCB), sizeof(DC390_SRB) ));
-
-	DC390_UNLOCK_ACB;
         return (0);
     }
     else
     {
-	//dc390_pSH_start = NULL;
 	scsi_unregister( psh );
-	DC390_UNLOCK_ACB;
 	return( -1 );
     }
 }
 
-
-/***********************************************************************
- * Function : int DC390_detect(Scsi_Host_Template *psht)
- *
- * Purpose : detects and initializes AMD53C974 SCSI chips
- *	     that were autoprobed, overridden on the LILO command line,
- *	     or specified at compile time.
- *
- * Inputs : psht - template for this SCSI adapter
- *
- * Returns : number of host adapters detected
- *
- ***********************************************************************/
-
-#ifndef NEW_PCI
-/* Acc. to PCI 2.1 spec it's up to the driver to enable Bus mastering:
- * We use pci_set_master () for 2.1.x and this func for 2.0.x:	*/
-static void __init dc390_set_master (PDEVDECL)
-{
-	USHORT cmd;
-	UCHAR lat;
-	
-	PCI_READ_CONFIG_WORD (PDEV, PCI_COMMAND, &cmd);
-	
-        if (! (cmd & PCI_COMMAND_MASTER)) {	
-		printk("PCI: Enabling bus mastering for device %02x:%02x\n",
-		       PCI_BUS_DEV);
-		cmd |= PCI_COMMAND_MASTER;
-		PCI_WRITE_CONFIG_WORD(PDEV, PCI_COMMAND, cmd);
-	}
-	PCI_READ_CONFIG_BYTE (PDEV, PCI_LATENCY_TIMER, &lat);
-	if (lat < 16 /* || lat == 255 */) {
-		printk("PCI: Setting latency timer of device %02x:%02x from %i to 64\n",
-		       PCI_BUS_DEV, lat);
-		PCI_WRITE_CONFIG_BYTE(PDEV, PCI_LATENCY_TIMER, 64);
-	}
-	
-}
-#endif /* ! NEW_PCI */
-
 static void __init dc390_set_pci_cfg (PDEVDECL)
 {
 	USHORT cmd;
@@ -2215,30 +1926,31 @@
 	PCI_WRITE_CONFIG_WORD (PDEV, PCI_COMMAND, cmd);
 	PCI_WRITE_CONFIG_WORD (PDEV, PCI_STATUS, (PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_DETECTED_PARITY));
 }
-	
 
 int __init DC390_detect (Scsi_Host_Template *psht)
 {
-    PDEVDECL0;
+    struct pci_dev *pdev = NULL;
     UCHAR   irq;
     ULONG   io_port;
 
-    //dc390_pSHT_start = psht;
     dc390_pACB_start = NULL;
 
     if ( PCI_PRESENT )
-	while (PCI_FIND_DEVICE (PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD53C974))
+	    while ((pdev = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD53C974, pdev)))
 	{
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,30)
 	    if (pci_enable_device (pdev))
 		continue;
-#endif
+
+	    if (pci_set_dma_mask(pdev, 0xffffffff)) {
+		    printk(KERN_ERR "DC390(%i): No suitable DMA available.\n", dc390_adapterCnt);
+		    continue;
+	    }
 	    PCI_GET_IO_AND_IRQ;
 	    DEBUG0(printk(KERN_INFO "DC390(%i): IO_PORT=%04x,IRQ=%x\n", dc390_adapterCnt, (UINT) io_port, irq));
 
 	    if( !DC390_init(psht, io_port, irq, PDEV, dc390_adapterCnt))
 	    {
-		PCI_SET_MASTER;
+		pci_set_master(pdev);
 		dc390_set_pci_cfg (PDEV);
 		dc390_adapterCnt++;
 	    }
@@ -2247,495 +1959,12 @@
 	printk (KERN_ERR "DC390: No PCI BIOS found!\n");
    
     if (dc390_adapterCnt)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
 	psht->proc_name = "tmscsim";
-#else
-	psht->proc_dir = &DC390_proc_scsi_tmscsim;
-#endif
+
     printk(KERN_INFO "DC390: %i adapters found\n", dc390_adapterCnt);
     return( dc390_adapterCnt );
 }
 
-
-/***********************************************************************
- * Functions: dc390_inquiry(), dc390_inquiry_done()
- *
- * Purpose: When changing speed etc., we have to issue an INQUIRY
- *	    command to make sure, we agree upon the nego parameters
- *	    with the device
- ***********************************************************************/
-
-static void dc390_inquiry_done (Scsi_Cmnd* cmd)
-{
-   printk (KERN_INFO "DC390: INQUIRY (ID %02x LUN %02x) returned %08x\n",
-	   cmd->device->id, cmd->device->lun, cmd->result);
-   if (cmd->result)
-   {
-	PACB pACB = (PACB)cmd->device->host->hostdata;
-	PDCB pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun);
-	printk ("DC390: Unsetting DsCn, Sync and TagQ!\n");
-	if (pDCB)
-	{
-		pDCB->DevMode &= ~(SYNC_NEGO_ | TAG_QUEUEING_ | EN_DISCONNECT_ );
-		dc390_updateDCB (pACB, pDCB);
-	}
-   }
-   kfree (cmd);
-}
-
-void dc390_inquiry (PACB pACB, PDCB pDCB)
-{
-   char* buffer;
-   Scsi_Cmnd* cmd;
-   cmd = kmalloc (sizeof(Scsi_Cmnd) + 256, GFP_ATOMIC);
-   if (!cmd) { printk ("DC390: kmalloc failed in inquiry!\n"); return; }
-   buffer = (char*)cmd + sizeof(Scsi_Cmnd);
-
-   memset (cmd, 0, sizeof(Scsi_Cmnd) + 256);
-   cmd->cmnd[0] = INQUIRY;
-   cmd->cmnd[1] = (pDCB->TargetLUN << 5) & 0xe0;
-   cmd->cmnd[4] = 0xff;
-   
-   cmd->cmd_len = 6; cmd->old_cmd_len = 6;
-/* TODO FIXME */
-/*    cmd->host = pACB->pScsiHost; */
-   cmd->device->id = pDCB->TargetID;
-   cmd->device->lun = pDCB->TargetLUN; 
-   cmd->serial_number = 1;
-   cmd->pid = 390;
-   cmd->bufflen = 128;
-   cmd->buffer = buffer;
-   cmd->request_bufflen = 128;
-   cmd->request_buffer = &buffer[128];
-   cmd->done = dc390_inquiry_done;
-   cmd->scsi_done = dc390_inquiry_done;
-   cmd->timeout_per_command = HZ;
-
-   cmd->request->rq_status = RQ_SCSI_BUSY;
-
-   pDCB->SyncMode &= ~SYNC_NEGO_DONE;
-   printk (KERN_INFO "DC390: Queue INQUIRY command to dev ID %02x LUN %02x\n",
-	   pDCB->TargetID, pDCB->TargetLUN);
-   DC390_queue_command (cmd, dc390_inquiry_done);
-}
-
-/***********************************************************************
- * Functions: dc390_sendstart(), dc390_sendstart_done()
- *
- * Purpose: When changing speed etc., we have to issue an INQUIRY
- *	    command to make sure, we agree upon the nego parameters
- *	    with the device
- ***********************************************************************/
-
-static void dc390_sendstart_done (Scsi_Cmnd* cmd)
-{
-   printk (KERN_INFO "DC390: SENDSTART (ID %02x LUN %02x) returned %08x\n",
-	   cmd->device->id, cmd->device->lun, cmd->result);
-   kfree (cmd);
-}
-
-void dc390_sendstart (PACB pACB, PDCB pDCB)
-{
-   char* buffer;
-   Scsi_Cmnd* cmd;
-   cmd = kmalloc (sizeof(Scsi_Cmnd) + 256, GFP_ATOMIC);
-   if (!cmd) { printk ("DC390: kmalloc failed in sendstart!\n"); return; }
-   buffer = (char*)cmd + sizeof(Scsi_Cmnd);
-
-   memset (cmd, 0, sizeof(Scsi_Cmnd) + 256);
-   cmd->cmnd[0] = 0x1b; /* START_STOP_UNIT */
-   cmd->cmnd[1] = (pDCB->TargetLUN << 5) & 0xe0;
-   cmd->cmnd[4] = 0x01; /* START */
-   
-   cmd->cmd_len = 6; cmd->old_cmd_len = 6;
-/* TODO FIXME */
-/*    cmd->host = pACB->pScsiHost; */
-   cmd->device->id = pDCB->TargetID;
-   cmd->device->lun = pDCB->TargetLUN; 
-   cmd->serial_number = 1;
-   cmd->pid = 310;
-   cmd->bufflen = 128;
-   cmd->buffer = buffer;
-   cmd->request_bufflen = 128;
-   cmd->request_buffer = &buffer[128];
-   cmd->done = dc390_sendstart_done;
-   cmd->scsi_done = dc390_sendstart_done;
-   cmd->timeout_per_command = 5*HZ;
-
-   cmd->request->rq_status = RQ_SCSI_BUSY;
-
-   pDCB->SyncMode &= ~SYNC_NEGO_DONE;
-   printk (KERN_INFO "DC390: Queue SEND_START command to dev ID %02x LUN %02x\n",
-	   pDCB->TargetID, pDCB->TargetLUN);
-   DC390_queue_command (cmd, dc390_sendstart_done);
-}
-
-/********************************************************************
- * Function: dc390_set_info()
- *
- * Purpose: Change adapter config
- *
- * Strings are parsed similar to the output of tmscsim_proc_info ()
- * '-' means no change
- *******************************************************************/
-
-static int dc390_scanf (char** buffer, char** pos, char** p0, int* var)
-{
-   *p0 = *pos;
-   *var = simple_strtoul (*p0, pos, 10);
-   if (*p0 == *pos) return -1;
-   *pos = strsep (buffer, " \t\n:=,;.");
-   return 0;
-}
-
-#define SCANF(buffer, pos, p0, var, min, max)		\
-if (dc390_scanf (&buffer, &pos, &p0, &var)) goto einv;	\
-else if (var<min || var>max) goto einv2
-
-static int dc390_yesno (char** buffer, char** pos, char* var, char bmask)
-{
-   switch (**pos)
-     {
-      case 'Y': *var |= bmask; break;
-      case 'N': *var &= ~bmask; break;
-      case '-': break;
-      default: return -1;
-     }
-   *pos = strsep (buffer, " \t\n:=,;");
-   return 0;
-}
-
-#define YESNO(buffer, pos, var, bmask)					\
-	if (dc390_yesno (&buffer, &pos, &var, bmask)) goto einv;	\
-	else dc390_updateDCB (pACB, pDCB);				\
-	if (!pos) goto ok
-
-static int dc390_search (char** buffer, char** pos, char** p0, char* var, char* txt, int max, int scale, char* ign)
-{
-   int dum;
-   if (! memcmp (*pos, txt, strlen(txt)))
-     {
-	*p0 = strsep (buffer, " \t\n:=,;");
-	if (!*p0) return -1;
-	dum = simple_strtoul (*p0, pos, 10);
-	if (*p0 == *pos) return -1;
-	if (dum >= 0 && dum <= max) 
-	  { *var = (dum * 100) / scale; }
-	else return -2;
-	*pos = strsep (buffer, " \t\n:=,;");
-	if (*ign && *pos && strlen(*pos) >= strlen(ign) && 
-	    !(memcmp (*pos, ign, strlen(ign)))) 
-		*pos = strsep (buffer, " \t\n:=,;");
-
-     }
-   return 0;
-}
-
-#define SEARCH(buffer, pos, p0, var, txt, max)						\
-if (dc390_search (&buffer, &pos, &p0, (PUCHAR)(&var), txt, max, 100, "")) goto einv2;	\
-else if (!p1) goto ok2
-
-#define SEARCH2(buffer, pos, p0, var, txt, max, scale)					\
-if (dc390_search (&buffer, &pos, &p0, &var, txt, max, scale, "")) goto einv2; 		\
-else if (!p1) goto ok2
-
-#define SEARCH3(buffer, pos, p0, var, txt, max, scale, ign)				\
-if (dc390_search (&buffer, &pos, &p0, &var, txt, max, scale, ign)) goto einv2;		\
-else if (!p1) goto ok2
-
-
-#ifdef DC390_PARSEDEBUG
-static char _prstr[256];
-char* prstr (char* p, char* e)
-{
-   char* c = _prstr;
-   while (p < e)
-     if (*p == 0) { *c++ = ':'; p++; }
-     else if (*p == 10) { *c++ = '\\'; *c++ = 'n'; p++; }
-     else *c++ = *p++;
-   *c = 0;
-   return _prstr;
-}
-#endif
-
-int dc390_set_info (char *buffer, int length, PACB pACB)
-{
-  char *pos = buffer, *p0 = buffer;
-  char needs_inquiry = 0; 
-  int dum = 0;
-  char dev;
-  PDCB pDCB = pACB->pLinkDCB;
-  DC390_IFLAGS;
-  DC390_AFLAGS;
-  pos[length] = 0;
-
-  DC390_LOCK_IO(pACB->pScsiHost);
-  DC390_LOCK_ACB;
-  /* UPPERCASE */ 
-  /* Don't use kernel toupper, because of 2.0.x bug: ctmp unexported */
-  while (*pos) 
-    { if (*pos >='a' && *pos <= 'z') *pos = *pos + 'A' - 'a'; pos++; }
-  
-  /* Remove WS */
-  pos = strsep (&buffer, " \t:\n=,;");
-  if (!*pos) goto ok;
-   
- next:
-  if (!memcmp (pos, "RESET", 5)) goto reset;
-  else if (!memcmp (pos, "INQUIRY", 7)) goto inquiry;
-  else if (!memcmp (pos, "REMOVE", 6)) goto remove;
-  else if (!memcmp (pos, "ADD", 3)) goto add;
-  else if (!memcmp (pos, "START", 5)) goto start;
-  else if (!memcmp (pos, "DUMP", 4)) goto dump;
-  
-  if (isdigit (*pos))
-    {
-      /* Device config line */
-      int dev, id, lun; char* pdec;
-      char olddevmode;
-      
-      SCANF (buffer, pos, p0, dev, 0, pACB->DCBCnt-1);
-      if (*pos) { SCANF (buffer, pos, p0, id, 0, 7); } else goto einv;
-      if (*pos) { SCANF (buffer, pos, p0, lun, 0, 7); } else goto einv;
-      if (!*pos) goto einv;
-      
-      PARSEDEBUG(printk (KERN_INFO "DC390: config line %i %i %i:\"%s\"\n", dev, id, lun, prstr (pos, &buffer[length])));
-      pDCB = pACB->pLinkDCB;
-      for (dum = 0; dum < dev; dum++) pDCB = pDCB->pNextDCB;
-      /* Sanity Check */
-      if (pDCB->TargetID != id || pDCB->TargetLUN != lun) 
-	 {
-	    printk (KERN_ERR "DC390: no such device: Idx=%02i ID=%02i LUN=%02i\n",
-		    dev, id, lun);
-	    goto einv2;
-	 }
-
-      if (pDCB->pWaitingSRB || pDCB->pGoingSRB)
-      {
-	  printk ("DC390: Cannot change dev (%i-%i) cfg: Pending requests\n",
-		  pDCB->TargetID, pDCB->TargetLUN);
-	  goto einv;
-      }
-	  
-      olddevmode = pDCB->DevMode;
-      YESNO (buffer, pos, pDCB->DevMode, PARITY_CHK_);
-      needs_inquiry++;
-      YESNO (buffer, pos, pDCB->DevMode, SYNC_NEGO_);
-      if ((olddevmode & SYNC_NEGO_) == (pDCB->DevMode & SYNC_NEGO_)) needs_inquiry--;
-      needs_inquiry++;
-      YESNO (buffer, pos, pDCB->DevMode, EN_DISCONNECT_);
-      if ((olddevmode & EN_DISCONNECT_) == (pDCB->DevMode & EN_DISCONNECT_)) needs_inquiry--;
-      YESNO (buffer, pos, pDCB->DevMode, SEND_START_);
-      needs_inquiry++;
-      YESNO (buffer, pos, pDCB->DevMode, TAG_QUEUEING_);
-      if ((olddevmode & TAG_QUEUEING_) == (pDCB->DevMode & TAG_QUEUEING_)) needs_inquiry--;
-
-      dc390_updateDCB (pACB, pDCB);
-      if (!*pos) goto ok;
-       
-      olddevmode = pDCB->NegoPeriod;
-      /* Look for decimal point (Speed) */
-      pdec = pos; 
-      while (pdec++ < &buffer[length]) if (*pdec == '.') break;
-      /* NegoPeriod */
-      if (*pos != '-')
-	{
-	  SCANF (buffer, pos, p0, dum, 72, 800); 
-	  pDCB->NegoPeriod = dum >> 2;
-	  if (pDCB->NegoPeriod != olddevmode) needs_inquiry++;
-	  if (!pos) goto ok;
-	  if (memcmp (pos, "NS", 2) == 0) pos = strsep (&pos, " \t\n:=,;.");
-	}
-      else pos = strsep (&pos, " \t\n:=,;.");
-      if (!*pos) goto ok;
-      
-      /* Sync Speed in MHz */
-      if (*pos != '-')
-	{
-	  SCANF (buffer, pos, p0, dum, 1, 13); 
-	  pDCB->NegoPeriod = (1000/dum) >> 2;
-	  if (pDCB->NegoPeriod != olddevmode && !pos) needs_inquiry++;
-	  if (!*pos) goto ok;
-	  /* decimal */
-	  if (pos-1 == pdec)
-	     {
-		int dumold = dum;
-		dum = simple_strtoul (pos, &p0, 10) * 10;
-		for (; p0-pos > 1; p0--) dum /= 10;
-		pDCB->NegoPeriod = (100000/(100*dumold + dum)) >> 2;
-		if (pDCB->NegoPeriod < 19) pDCB->NegoPeriod = 19;
-		pos = strsep (&pos, " \t\n:=,;");
-		if (!*pos) goto ok;
-	     }
-	  if (*pos == 'M') pos = strsep (&pos, " \t\n:=,;");
-	  if (pDCB->NegoPeriod != olddevmode) needs_inquiry++;
-	}
-      else pos = strsep (&pos, " \t\n:=,;");
-      /* dc390_updateDCB (pACB, pDCB); */
-      if (!*pos) goto ok;
-
-      olddevmode = pDCB->SyncOffset;
-      /* SyncOffs */
-      if (*pos != '-')
-	{
-	  SCANF (buffer, pos, p0, dum, 0, 0x0f); 
-	  pDCB->SyncOffset = dum;
-	  if (pDCB->SyncOffset > olddevmode) needs_inquiry++;
-	}
-      else pos = strsep (&pos, " \t\n:=,;");
-      if (!*pos) goto ok;
-      dc390_updateDCB (pACB, pDCB);
-
-      //olddevmode = pDCB->MaxCommand;
-      /* MaxCommand (Tags) */
-      if (*pos != '-')
-	{
-	  SCANF (buffer, pos, p0, dum, 1, 32 /*pACB->TagMaxNum*/);
-	  if (pDCB->SyncMode & EN_TAG_QUEUEING)
-		pDCB->MaxCommand = dum;
-	  else printk (KERN_INFO "DC390: Can't set MaxCmd larger than one without Tag Queueing!\n");
-	}
-      else pos = strsep (&pos, " \t\n:=,;");
-
-    }
-  else
-    {
-      char* p1 = pos; UCHAR dum, newadaptid;
-      PARSEDEBUG(printk (KERN_INFO "DC390: chg adapt cfg \"%s\"\n", prstr (pos, &buffer[length])));
-      dum = GLITCH_TO_NS (pACB->glitch_cfg);
-      /* Adapter setting */
-      SEARCH (buffer, pos, p0, pACB->pScsiHost->max_id, "MAXID", 8); 
-      SEARCH (buffer, pos, p0, pACB->pScsiHost->max_lun, "MAXLUN", 8); 
-      SEARCH (buffer, pos, p0, newadaptid, "ADAPTERID", 7);
-      SEARCH (buffer, pos, p0, pACB->TagMaxNum, "TAGMAXNUM", 32);
-      SEARCH (buffer, pos, p0, pACB->ACBFlag, "ACBFLAG", 255);
-      SEARCH3 (buffer, pos, p0, dum, "GLITCHEATER", 40, 1000, "NS");
-      SEARCH3 (buffer, pos, p0, pACB->sel_timeout, "SELTIMEOUT", 400, 163, "MS");
-      SEARCH3 (buffer, pos, p0, dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY], "DELAYRESET", 180, 100, "S");
-    ok2:
-      pACB->glitch_cfg = NS_TO_GLITCH (dum);
-      if (pACB->sel_timeout < 60) pACB->sel_timeout = 60;
-      DC390_write8 (Scsi_TimeOut, pACB->sel_timeout);
-      if (newadaptid != pACB->pScsiHost->this_id)
-      {
-	pACB->pScsiHost->this_id = newadaptid;
-	dc390_ResetDevParam (pACB);
-      }	    
-      //dum = 0; while (1 << dum <= pACB->TagMaxNum) dum ++;
-      //pACB->TagMaxNum &= (1 << --dum);
-      dc390_updateDCBs (pACB);
-      // All devs should be INQUIRED now
-      if (pos == p1) goto einv;
-    }
-  if (*pos) goto next;
-      
- ok:
-  DC390_UNLOCK_ACB;
-  if (needs_inquiry) 
-     { dc390_updateDCB (pACB, pDCB); dc390_inquiry (pACB, pDCB); }
-  DC390_UNLOCK_IO(pACB->pScsiHost);
-  return (length);
-
- einv2:
-  pos = p0;
- einv:
-  DC390_UNLOCK_ACB;
-  DC390_UNLOCK_IO(pACB->pScsiHost);
-  printk (KERN_WARNING "DC390: parse error near \"%s\"\n", (pos? pos: "NULL"));
-  return (-EINVAL);
-   
- reset:
-     {
-	Scsi_Cmnd cmd;
-	/* TODO FIXME */
-	/* cmd.host = pACB->pScsiHost; */
-	printk (KERN_WARNING "DC390: Driver reset requested!\n");
-	DC390_UNLOCK_ACB;
-	DC390_reset (&cmd);
-	DC390_UNLOCK_IO(pACB->pScsiHost);
-     }
-  return (length);
-
- dump:
-     {
-	dc390_dumpinfo (pACB, 0, 0);
-	DC390_UNLOCK_ACB;
-	DC390_UNLOCK_IO(pACB->pScsiHost);       
-     }
-  return (length);
-	
- inquiry:
-     {
-	pos = strsep (&pos, " \t\n.:;="); if (!*pos) goto einv;
-	dev = simple_strtoul (pos, &p0, 10);
-	if (dev >= pACB->DCBCnt) goto einv_dev;
-	for (dum = 0; dum < dev; dum++) pDCB = pDCB->pNextDCB;
-	printk (KERN_NOTICE " DC390: Issue INQUIRY command to Dev(Idx) %i SCSI ID %i LUN %i\n",
-		dev, pDCB->TargetID, pDCB->TargetLUN);
-	DC390_UNLOCK_ACB;
-	dc390_inquiry (pACB, pDCB);
-	DC390_UNLOCK_IO(pACB->pScsiHost);
-     }
-   return (length);
-
- remove:
-     {
-	pos = strsep (&pos, " \t\n.:;="); if (!*pos) goto einv;
-	dev = simple_strtoul (pos, &p0, 10);
-	if (dev >= pACB->DCBCnt) goto einv_dev;
-	for (dum = 0; dum < dev; dum++) pDCB = pDCB->pNextDCB;
-	printk (KERN_NOTICE " DC390: Remove DCB for Dev(Idx) %i SCSI ID %i LUN %i\n",
-		dev, pDCB->TargetID, pDCB->TargetLUN);
-	/* TO DO: We should make sure no pending commands are left */
-	dc390_remove_dev (pACB, pDCB);
-	DC390_UNLOCK_ACB;
-	DC390_UNLOCK_IO(pACB->pScsiHost);
-     }
-   return (length);
-
- add:
-     {
-	int id, lun;
-	pos = strsep (&pos, " \t\n.:;=");
-	if (*pos) { SCANF (buffer, pos, p0, id, 0, 7); } else goto einv;
-	if (*pos) { SCANF (buffer, pos, p0, lun, 0, 7); } else goto einv;
-	pDCB = dc390_findDCB (pACB, id, lun);
-	if (pDCB) { printk ("DC390: ADD: Device already existing\n"); goto einv; }
-	dc390_initDCB (pACB, &pDCB, id, lun);
-	DC390_UNLOCK_ACB;
-	dc390_inquiry (pACB, pDCB);
-	DC390_UNLOCK_IO(pACB->pScsiHost);
-     }
-   return (length);
-
- start:
-     {
-	int id, lun;
-	pos = strsep (&pos, " \t\n.:;=");
-	if (*pos) { SCANF (buffer, pos, p0, id, 0, 7); } else goto einv;
-	if (*pos) { SCANF (buffer, pos, p0, lun, 0, 7); } else goto einv;
-	pDCB = dc390_findDCB (pACB, id, lun);
-	if (pDCB) printk ("DC390: SendStart: Device already existing ...\n");
-	else dc390_initDCB (pACB, &pDCB, id, lun);
-	DC390_UNLOCK_ACB;
-	dc390_sendstart (pACB, pDCB);
-	dc390_inquiry (pACB, pDCB);
-	DC390_UNLOCK_IO(pACB->pScsiHost);
-     }
-   return (length);
-
- einv_dev:
-   printk (KERN_WARNING "DC390: Ignore cmnd to invalid Dev(Idx) %i. Valid range: 0 - %i.\n", 
-	   dev, pACB->DCBCnt - 1);
-   DC390_UNLOCK_ACB;
-   DC390_UNLOCK_IO(pACB->pScsiHost);
-   return (-EINVAL);
-}
-
-#undef SEARCH
-#undef YESNO
-#undef SCANF
-
 /********************************************************************
  * Function: DC390_proc_info(char* buffer, char **start,
  *			     off_t offset, int length, int hostno, int inout)
@@ -2763,15 +1992,13 @@
  else SPRINTF(" No  ")
 
 
-int DC390_proc_info (struct Scsi_Host *shpnt, char *buffer, char **start,
-		     off_t offset, int length, int inout)
+static int DC390_proc_info (struct Scsi_Host *shpnt, char *buffer, char **start,
+			    off_t offset, int length, int inout)
 {
   int dev, spd, spd1;
   char *pos = buffer;
-  struct scsi_cmnd_list *cl;
   PACB pACB;
   PDCB pDCB;
-  DC390_AFLAGS;
 
   pACB = dc390_pACB_start;
 
@@ -2785,13 +2012,11 @@
   if (pACB == (PACB)-1) return(-ESRCH);
 
   if(inout) /* Has data been written to the file ? */
-      return dc390_set_info(buffer, length, pACB);
+      return -ENOSYS;
    
   SPRINTF("Tekram DC390/AM53C974 PCI SCSI Host Adapter, ");
   SPRINTF("Driver Version %s\n", DC390_VERSION);
 
-  DC390_LOCK_ACB;
-
   SPRINTF("SCSI Host Nr %i, ", shpnt->host_no);
   SPRINTF("%s Adapter Nr %i\n", dc390_adapname, pACB->AdapterIndex);
   SPRINTF("IOPortBase 0x%04x, ", pACB->IOPortBase);
@@ -2839,9 +2064,6 @@
       SPRINTF ("      %02i\n", pDCB->MaxCommand);
       pDCB = pDCB->pNextDCB;
      }
-    SPRINTF ("Commands in Queues: Query: %li:", pACB->QueryCnt);
-    list_for_each_entry(cl, &pACB->cmdq, scp.list)
-	SPRINTF (" %li", ((struct scsi_cmnd*)cl)->pid);
     if (timer_pending(&pACB->Waiting_Timer)) SPRINTF ("Waiting queue timer running\n");
     else SPRINTF ("\n");
     pDCB = pACB->pLinkDCB;
@@ -2876,8 +2098,6 @@
     SPRINTF("\n");
 #endif
   
-
-  DC390_UNLOCK_ACB;
   *start = buffer + offset;
 
   if (pos - buffer < offset)
@@ -2919,7 +2139,7 @@
     return( 0 );
 }
 
-void dc390_freeDCBs (struct Scsi_Host *host)
+static void dc390_freeDCBs (struct Scsi_Host *host)
 {
     PDCB pDCB, nDCB;
     PACB pACB = (PACB)(host->hostdata);
@@ -2938,13 +2158,12 @@
 
 }
 
-int DC390_release (struct Scsi_Host *host)
+static int DC390_release (struct Scsi_Host *host)
 {
-    DC390_AFLAGS DC390_IFLAGS;
+    DC390_IFLAGS;
     PACB pACB = (PACB)(host->hostdata);
 
     DC390_LOCK_IO(host);
-    DC390_LOCK_ACB;
 
     /* TO DO: We should check for outstanding commands first. */
     dc390_shutdown (host);
@@ -2957,7 +2176,6 @@
 
     release_region(host->io_port,host->n_io_port);
     dc390_freeDCBs (host);
-    DC390_UNLOCK_ACB;
     DC390_UNLOCK_IO(host);
     scsi_unregister(host);
     return( 1 );
diff -Nru a/drivers/scsi/tmscsim.h b/drivers/scsi/tmscsim.h
--- a/drivers/scsi/tmscsim.h	Tue Jun 15 22:20:58 2004
+++ b/drivers/scsi/tmscsim.h	Tue Jun 15 22:20:58 2004
@@ -214,16 +214,12 @@
 PSRB		pTmpSRB;
 
 /* 0x2c: */
-ULONG		QueryCnt;
-struct list_head	cmdq;
-
-/* 0x38: */
 UCHAR		msgin123[4];
 UCHAR		DCBmap[MAX_SCSI_ID];
 UCHAR		Connected;
 UCHAR		pad;
 
-/* 0x3c: */
+/* 0x30: */
 #if defined(USE_SPINLOCKS) && USE_SPINLOCKS > 1 && (defined(CONFIG_SMP) || DEBUG_SPINLOCKS > 0)
 spinlock_t	lock;
 #endif
@@ -234,20 +230,20 @@
 UCHAR		Ignore_IRQ;	/* Not used */
 
 PDEVDECL1;			/* Pointer to PCI cfg. space */
-/* 0x4c/0x48: */
+/* 0x40/0x3c: */
 ULONG		Cmds;
 UINT		SelLost;
 UINT		SelConn;
 UINT		CmdInQ;
 UINT		CmdOutOfSRB;
 	
-/* 0x60/0x5c: */
+/* 0x54/0x50: */
 struct timer_list	Waiting_Timer;
-/* 0x74/0x70: */
+/* 0x68/0x64: */
 DC390_SRB	TmpSRB;
-/* 0xd8/0xd4: */
+/* 0xcc/0xc8: */
 DC390_SRB	SRB_array[MAX_SRB_CNT]; 	/* 50 SRBs */
-/* 0xfb0/0xfac: */
+/* 0xfa4/0xfa0: */
 };
 
 typedef  struct  _ACB	 DC390_ACB, *PACB;
@@ -406,15 +402,8 @@
  *	SISC query queue
  */
 typedef struct {
-	struct list_head	list;
 	dma_addr_t		saved_dma_handle;
 } dc390_cmd_scp_t;
-
-struct scsi_cmnd_list
-{
-	char dummy[offsetof(struct scsi_cmnd, SCp)];
-	dc390_cmd_scp_t scp;
-};
 
 /*
 **  Inquiry Data format
diff -Nru a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
--- a/drivers/scsi/wd7000.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/scsi/wd7000.c	Tue Jun 15 22:21:04 2004
@@ -165,6 +165,7 @@
  * Removed now obsolete wd7000.h
  */
 
+#include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
@@ -846,7 +847,7 @@
 static inline Scb *alloc_scbs(struct Scsi_Host *host, int needed)
 {
 	register Scb *scb, *p = NULL;
-	register unsigned long flags;
+	unsigned long flags;
 	register unsigned long timeout = jiffies + WAITnexttimeout;
 	register unsigned long now;
 	int i;
@@ -898,7 +899,7 @@
 
 static inline void free_scb(Scb * scb)
 {
-	register unsigned long flags;
+	unsigned long flags;
 
 	spin_lock_irqsave(&scbpool_lock, flags);
 
@@ -936,7 +937,7 @@
  */
 {
 	register int i, ogmb;
-	register unsigned long flags;
+	unsigned long flags;
 	unchar start_ogmb;
 	Mailbox *ogmbs = host->mb.ogmb;
 	int *next_ogmb = &(host->next_ogmb);
diff -Nru a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
--- a/drivers/serial/68360serial.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/serial/68360serial.c	Tue Jun 15 22:21:03 2004
@@ -1650,7 +1650,6 @@
 	
 	if (tty_hung_up_p(filp)) {
 		DBG_CNT("before DEC-hung");
-		MOD_DEC_USE_COUNT;
 		local_irq_restore(flags);
 		return;
 	}
@@ -1677,7 +1676,6 @@
 	}
 	if (state->count) {
 		DBG_CNT("before DEC-2");
-		MOD_DEC_USE_COUNT;
 		local_irq_restore(flags);
 		return;
 	}
@@ -1732,7 +1730,6 @@
 	}
 	info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
 	wake_up_interruptible(&info->close_wait);
-	MOD_DEC_USE_COUNT;
 	local_irq_restore(flags);
 }
 
@@ -1993,14 +1990,12 @@
 	if (retval)
 		return retval;
 
-	MOD_INC_USE_COUNT;
 	retval = block_til_ready(tty, filp, info);
 	if (retval) {
 #ifdef SERIAL_DEBUG_OPEN
 		printk("rs_open returning after block_til_ready with %d\n",
 		       retval);
 #endif
-		MOD_DEC_USE_COUNT;
 		return retval;
 	}
 
@@ -2476,6 +2471,7 @@
 static	int	baud_idx;
 
 static struct tty_operations rs_360_ops = {
+	.owner = THIS_MODULE,
 	.open = rs_360_open,
 	.close = rs_360_close,
 	.write = rs_360_write,
diff -Nru a/drivers/serial/8250_acpi.c b/drivers/serial/8250_acpi.c
--- a/drivers/serial/8250_acpi.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/serial/8250_acpi.c	Tue Jun 15 22:21:04 2004
@@ -14,7 +14,6 @@
 #include <linux/module.h>
 #include <linux/tty.h>
 #include <linux/serial.h>
-#include <linux/tty.h>
 #include <linux/serial_core.h>
 
 #include <acpi/acpi_bus.h>
diff -Nru a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
--- a/drivers/serial/8250_pci.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/serial/8250_pci.c	Tue Jun 15 22:20:43 2004
@@ -28,7 +28,6 @@
 
 #include <asm/bitops.h>
 #include <asm/byteorder.h>
-#include <asm/serial.h>
 #include <asm/io.h>
 
 #include "8250.h"
@@ -704,7 +703,7 @@
 		.subdevice	= PCI_SUBDEVICE_ID_OCTPRO232,
 		.init		= sbs_init,
 		.setup		= sbs_setup,
-		.exit		= sbs_exit
+		.exit		= __devexit_p(sbs_exit),
 	},
 	/*
 	 * SBS Technologies, Inc., PMC-OCTALPRO 422
@@ -716,7 +715,7 @@
 		.subdevice	= PCI_SUBDEVICE_ID_OCTPRO422,
 		.init		= sbs_init,
 		.setup		= sbs_setup,
-		.exit		= sbs_exit
+		.exit		= __devexit_p(sbs_exit),
 	},
 	/*
 	 * SBS Technologies, Inc., P-Octal 232
@@ -728,7 +727,7 @@
 		.subdevice	= PCI_SUBDEVICE_ID_POCTAL232,
 		.init		= sbs_init,
 		.setup		= sbs_setup,
-		.exit		= sbs_exit
+		.exit		= __devexit_p(sbs_exit),
 	},
 	/*
 	 * SBS Technologies, Inc., P-Octal 422
@@ -740,7 +739,7 @@
 		.subdevice	= PCI_SUBDEVICE_ID_POCTAL422,
 		.init		= sbs_init,
 		.setup		= sbs_setup,
-		.exit		= sbs_exit
+		.exit		= __devexit_p(sbs_exit),
 	},
 
 	/*
@@ -1585,7 +1584,7 @@
 	struct pci_board *board, tmp;
 	struct pci_serial_quirk *quirk;
 	struct serial_struct serial_req;
-	int base_baud, rc, nr_ports, i;
+	int rc, nr_ports, i;
 
 	if (ent->driver_data >= ARRAY_SIZE(pci_boards)) {
 		printk(KERN_ERR "pci_init_one: invalid driver_data: %ld\n",
@@ -1663,16 +1662,11 @@
 	priv->quirk = quirk;
 	pci_set_drvdata(dev, priv);
 
-	base_baud = board->base_baud;
-	if (!base_baud) {
-		moan_device("Board entry does not specify baud rate.", dev);
-		base_baud = BASE_BAUD;
-	}
 	for (i = 0; i < nr_ports; i++) {
 		memset(&serial_req, 0, sizeof(serial_req));
 		serial_req.flags = UPF_SKIP_TEST | UPF_AUTOPROBE |
 				   UPF_RESOURCES | UPF_SHARE_IRQ;
-		serial_req.baud_base = base_baud;
+		serial_req.baud_base = board->base_baud;
 		serial_req.irq = get_pci_irq(dev, board, i);
 		if (quirk->setup(dev, board, &serial_req, i))
 			break;
diff -Nru a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
--- a/drivers/serial/8250_pnp.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/serial/8250_pnp.c	Tue Jun 15 22:20:36 2004
@@ -437,7 +437,7 @@
 	.name		= "serial",
 	.id_table	= pnp_dev_table,
 	.probe		= serial_pnp_probe,
-	.remove		= serial_pnp_remove,
+	.remove		= __devexit_p(serial_pnp_remove),
 };
 
 static int __init serial8250_pnp_init(void)
diff -Nru a/drivers/serial/Kconfig b/drivers/serial/Kconfig
--- a/drivers/serial/Kconfig	Tue Jun 15 22:21:02 2004
+++ b/drivers/serial/Kconfig	Tue Jun 15 22:21:02 2004
@@ -259,6 +259,7 @@
 config SERIAL_S3C2410_CONSOLE
 	bool "Support for console on S3C2410 serial port"
 	depends on SERIAL_S3C2410=y
+	select SERIAL_CORE_CONSOLE
 	help
 	  Allow selection of the S3C2410 on-board serial ports for use as
 	  an virtual console.
diff -Nru a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
--- a/drivers/serial/pmac_zilog.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/serial/pmac_zilog.c	Tue Jun 15 22:20:36 2004
@@ -483,7 +483,7 @@
        		if (r3 & CHBEXT)
        			pmz_status_handle(uap_b, regs);
        	       	if (r3 & CHBRxIP)
-       			pmz_receive_chars(uap_b, regs);
+       			tty = pmz_receive_chars(uap_b, regs);
        		if (r3 & CHBTxIP)
        			pmz_transmit_chars(uap_b);
 	       	rc = IRQ_HANDLED;
diff -Nru a/drivers/serial/pxa.c b/drivers/serial/pxa.c
--- a/drivers/serial/pxa.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/serial/pxa.c	Tue Jun 15 22:21:02 2004
@@ -33,7 +33,6 @@
 #include <linux/sysrq.h>
 #include <linux/serial_reg.h>
 #include <linux/circ_buf.h>
-#include <linux/serial.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 
@@ -386,9 +385,6 @@
 	if (retval)
 		return retval;
 
-	CKEN |= up->cken;
-	udelay(1);
-
 	/*
 	 * Clear the FIFO buffers and disable them.
 	 * (they will be reenabled in set_termios())
@@ -461,8 +457,6 @@
 				  UART_FCR_CLEAR_RCVR |
 				  UART_FCR_CLEAR_XMIT);
 	serial_out(up, UART_FCR, 0);
-
-	CKEN &= ~up->cken;
 }
 
 static void
@@ -576,10 +570,14 @@
 serial_pxa_pm(struct uart_port *port, unsigned int state,
 	      unsigned int oldstate)
 {
+	struct uart_pxa_port *up = (struct uart_pxa_port *)port;
 	if (state) {
 		/* sleep */
+		CKEN &= ~up->cken;
 	} else {
 		/* wake */
+		CKEN |= up->cken;
+		udelay(1);
 	}
 }
 
@@ -760,13 +758,12 @@
 	.cken	= CKEN6_FFUART,
 	.port	= {
 		.type		= PORT_PXA,
-		.iotype		= SERIAL_IO_MEM,
+		.iotype		= UPIO_MEM,
 		.membase	= (void *)&FFUART,
 		.mapbase	= __PREG(FFUART),
 		.irq		= IRQ_FFUART,
 		.uartclk	= 921600 * 16,
 		.fifosize	= 64,
-		.flags		= ASYNC_SKIP_TEST,
 		.ops		= &serial_pxa_pops,
 		.line		= 0,
 	},
@@ -775,13 +772,12 @@
 	.cken	= CKEN7_BTUART,
 	.port	= {
 		.type		= PORT_PXA,
-		.iotype		= SERIAL_IO_MEM,
+		.iotype		= UPIO_MEM,
 		.membase	= (void *)&BTUART,
 		.mapbase	= __PREG(BTUART),
 		.irq		= IRQ_BTUART,
 		.uartclk	= 921600 * 16,
 		.fifosize	= 64,
-		.flags		= ASYNC_SKIP_TEST,
 		.ops		= &serial_pxa_pops,
 		.line		= 1,
 	},
@@ -790,13 +786,12 @@
 	.cken	= CKEN5_STUART,
 	.port	= {
 		.type		= PORT_PXA,
-		.iotype		= SERIAL_IO_MEM,
+		.iotype		= UPIO_MEM,
 		.membase	= (void *)&STUART,
 		.mapbase	= __PREG(STUART),
 		.irq		= IRQ_STUART,
 		.uartclk	= 921600 * 16,
 		.fifosize	= 64,
-		.flags		= ASYNC_SKIP_TEST,
 		.ops		= &serial_pxa_pops,
 		.line		= 2,
 	},
@@ -830,6 +825,10 @@
 
 static void __exit serial_pxa_exit(void)
 {
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(serial_pxa_ports); i++)
+		uart_remove_one_port(&serial_pxa_reg, &serial_pxa_ports[i].port);
 	uart_unregister_driver(&serial_pxa_reg);
 }
 
diff -Nru a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
--- a/drivers/serial/s3c2410.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/serial/s3c2410.c	Tue Jun 15 22:20:40 2004
@@ -37,7 +37,7 @@
 
 #define SERIAL_S3C2410_NAME	"ttySAC"
 #define SERIAL_S3C2410_MAJOR	204
-#define SERIAL_S3C2410_MINOR	4
+#define SERIAL_S3C2410_MINOR	64
 
 /* we can support 3 uarts, but not always use them */
 
diff -Nru a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
--- a/drivers/serial/serial_core.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/serial/serial_core.c	Tue Jun 15 22:20:38 2004
@@ -460,7 +460,7 @@
 
 static inline int
 __uart_user_write(struct uart_port *port, struct circ_buf *circ,
-		  const unsigned char *buf, int count)
+		  const unsigned char __user *buf, int count)
 {
 	unsigned long flags;
 	int c, ret = 0;
@@ -546,9 +546,11 @@
 		return 0;
 
 	if (from_user)
-		ret = __uart_user_write(state->port, &state->info->xmit, buf, count);
+		ret = __uart_user_write(state->port, &state->info->xmit,
+				(const unsigned char __user *)buf, count);
 	else
-		ret = __uart_kern_write(state->port, &state->info->xmit, buf, count);
+		ret = __uart_kern_write(state->port, &state->info->xmit,
+					buf, count);
 
 	uart_start(tty);
 	return ret;
@@ -634,7 +636,8 @@
 		uart_set_mctrl(port, TIOCM_RTS);
 }
 
-static int uart_get_info(struct uart_state *state, struct serial_struct *retinfo)
+static int uart_get_info(struct uart_state *state,
+			 struct serial_struct __user *retinfo)
 {
 	struct uart_port *port = state->port;
 	struct serial_struct tmp;
@@ -662,8 +665,8 @@
 	return 0;
 }
 
-static int
-uart_set_info(struct uart_state *state, struct serial_struct *newinfo)
+static int uart_set_info(struct uart_state *state,
+			 struct serial_struct __user *newinfo)
 {
 	struct serial_struct new_serial;
 	struct uart_port *port = state->port;
@@ -856,7 +859,8 @@
  * uart_get_lsr_info - get line status register info.
  * Note: uart_ioctl protects us against hangups.
  */
-static int uart_get_lsr_info(struct uart_state *state, unsigned int *value)
+static int uart_get_lsr_info(struct uart_state *state,
+			     unsigned int __user *value)
 {
 	struct uart_port *port = state->port;
 	unsigned int result;
@@ -1035,8 +1039,8 @@
  * NB: both 1->0 and 0->1 transitions are counted except for
  *     RI where only 0->1 is counted.
  */
-static int
-uart_get_count(struct uart_state *state, struct serial_icounter_struct *icnt)
+static int uart_get_count(struct uart_state *state,
+			  struct serial_icounter_struct __user *icnt)
 {
 	struct serial_icounter_struct icount;
 	struct uart_icount cnow;
@@ -1069,6 +1073,7 @@
 	   unsigned long arg)
 {
 	struct uart_state *state = tty->driver_data;
+	void __user *uarg = (void __user *)arg;
 	int ret = -ENOIOCTLCMD;
 
 	BUG_ON(!kernel_locked());
@@ -1078,11 +1083,11 @@
 	 */
 	switch (cmd) {
 	case TIOCGSERIAL:
-		ret = uart_get_info(state, (struct serial_struct *)arg);
+		ret = uart_get_info(state, uarg);
 		break;
 
 	case TIOCSSERIAL:
-		ret = uart_set_info(state, (struct serial_struct *)arg);
+		ret = uart_set_info(state, uarg);
 		break;
 
 	case TIOCSERCONFIG:
@@ -1112,7 +1117,7 @@
 		break;
 
 	case TIOCGICOUNT:
-		ret = uart_get_count(state, (struct serial_icounter_struct *)arg);
+		ret = uart_get_count(state, uarg);
 		break;
 	}
 
@@ -1132,7 +1137,7 @@
 	 */
 	switch (cmd) {
 	case TIOCSERGETLSR: /* Get line status register */
-		ret = uart_get_lsr_info(state, (unsigned int *)arg);
+		ret = uart_get_lsr_info(state, uarg);
 		break;
 
 	default: {
diff -Nru a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
--- a/drivers/serial/sh-sci.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/serial/sh-sci.c	Tue Jun 15 22:20:44 2004
@@ -758,7 +758,8 @@
 	struct cpufreq_freqs *freqs = p;
 	int i;
 
-	if (phase == CPUFREQ_POSTCHANGE) {
+	if ((phase == CPUFREQ_POSTCHANGE) ||
+	    (phase == CPUFREQ_RESUMECHANGE)){
 		for (i = 0; i < SCI_NPORTS; i++) {
 			struct uart_port *port = &sci_ports[i];
 
@@ -904,14 +905,14 @@
 {
 	struct sci_port *s = &sci_ports[port->line];
 
-	sci_request_irq(s);
-	sci_start_tx(port, 1);
-	sci_start_rx(port, 1);
-
 #if defined(__H8300S__)
 	h8300_sci_enable(port, sci_enable);
 #endif
 
+	sci_request_irq(s);
+	sci_start_tx(port, 1);
+	sci_start_rx(port, 1);
+
 	return 0;
 }
 
@@ -1328,6 +1329,7 @@
 	int bits = 8;
 	int parity = 'n';
 	int flow = 'n';
+	int ret;
 
 	if (co->index >= SCI_NPORTS)
 		co->index = 0;
@@ -1345,10 +1347,19 @@
 #else
 	port->uartclk = CONFIG_CPU_CLOCK;
 #endif
+#if defined(__H8300S__)
+	h8300_sci_enable(port, sci_enable);
+#endif
 	if (options)
 		uart_parse_options(options, &baud, &parity, &bits, &flow);
 
-	return uart_set_options(port, co, baud, parity, bits, flow);
+	ret = uart_set_options(port, co, baud, parity, bits, flow);
+#if defined(__H8300H__) || defined(__H8300S__)
+	/* disable rx interrupt */
+	if (ret == 0)
+		sci_stop_rx(port);
+#endif
+	return ret;
 }
 
 static struct console serial_console = {
diff -Nru a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
--- a/drivers/serial/sunsab.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/serial/sunsab.c	Tue Jun 15 22:20:39 2004
@@ -97,9 +97,10 @@
 		udelay(1);
 }
 
-static void receive_chars(struct uart_sunsab_port *up,
-			  union sab82532_irq_status *stat,
-			  struct pt_regs *regs)
+static struct tty_struct *
+receive_chars(struct uart_sunsab_port *up,
+	      union sab82532_irq_status *stat,
+	      struct pt_regs *regs)
 {
 	struct tty_struct *tty = NULL;
 	unsigned char buf[32];
@@ -126,7 +127,7 @@
 	if (stat->sreg.isr0 & SAB82532_ISR0_TIME) {
 		sunsab_cec_wait(up);
 		writeb(SAB82532_CMDR_RFRD, &up->regs->w.cmdr);
-		return;
+		return tty;
 	}
 
 	if (stat->sreg.isr0 & SAB82532_ISR0_RFO)
@@ -153,7 +154,7 @@
 		if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
 			tty->flip.work.func((void *)tty);
 			if (tty->flip.count >= TTY_FLIPBUF_SIZE)
-				return; // if TTY_DONT_FLIP is set
+				return tty; // if TTY_DONT_FLIP is set
 		}
 
 		*tty->flip.char_buf_ptr = ch;
@@ -225,11 +226,10 @@
 		}
 	}
 
-	if (tty)
-		tty_flip_buffer_push(tty);
-
 	if (saw_console_brk)
 		sun_do_break();
+
+	return tty;
 }
 
 static void sunsab_stop_tx(struct uart_port *, unsigned int);
@@ -311,6 +311,7 @@
 static irqreturn_t sunsab_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct uart_sunsab_port *up = dev_id;
+	struct tty_struct *tty;
 	union sab82532_irq_status status;
 	unsigned long flags;
 
@@ -322,10 +323,11 @@
 	if (readb(&up->regs->r.gis) & SAB82532_GIS_ISA1)
 		status.sreg.isr1 = readb(&up->regs->r.isr1);
 
+	tty = NULL;
 	if (status.stat) {
 		if (status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME |
 					SAB82532_ISR0_RFO | SAB82532_ISR0_RPF))
-			receive_chars(up, &status, regs);
+			tty = receive_chars(up, &status, regs);
 		if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) ||
 		    (status.sreg.isr1 & SAB82532_ISR1_CSC))
 			check_status(up, &status);
@@ -335,6 +337,9 @@
 
 	spin_unlock(&up->port.lock);
 
+	if (tty)
+		tty_flip_buffer_push(tty);
+
 	up++;
 
 	spin_lock(&up->port.lock);
@@ -345,10 +350,11 @@
 	if (readb(&up->regs->r.gis) & SAB82532_GIS_ISB1)
 		status.sreg.isr1 = readb(&up->regs->r.isr1);
 
+	tty = NULL;
 	if (status.stat) {
 		if (status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME |
 					SAB82532_ISR0_RFO | SAB82532_ISR0_RPF))
-			receive_chars(up, &status, regs);
+			tty = receive_chars(up, &status, regs);
 		if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) ||
 		    (status.sreg.isr1 & (SAB82532_ISR1_BRK | SAB82532_ISR1_CSC)))
 			check_status(up, &status);
@@ -357,6 +363,9 @@
 	}
 
 	spin_unlock_irqrestore(&up->port.lock, flags);
+
+	if (tty)
+		tty_flip_buffer_push(tty);
 
 	return IRQ_HANDLED;
 }
diff -Nru a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
--- a/drivers/serial/sunsu.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/serial/sunsu.c	Tue Jun 15 22:20:37 2004
@@ -310,7 +310,7 @@
 	spin_unlock_irqrestore(&up->port.lock, flags);
 }
 
-static _INLINE_ void
+static _INLINE_ struct tty_struct *
 receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs *regs)
 {
 	struct tty_struct *tty = up->port.info->tty;
@@ -322,7 +322,7 @@
 		if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) {
 			tty->flip.work.func((void *)tty);
 			if (tty->flip.count >= TTY_FLIPBUF_SIZE)
-				return; // if TTY_DONT_FLIP is set
+				return tty; // if TTY_DONT_FLIP is set
 		}
 		ch = serial_inp(up, UART_RX);
 		*tty->flip.char_buf_ptr = ch;
@@ -396,10 +396,11 @@
 	ignore_char:
 		*status = serial_inp(up, UART_LSR);
 	} while ((*status & UART_LSR_DR) && (max_count-- > 0));
-	tty_flip_buffer_push(tty);
 
 	if (saw_console_brk)
 		sun_do_break();
+
+	return tty;
 }
 
 static _INLINE_ void transmit_chars(struct uart_sunsu_port *up)
@@ -464,12 +465,23 @@
 	spin_lock_irqsave(&up->port.lock, flags);
 
 	do {
+		struct tty_struct *tty;
+
 		status = serial_inp(up, UART_LSR);
+		tty = NULL;
 		if (status & UART_LSR_DR)
-			receive_chars(up, &status, regs);
+			tty = receive_chars(up, &status, regs);
 		check_modem_status(up);
 		if (status & UART_LSR_THRE)
 			transmit_chars(up);
+
+		spin_unlock_irqrestore(&up->port.lock, flags);
+
+		if (tty)
+			tty_flip_buffer_push(tty);
+
+		spin_lock_irqsave(&up->port.lock, flags);
+
 	} while (!(serial_in(up, UART_IIR) & UART_IIR_NO_INT));
 
 	spin_unlock_irqrestore(&up->port.lock, flags);
diff -Nru a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
--- a/drivers/serial/sunzilog.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/serial/sunzilog.c	Tue Jun 15 22:21:04 2004
@@ -313,9 +313,10 @@
 	}
 }
 
-static void sunzilog_receive_chars(struct uart_sunzilog_port *up,
-				   struct zilog_channel *channel,
-				   struct pt_regs *regs)
+static struct tty_struct *
+sunzilog_receive_chars(struct uart_sunzilog_port *up,
+		       struct zilog_channel *channel,
+		       struct pt_regs *regs)
 {
 	struct tty_struct *tty;
 	unsigned char ch, r1;
@@ -414,8 +415,7 @@
 		}
 	}
 
-	if (tty)
-		tty_flip_buffer_push(tty);
+	return tty;
 }
 
 static void sunzilog_status_handle(struct uart_sunzilog_port *up,
@@ -550,19 +550,21 @@
 	while (up) {
 		struct zilog_channel *channel
 			= ZILOG_CHANNEL_FROM_PORT(&up->port);
+		struct tty_struct *tty;
 		unsigned char r3;
 
 		spin_lock(&up->port.lock);
 		r3 = read_zsreg(channel, R3);
 
 		/* Channel A */
+		tty = NULL;
 		if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
 			sbus_writeb(RES_H_IUS, &channel->control);
 			ZSDELAY();
 			ZS_WSYNC(channel);
 
 			if (r3 & CHARxIP)
-				sunzilog_receive_chars(up, channel, regs);
+				tty = sunzilog_receive_chars(up, channel, regs);
 			if (r3 & CHAEXT)
 				sunzilog_status_handle(up, channel, regs);
 			if (r3 & CHATxIP)
@@ -570,24 +572,31 @@
 		}
 		spin_unlock(&up->port.lock);
 
+		if (tty)
+			tty_flip_buffer_push(tty);
+
 		/* Channel B */
 		up = up->next;
 		channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
 
 		spin_lock(&up->port.lock);
+		tty = NULL;
 		if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
 			sbus_writeb(RES_H_IUS, &channel->control);
 			ZSDELAY();
 			ZS_WSYNC(channel);
 
 			if (r3 & CHBRxIP)
-				sunzilog_receive_chars(up, channel, regs);
+				tty = sunzilog_receive_chars(up, channel, regs);
 			if (r3 & CHBEXT)
 				sunzilog_status_handle(up, channel, regs);
 			if (r3 & CHBTxIP)
 				sunzilog_transmit_chars(up, channel);
 		}
 		spin_unlock(&up->port.lock);
+
+		if (tty)
+			tty_flip_buffer_push(tty);
 
 		up = up->next;
 	}
diff -Nru a/drivers/telephony/ixj.h b/drivers/telephony/ixj.h
--- a/drivers/telephony/ixj.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/telephony/ixj.h	Tue Jun 15 22:21:05 2004
@@ -1198,22 +1198,13 @@
 	int aec_level;
 	int cid_play_aec_level;
 	int readers, writers;
-#if LINUX_VERSION_CODE < 0x020400
-	struct wait_queue *poll_q;
-	struct wait_queue *read_q;
-#else
         wait_queue_head_t poll_q;
         wait_queue_head_t read_q;
-#endif
 	char *read_buffer, *read_buffer_end;
 	char *read_convert_buffer;
 	size_t read_buffer_size;
 	unsigned int read_buffer_ready;
-#if LINUX_VERSION_CODE < 0x020400
-	struct wait_queue *write_q;
-#else
         wait_queue_head_t write_q;
-#endif
 	char *write_buffer, *write_buffer_end;
 	char *write_convert_buffer;
 	size_t write_buffer_size;
diff -Nru a/drivers/usb/Makefile b/drivers/usb/Makefile
--- a/drivers/usb/Makefile	Tue Jun 15 22:21:03 2004
+++ b/drivers/usb/Makefile	Tue Jun 15 22:21:03 2004
@@ -66,3 +66,4 @@
 obj-$(CONFIG_USB_TEST)		+= misc/
 obj-$(CONFIG_USB_TIGL)		+= misc/
 obj-$(CONFIG_USB_USS720)	+= misc/
+obj-$(CONFIG_USB_PHIDGETSERVO)	+= misc/
diff -Nru a/drivers/usb/class/bluetty.c b/drivers/usb/class/bluetty.c
--- a/drivers/usb/class/bluetty.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/class/bluetty.c	Tue Jun 15 22:20:43 2004
@@ -1234,7 +1234,7 @@
 	.chars_in_buffer =	bluetooth_chars_in_buffer,
 };
 
-int usb_bluetooth_init(void)
+static int usb_bluetooth_init(void)
 {
 	int i;
 	int result;
@@ -1283,7 +1283,7 @@
 }
 
 
-void usb_bluetooth_exit(void)
+static void usb_bluetooth_exit(void)
 {
 	usb_deregister(&usb_bluetooth_driver);
 	tty_unregister_driver(bluetooth_tty_driver);
diff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
--- a/drivers/usb/class/cdc-acm.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/usb/class/cdc-acm.c	Tue Jun 15 22:20:42 2004
@@ -567,6 +567,8 @@
  * USB probe and disconnect routines.
  */
 
+#define CHECK_XFERTYPE(descr, xfer_type) (((descr)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == xfer_type)
+			
 static int acm_probe (struct usb_interface *intf,
 		      const struct usb_device_id *id)
 {
@@ -583,143 +585,150 @@
 
 	dev = interface_to_usbdev (intf);
 
-			cfacm = dev->actconfig;
-	
-			/* We know we're probe()d with the control interface. */
-			ifcom = intf->cur_altsetting;
-
-			/* ACM doesn't guarantee the data interface is
-			 * adjacent to the control interface, or that if one
-			 * is there it's not for call management ... so find
-			 * it
-			 */
-			for (j = 0; j < cfacm->desc.bNumInterfaces; j++) {
-				ifdata = cfacm->interface[j]->cur_altsetting;
-				data = cfacm->interface[j];
-
-				if (ifdata->desc.bInterfaceClass == 10 &&
-				    ifdata->desc.bNumEndpoints == 2) {
-					epctrl = &ifcom->endpoint[0].desc;
-					epread = &ifdata->endpoint[0].desc;
-					epwrite = &ifdata->endpoint[1].desc;
-
-					if ((epctrl->bEndpointAddress & 0x80) != 0x80 ||
-					    (epctrl->bmAttributes & 3) != 3 ||
-					    (epread->bmAttributes & 3) != 2 || 
-					    (epwrite->bmAttributes & 3) != 2 ||
-					    ((epread->bEndpointAddress & 0x80) ^ (epwrite->bEndpointAddress & 0x80)) != 0x80) 
-						goto next_interface;
-
-					if ((epread->bEndpointAddress & 0x80) != 0x80) {
-						epread = &ifdata->endpoint[1].desc;
-						epwrite = &ifdata->endpoint[0].desc;
-					}
-					dbg("found data interface at %d\n", j);
-					break;
-				} else {
-next_interface:
-					ifdata = NULL;
-					data = NULL;
-				}
-			}
-
-			/* there's been a problem */
-			if (!ifdata) {
-				dbg("interface not found (%p)\n", ifdata);
-				return -ENODEV;
-
-			}
-
-			for (minor = 0; minor < ACM_TTY_MINORS && acm_table[minor]; minor++);
-			if (acm_table[minor]) {
-				err("no more free acm devices");
-				return -ENODEV;
-			}
+	cfacm = dev->actconfig;
 
-			if (!(acm = kmalloc(sizeof(struct acm), GFP_KERNEL))) {
-				err("out of memory");
-				return -ENOMEM;
-			}
-			memset(acm, 0, sizeof(struct acm));
-
-			ctrlsize = epctrl->wMaxPacketSize;
-			readsize = epread->wMaxPacketSize;
-			acm->writesize = epwrite->wMaxPacketSize;
-			acm->control = intf;
-			acm->data = data;
-			acm->minor = minor;
-			acm->dev = dev;
-
-			acm->bh.func = acm_rx_tasklet;
-			acm->bh.data = (unsigned long) acm;
-			INIT_WORK(&acm->work, acm_softint, acm);
-
-			if (!(buf = kmalloc(ctrlsize + readsize + acm->writesize, GFP_KERNEL))) {
-				err("out of memory");
-				kfree(acm);
-				return -ENOMEM;
-			}
+	/* We know we're probe()d with the control interface. */
+	ifcom = intf->cur_altsetting;
 
-			acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL);
-			if (!acm->ctrlurb) {
-				err("out of memory");
-				kfree(acm);
-				kfree(buf);
-				return -ENOMEM;
-			}
-			acm->readurb = usb_alloc_urb(0, GFP_KERNEL);
-			if (!acm->readurb) {
-				err("out of memory");
-				usb_free_urb(acm->ctrlurb);
-				kfree(acm);
-				kfree(buf);
-				return -ENOMEM;
-			}
-			acm->writeurb = usb_alloc_urb(0, GFP_KERNEL);
-			if (!acm->writeurb) {
-				err("out of memory");
-				usb_free_urb(acm->readurb);
-				usb_free_urb(acm->ctrlurb);
-				kfree(acm);
-				kfree(buf);
-				return -ENOMEM;
-			}
-
-			usb_fill_int_urb(acm->ctrlurb, dev, usb_rcvintpipe(dev, epctrl->bEndpointAddress),
-				buf, ctrlsize, acm_ctrl_irq, acm, epctrl->bInterval);
+	/* ACM doesn't guarantee the data interface is
+	 * adjacent to the control interface, or that if one
+	 * is there it's not for call management ... so find
+	 * it
+	 */
+	for (j = 0; j < cfacm->desc.bNumInterfaces; j++) {
+		ifdata = cfacm->interface[j]->cur_altsetting;
+		data = cfacm->interface[j];
+
+		if (ifdata->desc.bInterfaceClass == USB_CLASS_CDC_DATA
+		    && ifdata->desc.bNumEndpoints == 2) {
+			
+			epctrl = &ifcom->endpoint[0].desc;
+			epread = &ifdata->endpoint[0].desc;
+			epwrite = &ifdata->endpoint[1].desc;
+
+			if ((epctrl->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN
+			    || !CHECK_XFERTYPE(epctrl,  USB_ENDPOINT_XFER_INT)
+			    || !CHECK_XFERTYPE(epread,  USB_ENDPOINT_XFER_BULK)
+			    || !CHECK_XFERTYPE(epwrite, USB_ENDPOINT_XFER_BULK)
+			    || ((epread->bEndpointAddress & USB_DIR_IN)
+			        ^ (epwrite->bEndpointAddress & USB_DIR_IN)) != USB_DIR_IN) {
+				/* not suitable */
+				goto next_interface;
+			}
+			
+			if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) {
+				/* descriptors are swapped */
+				epread = &ifdata->endpoint[1].desc;
+				epwrite = &ifdata->endpoint[0].desc;
+			}
+			dev_dbg(&intf->dev, "found data interface at %d\n", j);
+			break;
+		} else {
+next_interface:
+			ifdata = NULL;
+			data = NULL;
+		}
+	}
+
+	/* there's been a problem */
+	if (!ifdata) {
+		dev_dbg(&intf->dev, "data interface not found\n");
+		return -ENODEV;
+
+	}
+
+	for (minor = 0; minor < ACM_TTY_MINORS && acm_table[minor]; minor++);
+	if (acm_table[minor]) {
+		err("no more free acm devices");
+		return -ENODEV;
+	}
+
+	if (!(acm = kmalloc(sizeof(struct acm), GFP_KERNEL))) {
+		dev_dbg(&intf->dev, "out of memory (acm kmalloc)\n");
+		return -ENOMEM;
+	}
+	
+	memset(acm, 0, sizeof(struct acm));
 
-			usb_fill_bulk_urb(acm->readurb, dev, usb_rcvbulkpipe(dev, epread->bEndpointAddress),
-				buf += ctrlsize, readsize, acm_read_bulk, acm);
-			acm->readurb->transfer_flags |= URB_NO_FSBR;
-
-			usb_fill_bulk_urb(acm->writeurb, dev, usb_sndbulkpipe(dev, epwrite->bEndpointAddress),
-				buf += readsize, acm->writesize, acm_write_bulk, acm);
-			acm->writeurb->transfer_flags |= URB_NO_FSBR;
-
-			dev_info(&intf->dev, "ttyACM%d: USB ACM device", minor);
-
-			acm_set_control(acm, acm->ctrlout);
-
-			acm->line.speed = cpu_to_le32(9600);
-			acm->line.databits = 8;
-			acm_set_line(acm, &acm->line);
-
-			if ( (j = usb_driver_claim_interface(&acm_driver, data, acm)) != 0) {
-				err("claim failed");
-				usb_free_urb(acm->ctrlurb);
-				usb_free_urb(acm->readurb);
-				usb_free_urb(acm->writeurb);
-				kfree(acm);
-				kfree(buf);
-				return j;
-			} 
-
-			tty_register_device(acm_tty_driver, minor, &intf->dev);
-
-			acm_table[minor] = acm;
-			usb_set_intfdata (intf, acm);
-			return 0;
+	ctrlsize = epctrl->wMaxPacketSize;
+	readsize = epread->wMaxPacketSize;
+	acm->writesize = epwrite->wMaxPacketSize;
+	acm->control = intf;
+	acm->data = data;
+	acm->minor = minor;
+	acm->dev = dev;
+
+	acm->bh.func = acm_rx_tasklet;
+	acm->bh.data = (unsigned long) acm;
+	INIT_WORK(&acm->work, acm_softint, acm);
+
+	if (!(buf = kmalloc(ctrlsize + readsize + acm->writesize, GFP_KERNEL))) {
+		dev_dbg(&intf->dev, "out of memory (buf kmalloc)\n");
+		kfree(acm);
+		return -ENOMEM;
+	}
+
+	acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL);
+	if (!acm->ctrlurb) {
+		dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)\n");
+		kfree(acm);
+		kfree(buf);
+		return -ENOMEM;
+	}
+	acm->readurb = usb_alloc_urb(0, GFP_KERNEL);
+	if (!acm->readurb) {
+		dev_dbg(&intf->dev, "out of memory (readurb kmalloc)\n");
+		usb_free_urb(acm->ctrlurb);
+		kfree(acm);
+		kfree(buf);
+		return -ENOMEM;
+	}
+	acm->writeurb = usb_alloc_urb(0, GFP_KERNEL);
+	if (!acm->writeurb) {
+		dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)\n");
+		usb_free_urb(acm->readurb);
+		usb_free_urb(acm->ctrlurb);
+		kfree(acm);
+		kfree(buf);
+		return -ENOMEM;
+	}
+
+	usb_fill_int_urb(acm->ctrlurb, dev, usb_rcvintpipe(dev, epctrl->bEndpointAddress),
+		buf, ctrlsize, acm_ctrl_irq, acm, epctrl->bInterval);
+
+	usb_fill_bulk_urb(acm->readurb, dev, usb_rcvbulkpipe(dev, epread->bEndpointAddress),
+		buf += ctrlsize, readsize, acm_read_bulk, acm);
+	acm->readurb->transfer_flags |= URB_NO_FSBR;
+
+	usb_fill_bulk_urb(acm->writeurb, dev, usb_sndbulkpipe(dev, epwrite->bEndpointAddress),
+		buf += readsize, acm->writesize, acm_write_bulk, acm);
+	acm->writeurb->transfer_flags |= URB_NO_FSBR;
+
+	if ( (j = usb_driver_claim_interface(&acm_driver, data, acm)) != 0) {
+		err("claim failed");
+		usb_free_urb(acm->ctrlurb);
+		usb_free_urb(acm->readurb);
+		usb_free_urb(acm->writeurb);
+		kfree(acm);
+		kfree(buf);
+		return j;
+	} 
+
+	tty_register_device(acm_tty_driver, minor, &intf->dev);
+
+	dev_info(&intf->dev, "ttyACM%d: USB ACM device\n", minor);
+
+	acm_set_control(acm, acm->ctrlout);
+
+	acm->line.speed = cpu_to_le32(9600);
+	acm->line.databits = 8;
+	acm_set_line(acm, &acm->line);
+
+	acm_table[minor] = acm;
+	usb_set_intfdata (intf, acm);
+	return 0;
 }
+#undef CHECK_XFERTYPE
 
 static void acm_disconnect(struct usb_interface *intf)
 {
diff -Nru a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
--- a/drivers/usb/class/usblp.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/usb/class/usblp.c	Tue Jun 15 22:20:37 2004
@@ -226,11 +226,21 @@
 
 static int usblp_ctrl_msg(struct usblp *usblp, int request, int type, int dir, int recip, int value, void *buf, int len)
 {
-	int retval = usb_control_msg(usblp->dev,
+	int retval;
+	int index = usblp->ifnum;
+
+	/* High byte has the interface index.
+	   Low byte has the alternate setting.
+	 */
+	if ((request == USBLP_REQ_GET_ID) && (type == USB_TYPE_CLASS)) {
+	  index = (usblp->ifnum<<8)|usblp->protocol[usblp->current_protocol].alt_setting;
+	}
+
+	retval = usb_control_msg(usblp->dev,
 		dir ? usb_rcvctrlpipe(usblp->dev, 0) : usb_sndctrlpipe(usblp->dev, 0),
-		request, type | dir | recip, value, usblp->ifnum, buf, len, USBLP_WRITE_TIMEOUT);
-	dbg("usblp_control_msg: rq: 0x%02x dir: %d recip: %d value: %d len: %#x result: %d",
-		request, !!dir, recip, value, len, retval);
+		request, type | dir | recip, value, index, buf, len, USBLP_WRITE_TIMEOUT);
+	dbg("usblp_control_msg: rq: 0x%02x dir: %d recip: %d value: %d idx: %d len: %#x result: %d",
+		request, !!dir, recip, value, index, len, retval);
 	return retval < 0 ? retval : 0;
 }
 
@@ -439,6 +449,9 @@
 		retval = -ENODEV;
 		goto done;
 	}
+
+	dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd),
+		_IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) );
 
 	if (_IOC_TYPE(cmd) == 'P')	/* new-style ioctl number */
 
diff -Nru a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
--- a/drivers/usb/core/Makefile	Tue Jun 15 22:21:05 2004
+++ b/drivers/usb/core/Makefile	Tue Jun 15 22:21:05 2004
@@ -3,7 +3,7 @@
 #
 
 usbcore-objs	:= usb.o hub.o hcd.o urb.o message.o \
-			config.o file.o buffer.o driverfs.o
+			config.o file.o buffer.o sysfs.o
 
 ifeq ($(CONFIG_PCI),y)
 	usbcore-objs	+= hcd-pci.o
diff -Nru a/drivers/usb/core/config.c b/drivers/usb/core/config.c
--- a/drivers/usb/core/config.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/core/config.c	Tue Jun 15 22:20:36 2004
@@ -18,6 +18,11 @@
 #define USB_MAXCONFIG			8	/* Arbitrary limit */
 
 
+static inline const char *plural(int n)
+{
+	return (n == 1 ? "" : "s");
+}
+
 static int find_next_descriptor(unsigned char *buffer, int size,
     int dt1, int dt2, int *num_skipped)
 {
@@ -26,7 +31,7 @@
 	unsigned char *buffer0 = buffer;
 
 	/* Find the next descriptor of type dt1 or dt2 */
-	while (size >= sizeof(struct usb_descriptor_header)) {
+	while (size > 0) {
 		h = (struct usb_descriptor_header *) buffer;
 		if (h->bDescriptorType == dt1 || h->bDescriptorType == dt2)
 			break;
@@ -43,46 +48,46 @@
 }
 
 static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
-    int asnum, struct usb_host_endpoint *endpoint,
+    int asnum, struct usb_host_interface *ifp, int num_ep,
     unsigned char *buffer, int size)
 {
 	unsigned char *buffer0 = buffer;
-	struct usb_descriptor_header *header;
+	struct usb_endpoint_descriptor *d;
+	struct usb_host_endpoint *endpoint;
 	int n, i;
 
-	header = (struct usb_descriptor_header *)buffer;
-	if (header->bDescriptorType != USB_DT_ENDPOINT) {
-		dev_err(ddev, "config %d interface %d altsetting %d has an "
-		    "unexpected descriptor of type 0x%X, "
-		    "expecting endpoint type 0x%X\n",
-		    cfgno, inum, asnum,
-		    header->bDescriptorType, USB_DT_ENDPOINT);
-		return -EINVAL;
-	}
+	d = (struct usb_endpoint_descriptor *) buffer;
+	buffer += d->bLength;
+	size -= d->bLength;
 
-	if (header->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE)
-		memcpy(&endpoint->desc, buffer, USB_DT_ENDPOINT_AUDIO_SIZE);
-	else if (header->bLength >= USB_DT_ENDPOINT_SIZE)
-		memcpy(&endpoint->desc, buffer, USB_DT_ENDPOINT_SIZE);
+	if (d->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE)
+		n = USB_DT_ENDPOINT_AUDIO_SIZE;
+	else if (d->bLength >= USB_DT_ENDPOINT_SIZE)
+		n = USB_DT_ENDPOINT_SIZE;
 	else {
-		dev_err(ddev, "config %d interface %d altsetting %d has an "
-		    "invalid endpoint descriptor of length %d\n",
-		    cfgno, inum, asnum, header->bLength);
-		return -EINVAL;
+		dev_warn(ddev, "config %d interface %d altsetting %d has an "
+		    "invalid endpoint descriptor of length %d, skipping\n",
+		    cfgno, inum, asnum, d->bLength);
+		goto skip_to_next_endpoint_or_interface_descriptor;
 	}
 
-	i = endpoint->desc.bEndpointAddress & ~USB_ENDPOINT_DIR_MASK;
+	i = d->bEndpointAddress & ~USB_ENDPOINT_DIR_MASK;
 	if (i >= 16 || i == 0) {
-		dev_err(ddev, "config %d interface %d altsetting %d has an "
-		    "invalid endpoint with address 0x%X\n",
-		    cfgno, inum, asnum, endpoint->desc.bEndpointAddress);
-		return -EINVAL;
+		dev_warn(ddev, "config %d interface %d altsetting %d has an "
+		    "invalid endpoint with address 0x%X, skipping\n",
+		    cfgno, inum, asnum, d->bEndpointAddress);
+		goto skip_to_next_endpoint_or_interface_descriptor;
 	}
 
-	le16_to_cpus(&endpoint->desc.wMaxPacketSize);
+	/* Only store as many endpoints as we have room for */
+	if (ifp->desc.bNumEndpoints >= num_ep)
+		goto skip_to_next_endpoint_or_interface_descriptor;
+
+	endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
+	++ifp->desc.bNumEndpoints;
 
-	buffer += header->bLength;
-	size -= header->bLength;
+	memcpy(&endpoint->desc, d, n);
+	le16_to_cpus(&endpoint->desc.wMaxPacketSize);
 
 	/* Skip over any Class Specific or Vendor Specific descriptors;
 	 * find the next endpoint or interface descriptor */
@@ -91,67 +96,72 @@
 	    USB_DT_INTERFACE, &n);
 	endpoint->extralen = i;
 	if (n > 0)
-		dev_dbg(ddev, "skipped %d class/vendor specific endpoint "
-		    "descriptors\n", n);
+		dev_dbg(ddev, "skipped %d descriptor%s after %s\n",
+		    n, plural(n), "endpoint");
+	return buffer - buffer0 + i;
+
+skip_to_next_endpoint_or_interface_descriptor:
+	i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT,
+	    USB_DT_INTERFACE, NULL);
 	return buffer - buffer0 + i;
 }
 
-static void usb_free_intf(struct usb_interface *intf)
+static void usb_release_interface_cache(struct kref *ref)
 {
+	struct usb_interface_cache *intfc = ref_to_usb_interface_cache(ref);
 	int j;
 
-	if (intf->altsetting) {
-		for (j = 0; j < intf->num_altsetting; j++) {
-			struct usb_host_interface *alt = &intf->altsetting[j];
-
-			kfree(alt->endpoint);
-		}
-		kfree(intf->altsetting);
-	}
-	kfree(intf);
+	for (j = 0; j < intfc->num_altsetting; j++)
+		kfree(intfc->altsetting[j].endpoint);
+	kfree(intfc);
 }
 
 static int usb_parse_interface(struct device *ddev, int cfgno,
-    struct usb_host_config *config, unsigned char *buffer, int size)
+    struct usb_host_config *config, unsigned char *buffer, int size,
+    u8 inums[], u8 nalts[])
 {
 	unsigned char *buffer0 = buffer;
 	struct usb_interface_descriptor	*d;
 	int inum, asnum;
-	struct usb_interface *interface;
+	struct usb_interface_cache *intfc;
 	struct usb_host_interface *alt;
 	int i, n;
 	int len, retval;
+	int num_ep, num_ep_orig;
 
 	d = (struct usb_interface_descriptor *) buffer;
 	buffer += d->bLength;
 	size -= d->bLength;
 
-	if (d->bDescriptorType != USB_DT_INTERFACE) {
-		dev_err(ddev, "config %d has an unexpected descriptor of type "
-		    "0x%X, expecting interface type 0x%X\n",
-		    cfgno, d->bDescriptorType, USB_DT_INTERFACE);
-		return -EINVAL;
-	}
+	if (d->bLength < USB_DT_INTERFACE_SIZE)
+		goto skip_to_next_interface_descriptor;
 
+	/* Which interface entry is this? */
+	intfc = NULL;
 	inum = d->bInterfaceNumber;
-	if (inum >= config->desc.bNumInterfaces)
+	for (i = 0; i < config->desc.bNumInterfaces; ++i) {
+		if (inums[i] == inum) {
+			intfc = config->intf_cache[i];
+			break;
+		}
+	}
+	if (!intfc || intfc->num_altsetting >= nalts[i])
 		goto skip_to_next_interface_descriptor;
 
-	interface = config->interface[inum];
+	/* Check for duplicate altsetting entries */
 	asnum = d->bAlternateSetting;
-	if (asnum >= interface->num_altsetting) {
-		dev_err(ddev, "config %d interface %d has an invalid "
-		    "alternate setting number: %d but max is %d\n",
-		    cfgno, inum, asnum, interface->num_altsetting - 1);
-		return -EINVAL;
+	for ((i = 0, alt = &intfc->altsetting[0]);
+	      i < intfc->num_altsetting;
+	     (++i, ++alt)) {
+		if (alt->desc.bAlternateSetting == asnum) {
+			dev_warn(ddev, "Duplicate descriptor for config %d "
+			    "interface %d altsetting %d, skipping\n",
+			    cfgno, inum, asnum);
+			goto skip_to_next_interface_descriptor;
+		}
 	}
 
-	alt = &interface->altsetting[asnum];
-	if (alt->desc.bLength) {
-		dev_err(ddev, "Duplicate descriptor for config %d "
-		    "interface %d altsetting %d\n", cfgno, inum, asnum);
-		return -EINVAL;
-	}
+	++intfc->num_altsetting;
 	memcpy(&alt->desc, d, USB_DT_INTERFACE_SIZE);
 
 	/* Skip over any Class Specific or Vendor Specific descriptors;
@@ -161,41 +171,48 @@
 	    USB_DT_INTERFACE, &n);
 	alt->extralen = i;
 	if (n > 0)
-		dev_dbg(ddev, "skipped %d class/vendor specific "
-		    "interface descriptors\n", n);
+		dev_dbg(ddev, "skipped %d descriptor%s after %s\n",
+		    n, plural(n), "interface");
 	buffer += i;
 	size -= i;
 
-	if (alt->desc.bNumEndpoints > USB_MAXENDPOINTS) {
-		dev_err(ddev, "too many endpoints for config %d interface %d "
-		    "altsetting %d: %d, maximum allowed: %d\n",
-		    cfgno, inum, asnum, alt->desc.bNumEndpoints,
-		    USB_MAXENDPOINTS);
-		return -EINVAL;
+	/* Allocate space for the right(?) number of endpoints */
+	num_ep = num_ep_orig = alt->desc.bNumEndpoints;
+	alt->desc.bNumEndpoints = 0;		// Use as a counter
+	if (num_ep > USB_MAXENDPOINTS) {
+		dev_warn(ddev, "too many endpoints for config %d interface %d "
+		    "altsetting %d: %d, using maximum allowed: %d\n",
+		    cfgno, inum, asnum, num_ep, USB_MAXENDPOINTS);
+		num_ep = USB_MAXENDPOINTS;
 	}
 
-	len = alt->desc.bNumEndpoints * sizeof(struct usb_host_endpoint);
+	len = sizeof(struct usb_host_endpoint) * num_ep;
 	alt->endpoint = kmalloc(len, GFP_KERNEL);
 	if (!alt->endpoint)
 		return -ENOMEM;
 	memset(alt->endpoint, 0, len);
 
-	for (i = 0; i < alt->desc.bNumEndpoints; i++) {
-		if (size < USB_DT_ENDPOINT_SIZE) {
-			dev_err(ddev, "too few endpoint descriptors for "
-			    "config %d interface %d altsetting %d\n",
-			    cfgno, inum, asnum);
-			return -EINVAL;
-		}
-
-		retval = usb_parse_endpoint(ddev, cfgno, inum, asnum,
-		    alt->endpoint + i, buffer, size);
+	/* Parse all the endpoint descriptors */
+	n = 0;
+	while (size > 0) {
+		if (((struct usb_descriptor_header *) buffer)->bDescriptorType
+		     == USB_DT_INTERFACE)
+			break;
+		retval = usb_parse_endpoint(ddev, cfgno, inum, asnum, alt,
+		    num_ep, buffer, size);
 		if (retval < 0)
 			return retval;
+		++n;
 
 		buffer += retval;
 		size -= retval;
 	}
+
+	if (n != num_ep_orig)
+		dev_warn(ddev, "config %d interface %d altsetting %d has %d "
+		    "endpoint descriptor%s, different from the interface "
+		    "descriptor's value: %d\n",
+		    cfgno, inum, asnum, n, plural(n), num_ep_orig);
 	return buffer - buffer0;
 
 skip_to_next_interface_descriptor:
@@ -207,14 +224,16 @@
 int usb_parse_configuration(struct device *ddev, int cfgidx,
     struct usb_host_config *config, unsigned char *buffer, int size)
 {
+	unsigned char *buffer0 = buffer;
 	int cfgno;
 	int nintf, nintf_orig;
 	int i, j, n;
-	struct usb_interface *interface;
+	struct usb_interface_cache *intfc;
 	unsigned char *buffer2;
 	int size2;
 	struct usb_descriptor_header *header;
 	int len, retval;
+	u8 inums[USB_MAXINTERFACES], nalts[USB_MAXINTERFACES];
 
 	memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE);
 	if (config->desc.bDescriptorType != USB_DT_CONFIG ||
@@ -224,7 +243,6 @@
 		    config->desc.bDescriptorType, config->desc.bLength);
 		return -EINVAL;
 	}
-	config->desc.wTotalLength = size;
 	cfgno = config->desc.bConfigurationValue;
 
 	buffer += config->desc.bLength;
@@ -235,84 +253,110 @@
 		dev_warn(ddev, "config %d has too many interfaces: %d, "
 		    "using maximum allowed: %d\n",
 		    cfgno, nintf, USB_MAXINTERFACES);
-		config->desc.bNumInterfaces = nintf = USB_MAXINTERFACES;
-	}
-
-	for (i = 0; i < nintf; ++i) {
-		interface = config->interface[i] =
-		    kmalloc(sizeof(struct usb_interface), GFP_KERNEL);
-		if (!interface)
-			return -ENOMEM;
-		memset(interface, 0, sizeof(struct usb_interface));
+		nintf = USB_MAXINTERFACES;
 	}
 
 	/* Go through the descriptors, checking their length and counting the
 	 * number of altsettings for each interface */
+	n = 0;
 	for ((buffer2 = buffer, size2 = size);
-	      size2 >= sizeof(struct usb_descriptor_header);
+	      size2 > 0;
 	     (buffer2 += header->bLength, size2 -= header->bLength)) {
 
+		if (size2 < sizeof(struct usb_descriptor_header)) {
+			dev_warn(ddev, "config %d descriptor has %d excess "
+			    "byte%s, ignoring\n",
+			    cfgno, size2, plural(size2));
+			break;
+		}
+
 		header = (struct usb_descriptor_header *) buffer2;
 		if ((header->bLength > size2) || (header->bLength < 2)) {
-			dev_err(ddev, "config %d has an invalid descriptor "
-			    "of length %d\n", cfgno, header->bLength);
-			return -EINVAL;
+			dev_warn(ddev, "config %d has an invalid descriptor "
+			    "of length %d, skipping remainder of the config\n",
+			    cfgno, header->bLength);
+			break;
 		}
 
 		if (header->bDescriptorType == USB_DT_INTERFACE) {
 			struct usb_interface_descriptor *d;
+			int inum;
 
 			d = (struct usb_interface_descriptor *) header;
 			if (d->bLength < USB_DT_INTERFACE_SIZE) {
-				dev_err(ddev, "config %d has an invalid "
-				    "interface descriptor of length %d\n",
-				    cfgno, d->bLength);
-				return -EINVAL;
+				dev_warn(ddev, "config %d has an invalid "
+				    "interface descriptor of length %d, "
+				    "skipping\n", cfgno, d->bLength);
+				continue;
 			}
 
-			i = d->bInterfaceNumber;
-			if (i >= nintf_orig) {
-				dev_err(ddev, "config %d has an invalid "
+			inum = d->bInterfaceNumber;
+			if (inum >= nintf_orig)
+				dev_warn(ddev, "config %d has an invalid "
 				    "interface number: %d but max is %d\n",
-				    cfgno, i, nintf_orig - 1);
-				return -EINVAL;
+				    cfgno, inum, nintf_orig - 1);
+
+			/* Have we already encountered this interface?
+			 * Count its altsettings */
+			for (i = 0; i < n; ++i) {
+				if (inums[i] == inum)
+					break;
+			}
+			if (i < n) {
+				if (nalts[i] < 255)
+					++nalts[i];
+			} else if (n < USB_MAXINTERFACES) {
+				inums[n] = inum;
+				nalts[n] = 1;
+				++n;
 			}
-			if (i < nintf)
-				++config->interface[i]->num_altsetting;
 
 		} else if (header->bDescriptorType == USB_DT_DEVICE ||
-			    header->bDescriptorType == USB_DT_CONFIG) {
-			dev_err(ddev, "config %d contains an unexpected "
-			    "descriptor of type 0x%X\n",
+			    header->bDescriptorType == USB_DT_CONFIG)
+			dev_warn(ddev, "config %d contains an unexpected "
+			    "descriptor of type 0x%X, skipping\n",
 			    cfgno, header->bDescriptorType);
-			return -EINVAL;
-		}
 
 	}	/* for ((buffer2 = buffer, size2 = size); ...) */
+	size = buffer2 - buffer;
+	config->desc.wTotalLength = buffer2 - buffer0;
+
+	if (n != nintf)
+		dev_warn(ddev, "config %d has %d interface%s, different from "
+		    "the descriptor's value: %d\n",
+		    cfgno, n, plural(n), nintf_orig);
+	else if (n == 0)
+		dev_warn(ddev, "config %d has no interfaces?\n", cfgno);
+	config->desc.bNumInterfaces = nintf = n;
 
-	/* Allocate the altsetting arrays */
+	/* Check for missing interface numbers */
 	for (i = 0; i < nintf; ++i) {
-		interface = config->interface[i];
-		if (interface->num_altsetting > USB_MAXALTSETTING) {
-			dev_err(ddev, "too many alternate settings for "
-			    "config %d interface %d: %d, "
-			    "maximum allowed: %d\n",
-			    cfgno, i, interface->num_altsetting,
-			    USB_MAXALTSETTING);
-			return -EINVAL;
+		for (j = 0; j < nintf; ++j) {
+			if (inums[j] == i)
+				break;
 		}
-		if (interface->num_altsetting == 0) {
-			dev_err(ddev, "config %d has no interface number "
+		if (j >= nintf)
+			dev_warn(ddev, "config %d has no interface number "
 			    "%d\n", cfgno, i);
-			return -EINVAL;
+	}
+
+	/* Allocate the usb_interface_caches and altsetting arrays */
+	for (i = 0; i < nintf; ++i) {
+		j = nalts[i];
+		if (j > USB_MAXALTSETTING) {
+			dev_warn(ddev, "too many alternate settings for "
+			    "config %d interface %d: %d, "
+			    "using maximum allowed: %d\n",
+			    cfgno, inums[i], j, USB_MAXALTSETTING);
+			nalts[i] = j = USB_MAXALTSETTING;
 		}
 
-		len = sizeof(*interface->altsetting) *
-		    interface->num_altsetting;
-		interface->altsetting = kmalloc(len, GFP_KERNEL);
-		if (!interface->altsetting)
+		len = sizeof(*intfc) + sizeof(struct usb_host_interface) * j;
+		config->intf_cache[i] = intfc = kmalloc(len, GFP_KERNEL);
+		if (!intfc)
 			return -ENOMEM;
-		memset(interface->altsetting, 0, len);
+		memset(intfc, 0, len);
+		kref_init(&intfc->ref, usb_release_interface_cache);
 	}
 
 	/* Skip over any Class Specific or Vendor Specific descriptors;
@@ -322,15 +366,15 @@
 	    USB_DT_INTERFACE, &n);
 	config->extralen = i;
 	if (n > 0)
-		dev_dbg(ddev, "skipped %d class/vendor specific "
-		    "configuration descriptors\n", n);
+		dev_dbg(ddev, "skipped %d descriptor%s after %s\n",
+		    n, plural(n), "configuration");
 	buffer += i;
 	size -= i;
 
 	/* Parse all the interface/altsetting descriptors */
-	while (size >= sizeof(struct usb_descriptor_header)) {
+	while (size > 0) {
 		retval = usb_parse_interface(ddev, cfgno, config,
-		    buffer, size);
+		    buffer, size, inums, nalts);
 		if (retval < 0)
 			return retval;
 
@@ -340,17 +384,20 @@
 
 	/* Check for missing altsettings */
 	for (i = 0; i < nintf; ++i) {
-		interface = config->interface[i];
-		for (j = 0; j < interface->num_altsetting; ++j) {
-			if (!interface->altsetting[j].desc.bLength) {
-				dev_err(ddev, "config %d interface %d has no "
-				    "altsetting %d\n", cfgno, i, j);
-				return -EINVAL;
+		intfc = config->intf_cache[i];
+		for (j = 0; j < intfc->num_altsetting; ++j) {
+			for (n = 0; n < intfc->num_altsetting; ++n) {
+				if (intfc->altsetting[n].desc.
+				    bAlternateSetting == j)
+					break;
 			}
+			if (n >= intfc->num_altsetting)
+				dev_warn(ddev, "config %d interface %d has no "
+				    "altsetting %d\n", cfgno, inums[i], j);
 		}
 	}
 
-	return size;
+	return 0;
 }
 
 // hub-only!! ... and only exported for reset/reinit path.
@@ -374,10 +421,8 @@
 		struct usb_host_config *cf = &dev->config[c];
 
 		for (i = 0; i < cf->desc.bNumInterfaces; i++) {
-			struct usb_interface *ifp = cf->interface[i];
-
-			if (ifp)
-				usb_free_intf(ifp);
+			if (cf->intf_cache[i])
+				kref_put(&cf->intf_cache[i]->ref);
 		}
 	}
 	kfree(dev->config);
@@ -420,23 +465,24 @@
 		goto err2;
 	memset(dev->rawdescriptors, 0, length);
 
-	buffer = kmalloc(8, GFP_KERNEL);
+	buffer = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL);
 	if (!buffer)
 		goto err2;
 	desc = (struct usb_config_descriptor *)buffer;
 
 	for (cfgno = 0; cfgno < ncfg; cfgno++) {
-		/* We grab the first 8 bytes so we know how long the whole */
-		/* configuration is */
+		/* We grab just the first descriptor so we know how long
+		 * the whole configuration is */
 		result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,
-		    buffer, 8);
+		    buffer, USB_DT_CONFIG_SIZE);
 		if (result < 0) {
 			dev_err(ddev, "unable to read config index %d "
-			    "descriptor\n", cfgno);
+			    "descriptor/%s\n", cfgno, "start");
 			goto err;
-		} else if (result < 8) {
+		} else if (result < 4) {
 			dev_err(ddev, "config index %d descriptor too short "
-			    "(expected %i, got %i)\n", cfgno, 8, result);
+			    "(expected %i, got %i)\n", cfgno,
+			    USB_DT_CONFIG_SIZE, result);
 			result = -EINVAL;
 			goto err;
 		}
@@ -453,26 +499,21 @@
 		    bigbuffer, length);
 		if (result < 0) {
 			dev_err(ddev, "unable to read config index %d "
-			    "descriptor\n", cfgno);
+			    "descriptor/%s\n", cfgno, "all");
 			kfree(bigbuffer);
 			goto err;
 		}
 		if (result < length) {
-			dev_err(ddev, "config index %d descriptor too short "
+			dev_warn(ddev, "config index %d descriptor too short "
 			    "(expected %i, got %i)\n", cfgno, length, result);
-			result = -EINVAL;
-			kfree(bigbuffer);
-			goto err;
+			length = result;
 		}
 
 		dev->rawdescriptors[cfgno] = bigbuffer;
 
 		result = usb_parse_configuration(&dev->dev, cfgno,
 		    &dev->config[cfgno], bigbuffer, length);
-		if (result > 0)
-			dev_dbg(ddev, "config index %d descriptor has %d "
-			    "excess byte(s)\n", cfgno, result);
-		else if (result < 0) {
+		if (result < 0) {
 			++cfgno;
 			goto err;
 		}
diff -Nru a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
--- a/drivers/usb/core/devices.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/usb/core/devices.c	Tue Jun 15 22:21:04 2004
@@ -232,13 +232,21 @@
 	return start;
 }
 
-static char *usb_dump_interface_descriptor(char *start, char *end, const struct usb_interface *iface, int setno)
+static char *usb_dump_interface_descriptor(char *start, char *end,
+	const struct usb_interface_cache *intfc,
+	const struct usb_interface *iface,
+	int setno)
 {
-	struct usb_interface_descriptor *desc = &iface->altsetting[setno].desc;
+	const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc;
+	char *driver_name = "";
 
 	if (start > end)
 		return start;
 	down_read(&usb_bus_type.subsys.rwsem);
+	if (iface)
+		driver_name = (iface->dev.driver
+				? iface->dev.driver->name
+				: "(none)");
 	start += sprintf(start, format_iface,
 			 desc->bInterfaceNumber,
 			 desc->bAlternateSetting,
@@ -247,9 +255,7 @@
 			 class_decode(desc->bInterfaceClass),
 			 desc->bInterfaceSubClass,
 			 desc->bInterfaceProtocol,
-			 iface->dev.driver
-				? iface->dev.driver->name
-				: "(none)");
+			 driver_name);
 	up_read(&usb_bus_type.subsys.rwsem);
 	return start;
 }
@@ -258,13 +264,14 @@
 	int speed,
 	char *start,
 	char *end,
+	const struct usb_interface_cache *intfc,
 	const struct usb_interface *iface,
 	int setno
 ) {
-	struct usb_host_interface *desc = &iface->altsetting[setno];
+	const struct usb_host_interface *desc = &intfc->altsetting[setno];
 	int i;
 
-	start = usb_dump_interface_descriptor(start, end, iface, setno);
+	start = usb_dump_interface_descriptor(start, end, intfc, iface, setno);
 	for (i = 0; i < desc->desc.bNumEndpoints; i++) {
 		if (start > end)
 			return start;
@@ -303,6 +310,7 @@
 )
 {
 	int i, j;
+	struct usb_interface_cache *intfc;
 	struct usb_interface *interface;
 
 	if (start > end)
@@ -311,14 +319,13 @@
 		return start + sprintf(start, "(null Cfg. desc.)\n");
 	start = usb_dump_config_descriptor(start, end, &config->desc, active);
 	for (i = 0; i < config->desc.bNumInterfaces; i++) {
+		intfc = config->intf_cache[i];
 		interface = config->interface[i];
-		if (!interface)
-			break;
-		for (j = 0; j < interface->num_altsetting; j++) {
+		for (j = 0; j < intfc->num_altsetting; j++) {
 			if (start > end)
 				return start;
 			start = usb_dump_interface(speed,
-					start, end, interface, j);
+				start, end, intfc, interface, j);
 		}
 	}
 	return start;
@@ -395,7 +402,7 @@
 		return start;
 	
 	start = usb_dump_device_strings (start, end, dev);
-	
+
 	for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
 		if (start > end)
 			return start;
@@ -445,6 +452,7 @@
  * nbytes - the maximum number of bytes to write
  * skip_bytes - the number of bytes to skip before writing anything
  * file_offset - the offset into the devices file on completion
+ * The caller must own the usbdev->serialize semaphore.
  */
 static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, loff_t *skip_bytes, loff_t *file_offset,
 				struct usb_device *usbdev, struct usb_bus *bus, int level, int index, int count)
@@ -545,9 +553,13 @@
 	
 	/* Now look at all of this device's children. */
 	for (chix = 0; chix < usbdev->maxchild; chix++) {
-		if (usbdev->children[chix]) {
-			ret = usb_device_dump(buffer, nbytes, skip_bytes, file_offset, usbdev->children[chix],
+		struct usb_device *childdev = usbdev->children[chix];
+
+		if (childdev) {
+			down(&childdev->serialize);
+			ret = usb_device_dump(buffer, nbytes, skip_bytes, file_offset, childdev,
 					bus, level + 1, chix, ++cnt);
+			up(&childdev->serialize);
 			if (ret == -EFAULT)
 				return total_written;
 			total_written += ret;
@@ -575,8 +587,11 @@
 	for (buslist = usb_bus_list.next; buslist != &usb_bus_list; buslist = buslist->next) {
 		/* print devices for this bus */
 		bus = list_entry(buslist, struct usb_bus, bus_list);
+
 		/* recurse through all children of the root hub */
+		down(&bus->root_hub->serialize);
 		ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, bus->root_hub, bus, 0, 0, 0);
+		up(&bus->root_hub->serialize);
 		if (ret < 0) {
 			up(&usb_bus_list_lock);
 			return ret;
diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/core/devio.c	Tue Jun 15 22:20:40 2004
@@ -45,6 +45,7 @@
 #include <linux/usbdevice_fs.h>
 #include <asm/uaccess.h>
 #include <asm/byteorder.h>
+#include <linux/moduleparam.h>
 
 #include "hcd.h"	/* for usbcore internals */
 #include "usb.h"
@@ -54,12 +55,28 @@
 	struct dev_state *ps;
 	struct task_struct *task;
 	unsigned int signr;
-	unsigned int intf;
+	unsigned int ifnum;
 	void __user *userbuffer;
 	void __user *userurb;
 	struct urb *urb;
 };
 
+static int usbfs_snoop = 0;
+module_param (usbfs_snoop, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC (usbfs_snoop, "true to log all usbfs traffic");
+
+#define snoop(dev, format, arg...)				\
+	do {							\
+		if (usbfs_snoop)				\
+			dev_info( dev , format , ## arg);	\
+	} while (0)
+
+
+static inline int connected (struct usb_device *dev)
+{
+	return dev->state != USB_STATE_NOTATTACHED;
+}
+
 static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig)
 {
 	loff_t ret;
@@ -87,14 +104,15 @@
 static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
 	struct dev_state *ps = (struct dev_state *)file->private_data;
+	struct usb_device *dev = ps->dev;
 	ssize_t ret = 0;
 	unsigned len;
 	loff_t pos;
 	int i;
 
 	pos = *ppos;
-	down_read(&ps->devsem);
-	if (!ps->dev) {
+	down(&dev->serialize);
+	if (!connected(dev)) {
 		ret = -ENODEV;
 		goto err;
 	} else if (pos < 0) {
@@ -106,7 +124,7 @@
 		len = sizeof(struct usb_device_descriptor) - pos;
 		if (len > nbytes)
 			len = nbytes;
-		if (copy_to_user(buf, ((char *)&ps->dev->descriptor) + pos, len)) {
+		if (copy_to_user(buf, ((char *)&dev->descriptor) + pos, len)) {
 			ret = -EFAULT;
 			goto err;
 		}
@@ -118,9 +136,9 @@
 	}
 
 	pos = sizeof(struct usb_device_descriptor);
-	for (i = 0; nbytes && i < ps->dev->descriptor.bNumConfigurations; i++) {
+	for (i = 0; nbytes && i < dev->descriptor.bNumConfigurations; i++) {
 		struct usb_config_descriptor *config =
-			(struct usb_config_descriptor *)ps->dev->rawdescriptors[i];
+			(struct usb_config_descriptor *)dev->rawdescriptors[i];
 		unsigned int length = le16_to_cpu(config->wTotalLength);
 
 		if (*ppos < pos + length) {
@@ -128,7 +146,7 @@
 			/* The descriptor may claim to be longer than it
 			 * really is.  Here is the actual allocated length. */
 			unsigned alloclen =
-				ps->dev->config[i].desc.wTotalLength;
+				dev->config[i].desc.wTotalLength;
 
 			len = length - (*ppos - pos);
 			if (len > nbytes)
@@ -138,7 +156,7 @@
 			if (alloclen > (*ppos - pos)) {
 				alloclen -= (*ppos - pos);
 				if (copy_to_user(buf,
-				    ps->dev->rawdescriptors[i] + (*ppos - pos),
+				    dev->rawdescriptors[i] + (*ppos - pos),
 				    min(len, alloclen))) {
 					ret = -EFAULT;
 					goto err;
@@ -155,35 +173,10 @@
 	}
 
 err:
-	up_read(&ps->devsem);
+	up(&dev->serialize);
 	return ret;
 }
 
-extern inline unsigned int ld2(unsigned int x)
-{
-        unsigned int r = 0;
-        
-        if (x >= 0x10000) {
-                x >>= 16;
-                r += 16;
-        }
-        if (x >= 0x100) {
-                x >>= 8;
-                r += 8;
-        }
-        if (x >= 0x10) {
-                x >>= 4;
-                r += 4;
-        }
-        if (x >= 4) {
-                x >>= 2;
-                r += 2;
-        }
-        if (x >= 2)
-                r++;
-        return r;
-}
-
 /*
  * async list handling
  */
@@ -213,7 +206,7 @@
         kfree(as);
 }
 
-extern __inline__ void async_newpending(struct async *as)
+static inline void async_newpending(struct async *as)
 {
         struct dev_state *ps = as->ps;
         unsigned long flags;
@@ -223,7 +216,7 @@
         spin_unlock_irqrestore(&ps->lock, flags);
 }
 
-extern __inline__ void async_removepending(struct async *as)
+static inline void async_removepending(struct async *as)
 {
         struct dev_state *ps = as->ps;
         unsigned long flags;
@@ -233,7 +226,7 @@
         spin_unlock_irqrestore(&ps->lock, flags);
 }
 
-extern __inline__ struct async *async_getcompleted(struct dev_state *ps)
+static inline struct async *async_getcompleted(struct dev_state *ps)
 {
         unsigned long flags;
         struct async *as = NULL;
@@ -247,7 +240,7 @@
         return as;
 }
 
-extern __inline__ struct async *async_getpending(struct dev_state *ps, void __user *userurb)
+static inline struct async *async_getpending(struct dev_state *ps, void __user *userurb)
 {
         unsigned long flags;
         struct async *as;
@@ -301,7 +294,7 @@
 		free_async(as);
 }
 
-static void destroy_async_on_interface (struct dev_state *ps, unsigned int intf)
+static void destroy_async_on_interface (struct dev_state *ps, unsigned int ifnum)
 {
 	struct list_head *p, *q, hitlist;
 	unsigned long flags;
@@ -309,13 +302,13 @@
 	INIT_LIST_HEAD(&hitlist);
 	spin_lock_irqsave(&ps->lock, flags);
 	list_for_each_safe(p, q, &ps->async_pending)
-		if (intf == list_entry(p, struct async, asynclist)->intf)
+		if (ifnum == list_entry(p, struct async, asynclist)->ifnum)
 			list_move_tail(p, &hitlist);
 	spin_unlock_irqrestore(&ps->lock, flags);
 	destroy_async(ps, &hitlist);
 }
 
-extern __inline__ void destroy_all_async(struct dev_state *ps)
+static inline void destroy_all_async(struct dev_state *ps)
 {
 	        destroy_async(ps, &ps->async_pending);
 }
@@ -335,6 +328,7 @@
 static void driver_disconnect(struct usb_interface *intf)
 {
 	struct dev_state *ps = usb_get_intfdata (intf);
+	unsigned int ifnum = intf->altsetting->desc.bInterfaceNumber;
 
 	if (!ps)
 		return;
@@ -343,13 +337,15 @@
 	 * all pending I/O requests; 2.6 does that.
 	 */
 
-	/* prevent new I/O requests */
-	ps->dev = 0;
-	clear_bit(intf->cur_altsetting->desc.bInterfaceNumber, &ps->ifclaimed);
+	if (likely(ifnum < 8*sizeof(ps->ifclaimed)))
+		clear_bit(ifnum, &ps->ifclaimed);
+	else
+		warn("interface number %u out of range", ifnum);
+
 	usb_set_intfdata (intf, NULL);
 
 	/* force async requests to complete */
-	destroy_all_async (ps);
+	destroy_async_on_interface(ps, ifnum);
 }
 
 struct usb_driver usbdevfs_driver = {
@@ -359,71 +355,70 @@
 	.disconnect =	driver_disconnect,
 };
 
-static int claimintf(struct dev_state *ps, unsigned int intf)
+static int claimintf(struct dev_state *ps, unsigned int ifnum)
 {
 	struct usb_device *dev = ps->dev;
-	struct usb_interface *iface;
+	struct usb_interface *intf;
 	int err;
 
-	if (intf >= 8*sizeof(ps->ifclaimed) || !dev
-			|| intf >= dev->actconfig->desc.bNumInterfaces)
+	if (ifnum >= 8*sizeof(ps->ifclaimed))
 		return -EINVAL;
 	/* already claimed */
-	if (test_bit(intf, &ps->ifclaimed))
+	if (test_bit(ifnum, &ps->ifclaimed))
 		return 0;
-	iface = dev->actconfig->interface[intf];
-	err = -EBUSY;
 
 	/* lock against other changes to driver bindings */
 	down_write(&usb_bus_type.subsys.rwsem);
-	if (!usb_interface_claimed(iface)) {
-		usb_driver_claim_interface(&usbdevfs_driver, iface, ps);
-		set_bit(intf, &ps->ifclaimed);
-		err = 0;
-	}
+	intf = usb_ifnum_to_if(dev, ifnum);
+	if (!intf)
+		err = -ENOENT;
+	else
+		err = usb_driver_claim_interface(&usbdevfs_driver, intf, ps);
 	up_write(&usb_bus_type.subsys.rwsem);
+	if (err == 0)
+		set_bit(ifnum, &ps->ifclaimed);
 	return err;
 }
 
-static int releaseintf(struct dev_state *ps, unsigned int intf)
+static int releaseintf(struct dev_state *ps, unsigned int ifnum)
 {
 	struct usb_device *dev;
-	struct usb_interface *iface;
+	struct usb_interface *intf;
 	int err;
 
-	if (intf >= 8*sizeof(ps->ifclaimed))
-		return -EINVAL;
 	err = -EINVAL;
+	if (ifnum >= 8*sizeof(ps->ifclaimed))
+		return err;
 	dev = ps->dev;
-	down(&dev->serialize);
 	/* lock against other changes to driver bindings */
 	down_write(&usb_bus_type.subsys.rwsem);
-	if (test_and_clear_bit(intf, &ps->ifclaimed)) {
-		iface = dev->actconfig->interface[intf];
-		usb_driver_release_interface(&usbdevfs_driver, iface);
+	intf = usb_ifnum_to_if(dev, ifnum);
+	if (!intf)
+		err = -ENOENT;
+	else if (test_and_clear_bit(ifnum, &ps->ifclaimed)) {
+		usb_driver_release_interface(&usbdevfs_driver, intf);
 		err = 0;
 	}
 	up_write(&usb_bus_type.subsys.rwsem);
-	up(&dev->serialize);
 	return err;
 }
 
-static int checkintf(struct dev_state *ps, unsigned int intf)
+static int checkintf(struct dev_state *ps, unsigned int ifnum)
 {
-	if (intf >= 8*sizeof(ps->ifclaimed))
+	if (ifnum >= 8*sizeof(ps->ifclaimed))
 		return -EINVAL;
-	if (test_bit(intf, &ps->ifclaimed))
+	if (test_bit(ifnum, &ps->ifclaimed))
 		return 0;
 	/* if not yet claimed, claim it for the driver */
-	printk(KERN_WARNING "usbfs: process %d (%s) did not claim interface %u before use\n",
-	       current->pid, current->comm, intf);
-	return claimintf(ps, intf);
+	dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n",
+	       current->pid, current->comm, ifnum);
+	return claimintf(ps, ifnum);
 }
 
 static int findintfep(struct usb_device *dev, unsigned int ep)
 {
 	unsigned int i, j, e;
-        struct usb_interface *iface;
+        struct usb_interface *intf;
 	struct usb_host_interface *alts;
 	struct usb_endpoint_descriptor *endpt;
 
@@ -432,58 +427,38 @@
 	if (!dev->actconfig)
 		return -ESRCH;
 	for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
-		iface = dev->actconfig->interface[i];
-		for (j = 0; j < iface->num_altsetting; j++) {
-                        alts = &iface->altsetting[j];
+		intf = dev->actconfig->interface[i];
+		for (j = 0; j < intf->num_altsetting; j++) {
+                        alts = &intf->altsetting[j];
 			for (e = 0; e < alts->desc.bNumEndpoints; e++) {
 				endpt = &alts->endpoint[e].desc;
 				if (endpt->bEndpointAddress == ep)
-					return i;
+					return alts->desc.bInterfaceNumber;
 			}
 		}
 	}
 	return -ENOENT; 
 }
 
-static int findintfif(struct usb_device *dev, unsigned int ifn)
-{
-	unsigned int i;
-
-	if (ifn & ~0xff)
-		return -EINVAL;
-	if (!dev->actconfig)
-		return -ESRCH;
-	for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
-		if (dev->actconfig->interface[i]->
-				altsetting[0].desc.bInterfaceNumber == ifn)
-			return i;
-	}
-	return -ENOENT; 
-}
-
 static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsigned int index)
 {
-	int ret;
+	int ret = 0;
 
 	if (USB_TYPE_VENDOR == (USB_TYPE_MASK & requesttype))
 		return 0;
 
+	index &= 0xff;
 	switch (requesttype & USB_RECIP_MASK) {
 	case USB_RECIP_ENDPOINT:
-		if ((ret = findintfep(ps->dev, index & 0xff)) < 0)
-			return ret;
-		if ((ret = checkintf(ps, ret)))
-			return ret;
+		if ((ret = findintfep(ps->dev, index)) >= 0)
+			ret = checkintf(ps, ret);
 		break;
 
 	case USB_RECIP_INTERFACE:
-		if ((ret = findintfif(ps->dev, index & 0xff)) < 0)
-			return ret;
-		if ((ret = checkintf(ps, ret)))
-			return ret;
+		ret = checkintf(ps, index);
 		break;
 	}
-	return 0;
+	return ret;
 }
 
 /*
@@ -496,8 +471,7 @@
 	int ret;
 
 	/* 
-	 * no locking necessary here, as both sys_open (actually filp_open)
-	 * and the hub thread have the kernel lock
+	 * no locking necessary here, as chrdev_open has the kernel lock
 	 * (still acquire the kernel lock for safety)
 	 */
 	ret = -ENOMEM;
@@ -506,7 +480,7 @@
 
 	lock_kernel();
 	ret = -ENOENT;
-	dev = inode->u.generic_ip;
+	dev = usb_get_dev(inode->u.generic_ip);
 	if (!dev) {
 		kfree(ps);
 		goto out;
@@ -518,7 +492,6 @@
 	INIT_LIST_HEAD(&ps->async_pending);
 	INIT_LIST_HEAD(&ps->async_completed);
 	init_waitqueue_head(&ps->wait);
-	init_rwsem(&ps->devsem);
 	ps->discsignr = 0;
 	ps->disctask = current;
 	ps->disccontext = NULL;
@@ -535,18 +508,21 @@
 static int usbdev_release(struct inode *inode, struct file *file)
 {
 	struct dev_state *ps = (struct dev_state *)file->private_data;
-	unsigned int i;
+	struct usb_device *dev = ps->dev;
+	unsigned int ifnum;
 
-	lock_kernel();
+	down(&dev->serialize);
 	list_del_init(&ps->list);
 
-	if (ps->dev) {
-		for (i = 0; ps->ifclaimed && i < 8*sizeof(ps->ifclaimed); i++)
-			if (test_bit(i, &ps->ifclaimed))
-				releaseintf(ps, i);
+	if (connected(dev)) {
+		for (ifnum = 0; ps->ifclaimed && ifnum < 8*sizeof(ps->ifclaimed); ifnum++)
+			if (test_bit(ifnum, &ps->ifclaimed))
+				releaseintf(ps, ifnum);
+		destroy_all_async(ps);
 	}
-	unlock_kernel();
-	destroy_all_async(ps);
+	up(&dev->serialize);
+	usb_put_dev(dev);
+	ps->dev = NULL;
 	kfree(ps);
         return 0;
 }
@@ -557,7 +533,7 @@
 	struct usbdevfs_ctrltransfer ctrl;
 	unsigned int tmo;
 	unsigned char *tbuf;
-	int i, ret;
+	int i, j, ret;
 
 	if (copy_from_user(&ctrl, arg, sizeof(ctrl)))
 		return -EFAULT;
@@ -573,9 +549,18 @@
 			free_page((unsigned long)tbuf);
 			return -EINVAL;
 		}
+		snoop(&dev->dev, "control read: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", 
+			ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex);
+
 		i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType,
 				       ctrl.wValue, ctrl.wIndex, tbuf, ctrl.wLength, tmo);
 		if ((i > 0) && ctrl.wLength) {
+			if (usbfs_snoop) {
+				dev_info(&dev->dev, "control read: data ");
+				for (j = 0; j < ctrl.wLength; ++j)
+					printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]);
+				printk("\n");
+			}
 			if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) {
 				free_page((unsigned long)tbuf);
 				return -EFAULT;
@@ -588,15 +573,23 @@
 				return -EFAULT;
 			}
 		}
+		snoop(&dev->dev, "control write: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", 
+			ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex);
+		if (usbfs_snoop) {
+			dev_info(&dev->dev, "control write: data: ");
+			for (j = 0; j < ctrl.wLength; ++j)
+				printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]);
+			printk("\n");
+		}
 		i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType,
 				       ctrl.wValue, ctrl.wIndex, tbuf, ctrl.wLength, tmo);
 	}
 	free_page((unsigned long)tbuf);
 	if (i<0) {
-		printk(KERN_DEBUG "usbfs: USBDEVFS_CONTROL failed "
-			"cmd %s dev %d rqt %u rq %u len %u ret %d\n", 
-			current->comm,
-		       dev->devnum, ctrl.bRequestType, ctrl.bRequest, ctrl.wLength, i);
+		dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL "
+			   "failed cmd %s rqt %u rq %u len %u ret %d\n",
+			   current->comm, ctrl.bRequestType, ctrl.bRequest,
+			   ctrl.wLength, i);
 	}
 	return i;
 }
@@ -649,8 +642,8 @@
 	}
 	kfree(tbuf);
 	if (i < 0) {
-		printk(KERN_WARNING "usbfs: USBDEVFS_BULK failed dev %d ep 0x%x len %u ret %d\n", 
-		       dev->devnum, bulk.ep, bulk.len, i);
+		dev_warn(&dev->dev, "usbfs: USBDEVFS_BULK failed "
+			 "ep 0x%x len %u ret %d\n", bulk.ep, bulk.len, i);
 		return i;
 	}
 	return len2;
@@ -695,20 +688,22 @@
 static int proc_getdriver(struct dev_state *ps, void __user *arg)
 {
 	struct usbdevfs_getdriver gd;
-	struct usb_interface *interface;
+	struct usb_interface *intf;
 	int ret;
 
 	if (copy_from_user(&gd, arg, sizeof(gd)))
 		return -EFAULT;
-	if ((ret = findintfif(ps->dev, gd.interface)) < 0)
-		return ret;
-	interface = ps->dev->actconfig->interface[ret];
-	if (!interface->dev.driver)
-		return -ENODATA;
-	strncpy(gd.driver, interface->dev.driver->name, sizeof(gd.driver));
-	if (copy_to_user(arg, &gd, sizeof(gd)))
-		return -EFAULT;
-	return 0;
+	down_read(&usb_bus_type.subsys.rwsem);
+	intf = usb_ifnum_to_if(ps->dev, gd.interface);
+	if (!intf || !intf->dev.driver)
+		ret = -ENODATA;
+	else {
+		strncpy(gd.driver, intf->dev.driver->name,
+				sizeof(gd.driver));
+		ret = (copy_to_user(arg, &gd, sizeof(gd)) ? -EFAULT : 0);
+	}
+	up_read(&usb_bus_type.subsys.rwsem);
+	return ret;
 }
 
 static int proc_connectinfo(struct dev_state *ps, void __user *arg)
@@ -724,31 +719,21 @@
 
 static int proc_resetdevice(struct dev_state *ps)
 {
-	/* FIXME when usb_reset_device() is fixed we'll need to grab
-	 * ps->dev->serialize before calling it.
-	 */
-	return usb_reset_device(ps->dev);
+	return __usb_reset_device(ps->dev);
 
 }
 
 static int proc_setintf(struct dev_state *ps, void __user *arg)
 {
 	struct usbdevfs_setinterface setintf;
-	struct usb_interface *interface;
 	int ret;
 
 	if (copy_from_user(&setintf, arg, sizeof(setintf)))
 		return -EFAULT;
-	if ((ret = findintfif(ps->dev, setintf.interface)) < 0)
+	if ((ret = checkintf(ps, setintf.interface)))
 		return ret;
-	interface = ps->dev->actconfig->interface[ret];
-	if (interface->dev.driver) {
-		if ((ret = checkintf(ps, ret)))
-			return ret;
-	}
-	if (usb_set_interface(ps->dev, setintf.interface, setintf.altsetting))
-		return -EINVAL;
-	return 0;
+	return usb_set_interface(ps->dev, setintf.interface,
+			setintf.altsetting);
 }
 
 static int proc_setconfig(struct dev_state *ps, void __user *arg)
@@ -760,7 +745,6 @@
 	if (get_user(u, (unsigned int __user *)arg))
 		return -EFAULT;
 
-	down(&ps->dev->serialize);
  	actconfig = ps->dev->actconfig;
  
  	/* Don't touch the device if any interfaces are claimed.
@@ -796,7 +780,6 @@
 		else
 			status = usb_set_configuration(ps->dev, u);
 	}
-	up(&ps->dev->serialize);
 
 	return status;
 }
@@ -809,7 +792,7 @@
 	struct async *as;
 	struct usb_ctrlrequest *dr = NULL;
 	unsigned int u, totlen, isofrmlen;
-	int ret, interval = 0, intf = -1;
+	int ret, interval = 0, ifnum = -1;
 
 	if (copy_from_user(&uurb, arg, sizeof(uurb)))
 		return -EFAULT;
@@ -821,9 +804,9 @@
 	if (uurb.signr != 0 && (uurb.signr < SIGRTMIN || uurb.signr > SIGRTMAX))
 		return -EINVAL;
 	if (!(uurb.type == USBDEVFS_URB_TYPE_CONTROL && (uurb.endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) {
-		if ((intf = findintfep(ps->dev, uurb.endpoint)) < 0)
-			return intf;
-		if ((ret = checkintf(ps, intf)))
+		if ((ifnum = findintfep(ps->dev, uurb.endpoint)) < 0)
+			return ifnum;
+		if ((ret = checkintf(ps, ifnum)))
 			return ret;
 	}
 	switch(uurb.type) {
@@ -873,10 +856,13 @@
 		/* arbitrary limit */
 		if (uurb.number_of_packets < 1 || uurb.number_of_packets > 128)
 			return -EINVAL;
+		if (!(ep_desc = usb_epnum_to_ep_desc(ps->dev, uurb.endpoint)))
+			return -ENOENT;
+		interval = 1 << min (15, ep_desc->bInterval - 1);
 		isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb.number_of_packets;
 		if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
 			return -ENOMEM;
-		if (copy_from_user(isopkt, &((struct usbdevfs_urb *)arg)->iso_frame_desc, isofrmlen)) {
+		if (copy_from_user(isopkt, &((struct usbdevfs_urb __user *)arg)->iso_frame_desc, isofrmlen)) {
 			kfree(isopkt);
 			return -EFAULT;
 		}
@@ -898,7 +884,10 @@
 		uurb.number_of_packets = 0;
 		if (!(ep_desc = usb_epnum_to_ep_desc(ps->dev, uurb.endpoint)))
 			return -ENOENT;
-		interval = ep_desc->bInterval;
+		if (ps->dev->speed == USB_SPEED_HIGH)
+			interval = 1 << min (15, ep_desc->bInterval - 1);
+		else
+			interval = ep_desc->bInterval;
 		if (uurb.buffer_length > 16384)
 			return -EINVAL;
 		if (!access_ok((uurb.endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb.buffer, uurb.buffer_length))
@@ -947,7 +936,7 @@
 	else
 		as->userbuffer = NULL;
 	as->signr = uurb.signr;
-	as->intf = intf;
+	as->ifnum = ifnum;
 	as->task = current;
 	if (!(uurb.endpoint & USB_DIR_IN)) {
 		if (copy_from_user(as->urb->transfer_buffer, uurb.buffer, as->urb->transfer_buffer_length)) {
@@ -957,7 +946,7 @@
 	}
         async_newpending(as);
         if ((ret = usb_submit_urb(as->urb, GFP_KERNEL))) {
-		printk(KERN_DEBUG "usbfs: usb_submit_urb returned %d\n", ret);
+		dev_printk(KERN_DEBUG, &ps->dev->dev, "usbfs: usb_submit_urb returned %d\n", ret);
                 async_removepending(as);
                 free_async(as);
                 return ret;
@@ -1012,18 +1001,19 @@
         DECLARE_WAITQUEUE(wait, current);
 	struct async *as = NULL;
 	void __user *addr;
+	struct usb_device *dev = ps->dev;
 	int ret;
 
 	add_wait_queue(&ps->wait, &wait);
-	while (ps->dev) {
+	while (connected(dev)) {
 		__set_current_state(TASK_INTERRUPTIBLE);
 		if ((as = async_getcompleted(ps)))
 			break;
 		if (signal_pending(current))
 			break;
-		up_read(&ps->devsem);
+		up(&dev->serialize);
 		schedule();
-		down_read(&ps->devsem);
+		down(&dev->serialize);
 	}
 	remove_wait_queue(&ps->wait, &wait);
 	set_current_state(TASK_RUNNING);
@@ -1033,7 +1023,7 @@
 		free_async(as);
 		if (ret)
 			return ret;
-		if (put_user(addr, (void **)arg))
+		if (put_user(addr, (void __user * __user *)arg))
 			return -EFAULT;
 		return 0;
 	}
@@ -1055,7 +1045,7 @@
 	free_async(as);
 	if (ret)
 		return ret;
-	if (put_user(addr, (void **)arg))
+	if (put_user(addr, (void __user * __user *)arg))
 		return -EFAULT;
 	return 0;
 }
@@ -1075,28 +1065,23 @@
 
 static int proc_claiminterface(struct dev_state *ps, void __user *arg)
 {
-	unsigned int intf;
-	int ret;
+	unsigned int ifnum;
 
-	if (get_user(intf, (unsigned int __user *)arg))
+	if (get_user(ifnum, (unsigned int __user *)arg))
 		return -EFAULT;
-	if ((ret = findintfif(ps->dev, intf)) < 0)
-		return ret;
-	return claimintf(ps, ret);
+	return claimintf(ps, ifnum);
 }
 
 static int proc_releaseinterface(struct dev_state *ps, void __user *arg)
 {
-	unsigned int intf;
+	unsigned int ifnum;
 	int ret;
 
-	if (get_user(intf, (unsigned int __user *)arg))
+	if (get_user(ifnum, (unsigned int __user *)arg))
 		return -EFAULT;
-	if ((ret = findintfif(ps->dev, intf)) < 0)
-		return ret;
-	if ((ret = releaseintf(ps, intf)) < 0)
+	if ((ret = releaseintf(ps, ifnum)) < 0)
 		return ret;
-	destroy_async_on_interface (ps, intf);
+	destroy_async_on_interface (ps, ifnum);
 	return 0;
 }
 
@@ -1106,7 +1091,7 @@
 	int			size;
 	void			*buf = 0;
 	int			retval = 0;
-	struct usb_interface    *ifp = 0;
+	struct usb_interface    *intf = 0;
 	struct usb_driver       *driver = 0;
 
 	/* get input parameters and alloc buffer */
@@ -1125,26 +1110,25 @@
 		}
 	}
 
-	if (!ps->dev) {
+	if (!connected(ps->dev)) {
 		if (buf)
 			kfree(buf);
 		return -ENODEV;
 	}
 
-	down(&ps->dev->serialize);
 	if (ps->dev->state != USB_STATE_CONFIGURED)
 		retval = -ENODEV;
-	else if (!(ifp = usb_ifnum_to_if (ps->dev, ctrl.ifno)))
+	else if (!(intf = usb_ifnum_to_if (ps->dev, ctrl.ifno)))
                retval = -EINVAL;
 	else switch (ctrl.ioctl_code) {
 
 	/* disconnect kernel driver from interface */
 	case USBDEVFS_DISCONNECT:
 		down_write(&usb_bus_type.subsys.rwsem);
-		if (ifp->dev.driver) {
-			driver = to_usb_driver(ifp->dev.driver);
-			dev_dbg (&ifp->dev, "disconnect by usbfs\n");
-			usb_driver_release_interface(driver, ifp);
+		if (intf->dev.driver) {
+			driver = to_usb_driver(intf->dev.driver);
+			dev_dbg (&intf->dev, "disconnect by usbfs\n");
+			usb_driver_release_interface(driver, intf);
 		} else
 			retval = -ENODATA;
 		up_write(&usb_bus_type.subsys.rwsem);
@@ -1152,24 +1136,23 @@
 
 	/* let kernel drivers try to (re)bind to the interface */
 	case USBDEVFS_CONNECT:
-		bus_rescan_devices(ifp->dev.bus);
+		bus_rescan_devices(intf->dev.bus);
 		break;
 
 	/* talk directly to the interface's driver */
 	default:
 		down_read(&usb_bus_type.subsys.rwsem);
-		if (ifp->dev.driver)
-			driver = to_usb_driver(ifp->dev.driver);
+		if (intf->dev.driver)
+			driver = to_usb_driver(intf->dev.driver);
 		if (driver == 0 || driver->ioctl == 0) {
 			retval = -ENOTTY;
 		} else {
-			retval = driver->ioctl (ifp, ctrl.ioctl_code, buf);
+			retval = driver->ioctl (intf, ctrl.ioctl_code, buf);
 			if (retval == -ENOIOCTLCMD)
 				retval = -ENOTTY;
 		}
 		up_read(&usb_bus_type.subsys.rwsem);
 	}
-	up(&ps->dev->serialize);
 
 	/* cleanup and return */
 	if (retval >= 0
@@ -1190,95 +1173,115 @@
 static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct dev_state *ps = (struct dev_state *)file->private_data;
+	struct usb_device *dev = ps->dev;
+	void __user *p = (void __user *)arg;
 	int ret = -ENOTTY;
 
 	if (!(file->f_mode & FMODE_WRITE))
 		return -EPERM;
-	down_read(&ps->devsem);
-	if (!ps->dev) {
-		up_read(&ps->devsem);
+	down(&dev->serialize);
+	if (!connected(dev)) {
+		up(&dev->serialize);
 		return -ENODEV;
 	}
+
 	switch (cmd) {
 	case USBDEVFS_CONTROL:
-		ret = proc_control(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: CONTROL\n", __FUNCTION__);
+		ret = proc_control(ps, p);
 		if (ret >= 0)
 			inode->i_mtime = CURRENT_TIME;
 		break;
 
 	case USBDEVFS_BULK:
-		ret = proc_bulk(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: BULK\n", __FUNCTION__);
+		ret = proc_bulk(ps, p);
 		if (ret >= 0)
 			inode->i_mtime = CURRENT_TIME;
 		break;
 
 	case USBDEVFS_RESETEP:
-		ret = proc_resetep(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: RESETEP\n", __FUNCTION__);
+		ret = proc_resetep(ps, p);
 		if (ret >= 0)
 			inode->i_mtime = CURRENT_TIME;
 		break;
 
 	case USBDEVFS_RESET:
+		snoop(&dev->dev, "%s: RESET\n", __FUNCTION__);
 		ret = proc_resetdevice(ps);
 		break;
 
 	case USBDEVFS_CLEAR_HALT:
-		ret = proc_clearhalt(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: CLEAR_HALT\n", __FUNCTION__);
+		ret = proc_clearhalt(ps, p);
 		if (ret >= 0)
 			inode->i_mtime = CURRENT_TIME;
 		break;
 
 	case USBDEVFS_GETDRIVER:
-		ret = proc_getdriver(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: GETDRIVER\n", __FUNCTION__);
+		ret = proc_getdriver(ps, p);
 		break;
 
 	case USBDEVFS_CONNECTINFO:
-		ret = proc_connectinfo(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: CONNECTINFO\n", __FUNCTION__);
+		ret = proc_connectinfo(ps, p);
 		break;
 
 	case USBDEVFS_SETINTERFACE:
-		ret = proc_setintf(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: SETINTERFACE\n", __FUNCTION__);
+		ret = proc_setintf(ps, p);
 		break;
 
 	case USBDEVFS_SETCONFIGURATION:
-		ret = proc_setconfig(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: SETCONFIGURATION\n", __FUNCTION__);
+		ret = proc_setconfig(ps, p);
 		break;
 
 	case USBDEVFS_SUBMITURB:
-		ret = proc_submiturb(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: SUBMITURB\n", __FUNCTION__);
+		ret = proc_submiturb(ps, p);
 		if (ret >= 0)
 			inode->i_mtime = CURRENT_TIME;
 		break;
 
 	case USBDEVFS_DISCARDURB:
-		ret = proc_unlinkurb(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: DISCARDURB\n", __FUNCTION__);
+		ret = proc_unlinkurb(ps, p);
 		break;
 
 	case USBDEVFS_REAPURB:
-		ret = proc_reapurb(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: REAPURB\n", __FUNCTION__);
+		ret = proc_reapurb(ps, p);
 		break;
 
 	case USBDEVFS_REAPURBNDELAY:
-		ret = proc_reapurbnonblock(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: REAPURBDELAY\n", __FUNCTION__);
+		ret = proc_reapurbnonblock(ps, p);
 		break;
 
 	case USBDEVFS_DISCSIGNAL:
-		ret = proc_disconnectsignal(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: DISCSIGNAL\n", __FUNCTION__);
+		ret = proc_disconnectsignal(ps, p);
 		break;
 
 	case USBDEVFS_CLAIMINTERFACE:
-		ret = proc_claiminterface(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: CLAIMINTERFACE\n", __FUNCTION__);
+		ret = proc_claiminterface(ps, p);
 		break;
 
 	case USBDEVFS_RELEASEINTERFACE:
-		ret = proc_releaseinterface(ps, (void __user *)arg);
+		snoop(&dev->dev, "%s: RELEASEINTERFACE\n", __FUNCTION__);
+		ret = proc_releaseinterface(ps, p);
 		break;
 
 	case USBDEVFS_IOCTL:
-		ret = proc_ioctl(ps, (void __user *) arg);
+		snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__);
+		ret = proc_ioctl(ps, p);
 		break;
 	}
-	up_read(&ps->devsem);
+	up(&dev->serialize);
 	if (ret >= 0)
 		inode->i_atime = CURRENT_TIME;
 	return ret;
@@ -1293,7 +1296,7 @@
 	poll_wait(file, &ps->wait, wait);
 	if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed))
 		mask |= POLLOUT | POLLWRNORM;
-	if (!ps->dev)
+	if (!connected(ps->dev))
 		mask |= POLLERR | POLLHUP;
 	return mask;
 }
diff -Nru a/drivers/usb/core/driverfs.c b/drivers/usb/core/driverfs.c
--- a/drivers/usb/core/driverfs.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,229 +0,0 @@
-/*
- * drivers/usb/core/driverfs.c
- *
- * (C) Copyright 2002 David Brownell
- * (C) Copyright 2002 Greg Kroah-Hartman
- * (C) Copyright 2002 IBM Corp.
- *
- * All of the driverfs file attributes for usb devices and interfaces.
- *
- */
-
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-
-#ifdef CONFIG_USB_DEBUG
-	#define DEBUG
-#else
-	#undef DEBUG
-#endif
-#include <linux/usb.h>
-
-#include "usb.h"
-
-/* Active configuration fields */
-#define usb_actconfig_show(field, multiplier, format_string)		\
-static ssize_t  show_##field (struct device *dev, char *buf)		\
-{									\
-	struct usb_device *udev;					\
-									\
-	udev = to_usb_device (dev);					\
-	if (udev->actconfig)						\
-		return sprintf (buf, format_string,			\
-				udev->actconfig->desc.field * multiplier);	\
-	else								\
-		return 0;						\
-}									\
-
-#define usb_actconfig_attr(field, multiplier, format_string)		\
-usb_actconfig_show(field, multiplier, format_string)			\
-static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
-
-usb_actconfig_attr (bNumInterfaces, 1, "%2d\n")
-usb_actconfig_attr (bmAttributes, 1, "%2x\n")
-usb_actconfig_attr (bMaxPower, 2, "%3dmA\n")
-
-/* configuration value is always present, and r/w */
-usb_actconfig_show(bConfigurationValue, 1, "%u\n");
-
-static ssize_t
-set_bConfigurationValue (struct device *dev, const char *buf, size_t count)
-{
-	struct usb_device	*udev = udev = to_usb_device (dev);
-	int			config, value;
-
-	if (sscanf (buf, "%u", &config) != 1 || config > 255)
-		return -EINVAL;
-	down(&udev->serialize);
-	value = usb_set_configuration (udev, config);
-	up(&udev->serialize);
-	return (value < 0) ? value : count;
-}
-
-static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, 
-		show_bConfigurationValue, set_bConfigurationValue);
-
-/* String fields */
-#define usb_string_attr(name, field)		\
-static ssize_t  show_##name(struct device *dev, char *buf)		\
-{									\
-	struct usb_device *udev;					\
-	int len;							\
-									\
-	udev = to_usb_device (dev);					\
-	len = usb_string(udev, udev->descriptor.field, buf, PAGE_SIZE);	\
-	if (len < 0)							\
-		return 0;						\
-	buf[len] = '\n';						\
-	buf[len+1] = 0;							\
-	return len+1;							\
-}									\
-static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
-
-usb_string_attr(product, iProduct);
-usb_string_attr(manufacturer, iManufacturer);
-usb_string_attr(serial, iSerialNumber);
-
-static ssize_t
-show_speed (struct device *dev, char *buf)
-{
-	struct usb_device *udev;
-	char *speed;
-
-	udev = to_usb_device (dev);
-
-	switch (udev->speed) {
-	case USB_SPEED_LOW:
-		speed = "1.5";
-		break;
-	case USB_SPEED_UNKNOWN:
-	case USB_SPEED_FULL:
-		speed = "12";
-		break;
-	case USB_SPEED_HIGH:
-		speed = "480";
-		break;
-	default:
-		speed = "unknown";
-	}
-	return sprintf (buf, "%s\n", speed);
-}
-static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL);
-
-static ssize_t
-show_devnum (struct device *dev, char *buf)
-{
-	struct usb_device *udev;
-
-	udev = to_usb_device (dev);
-	return sprintf (buf, "%d\n", udev->devnum);
-}
-static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL);
-
-static ssize_t
-show_version (struct device *dev, char *buf)
-{
-	struct usb_device *udev;
-
-	udev = to_usb_device (dev);
-	return sprintf (buf, "%2x.%02x\n", udev->descriptor.bcdUSB >> 8, 
-			udev->descriptor.bcdUSB & 0xff);
-}
-static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
-
-static ssize_t
-show_maxchild (struct device *dev, char *buf)
-{
-	struct usb_device *udev;
-
-	udev = to_usb_device (dev);
-	return sprintf (buf, "%d\n", udev->maxchild);
-}
-static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL);
-
-/* Descriptor fields */
-#define usb_descriptor_attr(field, format_string)			\
-static ssize_t								\
-show_##field (struct device *dev, char *buf)				\
-{									\
-	struct usb_device *udev;					\
-									\
-	udev = to_usb_device (dev);					\
-	return sprintf (buf, format_string, udev->descriptor.field);	\
-}									\
-static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
-
-usb_descriptor_attr (idVendor, "%04x\n")
-usb_descriptor_attr (idProduct, "%04x\n")
-usb_descriptor_attr (bcdDevice, "%04x\n")
-usb_descriptor_attr (bDeviceClass, "%02x\n")
-usb_descriptor_attr (bDeviceSubClass, "%02x\n")
-usb_descriptor_attr (bDeviceProtocol, "%02x\n")
-usb_descriptor_attr (bNumConfigurations, "%d\n")
-
-
-void usb_create_driverfs_dev_files (struct usb_device *udev)
-{
-	struct device *dev = &udev->dev;
-
-	/* current configuration's attributes */
-	device_create_file (dev, &dev_attr_bNumInterfaces);
-	device_create_file (dev, &dev_attr_bConfigurationValue);
-	device_create_file (dev, &dev_attr_bmAttributes);
-	device_create_file (dev, &dev_attr_bMaxPower);
-
-	/* device attributes */
-	device_create_file (dev, &dev_attr_idVendor);
-	device_create_file (dev, &dev_attr_idProduct);
-	device_create_file (dev, &dev_attr_bcdDevice);
-	device_create_file (dev, &dev_attr_bDeviceClass);
-	device_create_file (dev, &dev_attr_bDeviceSubClass);
-	device_create_file (dev, &dev_attr_bDeviceProtocol);
-	device_create_file (dev, &dev_attr_bNumConfigurations);
-
-	/* speed varies depending on how you connect the device */
-	device_create_file (dev, &dev_attr_speed);
-	// FIXME iff there are other speed configs, show how many
-
-	if (udev->descriptor.iManufacturer)
-		device_create_file (dev, &dev_attr_manufacturer);
-	if (udev->descriptor.iProduct)
-		device_create_file (dev, &dev_attr_product);
-	if (udev->descriptor.iSerialNumber)
-		device_create_file (dev, &dev_attr_serial);
-
-	device_create_file (dev, &dev_attr_devnum);
-	device_create_file (dev, &dev_attr_version);
-	device_create_file (dev, &dev_attr_maxchild);
-}
-
-/* Interface fields */
-#define usb_intf_attr(field, format_string)				\
-static ssize_t								\
-show_##field (struct device *dev, char *buf)				\
-{									\
-	struct usb_interface *intf = to_usb_interface (dev);		\
-									\
-	return sprintf (buf, format_string, intf->cur_altsetting->desc.field); \
-}									\
-static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
-
-usb_intf_attr (bInterfaceNumber, "%02x\n")
-usb_intf_attr (bAlternateSetting, "%2d\n")
-usb_intf_attr (bNumEndpoints, "%02x\n")
-usb_intf_attr (bInterfaceClass, "%02x\n")
-usb_intf_attr (bInterfaceSubClass, "%02x\n")
-usb_intf_attr (bInterfaceProtocol, "%02x\n")
-usb_intf_attr (iInterface, "%02x\n")
-
-void usb_create_driverfs_intf_files (struct usb_interface *intf)
-{
-	device_create_file (&intf->dev, &dev_attr_bInterfaceNumber);
-	device_create_file (&intf->dev, &dev_attr_bAlternateSetting);
-	device_create_file (&intf->dev, &dev_attr_bNumEndpoints);
-	device_create_file (&intf->dev, &dev_attr_bInterfaceClass);
-	device_create_file (&intf->dev, &dev_attr_bInterfaceSubClass);
-	device_create_file (&intf->dev, &dev_attr_bInterfaceProtocol);
-	device_create_file (&intf->dev, &dev_attr_iInterface);
-}
diff -Nru a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
--- a/drivers/usb/core/hcd-pci.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/core/hcd-pci.c	Tue Jun 15 22:20:40 2004
@@ -279,41 +279,54 @@
 {
 	struct usb_hcd		*hcd;
 	int			retval = 0;
+	int			has_pci_pm;
 
 	hcd = pci_get_drvdata(dev);
-	dev_dbg (hcd->self.controller, "suspend D%d --> D%d\n",
-			dev->current_state, state);
 
-	if (pci_find_capability(dev, PCI_CAP_ID_PM)) {
-		dev_dbg(hcd->self.controller, "No PM capability\n");
-		return 0;
-	}
+	/* even when the PCI layer rejects some of the PCI calls
+	 * below, HCs can try global suspend and reduce DMA traffic.
+	 * PM-sensitive HCDs may already have done this.
+	 */
+	has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+	if (has_pci_pm)
+		dev_dbg(hcd->self.controller, "suspend D%d --> D%d\n",
+			dev->current_state, state);
 
 	switch (hcd->state) {
 	case USB_STATE_HALT:
 		dev_dbg (hcd->self.controller, "halted; hcd not suspended\n");
 		break;
-	case USB_STATE_SUSPENDED:
+	case HCD_STATE_SUSPENDED:
 		dev_dbg (hcd->self.controller, "hcd already suspended\n");
 		break;
 	default:
-		/* remote wakeup needs hub->suspend() cooperation */
-		// pci_enable_wake (dev, 3, 1);
-
-		pci_save_state (dev, hcd->pci_state);
-
-		/* driver may want to disable DMA etc */
-		hcd->state = USB_STATE_QUIESCING;
 		retval = hcd->driver->suspend (hcd, state);
 		if (retval)
 			dev_dbg (hcd->self.controller, 
 					"suspend fail, retval %d\n",
 					retval);
-		else
-			hcd->state = USB_STATE_SUSPENDED;
+		else {
+			hcd->state = HCD_STATE_SUSPENDED;
+			pci_save_state (dev, hcd->pci_state);
+#ifdef	CONFIG_USB_SUSPEND
+			pci_enable_wake (dev, state, hcd->remote_wakeup);
+			pci_enable_wake (dev, 4, hcd->remote_wakeup);
+#endif
+			/* no DMA or IRQs except in D0 */
+			pci_disable_device (dev);
+			free_irq (hcd->irq, hcd);
+			
+			if (has_pci_pm)
+				retval = pci_set_power_state (dev, state);
+			dev->dev.power.power_state = state;
+			if (retval < 0) {
+				dev_dbg (&dev->dev,
+						"PCI suspend fail, %d\n",
+						retval);
+				(void) usb_hcd_pci_resume (dev);
+			}
+		}
 	}
-
- 	pci_set_power_state (dev, state);
 	return retval;
 }
 EXPORT_SYMBOL (usb_hcd_pci_suspend);
@@ -328,23 +341,37 @@
 {
 	struct usb_hcd		*hcd;
 	int			retval;
+	int			has_pci_pm;
 
 	hcd = pci_get_drvdata(dev);
-	dev_dbg (hcd->self.controller, "resume from state D%d\n",
-			dev->current_state);
+	has_pci_pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+	if (has_pci_pm)
+		dev_dbg(hcd->self.controller, "resume from state D%d\n",
+				dev->current_state);
 
-	if (hcd->state != USB_STATE_SUSPENDED) {
+	if (hcd->state != HCD_STATE_SUSPENDED) {
 		dev_dbg (hcd->self.controller, 
 				"can't resume, not suspended!\n");
 		return -EL3HLT;
 	}
 	hcd->state = USB_STATE_RESUMING;
 
-	pci_set_power_state (dev, 0);
+	if (has_pci_pm)
+		pci_set_power_state (dev, 0);
+	dev->dev.power.power_state = 0;
+	retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
+				hcd->description, hcd);
+	if (retval < 0) {
+		dev_err (hcd->self.controller,
+			"can't restore IRQ after resume!\n");
+		return retval;
+	}
+	pci_set_master (dev);
 	pci_restore_state (dev, hcd->pci_state);
-
-	/* remote wakeup needs hub->suspend() cooperation */
-	// pci_enable_wake (dev, 3, 0);
+#ifdef	CONFIG_USB_SUSPEND
+	pci_enable_wake (dev, dev->current_state, 0);
+	pci_enable_wake (dev, 4, 0);
+#endif
 
 	retval = hcd->driver->resume (hcd);
 	if (!HCD_IS_RUNNING (hcd->state)) {
diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/core/hcd.c	Tue Jun 15 22:20:41 2004
@@ -171,10 +171,10 @@
 	0x01,       /*  __u8  bNumInterfaces; (1) */
 	0x01,       /*  __u8  bConfigurationValue; */
 	0x00,       /*  __u8  iConfiguration; */
-	0x40,       /*  __u8  bmAttributes; 
-				 Bit 7: Bus-powered,
+	0xc0,       /*  __u8  bmAttributes; 
+				 Bit 7: must be set,
 				     6: Self-powered,
-				     5 Remote-wakwup,
+				     5: Remote wakeup,
 				     4..0: resvd */
 	0x00,       /*  __u8  MaxPower; */
       
@@ -218,10 +218,10 @@
 	0x01,       /*  __u8  bNumInterfaces; (1) */
 	0x01,       /*  __u8  bConfigurationValue; */
 	0x00,       /*  __u8  iConfiguration; */
-	0x40,       /*  __u8  bmAttributes; 
-				 Bit 7: Bus-powered,
+	0xc0,       /*  __u8  bmAttributes; 
+				 Bit 7: must be set,
 				     6: Self-powered,
-				     5 Remote-wakwup,
+				     5: Remote wakeup,
 				     4..0: resvd */
 	0x00,       /*  __u8  MaxPower; */
       
@@ -324,13 +324,15 @@
 /* Root hub control transfers execute synchronously */
 static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
 {
-	struct usb_ctrlrequest *cmd = (struct usb_ctrlrequest *) urb->setup_packet;
+	struct usb_ctrlrequest *cmd;
  	u16		typeReq, wValue, wIndex, wLength;
 	const u8	*bufp = 0;
 	u8		*ubuf = urb->transfer_buffer;
 	int		len = 0;
+	int		patch_wakeup = 0;
 	unsigned long	flags;
 
+	cmd = (struct usb_ctrlrequest *) urb->setup_packet;
 	typeReq  = (cmd->bRequestType << 8) | cmd->bRequest;
 	wValue   = le16_to_cpu (cmd->wValue);
 	wIndex   = le16_to_cpu (cmd->wIndex);
@@ -347,13 +349,21 @@
 	/* DEVICE REQUESTS */
 
 	case DeviceRequest | USB_REQ_GET_STATUS:
-		// DEVICE_REMOTE_WAKEUP
-		ubuf [0] = 1; // selfpowered
+		ubuf [0] = (hcd->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP)
+				| (1 << USB_DEVICE_SELF_POWERED);
 		ubuf [1] = 0;
-			/* FALLTHROUGH */
+		break;
 	case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:
+		if (wValue == USB_DEVICE_REMOTE_WAKEUP)
+			hcd->remote_wakeup = 0;
+		else
+			goto error;
+		break;
 	case DeviceOutRequest | USB_REQ_SET_FEATURE:
-		dev_dbg (hcd->self.controller, "no device features yet yet\n");
+		if (hcd->can_wakeup && wValue == USB_DEVICE_REMOTE_WAKEUP)
+			hcd->remote_wakeup = 1;
+		else
+			goto error;
 		break;
 	case DeviceRequest | USB_REQ_GET_CONFIGURATION:
 		ubuf [0] = 1;
@@ -379,6 +389,8 @@
 				bufp = fs_rh_config_descriptor;
 				len = sizeof fs_rh_config_descriptor;
 			}
+			if (hcd->can_wakeup)
+				patch_wakeup = 1;
 			break;
 		case USB_DT_STRING << 8:
 			urb->actual_length = rh_string (
@@ -444,6 +456,11 @@
 		urb->actual_length = len;
 		// always USB_DIR_IN, toward host
 		memcpy (ubuf, bufp, len);
+
+		/* report whether RH hardware supports remote wakeup */
+		if (patch_wakeup)
+			((struct usb_config_descriptor *)ubuf)->bmAttributes
+				|= USB_CONFIG_ATT_WAKEUP;
 	}
 
 	/* any errors get returned through the urb completion */
@@ -762,10 +779,22 @@
 	set_bit (devnum, usb_dev->bus->devmap.devicemap);
 	usb_dev->state = USB_STATE_ADDRESS;
 
+	usb_dev->epmaxpacketin[0] = usb_dev->epmaxpacketout[0] = 64;
+	retval = usb_get_device_descriptor(usb_dev, USB_DT_DEVICE_SIZE);
+	if (retval != sizeof usb_dev->descriptor) {
+		dev_dbg (parent_dev, "can't read %s device descriptor %d\n",
+				usb_dev->dev.bus_id, retval);
+		return (retval < 0) ? retval : -EMSGSIZE;
+	}
+
+	(void) usb_get_dev (usb_dev);
+	down (&usb_dev->serialize);
 	retval = usb_new_device (usb_dev);
 	if (retval)
 		dev_err (parent_dev, "can't register root hub for %s, %d\n",
 				usb_dev->dev.bus_id, retval);
+	up (&usb_dev->serialize);
+	usb_put_dev (usb_dev);
 	return retval;
 }
 EXPORT_SYMBOL (usb_register_root_hub);
diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
--- a/drivers/usb/core/hcd.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/core/hcd.h	Tue Jun 15 22:20:38 2004
@@ -74,6 +74,8 @@
 	 */
 	struct hc_driver	*driver;	/* hw-specific hooks */
 	unsigned		saw_irq : 1;
+	unsigned		can_wakeup:1;	/* hw supports wakeup? */
+	unsigned		remote_wakeup:1;/* sw should use wakeup? */
 	int			irq;		/* irq allocated */
 	void			*regs;		/* device memory/io */
 
@@ -94,7 +96,7 @@
 #	define	USB_STATE_RUNNING	(__ACTIVE)
 #	define	USB_STATE_QUIESCING	(__SUSPEND|__TRANSIENT|__ACTIVE)
 #	define	USB_STATE_RESUMING	(__SUSPEND|__TRANSIENT)
-#	define	USB_STATE_SUSPENDED	(__SUSPEND)
+#	define	HCD_STATE_SUSPENDED	(__SUSPEND)
 
 #define	HCD_IS_RUNNING(state) ((state) & __ACTIVE)
 #define	HCD_IS_SUSPENDED(state) ((state) & __SUSPEND)
@@ -241,13 +243,13 @@
 extern struct usb_device *usb_alloc_dev(struct usb_device *parent,
 					struct usb_bus *, unsigned port);
 extern int usb_new_device(struct usb_device *dev);
-extern void usb_choose_address(struct usb_device *dev);
 extern void usb_disconnect(struct usb_device **);
+extern void usb_choose_address(struct usb_device *dev);
+extern void usb_release_address(struct usb_device *dev);
 
 /* exported to hub driver ONLY to support usb_reset_device () */
 extern int usb_get_configuration(struct usb_device *dev);
 extern void usb_destroy_configuration(struct usb_device *dev);
-extern int usb_set_address(struct usb_device *dev);
 
 /* use these only before the device's address has been set */
 #define usb_snddefctrl(dev)		((PIPE_CONTROL << 30))
@@ -327,7 +329,7 @@
 #define HS_USECS(bytes) NS_TO_US ( ((55 * 8 * 2083)/1000) \
 	+ ((2083UL * (3167 + BitTime (bytes)))/1000) \
 	+ USB2_HOST_DELAY)
-#define HS_USECS_ISO(bytes) NS_TO_US ( ((long)(38 * 8 * 2.083)) \
+#define HS_USECS_ISO(bytes) NS_TO_US ( ((38 * 8 * 2083)/1000) \
 	+ ((2083UL * (3167 + BitTime (bytes)))/1000) \
 	+ USB2_HOST_DELAY)
 
@@ -344,9 +346,16 @@
 extern int usb_register_root_hub (struct usb_device *usb_dev,
 		struct device *parent_dev);
 
-/* for portability to 2.4, hcds should call this */
 static inline int hcd_register_root (struct usb_hcd *hcd)
 {
+	/* hcd->driver->start() reported can_wakeup, probably with
+	 * assistance from board's boot firmware.
+	 * NOTE:  normal devices won't enable wakeup by default.
+	 */
+	if (hcd->can_wakeup)
+		dev_dbg (hcd->self.controller, "supports USB remote wakeup\n");
+	hcd->remote_wakeup = hcd->can_wakeup;
+
 	return usb_register_root_hub (
 		hcd_to_bus (hcd)->root_hub, hcd->self.controller);
 }
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/core/hub.c	Tue Jun 15 22:20:40 2004
@@ -38,7 +38,6 @@
 
 /* Wakes up khubd */
 static spinlock_t hub_event_lock = SPIN_LOCK_UNLOCKED;
-static DECLARE_MUTEX(usb_address0_sem);
 
 static LIST_HEAD(hub_event_list);	/* List of hubs needing servicing */
 static LIST_HEAD(hub_list);		/* List of all hubs (for cleanup) */
@@ -66,15 +65,15 @@
 #endif
 
 /* for dev_info, dev_dbg, etc */
-static inline struct device *hubdev (struct usb_device *dev)
+static inline struct device *hubdev (struct usb_device *hdev)
 {
-	return &dev->actconfig->interface[0]->dev;
+	return &hdev->actconfig->interface[0]->dev;
 }
 
 /* USB 2.0 spec Section 11.24.4.5 */
-static int get_hub_descriptor(struct usb_device *dev, void *data, int size)
+static int get_hub_descriptor(struct usb_device *hdev, void *data, int size)
 {
-	return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+	return 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);
 }
@@ -82,27 +81,27 @@
 /*
  * USB 2.0 spec Section 11.24.2.1
  */
-static int clear_hub_feature(struct usb_device *dev, int feature)
+static int clear_hub_feature(struct usb_device *hdev, int feature)
 {
-	return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
 		USB_REQ_CLEAR_FEATURE, USB_RT_HUB, feature, 0, NULL, 0, HZ);
 }
 
 /*
  * USB 2.0 spec Section 11.24.2.2
  */
-static int clear_port_feature(struct usb_device *dev, int port, int feature)
+static int clear_port_feature(struct usb_device *hdev, int port, int feature)
 {
-	return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
 		USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port, NULL, 0, HZ);
 }
 
 /*
  * USB 2.0 spec Section 11.24.2.13
  */
-static int set_port_feature(struct usb_device *dev, int port, int feature)
+static int set_port_feature(struct usb_device *hdev, int port, int feature)
 {
-	return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
 		USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port, NULL, 0, HZ);
 }
 
@@ -111,16 +110,15 @@
  * for info about using port indicators
  */
 static void set_port_led(
-	struct usb_device *dev,
-	struct usb_hub *hub,
+	struct usb_device *hdev,
 	int port,
 	int selector
 )
 {
-	int status = set_port_feature(dev, (selector << 8) | port,
+	int status = set_port_feature(hdev, (selector << 8) | port,
 			USB_PORT_FEAT_INDICATOR);
 	if (status < 0)
-		dev_dbg (&hub->intf->dev,
+		dev_dbg (hubdev (hdev),
 			"port %d indicator %s status %d\n",
 			port,
 			({ char *s; switch (selector) {
@@ -138,12 +136,12 @@
 static void led_work (void *__hub)
 {
 	struct usb_hub		*hub = __hub;
-	struct usb_device	*dev = interface_to_usbdev (hub->intf);
+	struct usb_device	*hdev = interface_to_usbdev (hub->intf);
 	unsigned		i;
 	unsigned		changed = 0;
 	int			cursor = -1;
 
-	if (dev->state != USB_STATE_CONFIGURED)
+	if (hdev->state != USB_STATE_CONFIGURED)
 		return;
 
 	for (i = 0; i < hub->descriptor->bNbrPorts; i++) {
@@ -190,13 +188,13 @@
 		}
 		if (selector != HUB_LED_AUTO)
 			changed = 1;
-		set_port_led(dev, hub, i + 1, selector);
+		set_port_led(hdev, i + 1, selector);
 		hub->indicator[i] = mode;
 	}
 	if (!changed && blinkenlights) {
 		cursor++;
 		cursor %= hub->descriptor->bNbrPorts;
-		set_port_led(dev, hub, cursor + 1, HUB_LED_GREEN);
+		set_port_led(hdev, cursor + 1, HUB_LED_GREEN);
 		hub->indicator[cursor] = INDICATOR_CYCLE;
 		changed++;
 	}
@@ -207,10 +205,10 @@
 /*
  * USB 2.0 spec Section 11.24.2.6
  */
-static int get_hub_status(struct usb_device *dev,
+static int get_hub_status(struct usb_device *hdev,
 		struct usb_hub_status *data)
 {
-	return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+	return 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_CTRL_GET_TIMEOUT);
 }
@@ -218,10 +216,10 @@
 /*
  * USB 2.0 spec Section 11.24.2.7
  */
-static int get_port_status(struct usb_device *dev, int port,
+static int get_port_status(struct usb_device *hdev, int port,
 		struct usb_port_status *data)
 {
-	return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
+	return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
 		USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port,
 		data, sizeof(*data), HZ * USB_CTRL_GET_TIMEOUT);
 }
@@ -279,9 +277,9 @@
 
 /* USB 2.0 spec Section 11.24.2.3 */
 static inline int
-hub_clear_tt_buffer (struct usb_device *hub, u16 devinfo, u16 tt)
+hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt)
 {
-	return usb_control_msg (hub, usb_rcvctrlpipe (hub, 0),
+	return usb_control_msg (hdev, usb_rcvctrlpipe (hdev, 0),
 		HUB_CLEAR_TT_BUFFER, USB_RT_PORT,
 		devinfo, tt, 0, 0, HZ);
 }
@@ -301,7 +299,7 @@
 	while (!list_empty (&hub->tt.clear_list)) {
 		struct list_head	*temp;
 		struct usb_tt_clear	*clear;
-		struct usb_device	*dev;
+		struct usb_device	*hdev;
 		int			status;
 
 		temp = hub->tt.clear_list.next;
@@ -310,12 +308,13 @@
 
 		/* drop lock so HCD can concurrently report other TT errors */
 		spin_unlock_irqrestore (&hub->tt.lock, flags);
-		dev = interface_to_usbdev (hub->intf);
-		status = hub_clear_tt_buffer (dev, clear->devinfo, clear->tt);
+		hdev = interface_to_usbdev (hub->intf);
+		status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt);
 		spin_lock_irqsave (&hub->tt.lock, flags);
 
 		if (status)
-			dev_err (&dev->dev, "clear tt %d (%04x) error %d\n",
+			dev_err (&hdev->dev,
+				"clear tt %d (%04x) error %d\n",
 				clear->tt, clear->devinfo, status);
 		kfree (clear);
 	}
@@ -335,9 +334,9 @@
  * It may not be possible for that hub to handle additional full (or low)
  * speed transactions until that state is fully cleared out.
  */
-void usb_hub_tt_clear_buffer (struct usb_device *dev, int pipe)
+void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe)
 {
-	struct usb_tt		*tt = dev->tt;
+	struct usb_tt		*tt = udev->tt;
 	unsigned long		flags;
 	struct usb_tt_clear	*clear;
 
@@ -346,15 +345,15 @@
 	 * there can be many TTs per hub).  even if they're uncommon.
 	 */
 	if ((clear = kmalloc (sizeof *clear, SLAB_ATOMIC)) == 0) {
-		dev_err (&dev->dev, "can't save CLEAR_TT_BUFFER state\n");
+		dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n");
 		/* FIXME recover somehow ... RESET_TT? */
 		return;
 	}
 
 	/* info that CLEAR_TT_BUFFER needs */
-	clear->tt = tt->multi ? dev->ttport : 1;
+	clear->tt = tt->multi ? udev->ttport : 1;
 	clear->devinfo = usb_pipeendpoint (pipe);
-	clear->devinfo |= dev->devnum << 4;
+	clear->devinfo |= udev->devnum << 4;
 	clear->devinfo |= usb_pipecontrol (pipe)
 			? (USB_ENDPOINT_XFER_CONTROL << 11)
 			: (USB_ENDPOINT_XFER_BULK << 11);
@@ -370,29 +369,30 @@
 
 static void hub_power_on(struct usb_hub *hub)
 {
-	struct usb_device *dev;
+	struct usb_device *hdev;
 	int i;
 
-	/* Enable power to the ports */
-	dev_dbg(hubdev(interface_to_usbdev(hub->intf)),
-		"enabling power on all ports\n");
-	dev = interface_to_usbdev(hub->intf);
-	for (i = 0; i < hub->descriptor->bNbrPorts; i++)
-		set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
+	/* if hub supports power switching, enable power on each port */
+	if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) < 2) {
+		dev_dbg(&hub->intf->dev, "enabling power on all ports\n");
+		hdev = interface_to_usbdev(hub->intf);
+		for (i = 0; i < hub->descriptor->bNbrPorts; i++)
+			set_port_feature(hdev, i + 1, USB_PORT_FEAT_POWER);
+	}
 
 	/* Wait for power to be enabled */
-	wait_ms(hub->descriptor->bPwrOn2PwrGood * 2);
+	msleep(hub->descriptor->bPwrOn2PwrGood * 2);
 }
 
 static int hub_hub_status(struct usb_hub *hub,
 		u16 *status, u16 *change)
 {
-	struct usb_device *dev = interface_to_usbdev (hub->intf);
+	struct usb_device *hdev = interface_to_usbdev (hub->intf);
 	int ret;
 
-	ret = get_hub_status(dev, &hub->status->hub);
+	ret = get_hub_status(hdev, &hub->status->hub);
 	if (ret < 0)
-		dev_err (hubdev (dev),
+		dev_err (&hub->intf->dev,
 			"%s failed (err = %d)\n", __FUNCTION__, ret);
 	else {
 		*status = le16_to_cpu(hub->status->hub.wHubStatus);
@@ -405,14 +405,14 @@
 static int hub_configure(struct usb_hub *hub,
 	struct usb_endpoint_descriptor *endpoint)
 {
-	struct usb_device *dev = interface_to_usbdev (hub->intf);
-	struct device *hub_dev;
+	struct usb_device *hdev = interface_to_usbdev (hub->intf);
+	struct device *hub_dev = &hub->intf->dev;
 	u16 hubstatus, hubchange;
 	unsigned int pipe;
 	int maxp, ret;
 	char *message;
 
-	hub->buffer = usb_buffer_alloc(dev, sizeof(*hub->buffer), GFP_KERNEL,
+	hub->buffer = usb_buffer_alloc(hdev, sizeof(*hub->buffer), GFP_KERNEL,
 			&hub->buffer_dma);
 	if (!hub->buffer) {
 		message = "can't allocate hub irq buffer";
@@ -438,7 +438,7 @@
 	 * hub->descriptor can handle USB_MAXCHILDREN ports,
 	 * but the hub can/will return fewer bytes here.
 	 */
-	ret = get_hub_descriptor(dev, hub->descriptor,
+	ret = get_hub_descriptor(hdev, hub->descriptor,
 			sizeof(*hub->descriptor));
 	if (ret < 0) {
 		message = "can't read hub descriptor";
@@ -449,10 +449,9 @@
 		goto fail;
 	}
 
-	hub_dev = hubdev(dev);
-	dev->maxchild = hub->descriptor->bNbrPorts;
-	dev_info (hub_dev, "%d port%s detected\n", dev->maxchild,
-		(dev->maxchild == 1) ? "" : "s");
+	hdev->maxchild = hub->descriptor->bNbrPorts;
+	dev_info (hub_dev, "%d port%s detected\n", hdev->maxchild,
+		(hdev->maxchild == 1) ? "" : "s");
 
 	le16_to_cpus(&hub->descriptor->wHubCharacteristics);
 
@@ -460,11 +459,11 @@
 		int	i;
 		char	portstr [USB_MAXCHILDREN + 1];
 
-		for (i = 0; i < dev->maxchild; i++)
+		for (i = 0; i < hdev->maxchild; i++)
 			portstr[i] = hub->descriptor->DeviceRemovable
 				    [((i + 1) / 8)] & (1 << ((i + 1) % 8))
 				? 'F' : 'R';
-		portstr[dev->maxchild] = 0;
+		portstr[hdev->maxchild] = 0;
 		dev_dbg(hub_dev, "compound device; port removable status: %s\n", portstr);
 	} else
 		dev_dbg(hub_dev, "standalone hub\n");
@@ -498,32 +497,32 @@
 	spin_lock_init (&hub->tt.lock);
 	INIT_LIST_HEAD (&hub->tt.clear_list);
 	INIT_WORK (&hub->tt.kevent, hub_tt_kevent, hub);
-	switch (dev->descriptor.bDeviceProtocol) {
+	switch (hdev->descriptor.bDeviceProtocol) {
 		case 0:
 			break;
 		case 1:
 			dev_dbg(hub_dev, "Single TT\n");
-			hub->tt.hub = dev;
+			hub->tt.hub = hdev;
 			break;
 		case 2:
-			ret = usb_set_interface(dev, 0, 1);
+			ret = usb_set_interface(hdev, 0, 1);
 			if (ret == 0) {
 				dev_dbg(hub_dev, "TT per port\n");
 				hub->tt.multi = 1;
 			} else
 				dev_err(hub_dev, "Using single TT (err %d)\n",
 					ret);
-			hub->tt.hub = dev;
+			hub->tt.hub = hdev;
 			break;
 		default:
 			dev_dbg(hub_dev, "Unrecognized hub protocol %d\n",
-				dev->descriptor.bDeviceProtocol);
+				hdev->descriptor.bDeviceProtocol);
 			break;
 	}
 
 	switch (hub->descriptor->wHubCharacteristics & HUB_CHAR_TTTT) {
 		case 0x00:
-			if (dev->descriptor.bDeviceProtocol != 0)
+			if (hdev->descriptor.bDeviceProtocol != 0)
 				dev_dbg(hub_dev, "TT requires at most 8 FS bit times\n");
 			break;
 		case 0x20:
@@ -545,8 +544,25 @@
 
 	dev_dbg(hub_dev, "power on to power good time: %dms\n",
 		hub->descriptor->bPwrOn2PwrGood * 2);
-	dev_dbg(hub_dev, "hub controller current requirement: %dmA\n",
-		hub->descriptor->bHubContrCurrent);
+
+	/* power budgeting mostly matters with bus-powered hubs,
+	 * and battery-powered root hubs (may provide just 8 mA).
+	 */
+	ret = usb_get_status(hdev, USB_RECIP_DEVICE, 0, &hubstatus);
+	if (ret < 0) {
+		message = "can't get hub status";
+		goto fail;
+	}
+	cpu_to_le16s(&hubstatus);
+	if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
+		dev_dbg(hub_dev, "hub controller current requirement: %dmA\n",
+			hub->descriptor->bHubContrCurrent);
+		hub->power_budget = (501 - hub->descriptor->bHubContrCurrent)
+					/ 2;
+		dev_dbg(hub_dev, "%dmA bus power budget for children\n",
+			hub->power_budget * 2);
+	}
+
 
 	ret = hub_hub_status(hub, &hubstatus, &hubchange);
 	if (ret < 0) {
@@ -554,20 +570,19 @@
 		goto fail;
 	}
 
-	/* FIXME implement per-port power budgeting;
-	 * enable it for bus-powered hubs.
-	 */
-	dev_dbg(hub_dev, "local power source is %s\n",
-		(hubstatus & HUB_STATUS_LOCAL_POWER)
-		? "lost (inactive)" : "good");
+	/* local power status reports aren't always correct */
+	if (hdev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_SELFPOWER)
+		dev_dbg(hub_dev, "local power source is %s\n",
+			(hubstatus & HUB_STATUS_LOCAL_POWER)
+			? "lost (inactive)" : "good");
 
 	if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_OCPM) == 0)
 		dev_dbg(hub_dev, "%sover-current condition exists\n",
 			(hubstatus & HUB_STATUS_OVERCURRENT) ? "" : "no ");
 
 	/* Start the interrupt endpoint */
-	pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
-	maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
+	pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress);
+	maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe));
 
 	if (maxp > sizeof(*hub->buffer))
 		maxp = sizeof(*hub->buffer);
@@ -579,7 +594,7 @@
 		goto fail;
 	}
 
-	usb_fill_int_urb(hub->urb, dev, pipe, *hub->buffer, maxp, hub_irq,
+	usb_fill_int_urb(hub->urb, hdev, pipe, *hub->buffer, maxp, hub_irq,
 		hub, endpoint->bInterval);
 	hub->urb->transfer_dma = hub->buffer_dma;
 	hub->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
@@ -595,7 +610,7 @@
 
 	/* maybe start cycling the hub leds */
 	if (hub->has_indicators && blinkenlights) {
-		set_port_led(dev, hub, 1, HUB_LED_GREEN);
+		set_port_led(hdev, 1, HUB_LED_GREEN);
 		hub->indicator [0] = INDICATOR_CYCLE;
 		schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD);
 	}
@@ -605,12 +620,14 @@
 	return 0;
 
 fail:
-	dev_err (&hub->intf->dev, "config failed, %s (err %d)\n",
+	dev_err (hub_dev, "config failed, %s (err %d)\n",
 			message, ret);
 	/* hub_disconnect() frees urb and descriptor */
 	return ret;
 }
 
+static unsigned highspeed_hubs;
+
 static void hub_disconnect(struct usb_interface *intf)
 {
 	struct usb_hub *hub = usb_get_intfdata (intf);
@@ -620,6 +637,9 @@
 	if (!hub)
 		return;
 
+	if (interface_to_usbdev(intf)->speed == USB_SPEED_HIGH)
+		highspeed_hubs--;
+
 	usb_set_intfdata (intf, NULL);
 	spin_lock_irqsave(&hub_event_lock, flags);
 	hub->urb_complete = &urb_complete;
@@ -672,19 +692,21 @@
 {
 	struct usb_host_interface *desc;
 	struct usb_endpoint_descriptor *endpoint;
-	struct usb_device *dev;
+	struct usb_device *hdev;
 	struct usb_hub *hub;
+	struct device *hub_dev;
 	unsigned long flags;
 
 	desc = intf->cur_altsetting;
-	dev = interface_to_usbdev(intf);
+	hdev = interface_to_usbdev(intf);
+	hub_dev = &intf->dev;
 
 	/* Some hubs have a subclass of 1, which AFAICT according to the */
 	/*  specs is not defined, but it works */
 	if ((desc->desc.bInterfaceSubClass != 0) &&
 	    (desc->desc.bInterfaceSubClass != 1)) {
 descriptor_error:
-		dev_err (&intf->dev, "bad descriptor, ignoring hub\n");
+		dev_err (hub_dev, "bad descriptor, ignoring hub\n");
 		return -EIO;
 	}
 
@@ -708,11 +730,11 @@
 	}
 
 	/* We found a hub */
-	dev_info (hubdev (dev), "USB hub found\n");
+	dev_info (hub_dev, "USB hub found\n");
 
 	hub = kmalloc(sizeof(*hub), GFP_KERNEL);
 	if (!hub) {
-		dev_dbg (hubdev(dev), "couldn't kmalloc hub struct\n");
+		dev_dbg (hub_dev, "couldn't kmalloc hub struct\n");
 		return -ENOMEM;
 	}
 
@@ -731,6 +753,9 @@
 
 	usb_set_intfdata (intf, hub);
 
+	if (hdev->speed == USB_SPEED_HIGH)
+		highspeed_hubs++;
+
 	if (hub_configure(hub, endpoint) >= 0)
 		return 0;
 
@@ -741,7 +766,7 @@
 static int
 hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data)
 {
-	struct usb_device *hub = interface_to_usbdev (intf);
+	struct usb_device *hdev = interface_to_usbdev (intf);
 
 	/* assert ifno == 0 (part of hub spec) */
 	switch (code) {
@@ -751,16 +776,16 @@
 		int i;
 
 		spin_lock_irqsave(&hub_event_lock, flags);
-		if (hub->devnum <= 0)
+		if (hdev->devnum <= 0)
 			info->nports = 0;
 		else {
-			info->nports = hub->maxchild;
+			info->nports = hdev->maxchild;
 			for (i = 0; i < info->nports; i++) {
-				if (hub->children[i] == NULL)
+				if (hdev->children[i] == NULL)
 					info->port[i] = 0;
 				else
 					info->port[i] =
-						hub->children[i]->devnum;
+						hdev->children[i]->devnum;
 			}
 		}
 		spin_unlock_irqrestore(&hub_event_lock, flags);
@@ -775,13 +800,13 @@
 
 static int hub_reset(struct usb_hub *hub)
 {
-	struct usb_device *dev = interface_to_usbdev(hub->intf);
+	struct usb_device *hdev = interface_to_usbdev(hub->intf);
 	int i;
 
 	/* Disconnect any attached devices */
 	for (i = 0; i < hub->descriptor->bNbrPorts; i++) {
-		if (dev->children[i])
-			usb_disconnect(&dev->children[i]);
+		if (hdev->children[i])
+			usb_disconnect(&hdev->children[i]);
 	}
 
 	/* Attempt to reset the hub */
@@ -790,10 +815,10 @@
 	else
 		return -1;
 
-	if (usb_reset_device(dev))
+	if (usb_reset_device(hdev))
 		return -1;
 
-	hub->urb->dev = dev;                                                    
+	hub->urb->dev = hdev;                                                    
 	if (usb_submit_urb(hub->urb, GFP_KERNEL))
 		return -1;
 
@@ -802,36 +827,36 @@
 	return 0;
 }
 
-static void hub_start_disconnect(struct usb_device *dev)
+static void hub_start_disconnect(struct usb_device *hdev)
 {
-	struct usb_device *parent = dev->parent;
+	struct usb_device *parent = hdev->parent;
 	int i;
 
 	/* Find the device pointer to disconnect */
 	if (parent) {
 		for (i = 0; i < parent->maxchild; i++) {
-			if (parent->children[i] == dev) {
+			if (parent->children[i] == hdev) {
 				usb_disconnect(&parent->children[i]);
 				return;
 			}
 		}
 	}
 
-	dev_err(&dev->dev, "cannot disconnect hub!\n");
+	dev_err(&hdev->dev, "cannot disconnect hub!\n");
 }
 
-static int hub_port_status(struct usb_device *dev, int port,
+static int hub_port_status(struct usb_device *hdev, int port,
 			       u16 *status, u16 *change)
 {
-	struct usb_hub *hub = usb_get_intfdata(dev->actconfig->interface[0]);
+	struct usb_hub *hub = usb_get_intfdata(hdev->actconfig->interface[0]);
 	int ret;
 
 	if (!hub)
 		return -ENODEV;
 
-	ret = get_port_status(dev, port + 1, &hub->status->port);
+	ret = get_port_status(hdev, port + 1, &hub->status->port);
 	if (ret < 0)
-		dev_err (hubdev (dev),
+		dev_err (&hub->intf->dev,
 			"%s failed (err = %d)\n", __FUNCTION__, ret);
 	else {
 		*status = le16_to_cpu(hub->status->port.wPortStatus);
@@ -841,16 +866,18 @@
 	return ret;
 }
 
-#define HUB_RESET_TRIES		5
-#define HUB_PROBE_TRIES		2
+#define PORT_RESET_TRIES	5
+#define SET_ADDRESS_TRIES	2
+#define GET_DESCRIPTOR_TRIES	2
+#define SET_CONFIG_TRIES	2
+
 #define HUB_ROOT_RESET_TIME	50	/* times are in msec */
 #define HUB_SHORT_RESET_TIME	10
 #define HUB_LONG_RESET_TIME	200
 #define HUB_RESET_TIMEOUT	500
 
-/* return: -1 on error, 0 on success, 1 on disconnect.  */
-static int hub_port_wait_reset(struct usb_device *hub, int port,
-				struct usb_device *dev, unsigned int delay)
+static int hub_port_wait_reset(struct usb_device *hdev, int port,
+				struct usb_device *udev, unsigned int delay)
 {
 	int delay_time, ret;
 	u16 portstatus;
@@ -860,31 +887,30 @@
 			delay_time < HUB_RESET_TIMEOUT;
 			delay_time += delay) {
 		/* wait to give the device a chance to reset */
-		wait_ms(delay);
+		msleep(delay);
 
 		/* read and decode port status */
-		ret = hub_port_status(hub, port, &portstatus, &portchange);
-		if (ret < 0) {
-			return -1;
-		}
+		ret = hub_port_status(hdev, port, &portstatus, &portchange);
+		if (ret < 0)
+			return ret;
 
 		/* Device went away? */
 		if (!(portstatus & USB_PORT_STAT_CONNECTION))
-			return 1;
+			return -ENOTCONN;
 
 		/* bomb out completely if something weird happened */
 		if ((portchange & USB_PORT_STAT_C_CONNECTION))
-			return -1;
+			return -EINVAL;
 
 		/* if we`ve finished resetting, then break out of the loop */
 		if (!(portstatus & USB_PORT_STAT_RESET) &&
 		    (portstatus & USB_PORT_STAT_ENABLE)) {
 			if (portstatus & USB_PORT_STAT_HIGH_SPEED)
-				dev->speed = USB_SPEED_HIGH;
+				udev->speed = USB_SPEED_HIGH;
 			else if (portstatus & USB_PORT_STAT_LOW_SPEED)
-				dev->speed = USB_SPEED_LOW;
+				udev->speed = USB_SPEED_LOW;
 			else
-				dev->speed = USB_SPEED_FULL;
+				udev->speed = USB_SPEED_FULL;
 			return 0;
 		}
 
@@ -892,55 +918,55 @@
 		if (delay_time >= 2 * HUB_SHORT_RESET_TIME)
 			delay = HUB_LONG_RESET_TIME;
 
-		dev_dbg (hubdev (hub),
+		dev_dbg (hubdev (hdev),
 			"port %d not reset yet, waiting %dms\n",
 			port + 1, delay);
 	}
 
-	return -1;
+	return -EBUSY;
 }
 
-/* return: -1 on error, 0 on success, 1 on disconnect.  */
-static int hub_port_reset(struct usb_device *hub, int port,
-				struct usb_device *dev, unsigned int delay)
+static int hub_port_reset(struct usb_device *hdev, int port,
+				struct usb_device *udev, unsigned int delay)
 {
 	int i, status;
+	struct device *hub_dev = hubdev (hdev);
 
 	/* Reset the port */
-	for (i = 0; i < HUB_RESET_TRIES; i++) {
-		set_port_feature(hub, port + 1, USB_PORT_FEAT_RESET);
+	for (i = 0; i < PORT_RESET_TRIES; i++) {
+		set_port_feature(hdev, port + 1, USB_PORT_FEAT_RESET);
 
 		/* return on disconnect or reset */
-		status = hub_port_wait_reset(hub, port, dev, delay);
-		if (status != -1) {
-			clear_port_feature(hub,
+		status = hub_port_wait_reset(hdev, port, udev, delay);
+		if (status == -ENOTCONN || status == 0) {
+			clear_port_feature(hdev,
 				port + 1, USB_PORT_FEAT_C_RESET);
-			dev->state = status
+			udev->state = status
 					? USB_STATE_NOTATTACHED
 					: USB_STATE_DEFAULT;
 			return status;
 		}
 
-		dev_dbg (hubdev (hub),
+		dev_dbg (hub_dev,
 			"port %d not enabled, trying reset again...\n",
 			port + 1);
 		delay = HUB_LONG_RESET_TIME;
 	}
 
-	dev_err (hubdev (hub),
+	dev_err (hub_dev,
 		"Cannot enable port %i.  Maybe the USB cable is bad?\n",
 		port + 1);
 
-	return -1;
+	return status;
 }
 
-int hub_port_disable(struct usb_device *hub, int port)
+static int hub_port_disable(struct usb_device *hdev, int port)
 {
 	int ret;
 
-	ret = clear_port_feature(hub, port + 1, USB_PORT_FEAT_ENABLE);
+	ret = clear_port_feature(hdev, port + 1, USB_PORT_FEAT_ENABLE);
 	if (ret)
-		dev_err(hubdev(hub), "cannot disable port %d (err = %d)\n",
+		dev_err(hubdev(hdev), "cannot disable port %d (err = %d)\n",
 			port + 1, ret);
 
 	return ret;
@@ -964,8 +990,7 @@
 #define HUB_DEBOUNCE_STEP	 25
 #define HUB_DEBOUNCE_STABLE	  4
 
-/* return: -1 on error, 0 on success, 1 on disconnect.  */
-static int hub_port_debounce(struct usb_device *hub, int port)
+static int hub_port_debounce(struct usb_device *hdev, int port)
 {
 	int ret;
 	int delay_time, stable_count;
@@ -975,11 +1000,11 @@
 	connection = 0;
 	stable_count = 0;
 	for (delay_time = 0; delay_time < HUB_DEBOUNCE_TIMEOUT; delay_time += HUB_DEBOUNCE_STEP) {
-		wait_ms(HUB_DEBOUNCE_STEP);
+		msleep(HUB_DEBOUNCE_STEP);
 
-		ret = hub_port_status(hub, port, &portstatus, &portchange);
+		ret = hub_port_status(hdev, port, &portstatus, &portchange);
 		if (ret < 0)
-			return -1;
+			return ret;
 
 		if ((portstatus & USB_PORT_STAT_CONNECTION) == connection) {
 			if (connection) {
@@ -992,130 +1017,400 @@
 		connection = portstatus & USB_PORT_STAT_CONNECTION;
 
 		if ((portchange & USB_PORT_STAT_C_CONNECTION)) {
-			clear_port_feature(hub, port+1, USB_PORT_FEAT_C_CONNECTION);
+			clear_port_feature(hdev, port+1, USB_PORT_FEAT_C_CONNECTION);
 		}
 	}
 
-	dev_dbg (hubdev (hub),
+	dev_dbg (hubdev (hdev),
 		"debounce: port %d: delay %dms stable %d status 0x%x\n",
 		port + 1, delay_time, stable_count, portstatus);
 
-	return ((portstatus&USB_PORT_STAT_CONNECTION)) ? 0 : 1;
+	return (portstatus & USB_PORT_STAT_CONNECTION) ? 0 : -ENOTCONN;
 }
 
-static void hub_port_connect_change(struct usb_hub *hubstate, int port,
-					u16 portstatus, u16 portchange)
+static int hub_set_address(struct usb_device *udev)
 {
-	struct usb_device *hub = interface_to_usbdev(hubstate->intf);
-	struct usb_device *dev;
-	unsigned int delay = HUB_SHORT_RESET_TIME;
-	int i;
-
-	dev_dbg (&hubstate->intf->dev,
-		"port %d, status %x, change %x, %s\n",
-		port + 1, portstatus, portchange, portspeed (portstatus));
-
-	/* Clear the connection change status */
-	clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_CONNECTION);
+	int retval;
 
-	/* Disconnect any existing devices under this port */
-	if (hub->children[port])
-		usb_disconnect(&hub->children[port]);
-
-	/* Return now if nothing is connected */
-	if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
-		if (portstatus & USB_PORT_STAT_ENABLE)
-			hub_port_disable(hub, port);
+	if (udev->devnum == 0)
+		return -EINVAL;
+	if (udev->state != USB_STATE_DEFAULT &&
+			udev->state != USB_STATE_ADDRESS)
+		return -EINVAL;
+	retval = usb_control_msg(udev, usb_snddefctrl(udev),
+		USB_REQ_SET_ADDRESS, 0, udev->devnum, 0,
+		NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+	if (retval == 0)
+		udev->state = USB_STATE_ADDRESS;
+	return retval;
+}
 
-		return;
-	}
+/* reset device, (re)assign address, get device descriptor.
+ * device connection is stable, no more debouncing needed.
+ * returns device in USB_STATE_ADDRESS, except on error.
+ * on error return, device is no longer usable (ref dropped).
+ *
+ * caller owns dev->serialize for the device, guarding against
+ * config changes and disconnect processing.
+ */
+static int
+hub_port_init (struct usb_device *hdev, struct usb_device *udev, int port)
+{
+	static DECLARE_MUTEX(usb_address0_sem);
 
-	if (hub_port_debounce(hub, port)) {
-		dev_err (&hubstate->intf->dev,
-			"connect-debounce failed, port %d disabled\n",
-			port+1);
-		hub_port_disable(hub, port);
-		return;
-	}
+	int			i, j, retval;
+	unsigned		delay = HUB_SHORT_RESET_TIME;
+	enum usb_device_speed	oldspeed = udev->speed;
 
 	/* root hub ports have a slightly longer reset period
 	 * (from USB 2.0 spec, section 7.1.7.5)
 	 */
-	if (!hub->parent)
+	if (!hdev->parent)
 		delay = HUB_ROOT_RESET_TIME;
 
 	/* Some low speed devices have problems with the quick delay, so */
 	/*  be a bit pessimistic with those devices. RHbug #23670 */
-	if (portstatus & USB_PORT_STAT_LOW_SPEED)
+	if (oldspeed == USB_SPEED_LOW)
 		delay = HUB_LONG_RESET_TIME;
 
 	down(&usb_address0_sem);
 
-	for (i = 0; i < HUB_PROBE_TRIES; i++) {
-
-		/* Allocate a new device struct */
-		dev = usb_alloc_dev(hub, hub->bus, port);
-		if (!dev) {
-			dev_err (&hubstate->intf->dev,
-				"couldn't allocate usb_device\n");
-			break;
-		}
-
-		dev->state = USB_STATE_POWERED;
-
-		/* Reset the device, and detect its speed */
-		if (hub_port_reset(hub, port, dev, delay)) {
-			usb_put_dev(dev);
-			break;
-		}
+	/* Reset the device; full speed may morph to high speed */
+	retval = hub_port_reset(hdev, port, udev, delay);
+	if (retval < 0)		/* error or disconnect */
+		goto fail;
+				/* success, speed is known */
+	retval = -ENODEV;
 
-		/* Find a new address for it */
-		usb_choose_address(dev);
+	if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed) {
+		dev_dbg(&udev->dev, "device reset changed speed!\n");
+		goto fail;
+	}
+  
+	/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
+	 * it's fixed size except for full speed devices.
+	 */
+	switch (udev->speed) {
+	case USB_SPEED_HIGH:		/* fixed at 64 */
+		i = 64;
+		break;
+	case USB_SPEED_FULL:		/* 8, 16, 32, or 64 */
+		/* to determine the ep0 maxpacket size, read the first 8
+		 * bytes from the device descriptor to get bMaxPacketSize0;
+		 * then correct our initial (small) guess.
+		 */
+		// FALLTHROUGH
+	case USB_SPEED_LOW:		/* fixed at 8 */
+		i = 8;
+		break;
+	default:
+		goto fail;
+	}
+	udev->epmaxpacketin [0] = i;
+	udev->epmaxpacketout[0] = i;
+ 
+	/* set the address */
+	if (udev->devnum <= 0) {
+		usb_choose_address(udev);
+		if (udev->devnum <= 0)
+			goto fail;
 
 		/* Set up TT records, if needed  */
-		if (hub->tt) {
-			dev->tt = hub->tt;
-			dev->ttport = hub->ttport;
-		} else if (dev->speed != USB_SPEED_HIGH
-				&& hub->speed == USB_SPEED_HIGH) {
-			dev->tt = &hubstate->tt;
-			dev->ttport = port + 1;
+		if (hdev->tt) {
+			udev->tt = hdev->tt;
+			udev->ttport = hdev->ttport;
+		} else if (udev->speed != USB_SPEED_HIGH
+				&& hdev->speed == USB_SPEED_HIGH) {
+			struct usb_hub	*hub;
+ 
+			hub = usb_get_intfdata (hdev->actconfig
+							->interface[0]);
+			udev->tt = &hub->tt;
+			udev->ttport = port + 1;
 		}
 
-		dev_info (&dev->dev,
-			"new %s speed USB device using address %d\n",
-			({ char *speed; switch (dev->speed) {
+		/* force the right log message (below) at low speed */
+		oldspeed = USB_SPEED_UNKNOWN;
+	}
+ 
+	dev_info (&udev->dev,
+			"%s %s speed USB device using address %d\n",
+			(oldspeed == USB_SPEED_UNKNOWN) ? "new" : "reset",
+			({ char *speed; switch (udev->speed) {
 			case USB_SPEED_LOW:	speed = "low";	break;
 			case USB_SPEED_FULL:	speed = "full";	break;
 			case USB_SPEED_HIGH:	speed = "high";	break;
 			default: 		speed = "?";	break;
 			}; speed;}),
-			dev->devnum);
+			udev->devnum);
+ 
+	/* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
+	 * Because device hardware and firmware is sometimes buggy in
+	 * this area, and this is how Linux has done it for ages.
+	 * Change it cautiously.
+	 *
+	 * NOTE:  Windows gets the descriptor first, seemingly to help
+	 * work around device bugs like "can't use addresses with bit 3
+	 * set in certain configurations".  Yes, really.
+	 */
+	for (i = 0; i < GET_DESCRIPTOR_TRIES; ++i) {
+		for (j = 0; j < SET_ADDRESS_TRIES; ++j) {
+			retval = hub_set_address(udev);
+			if (retval >= 0)
+				break;
+			msleep(200);
+		}
+		if (retval < 0) {
+			dev_err(&udev->dev,
+				"device not accepting address %d, error %d\n",
+				udev->devnum, retval);
+ fail:
+			hub_port_disable(hdev, port);
+			usb_release_address(udev);
+			usb_put_dev(udev);
+			up(&usb_address0_sem);
+			return retval;
+		}
+ 
+		/* cope with hardware quirkiness:
+		 *  - let SET_ADDRESS settle, some device hardware wants it
+		 *  - read ep0 maxpacket even for high and low speed,
+  		 */
+		msleep(10);
+		retval = usb_get_device_descriptor(udev, 8);
+		if (retval >= 8)
+			break;
+		msleep(100);
+	}
+	if (retval != 8) {
+		dev_err(&udev->dev, "device descriptor read/%s, error %d\n",
+				"8", retval);
+		if (retval >= 0)
+			retval = -EMSGSIZE;
+		goto fail;
+	}
+	if (udev->speed == USB_SPEED_FULL
+			&& (udev->epmaxpacketin [0]
+				!= udev->descriptor.bMaxPacketSize0)) {
+		usb_disable_endpoint(udev, 0);
+		usb_endpoint_running(udev, 0, 1);
+		usb_endpoint_running(udev, 0, 0);
+		udev->epmaxpacketin [0] = udev->descriptor.bMaxPacketSize0;
+		udev->epmaxpacketout[0] = udev->descriptor.bMaxPacketSize0;
+	}
+  
+	retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE);
+	if (retval < (signed)sizeof(udev->descriptor)) {
+		dev_err(&udev->dev, "device descriptor read/%s, error %d\n",
+			"all", retval);
+		if (retval >= 0)
+			retval = -ENOMSG;
+		goto fail;
+	}
 
-		/* Run it through the hoops (find a driver, etc) */
-		if (usb_new_device(dev) == 0) {
-			hub->children[port] = dev;
-			goto done;
+	/* now dev is visible to other tasks */
+	hdev->children[port] = udev;
+
+	up(&usb_address0_sem);
+	return 0;
+}
+
+static void
+check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port)
+{
+	struct usb_qualifier_descriptor	*qual;
+	int				status;
+
+	qual = kmalloc (sizeof *qual, SLAB_KERNEL);
+	if (qual == 0)
+		return;
+
+	status = usb_get_descriptor (udev, USB_DT_DEVICE_QUALIFIER, 0,
+			qual, sizeof *qual);
+	if (status == sizeof *qual) {
+		dev_info(&udev->dev, "not running at top speed; "
+			"connect to a high speed hub\n");
+		/* hub LEDs are probably harder to miss than syslog */
+		if (hub->has_indicators) {
+			hub->indicator[port] = INDICATOR_GREEN_BLINK;
+			schedule_work (&hub->leds);
 		}
+	}
+	kfree (qual);
+}
 
-		/* Free the configuration if there was an error */
-		usb_put_dev(dev);
+static unsigned
+hub_power_remaining (struct usb_hub *hub, struct usb_device *hdev)
+{
+	int remaining;
+	unsigned i;
 
-		/* Switch to a long reset time */
-		delay = HUB_LONG_RESET_TIME;
+	remaining = hub->power_budget;
+	if (!remaining)		/* self-powered */
+		return 0;
+
+	for (i = 0; i < hdev->maxchild; i++) {
+		struct usb_device	*udev = hdev->children[i];
+		int			delta;
+
+		if (!udev)
+			continue;
+
+		if (udev->actconfig)
+			delta = udev->actconfig->desc.bMaxPower;
+		else
+			delta = 50;
+		// dev_dbg(&udev->dev, "budgeted %dmA\n", 2 * delta);
+		remaining -= delta;
+	}
+	if (remaining < 0) {
+		dev_warn(&hub->intf->dev,
+			"%dmA over power budget!\n",
+			-2 * remaining);
+		remaining = 0;
+	}
+	return remaining;
+}
+ 
+static void hub_port_connect_change(struct usb_hub *hub, int port,
+					u16 portstatus, u16 portchange)
+{
+	struct usb_device *hdev = interface_to_usbdev(hub->intf);
+	struct device *hub_dev = &hub->intf->dev;
+	int status, i;
+ 
+	dev_dbg (hub_dev,
+		"port %d, status %04x, change %04x, %s\n",
+		port + 1, portstatus, portchange, portspeed (portstatus));
+ 
+	/* Clear the connection change status */
+	clear_port_feature(hdev, port + 1, USB_PORT_FEAT_C_CONNECTION);
+
+	if (hub->has_indicators) {
+		set_port_led(hdev, port + 1, HUB_LED_AUTO);
+		hub->indicator[port] = INDICATOR_AUTO;
 	}
+ 
+	/* Disconnect any existing devices under this port */
+	if (hdev->children[port])
+		usb_disconnect(&hdev->children[port]);
+
+	/* Return now if nothing is connected */
+	if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
+
+		/* maybe switch power back on (e.g. root hub was reset) */
+		if ((hub->descriptor->wHubCharacteristics
+					& HUB_CHAR_LPSM) < 2
+				&& !(portstatus & (1 << USB_PORT_FEAT_POWER)))
+			set_port_feature(hdev, port + 1, USB_PORT_FEAT_POWER);
+ 
+		if (portstatus & USB_PORT_STAT_ENABLE)
+  			goto done;
+		return;
+	}
+  
+	if (hub_port_debounce(hdev, port)) {
+		dev_err (hub_dev,
+			"connect-debounce failed, port %d disabled\n",
+			port+1);
+		goto done;
+	}
+
+	for (i = 0; i < SET_CONFIG_TRIES; i++) {
+		struct usb_device *udev;
 
-	hub_port_disable(hub, port);
+		/* reallocate for each attempt, since references
+		 * to the previous one can escape in various ways
+		 */
+		udev = usb_alloc_dev(hdev, hdev->bus, port);
+		if (!udev) {
+			dev_err (hub_dev,
+				"couldn't allocate port %d usb_device\n", port+1);
+			goto done;
+		}
+		udev->state = USB_STATE_POWERED;
+	  
+		/* hub can tell if it's lowspeed already:  D- pullup (not D+) */
+		if (portstatus & USB_PORT_STAT_LOW_SPEED)
+			udev->speed = USB_SPEED_LOW;
+		else
+			udev->speed = USB_SPEED_UNKNOWN;
+
+		/* reset, set address, get descriptor, add to hub's children */
+		down (&udev->serialize);
+		status = hub_port_init(hdev, udev, port);
+		if (status == -ENOTCONN)
+			break;
+		if (status < 0)
+			continue;
+
+		/* consecutive bus-powered hubs aren't reliable; they can
+		 * violate the voltage drop budget.  if the new child has
+		 * a "powered" LED, users should notice we didn't enable it
+		 * (without reading syslog), even without per-port LEDs
+		 * on the parent.
+		 */
+		if (udev->descriptor.bDeviceClass == USB_CLASS_HUB
+				&& hub->power_budget) {
+			u16	devstat;
+
+			status = usb_get_status(udev, USB_RECIP_DEVICE, 0,
+					&devstat);
+			if (status < 0) {
+				dev_dbg(&udev->dev, "get status %d ?\n", status);
+				continue;
+			}
+			cpu_to_le16s(&devstat);
+			if ((devstat & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
+				dev_err(&udev->dev,
+					"can't connect bus-powered hub "
+					"to this port\n");
+				if (hub->has_indicators) {
+					hub->indicator[port] =
+						INDICATOR_AMBER_BLINK;
+					schedule_work (&hub->leds);
+				}
+				hdev->children[port] = NULL;
+				usb_put_dev(udev);
+				hub_port_disable(hdev, port);
+				return;
+			}
+		}
+ 
+		/* check for devices running slower than they could */
+		if (udev->descriptor.bcdUSB >= 0x0200
+				&& udev->speed == USB_SPEED_FULL
+				&& highspeed_hubs != 0)
+			check_highspeed (hub, udev, port);
+
+		/* Run it through the hoops (find a driver, etc) */
+		status = usb_new_device(udev);
+		if (status != 0) {
+			hdev->children[port] = NULL;
+			continue;
+		}
+		up (&udev->serialize);
+
+		status = hub_power_remaining(hub, hdev);
+		if (status)
+			dev_dbg(hub_dev,
+				"%dmA power budget left\n",
+				2 * status);
+
+		return;
+	}
+ 
 done:
-	up(&usb_address0_sem);
+	hub_port_disable(hdev, port);
 }
 
 static void hub_events(void)
 {
 	unsigned long flags;
 	struct list_head *tmp;
-	struct usb_device *dev;
+	struct usb_device *hdev;
 	struct usb_hub *hub;
+	struct device *hub_dev;
 	u16 hubstatus;
 	u16 hubchange;
 	u16 portstatus;
@@ -1138,7 +1433,8 @@
 		tmp = hub_event_list.next;
 
 		hub = list_entry(tmp, struct usb_hub, event_list);
-		dev = interface_to_usbdev(hub->intf);
+		hdev = interface_to_usbdev(hub->intf);
+		hub_dev = &hub->intf->dev;
 
 		list_del_init(tmp);
 
@@ -1148,14 +1444,14 @@
 		spin_unlock_irqrestore(&hub_event_lock, flags);
 
 		if (hub->error) {
-			dev_dbg (&hub->intf->dev, "resetting for error %d\n",
+			dev_dbg (hub_dev, "resetting for error %d\n",
 				hub->error);
 
 			if (hub_reset(hub)) {
-				dev_dbg (&hub->intf->dev,
+				dev_dbg (hub_dev,
 					"can't reset; disconnecting\n");
 				up(&hub->khubd_sem);
-				hub_start_disconnect(dev);
+				hub_start_disconnect(hdev);
 				continue;
 			}
 
@@ -1164,7 +1460,7 @@
 		}
 
 		for (i = 0; i < hub->descriptor->bNbrPorts; i++) {
-			ret = hub_port_status(dev, i, &portstatus, &portchange);
+			ret = hub_port_status(hdev, i, &portstatus, &portchange);
 			if (ret < 0) {
 				continue;
 			}
@@ -1172,10 +1468,10 @@
 			if (portchange & USB_PORT_STAT_C_CONNECTION) {
 				hub_port_connect_change(hub, i, portstatus, portchange);
 			} else if (portchange & USB_PORT_STAT_C_ENABLE) {
-				dev_dbg (hubdev (dev),
-					"port %d enable change, status %x\n",
+				dev_dbg (hub_dev,
+					"port %d enable change, status %08x\n",
 					i + 1, portstatus);
-				clear_port_feature(dev,
+				clear_port_feature(hdev,
 					i + 1, USB_PORT_FEAT_C_ENABLE);
 
 				/*
@@ -1186,8 +1482,8 @@
 				 */
 				if (!(portstatus & USB_PORT_STAT_ENABLE)
 				    && (portstatus & USB_PORT_STAT_CONNECTION)
-				    && (dev->children[i])) {
-					dev_err (&hub->intf->dev,
+				    && (hdev->children[i])) {
+					dev_err (hub_dev,
 					    "port %i "
 					    "disabled by hub (EMI?), "
 					    "re-enabling...",
@@ -1198,43 +1494,43 @@
 			}
 
 			if (portchange & USB_PORT_STAT_C_SUSPEND) {
-				dev_dbg (&hub->intf->dev,
+				dev_dbg (hub_dev,
 					"suspend change on port %d\n",
 					i + 1);
-				clear_port_feature(dev,
+				clear_port_feature(hdev,
 					i + 1,  USB_PORT_FEAT_C_SUSPEND);
 			}
 			
 			if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
-				dev_err (&hub->intf->dev,
+				dev_err (hub_dev,
 					"over-current change on port %d\n",
 					i + 1);
-				clear_port_feature(dev,
+				clear_port_feature(hdev,
 					i + 1, USB_PORT_FEAT_C_OVER_CURRENT);
 				hub_power_on(hub);
 			}
 
 			if (portchange & USB_PORT_STAT_C_RESET) {
-				dev_dbg (&hub->intf->dev,
+				dev_dbg (hub_dev,
 					"reset change on port %d\n",
 					i + 1);
-				clear_port_feature(dev,
+				clear_port_feature(hdev,
 					i + 1, USB_PORT_FEAT_C_RESET);
 			}
 		} /* end for i */
 
 		/* deal with hub status changes */
 		if (hub_hub_status(hub, &hubstatus, &hubchange) < 0)
-			dev_err (&hub->intf->dev, "get_hub_status failed\n");
+			dev_err (hub_dev, "get_hub_status failed\n");
 		else {
 			if (hubchange & HUB_CHANGE_LOCAL_POWER) {
-				dev_dbg (&hub->intf->dev, "power change\n");
-				clear_hub_feature(dev, C_HUB_LOCAL_POWER);
+				dev_dbg (hub_dev, "power change\n");
+				clear_hub_feature(hdev, C_HUB_LOCAL_POWER);
 			}
 			if (hubchange & HUB_CHANGE_OVERCURRENT) {
-				dev_dbg (&hub->intf->dev, "overcurrent change\n");
-				wait_ms(500);	/* Cool down */
-				clear_hub_feature(dev, C_HUB_OVER_CURRENT);
+				dev_dbg (hub_dev, "overcurrent change\n");
+				msleep(500);	/* Cool down */
+				clear_hub_feature(hdev, C_HUB_OVER_CURRENT);
                         	hub_power_on(hub);
 			}
 		}
@@ -1244,7 +1540,7 @@
 	spin_unlock_irqrestore(&hub_event_lock, flags);
 }
 
-static int hub_thread(void *__hub)
+static int hub_thread(void *__unused)
 {
 	/*
 	 * This thread doesn't need any user-level access,
@@ -1331,30 +1627,73 @@
 	usb_deregister(&hub_driver);
 } /* usb_hub_cleanup() */
 
+
+static int config_descriptors_changed(struct usb_device *udev)
+{
+	unsigned			index;
+	unsigned			len = 0;
+	struct usb_config_descriptor	*buf;
+
+	for (index = 0; index < udev->descriptor.bNumConfigurations; index++) {
+		if (len < udev->config[index].desc.wTotalLength)
+			len = udev->config[index].desc.wTotalLength;
+	}
+	buf = kmalloc (len, SLAB_KERNEL);
+	if (buf == 0) {
+		dev_err(&udev->dev, "no mem to re-read configs after reset\n");
+		/* assume the worst */
+		return 1;
+	}
+	for (index = 0; index < udev->descriptor.bNumConfigurations; index++) {
+		int length;
+		int old_length = udev->config[index].desc.wTotalLength;
+
+		length = usb_get_descriptor(udev, USB_DT_CONFIG, index, buf,
+				old_length);
+		if (length < old_length) {
+			dev_dbg(&udev->dev, "config index %d, error %d\n",
+					index, length);
+			break;
+		}
+		if (memcmp (buf, udev->rawdescriptors[index], old_length)
+				!= 0) {
+			dev_dbg(&udev->dev, "config index %d changed (#%d)\n",
+				index, buf->bConfigurationValue);
+/* FIXME enable this when we can re-enumerate after reset;
+ * until then DFU-ish drivers need this and other workarounds
+ */
+//			break;
+		}
+	}
+	kfree(buf);
+	return index != udev->descriptor.bNumConfigurations;
+}
+
 /*
- * WARNING - If a driver calls usb_reset_device, you should simulate a
- * disconnect() and probe() for other interfaces you doesn't claim. This
- * is left up to the driver writer right now. This insures other drivers
- * have a chance to re-setup their interface.
+ * WARNING - don't reset any device unless drivers for all of its
+ * interfaces are expecting that reset!  Maybe some driver->reset()
+ * method should eventually help ensure sufficient cooperation.
  *
- * Take a look at proc_resetdevice in devio.c for some sample code to
- * do this.
- * Use this only from within your probe function, otherwise use
- * usb_reset_device() below, which ensure proper locking
+ * This is the same as usb_reset_device() except that the caller
+ * already holds dev->serialize.  For example, it's safe to use
+ * this from a driver probe() routine after downloading new firmware.
  */
-int usb_physical_reset_device(struct usb_device *dev)
+int __usb_reset_device(struct usb_device *udev)
 {
-	struct usb_device *parent = dev->parent;
-	struct usb_device_descriptor *descriptor;
+	struct usb_device *parent = udev->parent;
+	struct usb_device_descriptor descriptor = udev->descriptor;
 	int i, ret, port = -1;
 
-	if (!parent) {
-		err("attempting to reset root hub!");
+	if (udev->maxchild) {
+		/* this requires hub- or hcd-specific logic;
+		 * see hub_reset() and OHCI hc_restart()
+		 */
+		dev_dbg(&udev->dev, "%s for hub!\n", __FUNCTION__);
 		return -EINVAL;
 	}
 
 	for (i = 0; i < parent->maxchild; i++)
-		if (parent->children[i] == dev) {
+		if (parent->children[i] == udev) {
 			port = i;
 			break;
 		}
@@ -1362,114 +1701,69 @@
 	if (port < 0)
 		return -ENOENT;
 
-	descriptor = kmalloc(sizeof *descriptor, GFP_NOIO);
-	if (!descriptor) {
-		return -ENOMEM;
-	}
-
-	down(&usb_address0_sem);
-
-	/* Send a reset to the device */
-	if (hub_port_reset(parent, port, dev, HUB_SHORT_RESET_TIME)) {
-		hub_port_disable(parent, port);
-		up(&usb_address0_sem);
-		kfree(descriptor);
-		return(-ENODEV);
-	}
-
-	/* Reprogram the Address */
-	ret = usb_set_address(dev);
-	if (ret < 0) {
-		err("USB device not accepting new address (error=%d)", ret);
-		hub_port_disable(parent, port);
-		up(&usb_address0_sem);
-		kfree(descriptor);
-		return ret;
-	}
-
-	/* Let the SET_ADDRESS settle */
-	wait_ms(10);
-
-	up(&usb_address0_sem);
-
-	/*
-	 * Now we fetch the configuration descriptors for the device and
-	 * see if anything has changed. If it has, we dump the current
-	 * parsed descriptors and reparse from scratch. Then we leave
-	 * the device alone for the caller to finish setting up.
-	 *
-	 * If nothing changed, we reprogram the configuration and then
-	 * the alternate settings.
-	 */
-
-	ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, descriptor,
-			sizeof(*descriptor));
-	if (ret < 0) {
-		kfree(descriptor);
-		return ret;
-	}
-
-	le16_to_cpus(&descriptor->bcdUSB);
-	le16_to_cpus(&descriptor->idVendor);
-	le16_to_cpus(&descriptor->idProduct);
-	le16_to_cpus(&descriptor->bcdDevice);
-
-	if (memcmp(&dev->descriptor, descriptor, sizeof(*descriptor))) {
-		kfree(descriptor);
-		usb_destroy_configuration(dev);
-
-		/* FIXME Linux doesn't yet handle these "device morphed"
-		 * paths.  DFU variants need this to work ... and they
-		 * include the "config descriptors changed" case this
-		 * doesn't yet detect!
-		 */
-		dev->state = USB_STATE_NOTATTACHED;
-		dev_err(&dev->dev, "device morphed (DFU?), nyet supported\n");
-
-		return -ENODEV;
-	}
-
-	kfree(descriptor);
+	ret = hub_port_init(parent, udev, port);
+	if (ret < 0)
+		goto re_enumerate;
+ 
+	/* Device might have changed firmware (DFU or similar) */
+	if (memcmp(&udev->descriptor, &descriptor, sizeof descriptor)
+			|| config_descriptors_changed (udev)) {
+		dev_info(&udev->dev, "device firmware changed\n");
+		udev->descriptor = descriptor;	/* for disconnect() calls */
+		goto re_enumerate;
+  	}
+  
+	if (!udev->actconfig)
+		return 0;
 
-	ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
+	ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 			USB_REQ_SET_CONFIGURATION, 0,
-			dev->actconfig->desc.bConfigurationValue, 0,
+			udev->actconfig->desc.bConfigurationValue, 0,
 			NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
 	if (ret < 0) {
-		err("failed to set dev %s active configuration (error=%d)",
-			dev->devpath, ret);
-		return ret;
-	}
-	dev->state = USB_STATE_CONFIGURED;
+		dev_err(&udev->dev,
+			"can't restore configuration #%d (error=%d)\n",
+			udev->actconfig->desc.bConfigurationValue, ret);
+		goto re_enumerate;
+  	}
+	udev->state = USB_STATE_CONFIGURED;
 
-	for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
-		struct usb_interface *intf = dev->actconfig->interface[i];
+	for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
+		struct usb_interface *intf = udev->actconfig->interface[i];
 		struct usb_interface_descriptor *desc;
 
+		/* set_interface resets host side toggle and halt status even
+		 * for altsetting zero.  the interface may have no driver.
+		 */
 		desc = &intf->cur_altsetting->desc;
-		ret = usb_set_interface(dev, desc->bInterfaceNumber,
+		ret = usb_set_interface(udev, desc->bInterfaceNumber,
 			desc->bAlternateSetting);
 		if (ret < 0) {
-			err("failed to set active alternate setting "
-				"for dev %s interface %d (error=%d)",
-				dev->devpath, desc->bInterfaceNumber, ret);
-			return ret;
+			dev_err(&udev->dev, "failed to restore interface %d "
+				"altsetting %d (error=%d)\n",
+				desc->bInterfaceNumber,
+				desc->bAlternateSetting,
+				ret);
+			goto re_enumerate;
 		}
 	}
 
 	return 0;
+ 
+re_enumerate:
+	/* FIXME make some task re-enumerate; don't just mark unusable */
+	udev->state = USB_STATE_NOTATTACHED;
+	return -ENODEV;
 }
+EXPORT_SYMBOL(__usb_reset_device);
 
 int usb_reset_device(struct usb_device *udev)
 {
-	struct device *gdev = &udev->dev;
 	int r;
 	
-	down_read(&gdev->bus->subsys.rwsem);
-	r = usb_physical_reset_device(udev);
-	up_read(&gdev->bus->subsys.rwsem);
+	down(&udev->serialize);
+	r = __usb_reset_device(udev);
+	up(&udev->serialize);
 
 	return r;
 }
-
-
diff -Nru a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
--- a/drivers/usb/core/hub.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/usb/core/hub.h	Tue Jun 15 22:20:37 2004
@@ -209,6 +209,8 @@
 	struct semaphore	khubd_sem;
 	struct usb_tt		tt;		/* Transaction Translator */
 
+	u8			power_budget;	/* in 2mA units; or zero */
+
 	unsigned		has_indicators:1;
 	enum hub_led_mode	indicator[USB_MAXCHILDREN];
 	struct work_struct	leds;
diff -Nru a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
--- a/drivers/usb/core/inode.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/core/inode.c	Tue Jun 15 22:20:36 2004
@@ -717,9 +717,6 @@
 	while (!list_empty(&dev->filelist)) {
 		ds = list_entry(dev->filelist.next, struct dev_state, list);
 		list_del_init(&ds->list);
-		down_write(&ds->devsem);
-		ds->dev = NULL;
-		up_write(&ds->devsem);
 		if (ds->discsignr) {
 			sinfo.si_signo = SIGPIPE;
 			sinfo.si_errno = EPIPE;
diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/core/message.c	Tue Jun 15 22:20:38 2004
@@ -796,10 +796,6 @@
 	}
 }
 
-static void release_interface(struct device *dev)
-{
-}
-
 /*
  * usb_disable_device - Disable all the endpoints for a USB device
  * @dev: the device whose endpoints are being disabled
@@ -834,7 +830,15 @@
 			interface = dev->actconfig->interface[i];
 			dev_dbg (&dev->dev, "unregistering interface %s\n",
 				interface->dev.bus_id);
-			device_unregister (&interface->dev);
+			device_del (&interface->dev);
+		}
+
+		/* Now that the interfaces are unbound, nobody should
+		 * try to access them.
+		 */
+		for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
+			put_device (&dev->actconfig->interface[i]->dev);
+			dev->actconfig->interface[i] = NULL;
 		}
 		dev->actconfig = 0;
 		if (dev->state == USB_STATE_CONFIGURED)
@@ -1071,6 +1075,16 @@
 	return 0;
 }
 
+static void release_interface(struct device *dev)
+{
+	struct usb_interface *intf = to_usb_interface(dev);
+	struct usb_interface_cache *intfc =
+			altsetting_to_usb_interface_cache(intf->altsetting);
+
+	kref_put(&intfc->ref);
+	kfree(intf);
+}
+
 /*
  * usb_set_configuration - Makes a particular device setting be current
  * @dev: the device whose configuration is being updated
@@ -1109,19 +1123,19 @@
 {
 	int i, ret;
 	struct usb_host_config *cp = NULL;
-	
+	struct usb_interface **new_interfaces = NULL;
+	int n, nintf;
+
 	/* dev->serialize guards all config changes */
 
-	for (i=0; i<dev->descriptor.bNumConfigurations; i++) {
+	for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
 		if (dev->config[i].desc.bConfigurationValue == configuration) {
 			cp = &dev->config[i];
 			break;
 		}
 	}
-	if ((!cp && configuration != 0)) {
-		ret = -EINVAL;
-		goto out;
-	}
+	if ((!cp && configuration != 0))
+		return -EINVAL;
 
 	/* The USB spec says configuration 0 means unconfigured.
 	 * But if a device includes a configuration numbered 0,
@@ -1130,6 +1144,34 @@
 	if (cp && configuration == 0)
 		dev_warn(&dev->dev, "config 0 descriptor??\n");
 
+	/* Allocate memory for new interfaces before doing anything else,
+	 * so that if we run out then nothing will have changed. */
+	n = nintf = 0;
+	if (cp) {
+		nintf = cp->desc.bNumInterfaces;
+		new_interfaces = kmalloc(nintf * sizeof(*new_interfaces),
+				GFP_KERNEL);
+		if (!new_interfaces) {
+			dev_err(&dev->dev, "Out of memory");
+			return -ENOMEM;
+		}
+
+		for (; n < nintf; ++n) {
+			new_interfaces[n] = kmalloc(
+					sizeof(struct usb_interface),
+					GFP_KERNEL);
+			if (!new_interfaces[n]) {
+				dev_err(&dev->dev, "Out of memory");
+				ret = -ENOMEM;
+free_interfaces:
+				while (--n >= 0)
+					kfree(new_interfaces[n]);
+				kfree(new_interfaces);
+				return ret;
+			}
+		}
+	}
+
 	/* if it's already configured, clear out old state first.
 	 * getting rid of old interfaces means unbinding their drivers.
 	 */
@@ -1139,7 +1181,7 @@
 	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)
-		goto out;
+		goto free_interfaces;
 
 	dev->actconfig = cp;
 	if (!cp)
@@ -1147,14 +1189,21 @@
 	else {
 		dev->state = USB_STATE_CONFIGURED;
 
-		/* re-initialize hc/hcd/usbcore interface/endpoint state.
-		 * this triggers binding of drivers to interfaces; and
-		 * maybe probe() calls will choose different altsettings.
+		/* Initialize the new interface structures and the
+		 * hc/hcd/usbcore interface/endpoint state.
 		 */
-		for (i = 0; i < cp->desc.bNumInterfaces; ++i) {
-			struct usb_interface *intf = cp->interface[i];
+		for (i = 0; i < nintf; ++i) {
+			struct usb_interface_cache *intfc;
+			struct usb_interface *intf;
 			struct usb_host_interface *alt;
 
+			cp->interface[i] = intf = new_interfaces[i];
+			memset(intf, 0, sizeof(*intf));
+			intfc = cp->intf_cache[i];
+			intf->altsetting = intfc->altsetting;
+			intf->num_altsetting = intfc->num_altsetting;
+			kref_get(&intfc->ref);
+
 			alt = usb_altnum_to_altsetting(intf, 0);
 
 			/* No altsetting 0?  We'll assume the first altsetting.
@@ -1178,12 +1227,15 @@
 				 configuration,
 				 alt->desc.bInterfaceNumber);
 		}
+		kfree(new_interfaces);
 
-		/* Now that all interfaces are setup, probe() calls
-		 * may claim() any interface that's not yet bound.
-		 * Many class drivers need that: CDC, audio, video, etc.
+		/* 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
+		 * claim() any interfaces not yet bound.  Many class drivers
+		 * need that: CDC, audio, video, etc.
 		 */
-		for (i = 0; i < cp->desc.bNumInterfaces; ++i) {
+		for (i = 0; i < nintf; ++i) {
 			struct usb_interface *intf = cp->interface[i];
 			struct usb_interface_descriptor *desc;
 
@@ -1200,11 +1252,10 @@
 					ret);
 				continue;
 			}
-			usb_create_driverfs_intf_files (intf);
+			usb_create_sysfs_intf_files (intf);
 		}
 	}
 
-out:
 	return ret;
 }
 
diff -Nru a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/usb/core/sysfs.c	Tue Jun 15 22:20:38 2004
@@ -0,0 +1,229 @@
+/*
+ * drivers/usb/core/sysfs.c
+ *
+ * (C) Copyright 2002 David Brownell
+ * (C) Copyright 2002 Greg Kroah-Hartman
+ * (C) Copyright 2002 IBM Corp.
+ *
+ * All of the sysfs file attributes for usb devices and interfaces.
+ *
+ */
+
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+
+#ifdef CONFIG_USB_DEBUG
+	#define DEBUG
+#else
+	#undef DEBUG
+#endif
+#include <linux/usb.h>
+
+#include "usb.h"
+
+/* Active configuration fields */
+#define usb_actconfig_show(field, multiplier, format_string)		\
+static ssize_t  show_##field (struct device *dev, char *buf)		\
+{									\
+	struct usb_device *udev;					\
+									\
+	udev = to_usb_device (dev);					\
+	if (udev->actconfig)						\
+		return sprintf (buf, format_string,			\
+				udev->actconfig->desc.field * multiplier);	\
+	else								\
+		return 0;						\
+}									\
+
+#define usb_actconfig_attr(field, multiplier, format_string)		\
+usb_actconfig_show(field, multiplier, format_string)			\
+static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
+
+usb_actconfig_attr (bNumInterfaces, 1, "%2d\n")
+usb_actconfig_attr (bmAttributes, 1, "%2x\n")
+usb_actconfig_attr (bMaxPower, 2, "%3dmA\n")
+
+/* configuration value is always present, and r/w */
+usb_actconfig_show(bConfigurationValue, 1, "%u\n");
+
+static ssize_t
+set_bConfigurationValue (struct device *dev, const char *buf, size_t count)
+{
+	struct usb_device	*udev = udev = to_usb_device (dev);
+	int			config, value;
+
+	if (sscanf (buf, "%u", &config) != 1 || config > 255)
+		return -EINVAL;
+	down(&udev->serialize);
+	value = usb_set_configuration (udev, config);
+	up(&udev->serialize);
+	return (value < 0) ? value : count;
+}
+
+static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, 
+		show_bConfigurationValue, set_bConfigurationValue);
+
+/* String fields */
+#define usb_string_attr(name, field)		\
+static ssize_t  show_##name(struct device *dev, char *buf)		\
+{									\
+	struct usb_device *udev;					\
+	int len;							\
+									\
+	udev = to_usb_device (dev);					\
+	len = usb_string(udev, udev->descriptor.field, buf, PAGE_SIZE);	\
+	if (len < 0)							\
+		return 0;						\
+	buf[len] = '\n';						\
+	buf[len+1] = 0;							\
+	return len+1;							\
+}									\
+static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
+
+usb_string_attr(product, iProduct);
+usb_string_attr(manufacturer, iManufacturer);
+usb_string_attr(serial, iSerialNumber);
+
+static ssize_t
+show_speed (struct device *dev, char *buf)
+{
+	struct usb_device *udev;
+	char *speed;
+
+	udev = to_usb_device (dev);
+
+	switch (udev->speed) {
+	case USB_SPEED_LOW:
+		speed = "1.5";
+		break;
+	case USB_SPEED_UNKNOWN:
+	case USB_SPEED_FULL:
+		speed = "12";
+		break;
+	case USB_SPEED_HIGH:
+		speed = "480";
+		break;
+	default:
+		speed = "unknown";
+	}
+	return sprintf (buf, "%s\n", speed);
+}
+static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL);
+
+static ssize_t
+show_devnum (struct device *dev, char *buf)
+{
+	struct usb_device *udev;
+
+	udev = to_usb_device (dev);
+	return sprintf (buf, "%d\n", udev->devnum);
+}
+static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL);
+
+static ssize_t
+show_version (struct device *dev, char *buf)
+{
+	struct usb_device *udev;
+
+	udev = to_usb_device (dev);
+	return sprintf (buf, "%2x.%02x\n", udev->descriptor.bcdUSB >> 8, 
+			udev->descriptor.bcdUSB & 0xff);
+}
+static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
+
+static ssize_t
+show_maxchild (struct device *dev, char *buf)
+{
+	struct usb_device *udev;
+
+	udev = to_usb_device (dev);
+	return sprintf (buf, "%d\n", udev->maxchild);
+}
+static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL);
+
+/* Descriptor fields */
+#define usb_descriptor_attr(field, format_string)			\
+static ssize_t								\
+show_##field (struct device *dev, char *buf)				\
+{									\
+	struct usb_device *udev;					\
+									\
+	udev = to_usb_device (dev);					\
+	return sprintf (buf, format_string, udev->descriptor.field);	\
+}									\
+static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
+
+usb_descriptor_attr (idVendor, "%04x\n")
+usb_descriptor_attr (idProduct, "%04x\n")
+usb_descriptor_attr (bcdDevice, "%04x\n")
+usb_descriptor_attr (bDeviceClass, "%02x\n")
+usb_descriptor_attr (bDeviceSubClass, "%02x\n")
+usb_descriptor_attr (bDeviceProtocol, "%02x\n")
+usb_descriptor_attr (bNumConfigurations, "%d\n")
+
+
+void usb_create_sysfs_dev_files (struct usb_device *udev)
+{
+	struct device *dev = &udev->dev;
+
+	/* current configuration's attributes */
+	device_create_file (dev, &dev_attr_bNumInterfaces);
+	device_create_file (dev, &dev_attr_bConfigurationValue);
+	device_create_file (dev, &dev_attr_bmAttributes);
+	device_create_file (dev, &dev_attr_bMaxPower);
+
+	/* device attributes */
+	device_create_file (dev, &dev_attr_idVendor);
+	device_create_file (dev, &dev_attr_idProduct);
+	device_create_file (dev, &dev_attr_bcdDevice);
+	device_create_file (dev, &dev_attr_bDeviceClass);
+	device_create_file (dev, &dev_attr_bDeviceSubClass);
+	device_create_file (dev, &dev_attr_bDeviceProtocol);
+	device_create_file (dev, &dev_attr_bNumConfigurations);
+
+	/* speed varies depending on how you connect the device */
+	device_create_file (dev, &dev_attr_speed);
+	// FIXME iff there are other speed configs, show how many
+
+	if (udev->descriptor.iManufacturer)
+		device_create_file (dev, &dev_attr_manufacturer);
+	if (udev->descriptor.iProduct)
+		device_create_file (dev, &dev_attr_product);
+	if (udev->descriptor.iSerialNumber)
+		device_create_file (dev, &dev_attr_serial);
+
+	device_create_file (dev, &dev_attr_devnum);
+	device_create_file (dev, &dev_attr_version);
+	device_create_file (dev, &dev_attr_maxchild);
+}
+
+/* Interface fields */
+#define usb_intf_attr(field, format_string)				\
+static ssize_t								\
+show_##field (struct device *dev, char *buf)				\
+{									\
+	struct usb_interface *intf = to_usb_interface (dev);		\
+									\
+	return sprintf (buf, format_string, intf->cur_altsetting->desc.field); \
+}									\
+static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
+
+usb_intf_attr (bInterfaceNumber, "%02x\n")
+usb_intf_attr (bAlternateSetting, "%2d\n")
+usb_intf_attr (bNumEndpoints, "%02x\n")
+usb_intf_attr (bInterfaceClass, "%02x\n")
+usb_intf_attr (bInterfaceSubClass, "%02x\n")
+usb_intf_attr (bInterfaceProtocol, "%02x\n")
+usb_intf_attr (iInterface, "%02x\n")
+
+void usb_create_sysfs_intf_files (struct usb_interface *intf)
+{
+	device_create_file (&intf->dev, &dev_attr_bInterfaceNumber);
+	device_create_file (&intf->dev, &dev_attr_bAlternateSetting);
+	device_create_file (&intf->dev, &dev_attr_bNumEndpoints);
+	device_create_file (&intf->dev, &dev_attr_bInterfaceClass);
+	device_create_file (&intf->dev, &dev_attr_bInterfaceSubClass);
+	device_create_file (&intf->dev, &dev_attr_bInterfaceProtocol);
+	device_create_file (&intf->dev, &dev_attr_iInterface);
+}
diff -Nru a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
--- a/drivers/usb/core/urb.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/core/urb.c	Tue Jun 15 22:20:41 2004
@@ -13,6 +13,14 @@
 #include <linux/usb.h>
 #include "hcd.h"
 
+#define to_urb(d) container_of(d, struct urb, kref)
+
+static void urb_destroy(struct kref *kref)
+{
+	struct urb *urb = to_urb(kref);
+	kfree(urb);
+}
+
 /**
  * usb_init_urb - initializes a urb so that it can be used by a USB driver
  * @urb: pointer to the urb to initialize
@@ -31,7 +39,7 @@
 {
 	if (urb) {
 		memset(urb, 0, sizeof(*urb));
-		urb->count = (atomic_t)ATOMIC_INIT(1);
+		kref_init(&urb->kref, urb_destroy);
 		spin_lock_init(&urb->lock);
 	}
 }
@@ -80,8 +88,7 @@
 void usb_free_urb(struct urb *urb)
 {
 	if (urb)
-		if (atomic_dec_and_test(&urb->count))
-			kfree(urb);
+		kref_put(&urb->kref);
 }
 
 /**
@@ -96,11 +103,9 @@
  */
 struct urb * usb_get_urb(struct urb *urb)
 {
-	if (urb) {
-		atomic_inc(&urb->count);
-		return urb;
-	} else
-		return NULL;
+	if (urb)
+		kref_get(&urb->kref);
+	return urb;
 }
 		
 		
@@ -232,6 +237,8 @@
 	    (dev->state < USB_STATE_DEFAULT) ||
 	    (!dev->bus) || (dev->devnum <= 0))
 		return -ENODEV;
+	if (dev->state == USB_STATE_SUSPENDED)
+		return -EHOSTUNREACH;
 	if (!(op = dev->bus->op) || !op->submit_urb)
 		return -ENODEV;
 
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/core/usb.c	Tue Jun 15 22:20:40 2004
@@ -198,6 +198,9 @@
  * This routine helps device drivers avoid such mistakes.
  * However, you should make sure that you do the right thing with any
  * alternate settings available for this interfaces.
+ *
+ * Don't call this function unless you are bound to one of the interfaces
+ * on this device or you own the dev->serialize semaphore!
  */
 struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum)
 {
@@ -228,6 +231,9 @@
  * it would be incorrect to assume that the first altsetting entry in
  * the array corresponds to altsetting zero.  This routine helps device
  * drivers avoid such mistakes.
+ *
+ * Don't call this function unless you are bound to the intf interface
+ * or you own the device's ->serialize semaphore!
  */
 struct usb_host_interface *usb_altnum_to_altsetting(struct usb_interface *intf,
 		unsigned int altnum)
@@ -992,12 +998,10 @@
 	 */
 	usb_disable_device(dev, 0);
 
-	dev_dbg (&dev->dev, "unregistering device\n");
 	/* Free the device number and remove the /proc/bus/usb entry */
-	if (dev->devnum > 0) {
-		clear_bit(dev->devnum, dev->bus->devmap.devicemap);
-		usbfs_remove_device(dev);
-	}
+	dev_dbg (&dev->dev, "unregistering device\n");
+	usb_release_address(dev);
+	usbfs_remove_device(dev);
 	up(&dev->serialize);
 	device_unregister(&dev->dev);
 }
@@ -1032,24 +1036,23 @@
 	}
 }
 
-
-// hub-only!! ... and only exported for reset/reinit path.
-// otherwise used internally, for usb_new_device()
-int usb_set_address(struct usb_device *dev)
+/**
+ * usb_release_address - deallocate device address (usbcore-internal)
+ * @dev: newly removed device
+ *
+ * Removes and deallocates the address assigned to a device.
+ * Only hub drivers (but not virtual root hub drivers for host
+ * controllers) should ever call this.
+ */
+void usb_release_address(struct usb_device *dev)
 {
-	int retval;
-
-	if (dev->devnum == 0)
-		return -EINVAL;
-	if (dev->state != USB_STATE_DEFAULT && dev->state != USB_STATE_ADDRESS)
-		return -EINVAL;
-	retval = usb_control_msg(dev, usb_snddefctrl(dev), USB_REQ_SET_ADDRESS,
-		0, dev->devnum, 0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
-	if (retval == 0)
-		dev->state = USB_STATE_ADDRESS;
-	return retval;
+	if (dev->devnum > 0) {
+		clear_bit(dev->devnum, dev->bus->devmap.devicemap);
+		dev->devnum = -1;
+	}
 }
 
+
 static inline void usb_show_string(struct usb_device *dev, char *id, int index)
 {
 	char *buf;
@@ -1063,92 +1066,59 @@
 	kfree(buf);
 }
 
+static int usb_choose_configuration(struct usb_device *dev)
+{
+	int c, i;
+
+	c = dev->config[0].desc.bConfigurationValue;
+	if (dev->descriptor.bNumConfigurations != 1) {
+		for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
+			struct usb_interface_descriptor	*desc;
+
+			/* heuristic:  Linux is more likely to have class
+			 * drivers, so avoid vendor-specific interfaces.
+			 */
+			desc = &dev->config[i].intf_cache[0]
+					->altsetting->desc;
+			if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC)
+				continue;
+			/* COMM/2/all is CDC ACM, except 0xff is MSFT RNDIS */
+			if (desc->bInterfaceClass == USB_CLASS_COMM
+					&& desc->bInterfaceSubClass == 2
+					&& desc->bInterfaceProtocol == 0xff)
+				continue;
+			c = dev->config[i].desc.bConfigurationValue;
+			break;
+		}
+		dev_info(&dev->dev,
+			"configuration #%d chosen from %d choices\n",
+			c, dev->descriptor.bNumConfigurations);
+	}
+	return c;
+}
+
 /*
- * By the time we get here, we chose a new device address
- * and is in the default state. We need to identify the thing and
- * get the ball rolling..
+ * usb_new_device - perform initial device setup (usbcore-internal)
+ * @dev: newly addressed device (in ADDRESS state)
  *
- * Returns 0 for success, != 0 for error.
+ * This is called with devices which have been enumerated, but not yet
+ * configured.  The device descriptor is available, but not descriptors
+ * for any device configuration.  The caller owns dev->serialize, and
+ * the device is not visible through sysfs or other filesystem code.
+ *
+ * Returns 0 for success (device is configured and listed, with its
+ * interfaces, in sysfs); else a negative errno value.  On error, one
+ * reference count to the device has been dropped.
  *
  * This call is synchronous, and may not be used in an interrupt context.
  *
  * Only the hub driver should ever call this; root hub registration
  * uses it only indirectly.
  */
-#define NEW_DEVICE_RETRYS	2
-#define SET_ADDRESS_RETRYS	2
 int usb_new_device(struct usb_device *dev)
 {
-	int err = -EINVAL;
-	int i;
-	int j;
-	int config;
-
-	/* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
-	 * it's fixed size except for full speed devices.
-	 */
-	switch (dev->speed) {
-	case USB_SPEED_HIGH:		/* fixed at 64 */
-		i = 64;
-		break;
-	case USB_SPEED_FULL:		/* 8, 16, 32, or 64 */
-		/* to determine the ep0 maxpacket size, read the first 8
-		 * bytes from the device descriptor to get bMaxPacketSize0;
-		 * then correct our initial (small) guess.
-		 */
-		// FALLTHROUGH
-	case USB_SPEED_LOW:		/* fixed at 8 */
-		i = 8;
-		break;
-	default:
-		goto fail;
-	}
-	dev->epmaxpacketin [0] = i;
-	dev->epmaxpacketout[0] = i;
-
-	for (i = 0; i < NEW_DEVICE_RETRYS; ++i) {
-
-		for (j = 0; j < SET_ADDRESS_RETRYS; ++j) {
-			err = usb_set_address(dev);
-			if (err >= 0)
-				break;
-			wait_ms(200);
-		}
-		if (err < 0) {
-			dev_err(&dev->dev,
-				"device not accepting address %d, error %d\n",
-				dev->devnum, err);
-			goto fail;
-		}
-
-		wait_ms(10);	/* Let the SET_ADDRESS settle */
-
-		/* high and low speed devices don't need this... */
-		err = usb_get_device_descriptor(dev, 8);
-		if (err >= 8)
-			break;
-		wait_ms(100);
-	}
-
-	if (err < 8) {
-		dev_err(&dev->dev, "device descriptor read/8, error %d\n", err);
-		goto fail;
-	}
-	if (dev->speed == USB_SPEED_FULL) {
-		usb_disable_endpoint(dev, 0);
-		usb_endpoint_running(dev, 0, 1);
-		usb_endpoint_running(dev, 0, 0);
-		dev->epmaxpacketin [0] = dev->descriptor.bMaxPacketSize0;
-		dev->epmaxpacketout[0] = dev->descriptor.bMaxPacketSize0;
-	}
-
-	/* USB device state == addressed ... still not usable */
-
-	err = usb_get_device_descriptor(dev, sizeof(dev->descriptor));
-	if (err != (signed)sizeof(dev->descriptor)) {
-		dev_err(&dev->dev, "device descriptor read/all, error %d\n", err);
-		goto fail;
-	}
+	int err;
+	int c;
 
 	err = usb_get_configuration(dev);
 	if (err < 0) {
@@ -1170,51 +1140,22 @@
 		usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber);
 #endif
 
-	down(&dev->serialize);
-
 	/* put device-specific files into sysfs */
 	err = device_add (&dev->dev);
 	if (err) {
 		dev_err(&dev->dev, "can't device_add, error %d\n", err);
-		up(&dev->serialize);
 		goto fail;
 	}
-	usb_create_driverfs_dev_files (dev);
+	usb_create_sysfs_dev_files (dev);
 
 	/* choose and set the configuration. that registers the interfaces
 	 * with the driver core, and lets usb device drivers bind to them.
 	 * NOTE:  should interact with hub power budgeting.
 	 */
-	config = dev->config[0].desc.bConfigurationValue;
-	if (dev->descriptor.bNumConfigurations != 1) {
-		for (i = 0; i < dev->descriptor.bNumConfigurations; i++) {
-			struct usb_interface_descriptor	*desc;
-
-			/* heuristic:  Linux is more likely to have class
-			 * drivers, so avoid vendor-specific interfaces.
-			 */
-			desc = &dev->config[i].interface[0]
-					->altsetting->desc;
-			if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC)
-				continue;
-			/* COMM/2/all is CDC ACM, except 0xff is MSFT RNDIS */
-			if (desc->bInterfaceClass == USB_CLASS_COMM
-					&& desc->bInterfaceSubClass == 2
-					&& desc->bInterfaceProtocol == 0xff)
-				continue;
-			config = dev->config[i].desc.bConfigurationValue;
-			break;
-		}
-		dev_info(&dev->dev,
-			"configuration #%d chosen from %d choices\n",
-			config,
-			dev->descriptor.bNumConfigurations);
-	}
-	err = usb_set_configuration(dev, config);
-	up(&dev->serialize);
+	c = usb_choose_configuration(dev);
+	err = usb_set_configuration(dev, c);
 	if (err) {
-		dev_err(&dev->dev, "can't set config #%d, error %d\n",
-			config, err);
+		dev_err(&dev->dev, "can't set config #%d, error %d\n", c, err);
 		device_del(&dev->dev);
 		goto fail;
 	}
@@ -1226,9 +1167,9 @@
 
 	return 0;
 fail:
-	dev->state = USB_STATE_DEFAULT;
-	clear_bit(dev->devnum, dev->bus->devmap.devicemap);
-	dev->devnum = -1;
+	dev->state = USB_STATE_NOTATTACHED;
+	usb_release_address(dev);
+	usb_put_dev(dev);
 	return err;
 }
 
@@ -1577,20 +1518,40 @@
  */
 static int __init usb_init(void)
 {
+	int retval;
 	if (nousb) {
 		pr_info ("%s: USB support disabled\n", usbcore_name);
 		return 0;
 	}
 
-	bus_register(&usb_bus_type);
+	retval = bus_register(&usb_bus_type);
+	if (retval) 
+		goto out;
 	usb_host_init();
-	usb_major_init();
-	usbfs_init();
-	usb_hub_init();
-
-	driver_register(&usb_generic_driver);
-
-	return 0;
+	retval = usb_major_init();
+	if (retval)
+		goto major_init_failed;
+	retval = usbfs_init();
+	if (retval)
+		goto fs_init_failed;
+	retval = usb_hub_init();
+	if (retval)
+		goto hub_init_failed;
+
+	retval = driver_register(&usb_generic_driver);
+	if (!retval)
+		goto out;
+
+	usb_hub_cleanup();
+hub_init_failed:
+	usbfs_cleanup();
+fs_init_failed:
+	usb_major_cleanup();	
+major_init_failed:
+	usb_host_cleanup();
+	bus_unregister(&usb_bus_type);
+out:
+	return retval;
 }
 
 /*
diff -Nru a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
--- a/drivers/usb/core/usb.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/usb/core/usb.h	Tue Jun 15 22:20:37 2004
@@ -1,7 +1,7 @@
 /* Functions local to drivers/usb/core/ */
 
-extern void usb_create_driverfs_dev_files (struct usb_device *dev);
-extern void usb_create_driverfs_intf_files (struct usb_interface *intf);
+extern void usb_create_sysfs_dev_files (struct usb_device *dev);
+extern void usb_create_sysfs_intf_files (struct usb_interface *intf);
 extern int usb_probe_interface (struct device *dev);
 extern int usb_unbind_interface (struct device *dev);
 
diff -Nru a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
--- a/drivers/usb/gadget/Kconfig	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/gadget/Kconfig	Tue Jun 15 22:20:38 2004
@@ -95,6 +95,7 @@
 config USB_PXA2XX_SMALL
 	depends on USB_GADGET_PXA2XX
 	bool
+	default n if USB_ETH_RNDIS
 	default y if USB_ZERO
 	default y if USB_ETH
 	default y if USB_G_SERIAL
diff -Nru a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
--- a/drivers/usb/gadget/dummy_hcd.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/gadget/dummy_hcd.c	Tue Jun 15 22:20:36 2004
@@ -144,6 +144,7 @@
 	struct usb_gadget_driver	*driver;
 	struct dummy_request		fifo_req;
 	u8				fifo_buf [FIFO_SIZE];
+	u16				devstatus;
 
 	struct hcd_dev			*hdev;
 
@@ -156,6 +157,8 @@
 	u32				port_status;
 	int				started;
 	struct completion		released;
+	unsigned			resuming:1;
+	unsigned long			re_timeout;
 };
 
 static struct dummy	*the_controller;
@@ -556,8 +559,37 @@
 	return tv.tv_usec / 1000;
 }
 
+static int dummy_wakeup (struct usb_gadget *_gadget)
+{
+	struct dummy	*dum;
+
+	dum = container_of (_gadget, struct dummy, gadget);
+	if ((dum->devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) == 0
+			|| !(dum->port_status & (1 << USB_PORT_FEAT_SUSPEND)))
+		return -EINVAL;
+
+	/* hub notices our request, issues downstream resume, etc */
+	dum->resuming = 1;
+	dum->port_status |= (1 << USB_PORT_FEAT_C_SUSPEND);
+	return 0;
+}
+
+static int dummy_set_selfpowered (struct usb_gadget *_gadget, int value)
+{
+	struct dummy	*dum;
+
+	dum = container_of (_gadget, struct dummy, gadget);
+	if (value)
+		dum->devstatus |= (1 << USB_DEVICE_SELF_POWERED);
+	else
+		dum->devstatus &= ~(1 << USB_DEVICE_SELF_POWERED);
+	return 0;
+}
+
 static const struct usb_gadget_ops dummy_ops = {
 	.get_frame	= dummy_g_get_frame,
+	.wakeup		= dummy_wakeup,
+	.set_selfpowered = dummy_set_selfpowered,
 };
 
 /*-------------------------------------------------------------------------*/
@@ -653,6 +685,9 @@
 	dum->gadget.ops = &dummy_ops;
 	dum->gadget.is_dualspeed = 1;
 
+	dum->devstatus = 0;
+	dum->resuming = 0;
+
 	INIT_LIST_HEAD (&dum->gadget.ep_list);
 	for (i = 0; i < DUMMY_ENDPOINTS; i++) {
 		struct dummy_ep	*ep = &dum->ep [i];
@@ -1130,8 +1165,19 @@
 				break;
 			case USB_REQ_SET_FEATURE:
 				if (setup.bRequestType == Dev_Request) {
-					// remote wakeup, and (hs) test mode
-					value = -EOPNOTSUPP;
+					value = 0;
+					switch (setup.wValue) {
+					case USB_DEVICE_REMOTE_WAKEUP:
+						break;
+					default:
+						value = -EOPNOTSUPP;
+					}
+					if (value == 0) {
+						dum->devstatus |=
+							(1 << setup.wValue);
+						maybe_set_status (urb, 0);
+					}
+
 				} else if (setup.bRequestType == Ep_Request) {
 					// endpoint halt
 					ep2 = find_endpoint (dum,
@@ -1147,9 +1193,17 @@
 				break;
 			case USB_REQ_CLEAR_FEATURE:
 				if (setup.bRequestType == Dev_Request) {
-					// remote wakeup
-					value = 0;
-					maybe_set_status (urb, 0);
+					switch (setup.wValue) {
+					case USB_DEVICE_REMOTE_WAKEUP:
+						dum->devstatus &= ~(1 <<
+							USB_DEVICE_REMOTE_WAKEUP);
+						value = 0;
+						maybe_set_status (urb, 0);
+						break;
+					default:
+						value = -EOPNOTSUPP;
+						break;
+					}
 				} else if (setup.bRequestType == Ep_Request) {
 					// endpoint halt
 					ep2 = find_endpoint (dum,
@@ -1185,6 +1239,10 @@
 		break;
 	}
 	buf [0] = ep2->halted;
+						} else if (setup.bRequestType ==
+								Dev_InRequest) {
+							buf [0] = (u8)
+								dum->devstatus;
 						} else
 							buf [0] = 0;
 					}
@@ -1338,8 +1396,21 @@
 	case ClearHubFeature:
 		break;
 	case ClearPortFeature:
-		// FIXME won't some of these need special handling?
-		dum->port_status &= ~(1 << wValue);
+		switch (wValue) {
+		case USB_PORT_FEAT_SUSPEND:
+			/* 20msec resume signaling */
+			dum->resuming = 1;
+			dum->re_timeout = jiffies + ((HZ * 20)/1000);
+			break;
+		case USB_PORT_FEAT_POWER:
+			dum->port_status = 0;
+			dum->address = 0;
+			dum->hdev = 0;
+			dum->resuming = 0;
+			break;
+		default:
+			dum->port_status &= ~(1 << wValue);
+		}
 		break;
 	case GetHubDescriptor:
 		hub_descriptor ((struct usb_hub_descriptor *) buf);
@@ -1350,33 +1421,28 @@
 	case GetPortStatus:
 		if (wIndex != 1)
 			retval = -EPIPE;
-		((u16 *) buf)[0] = cpu_to_le16 (dum->port_status);
-		((u16 *) buf)[1] = cpu_to_le16 (dum->port_status >> 16);
-		break;
-	case SetHubFeature:
-		retval = -EPIPE;
-		break;
-	case SetPortFeature:
-		if (wValue == USB_PORT_FEAT_RESET) {
-			/* if it's already running, disconnect first */
-			if (dum->port_status & USB_PORT_STAT_ENABLE) {
-				dum->port_status &= ~(USB_PORT_STAT_ENABLE
-						| USB_PORT_STAT_LOW_SPEED
-						| USB_PORT_STAT_HIGH_SPEED);
-				if (dum->driver) {
-					dev_dbg (hardware, "disconnect\n");
-					stop_activity (dum, dum->driver);
-				}
 
-				/* FIXME test that code path! */
-			} else
-				dum->port_status |=
-					(1 << USB_PORT_FEAT_C_ENABLE);
-
-			dum->port_status |= USB_PORT_STAT_ENABLE |
-				  (1 << USB_PORT_FEAT_C_RESET);
+		/* whoever resets or resumes must GetPortStatus to
+		 * complete it!!
+		 */
+		if (dum->resuming && time_after (jiffies, dum->re_timeout)) {
+			dum->port_status |= (1 << USB_PORT_FEAT_C_SUSPEND);
+			dum->port_status &= ~(1 << USB_PORT_FEAT_SUSPEND);
+			dum->resuming = 0;
+			dum->re_timeout = 0;
+			if (dum->driver->resume) {
+				spin_unlock (&dum->lock);
+				dum->driver->resume (&dum->gadget);
+				spin_lock (&dum->lock);
+			}
+		}
+		if ((dum->port_status & (1 << USB_PORT_FEAT_RESET)) != 0
+				&& time_after (jiffies, dum->re_timeout)) {
+			dum->port_status |= (1 << USB_PORT_FEAT_C_RESET);
+			dum->port_status &= ~(1 << USB_PORT_FEAT_RESET);
+			dum->re_timeout = 0;
 			if (dum->driver) {
-
+				dum->port_status |= USB_PORT_STAT_ENABLE;
 				/* give it the best speed we agree on */
 				dum->gadget.speed = dum->driver->speed;
 				dum->gadget.ep0->maxpacket = 64;
@@ -1395,8 +1461,42 @@
 					break;
 				}
 			}
-		} else
+		}
+		((u16 *) buf)[0] = cpu_to_le16 (dum->port_status);
+		((u16 *) buf)[1] = cpu_to_le16 (dum->port_status >> 16);
+		break;
+	case SetHubFeature:
+		retval = -EPIPE;
+		break;
+	case SetPortFeature:
+		switch (wValue) {
+		case USB_PORT_FEAT_SUSPEND:
+			dum->port_status |= (1 << USB_PORT_FEAT_SUSPEND);
+			if (dum->driver->suspend) {
+				spin_unlock (&dum->lock);
+				dum->driver->suspend (&dum->gadget);
+				spin_lock (&dum->lock);
+			}
+			break;
+		case USB_PORT_FEAT_RESET:
+			/* if it's already running, disconnect first */
+			if (dum->port_status & USB_PORT_STAT_ENABLE) {
+				dum->port_status &= ~(USB_PORT_STAT_ENABLE
+						| USB_PORT_STAT_LOW_SPEED
+						| USB_PORT_STAT_HIGH_SPEED);
+				if (dum->driver) {
+					dev_dbg (hardware, "disconnect\n");
+					stop_activity (dum, dum->driver);
+				}
+
+				/* FIXME test that code path! */
+			}
+			/* 50msec reset signaling */
+			dum->re_timeout = jiffies + ((HZ * 50)/1000);
+			/* FALLTHROUGH */
+		default:
 			dum->port_status |= (1 << wValue);
+		}
 		break;
 
 	default:
diff -Nru a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
--- a/drivers/usb/gadget/epautoconf.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/usb/gadget/epautoconf.c	Tue Jun 15 22:21:05 2004
@@ -96,7 +96,8 @@
 				/* for now, avoid PXA "interrupt-in";
 				 * it's documented as never using DATA1.
 				 */
-				if (gadget_is_pxa (gadget))
+				if (gadget_is_pxa (gadget)
+						&& 'i' == tmp [1])
 					return 0;
 				break;
 			case USB_ENDPOINT_XFER_BULK:
diff -Nru a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
--- a/drivers/usb/gadget/ether.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/usb/gadget/ether.c	Tue Jun 15 22:21:04 2004
@@ -40,6 +40,7 @@
 #include <linux/version.h>
 #include <linux/device.h>
 #include <linux/moduleparam.h>
+#include <linux/ctype.h>
 
 #include <asm/byteorder.h>
 #include <asm/io.h>
@@ -117,6 +118,7 @@
 	unsigned		zlp:1;
 	unsigned		cdc:1;
 	unsigned		rndis:1;
+	u16			cdc_filter;
 	unsigned long		todo;
 #define	WORK_RX_MEMORY		0
 	int			rndis_config;
@@ -192,6 +194,16 @@
 module_param(iProduct, charp, S_IRUGO);
 MODULE_PARM_DESC(iProduct, "USB Product string");
 
+/* initial value, changed by "ifconfig usb0 hw ether xx:xx:xx:xx:xx:xx" */
+static char *__initdata dev_addr;
+module_param(dev_addr, charp, S_IRUGO);
+MODULE_PARM_DESC(iProduct, "Device Ethernet Address");
+
+/* this address is invisible to ifconfig */
+static char *__initdata host_addr;
+module_param(host_addr, charp, S_IRUGO);
+MODULE_PARM_DESC(host_addr, "Host Ethernet Address");
+
 
 /*-------------------------------------------------------------------------*/
 
@@ -1139,6 +1151,9 @@
 	}
 	eth_reset_config (dev);
 
+	/* default:  pass all packets, no multicast filtering */
+	dev->cdc_filter = 0x000f;
+
 	switch (number) {
 	case DEV_CONFIG_VALUE:
 		dev->rndis = 0;
@@ -1311,9 +1326,20 @@
  * section 3.6.2.1 table 4 has ACM requests; RNDIS requires the
  * encapsulated command mechanism.
  */
-#define CDC_SEND_ENCAPSULATED_COMMAND	0x00	/* optional */
-#define CDC_GET_ENCAPSULATED_RESPONSE	0x01	/* optional */
-#define CDC_SET_ETHERNET_PACKET_FILTER	0x43	/* required */
+#define CDC_SEND_ENCAPSULATED_COMMAND		0x00	/* optional */
+#define CDC_GET_ENCAPSULATED_RESPONSE		0x01	/* optional */
+#define CDC_SET_ETHERNET_MULTICAST_FILTERS	0x40	/* optional */
+#define CDC_SET_ETHERNET_PM_PATTERN_FILTER	0x41	/* optional */
+#define CDC_GET_ETHERNET_PM_PATTERN_FILTER	0x42	/* optional */
+#define CDC_SET_ETHERNET_PACKET_FILTER		0x43	/* required */
+#define CDC_GET_ETHERNET_STATISTIC		0x44	/* optional */
+
+/* table 62; bits in cdc_filter */
+#define	CDC_PACKET_TYPE_PROMISCUOUS		(1 << 0)
+#define	CDC_PACKET_TYPE_ALL_MULTICAST		(1 << 1) /* no filter */
+#define	CDC_PACKET_TYPE_DIRECTED		(1 << 2)
+#define	CDC_PACKET_TYPE_BROADCAST		(1 << 3)
+#define	CDC_PACKET_TYPE_MULTICAST		(1 << 4) /* filtered */
 
 #ifdef CONFIG_USB_ETH_RNDIS
 
@@ -1513,8 +1539,9 @@
 		DEBUG (dev, "NOP packet filter %04x\n", ctrl->wValue);
 		/* NOTE: table 62 has 5 filter bits to reduce traffic,
 		 * and we "must" support multicast and promiscuous.
-		 * this NOP implements a bad filter...
+		 * this NOP implements a bad filter (always promisc)
 		 */
+		dev->cdc_filter = ctrl->wValue;
 		value = 0;
 		break;
 #endif /* DEV_CONFIG_CDC */
@@ -1624,12 +1651,12 @@
 	return &((struct eth_dev *) net->priv)->stats;
 }
 
-static int eth_ethtool_ioctl (struct net_device *net, void *useraddr)
+static int eth_ethtool_ioctl (struct net_device *net, void __user *useraddr)
 {
 	struct eth_dev	*dev = (struct eth_dev *) net->priv;
 	u32		cmd;
 
-	if (get_user (cmd, (u32 *)useraddr))
+	if (get_user (cmd, (u32 __user *)useraddr))
 		return -EFAULT;
 	switch (cmd) {
 
@@ -1667,7 +1694,7 @@
 {
 	switch (cmd) {
 	case SIOCETHTOOL:
-		return eth_ethtool_ioctl (net, (void *)rq->ifr_data);
+		return eth_ethtool_ioctl(net, rq->ifr_data);
 	default:
 		return -EOPNOTSUPP;
 	}
@@ -1942,6 +1969,11 @@
 	struct usb_request	*req = 0;
 	unsigned long		flags;
 
+	/* FIXME check dev->cdc_filter to decide whether to send this,
+	 * instead of acting as if CDC_PACKET_TYPE_PROMISCUOUS were
+	 * always set.  RNDIS has the same kind of outgoing filter.
+	 */
+
 	spin_lock_irqsave (&dev->lock, flags);
 	req = container_of (dev->tx_reqs.next, struct usb_request, list);
 	list_del (&req->list);
@@ -2178,6 +2210,36 @@
 	set_gadget_data (gadget, 0);
 }
 
+static u8 __init nibble (unsigned char c)
+{
+	if (likely (isdigit (c)))
+		return c - '0';
+	c = toupper (c);
+	if (likely (isxdigit (c)))
+		return 10 + c - 'A';
+	return 0;
+}
+
+static void __init get_ether_addr (const char *str, u8 *dev_addr)
+{
+	if (str) {
+		unsigned	i;
+
+		for (i = 0; i < 6; i++) {
+			unsigned char num;
+
+			if((*str == '.') || (*str == ':'))
+				str++;
+			num = nibble(*str++) << 4;
+			num |= (nibble(*str++));
+			dev_addr [i] = num;
+		}
+		if (is_valid_ether_addr (dev_addr))
+			return;
+	}
+	random_ether_addr(dev_addr);
+}
+
 static int __init
 eth_bind (struct usb_gadget *gadget)
 {
@@ -2372,21 +2434,13 @@
 	dev->cdc = cdc;
 	dev->zlp = zlp;
 
-	/* FIXME make these addresses configurable with module params.
-	 * also the manufacturer and product strings.
-	 */
-
-	/* one random address for the gadget device ... both of these could
-	 * reasonably come from an id prom or a module parameter.
-	 */
-	random_ether_addr(net->dev_addr);
-
-	/* ... another address for the host, on the other end of the
-	 * link, gets exported through CDC (see CDC spec table 41)
-	 * and RNDIS.
+	/* Module params for these addresses should come from ID proms.
+	 * The host side address is used with CDC and RNDIS, and commonly
+	 * end ups in a persistent config database.
 	 */
+	get_ether_addr(dev_addr, net->dev_addr);
 	if (cdc || rndis) {
-		random_ether_addr(dev->host_mac);
+		get_ether_addr(host_addr, dev->host_mac);
 #ifdef	DEV_CONFIG_CDC
 		snprintf (ethaddr, sizeof ethaddr, "%02X%02X%02X%02X%02X%02X",
 			dev->host_mac [0], dev->host_mac [1],
diff -Nru a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
--- a/drivers/usb/gadget/file_storage.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/usb/gadget/file_storage.c	Tue Jun 15 22:21:03 2004
@@ -2054,7 +2054,7 @@
 	buf[0] = 0x80 | 0x70;			// Valid, current error
 	buf[2] = SK(sd);
 	put_be32(&buf[3], sdinfo);		// Sense information
-	buf[7] = 18 - 7;			// Additional sense length
+	buf[7] = 18 - 8;			// Additional sense length
 	buf[12] = ASC(sd);
 	buf[13] = ASCQ(sd);
 	return 18;
diff -Nru a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h
--- a/drivers/usb/gadget/gadget_chips.h	Tue Jun 15 22:20:35 2004
+++ b/drivers/usb/gadget/gadget_chips.h	Tue Jun 15 22:20:35 2004
@@ -20,7 +20,7 @@
 #define	gadget_is_dummy(g)	0
 #endif
 
-#ifdef CONFIG_USB_GADGET_PXA
+#ifdef CONFIG_USB_GADGET_PXA2XX
 #define	gadget_is_pxa(g)	!strcmp("pxa2xx_udc", (g)->name)
 #else
 #define	gadget_is_pxa(g)	0
diff -Nru a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
--- a/drivers/usb/gadget/pxa2xx_udc.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/usb/gadget/pxa2xx_udc.c	Tue Jun 15 22:20:42 2004
@@ -51,6 +51,7 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/system.h>
+#include <asm/mach-types.h>
 #include <asm/unaligned.h>
 #include <asm/hardware.h>
 
diff -Nru a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
--- a/drivers/usb/gadget/rndis.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/gadget/rndis.c	Tue Jun 15 22:20:36 2004
@@ -22,6 +22,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/version.h>
@@ -51,7 +52,7 @@
 #define DEBUG if (rndis_debug) printk 
 static int rndis_debug = 0;
 
-MODULE_PARM (rndis_debug, "i");
+module_param (rndis_debug, bool, 0);
 MODULE_PARM_DESC (rndis_debug, "enable debugging");
 
 #else
@@ -78,44 +79,6 @@
 
 static rndis_resp_t *rndis_add_response (int configNr, u32 length);
 
-/* helper functions */
-static u32 devFlags2currentFilter (struct net_device *dev)
-{
-	u32 filter = 0;
-	
-	if (!dev) return 0;
-	
-	if (dev->flags & IFF_MULTICAST) 
-	    filter |= NDIS_PACKET_TYPE_MULTICAST;
-	if (dev->flags & IFF_BROADCAST)
-	    filter |= NDIS_PACKET_TYPE_BROADCAST;
-	if (dev->flags & IFF_ALLMULTI)
-	    filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
-	if (dev->flags & IFF_PROMISC)
-	    filter |= NDIS_PACKET_TYPE_PROMISCUOUS;
-	
-	return filter;
-}
-
-static void currentFilter2devFlags (u32 currentFilter, struct net_device *dev)
-{
-	/* FIXME the filter is supposed to control what gets
-	 * forwarded from gadget to host; but dev->flags controls
-	 * reporting from host to gadget ...
-	 */
-#if 0
-	if (!dev) return;
-	if (currentFilter & NDIS_PACKET_TYPE_MULTICAST)
-	    dev->flags |= IFF_MULTICAST;
-	if (currentFilter & NDIS_PACKET_TYPE_BROADCAST)
-	    dev->flags |= IFF_BROADCAST;
-	if (currentFilter & NDIS_PACKET_TYPE_ALL_MULTICAST)
-	    dev->flags |= IFF_ALLMULTI;
-	if (currentFilter & NDIS_PACKET_TYPE_PROMISCUOUS)
-	    dev->flags |= IFF_PROMISC;
-#endif
-}
-
 /* FIXME OMITTED OIDs, that RNDIS-on-USB "must" support, include
  *  - power management (OID_PNP_CAPABILITIES, ...)
  *  - network wakeup (OID_PNP_ENABLE_WAKE_UP, ...)
@@ -252,13 +215,12 @@
 			rndis_per_dev_params [configNr].vendorDescr, length);
 		retval = 0;
 		break;
-		
+
 	/* mandatory */
 	case OID_GEN_CURRENT_PACKET_FILTER:
 		DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __FUNCTION__);
 		length = 4;
-		*((u32 *) resp + 6) = devFlags2currentFilter (
-					rndis_per_dev_params [configNr].dev);
+		*((u32 *) resp + 6) = rndis_per_dev_params[configNr].filter;
 		retval = 0;
 		break;
 		
@@ -767,16 +729,24 @@
 
 	switch (OID) {
 	case OID_GEN_CURRENT_PACKET_FILTER:
-		DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER\n", __FUNCTION__);
 		params = &rndis_per_dev_params [configNr];
-		currentFilter2devFlags(cp[28], params->dev);
 		retval = 0;
 
+		/* FIXME use this NDIS_PACKET_TYPE_* bitflags to
+		 * filter packets in hard_start_xmit()
+		 * NDIS_PACKET_TYPE_x == CDC_PACKET_TYPE_x for x in:
+		 *	PROMISCUOUS, DIRECTED,
+		 *	MULTICAST, ALL_MULTICAST, BROADCAST
+		 */
+		params->filter = *(u32 *)buf;
+		DEBUG("%s: OID_GEN_CURRENT_PACKET_FILTER %08x\n",
+			__FUNCTION__, params->filter);
+
 		/* this call has a significant side effect:  it's
 		 * what makes the packet flow start and stop, like
 		 * activating the CDC Ethernet altsetting.
 		 */
-		if (cp[28]) {
+		if (params->filter) {
 			params->state = RNDIS_DATA_INITIALIZED;
 			netif_carrier_on(params->dev);
 			if (netif_running(params->dev))
diff -Nru a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h
--- a/drivers/usb/gadget/rndis.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/gadget/rndis.h	Tue Jun 15 22:20:38 2004
@@ -277,6 +277,7 @@
 	u8			confignr;
 	int			used;
 	enum rndis_state	state;
+	u32			filter;
 	u32			medium;
 	u32			speed;
 	u32			media_state;
diff -Nru a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
--- a/drivers/usb/gadget/serial.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/gadget/serial.c	Tue Jun 15 22:20:43 2004
@@ -33,7 +33,6 @@
 #include <linux/uts.h>
 #include <linux/version.h>
 #include <linux/wait.h>
-#include <linux/list.h>
 #include <linux/proc_fs.h>
 #include <linux/device.h>
 #include <linux/tty.h>
@@ -155,9 +154,8 @@
 
 #define GS_CLOSE_TIMEOUT		15
 
-/* debug macro */
+/* debug settings */
 #if G_SERIAL_DEBUG
-
 static int debug = G_SERIAL_DEBUG;
 
 #define gs_debug(format, arg...) \
@@ -595,8 +593,10 @@
 MODULE_AUTHOR("Al Borchers");
 MODULE_LICENSE("GPL");
 
+#if G_SERIAL_DEBUG
 MODULE_PARM(debug, "i");
 MODULE_PARM_DESC(debug, "Enable debugging, 0=off, 1=on");
+#endif
 
 MODULE_PARM(read_q_size, "i");
 MODULE_PARM_DESC(read_q_size, "Read request queue size, default=32");
diff -Nru a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
--- a/drivers/usb/gadget/zero.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/usb/gadget/zero.c	Tue Jun 15 22:20:39 2004
@@ -130,6 +130,9 @@
 	 */
 	u8			config;
 	struct usb_ep		*in_ep, *out_ep;
+
+	/* autoresume timer */
+	struct timer_list	resume;
 };
 
 #define xprintk(d,level,fmt,args...) \
@@ -167,6 +170,12 @@
 module_param (qlen, uint, S_IRUGO|S_IWUSR);
 module_param (pattern, uint, S_IRUGO|S_IWUSR);
 
+/*
+ * if it's nonzero, autoresume says how many seconds to wait
+ * before trying to wake up the host after suspend.
+ */
+static unsigned autoresume = 0;
+module_param (autoresume, uint, 0);
 
 /*
  * Normally the "loopback" configuration is second (index 1) so
@@ -224,7 +233,7 @@
 	.bNumConfigurations =	2,
 };
 
-static const struct usb_config_descriptor
+static struct usb_config_descriptor
 source_sink_config = {
 	.bLength =		sizeof source_sink_config,
 	.bDescriptorType =	USB_DT_CONFIG,
@@ -237,7 +246,7 @@
 	.bMaxPower =		1,	/* self-powered */
 };
 
-static const struct usb_config_descriptor
+static struct usb_config_descriptor
 loopback_config = {
 	.bLength =		sizeof loopback_config,
 	.bDescriptorType =	USB_DT_CONFIG,
@@ -1060,6 +1069,19 @@
 	 */
 }
 
+static void
+zero_autoresume (unsigned long _dev)
+{
+	struct zero_dev	*dev = (struct zero_dev *) _dev;
+	int		status;
+
+	/* normally the host would be woken up for something
+	 * more significant than just a timer firing...
+	 */
+	status = usb_gadget_wakeup (dev->gadget);
+	DBG (dev, "wakeup --> %d\n", status);
+}
+
 /*-------------------------------------------------------------------------*/
 
 static void
@@ -1072,6 +1094,7 @@
 	/* we've already been disconnected ... no i/o is active */
 	if (dev->req)
 		free_ep_req (gadget->ep0, dev->req);
+	del_timer_sync (&dev->resume);
 	kfree (dev);
 	set_gadget_data (gadget, 0);
 }
@@ -1176,6 +1199,14 @@
 
 	usb_gadget_set_selfpowered (gadget);
 
+	init_timer (&dev->resume);
+	dev->resume.function = zero_autoresume;
+	dev->resume.data = (unsigned long) dev;
+	if (autoresume) {
+		source_sink_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
+		loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
+	}
+
 	gadget->ep0->driver_data = dev;
 
 	INFO (dev, "%s, version: " DRIVER_VERSION "\n", longname);
@@ -1195,6 +1226,33 @@
 
 /*-------------------------------------------------------------------------*/
 
+static void
+zero_suspend (struct usb_gadget *gadget)
+{
+	struct zero_dev		*dev = get_gadget_data (gadget);
+
+	if (gadget->speed == USB_SPEED_UNKNOWN)
+		return;
+
+	if (autoresume) {
+		mod_timer (&dev->resume, jiffies + (HZ * autoresume));
+		DBG (dev, "suspend, wakeup in %d seconds\n", autoresume);
+	} else
+		DBG (dev, "suspend\n");
+}
+
+static void
+zero_resume (struct usb_gadget *gadget)
+{
+	struct zero_dev		*dev = get_gadget_data (gadget);
+
+	DBG (dev, "resume\n");
+	del_timer (&dev->resume);
+}
+
+
+/*-------------------------------------------------------------------------*/
+
 static struct usb_gadget_driver zero_driver = {
 #ifdef CONFIG_USB_GADGET_DUALSPEED
 	.speed		= USB_SPEED_HIGH,
@@ -1207,6 +1265,9 @@
 
 	.setup		= zero_setup,
 	.disconnect	= zero_disconnect,
+
+	.suspend	= zero_suspend,
+	.resume		= zero_resume,
 
 	.driver 	= {
 		.name		= (char *) shortname,
diff -Nru a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
--- a/drivers/usb/host/ehci-dbg.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/host/ehci-dbg.c	Tue Jun 15 22:20:43 2004
@@ -170,6 +170,20 @@
 		itd->index[6], itd->index[7]);
 }
 
+static void __attribute__((__unused__))
+dbg_sitd (const char *label, struct ehci_hcd *ehci, struct ehci_sitd *sitd) 
+{
+	ehci_dbg (ehci, "%s [%d] sitd %p, next %08x, urb %p\n",
+		label, sitd->frame, sitd, le32_to_cpu(sitd->hw_next), sitd->urb);
+	ehci_dbg (ehci,
+		"  addr %08x sched %04x result %08x buf %08x %08x\n", 
+		le32_to_cpu(sitd->hw_fullspeed_ep),
+		le32_to_cpu(sitd->hw_uframe),
+		le32_to_cpu(sitd->hw_results),
+		le32_to_cpu(sitd->hw_buf [0]),
+		le32_to_cpu(sitd->hw_buf [1]));
+}
+
 static int __attribute__((__unused__))
 dbg_status_buf (char *buf, unsigned len, char *label, u32 status)
 {
@@ -625,11 +639,20 @@
 
 	spin_lock_irqsave (&ehci->lock, flags);
 
+	if (bus->controller->power.power_state) {
+		size = scnprintf (next, size,
+			"bus %s, device %s (driver " DRIVER_VERSION ")\n"
+			"SUSPENDED (no register access)\n",
+			hcd->self.controller->bus->name,
+			hcd->self.controller->bus_id);
+		goto done;
+	}
+
 	/* Capability Registers */
 	i = HC_VERSION(readl (&ehci->caps->hc_capbase));
 	temp = scnprintf (next, size,
-		"bus %s device %s\n"
-		"EHCI %x.%02x, hcd state %d (driver " DRIVER_VERSION ")\n",
+		"bus %s, device %s (driver " DRIVER_VERSION ")\n"
+		"EHCI %x.%02x, hcd state %d\n",
 		hcd->self.controller->bus->name,
 		hcd->self.controller->bus_id,
 		i >> 8, i & 0x0ff, ehci->hcd.state);
@@ -672,7 +695,7 @@
 	next += temp;
 
 	for (i = 0; i < HCS_N_PORTS (ehci->hcs_params); i++) {
-		temp = dbg_port_buf (scratch, sizeof scratch, label, i,
+		temp = dbg_port_buf (scratch, sizeof scratch, label, i + 1,
 				readl (&ehci->regs->port_status [i]));
 		temp = scnprintf (next, size, fmt, temp, scratch);
 		size -= temp;
@@ -701,6 +724,7 @@
 	next += temp;
 #endif
 
+done:
 	spin_unlock_irqrestore (&ehci->lock, flags);
 
 	return PAGE_SIZE - size;
diff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/usb/host/ehci-hcd.c	Tue Jun 15 22:20:42 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 by David Brownell
+ * Copyright (c) 2000-2004 by David Brownell
  * 
  * 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
@@ -69,6 +69,7 @@
  *
  * HISTORY:
  *
+ * 2004-05-10 Root hub and PCI suspend/resume support; remote wakeup. (db)
  * 2004-02-24 Replace pci_* with generic dma_* API calls (dsaxena@plexity.net)
  * 2003-12-29 Rewritten high speed iso transfer support (by Michal Sojka,
  *	<sojkam@centrum.cz>, updates by DB).
@@ -96,7 +97,7 @@
  * 2001-June	Works with usb-storage and NEC EHCI on 2.4
  */
 
-#define DRIVER_VERSION "2003-Dec-29"
+#define DRIVER_VERSION "2004-May-10"
 #define DRIVER_AUTHOR "David Brownell"
 #define DRIVER_DESC "USB 2.0 'Enhanced' Host Controller (EHCI) Driver"
 
@@ -128,7 +129,7 @@
 module_param (log2_irq_thresh, int, S_IRUGO);
 MODULE_PARM_DESC (log2_irq_thresh, "log2 IRQ latency, 1-64 microframes");
 
-#define	INTR_MASK (STS_IAA | STS_FATAL | STS_ERR | STS_INT)
+#define	INTR_MASK (STS_IAA | STS_FATAL | STS_PCD | STS_ERR | STS_INT)
 
 /*-------------------------------------------------------------------------*/
 
@@ -201,6 +202,7 @@
 	dbg_cmd (ehci, "reset", command);
 	writel (command, &ehci->regs->command);
 	ehci->hcd.state = USB_STATE_HALT;
+	ehci->next_statechange = jiffies;
 	return handshake (&ehci->regs->command, CMD_RESET, 0, 250 * 1000);
 }
 
@@ -241,6 +243,8 @@
 
 /*-------------------------------------------------------------------------*/
 
+static void ehci_work(struct ehci_hcd *ehci, struct pt_regs *regs);
+
 #include "ehci-hub.c"
 #include "ehci-mem.c"
 #include "ehci-q.c"
@@ -248,8 +252,6 @@
 
 /*-------------------------------------------------------------------------*/
 
-static void ehci_work(struct ehci_hcd *ehci, struct pt_regs *regs);
-
 static void ehci_watchdog (unsigned long param)
 {
 	struct ehci_hcd		*ehci = (struct ehci_hcd *) param;
@@ -295,7 +297,7 @@
 
 		/* and wait a while for it to happen */
 		do {
-			wait_ms (10);
+			msleep(10);
 			msec -= 10;
 			pci_read_config_dword (to_pci_dev(ehci->hcd.self.controller), where, &cap);
 		} while ((cap & (1 << 16)) && msec);
@@ -428,12 +430,17 @@
 #ifdef	CONFIG_PCI
 	if (hcd->self.controller->bus == &pci_bus_type) {
 		struct pci_dev		*pdev;
+		u16			port_wake;
 
 		pdev = to_pci_dev(hcd->self.controller);
 
 		/* Serial Bus Release Number is at PCI 0x60 offset */
 		pci_read_config_byte(pdev, 0x60, &sbrn);
 
+		/* port wake capability, reported by boot firmware */
+		pci_read_config_word(pdev, 0x62, &port_wake);
+		hcd->can_wakeup = (port_wake & 1) != 0;
+
 		/* help hc dma work well with cachelines */
 		pci_set_mwi (pdev);
 
@@ -615,41 +622,26 @@
 
 /* suspend/resume, section 4.3 */
 
+/* These routines rely on PCI to handle powerdown and wakeup, and
+ * transceivers that don't need any software attention to set up
+ * the right sort of wakeup.  
+ */
+
 static int ehci_suspend (struct usb_hcd *hcd, u32 state)
 {
 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
-	int			ports;
-	int			i;
-
-	ehci_dbg (ehci, "suspend to %d\n", state);
 
-	ports = HCS_N_PORTS (ehci->hcs_params);
+	while (time_before (jiffies, ehci->next_statechange))
+		msleep (100);
 
-	// FIXME:  This assumes what's probably a D3 level suspend...
-
-	// FIXME:  usb wakeup events on this bus should resume the machine.
-	// pci config register PORTWAKECAP controls which ports can do it;
-	// bios may have initted the register...
-
-	/* suspend each port, then stop the hc */
-	for (i = 0; i < ports; i++) {
-		int	temp = readl (&ehci->regs->port_status [i]);
-
-		if ((temp & PORT_PE) == 0
-				|| (temp & PORT_OWNER) != 0)
-			continue;
-		ehci_dbg (ehci, "suspend port %d", i);
-		temp |= PORT_SUSPEND;
-		writel (temp, &ehci->regs->port_status [i]);
-	}
-
-	if (hcd->state == USB_STATE_RUNNING)
-		ehci_ready (ehci);
-	writel (readl (&ehci->regs->command) & ~CMD_RUN, &ehci->regs->command);
-
-// save pci FLADJ value
+#ifdef	CONFIG_USB_SUSPEND
+	(void) usb_suspend_device (hcd->self.root_hub);
+#else
+	/* FIXME lock root hub */
+	(void) ehci_hub_suspend (hcd);
+#endif
 
-	/* who tells PCI to reduce power consumption? */
+	// save (PCI) FLADJ in case of Vaux power loss
 
 	return 0;
 }
@@ -657,40 +649,22 @@
 static int ehci_resume (struct usb_hcd *hcd)
 {
 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
-	int			ports;
-	int			i;
+	int			retval;
 
-	ehci_dbg (ehci, "resume\n");
+	// maybe restore (PCI) FLADJ
 
-	ports = HCS_N_PORTS (ehci->hcs_params);
+	while (time_before (jiffies, ehci->next_statechange))
+		msleep (100);
 
-	// FIXME:  if controller didn't retain state,
-	// return and let generic code clean it up
-	// test configured_flag ?
-
-	/* resume HC and each port */
-// restore pci FLADJ value
-	// khubd and drivers will set HC running, if needed;
-	hcd->state = USB_STATE_RUNNING;
-	// FIXME Philips/Intel/... etc don't really have a "READY"
-	// state ... turn on CMD_RUN too
-	for (i = 0; i < ports; i++) {
-		int	temp = readl (&ehci->regs->port_status [i]);
-
-		if ((temp & PORT_PE) == 0
-				|| (temp & PORT_SUSPEND) != 0)
-			continue;
-		ehci_dbg (ehci, "resume port %d", i);
-		temp |= PORT_RESUME;
-		writel (temp, &ehci->regs->port_status [i]);
-		readl (&ehci->regs->command);	/* unblock posted writes */
-
-		wait_ms (20);
-		temp &= ~PORT_RESUME;
-		writel (temp, &ehci->regs->port_status [i]);
-	}
-	readl (&ehci->regs->command);	/* unblock posted writes */
-	return 0;
+#ifdef	CONFIG_USB_SUSPEND
+	retval = usb_resume_device (hcd->self.root_hub);
+#else
+	/* FIXME lock root hub */
+	retval = ehci_hub_resume (hcd);
+#endif
+	if (retval == 0)
+		hcd->self.controller->power.power_state = 0;
+	return retval;
 }
 
 #endif
@@ -752,7 +726,7 @@
 	bh = 0;
 
 #ifdef	EHCI_VERBOSE_DEBUG
-	/* unrequested/ignored: Port Change Detect, Frame List Rollover */
+	/* unrequested/ignored: Frame List Rollover */
 	dbg_status (ehci, "irq", status);
 #endif
 
@@ -774,6 +748,34 @@
 		bh = 1;
 	}
 
+	/* remote wakeup [4.3.1] */
+	if ((status & STS_PCD) && ehci->hcd.remote_wakeup) {
+		unsigned	i = HCS_N_PORTS (ehci->hcs_params);
+
+		/* resume root hub? */
+		status = readl (&ehci->regs->command);
+		if (!(status & CMD_RUN))
+			writel (status | CMD_RUN, &ehci->regs->command);
+
+		while (i--) {
+			status = readl (&ehci->regs->port_status [i]);
+			if (status & PORT_OWNER)
+				continue;
+			if (!(status & PORT_RESUME)
+					|| ehci->reset_done [i] != 0)
+				continue;
+
+			/* start 20 msec resume signaling from this port,
+			 * and make khubd collect PORT_STAT_C_SUSPEND to
+			 * stop that signaling.
+			 */
+			ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
+			mod_timer (&ehci->hcd.rh_timer,
+					ehci->reset_done [i] + 1);
+			ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
+		}
+	}
+
 	/* PCI errors [4.15.2.4] */
 	if (unlikely ((status & STS_FATAL) != 0)) {
 		ehci_err (ehci, "fatal error\n");
@@ -814,7 +816,6 @@
 	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
 	struct list_head	qtd_list;
 
-	urb->transfer_flags &= ~EHCI_STATE_UNLINK;
 	INIT_LIST_HEAD (&qtd_list);
 
 	switch (usb_pipetype (urb->pipe)) {
@@ -914,7 +915,6 @@
 
 		// wait till next completion, do it then.
 		// completion irqs can wait up to 1024 msec,
-		urb->transfer_flags |= EHCI_STATE_UNLINK;
 		break;
 	}
 	spin_unlock_irqrestore (&ehci->lock, flags);
@@ -965,7 +965,7 @@
 		goto rescan;
 	case QH_STATE_IDLE:		/* fully unlinked */
 		if (list_empty (&qh->qtd_list)) {
-			qh_put (ehci, qh);
+			qh_put (qh);
 			break;
 		}
 		/* else FALL THROUGH */
diff -Nru a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
--- a/drivers/usb/host/ehci-hub.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/usb/host/ehci-hub.c	Tue Jun 15 22:21:04 2004
@@ -28,6 +28,131 @@
 
 /*-------------------------------------------------------------------------*/
 
+#ifdef	CONFIG_PM
+
+static int ehci_hub_suspend (struct usb_hcd *hcd)
+{
+	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
+	struct usb_device	*root = hcd_to_bus (&ehci->hcd)->root_hub;
+	int			port;
+	int			status = 0;
+
+	if (root->dev.power.power_state != 0)
+		return 0;
+	if (time_before (jiffies, ehci->next_statechange))
+		return -EAGAIN;
+
+	port = HCS_N_PORTS (ehci->hcs_params);
+	spin_lock_irq (&ehci->lock);
+
+	/* suspend any active/unsuspended ports, maybe allow wakeup */
+	while (port--) {
+		u32	t1 = readl (&ehci->regs->port_status [port]);
+		u32	t2 = t1;
+
+		if ((t1 & PORT_PE) && !(t1 & PORT_OWNER))
+			t2 |= PORT_SUSPEND;
+		if (ehci->hcd.remote_wakeup)
+			t2 |= PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E;
+		else
+			t2 &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E);
+
+		if (t1 != t2) {
+			ehci_vdbg (ehci, "port %d, %08x -> %08x\n",
+				port + 1, t1, t2);
+			writel (t2, &ehci->regs->port_status [port]);
+		}
+	}
+
+	/* stop schedules, then turn off HC and clean any completed work */
+	if (hcd->state == USB_STATE_RUNNING)
+		ehci_ready (ehci);
+	ehci->command = readl (&ehci->regs->command);
+	writel (ehci->command & ~CMD_RUN, &ehci->regs->command);
+	if (ehci->reclaim)
+		ehci->reclaim_ready = 1;
+	ehci_work (ehci, 0);
+	(void) handshake (&ehci->regs->status, STS_HALT, STS_HALT, 2000);
+
+	root->dev.power.power_state = 3;
+	ehci->next_statechange = jiffies + msecs_to_jiffies(10);
+	spin_unlock_irq (&ehci->lock);
+	return status;
+}
+
+
+/* caller owns root->serialize, and should reset/reinit on error */
+static int ehci_hub_resume (struct usb_hcd *hcd)
+{
+	struct ehci_hcd		*ehci = hcd_to_ehci (hcd);
+	struct usb_device	*root = hcd_to_bus (&ehci->hcd)->root_hub;
+	u32			temp;
+	int			i;
+
+	if (!root->dev.power.power_state)
+		return 0;
+	if (time_before (jiffies, ehci->next_statechange))
+		return -EAGAIN;
+
+	/* re-init operational registers in case we lost power */
+	if (readl (&ehci->regs->intr_enable) == 0) {
+		writel (INTR_MASK, &ehci->regs->intr_enable);
+		writel (0, &ehci->regs->segment);
+		writel (ehci->periodic_dma, &ehci->regs->frame_list);
+		writel ((u32)ehci->async->qh_dma, &ehci->regs->async_next);
+		/* FIXME will this work even (pci) vAUX was lost? */
+	}
+
+	/* restore CMD_RUN, framelist size, and irq threshold */
+	writel (ehci->command, &ehci->regs->command);
+
+	/* take ports out of suspend */
+	i = HCS_N_PORTS (ehci->hcs_params);
+	while (i--) {
+		temp = readl (&ehci->regs->port_status [i]);
+		temp &= ~(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E);
+		if (temp & PORT_SUSPEND) {
+			ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
+			temp |= PORT_RESUME;
+		}
+		writel (temp, &ehci->regs->port_status [i]);
+	}
+	i = HCS_N_PORTS (ehci->hcs_params);
+	msleep (20);
+	while (i--) {
+		temp = readl (&ehci->regs->port_status [i]);
+		if ((temp & PORT_SUSPEND) == 0)
+			continue;
+		temp &= ~PORT_RESUME;
+		writel (temp, &ehci->regs->port_status [i]);
+		ehci_vdbg (ehci, "resumed port %d\n", i + 1);
+	}
+	(void) readl (&ehci->regs->command);
+
+	/* maybe re-activate the schedule(s) */
+	temp = 0;
+	if (ehci->async->qh_next.qh)
+		temp |= CMD_ASE;
+	if (ehci->periodic_sched)
+		temp |= CMD_PSE;
+	if (temp)
+		writel (ehci->command | temp, &ehci->regs->command);
+
+	root->dev.power.power_state = 0;
+	ehci->next_statechange = jiffies + msecs_to_jiffies(5);
+	ehci->hcd.state = USB_STATE_RUNNING;
+	return 0;
+}
+
+#else
+
+#define ehci_hub_suspend	0
+#define ehci_hub_resume		0
+
+#endif	/* CONFIG_PM */
+
+/*-------------------------------------------------------------------------*/
+
 static int check_reset_complete (
 	struct ehci_hcd	*ehci,
 	int		index,
@@ -99,7 +224,11 @@
 		}
 		if (!(temp & PORT_CONNECT))
 			ehci->reset_done [i] = 0;
-		if ((temp & (PORT_CSC | PORT_PEC | PORT_OCC)) != 0) {
+		if ((temp & (PORT_CSC | PORT_PEC | PORT_OCC)) != 0
+				// PORT_STAT_C_SUSPEND?
+				|| ((temp & PORT_RESUME) != 0
+					&& time_after (jiffies,
+						ehci->reset_done [i]))) {
 			if (i < 7)
 			    buf [0] |= 1 << (i + 1);
 			else
@@ -143,6 +272,8 @@
 
 /*-------------------------------------------------------------------------*/
 
+#define	PORT_WAKE_BITS 	(PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E)
+
 static int ehci_hub_control (
 	struct usb_hcd	*hcd,
 	u16		typeReq,
@@ -194,8 +325,20 @@
 				&ehci->regs->port_status [wIndex]);
 			break;
 		case USB_PORT_FEAT_SUSPEND:
+			if (temp & PORT_RESET)
+				goto error;
+			if (temp & PORT_SUSPEND) {
+				if ((temp & PORT_PE) == 0)
+					goto error;
+				/* resume signaling for 20 msec */
+				writel ((temp & ~PORT_WAKE_BITS) | PORT_RESUME,
+					&ehci->regs->port_status [wIndex]);
+				ehci->reset_done [wIndex] = jiffies
+						+ msecs_to_jiffies (20);
+			}
+			break;
 		case USB_PORT_FEAT_C_SUSPEND:
-			/* ? */
+			/* we auto-clear this feature */
 			break;
 		case USB_PORT_FEAT_POWER:
 			if (HCS_PPC (ehci->hcs_params))
@@ -239,15 +382,37 @@
 			status |= 1 << USB_PORT_FEAT_C_CONNECTION;
 		if (temp & PORT_PEC)
 			status |= 1 << USB_PORT_FEAT_C_ENABLE;
-		// USB_PORT_FEAT_C_SUSPEND
 		if (temp & PORT_OCC)
 			status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT;
 
+		/* whoever resumes must GetPortStatus to complete it!! */
+		if ((temp & PORT_RESUME)
+				&& time_after (jiffies,
+					ehci->reset_done [wIndex])) {
+			status |= 1 << USB_PORT_FEAT_C_SUSPEND;
+			ehci->reset_done [wIndex] = 0;
+
+			/* stop resume signaling */
+			temp = readl (&ehci->regs->port_status [wIndex]);
+			writel (temp & ~PORT_RESUME,
+				&ehci->regs->port_status [wIndex]);
+			retval = handshake (
+					&ehci->regs->port_status [wIndex],
+					PORT_RESUME, 0, 2000 /* 2msec */);
+			if (retval != 0) {
+				ehci_err (ehci, "port %d resume error %d\n",
+					wIndex + 1, retval);
+				goto error;
+			}
+			temp &= ~(PORT_SUSPEND|PORT_RESUME|(3<<10));
+		}
+
 		/* whoever resets must GetPortStatus to complete it!! */
 		if ((temp & PORT_RESET)
 				&& time_after (jiffies,
 					ehci->reset_done [wIndex])) {
 			status |= 1 << USB_PORT_FEAT_C_RESET;
+			ehci->reset_done [wIndex] = 0;
 
 			/* force reset to complete */
 			writel (temp & ~PORT_RESET,
@@ -275,7 +440,7 @@
 			}
 			if (temp & PORT_PE)
 				status |= 1 << USB_PORT_FEAT_ENABLE;
-			if (temp & PORT_SUSPEND)
+			if (temp & (PORT_SUSPEND|PORT_RESUME))
 				status |= 1 << USB_PORT_FEAT_SUSPEND;
 			if (temp & PORT_OC)
 				status |= 1 << USB_PORT_FEAT_OVER_CURRENT;
@@ -312,6 +477,11 @@
 
 		switch (wValue) {
 		case USB_PORT_FEAT_SUSPEND:
+			if ((temp & PORT_PE) == 0
+					|| (temp & PORT_RESET) != 0)
+				goto error;
+			if (ehci->hcd.remote_wakeup)
+				temp |= PORT_WAKE_BITS;
 			writel (temp | PORT_SUSPEND,
 				&ehci->regs->port_status [wIndex]);
 			break;
@@ -321,6 +491,8 @@
 					&ehci->regs->port_status [wIndex]);
 			break;
 		case USB_PORT_FEAT_RESET:
+			if (temp & PORT_RESUME)
+				goto error;
 			/* line status bits may report this as low speed,
 			 * which can be fine if this root hub has a
 			 * transaction translator built in.
@@ -342,7 +514,7 @@
 				 * usb 2.0 spec says 50 ms resets on root
 				 */
 				ehci->reset_done [wIndex] = jiffies
-				    	+ ((50 /* msec */ * HZ) / 1000);
+						+ msecs_to_jiffies (50);
 			}
 			writel (temp, &ehci->regs->port_status [wIndex]);
 			break;
diff -Nru a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
--- a/drivers/usb/host/ehci-mem.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/usb/host/ehci-mem.c	Tue Jun 15 22:21:02 2004
@@ -87,6 +87,22 @@
 }
 
 
+static void qh_destroy (struct kref *kref)
+{
+	struct ehci_qh *qh = container_of(kref, struct ehci_qh, kref);
+	struct ehci_hcd *ehci = qh->ehci;
+
+	/* clean qtds first, and know this is not linked */
+	if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) {
+		ehci_dbg (ehci, "unused qh not empty!\n");
+		BUG ();
+	}
+	if (qh->dummy)
+		ehci_qtd_free (ehci, qh->dummy);
+	usb_put_dev (qh->dev);
+	dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
+}
+
 static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, int flags)
 {
 	struct ehci_qh		*qh;
@@ -98,7 +114,8 @@
 		return qh;
 
 	memset (qh, 0, sizeof *qh);
-	atomic_set (&qh->refcount, 1);
+	kref_init(&qh->kref, qh_destroy);
+	qh->ehci = ehci;
 	qh->qh_dma = dma;
 	// INIT_LIST_HEAD (&qh->qh_list);
 	INIT_LIST_HEAD (&qh->qtd_list);
@@ -114,25 +131,15 @@
 }
 
 /* to share a qh (cpu threads, or hc) */
-static inline struct ehci_qh *qh_get (/* ehci, */ struct ehci_qh *qh)
+static inline struct ehci_qh *qh_get (struct ehci_qh *qh)
 {
-	atomic_inc (&qh->refcount);
+	kref_get(&qh->kref);
 	return qh;
 }
 
-static void qh_put (struct ehci_hcd *ehci, struct ehci_qh *qh)
+static inline void qh_put (struct ehci_qh *qh)
 {
-	if (!atomic_dec_and_test (&qh->refcount))
-		return;
-	/* clean qtds first, and know this is not linked */
-	if (!list_empty (&qh->qtd_list) || qh->qh_next.ptr) {
-		ehci_dbg (ehci, "unused qh not empty!\n");
-		BUG ();
-	}
-	if (qh->dummy)
-		ehci_qtd_free (ehci, qh->dummy);
-	usb_put_dev (qh->dev);
-	dma_pool_free (ehci->qh_pool, qh, qh->qh_dma);
+	kref_put(&qh->kref);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -145,7 +152,7 @@
 static void ehci_mem_cleanup (struct ehci_hcd *ehci)
 {
 	if (ehci->async)
-		qh_put (ehci, ehci->async);
+		qh_put (ehci->async);
 	ehci->async = 0;
 
 	/* DMA consistent memory and pools */
diff -Nru a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
--- a/drivers/usb/host/ehci-q.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/host/ehci-q.c	Tue Jun 15 22:20:43 2004
@@ -193,7 +193,7 @@
 			/* ... update hc-wide periodic stats (for usbfs) */
 			hcd_to_bus (&ehci->hcd)->bandwidth_int_reqs--;
 		}
-		qh_put (ehci, qh);
+		qh_put (qh);
 	}
 
 	spin_lock (&urb->lock);
@@ -708,7 +708,7 @@
 	default:
  		dbg ("bogus dev %p speed %d", urb->dev, urb->dev->speed);
 done:
-		qh_put (ehci, qh);
+		qh_put (qh);
 		return 0;
 	}
 
@@ -951,7 +951,7 @@
 	// qh->hw_next = cpu_to_le32 (qh->qh_dma);
 	qh->qh_state = QH_STATE_IDLE;
 	qh->qh_next.qh = 0;
-	qh_put (ehci, qh);			// refcount from reclaim 
+	qh_put (qh);			// refcount from reclaim 
 
 	/* other unlink(s) may be pending (in QH_STATE_UNLINK_WAIT) */
 	next = qh->reclaim;
@@ -965,7 +965,7 @@
 			&& HCD_IS_RUNNING (ehci->hcd.state))
 		qh_link_async (ehci, qh);
 	else {
-		qh_put (ehci, qh);		// refcount from async list
+		qh_put (qh);		// refcount from async list
 
 		/* it's not free to turn the async schedule on/off; leave it
 		 * active but idle for a while once it empties.
@@ -1067,7 +1067,7 @@
 				qh = qh_get (qh);
 				qh->stamp = ehci->stamp;
 				temp = qh_completions (ehci, qh, regs);
-				qh_put (ehci, qh);
+				qh_put (qh);
 				if (temp != 0) {
 					goto rescan;
 				}
diff -Nru a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
--- a/drivers/usb/host/ehci-sched.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/host/ehci-sched.c	Tue Jun 15 22:20:38 2004
@@ -312,7 +312,7 @@
 
 	do {
 		periodic_unlink (ehci, frame, qh);
-		qh_put (ehci, qh);
+		qh_put (qh);
 		frame += qh->period;
 	} while (frame < ehci->periodic_size);
 
@@ -355,7 +355,7 @@
 
 	dbg ("descheduled qh %p, period = %d frame = %d count = %d, urbs = %d",
 		qh, qh->period, frame,
-		atomic_read (&qh->refcount), ehci->periodic_sched);
+		atomic_read (&qh->kref.refcount), ehci->periodic_sched);
 }
 
 static int check_period (
@@ -1846,7 +1846,7 @@
 				modified = qh_completions (ehci, temp.qh, regs);
 				if (unlikely (list_empty (&temp.qh->qtd_list)))
 					intr_deschedule (ehci, temp.qh, 0);
-				qh_put (ehci, temp.qh);
+				qh_put (temp.qh);
 				break;
 			case Q_TYPE_FSTN:
 				/* for "save place" FSTNs, look at QH entries
diff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
--- a/drivers/usb/host/ehci.h	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/host/ehci.h	Tue Jun 15 22:20:44 2004
@@ -84,6 +84,8 @@
 	struct notifier_block	reboot_notifier;
 	unsigned long		actions;
 	unsigned		stamp;
+	unsigned long		next_statechange;
+	u32			command;
 
 	unsigned		is_arc_rh_tt:1;	/* ARC roothub with TT */
 
@@ -99,8 +101,6 @@
 /* unwrap an HCD pointer to get an EHCI_HCD pointer */ 
 #define hcd_to_ehci(hcd_ptr) container_of(hcd_ptr, struct ehci_hcd, hcd)
 
-/* NOTE:  urb->transfer_flags expected to not use this bit !!! */
-#define EHCI_STATE_UNLINK	0x8000		/* urb being unlinked */
 
 enum ehci_timer_action {
 	TIMER_IO_WATCHDOG,
@@ -221,7 +221,7 @@
 	u32		segment; 	/* address bits 63:32 if needed */
 	/* PERIODICLISTBASE: offset 0x14 */
 	u32		frame_list; 	/* points to periodic list */
-	/* ASYNCICLISTADDR: offset 0x18 */
+	/* ASYNCLISTADDR: offset 0x18 */
 	u32		async_next;	/* address of next async queue head */
 
 	u32		reserved [9];
@@ -237,7 +237,10 @@
 #define PORT_WKDISC_E	(1<<21)		/* wake on disconnect (enable) */
 #define PORT_WKCONN_E	(1<<20)		/* wake on connect (enable) */
 /* 19:16 for port testing */
-/* 15:14 for using port indicator leds (if HCS_INDICATOR allows) */
+#define PORT_LED_OFF	(0<<14)
+#define PORT_LED_AMBER	(1<<14)
+#define PORT_LED_GREEN	(2<<14)
+#define PORT_LED_MASK	(3<<14)
 #define PORT_OWNER	(1<<13)		/* true: companion hc owns this port */
 #define PORT_POWER	(1<<12)		/* true: has power (see PPC) */
 #define PORT_USB11(x) (((x)&(3<<10))==(1<<10))	/* USB 1.1 device */
@@ -366,7 +369,8 @@
 	struct ehci_qtd		*dummy;
 	struct ehci_qh		*reclaim;	/* next to reclaim */
 
-	atomic_t		refcount;
+	struct ehci_hcd		*ehci;
+	struct kref		kref;
 	unsigned		stamp;
 
 	u8			qh_state;
diff -Nru a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
--- a/drivers/usb/host/ohci-dbg.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/host/ohci-dbg.c	Tue Jun 15 22:20:44 2004
@@ -617,7 +617,17 @@
 	/* dump driver info, then registers in spec order */
 
 	ohci_dbg_sw (ohci, &next, &size,
-		"%s version " DRIVER_VERSION "\n", hcd_name);
+		"bus %s, device %s\n"
+		"%s version " DRIVER_VERSION "\n",
+		hcd->self.controller->bus->name,
+		hcd->self.controller->bus_id,
+		hcd_name);
+
+	if (bus->controller->power.power_state) {
+		size -= scnprintf (next, size,
+			"SUSPENDED (no register access)\n");
+		goto done;
+	}
 
 	ohci_dump_status(ohci, &next, &size);
 
@@ -657,8 +667,8 @@
 	/* roothub */
 	ohci_dump_roothub (ohci, 1, &next, &size);
 
+done:
 	spin_unlock_irqrestore (&ohci->lock, flags);
-
 	return PAGE_SIZE - size;
 }
 static CLASS_DEVICE_ATTR (registers, S_IRUGO, show_registers, NULL);
diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
--- a/drivers/usb/host/ohci-hcd.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/host/ohci-hcd.c	Tue Jun 15 22:20:36 2004
@@ -117,8 +117,8 @@
 
 /* For initializing controller (mask in an HCFS mode too) */
 #define	OHCI_CONTROL_INIT 	OHCI_CTRL_CBSR
-
-#define OHCI_UNLINK_TIMEOUT	 (HZ / 10)
+#define	OHCI_INTR_INIT \
+	(OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_RD | OHCI_INTR_WDH)
 
 /*-------------------------------------------------------------------------*/
 
@@ -126,11 +126,6 @@
 
 #include "ohci.h"
 
-static inline void disable (struct ohci_hcd *ohci)
-{
-	ohci->hcd.state = USB_STATE_HALT;
-}
-
 #include "ohci-hub.c"
 #include "ohci-dbg.c"
 #include "ohci-mem.c"
@@ -206,8 +201,7 @@
 	if (!urb_priv)
 		return -ENOMEM;
 	memset (urb_priv, 0, sizeof (urb_priv_t) + size * sizeof (struct td *));
-	
-	/* fill the private part of the URB */
+	INIT_LIST_HEAD (&urb_priv->pending);
 	urb_priv->length = size;
 	urb_priv->ed = ed;	
 
@@ -397,6 +391,16 @@
 {
 	u32 temp;
 
+	/* boot firmware should have set this up (5.1.1.3.1) */
+	if (!ohci->fminterval) {
+		temp = readl (&ohci->regs->fminterval);
+		if (temp & 0x3fff0000)
+			ohci->fminterval = temp;
+		else
+			ohci->fminterval = DEFAULT_FMINTERVAL;
+		/* also: power/overcurrent flags in roothub.a */
+	}
+
 	/* SMM owns the HC?  not for long!
 	 * On PA-RISC, PDC can leave IR set incorrectly; ignore it there.
 	 */
@@ -413,7 +417,7 @@
 		writel (OHCI_INTR_OC, &ohci->regs->intrenable);
 		writel (OHCI_OCR, &ohci->regs->cmdstatus);
 		while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
-			wait_ms (10);
+			msleep (10);
 			if (--temp == 0) {
 				ohci_err (ohci, "USB HC TakeOver failed!\n");
 				return -1;
@@ -430,9 +434,12 @@
 
   	/* Reset USB (needed by some controllers); RemoteWakeupConnected
 	 * saved if boot firmware (BIOS/SMM/...) told us it's connected
+	 * (for OHCI integrated on mainboard, it normally is)
 	 */
 	ohci->hc_control = readl (&ohci->regs->control);
 	ohci->hc_control &= OHCI_CTRL_RWC;	/* hcfs 0 = RESET */
+	if (ohci->hc_control)
+		ohci->hcd.can_wakeup = 1;
 	writel (ohci->hc_control, &ohci->regs->control);
 	if (power_switching) {
 		unsigned ports = roothub_a (ohci) & RH_A_NDP; 
@@ -444,7 +451,7 @@
 	}
 	// flush those pci writes
 	(void) readl (&ohci->regs->control);
-	wait_ms (50);
+	msleep (50);
 
 	/* HC Reset requires max 10 us delay */
 	writel (OHCI_HCR,  &ohci->regs->cmdstatus);
@@ -473,9 +480,6 @@
 
 /*-------------------------------------------------------------------------*/
 
-#define	FI		0x2edf		/* 12000 bits per frame (-1) */
-#define LSTHRESH	0x628		/* lowspeed bit threshold */
-
 /* Start an OHCI controller, set the BUS operational
  * enable interrupts 
  * connect the virtual root hub
@@ -486,7 +490,6 @@
   	struct usb_device	*udev;
   	struct usb_bus		*bus;
 
-	spin_lock_init (&ohci->lock);
 	disable (ohci);
 
 	/* Tell the controller where the control and bulk lists are
@@ -497,12 +500,7 @@
 	/* a reset clears this */
 	writel ((u32) ohci->hcca_dma, &ohci->regs->hcca);
 
-	/* force default fmInterval (we won't adjust it); init thresholds
-	 * for last FS and LS packets, reserve 90% for periodic.
-	 */
-	writel ((((6 * (FI - 210)) / 7) << 16) | FI, &ohci->regs->fminterval);
-	writel (((9 * FI) / 10) & 0x3fff, &ohci->regs->periodicstart);
-	writel (LSTHRESH, &ohci->regs->lsthresh);
+	periodic_reinit (ohci);
 
 	/* some OHCI implementations are finicky about how they init.
 	 * bogus values here mean not even enumeration could work.
@@ -519,8 +517,11 @@
  	writel (ohci->hc_control, &ohci->regs->control);
 	ohci->hcd.state = USB_STATE_RUNNING;
 
+	/* wake on ConnectStatusChange, matching external hubs */
+	writel (RH_HS_DRWE, &ohci->regs->roothub.status);
+
 	/* Choose the interrupts we care about now, others later on demand */
-	mask = OHCI_INTR_MIE | OHCI_INTR_UE | OHCI_INTR_WDH;
+	mask = OHCI_INTR_INIT;
 	writel (mask, &ohci->regs->intrstatus);
 	writel (mask, &ohci->regs->intrenable);
 
@@ -551,9 +552,14 @@
 
 	// POTPGT delay is bits 24-31, in 2 ms units.
 	mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
+	bus = hcd_to_bus (&ohci->hcd);
+
+	if (bus->root_hub) {
+		ohci->hcd.state = USB_STATE_RUNNING;
+		return 0;
+	}
  
 	/* connect the virtual root hub */
-	bus = hcd_to_bus (&ohci->hcd);
 	bus->root_hub = udev = usb_alloc_dev (NULL, bus, 0);
 	ohci->hcd.state = USB_STATE_RUNNING;
 	if (!udev) {
@@ -610,11 +616,18 @@
 		ohci_dump (ohci, 1);
 		hc_reset (ohci);
 	}
-  
+
+	if (ints & OHCI_INTR_RD) {
+		ohci_vdbg (ohci, "resume detect\n");
+		schedule_work(&ohci->rh_resume);
+	}
+
 	if (ints & OHCI_INTR_WDH) {
 		if (HCD_IS_RUNNING(hcd->state))
 			writel (OHCI_INTR_WDH, &regs->intrdisable);	
-		dl_done_list (ohci, dl_reverse_done_list (ohci), ptregs);
+		spin_lock (&ohci->lock);
+		dl_done_list (ohci, ptregs);
+		spin_unlock (&ohci->lock);
 		if (HCD_IS_RUNNING(hcd->state))
 			writel (OHCI_INTR_WDH, &regs->intrenable); 
 	}
@@ -654,6 +667,7 @@
 		ohci->hcd.state);
 	ohci_dump (ohci, 1);
 
+	flush_scheduled_work();
 	if (HCD_IS_RUNNING(ohci->hcd.state))
 		hc_reset (ohci);
 	
@@ -670,22 +684,68 @@
 
 /*-------------------------------------------------------------------------*/
 
-// FIXME:  this restart logic should be generic,
-// and handle full hcd state cleanup
-
-/* controller died; cleanup debris, then restart */
 /* must not be called from interrupt context */
 
 #ifdef CONFIG_PM
+
+static void mark_children_gone (struct usb_device *dev)
+{
+	unsigned i;
+
+	for (i = 0; i < dev->maxchild; i++) {
+		if (dev->children [i] == 0)
+			continue;
+		dev->children [i]->state = USB_STATE_NOTATTACHED;
+		mark_children_gone (dev->children [i]);
+	}
+}
+
 static int hc_restart (struct ohci_hcd *ohci)
 {
 	int temp;
 	int i;
+	struct urb_priv *priv;
 
+	/* mark any devices gone, so they do nothing till khubd disconnects.
+	 * recycle any "live" eds/tds (and urbs) right away.
+	 * later, khubd disconnect processing will recycle the other state,
+	 * (either as disconnect/reconnect, or maybe someday as a reset).
+	 */ 
+	spin_lock_irq(&ohci->lock);
 	disable (ohci);
-	if (hcd_to_bus (&ohci->hcd)->root_hub)
-		usb_disconnect (&hcd_to_bus (&ohci->hcd)->root_hub);
-	
+	mark_children_gone (ohci->hcd.self.root_hub);
+	if (!list_empty (&ohci->pending))
+		ohci_dbg(ohci, "abort schedule...\n");
+	list_for_each_entry (priv, &ohci->pending, pending) {
+		struct urb	*urb = priv->td[0]->urb;
+		struct ed	*ed = priv->ed;
+
+		switch (ed->state) {
+		case ED_OPER:
+			ed->state = ED_UNLINK;
+			ed->hwINFO |= ED_DEQUEUE;
+			ed_deschedule (ohci, ed);
+
+			ed->ed_next = ohci->ed_rm_list;
+			ed->ed_prev = 0;
+			ohci->ed_rm_list = ed;
+			/* FALLTHROUGH */
+		case ED_UNLINK:
+			break;
+		default:
+			ohci_dbg(ohci, "bogus ed %p state %d\n",
+					ed, ed->state);
+		}
+
+		spin_lock (&urb->lock);
+		urb->status = -ESHUTDOWN;
+		spin_unlock (&urb->lock);
+	}
+	finish_unlinks (ohci, 0, 0);
+	spin_unlock_irq(&ohci->lock);
+
+	/* paranoia, in case that didn't work: */
+
 	/* empty the interrupt branches */
 	for (i = 0; i < NUM_INTS; i++) ohci->load [i] = 0;
 	for (i = 0; i < NUM_INTS; i++) ohci->hcca->int_table [i] = 0;
@@ -700,8 +760,20 @@
 	if ((temp = hc_reset (ohci)) < 0 || (temp = hc_start (ohci)) < 0) {
 		ohci_err (ohci, "can't restart, %d\n", temp);
 		return temp;
-	} else
+	} else {
+		/* here we "know" root ports should always stay powered,
+		 * and that if we try to turn them back on the root hub
+		 * will respond to CSC processing.
+		 */
+		i = roothub_a (ohci) & RH_A_NDP;
+		while (i--)
+			writel (RH_PS_PSS,
+				&ohci->regs->roothub.portstatus [temp]);
+		ohci->hcd.self.root_hub->dev.power.power_state = 0;
+		ohci->hcd.state = USB_STATE_RUNNING;
 		ohci_dbg (ohci, "restart complete\n");
+		ohci_dump (ohci, 1);
+	}
 	return 0;
 }
 #endif
diff -Nru a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
--- a/drivers/usb/host/ohci-hub.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/usb/host/ohci-hub.c	Tue Jun 15 22:20:37 2004
@@ -60,6 +60,261 @@
 		(temp & RH_PS_CCS) ? " CCS" : "" \
 		);
 
+/*-------------------------------------------------------------------------*/
+
+#if	defined(CONFIG_USB_SUSPEND) || defined(CONFIG_PM)
+
+#define OHCI_SCHED_ENABLES \
+	(OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE)
+
+static void dl_done_list (struct ohci_hcd *, struct pt_regs *);
+static void finish_unlinks (struct ohci_hcd *, u16 , struct pt_regs *);
+
+static int ohci_hub_suspend (struct usb_hcd *hcd)
+{
+	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
+	struct usb_device	*root = hcd_to_bus (&ohci->hcd)->root_hub;
+	int			status = 0;
+
+	if (root->dev.power.power_state != 0)
+		return 0;
+	if (time_before (jiffies, ohci->next_statechange))
+		return -EAGAIN;
+
+	spin_lock_irq (&ohci->lock);
+
+	ohci->hc_control = readl (&ohci->regs->control);
+	switch (ohci->hc_control & OHCI_CTRL_HCFS) {
+	case OHCI_USB_RESUME:
+		ohci_dbg (ohci, "resume/suspend?\n");
+		ohci->hc_control &= ~OHCI_CTRL_HCFS;
+		ohci->hc_control |= OHCI_USB_RESET;
+		writel (ohci->hc_control, &ohci->regs->control);
+		(void) readl (&ohci->regs->control);
+		/* FALL THROUGH */
+	case OHCI_USB_RESET:
+		status = -EBUSY;
+		ohci_dbg (ohci, "needs reinit!\n");
+		goto done;
+	case OHCI_USB_SUSPEND:
+		ohci_dbg (ohci, "already suspended?\n");
+		goto succeed;
+	}
+	ohci_dbg (ohci, "suspend root hub\n");
+
+	/* First stop any processing */
+	ohci->hcd.state = USB_STATE_QUIESCING;
+	if (ohci->hc_control & OHCI_SCHED_ENABLES) {
+		int		limit;
+
+		ohci->hc_control &= ~OHCI_SCHED_ENABLES;
+		writel (ohci->hc_control, &ohci->regs->control);
+		ohci->hc_control = readl (&ohci->regs->control);
+		writel (OHCI_INTR_SF, &ohci->regs->intrstatus);
+
+		/* sched disables take effect on the next frame,
+		 * then the last WDH could take 6+ msec
+		 */
+		ohci_dbg (ohci, "stopping schedules ...\n");
+		limit = 2000;
+		while (limit > 0) {
+			udelay (250);
+			limit =- 250;
+			if (readl (&ohci->regs->intrstatus) & OHCI_INTR_SF)
+				break;
+		}
+		dl_done_list (ohci, 0);
+		mdelay (7);
+	}
+	dl_done_list (ohci, 0);
+	finish_unlinks (ohci, OHCI_FRAME_NO(ohci->hcca), 0);
+	writel (readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus);
+
+	/* maybe resume can wake root hub */
+	if (ohci->hcd.remote_wakeup)
+		ohci->hc_control |= OHCI_CTRL_RWE;
+	else
+		ohci->hc_control &= ~OHCI_CTRL_RWE;
+
+	/* Suspend hub */
+	ohci->hc_control &= ~OHCI_CTRL_HCFS;
+	ohci->hc_control |= OHCI_USB_SUSPEND;
+	writel (ohci->hc_control, &ohci->regs->control);
+	(void) readl (&ohci->regs->control);
+
+	/* no resumes until devices finish suspending */
+	ohci->next_statechange = jiffies + msecs_to_jiffies (5);
+
+succeed:
+	/* it's not USB_STATE_SUSPENDED unless access to this
+	 * hub from the non-usb side (PCI, SOC, etc) stopped 
+	 */
+	root->dev.power.power_state = 3;
+done:
+	spin_unlock_irq (&ohci->lock);
+	return status;
+}
+
+static inline struct ed *find_head (struct ed *ed)
+{
+	/* for bulk and control lists */
+	while (ed->ed_prev)
+		ed = ed->ed_prev;
+	return ed;
+}
+
+static int hc_restart (struct ohci_hcd *ohci);
+
+/* caller owns root->serialize */
+static int ohci_hub_resume (struct usb_hcd *hcd)
+{
+	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
+	struct usb_device	*root = hcd_to_bus (&ohci->hcd)->root_hub;
+	u32			temp, enables;
+	int			status = -EINPROGRESS;
+
+	if (!root->dev.power.power_state)
+		return 0;
+	if (time_before (jiffies, ohci->next_statechange))
+		return -EAGAIN;
+
+	spin_lock_irq (&ohci->lock);
+	ohci->hc_control = readl (&ohci->regs->control);
+	switch (ohci->hc_control & OHCI_CTRL_HCFS) {
+	case OHCI_USB_SUSPEND:
+		ohci->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES);
+		ohci->hc_control |= OHCI_USB_RESUME;
+		writel (ohci->hc_control, &ohci->regs->control);
+		(void) readl (&ohci->regs->control);
+		ohci_dbg (ohci, "resume root hub\n");
+		break;
+	case OHCI_USB_RESUME:
+		/* HCFS changes sometime after INTR_RD */
+		ohci_info (ohci, "remote wakeup\n");
+		break;
+	case OHCI_USB_OPER:
+		ohci_dbg (ohci, "odd resume\n");
+		root->dev.power.power_state = 0;
+		status = 0;
+		break;
+	default:		/* RESET, we lost power */
+		ohci_dbg (ohci, "root hub hardware reset\n");
+		status = -EBUSY;
+	}
+	spin_unlock_irq (&ohci->lock);
+	if (status == -EBUSY)
+		return hc_restart (ohci);
+	if (status != -EINPROGRESS)
+		return status;
+
+	temp = roothub_a (ohci) & RH_A_NDP;
+	enables = 0;
+	while (temp--) {
+		u32 stat = readl (&ohci->regs->roothub.portstatus [temp]);
+
+		/* force global, not selective, resume */
+		if (!(stat & RH_PS_PSS))
+			continue;
+		writel (RH_PS_POCI, &ohci->regs->roothub.portstatus [temp]);
+	}
+
+	/* Some controllers (lucent) need extra-long delays */
+	ohci->hcd.state = USB_STATE_RESUMING;
+	mdelay (20 /* usb 11.5.1.10 */ + 15);
+
+	temp = readl (&ohci->regs->control);
+	temp &= OHCI_CTRL_HCFS;
+	if (temp != OHCI_USB_RESUME) {
+		ohci_err (ohci, "controller won't resume\n");
+		return -EBUSY;
+	}
+
+	/* disable old schedule state, reinit from scratch */
+	writel (0, &ohci->regs->ed_controlhead);
+	writel (0, &ohci->regs->ed_controlcurrent);
+	writel (0, &ohci->regs->ed_bulkhead);
+	writel (0, &ohci->regs->ed_bulkcurrent);
+	writel (0, &ohci->regs->ed_periodcurrent);
+	writel ((u32) ohci->hcca_dma, &ohci->regs->hcca);
+
+	periodic_reinit (ohci);
+
+	/* interrupts might have been disabled */
+	writel (OHCI_INTR_INIT, &ohci->regs->intrenable);
+	if (ohci->ed_rm_list)
+		writel (OHCI_INTR_SF, &ohci->regs->intrenable);
+	writel (readl (&ohci->regs->intrstatus), &ohci->regs->intrstatus);
+
+	/* Then re-enable operations */
+	writel (OHCI_USB_OPER, &ohci->regs->control);
+	(void) readl (&ohci->regs->control);
+	msleep (3);
+
+	temp = OHCI_CONTROL_INIT | OHCI_USB_OPER;
+	if (ohci->hcd.can_wakeup)
+		temp |= OHCI_CTRL_RWC;
+	ohci->hc_control = temp;
+	writel (temp, &ohci->regs->control);
+	(void) readl (&ohci->regs->control);
+
+	/* TRSMRCY */
+	msleep (10);
+	root->dev.power.power_state = 0;
+
+	/* keep it alive for ~5x suspend + resume costs */
+	ohci->next_statechange = jiffies + msecs_to_jiffies (250);
+
+	/* maybe turn schedules back on */
+	enables = 0;
+	temp = 0;
+	if (!ohci->ed_rm_list) {
+		if (ohci->ed_controltail) {
+			writel (find_head (ohci->ed_controltail)->dma,
+				&ohci->regs->ed_controlhead);
+			enables |= OHCI_CTRL_CLE;
+			temp |= OHCI_CLF;
+		}
+		if (ohci->ed_bulktail) {
+			writel (find_head (ohci->ed_bulktail)->dma,
+				&ohci->regs->ed_bulkhead);
+			enables |= OHCI_CTRL_BLE;
+			temp |= OHCI_BLF;
+		}
+	}
+	if (hcd_to_bus (&ohci->hcd)->bandwidth_isoc_reqs
+			|| hcd_to_bus (&ohci->hcd)->bandwidth_int_reqs)
+		enables |= OHCI_CTRL_PLE|OHCI_CTRL_IE;
+	if (enables) {
+		ohci_dbg (ohci, "restarting schedules ... %08x\n", enables);
+		ohci->hc_control |= enables;
+		writel (ohci->hc_control, &ohci->regs->control);
+		if (temp)
+			writel (status, &ohci->regs->cmdstatus);
+		(void) readl (&ohci->regs->control);
+	}
+
+	ohci->hcd.state = USB_STATE_RUNNING;
+	return 0;
+}
+
+static void ohci_rh_resume (void *_hcd)
+{
+	struct usb_hcd	*hcd = _hcd;
+
+	down (&hcd->self.root_hub->serialize);
+	(void) ohci_hub_resume (hcd);
+	up (&hcd->self.root_hub->serialize);
+}
+
+#else
+
+static void ohci_rh_resume (void *_hcd)
+{
+	struct ohci_hcd	*ohci = hcd_to_ohci (_hcd);
+	ohci_dbg(ohci, "rh_resume ??\n");
+}
+
+#endif	/* CONFIG_USB_SUSPEND || CONFIG_PM */
 
 /*-------------------------------------------------------------------------*/
 
@@ -70,6 +325,7 @@
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	int		ports, i, changed = 0, length = 1;
+	int		can_suspend = 1;
 
 	ports = roothub_a (ohci) & RH_A_NDP; 
 	if (ports > MAX_ROOT_PORTS) {
@@ -95,16 +351,45 @@
 	for (i = 0; i < ports; i++) {
 		u32	status = roothub_portstatus (ohci, i);
 
-		status &= RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC
-				| RH_PS_OCIC | RH_PS_PRSC;
-		if (status) {
+		if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC
+				| RH_PS_OCIC | RH_PS_PRSC)) {
 			changed = 1;
 			if (i < 7)
 			    buf [0] |= 1 << (i + 1);
 			else
 			    buf [1] |= 1 << (i - 7);
+			continue;
 		}
+
+		/* can suspend if no ports are enabled; or if all all
+		 * enabled ports are suspended AND remote wakeup is on.
+		 */
+		if (!(status & RH_PS_CCS))
+			continue;
+		if ((status & RH_PS_PSS) && ohci->hcd.remote_wakeup)
+			continue;
+		can_suspend = 0;
 	}
+
+#ifdef CONFIG_PM
+	/* save power by suspending idle root hubs;
+	 * INTR_RD wakes us when there's work
+	 */
+	if (can_suspend
+			&& !changed
+			&& !ohci->ed_rm_list
+			&& ((OHCI_CTRL_HCFS | OHCI_SCHED_ENABLES)
+					& ohci->hc_control)
+				== OHCI_USB_OPER
+			&& down_trylock (&hcd->self.root_hub->serialize) == 0
+			) {
+		ohci_vdbg (ohci, "autosuspend\n");
+		(void) ohci_hub_suspend (&ohci->hcd);
+		ohci->hcd.state = USB_STATE_RUNNING;
+		up (&hcd->self.root_hub->serialize);
+	}
+#endif
+
 	return changed ? length : 0;
 }
 
@@ -188,6 +473,9 @@
 			break;
 		case USB_PORT_FEAT_SUSPEND:
 			temp = RH_PS_POCI;
+			if ((ohci->hc_control & OHCI_CTRL_HCFS)
+					!= OHCI_USB_OPER)
+				schedule_work (&ohci->rh_resume);
 			break;
 		case USB_PORT_FEAT_C_SUSPEND:
 			temp = RH_PS_PSSC;
diff -Nru a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c
--- a/drivers/usb/host/ohci-mem.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/usb/host/ohci-mem.c	Tue Jun 15 22:20:42 2004
@@ -31,6 +31,9 @@
 	if (ohci != 0) {
 		memset (ohci, 0, sizeof (struct ohci_hcd));
 		ohci->hcd.product_desc = "OHCI Host Controller";
+		spin_lock_init (&ohci->lock);
+		INIT_LIST_HEAD (&ohci->pending);
+		INIT_WORK (&ohci->rh_resume, ohci_rh_resume, &ohci->hcd);
 		return &ohci->hcd;
 	}
 	return 0;
diff -Nru a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
--- a/drivers/usb/host/ohci-pci.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/host/ohci-pci.c	Tue Jun 15 22:20:43 2004
@@ -36,6 +36,7 @@
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 
 	ohci->regs = hcd->regs;
+	ohci->next_statechange = jiffies;
 	return hc_reset (ohci);
 }
 
@@ -118,74 +119,26 @@
 static int ohci_pci_suspend (struct usb_hcd *hcd, u32 state)
 {
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
-	u16			cmd;
-	u32			tmp;
 
-	if ((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER) {
-		ohci_dbg (ohci, "can't suspend (state is %s)\n",
-			hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS));
-		return -EIO;
-	}
+	/* suspend root hub, hoping it keeps power during suspend */
+	while (time_before (jiffies, ohci->next_statechange))
+		msleep (100);
+
+#ifdef	CONFIG_USB_SUSPEND
+	(void) usb_suspend_device (hcd->self.root_hub);
+#else
+	down (&hcd->self.root_hub->serialize);
+	(void) ohci_hub_suspend (hcd);
+	up (&hcd->self.root_hub->serialize);
+#endif
 
-	/* act as if usb suspend can always be used */
-	ohci_dbg (ohci, "suspend to %d\n", state);
+	/* let things settle down a bit */
+	msleep (100);
 	
-	/* First stop processing */
-  	spin_lock_irq (&ohci->lock);
-	ohci->hc_control &=
-		~(OHCI_CTRL_PLE|OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_IE);
-	writel (ohci->hc_control, &ohci->regs->control);
-	writel (OHCI_INTR_SF, &ohci->regs->intrstatus);
-	(void) readl (&ohci->regs->intrstatus);
-  	spin_unlock_irq (&ohci->lock);
-
-	/* Wait a frame or two */
-	mdelay (1);
-	if (!readl (&ohci->regs->intrstatus) & OHCI_INTR_SF)
-		mdelay (1);
-		
 #ifdef CONFIG_PMAC_PBOOK
 	if (_machine == _MACH_Pmac)
 		disable_irq ((to_pci_dev(hcd->self.controller))->irq);
- 	/* else, 2.4 assumes shared irqs -- don't disable */
-#endif
-
-	/* Enable remote wakeup */
-	writel (readl (&ohci->regs->intrenable) | OHCI_INTR_RD,
-		&ohci->regs->intrenable);
-
-	/* Suspend chip and let things settle down a bit */
-  	spin_lock_irq (&ohci->lock);
- 	ohci->hc_control = OHCI_USB_SUSPEND;
- 	writel (ohci->hc_control, &ohci->regs->control);
-	(void) readl (&ohci->regs->control);
-  	spin_unlock_irq (&ohci->lock);
-
-	set_current_state (TASK_UNINTERRUPTIBLE);
-	schedule_timeout (HZ/2);
-
-	tmp = readl (&ohci->regs->control) | OHCI_CTRL_HCFS;
-	switch (tmp) {
-		case OHCI_USB_RESET:
-		case OHCI_USB_RESUME:
-		case OHCI_USB_OPER:
-			ohci_err (ohci, "can't suspend; hcfs %d\n", tmp);
-			break;
-		case OHCI_USB_SUSPEND:
-			ohci_dbg (ohci, "suspended\n");
-			break;
-	}
 
-	/* In some rare situations, Apple's OHCI have happily trashed
-	 * memory during sleep. We disable its bus master bit during
-	 * suspend
-	 */
-	pci_read_config_word (to_pci_dev(hcd->self.controller), PCI_COMMAND, 
-				&cmd);
-	cmd &= ~PCI_COMMAND_MASTER;
-	pci_write_config_word (to_pci_dev(hcd->self.controller), PCI_COMMAND, 
-				cmd);
-#ifdef CONFIG_PMAC_PBOOK
 	{
 	   	struct device_node	*of_node;
  
@@ -202,7 +155,6 @@
 static int ohci_pci_resume (struct usb_hcd *hcd)
 {
 	struct ohci_hcd		*ohci = hcd_to_ohci (hcd);
-	int			temp;
 	int			retval = 0;
 
 #ifdef CONFIG_PMAC_PBOOK
@@ -215,90 +167,25 @@
 			pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
 	}
 #endif
-	/* did we suspend, or were we powered off? */
-	ohci->hc_control = readl (&ohci->regs->control);
-	temp = ohci->hc_control & OHCI_CTRL_HCFS;
-
-#ifdef DEBUG
-	/* the registers may look crazy here */
-	ohci_dump_status (ohci, 0, 0);
-#endif
 
-	/* Re-enable bus mastering */
-	pci_set_master (to_pci_dev(ohci->hcd.self.controller));
-	
-	switch (temp) {
-
-	case OHCI_USB_RESET:	// lost power
-restart:
-		ohci_info (ohci, "USB restart\n");
-		retval = hc_restart (ohci);
-		break;
-
-	case OHCI_USB_SUSPEND:	// host wakeup
-	case OHCI_USB_RESUME:	// remote wakeup
-		ohci_info (ohci, "USB continue from %s wakeup\n",
-			 (temp == OHCI_USB_SUSPEND)
-				? "host" : "remote");
-
-		/* we "should" only need RESUME if we're SUSPENDed ... */
-		ohci->hc_control = OHCI_USB_RESUME;
-		writel (ohci->hc_control, &ohci->regs->control);
-		(void) readl (&ohci->regs->control);
-		/* Some controllers (lucent) need extra-long delays */
-		mdelay (35); /* no schedule here ! */
-
-		temp = readl (&ohci->regs->control);
-		temp = ohci->hc_control & OHCI_CTRL_HCFS;
-		if (temp != OHCI_USB_RESUME) {
-			ohci_err (ohci, "controller won't resume\n");
-			/* maybe we can reset */
-			goto restart;
-		}
-
-		/* Then re-enable operations */
-		writel (OHCI_USB_OPER, &ohci->regs->control);
-		(void) readl (&ohci->regs->control);
-		mdelay (3);
-
-		spin_lock_irq (&ohci->lock);
-		ohci->hc_control = OHCI_CONTROL_INIT | OHCI_USB_OPER;
-		if (!ohci->ed_rm_list) {
-			if (ohci->ed_controltail)
-				ohci->hc_control |= OHCI_CTRL_CLE;
-			if (ohci->ed_bulktail)
-				ohci->hc_control |= OHCI_CTRL_BLE;
-		}
-		if (hcd_to_bus (&ohci->hcd)->bandwidth_isoc_reqs
-				|| hcd_to_bus (&ohci->hcd)->bandwidth_int_reqs)
-			ohci->hc_control |= OHCI_CTRL_PLE|OHCI_CTRL_IE;
-		hcd->state = USB_STATE_RUNNING;
-		writel (ohci->hc_control, &ohci->regs->control);
-
-		/* trigger a start-frame interrupt (why?) */
-		writel (OHCI_INTR_SF, &ohci->regs->intrstatus);
-		writel (OHCI_INTR_SF, &ohci->regs->intrenable);
-
-		writel (OHCI_INTR_WDH, &ohci->regs->intrdisable);	
-		(void) readl (&ohci->regs->intrdisable);
-		spin_unlock_irq (&ohci->lock);
+	/* resume root hub */
+	while (time_before (jiffies, ohci->next_statechange))
+		msleep (100);
+#ifdef	CONFIG_USB_SUSPEND
+	/* get extra cleanup even if remote wakeup isn't in use */
+	retval = usb_resume_device (hcd->self.root_hub);
+#else
+	down (&hcd->self.root_hub->serialize);
+	retval = ohci_hub_resume (hcd);
+	up (&hcd->self.root_hub->serialize);
+#endif
 
+	if (retval == 0) {
+		hcd->self.controller->power.power_state = 0;
 #ifdef CONFIG_PMAC_PBOOK
 		if (_machine == _MACH_Pmac)
 			enable_irq (to_pci_dev(hcd->self.controller)->irq);
 #endif
-
-		/* Check for a pending done list */
-		if (ohci->hcca->done_head)
-			dl_done_list (ohci, dl_reverse_done_list (ohci), NULL);
-		writel (OHCI_INTR_WDH, &ohci->regs->intrenable); 
-
-		/* assume there are TDs on the bulk and control lists */
-		writel (OHCI_BLF | OHCI_CLF, &ohci->regs->cmdstatus);
-		break;
-
-	default:
-		ohci_warn (ohci, "odd PCI resume\n");
 	}
 	return retval;
 }
diff -Nru a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
--- a/drivers/usb/host/ohci-q.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/usb/host/ohci-q.c	Tue Jun 15 22:21:03 2004
@@ -22,6 +22,7 @@
 		}
 	}
 
+	list_del (&urb_priv->pending);
 	kfree (urb_priv);
 }
 
@@ -169,6 +170,9 @@
 {	 
 	int	branch;
 
+	if (ohci->hcd.state == USB_STATE_QUIESCING)
+		return -EAGAIN;
+
 	ed->state = ED_OPER;
 	ed->ed_prev = 0;
 	ed->ed_next = 0;
@@ -419,7 +423,7 @@
 	}
 
 	/* NOTE: only ep0 currently needs this "re"init logic, during
-	 * enumeration (after set_address, or if ep0 maxpacket >8).
+	 * enumeration (after set_address).
 	 */
   	if (ed->state == ED_IDLE) {
 		u32	info;
@@ -593,6 +597,7 @@
 	}
 
 	urb_priv->td_cnt = 0;
+	list_add (&urb_priv->pending, &ohci->pending);
 
 	if (data_len)
 		data = urb->transfer_dma;
@@ -865,9 +870,6 @@
 	u32		td_dma;
 	struct td	*td_rev = NULL;
 	struct td	*td = NULL;
-  	unsigned long	flags;
-
-  	spin_lock_irqsave (&ohci->lock, flags);
 
 	td_dma = le32_to_cpup (&ohci->hcca->done_head);
 	ohci->hcca->done_head = 0;
@@ -899,7 +901,6 @@
 		td_rev = td;
 		td_dma = le32_to_cpup (&td->hwNextTD);
 	}	
-	spin_unlock_irqrestore (&ohci->lock, flags);
 	return td_rev;
 }
 
@@ -1013,7 +1014,9 @@
    	}
 
 	/* maybe reenable control and bulk lists */ 
-	if (HCD_IS_RUNNING(ohci->hcd.state) && !ohci->ed_rm_list) {
+	if (HCD_IS_RUNNING(ohci->hcd.state)
+			&& ohci->hcd.state != USB_STATE_QUIESCING
+			&& !ohci->ed_rm_list) {
 		u32	command = 0, control = 0;
 
 		if (ohci->ed_controltail) {
@@ -1053,11 +1056,10 @@
  * scanning the (re-reversed) donelist as this does.
  */
 static void
-dl_done_list (struct ohci_hcd *ohci, struct td *td, struct pt_regs *regs)
+dl_done_list (struct ohci_hcd *ohci, struct pt_regs *regs)
 {
-	unsigned long	flags;
+	struct td	*td = dl_reverse_done_list (ohci);
 
-  	spin_lock_irqsave (&ohci->lock, flags);
   	while (td) {
 		struct td	*td_next = td->next_dl_td;
 		struct urb	*urb = td->urb;
@@ -1098,5 +1100,4 @@
 
     		td = td_next;
   	}  
-	spin_unlock_irqrestore (&ohci->lock, flags);
 }
diff -Nru a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
--- a/drivers/usb/host/ohci.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/usb/host/ohci.h	Tue Jun 15 22:21:05 2004
@@ -318,8 +318,9 @@
 /* hcd-private per-urb state */
 typedef struct urb_priv {
 	struct ed		*ed;
-	__u16			length;		// # tds in this request
-	__u16			td_cnt;		// tds already serviced
+	u16			length;		// # tds in this request
+	u16			td_cnt;		// tds already serviced
+	struct list_head	pending;
 	struct td		*td [0];	// all TDs in this request
 
 } urb_priv_t;
@@ -364,12 +365,17 @@
 	struct dma_pool		*td_cache;
 	struct dma_pool		*ed_cache;
 	struct td		*td_hash [TD_HASH_SIZE];
+	struct list_head	pending;
 
 	/*
 	 * driver state
 	 */
 	int			load [NUM_INTS];
 	u32 			hc_control;	/* copy of hc control reg */
+	unsigned long		next_statechange;	/* suspend/resume */
+	u32			fminterval;		/* saved register */
+
+	struct work_struct	rh_resume;
 
 	unsigned long		flags;		/* for HC bugs */
 #define	OHCI_QUIRK_AMD756	0x01			/* erratum #4 */
@@ -383,6 +389,24 @@
 };
 
 #define hcd_to_ohci(hcd_ptr) container_of(hcd_ptr, struct ohci_hcd, hcd)
+
+/*-------------------------------------------------------------------------*/
+
+static inline void disable (struct ohci_hcd *ohci)
+{
+	ohci->hcd.state = USB_STATE_HALT;
+}
+
+#define	FI			0x2edf		/* 12000 bits per frame (-1) */
+#define	DEFAULT_FMINTERVAL 	((((6 * (FI - 210)) / 7) << 16) | FI)
+#define LSTHRESH		0x628		/* lowspeed bit threshold */
+
+static inline void periodic_reinit (struct ohci_hcd *ohci)
+{
+	writel (ohci->fminterval, &ohci->regs->fminterval);
+	writel (((9 * FI) / 10) & 0x3fff, &ohci->regs->periodicstart);
+	writel (LSTHRESH, &ohci->regs->lsthresh);
+}
 
 /*-------------------------------------------------------------------------*/
 
diff -Nru a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
--- a/drivers/usb/host/uhci-debug.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/usb/host/uhci-debug.c	Tue Jun 15 22:20:37 2004
@@ -567,8 +567,8 @@
 	return (file->f_pos = new);
 }
 
-static ssize_t uhci_proc_read(struct file *file, char *buf, size_t nbytes,
-			loff_t *ppos)
+static ssize_t uhci_proc_read(struct file *file, char __user *buf,
+				size_t nbytes, loff_t *ppos)
 {
 	struct uhci_proc *up = file->private_data;
 	unsigned int pos;
@@ -578,13 +578,8 @@
 	size = up->size;
 	if (pos >= size)
 		return 0;
-	if (nbytes >= size)
-		nbytes = size;
-	if (pos + nbytes > size)
+	if (nbytes > size - pos)
 		nbytes = size - pos;
-
-	if (!access_ok(VERIFY_WRITE, buf, nbytes))
-		return -EINVAL;
 
 	if (copy_to_user(buf, up->data + pos, nbytes))
 		return -EFAULT;
diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/usb/host/uhci-hcd.c	Tue Jun 15 22:20:58 2004
@@ -95,6 +95,10 @@
 static int uhci_get_current_frame_number(struct uhci_hcd *uhci);
 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_finish_completion(struct usb_hcd *hcd, struct pt_regs *regs);
+static void uhci_free_pending_qhs(struct uhci_hcd *uhci);
+static void uhci_free_pending_tds(struct uhci_hcd *uhci);
 
 static void hc_state_transitions(struct uhci_hcd *uhci);
 
@@ -157,8 +161,8 @@
 	return td;
 }
 
-static inline void uhci_fill_td(struct uhci_td *td, __u32 status,
-		__u32 token, __u32 buffer)
+static inline void uhci_fill_td(struct uhci_td *td, u32 status,
+		u32 token, u32 buffer)
 {
 	td->status = cpu_to_le32(status);
 	td->token = cpu_to_le32(token);
@@ -184,11 +188,11 @@
 		list_add_tail(&td->fl_list, &ftd->fl_list);
 
 		td->link = ltd->link;
-		mb();
+		wmb();
 		ltd->link = cpu_to_le32(td->dma_handle);
 	} else {
 		td->link = uhci->fl->frame[framenum];
-		mb();
+		wmb();
 		uhci->fl->frame[framenum] = cpu_to_le32(td->dma_handle);
 		uhci->fl->frame_cpu[framenum] = td;
 	}
@@ -218,7 +222,7 @@
 		ptd->link = td->link;
 	}
 
-	mb();
+	wmb();
 	td->link = UHCI_PTR_TERM;
 
 	list_del_init(&td->fl_list);
@@ -332,17 +336,7 @@
 	/* Grab the last QH */
 	lqh = list_entry(skelqh->list.prev, struct uhci_qh, list);
 
-	/*
-	 * Patch this endpoint's URB's QHs to point to the next skelqh:
-	 *    skelqh --> ... lqh --> newqh --> next skelqh
-	 * Do this first, so the HC always sees the right QH after this one.
-	 */
-	list_for_each (tmp, &urbp->queue_list) {
-		struct urb_priv *turbp =
-			list_entry(tmp, struct urb_priv, queue_list);
-
-		turbp->qh->link = lqh->link;
-	}
+	/* Point to the next skelqh */
 	urbp->qh->link = lqh->link;
 	wmb();				/* Ordering is important */
 
@@ -362,15 +356,15 @@
 	 *
 	 * 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) {
 		list_for_each (tmp, &lqh->urbp->queue_list) {
 			struct urb_priv *turbp =
 				list_entry(tmp, struct urb_priv, queue_list);
 
-			turbp->qh->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH;
+			turbp->qh->link = lqh->link;
 		}
 	}
-	lqh->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH;
 
 	list_add_tail(&urbp->qh->list, &skelqh->list);
 }
@@ -382,7 +376,8 @@
 static void uhci_remove_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
 {
 	struct uhci_qh *pqh;
-	__u32 newlink;
+	u32 newlink;
+	unsigned int age;
 
 	if (!qh)
 		return;
@@ -423,7 +418,7 @@
 				turbp->qh->link = newlink;
 			}
 		}
-		mb();
+		wmb();
 
 		/* Leave qh->link in case the HC is on the QH now, it will */
 		/* continue the rest of the schedule */
@@ -435,6 +430,12 @@
 	list_del_init(&qh->urbp->queue_list);
 	qh->urbp = NULL;
 
+	age = uhci_get_current_frame_number(uhci);
+	if (age != uhci->qh_remove_age) {
+		uhci_free_pending_qhs(uhci);
+		uhci->qh_remove_age = age;
+	}
+
 	/* 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))
@@ -510,7 +511,7 @@
 	/* All qh's in the queue need to link to the next queue */
 	urbp->qh->link = eurbp->qh->link;
 
-	mb();			/* Make sure we flush everything */
+	wmb();			/* Make sure we flush everything */
 
 	lltd->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH;
 
@@ -638,6 +639,7 @@
 {
 	struct list_head *head, *tmp;
 	struct urb_priv *urbp;
+	unsigned int age;
 
 	urbp = (struct urb_priv *)urb->hcpriv;
 	if (!urbp)
@@ -647,6 +649,12 @@
 		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);
+	if (age != uhci->td_remove_age) {
+		uhci_free_pending_tds(uhci);
+		uhci->td_remove_age = age;
+	}
+
 	/* 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))
@@ -1044,9 +1052,13 @@
 			usb_pipeout(urb->pipe));
 	}
 
-	/* Set the flag on the last packet */
-	if (!(urb->transfer_flags & URB_NO_INTERRUPT))
-		td->status |= cpu_to_le32(TD_CTRL_IOC);
+	/* Set the interrupt-on-completion flag on the last packet.
+	 * A more-or-less typical 4 KB URB (= size of one memory page)
+	 * will require about 3 ms to transfer; that's a little on the
+	 * fast side but not enough to justify delaying an interrupt
+	 * more than 2 or 3 URBs, so we will ignore the URB_NO_INTERRUPT
+	 * flag setting. */
+	td->status |= cpu_to_le32(TD_CTRL_IOC);
 
 	qh = uhci_alloc_qh(uhci, urb->dev);
 	if (!qh)
@@ -1518,6 +1530,7 @@
 	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
 	unsigned long flags;
 	struct urb_priv *urbp;
+	unsigned int age;
 
 	spin_lock_irqsave(&uhci->schedule_lock, flags);
 	urbp = urb->hcpriv;
@@ -1527,6 +1540,12 @@
 
 	uhci_unlink_generic(uhci, urb);
 
+	age = uhci_get_current_frame_number(uhci);
+	if (age != uhci->urb_remove_age) {
+		uhci_remove_pending_urbps(uhci);
+		uhci->urb_remove_age = age;
+	}
+
 	/* If we're the first, set the next interrupt bit */
 	if (list_empty(&uhci->urb_remove_list))
 		uhci_set_next_interrupt(uhci);
@@ -1596,6 +1615,12 @@
 	INIT_LIST_HEAD(&list);
 
 	spin_lock_irqsave(&uhci->schedule_lock, flags);
+	if (!list_empty(&uhci->urb_remove_list) &&
+	    uhci_get_current_frame_number(uhci) != uhci->urb_remove_age) {
+		uhci_remove_pending_urbps(uhci);
+		uhci_finish_completion(hcd, NULL);
+	}
+
 	head = &uhci->urb_list;
 	tmp = head->next;
 	while (tmp != head) {
@@ -1734,6 +1759,7 @@
 	unsigned int io_addr = uhci->io_addr;
 	unsigned short status;
 	struct list_head *tmp, *head;
+	unsigned int age;
 
 	/*
 	 * Read the interrupt status, and write it back to clear the
@@ -1764,11 +1790,20 @@
 
 	spin_lock(&uhci->schedule_lock);
 
-	uhci_free_pending_qhs(uhci);
-	uhci_free_pending_tds(uhci);
-	uhci_remove_pending_urbps(uhci);
-
-	uhci_clear_next_interrupt(uhci);
+	age = uhci_get_current_frame_number(uhci);
+	if (age != uhci->qh_remove_age)
+		uhci_free_pending_qhs(uhci);
+	if (age != uhci->td_remove_age)
+		uhci_free_pending_tds(uhci);
+	if (age != uhci->urb_remove_age)
+		uhci_remove_pending_urbps(uhci);
+
+	if (list_empty(&uhci->urb_remove_list) &&
+	    list_empty(&uhci->td_remove_list) &&
+	    list_empty(&uhci->qh_remove_list))
+		uhci_clear_next_interrupt(uhci);
+	else
+		uhci_set_next_interrupt(uhci);
 
 	/* Walk the list of pending URB's to see which ones completed */
 	head = &uhci->urb_list;
@@ -1786,6 +1821,9 @@
 
 	spin_unlock(&uhci->schedule_lock);
 
+	/* Wake up anyone waiting for an URB to complete */
+	wake_up_all(&uhci->waitqh);
+
 	return IRQ_HANDLED;
 }
 
@@ -2086,6 +2124,8 @@
 
 	INIT_LIST_HEAD(&uhci->complete_list);
 
+	init_waitqueue_head(&uhci->waitqh);
+
 	uhci->fl = dma_alloc_coherent(uhci_dev(uhci), sizeof(*uhci->fl),
 			&dma_handle, 0);
 	if (!uhci->fl) {
@@ -2296,6 +2336,9 @@
 	uhci_free_pending_qhs(uhci);
 	uhci_free_pending_tds(uhci);
 	spin_unlock_irq(&uhci->schedule_lock);
+
+	/* Wake up anyone waiting for an URB to complete */
+	wake_up_all(&uhci->waitqh);
 	
 	release_uhci(uhci);
 }
@@ -2361,6 +2404,46 @@
 	kfree(hcd_to_uhci(hcd));
 }
 
+/* Are there any URBs for a particular device/endpoint on a given list? */
+static int urbs_for_ep_list(struct list_head *head,
+		struct hcd_dev *hdev, int ep)
+{
+	struct urb_priv *urbp;
+
+	list_for_each_entry(urbp, head, urb_list) {
+		struct urb *urb = urbp->urb;
+
+		if (hdev == urb->dev->hcpriv && ep ==
+				(usb_pipeendpoint(urb->pipe) |
+				 usb_pipein(urb->pipe)))
+			return 1;
+	}
+	return 0;
+}
+
+/* Are there any URBs for a particular device/endpoint? */
+static int urbs_for_ep(struct uhci_hcd *uhci, struct hcd_dev *hdev, int ep)
+{
+	int rc;
+
+	spin_lock_irq(&uhci->schedule_lock);
+	rc = (urbs_for_ep_list(&uhci->urb_list, hdev, ep) ||
+			urbs_for_ep_list(&uhci->complete_list, hdev, ep) ||
+			urbs_for_ep_list(&uhci->urb_remove_list, hdev, ep));
+	spin_unlock_irq(&uhci->schedule_lock);
+	return rc;
+}
+
+/* Wait until all the URBs for a particular device/endpoint are gone */
+static void uhci_hcd_endpoint_disable(struct usb_hcd *hcd,
+		struct hcd_dev *hdev, int endpoint)
+{
+	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
+
+	wait_event_interruptible(uhci->waitqh,
+			!urbs_for_ep(uhci, hdev, endpoint));
+}
+
 static int uhci_hcd_get_frame_number(struct usb_hcd *hcd)
 {
 	return uhci_get_current_frame_number(hcd_to_uhci(hcd));
@@ -2390,6 +2473,7 @@
 	.urb_enqueue =		uhci_urb_enqueue,
 	.urb_dequeue =		uhci_urb_dequeue,
 
+	.endpoint_disable =	uhci_hcd_endpoint_disable,
 	.get_frame_number =	uhci_hcd_get_frame_number,
 
 	.hub_status_data =	uhci_hub_status_data,
diff -Nru a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
--- a/drivers/usb/host/uhci-hcd.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/host/uhci-hcd.h	Tue Jun 15 22:20:43 2004
@@ -80,7 +80,7 @@
 #define CAN_SCHEDULE_FRAMES	1000	/* how far future frames can be scheduled */
 
 struct uhci_frame_list {
-	__u32 frame[UHCI_NUMFRAMES];
+	u32 frame[UHCI_NUMFRAMES];
 
 	void *frame_cpu[UHCI_NUMFRAMES];
 
@@ -105,8 +105,8 @@
  */
 struct uhci_qh {
 	/* Hardware fields */
-	__u32 link;			/* Next queue */
-	__u32 element;			/* Queue element pointer */
+	u32 link;			/* Next queue */
+	u32 element;			/* Queue element pointer */
 
 	/* Software fields */
 	dma_addr_t dma_handle;
@@ -185,10 +185,10 @@
  */
 struct uhci_td {
 	/* Hardware fields */
-	__u32 link;
-	__u32 status;
-	__u32 token;
-	__u32 buffer;
+	u32 link;
+	u32 status;
+	u32 token;
+	u32 buffer;
 
 	/* Software fields */
 	dma_addr_t dma_handle;
@@ -357,12 +357,15 @@
 
 	/* List of QH's that are done, but waiting to be unlinked (race) */
 	struct list_head qh_remove_list;	/* P: uhci->schedule_lock */
+	unsigned int qh_remove_age;		/* Age in frames */
 
 	/* List of TD's that are done, but waiting to be freed (race) */
 	struct list_head td_remove_list;	/* P: uhci->schedule_lock */
+	unsigned int td_remove_age;		/* Age in frames */
 
 	/* List of asynchronously unlinked URB's */
 	struct list_head urb_remove_list;	/* P: uhci->schedule_lock */
+	unsigned int urb_remove_age;		/* Age in frames */
 
 	/* List of URB's awaiting completion callback */
 	struct list_head complete_list;		/* P: uhci->schedule_lock */
@@ -370,6 +373,8 @@
 	int rh_numports;
 
 	struct timer_list stall_timer;
+
+	wait_queue_head_t waitqh;		/* endpoint_disable waiters */
 };
 
 struct urb_priv {
diff -Nru a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
--- a/drivers/usb/image/mdc800.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/image/mdc800.c	Tue Jun 15 22:20:41 2004
@@ -33,7 +33,7 @@
  * Fix: mdc800 used sleep_on and slept with io_lock held.
  * Converted sleep_on to waitqueues with schedule_timeout and made io_lock
  * a semaphore from a spinlock.
- * by Oliver Neukum <520047054719-0001@t-online.de>
+ * by Oliver Neukum <oliver@neukum.name>
  * (02/12/2001)
  * 
  * Identify version on module load.
@@ -41,7 +41,7 @@
  *
  * version 0.7.5
  * Fixed potential SMP races with Spinlocks.
- * Thanks to Oliver Neukum <oliver.neukum@lrz.uni-muenchen.de> who 
+ * Thanks to Oliver Neukum <oliver@neukum.name> who 
  * noticed the race conditions.
  * (30/10/2000)
  *
@@ -312,14 +312,17 @@
 static int mdc800_usb_waitForIRQ (int mode, int msec)
 {
         DECLARE_WAITQUEUE(wait, current);
+	long timeout;
 
 	mdc800->camera_request_ready=1+mode;
 
 	add_wait_queue(&mdc800->irq_wait, &wait);
 	set_current_state(TASK_INTERRUPTIBLE);
-	if (!mdc800->irq_woken)
+	timeout = msec*HZ/1000;
+	while (!mdc800->irq_woken && timeout)
 	{
-		schedule_timeout (msec*HZ/1000);
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		timeout = schedule_timeout (timeout);
 	}
         remove_wait_queue(&mdc800->irq_wait, &wait);
 	set_current_state(TASK_RUNNING);
@@ -668,6 +671,7 @@
 {
 	size_t left=len, sts=len; /* single transfer size */
 	char* ptr=buf;
+	long timeout;
 	DECLARE_WAITQUEUE(wait, current);
 
 	down (&mdc800->io_lock);
@@ -715,10 +719,11 @@
 					return len-left;
 				}
 				add_wait_queue(&mdc800->download_wait, &wait);
-				set_current_state(TASK_INTERRUPTIBLE);
-				if (!mdc800->downloaded)
+				timeout = TO_DOWNLOAD_GET_READY*HZ/1000;
+				while (!mdc800->downloaded && timeout)
 				{
-					schedule_timeout (TO_DOWNLOAD_GET_READY*HZ/1000);
+					set_current_state(TASK_UNINTERRUPTIBLE);
+					timeout = schedule_timeout (timeout);
 				}
 				set_current_state(TASK_RUNNING);
 				remove_wait_queue(&mdc800->download_wait, &wait);
@@ -819,6 +824,7 @@
 		if (mdc800->in_count == 8)
 		{
 			int answersize;
+			long timeout;
 
 			if (mdc800_usb_waitForIRQ (0,TO_GET_READY))
 			{
@@ -839,10 +845,11 @@
 				return -EIO;
 			}
 			add_wait_queue(&mdc800->write_wait, &wait);
-			set_current_state(TASK_INTERRUPTIBLE);
-			if (!mdc800->written)
+			timeout = TO_WRITE_GET_READY*HZ/1000;
+			while (!mdc800->written && timeout)
 			{
-				schedule_timeout (TO_WRITE_GET_READY*HZ/1000);
+				set_current_state(TASK_UNINTERRUPTIBLE);
+				timeout = schedule_timeout (timeout);
 			}
                         set_current_state(TASK_RUNNING);
 			remove_wait_queue(&mdc800->write_wait, &wait);
diff -Nru a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig
--- a/drivers/usb/input/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/input/Kconfig	Tue Jun 15 22:20:43 2004
@@ -191,6 +191,19 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called mtouchusb.
 
+config USB_EGALAX
+	tristate "eGalax TouchKit USB Touchscreen Driver"
+	depends on USB && INPUT
+	---help---
+	  Say Y here if you want to use a eGalax TouchKit USB
+	  Touchscreen controller.
+
+	  The driver has been tested on a Xenarc 700TSV monitor
+	  with eGalax touchscreen.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called touchkitusb.
+
 config USB_XPAD
 	tristate "X-Box gamepad support"
 	depends on USB && INPUT
diff -Nru a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile
--- a/drivers/usb/input/Makefile	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/input/Makefile	Tue Jun 15 22:20:41 2004
@@ -33,6 +33,7 @@
 obj-$(CONFIG_USB_KBTAB)		+= kbtab.o
 obj-$(CONFIG_USB_MOUSE)		+= usbmouse.o
 obj-$(CONFIG_USB_MTOUCH)	+= mtouchusb.o
+obj-$(CONFIG_USB_EGALAX)	+= touchkitusb.o
 obj-$(CONFIG_USB_POWERMATE)	+= powermate.o
 obj-$(CONFIG_USB_WACOM)		+= wacom.o
 obj-$(CONFIG_USB_XPAD)		+= xpad.o
diff -Nru a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
--- a/drivers/usb/input/aiptek.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/input/aiptek.c	Tue Jun 15 22:20:43 2004
@@ -1,7 +1,9 @@
 /*
- *  Native support for the Aiptek 8000U
- *
- *  Copyright (c) 2001 Chris Atenasio		<chris@crud.net>
+ *  Native support for the Aiptek HyperPen USB Tablets
+ *  (4000U/5000U/6000U/8000U/12000U)
+ *  
+ *  Copyright (c) 2001      Chris Atenasio   <chris@crud.net>
+ *  Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net>
  *
  *  based on wacom.c by
  *     Vojtech Pavlik      <vojtech@suse.cz>
@@ -11,17 +13,48 @@
  *     James E. Blair      <corvus@gnu.org>
  *     Daniel Egger        <egger@suse.de>
  *
- *
  *  Many thanks to Oliver Kuechemann for his support.
  *
  *  ChangeLog:
  *      v0.1 - Initial release
- *      v0.2 - Hack to get around fake event 28's.
+ *      v0.2 - Hack to get around fake event 28's. (Bryan W. Headley)
  *      v0.3 - Make URB dynamic (Bryan W. Headley, Jun-8-2002)
- *             (kernel 2.5.x variant, June-14-2002)
- */
-
-/*
+ *             Released to Linux 2.4.19 and 2.5.x
+ *      v0.4 - Rewrote substantial portions of the code to deal with
+ *             corrected control sequences, timing, dynamic configuration,
+ *             support of 6000U - 12000U, procfs, and macro key support
+ *             (Jan-1-2003 - Feb-5-2003, Bryan W. Headley)
+ *      v1.0 - Added support for diagnostic messages, count of messages
+ *             received from URB - Mar-8-2003, Bryan W. Headley
+ *      v1.1 - added support for tablet resolution, changed DV and proximity
+ *             some corrections - Jun-22-2003, martin schneebacher
+ *           - Added support for the sysfs interface, deprecating the
+ *             procfs interface for 2.5.x kernel. Also added support for
+ *             Wheel command. Bryan W. Headley July-15-2003.
+ *      v1.2 - Reworked jitter timer as a kernel thread. 
+ *             Bryan W. Headley November-28-2003/Jan-10-2004.
+ *      v1.3 - Repaired issue of kernel thread going nuts on single-processor
+ *             machines, introduced programmableDelay as a command line
+ *             parameter. Feb 7 2004, Bryan W. Headley.
+ *      v1.4 - Re-wire jitter so it does not require a thread. Courtesy of
+ *             Rene van Paassen. Added reporting of physical pointer device
+ *             (e.g., stylus, mouse in reports 2, 3, 4, 5. We don't know
+ *             for reports 1, 6.)
+ *             what physical device reports for reports 1, 6.) Also enabled
+ *             MOUSE and LENS tool button modes. Renamed "rubber" to "eraser".
+ *             Feb 20, 2004, Bryan W. Headley.
+ *      v1.5 - Added previousJitterable, so we don't do jitter delay when the
+ *             user is holding a button down for periods of time.
+ *
+ * NOTE:
+ *      This kernel driver is augmented by the "Aiptek" XFree86 input
+ *      driver for your X server, as well as the Gaiptek GUI Front-end
+ *      "Tablet Manager". 
+ *      These three products are highly interactive with one another, 
+ *      so therefore it's easier to document them all as one subsystem.
+ *      Please visit the project's "home page", located at, 
+ *      http://aiptektablet.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
@@ -37,373 +70,2229 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include <linux/jiffies.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/usb.h>
+#include <linux/sched.h>
+#include <asm/uaccess.h>
 #include <asm/unaligned.h>
-#include <asm/byteorder.h>
+
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v0.3"
-#define DRIVER_AUTHOR "Chris Atenasio <chris@crud.net>"
-#define DRIVER_DESC "USB Aiptek 6000U/8000U tablet driver (Linux 2.5.x)"
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_LICENSE("GPL");
+#define DRIVER_VERSION "v1.5 (May-15-2004)"
+#define DRIVER_AUTHOR  "Bryan W. Headley/Chris Atenasio"
+#define DRIVER_DESC    "Aiptek HyperPen USB Tablet Driver (Linux 2.6.x)"
 
 /*
  * Aiptek status packet:
  *
+ * (returned as Report 1 - relative coordinates from mouse and stylus)
+ *
+ *        bit7  bit6  bit5  bit4  bit3  bit2  bit1  bit0
+ * byte0   0     0     0     0     0     0     0     1
+ * byte1   0     0     0     0     0    BS2   BS    Tip
+ * byte2  X7    X6    X5    X4    X3    X2    X1    X0
+ * byte3  Y7    Y6    Y5    Y4    Y3    Y2    Y1    Y0
+ *
+ * (returned as Report 2 - absolute coordinates from the stylus)
+ *
  *        bit7  bit6  bit5  bit4  bit3  bit2  bit1  bit0
  * byte0   0     0     0     0     0     0     1     0
  * byte1  X7    X6    X5    X4    X3    X2    X1    X0
  * byte2  X15   X14   X13   X12   X11   X10   X9    X8
  * byte3  Y7    Y6    Y5    Y4    Y3    Y2    Y1    Y0
  * byte4  Y15   Y14   Y13   Y12   Y11   Y10   Y9    Y8
- * byte5   *     *     *    BS2   BS1   Tip   DV    IR
+ * byte5   *     *     *    BS2   BS1   Tip   IR    DV
  * byte6  P7    P6    P5    P4    P3    P2    P1    P0
  * byte7  P15   P14   P13   P12   P11   P10   P9    P8
  *
+ * (returned as Report 3 - absolute coordinates from the mouse)
+ *
+ *        bit7  bit6  bit5  bit4  bit3  bit2  bit1  bit0
+ * byte0   0     0     0     0     0     0     1     0
+ * byte1  X7    X6    X5    X4    X3    X2    X1    X0
+ * byte2  X15   X14   X13   X12   X11   X10   X9    X8
+ * byte3  Y7    Y6    Y5    Y4    Y3    Y2    Y1    Y0
+ * byte4  Y15   Y14   Y13   Y12   Y11   Y10   Y9    Y8
+ * byte5   *     *     *    BS2   BS1   Tip   IR    DV
+ * byte6  P7    P6    P5    P4    P3    P2    P1    P0
+ * byte7  P15   P14   P13   P12   P11   P10   P9    P8
+ *
+ * (returned as Report 4 - macrokeys from the stylus)
+ *
+ *        bit7  bit6  bit5  bit4  bit3  bit2  bit1  bit0
+ * byte0   0     0     0     0     0     1     0     0
+ * byte1   0     0     0    BS2   BS    Tip   IR    DV
+ * byte2   0     0     0     0     0     0     1     0
+ * byte3   0     0     0    K4    K3    K2    K1    K0
+ * byte4  P7    P6    P5    P4    P3    P2    P1    P0
+ * byte5  P15   P14   P13   P12   P11   P10   P9    P8
+ *
+ * (returned as Report 5 - macrokeys from the mouse)
+ *
+ *        bit7  bit6  bit5  bit4  bit3  bit2  bit1  bit0
+ * byte0   0     0     0     0     0     1     0     0
+ * byte1   0     0     0    BS2   BS    Tip   IR    DV
+ * byte2   0     0     0     0     0     0     1     0
+ * byte3   0     0     0    K4    K3    K2    K1    K0
+ * byte4  P7    P6    P5    P4    P3    P2    P1    P0
+ * byte5  P15   P14   P13   P12   P11   P10   P9    P8
+ *
  * IR: In Range = Proximity on
  * DV = Data Valid
+ * BS = Barrel Switch (as in, macro keys)
+ * BS2 also referred to as Tablet Pick
  *
- * 
  * Command Summary:
  *
+ * Use report_type CONTROL (3)
+ * Use report_id   2
+ *
  * Command/Data    Description     Return Bytes    Return Value
  * 0x10/0x00       SwitchToMouse       0
  * 0x10/0x01       SwitchToTablet      0
- * 0x18/0x04       Resolution500LPI    0
- * 0x17/0x00       FilterOn            0
+ * 0x18/0x04       SetResolution       0 
  * 0x12/0xFF       AutoGainOn          0
+ * 0x17/0x00       FilterOn            0
  * 0x01/0x00       GetXExtension       2           MaxX
  * 0x01/0x01       GetYExtension       2           MaxY
  * 0x02/0x00       GetModelCode        2           ModelCode = LOBYTE
  * 0x03/0x00       GetODMCode          2           ODMCode
  * 0x08/0x00       GetPressureLevels   2           =512
  * 0x04/0x00       GetFirmwareVersion  2           Firmware Version
- *
+ * 0x11/0x02       EnableMacroKeys     0
  *
  * To initialize the tablet:
  *
- * (1) Send command Resolution500LPI
- * (2) Option Commands (GetXExtension, GetYExtension)
- * (3) Send command SwitchToTablet
+ * (1) Send Resolution500LPI (Command)
+ * (2) Query for Model code (Option Report)
+ * (3) Query for ODM code (Option Report)
+ * (4) Query for firmware (Option Report)
+ * (5) Query for GetXExtension (Option Report)
+ * (6) Query for GetYExtension (Option Report)
+ * (7) Query for GetPressureLevels (Option Report)
+ * (8) SwitchToTablet for Absolute coordinates, or
+ *     SwitchToMouse for Relative coordinates (Command)
+ * (9) EnableMacroKeys (Command)
+ * (10) FilterOn (Command)
+ * (11) AutoGainOn (Command)
+ *
+ * (Step 9 can be omitted, but you'll then have no function keys.)
  */
 
-#define USB_VENDOR_ID_AIPTEK   0x08ca
+#define USB_VENDOR_ID_AIPTEK				0x08ca
+#define USB_REQ_GET_REPORT				0x01
+#define USB_REQ_SET_REPORT				0x09
+
+	/* PointerMode codes
+	 */
+#define AIPTEK_POINTER_ONLY_MOUSE_MODE			0
+#define AIPTEK_POINTER_ONLY_STYLUS_MODE			1
+#define AIPTEK_POINTER_EITHER_MODE			2
+
+#define AIPTEK_POINTER_ALLOW_MOUSE_MODE(a)		\
+	(a == AIPTEK_POINTER_ONLY_MOUSE_MODE ||		\
+	 a == AIPTEK_POINTER_EITHER_MODE)
+#define AIPTEK_POINTER_ALLOW_STYLUS_MODE(a)		\
+	(a == AIPTEK_POINTER_ONLY_STYLUS_MODE ||	\
+	 a == AIPTEK_POINTER_EITHER_MODE)
+
+	/* CoordinateMode code
+	 */
+#define AIPTEK_COORDINATE_RELATIVE_MODE			0
+#define AIPTEK_COORDINATE_ABSOLUTE_MODE			1
+
+       /* XTilt and YTilt values
+        */
+#define AIPTEK_TILT_MIN					(-128)
+#define AIPTEK_TILT_MAX					127
+#define AIPTEK_TILT_DISABLE				(-10101)
+
+	/* Wheel values
+	 */
+#define AIPTEK_WHEEL_MIN				0
+#define AIPTEK_WHEEL_MAX				1024
+#define AIPTEK_WHEEL_DISABLE				(-10101)
+
+	/* ToolCode values, which BTW are 0x140 .. 0x14f
+	 * We have things set up such that if TOOL_BUTTON_FIRED_BIT is
+	 * not set, we'll send one instance of AIPTEK_TOOL_BUTTON_xxx.
+	 *
+	 * Whenever the user resets the value, TOOL_BUTTON_FIRED_BIT will
+	 * get reset.
+	 */
+#define TOOL_BUTTON(x)					((x) & 0x14f)
+#define TOOL_BUTTON_FIRED(x)				((x) & 0x200)
+#define TOOL_BUTTON_FIRED_BIT				0x200
+	/* toolMode codes
+	 */
+#define AIPTEK_TOOL_BUTTON_PEN_MODE			BTN_TOOL_PEN
+#define AIPTEK_TOOL_BUTTON_PEN_MODE			BTN_TOOL_PEN
+#define AIPTEK_TOOL_BUTTON_PENCIL_MODE			BTN_TOOL_PENCIL
+#define AIPTEK_TOOL_BUTTON_BRUSH_MODE			BTN_TOOL_BRUSH
+#define AIPTEK_TOOL_BUTTON_AIRBRUSH_MODE		BTN_TOOL_AIRBRUSH
+#define AIPTEK_TOOL_BUTTON_ERASER_MODE			BTN_TOOL_RUBBER
+#define AIPTEK_TOOL_BUTTON_MOUSE_MODE			BTN_TOOL_MOUSE
+#define AIPTEK_TOOL_BUTTON_LENS_MODE			BTN_TOOL_LENS
+
+	/* Diagnostic message codes
+	 */
+#define AIPTEK_DIAGNOSTIC_NA				0
+#define AIPTEK_DIAGNOSTIC_SENDING_RELATIVE_IN_ABSOLUTE	1
+#define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE	2
+#define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED		3
+
+	/* Time to wait (in ms) to help mask hand jittering 
+	 * when pressing the stylus buttons.
+	 */
+#define AIPTEK_JITTER_DELAY_DEFAULT			50
+
+	/* Time to wait (in ms) in-between sending the tablet
+	 * a command and beginning the process of reading the return
+	 * sequence from the tablet.
+	 */
+#define AIPTEK_PROGRAMMABLE_DELAY_25		25
+#define AIPTEK_PROGRAMMABLE_DELAY_50		50
+#define AIPTEK_PROGRAMMABLE_DELAY_100		100
+#define AIPTEK_PROGRAMMABLE_DELAY_200		200
+#define AIPTEK_PROGRAMMABLE_DELAY_300		300
+#define AIPTEK_PROGRAMMABLE_DELAY_400		400
+#define AIPTEK_PROGRAMMABLE_DELAY_DEFAULT	AIPTEK_PROGRAMMABLE_DELAY_400
+
+	/* Mouse button programming
+	 */
+#define AIPTEK_MOUSE_LEFT_BUTTON		0x01
+#define AIPTEK_MOUSE_RIGHT_BUTTON		0x02
+#define AIPTEK_MOUSE_MIDDLE_BUTTON		0x04
+
+	/* Stylus button programming
+	 */
+#define AIPTEK_STYLUS_LOWER_BUTTON		0x08
+#define AIPTEK_STYLUS_UPPER_BUTTON		0x10
+
+	/* Length of incoming packet from the tablet
+	 */
+#define AIPTEK_PACKET_LENGTH			8
+
+	/* We report in EV_MISC both the proximity and
+	 * whether the report came from the stylus, tablet mouse
+	 * or "unknown" -- Unknown when the tablet is in relative
+	 * mode, because we only get report 1's.
+	 */
+#define AIPTEK_REPORT_TOOL_UNKNOWN		0x10
+#define AIPTEK_REPORT_TOOL_STYLUS		0x20
+#define AIPTEK_REPORT_TOOL_MOUSE		0x40
+
+static int programmableDelay = AIPTEK_PROGRAMMABLE_DELAY_DEFAULT;
+static int jitterDelay = AIPTEK_JITTER_DELAY_DEFAULT;
 
 struct aiptek_features {
-	char *name;
-	int pktlen;
-	int x_max;
-	int y_max;
-	int pressure_min;
-	int pressure_max;
-	usb_complete_t irq;
-	unsigned long evbit;
-	unsigned long absbit;
-	unsigned long relbit;
-	unsigned long btnbit;
-	unsigned long digibit;
+	int odmCode;		/* Tablet manufacturer code       */
+	int modelCode;		/* Tablet model code (not unique) */
+	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 {
+	int pointerMode;	/* stylus-, mouse-only or either */
+	int coordinateMode;	/* absolute/relative coords      */
+	int toolMode;		/* pen, pencil, brush, etc. tool */
+	int xTilt;		/* synthetic xTilt amount        */
+	int yTilt;		/* synthetic yTilt amount        */
+	int wheel;		/* synthetic wheel amount        */
+	int stylusButtonUpper;	/* stylus upper btn delivers...  */
+	int stylusButtonLower;	/* stylus lower btn delivers...  */
+	int mouseButtonLeft;	/* mouse left btn delivers...    */
+	int mouseButtonMiddle;	/* mouse middle btn delivers...  */
+	int mouseButtonRight;	/* mouse right btn delivers...   */
+	int programmableDelay;	/* delay for tablet programming  */
+	int jitterDelay;	/* delay for hand jittering      */
 };
 
 struct aiptek {
-	struct input_dev dev;
-	struct usb_device *usbdev;
-	struct urb *irq;
-	struct aiptek_features *features;
-	int tool;
-	int open;
+	struct input_dev inputdev;		/* input device struct           */
+	struct usb_device *usbdev;		/* usb device struct             */
+	struct urb *urb;			/* urb for incoming reports      */
+	dma_addr_t data_dma;			/* our dma stuffage              */
+	struct aiptek_features features;	/* tablet's array of features    */
+	struct aiptek_settings curSetting;	/* tablet's current programmable */
+	struct aiptek_settings newSetting;	/* ... and new param settings    */
+	unsigned int ifnum;			/* interface number for IO       */
+	int openCount;				/* module use counter            */
+	int diagnostic;				/* tablet diagnostic codes       */
+	unsigned long eventCount;		/* event count                   */
+	int inDelay;				/* jitter: in jitter delay?      */
+	unsigned long endDelay;			/* jitter: time when delay ends  */
+	int previousJitterable;			/* jitterable prev value     */
+	unsigned char *data;			/* incoming packet data          */
+};
 
-	signed char *data;
-	dma_addr_t data_dma;
+/*
+ * Permit easy lookup of keyboard events to send, versus
+ * the bitmap which comes from the tablet. This hides the
+ * issue that the F_keys are not sequentially numbered.
+ */
+static int macroKeyEvents[] = {
+	KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5,
+	KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11,
+	KEY_F12, KEY_F13, KEY_F14, KEY_F15, KEY_F16, KEY_F17,
+	KEY_F18, KEY_F19, KEY_F20, KEY_F21, KEY_F22, KEY_F23,
+	KEY_F24, KEY_STOP, KEY_AGAIN, KEY_PROPS, KEY_UNDO,
+	KEY_FRONT, KEY_COPY, KEY_OPEN, KEY_PASTE, 0
 };
 
-static void
-aiptek_irq(struct urb *urb, struct pt_regs *regs)
+/***********************************************************************
+ * Relative reports deliver values in 2's complement format to
+ * deal with negative offsets.
+ */
+static int aiptek_convert_from_2s_complement(unsigned char c)
+{
+	int ret;
+	unsigned char b = c;
+	int negate = 0;
+
+	if ((b & 0x80) != 0) {
+		b = ~b;
+		b--;
+		negate = 1;
+	}
+	ret = b;
+	ret = (negate == 1) ? -ret : ret;
+	return ret;
+}
+
+/***********************************************************************
+ * aiptek_irq can receive one of six potential reports.
+ * The documentation for each is in the body of the function.
+ *
+ * The tablet reports on several attributes per invocation of
+ * aiptek_irq. Because the Linux Input Event system allows the
+ * transmission of ONE attribute per input_report_xxx() call,
+ * collation has to be done on the other end to reconstitute
+ * a complete tablet report. Further, the number of Input Event reports
+ * submitted varies, depending on what USB report type, and circumstance.
+ * To deal with this, EV_MSC is used to indicate an 'end-of-report'
+ * message. This has been an undocumented convention understood by the kernel
+ * tablet driver and clients such as gpm and XFree86's tablet drivers.
+ *
+ * Of the information received from the tablet, the one piece I
+ * cannot transmit is the proximity bit (without resorting to an EV_MSC
+ * convention above.) I therefore have taken over REL_MISC and ABS_MISC
+ * (for relative and absolute reports, respectively) for communicating
+ * Proximity. Why two events? I thought it interesting to know if the
+ * Proximity event occured while the tablet was in absolute or relative
+ * mode.
+ *
+ * Other tablets use the notion of a certain minimum stylus pressure
+ * to infer proximity. While that could have been done, that is yet
+ * another 'by convention' behavior, the documentation for which
+ * would be spread between two (or more) pieces of software.
+ *
+ * EV_MSC usage was terminated for this purpose in Linux 2.5.x, and
+ * replaced with the input_sync() method (which emits EV_SYN.)
+ */
+
+static void aiptek_irq(struct urb *urb, struct pt_regs *regs)
 {
 	struct aiptek *aiptek = urb->context;
 	unsigned char *data = aiptek->data;
-	struct input_dev *dev = &aiptek->dev;
-	int x;
-	int y;
-	int pressure;
-	int proximity;
-	int retval;
+	struct input_dev *inputdev = &aiptek->inputdev;
+	int jitterable = 0;
+	int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck;
 
 	switch (urb->status) {
 	case 0:
-		/* success */
+		/* Success */
 		break;
+
 	case -ECONNRESET:
 	case -ENOENT:
 	case -ESHUTDOWN:
-		/* this urb is terminated, clean up */
-		dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
+		/* This urb is terminated, clean up */
+		dbg("%s - urb shutting down with status: %d",
+		    __FUNCTION__, urb->status);
 		return;
+
 	default:
-		dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
+		dbg("%s - nonzero urb status received: %d",
+		    __FUNCTION__, urb->status);
 		goto exit;
 	}
 
-	if ((data[0] & 2) == 0) {
-		dbg("received unknown report #%d", data[0]);
+	/* See if we are in a delay loop -- throw out report if true.
+	 */
+	if (aiptek->inDelay == 1 && time_after(aiptek->endDelay, jiffies)) {
+		goto exit;
 	}
 
-	input_regs(dev, regs);
+	aiptek->inDelay = 0;
+	aiptek->eventCount++;
 
-	proximity = data[5] & 0x01;
-	input_report_key(dev, BTN_TOOL_PEN, proximity);
-
-	x = le16_to_cpu(get_unaligned((u16 *) &data[1]));
-	y = le16_to_cpu(get_unaligned((u16 *) &data[3]));
-	pressure = le16_to_cpu(*(u16 *) &data[6]);
-	pressure -= aiptek->features->pressure_min;
-
-	if (pressure < 0) {
-		pressure = 0;
+	/* Report 1 delivers relative coordinates with either a stylus
+	 * or the mouse. You do not know, however, which input
+	 * tool generated the event.
+	 */
+	if (data[0] == 1) {
+		if (aiptek->curSetting.coordinateMode ==
+		    AIPTEK_COORDINATE_ABSOLUTE_MODE) {
+			aiptek->diagnostic =
+			    AIPTEK_DIAGNOSTIC_SENDING_RELATIVE_IN_ABSOLUTE;
+		} else {
+			input_regs(inputdev, regs);
+
+			x = aiptek_convert_from_2s_complement(data[2]);
+			y = aiptek_convert_from_2s_complement(data[3]);
+
+			/* jitterable keeps track of whether any button has been pressed.
+			 * We're also using it to remap the physical mouse button mask
+			 * to pseudo-settings. (We don't specifically care about it's
+			 * value after moving/transposing mouse button bitmasks, except
+			 * that a non-zero value indicates that one or more
+			 * mouse button was pressed.)
+			 */
+			jitterable = data[5] & 0x07;
+
+			left = (data[5] & aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0;
+			right = (data[5] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0;
+			middle = (data[5] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
+
+			input_report_key(inputdev, BTN_LEFT, left);
+			input_report_key(inputdev, BTN_MIDDLE, middle);
+			input_report_key(inputdev, BTN_RIGHT, right);
+			input_report_rel(inputdev, REL_X, x);
+			input_report_rel(inputdev, REL_Y, y);
+			input_report_rel(inputdev, REL_MISC, 1 | AIPTEK_REPORT_TOOL_UNKNOWN);
+
+			/* Wheel support is in the form of a single-event
+			 * firing.
+			 */
+			if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) {
+				input_report_rel(inputdev, REL_WHEEL,
+						 aiptek->curSetting.wheel);
+				aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
+			}
+			input_sync(inputdev);
+		}
 	}
-
-	if (proximity) {
-		input_report_abs(dev, ABS_X, x);
-		input_report_abs(dev, ABS_Y, y);
-		input_report_abs(dev, ABS_PRESSURE, pressure);
-		input_report_key(dev, BTN_TOUCH, data[5] & 0x04);
-		input_report_key(dev, BTN_STYLUS, data[5] & 0x08);
-		input_report_key(dev, BTN_STYLUS2, data[5] & 0x10);
+	/* Report 2 is delivered only by the stylus, and delivers
+	 * absolute coordinates.
+	 */
+	else if (data[0] == 2) {
+		if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) {
+			aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE;
+		} else if (!AIPTEK_POINTER_ALLOW_STYLUS_MODE
+			    (aiptek->curSetting.pointerMode)) {
+				aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
+		} else {
+			input_regs(inputdev, regs);
+
+			x = le16_to_cpu(get_unaligned((__u16 *) (data + 1)));
+			y = le16_to_cpu(get_unaligned((__u16 *) (data + 3)));
+			z = le16_to_cpu(get_unaligned((__u16 *) (data + 6)));
+
+			p = (data[5] & 0x01) != 0 ? 1 : 0;
+			dv = (data[5] & 0x02) != 0 ? 1 : 0;
+			tip = (data[5] & 0x04) != 0 ? 1 : 0;
+
+			/* Use jitterable to re-arrange button masks
+			 */
+			jitterable = data[5] & 0x18;
+
+			bs = (data[5] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0;
+			pck = (data[5] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0;
+
+			/* dv indicates 'data valid' (e.g., the tablet is in sync
+			 * and has delivered a "correct" report) We will ignore
+			 * all 'bad' reports...
+			 */
+			if (dv != 0) {
+				/* If we've not already sent a tool_button_?? code, do
+				 * so now. Then set FIRED_BIT so it won't be resent unless
+				 * the user forces FIRED_BIT off.
+				 */
+				if (TOOL_BUTTON_FIRED
+				    (aiptek->curSetting.toolMode) == 0) {
+					input_report_key(inputdev,
+							 TOOL_BUTTON(aiptek->curSetting.toolMode),
+							 1);
+					aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT;
+				}
+
+				if (p != 0) {
+					input_report_abs(inputdev, ABS_X, x);
+					input_report_abs(inputdev, ABS_Y, y);
+					input_report_abs(inputdev, ABS_PRESSURE, z);
+
+					input_report_key(inputdev, BTN_TOUCH, tip);
+					input_report_key(inputdev, BTN_STYLUS, bs);
+					input_report_key(inputdev, BTN_STYLUS2, pck);
+
+					if (aiptek->curSetting.xTilt !=
+					    AIPTEK_TILT_DISABLE) {
+						input_report_abs(inputdev,
+								 ABS_TILT_X,
+								 aiptek->curSetting.xTilt);
+					}
+					if (aiptek->curSetting.yTilt != AIPTEK_TILT_DISABLE) {
+						input_report_abs(inputdev,
+								 ABS_TILT_Y,
+								 aiptek->curSetting.yTilt);
+					}
+
+					/* Wheel support is in the form of a single-event
+					 * firing.
+					 */
+					if (aiptek->curSetting.wheel !=
+					    AIPTEK_WHEEL_DISABLE) {
+						input_report_abs(inputdev,
+								 ABS_WHEEL,
+								 aiptek->curSetting.wheel);
+						aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
+					}
+				}
+				input_report_abs(inputdev, ABS_MISC, p | AIPTEK_REPORT_TOOL_STYLUS);
+				input_sync(inputdev);
+			}
+		}
+	}
+	/* Report 3's come from the mouse in absolute mode.
+	 */
+	else if (data[0] == 3) {
+		if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) {
+			aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE;
+		} else if (!AIPTEK_POINTER_ALLOW_MOUSE_MODE
+			(aiptek->curSetting.pointerMode)) {
+			aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
+		} else {
+			input_regs(inputdev, regs);
+			x = le16_to_cpu(get_unaligned((__u16 *) (data + 1)));
+			y = le16_to_cpu(get_unaligned((__u16 *) (data + 3)));
+
+			jitterable = data[5] & 0x1c;
+
+			p = (data[5] & 0x01) != 0 ? 1 : 0;
+			dv = (data[5] & 0x02) != 0 ? 1 : 0;
+			left = (data[5] & aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0;
+			right = (data[5] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0;
+			middle = (data[5] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
+
+			if (dv != 0) {
+				/* If we've not already sent a tool_button_?? code, do
+				 * so now. Then set FIRED_BIT so it won't be resent unless
+				 * the user forces FIRED_BIT off.
+				 */
+				if (TOOL_BUTTON_FIRED
+				    (aiptek->curSetting.toolMode) == 0) {
+					input_report_key(inputdev,
+							 TOOL_BUTTON(aiptek->curSetting.toolMode),
+							 1);
+					aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT;
+				}
+
+				if (p != 0) {
+					input_report_abs(inputdev, ABS_X, x);
+					input_report_abs(inputdev, ABS_Y, y);
+
+					input_report_key(inputdev, BTN_LEFT, left);
+					input_report_key(inputdev, BTN_MIDDLE, middle);
+					input_report_key(inputdev, BTN_RIGHT, right);
+
+					/* Wheel support is in the form of a single-event
+					 * firing.
+					 */
+					if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) {
+						input_report_abs(inputdev,
+								 ABS_WHEEL,
+								 aiptek->curSetting.wheel);
+						aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
+					}
+				}
+				input_report_rel(inputdev, REL_MISC, p | AIPTEK_REPORT_TOOL_MOUSE);
+				input_sync(inputdev);
+			}
+		}
+	}
+	/* Report 4s come from the macro keys when pressed by stylus
+	 */
+	else if (data[0] == 4) {
+		jitterable = data[1] & 0x18;
+
+		p = (data[1] & 0x01) != 0 ? 1 : 0;
+		dv = (data[1] & 0x02) != 0 ? 1 : 0;
+		tip = (data[1] & 0x04) != 0 ? 1 : 0;
+		bs = (data[1] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0;
+		pck = (data[1] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0;
+
+		macro = data[3];
+		z = le16_to_cpu(get_unaligned((__u16 *) (data + 4)));
+
+		if (dv != 0) {
+			input_regs(inputdev, regs);
+
+			/* If we've not already sent a tool_button_?? code, do
+			 * so now. Then set FIRED_BIT so it won't be resent unless
+			 * the user forces FIRED_BIT off.
+			 */
+			if (TOOL_BUTTON_FIRED(aiptek->curSetting.toolMode) == 0) {
+				input_report_key(inputdev,
+						 TOOL_BUTTON(aiptek->curSetting.toolMode),
+						 1);
+				aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT;
+			}
+
+			if (p != 0) {
+				input_report_key(inputdev, BTN_TOUCH, tip);
+				input_report_key(inputdev, BTN_STYLUS, bs);
+				input_report_key(inputdev, BTN_STYLUS2, pck);
+				input_report_abs(inputdev, ABS_PRESSURE, z);
+			}
+
+			/* For safety, we're sending key 'break' codes for the
+			 * neighboring macro keys.
+			 */
+			if (macro > 0) {
+				input_report_key(inputdev,
+						 macroKeyEvents[macro - 1], 0);
+			}
+			if (macro < 25) {
+				input_report_key(inputdev,
+						 macroKeyEvents[macro + 1], 0);
+			}
+			input_report_key(inputdev, macroKeyEvents[macro], p);
+			input_report_abs(inputdev, ABS_MISC,
+					 p | AIPTEK_REPORT_TOOL_STYLUS);
+			input_sync(inputdev);
+		}
+	}
+	/* Report 5s come from the macro keys when pressed by mouse
+	 */
+	else if (data[0] == 5) {
+		jitterable = data[1] & 0x1c;
+
+		p = (data[1] & 0x01) != 0 ? 1 : 0;
+		dv = (data[1] & 0x02) != 0 ? 1 : 0;
+		left = (data[1]& aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0;
+		right = (data[1] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0;
+		middle = (data[1] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
+		macro = data[3];
+
+		if (dv != 0) {
+			input_regs(inputdev, regs);
+
+			/* If we've not already sent a tool_button_?? code, do
+			 * so now. Then set FIRED_BIT so it won't be resent unless
+			 * the user forces FIRED_BIT off.
+			 */
+			if (TOOL_BUTTON_FIRED(aiptek->curSetting.toolMode) == 0) {
+				input_report_key(inputdev,
+						 TOOL_BUTTON(aiptek->curSetting.toolMode),
+						 1);
+				aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT;
+			}
+
+			if (p != 0) {
+				input_report_key(inputdev, BTN_LEFT, left);
+				input_report_key(inputdev, BTN_MIDDLE, middle);
+				input_report_key(inputdev, BTN_RIGHT, right);
+			}
+
+			/* For safety, we're sending key 'break' codes for the
+			 * neighboring macro keys.
+			 */
+			if (macro > 0) {
+				input_report_key(inputdev,
+						 macroKeyEvents[macro - 1], 0);
+			}
+			if (macro < 25) {
+				input_report_key(inputdev,
+						 macroKeyEvents[macro + 1], 0);
+			}
+
+			input_report_key(inputdev, macroKeyEvents[macro], 1);
+			input_report_rel(inputdev, ABS_MISC,
+					 p | AIPTEK_REPORT_TOOL_MOUSE);
+			input_sync(inputdev);
+		}
+	}
+	/* We have no idea which tool can generate a report 6. Theoretically,
+	 * neither need to, having been given reports 4 & 5 for such use.
+	 * However, report 6 is the 'official-looking' report for macroKeys;
+	 * reports 4 & 5 supposively are used to support unnamed, unknown
+	 * hat switches (which just so happen to be the macroKeys.)
+	 */
+	else if (data[0] == 6) {
+		macro = le16_to_cpu(get_unaligned((__u16 *) (data + 1)));
+		input_regs(inputdev, regs);
+
+		if (macro > 0) {
+			input_report_key(inputdev, macroKeyEvents[macro - 1],
+					 0);
+		}
+		if (macro < 25) {
+			input_report_key(inputdev, macroKeyEvents[macro + 1],
+					 0);
+		}
+
+		/* If we've not already sent a tool_button_?? code, do
+		 * so now. Then set FIRED_BIT so it won't be resent unless
+		 * the user forces FIRED_BIT off.
+		 */
+		if (TOOL_BUTTON_FIRED(aiptek->curSetting.toolMode) == 0) {
+			input_report_key(inputdev,
+					 TOOL_BUTTON(aiptek->curSetting.
+						     toolMode), 1);
+			aiptek->curSetting.toolMode |= TOOL_BUTTON_FIRED_BIT;
+		}
+
+		input_report_key(inputdev, macroKeyEvents[macro], 1);
+		input_report_abs(inputdev, ABS_MISC,
+				 1 | AIPTEK_REPORT_TOOL_UNKNOWN);
+		input_sync(inputdev);
+	} else {
+		dbg("Unknown report %d", data[0]);
 	}
 
-	input_sync(dev);
+	/* Jitter may occur when the user presses a button on the stlyus
+	 * or the mouse. What we do to prevent that is wait 'x' milliseconds
+	 * following a 'jitterable' event, which should give the hand some time
+	 * stabilize itself.
+	 *
+	 * We just introduced aiptek->previousJitterable to carry forth the
+	 * notion that jitter occurs when the button state changes from on to off:
+	 * a person drawing, holding a button down is not subject to jittering.
+	 * With that in mind, changing from upper button depressed to lower button
+	 * WILL transition through a jitter delay.
+	 */
+
+	if (aiptek->previousJitterable != jitterable &&
+	    aiptek->curSetting.jitterDelay != 0 && aiptek->inDelay != 1) {
+		aiptek->endDelay = jiffies +
+		    ((aiptek->curSetting.jitterDelay * HZ) / 1000);
+		aiptek->inDelay = 1;
+	}
+	aiptek->previousJitterable = jitterable;
 
 exit:
-	retval = usb_submit_urb (urb, GFP_ATOMIC);
-	if (retval)
-		err ("%s - usb_submit_urb failed with result %d",
-		     __FUNCTION__, retval);
+	retval = usb_submit_urb(urb, GFP_ATOMIC);
+	if (retval != 0) {
+		err("%s - usb_submit_urb failed with result %d",
+		    __FUNCTION__, retval);
+	}
 }
 
-struct aiptek_features aiptek_features[] = {
-	{"Aiptek 6000U/8000U",
-	 8, 3000, 2250, 26, 511, aiptek_irq, 0, 0, 0, 0},
-	{NULL, 0}
-};
-
+/***********************************************************************
+ * These are the USB id's known so far. We do not identify them to
+ * specific Aiptek model numbers, because there has been overlaps,
+ * use, and reuse of id's in existing models. Certain models have
+ * been known to use more than one ID, indicative perhaps of
+ * manufacturing revisions. In any event, we consider these 
+ * IDs to not be model-specific nor unique.
+ */
 struct usb_device_id aiptek_ids[] = {
-	{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20), .driver_info = 0},
+	{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x01)},
+	{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x10)},
+	{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20)},
+	{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x21)},
+	{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x22)},
+	{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x23)},
+	{USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x24)},
 	{}
 };
 
 MODULE_DEVICE_TABLE(usb, aiptek_ids);
 
-static int
-aiptek_open(struct input_dev *dev)
+/***********************************************************************
+ * Open an instance of the tablet driver.
+ */
+static int aiptek_open(struct input_dev *inputdev)
 {
-	struct aiptek *aiptek = dev->private;
+	struct aiptek *aiptek = inputdev->private;
 
-	if (aiptek->open++)
+	if (aiptek->openCount++ > 0) {
 		return 0;
+	}
 
-	aiptek->irq->dev = aiptek->usbdev;
-	if (usb_submit_urb(aiptek->irq, GFP_KERNEL)) {
-		aiptek->open--;
+	aiptek->urb->dev = aiptek->usbdev;
+	if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) {
+		aiptek->openCount--;
 		return -EIO;
 	}
 
 	return 0;
 }
 
-static void
-aiptek_close(struct input_dev *dev)
+/***********************************************************************
+ * Close an instance of the tablet driver.
+ */
+static void aiptek_close(struct input_dev *inputdev)
 {
-	struct aiptek *aiptek = dev->private;
+	struct aiptek *aiptek = inputdev->private;
 
-	if (!--aiptek->open)
-		usb_unlink_urb(aiptek->irq);
+	if (--aiptek->openCount == 0) {
+		usb_unlink_urb(aiptek->urb);
+	}
+}
+
+/***********************************************************************
+ * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x, 
+ * where they were known as usb_set_report and usb_get_report.
+ */
+static int
+aiptek_set_report(struct aiptek *aiptek,
+		  unsigned char report_type,
+		  unsigned char report_id, void *buffer, int size)
+{
+	return usb_control_msg(aiptek->usbdev,
+			       usb_sndctrlpipe(aiptek->usbdev, 0),
+			       USB_REQ_SET_REPORT,
+			       USB_TYPE_CLASS | USB_RECIP_INTERFACE |
+			       USB_DIR_OUT, (report_type << 8) + report_id,
+			       aiptek->ifnum, buffer, size, 5 * HZ);
 }
 
-#define USB_REQ_SET_REPORT	0x09
 static int
-usb_set_report(struct usb_device *dev, struct usb_host_interface *inter, unsigned char type,
-		unsigned char id, void *buf, int size)
+aiptek_get_report(struct aiptek *aiptek,
+		  unsigned char report_type,
+		  unsigned char report_id, void *buffer, int size)
 {
-	return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-		USB_REQ_SET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-		(type << 8) + id, inter->desc.bInterfaceNumber, buf, size, HZ);
+	return usb_control_msg(aiptek->usbdev,
+			       usb_rcvctrlpipe(aiptek->usbdev, 0),
+			       USB_REQ_GET_REPORT,
+			       USB_TYPE_CLASS | USB_RECIP_INTERFACE |
+			       USB_DIR_IN, (report_type << 8) + report_id,
+			       aiptek->ifnum, buffer, size, 5 * HZ);
 }
 
+/***********************************************************************
+ * Send a command to the tablet.
+ */
 static int
-aiptek_command(struct usb_device *dev, struct usb_host_interface *inter,
-	       unsigned char command, unsigned char data)
+aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data)
 {
+	const int sizeof_buf = 3 * sizeof(u8);
+	int ret;
 	u8 *buf;
-	int err;
-	
-	buf = kmalloc(3, GFP_KERNEL);
+
+	buf = kmalloc(sizeof_buf, GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 
-	buf[0] = 4;
+	buf[0] = 2;
 	buf[1] = command;
 	buf[2] = data;
 
-	if ((err = usb_set_report(dev, inter, 3, 2, buf, 3)) != 3) {
-		dbg("aiptek_command: 0x%x 0x%x\n", command, data);
+	if ((ret =
+	     aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) {
+		dbg("aiptek_program: failed, tried to send: 0x%02x 0x%02x",
+		    command, data);
 	}
-	
 	kfree(buf);
-	return err < 0 ? err : 0;
+	return ret < 0 ? ret : 0;
 }
 
-static int 
-aiptek_probe(struct usb_interface *intf,
-	     const struct usb_device_id *id)
+/***********************************************************************
+ * Retrieve information from the tablet. Querying info is defined as first
+ * sending the {command,data} sequence as a command, followed by a wait
+ * (aka, "programmaticDelay") and then a "read" request.
+ */
+static int
+aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data)
 {
-	struct usb_device *dev = interface_to_usbdev (intf);
-	struct usb_host_interface *interface = intf->cur_altsetting;
-	struct usb_endpoint_descriptor *endpoint;
-	struct aiptek *aiptek;
-	int err = -ENOMEM;
+	const int sizeof_buf = 3 * sizeof(u8);
+	int ret;
+	u8 *buf;
+
+	buf = kmalloc(sizeof_buf, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
 
-	if (!(aiptek = kmalloc(sizeof (struct aiptek), GFP_KERNEL)))
-		goto error_out_noalloc;
+	buf[0] = 2;
+	buf[1] = command;
+	buf[2] = data;
 
-	memset(aiptek, 0, sizeof (struct aiptek));
+	if (aiptek_command(aiptek, command, data) != 0) {
+		kfree(buf);
+		return -EIO;
+	}
+	msleep(aiptek->curSetting.programmableDelay);
 
-	aiptek->data = usb_buffer_alloc(dev, 10, GFP_KERNEL, &aiptek->data_dma);
-	if (!aiptek->data) {
-		goto error_out_nobuf;
+	if ((ret =
+	     aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) {
+		dbg("aiptek_query failed: returned 0x%02x 0x%02x 0x%02x",
+		    buf[0], buf[1], buf[2]);
+		ret = -EIO;
+	} else {
+		ret = le16_to_cpu(get_unaligned((__u16 *) (buf + 1)));
 	}
+	kfree(buf);
+	return ret;
+}
 
-	aiptek->irq = usb_alloc_urb(0, GFP_KERNEL);
-	if (!aiptek->irq) {
-		goto error_out_nourb;
+/***********************************************************************
+ * Program the tablet into either absolute or relative mode.
+ * We also get information about the tablet's size.
+ */
+static int aiptek_program_tablet(struct aiptek *aiptek)
+{
+	int ret;
+	/* Execute Resolution500LPI */
+	if ((ret = aiptek_command(aiptek, 0x18, 0x04)) < 0)
+		return ret;
+
+	/* Query getModelCode */
+	if ((ret = aiptek_query(aiptek, 0x02, 0x00)) < 0)
+		return ret;
+	aiptek->features.modelCode = ret & 0xff;
+
+	/* Query getODMCode */
+	if ((ret = aiptek_query(aiptek, 0x03, 0x00)) < 0)
+		return ret;
+	aiptek->features.odmCode = ret;
+
+	/* Query getFirmwareCode */
+	if ((ret = aiptek_query(aiptek, 0x04, 0x00)) < 0)
+		return ret;
+	aiptek->features.firmwareCode = ret;
+
+	/* Query getXextension */
+	if ((ret = aiptek_query(aiptek, 0x01, 0x00)) < 0)
+		return ret;
+	aiptek->inputdev.absmin[ABS_X] = 0;
+	aiptek->inputdev.absmax[ABS_X] = ret - 1;
+
+	/* Query getYextension */
+	if ((ret = aiptek_query(aiptek, 0x01, 0x01)) < 0)
+		return ret;
+	aiptek->inputdev.absmin[ABS_Y] = 0;
+	aiptek->inputdev.absmax[ABS_Y] = ret - 1;
+
+	/* Query getPressureLevels */
+	if ((ret = aiptek_query(aiptek, 0x08, 0x00)) < 0)
+		return ret;
+	aiptek->inputdev.absmin[ABS_PRESSURE] = 0;
+	aiptek->inputdev.absmax[ABS_PRESSURE] = ret - 1;
+
+	/* Depending on whether we are in absolute or relative mode, we will
+	 * do a switchToTablet(absolute) or switchToMouse(relative) command.
+	 */
+	if (aiptek->curSetting.coordinateMode ==
+	    AIPTEK_COORDINATE_ABSOLUTE_MODE) {
+		/* Execute switchToTablet */
+		if ((ret = aiptek_command(aiptek, 0x10, 0x01)) < 0) {
+			return ret;
+		}
+	} else {
+		/* Execute switchToMouse */
+		if ((ret = aiptek_command(aiptek, 0x10, 0x00)) < 0) {
+			return ret;
+		}
 	}
 
-	/* Resolution500LPI */
-	err = aiptek_command(dev, interface, 0x18, 0x04);
-	if (err)
-		goto error_out;
+	/* Enable the macro keys */
+	if ((ret = aiptek_command(aiptek, 0x11, 0x02)) < 0)
+		return ret;
+#if 0
+	/* Execute FilterOn */
+	if ((ret = aiptek_command(aiptek, 0x17, 0x00)) < 0)
+		return ret;
+#endif
+
+	/* Execute AutoGainOn */
+	if ((ret = aiptek_command(aiptek, 0x12, 0xff)) < 0)
+		return ret;
+
+	/* Reset the eventCount, so we track events from last (re)programming
+	 */
+	aiptek->diagnostic = AIPTEK_DIAGNOSTIC_NA;
+	aiptek->eventCount = 0;
 
-	/* SwitchToTablet */
-	err = aiptek_command(dev, interface, 0x10, 0x01);
-	if (err)
-		goto error_out;
+	return 0;
+}
+
+/***********************************************************************
+ * Sysfs functions. Sysfs prefers that individually-tunable parameters
+ * exist in their separate pseudo-files. Summary data that is immutable
+ * may exist in a singular file so long as you don't define a writeable
+ * interface.
+ */
 
-	aiptek->features = aiptek_features + id->driver_info;
+/***********************************************************************
+ * support the 'size' file -- display support
+ */
+static ssize_t show_tabletSize(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
 
-	aiptek->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC) |
-	    aiptek->features->evbit;
+	if (aiptek == NULL)
+		return 0;
 
-	aiptek->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) |
-	    BIT(ABS_MISC) | aiptek->features->absbit;
+	return snprintf(buf, PAGE_SIZE, "%dx%d\n",
+			aiptek->inputdev.absmax[ABS_X] + 1,
+			aiptek->inputdev.absmax[ABS_Y] + 1);
+}
 
-	aiptek->dev.relbit[0] |= aiptek->features->relbit;
+/* These structs define the sysfs files, param #1 is the name of the
+ * file, param 2 is the file permissions, param 3 & 4 are to the
+ * output generator and input parser routines. Absence of a routine is
+ * permitted -- it only means can't either 'cat' the file, or send data
+ * to it.
+ */
+static DEVICE_ATTR(size, S_IRUGO, show_tabletSize, NULL);
 
-	aiptek->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) |
-	    BIT(BTN_MIDDLE) | aiptek->features->btnbit;
+/***********************************************************************
+ * support routines for the 'product_id' file
+ */
+static ssize_t show_tabletProductId(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
 
-	aiptek->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) |
-	    BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOUCH) |
-	    BIT(BTN_STYLUS) | BIT(BTN_STYLUS2) | aiptek->features->digibit;
+	if (aiptek == NULL)
+		return 0;
 
-	aiptek->dev.mscbit[0] = BIT(MSC_SERIAL);
+	return snprintf(buf, PAGE_SIZE, "0x%04x\n",
+			aiptek->inputdev.id.product);
+}
 
-	aiptek->dev.absmax[ABS_X] = aiptek->features->x_max;
-	aiptek->dev.absmax[ABS_Y] = aiptek->features->y_max;
-	aiptek->dev.absmax[ABS_PRESSURE] = aiptek->features->pressure_max -
-	    aiptek->features->pressure_min;
+static DEVICE_ATTR(product_id, S_IRUGO, show_tabletProductId, NULL);
 
-	aiptek->dev.absfuzz[ABS_X] = 0;
-	aiptek->dev.absfuzz[ABS_Y] = 0;
+/***********************************************************************
+ * support routines for the 'vendor_id' file
+ */
+static ssize_t show_tabletVendorId(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
 
-	aiptek->dev.private = aiptek;
-	aiptek->dev.open = aiptek_open;
-	aiptek->dev.close = aiptek_close;
+	if (aiptek == NULL)
+		return 0;
 
-	aiptek->dev.name = aiptek->features->name;
-	aiptek->dev.id.bustype = BUS_USB;
-	aiptek->dev.id.vendor = dev->descriptor.idVendor;
-	aiptek->dev.id.product = dev->descriptor.idProduct;
-	aiptek->dev.id.version = dev->descriptor.bcdDevice;
-	aiptek->dev.dev = &intf->dev;
-	aiptek->usbdev = dev;
+	return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->inputdev.id.vendor);
+}
 
-	endpoint = &intf->altsetting[0].endpoint[0].desc;
+static DEVICE_ATTR(vendor_id, S_IRUGO, show_tabletVendorId, NULL);
 
-	if (aiptek->features->pktlen > 10)
-		BUG();
+/***********************************************************************
+ * support routines for the 'vendor' file
+ */
+static ssize_t show_tabletManufacturer(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	int retval;
 
-	usb_fill_int_urb(aiptek->irq, dev,
-			 usb_rcvintpipe(dev, endpoint->bEndpointAddress),
-			 aiptek->data, aiptek->features->pktlen,
-			 aiptek->features->irq, aiptek, endpoint->bInterval);
-	aiptek->irq->transfer_dma = aiptek->data_dma;
-	aiptek->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+	if (aiptek == NULL)
+		return 0;
 
-	input_register_device(&aiptek->dev);
+	retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->features.manuName);
+	return retval;
+}
 
-	printk(KERN_INFO "input: %s on usb%d:%d\n",
-	       aiptek->features->name, dev->bus->busnum, dev->devnum);
+static DEVICE_ATTR(vendor, S_IRUGO, show_tabletManufacturer, NULL);
 
-	usb_set_intfdata(intf, aiptek);
-	return 0;
+/***********************************************************************
+ * support routines for the 'product' file
+ */
+static ssize_t show_tabletProduct(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	int retval;
 
-error_out:
-	usb_free_urb(aiptek->irq);
-error_out_nourb:
-	usb_buffer_free(dev, 10, aiptek->data, aiptek->data_dma);
-error_out_nobuf:
-	kfree(aiptek);
-error_out_noalloc:
-	return err;
-	
+	if (aiptek == NULL)
+		return 0;
+
+	retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->features.prodName);
+	return retval;
 }
 
-static void
-aiptek_disconnect(struct usb_interface *intf)
+static DEVICE_ATTR(product, S_IRUGO, show_tabletProduct, NULL);
+
+/***********************************************************************
+ * support routines for the 'pointer_mode' file. Note that this file
+ * both displays current setting and allows reprogramming.
+ */
+static ssize_t show_tabletPointerMode(struct device *dev, char *buf)
 {
-	struct aiptek *aiptek  = usb_get_intfdata (intf);
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *s;
 
-	usb_set_intfdata(intf, NULL);
-	if (aiptek) {
-		usb_unlink_urb(aiptek->irq);
-		input_unregister_device(&aiptek->dev);
-		usb_free_urb(aiptek->irq);
-		usb_buffer_free(interface_to_usbdev(intf), 10, aiptek->data, aiptek->data_dma);
+	if (aiptek == NULL)
+		return 0;
+
+	switch (aiptek->curSetting.pointerMode) {
+	case AIPTEK_POINTER_ONLY_STYLUS_MODE:
+		s = "stylus";
+		break;
+
+	case AIPTEK_POINTER_ONLY_MOUSE_MODE:
+		s = "mouse";
+		break;
+
+	case AIPTEK_POINTER_EITHER_MODE:
+		s = "either";
+		break;
+
+	default:
+		s = "unknown";
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%s\n", s);
+}
+
+static ssize_t
+store_tabletPointerMode(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "stylus") == 0) {
+		aiptek->newSetting.pointerMode =
+		    AIPTEK_POINTER_ONLY_STYLUS_MODE;
+	} else if (strcmp(buf, "mouse") == 0) {
+		aiptek->newSetting.pointerMode = AIPTEK_POINTER_ONLY_MOUSE_MODE;
+	} else if (strcmp(buf, "either") == 0) {
+		aiptek->newSetting.pointerMode = AIPTEK_POINTER_EITHER_MODE;
+	}
+	return count;
+}
+
+static DEVICE_ATTR(pointer_mode,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletPointerMode, store_tabletPointerMode);
+
+/***********************************************************************
+ * support routines for the 'coordinate_mode' file. Note that this file
+ * both displays current setting and allows reprogramming.
+ */
+static ssize_t show_tabletCoordinateMode(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *s;
+
+	if (aiptek == NULL)
+		return 0;
+
+	switch (aiptek->curSetting.coordinateMode) {
+	case AIPTEK_COORDINATE_ABSOLUTE_MODE:
+		s = "absolute";
+		break;
+
+	case AIPTEK_COORDINATE_RELATIVE_MODE:
+		s = "relative";
+		break;
+
+	default:
+		s = "unknown";
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%s\n", s);
+}
+
+static ssize_t
+store_tabletCoordinateMode(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "absolute") == 0) {
+		aiptek->newSetting.pointerMode =
+		    AIPTEK_COORDINATE_ABSOLUTE_MODE;
+	} else if (strcmp(buf, "relative") == 0) {
+		aiptek->newSetting.pointerMode =
+		    AIPTEK_COORDINATE_RELATIVE_MODE;
+	}
+	return count;
+}
+
+static DEVICE_ATTR(coordinate_mode,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletCoordinateMode, store_tabletCoordinateMode);
+
+/***********************************************************************
+ * support routines for the 'tool_mode' file. Note that this file
+ * both displays current setting and allows reprogramming.
+ */
+static ssize_t show_tabletToolMode(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *s;
+
+	if (aiptek == NULL)
+		return 0;
+
+	switch (TOOL_BUTTON(aiptek->curSetting.toolMode)) {
+	case AIPTEK_TOOL_BUTTON_MOUSE_MODE:
+		s = "mouse";
+		break;
+
+	case AIPTEK_TOOL_BUTTON_ERASER_MODE:
+		s = "eraser";
+		break;
+
+	case AIPTEK_TOOL_BUTTON_PENCIL_MODE:
+		s = "pencil";
+		break;
+
+	case AIPTEK_TOOL_BUTTON_PEN_MODE:
+		s = "pen";
+		break;
+
+	case AIPTEK_TOOL_BUTTON_BRUSH_MODE:
+		s = "brush";
+		break;
+
+	case AIPTEK_TOOL_BUTTON_AIRBRUSH_MODE:
+		s = "airbrush";
+		break;
+
+	case AIPTEK_TOOL_BUTTON_LENS_MODE:
+		s = "lens";
+		break;
+
+	default:
+		s = "unknown";
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%s\n", s);
+}
+
+static ssize_t
+store_tabletToolMode(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "mouse") == 0) {
+		aiptek->newSetting.toolMode = AIPTEK_TOOL_BUTTON_MOUSE_MODE;
+	} else if (strcmp(buf, "eraser") == 0) {
+		aiptek->newSetting.toolMode = AIPTEK_TOOL_BUTTON_ERASER_MODE;
+	} else if (strcmp(buf, "pencil") == 0) {
+		aiptek->newSetting.toolMode = AIPTEK_TOOL_BUTTON_PENCIL_MODE;
+	} else if (strcmp(buf, "pen") == 0) {
+		aiptek->newSetting.toolMode = AIPTEK_TOOL_BUTTON_PEN_MODE;
+	} else if (strcmp(buf, "brush") == 0) {
+		aiptek->newSetting.toolMode = AIPTEK_TOOL_BUTTON_BRUSH_MODE;
+	} else if (strcmp(buf, "airbrush") == 0) {
+		aiptek->newSetting.toolMode = AIPTEK_TOOL_BUTTON_AIRBRUSH_MODE;
+	} else if (strcmp(buf, "lens") == 0) {
+		aiptek->newSetting.toolMode = AIPTEK_TOOL_BUTTON_LENS_MODE;
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(tool_mode,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletToolMode, store_tabletToolMode);
+
+/***********************************************************************
+ * support routines for the 'xtilt' file. Note that this file
+ * both displays current setting and allows reprogramming.
+ */
+static ssize_t show_tabletXtilt(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (aiptek->curSetting.xTilt == AIPTEK_TILT_DISABLE) {
+		return snprintf(buf, PAGE_SIZE, "disable\n");
+	} else {
+		return snprintf(buf, PAGE_SIZE, "%d\n",
+				aiptek->curSetting.xTilt);
+	}
+}
+
+static ssize_t
+store_tabletXtilt(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	int x;
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "disable") == 0) {
+		aiptek->newSetting.xTilt = AIPTEK_TILT_DISABLE;
+	} else {
+		x = (int)simple_strtol(buf, 0, 10);
+		if (x >= AIPTEK_TILT_MIN && x <= AIPTEK_TILT_MAX) {
+			aiptek->newSetting.xTilt = x;
+		}
+	}
+	return count;
+}
+
+static DEVICE_ATTR(xtilt,
+		   S_IRUGO | S_IWUGO, show_tabletXtilt, store_tabletXtilt);
+
+/***********************************************************************
+ * support routines for the 'ytilt' file. Note that this file
+ * both displays current setting and allows reprogramming.
+ */
+static ssize_t show_tabletYtilt(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (aiptek->curSetting.yTilt == AIPTEK_TILT_DISABLE) {
+		return snprintf(buf, PAGE_SIZE, "disable\n");
+	} else {
+		return snprintf(buf, PAGE_SIZE, "%d\n",
+				aiptek->curSetting.yTilt);
+	}
+}
+
+static ssize_t
+store_tabletYtilt(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	int y;
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "disable") == 0) {
+		aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE;
+	} else {
+		y = (int)simple_strtol(buf, 0, 10);
+		if (y >= AIPTEK_TILT_MIN && y <= AIPTEK_TILT_MAX) {
+			aiptek->newSetting.yTilt = y;
+		}
+	}
+	return count;
+}
+
+static DEVICE_ATTR(ytilt,
+		   S_IRUGO | S_IWUGO, show_tabletYtilt, store_tabletYtilt);
+
+/***********************************************************************
+ * support routines for the 'jitter' file. Note that this file
+ * both displays current setting and allows reprogramming.
+ */
+static ssize_t show_tabletJitterDelay(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "%d\n", aiptek->curSetting.jitterDelay);
+}
+
+static ssize_t
+store_tabletJitterDelay(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	aiptek->newSetting.jitterDelay = (int)simple_strtol(buf, 0, 10);
+	return count;
+}
+
+static DEVICE_ATTR(jitter,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletJitterDelay, store_tabletJitterDelay);
+
+/***********************************************************************
+ * support routines for the 'delay' file. Note that this file
+ * both displays current setting and allows reprogramming.
+ */
+static ssize_t show_tabletProgrammableDelay(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "%d\n",
+			aiptek->curSetting.programmableDelay);
+}
+
+static ssize_t
+store_tabletProgrammableDelay(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	aiptek->newSetting.programmableDelay = (int)simple_strtol(buf, 0, 10);
+	return count;
+}
+
+static DEVICE_ATTR(delay,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletProgrammableDelay, store_tabletProgrammableDelay);
+
+/***********************************************************************
+ * support routines for the 'input_path' file. Note that this file
+ * only displays current setting.
+ */
+static ssize_t show_tabletInputDevice(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "/dev/input/%s\n",
+			aiptek->features.inputPath);
+}
+
+static DEVICE_ATTR(input_path, S_IRUGO, show_tabletInputDevice, NULL);
+
+/***********************************************************************
+ * support routines for the 'event_count' file. Note that this file
+ * only displays current setting.
+ */
+static ssize_t show_tabletEventsReceived(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "%ld\n", aiptek->eventCount);
+}
+
+static DEVICE_ATTR(event_count, S_IRUGO, show_tabletEventsReceived, NULL);
+
+/***********************************************************************
+ * support routines for the 'diagnostic' file. Note that this file
+ * only displays current setting.
+ */
+static ssize_t show_tabletDiagnosticMessage(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *retMsg;
+
+	if (aiptek == NULL)
+		return 0;
+
+	switch (aiptek->diagnostic) {
+	case AIPTEK_DIAGNOSTIC_NA:
+		retMsg = "no errors\n";
+		break;
+
+	case AIPTEK_DIAGNOSTIC_SENDING_RELATIVE_IN_ABSOLUTE:
+		retMsg = "Error: receiving relative reports\n";
+		break;
+
+	case AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE:
+		retMsg = "Error: receiving absolute reports\n";
+		break;
+
+	case AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED:
+		if (aiptek->curSetting.pointerMode ==
+		    AIPTEK_POINTER_ONLY_MOUSE_MODE) {
+			retMsg = "Error: receiving stylus reports\n";
+		} else {
+			retMsg = "Error: receiving mouse reports\n";
+		}
+		break;
+
+	default:
+		return 0;
+	}
+	return snprintf(buf, PAGE_SIZE, retMsg);
+}
+
+static DEVICE_ATTR(diagnostic, S_IRUGO, show_tabletDiagnosticMessage, NULL);
+
+/***********************************************************************
+ * support routines for the 'stylus_upper' file. Note that this file
+ * both displays current setting and allows for setting changing.
+ */
+static ssize_t show_tabletStylusUpper(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *s;
+
+	if (aiptek == NULL)
+		return 0;
+
+	switch (aiptek->curSetting.stylusButtonUpper) {
+	case AIPTEK_STYLUS_UPPER_BUTTON:
+		s = "upper";
+		break;
+
+	case AIPTEK_STYLUS_LOWER_BUTTON:
+		s = "lower";
+		break;
+
+	default:
+		s = "unknown";
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%s\n", s);
+}
+
+static ssize_t
+store_tabletStylusUpper(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "upper") == 0) {
+		aiptek->newSetting.stylusButtonUpper =
+		    AIPTEK_STYLUS_UPPER_BUTTON;
+	} else if (strcmp(buf, "lower") == 0) {
+		aiptek->newSetting.stylusButtonUpper =
+		    AIPTEK_STYLUS_LOWER_BUTTON;
+	}
+	return count;
+}
+
+static DEVICE_ATTR(stylus_upper,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletStylusUpper, store_tabletStylusUpper);
+
+/***********************************************************************
+ * support routines for the 'stylus_lower' file. Note that this file
+ * both displays current setting and allows for setting changing.
+ */
+static ssize_t show_tabletStylusLower(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *s;
+
+	if (aiptek == NULL)
+		return 0;
+
+	switch (aiptek->curSetting.stylusButtonLower) {
+	case AIPTEK_STYLUS_UPPER_BUTTON:
+		s = "upper";
+		break;
+
+	case AIPTEK_STYLUS_LOWER_BUTTON:
+		s = "lower";
+		break;
+
+	default:
+		s = "unknown";
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%s\n", s);
+}
+
+static ssize_t
+store_tabletStylusLower(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "upper") == 0) {
+		aiptek->newSetting.stylusButtonLower =
+		    AIPTEK_STYLUS_UPPER_BUTTON;
+	} else if (strcmp(buf, "lower") == 0) {
+		aiptek->newSetting.stylusButtonLower =
+		    AIPTEK_STYLUS_LOWER_BUTTON;
+	}
+	return count;
+}
+
+static DEVICE_ATTR(stylus_lower,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletStylusLower, store_tabletStylusLower);
+
+/***********************************************************************
+ * support routines for the 'mouse_left' file. Note that this file
+ * both displays current setting and allows for setting changing.
+ */
+static ssize_t show_tabletMouseLeft(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *s;
+
+	if (aiptek == NULL)
+		return 0;
+
+	switch (aiptek->curSetting.mouseButtonLeft) {
+	case AIPTEK_MOUSE_LEFT_BUTTON:
+		s = "left";
+		break;
+
+	case AIPTEK_MOUSE_MIDDLE_BUTTON:
+		s = "middle";
+		break;
+
+	case AIPTEK_MOUSE_RIGHT_BUTTON:
+		s = "right";
+		break;
+
+	default:
+		s = "unknown";
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%s\n", s);
+}
+
+static ssize_t
+store_tabletMouseLeft(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "left") == 0) {
+		aiptek->newSetting.mouseButtonLeft = AIPTEK_MOUSE_LEFT_BUTTON;
+	} else if (strcmp(buf, "middle") == 0) {
+		aiptek->newSetting.mouseButtonLeft = AIPTEK_MOUSE_MIDDLE_BUTTON;
+	} else if (strcmp(buf, "right") == 0) {
+		aiptek->newSetting.mouseButtonLeft = AIPTEK_MOUSE_RIGHT_BUTTON;
+	}
+	return count;
+}
+
+static DEVICE_ATTR(mouse_left,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletMouseLeft, store_tabletMouseLeft);
+
+/***********************************************************************
+ * support routines for the 'mouse_middle' file. Note that this file
+ * both displays current setting and allows for setting changing.
+ */
+static ssize_t show_tabletMouseMiddle(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *s;
+
+	if (aiptek == NULL)
+		return 0;
+
+	switch (aiptek->curSetting.mouseButtonMiddle) {
+	case AIPTEK_MOUSE_LEFT_BUTTON:
+		s = "left";
+		break;
+
+	case AIPTEK_MOUSE_MIDDLE_BUTTON:
+		s = "middle";
+		break;
+
+	case AIPTEK_MOUSE_RIGHT_BUTTON:
+		s = "right";
+		break;
+
+	default:
+		s = "unknown";
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%s\n", s);
+}
+
+static ssize_t
+store_tabletMouseMiddle(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "left") == 0) {
+		aiptek->newSetting.mouseButtonMiddle = AIPTEK_MOUSE_LEFT_BUTTON;
+	} else if (strcmp(buf, "middle") == 0) {
+		aiptek->newSetting.mouseButtonMiddle =
+		    AIPTEK_MOUSE_MIDDLE_BUTTON;
+	} else if (strcmp(buf, "right") == 0) {
+		aiptek->newSetting.mouseButtonMiddle =
+		    AIPTEK_MOUSE_RIGHT_BUTTON;
+	}
+	return count;
+}
+
+static DEVICE_ATTR(mouse_middle,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletMouseMiddle, store_tabletMouseMiddle);
+
+/***********************************************************************
+ * support routines for the 'mouse_right' file. Note that this file
+ * both displays current setting and allows for setting changing.
+ */
+static ssize_t show_tabletMouseRight(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+	char *s;
+
+	if (aiptek == NULL)
+		return 0;
+
+	switch (aiptek->curSetting.mouseButtonRight) {
+	case AIPTEK_MOUSE_LEFT_BUTTON:
+		s = "left";
+		break;
+
+	case AIPTEK_MOUSE_MIDDLE_BUTTON:
+		s = "middle";
+		break;
+
+	case AIPTEK_MOUSE_RIGHT_BUTTON:
+		s = "right";
+		break;
+
+	default:
+		s = "unknown";
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%s\n", s);
+}
+
+static ssize_t
+store_tabletMouseRight(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (strcmp(buf, "left") == 0) {
+		aiptek->newSetting.mouseButtonRight = AIPTEK_MOUSE_LEFT_BUTTON;
+	} else if (strcmp(buf, "middle") == 0) {
+		aiptek->newSetting.mouseButtonRight =
+		    AIPTEK_MOUSE_MIDDLE_BUTTON;
+	} else if (strcmp(buf, "right") == 0) {
+		aiptek->newSetting.mouseButtonRight = AIPTEK_MOUSE_RIGHT_BUTTON;
+	}
+	return count;
+}
+
+static DEVICE_ATTR(mouse_right,
+		   S_IRUGO | S_IWUGO,
+		   show_tabletMouseRight, store_tabletMouseRight);
+
+/***********************************************************************
+ * support routines for the 'wheel' file. Note that this file
+ * both displays current setting and allows for setting changing.
+ */
+static ssize_t show_tabletWheel(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	if (aiptek->curSetting.wheel == AIPTEK_WHEEL_DISABLE) {
+		return snprintf(buf, PAGE_SIZE, "disable\n");
+	} else {
+		return snprintf(buf, PAGE_SIZE, "%d\n",
+				aiptek->curSetting.wheel);
+	}
+}
+
+static ssize_t
+store_tabletWheel(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	aiptek->newSetting.wheel = (int)simple_strtol(buf, 0, 10);
+	return count;
+}
+
+static DEVICE_ATTR(wheel,
+		   S_IRUGO | S_IWUGO, show_tabletWheel, store_tabletWheel);
+
+/***********************************************************************
+ * support routines for the 'execute' file. Note that this file
+ * both displays current setting and allows for setting changing.
+ */
+static ssize_t show_tabletExecute(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	/* There is nothing useful to display, so a one-line manual
+	 * is in order...
+	 */
+	return snprintf(buf, PAGE_SIZE,
+			"Write anything to this file to program your tablet.\n");
+}
+
+static ssize_t
+store_tabletExecute(struct device *dev, const char *buf, size_t count)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	/* We do not care what you write to this file. Merely the action
+	 * of writing to this file triggers a tablet reprogramming.
+	 */
+	memcpy(&aiptek->curSetting, &aiptek->newSetting,
+	       sizeof(struct aiptek_settings));
+
+	if (aiptek_program_tablet(aiptek) < 0)
+		return -EIO;
+
+	return count;
+}
+
+static DEVICE_ATTR(execute,
+		   S_IRUGO | S_IWUGO, show_tabletExecute, store_tabletExecute);
+
+/***********************************************************************
+ * support routines for the 'odm_code' file. Note that this file
+ * only displays current setting.
+ */
+static ssize_t show_tabletODMCode(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->features.odmCode);
+}
+
+static DEVICE_ATTR(odm_code, S_IRUGO, show_tabletODMCode, NULL);
+
+/***********************************************************************
+ * support routines for the 'model_code' file. Note that this file
+ * only displays current setting.
+ */
+static ssize_t show_tabletModelCode(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->features.modelCode);
+}
+
+static DEVICE_ATTR(model_code, S_IRUGO, show_tabletModelCode, NULL);
+
+/***********************************************************************
+ * support routines for the 'firmware_code' file. Note that this file
+ * only displays current setting.
+ */
+static ssize_t show_firmwareCode(struct device *dev, char *buf)
+{
+	struct aiptek *aiptek = dev_get_drvdata(dev);
+
+	if (aiptek == NULL)
+		return 0;
+
+	return snprintf(buf, PAGE_SIZE, "%04x\n",
+			aiptek->features.firmwareCode);
+}
+
+static DEVICE_ATTR(firmware_code, S_IRUGO, show_firmwareCode, NULL);
+
+/***********************************************************************
+ * This routine removes all existing sysfs files managed by this device
+ * driver.
+ */
+static void aiptek_delete_files(struct device *dev)
+{
+	device_remove_file(dev, &dev_attr_size);
+	device_remove_file(dev, &dev_attr_product_id);
+	device_remove_file(dev, &dev_attr_vendor_id);
+	device_remove_file(dev, &dev_attr_vendor);
+	device_remove_file(dev, &dev_attr_product);
+	device_remove_file(dev, &dev_attr_pointer_mode);
+	device_remove_file(dev, &dev_attr_coordinate_mode);
+	device_remove_file(dev, &dev_attr_tool_mode);
+	device_remove_file(dev, &dev_attr_xtilt);
+	device_remove_file(dev, &dev_attr_ytilt);
+	device_remove_file(dev, &dev_attr_jitter);
+	device_remove_file(dev, &dev_attr_delay);
+	device_remove_file(dev, &dev_attr_input_path);
+	device_remove_file(dev, &dev_attr_event_count);
+	device_remove_file(dev, &dev_attr_diagnostic);
+	device_remove_file(dev, &dev_attr_odm_code);
+	device_remove_file(dev, &dev_attr_model_code);
+	device_remove_file(dev, &dev_attr_firmware_code);
+	device_remove_file(dev, &dev_attr_stylus_lower);
+	device_remove_file(dev, &dev_attr_stylus_upper);
+	device_remove_file(dev, &dev_attr_mouse_left);
+	device_remove_file(dev, &dev_attr_mouse_middle);
+	device_remove_file(dev, &dev_attr_mouse_right);
+	device_remove_file(dev, &dev_attr_wheel);
+	device_remove_file(dev, &dev_attr_execute);
+}
+
+/***********************************************************************
+ * This routine creates the sysfs files managed by this device
+ * driver.
+ */
+static int aiptek_add_files(struct device *dev)
+{
+	int ret;
+
+	if ((ret = device_create_file(dev, &dev_attr_size)) ||
+	    (ret = device_create_file(dev, &dev_attr_product_id)) ||
+	    (ret = device_create_file(dev, &dev_attr_vendor_id)) ||
+	    (ret = device_create_file(dev, &dev_attr_vendor)) ||
+	    (ret = device_create_file(dev, &dev_attr_product)) ||
+	    (ret = device_create_file(dev, &dev_attr_pointer_mode)) ||
+	    (ret = device_create_file(dev, &dev_attr_coordinate_mode)) ||
+	    (ret = device_create_file(dev, &dev_attr_tool_mode)) ||
+	    (ret = device_create_file(dev, &dev_attr_xtilt)) ||
+	    (ret = device_create_file(dev, &dev_attr_ytilt)) ||
+	    (ret = device_create_file(dev, &dev_attr_jitter)) ||
+	    (ret = device_create_file(dev, &dev_attr_delay)) ||
+	    (ret = device_create_file(dev, &dev_attr_input_path)) ||
+	    (ret = device_create_file(dev, &dev_attr_event_count)) ||
+	    (ret = device_create_file(dev, &dev_attr_diagnostic)) ||
+	    (ret = device_create_file(dev, &dev_attr_odm_code)) ||
+	    (ret = device_create_file(dev, &dev_attr_model_code)) ||
+	    (ret = device_create_file(dev, &dev_attr_firmware_code)) ||
+	    (ret = device_create_file(dev, &dev_attr_stylus_lower)) ||
+	    (ret = device_create_file(dev, &dev_attr_stylus_upper)) ||
+	    (ret = device_create_file(dev, &dev_attr_mouse_left)) ||
+	    (ret = device_create_file(dev, &dev_attr_mouse_middle)) ||
+	    (ret = device_create_file(dev, &dev_attr_mouse_right)) ||
+	    (ret = device_create_file(dev, &dev_attr_wheel)) ||
+	    (ret = device_create_file(dev, &dev_attr_execute))) {
+		err("aiptek: killing own sysfs device files\n");
+		aiptek_delete_files(dev);
+	}
+	return ret;
+}
+
+/***********************************************************************
+ * This routine is called when a tablet has been identified. It basically
+ * sets up the tablet and the driver's internal structures.
+ */
+static int
+aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
+{
+	struct usb_device *usbdev = interface_to_usbdev(intf);
+	struct usb_endpoint_descriptor *endpoint;
+	struct aiptek *aiptek;
+	struct input_dev *inputdev;
+	struct input_handle *inputhandle;
+	struct list_head *node, *next;
+	char path[64 + 1];
+	int i;
+	int speeds[] = { 0,
+		AIPTEK_PROGRAMMABLE_DELAY_50,
+		AIPTEK_PROGRAMMABLE_DELAY_400,
+		AIPTEK_PROGRAMMABLE_DELAY_25,
+		AIPTEK_PROGRAMMABLE_DELAY_100,
+		AIPTEK_PROGRAMMABLE_DELAY_200,
+		AIPTEK_PROGRAMMABLE_DELAY_300
+	};
+
+	/* programmableDelay is where the command-line specified
+	 * delay is kept. We make it the first element of speeds[],
+	 * so therefore, your override speed is tried first, then the
+	 * remainder. Note that the default value of 400ms will be tried
+	 * if you do not specify any command line parameter.
+	 */
+	speeds[0] = programmableDelay;
+
+	if ((aiptek = kmalloc(sizeof(struct aiptek), GFP_KERNEL)) == NULL)
+		return -ENOMEM;
+	memset(aiptek, 0, sizeof(struct aiptek));
+
+	aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH,
+					SLAB_ATOMIC, &aiptek->data_dma);
+	if (aiptek->data == NULL) {
 		kfree(aiptek);
+		return -ENOMEM;
+	}
+
+	aiptek->urb = usb_alloc_urb(0, GFP_KERNEL);
+	if (aiptek->urb == NULL) {
+		usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data,
+				aiptek->data_dma);
+		kfree(aiptek);
+		return -ENOMEM;
+	}
+
+	/* Set up the curSettings struct. Said struct contains the current
+	 * programmable parameters. The newSetting struct contains changes
+	 * the user makes to the settings via the sysfs interface. Those
+	 * changes are not "committed" to curSettings until the user
+	 * writes to the sysfs/.../execute file.
+	 */
+	aiptek->curSetting.pointerMode = AIPTEK_POINTER_EITHER_MODE;
+	aiptek->curSetting.coordinateMode = AIPTEK_COORDINATE_ABSOLUTE_MODE;
+	aiptek->curSetting.toolMode = AIPTEK_TOOL_BUTTON_PEN_MODE;
+	aiptek->curSetting.xTilt = AIPTEK_TILT_DISABLE;
+	aiptek->curSetting.yTilt = AIPTEK_TILT_DISABLE;
+	aiptek->curSetting.mouseButtonLeft = AIPTEK_MOUSE_LEFT_BUTTON;
+	aiptek->curSetting.mouseButtonMiddle = AIPTEK_MOUSE_MIDDLE_BUTTON;
+	aiptek->curSetting.mouseButtonRight = AIPTEK_MOUSE_RIGHT_BUTTON;
+	aiptek->curSetting.stylusButtonUpper = AIPTEK_STYLUS_UPPER_BUTTON;
+	aiptek->curSetting.stylusButtonLower = AIPTEK_STYLUS_LOWER_BUTTON;
+	aiptek->curSetting.jitterDelay = jitterDelay;
+	aiptek->curSetting.programmableDelay = programmableDelay;
+
+	/* Both structs should have equivalent settings
+	 */
+	memcpy(&aiptek->newSetting, &aiptek->curSetting,
+	       sizeof(struct aiptek_settings));
+
+	/* Now program the capacities of the tablet, in terms of being
+	 * an input device.
+	 */
+	aiptek->inputdev.evbit[0] |= BIT(EV_KEY)
+	    | BIT(EV_ABS)
+	    | BIT(EV_REL)
+	    | BIT(EV_MSC);
+
+	aiptek->inputdev.absbit[0] |=
+	    (BIT(ABS_X) |
+	     BIT(ABS_Y) |
+	     BIT(ABS_PRESSURE) |
+	     BIT(ABS_TILT_X) |
+	     BIT(ABS_TILT_Y) | BIT(ABS_WHEEL) | BIT(ABS_MISC));
+
+	aiptek->inputdev.relbit[0] |=
+	    (BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL) | BIT(REL_MISC));
+
+	aiptek->inputdev.keybit[LONG(BTN_LEFT)] |=
+	    (BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE));
+
+	aiptek->inputdev.keybit[LONG(BTN_DIGI)] |=
+	    (BIT(BTN_TOOL_PEN) |
+	     BIT(BTN_TOOL_RUBBER) |
+	     BIT(BTN_TOOL_PENCIL) |
+	     BIT(BTN_TOOL_AIRBRUSH) |
+	     BIT(BTN_TOOL_BRUSH) |
+	     BIT(BTN_TOOL_MOUSE) |
+	     BIT(BTN_TOOL_LENS) |
+	     BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2));
+
+	aiptek->inputdev.mscbit[0] = BIT(MSC_SERIAL);
+
+	/* Programming the tablet macro keys needs to be done with a for loop
+	 * as the keycodes are discontiguous.
+	 */
+	for (i = 0; i < sizeof(macroKeyEvents) / sizeof(macroKeyEvents[0]); ++i)
+		set_bit(macroKeyEvents[i], aiptek->inputdev.keybit);
+
+	/* Set up client data, pointers to open and close routines
+	 * for the input device.
+	 */
+	aiptek->inputdev.private = aiptek;
+	aiptek->inputdev.open = aiptek_open;
+	aiptek->inputdev.close = aiptek_close;
+
+	/* Determine the usb devices' physical path.
+	 * Asketh not why we always pretend we're using "../input0",
+	 * but I suspect this will have to be refactored one
+	 * day if a single USB device can be a keyboard & a mouse
+	 * & a tablet, and the inputX number actually will tell
+	 * us something...
+	 */
+	if (usb_make_path(usbdev, path, 64) > 0)
+		sprintf(aiptek->features.usbPath, "%s/input0", path);
+
+	/* Program the input device coordinate capacities. We do not yet
+	 * know what maximum X, Y, and Z values are, so we're putting fake
+	 * values in. Later, we'll ask the tablet to put in the correct
+	 * values.
+	 */
+	aiptek->inputdev.absmin[ABS_X] = 0;
+	aiptek->inputdev.absmax[ABS_X] = 2999;
+	aiptek->inputdev.absmin[ABS_Y] = 0;
+	aiptek->inputdev.absmax[ABS_Y] = 2249;
+	aiptek->inputdev.absmin[ABS_PRESSURE] = 0;
+	aiptek->inputdev.absmax[ABS_PRESSURE] = 511;
+	aiptek->inputdev.absmin[ABS_TILT_X] = AIPTEK_TILT_MIN;
+	aiptek->inputdev.absmax[ABS_TILT_X] = AIPTEK_TILT_MAX;
+	aiptek->inputdev.absmin[ABS_TILT_Y] = AIPTEK_TILT_MIN;
+	aiptek->inputdev.absmax[ABS_TILT_Y] = AIPTEK_TILT_MAX;
+	aiptek->inputdev.absmin[ABS_WHEEL] = AIPTEK_WHEEL_MIN;
+	aiptek->inputdev.absmax[ABS_WHEEL] = AIPTEK_WHEEL_MAX - 1;
+	aiptek->inputdev.absfuzz[ABS_X] = 0;
+	aiptek->inputdev.absfuzz[ABS_Y] = 0;
+	aiptek->inputdev.absfuzz[ABS_PRESSURE] = 0;
+	aiptek->inputdev.absfuzz[ABS_TILT_X] = 0;
+	aiptek->inputdev.absfuzz[ABS_TILT_Y] = 0;
+	aiptek->inputdev.absfuzz[ABS_WHEEL] = 0;
+	aiptek->inputdev.absflat[ABS_X] = 0;
+	aiptek->inputdev.absflat[ABS_Y] = 0;
+	aiptek->inputdev.absflat[ABS_PRESSURE] = 0;
+	aiptek->inputdev.absflat[ABS_TILT_X] = 0;
+	aiptek->inputdev.absflat[ABS_TILT_Y] = 0;
+	aiptek->inputdev.absflat[ABS_WHEEL] = 0;
+	aiptek->inputdev.name = "Aiptek";
+	aiptek->inputdev.phys = aiptek->features.usbPath;
+	aiptek->inputdev.id.bustype = BUS_USB;
+	aiptek->inputdev.id.vendor = usbdev->descriptor.idVendor;
+	aiptek->inputdev.id.product = usbdev->descriptor.idProduct;
+	aiptek->inputdev.id.version = usbdev->descriptor.bcdDevice;
+
+	aiptek->usbdev = usbdev;
+	aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber;
+	aiptek->inDelay = 0;
+	aiptek->endDelay = 0;
+	aiptek->previousJitterable = 0;
+
+	endpoint = &intf->altsetting[0].endpoint[0].desc;
+
+	/* Go set up our URB, which is called when the tablet receives
+	 * input.
+	 */
+	usb_fill_int_urb(aiptek->urb,
+			 aiptek->usbdev,
+			 usb_rcvintpipe(aiptek->usbdev,
+					endpoint->bEndpointAddress),
+			 aiptek->data, 8, aiptek_irq, aiptek,
+			 endpoint->bInterval);
+
+	aiptek->urb->transfer_dma = aiptek->data_dma;
+	aiptek->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+
+	/* 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 put it here instead of in the sysfs interface.
+	 */
+	usb_string(usbdev,
+		   usbdev->descriptor.iManufacturer,
+		   aiptek->features.manuName,
+		   sizeof(aiptek->features.manuName));
+	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 in the link list of
+	 * input_handles associated with this input device.
+	 * What identifies an evdev input_handler is that it begins
+	 * with 'event', continues with a digit, and that in turn
+	 * is mapped to /{devfs}/input/eventN.
+	 */
+	inputdev = &aiptek->inputdev;
+	list_for_each_safe(node, next, &inputdev->h_list) {
+		inputhandle = to_handle(node);
+		if (strncmp(inputhandle->name, "event", 5) == 0) {
+			strcpy(aiptek->features.inputPath, inputhandle->name);
+			break;
+		}
+	}
+
+	info("input: Aiptek on %s (%s)\n", path, aiptek->features.inputPath);
+
+	/* Program the tablet. This sets the tablet up in the mode
+	 * specified in newSetting, and also queries the tablet's
+	 * physical capacities.
+	 *
+	 * Sanity check: if a tablet doesn't like the slow programmatic
+	 * delay, we often get sizes of 0x0. Let's use that as an indicator
+	 * to try faster delays, up to 25 ms. If that logic fails, well, you'll
+	 * have to explain to us how your tablet thinks it's 0x0, and yet that's
+	 * not an error :-)
+	 */
+
+	for (i = 0; i < sizeof(speeds) / sizeof(speeds[0]); ++i) {
+		aiptek->curSetting.programmableDelay = speeds[i];
+		(void)aiptek_program_tablet(aiptek);
+		if (aiptek->inputdev.absmax[ABS_X] > 0) {
+			info("input: Aiptek using %d ms programming speed\n",
+			     aiptek->curSetting.programmableDelay);
+			break;
+		}
 	}
+
+	/* Associate this driver's struct with the usb interface.
+	 */
+	usb_set_intfdata(intf, aiptek);
+
+	/* Set up the sysfs files
+	 */
+	aiptek_add_files(&intf->dev);
+
+	/* Make sure the evdev module is loaded. Assuming evdev IS a module :-)
+	 */
+	if (request_module("evdev") != 0)
+		info("aiptek: error loading 'evdev' module");
+
+	return 0;
 }
 
+/* Forward declaration */
+static void aiptek_disconnect(struct usb_interface *intf);
+
 static struct usb_driver aiptek_driver = {
-	.owner =	THIS_MODULE,
-	.name =		"aiptek",
-	.probe =	aiptek_probe,
-	.disconnect =	aiptek_disconnect,
-	.id_table =	aiptek_ids,
+	.owner = THIS_MODULE,
+	.name = "aiptek",
+	.probe = aiptek_probe,
+	.disconnect = aiptek_disconnect,
+	.id_table = aiptek_ids,
 };
 
-static int __init
-aiptek_init(void)
+/***********************************************************************
+ * Deal with tablet disconnecting from the system.
+ */
+static void aiptek_disconnect(struct usb_interface *intf)
+{
+	struct aiptek *aiptek = usb_get_intfdata(intf);
+
+	/* Disassociate driver's struct with usb interface
+	 */
+	usb_set_intfdata(intf, NULL);
+	if (aiptek != NULL) {
+		/* Free & unhook everything from the system.
+		 */
+		usb_unlink_urb(aiptek->urb);
+		input_unregister_device(&aiptek->inputdev);
+		aiptek_delete_files(&intf->dev);
+		usb_free_urb(aiptek->urb);
+		usb_buffer_free(interface_to_usbdev(intf),
+				AIPTEK_PACKET_LENGTH,
+				aiptek->data, aiptek->data_dma);
+		kfree(aiptek);
+		aiptek = NULL;
+	}
+}
+
+static int __init aiptek_init(void)
 {
 	int result = usb_register(&aiptek_driver);
 	if (result == 0) {
-		info(DRIVER_VERSION " " DRIVER_AUTHOR);
+		info(DRIVER_VERSION ": " DRIVER_AUTHOR);
 		info(DRIVER_DESC);
 	}
 	return result;
 }
 
-static void __exit
-aiptek_exit(void)
+static void __exit aiptek_exit(void)
 {
 	usb_deregister(&aiptek_driver);
 }
+
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
+
+MODULE_PARM(programmableDelay, "i");
+MODULE_PARM_DESC(programmableDelay, "delay used during tablet programming");
+MODULE_PARM(jitterDelay, "i");
+MODULE_PARM_DESC(jitterDelay, "stylus/mouse settlement delay");
 
 module_init(aiptek_init);
 module_exit(aiptek_exit);
diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/input/hid-core.c	Tue Jun 15 22:20:41 2004
@@ -958,7 +958,7 @@
  * Create a report.
  */
 
-void hid_output_report(struct hid_report *report, __u8 *data)
+static void hid_output_report(struct hid_report *report, __u8 *data)
 {
 	unsigned n;
 
@@ -1038,7 +1038,8 @@
 	return -1;
 }
 
-int hid_find_field_in_report(struct hid_report *report, __u32 wanted_usage, struct hid_field **field)
+#if 0
+static int hid_find_field_in_report(struct hid_report *report, __u32 wanted_usage, struct hid_field **field)
 {
 	int i, j;
 
@@ -1051,6 +1052,7 @@
 
 	return -1;
 }
+#endif
 
 static int hid_submit_out(struct hid_device *hid)
 {
@@ -1357,7 +1359,13 @@
 #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO  0x1001
 
 #define USB_VENDOR_ID_AIPTEK		0x08ca
-#define USB_DEVICE_ID_AIPTEK_6000	0x0020
+#define USB_DEVICE_ID_AIPTEK_01		0x0001
+#define USB_DEVICE_ID_AIPTEK_10		0x0010
+#define USB_DEVICE_ID_AIPTEK_20		0x0020
+#define USB_DEVICE_ID_AIPTEK_21		0x0021
+#define USB_DEVICE_ID_AIPTEK_22		0x0022
+#define USB_DEVICE_ID_AIPTEK_23		0x0023
+#define USB_DEVICE_ID_AIPTEK_24		0x0024
 
 #define USB_VENDOR_ID_GRIFFIN		0x077d
 #define USB_DEVICE_ID_POWERMATE		0x0410
@@ -1412,13 +1420,27 @@
 #define USB_VENDOR_ID_CHIC		0x05fe
 #define USB_DEVICE_ID_CHIC_GAMEPAD	0x0014
 
-struct hid_blacklist {
+#define USB_VENDOR_ID_GLAB		0x06c2
+#define USB_DEVICE_ID_4_PHIDGETSERVO_30	0x0038
+#define USB_DEVICE_ID_1_PHIDGETSERVO_30	0x0039
+
+#define USB_VENDOR_ID_WISEGROUP		0x0925
+#define USB_DEVICE_ID_1_PHIDGETSERVO_20	0x8101
+#define USB_DEVICE_ID_4_PHIDGETSERVO_20	0x8104
+
+static struct hid_blacklist {
 	__u16 idVendor;
 	__u16 idProduct;
 	unsigned quirks;
 } hid_blacklist[] = {
 
-	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_6000, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO, HID_QUIRK_IGNORE },
@@ -1459,6 +1481,10 @@
 	{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 7, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PTU, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE },
 
 	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET },
@@ -1767,7 +1793,7 @@
 
 static struct usb_driver hid_driver = {
 	.owner =	THIS_MODULE,
-	.name =		"hid",
+	.name =		"usbhid",
 	.probe =	hid_probe,
 	.disconnect =	hid_disconnect,
 	.id_table =	hid_usb_ids,
diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
--- a/drivers/usb/input/hiddev.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/usb/input/hiddev.c	Tue Jun 15 22:20:39 2004
@@ -232,7 +232,7 @@
 static struct usb_class_driver hiddev_class;
 static void hiddev_cleanup(struct hiddev *hiddev)
 {
-	hiddev_table[hiddev->hid->minor] = NULL;
+	hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL;
 	usb_deregister_dev(hiddev->hid->intf, &hiddev_class);
 	kfree(hiddev);
 }
@@ -612,7 +612,7 @@
 		uref = &uref_multi->uref;
 		if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
 			if (copy_from_user(uref_multi, (void *) arg, 
-					   sizeof(uref_multi)))
+					   sizeof(*uref_multi)))
 				goto fault;
 		} else {
 			if (copy_from_user(uref, (void *) arg, sizeof(*uref)))
diff -Nru a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
--- a/drivers/usb/input/kbtab.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/input/kbtab.c	Tue Jun 15 22:20:36 2004
@@ -95,7 +95,7 @@
 		     __FUNCTION__, retval);
 }
 
-struct usb_device_id kbtab_ids[] = {
+static struct usb_device_id kbtab_ids[] = {
 	{ USB_DEVICE(USB_VENDOR_ID_KBGEAR, 0x1001), .driver_info = 0 },
 	{ }
 };
diff -Nru a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c
--- a/drivers/usb/input/mtouchusb.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/input/mtouchusb.c	Tue Jun 15 22:20:41 2004
@@ -28,6 +28,12 @@
  *    Complete rewrite using Linux Input in 2.6.3
  *    Unfortunately no calibration support at this time
  *
+ *  1.4 04/25/2004 (TEJ) tejohnson@yahoo.com
+ *    Changed reset from standard USB dev reset to vendor reset
+ *    Changed data sent to host from compensated to raw coordinates
+ *    Eliminated vendor/product module params
+ *    Performed multiple successfull tests with an EXII-5010UC
+ *
  *****************************************************************************/
 
 #include <linux/config.h>
@@ -45,25 +51,28 @@
 #include <linux/init.h>
 #include <linux/usb.h>
 
-#define MTOUCHUSB_MIN_XC                0xc8
-#define MTOUCHUSB_MAX_XC                0xff78
+#define MTOUCHUSB_MIN_XC                0x0
+#define MTOUCHUSB_MAX_XC                0x4000
 #define MTOUCHUSB_XC_FUZZ               0x0
 #define MTOUCHUSB_XC_FLAT               0x0
 #define MTOUCHUSB_MIN_YC                0x0
-#define MTOUCHUSB_MAX_YC                0xff78
+#define MTOUCHUSB_MAX_YC                0x4000
 #define MTOUCHUSB_YC_FUZZ               0x0
 #define MTOUCHUSB_YC_FLAT               0x0
-#define MTOUCHUSB_ASYC_REPORT           1
-#define MTOUCHUSB_REPORT_SIZE_DATA      11
+
+#define MTOUCHUSB_ASYNC_REPORT          1
+#define MTOUCHUSB_RESET                 7
+#define MTOUCHUSB_REPORT_DATA_SIZE      11
 #define MTOUCHUSB_REQ_CTRLLR_ID         10
 
-#define MTOUCHUSB_GET_XC(data)          (data[4]<<8 | data[3])
-#define MTOUCHUSB_GET_YC(data)          (data[6]<<8 | data[5])
+#define MTOUCHUSB_GET_XC(data)          (data[8]<<8 | data[7])
+#define MTOUCHUSB_GET_YC(data)          (data[10]<<8 | data[9])
 #define MTOUCHUSB_GET_TOUCHED(data)     ((data[2] & 0x40) ? 1:0)
 
-#define DRIVER_VERSION "v0.1"
+#define DRIVER_VERSION "v1.4"
 #define DRIVER_AUTHOR "Todd E. Johnson, tejohnson@yahoo.com"
-#define DRIVER_DESC "Microtouch USB HID Touchscreen Driver"
+#define DRIVER_DESC "3M USB Touchscreen Driver"
+#define DRIVER_LICENSE "GPL"
 
 struct mtouch_usb {
         unsigned char *data;
@@ -76,11 +85,9 @@
         char phys[64];
 };
 
-static __s32 vendor=-1, product=-1;
-
 static struct usb_device_id mtouchusb_devices [] = {
-        { USB_DEVICE(0x0596, 0x0001) }, /* 3M (Formerly MicroTouch) 14-206 */
-        { }                             /* Terminating entry */
+        { USB_DEVICE(0x0596, 0x0001) },
+        { }
 };
 
 static void mtouchusb_irq(struct urb *urb, struct pt_regs *regs)
@@ -135,8 +142,10 @@
 
         mtouch->irq->dev = mtouch->udev;
 
-        if (usb_submit_urb (mtouch->irq, GFP_ATOMIC))
+        if (usb_submit_urb (mtouch->irq, GFP_ATOMIC)) {
+                mtouch->open--;
                 return -EIO;
+        }
 
         return 0;
 }
@@ -153,7 +162,7 @@
 {
         dbg("%s - called", __FUNCTION__);
 
-        mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_SIZE_DATA,
+        mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_DATA_SIZE,
                                         SLAB_ATOMIC, &mtouch->data_dma);
 
         if (!mtouch->data)
@@ -167,7 +176,7 @@
         dbg("%s - called", __FUNCTION__);
 
         if (mtouch->data)
-                usb_buffer_free(udev, MTOUCHUSB_REPORT_SIZE_DATA,
+                usb_buffer_free(udev, MTOUCHUSB_REPORT_DATA_SIZE,
                                 mtouch->data, mtouch->data_dma);
 }
 
@@ -180,41 +189,8 @@
         char path[64];
         char *buf;
         int nRet;
-        int ix;
-        char valid_device = 0;
 
         dbg("%s - called", __FUNCTION__);
-        if (vendor != -1 && product != -1) {
-                info("%s - User specified USB Touch -- Vend:Prod - %x:%x",
-                     __FUNCTION__, vendor, product);
-        }
-
-        for (ix = 0; ix < sizeof (mtouchusb_devices) /
-             sizeof (struct usb_device_id); ix++) {
-                if ((udev->descriptor.idVendor ==
-                     mtouchusb_devices [ix].idVendor) &&
-                     (udev->descriptor.idProduct ==
-                     mtouchusb_devices [ix].idProduct)) {
-                        valid_device = 1;
-                        break;
-                }
-        }
-
-        if (udev->descriptor.idVendor == vendor &&
-            udev->descriptor.idProduct == product) {  /* User specified */
-                valid_device = 1;
-        }
-
-        if (!valid_device) {
-                err("%s - No valid device!", __FUNCTION__);
-                return -EIO;
-        }
-
-        if (udev->descriptor.bNumConfigurations != 1) {
-                err("%s -  Only one device configuration is supported.",
-                    __FUNCTION__);
-                return -EIO;
-        }
 
         dbg("%s - setting interface", __FUNCTION__);
         interface = intf->cur_altsetting;
@@ -222,11 +198,6 @@
         dbg("%s - setting endpoint", __FUNCTION__);
         endpoint = &interface->endpoint[0].desc;
 
-        if (interface->desc.bNumEndpoints != 1) {
-                err("%s - Only one endpoint is supported.", __FUNCTION__);
-                return -EIO;
-        }
-
         if (!(mtouch = kmalloc (sizeof (struct mtouch_usb), GFP_KERNEL))) {
                 err("%s - Out of memory.", __FUNCTION__);
                 return -ENOMEM;
@@ -266,8 +237,8 @@
         mtouch->input.absmax[ABS_X] =  MTOUCHUSB_MAX_XC;
         mtouch->input.absfuzz[ABS_X] = MTOUCHUSB_XC_FUZZ;
         mtouch->input.absflat[ABS_X] = MTOUCHUSB_XC_FLAT;
-        mtouch->input.absmin[ABS_Y] =  MTOUCHUSB_MAX_YC;
-        mtouch->input.absmax[ABS_Y] =  MTOUCHUSB_MIN_YC;
+        mtouch->input.absmin[ABS_Y] =  MTOUCHUSB_MIN_YC;
+        mtouch->input.absmax[ABS_Y] =  MTOUCHUSB_MAX_YC;
         mtouch->input.absfuzz[ABS_Y] = MTOUCHUSB_YC_FUZZ;
         mtouch->input.absflat[ABS_Y] = MTOUCHUSB_YC_FLAT;
 
@@ -290,15 +261,15 @@
         kfree(buf);
 
         nRet = usb_control_msg(mtouch->udev,
-                               usb_rcvctrlpipe(udev, 0x80),
-                               USB_REQ_GET_CONFIGURATION,
-                               USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE,
+                               usb_rcvctrlpipe(udev, 0),
+                               MTOUCHUSB_RESET,
+                               USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                               1,
                                0,
-                               0x81,
                                NULL,
                                0,
                                HZ * USB_CTRL_SET_TIMEOUT);
-        dbg("%s - usb_control_msg - USB_REQ_GET_CONFIGURATION - bytes|err: %d",
+        dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d",
             __FUNCTION__, nRet);
 
         dbg("%s - usb_alloc_urb: mtouch->irq", __FUNCTION__);
@@ -315,7 +286,7 @@
                          mtouch->udev,
                          usb_rcvintpipe(mtouch->udev, 0x81),
                          mtouch->data,
-                         MTOUCHUSB_REPORT_SIZE_DATA,
+                         MTOUCHUSB_REPORT_DATA_SIZE,
                          mtouchusb_irq,
                          mtouch,
                          endpoint->bInterval);
@@ -324,15 +295,15 @@
         input_register_device(&mtouch->input);
 
         nRet = usb_control_msg(mtouch->udev,
-                               usb_rcvctrlpipe(udev, 0x80),
-                               MTOUCHUSB_ASYC_REPORT,
+                               usb_rcvctrlpipe(udev, 0),
+                               MTOUCHUSB_ASYNC_REPORT,
                                USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-                               MTOUCHUSB_ASYC_REPORT,
-                               MTOUCHUSB_ASYC_REPORT,
+                               1,
+                               1,
                                NULL,
                                0,
                                HZ * USB_CTRL_SET_TIMEOUT);
-        dbg("%s - usb_control_msg - MTOUCHUSB_ASYC_REPORT - bytes|err: %d",
+        dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d",
             __FUNCTION__, nRet);
 
         printk(KERN_INFO "input: %s on %s\n", mtouch->name, path);
@@ -383,9 +354,3 @@
 MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
 MODULE_LICENSE("GPL");
-MODULE_PARM(vendor, "i");
-MODULE_PARM_DESC(vendor, "User specified USB idVendor");
-MODULE_PARM(product, "i");
-MODULE_PARM_DESC(product, "User specified USB idProduct");
-
-
diff -Nru a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
--- a/drivers/usb/input/powermate.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/input/powermate.c	Tue Jun 15 22:20:41 2004
@@ -33,6 +33,7 @@
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/spinlock.h>
 #include <linux/usb.h>
 
 #define POWERMATE_VENDOR	0x077d	/* Griffin Technology, Inc. */
@@ -67,7 +68,7 @@
 	dma_addr_t configcr_dma;
 	struct usb_device *udev;
 	struct input_dev input;
-	struct semaphore lock;
+	spinlock_t lock;
 	int static_brightness;
 	int pulse_speed;
 	int pulse_table;
@@ -116,7 +117,7 @@
 		     __FUNCTION__, retval);
 }
 
-/* Decide if we need to issue a control message and do so. Must be called with pm->lock down */
+/* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */
 static void powermate_sync_state(struct powermate_device *pm)
 {
 	if (pm->requires_update == 0) 
@@ -194,19 +195,22 @@
 static void powermate_config_complete(struct urb *urb, struct pt_regs *regs)
 {
 	struct powermate_device *pm = urb->context;
+	unsigned long flags;
 
 	if (urb->status)
 		printk(KERN_ERR "powermate: config urb returned %d\n", urb->status);
 	
-	down(&pm->lock);
+	spin_lock_irqsave(&pm->lock, flags);
 	powermate_sync_state(pm);
-	up(&pm->lock);
+	spin_unlock_irqrestore(&pm->lock, flags);
 }
 
 /* Set the LED up as described and begin the sync with the hardware if required */
 static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed, 
 				int pulse_table, int pulse_asleep, int pulse_awake)
 {
+	unsigned long flags;
+
 	if (pulse_speed < 0)
 		pulse_speed = 0;
 	if (pulse_table < 0)
@@ -219,7 +223,8 @@
 	pulse_asleep = !!pulse_asleep;
 	pulse_awake = !!pulse_awake;
 
-	down(&pm->lock);
+
+	spin_lock_irqsave(&pm->lock, flags);
 
 	/* mark state updates which are required */
 	if (static_brightness != pm->static_brightness){
@@ -242,7 +247,7 @@
 
 	powermate_sync_state(pm);
    
-	up(&pm->lock);
+	spin_unlock_irqrestore(&pm->lock, flags);
 }
 
 /* Callback from the Input layer when an event arrives from userspace to configure the LED */
@@ -344,7 +349,7 @@
 		return -ENOMEM;
 	}
 
-	init_MUTEX(&pm->lock);
+	pm->lock = SPIN_LOCK_UNLOCKED;
 	init_input_dev(&pm->input);
 
 	/* get a handle to the interrupt data pipe */
@@ -411,7 +416,6 @@
 
 	usb_set_intfdata(intf, NULL);
 	if (pm) {
-		down(&pm->lock);
 		pm->requires_update = 0;
 		usb_unlink_urb(pm->irq);
 		input_unregister_device(&pm->input);
diff -Nru a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/usb/input/touchkitusb.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,310 @@
+/******************************************************************************
+ * touchkitusb.c  --  Driver for eGalax TouchKit USB Touchscreens
+ *
+ * Copyright (C) 2004 by Daniel Ritz
+ * Copyright (C) by Todd E. Johnson (mtouchusb.c)
+ *
+ * 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.
+ *
+ * Based upon mtouchusb.c
+ *
+ *****************************************************************************/
+
+//#define DEBUG
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/init.h>
+
+#if !defined(DEBUG) && defined(CONFIG_USB_DEBUG)
+#define DEBUG
+#endif
+#include <linux/usb.h>
+
+
+#define TOUCHKIT_MIN_XC			0x0
+#define TOUCHKIT_MAX_XC			0x07ff
+#define TOUCHKIT_XC_FUZZ		0x0
+#define TOUCHKIT_XC_FLAT		0x0
+#define TOUCHKIT_MIN_YC			0x0
+#define TOUCHKIT_MAX_YC			0x07ff
+#define TOUCHKIT_YC_FUZZ		0x0
+#define TOUCHKIT_YC_FLAT		0x0
+#define TOUCHKIT_REPORT_DATA_SIZE	8
+
+#define TOUCHKIT_DOWN			0x01
+#define TOUCHKIT_POINT_TOUCH		0x81
+#define TOUCHKIT_POINT_NOTOUCH		0x80
+
+#define TOUCHKIT_GET_TOUCHED(dat)	((((dat)[0]) & TOUCHKIT_DOWN) ? 1 : 0)
+#define TOUCHKIT_GET_X(dat)		(((dat)[3] << 7) | (dat)[4])
+#define TOUCHKIT_GET_Y(dat)		(((dat)[1] << 7) | (dat)[2])
+
+#define DRIVER_VERSION			"v0.1"
+#define DRIVER_AUTHOR			"Daniel Ritz <daniel.ritz@gmx.ch>"
+#define DRIVER_DESC			"eGalax TouchKit USB HID Touchscreen Driver"
+
+struct touchkit_usb {
+	unsigned char *data;
+	dma_addr_t data_dma;
+	struct urb *irq;
+	struct usb_device *udev;
+	struct input_dev input;
+	int open;
+	char name[128];
+	char phys[64];
+};
+
+static struct usb_device_id touchkit_devices[] = {
+	{USB_DEVICE(0x3823, 0x0001)},
+	{USB_DEVICE(0x0eef, 0x0001)},
+	{}
+};
+
+static void touchkit_irq(struct urb *urb, struct pt_regs *regs)
+{
+	struct touchkit_usb *touchkit = urb->context;
+	int retval;
+
+	switch (urb->status) {
+	case 0:
+		/* success */
+		break;
+	case -ETIMEDOUT:
+		/* this urb is timing out */
+		dbg("%s - urb timed out - was the device unplugged?",
+		    __FUNCTION__);
+		return;
+	case -ECONNRESET:
+	case -ENOENT:
+	case -ESHUTDOWN:
+		/* this urb is terminated, clean up */
+		dbg("%s - urb shutting down with status: %d",
+		    __FUNCTION__, urb->status);
+		return;
+	default:
+		dbg("%s - nonzero urb status received: %d",
+		    __FUNCTION__, urb->status);
+		goto exit;
+	}
+
+	input_regs(&touchkit->input, regs);
+	input_report_key(&touchkit->input, BTN_TOUCH,
+	                 TOUCHKIT_GET_TOUCHED(touchkit->data));
+	input_report_abs(&touchkit->input, ABS_X,
+	                 TOUCHKIT_GET_X(touchkit->data));
+	input_report_abs(&touchkit->input, ABS_Y,
+	                 TOUCHKIT_GET_Y(touchkit->data));
+	input_sync(&touchkit->input);
+
+exit:
+	retval = usb_submit_urb(urb, GFP_ATOMIC);
+	if (retval)
+		err("%s - usb_submit_urb failed with result: %d",
+		    __FUNCTION__, retval);
+}
+
+static int touchkit_open(struct input_dev *input)
+{
+	struct touchkit_usb *touchkit = input->private;
+
+	if (touchkit->open++)
+		return 0;
+
+	touchkit->irq->dev = touchkit->udev;
+
+	if (usb_submit_urb(touchkit->irq, GFP_ATOMIC)) {
+		touchkit->open--;
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static void touchkit_close(struct input_dev *input)
+{
+	struct touchkit_usb *touchkit = input->private;
+
+	if (!--touchkit->open)
+		usb_unlink_urb(touchkit->irq);
+}
+
+static int touchkit_alloc_buffers(struct usb_device *udev,
+				  struct touchkit_usb *touchkit)
+{
+	touchkit->data = usb_buffer_alloc(udev, TOUCHKIT_REPORT_DATA_SIZE,
+	                                  SLAB_ATOMIC, &touchkit->data_dma);
+
+	if (!touchkit->data)
+		return -1;
+
+	return 0;
+}
+
+static void touchkit_free_buffers(struct usb_device *udev,
+				  struct touchkit_usb *touchkit)
+{
+	if (touchkit->data)
+		usb_buffer_free(udev, TOUCHKIT_REPORT_DATA_SIZE,
+		                touchkit->data, touchkit->data_dma);
+}
+
+static int touchkit_probe(struct usb_interface *intf,
+			  const struct usb_device_id *id)
+{
+	int ret;
+	struct touchkit_usb *touchkit;
+	struct usb_host_interface *interface;
+	struct usb_endpoint_descriptor *endpoint;
+	struct usb_device *udev = interface_to_usbdev(intf);
+	char path[64];
+	char *buf;
+
+	interface = intf->cur_altsetting;
+	endpoint = &interface->endpoint[0].desc;
+
+	touchkit = kmalloc(sizeof(struct touchkit_usb), GFP_KERNEL);
+	if (!touchkit)
+		return -ENOMEM;
+
+	memset(touchkit, 0, sizeof(struct touchkit_usb));
+	touchkit->udev = udev;
+
+	if (touchkit_alloc_buffers(udev, touchkit)) {
+		ret = -ENOMEM;
+		goto out_free;
+	}
+
+	touchkit->input.private = touchkit;
+	touchkit->input.open = touchkit_open;
+	touchkit->input.close = touchkit_close;
+
+	usb_make_path(udev, path, 64);
+	sprintf(touchkit->phys, "%s/input0", path);
+
+	touchkit->input.name = touchkit->name;
+	touchkit->input.phys = touchkit->phys;
+	touchkit->input.id.bustype = BUS_USB;
+	touchkit->input.id.vendor = udev->descriptor.idVendor;
+	touchkit->input.id.product = udev->descriptor.idProduct;
+	touchkit->input.id.version = udev->descriptor.bcdDevice;
+	touchkit->input.dev = &intf->dev;
+
+	touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
+	touchkit->input.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
+	touchkit->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+
+	/* Used to Scale Compensated Data */
+	touchkit->input.absmin[ABS_X] = TOUCHKIT_MIN_XC;
+	touchkit->input.absmax[ABS_X] = TOUCHKIT_MAX_XC;
+	touchkit->input.absfuzz[ABS_X] = TOUCHKIT_XC_FUZZ;
+	touchkit->input.absflat[ABS_X] = TOUCHKIT_XC_FLAT;
+	touchkit->input.absmin[ABS_Y] = TOUCHKIT_MIN_YC;
+	touchkit->input.absmax[ABS_Y] = TOUCHKIT_MAX_YC;
+	touchkit->input.absfuzz[ABS_Y] = TOUCHKIT_YC_FUZZ;
+	touchkit->input.absflat[ABS_Y] = TOUCHKIT_YC_FLAT;
+
+	buf = kmalloc(63, GFP_KERNEL);
+	if (!buf) {
+		ret = -ENOMEM;
+		goto out_free_buffers;
+	}
+
+	if (udev->descriptor.iManufacturer &&
+	    usb_string(udev, udev->descriptor.iManufacturer, buf, 63) > 0)
+		strcat(touchkit->name, buf);
+	if (udev->descriptor.iProduct &&
+	    usb_string(udev, udev->descriptor.iProduct, buf, 63) > 0)
+		sprintf(touchkit->name, "%s %s", touchkit->name, buf);
+
+	if (!strlen(touchkit->name))
+		sprintf(touchkit->name, "USB Touchscreen %04x:%04x",
+		        touchkit->input.id.vendor, touchkit->input.id.product);
+
+	kfree(buf);
+
+	touchkit->irq = usb_alloc_urb(0, GFP_KERNEL);
+	if (!touchkit->irq) {
+		dbg("%s - usb_alloc_urb failed: touchkit->irq", __FUNCTION__);
+		ret = -ENOMEM;
+		goto out_free_buffers;
+	}
+
+	usb_fill_int_urb(touchkit->irq, touchkit->udev,
+	                 usb_rcvintpipe(touchkit->udev, 0x81),
+	                 touchkit->data, TOUCHKIT_REPORT_DATA_SIZE,
+	                 touchkit_irq, touchkit, endpoint->bInterval);
+
+	input_register_device(&touchkit->input);
+
+	printk(KERN_INFO "input: %s on %s\n", touchkit->name, path);
+	usb_set_intfdata(intf, touchkit);
+
+	return 0;
+
+out_free_buffers:
+	touchkit_free_buffers(udev, touchkit);
+out_free:
+	kfree(touchkit);
+	return ret;
+}
+
+static void touchkit_disconnect(struct usb_interface *intf)
+{
+	struct touchkit_usb *touchkit = usb_get_intfdata(intf);
+
+	dbg("%s - called", __FUNCTION__);
+
+	if (!touchkit)
+		return;
+
+	dbg("%s - touchkit is initialized, cleaning up", __FUNCTION__);
+	usb_set_intfdata(intf, NULL);
+	input_unregister_device(&touchkit->input);
+	usb_unlink_urb(touchkit->irq);
+	usb_free_urb(touchkit->irq);
+	touchkit_free_buffers(interface_to_usbdev(intf), touchkit);
+	kfree(touchkit);
+}
+
+MODULE_DEVICE_TABLE(usb, touchkit_devices);
+
+static struct usb_driver touchkit_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "touchkitusb",
+	.probe		= touchkit_probe,
+	.disconnect	= touchkit_disconnect,
+	.id_table	= touchkit_devices,
+};
+
+static int __init touchkit_init(void)
+{
+	return usb_register(&touchkit_driver);
+}
+
+static void __exit touchkit_cleanup(void)
+{
+	usb_deregister(&touchkit_driver);
+}
+
+module_init(touchkit_init);
+module_exit(touchkit_cleanup);
+
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
--- a/drivers/usb/input/wacom.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/input/wacom.c	Tue Jun 15 22:20:36 2004
@@ -527,7 +527,7 @@
 		     __FUNCTION__, retval);
 }
 
-struct wacom_features wacom_features[] = {
+static struct wacom_features wacom_features[] = {
 	{ "Wacom Penpartner",    7,   5040,  3780,  255, 32, 0, wacom_penpartner_irq },
         { "Wacom Graphire",      8,  10206,  7422,  511, 32, 1, wacom_graphire_irq },
 	{ "Wacom Graphire2 4x5", 8,  10206,  7422,  511, 32, 1, wacom_graphire_irq },
@@ -556,7 +556,7 @@
  	{ }
 };
 
-struct usb_device_id wacom_ids[] = {
+static struct usb_device_id wacom_ids[] = {
 	{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x00) },
 	{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x10) },
 	{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x11) },
diff -Nru a/drivers/usb/media/Kconfig b/drivers/usb/media/Kconfig
--- a/drivers/usb/media/Kconfig	Tue Jun 15 22:20:35 2004
+++ b/drivers/usb/media/Kconfig	Tue Jun 15 22:20:35 2004
@@ -108,7 +108,7 @@
 
 config USB_PWC
 	tristate "USB Philips Cameras"
-	depends on USB && VIDEO_DEV && BROKEN
+	depends on USB && VIDEO_DEV
 	---help---
 	  Say Y or M here if you want to use one of these Philips & OEM
           webcams:
diff -Nru a/drivers/usb/media/dsbr100.c b/drivers/usb/media/dsbr100.c
--- a/drivers/usb/media/dsbr100.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/usb/media/dsbr100.c	Tue Jun 15 22:20:39 2004
@@ -33,6 +33,9 @@
 
  History:
 
+ Version 0.40:
+  Markus: Updates for 2.6.x kernels, code layout changes, name sanitizing
+
  Version 0.30:
  	Markus: Updates for 2.5.x kernel and more ISO compliant source
 
@@ -75,13 +78,17 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v0.30"
+#define DRIVER_VERSION "v0.40"
 #define DRIVER_AUTHOR "Markus Demleitner <msdemlei@tucana.harvard.edu>"
 #define DRIVER_DESC "D-Link DSB-R100 USB FM radio driver"
 
 #define DSB100_VENDOR 0x04b4
 #define DSB100_PRODUCT 0x1002
 
+/* Commands the device appears to understand */
+#define DSB100_TUNE 1
+#define DSB100_ONOFF 2
+
 #define TB_LEN 16
 
 /* Frequency limits in MHz -- these are European values.  For Japanese
@@ -102,15 +109,19 @@
 static int radio_nr = -1;
 MODULE_PARM(radio_nr, "i");
 
-typedef struct
-{
-	struct usb_device *dev;
+/* Data for one (physical) device */
+typedef struct {
+	struct usb_device *usbdev;
+	struct video_device *videodev;
 	unsigned char transfer_buffer[TB_LEN];
 	int curfreq;
 	int stereo;
-} usb_dsbr100;
+	int users;
+	int removed;
+} dsbr100_device;
 
 
+/* File system interface */
 static struct file_operations usb_dsbr100_fops = {
 	.owner =	THIS_MODULE,
 	.open =		usb_dsbr100_open,
@@ -118,65 +129,84 @@
 	.ioctl =        usb_dsbr100_ioctl,
 	.llseek =       no_llseek,
 };
-static struct video_device usb_dsbr100_radio=
+
+/* V4L interface */
+static struct video_device dsbr100_videodev_template=
 {
 	.owner =	THIS_MODULE,
 	.name =		"D-Link DSB-R 100",
 	.type =		VID_TYPE_TUNER,
 	.hardware =	VID_HARDWARE_AZTECH,
 	.fops =         &usb_dsbr100_fops,
+	.release = video_device_release,
 };
 
-static int users = 0;
-
-static struct usb_device_id usb_dsbr100_table [] = {
+static struct usb_device_id usb_dsbr100_device_table [] = {
 	{ USB_DEVICE(DSB100_VENDOR, DSB100_PRODUCT) },
 	{ }						/* Terminating entry */
 };
 
-MODULE_DEVICE_TABLE (usb, usb_dsbr100_table);
+MODULE_DEVICE_TABLE (usb, usb_dsbr100_device_table);
 
+/* USB subsystem interface */
 static struct usb_driver usb_dsbr100_driver = {
 	.owner =	THIS_MODULE,
 	.name =		"dsbr100",
 	.probe =	usb_dsbr100_probe,
 	.disconnect =	usb_dsbr100_disconnect,
-	.id_table =	usb_dsbr100_table,
+	.id_table =	usb_dsbr100_device_table,
 };
 
+/* Low-level device interface begins here */
 
-static int dsbr100_start(usb_dsbr100 *radio)
+/* switch on radio */
+static int dsbr100_start(dsbr100_device *radio)
 {
-	if (usb_control_msg(radio->dev, usb_rcvctrlpipe(radio->dev, 0),
-		0x00, 0xC0, 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 ||
-	    usb_control_msg(radio->dev, usb_rcvctrlpipe(radio->dev, 0),
-		0x02, 0xC0, 0x01, 0x00, radio->transfer_buffer, 8, 300)<0)
+	if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
+			USB_REQ_GET_STATUS, 
+			USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+			0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 ||
+	usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
+			DSB100_ONOFF, 
+			USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+			0x01, 0x00, radio->transfer_buffer, 8, 300)<0)
 		return -1;
 	return (radio->transfer_buffer)[0];
 }
 
 
-static int dsbr100_stop(usb_dsbr100 *radio)
+/* switch off radio */
+static int dsbr100_stop(dsbr100_device *radio)
 {
-	if (usb_control_msg(radio->dev, usb_rcvctrlpipe(radio->dev, 0),
-		0x00, 0xC0, 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 ||
-	    usb_control_msg(radio->dev, usb_rcvctrlpipe(radio->dev, 0),
-		0x02, 0xC0, 0x00, 0x00, radio->transfer_buffer, 8, 300)<0)
+	if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
+			USB_REQ_GET_STATUS, 
+			USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+			0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 ||
+	usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
+			DSB100_ONOFF, 
+			USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+			0x00, 0x00, radio->transfer_buffer, 8, 300)<0)
 		return -1;
 	return (radio->transfer_buffer)[0];
 }
 
-
-static int dsbr100_setfreq(usb_dsbr100 *radio, int freq)
+/* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */
+static int dsbr100_setfreq(dsbr100_device *radio, int freq)
 {
 	freq = (freq/16*80)/1000+856;
-	if (usb_control_msg(radio->dev, usb_rcvctrlpipe(radio->dev, 0),
-		0x01, 0xC0, (freq>>8)&0x00ff, freq&0xff, 
-		radio->transfer_buffer, 8, 300)<0 ||
-	    usb_control_msg(radio->dev, usb_rcvctrlpipe(radio->dev, 0),
-		0x00, 0xC0, 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 ||
-	    usb_control_msg(radio->dev, usb_rcvctrlpipe(radio->dev, 0),
-		0x00, 0xC0, 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) {
+	if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
+			DSB100_TUNE, 
+			USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+			(freq>>8)&0x00ff, freq&0xff, 
+			radio->transfer_buffer, 8, 300)<0 ||
+	   usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
+		 	USB_REQ_GET_STATUS, 
+			USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+			0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 ||
+	usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
+			USB_REQ_GET_STATUS, 
+			USB_TYPE_VENDOR | USB_RECIP_DEVICE |  USB_DIR_IN,
+			0x00, 0x24, radio->transfer_buffer, 8, 300)<0) {
 		radio->stereo = -1;
 		return -1;
 	}
@@ -184,61 +214,91 @@
 	return (radio->transfer_buffer)[0];
 }
 
-static void dsbr100_getstat(usb_dsbr100 *radio)
-{
-	if (usb_control_msg(radio->dev, usb_rcvctrlpipe(radio->dev, 0),
-		0x00, 0xC0, 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0)
+/* return the device status.  This is, in effect, just whether it
+sees a stereo signal or not.  Pity. */
+static void dsbr100_getstat(dsbr100_device *radio)
+{
+	if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
+		USB_REQ_GET_STATUS, 
+		USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+		0x00 , 0x24, radio->transfer_buffer, 8, 300)<0)
 		radio->stereo = -1;
 	else
 		radio->stereo = ! (radio->transfer_buffer[0]&0x01);
 }
 
 
+/* USB subsystem interface begins here */
+
+/* check if the device is present and register with v4l and
+usb if it is */
 static int usb_dsbr100_probe(struct usb_interface *intf, 
 			 const struct usb_device_id *id)
 {
-	usb_dsbr100 *radio;
+	dsbr100_device *radio;
 
-	if (!(radio = kmalloc(sizeof(usb_dsbr100),GFP_KERNEL)))
+	if (!(radio = kmalloc(sizeof(dsbr100_device), GFP_KERNEL)))
 		return -ENOMEM;
-	usb_dsbr100_radio.priv = radio;
-	radio->dev = interface_to_usbdev (intf);
+	if (!(radio->videodev = video_device_alloc())) {
+		kfree(radio);
+		return -ENOMEM;
+	}
+	memcpy(radio->videodev, &dsbr100_videodev_template, 
+		sizeof(dsbr100_videodev_template));
+	radio->removed = 0;
+	radio->users = 0;
+	radio->usbdev = interface_to_usbdev(intf);
 	radio->curfreq = FREQ_MIN*FREQ_MUL;
-	usb_set_intfdata (intf, radio);
+	video_set_drvdata(radio->videodev, radio);
+	if (video_register_device(radio->videodev, VFL_TYPE_RADIO,
+		radio_nr)) {
+		warn("Could not register video device");
+		video_device_release(radio->videodev);
+		kfree(radio);
+		return -EIO;
+	}
+	usb_set_intfdata(intf, radio);
 	return 0;
 }
 
+/* handle unplugging of the device, release data structures
+if nothing keeps us from doing it.  If something is still
+keeping us busy, the release callback of v4l will take care
+of releasing it.  stv680.c does not relase its private
+data, so I don't do this here either.  Checking out the
+code I'd expect I better did that, but if there's a memory
+leak here it's tiny (~50 bytes per disconnect) */
 static void usb_dsbr100_disconnect(struct usb_interface *intf)
 {
-	usb_dsbr100 *radio = usb_get_intfdata (intf);
+	dsbr100_device *radio = usb_get_intfdata(intf);
 
 	usb_set_intfdata (intf, NULL);
-
 	if (radio) {
-		lock_kernel();
-		if (users) {
-			unlock_kernel();
-			return;
+		video_unregister_device(radio->videodev);
+		radio->videodev = NULL;
+		if (radio->users) {
+			kfree(radio);
+		} else {
+			radio->removed = 1;
 		}
-		kfree(radio);
-		usb_dsbr100_radio.priv = NULL;
-		unlock_kernel();
 	}
 }
 
+
+/* Video for Linux interface */
+
 static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file,
 				unsigned int cmd, void *arg)
 {
-	struct video_device *dev = video_devdata(file);
-	usb_dsbr100 *radio=dev->priv;
+	dsbr100_device *radio=video_get_drvdata(video_devdata(file));
 
 	if (!radio)
-		return -EINVAL;
+		return -EIO;
 
-	switch(cmd)
-	{
+	switch(cmd) {
 		case VIDIOCGCAP: {
 			struct video_capability *v = arg;
+
 			memset(v, 0, sizeof(*v));
 			v->type = VID_TYPE_TUNER;
 			v->channels = 1;
@@ -248,6 +308,7 @@
 		}
 		case VIDIOCGTUNER: {
 			struct video_tuner *v = arg;
+
 			dsbr100_getstat(radio);
 			if(v->tuner)	/* Only 1 tuner */ 
 				return -EINVAL;
@@ -263,21 +324,21 @@
 		}
 		case VIDIOCSTUNER: {
 			struct video_tuner *v = arg;
+
 			if(v->tuner!=0)
 				return -EINVAL;
 			/* Only 1 tuner so no setting needed ! */
 			return 0;
 		}
-		case VIDIOCGFREQ:
-		{
+		case VIDIOCGFREQ: {
 			int *freq = arg;
+
 			if (radio->curfreq==-1)
 				return -EINVAL;
 			*freq = radio->curfreq;
 			return 0;
 		}
-		case VIDIOCSFREQ:
-		{
+		case VIDIOCSFREQ: {
 			int *freq = arg;
 
 			radio->curfreq = *freq;
@@ -287,6 +348,7 @@
 		}
 		case VIDIOCGAUDIO: {
 			struct video_audio *v = arg;
+
 			memset(v, 0, sizeof(*v));
 			v->flags |= VIDEO_AUDIO_MUTABLE;
 			v->mode = VIDEO_SOUND_STEREO;
@@ -297,9 +359,9 @@
 		}
 		case VIDIOCSAUDIO: {
 			struct video_audio *v = arg;
+
 			if (v->audio) 
 				return -EINVAL;
-
 			if (v->flags&VIDEO_AUDIO_MUTE) {
 				if (dsbr100_stop(radio)==-1)
 					warn("Radio did not respond properly");
@@ -322,64 +384,40 @@
 
 static int usb_dsbr100_open(struct inode *inode, struct file *file)
 {
-	struct video_device *dev = video_devdata(file);
-	usb_dsbr100 *radio=dev->priv;
+	dsbr100_device *radio=video_get_drvdata(video_devdata(file));
 
-	if (! radio) {
-		warn("Radio not initialised");
-		return -EAGAIN;
-	}
-	if(users)
-	{
-		warn("Radio in use");
-		return -EBUSY;
-	}
-	users++;
-	if (dsbr100_start(radio)<0)
+	radio->users = 1;
+	if (dsbr100_start(radio)<0) {
 		warn("Radio did not start up properly");
+		radio->users = 0;
+		return -EIO;
+	}
 	dsbr100_setfreq(radio, radio->curfreq);
 	return 0;
 }
 
 static int usb_dsbr100_close(struct inode *inode, struct file *file)
 {
-	struct video_device *dev = video_devdata(file);
-	usb_dsbr100 *radio=dev->priv;
+	dsbr100_device *radio=video_get_drvdata(video_devdata(file));
 
 	if (!radio)
 		return -ENODEV;
-	users--;
+	radio->users = 0;
+	if (radio->removed) {
+		kfree(radio);
+	}
 	return 0;
 }
 
 static int __init dsbr100_init(void)
 {
-	int retval;
-	usb_dsbr100_radio.priv = NULL;
-	retval = usb_register(&usb_dsbr100_driver);
-	if (retval)
-		goto failed_usb_register;
-	retval = video_register_device(&usb_dsbr100_radio, VFL_TYPE_RADIO,
-				       radio_nr);
-	if (retval) {	
-		warn("Couldn't register video device");
-		goto failed_video_register;
-	}
+	int retval = usb_register(&usb_dsbr100_driver);
 	info(DRIVER_VERSION ":" DRIVER_DESC);
-	return 0;
-failed_video_register:
-	usb_deregister(&usb_dsbr100_driver);
-failed_usb_register:
 	return retval;
 }
 
 static void __exit dsbr100_exit(void)
 {
-	usb_dsbr100 *radio=usb_dsbr100_radio.priv;
-
-	if (radio)
-		dsbr100_stop(radio);
-	video_unregister_device(&usb_dsbr100_radio);
 	usb_deregister(&usb_dsbr100_driver);
 }
 
diff -Nru a/drivers/usb/media/ibmcam.c b/drivers/usb/media/ibmcam.c
--- a/drivers/usb/media/ibmcam.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/media/ibmcam.c	Tue Jun 15 22:20:38 2004
@@ -3647,7 +3647,7 @@
 {
 	struct usb_device *dev = interface_to_usbdev(intf);
 	struct uvd *uvd = NULL;
-	int i, nas, model=0, canvasX=0, canvasY=0;
+	int ix, i, nas, model=0, canvasX=0, canvasY=0;
 	int actInterface=-1, inactInterface=-1, maxPS=0;
 	__u8 ifnum = intf->altsetting->desc.bInterfaceNumber;
 	unsigned char video_ep = 0;
@@ -3718,7 +3718,7 @@
 	} while (0);
 
 	/* Validate found interface: must have one ISO endpoint */
-	nas = dev->actconfig->interface[ifnum]->num_altsetting;
+	nas = intf->num_altsetting;
 	if (debug > 0)
 		info("Number of alternate settings=%d.", nas);
 	if (nas < 2) {
@@ -3726,11 +3726,12 @@
 		return -ENODEV;
 	}
 	/* Validate all alternate settings */
-	for (i=0; i < nas; i++) {
+	for (ix=0; ix < nas; ix++) {
 		const struct usb_host_interface *interface;
 		const struct usb_endpoint_descriptor *endpoint;
 
-		interface = &dev->actconfig->interface[ifnum]->altsetting[i];
+		interface = &intf->altsetting[ix];
+		i = interface->desc.bAlternateSetting;
 		if (interface->desc.bNumEndpoints != 1) {
 			err("Interface %d. has %u. endpoints!",
 			    ifnum, (unsigned)(interface->desc.bNumEndpoints));
diff -Nru a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c
--- a/drivers/usb/media/konicawc.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/media/konicawc.c	Tue Jun 15 22:20:36 2004
@@ -381,9 +381,15 @@
 	int i, errFlag;
 	struct konicawc *cam = (struct konicawc *)uvd->user_data;
 	int pktsz;
-	struct usb_host_interface *interface;
+	struct usb_interface *intf;
+	struct usb_host_interface *interface = NULL;
 
-	interface = &dev->actconfig->interface[uvd->iface]->altsetting[spd_to_iface[cam->speed]];
+	intf = usb_ifnum_to_if(dev, uvd->iface);
+	if (intf)
+		interface = usb_altnum_to_altsetting(intf,
+				spd_to_iface[cam->speed]);
+	if (!interface)
+		return -ENXIO;
 	pktsz = interface->endpoint[1].desc.wMaxPacketSize;
 	DEBUG(1, "pktsz = %d", pktsz);
 	if (!CAMERA_IS_OPERATIONAL(uvd)) {
@@ -721,7 +727,7 @@
 {
 	struct usb_device *dev = interface_to_usbdev(intf);
 	struct uvd *uvd = NULL;
-	int i, nas;
+	int ix, i, nas;
 	int actInterface=-1, inactInterface=-1, maxPS=0;
 	unsigned char video_ep = 0;
 
@@ -741,11 +747,12 @@
 		return -ENODEV;
 	}
 	/* Validate all alternate settings */
-	for (i=0; i < nas; i++) {
+	for (ix=0; ix < nas; ix++) {
 		const struct usb_host_interface *interface;
 		const struct usb_endpoint_descriptor *endpoint;
 
-		interface = &intf->altsetting[i];
+		interface = &intf->altsetting[ix];
+		i = interface->desc.bAlternateSetting;
 		if (interface->desc.bNumEndpoints != 2) {
 			err("Interface %d. has %u. endpoints!",
 			    interface->desc.bInterfaceNumber,
diff -Nru a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c
--- a/drivers/usb/media/ov511.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/media/ov511.c	Tue Jun 15 22:20:38 2004
@@ -5603,8 +5603,16 @@
 
 	if (ov->bridge == BRG_OV518)
 	{
-		struct usb_interface *ifp = ov->dev->config[0].interface[0];
-		__u16 mxps = ifp->altsetting[7].endpoint[0].desc.wMaxPacketSize;
+		struct usb_interface *ifp;
+		struct usb_host_interface *alt;
+		__u16 mxps = 0;
+
+		ifp = usb_ifnum_to_if(ov->dev, 0);
+		if (ifp) {
+			alt = usb_altnum_to_altsetting(ifp, 7);
+			if (alt)
+				mxps = alt->endpoint[0].desc.wMaxPacketSize;
+		}
 
 		/* Some OV518s have packet numbering by default, some don't */
 		if (mxps == 897)
@@ -5805,7 +5813,7 @@
 	if (dev->descriptor.bNumConfigurations != 1)
 		return -ENODEV;
 
-	idesc = &intf->altsetting[0].desc;
+	idesc = &intf->cur_altsetting->desc;
 
 	if (idesc->bInterfaceClass != 0xFF)
 		return -ENODEV;
diff -Nru a/drivers/usb/media/pwc-if.c b/drivers/usb/media/pwc-if.c
--- a/drivers/usb/media/pwc-if.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/media/pwc-if.c	Tue Jun 15 22:20:43 2004
@@ -129,7 +129,6 @@
 
 static int pwc_video_open(struct inode *inode, struct file *file);
 static int pwc_video_close(struct inode *inode, struct file *file);
-static int pwc_video_release(struct video_device *);			  
 static ssize_t pwc_video_read(struct file *file, char *buf,
 			  size_t count, loff_t *ppos);
 static unsigned int pwc_video_poll(struct file *file, poll_table *wait);
@@ -789,7 +788,8 @@
 	struct urb *urb;
 	int i, j, ret;
 
-	struct usb_host_interface *idesc;
+	struct usb_interface *intf;
+	struct usb_host_interface *idesc = NULL;
 
 	if (pdev == NULL)
 		return -EFAULT;
@@ -801,7 +801,9 @@
 	/* Get the current alternate interface, adjust packet size */
 	if (!udev->actconfig)
 		return -EFAULT;
-	idesc = &udev->actconfig->interface[0]->altsetting[pdev->valternate];
+	intf = usb_ifnum_to_if(udev, 0);
+	if (intf)
+		idesc = usb_altnum_to_altsetting(intf, pdev->valternate);
 	if (!idesc)
 		return -EFAULT;
 
@@ -1118,12 +1120,6 @@
 	return 0;
 }
 
-static int pwc_video_release(struct video_device *vfd)
-{
-	Trace(TRACE_OPEN, "pwc_video_release() called. Now what?\n");
-}
-		
-
 /*
  *	FIXME: what about two parallel reads ????
  *      ANSWER: Not supported. You can't open the device more than once,
@@ -1852,7 +1848,7 @@
 		}
 	}
 
-	pdev->vdev.release = pwc_video_release;
+	pdev->vdev.release = video_device_release;
 	i = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr);
 	if (i < 0) {
 		Err("Failed to register as video device (%d).\n", i);
diff -Nru a/drivers/usb/media/se401.c b/drivers/usb/media/se401.c
--- a/drivers/usb/media/se401.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/media/se401.c	Tue Jun 15 22:20:38 2004
@@ -1326,7 +1326,7 @@
         if (dev->descriptor.bNumConfigurations != 1)
                 return -ENODEV;
 
-        interface = &intf->altsetting[0].desc;
+        interface = &intf->cur_altsetting->desc;
 
         /* Is it an se401? */
         if (dev->descriptor.idVendor == 0x03e8 &&
diff -Nru a/drivers/usb/media/ultracam.c b/drivers/usb/media/ultracam.c
--- a/drivers/usb/media/ultracam.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/usb/media/ultracam.c	Tue Jun 15 22:20:37 2004
@@ -95,7 +95,7 @@
  * 02-Nov-2000 First (mostly dummy) version.
  * 06-Nov-2000 Rewrote to dump all data into frame.
  */
-void ultracam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
+static void ultracam_ProcessIsocData(struct uvd *uvd, struct usbvideo_frame *frame)
 {
 	int n;
 
@@ -513,7 +513,7 @@
 {
 	struct usb_device *dev = interface_to_usbdev(intf);
 	struct uvd *uvd = NULL;
-	int i, nas;
+	int ix, i, nas;
 	int actInterface=-1, inactInterface=-1, maxPS=0;
 	unsigned char video_ep = 0;
 
@@ -540,11 +540,12 @@
 		return -ENODEV;
 	}
 	/* Validate all alternate settings */
-	for (i=0; i < nas; i++) {
+	for (ix=0; ix < nas; ix++) {
 		const struct usb_host_interface *interface;
 		const struct usb_endpoint_descriptor *endpoint;
 
-		interface = &intf->altsetting[i];
+		interface = &intf->altsetting[ix];
+		i = interface->desc.bAlternateSetting;
 		if (interface->desc.bNumEndpoints != 1) {
 			err("Interface %d. has %u. endpoints!",
 			    interface->desc.bInterfaceNumber,
diff -Nru a/drivers/usb/media/vicam.c b/drivers/usb/media/vicam.c
--- a/drivers/usb/media/vicam.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/media/vicam.c	Tue Jun 15 22:20:38 2004
@@ -1303,7 +1303,7 @@
 
 	printk(KERN_INFO "ViCam based webcam connected\n");
 
-	interface = &intf->altsetting[0];
+	interface = intf->cur_altsetting;
 
 	DBG(KERN_DEBUG "Interface %d. has %u. endpoints!\n",
 	       interface->desc.bInterfaceNumber, (unsigned) (interface->desc.bNumEndpoints));
diff -Nru a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c
--- a/drivers/usb/media/w9968cf.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/media/w9968cf.c	Tue Jun 15 22:20:43 2004
@@ -1578,7 +1578,7 @@
 
 	static struct i2c_adapter adap = {
 		.id =                I2C_ALGO_SMBUS | I2C_HW_SMBUS_W9968CF,
-		.class =             I2C_ADAP_CLASS_CAM_DIGITAL,
+		.class =             I2C_CLASS_CAM_DIGITAL,
 		.owner =             THIS_MODULE,
 		.client_register =   w9968cf_i2c_attach_inform,
 		.client_unregister = w9968cf_i2c_detach_inform,
diff -Nru a/drivers/usb/media/w9968cf.h b/drivers/usb/media/w9968cf.h
--- a/drivers/usb/media/w9968cf.h	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/media/w9968cf.h	Tue Jun 15 22:20:36 2004
@@ -189,8 +189,8 @@
 	VPP_UYVY_TO_RGBX = 0x08,
 };
 
-struct list_head w9968cf_dev_list; /* head of V4L registered cameras list */
-LIST_HEAD(w9968cf_dev_list);
+static struct list_head w9968cf_dev_list; /* head of V4L registered cameras list */
+static LIST_HEAD(w9968cf_dev_list);
 struct semaphore w9968cf_devlist_sem; /* semaphore for list traversal */
 
 /* Main device driver structure */
diff -Nru a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
--- a/drivers/usb/misc/Kconfig	Tue Jun 15 22:21:03 2004
+++ b/drivers/usb/misc/Kconfig	Tue Jun 15 22:21:03 2004
@@ -133,6 +133,18 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called speedtch.
 
+config USB_PHIDGETSERVO
+	tristate "USB PhidgetServo support"
+	depends on USB
+	help
+	  Say Y here if you want to connect an 1 or 4 Motor PhidgetServo 
+	  servo controller version 2.0 or 3.0.
+
+	  Phidgets Inc. has a web page at <http://www.phidgets.com/>.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called phidgetservo.
+
 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	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/misc/Makefile	Tue Jun 15 22:20:41 2004
@@ -15,3 +15,4 @@
 obj-$(CONFIG_USB_TEST)		+= usbtest.o
 obj-$(CONFIG_USB_TIGL)		+= tiglusb.o
 obj-$(CONFIG_USB_USS720)	+= uss720.o
+obj-$(CONFIG_USB_PHIDGETSERVO)	+= phidgetservo.o
diff -Nru a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
--- a/drivers/usb/misc/cytherm.c	Tue Jun 15 22:20:58 2004
+++ b/drivers/usb/misc/cytherm.c	Tue Jun 15 22:20:58 2004
@@ -46,9 +46,6 @@
 static int cytherm_probe(struct usb_interface *interface, 
 			 const struct usb_device_id *id);
 static void cytherm_disconnect(struct usb_interface *interface);
-int vendor_command(struct usb_device *dev, unsigned char request, 
-		   unsigned char value, unsigned char index,
-		   void *buf, int size);
 
 
 /* usb specific object needed to register this driver with the usb subsystem */
@@ -71,9 +68,9 @@
 
 
 /* Send a vendor command to device */
-int vendor_command(struct usb_device *dev, unsigned char request, 
-		   unsigned char value, unsigned char index,
-		   void *buf, int size)
+static int vendor_command(struct usb_device *dev, unsigned char request, 
+			  unsigned char value, unsigned char index,
+			  void *buf, int size)
 {
 	return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
 			       request, 
@@ -122,12 +119,12 @@
 	retval = vendor_command(cytherm->udev, WRITE_RAM, BRIGHTNESS, 
 				cytherm->brightness, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
 	/* Inform µC that we have changed the brightness setting */
 	retval = vendor_command(cytherm->udev, WRITE_RAM, BRIGHTNESS_SEM,
 				0x01, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
    
 	kfree(buffer);
    
@@ -161,13 +158,13 @@
 	/* read temperature */
 	retval = vendor_command(cytherm->udev, READ_RAM, TEMP, 0, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
 	temp = buffer[1];
    
 	/* read sign */
 	retval = vendor_command(cytherm->udev, READ_RAM, SIGN, 0, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
 	sign = buffer[1];
 
 	kfree(buffer);
@@ -205,7 +202,7 @@
 	/* check button */
 	retval = vendor_command(cytherm->udev, READ_RAM, BUTTON, 0, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
    
 	retval = buffer[1];
 
@@ -242,7 +239,7 @@
 
 	retval = vendor_command(cytherm->udev, READ_PORT, 0, 0, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
 
 	retval = buffer[1];
 
@@ -277,7 +274,7 @@
 	retval = vendor_command(cytherm->udev, WRITE_PORT, 0,
 				tmp, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
 
 	kfree(buffer);
 
@@ -302,7 +299,7 @@
 
 	retval = vendor_command(cytherm->udev, READ_PORT, 1, 0, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
    
 	retval = buffer[1];
 
@@ -337,7 +334,7 @@
 	retval = vendor_command(cytherm->udev, WRITE_PORT, 1,
 				tmp, buffer, 8);
 	if (retval)
-		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
+		dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
 
 	kfree(buffer);
 
diff -Nru a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
--- a/drivers/usb/misc/emi26.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/misc/emi26.c	Tue Jun 15 22:20:38 2004
@@ -194,7 +194,7 @@
 
 	/* return 1 to fail the driver inialization
 	 * and give real driver change to load */
-	return 1;
+	err = 1;
 
 wraperr:
 	kfree(buf);
@@ -226,7 +226,7 @@
 {
 }
 
-struct usb_driver emi26_driver = {
+static struct usb_driver emi26_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "emi26 - firmware loader",
 	.probe		= emi26_probe,
diff -Nru a/drivers/usb/misc/emi26_fw.h b/drivers/usb/misc/emi26_fw.h
--- a/drivers/usb/misc/emi26_fw.h	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/misc/emi26_fw.h	Tue Jun 15 22:20:44 2004
@@ -17,7 +17,7 @@
  * any driver which includes this firmware, in whole or in part,
  * requires the inclusion of this statement.
  */
-INTEL_HEX_RECORD g_bitstream[]={
+static INTEL_HEX_RECORD g_bitstream[]={
 {  16, 0x8010, 0, {0xff,0xff,0xff,0xff,0xaa,0x99,0x55,0x66,0x30,0x00,0x80,0x01,0x00,0x00,0x00,0x07 } },
 {  16, 0x8020, 0, {0x30,0x01,0x60,0x01,0x00,0x00,0x00,0x0b,0x30,0x01,0x20,0x01,0x00,0x80,0x3f,0x2d } },
 {  16, 0x8030, 0, {0x30,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x30,0x00,0x80,0x01,0x00,0x00,0x00,0x09 } },
@@ -4406,7 +4406,7 @@
  * any driver which includes this firmware, in whole or in part,
  * requires the inclusion of this statement.
  */
-INTEL_HEX_RECORD g_Firmware[] = {
+static INTEL_HEX_RECORD g_Firmware[] = {
 {   3,0x0000,0,{0x02,0x43,0x56} },
 {   3,0x0003,0,{0x02,0x4b,0xcd} },
 {   3,0x000b,0,{0x02,0x4b,0xd2} },
@@ -5669,7 +5669,7 @@
  * any driver which includes this firmware, in whole or in part,
  * requires the inclusion of this statement.
  */
-INTEL_HEX_RECORD g_Loader[] = {
+static INTEL_HEX_RECORD g_Loader[] = {
 {   3,0x0000,0,{0x02,0x03,0x1c} },
 {   3,0x0043,0,{0x02,0x04,0x00} },
 {  16,0x0100,0,{0x90,0x7f,0xe9,0xe0,0x24,0x5b,0x60,0x60,0x24,0x02,0x60,0x03,0x02,0x01,0xbe,0x90} },
diff -Nru a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
--- a/drivers/usb/misc/emi62.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/misc/emi62.c	Tue Jun 15 22:20:44 2004
@@ -229,6 +229,8 @@
 		goto wraperr;
 	}
 
+	kfree(buf);
+
 	/* return 1 to fail the driver inialization
 	 * and give real driver change to load */
 	return 1;
@@ -265,7 +267,7 @@
 {
 }
 
-struct usb_driver emi62_driver = {
+static struct usb_driver emi62_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "emi62 - firmware loader",
 	.probe		= emi62_probe,
diff -Nru a/drivers/usb/misc/emi62_fw_m.h b/drivers/usb/misc/emi62_fw_m.h
--- a/drivers/usb/misc/emi62_fw_m.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/misc/emi62_fw_m.h	Tue Jun 15 22:20:38 2004
@@ -3,7 +3,7 @@
  */
 /* generated Tue Jun 3 21:36:11 EEST 2003 */
 
-INTEL_HEX_RECORD g_emi62bs[]={
+static INTEL_HEX_RECORD g_emi62bs[]={
   16, 0x8010, 0, {0xff,0xff,0xff,0xff,0xaa,0x99,0x55,0x66,0x30,0x00,0x80,0x01,0x00,0x00,0x00,0x07 },
   16, 0x8020, 0, {0x30,0x01,0x60,0x01,0x00,0x00,0x00,0x0d,0x30,0x01,0x20,0x01,0x00,0x80,0x3f,0x2d },
   16, 0x8030, 0, {0x30,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x30,0x00,0x80,0x01,0x00,0x00,0x00,0x09 },
@@ -6112,7 +6112,7 @@
 };
 // VERSION= 1.0.0.191
 // DATE= 2002oct28
-INTEL_HEX_RECORD g_HexMidiFw62[] = {
+static INTEL_HEX_RECORD g_HexMidiFw62[] = {
    3,0x0000,0,{0x02,0x46,0xb9},
    3,0x0003,0,{0x02,0x0f,0xfd},
    3,0x000b,0,{0x02,0x4e,0x0f},
@@ -8640,7 +8640,8 @@
 /*
 VERSION=1.04.062
 DATE=16.10.2002  
-*/INTEL_HEX_RECORD g_emi62_loader[] = {
+*/
+static INTEL_HEX_RECORD g_emi62_loader[] = {
    3,0x0000,0,{0x02,0x02,0x87},
    3,0x0043,0,{0x02,0x04,0x00},
   16,0x0100,0,{0xe4,0xff,0xfe,0xc2,0x20,0xd2,0xe8,0x43,0xd8,0x20,0x90,0x7f,0xab,0x74,0xff,0xf0},
diff -Nru a/drivers/usb/misc/emi62_fw_s.h b/drivers/usb/misc/emi62_fw_s.h
--- a/drivers/usb/misc/emi62_fw_s.h	Tue Jun 15 22:20:39 2004
+++ b/drivers/usb/misc/emi62_fw_s.h	Tue Jun 15 22:20:39 2004
@@ -3,7 +3,7 @@
  */
 /* generated Tue Apr 15 21:59:42 EEST 2003 */
 
-INTEL_HEX_RECORD g_emi62bs[]={
+static INTEL_HEX_RECORD g_emi62bs[]={
  {16, 0x8010, 0, {0xff,0xff,0xff,0xff,0xaa,0x99,0x55,0x66,0x30,0x00,0x80,0x01,0x00,0x00,0x00,0x07 }},
  {16, 0x8020, 0, {0x30,0x01,0x60,0x01,0x00,0x00,0x00,0x0d,0x30,0x01,0x20,0x01,0x00,0x80,0x3f,0x2d }},
  {16, 0x8030, 0, {0x30,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x30,0x00,0x80,0x01,0x00,0x00,0x00,0x09 }},
@@ -6112,7 +6112,7 @@
 };
 // VERSION= 1.0.0.191
 // DATE= 2002oct28
-INTEL_HEX_RECORD g_HexSpdifFw62[] = {
+static INTEL_HEX_RECORD g_HexSpdifFw62[] = {
   {3,0x0000,0,{0x02,0x45,0xf9}},
  { 3,0x0003,0,{0x02,0x0f,0xfd}},
  { 3,0x000b,0,{0x02,0x4d,0x9b}},
@@ -8623,7 +8623,8 @@
 /*
 VERSION=1.04.062
 DATE=16.10.2002  
-*/INTEL_HEX_RECORD g_emi62_loader[] = {
+*/
+static INTEL_HEX_RECORD g_emi62_loader[] = {
  { 3,0x0000,0,{0x02,0x02,0x87}},
  { 3,0x0043,0,{0x02,0x04,0x00}},
  {16,0x0100,0,{0xe4,0xff,0xfe,0xc2,0x20,0xd2,0xe8,0x43,0xd8,0x20,0x90,0x7f,0xab,0x74,0xff,0xf0}},
diff -Nru a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
--- a/drivers/usb/misc/legousbtower.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/misc/legousbtower.c	Tue Jun 15 22:20:40 2004
@@ -1,8 +1,8 @@
 /*
  * LEGO USB Tower driver
  *
- * Copyright (C) 2003 David Glance <davidgsf@sourceforge.net> 
- *               2001 Juergen Stuber <stuber@loria.fr>
+ * Copyright (C) 2003 David Glance <davidgsf@sourceforge.net>
+ *               2001-2004 Juergen Stuber <starblue@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
@@ -33,14 +33,44 @@
  *   - changed to use lego0 rather than tower0
  *   - changed dbg() to use __func__ rather than deprecated __FUNCTION__
  * 2003-01-12 - 0.53 david (david@csse.uwa.edu.au)
- *   - changed read and write to write everything or timeout (from a patch by Chris Riesen and 
- *     Brett Thaeler driver)
+ *   - changed read and write to write everything or
+ *     timeout (from a patch by Chris Riesen and Brett Thaeler driver)
  *   - added ioctl functionality to set timeouts
- * 2003-07-18 - 0.54 davidgsf (david@csse.uwa.edu.au) 
+ * 2003-07-18 - 0.54 davidgsf (david@csse.uwa.edu.au)
  *   - initial import into LegoUSB project
  *   - merge of existing LegoUSB.c driver
- * 2003-07-18 - 0.56 davidgsf (david@csse.uwa.edu.au) 
+ * 2003-07-18 - 0.56 davidgsf (david@csse.uwa.edu.au)
  *   - port to 2.6 style driver
+ * 2004-02-29 - 0.6 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - fix locking
+ *   - unlink read URBs which are no longer needed
+ *   - allow increased buffer size, eliminates need for timeout on write
+ *   - have read URB running continuously
+ *   - added poll
+ *   - forbid seeking
+ *   - added nonblocking I/O
+ *   - changed back __func__ to __FUNCTION__
+ *   - read and log tower firmware version
+ *   - reset tower on probe, avoids failure of first write
+ * 2004-03-09 - 0.7 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - timeout read now only after inactivity, shorten default accordingly
+ * 2004-03-11 - 0.8 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - log major, minor instead of possibly confusing device filename
+ *   - whitespace cleanup
+ * 2004-03-12 - 0.9 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - normalize whitespace in debug messages
+ *   - take care about endianness in control message responses
+ * 2004-03-13 - 0.91 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - make default intervals longer to accommodate current EHCI driver
+ * 2004-03-19 - 0.92 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - replaced atomic_t by memory barriers
+ * 2004-04-21 - 0.93 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - wait for completion of write urb in release (needed for remotecontrol)
+ *   - corrected poll for write direction (missing negation)
+ * 2004-04-22 - 0.94 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - make device locking interruptible
+ * 2004-04-30 - 0.95 Juergen Stuber <starblue@users.sourceforge.net>
+ *   - check for valid udev on resubmitting and unlinking urbs
  */
 
 #include <linux/config.h>
@@ -53,33 +83,113 @@
 #include <linux/completion.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
+#include <linux/poll.h>
 
 
 #ifdef CONFIG_USB_DEBUG
 	static int debug = 4;
 #else
-	static int debug = 1;
+	static int debug = 0;
 #endif
 
 /* Use our own dbg macro */
 #undef dbg
-#define dbg(lvl, format, arg...) do { if (debug >= lvl) printk(KERN_DEBUG  __FILE__ " : " format " \n", ## arg); } while (0)
+#define dbg(lvl, format, arg...) do { if (debug >= lvl) printk(KERN_DEBUG  __FILE__ ": " format "\n", ## arg); } while (0)
 
 
 /* Version Information */
-#define DRIVER_VERSION "v0.56"
-#define DRIVER_AUTHOR "David Glance, davidgsf@sourceforge.net"
+#define DRIVER_VERSION "v0.95"
+#define DRIVER_AUTHOR "Juergen Stuber <starblue@sourceforge.net>"
 #define DRIVER_DESC "LEGO USB Tower Driver"
 
-/* Module paramaters */
+/* Module parameters */
 MODULE_PARM(debug, "i");
 MODULE_PARM_DESC(debug, "Debug enabled or not");
 
+/* The defaults are chosen to work with the latest versions of leJOS and NQC.
+ */
+
+/* Some legacy software likes to receive packets in one piece.
+ * In this case read_buffer_size should exceed the maximal packet length
+ * (417 for datalog uploads), and packet_timeout should be set.
+ */
+static size_t read_buffer_size = 480;
+MODULE_PARM(read_buffer_size, "i");
+MODULE_PARM_DESC(read_buffer_size, "Read buffer size");
+
+/* Some legacy software likes to send packets in one piece.
+ * In this case write_buffer_size should exceed the maximal packet length
+ * (417 for firmware and program downloads).
+ * A problem with long writes is that the following read may time out
+ * if the software is not prepared to wait long enough.
+ */
+static size_t write_buffer_size = 480;
+MODULE_PARM(write_buffer_size, "i");
+MODULE_PARM_DESC(write_buffer_size, "Write buffer size");
+
+/* Some legacy software expects reads to contain whole LASM packets.
+ * To achieve this, characters which arrive before a packet timeout
+ * occurs will be returned in a single read operation.
+ * A problem with long reads is that the software may time out
+ * if it is not prepared to wait long enough.
+ * The packet timeout should be greater than the time between the
+ * reception of subsequent characters, which should arrive about
+ * every 5ms for the standard 2400 baud.
+ * Set it to 0 to disable.
+ */
+static int packet_timeout = 50;
+MODULE_PARM(packet_timeout, "i");
+MODULE_PARM_DESC(packet_timeout, "Packet timeout in ms");
+
+/* Some legacy software expects blocking reads to time out.
+ * Timeout occurs after the specified time of read and write inactivity.
+ * Set it to 0 to disable.
+ */
+static int read_timeout = 200;
+MODULE_PARM(read_timeout, "i");
+MODULE_PARM_DESC(read_timeout, "Read timeout in ms");
+
+/* As of kernel version 2.6.4 ehci-hcd uses an
+ * "only one interrupt transfer per frame" shortcut
+ * to simplify the scheduling of periodic transfers.
+ * This conflicts with our standard 1ms intervals for in and out URBs.
+ * We use default intervals of 2ms for in and 8ms for out transfers,
+ * which is fast enough for 2400 baud and allows a small additional load.
+ * Increase the interval to allow more devices that do interrupt transfers,
+ * or set to 0 to use the standard interval from the endpoint descriptors.
+ */
+static int interrupt_in_interval = 2;
+MODULE_PARM(interrupt_in_interval, "i");
+MODULE_PARM_DESC(interrupt_in_interval, "Interrupt in interval in ms");
+
+static int interrupt_out_interval = 8;
+MODULE_PARM(interrupt_out_interval, "i");
+MODULE_PARM_DESC(interrupt_out_interval, "Interrupt out interval in ms");
 
 /* Define these values to match your device */
 #define LEGO_USB_TOWER_VENDOR_ID	0x0694
 #define LEGO_USB_TOWER_PRODUCT_ID	0x0001
 
+/* Vendor requests */
+#define LEGO_USB_TOWER_REQUEST_RESET		0x04
+#define LEGO_USB_TOWER_REQUEST_GET_VERSION	0xFD
+
+struct tower_reset_reply {
+	__u16 size;		/* little-endian */
+	__u8 err_code;
+	__u8 spare;
+} __attribute__ ((packed));
+
+struct tower_get_version_reply {
+	__u16 size;		/* little-endian */
+	__u8 err_code;
+	__u8 spare;
+	__u8 major;
+	__u8 minor;
+	__u16 build_no;		/* little-endian */
+} __attribute__ ((packed));
+
+
 /* table of devices that work with this driver */
 static struct usb_device_id tower_table [] = {
 	{ USB_DEVICE(LEGO_USB_TOWER_VENDOR_ID, LEGO_USB_TOWER_PRODUCT_ID) },
@@ -90,22 +200,21 @@
 
 #define LEGO_USB_TOWER_MINOR_BASE	160
 
-/* we can have up to this number of device plugged in at once */
-#define MAX_DEVICES		16
-
-#define COMMAND_TIMEOUT		(2*HZ)  /* 2 second timeout for a command */
 
 /* Structure to hold all of our device specific stuff */
 struct lego_usb_tower {
 	struct semaphore	sem;		/* locks this structure */
-	struct usb_device* 	udev;		/* save off the usb device pointer */
-	struct usb_interface*   interface;
+	struct usb_device*	udev;		/* save off the usb device pointer */
 	unsigned char		minor;		/* the starting minor number for this device */
 
 	int			open_count;	/* number of times this port has been opened */
 
 	char*			read_buffer;
-	int			read_buffer_length;
+	size_t			read_buffer_length; /* this much came in */
+	size_t			read_packet_length; /* this much will be returned on read */
+	spinlock_t		read_buffer_lock;
+	int			packet_timeout_jiffies;
+	unsigned long		read_last_arrival;
 
 	wait_queue_head_t	read_wait;
 	wait_queue_head_t	write_wait;
@@ -113,18 +222,18 @@
 	char*			interrupt_in_buffer;
 	struct usb_endpoint_descriptor* interrupt_in_endpoint;
 	struct urb*		interrupt_in_urb;
+	int			interrupt_in_interval;
+	int			interrupt_in_running;
+	int			interrupt_in_done;
 
 	char*			interrupt_out_buffer;
 	struct usb_endpoint_descriptor* interrupt_out_endpoint;
 	struct urb*		interrupt_out_urb;
+	int			interrupt_out_interval;
+	int			interrupt_out_busy;
 
 };
 
-/* Note that no locking is needed:
- * read_buffer is arbitrated by read_buffer_length == 0
- * interrupt_out_buffer is arbitrated by interrupt_out_urb->status == -EINPROGRESS
- * interrupt_in_buffer belongs to urb alone and is overwritten on overflow
- */
 
 /* local function prototypes */
 static ssize_t tower_read	(struct file *file, char *buffer, size_t count, loff_t *ppos);
@@ -132,8 +241,11 @@
 static inline void tower_delete (struct lego_usb_tower *dev);
 static int tower_open		(struct inode *inode, struct file *file);
 static int tower_release	(struct inode *inode, struct file *file);
-static int tower_release_internal (struct lego_usb_tower *dev);
+static unsigned int tower_poll	(struct file *file, poll_table *wait);
+static loff_t tower_llseek	(struct file *file, loff_t off, int whence);
+
 static void tower_abort_transfers (struct lego_usb_tower *dev);
+static void tower_check_for_read_packet (struct lego_usb_tower *dev);
 static void tower_interrupt_in_callback (struct urb *urb, struct pt_regs *regs);
 static void tower_interrupt_out_callback (struct urb *urb, struct pt_regs *regs);
 
@@ -146,14 +258,16 @@
 
 /* file operations needed when we register this driver */
 static struct file_operations tower_fops = {
-	.owner = 	THIS_MODULE,
-	.read  = 	tower_read,
+	.owner =	THIS_MODULE,
+	.read  =	tower_read,
 	.write =	tower_write,
 	.open =		tower_open,
-	.release = 	tower_release,
+	.release =	tower_release,
+	.poll =		tower_poll,
+	.llseek =	tower_llseek,
 };
 
-/* 
+/*
  * usb class driver info in order to get a minor number from the usb core,
  * and to have the device registered with devfs and the driver core
  */
@@ -167,11 +281,11 @@
 
 /* usb specific object needed to register this driver with the usb subsystem */
 static struct usb_driver tower_driver = {
-	.owner =        THIS_MODULE,
-	.name =	        "legousbtower",
-	.probe = 	tower_probe,
-	.disconnect = 	tower_disconnect,
-	.id_table = 	tower_table,
+	.owner =	THIS_MODULE,
+	.name =		"legousbtower",
+	.probe =	tower_probe,
+	.disconnect =	tower_disconnect,
+	.id_table =	tower_table,
 };
 
 
@@ -183,8 +297,8 @@
 	int i;
 
 	if (debug < level)
-		return; 
-	
+		return;
+
 	printk (KERN_DEBUG __FILE__": %s - length = %d, data = ", function, size);
 	for (i = 0; i < size; ++i) {
 		printk ("%.2x ", data[i]);
@@ -198,7 +312,7 @@
  */
 static inline void tower_delete (struct lego_usb_tower *dev)
 {
-	dbg(2, "%s enter", __func__);
+	dbg(2, "%s: enter", __FUNCTION__);
 
 	tower_abort_transfers (dev);
 
@@ -214,7 +328,7 @@
 	kfree (dev->interrupt_out_buffer);
 	kfree (dev);
 
-	dbg(2, "%s : leave", __func__);
+	dbg(2, "%s: leave", __FUNCTION__);
 }
 
 
@@ -228,7 +342,7 @@
 	int retval = 0;
 	struct usb_interface *interface;
 
-	dbg(2,"%s : enter", __func__);
+	dbg(2, "%s: enter", __FUNCTION__);
 
 	subminor = iminor(inode);
 
@@ -240,37 +354,63 @@
 		err ("%s - error, can't find device for minor %d",
 		     __FUNCTION__, subminor);
 		retval = -ENODEV;
-		goto exit_no_device;
+		goto unlock_disconnect_exit;
 	}
 
 	dev = usb_get_intfdata(interface);
 
 	if (!dev) {
 		retval = -ENODEV;
-		goto exit_no_device;
+		goto unlock_disconnect_exit;
 	}
 
 	/* lock this device */
-	down (&dev->sem);
-
-	
-	/* increment our usage count for the device */
-	++dev->open_count;
-
-	/* save device in the file's private structure */
-	file->private_data = dev;
+	if (down_interruptible (&dev->sem)) {
+	        retval = -ERESTARTSYS;
+		goto unlock_disconnect_exit;
+	}
 
+	/* allow opening only once */
+	if (dev->open_count) {
+		retval = -EBUSY;
+		goto unlock_exit;
+	}
+	dev->open_count = 1;
 
 	/* initialize in direction */
 	dev->read_buffer_length = 0;
+	dev->read_packet_length = 0;
+	usb_fill_int_urb (dev->interrupt_in_urb,
+			  dev->udev,
+			  usb_rcvintpipe(dev->udev, dev->interrupt_in_endpoint->bEndpointAddress),
+			  dev->interrupt_in_buffer,
+			  dev->interrupt_in_endpoint->wMaxPacketSize,
+			  tower_interrupt_in_callback,
+			  dev,
+			  dev->interrupt_in_interval);
+
+	dev->interrupt_in_running = 1;
+	dev->interrupt_in_done = 0;
+	mb();
 
-	up (&dev->sem);
+	retval = usb_submit_urb (dev->interrupt_in_urb, GFP_KERNEL);
+	if (retval) {
+		err("Couldn't submit interrupt_in_urb %d", retval);
+		dev->interrupt_in_running = 0;
+		dev->open_count = 0;
+		goto unlock_exit;
+	}
 
-exit_no_device:
+	/* save device in the file's private structure */
+	file->private_data = dev;
 
+unlock_exit:
+	up (&dev->sem);
+
+unlock_disconnect_exit:
 	up (&disconnect_sem);
 
-	dbg(2,"%s : leave, return value %d ", __func__, retval);
+	dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval);
 
 	return retval;
 }
@@ -283,87 +423,137 @@
 	struct lego_usb_tower *dev;
 	int retval = 0;
 
-	dbg(2," %s : enter", __func__);
+	dbg(2, "%s: enter", __FUNCTION__);
 
 	dev = (struct lego_usb_tower *)file->private_data;
 
 	if (dev == NULL) {
-		dbg(1," %s : object is NULL", __func__);
+		dbg(1, "%s: object is NULL", __FUNCTION__);
 		retval = -ENODEV;
 		goto exit;
 	}
 
+	if (down_interruptible (&dev->sem)) {
+	        retval = -ERESTARTSYS;
+		goto exit;
+	}
 
-	/* lock our device */
-	down (&dev->sem);
-
- 	if (dev->open_count <= 0) {
-		dbg(1," %s : device not opened", __func__);
+	if (dev->open_count != 1) {
+		dbg(1, "%s: device not opened exactly once", __FUNCTION__);
 		retval = -ENODEV;
+		goto unlock_exit;
+	}
+	if (dev->udev == NULL) {
+		/* the device was unplugged before the file was released */
+		up (&dev->sem);	/* unlock here as tower_delete frees dev */
+		tower_delete (dev);
 		goto exit;
 	}
 
-	/* do the work */
-	retval = tower_release_internal (dev);
+	/* wait until write transfer is finished */
+	if (dev->interrupt_out_busy) {
+		wait_event_interruptible_timeout (dev->write_wait, !dev->interrupt_out_busy, 2 * HZ);
+	}
+	tower_abort_transfers (dev);
+	dev->open_count = 0;
 
-exit:
+unlock_exit:
 	up (&dev->sem);
-	dbg(2," %s : leave, return value %d", __func__, retval);
+
+exit:
+	dbg(2, "%s: leave, return value %d", __FUNCTION__, retval);
 	return retval;
 }
 
 
 /**
- *	tower_release_internal
+ *	tower_abort_transfers
+ *      aborts transfers and frees associated data structures
  */
-static int tower_release_internal (struct lego_usb_tower *dev)
+static void tower_abort_transfers (struct lego_usb_tower *dev)
 {
-	int retval = 0;
+	dbg(2, "%s: enter", __FUNCTION__);
 
-	dbg(2," %s : enter", __func__);
-
-	if (dev->udev == NULL) {
-		/* the device was unplugged before the file was released */
-		tower_delete (dev);
+	if (dev == NULL) {
+		dbg(1, "%s: dev is null", __FUNCTION__);
 		goto exit;
 	}
 
-	/* decrement our usage count for the device */
-	--dev->open_count;
-	if (dev->open_count <= 0) {
-		tower_abort_transfers (dev);
-		dev->open_count = 0;
+	/* shutdown transfer */
+	if (dev->interrupt_in_running) {
+		dev->interrupt_in_running = 0;
+		mb();
+		if (dev->interrupt_in_urb != NULL && dev->udev) {
+			usb_unlink_urb (dev->interrupt_in_urb);
+		}
+	}
+	if (dev->interrupt_out_busy) {
+		if (dev->interrupt_out_urb != NULL && dev->udev) {
+			usb_unlink_urb (dev->interrupt_out_urb);
+		}
 	}
 
 exit:
-	dbg(2," %s : leave", __func__);
-	return retval;
+	dbg(2, "%s: leave", __FUNCTION__);
 }
 
 
 /**
- *	tower_abort_transfers
- *      aborts transfers and frees associated data structures
+ *	tower_check_for_read_packet
+ *
+ *      To get correct semantics for signals and non-blocking I/O
+ *      with packetizing we pretend not to see any data in the read buffer
+ *      until it has been there unchanged for at least
+ *      dev->packet_timeout_jiffies, or until the buffer is full.
  */
-static void tower_abort_transfers (struct lego_usb_tower *dev)
+static void tower_check_for_read_packet (struct lego_usb_tower *dev)
 {
-	dbg(2," %s : enter", __func__);
-
-	if (dev == NULL) {
-		dbg(1," %s : dev is null", __func__);
-	        goto exit;
+	spin_lock_irq (&dev->read_buffer_lock);
+	if (!packet_timeout
+	    || time_after(jiffies, dev->read_last_arrival + dev->packet_timeout_jiffies)
+	    || dev->read_buffer_length == read_buffer_size) {
+		dev->read_packet_length = dev->read_buffer_length;
 	}
+	dev->interrupt_in_done = 0;
+	spin_unlock_irq (&dev->read_buffer_lock);
+}
 
-	/* shutdown transfer */
-	if (dev->interrupt_in_urb != NULL) {
-		usb_unlink_urb (dev->interrupt_in_urb);
+
+/**
+ *	tower_poll
+ */
+static unsigned int tower_poll (struct file *file, poll_table *wait)
+{
+	struct lego_usb_tower *dev;
+	unsigned int mask = 0;
+
+	dbg(2, "%s: enter", __FUNCTION__);
+
+	dev = file->private_data;
+
+	poll_wait(file, &dev->read_wait, wait);
+	poll_wait(file, &dev->write_wait, wait);
+
+	tower_check_for_read_packet(dev);
+	if (dev->read_packet_length > 0) {
+		mask |= POLLIN | POLLRDNORM;
 	}
-	if (dev->interrupt_out_urb != NULL) {
-		usb_unlink_urb (dev->interrupt_out_urb);
+	if (!dev->interrupt_out_busy) {
+		mask |= POLLOUT | POLLWRNORM;
 	}
 
-exit:
-	dbg(2," %s : leave", __func__);
+	dbg(2, "%s: leave, mask = %d", __FUNCTION__, mask);
+
+	return mask;
+}
+
+
+/**
+ *	tower_llseek
+ */
+static loff_t tower_llseek (struct file *file, loff_t off, int whence)
+{
+	return -ESPIPE;		/* unseekable */
 }
 
 
@@ -373,96 +563,87 @@
 static ssize_t tower_read (struct file *file, char *buffer, size_t count, loff_t *ppos)
 {
 	struct lego_usb_tower *dev;
-	size_t bytes_read = 0;
 	size_t bytes_to_read;
 	int i;
 	int retval = 0;
-	int timeout = 0;
+	unsigned long timeout = 0;
 
-	dbg(2," %s : enter, count = %Zd", __func__, count);
+	dbg(2, "%s: enter, count = %Zd", __FUNCTION__, count);
 
 	dev = (struct lego_usb_tower *)file->private_data;
-	
+
 	/* lock this object */
-	down (&dev->sem);
+	if (down_interruptible (&dev->sem)) {
+		retval = -ERESTARTSYS;
+		goto exit;
+	}
 
 	/* verify that the device wasn't unplugged */
 	if (dev->udev == NULL) {
 		retval = -ENODEV;
 		err("No device or device unplugged %d", retval);
-		goto exit;
+		goto unlock_exit;
 	}
 
 	/* verify that we actually have some data to read */
 	if (count == 0) {
-		dbg(1," %s : read request of 0 bytes", __func__);
-		goto exit;
+		dbg(1, "%s: read request of 0 bytes", __FUNCTION__);
+		goto unlock_exit;
 	}
 
+	if (read_timeout) {
+		timeout = jiffies + read_timeout * HZ / 1000;
+	}
+
+	/* wait for data */
+	tower_check_for_read_packet (dev);
+	while (dev->read_packet_length == 0) {
+		if (file->f_flags & O_NONBLOCK) {
+			retval = -EAGAIN;
+			goto unlock_exit;
+		}
+		retval = wait_event_interruptible_timeout(dev->read_wait, dev->interrupt_in_done, dev->packet_timeout_jiffies);
+		if (retval < 0) {
+			goto unlock_exit;
+		}
 
-	timeout = COMMAND_TIMEOUT;
+		/* reset read timeout during read or write activity */
+		if (read_timeout
+		    && (dev->read_buffer_length || dev->interrupt_out_busy)) {
+			timeout = jiffies + read_timeout * HZ / 1000;
+		}
+		/* check for read timeout */
+		if (read_timeout && time_after (jiffies, timeout)) {
+			retval = -ETIMEDOUT;
+			goto unlock_exit;
+		}
+		tower_check_for_read_packet (dev);
+	}
 
-	while (1) {
-		if (dev->read_buffer_length == 0) {
+	/* copy the data from read_buffer into userspace */
+	bytes_to_read = min(count, dev->read_packet_length);
 
-			/* start reading */
-			usb_fill_int_urb (dev->interrupt_in_urb,dev->udev,
-					  usb_rcvintpipe(dev->udev, dev->interrupt_in_endpoint->bEndpointAddress),
-					  dev->interrupt_in_buffer,
-					  dev->interrupt_in_endpoint->wMaxPacketSize,
-					  tower_interrupt_in_callback,
-					  dev,
-					  dev->interrupt_in_endpoint->bInterval);
-			
-			retval = usb_submit_urb (dev->interrupt_in_urb, GFP_KERNEL);
-			
-			if (retval < 0) {
-				err("Couldn't submit interrupt_in_urb");
-				goto exit;
-			}
-
-			if (timeout <= 0) {
-			        retval = -ETIMEDOUT;
-			        goto exit;
-			}
-
-			if (signal_pending(current)) {
-				retval = -EINTR;
-				goto exit;
-			}
-
-			up (&dev->sem);
-			timeout = interruptible_sleep_on_timeout (&dev->read_wait, timeout);
-			down (&dev->sem);
+	if (copy_to_user (buffer, dev->read_buffer, bytes_to_read)) {
+		retval = -EFAULT;
+		goto unlock_exit;
+	}
 
-		} else {
-			/* copy the data from read_buffer into userspace */
-			bytes_to_read = count > dev->read_buffer_length ? dev->read_buffer_length : count;
-			if (copy_to_user (buffer, dev->read_buffer, bytes_to_read) != 0) {
-				retval = -EFAULT;
-				goto exit;
-			}
-			dev->read_buffer_length -= bytes_to_read;
-			for (i=0; i<dev->read_buffer_length; i++) {
-				dev->read_buffer[i] = dev->read_buffer[i+bytes_to_read];
-			}
-
-			buffer += bytes_to_read;
-			count -= bytes_to_read;
-			bytes_read += bytes_to_read;
-			if (count == 0) {
-				break;
-			}
-		}
+	spin_lock_irq (&dev->read_buffer_lock);
+	dev->read_buffer_length -= bytes_to_read;
+	dev->read_packet_length -= bytes_to_read;
+	for (i=0; i<dev->read_buffer_length; i++) {
+		dev->read_buffer[i] = dev->read_buffer[i+bytes_to_read];
 	}
+	spin_unlock_irq (&dev->read_buffer_lock);
 
-	retval = bytes_read;
+	retval = bytes_to_read;
 
-exit:
+unlock_exit:
 	/* unlock the device */
 	up (&dev->sem);
 
-	dbg(2," %s : leave, return value %d", __func__, retval);
+exit:
+	dbg(2, "%s: leave, return value %d", __FUNCTION__, retval);
 	return retval;
 }
 
@@ -473,107 +654,80 @@
 static ssize_t tower_write (struct file *file, const char *buffer, size_t count, loff_t *ppos)
 {
 	struct lego_usb_tower *dev;
-	size_t bytes_written = 0;
 	size_t bytes_to_write;
-	size_t buffer_size;
 	int retval = 0;
-	int timeout = 0;
 
-	dbg(2," %s : enter, count = %Zd", __func__, count);
+	dbg(2, "%s: enter, count = %Zd", __FUNCTION__, count);
 
 	dev = (struct lego_usb_tower *)file->private_data;
 
 	/* lock this object */
-	down (&dev->sem);
+	if (down_interruptible (&dev->sem)) {
+		retval = -ERESTARTSYS;
+		goto exit;
+	}
 
 	/* verify that the device wasn't unplugged */
 	if (dev->udev == NULL) {
 		retval = -ENODEV;
 		err("No device or device unplugged %d", retval);
-		goto exit;
+		goto unlock_exit;
 	}
 
 	/* verify that we actually have some data to write */
 	if (count == 0) {
-		dbg(1," %s : write request of 0 bytes", __func__);
-		goto exit;
+		dbg(1, "%s: write request of 0 bytes", __FUNCTION__);
+		goto unlock_exit;
 	}
 
+	/* wait until previous transfer is finished */
+	while (dev->interrupt_out_busy) {
+		if (file->f_flags & O_NONBLOCK) {
+			retval = -EAGAIN;
+			goto unlock_exit;
+		}
+		retval = wait_event_interruptible (dev->write_wait, !dev->interrupt_out_busy);
+		if (retval) {
+			goto unlock_exit;
+		}
+	}
 
-	while (count > 0) {
-		if (dev->interrupt_out_urb->status == -EINPROGRESS) {
-			timeout = COMMAND_TIMEOUT;
-
-			while (timeout > 0) {
-				if (signal_pending(current)) {
-					dbg(1," %s : interrupted", __func__);
-					retval = -EINTR;
-					goto exit;
-				}
-				up (&dev->sem);
-				timeout = interruptible_sleep_on_timeout (&dev->write_wait, timeout);
-				down (&dev->sem);
-				if (timeout > 0) {
-					break;
-				}
-				dbg(1," %s : interrupted timeout: %d", __func__, timeout);
-			}
-
-
-			dbg(1," %s : final timeout: %d", __func__, timeout);
-
-			if (timeout == 0) {
-				dbg(1, "%s - command timed out.", __func__);
-				retval = -ETIMEDOUT;
-				goto exit;
-			}
-
-			dbg(4," %s : in progress, count = %Zd", __func__, count);
-		} else {
-			dbg(4," %s : sending, count = %Zd", __func__, count);
-
-			/* write the data into interrupt_out_buffer from userspace */
-			buffer_size = dev->interrupt_out_endpoint->wMaxPacketSize;
-			bytes_to_write = count > buffer_size ? buffer_size : count;
-			dbg(4," %s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd", __func__, buffer_size, count, bytes_to_write);
-
-			if (copy_from_user (dev->interrupt_out_buffer, buffer, bytes_to_write) != 0) {
-				retval = -EFAULT;
-				goto exit;
-			}
-
-			/* send off the urb */
-			usb_fill_int_urb(dev->interrupt_out_urb,
-					dev->udev, 
-					usb_sndintpipe(dev->udev, dev->interrupt_out_endpoint->bEndpointAddress),
-					dev->interrupt_out_buffer,
-					bytes_to_write,
-					tower_interrupt_out_callback,
-					dev,
-					dev->interrupt_in_endpoint->bInterval);
-
-			dev->interrupt_out_urb->actual_length = bytes_to_write;
-			retval = usb_submit_urb (dev->interrupt_out_urb, GFP_KERNEL);
-
-			if (retval < 0) {
-				err("Couldn't submit interrupt_out_urb %d", retval);
-				goto exit;
-			}
+	/* write the data into interrupt_out_buffer from userspace */
+	bytes_to_write = min(count, write_buffer_size);
+	dbg(4, "%s: count = %Zd, bytes_to_write = %Zd", __FUNCTION__, count, bytes_to_write);
+
+	if (copy_from_user (dev->interrupt_out_buffer, buffer, bytes_to_write)) {
+		retval = -EFAULT;
+		goto unlock_exit;
+	}
+
+	/* send off the urb */
+	usb_fill_int_urb(dev->interrupt_out_urb,
+			 dev->udev,
+			 usb_sndintpipe(dev->udev, dev->interrupt_out_endpoint->bEndpointAddress),
+			 dev->interrupt_out_buffer,
+			 bytes_to_write,
+			 tower_interrupt_out_callback,
+			 dev,
+			 dev->interrupt_out_interval);
 
-			buffer += bytes_to_write;
-			count -= bytes_to_write;
+	dev->interrupt_out_busy = 1;
+	wmb();
 
-			bytes_written += bytes_to_write;
-		}
+	retval = usb_submit_urb (dev->interrupt_out_urb, GFP_KERNEL);
+	if (retval) {
+		dev->interrupt_out_busy = 0;
+		err("Couldn't submit interrupt_out_urb %d", retval);
+		goto unlock_exit;
 	}
+	retval = bytes_to_write;
 
-	retval = bytes_written;
-
-exit:
+unlock_exit:
 	/* unlock the device */
 	up (&dev->sem);
 
-	dbg(2," %s : leave, return value %d", __func__, retval);
+exit:
+	dbg(2, "%s: leave, return value %d", __FUNCTION__, retval);
 
 	return retval;
 }
@@ -585,39 +739,53 @@
 static void tower_interrupt_in_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context;
+	int retval;
 
-	dbg(4," %s : enter, status %d", __func__, urb->status);
+	dbg(4, "%s: enter, status %d", __FUNCTION__, urb->status);
 
-	lego_usb_tower_debug_data(5,__func__, urb->actual_length, urb->transfer_buffer);
+	lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
 
-	if (urb->status != 0) {
-		if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)) {
-			dbg(1," %s : nonzero status received: %d", __func__, urb->status);
+	if (urb->status) {
+		if (urb->status == -ENOENT ||
+		    urb->status == -ECONNRESET ||
+		    urb->status == -ESHUTDOWN) {
+			goto exit;
+		} else {
+			dbg(1, "%s: nonzero status received: %d", __FUNCTION__, urb->status);
+			goto resubmit; /* maybe we can recover */
 		}
-		goto exit;
 	}
 
-	down (&dev->sem);
-
 	if (urb->actual_length > 0) {
-		if (dev->read_buffer_length < (4 * dev->interrupt_in_endpoint->wMaxPacketSize) - (urb->actual_length)) {
-
-			memcpy (dev->read_buffer+dev->read_buffer_length, dev->interrupt_in_buffer, urb->actual_length);
-
+		spin_lock (&dev->read_buffer_lock);
+		if (dev->read_buffer_length + urb->actual_length < read_buffer_size) {
+			memcpy (dev->read_buffer + dev->read_buffer_length,
+				dev->interrupt_in_buffer,
+				urb->actual_length);
 			dev->read_buffer_length += urb->actual_length;
-			dbg(1," %s reading  %d ", __func__, urb->actual_length);
-			wake_up_interruptible (&dev->read_wait);
-
+			dev->read_last_arrival = jiffies;
+			dbg(3, "%s: received %d bytes", __FUNCTION__, urb->actual_length);
 		} else {
-			dbg(1," %s : read_buffer overflow", __func__);
+			printk(KERN_WARNING "%s: read_buffer overflow, %d bytes dropped", __FUNCTION__, urb->actual_length);
 		}
+		spin_unlock (&dev->read_buffer_lock);
 	}
 
-	up (&dev->sem);
+resubmit:
+	/* resubmit if we're still running */
+	if (dev->interrupt_in_running && dev->udev) {
+		retval = usb_submit_urb (dev->interrupt_in_urb, GFP_ATOMIC);
+		if (retval) {
+			err("%s: usb_submit_urb failed (%d)", __FUNCTION__, retval);
+		}
+	}
 
 exit:
-	lego_usb_tower_debug_data(5,__func__, urb->actual_length, urb->transfer_buffer);
-	dbg(4," %s : leave, status %d", __func__, urb->status);
+	dev->interrupt_in_done = 1;
+	wake_up_interruptible (&dev->read_wait);
+
+	lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
+	dbg(4, "%s: leave, status %d", __FUNCTION__, urb->status);
 }
 
 
@@ -628,22 +796,22 @@
 {
 	struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context;
 
-	dbg(4," %s : enter, status %d", __func__, urb->status);
-	lego_usb_tower_debug_data(5,__func__, urb->actual_length, urb->transfer_buffer);
+	dbg(4, "%s: enter, status %d", __FUNCTION__, urb->status);
+	lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
 
-	if (urb->status != 0) {
-		if ((urb->status != -ENOENT) && 
-		    (urb->status != -ECONNRESET)) {
-			dbg(1, " %s :nonzero status received: %d", __func__, urb->status);
-		}
-		goto exit;
-	}                        
+	/* sync/async unlink faults aren't errors */
+	if (urb->status && !(urb->status == -ENOENT ||
+			     urb->status == -ECONNRESET ||
+			     urb->status == -ESHUTDOWN)) {
+		dbg(1, "%s - nonzero write bulk status received: %d",
+		    __FUNCTION__, urb->status);
+	}
 
+	dev->interrupt_out_busy = 0;
 	wake_up_interruptible(&dev->write_wait);
-exit:
 
-	lego_usb_tower_debug_data(5,__func__, urb->actual_length, urb->transfer_buffer);
-	dbg(4," %s : leave, status %d", __func__, urb->status);
+	lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
+	dbg(4, "%s: leave, status %d", __FUNCTION__, urb->status);
 }
 
 
@@ -659,15 +827,18 @@
 	struct lego_usb_tower *dev = NULL;
 	struct usb_host_interface *iface_desc;
 	struct usb_endpoint_descriptor* endpoint;
+	struct tower_reset_reply reset_reply;
+	struct tower_get_version_reply get_version_reply;
 	int i;
 	int retval = -ENOMEM;
+	int result;
 
-	dbg(2," %s : enter", __func__);
+	dbg(2, "%s: enter", __FUNCTION__);
 
 	if (udev == NULL) {
 		info ("udev is NULL.");
 	}
-	
+
 	/* See if the device offered us matches what we can accept */
 	if ((udev->descriptor.idVendor != LEGO_USB_TOWER_VENDOR_ID) ||
 	    (udev->descriptor.idProduct != LEGO_USB_TOWER_PRODUCT_ID)) {
@@ -691,6 +862,10 @@
 
 	dev->read_buffer = NULL;
 	dev->read_buffer_length = 0;
+	dev->read_packet_length = 0;
+	spin_lock_init (&dev->read_buffer_lock);
+	dev->packet_timeout_jiffies = packet_timeout * HZ / 1000;
+	dev->read_last_arrival = jiffies;
 
 	init_waitqueue_head (&dev->read_wait);
 	init_waitqueue_head (&dev->write_wait);
@@ -698,13 +873,15 @@
 	dev->interrupt_in_buffer = NULL;
 	dev->interrupt_in_endpoint = NULL;
 	dev->interrupt_in_urb = NULL;
+	dev->interrupt_in_running = 0;
+	dev->interrupt_in_done = 0;
 
 	dev->interrupt_out_buffer = NULL;
 	dev->interrupt_out_endpoint = NULL;
 	dev->interrupt_out_urb = NULL;
+	dev->interrupt_out_busy = 0;
 
-
-	iface_desc = &interface->altsetting[0];
+	iface_desc = interface->cur_altsetting;
 
 	/* set up the endpoint information */
 	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
@@ -714,7 +891,7 @@
 		    ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) {
 			dev->interrupt_in_endpoint = endpoint;
 		}
-		
+
 		if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) &&
 		    ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT)) {
 			dev->interrupt_out_endpoint = endpoint;
@@ -729,7 +906,7 @@
 		goto error;
 	}
 
-	dev->read_buffer = kmalloc ((4*dev->interrupt_in_endpoint->wMaxPacketSize), GFP_KERNEL);
+	dev->read_buffer = kmalloc (read_buffer_size, GFP_KERNEL);
 	if (!dev->read_buffer) {
 		err("Couldn't allocate read_buffer");
 		goto error;
@@ -744,7 +921,7 @@
 		err("Couldn't allocate interrupt_in_urb");
 		goto error;
 	}
-	dev->interrupt_out_buffer = kmalloc (dev->interrupt_out_endpoint->wMaxPacketSize, GFP_KERNEL);
+	dev->interrupt_out_buffer = kmalloc (write_buffer_size, GFP_KERNEL);
 	if (!dev->interrupt_out_buffer) {
 		err("Couldn't allocate interrupt_out_buffer");
 		goto error;
@@ -753,7 +930,9 @@
 	if (!dev->interrupt_out_urb) {
 		err("Couldn't allocate interrupt_out_urb");
 		goto error;
-	}                
+	}
+	dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval;
+	dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval;
 
 	/* we can register the device now, as it is ready */
 	usb_set_intfdata (interface, dev);
@@ -766,16 +945,50 @@
 		usb_set_intfdata (interface, NULL);
 		goto error;
 	}
-
 	dev->minor = interface->minor;
 
 	/* let the user know what node this device is now attached to */
-	info ("LEGO USB Tower device now attached to /dev/usb/lego%d", (dev->minor - LEGO_USB_TOWER_MINOR_BASE));
+	info ("LEGO USB Tower #%d now attached to major %d minor %d", (dev->minor - LEGO_USB_TOWER_MINOR_BASE), USB_MAJOR, dev->minor);
 
+	/* reset the tower */
+	result = usb_control_msg (udev,
+				  usb_rcvctrlpipe(udev, 0),
+				  LEGO_USB_TOWER_REQUEST_RESET,
+				  USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_DEVICE,
+				  0,
+				  0,
+				  &reset_reply,
+				  sizeof(reset_reply),
+				  HZ);
+	if (result < 0) {
+		err("LEGO USB Tower reset control request failed");
+		retval = result;
+		goto error;
+	}
+
+	/* get the firmware version and log it */
+	result = usb_control_msg (udev,
+				  usb_rcvctrlpipe(udev, 0),
+				  LEGO_USB_TOWER_REQUEST_GET_VERSION,
+				  USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_DEVICE,
+				  0,
+				  0,
+				  &get_version_reply,
+				  sizeof(get_version_reply),
+				  HZ);
+	if (result < 0) {
+		err("LEGO USB Tower get version control request failed");
+		retval = result;
+		goto error;
+	}
+	info("LEGO USB Tower firmware version is %d.%d build %d",
+	     get_version_reply.major,
+	     get_version_reply.minor,
+	     le16_to_cpu(get_version_reply.build_no));
 
 
 exit:
-	dbg(2," %s : leave, return value 0x%.8lx (dev)", __func__, (long) dev);
+	dbg(2, "%s: leave, return value 0x%.8lx (dev)", __FUNCTION__, (long) dev);
 
 	return retval;
 
@@ -795,7 +1008,7 @@
 	struct lego_usb_tower *dev;
 	int minor;
 
-	dbg(2," %s : enter", __func__);
+	dbg(2, "%s: enter", __FUNCTION__);
 
 	down (&disconnect_sem);
 
@@ -823,7 +1036,7 @@
 
 	info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE));
 
-	dbg(2," %s : leave", __func__);
+	dbg(2, "%s: leave", __FUNCTION__);
 }
 
 
@@ -836,7 +1049,7 @@
 	int result;
 	int retval = 0;
 
-	dbg(2," %s : enter", __func__);
+	dbg(2, "%s: enter", __FUNCTION__);
 
 	/* register this driver with the USB subsystem */
 	result = usb_register(&tower_driver);
@@ -849,7 +1062,7 @@
 	info(DRIVER_DESC " " DRIVER_VERSION);
 
 exit:
-	dbg(2," %s : leave, return value %d", __func__, retval);
+	dbg(2, "%s: leave, return value %d", __FUNCTION__, retval);
 
 	return retval;
 }
@@ -860,12 +1073,12 @@
  */
 static void __exit lego_usb_tower_exit(void)
 {
-	dbg(2," %s : enter", __func__);
+	dbg(2, "%s: enter", __FUNCTION__);
 
 	/* deregister this driver with the USB subsystem */
 	usb_deregister (&tower_driver);
 
-	dbg(2," %s : leave", __func__);
+	dbg(2, "%s: leave", __FUNCTION__);
 }
 
 module_init (lego_usb_tower_init);
diff -Nru a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/usb/misc/phidgetservo.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,327 @@
+/*
+ * USB PhidgetServo driver 1.0
+ *
+ * Copyright (C) 2004 Sean Young <sean@mess.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 is a driver for the USB PhidgetServo version 2.0 and 3.0 servo 
+ * controllers available at: http://www.phidgets.com/ 
+ *
+ * Note that the driver takes input as: degrees.minutes
+ * -23 < degrees < 203
+ * 0 < minutes < 59
+ *
+ * CAUTION: Generally you should use 0 < degrees < 180 as anything else
+ * is probably beyond the range of your servo and may damage it.
+ */
+
+#include <linux/config.h>
+#ifdef CONFIG_USB_DEBUG
+#define DEBUG	1
+#endif
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+
+#define DRIVER_AUTHOR "Sean Young <sean@mess.org>"
+#define DRIVER_DESC "USB PhidgetServo Driver"
+
+#define VENDOR_ID_GLAB			0x06c2
+#define DEVICE_ID_4MOTOR_SERVO_30	0x0038
+#define DEVICE_ID_1MOTOR_SERVO_30	0x0039
+
+#define VENDOR_ID_WISEGROUP		0x0925
+#define DEVICE_ID_1MOTOR_SERVO_20	0x8101
+#define DEVICE_ID_4MOTOR_SERVO_20	0x8104
+
+static struct usb_device_id id_table[] = {
+	{USB_DEVICE(VENDOR_ID_GLAB, DEVICE_ID_4MOTOR_SERVO_30)},
+	{USB_DEVICE(VENDOR_ID_GLAB, DEVICE_ID_1MOTOR_SERVO_30)},
+	{USB_DEVICE(VENDOR_ID_WISEGROUP, DEVICE_ID_4MOTOR_SERVO_20)},
+	{USB_DEVICE(VENDOR_ID_WISEGROUP, DEVICE_ID_1MOTOR_SERVO_20)},
+	{}
+};
+
+MODULE_DEVICE_TABLE(usb, id_table);
+
+struct phidget_servo {
+	struct usb_device *udev;
+	int version;
+	int quad_servo;
+	int pulse[4];
+	int degrees[4];
+	int minutes[4];
+};
+
+static void
+change_position_v30(struct phidget_servo *servo, int servo_no, int degrees, 
+								int minutes)
+{
+	int retval;
+	unsigned char *buffer;
+
+	buffer = kmalloc(6, GFP_KERNEL);
+	if (!buffer) {
+		dev_err(&servo->udev->dev, "%s - out of memory\n",
+			__FUNCTION__);
+		return;
+	}
+
+	/*
+	 * pulse = 0 - 4095
+	 * angle = 0 - 180 degrees
+	 *
+	 * pulse = angle * 10.6 + 243.8	
+	 */
+	servo->pulse[servo_no] = ((degrees*60 + minutes)*106 + 2438*60)/600;	
+	servo->degrees[servo_no]= degrees;
+	servo->minutes[servo_no]= minutes;	
+
+	/* 
+	 * The PhidgetServo v3.0 is controlled by sending 6 bytes,
+	 * 4 * 12 bits for each servo.
+	 *
+	 * low = lower 8 bits pulse
+	 * high = higher 4 bits pulse
+	 *
+	 * offset     bits
+	 * +---+-----------------+
+	 * | 0 |      low 0      |
+	 * +---+--------+--------+
+	 * | 1 | high 1 | high 0 |
+	 * +---+--------+--------+
+	 * | 2 |      low 1      |
+	 * +---+-----------------+
+	 * | 3 |      low 2      |
+	 * +---+--------+--------+
+	 * | 4 | high 3 | high 2 |
+	 * +---+--------+--------+
+	 * | 5 |      low 3      |
+	 * +---+-----------------+
+	 */
+
+	buffer[0] = servo->pulse[0] & 0xff;
+	buffer[1] = (servo->pulse[0] >> 8 & 0x0f)
+	    | (servo->pulse[1] >> 4 & 0xf0);
+	buffer[2] = servo->pulse[1] & 0xff;
+	buffer[3] = servo->pulse[2] & 0xff;
+	buffer[4] = (servo->pulse[2] >> 8 & 0x0f)
+	    | (servo->pulse[3] >> 4 & 0xf0);
+	buffer[5] = servo->pulse[3] & 0xff;
+
+	dev_dbg(&servo->udev->dev,
+		"data: %02x %02x %02x %02x %02x %02x\n",
+		buffer[0], buffer[1], buffer[2],
+		buffer[3], buffer[4], buffer[5]);
+
+	retval = usb_control_msg(servo->udev,
+				 usb_sndctrlpipe(servo->udev, 0),
+				 0x09, 0x21, 0x0200, 0x0000, buffer, 6, 2 * HZ);
+	if (retval != 6)
+		dev_err(&servo->udev->dev, "retval = %d\n", retval);
+	kfree(buffer);
+}
+
+static void
+change_position_v20(struct phidget_servo *servo, int servo_no, int degrees,
+								int minutes)
+{
+	int retval;
+	unsigned char *buffer;
+
+	buffer = kmalloc(2, GFP_KERNEL);
+	if (!buffer) {
+		dev_err(&servo->udev->dev, "%s - out of memory\n",
+			__FUNCTION__);
+		return;
+	}
+
+	/*
+	 * angle = 0 - 180 degrees
+	 * pulse = angle + 23
+	 */
+	servo->pulse[servo_no]= degrees + 23;
+	servo->degrees[servo_no]= degrees;
+	servo->minutes[servo_no]= 0;
+
+	/*
+	 * The PhidgetServo v2.0 is controlled by sending two bytes. The
+	 * first byte is the servo number xor'ed with 2:
+	 *
+	 * servo 0 = 2
+	 * servo 1 = 3
+	 * servo 2 = 0
+	 * servo 3 = 1
+	 *
+	 * The second byte is the position.
+	 */
+
+	buffer[0] = servo_no ^ 2;
+	buffer[1] = servo->pulse[servo_no];
+
+	dev_dbg(&servo->udev->dev, "data: %02x %02x\n", buffer[0], buffer[1]);
+
+	retval = usb_control_msg(servo->udev,
+				 usb_sndctrlpipe(servo->udev, 0),
+				 0x09, 0x21, 0x0200, 0x0000, buffer, 2, 2 * HZ);
+	if (retval != 2)
+		dev_err(&servo->udev->dev, "retval = %d\n", retval);
+	kfree(buffer);
+}
+
+#define show_set(value)	\
+static ssize_t set_servo##value (struct device *dev,			\
+					const char *buf, size_t count)	\
+{									\
+	int degrees, minutes;						\
+	struct usb_interface *intf = to_usb_interface (dev);		\
+	struct phidget_servo *servo = usb_get_intfdata (intf);		\
+									\
+	minutes = 0;							\
+	/* must at least convert degrees */				\
+	if (sscanf (buf, "%d.%d", &degrees, &minutes) < 1) {		\
+		return -EINVAL;						\
+	}								\
+									\
+	if (degrees < -23 || degrees > (180 + 23) ||			\
+	    minutes < 0 || minutes > 59) {				\
+		return -EINVAL;						\
+	}								\
+									\
+	if (servo->version >= 3) 					\
+		change_position_v30 (servo, value, degrees, minutes);	\
+	else 								\
+		change_position_v20 (servo, value, degrees, minutes);	\
+									\
+	return count;							\
+}									\
+									\
+static ssize_t show_servo##value (struct device *dev, char *buf) 	\
+{									\
+	struct usb_interface *intf = to_usb_interface (dev);		\
+	struct phidget_servo *servo = usb_get_intfdata (intf);		\
+									\
+	return sprintf (buf, "%d.%02d\n", servo->degrees[value],	\
+				servo->minutes[value]);			\
+}									\
+static DEVICE_ATTR(servo##value, S_IWUGO | S_IRUGO,			\
+	  show_servo##value, set_servo##value);
+
+show_set(0);
+show_set(1);
+show_set(2);
+show_set(3);
+
+static int
+servo_probe(struct usb_interface *interface, const struct usb_device_id *id)
+{
+	struct usb_device *udev = interface_to_usbdev(interface);
+	struct phidget_servo *dev = NULL;
+
+	dev = kmalloc(sizeof (struct phidget_servo), GFP_KERNEL);
+	if (dev == NULL) {
+		dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__);
+		return -ENOMEM;
+	}
+	memset(dev, 0x00, sizeof (*dev));
+
+	dev->udev = usb_get_dev(udev);
+	switch (udev->descriptor.idVendor) {
+	case VENDOR_ID_WISEGROUP:
+		dev->version = 2;
+		break;
+	case VENDOR_ID_GLAB:
+		dev->version = 3;
+		break;
+	}
+	switch (udev->descriptor.idProduct) {
+	case DEVICE_ID_4MOTOR_SERVO_20:
+	case DEVICE_ID_4MOTOR_SERVO_30:
+		dev->quad_servo = 1;
+		break;
+	case DEVICE_ID_1MOTOR_SERVO_20:
+	case DEVICE_ID_1MOTOR_SERVO_30:
+		dev->quad_servo = 0;
+		break;
+	}
+
+	usb_set_intfdata(interface, dev);
+
+	device_create_file(&interface->dev, &dev_attr_servo0);
+	if (dev->quad_servo) {
+		device_create_file(&interface->dev, &dev_attr_servo1);
+		device_create_file(&interface->dev, &dev_attr_servo2);
+		device_create_file(&interface->dev, &dev_attr_servo3);
+	}
+
+	dev_info(&interface->dev, "USB %d-Motor PhidgetServo v%d.0 attached\n",
+		 dev->quad_servo ? 4 : 1, dev->version);
+	if (dev->version == 2) 
+		dev_info(&interface->dev,
+			 "WARNING: v2.0 not tested! Please report if it works.\n");
+
+	return 0;
+}
+
+static void
+servo_disconnect(struct usb_interface *interface)
+{
+	struct phidget_servo *dev;
+
+	dev = usb_get_intfdata(interface);
+	usb_set_intfdata(interface, NULL);
+
+	device_remove_file(&interface->dev, &dev_attr_servo0);
+	if (dev->quad_servo) {
+		device_remove_file(&interface->dev, &dev_attr_servo1);
+		device_remove_file(&interface->dev, &dev_attr_servo2);
+		device_remove_file(&interface->dev, &dev_attr_servo3);
+	}
+
+	usb_put_dev(dev->udev);
+
+	kfree(dev);
+
+	dev_info(&interface->dev, "USB %d-Motor PhidgetServo v%d.0 detached\n",
+		 dev->quad_servo ? 4 : 1, dev->version);
+}
+
+static struct usb_driver servo_driver = {
+	.owner = THIS_MODULE,
+	.name = "phidgetservo",
+	.probe = servo_probe,
+	.disconnect = servo_disconnect,
+	.id_table = id_table
+};
+
+static int __init
+phidget_servo_init(void)
+{
+	int retval = 0;
+
+	retval = usb_register(&servo_driver);
+	if (retval)
+		err("usb_register failed. Error number %d", retval);
+
+	return retval;
+}
+
+static void __exit
+phidget_servo_exit(void)
+{
+	usb_deregister(&servo_driver);
+}
+
+module_init(phidget_servo_init);
+module_exit(phidget_servo_exit);
+
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c
--- a/drivers/usb/misc/speedtch.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/usb/misc/speedtch.c	Tue Jun 15 22:21:05 2004
@@ -269,7 +269,7 @@
 static void udsl_atm_dev_close (struct atm_dev *dev);
 static int udsl_atm_open (struct atm_vcc *vcc);
 static void udsl_atm_close (struct atm_vcc *vcc);
-static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void *arg);
+static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void __user *arg);
 static int udsl_atm_send (struct atm_vcc *vcc, struct sk_buff *skb);
 static int udsl_atm_proc_read (struct atm_dev *atm_dev, loff_t *pos, char *page);
 
@@ -991,11 +991,11 @@
 	dbg ("udsl_atm_close successful");
 }
 
-static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void *arg)
+static int udsl_atm_ioctl (struct atm_dev *dev, unsigned int cmd, void __user *arg)
 {
 	switch (cmd) {
 	case ATM_QUERYLOOP:
-		return put_user (ATM_LM_NONE, (int *) arg) ? -EFAULT : 0;
+		return put_user (ATM_LM_NONE, (int __user *)arg) ? -EFAULT : 0;
 	default:
 		return -ENOIOCTLCMD;
 	}
diff -Nru a/drivers/usb/misc/tiglusb.c b/drivers/usb/misc/tiglusb.c
--- a/drivers/usb/misc/tiglusb.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/misc/tiglusb.c	Tue Jun 15 22:20:36 2004
@@ -33,6 +33,7 @@
 #include <linux/usb.h>
 #include <linux/smp_lock.h>
 #include <linux/devfs_fs_kernel.h>
+#include <linux/device.h>
 
 #include <linux/ticable.h>
 #include "tiglusb.h"
@@ -49,6 +50,7 @@
 
 static tiglusb_t tiglusb[MAXTIGL];
 static int timeout = TIMAXTIME;	/* timeout in tenth of seconds     */
+static struct class_simple *tiglusb_class;
 
 /*---------- misc functions ------------------------------------------- */
 
@@ -336,7 +338,7 @@
 {
 	struct usb_device *dev = interface_to_usbdev(intf);
 	int minor = -1;
-	int i;
+	int i, err = 0;
 	ptiglusb_t s;
 
 	dbg ("probing vendor id 0x%x, device id 0x%x",
@@ -347,18 +349,23 @@
 	 * the TIGL hardware, there's only 1 configuration.
 	 */
 
-	if (dev->descriptor.bNumConfigurations != 1)
-		return -ENODEV;
+	if (dev->descriptor.bNumConfigurations != 1) {
+		err = -ENODEV;
+		goto out;
+	}
 
 	if ((dev->descriptor.idProduct != 0xe001)
-	    && (dev->descriptor.idVendor != 0x451))
-		return -ENODEV;
+	    && (dev->descriptor.idVendor != 0x451)) {
+		err = -ENODEV;
+		goto out;
+	}
 
 	// NOTE:  it's already in this config, this shouldn't be needed.
 	// is this working around some hardware bug?
 	if (usb_reset_configuration (dev) < 0) {
 		err ("tiglusb_probe: reset_configuration failed");
-		return -ENODEV;
+		err = -ENODEV;
+		goto out;
 	}
 
 	/*
@@ -372,8 +379,10 @@
 		}
 	}
 
-	if (minor == -1)
-		return -ENODEV;
+	if (minor == -1) {
+		err = -ENODEV;
+		goto out;
+	}
 
 	s = &tiglusb[minor];
 
@@ -383,17 +392,28 @@
 	up (&s->mutex);
 	dbg ("bound to interface");
 
-	devfs_mk_cdev(MKDEV(TIUSB_MAJOR, TIUSB_MINOR) + s->minor,
+	class_simple_device_add(tiglusb_class, MKDEV(TIUSB_MAJOR, TIUSB_MINOR + s->minor),
+			NULL, "usb%d", s->minor);
+	err = devfs_mk_cdev(MKDEV(TIUSB_MAJOR, TIUSB_MINOR) + s->minor,
 			S_IFCHR | S_IRUGO | S_IWUGO,
 			"ticables/usb/%d", s->minor);
 
+	if (err)
+		goto out_class;
+
 	/* Display firmware version */
 	info ("firmware revision %i.%02x",
 		dev->descriptor.bcdDevice >> 8,
 		dev->descriptor.bcdDevice & 0xff);
 
 	usb_set_intfdata (intf, s);
-	return 0;
+	err = 0;
+	goto out;
+
+out_class:
+	class_simple_device_remove(MKDEV(TIUSB_MAJOR, TIUSB_MINOR + s->minor));
+out:
+	return err;
 }
 
 static void
@@ -423,6 +443,7 @@
 	s->dev = NULL;
 	s->opened = 0;
 
+	class_simple_device_remove(MKDEV(TIUSB_MAJOR, TIUSB_MINOR + s->minor));
 	devfs_remove("ticables/usb/%d", s->minor);
 
 	info ("device %d removed", s->minor);
@@ -473,7 +494,7 @@
 tiglusb_init (void)
 {
 	unsigned u;
-	int result;
+	int result, err = 0;
 
 	/* initialize struct */
 	for (u = 0; u < MAXTIGL; u++) {
@@ -490,28 +511,41 @@
 	/* register device */
 	if (register_chrdev (TIUSB_MAJOR, "tiglusb", &tiglusb_fops)) {
 		err ("unable to get major %d", TIUSB_MAJOR);
-		return -EIO;
+		err = -EIO;
+		goto out;
 	}
 
 	/* Use devfs, tree: /dev/ticables/usb/[0..3] */
 	devfs_mk_dir ("ticables/usb");
 
+	tiglusb_class = class_simple_create(THIS_MODULE, "tiglusb");
+	if (IS_ERR(tiglusb_class)) {
+		err = PTR_ERR(tiglusb_class);
+		goto out_chrdev;
+	}
 	/* register USB module */
 	result = usb_register (&tiglusb_driver);
 	if (result < 0) {
-		unregister_chrdev (TIUSB_MAJOR, "tiglusb");
-		return -1;
+		err = -1;
+		goto out_chrdev;
 	}
 
 	info (DRIVER_DESC ", version " DRIVER_VERSION);
 
-	return 0;
+	err = 0;
+	goto out;
+
+out_chrdev:
+	unregister_chrdev (TIUSB_MAJOR, "tiglusb");
+out:
+	return err;
 }
 
 static void __exit
 tiglusb_cleanup (void)
 {
 	usb_deregister (&tiglusb_driver);
+	class_simple_destroy(tiglusb_class);
 	devfs_remove("ticables/usb");
 	unregister_chrdev (TIUSB_MAJOR, "tiglusb");
 }
diff -Nru a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
--- a/drivers/usb/misc/usbtest.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/usb/misc/usbtest.c	Tue Jun 15 22:21:03 2004
@@ -802,6 +802,7 @@
 				switch (status) {
 				case -EINPROGRESS:
 				case -EBUSY:
+				case -EIDRM:
 					continue;
 				default:
 					dbg ("urb unlink --> %d", status);
@@ -1038,8 +1039,6 @@
 	if (!status)
 		status = usb_submit_urb (urb, SLAB_ATOMIC);
 	if (status) {
-		if (status == -ECONNRESET || status == -ENOENT)
-			status = 0;
 		urb->status = status;
 		complete ((struct completion *) urb->context);
 	}
@@ -1074,11 +1073,12 @@
 	/* unlinking that should always work.  variable delay tests more
 	 * hcd states and code paths, even with little other system load.
 	 */
-	wait_ms (jiffies % (2 * INTERRUPT_RATE));
+	msleep (jiffies % (2 * INTERRUPT_RATE));
 retry:
 	retval = usb_unlink_urb (urb);
-	if (retval == -EBUSY) {
+	if (retval == -EBUSY || retval == -EIDRM) {
 		/* we can't unlink urbs while they're completing.
+		 * or if they've completed, and we haven't resubmitted.
 		 * "normal" drivers would prevent resubmission, but
 		 * since we're testing unlink paths, we can't.
 		 */
diff -Nru a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
--- a/drivers/usb/misc/uss720.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/misc/uss720.c	Tue Jun 15 22:20:36 2004
@@ -553,7 +553,7 @@
 	i = usb_set_interface(usbdev, intf->altsetting->desc.bInterfaceNumber, 2);
 	printk(KERN_DEBUG "uss720: set inteface result %d\n", i);
 
-	interface = &intf->altsetting[2];
+	interface = intf->cur_altsetting;
 
 	/*
 	 * Allocate parport interface 
diff -Nru a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c
--- a/drivers/usb/net/catc.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/net/catc.c	Tue Jun 15 22:20:40 2004
@@ -672,7 +672,7 @@
         struct catc *catc = dev->priv;
         u32 cmd;
         
-        if (get_user(cmd, (u32 *)useraddr))
+        if (get_user(cmd, (u32 __user *)useraddr))
                 return -EFAULT;
 
         switch (cmd) {
@@ -726,7 +726,7 @@
 {
         switch(cmd) {
         case SIOCETHTOOL:
-                return netdev_ethtool_ioctl(dev, (void __user *)rq->ifr_data);
+                return netdev_ethtool_ioctl(dev, rq->ifr_data);
         default:
                 return -EOPNOTSUPP;
         }
diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
--- a/drivers/usb/net/kaweth.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/net/kaweth.c	Tue Jun 15 22:20:43 2004
@@ -123,9 +123,10 @@
 		const struct usb_device_id *id	/* from id_table */
 	);
 static void kaweth_disconnect(struct usb_interface *intf);
-int kaweth_internal_control_msg(struct usb_device *usb_dev, unsigned int pipe,
-				struct usb_ctrlrequest *cmd, void *data,
-				int len, int timeout);
+static int kaweth_internal_control_msg(struct usb_device *usb_dev,
+				       unsigned int pipe,
+				       struct usb_ctrlrequest *cmd, void *data,
+				       int len, int timeout);
 
 /****************************************************************
  *     usb_device_id
@@ -736,7 +737,7 @@
 {
 	switch (cmd) {
 	case SIOCETHTOOL:
-		return netdev_ethtool_ioctl(net, (void __user *)rq->ifr_data);
+		return netdev_ethtool_ioctl(net, rq->ifr_data);
 	}
 	return -EOPNOTSUPP;
 }
@@ -1239,20 +1240,21 @@
         init_waitqueue_head(&awd.wqh);
         awd.done = 0;
 
-        set_current_state(TASK_INTERRUPTIBLE);
         add_wait_queue(&awd.wqh, &wait);
         urb->context = &awd;
-        status = usb_submit_urb(urb, GFP_ATOMIC);
+        status = usb_submit_urb(urb, GFP_NOIO);
         if (status) {
                 // something went wrong
                 usb_free_urb(urb);
-                set_current_state(TASK_RUNNING);
                 remove_wait_queue(&awd.wqh, &wait);
                 return status;
         }
 
-	while (timeout && !awd.done)
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	while (timeout && !awd.done) {
 		timeout = schedule_timeout(timeout);
+		set_current_state(TASK_UNINTERRUPTIBLE);
+	}
 
         set_current_state(TASK_RUNNING);
         remove_wait_queue(&awd.wqh, &wait);
@@ -1277,9 +1279,10 @@
 
 /*-------------------------------------------------------------------*/
 // returns status (negative) or length (positive)
-int kaweth_internal_control_msg(struct usb_device *usb_dev, unsigned int pipe,
-                            struct usb_ctrlrequest *cmd, void *data, int len,
-			    int timeout)
+static int kaweth_internal_control_msg(struct usb_device *usb_dev,
+				       unsigned int pipe,
+				       struct usb_ctrlrequest *cmd, void *data,
+				       int len, int timeout)
 {
         struct urb *urb;
         int retv;
@@ -1305,7 +1308,7 @@
 /****************************************************************
  *     kaweth_init
  ****************************************************************/
-int __init kaweth_init(void)
+static int __init kaweth_init(void)
 {
 	kaweth_dbg("Driver loading");
 	return usb_register(&kaweth_driver);
@@ -1314,7 +1317,7 @@
 /****************************************************************
  *     kaweth_exit
  ****************************************************************/
-void __exit kaweth_exit(void)
+static void __exit kaweth_exit(void)
 {
 	usb_deregister(&kaweth_driver);
 }
diff -Nru a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
--- a/drivers/usb/net/pegasus.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/usb/net/pegasus.c	Tue Jun 15 22:21:04 2004
@@ -1030,7 +1030,7 @@
 	int cmd;
 
 	pegasus = net->priv;
-	if (get_user(cmd, (int *) uaddr))
+	if (get_user(cmd, (int __user *) uaddr))
 		return -EFAULT;
 	switch (cmd) {
 	case ETHTOOL_GDRVINFO:{
@@ -1107,13 +1107,13 @@
 #endif
 static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
 {
-	__u16 *data = (__u16 *) & rq->ifr_data;
+	__u16 *data = (__u16 *) & rq->ifr_ifru;
 	pegasus_t *pegasus = net->priv;
 	int res;
 
 	switch (cmd) {
 	case SIOCETHTOOL:
-		res = pegasus_ethtool_ioctl(net, (void __user *)rq->ifr_data);
+		res = pegasus_ethtool_ioctl(net, rq->ifr_data);
 		break;
 	case SIOCDEVPRIVATE:
 		data[0] = pegasus->phy;
@@ -1321,13 +1321,13 @@
 	.id_table = pegasus_ids,
 };
 
-int __init pegasus_init(void)
+static int __init pegasus_init(void)
 {
 	info(DRIVER_VERSION ":" DRIVER_DESC);
 	return usb_register(&pegasus_driver);
 }
 
-void __exit pegasus_exit(void)
+static void __exit pegasus_exit(void)
 {
 	usb_deregister(&pegasus_driver);
 }
diff -Nru a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h
--- a/drivers/usb/net/pegasus.h	Tue Jun 15 22:21:04 2004
+++ b/drivers/usb/net/pegasus.h	Tue Jun 15 22:21:04 2004
@@ -136,6 +136,7 @@
 #define	VENDOR_LANEED		0x056e
 #define	VENDOR_LINKSYS		0x066b
 #define	VENDOR_MELCO		0x0411
+#define	VENDOR_MICROSOFT	0x045e
 #define	VENDOR_MOBILITY		0x1342
 #define	VENDOR_NETGEAR		0x0846
 #define	VENDOR_OCT		0x0b39
@@ -264,6 +265,8 @@
 PEGASUS_DEV( "MELCO/BUFFALO LUA-TX", VENDOR_MELCO, 0x0005,
 		DEFAULT_GPIO_RESET )
 PEGASUS_DEV( "MELCO/BUFFALO LUA2-TX", VENDOR_MELCO, 0x0009,
+		DEFAULT_GPIO_RESET | PEGASUS_II )
+PEGASUS_DEV( "Microsoft MN-110", VENDOR_MICROSOFT, 0x007a,
 		DEFAULT_GPIO_RESET | PEGASUS_II )
 PEGASUS_DEV( "NETGEAR FA101", VENDOR_NETGEAR, 0x1020,
 		DEFAULT_GPIO_RESET | PEGASUS_II )
diff -Nru a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
--- a/drivers/usb/net/rtl8150.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/net/rtl8150.c	Tue Jun 15 22:20:41 2004
@@ -167,7 +167,7 @@
 
 typedef struct rtl8150 rtl8150_t;
 
-unsigned long multicast_filter_limit = 32;
+static unsigned long multicast_filter_limit = 32;
 
 static void fill_skb_pool(rtl8150_t *);
 static void free_skb_pool(rtl8150_t *);
@@ -516,7 +516,7 @@
 	netif_wake_queue(dev->netdev);
 }
 
-void intr_callback(struct urb *urb, struct pt_regs *regs)
+static void intr_callback(struct urb *urb, struct pt_regs *regs)
 {
 	rtl8150_t *dev;
 	__u8 *d;
@@ -776,13 +776,13 @@
 	return res;
 }
 
-static int rtl8150_ethtool_ioctl(struct net_device *netdev, void *uaddr)
+static int rtl8150_ethtool_ioctl(struct net_device *netdev, void __user *uaddr)
 {
 	rtl8150_t *dev;
 	int cmd;
 
 	dev = netdev->priv;
-	if (get_user(cmd, (int *) uaddr))
+	if (get_user(cmd, (int __user *) uaddr))
 		return -EFAULT;
 
 	switch (cmd) {
@@ -856,7 +856,7 @@
 	int res;
 
 	dev = netdev->priv;
-	data = (u16 *) & rq->ifr_data;
+	data = (u16 *) & rq->ifr_ifru;
 	res = 0;
 
 	switch (cmd) {
@@ -977,13 +977,13 @@
 	}
 }
 
-int __init usb_rtl8150_init(void)
+static int __init usb_rtl8150_init(void)
 {
 	info(DRIVER_DESC " " DRIVER_VERSION);
 	return usb_register(&rtl8150_driver);
 }
 
-void __exit usb_rtl8150_exit(void)
+static void __exit usb_rtl8150_exit(void)
 {
 	usb_deregister(&rtl8150_driver);
 }
diff -Nru a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
--- a/drivers/usb/net/usbnet.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/net/usbnet.c	Tue Jun 15 22:20:41 2004
@@ -107,7 +107,13 @@
  *
  *-------------------------------------------------------------------------*/
 
+// #define	DEBUG			// error path messages, extra info
+// #define	VERBOSE			// more; success messages
+
 #include <linux/config.h>
+#ifdef	CONFIG_USB_DEBUG
+#   define DEBUG
+#endif
 #include <linux/module.h>
 #include <linux/kmod.h>
 #include <linux/sched.h>
@@ -120,25 +126,15 @@
 #include <linux/mii.h>
 #include <asm/uaccess.h>
 #include <asm/unaligned.h>
-
-
-// #define	DEBUG			// error path messages, extra info
-// #define	VERBOSE			// more; success messages
-#define	REALLY_QUEUE
-
-#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG)
-#   define DEBUG
-#endif
 #include <linux/usb.h>
-
 #include <asm/io.h>
 #include <asm/scatterlist.h>
 #include <linux/mm.h>
 #include <linux/dma-mapping.h>
 
-
 #define DRIVER_VERSION		"25-Aug-2003"
 
+
 /*-------------------------------------------------------------------------*/
 
 /*
@@ -148,13 +144,8 @@
  * For high speed, each frame comfortably fits almost 36 max size
  * Ethernet packets (so queues should be bigger).
  */
-#ifdef REALLY_QUEUE
 #define	RX_QLEN(dev) (((dev)->udev->speed == USB_SPEED_HIGH) ? 60 : 4)
 #define	TX_QLEN(dev) (((dev)->udev->speed == USB_SPEED_HIGH) ? 60 : 4)
-#else
-#define	RX_QLEN(dev)		1
-#define	TX_QLEN(dev)		1
-#endif
 
 // packets are always ethernet inside
 // ... except they can be bigger (limit of 64K with NetChip framing)
@@ -606,7 +597,7 @@
 	ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf);
 }
 
-void ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
+static void ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
 {
 	struct usbnet *dev = (struct usbnet *)net->priv;
 	u8 opt;
@@ -626,7 +617,7 @@
 	}
 }
 
-int ax8817x_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
+static int ax8817x_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
 {
 	struct usbnet *dev = (struct usbnet *)net->priv;
 	u8 opt = 0;
@@ -646,8 +637,8 @@
 	return 0;
 }
 
-int ax8817x_get_eeprom(struct net_device *net, 
-		       struct ethtool_eeprom *eeprom, u8 *data)
+static int ax8817x_get_eeprom(struct net_device *net,
+			      struct ethtool_eeprom *eeprom, u8 *data)
 {
 	struct usbnet *dev = (struct usbnet *)net->priv;
 	u16 *ebuf = (u16 *)data;
@@ -729,7 +720,7 @@
 					(gpio_bits >> (i * 8)) & 0xff, 0, 0,
 					buf)) < 0)
 			return ret;
-		wait_ms(5);
+		msleep(5);
 	}
 
 	if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x80, 0, 0, buf)) < 0) {
@@ -928,8 +919,8 @@
  */
 static int generic_cdc_bind (struct usbnet *dev, struct usb_interface *intf)
 {
-	u8				*buf = intf->altsetting->extra;
-	int				len = intf->altsetting->extralen;
+	u8				*buf = intf->cur_altsetting->extra;
+	int				len = intf->cur_altsetting->extralen;
 	struct usb_interface_descriptor	*d;
 	struct cdc_state		*info = (void *) &dev->data;
 	int				status;
@@ -955,7 +946,7 @@
 	/* this assumes that if there's a non-RNDIS vendor variant
 	 * of cdc-acm, it'll fail RNDIS requests cleanly.
 	 */
-	rndis = (intf->altsetting->desc.bInterfaceProtocol == 0xff);
+	rndis = (intf->cur_altsetting->desc.bInterfaceProtocol == 0xff);
 
 	memset (info, 0, sizeof *info);
 	info->control = intf;
@@ -1006,7 +997,7 @@
 			if (!info->control || !info->data) {
 				dev_dbg (&intf->dev,
 					"master #%u/%p slave #%u/%p\n",
-					info->u->bMasterInterface0
+					info->u->bMasterInterface0,
 					info->control,
 					info->u->bSlaveInterface0,
 					info->data);
@@ -1025,7 +1016,7 @@
 			}
 
 			/* a data interface altsetting does the real i/o */
-			d = &info->data->altsetting->desc;
+			d = &info->data->cur_altsetting->desc;
 			if (d->bInterfaceClass != USB_CLASS_CDC_DATA) {
 				dev_dbg (&intf->dev, "slave class %u\n",
 					d->bInterfaceClass);
@@ -1142,10 +1133,13 @@
 	unsigned char	buf [13];
 
 	tmp = usb_string (dev->udev, e->iMACAddress, buf, sizeof buf);
-	if (tmp < 0)
+	if (tmp != 12) {
+		dev_dbg (&dev->udev->dev,
+			"bad MAC string %d fetch, %d\n", e->iMACAddress, tmp);
+		if (tmp >= 0)
+			tmp = -EINVAL;
 		return tmp;
-	else if (tmp != 12)
-		return -EINVAL;
+	}
 	for (i = tmp = 0; i < 6; i++, tmp += 2)
 		dev->net->dev_addr [i] =
 			 (nibble (buf [tmp]) << 4) + nibble (buf [tmp + 1]);
@@ -2674,9 +2668,7 @@
 	struct usbnet *dev = (struct usbnet *)net->priv;
 
 	if (dev->mii.mdio_read != NULL && dev->mii.mdio_write != NULL)
-		return generic_mii_ioctl(&dev->mii,
-				(struct mii_ioctl_data *) &rq->ifr_data,
-				cmd, NULL);
+		return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
 	}
 #endif
 	return -EOPNOTSUPP;
@@ -3014,7 +3006,7 @@
 
 // precondition: never called in_interrupt
 
-int
+static int
 usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 {
 	struct usbnet			*dev;
@@ -3204,6 +3196,10 @@
 	// Hawking UF200, TrendNet TU2-ET100
 	USB_DEVICE (0x07b8, 0x420a),
 	.driver_info =  (unsigned long) &hawking_uf200_info,
+}, {
+        // Billionton Systems, USB2AR 
+        USB_DEVICE (0x08dd, 0x90ff),
+        .driver_info =  (unsigned long) &ax8817x_info,
 }, {
 	// ATEN UC210T
 	USB_DEVICE (0x0557, 0x2009),
diff -Nru a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
--- a/drivers/usb/serial/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/serial/Kconfig	Tue Jun 15 22:20:43 2004
@@ -314,8 +314,8 @@
 	  module will be called kl5kusb105.
 
 config USB_SERIAL_KOBIL_SCT
-        tristate "USB KOBIL chipcard reader (EXPERIMENTAL)"
-        depends on USB_SERIAL && EXPERIMENTAL
+        tristate "USB KOBIL chipcard reader"
+        depends on USB_SERIAL
         ---help---
           Say Y here if you want to use one of the following KOBIL USB chipcard
           readers:
diff -Nru a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
--- a/drivers/usb/serial/belkin_sa.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/serial/belkin_sa.c	Tue Jun 15 22:20:41 2004
@@ -244,23 +244,12 @@
 
 static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
 {
-	struct usb_serial *serial;
-
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-
 	dbg("%s port %d", __FUNCTION__, port->number);
 
-	if (serial->dev) {
-		/* shutdown our bulk reads and writes */
-		usb_unlink_urb (port->write_urb);
-		usb_unlink_urb (port->read_urb);
-		usb_unlink_urb (port->interrupt_in_urb);
-	}
+	/* shutdown our bulk reads and writes */
+	usb_unlink_urb (port->write_urb);
+	usb_unlink_urb (port->read_urb);
+	usb_unlink_urb (port->interrupt_in_urb);
 } /* belkin_sa_close */
 
 
@@ -268,7 +257,6 @@
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 	struct belkin_sa_private *priv;
-	struct usb_serial *serial;
 	unsigned char *data = urb->transfer_buffer;
 	int retval;
 	unsigned long flags;
@@ -288,14 +276,6 @@
 		goto exit;
 	}
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
-	serial = port->serial;
-
-	if (serial_paranoia_check (serial, __FUNCTION__))
-		return;
-	
 	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
 
 	/* Handle known interrupt data */
diff -Nru a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
--- a/drivers/usb/serial/console.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/serial/console.c	Tue Jun 15 22:20:44 2004
@@ -137,7 +137,7 @@
 
 	/* grab the first serial port that happens to be connected */
 	serial = usb_serial_get_by_index(0);
-	if (serial_paranoia_check (serial, __FUNCTION__)) {
+	if (serial == NULL) {
 		/* no device is connected yet, sorry :( */
 		err ("No USB device connected to ttyUSB0");
 		return -ENODEV;
@@ -199,11 +199,12 @@
 {
 	static struct usbcons_info *info = &usbcons_info;
 	struct usb_serial_port *port = info->port;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
+	struct usb_serial *serial;
 	int retval = -ENODEV;
 
-	if (!serial || !port)
+	if (!port)
 		return;
+	serial = port->serial;
 
 	if (count == 0)
 		return;
diff -Nru a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
--- a/drivers/usb/serial/cyberjack.c	Tue Jun 15 22:21:02 2004
+++ b/drivers/usb/serial/cyberjack.c	Tue Jun 15 22:21:02 2004
@@ -109,7 +109,7 @@
 	short		rdtodo;		/* Bytes still to read */
 	unsigned char	wrbuf[5*64];	/* Buffer for collecting data to write */
 	short		wrfilled;	/* Overall data size we already got */
-	short		wrsent;		/* Data akready sent */
+	short		wrsent;		/* Data already sent */
 };
 
 /* do some startup allocations not currently performed by usb_serial_probe() */
@@ -155,15 +155,10 @@
 	unsigned long flags;
 	int result = 0;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	dbg("%s - usb_clear_halt", __FUNCTION__ );
 	usb_clear_halt(port->serial->dev, port->write_urb->pipe);
-	usb_clear_halt(port->serial->dev, port->read_urb->pipe);
-	usb_clear_halt(port->serial->dev, port->interrupt_in_urb->pipe);
 
 	/* force low_latency on so that our tty_push actually forces
 	 * the data through, otherwise it is scheduled, and with high
@@ -215,7 +210,6 @@
 	unsigned long flags;
 	int result;
 	int wrexpected;
-	unsigned char localbuf[CYBERJACK_LOCAL_BUF_SIZE];	/* Buffer for collecting data to write */
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	dbg("%s - from_user %d", __FUNCTION__, from_user);
@@ -232,29 +226,23 @@
 
 	spin_lock_irqsave(&priv->lock, flags);
 
-	if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ||
-		(count>sizeof(localbuf)) ) {
-		/* To much data  for buffer. Reset buffer. */
+	if( (count+priv->wrfilled)>sizeof(priv->wrbuf) ) {
+		/* To much data for buffer. Reset buffer. */
 		priv->wrfilled=0;
 		spin_unlock_irqrestore(&priv->lock, flags);
 		return (0);
 	}
 
-	spin_unlock_irqrestore(&priv->lock, flags);
-
 	/* Copy data */
 	if (from_user) {
-		if (copy_from_user(localbuf, buf, count)) {
+		if (copy_from_user(priv->wrbuf+priv->wrfilled, buf, count)) {
+			spin_unlock_irqrestore(&priv->lock, flags);
 			return -EFAULT;
 		}
 	} else {
-		memcpy (localbuf, buf, count);
+		memcpy (priv->wrbuf+priv->wrfilled, buf, count);
 	}  
 
-	spin_lock_irqsave(&priv->lock, flags);
-
-	memcpy (priv->wrbuf+priv->wrfilled, localbuf, count);
-
 	usb_serial_debug_data (__FILE__, __FUNCTION__, count,
 		priv->wrbuf+priv->wrfilled);
 	priv->wrfilled += count;
@@ -321,23 +309,15 @@
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 	struct cyberjack_private *priv = usb_get_serial_port_data(port);
-	struct usb_serial *serial;
 	unsigned char *data = urb->transfer_buffer;
 	int result;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	/* the urb might have been killed. */
 	if (urb->status)
 		return;
 
-	serial = port->serial;
-	if (serial_paranoia_check (serial, __FUNCTION__))
-		return;
-
 	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
 
 	/* React only to interrupts signaling a bulk_in transfer */
@@ -386,7 +366,6 @@
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 	struct cyberjack_private *priv = usb_get_serial_port_data(port);
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
 	short todo;
@@ -395,11 +374,6 @@
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
@@ -447,15 +421,9 @@
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 	struct cyberjack_private *priv = usb_get_serial_port_data(port);
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
 		return;
@@ -483,11 +451,11 @@
 		priv->wrsent+=length;
 
 		/* set up our urb */
-		usb_fill_bulk_urb(port->write_urb, serial->dev, 
-			      usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress),
+		usb_fill_bulk_urb(port->write_urb, port->serial->dev, 
+			      usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress),
 			      port->write_urb->transfer_buffer, length,
-			      ((serial->type->write_bulk_callback) ? 
-			       serial->type->write_bulk_callback : 
+			      ((port->serial->type->write_bulk_callback) ? 
+			       port->serial->type->write_bulk_callback : 
 			       cyberjack_write_bulk_callback), 
 			      port);
 
diff -Nru a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
--- a/drivers/usb/serial/digi_acceleport.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/serial/digi_acceleport.c	Tue Jun 15 22:20:40 2004
@@ -1396,11 +1396,6 @@
 		return;
 	}
 
-	/* further sanity checks */
-	if( port_paranoia_check( port, __FUNCTION__ )
-	|| serial_paranoia_check( serial, __FUNCTION__ ) )
-		return;
-
 	/* try to send any buffered data on this port, if it is open */
 	spin_lock( &priv->dp_port_lock );
 	priv->dp_write_urb_in_use = 0;
@@ -1798,7 +1793,6 @@
 		return;
 	}
 	if( port->serial == NULL
-	|| serial_paranoia_check( port->serial, __FUNCTION__ )
 	|| (serial_priv=usb_get_serial_data(port->serial)) == NULL ) {
 		err("%s: serial is bad or serial->private is NULL, status=%d", __FUNCTION__, urb->status );
 		return;
@@ -1851,11 +1845,6 @@
 	unsigned char *data = ((unsigned char *)urb->transfer_buffer)+3;
 	int flag,throttled;
 
-
-	/* sanity check */
-	if( port_paranoia_check( port, __FUNCTION__ ) )
-		return( -1 );
-
 	/* do not process callbacks on closed ports */
 	/* but do continue the read chain */
 	if( port->open_count == 0 )
@@ -1980,9 +1969,8 @@
 
 		port = serial->port[line];
 
-		if( port_paranoia_check( port, __FUNCTION__ )
-		|| (priv=usb_get_serial_port_data(port)) == NULL )
-			return( -1 );
+		if ((priv=usb_get_serial_port_data(port)) == NULL )
+			return -1;
 
 		if( opcode == DIGI_CMD_READ_INPUT_SIGNALS ) {
 
diff -Nru a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
--- a/drivers/usb/serial/empeg.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/usb/serial/empeg.c	Tue Jun 15 22:21:04 2004
@@ -157,9 +157,6 @@
 	struct usb_serial *serial = port->serial;
 	int result = 0;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	/* Force default termio settings */
@@ -190,21 +187,10 @@
 
 static void empeg_close (struct usb_serial_port *port, struct file * filp)
 {
-	struct usb_serial *serial;
-
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-
-	if (serial->dev) {
-		/* shutdown our bulk read */
-		usb_unlink_urb (port->read_urb);
-	}
+	/* shutdown our bulk read */
+	usb_unlink_urb (port->read_urb);
 	/* Uncomment the following line if you want to see some statistics in your syslog */
 	/* dev_info (&port->dev, "Bytes In = %d  Bytes Out = %d\n", bytes_in, bytes_out); */
 }
@@ -353,9 +339,6 @@
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (urb->status) {
@@ -370,22 +353,13 @@
 static void empeg_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
 	int i;
 	int result;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		return;
@@ -416,8 +390,8 @@
 	/* Continue trying to always read  */
 	usb_fill_bulk_urb(
 		port->read_urb,
-		serial->dev, 
-		usb_rcvbulkpipe(serial->dev,
+		port->serial->dev, 
+		usb_rcvbulkpipe(port->serial->dev,
 			port->bulk_in_endpointAddress),
 		port->read_urb->transfer_buffer,
 		port->read_urb->transfer_buffer_length,
diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
--- a/drivers/usb/serial/ftdi_sio.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/serial/ftdi_sio.c	Tue Jun 15 22:20:43 2004
@@ -17,6 +17,9 @@
  * See http://ftdi-usb-sio.sourceforge.net for upto date testing info
  *	and extra documentation
  *
+ * (27/May/2004) Ian Abbott
+ *      Improved throttling code, mostly stolen from the WhiteHEAT driver.
+ *
  * (26/Mar/2004) Jan Capek
  *      Added PID's for ICD-U20/ICD-U40 - incircuit PIC debuggers from CCS Inc.
  *
@@ -584,6 +587,10 @@
 #define BUFSZ 512
 #define PKTSZ 64
 
+/* rx_flags */
+#define THROTTLED		0x01
+#define ACTUALLY_THROTTLED	0x02
+
 struct ftdi_private {
 	ftdi_chip_type_t chip_type;
 				/* type of the device, either SIO or FT8U232AM */
@@ -598,6 +605,8 @@
 	unsigned long last_dtr_rts;	/* saved modem control outputs */
         wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
  	char prev_status, diff_status;        /* Used for TIOCMIWAIT */
+	__u8 rx_flags;		/* receive state flags (throttling) */
+	spinlock_t rx_lock;	/* spinlock for receive state */
 
 	int force_baud;		/* if non-zero, force the baud rate to this value */
 	int force_rtscts;	/* if non-zero, force RTS-CTS to always be enabled */
@@ -625,6 +634,7 @@
 static int  ftdi_chars_in_buffer	(struct usb_serial_port *port);
 static void ftdi_write_bulk_callback	(struct urb *urb, struct pt_regs *regs);
 static void ftdi_read_bulk_callback	(struct urb *urb, struct pt_regs *regs);
+static void ftdi_process_read		(struct usb_serial_port *port);
 static void ftdi_set_termios		(struct usb_serial_port *port, struct termios * old);
 static int  ftdi_tiocmget               (struct usb_serial_port *port, struct file *file);
 static int  ftdi_tiocmset		(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear);
@@ -1110,6 +1120,7 @@
 	}
 	memset(priv, 0, sizeof(*priv));
 
+	spin_lock_init(&priv->rx_lock);
         init_waitqueue_head(&priv->delta_msr_wait);
 	/* This will push the characters through immediately rather
 	   than queue a task to deliver them */
@@ -1273,8 +1284,8 @@
 	 */
 
 	if (priv) {
-		kfree(priv);
 		usb_set_serial_port_data(port, NULL);
+		kfree(priv);
 	}
 } /* ftdi_shutdown */
 
@@ -1282,8 +1293,9 @@
 static int  ftdi_open (struct usb_serial_port *port, struct file *filp)
 { /* ftdi_open */
 	struct termios tmp_termios;
-	struct usb_serial *serial = port->serial;
+	struct usb_device *dev = port->serial->dev;
 	struct ftdi_private *priv = usb_get_serial_port_data(port);
+	unsigned long flags;
 	
 	int result = 0;
 	char buf[1]; /* Needed for the usb_control_msg I think */
@@ -1295,7 +1307,7 @@
 
 	/* No error checking for this (will get errors later anyway) */
 	/* See ftdi_sio.h for description of what is reset */
-	usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+	usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 			FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE, 
 			FTDI_SIO_RESET_SIO, 
 			0, buf, 0, WDR_TIMEOUT);
@@ -1317,9 +1329,14 @@
 		err("%s Error from RTS HIGH urb", __FUNCTION__);
 	}
 
+	/* Not throttled */
+	spin_lock_irqsave(&priv->rx_lock, flags);
+	priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
+	spin_unlock_irqrestore(&priv->rx_lock, flags);
+
 	/* Start reading from the device */
-	usb_fill_bulk_urb(port->read_urb, serial->dev, 
-		      usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+	usb_fill_bulk_urb(port->read_urb, dev,
+		      usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress),
 		      port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
 		      ftdi_read_bulk_callback, port);
 	result = usb_submit_urb(port->read_urb, GFP_KERNEL);
@@ -1342,47 +1359,42 @@
 
 static void ftdi_close (struct usb_serial_port *port, struct file *filp)
 { /* ftdi_close */
-	struct usb_serial *serial;
 	unsigned int c_cflag = port->tty->termios->c_cflag;
 	char buf[1];
 
 	dbg("%s", __FUNCTION__);
 
-	serial = get_usb_serial ( port, __FUNCTION__);
-	if (!serial)
-		return;
+	if (c_cflag & HUPCL){
+		/* Disable flow control */
+		if (usb_control_msg(port->serial->dev, 
+				    usb_sndctrlpipe(port->serial->dev, 0),
+				    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
+				    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
+				    0, 0, buf, 0, WDR_TIMEOUT) < 0) {
+			err("error from flowcontrol urb");
+		}	    
 
-	if (serial->dev) {
-		if (c_cflag & HUPCL){
-			/* Disable flow control */
-			if (usb_control_msg(serial->dev, 
-					    usb_sndctrlpipe(serial->dev, 0),
-					    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
-					    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
-					    0, 0, buf, 0, WDR_TIMEOUT) < 0) {
-				err("error from flowcontrol urb");
-			}	    
-
-			/* drop DTR */
-			if (set_dtr(port, LOW) < 0){
-				err("Error from DTR LOW urb");
-			}
-			/* drop RTS */
-			if (set_rts(port, LOW) < 0) {
-				err("Error from RTS LOW urb");
-			}
-		} /* Note change no line if hupcl is off */
-		
-		/* shutdown our bulk read */
-		if (port->read_urb) {
-			if (usb_unlink_urb (port->read_urb) < 0) {
-				err("Error unlinking read urb");
-			}
+		/* drop DTR */
+		if (set_dtr(port, LOW) < 0){
+			err("Error from DTR LOW urb");
 		}
-
-	} /* if (serial->dev) */
-
-
+		/* drop RTS */
+		if (set_rts(port, LOW) < 0) {
+			err("Error from RTS LOW urb");
+		}
+	} /* Note change no line if hupcl is off */
+	
+	/* shutdown our bulk read */
+	if (port->read_urb) {
+		if (usb_unlink_urb (port->read_urb) < 0) {
+			/* Generally, this isn't an error.  If the previous
+			   read bulk callback occurred (or is about to occur)
+			   while the port was being closed or was throtted
+			   (and is still throttled), the read urb will not
+			   have been submitted. */
+			dbg("%s - failed to unlink read urb (generally not an error)", __FUNCTION__);
+		}
+	}
 } /* ftdi_close */
 
 
@@ -1397,7 +1409,6 @@
 static int ftdi_write (struct usb_serial_port *port, int from_user,
 			   const unsigned char *buf, int count)
 { /* ftdi_write */
-	struct usb_serial *serial = get_usb_serial ( port, __FUNCTION__);
 	struct ftdi_private *priv = usb_get_serial_port_data(port);
 	struct urb *urb;
 	unsigned char *buffer;
@@ -1484,8 +1495,8 @@
 	usb_serial_debug_data (__FILE__, __FUNCTION__, transfer_size, buffer);
 
 	/* fill the buffer and send it */
-	usb_fill_bulk_urb(urb, serial->dev, 
-		      usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress),
+	usb_fill_bulk_urb(urb, port->serial->dev, 
+		      usb_sndbulkpipe(port->serial->dev, port->bulk_out_endpointAddress),
 		      buffer, transfer_size,
 		      ftdi_write_bulk_callback, port);
 
@@ -1513,9 +1524,6 @@
 	/* free up the transfer buffer, as usb_free_urb() does not do this */
 	kfree (urb->transfer_buffer);
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
 	if (urb->status) {
@@ -1558,16 +1566,8 @@
 static void ftdi_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 { /* ftdi_read_bulk_callback */
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial;
 	struct tty_struct *tty;
 	struct ftdi_private *priv;
-	char error_flag;
-       	unsigned char *data = urb->transfer_buffer;
-
-	int i;
-	int result;
-	int need_flip;
-	int packet_offset;
 
 	if (urb->number_of_packets > 0) {
 		err("%s transfer_buffer_length %d actual_length %d number of packets %d",__FUNCTION__,
@@ -1575,20 +1575,11 @@
 		err("%s transfer_flags %x ", __FUNCTION__,urb->transfer_flags );
 	}
 
-	dbg("%s", __FUNCTION__);
+	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	if (port_paranoia_check (port, __FUNCTION__)) {
-		return;
-	}
 	if (port->open_count <= 0)
 		return;
 
-	serial = get_usb_serial(port,__FUNCTION__);
-	if (!serial){
-		dbg("%s - bad serial pointer - exiting",__FUNCTION__);
-		return;
-	}
-	
 	tty = port->tty;
 	if (!tty) {
 		dbg("%s - bad tty pointer - exiting",__FUNCTION__);
@@ -1596,6 +1587,14 @@
 	}
 
 	priv = usb_get_serial_port_data(port);
+	if (!priv) {
+		dbg("%s - bad port private data pointer - exiting", __FUNCTION__);
+		return;
+	}
+
+	if (urb != port->read_urb) {
+		err("%s - Not my urb!", __FUNCTION__);
+	}
 
 	if (urb->status) {
 		/* This will happen at close every time so it is a dbg not an err */
@@ -1603,6 +1602,59 @@
 		return;
 	}
 
+	/* If throttled, delay receive processing until unthrottled. */
+	spin_lock(&priv->rx_lock);
+	if (priv->rx_flags & THROTTLED) {
+		dbg("Deferring read urb processing until unthrottled");
+		priv->rx_flags |= ACTUALLY_THROTTLED;
+		spin_unlock(&priv->rx_lock);
+		return;
+	}
+	spin_unlock(&priv->rx_lock);
+
+	ftdi_process_read(port);
+
+} /* ftdi_read_bulk_callback */
+
+
+static void ftdi_process_read (struct usb_serial_port *port)
+{ /* ftdi_process_read */
+	struct urb *urb;
+	struct tty_struct *tty;
+	struct ftdi_private *priv;
+	char error_flag;
+       	unsigned char *data;
+
+	int i;
+	int result;
+	int need_flip;
+	int packet_offset;
+
+	dbg("%s - port %d", __FUNCTION__, port->number);
+
+	if (port->open_count <= 0)
+		return;
+
+	tty = port->tty;
+	if (!tty) {
+		dbg("%s - bad tty pointer - exiting",__FUNCTION__);
+		return;
+	}
+
+	priv = usb_get_serial_port_data(port);
+	if (!priv) {
+		dbg("%s - bad port private data pointer - exiting", __FUNCTION__);
+		return;
+	}
+
+	urb = port->read_urb;
+	if (!urb) {
+		dbg("%s - bad read_urb pointer - exiting", __FUNCTION__);
+		return;
+	}
+
+	data = urb->transfer_buffer;
+
         /* The first two bytes of every read packet are status */
 	if (urb->actual_length > 2) {
 		usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
@@ -1696,8 +1748,8 @@
 	/* if the port is closed stop trying to read */
 	if (port->open_count > 0){
 		/* Continue trying to always read  */
-		usb_fill_bulk_urb(port->read_urb, serial->dev, 
-			      usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+		usb_fill_bulk_urb(port->read_urb, port->serial->dev, 
+			      usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),
 			      port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
 			      ftdi_read_bulk_callback, port);
 
@@ -1707,12 +1759,11 @@
 	}
 
 	return;
-} /* ftdi_read_bulk_callback */
+} /* ftdi_process_read */
 
 
 static void ftdi_break_ctl( struct usb_serial_port *port, int break_state )
 {
-	struct usb_serial *serial = port->serial;
 	struct ftdi_private *priv = usb_get_serial_port_data(port);
 	__u16 urb_value = 0; 
 	char buf[1];
@@ -1728,7 +1779,7 @@
 	}
 
 	
-	if (usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+	if (usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0),
 			    FTDI_SIO_SET_DATA_REQUEST, 
 			    FTDI_SIO_SET_DATA_REQUEST_TYPE,
 			    urb_value , 0,
@@ -1748,7 +1799,7 @@
 
 static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_termios)
 { /* ftdi_termios */
-	struct usb_serial *serial = port->serial;
+	struct usb_device *dev = port->serial->dev;
 	unsigned int cflag = port->tty->termios->c_cflag;
 	struct ftdi_private *priv = usb_get_serial_port_data(port);
 	__u16 urb_value; /* will hold the new flags */
@@ -1807,7 +1858,7 @@
 	 *  or'ed with this value  */
 	priv->last_set_data_urb_value = urb_value;
 	
-	if (usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+	if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 			    FTDI_SIO_SET_DATA_REQUEST, 
 			    FTDI_SIO_SET_DATA_REQUEST_TYPE,
 			    urb_value , 0,
@@ -1818,7 +1869,7 @@
 	/* Now do the baudrate */
 	if ((cflag & CBAUD) == B0 ) {
 		/* Disable flow control */
-		if (usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST, 
 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
 				    0, 0, 
@@ -1844,8 +1895,8 @@
 	/* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
 	if (cflag & CRTSCTS) {
 		dbg("%s Setting to CRTSCTS flow control", __FUNCTION__);
-		if (usb_control_msg(serial->dev, 
-				    usb_sndctrlpipe(serial->dev, 0),
+		if (usb_control_msg(dev, 
+				    usb_sndctrlpipe(dev, 0),
 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST, 
 				    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
 				    0 , FTDI_SIO_RTS_CTS_HS,
@@ -1870,8 +1921,8 @@
 			vstop=port->tty->termios->c_cc[VSTOP];
 			urb_value=(vstop << 8) | (vstart);
 
-			if (usb_control_msg(serial->dev,
-					    usb_sndctrlpipe(serial->dev, 0),
+			if (usb_control_msg(dev,
+					    usb_sndctrlpipe(dev, 0),
 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
 					    urb_value , FTDI_SIO_XON_XOFF_HS,
@@ -1882,8 +1933,8 @@
 			/* else clause to only run if cfag ! CRTSCTS and iflag ! XOFF */
 			/* CHECKME Assuming XON/XOFF handled by tty stack - not by device */
 			dbg("%s Turning off hardware flow control", __FUNCTION__);
-			if (usb_control_msg(serial->dev, 
-					    usb_sndctrlpipe(serial->dev, 0),
+			if (usb_control_msg(dev, 
+					    usb_sndctrlpipe(dev, 0),
 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST, 
 					    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
 					    0, 0, 
@@ -1899,7 +1950,6 @@
 
 static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file)
 {
-	struct usb_serial *serial = port->serial;
 	struct ftdi_private *priv = usb_get_serial_port_data(port);
 	unsigned char buf[2];
 	int ret;
@@ -1908,8 +1958,8 @@
 	switch (priv->chip_type) {
 	case SIO:
 		/* Request the status from the device */
-		if ((ret = usb_control_msg(serial->dev, 
-					   usb_rcvctrlpipe(serial->dev, 0),
+		if ((ret = usb_control_msg(port->serial->dev, 
+					   usb_rcvctrlpipe(port->serial->dev, 0),
 					   FTDI_SIO_GET_MODEM_STATUS_REQUEST, 
 					   FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
 					   0, 0, 
@@ -1923,8 +1973,8 @@
 	case FT232BM:
 		/* the 8U232AM returns a two byte value (the sio is a 1 byte value) - in the same
 		   format as the data returned from the in point */
-		if ((ret = usb_control_msg(serial->dev, 
-					   usb_rcvctrlpipe(serial->dev, 0),
+		if ((ret = usb_control_msg(port->serial->dev, 
+					   usb_rcvctrlpipe(port->serial->dev, 0),
 					   FTDI_SIO_GET_MODEM_STATUS_REQUEST, 
 					   FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE,
 					   0, 0, 
@@ -2099,28 +2149,32 @@
 
 static void ftdi_throttle (struct usb_serial_port *port)
 {
+	struct ftdi_private *priv = usb_get_serial_port_data(port);
+	unsigned long flags;
+
 	dbg("%s - port %d", __FUNCTION__, port->number);
-	usb_unlink_urb (port->read_urb);
+
+	spin_lock_irqsave(&priv->rx_lock, flags);
+	priv->rx_flags |= THROTTLED;
+	spin_unlock_irqrestore(&priv->rx_lock, flags);
 }
 
 
 static void ftdi_unthrottle (struct usb_serial_port *port)
 {
-	int result;
-	struct usb_serial *serial = port->serial;
+	struct ftdi_private *priv = usb_get_serial_port_data(port);
+	int actually_throttled;
+	unsigned long flags;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	port->read_urb->dev = serial->dev;
+	spin_lock_irqsave(&priv->rx_lock, flags);
+	actually_throttled = priv->rx_flags & ACTUALLY_THROTTLED;
+	priv->rx_flags &= ~(THROTTLED | ACTUALLY_THROTTLED);
+	spin_unlock_irqrestore(&priv->rx_lock, flags);
 
-	usb_fill_bulk_urb(port->read_urb, serial->dev, 
-		      usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
-		      port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
-		      ftdi_read_bulk_callback, port);
-
-	result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
-	if (result)
-		err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
+	if (actually_throttled)
+		ftdi_process_read(port);
 }
 
 static int __init ftdi_init (void)
diff -Nru a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
--- a/drivers/usb/serial/generic.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/serial/generic.c	Tue Jun 15 22:20:36 2004
@@ -16,6 +16,7 @@
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/usb.h>
 #include <asm/uaccess.h>
 
@@ -32,10 +33,10 @@
 static __u16 vendor  = 0x05f9;
 static __u16 product = 0xffff;
 
-MODULE_PARM(vendor, "h");
+module_param(vendor, ushort, 0);
 MODULE_PARM_DESC(vendor, "User specified USB idVendor");
 
-MODULE_PARM(product, "h");
+module_param(product, ushort, 0);
 MODULE_PARM_DESC(product, "User specified USB idProduct");
 
 static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
@@ -83,9 +84,6 @@
 	struct usb_serial *serial = port->serial;
 	int result = 0;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	/* force low_latency on so that our tty_push actually forces the data through, 
@@ -223,7 +221,7 @@
 void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
+	struct usb_serial *serial = port->serial;
 	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
 	int i;
@@ -231,11 +229,6 @@
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		return;
@@ -273,14 +266,8 @@
 void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
-
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
 
 	if (urb->status) {
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
--- a/drivers/usb/serial/io_edgeport.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/serial/io_edgeport.c	Tue Jun 15 22:20:36 2004
@@ -776,10 +776,6 @@
 
 	dbg("%s", __FUNCTION__);
 
-	if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
-		return;
-	}
-
 	switch (urb->status) {
 	case 0:
 		/* success */
@@ -825,19 +821,17 @@
 			txCredits = data[position] | (data[position+1] << 8);
 			if (txCredits) {
 				port = edge_serial->serial->port[portNumber];
-				if (port_paranoia_check (port, __FUNCTION__) == 0) {
-					edge_port = usb_get_serial_port_data(port);
-					if (edge_port->open) {
-						edge_port->txCredits += txCredits;
-						dbg("%s - txcredits for port%d = %d", __FUNCTION__, portNumber, edge_port->txCredits);
-
-						/* tell the tty driver that something has changed */
-						if (edge_port->port->tty)
-							wake_up_interruptible(&edge_port->port->tty->write_wait);
+				edge_port = usb_get_serial_port_data(port);
+				if (edge_port->open) {
+					edge_port->txCredits += txCredits;
+					dbg("%s - txcredits for port%d = %d", __FUNCTION__, portNumber, edge_port->txCredits);
+
+					/* tell the tty driver that something has changed */
+					if (edge_port->port->tty)
+						wake_up_interruptible(&edge_port->port->tty->write_wait);
 
-						// Since we have more credit, check if more data can be sent
-						send_more_port_data(edge_serial, edge_port);
-					}
+					// Since we have more credit, check if more data can be sent
+					send_more_port_data(edge_serial, edge_port);
 				}
 			}
 			position += 2;
@@ -867,10 +861,6 @@
 
 	dbg("%s", __FUNCTION__);
 
-	if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		return;
@@ -916,10 +906,6 @@
 
 	dbg("%s", __FUNCTION__);
 
-	if (port_paranoia_check (edge_port->port, __FUNCTION__)) {
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
 	}
@@ -969,10 +955,6 @@
 	/* Free the command urb */
 	usb_free_urb (urb);
 
-	if (port_paranoia_check (edge_port->port, __FUNCTION__)) {
-		return;
-	}
-
 	if (status) {
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, status);
 		return;
@@ -1009,9 +991,6 @@
 	int response;
 	int timeout;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (edge_port == NULL)
@@ -1240,55 +1219,45 @@
  *****************************************************************************/
 static void edge_close (struct usb_serial_port *port, struct file * filp)
 {
-	struct usb_serial *serial;
 	struct edgeport_serial *edge_serial;
 	struct edgeport_port *edge_port;
 	int status;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 			 
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-	
-	edge_serial = usb_get_serial_data(serial);
+	edge_serial = usb_get_serial_data(port->serial);
 	edge_port = usb_get_serial_port_data(port);
 	if ((edge_serial == NULL) || (edge_port == NULL))
 		return;
 	
-	if (serial->dev) {
-		// block until tx is empty
-		block_until_tx_empty(edge_port);
-
-		edge_port->closePending = TRUE;
-
-		/* flush and chase */
-		edge_port->chaseResponsePending = TRUE;
-
-		dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__);
-		status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0);
-		if (status == 0) {
-			// block until chase finished
-			block_until_chase_response(edge_port);
-		} else {
-			edge_port->chaseResponsePending = FALSE;
-		}
+	// block until tx is empty
+	block_until_tx_empty(edge_port);
 
-		/* close the port */
-		dbg("%s - Sending IOSP_CMD_CLOSE_PORT", __FUNCTION__);
-		send_iosp_ext_cmd (edge_port, IOSP_CMD_CLOSE_PORT, 0);
-
-		//port->close = TRUE;
-		edge_port->closePending = FALSE;
-		edge_port->open = FALSE;
-		edge_port->openPending = FALSE;
+	edge_port->closePending = TRUE;
 
-		if (edge_port->write_urb) {
-			usb_unlink_urb (edge_port->write_urb);
-		}
+	/* flush and chase */
+	edge_port->chaseResponsePending = TRUE;
+
+	dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__);
+	status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0);
+	if (status == 0) {
+		// block until chase finished
+		block_until_chase_response(edge_port);
+	} else {
+		edge_port->chaseResponsePending = FALSE;
+	}
+
+	/* close the port */
+	dbg("%s - Sending IOSP_CMD_CLOSE_PORT", __FUNCTION__);
+	send_iosp_ext_cmd (edge_port, IOSP_CMD_CLOSE_PORT, 0);
+
+	//port->close = TRUE;
+	edge_port->closePending = FALSE;
+	edge_port->open = FALSE;
+	edge_port->openPending = FALSE;
+
+	if (edge_port->write_urb) {
+		usb_unlink_urb (edge_port->write_urb);
 	}
 
 	if (edge_port->write_urb) {
@@ -2071,24 +2040,22 @@
 				/* spit this data back into the tty driver if this port is open */
 				if (rxLen) {
 					port = edge_serial->serial->port[edge_serial->rxPort];
-					if (port_paranoia_check (port, __FUNCTION__) == 0) {
-        					edge_port = usb_get_serial_port_data(port);
-						if (edge_port->open) {
-							tty = edge_port->port->tty;
-							if (tty) {
-								dbg("%s - Sending %d bytes to TTY for port %d", __FUNCTION__, rxLen, edge_serial->rxPort);
-								for (i = 0; i < rxLen ; ++i) {
-									/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
-									if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
-										tty_flip_buffer_push(tty);
-									}
-									/* this doesn't actually push the data through unless tty->low_latency is set */
-									tty_insert_flip_char(tty, buffer[i], 0);
+					edge_port = usb_get_serial_port_data(port);
+					if (edge_port->open) {
+						tty = edge_port->port->tty;
+						if (tty) {
+							dbg("%s - Sending %d bytes to TTY for port %d", __FUNCTION__, rxLen, edge_serial->rxPort);
+							for (i = 0; i < rxLen ; ++i) {
+								/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
+								if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
+									tty_flip_buffer_push(tty);
 								}
-								tty_flip_buffer_push(tty);
+								/* this doesn't actually push the data through unless tty->low_latency is set */
+								tty_insert_flip_char(tty, buffer[i], 0);
 							}
-							edge_port->icount.rx += rxLen;
+							tty_flip_buffer_push(tty);
 						}
+						edge_port->icount.rx += rxLen;
 					}
 					buffer += rxLen;
 				}
@@ -2124,9 +2091,6 @@
 
 	/* switch the port pointer to the one being currently talked about */
 	port = edge_serial->serial->port[edge_serial->rxPort];
-	if (port_paranoia_check (port, __FUNCTION__)) {
-		return;
-	}
         edge_port = usb_get_serial_port_data(port);
 	if (edge_port == NULL) {
 		dev_err(&edge_serial->serial->dev->dev, "%s - edge_port == NULL for port %d\n", __FUNCTION__, edge_serial->rxPort);
diff -Nru a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
--- a/drivers/usb/serial/io_ti.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/usb/serial/io_ti.c	Tue Jun 15 22:21:04 2004
@@ -279,8 +279,8 @@
  * @address_type: Can read both XDATA and I2C
  * @buffer: pointer to input data buffer
  */
-int TIReadDownloadMemory (struct usb_device *dev, int start_address, int length,
-			  __u8 address_type, __u8 *buffer)
+static int TIReadDownloadMemory(struct usb_device *dev, int start_address,
+				int length, __u8 address_type, __u8 *buffer)
 {
 	int status = 0;
 	__u8 read_length;
@@ -328,7 +328,7 @@
 	return status;
 }
 
-int TIReadRam (struct usb_device *dev, int start_address, int length, __u8 *buffer)
+static int TIReadRam (struct usb_device *dev, int start_address, int length, __u8 *buffer)
 {
 	return TIReadDownloadMemory (dev,
 				     start_address,
@@ -552,7 +552,7 @@
 			break;
 
 		/* Block the thread for 10ms */
-		wait_ms (10);
+		msleep(10);
 
 		if (last_count == port->tx.count) {
 			/* No activity.. count down. */
@@ -581,7 +581,7 @@
 		/* This function takes 4 ms; */
 		if (!TIIsTxActive (port)) {
 			/* Delay a few char times */
-			wait_ms (50);
+			msleep(50);
 			dbg ("%s - Empty", __FUNCTION__);
 			return;
 		}
@@ -612,7 +612,7 @@
 	return 0;
 }
 
-int TIReadRom (struct edgeport_serial *serial, int start_address, int length, __u8 *buffer)
+static int TIReadRom (struct edgeport_serial *serial, int start_address, int length, __u8 *buffer)
 {
 	int status;
 
@@ -632,7 +632,7 @@
 	return status;
 }
 
-int TIWriteRom (struct edgeport_serial *serial, int start_address, int length, __u8 *buffer)
+static int TIWriteRom (struct edgeport_serial *serial, int start_address, int length, __u8 *buffer)
 {
 	if (serial->product_info.TiMode == TI_MODE_BOOT)
 		return TIWriteBootMemory (serial,
@@ -995,7 +995,7 @@
 	if (status)
 		return status;
 
-	interface = &serial->serial->dev->config->interface[0]->altsetting->desc;
+	interface = &serial->serial->interface->cur_altsetting->desc;
 	if (!interface) {
 		dev_err (&serial->serial->dev->dev, "%s - no interface set, error!", __FUNCTION__);
 		return -ENODEV;
@@ -1649,10 +1649,6 @@
 
 	dbg("%s", __FUNCTION__);
 
-	if (serial_paranoia_check (edge_serial->serial, __FUNCTION__)) {
-		return;
-	}
-
 	switch (urb->status) {
 	case 0:
 		/* success */
@@ -1685,11 +1681,6 @@
 	dbg ("%s - port_number %d, function %d, info 0x%x",
 	     __FUNCTION__, port_number, function, data[1]);
 	port = edge_serial->serial->port[port_number];
-	if (port_paranoia_check (port, __FUNCTION__)) {
-		dbg ("%s - change found for port that is not present",
-		     __FUNCTION__);
-		return;
-	}
 	edge_port = usb_get_serial_port_data(port);
 	if (!edge_port) {
 		dbg ("%s - edge_port not found", __FUNCTION__);
@@ -1744,9 +1735,6 @@
 
 	dbg("%s", __FUNCTION__);
 
-	if (port_paranoia_check (edge_port->port, __FUNCTION__))
-		return;
-
 	if (urb->status) {
 		dbg ("%s - nonzero read bulk status received: %d",
 		     __FUNCTION__, urb->status);
@@ -1804,23 +1792,17 @@
 static void edge_bulk_out_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct tty_struct *tty;
 
 	dbg ("%s - port %d", __FUNCTION__, port->number);
 
-	if (!serial) {
-		dbg ("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg ("%s - nonzero write bulk status received: %d",
 		     __FUNCTION__, urb->status);
 
 		if (urb->status == -EPIPE) {
 			/* clear any problem that might have happened on this pipe */
-			usb_clear_halt (serial->dev, urb->pipe);
+			usb_clear_halt (port->serial->dev, urb->pipe);
 		}
 		return;
 	}
@@ -1848,9 +1830,6 @@
 	u16 open_settings;
 	u8 transaction_timeout;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (edge_port == NULL)
@@ -1993,61 +1972,50 @@
 
 static void edge_close (struct usb_serial_port *port, struct file * filp)
 {
-	struct usb_serial *serial;
 	struct edgeport_serial *edge_serial;
 	struct edgeport_port *edge_port;
 	int port_number;
 	int status;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 			 
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-	
-	edge_serial = usb_get_serial_data(serial);
+	edge_serial = usb_get_serial_data(port->serial);
 	edge_port = usb_get_serial_port_data(port);
 	if ((edge_serial == NULL) || (edge_port == NULL))
 		return;
 	
-	if (serial->dev) {
-		/* The bulkreadcompletion routine will check 
-		 * this flag and dump add read data */
-		edge_port->close_pending = 1;
-
-		/* chase the port close */
-		TIChasePort (edge_port);
-
-		usb_unlink_urb (port->read_urb);
-
-		/* assuming we can still talk to the device,
-		 * send a close port command to it */
-		dbg("%s - send umpc_close_port", __FUNCTION__);
-		port_number = port->number - port->serial->minor;
-		status = TIWriteCommandSync (port->serial->dev,
-					     UMPC_CLOSE_PORT,
-					     (__u8)(UMPM_UART1_PORT + port_number),
-					     0,
-					     NULL,
-					     0);
-		--edge_port->edge_serial->num_ports_open;
-		if (edge_port->edge_serial->num_ports_open <= 0) {
-			/* last port is now closed, let's shut down our interrupt urb */
-			usb_unlink_urb (serial->port[0]->interrupt_in_urb);
-			edge_port->edge_serial->num_ports_open = 0;
-		}
-	edge_port->close_pending = 0;
+	/* The bulkreadcompletion routine will check 
+	 * this flag and dump add read data */
+	edge_port->close_pending = 1;
+
+	/* chase the port close */
+	TIChasePort (edge_port);
+
+	usb_unlink_urb (port->read_urb);
+
+	/* assuming we can still talk to the device,
+	 * send a close port command to it */
+	dbg("%s - send umpc_close_port", __FUNCTION__);
+	port_number = port->number - port->serial->minor;
+	status = TIWriteCommandSync (port->serial->dev,
+				     UMPC_CLOSE_PORT,
+				     (__u8)(UMPM_UART1_PORT + port_number),
+				     0,
+				     NULL,
+				     0);
+	--edge_port->edge_serial->num_ports_open;
+	if (edge_port->edge_serial->num_ports_open <= 0) {
+		/* last port is now closed, let's shut down our interrupt urb */
+		usb_unlink_urb (port->serial->port[0]->interrupt_in_urb);
+		edge_port->edge_serial->num_ports_open = 0;
 	}
+	edge_port->close_pending = 0;
 
 	dbg("%s - exited", __FUNCTION__);
 }
 
 static int edge_write (struct usb_serial_port *port, int from_user, const unsigned char *data, int count)
 {
-	struct usb_serial *serial = port->serial;
 	struct edgeport_port *edge_port = usb_get_serial_port_data(port);
 	int result;
 
@@ -2080,8 +2048,8 @@
 	usb_serial_debug_data (__FILE__, __FUNCTION__, count, port->write_urb->transfer_buffer);
 
 	/* set up our urb */
-	usb_fill_bulk_urb (port->write_urb, serial->dev,
-			   usb_sndbulkpipe (serial->dev,
+	usb_fill_bulk_urb (port->write_urb, port->serial->dev,
+			   usb_sndbulkpipe (port->serial->dev,
 					    port->bulk_out_endpointAddress),
 			   port->write_urb->transfer_buffer, count,
 			   edge_bulk_out_callback,
diff -Nru a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
--- a/drivers/usb/serial/ipaq.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/serial/ipaq.c	Tue Jun 15 22:20:44 2004
@@ -150,7 +150,7 @@
 
 
 /* All of the device info needed for the Compaq iPAQ */
-struct usb_serial_device_type ipaq_device = {
+static struct usb_serial_device_type ipaq_device = {
 	.owner =		THIS_MODULE,
 	.name =			"PocketPC PDA",
 	.id_table =		ipaq_id_table,
@@ -181,10 +181,6 @@
 	int			i, result = 0;
 	int			retries = KP_RETRIES;
 
-	if (port_paranoia_check(port, __FUNCTION__)) {
-		return -ENODEV;
-	}
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	bytes_in = 0;
@@ -288,23 +284,13 @@
 
 static void ipaq_close(struct usb_serial_port *port, struct file *filp)
 {
-	struct usb_serial	*serial;
 	struct ipaq_private	*priv = usb_get_serial_port_data(port);
 
-	if (port_paranoia_check(port, __FUNCTION__)) {
-		return; 
-	}
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 			 
-	serial = get_usb_serial(port, __FUNCTION__);
-	if (!serial)
-		return;
-
 	/*
 	 * shut down bulk read and write
 	 */
-
 	usb_unlink_urb(port->write_urb);
 	usb_unlink_urb(port->read_urb);
 	ipaq_destroy_lists(port);
@@ -318,21 +304,12 @@
 static void ipaq_read_bulk_callback(struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port	*port = (struct usb_serial_port *)urb->context;
-	struct usb_serial	*serial = get_usb_serial (port, __FUNCTION__);
 	struct tty_struct	*tty;
 	unsigned char		*data = urb->transfer_buffer;
 	int			i, result;
 
-	if (port_paranoia_check(port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		return;
@@ -355,8 +332,8 @@
 	}
 
 	/* Continue trying to always read  */
-	usb_fill_bulk_urb(port->read_urb, serial->dev, 
-		      usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+	usb_fill_bulk_urb(port->read_urb, port->serial->dev, 
+		      usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),
 		      port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
 		      ipaq_read_bulk_callback, port);
 	result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
@@ -488,10 +465,6 @@
 	unsigned long		flags;
 	int			result;
 
-	if (port_paranoia_check (port, __FUNCTION__)) {
-		return;
-	}
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
 	if (urb->status) {
diff -Nru a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
--- a/drivers/usb/serial/ir-usb.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/serial/ir-usb.c	Tue Jun 15 22:20:40 2004
@@ -138,7 +138,7 @@
 };
 
 
-struct usb_serial_device_type ir_device = {
+static struct usb_serial_device_type ir_device = {
 	.owner =		THIS_MODULE,
 	.name =			"IR Dongle",
 	.id_table =		id_table,
@@ -279,13 +279,9 @@
 
 static int ir_open (struct usb_serial_port *port, struct file *filp)
 {
-	struct usb_serial *serial = port->serial;
 	char *buffer;
 	int result = 0;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (buffer_size) {
@@ -313,8 +309,8 @@
 	/* Start reading from the device */
 	usb_fill_bulk_urb (
 		port->read_urb,
-		serial->dev, 
-		usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+		port->serial->dev, 
+		usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),
 		port->read_urb->transfer_buffer,
 		port->read_urb->transfer_buffer_length,
 		ir_read_bulk_callback,
@@ -328,21 +324,10 @@
 
 static void ir_close (struct usb_serial_port *port, struct file * filp)
 {
-	struct usb_serial *serial;
-
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 			 
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-	
-	if (serial->dev) {
-		/* shutdown our bulk read */
-		usb_unlink_urb (port->read_urb);
-	}
+	/* shutdown our bulk read */
+	usb_unlink_urb (port->read_urb);
 }
 
 static int ir_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
@@ -411,9 +396,6 @@
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
 	if (urb->status) {
@@ -433,21 +415,12 @@
 static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
 	int result;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (!port->open_count) {
 		dbg("%s - port closed.", __FUNCTION__);
 		return;
@@ -496,8 +469,8 @@
 			/* Continue trying to always read */
 			usb_fill_bulk_urb (
 				port->read_urb,
-				serial->dev, 
-				usb_rcvbulkpipe(serial->dev,
+				port->serial->dev, 
+				usb_rcvbulkpipe(port->serial->dev,
 					port->bulk_in_endpointAddress),
 				port->read_urb->transfer_buffer,
 				port->read_urb->transfer_buffer_length,
diff -Nru a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
--- a/drivers/usb/serial/keyspan.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/usb/serial/keyspan.c	Tue Jun 15 22:20:37 2004
@@ -133,9 +133,6 @@
 
 	/* Per device and per port private data */
 struct keyspan_serial_private {
-	/* number of active ports */
-	atomic_t	active_count;
-
 	const struct keyspan_device_details	*device_details;
 
 	struct urb	*instat_urb;
@@ -1144,13 +1141,9 @@
 static void keyspan_close(struct usb_serial_port *port, struct file *filp)
 {
 	int			i;
-	struct usb_serial	*serial;
+	struct usb_serial	*serial = port->serial;
 	struct keyspan_serial_private 	*s_priv;
 	struct keyspan_port_private 	*p_priv;
-
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
 
 	dbg("%s", __FUNCTION__);
 	s_priv = usb_get_serial_data(serial);
diff -Nru a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
--- a/drivers/usb/serial/keyspan.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/usb/serial/keyspan.h	Tue Jun 15 22:20:42 2004
@@ -326,6 +326,22 @@
 	.baudclk		= KEYSPAN_USA19_BAUDCLK,
 };
 
+static const struct keyspan_device_details mpr_device_details = {
+	.product_id		= keyspan_mpr_product_id,
+	.msg_format		= msg_usa28,
+	.num_ports		= 1,
+	.indat_endp_flip	= 1,
+	.outdat_endp_flip	= 1,
+	.indat_endpoints	= {0x81},
+	.outdat_endpoints	= {0x01},
+	.inack_endpoints	= {0x83},
+	.outcont_endpoints	= {0x03},
+	.instat_endpoint	= 0x84,
+	.glocont_endpoint	= -1,
+	.calculate_baud_rate	= keyspan_usa28_calc_baud,
+	.baudclk		= KEYSPAN_USA19_BAUDCLK,
+};
+
 static const struct keyspan_device_details usa19qw_device_details = {
 	.product_id		= keyspan_usa19qw_product_id,
 	.msg_format		= msg_usa26,
@@ -460,6 +476,7 @@
 	&usa18x_device_details,
 	&usa19_device_details,
 	&usa19qi_device_details,
+	&mpr_device_details,
 	&usa19qw_device_details,
 	&usa19w_device_details,
 	&usa19hs_device_details,
@@ -535,7 +552,7 @@
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
-	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_pre_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
 	{ } /* Terminating entry */
 };
 
diff -Nru a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
--- a/drivers/usb/serial/keyspan_pda.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/usb/serial/keyspan_pda.c	Tue Jun 15 22:20:42 2004
@@ -226,8 +226,7 @@
 static void keyspan_pda_rx_interrupt (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial;
-       	struct tty_struct *tty;
+       	struct tty_struct *tty = port->tty;
 	unsigned char *data = urb->transfer_buffer;
 	int i;
 	int status;
@@ -249,22 +248,11 @@
 		goto exit;
 	}
 
-	
-	if (port_paranoia_check (port, "keyspan_pda_rx_interrupt")) {
-		return;
-	}
-
-	serial = port->serial;
-	if (serial_paranoia_check (serial, "keyspan_pda_rx_interrupt")) {
-		return;
-	}
-	
  	/* see if the message is data or a status interrupt */
 	switch (data[0]) {
 	case 0:
 		/* rest of message is rx data */
 		if (urb->actual_length) {
-			tty = serial->port[0]->tty;
 			for (i = 1; i < urb->actual_length ; ++i) {
 				tty_insert_flip_char(tty, data[i], 0);
 			}
@@ -278,7 +266,6 @@
 		case 1: /* modemline change */
 			break;
 		case 2: /* tx unthrottle interrupt */
-			tty = serial->port[0]->tty;
 			priv->tx_throttled = 0;
 			/* queue up a wakeup at scheduler time */
 			schedule_work(&priv->wakeup_work);
@@ -633,20 +620,10 @@
 static void keyspan_pda_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial;
 	struct keyspan_pda_private *priv;
 
 	priv = usb_get_serial_port_data(port);
 
-	if (port_paranoia_check (port, "keyspan_pda_rx_interrupt")) {
-		return;
-	}
-
-	serial = port->serial;
-	if (serial_paranoia_check (serial, "keyspan_pda_rx_interrupt")) {
-		return;
-	}
-	
 	/* queue up a wakeup at scheduler time */
 	schedule_work(&priv->wakeup_work);
 }
diff -Nru a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
--- a/drivers/usb/serial/kl5kusb105.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/serial/kl5kusb105.c	Tue Jun 15 22:20:41 2004
@@ -187,12 +187,13 @@
 
 #define KLSI_TIMEOUT	 (HZ * 5 ) /* default urb timeout */
 
-static int klsi_105_chg_port_settings(struct usb_serial *serial,
+static int klsi_105_chg_port_settings(struct usb_serial_port *port,
 				      struct klsi_105_port_settings *settings)
 {
 	int rc;
 
-        rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
+        rc = usb_control_msg(port->serial->dev,
+			     usb_sndctrlpipe(port->serial->dev, 0),
 			     KL5KUSB105A_SIO_SET_DATA,
                              USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_INTERFACE,
 			     0, /* value */
@@ -227,7 +228,7 @@
  */
 /* It seems that the status buffer has always only 2 bytes length */
 #define KLSI_STATUSBUF_LEN	2
-static int klsi_105_get_line_state(struct usb_serial *serial,
+static int klsi_105_get_line_state(struct usb_serial_port *port,
 				   unsigned long *line_state_p)
 {
 	int rc;
@@ -235,7 +236,8 @@
 	__u16 status;
 
 	info("%s - sending SIO Poll request", __FUNCTION__);
-        rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+        rc = usb_control_msg(port->serial->dev,
+			     usb_rcvctrlpipe(port->serial->dev, 0),
 			     KL5KUSB105A_SIO_POLL,
                              USB_TYPE_VENDOR | USB_DIR_IN,
 			     0, /* value */
@@ -362,7 +364,6 @@
 
 static int  klsi_105_open (struct usb_serial_port *port, struct file *filp)
 {
-	struct usb_serial *serial = port->serial;
 	struct klsi_105_private *priv = usb_get_serial_port_data(port);
 	int retval = 0;
 	int rc;
@@ -389,7 +390,7 @@
 	cfg.databits = kl5kusb105a_dtb_8;
 	cfg.unknown1 = 0;
 	cfg.unknown2 = 1;
-	klsi_105_chg_port_settings(serial, &cfg);
+	klsi_105_chg_port_settings(port, &cfg);
 	
 	/* set up termios structure */
 	spin_lock_irqsave (&priv->lock, flags);
@@ -407,8 +408,8 @@
 	spin_unlock_irqrestore (&priv->lock, flags);
 
 	/* READ_ON and urb submission */
-	usb_fill_bulk_urb(port->read_urb, serial->dev, 
-		      usb_rcvbulkpipe(serial->dev,
+	usb_fill_bulk_urb(port->read_urb, port->serial->dev, 
+		      usb_rcvbulkpipe(port->serial->dev,
 				      port->bulk_in_endpointAddress),
 		      port->read_urb->transfer_buffer,
 		      port->read_urb->transfer_buffer_length,
@@ -422,7 +423,8 @@
 		goto exit;
 	}
 
-	rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev,0),
+	rc = usb_control_msg(port->serial->dev,
+			     usb_sndctrlpipe(port->serial->dev,0),
 			     KL5KUSB105A_SIO_CONFIGURE,
 			     USB_TYPE_VENDOR|USB_DIR_OUT|USB_RECIP_INTERFACE,
 			     KL5KUSB105A_SIO_CONFIGURE_READ_ON,
@@ -436,7 +438,7 @@
 	} else 
 		dbg("%s - enabled reading", __FUNCTION__);
 
-	rc = klsi_105_get_line_state(serial, &line_state);
+	rc = klsi_105_get_line_state(port, &line_state);
 	if (rc >= 0) {
 		spin_lock_irqsave (&priv->lock, flags);
 		priv->line_state = line_state;
@@ -453,20 +455,14 @@
 
 static void klsi_105_close (struct usb_serial_port *port, struct file *filp)
 {
-	struct usb_serial *serial;
 	struct klsi_105_private *priv = usb_get_serial_port_data(port);
 	int rc;
 
 	dbg("%s port %d", __FUNCTION__, port->number);
 
-	serial = get_usb_serial (port, __FUNCTION__);
-
-	if(!serial)
-		return;
-
 	/* send READ_OFF */
-	rc = usb_control_msg (serial->dev,
-			      usb_sndctrlpipe(serial->dev, 0),
+	rc = usb_control_msg (port->serial->dev,
+			      usb_sndctrlpipe(port->serial->dev, 0),
 			      KL5KUSB105A_SIO_CONFIGURE,
 			      USB_TYPE_VENDOR | USB_DIR_OUT,
 			      KL5KUSB105A_SIO_CONFIGURE_READ_OFF,
@@ -497,7 +493,6 @@
 static int klsi_105_write (struct usb_serial_port *port, int from_user,
 			   const unsigned char *buf, int count)
 {
-	struct usb_serial *serial = port->serial;
 	struct klsi_105_private *priv = usb_get_serial_port_data(port);
 	int result, size;
 	int bytes_sent=0;
@@ -551,8 +546,8 @@
 		((__u8 *)urb->transfer_buffer)[1] = (__u8) ((size & 0xFF00)>>8);
 
 		/* set up our urb */
-		usb_fill_bulk_urb(urb, serial->dev,
-			      usb_sndbulkpipe(serial->dev,
+		usb_fill_bulk_urb(urb, port->serial->dev,
+			      usb_sndbulkpipe(port->serial->dev,
 					      port->bulk_out_endpointAddress),
 			      urb->transfer_buffer,
 			      URB_TRANSFER_BUFFER_SIZE,
@@ -579,15 +574,9 @@
 static void klsi_105_write_bulk_callback ( struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = port->serial;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__,
 		    urb->status);
@@ -646,7 +635,6 @@
 static void klsi_105_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = port->serial;
 	struct klsi_105_private *priv = usb_get_serial_port_data(port);
 	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
@@ -660,10 +648,6 @@
 		    urb->status);
                 return;
         }
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
 	
 	/* The data received is again preceded by a length double-byte in LSB-
 	 * first order (see klsi_105_write() )
@@ -714,8 +698,8 @@
 		priv->bytes_in += bytes_sent;
 	}
 	/* Continue trying to always read  */
-	usb_fill_bulk_urb(port->read_urb, serial->dev, 
-		      usb_rcvbulkpipe(serial->dev,
+	usb_fill_bulk_urb(port->read_urb, port->serial->dev, 
+		      usb_rcvbulkpipe(port->serial->dev,
 				      port->bulk_in_endpointAddress),
 		      port->read_urb->transfer_buffer,
 		      port->read_urb->transfer_buffer_length,
@@ -730,7 +714,6 @@
 static void klsi_105_set_termios (struct usb_serial_port *port,
 				  struct termios *old_termios)
 {
-	struct usb_serial *serial = port->serial;
 	struct klsi_105_private *priv = usb_get_serial_port_data(port);
 	unsigned int iflag = port->tty->termios->c_iflag;
 	unsigned int old_iflag = old_termios->c_iflag;
@@ -868,7 +851,7 @@
 	spin_unlock_irqrestore (&priv->lock, flags);
 	
 	/* now commit changes to device */
-	klsi_105_chg_port_settings(serial, &cfg);
+	klsi_105_chg_port_settings(port, &cfg);
 } /* klsi_105_set_termios */
 
 
@@ -890,14 +873,13 @@
 
 static int klsi_105_tiocmget (struct usb_serial_port *port, struct file *file)
 {
-	struct usb_serial *serial = port->serial;
 	struct klsi_105_private *priv = usb_get_serial_port_data(port);
 	unsigned long flags;
 	int rc;
 	unsigned long line_state;
 	dbg("%s - request, just guessing", __FUNCTION__);
 
-	rc = klsi_105_get_line_state(serial, &line_state);
+	rc = klsi_105_get_line_state(port, &line_state);
 	if (rc < 0) {
 		err("Reading line control failed (error = %d)", rc);
 		/* better return value? EAGAIN? */
diff -Nru a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
--- a/drivers/usb/serial/kobil_sct.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/serial/kobil_sct.c	Tue Jun 15 22:20:44 2004
@@ -21,6 +21,9 @@
  * Supported readers: USB TWIN, KAAN Standard Plus and SecOVID Reader Plus
  * (Adapter K), B1 Professional and KAAN Professional (Adapter B)
  * 
+ * (21/05/2004) tw
+ *      Fix bug with P'n'P readers
+ *
  * (28/05/2003) tw
  *      Add support for KAAN SIM
  *
@@ -59,7 +62,7 @@
 #include "usb-serial.h"
 
 /* Version Information */
-#define DRIVER_VERSION "28/05/2003"
+#define DRIVER_VERSION "21/05/2004"
 #define DRIVER_AUTHOR "KOBIL Systems GmbH - http://www.kobil.com"
 #define DRIVER_DESC "KOBIL USB Smart Card Terminal Driver (experimental)"
 
@@ -110,7 +113,7 @@
 };
 
 
-struct usb_serial_device_type kobil_device = {
+static struct usb_serial_device_type kobil_device = {
 	.owner =		THIS_MODULE,
 	.name =			"KOBIL USB smart card terminal",
 	.id_table =		id_table,
@@ -183,7 +186,7 @@
 	pdev = serial->dev;
  	actconfig = pdev->actconfig;
  	interface = actconfig->interface[0];
-	altsetting = interface->altsetting;
+	altsetting = interface->cur_altsetting;
  	endpoint = altsetting->endpoint;
   
  	for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
@@ -230,9 +233,6 @@
 	priv = usb_get_serial_port_data(port);
 	priv->line_state = 0;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-
 	// someone sets the dev to 0 if the close method has been called
 	port->interrupt_in_urb->dev = port->serial->dev;
 
@@ -342,6 +342,12 @@
 			);
 		dbg("%s - port %d Send reset_all_queues URB returns: %i", __FUNCTION__, port->number, result);
 	}
+	if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
+	    priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
+		// start reading (Adapter B 'cause PNP string)
+		result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC  ); 
+		dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
+	}
 
 	kfree(transfer_buffer);
 	return 0;
@@ -459,6 +465,11 @@
 	if ( ((priv->device_type != KOBIL_ADAPTER_B_PRODUCT_ID) && (priv->filled > 2) && (priv->filled >= (priv->buf[1] + 3))) || 
 	     ((priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) && (priv->filled > 3) && (priv->filled >= (priv->buf[2] + 4))) ) {
 		
+		// stop reading (except TWIN and KAAN SIM)
+		if ( (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) || (priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) ) {
+			usb_unlink_urb( port->interrupt_in_urb );
+		}
+
 		todo = priv->filled - priv->cur_pos;
 
 		while(todo > 0) {
@@ -466,25 +477,23 @@
 			length = (todo < 8) ? todo : 8;
 			// copy data to transfer buffer
 			memcpy(port->write_urb->transfer_buffer, priv->buf + priv->cur_pos, length );
-			
-			usb_fill_bulk_urb( port->write_urb,
-					   port->serial->dev,
-					   usb_sndbulkpipe( port->serial->dev, priv->write_int_endpoint_address),
-					   port->write_urb->transfer_buffer,
-					   length,
-					   kobil_write_callback,
-					   port
+			usb_fill_int_urb( port->write_urb,
+					  port->serial->dev,
+					  usb_sndintpipe(port->serial->dev, priv->write_int_endpoint_address),
+					  port->write_urb->transfer_buffer,
+					  length,
+					  kobil_write_callback,
+					  port,
+					  8
 				);
 
 			priv->cur_pos = priv->cur_pos + length;
-			result = usb_submit_urb( port->write_urb, GFP_ATOMIC );
+			result = usb_submit_urb( port->write_urb, GFP_NOIO );
 			dbg("%s - port %d Send write URB returns: %i", __FUNCTION__, port->number, result);
 			todo = priv->filled - priv->cur_pos;
 
 			if (todo > 0) {
-				//mdelay(16);
-				set_current_state(TASK_UNINTERRUPTIBLE);
-				schedule_timeout(24 * HZ / 1000);
+				msleep(24);
 			}
 
 		} // end while
@@ -495,9 +504,14 @@
 		// someone sets the dev to 0 if the close method has been called
 		port->interrupt_in_urb->dev = port->serial->dev;
 		
-		// start reading
-		result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC ); 
-		dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
+		// start reading (except TWIN and KAAN SIM)
+		if ( (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) || (priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) ) {
+			// someone sets the dev to 0 if the close method has been called
+			port->interrupt_in_urb->dev = port->serial->dev;
+			
+			result = usb_submit_urb( port->interrupt_in_urb, GFP_NOIO ); 
+			dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result);
+		}
 	}
 	return count;
 }
diff -Nru a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
--- a/drivers/usb/serial/omninet.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/serial/omninet.c	Tue Jun 15 22:20:44 2004
@@ -151,20 +151,13 @@
 
 static int omninet_open (struct usb_serial_port *port, struct file *filp)
 {
-	struct usb_serial	*serial;
+	struct usb_serial	*serial = port->serial;
 	struct usb_serial_port	*wport;
 	struct omninet_data	*od;
 	int			result = 0;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return -ENODEV;
-
 	od = kmalloc( sizeof(struct omninet_data), GFP_KERNEL );
 	if( !od ) {
 		err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct omninet_data));
@@ -189,24 +182,15 @@
 
 static void omninet_close (struct usb_serial_port *port, struct file * filp)
 {
-	struct usb_serial 	*serial;
+	struct usb_serial 	*serial = port->serial;
 	struct usb_serial_port 	*wport;
 	struct omninet_data 	*od;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-
-	if (serial->dev) {
-		wport = serial->port[1];
-		usb_unlink_urb (wport->write_urb);
-		usb_unlink_urb (port->read_urb);
-	}
+	wport = serial->port[1];
+	usb_unlink_urb(wport->write_urb);
+	usb_unlink_urb(port->read_urb);
 
 	od = usb_get_serial_port_data(port);
 	if (od)
@@ -221,8 +205,6 @@
 static void omninet_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port 	*port 	= (struct usb_serial_port *)urb->context;
-	struct usb_serial	*serial = get_usb_serial (port, __FUNCTION__);
-
 	unsigned char 		*data 	= urb->transfer_buffer;
 	struct omninet_header 	*header = (struct omninet_header *) &data[0];
 
@@ -231,11 +213,6 @@
 
 //	dbg("omninet_read_bulk_callback");
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		return;
@@ -259,8 +236,8 @@
 	}
 
 	/* Continue trying to always read  */
-	usb_fill_bulk_urb(urb, serial->dev, 
-		      usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+	usb_fill_bulk_urb(urb, port->serial->dev, 
+		      usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),
 		      urb->transfer_buffer, urb->transfer_buffer_length,
 		      omninet_read_bulk_callback, port);
 	result = usb_submit_urb(urb, GFP_ATOMIC);
@@ -344,19 +321,8 @@
 {
 /*	struct omninet_header	*header = (struct omninet_header  *) urb->transfer_buffer; */
 	struct usb_serial_port 	*port   = (struct usb_serial_port *) urb->context;
-	struct usb_serial 	*serial;
 
 //	dbg("omninet_write_bulk_callback, port %0x\n", port);
-
-
-	if (port_paranoia_check (port, __FUNCTION__)) {
-		return;
-	}
-
-	serial = port->serial;
-	if (serial_paranoia_check (serial, __FUNCTION__)) {
-		return;
-	}
 
 	if (urb->status) {
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
diff -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
--- a/drivers/usb/serial/pl2303.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/serial/pl2303.c	Tue Jun 15 22:20:40 2004
@@ -1,7 +1,7 @@
 /*
  * Prolific PL2303 USB to serial adaptor driver
  *
- * Copyright (C) 2001-2003 Greg Kroah-Hartman (greg@kroah.com)
+ * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
  * Copyright (C) 2003 IBM Corp.
  *
  * Original driver for 2.2.x by anonymous
@@ -45,6 +45,7 @@
 #include <linux/tty_flip.h>
 #include <linux/serial.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
@@ -80,6 +81,7 @@
 	{ USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) },
 	{ USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) },
 	{ USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) },
+	{ USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) },
 	{ }					/* Terminating entry */
 };
 
@@ -410,9 +412,6 @@
 	unsigned char *buf;
 	int result;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-		
 	dbg("%s -  port %d", __FUNCTION__, port->number);
 
 	usb_clear_halt(serial->dev, port->write_urb->pipe);
@@ -473,18 +472,11 @@
 
 static void pl2303_close (struct usb_serial_port *port, struct file *filp)
 {
-	struct usb_serial *serial;
 	struct pl2303_private *priv;
 	unsigned long flags;
 	unsigned int c_cflag;
 	int result;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	/* shutdown our urbs */
@@ -661,7 +653,6 @@
 static void pl2303_read_int_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct pl2303_private *priv = usb_get_serial_port_data(port);
 	unsigned char *data = urb->transfer_buffer;
 	unsigned long flags;
@@ -685,9 +676,6 @@
 		goto exit;
 	}
 
-	if (!serial) {
-		return;
-	}
 
 	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, urb->transfer_buffer);
 
@@ -712,7 +700,6 @@
 static void pl2303_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct pl2303_private *priv = usb_get_serial_port_data(port);
 	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
@@ -722,16 +709,8 @@
 	u8 status;
 	char tty_flag;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - urb->status = %d", __FUNCTION__, urb->status);
 		if (!port->open_count) {
@@ -742,7 +721,7 @@
 			/* PL2303 mysteriously fails with -EPROTO reschedule the read */
 			dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__);
 			urb->status = 0;
-			urb->dev = serial->dev;
+			urb->dev = port->serial->dev;
 			result = usb_submit_urb(urb, GFP_ATOMIC);
 			if (result)
 				dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
@@ -790,7 +769,7 @@
 
 	/* Schedule the next read _if_ we are still open */
 	if (port->open_count) {
-		urb->dev = serial->dev;
+		urb->dev = port->serial->dev;
 		result = usb_submit_urb(urb, GFP_ATOMIC);
 		if (result)
 			dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result);
@@ -806,16 +785,10 @@
 	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
 	int result;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
 	if (urb->status) {
 		/* error in the urb, so we have to resubmit it */
-		if (serial_paranoia_check (port->serial, __FUNCTION__)) {
-			return;
-		}
 		dbg("%s - Overflow in write", __FUNCTION__);
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
 		port->write_urb->transfer_buffer_length = 1;
@@ -862,6 +835,6 @@
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(debug, "i");
+module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
 
diff -Nru a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
--- a/drivers/usb/serial/pl2303.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/serial/pl2303.h	Tue Jun 15 22:20:41 2004
@@ -41,3 +41,6 @@
 
 #define SITECOM_VENDOR_ID	0x6189
 #define SITECOM_PRODUCT_ID	0x2068
+
+#define ALCATEL_VENDOR_ID	0x11f7
+#define ALCATEL_PRODUCT_ID	0x02df
diff -Nru a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
--- a/drivers/usb/serial/safe_serial.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/serial/safe_serial.c	Tue Jun 15 22:20:38 2004
@@ -211,7 +211,6 @@
 static void safe_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	unsigned char *data = urb->transfer_buffer;
 	unsigned char length = urb->actual_length;
 	int i;
@@ -219,11 +218,6 @@
 
 	dbg ("%s", __FUNCTION__);
 
-	if (!serial) {
-		dbg ("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg ("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		return;
@@ -272,8 +266,8 @@
 	}
 
 	/* Continue trying to always read  */
-	usb_fill_bulk_urb (urb, serial->dev,
-		       usb_rcvbulkpipe (serial->dev, port->bulk_in_endpointAddress),
+	usb_fill_bulk_urb (urb, port->serial->dev,
+		       usb_rcvbulkpipe (port->serial->dev, port->bulk_in_endpointAddress),
 		       urb->transfer_buffer, urb->transfer_buffer_length,
 		       safe_read_bulk_callback, port);
 
@@ -284,7 +278,6 @@
 
 static int safe_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
 {
-	struct usb_serial *serial = port->serial;
 	unsigned char *data;
 	int result;
 	int i;
@@ -367,7 +360,7 @@
 		printk ("\n");
 	}
 #endif
-	port->write_urb->dev = serial->dev;
+	port->write_urb->dev = port->serial->dev;
 	if ((result = usb_submit_urb (port->write_urb, GFP_KERNEL))) {
 		err ("%s - failed submitting write urb, error %d", __FUNCTION__, result);
 		return 0;
@@ -395,7 +388,7 @@
 
 static int safe_startup (struct usb_serial *serial)
 {
-	switch (serial->interface->altsetting->desc.bInterfaceProtocol) {
+	switch (serial->interface->cur_altsetting->desc.bInterfaceProtocol) {
 	case LINEO_SAFESERIAL_CRC:
 		break;
 	case LINEO_SAFESERIAL_CRC_PADDED:
diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/usb/serial/usb-serial.c	Tue Jun 15 22:20:39 2004
@@ -1,7 +1,7 @@
 /*
  * USB Serial Converter driver
  *
- * Copyright (C) 1999 - 2003 Greg Kroah-Hartman (greg@kroah.com)
+ * Copyright (C) 1999 - 2004 Greg Kroah-Hartman (greg@kroah.com)
  * Copyright (C) 2000 Peter Berger (pberger@brimson.com)
  * Copyright (C) 2000 Al Borchers (borchers@steinerpoint.com)
  *
@@ -330,6 +330,7 @@
 #include <linux/tty_driver.h>
 #include <linux/tty_flip.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
 #include <linux/smp_lock.h>
@@ -416,8 +417,7 @@
 			}
 		if (good_spot == 0)
 			continue;
-			
-		serial->magic = USB_SERIAL_MAGIC;
+
 		*minor = i;
 		dbg("%s - minor base = %d", __FUNCTION__, *minor);
 		for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i)
@@ -460,9 +460,10 @@
 
 	/* get the serial object associated with this tty pointer */
 	serial = usb_serial_get_by_index(tty->index);
-
-	if (serial_paranoia_check (serial, __FUNCTION__))
-		return -ENODEV;
+	if (!serial) {
+		retval = -ENODEV;
+		goto bailout;
+	}
 
 	/* set up our port structure making the tty driver remember our port object, and us it */
 	portNumber = tty->index - serial->minor;
@@ -496,9 +497,8 @@
 static void serial_close(struct tty_struct *tty, struct file * filp)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 
-	if (!serial)
+	if (!port)
 		return;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
@@ -524,12 +524,8 @@
 static int serial_write (struct tty_struct * tty, int from_user, const unsigned char *buf, int count)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	int retval = -EINVAL;
 
-	if (!serial)
-		return -ENODEV;
-
 	dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count);
 
 	if (!port->open_count) {
@@ -538,7 +534,7 @@
 	}
 
 	/* pass on to the driver specific version of this function */
-	retval = serial->type->write(port, from_user, buf, count);
+	retval = port->serial->type->write(port, from_user, buf, count);
 
 exit:
 	return retval;
@@ -547,12 +543,8 @@
 static int serial_write_room (struct tty_struct *tty) 
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	int retval = -EINVAL;
 
-	if (!serial)
-		return -ENODEV;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (!port->open_count) {
@@ -561,7 +553,7 @@
 	}
 
 	/* pass on to the driver specific version of this function */
-	retval = serial->type->write_room(port);
+	retval = port->serial->type->write_room(port);
 
 exit:
 	return retval;
@@ -570,12 +562,8 @@
 static int serial_chars_in_buffer (struct tty_struct *tty) 
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	int retval = -EINVAL;
 
-	if (!serial)
-		return -ENODEV;
-
 	dbg("%s = port %d", __FUNCTION__, port->number);
 
 	if (!port->open_count) {
@@ -584,7 +572,7 @@
 	}
 
 	/* pass on to the driver specific version of this function */
-	retval = serial->type->chars_in_buffer(port);
+	retval = port->serial->type->chars_in_buffer(port);
 
 exit:
 	return retval;
@@ -593,10 +581,6 @@
 static void serial_throttle (struct tty_struct * tty)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-
-	if (!serial)
-		return;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -606,8 +590,8 @@
 	}
 
 	/* pass on to the driver specific version of this function */
-	if (serial->type->throttle)
-		serial->type->throttle(port);
+	if (port->serial->type->throttle)
+		port->serial->type->throttle(port);
 
 exit:
 	;
@@ -616,10 +600,6 @@
 static void serial_unthrottle (struct tty_struct * tty)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-
-	if (!serial)
-		return;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -629,8 +609,8 @@
 	}
 
 	/* pass on to the driver specific version of this function */
-	if (serial->type->unthrottle)
-		serial->type->unthrottle(port);
+	if (port->serial->type->unthrottle)
+		port->serial->type->unthrottle(port);
 
 exit:
 	;
@@ -639,12 +619,8 @@
 static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	int retval = -ENODEV;
 
-	if (!serial)
-		return -ENODEV;
-
 	dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd);
 
 	if (!port->open_count) {
@@ -653,8 +629,8 @@
 	}
 
 	/* pass on to the driver specific version of this function if it is available */
-	if (serial->type->ioctl)
-		retval = serial->type->ioctl(port, file, cmd, arg);
+	if (port->serial->type->ioctl)
+		retval = port->serial->type->ioctl(port, file, cmd, arg);
 	else
 		retval = -ENOIOCTLCMD;
 
@@ -665,10 +641,6 @@
 static void serial_set_termios (struct tty_struct *tty, struct termios * old)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-
-	if (!serial)
-		return;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -678,8 +650,8 @@
 	}
 
 	/* pass on to the driver specific version of this function if it is available */
-	if (serial->type->set_termios)
-		serial->type->set_termios(port, old);
+	if (port->serial->type->set_termios)
+		port->serial->type->set_termios(port, old);
 
 exit:
 	;
@@ -688,10 +660,6 @@
 static void serial_break (struct tty_struct *tty, int break_state)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-
-	if (!serial)
-		return;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -701,8 +669,8 @@
 	}
 
 	/* pass on to the driver specific version of this function if it is available */
-	if (serial->type->break_ctl)
-		serial->type->break_ctl(port, break_state);
+	if (port->serial->type->break_ctl)
+		port->serial->type->break_ctl(port, break_state);
 
 exit:
 	;
@@ -761,10 +729,6 @@
 static int serial_tiocmget (struct tty_struct *tty, struct file *file)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-
-	if (!serial)
-		goto exit;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -773,8 +737,8 @@
 		goto exit;
 	}
 
-	if (serial->type->tiocmget)
-		return serial->type->tiocmget(port, file);
+	if (port->serial->type->tiocmget)
+		return port->serial->type->tiocmget(port, file);
 
 exit:
 	return -EINVAL;
@@ -784,10 +748,6 @@
 			    unsigned int set, unsigned int clear)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
-
-	if (!serial)
-		goto exit;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -796,8 +756,8 @@
 		goto exit;
 	}
 
-	if (serial->type->tiocmset)
-		return serial->type->tiocmset(port, file, set, clear);
+	if (port->serial->type->tiocmset)
+		return port->serial->type->tiocmset(port, file, set, clear);
 
 exit:
 	return -EINVAL;
@@ -806,7 +766,6 @@
 void usb_serial_port_softint(void *private)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)private;
-	struct usb_serial *serial;
 	struct tty_struct *tty;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
@@ -814,10 +773,6 @@
 	if (!port)
 		return;
 
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-
 	tty = port->tty;
 	if (!tty)
 		return;
@@ -1037,7 +992,7 @@
 	     (dev->descriptor.idProduct == ATEN_PRODUCT_ID))) {
 		if (interface != dev->actconfig->interface[0]) {
 			/* check out the endpoints of the other interface*/
-			iface_desc = &dev->actconfig->interface[0]->altsetting[0];
+			iface_desc = dev->actconfig->interface[0]->cur_altsetting;
 			for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
 				endpoint = &iface_desc->endpoint[i].desc;
 				if ((endpoint->bEndpointAddress & 0x80) &&
@@ -1117,7 +1072,6 @@
 		memset(port, 0x00, sizeof(struct usb_serial_port));
 		port->number = i + serial->minor;
 		port->serial = serial;
-		port->magic = USB_SERIAL_PORT_MAGIC;
 		INIT_WORK(&port->work, usb_serial_port_softint, port);
 		serial->port[i] = port;
 	}
@@ -1463,5 +1417,5 @@
 MODULE_DESCRIPTION( DRIVER_DESC );
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(debug, "i");
+module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
diff -Nru a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
--- a/drivers/usb/serial/usb-serial.h	Tue Jun 15 22:21:05 2004
+++ b/drivers/usb/serial/usb-serial.h	Tue Jun 15 22:21:05 2004
@@ -1,7 +1,7 @@
 /*
  * USB Serial Converter driver
  *
- *	Copyright (C) 1999 - 2003
+ *	Copyright (C) 1999 - 2004
  *	    Greg Kroah-Hartman (greg@kroah.com)
  *
  *	This program is free software; you can redistribute it and/or modify
@@ -62,15 +62,11 @@
 
 #define MAX_NUM_PORTS		8	/* The maximum number of ports one device can grab at once */
 
-#define USB_SERIAL_MAGIC	0x6702	/* magic number for usb_serial struct */
-#define USB_SERIAL_PORT_MAGIC	0x7301	/* magic number for usb_serial_port struct */
-
 /* parity check flag */
 #define RELEVANT_IFLAG(iflag)	(iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
 
 /**
  * usb_serial_port: structure for the specific ports of a device.
- * @magic: magic number for internal validity of this pointer.
  * @serial: pointer back to the struct usb_serial owner of this port.
  * @tty: pointer to the corresponding tty for this port.
  * @number: the number of the port (the minor number).
@@ -95,8 +91,7 @@
  * ports of a device.
  */
 struct usb_serial_port {
-	int			magic;
-	struct usb_serial	*serial;
+	struct usb_serial *	serial;
 	struct tty_struct *	tty;
 	unsigned char		number;
 
@@ -133,7 +128,6 @@
 
 /**
  * usb_serial - structure used by the usb-serial core for a device
- * @magic: magic number for internal validity of this pointer.
  * @dev: pointer to the struct usb_device for this device
  * @type: pointer to the struct usb_serial_device_type for this device
  * @interface: pointer to the struct usb_interface for this device
@@ -151,7 +145,6 @@
  *	usb_set_serial_data() to access this.
  */
 struct usb_serial {
-	int				magic;
 	struct usb_device *		dev;
 	struct usb_serial_device_type *	type;
 	struct usb_interface *		interface;
@@ -300,60 +293,6 @@
 extern struct usb_serial_device_type usb_serial_generic_device;
 extern struct bus_type usb_serial_bus_type;
 extern struct tty_driver *usb_serial_tty_driver;
-
-/* Inline functions to check the sanity of a pointer that is passed to us */
-static inline int serial_paranoia_check (struct usb_serial *serial, const char *function)
-{
-	if (!serial) {
-		dbg("%s - serial == NULL", function);
-		return -1;
-	}
-	if (serial->magic != USB_SERIAL_MAGIC) {
-		dbg("%s - bad magic number for serial", function);
-		return -1;
-	}
-	if (!serial->type) {
-		dbg("%s - serial->type == NULL!", function);
-		return -1;
-	}
-
-	return 0;
-}
-
-
-static inline int port_paranoia_check (struct usb_serial_port *port, const char *function)
-{
-	if (!port) {
-		dbg("%s - port == NULL", function);
-		return -1;
-	}
-	if (port->magic != USB_SERIAL_PORT_MAGIC) {
-		dbg("%s - bad magic number for port", function);
-		return -1;
-	}
-	if (!port->serial) {
-		dbg("%s - port->serial == NULL", function);
-		return -1;
-	}
-
-	return 0;
-}
-
-
-static inline struct usb_serial* get_usb_serial (struct usb_serial_port *port, const char *function) 
-{ 
-	/* if no port was specified, or it fails a paranoia check */
-	if (!port || 
-		port_paranoia_check (port, function) ||
-		serial_paranoia_check (port->serial, function)) {
-		/* then say that we don't have a valid usb_serial thing, which will
-		 * end up genrating -ENODEV return values */ 
-		return NULL;
-	}
-
-	return port->serial;
-}
-
 
 static inline void usb_serial_debug_data (const char *file, const char *function, int size, const unsigned char *data)
 {
diff -Nru a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
--- a/drivers/usb/serial/visor.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/serial/visor.c	Tue Jun 15 22:20:38 2004
@@ -2,7 +2,7 @@
  * USB HandSpring Visor, Palm m50x, and Sony Clie driver
  * (supports all of the Palm OS USB devices)
  *
- *	Copyright (C) 1999 - 2003
+ *	Copyright (C) 1999 - 2004
  *	    Greg Kroah-Hartman (greg@kroah.com)
  *
  *	This program is free software; you can redistribute it and/or modify
@@ -151,6 +151,7 @@
 #include <linux/tty_driver.h>
 #include <linux/tty_flip.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
@@ -194,8 +195,8 @@
 static int palm_os_4_probe (struct usb_serial *serial, const struct usb_device_id *id);
 
 /* Parameters that may be passed into the module. */
-static int vendor = -1;
-static int product = -1;
+static __u16 vendor;
+static __u16 product;
 
 static struct usb_device_id id_table [] = {
 	{ USB_DEVICE(HANDSPRING_VENDOR_ID, HANDSPRING_VISOR_ID),
@@ -222,6 +223,8 @@
 		.driver_info = (kernel_ulong_t)&palm_os_4_probe },
 	{ USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID),
 		.driver_info = (kernel_ulong_t)&palm_os_4_probe },
+	{ USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID),
+		.driver_info = (kernel_ulong_t)&palm_os_4_probe },
 	{ USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID),
 		.driver_info = (kernel_ulong_t)&palm_os_4_probe },
 	{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID),
@@ -273,6 +276,7 @@
 	{ USB_DEVICE(PALM_VENDOR_ID, PALM_M130_ID) },
 	{ USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID) },
 	{ USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID) },
+	{ USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID) },
 	{ USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID) },
 	{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_3_5_ID) },
 	{ USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID) },
@@ -393,9 +397,6 @@
 	struct usb_serial *serial = port->serial;
 	int result = 0;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return -ENODEV;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
 	if (!port->read_urb) {
@@ -443,18 +444,10 @@
 
 static void visor_close (struct usb_serial_port *port, struct file * filp)
 {
-	struct usb_serial *serial;
 	unsigned char *transfer_buffer;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 			 
-	serial = get_usb_serial (port, __FUNCTION__);
-	if (!serial)
-		return;
-	
 	/* shutdown our urbs */
 	usb_unlink_urb (port->read_urb);
 	if (port->interrupt_in_urb)
@@ -463,8 +456,8 @@
 	/* Try to send shutdown message, if the device is gone, this will just fail. */
 	transfer_buffer =  kmalloc (0x12, GFP_KERNEL);
 	if (transfer_buffer) {
-		usb_control_msg (serial->dev,
-				 usb_rcvctrlpipe(serial->dev, 0),
+		usb_control_msg (port->serial->dev,
+				 usb_rcvctrlpipe(port->serial->dev, 0),
 				 VISOR_CLOSE_NOTIFICATION, 0xc2,
 				 0x0000, 0x0000, 
 				 transfer_buffer, 0x12, 300);
@@ -568,9 +561,6 @@
 	/* free up the transfer buffer, as usb_free_urb() does not do this */
 	kfree (urb->transfer_buffer);
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-	
 	dbg("%s - port %d", __FUNCTION__, port->number);
 	
 	if (urb->status)
@@ -584,22 +574,13 @@
 static void visor_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct tty_struct *tty;
 	unsigned char *data = urb->transfer_buffer;
 	int i;
 	int result;
 
-	if (port_paranoia_check (port, __FUNCTION__))
-		return;
-
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		return;
@@ -622,9 +603,9 @@
 	bytes_in += urb->actual_length;
 
 	/* Continue trying to always read  */
-	usb_fill_bulk_urb (port->read_urb, serial->dev,
-			   usb_rcvbulkpipe (serial->dev,
-					    port->bulk_in_endpointAddress),
+	usb_fill_bulk_urb (port->read_urb, port->serial->dev,
+			   usb_rcvbulkpipe(port->serial->dev,
+					   port->bulk_in_endpointAddress),
 			   port->read_urb->transfer_buffer,
 			   port->read_urb->transfer_buffer_length,
 			   visor_read_bulk_callback, port);
@@ -699,7 +680,7 @@
 	char *string;
 	int retval = 0;
 	int i;
-	int num_ports;
+	int num_ports = 0;
 
 	dbg("%s", __FUNCTION__);
 
@@ -721,41 +702,50 @@
 			__FUNCTION__, retval);
 		goto exit;
 	}
-		
-	connection_info = (struct visor_connection_info *)transfer_buffer;
 
-	le16_to_cpus(&connection_info->num_ports);
-	num_ports = connection_info->num_ports;
-	/* handle devices that report invalid stuff here */
-	if (num_ports > 2)
-		num_ports = 2;
-	dev_info(dev, "%s: Number of ports: %d\n", serial->type->name,
-		connection_info->num_ports);
+	if (retval == sizeof(*connection_info)) {
+	        connection_info = (struct visor_connection_info *)transfer_buffer;
 
-	for (i = 0; i < num_ports; ++i) {
-		switch (connection_info->connections[i].port_function_id) {
-			case VISOR_FUNCTION_GENERIC:
-				string = "Generic";
-				break;
-			case VISOR_FUNCTION_DEBUGGER:
-				string = "Debugger";
-				break;
-			case VISOR_FUNCTION_HOTSYNC:
-				string = "HotSync";
-				break;
-			case VISOR_FUNCTION_CONSOLE:
-				string = "Console";
-				break;
-			case VISOR_FUNCTION_REMOTE_FILE_SYS:
-				string = "Remote File System";
-				break;
-			default:
-				string = "unknown";
-				break;	
+		le16_to_cpus(&connection_info->num_ports);
+		num_ports = connection_info->num_ports;
+
+		for (i = 0; i < num_ports; ++i) {
+			switch (connection_info->connections[i].port_function_id) {
+				case VISOR_FUNCTION_GENERIC:
+					string = "Generic";
+					break;
+				case VISOR_FUNCTION_DEBUGGER:
+					string = "Debugger";
+					break;
+				case VISOR_FUNCTION_HOTSYNC:
+					string = "HotSync";
+					break;
+				case VISOR_FUNCTION_CONSOLE:
+					string = "Console";
+					break;
+				case VISOR_FUNCTION_REMOTE_FILE_SYS:
+					string = "Remote File System";
+					break;
+				default:
+					string = "unknown";
+					break;
+			}
+			dev_info(dev, "%s: port %d, is for %s use\n",
+				serial->type->name,
+				connection_info->connections[i].port, string);
 		}
-		dev_info(dev, "%s: port %d, is for %s use\n", serial->type->name,
-			 connection_info->connections[i].port, string);
 	}
+	/*
+	* Handle devices that report invalid stuff here.
+	*/
+	if (num_ports == 0 || num_ports > 2) {
+		dev_warn (dev, "%s: No valid connect info available\n",
+			serial->type->name);
+		num_ports = 2;
+	}
+  
+	dev_info(dev, "%s: Number of ports: %d\n", serial->type->name,
+		num_ports);
 
 	/*
 	 * save off our num_ports info so that we can use it in the
@@ -887,8 +877,7 @@
  
 static int treo_attach (struct usb_serial *serial)
 {
-	struct usb_serial_port *port;
-	int i;
+	struct usb_serial_port *swap_port;
 
 	/* Only do this endpoint hack for the Handspring devices with
 	 * interrupt in endpoints, which for now are the Treo devices. */
@@ -898,31 +887,28 @@
 
 	dbg("%s", __FUNCTION__);
 
-	/* Ok, this is pretty ugly, but these devices want to use the
-	 * interrupt endpoint as paired up with a bulk endpoint for a
-	 * "virtual serial port".  So let's force the endpoints to be
-	 * where we want them to be. */
-	for (i = serial->num_bulk_in; i < serial->num_ports; ++i) {
-		port = serial->port[i];
-		port->read_urb = serial->port[0]->read_urb;
-		port->bulk_in_endpointAddress = serial->port[0]->bulk_in_endpointAddress;
-		port->bulk_in_buffer = serial->port[0]->bulk_in_buffer;
-	}
-
-	for (i = serial->num_bulk_out; i < serial->num_ports; ++i) {
-		port = serial->port[i];
-		port->write_urb = serial->port[0]->write_urb;
-		port->bulk_out_size = serial->port[0]->bulk_out_size;
-		port->bulk_out_endpointAddress = serial->port[0]->bulk_out_endpointAddress;
-		port->bulk_out_buffer = serial->port[0]->bulk_out_buffer;
-	}
-
-	for (i = serial->num_interrupt_in; i < serial->num_ports; ++i) {
-		port = serial->port[i];
-		port->interrupt_in_urb = serial->port[0]->interrupt_in_urb;
-		port->interrupt_in_endpointAddress = serial->port[0]->interrupt_in_endpointAddress;
-		port->interrupt_in_buffer = serial->port[0]->interrupt_in_buffer;
-	}
+	/*
+	* It appears that Treos want to use the 1st interrupt endpoint to
+	* communicate with the 2nd bulk out endpoint, so let's swap the 1st
+	* and 2nd bulk in and interrupt endpoints.  Note that swapping the
+	* bulk out endpoints would break lots of apps that want to communicate
+	* on the second port.
+	*/
+#define COPY_PORT(dest, src)						\
+	dest->read_urb = src->read_urb;					\
+	dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress;	\
+	dest->bulk_in_buffer = src->bulk_in_buffer;			\
+	dest->interrupt_in_urb = src->interrupt_in_urb;			\
+	dest->interrupt_in_endpointAddress = src->interrupt_in_endpointAddress;	\
+	dest->interrupt_in_buffer = src->interrupt_in_buffer;
+
+	swap_port = kmalloc(sizeof(*swap_port), GFP_KERNEL);
+	if (!swap_port)
+		return -ENOMEM;
+	COPY_PORT(swap_port, serial->port[0]);
+	COPY_PORT(serial->port[0], serial->port[1]);
+	COPY_PORT(serial->port[1], swap_port);
+	kfree(swap_port);
 
 	return 0;
 }
@@ -1099,10 +1085,10 @@
 MODULE_DESCRIPTION( DRIVER_DESC );
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(debug, "i");
+module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
 
-MODULE_PARM(vendor, "i");
+module_param(vendor, ushort, 0);
 MODULE_PARM_DESC(vendor, "User specified vendor ID");
-MODULE_PARM(product, "i");
+module_param(product, ushort, 0);
 MODULE_PARM_DESC(product, "User specified product ID");
diff -Nru a/drivers/usb/serial/visor.h b/drivers/usb/serial/visor.h
--- a/drivers/usb/serial/visor.h	Tue Jun 15 22:20:44 2004
+++ b/drivers/usb/serial/visor.h	Tue Jun 15 22:20:44 2004
@@ -31,6 +31,7 @@
 #define PALM_M130_ID			0x0050
 #define PALM_TUNGSTEN_T_ID		0x0060
 #define PALM_TUNGSTEN_Z_ID		0x0031
+#define PALM_ZIRE31_ID			0x0061
 #define PALM_ZIRE_ID			0x0070
 #define PALM_M100_ID			0x0080
 
diff -Nru a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
--- a/drivers/usb/serial/whiteheat.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/usb/serial/whiteheat.c	Tue Jun 15 22:20:39 2004
@@ -984,7 +984,6 @@
 static void command_port_read_callback (struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *command_port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (command_port, __FUNCTION__);
 	struct whiteheat_command_private *command_info;
 	unsigned char *data = urb->transfer_buffer;
 	int result;
@@ -997,11 +996,6 @@
 		return;
 	}
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
-	
 	usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
 
 	command_info = usb_get_serial_port_data(command_port);
@@ -1029,7 +1023,7 @@
 	}
 	
 	/* Continue trying to always read */
-	command_port->read_urb->dev = serial->dev;
+	command_port->read_urb->dev = command_port->serial->dev;
 	result = usb_submit_urb(command_port->read_urb, GFP_ATOMIC);
 	spin_unlock_irqrestore(&command_info->lock, flags);
 	if (result)
@@ -1040,7 +1034,6 @@
 static void whiteheat_read_callback(struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct whiteheat_urb_wrap *wrap;
 	unsigned char *data = urb->transfer_buffer;
 	struct whiteheat_private *info = usb_get_serial_port_data(port);
@@ -1057,14 +1050,6 @@
 	list_del(&wrap->list);
 	spin_unlock(&info->lock);
 
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		spin_lock(&info->lock);
-		list_add(&wrap->list, &info->rx_urbs_free);
-		spin_unlock(&info->lock);
-		return;
-	}
-
 	if (urb->status) {
 		dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status);
 		spin_lock(&info->lock);
@@ -1091,7 +1076,6 @@
 static void whiteheat_write_callback(struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
 	struct whiteheat_private *info = usb_get_serial_port_data(port);
 	struct whiteheat_urb_wrap *wrap;
 
@@ -1107,11 +1091,6 @@
 	list_del(&wrap->list);
 	list_add(&wrap->list, &info->tx_urbs_free);
 	spin_unlock(&info->lock);
-
-	if (!serial) {
-		dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-		return;
-	}
 
 	if (urb->status) {
 		dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
diff -Nru a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
--- a/drivers/usb/storage/datafab.c	Tue Jun 15 22:21:04 2004
+++ b/drivers/usb/storage/datafab.c	Tue Jun 15 22:21:04 2004
@@ -321,7 +321,7 @@
 			goto leave;
 		}
 
-		wait_ms(20);
+		msleep(20);
 	}
 
 	rc = USB_STOR_TRANSPORT_ERROR;
@@ -489,7 +489,7 @@
 	return USB_STOR_TRANSPORT_GOOD;
 }
 
-void datafab_info_destructor(void *extra)
+static void datafab_info_destructor(void *extra)
 {
 	// this routine is a placeholder...
 	// currently, we don't allocate any extra memory so we're okay
diff -Nru a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
--- a/drivers/usb/storage/isd200.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/storage/isd200.c	Tue Jun 15 22:20:40 2004
@@ -349,7 +349,7 @@
  * RETURNS:
  *    void
  */
-void isd200_build_sense(struct us_data *us, Scsi_Cmnd *srb)
+static void isd200_build_sense(struct us_data *us, Scsi_Cmnd *srb)
 {
 	struct isd200_info *info = (struct isd200_info *)us->extra;
 	struct sense_data *buf = (struct sense_data *) &srb->sense_buffer[0];
@@ -505,7 +505,7 @@
  * RETURNS:
  *    ISD status code
  */
-int isd200_read_regs( struct us_data *us )
+static int isd200_read_regs( struct us_data *us )
 {
 	struct isd200_info *info = (struct isd200_info *)us->extra;
 	int retStatus = ISD200_GOOD;
@@ -534,7 +534,7 @@
  * This is used by the protocol layers to actually send the message to
  * the device and receive the response.
  */
-void isd200_invoke_transport( struct us_data *us, 
+static void isd200_invoke_transport( struct us_data *us, 
 			      Scsi_Cmnd *srb, 
 			      union ata_cdb *ataCdb )
 {
@@ -677,7 +677,7 @@
  * RETURNS:
  *    ISD status code
  */
-int isd200_write_config( struct us_data *us ) 
+static int isd200_write_config( struct us_data *us ) 
 {
 	struct isd200_info *info = (struct isd200_info *)us->extra;
 	int retStatus = ISD200_GOOD;
@@ -720,7 +720,7 @@
  * RETURNS:
  *    ISD status code
  */
-int isd200_read_config( struct us_data *us ) 
+static int isd200_read_config( struct us_data *us ) 
 {
 	struct isd200_info *info = (struct isd200_info *)us->extra;
 	int retStatus = ISD200_GOOD;
@@ -765,7 +765,7 @@
  * RETURNS:
  *    NT status code
  */
-int isd200_atapi_soft_reset( struct us_data *us ) 
+static int isd200_atapi_soft_reset( struct us_data *us ) 
 {
 	int retStatus = ISD200_GOOD;
 	int transferStatus;
@@ -791,7 +791,7 @@
  * RETURNS:
  *    ISD status code
  */
-int isd200_srst( struct us_data *us ) 
+static int isd200_srst( struct us_data *us ) 
 {
 	int retStatus = ISD200_GOOD;
 	int transferStatus;
@@ -806,7 +806,7 @@
 		retStatus = ISD200_ERROR;
 	} else {
 		/* delay 10ms to give the drive a chance to see it */
-		wait_ms(10);
+		msleep(10);
 
 		transferStatus = isd200_action( us, ACTION_REENABLE, NULL, 0 );
 		if (transferStatus != ISD200_TRANSPORT_GOOD) {
@@ -814,7 +814,7 @@
 			retStatus = ISD200_ERROR;
 		} else {
 			/* delay 50ms to give the drive a chance to recover after SRST */
-			wait_ms(50);
+			msleep(50);
 		}
 	}
 
@@ -937,7 +937,7 @@
  * RETURNS:
  *    ISD status code
  */
-int isd200_manual_enum(struct us_data *us)
+static int isd200_manual_enum(struct us_data *us)
 {
 	struct isd200_info *info = (struct isd200_info *)us->extra;
 	int retStatus = ISD200_GOOD;
@@ -981,7 +981,7 @@
  * RETURNS:
  *    ISD status code
  */
-int isd200_get_inquiry_data( struct us_data *us )
+static int isd200_get_inquiry_data( struct us_data *us )
 {
 	struct isd200_info *info = (struct isd200_info *)us->extra;
 	int retStatus = ISD200_GOOD;
@@ -1124,8 +1124,8 @@
  *    TRUE if the command needs to be sent to the transport layer
  *    FALSE otherwise
  */
-int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us, 
-		       union ata_cdb * ataCdb)
+static int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
+			      union ata_cdb * ataCdb)
 {
 	struct isd200_info *info = (struct isd200_info *)us->extra;
 	struct hd_driveid *id = info->id;
@@ -1339,7 +1339,7 @@
  *
  * Frees the driver structure.
  */
-void isd200_free_info_ptrs(void *info_)
+static void isd200_free_info_ptrs(void *info_)
 {
 	struct isd200_info *info = (struct isd200_info *) info_;
 
@@ -1357,7 +1357,7 @@
  * RETURNS:
  *    ISD status code
  */
-int isd200_init_info(struct us_data *us)
+static int isd200_init_info(struct us_data *us)
 {
 	int retStatus = ISD200_GOOD;
 	struct isd200_info *info;
diff -Nru a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
--- a/drivers/usb/storage/jumpshot.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/storage/jumpshot.c	Tue Jun 15 22:20:36 2004
@@ -253,7 +253,7 @@
 			if (result != USB_STOR_TRANSPORT_GOOD) {
 				// I have not experimented to find the smallest value.
 				//
-				wait_ms(50); 
+				msleep(50); 
 			}
 		} while ((result != USB_STOR_TRANSPORT_GOOD) && (waitcount < 10));
 
@@ -416,7 +416,7 @@
 }
 
 
-void jumpshot_info_destructor(void *extra)
+static void jumpshot_info_destructor(void *extra)
 {
 	// this routine is a placeholder...
 	// currently, we don't allocate any extra blocks so we're okay
diff -Nru a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
--- a/drivers/usb/storage/scsiglue.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/usb/storage/scsiglue.c	Tue Jun 15 22:20:40 2004
@@ -159,14 +159,18 @@
 		return FAILED;
 	}
 
-	/* Set state to ABORTING, set the ABORTING bit, and release the lock */
+	/* Set state to ABORTING and set the ABORTING bit, but only if
+	 * a device reset isn't already in progress (to avoid interfering
+	 * with the reset).  To prevent races with auto-reset, we must
+	 * stop any ongoing USB transfers while still holding the host
+	 * lock. */
 	us->sm_state = US_STATE_ABORTING;
-	set_bit(US_FLIDX_ABORTING, &us->flags);
+	if (!test_bit(US_FLIDX_RESETTING, &us->flags)) {
+		set_bit(US_FLIDX_ABORTING, &us->flags);
+		usb_stor_stop_transport(us);
+	}
 	scsi_unlock(host);
 
-	/* Stop an ongoing USB transfer */
-	usb_stor_stop_transport(us);
-
 	/* Wait for the aborted command to finish */
 	wait_for_completion(&us->notify);
 
@@ -254,18 +258,17 @@
 }
 
 /* Report a driver-initiated device reset to the SCSI layer.
- * Calling this for a SCSI-initiated reset is unnecessary but harmless. */
+ * Calling this for a SCSI-initiated reset is unnecessary but harmless.
+ * The caller must own the SCSI host lock. */
 void usb_stor_report_device_reset(struct us_data *us)
 {
 	int i;
 
-	scsi_lock(us->host);
 	scsi_report_device_reset(us->host, 0, 0);
 	if (us->flags & US_FL_SCM_MULT_TARG) {
 		for (i = 1; i < us->host->max_id; ++i)
 			scsi_report_device_reset(us->host, 0, i);
 	}
-	scsi_unlock(us->host);
 }
 
 /***********************************************************************
diff -Nru a/drivers/usb/storage/scsiglue.h b/drivers/usb/storage/scsiglue.h
--- a/drivers/usb/storage/scsiglue.h	Tue Jun 15 22:20:41 2004
+++ b/drivers/usb/storage/scsiglue.h	Tue Jun 15 22:20:41 2004
@@ -43,7 +43,7 @@
 
 #include <linux/blkdev.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 #include "usb.h"
 
 extern void usb_stor_report_device_reset(struct us_data *us);
diff -Nru a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
--- a/drivers/usb/storage/shuttle_usbat.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/usb/storage/shuttle_usbat.c	Tue Jun 15 22:20:36 2004
@@ -55,11 +55,11 @@
 
 int transferred = 0;
 
-int usbat_read(struct us_data *us,
-	     unsigned char access,
-	     unsigned char reg, 
-	     unsigned char *content) {
-
+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,
@@ -74,11 +74,11 @@
 	return result;
 }
 
-int usbat_write(struct us_data *us,
-	     unsigned char access,
-	     unsigned char reg, 
-	     unsigned char content) {
-
+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,
@@ -93,14 +93,14 @@
 	return result;
 }
 
-int usbat_set_shuttle_features(struct us_data *us,
-	     unsigned char external_trigger,
-	     unsigned char epp_control, 
-	     unsigned char mask_byte, 
-	     unsigned char test_pattern, 
-	     unsigned char subcountH, 
-	     unsigned char subcountL) {
-
+static int usbat_set_shuttle_features(struct us_data *us,
+				      unsigned char external_trigger,
+				      unsigned char epp_control,
+				      unsigned char mask_byte,
+				      unsigned char test_pattern,
+				      unsigned char subcountH,
+				      unsigned char subcountL)
+{
 	int result;
 	unsigned char *command = us->iobuf;
 
@@ -125,13 +125,13 @@
 	return result;
 }
 
-int usbat_read_block(struct us_data *us,
-	     unsigned char access,
-	     unsigned char reg, 
-	     unsigned char *content,
-	     unsigned short len,
-	     int use_sg) {
-
+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;
 
@@ -171,8 +171,8 @@
  * an error condition.
  */
 
-int usbat_wait_not_busy(struct us_data *us, int minutes) {
-
+static int usbat_wait_not_busy(struct us_data *us, int minutes)
+{
 	int i;
 	int result;
 	unsigned char *status = us->iobuf;
@@ -202,13 +202,13 @@
 		}
 
 		if (i<500)
-			wait_ms(10); // 5 seconds
+			msleep(10); // 5 seconds
 		else if (i<700)
-			wait_ms(50); // 10 seconds
+			msleep(50); // 10 seconds
 		else if (i<1200)
-			wait_ms(100); // 50 seconds
+			msleep(100); // 50 seconds
 		else
-			wait_ms(1000); // X minutes
+			msleep(1000); // X minutes
 	}
 
 	US_DEBUGP("Waited not busy for %d minutes, timing out.\n",
@@ -216,14 +216,13 @@
 	return USB_STOR_TRANSPORT_FAILED;
 }
 
-int usbat_write_block(struct us_data *us,
-	     unsigned char access,
-	     unsigned char reg, 
-	     unsigned char *content,
-	     unsigned short len,
-	     int use_sg,
-	     int minutes) {
-
+static int usbat_write_block(struct us_data *us,
+			     unsigned char access, 
+			     unsigned char reg,
+			     unsigned char *content,
+			     unsigned short len,
+			     int use_sg, int minutes)
+{
 	int result;
 	unsigned char *command = us->iobuf;
 
@@ -260,21 +259,21 @@
 	return usbat_wait_not_busy(us, minutes);
 }
 
-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) {
-
+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)
+{
 	int result;
 	unsigned int pipe = (direction == SCSI_DATA_READ) ?
 			us->recv_bulk_pipe : us->send_bulk_pipe;
@@ -431,12 +430,12 @@
  * transfers of data!
  */
 
-int usbat_multiple_write(struct us_data *us, 
-			unsigned char access,
-			unsigned char *registers,
-			unsigned char *data_out,
-			unsigned short num_registers) {
-
+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;
 	unsigned char *data = us->iobuf;
 	int i;
@@ -479,9 +478,8 @@
 	return usbat_wait_not_busy(us, 0);
 }
 
-int usbat_read_user_io(struct us_data *us,
-		unsigned char *data_flags) {
-
+static int usbat_read_user_io(struct us_data *us, unsigned char *data_flags)
+{
 	int result;
 
 	result = usb_stor_ctrl_transfer(us,
@@ -496,10 +494,10 @@
 	return result;
 }
 
-int usbat_write_user_io(struct us_data *us,
-		unsigned char enable_flags,
-		unsigned char data_flags) {
-
+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,
@@ -519,11 +517,11 @@
  * a little ( <= 65535 byte) ATAPI pipe
  */
 
-int usbat_handle_read10(struct us_data *us,
-		unsigned char *registers,
-		unsigned char *data,
-		Scsi_Cmnd *srb) {
-
+static int usbat_handle_read10(struct us_data *us,
+			       unsigned char *registers,
+			       unsigned char *data,
+			       Scsi_Cmnd *srb)
+{
 	int result = USB_STOR_TRANSPORT_GOOD;
 	unsigned char *buffer;
 	unsigned int len;
@@ -630,8 +628,8 @@
 	return result;
 }
 
-static int hp_8200e_select_and_test_registers(struct us_data *us) {
-
+static int hp_8200e_select_and_test_registers(struct us_data *us)
+{
 	int selector;
 	unsigned char *status = us->iobuf;
 
@@ -679,8 +677,8 @@
 	return USB_STOR_TRANSPORT_GOOD;
 }
 
-int init_8200e(struct us_data *us) {
-
+int init_8200e(struct us_data *us)
+{
 	int result;
 	unsigned char *status = us->iobuf;
 
@@ -693,7 +691,7 @@
 
 	US_DEBUGP("INIT 1\n");
 
-	wait_ms(2000);
+	msleep(2000);
 
 	if (usbat_read_user_io(us, status) !=
 			USB_STOR_XFER_GOOD)
@@ -727,7 +725,7 @@
 
 	US_DEBUGP("INIT 5\n");
 
-	wait_ms(250);
+	msleep(250);
 
 	// Write 0x80 to ISA port 0x3F
 
@@ -778,7 +776,7 @@
 
 	US_DEBUGP("INIT 12\n");
 
-	wait_ms(1400);
+	msleep(1400);
 
 	if (usbat_read_user_io(us, status) !=
 			USB_STOR_XFER_GOOD)
diff -Nru a/drivers/usb/storage/shuttle_usbat.h b/drivers/usb/storage/shuttle_usbat.h
--- a/drivers/usb/storage/shuttle_usbat.h	Tue Jun 15 22:20:37 2004
+++ b/drivers/usb/storage/shuttle_usbat.h	Tue Jun 15 22:20:37 2004
@@ -52,27 +52,7 @@
 #define USBAT_UIO_OE0		0x10 // I/O 0 set=output/clr=input
 #define USBAT_UIO_ADPRST	0x01 // Reset SCM chip
 
-/* USBAT-specific commands */
-
-extern int usbat_read(struct us_data *us, unsigned char access,
-	unsigned char reg, unsigned char *content);
-extern int usbat_write(struct us_data *us, unsigned char access,
-	unsigned char reg, unsigned char content);
-extern int usbat_read_block(struct us_data *us, unsigned char access,
-	unsigned char reg, unsigned char *content, unsigned short len,
-	int use_sg);
-extern int usbat_write_block(struct us_data *us, unsigned char access,
-	unsigned char reg, unsigned char *content, unsigned short len,
-	int use_sg, int minutes);
-extern int usbat_multiple_write(struct us_data *us, unsigned char access,
-	unsigned char *registers, unsigned char *data_out,
-	unsigned short num_registers);
-extern int usbat_read_user_io(struct us_data *us, unsigned char *data_flags);
-extern int usbat_write_user_io(struct us_data *us,
-	unsigned char enable_flags, unsigned char data_flags);
-
 /* HP 8200e stuff */
-
 extern int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us);
 extern int init_8200e(struct us_data *us);
 
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	Tue Jun 15 22:20:39 2004
+++ b/drivers/usb/storage/transport.c	Tue Jun 15 22:20:39 2004
@@ -137,7 +137,7 @@
 	int status;
 
 	/* don't submit URBs during abort/disconnect processing */
-	if (us->flags & DONT_SUBMIT)
+	if (us->flags & ABORTING_OR_DISCONNECTING)
 		return -EIO;
 
 	/* set up data structures for the wakeup system */
@@ -172,7 +172,7 @@
 	set_bit(US_FLIDX_URB_ACTIVE, &us->flags);
 
 	/* did an abort/disconnect occur during the submission? */
-	if (us->flags & DONT_SUBMIT) {
+	if (us->flags & ABORTING_OR_DISCONNECTING) {
 
 		/* cancel the URB, if it hasn't been cancelled already */
 		if (test_and_clear_bit(US_FLIDX_URB_ACTIVE, &us->flags)) {
@@ -440,7 +440,7 @@
 	int result;
 
 	/* don't submit s-g requests during abort/disconnect processing */
-	if (us->flags & DONT_SUBMIT)
+	if (us->flags & ABORTING_OR_DISCONNECTING)
 		return USB_STOR_XFER_ERROR;
 
 	/* initialize the scatter-gather request block */
@@ -458,7 +458,7 @@
 	set_bit(US_FLIDX_SG_ACTIVE, &us->flags);
 
 	/* did an abort/disconnect occur during the submission? */
-	if (us->flags & DONT_SUBMIT) {
+	if (us->flags & ABORTING_OR_DISCONNECTING) {
 
 		/* cancel the request, if it hasn't been cancelled already */
 		if (test_and_clear_bit(US_FLIDX_SG_ACTIVE, &us->flags)) {
@@ -712,14 +712,10 @@
 
 	/* abort processing: the bulk-only transport requires a reset
 	 * following an abort */
-	Handle_Abort:
+  Handle_Abort:
 	srb->result = DID_ABORT << 16;
-	if (us->protocol == US_PR_BULK) {
-
-		/* permit the reset transfer to take place */
-		clear_bit(US_FLIDX_ABORTING, &us->flags);
+	if (us->protocol == US_PR_BULK)
 		us->transport_reset(us);
-	}
 }
 
 /* Stop the current URB transfer */
@@ -912,6 +908,17 @@
 				 USB_RECIP_INTERFACE,
 				 0, us->ifnum, us->iobuf, 1, HZ);
 
+	/* 
+	 * Some devices (i.e. Iomega Zip100) need this -- apparently
+	 * the bulk pipes get STALLed when the GetMaxLUN request is
+	 * processed.   This is, in theory, harmless to all other devices
+	 * (regardless of if they stall or not).
+	 */
+	if (result < 0) {
+		usb_stor_clear_halt(us, us->recv_bulk_pipe);
+		usb_stor_clear_halt(us, us->send_bulk_pipe);
+	}
+
 	US_DEBUGP("GetMaxLUN command result is %d, data is %d\n", 
 		  result, us->iobuf[0]);
 
@@ -1079,35 +1086,39 @@
 {
 	int result;
 	int result2;
+	int rc = FAILED;
 
-	/* Let the SCSI layer know we are doing a reset */
+	/* Let the SCSI layer know we are doing a reset, set the
+	 * RESETTING bit, and clear the ABORTING bit so that the reset
+	 * may proceed.
+	 */
+	scsi_lock(us->host);
 	usb_stor_report_device_reset(us);
+	set_bit(US_FLIDX_RESETTING, &us->flags);
+	clear_bit(US_FLIDX_ABORTING, &us->flags);
+	scsi_unlock(us->host);
 
 	/* A 20-second timeout may seem rather long, but a LaCie
-	 *  StudioDrive USB2 device takes 16+ seconds to get going
-	 *  following a powerup or USB attach event. */
-
+	 * StudioDrive USB2 device takes 16+ seconds to get going
+	 * following a powerup or USB attach event.
+	 */
 	result = usb_stor_control_msg(us, us->send_ctrl_pipe,
 			request, requesttype, value, index, data, size,
 			20*HZ);
 	if (result < 0) {
 		US_DEBUGP("Soft reset failed: %d\n", result);
-		return FAILED;
+		goto Done;
 	}
 
 	/* long wait for reset, so unlock to allow disconnects */
 	up(&us->dev_semaphore);
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ*6);
+	msleep(6000);
 	down(&us->dev_semaphore);
 	if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {
 		US_DEBUGP("Reset interrupted by disconnect\n");
-		return FAILED;
+		goto Done;
 	}
 
-	/* permit the clear-halt transfers to take place */
-	clear_bit(US_FLIDX_ABORTING, &us->flags);
-
 	US_DEBUGP("Soft reset: clearing bulk-in endpoint halt\n");
 	result = usb_stor_clear_halt(us, us->recv_bulk_pipe);
 
@@ -1117,10 +1128,14 @@
 	/* return a result code based on the result of the control message */
 	if (result < 0 || result2 < 0) {
 		US_DEBUGP("Soft reset failed\n");
-		return FAILED;
+		goto Done;
 	}
 	US_DEBUGP("Soft reset done\n");
-	return SUCCESS;
+	rc = SUCCESS;
+
+  Done:
+	clear_bit(US_FLIDX_RESETTING, &us->flags);
+	return rc;
 }
 
 /* This issues a CB[I] Reset to the device in question
diff -Nru a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
--- a/drivers/usb/storage/unusual_devs.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/usb/storage/unusual_devs.h	Tue Jun 15 22:20:43 2004
@@ -90,6 +90,12 @@
  		US_SC_SCSI, US_PR_DPCM_USB, NULL, 0 ),
 #endif
 
+/* Patch submitted by Alessandro Fracchetti <al.fracchetti@tin.it> */
+UNUSUAL_DEV(  0x0482, 0x0105, 0x0100, 0x0100,
+		"Kyocera",
+		"Finecam L3",
+		US_SC_SCSI, US_PR_BULK, NULL, US_FL_FIX_INQUIRY),
+
 /* Patch submitted by Philipp Friedrich <philipp@void.at> */
 UNUSUAL_DEV(  0x0482, 0x0100, 0x0100, 0x0100,
 		"Kyocera",
@@ -297,6 +303,13 @@
 		US_SC_SCSI, US_PR_DEVICE, NULL,
 		US_FL_SINGLE_LUN | US_FL_MODE_XLATE),
 
+/* Submitted by Rajesh Kumble Nayak <nayak@obs-nice.fr> */
+UNUSUAL_DEV(  0x054c, 0x002e, 0x0500, 0x0500, 
+		"Sony",
+		"Handycam HC-85",
+		US_SC_UFI, US_PR_DEVICE, NULL,
+		US_FL_SINGLE_LUN | US_FL_MODE_XLATE),
+
 UNUSUAL_DEV(  0x054c, 0x0032, 0x0000, 0x9999,
 		"Sony",
 		"Memorystick MSC-U01N",
@@ -322,6 +335,13 @@
 		"PEG Mass Storage",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_FIX_INQUIRY ),
+
+/* Submitted by Mike Alborn <malborn@deandra.homeip.net> */
+UNUSUAL_DEV(  0x054c, 0x016a, 0x0000, 0x9999,
+		"Sony",
+		"PEG Mass Storage",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_FIX_INQUIRY ),
 		
 UNUSUAL_DEV(  0x057b, 0x0000, 0x0000, 0x0299, 
 		"Y-E Data",
@@ -438,22 +458,6 @@
 		US_FL_SINGLE_LUN ),
 #endif
 
-/* Following three Minolta cameras reported by Martin Pool
- * <mbp@sourcefrog.net>.  Originally discovered by Kedar Petankar,
- * Matthew Geier, Mikael Lofj"ard, Marcel de Boer.
- */
-UNUSUAL_DEV( 0x0686, 0x4006, 0x0001, 0x0001,
-		"Minolta",
-		"DiMAGE 7",
-		US_SC_SCSI, US_PR_DEVICE, NULL,
-		0 ),
-
-UNUSUAL_DEV( 0x0686, 0x400f, 0x0001, 0x0001,
-		"Minolta",
-		"DiMAGE 7Hi",
-		US_SC_SCSI, US_PR_DEVICE, NULL,
-		0 ),
-
 /* Submitted by Benny Sjostrand <benny@hostmobility.com> */
 UNUSUAL_DEV( 0x0686, 0x4011, 0x0001, 0x0001,
 		"Minolta",
@@ -629,7 +633,7 @@
 		"Casio",
 		"QV DigitalCamera",
 		US_SC_DEVICE, US_PR_CB, NULL,
-		US_FL_FIX_INQUIRY ),
+		US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ),
 
 /* Later Casio cameras apparently tell the truth */
 UNUSUAL_DEV( 0x07cf, 0x1001, 0x9010, 0x9999,
@@ -688,7 +692,7 @@
 UNUSUAL_DEV(  0x0a16, 0x8888, 0x0100, 0x0100,
 		"IBM",
 		"IBM USB Memory Key",
-		US_SC_SCSI, US_PR_BULK, NULL,
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_FIX_INQUIRY ),
 
 /* This Pentax still camera is not conformant
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/usb/storage/usb.c	Tue Jun 15 22:20:38 2004
@@ -84,8 +84,6 @@
 
 
 #include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 
@@ -490,7 +488,7 @@
 		if (unusual_dev->useTransport != US_PR_DEVICE &&
 			us->protocol == idesc->bInterfaceProtocol)
 			msg += 2;
-		if (msg >= 0)
+		if (msg >= 0 && !(unusual_dev->flags & US_FL_NEED_OVERRIDE))
 			printk(KERN_NOTICE USB_STORAGE "This device "
 				"(%04x,%04x,%04x S %02x P %02x)"
 				" has %s in unusual_devs.h\n"
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h	Tue Jun 15 22:20:42 2004
+++ b/drivers/usb/storage/usb.h	Tue Jun 15 22:20:42 2004
@@ -49,7 +49,7 @@
 #include <linux/smp_lock.h>
 #include <linux/completion.h>
 #include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi_host.h>
 
 struct us_data;
 
@@ -69,6 +69,7 @@
 /* Flag definitions: these entries are static */
 #define US_FL_SINGLE_LUN      0x00000001 /* allow access to only LUN 0	    */
 #define US_FL_MODE_XLATE      0          /* [no longer used]                */
+#define US_FL_NEED_OVERRIDE   0x00000004 /* unusual_devs entry is necessary */
 #define US_FL_IGNORE_SER      0		 /* [no longer used]		    */
 #define US_FL_SCM_MULT_TARG   0x00000020 /* supports multiple targets	    */
 #define US_FL_FIX_INQUIRY     0x00000040 /* INQUIRY response needs faking   */
@@ -79,8 +80,9 @@
 #define US_FLIDX_SG_ACTIVE	19  /* 0x00080000  current_sg is in use   */
 #define US_FLIDX_ABORTING	20  /* 0x00100000  abort is in progress   */
 #define US_FLIDX_DISCONNECTING	21  /* 0x00200000  disconnect in progress */
-#define DONT_SUBMIT	((1UL << US_FLIDX_ABORTING) | \
-			 (1UL << US_FLIDX_DISCONNECTING))
+#define ABORTING_OR_DISCONNECTING	((1UL << US_FLIDX_ABORTING) | \
+					 (1UL << US_FLIDX_DISCONNECTING))
+#define US_FLIDX_RESETTING	22  /* 0x00400000  device reset in progress */
 
 
 /* processing state machine states */
diff -Nru a/drivers/video/68328fb.c b/drivers/video/68328fb.c
--- a/drivers/video/68328fb.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/video/68328fb.c	Tue Jun 15 22:20:43 2004
@@ -1,29 +1,30 @@
 /*
- * linux/arch/m68knommu/console/68328fb.c -- Low level implementation of the
- *                                           mc68328 LCD frame buffer device
+ *  linux/drivers/video/68328fb.c -- Low level implementation of the
+ *                                   mc68x328 LCD frame buffer device
  *
- *    Copyright (C) 1998,1999 Kenneth Albanowski <kjahds@kjahds.com>,
- *                            The Silver Hammer Group, Ltd.
- *
- *
- * This file is based on the Amiga CyberVision frame buffer device (Cyberfb.c):
+ *	Copyright (C) 2003 Georges Menie
  *
- *    Copyright (C) 1996 Martin Apel
- *                       Geert Uytterhoeven
+ *  This driver assumes an already configured controller (e.g. from config.c)
+ *  Keep the code clean of board specific initialization.
  *
+ *  This code has not been tested with colors, colormap management functions
+ *  are minimal (no colormap data written to the 68328 registers...)
  *
- * This file is based on the Amiga frame buffer device (amifb.c):
+ *  initial version of this driver:
+ *    Copyright (C) 1998,1999 Kenneth Albanowski <kjahds@kjahds.com>,
+ *                            The Silver Hammer Group, Ltd.
  *
- *    Copyright (C) 1995 Geert Uytterhoeven
+ *  this version is based on :
  *
+ *  linux/drivers/video/vfb.c -- Virtual frame buffer device
  *
- * History:
- *   - 17 Feb 98: Original version by Kenneth Albanowski <kjahds@kjahds.com>
+ *      Copyright (C) 2002 James Simmons
  *
+ *	Copyright (C) 1997 Geert Uytterhoeven
  *
- * 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.
+ *  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/module.h>
@@ -33,417 +34,452 @@
 #include <linux/mm.h>
 #include <linux/tty.h>
 #include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <linux/delay.h>
-#include <linux/config.h>
-#include <asm/segment.h>
-#include <asm/system.h>
-#include <asm/irq.h>
-#include <asm/pgtable.h>
+#include <linux/interrupt.h>
+#include <asm/uaccess.h>
 #include <linux/fb.h>
+#include <linux/init.h>
 
-#define arraysize(x)    (sizeof(x)/sizeof(*(x)))
-
-static struct fb_info fb_info;
-
-   /*
-    *    mc68328vision Graphics Board
-    */
-
-#define CYBER8_WIDTH 1152
-#define CYBER8_HEIGHT 886
-#define CYBER8_PIXCLOCK 12500	/* ++Geert: Just a guess */
-
-#define CYBER16_WIDTH 800
-#define CYBER16_HEIGHT 600
-#define CYBER16_PIXCLOCK 25000	/* ++Geert: Just a guess */
-
-#define PALM_WIDTH 160
-#define PALM_HEIGHT 160
-
-/*static int mc68328Key = 0;
-static u_char mc68328_colour_table [256][4];*/
-
-   /*
-    *    Predefined Video Mode Names
-    */
+#if defined(CONFIG_M68VZ328)
+#include <asm/MC68VZ328.h>
+#elif defined(CONFIG_M68EZ328)
+#include <asm/MC68EZ328.h>
+#elif defined(CONFIG_M68328)
+#include <asm/MC68328.h>
+#else
+#error wrong architecture for the MC68x328 frame buffer device
+#endif
 
-static char *mc68328_fb_modenames[] = {
+#if defined(CONFIG_FB_68328_INVERT)
+#define MC68X328FB_MONO_VISUAL FB_VISUAL_MONO01
+#else
+#define MC68X328FB_MONO_VISUAL FB_VISUAL_MONO10
+#endif
 
-	/*
-	 *    Autodetect (Default) Video Mode
-	 */
+static u_long videomemory;
+static u_long videomemorysize;
 
-	"default",
+static struct fb_info fb_info;
+static u32 mc68x328fb_pseudo_palette[17];
 
-	/*
-	 *    Predefined Video Modes
-	 */
+static struct fb_var_screeninfo mc68x328fb_default __initdata = {
+	.red =		{ 0, 8, 0 },
+      	.green =	{ 0, 8, 0 },
+      	.blue =		{ 0, 8, 0 },
+      	.activate =	FB_ACTIVATE_TEST,
+      	.height =	-1,
+      	.width =	-1,
+      	.pixclock =	20000,
+      	.left_margin =	64,
+      	.right_margin =	64,
+      	.upper_margin =	32,
+      	.lower_margin =	32,
+      	.hsync_len =	64,
+      	.vsync_len =	2,
+      	.vmode =	FB_VMODE_NONINTERLACED,
+};
 
-	"Palm",			/* Palm Pilot devices, 1.0 and higher */
-	"Palm Grey",		/* Palm Pilot devices, 1.0 and higher */
+static struct fb_fix_screeninfo mc68x328fb_fix __initdata = {
+	.id =		"68328fb",
+	.type =		FB_TYPE_PACKED_PIXELS,
+	.xpanstep =	1,
+	.ypanstep =	1,
+	.ywrapstep =	1,
+	.accel =	FB_ACCEL_NONE,
+};
 
-	/*
-	 *    Dummy Video Modes
-	 */
+    /*
+     *  Interface used by the world
+     */
+int mc68x328fb_init(void);
+int mc68x328fb_setup(char *);
+
+static int mc68x328fb_check_var(struct fb_var_screeninfo *var,
+			 struct fb_info *info);
+static int mc68x328fb_set_par(struct fb_info *info);
+static int mc68x328fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+			 u_int transp, struct fb_info *info);
+static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
+			   struct fb_info *info);
+static int mc68x328fb_mmap(struct fb_info *info, struct file *file,
+		    struct vm_area_struct *vma);
+
+static struct fb_ops mc68x328fb_ops = {
+	.fb_check_var	= mc68x328fb_check_var,
+	.fb_set_par	= mc68x328fb_set_par,
+	.fb_setcolreg	= mc68x328fb_setcolreg,
+	.fb_pan_display	= mc68x328fb_pan_display,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
+	.fb_cursor	= soft_cursor,
+	.fb_mmap	= mc68x328fb_mmap,
+};
 
-	"dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy",
-	    "dummy",
-	"dummy", "dummy", "dummy", "dummy", "dummy", "dummy", "dummy",
-	    "dummy",
-	"dummy", "dummy", "dummy", "dummy",
+    /*
+     *  Internal routines
+     */
 
-	/*
-	 *    User Defined Video Modes
-	 *
-	 *    This doesn't work yet!!
-	 */
-
-	"user0", "user1", "user2", "user3", "user4", "user5", "user6",
-	    "user7"
-};
+static u_long get_line_length(int xres_virtual, int bpp)
+{
+	u_long length;
 
+	length = xres_virtual * bpp;
+	length = (length + 31) & ~31;
+	length >>= 3;
+	return (length);
+}
 
-   /*
-    *    Predefined Video Mode Definitions
-    */
+    /*
+     *  Setting the video mode has been split into two parts.
+     *  First part, xxxfb_check_var, must not write anything
+     *  to hardware, it should only verify and adjust var.
+     *  This means it doesn't alter par but it does use hardware
+     *  data from it to check this var. 
+     */
 
-static struct fb_var_screeninfo mc68328_fb_predefined[] = {
+static int mc68x328fb_check_var(struct fb_var_screeninfo *var,
+			 struct fb_info *info)
+{
+	u_long line_length;
 
 	/*
-	 *    Autodetect (Default) Video Mode
+	 *  FB_VMODE_CONUPDATE and FB_VMODE_SMOOTH_XPAN are equal!
+	 *  as FB_VMODE_SMOOTH_XPAN is only used internally
 	 */
 
-	{0,},
+	if (var->vmode & FB_VMODE_CONUPDATE) {
+		var->vmode |= FB_VMODE_YWRAP;
+		var->xoffset = info->var.xoffset;
+		var->yoffset = info->var.yoffset;
+	}
 
 	/*
-	 *    Predefined Video Modes
+	 *  Some very basic checks
 	 */
+	if (!var->xres)
+		var->xres = 1;
+	if (!var->yres)
+		var->yres = 1;
+	if (var->xres > var->xres_virtual)
+		var->xres_virtual = var->xres;
+	if (var->yres > var->yres_virtual)
+		var->yres_virtual = var->yres;
+	if (var->bits_per_pixel <= 1)
+		var->bits_per_pixel = 1;
+	else if (var->bits_per_pixel <= 8)
+		var->bits_per_pixel = 8;
+	else if (var->bits_per_pixel <= 16)
+		var->bits_per_pixel = 16;
+	else if (var->bits_per_pixel <= 24)
+		var->bits_per_pixel = 24;
+	else if (var->bits_per_pixel <= 32)
+		var->bits_per_pixel = 32;
+	else
+		return -EINVAL;
 
-	{
-	 /* Palm */
-	 PALM_WIDTH, PALM_HEIGHT, PALM_WIDTH, PALM_HEIGHT,
-	 0, 0,
-	 1, -1,
-	 {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 0, 0},
-	 0, 0,
-	 -1, -1,		/* phys height, width */
-	 FB_ACCEL_NONE,
-	 0, 0, 0, 0, 0, 0, 0,	/* timing */
-	 0,			/* sync */
-	 FB_VMODE_NONINTERLACED},
-	{
-	 /* Palm Grey */
-	 PALM_WIDTH, PALM_HEIGHT, PALM_WIDTH, PALM_HEIGHT,
-	 0, 0,
-	 2, -1,
-	 {0, 2, 0}, {0, 2, 0}, {0, 2, 0}, {0, 0, 0},
-	 0, 0,
-	 -1, -1,		/* phys height, width */
-	 FB_ACCEL_NONE,
-	 0, 0, 0, 0, 0, 0, 0,	/* timing */
-	 0,			/* sync */
-	 FB_VMODE_NONINTERLACED},
+	if (var->xres_virtual < var->xoffset + var->xres)
+		var->xres_virtual = var->xoffset + var->xres;
+	if (var->yres_virtual < var->yoffset + var->yres)
+		var->yres_virtual = var->yoffset + var->yres;
 
 	/*
-	 *    Dummy Video Modes
+	 *  Memory limit
 	 */
-
-	{0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,},
-	{0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,},
-	{0,}, {0,},
+	line_length =
+	    get_line_length(var->xres_virtual, var->bits_per_pixel);
+	if (line_length * var->yres_virtual > videomemorysize)
+		return -ENOMEM;
 
 	/*
-	 *    User Defined Video Modes
+	 * Now that we checked it we alter var. The reason being is that the video
+	 * mode passed in might not work but slight changes to it might make it 
+	 * work. This way we let the user know what is acceptable.
 	 */
+	switch (var->bits_per_pixel) {
+	case 1:
+	case 8:
+		var->red.offset = 0;
+		var->red.length = 8;
+		var->green.offset = 0;
+		var->green.length = 8;
+		var->blue.offset = 0;
+		var->blue.length = 8;
+		var->transp.offset = 0;
+		var->transp.length = 0;
+		break;
+	case 16:		/* RGBA 5551 */
+		if (var->transp.length) {
+			var->red.offset = 0;
+			var->red.length = 5;
+			var->green.offset = 5;
+			var->green.length = 5;
+			var->blue.offset = 10;
+			var->blue.length = 5;
+			var->transp.offset = 15;
+			var->transp.length = 1;
+		} else {	/* RGB 565 */
+			var->red.offset = 0;
+			var->red.length = 5;
+			var->green.offset = 5;
+			var->green.length = 6;
+			var->blue.offset = 11;
+			var->blue.length = 5;
+			var->transp.offset = 0;
+			var->transp.length = 0;
+		}
+		break;
+	case 24:		/* RGB 888 */
+		var->red.offset = 0;
+		var->red.length = 8;
+		var->green.offset = 8;
+		var->green.length = 8;
+		var->blue.offset = 16;
+		var->blue.length = 8;
+		var->transp.offset = 0;
+		var->transp.length = 0;
+		break;
+	case 32:		/* RGBA 8888 */
+		var->red.offset = 0;
+		var->red.length = 8;
+		var->green.offset = 8;
+		var->green.length = 8;
+		var->blue.offset = 16;
+		var->blue.length = 8;
+		var->transp.offset = 24;
+		var->transp.length = 8;
+		break;
+	}
+	var->red.msb_right = 0;
+	var->green.msb_right = 0;
+	var->blue.msb_right = 0;
+	var->transp.msb_right = 0;
 
-	{0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,}, {0,}
-};
-
-static struct fb_fix_screeninfo mc68328_fix __initdata = {
-	.id		= "mc68328";
-	.smem_len 	= 160 * 160 /8;
-	.type 		= FB_TYPE_PACKED_PIXELS;
-	.accel 		= FB_ACCEL_NONE;
-};
-
-#define NUM_TOTAL_MODES    arraysize(mc68328_fb_predefined)
-#define NUM_PREDEF_MODES   (3)
-
-static int mc68328fb_inverse = 0;
-static int mc68328fb_mode = 0;
-static int mc68328fbCursorMode = 0;
-
-   /*
-    *    Some default modes
-    */
-
-#define PALM_DEFMODE     (1)
-#define CYBER16_DEFMODE    (2)
-
-   /*
-    *    Interface used by the world
-    */
-int mc68328_fb_init(void);
-
-static int mc68328fb_setcolreg(u_int regno, u_int red, u_int green,
-			       u_int blue, u_int transp);
-static void mc68328fb_blank(int blank, struct fb_info *info);
-
-   /*
-    *    Accelerated Functions used by the low level console driver
-    */
-
-void mc68328_WaitQueue(u_short fifo);
-void mc68328_WaitBlit(void);
-void mc68328_BitBLT(u_short curx, u_short cury, u_short destx,
-		    u_short desty, u_short width, u_short height,
-		    u_short mode);
-void mc68328_RectFill(u_short x, u_short y, u_short width, u_short height,
-		      u_short mode, u_short color);
-void mc68328_MoveCursor(u_short x, u_short y);
-
-   /*
-    *    Internal routines
-    */
-static int get_video_mode(const char *name);
-
-   /*
-    *    Set a single color register. The values supplied are already
-    *    rounded down to the hardware's capabilities (according to the
-    *    entries in the var structure). Return != 0 for invalid regno.
-    */
-
-static int mc68328fb_setcolreg(u_int regno, u_int red, u_int green,
-			       u_int blue, u_int transp)
-{
-	return 1;
-#if 0
-	if (regno > 255)
-		return (1);
-
-	*(mc68328Regs + 0x3c8) = (char) regno;
-	mc68328_colour_table[regno][0] = red & 0xff;
-	mc68328_colour_table[regno][1] = green & 0xff;
-	mc68328_colour_table[regno][2] = blue & 0xff;
-	mc68328_colour_table[regno][3] = transp;
-
-	*(mc68328Regs + 0x3c9) = (red & 0xff) >> 2;
-	*(mc68328Regs + 0x3c9) = (green & 0xff) >> 2;
-	*(mc68328Regs + 0x3c9) = (blue & 0xff) >> 2;
-
-	return (0);
-#endif
-}
-
-   /*
-    *    (Un)Blank the screen
-    */
-
-static void mc68328fb_blank(int blank, struct fb_info *info)
-{
-#if 0
-	if (blank)
-		(*(volatile unsigned char *) 0xFFFFFA27) &= ~128;
-	else
-		(*(volatile unsigned char *) 0xFFFFFA27) |= 128;
-#endif
+	return 0;
 }
 
-
-/**************************************************************
- * We are waiting for "fifo" FIFO-slots empty
+/* This routine actually sets the video mode. It's in here where we
+ * the hardware state info->par and fix which can be affected by the 
+ * change in par. For this driver it doesn't do much. 
  */
-void mc68328_WaitQueue(u_short fifo)
+static int mc68x328fb_set_par(struct fb_info *info)
 {
+	info->fix.line_length = get_line_length(info->var.xres_virtual,
+						info->var.bits_per_pixel);
+	return 0;
 }
 
-/**************************************************************
- * We are waiting for Hardware (Graphics Engine) not busy
- */
-void mc68328_WaitBlit(void)
-{
-}
+    /*
+     *  Set a single color register. The values supplied are already
+     *  rounded down to the hardware's capabilities (according to the
+     *  entries in the var structure). Return != 0 for invalid regno.
+     */
 
-/**************************************************************
- * BitBLT - Through the Plane
- */
-void mc68328_BitBLT(u_short curx, u_short cury, u_short destx,
-		    u_short desty, u_short width, u_short height,
-		    u_short mode)
+static int mc68x328fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+			 u_int transp, struct fb_info *info)
 {
-#if 0
-	u_short blitcmd = S3_BITBLT;
+	if (regno >= 256)	/* no. of hw registers */
+		return 1;
+	/*
+	 * Program hardware... do anything you want with transp
+	 */
 
-/* Set drawing direction */
-/* -Y, X maj, -X (default) */
-	if (curx > destx)
-		blitcmd |= 0x0020;	/* Drawing direction +X */
-	else {
-		curx += (width - 1);
-		destx += (width - 1);
+	/* grayscale works only partially under directcolor */
+	if (info->var.grayscale) {
+		/* grayscale = 0.30*R + 0.59*G + 0.11*B */
+		red = green = blue =
+		    (red * 77 + green * 151 + blue * 28) >> 8;
 	}
 
-	if (cury > desty)
-		blitcmd |= 0x0080;	/* Drawing direction +Y */
-	else {
-		cury += (height - 1);
-		desty += (height - 1);
+	/* Directcolor:
+	 *   var->{color}.offset contains start of bitfield
+	 *   var->{color}.length contains length of bitfield
+	 *   {hardwarespecific} contains width of RAMDAC
+	 *   cmap[X] is programmed to (X << red.offset) | (X << green.offset) | (X << blue.offset)
+	 *   RAMDAC[X] is programmed to (red, green, blue)
+	 * 
+	 * Pseudocolor:
+	 *    uses offset = 0 && length = RAMDAC register width.
+	 *    var->{color}.offset is 0
+	 *    var->{color}.length contains widht of DAC
+	 *    cmap is not used
+	 *    RAMDAC[X] is programmed to (red, green, blue)
+	 * Truecolor:
+	 *    does not use DAC. Usually 3 are present.
+	 *    var->{color}.offset contains start of bitfield
+	 *    var->{color}.length contains length of bitfield
+	 *    cmap is programmed to (red << red.offset) | (green << green.offset) |
+	 *                      (blue << blue.offset) | (transp << transp.offset)
+	 *    RAMDAC does not exist
+	 */
+#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
+	switch (info->fix.visual) {
+	case FB_VISUAL_TRUECOLOR:
+	case FB_VISUAL_PSEUDOCOLOR:
+		red = CNVT_TOHW(red, info->var.red.length);
+		green = CNVT_TOHW(green, info->var.green.length);
+		blue = CNVT_TOHW(blue, info->var.blue.length);
+		transp = CNVT_TOHW(transp, info->var.transp.length);
+		break;
+	case FB_VISUAL_DIRECTCOLOR:
+		red = CNVT_TOHW(red, 8);	/* expect 8 bit DAC */
+		green = CNVT_TOHW(green, 8);
+		blue = CNVT_TOHW(blue, 8);
+		/* hey, there is bug in transp handling... */
+		transp = CNVT_TOHW(transp, 8);
+		break;
+	}
+#undef CNVT_TOHW
+	/* Truecolor has hardware independent palette */
+	if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
+		u32 v;
+
+		if (regno >= 16)
+			return 1;
+
+		v = (red << info->var.red.offset) |
+		    (green << info->var.green.offset) |
+		    (blue << info->var.blue.offset) |
+		    (transp << info->var.transp.offset);
+		switch (info->var.bits_per_pixel) {
+		case 8:
+			break;
+		case 16:
+			((u32 *) (info->pseudo_palette))[regno] = v;
+			break;
+		case 24:
+		case 32:
+			((u32 *) (info->pseudo_palette))[regno] = v;
+			break;
+		}
+		return 0;
 	}
+	return 0;
+}
 
-	mc68328_WaitQueue(0x8000);
+    /*
+     *  Pan or Wrap the Display
+     *
+     *  This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
+     */
 
-	*((u_short volatile *) (mc68328Regs + S3_PIXEL_CNTL)) = 0xa000;
-	*((u_short volatile *) (mc68328Regs + S3_FRGD_MIX)) =
-	    (0x0060 | mode);
+static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
+			   struct fb_info *info)
+{
+	if (var->vmode & FB_VMODE_YWRAP) {
+		if (var->yoffset < 0
+		    || var->yoffset >= info->var.yres_virtual
+		    || var->xoffset)
+			return -EINVAL;
+	} else {
+		if (var->xoffset + var->xres > info->var.xres_virtual ||
+		    var->yoffset + var->yres > info->var.yres_virtual)
+			return -EINVAL;
+	}
+	info->var.xoffset = var->xoffset;
+	info->var.yoffset = var->yoffset;
+	if (var->vmode & FB_VMODE_YWRAP)
+		info->var.vmode |= FB_VMODE_YWRAP;
+	else
+		info->var.vmode &= ~FB_VMODE_YWRAP;
+	return 0;
+}
 
-	*((u_short volatile *) (mc68328Regs + S3_CUR_X)) = curx;
-	*((u_short volatile *) (mc68328Regs + S3_CUR_Y)) = cury;
+    /*
+     *  Most drivers don't need their own mmap function 
+     */
 
-	*((u_short volatile *) (mc68328Regs + S3_DESTX_DIASTP)) = destx;
-	*((u_short volatile *) (mc68328Regs + S3_DESTY_AXSTP)) = desty;
+static int mc68x328fb_mmap(struct fb_info *info, struct file *file,
+		    struct vm_area_struct *vma)
+{
+#ifndef MMU
+	/* this is uClinux (no MMU) specific code */
 
-	*((u_short volatile *) (mc68328Regs + S3_MIN_AXIS_PCNT)) =
-	    height - 1;
-	*((u_short volatile *) (mc68328Regs + S3_MAJ_AXIS_PCNT)) =
-	    width - 1;
+	vma->vm_flags |= VM_RESERVED;
+	vma->vm_start = videomemory;
 
-	*((u_short volatile *) (mc68328Regs + S3_CMD)) = blitcmd;
+	return 0;
+#else
+	return -EINVAL;
 #endif
 }
 
-/**************************************************************
- * Rectangle Fill Solid
- */
-void mc68328_RectFill(u_short x, u_short y, u_short width, u_short height,
-		      u_short mode, u_short color)
+int __init mc68x328fb_setup(char *options)
 {
 #if 0
-	u_short blitcmd = S3_FILLEDRECT;
-
-	mc68328_WaitQueue(0x8000);
-
-	*((u_short volatile *) (mc68328Regs + S3_PIXEL_CNTL)) = 0xa000;
-	*((u_short volatile *) (mc68328Regs + S3_FRGD_MIX)) =
-	    (0x0020 | mode);
-
-	*((u_short volatile *) (mc68328Regs + S3_MULT_MISC)) = 0xe000;
-	*((u_short volatile *) (mc68328Regs + S3_FRGD_COLOR)) = color;
-
-	*((u_short volatile *) (mc68328Regs + S3_CUR_X)) = x;
-	*((u_short volatile *) (mc68328Regs + S3_CUR_Y)) = y;
-
-	*((u_short volatile *) (mc68328Regs + S3_MIN_AXIS_PCNT)) =
-	    height - 1;
-	*((u_short volatile *) (mc68328Regs + S3_MAJ_AXIS_PCNT)) =
-	    width - 1;
-
-	*((u_short volatile *) (mc68328Regs + S3_CMD)) = blitcmd;
+	char *this_opt;
 #endif
-}
-
 
-/**************************************************************
- * Move cursor to x, y
- */
-void mc68328_MoveCursor(u_short x, u_short y)
-{
-	(*(volatile unsigned short *) 0xFFFFFA18) =
-	    (mc68328fbCursorMode << 14) | x;
-	(*(volatile unsigned short *) 0xFFFFFA1A) = y;
+	if (!options || !*options)
+		return 1;
 #if 0
-	*(mc68328Regs + S3_CRTC_ADR) = 0x39;
-	*(mc68328Regs + S3_CRTC_DATA) = 0xa0;
-
-	*(mc68328Regs + S3_CRTC_ADR) = S3_HWGC_ORGX_H;
-	*(mc68328Regs + S3_CRTC_DATA) = (char) ((x & 0x0700) >> 8);
-	*(mc68328Regs + S3_CRTC_ADR) = S3_HWGC_ORGX_L;
-	*(mc68328Regs + S3_CRTC_DATA) = (char) (x & 0x00ff);
-
-	*(mc68328Regs + S3_CRTC_ADR) = S3_HWGC_ORGY_H;
-	*(mc68328Regs + S3_CRTC_DATA) = (char) ((y & 0x0700) >> 8);
-	*(mc68328Regs + S3_CRTC_ADR) = S3_HWGC_ORGY_L;
-	*(mc68328Regs + S3_CRTC_DATA) = (char) (y & 0x00ff);
+	while ((this_opt = strsep(&options, ",")) != NULL) {
+		if (!*this_opt)
+			continue;
+		if (!strncmp(this_opt, "disable", 7))
+			mc68x328fb_enable = 0;
+	}
 #endif
+	return 1;
 }
 
-/* -------------------- Generic routines ------------------------------------ */
-
-   /*
-    *    Default Colormaps
-    */
-
-static u_short red16[] =
-    { 0xc000, 0x0000, 0x0000, 0x0000, 0xc000, 0xc000, 0xc000, 0x0000,
-	0x8000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff
-};
-static u_short green16[] =
-    { 0xc000, 0x0000, 0xc000, 0xc000, 0x0000, 0x0000, 0xc000, 0x0000,
-	0x8000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff
-};
-static u_short blue16[] =
-    { 0xc000, 0x0000, 0x0000, 0xc000, 0x0000, 0xc000, 0x0000, 0x0000,
-	0x8000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff
-};
-
+    /*
+     *  Initialisation
+     */
 
-static struct fb_cmap default_16_colors =
-    { 0, 16, red16, green16, blue16, NULL };
-
-
-static struct fb_cmap *get_default_colormap(int bpp)
+int __init mc68x328fb_init(void)
 {
-	return (&default_16_colors);
-}
-
+	/*
+	 *  initialize the default mode from the LCD controller registers
+	 */
+	mc68x328fb_default.xres = LXMAX;
+	mc68x328fb_default.yres = LYMAX+1;
+	mc68x328fb_default.xres_virtual = mc68x328fb_default.xres;
+	mc68x328fb_default.yres_virtual = mc68x328fb_default.yres;
+	mc68x328fb_default.bits_per_pixel = 1 + (LPICF & 0x01);
+	videomemory = LSSA;
+	videomemorysize = (mc68x328fb_default.xres_virtual+7) / 8 *
+		mc68x328fb_default.yres_virtual * mc68x328fb_default.bits_per_pixel;
+
+	fb_info.screen_base = (void *)videomemory;
+	fb_info.fbops = &mc68x328fb_ops;
+	fb_info.var = mc68x328fb_default;
+	fb_info.fix = mc68x328fb_fix;
+	fb_info.fix.smem_start = videomemory;
+	fb_info.fix.smem_len = videomemorysize;
+	fb_info.fix.line_length =
+		get_line_length(mc68x328fb_default.xres_virtual, mc68x328fb_default.bits_per_pixel);
+	fb_info.fix.visual = (mc68x328fb_default.bits_per_pixel) == 1 ?
+		MC68X328FB_MONO_VISUAL : FB_VISUAL_PSEUDOCOLOR;
+	fb_info.pseudo_palette = &mc68x328fb_pseudo_palette;
+	fb_info.flags = FBINFO_FLAG_DEFAULT;
 
-#define CNVT_TOHW(val,width)     ((((val)<<(width))+0x7fff-(val))>>16)
-#define CNVT_FROMHW(val,width)   (((width) ? ((((val)<<16)-(val)) / \
-                                              ((1<<(width))-1)) : 0))
-
-static struct fb_ops mc68328_fb_ops = {
-	.owner		= THIS_MODULE,
-	.fb_setcolreg	= mc68328fb_setcolreg,
-	.fb_fillrect	= cfbfillrect,
-	.fb_copyarea	= cfbcopyarea,
-	.fb_imageblit	= cfbimgblt,
-	.fb_cursor	= softcursor,
-};
+	fb_alloc_cmap(&fb_info.cmap, 256, 0);
 
+	if (register_framebuffer(&fb_info) < 0) {
+		return -EINVAL;
+	}
 
-   /*
-    *    Initialization
-    */
+	printk(KERN_INFO
+		"fb%d: %s frame buffer device\n", fb_info.node,	fb_info.fix.id);
+	printk(KERN_INFO
+		"fb%d: %dx%dx%d at 0x%08lx\n", fb_info.node,
+		mc68x328fb_default.xres_virtual, mc68x328fb_default.yres_virtual,
+		1 << mc68x328fb_default.bits_per_pixel, videomemory);
 
-int __init mc68328_fb_init(void)
-{
-	if (mc68328fb_mode == -1)
-		mc68328fb_mode = PALM_DEFMODE;
-	mc68328_fix.smem_start = (*(volatile unsigned long *) 0xFFFFFA00);
-	/*kernel_map (board_addr + 0x01400000, 0x00400000, */
-	
-	info->var = mc68328_fb_predefined[mc68328fb_mode];
-	
-	if (info->var.bits_per_pixel == 1)
-		fix->visual = FB_VISUAL_MONO01;
-	else
-		fix->visual = FB_VISUAL_DIRECTCOLOR;
-	info->screen_base = (u_char *) mc68328_fix.smem_start;
-	
-	if (register_framebuffer(&fb_info) < 0)
-		panic("Cannot register frame buffer\n");
 	return 0;
 }
 
-   /*
-    *    Get a Video Mode
-    */
+#ifdef MODULE
 
-static int get_video_mode(const char *name)
+static void __exit mc68x328fb_cleanup(void)
 {
-	int i;
-
-	for (i = 1; i < NUM_PREDEF_MODES; i++)
-		if (!strcmp(name, mc68328_fb_modenames[i]))
-			return (i);
-	return (0);
+	unregister_framebuffer(&fb_info);
 }
+
+module_init(mc68x328fb_init);
+module_exit(mc68x328fb_cleanup);
+
+MODULE_LICENSE("GPL");
+#endif				/* MODULE */
diff -Nru a/drivers/video/Kconfig b/drivers/video/Kconfig
--- a/drivers/video/Kconfig	Tue Jun 15 22:20:36 2004
+++ b/drivers/video/Kconfig	Tue Jun 15 22:20:36 2004
@@ -225,6 +225,10 @@
 	  This is the frame buffer device driver for the Chips & Technologies
 	  65550 graphics chip in PowerBooks.
 
+config FB_ASILIANT
+	bool "Chips 69000 display support"
+	depends on FB && PCI
+
 config FB_IMSTT
 	bool "IMS Twin Turbo display support"
 	depends on FB && PCI
@@ -308,6 +312,14 @@
 	  As this card technology is 15 years old, most people will answer N
 	  here.
 
+config FB_HGA_ACCEL
+	bool "Hercules mono Acceleration functions (EXPERIMENTAL)"
+	depends on FB_HGA && EXPERIMENTAL
+	---help---
+	This will compile the Hercules mono graphics with
+	acceleration functions.
+
+
 config VIDEO_SELECT
 	bool
 	depends on FB && X86
@@ -319,6 +331,21 @@
 	help
 	  SGI Visual Workstation support for framebuffer graphics.
 
+config FB_GBE
+	bool "SGI Graphics Backend frame buffer support"
+	depends on FB && (SGI_IP32 || X86_VISWS)
+ 	help
+	  This is the frame buffer device driver for SGI Graphics Backend.
+	  This chip is used in SGI O2 and Visual Workstation 320/540.
+
+config FB_GBE_MEM
+	int "Video memory size in MB"
+	depends on FB_GBE
+	default 8
+	help
+	  This is the amount of memory reserved for the framebuffer,
+	  which can be any value between 1MB and 8MB.
+
 config BUS_I2C
 	bool
 	depends on FB && VISWS
@@ -743,6 +770,14 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called tdfxfb.
 
+config FB_3DFX_ACCEL
+	bool "3Dfx Banshee/Voodoo3 Acceleration functions (EXPERIMENTAL)"
+	depends on FB_3DFX && EXPERIMENTAL
+	---help---
+	This will compile the 3Dfx Banshee/Voodoo3 frame buffer device
+	with acceleration functions.
+
+
 config FB_VOODOO1
 	tristate "3Dfx Voodoo Graphics (sst1) support"
 	depends on FB && PCI
@@ -772,6 +807,14 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called tridentfb.
 
+config FB_TRIDENT_ACCEL
+	bool "Trident Acceleration functions (EXPERIMENTAL)"
+	depends on FB_TRIDENT && EXPERIMENTAL
+	---help---
+	This will compile the Trident frame buffer device with
+	acceleration functions.
+
+
 config FB_PM3
 	tristate "Permedia3 support"
 	depends on FB && PCI && BROKEN
@@ -879,6 +922,37 @@
 	help
 	  Say Y here if you want to support the built-in frame buffer of
 	  the Motorola 68328 CPU family.
+
+config FB_PXA
+	tristate "PXA LCD framebuffer support"
+	depends on FB && ARCH_PXA
+	---help---
+	  Frame buffer driver for the built-in LCD controller in the Intel
+	  PXA2x0 processor.
+
+	  This driver is also available as a module ( = code which can be
+	  inserted and removed from the running kernel whenever you want). The
+	  module will be called vfb. If you want to compile it as a module,
+	  say M here and read <file:Documentation/modules.txt>.
+
+	  If unsure, say N.
+
+config FB_PXA_PARAMETERS
+	bool "PXA LCD command line parameters"
+	default n
+	depends on FB_PXA
+	---help---
+	  Enable the use of kernel command line or module parameters
+	  to configure the physical properties of the LCD panel when
+	  using the PXA LCD driver.
+
+	  This option allows you to override the panel parameters
+	  supplied by the platform in order to support multiple
+	  different models of flatpanel. If you will only be using a
+	  single model of flatpanel then you can safely leave this
+	  option disabled.
+
+	  Documentation/fb/pxafb.txt describes the available parameters.
 
 config FB_VIRTUAL
 	tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)"
diff -Nru a/drivers/video/Makefile b/drivers/video/Makefile
--- a/drivers/video/Makefile	Tue Jun 15 22:20:37 2004
+++ b/drivers/video/Makefile	Tue Jun 15 22:20:37 2004
@@ -20,9 +20,9 @@
 obj-$(CONFIG_FB_APOLLO)           += dnfb.o cfbfillrect.o cfbimgblt.o
 obj-$(CONFIG_FB_Q40)              += q40fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_ATARI)            += atafb.o
-obj-$(CONFIG_FB_68328)            += 68328fb.o
+obj-$(CONFIG_FB_68328)            += 68328fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_RADEON_OLD)	  += radeonfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
-obj-$(CONFIG_FB_NEOMAGIC)         += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
+obj-$(CONFIG_FB_NEOMAGIC)         += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o vgastate.o
 obj-$(CONFIG_FB_IGA)              += igafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_CONTROL)          += controlfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_PLATINUM)         += platinumfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
@@ -31,6 +31,7 @@
 obj-$(CONFIG_FB_CLPS711X)         += clps711xfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_CYBER)            += cyberfb.o
 obj-$(CONFIG_FB_CYBER2000)        += cyber2000fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
+obj-$(CONFIG_FB_GBE)              += gbefb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_SGIVW)            += sgivwfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_3DFX)             += tdfxfb.o cfbimgblt.o
 obj-$(CONFIG_FB_MAC)              += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o 
@@ -72,6 +73,7 @@
 obj-$(CONFIG_FB_PVR2)             += pvr2fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_KYRO)             += kyro/ cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_VOODOO1)          += sstfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
+obj-$(CONFIG_FB_ASILIANT)	  += asiliantfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 
 obj-$(CONFIG_FB_FFB)               += ffb.o sbuslib.o cfbimgblt.o cfbcopyarea.o
 obj-$(CONFIG_FB_CG6)               += cg6.o sbuslib.o cfbimgblt.o cfbcopyarea.o
@@ -87,4 +89,4 @@
 				      cfbfillrect.o
 obj-$(CONFIG_FB_LEO)               += leo.o sbuslib.o cfbimgblt.o cfbcopyarea.o \
 				      cfbfillrect.o
-
+obj-$(CONFIG_FB_PXA)		   += pxafb.o cfbimgblt.o cfbcopyarea.o cfbfillrect.o
diff -Nru a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/video/asiliantfb.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,620 @@
+/*
+ * drivers/video/asiliantfb.c
+ *  frame buffer driver for Asiliant 69000 chip
+ *  Copyright (C) 2001-2003 Saito.K & Jeanne
+ *
+ *  from driver/video/chipsfb.c and,
+ *
+ *  drivers/video/asiliantfb.c -- frame buffer device for
+ *  Asiliant 69030 chip (formerly Intel, formerly Chips & Technologies)
+ *  Author: apc@agelectronics.co.uk
+ *  Copyright (C) 2000 AG Electronics
+ *  Note: the data sheets don't seem to be available from Asiliant.
+ *  They are available by searching developer.intel.com, but are not otherwise
+ *  linked to.
+ *
+ *  This driver should be portable with minimal effort to the 69000 display
+ *  chip, and to the twin-display mode of the 69030.
+ *  Contains code from Thomas Hhenleitner <th@visuelle-maschinen.de> (thanks)
+ *
+ *  Derived from the CT65550 driver chipsfb.c:
+ *  Copyright (C) 1998 Paul Mackerras
+ *  ...which was derived from the Powermac "chips" driver:
+ *  Copyright (C) 1997 Fabio Riccardi.
+ *  And from the frame buffer device for Open Firmware-initialized devices:
+ *  Copyright (C) 1997 Geert Uytterhoeven.
+ *
+ *  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/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/tty.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <asm/io.h>
+
+/* Built in clock of the 69030 */
+const unsigned Fref = 14318180;
+
+#define mmio_base (p->screen_base + 0x400000)
+
+#define mm_write_ind(num, val, ap, dp)	do { \
+	writeb((num), mmio_base + (ap)); writeb((val), mmio_base + (dp)); \
+} while (0)
+
+static void mm_write_xr(struct fb_info *p, u8 reg, u8 data)
+{
+	mm_write_ind(reg, data, 0x7ac, 0x7ad);
+}
+#define write_xr(num, val)	mm_write_xr(p, num, val)
+
+static void mm_write_fr(struct fb_info *p, u8 reg, u8 data)
+{
+	mm_write_ind(reg, data, 0x7a0, 0x7a1);
+}
+#define write_fr(num, val)	mm_write_fr(p, num, val)
+
+static void mm_write_cr(struct fb_info *p, u8 reg, u8 data)
+{
+	mm_write_ind(reg, data, 0x7a8, 0x7a9);
+}
+#define write_cr(num, val)	mm_write_cr(p, num, val)
+
+static void mm_write_gr(struct fb_info *p, u8 reg, u8 data)
+{
+	mm_write_ind(reg, data, 0x79c, 0x79d);
+}
+#define write_gr(num, val)	mm_write_gr(p, num, val)
+
+static void mm_write_sr(struct fb_info *p, u8 reg, u8 data)
+{
+	mm_write_ind(reg, data, 0x788, 0x789);
+}
+#define write_sr(num, val)	mm_write_sr(p, num, val)
+
+static void mm_write_ar(struct fb_info *p, u8 reg, u8 data)
+{
+	readb(mmio_base + 0x7b4);
+	mm_write_ind(reg, data, 0x780, 0x780);
+}
+#define write_ar(num, val)	mm_write_ar(p, num, val)
+
+/*
+ * Exported functions
+ */
+int asiliantfb_init(void);
+
+static int asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *);
+static int asiliantfb_check_var(struct fb_var_screeninfo *var,
+				struct fb_info *info);
+static int asiliantfb_set_par(struct fb_info *info);
+static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+				u_int transp, struct fb_info *info);
+
+static struct fb_ops asiliantfb_ops = {
+	.owner		= THIS_MODULE,
+	.fb_check_var	= asiliantfb_check_var,
+	.fb_set_par	= asiliantfb_set_par,
+	.fb_setcolreg	= asiliantfb_setcolreg,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
+	.fb_cursor	= soft_cursor,
+};
+
+/* Calculate the ratios for the dot clocks without using a single long long
+ * value */
+static void asiliant_calc_dclk2(u32 *ppixclock, u8 *dclk2_m, u8 *dclk2_n, u8 *dclk2_div)
+{
+	unsigned pixclock = *ppixclock;
+	unsigned Ftarget = 1000000 * (1000000 / pixclock);
+	unsigned n;
+	unsigned best_error = 0xffffffff;
+	unsigned best_m = 0xffffffff,
+	         best_n = 0xffffffff;
+	unsigned ratio;
+	unsigned remainder;
+	unsigned char divisor = 0;
+
+	/* Calculate the frequency required. This is hard enough. */
+	ratio = 1000000 / pixclock;
+	remainder = 1000000 % pixclock;
+	Ftarget = 1000000 * ratio + (1000000 * remainder) / pixclock;
+
+	while (Ftarget < 100000000) {
+		divisor += 0x10;
+		Ftarget <<= 1;
+	}
+
+	ratio = Ftarget / Fref;
+	remainder = Ftarget % Fref;
+
+	/* This expresses the constraint that 150kHz <= Fref/n <= 5Mhz,
+	 * together with 3 <= n <= 257. */
+	for (n = 3; n <= 257; n++) {
+		unsigned m = n * ratio + (n * remainder) / Fref;
+
+		/* 3 <= m <= 257 */
+		if (m >= 3 && m <= 257) {
+			unsigned new_error = ((Ftarget * n) - (Fref * m)) >= 0 ?
+					       ((Ftarget * n) - (Fref * m)) : ((Fref * m) - (Ftarget * n));
+			if (new_error < best_error) {
+				best_n = n;
+				best_m = m;
+				best_error = new_error;
+			}
+		}
+		/* But if VLD = 4, then 4m <= 1028 */
+		else if (m <= 1028) {
+			/* remember there are still only 8-bits of precision in m, so
+			 * avoid over-optimistic error calculations */
+			unsigned new_error = ((Ftarget * n) - (Fref * (m & ~3))) >= 0 ?
+					       ((Ftarget * n) - (Fref * (m & ~3))) : ((Fref * (m & ~3)) - (Ftarget * n));
+			if (new_error < best_error) {
+				best_n = n;
+				best_m = m;
+				best_error = new_error;
+			}
+		}
+	}
+	if (best_m > 257)
+		best_m >>= 2;	/* divide m by 4, and leave VCO loop divide at 4 */
+	else
+		divisor |= 4;	/* or set VCO loop divide to 1 */
+	*dclk2_m = best_m - 2;
+	*dclk2_n = best_n - 2;
+	*dclk2_div = divisor;
+	*ppixclock = pixclock;
+	return;
+}
+
+static void asiliant_set_timing(struct fb_info *p)
+{
+	unsigned hd = p->var.xres / 8;
+	unsigned hs = (p->var.xres + p->var.right_margin) / 8;
+       	unsigned he = (p->var.xres + p->var.right_margin + p->var.hsync_len) / 8;
+	unsigned ht = (p->var.left_margin + p->var.xres + p->var.right_margin + p->var.hsync_len) / 8;
+	unsigned vd = p->var.yres;
+	unsigned vs = p->var.yres + p->var.lower_margin;
+	unsigned ve = p->var.yres + p->var.lower_margin + p->var.vsync_len;
+	unsigned vt = p->var.upper_margin + p->var.yres + p->var.lower_margin + p->var.vsync_len;
+	unsigned wd = (p->var.xres_virtual * ((p->var.bits_per_pixel+7)/8)) / 8;
+
+	if ((p->var.xres == 640) && (p->var.yres == 480) && (p->var.pixclock == 39722)) {
+	  write_fr(0x01, 0x02);  /* LCD */
+	} else {
+	  write_fr(0x01, 0x01);  /* CRT */
+	}
+
+	write_cr(0x11, (ve - 1) & 0x0f);
+	write_cr(0x00, (ht - 5) & 0xff);
+	write_cr(0x01, hd - 1);
+	write_cr(0x02, hd);
+	write_cr(0x03, ((ht - 1) & 0x1f) | 0x80);
+	write_cr(0x04, hs);
+	write_cr(0x05, (((ht - 1) & 0x20) <<2) | (he & 0x1f));
+	write_cr(0x3c, (ht - 1) & 0xc0);
+	write_cr(0x06, (vt - 2) & 0xff);
+	write_cr(0x30, (vt - 2) >> 8);
+	write_cr(0x07, 0x00);
+	write_cr(0x08, 0x00);
+	write_cr(0x09, 0x00);
+	write_cr(0x10, (vs - 1) & 0xff);
+	write_cr(0x32, ((vs - 1) >> 8) & 0xf);
+	write_cr(0x11, ((ve - 1) & 0x0f) | 0x80);
+	write_cr(0x12, (vd - 1) & 0xff);
+	write_cr(0x31, ((vd - 1) & 0xf00) >> 8);
+	write_cr(0x13, wd & 0xff);
+	write_cr(0x41, (wd & 0xf00) >> 8);
+	write_cr(0x15, (vs - 1) & 0xff);
+	write_cr(0x33, ((vs - 1) >> 8) & 0xf);
+	write_cr(0x38, ((ht - 5) & 0x100) >> 8);
+	write_cr(0x16, (vt - 1) & 0xff);
+	write_cr(0x18, 0x00);
+
+	if (p->var.xres == 640) {
+	  writeb(0xc7, mmio_base + 0x784);	/* set misc output reg */
+	} else {
+	  writeb(0x07, mmio_base + 0x784);	/* set misc output reg */
+	}
+}
+
+static int asiliantfb_check_var(struct fb_var_screeninfo *var,
+			     struct fb_info *p)
+{
+	unsigned long Ftarget, ratio, remainder;
+
+	ratio = 1000000 / var->pixclock;
+	remainder = 1000000 % var->pixclock;
+	Ftarget = 1000000 * ratio + (1000000 * remainder) / var->pixclock;
+
+	/* First check the constraint that the maximum post-VCO divisor is 32,
+	 * and the maximum Fvco is 220MHz */
+	if (Ftarget > 220000000 || Ftarget < 3125000) {
+		printk(KERN_ERR "asiliantfb dotclock must be between 3.125 and 220MHz\n");
+		return -ENXIO;
+	}
+	var->xres_virtual = var->xres;
+	var->yres_virtual = var->yres;
+
+	if (var->bits_per_pixel == 24) {
+		var->red.offset = 16;
+		var->green.offset = 8;
+		var->blue.offset = 0;
+		var->red.length = var->blue.length = var->green.length = 8;
+	} else if (var->bits_per_pixel == 16) {
+		switch (var->red.offset) {
+			case 11:
+				var->green.length = 6;
+				break;
+			case 10:
+				var->green.length = 5;
+				break;
+			default:
+				return -EINVAL;
+		}
+		var->green.offset = 5;
+		var->blue.offset = 0;
+		var->red.length = var->blue.length = 5;
+	} else if (var->bits_per_pixel == 8) {
+		var->red.offset = var->green.offset = var->blue.offset = 0;
+		var->red.length = var->green.length = var->blue.length = 8;
+	}
+	return 0;
+}
+
+static int asiliantfb_set_par(struct fb_info *p)
+{
+	u8 dclk2_m;		/* Holds m-2 value for register */
+	u8 dclk2_n;		/* Holds n-2 value for register */
+	u8 dclk2_div;		/* Holds divisor bitmask */
+
+	/* Set pixclock */
+	asiliant_calc_dclk2(&p->var.pixclock, &dclk2_m, &dclk2_n, &dclk2_div);
+
+	/* Set color depth */
+	if (p->var.bits_per_pixel == 24) {
+		write_xr(0x81, 0x16);	/* 24 bit packed color mode */
+		write_xr(0x82, 0x00);	/* Disable palettes */
+		write_xr(0x20, 0x20);	/* 24 bit blitter mode */
+	} else if (p->var.bits_per_pixel == 16) {
+		if (p->var.red.offset == 11)
+			write_xr(0x81, 0x15);	/* 16 bit color mode */
+		else
+			write_xr(0x81, 0x14);	/* 15 bit color mode */
+		write_xr(0x82, 0x00);	/* Disable palettes */
+		write_xr(0x20, 0x10);	/* 16 bit blitter mode */
+	} else if (p->var.bits_per_pixel == 8) {
+		write_xr(0x0a, 0x02);	/* Linear */
+		write_xr(0x81, 0x12);	/* 8 bit color mode */
+		write_xr(0x82, 0x00);	/* Graphics gamma enable */
+		write_xr(0x20, 0x00);	/* 8 bit blitter mode */
+	}
+	p->fix.line_length = p->var.xres * (p->var.bits_per_pixel >> 3);
+	p->fix.visual = (p->var.bits_per_pixel == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
+	write_xr(0xc4, dclk2_m);
+	write_xr(0xc5, dclk2_n);
+	write_xr(0xc7, dclk2_div);
+	/* Set up the CR registers */
+	asiliant_set_timing(p);
+	return 0;
+}
+
+static int asiliantfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+			     u_int transp, struct fb_info *p)
+{
+	if (regno > 255)
+		return 1;
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
+
+        /* Set hardware palete */
+	writeb(regno, mmio_base + 0x790);
+	udelay(1);
+	writeb(red, mmio_base + 0x791);
+	writeb(green, mmio_base + 0x791);
+	writeb(blue, mmio_base + 0x791);
+
+	switch(p->var.bits_per_pixel) {
+	case 15:
+		if (regno < 16) {
+			((u32 *)(p->pseudo_palette))[regno] =
+				((red & 0xf8) << 7) |
+				((green & 0xf8) << 2) |
+				((blue & 0xf8) >> 3);
+		}
+		break;
+	case 16:
+		if (regno < 16) {
+			((u32 *)(p->pseudo_palette))[regno] =
+				((red & 0xf8) << 8) |
+				((green & 0xfc) << 3) |
+				((blue & 0xf8) >> 3);
+		}
+		break;
+	case 24:
+		if (regno < 24) {
+			((u32 *)(p->pseudo_palette))[regno] =
+				(red << 16)  |
+				(green << 8) |
+				(blue);
+		}
+		break;
+	}
+	return 0;
+}
+
+struct chips_init_reg {
+	unsigned char addr;
+	unsigned char data;
+};
+
+#define N_ELTS(x)	(sizeof(x) / sizeof(x[0]))
+
+static struct chips_init_reg chips_init_sr[] =
+{
+	{0x00, 0x03},		/* Reset register */
+	{0x01, 0x01},		/* Clocking mode */
+	{0x02, 0x0f},		/* Plane mask */
+	{0x04, 0x0e}		/* Memory mode */
+};
+
+static struct chips_init_reg chips_init_gr[] =
+{
+        {0x03, 0x00},		/* Data rotate */
+	{0x05, 0x00},		/* Graphics mode */
+	{0x06, 0x01},		/* Miscellaneous */
+	{0x08, 0x00}		/* Bit mask */
+};
+
+static struct chips_init_reg chips_init_ar[] =
+{
+	{0x10, 0x01},		/* Mode control */
+	{0x11, 0x00},		/* Overscan */
+	{0x12, 0x0f},		/* Memory plane enable */
+	{0x13, 0x00}		/* Horizontal pixel panning */
+};
+
+static struct chips_init_reg chips_init_cr[] =
+{
+	{0x0c, 0x00},		/* Start address high */
+	{0x0d, 0x00},		/* Start address low */
+	{0x40, 0x00},		/* Extended Start Address */
+	{0x41, 0x00},		/* Extended Start Address */
+	{0x14, 0x00},		/* Underline location */
+	{0x17, 0xe3},		/* CRT mode control */
+	{0x70, 0x00}		/* Interlace control */
+};
+
+
+static struct chips_init_reg chips_init_fr[] =
+{
+	{0x01, 0x02},
+	{0x03, 0x08},
+	{0x08, 0xcc},
+	{0x0a, 0x08},
+	{0x18, 0x00},
+	{0x1e, 0x80},
+	{0x40, 0x83},
+	{0x41, 0x00},
+	{0x48, 0x13},
+	{0x4d, 0x60},
+	{0x4e, 0x0f},
+
+	{0x0b, 0x01},
+
+	{0x21, 0x51},
+	{0x22, 0x1d},
+	{0x23, 0x5f},
+	{0x20, 0x4f},
+	{0x34, 0x00},
+	{0x24, 0x51},
+	{0x25, 0x00},
+	{0x27, 0x0b},
+	{0x26, 0x00},
+	{0x37, 0x80},
+	{0x33, 0x0b},
+	{0x35, 0x11},
+	{0x36, 0x02},
+	{0x31, 0xea},
+	{0x32, 0x0c},
+	{0x30, 0xdf},
+	{0x10, 0x0c},
+	{0x11, 0xe0},
+	{0x12, 0x50},
+	{0x13, 0x00},
+	{0x16, 0x03},
+	{0x17, 0xbd},
+	{0x1a, 0x00},
+};
+
+
+static struct chips_init_reg chips_init_xr[] =
+{
+	{0xce, 0x00},		/* set default memory clock */
+	{0xcc, 200 },	        /* MCLK ratio M */
+	{0xcd, 18  },	        /* MCLK ratio N */
+	{0xce, 0x90},		/* MCLK divisor = 2 */
+
+	{0xc4, 209 },
+	{0xc5, 118 },
+	{0xc7, 32  },
+	{0xcf, 0x06},
+	{0x09, 0x01},		/* IO Control - CRT controller extensions */
+	{0x0a, 0x02},		/* Frame buffer mapping */
+	{0x0b, 0x01},		/* PCI burst write */
+	{0x40, 0x03},		/* Memory access control */
+	{0x80, 0x82},		/* Pixel pipeline configuration 0 */
+	{0x81, 0x12},		/* Pixel pipeline configuration 1 */
+	{0x82, 0x08},		/* Pixel pipeline configuration 2 */
+
+	{0xd0, 0x0f},
+	{0xd1, 0x01},
+};
+
+static void __init chips_hw_init(struct fb_info *p)
+{
+	int i;
+
+	for (i = 0; i < N_ELTS(chips_init_xr); ++i)
+		write_xr(chips_init_xr[i].addr, chips_init_xr[i].data);
+	write_xr(0x81, 0x12);
+	write_xr(0x82, 0x08);
+	write_xr(0x20, 0x00);
+	for (i = 0; i < N_ELTS(chips_init_sr); ++i)
+		write_sr(chips_init_sr[i].addr, chips_init_sr[i].data);
+	for (i = 0; i < N_ELTS(chips_init_gr); ++i)
+		write_gr(chips_init_gr[i].addr, chips_init_gr[i].data);
+	for (i = 0; i < N_ELTS(chips_init_ar); ++i)
+		write_ar(chips_init_ar[i].addr, chips_init_ar[i].data);
+	/* Enable video output in attribute index register */
+	writeb(0x20, mmio_base + 0x780);
+	for (i = 0; i < N_ELTS(chips_init_cr); ++i)
+		write_cr(chips_init_cr[i].addr, chips_init_cr[i].data);
+	for (i = 0; i < N_ELTS(chips_init_fr); ++i)
+		write_fr(chips_init_fr[i].addr, chips_init_fr[i].data);
+}
+
+static struct fb_fix_screeninfo asiliantfb_fix __initdata = {
+	.id =		"Asiliant 69000",
+	.type =		FB_TYPE_PACKED_PIXELS,
+	.visual =	FB_VISUAL_PSEUDOCOLOR,
+	.accel =	FB_ACCEL_NONE,
+	.line_length =	640,
+	.smem_len =	0x200000,	/* 2MB */
+};
+
+static struct fb_var_screeninfo asiliantfb_var __initdata = {
+	.xres 		= 640,
+	.yres 		= 480,
+	.xres_virtual 	= 640,
+	.yres_virtual 	= 480,
+	.bits_per_pixel = 8,
+	.red 		= { .length = 8 },
+	.green 		= { .length = 8 },
+	.blue 		= { .length = 8 },
+	.height 	= -1,
+	.width 		= -1,
+	.vmode 		= FB_VMODE_NONINTERLACED,
+	.pixclock 	= 39722,
+	.left_margin 	= 48,
+	.right_margin 	= 16,
+	.upper_margin 	= 33,
+	.lower_margin 	= 10,
+	.hsync_len 	= 96,
+	.vsync_len 	= 2,
+};
+
+static void __init init_asiliant(struct fb_info *p, unsigned long addr)
+{
+	p->fix			= asiliantfb_fix;
+	p->fix.smem_start	= addr;
+	p->var			= asiliantfb_var;
+	p->fbops		= &asiliantfb_ops;
+	p->flags		= FBINFO_FLAG_DEFAULT;
+
+	fb_alloc_cmap(&p->cmap, 256, 0);
+
+	if (register_framebuffer(p) < 0) {
+		printk(KERN_ERR "C&T 69000 framebuffer failed to register\n");
+		return;
+	}
+
+	printk(KERN_INFO "fb%d: Asiliant 69000 frame buffer (%dK RAM detected)\n",
+		p->node, p->fix.smem_len / 1024);
+
+	writeb(0xff, mmio_base + 0x78c);
+	chips_hw_init(p);
+}
+
+static int __devinit
+asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
+{
+	unsigned long addr, size;
+	struct fb_info *p;
+
+	if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
+		return -ENODEV;
+	addr = pci_resource_start(dp, 0);
+	size = pci_resource_len(dp, 0);
+	if (addr == 0)
+		return -ENODEV;
+	if (!request_mem_region(addr, size, "asiliantfb"))
+		return -EBUSY;
+
+	p = framebuffer_alloc(sizeof(u32) * 256, &dp->dev);
+	if (!p)	{
+		release_mem_region(addr, size);
+		return -ENOMEM;
+	}
+	p->pseudo_palette = p->par;
+	p->par = NULL;
+
+	p->screen_base = ioremap(addr, 0x800000);
+	if (p->screen_base == NULL) {
+		release_mem_region(addr, size);
+		framebuffer_release(p);
+		return -ENOMEM;
+	}
+
+	pci_write_config_dword(dp, 4, 0x02800083);
+	writeb(3, addr + 0x400784);
+
+	init_asiliant(p, addr);
+
+	/* Clear the entire framebuffer */
+	memset(p->screen_base, 0, 0x200000);
+
+	pci_set_drvdata(dp, p);
+	return 0;
+}
+
+static void __devexit asiliantfb_remove(struct pci_dev *dp)
+{
+	struct fb_info *p = pci_get_drvdata(dp);
+
+	unregister_framebuffer(p);
+	iounmap(p->screen_base);
+	release_mem_region(pci_resource_start(dp, 0), pci_resource_len(dp, 0));
+	pci_set_drvdata(dp, NULL);
+	framebuffer_release(p);
+}
+
+static struct pci_device_id asiliantfb_pci_tbl[] __devinitdata = {
+	{ PCI_VENDOR_ID_CT, PCI_DEVICE_ID_CT_69000, PCI_ANY_ID, PCI_ANY_ID },
+	{ 0 }
+};
+
+MODULE_DEVICE_TABLE(pci, asiliantfb_pci_tbl);
+
+static struct pci_driver asiliantfb_driver = {
+	.name =		"asiliantfb",
+	.id_table =	asiliantfb_pci_tbl,
+	.probe =	asiliantfb_pci_init,
+	.remove =	__devexit_p(asiliantfb_remove),
+};
+
+int __init asiliantfb_init(void)
+{
+	return pci_module_init(&asiliantfb_driver);
+}
+
+static void __exit asiliantfb_exit(void)
+{
+	pci_unregister_driver(&asiliantfb_driver);
+}
+
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/video/atafb.c b/drivers/video/atafb.c
--- a/drivers/video/atafb.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/video/atafb.c	Tue Jun 15 22:20:37 2004
@@ -2819,8 +2819,6 @@
 	       fb_info.node, fb_info.modename, screen_len>>10);
 
 	/* TODO: This driver cannot be unloaded yet */
-	MOD_INC_USE_COUNT;
-
 	return 0;
 }
 
@@ -3096,14 +3094,5 @@
 int init_module(void)
 {
 	return atafb_init();
-}
-
-void cleanup_module(void)
-{
-	/* Not reached because the usecount will never
-	   be decremented to zero */
-	unregister_framebuffer(&fb_info);
-	/* atari_stram_free( screen_base ); */
-	/* TODO: further clean up ... */
 }
 #endif /* MODULE */
diff -Nru a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
--- a/drivers/video/aty/atyfb_base.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/video/aty/atyfb_base.c	Tue Jun 15 22:20:42 2004
@@ -1231,10 +1231,7 @@
 
 	for (i = 0; i < FB_MAX; i++) {
 		info = registered_fb[i];
-		if (info &&
-		    info->fbops == &atyfb_ops &&
-		    info->display_fg &&
-		    info->display_fg->vc_num == i) {
+		if (info && info->fbops == &atyfb_ops) {
 			par = (struct atyfb_par *) info->par;
 			
 			atyfb_save_palette(par, enter);
@@ -1941,6 +1938,19 @@
 			if (i < 0)
 				continue;
 
+			rp = &pdev->resource[0];
+			if (rp->flags & IORESOURCE_IO)
+				rp = &pdev->resource[1];
+			addr = rp->start;
+			if (!addr)
+				continue;
+
+			res_start = rp->start;
+			res_size = rp->end - rp->start + 1;
+			if (!request_mem_region
+			    (res_start, res_size, "atyfb"))
+				continue;
+
 			info =
 			    kmalloc(sizeof(struct fb_info), GFP_ATOMIC);
 			if (!info) {
@@ -1963,19 +1973,6 @@
 			info->fix = atyfb_fix;
 			info->par = default_par;
 
-			rp = &pdev->resource[0];
-			if (rp->flags & IORESOURCE_IO)
-				rp = &pdev->resource[1];
-			addr = rp->start;
-			if (!addr)
-				continue;
-
-			res_start = rp->start;
-			res_size = rp->end - rp->start + 1;
-			if (!request_mem_region
-			    (res_start, res_size, "atyfb"))
-				continue;
-
 #ifdef __sparc__
 			/*
 			 * Map memory-mapped registers.
@@ -2003,6 +2000,7 @@
 			if (!default_par->mmap_map) {
 				printk
 				    ("atyfb_init: can't alloc mmap_map\n");
+				kfree(default_par);
 				kfree(info);
 				release_mem_region(res_start, res_size);
 				return -ENXIO;
@@ -2220,6 +2218,9 @@
 			    ioremap(info->fix.mmio_start, 0x1000);
 
 			if (!default_par->ati_regbase) {
+#ifdef __sparc__
+				kfree(default_par->mmap_map);
+#endif
 				kfree(default_par);
 				kfree(info);
 				release_mem_region(res_start, res_size);
@@ -2250,6 +2251,10 @@
 			    (char *) ioremap(addr, 0x800000);
 
 			if (!info->screen_base) {
+#ifdef __sparc__
+				kfree(default_par->mmap_map);
+#endif
+				kfree(default_par);
 				kfree(info);
 				release_mem_region(res_start, res_size);
 				return -ENXIO;
@@ -2261,6 +2266,7 @@
 				if (default_par->mmap_map)
 					kfree(default_par->mmap_map);
 #endif
+				kfree(default_par);
 				kfree(info);
 				release_mem_region(res_start, res_size);
 				return -ENXIO;
@@ -2329,6 +2335,7 @@
 		memset(default_par, 0, sizeof(struct atyfb_par));
 
 		info->fix = atyfb_fix;
+		info->par = default_par;
 
 		/*
 		 *  Map the video memory (physical address given) to somewhere in the
@@ -2360,6 +2367,7 @@
 		}
 
 		if (!aty_init(info, "ISA bus")) {
+			kfree(default_par);
 			kfree(info);
 			/* This is insufficient! kernel_map has added two large chunks!! */
 			return -ENXIO;
diff -Nru a/drivers/video/aty/radeon_accel.c b/drivers/video/aty/radeon_accel.c
--- a/drivers/video/aty/radeon_accel.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/video/aty/radeon_accel.c	Tue Jun 15 22:20:42 2004
@@ -13,7 +13,10 @@
 		rinfo->dp_gui_master_cntl  /* contains, like GMC_DST_32BPP */
                 | GMC_BRUSH_SOLID_COLOR
                 | ROP3_P);
-	OUTREG(DP_BRUSH_FRGD_CLR, region->color);
+	if (radeon_get_dstbpp(rinfo->depth) != DST_8BPP)
+		OUTREG(DP_BRUSH_FRGD_CLR, rinfo->pseudo_palette[region->color]);
+	else
+		OUTREG(DP_BRUSH_FRGD_CLR, region->color);
 	OUTREG(DP_WRITE_MSK, 0xffffffff);
 	OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM));
 
@@ -53,6 +56,18 @@
 static void radeonfb_prim_copyarea(struct radeonfb_info *rinfo, 
 				   const struct fb_copyarea *area)
 {
+	int xdir, ydir;
+	u32 sx, sy, dx, dy, w, h;
+
+	w = area->width; h = area->height;
+	dx = area->dx; dy = area->dy;
+	sx = area->sx; sy = area->sy;
+	xdir = sx - dx;
+	ydir = sy - dy;
+
+	if ( xdir < 0 ) { sx += w-1; dx += w-1; }
+	if ( ydir < 0 ) { sy += h-1; dy += h-1; }
+
 	radeon_fifo_wait(3);
 	OUTREG(DP_GUI_MASTER_CNTL,
 		rinfo->dp_gui_master_cntl /* i.e. GMC_DST_32BPP */
@@ -60,12 +75,13 @@
 		| ROP3_S 
 		| DP_SRC_RECT );
 	OUTREG(DP_WRITE_MSK, 0xffffffff);
-	OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM));
+	OUTREG(DP_CNTL, (xdir>=0 ? DST_X_LEFT_TO_RIGHT : 0)
+			| (ydir>=0 ? DST_Y_TOP_TO_BOTTOM : 0));
 
 	radeon_fifo_wait(3);
-	OUTREG(SRC_Y_X, (area->sy << 16) | area->sx);
-	OUTREG(DST_Y_X, (area->dy << 16) | area->dx);
-	OUTREG(DST_HEIGHT_WIDTH, (area->height << 16) | area->width);
+	OUTREG(SRC_Y_X, (sy << 16) | sx);
+	OUTREG(DST_Y_X, (dy << 16) | dx);
+	OUTREG(DST_HEIGHT_WIDTH, (h << 16) | w);
 }
 
 
diff -Nru a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
--- a/drivers/video/aty/radeon_base.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/video/aty/radeon_base.c	Tue Jun 15 22:20:38 2004
@@ -1144,6 +1144,7 @@
 
 	/* Set PPLL ref. div */
 	if (rinfo->family == CHIP_FAMILY_R300 ||
+	    rinfo->family == CHIP_FAMILY_RS300 ||
 	    rinfo->family == CHIP_FAMILY_R350 ||
 	    rinfo->family == CHIP_FAMILY_RV350) {
 		if (mode->ppll_ref_div & R300_PPLL_REF_DIV_ACC_MASK) {
@@ -1184,7 +1185,7 @@
 		~(PPLL_RESET | PPLL_SLEEP | PPLL_ATOMIC_UPDATE_EN | PPLL_VGA_ATOMIC_UPDATE_EN));
 
 	/* We may want some locking ... oh well */
-       	wait_ms(5);
+       	msleep(5);
 
 	/* Switch back VCLK source to PPLL */
 	OUTPLLP(VCLK_ECP_CNTL, VCLK_SRC_SEL_PPLLCLK, ~VCLK_SRC_SEL_MASK);
@@ -1783,7 +1784,6 @@
 	info->pseudo_palette = rinfo->pseudo_palette;
         info->flags = FBINFO_FLAG_DEFAULT;
         info->fbops = &radeonfb_ops;
-        info->display_fg = NULL;
         info->screen_base = (char *)rinfo->fb_base;
 
 	/* Fill fix common fields */
@@ -1855,7 +1855,8 @@
 	     rinfo->family == CHIP_FAMILY_RV280 ||
 	     rinfo->family == CHIP_FAMILY_RV350) &&
 	    !machine_is_compatible("PowerBook4,3") &&
-	    !machine_is_compatible("PowerBook6,3"))
+	    !machine_is_compatible("PowerBook6,3") &&
+	    !machine_is_compatible("PowerBook6,5"))
 		conv_table = backlight_conv_m7;
 	else
 		conv_table = backlight_conv_m6;
@@ -1865,7 +1866,7 @@
 	lvds_gen_cntl |= (LVDS_BL_MOD_EN | LVDS_BLON);
 	if (on && (level > BACKLIGHT_OFF)) {
 		lvds_gen_cntl |= LVDS_DIGON;
-		if (!lvds_gen_cntl & LVDS_ON) {
+		if (!(lvds_gen_cntl & LVDS_ON)) {
 			lvds_gen_cntl &= ~LVDS_BLON;
 			OUTREG(LVDS_GEN_CNTL, lvds_gen_cntl);
 			(void)INREG(LVDS_GEN_CNTL);
@@ -2129,7 +2130,31 @@
 #endif /* CONFIG_PPC_OF */
 
 	/* framebuffer size */
-	tmp = INREG(CONFIG_MEMSIZE);
+        if ((rinfo->family == CHIP_FAMILY_RS100) ||
+            (rinfo->family == CHIP_FAMILY_RS200) ||
+            (rinfo->family == CHIP_FAMILY_RS300)) {
+          u32 tom = INREG(NB_TOM);
+          tmp = ((((tom >> 16) - (tom & 0xffff) + 1) << 6) * 1024);
+ 
+          OUTREG(MC_FB_LOCATION, tom);
+          OUTREG(DISPLAY_BASE_ADDR, (tom & 0xffff) << 16);
+          OUTREG(CRTC2_DISPLAY_BASE_ADDR, (tom & 0xffff) << 16);
+          OUTREG(OV0_BASE_ADDR, (tom & 0xffff) << 16);
+ 
+          /* This is supposed to fix the crtc2 noise problem. */
+          OUTREG(GRPH2_BUFFER_CNTL, INREG(GRPH2_BUFFER_CNTL) & ~0x7f0000);
+ 
+          if ((rinfo->family == CHIP_FAMILY_RS100) ||
+              (rinfo->family == CHIP_FAMILY_RS200)) {
+             /* This is to workaround the asic bug for RMX, some versions
+                of BIOS dosen't have this register initialized correctly.
+             */
+             OUTREGP(CRTC_MORE_CNTL, CRTC_H_CUTOFF_ACTIVE_EN,
+                     ~CRTC_H_CUTOFF_ACTIVE_EN);
+          }
+        } else {
+          tmp = INREG(CONFIG_MEMSIZE);
+        }
 
 	/* mem size is bits [28:0], mask off the rest */
 	rinfo->video_ram = tmp & CONFIG_MEMSIZE_MASK;
@@ -2204,6 +2229,7 @@
 			rinfo->mapped_vram /= 2;
 			continue;
 		}
+		memset_io(rinfo->fb_base, 0, rinfo->mapped_vram);
 		break;
 	}
 
diff -Nru a/drivers/video/aty/radeon_i2c.c b/drivers/video/aty/radeon_i2c.c
--- a/drivers/video/aty/radeon_i2c.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/video/aty/radeon_i2c.c	Tue Jun 15 22:20:40 2004
@@ -189,12 +189,12 @@
 		 */
 		OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
 		(void)INREG(reg);
-		wait_ms(13);
+		msleep(13);
 
 		OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
 		(void)INREG(reg);
 		for (j = 0; j < 5; j++) {
-			wait_ms(10);
+			msleep(10);
 			if (INREG(reg) & VGA_DDC_CLK_INPUT)
 				break;
 		}
@@ -203,13 +203,13 @@
 
 		OUTREG(reg, INREG(reg) | VGA_DDC_DATA_OUT_EN);
 		(void)INREG(reg);
-		wait_ms(15);
+		msleep(15);
 		OUTREG(reg, INREG(reg) | VGA_DDC_CLK_OUT_EN);
 		(void)INREG(reg);
-		wait_ms(15);
+		msleep(15);
 		OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
 		(void)INREG(reg);
-		wait_ms(15);
+		msleep(15);
 
 		/* Do the real work */
 		edid = radeon_do_probe_i2c_edid(&rinfo->i2c[conn-1]);
@@ -217,19 +217,19 @@
 		OUTREG(reg, INREG(reg) | 
 				(VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN));
 		(void)INREG(reg);
-		wait_ms(15);
+		msleep(15);
 		
 		OUTREG(reg, INREG(reg) & ~(VGA_DDC_CLK_OUT_EN));
 		(void)INREG(reg);
 		for (j = 0; j < 10; j++) {
-			wait_ms(10);
+			msleep(10);
 			if (INREG(reg) & VGA_DDC_CLK_INPUT)
 				break;
 		}
 
 		OUTREG(reg, INREG(reg) & ~(VGA_DDC_DATA_OUT_EN));
 		(void)INREG(reg);
-		wait_ms(15);
+		msleep(15);
 		OUTREG(reg, INREG(reg) |
 				(VGA_DDC_DATA_OUT_EN | VGA_DDC_CLK_OUT_EN));
 		(void)INREG(reg);
diff -Nru a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c
--- a/drivers/video/aty/radeon_monitor.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/video/aty/radeon_monitor.c	Tue Jun 15 22:20:35 2004
@@ -653,7 +653,8 @@
 		rinfo->panel_info.use_bios_dividers = 1;
 	}
 	/* iBook G4 */
-	if (machine_is_compatible("PowerBook6,3")) {
+        if (machine_is_compatible("PowerBook6,3") |
+            machine_is_compatible("PowerBook6,5")) {
 		rinfo->panel_info.ref_divider = rinfo->pll.ref_div;
 		rinfo->panel_info.post_divider = 0x6;
 		rinfo->panel_info.fbk_divider = 0xad;
diff -Nru a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
--- a/drivers/video/aty/radeon_pm.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/video/aty/radeon_pm.c	Tue Jun 15 22:20:42 2004
@@ -867,7 +867,7 @@
 	}
 
 	/* Blank display and LCD */
-	radeonfb_blank(VESA_POWERDOWN+1, info);
+	radeonfb_blank(VESA_POWERDOWN, info);
 
 	/* Sleep */
 	rinfo->asleep = 1;
diff -Nru a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h
--- a/drivers/video/aty/radeonfb.h	Tue Jun 15 22:20:38 2004
+++ b/drivers/video/aty/radeonfb.h	Tue Jun 15 22:20:38 2004
@@ -223,8 +223,6 @@
 
        	/* Palette */
 	int		palette_valid;
-	u32		palette[256];
-	u32		palette2[256];
 };
 
 struct panel_info {
@@ -440,15 +438,6 @@
 /*
  * Inline utilities
  */
-
-static inline void wait_ms(unsigned long ms)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout((ms * HZ + 999) / 1000);
-}
-
-
-
 static inline int round_div(int num, int den)
 {
         return (num + (den / 2)) / den;
diff -Nru a/drivers/video/console/Makefile b/drivers/video/console/Makefile
--- a/drivers/video/console/Makefile	Tue Jun 15 22:20:40 2004
+++ b/drivers/video/console/Makefile	Tue Jun 15 22:20:40 2004
@@ -19,7 +19,7 @@
 # Each configuration option enables a list of files.
 
 obj-$(CONFIG_DUMMY_CONSOLE)       += dummycon.o
-obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o
+obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o font.o
 obj-$(CONFIG_PROM_CONSOLE)        += promcon.o promcon_tbl.o
 obj-$(CONFIG_STI_CONSOLE)         += sticon.o sticore.o
 obj-$(CONFIG_VGA_CONSOLE)         += vgacon.o
diff -Nru a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
--- a/drivers/video/console/dummycon.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/video/console/dummycon.c	Tue Jun 15 22:20:44 2004
@@ -11,6 +11,7 @@
 #include <linux/console.h>
 #include <linux/vt_kern.h>
 #include <linux/init.h>
+#include <linux/module.h>
 
 /*
  *  Dummy console driver
@@ -58,6 +59,7 @@
  */
 
 const struct consw dummy_con = {
+    .owner =		THIS_MODULE,
     .con_startup =	dummycon_startup,
     .con_init =		dummycon_init,
     .con_deinit =	DUMMY,
diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
--- a/drivers/video/console/fbcon.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/video/console/fbcon.c	Tue Jun 15 22:20:42 2004
@@ -115,6 +115,8 @@
 static int first_fb_vc;
 static int last_fb_vc = MAX_NR_CONSOLES - 1;
 static int fbcon_is_default = 1; 
+/* font data */
+static char fontname[40];
 
 #define REFCOUNT(fd)	(((int *)(fd))[-1])
 #define FNTSIZE(fd)	(((int *)(fd))[-2])
@@ -168,9 +170,7 @@
 /*
  *  Internal routines
  */
-static void fbcon_set_display(struct vc_data *vc, int init, int logo);
 static __inline__ int real_y(struct display *p, int ypos);
-static __inline__ void updatescrollmode(struct display *p, struct vc_data *vc);
 static __inline__ void ywrap_up(struct vc_data *vc, int count);
 static __inline__ void ywrap_down(struct vc_data *vc, int count);
 static __inline__ void ypan_up(struct vc_data *vc, int count);
@@ -233,18 +233,15 @@
 
 int __init fb_console_setup(char *this_opt)
 {
-	int unit, i, j;
 	char *options;
+	int i, j;
 
 	if (!this_opt || !*this_opt)
 		return 0;
 
 	while ((options = strsep(&this_opt, ",")) != NULL) {
-		if (!strncmp(options, "font:", 5)) {
-			for (unit = 0; unit < MAX_NR_CONSOLES; unit++)
-				strcpy(fb_display[unit].fontname,
-				       options + 5);
-		}
+		if (!strncmp(options, "font:", 5))
+			strcpy(fontname, options + 5);
 		
 		if (!strncmp(options, "scrollback:", 11)) {
 			options += 11;
@@ -304,8 +301,7 @@
 		return -ENODEV;
 	con2fb_map[unit] = newidx;
 	fbcon_is_default = (vc->vc_sw == &fb_con) ? 1 : 0;
-	take_over_console(&fb_con, unit, unit, fbcon_is_default);
-	return 0;
+	return take_over_console(&fb_con, unit, unit, fbcon_is_default);
 }
 
 /*
@@ -443,11 +439,13 @@
 static const char *fbcon_startup(void)
 {
 	const char *display_desc = "frame buffer device";
+	struct display *p = &fb_display[fg_console];
+	struct vc_data *vc = vc_cons[fg_console].d;
 	struct font_desc *font = NULL;
 	struct module *owner;
 	struct fb_info *info;
-	struct vc_data *vc;
 	static int done = 0;
+	int cols, rows;
 	int irqres;
 
 	irqres = 1;
@@ -494,37 +492,35 @@
 		softback_lines = 0;
 	}
 
-	font = get_default_font(info->var.xres, info->var.yres);	
-
-	vc = (struct vc_data *) kmalloc(sizeof(struct vc_data), GFP_ATOMIC); 
-
-	if (!vc) {
-		if (softback_buf)
-			kfree((void *) softback_buf);
-		return NULL;
-	}
-
 	/* Setup default font */
-	vc->vc_font.data = font->data;
-	vc->vc_font.width = font->width;
-	vc->vc_font.height = font->height;
-	vc->vc_font.charcount = 256; /* FIXME  Need to support more fonts */
-
-	vc->vc_cols = info->var.xres/vc->vc_font.width;
-	vc->vc_rows = info->var.yres/vc->vc_font.height;
+	if (!p->fontdata) {
+		if (!fontname[0] || !(font = find_font(fontname)))
+			font = get_default_font(info->var.xres,
+						   info->var.yres);
+		vc->vc_font.width = font->width;
+		vc->vc_font.height = font->height;
+		vc->vc_font.data = p->fontdata = font->data;
+		vc->vc_font.charcount = 256; /* FIXME  Need to support more fonts */
+	}
 
-	/* We trust the mode the driver supplies. */
+	/*
+	 * We must always set the mode. The mode of the previous console
+	 * driver could be in the same resolution but we are using different
+	 * hardware so we have to initialize the hardware.
+	 */
 	if (info->fbops->fb_set_par)
 		info->fbops->fb_set_par(info);
+	cols = info->var.xres/vc->vc_font.width;
+	rows = info->var.yres/vc->vc_font.height;
+	vc_resize(vc->vc_num, cols, rows);
 
 	DPRINTK("mode:   %s\n", info->fix.id);
 	DPRINTK("visual: %d\n", info->fix.visual);
 	DPRINTK("res:    %dx%d-%d\n", info->var.xres,
 		info->var.yres,
 		info->var.bits_per_pixel);
+	con_set_default_unimap(vc->vc_num);
 
-	info->display_fg = vc;
-	
 #ifdef CONFIG_ATARI
 	if (MACH_IS_ATARI) {
 		cursor_blink_rate = ATARI_CURSOR_BLINK_RATE;
@@ -599,98 +595,60 @@
 
 static void fbcon_init(struct vc_data *vc, int init)
 {
-	int unit = vc->vc_num;
-	struct fb_info *info;
-
-	/* on which frame buffer will we open this console? */
-	info = registered_fb[(int) con2fb_map[unit]];
-	
-	if (info->var.accel_flags)
-		fb_display[unit].scrollmode = SCROLL_YNOMOVE;
-	else
-		fb_display[unit].scrollmode = SCROLL_YREDRAW;
-	fbcon_set_display(vc, init, !init);
-}
-
-static void fbcon_deinit(struct vc_data *vc)
-{
-	struct display *p = &fb_display[vc->vc_num];
-
-	fbcon_free_font(p);
-}
-
-static __inline__ void updatescrollmode(struct display *p, struct vc_data *vc)
-{
 	struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
-
-	int m;
-	if (p->scrollmode & __SCROLL_YFIXED)
-		return;
-	if (divides(info->fix.ywrapstep, vc->vc_font.height) &&
-	    divides(vc->vc_font.height, info->var.yres_virtual))
-		m = __SCROLL_YWRAP;
-	else if (divides(info->fix.ypanstep, vc->vc_font.height) &&
-		 info->var.yres_virtual >= info->var.yres + vc->vc_font.height)
-		m = __SCROLL_YPAN;
-	else if (p->scrollmode & __SCROLL_YNOMOVE)
-		m = __SCROLL_YREDRAW;
-	else
-		m = __SCROLL_YMOVE;
-	p->scrollmode = (p->scrollmode & ~__SCROLL_YMASK) | m;
-}
-
-static void fbcon_set_display(struct vc_data *vc, int init, int logo)
-{
-	struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
-	int nr_rows, nr_cols, old_rows, old_cols, i, charcnt = 256;
-	struct display *p = &fb_display[vc->vc_num];
+	struct vc_data **default_mode = vc->vc_display_fg;
+	struct display *t, *p = &fb_display[vc->vc_num];
+	int display_fg = (*default_mode)->vc_num;
+	int logo = 1, rows, cols, charcnt = 256;
 	unsigned short *save = NULL, *r, *q;
-	struct font_desc *font;
 
-	if (vc->vc_num != fg_console || (info->flags & FBINFO_FLAG_MODULE) ||
+	if (vc->vc_num != display_fg || (info->flags & FBINFO_FLAG_MODULE) ||
 	    (info->fix.type == FB_TYPE_TEXT))
 		logo = 0;
 
 	info->var.xoffset = info->var.yoffset = p->yscroll = 0;	/* reset wrap/pan */
 
-	for (i = 0; i < MAX_NR_CONSOLES; i++)
-		if (vc && i != vc->vc_num && fb_display[i].fontdata) 
-			break;
-
-	fbcon_free_font(p);
-	if (i < MAX_NR_CONSOLES) {
-		struct display *q = &fb_display[i];
-		struct vc_data *tmp = vc_cons[i].d;
-		
-		/* If we are not the first console on this
-		   fb, copy the font from that console */
-		vc->vc_font.width = tmp->vc_font.width;
-		vc->vc_font.height = tmp->vc_font.height;
-		vc->vc_font.data = p->fontdata = q->fontdata;
-		p->userfont = q->userfont;
-		if (p->userfont) {
-			REFCOUNT(p->fontdata)++;
-			charcnt = FNTCHARCNT(p->fontdata);
-		}
-		con_copy_unimap(vc->vc_num, i);
+	/* If we are not the first console on this
+	   fb, copy the font from that console */
+	t = &fb_display[display_fg];
+	vc->vc_font.width = (*default_mode)->vc_font.width;
+	vc->vc_font.height = (*default_mode)->vc_font.height;
+	vc->vc_font.data = p->fontdata = t->fontdata;
+	p->userfont = t->userfont;
+	if (p->userfont) {
+		REFCOUNT(p->fontdata)++;
+		charcnt = FNTCHARCNT(p->fontdata);
 	}
+	con_copy_unimap(vc->vc_num, display_fg);
 
-	if (!p->fontdata) {
-		if (!p->fontname[0] || !(font = find_font(p->fontname)))
-			font = get_default_font(info->var.xres,
-						   info->var.yres);
-		vc->vc_font.width = font->width;
-		vc->vc_font.height = font->height;
-		vc->vc_font.data = p->fontdata = font->data;
+	vc->vc_can_do_color = info->var.bits_per_pixel != 1;
+	vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
+	if (charcnt == 256) {
+		vc->vc_hi_font_mask = 0;
+	} else {
+		vc->vc_hi_font_mask = 0x100;
+		if (vc->vc_can_do_color)
+			vc->vc_complement_mask <<= 1;
 	}
 
-	updatescrollmode(p, vc);
+	cols = info->var.xres / vc->vc_font.width;
+	rows = info->var.yres / vc->vc_font.height;
+	vc_resize(vc->vc_num, cols, rows);
 
-	old_cols = vc->vc_cols;
-	old_rows = vc->vc_rows;
+	if (info->var.accel_flags)
+		p->scrollmode = SCROLL_YNOMOVE;
+	else
+		p->scrollmode = SCROLL_YREDRAW;
 
-	nr_cols = info->var.xres / vc->vc_font.width;
-	nr_rows = info->var.yres / vc->vc_font.height;
+	/*
+	 *  ++guenther: console.c:vc_allocate() relies on initializing
+	 *  vc_{cols,rows}, but we must not set those if we are only
+	 *  resizing the console.
+	 */
+	if (init) {
+		vc->vc_cols = cols;
+		vc->vc_rows = rows;
+	}
 
 	if (logo) {
 		/* Need to make room for the logo */
@@ -701,34 +659,28 @@
 		logo_lines = (logo_height + vc->vc_font.height - 1) /
 			     vc->vc_font.height;
 		q = (unsigned short *) (vc->vc_origin +
-					vc->vc_size_row * old_rows);
-		step = logo_lines * old_cols;
-		for (r = q - logo_lines * old_cols; r < q; r++)
+					vc->vc_size_row * rows);
+		step = logo_lines * cols;
+		for (r = q - logo_lines * cols; r < q; r++)
 			if (scr_readw(r) != vc->vc_video_erase_char)
 				break;
-		if (r != q && nr_rows >= old_rows + logo_lines) {
-			save =
-			    kmalloc(logo_lines * nr_cols * 2, GFP_KERNEL);
+		if (r != q && rows >= rows + logo_lines) {
+			save = kmalloc(logo_lines * cols * 2, GFP_KERNEL);
 			if (save) {
-				int i =
-				    old_cols <
-				    nr_cols ? old_cols : nr_cols;
 				scr_memsetw(save, vc->vc_video_erase_char,
-					    logo_lines * nr_cols * 2);
+					    logo_lines * cols * 2);
 				r = q - step;
-				for (cnt = 0; cnt < logo_lines;
-				     cnt++, r += i)
-					scr_memcpyw(save + cnt * nr_cols,
-						    r, 2 * i);
+				for (cnt = 0; cnt < logo_lines; cnt++, r += cols)
+					scr_memcpyw(save + cnt * cols, r, 2 * cols);
 				r = q;
 			}
 		}
 		if (r == q) {
 			/* We can scroll screen down */
-			r = q - step - old_cols;
-			for (cnt = old_rows - logo_lines; cnt > 0; cnt--) {
+			r = q - step - cols;
+			for (cnt = rows - logo_lines; cnt > 0; cnt--) {
 				scr_memcpyw(r + step, r, vc->vc_size_row);
-				r -= old_cols;
+				r -= cols;
 			}
 			if (!save) {
 				vc->vc_y += logo_lines;
@@ -738,55 +690,20 @@
 		scr_memsetw((unsigned short *) vc->vc_origin,
 			    vc->vc_video_erase_char,
 			    vc->vc_size_row * logo_lines);
-	}
-
-	/*
-	 *  ++guenther: console.c:vc_allocate() relies on initializing
-	 *  vc_{cols,rows}, but we must not set those if we are only
-	 *  resizing the console.
-	 */
-	if (init) {
-		vc->vc_cols = nr_cols;
-		vc->vc_rows = nr_rows;
-	}
-	p->vrows = info->var.yres_virtual / vc->vc_font.height;
-	if(info->var.yres > (vc->vc_font.height * (vc->vc_rows + 1))) {
-		p->vrows -= (info->var.yres - (vc->vc_font.height * vc->vc_rows)) / vc->vc_font.height;
-	}
-	if ((info->var.yres % vc->vc_font.height) &&
-	    (info->var.yres_virtual % vc->vc_font.height <
-	     info->var.yres % vc->vc_font.height))
-		p->vrows--;
-	vc->vc_can_do_color = info->var.bits_per_pixel != 1;
-	vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
-	if (charcnt == 256) {
-		vc->vc_hi_font_mask = 0;
-	} else {
-		vc->vc_hi_font_mask = 0x100;
-		if (vc->vc_can_do_color)
-			vc->vc_complement_mask <<= 1;
-	}
 
-	if (!init) {
-		if (vc->vc_cols != nr_cols || vc->vc_rows != nr_rows)
-			vc_resize(vc->vc_num, nr_cols, nr_rows);
-		else if (CON_IS_VISIBLE(vc) &&
-			 vt_cons[vc->vc_num]->vc_mode == KD_TEXT) {
+		if (CON_IS_VISIBLE(vc) && vt_cons[vc->vc_num]->vc_mode == KD_TEXT) {
 			accel_clear_margins(vc, info, 0);
 			update_screen(vc->vc_num);
 		}
 		if (save) {
 			q = (unsigned short *) (vc->vc_origin +
 						vc->vc_size_row *
-						old_rows);
-			scr_memcpyw(q, save, logo_lines * nr_cols * 2);
+						rows);
+			scr_memcpyw(q, save, logo_lines * cols * 2);
 			vc->vc_y += logo_lines;
 			vc->vc_pos += logo_lines * vc->vc_size_row;
 			kfree(save);
 		}
-	}
-
-	if (logo) {
 		if (logo_lines > vc->vc_bottom) {
 			logo_shown = -1;
 			printk(KERN_INFO
@@ -797,7 +714,7 @@
 		}
 	}
 
-	if (vc->vc_num == fg_console && softback_buf) {
+	if (vc->vc_num == display_fg && softback_buf) {
 		int l = fbcon_softback_size / vc->vc_size_row;
 		if (l > 5)
 			softback_end = softback_buf + l * vc->vc_size_row;
@@ -809,6 +726,12 @@
 	}
 }
 
+static void fbcon_deinit(struct vc_data *vc)
+{
+	struct display *p = &fb_display[vc->vc_num];
+
+	fbcon_free_font(p);
+}
 
 /* ====================================================================== */
 
@@ -1542,6 +1465,25 @@
 			height, width);
 }
 
+static __inline__ void updatescrollmode(struct display *p, struct fb_info *info, struct vc_data *vc)
+{
+	int m;
+
+	if (p->scrollmode & __SCROLL_YFIXED)
+		return;
+	if (divides(info->fix.ywrapstep, vc->vc_font.height) &&
+	    divides(vc->vc_font.height, info->var.yres_virtual))
+		m = __SCROLL_YWRAP;
+	else if (divides(info->fix.ypanstep, vc->vc_font.height) &&
+		 info->var.yres_virtual >= info->var.yres + vc->vc_font.height)
+		m = __SCROLL_YPAN;
+	else if (p->scrollmode & __SCROLL_YNOMOVE)
+		m = __SCROLL_YREDRAW;
+	else
+		m = __SCROLL_YMOVE;
+	p->scrollmode = (p->scrollmode & ~__SCROLL_YMASK) | m;
+}
+
 static int fbcon_resize(struct vc_data *vc, unsigned int width, 
 			unsigned int height)
 {
@@ -1556,20 +1498,30 @@
 	var.yres = height * fh;
 	x_diff = info->var.xres - var.xres;
 	y_diff = info->var.yres - var.yres;
-	if (x_diff < 0 || x_diff > fw ||
-	   (y_diff < 0 || y_diff > fh)) {
-		var.activate = FB_ACTIVATE_TEST;
-		err = fb_set_var(info, &var);
-		if (err || width > var.xres/fw ||
-		    height > var.yres/fh)
+	if (x_diff < 0 || x_diff > fw || (y_diff < 0 || y_diff > fh)) {
+		char mode[40];
+
+		DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
+		if (!info->fbops->fb_set_par)
+			return -EINVAL;
+
+		sprintf(mode, "%dx%d", var.xres, var.yres);
+		err = fb_find_mode(&var, info, mode, NULL, 0, NULL,
+					info->var.bits_per_pixel);
+		if (!err || width > var.xres/fw || height > var.yres/fh)
 			return -EINVAL;
 		DPRINTK("resize now %ix%i\n", var.xres, var.yres);
-		var.activate = FB_ACTIVATE_NOW;
-		fb_set_var(info, &var);
+		if (CON_IS_VISIBLE(vc)) {
+			var.activate = FB_ACTIVATE_NOW;
+			fb_set_var(info, &var);
+		}
 	}
 	p->vrows = var.yres_virtual/fh;
 	if (var.yres > (fh * (height + 1)))
 		p->vrows -= (var.yres - (fh * height)) / fh;
+	if ((var.yres % fh) && (var.yres_virtual % fh < var.yres % fh))
+		p->vrows--;
+	updatescrollmode(p, info, vc);
 	return 0;
 }
 
@@ -1839,16 +1791,6 @@
 	if (resize) {
 		/* reset wrap/pan */
 		info->var.xoffset = info->var.yoffset = p->yscroll = 0;
-		p->vrows = info->var.yres_virtual / h;
-
-#if 0          /* INCOMPLETE - let the console gurus handle this */
-		if(info->var.yres > (h * (vc->vc_rows + 1))
-			p->vrows -= (info->var.yres - (h * vc->vc_rows)) / h;
-#endif
-		if ((info->var.yres % h)
-		    && (info->var.yres_virtual % h < info->var.yres % h))
-			p->vrows--;
-		updatescrollmode(p, vc);
 		vc_resize(vc->vc_num, info->var.xres / w, info->var.yres / h);
 		if (CON_IS_VISIBLE(vc) && softback_buf) {
 			int l = fbcon_softback_size / vc->vc_size_row;
@@ -2257,6 +2199,7 @@
  */
 
 const struct consw fb_con = {
+	.owner			= THIS_MODULE,
 	.con_startup 		= fbcon_startup,
 	.con_init 		= fbcon_init,
 	.con_deinit 		= fbcon_deinit,
@@ -2286,10 +2229,16 @@
 
 int __init fb_console_init(void)
 {
+	int err;
+
 	if (!num_registered_fb)
 		return -ENODEV;
 
-	take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
+	err = take_over_console(&fb_con, first_fb_vc, last_fb_vc,
+				fbcon_is_default);
+	if (err)
+		return err;
+
 	acquire_console_sem();
 	if (!fbcon_event_notifier_registered) {
 		fb_register_client(&fbcon_event_notifer);
diff -Nru a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
--- a/drivers/video/console/fbcon.h	Tue Jun 15 22:20:43 2004
+++ b/drivers/video/console/fbcon.h	Tue Jun 15 22:20:43 2004
@@ -27,7 +27,6 @@
     /* Filled in by the frame buffer device */
     u_short inverse;                /* != 0 text black on white as default */
     /* Filled in by the low-level console driver */
-    char fontname[40];              /* Font associated to this display */	
     u_char *fontdata;
     int userfont;                   /* != 0 if fontdata kmalloc()ed */
     u_short scrollmode;             /* Scroll Method */
diff -Nru a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
--- a/drivers/video/console/mdacon.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/video/console/mdacon.c	Tue Jun 15 22:20:41 2004
@@ -370,8 +370,6 @@
 
 	if (mda_display_fg == NULL)
 		mda_display_fg = c;
-
-	MOD_INC_USE_COUNT;
 }
 
 static void mdacon_deinit(struct vc_data *c)
@@ -380,8 +378,6 @@
 
 	if (mda_display_fg == c)
 		mda_display_fg = NULL;
-
-	MOD_DEC_USE_COUNT;
 }
 
 static inline u16 mda_convert_attr(u16 ch)
@@ -586,6 +582,7 @@
  */
 
 const struct consw mda_con = {
+	.owner =		THIS_MODULE,
 	.con_startup =		mdacon_startup,
 	.con_init =		mdacon_init,
 	.con_deinit =		mdacon_deinit,
@@ -609,8 +606,7 @@
 	if (mda_first_vc > mda_last_vc)
 		return 1;
 
-	take_over_console(&mda_con, mda_first_vc-1, mda_last_vc-1, 0);
-	return 0;
+	return take_over_console(&mda_con, mda_first_vc-1, mda_last_vc-1, 0);
 }
 
 void __exit mda_console_exit(void)
diff -Nru a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
--- a/drivers/video/console/newport_con.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/video/console/newport_con.c	Tue Jun 15 22:20:43 2004
@@ -32,6 +32,7 @@
 
 
 extern struct font_desc font_vga_8x16;
+extern unsigned long sgi_gfxaddr;
 
 #define FONT_DATA ((unsigned char *)font_vga_8x16.data)
 
@@ -43,7 +44,7 @@
 
 static unsigned char *font_data[MAX_NR_CONSOLES];
 
-extern struct newport_regs *npregs;
+static struct newport_regs *npregs;
 
 static int logo_active;
 static int topscan;
@@ -51,6 +52,8 @@
 static int newport_xsize;
 static int newport_ysize;
 
+static int newport_set_def_font(int unit, struct console_font_op *op);
+
 #define BMASK(c) (c << 24)
 
 #define RENDER(regs, cp) do { \
@@ -95,11 +98,33 @@
 	}
 }
 
+static void newport_show_logo(void)
+{
 #ifdef CONFIG_LOGO_SGI_CLUT224
-static void newport_show_logo(void);
-#else
-#define newport_show_logo()	do { } while (0)
-#endif
+	const struct linux_logo *logo = fb_find_logo(8);
+	const unsigned char *clut = logo->clut;
+	const unsigned char *data = logo->data;
+	unsigned long i;
+
+	for (i = 0; i < logo->clutsize; i++) {
+		newport_bfwait();
+		newport_cmap_setaddr(npregs, i + 0x20);
+		newport_cmap_setrgb(npregs, clut[0], clut[1], clut[2]);
+		clut += 3;
+	}
+
+	newport_wait();
+	npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
+				 NPORT_DMODE0_CHOST);
+
+	npregs->set.xystarti = ((newport_xsize - logo->width) << 16) | (0);
+	npregs->set.xyendi = ((newport_xsize - 1) << 16);
+	newport_wait();
+
+	for (i = 0; i < logo->width*logo->height; i++)
+		npregs->go.hostrw0 = *data++ << 24;
+#endif /* CONFIG_LOGO_SGI_CLUT224 */
+}
 
 static inline void newport_clear_screen(int xstart, int ystart, int xend,
 					int yend, int ci)
@@ -258,26 +283,22 @@
 		xcurs_correction = 21;
 }
 
-#ifdef MODULE
+/* Can't be __init, take_over_console may call it later */
 static const char *newport_startup(void)
-#else
-static const char *__init newport_startup(void)
-#endif
 {
 	int i;
-	struct newport_regs *p;
-
-	npregs = (struct newport_regs *) (KSEG1 + 0x1f0f0000);
 
-	p = npregs;
-	p->cset.config = NPORT_CFG_GD0;
+	if (!sgi_gfxaddr)
+		return NULL;
+	npregs = (struct newport_regs *) (KSEG1 + sgi_gfxaddr);
+	npregs->cset.config = NPORT_CFG_GD0;
 
 	if (newport_wait()) {
 		return NULL;
 	}
 
-	p->set.xstarti = TESTVAL;
-	if (p->set._xstart.word != XSTI_TO_FXSTART(TESTVAL))
+	npregs->set.xstarti = TESTVAL;
+	if (npregs->set._xstart.word != XSTI_TO_FXSTART(TESTVAL))
 		return NULL;
 
 	for (i = 0; i < MAX_NR_CONSOLES; i++)
@@ -287,8 +308,6 @@
 	newport_get_revisions();
 	newport_get_screensize();
 
-	/* gfx_init (display_desc); */
-
 	return "SGI Newport";
 }
 
@@ -299,6 +318,15 @@
 	vc->vc_can_do_color = 1;
 }
 
+static void newport_deinit(struct vc_data *c)
+{
+	int i;
+
+	/* free memory used by user font */
+	for (i = 0; i < MAX_NR_CONSOLES; i++)
+		newport_set_def_font(i, NULL);
+}
+
 static void newport_clear(struct vc_data *vc, int sy, int sx, int height,
 			  int width)
 {
@@ -677,9 +705,10 @@
 #define DUMMY (void *) newport_dummy
 
 const struct consw newport_con = {
+    .owner =		THIS_MODULE,
     .con_startup =	newport_startup,
     .con_init =		newport_init,
-    .con_deinit =	DUMMY,
+    .con_deinit =	newport_deinit,
     .con_clear =	newport_clear,
     .con_putc =		newport_putc,
     .con_putcs =	newport_putcs,
@@ -696,63 +725,18 @@
 };
 
 #ifdef MODULE
-MODULE_LICENSE("GPL");
-
-int init_module(void)
+static int __init newport_console_init(void)
 {
-	if (!newport_startup())
-		printk("Error loading SGI Newport Console driver\n");
-	else
-		printk("Loading SGI Newport Console Driver\n");
-	take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
-
-	return 0;
+	return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
 }
 
-int cleanup_module(void)
+static void __exit newport_console_exit(void)
 {
-	int i;
-
-	printk("Unloading SGI Newport Console Driver\n");
-	/* free memory used by user font */
-	for (i = 0; i < MAX_NR_CONSOLES; i++)
-		newport_set_def_font(i, NULL);
-
-	return 0;
+	give_up_console(&newport_con);
 }
-#endif
-
 
-#ifdef CONFIG_LOGO_SGI_CLUT224
-
-#undef __initdata
-#define __initdata
-#include "../logo/logo_sgi_clut224.c"
-
-static void newport_show_logo(void)
-{
-	const struct linux_logo *logo = &logo_sgi_clut224;
-	const unsigned char *clut = logo->clut;
-	const unsigned char *data = logo->data;
-	unsigned long i;
-
-	for (i = 0; i < logo->clutsize; i++) {
-		newport_bfwait();
-		newport_cmap_setaddr(npregs, i + 0x20);
-		newport_cmap_setrgb(npregs, clut[0], clut[1], clut[2]);
-		clut += 3;
-	}
-
-	newport_wait();
-	npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
-				 NPORT_DMODE0_CHOST);
-
-	npregs->set.xystarti = ((newport_xsize - logo->width) << 16) | (0);
-	npregs->set.xyendi = ((newport_xsize - 1) << 16);
-	newport_wait();
-
-	for (i = 0; i < logo->width*logo->height; i++)
-		npregs->go.hostrw0 = *data++ << 24;
-}
-#endif /* CONFIG_LOGO_SGI_CLUT224 */
+module_init(newport_console_init);
+module_exit(newport_console_exit);
+#endif
 
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/video/console/promcon.c b/drivers/video/console/promcon.c
--- a/drivers/video/console/promcon.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/video/console/promcon.c	Tue Jun 15 22:20:41 2004
@@ -574,6 +574,7 @@
 #define DUMMY (void *) promcon_dummy
 
 const struct consw prom_con = {
+	.owner =		THIS_MODULE,
 	.con_startup =		promcon_startup,
 	.con_init =		promcon_init,
 	.con_deinit =		promcon_deinit,
diff -Nru a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
--- a/drivers/video/console/sticon.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/video/console/sticon.c	Tue Jun 15 22:20:43 2004
@@ -354,6 +354,7 @@
 }
 
 static struct consw sti_con = {
+	.owner			= THIS_MODULE,
 	.con_startup		= sticon_startup,
 	.con_init		= sticon_init,
 	.con_deinit		= sticon_deinit,
@@ -390,7 +391,7 @@
 
     if (conswitchp == &dummy_con) {
 	printk(KERN_INFO "sticon: Initializing STI text console.\n");
-	take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1, 1);
+	return take_over_console(&sti_con, 0, MAX_NR_CONSOLES - 1, 1);
     }
     return 0;
 }
diff -Nru a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
--- a/drivers/video/console/vgacon.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/video/console/vgacon.c	Tue Jun 15 22:20:40 2004
@@ -1065,6 +1065,7 @@
 #define DUMMY (void *) vgacon_dummy
 
 const struct consw vga_con = {
+	.owner = THIS_MODULE,
 	.con_startup = vgacon_startup,
 	.con_init = vgacon_init,
 	.con_deinit = vgacon_deinit,
diff -Nru a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
--- a/drivers/video/cyber2000fb.c	Tue Jun 15 22:20:37 2004
+++ b/drivers/video/cyber2000fb.c	Tue Jun 15 22:20:37 2004
@@ -1721,7 +1721,7 @@
 	err = cyberpro_vl_probe();
 	if (!err) {
 		ret = 0;
-		MOD_INC_USE_COUNT;
+		__module_get(THIS_MODULE);
 	}
 #endif
 #ifdef CONFIG_PCI
diff -Nru a/drivers/video/cyberfb.c b/drivers/video/cyberfb.c
--- a/drivers/video/cyberfb.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/video/cyberfb.c	Tue Jun 15 22:20:36 2004
@@ -1065,7 +1065,6 @@
 		   fb_info.node, fb_info.modename, CyberSize>>10);
 
 	    /* TODO: This driver cannot be unloaded yet */
-	    MOD_INC_USE_COUNT;
 	    DPRINTK("EXIT\n");
 	    return 0;
 	}
@@ -1205,14 +1204,6 @@
 int init_module(void)
 {
 	return cyberfb_init();
-}
-
-void cleanup_module(void)
-{
-	/* Not reached because the usecount will never be
-	   decremented to zero */
-	unregister_framebuffer(&fb_info);
-	/* TODO: clean up ... */
 }
 #endif /* MODULE */
 
diff -Nru a/drivers/video/fbmem.c b/drivers/video/fbmem.c
--- a/drivers/video/fbmem.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/video/fbmem.c	Tue Jun 15 22:20:35 2004
@@ -114,6 +114,8 @@
 extern int chips_init(void);
 extern int g364fb_init(void);
 extern int sa1100fb_init(void);
+extern int pxafb_init(void);
+extern int pxafb_setup(char*);
 extern int fm2fb_init(void);
 extern int fm2fb_setup(char*);
 extern int q40fb_init(void);
@@ -121,6 +123,8 @@
 extern int sun3fb_setup(char *);
 extern int sgivwfb_init(void);
 extern int sgivwfb_setup(char*);
+extern int gbefb_init(void);
+extern int gbefb_setup(char*);
 extern int rivafb_init(void);
 extern int rivafb_setup(char*);
 extern int tdfxfb_init(void);
@@ -166,6 +170,8 @@
 extern int leo_setup(char*);
 extern int kyrofb_init(void);
 extern int kyrofb_setup(char*);
+extern int mc68x328fb_init(void);
+extern int mc68x328fb_setup(char *);
 
 static struct {
 	const char *name;
@@ -307,6 +313,9 @@
 #ifdef CONFIG_FB_SGIVW
 	{ "sgivwfb", sgivwfb_init, sgivwfb_setup },
 #endif
+#ifdef CONFIG_FB_GBE
+	{ "gbefb", gbefb_init, gbefb_setup },
+#endif
 #ifdef CONFIG_FB_ACORN
 	{ "acornfb", acornfb_init, acornfb_setup },
 #endif
@@ -340,6 +349,9 @@
 #ifdef CONFIG_FB_SA1100
 	{ "sa1100fb", sa1100fb_init, NULL },
 #endif
+#ifdef CONFIG_FB_PXA
+	{ "pxafb", pxafb_init, pxafb_setup },
+#endif
 #ifdef CONFIG_FB_SUN3
 	{ "sun3fb", sun3fb_init, sun3fb_setup },
 #endif
@@ -370,6 +382,9 @@
 #ifdef CONFIG_FB_KYRO
 	{ "kyrofb", kyrofb_init, kyrofb_setup },
 #endif
+#ifdef CONFIG_FB_68328
+	{ "68328fb", mc68x328fb_init, mc68x328fb_setup },
+#endif
 
 	/*
 	 * Generic drivers that don't use resource management (yet)
@@ -411,12 +426,13 @@
 /*
  * Drawing helpers.
  */
-u8 sys_inbuf(struct fb_info *info, u8 *src)
-{	
+static u8 fb_sys_inbuf(struct fb_info *info, u8 *src)
+{
 	return *src;
 }
 
-void sys_outbuf(struct fb_info *info, u8 *dst, u8 *src, unsigned int size)
+static void fb_sys_outbuf(struct fb_info *info, u8 *dst,
+				u8 *src, unsigned int size)
 {
 	memcpy(dst, src, size);
 }	
@@ -1013,7 +1029,7 @@
 	struct fb_con2fbmap con2fb;
 #endif
 	struct fb_cmap cmap;
-	int i, rc;
+	int i;
 	
 	if (!fb)
 		return -ENODEV;
@@ -1055,9 +1071,9 @@
 		return 0;
 	case FBIO_CURSOR:
 		acquire_console_sem();
-		rc = fb_cursor(info, (struct fb_cursor *) arg);
+		i = fb_cursor(info, (struct fb_cursor *) arg);
 		release_console_sem();
-		return rc;
+		return i;
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE
 	case FBIOGET_CON2FBMAP:
 		if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb)))
@@ -1178,8 +1194,7 @@
 	if (boot_cpu_data.x86 > 3)
 		pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
 #elif defined(__mips__)
-	pgprot_val(vma->vm_page_prot) &= ~_CACHE_MASK;
-	pgprot_val(vma->vm_page_prot) |= _CACHE_UNCACHED;
+	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 #elif defined(__hppa__)
 	pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
 #elif defined(__ia64__) || defined(__arm__) || defined(__sh__)
@@ -1286,14 +1301,15 @@
 			fb_info->pixmap.size = FBPIXMAPSIZE;
 			fb_info->pixmap.buf_align = 1;
 			fb_info->pixmap.scan_align = 1;
+			fb_info->pixmap.access_align = 4;
 			fb_info->pixmap.flags = FB_PIXMAP_DEFAULT;
 		}
 	}	
 	fb_info->pixmap.offset = 0;
 	if (fb_info->pixmap.outbuf == NULL)
-		fb_info->pixmap.outbuf = sys_outbuf;
+		fb_info->pixmap.outbuf = fb_sys_outbuf;
 	if (fb_info->pixmap.inbuf == NULL)
-		fb_info->pixmap.inbuf = sys_inbuf;
+		fb_info->pixmap.inbuf = fb_sys_inbuf;
 
 	if (fb_info->sprite.addr == NULL) {
 		fb_info->sprite.addr = kmalloc(FBPIXMAPSIZE, GFP_KERNEL);
@@ -1301,14 +1317,15 @@
 			fb_info->sprite.size = FBPIXMAPSIZE;
 			fb_info->sprite.buf_align = 1;
 			fb_info->sprite.scan_align = 1;
+			fb_info->sprite.access_align = 4;
 			fb_info->sprite.flags = FB_PIXMAP_DEFAULT;
 		}
 	}
 	fb_info->sprite.offset = 0;
 	if (fb_info->sprite.outbuf == NULL)
-		fb_info->sprite.outbuf = sys_outbuf;
+		fb_info->sprite.outbuf = fb_sys_outbuf;
 	if (fb_info->sprite.inbuf == NULL)
-		fb_info->sprite.inbuf = sys_inbuf;
+		fb_info->sprite.inbuf = fb_sys_inbuf;
 
 	registered_fb[i] = fb_info;
 
diff -Nru a/drivers/video/gbefb.c b/drivers/video/gbefb.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/video/gbefb.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1200 @@
+/*
+ *  SGI GBE frame buffer driver
+ *
+ *  Copyright (C) 1999 Silicon Graphics, Inc. - Jeffrey Newquist
+ *  Copyright (C) 2002 Vivien Chappelier <vivien.chappelier@linux-mips.org>
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License. See the file COPYING in the main directory of this archive for
+ *  more details.
+ */
+
+#include <linux/config.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/errno.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+
+#ifdef CONFIG_X86
+#include <asm/mtrr.h>
+#endif
+#ifdef CONFIG_MIPS
+#include <asm/addrspace.h>
+#endif
+#include <asm/byteorder.h>
+#include <asm/io.h>
+#include <asm/tlbflush.h>
+
+#include <video/gbe.h>
+
+static struct sgi_gbe *gbe;
+
+struct gbefb_par {
+	struct fb_var_screeninfo var;
+	struct gbe_timing_info timing;
+	int valid;
+};
+
+#ifdef CONFIG_SGI_IP32
+#define GBE_BASE	0x16000000 /* SGI O2 */
+#endif
+
+#ifdef CONFIG_X86_VISWS
+#define GBE_BASE	0xd0000000 /* SGI Visual Workstation */
+#endif
+
+/* macro for fastest write-though access to the framebuffer */
+#ifdef CONFIG_MIPS
+#ifdef CONFIG_CPU_R10000
+#define pgprot_fb(_prot) (((_prot) & (~_CACHE_MASK)) | _CACHE_UNCACHED_ACCELERATED)
+#else
+#define pgprot_fb(_prot) (((_prot) & (~_CACHE_MASK)) | _CACHE_CACHABLE_NO_WA)
+#endif
+#endif
+#ifdef CONFIG_X86
+#define pgprot_fb(_prot) ((_prot) | _PAGE_PCD)
+#endif
+
+/*
+ *  RAM we reserve for the frame buffer. This defines the maximum screen
+ *  size
+ */
+#if CONFIG_FB_GBE_MEM > 8
+#error GBE Framebuffer cannot use more than 8MB of memory
+#endif
+
+#define TILE_SHIFT 16
+#define TILE_SIZE (1 << TILE_SHIFT)
+#define TILE_MASK (TILE_SIZE - 1)
+
+static unsigned int gbe_mem_size = CONFIG_FB_GBE_MEM * 1024*1024;
+static void *gbe_mem;
+static dma_addr_t gbe_dma_addr;
+unsigned long gbe_mem_phys;
+
+static struct {
+	uint16_t *cpu;
+	dma_addr_t dma;
+} gbe_tiles;
+
+static int gbe_revision;
+
+static struct fb_info fb_info;
+static int ypan, ywrap;
+
+static uint32_t pseudo_palette[256];
+
+static char *mode_option __initdata = NULL;
+
+/* default CRT mode */
+static struct fb_var_screeninfo default_var_CRT __initdata = {
+	/* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
+	.xres		= 640,
+	.yres		= 480,
+	.xres_virtual	= 640,
+	.yres_virtual	= 480,
+	.xoffset	= 0,
+	.yoffset	= 0,
+	.bits_per_pixel	= 8,
+	.grayscale	= 0,
+	.red		= { 0, 8, 0 },
+	.green		= { 0, 8, 0 },
+	.blue		= { 0, 8, 0 },
+	.transp		= { 0, 0, 0 },
+	.nonstd		= 0,
+	.activate	= 0,
+	.height		= -1,
+	.width		= -1,
+	.accel_flags	= 0,
+	.pixclock	= 39722,	/* picoseconds */
+	.left_margin	= 48,
+	.right_margin	= 16,
+	.upper_margin	= 33,
+	.lower_margin	= 10,
+	.hsync_len	= 96,
+	.vsync_len	= 2,
+	.sync		= 0,
+	.vmode		= FB_VMODE_NONINTERLACED,
+};
+
+/* default LCD mode */
+static struct fb_var_screeninfo default_var_LCD __initdata = {
+	/* 1600x1024, 8 bpp */
+	.xres		= 1600,
+	.yres		= 1024,
+	.xres_virtual	= 1600,
+	.yres_virtual	= 1024,
+	.xoffset	= 0,
+	.yoffset	= 0,
+	.bits_per_pixel	= 8,
+	.grayscale	= 0,
+	.red		= { 0, 8, 0 },
+	.green		= { 0, 8, 0 },
+	.blue		= { 0, 8, 0 },
+	.transp		= { 0, 0, 0 },
+	.nonstd		= 0,
+	.activate	= 0,
+	.height		= -1,
+	.width		= -1,
+	.accel_flags	= 0,
+	.pixclock	= 9353,
+	.left_margin	= 20,
+	.right_margin	= 30,
+	.upper_margin	= 37,
+	.lower_margin	= 3,
+	.hsync_len	= 20,
+	.vsync_len	= 3,
+	.sync		= 0,
+	.vmode		= FB_VMODE_NONINTERLACED
+};
+
+/* default modedb mode */
+/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */
+static struct fb_videomode default_mode_CRT __initdata = {
+	.refresh	= 60,
+	.xres		= 640,
+	.yres		= 480,
+	.pixclock	= 39722,
+	.left_margin	= 48,
+	.right_margin	= 16,
+	.upper_margin	= 33,
+	.lower_margin	= 10,
+	.hsync_len	= 96,
+	.vsync_len	= 2,
+	.sync		= 0,
+	.vmode		= FB_VMODE_NONINTERLACED,
+};
+/* 1600x1024 SGI flatpanel 1600sw */
+static struct fb_videomode default_mode_LCD __initdata = {
+	/* 1600x1024, 8 bpp */
+	.xres		= 1600,
+	.yres		= 1024,
+	.pixclock	= 9353,
+	.left_margin	= 20,
+	.right_margin	= 30,
+	.upper_margin	= 37,
+	.lower_margin	= 3,
+	.hsync_len	= 20,
+	.vsync_len	= 3,
+	.vmode		= FB_VMODE_NONINTERLACED,
+};
+
+struct fb_videomode *default_mode = &default_mode_CRT;
+struct fb_var_screeninfo *default_var = &default_var_CRT;
+
+static int flat_panel_enabled = 0;
+
+static struct gbefb_par par_current;
+
+static void gbe_reset(void)
+{
+	/* Turn on dotclock PLL */
+	gbe->ctrlstat = 0x300aa000;
+}
+
+
+/*
+ * Function:	gbe_turn_off
+ * Parameters:	(None)
+ * Description:	This should turn off the monitor and gbe.  This is used
+ *              when switching between the serial console and the graphics
+ *              console.
+ */
+
+void gbe_turn_off(void)
+{
+	int i;
+	unsigned int val, x, y, vpixen_off;
+
+	/* check if pixel counter is on */
+	val = gbe->vt_xy;
+	if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 1)
+		return;
+
+	/* turn off DMA */
+	val = gbe->ovr_control;
+	SET_GBE_FIELD(OVR_CONTROL, OVR_DMA_ENABLE, val, 0);
+	gbe->ovr_control = val;
+	udelay(1000);
+	val = gbe->frm_control;
+	SET_GBE_FIELD(FRM_CONTROL, FRM_DMA_ENABLE, val, 0);
+	gbe->frm_control = val;
+	udelay(1000);
+	val = gbe->did_control;
+	SET_GBE_FIELD(DID_CONTROL, DID_DMA_ENABLE, val, 0);
+	gbe->did_control = val;
+	udelay(1000);
+
+	/* We have to wait through two vertical retrace periods before
+	 * the pixel DMA is turned off for sure. */
+	for (i = 0; i < 10000; i++) {
+		val = gbe->frm_inhwctrl;
+		if (GET_GBE_FIELD(FRM_INHWCTRL, FRM_DMA_ENABLE, val)) {
+			udelay(10);
+		} else {
+			val = gbe->ovr_inhwctrl;
+			if (GET_GBE_FIELD(OVR_INHWCTRL, OVR_DMA_ENABLE, val)) {
+				udelay(10);
+			} else {
+				val = gbe->did_inhwctrl;
+				if (GET_GBE_FIELD(DID_INHWCTRL, DID_DMA_ENABLE, val)) {
+					udelay(10);
+				} else
+					break;
+			}
+		}
+	}
+	if (i == 10000)
+		printk(KERN_ERR "gbefb: turn off DMA timed out\n");
+
+	/* wait for vpixen_off */
+	val = gbe->vt_vpixen;
+	vpixen_off = GET_GBE_FIELD(VT_VPIXEN, VPIXEN_OFF, val);
+
+	for (i = 0; i < 100000; i++) {
+		val = gbe->vt_xy;
+		x = GET_GBE_FIELD(VT_XY, X, val);
+		y = GET_GBE_FIELD(VT_XY, Y, val);
+		if (y < vpixen_off)
+			break;
+		udelay(1);
+	}
+	if (i == 100000)
+		printk(KERN_ERR
+		       "gbefb: wait for vpixen_off timed out\n");
+	for (i = 0; i < 10000; i++) {
+		val = gbe->vt_xy;
+		x = GET_GBE_FIELD(VT_XY, X, val);
+		y = GET_GBE_FIELD(VT_XY, Y, val);
+		if (y > vpixen_off)
+			break;
+		udelay(1);
+	}
+	if (i == 10000)
+		printk(KERN_ERR "gbefb: wait for vpixen_off timed out\n");
+
+	/* turn off pixel counter */
+	val = 0;
+	SET_GBE_FIELD(VT_XY, FREEZE, val, 1);
+	gbe->vt_xy = val;
+	udelay(10000);
+	for (i = 0; i < 10000; i++) {
+		val = gbe->vt_xy;
+		if (GET_GBE_FIELD(VT_XY, FREEZE, val) != 1)
+			udelay(10);
+		else
+			break;
+	}
+	if (i == 10000)
+		printk(KERN_ERR "gbefb: turn off pixel clock timed out\n");
+
+	/* turn off dot clock */
+	val = gbe->dotclock;
+	SET_GBE_FIELD(DOTCLK, RUN, val, 0);
+	gbe->dotclock = val;
+	udelay(10000);
+	for (i = 0; i < 10000; i++) {
+		val = gbe->dotclock;
+		if (GET_GBE_FIELD(DOTCLK, RUN, val))
+			udelay(10);
+		else
+			break;
+	}
+	if (i == 10000)
+		printk(KERN_ERR "gbefb: turn off dotclock timed out\n");
+
+	/* reset the frame DMA FIFO */
+	val = gbe->frm_size_tile;
+	SET_GBE_FIELD(FRM_SIZE_TILE, FRM_FIFO_RESET, val, 1);
+	gbe->frm_size_tile = val;
+	SET_GBE_FIELD(FRM_SIZE_TILE, FRM_FIFO_RESET, val, 0);
+	gbe->frm_size_tile = val;
+}
+
+static void gbe_turn_on(void)
+{
+	unsigned int val, i;
+
+	/*
+	 * Check if pixel counter is off, for unknown reason this
+	 * code hangs Visual Workstations
+	 */
+	if (gbe_revision < 2) {
+		val = gbe->vt_xy;
+		if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 0)
+			return;
+	}
+
+	/* turn on dot clock */
+	val = gbe->dotclock;
+	SET_GBE_FIELD(DOTCLK, RUN, val, 1);
+	gbe->dotclock = val;
+	udelay(10000);
+	for (i = 0; i < 10000; i++) {
+		val = gbe->dotclock;
+		if (GET_GBE_FIELD(DOTCLK, RUN, val) != 1)
+			udelay(10);
+		else
+			break;
+	}
+	if (i == 10000)
+		printk(KERN_ERR "gbefb: turn on dotclock timed out\n");
+
+	/* turn on pixel counter */
+	val = 0;
+	SET_GBE_FIELD(VT_XY, FREEZE, val, 0);
+	gbe->vt_xy = val;
+	udelay(10000);
+	for (i = 0; i < 10000; i++) {
+		val = gbe->vt_xy;
+		if (GET_GBE_FIELD(VT_XY, FREEZE, val))
+			udelay(10);
+		else
+			break;
+	}
+	if (i == 10000)
+		printk(KERN_ERR "gbefb: turn on pixel clock timed out\n");
+
+	/* turn on DMA */
+	val = gbe->frm_control;
+	SET_GBE_FIELD(FRM_CONTROL, FRM_DMA_ENABLE, val, 1);
+	gbe->frm_control = val;
+	udelay(1000);
+	for (i = 0; i < 10000; i++) {
+		val = gbe->frm_inhwctrl;
+		if (GET_GBE_FIELD(FRM_INHWCTRL, FRM_DMA_ENABLE, val) != 1)
+			udelay(10);
+		else
+			break;
+	}
+	if (i == 10000)
+		printk(KERN_ERR "gbefb: turn on DMA timed out\n");
+}
+
+/*
+ *  Blank the display.
+ */
+static int gbefb_blank(int blank, struct fb_info *info)
+{
+	/* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */
+	switch (blank) {
+	case 0:		/* unblank */
+		gbe_turn_on();
+		break;
+
+	case 1:		/* blank */
+		gbe_turn_off();
+		break;
+
+	default:
+		/* Nothing */
+		break;
+	}
+	return 0;
+}
+
+/*
+ *  Setup flatpanel related registers.
+ */
+static void gbefb_setup_flatpanel(struct gbe_timing_info *timing)
+{
+	int fp_wid, fp_hgt, fp_vbs, fp_vbe;
+	u32 outputVal = 0;
+
+	SET_GBE_FIELD(VT_FLAGS, HDRV_INVERT, outputVal,
+		(timing->flags & FB_SYNC_HOR_HIGH_ACT) ? 0 : 1);
+	SET_GBE_FIELD(VT_FLAGS, VDRV_INVERT, outputVal,
+		(timing->flags & FB_SYNC_VERT_HIGH_ACT) ? 0 : 1);
+	gbe->vt_flags = outputVal;
+
+	/* Turn on the flat panel */
+	fp_wid = 1600;
+	fp_hgt = 1024;
+	fp_vbs = 0;
+	fp_vbe = 1600;
+	timing->pll_m = 4;
+	timing->pll_n = 1;
+	timing->pll_p = 0;
+
+	outputVal = 0;
+	SET_GBE_FIELD(FP_DE, ON, outputVal, fp_vbs);
+	SET_GBE_FIELD(FP_DE, OFF, outputVal, fp_vbe);
+	gbe->fp_de = outputVal;
+	outputVal = 0;
+	SET_GBE_FIELD(FP_HDRV, OFF, outputVal, fp_wid);
+	gbe->fp_hdrv = outputVal;
+	outputVal = 0;
+	SET_GBE_FIELD(FP_VDRV, ON, outputVal, 1);
+	SET_GBE_FIELD(FP_VDRV, OFF, outputVal, fp_hgt + 1);
+	gbe->fp_vdrv = outputVal;
+}
+
+struct gbe_pll_info {
+	int clock_rate;
+	int fvco_min;
+	int fvco_max;
+};
+
+static struct gbe_pll_info gbe_pll_table[2] = {
+	{ 20, 80, 220 },
+	{ 27, 80, 220 },
+};
+
+static int compute_gbe_timing(struct fb_var_screeninfo *var,
+			      struct gbe_timing_info *timing)
+{
+	int pll_m, pll_n, pll_p, error, best_m, best_n, best_p, best_error;
+	int pixclock;
+	struct gbe_pll_info *gbe_pll;
+
+	if (gbe_revision < 2)
+		gbe_pll = &gbe_pll_table[0];
+	else
+		gbe_pll = &gbe_pll_table[1];
+
+	/* Determine valid resolution and timing
+	 * GBE crystal runs at 20Mhz or 27Mhz
+	 * pll_m, pll_n, pll_p define the following frequencies
+	 * fvco = pll_m * 20Mhz / pll_n
+	 * fout = fvco / (2**pll_p) */
+	best_error = 1000000000;
+	best_n = best_m = best_p = 0;
+	for (pll_p = 0; pll_p < 4; pll_p++)
+		for (pll_m = 1; pll_m < 256; pll_m++)
+			for (pll_n = 1; pll_n < 64; pll_n++) {
+				pixclock = (1000000 / gbe_pll->clock_rate) *
+						(pll_n << pll_p) / pll_m;
+
+				error = var->pixclock - pixclock;
+
+				if (error < 0)
+					error = -error;
+
+				if (error < best_error &&
+				    pll_m / pll_n >
+				    gbe_pll->fvco_min / gbe_pll->clock_rate &&
+ 				    pll_m / pll_n <
+				    gbe_pll->fvco_max / gbe_pll->clock_rate) {
+					best_error = error;
+					best_m = pll_m;
+					best_n = pll_n;
+					best_p = pll_p;
+				}
+			}
+
+	if (!best_n || !best_m)
+		return -EINVAL;	/* Resolution to high */
+
+	pixclock = (1000000 / gbe_pll->clock_rate) *
+		(best_n << best_p) / best_m;
+
+	/* set video timing information */
+	if (timing) {
+		timing->width = var->xres;
+		timing->height = var->yres;
+		timing->pll_m = best_m;
+		timing->pll_n = best_n;
+		timing->pll_p = best_p;
+		timing->cfreq = gbe_pll->clock_rate * 1000 * timing->pll_m /
+			(timing->pll_n << timing->pll_p);
+		timing->htotal = var->left_margin + var->xres +
+				var->right_margin + var->hsync_len;
+		timing->vtotal = var->upper_margin + var->yres +
+				var->lower_margin + var->vsync_len;
+		timing->fields_sec = 1000 * timing->cfreq / timing->htotal *
+				1000 / timing->vtotal;
+		timing->hblank_start = var->xres;
+		timing->vblank_start = var->yres;
+		timing->hblank_end = timing->htotal;
+		timing->hsync_start = var->xres + var->right_margin + 1;
+		timing->hsync_end = timing->hsync_start + var->hsync_len;
+		timing->vblank_end = timing->vtotal;
+		timing->vsync_start = var->yres + var->lower_margin + 1;
+		timing->vsync_end = timing->vsync_start + var->vsync_len;
+	}
+
+	return pixclock;
+}
+
+static void gbe_set_timing_info(struct gbe_timing_info *timing)
+{
+	int temp;
+	unsigned int val;
+
+	/* setup dot clock PLL */
+	val = 0;
+	SET_GBE_FIELD(DOTCLK, M, val, timing->pll_m - 1);
+	SET_GBE_FIELD(DOTCLK, N, val, timing->pll_n - 1);
+	SET_GBE_FIELD(DOTCLK, P, val, timing->pll_p);
+	SET_GBE_FIELD(DOTCLK, RUN, val, 0);	/* do not start yet */
+	gbe->dotclock = val;
+	udelay(10000);
+
+	/* setup pixel counter */
+	val = 0;
+	SET_GBE_FIELD(VT_XYMAX, MAXX, val, timing->htotal);
+	SET_GBE_FIELD(VT_XYMAX, MAXY, val, timing->vtotal);
+	gbe->vt_xymax = val;
+
+	/* setup video timing signals */
+	val = 0;
+	SET_GBE_FIELD(VT_VSYNC, VSYNC_ON, val, timing->vsync_start);
+	SET_GBE_FIELD(VT_VSYNC, VSYNC_OFF, val, timing->vsync_end);
+	gbe->vt_vsync = val;
+	val = 0;
+	SET_GBE_FIELD(VT_HSYNC, HSYNC_ON, val, timing->hsync_start);
+	SET_GBE_FIELD(VT_HSYNC, HSYNC_OFF, val, timing->hsync_end);
+	gbe->vt_hsync = val;
+	val = 0;
+	SET_GBE_FIELD(VT_VBLANK, VBLANK_ON, val, timing->vblank_start);
+	SET_GBE_FIELD(VT_VBLANK, VBLANK_OFF, val, timing->vblank_end);
+	gbe->vt_vblank = val;
+	val = 0;
+	SET_GBE_FIELD(VT_HBLANK, HBLANK_ON, val,
+		      timing->hblank_start - 5);
+	SET_GBE_FIELD(VT_HBLANK, HBLANK_OFF, val,
+		      timing->hblank_end - 3);
+	gbe->vt_hblank = val;
+
+	/* setup internal timing signals */
+	val = 0;
+	SET_GBE_FIELD(VT_VCMAP, VCMAP_ON, val, timing->vblank_start);
+	SET_GBE_FIELD(VT_VCMAP, VCMAP_OFF, val, timing->vblank_end);
+	gbe->vt_vcmap = val;
+	val = 0;
+	SET_GBE_FIELD(VT_HCMAP, HCMAP_ON, val, timing->hblank_start);
+	SET_GBE_FIELD(VT_HCMAP, HCMAP_OFF, val, timing->hblank_end);
+	gbe->vt_hcmap = val;
+
+	val = 0;
+	temp = timing->vblank_start - timing->vblank_end - 1;
+	if (temp > 0)
+		temp = -temp;
+
+	if (flat_panel_enabled)
+		gbefb_setup_flatpanel(timing);
+
+	SET_GBE_FIELD(DID_START_XY, DID_STARTY, val, (u32) temp);
+	if (timing->hblank_end >= 20)
+		SET_GBE_FIELD(DID_START_XY, DID_STARTX, val,
+			      timing->hblank_end - 20);
+	else
+		SET_GBE_FIELD(DID_START_XY, DID_STARTX, val,
+			      timing->htotal - (20 - timing->hblank_end));
+	gbe->did_start_xy = val;
+
+	val = 0;
+	SET_GBE_FIELD(CRS_START_XY, CRS_STARTY, val, (u32) (temp + 1));
+	if (timing->hblank_end >= GBE_CRS_MAGIC)
+		SET_GBE_FIELD(CRS_START_XY, CRS_STARTX, val,
+			      timing->hblank_end - GBE_CRS_MAGIC);
+	else
+		SET_GBE_FIELD(CRS_START_XY, CRS_STARTX, val,
+			      timing->htotal - (GBE_CRS_MAGIC -
+						timing->hblank_end));
+	gbe->crs_start_xy = val;
+
+	val = 0;
+	SET_GBE_FIELD(VC_START_XY, VC_STARTY, val, (u32) temp);
+	SET_GBE_FIELD(VC_START_XY, VC_STARTX, val, timing->hblank_end - 4);
+	gbe->vc_start_xy = val;
+
+	val = 0;
+	temp = timing->hblank_end - GBE_PIXEN_MAGIC_ON;
+	if (temp < 0)
+		temp += timing->htotal;	/* allow blank to wrap around */
+
+	SET_GBE_FIELD(VT_HPIXEN, HPIXEN_ON, val, temp);
+	SET_GBE_FIELD(VT_HPIXEN, HPIXEN_OFF, val,
+		      ((temp + timing->width -
+			GBE_PIXEN_MAGIC_OFF) % timing->htotal));
+	gbe->vt_hpixen = val;
+
+	val = 0;
+	SET_GBE_FIELD(VT_VPIXEN, VPIXEN_ON, val, timing->vblank_end);
+	SET_GBE_FIELD(VT_VPIXEN, VPIXEN_OFF, val, timing->vblank_start);
+	gbe->vt_vpixen = val;
+
+	/* turn off sync on green */
+	val = 0;
+	SET_GBE_FIELD(VT_FLAGS, SYNC_LOW, val, 1);
+	gbe->vt_flags = val;
+}
+
+/*
+ *  Set the hardware according to 'par'.
+ */
+
+static int gbefb_set_par(struct fb_info *info)
+{
+	int i;
+	unsigned int val;
+	int wholeTilesX, partTilesX, maxPixelsPerTileX;
+	int height_pix;
+	int xpmax, ypmax;	/* Monitor resolution */
+	int bytesPerPixel;	/* Bytes per pixel */
+	struct gbefb_par *par = (struct gbefb_par *) info->par;
+
+	compute_gbe_timing(&info->var, &par->timing);
+
+	bytesPerPixel = info->var.bits_per_pixel / 8;
+	info->fix.line_length = info->var.xres_virtual * bytesPerPixel;
+	xpmax = par->timing.width;
+	ypmax = par->timing.height;
+
+	/* turn off GBE */
+	gbe_turn_off();
+
+	/* set timing info */
+	gbe_set_timing_info(&par->timing);
+
+	/* initialize DIDs */
+	val = 0;
+	switch (bytesPerPixel) {
+	case 1:
+		SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_I8);
+		break;
+	case 2:
+		SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_ARGB5);
+		break;
+	case 4:
+		SET_GBE_FIELD(WID, TYP, val, GBE_CMODE_RGB8);
+		break;
+	}
+	SET_GBE_FIELD(WID, BUF, val, GBE_BMODE_BOTH);
+
+	for (i = 0; i < 32; i++)
+		gbe->mode_regs[i] = val;
+
+	/* Initialize interrupts */
+	gbe->vt_intr01 = 0xffffffff;
+	gbe->vt_intr23 = 0xffffffff;
+
+	/* HACK:
+	   The GBE hardware uses a tiled memory to screen mapping. Tiles are
+	   blocks of 512x128, 256x128 or 128x128 pixels, respectively for 8bit,
+	   16bit and 32 bit modes (64 kB). They cover the screen with partial
+	   tiles on the right and/or bottom of the screen if needed.
+	   For exemple in 640x480 8 bit mode the mapping is:
+
+	   <-------- 640 ----->
+	   <---- 512 ----><128|384 offscreen>
+	   ^  ^
+	   | 128    [tile 0]        [tile 1]
+	   |  v
+	   ^
+	   4 128    [tile 2]        [tile 3]
+	   8  v
+	   0  ^
+	   128    [tile 4]        [tile 5]
+	   |  v
+	   |  ^
+	   v  96    [tile 6]        [tile 7]
+	   32 offscreen
+
+	   Tiles have the advantage that they can be allocated individually in
+	   memory. However, this mapping is not linear at all, which is not
+	   really convienient. In order to support linear addressing, the GBE
+	   DMA hardware is fooled into thinking the screen is only one tile
+	   large and but has a greater height, so that the DMA transfer covers
+	   the same region.
+	   Tiles are still allocated as independent chunks of 64KB of
+	   continuous physical memory and remapped so that the kernel sees the
+	   framebuffer as a continuous virtual memory. The GBE tile table is
+	   set up so that each tile references one of these 64k blocks:
+
+	   GBE -> tile list    framebuffer           TLB   <------------ CPU
+	          [ tile 0 ] -> [ 64KB ]  <- [ 16x 4KB page entries ]     ^
+	             ...           ...              ...       linear virtual FB
+	          [ tile n ] -> [ 64KB ]  <- [ 16x 4KB page entries ]     v
+
+
+	   The GBE hardware is then told that the buffer is 512*tweaked_height,
+	   with tweaked_height = real_width*real_height/pixels_per_tile.
+	   Thus the GBE hardware will scan the first tile, filing the first 64k
+	   covered region of the screen, and then will proceed to the next
+	   tile, until the whole screen is covered.
+
+	   Here is what would happen at 640x480 8bit:
+
+	   normal tiling               linear
+	   ^   11111111111111112222    11111111111111111111  ^
+	   128 11111111111111112222    11111111111111111111 102 lines
+	       11111111111111112222    11111111111111111111  v
+	   V   11111111111111112222    11111111222222222222
+	       33333333333333334444    22222222222222222222
+	       33333333333333334444    22222222222222222222
+	       <      512     >        <  256 >               102*640+256 = 64k
+
+	   NOTE: The only mode for which this is not working is 800x600 8bit,
+	   as 800*600/512 = 937.5 which is not integer and thus causes
+	   flickering.
+	   I guess this is not so important as one can use 640x480 8bit or
+	   800x600 16bit anyway.
+	 */
+
+	/* Tell gbe about the tiles table location */
+	/* tile_ptr -> [ tile 1 ] -> FB mem */
+	/*             [ tile 2 ] -> FB mem */
+	/*               ...                */
+	val = 0;
+	SET_GBE_FIELD(FRM_CONTROL, FRM_TILE_PTR, val, gbe_tiles.dma >> 9);
+	SET_GBE_FIELD(FRM_CONTROL, FRM_DMA_ENABLE, val, 0); /* do not start */
+	SET_GBE_FIELD(FRM_CONTROL, FRM_LINEAR, val, 0);
+	gbe->frm_control = val;
+
+	maxPixelsPerTileX = 512 / bytesPerPixel;
+	wholeTilesX = 1;
+	partTilesX = 0;
+
+	/* Initialize the framebuffer */
+	val = 0;
+	SET_GBE_FIELD(FRM_SIZE_TILE, FRM_WIDTH_TILE, val, wholeTilesX);
+	SET_GBE_FIELD(FRM_SIZE_TILE, FRM_RHS, val, partTilesX);
+
+	switch (bytesPerPixel) {
+	case 1:
+		SET_GBE_FIELD(FRM_SIZE_TILE, FRM_DEPTH, val,
+			      GBE_FRM_DEPTH_8);
+		break;
+	case 2:
+		SET_GBE_FIELD(FRM_SIZE_TILE, FRM_DEPTH, val,
+			      GBE_FRM_DEPTH_16);
+		break;
+	case 4:
+		SET_GBE_FIELD(FRM_SIZE_TILE, FRM_DEPTH, val,
+			      GBE_FRM_DEPTH_32);
+		break;
+	}
+	gbe->frm_size_tile = val;
+
+	/* compute tweaked height */
+	height_pix = xpmax * ypmax / maxPixelsPerTileX;
+
+	val = 0;
+	SET_GBE_FIELD(FRM_SIZE_PIXEL, FB_HEIGHT_PIX, val, height_pix);
+	gbe->frm_size_pixel = val;
+
+	/* turn off DID and overlay DMA */
+	gbe->did_control = 0;
+	gbe->ovr_width_tile = 0;
+
+	/* Turn off mouse cursor */
+	gbe->crs_ctl = 0;
+
+	/* Turn on GBE */
+	gbe_turn_on();
+
+	/* Initialize the gamma map */
+	udelay(10);
+	for (i = 0; i < 256; i++)
+		gbe->gmap[i] = (i << 24) | (i << 16) | (i << 8);
+
+	/* Initialize the color map */
+	for (i = 0; i < 256; i++) {
+		int j;
+
+		for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++)
+			udelay(10);
+		if (j == 1000)
+			printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
+
+		gbe->cmap[i] = (i << 8) | (i << 16) | (i << 24);
+	}
+
+	return 0;
+}
+
+static void gbefb_encode_fix(struct fb_fix_screeninfo *fix,
+			     struct fb_var_screeninfo *var)
+{
+	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
+	strcpy(fix->id, "SGI GBE");
+	fix->smem_start = (unsigned long) gbe_mem;
+	fix->smem_len = gbe_mem_size;
+	fix->type = FB_TYPE_PACKED_PIXELS;
+	fix->type_aux = 0;
+	fix->accel = FB_ACCEL_NONE;
+	switch (var->bits_per_pixel) {
+	case 8:
+		fix->visual = FB_VISUAL_PSEUDOCOLOR;
+		break;
+	default:
+		fix->visual = FB_VISUAL_TRUECOLOR;
+		break;
+	}
+	fix->ywrapstep = 0;
+	fix->xpanstep = 0;
+	fix->ypanstep = 0;
+	fix->line_length = var->xres_virtual * var->bits_per_pixel / 8;
+	fix->mmio_start = GBE_BASE;
+	fix->mmio_len = sizeof(struct sgi_gbe);
+}
+
+/*
+ *  Set a single color register. The values supplied are already
+ *  rounded down to the hardware's capabilities (according to the
+ *  entries in the var structure). Return != 0 for invalid regno.
+ */
+
+static int gbefb_setcolreg(unsigned regno, unsigned red, unsigned green,
+			     unsigned blue, unsigned transp,
+			     struct fb_info *info)
+{
+	int i;
+
+	if (regno > 255)
+		return 1;
+	red >>= 8;
+	green >>= 8;
+	blue >>= 8;
+
+	switch (info->var.bits_per_pixel) {
+	case 8:
+		/* wait for the color map FIFO to have a free entry */
+		for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++)
+			udelay(10);
+		if (i == 1000) {
+			printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
+			return 1;
+		}
+		gbe->cmap[regno] = (red << 24) | (green << 16) | (blue << 8);
+		break;
+	case 15:
+	case 16:
+		red >>= 3;
+		green >>= 3;
+		blue >>= 3;
+		pseudo_palette[regno] =
+			(red << info->var.red.offset) |
+			(green << info->var.green.offset) |
+			(blue << info->var.blue.offset);
+		break;
+	case 32:
+		pseudo_palette[regno] =
+			(red << info->var.red.offset) |
+			(green << info->var.green.offset) |
+			(blue << info->var.blue.offset);
+		break;
+	}
+
+	return 0;
+}
+
+/*
+ *  Check video mode validity, eventually modify var to best match.
+ */
+static int gbefb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
+{
+	unsigned int line_length;
+	struct gbe_timing_info timing;
+
+	/* Limit bpp to 8, 16, and 32 */
+	if (var->bits_per_pixel <= 8)
+		var->bits_per_pixel = 8;
+	else if (var->bits_per_pixel <= 16)
+		var->bits_per_pixel = 16;
+	else if (var->bits_per_pixel <= 32)
+		var->bits_per_pixel = 32;
+	else
+		return -EINVAL;
+
+	/* Check the mode can be mapped linearly with the tile table trick. */
+	/* This requires width x height x bytes/pixel be a multiple of 512 */
+	if ((var->xres * var->yres * var->bits_per_pixel) & 4095)
+		return -EINVAL;
+
+	var->grayscale = 0;	/* No grayscale for now */
+
+	if ((var->pixclock = compute_gbe_timing(var, &timing)) < 0)
+		return(-EINVAL);
+
+	/* Adjust virtual resolution, if necessary */
+	if (var->xres > var->xres_virtual || (!ywrap && !ypan))
+		var->xres_virtual = var->xres;
+	if (var->yres > var->yres_virtual || (!ywrap && !ypan))
+		var->yres_virtual = var->yres;
+
+	if (var->vmode & FB_VMODE_CONUPDATE) {
+		var->vmode |= FB_VMODE_YWRAP;
+		var->xoffset = info->var.xoffset;
+		var->yoffset = info->var.yoffset;
+	}
+
+	/* No grayscale for now */
+	var->grayscale = 0;
+
+	/* Memory limit */
+	line_length = var->xres_virtual * var->bits_per_pixel / 8;
+	if (line_length * var->yres_virtual > gbe_mem_size)
+		return -ENOMEM;	/* Virtual resolution too high */
+
+	switch (var->bits_per_pixel) {
+	case 8:
+		var->red.offset = 0;
+		var->red.length = 8;
+		var->green.offset = 0;
+		var->green.length = 8;
+		var->blue.offset = 0;
+		var->blue.length = 8;
+		var->transp.offset = 0;
+		var->transp.length = 0;
+		break;
+	case 16:		/* RGB 1555 */
+		var->red.offset = 10;
+		var->red.length = 5;
+		var->green.offset = 5;
+		var->green.length = 5;
+		var->blue.offset = 0;
+		var->blue.length = 5;
+		var->transp.offset = 0;
+		var->transp.length = 0;
+		break;
+	case 32:		/* RGB 8888 */
+		var->red.offset = 24;
+		var->red.length = 8;
+		var->green.offset = 16;
+		var->green.length = 8;
+		var->blue.offset = 8;
+		var->blue.length = 8;
+		var->transp.offset = 0;
+		var->transp.length = 8;
+		break;
+	}
+	var->red.msb_right = 0;
+	var->green.msb_right = 0;
+	var->blue.msb_right = 0;
+	var->transp.msb_right = 0;
+
+	var->left_margin = timing.htotal - timing.hsync_end;
+	var->right_margin = timing.hsync_start - timing.width;
+	var->upper_margin = timing.vtotal - timing.vsync_end;
+	var->lower_margin = timing.vsync_start - timing.height;
+	var->hsync_len = timing.hsync_end - timing.hsync_start;
+	var->vsync_len = timing.vsync_end - timing.vsync_start;
+
+	return 0;
+}
+
+static int gbefb_mmap(struct fb_info *info, struct file *file,
+			struct vm_area_struct *vma)
+{
+	unsigned long size = vma->vm_end - vma->vm_start;
+	unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
+	unsigned long addr;
+	unsigned long phys_addr, phys_size;
+	u16 *tile;
+
+	/* check range */
+	if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
+		return -EINVAL;
+	if (offset + size > gbe_mem_size)
+		return -EINVAL;
+
+	/* remap using the fastest write-through mode on architecture */
+	/* try not polluting the cache when possible */
+	pgprot_val(vma->vm_page_prot) =
+		pgprot_fb(pgprot_val(vma->vm_page_prot));
+
+	vma->vm_flags |= VM_IO | VM_RESERVED;
+	vma->vm_file = file;
+
+	/* look for the starting tile */
+	tile = &gbe_tiles.cpu[offset >> TILE_SHIFT];
+	addr = vma->vm_start;
+	offset &= TILE_MASK;
+
+	/* remap each tile separately */
+	do {
+		phys_addr = (((unsigned long) (*tile)) << TILE_SHIFT) + offset;
+		if ((offset + size) < TILE_SIZE)
+			phys_size = size;
+		else
+			phys_size = TILE_SIZE - offset;
+
+		if (remap_page_range
+		    (vma, addr, phys_addr, phys_size, vma->vm_page_prot))
+			return -EAGAIN;
+
+		offset = 0;
+		size -= phys_size;
+		addr += phys_size;
+		tile++;
+	} while (size);
+
+	return 0;
+}
+
+static struct fb_ops gbefb_ops = {
+	.owner		= THIS_MODULE,
+	.fb_check_var	= gbefb_check_var,
+	.fb_set_par	= gbefb_set_par,
+	.fb_setcolreg	= gbefb_setcolreg,
+	.fb_mmap	= gbefb_mmap,
+	.fb_blank	= gbefb_blank,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
+	.fb_cursor	= soft_cursor,
+};
+
+/*
+ * Initialization
+ */
+
+int __init gbefb_setup(char *options)
+{
+	char *this_opt;
+
+	if (!options || !*options)
+		return 0;
+
+	while ((this_opt = strsep(&options, ",")) != NULL) {
+		if (!strncmp(this_opt, "monitor:", 8)) {
+			if (!strncmp(this_opt + 8, "crt", 3)) {
+				flat_panel_enabled = 0;
+				default_var = &default_var_CRT;
+				default_mode = &default_mode_CRT;
+			} else if (!strncmp(this_opt + 8, "1600sw", 6) ||
+				   !strncmp(this_opt + 8, "lcd", 3)) {
+				flat_panel_enabled = 1;
+				default_var = &default_var_LCD;
+				default_mode = &default_mode_LCD;
+			}
+		} else if (!strncmp(this_opt, "mem:", 4)) {
+			gbe_mem_size = memparse(this_opt + 4, &this_opt);
+			if (gbe_mem_size > CONFIG_FB_GBE_MEM * 1024 * 1024)
+				gbe_mem_size = CONFIG_FB_GBE_MEM * 1024 * 1024;
+			if (gbe_mem_size < TILE_SIZE)
+				gbe_mem_size = TILE_SIZE;
+		} else
+			mode_option = this_opt;
+	}
+	return 0;
+}
+
+int __init gbefb_init(void)
+{
+	int i, ret = 0;
+
+	if (!request_mem_region(GBE_BASE, sizeof(struct sgi_gbe), "GBE")) {
+		printk(KERN_ERR "gbefb: couldn't reserve mmio region\n");
+		return -EBUSY;
+	}
+
+	gbe = (struct sgi_gbe *) ioremap(GBE_BASE, sizeof(struct sgi_gbe));
+	if (!gbe) {
+		printk(KERN_ERR "gbefb: couldn't map mmio region\n");
+		ret = -ENXIO;
+		goto out_release_mem_region;
+	}
+	gbe_revision = gbe->ctrlstat & 15;
+
+	gbe_tiles.cpu =
+		dma_alloc_coherent(NULL, GBE_TLB_SIZE * sizeof(uint16_t),
+				   &gbe_tiles.dma, GFP_KERNEL);
+	if (!gbe_tiles.cpu) {
+		printk(KERN_ERR "gbefb: couldn't allocate tiles table\n");
+		ret = -ENOMEM;
+		goto out_unmap;
+	}
+
+
+	if (gbe_mem_phys) {
+		/* memory was allocated at boot time */
+		gbe_mem = ioremap_nocache(gbe_mem_phys, gbe_mem_size);
+		gbe_dma_addr = 0;
+	} else {
+		/* try to allocate memory with the classical allocator
+		 * this has high chance to fail on low memory machines */
+		gbe_mem = dma_alloc_coherent(NULL, gbe_mem_size, &gbe_dma_addr,
+					     GFP_KERNEL);
+		gbe_mem_phys = (unsigned long) gbe_dma_addr;
+	}
+
+#ifdef CONFIG_X86
+	mtrr_add(gbe_mem_phys, gbe_mem_size, MTRR_TYPE_WRCOMB, 1);
+#endif
+
+	if (!gbe_mem) {
+		printk(KERN_ERR "gbefb: couldn't map framebuffer\n");
+		ret = -ENXIO;
+		goto out_tiles_free;
+	}
+
+	/* map framebuffer memory into tiles table */
+	for (i = 0; i < (gbe_mem_size >> TILE_SHIFT); i++)
+		gbe_tiles.cpu[i] = (gbe_mem_phys >> TILE_SHIFT) + i;
+
+	fb_info.currcon = -1;
+	fb_info.fbops = &gbefb_ops;
+	fb_info.pseudo_palette = pseudo_palette;
+	fb_info.flags = FBINFO_FLAG_DEFAULT;
+	fb_info.screen_base = gbe_mem;
+	fb_alloc_cmap(&fb_info.cmap, 256, 0);
+
+	/* reset GBE */
+	gbe_reset();
+
+	/* turn on default video mode */
+	if (fb_find_mode(&par_current.var, &fb_info, mode_option, NULL, 0,
+			 default_mode, 8) == 0)
+		par_current.var = *default_var;
+	fb_info.var = par_current.var;
+	gbefb_check_var(&par_current.var, &fb_info);
+	gbefb_encode_fix(&fb_info.fix, &fb_info.var);
+	fb_info.par = &par_current;
+
+	if (register_framebuffer(&fb_info) < 0) {
+		ret = -ENXIO;
+		printk(KERN_ERR "gbefb: couldn't register framebuffer\n");
+		goto out_gbe_unmap;
+	}
+
+	printk(KERN_INFO "fb%d: %s rev %d @ 0x%08x using %dkB memory\n",
+	       fb_info.node, fb_info.fix.id, gbe_revision, (unsigned) GBE_BASE,
+	       gbe_mem_size >> 10);
+
+	return 0;
+
+out_gbe_unmap:
+	if (gbe_dma_addr)
+		dma_free_coherent(NULL, gbe_mem_size, gbe_mem, gbe_mem_phys);
+	else
+		iounmap(gbe_mem);
+out_tiles_free:
+	dma_free_coherent(NULL, GBE_TLB_SIZE * sizeof(uint16_t),
+			  (void *)gbe_tiles.cpu, gbe_tiles.dma);
+out_unmap:
+	iounmap(gbe);
+out_release_mem_region:
+	release_mem_region(GBE_BASE, sizeof(struct sgi_gbe));
+	return ret;
+}
+
+void __exit gbefb_exit(void)
+{
+	unregister_framebuffer(&fb_info);
+	gbe_turn_off();
+	if (gbe_dma_addr)
+		dma_free_coherent(NULL, gbe_mem_size, gbe_mem, gbe_mem_phys);
+	else
+		iounmap(gbe_mem);
+	dma_free_coherent(NULL, GBE_TLB_SIZE * sizeof(uint16_t),
+			  (void *)gbe_tiles.cpu, gbe_tiles.dma);
+	release_mem_region(GBE_BASE, sizeof(struct sgi_gbe));
+	iounmap(gbe);
+}
+
+#ifdef MODULE
+module_init(gbefb_init);
+module_exit(gbefb_exit);
+#endif
+
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/video/hgafb.c b/drivers/video/hgafb.c
--- a/drivers/video/hgafb.c	Tue Jun 15 22:20:43 2004
+++ b/drivers/video/hgafb.c	Tue Jun 15 22:20:43 2004
@@ -448,6 +448,10 @@
 	return 0;
 }
 
+/*
+ * Accel functions
+ */
+#ifdef CONFIG_FB_HGA_ACCEL
 static void hgafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
 {
 	u_int rows, y;
@@ -510,6 +514,11 @@
 		*dest = d;
 	}
 }
+#else /* !CONFIG_FB_HGA_ACCEL */
+#define hgafb_fillrect cfb_fillrect
+#define hgafb_copyarea cfb_copyarea
+#define hgafb_imageblit cfb_imageblit
+#endif /* CONFIG_FB_HGA_ACCEL */
 
 
 static struct fb_ops hgafb_ops = {
@@ -519,9 +528,9 @@
 	.fb_setcolreg	= hgafb_setcolreg,
 	.fb_pan_display	= hgafb_pan_display,
 	.fb_blank	= hgafb_blank,
-	.fb_fillrect	= cfb_fillrect, //hgafb_fillrect,
-	.fb_copyarea	= cfb_copyarea,	//hgafb_copyarea,
-	.fb_imageblit	= cfb_imageblit,//hgafb_imageblit,
+	.fb_fillrect	= hgafb_fillrect,
+	.fb_copyarea	= hgafb_copyarea,
+	.fb_imageblit	= hgafb_imageblit,
 };
 		
 /* ------------------------------------------------------------------------- *
diff -Nru a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c
--- a/drivers/video/imsttfb.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/video/imsttfb.c	Tue Jun 15 22:20:40 2004
@@ -1084,6 +1084,7 @@
 	while(read_reg_le32(par->dc_regs, SSTATUS) & 0x40);
 }
 
+#if 0
 static int
 imsttfb_load_cursor_image(struct imstt_par *par, int width, int height, __u8 fgc)
 {
@@ -1191,7 +1192,6 @@
 	}
 }
 
-#if 0
 static int 
 imsttfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
 {
diff -Nru a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c
--- a/drivers/video/logo/logo.c	Tue Jun 15 22:20:41 2004
+++ b/drivers/video/logo/logo.c	Tue Jun 15 22:20:41 2004
@@ -16,7 +16,7 @@
 #include <asm/setup.h>
 #endif
 
-#if defined(CONFIG_MIPS) || defined(CONFIG_MIPS64)
+#ifdef CONFIG_MIPS
 #include <asm/bootinfo.h>
 #endif
 
diff -Nru a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c
--- a/drivers/video/matrox/matroxfb_DAC1064.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/video/matrox/matroxfb_DAC1064.c	Tue Jun 15 22:20:40 2004
@@ -660,7 +660,7 @@
 	ACCESS_FBINFO(features.accel.has_cacheflush) = 1;
 
 	ACCESS_FBINFO(outputs[0]).output = &m1064;
-	ACCESS_FBINFO(outputs[0]).src = MATROXFB_SRC_CRTC1;
+	ACCESS_FBINFO(outputs[0]).src = ACCESS_FBINFO(outputs[0]).default_src;
 	ACCESS_FBINFO(outputs[0]).data = MINFO;
 	ACCESS_FBINFO(outputs[0]).mode = MATROXFB_OUTPUT_MODE_MONITOR;
 
@@ -859,7 +859,7 @@
 	{
 		ACCESS_FBINFO(outputs[0]).output = &m1064;
 	}
-	ACCESS_FBINFO(outputs[0]).src = MATROXFB_SRC_CRTC1;
+	ACCESS_FBINFO(outputs[0]).src = ACCESS_FBINFO(outputs[0]).default_src;
 	ACCESS_FBINFO(outputs[0]).data = MINFO;
 	ACCESS_FBINFO(outputs[0]).mode = MATROXFB_OUTPUT_MODE_MONITOR;
 
diff -Nru a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c
--- a/drivers/video/matrox/matroxfb_Ti3026.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/video/matrox/matroxfb_Ti3026.c	Tue Jun 15 22:20:36 2004
@@ -692,7 +692,7 @@
 
 	ACCESS_FBINFO(outputs[0]).data = MINFO;
 	ACCESS_FBINFO(outputs[0]).output = &ti3026_output;
-	ACCESS_FBINFO(outputs[0]).src = MATROXFB_SRC_CRTC1;
+	ACCESS_FBINFO(outputs[0]).src = ACCESS_FBINFO(outputs[0]).default_src;
 	ACCESS_FBINFO(outputs[0]).mode = MATROXFB_OUTPUT_MODE_MONITOR;
 
 	if (ACCESS_FBINFO(devflags.noinit))
diff -Nru a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
--- a/drivers/video/matrox/matroxfb_base.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/video/matrox/matroxfb_base.c	Tue Jun 15 22:20:42 2004
@@ -1272,6 +1272,7 @@
 static int dfp;				/* "matrox:dfp */
 static int dfp_type = -1;		/* "matrox:dfp:xxx */
 static int memtype = -1;		/* "matrox:memtype:xxx" */
+static char outputs[8];			/* "matrox:outputs:xxx" */
 
 #ifndef MODULE
 static char videomode[64];		/* "matrox:mode:xxxxx" or "matrox:xxxxx" */
@@ -1537,6 +1538,39 @@
 
 static int hotplug = 0;
 
+static void setDefaultOutputs(WPMINFO2) {
+	unsigned int i;
+	const char* ptr;
+
+	ACCESS_FBINFO(outputs[0]).default_src = MATROXFB_SRC_CRTC1;
+	if (ACCESS_FBINFO(devflags.g450dac)) {
+		ACCESS_FBINFO(outputs[1]).default_src = MATROXFB_SRC_CRTC1;
+		ACCESS_FBINFO(outputs[2]).default_src = MATROXFB_SRC_CRTC1;
+	} else if (dfp) {
+		ACCESS_FBINFO(outputs[2]).default_src = MATROXFB_SRC_CRTC1;
+	}
+	ptr = outputs;
+	for (i = 0; i < MATROXFB_MAX_OUTPUTS; i++) {
+		char c = *ptr++;
+
+		if (c == 0) {
+			break;
+		}
+		if (c == '0') {
+			ACCESS_FBINFO(outputs[i]).default_src = MATROXFB_SRC_NONE;
+		} else if (c == '1') {
+			ACCESS_FBINFO(outputs[i]).default_src = MATROXFB_SRC_CRTC1;
+		} else if (c == '2' && ACCESS_FBINFO(devflags.crtc2)) {
+			ACCESS_FBINFO(outputs[i]).default_src = MATROXFB_SRC_CRTC2;
+		} else {
+			printk(KERN_ERR "matroxfb: Unknown outputs setting\n");
+			break;
+		}
+	}
+	/* Nullify this option for subsequent adapters */
+	outputs[0] = 0;
+}
+
 static int initMatrox2(WPMINFO struct board* b){
 	unsigned long ctrlptr_phys = 0;
 	unsigned long video_base_phys = 0;
@@ -1577,20 +1611,18 @@
 	ACCESS_FBINFO(devflags.crtc2) = (b->flags & DEVF_CRTC2) != 0;
 	ACCESS_FBINFO(devflags.maven_capable) = (b->flags & DEVF_MAVEN_CAPABLE) != 0;
 	ACCESS_FBINFO(devflags.dualhead) = (b->flags & DEVF_DUALHEAD) != 0;
+	ACCESS_FBINFO(devflags.dfp_type) = dfp_type;
+	ACCESS_FBINFO(devflags.g450dac) = (b->flags & DEVF_G450DAC) != 0;
+	ACCESS_FBINFO(devflags.textstep) = ACCESS_FBINFO(devflags.vgastep) * ACCESS_FBINFO(devflags.textmode);
+	ACCESS_FBINFO(devflags.textvram) = 65536 / ACCESS_FBINFO(devflags.textmode);
+	setDefaultOutputs(PMINFO2);
 	if (b->flags & DEVF_PANELLINK_CAPABLE) {
 		ACCESS_FBINFO(outputs[2]).data = MINFO;
 		ACCESS_FBINFO(outputs[2]).output = &panellink_output;
-		if (dfp)
-			ACCESS_FBINFO(outputs[2]).src = MATROXFB_SRC_CRTC1;
-		else
-			ACCESS_FBINFO(outputs[2]).src = MATROXFB_SRC_NONE;
+		ACCESS_FBINFO(outputs[2]).src = ACCESS_FBINFO(outputs[2]).default_src;
 		ACCESS_FBINFO(outputs[2]).mode = MATROXFB_OUTPUT_MODE_MONITOR;
 		ACCESS_FBINFO(devflags.panellink) = 1;
 	}
-	ACCESS_FBINFO(devflags.dfp_type) = dfp_type;
-	ACCESS_FBINFO(devflags.g450dac) = (b->flags & DEVF_G450DAC) != 0;
-	ACCESS_FBINFO(devflags.textstep) = ACCESS_FBINFO(devflags.vgastep) * ACCESS_FBINFO(devflags.textmode);
-	ACCESS_FBINFO(devflags.textvram) = 65536 / ACCESS_FBINFO(devflags.textmode);
 
 	if (ACCESS_FBINFO(capable.cross4MB) < 0)
 		ACCESS_FBINFO(capable.cross4MB) = b->flags & DEVF_CROSS4MB;
@@ -1813,6 +1845,13 @@
 							to yres_virtual * xres_virtual < 2^32 */
 	}
 	matroxfb_init_fix(PMINFO2);
+	/* Normalize values (namely yres_virtual) */
+	matroxfb_check_var(&vesafb_defined, &ACCESS_FBINFO(fbcon));
+	/* And put it into "current" var. Do NOT program hardware yet, or we'll not take over
+	 * vgacon correctly. fbcon_startup will call fb_set_par for us, WITHOUT check_var,
+	 * and unfortunately it will do it BEFORE vgacon contents is saved, so it won't work
+	 * anyway. But we at least tried... */
+	ACCESS_FBINFO(fbcon.var) = vesafb_defined;
 	err = -EINVAL;
 
 	printk(KERN_INFO "matroxfb: %dx%dx%dbpp (virtual: %dx%d)\n",
@@ -1834,6 +1873,9 @@
 		 * until someone tells me what is proper thing to do */
 		printk(KERN_INFO "fb%d: initializing hardware\n",
 			ACCESS_FBINFO(fbcon.node));
+		/* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var
+		 * already before, so register_framebuffer works correctly. */
+		vesafb_defined.activate |= FB_ACTIVATE_FORCE;
 		fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined);
 	}
 	return 0;
@@ -2288,6 +2330,8 @@
 			mem = simple_strtoul(this_opt+4, NULL, 0);
 		else if (!strncmp(this_opt, "mode:", 5))
 			strlcpy(videomode, this_opt+5, sizeof(videomode));
+		else if (!strncmp(this_opt, "outputs:", 8))
+			strlcpy(outputs, this_opt+8, sizeof(outputs));
 		else if (!strncmp(this_opt, "dfp:", 4)) {
 			dfp_type = simple_strtoul(this_opt+4, NULL, 0);
 			dfp = 1;
@@ -2463,6 +2507,8 @@
 MODULE_PARM_DESC(dfp, "Specifies whether to use digital flat panel interface of G200/G400 (0 or 1) (default=0)");
 MODULE_PARM(dfp_type, "i");
 MODULE_PARM_DESC(dfp_type, "Specifies DFP interface type (0 to 255) (default=read from hardware)");
+MODULE_PARM(outputs, "c8");
+MODULE_PARM_DESC(outputs, "Specifies which CRTC is mapped to which output (string of up to three letters, consisting of 0 (disabled), 1 (CRTC1), 2 (CRTC2)) (default=111 for Gx50, 101 for G200/G400 with DFP, and 100 for all other devices)");
 #ifdef CONFIG_PPC_PMAC
 MODULE_PARM(vmode, "i");
 MODULE_PARM_DESC(vmode, "Specify the vmode mode number that should be used (640x480 default)");
diff -Nru a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h
--- a/drivers/video/matrox/matroxfb_base.h	Tue Jun 15 22:20:40 2004
+++ b/drivers/video/matrox/matroxfb_base.h	Tue Jun 15 22:20:40 2004
@@ -479,6 +479,7 @@
 	struct matrox_altout*	output;
 	void*			data;
 	unsigned int		mode;
+	unsigned int		default_src;
 			      } outputs[MATROXFB_MAX_OUTPUTS];
 
 #define MATROXFB_MAX_FB_DRIVERS		5
diff -Nru a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c
--- a/drivers/video/matrox/matroxfb_crtc2.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/video/matrox/matroxfb_crtc2.c	Tue Jun 15 22:20:44 2004
@@ -628,15 +628,6 @@
 	m2info->mmio.vbase = ACCESS_FBINFO(mmio.vbase);
 	m2info->mmio.len = ACCESS_FBINFO(mmio.len);
 
-	/*
-	 *  If we have unused output, connect CRTC2 to it...
-	 */
-	if (ACCESS_FBINFO(outputs[1]).output &&
-	    ACCESS_FBINFO(outputs[1]).src == MATROXFB_SRC_NONE &&
-	    ACCESS_FBINFO(outputs[2]).src == MATROXFB_SRC_NONE) {
-		ACCESS_FBINFO(outputs[1]).src = MATROXFB_SRC_CRTC2;
-	}
-
 	matroxfb_dh_init_fix(m2info);
 	if (register_framebuffer(&m2info->fbcon)) {
 		return -ENXIO;
diff -Nru a/drivers/video/matrox/matroxfb_g450.c b/drivers/video/matrox/matroxfb_g450.c
--- a/drivers/video/matrox/matroxfb_g450.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/video/matrox/matroxfb_g450.c	Tue Jun 15 22:20:44 2004
@@ -591,11 +591,11 @@
 	if (ACCESS_FBINFO(devflags.g450dac)) {
 		down_write(&ACCESS_FBINFO(altout.lock));
 		tvo_fill_defaults(PMINFO2);
-		ACCESS_FBINFO(outputs[1]).src = MATROXFB_SRC_CRTC1;
+		ACCESS_FBINFO(outputs[1]).src = ACCESS_FBINFO(outputs[1]).default_src;
 		ACCESS_FBINFO(outputs[1]).data = MINFO;
 		ACCESS_FBINFO(outputs[1]).output = &matroxfb_g450_altout;
 		ACCESS_FBINFO(outputs[1]).mode = MATROXFB_OUTPUT_MODE_MONITOR;
-		ACCESS_FBINFO(outputs[2]).src = MATROXFB_SRC_CRTC1;
+		ACCESS_FBINFO(outputs[2]).src = ACCESS_FBINFO(outputs[2]).default_src;
 		ACCESS_FBINFO(outputs[2]).data = MINFO;
 		ACCESS_FBINFO(outputs[2]).output = &matroxfb_g450_dvi;
 		ACCESS_FBINFO(outputs[2]).mode = MATROXFB_OUTPUT_MODE_MONITOR;
diff -Nru a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c
--- a/drivers/video/matrox/matroxfb_maven.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/video/matrox/matroxfb_maven.c	Tue Jun 15 22:20:36 2004
@@ -1188,7 +1188,7 @@
 	md->client = clnt;
 	down_write(&ACCESS_FBINFO(altout.lock));
 	ACCESS_FBINFO(outputs[1]).output = &maven_altout;
-	ACCESS_FBINFO(outputs[1]).src = MATROXFB_SRC_NONE;
+	ACCESS_FBINFO(outputs[1]).src = ACCESS_FBINFO(outputs[1]).default_src;
 	ACCESS_FBINFO(outputs[1]).data = md;
 	ACCESS_FBINFO(outputs[1]).mode = MATROXFB_OUTPUT_MODE_MONITOR;
 	up_write(&ACCESS_FBINFO(altout.lock));
@@ -1249,6 +1249,7 @@
 		err = -ENOMEM;
 		goto ERROR0;
 	}
+	memset(new_client, 0, sizeof(*new_client) + sizeof(*data));
 	data = (struct maven_data*)(new_client + 1);
 	i2c_set_clientdata(new_client, data);
 	new_client->addr = address;
diff -Nru a/drivers/video/modedb.c b/drivers/video/modedb.c
--- a/drivers/video/modedb.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/video/modedb.c	Tue Jun 15 22:20:40 2004
@@ -391,7 +391,7 @@
 }
 
 /**
- *	__fb_try_mode - test a video mode
+ *	fb_try_mode - test a video mode
  *	@var: frame buffer user defined part of display
  *	@info: frame buffer info structure
  *	@mode: frame buffer video mode structure
@@ -403,10 +403,10 @@
  *
  */
 
-int __fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
+int fb_try_mode(struct fb_var_screeninfo *var, struct fb_info *info,
 		  const struct fb_videomode *mode, unsigned int bpp)
 {
-    int err = 1;
+    int err = 0;
 
     DPRINTK("Trying mode %s %dx%d-%d@%d\n", mode->name ? mode->name : "noname",
 	    mode->xres, mode->yres, bpp, mode->refresh);
@@ -430,10 +430,9 @@
     if (info->fbops->fb_check_var)
     	err = info->fbops->fb_check_var(var, info);
     var->activate &= ~FB_ACTIVATE_TEST;
-    return !err;
+    return err;
 }
 
-
 /**
  *	fb_find_mode - finds a valid video mode
  *	@var: frame buffer user defined part of display
@@ -536,18 +535,18 @@
 		if ((name_matches(db[j], name, namelen) ||
 		     (res_specified && res_matches(db[j], xres, yres))) &&
 		    (!i || db[j].refresh == refresh) &&
-		    __fb_try_mode(var, info, &db[j], bpp))
+		    !fb_try_mode(var, info, &db[j], bpp))
 		    return 2-i;
 	}
     }
 
     DPRINTK("Trying default video mode\n");
-    if (__fb_try_mode(var, info, default_mode, default_bpp))
+    if (!fb_try_mode(var, info, default_mode, default_bpp))
 	return 3;
 
     DPRINTK("Trying all modes\n");
     for (i = 0; i < dbsize; i++)
-	if (__fb_try_mode(var, info, &db[i], default_bpp))
+	if (!fb_try_mode(var, info, &db[i], default_bpp))
 	    return 4;
 
     DPRINTK("No valid mode found\n");
diff -Nru a/drivers/video/neofb.c b/drivers/video/neofb.c
--- a/drivers/video/neofb.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/video/neofb.c	Tue Jun 15 22:20:42 2004
@@ -81,13 +81,13 @@
 #include <asm/mtrr.h>
 #endif
 
+#include <video/vga.h>
 #include <video/neomagic.h>
 
-#define NEOFB_VERSION "0.4.1"
+#define NEOFB_VERSION "0.4.2"
 
 /* --------------------------------------------------------------------- */
 
-static int disabled;
 static int internal;
 static int external;
 static int libretto;
@@ -100,8 +100,6 @@
 MODULE_AUTHOR("(c) 2001-2002  Denis Oliver Kropp <dok@convergence.de>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("FBDev driver for NeoMagic PCI Chips");
-MODULE_PARM(disabled, "i");
-MODULE_PARM_DESC(disabled, "Disable this driver's initialization.");
 MODULE_PARM(internal, "i");
 MODULE_PARM_DESC(internal, "Enable output on internal LCD Display.");
 MODULE_PARM(external, "i");
@@ -152,6 +150,16 @@
 };
 #endif
 
+static inline u32 read_le32(int regindex, const struct neofb_par *par)
+{
+	return readl(par->neo2200 + par->cursorOff + regindex);
+}
+
+static inline void write_le32(int regindex, u32 val, const struct neofb_par *par)
+{
+	writel(val, par->neo2200 + par->cursorOff + regindex);
+}
+
 static int neoFindMode(int xres, int yres, int depth)
 {
 	int xres_s;
@@ -363,44 +371,61 @@
 	par->Attribute[18] = 0x0F;
 	par->Attribute[19] = 0x00;
 	par->Attribute[20] = 0x00;
-
 	return 0;
 }
 
-static void vgaHWLock(void)
+static void vgaHWLock(struct vgastate *state)
 {
 	/* Protect CRTC[0-7] */
-	VGAwCR(0x11, VGArCR(0x11) | 0x80);
+	vga_wcrt(state->vgabase, 0x11, vga_rcrt(state->vgabase, 0x11) | 0x80);
 }
 
 static void vgaHWUnlock(void)
 {
 	/* Unprotect CRTC[0-7] */
-	VGAwCR(0x11, VGArCR(0x11) & ~0x80);
+	vga_wcrt(NULL, 0x11, vga_rcrt(NULL, 0x11) & ~0x80);
 }
 
-static void neoLock(void)
+static void neoLock(struct vgastate *state)
 {
-	VGAwGR(0x09, 0x00);
-	vgaHWLock();
+	vga_wgfx(state->vgabase, 0x09, 0x00);
+	vgaHWLock(state);
 }
 
 static void neoUnlock(void)
 {
 	vgaHWUnlock();
-	VGAwGR(0x09, 0x26);
+	vga_wgfx(NULL, 0x09, 0x26);
 }
 
 /*
- * vgaHWSeqReset
- *      perform a sequencer reset.
+ * VGA Palette management
  */
-void vgaHWSeqReset(int start)
+static int paletteEnabled = 0;
+
+inline void VGAenablePalette(void)
 {
-	if (start)
-		VGAwSEQ(0x00, 0x01);	/* Synchronous Reset */
+	vga_r(NULL, VGA_IS1_RC);
+	vga_w(NULL, VGA_ATT_W, 0x00);
+	paletteEnabled = 1;
+}
+
+inline void VGAdisablePalette(void)
+{
+	vga_r(NULL, VGA_IS1_RC);
+	vga_w(NULL, VGA_ATT_W, 0x20);
+	paletteEnabled = 0;
+}
+
+inline void VGAwATTR(u8 index, u8 value)
+{
+	if (paletteEnabled)
+		index &= ~0x20;
 	else
-		VGAwSEQ(0x00, 0x03);	/* End Reset */
+		index |= 0x20;
+
+	vga_r(NULL, VGA_IS1_RC);
+	vga_wattr(NULL, index, value);
 }
 
 void vgaHWProtect(int on)
@@ -411,21 +436,18 @@
 		/*
 		 * Turn off screen and disable sequencer.
 		 */
-		tmp = VGArSEQ(0x01);
-
-		vgaHWSeqReset(1);	/* start synchronous reset */
-		VGAwSEQ(0x01, tmp | 0x20);	/* disable the display */
+		tmp = vga_rseq(NULL, 0x01);
+		vga_wseq(NULL, 0x00, 0x01);		/* Synchronous Reset */
+		vga_wseq(NULL, 0x01, tmp | 0x20);	/* disable the display */
 
 		VGAenablePalette();
 	} else {
 		/*
 		 * Reenable sequencer, then turn on screen.
 		 */
-
-		tmp = VGArSEQ(0x01);
-
-		VGAwSEQ(0x01, tmp & ~0x20);	/* reenable display */
-		vgaHWSeqReset(0);	/* clear synchronousreset */
+		tmp = vga_rseq(NULL, 0x01);
+		vga_wseq(NULL, 0x01, tmp & ~0x20);	/* reenable display */
+		vga_wseq(NULL, 0x00, 0x03);		/* clear synchronousreset */
 
 		VGAdisablePalette();
 	}
@@ -436,19 +458,19 @@
 {
 	int i;
 
-	VGAwMISC(par->MiscOutReg);
+	vga_w(NULL, VGA_MIS_W, par->MiscOutReg);
 
 	for (i = 1; i < 5; i++)
-		VGAwSEQ(i, par->Sequencer[i]);
+		vga_wseq(NULL, i, par->Sequencer[i]);
 
 	/* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 or CRTC[17] */
-	VGAwCR(17, par->CRTC[17] & ~0x80);
+	vga_wcrt(NULL, 17, par->CRTC[17] & ~0x80);
 
 	for (i = 0; i < 25; i++)
-		VGAwCR(i, par->CRTC[i]);
+		vga_wcrt(NULL, i, par->CRTC[i]);
 
 	for (i = 0; i < 9; i++)
-		VGAwGR(i, par->Graphics[i]);
+		vga_wgfx(NULL, i, par->Graphics[i]);
 
 	VGAenablePalette();
 
@@ -535,6 +557,36 @@
 /* --------------------------------------------------------------------- */
 
 static int
+neofb_open(struct fb_info *info, int user)
+{
+	struct neofb_par *par = (struct neofb_par *) info->par;
+	int cnt = atomic_read(&par->ref_count);
+
+	if (cnt) {
+		memset(&par->state, 0, sizeof(struct vgastate));
+		par->state.flags = VGA_SAVE_MODE | VGA_SAVE_FONTS;
+		save_vga(&par->state);
+	}
+	atomic_inc(&par->ref_count);
+	return 0;
+}
+
+static int
+neofb_release(struct fb_info *info, int user)
+{
+	struct neofb_par *par = (struct neofb_par *) info->par;
+	int cnt = atomic_read(&par->ref_count);
+
+	if (!cnt)
+		return -EINVAL;
+	if (cnt == 1) {
+		restore_vga(&par->state);
+	}
+	atomic_dec(&par->ref_count);
+	return 0;
+}
+
+static int
 neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
 	struct neofb_par *par = (struct neofb_par *) info->par;
@@ -672,16 +724,13 @@
 	if (var->xres_virtual < var->xres)
 		var->xres_virtual = var->xres;
 
-	memlen =
-	    var->xres_virtual * var->bits_per_pixel * var->yres_virtual /
-	    8;
+	memlen = var->xres_virtual * var->bits_per_pixel * var->yres_virtual >> 3;
+
 	if (memlen > vramlen) {
-		var->yres_virtual =
-		    vramlen * 8 / (var->xres_virtual *
-				   var->bits_per_pixel);
-		memlen =
-		    var->xres_virtual * var->bits_per_pixel *
-		    var->yres_virtual / 8;
+		var->yres_virtual =  vramlen * 8 / (var->xres_virtual *
+				   	var->bits_per_pixel);
+		memlen = var->xres_virtual * var->bits_per_pixel *
+				var->yres_virtual / 8;
 	}
 
 	/* we must round yres/xres down, we already rounded y/xres_virtual up
@@ -981,13 +1030,13 @@
 	}
 
 	/* alread unlocked above */
-	/* BOGUS  VGAwGR (0x09, 0x26); */
+	/* BOGUS  vga_wgfx(NULL, 0x09, 0x26); */
 
 	/* don't know what this is, but it's 0 from bootup anyway */
-	VGAwGR(0x15, 0x00);
+	vga_wgfx(NULL, 0x15, 0x00);
 
 	/* was set to 0x01 by my bios in text and vesa modes */
-	VGAwGR(0x0A, par->GeneralLockReg);
+	vga_wgfx(NULL, 0x0A, par->GeneralLockReg);
 
 	/*
 	 * The color mode needs to be set before calling vgaHWRestore
@@ -996,7 +1045,7 @@
 	 * NOTE: Make sure we don't change bits make sure we don't change
 	 * any reserved bits.
 	 */
-	temp = VGArGR(0x90);
+	temp = vga_rgfx(NULL, 0x90);
 	switch (info->fix.accel) {
 	case FB_ACCEL_NEOMAGIC_NM2070:
 		temp &= 0xF0;	/* Save bits 7:4 */
@@ -1015,7 +1064,7 @@
 		break;
 	}
 
-	VGAwGR(0x90, temp);
+	vga_wgfx(NULL, 0x90, temp);
 
 	/*
 	 * In some rare cases a lockup might occur if we don't delay
@@ -1027,9 +1076,9 @@
 	 * Disable horizontal and vertical graphics and text expansions so
 	 * that vgaHWRestore works properly.
 	 */
-	temp = VGArGR(0x25);
+	temp = vga_rgfx(NULL, 0x25);
 	temp &= 0x39;
-	VGAwGR(0x25, temp);
+	vga_wgfx(NULL, 0x25, temp);
 
 	/*
 	 * Sleep for 200ms to make sure that the two operations above have
@@ -1041,19 +1090,18 @@
 	 * This function handles restoring the generic VGA registers.  */
 	vgaHWRestore(info, par);
 
-
-	VGAwGR(0x0E, par->ExtCRTDispAddr);
-	VGAwGR(0x0F, par->ExtCRTOffset);
-	temp = VGArGR(0x10);
+	vga_wgfx(NULL, 0x0E, par->ExtCRTDispAddr);
+	vga_wgfx(NULL, 0x0F, par->ExtCRTOffset);
+	temp = vga_rgfx(NULL, 0x10);
 	temp &= 0x0F;		/* Save bits 3:0 */
 	temp |= (par->SysIfaceCntl1 & ~0x0F);	/* VESA Bios sets bit 1! */
-	VGAwGR(0x10, temp);
+	vga_wgfx(NULL, 0x10, temp);
 
-	VGAwGR(0x11, par->SysIfaceCntl2);
-	VGAwGR(0x15, 0 /*par->SingleAddrPage */ );
-	VGAwGR(0x16, 0 /*par->DualAddrPage */ );
+	vga_wgfx(NULL, 0x11, par->SysIfaceCntl2);
+	vga_wgfx(NULL, 0x15, 0 /*par->SingleAddrPage */ );
+	vga_wgfx(NULL, 0x16, 0 /*par->DualAddrPage */ );
 
-	temp = VGArGR(0x20);
+	temp = vga_rgfx(NULL, 0x20);
 	switch (info->fix.accel) {
 	case FB_ACCEL_NEOMAGIC_NM2070:
 		temp &= 0xFC;	/* Save bits 7:2 */
@@ -1074,79 +1122,78 @@
 		temp |= (par->PanelDispCntlReg1 & ~0x98);
 		break;
 	}
-	VGAwGR(0x20, temp);
+	vga_wgfx(NULL, 0x20, temp);
 
-	temp = VGArGR(0x25);
+	temp = vga_rgfx(NULL, 0x25);
 	temp &= 0x38;		/* Save bits 5:3 */
 	temp |= (par->PanelDispCntlReg2 & ~0x38);
-	VGAwGR(0x25, temp);
+	vga_wgfx(NULL, 0x25, temp);
 
 	if (info->fix.accel != FB_ACCEL_NEOMAGIC_NM2070) {
-		temp = VGArGR(0x30);
+		temp = vga_rgfx(NULL, 0x30);
 		temp &= 0xEF;	/* Save bits 7:5 and bits 3:0 */
 		temp |= (par->PanelDispCntlReg3 & ~0xEF);
-		VGAwGR(0x30, temp);
+		vga_wgfx(NULL, 0x30, temp);
 	}
 
-	VGAwGR(0x28, par->PanelVertCenterReg1);
-	VGAwGR(0x29, par->PanelVertCenterReg2);
-	VGAwGR(0x2a, par->PanelVertCenterReg3);
+	vga_wgfx(NULL, 0x28, par->PanelVertCenterReg1);
+	vga_wgfx(NULL, 0x29, par->PanelVertCenterReg2);
+	vga_wgfx(NULL, 0x2a, par->PanelVertCenterReg3);
 
 	if (info->fix.accel != FB_ACCEL_NEOMAGIC_NM2070) {
-		VGAwGR(0x32, par->PanelVertCenterReg4);
-		VGAwGR(0x33, par->PanelHorizCenterReg1);
-		VGAwGR(0x34, par->PanelHorizCenterReg2);
-		VGAwGR(0x35, par->PanelHorizCenterReg3);
+		vga_wgfx(NULL, 0x32, par->PanelVertCenterReg4);
+		vga_wgfx(NULL, 0x33, par->PanelHorizCenterReg1);
+		vga_wgfx(NULL, 0x34, par->PanelHorizCenterReg2);
+		vga_wgfx(NULL, 0x35, par->PanelHorizCenterReg3);
 	}
 
 	if (info->fix.accel == FB_ACCEL_NEOMAGIC_NM2160)
-		VGAwGR(0x36, par->PanelHorizCenterReg4);
+		vga_wgfx(NULL, 0x36, par->PanelHorizCenterReg4);
 
 	if (info->fix.accel == FB_ACCEL_NEOMAGIC_NM2200 ||
 	    info->fix.accel == FB_ACCEL_NEOMAGIC_NM2230 ||
 	    info->fix.accel == FB_ACCEL_NEOMAGIC_NM2360 ||
 	    info->fix.accel == FB_ACCEL_NEOMAGIC_NM2380) {
-		VGAwGR(0x36, par->PanelHorizCenterReg4);
-		VGAwGR(0x37, par->PanelVertCenterReg5);
-		VGAwGR(0x38, par->PanelHorizCenterReg5);
+		vga_wgfx(NULL, 0x36, par->PanelHorizCenterReg4);
+		vga_wgfx(NULL, 0x37, par->PanelVertCenterReg5);
+		vga_wgfx(NULL, 0x38, par->PanelHorizCenterReg5);
 
 		clock_hi = 1;
 	}
 
 	/* Program VCLK3 if needed. */
-	if (par->ProgramVCLK && ((VGArGR(0x9B) != par->VCLK3NumeratorLow)
-				 || (VGArGR(0x9F) != par->VCLK3Denominator)
-				 || (clock_hi && ((VGArGR(0x8F) & ~0x0f)
-						  != (par->
-						      VCLK3NumeratorHigh &
+	if (par->ProgramVCLK && ((vga_rgfx(NULL, 0x9B) != par->VCLK3NumeratorLow)
+				 || (vga_rgfx(NULL, 0x9F) != par->VCLK3Denominator)
+				 || (clock_hi && ((vga_rgfx(NULL, 0x8F) & ~0x0f)
+						  != (par->VCLK3NumeratorHigh &
 						      ~0x0F))))) {
-		VGAwGR(0x9B, par->VCLK3NumeratorLow);
+		vga_wgfx(NULL, 0x9B, par->VCLK3NumeratorLow);
 		if (clock_hi) {
-			temp = VGArGR(0x8F);
+			temp = vga_rgfx(NULL, 0x8F);
 			temp &= 0x0F;	/* Save bits 3:0 */
 			temp |= (par->VCLK3NumeratorHigh & ~0x0F);
-			VGAwGR(0x8F, temp);
+			vga_wgfx(NULL, 0x8F, temp);
 		}
-		VGAwGR(0x9F, par->VCLK3Denominator);
+		vga_wgfx(NULL, 0x9F, par->VCLK3Denominator);
 	}
 
 	if (par->biosMode)
-		VGAwCR(0x23, par->biosMode);
+		vga_wcrt(NULL, 0x23, par->biosMode);
 
-	VGAwGR(0x93, 0xc0);	/* Gives 5x faster framebuffer writes !!! */
+	vga_wgfx(NULL, 0x93, 0xc0);	/* Gives 5x faster framebuffer writes !!! */
 
 	/* Program vertical extension register */
 	if (info->fix.accel == FB_ACCEL_NEOMAGIC_NM2200 ||
 	    info->fix.accel == FB_ACCEL_NEOMAGIC_NM2230 ||
 	    info->fix.accel == FB_ACCEL_NEOMAGIC_NM2360 ||
 	    info->fix.accel == FB_ACCEL_NEOMAGIC_NM2380) {
-		VGAwCR(0x70, par->VerticalExt);
+		vga_wcrt(NULL, 0x70, par->VerticalExt);
 	}
 
 	vgaHWProtect(0);	/* Turn on screen */
 
 	/* Calling this also locks offset registers required in update_start */
-	neoLock();
+	neoLock(&par->state);
 
 	info->fix.line_length =
 	    info->var.xres_virtual * (info->var.bits_per_pixel >> 3);
@@ -1167,6 +1214,8 @@
 static void neofb_update_start(struct fb_info *info,
 			       struct fb_var_screeninfo *var)
 {
+	struct neofb_par *par = (struct neofb_par *) info->par;
+	struct vgastate *state = &par->state;
 	int oldExtCRTDispAddr;
 	int Base;
 
@@ -1180,18 +1229,18 @@
 	/*
 	 * These are the generic starting address registers.
 	 */
-	VGAwCR(0x0C, (Base & 0x00FF00) >> 8);
-	VGAwCR(0x0D, (Base & 0x00FF));
+	vga_wcrt(state->vgabase, 0x0C, (Base & 0x00FF00) >> 8);
+	vga_wcrt(state->vgabase, 0x0D, (Base & 0x00FF));
 
 	/*
 	 * Make sure we don't clobber some other bits that might already
 	 * have been set. NOTE: NM2200 has a writable bit 3, but it shouldn't
 	 * be needed.
 	 */
-	oldExtCRTDispAddr = VGArGR(0x0E);
-	VGAwGR(0x0E, (((Base >> 16) & 0x0f) | (oldExtCRTDispAddr & 0xf0)));
+	oldExtCRTDispAddr = vga_rgfx(NULL, 0x0E);
+	vga_wgfx(state->vgabase, 0x0E, (((Base >> 16) & 0x0f) | (oldExtCRTDispAddr & 0xf0)));
 
-	neoLock();
+	neoLock(state);
 }
 
 /*
@@ -1227,7 +1276,7 @@
 static int neofb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
 			   u_int transp, struct fb_info *fb)
 {
-	if (regno >= NR_PALETTE)
+	if (regno >= 255)
 		return -EINVAL;
 
 	switch (fb->var.bits_per_pixel) {
@@ -1353,7 +1402,7 @@
 	}
 
 	par->neo2200->dstStart =
-	    dst * ((info->var.bits_per_pixel + 7) / 8);
+	    dst * ((info->var.bits_per_pixel + 7) >> 3);
 	par->neo2200->xyExt =
 	    (rect->height << 16) | (rect->width & 0xffff);
 }
@@ -1361,24 +1410,20 @@
 static void
 neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area)
 {
-	struct neofb_par *par = (struct neofb_par *) info->par;
 	u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy;
+	struct neofb_par *par = (struct neofb_par *) info->par;
 	u_long src, dst, bltCntl;
 
 	bltCntl = NEO_BC3_FIFO_EN | NEO_BC3_SKIP_MAPPING | 0x0C0000;
 
-	if (sy < dy) {
+	if ((dy > sy) || ((dy == sy) && (dx > sx))) {
+		/* Start with the lower right corner */
 		sy += (area->height - 1);
 		dy += (area->height - 1);
-
-		bltCntl |= NEO_BC0_DST_Y_DEC | NEO_BC0_SRC_Y_DEC;
-	}
-
-	if (area->sx < area->dx) {
 		sx += (area->width - 1);
 		dx += (area->width - 1);
 
-		bltCntl |= NEO_BC0_X_DEC;
+		bltCntl |= NEO_BC0_X_DEC | NEO_BC0_DST_Y_DEC | NEO_BC0_SRC_Y_DEC;
 	}
 
 	src = sx * (info->var.bits_per_pixel >> 3) + sy*info->fix.line_length;
@@ -1395,6 +1440,7 @@
 	    (area->height << 16) | (area->width & 0xffff);
 }
 
+/*
 static void
 neo2200_imageblit(struct fb_info *info, const struct fb_image *image)
 {
@@ -1431,6 +1477,7 @@
 	memcpy(par->mmio_vbase + 0x100000, image->data,
 	       (image->width * image->height) >> 3);
 }
+*/
 
 static void
 neofb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
@@ -1439,7 +1486,7 @@
 		case FB_ACCEL_NEOMAGIC_NM2200:
 		case FB_ACCEL_NEOMAGIC_NM2230: 
 		case FB_ACCEL_NEOMAGIC_NM2360: 
-		case FB_ACCEL_NEOMAGIC_NM2380: 
+		case FB_ACCEL_NEOMAGIC_NM2380:
 			neo2200_fillrect(info, rect);
 			break;
 		default:
@@ -1467,17 +1514,22 @@
 static void
 neofb_imageblit(struct fb_info *info, const struct fb_image *image)
 {
-	switch (info->fix.accel) {
-		case FB_ACCEL_NEOMAGIC_NM2200:
-		case FB_ACCEL_NEOMAGIC_NM2230: 
-		case FB_ACCEL_NEOMAGIC_NM2360: 
-		case FB_ACCEL_NEOMAGIC_NM2380: 
-			neo2200_imageblit(info, image);
-			break;
-		default:
-			cfb_imageblit(info, image);
-			break;
-	}
+/*
+	if (image->depth == 1) {
+		switch (info->fix.accel) {
+			case FB_ACCEL_NEOMAGIC_NM2200:
+			case FB_ACCEL_NEOMAGIC_NM2230:
+			case FB_ACCEL_NEOMAGIC_NM2360:
+			case FB_ACCEL_NEOMAGIC_NM2380:
+				neo2200_imageblit(info, image);
+				break;
+			default:
+				cfb_imageblit(info, image);
+				break;
+		}
+	} else
+*/
+		cfb_imageblit(info, image);
 }	
 
 static int 
@@ -1496,8 +1548,67 @@
 	return 0;		
 }
 
+/*
+static void
+neofb_draw_cursor(struct fb_info *info, u8 *dst, u8 *src, unsigned int width)
+{
+	//memset_io(info->sprite.addr, 0xff, 1);
+}
+
+static int
+neofb_cursor(struct fb_info *info, struct fb_cursor *cursor)
+{
+	struct neofb_par *par = (struct neofb_par *) info->par;
+
+	* Disable cursor *
+	write_le32(NEOREG_CURSCNTL, ~NEO_CURS_ENABLE, par);
+
+	if (cursor->set & FB_CUR_SETPOS) {
+		u32 x = cursor->image.dx;
+		u32 y = cursor->image.dy;
+
+		info->cursor.image.dx = x;
+		info->cursor.image.dy = y;
+		write_le32(NEOREG_CURSX, x, par);
+		write_le32(NEOREG_CURSY, y, par);
+	}
+
+	if (cursor->set & FB_CUR_SETSIZE) {
+		info->cursor.image.height = cursor->image.height;
+		info->cursor.image.width = cursor->image.width;
+	}
+
+	if (cursor->set & FB_CUR_SETHOT)
+		info->cursor.hot = cursor->hot;
+
+	if (cursor->set & FB_CUR_SETCMAP) {
+		if (cursor->image.depth == 1) {
+			u32 fg = cursor->image.fg_color;
+			u32 bg = cursor->image.bg_color;
+
+			info->cursor.image.fg_color = fg;
+			info->cursor.image.bg_color = bg;
+
+			fg = ((fg & 0xff0000) >> 16) | ((fg & 0xff) << 16) | (fg & 0xff00);
+			bg = ((bg & 0xff0000) >> 16) | ((bg & 0xff) << 16) | (bg & 0xff00);
+			write_le32(NEOREG_CURSFGCOLOR, fg, par);
+			write_le32(NEOREG_CURSBGCOLOR, bg, par);
+		}
+	}
+
+	if (cursor->set & FB_CUR_SETSHAPE)
+		fb_load_cursor_image(info);
+
+	if (info->cursor.enable)
+		write_le32(NEOREG_CURSCNTL, NEO_CURS_ENABLE, par);
+	return 0;
+}
+*/
+
 static struct fb_ops neofb_ops = {
 	.owner		= THIS_MODULE,
+	.fb_open	= neofb_open,
+	.fb_release	= neofb_release,
 	.fb_check_var	= neofb_check_var,
 	.fb_set_par	= neofb_set_par,
 	.fb_setcolreg	= neofb_setcolreg,
@@ -1631,31 +1742,31 @@
 	return 0;
 }
 
-static void __devinit neo_unmap_mmio(struct fb_info *info)
+static void neo_unmap_mmio(struct fb_info *info)
 {
 	struct neofb_par *par = (struct neofb_par *) info->par;
 
 	DBG("neo_unmap_mmio");
 
-	if (par->mmio_vbase) {
-		iounmap(par->mmio_vbase);
-		par->mmio_vbase = NULL;
+	iounmap(par->mmio_vbase);
+	par->mmio_vbase = NULL;
 
-		release_mem_region(info->fix.mmio_start,
-				   info->fix.mmio_len);
-	}
+	release_mem_region(info->fix.mmio_start,
+			   info->fix.mmio_len);
 }
 
 static int __devinit neo_map_video(struct fb_info *info,
 				   struct pci_dev *dev, int video_len)
 {
+	//unsigned long addr;
+
 	DBG("neo_map_video");
 
 	info->fix.smem_start = pci_resource_start(dev, 0);
 	info->fix.smem_len = video_len;
 
-	if (!request_mem_region
-	    (info->fix.smem_start, info->fix.smem_len, "frame buffer")) {
+	if (!request_mem_region(info->fix.smem_start, info->fix.smem_len,
+				"frame buffer")) {
 		printk("neofb: frame buffer in use\n");
 		return -EBUSY;
 	}
@@ -1673,33 +1784,36 @@
 
 #ifdef CONFIG_MTRR
 	((struct neofb_par *)(info->par))->mtrr =
-	    mtrr_add(info->fix.smem_start, pci_resource_len(dev, 0),
-		     MTRR_TYPE_WRCOMB, 1);
+		mtrr_add(info->fix.smem_start, pci_resource_len(dev, 0),
+				MTRR_TYPE_WRCOMB, 1);
 #endif
 
 	/* Clear framebuffer, it's all white in memory after boot */
 	memset(info->screen_base, 0, info->fix.smem_len);
+
+	/* Allocate Cursor drawing pad.
+	info->fix.smem_len -= PAGE_SIZE;
+	addr = info->fix.smem_start + info->fix.smem_len;
+	write_le32(NEOREG_CURSMEMPOS, ((0x000f & (addr >> 10)) << 8) |
+					((0x0ff0 & (addr >> 10)) >> 4), par);
+	addr = (unsigned long) info->screen_base + info->fix.smem_len;
+	info->sprite.addr = (u8 *) addr; */
 	return 0;
 }
 
-static void __devinit neo_unmap_video(struct fb_info *info)
+static void neo_unmap_video(struct fb_info *info)
 {
-
-	DBG("neo_unmap_video");
-
-	if (info->screen_base) {
 #ifdef CONFIG_MTRR
-		struct neofb_par *par = (struct neofb_par *) info->par;
-		mtrr_del(par->mtrr, info->fix.smem_start,
-			 info->fix.smem_len);
-#endif
+	struct neofb_par *par = (struct neofb_par *) info->par;
 
-		iounmap(info->screen_base);
-		info->screen_base = NULL;
+	mtrr_del(par->mtrr, info->fix.smem_start,
+		 info->fix.smem_len);
+#endif
+	iounmap(info->screen_base);
+	info->screen_base = NULL;
 
-		release_mem_region(info->fix.smem_start,
-				   info->fix.smem_len);
-	}
+	release_mem_region(info->fix.smem_start,
+			   info->fix.smem_len);
 }
 
 static int __devinit neo_init_hw(struct fb_info *info)
@@ -1723,16 +1837,16 @@
 	printk(KERN_DEBUG "--- Neo extended register dump ---\n");
 	for (w = 0; w < 0x85; w++)
 		printk(KERN_DEBUG "CR %p: %p\n", (void *) w,
-		       (void *) VGArCR(w));
+		       (void *) vga_rcrt(NULL, w);
 	for (w = 0; w < 0xC7; w++)
 		printk(KERN_DEBUG "GR %p: %p\n", (void *) w,
-		       (void *) VGArGR(w));
+		       (void *) vga_rgfx(NULL, w));
 #endif
 
 	/* Determine the panel type */
-	VGAwGR(0x09, 0x26);
-	type = VGArGR(0x21);
-	display = VGArGR(0x20);
+	vga_wgfx(NULL, 0x09, 0x26);
+	type = vga_rgfx(NULL, 0x21);
+	display = vga_rgfx(NULL, 0x20);
 	if (!par->internal_display && !par->external_display) {
 		par->internal_display = display & 2 || !(display & 3) ? 1 : 0;
 		par->external_display = display & 1;
@@ -1742,8 +1856,8 @@
 	}
 
 	/* Determine panel width -- used in NeoValidMode. */
-	w = VGArGR(0x20);
-	VGAwGR(0x09, 0x00);
+	w = vga_rgfx(NULL, 0x20);
+	vga_wgfx(NULL, 0x09, 0x00);
 	switch ((w & 0x18) >> 3) {
 	case 0x00:
 		par->NeoPanelWidth = 640;
@@ -1868,10 +1982,16 @@
 		par->neo2200 = (Neo2200 *) par->mmio_vbase;
 		break;
 	}
-
+/*
+	info->sprite.size = CursorMem;
+	info->sprite.scan_align = 1;
+	info->sprite.buf_align = 1;
+	info->sprite.flags = FB_PIXMAP_IO;
+	info->sprite.outbuf = neofb_draw_cursor;
+*/
 	par->maxClock = maxClock;
-
-	return videoRam * 1024;
+	par->cursorOff = CursorOff;
+	return ((videoRam * 1024));
 }
 
 
@@ -1881,15 +2001,12 @@
 	struct fb_info *info;
 	struct neofb_par *par;
 
-	info = kmalloc(sizeof(struct fb_info) + sizeof(struct neofb_par) + 
-		       sizeof(u32) * 17, GFP_KERNEL);
+	info = framebuffer_alloc(sizeof(struct neofb_par) + sizeof(u32) * 256, &dev->dev);
 
 	if (!info)
 		return NULL;
 
-	memset(info, 0, sizeof(struct fb_info) + sizeof(struct neofb_par) + sizeof(u32) * 17);
-
-	par = (struct neofb_par *) (info + 1);
+	par = info->par;
 
 	info->fix.accel = id->driver_data;
 
@@ -1939,23 +2056,18 @@
 
 	info->fbops = &neofb_ops;
 	info->flags = FBINFO_FLAG_DEFAULT;
-	info->par = par;
 	info->pseudo_palette = (void *) (par + 1);
-
-	fb_alloc_cmap(&info->cmap, NR_PALETTE, 0);
-
 	return info;
 }
 
-static void __devinit neo_free_fb_info(struct fb_info *info)
+static void neo_free_fb_info(struct fb_info *info)
 {
 	if (info) {
 		/*
 		 * Free the colourmap
 		 */
-		fb_alloc_cmap(&info->cmap, 0, 0);
-
-		kfree(info);
+		fb_dealloc_cmap(&info->cmap);
+		framebuffer_release(info);
 	}
 }
 
@@ -1978,21 +2090,24 @@
 	err = -ENOMEM;
 	info = neo_alloc_fb_info(dev, id);
 	if (!info)
-		goto failed;
+		return err;
 
 	err = neo_map_mmio(info, dev);
 	if (err)
-		goto failed;
+		goto err_map_mmio;
 
 	video_len = neo_init_hw(info);
 	if (video_len < 0) {
 		err = video_len;
-		goto failed;
+		goto err_init_hw;
 	}
 
 	err = neo_map_video(info, dev, video_len);
 	if (err)
-		goto failed;
+		goto err_init_hw;
+
+	if (neofb_check_var(&info->var, info))
+		goto err_map_video;
 
 	/*
 	 * Calculate the hsync and vsync frequencies.  Note that
@@ -2013,10 +2128,12 @@
 	       info->fix.smem_len >> 10, info->var.xres,
 	       info->var.yres, h_sync / 1000, h_sync % 1000, v_sync);
 
+	if (fb_alloc_cmap(&info->cmap, 256, 0) < 0)
+		goto err_map_video;
 
 	err = register_framebuffer(info);
 	if (err < 0)
-		goto failed;
+		goto err_reg_fb;
 
 	printk(KERN_INFO "fb%d: %s frame buffer device\n",
 	       info->node, info->fix.id);
@@ -2027,11 +2144,14 @@
 	pci_set_drvdata(dev, info);
 	return 0;
 
-      failed:
+err_reg_fb:
+	fb_dealloc_cmap(&info->cmap);
+err_map_video:
 	neo_unmap_video(info);
+err_init_hw:
 	neo_unmap_mmio(info);
+err_map_mmio:
 	neo_free_fb_info(info);
-
 	return err;
 }
 
@@ -2103,24 +2223,6 @@
 	.remove =	__devexit_p(neofb_remove)
 };
 
-/* **************************** init-time only **************************** */
-
-static void __init neo_init(void)
-{
-	DBG("neo_init");
-	pci_register_driver(&neofb_driver);
-}
-
-/* **************************** exit-time only **************************** */
-
-static void __exit neo_done(void)
-{
-	DBG("neo_done");
-	pci_unregister_driver(&neofb_driver);
-}
-
-#ifndef MODULE
-
 /* ************************* init in-kernel code ************************** */
 
 int __init neofb_setup(char *options)
@@ -2136,8 +2238,6 @@
 		if (!*this_opt)
 			continue;
 
-		if (!strncmp(this_opt, "disabled", 8))
-			disabled = 1;
 		if (!strncmp(this_opt, "internal", 8))
 			internal = 1;
 		if (!strncmp(this_opt, "external", 8))
@@ -2153,41 +2253,18 @@
 	return 0;
 }
 
-static int __initdata initialized = 0;
-
 int __init neofb_init(void)
 {
-	DBG("neofb_init");
-
-	if (disabled)
-		return -ENXIO;
-
-	if (!initialized) {
-		initialized = 1;
-		neo_init();
-	}
-
-	/* never return failure, user can hotplug card later... */
-	return 0;
+	return pci_register_driver(&neofb_driver);
 }
 
-#else
-
-/* *************************** init module code **************************** */
+#ifdef MODULE
 
-int __init init_module(void)
+static void __exit neofb_exit(void)
 {
-	DBG("init_module");
-
-	if (disabled)
-		return -ENXIO;
-
-	neo_init();
-
-	/* never return failure; user can hotplug card later... */
-	return 0;
+	pci_unregister_driver(&neofb_driver);
 }
 
+module_init(neofb_init);
+module_exit(neofb_exit);
 #endif				/* MODULE */
-
-module_exit(neo_done);
diff -Nru a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
--- a/drivers/video/pm2fb.c	Tue Jun 15 22:21:05 2004
+++ b/drivers/video/pm2fb.c	Tue Jun 15 22:21:05 2004
@@ -63,6 +63,16 @@
 #endif
 
 /*
+ * The 2.4 driver calls reset_card() at init time, where it also sets the
+ * initial mode. I don't think the driver should touch the chip until
+ * the console sets a video mode. So I was calling this at the start
+ * of setting a mode. However, certainly on 1280x1024 depth 16 on my
+ * PCI Graphics Blaster Exxtreme this causes the display to smear
+ * slightly.  I don't know why. Guesses to jim.hague@acm.org.
+ */
+#undef RESET_CARD_ON_MODE_SET
+
+/*
  * Driver data 
  */
 static char *mode __initdata = NULL;
@@ -340,16 +350,7 @@
 	}
 }
 
-#if 0
-/*
- * FIXME:
- * The 2.4 driver calls this at init time, where it also sets the
- * initial mode. I don't think the driver should touch the chip
- * until the console sets a video mode. So I was calling this
- * at the start of setting a mode. However, certainly on 1280x1024
- * depth 16 this causes the display to smear slightly.
- * I don't know why. Guesses to jim.hague@acm.org.
- */
+#ifdef RESET_CARD_ON_MODE_SET
 static void reset_card(struct pm2fb_par* p)
 {
 	if (p->type == PM2_TYPE_PERMEDIA2V)
@@ -501,6 +502,8 @@
 	u32 vsync;
 
 	vsync = video;
+
+	DPRINTK("video = 0x%x\n", video);
 	
 	/*
 	 * The hardware cursor needs +vsync to recognise vert retrace.
@@ -660,6 +663,9 @@
 	u32 xres;
 	int data64;
 
+#ifdef RESET_CARD_ON_MODE_SET
+	reset_card(par);
+#endif
 	reset_config(par);
 	clear_palette(par);
     
@@ -721,8 +727,7 @@
 
 	info->fix.visual =
 		(depth == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
-	info->fix.line_length =
-		info->var.xres * ((info->var.bits_per_pixel + 7) >> 3);
+	info->fix.line_length = info->var.xres * depth / 8;
 	info->cmap.len = 256;
 
 	/*
@@ -803,6 +808,8 @@
 		break;
 	}
 	set_pixclock(par, pixclock);
+	DPRINTK("Setting graphics mode at %dx%d depth %d\n",
+		info->var.xres, info->var.yres, info->var.bits_per_pixel);
 	return 0;	
 }
 
@@ -843,7 +850,8 @@
 	 *   var->{color}.offset contains start of bitfield
 	 *   var->{color}.length contains length of bitfield
 	 *   {hardwarespecific} contains width of DAC
-	 *   cmap[X] is programmed to (X << red.offset) | (X << green.offset) | (X << blue.offset)
+	 *   cmap[X] is programmed to
+	 *   (X << red.offset) | (X << green.offset) | (X << blue.offset)
 	 *   RAMDAC[X] is programmed to (red, green, blue)
 	 *
 	 * Pseudocolor:
@@ -856,8 +864,9 @@
 	 *    does not use RAMDAC (usually has 3 of them).
 	 *    var->{color}.offset contains start of bitfield
 	 *    var->{color}.length contains length of bitfield
-	 *    cmap is programmed to (red << red.offset) | (green << green.offset) |
-	 *                      (blue << blue.offset) | (transp << transp.offset)
+	 *    cmap is programmed to
+	 *    (red << red.offset) | (green << green.offset) |
+	 *    (blue << blue.offset) | (transp << transp.offset)
 	 *    RAMDAC does not exist
 	 */
 #define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
@@ -962,6 +971,11 @@
 	struct pm2fb_par *par = (struct pm2fb_par *) info->par;
 	u32 video = par->video;
 
+	DPRINTK("blank_mode %d\n", blank_mode);
+
+	/* Turn everything on, then disable as requested. */
+	video |= (PM2F_VIDEO_ENABLE | PM2F_HSYNC_MASK | PM2F_VSYNC_MASK);
+
 	switch (blank_mode) {
 	case 0: 	/* Screen: On; HSync: On, VSync: On */
 		break;
@@ -1030,15 +1044,12 @@
 		return err;
 	}
 
-	size = sizeof(struct fb_info) + sizeof(struct pm2fb_par) + 256 * sizeof(u32);
-
+	size = sizeof(struct pm2fb_par) + 256 * sizeof(u32);
 	info = framebuffer_alloc(size, &pdev->dev);
 	if ( !info )
 		return -ENOMEM;
-	memset(info, 0, size);
-    
-	default_par = info->par;
- 
+	default_par = (struct pm2fb_par *) info->par;
+
 	switch (pdev->device) {
 	case  PCI_DEVICE_ID_TI_TVP4020:
 		strcpy(pm2fb_fix.id, "TVP4020");
@@ -1112,7 +1123,6 @@
 
 	info->fbops		= &pm2fb_ops;
 	info->fix		= pm2fb_fix; 	
-	info->par		= default_par;
 	info->pseudo_palette	= (void *)(default_par + 1); 
 	info->flags		= FBINFO_FLAG_DEFAULT;
 
diff -Nru a/drivers/video/pxafb.c b/drivers/video/pxafb.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/video/pxafb.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1381 @@
+/*
+ *  linux/drivers/video/pxafb.c
+ *
+ *  Copyright (C) 1999 Eric A. Thomas.
+ *  Copyright (C) 2004 Jean-Frederic Clere.
+ *  Copyright (C) 2004 Ian Campbell.
+ *  Copyright (C) 2004 Jeff Lackey.
+ *   Based on sa1100fb.c Copyright (C) 1999 Eric A. Thomas
+ *  which in turn is
+ *   Based on acornfb.c Copyright (C) Russell King.
+ *
+ * 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.
+ *
+ *	        Intel PXA250/210 LCD Controller Frame Buffer Driver
+ *
+ * Please direct your questions and comments on this driver to the following
+ * email address:
+ *
+ *	linux-arm-kernel@lists.arm.linux.org.uk
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/interrupt.h>
+#include <linux/slab.h>
+#include <linux/fb.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/cpufreq.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+#include <asm/uaccess.h>
+#include <asm/arch/bitfield.h>
+#include <asm/arch/pxafb.h>
+
+/*
+ * Complain if VAR is out of range.
+ */
+#define DEBUG_VAR 1
+
+#include "pxafb.h"
+
+/* Bits which should not be set in machine configuration structures */
+#define LCCR0_INVALID_CONFIG_MASK (LCCR0_OUM|LCCR0_BM|LCCR0_QDM|LCCR0_DIS|LCCR0_EFM|LCCR0_IUM|LCCR0_SFM|LCCR0_LDM|LCCR0_ENB)
+#define LCCR3_INVALID_CONFIG_MASK (LCCR3_HSP|LCCR3_VSP|LCCR3_PCD|LCCR3_BPP)
+
+static void (*pxafb_backlight_power)(int);
+static void (*pxafb_lcd_power)(int);
+
+static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *);
+static void set_ctrlr_state(struct pxafb_info *fbi, u_int state);
+
+#ifdef CONFIG_FB_PXA_PARAMETERS
+#define PXAFB_OPTIONS_SIZE 256
+static char g_options[PXAFB_OPTIONS_SIZE] __initdata = "";
+#endif
+
+static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+	/*
+	 * We need to handle two requests being made at the same time.
+	 * There are two important cases:
+	 *  1. When we are changing VT (C_REENABLE) while unblanking (C_ENABLE)
+	 *     We must perform the unblanking, which will do our REENABLE for us.
+	 *  2. When we are blanking, but immediately unblank before we have
+	 *     blanked.  We do the "REENABLE" thing here as well, just to be sure.
+	 */
+	if (fbi->task_state == C_ENABLE && state == C_REENABLE)
+		state = (u_int) -1;
+	if (fbi->task_state == C_DISABLE && state == C_ENABLE)
+		state = C_REENABLE;
+
+	if (state != (u_int)-1) {
+		fbi->task_state = state;
+		schedule_work(&fbi->task);
+	}
+	local_irq_restore(flags);
+}
+
+static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
+{
+	chan &= 0xffff;
+	chan >>= 16 - bf->length;
+	return chan << bf->offset;
+}
+
+static int
+pxafb_setpalettereg(u_int regno, u_int red, u_int green, u_int blue,
+		       u_int trans, struct fb_info *info)
+{
+	struct pxafb_info *fbi = (struct pxafb_info *)info;
+	u_int val, ret = 1;
+
+	if (regno < fbi->palette_size) {
+		val  = ((red   >>  0) & 0xf800);
+		val |= ((green >>  5) & 0x07e0);
+		val |= ((blue  >> 11) & 0x001f);
+
+		fbi->palette_cpu[regno] = val;
+		ret = 0;
+	}
+	return ret;
+}
+
+static int
+pxafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+		   u_int trans, struct fb_info *info)
+{
+	struct pxafb_info *fbi = (struct pxafb_info *)info;
+	unsigned int val;
+	int ret = 1;
+
+	/*
+	 * If inverse mode was selected, invert all the colours
+	 * rather than the register number.  The register number
+	 * is what you poke into the framebuffer to produce the
+	 * colour you requested.
+	 */
+	if (fbi->cmap_inverse) {
+		red   = 0xffff - red;
+		green = 0xffff - green;
+		blue  = 0xffff - blue;
+	}
+
+	/*
+	 * If greyscale is true, then we convert the RGB value
+	 * to greyscale no matter what visual we are using.
+	 */
+	if (fbi->fb.var.grayscale)
+		red = green = blue = (19595 * red + 38470 * green +
+					7471 * blue) >> 16;
+
+	switch (fbi->fb.fix.visual) {
+	case FB_VISUAL_TRUECOLOR:
+		/*
+		 * 12 or 16-bit True Colour.  We encode the RGB value
+		 * according to the RGB bitfield information.
+		 */
+		if (regno < 16) {
+			u32 *pal = fbi->fb.pseudo_palette;
+
+			val  = chan_to_field(red, &fbi->fb.var.red);
+			val |= chan_to_field(green, &fbi->fb.var.green);
+			val |= chan_to_field(blue, &fbi->fb.var.blue);
+
+			pal[regno] = val;
+			ret = 0;
+		}
+		break;
+
+	case FB_VISUAL_STATIC_PSEUDOCOLOR:
+	case FB_VISUAL_PSEUDOCOLOR:
+		ret = pxafb_setpalettereg(regno, red, green, blue, trans, info);
+		break;
+	}
+
+	return ret;
+}
+
+/*
+ *  pxafb_bpp_to_lccr3():
+ *    Convert a bits per pixel value to the correct bit pattern for LCCR3
+ */
+static int pxafb_bpp_to_lccr3(struct fb_var_screeninfo *var)
+{
+        int ret = 0;
+        switch (var->bits_per_pixel) {
+        case 1:  ret = LCCR3_1BPP; break;
+        case 2:  ret = LCCR3_2BPP; break;
+        case 4:  ret = LCCR3_4BPP; break;
+        case 8:  ret = LCCR3_8BPP; break;
+        case 16: ret = LCCR3_16BPP; break;
+        }
+        return ret;
+}
+
+#ifdef CONFIG_CPU_FREQ
+/*
+ *  pxafb_display_dma_period()
+ *    Calculate the minimum period (in picoseconds) between two DMA
+ *    requests for the LCD controller.  If we hit this, it means we're
+ *    doing nothing but LCD DMA.
+ */
+static unsigned int pxafb_display_dma_period(struct fb_var_screeninfo *var)
+{
+       /*
+        * Period = pixclock * bits_per_byte * bytes_per_transfer
+        *              / memory_bits_per_pixel;
+        */
+       return var->pixclock * 8 * 16 / var->bits_per_pixel;
+}
+
+extern unsigned int get_clk_frequency_khz(int info);
+#endif
+
+/*
+ *  pxafb_check_var():
+ *    Get the video params out of 'var'. If a value doesn't fit, round it up,
+ *    if it's too big, return -EINVAL.
+ *
+ *    Round up in the following order: bits_per_pixel, xres,
+ *    yres, xres_virtual, yres_virtual, xoffset, yoffset, grayscale,
+ *    bitfields, horizontal timing, vertical timing.
+ */
+static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
+{
+	struct pxafb_info *fbi = (struct pxafb_info *)info;
+
+	if (var->xres < MIN_XRES)
+		var->xres = MIN_XRES;
+	if (var->yres < MIN_YRES)
+		var->yres = MIN_YRES;
+	if (var->xres > fbi->max_xres)
+		var->xres = fbi->max_xres;
+	if (var->yres > fbi->max_yres)
+		var->yres = fbi->max_yres;
+	var->xres_virtual =
+		max(var->xres_virtual, var->xres);
+	var->yres_virtual =
+		max(var->yres_virtual, var->yres);
+
+        /*
+	 * Setup the RGB parameters for this display.
+	 *
+	 * The pixel packing format is described on page 7-11 of the
+	 * PXA2XX Developer's Manual.
+         */
+	if ( var->bits_per_pixel == 16 ) {
+		var->red.offset   = 11; var->red.length   = 5;
+		var->green.offset = 5;  var->green.length = 6;
+		var->blue.offset  = 0;  var->blue.length  = 5;
+		var->transp.offset = var->transp.length = 0;
+	} else {
+		var->red.offset = var->green.offset = var->blue.offset = var->transp.offset = 0;
+		var->red.length   = 8;
+		var->green.length = 8;
+		var->blue.length  = 8;
+		var->transp.length = 0;
+	}
+
+#ifdef CONFIG_CPU_FREQ
+	DPRINTK("dma period = %d ps, clock = %d kHz\n",
+		pxafb_display_dma_period(var),
+		get_clk_frequency_khz(0));
+#endif
+
+	return 0;
+}
+
+static inline void pxafb_set_truecolor(u_int is_true_color)
+{
+	DPRINTK("true_color = %d\n", is_true_color);
+	// do your machine-specific setup if needed
+}
+
+/*
+ * pxafb_set_par():
+ *	Set the user defined part of the display for the specified console
+ */
+static int pxafb_set_par(struct fb_info *info)
+{
+	struct pxafb_info *fbi = (struct pxafb_info *)info;
+	struct fb_var_screeninfo *var = &info->var;
+	unsigned long palette_mem_size;
+
+	DPRINTK("set_par\n");
+
+	if (var->bits_per_pixel == 16)
+		fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR;
+	else if (!fbi->cmap_static)
+		fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
+	else {
+		/*
+		 * Some people have weird ideas about wanting static
+		 * pseudocolor maps.  I suspect their user space
+		 * applications are broken.
+		 */
+		fbi->fb.fix.visual = FB_VISUAL_STATIC_PSEUDOCOLOR;
+	}
+
+	fbi->fb.fix.line_length = var->xres_virtual *
+				  var->bits_per_pixel / 8;
+	fbi->palette_size = var->bits_per_pixel == 8 ? 256 : 16;
+
+	palette_mem_size = fbi->palette_size * sizeof(u16);
+
+	DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size);
+
+	fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size);
+	fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size;
+
+	/*
+	 * Set (any) board control register to handle new color depth
+	 */
+	pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR);
+
+	pxafb_activate_var(var, fbi);
+
+	return 0;
+}
+
+/*
+ * Formal definition of the VESA spec:
+ *  On
+ *  	This refers to the state of the display when it is in full operation
+ *  Stand-By
+ *  	This defines an optional operating state of minimal power reduction with
+ *  	the shortest recovery time
+ *  Suspend
+ *  	This refers to a level of power management in which substantial power
+ *  	reduction is achieved by the display.  The display can have a longer
+ *  	recovery time from this state than from the Stand-by state
+ *  Off
+ *  	This indicates that the display is consuming the lowest level of power
+ *  	and is non-operational. Recovery from this state may optionally require
+ *  	the user to manually power on the monitor
+ *
+ *  Now, the fbdev driver adds an additional state, (blank), where they
+ *  turn off the video (maybe by colormap tricks), but don't mess with the
+ *  video itself: think of it semantically between on and Stand-By.
+ *
+ *  So here's what we should do in our fbdev blank routine:
+ *
+ *  	VESA_NO_BLANKING (mode 0)	Video on,  front/back light on
+ *  	VESA_VSYNC_SUSPEND (mode 1)  	Video on,  front/back light off
+ *  	VESA_HSYNC_SUSPEND (mode 2)  	Video on,  front/back light off
+ *  	VESA_POWERDOWN (mode 3)		Video off, front/back light off
+ *
+ *  This will match the matrox implementation.
+ */
+
+/*
+ * pxafb_blank():
+ *	Blank the display by setting all palette values to zero.  Note, the
+ * 	12 and 16 bpp modes don't really use the palette, so this will not
+ *      blank the display in all modes.
+ */
+static int pxafb_blank(int blank, struct fb_info *info)
+{
+	struct pxafb_info *fbi = (struct pxafb_info *)info;
+	int i;
+
+	DPRINTK("pxafb_blank: blank=%d\n", blank);
+
+	switch (blank) {
+	case VESA_POWERDOWN:
+	case VESA_VSYNC_SUSPEND:
+	case VESA_HSYNC_SUSPEND:
+		if (fbi->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR ||
+		    fbi->fb.fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
+			for (i = 0; i < fbi->palette_size; i++)
+				pxafb_setpalettereg(i, 0, 0, 0, 0, info);
+
+		pxafb_schedule_work(fbi, C_DISABLE);
+		//TODO if (pxafb_blank_helper) pxafb_blank_helper(blank);
+		break;
+
+	case VESA_NO_BLANKING:
+		//TODO if (pxafb_blank_helper) pxafb_blank_helper(blank);
+		if (fbi->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR ||
+		    fbi->fb.fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
+			fb_set_cmap(&fbi->fb.cmap, 1, info);
+		pxafb_schedule_work(fbi, C_ENABLE);
+	}
+	return 0;
+}
+
+static struct fb_ops pxafb_ops = {
+	.owner		= THIS_MODULE,
+	.fb_check_var	= pxafb_check_var,
+	.fb_set_par	= pxafb_set_par,
+	.fb_setcolreg	= pxafb_setcolreg,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
+	.fb_blank	= pxafb_blank,
+	.fb_cursor	= soft_cursor,
+};
+
+/*
+ * Calculate the PCD value from the clock rate (in picoseconds).
+ * We take account of the PPCR clock setting.
+ * From PXA Developer's Manual:
+ *
+ *   PixelClock =      LCLK
+ *                -------------
+ *                2 ( PCD + 1 )
+ *
+ *   PCD =      LCLK
+ *         ------------- - 1
+ *         2(PixelClock)
+ *
+ * Where:
+ *   LCLK = LCD/Memory Clock
+ *   PCD = LCCR3[7:0]
+ *
+ * PixelClock here is in Hz while the pixclock argument given is the
+ * period in picoseconds. Hence PixelClock = 1 / ( pixclock * 10^-12 )
+ *
+ * The function get_lclk_frequency_10khz returns LCLK in units of
+ * 10khz. Calling the result of this function lclk gives us the
+ * following
+ *
+ *    PCD = (lclk * 10^4 ) * ( pixclock * 10^-12 )
+ *          -------------------------------------- - 1
+ *                          2
+ *
+ * Factoring the 10^4 and 10^-12 out gives 10^-8 == 1 / 100000000 as used below.
+ */
+static inline unsigned int get_pcd(unsigned int pixclock)
+{
+	unsigned long long pcd;
+
+	/* FIXME: Need to take into account Double Pixel Clock mode
+         * (DPC) bit? or perhaps set it based on the various clock
+         * speeds */
+
+	pcd = (unsigned long long)get_lcdclk_frequency_10khz() * pixclock;
+	pcd /= 100000000 * 2;
+	/* no need for this, since we should subtract 1 anyway. they cancel */
+	/* pcd += 1; */ /* make up for integer math truncations */
+	return (unsigned int)pcd;
+}
+
+/*
+ * pxafb_activate_var():
+ *	Configures LCD Controller based on entries in var parameter.  Settings are
+ *	only written to the controller if changes were made.
+ */
+static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *fbi)
+{
+	struct pxafb_lcd_reg new_regs;
+	u_long flags;
+	u_int lines_per_panel, pcd = get_pcd(var->pixclock);
+
+	DPRINTK("Configuring PXA LCD\n");
+
+	DPRINTK("var: xres=%d hslen=%d lm=%d rm=%d\n",
+		var->xres, var->hsync_len,
+		var->left_margin, var->right_margin);
+	DPRINTK("var: yres=%d vslen=%d um=%d bm=%d\n",
+		var->yres, var->vsync_len,
+		var->upper_margin, var->lower_margin);
+	DPRINTK("var: pixclock=%d pcd=%d\n", var->pixclock, pcd);
+
+#if DEBUG_VAR
+	if (var->xres < 16        || var->xres > 1024)
+		printk(KERN_ERR "%s: invalid xres %d\n",
+			fbi->fb.fix.id, var->xres);
+	switch(var->bits_per_pixel) {
+	case 1:
+	case 2:
+	case 4:
+	case 8:
+	case 16:
+		break;
+	default:
+		printk(KERN_ERR "%s: invalid bit depth %d\n",
+		       fbi->fb.fix.id, var->bits_per_pixel);
+		break;
+	}
+	if (var->hsync_len < 1    || var->hsync_len > 64)
+		printk(KERN_ERR "%s: invalid hsync_len %d\n",
+			fbi->fb.fix.id, var->hsync_len);
+	if (var->left_margin < 1  || var->left_margin > 255)
+		printk(KERN_ERR "%s: invalid left_margin %d\n",
+			fbi->fb.fix.id, var->left_margin);
+	if (var->right_margin < 1 || var->right_margin > 255)
+		printk(KERN_ERR "%s: invalid right_margin %d\n",
+			fbi->fb.fix.id, var->right_margin);
+	if (var->yres < 1         || var->yres > 1024)
+		printk(KERN_ERR "%s: invalid yres %d\n",
+			fbi->fb.fix.id, var->yres);
+	if (var->vsync_len < 1    || var->vsync_len > 64)
+		printk(KERN_ERR "%s: invalid vsync_len %d\n",
+			fbi->fb.fix.id, var->vsync_len);
+	if (var->upper_margin < 0 || var->upper_margin > 255)
+		printk(KERN_ERR "%s: invalid upper_margin %d\n",
+			fbi->fb.fix.id, var->upper_margin);
+	if (var->lower_margin < 0 || var->lower_margin > 255)
+		printk(KERN_ERR "%s: invalid lower_margin %d\n",
+			fbi->fb.fix.id, var->lower_margin);
+#endif
+
+	new_regs.lccr0 = fbi->lccr0 |
+		(LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM |
+                 LCCR0_QDM | LCCR0_BM  | LCCR0_OUM);
+
+	new_regs.lccr1 =
+		LCCR1_DisWdth(var->xres) +
+		LCCR1_HorSnchWdth(var->hsync_len) +
+		LCCR1_BegLnDel(var->left_margin) +
+		LCCR1_EndLnDel(var->right_margin);
+
+	/*
+	 * If we have a dual scan LCD, we need to halve
+	 * the YRES parameter.
+	 */
+	lines_per_panel = var->yres;
+	if (fbi->lccr0 & LCCR0_SDS)
+		lines_per_panel /= 2;
+
+	new_regs.lccr2 =
+		LCCR2_DisHght(lines_per_panel) +
+		LCCR2_VrtSnchWdth(var->vsync_len) +
+		LCCR2_BegFrmDel(var->upper_margin) +
+		LCCR2_EndFrmDel(var->lower_margin);
+
+	new_regs.lccr3 = fbi->lccr3 |
+		pxafb_bpp_to_lccr3(var) |
+		(var->sync & FB_SYNC_HOR_HIGH_ACT ? LCCR3_HorSnchH : LCCR3_HorSnchL) |
+		(var->sync & FB_SYNC_VERT_HIGH_ACT ? LCCR3_VrtSnchH : LCCR3_VrtSnchL);
+
+	if (pcd)
+		new_regs.lccr3 |= LCCR3_PixClkDiv(pcd);
+
+	DPRINTK("nlccr0 = 0x%08x\n", new_regs.lccr0);
+	DPRINTK("nlccr1 = 0x%08x\n", new_regs.lccr1);
+	DPRINTK("nlccr2 = 0x%08x\n", new_regs.lccr2);
+	DPRINTK("nlccr3 = 0x%08x\n", new_regs.lccr3);
+
+	/* Update shadow copy atomically */
+	local_irq_save(flags);
+
+	/* setup dma descriptors */
+	fbi->dmadesc_fblow_cpu = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette_cpu - 3*16);
+	fbi->dmadesc_fbhigh_cpu = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette_cpu - 2*16);
+	fbi->dmadesc_palette_cpu = (struct pxafb_dma_descriptor *)((unsigned int)fbi->palette_cpu - 1*16);
+
+	fbi->dmadesc_fblow_dma = fbi->palette_dma - 3*16;
+	fbi->dmadesc_fbhigh_dma = fbi->palette_dma - 2*16;
+	fbi->dmadesc_palette_dma = fbi->palette_dma - 1*16;
+
+#define BYTES_PER_PANEL (lines_per_panel * fbi->fb.fix.line_length)
+
+	/* populate descriptors */
+	fbi->dmadesc_fblow_cpu->fdadr = fbi->dmadesc_fblow_dma;
+	fbi->dmadesc_fblow_cpu->fsadr = fbi->screen_dma + BYTES_PER_PANEL;
+	fbi->dmadesc_fblow_cpu->fidr  = 0;
+	fbi->dmadesc_fblow_cpu->ldcmd = BYTES_PER_PANEL;
+
+	fbi->fdadr1 = fbi->dmadesc_fblow_dma; /* only used in dual-panel mode */
+
+	fbi->dmadesc_fbhigh_cpu->fsadr = fbi->screen_dma;
+	fbi->dmadesc_fbhigh_cpu->fidr = 0;
+	fbi->dmadesc_fbhigh_cpu->ldcmd = BYTES_PER_PANEL;
+
+	fbi->dmadesc_palette_cpu->fsadr = fbi->palette_dma;
+	fbi->dmadesc_palette_cpu->fidr  = 0;
+	fbi->dmadesc_palette_cpu->ldcmd = (fbi->palette_size * 2) | LDCMD_PAL;
+
+	if( var->bits_per_pixel < 12)
+	{
+		/* assume any mode with <12 bpp is palette driven */
+		fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_fbhigh_dma;
+		fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_palette_dma;
+		fbi->fdadr0 = fbi->dmadesc_palette_dma; /* flips back and forth between pal and fbhigh */
+	}
+	else
+	{
+		/* palette shouldn't be loaded in true-color mode */
+		fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_fbhigh_dma;
+		fbi->fdadr0 = fbi->dmadesc_fbhigh_dma; /* no pal just fbhigh */
+		/* init it to something, even though we won't be using it */
+		fbi->dmadesc_palette_cpu->fdadr = fbi->dmadesc_palette_dma;
+	}
+
+#if 0
+	DPRINTK("fbi->dmadesc_fblow_cpu = 0x%p\n", fbi->dmadesc_fblow_cpu);
+	DPRINTK("fbi->dmadesc_fbhigh_cpu = 0x%p\n", fbi->dmadesc_fbhigh_cpu);
+	DPRINTK("fbi->dmadesc_palette_cpu = 0x%p\n", fbi->dmadesc_palette_cpu);
+	DPRINTK("fbi->dmadesc_fblow_dma = 0x%x\n", fbi->dmadesc_fblow_dma);
+	DPRINTK("fbi->dmadesc_fbhigh_dma = 0x%x\n", fbi->dmadesc_fbhigh_dma);
+	DPRINTK("fbi->dmadesc_palette_dma = 0x%x\n", fbi->dmadesc_palette_dma);
+
+	DPRINTK("fbi->dmadesc_fblow_cpu->fdadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fdadr);
+	DPRINTK("fbi->dmadesc_fbhigh_cpu->fdadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fdadr);
+	DPRINTK("fbi->dmadesc_palette_cpu->fdadr = 0x%x\n", fbi->dmadesc_palette_cpu->fdadr);
+
+	DPRINTK("fbi->dmadesc_fblow_cpu->fsadr = 0x%x\n", fbi->dmadesc_fblow_cpu->fsadr);
+	DPRINTK("fbi->dmadesc_fbhigh_cpu->fsadr = 0x%x\n", fbi->dmadesc_fbhigh_cpu->fsadr);
+	DPRINTK("fbi->dmadesc_palette_cpu->fsadr = 0x%x\n", fbi->dmadesc_palette_cpu->fsadr);
+
+	DPRINTK("fbi->dmadesc_fblow_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fblow_cpu->ldcmd);
+	DPRINTK("fbi->dmadesc_fbhigh_cpu->ldcmd = 0x%x\n", fbi->dmadesc_fbhigh_cpu->ldcmd);
+	DPRINTK("fbi->dmadesc_palette_cpu->ldcmd = 0x%x\n", fbi->dmadesc_palette_cpu->ldcmd);
+#endif
+
+	fbi->reg_lccr0 = new_regs.lccr0;
+	fbi->reg_lccr1 = new_regs.lccr1;
+	fbi->reg_lccr2 = new_regs.lccr2;
+	fbi->reg_lccr3 = new_regs.lccr3;
+	local_irq_restore(flags);
+
+	/*
+	 * Only update the registers if the controller is enabled
+	 * and something has changed.
+	 */
+	if ((LCCR0  != fbi->reg_lccr0) || (LCCR1  != fbi->reg_lccr1) ||
+	    (LCCR2  != fbi->reg_lccr2) || (LCCR3  != fbi->reg_lccr3) ||
+	    (FDADR0 != fbi->fdadr0)    || (FDADR1 != fbi->fdadr1))
+		pxafb_schedule_work(fbi, C_REENABLE);
+
+	return 0;
+}
+
+/*
+ * NOTE!  The following functions are purely helpers for set_ctrlr_state.
+ * Do not call them directly; set_ctrlr_state does the correct serialisation
+ * to ensure that things happen in the right way 100% of time time.
+ *	-- rmk
+ */
+static inline void __pxafb_backlight_power(struct pxafb_info *fbi, int on)
+{
+	DPRINTK("backlight o%s\n", on ? "n" : "ff");
+
+ 	if (pxafb_backlight_power)
+ 		pxafb_backlight_power(on);
+}
+
+static inline void __pxafb_lcd_power(struct pxafb_info *fbi, int on)
+{
+	DPRINTK("LCD power o%s\n", on ? "n" : "ff");
+
+	if (pxafb_lcd_power)
+		pxafb_lcd_power(on);
+}
+
+static void pxafb_setup_gpio(struct pxafb_info *fbi)
+{
+        unsigned int lccr0 = fbi->lccr0;
+
+	/*
+	 * setup is based on type of panel supported
+        */
+
+	/* 4 bit interface */
+	if ((lccr0 & LCCR0_CMS) == LCCR0_Mono &&
+	    (lccr0 & LCCR0_SDS) == LCCR0_Sngl &&
+	    (lccr0 & LCCR0_DPD) == LCCR0_4PixMono)
+	{
+		// bits 58-61
+		GPDR1 |= (0xf << 26);
+		GAFR1_U = (GAFR1_U & ~(0xff << 20)) | (0xaa << 20);
+
+		// bits 74-77
+		GPDR2 |= (0xf << 10);
+		GAFR2_L = (GAFR2_L & ~(0xff << 20)) | (0xaa << 20);
+	}
+
+	/* 8 bit interface */
+        else if (((lccr0 & LCCR0_CMS) == LCCR0_Mono &&
+		  ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_DPD) == LCCR0_8PixMono)) ||
+                 ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
+		  (lccr0 & LCCR0_PAS) == LCCR0_Pas && (lccr0 & LCCR0_SDS) == LCCR0_Sngl))
+	{
+		// bits 58-65
+		GPDR1 |= (0x3f << 26);
+		GPDR2 |= (0x3);
+
+		GAFR1_U = (GAFR1_U & ~(0xfff << 20)) | (0xaaa << 20);
+		GAFR2_L = (GAFR2_L & ~0xf) | (0xa);
+
+		// bits 74-77
+		GPDR2 |= (0xf << 10);
+		GAFR2_L = (GAFR2_L & ~(0xff << 20)) | (0xaa << 20);
+	}
+
+	/* 16 bit interface */
+	else if ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
+		 ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_PAS) == LCCR0_Act))
+	{
+		// bits 58-77
+		GPDR1 |= (0x3f << 26);
+		GPDR2 |= 0x00003fff;
+
+		GAFR1_U = (GAFR1_U & ~(0xfff << 20)) | (0xaaa << 20);
+		GAFR2_L = (GAFR2_L & 0xf0000000) | 0x0aaaaaaa;
+	}
+
+	else {
+	        printk( KERN_ERR "pxafb_setup_gpio: unable to determine bits per pixel\n");
+        }
+}
+
+static void pxafb_enable_controller(struct pxafb_info *fbi)
+{
+	DPRINTK("Enabling LCD controller\n");
+	DPRINTK("fdadr0 0x%08x\n", (unsigned int) fbi->fdadr0);
+	DPRINTK("fdadr1 0x%08x\n", (unsigned int) fbi->fdadr1);
+	DPRINTK("reg_lccr0 0x%08x\n", (unsigned int) fbi->reg_lccr0);
+	DPRINTK("reg_lccr1 0x%08x\n", (unsigned int) fbi->reg_lccr1);
+	DPRINTK("reg_lccr2 0x%08x\n", (unsigned int) fbi->reg_lccr2);
+	DPRINTK("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3);
+
+	/* Sequence from 11.7.10 */
+	LCCR3 = fbi->reg_lccr3;
+	LCCR2 = fbi->reg_lccr2;
+	LCCR1 = fbi->reg_lccr1;
+	LCCR0 = fbi->reg_lccr0 & ~LCCR0_ENB;
+
+	FDADR0 = fbi->fdadr0;
+	FDADR1 = fbi->fdadr1;
+	LCCR0 |= LCCR0_ENB;
+
+	DPRINTK("FDADR0 0x%08x\n", (unsigned int) FDADR0);
+	DPRINTK("FDADR1 0x%08x\n", (unsigned int) FDADR1);
+	DPRINTK("LCCR0 0x%08x\n", (unsigned int) LCCR0);
+	DPRINTK("LCCR1 0x%08x\n", (unsigned int) LCCR1);
+	DPRINTK("LCCR2 0x%08x\n", (unsigned int) LCCR2);
+	DPRINTK("LCCR3 0x%08x\n", (unsigned int) LCCR3);
+}
+
+static void pxafb_disable_controller(struct pxafb_info *fbi)
+{
+	DECLARE_WAITQUEUE(wait, current);
+
+	DPRINTK("Disabling LCD controller\n");
+
+	add_wait_queue(&fbi->ctrlr_wait, &wait);
+	set_current_state(TASK_UNINTERRUPTIBLE);
+
+	LCSR = 0xffffffff;	/* Clear LCD Status Register */
+	LCCR0 &= ~LCCR0_LDM;	/* Enable LCD Disable Done Interrupt */
+	LCCR0 |= LCCR0_DIS;	/* Disable LCD Controller */
+
+	schedule_timeout(20 * HZ / 1000);
+	remove_wait_queue(&fbi->ctrlr_wait, &wait);
+}
+
+/*
+ *  pxafb_handle_irq: Handle 'LCD DONE' interrupts.
+ */
+static irqreturn_t pxafb_handle_irq(int irq, void *dev_id, struct pt_regs *regs)
+{
+	struct pxafb_info *fbi = dev_id;
+	unsigned int lcsr = LCSR;
+
+	if (lcsr & LCSR_LDD) {
+		LCCR0 |= LCCR0_LDM;
+		wake_up(&fbi->ctrlr_wait);
+	}
+
+	LCSR = lcsr;
+	return IRQ_HANDLED;
+}
+
+/*
+ * This function must be called from task context only, since it will
+ * sleep when disabling the LCD controller, or if we get two contending
+ * processes trying to alter state.
+ */
+static void set_ctrlr_state(struct pxafb_info *fbi, u_int state)
+{
+	u_int old_state;
+
+	down(&fbi->ctrlr_sem);
+
+	old_state = fbi->state;
+
+	/*
+	 * Hack around fbcon initialisation.
+	 */
+	if (old_state == C_STARTUP && state == C_REENABLE)
+		state = C_ENABLE;
+
+	switch (state) {
+	case C_DISABLE_CLKCHANGE:
+		/*
+		 * Disable controller for clock change.  If the
+		 * controller is already disabled, then do nothing.
+		 */
+		if (old_state != C_DISABLE && old_state != C_DISABLE_PM) {
+			fbi->state = state;
+			//TODO __pxafb_lcd_power(fbi, 0);
+			pxafb_disable_controller(fbi);
+		}
+		break;
+
+	case C_DISABLE_PM:
+	case C_DISABLE:
+		/*
+		 * Disable controller
+		 */
+		if (old_state != C_DISABLE) {
+			fbi->state = state;
+			__pxafb_backlight_power(fbi, 0);
+			__pxafb_lcd_power(fbi, 0);
+			if (old_state != C_DISABLE_CLKCHANGE)
+				pxafb_disable_controller(fbi);
+		}
+		break;
+
+	case C_ENABLE_CLKCHANGE:
+		/*
+		 * Enable the controller after clock change.  Only
+		 * do this if we were disabled for the clock change.
+		 */
+		if (old_state == C_DISABLE_CLKCHANGE) {
+			fbi->state = C_ENABLE;
+			pxafb_enable_controller(fbi);
+			//TODO __pxafb_lcd_power(fbi, 1);
+		}
+		break;
+
+	case C_REENABLE:
+		/*
+		 * Re-enable the controller only if it was already
+		 * enabled.  This is so we reprogram the control
+		 * registers.
+		 */
+		if (old_state == C_ENABLE) {
+			pxafb_disable_controller(fbi);
+			pxafb_setup_gpio(fbi);
+			pxafb_enable_controller(fbi);
+		}
+		break;
+
+	case C_ENABLE_PM:
+		/*
+		 * Re-enable the controller after PM.  This is not
+		 * perfect - think about the case where we were doing
+		 * a clock change, and we suspended half-way through.
+		 */
+		if (old_state != C_DISABLE_PM)
+			break;
+		/* fall through */
+
+	case C_ENABLE:
+		/*
+		 * Power up the LCD screen, enable controller, and
+		 * turn on the backlight.
+		 */
+		if (old_state != C_ENABLE) {
+			fbi->state = C_ENABLE;
+			pxafb_setup_gpio(fbi);
+			pxafb_enable_controller(fbi);
+			__pxafb_lcd_power(fbi, 1);
+			__pxafb_backlight_power(fbi, 1);
+		}
+		break;
+	}
+	up(&fbi->ctrlr_sem);
+}
+
+/*
+ * Our LCD controller task (which is called when we blank or unblank)
+ * via keventd.
+ */
+static void pxafb_task(void *dummy)
+{
+	struct pxafb_info *fbi = dummy;
+	u_int state = xchg(&fbi->task_state, -1);
+
+	set_ctrlr_state(fbi, state);
+}
+
+#ifdef CONFIG_CPU_FREQ
+/*
+ * CPU clock speed change handler.  We need to adjust the LCD timing
+ * parameters when the CPU clock is adjusted by the power management
+ * subsystem.
+ *
+ * TODO: Determine why f->new != 10*get_lclk_frequency_10khz()
+ */
+static int
+pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
+{
+	struct pxafb_info *fbi = TO_INF(nb, freq_transition);
+	//TODO struct cpufreq_freqs *f = data;
+	u_int pcd;
+
+	switch (val) {
+	case CPUFREQ_PRECHANGE:
+		set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
+		break;
+
+	case CPUFREQ_POSTCHANGE:
+		pcd = get_pcd(fbi->fb.var.pixclock);
+		fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd);
+		set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE);
+		break;
+	}
+	return 0;
+}
+
+static int
+pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data)
+{
+	struct pxafb_info *fbi = TO_INF(nb, freq_policy);
+	struct fb_var_screeninfo *var = &fbi->fb.var;
+	struct cpufreq_policy *policy = data;
+
+	switch (val) {
+	case CPUFREQ_ADJUST:
+	case CPUFREQ_INCOMPATIBLE:
+		printk(KERN_DEBUG "min dma period: %d ps, "
+			"new clock %d kHz\n", pxafb_display_dma_period(var),
+			policy->max);
+		// TODO: fill in min/max values
+		break;
+#if 0
+	case CPUFREQ_NOTIFY:
+		printk(KERN_ERR "%s: got CPUFREQ_NOTIFY\n", __FUNCTION__);
+		do {} while(0);
+		/* todo: panic if min/max values aren't fulfilled
+		 * [can't really happen unless there's a bug in the
+		 * CPU policy verification process *
+		 */
+		break;
+#endif
+	}
+	return 0;
+}
+#endif
+
+#ifdef CONFIG_PM
+/*
+ * Power management hooks.  Note that we won't be called from IRQ context,
+ * unlike the blank functions above, so we may sleep.
+ */
+static int pxafb_suspend(struct device *dev, u32 state, u32 level)
+{
+	struct pxafb_info *fbi = dev_get_drvdata(dev);
+
+	if (level == SUSPEND_DISABLE || level == SUSPEND_POWER_DOWN)
+		set_ctrlr_state(fbi, C_DISABLE_PM);
+	return 0;
+}
+
+static int pxafb_resume(struct device *dev, u32 level)
+{
+	struct pxafb_info *fbi = dev_get_drvdata(dev);
+
+	if (level == RESUME_ENABLE)
+		set_ctrlr_state(fbi, C_ENABLE_PM);
+	return 0;
+}
+#else
+#define pxafb_suspend	NULL
+#define pxafb_resume	NULL
+#endif
+
+/*
+ * pxafb_map_video_memory():
+ *      Allocates the DRAM memory for the frame buffer.  This buffer is
+ *	remapped into a non-cached, non-buffered, memory region to
+ *      allow palette and pixel writes to occur without flushing the
+ *      cache.  Once this area is remapped, all virtual memory
+ *      access to the video memory should occur at the new region.
+ */
+static int __init pxafb_map_video_memory(struct pxafb_info *fbi)
+{
+	u_long palette_mem_size;
+
+	/*
+	 * We reserve one page for the palette, plus the size
+	 * of the framebuffer.
+	 */
+	fbi->map_size = PAGE_ALIGN(fbi->fb.fix.smem_len + PAGE_SIZE);
+	fbi->map_cpu = dma_alloc_writecombine(fbi->dev, fbi->map_size,
+					      &fbi->map_dma, GFP_KERNEL);
+
+	if (fbi->map_cpu) {
+		/* prevent initial garbage on screen */
+		memset(fbi->map_cpu, 0, fbi->map_size);
+		fbi->fb.screen_base = fbi->map_cpu + PAGE_SIZE;
+		fbi->screen_dma = fbi->map_dma + PAGE_SIZE;
+		/*
+		 * FIXME: this is actually the wrong thing to place in
+		 * smem_start.  But fbdev suffers from the problem that
+		 * it needs an API which doesn't exist (in this case,
+		 * dma_writecombine_mmap)
+		 */
+		fbi->fb.fix.smem_start = fbi->screen_dma;
+
+		fbi->palette_size = fbi->fb.var.bits_per_pixel == 8 ? 256 : 16;
+
+		palette_mem_size = fbi->palette_size * sizeof(u16);
+		DPRINTK("palette_mem_size = 0x%08lx\n", (u_long) palette_mem_size);
+
+		fbi->palette_cpu = (u16 *)(fbi->map_cpu + PAGE_SIZE - palette_mem_size);
+		fbi->palette_dma = fbi->map_dma + PAGE_SIZE - palette_mem_size;
+	}
+
+	return fbi->map_cpu ? 0 : -ENOMEM;
+}
+
+static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev)
+{
+	struct pxafb_info *fbi;
+	void *addr;
+	struct pxafb_mach_info *inf = dev->platform_data;
+
+	/* Alloc the pxafb_info and pseudo_palette in one step */
+	fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 17, GFP_KERNEL);
+	if (!fbi)
+		return NULL;
+
+	memset(fbi, 0, sizeof(struct pxafb_info));
+	fbi->dev = dev;
+
+	strcpy(fbi->fb.fix.id, PXA_NAME);
+
+	fbi->fb.fix.type	= FB_TYPE_PACKED_PIXELS;
+	fbi->fb.fix.type_aux	= 0;
+	fbi->fb.fix.xpanstep	= 0;
+	fbi->fb.fix.ypanstep	= 0;
+	fbi->fb.fix.ywrapstep	= 0;
+	fbi->fb.fix.accel	= FB_ACCEL_NONE;
+
+	fbi->fb.var.nonstd	= 0;
+	fbi->fb.var.activate	= FB_ACTIVATE_NOW;
+	fbi->fb.var.height	= -1;
+	fbi->fb.var.width	= -1;
+	fbi->fb.var.accel_flags	= 0;
+	fbi->fb.var.vmode	= FB_VMODE_NONINTERLACED;
+
+	fbi->fb.fbops		= &pxafb_ops;
+	fbi->fb.flags		= FBINFO_FLAG_DEFAULT;
+	fbi->fb.node		= -1;
+	fbi->fb.currcon		= -1;
+
+	addr = fbi;
+	addr = addr + sizeof(struct pxafb_info);
+	fbi->fb.pseudo_palette	= addr;
+
+	fbi->max_xres			= inf->xres;
+	fbi->fb.var.xres		= inf->xres;
+	fbi->fb.var.xres_virtual	= inf->xres;
+	fbi->max_yres			= inf->yres;
+	fbi->fb.var.yres		= inf->yres;
+	fbi->fb.var.yres_virtual	= inf->yres;
+	fbi->max_bpp			= inf->bpp;
+	fbi->fb.var.bits_per_pixel	= inf->bpp;
+	fbi->fb.var.pixclock		= inf->pixclock;
+	fbi->fb.var.hsync_len		= inf->hsync_len;
+	fbi->fb.var.left_margin		= inf->left_margin;
+	fbi->fb.var.right_margin	= inf->right_margin;
+	fbi->fb.var.vsync_len		= inf->vsync_len;
+	fbi->fb.var.upper_margin	= inf->upper_margin;
+	fbi->fb.var.lower_margin	= inf->lower_margin;
+	fbi->fb.var.sync		= inf->sync;
+	fbi->fb.var.grayscale		= inf->cmap_greyscale;
+	fbi->cmap_inverse		= inf->cmap_inverse;
+	fbi->cmap_static		= inf->cmap_static;
+	fbi->lccr0			= inf->lccr0;
+	fbi->lccr3			= inf->lccr3;
+	fbi->state			= C_STARTUP;
+	fbi->task_state			= (u_char)-1;
+	fbi->fb.fix.smem_len		= fbi->max_xres * fbi->max_yres *
+					  fbi->max_bpp / 8;
+
+	init_waitqueue_head(&fbi->ctrlr_wait);
+	INIT_WORK(&fbi->task, pxafb_task, fbi);
+	init_MUTEX(&fbi->ctrlr_sem);
+
+	return fbi;
+}
+
+#ifdef CONFIG_FB_PXA_PARAMETERS
+static int __init pxafb_parse_options(struct device *dev, char *options)
+{
+	struct pxafb_mach_info *inf = dev->platform_data;
+	char *this_opt;
+
+        if (!options || !*options)
+                return 0;
+
+	dev_dbg(dev, "options are \"%s\"\n", options ? options : "null");
+
+	/* could be made table driven or similar?... */
+        while ((this_opt = strsep(&options, ",")) != NULL) {
+                if (!strncmp(this_opt, "mode:", 5)) {
+			const char *name = this_opt+5;
+			unsigned int namelen = strlen(name);
+			int res_specified = 0, bpp_specified = 0;
+			unsigned int xres = 0, yres = 0, bpp = 0;
+			int yres_specified = 0;
+			int i;
+			for (i = namelen-1; i >= 0; i--) {
+				switch (name[i]) {
+				case '-':
+					namelen = i;
+					if (!bpp_specified && !yres_specified) {
+						bpp = simple_strtoul(&name[i+1], NULL, 0);
+						bpp_specified = 1;
+					} else
+						goto done;
+					break;
+				case 'x':
+					if (!yres_specified) {
+						yres = simple_strtoul(&name[i+1], NULL, 0);
+						yres_specified = 1;
+					} else
+						goto done;
+					break;
+				case '0'...'9':
+					break;
+				default:
+					goto done;
+				}
+			}
+			if (i < 0 && yres_specified) {
+				xres = simple_strtoul(name, NULL, 0);
+				res_specified = 1;
+			}
+		done:
+			if ( res_specified ) {
+				dev_info(dev, "overriding resolution: %dx%x\n", xres, yres);
+				inf->xres = xres; inf->yres = yres;
+			}
+			if ( bpp_specified )
+				switch (bpp) {
+				case 1:
+				case 2:
+				case 4:
+				case 8:
+				case 16:
+					inf->bpp = bpp;
+					dev_info(dev, "overriding bit depth: %d\n", bpp);
+					break;
+				default:
+					dev_err(dev, "Depth %d is not valid\n", bpp);
+				}
+                } else if (!strncmp(this_opt, "pixclock:", 9)) {
+                        inf->pixclock = simple_strtoul(this_opt+9, NULL, 0);
+			dev_info(dev, "override pixclock: %u\n", inf->pixclock);
+                } else if (!strncmp(this_opt, "left:", 5)) {
+                        inf->left_margin = simple_strtoul(this_opt+5, NULL, 0);
+			dev_info(dev, "override left: %u\n", inf->left_margin);
+                } else if (!strncmp(this_opt, "right:", 6)) {
+                        inf->right_margin = simple_strtoul(this_opt+6, NULL, 0);
+			dev_info(dev, "override right: %u\n", inf->right_margin);
+                } else if (!strncmp(this_opt, "upper:", 6)) {
+                        inf->upper_margin = simple_strtoul(this_opt+6, NULL, 0);
+			dev_info(dev, "override upper: %u\n", inf->upper_margin);
+                } else if (!strncmp(this_opt, "lower:", 6)) {
+                        inf->lower_margin = simple_strtoul(this_opt+6, NULL, 0);
+			dev_info(dev, "override lower: %u\n", inf->lower_margin);
+                } else if (!strncmp(this_opt, "hsynclen:", 9)) {
+                        inf->hsync_len = simple_strtoul(this_opt+9, NULL, 0);
+			dev_info(dev, "override hsynclen: %u\n", inf->hsync_len);
+                } else if (!strncmp(this_opt, "vsynclen:", 9)) {
+                        inf->vsync_len = simple_strtoul(this_opt+9, NULL, 0);
+			dev_info(dev, "override vsynclen: %u\n", inf->vsync_len);
+                } else if (!strncmp(this_opt, "hsync:", 6)) {
+                        if ( simple_strtoul(this_opt+6, NULL, 0) == 0 ) {
+				dev_info(dev, "override hsync: Active Low\n");
+				inf->sync &= ~FB_SYNC_HOR_HIGH_ACT;
+			} else {
+				dev_info(dev, "override hsync: Active High\n");
+				inf->sync |= FB_SYNC_HOR_HIGH_ACT;
+			}
+                } else if (!strncmp(this_opt, "vsync:", 6)) {
+                        if ( simple_strtoul(this_opt+6, NULL, 0) == 0 ) {
+				dev_info(dev, "override vsync: Active Low\n");
+				inf->sync &= ~FB_SYNC_VERT_HIGH_ACT;
+			} else {
+				dev_info(dev, "override vsync: Active High\n");
+				inf->sync |= FB_SYNC_VERT_HIGH_ACT;
+			}
+                } else if (!strncmp(this_opt, "dpc:", 4)) {
+                        if ( simple_strtoul(this_opt+4, NULL, 0) == 0 ) {
+				dev_info(dev, "override double pixel clock: false\n");
+				inf->lccr3 &= ~LCCR3_DPC;
+			} else {
+				dev_info(dev, "override double pixel clock: true\n");
+				inf->lccr3 |= LCCR3_DPC;
+			}
+                } else if (!strncmp(this_opt, "outputen:", 9)) {
+                        if ( simple_strtoul(this_opt+9, NULL, 0) == 0 ) {
+				dev_info(dev, "override output enable: active low\n");
+				inf->lccr3 = ( inf->lccr3 & ~LCCR3_OEP ) | LCCR3_OutEnL;
+			} else {
+				dev_info(dev, "override output enable: active high\n");
+				inf->lccr3 = ( inf->lccr3 & ~LCCR3_OEP ) | LCCR3_OutEnH;
+			}
+                } else if (!strncmp(this_opt, "pixclockpol:", 12)) {
+                        if ( simple_strtoul(this_opt+12, NULL, 0) == 0 ) {
+				dev_info(dev, "override pixel clock polarity: falling edge\n");
+				inf->lccr3 = ( inf->lccr3 & ~LCCR3_PCP ) | LCCR3_PixFlEdg;
+			} else {
+				dev_info(dev, "override pixel clock polarity: rising edge\n");
+				inf->lccr3 = ( inf->lccr3 & ~LCCR3_PCP ) | LCCR3_PixRsEdg;
+			}
+                } else if (!strncmp(this_opt, "color", 5)) {
+			inf->lccr0 = (inf->lccr0 & ~LCCR0_CMS) | LCCR0_Color;
+                } else if (!strncmp(this_opt, "mono", 4)) {
+			inf->lccr0 = (inf->lccr0 & ~LCCR0_CMS) | LCCR0_Mono;
+                } else if (!strncmp(this_opt, "active", 6)) {
+			inf->lccr0 = (inf->lccr0 & ~LCCR0_PAS) | LCCR0_Act;
+                } else if (!strncmp(this_opt, "passive", 7)) {
+			inf->lccr0 = (inf->lccr0 & ~LCCR0_PAS) | LCCR0_Pas;
+                } else if (!strncmp(this_opt, "single", 6)) {
+			inf->lccr0 = (inf->lccr0 & ~LCCR0_SDS) | LCCR0_Sngl;
+                } else if (!strncmp(this_opt, "dual", 4)) {
+			inf->lccr0 = (inf->lccr0 & ~LCCR0_SDS) | LCCR0_Dual;
+                } else if (!strncmp(this_opt, "4pix", 4)) {
+			inf->lccr0 = (inf->lccr0 & ~LCCR0_DPD) | LCCR0_4PixMono;
+                } else if (!strncmp(this_opt, "8pix", 4)) {
+			inf->lccr0 = (inf->lccr0 & ~LCCR0_DPD) | LCCR0_8PixMono;
+		} else {
+			dev_err(dev, "unknown option: %s\n", this_opt);
+			return -EINVAL;
+		}
+        }
+        return 0;
+
+}
+#endif
+
+int __init pxafb_probe(struct device *dev)
+{
+	struct pxafb_info *fbi;
+	struct pxafb_mach_info *inf;
+	unsigned long flags;
+	int ret;
+
+	dev_dbg(dev, "pxafb_probe\n");
+
+	inf = dev->platform_data;
+	ret = -ENOMEM;
+	fbi = NULL;
+	if (!inf)
+		goto failed;
+
+#ifdef CONFIG_FB_PXA_PARAMETERS
+	ret = pxafb_parse_options(dev, g_options);
+	if ( ret < 0 )
+		goto failed;
+#endif
+
+#ifdef DEBUG_VAR
+        /* Check for various illegal bit-combinations. Currently only
+	 * a warning is given. */
+
+        if ( inf->lccr0 & LCCR0_INVALID_CONFIG_MASK )
+                dev_warn(dev, "machine LCCR0 setting contains illegal bits: %08x\n",
+                        inf->lccr0 & LCCR0_INVALID_CONFIG_MASK);
+        if ( inf->lccr3 & LCCR3_INVALID_CONFIG_MASK )
+                dev_warn(dev, "machine LCCR3 setting contains illegal bits: %08x\n",
+                        inf->lccr3 & LCCR3_INVALID_CONFIG_MASK);
+        if ( inf->lccr0 & LCCR0_DPD &&
+             ( ( inf->lccr0 & LCCR0_PAS ) != LCCR0_Pas ||
+               ( inf->lccr0 & LCCR0_SDS ) != LCCR0_Sngl ||
+               ( inf->lccr0 & LCCR0_CMS ) != LCCR0_Mono ) )
+                dev_warn(dev, "Double Pixel Data (DPD) mode is only valid in passive mono"
+			 " single panel mode\n");
+        if ( (inf->lccr0 & LCCR0_PAS) == LCCR0_Act &&
+             ( inf->lccr0 & LCCR0_SDS ) == LCCR0_Dual )
+                dev_warn(dev, "Dual panel only valid in passive mode\n");
+        if ( (inf->lccr0 & LCCR0_PAS ) == LCCR0_Pas &&
+             (inf->upper_margin || inf->lower_margin) )
+                dev_warn(dev, "Upper and lower margins must be 0 in passive mode\n");
+#endif
+
+	dev_dbg(dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp);
+	if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) {
+		dev_err(dev, "Invalid resolution or bit depth\n");
+		ret = -EINVAL;
+		goto failed;
+	}
+	pxafb_backlight_power = inf->pxafb_backlight_power;
+	pxafb_lcd_power = inf->pxafb_lcd_power;
+	fbi = pxafb_init_fbinfo(dev);
+	if (!fbi) {
+		dev_err(dev, "Failed to initialize framebuffer device\n");
+		ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc
+		goto failed;
+	}
+
+	/* Initialize video memory */
+	ret = pxafb_map_video_memory(fbi);
+	if (ret) {
+		dev_err(dev, "Failed to allocate video RAM: %d\n", ret);
+		ret = -ENOMEM;
+		goto failed;
+	}
+	/* enable LCD controller clock */
+	local_irq_save(flags);
+	CKEN |= CKEN16_LCD;
+	local_irq_restore(flags);
+
+	ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi);
+	if (ret) {
+		dev_err(dev, "request_irq failed: %d\n", ret);
+		ret = -EBUSY;
+		goto failed;
+	}
+
+	/*
+	 * This makes sure that our colour bitfield
+	 * descriptors are correctly initialised.
+	 */
+	pxafb_check_var(&fbi->fb.var, &fbi->fb);
+	pxafb_set_par(&fbi->fb);
+
+	dev_set_drvdata(dev, fbi);
+
+	ret = register_framebuffer(&fbi->fb);
+	if (ret < 0) {
+		dev_err(dev, "Failed to register framebuffer device: %d\n", ret);
+		goto failed;
+	}
+
+#ifdef CONFIG_PM
+	// TODO
+#endif
+
+#ifdef CONFIG_CPU_FREQ
+	fbi->freq_transition.notifier_call = pxafb_freq_transition;
+	fbi->freq_policy.notifier_call = pxafb_freq_policy;
+	cpufreq_register_notifier(&fbi->freq_transition, CPUFREQ_TRANSITION_NOTIFIER);
+	cpufreq_register_notifier(&fbi->freq_policy, CPUFREQ_POLICY_NOTIFIER);
+#endif
+
+	/*
+	 * Ok, now enable the LCD controller
+	 */
+	set_ctrlr_state(fbi, C_ENABLE);
+
+	return 0;
+
+failed:
+	dev_set_drvdata(dev, NULL);
+	if (fbi)
+		kfree(fbi);
+	return ret;
+}
+
+static struct device_driver pxafb_driver = {
+	.name		= "pxafb",
+	.bus		= &platform_bus_type,
+	.probe		= pxafb_probe,
+#ifdef CONFIG_PM
+	.suspend	= pxafb_suspend,
+	.resume		= pxafb_resume,
+#endif
+};
+
+int __devinit pxafb_init(void)
+{
+	return driver_register(&pxafb_driver);
+}
+
+#ifndef MODULE
+int __devinit pxafb_setup(char *options)
+{
+# ifdef CONFIG_FB_PXA_PARAMETERS
+	strlcpy(g_options, options, sizeof(g_options));
+# endif
+	return 0;
+}
+#else
+module_init(pxafb_init);
+# ifdef CONFIG_FB_PXA_PARAMETERS
+module_param_string(options, g_options, sizeof(g_options), 0);
+MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)");
+# endif
+#endif
+
+MODULE_DESCRIPTION("loadable framebuffer driver for PXA");
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/video/pxafb.h b/drivers/video/pxafb.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/video/pxafb.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,129 @@
+#ifndef __PXAFB_H__
+#define __PXAFB_H__
+
+/*
+ * linux/drivers/video/pxafb.h
+ *    -- Intel PXA250/210 LCD Controller Frame Buffer Device
+ *
+ *  Copyright (C) 1999 Eric A. Thomas.
+ *  Copyright (C) 2004 Jean-Frederic Clere.
+ *  Copyright (C) 2004 Ian Campbell.
+ *  Copyright (C) 2004 Jeff Lackey.
+ *   Based on sa1100fb.c Copyright (C) 1999 Eric A. Thomas
+ *  which in turn is
+ *   Based on acornfb.c Copyright (C) Russell King.
+ *
+ *  2001-08-03: Cliff Brake <cbrake@acclent.com>
+ *	 - ported SA1100 code to PXA
+ *
+ * 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.
+ */
+
+/* Shadows for LCD controller registers */
+struct pxafb_lcd_reg {
+	unsigned int lccr0;
+	unsigned int lccr1;
+	unsigned int lccr2;
+	unsigned int lccr3;
+};
+
+/* PXA LCD DMA descriptor */
+struct pxafb_dma_descriptor {
+	unsigned int fdadr;
+	unsigned int fsadr;
+	unsigned int fidr;
+	unsigned int ldcmd;
+};
+
+struct pxafb_info {
+	struct fb_info		fb;
+	struct device		*dev;
+
+	u_int			max_bpp;
+	u_int			max_xres;
+	u_int			max_yres;
+
+	/*
+	 * These are the addresses we mapped
+	 * the framebuffer memory region to.
+	 */
+	/* raw memory addresses */
+	dma_addr_t		map_dma;	/* physical */
+	u_char *		map_cpu;	/* virtual */
+	u_int			map_size;
+
+	/* addresses of pieces placed in raw buffer */
+	u_char *		screen_cpu;	/* virtual address of frame buffer */
+	dma_addr_t		screen_dma;	/* physical address of frame buffer */
+	u16 *			palette_cpu;	/* virtual address of palette memory */
+	dma_addr_t		palette_dma;	/* physical address of palette memory */
+	u_int			palette_size;
+
+	/* DMA descriptors */
+	struct pxafb_dma_descriptor * 	dmadesc_fblow_cpu;
+	dma_addr_t		dmadesc_fblow_dma;
+	struct pxafb_dma_descriptor * 	dmadesc_fbhigh_cpu;
+	dma_addr_t		dmadesc_fbhigh_dma;
+	struct pxafb_dma_descriptor *	dmadesc_palette_cpu;
+	dma_addr_t		dmadesc_palette_dma;
+
+	dma_addr_t		fdadr0;
+	dma_addr_t		fdadr1;
+
+	u_int			lccr0;
+	u_int			lccr3;
+	u_int			cmap_inverse:1,
+				cmap_static:1,
+				unused:30;
+
+	u_int			reg_lccr0;
+	u_int			reg_lccr1;
+	u_int			reg_lccr2;
+	u_int			reg_lccr3;
+
+	volatile u_char		state;
+	volatile u_char		task_state;
+	struct semaphore	ctrlr_sem;
+	wait_queue_head_t	ctrlr_wait;
+	struct work_struct	task;
+
+#ifdef CONFIG_CPU_FREQ
+	struct notifier_block	freq_transition;
+	struct notifier_block	freq_policy;
+#endif
+};
+
+#define TO_INF(ptr,member) container_of(ptr,struct pxafb_info,member)
+
+/*
+ * These are the actions for set_ctrlr_state
+ */
+#define C_DISABLE		(0)
+#define C_ENABLE		(1)
+#define C_DISABLE_CLKCHANGE	(2)
+#define C_ENABLE_CLKCHANGE	(3)
+#define C_REENABLE		(4)
+#define C_DISABLE_PM		(5)
+#define C_ENABLE_PM		(6)
+#define C_STARTUP		(7)
+
+#define PXA_NAME	"PXA"
+
+/*
+ *  Debug macros
+ */
+#if DEBUG
+#  define DPRINTK(fmt, args...)	printk("%s: " fmt, __FUNCTION__ , ## args)
+#else
+#  define DPRINTK(fmt, args...)
+#endif
+
+/*
+ * Minimum X and Y resolutions
+ */
+#define MIN_XRES	64
+#define MIN_YRES	64
+
+#endif /* __PXAFB_H__ */
diff -Nru a/drivers/video/q40fb.c b/drivers/video/q40fb.c
--- a/drivers/video/q40fb.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/video/q40fb.c	Tue Jun 15 22:20:38 2004
@@ -1,9 +1,9 @@
-/* 
+/*
  * linux/drivers/video/q40fb.c -- Q40 frame buffer device
  *
- * Copyright (C) 2001 
+ * Copyright (C) 2001
  *
- *      Richard Zidlicky <Richard.Zidlicky@stud.informatik.uni-erlangen.de>
+ *      Richard Zidlicky <rz@linux-m68k.org>
  *
  *  This file is subject to the terms and conditions of the GNU General Public
  *  License. See the file COPYING in the main directory of this archive for
@@ -30,9 +30,6 @@
 
 #define Q40_PHYS_SCREEN_ADDR 0xFE800000
 
-static u32 pseudo_palette[17];
-static struct fb_info fb_info;
-
 static struct fb_fix_screeninfo q40fb_fix __initdata = {
 	.id		= "Q40",
 	.smem_len	= 1024*1024,
@@ -48,7 +45,7 @@
 	.xres_virtual	= 1024,
 	.yres_virtual	= 512,
 	.bits_per_pixel	= 16,
-    	.red		= {6, 5, 0}, 
+    	.red		= {6, 5, 0},
 	.green		= {11, 5, 0},
 	.blue		= {0, 6, 0},
 	.activate	= FB_ACTIVATE_NOW,
@@ -57,24 +54,8 @@
 	.vmode		= FB_VMODE_NONINTERLACED,
 };
 
-/* frame buffer operations */
-int q40fb_init(void);
-
-static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
-                           unsigned blue, unsigned transp,
-                           struct fb_info *info);
-
-static struct fb_ops q40fb_ops = {
-	.owner		= THIS_MODULE,
-	.fb_setcolreg	= q40fb_setcolreg,
-	.fb_fillrect	= cfb_fillrect,
-	.fb_copyarea	= cfb_copyarea,
-	.fb_imageblit	= cfb_imageblit,
-	.fb_cursor	= soft_cursor,
-};
-
 static int q40fb_setcolreg(unsigned regno, unsigned red, unsigned green,
-		  	   unsigned blue, unsigned transp,
+			   unsigned blue, unsigned transp,
 			   struct fb_info *info)
 {
     /*
@@ -82,46 +63,94 @@
      *  magnitude.
      *  Return != 0 for invalid regno.
      */
-  
+
+    if (regno > 255)
+	    return 1;
     red>>=11;
     green>>=11;
     blue>>=10;
 
     if (regno < 16) {
-	((u16 *)info->pseudo_palette)[regno] = ((red & 31) <<6) |
+	((u32 *)info->pseudo_palette)[regno] = ((red & 31) <<6) |
 					       ((green & 31) << 11) |
 					       (blue & 63);
     }
     return 0;
 }
 
-int q40fb_init(void)
+static struct fb_ops q40fb_ops = {
+	.owner		= THIS_MODULE,
+	.fb_setcolreg	= q40fb_setcolreg,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
+	.fb_cursor	= soft_cursor,
+};
+
+static int __init q40fb_probe(struct device *device)
 {
-        if ( !MACH_IS_Q40)
-	  return -ENXIO;
+	struct platform_device *dev = to_platform_device(device);
+	struct fb_info *info;
+
+	if (!MACH_IS_Q40)
+		return -ENXIO;
 
 	/* mapped in q40/config.c */
 	q40fb_fix.smem_start = Q40_PHYS_SCREEN_ADDR;
-	
-	fb_info.var = q40fb_var;
-	fb_info.fix = q40fb_fix;
-	fb_info.fbops = &q40fb_ops;
-	fb_info.flags = FBINFO_FLAG_DEFAULT;  /* not as module for now */
-	fb_info.pseudo_palette = pseudo_palette;	
-   	fb_info.screen_base = (char *) q40fb_fix.smem_start;
 
-	fb_alloc_cmap(&fb_info.cmap, 16, 0);
+	info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
+	if (!info)
+		return -ENOMEM;
+
+	info->var = q40fb_var;
+	info->fix = q40fb_fix;
+	info->fbops = &q40fb_ops;
+	info->flags = FBINFO_FLAG_DEFAULT;  /* not as module for now */
+	info->pseudo_palette = info->par;
+	info->par = NULL;
+	info->screen_base = (char *) q40fb_fix.smem_start;
+
+	if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+		framebuffer_release(info);
+		return -ENOMEM;
+	}
 
 	master_outb(3, DISPLAY_CONTROL_REG);
 
-	if (register_framebuffer(&fb_info) < 0) {
+	if (register_framebuffer(info) < 0) {
 		printk(KERN_ERR "Unable to register Q40 frame buffer\n");
+		fb_dealloc_cmap(&info->cmap);
+		framebuffer_release(info);
 		return -EINVAL;
 	}
 
         printk(KERN_INFO "fb%d: Q40 frame buffer alive and kicking !\n",
-	       fb_info.node);
+	       info->node);
 	return 0;
 }
 
-MODULE_LICENSE("GPL");	
+static struct device_driver q40fb_driver = {
+	.name	= "q40fb",
+	.bus	= &platform_bus_type,
+	.probe	= q40fb_probe,
+};
+
+static struct platform_device q40fb_device = {
+	.name	= "q40fb",
+};
+
+int __init q40fb_init(void)
+{
+	int ret = 0;
+
+	ret = driver_register(&q40fb_driver);
+
+	if (!ret) {
+		ret = platform_device_register(&q40fb_device);
+		if (ret)
+			driver_unregister(&q40fb_driver);
+	}
+	return ret;
+}
+
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/video/radeonfb.c b/drivers/video/radeonfb.c
--- a/drivers/video/radeonfb.c	Tue Jun 15 22:21:03 2004
+++ b/drivers/video/radeonfb.c	Tue Jun 15 22:21:03 2004
@@ -2252,7 +2252,6 @@
 	info->pseudo_palette = rinfo->pseudo_palette;
         info->flags = FBINFO_FLAG_DEFAULT;
         info->fbops = &radeonfb_ops;
-        info->display_fg = NULL;
         info->screen_base = (char *)rinfo->fb_base;
 
 	/* Fill fix common fields */
diff -Nru a/drivers/video/retz3fb.c b/drivers/video/retz3fb.c
--- a/drivers/video/retz3fb.c	Tue Jun 15 22:20:44 2004
+++ b/drivers/video/retz3fb.c	Tue Jun 15 22:20:44 2004
@@ -1432,8 +1432,6 @@
 		       fb_info->modename, zinfo->fbsize>>10);
 
 		/* FIXME: This driver cannot be unloaded yet */
-		MOD_INC_USE_COUNT;
-
 		res = 0;
 	}
 	return res;
@@ -1490,16 +1488,6 @@
 int init_module(void)
 {
 	return retz3fb_init();
-}
-
-void cleanup_module(void)
-{
-	/*
-	 * Not reached because the usecount will never
-	 * be decremented to zero
-	 *
-	 * FIXME: clean up ... *
-	 */
 }
 #endif
 
diff -Nru a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
--- a/drivers/video/riva/fbdev.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/video/riva/fbdev.c	Tue Jun 15 22:20:42 2004
@@ -492,17 +492,17 @@
  * CALLED FROM:
  * rivafb_cursor()
  */
-static void rivafb_load_cursor_image(struct riva_par *par, u8 *data, 
-				     u8 *mask, u16 bg, u16 fg, u32 w, u32 h)
+static void rivafb_load_cursor_image(struct riva_par *par, u8 *data8,
+				     u8 *mask8, u16 bg, u16 fg, u32 w, u32 h)
 {
 	int i, j, k = 0;
 	u32 b, m, tmp;
+	u32 *data = (u32 *)data8;
+	u32 *mask = (u32 *)mask8;
 
 	for (i = 0; i < h; i++) {
-		b = *((u32 *)data);
-		b = (u32)((u32 *)b + 1);
-		m = *((u32 *)mask);
-		m = (u32)((u32 *)m + 1);
+		b = *data++;
+		m = *mask++;
 		reverse_order(&b);
 		
 		for (j = 0; j < w/2; j++) {
@@ -1620,14 +1620,27 @@
 	struct riva_par *par = (struct riva_par *) info->par;
 	struct device_node *dp;
 	unsigned char *pedid = NULL;
+	unsigned char *disptype = NULL;
+	static char *propnames[] = {
+		"DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL };
+	int i;
 
 	dp = pci_device_to_OF_node(pd);
-	pedid = (unsigned char *)get_property(dp, "EDID,B", 0);
-
-	if (pedid) {
+	for (; dp != NULL; dp = dp->child) {
+		disptype = (unsigned char *)get_property(dp, "display-type", NULL);
+		if (disptype == NULL)
+			continue;
+		if (strncmp(disptype, "LCD", 3) != 0)
+			continue;
+		for (i = 0; propnames[i] != NULL; ++i) {
+			pedid = (unsigned char *)
+				get_property(dp, propnames[i], NULL);
+			if (pedid != NULL) {
 		par->EDID = pedid;
 		return 1;
-	} else
+			}
+		}
+	}
 		return 0;
 }
 #endif /* CONFIG_PPC_OF */
diff -Nru a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
--- a/drivers/video/sa1100fb.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/video/sa1100fb.c	Tue Jun 15 22:20:38 2004
@@ -326,6 +326,22 @@
 };
 #endif
 
+#ifdef CONFIG_SA1100_COLLIE
+static struct sa1100fb_mach_info collie_info __initdata = {
+	pixclock:	171521,		bpp:		16,
+	xres:		320,		yres:		240,
+
+	hsync_len:	5,		vsync_len:	1,
+	left_margin:	11,		upper_margin:	2,
+	right_margin:	30,		lower_margin:	0,
+
+	sync:		FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+
+	lccr0:		LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
+	lccr3:		LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
+};
+#endif
+
 #ifdef CONFIG_SA1100_FREEBIRD
 #warning Please check this carefully
 static struct sa1100fb_mach_info freebird_info __initdata = {
@@ -635,6 +651,11 @@
 		inf = &brutus_info;
 	}
 #endif
+#ifdef CONFIG_SA1100_COLLIE
+	if (machine_is_collie()) {
+		inf = &collie_info;
+	}
+#endif
 #ifdef CONFIG_SA1100_FREEBIRD
 	if (machine_is_freebird()) {
 		inf = &freebird_info;
@@ -1765,8 +1786,6 @@
 #endif
 
 	/* This driver cannot be unloaded at the moment */
-	MOD_INC_USE_COUNT;
-
 	return 0;
 
 failed:
diff -Nru a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c
--- a/drivers/video/sbuslib.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/video/sbuslib.c	Tue Jun 15 22:20:38 2004
@@ -122,6 +122,7 @@
 		cmap.red = &red;
 		cmap.green = &green;
 		cmap.blue = &blue;
+		cmap.transp = NULL;
 		for (i = 0; i < count; i++) {
 			int err;
 
diff -Nru a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c
--- a/drivers/video/tdfxfb.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/video/tdfxfb.c	Tue Jun 15 22:20:38 2004
@@ -166,7 +166,11 @@
 static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
 static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);  
 static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image); 
+#ifdef CONFIG_FB_3DFX_ACCEL
 static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor);
+#else /* !CONFIG_FB_3DFX_ACCEL */
+#define tdfxfb_cursor soft_cursor
+#endif /* CONFIG_FB_3DFX_ACCEL */
 static int banshee_wait_idle(struct fb_info *info);
 
 static struct fb_ops tdfxfb_ops = {
@@ -180,7 +184,7 @@
 	.fb_copyarea	= tdfxfb_copyarea,
 	.fb_imageblit	= tdfxfb_imageblit,
 	.fb_sync	= banshee_wait_idle,
-	.fb_cursor	= soft_cursor,
+	.fb_cursor	= tdfxfb_cursor,
 };
 
 /*
@@ -1001,6 +1005,7 @@
 	banshee_wait_idle(info);
 }
 
+#ifdef CONFIG_FB_3DFX_ACCEL
 static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
 {
 	struct tdfx_par *par = (struct tdfx_par *) info->par;
@@ -1137,6 +1142,7 @@
 	spin_unlock_irqrestore(&par->DAClock, flags);
 	return 0;
 }
+#endif /* CONFIG_FB_3DFX_ACCEL */
 
 /**
  *      tdfxfb_probe - Device Initializiation
diff -Nru a/drivers/video/tgafb.c b/drivers/video/tgafb.c
--- a/drivers/video/tgafb.c	Tue Jun 15 22:20:42 2004
+++ b/drivers/video/tgafb.c	Tue Jun 15 22:20:42 2004
@@ -23,6 +23,7 @@
 #include <linux/init.h>
 #include <linux/fb.h>
 #include <linux/pci.h>
+#include <linux/selection.h>
 #include <asm/io.h>
 #include <video/tgafb.h>
 #include <linux/selection.h>
diff -Nru a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
--- a/drivers/video/tridentfb.c	Tue Jun 15 22:20:40 2004
+++ b/drivers/video/tridentfb.c	Tue Jun 15 22:20:40 2004
@@ -450,7 +450,7 @@
 /*
  * Accel functions called by the upper layers
  */
-
+#ifdef CONFIG_FB_TRIDENT_ACCEL
 static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr)
 {
 	int bpp = info->var.bits_per_pixel;
@@ -474,6 +474,11 @@
 	acc->copy_rect(ca->sx,ca->sy,ca->dx,ca->dy,ca->width,ca->height);
 	acc->wait_engine();
 }
+#else /* !CONFIG_FB_TRIDENT_ACCEL */
+#define tridentfb_fillrect cfb_fillrect
+#define tridentfb_copyarea cfb_copyarea
+#endif /* CONFIG_FB_TRIDENT_ACCEL */
+
 
 /*
  * Hardware access functions
@@ -1265,10 +1270,8 @@
 	.fb_blank = tridentfb_blank,
 	.fb_check_var = tridentfb_check_var,
 	.fb_set_par = tridentfb_set_par,
-//	.fb_fillrect = tridentfb_fillrect,
-//	.fb_copyarea= tridentfb_copyarea,
-	.fb_fillrect = cfb_fillrect,
-	.fb_copyarea= cfb_copyarea,
+	.fb_fillrect = tridentfb_fillrect,
+	.fb_copyarea= tridentfb_copyarea,
 	.fb_imageblit = cfb_imageblit,
 	.fb_cursor = soft_cursor,
 };
diff -Nru a/drivers/video/vesafb.c b/drivers/video/vesafb.c
--- a/drivers/video/vesafb.c	Tue Jun 15 22:20:36 2004
+++ b/drivers/video/vesafb.c	Tue Jun 15 22:20:36 2004
@@ -47,12 +47,9 @@
 	.accel	= FB_ACCEL_NONE,
 };
 
-static struct fb_info fb_info;
-static u32 pseudo_palette[17];
-
 static int             inverse   = 0;
 static int             mtrr      = 1;
-
+static int	       vram __initdata = 0; /* Set amount of memory to be used */
 static int             pmi_setpal = 0;	/* pmi for palette changes ??? */
 static int             ypan       = 0;  /* 0..nothing, 1..ypan, 2..ywrap */
 static unsigned short  *pmi_base  = 0;
@@ -210,14 +207,17 @@
 			mtrr=1;
 		else if (! strcmp(this_opt, "nomtrr"))
 			mtrr=0;
+		else if (! strncmp(this_opt, "vram:", 5))
+			vram = simple_strtoul(this_opt+5, NULL, 0);
 	}
 	return 0;
 }
 
-int __init vesafb_init(void)
+static int __init vesafb_probe(struct device *device)
 {
-	int video_cmap_len;
-	int i;
+	struct platform_device *dev = to_platform_device(device);
+	struct fb_info *info;
+	int i, err;
 
 	if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB)
 		return -ENXIO;
@@ -229,7 +229,18 @@
 	vesafb_defined.xres = screen_info.lfb_width;
 	vesafb_defined.yres = screen_info.lfb_height;
 	vesafb_fix.line_length = screen_info.lfb_linelength;
-	vesafb_fix.smem_len = screen_info.lfb_size * 65536;
+
+	/* Allocate enough memory for double buffering */
+	vesafb_fix.smem_len = screen_info.lfb_width * screen_info.lfb_height * vesafb_defined.bits_per_pixel >> 2;
+
+	/* check that we don't remap more memory than old cards have */
+	if (vesafb_fix.smem_len > (screen_info.lfb_size * 65536))
+		vesafb_fix.smem_len = screen_info.lfb_size * 65536;
+
+	/* Set video size according to vram boot option */
+	if (vram)
+		vesafb_fix.smem_len = vram * 1024 * 1024;
+
 	vesafb_fix.visual   = (vesafb_defined.bits_per_pixel == 8) ?
 		FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
 
@@ -251,17 +262,25 @@
 		   spaces our resource handlers simply don't know about */
 	}
 
-        fb_info.screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len);
-	if (!fb_info.screen_base) {
+	info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
+	if (!info) {
 		release_mem_region(vesafb_fix.smem_start, vesafb_fix.smem_len);
+		return -ENOMEM;
+	}
+	info->pseudo_palette = info->par;
+	info->par = NULL;
+
+        info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len);
+	if (!info->screen_base) {
 		printk(KERN_ERR
 		       "vesafb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n",
 			vesafb_fix.smem_len, vesafb_fix.smem_start);
-		return -EIO;
+		err = -EIO;
+		goto err;
 	}
 
 	printk(KERN_INFO "vesafb: framebuffer at 0x%lx, mapped to 0x%p, size %dk\n",
-	       vesafb_fix.smem_start, fb_info.screen_base, vesafb_fix.smem_len/1024);
+	       vesafb_fix.smem_start, info->screen_base, vesafb_fix.smem_len/1024);
 	printk(KERN_INFO "vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
 	       vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel, vesafb_fix.line_length, screen_info.pages);
 
@@ -331,12 +350,10 @@
 		       screen_info.red_pos,
 		       screen_info.green_pos,
 		       screen_info.blue_pos);
-		video_cmap_len = 16;
 	} else {
 		vesafb_defined.red.length   = 6;
 		vesafb_defined.green.length = 6;
 		vesafb_defined.blue.length  = 6;
-		video_cmap_len = 256;
 	}
 
 	vesafb_fix.ypanstep  = ypan     ? 1 : 0;
@@ -358,20 +375,51 @@
 		}
 	}
 	
-	fb_info.fbops = &vesafb_ops;
-	fb_info.var = vesafb_defined;
-	fb_info.fix = vesafb_fix;
-	fb_info.pseudo_palette = pseudo_palette;
-	fb_info.flags = FBINFO_FLAG_DEFAULT;
+	info->fbops = &vesafb_ops;
+	info->var = vesafb_defined;
+	info->fix = vesafb_fix;
+	info->flags = FBINFO_FLAG_DEFAULT;
+
+	if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+		err = -ENXIO;
+		goto err;
+	}
+	if (register_framebuffer(info)<0) {
+		err = -EINVAL;
+		fb_dealloc_cmap(&info->cmap);
+		goto err;
+	}
+	printk(KERN_INFO "fb%d: %s frame buffer device\n",
+	       info->node, info->fix.id);
+	return 0;
+err:
+	framebuffer_release(info);
+	release_mem_region(vesafb_fix.smem_start, vesafb_fix.smem_len);
+	return err;
+}
 
-	fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
+static struct device_driver vesafb_driver = {
+	.name	= "vesafb",
+	.bus	= &platform_bus_type,
+	.probe	= vesafb_probe,
+};
 
-	if (register_framebuffer(&fb_info)<0)
-		return -EINVAL;
+static struct platform_device vesafb_device = {
+	.name	= "vesafb",
+};
 
-	printk(KERN_INFO "fb%d: %s frame buffer device\n",
-	       fb_info.node, fb_info.fix.id);
-	return 0;
+int __init vesafb_init(void)
+{
+	int ret;
+
+	ret = driver_register(&vesafb_driver);
+
+	if (!ret) {
+		ret = platform_device_register(&vesafb_device);
+		if (ret)
+			driver_unregister(&vesafb_driver);
+	}
+	return ret;
 }
 
 /*
diff -Nru a/drivers/video/vfb.c b/drivers/video/vfb.c
--- a/drivers/video/vfb.c	Tue Jun 15 22:20:35 2004
+++ b/drivers/video/vfb.c	Tue Jun 15 22:20:35 2004
@@ -37,9 +37,6 @@
 static u_long videomemorysize = VIDEOMEMSIZE;
 MODULE_PARM(videomemorysize, "l");
 
-static struct fb_info fb_info;
-static u32 vfb_pseudo_palette[17];
-
 static struct fb_var_screeninfo vfb_default __initdata = {
 	.xres =		640,
 	.yres =		480,
@@ -404,18 +401,22 @@
      *  Initialisation
      */
 
-int __init vfb_init(void)
+static void vfb_platform_release(struct device *device)
 {
-	int retval;
+	// This is called when the reference count goes to zero.
+}
 
-	if (!vfb_enable)
-		return -ENXIO;
+static int __init vfb_probe(struct device *device)
+{
+	struct platform_device *dev = to_platform_device(device);
+	struct fb_info *info;
+	int retval = -ENOMEM;
 
 	/*
 	 * For real video cards we use ioremap.
 	 */
 	if (!(videomemory = vmalloc(videomemorysize)))
-		return -ENOMEM;
+		return retval;
 
 	/*
 	 * VFB must clear memory to prevent kernel info
@@ -425,41 +426,98 @@
 	 */
 	memset(videomemory, 0, videomemorysize);
 
-	fb_info.screen_base = videomemory;
-	fb_info.fbops = &vfb_ops;
+	info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
+	if (!info)
+		goto err;
 
-	retval = fb_find_mode(&fb_info.var, &fb_info, NULL,
+	info->screen_base = videomemory;
+	info->fbops = &vfb_ops;
+
+	retval = fb_find_mode(&info->var, info, NULL,
 			      NULL, 0, NULL, 8);
 
 	if (!retval || (retval == 4))
-		fb_info.var = vfb_default;
-	fb_info.fix = vfb_fix;
-	fb_info.pseudo_palette = &vfb_pseudo_palette;
-	fb_info.flags = FBINFO_FLAG_DEFAULT;
+		info->var = vfb_default;
+	info->fix = vfb_fix;
+	info->pseudo_palette = info->par;
+	info->par = NULL;
+	info->flags = FBINFO_FLAG_DEFAULT;
+
+	retval = fb_alloc_cmap(&info->cmap, 256, 0);
+	if (retval < 0)
+		goto err1;
+
+	retval = register_framebuffer(info);
+	if (retval < 0)
+		goto err2;
+	dev_set_drvdata(&dev->dev, info);
+
+	printk(KERN_INFO
+	       "fb%d: Virtual frame buffer device, using %ldK of video memory\n",
+	       info->node, videomemorysize >> 10);
+	return 0;
+err2:
+	fb_dealloc_cmap(&info->cmap);
+err1:
+	framebuffer_release(info);
+err:
+	vfree(videomemory);
+	return retval;
+}
 
-	fb_alloc_cmap(&fb_info.cmap, 256, 0);
+static int vfb_remove(struct device *device)
+{
+	struct fb_info *info = dev_get_drvdata(device);
 
-	if (register_framebuffer(&fb_info) < 0) {
+	if (info) {
+		unregister_framebuffer(info);
 		vfree(videomemory);
-		return -EINVAL;
+		framebuffer_release(info);
 	}
-
-	printk(KERN_INFO
-	       "fb%d: Virtual frame buffer device, using %ldK of video memory\n",
-	       fb_info.node, videomemorysize >> 10);
 	return 0;
 }
 
-#ifdef MODULE
+static struct device_driver vfb_driver = {
+	.name	= "vfb",
+	.bus	= &platform_bus_type,
+	.probe	= vfb_probe,
+	.remove = vfb_remove,
+};
 
-static void __exit vfb_cleanup(void)
+static struct platform_device vfb_device = {
+	.name	= "vfb",
+	.id	= 0,
+	.dev	= {
+		.release = vfb_platform_release,
+	}
+};
+
+int __init vfb_init(void)
 {
-	unregister_framebuffer(&fb_info);
-	vfree(videomemory);
+	int ret = 0;
+
+	if (!vfb_enable)
+		return -ENXIO;
+
+	ret = driver_register(&vfb_driver);
+
+	if (!ret) {
+		ret = platform_device_register(&vfb_device);
+		if (ret)
+			driver_unregister(&vfb_driver);
+	}
+	return ret;
+}
+
+#ifdef MODULE
+static void __exit vfb_exit(void)
+{
+	platform_device_unregister(&vfb_device);
+	driver_unregister(&vfb_driver);
 }
 
 module_init(vfb_init);
-module_exit(vfb_cleanup);
+module_exit(vfb_exit);
 
 MODULE_LICENSE("GPL");
 #endif				/* MODULE */
diff -Nru a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
--- a/drivers/video/vga16fb.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/video/vga16fb.c	Tue Jun 15 22:20:38 2004
@@ -1347,7 +1347,7 @@
 
 	/* XXX share VGA_FB_PHYS and I/O region with vgacon and others */
 
-	vga16fb.screen_base = ioremap(VGA_MAP_MEM(VGA_FB_PHYS), VGA_FB_PHYS_LEN);
+	vga16fb.screen_base = (void *)VGA_MAP_MEM(VGA_FB_PHYS);
 	if (!vga16fb.screen_base) {
 		printk(KERN_ERR "vga16fb: unable to map device\n");
 		ret = -ENOMEM;
@@ -1371,8 +1371,6 @@
 	vga16fb.fix = vga16fb_fix;
 	vga16fb.par = &vga16_par;
 	vga16fb.flags = FBINFO_FLAG_DEFAULT;
-
-	vga16fb.fix.smem_start	= VGA_MAP_MEM(vga16fb.fix.smem_start);
 
 	i = (vga16fb_defined.bits_per_pixel == 8) ? 256 : 16;
 	ret = fb_alloc_cmap(&vga16fb.cmap, i, 0);
diff -Nru a/drivers/video/virgefb.c b/drivers/video/virgefb.c
--- a/drivers/video/virgefb.c	Tue Jun 15 22:20:38 2004
+++ b/drivers/video/virgefb.c	Tue Jun 15 22:20:38 2004
@@ -1809,7 +1809,6 @@
 
 	/* TODO: This driver cannot be unloaded yet */
 
-	MOD_INC_USE_COUNT;
 	DPRINTK("EXIT\n");
 	return 0;
 }
@@ -2063,14 +2062,6 @@
 int init_module(void)
 {
 	return virgefb_init();
-}
-
-void cleanup_module(void)
-{
-	/* Not reached because the usecount will never be
-	   decremented to zero */
-	unregister_framebuffer(&fb_info);
-	/* TODO: clean up ... */
 }
 #endif /* MODULE */
 
diff -Nru a/fs/Kconfig b/fs/Kconfig
--- a/fs/Kconfig	Tue Jun 15 22:20:41 2004
+++ b/fs/Kconfig	Tue Jun 15 22:20:41 2004
@@ -244,6 +244,40 @@
 	  Almost everyone but ReiserFS developers and people fine-tuning
 	  reiserfs or tracing problems should say N.
 
+config REISERFS_FS_XATTR
+	bool "ReiserFS extended attributes"
+	depends on REISERFS_FS
+	help
+	  Extended attributes are name:value pairs associated with inodes by
+	  the kernel or by users (see the attr(5) manual page, or visit
+	  <http://acl.bestbits.at/> for details).
+
+	  If unsure, say N.
+
+config REISERFS_FS_POSIX_ACL
+	bool "ReiserFS POSIX Access Control Lists"
+	depends on REISERFS_FS_XATTR
+	help
+	  Posix Access Control Lists (ACLs) support permissions for users and
+	  groups beyond the owner/group/world scheme.
+
+	  To learn more about Access Control Lists, visit the Posix ACLs for
+	  Linux website <http://acl.bestbits.at/>.
+
+	  If you don't know what Access Control Lists are, say N
+
+config REISERFS_FS_SECURITY
+	bool "ReiserFS Security Labels"
+	depends on REISERFS_FS_XATTR
+	help
+	  Security labels support alternative access control models
+	  implemented by security modules like SELinux.  This option
+	  enables an extended attribute handler for file security
+	  labels in the ReiserFS filesystem.
+
+	  If you are not using a security module that requires using
+	  extended attributes for file security labels, say N.
+
 config JFS_FS
 	tristate "JFS filesystem support"
 	select NLS
@@ -282,13 +316,13 @@
 	  to be made available to the user in the /proc/fs/jfs/ directory.
 
 config FS_POSIX_ACL
-# Posix ACL utility routines (for now, only ext2/ext3/jfs)
+# Posix ACL utility routines (for now, only ext2/ext3/jfs/reiserfs)
 #
 # NOTE: you can implement Posix ACLs without these helpers (XFS does).
 # 	Never use this symbol for ifdefs.
 #
 	bool
-	depends on EXT2_FS_POSIX_ACL || EXT3_FS_POSIX_ACL || JFS_POSIX_ACL
+	depends on EXT2_FS_POSIX_ACL || EXT3_FS_POSIX_ACL || JFS_POSIX_ACL || REISERFS_FS_POSIX_ACL
 	default y
 
 config XFS_FS
@@ -468,7 +502,7 @@
 	  automounter (amd), which is a pure user space daemon.
 
 	  To use the automounter you need the user-space tools from
-	  <ftp://ftp.kernel.org/pub/linux/daemons/autofs/testing-v4/>; you also
+	  <ftp://ftp.kernel.org/pub/linux/daemons/autofs/v4/>; you also
 	  want to answer Y to "NFS file system support", below.
 
 	  To compile this support as a module, choose M here: the module will be
@@ -991,7 +1025,7 @@
 	  style features such as file ownership and permissions.
 
 config BEFS_FS
-	tristate "BeOS file systemv(BeFS) support (read only) (EXPERIMENTAL)"
+	tristate "BeOS file system (BeFS) support (read only) (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
 	select NLS
 	help
@@ -1535,20 +1569,30 @@
 	  This is the client VFS module for the Common Internet File System
 	  (CIFS) protocol which is the successor to the Server Message Block 
 	  (SMB) protocol, the native file sharing mechanism for most early
-	  PC operating systems.  CIFS is fully supported by current network
-	  file servers such as Windows 2000 (including Windows NT version 4 
+	  PC operating systems.  The CIFS protocol is fully supported by 
+	  file servers such as Windows 2000 (including Windows 2003, NT 4  
 	  and Windows XP) as well by Samba (which provides excellent CIFS
-	  server support for Linux and many other operating systems).  For
-	  production systems the smbfs module may be used instead of this
-	  cifs module since smbfs is currently more stable and provides
-	  support for older servers.  The intent of this module is to provide the
-	  most advanced network file system function for CIFS compliant servers, 
+	  server support for Linux and many other operating systems). Currently
+	  you must use the smbfs client filesystem to access older SMB servers
+	  such as Windows 9x and OS/2.
+
+	  The intent of the cifs module is to provide an advanced
+	  network file system client for mounting to CIFS compliant servers, 
 	  including support for dfs (hierarchical name space), secure per-user
 	  session establishment, safe distributed caching (oplock), optional
-	  packet signing, Unicode and other internationalization improvements, and
-	  optional Winbind (nsswitch) integration.  This module is in an early
-	  development stage, so unless you are specifically interested in this
-	  filesystem, just say N.
+	  packet signing, Unicode and other internationalization improvements, 
+	  and optional Winbind (nsswitch) integration. You do not need to enable
+	  cifs if running only a (Samba) server. It is possible to enable both
+	  smbfs and cifs (e.g. if you are using CIFS for accessing Windows 2003
+	  and Samba 3 servers, and smbfs for accessing old servers). If you need 
+	  to mount to Samba or Windows 2003 servers from this machine, say Y.
+
+config CIFS_STATS
+        bool "CIFS statistics"
+        depends on CIFS
+        help
+          Enabling this option will cause statistics for each server share
+	  mounted by the cifs client to be displayed in /proc/fs/cifs/DebugData
 
 config NCP_FS
 	tristate "NCP file system support (to mount NetWare volumes)"
@@ -1608,22 +1652,6 @@
 	  cache manager then say Y.
 	  
 	  For most cases you probably want to say N.
-
-#
-# Intermezzo broke when we added the expanded NGROUPS patches
-#
-config INTERMEZZO_FS
-	tristate "InterMezzo file system support (replicating fs) (EXPERIMENTAL)"
-	depends on INET && EXPERIMENTAL 
-	help
-	  InterMezzo is a networked file system with disconnected operation
-	  and kernel level write back caching.  It is most often used for
-	  replicating potentially large trees or keeping laptop/desktop copies
-	  in sync.
-
-	  If you say Y or M your kernel or module will provide InterMezzo
-	  support.  You will also need a file server daemon, which you can get
-	  from <http://www.inter-mezzo.org/>.
 
 config AFS_FS
 # for fs/nls/Config.in
diff -Nru a/fs/Makefile b/fs/Makefile
--- a/fs/Makefile	Tue Jun 15 22:20:41 2004
+++ b/fs/Makefile	Tue Jun 15 22:20:41 2004
@@ -53,7 +53,6 @@
 obj-$(CONFIG_RAMFS)		+= ramfs/
 obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
 obj-$(CONFIG_CODA_FS)		+= coda/
-obj-$(CONFIG_INTERMEZZO_FS)	+= intermezzo/
 obj-$(CONFIG_MINIX_FS)		+= minix/
 obj-$(CONFIG_FAT_FS)		+= fat/
 obj-$(CONFIG_UMSDOS_FS)		+= umsdos/
diff -Nru a/fs/afs/dir.c b/fs/afs/dir.c
--- a/fs/afs/dir.c	Tue Jun 15 22:20:39 2004
+++ b/fs/afs/dir.c	Tue Jun 15 22:20:39 2004
@@ -615,7 +615,9 @@
 
 	/* the dirent, if it exists, now points to a different vnode */
  not_found:
+	spin_lock(&dentry->d_lock);
 	dentry->d_flags |= DCACHE_NFSFS_RENAMED;
+	spin_unlock(&dentry->d_lock);
 
  out_bad:
 	if (inode) {
diff -Nru a/fs/afs/file.c b/fs/afs/file.c
--- a/fs/afs/file.c	Tue Jun 15 22:20:43 2004
+++ b/fs/afs/file.c	Tue Jun 15 22:20:43 2004
@@ -31,8 +31,8 @@
 static int afs_file_invalidatepage(struct page *page, unsigned long offset);
 static int afs_file_releasepage(struct page *page, int gfp_flags);
 
-static ssize_t afs_file_write(struct file *file, const char *buf, size_t size,
-			      loff_t *off);
+static ssize_t afs_file_write(struct file *file, const char __user *buf,
+			      size_t size, loff_t *off);
 
 struct inode_operations afs_file_inode_operations = {
 	.getattr	= afs_inode_getattr,
@@ -61,8 +61,8 @@
 /*
  * AFS file write
  */
-static ssize_t afs_file_write(struct file *file, const char *buf, size_t size,
-			      loff_t *off)
+static ssize_t afs_file_write(struct file *file, const char __user *buf,
+			      size_t size, loff_t *off)
 {
 	struct afs_vnode *vnode;
 
diff -Nru a/fs/afs/proc.c b/fs/afs/proc.c
--- a/fs/afs/proc.c	Tue Jun 15 22:20:38 2004
+++ b/fs/afs/proc.c	Tue Jun 15 22:20:38 2004
@@ -27,7 +27,7 @@
 static void *afs_proc_cells_next(struct seq_file *p, void *v, loff_t *pos);
 static void afs_proc_cells_stop(struct seq_file *p, void *v);
 static int afs_proc_cells_show(struct seq_file *m, void *v);
-static ssize_t afs_proc_cells_write(struct file *file, const char *buf,
+static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
 				    size_t size, loff_t *_pos);
 
 static struct seq_operations afs_proc_cells_ops = {
@@ -47,9 +47,10 @@
 
 static int afs_proc_rootcell_open(struct inode *inode, struct file *file);
 static int afs_proc_rootcell_release(struct inode *inode, struct file *file);
-static ssize_t afs_proc_rootcell_read(struct file *file, char *buf,
+static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
 				      size_t size, loff_t *_pos);
-static ssize_t afs_proc_rootcell_write(struct file *file, const char *buf,
+static ssize_t afs_proc_rootcell_write(struct file *file,
+				       const char __user *buf,
 				       size_t size, loff_t *_pos);
 
 static struct file_operations afs_proc_rootcell_fops = {
@@ -278,7 +279,7 @@
  * handle writes to /proc/fs/afs/cells
  * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]"
  */
-static ssize_t afs_proc_cells_write(struct file *file, const char *buf,
+static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
 				    size_t size, loff_t *_pos)
 {
 	char *kbuf, *name, *args;
@@ -363,7 +364,7 @@
 	return 0;
 }
 
-static ssize_t afs_proc_rootcell_read(struct file *file, char *buf,
+static ssize_t afs_proc_rootcell_read(struct file *file, char __user *buf,
 				      size_t size, loff_t *_pos)
 {
 	return 0;
@@ -374,7 +375,8 @@
  * handle writes to /proc/fs/afs/rootcell
  * - to initialize rootcell: echo "cell.name:192.168.231.14"
  */
-static ssize_t afs_proc_rootcell_write(struct file *file, const char *buf,
+static ssize_t afs_proc_rootcell_write(struct file *file,
+				       const char __user *buf,
 				       size_t size, loff_t *_pos)
 {
 	char *kbuf, *s;
diff -Nru a/fs/aio.c b/fs/aio.c
--- a/fs/aio.c	Tue Jun 15 22:20:40 2004
+++ b/fs/aio.c	Tue Jun 15 22:20:40 2004
@@ -15,7 +15,7 @@
 #include <linux/aio_abi.h>
 #include <linux/module.h>
 
-//#define DEBUG 1
+#define DEBUG 0
 
 #include <linux/sched.h>
 #include <linux/fs.h>
@@ -64,14 +64,9 @@
 static int __init aio_setup(void)
 {
 	kiocb_cachep = kmem_cache_create("kiocb", sizeof(struct kiocb),
-				0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!kiocb_cachep)
-		panic("unable to create kiocb cache\n");
-
+				0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 	kioctx_cachep = kmem_cache_create("kioctx", sizeof(struct kioctx),
-				0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!kioctx_cachep)
-		panic("unable to create kioctx cache");
+				0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 
 	aio_wq = create_workqueue("aio");
 
@@ -399,7 +394,7 @@
 	req->ki_ctx = ctx;
 	req->ki_cancel = NULL;
 	req->ki_retry = NULL;
-	req->ki_user_obj = NULL;
+	req->ki_obj.user = NULL;
 
 	/* Check if the completion queue has enough free space to
 	 * accept an event from this io.
@@ -442,7 +437,7 @@
 {
 	req->ki_ctx = NULL;
 	req->ki_filp = NULL;
-	req->ki_user_obj = NULL;
+	req->ki_obj.user = NULL;
 	kmem_cache_free(kiocb_cachep, req);
 	ctx->reqs_active--;
 
@@ -543,19 +538,25 @@
 
 static void use_mm(struct mm_struct *mm)
 {
-	struct mm_struct *active_mm = current->active_mm;
+	struct mm_struct *active_mm;
+
 	atomic_inc(&mm->mm_count);
+	task_lock(current);
+	active_mm = current->active_mm;
 	current->mm = mm;
 	if (mm != active_mm) {
 		current->active_mm = mm;
 		activate_mm(active_mm, mm);
 	}
+	task_unlock(current);
 	mmdrop(active_mm);
 }
 
 static void unuse_mm(struct mm_struct *mm)
 {
+	task_lock(current);
 	current->mm = NULL;
+	task_unlock(current);
 	/* active_mm is still 'mm' */
 	enter_lazy_tlb(mm, current);
 }
@@ -604,7 +605,7 @@
 	 * single context. */
 	if (is_sync_kiocb(iocb)) {
 		kiocbSetKicked(iocb);
-		wake_up_process(iocb->ki_user_obj);
+		wake_up_process(iocb->ki_obj.tsk);
 		return;
 	}
 
@@ -613,7 +614,7 @@
 		spin_lock_irqsave(&ctx->ctx_lock, flags);
 		list_add_tail(&iocb->ki_run_list, &ctx->run_list);
 		spin_unlock_irqrestore(&ctx->ctx_lock, flags);
-		schedule_work(&ctx->wq);
+		queue_work(aio_wq, &ctx->wq);
 	}
 }
 
@@ -652,7 +653,7 @@
 			spin_unlock_irq(&ctx->ctx_lock);
 		}
 		/* sync iocbs put the task here for us */
-		wake_up_process(iocb->ki_user_obj);
+		wake_up_process(iocb->ki_obj.tsk);
 		return ret;
 	}
 
@@ -672,13 +673,13 @@
 	event = aio_ring_event(info, tail, KM_IRQ0);
 	tail = (tail + 1) % info->nr;
 
-	event->obj = (u64)(unsigned long)iocb->ki_user_obj;
+	event->obj = (u64)(unsigned long)iocb->ki_obj.user;
 	event->data = iocb->ki_user_data;
 	event->res = res;
 	event->res2 = res2;
 
 	dprintk("aio_complete: %p[%lu]: %p: %p %Lx %lx %lx\n",
-		ctx, tail, iocb, iocb->ki_user_obj, iocb->ki_user_data,
+		ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data,
 		res, res2);
 
 	/* after flagging the request as done, we
@@ -776,24 +777,16 @@
 static inline void set_timeout(long start_jiffies, struct timeout *to,
 			       const struct timespec *ts)
 {
-	unsigned long how_long;
-
-	if (ts->tv_sec < 0 || (!ts->tv_sec && !ts->tv_nsec)) {
+	to->timer.expires = start_jiffies + timespec_to_jiffies(ts);
+	if (time_after(to->timer.expires, jiffies))
+		add_timer(&to->timer);
+	else
 		to->timed_out = 1;
-		return;
-	}
-
-	how_long = ts->tv_sec * HZ;
-#define HZ_NS (1000000000 / HZ)
-	how_long += (ts->tv_nsec + HZ_NS - 1) / HZ_NS;
-	
-	to->timer.expires = jiffies + how_long;
-	add_timer(&to->timer);
 }
 
 static inline void clear_timeout(struct timeout *to)
 {
-	del_timer_sync(&to->timer);
+	del_singleshot_timer_sync(&to->timer);
 }
 
 static int read_events(struct kioctx *ctx,
@@ -939,7 +932,7 @@
  *	pointer is passed for ctxp.  Will fail with -ENOSYS if not
  *	implemented.
  */
-asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t *ctxp)
+asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp)
 {
 	struct kioctx *ioctx = NULL;
 	unsigned long ctx;
@@ -961,6 +954,7 @@
 		ret = put_user(ioctx->user_id, ctxp);
 		if (!ret)
 			return 0;
+	 	get_ioctx(ioctx);
 		io_destroy(ioctx);
 	}
 
@@ -1028,7 +1022,7 @@
 		goto out_put_req;
 	}
 
-	req->ki_user_obj = user_iocb;
+	req->ki_obj.user = user_iocb;
 	req->ki_user_data = iocb->aio_data;
 	req->ki_pos = iocb->aio_offset;
 
@@ -1099,7 +1093,7 @@
  *	fail with -ENOSYS if not implemented.
  */
 asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr,
-			      struct iocb __user **iocbpp)
+			      struct iocb __user * __user *iocbpp)
 {
 	struct kioctx *ctx;
 	long ret = 0;
@@ -1154,7 +1148,7 @@
 	/* TODO: use a hash or array, this sucks. */
 	list_for_each(pos, &ctx->active_reqs) {
 		struct kiocb *kiocb = list_kiocb(pos);
-		if (kiocb->ki_user_obj == iocb && kiocb->ki_key == key)
+		if (kiocb->ki_obj.user == iocb && kiocb->ki_key == key)
 			return kiocb;
 	}
 	return NULL;
@@ -1201,7 +1195,7 @@
 		struct io_event tmp;
 		pr_debug("calling cancel\n");
 		memset(&tmp, 0, sizeof(tmp));
-		tmp.obj = (u64)(unsigned long)kiocb->ki_user_obj;
+		tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user;
 		tmp.data = kiocb->ki_user_data;
 		ret = cancel(kiocb, &tmp);
 		if (!ret) {
diff -Nru a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
--- a/fs/autofs4/autofs_i.h	Tue Jun 15 22:20:42 2004
+++ b/fs/autofs4/autofs_i.h	Tue Jun 15 22:20:42 2004
@@ -25,15 +25,17 @@
 #include <linux/string.h>
 #include <linux/wait.h>
 #include <linux/sched.h>
+#include <linux/mount.h>
+#include <linux/namei.h>
 #include <asm/current.h>
 #include <asm/uaccess.h>
 
 /* #define DEBUG */
 
 #ifdef DEBUG
-#define DPRINTK(D) do{ printk("pid %d: ", current->pid); printk D; } while(0)
+#define DPRINTK(fmt,args...) do { printk(KERN_DEBUG "pid %d: %s: " fmt "\n" , current->pid , __FUNCTION__ , ##args); } while(0)
 #else
-#define DPRINTK(D) do {} while(0)
+#define DPRINTK(fmt,args...) do {} while(0)
 #endif
 
 #define AUTOFS_SUPER_MAGIC 0x0187
@@ -82,7 +84,7 @@
 	char *name;
 	/* This is for status reporting upon return */
 	int status;
-	int wait_ctr;
+	atomic_t wait_ctr;
 };
 
 #define AUTOFS_SBI_MAGIC 0x6d4a556d
@@ -93,8 +95,12 @@
 	pid_t oz_pgrp;
 	int catatonic;
 	int version;
+	int sub_version;
 	unsigned long exp_timeout;
+	int reghost_enabled;
+	int needs_reghost;
 	struct super_block *sb;
+	struct semaphore wq_sem;
 	struct autofs_wait_queue *queues; /* Wait queue pointer */
 };
 
@@ -125,6 +131,12 @@
 		(inf != NULL && inf->flags & AUTOFS_INF_EXPIRING);
 }
 
+static inline void autofs4_copy_atime(struct file *src, struct file *dst)
+{
+	dst->f_dentry->d_inode->i_atime = src->f_dentry->d_inode->i_atime;
+	return;
+}
+
 struct inode *autofs4_get_inode(struct super_block *, struct autofs_info *);
 struct autofs_info *autofs4_init_inf(struct autofs_sb_info *, mode_t mode);
 void autofs4_free_ino(struct autofs_info *);
@@ -132,15 +144,17 @@
 /* Expiration */
 int is_autofs4_dentry(struct dentry *);
 int autofs4_expire_run(struct super_block *, struct vfsmount *,
-			struct autofs_sb_info *, struct autofs_packet_expire *);
+			struct autofs_sb_info *,
+			struct autofs_packet_expire __user *);
 int autofs4_expire_multi(struct super_block *, struct vfsmount *,
-			struct autofs_sb_info *, int *);
+			struct autofs_sb_info *, int __user *);
 
 /* Operations structures */
 
 extern struct inode_operations autofs4_symlink_inode_operations;
 extern struct inode_operations autofs4_dir_inode_operations;
 extern struct inode_operations autofs4_root_inode_operations;
+extern struct file_operations autofs4_dir_operations;
 extern struct file_operations autofs4_root_operations;
 
 /* Initializing function */
@@ -157,6 +171,24 @@
 	NFY_EXPIRE
 };
 
-int autofs4_wait(struct autofs_sb_info *,struct qstr *, enum autofs_notify);
+int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify);
 int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int);
 void autofs4_catatonic_mode(struct autofs_sb_info *);
+
+static inline int simple_positive(struct dentry *dentry)
+{
+	return dentry->d_inode && !d_unhashed(dentry);
+}
+
+static inline int simple_empty_nolock(struct dentry *dentry)
+{
+	struct dentry *child;
+	int ret = 0;
+
+	list_for_each_entry(child, &dentry->d_subdirs, d_child)
+		if (simple_positive(child))
+			goto out;
+	ret = 1;
+out:
+	return ret;
+}
diff -Nru a/fs/autofs4/expire.c b/fs/autofs4/expire.c
--- a/fs/autofs4/expire.c	Tue Jun 15 22:20:42 2004
+++ b/fs/autofs4/expire.c	Tue Jun 15 22:20:42 2004
@@ -4,6 +4,7 @@
  *
  *  Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
  *  Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
+ *  Copyright 2001-2003 Ian Kent <raven@themaw.net>
  *
  * This file is part of the Linux kernel and is made available under
  * the terms of the GNU General Public License, version 2, or at your
@@ -12,139 +13,198 @@
  * ------------------------------------------------------------------------- */
 
 #include "autofs_i.h"
-#include <linux/mount.h>
 
-/*
- * Determine if a subtree of the namespace is busy.
- *
- * mnt is the mount tree under the autofs mountpoint
+static unsigned long now;
+
+/* Check if a dentry can be expired return 1 if it can else return 0 */
+static inline int autofs4_can_expire(struct dentry *dentry,
+					unsigned long timeout, int do_now)
+{
+	struct autofs_info *ino = autofs4_dentry_ino(dentry);
+
+	/* dentry in the process of being deleted */
+	if (ino == NULL)
+		return 0;
+
+	/* No point expiring a pending mount */
+	if (dentry->d_flags & DCACHE_AUTOFS_PENDING)
+		return 0;
+
+	if (!do_now) {
+		/* Too young to die */
+		if (time_after(ino->last_used + timeout, now))
+			return 0;
+
+		/* update last_used here :-
+		   - obviously makes sense if it is in use now
+		   - less obviously, prevents rapid-fire expire
+		     attempts if expire fails the first time */
+		ino->last_used = now;
+	}
+
+	return 1;
+}
+
+/* Check a mount point for busyness return 1 if not busy, otherwise */
+static int autofs4_check_mount(struct vfsmount *mnt, struct dentry *dentry)
+{
+	int status = 0;
+
+	DPRINTK("dentry %p %.*s",
+		dentry, (int)dentry->d_name.len, dentry->d_name.name);
+
+	mntget(mnt);
+	dget(dentry);
+
+	if (!follow_down(&mnt, &dentry))
+		goto done;
+
+	while (d_mountpoint(dentry) && follow_down(&mnt, &dentry))
+		;
+
+	/* This is an autofs submount, we can't expire it */
+	if (is_autofs4_dentry(dentry))
+		goto done;
+
+	/* The big question */
+	if (may_umount_tree(mnt) == 0)
+		status = 1;
+done:
+	DPRINTK("returning = %d", status);
+	mntput(mnt);
+	dput(dentry);
+	return status;
+}
+
+/* Check a directory tree of mount points for busyness
+ * The tree is not busy iff no mountpoints are busy
+ * Return 1 if the tree is busy or 0 otherwise
  */
-static inline int is_vfsmnt_tree_busy(struct vfsmount *mnt)
+static int autofs4_check_tree(struct vfsmount *mnt,
+	       		      struct dentry *top,
+			      unsigned long timeout,
+			      int do_now)
 {
-	struct vfsmount *this_parent = mnt;
+	struct dentry *this_parent = top;
 	struct list_head *next;
-	int count;
 
-	count = atomic_read(&mnt->mnt_count) - 1;
+	DPRINTK("parent %p %.*s",
+		top, (int)top->d_name.len, top->d_name.name);
+
+	/* Negative dentry - give up */
+	if (!simple_positive(top))
+		return 0;
+
+	/* Timeout of a tree mount is determined by its top dentry */
+	if (!autofs4_can_expire(top, timeout, do_now))
+		return 0;
 
+	spin_lock(&dcache_lock);
 repeat:
-	next = this_parent->mnt_mounts.next;
-	DPRINTK(("is_vfsmnt_tree_busy: mnt=%p, this_parent=%p, next=%p\n",
-		 mnt, this_parent, next));
+	next = this_parent->d_subdirs.next;
 resume:
-	for( ; next != &this_parent->mnt_mounts; next = next->next) {
-		struct vfsmount *p = list_entry(next, struct vfsmount,
-						mnt_child);
-
-		/* -1 for struct vfs_mount's normal count, 
-		   -1 to compensate for child's reference to parent */
-		count += atomic_read(&p->mnt_count) - 1 - 1;
+	while (next != &this_parent->d_subdirs) {
+		struct dentry *dentry = list_entry(next, struct dentry, d_child);
+
+		/* Negative dentry - give up */
+		if (!simple_positive(dentry)) {
+			next = next->next;
+			continue;
+		}
 
-		DPRINTK(("is_vfsmnt_tree_busy: p=%p, count now %d\n",
-			 p, count));
+		DPRINTK("dentry %p %.*s",
+			dentry, (int)dentry->d_name.len, dentry->d_name.name);
 
-		if (!list_empty(&p->mnt_mounts)) {
-			this_parent = p;
+		if (!simple_empty_nolock(dentry)) {
+			this_parent = dentry;
 			goto repeat;
 		}
-		/* root is busy if any leaf is busy */
-		if (atomic_read(&p->mnt_count) > 1)
-			return 1;
-	}
 
-	/* All done at this level ... ascend and resume the search. */
-	if (this_parent != mnt) {
-		next = this_parent->mnt_child.next; 
-		this_parent = this_parent->mnt_parent;
-		goto resume;
-	}
+		dentry = dget(dentry);
+		spin_unlock(&dcache_lock);
 
-	DPRINTK(("is_vfsmnt_tree_busy: count=%d\n", count));
-	return count != 0; /* remaining users? */
-}
+		if (d_mountpoint(dentry)) {
+			/* First busy => tree busy */
+			if (!autofs4_check_mount(mnt, dentry)) {
+				dput(dentry);
+				return 0;
+			}
+		}
 
-/* Traverse a dentry's list of vfsmounts and return the number of
-   non-busy mounts */
-static int check_vfsmnt(struct vfsmount *mnt, struct dentry *dentry)
-{
-	int ret = dentry->d_mounted;
-	struct vfsmount *vfs = lookup_mnt(mnt, dentry);
+		dput(dentry);
+		spin_lock(&dcache_lock);
+		next = next->next;
+	}
 
-	if (vfs) {
-		mntput(vfs);
-		if (is_vfsmnt_tree_busy(vfs))
-			ret--;
+	if (this_parent != top) {
+		next = this_parent->d_child.next;
+		this_parent = this_parent->d_parent;
+		goto resume;
 	}
-	DPRINTK(("check_vfsmnt: ret=%d\n", ret));
-	return ret;
+	spin_unlock(&dcache_lock);
+
+	return 1;
 }
 
-/* Check dentry tree for busyness.  If a dentry appears to be busy
-   because it is a mountpoint, check to see if the mounted
-   filesystem is busy. */
-static int is_tree_busy(struct vfsmount *topmnt, struct dentry *top)
+struct dentry *autofs4_check_leaves(struct vfsmount *mnt,
+				    struct dentry *parent,
+				    unsigned long timeout,
+				    int do_now)
 {
-	struct dentry *this_parent;
+	struct dentry *this_parent = parent;
 	struct list_head *next;
-	int count;
 
-	count = atomic_read(&top->d_count);
-	
-	DPRINTK(("is_tree_busy: top=%p initial count=%d\n", 
-		 top, count));
-	this_parent = top;
-
-	if (is_autofs4_dentry(top)) {
-		count--;
-		DPRINTK(("is_tree_busy: autofs; count=%d\n", count));
-	}
+	DPRINTK("parent %p %.*s",
+		parent, (int)parent->d_name.len, parent->d_name.name);
 
-	if (d_mountpoint(top))
-		count -= check_vfsmnt(topmnt, top);
-
- repeat:
+	spin_lock(&dcache_lock);
+repeat:
 	next = this_parent->d_subdirs.next;
- resume:
+resume:
 	while (next != &this_parent->d_subdirs) {
-		int adj = 0;
-		struct dentry *dentry = list_entry(next, struct dentry,
-						   d_child);
-		next = next->next;
-
-		count += atomic_read(&dentry->d_count) - 1;
-
-		if (d_mountpoint(dentry))
-			adj += check_vfsmnt(topmnt, dentry);
+		struct dentry *dentry = list_entry(next, struct dentry, d_child);
 
-		if (is_autofs4_dentry(dentry)) {
-			adj++;
-			DPRINTK(("is_tree_busy: autofs; adj=%d\n",
-				 adj));
+		/* Negative dentry - give up */
+		if (!simple_positive(dentry)) {
+			next = next->next;
+			continue;
 		}
 
-		count -= adj;
+		DPRINTK("dentry %p %.*s",
+			dentry, (int)dentry->d_name.len, dentry->d_name.name);
 
 		if (!list_empty(&dentry->d_subdirs)) {
 			this_parent = dentry;
 			goto repeat;
 		}
 
-		if (atomic_read(&dentry->d_count) != adj) {
-			DPRINTK(("is_tree_busy: busy leaf (d_count=%d adj=%d)\n",
-				 atomic_read(&dentry->d_count), adj));
-			return 1;
+		dentry = dget(dentry);
+		spin_unlock(&dcache_lock);
+
+		if (d_mountpoint(dentry)) {
+			/* Can we expire this guy */
+			if (!autofs4_can_expire(dentry, timeout, do_now))
+				goto cont;
+
+			/* Can we umount this guy */
+			if (autofs4_check_mount(mnt, dentry))
+				return dentry;
+
 		}
+cont:
+		dput(dentry);
+		spin_lock(&dcache_lock);
+		next = next->next;
 	}
 
-	/* All done at this level ... ascend and resume the search. */
-	if (this_parent != top) {
-		next = this_parent->d_child.next; 
+	if (this_parent != parent) {
+		next = this_parent->d_child.next;
 		this_parent = this_parent->d_parent;
 		goto resume;
 	}
+	spin_unlock(&dcache_lock);
 
-	DPRINTK(("is_tree_busy: count=%d\n", count));
-	return count != 0; /* remaining users? */
+	return NULL;
 }
 
 /*
@@ -156,61 +216,86 @@
 static struct dentry *autofs4_expire(struct super_block *sb,
 				     struct vfsmount *mnt,
 				     struct autofs_sb_info *sbi,
-				     int do_now)
+				     int how)
 {
-	unsigned long now = jiffies;
 	unsigned long timeout;
 	struct dentry *root = sb->s_root;
-	struct list_head *tmp;
+	struct dentry *expired = NULL;
+	struct list_head *next;
+	int do_now = how & AUTOFS_EXP_IMMEDIATE;
+	int exp_leaves = how & AUTOFS_EXP_LEAVES;
 
-	if (!sbi->exp_timeout || !root)
+	if ( !sbi->exp_timeout || !root )
 		return NULL;
 
+	now = jiffies;
 	timeout = sbi->exp_timeout;
 
 	spin_lock(&dcache_lock);
-	for(tmp = root->d_subdirs.next;
-	    tmp != &root->d_subdirs; 
-	    tmp = tmp->next) {
-		struct autofs_info *ino;
-		struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
+	next = root->d_subdirs.next;
 
-		if (dentry->d_inode == NULL)
+	/* On exit from the loop expire is set to a dgot dentry
+	 * to expire or it's NULL */
+	while ( next != &root->d_subdirs ) {
+		struct dentry *dentry = list_entry(next, struct dentry, d_child);
+
+		/* Negative dentry - give up */
+		if ( !simple_positive(dentry) ) {
+			next = next->next;
 			continue;
+		}
 
-		ino = autofs4_dentry_ino(dentry);
+		dentry = dget(dentry);
+		spin_unlock(&dcache_lock);
 
-		if (ino == NULL) {
-			/* dentry in the process of being deleted */
-			continue;
+		/* Case 1: indirect mount or top level direct mount */
+		if (d_mountpoint(dentry)) {
+			DPRINTK("checking mountpoint %p %.*s",
+				dentry, (int)dentry->d_name.len, dentry->d_name.name);
+
+			/* Can we expire this guy */
+			if (!autofs4_can_expire(dentry, timeout, do_now))
+				goto next;
+
+			/* Can we umount this guy */
+			if (autofs4_check_mount(mnt, dentry)) {
+				expired = dentry;
+				break;
+			}
+			goto next;
 		}
 
-		/* No point expiring a pending mount */
-		if (dentry->d_flags & DCACHE_AUTOFS_PENDING)
-			continue;
+		if ( simple_empty(dentry) )
+			goto next;
 
-		if (!do_now) {
-			/* Too young to die */
-			if (time_after(ino->last_used + timeout, now))
-				continue;
-		
-			/* update last_used here :- 
-			   - obviously makes sense if it is in use now
-			   - less obviously, prevents rapid-fire expire
-			     attempts if expire fails the first time */
-			ino->last_used = now;
+		/* Case 2: tree mount, expire iff entire tree is not busy */
+		if (!exp_leaves) {
+			if (autofs4_check_tree(mnt, dentry, timeout, do_now)) {
+			expired = dentry;
+			break;
+			}
+		/* Case 3: direct mount, expire individual leaves */
+		} else {
+			expired = autofs4_check_leaves(mnt, dentry, timeout, do_now);
+			if (expired) {
+				dput(dentry);
+				break;
+			}
 		}
-		if (!is_tree_busy(mnt, dentry)) {
-			DPRINTK(("autofs_expire: returning %p %.*s\n",
-				 dentry, (int)dentry->d_name.len, dentry->d_name.name));
-			/* Start from here next time */
-			list_del(&root->d_subdirs);
-			list_add(&root->d_subdirs, &dentry->d_child);
-			dget(dentry);
-			spin_unlock(&dcache_lock);
+next:
+		dput(dentry);
+		spin_lock(&dcache_lock);
+		next = next->next;
+	}
 
-			return dentry;
-		}
+	if ( expired ) {
+		DPRINTK("returning %p %.*s",
+			expired, (int)expired->d_name.len, expired->d_name.name);
+		spin_lock(&dcache_lock);
+		list_del(&expired->d_parent->d_subdirs);
+		list_add(&expired->d_parent->d_subdirs, &expired->d_child);
+		spin_unlock(&dcache_lock);
+		return expired;
 	}
 	spin_unlock(&dcache_lock);
 
@@ -221,7 +306,7 @@
 int autofs4_expire_run(struct super_block *sb,
 		      struct vfsmount *mnt,
 		      struct autofs_sb_info *sbi,
-		      struct autofs_packet_expire *pkt_p)
+		      struct autofs_packet_expire __user *pkt_p)
 {
 	struct autofs_packet_expire pkt;
 	struct dentry *dentry;
@@ -248,7 +333,7 @@
 /* Call repeatedly until it returns -EAGAIN, meaning there's nothing
    more to be done */
 int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt,
-			struct autofs_sb_info *sbi, int *arg)
+			struct autofs_sb_info *sbi, int __user *arg)
 {
 	struct dentry *dentry;
 	int ret = -EAGAIN;
@@ -263,7 +348,7 @@
 		/* This is synchronous because it makes the daemon a
                    little easier */
 		de_info->flags |= AUTOFS_INF_EXPIRING;
-		ret = autofs4_wait(sbi, &dentry->d_name, NFY_EXPIRE);
+		ret = autofs4_wait(sbi, dentry, NFY_EXPIRE);
 		de_info->flags &= ~AUTOFS_INF_EXPIRING;
 		dput(dentry);
 	}
diff -Nru a/fs/autofs4/inode.c b/fs/autofs4/inode.c
--- a/fs/autofs4/inode.c	Tue Jun 15 22:20:43 2004
+++ b/fs/autofs4/inode.c	Tue Jun 15 22:20:43 2004
@@ -87,7 +87,7 @@
 
 	kfree(sbi);
 
-	DPRINTK(("autofs: shutting down\n"));
+	DPRINTK("shutting down");
 }
 
 static struct super_operations autofs4_sops = {
@@ -187,12 +187,13 @@
 	struct file * pipe;
 	int pipefd;
 	struct autofs_sb_info *sbi;
+	struct autofs_info *ino;
 	int minproto, maxproto;
 
 	sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL);
 	if ( !sbi )
 		goto fail_unlock;
-	DPRINTK(("autofs: starting up, sbi = %p\n",sbi));
+	DPRINTK("starting up, sbi = %p",sbi);
 
 	memset(sbi, 0, sizeof(*sbi));
 
@@ -203,6 +204,8 @@
 	sbi->oz_pgrp = process_group(current);
 	sbi->sb = s;
 	sbi->version = 0;
+	sbi->sub_version = 0;
+	init_MUTEX(&sbi->wq_sem);
 	sbi->queues = NULL;
 	s->s_blocksize = 1024;
 	s->s_blocksize_bits = 10;
@@ -212,7 +215,11 @@
 	/*
 	 * Get the root inode and dentry, but defer checking for errors.
 	 */
-	root_inode = autofs4_get_inode(s, autofs4_mkroot(sbi));
+	ino = autofs4_mkroot(sbi);
+	if (!ino)
+		goto fail_free;
+	root_inode = autofs4_get_inode(s, ino);
+	kfree(ino);
 	if (!root_inode)
 		goto fail_free;
 
@@ -244,8 +251,9 @@
 	}
 
 	sbi->version = maxproto > AUTOFS_MAX_PROTO_VERSION ? AUTOFS_MAX_PROTO_VERSION : maxproto;
+	sbi->sub_version = AUTOFS_PROTO_SUBVERSION;
 
-	DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp));
+	DPRINTK("pipe fd = %d, pgrp = %u", pipefd, sbi->oz_pgrp);
 	pipe = fget(pipefd);
 	
 	if ( !pipe ) {
@@ -305,7 +313,7 @@
 	if (S_ISDIR(inf->mode)) {
 		inode->i_nlink = 2;
 		inode->i_op = &autofs4_dir_inode_operations;
-		inode->i_fop = &simple_dir_operations;
+		inode->i_fop = &autofs4_dir_operations;
 	} else if (S_ISLNK(inf->mode)) {
 		inode->i_size = inf->size;
 		inode->i_op = &autofs4_symlink_inode_operations;
diff -Nru a/fs/autofs4/root.c b/fs/autofs4/root.c
--- a/fs/autofs4/root.c	Tue Jun 15 22:20:36 2004
+++ b/fs/autofs4/root.c	Tue Jun 15 22:20:36 2004
@@ -4,6 +4,7 @@
  *
  *  Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
  *  Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
+ *  Copyright 2001-2003 Ian Kent <raven@themaw.net>
  *
  * This file is part of the Linux kernel and is made available under
  * the terms of the GNU General Public License, version 2, or at your
@@ -24,17 +25,28 @@
 static int autofs4_dir_rmdir(struct inode *,struct dentry *);
 static int autofs4_dir_mkdir(struct inode *,struct dentry *,int);
 static int autofs4_root_ioctl(struct inode *, struct file *,unsigned int,unsigned long);
+static int autofs4_dir_open(struct inode *inode, struct file *file);
+static int autofs4_dir_close(struct inode *inode, struct file *file);
+static int autofs4_dir_readdir(struct file * filp, void * dirent, filldir_t filldir);
+static int autofs4_root_readdir(struct file * filp, void * dirent, filldir_t filldir);
 static struct dentry *autofs4_root_lookup(struct inode *,struct dentry *, struct nameidata *);
+static int autofs4_dcache_readdir(struct file *, void *, filldir_t);
 
 struct file_operations autofs4_root_operations = {
 	.open		= dcache_dir_open,
 	.release	= dcache_dir_close,
-	.llseek		= dcache_dir_lseek,
 	.read		= generic_read_dir,
-	.readdir	= dcache_readdir,
+	.readdir	= autofs4_root_readdir,
 	.ioctl		= autofs4_root_ioctl,
 };
 
+struct file_operations autofs4_dir_operations = {
+	.open		= autofs4_dir_open,
+	.release	= autofs4_dir_close,
+	.read		= generic_read_dir,
+	.readdir	= autofs4_dir_readdir,
+};
+
 struct inode_operations autofs4_root_inode_operations = {
 	.lookup		= autofs4_root_lookup,
 	.unlink		= autofs4_dir_unlink,
@@ -51,12 +63,35 @@
 	.rmdir		= autofs4_dir_rmdir,
 };
 
+static int autofs4_root_readdir(struct file *file, void *dirent,
+				filldir_t filldir)
+{
+	struct autofs_sb_info *sbi = autofs4_sbi(file->f_dentry->d_sb);
+	int oz_mode = autofs4_oz_mode(sbi);
+
+	DPRINTK("called, filp->f_pos = %lld", file->f_pos);
+
+	/*
+	 * Don't set reghost flag if:
+	 * 1) f_pos is larger than zero -- we've already been here.
+	 * 2) we haven't even enabled reghosting in the 1st place.
+	 * 3) this is the daemon doing a readdir
+	 */
+	if (oz_mode && file->f_pos == 0 && sbi->reghost_enabled)
+		sbi->needs_reghost = 1;
+
+	DPRINTK("needs_reghost = %d", sbi->needs_reghost);
+
+	return autofs4_dcache_readdir(file, dirent, filldir);
+}
+
 /* Update usage from here to top of tree, so that scan of
    top-level directories will give a useful result */
 static void autofs4_update_usage(struct dentry *dentry)
 {
 	struct dentry *top = dentry->d_sb->s_root;
 
+	spin_lock(&dcache_lock);
 	for(; dentry != top; dentry = dentry->d_parent) {
 		struct autofs_info *ino = autofs4_dentry_ino(dentry);
 
@@ -65,11 +100,194 @@
 			ino->last_used = jiffies;
 		}
 	}
+	spin_unlock(&dcache_lock);
+}
+
+/*
+ * From 2.4 kernel readdir.c
+ */
+static int autofs4_dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
+{
+	int i;
+	struct dentry *dentry = filp->f_dentry;
+
+	i = filp->f_pos;
+	switch (i) {
+		case 0:
+			if (filldir(dirent, ".", 1, i, dentry->d_inode->i_ino, DT_DIR) < 0)
+				break;
+			i++;
+			filp->f_pos++;
+			/* fallthrough */
+		case 1:
+			if (filldir(dirent, "..", 2, i, dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
+				break;
+			i++;
+			filp->f_pos++;
+			/* fallthrough */
+		default: {
+			struct list_head *list;
+			int j = i-2;
+
+			spin_lock(&dcache_lock);
+			list = dentry->d_subdirs.next;
+
+			for (;;) {
+				if (list == &dentry->d_subdirs) {
+					spin_unlock(&dcache_lock);
+					return 0;
+				}
+				if (!j)
+					break;
+				j--;
+				list = list->next;
+			}
+
+			while(1) {
+				struct dentry *de = list_entry(list, struct dentry, d_child);
+
+				if (!d_unhashed(de) && de->d_inode) {
+					spin_unlock(&dcache_lock);
+					if (filldir(dirent, de->d_name.name, de->d_name.len, filp->f_pos, de->d_inode->i_ino, DT_UNKNOWN) < 0)
+						break;
+					spin_lock(&dcache_lock);
+				}
+				filp->f_pos++;
+				list = list->next;
+				if (list != &dentry->d_subdirs)
+					continue;
+				spin_unlock(&dcache_lock);
+				break;
+			}
+		}
+	}
+	return 0;
+}
+
+static int autofs4_dir_open(struct inode *inode, struct file *file)
+{
+	struct dentry *dentry = file->f_dentry;
+	struct vfsmount *mnt = file->f_vfsmnt;
+	struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+	int status;
+
+	DPRINTK("file=%p dentry=%p %.*s",
+		file, dentry, dentry->d_name.len, dentry->d_name.name);
+
+	if (autofs4_oz_mode(sbi))
+		goto out;
+
+	if (autofs4_ispending(dentry)) {
+		DPRINTK("dentry busy");
+		return -EBUSY;
+	}
+
+	if (!d_mountpoint(dentry) && dentry->d_op && dentry->d_op->d_revalidate) {
+		struct nameidata nd;
+		int empty;
+
+		/* In case there are stale directory dentrys from a failed mount */
+		spin_lock(&dcache_lock);
+		empty = list_empty(&dentry->d_subdirs);
+		spin_unlock(&dcache_lock);
+
+		if (!empty)
+			d_invalidate(dentry);
+
+		nd.flags = LOOKUP_DIRECTORY;
+		status = (dentry->d_op->d_revalidate)(dentry, &nd);
+
+		if (!status)
+			return -ENOENT;
+	}
+
+	if (d_mountpoint(dentry)) {
+		struct file *fp = NULL;
+		struct vfsmount *fp_mnt = mntget(mnt);
+		struct dentry *fp_dentry = dget(dentry);
+
+		while (follow_down(&fp_mnt, &fp_dentry) && d_mountpoint(fp_dentry));
+
+		fp = dentry_open(fp_dentry, fp_mnt, file->f_flags);
+		status = PTR_ERR(fp);
+		if (IS_ERR(fp)) {
+			file->private_data = NULL;
+			return status;
+		}
+		file->private_data = fp;
+	}
+out:
+	return 0;
+}
+
+static int autofs4_dir_close(struct inode *inode, struct file *file)
+{
+	struct dentry *dentry = file->f_dentry;
+	struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+
+	DPRINTK("file=%p dentry=%p %.*s",
+		file, dentry, dentry->d_name.len, dentry->d_name.name);
+
+	if (autofs4_oz_mode(sbi))
+		goto out;
+
+	if (autofs4_ispending(dentry)) {
+		DPRINTK("dentry busy");
+		return -EBUSY;
+	}
+
+	if (d_mountpoint(dentry)) {
+		struct file *fp = file->private_data;
+
+		if (!fp)
+			return -ENOENT;
+
+		filp_close(fp, current->files);
+		file->private_data = NULL;
+	}
+out:
+	return 0;
+}
+
+static int autofs4_dir_readdir(struct file *file, void *dirent, filldir_t filldir)
+{
+	struct dentry *dentry = file->f_dentry;
+	struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
+	int status;
+
+	DPRINTK("file=%p dentry=%p %.*s",
+		file, dentry, dentry->d_name.len, dentry->d_name.name);
+
+	if (autofs4_oz_mode(sbi))
+		goto out;
+
+	if (autofs4_ispending(dentry)) {
+		DPRINTK("dentry busy");
+		return -EBUSY;
+	}
+
+	if (d_mountpoint(dentry)) {
+		struct file *fp = file->private_data;
+
+		if (!fp)
+			return -ENOENT;
+
+		if (!fp->f_op || !fp->f_op->readdir)
+			goto out;
+
+		status = vfs_readdir(fp, filldir, dirent);
+		file->f_pos = fp->f_pos;
+		if (status)
+			autofs4_copy_atime(file, fp);
+		return status;
+	}
+out:
+	return autofs4_dcache_readdir(file, dirent, filldir);
 }
 
 static int try_to_fill_dentry(struct dentry *dentry, 
 			      struct super_block *sb,
-			      struct autofs_sb_info *sbi)
+			      struct autofs_sb_info *sbi, int flags)
 {
 	struct autofs_info *de_info = autofs4_dentry_ino(dentry);
 	int status = 0;
@@ -78,28 +296,27 @@
            when expiration is done to trigger mount request with a new
            dentry */
 	if (de_info && (de_info->flags & AUTOFS_INF_EXPIRING)) {
-		DPRINTK(("try_to_fill_entry: waiting for expire %p name=%.*s, flags&PENDING=%s de_info=%p de_info->flags=%x\n",
-			 dentry, dentry->d_name.len, dentry->d_name.name, 
-			 dentry->d_flags & DCACHE_AUTOFS_PENDING?"t":"f",
-			 de_info, de_info?de_info->flags:0));
-		status = autofs4_wait(sbi, &dentry->d_name, NFY_NONE);
+		DPRINTK("waiting for expire %p name=%.*s",
+			 dentry, dentry->d_name.len, dentry->d_name.name);
+
+		status = autofs4_wait(sbi, dentry, NFY_NONE);
 		
-		DPRINTK(("try_to_fill_entry: expire done status=%d\n", status));
+		DPRINTK("expire done status=%d", status);
 		
 		return 0;
 	}
 
-	DPRINTK(("try_to_fill_entry: dentry=%p %.*s ino=%p\n", 
-		 dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode));
+	DPRINTK("dentry=%p %.*s ino=%p",
+		 dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_inode);
 
 	/* Wait for a pending mount, triggering one if there isn't one already */
-	while(dentry->d_inode == NULL) {
-		DPRINTK(("try_to_fill_entry: waiting for mount name=%.*s, de_info=%p de_info->flags=%x\n",
-			 dentry->d_name.len, dentry->d_name.name, 
-			 de_info, de_info?de_info->flags:0));
-		status = autofs4_wait(sbi, &dentry->d_name, NFY_MOUNT);
+	if (dentry->d_inode == NULL) {
+		DPRINTK("waiting for mount name=%.*s",
+			 dentry->d_name.len, dentry->d_name.name);
+
+		status = autofs4_wait(sbi, dentry, NFY_MOUNT);
 		 
-		DPRINTK(("try_to_fill_entry: mount done status=%d\n", status));
+		DPRINTK("mount done status=%d", status);
 
 		if (status && dentry->d_inode)
 			return 0; /* Try to get the kernel to invalidate this dentry */
@@ -107,54 +324,65 @@
 		/* Turn this into a real negative dentry? */
 		if (status == -ENOENT) {
 			dentry->d_time = jiffies + AUTOFS_NEGATIVE_TIMEOUT;
+			spin_lock(&dentry->d_lock);
 			dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
+			spin_unlock(&dentry->d_lock);
 			return 1;
 		} else if (status) {
 			/* Return a negative dentry, but leave it "pending" */
 			return 1;
 		}
-	}
+	/* Trigger mount for path component or follow link */
+	} else if (flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY) ||
+			current->link_count) {
+		DPRINTK("waiting for mount name=%.*s",
+			dentry->d_name.len, dentry->d_name.name);
 
-	/* If this is an unused directory that isn't a mount point,
-	   bitch at the daemon and fix it in user space */
-	spin_lock(&dcache_lock);
-	if (S_ISDIR(dentry->d_inode->i_mode) &&
-	    !d_mountpoint(dentry) && 
-	    list_empty(&dentry->d_subdirs)) {
-		DPRINTK(("try_to_fill_entry: mounting existing dir\n"));
-		spin_unlock(&dcache_lock);
-		return autofs4_wait(sbi, &dentry->d_name, NFY_MOUNT) == 0;
+		spin_lock(&dentry->d_lock);
+		dentry->d_flags |= DCACHE_AUTOFS_PENDING;
+		spin_unlock(&dentry->d_lock);
+		status = autofs4_wait(sbi, dentry, NFY_MOUNT);
+
+		DPRINTK("mount done status=%d", status);
+
+		if (status) {
+			spin_lock(&dentry->d_lock);
+			dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
+			spin_unlock(&dentry->d_lock);
+			return 0;
+		}
 	}
-	spin_unlock(&dcache_lock);
 
 	/* We don't update the usages for the autofs daemon itself, this
 	   is necessary for recursive autofs mounts */
 	if (!autofs4_oz_mode(sbi))
 		autofs4_update_usage(dentry);
 
+	spin_lock(&dentry->d_lock);
 	dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
+	spin_unlock(&dentry->d_lock);
 	return 1;
 }
 
-
 /*
  * Revalidate is called on every cache lookup.  Some of those
  * cache lookups may actually happen while the dentry is not
  * yet completely filled in, and revalidate has to delay such
  * lookups..
  */
-static int autofs4_root_revalidate(struct dentry * dentry, struct nameidata *nd)
+static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd)
 {
 	struct inode * dir = dentry->d_parent->d_inode;
 	struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
 	int oz_mode = autofs4_oz_mode(sbi);
+	int flags = nd ? nd->flags : 0;
+	int status = 1;
 
 	/* Pending dentry */
 	if (autofs4_ispending(dentry)) {
-		if (autofs4_oz_mode(sbi))
-			return 1;
-		else
-			return try_to_fill_dentry(dentry, dir->i_sb, sbi);
+		if (!oz_mode)
+			status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags);
+		return status;
 	}
 
 	/* Negative dentry.. invalidate if "old" */
@@ -166,13 +394,12 @@
 	if (S_ISDIR(dentry->d_inode->i_mode) &&
 	    !d_mountpoint(dentry) && 
 	    list_empty(&dentry->d_subdirs)) {
-		DPRINTK(("autofs_root_revalidate: dentry=%p %.*s, emptydir\n",
-			 dentry, dentry->d_name.len, dentry->d_name.name));
+		DPRINTK("dentry=%p %.*s, emptydir",
+			 dentry, dentry->d_name.len, dentry->d_name.name);
 		spin_unlock(&dcache_lock);
-		if (oz_mode)
-			return 1;
-		else
-			return try_to_fill_dentry(dentry, dir->i_sb, sbi);
+		if (!oz_mode)
+			status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags);
+		return status;
 	}
 	spin_unlock(&dcache_lock);
 
@@ -183,21 +410,11 @@
 	return 1;
 }
 
-static int autofs4_revalidate(struct dentry *dentry, struct nameidata *nd)
-{
-	struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
-
-	if (!autofs4_oz_mode(sbi))
-		autofs4_update_usage(dentry);
-
-	return 1;
-}
-
 static void autofs4_dentry_release(struct dentry *de)
 {
 	struct autofs_info *inf;
 
-	DPRINTK(("autofs4_dentry_release: releasing %p\n", de));
+	DPRINTK("releasing %p", de);
 
 	inf = autofs4_dentry_ino(de);
 	de->d_fsdata = NULL;
@@ -212,7 +429,7 @@
 
 /* For dentries of directories in the root dir */
 static struct dentry_operations autofs4_root_dentry_operations = {
-	.d_revalidate	= autofs4_root_revalidate,
+	.d_revalidate	= autofs4_revalidate,
 	.d_release	= autofs4_dentry_release,
 };
 
@@ -224,13 +441,12 @@
 
 /* Lookups in non-root dirs never find anything - if it's there, it's
    already in the dcache */
-/* SMP-safe */
 static struct dentry *autofs4_dir_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
 {
 #if 0
-	DPRINTK(("autofs_dir_lookup: ignoring lookup of %.*s/%.*s\n",
+	DPRINTK("ignoring lookup of %.*s/%.*s",
 		 dentry->d_parent->d_name.len, dentry->d_parent->d_name.name,
-		 dentry->d_name.len, dentry->d_name.name));
+		 dentry->d_name.len, dentry->d_name.name);
 #endif
 
 	dentry->d_fsdata = NULL;
@@ -244,18 +460,17 @@
 	struct autofs_sb_info *sbi;
 	int oz_mode;
 
-	DPRINTK(("autofs_root_lookup: name = %.*s\n", 
-		 dentry->d_name.len, dentry->d_name.name));
+	DPRINTK("name = %.*s",
+		dentry->d_name.len, dentry->d_name.name);
 
 	if (dentry->d_name.len > NAME_MAX)
 		return ERR_PTR(-ENAMETOOLONG);/* File name too long to exist */
 
 	sbi = autofs4_sbi(dir->i_sb);
 
-	lock_kernel();
 	oz_mode = autofs4_oz_mode(sbi);
-	DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n",
-		 current->pid, process_group(current), sbi->catatonic, oz_mode));
+	DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
+		 current->pid, process_group(current), sbi->catatonic, oz_mode);
 
 	/*
 	 * Mark the dentry incomplete, but add it. This is needed so
@@ -269,8 +484,11 @@
 	 */
 	dentry->d_op = &autofs4_root_dentry_operations;
 
-	if (!oz_mode)
+	if (!oz_mode) {
+		spin_lock(&dentry->d_lock);
 		dentry->d_flags |= DCACHE_AUTOFS_PENDING;
+		spin_unlock(&dentry->d_lock);
+	}
 	dentry->d_fsdata = NULL;
 	d_add(dentry, NULL);
 
@@ -285,12 +503,16 @@
 	 * a signal. If so we can force a restart..
 	 */
 	if (dentry->d_flags & DCACHE_AUTOFS_PENDING) {
+		/* See if we were interrupted */
 		if (signal_pending(current)) {
-			unlock_kernel();
-			return ERR_PTR(-ERESTARTNOINTR);
+			sigset_t *sigset = &current->pending.signal;
+			if (sigismember (sigset, SIGKILL) ||
+			    sigismember (sigset, SIGQUIT) ||
+			    sigismember (sigset, SIGINT)) {
+			    return ERR_PTR(-ERESTARTNOINTR);
+			}
 		}
 	}
-	unlock_kernel();
 
 	/*
 	 * If this dentry is unhashed, then we shouldn't honour this
@@ -313,27 +535,21 @@
 	struct inode *inode;
 	char *cp;
 
-	DPRINTK(("autofs_dir_symlink: %s <- %.*s\n", symname, 
-		 dentry->d_name.len, dentry->d_name.name));
+	DPRINTK("%s <- %.*s", symname,
+		dentry->d_name.len, dentry->d_name.name);
 
-	lock_kernel();
-	if (!autofs4_oz_mode(sbi)) {
-		unlock_kernel();
+	if (!autofs4_oz_mode(sbi))
 		return -EACCES;
-	}
 
 	ino = autofs4_init_ino(ino, sbi, S_IFLNK | 0555);
-	if (ino == NULL) {
-		unlock_kernel();
+	if (ino == NULL)
 		return -ENOSPC;
-	}
 
 	ino->size = strlen(symname);
 	ino->u.symlink = cp = kmalloc(ino->size + 1, GFP_KERNEL);
 
 	if (cp == NULL) {
 		kfree(ino);
-		unlock_kernel();
 		return -ENOSPC;
 	}
 
@@ -353,7 +569,6 @@
 
 	dir->i_mtime = CURRENT_TIME;
 
-	unlock_kernel();
 	return 0;
 }
 
@@ -370,7 +585,7 @@
  * If a process is blocked on the dentry waiting for the expire to finish,
  * it will invalidate the dentry and try to mount with a new one.
  *
- * Also see autofs_dir_rmdir().. 
+ * Also see autofs4_dir_rmdir()..
  */
 static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
 {
@@ -378,11 +593,8 @@
 	struct autofs_info *ino = autofs4_dentry_ino(dentry);
 	
 	/* This allows root to remove symlinks */
-	lock_kernel();
-	if ( !autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) ) {
-		unlock_kernel();
+	if ( !autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN) )
 		return -EACCES;
-	}
 
 	dput(ino->dentry);
 
@@ -393,8 +605,6 @@
 
 	d_drop(dentry);
 
-	unlock_kernel();
-	
 	return 0;
 }
 
@@ -403,16 +613,12 @@
 	struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
 	struct autofs_info *ino = autofs4_dentry_ino(dentry);
 	
-	lock_kernel();
-	if (!autofs4_oz_mode(sbi)) {
-		unlock_kernel();
+	if (!autofs4_oz_mode(sbi))
 		return -EACCES;
-	}
 
 	spin_lock(&dcache_lock);
 	if (!list_empty(&dentry->d_subdirs)) {
 		spin_unlock(&dcache_lock);
-		unlock_kernel();
 		return -ENOTEMPTY;
 	}
 	__d_drop(dentry);
@@ -426,32 +632,24 @@
 	if (dir->i_nlink)
 		dir->i_nlink--;
 
-	unlock_kernel();
 	return 0;
 }
 
-
-
 static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
 	struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb);
 	struct autofs_info *ino = autofs4_dentry_ino(dentry);
 	struct inode *inode;
 
-	lock_kernel();
-	if ( !autofs4_oz_mode(sbi) ) {
-		unlock_kernel();
+	if ( !autofs4_oz_mode(sbi) )
 		return -EACCES;
-	}
 
-	DPRINTK(("autofs_dir_mkdir: dentry %p, creating %.*s\n",
-		 dentry, dentry->d_name.len, dentry->d_name.name));
+	DPRINTK("dentry %p, creating %.*s",
+		dentry, dentry->d_name.len, dentry->d_name.name);
 
 	ino = autofs4_init_ino(ino, sbi, S_IFDIR | 0555);
-	if (ino == NULL) {
-		unlock_kernel();
+	if (ino == NULL)
 		return -ENOSPC;
-	}
 
 	inode = autofs4_get_inode(dir->i_sb, ino);
 	d_instantiate(dentry, inode);
@@ -467,13 +665,12 @@
 	dir->i_nlink++;
 	dir->i_mtime = CURRENT_TIME;
 
-	unlock_kernel();
 	return 0;
 }
 
 /* Get/set timeout ioctl() operation */
 static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
-					 unsigned long *p)
+					 unsigned long __user *p)
 {
 	int rv;
 	unsigned long ntimeout;
@@ -491,12 +688,73 @@
 }
 
 /* Return protocol version */
-static inline int autofs4_get_protover(struct autofs_sb_info *sbi, int *p)
+static inline int autofs4_get_protover(struct autofs_sb_info *sbi, int __user *p)
 {
 	return put_user(sbi->version, p);
 }
 
-/* Identify autofs_dentries - this is so we can tell if there's
+/* Return protocol sub version */
+static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, int __user *p)
+{
+	return put_user(sbi->sub_version, p);
+}
+
+/*
+ * Tells the daemon whether we need to reghost or not. Also, clears
+ * the reghost_needed flag.
+ */
+static inline int autofs4_ask_reghost(struct autofs_sb_info *sbi, int __user *p)
+{
+	int status;
+
+	DPRINTK("returning %d", sbi->needs_reghost);
+
+	status = put_user(sbi->needs_reghost, p);
+	if ( status )
+		return status;
+
+	sbi->needs_reghost = 0;
+	return 0;
+}
+
+/*
+ * Enable / Disable reghosting ioctl() operation
+ */
+static inline int autofs4_toggle_reghost(struct autofs_sb_info *sbi, int __user *p)
+{
+	int status;
+	int val;
+
+	status = get_user(val, p);
+
+	DPRINTK("reghost = %d", val);
+
+	if (status)
+		return status;
+
+	/* turn on/off reghosting, with the val */
+	sbi->reghost_enabled = val;
+	return 0;
+}
+
+/*
+* Tells the daemon whether it can umount the autofs mount.
+*/
+static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p)
+{
+	int status = 0;
+
+	if (may_umount(mnt) == 0)
+		status = 1;
+
+	DPRINTK("returning %d", status);
+
+	status = put_user(status, p);
+
+	return status;
+}
+
+/* Identify autofs4_dentries - this is so we can tell if there's
    an extra dentry refcount or not.  We only hold a refcount on the
    dentry if its non-negative (ie, d_inode != NULL)
 */
@@ -516,9 +774,10 @@
 			     unsigned int cmd, unsigned long arg)
 {
 	struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb);
+	void __user *p = (void __user *)arg;
 
-	DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",
-		 cmd,arg,sbi,process_group(current)));
+	DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
+		cmd,arg,sbi,process_group(current));
 
 	if ( _IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
 	     _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT )
@@ -536,18 +795,26 @@
 		autofs4_catatonic_mode(sbi);
 		return 0;
 	case AUTOFS_IOC_PROTOVER: /* Get protocol version */
-		return autofs4_get_protover(sbi, (int *)arg);
+		return autofs4_get_protover(sbi, p);
+	case AUTOFS_IOC_PROTOSUBVER: /* Get protocol sub version */
+		return autofs4_get_protosubver(sbi, p);
 	case AUTOFS_IOC_SETTIMEOUT:
-		return autofs4_get_set_timeout(sbi,(unsigned long *)arg);
+		return autofs4_get_set_timeout(sbi, p);
+
+	case AUTOFS_IOC_TOGGLEREGHOST:
+		return autofs4_toggle_reghost(sbi, p);
+	case AUTOFS_IOC_ASKREGHOST:
+		return autofs4_ask_reghost(sbi, p);
+
+	case AUTOFS_IOC_ASKUMOUNT:
+		return autofs4_ask_umount(filp->f_vfsmnt, p);
 
 	/* return a single thing to expire */
 	case AUTOFS_IOC_EXPIRE:
-		return autofs4_expire_run(inode->i_sb,filp->f_vfsmnt,sbi,
-					  (struct autofs_packet_expire *)arg);
+		return autofs4_expire_run(inode->i_sb,filp->f_vfsmnt,sbi, p);
 	/* same as above, but can send multiple expires through pipe */
 	case AUTOFS_IOC_EXPIRE_MULTI:
-		return autofs4_expire_multi(inode->i_sb,filp->f_vfsmnt,sbi,
-					    (int *)arg);
+		return autofs4_expire_multi(inode->i_sb,filp->f_vfsmnt,sbi, p);
 
 	default:
 		return -ENOSYS;
diff -Nru a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
--- a/fs/autofs4/waitq.c	Tue Jun 15 22:21:03 2004
+++ b/fs/autofs4/waitq.c	Tue Jun 15 22:21:03 2004
@@ -3,6 +3,7 @@
  * linux/fs/autofs/waitq.c
  *
  *  Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved
+ *  Copyright 2001-2003 Ian Kent <raven@themaw.net>
  *
  * This file is part of the Linux kernel and is made available under
  * the terms of the GNU General Public License, version 2, or at your
@@ -27,7 +28,7 @@
 {
 	struct autofs_wait_queue *wq, *nwq;
 
-	DPRINTK(("autofs: entering catatonic mode\n"));
+	DPRINTK("entering catatonic mode");
 
 	sbi->catatonic = 1;
 	wq = sbi->queues;
@@ -37,7 +38,7 @@
 		wq->status = -ENOENT; /* Magic is gone - report failure */
 		kfree(wq->name);
 		wq->name = NULL;
-		wake_up(&wq->queue);
+		wake_up_interruptible(&wq->queue);
 		wq = nwq;
 	}
 	if (sbi->pipe) {
@@ -90,8 +91,8 @@
 	union autofs_packet_union pkt;
 	size_t pktsz;
 
-	DPRINTK(("autofs_notify: wait id = 0x%08lx, name = %.*s, type=%d\n",
-		 wq->wait_queue_token, wq->len, wq->name, type));
+	DPRINTK("wait id = 0x%08lx, name = %.*s, type=%d",
+		wq->wait_queue_token, wq->len, wq->name, type);
 
 	memset(&pkt,0,sizeof pkt); /* For security reasons */
 
@@ -116,7 +117,7 @@
 		memcpy(ep->name, wq->name, wq->len);
 		ep->name[wq->len] = '\0';
 	} else {
-		printk("autofs_notify_daemon: bad type %d!\n", type);
+		printk("autofs4_notify_daemon: bad type %d!\n", type);
 		return;
 	}
 
@@ -124,62 +125,107 @@
 		autofs4_catatonic_mode(sbi);
 }
 
-int autofs4_wait(struct autofs_sb_info *sbi, struct qstr *name,
+static int autofs4_getpath(struct autofs_sb_info *sbi,
+			   struct dentry *dentry, char **name)
+{
+	struct dentry *root = sbi->sb->s_root;
+	struct dentry *tmp;
+	char *buf = *name;
+	char *p;
+	int len = 0;
+
+	spin_lock(&dcache_lock);
+	for (tmp = dentry ; tmp != root ; tmp = tmp->d_parent)
+		len += tmp->d_name.len + 1;
+
+	if (--len > NAME_MAX) {
+		spin_unlock(&dcache_lock);
+		return 0;
+	}
+
+	*(buf + len) = '\0';
+	p = buf + len - dentry->d_name.len;
+	strncpy(p, dentry->d_name.name, dentry->d_name.len);
+
+	for (tmp = dentry->d_parent; tmp != root ; tmp = tmp->d_parent) {
+		*(--p) = '/';
+		p -= tmp->d_name.len;
+		strncpy(p, tmp->d_name.name, tmp->d_name.len);
+	}
+	spin_unlock(&dcache_lock);
+
+	return len;
+}
+
+int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
 		enum autofs_notify notify)
 {
 	struct autofs_wait_queue *wq;
-	int status;
+	char *name;
+	int len, status;
 
 	/* In catatonic mode, we don't wait for nobody */
 	if ( sbi->catatonic )
 		return -ENOENT;
 	
-	/* We shouldn't be able to get here, but just in case */
-	if ( name->len > NAME_MAX )
+	name = kmalloc(NAME_MAX + 1, GFP_KERNEL);
+	if (!name)
+		return -ENOMEM;
+
+	len = autofs4_getpath(sbi, dentry, &name);
+	if (!len) {
+		kfree(name);
 		return -ENOENT;
+	}
 
-	for ( wq = sbi->queues ; wq ; wq = wq->next ) {
-		if ( wq->hash == name->hash &&
-		     wq->len == name->len &&
-		     wq->name && !memcmp(wq->name,name->name,name->len) )
+	if (down_interruptible(&sbi->wq_sem)) {
+		kfree(name);
+		return -EINTR;
+	}
+
+	for (wq = sbi->queues ; wq ; wq = wq->next) {
+		if (wq->hash == dentry->d_name.hash &&
+		    wq->len == len &&
+		    wq->name && !memcmp(wq->name, name, len))
 			break;
 	}
-	
+
 	if ( !wq ) {
 		/* Create a new wait queue */
 		wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);
-		if ( !wq )
-			return -ENOMEM;
-
-		wq->name = kmalloc(name->len,GFP_KERNEL);
-		if ( !wq->name ) {
-			kfree(wq);
+		if ( !wq ) {
+			kfree(name);
+			up(&sbi->wq_sem);
 			return -ENOMEM;
 		}
+
 		wq->wait_queue_token = autofs4_next_wait_queue;
 		if (++autofs4_next_wait_queue == 0)
 			autofs4_next_wait_queue = 1;
-		init_waitqueue_head(&wq->queue);
-		wq->hash = name->hash;
-		wq->len = name->len;
-		wq->status = -EINTR; /* Status return if interrupted */
-		memcpy(wq->name, name->name, name->len);
 		wq->next = sbi->queues;
 		sbi->queues = wq;
+		init_waitqueue_head(&wq->queue);
+		wq->hash = dentry->d_name.hash;
+		wq->name = name;
+		wq->len = len;
+		wq->status = -EINTR; /* Status return if interrupted */
+		atomic_set(&wq->wait_ctr, 2);
+		up(&sbi->wq_sem);
 
-		DPRINTK(("autofs_wait: new wait id = 0x%08lx, name = %.*s, nfy=%d\n",
-			 wq->wait_queue_token, wq->len, wq->name, notify));
+		DPRINTK("new wait id = 0x%08lx, name = %.*s, nfy=%d",
+			(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
 		/* autofs4_notify_daemon() may block */
-		wq->wait_ctr = 2;
 		if (notify != NFY_NONE) {
 			autofs4_notify_daemon(sbi,wq, 
-					      notify == NFY_MOUNT ? autofs_ptype_missing :
-								    autofs_ptype_expire_multi);
+					notify == NFY_MOUNT ?
+						  autofs_ptype_missing :
+						  autofs_ptype_expire_multi);
 		}
 	} else {
-		wq->wait_ctr++;
-		DPRINTK(("autofs_wait: existing wait id = 0x%08lx, name = %.*s, nfy=%d\n",
-			 wq->wait_queue_token, wq->len, wq->name, notify));
+		atomic_inc(&wq->wait_ctr);
+		up(&sbi->wq_sem);
+		DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
+			(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
 	}
 
 	/* wq->name is NULL if and only if the lock is already released */
@@ -204,19 +250,20 @@
 		recalc_sigpending();
 		spin_unlock_irqrestore(&current->sighand->siglock, irqflags);
 
-		interruptible_sleep_on(&wq->queue);
+		wait_event_interruptible(wq->queue, wq->name == NULL);
 
 		spin_lock_irqsave(&current->sighand->siglock, irqflags);
 		current->blocked = oldset;
 		recalc_sigpending();
 		spin_unlock_irqrestore(&current->sighand->siglock, irqflags);
 	} else {
-		DPRINTK(("autofs_wait: skipped sleeping\n"));
+		DPRINTK("skipped sleeping");
 	}
 
 	status = wq->status;
 
-	if (--wq->wait_ctr == 0)	/* Are we the last process to need status? */
+	/* Are we the last process to need status? */
+	if (atomic_dec_and_test(&wq->wait_ctr))
 		kfree(wq);
 
 	return status;
@@ -227,23 +274,28 @@
 {
 	struct autofs_wait_queue *wq, **wql;
 
+	down(&sbi->wq_sem);
 	for ( wql = &sbi->queues ; (wq = *wql) ; wql = &wq->next ) {
 		if ( wq->wait_queue_token == wait_queue_token )
 			break;
 	}
-	if ( !wq )
+
+	if ( !wq ) {
+		up(&sbi->wq_sem);
 		return -EINVAL;
+	}
 
 	*wql = wq->next;	/* Unlink from chain */
+	up(&sbi->wq_sem);
 	kfree(wq->name);
 	wq->name = NULL;	/* Do not wait on this queue */
 
 	wq->status = status;
 
-	if (--wq->wait_ctr == 0)	/* Is anyone still waiting for this guy? */
+	if (atomic_dec_and_test(&wq->wait_ctr))	/* Is anyone still waiting for this guy? */
 		kfree(wq);
 	else
-		wake_up(&wq->queue);
+		wake_up_interruptible(&wq->queue);
 
 	return 0;
 }
diff -Nru a/fs/befs/befs.h b/fs/befs/befs.h
--- a/fs/befs/befs.h	Tue Jun 15 22:20:44 2004
+++ b/fs/befs/befs.h	Tue Jun 15 22:20:44 2004
@@ -14,10 +14,7 @@
 #define BEFS_VERSION "0.9.3"
 
 
-/* Sector_t makes this sillyness obsolete */
 typedef u64 befs_blocknr_t;
-typedef u32 vfs_blocknr_t;
-
 /*
  * BeFS in memory structures
  */
diff -Nru a/fs/befs/btree.c b/fs/befs/btree.c
--- a/fs/befs/btree.c	Tue Jun 15 22:20:36 2004
+++ b/fs/befs/btree.c	Tue Jun 15 22:20:36 2004
@@ -372,12 +372,12 @@
 		thiskey = befs_bt_get_key(sb, node, mid, &keylen);
 		eq = befs_compare_strings(thiskey, keylen, findkey,
 					  findkey_len);
-		*value = fs64_to_cpu(sb, valarray[mid]);
 
 		if (eq == 0) {
 			befs_debug(sb, "<--- befs_find_key() found %s at %d",
 				   thiskey, mid);
 
+			*value = fs64_to_cpu(sb, valarray[mid]);
 			return BEFS_BT_MATCH;
 		}
 		if (eq > 0)
@@ -387,6 +387,8 @@
 	}
 	if (eq < 0)
 		*value = fs64_to_cpu(sb, valarray[mid + 1]);
+	else
+		*value = fs64_to_cpu(sb, valarray[mid]);
 	befs_debug(sb, "<--- befs_find_key() found %s at %d", thiskey, mid);
 	return BEFS_BT_PARMATCH;
 }
diff -Nru a/fs/befs/debug.c b/fs/befs/debug.c
--- a/fs/befs/debug.c	Tue Jun 15 22:21:05 2004
+++ b/fs/befs/debug.c	Tue Jun 15 22:21:05 2004
@@ -29,22 +29,29 @@
 befs_error(const struct super_block *sb, const char *fmt, ...)
 {
 	va_list args;
-	char err_buf[ERRBUFSIZE];
+	char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
+	if (err_buf == NULL) {
+		printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE);
+		return;
+	}
 
 	va_start(args, fmt);
 	vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
 	va_end(args);
 
 	printk(KERN_ERR "BeFS(%s): %s\n", sb->s_id, err_buf);
-
-	befs_debug(sb, err_buf);
+	kfree(err_buf);
 }
 
 void
 befs_warning(const struct super_block *sb, const char *fmt, ...)
 {
 	va_list args;
-	char err_buf[ERRBUFSIZE];
+	char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
+	if (err_buf == NULL) {
+		printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE);
+		return;
+	}
 
 	va_start(args, fmt);
 	vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
@@ -52,7 +59,7 @@
 
 	printk(KERN_WARNING "BeFS(%s): %s\n", sb->s_id, err_buf);
 
-	befs_debug(sb, err_buf);
+	kfree(err_buf);
 }
 
 void
@@ -61,15 +68,25 @@
 #ifdef CONFIG_BEFS_DEBUG
 
 	va_list args;
-	char err_buf[ERRBUFSIZE];
+	char *err_buf = NULL;
 
 	if (BEFS_SB(sb)->mount_opts.debug) {
+		err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL);
+		if (err_buf == NULL) {
+			printk(KERN_ERR "could not allocate %d bytes\n",
+				ERRBUFSIZE);
+			return;
+		}
+
 		va_start(args, fmt);
 		vsnprintf(err_buf, ERRBUFSIZE, fmt, args);
 		va_end(args);
 
 		printk(KERN_DEBUG "BeFS(%s): %s\n", sb->s_id, err_buf);
+
+		kfree(err_buf);
 	}
+
 #endif				//CONFIG_BEFS_DEBUG
 }
 
diff -Nru a/fs/befs/io.c b/fs/befs/io.c
--- a/fs/befs/io.c	Tue Jun 15 22:21:02 2004
+++ b/fs/befs/io.c	Tue Jun 15 22:21:02 2004
@@ -28,7 +28,6 @@
 {
 	struct buffer_head *bh = NULL;
 	befs_blocknr_t block = 0;
-	vfs_blocknr_t vfs_block = 0;
 	befs_sb_info *befs_sb = BEFS_SB(sb);
 
 	befs_debug(sb, "---> Enter befs_read_iaddr() "
@@ -42,17 +41,10 @@
 	}
 
 	block = iaddr2blockno(sb, &iaddr);
-	vfs_block = (vfs_blocknr_t) block;
-
-	if (vfs_block != block) {
-		befs_error(sb, "Error converting to host blocknr_t. %Lu "
-			   "is larger than the host can use", block);
-		goto error;
-	}
 
 	befs_debug(sb, "befs_read_iaddr: offset = %lu", block);
 
-	bh = sb_bread(sb, vfs_block);
+	bh = sb_bread(sb, block);
 
 	if (bh == NULL) {
 		befs_error(sb, "Failed to read block %lu", block);
@@ -71,20 +63,13 @@
 befs_bread(struct super_block *sb, befs_blocknr_t block)
 {
 	struct buffer_head *bh = NULL;
-	vfs_blocknr_t vfs_block = (vfs_blocknr_t) block;
 
 	befs_debug(sb, "---> Enter befs_read() %Lu", block);
 
-	if (vfs_block != block) {
-		befs_error(sb, "Error converting to host blocknr_t. %Lu "
-			   "is larger than the host can use", block);
-		goto error;
-	}
-
-	bh = sb_bread(sb, vfs_block);
+	bh = sb_bread(sb, block);
 
 	if (bh == NULL) {
-		befs_error(sb, "Failed to read block %lu", vfs_block);
+		befs_error(sb, "Failed to read block %lu", block);
 		goto error;
 	}
 
diff -Nru a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
--- a/fs/befs/linuxvfs.c	Tue Jun 15 22:20:39 2004
+++ b/fs/befs/linuxvfs.c	Tue Jun 15 22:20:39 2004
@@ -325,7 +325,7 @@
 		   befs_ino->i_inode_num.allocation_group,
 		   befs_ino->i_inode_num.start, befs_ino->i_inode_num.len);
 
-	bh = befs_bread_iaddr(sb, befs_ino->i_inode_num);
+	bh = befs_bread(sb, inode->i_ino);
 	if (!bh) {
 		befs_error(sb, "unable to read inode block - "
 			   "inode = %lu", inode->i_ino);
@@ -376,7 +376,7 @@
 	befs_ino->i_attribute = fsrun_to_cpu(sb, raw_inode->attributes);
 	befs_ino->i_flags = fs32_to_cpu(sb, raw_inode->flags);
 
-	if (S_ISLNK(inode->i_mode) && !(inode->i_flags & BEFS_LONG_SYMLINK)) {
+	if (S_ISLNK(inode->i_mode) && !(befs_ino->i_flags & BEFS_LONG_SYMLINK)){
 		inode->i_size = 0;
 		inode->i_blocks = befs_sb->block_size / VFS_BLOCK_SIZE;
 		strncpy(befs_ino->i_data.symlink, raw_inode->data.symlink,
@@ -571,7 +571,7 @@
 		}
 
 		/* convert from Unicode to nls */
-		unilen = nls->uni2char(uni, &result[o], 1);
+		unilen = nls->uni2char(uni, &result[o], in_len - o);
 		if (unilen < 0) {
 			goto conv_err;
 		}
@@ -584,7 +584,7 @@
 	return o;
 
       conv_err:
-	befs_error(sb, "Name using charecter set %s contains a charecter that "
+	befs_error(sb, "Name using character set %s contains a character that "
 		   "cannot be converted to unicode.", nls->charset);
 	befs_debug(sb, "<--- utf2nls()");
 	kfree(result);
@@ -855,6 +855,13 @@
 
 	if (befs_check_sb(sb) != BEFS_OK)
 		goto unaquire_priv_sbp;
+
+	if( befs_sb->num_blocks > ~((sector_t)0) ) {
+		befs_error(sb, "blocks count: %Lu "
+			"is larger than the host can use",
+			befs_sb->num_blocks);
+		goto unaquire_priv_sbp;
+	}
 
 	/*
 	 * set up enough so that it can read an inode
diff -Nru a/fs/bfs/dir.c b/fs/bfs/dir.c
--- a/fs/bfs/dir.c	Tue Jun 15 22:20:58 2004
+++ b/fs/bfs/dir.c	Tue Jun 15 22:20:58 2004
@@ -274,7 +274,7 @@
 {
 	struct buffer_head * bh;
 	struct bfs_dirent * de;
-	int block, sblock, eblock, off;
+	int block, sblock, eblock, off, eoff;
 	int i;
 
 	dprintf("name=%s, namelen=%d\n", name, namelen);
@@ -286,12 +286,17 @@
 
 	sblock = BFS_I(dir)->i_sblock;
 	eblock = BFS_I(dir)->i_eblock;
+	eoff = dir->i_size % BFS_BSIZE;
 	for (block=sblock; block<=eblock; block++) {
 		bh = sb_bread(dir->i_sb, block);
 		if(!bh) 
 			return -ENOSPC;
 		for (off=0; off<BFS_BSIZE; off+=BFS_DIRENT_SIZE) {
 			de = (struct bfs_dirent *)(bh->b_data + off);
+			if (block==eblock && off>=eoff) {
+				/* Do not read/interpret the garbage in the end of eblock. */
+				de->ino = 0;
+			}
 			if (!de->ino) {
 				if ((block-sblock)*BFS_BSIZE + off >= dir->i_size) {
 					dir->i_size += BFS_DIRENT_SIZE;
diff -Nru a/fs/binfmt_aout.c b/fs/binfmt_aout.c
--- a/fs/binfmt_aout.c	Tue Jun 15 22:20:37 2004
+++ b/fs/binfmt_aout.c	Tue Jun 15 22:20:37 2004
@@ -521,6 +521,6 @@
 	unregister_binfmt(&aout_format);
 }
 
-module_init(init_aout_binfmt);
+core_initcall(init_aout_binfmt);
 module_exit(exit_aout_binfmt);
 MODULE_LICENSE("GPL");
diff -Nru a/fs/binfmt_elf.c b/fs/binfmt_elf.c
--- a/fs/binfmt_elf.c	Tue Jun 15 22:20:40 2004
+++ b/fs/binfmt_elf.c	Tue Jun 15 22:20:40 2004
@@ -110,18 +110,18 @@
 	nbyte = ELF_PAGEOFFSET(elf_bss);
 	if (nbyte) {
 		nbyte = ELF_MIN_ALIGN - nbyte;
-		clear_user((void *) elf_bss, nbyte);
+		clear_user((void __user *) elf_bss, nbyte);
 	}
 }
 
 /* Let's use some macros to make this stack manipulation a litle clearer */
 #ifdef CONFIG_STACK_GROWSUP
-#define STACK_ADD(sp, items) ((elf_addr_t *)(sp) + (items))
+#define STACK_ADD(sp, items) ((elf_addr_t __user *)(sp) + (items))
 #define STACK_ROUND(sp, items) \
 	((15 + (unsigned long) ((sp) + (items))) &~ 15UL)
-#define STACK_ALLOC(sp, len) ({ elf_addr_t *old_sp = (elf_addr_t *)sp; sp += len; old_sp; })
+#define STACK_ALLOC(sp, len) ({ elf_addr_t __user *old_sp = (elf_addr_t __user *)sp; sp += len; old_sp; })
 #else
-#define STACK_ADD(sp, items) ((elf_addr_t *)(sp) - (items))
+#define STACK_ADD(sp, items) ((elf_addr_t __user *)(sp) - (items))
 #define STACK_ROUND(sp, items) \
 	(((unsigned long) (sp - items)) &~ 15UL)
 #define STACK_ALLOC(sp, len) ({ sp -= len ; sp; })
@@ -135,8 +135,10 @@
 	unsigned long p = bprm->p;
 	int argc = bprm->argc;
 	int envc = bprm->envc;
-	elf_addr_t *argv, *envp;
-	elf_addr_t *sp, *u_platform;
+	elf_addr_t __user *argv;
+	elf_addr_t __user *envp;
+	elf_addr_t __user *sp;
+	elf_addr_t __user *u_platform;
 	const char *k_platform = ELF_PLATFORM;
 	int items;
 	elf_addr_t *elf_info;
@@ -169,7 +171,7 @@
 		if (smp_num_siblings > 1)
 			STACK_ALLOC(p, ((current->pid % 64) << 7));
 #endif
-		u_platform = (elf_addr_t *)STACK_ALLOC(p, len);
+		u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
 		__copy_to_user(u_platform, k_platform, len);
 	}
 
@@ -222,10 +224,10 @@
 
 	/* Point sp at the lowest address on the stack */
 #ifdef CONFIG_STACK_GROWSUP
-	sp = (elf_addr_t *)bprm->p - items - ei_index;
+	sp = (elf_addr_t __user *)bprm->p - items - ei_index;
 	bprm->exec = (unsigned long) sp; /* XXX: PARISC HACK */
 #else
-	sp = (elf_addr_t *)bprm->p;
+	sp = (elf_addr_t __user *)bprm->p;
 #endif
 
 	/* Now, let's put argc (and argv, envp if appropriate) on the stack */
@@ -245,7 +247,7 @@
 	while (argc-- > 0) {
 		size_t len;
 		__put_user((elf_addr_t)p, argv++);
-		len = strnlen_user((void *)p, PAGE_SIZE*MAX_ARG_PAGES);
+		len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES);
 		if (!len || len > PAGE_SIZE*MAX_ARG_PAGES)
 			return;
 		p += len;
@@ -255,7 +257,7 @@
 	while (envc-- > 0) {
 		size_t len;
 		__put_user((elf_addr_t)p, envp++);
-		len = strnlen_user((void *)p, PAGE_SIZE*MAX_ARG_PAGES);
+		len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES);
 		if (!len || len > PAGE_SIZE*MAX_ARG_PAGES)
 			return;
 		p += len;
@@ -264,7 +266,7 @@
 	current->mm->env_end = p;
 
 	/* Put the elf_info on the stack in the right place.  */
-	sp = (elf_addr_t *)envp + 1;
+	sp = (elf_addr_t __user *)envp + 1;
 	copy_to_user(sp, elf_info, ei_index * sizeof(elf_addr_t));
 }
 
@@ -418,7 +420,7 @@
 			     struct file * interpreter)
 {
 	unsigned long text_data, elf_entry = ~0UL;
-	char * addr;
+	char __user * addr;
 	loff_t offset;
 
 	current->mm->end_code = interp_ex->a_text;
@@ -429,12 +431,12 @@
 	switch (N_MAGIC(*interp_ex)) {
 	case OMAGIC:
 		offset = 32;
-		addr = (char *) 0;
+		addr = (char __user *)0;
 		break;
 	case ZMAGIC:
 	case QMAGIC:
 		offset = N_TXTOFF(*interp_ex);
-		addr = (char *) N_TXTADDR(*interp_ex);
+		addr = (char __user *) N_TXTADDR(*interp_ex);
 		break;
 	default:
 		goto out;
@@ -734,7 +736,7 @@
 				nbyte = ELF_MIN_ALIGN - nbyte;
 				if (nbyte > elf_brk - elf_bss)
 					nbyte = elf_brk - elf_bss;
-				clear_user((void *) elf_bss + load_bias, nbyte);
+				clear_user((void __user *) elf_bss + load_bias, nbyte);
 			}
 		}
 
@@ -1184,7 +1186,7 @@
 	if (len >= ELF_PRARGSZ)
 		len = ELF_PRARGSZ-1;
 	copy_from_user(&psinfo->pr_psargs,
-		       (const char *)mm->arg_start, len);
+		       (const char __user *)mm->arg_start, len);
 	for(i = 0; i < len; i++)
 		if (psinfo->pr_psargs[i] == 0)
 			psinfo->pr_psargs[i] = ' ';
@@ -1543,6 +1545,6 @@
 	unregister_binfmt(&elf_format);
 }
 
-module_init(init_elf_binfmt)
-module_exit(exit_elf_binfmt)
+core_initcall(init_elf_binfmt);
+module_exit(exit_elf_binfmt);
 MODULE_LICENSE("GPL");
diff -Nru a/fs/binfmt_em86.c b/fs/binfmt_em86.c
--- a/fs/binfmt_em86.c	Tue Jun 15 22:20:42 2004
+++ b/fs/binfmt_em86.c	Tue Jun 15 22:20:42 2004
@@ -110,6 +110,6 @@
 	unregister_binfmt(&em86_format);
 }
 
-module_init(init_em86_binfmt)
-module_exit(exit_em86_binfmt)
+core_initcall(init_em86_binfmt);
+module_exit(exit_em86_binfmt);
 MODULE_LICENSE("GPL");
diff -Nru a/fs/binfmt_flat.c b/fs/binfmt_flat.c
--- a/fs/binfmt_flat.c	Tue Jun 15 22:20:35 2004
+++ b/fs/binfmt_flat.c	Tue Jun 15 22:20:35 2004
@@ -723,7 +723,7 @@
 				return -ENOEXEC;
 
 			/* Get the pointer's value.  */
-			addr = flat_get_addr_from_rp(rp, relval);
+			addr = flat_get_addr_from_rp(rp, relval, flags);
 			if (addr != 0) {
 				/*
 				 * Do the relocation.  PIC relocs in the data section are
@@ -896,7 +896,7 @@
 
 /****************************************************************************/
 
-module_init(init_flat_binfmt);
+core_initcall(init_flat_binfmt);
 module_exit(exit_flat_binfmt);
 
 /****************************************************************************/
diff -Nru a/fs/binfmt_misc.c b/fs/binfmt_misc.c
--- a/fs/binfmt_misc.c	Tue Jun 15 22:20:39 2004
+++ b/fs/binfmt_misc.c	Tue Jun 15 22:20:39 2004
@@ -196,7 +196,7 @@
  * ':name:type:offset:magic:mask:interpreter:'
  * where the ':' is the IFS, that can be chosen with the first char
  */
-static Node *create_entry(const char *buffer, size_t count)
+static Node *create_entry(const char __user *buffer, size_t count)
 {
 	Node *e;
 	int memsize, err;
@@ -319,7 +319,7 @@
  * Set status of entry/binfmt_misc:
  * '1' enables, '0' disables and '-1' clears entry/binfmt_misc
  */
-static int parse_command(const char *buffer, size_t count)
+static int parse_command(const char __user *buffer, size_t count)
 {
 	char s[4];
 
@@ -424,7 +424,7 @@
 /* /<entry> */
 
 static ssize_t
-bm_entry_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
+bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
 {
 	Node *e = file->f_dentry->d_inode->u.generic_ip;
 	loff_t pos = *ppos;
@@ -456,7 +456,7 @@
 	return res;
 }
 
-static ssize_t bm_entry_write(struct file *file, const char *buffer,
+static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
 				size_t count, loff_t *ppos)
 {
 	struct dentry *root;
@@ -488,7 +488,7 @@
 
 /* /register */
 
-static ssize_t bm_register_write(struct file *file, const char *buffer,
+static ssize_t bm_register_write(struct file *file, const char __user *buffer,
 			       size_t count, loff_t *ppos)
 {
 	Node *e;
@@ -556,7 +556,7 @@
 /* /status */
 
 static ssize_t
-bm_status_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
+bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
 	char *s = enabled ? "enabled" : "disabled";
 	int len = strlen(s);
@@ -574,7 +574,7 @@
 	return nbytes;
 }
 
-static ssize_t bm_status_write(struct file * file, const char * buffer,
+static ssize_t bm_status_write(struct file * file, const char __user * buffer,
 		size_t count, loff_t *ppos)
 {
 	int res = parse_command(buffer, count);
@@ -656,6 +656,6 @@
 	unregister_filesystem(&bm_fs_type);
 }
 
-module_init(init_misc_binfmt);
+core_initcall(init_misc_binfmt);
 module_exit(exit_misc_binfmt);
 MODULE_LICENSE("GPL");
diff -Nru a/fs/binfmt_script.c b/fs/binfmt_script.c
--- a/fs/binfmt_script.c	Tue Jun 15 22:20:37 2004
+++ b/fs/binfmt_script.c	Tue Jun 15 22:20:37 2004
@@ -111,6 +111,6 @@
 	unregister_binfmt(&script_format);
 }
 
-module_init(init_script_binfmt)
-module_exit(exit_script_binfmt)
+core_initcall(init_script_binfmt);
+module_exit(exit_script_binfmt);
 MODULE_LICENSE("GPL");
diff -Nru a/fs/binfmt_som.c b/fs/binfmt_som.c
--- a/fs/binfmt_som.c	Tue Jun 15 22:20:39 2004
+++ b/fs/binfmt_som.c	Tue Jun 15 22:20:39 2004
@@ -305,5 +305,5 @@
 	unregister_binfmt(&som_format);
 }
 
-module_init(init_som_binfmt);
+core_initcall(init_som_binfmt);
 module_exit(exit_som_binfmt);
diff -Nru a/fs/bio.c b/fs/bio.c
--- a/fs/bio.c	Tue Jun 15 22:20:41 2004
+++ b/fs/bio.c	Tue Jun 15 22:20:41 2004
@@ -53,7 +53,7 @@
  * unsigned short
  */
 
-#define BV(x) { .nr_vecs = x, .name = "biovec-" #x }
+#define BV(x) { .nr_vecs = x, .name = "biovec-"__stringify(x) }
 static struct biovec_pool bvec_array[BIOVEC_NR_POOLS] = {
 	BV(1), BV(4), BV(16), BV(64), BV(128), BV(BIO_MAX_PAGES),
 };
@@ -808,9 +808,7 @@
 		size = bp->nr_vecs * sizeof(struct bio_vec);
 
 		bp->slab = kmem_cache_create(bp->name, size, 0,
-						SLAB_HWCACHE_ALIGN, NULL, NULL);
-		if (!bp->slab)
-			panic("biovec: can't init slab cache\n");
+				SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 
 		if (i >= scale)
 			pool_entries >>= 1;
@@ -825,16 +823,16 @@
 static int __init init_bio(void)
 {
 	bio_slab = kmem_cache_create("bio", sizeof(struct bio), 0,
-					SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!bio_slab)
-		panic("bio: can't create slab cache\n");
-	bio_pool = mempool_create(BIO_POOL_SIZE, mempool_alloc_slab, mempool_free_slab, bio_slab);
+				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();
 
-	bio_split_pool = mempool_create(BIO_SPLIT_ENTRIES, bio_pair_alloc, bio_pair_free, NULL);
+	bio_split_pool = mempool_create(BIO_SPLIT_ENTRIES,
+				bio_pair_alloc, bio_pair_free, NULL);
 	if (!bio_split_pool)
 		panic("bio: can't create split pool\n");
 
diff -Nru a/fs/block_dev.c b/fs/block_dev.c
--- a/fs/block_dev.c	Tue Jun 15 22:21:05 2004
+++ b/fs/block_dev.c	Tue Jun 15 22:21:05 2004
@@ -238,7 +238,10 @@
 
 static void bdev_destroy_inode(struct inode *inode)
 {
-	kmem_cache_free(bdev_cachep, BDEV_I(inode));
+	struct bdev_inode *bdi = BDEV_I(inode);
+
+	bdi->bdev.bd_inode_backing_dev_info = NULL;
+	kmem_cache_free(bdev_cachep, bdi);
 }
 
 static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
@@ -303,14 +306,9 @@
 void __init bdev_cache_init(void)
 {
 	int err;
-	bdev_cachep = kmem_cache_create("bdev_cache",
-					sizeof(struct bdev_inode),
-					0,
-					SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
-					init_once,
-					NULL);
-	if (!bdev_cachep)
-		panic("Cannot create bdev_cache SLAB cache");
+	bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
+			0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_PANIC,
+			init_once, NULL);
 	err = register_filesystem(&bd_type);
 	if (err)
 		panic("Cannot register bdev pseudo-fs");
diff -Nru a/fs/buffer.c b/fs/buffer.c
--- a/fs/buffer.c	Tue Jun 15 22:20:41 2004
+++ b/fs/buffer.c	Tue Jun 15 22:20:41 2004
@@ -43,6 +43,26 @@
 
 #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
 
+struct bh_wait_queue {
+	struct buffer_head *bh;
+	wait_queue_t wait;
+};
+
+#define __DEFINE_BH_WAIT(name, b, f)					\
+	struct bh_wait_queue name = {					\
+		.bh	= b,						\
+		.wait	= {						\
+				.task	= current,			\
+				.flags	= f,				\
+				.func	= bh_wake_function,		\
+				.task_list =				\
+					LIST_HEAD_INIT(name.wait.task_list),\
+			},						\
+	}
+#define DEFINE_BH_WAIT(name, bh)	__DEFINE_BH_WAIT(name, bh, 0)
+#define DEFINE_BH_WAIT_EXCLUSIVE(name, bh) \
+		__DEFINE_BH_WAIT(name, bh, WQ_FLAG_EXCLUSIVE)
+
 /*
  * Hashed waitqueue_head's for wait_on_buffer()
  */
@@ -74,10 +94,50 @@
 
 	smp_mb();
 	if (waitqueue_active(wq))
-		wake_up_all(wq);
+		__wake_up(wq, TASK_INTERRUPTIBLE|TASK_UNINTERRUPTIBLE, 1, bh);
 }
 EXPORT_SYMBOL(wake_up_buffer);
 
+static int bh_wake_function(wait_queue_t *wait, unsigned mode,
+				int sync, void *key)
+{
+	struct buffer_head *bh = key;
+	struct bh_wait_queue *wq;
+
+	wq = container_of(wait, struct bh_wait_queue, wait);
+	if (wq->bh != bh || buffer_locked(bh))
+		return 0;
+	else
+		return autoremove_wake_function(wait, mode, sync, key);
+}
+
+static void sync_buffer(struct buffer_head *bh)
+{
+	struct block_device *bd;
+
+	smp_mb();
+	bd = bh->b_bdev;
+	if (bd)
+		blk_run_address_space(bd->bd_inode->i_mapping);
+}
+
+void fastcall __lock_buffer(struct buffer_head *bh)
+{
+	wait_queue_head_t *wqh = bh_waitq_head(bh);
+	DEFINE_BH_WAIT_EXCLUSIVE(wait, bh);
+
+	do {
+		prepare_to_wait_exclusive(wqh, &wait.wait,
+					TASK_UNINTERRUPTIBLE);
+		if (buffer_locked(bh)) {
+			sync_buffer(bh);
+			io_schedule();
+		}
+	} while (test_set_buffer_locked(bh));
+	finish_wait(wqh, &wait.wait);
+}
+EXPORT_SYMBOL(__lock_buffer);
+
 void fastcall unlock_buffer(struct buffer_head *bh)
 {
 	clear_buffer_locked(bh);
@@ -93,20 +153,16 @@
 void __wait_on_buffer(struct buffer_head * bh)
 {
 	wait_queue_head_t *wqh = bh_waitq_head(bh);
-	DEFINE_WAIT(wait);
+	DEFINE_BH_WAIT(wait, bh);
 
 	do {
-		prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(wqh, &wait.wait, TASK_UNINTERRUPTIBLE);
 		if (buffer_locked(bh)) {
-			struct block_device *bd;
-			smp_mb();
-			bd = bh->b_bdev;
-			if (bd)
-				blk_run_address_space(bd->bd_inode->i_mapping);
+			sync_buffer(bh);
 			io_schedule();
 		}
 	} while (buffer_locked(bh));
-	finish_wait(wqh, &wait);
+	finish_wait(wqh, &wait.wait);
 }
 
 static void
@@ -895,7 +951,8 @@
 		if (page->mapping) {	/* Race with truncate? */
 			if (!mapping->backing_dev_info->memory_backed)
 				inc_page_state(nr_dirty);
-			radix_tree_tag_set(&mapping->page_tree, page->index,
+			radix_tree_tag_set(&mapping->page_tree,
+						page_index(page),
 						PAGECACHE_TAG_DIRTY);
 		}
 		spin_unlock_irq(&mapping->tree_lock);
@@ -1207,12 +1264,6 @@
 	pgoff_t index;
 	int sizebits;
 
-	/* Size must be multiple of hard sectorsize */
-	if (size & (bdev_hardsect_size(bdev)-1))
-		BUG();
-	if (size < 512 || size > PAGE_SIZE)
-		BUG();
-
 	sizebits = -1;
 	do {
 		sizebits++;
@@ -1233,6 +1284,18 @@
 struct buffer_head *
 __getblk_slow(struct block_device *bdev, sector_t block, int size)
 {
+	/* Size must be multiple of hard sectorsize */
+	if (unlikely(size & (bdev_hardsect_size(bdev)-1) ||
+			(size < 512 || size > PAGE_SIZE))) {
+		printk(KERN_ERR "getblk(): invalid block size %d requested\n",
+					size);
+		printk(KERN_ERR "hardsect size: %d\n",
+					bdev_hardsect_size(bdev));
+
+		dump_stack();
+		return NULL;
+	}
+
 	for (;;) {
 		struct buffer_head * bh;
 
@@ -2905,9 +2968,11 @@
 int block_sync_page(struct page *page)
 {
 	struct address_space *mapping;
+
 	smp_mb();
-	mapping = page->mapping;
-	blk_run_address_space(mapping);
+	mapping = page_mapping(page);
+	if (mapping)
+		blk_run_backing_dev(mapping->backing_dev_info, page);
 	return 0;
 }
 
@@ -3035,7 +3100,7 @@
 
 	bh_cachep = kmem_cache_create("buffer_head",
 			sizeof(struct buffer_head), 0,
-			0, init_buffer_head, NULL);
+			SLAB_PANIC, init_buffer_head, NULL);
 	for (i = 0; i < ARRAY_SIZE(bh_wait_queue_heads); i++)
 		init_waitqueue_head(&bh_wait_queue_heads[i].wqh);
 
diff -Nru a/fs/cifs/AUTHORS b/fs/cifs/AUTHORS
--- a/fs/cifs/AUTHORS	Tue Jun 15 22:20:36 2004
+++ b/fs/cifs/AUTHORS	Tue Jun 15 22:20:36 2004
@@ -22,6 +22,8 @@
 Amrut Joshi
 Shobhit Dayal
 Sergey Vlasov
+Richard Hughes
+Yury Umanets
 
 Test case and Bug Report contributors
 -------------------------------------
@@ -29,5 +31,7 @@
 and debug of problems they have found:  Jochen Dolze, David Blaine,
 Rene Scharfe, Martin Josefsson, Alexander Wild, Anthony Liguori,
 Lars Muller, Urban Widmark, Massimiliano Ferrero, Howard Owen,
-Kieron Briggs and others. 
+Olaf Kirch, Kieron Briggs and others. 
 
+And thanks to the IBM LTC and Power test teams and SuSE testers for
+finding multiple bugs during excellent stress test runs.
diff -Nru a/fs/cifs/CHANGES b/fs/cifs/CHANGES
--- a/fs/cifs/CHANGES	Tue Jun 15 22:20:44 2004
+++ b/fs/cifs/CHANGES	Tue Jun 15 22:20:44 2004
@@ -1,9 +1,47 @@
+Version 1.18
+------------
+Do not rename hardlinked files (since that should be a noop). Flush
+cached write behind data when reopening a file after session abend,
+except when already in write. Grab per socket sem during reconnect 
+to avoid oops in sendmsg if overlapping with reconnect.
+
+
+Version 1.17
+------------
+Update number of blocks in file so du command is happier (in Linux a fake
+blocksize of 512 is required for calculating number of blocks in inode).
+Fix prepare write of partial pages to read in data from server if possible.
+Fix race on tcpStatus field between unmount and reconnection code, causing
+cifsd process sometimes to hang around forever. Improve out of memory
+checks in cifs_filldir
+
+Version 1.16
+------------
+Fix incorrect file size in file handle based setattr on big endian hardware.
+Fix oops in build_path_from_dentry when out of memory.  Add checks for invalid
+and closing file structs in writepage/partialpagewrite.  Add statistics
+for each mounted share (new menuconfig option). Fix endianness problem in
+volume information displayed in /proc/fs/cifs/DebugData (only affects
+affects big endian architectures). Prevent renames while constructing
+path names for open, mkdir and rmdir.
+
+Version 1.15
+------------
+Change to mempools for alloc smb request buffers and multiplex structs
+to better handle low memory problems (and potential deadlocks).
+
+Version 1.14
+------------
+Fix incomplete listings of large directories on Samba servers when Unix
+extensions enabled.  Fix oops when smb_buffer can not be allocated. Fix
+rename deadlock when writing out dirty pages at same time.
+
 Version 1.13
 ------------
 Fix open of files in which O_CREATE can cause the mode to change in
 some cases. Fix case in which retry of write overlaps file close.
 Fix PPC64 build error.  Reduce excessive stack usage in smb password
-hashing.
+hashing. Fix overwrite of Linux user's view of file mode to Windows servers.
 
 Version 1.12
 ------------
diff -Nru a/fs/cifs/README b/fs/cifs/README
--- a/fs/cifs/README	Tue Jun 15 22:21:03 2004
+++ b/fs/cifs/README	Tue Jun 15 22:21:03 2004
@@ -97,16 +97,30 @@
 
 	case sensitive = yes
 	delete readonly = yes 
- 
+	ea support = yes
+
+Note that ea support is required for supporting Linux xattrs. 
 Some administrators also change the "map archive" and the "create mask" 
 parameters from their default values.  Creating special devices (mknod) remotely 
 may require specifying a mkdev function to Samba.  For more information on these 
 see the manual pages ("man smb.conf") on the Samba server system.  Note that the 
 cifs vfs, unlike the smbfs vfs, does not read the smb.conf on the client system 
 (the few optional settings are passed in on mount via -o parameters instead).  
-Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to delete 
+Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to delete
 open files (required for strict POSIX compliance).  Windows Servers already 
-supported this feature.  
+supported this feature. Samba server does not allow symlinks that refer to files
+outside of the share, so in Samba versions prior to 3.0.5, most symlinks to
+files with absolute paths (ie beginning with slash) such as:
+	 ln -s /mnt/foo bar
+would be forbidden. Samba 3.0.5 server or later includes the ability to create 
+such symlinks safely by converting unsafe symlinks (ie symlinks to server 
+files that are outside of the share) to a samba specific format on the server
+that is ignored by local server applications and non-cifs clients and that will
+not be traversed by the Samba server).  This is opaque to the Linux client
+application using the cifs vfs. Absolute symlinks will work to Samba 3.0.5 or
+later, but only for remote clients using the CIFS Unix extensions, and will
+be invisbile to Windows clients and typically will not affect local
+applications running on the same server as Samba.  
 
 Use instructions:
 ================
@@ -142,6 +156,8 @@
         password=your_password
 2) By specifying the password in the PASSWD environment variable (similarly
 the user name can be taken from the USER environment variable).
+3) By specifying the password in a file by name via PASSWD_FILE
+4) By specifying the password in a file by file descriptor via PASSWD_FD
 
 If no password is provided, mount.cifs will prompt for password entry
 
@@ -166,8 +182,28 @@
 		mount.	
   domain	Set the SMB/CIFS workgroup name prepended to the
 		username during CIFS session establishment
-  uid           If CIFS Unix extensions are not supported by the server
-                this overrides the default uid for inodes.
+  uid		If CIFS Unix extensions are not supported by the server
+		this overrides the default uid for inodes. For mounts to
+		servers which do support the CIFS Unix extensions, such
+		as a properly configured Samba server, the server provides
+		the uid, gid and mode.  For servers which do not support
+		the Unix extensions, the default uid (and gid) returned on
+		lookup of existing files is the uid (gid) of the person
+		who executed the mount (root, except when mount.cifs
+		is configured setuid for user mounts) unless the "uid=" 
+		(gid) mount option is specified.  For the uid (gid) of newly
+		created files and directories, ie files created since 
+		the last mount of the server share, the expected uid 
+		(gid) is cached as as long as the inode remains in 
+		memory on the client.   Also note that permission
+		checks (authorization checks) on accesses to a file occur
+		at the server, but there are cases in which an administrator
+		may want to restrict at the client as well.  For those
+		servers which do not report a uid/gid owner
+		(such as Windows), permissions can also be checked at the
+		client, and a crude form of client side permission checking 
+		can be enabled by specifying file_mode and dir_mode on 
+		the client
   gid		If CIFS Unix extensions are not supported by the server
 		this overrides the default gid for inodes.
   file_mode     If CIFS Unix extensions are not supported by the server
@@ -219,13 +255,27 @@
 		if guest is specified on the mount options.  If no
 		password is specified a null password will be used.
 
+The mount.cifs mount helper also accepts a few mount options before -o
+including:
+
+	-S      take password from stdin (equivalent to setting the environment
+		variable "PASSWD_FD=0"
+	-V      print mount.cifs version
+	-?      display simple usage information
+
+With recent 2.6 kernel versions of modutils, the version of the cifs kernel
+module can be displayed via modinfo.
+
 Misc /proc/fs/cifs Flags and Debug Info
 =======================================
 Informational pseudo-files:
 DebugData		Displays information about active CIFS sessions
+			and shares.
 SimultaneousOps		Counter which holds maximum number of
 			simultaneous outstanding SMB/CIFS requests.
-Stats			Lists summary resource usage information
+Stats			Lists summary resource usage information as well as per
+			share statistics, if CONFIG_CIFS_STATS in enabled
+			in the kernel configuration.
 
 Configuration pseudo-files:
 MultiuserMount		If set to one, more than one CIFS session to 
@@ -279,13 +329,25 @@
 Three other experimental features are under development and to test 
 require enabling an ifdef (e.g. by  adding "#define CIFS_FCNTL" in cifsglob.h)
 
-	CIFS_QUOTA
+	CONFIG_CIFS_QUOTA
+
+	CONFIG_CIFS_XATTR
 
-	CIFS_XATTR
+	CONFIG_CIFS_FCNTL  (fcntl needed for support of directory change 
+			    notification and perhaps later for file leases)
 
-	CIFS_FCNTL  (fcntl needed for support of directory change notification)
+Per share (per client mount) statistics are available in /proc/fs/cifs/DebugData
+if the kernel was configured with cifs statistics enabled.  The statistics
+represent the number of successful (ie non-zero return code from the server) 
+SMB responses to some of the more common commands (open, delete, mkdir etc.).
+Also recorded is the total bytes read and bytes written to the server for
+that share.  Note that due to client caching effects this can be less than the
+number of bytes read and written by the application running on the client.
+The statistics for the number of total SMBs and oplock breaks are different in
+that they represent all for that share, not just those for which the server
+returned success.
 	
-Also note that "cat /proc/fs/cifs/DebugData" will display some information about 
+Also note that "cat /proc/fs/cifs/DebugData" will display information about 
 the active sessions and the shares that are mounted.  Note: NTLMv2 enablement 
 will not work since they its implementation is not quite complete yet.
 Do not alter these configuration values unless you are doing specific testing.  
diff -Nru a/fs/cifs/TODO b/fs/cifs/TODO
--- a/fs/cifs/TODO	Tue Jun 15 22:21:03 2004
+++ b/fs/cifs/TODO	Tue Jun 15 22:21:03 2004
@@ -1,7 +1,7 @@
-version 1.0.2 January 29, 2004
+version 1.16 May 27, 2004
 
-A Partial List of Known Problems and Missing Features
-=====================================================
+A Partial List of Missing Features
+==================================
 
 Contributions are welcome.  There are plenty of opportunities
 for visible, important contributions to this module.  Here
@@ -21,8 +21,8 @@
 
 f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup 
 used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM
-	and raw NTLMSSP already. This is important when enabling
-	extended security and mounting to Windows 2003 Servers
+and raw NTLMSSP already. This is important when enabling
+extended security and mounting to Windows 2003 Servers
 
 f) Directory entry caching relies on a 1 second timer, rather than 
 using FindNotify or equivalent.  - (started)
@@ -34,7 +34,8 @@
 
 i) support for the Linux 2.5 kernel new feature get_xattr and set_xattr
 which will allow us to expose dos attributes as well as real
-ACLs
+ACLs. This support has been started in the current code, but is
+ifdeffed out.
 
 k) finish writepages support (multi-page write behind for improved
 performance) and syncpage
@@ -42,7 +43,9 @@
 l) hook lower into the sockets api (as NFS/SunRPC does) to avoid the
 extra copy in/out of the socket buffers in some cases.
 
-m) finish support for IPv6
+m) finish support for IPv6.  This is mostly complete but
+needs a simple inet_pton like function to convert ipv6
+addresses in string representation.
 
 o) Better optimize open (and pathbased setfilesize) to reduce the
 oplock breaks coming from windows srv.  Piggyback identical file
@@ -51,10 +54,23 @@
 spurious oplock breaks).
 
 p) Improve performance of readpages by sending more than one read
-at a time when 8 pages or more are requested.
+at a time when 8 pages or more are requested.  Evaluate whether
+reads larger than 16K would be helpful.
 
+q) For support of Windows9x/98 we need to retry failed mounts
+to *SMBSERVER (default server name) with the uppercase hostname
+in the RFC1001 session_init request.
 
-KNOWN BUGS (updated January 30, 2004)
+r) Add Extended Attributed support (for storing UID/GID info
+to Windows servers)
+
+s) Finish fcntl D_NOTIFY support so kde and gnome file list windows
+will autorefresh
+
+t) Add GUI tool to configure /proc/fs/cifs settings and for display of
+the CIFS statistics
+
+KNOWN BUGS (updated May 27, 2004)
 ====================================
 1) existing symbolic links (Windows reparse points) are recognized but
 can not be created remotely. They are implemented for Samba and those that
@@ -64,20 +80,18 @@
 but recognizes them
 3) create of new files to FAT partitions on Windows servers can
 succeed but still return access denied (appears to be Windows 
-not client problem).  NTFS partitions do not have this problem.
-4) debug connectathon special test case nfs_idem (which does
-some invalid symlink naming, or at least what Samba thinks
-is an invalid symlink target).
-5) debug connectation lock test case 10 which fails against
+server not cifs client problem) and has not been reproduced recently.
+NTFS partitions do not have this problem.
+4) debug connectation lock test case 10 which fails against
 Samba (may be unmappable due to POSIX to Windows lock model
 differences but worth investigating).  Also debug Samba to 
 see why lock test case 7 takes longer to complete to Samba
 than to Windows.
 
 Misc testing to do
-=================
+==================
 1) check out max path names and max path name components against various server
-types.
+types. Return max path name in stat -f information
 
 2) Modify file portion of ltp so it can run against a mounted network
 share and run it against cifs vfs.
@@ -87,5 +101,6 @@
 and when signing is disabled to request larger read sizes (larger than 
 negotiated size) and send larger write sizes to modern servers.
 
-4) More exhaustively test the recently added NT4 support
+4) More exhaustively test the recently added NT4 support against various
+NT4 service pack levels.
 
diff -Nru a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
--- a/fs/cifs/cifs_debug.c	Tue Jun 15 22:20:40 2004
+++ b/fs/cifs/cifs_debug.c	Tue Jun 15 22:20:40 2004
@@ -74,7 +74,7 @@
 		    "---------------------------------------------------\n");
 	buf += length;
 
-	length = sprintf(buf, "Servers: \n");
+	length = sprintf(buf, "Servers:\n");
 	buf += length;
 
 	i = 0;
@@ -84,13 +84,15 @@
 		ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
 		length =
 		    sprintf(buf,
-			    "\n%d) Name: %s  Domain: %s Mounts: %d ServerOS: %s  \n\tServerNOS: %s\tCapabilities: 0x%x\n\tSMB session status: %d\tTCP session status: %d",
+			    "\n%d) Name: %s  Domain: %s Mounts: %d ServerOS: %s  \n\tServerNOS: %s\tCapabilities: 0x%x\n\tSMB session status: %d\tTCP status: %d",
 				i, ses->serverName, ses->serverDomain, atomic_read(&ses->inUse),
 				ses->serverOS, ses->serverNOS, ses->capabilities,ses->status,ses->server->tcpStatus);
 		buf += length;
 		if(ses->server) {
-			buf += sprintf(buf, "\n\tLocal Users To Same Server: %d SecMode: 0x%x",
-				atomic_read(&ses->server->socketUseCount),ses->server->secMode);
+			buf += sprintf(buf, "\n\tLocal Users To Server: %d SecMode: 0x%x Req Active: %d",
+				atomic_read(&ses->server->socketUseCount),
+				ses->server->secMode,
+				atomic_read(&ses->server->inFlight));
 			
 			/* length = sprintf(buf, "\nMIDs: \n");
 			buf += length;
@@ -113,7 +115,7 @@
 	sprintf(buf, "\n");
 	buf++;
 
-	length = sprintf(buf, "\nShares: \n");
+	length = sprintf(buf, "\nShares:\n");
 	buf += length;
 
 	i = 0;
@@ -123,7 +125,7 @@
 		tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
 		length =
 		    sprintf(buf,
-			    "\n%d) %s Uses: %d on FS: %s with characteristics: 0x%x Attributes: 0x%x\n\tPathComponentMax: %d Status: %d",
+			    "\n%d) %s Uses: %d Type: %s Characteristics: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d",
 			    i, tcon->treeName,
 			    atomic_read(&tcon->useCount),
 			    tcon->nativeFileSystem,
@@ -140,8 +142,10 @@
 			    sprintf(buf, " type: %d ",
 				    tcon->fsDevInfo.DeviceType);
 		buf += length;
-		if(tcon->tidStatus == CifsNeedReconnect)
+		if(tcon->tidStatus == CifsNeedReconnect) {
 			buf += sprintf(buf, "\tDISCONNECTED ");
+			length += 14;
+		}
 	}
 	read_unlock(&GlobalSMBSeslock);
 
@@ -176,32 +180,80 @@
 	return length;
 }
 
+#ifdef CONFIG_CIFS_STATS
 int
 cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
 		  int length, int *eof, void *data)
 {
-	int item_length;
-	length =
-	    sprintf(buf,
-		    "Currently Allocated structures\nCIFS Sessions: %d\n",sesInfoAllocCount.counter);
+	int item_length,i;
+	struct list_head *tmp;
+	struct cifsTconInfo *tcon;
+
+	length = sprintf(buf,
+			"Resources in use\nCIFS Session: %d\n",
+			sesInfoAllocCount.counter);
 	buf += length;
 	item_length = 
-		sprintf(buf,"Shares (unique mount targets): %d\n",tconInfoAllocCount.counter);
+		sprintf(buf,"Share (unique mount targets): %d\n",
+			tconInfoAllocCount.counter);
 	length += item_length;
 	buf += item_length;      
 	item_length = 
-			sprintf(buf,"Allocated SMB Request and Response Buffers: %d\n",bufAllocCount.counter);
+		sprintf(buf,"SMB Request/Response Buffer: %d\n",
+			bufAllocCount.counter);
 	length += item_length;
 	buf += item_length;      
 	item_length = 
-		sprintf(buf,"Active Operations (MIDs in use): %d\n",midCount.counter);
+		sprintf(buf,"Operations (MIDs): %d\n",
+			midCount.counter);
 	length += item_length;
 	buf += item_length;
-	item_length = sprintf(buf,"%d sessions and %d shares reconnected after failure\n",tcpSesReconnectCount.counter,tconInfoReconnectCount.counter);
+	item_length = sprintf(buf,
+		"\n%d session %d share reconnects\n",
+		tcpSesReconnectCount.counter,tconInfoReconnectCount.counter);
 	length += item_length;
+	buf += item_length;
+
+	i = 0;
+	read_lock(&GlobalSMBSeslock);
+	list_for_each(tmp, &GlobalTreeConnectionList) {
+		i++;
+		tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
+		item_length = sprintf(buf,"\n%d) %s",i, tcon->treeName);
+		buf += item_length;
+		length += item_length;
+		if(tcon->tidStatus == CifsNeedReconnect) {
+			buf += sprintf(buf, "\tDISCONNECTED ");
+			length += 14;
+		}
+		item_length = sprintf(buf,"\nSMBs: %d Oplock Breaks: %d",
+			atomic_read(&tcon->num_smbs_sent),
+			atomic_read(&tcon->num_oplock_brks));
+		buf += item_length;
+		length += item_length;
+		item_length = sprintf(buf,"\nReads: %d Bytes %lld",
+			atomic_read(&tcon->num_reads),
+			(long long)(tcon->bytes_read));
+		buf += item_length;
+		item_length = sprintf(buf,"\nWrites: %d Bytes: %lld",
+			atomic_read(&tcon->num_writes),
+			(long long)(tcon->bytes_written));
+		buf += item_length;
+		item_length = sprintf(buf,
+			"\nOpens: %d Deletes: %d\nMkdirs: %d Rmdirs: %d",
+			atomic_read(&tcon->num_opens),
+			atomic_read(&tcon->num_deletes),
+			atomic_read(&tcon->num_mkdirs),
+			atomic_read(&tcon->num_rmdirs));
+		buf += item_length;
+		length += item_length;
+	}
+	read_unlock(&GlobalSMBSeslock);
+
 
 	return length;
 }
+#endif
 
 struct proc_dir_entry *proc_fs_cifs;
 read_proc_t cifs_txanchor_read;
@@ -241,10 +293,10 @@
 
 	create_proc_read_entry("SimultaneousOps", 0, proc_fs_cifs,
 				cifs_total_xid_read, 0);
-
+#ifdef CONFIG_CIFS_STATS
 	create_proc_read_entry("Stats", 0, proc_fs_cifs,
 				cifs_stats_read, 0);
-
+#endif
 	pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
 				cifsFYI_read, 0);
 	if (pde)
@@ -312,7 +364,9 @@
 	remove_proc_entry("cifsFYI", proc_fs_cifs);
 	remove_proc_entry("traceSMB", proc_fs_cifs);
 	remove_proc_entry("SimultaneousOps", proc_fs_cifs);
+#ifdef CONFIG_CIFS_STATS
 	remove_proc_entry("Stats", proc_fs_cifs);
+#endif
 	remove_proc_entry("MultiuserMount", proc_fs_cifs);
 	remove_proc_entry("OplockEnabled", proc_fs_cifs);
 	remove_proc_entry("NTLMV2Enabled",proc_fs_cifs);
@@ -346,7 +400,7 @@
 	return len;
 }
 static int
-cifsFYI_write(struct file *file, const char *buffer,
+cifsFYI_write(struct file *file, const char __user *buffer,
 	      unsigned long count, void *data)
 {
 	char c;
@@ -385,7 +439,7 @@
 	return len;
 }
 static int
-oplockEnabled_write(struct file *file, const char *buffer,
+oplockEnabled_write(struct file *file, const char __user *buffer,
 		    unsigned long count, void *data)
 {
 	char c;
@@ -425,7 +479,7 @@
         return len;
 }
 static int
-quotaEnabled_write(struct file *file, const char *buffer,
+quotaEnabled_write(struct file *file, const char __user *buffer,
                     unsigned long count, void *data)
 {
         char c;
@@ -465,7 +519,7 @@
         return len;
 }
 static int
-linuxExtensionsEnabled_write(struct file *file, const char *buffer,
+linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
                     unsigned long count, void *data)
 {
         char c;
@@ -505,7 +559,7 @@
 	return len;
 }
 static int
-lookupFlag_write(struct file *file, const char *buffer,
+lookupFlag_write(struct file *file, const char __user *buffer,
 		    unsigned long count, void *data)
 {
 	char c;
@@ -543,7 +597,7 @@
 	return len;
 }
 static int
-traceSMB_write(struct file *file, const char *buffer,
+traceSMB_write(struct file *file, const char __user *buffer,
 	       unsigned long count, void *data)
 {
 	char c;
@@ -582,7 +636,7 @@
 	return len;
 }
 static int
-multiuser_mount_write(struct file *file, const char *buffer,
+multiuser_mount_write(struct file *file, const char __user *buffer,
 		      unsigned long count, void *data)
 {
 	char c;
@@ -621,7 +675,7 @@
 	return len;
 }
 static int
-extended_security_write(struct file *file, const char *buffer,
+extended_security_write(struct file *file, const char __user *buffer,
 			unsigned long count, void *data)
 {
 	char c;
@@ -660,7 +714,7 @@
 	return len;
 }
 static int
-ntlmv2_enabled_write(struct file *file, const char *buffer,
+ntlmv2_enabled_write(struct file *file, const char __user *buffer,
 			unsigned long count, void *data)
 {
 	char c;
@@ -699,7 +753,7 @@
 	return len;
 }
 static int
-packet_signing_enabled_write(struct file *file, const char *buffer,
+packet_signing_enabled_write(struct file *file, const char __user *buffer,
 			unsigned long count, void *data)
 {
 	char c;
diff -Nru a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h
--- a/fs/cifs/cifs_debug.h	Tue Jun 15 22:20:41 2004
+++ b/fs/cifs/cifs_debug.h	Tue Jun 15 22:20:41 2004
@@ -63,18 +63,4 @@
 #define cifserror(format,arg...)
 #endif		/* _CIFS_DEBUG */
 
-/*
- *	statistics
- *	----------
- */
-#ifdef	_CIFS_STATISTICS
-#define	INCREMENT(x)	((x)++)
-#define	DECREMENT(x)	((x)--)
-#define	HIGHWATERMARK(x,y)	x = MAX((x), (y))
-#else
-#define	INCREMENT(x)
-#define	DECREMENT(x)
-#define	HIGHWATERMARK(x,y)
-#endif				/* _CIFS_STATISTICS */
-
 #endif				/* _H_CIFS_DEBUG */
diff -Nru a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
--- a/fs/cifs/cifsfs.c	Tue Jun 15 22:20:41 2004
+++ b/fs/cifs/cifsfs.c	Tue Jun 15 22:20:41 2004
@@ -31,6 +31,7 @@
 #include <linux/list.h>
 #include <linux/seq_file.h>
 #include <linux/vfs.h>
+#include <linux/mempool.h>
 #include "cifsfs.h"
 #include "cifspdu.h"
 #define DECLARE_GLOBALS_HERE
@@ -39,9 +40,11 @@
 #include "cifs_debug.h"
 #include "cifs_fs_sb.h"
 #include <linux/mm.h>
-#define CIFS_MAGIC_NUMBER 0xFF534D42	/* the first four bytes of all SMB PDUs */
+#define CIFS_MAGIC_NUMBER 0xFF534D42	/* the first four bytes of SMB PDUs */
+/* BB when mempool_resize is added back in, we will resize pool on new mount */
+#define CIFS_MIN_RCV_POOL 11 /* enough for progress to five servers */
 
-#ifdef CIFS_QUOTA
+#ifdef CONFIG_CIFS_QUOTA
 static struct quotactl_ops cifs_quotactl_ops;
 #endif
 
@@ -100,7 +103,7 @@
 	sb->s_op = &cifs_super_ops;
 /*	if(cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
 	    sb->s_blocksize = cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
-#ifdef CIFS_QUOTA
+#ifdef CONFIG_CIFS_QUOTA
 	sb->s_qcop = &cifs_quotactl_ops;
 #endif
 	sb->s_blocksize = CIFS_MAX_MSGSIZE;
@@ -209,9 +212,11 @@
 }
 
 static kmem_cache_t *cifs_inode_cachep;
-kmem_cache_t *cifs_req_cachep;
-kmem_cache_t *cifs_mid_cachep;
+static kmem_cache_t *cifs_req_cachep;
+static kmem_cache_t *cifs_mid_cachep;
 kmem_cache_t *cifs_oplock_cachep;
+mempool_t *cifs_req_poolp;
+mempool_t *cifs_mid_poolp;
 
 static struct inode *
 cifs_alloc_inode(struct super_block *sb)
@@ -271,7 +276,7 @@
 	return 0;
 }
 
-#ifdef CIFS_QUOTA
+#ifdef CONFIG_CIFS_QUOTA
 int cifs_xquota_set(struct super_block * sb, int quota_type, qid_t qid,
 		struct fs_disk_quota * pdquota)
 {
@@ -421,7 +426,7 @@
 }
 
 static ssize_t
-cifs_read_wrapper(struct file * file, char *read_data, size_t read_size,
+cifs_read_wrapper(struct file * file, char __user *read_data, size_t read_size,
           loff_t * poffset)
 {
 	if(file == NULL)
@@ -450,7 +455,7 @@
 }
 
 static ssize_t
-cifs_write_wrapper(struct file * file, const char *write_data,
+cifs_write_wrapper(struct file * file, const char __user *write_data,
            size_t write_size, loff_t * poffset) 
 {
 	ssize_t written;
@@ -504,7 +509,7 @@
 	.getattr = cifs_getattr, /* do we need this anymore? */
 	.rename = cifs_rename,
 	.permission = cifs_permission,
-#ifdef CIFS_XATTR
+#ifdef CONFIG_CIFS_XATTR
 	.setxattr = cifs_setxattr,
 	.getxattr = cifs_getxattr,
 	.listxattr = cifs_listxattr,
@@ -519,7 +524,7 @@
 	/* BB add the following two eventually */
 	/* revalidate: cifs_revalidate,
 	   setattr:    cifs_notify_change, *//* BB do we need notify change */
-#ifdef CIFS_XATTR
+#ifdef CONFIG_CIFS_XATTR
 	.setxattr = cifs_setxattr,
 	.getxattr = cifs_getxattr,
 	.listxattr = cifs_listxattr,
@@ -537,7 +542,7 @@
 	.flush = cifs_flush,
 	.mmap  = cifs_file_mmap,
 	.sendfile = generic_file_sendfile,
-#ifdef CIFS_FCNTL
+#ifdef CONFIG_CIFS_FCNTL
 	.fcntl = cifs_fcntl,
 #endif
 };
@@ -546,7 +551,7 @@
 	.readdir = cifs_readdir,
 	.release = cifs_closedir,
 	.read    = generic_read_dir,
-#ifdef CIFS_FCNTL
+#ifdef CONFIG_CIFS_FCNTL
 	.fcntl   = cifs_fcntl,
 #endif
 };
@@ -593,12 +598,23 @@
 	if (cifs_req_cachep == NULL)
 		return -ENOMEM;
 
+	cifs_req_poolp = mempool_create(CIFS_MIN_RCV_POOL,
+					mempool_alloc_slab,
+					mempool_free_slab,
+					cifs_req_cachep);
+
+	if(cifs_req_poolp == NULL) {
+		kmem_cache_destroy(cifs_req_cachep);
+		return -ENOMEM;
+	}
+
 	return 0;
 }
 
 static void
 cifs_destroy_request_bufs(void)
 {
+	mempool_destroy(cifs_req_poolp);
 	if (kmem_cache_destroy(cifs_req_cachep))
 		printk(KERN_WARNING
 		       "cifs_destroy_request_cache: error not all structures were freed\n");
@@ -612,11 +628,22 @@
 				SLAB_HWCACHE_ALIGN, NULL, NULL);
 	if (cifs_mid_cachep == NULL)
 		return -ENOMEM;
+
+	cifs_mid_poolp = mempool_create(3 /* a reasonable min simultan opers */,
+					mempool_alloc_slab,
+					mempool_free_slab,
+					cifs_mid_cachep);
+	if(cifs_mid_poolp == NULL) {
+		kmem_cache_destroy(cifs_mid_cachep);
+		return -ENOMEM;
+	}
+
 	cifs_oplock_cachep = kmem_cache_create("cifs_oplock_structs",
 				sizeof (struct oplock_q_entry), 0,
 				SLAB_HWCACHE_ALIGN, NULL, NULL);
 	if (cifs_oplock_cachep == NULL) {
 		kmem_cache_destroy(cifs_mid_cachep);
+		mempool_destroy(cifs_mid_poolp);
 		return -ENOMEM;
 	}
 
@@ -626,9 +653,11 @@
 static void
 cifs_destroy_mids(void)
 {
+	mempool_destroy(cifs_mid_poolp);
 	if (kmem_cache_destroy(cifs_mid_cachep))
 		printk(KERN_WARNING
 		       "cifs_destroy_mids: error not all structures were freed\n");
+
 	if (kmem_cache_destroy(cifs_oplock_cachep))
 		printk(KERN_WARNING
 		       "error not all oplock structures were freed\n");
diff -Nru a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
--- a/fs/cifs/cifsfs.h	Tue Jun 15 22:20:37 2004
+++ b/fs/cifs/cifsfs.h	Tue Jun 15 22:20:37 2004
@@ -85,7 +85,7 @@
 
 /* Functions related to symlinks */
 extern int cifs_follow_link(struct dentry *direntry, struct nameidata *nd);
-extern int cifs_readlink(struct dentry *direntry, char *buffer, int buflen);
+extern int cifs_readlink(struct dentry *direntry, char __user *buffer, int buflen);
 extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
 			const char *symname);
 extern int	cifs_removexattr(struct dentry *, const char *);
@@ -93,5 +93,5 @@
 			 size_t, int);
 extern ssize_t	cifs_getxattr(struct dentry *, const char *, void *, size_t);
 extern ssize_t	cifs_listxattr(struct dentry *, char *, size_t);
-#define CIFS_VERSION   "1.13"
+#define CIFS_VERSION   "1.18"
 #endif				/* _CIFSFS_H */
diff -Nru a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
--- a/fs/cifs/cifsglob.h	Tue Jun 15 22:20:37 2004
+++ b/fs/cifs/cifsglob.h	Tue Jun 15 22:20:37 2004
@@ -34,9 +34,14 @@
 
 /*
  * MAX_REQ is the maximum number of requests that WE will send
- * on one NetBIOS handle concurently.
+ * on one socket concurently. It also matches the most common
+ * value of max multiplex returned by servers.  We may 
+ * eventually want to use the negotiated value (in case
+ * future servers can handle more) when we are more confident that
+ * we will not have problems oveloading the socket with pending
+ * write data.
  */
-#define MAX_REQ (10)
+#define CIFS_MAX_REQ 50 
 
 #define SERVER_NAME_LENGTH 15
 #define SERVER_NAME_LEN_WITH_NULL     (SERVER_NAME_LENGTH + 1)
@@ -110,7 +115,8 @@
 		struct sockaddr_in sockAddr;
 		struct sockaddr_in6 sockAddr6;
 	} addr;
-	wait_queue_head_t response_q;
+	wait_queue_head_t response_q; 
+	wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/
 	struct list_head pending_mid_q;
 	void *Server_NlsInfo;	/* BB - placeholder for future NLS info  */
 	unsigned short server_codepage;	/* codepage for the server    */
@@ -119,7 +125,8 @@
 	char versionMajor;
 	char versionMinor;
 	int svlocal:1;		/* local server or remote */
-	atomic_t socketUseCount;	/* indicates if the server has any open cifs sessions */
+	atomic_t socketUseCount; /* number of open cifs sessions on socket */
+	atomic_t inFlight;  /* number of requests on the wire to server */
 	enum statusEnum tcpStatus; /* what we think the status is */
 	struct semaphore tcpSem;
 	struct task_struct *tsk;
@@ -163,7 +170,7 @@
 	struct semaphore sesSem;
 	struct cifsUidInfo *uidInfo;	/* pointer to user info */
 	struct TCP_Server_Info *server;	/* pointer to server info */
-	atomic_t inUse;		/* # of CURRENT users of this ses */
+	atomic_t inUse; /* # of mounts (tree connections) on this ses */
 	enum statusEnum status;
 	__u32 sequence_number;  /* needed for CIFS PDU signature */
 	__u16 ipc_tid;		/* special tid for connection to IPC share */
@@ -195,6 +202,19 @@
 	__u16 Flags;		/* optional support bits */
 	enum statusEnum tidStatus;
 	atomic_t useCount;	/* how many mounts (explicit or implicit) to this share */
+#ifdef CONFIG_CIFS_STATS
+	atomic_t num_smbs_sent;
+	atomic_t num_writes;
+	atomic_t num_reads;
+	atomic_t num_oplock_brks;
+	atomic_t num_opens;
+	atomic_t num_deletes;
+	atomic_t num_mkdirs;
+	atomic_t num_rmdirs;
+	__u64    bytes_read;
+	__u64    bytes_written;
+	spinlock_t stat_lock;
+#endif
 	FILE_SYSTEM_DEVICE_INFO fsDevInfo;
 	FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo;	/* ok if file system name truncated */
 	FILE_SYSTEM_UNIX_INFO fsUnixInfo;
@@ -294,13 +314,6 @@
 #define   MID_RESPONSE_RECEIVED 4
 #define   MID_RETRY_NEEDED      8 /* session closed while this request out */
 
-struct servers_not_supported { /* @z4a */
-	struct servers_not_supported *next1;  /* @z4a */
-	char server_Name[SERVER_NAME_LEN_WITH_NULL]; /* @z4a */
-	/* Server Names in SMB protocol are 15 chars + X'20'  */
-	/*   in 16th byte...                      @z4a        */
-};
-
 /*
  *****************************************************************
  * All constants go here
@@ -397,5 +410,4 @@
 GLOBAL_EXTERN unsigned int ntlmv2_support;  /* better optional password hash */
 GLOBAL_EXTERN unsigned int sign_CIFS_PDUs;  /* enable smb packet signing */
 GLOBAL_EXTERN unsigned int linuxExtEnabled;  /* enable Linux/Unix CIFS extensions */
-
 
diff -Nru a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
--- a/fs/cifs/cifspdu.h	Tue Jun 15 22:20:44 2004
+++ b/fs/cifs/cifspdu.h	Tue Jun 15 22:20:44 2004
@@ -34,9 +34,10 @@
 #define SMB_COM_DELETE                0x06
 #define SMB_COM_RENAME                0x07
 #define SMB_COM_LOCKING_ANDX          0x24
+#define SMB_COM_COPY                  0x29
 #define SMB_COM_READ_ANDX             0x2E
 #define SMB_COM_WRITE_ANDX            0x2F
-#define SMB_COM_TRANSACTION2	      0x32
+#define SMB_COM_TRANSACTION2          0x32
 #define SMB_COM_TRANSACTION2_SECONDARY 0x33
 #define SMB_COM_FIND_CLOSE2           0x34
 #define SMB_COM_TREE_DISCONNECT       0x71
@@ -775,6 +776,34 @@
 	/* followed by NewFileName */
 } RENAME_REQ;
 
+	/* copy request flags */
+#define COPY_MUST_BE_FILE      0x0001
+#define COPY_MUST_BE_DIR       0x0002
+#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */
+#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */
+#define COPY_VERIFY_WRITES     0x0010
+#define COPY_TREE              0x0020 
+
+typedef struct smb_com_copy_req {
+	struct smb_hdr hdr;	/* wct = 3 */
+	__u16 Tid2;
+	__u16 OpenFunction;
+	__u16 Flags;
+	__u16 ByteCount;
+	__u8 BufferFormat;	/* 4 = ASCII or Unicode */ 
+	unsigned char OldFileName[1];
+	/* followed by __u8 BufferFormat2 */
+	/* followed by NewFileName string */
+} COPY_REQ;
+
+typedef struct smb_com_copy_rsp {
+	struct smb_hdr hdr;     /* wct = 1 */
+	__u16 CopyCount;    /* number of files copied */
+	__u16 ByteCount;    /* may be zero */
+	__u8 BufferFormat;  /* 0x04 - only present if errored file follows */
+	unsigned char ErrorFileName[1]; /* only present if error in copy */
+} COPY_RSP;
+
 #define CREATE_HARD_LINK		0x103
 #define MOVEFILE_COPY_ALLOWED		0x0002
 #define MOVEFILE_REPLACE_EXISTING	0x0001
@@ -833,6 +862,10 @@
 	__u16 ByteCount;	/* bct = 0 */
 } CREATE_DIRECTORY_RSP;
 
+/***************************************************/
+/* NT Transact structure defintions follow         */
+/* Currently only ioctl and notify are implemented */
+/***************************************************/
 typedef struct smb_com_transaction_ioctl_req {
 	struct smb_hdr hdr;	/* wct = 23 */
 	__u8 MaxSetupCount;
@@ -875,29 +908,45 @@
 } TRANSACT_IOCTL_RSP;
 
 typedef struct smb_com_transaction_change_notify_req {
-        struct smb_hdr hdr;     /* wct = 23 */
-        __u8 MaxSetupCount;
-        __u16 Reserved;
-        __u32 TotalParameterCount;
-        __u32 TotalDataCount;
-        __u32 MaxParameterCount;
-        __u32 MaxDataCount;
-        __u32 ParameterCount;
-        __u32 ParameterOffset;
-        __u32 DataCount;
-        __u32 DataOffset;
-        __u8 SetupCount; /* four setup words follow subcommand */
-        /* SNIA spec incorrectly included spurious pad here */
-        __u16 SubCommand;/* 4 = Change Notify */
+	struct smb_hdr hdr;     /* wct = 23 */
+	__u8 MaxSetupCount;
+	__u16 Reserved;
+	__u32 TotalParameterCount;
+	__u32 TotalDataCount;
+	__u32 MaxParameterCount;
+	__u32 MaxDataCount;
+	__u32 ParameterCount;
+	__u32 ParameterOffset;
+	__u32 DataCount;
+	__u32 DataOffset;
+	__u8 SetupCount; /* four setup words follow subcommand */
+	/* SNIA spec incorrectly included spurious pad here */
+	__u16 SubCommand;/* 4 = Change Notify */
 	__u32 CompletionFilter;  /* operation to monitor */
 	__u16 Fid;
 	__u8 WatchTree;  /* 1 = Monitor subdirectories */
+	__u8 Reserved2;
 	__u16 ByteCount;
-	__u8 Pad[3];
-	__u8 Data[1];
+/* __u8 Pad[3];*/
+/*	__u8 Data[1];*/
 } TRANSACT_CHANGE_NOTIFY_REQ;
 
-/* Completion Filter flags */
+typedef struct smb_com_transaction_change_notify_rsp {
+	struct smb_hdr hdr;	/* wct = 18 */
+	__u8 Reserved[3];
+	__u32 TotalParameterCount;
+	__u32 TotalDataCount;
+	__u32 ParameterCount;
+	__u32 ParameterOffset;
+	__u32 ParameterDisplacement;
+	__u32 DataCount;
+	__u32 DataOffset;
+	__u32 DataDisplacement;
+	__u8 SetupCount;   /* 0 */
+	__u16 ByteCount;
+	/* __u8 Pad[3]; */
+} TRANSACT_CHANGE_NOTIFY_RSP;
+/* Completion Filter flags for Notify */
 #define FILE_NOTIFY_CHANGE_FILE_NAME    0x00000001
 #define FILE_NOTIFY_CHANGE_DIR_NAME     0x00000002
 #define FILE_NOTIFY_CHANGE_NAME         0x00000003
@@ -912,6 +961,15 @@
 #define FILE_NOTIFY_CHANGE_STREAM_SIZE  0x00000400
 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
 
+#define FILE_ACTION_ADDED		0x00000001
+#define FILE_ACTION_REMOVED		0x00000002
+#define FILE_ACTION_MODIFIED		0x00000003
+#define FILE_ACTION_RENAMED_OLD_NAME	0x00000004
+#define FILE_ACTION_RENAMED_NEW_NAME	0x00000005
+#define FILE_ACTION_ADDED_STREAM	0x00000006
+#define FILE_ACTION_REMOVED_STREAM	0x00000007
+#define FILE_ACTION_MODIFIED_STREAM	0x00000008
+
 /* response contains array of the following structures */
 struct file_notify_information {
 	__u32 NextEntryOffset;
@@ -988,9 +1046,12 @@
 
 /* PathInfo/FileInfo infolevels */
 #define SMB_INFO_STANDARD                   1
+#define SMB_INFO_QUERY_EAS_FROM_LIST        3
+#define SMB_INFO_QUERY_ALL_EAS              4
 #define SMB_INFO_IS_NAME_VALID              6
 #define SMB_QUERY_FILE_BASIC_INFO       0x101
 #define SMB_QUERY_FILE_STANDARD_INFO    0x102
+#define SMB_QUERY_FILE_EA_INFO          0x103
 #define SMB_QUERY_FILE_NAME_INFO        0x104
 #define SMB_QUERY_FILE_ALLOCATION_INFO  0x105
 #define SMB_QUERY_FILE_END_OF_FILEINFO  0x106
@@ -1010,8 +1071,13 @@
 #define SMB_SET_FILE_UNIX_HLINK         0x203
 #define SMB_SET_FILE_BASIC_INFO2        0x3ec
 #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2
+#define SMB_FILE_ALL_INFO2              0x3fa
 #define SMB_SET_FILE_ALLOCATION_INFO2   0x3fb
 #define SMB_SET_FILE_END_OF_FILE_INFO2  0x3fc
+#define SMB_FILE_MOVE_CLUSTER_INFO      0x407
+#define SMB_FILE_QUOTA_INFO             0x408
+#define SMB_FILE_REPARSEPOINT_INFO      0x409
+#define SMB_FILE_MAXIMUM_INFO           0x40d
 
 /* Find File infolevels */
 #define SMB_FIND_FILE_DIRECTORY_INFO      0x101
@@ -1273,6 +1339,7 @@
 	__u16 LastNameOffset;
 } T2_FNEXT_RSP_PARMS;
 
+/* QFSInfo Levels */
 #define SMB_INFO_ALLOCATION         1
 #define SMB_INFO_VOLUME             2
 #define SMB_QUERY_FS_VOLUME_INFO    0x102
@@ -1280,6 +1347,8 @@
 #define SMB_QUERY_FS_DEVICE_INFO    0x104
 #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
 #define SMB_QUERY_CIFS_UNIX_INFO    0x200
+#define SMB_QUERY_LABEL_INFO        0x3ea
+#define SMB_QUERY_FS_QUOTA_INFO     0x3ee
 
 typedef struct smb_com_transaction2_qfsi_req {
 	struct smb_hdr hdr;	/* wct = 14+ */
@@ -1621,16 +1690,17 @@
 };
 
 struct fea {
-	unsigned char fEA;
-	unsigned char cbName;
-	unsigned short cbValue;
+	unsigned char EA_flags;
+	__u8 name_len;
+	__u16 value_len;
 	char szName[1];
+	/* optionally followed by value */
 };
 /* flags for _FEA.fEA */
 #define FEA_NEEDEA         0x80	/* need EA bit */
 
 struct fealist {
-	unsigned long cbList;
+	__u32 list_len;
 	struct fea list[1];
 };
 
@@ -1640,6 +1710,83 @@
 	size_t length;
 	void (*free) (struct data_blob * data_blob);
 };
+
+#ifdef CONFIG_CIFS_POSIX
+/* 
+	For better POSIX semantics from Linux client, (even better
+	than the existing CIFS Unix Extensions) we need updated PDUs for:
+	
+	1) PosixCreateX - to set and return the mode, inode#, device info and
+	perhaps add a CreateDevice - to create Pipes and other special .inodes
+	Also note POSIX open flags
+	2) Close - to return the last write time to do cache across close more safely
+	3) PosixQFSInfo - to return statfs info
+	4) FindFirst return unique inode number - what about resume key, two forms short (matches readdir) and full (enough info to cache inodes)
+	5) Mkdir - set mode
+	
+	And under consideration: 
+	6) FindClose2 (return nanosecond timestamp ??)
+	7) Use nanosecond timestamps throughout all time fields if 
+	   corresponding attribute flag is set
+	8) sendfile - handle based copy
+	9) Direct i/o
+	10) "POSIX ACL" support
+	11) Misc fcntls?
+	
+	what about fixing 64 bit alignment
+	
+	There are also various legacy SMB/CIFS requests used as is
+	
+	From existing Lanman and NTLM dialects:
+	--------------------------------------
+	NEGOTIATE
+	SESSION_SETUP_ANDX (BB which?)
+	TREE_CONNECT_ANDX (BB which wct?)
+	TREE_DISCONNECT (BB add volume timestamp on response)
+	LOGOFF_ANDX
+	DELETE (note delete open file behavior)
+	DELETE_DIRECTORY
+	READ_AND_X
+	WRITE_AND_X
+	LOCKING_AND_X (note posix lock semantics)
+	RENAME (note rename across dirs and open file rename posix behaviors)
+	NT_RENAME (for hardlinks) Is this good enough for all features?
+	FIND_CLOSE2
+	TRANSACTION2 (18 cases)
+		SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2
+		(BB verify that never need to set allocation size)
+		SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via Unix ext?)
+	
+	COPY (note support for copy across directories) - FUTURE, OPTIONAL
+	setting/getting OS/2 EAs - FUTURE (BB can this handle
+	        setting Linux xattrs perfectly)         - OPTIONAL
+    dnotify                                         - FUTURE, OPTIONAL
+    quota                                           - FUTURE, OPTIONAL
+			
+	Note that various requests implemented for NT interop such as 
+		NT_TRANSACT (IOCTL) QueryReparseInfo
+	are unneeded to servers compliant with the CIFS POSIX extensions
+	
+	From CIFS Unix Extensions:
+	-------------------------
+	T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks
+	T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2)
+	T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK)
+	T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields
+					Actually need QUERY_FILE_UNIX_INFO since has inode num
+					BB what about a) blksize/blkbits/blocks
+								  b) i_version
+								  c) i_rdev
+								  d) notify mask?
+								  e) generation
+								  f) size_seqcount
+	T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX
+	TRANS2_GET_DFS_REFERRAL				  - OPTIONAL but recommended
+	T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL
+	
+	
+ */
+#endif 
 
 #pragma pack()			/* resume default structure packing */
 
diff -Nru a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
--- a/fs/cifs/cifsproto.h	Tue Jun 15 22:20:36 2004
+++ b/fs/cifs/cifsproto.h	Tue Jun 15 22:20:36 2004
@@ -239,8 +239,16 @@
 			int whence, unsigned long offset, long long *newoffset);
 
 extern int CIFSSMBCopy(int xid,
-			struct cifsTconInfo *ftcon,
-			char *fromName,
-			struct cifsTconInfo *ttcon,
-			char *toName, int ofun, int flags);
+			struct cifsTconInfo *source_tcon,
+			const char *fromName,
+			const __u16 target_tid,
+			const char *toName, const int flags,
+			const struct nls_table *nls_codepage);
+extern int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, 
+			const int notify_subdirs,const __u16 netfid,__u32 filter,
+			const struct nls_table *nls_codepage);
+extern int CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
+		 const unsigned char *searchName,
+		 char * EAData, size_t size,
+		 const struct nls_table *nls_codepage);
 #endif			/* _CIFSPROTO_H */
diff -Nru a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
--- a/fs/cifs/cifssmb.c	Tue Jun 15 22:20:37 2004
+++ b/fs/cifs/cifssmb.c	Tue Jun 15 22:20:37 2004
@@ -37,13 +37,24 @@
 #include "cifs_unicode.h"
 #include "cifs_debug.h"
 
+#ifdef CONFIG_CIFS_POSIX
 static struct {
 	int index;
 	char *name;
 } protocols[] = {
 	{CIFS_PROT, "\2NT LM 0.12"}, 
+	{CIFS_PROT, "\2POSIX 2"},
 	{BAD_PROT, "\2"}
 };
+#else
+static struct {
+	int index;
+	char *name;
+} protocols[] = {
+	{CIFS_PROT, "\2NT LM 0.12"}, 
+	{BAD_PROT, "\2"}
+};
+#endif
 
 
 /* Mark as invalid, all open files on tree connections since they
@@ -143,7 +154,8 @@
 		return rc;
 
 	*request_buf = cifs_buf_get();
-	if (request_buf == 0) {
+	if (*request_buf == 0) {
+		/* BB should we add a retry in here if not a writepage? */
 		return -ENOMEM;
 	}
     /* Although the original thought was we needed the response buf for  */
@@ -154,6 +166,12 @@
 
 	header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon,
 			wct /*wct */ );
+
+#ifdef CONFIG_CIFS_STATS
+        if(tcon != NULL) {
+                atomic_inc(&tcon->num_smbs_sent);
+        }
+#endif
 	return rc;
 }
 
@@ -365,8 +383,11 @@
 			 smb_buffer_response, &length, 0);
 	if (ses->server) {
 		atomic_dec(&ses->server->socketUseCount);
-		if (atomic_read(&ses->server->socketUseCount) == 0)
+		if (atomic_read(&ses->server->socketUseCount) == 0) {
+			spin_lock(&GlobalMid_Lock);
 			ses->server->tcpStatus = CifsExiting;
+			spin_unlock(&GlobalMid_Lock);
+		}
 	}
 	if (pSMB)
 		cifs_buf_release(pSMB);
@@ -418,7 +439,13 @@
 			 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
 	if (rc) {
 		cFYI(1, ("Error in RMFile = %d", rc));
-	}
+	} 
+#ifdef CONFIG_CIFS_STATS
+        else {
+		atomic_inc(&tcon->num_deletes);
+        }
+#endif
+
 	if (pSMB)
 		cifs_buf_release(pSMB);
 	if (rc == -EAGAIN)
@@ -465,6 +492,12 @@
 	if (rc) {
 		cFYI(1, ("Error in RMDir = %d", rc));
 	}
+#ifdef CONFIG_CIFS_STATS
+        else {
+		atomic_inc(&tcon->num_rmdirs);
+        }
+#endif
+
 	if (pSMB)
 		cifs_buf_release(pSMB);
 	if (rc == -EAGAIN)
@@ -510,6 +543,11 @@
 	if (rc) {
 		cFYI(1, ("Error in Mkdir = %d", rc));
 	}
+#ifdef CONFIG_CIFS_STATS
+        else {
+		atomic_inc(&tcon->num_mkdirs);
+        }
+#endif
 	if (pSMB)
 		cifs_buf_release(pSMB);
 	if (rc == -EAGAIN)
@@ -606,6 +644,10 @@
 		    pfile_info->EndOfFile = pSMBr->EndOfFile;
 		    pfile_info->NumberOfLinks = cpu_to_le32(1);
 		}
+
+#ifdef CONFIG_CIFS_STATS
+		atomic_inc(&tcon->num_opens);
+#endif
 	}
 	if (pSMB)
 		cifs_buf_release(pSMB);
@@ -728,7 +770,7 @@
 	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
 			 (struct smb_hdr *) pSMBr, &bytes_returned, long_op);
 	if (rc) {
-		cERROR(1, ("Send error in write = %d", rc));
+		cFYI(1, ("Send error in write = %d", rc));
 		*nbytes = 0;
 	} else
 		*nbytes = le16_to_cpu(pSMBr->Count);
@@ -792,7 +834,7 @@
 			 (struct smb_hdr *) pSMBr, &bytes_returned, timeout);
 
 	if (rc) {
-		cERROR(1, ("Send error in Lock = %d", rc));
+		cFYI(1, ("Send error in Lock = %d", rc));
 	}
 	if (pSMB)
 		cifs_buf_release(pSMB);
@@ -892,7 +934,6 @@
 	}
 
 	pSMB->ByteCount = 1 /* 1st signature byte */  + name_len + name_len2;
-    /* we could also set search attributes but not needed */
 	pSMB->hdr.smb_buf_length += pSMB->ByteCount;
 	pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
 
@@ -986,6 +1027,76 @@
 	return rc;
 }
 
+int
+CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, 
+            const __u16 target_tid, const char *toName, const int flags,
+            const struct nls_table *nls_codepage)
+{
+	int rc = 0;
+	COPY_REQ *pSMB = NULL;
+	COPY_RSP *pSMBr = NULL;
+	int bytes_returned;
+	int name_len, name_len2;
+
+	cFYI(1, ("In CIFSSMBCopy"));
+copyRetry:
+	rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
+			(void **) &pSMBr);
+	if (rc)
+		return rc;
+
+	pSMB->BufferFormat = 0x04;
+	pSMB->Tid2 = target_tid;
+
+	if(flags & COPY_TREE)
+		pSMB->Flags |= COPY_TREE;
+	pSMB->Flags = cpu_to_le16(pSMB->Flags);
+
+	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
+		name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName, 
+				fromName, 
+				530 /* find define for this maxpathcomponent */,
+				nls_codepage);
+		name_len++;     /* trailing null */
+		name_len *= 2;
+		pSMB->OldFileName[name_len] = 0x04;     /* pad */
+		/* protocol requires ASCII signature byte on Unicode string */
+		pSMB->OldFileName[name_len + 1] = 0x00;
+		name_len2 = cifs_strtoUCS((wchar_t *) & pSMB->
+				OldFileName[name_len + 2], toName, 530,
+				nls_codepage);
+		name_len2 += 1 /* trailing null */  + 1 /* Signature word */ ;
+		name_len2 *= 2; /* convert to bytes */
+	} else {                /* BB improve the check for buffer overruns BB */
+		name_len = strnlen(fromName, 530);
+		name_len++;     /* trailing null */
+		strncpy(pSMB->OldFileName, fromName, name_len);
+		name_len2 = strnlen(toName, 530);
+		name_len2++;    /* trailing null */
+		pSMB->OldFileName[name_len] = 0x04;  /* 2nd buffer format */
+		strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
+		name_len2++;    /* trailing null */
+		name_len2++;    /* signature byte */
+	}
+
+	pSMB->ByteCount = 1 /* 1st signature byte */  + name_len + name_len2;
+	pSMB->hdr.smb_buf_length += pSMB->ByteCount;
+	pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
+
+	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
+		(struct smb_hdr *) pSMBr, &bytes_returned, 0);
+	if (rc) {
+		cFYI(1, ("Send error in copy = %d with %d files copied",
+			rc, pSMBr->CopyCount));
+	}
+	if (pSMB)
+		cifs_buf_release(pSMB);
+
+	if (rc == -EAGAIN)
+		goto copyRetry;
+
+	return rc;
+}
 
 int
 CIFSUnixCreateSymLink(const int xid, struct cifsTconInfo *tcon,
@@ -1356,9 +1467,9 @@
 
 	pSMB->TotalParameterCount = 0 ;
 	pSMB->TotalDataCount = 0;
-	pSMB->MaxParameterCount = cpu_to_le16(2);
+	pSMB->MaxParameterCount = cpu_to_le32(2);
 	/* BB find exact data count max from sess structure BB */
-	pSMB->MaxDataCount = cpu_to_le16(4000);
+	pSMB->MaxDataCount = cpu_to_le32(4000);
 	pSMB->MaxSetupCount = 4;
 	pSMB->Reserved = 0;
 	pSMB->ParameterOffset = 0;
@@ -1485,6 +1596,8 @@
 	} else {		/* decode response */
 		pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
 		/* BB also check enough total bytes returned */
+		/* BB we need to improve the validity checking
+		of these trans2 responses */
 		if ((pSMBr->ByteCount < 40) || (pSMBr->DataOffset > 512)) 
 			rc = -EIO;	/* bad smb */
 		else if (pFindData){
@@ -2211,6 +2324,11 @@
 			    (FILE_SYSTEM_ATTRIBUTE_INFO
 			     *) (((char *) &pSMBr->hdr.Protocol) +
 				 pSMBr->DataOffset);
+			response_data->Attributes = le32_to_cpu(response_data->Attributes);
+			response_data->MaxPathNameComponentLength = 
+				le32_to_cpu(response_data->MaxPathNameComponentLength);
+			response_data->FileSystemNameLen = 
+				le32_to_cpu(response_data->FileSystemNameLen);
 			memcpy(&tcon->fsAttrInfo, response_data,
 			       sizeof (FILE_SYSTEM_ATTRIBUTE_INFO));
 		}
@@ -2280,6 +2398,10 @@
 			    (FILE_SYSTEM_DEVICE_INFO
 			     *) (((char *) &pSMBr->hdr.Protocol) +
 				 pSMBr->DataOffset);
+			response_data->DeviceType = 
+				le32_to_cpu(response_data->DeviceType);
+			response_data->DeviceCharacteristics = 
+				le32_to_cpu(response_data->DeviceCharacteristics);
 			memcpy(&tcon->fsDevInfo, response_data,
 			       sizeof (FILE_SYSTEM_DEVICE_INFO));
 		}
@@ -2290,7 +2412,6 @@
 	if (rc == -EAGAIN)
 		goto QFSDeviceRetry;
 
-
 	return rc;
 }
 
@@ -2348,6 +2469,12 @@
 			    (FILE_SYSTEM_UNIX_INFO
 			     *) (((char *) &pSMBr->hdr.Protocol) +
 				 pSMBr->DataOffset);
+			response_data->MajorVersionNumber =
+				le16_to_cpu(response_data->MajorVersionNumber);
+			response_data->MinorVersionNumber =
+				le16_to_cpu(response_data->MinorVersionNumber);
+			response_data->Capability =
+				le64_to_cpu(response_data->Capability);
 			memcpy(&tcon->fsUnixInfo, response_data,
 			       sizeof (FILE_SYSTEM_UNIX_INFO));
 		}
@@ -2511,7 +2638,7 @@
 		(struct file_end_of_file_info *) (((char *) &pSMB->hdr.Protocol) +
 			pSMB->DataOffset);
 	pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset); /* now safe to change to le */
-	parm_data->FileSize = size;
+	parm_data->FileSize = cpu_to_le64(size);
 	pSMB->Fid = fid;
 	if(SetAllocation) {
 		if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU)
@@ -2706,3 +2833,149 @@
 		goto setPermsRetry;
 	return rc;
 }
+
+int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, 
+			const int notify_subdirs, const __u16 netfid,
+			__u32 filter, const struct nls_table *nls_codepage)
+{
+	int rc = 0;
+	struct smb_com_transaction_change_notify_req * pSMB = NULL;
+	struct smb_com_transaction_change_notify_rsp * pSMBr = NULL;
+	int bytes_returned;
+
+	cFYI(1, ("In CIFSSMBNotify for file handle %d",(int)netfid));
+	rc = smb_init(SMB_COM_NT_TRANSACT, 23, tcon, (void **) &pSMB,
+                      (void **) &pSMBr);
+	if (rc)
+		return rc;
+
+	pSMB->TotalParameterCount = 0 ;
+	pSMB->TotalDataCount = 0;
+	pSMB->MaxParameterCount = cpu_to_le32(2);
+	/* BB find exact data count max from sess structure BB */
+	pSMB->MaxDataCount = 0; /* same in little endian or be */
+	pSMB->MaxSetupCount = 4;
+	pSMB->Reserved = 0;
+	pSMB->ParameterOffset = 0;
+	pSMB->DataCount = 0;
+	pSMB->DataOffset = 0;
+	pSMB->SetupCount = 4; /* single byte does not need le conversion */
+	pSMB->SubCommand = cpu_to_le16(NT_TRANSACT_NOTIFY_CHANGE);
+	pSMB->ParameterCount = pSMB->TotalParameterCount;
+	if(notify_subdirs)
+		pSMB->WatchTree = 1; /* one byte - no le conversion needed */
+	pSMB->Reserved2 = 0;
+	pSMB->CompletionFilter = cpu_to_le32(filter);
+	pSMB->Fid = netfid; /* file handle always le */
+	pSMB->ByteCount = 0;
+
+	pSMB->hdr.smb_buf_length += pSMB->ByteCount;
+	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
+			(struct smb_hdr *) pSMBr, &bytes_returned, 0);
+	if (rc) {
+		cFYI(1, ("Error in Notify = %d", rc));
+	}
+	if (pSMB)
+		cifs_buf_release(pSMB);
+/*		if (rc == -EAGAIN)
+			goto NotifyRetry; */
+	return rc;	
+}
+#ifdef CONFIG_CIFS_XATTR
+int
+CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
+		 const unsigned char *searchName,
+		 char * EAData, size_t size,
+		 const struct nls_table *nls_codepage)
+{
+		/* BB assumes one setup word */
+	TRANSACTION2_QPI_REQ *pSMB = NULL;
+	TRANSACTION2_QPI_RSP *pSMBr = NULL;
+	int rc = 0;
+	int bytes_returned;
+	int name_len;
+
+	cFYI(1, ("In Query All EAs path %s", searchName));
+QAllEAsRetry:
+	rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
+		      (void **) &pSMBr);
+	if (rc)
+		return rc;
+
+	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
+		name_len =
+		    cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+				  /* find define for this maxpathcomponent */
+				  , nls_codepage);
+		name_len++;	/* trailing null */
+		name_len *= 2;
+	} else {		/* BB improve the check for buffer overruns BB */
+		name_len = strnlen(searchName, 530);
+		name_len++;	/* trailing null */
+		strncpy(pSMB->FileName, searchName, name_len);
+	}
+
+	pSMB->TotalParameterCount = 2 /* level */  + 4 /* reserved */  +
+	    name_len /* includes null */ ;
+	pSMB->TotalDataCount = 0;
+	pSMB->MaxParameterCount = cpu_to_le16(2);
+	pSMB->MaxDataCount = cpu_to_le16(4000);	/* BB find exact max SMB PDU from sess structure BB */
+	pSMB->MaxSetupCount = 0;
+	pSMB->Reserved = 0;
+	pSMB->Flags = 0;
+	pSMB->Timeout = 0;
+	pSMB->Reserved2 = 0;
+	pSMB->ParameterOffset = cpu_to_le16(offsetof(
+        struct smb_com_transaction2_qpi_req ,InformationLevel) - 4);
+	pSMB->DataCount = 0;
+	pSMB->DataOffset = 0;
+	pSMB->SetupCount = 1;
+	pSMB->Reserved3 = 0;
+	pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
+	pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
+	pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
+	pSMB->ParameterCount = pSMB->TotalParameterCount;
+	pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS);
+	pSMB->Reserved4 = 0;
+	pSMB->hdr.smb_buf_length += pSMB->ByteCount;
+	pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
+
+	rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
+			 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
+	if (rc) {
+		cFYI(1, ("Send error in QueryAllEAs = %d", rc));
+	} else {		/* decode response */
+		pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
+		/* BB also check enough total bytes returned */
+		/* BB we need to improve the validity checking
+		of these trans2 responses */
+		if ((pSMBr->ByteCount < 4) || (pSMBr->DataOffset > 512)) 
+			rc = -EIO;	/* bad smb */
+	   /* else if (pFindData){
+			memcpy((char *) pFindData,
+			       (char *) &pSMBr->hdr.Protocol +
+			       pSMBr->DataOffset, kl);
+		}*/ else {
+			/* check that length of list is not more than bcc */
+			/* check that each entry does not go beyond length
+			   of list */
+			/* check that each element of each entry does not
+			   go beyond end of list */
+			struct fealist * ea_response_data;
+			rc = 0;
+			/* validate_trans2_offsets() */
+			/* BB to check if(start of smb + pSMBr->DataOffset > &bcc+ bcc)*/
+			ea_response_data = (struct fealist *)
+				(((char *) &pSMBr->hdr.Protocol) +
+				pSMBr->DataOffset);
+			cFYI(1,("ea length %d",ea_response_data->list_len));
+		}
+	}
+	if (pSMB)
+		cifs_buf_release(pSMB);
+	if (rc == -EAGAIN)
+		goto QAllEAsRetry;
+
+	return rc;
+}
+#endif
diff -Nru a/fs/cifs/connect.c b/fs/cifs/connect.c
--- a/fs/cifs/connect.c	Tue Jun 15 22:20:58 2004
+++ b/fs/cifs/connect.c	Tue Jun 15 22:20:58 2004
@@ -63,6 +63,7 @@
 	mode_t dir_mode;
 	int rw:1;
 	int retry:1;
+	int intr:1;
 	unsigned int rsize;
 	unsigned int wsize;
 	unsigned int sockopt;
@@ -94,9 +95,15 @@
 	struct cifsTconInfo *tcon;
 	struct mid_q_entry * mid_entry;
 	
-	if(server->tcpStatus == CifsExiting)
+	spin_lock(&GlobalMid_Lock);
+	if(server->tcpStatus == CifsExiting) {
+		/* the demux thread will exit normally 
+		next time through the loop */
+		spin_unlock(&GlobalMid_Lock);
 		return rc;
-	server->tcpStatus = CifsNeedReconnect;
+	} else
+		server->tcpStatus = CifsNeedReconnect;
+	spin_unlock(&GlobalMid_Lock);
 	server->maxBuf = 0;
 
 	cFYI(1, ("Reconnecting tcp session "));
@@ -121,7 +128,8 @@
 		}
 	}
 	read_unlock(&GlobalSMBSeslock);
-
+	/* do not want to be sending data on a socket we are freeing */
+	down(&server->tcpSem); 
 	if(server->ssocket) {
 		cFYI(1,("State: 0x%x Flags: 0x%lx", server->ssocket->state,
 			server->ssocket->flags));
@@ -147,7 +155,7 @@
 		}
 	}
 	spin_unlock(&GlobalMid_Lock);
-
+	up(&server->tcpSem); 
 
 	while ((server->tcpStatus != CifsExiting) && (server->tcpStatus != CifsGood))
 	{
@@ -163,7 +171,11 @@
 			schedule_timeout(3 * HZ);
 		} else {
 			atomic_inc(&tcpSesReconnectCount);
-			server->tcpStatus = CifsGood;
+			spin_lock(&GlobalMid_Lock);
+			if(server->tcpStatus != CifsExiting)
+				server->tcpStatus = CifsGood;
+			spin_unlock(&GlobalMid_Lock);
+			atomic_set(&server->inFlight,0);
 			wake_up(&server->response_q);
 		}
 	}
@@ -241,12 +253,14 @@
 				/* some servers kill tcp session rather than returning
 					smb negprot error in which case reconnecting here is
 					not going to help - return error to mount */
+				spin_lock(&GlobalMid_Lock);
 				server->tcpStatus = CifsExiting;
+				spin_unlock(&GlobalMid_Lock);
 				wake_up(&server->response_q);
 				break;
 			}
 
-			cFYI(1,("Reconnecting after unexpected rcvmsg error "));
+			cFYI(1,("Reconnecting after unexpected peek error %d",length));
 			cifs_reconnect(server);
 			csocket = server->ssocket;
 			wake_up(&server->response_q);
@@ -266,7 +280,7 @@
 				length = sock_recvmsg(csocket, &smb_msg, 4, 0);
 				cFYI(0,("Received 4 byte keep alive packet"));
 			} else if (temp[0] == (char) RFC1002_POSITIVE_SESSION_RESPONSE) {
-				iov.iov_base = smb_buffer;
+					iov.iov_base = smb_buffer;
 					iov.iov_len = 4;
 					length = sock_recvmsg(csocket, &smb_msg, 4, 0);
 					cFYI(1,("Good RFC 1002 session rsp"));
@@ -278,7 +292,9 @@
 					/* if nack on negprot (rather than 
 					ret of smb negprot error) reconnecting
 					not going to help, ret error to mount */
+					spin_lock(&GlobalMid_Lock);
 					server->tcpStatus = CifsExiting;
+					spin_unlock(&GlobalMid_Lock);
 					/* wake up thread doing negprot */
 					wake_up(&server->response_q);
 					break;
@@ -389,8 +405,16 @@
 			}
 		}
 	}
-   
+	spin_lock(&GlobalMid_Lock);
 	server->tcpStatus = CifsExiting;
+	spin_unlock(&GlobalMid_Lock);
+	atomic_set(&server->inFlight, 0);
+	/* Although there should not be any requests blocked on 
+	this queue it can not hurt to be paranoid and try to wake up requests
+	that may haven been blocked when more than 50 at time were on the wire 
+	to the same server - they now will see the session is in exit state
+	and get out of SendReceive.  */
+	wake_up_all(&server->request_q);   
 	server->tsk = NULL;
 	if(server->ssocket) {
 		sock_release(csocket);
@@ -587,6 +611,8 @@
 			}
 			if ((temp_len = strnlen(value, 300)) < 300) {
 				vol->UNC = kmalloc(temp_len+1,GFP_KERNEL);
+				if(vol->UNC == NULL)
+					return 1;
 				strcpy(vol->UNC,value);
 				if (strncmp(vol->UNC, "//", 2) == 0) {
 					vol->UNC[0] = '\\';
@@ -699,6 +725,7 @@
 				   (strnicmp(data, "exec", 4) == 0) ||
 				   (strnicmp(data, "noexec", 6) == 0) ||
 				   (strnicmp(data, "nodev", 5) == 0) ||
+				   (strnicmp(data, "noauto", 6) == 0) ||
 				   (strnicmp(data, "dev", 3) == 0)) {
 			/*  The mount tool or mount.cifs helper (if present)
 				uses these opts to set flags, and the flags are read
@@ -717,6 +744,12 @@
 			vol->retry = 0;
 		} else if (strnicmp(data, "nosoft", 6) == 0) {
 			vol->retry = 1;
+		} else if (strnicmp(data, "nointr", 6) == 0) {
+			vol->intr = 0;
+		} else if (strnicmp(data, "intr", 4) == 0) {
+			vol->intr = 1;
+		} else if (strnicmp(data, "noac", 4) == 0) {
+			printk(KERN_WARNING "CIFS: Mount option noac not supported. Instead set /proc/fs/cifs/LookupCacheEnabled to 0\n");
 		} else
 			printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data);
 	}
@@ -727,6 +760,8 @@
 		}
 		if ((temp_len = strnlen(devname, 300)) < 300) {
 			vol->UNC = kmalloc(temp_len+1,GFP_KERNEL);
+			if(vol->UNC == NULL)
+				return 1;
 			strcpy(vol->UNC,devname);
 			if (strncmp(vol->UNC, "//", 2) == 0) {
 				vol->UNC[0] = '\\';
@@ -908,7 +943,7 @@
 		} else {
 		/* BB other socket options to set KEEPALIVE, NODELAY? */
 			cFYI(1,("Socket created"));
-	/*		(*csocket)->sk->allocation = GFP_NOFS; */ /* BB is there equivalent in 2.6 */
+			(*csocket)->sk->sk_allocation = GFP_NOFS; 
 		}
 	}
 
@@ -1015,6 +1050,7 @@
 		} else {
 		/* BB other socket options to set KEEPALIVE, NODELAY? */
 			 cFYI(1,("ipv6 Socket created"));
+			(*csocket)->sk->sk_allocation = GFP_NOFS;
 		}
 	}
 
@@ -1202,12 +1238,17 @@
 			return rc;
 		} else {
 			memset(srvTcp, 0, sizeof (struct TCP_Server_Info));
-			memcpy(&srvTcp->addr.sockAddr, &sin_server, sizeof (struct sockaddr_in));	
-            /* BB Add code for ipv6 case too */
+			memcpy(&srvTcp->addr.sockAddr, &sin_server, sizeof (struct sockaddr_in));
+			atomic_set(&srvTcp->inFlight,0);
+			/* BB Add code for ipv6 case too */
 			srvTcp->ssocket = csocket;
 			srvTcp->protocolType = IPV4;
 			init_waitqueue_head(&srvTcp->response_q);
+			init_waitqueue_head(&srvTcp->request_q);
 			INIT_LIST_HEAD(&srvTcp->pending_mid_q);
+			/* at this point we are the only ones with the pointer
+			to the struct since the kernel thread not created yet
+			so no need to spinlock this init of tcpStatus */
 			srvTcp->tcpStatus = CifsNew;
 			init_MUTEX(&srvTcp->tcpSem);
 			kernel_thread((void *)(void *)cifs_demultiplex_thread, srvTcp,
@@ -1324,9 +1365,12 @@
 
 /* on error free sesinfo and tcon struct if needed */
 	if (rc) {
-		if(atomic_read(&srvTcp->socketUseCount) == 0)
-                	srvTcp->tcpStatus = CifsExiting;
-		           /* If find_unc succeeded then rc == 0 so we can not end */
+		if(atomic_read(&srvTcp->socketUseCount) == 0) {
+			spin_lock(&GlobalMid_Lock);
+			srvTcp->tcpStatus = CifsExiting;
+			spin_unlock(&GlobalMid_Lock);
+		}
+		 /* If find_unc succeeded then rc == 0 so we can not end */
 		if (tcon)  /* up here accidently freeing someone elses tcon struct */
 			tconInfoFree(tcon);
 		if (existingCifsSes == 0) {
@@ -1516,7 +1560,7 @@
 					bcc_ptr +=
 					    pSMBr->resp.SecurityBlobLength;
 
-				if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
+				if (smb_buffer->Flags2 & SMBFLG2_UNICODE) {
 					if ((long) (bcc_ptr) % 2) {
 						remaining_words =
 						    (BCC(smb_buffer_response)
@@ -1769,7 +1813,7 @@
 					      pSMBr->resp.SecurityBlobLength));
 				}
 
-				if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
+				if (smb_buffer->Flags2 & SMBFLG2_UNICODE) {
 					if ((long) (bcc_ptr) % 2) {
 						remaining_words =
 						    (BCC(smb_buffer_response)
@@ -2080,7 +2124,7 @@
 						ses->server->secMode |= 
 							SECMODE_SIGN_ENABLED;
 
-				if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
+				if (smb_buffer->Flags2 & SMBFLG2_UNICODE) {
 					if ((long) (bcc_ptr) % 2) {
 						remaining_words =
 						    (BCC(smb_buffer_response)
@@ -2476,7 +2520,7 @@
 				cFYI(1,
 				     ("NTLMSSP response to Authenticate "));
 
-				if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
+				if (smb_buffer->Flags2 & SMBFLG2_UNICODE) {
 					if ((long) (bcc_ptr) % 2) {
 						remaining_words =
 						    (BCC(smb_buffer_response)
@@ -2675,7 +2719,7 @@
         /* skip service field (NB: this field is always ASCII) */
 		bcc_ptr += length + 1;	
 		strncpy(tcon->treeName, tree, MAX_TREE_SIZE);
-		if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
+		if (smb_buffer->Flags2 & SMBFLG2_UNICODE) {
 			length = UniStrnlen((wchar_t *) bcc_ptr, 512);
 			if (((long) bcc_ptr + (2 * length)) -
 			    (long) pByteArea(smb_buffer_response) <=
@@ -2743,6 +2787,7 @@
 				FreeXid(xid);
 				return 0;
 			}
+ 
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(HZ / 4);	/* give captive thread time to exit */
 			if((ses->server) && (ses->server->ssocket)) {            
@@ -2772,7 +2817,7 @@
 	char ntlm_session_key[CIFS_SESSION_KEY_SIZE];
 	int ntlmv2_flag = FALSE;
 
-    /* what if server changes its buffer size after dropping the session? */
+	/* what if server changes its buffer size after dropping the session? */
 	if(pSesInfo->server->maxBuf == 0) /* no need to send on reconnect */ {
 		rc = CIFSSMBNegotiate(xid, pSesInfo);
 		if(rc == -EAGAIN) /* retry only once on 1st time connection */ {
@@ -2780,8 +2825,15 @@
 			if(rc == -EAGAIN) 
 				rc = -EHOSTDOWN;
 		}
-		if(rc == 0)
-			pSesInfo->server->tcpStatus = CifsGood;
+		if(rc == 0) {
+			spin_lock(&GlobalMid_Lock);
+			if(pSesInfo->server->tcpStatus != CifsExiting)
+				pSesInfo->server->tcpStatus = CifsGood;
+			else
+				rc = -EHOSTDOWN;
+			spin_unlock(&GlobalMid_Lock);
+
+		}
 	}
 	if (!rc) {
 		pSesInfo->capabilities = pSesInfo->server->capabilities;
diff -Nru a/fs/cifs/dir.c b/fs/cifs/dir.c
--- a/fs/cifs/dir.c	Tue Jun 15 22:20:42 2004
+++ b/fs/cifs/dir.c	Tue Jun 15 22:20:42 2004
@@ -38,7 +38,7 @@
 	do {
 		direntry->d_time = jiffies;
 		direntry = direntry->d_parent;
-	} while (!IS_ROOT(direntry));	/* BB for DFS case should stop at the root of share which could be lower than root of this mount due to implicit dfs connections */
+	} while (!IS_ROOT(direntry));	
 }
 
 /* Note: caller must free return buffer */
@@ -49,14 +49,26 @@
 	int namelen = 0;
 	char *full_path;
 
+	if(direntry == NULL)
+		return NULL;  /* not much we can do if dentry is freed and
+		we need to reopen the file after it was closed implicitly
+		when the server crashed */
+
+cifs_bp_rename_retry:
 	for (temp = direntry; !IS_ROOT(temp);) {
 		namelen += (1 + temp->d_name.len);
 		temp = temp->d_parent;
+		if(temp == NULL) {
+			cERROR(1,("corrupt dentry"));
+			return NULL;
+		}
 	}
-	namelen += 1;		/* allow for trailing null */
-	full_path = kmalloc(namelen, GFP_KERNEL);
-	namelen--;
+
+	full_path = kmalloc(namelen+1, GFP_KERNEL);
+	if(full_path == NULL)
+		return full_path;
 	full_path[namelen] = 0;	/* trailing null */
+
 	for (temp = direntry; !IS_ROOT(temp);) {
 		namelen -= 1 + temp->d_name.len;
 		if (namelen < 0) {
@@ -68,11 +80,23 @@
 			cFYI(0, (" name: %s ", full_path + namelen));
 		}
 		temp = temp->d_parent;
+		if(temp == NULL) {
+			cERROR(1,("corrupt dentry"));
+			kfree(full_path);
+			return NULL;
+		}
 	}
-	if (namelen != 0)
+	if (namelen != 0) {
 		cERROR(1,
 		       ("We did not end path lookup where we expected namelen is %d",
 			namelen));
+		/* presumably this is only possible if we were racing with a rename 
+		of one of the parent directories  (we can not lock the dentries
+		above us to prevent this, but retrying should be harmless) */
+		kfree(full_path);
+		namelen = 0;
+		goto cifs_bp_rename_retry;
+	}
 
 	return full_path;
 }
@@ -135,22 +159,28 @@
 	struct cifsFileInfo * pCifsFile = NULL;
 	struct cifsInodeInfo * pCifsInode;
 	int disposition = FILE_OVERWRITE_IF;
+	int write_only = FALSE;
 
 	xid = GetXid();
 
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+	down(&direntry->d_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(direntry);
+	up(&direntry->d_sb->s_vfs_rename_sem);
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 
-	if(nd) { 
-		cFYI(1,("In create for inode %p dentry->inode %p nd flags = 0x%x for %s",inode, direntry->d_inode, nd->flags,full_path));
-
+	if(nd) {
 		if ((nd->intent.open.flags & O_ACCMODE) == O_RDONLY)
 			desiredAccess = GENERIC_READ;
-		else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY)
+		else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY) {
 			desiredAccess = GENERIC_WRITE;
-		else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) {
+			write_only = TRUE;
+		} else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) {
 			/* GENERIC_ALL is too much permission to request */
 			/* can cause unnecessary access denied on create */
 			/* desiredAccess = GENERIC_ALL; */
@@ -173,6 +203,12 @@
 		oplock = REQ_OPLOCK;
 
 	buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
+	if(buf == NULL) {
+		kfree(full_path);
+		FreeXid(xid);
+		return -ENOMEM;
+	}
+
 	rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
 			 desiredAccess, CREATE_NOT_DIR,
 			 &fileHandle, &oplock, buf, cifs_sb->local_nls);
@@ -228,16 +264,25 @@
 				pCifsFile->invalidHandle = FALSE;
 				pCifsFile->closePend     = FALSE;
 				init_MUTEX(&pCifsFile->fh_sem);
-				/* pCifsFile->pfile = file; */ /* put in at open time */
+				/* put the following in at open now */
+				/* pCifsFile->pfile = file; */ 
 				write_lock(&GlobalSMBSeslock);
 				list_add(&pCifsFile->tlist,&pTcon->openFileList);
 				pCifsInode = CIFS_I(newinode);
 				if(pCifsInode) {
-					list_add(&pCifsFile->flist,&pCifsInode->openFileList);
+				/* if readable file instance put first in list*/
+					if (write_only == TRUE) {
+                                        	list_add_tail(&pCifsFile->flist,
+							&pCifsInode->openFileList);
+					} else {
+						list_add(&pCifsFile->flist,
+							&pCifsInode->openFileList);
+					}
 					if((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
 						pCifsInode->clientCanCacheAll = TRUE;
 						pCifsInode->clientCanCacheRead = TRUE;
-						cFYI(1,("Exclusive Oplock granted on inode %p",newinode));
+						cFYI(1,("Exclusive Oplock granted on inode %p",
+							newinode));
 					} else if((oplock & 0xF) == OPLOCK_READ)
 						pCifsInode->clientCanCacheRead = TRUE;
 				}
@@ -272,9 +317,13 @@
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+	down(&direntry->d_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(direntry);
-
-	if (pTcon->ses->capabilities & CAP_UNIX) {
+	up(&direntry->d_sb->s_vfs_rename_sem);
+	if(full_path == NULL)
+		rc = -ENOMEM;
+	
+	if (full_path && (pTcon->ses->capabilities & CAP_UNIX)) {
 		rc = CIFSSMBUnixSetPerms(xid, pTcon,
 			full_path, mode, current->euid, current->egid,
 			device_number, cifs_sb->local_nls);
@@ -298,7 +347,8 @@
 struct dentry *
 cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct nameidata *nd)
 {
-	int rc, xid;
+	int xid;
+	int rc = 0; /* to get around spurious gcc warning, set to zero here */
 	struct cifs_sb_info *cifs_sb;
 	struct cifsTconInfo *pTcon;
 	struct inode *newInode = NULL;
@@ -320,7 +370,15 @@
 	cifs_sb = CIFS_SB(parent_dir_inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+	/* can not grab the rename sem here since it would
+	deadlock in the cases (beginning of sys_rename itself)
+	in which we already have the sb rename sem */
 	full_path = build_path_from_dentry(direntry);
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return ERR_PTR(-ENOMEM);
+	}
+
 	if (direntry->d_inode != NULL) {
 		cFYI(1, (" non-NULL inode in lookup"));
 	} else {
@@ -347,10 +405,10 @@
 		rc = 0;
 		d_add(direntry, NULL);
 	} else {
-		cERROR(1,
-		       ("Error 0x%x or (%d decimal) on cifs_get_inode_info in lookup",
-			rc, rc));
-		/* BB special case check for Access Denied - watch security exposure of returning dir info implicitly via different rc if file exists or not but no access BB */
+		cERROR(1,("Error 0x%x or on cifs_get_inode_info in lookup",rc));
+		/* BB special case check for Access Denied - watch security 
+		exposure of returning dir info implicitly via different rc 
+		if file exists or not but no access BB */
 	}
 
 	if (full_path)
diff -Nru a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c
--- a/fs/cifs/fcntl.c	Tue Jun 15 22:20:43 2004
+++ b/fs/cifs/fcntl.c	Tue Jun 15 22:20:43 2004
@@ -32,16 +32,41 @@
 {
 	int xid;
 	int rc = -EINVAL;
+	int oplock = FALSE;
 	struct cifs_sb_info *cifs_sb;
 	struct cifsTconInfo *pTcon;
 	char *full_path = NULL;
+	__u32 filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES;
+    __u16 netfid;
 
 	xid = GetXid();
 	cifs_sb = CIFS_SB(file->f_dentry->d_sb);
 	pTcon = cifs_sb->tcon;
+
+	down(&file->f_dentry->d_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(file->f_dentry);
-	cFYI(1,("cifs dir notify on file %s",full_path));
-	/* CIFSSMBNotify */
+	up(&file->f_dentry->d_sb->s_vfs_rename_sem);
+
+	if(full_path == NULL) {
+		rc = -ENOMEM;
+	} else {
+		cFYI(1,("cifs dir notify on file %s",full_path));
+		rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, 
+			GENERIC_READ | SYNCHRONIZE, 0 /* create options */,
+			&netfid, &oplock,NULL, cifs_sb->local_nls);
+		/* BB fixme - add this handle to a notify handle list */
+		if(rc) {
+			cFYI(1,("Could not open directory for notify"));
+		} else {
+			rc = CIFSSMBNotify(xid, pTcon, 1 /* subdirs */, netfid, 
+				filter, cifs_sb->local_nls);
+			/* BB add code to close file eventually (at unmount
+			it would close automatically but may be a way
+			to do it easily when inode freed or when
+			notify info is cleared/changed */
+		}
+	}
+	
 	FreeXid(xid);
 	return rc;
 }
diff -Nru a/fs/cifs/file.c b/fs/cifs/file.c
--- a/fs/cifs/file.c	Tue Jun 15 22:20:35 2004
+++ b/fs/cifs/file.c	Tue Jun 15 22:20:35 2004
@@ -80,7 +80,13 @@
 		}
 	}
 
+	down(&inode->i_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(file->f_dentry);
+	up(&inode->i_sb->s_vfs_rename_sem);
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 
 	cFYI(1, (" inode = 0x%p file flags are 0x%x for %s", inode, file->f_flags,full_path));
 	if ((file->f_flags & O_ACCMODE) == O_RDONLY)
@@ -137,6 +143,10 @@
 	/* Also refresh inode by passing in file_info buf returned by SMBOpen 
 	   and calling get_inode_info with returned buf (at least 
 	   helps non-Unix server case */
+
+	/* BB we can not do this if this is the second open of a file 
+	and the first handle has writebehind data, we might be 
+	able to simply do a filemap_fdatawrite/filemap_fdatawait first */
 	buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
 	if(buf==0) {
 		if (full_path)
@@ -150,8 +160,6 @@
 		cFYI(1, ("cifs_open returned 0x%x ", rc));
 		cFYI(1, ("oplock: %d ", oplock));	
 	} else {
-		if(file->private_data)
-			kfree(file->private_data);
 		file->private_data =
 			kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL);
 		if (file->private_data) {
@@ -169,7 +177,14 @@
 			list_add(&pCifsFile->tlist,&pTcon->openFileList);
 			pCifsInode = CIFS_I(file->f_dentry->d_inode);
 			if(pCifsInode) {
-				list_add(&pCifsFile->flist,&pCifsInode->openFileList);
+				/* want handles we can use to read with first */
+				/* in the list so we do not have to walk the */
+				/* list to search for one in prepare_write */
+				if ((file->f_flags & O_ACCMODE) == O_WRONLY) {
+					list_add_tail(&pCifsFile->flist,&pCifsInode->openFileList);
+				} else {
+					list_add(&pCifsFile->flist,&pCifsInode->openFileList);
+				}
 				write_unlock(&GlobalSMBSeslock);
 				write_unlock(&file->f_owner.lock);
 				if(pCifsInode->clientCanCacheRead) {
@@ -252,7 +267,7 @@
 	return rc;
 }
 
-static int cifs_reopen_file(struct inode *inode, struct file *file)
+static int cifs_reopen_file(struct inode *inode, struct file *file, int can_flush)
 {
 	int rc = -EACCES;
 	int xid, oplock;
@@ -264,7 +279,6 @@
 	int desiredAccess = 0x20197;
 	int disposition = FILE_OPEN;
 	__u16 netfid;
-	FILE_ALL_INFO * buf = NULL;
 
 	if(inode == NULL)
 		return -EBADF;
@@ -281,11 +295,24 @@
 		return 0;
 	}
 
-
+	if(file->f_dentry == NULL) {
+		up(&pCifsFile->fh_sem);
+		cFYI(1,("failed file reopen, no valid name if dentry freed"));
+		FreeXid(xid);
+		return -EBADF;
+	}
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
-
+/* can not grab rename sem here because various ops, including
+those that already have the rename sem can end up causing writepage
+to get called and if the server was down that means we end up here,
+and we can never tell if the caller already has the rename_sem */
 	full_path = build_path_from_dentry(file->f_dentry);
+	if(full_path == NULL) {
+		up(&pCifsFile->fh_sem);
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 
 	cFYI(1, (" inode = 0x%p file flags are 0x%x for %s", inode, file->f_flags,full_path));
 	if ((file->f_flags & O_ACCMODE) == O_RDONLY)
@@ -304,21 +331,23 @@
 	else
 		oplock = FALSE;
 
-		/* BB pass O_SYNC flag through on file attributes .. BB */
+	
+	/* Can not refresh inode by passing in file_info buf to be returned
+	 by SMBOpen and then calling get_inode_info with returned buf 
+	 since file might have write behind data that needs to be flushed 
+	 and server version of file size can be stale. If we 
+	 knew for sure that inode was not dirty locally we could do this */
 
-		/* Also refresh inode by passing in file_info buf returned by SMBOpen
-		   and calling get_inode_info with returned buf (at least
-		   helps non-Unix server case */
-	buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
+/*	buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
 	if(buf==0) {
 		up(&pCifsFile->fh_sem);
 		if (full_path)
 			kfree(full_path);
 		FreeXid(xid);
 		return -ENOMEM;
-	}
+	}*/
 	rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess,
-				CREATE_NOT_DIR, &netfid, &oplock, buf, cifs_sb->local_nls);
+				CREATE_NOT_DIR, &netfid, &oplock, NULL, cifs_sb->local_nls);
 	if (rc) {
 		up(&pCifsFile->fh_sem);
 		cFYI(1, ("cifs_open returned 0x%x ", rc));
@@ -329,13 +358,25 @@
 		up(&pCifsFile->fh_sem);
 		pCifsInode = CIFS_I(inode);
 		if(pCifsInode) {
-			if (pTcon->ses->capabilities & CAP_UNIX)
-				rc = cifs_get_inode_info_unix(&inode,
+			if(can_flush) {
+				filemap_fdatawrite(inode->i_mapping);
+				filemap_fdatawait(inode->i_mapping);
+			/* temporarily disable caching while we
+			go to server to get inode info */
+				pCifsInode->clientCanCacheAll = FALSE;
+				pCifsInode->clientCanCacheRead = FALSE;
+				if (pTcon->ses->capabilities & CAP_UNIX)
+					rc = cifs_get_inode_info_unix(&inode,
 						full_path, inode->i_sb);
-			else
-				rc = cifs_get_inode_info(&inode,
-						full_path, buf, inode->i_sb);
-
+				else
+					rc = cifs_get_inode_info(&inode,
+						full_path, NULL, inode->i_sb);
+			} /* else we are writing out data to server already
+			and could deadlock if we tried to flush data, and 
+			since we do not know if we have data that would
+			invalidate the current end of file on the server
+			we can not go to the server to get the new
+			inod info */
 			if((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
 				pCifsInode->clientCanCacheAll =  TRUE;
 				pCifsInode->clientCanCacheRead = TRUE;
@@ -351,8 +392,6 @@
 		}
 	}
 
-	if (buf)
-		kfree(buf);
 	if (full_path)
 		kfree(full_path);
 	FreeXid(xid);
@@ -546,6 +585,9 @@
 	int xid, long_op;
 	struct cifsFileInfo * open_file;
 
+	if(file->f_dentry == NULL)
+		return -EBADF;
+
 	xid = GetXid();
 
 	cifs_sb = CIFS_SB(file->f_dentry->d_sb);
@@ -585,7 +627,11 @@
 					FreeXid(xid);
 					return total_written;
 				}
-				rc = cifs_reopen_file(file->f_dentry->d_inode,file);
+				/* we could deadlock if we called
+				 filemap_fdatawait from here so tell
+				reopen_file not to flush data to server now */
+				rc = cifs_reopen_file(file->f_dentry->d_inode,
+					file,FALSE);
 				if(rc != 0)
 					break;
 			}
@@ -608,12 +654,21 @@
 		long_op = FALSE; /* subsequent writes fast - 15 seconds is plenty */
 	}
 
+#ifdef CONFIG_CIFS_STATS
+	if(total_written > 0) {
+		atomic_inc(&pTcon->num_writes);
+		spin_lock(&pTcon->stat_lock);
+		pTcon->bytes_written += total_written;
+		spin_unlock(&pTcon->stat_lock);
+	}
+#endif		
+
 	/* since the write may have blocked check these pointers again */
 	if(file->f_dentry) {
 		if(file->f_dentry->d_inode) {
 			file->f_dentry->d_inode->i_ctime = file->f_dentry->d_inode->i_mtime =
 				CURRENT_TIME;
-			if (bytes_written > 0) {
+			if (total_written > 0) {
 				if (*poffset > file->f_dentry->d_inode->i_size)
 					i_size_write(file->f_dentry->d_inode, *poffset);
 			}
@@ -634,26 +689,22 @@
 	int bytes_written = 0;
 	struct cifs_sb_info *cifs_sb;
 	struct cifsTconInfo *pTcon;
-	struct inode *inode = page->mapping->host;
+	struct inode *inode;
 	struct cifsInodeInfo *cifsInode;
 	struct cifsFileInfo *open_file = NULL;
 	struct list_head *tmp;
 	struct list_head *tmp1;
 
-	cifs_sb = CIFS_SB(inode->i_sb);
-	pTcon = cifs_sb->tcon;
-
-	/* figure out which file struct to use 
-	if (file->private_data == NULL) {
-		return -EBADF;
-	}     
-	 */
 	if (!mapping) {
 		return -EFAULT;
 	} else if(!mapping->host) {
 		return -EFAULT;
 	}
 
+	inode = page->mapping->host;
+	cifs_sb = CIFS_SB(inode->i_sb);
+	pTcon = cifs_sb->tcon;
+
 	offset += (loff_t)from;
 	write_data = kmap(page);
 	write_data += from;
@@ -676,8 +727,11 @@
 
 	cifsInode = CIFS_I(mapping->host);
 	read_lock(&GlobalSMBSeslock); 
+	/* BB we should start at the end */
 	list_for_each_safe(tmp, tmp1, &cifsInode->openFileList) {            
 		open_file = list_entry(tmp,struct cifsFileInfo, flist);
+		if(open_file->closePend)
+			continue;
 		/* We check if file is open for writing first */
 		if((open_file->pfile) && 
 		   ((open_file->pfile->f_flags & O_RDWR) || 
@@ -691,7 +745,15 @@
 			if ((bytes_written > 0) && (offset)) {
 				rc = 0;
 			} else if(bytes_written < 0) {
-				rc = bytes_written;
+				if(rc == -EBADF) {
+				/* have seen a case in which
+				kernel seemed to have closed/freed a file
+				even with writes active so we might as well
+				see if there are other file structs to try
+				for the same inode before giving up */
+					continue;
+				} else
+					rc = bytes_written;
 			}
 			break;  /* now that we found a valid file handle
 				and tried to write to it we are done, no
@@ -735,6 +797,9 @@
 	xid = GetXid();
 /* BB add check for wbc flags */
 	page_cache_get(page);
+        if (!PageUptodate(page)) {
+		cFYI(1,("ppw - page not up to date"));
+	}
 	
 	rc = cifs_partialpagewrite(page,0,PAGE_CACHE_SIZE);
 	SetPageUptodate(page); /* BB add check for error and Clearuptodate? */
@@ -752,8 +817,7 @@
 	int rc = 0;
 	struct inode *inode = page->mapping->host;
 	loff_t position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
-	/* struct cifsFileInfo *open_file;
-	struct cifs_sb_info *cifs_sb; */
+	char * page_data;
 
 	xid = GetXid();
 	cFYI(1,("commit write for page %p up to position %lld for %d",page,position,to));
@@ -784,7 +848,31 @@
 			cFYI(1,(" SetEOF (commit write) rc = %d",rc));
 		}*/
 	}
-	set_page_dirty(page);
+	if (!PageUptodate(page)) {
+		position =  ((loff_t)page->index << PAGE_CACHE_SHIFT) + offset;
+		/* can not rely on (or let) writepage write this data */
+		if(to < offset) {
+			cFYI(1,("Illegal offsets, can not copy from %d to %d",
+				offset,to));
+			FreeXid(xid);
+			return rc;
+		}
+		/* this is probably better than directly calling 
+		partialpage_write since in this function
+		the file handle is known which we might as well
+		leverage */
+		/* BB check if anything else missing out of ppw */
+		/* such as updating last write time */
+		page_data = kmap(page);
+		rc = cifs_write(file, page_data+offset,to-offset,
+                                        &position);
+		if(rc > 0)
+			rc = 0;
+		/* else if rc < 0 should we set writebehind rc? */
+		kunmap(page);
+	} else {	
+		set_page_dirty(page);
+	}
 
 	FreeXid(xid);
 	return rc;
@@ -889,13 +977,18 @@
 	}
 	open_file = (struct cifsFileInfo *)file->private_data;
 
+	if((file->f_flags & O_ACCMODE) == O_WRONLY) {
+		cFYI(1,("attempting read on write only file instance"));
+	}
+
 	for (total_read = 0,current_offset=read_data; read_size > total_read;
 				total_read += bytes_read,current_offset+=bytes_read) {
 		current_read_size = min_t(const int,read_size - total_read,cifs_sb->rsize);
 		rc = -EAGAIN;
 		while(rc == -EAGAIN) {
 			if ((open_file->invalidHandle) && (!open_file->closePend)) {
-				rc = cifs_reopen_file(file->f_dentry->d_inode,file);
+				rc = cifs_reopen_file(file->f_dentry->d_inode,
+					file,TRUE);
 				if(rc != 0)
 					break;
 			}
@@ -913,10 +1006,15 @@
 				return rc;
 			}
 		} else {
+#ifdef CONFIG_CIFS_STATS
+			atomic_inc(&pTcon->num_reads);
+			spin_lock(&pTcon->stat_lock);
+			pTcon->bytes_read += total_read;
+			spin_unlock(&pTcon->stat_lock);
+#endif
 			*poffset += bytes_read;
 		}
 	}
-
 	FreeXid(xid);
 	return total_read;
 }
@@ -1045,7 +1143,8 @@
 		rc = -EAGAIN;
 		while(rc == -EAGAIN) {
 			if ((open_file->invalidHandle) && (!open_file->closePend)) {
-				rc = cifs_reopen_file(file->f_dentry->d_inode,file);
+				rc = cifs_reopen_file(file->f_dentry->d_inode,
+					file, TRUE);
 				if(rc != 0)
 					break;
 			}
@@ -1078,7 +1177,12 @@
 				le16_to_cpu(pSMBr->DataOffset), &lru_pvec);
 
 			i +=  bytes_read >> PAGE_CACHE_SHIFT;
-
+#ifdef CONFIG_CIFS_STATS
+			atomic_inc(&pTcon->num_reads);
+			spin_lock(&pTcon->stat_lock);
+			pTcon->bytes_read += bytes_read;
+			spin_unlock(&pTcon->stat_lock);
+#endif
 			if((int)(bytes_read & PAGE_CACHE_MASK) != bytes_read) {
 				cFYI(1,("Partial page %d of %d read to cache",i++,num_pages));
 
@@ -1124,53 +1228,105 @@
 	return rc;
 }
 
-static int
-cifs_readpage(struct file *file, struct page *page)
+static int cifs_readpage_worker(struct file *file, struct page *page, loff_t * poffset)
 {
-	loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
 	char * read_data;
-	int rc = -EACCES;
-	int xid;
-
-	xid = GetXid();
-
-	if (file->private_data == NULL) {
-		FreeXid(xid);
-		return -EBADF;
-	}
-
-	cFYI(0,("readpage %p at offset %d 0x%x\n",page,(int)offset,(int)offset));
+	int rc;
 
 	page_cache_get(page);
 	read_data = kmap(page);
 	/* for reads over a certain size could initiate async read ahead */
-
-	rc = cifs_read(file, read_data, PAGE_CACHE_SIZE, &offset);
-
+                                                                                                                           
+	rc = cifs_read(file, read_data, PAGE_CACHE_SIZE, poffset);
+                                                                                                                           
 	if (rc < 0)
 		goto io_error;
 	else {
 		cFYI(1,("Bytes read %d ",rc));
 	}
-
+                                                                                                                           
 	file->f_dentry->d_inode->i_atime = CURRENT_TIME;
-
+                                                                                                                           
 	if(PAGE_CACHE_SIZE > rc) {
 		memset(read_data+rc, 0, PAGE_CACHE_SIZE - rc);
 	}
 	flush_dcache_page(page);
 	SetPageUptodate(page);
 	rc = 0;
-
+                                                                                                                           
 io_error:
-	kunmap(page);
+        kunmap(page);
+	page_cache_release(page);
+	return rc;
+}
+
+static int
+cifs_readpage(struct file *file, struct page *page)
+{
+	loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
+	int rc = -EACCES;
+	int xid;
+
+	xid = GetXid();
+
+	if (file->private_data == NULL) {
+		FreeXid(xid);
+		return -EBADF;
+	}
+
+	cFYI(1,("readpage %p at offset %d 0x%x\n",page,(int)offset,(int)offset));
+
+	rc = cifs_readpage_worker(file,page,&offset);
+
 	unlock_page(page);
 
-	page_cache_release(page);
 	FreeXid(xid);
 	return rc;
 }
 
+/* We do not want to update the file size from server for inodes
+   open for write - to avoid races with writepage extending
+   the file - in the future we could consider allowing
+   refreshing the inode only on increases in the file size 
+   but this is tricky to do without racing with writebehind
+   page caching in the current Linux kernel design */
+   
+int is_size_safe_to_change(struct cifsInodeInfo * cifsInode)
+{
+	struct list_head *tmp;
+	struct list_head *tmp1;
+	struct cifsFileInfo *open_file = NULL;
+	int rc = TRUE;
+
+	if(cifsInode == NULL)
+		return rc;
+
+	read_lock(&GlobalSMBSeslock); 
+	list_for_each_safe(tmp, tmp1, &cifsInode->openFileList) {            
+		open_file = list_entry(tmp,struct cifsFileInfo, flist);
+		if(open_file == NULL)
+			break;
+		if(open_file->closePend)
+			continue;
+	/* We check if file is open for writing,   
+	BB we could supplement this with a check to see if file size
+	changes have been flushed to server - ie inode metadata dirty */
+		if((open_file->pfile) && 
+	   ((open_file->pfile->f_flags & O_RDWR) || 
+		(open_file->pfile->f_flags & O_WRONLY))) {
+			 rc = FALSE;
+			 break;
+		}
+		if(tmp->next == NULL) {
+			cFYI(1,("File instance %p removed",tmp));
+			break;
+		}
+	}
+	read_unlock(&GlobalSMBSeslock);
+	return rc;
+}
+
+
 void
 fill_in_inode(struct inode *tmp_inode,
 	      FILE_DIRECTORY_INFO * pfindData, int *pobject_type)
@@ -1230,9 +1386,16 @@
 		atomic_set(&cifsInfo->inUse,1);
 	}
 
-	i_size_write(tmp_inode,pfindData->EndOfFile);
-	tmp_inode->i_blocks =
-		(tmp_inode->i_blksize - 1 + pfindData->AllocationSize) >> tmp_inode->i_blkbits;
+	if(is_size_safe_to_change(cifsInfo)) {
+		/* can not safely change the file size here if the 
+		client is writing to it due to potential races */
+		i_size_write(tmp_inode,pfindData->EndOfFile);
+
+	/* 512 bytes (2**9) is the fake blocksize that must be used */
+	/* for this calculation, even though the reported blocksize is larger */
+		tmp_inode->i_blocks = (512 - 1 + pfindData->AllocationSize) >> 9;
+	}
+
 	if (pfindData->AllocationSize < pfindData->EndOfFile)
 		cFYI(1, ("Possible sparse file: allocation size less than end of file "));
 	cFYI(1,
@@ -1303,10 +1466,17 @@
 	tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks);
 
 	pfindData->NumOfBytes = le64_to_cpu(pfindData->NumOfBytes);
-	pfindData->EndOfFile = le64_to_cpu(pfindData->EndOfFile);
-	i_size_write(tmp_inode,pfindData->EndOfFile);
-	tmp_inode->i_blocks =
-                (tmp_inode->i_blksize - 1 + pfindData->NumOfBytes) >> tmp_inode->i_blkbits;
+
+	if(is_size_safe_to_change(cifsInfo)) {
+		/* can not safely change the file size here if the 
+		client is writing to it due to potential races */
+		pfindData->EndOfFile = le64_to_cpu(pfindData->EndOfFile);
+		i_size_write(tmp_inode,pfindData->EndOfFile);
+
+	/* 512 bytes (2**9) is the fake blocksize that must be used */
+	/* for this calculation, not the real blocksize */
+		tmp_inode->i_blocks = (512 - 1 + pfindData->NumOfBytes) >> 9;
+	}
 
 	if (S_ISREG(tmp_inode->i_mode)) {
 		cFYI(1, ("File inode"));
@@ -1348,12 +1518,15 @@
 		/* BB overwrite the old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len ?? */
 		if(*ptmp_inode == NULL) {
 	                *ptmp_inode = new_inode(file->f_dentry->d_sb);
+			if(*ptmp_inode == NULL)
+				return;
 			d_instantiate(tmp_dentry, *ptmp_inode);
 		}
 	} else {
 		tmp_dentry = d_alloc(file->f_dentry, qstring);
 		if(tmp_dentry == NULL) {
 			cERROR(1,("Failed allocating dentry"));
+			*ptmp_inode = NULL;
 			return;
 		}
 			
@@ -1361,6 +1534,8 @@
 		tmp_dentry->d_op = &cifs_dentry_ops;
 		cFYI(0, (" instantiate dentry 0x%p with inode 0x%p ",
 			 tmp_dentry, *ptmp_inode));
+		if(*ptmp_inode == NULL)
+			return;
 		d_instantiate(tmp_dentry, *ptmp_inode);
 		d_rehash(tmp_dentry);
 	}
@@ -1417,7 +1592,9 @@
 	pqstring->len = pfindData->FileNameLength;
 
 	construct_dentry(pqstring, file, &tmp_inode, &tmp_dentry);
-
+	if((tmp_inode == NULL) || (tmp_dentry == NULL)) {
+		return -ENOMEM;
+	}
 	fill_in_inode(tmp_inode, pfindData, &object_type);
 	rc = filldir(direntry, pfindData->FileName, pqstring->len, file->f_pos,
 		tmp_inode->i_ino, object_type);
@@ -1443,6 +1620,9 @@
 	pqstring->len = strnlen(pUnixFindData->FileName, MAX_PATHCONF);
 
 	construct_dentry(pqstring, file, &tmp_inode, &tmp_dentry);
+	if((tmp_inode == NULL) || (tmp_dentry == NULL)) {
+		return -ENOMEM;
+	}
 
 	unix_fill_in_inode(tmp_inode, pUnixFindData, &object_type);
 	rc = filldir(direntry, pUnixFindData->FileName, pqstring->len,
@@ -1793,10 +1973,10 @@
 					cifsFile->search_resume_name = 
 						kmalloc(cifsFile->resume_name_length, GFP_KERNEL);
 					cFYI(1,("fnext last file: %s with name %d bytes long",
-						lastFindData->FileName,
+						pfindDataUnix->FileName,
 						cifsFile->resume_name_length));
 					memcpy(cifsFile->search_resume_name,
-						lastFindData->FileName, 
+						pfindDataUnix->FileName, 
 						cifsFile->resume_name_length);
 				}
 
@@ -1905,17 +2085,34 @@
 int cifs_prepare_write(struct file *file, struct page *page,
 			unsigned from, unsigned to)
 {
+	int rc = 0;
+        loff_t offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
 	cFYI(1,("prepare write for page %p from %d to %d",page,from,to));
 	if (!PageUptodate(page)) {
-		if (to - from != PAGE_CACHE_SIZE) {
+	/*	if (to - from != PAGE_CACHE_SIZE) {
 			void *kaddr = kmap_atomic(page, KM_USER0);
 			memset(kaddr, 0, from);
 			memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
 			flush_dcache_page(page);
 			kunmap_atomic(kaddr, KM_USER0);
+		} */
+		/* If we are writing a full page it will be up to date,
+		no need to read from the server */
+		if((to==PAGE_CACHE_SIZE) && (from == 0))
+			SetPageUptodate(page);
+
+		/* might as well read a page, it is fast enough */
+		if((file->f_flags & O_ACCMODE) != O_WRONLY) {
+			rc = cifs_readpage_worker(file,page,&offset);
+		} else {
+		/* should we try using another
+		file handle if there is one - how would we lock it
+		to prevent close of that handle racing with this read? */
+		/* In any case this will be written out by commit_write */
 		}
-		SetPageUptodate(page);
 	}
+
+	/* BB should we pass any errors back? e.g. if we do not have read access to the file */
 	return 0;
 }
 
@@ -1924,8 +2121,7 @@
 	.readpage = cifs_readpage,
 	.readpages = cifs_readpages,
 	.writepage = cifs_writepage,
-	.prepare_write = simple_prepare_write, /* BB fixme BB */
-/*	.prepare_write = cifs_prepare_write, */  /* BB removeme BB */
+	.prepare_write = cifs_prepare_write, 
 	.commit_write = cifs_commit_write,
    /* .sync_page = cifs_sync_page, */
 	/*.direct_IO = */
diff -Nru a/fs/cifs/inode.c b/fs/cifs/inode.c
--- a/fs/cifs/inode.c	Tue Jun 15 22:20:36 2004
+++ b/fs/cifs/inode.c	Tue Jun 15 22:20:36 2004
@@ -30,6 +30,8 @@
 #include "cifs_debug.h"
 #include "cifs_fs_sb.h"
 
+extern int is_size_safe_to_change(struct cifsInodeInfo *);
+
 int
 cifs_get_inode_info_unix(struct inode **pinode,
 			 const unsigned char *search_path,
@@ -43,9 +45,6 @@
 	struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
 	char *tmp_path;
 
-/* BB add caching check so we do not go to server to overwrite inode info to cached file
-	where the local file sizes are correct and the server info is stale  BB */
-
 	xid = GetXid();
 
 	pTcon = cifs_sb->tcon;
@@ -125,13 +124,29 @@
 		inode->i_nlink = le64_to_cpu(findData.Nlinks);
 		findData.NumOfBytes = le64_to_cpu(findData.NumOfBytes);
 		findData.EndOfFile = le64_to_cpu(findData.EndOfFile);
-		i_size_write(inode,findData.EndOfFile);
+
+		if(is_size_safe_to_change(cifsInfo)) {
+		/* can not safely change the file size here if the 
+		   client is writing to it due to potential races */
+
+			i_size_write(inode,findData.EndOfFile);
 /* blksize needs to be multiple of two. So safer to default to blksize
 	and blkbits set in superblock so 2**blkbits and blksize will match */
 /*		inode->i_blksize =
 		    (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/
-		inode->i_blocks = 
-	                (inode->i_blksize - 1 + findData.NumOfBytes) >> inode->i_blkbits;
+
+		/* This seems incredibly stupid but it turns out that
+		i_blocks is not related to (i_size / i_blksize), instead a
+		size of 512 is required to be used for calculating num blocks */
+		 
+
+/*		inode->i_blocks = 
+	                (inode->i_blksize - 1 + findData.NumOfBytes) >> inode->i_blkbits;*/
+
+		/* 512 bytes (2**9) is the fake blocksize that must be used */
+		/* for this calculation */
+			inode->i_blocks = (512 - 1 + findData.NumOfBytes) >> 9;
+		}
 
 		if (findData.NumOfBytes < findData.EndOfFile)
 			cFYI(1, ("Server inconsistency Error: it says allocation size less than end of file "));
@@ -273,10 +288,18 @@
 				inode->i_mode &= ~(S_IWUGO);
    /* BB add code here - validate if device or weird share or device type? */
 		}
-		i_size_write(inode,le64_to_cpu(pfindData->EndOfFile));
+		if(is_size_safe_to_change(cifsInfo)) {
+		/* can not safely change the file size here if the 
+		client is writing to it due to potential races */
+
+			i_size_write(inode,le64_to_cpu(pfindData->EndOfFile));
+
+		/* 512 bytes (2**9) is the fake blocksize that must be used */
+		/* for this calculation */
+			inode->i_blocks = (512 - 1 + pfindData->AllocationSize)
+				 >> 9;
+		}
 		pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize);
-		inode->i_blocks =
-			(inode->i_blksize - 1 + pfindData->AllocationSize) >> inode->i_blkbits;
 
 		inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks);
 
@@ -345,8 +368,15 @@
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+/* Unlink can be called from rename so we can not grab
+	the sem here since we deadlock otherwise */
+/*	down(&direntry->d_sb->s_vfs_rename_sem);*/
 	full_path = build_path_from_dentry(direntry);
-
+/*	up(&direntry->d_sb->s_vfs_rename_sem);*/
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 	rc = CIFSSMBDelFile(xid, pTcon, full_path, cifs_sb->local_nls);
 
 	if (!rc) {
@@ -427,7 +457,13 @@
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+	down(&inode->i_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(direntry);
+	up(&inode->i_sb->s_vfs_rename_sem);
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 	/* BB add setting the equivalent of mode via CreateX w/ACLs */
 	rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls);
 	if (rc) {
@@ -480,7 +516,13 @@
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+	down(&inode->i_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(direntry);
+	up(&inode->i_sb->s_vfs_rename_sem);
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 
 	rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls);
 
@@ -525,15 +567,50 @@
                      different share. Might eventually add support for this */
 	}
 
+	/* we already  have the rename sem so we do not need
+	to grab it again here to protect the path integrity */
 	fromName = build_path_from_dentry(source_direntry);
 	toName = build_path_from_dentry(target_direntry);
+	if((fromName == NULL) || (toName == NULL)) {
+		rc = -ENOMEM;
+		goto cifs_rename_exit;
+	}
 
 	rc = CIFSSMBRename(xid, pTcon, fromName, toName,
 			   cifs_sb_source->local_nls);
 	if(rc == -EEXIST) {
-		cifs_unlink(target_inode, target_direntry);
-		rc = CIFSSMBRename(xid, pTcon, fromName, toName,
-				   cifs_sb_source->local_nls);
+		/* check if they are the same file 
+		because rename of hardlinked files is a noop */
+		FILE_UNIX_BASIC_INFO * info_buf_source;
+		FILE_UNIX_BASIC_INFO * info_buf_target;
+
+		info_buf_source = 
+			kmalloc(2 * sizeof(FILE_UNIX_BASIC_INFO),GFP_KERNEL);
+		if(info_buf_source != NULL) {
+			info_buf_target = info_buf_source+1;
+			rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, 
+				info_buf_source, cifs_sb_source->local_nls);
+			if(rc == 0) {
+				rc = CIFSSMBUnixQPathInfo(xid,pTcon,toName,
+						info_buf_target,
+						cifs_sb_target->local_nls);
+			}
+			if((rc == 0) && 
+				(info_buf_source->UniqueId == 
+				 info_buf_target->UniqueId)) {
+			/* do not rename since the files are hardlinked 
+			   which is a noop */
+			} else {
+			/* we either can not tell the files are hardlinked
+			(as with Windows servers) or files are not hardlinked 
+			so delete the target manually before renaming to
+			follow POSIX rather than Windows semantics */
+				cifs_unlink(target_inode, target_direntry);
+				rc = CIFSSMBRename(xid, pTcon, fromName, toName,
+					cifs_sb_source->local_nls);
+			}
+			kfree(info_buf_source);
+		} /* if we can not get memory just leave rc as EEXIST */
 	}
 
 	if((rc == -EIO)||(rc == -EEXIST)) {
@@ -549,6 +626,8 @@
 			CIFSSMBClose(xid, pTcon, netfid);
 		}
 	}
+
+cifs_rename_exit:
 	if (fromName)
 		kfree(fromName);
 	if (toName)
@@ -586,7 +665,13 @@
 
 	cifs_sb = CIFS_SB(direntry->d_sb);
 
+	/* can not safely grab the rename sem here if
+	rename calls revalidate since that would deadlock */
 	full_path = build_path_from_dentry(direntry);
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 	cFYI(1,
 	     ("Revalidate: %s inode 0x%p count %d dentry: 0x%p d_time %ld jiffies %ld",
 	      full_path, direntry->d_inode,
@@ -647,9 +732,12 @@
 		}
 	}
 
-
+	/* can not grab this sem since kernel filesys locking
+		documentation indicates i_sem may be taken by the kernel 
+		on lookup and rename which could deadlock if we grab
+		the i_sem here as well */
+/*	down(&direntry->d_inode->i_sem);*/
 	/* need to write out dirty pages here  */
-	down(&direntry->d_inode->i_sem);
 	if(direntry->d_inode->i_mapping) {
 		/* do we need to lock inode until after invalidate completes below? */
 		filemap_fdatawrite(direntry->d_inode->i_mapping);
@@ -663,9 +751,7 @@
 			invalidate_remote_inode(direntry->d_inode);
 		}
 	}
-
-
-	up(&direntry->d_inode->i_sem);
+/*	up(&direntry->d_inode->i_sem);*/
 	
 	if (full_path)
 		kfree(full_path);
@@ -729,7 +815,13 @@
 	cifs_sb = CIFS_SB(direntry->d_inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+	down(&direntry->d_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(direntry);
+	up(&direntry->d_sb->s_vfs_rename_sem);
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 	cifsInode = CIFS_I(direntry->d_inode);
 
 	/* BB check if we need to refresh inode from server now ? BB */
diff -Nru a/fs/cifs/link.c b/fs/cifs/link.c
--- a/fs/cifs/link.c	Tue Jun 15 22:20:38 2004
+++ b/fs/cifs/link.c	Tue Jun 15 22:20:38 2004
@@ -44,10 +44,18 @@
 	cifs_sb_target = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb_target->tcon;
 
-/* No need to check for cross device links since server will do that - BB note DFS case in future though (when we may have to check) */
+/* No need to check for cross device links since server will do that
+   BB note DFS case in future though (when we may have to check) */
 
+	down(&inode->i_sb->s_vfs_rename_sem);
 	fromName = build_path_from_dentry(old_file);
 	toName = build_path_from_dentry(direntry);
+	up(&inode->i_sb->s_vfs_rename_sem);
+	if((fromName == NULL) || (toName == NULL)) {
+		rc = -ENOMEM;
+		goto cifs_hl_exit;
+	}
+
 	if (cifs_sb_target->tcon->ses->capabilities & CAP_UNIX)
 		rc = CIFSUnixCreateHardLink(xid, pTcon, fromName, toName,
 					    cifs_sb_target->local_nls);
@@ -70,6 +78,7 @@
 	cifsInode = CIFS_I(old_file->d_inode);
 	cifsInode->time = 0;	/* will force revalidate to go get info when needed */
 
+cifs_hl_exit:
 	if (fromName)
 		kfree(fromName);
 	if (toName)
@@ -90,7 +99,15 @@
 	struct cifsTconInfo *pTcon;
 
 	xid = GetXid();
+
+	down(&direntry->d_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(direntry);
+	up(&direntry->d_sb->s_vfs_rename_sem);
+
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 	cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode));
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
@@ -149,7 +166,15 @@
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+	down(&inode->i_sb->s_vfs_rename_sem);
 	full_path = build_path_from_dentry(direntry);
+	up(&inode->i_sb->s_vfs_rename_sem);
+
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
+
 	cFYI(1, ("Full path: %s ", full_path));
 	cFYI(1, ("symname is %s", symname));
 
@@ -185,7 +210,7 @@
 }
 
 int
-cifs_readlink(struct dentry *direntry, char *pBuffer, int buflen)
+cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
 {
 	struct inode *inode = direntry->d_inode;
 	int rc = -EACCES;
@@ -204,7 +229,18 @@
 	xid = GetXid();
 	cifs_sb = CIFS_SB(inode->i_sb);
 	pTcon = cifs_sb->tcon;
+
+/* BB would it be safe against deadlock to grab this sem 
+      even though rename itself grabs the sem and calls lookup? */
+/*       down(&inode->i_sb->s_vfs_rename_sem);*/
 	full_path = build_path_from_dentry(direntry);
+/*       up(&inode->i_sb->s_vfs_rename_sem);*/
+
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
+
 	cFYI(1,
 	     ("Full path: %s inode = 0x%p pBuffer = 0x%p buflen = %d",
 	      full_path, inode, pBuffer, buflen));
diff -Nru a/fs/cifs/misc.c b/fs/cifs/misc.c
--- a/fs/cifs/misc.c	Tue Jun 15 22:21:03 2004
+++ b/fs/cifs/misc.c	Tue Jun 15 22:21:03 2004
@@ -21,6 +21,7 @@
 
 #include <linux/slab.h>
 #include <linux/ctype.h>
+#include <linux/mempool.h>
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifsproto.h"
@@ -28,7 +29,7 @@
 #include "smberr.h"
 #include "nterr.h"
 
-extern kmem_cache_t *cifs_req_cachep;
+extern mempool_t *cifs_req_poolp;
 extern struct task_struct * oplockThread;
 
 __u16 GlobalMid;		/* multiplex id - rotating counter */
@@ -122,6 +123,9 @@
 		ret_buf->tidStatus = CifsNew;
 		INIT_LIST_HEAD(&ret_buf->openFileList);
 		init_MUTEX(&ret_buf->tconSem);
+#ifdef CONFIG_CIFS_STATS
+		ret_buf->stat_lock = SPIN_LOCK_UNLOCKED;
+#endif
 		write_unlock(&GlobalSMBSeslock);
 	}
 	return ret_buf;
@@ -153,7 +157,7 @@
    albeit slightly larger than necessary and maxbuffersize 
    defaults to this and can not be bigger */
 	ret_buf =
-	    (struct smb_hdr *) kmem_cache_alloc(cifs_req_cachep, SLAB_KERNEL | SLAB_NOFS);
+	    (struct smb_hdr *) mempool_alloc(cifs_req_poolp, SLAB_KERNEL | SLAB_NOFS);
 
 	/* clear the first few header bytes */
 	if (ret_buf) {
@@ -172,7 +176,7 @@
 		cFYI(1, ("Null buffer passed to cifs_buf_release"));
 		return;
 	}
-	kmem_cache_free(cifs_req_cachep, buf_to_free);
+	mempool_free(buf_to_free,cifs_req_poolp);
 
 	atomic_dec(&bufAllocCount);
 	return;
@@ -391,6 +395,9 @@
 	list_for_each(tmp, &GlobalTreeConnectionList) {
 		tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
 		if (tcon->tid == buf->Tid) {
+#ifdef CONFIG_CIFS_STATS
+			atomic_inc(&tcon->num_oplock_brks);
+#endif
 			list_for_each(tmp1,&tcon->openFileList){
 				netfile = list_entry(tmp1,struct cifsFileInfo,tlist);
 				if(pSMB->Fid == netfile->netfid) {
diff -Nru a/fs/cifs/transport.c b/fs/cifs/transport.c
--- a/fs/cifs/transport.c	Tue Jun 15 22:20:38 2004
+++ b/fs/cifs/transport.c	Tue Jun 15 22:20:38 2004
@@ -25,12 +25,13 @@
 #include <linux/net.h>
 #include <asm/uaccess.h>
 #include <asm/processor.h>
+#include <linux/mempool.h>
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifsproto.h"
 #include "cifs_debug.h"
   
-extern kmem_cache_t *cifs_mid_cachep;
+extern mempool_t *cifs_mid_poolp;
 extern kmem_cache_t *cifs_oplock_cachep;
 
 struct mid_q_entry *
@@ -47,8 +48,7 @@
 		return NULL;
 	}
 	
-	temp = (struct mid_q_entry *) kmem_cache_alloc(cifs_mid_cachep,
-						       SLAB_KERNEL);
+	temp = (struct mid_q_entry *) mempool_alloc(cifs_mid_poolp,SLAB_KERNEL | SLAB_NOFS);
 	if (temp == NULL)
 		return temp;
 	else {
@@ -79,7 +79,7 @@
 	atomic_dec(&midCount);
 	spin_unlock(&GlobalMid_Lock);
 	cifs_buf_release(midEntry->resp_buf);
-	kmem_cache_free(cifs_mid_cachep, midEntry);
+	mempool_free(midEntry, cifs_mid_poolp);
 }
 
 struct oplock_q_entry *
@@ -120,13 +120,13 @@
 	 unsigned int smb_buf_length, struct sockaddr *sin)
 {
 	int rc = 0;
+	int i = 0;
 	struct msghdr smb_msg;
 	struct iovec iov;
 	mm_segment_t temp_fs;
 
 	if(ssocket == NULL)
 		return -ENOTSOCK; /* BB eventually add reconnect code here */
-/*  ssocket->sk->allocation = GFP_BUFFER; *//* BB is this spurious? */
 	iov.iov_base = smb_buffer;
 	iov.iov_len = smb_buf_length + 4;
 
@@ -152,6 +152,14 @@
 	while(iov.iov_len > 0) {
 		rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4);
 		if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
+			i++;
+			if(i > 60) {
+				cERROR(1,
+				   ("sends on sock %p stuck for 30 seconds",
+				    ssocket));
+				rc = -EAGAIN;
+				break;
+			}
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(HZ/2);
 			continue;
@@ -182,31 +190,60 @@
 	long timeout;
 	struct mid_q_entry *midQ;
 
-	if ((ses == NULL) || (ses->server == NULL)) {
-		cERROR(1,("Null tcp session or smb session: %p",ses));
+	if (ses == NULL) {
+		cERROR(1,("Null smb session"));
+		return -EIO;
+	}
+	if(ses->server == NULL) {
+		cERROR(1,("Null tcp session"));
 		return -EIO;
 	}
 
+	/* Ensure that we do not send more than 50 overlapping requests 
+		to the same server. We may make this configurable later or
+		use ses->maxReq */
+
+	/* can not count locking commands against the total since
+		they are allowed to block on server */
+	if(long_op < 3) {
+		/* update # of requests on the wire to this server */
+		atomic_inc(&ses->server->inFlight); 
+	}
+ 
+	if(atomic_read(&ses->server->inFlight) > CIFS_MAX_REQ) {
+		wait_event(ses->server->request_q,atomic_read(&ses->server->inFlight) <= CIFS_MAX_REQ);
+	}
+
+	/* make sure that we sign in the same order that we send on this socket 
+		and avoid races inside tcp sendmsg code that could cause corruption
+		of smb data */
+
+	down(&ses->server->tcpSem); 
+
 	if (ses->server->tcpStatus == CifsExiting) {
-		return -ENOENT;
+		rc = -ENOENT;
+		goto out_unlock;
 	} else if (ses->server->tcpStatus == CifsNeedReconnect) {
 		cFYI(1,("tcp session dead - return to caller to retry"));
-		return -EAGAIN;
+		rc = -EAGAIN;
+		goto out_unlock;
 	} else if (ses->status != CifsGood) {
 		/* check if SMB session is bad because we are setting it up */
 		if((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) && 
 			(in_buf->Command != SMB_COM_NEGOTIATE)) {
-			return -EAGAIN;
+			rc = -EAGAIN;
+			goto out_unlock;
 		} /* else ok - we are setting up session */
 	}
-	/* make sure that we sign in the same order that we send on this socket 
-		and avoid races inside tcp sendmsg code that could cause corruption
-		of smb data */
-	down(&ses->server->tcpSem); 
 	midQ = AllocMidQEntry(in_buf, ses);
 	if (midQ == NULL) {
 		up(&ses->server->tcpSem);
-		return -EIO;
+		/* If not lock req, update # of requests on wire to server */
+		if(long_op < 3) {
+			atomic_dec(&ses->server->inFlight); 
+			wake_up(&ses->server->request_q);
+		}
+		return -ENOMEM;
 	}
 
 	if (in_buf->smb_buf_length > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE - 4) {
@@ -215,6 +252,11 @@
 		       ("Illegal length, greater than maximum frame, %d ",
 			in_buf->smb_buf_length));
 		DeleteMidQEntry(midQ);
+		/* If not lock req, update # of requests on wire to server */
+		if(long_op < 3) {
+			atomic_dec(&ses->server->inFlight); 
+			wake_up(&ses->server->request_q);
+		}
 		return -EIO;
 	}
 
@@ -226,7 +268,17 @@
 	midQ->midState = MID_REQUEST_SUBMITTED;
 	rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length,
 		      (struct sockaddr *) &(ses->server->addr.sockAddr));
-	up(&ses->server->tcpSem);
+	if(rc < 0) {
+		DeleteMidQEntry(midQ);
+		up(&ses->server->tcpSem);
+		/* If not lock req, update # of requests on wire to server */
+		if(long_op < 3) {
+			atomic_dec(&ses->server->inFlight); 
+			wake_up(&ses->server->request_q);
+		}
+		return rc;
+	} else
+		up(&ses->server->tcpSem);
 	if (long_op == -1)
 		goto cifs_no_response_exit;
 	else if (long_op == 2) /* writes past end of file can take looooong time */
@@ -285,10 +337,14 @@
 		}
 		spin_unlock(&GlobalMid_Lock);
 		DeleteMidQEntry(midQ);
+		/* If not lock req, update # of requests on wire to server */
+		if(long_op < 3) {
+			atomic_dec(&ses->server->inFlight); 
+			wake_up(&ses->server->request_q);
+		}
 		return rc;
 	}
   
-
 	if (receive_len > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE) {
 		cERROR(1,
 		       ("Frame too large received.  Length: %d  Xid: %d",
@@ -338,8 +394,22 @@
 		}
 	}
 cifs_no_response_exit:
-	DeleteMidQEntry(midQ);	/* BB what if process is killed?
-			 - BB add background daemon to clean up Mid entries from
-			 killed processes & test killing process with active mid */
+	DeleteMidQEntry(midQ);
+
+	if(long_op < 3) {
+		atomic_dec(&ses->server->inFlight); 
+		wake_up(&ses->server->request_q);
+	}
+
+	return rc;
+
+out_unlock:
+	up(&ses->server->tcpSem);
+	/* If not lock req, update # of requests on wire to server */
+	if(long_op < 3) {
+		atomic_dec(&ses->server->inFlight); 
+		wake_up(&ses->server->request_q);
+	}
+
 	return rc;
 }
diff -Nru a/fs/cifs/xattr.c b/fs/cifs/xattr.c
--- a/fs/cifs/xattr.c	Tue Jun 15 22:20:40 2004
+++ b/fs/cifs/xattr.c	Tue Jun 15 22:20:40 2004
@@ -20,37 +20,68 @@
  */
 
 #include <linux/fs.h>
+#include "cifsfs.h"
+#include "cifspdu.h"
+#include "cifsglob.h"
+#include "cifsproto.h"
+#include "cifs_debug.h"
 
 int cifs_removexattr(struct dentry * direntry, const char * name)
 {
-        int rc = -EOPNOTSUPP;
-        return rc;
+	int rc = -EOPNOTSUPP;
+	return rc;
 }
 
 int cifs_setxattr(struct dentry * direntry, const char * name,
         const void * value, size_t size, int flags)
 {
-        int rc = -EOPNOTSUPP;
-        return rc;
+	int rc = -EOPNOTSUPP;
+	return rc;
 }
 
 ssize_t cifs_getxattr(struct dentry * direntry, const char * name,
          void * value, size_t size)
 {
-        ssize_t rc = -EOPNOTSUPP;
-        return rc;
+	ssize_t rc = -EOPNOTSUPP;
+	return rc;
 }
 
 ssize_t cifs_listxattr(struct dentry * direntry, char * ea_data, size_t ea_size)
 {
-        ssize_t rc = -EOPNOTSUPP;
-
+	ssize_t rc = -EOPNOTSUPP;
+#ifdef CONFIG_CIFS_XATTR
+	int xid;
+	struct cifs_sb_info *cifs_sb;
+	struct cifsTconInfo *pTcon;
+	struct super_block * sb;
+	char * full_path;
+	if(direntry == NULL)
+		return -EIO;
+	if(direntry->d_inode == NULL)
+		return -EIO;
+	sb = direntry->d_inode->i_sb;
+	if(sb == NULL)
+		return -EIO;
+	xid = GetXid();
+
+	cifs_sb = CIFS_SB(sb);
+	pTcon = cifs_sb->tcon;
+
+	down(&sb->s_vfs_rename_sem);
+	full_path = build_path_from_dentry(direntry);
+	up(&sb->s_vfs_rename_sem);
+	if(full_path == NULL) {
+		FreeXid(xid);
+		return -ENOMEM;
+	}
 	/* return dosattributes as pseudo xattr */
 	/* return alt name if available as pseudo attr */
 
 	/* if proc/fs/cifs/streamstoxattr is set then
 		search server for EAs or streams to 
 		returns as xattrs */
-
-        return rc;
+	rc = CIFSSMBQAllEAs(xid,pTcon,full_path,ea_data,ea_size,cifs_sb->local_nls);
+	FreeXid(xid);
+#endif
+	return rc;
 }
diff -Nru a/fs/coda/file.c b/fs/coda/file.c
--- a/fs/coda/file.c	Tue Jun 15 22:20:39 2004
+++ b/fs/coda/file.c	Tue Jun 15 22:20:39 2004
@@ -29,7 +29,7 @@
 int use_coda_close;
 
 static ssize_t
-coda_file_read(struct file *coda_file, char *buf, size_t count, loff_t *ppos)
+coda_file_read(struct file *coda_file, char __user *buf, size_t count, loff_t *ppos)
 {
 	struct coda_file_info *cfi;
 	struct file *host_file;
@@ -45,7 +45,7 @@
 }
 
 static ssize_t
-coda_file_write(struct file *coda_file, const char *buf, size_t count, loff_t *ppos)
+coda_file_write(struct file *coda_file, const char __user *buf, size_t count, loff_t *ppos)
 {
 	struct inode *host_inode, *coda_inode = coda_file->f_dentry->d_inode;
 	struct coda_file_info *cfi;
diff -Nru a/fs/coda/pioctl.c b/fs/coda/pioctl.c
--- a/fs/coda/pioctl.c	Tue Jun 15 22:20:42 2004
+++ b/fs/coda/pioctl.c	Tue Jun 15 22:20:42 2004
@@ -58,7 +58,7 @@
         struct coda_inode_info *cnp;
 
         /* get the Pioctl data arguments from user space */
-        if (copy_from_user(&data, (int *)user_data, sizeof(data))) {
+        if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) {
 	    return -EINVAL;
 	}
        
diff -Nru a/fs/coda/psdev.c b/fs/coda/psdev.c
--- a/fs/coda/psdev.c	Tue Jun 15 22:20:42 2004
+++ b/fs/coda/psdev.c	Tue Jun 15 22:20:42 2004
@@ -88,7 +88,7 @@
 	switch(cmd) {
 	case CIOC_KERNEL_VERSION:
 		data = CODA_KERNEL_VERSION;
-		return put_user(data, (int *) arg);
+		return put_user(data, (int __user *) arg);
 	default:
 		return -ENOTTY;
 	}
@@ -100,7 +100,7 @@
  *	Receive a message written by Venus to the psdev
  */
  
-static ssize_t coda_psdev_write(struct file *file, const char *buf, 
+static ssize_t coda_psdev_write(struct file *file, const char __user *buf, 
 				size_t nbytes, loff_t *off)
 {
         struct venus_comm *vcp = (struct venus_comm *) file->private_data;
@@ -212,7 +212,7 @@
  *	Read a message from the kernel to Venus
  */
 
-static ssize_t coda_psdev_read(struct file * file, char * buf, 
+static ssize_t coda_psdev_read(struct file * file, char __user * buf, 
 			       size_t nbytes, loff_t *off)
 {
 	DECLARE_WAITQUEUE(wait, current);
diff -Nru a/fs/coda/sysctl.c b/fs/coda/sysctl.c
--- a/fs/coda/sysctl.c	Tue Jun 15 22:20:39 2004
+++ b/fs/coda/sysctl.c	Tue Jun 15 22:20:39 2004
@@ -69,7 +69,7 @@
 }
 
 int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp,
-			     void * buffer, size_t * lenp )
+			     void __user * buffer, size_t * lenp )
 {
 	if ( write ) {
 		reset_coda_vfs_stats();
@@ -83,7 +83,7 @@
 }
 
 int do_reset_coda_cache_inv_stats( ctl_table * table, int write, 
-				   struct file * filp, void * buffer, 
+				   struct file * filp, void __user * buffer, 
 				   size_t * lenp )
 {
 	if ( write ) {
@@ -214,7 +214,7 @@
 #define coda_proc_create(name,get_info) \
 	create_proc_info_entry(name, 0, proc_fs_coda, get_info)
 
-void coda_sysctl_init()
+void coda_sysctl_init(void)
 {
 	reset_coda_vfs_stats();
 	reset_coda_cache_inv_stats();
@@ -234,7 +234,7 @@
 #endif 
 }
 
-void coda_sysctl_clean() 
+void coda_sysctl_clean(void) 
 {
 
 #ifdef CONFIG_SYSCTL
diff -Nru a/fs/compat.c b/fs/compat.c
--- a/fs/compat.c	Tue Jun 15 22:20:40 2004
+++ b/fs/compat.c	Tue Jun 15 22:20:40 2004
@@ -34,15 +34,23 @@
 #include <linux/syscalls.h>
 #include <linux/ctype.h>
 #include <linux/module.h>
+#include <linux/dnotify.h>
+#include <linux/highuid.h>
+#include <linux/sunrpc/svc.h>
+#include <linux/nfsd/nfsd.h>
+#include <linux/nfsd/syscall.h>
+#include <linux/personality.h>
+
 #include <net/sock.h>		/* siocdevprivate_ioctl */
 
 #include <asm/uaccess.h>
+#include <asm/mmu_context.h>
 
 /*
  * Not all architectures have sys_utime, so implement this in terms
  * of sys_utimes.
  */
-asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t)
+asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __user *t)
 {
 	struct timeval tv[2];
 
@@ -56,7 +64,7 @@
 	return do_utimes(filename, t ? tv : NULL);
 }
 
-asmlinkage long compat_sys_utimes(char *filename, struct compat_timeval *t)
+asmlinkage long compat_sys_utimes(char __user *filename, struct compat_timeval __user *t)
 {
 	struct timeval tv[2];
 
@@ -70,8 +78,8 @@
 	return do_utimes(filename, t ? tv : NULL);
 }
 
-asmlinkage long compat_sys_newstat(char * filename,
-		struct compat_stat *statbuf)
+asmlinkage long compat_sys_newstat(char __user * filename,
+		struct compat_stat __user *statbuf)
 {
 	struct kstat stat;
 	int error = vfs_stat(filename, &stat);
@@ -81,8 +89,8 @@
 	return error;
 }
 
-asmlinkage long compat_sys_newlstat(char * filename,
-		struct compat_stat *statbuf)
+asmlinkage long compat_sys_newlstat(char __user * filename,
+		struct compat_stat __user *statbuf)
 {
 	struct kstat stat;
 	int error = vfs_lstat(filename, &stat);
@@ -93,7 +101,7 @@
 }
 
 asmlinkage long compat_sys_newfstat(unsigned int fd,
-		struct compat_stat * statbuf)
+		struct compat_stat __user * statbuf)
 {
 	struct kstat stat;
 	int error = vfs_fstat(fd, &stat);
@@ -103,7 +111,7 @@
 	return error;
 }
 
-static int put_compat_statfs(struct compat_statfs *ubuf, struct kstatfs *kbuf)
+static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *kbuf)
 {
 	
 	if (sizeof ubuf->f_blocks == 4) {
@@ -137,7 +145,7 @@
  * The following statfs calls are copies of code from fs/open.c and
  * should be checked against those from time to time
  */
-asmlinkage long compat_sys_statfs(const char *path, struct compat_statfs *buf)
+asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs __user *buf)
 {
 	struct nameidata nd;
 	int error;
@@ -153,7 +161,7 @@
 	return error;
 }
 
-asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs *buf)
+asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user *buf)
 {
 	struct file * file;
 	struct kstatfs tmp;
@@ -171,7 +179,7 @@
 	return error;
 }
 
-static int put_compat_statfs64(struct compat_statfs64 *ubuf, struct kstatfs *kbuf)
+static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstatfs *kbuf)
 {
 	if (sizeof ubuf->f_blocks == 4) {
 		if ((kbuf->f_blocks | kbuf->f_bfree |
@@ -195,7 +203,7 @@
 	return 0;
 }
 
-asmlinkage long compat_statfs64(const char *path, compat_size_t sz, struct compat_statfs64 *buf)
+asmlinkage long compat_statfs64(const char __user *path, compat_size_t sz, struct compat_statfs64 __user *buf)
 {
 	struct nameidata nd;
 	int error;
@@ -214,7 +222,7 @@
 	return error;
 }
 
-asmlinkage long compat_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 *buf)
+asmlinkage long compat_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf)
 {
 	struct file * file;
 	struct kstatfs tmp;
@@ -282,53 +290,36 @@
 
 __initcall(init_sys32_ioctl);
 
-static struct ioctl_trans *ioctl_free_list;
-
-/* Never free them really. This avoids SMP races. With a Read-Copy-Update
-   enabled kernel we could just use the RCU infrastructure for this. */
-static void free_ioctl(struct ioctl_trans *t) 
-{ 
-	t->cmd = 0; 
-	mb();
-	t->next = ioctl_free_list;
-	ioctl_free_list = t;
-} 
-
-int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file *))
+int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int,
+				unsigned int, unsigned long, struct file *))
 {
 	struct ioctl_trans *t;
+	struct ioctl_trans *new_t;
 	unsigned long hash = ioctl32_hash(cmd);
 
+	new_t = kmalloc(sizeof(*new_t), GFP_KERNEL);
+	if (!new_t)
+		return -ENOMEM;
+
 	lock_kernel(); 
-	for (t = (struct ioctl_trans *)ioctl32_hash_table[hash];
-	     t;
-	     t = t->next) { 
+	for (t = ioctl32_hash_table[hash]; t; t = t->next) {
 		if (t->cmd == cmd) {
-			printk("Trying to register duplicated ioctl32 handler %x\n", cmd);
+			printk(KERN_ERR "Trying to register duplicated ioctl32 "
+					"handler %x\n", cmd);
 			unlock_kernel();
+			kfree(new_t);
 			return -EINVAL; 
 		}
-	} 
-
-	if (ioctl_free_list) { 
-		t = ioctl_free_list; 
-		ioctl_free_list = t->next; 
-	} else { 
-		t = kmalloc(sizeof(struct ioctl_trans), GFP_KERNEL); 
-		if (!t) { 
-			unlock_kernel();
-			return -ENOMEM;
-		}
 	}
-	
-	t->next = NULL;
-	t->cmd = cmd;
-	t->handler = handler; 
-	ioctl32_insert_translation(t);
+	new_t->next = NULL;
+	new_t->cmd = cmd;
+	new_t->handler = handler;
+	ioctl32_insert_translation(new_t);
 
 	unlock_kernel();
 	return 0;
 }
+EXPORT_SYMBOL(register_ioctl32_conversion);
 
 static inline int builtin_ioctl(struct ioctl_trans *t)
 { 
@@ -347,7 +338,7 @@
 
 	lock_kernel(); 
 
-	t = (struct ioctl_trans *)ioctl32_hash_table[hash];
+	t = ioctl32_hash_table[hash];
 	if (!t) { 
 		unlock_kernel();
 		return -EINVAL;
@@ -358,38 +349,39 @@
 			printk("%p tried to unregister builtin ioctl %x\n",
 			       __builtin_return_address(0), cmd);
 		} else { 
-		ioctl32_hash_table[hash] = t->next;
-			free_ioctl(t); 
+			ioctl32_hash_table[hash] = t->next;
 			unlock_kernel();
-		return 0;
+			kfree(t);
+			return 0;
 		}
 	} 
 	while (t->next) {
-		t1 = (struct ioctl_trans *)(long)t->next;
+		t1 = t->next;
 		if (t1->cmd == cmd) { 
 			if (builtin_ioctl(t1)) {
-				printk("%p tried to unregister builtin ioctl %x\n",
-				       __builtin_return_address(0), cmd);
+				printk("%p tried to unregister builtin "
+					"ioctl %x\n",
+					__builtin_return_address(0), cmd);
 				goto out;
 			} else { 
-			t->next = t1->next;
-				free_ioctl(t1); 
+				t->next = t1->next;
 				unlock_kernel();
-			return 0;
+				kfree(t1);
+				return 0;
 			}
 		}
 		t = t1;
 	}
-	printk(KERN_ERR "Trying to free unknown 32bit ioctl handler %x\n", cmd);
- out:
+	printk(KERN_ERR "Trying to free unknown 32bit ioctl handler %x\n",
+				cmd);
+out:
 	unlock_kernel();
 	return -EINVAL;
 }
-
-EXPORT_SYMBOL(register_ioctl32_conversion); 
 EXPORT_SYMBOL(unregister_ioctl32_conversion); 
 
-asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
+				unsigned long arg)
 {
 	struct file * filp;
 	int error = -EBADF;
@@ -404,43 +396,53 @@
 		goto out;
 	}
 
-	t = (struct ioctl_trans *)ioctl32_hash_table [ioctl32_hash (cmd)];
+	lock_kernel();
+
+	t = ioctl32_hash_table[ioctl32_hash (cmd)];
 
 	while (t && t->cmd != cmd)
-		t = (struct ioctl_trans *)t->next;
+		t = t->next;
 	if (t) {
 		if (t->handler) { 
-			lock_kernel();
 			error = t->handler(fd, cmd, arg, filp);
 			unlock_kernel();
-		} else
+		} else {
+			unlock_kernel();
 			error = sys_ioctl(fd, cmd, arg);
-	} else if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
-		error = siocdevprivate_ioctl(fd, cmd, arg);
+		}
 	} else {
-		static int count;
-		if (++count <= 50) { 
-			char buf[10];
-			char *path = (char *)__get_free_page(GFP_KERNEL), *fn = "?"; 
-
-			/* find the name of the device. */
-			if (path) {
-		       		fn = d_path(filp->f_dentry, filp->f_vfsmnt, 
-					    path, PAGE_SIZE);
+		unlock_kernel();
+		if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
+			error = siocdevprivate_ioctl(fd, cmd, arg);
+		} else {
+			static int count;
+			if (++count <= 50) {
+				char buf[10];
+				char *fn = "?";
+				char *path;
+
+				path = (char *)__get_free_page(GFP_KERNEL);
+
+				/* find the name of the device. */
+				if (path) {
+			       		fn = d_path(filp->f_dentry,
+						filp->f_vfsmnt, path,
+						PAGE_SIZE);
+				}
+
+				sprintf(buf,"'%c'", (cmd>>24) & 0x3f);
+				if (!isprint(buf[1]))
+				    sprintf(buf, "%02x", buf[1]);
+				printk("ioctl32(%s:%d): Unknown cmd fd(%d) "
+					"cmd(%08x){%s} arg(%08x) on %s\n",
+					current->comm, current->pid,
+					(int)fd, (unsigned int)cmd, buf,
+					(unsigned int)arg, fn);
+				if (path)
+					free_page((unsigned long)path);
 			}
-
-			sprintf(buf,"'%c'", (cmd>>24) & 0x3f); 
-			if (!isprint(buf[1]))
-			    sprintf(buf, "%02x", buf[1]);
-			printk("ioctl32(%s:%d): Unknown cmd fd(%d) "
-			       "cmd(%08x){%s} arg(%08x) on %s\n",
-			       current->comm, current->pid,
-			       (int)fd, (unsigned int)cmd, buf, (unsigned int)arg,
-			       fn);
-			if (path) 
-				free_page((unsigned long)path); 
+			error = -EINVAL;
 		}
-		error = -EINVAL;
 	}
 out:
 	fput(filp);
@@ -448,7 +450,7 @@
 	return error;
 }
 
-static int get_compat_flock(struct flock *kfl, struct compat_flock *ufl)
+static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
 {
 	if (!access_ok(VERIFY_READ, ufl, sizeof(*ufl)) ||
 	    __get_user(kfl->l_type, &ufl->l_type) ||
@@ -460,7 +462,7 @@
 	return 0;
 }
 
-static int put_compat_flock(struct flock *kfl, struct compat_flock *ufl)
+static int put_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
 {
 	if (!access_ok(VERIFY_WRITE, ufl, sizeof(*ufl)) ||
 	    __put_user(kfl->l_type, &ufl->l_type) ||
@@ -473,7 +475,7 @@
 }
 
 #ifndef HAVE_ARCH_GET_COMPAT_FLOCK64
-static int get_compat_flock64(struct flock *kfl, struct compat_flock64 *ufl)
+static int get_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
 {
 	if (!access_ok(VERIFY_READ, ufl, sizeof(*ufl)) ||
 	    __get_user(kfl->l_type, &ufl->l_type) ||
@@ -487,7 +489,7 @@
 #endif
 
 #ifndef HAVE_ARCH_PUT_COMPAT_FLOCK64
-static int put_compat_flock64(struct flock *kfl, struct compat_flock64 *ufl)
+static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
 {
 	if (!access_ok(VERIFY_WRITE, ufl, sizeof(*ufl)) ||
 	    __put_user(kfl->l_type, &ufl->l_type) ||
@@ -564,7 +566,7 @@
 }
 
 asmlinkage long
-compat_sys_io_setup(unsigned nr_reqs, u32 *ctx32p)
+compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
 {
 	long ret;
 	aio_context_t ctx64;
@@ -574,7 +576,8 @@
 		return -EFAULT;
 
 	set_fs(KERNEL_DS);
-	ret = sys_io_setup(nr_reqs, &ctx64);
+	/* The __user pointer cast is valid because of the set_fs() */
+	ret = sys_io_setup(nr_reqs, (aio_context_t __user *) &ctx64);
 	set_fs(oldfs);
 	/* truncating is ok because it's a user address */
 	if (!ret)
@@ -586,12 +589,12 @@
 compat_sys_io_getevents(aio_context_t ctx_id,
 				 unsigned long min_nr,
 				 unsigned long nr,
-				 struct io_event *events,
-				 struct compat_timespec *timeout)
+				 struct io_event __user *events,
+				 struct compat_timespec __user *timeout)
 {
 	long ret;
 	struct timespec t;
-	struct timespec *ut = NULL;
+	struct timespec __user *ut = NULL;
 
 	ret = -EFAULT;
 	if (unlikely(!access_ok(VERIFY_WRITE, events, 
@@ -611,7 +614,7 @@
 }
 
 static inline long
-copy_iocb(long nr, u32 *ptr32, u64 *ptr64)
+copy_iocb(long nr, u32 __user *ptr32, struct iocb __user * __user *ptr64)
 {
 	compat_uptr_t uptr;
 	int i;
@@ -619,7 +622,7 @@
 	for (i = 0; i < nr; ++i) {
 		if (get_user(uptr, ptr32 + i))
 			return -EFAULT;
-		if (put_user((u64)compat_ptr(uptr), ptr64 + i))
+		if (put_user(compat_ptr(uptr), ptr64 + i))
 			return -EFAULT;
 	}
 	return 0;
@@ -628,9 +631,9 @@
 #define MAX_AIO_SUBMITS 	(PAGE_SIZE/sizeof(struct iocb *))
 
 asmlinkage long
-compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 *iocb)
+compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 __user *iocb)
 {
-	struct iocb **iocb64; 
+	struct iocb __user * __user *iocb64; 
 	long ret;
 
 	if (unlikely(nr < 0))
@@ -640,7 +643,7 @@
 		nr = MAX_AIO_SUBMITS;
 	
 	iocb64 = compat_alloc_user_space(nr * sizeof(*iocb64));
-	ret = copy_iocb(nr, iocb, (u64 *) iocb64);
+	ret = copy_iocb(nr, iocb, iocb64);
 	if (!ret)
 		ret = sys_io_submit(ctx_id, nr, iocb64);
 	return ret;
@@ -741,9 +744,9 @@
 #define SMBFS_NAME      "smbfs"
 #define NCPFS_NAME      "ncpfs"
 
-asmlinkage int compat_sys_mount(char __user * dev_name, char __user * dir_name,
-				char __user * type, unsigned long flags,
-				void __user * data)
+asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name,
+				 char __user * type, unsigned long flags,
+				 void __user * data)
 {
 	unsigned long type_page;
 	unsigned long data_page;
@@ -794,3 +797,840 @@
 	return retval;
 }
 
+static ssize_t compat_do_readv_writev(int type, struct file *file,
+			       const struct compat_iovec __user *uvector,
+			       unsigned long nr_segs, loff_t *pos)
+{
+	typedef ssize_t (*io_fn_t)(struct file *, char __user *, size_t, loff_t *);
+	typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *);
+
+	compat_ssize_t tot_len;
+	struct iovec iovstack[UIO_FASTIOV];
+	struct iovec *iov=iovstack, *vector;
+	ssize_t ret;
+	int seg;
+	io_fn_t fn;
+	iov_fn_t fnv;
+	struct inode *inode;
+
+	/*
+	 * SuS says "The readv() function *may* fail if the iovcnt argument
+	 * was less than or equal to 0, or greater than {IOV_MAX}.  Linux has
+	 * traditionally returned zero for zero segments, so...
+	 */
+	ret = 0;
+	if (nr_segs == 0)
+		goto out;
+
+	/*
+	 * First get the "struct iovec" from user memory and
+	 * verify all the pointers
+	 */
+	ret = -EINVAL;
+	if ((nr_segs > UIO_MAXIOV) || (nr_segs <= 0))
+		goto out;
+	if (!file->f_op)
+		goto out;
+	if (nr_segs > UIO_FASTIOV) {
+		ret = -ENOMEM;
+		iov = kmalloc(nr_segs*sizeof(struct iovec), GFP_KERNEL);
+		if (!iov)
+			goto out;
+	}
+	ret = -EFAULT;
+	if (verify_area(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
+		goto out;
+
+	/*
+	 * Single unix specification:
+	 * We should -EINVAL if an element length is not >= 0 and fitting an
+	 * ssize_t.  The total length is fitting an ssize_t
+	 *
+	 * Be careful here because iov_len is a size_t not an ssize_t
+	 */
+	tot_len = 0;
+	vector = iov;
+	ret = -EINVAL;
+	for (seg = 0 ; seg < nr_segs; seg++) {
+		compat_ssize_t tmp = tot_len;
+		compat_ssize_t len;
+		compat_uptr_t buf;
+
+		if (__get_user(len, &uvector->iov_len) ||
+		    __get_user(buf, &uvector->iov_base)) {
+			ret = -EFAULT;
+			goto out;
+		}
+		if (len < 0)	/* size_t not fitting an compat_ssize_t .. */
+			goto out;
+		tot_len += len;
+		if (tot_len < tmp) /* maths overflow on the compat_ssize_t */
+			goto out;
+		vector->iov_base = compat_ptr(buf);
+		vector->iov_len = (compat_size_t) len;
+		uvector++;
+		vector++;
+	}
+	if (tot_len == 0) {
+		ret = 0;
+		goto out;
+	}
+
+	inode = file->f_dentry->d_inode;
+	/* VERIFY_WRITE actually means a read, as we write to user space */
+	ret = locks_verify_area((type == READ
+				 ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE),
+				inode, file, *pos, tot_len);
+	if (ret)
+		goto out;
+
+	fnv = NULL;
+	if (type == READ) {
+		fn = file->f_op->read;
+		fnv = file->f_op->readv;
+	} else {
+		fn = (io_fn_t)file->f_op->write;
+		fnv = file->f_op->writev;
+	}
+	if (fnv) {
+		ret = fnv(file, iov, nr_segs, pos);
+		goto out;
+	}
+
+	/* Do it by hand, with file-ops */
+	ret = 0;
+	vector = iov;
+	while (nr_segs > 0) {
+		void __user * base;
+		size_t len;
+		ssize_t nr;
+
+		base = vector->iov_base;
+		len = vector->iov_len;
+		vector++;
+		nr_segs--;
+
+		nr = fn(file, base, len, pos);
+
+		if (nr < 0) {
+			if (!ret) ret = nr;
+			break;
+		}
+		ret += nr;
+		if (nr != len)
+			break;
+	}
+out:
+	if (iov != iovstack)
+		kfree(iov);
+	if ((ret + (type == READ)) > 0)
+		dnotify_parent(file->f_dentry,
+				(type == READ) ? DN_ACCESS : DN_MODIFY);
+	return ret;
+}
+
+asmlinkage ssize_t
+compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec, unsigned long vlen)
+{
+	struct file *file;
+	ssize_t ret = -EBADF;
+
+	file = fget(fd);
+	if (!file)
+		return -EBADF;
+
+	if (!(file->f_mode & FMODE_READ))
+		goto out;
+
+	ret = -EINVAL;
+	if (!file->f_op || (!file->f_op->readv && !file->f_op->read))
+		goto out;
+
+	ret = compat_do_readv_writev(READ, file, vec, vlen, &file->f_pos);
+
+out:
+	fput(file);
+	return ret;
+}
+
+asmlinkage ssize_t
+compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec, unsigned long vlen)
+{
+	struct file *file;
+	ssize_t ret = -EBADF;
+
+	file = fget(fd);
+	if (!file)
+		return -EBADF;
+	if (!(file->f_mode & FMODE_WRITE))
+		goto out;
+
+	ret = -EINVAL;
+	if (!file->f_op || (!file->f_op->writev && !file->f_op->write))
+		goto out;
+
+	ret = compat_do_readv_writev(WRITE, file, vec, vlen, &file->f_pos);
+
+out:
+	fput(file);
+	return ret;
+}
+
+/*
+ * compat_count() counts the number of arguments/envelopes. It is basically
+ * a copy of count() from fs/exec.c, except that it works with 32 bit argv
+ * and envp pointers.
+ */
+static int compat_count(compat_uptr_t __user *argv, int max)
+{
+	int i = 0;
+
+	if (argv != NULL) {
+		for (;;) {
+			compat_uptr_t p;
+
+			if (get_user(p, argv))
+				return -EFAULT;
+			if (!p)
+				break;
+			argv++;
+			if(++i > max)
+				return -E2BIG;
+		}
+	}
+	return i;
+}
+
+/*
+ * compat_copy_strings() is basically a copy of copy_strings() from fs/exec.c
+ * except that it works with 32 bit argv and envp pointers.
+ */
+static int compat_copy_strings(int argc, compat_uptr_t __user *argv,
+				struct linux_binprm *bprm)
+{
+	struct page *kmapped_page = NULL;
+	char *kaddr = NULL;
+	int ret;
+
+	while (argc-- > 0) {
+		compat_uptr_t str;
+		int len;
+		unsigned long pos;
+
+		if (get_user(str, argv+argc) ||
+			!(len = strnlen_user(compat_ptr(str), bprm->p))) {
+			ret = -EFAULT;
+			goto out;
+		}
+
+		if (bprm->p < len)  {
+			ret = -E2BIG;
+			goto out;
+		}
+
+		bprm->p -= len;
+		/* XXX: add architecture specific overflow check here. */
+		pos = bprm->p;
+
+		while (len > 0) {
+			int i, new, err;
+			int offset, bytes_to_copy;
+			struct page *page;
+
+			offset = pos % PAGE_SIZE;
+			i = pos/PAGE_SIZE;
+			page = bprm->page[i];
+			new = 0;
+			if (!page) {
+				page = alloc_page(GFP_HIGHUSER);
+				bprm->page[i] = page;
+				if (!page) {
+					ret = -ENOMEM;
+					goto out;
+				}
+				new = 1;
+			}
+
+			if (page != kmapped_page) {
+				if (kmapped_page)
+					kunmap(kmapped_page);
+				kmapped_page = page;
+				kaddr = kmap(kmapped_page);
+			}
+			if (new && offset)
+				memset(kaddr, 0, offset);
+			bytes_to_copy = PAGE_SIZE - offset;
+			if (bytes_to_copy > len) {
+				bytes_to_copy = len;
+				if (new)
+					memset(kaddr+offset+len, 0,
+						PAGE_SIZE-offset-len);
+			}
+			err = copy_from_user(kaddr+offset, compat_ptr(str),
+						bytes_to_copy);
+			if (err) {
+				ret = -EFAULT;
+				goto out;
+			}
+
+			pos += bytes_to_copy;
+			str += bytes_to_copy;
+			len -= bytes_to_copy;
+		}
+	}
+	ret = 0;
+out:
+	if (kmapped_page)
+		kunmap(kmapped_page);
+	return ret;
+}
+
+#ifdef CONFIG_MMU
+
+#define free_arg_pages(bprm) do { } while (0)
+
+#else
+
+static inline void free_arg_pages(struct linux_binprm *bprm)
+{
+	int i;
+
+	for (i = 0; i < MAX_ARG_PAGES; i++) {
+		if (bprm->page[i])
+			__free_page(bprm->page[i]);
+		bprm->page[i] = NULL;
+	}
+}
+
+#endif /* CONFIG_MMU */
+
+/*
+ * compat_do_execve() is mostly a copy of do_execve(), with the exception
+ * that it processes 32 bit argv and envp pointers.
+ */
+int compat_do_execve(char * filename,
+	compat_uptr_t __user *argv,
+	compat_uptr_t __user *envp,
+	struct pt_regs * regs)
+{
+	struct linux_binprm bprm;
+	struct file *file;
+	int retval;
+	int i;
+
+	sched_balance_exec();
+
+	file = open_exec(filename);
+
+	retval = PTR_ERR(file);
+	if (IS_ERR(file))
+		return retval;
+
+	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
+	memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));
+
+	bprm.file = file;
+	bprm.filename = filename;
+	bprm.interp = filename;
+	bprm.sh_bang = 0;
+	bprm.loader = 0;
+	bprm.exec = 0;
+	bprm.security = NULL;
+	bprm.mm = mm_alloc();
+	retval = -ENOMEM;
+	if (!bprm.mm)
+		goto out_file;
+
+	retval = init_new_context(current, bprm.mm);
+	if (retval < 0)
+		goto out_mm;
+
+	bprm.argc = compat_count(argv, bprm.p / sizeof(compat_uptr_t));
+	if ((retval = bprm.argc) < 0)
+		goto out_mm;
+
+	bprm.envc = compat_count(envp, bprm.p / sizeof(compat_uptr_t));
+	if ((retval = bprm.envc) < 0)
+		goto out_mm;
+
+	retval = security_bprm_alloc(&bprm);
+	if (retval)
+		goto out;
+
+	retval = prepare_binprm(&bprm);
+	if (retval < 0)
+		goto out;
+
+	retval = copy_strings_kernel(1, &bprm.filename, &bprm);
+	if (retval < 0)
+		goto out;
+
+	bprm.exec = bprm.p;
+	retval = compat_copy_strings(bprm.envc, envp, &bprm);
+	if (retval < 0)
+		goto out;
+
+	retval = compat_copy_strings(bprm.argc, argv, &bprm);
+	if (retval < 0)
+		goto out;
+
+	retval = search_binary_handler(&bprm,regs);
+	if (retval >= 0) {
+		free_arg_pages(&bprm);
+
+		/* execve success */
+		security_bprm_free(&bprm);
+		return retval;
+	}
+
+out:
+	/* Something went wrong, return the inode and free the argument pages*/
+	for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
+		struct page * page = bprm.page[i];
+		if (page)
+			__free_page(page);
+	}
+
+	if (bprm.security)
+		security_bprm_free(&bprm);
+
+out_mm:
+	if (bprm.mm)
+		mmdrop(bprm.mm);
+
+out_file:
+	if (bprm.file) {
+		allow_write_access(bprm.file);
+		fput(bprm.file);
+	}
+
+	return retval;
+}
+
+#define __COMPAT_NFDBITS       (8 * sizeof(compat_ulong_t))
+
+#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
+
+/*
+ * Ooo, nasty.  We need here to frob 32-bit unsigned longs to
+ * 64-bit unsigned longs.
+ */
+static inline
+int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
+			unsigned long *fdset)
+{
+	nr = ROUND_UP(nr, __COMPAT_NFDBITS);
+	if (ufdset) {
+		unsigned long odd;
+
+		if (verify_area(VERIFY_WRITE, ufdset, nr*sizeof(compat_ulong_t)))
+			return -EFAULT;
+
+		odd = nr & 1UL;
+		nr &= ~1UL;
+		while (nr) {
+			unsigned long h, l;
+			__get_user(l, ufdset);
+			__get_user(h, ufdset+1);
+			ufdset += 2;
+			*fdset++ = h << 32 | l;
+			nr -= 2;
+		}
+		if (odd)
+			__get_user(*fdset, ufdset);
+	} else {
+		/* Tricky, must clear full unsigned long in the
+		 * kernel fdset at the end, this makes sure that
+		 * actually happens.
+		 */
+		memset(fdset, 0, ((nr + 1) & ~1)*sizeof(compat_ulong_t));
+	}
+	return 0;
+}
+
+static inline
+void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
+			unsigned long *fdset)
+{
+	unsigned long odd;
+	nr = ROUND_UP(nr, __COMPAT_NFDBITS);
+
+	if (!ufdset)
+		return;
+
+	odd = nr & 1UL;
+	nr &= ~1UL;
+	while (nr) {
+		unsigned long h, l;
+		l = *fdset++;
+		h = l >> 32;
+		__put_user(l, ufdset);
+		__put_user(h, ufdset+1);
+		ufdset += 2;
+		nr -= 2;
+	}
+	if (odd)
+		__put_user(*fdset, ufdset);
+}
+
+
+/*
+ * This is a virtual copy of sys_select from fs/select.c and probably
+ * should be compared to it from time to time
+ */
+static void *select_bits_alloc(int size)
+{
+	return kmalloc(6 * size, GFP_KERNEL);
+}
+
+static void select_bits_free(void *bits, int size)
+{
+	kfree(bits);
+}
+
+/*
+ * We can actually return ERESTARTSYS instead of EINTR, but I'd
+ * like to be certain this leads to no problems. So I return
+ * EINTR just for safety.
+ *
+ * Update: ERESTARTSYS breaks at least the xview clock binary, so
+ * I'm trying ERESTARTNOHAND which restart only when you want to.
+ */
+#define MAX_SELECT_SECONDS \
+	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
+
+asmlinkage long
+compat_sys_select(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp,
+		compat_ulong_t __user *exp, struct compat_timeval __user *tvp)
+{
+	fd_set_bits fds;
+	char *bits;
+	long timeout;
+	int ret, size, max_fdset;
+
+	timeout = MAX_SCHEDULE_TIMEOUT;
+	if (tvp) {
+		time_t sec, usec;
+
+		if ((ret = verify_area(VERIFY_READ, tvp, sizeof(*tvp)))
+		    || (ret = __get_user(sec, &tvp->tv_sec))
+		    || (ret = __get_user(usec, &tvp->tv_usec)))
+			goto out_nofds;
+
+		ret = -EINVAL;
+		if (sec < 0 || usec < 0)
+			goto out_nofds;
+
+		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
+			timeout = ROUND_UP(usec, 1000000/HZ);
+			timeout += sec * (unsigned long) HZ;
+		}
+	}
+
+	ret = -EINVAL;
+	if (n < 0)
+		goto out_nofds;
+
+	/* max_fdset can increase, so grab it once to avoid race */
+	max_fdset = current->files->max_fdset;
+	if (n > max_fdset)
+		n = max_fdset;
+
+	/*
+	 * We need 6 bitmaps (in/out/ex for both incoming and outgoing),
+	 * since we used fdset we need to allocate memory in units of
+	 * long-words.
+	 */
+	ret = -ENOMEM;
+	size = FDS_BYTES(n);
+	bits = select_bits_alloc(size);
+	if (!bits)
+		goto out_nofds;
+	fds.in      = (unsigned long *)  bits;
+	fds.out     = (unsigned long *) (bits +   size);
+	fds.ex      = (unsigned long *) (bits + 2*size);
+	fds.res_in  = (unsigned long *) (bits + 3*size);
+	fds.res_out = (unsigned long *) (bits + 4*size);
+	fds.res_ex  = (unsigned long *) (bits + 5*size);
+
+	if ((ret = compat_get_fd_set(n, inp, fds.in)) ||
+	    (ret = compat_get_fd_set(n, outp, fds.out)) ||
+	    (ret = compat_get_fd_set(n, exp, fds.ex)))
+		goto out;
+	zero_fd_set(n, fds.res_in);
+	zero_fd_set(n, fds.res_out);
+	zero_fd_set(n, fds.res_ex);
+
+	ret = do_select(n, &fds, &timeout);
+
+	if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
+		time_t sec = 0, usec = 0;
+		if (timeout) {
+			sec = timeout / HZ;
+			usec = timeout % HZ;
+			usec *= (1000000/HZ);
+		}
+		if (put_user(sec, &tvp->tv_sec) ||
+		    put_user(usec, &tvp->tv_usec))
+			ret = -EFAULT;
+	}
+
+	if (ret < 0)
+		goto out;
+	if (!ret) {
+		ret = -ERESTARTNOHAND;
+		if (signal_pending(current))
+			goto out;
+		ret = 0;
+	}
+
+	compat_set_fd_set(n, inp, fds.res_in);
+	compat_set_fd_set(n, outp, fds.res_out);
+	compat_set_fd_set(n, exp, fds.res_ex);
+
+out:
+	select_bits_free(bits, size);
+out_nofds:
+	return ret;
+}
+
+#if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)
+/* Stuff for NFS server syscalls... */
+struct compat_nfsctl_svc {
+	u16			svc32_port;
+	s32			svc32_nthreads;
+};
+
+struct compat_nfsctl_client {
+	s8			cl32_ident[NFSCLNT_IDMAX+1];
+	s32			cl32_naddr;
+	struct in_addr		cl32_addrlist[NFSCLNT_ADDRMAX];
+	s32			cl32_fhkeytype;
+	s32			cl32_fhkeylen;
+	u8			cl32_fhkey[NFSCLNT_KEYMAX];
+};
+
+struct compat_nfsctl_export {
+	char		ex32_client[NFSCLNT_IDMAX+1];
+	char		ex32_path[NFS_MAXPATHLEN+1];
+	compat_dev_t	ex32_dev;
+	compat_ino_t	ex32_ino;
+	compat_int_t	ex32_flags;
+	compat_uid_t	ex32_anon_uid;
+	compat_gid_t	ex32_anon_gid;
+};
+
+struct compat_nfsctl_fdparm {
+	struct sockaddr		gd32_addr;
+	s8			gd32_path[NFS_MAXPATHLEN+1];
+	compat_int_t		gd32_version;
+};
+
+struct compat_nfsctl_fsparm {
+	struct sockaddr		gd32_addr;
+	s8			gd32_path[NFS_MAXPATHLEN+1];
+	compat_int_t		gd32_maxlen;
+};
+
+struct compat_nfsctl_arg {
+	compat_int_t		ca32_version;	/* safeguard */
+	union {
+		struct compat_nfsctl_svc	u32_svc;
+		struct compat_nfsctl_client	u32_client;
+		struct compat_nfsctl_export	u32_export;
+		struct compat_nfsctl_fdparm	u32_getfd;
+		struct compat_nfsctl_fsparm	u32_getfs;
+	} u;
+#define ca32_svc	u.u32_svc
+#define ca32_client	u.u32_client
+#define ca32_export	u.u32_export
+#define ca32_getfd	u.u32_getfd
+#define ca32_getfs	u.u32_getfs
+};
+
+union compat_nfsctl_res {
+	__u8			cr32_getfh[NFS_FHSIZE];
+	struct knfsd_fh		cr32_getfs;
+};
+
+static int compat_nfs_svc_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
+{
+	int err;
+
+	err = access_ok(VERIFY_READ, &arg->ca32_svc, sizeof(arg->ca32_svc));
+	err |= get_user(karg->ca_version, &arg->ca32_version);
+	err |= __get_user(karg->ca_svc.svc_port, &arg->ca32_svc.svc32_port);
+	err |= __get_user(karg->ca_svc.svc_nthreads, &arg->ca32_svc.svc32_nthreads);
+	return (err) ? -EFAULT : 0;
+}
+
+static int compat_nfs_clnt_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
+{
+	int err;
+
+	err = access_ok(VERIFY_READ, &arg->ca32_client, sizeof(arg->ca32_client));
+	err |= get_user(karg->ca_version, &arg->ca32_version);
+	err |= __copy_from_user(&karg->ca_client.cl_ident[0],
+			  &arg->ca32_client.cl32_ident[0],
+			  NFSCLNT_IDMAX);
+	err |= __get_user(karg->ca_client.cl_naddr, &arg->ca32_client.cl32_naddr);
+	err |= __copy_from_user(&karg->ca_client.cl_addrlist[0],
+			  &arg->ca32_client.cl32_addrlist[0],
+			  (sizeof(struct in_addr) * NFSCLNT_ADDRMAX));
+	err |= __get_user(karg->ca_client.cl_fhkeytype,
+		      &arg->ca32_client.cl32_fhkeytype);
+	err |= __get_user(karg->ca_client.cl_fhkeylen,
+		      &arg->ca32_client.cl32_fhkeylen);
+	err |= __copy_from_user(&karg->ca_client.cl_fhkey[0],
+			  &arg->ca32_client.cl32_fhkey[0],
+			  NFSCLNT_KEYMAX);
+
+	return (err) ? -EFAULT : 0;
+}
+
+static int compat_nfs_exp_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
+{
+	int err;
+
+	err = access_ok(VERIFY_READ, &arg->ca32_export, sizeof(arg->ca32_export));
+	err |= get_user(karg->ca_version, &arg->ca32_version);
+	err |= __copy_from_user(&karg->ca_export.ex_client[0],
+			  &arg->ca32_export.ex32_client[0],
+			  NFSCLNT_IDMAX);
+	err |= __copy_from_user(&karg->ca_export.ex_path[0],
+			  &arg->ca32_export.ex32_path[0],
+			  NFS_MAXPATHLEN);
+	err |= __get_user(karg->ca_export.ex_dev,
+		      &arg->ca32_export.ex32_dev);
+	err |= __get_user(karg->ca_export.ex_ino,
+		      &arg->ca32_export.ex32_ino);
+	err |= __get_user(karg->ca_export.ex_flags,
+		      &arg->ca32_export.ex32_flags);
+	err |= __get_user(karg->ca_export.ex_anon_uid,
+		      &arg->ca32_export.ex32_anon_uid);
+	err |= __get_user(karg->ca_export.ex_anon_gid,
+		      &arg->ca32_export.ex32_anon_gid);
+	SET_UID(karg->ca_export.ex_anon_uid, karg->ca_export.ex_anon_uid);
+	SET_GID(karg->ca_export.ex_anon_gid, karg->ca_export.ex_anon_gid);
+
+	return (err) ? -EFAULT : 0;
+}
+
+static int compat_nfs_getfd_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
+{
+	int err;
+
+	err = access_ok(VERIFY_READ, &arg->ca32_getfd, sizeof(arg->ca32_getfd));
+	err |= get_user(karg->ca_version, &arg->ca32_version);
+	err |= __copy_from_user(&karg->ca_getfd.gd_addr,
+			  &arg->ca32_getfd.gd32_addr,
+			  (sizeof(struct sockaddr)));
+	err |= __copy_from_user(&karg->ca_getfd.gd_path,
+			  &arg->ca32_getfd.gd32_path,
+			  (NFS_MAXPATHLEN+1));
+	err |= __get_user(karg->ca_getfd.gd_version,
+		      &arg->ca32_getfd.gd32_version);
+
+	return (err) ? -EFAULT : 0;
+}
+
+static int compat_nfs_getfs_trans(struct nfsctl_arg *karg, struct compat_nfsctl_arg __user *arg)
+{
+	int err;
+
+	err = access_ok(VERIFY_READ, &arg->ca32_getfs, sizeof(arg->ca32_getfs));
+	err |= get_user(karg->ca_version, &arg->ca32_version);
+	err |= __copy_from_user(&karg->ca_getfs.gd_addr,
+			  &arg->ca32_getfs.gd32_addr,
+			  (sizeof(struct sockaddr)));
+	err |= __copy_from_user(&karg->ca_getfs.gd_path,
+			  &arg->ca32_getfs.gd32_path,
+			  (NFS_MAXPATHLEN+1));
+	err |= __get_user(karg->ca_getfs.gd_maxlen,
+		      &arg->ca32_getfs.gd32_maxlen);
+
+	return (err) ? -EFAULT : 0;
+}
+
+/* This really doesn't need translations, we are only passing
+ * back a union which contains opaque nfs file handle data.
+ */
+static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, union compat_nfsctl_res __user *res)
+{
+	int err;
+
+	err = copy_to_user(res, kres, sizeof(*res));
+
+	return (err) ? -EFAULT : 0;
+}
+
+asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg __user *arg,
+					union compat_nfsctl_res __user *res)
+{
+	struct nfsctl_arg *karg;
+	union nfsctl_res *kres;
+	mm_segment_t oldfs;
+	int err;
+
+	karg = kmalloc(sizeof(*karg), GFP_USER);
+	kres = kmalloc(sizeof(*kres), GFP_USER);
+	if(!karg || !kres) {
+		err = -ENOMEM;
+		goto done;
+	}
+
+	switch(cmd) {
+	case NFSCTL_SVC:
+		err = compat_nfs_svc_trans(karg, arg);
+		break;
+
+	case NFSCTL_ADDCLIENT:
+		err = compat_nfs_clnt_trans(karg, arg);
+		break;
+
+	case NFSCTL_DELCLIENT:
+		err = compat_nfs_clnt_trans(karg, arg);
+		break;
+
+	case NFSCTL_EXPORT:
+	case NFSCTL_UNEXPORT:
+		err = compat_nfs_exp_trans(karg, arg);
+		break;
+
+	case NFSCTL_GETFD:
+		err = compat_nfs_getfd_trans(karg, arg);
+		break;
+
+	case NFSCTL_GETFS:
+		err = compat_nfs_getfs_trans(karg, arg);
+		break;
+
+	default:
+		err = -EINVAL;
+		goto done;
+	}
+
+	oldfs = get_fs();
+	set_fs(KERNEL_DS);
+	/* The __user pointer casts are valid because of the set_fs() */
+	err = sys_nfsservctl(cmd, (void __user *) karg, (void __user *) kres);
+	set_fs(oldfs);
+
+	if (err)
+		goto done;
+
+	if((cmd == NFSCTL_GETFD) ||
+	   (cmd == NFSCTL_GETFS))
+		err = compat_nfs_getfh_res_trans(kres, res);
+
+done:
+	kfree(karg);
+	kfree(kres);
+	return err;
+}
+#else /* !NFSD */
+long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2)
+{
+	return sys_ni_syscall();
+}
+#endif
diff -Nru a/fs/compat_ioctl.c b/fs/compat_ioctl.c
--- a/fs/compat_ioctl.c	Tue Jun 15 22:21:03 2004
+++ b/fs/compat_ioctl.c	Tue Jun 15 22:21:03 2004
@@ -20,6 +20,7 @@
 #include <linux/smp_lock.h>
 #include <linux/ioctl.h>
 #include <linux/if.h>
+#include <linux/if_bridge.h>
 #include <linux/slab.h>
 #include <linux/hdreg.h>
 #include <linux/raid/md.h>
@@ -134,7 +135,7 @@
 	set_fs (KERNEL_DS);
 	err = sys_ioctl(fd, cmd, (unsigned long)&val);
 	set_fs (old_fs);
-	if (!err && put_user(val, (u32 *)compat_ptr(arg)))
+	if (!err && put_user(val, (u32 __user *)compat_ptr(arg)))
 		return -EFAULT;
 	return err;
 }
@@ -142,7 +143,7 @@
 static int rw_long(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	mm_segment_t old_fs = get_fs();
-	u32 *argptr = compat_ptr(arg);
+	u32 __user *argptr = compat_ptr(arg);
 	int err;
 	unsigned long val;
 	
@@ -176,7 +177,7 @@
 	u16 mode, signal;
 };
 
-static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 *up)
+static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
 {
 	int i;
 
@@ -192,7 +193,7 @@
 	return 0;
 }
 
-static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 *up)
+static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
 {
 	int i;
 
@@ -213,13 +214,18 @@
 	compat_int_t height, width, depth, bytesperline;
 };
 
-static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 *up)
+static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
 {
 	u32 tmp;
 
-	if(get_user(tmp, &up->base))
+	if (get_user(tmp, &up->base))
 		return -EFAULT;
-	kp->base = compat_ptr(tmp);
+
+	/* This is actually a physical address stored
+	 * as a void pointer.
+	 */
+	kp->base = (void *)(unsigned long) tmp;
+
 	__get_user(kp->height, &up->height);
 	__get_user(kp->width, &up->width);
 	__get_user(kp->depth, &up->depth);
@@ -227,7 +233,7 @@
 	return 0;
 }
 
-static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 *up)
+static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up)
 {
 	u32 tmp = (u32)((unsigned long)kp->base);
 
@@ -260,9 +266,9 @@
 		kfree(cp);
 }
 
-static int get_video_window32(struct video_window *kp, struct video_window32 *up)
+static int get_video_window32(struct video_window *kp, struct video_window32 __user *up)
 {
-	struct video_clip32 *ucp;
+	struct video_clip32 __user *ucp;
 	struct video_clip *kcp;
 	int nclips, err, i;
 	u32 tmp;
@@ -312,7 +318,7 @@
 }
 
 /* You get back everything except the clips... */
-static int put_video_window32(struct video_window *kp, struct video_window32 *up)
+static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
 {
 	if(put_user(kp->x, &up->x))
 		return -EFAULT;
@@ -343,7 +349,7 @@
 		unsigned long vx;
 	} karg;
 	mm_segment_t old_fs = get_fs();
-	void *up = compat_ptr(arg);
+	void __user *up = compat_ptr(arg);
 	int err = 0;
 
 	/* First, convert the command. */
@@ -373,7 +379,7 @@
 		break;
 
 	case VIDIOCSFREQ:
-		err = get_user(karg.vx, (u32 *)up);
+		err = get_user(karg.vx, (u32 __user *)up);
 		break;
 	};
 	if(err)
@@ -401,7 +407,7 @@
 			break;
 
 		case VIDIOCGFREQ:
-			err = put_user(((u32)karg.vx), (u32 *)up);
+			err = put_user(((u32)karg.vx), (u32 __user *)up);
 			break;
 		};
 	}
@@ -411,7 +417,7 @@
 
 static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct compat_timeval *up = compat_ptr(arg);
+	struct compat_timeval __user *up = compat_ptr(arg);
 	struct timeval ktv;
 	mm_segment_t old_fs = get_fs();
 	int err;
@@ -489,83 +495,79 @@
 {
 	struct ifconf32 ifc32;
 	struct ifconf ifc;
-	struct ifreq32 *ifr32;
-	struct ifreq *ifr;
-	mm_segment_t old_fs;
+	struct ifconf __user *uifc;
+	struct ifreq32 __user *ifr32;
+	struct ifreq __user *ifr;
 	unsigned int i, j;
 	int err;
 
 	if (copy_from_user(&ifc32, compat_ptr(arg), sizeof(struct ifconf32)))
 		return -EFAULT;
 
-	if(ifc32.ifcbuf == 0) {
+	if (ifc32.ifcbuf == 0) {
 		ifc32.ifc_len = 0;
 		ifc.ifc_len = 0;
-		ifc.ifc_buf = NULL;
+		ifc.ifc_req = NULL;
+		uifc = compat_alloc_user_space(sizeof(struct ifconf));
 	} else {
-		ifc.ifc_len = ((ifc32.ifc_len / sizeof (struct ifreq32)) + 1) *
+		size_t len =((ifc32.ifc_len / sizeof (struct ifreq32)) + 1) *
 			sizeof (struct ifreq);
-		/* should the size be limited? -arnd */
-		ifc.ifc_buf = kmalloc (ifc.ifc_len, GFP_KERNEL);
-		if (!ifc.ifc_buf)
-			return -ENOMEM;
+		uifc = compat_alloc_user_space(sizeof(struct ifconf) + len);
+		ifc.ifc_len = len;
+		ifr = ifc.ifc_req = (void __user *)(uifc + 1);
+		ifr32 = compat_ptr(ifc32.ifcbuf);
+		for (i = 0; i < ifc32.ifc_len; i += sizeof (struct ifreq32)) {
+			if (copy_in_user(ifr, ifr32, sizeof(struct ifreq32)))
+				return -EFAULT;
+			ifr++;
+			ifr32++; 
+		}
 	}
+	if (copy_to_user(uifc, &ifc, sizeof(struct ifconf)))
+		return -EFAULT;
+
+	err = sys_ioctl (fd, SIOCGIFCONF, (unsigned long)uifc);	
+	if (err)
+		return err;
+
+	if (copy_from_user(&ifc, uifc, sizeof(struct ifconf))) 
+		return -EFAULT;
+
 	ifr = ifc.ifc_req;
 	ifr32 = compat_ptr(ifc32.ifcbuf);
-	for (i = 0; i < ifc32.ifc_len; i += sizeof (struct ifreq32)) {
-		if (copy_from_user(ifr, ifr32, sizeof (struct ifreq32))) {
-			kfree (ifc.ifc_buf);
+	for (i = 0, j = 0; i < ifc32.ifc_len && j < ifc.ifc_len;
+	     i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) {
+		if (copy_in_user(ifr32, ifr, sizeof (struct ifreq32)))
 			return -EFAULT;
-		}
+		ifr32++;
 		ifr++;
-		ifr32++; 
 	}
-	old_fs = get_fs(); set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, SIOCGIFCONF, (unsigned long)&ifc);	
-	set_fs (old_fs);
-	if (!err) {
-		ifr = ifc.ifc_req;
-		ifr32 = compat_ptr(ifc32.ifcbuf);
-		for (i = 0, j = 0; i < ifc32.ifc_len && j < ifc.ifc_len;
-		     i += sizeof (struct ifreq32), j += sizeof (struct ifreq)) {
-			int k = copy_to_user(ifr32, ifr, sizeof (struct ifreq32));
-			ifr32++;
-			ifr++;
-			if (k) {
-				err = -EFAULT;
-				break;
-			}
-		       
-		}
-		if (!err) {
-			if (ifc32.ifcbuf == 0) {
-				/* Translate from 64-bit structure multiple to
-				 * a 32-bit one.
-				 */
-				i = ifc.ifc_len;
-				i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32));
-				ifc32.ifc_len = i;
-			} else {
-				if (i <= ifc32.ifc_len)
-					ifc32.ifc_len = i;
-				else
-					ifc32.ifc_len = i - sizeof (struct ifreq32);
-			}
-			if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32)))
-				err = -EFAULT;
-		}
+
+	if (ifc32.ifcbuf == 0) {
+		/* Translate from 64-bit structure multiple to
+		 * a 32-bit one.
+		 */
+		i = ifc.ifc_len;
+		i = ((i / sizeof(struct ifreq)) * sizeof(struct ifreq32));
+		ifc32.ifc_len = i;
+	} else {
+		if (i <= ifc32.ifc_len)
+			ifc32.ifc_len = i;
+		else
+			ifc32.ifc_len = i - sizeof (struct ifreq32);
 	}
-	if(ifc.ifc_buf != NULL)
-		kfree (ifc.ifc_buf);
-	return err;
+	if (copy_to_user(compat_ptr(arg), &ifc32, sizeof(struct ifconf32)))
+		return -EFAULT;
+
+	return 0;
 }
 
 static int ethtool_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct ifreq *ifr;
-	struct ifreq32 *ifr32;
+	struct ifreq __user *ifr;
+	struct ifreq32 __user *ifr32;
 	u32 data;
-	void *datap;
+	void __user *datap;
 	
 	ifr = compat_alloc_user_space(sizeof(*ifr));
 	ifr32 = compat_ptr(arg);
@@ -586,12 +588,12 @@
 static int bond_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	struct ifreq kifr;
-	struct ifreq *uifr;
-	struct ifreq32 *ifr32 = compat_ptr(arg);
+	struct ifreq __user *uifr;
+	struct ifreq32 __user *ifr32 = compat_ptr(arg);
 	mm_segment_t old_fs;
 	int err;
 	u32 data;
-	void *datap;
+	void __user *datap;
 
 	switch (cmd) {
 	case SIOCBONDENSLAVE:
@@ -628,10 +630,10 @@
 
 int siocdevprivate_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct ifreq *u_ifreq64;
-	struct ifreq32 *u_ifreq32 = compat_ptr(arg);
+	struct ifreq __user *u_ifreq64;
+	struct ifreq32 __user *u_ifreq32 = compat_ptr(arg);
 	char tmp_buf[IFNAMSIZ];
-	void *data64;
+	void __user *data64;
 	u32 data32;
 
 	if (copy_from_user(&tmp_buf[0], &(u_ifreq32->ifr_ifrn.ifrn_name[0]),
@@ -655,8 +657,8 @@
 static int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	struct ifreq ifr;
-	struct ifreq32 *uifr32;
-	struct ifmap32 *uifmap32;
+	struct ifreq32 __user *uifr32;
+	struct ifmap32 __user *uifmap32;
 	mm_segment_t old_fs;
 	int err;
 	
@@ -760,7 +762,7 @@
 	struct socket *mysock = sockfd_lookup(fd, &ret);
 
 	if (mysock && mysock->sk && mysock->sk->sk_family == AF_INET6) { /* ipv6 */
-		struct in6_rtmsg32 *ur6 = compat_ptr(arg);
+		struct in6_rtmsg32 __user *ur6 = compat_ptr(arg);
 		ret = copy_from_user (&r6.rtmsg_dst, &(ur6->rtmsg_dst),
 			3 * sizeof(struct in6_addr));
 		ret |= __get_user (r6.rtmsg_type, &(ur6->rtmsg_type));
@@ -773,7 +775,7 @@
 		
 		r = (void *) &r6;
 	} else { /* ipv4 */
-		struct rtentry32 *ur4 = compat_ptr(arg);
+		struct rtentry32 __user *ur4 = compat_ptr(arg);
 		ret = copy_from_user (&r4.rt_dst, &(ur4->rt_dst),
 					3 * sizeof(struct sockaddr));
 		ret |= __get_user (r4.rt_flags, &(ur4->rt_flags));
@@ -815,7 +817,7 @@
 {
 	mm_segment_t old_fs = get_fs();
 	struct hd_geometry geo;
-	struct hd_geometry32 *ugeo;
+	struct hd_geometry32 __user *ugeo;
 	int err;
 	
 	set_fs (KERNEL_DS);
@@ -855,23 +857,11 @@
 	compat_caddr_t	transp;
 };
 
-static int do_cmap_ptr(__u16 **ptr64, __u32 *ptr32)
-{
-	__u32 data;
-	void *datap;
-
-	if (get_user(data, ptr32))
-		return -EFAULT;
-	datap = compat_ptr(data);
-	if (put_user(datap, ptr64))
-		return -EFAULT;
-	return 0;
-}
-
 static int fb_getput_cmap(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct fb_cmap *cmap;
-	struct fb_cmap32 *cmap32;
+	struct fb_cmap __user *cmap;
+	struct fb_cmap32 __user *cmap32;
+	__u32 data;
 	int err;
 
 	cmap = compat_alloc_user_space(sizeof(*cmap));
@@ -880,10 +870,14 @@
 	if (copy_in_user(&cmap->start, &cmap32->start, 2 * sizeof(__u32)))
 		return -EFAULT;
 
-	if (do_cmap_ptr(&cmap->red, &cmap32->red) ||
-	    do_cmap_ptr(&cmap->green, &cmap32->green) ||
-	    do_cmap_ptr(&cmap->blue, &cmap32->blue) ||
-	    do_cmap_ptr(&cmap->transp, &cmap32->transp))
+	if (get_user(data, &cmap32->red) ||
+	    put_user(compat_ptr(data), &cmap->red) ||
+	    get_user(data, &cmap32->green) ||
+	    put_user(compat_ptr(data), &cmap->green) ||
+	    get_user(data, &cmap32->blue) ||
+	    put_user(compat_ptr(data), &cmap->blue) ||
+	    get_user(data, &cmap32->transp) ||
+	    put_user(compat_ptr(data), &cmap->transp))
 		return -EFAULT;
 
 	err = sys_ioctl(fd, cmd, (unsigned long) cmap);
@@ -898,7 +892,7 @@
 }
 
 static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix,
-				  struct fb_fix_screeninfo32 *fix32)
+				  struct fb_fix_screeninfo32 __user *fix32)
 {
 	__u32 data;
 	int err;
@@ -932,7 +926,7 @@
 {
 	mm_segment_t old_fs;
 	struct fb_fix_screeninfo fix;
-	struct fb_fix_screeninfo32 *fix32;
+	struct fb_fix_screeninfo32 __user *fix32;
 	int err;
 
 	fix32 = compat_ptr(arg);
@@ -981,7 +975,7 @@
 {
 	mm_segment_t old_fs = get_fs();
 	unsigned long kval;
-	unsigned int *uvp;
+	unsigned int __user *uvp;
 	int error;
 
 	set_fs(KERNEL_DS);
@@ -1028,10 +1022,10 @@
 	compat_uint_t iov_len;
 } sg_iovec32_t;
 
-static int sg_build_iovec(sg_io_hdr_t *sgio, void *dxferp, u16 iovec_count)
+static int sg_build_iovec(sg_io_hdr_t __user *sgio, void __user *dxferp, u16 iovec_count)
 {
-	sg_iovec_t *iov = (sg_iovec_t *) (sgio + 1);
-	sg_iovec32_t *iov32 = dxferp;
+	sg_iovec_t __user *iov = (sg_iovec_t __user *) (sgio + 1);
+	sg_iovec32_t __user *iov32 = dxferp;
 	int i;
 
 	for (i = 0; i < iovec_count; i++) {
@@ -1044,17 +1038,18 @@
 			return -EFAULT;
 	}
 
-	sgio->dxferp = iov; /* FIXME: dereferencing user pointer? */
+	if (put_user(iov, &sgio->dxferp))
+		return -EFAULT;
 	return 0;
 }
 
 static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	sg_io_hdr_t *sgio;
-	sg_io_hdr32_t *sgio32;
+	sg_io_hdr_t __user *sgio;
+	sg_io_hdr32_t __user *sgio32;
 	u16 iovec_count;
 	u32 data;
-	void *dxferp;
+	void __user *dxferp;
 	int err;
 
 	sgio32 = compat_ptr(arg);
@@ -1062,12 +1057,9 @@
 		return -EFAULT;
 
 	{
-		void *new, *top;
-
-		top = compat_alloc_user_space(0);
-		new = compat_alloc_user_space(sizeof(sg_io_hdr_t) +
-				       (iovec_count *
-					sizeof(sg_iovec_t)));
+		void __user *top = compat_alloc_user_space(0);
+		void __user *new = compat_alloc_user_space(sizeof(sg_io_hdr_t) +
+				       (iovec_count * sizeof(sg_iovec_t)));
 		if (new > top)
 			return -EINVAL;
 
@@ -1094,7 +1086,8 @@
 	}
 
 	{
-		unsigned char *cmdp, *sbp;
+		unsigned char __user *cmdp;
+		unsigned char __user *sbp;
 
 		if (get_user(data, &sgio32->cmdp))
 			return -EFAULT;
@@ -1127,7 +1120,7 @@
 	err = sys_ioctl(fd, cmd, (unsigned long) sgio);
 
 	if (err >= 0) {
-		void *datap;
+		void __user *datap;
 
 		if (copy_in_user(&sgio32->pack_id, &sgio->pack_id,
 				 sizeof(int)) ||
@@ -1154,9 +1147,9 @@
 
 static int ppp_sock_fprog_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct sock_fprog32 *u_fprog32 = compat_ptr(arg);
-	struct sock_fprog *u_fprog64 = compat_alloc_user_space(sizeof(struct sock_fprog));
-	void *fptr64;
+	struct sock_fprog32 __user *u_fprog32 = compat_ptr(arg);
+	struct sock_fprog __user *u_fprog64 = compat_alloc_user_space(sizeof(struct sock_fprog));
+	void __user *fptr64;
 	u32 fptr32;
 	u16 flen;
 
@@ -1193,8 +1186,8 @@
 
 static int ppp_gidle(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct ppp_idle *idle;
-	struct ppp_idle32 *idle32;
+	struct ppp_idle __user *idle;
+	struct ppp_idle32 __user *idle32;
 	__kernel_time_t xmit, recv;
 	int err;
 
@@ -1215,10 +1208,10 @@
 
 static int ppp_scompress(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct ppp_option_data *odata;
-	struct ppp_option_data32 *odata32;
+	struct ppp_option_data __user *odata;
+	struct ppp_option_data32 __user *odata32;
 	__u32 data;
-	void *datap;
+	void __user *datap;
 
 	odata = compat_alloc_user_space(sizeof(*odata));
 	odata32 = compat_ptr(arg);
@@ -1310,11 +1303,11 @@
 {
 	mm_segment_t old_fs = get_fs();
 	struct mtconfiginfo info;
-	struct mtconfiginfo32 *uinfo32;
+	struct mtconfiginfo32 __user *uinfo32;
 	struct mtget get;
-	struct mtget32 *umget32;
+	struct mtget32 __user *umget32;
 	struct mtpos pos;
-	struct mtpos32 *upos32;
+	struct mtpos32 __user *upos32;
 	unsigned long kcmd;
 	void *karg;
 	int err = 0;
@@ -1344,7 +1337,7 @@
 		err |= __get_user(info.debug, &uinfo32->debug);
 		err |= __copy_from_user((char *)&info.debug
 				     + sizeof(info.debug),
-				     (char *)&uinfo32->debug
+				     (char __user *)&uinfo32->debug
 				     + sizeof(uinfo32->debug), sizeof(__u32));
 		if (err)
 			return -EFAULT;
@@ -1387,7 +1380,7 @@
 		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 *)&uinfo32->debug
+		err |= __copy_to_user((char __user *)&uinfo32->debug
 			    		   + sizeof(uinfo32->debug),
 					   (char *)&info.debug + sizeof(info.debug), sizeof(__u32));
 		break;
@@ -1418,10 +1411,10 @@
   
 static int cdrom_do_read_audio(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct cdrom_read_audio *cdread_audio;
-	struct cdrom_read_audio32 *cdread_audio32;
+	struct cdrom_read_audio __user *cdread_audio;
+	struct cdrom_read_audio32 __user *cdread_audio32;
 	__u32 data;
-	void *datap;
+	void __user *datap;
 
 	cdread_audio = compat_alloc_user_space(sizeof(*cdread_audio));
 	cdread_audio32 = compat_ptr(arg);
@@ -1441,24 +1434,11 @@
 	return sys_ioctl(fd, cmd, (unsigned long) cdread_audio);
 }
 
-static int __cgc_do_ptr(void **ptr64, __u32 *ptr32)
-{
-	u32 data;
-	void *datap;
-
-	if (get_user(data, ptr32))
-		return -EFAULT;
-	datap = compat_ptr(data);
-	if (put_user(datap, ptr64))
-		return -EFAULT;
-
-	return 0;
-}
-
 static int cdrom_do_generic_command(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct cdrom_generic_command *cgc;
-	struct cdrom_generic_command32 *cgc32;
+	struct cdrom_generic_command __user *cgc;
+	struct cdrom_generic_command32 __user *cgc32;
+	u32 data;
 	unsigned char dir;
 	int itmp;
 
@@ -1466,25 +1446,20 @@
 	cgc32 = compat_ptr(arg);
 
 	if (copy_in_user(&cgc->cmd, &cgc32->cmd, sizeof(cgc->cmd)) ||
-	    __cgc_do_ptr((void **) &cgc->buffer, &cgc32->buffer) ||
+	    get_user(data, &cgc32->buffer) ||
+	    put_user(compat_ptr(data), &cgc->buffer) ||
 	    copy_in_user(&cgc->buflen, &cgc32->buflen,
 			 (sizeof(unsigned int) + sizeof(int))) ||
-	    __cgc_do_ptr((void **) &cgc->sense, &cgc32->sense))
-		return -EFAULT;
-
-	if (get_user(dir, &cgc32->data_direction) ||
-	    put_user(dir, &cgc->data_direction))
-		return -EFAULT;
-
-	if (get_user(itmp, &cgc32->quiet) ||
-	    put_user(itmp, &cgc->quiet))
-		return -EFAULT;
-
-	if (get_user(itmp, &cgc32->timeout) ||
-	    put_user(itmp, &cgc->timeout))
-		return -EFAULT;
-
-	if (__cgc_do_ptr(&cgc->reserved[0], &cgc32->reserved[0]))
+	    get_user(data, &cgc32->sense) ||
+	    put_user(compat_ptr(data), &cgc->sense) ||
+	    get_user(dir, &cgc32->data_direction) ||
+	    put_user(dir, &cgc->data_direction) ||
+	    get_user(itmp, &cgc32->quiet) ||
+	    put_user(itmp, &cgc->quiet) ||
+	    get_user(itmp, &cgc32->timeout) ||
+	    put_user(itmp, &cgc->timeout) ||
+	    get_user(data, &cgc32->reserved[0]) ||
+	    put_user(compat_ptr(data), &cgc->reserved[0]))
 		return -EFAULT;
 
 	return sys_ioctl(fd, cmd, (unsigned long) cgc);
@@ -1537,7 +1512,7 @@
 {
 	mm_segment_t old_fs = get_fs();
 	struct loop_info l;
-	struct loop_info32 *ul;
+	struct loop_info32 __user *ul;
 	int err = -EINVAL;
 
 	ul = compat_ptr(arg);
@@ -1619,19 +1594,14 @@
 
 static int do_fontx_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file)
 {
-	struct consolefontdesc cfdarg;
+	struct consolefontdesc32 __user *user_cfd = compat_ptr(arg);
 	struct console_font_op op;
-	struct consolefontdesc32 *user_cfd = compat_ptr(arg);
+	compat_caddr_t data;
 	int i, perm;
 
 	perm = vt_check(file);
 	if (perm < 0) return perm;
 	
-	if (copy_from_user(&cfdarg, user_cfd, sizeof(struct consolefontdesc32)))
-		return -EFAULT;
-	
-	cfdarg.chardata = compat_ptr(((struct consolefontdesc32 *)&cfdarg)->chardata);
- 	
 	switch (cmd) {
 	case PIO_FONTX:
 		if (!perm)
@@ -1639,26 +1609,30 @@
 		op.op = KD_FONT_OP_SET;
 		op.flags = 0;
 		op.width = 8;
-		op.height = cfdarg.charheight;
-		op.charcount = cfdarg.charcount;
-		op.data = cfdarg.chardata;
+		if (get_user(op.height, &user_cfd->charheight) ||
+		    get_user(op.charcount, &user_cfd->charcount) ||
+		    get_user(data, &user_cfd->chardata))
+			return -EFAULT;
+		op.data = compat_ptr(data);
 		return con_font_op(fg_console, &op);
 	case GIO_FONTX:
-		if (!cfdarg.chardata)
-			return 0;
 		op.op = KD_FONT_OP_GET;
 		op.flags = 0;
 		op.width = 8;
-		op.height = cfdarg.charheight;
-		op.charcount = cfdarg.charcount;
-		op.data = cfdarg.chardata;
+		if (get_user(op.height, &user_cfd->charheight) ||
+		    get_user(op.charcount, &user_cfd->charcount) ||
+		    get_user(data, &user_cfd->chardata))
+			return -EFAULT;
+		if (!data)
+			return 0;
+		op.data = compat_ptr(data);
 		i = con_font_op(fg_console, &op);
 		if (i)
 			return i;
-		cfdarg.charheight = op.height;
-		cfdarg.charcount = op.charcount;
-		((struct consolefontdesc32 *)&cfdarg)->chardata	= (unsigned long)cfdarg.chardata;
-		if (copy_to_user(user_cfd, &cfdarg, sizeof(struct consolefontdesc32)))
+		if (put_user(op.height, &user_cfd->charheight) ||
+		    put_user(op.charcount, &user_cfd->charcount) ||
+		    put_user((compat_caddr_t)(unsigned long)op.data,
+				&user_cfd->chardata))
 			return -EFAULT;
 		return 0;
 	}
@@ -1676,13 +1650,13 @@
 static int do_kdfontop_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file)
 {
 	struct console_font_op op;
-	struct console_font_op32 *fontop = compat_ptr(arg);
+	struct console_font_op32 __user *fontop = compat_ptr(arg);
 	int perm = vt_check(file), i;
 	struct vt_struct *vt;
 	
 	if (perm < 0) return perm;
 	
-	if (copy_from_user(&op, (void *) fontop, sizeof(struct console_font_op32)))
+	if (copy_from_user(&op, fontop, sizeof(struct console_font_op32)))
 		return -EFAULT;
 	if (!perm && op.op != KD_FONT_OP_GET)
 		return -EPERM;
@@ -1692,7 +1666,7 @@
 	i = con_font_op(vt->vc_num, &op);
 	if (i) return i;
 	((struct console_font_op32 *)&op)->data = (unsigned long)op.data;
-	if (copy_to_user((void *) fontop, &op, sizeof(struct console_font_op32)))
+	if (copy_to_user(fontop, &op, sizeof(struct console_font_op32)))
 		return -EFAULT;
 	return 0;
 }
@@ -1705,7 +1679,7 @@
 static int do_unimap_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file)
 {
 	struct unimapdesc32 tmp;
-	struct unimapdesc32 *user_ud = compat_ptr(arg);
+	struct unimapdesc32 __user *user_ud = compat_ptr(arg);
 	int perm = vt_check(file);
 	
 	if (perm < 0) return perm;
@@ -1736,7 +1710,7 @@
 	set_fs(old_fs);
 
 	if (err >= 0)
-		err = put_user(kuid, (compat_uid_t *)compat_ptr(arg));
+		err = put_user(kuid, (compat_uid_t __user *)compat_ptr(arg));
 
 	return err;
 }
@@ -1798,10 +1772,10 @@
 
 static int do_atm_iobuf(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct atm_iobuf   *iobuf;
-	struct atm_iobuf32 *iobuf32;
+	struct atm_iobuf   __user *iobuf;
+	struct atm_iobuf32 __user *iobuf32;
 	u32 data;
-	void *datap;
+	void __user *datap;
 	int len, err;
 
 	iobuf = compat_alloc_user_space(sizeof(*iobuf));
@@ -1828,10 +1802,10 @@
 
 static int do_atmif_sioc(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-        struct atmif_sioc   *sioc;
-	struct atmif_sioc32 *sioc32;
+        struct atmif_sioc   __user *sioc;
+	struct atmif_sioc32 __user *sioc32;
 	u32 data;
-	void *datap;
+	void __user *datap;
 	int err;
         
 	sioc = compat_alloc_user_space(sizeof(*sioc));
@@ -1926,39 +1900,24 @@
 
 static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct blkpg_ioctl_arg a;
-	struct blkpg_ioctl_arg32 *ua32;
-	struct blkpg_partition p;
-	struct blkpg_partition *up32;
+	struct blkpg_ioctl_arg32 __user *ua32 = compat_ptr(arg);
+	struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a));
 	compat_caddr_t udata;
+	compat_int_t n;
 	int err;
-	mm_segment_t old_fs = get_fs();
 	
-	ua32 = compat_ptr(arg);
-	err = get_user(a.op, &ua32->op);
-	err |= __get_user(a.flags, &ua32->flags);
-	err |= __get_user(a.datalen, &ua32->datalen);
-	err |= __get_user(udata, &ua32->data);
-	up32 = compat_ptr(udata);
+	err = get_user(n, &ua32->op);
+	err |= put_user(n, &a->op);
+	err |= get_user(n, &ua32->flags);
+	err |= put_user(n, &a->flags);
+	err |= get_user(n, &ua32->datalen);
+	err |= put_user(n, &a->datalen);
+	err |= get_user(udata, &ua32->data);
+	err |= put_user(compat_ptr(udata), &a->data);
 	if (err)
 		return err;
 
-	switch (a.op) {
-	case BLKPG_ADD_PARTITION:
-	case BLKPG_DEL_PARTITION:
-		if (a.datalen < sizeof(struct blkpg_partition))
-			return -EINVAL;
-                if (copy_from_user(&p, up32, sizeof(struct blkpg_partition)))
-			return -EFAULT;
-		a.data = &p;
-		set_fs (KERNEL_DS);
-		err = sys_ioctl(fd, cmd, (unsigned long)&a);
-		set_fs (old_fs);
-		break;
-	default:
-		return -EINVAL;
-	}                                        
-	return err;
+	return sys_ioctl(fd, cmd, (unsigned long)a);
 }
 
 static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg)
@@ -2127,7 +2086,7 @@
 		case FDGETPRM32:
 		{
 			compat_uptr_t name;
-			struct floppy_struct32 *uf;
+			struct floppy_struct32 __user *uf;
 			struct floppy_struct *f;
 
 			uf = compat_ptr(arg);
@@ -2156,7 +2115,7 @@
 		case FDSETDRVPRM32:
 		case FDGETDRVPRM32:
 		{
-			struct floppy_drive_params32 *uf;
+			struct floppy_drive_params32 __user *uf;
 			struct floppy_drive_params *f;
 
 			uf = compat_ptr(arg);
@@ -2218,22 +2177,23 @@
 		case FDGETPRM32:
 		{
 			struct floppy_struct *f = karg;
+			struct floppy_struct32 __user *uf = compat_ptr(arg);
 
-			err = __put_user(f->size, &((struct floppy_struct32 *)arg)->size);
-			err |= __put_user(f->sect, &((struct floppy_struct32 *)arg)->sect);
-			err |= __put_user(f->head, &((struct floppy_struct32 *)arg)->head);
-			err |= __put_user(f->track, &((struct floppy_struct32 *)arg)->track);
-			err |= __put_user(f->stretch, &((struct floppy_struct32 *)arg)->stretch);
-			err |= __put_user(f->gap, &((struct floppy_struct32 *)arg)->gap);
-			err |= __put_user(f->rate, &((struct floppy_struct32 *)arg)->rate);
-			err |= __put_user(f->spec1, &((struct floppy_struct32 *)arg)->spec1);
-			err |= __put_user(f->fmt_gap, &((struct floppy_struct32 *)arg)->fmt_gap);
-			err |= __put_user((u64)f->name, (compat_caddr_t*)&((struct floppy_struct32 *)arg)->name);
+			err = __put_user(f->size, &uf->size);
+			err |= __put_user(f->sect, &uf->sect);
+			err |= __put_user(f->head, &uf->head);
+			err |= __put_user(f->track, &uf->track);
+			err |= __put_user(f->stretch, &uf->stretch);
+			err |= __put_user(f->gap, &uf->gap);
+			err |= __put_user(f->rate, &uf->rate);
+			err |= __put_user(f->spec1, &uf->spec1);
+			err |= __put_user(f->fmt_gap, &uf->fmt_gap);
+			err |= __put_user((u64)f->name, (compat_caddr_t __user *)&uf->name);
 			break;
 		}
 		case FDGETDRVPRM32:
 		{
-			struct floppy_drive_params32 *uf;
+			struct floppy_drive_params32 __user *uf;
 			struct floppy_drive_params *f = karg;
 
 			uf = compat_ptr(arg);
@@ -2261,7 +2221,7 @@
 		case FDGETDRVSTAT32:
 		case FDPOLLDRVSTAT32:
 		{
-			struct floppy_drive_struct32 *uf;
+			struct floppy_drive_struct32 __user *uf;
 			struct floppy_drive_struct *f = karg;
 
 			uf = compat_ptr(arg);
@@ -2284,7 +2244,7 @@
 		}
 		case FDGETFDCSTAT32:
 		{
-			struct floppy_fdc_state32 *uf;
+			struct floppy_fdc_state32 __user *uf;
 			struct floppy_fdc_state *f = karg;
 
 			uf = compat_ptr(arg);
@@ -2294,7 +2254,7 @@
 			err |= __put_user(f->version, &uf->version);
 			err |= __put_user(f->dor, &uf->dor);
 			err |= __put_user(f->address, &uf->address);
-			err |= __copy_to_user((char *)&uf->address + sizeof(uf->address),
+			err |= __copy_to_user((char __user *)&uf->address + sizeof(uf->address),
 					   (char *)&f->address + sizeof(f->address), sizeof(int));
 			err |= __put_user(f->driver_version, &uf->driver_version);
 			err |= __copy_to_user(uf->track, f->track, sizeof(f->track));
@@ -2302,7 +2262,7 @@
 		}
 		case FDWERRORGET32:
 		{
-			struct floppy_write_errors32 *uf;
+			struct floppy_write_errors32 __user *uf;
 			struct floppy_write_errors *f = karg;
 
 			uf = compat_ptr(arg);
@@ -2335,10 +2295,10 @@
 
 static int mtd_rw_oob(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct mtd_oob_buf	*buf = compat_alloc_user_space(sizeof(*buf));
-	struct mtd_oob_buf32	*buf32 = compat_ptr(arg);
+	struct mtd_oob_buf __user *buf = compat_alloc_user_space(sizeof(*buf));
+	struct mtd_oob_buf32 __user *buf32 = compat_ptr(arg);
 	u32 data;
-	char *datap;
+	char __user *datap;
 	unsigned int real_cmd;
 	int err;
 
@@ -2368,7 +2328,7 @@
 #define	VFAT_IOCTL_READDIR_SHORT32	_IOR('r', 2, struct compat_dirent[2])
 
 static long
-put_dirent32 (struct dirent *d, struct compat_dirent *d32)
+put_dirent32 (struct dirent *d, struct compat_dirent __user *d32)
 {
         int ret;
 
@@ -2385,6 +2345,7 @@
 
 static int vfat_ioctl32(unsigned fd, unsigned cmd, unsigned long arg)
 {
+	struct compat_dirent __user *p = compat_ptr(arg);
 	int ret;
 	mm_segment_t oldfs = get_fs();
 	struct dirent d[2];
@@ -2403,8 +2364,8 @@
 	ret = sys_ioctl(fd,cmd,(unsigned long)&d);
 	set_fs(oldfs);
 	if (ret >= 0) {
-		ret |= put_dirent32(&d[0], (struct compat_dirent *)compat_ptr(arg));
-		ret |= put_dirent32(&d[1], ((struct compat_dirent *)compat_ptr(arg)) + 1);
+		ret |= put_dirent32(&d[0], p);
+		ret |= put_dirent32(&d[1], p + 1);
 	}
 	return ret;
 }
@@ -2426,28 +2387,22 @@
         __u64   block_minor;
 } __attribute__((packed));
 
-static int get_raw32_request(struct raw_config_request *req, struct raw32_config_request *user_req)
+static int get_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req)
 {
-        __u32   lo_maj, hi_maj, lo_min, hi_min;
         int ret;
 
         if ((ret = verify_area(VERIFY_READ, user_req,
                                sizeof(struct raw32_config_request))))
                 return ret;
 
-        __get_user(req->raw_minor, &user_req->raw_minor);
-        __get_user(lo_maj, (__u32*)&user_req->block_major);
-        __get_user(hi_maj, ((__u32*)(&user_req->block_major) + 1));
-        __get_user(lo_min, (__u32*)&user_req->block_minor);
-        __get_user(hi_min, ((__u32*)(&user_req->block_minor) + 1));
-
-        req->block_major = lo_maj | (((__u64)hi_maj) << 32);
-        req->block_minor = lo_min | (((__u64)hi_min) << 32);
+        ret = __get_user(req->raw_minor, &user_req->raw_minor);
+        ret |= __get_user(req->block_major, &user_req->block_major);
+        ret |= __get_user(req->block_minor, &user_req->block_minor);
 
-        return ret;
+        return ret ? -EFAULT : 0;
 }
 
-static int set_raw32_request(struct raw_config_request *req, struct raw32_config_request *user_req)
+static int set_raw32_request(struct raw_config_request *req, struct raw32_config_request __user *user_req)
 {
 	int ret;
 
@@ -2455,13 +2410,11 @@
                                sizeof(struct raw32_config_request))))
                 return ret;
 
-        __put_user(req->raw_minor, &user_req->raw_minor);
-        __put_user((__u32)(req->block_major), (__u32*)&user_req->block_major);
-        __put_user((__u32)(req->block_major >> 32), ((__u32*)(&user_req->block_major) + 1));
-        __put_user((__u32)(req->block_minor), (__u32*)&user_req->block_minor);
-        __put_user((__u32)(req->block_minor >> 32), ((__u32*)(&user_req->block_minor) + 1));
+        ret = __put_user(req->raw_minor, &user_req->raw_minor);
+        ret |= __put_user(req->block_major, &user_req->block_major);
+        ret |= __put_user(req->block_minor, &user_req->block_minor);
 
-        return ret;
+        return ret ? -EFAULT : 0;
 }
 
 static int raw_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
@@ -2472,7 +2425,7 @@
         case RAW_SETBIND:
         case RAW_GETBIND: {
                 struct raw_config_request req;
-                struct raw32_config_request *user_req = compat_ptr(arg);
+                struct raw32_config_request __user *user_req = compat_ptr(arg);
                 mm_segment_t oldfs = get_fs();
 
                 if ((ret = get_raw32_request(&req, user_req)))
@@ -2520,7 +2473,7 @@
 {
         typedef struct serial_struct SS;
         typedef struct serial_struct32 SS32;
-        struct serial_struct32 *ss32 = compat_ptr(arg);
+        struct serial_struct32 __user *ss32 = compat_ptr(arg);
         int err;
         struct serial_struct ss;
         mm_segment_t oldseg = get_fs();
@@ -2568,10 +2521,11 @@
 static int do_usbdevfs_control(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
         struct usbdevfs_ctrltransfer kctrl;
-        struct usbdevfs_ctrltransfer32 *uctrl;
+        struct usbdevfs_ctrltransfer32 __user *uctrl;
         mm_segment_t old_fs;
         __u32 udata;
-        void *uptr, *kptr;
+        void __user *uptr;
+        void *kptr;
         int err;
 
         uctrl = compat_ptr(arg);
@@ -2629,10 +2583,11 @@
 static int do_usbdevfs_bulk(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
         struct usbdevfs_bulktransfer kbulk;
-        struct usbdevfs_bulktransfer32 *ubulk;
+        struct usbdevfs_bulktransfer32 __user *ubulk;
         mm_segment_t old_fs;
         __u32 udata;
-        void *uptr, *kptr;
+        void __user *uptr;
+        void *kptr;
         int err;
 
 	ubulk = compat_ptr(arg);
@@ -2895,7 +2850,7 @@
         set_fs(old_fs);
 
         if (err >= 0 &&
-            put_user((u32)(u64)kptr, (u32 *)compat_ptr(arg)))
+            put_user((u32)(u64)kptr, (u32 __user *)compat_ptr(arg)))
                 err = -EFAULT;
 
         return err;
@@ -2911,7 +2866,7 @@
 static int do_usbdevfs_discsignal(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
         struct usbdevfs_disconnectsignal kdis;
-        struct usbdevfs_disconnectsignal32 *udis;
+        struct usbdevfs_disconnectsignal32 __user *udis;
         mm_segment_t old_fs;
         u32 uctx;
         int err;
@@ -2957,10 +2912,10 @@
 
 static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct i2c_rdwr_ioctl_data	*tdata;
-	struct i2c_rdwr_ioctl_data32	*udata;
-	struct i2c_msg			*tmsgs;
-	struct i2c_msg32		*umsgs;
+	struct i2c_rdwr_ioctl_data	__user *tdata;
+	struct i2c_rdwr_ioctl_data32	__user *udata;
+	struct i2c_msg			__user *tmsgs;
+	struct i2c_msg32		__user *umsgs;
 	compat_caddr_t			datap;
 	int				nmsgs, i;
 
@@ -2970,7 +2925,7 @@
 	if (verify_area(VERIFY_WRITE, tdata, sizeof(*tdata)))
 		return -EFAULT;
 
-	udata = (struct i2c_rdwr_ioctl_data32 *)compat_ptr(arg);
+	udata = compat_ptr(arg);
 	if (verify_area(VERIFY_READ, udata, sizeof(*udata)))
 		return -EFAULT;
 	if (__get_user(nmsgs, &udata->nmsgs) || __put_user(nmsgs, &tdata->nmsgs))
@@ -2979,7 +2934,7 @@
 		return -EINVAL;
 	if (__get_user(datap, &udata->msgs))
 		return -EFAULT;
-	umsgs = (struct i2c_msg32 *)compat_ptr(datap);
+	umsgs = compat_ptr(datap);
 	if (verify_area(VERIFY_READ, umsgs, sizeof(struct i2c_msg) * nmsgs))
 		return -EFAULT;
 
@@ -3004,8 +2959,8 @@
 
 static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct i2c_smbus_ioctl_data	*tdata;
-	struct i2c_smbus_ioctl_data32	*udata;
+	struct i2c_smbus_ioctl_data	__user *tdata;
+	struct i2c_smbus_ioctl_data32	__user *udata;
 	compat_caddr_t			datap;
 
 	tdata = compat_alloc_user_space(sizeof(*tdata));
@@ -3014,7 +2969,7 @@
 	if (verify_area(VERIFY_WRITE, tdata, sizeof(*tdata)))
 		return -EFAULT;
 
-	udata = (struct i2c_smbus_ioctl_data32 *)compat_ptr(arg);
+	udata = compat_ptr(arg);
 	if (verify_area(VERIFY_READ, udata, sizeof(*udata)))
 		return -EFAULT;
 
@@ -3037,14 +2992,15 @@
 
 static int do_wireless_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-	struct iwreq *iwr, *iwr_u;
-	struct iw_point *iwp;
-	struct compat_iw_point *iwp_u;
+	struct iwreq __user *iwr;
+	struct iwreq __user *iwr_u;
+	struct iw_point __user *iwp;
+	struct compat_iw_point __user *iwp_u;
 	compat_caddr_t pointer;
 	__u16 length, flags;
 
-	iwr_u = (struct iwreq *) compat_ptr(arg);
-	iwp_u = (struct compat_iw_point *) &iwr_u->u.data;
+	iwr_u = compat_ptr(arg);
+	iwp_u = (struct compat_iw_point __user *) &iwr_u->u.data;
 	iwr = compat_alloc_user_space(sizeof(*iwr));
 	if (iwr == NULL)
 		return -ENOMEM;
@@ -3072,20 +3028,208 @@
 	return sys_ioctl(fd, cmd, (unsigned long) iwr);
 }
 
-/* Emulate old style bridge ioctls */
-static int do_bridge_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+/* Since old style bridge ioctl's endup using SIOCDEVPRIVATE
+ * for some operations; this forces use of the newer bridge-utils that
+ * use compatiable ioctls
+ */
+static int old_bridge_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	u32 tmp;
-	unsigned long *argbuf = compat_alloc_user_space(3 * sizeof(unsigned long)); 
-	int i;	
-	for (i = 0; i < 3; i++) {
-		if (get_user(tmp, i + ((u32 *)arg)) ||
-		    put_user(tmp, i + argbuf))
-			return -EFAULT;
+
+	if (get_user(tmp, (u32 __user *) arg))
+		return -EFAULT;
+	if (tmp == BRCTL_GET_VERSION)
+		return BRCTL_VERSION + 1;
+	return -EINVAL;
+}
+
+#if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE)
+struct ncp_ioctl_request_32 {
+	u32 function;
+	u32 size;
+	compat_caddr_t data;
+};
+
+struct ncp_fs_info_v2_32 {
+	s32 version;
+	u32 mounted_uid;
+	u32 connection;
+	u32 buffer_size;
+
+	u32 volume_number;
+	u32 directory_id;
+
+	u32 dummy1;
+	u32 dummy2;
+	u32 dummy3;
+};
+
+struct ncp_objectname_ioctl_32
+{
+	s32		auth_type;
+	u32		object_name_len;
+	compat_caddr_t	object_name;	/* an userspace data, in most cases user name */
+};
+
+struct ncp_privatedata_ioctl_32
+{
+	u32		len;
+	compat_caddr_t	data;		/* ~1000 for NDS */
+};
+
+#define	NCP_IOC_NCPREQUEST_32		_IOR('n', 1, struct ncp_ioctl_request_32)
+#define NCP_IOC_GETMOUNTUID2_32		_IOW('n', 2, u32)
+#define NCP_IOC_GET_FS_INFO_V2_32	_IOWR('n', 4, struct ncp_fs_info_v2_32)
+#define NCP_IOC_GETOBJECTNAME_32	_IOWR('n', 9, struct ncp_objectname_ioctl_32)
+#define NCP_IOC_SETOBJECTNAME_32	_IOR('n', 9, struct ncp_objectname_ioctl_32)
+#define NCP_IOC_GETPRIVATEDATA_32	_IOWR('n', 10, struct ncp_privatedata_ioctl_32)
+#define NCP_IOC_SETPRIVATEDATA_32	_IOR('n', 10, struct ncp_privatedata_ioctl_32)
+
+static int do_ncp_ncprequest(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct ncp_ioctl_request_32 n32;
+	struct ncp_ioctl_request __user *p = compat_alloc_user_space(sizeof(*p));
+
+	if (copy_from_user(&n32, compat_ptr(arg), sizeof(n32)) ||
+	    put_user(n32.function, &p->function) ||
+	    put_user(n32.size, &p->size) ||
+	    put_user(compat_ptr(n32.data), &p->data))
+		return -EFAULT;
+
+	return sys_ioctl(fd, NCP_IOC_NCPREQUEST, (unsigned long)p);
+}
+
+static int do_ncp_getmountuid2(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	mm_segment_t old_fs = get_fs();
+	__kernel_uid_t kuid;
+	int err;
+
+	cmd = NCP_IOC_GETMOUNTUID2;
+
+	set_fs(KERNEL_DS);
+	err = sys_ioctl(fd, cmd, (unsigned long)&kuid);
+	set_fs(old_fs);
+
+	if (!err)
+		err = put_user(kuid,
+			       (unsigned int __user *) compat_ptr(arg));
+
+	return err;
+}
+
+static int do_ncp_getfsinfo2(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	mm_segment_t old_fs = get_fs();
+	struct ncp_fs_info_v2_32 n32;
+	struct ncp_fs_info_v2 n;
+	int err;
+
+	if (copy_from_user(&n32, compat_ptr(arg), sizeof(n32)))
+		return -EFAULT;
+	if (n32.version != NCP_GET_FS_INFO_VERSION_V2)
+		return -EINVAL;
+	n.version = NCP_GET_FS_INFO_VERSION_V2;
+
+	set_fs(KERNEL_DS);
+	err = sys_ioctl(fd, NCP_IOC_GET_FS_INFO_V2, (unsigned long)&n);
+	set_fs(old_fs);
+
+	if (!err) {
+		n32.version = n.version;
+		n32.mounted_uid = n.mounted_uid;
+		n32.connection = n.connection;
+		n32.buffer_size = n.buffer_size;
+		n32.volume_number = n.volume_number;
+		n32.directory_id = n.directory_id;
+		n32.dummy1 = n.dummy1;
+		n32.dummy2 = n.dummy2;
+		n32.dummy3 = n.dummy3;
+		err = copy_to_user(compat_ptr(arg), &n32, sizeof(n32)) ? -EFAULT : 0;
 	}
-	return sys_ioctl(fd, cmd, (unsigned long)argbuf);
+	return err;
 }
 
+static int do_ncp_getobjectname(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct ncp_objectname_ioctl_32 n32, __user *p32 = compat_ptr(arg);
+	struct ncp_objectname_ioctl __user *p = compat_alloc_user_space(sizeof(*p));
+	s32 auth_type;
+	u32 name_len;
+	int err;
+
+	if (copy_from_user(&n32, p32, sizeof(n32)) ||
+	    put_user(n32.object_name_len, &p->object_name_len) ||
+	    put_user(compat_ptr(n32.object_name), &p->object_name))
+		return -EFAULT;
+
+	err = sys_ioctl(fd, NCP_IOC_GETOBJECTNAME, (unsigned long)p);
+        if (err)
+		return err;
+
+	if (get_user(auth_type, &p->auth_type) ||
+	    put_user(auth_type, &p32->auth_type) ||
+	    get_user(name_len, &p->object_name_len) ||
+	    put_user(name_len, &p32->object_name_len))
+		return -EFAULT;
+
+	return 0;
+}
+
+static int do_ncp_setobjectname(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct ncp_objectname_ioctl_32 n32, __user *p32 = compat_ptr(arg);
+	struct ncp_objectname_ioctl __user *p = compat_alloc_user_space(sizeof(*p));
+
+	if (copy_from_user(&n32, p32, sizeof(n32)) ||
+	    put_user(n32.auth_type, &p->auth_type) ||
+	    put_user(n32.object_name_len, &p->object_name_len) ||
+	    put_user(compat_ptr(n32.object_name), &p->object_name))
+		return -EFAULT;
+
+	return sys_ioctl(fd, NCP_IOC_SETOBJECTNAME, (unsigned long)p);
+}
+
+static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct ncp_privatedata_ioctl_32 n32, __user *p32 = compat_ptr(arg);
+	struct ncp_privatedata_ioctl __user *p =
+		compat_alloc_user_space(sizeof(*p));
+	u32 len;
+	int err;
+
+	if (copy_from_user(&n32, p32, sizeof(n32)) ||
+	    put_user(n32.len, &p->len) ||
+	    put_user(compat_ptr(n32.data), &p->data))
+		return -EFAULT;
+
+	err = sys_ioctl(fd, NCP_IOC_GETPRIVATEDATA, (unsigned long)p);
+        if (err)
+		return err;
+
+	if (get_user(len, &p->len) ||
+	    put_user(len, &p32->len))
+		return -EFAULT;
+
+	return 0;
+}
+
+static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct ncp_privatedata_ioctl_32 n32;
+	struct ncp_privatedata_ioctl_32 __user *p32 = compat_ptr(arg);
+	struct ncp_privatedata_ioctl __user *p =
+		compat_alloc_user_space(sizeof(*p));
+
+	if (copy_from_user(&n32, p32, sizeof(n32)) ||
+	    put_user(n32.len, &p->len) ||
+	    put_user(compat_ptr(n32.data), &p->data))
+		return -EFAULT;
+
+	return sys_ioctl(fd, NCP_IOC_SETPRIVATEDATA, (unsigned long)p);
+}
+#endif
+
 #undef CODE
 #endif
 
@@ -3133,6 +3277,8 @@
 HANDLE_IOCTL(SIOCBONDCHANGEACTIVE, bond_ioctl)
 HANDLE_IOCTL(SIOCADDRT, routing_ioctl)
 HANDLE_IOCTL(SIOCDELRT, routing_ioctl)
+HANDLE_IOCTL(SIOCBRADDIF, dev_ifsioc)
+HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc)
 /* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
 HANDLE_IOCTL(SIOCRTMSG, ret_einval)
 HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp)
@@ -3263,8 +3409,18 @@
 HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl)
 HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl)
-HANDLE_IOCTL(SIOCSIFBR, do_bridge_ioctl)
-HANDLE_IOCTL(SIOCGIFBR, do_bridge_ioctl)
+HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl)
+HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl)
+
+#if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE)
+HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
+HANDLE_IOCTL(NCP_IOC_GETMOUNTUID2_32, do_ncp_getmountuid2)
+HANDLE_IOCTL(NCP_IOC_GET_FS_INFO_V2_32, do_ncp_getfsinfo2)
+HANDLE_IOCTL(NCP_IOC_GETOBJECTNAME_32, do_ncp_getobjectname)
+HANDLE_IOCTL(NCP_IOC_SETOBJECTNAME_32, do_ncp_setobjectname)
+HANDLE_IOCTL(NCP_IOC_GETPRIVATEDATA_32, do_ncp_getprivatedata)
+HANDLE_IOCTL(NCP_IOC_SETPRIVATEDATA_32, do_ncp_setprivatedata)
+#endif
 
 #undef DECLARES
 #endif
diff -Nru a/fs/dcache.c b/fs/dcache.c
--- a/fs/dcache.c	Tue Jun 15 22:20:37 2004
+++ b/fs/dcache.c	Tue Jun 15 22:20:37 2004
@@ -21,6 +21,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/smp_lock.h>
+#include <linux/hash.h>
 #include <linux/cache.h>
 #include <linux/module.h>
 #include <linux/mount.h>
@@ -40,6 +41,8 @@
 
 static kmem_cache_t *dentry_cache; 
 
+#define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname))
+
 /*
  * This is the single most critical data structure when it comes
  * to the dcache: the hashtable for lookups. Somebody should try
@@ -65,9 +68,8 @@
 {
 	struct dentry * dentry = (struct dentry *)arg;
 
-	if (dname_external(dentry)) {
-		kfree(dentry->d_qstr);
-	}
+	if (dname_external(dentry))
+		kfree(dentry->d_name.name);
 	kmem_cache_free(dentry_cache, dentry); 
 }
 
@@ -161,7 +163,7 @@
  	if (d_unhashed(dentry))
 		goto kill_it;
   	if (list_empty(&dentry->d_lru)) {
-  		dentry->d_vfs_flags |= DCACHE_REFERENCED;
+  		dentry->d_flags |= DCACHE_REFERENCED;
   		list_add(&dentry->d_lru, &dentry_unused);
   		dentry_stat.nr_unused++;
   	}
@@ -257,7 +259,7 @@
 static inline struct dentry * __dget_locked(struct dentry *dentry)
 {
 	atomic_inc(&dentry->d_count);
-	if (atomic_read(&dentry->d_count) == 1) {
+	if (!list_empty(&dentry->d_lru)) {
 		dentry_stat.nr_unused--;
 		list_del_init(&dentry->d_lru);
 	}
@@ -394,8 +396,8 @@
 			continue;
 		}
 		/* If the dentry was recently referenced, don't free it. */
-		if (dentry->d_vfs_flags & DCACHE_REFERENCED) {
-			dentry->d_vfs_flags &= ~DCACHE_REFERENCED;
+		if (dentry->d_flags & DCACHE_REFERENCED) {
+			dentry->d_flags &= ~DCACHE_REFERENCED;
  			list_add(&dentry->d_lru, &dentry_unused);
  			dentry_stat.nr_unused++;
  			spin_unlock(&dentry->d_lock);
@@ -643,30 +645,27 @@
 }
 
 /*
- * This is called from kswapd when we think we need some more memory.
+ * Scan `nr' dentries and return the number which remain.
+ *
+ * We need to avoid reentering the filesystem if the caller is performing a
+ * GFP_NOFS allocation attempt.  One example deadlock is:
+ *
+ * ext2_new_block->getblk->GFP->shrink_dcache_memory->prune_dcache->
+ * prune_one_dentry->dput->dentry_iput->iput->inode->i_sb->s_op->put_inode->
+ * ext2_discard_prealloc->ext2_free_blocks->lock_super->DEADLOCK.
+ *
+ * In this case we return -1 to tell the caller that we baled.
  */
 static int shrink_dcache_memory(int nr, unsigned int gfp_mask)
 {
 	if (nr) {
-		/*
-		 * Nasty deadlock avoidance.
-		 *
-	 	 * ext2_new_block->getblk->GFP->shrink_dcache_memory->
-		 * prune_dcache->prune_one_dentry->dput->dentry_iput->iput->
-		 * inode->i_sb->s_op->put_inode->ext2_discard_prealloc->
-		 * ext2_free_blocks->lock_super->DEADLOCK.
-	 	 *
-	 	 * We should make sure we don't hold the superblock lock over
-	 	 * block allocations, but for now:
-		 */
-		if (gfp_mask & __GFP_FS)
-			prune_dcache(nr);
+		if (!(gfp_mask & __GFP_FS))
+			return -1;
+		prune_dcache(nr);
 	}
 	return dentry_stat.nr_unused;
 }
 
-#define NAME_ALLOC_LEN(len)	((len+16) & ~15)
-
 /**
  * d_alloc	-	allocate a dcache entry
  * @parent: parent of entry to allocate
@@ -677,47 +676,37 @@
  * copied and the copy passed in may be reused after this call.
  */
  
-struct dentry * d_alloc(struct dentry * parent, const struct qstr *name)
+struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
 {
-	char * str;
 	struct dentry *dentry;
-	struct qstr * qstr;
+	char *dname;
 
 	dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL); 
 	if (!dentry)
 		return NULL;
 
 	if (name->len > DNAME_INLINE_LEN-1) {
-		qstr = kmalloc(sizeof(*qstr) + NAME_ALLOC_LEN(name->len), 
-				GFP_KERNEL);  
-		if (!qstr) {
+		dname = kmalloc(name->len + 1, GFP_KERNEL);
+		if (!dname) {
 			kmem_cache_free(dentry_cache, dentry); 
 			return NULL;
 		}
-		qstr->name = qstr->name_str;
-		qstr->len = name->len;
-		qstr->hash = name->hash;
-		dentry->d_qstr = qstr;
-		str = qstr->name_str;
 	} else  {
-		dentry->d_qstr = &dentry->d_name;
-		str = dentry->d_iname;
+		dname = dentry->d_iname;
 	}	
+	dentry->d_name.name = dname;
 
-	memcpy(str, name->name, name->len);
-	str[name->len] = 0;
+	dentry->d_name.len = name->len;
+	dentry->d_name.hash = name->hash;
+	memcpy(dname, name->name, name->len);
+	dname[name->len] = 0;
 
 	atomic_set(&dentry->d_count, 1);
-	dentry->d_vfs_flags = DCACHE_UNHASHED;
+	dentry->d_flags = DCACHE_UNHASHED;
 	dentry->d_lock = SPIN_LOCK_UNLOCKED;
-	dentry->d_flags = 0;
 	dentry->d_inode = NULL;
 	dentry->d_parent = NULL;
-	dentry->d_move_count = 0;
 	dentry->d_sb = NULL;
-	dentry->d_name.name = str;
-	dentry->d_name.len = name->len;
-	dentry->d_name.hash = name->hash;
 	dentry->d_op = NULL;
 	dentry->d_fsdata = NULL;
 	dentry->d_mounted = 0;
@@ -784,7 +773,8 @@
 	struct dentry *res = NULL;
 
 	if (root_inode) {
-		static const struct qstr name = { .name = "/", .len = 1, .hash = 0 };
+		static const struct qstr name = { .name = "/", .len = 1 };
+
 		res = d_alloc(NULL, &name);
 		if (res) {
 			res->d_sb = root_inode->i_sb;
@@ -795,10 +785,11 @@
 	return res;
 }
 
-static inline struct hlist_head * d_hash(struct dentry * parent, unsigned long hash)
+static inline struct hlist_head *d_hash(struct dentry *parent,
+					unsigned long hash)
 {
-	hash += (unsigned long) parent / L1_CACHE_BYTES;
-	hash = hash ^ (hash >> D_HASHBITS);
+	hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES;
+	hash = hash ^ ((hash ^ GOLDEN_RATIO_PRIME) >> D_HASHBITS);
 	return dentry_hashtable + (hash & D_HASHMASK);
 }
 
@@ -824,7 +815,7 @@
 
 struct dentry * d_alloc_anon(struct inode *inode)
 {
-	static const struct qstr anonstring = { "", 0, 0};
+	static const struct qstr anonstring = { .name = "" };
 	struct dentry *tmp;
 	struct dentry *res;
 
@@ -855,9 +846,14 @@
 			res->d_sb = inode->i_sb;
 			res->d_parent = res;
 			res->d_inode = inode;
-			res->d_bucket = d_hash(res, res->d_name.hash);
+
+			/*
+			 * Set d_bucket to an "impossible" bucket address so
+			 * that d_move() doesn't get a false positive
+			 */
+			res->d_bucket = NULL;
 			res->d_flags |= DCACHE_DISCONNECTED;
-			res->d_vfs_flags &= ~DCACHE_UNHASHED;
+			res->d_flags &= ~DCACHE_UNHASHED;
 			list_add(&res->d_alias, &inode->i_dentry);
 			hlist_add_head(&res->d_hash, &inode->i_sb->s_anon);
 			spin_unlock(&res->d_lock);
@@ -930,8 +926,7 @@
  *
  * __d_lookup is dcache_lock free. The hash list is protected using RCU.
  * Memory barriers are used while updating and doing lockless traversal. 
- * To avoid races with d_move while rename is happening, d_move_count is 
- * used. 
+ * To avoid races with d_move while rename is happening, d_lock is used.
  *
  * Overflows in memcmp(), while d_move, are avoided by keeping the length
  * and name pointer in one structure pointed by d_qstr.
@@ -940,8 +935,9 @@
  * lookup is going on.
  *
  * dentry_unused list is not updated even if lookup finds the required dentry
- * in there. It is updated in places such as prune_dcache, shrink_dcache_sb and
- * select_parent. This laziness saves lookup from dcache_lock acquisition.
+ * in there. It is updated in places such as prune_dcache, shrink_dcache_sb,
+ * select_parent and __dget_locked. This laziness saves lookup from dcache_lock
+ * acquisition.
  *
  * d_lookup() is protected against the concurrent renames in some unrelated
  * directory using the seqlockt_t rename_lock.
@@ -974,23 +970,11 @@
 	
 	hlist_for_each (node, head) { 
 		struct dentry *dentry; 
-		unsigned long move_count;
-		struct qstr * qstr;
+		struct qstr *qstr;
 
 		smp_read_barrier_depends();
 		dentry = hlist_entry(node, struct dentry, d_hash);
 
-		/* if lookup ends up in a different bucket 
-		 * due to concurrent rename, fail it
-		 */
-		if (unlikely(dentry->d_bucket != head))
-			break;
-
-		/*
-		 * We must take a snapshot of d_move_count followed by
-		 * read memory barrier before any search key comparison 
-		 */
-		move_count = dentry->d_move_count;
 		smp_rmb();
 
 		if (dentry->d_name.hash != hash)
@@ -998,29 +982,44 @@
 		if (dentry->d_parent != parent)
 			continue;
 
-		qstr = dentry->d_qstr;
+		spin_lock(&dentry->d_lock);
+
+		/*
+		 * If lookup ends up in a different bucket due to concurrent
+		 * rename, fail it
+		 */
+		if (unlikely(dentry->d_bucket != head))
+			goto terminate;
+
+		/*
+		 * Recheck the dentry after taking the lock - d_move may have
+		 * changed things.  Don't bother checking the hash because we're
+		 * about to compare the whole name anyway.
+		 */
+		if (dentry->d_parent != parent)
+			goto next;
+
+		qstr = &dentry->d_name;
 		smp_read_barrier_depends();
 		if (parent->d_op && parent->d_op->d_compare) {
 			if (parent->d_op->d_compare(parent, qstr, name))
-				continue;
+				goto next;
 		} else {
 			if (qstr->len != len)
-				continue;
+				goto next;
 			if (memcmp(qstr->name, str, len))
-				continue;
+				goto next;
 		}
-		spin_lock(&dentry->d_lock);
-		/*
-		 * If dentry is moved, fail the lookup
-		 */ 
-		if (likely(move_count == dentry->d_move_count)) {
-			if (!d_unhashed(dentry)) {
-				atomic_inc(&dentry->d_count);
-				found = dentry;
-			}
+
+		if (!d_unhashed(dentry)) {
+			atomic_inc(&dentry->d_count);
+			found = dentry;
 		}
+terminate:
 		spin_unlock(&dentry->d_lock);
 		break;
+next:
+		spin_unlock(&dentry->d_lock);
  	}
  	rcu_read_unlock();
 
@@ -1118,8 +1117,11 @@
 void d_rehash(struct dentry * entry)
 {
 	struct hlist_head *list = d_hash(entry->d_parent, entry->d_name.hash);
+
 	spin_lock(&dcache_lock);
- 	entry->d_vfs_flags &= ~DCACHE_UNHASHED;
+	spin_lock(&entry->d_lock);
+ 	entry->d_flags &= ~DCACHE_UNHASHED;
+	spin_unlock(&entry->d_lock);
 	entry->d_bucket = list;
  	hlist_add_head_rcu(&entry->d_hash, list);
 	spin_unlock(&dcache_lock);
@@ -1140,28 +1142,40 @@
  * then no longer matches the actual (corrupted) string of the target.
  * The hash value has to match the hash queue that the dentry is on..
  */
-static inline void switch_names(struct dentry * dentry, struct dentry * target)
+static void switch_names(struct dentry *dentry, struct dentry *target)
 {
-	const unsigned char *old_name, *new_name;
-	struct qstr *old_qstr, *new_qstr;
-
-	memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN); 
-	old_qstr = target->d_qstr;
-	old_name = target->d_name.name;
-	new_qstr = dentry->d_qstr;
-	new_name = dentry->d_name.name;
-	if (old_name == target->d_iname) {
-		old_name = dentry->d_iname;
-		old_qstr = &dentry->d_name;
-	}
-	if (new_name == dentry->d_iname) {
-		new_name = target->d_iname;
-		new_qstr = &target->d_name;
-	}
-	target->d_name.name = new_name;
-	dentry->d_name.name = old_name;
-	target->d_qstr = new_qstr;
-	dentry->d_qstr = old_qstr;
+	if (dname_external(target)) {
+		if (dname_external(dentry)) {
+			/*
+			 * Both external: swap the pointers
+			 */
+			do_switch(target->d_name.name, dentry->d_name.name);
+		} else {
+			/*
+			 * dentry:internal, target:external.  Steal target's
+			 * storage and make target internal.
+			 */
+			dentry->d_name.name = target->d_name.name;
+			target->d_name.name = target->d_iname;
+		}
+	} else {
+		if (dname_external(dentry)) {
+			/*
+			 * dentry:external, target:internal.  Give dentry's
+			 * storage to target and make dentry internal
+			 */
+			memcpy(dentry->d_iname, target->d_name.name,
+					target->d_name.len + 1);
+			target->d_name.name = dentry->d_name.name;
+			dentry->d_name.name = dentry->d_iname;
+		} else {
+			/*
+			 * Both are internal.  Just copy target to dentry
+			 */
+			memcpy(dentry->d_iname, target->d_name.name,
+					target->d_name.len + 1);
+		}
+	}
 }
 
 /*
@@ -1204,14 +1218,14 @@
 	}
 
 	/* Move the dentry to the target hash queue, if on different bucket */
-	if (dentry->d_vfs_flags & DCACHE_UNHASHED)
+	if (dentry->d_flags & DCACHE_UNHASHED)
 		goto already_unhashed;
 	if (dentry->d_bucket != target->d_bucket) {
 		hlist_del_rcu(&dentry->d_hash);
 already_unhashed:
 		dentry->d_bucket = target->d_bucket;
 		hlist_add_head_rcu(&dentry->d_hash, target->d_bucket);
-		dentry->d_vfs_flags &= ~DCACHE_UNHASHED;
+		dentry->d_flags &= ~DCACHE_UNHASHED;
 	}
 
 	/* Unhash the target: dput() will then get rid of it */
@@ -1239,7 +1253,6 @@
 	}
 
 	list_add(&dentry->d_child, &dentry->d_parent->d_subdirs);
-	dentry->d_move_count++;
 	spin_unlock(&target->d_lock);
 	spin_unlock(&dentry->d_lock);
 	write_sequnlock(&rename_lock);
@@ -1337,6 +1350,7 @@
 	char *res;
 	struct vfsmount *rootmnt;
 	struct dentry *root;
+
 	read_lock(&current->fs->lock);
 	rootmnt = mntget(current->fs->rootmnt);
 	root = dget(current->fs->root);
@@ -1562,10 +1576,8 @@
 	dentry_cache = kmem_cache_create("dentry_cache",
 					 sizeof(struct dentry),
 					 0,
-					 SLAB_RECLAIM_ACCOUNT,
+					 SLAB_RECLAIM_ACCOUNT|SLAB_PANIC,
 					 NULL, NULL);
-	if (!dentry_cache)
-		panic("Cannot create dentry cache");
 	
 	set_shrinker(DEFAULT_SEEKS, shrink_dcache_memory);
 
@@ -1627,20 +1639,14 @@
 	/* Base hash sizes on available memory, with a reserve equal to
            150% of current kernel size */
 
-	reserve = (mempages - nr_free_pages()) * 3/2;
+	reserve = min((mempages - nr_free_pages()) * 3/2, mempages - 1);
 	mempages -= reserve;
 
-	names_cachep = kmem_cache_create("names_cache",
-			PATH_MAX, 0,
-			SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!names_cachep)
-		panic("Cannot create names SLAB cache");
-
-	filp_cachep = kmem_cache_create("filp",
-			sizeof(struct file), 0,
-			SLAB_HWCACHE_ALIGN, filp_ctor, filp_dtor);
-	if(!filp_cachep)
-		panic("Cannot create filp SLAB cache");
+	names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,
+			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
+
+	filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
+			SLAB_HWCACHE_ALIGN|SLAB_PANIC, filp_ctor, filp_dtor);
 
 	dcache_init(mempages);
 	inode_init(mempages);
diff -Nru a/fs/dcookies.c b/fs/dcookies.c
--- a/fs/dcookies.c	Tue Jun 15 22:20:36 2004
+++ b/fs/dcookies.c	Tue Jun 15 22:20:36 2004
@@ -142,7 +142,7 @@
 /* And here is where the userspace process can look up the cookie value
  * to retrieve the path.
  */
-asmlinkage long sys_lookup_dcookie(u64 cookie64, char * buf, size_t len)
+asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len)
 {
 	unsigned long cookie = (unsigned long)cookie64;
 	int err = -EINVAL;
diff -Nru a/fs/devfs/base.c b/fs/devfs/base.c
--- a/fs/devfs/base.c	Tue Jun 15 22:20:37 2004
+++ b/fs/devfs/base.c	Tue Jun 15 22:20:37 2004
@@ -848,13 +848,13 @@
 static devfs_handle_t _devfs_walk_path(struct devfs_entry *dir,
 				       const char *name, int namelen,
 				       int traverse_symlink);
-static ssize_t devfsd_read(struct file *file, char *buf, size_t len,
+static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len,
 			   loff_t * ppos);
 static int devfsd_ioctl(struct inode *inode, struct file *file,
 			unsigned int cmd, unsigned long arg);
 static int devfsd_close(struct inode *inode, struct file *file);
 #ifdef CONFIG_DEVFS_DEBUG
-static ssize_t stat_read(struct file *file, char *buf, size_t len,
+static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
 			 loff_t * ppos);
 static struct file_operations stat_fops = {
 	.read = stat_read,
@@ -2579,7 +2579,7 @@
 
 /*  File operations for devfsd follow  */
 
-static ssize_t devfsd_read(struct file *file, char *buf, size_t len,
+static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len,
 			   loff_t * ppos)
 {
 	int done = FALSE;
@@ -2693,7 +2693,7 @@
 	switch (cmd) {
 	case DEVFSDIOC_GET_PROTO_REV:
 		ival = DEVFSD_PROTOCOL_REVISION_KERNEL;
-		if (copy_to_user((void *)arg, &ival, sizeof ival))
+		if (copy_to_user((void __user *)arg, &ival, sizeof ival))
 			return -EFAULT;
 		break;
 	case DEVFSDIOC_SET_EVENT_MASK:
@@ -2732,7 +2732,7 @@
 		/*break; */
 #ifdef CONFIG_DEVFS_DEBUG
 	case DEVFSDIOC_SET_DEBUG_MASK:
-		if (copy_from_user(&ival, (void *)arg, sizeof ival))
+		if (copy_from_user(&ival, (void __user *)arg, sizeof ival))
 			return -EFAULT;
 		devfs_debug = ival;
 		break;
@@ -2772,7 +2772,7 @@
 }				/*  End Function devfsd_close  */
 
 #ifdef CONFIG_DEVFS_DEBUG
-static ssize_t stat_read(struct file *file, char *buf, size_t len,
+static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
 			 loff_t * ppos)
 {
 	ssize_t num;
diff -Nru a/fs/direct-io.c b/fs/direct-io.c
--- a/fs/direct-io.c	Tue Jun 15 22:20:41 2004
+++ b/fs/direct-io.c	Tue Jun 15 22:20:41 2004
@@ -690,8 +690,11 @@
 static void clean_blockdev_aliases(struct dio *dio)
 {
 	unsigned i;
+	unsigned nblocks;
 
-	for (i = 0; i < dio->blocks_available; i++) {
+	nblocks = dio->map_bh.b_size >> dio->inode->i_blkbits;
+
+	for (i = 0; i < nblocks; i++) {
 		unmap_underlying_metadata(dio->map_bh.b_bdev,
 					dio->map_bh.b_blocknr + i);
 	}
@@ -987,13 +990,6 @@
 		}
 	} /* end iovec loop */
 
-	if (ret == -ENOTBLK && rw == WRITE) {
-		/*
-		 * The remaining part of the request will be
-		 * be handled by buffered I/O when we return
-		 */
-		ret = 0;
-	}
 	/*
 	 * There may be some unwritten disk at the end of a part-written
 	 * fs-block-sized block.  Go zero that now.
@@ -1060,24 +1056,29 @@
 			kfree(dio);
 		}
 	} else {
+		ssize_t transferred = 0;
+
 		finished_one_bio(dio);
 		ret2 = dio_await_completion(dio);
 		if (ret == 0)
 			ret = ret2;
 		if (ret == 0)
 			ret = dio->page_errors;
-		if (ret == 0 && dio->result) {
+		if (dio->result) {
 			loff_t i_size = i_size_read(inode);
 
-			ret = dio->result;
+			transferred = dio->result;
 			/*
 			 * Adjust the return value if the read crossed a
 			 * non-block-aligned EOF.
 			 */
-			if (rw == READ && (offset + ret > i_size))
-				ret = i_size - offset;
+			if (rw == READ && (offset + transferred > i_size))
+				transferred = i_size - offset;
 		}
-		dio_complete(dio, offset, ret);
+		dio_complete(dio, offset, transferred);
+		if (ret == 0)
+			ret = transferred;
+
 		/* We could have also come here on an AIO file extend */
 		if (!is_sync_kiocb(iocb) && rw == WRITE &&
 		    ret >= 0 && dio->result == dio->size)
@@ -1087,6 +1088,13 @@
 			 */
 			aio_complete(iocb, ret, 0);
 		kfree(dio);
+	}
+	if (ret == -ENOTBLK && rw == WRITE) {
+		/*
+		 * The entire request will be be handled by buffered I/O
+		 * when we return
+		 */
+		ret = 0;
 	}
 	return ret;
 }
diff -Nru a/fs/dnotify.c b/fs/dnotify.c
--- a/fs/dnotify.c	Tue Jun 15 22:20:38 2004
+++ b/fs/dnotify.c	Tue Jun 15 22:20:38 2004
@@ -173,9 +173,7 @@
 static int __init dnotify_init(void)
 {
 	dn_cache = kmem_cache_create("dnotify_cache",
-		sizeof(struct dnotify_struct), 0, 0, NULL, NULL);
-	if (!dn_cache)
-		panic("cannot create dnotify slab cache");
+		sizeof(struct dnotify_struct), 0, SLAB_PANIC, NULL, NULL);
 	return 0;
 }
 
diff -Nru a/fs/dquot.c b/fs/dquot.c
--- a/fs/dquot.c	Tue Jun 15 22:20:42 2004
+++ b/fs/dquot.c	Tue Jun 15 22:20:42 2004
@@ -75,6 +75,7 @@
 #include <linux/proc_fs.h>
 #include <linux/security.h>
 #include <linux/kmod.h>
+#include <linux/pagemap.h>
 
 #include <asm/uaccess.h>
 
@@ -305,7 +306,7 @@
 
 int dquot_acquire(struct dquot *dquot)
 {
-	int ret = 0;
+	int ret = 0, ret2 = 0;
 	struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
 
 	down(&dquot->dq_lock);
@@ -318,8 +319,15 @@
 	/* Instantiate dquot if needed */
 	if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && !dquot->dq_off) {
 		ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot);
+		/* Write the info if needed */
+		if (info_dirty(&dqopt->info[dquot->dq_type]))
+			ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type);
 		if (ret < 0)
 			goto out_iolock;
+		if (ret2 < 0) {
+			ret = ret2;
+			goto out_iolock;
+		}
 	}
 	set_bit(DQ_ACTIVE_B, &dquot->dq_flags);
 out_iolock:
@@ -333,7 +341,7 @@
  */
 int dquot_commit(struct dquot *dquot)
 {
-	int ret = 0;
+	int ret = 0, ret2 = 0;
 	struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
 
 	down(&dqopt->dqio_sem);
@@ -345,12 +353,15 @@
 	spin_unlock(&dq_list_lock);
 	/* Inactive dquot can be only if there was error during read/init
 	 * => we have better not writing it */
-	if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
+	if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
 		ret = dqopt->ops[dquot->dq_type]->commit_dqblk(dquot);
+		if (info_dirty(&dqopt->info[dquot->dq_type]))
+			ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type);
+		if (ret >= 0)
+			ret = ret2;
+	}
 out_sem:
 	up(&dqopt->dqio_sem);
-	if (info_dirty(&dqopt->info[dquot->dq_type]))
-		dquot->dq_sb->dq_op->write_info(dquot->dq_sb, dquot->dq_type);
 	return ret;
 }
 
@@ -359,7 +370,7 @@
  */
 int dquot_release(struct dquot *dquot)
 {
-	int ret = 0;
+	int ret = 0, ret2 = 0;
 	struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
 
 	down(&dquot->dq_lock);
@@ -367,7 +378,14 @@
 	if (atomic_read(&dquot->dq_count) > 1)
 		goto out_dqlock;
 	down(&dqopt->dqio_sem);
-	ret = dqopt->ops[dquot->dq_type]->release_dqblk(dquot);
+	if (dqopt->ops[dquot->dq_type]->release_dqblk) {
+		ret = dqopt->ops[dquot->dq_type]->release_dqblk(dquot);
+		/* Write the info */
+		if (info_dirty(&dqopt->info[dquot->dq_type]))
+			ret2 = dqopt->ops[dquot->dq_type]->write_file_info(dquot->dq_sb, dquot->dq_type);
+		if (ret >= 0)
+			ret = ret2;
+	}
 	clear_bit(DQ_ACTIVE_B, &dquot->dq_flags);
 	up(&dqopt->dqio_sem);
 out_dqlock:
@@ -529,7 +547,7 @@
 	clear_dquot_dirty(dquot);
 	if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
 		spin_unlock(&dq_list_lock);
-		dquot_release(dquot);
+		dquot->dq_sb->dq_op->release_dquot(dquot);
 		goto we_slept;
 	}
 	atomic_dec(&dquot->dq_count);
@@ -546,7 +564,7 @@
 {
 	struct dquot *dquot;
 
-	dquot = kmem_cache_alloc(dquot_cachep, SLAB_KERNEL);
+	dquot = kmem_cache_alloc(dquot_cachep, SLAB_NOFS);
 	if(!dquot)
 		return NODQUOT;
 
@@ -605,7 +623,7 @@
 	 * finished or it will be canceled due to dq_count > 1 test */
 	wait_on_dquot(dquot);
 	/* Read the dquot and instantiate it (everything done only if needed) */
-	if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && dquot_acquire(dquot) < 0) {
+	if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && sb->dq_op->acquire_dquot(dquot) < 0) {
 		dqput(dquot);
 		return NODQUOT;
 	}
@@ -1203,8 +1221,11 @@
 		if (transfer_to[cnt] == NODQUOT)
 			continue;
 
-		dquot_decr_inodes(transfer_from[cnt], 1);
-		dquot_decr_space(transfer_from[cnt], space);
+		/* Due to IO error we might not have transfer_from[] structure */
+		if (transfer_from[cnt]) {
+			dquot_decr_inodes(transfer_from[cnt], 1);
+			dquot_decr_space(transfer_from[cnt], space);
+		}
 
 		dquot_incr_inodes(transfer_to[cnt], 1);
 		dquot_incr_space(transfer_to[cnt], space);
@@ -1259,6 +1280,8 @@
 	.free_inode	= dquot_free_inode,
 	.transfer	= dquot_transfer,
 	.write_dquot	= dquot_commit,
+	.acquire_dquot	= dquot_acquire,
+	.release_dquot	= dquot_release,
 	.mark_dirty	= dquot_mark_dquot_dirty,
 	.write_info	= dquot_commit_info
 };
@@ -1363,9 +1386,21 @@
 	error = -EINVAL;
 	if (!fmt->qf_ops->check_quota_file(sb, type))
 		goto out_file_init;
-	/* We don't want quota and atime on quota files (deadlocks possible) */
+	/* We don't want quota and atime on quota files (deadlocks possible)
+	 * We also need to set GFP mask differently because we cannot recurse
+	 * into filesystem when allocating page for quota inode */
 	down_write(&dqopt->dqptr_sem);
 	inode->i_flags |= S_NOQUOTA | S_NOATIME;
+
+	/*
+	 * We write to quota files deep within filesystem code.  We don't want
+	 * the VFS to reenter filesystem code when it tries to allocate a
+	 * pagecache page for the quota file write.  So clear __GFP_FS in
+	 * the quota file's allocation flags.
+	 */
+	mapping_set_gfp_mask(inode->i_mapping,
+		mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS);
+
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
 		to_drop[cnt] = inode->i_dquot[cnt];
 		inode->i_dquot[cnt] = NODQUOT;
@@ -1714,9 +1749,8 @@
 
 	dquot_cachep = kmem_cache_create("dquot", 
 			sizeof(struct dquot), sizeof(unsigned long) * 4,
-			SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, NULL, NULL);
-	if (!dquot_cachep)
-		panic("Cannot create dquot SLAB cache");
+			SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_PANIC,
+			NULL, NULL);
 
 	order = 0;
 	dquot_hash = (struct hlist_head *)__get_free_pages(GFP_ATOMIC, order);
@@ -1760,6 +1794,8 @@
 EXPORT_SYMBOL(vfs_set_dqblk);
 EXPORT_SYMBOL(dquot_commit);
 EXPORT_SYMBOL(dquot_commit_info);
+EXPORT_SYMBOL(dquot_acquire);
+EXPORT_SYMBOL(dquot_release);
 EXPORT_SYMBOL(dquot_mark_dquot_dirty);
 EXPORT_SYMBOL(dquot_initialize);
 EXPORT_SYMBOL(dquot_drop);
diff -Nru a/fs/eventpoll.c b/fs/eventpoll.c
--- a/fs/eventpoll.c	Tue Jun 15 22:20:39 2004
+++ b/fs/eventpoll.c	Tue Jun 15 22:20:39 2004
@@ -148,14 +148,6 @@
 #define EP_ITEM_FROM_EPQUEUE(p) (container_of(p, struct ep_pqueue, pt)->epi)
 
 /*
- * This is used to optimize the event transfer to userspace. Since this
- * is kept on stack, it should be pretty small.
- */
-#define EP_MAX_BUF_EVENTS 32
-
-
-
-/*
  * Node that is linked into the "wake_task_list" member of the "struct poll_safewake".
  * It is used to keep track on all tasks that are currently inside the wake_up() code
  * to 1) short-circuit the one coming from the same task and same wait queue head
@@ -309,7 +301,7 @@
 static void ep_unregister_pollwait(struct eventpoll *ep, struct epitem *epi);
 static int ep_unlink(struct eventpoll *ep, struct epitem *epi);
 static int ep_remove(struct eventpoll *ep, struct epitem *epi);
-static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync);
+static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *key);
 static int ep_eventpoll_close(struct inode *inode, struct file *file);
 static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait);
 static int ep_collect_ready_items(struct eventpoll *ep,
@@ -507,6 +499,11 @@
 	DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n",
 		     current, size));
 
+	/* Sanity check on the size parameter */
+	error = -EINVAL;
+	if (size <= 0)
+		goto eexit_1;
+
 	/* Correctly size the hash */
 	hashbits = ep_get_hash_bits((unsigned int) size);
 
@@ -1296,7 +1293,7 @@
  * machanism. It is called by the stored file descriptors when they
  * have events to report.
  */
-static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync)
+static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *key)
 {
 	int pwake = 0;
 	unsigned long flags;
@@ -1430,11 +1427,10 @@
 static int ep_send_events(struct eventpoll *ep, struct list_head *txlist,
 			  struct epoll_event __user *events)
 {
-	int eventcnt = 0, eventbuf = 0;
+	int eventcnt = 0;
 	unsigned int revents;
 	struct list_head *lnk;
 	struct epitem *epi;
-	struct epoll_event event[EP_MAX_BUF_EVENTS];
 
 	/*
 	 * We can loop without lock because this is a task private list.
@@ -1460,28 +1456,16 @@
 		epi->revents = revents & epi->event.events;
 
 		if (epi->revents) {
-			event[eventbuf] = epi->event;
-			event[eventbuf].events &= revents;
-			eventbuf++;
-			if (eventbuf == EP_MAX_BUF_EVENTS) {
-				if (__copy_to_user(&events[eventcnt], event,
-						   eventbuf * sizeof(struct epoll_event)))
-					return -EFAULT;
-				eventcnt += eventbuf;
-				eventbuf = 0;
-			}
+			if (__put_user(epi->revents,
+				       &events[eventcnt].events) ||
+			    __put_user(epi->event.data,
+				       &events[eventcnt].data))
+				return -EFAULT;
 			if (epi->event.events & EPOLLONESHOT)
 				epi->event.events &= EP_PRIVATE_BITS;
+			eventcnt++;
 		}
 	}
-
-	if (eventbuf) {
-		if (__copy_to_user(&events[eventcnt], event,
-				   eventbuf * sizeof(struct epoll_event)))
-			return -EFAULT;
-		eventcnt += eventbuf;
-	}
-
 	return eventcnt;
 }
 
@@ -1695,22 +1679,14 @@
 	ep_poll_safewake_init(&psw);
 
 	/* Allocates slab cache used to allocate "struct epitem" items */
-	error = -ENOMEM;
-	epi_cache = kmem_cache_create("eventpoll_epi",
-				      sizeof(struct epitem),
-				      0,
-				      SLAB_HWCACHE_ALIGN | EPI_SLAB_DEBUG, NULL, NULL);
-	if (!epi_cache)
-		goto eexit_1;
+	epi_cache = kmem_cache_create("eventpoll_epi", sizeof(struct epitem),
+			0, SLAB_HWCACHE_ALIGN|EPI_SLAB_DEBUG|SLAB_PANIC,
+			NULL, NULL);
 
 	/* Allocates slab cache used to allocate "struct eppoll_entry" */
-	error = -ENOMEM;
 	pwq_cache = kmem_cache_create("eventpoll_pwq",
-				      sizeof(struct eppoll_entry),
-				      0,
-				      EPI_SLAB_DEBUG, NULL, NULL);
-	if (!pwq_cache)
-		goto eexit_2;
+			sizeof(struct eppoll_entry), 0,
+			EPI_SLAB_DEBUG|SLAB_PANIC, NULL, NULL);
 
 	/*
 	 * Register the virtual file system that will be the source of inodes
@@ -1718,27 +1694,20 @@
 	 */
 	error = register_filesystem(&eventpoll_fs_type);
 	if (error)
-		goto eexit_3;
+		goto epanic;
 
 	/* Mount the above commented virtual file system */
 	eventpoll_mnt = kern_mount(&eventpoll_fs_type);
 	error = PTR_ERR(eventpoll_mnt);
 	if (IS_ERR(eventpoll_mnt))
-		goto eexit_4;
-
-	DNPRINTK(3, (KERN_INFO "[%p] eventpoll: successfully initialized.\n", current));
+		goto epanic;
 
+	DNPRINTK(3, (KERN_INFO "[%p] eventpoll: successfully initialized.\n",
+			current));
 	return 0;
 
-eexit_4:
-	unregister_filesystem(&eventpoll_fs_type);
-eexit_3:
-	kmem_cache_destroy(pwq_cache);
-eexit_2:
-	kmem_cache_destroy(epi_cache);
-eexit_1:
-
-	return error;
+epanic:
+	panic("eventpoll_init() failed\n");
 }
 
 
@@ -1755,4 +1724,3 @@
 module_exit(eventpoll_exit);
 
 MODULE_LICENSE("GPL");
-
diff -Nru a/fs/exec.c b/fs/exec.c
--- a/fs/exec.c	Tue Jun 15 22:20:39 2004
+++ b/fs/exec.c	Tue Jun 15 22:20:39 2004
@@ -293,53 +293,48 @@
  * This routine is used to map in a page into an address space: needed by
  * execve() for the initial stack and environment pages.
  *
- * tsk->mmap_sem is held for writing.
+ * vma->vm_mm->mmap_sem is held for writing.
  */
-void put_dirty_page(struct task_struct *tsk, struct page *page,
-			unsigned long address, pgprot_t prot)
+void install_arg_page(struct vm_area_struct *vma,
+			struct page *page, unsigned long address)
 {
+	struct mm_struct *mm = vma->vm_mm;
 	pgd_t * pgd;
 	pmd_t * pmd;
 	pte_t * pte;
-	struct pte_chain *pte_chain;
 
-	if (page_count(page) != 1)
-		printk(KERN_ERR "mem_map disagrees with %p at %08lx\n",
-				page, address);
-
-	pgd = pgd_offset(tsk->mm, address);
-	pte_chain = pte_chain_alloc(GFP_KERNEL);
-	if (!pte_chain)
+	if (unlikely(anon_vma_prepare(vma)))
 		goto out_sig;
-	spin_lock(&tsk->mm->page_table_lock);
-	pmd = pmd_alloc(tsk->mm, pgd, address);
+
+	flush_dcache_page(page);
+	pgd = pgd_offset(mm, address);
+
+	spin_lock(&mm->page_table_lock);
+	pmd = pmd_alloc(mm, pgd, address);
 	if (!pmd)
 		goto out;
-	pte = pte_alloc_map(tsk->mm, pmd, address);
+	pte = pte_alloc_map(mm, pmd, address);
 	if (!pte)
 		goto out;
 	if (!pte_none(*pte)) {
 		pte_unmap(pte);
 		goto out;
 	}
+	mm->rss++;
 	lru_cache_add_active(page);
-	flush_dcache_page(page);
-	set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(page, prot))));
-	pte_chain = page_add_rmap(page, pte, pte_chain);
+	set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(
+					page, vma->vm_page_prot))));
+	page_add_anon_rmap(page, vma, address);
 	pte_unmap(pte);
-	tsk->mm->rss++;
-	spin_unlock(&tsk->mm->page_table_lock);
+	spin_unlock(&mm->page_table_lock);
 
 	/* no need for flush_tlb */
-	pte_chain_free(pte_chain);
 	return;
 out:
-	spin_unlock(&tsk->mm->page_table_lock);
+	spin_unlock(&mm->page_table_lock);
 out_sig:
 	__free_page(page);
-	force_sig(SIGKILL, tsk);
-	pte_chain_free(pte_chain);
-	return;
+	force_sig(SIGKILL, current);
 }
 
 int setup_arg_pages(struct linux_binprm *bprm, int executable_stack)
@@ -414,6 +409,8 @@
 		return -ENOMEM;
 	}
 
+	memset(mpnt, 0, sizeof(*mpnt));
+
 	down_write(&mm->mmap_sem);
 	{
 		mpnt->vm_mm = mm;
@@ -435,11 +432,6 @@
 		else
 			mpnt->vm_flags = VM_STACK_FLAGS;
 		mpnt->vm_page_prot = protection_map[mpnt->vm_flags & 0x7];
-		mpnt->vm_ops = NULL;
-		mpnt->vm_pgoff = 0;
-		mpnt->vm_file = NULL;
-		INIT_LIST_HEAD(&mpnt->shared);
-		mpnt->vm_private_data = (void *) 0;
 		insert_vm_struct(mm, mpnt);
 		mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
 	}
@@ -448,8 +440,7 @@
 		struct page *page = bprm->page[i];
 		if (page) {
 			bprm->page[i] = NULL;
-			put_dirty_page(current, page, stack_base,
-					mpnt->vm_page_prot);
+			install_arg_page(mpnt, page, stack_base);
 		}
 		stack_base += PAGE_SIZE;
 	}
@@ -1003,7 +994,7 @@
 			return retval;
 
 		/* Remember if the application is TASO.  */
-		bprm->sh_bang = eh->ah.entry < 0x100000000;
+		bprm->sh_bang = eh->ah.entry < 0x100000000UL;
 
 		bprm->file = file;
 		bprm->loader = loader;
@@ -1083,13 +1074,13 @@
 	int retval;
 	int i;
 
-	sched_balance_exec();
-
 	file = open_exec(filename);
 
 	retval = PTR_ERR(file);
 	if (IS_ERR(file))
 		return retval;
+
+	sched_balance_exec();
 
 	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
 	memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));
diff -Nru a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
--- a/fs/exportfs/expfs.c	Tue Jun 15 22:20:44 2004
+++ b/fs/exportfs/expfs.c	Tue Jun 15 22:20:44 2004
@@ -155,11 +155,15 @@
 
 		if (!IS_ROOT(pd)) {
 			/* must have found a connected parent - great */
+			spin_lock(&pd->d_lock);
 			pd->d_flags &= ~DCACHE_DISCONNECTED;
+			spin_unlock(&pd->d_lock);
 			noprogress = 0;
 		} else if (pd == sb->s_root) {
 			printk(KERN_ERR "export: Eeek filesystem root is not connected, impossible\n");
+			spin_lock(&pd->d_lock);
 			pd->d_flags &= ~DCACHE_DISCONNECTED;
+			spin_unlock(&pd->d_lock);
 			noprogress = 0;
 		} else {
 			/* we have hit the top of a disconnected path.  Try
diff -Nru a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
--- a/fs/ext2/ialloc.c	Tue Jun 15 22:20:40 2004
+++ b/fs/ext2/ialloc.c	Tue Jun 15 22:20:40 2004
@@ -663,7 +663,7 @@
 	}
 	brelse(bitmap_bh);
 	printk("ext2_count_free_inodes: stored = %lu, computed = %lu, %lu\n",
-		percpu_counter_read(EXT2_SB(sb)->s_freeinodes_counter),
+		percpu_counter_read(&EXT2_SB(sb)->s_freeinodes_counter),
 		desc_count, bitmap_count);
 	unlock_super(sb);
 	return desc_count;
@@ -724,7 +724,7 @@
 		bitmap_count += x;
 	}
 	brelse(bitmap_bh);
-	if (percpu_counter_read(EXT2_SB(sb)->s_freeinodes_counter) !=
+	if (percpu_counter_read(&EXT2_SB(sb)->s_freeinodes_counter) !=
 				bitmap_count)
 		ext2_error(sb, "ext2_check_inodes_bitmap",
 			    "Wrong free inodes count in super block, "
diff -Nru a/fs/ext2/inode.c b/fs/ext2/inode.c
--- a/fs/ext2/inode.c	Tue Jun 15 22:20:36 2004
+++ b/fs/ext2/inode.c	Tue Jun 15 22:20:36 2004
@@ -584,6 +584,7 @@
 	if (err == -EAGAIN)
 		goto changed;
 
+	goal = 0;
 	if (ext2_find_goal(inode, iblock, chain, partial, &goal) < 0)
 		goto changed;
 
diff -Nru a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
--- a/fs/ext2/ioctl.c	Tue Jun 15 22:21:05 2004
+++ b/fs/ext2/ioctl.c	Tue Jun 15 22:21:05 2004
@@ -25,7 +25,7 @@
 	switch (cmd) {
 	case EXT2_IOC_GETFLAGS:
 		flags = ei->i_flags & EXT2_FL_USER_VISIBLE;
-		return put_user(flags, (int *) arg);
+		return put_user(flags, (int __user *) arg);
 	case EXT2_IOC_SETFLAGS: {
 		unsigned int oldflags;
 
@@ -35,7 +35,7 @@
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EACCES;
 
-		if (get_user(flags, (int *) arg))
+		if (get_user(flags, (int __user *) arg))
 			return -EFAULT;
 
 		if (!S_ISDIR(inode->i_mode))
@@ -64,13 +64,13 @@
 		return 0;
 	}
 	case EXT2_IOC_GETVERSION:
-		return put_user(inode->i_generation, (int *) arg);
+		return put_user(inode->i_generation, (int __user *) arg);
 	case EXT2_IOC_SETVERSION:
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
 		if (IS_RDONLY(inode))
 			return -EROFS;
-		if (get_user(inode->i_generation, (int *) arg))
+		if (get_user(inode->i_generation, (int __user *) arg))
 			return -EFAULT;	
 		inode->i_ctime = CURRENT_TIME;
 		mark_inode_dirty(inode);
diff -Nru a/fs/ext3/inode.c b/fs/ext3/inode.c
--- a/fs/ext3/inode.c	Tue Jun 15 22:20:42 2004
+++ b/fs/ext3/inode.c	Tue Jun 15 22:20:42 2004
@@ -205,8 +205,6 @@
 		 * need to make sure that the in-core orphan linked list
 		 * is properly cleaned up. */
 		ext3_orphan_del(NULL, inode);
-
-		ext3_std_error(inode->i_sb, PTR_ERR(handle));
 		goto no_delete;
 	}
 
@@ -811,6 +809,7 @@
 	if (err == -EAGAIN)
 		goto changed;
 
+	goal = 0;
 	down(&ei->truncate_sem);
 	if (ext3_find_goal(inode, iblock, chain, partial, &goal) < 0) {
 		up(&ei->truncate_sem);
@@ -1081,15 +1080,28 @@
 	struct inode *inode = page->mapping->host;
 	int ret, needed_blocks = ext3_writepage_trans_blocks(inode);
 	handle_t *handle;
+	int tried_commit = 0;
 
+retry:
 	handle = ext3_journal_start(inode, needed_blocks);
 	if (IS_ERR(handle)) {
 		ret = PTR_ERR(handle);
 		goto out;
 	}
 	ret = block_prepare_write(page, from, to, ext3_get_block);
-	if (ret != 0)
-		goto prepare_write_failed;
+	if (ret) {
+		if (ret != -ENOSPC || tried_commit)
+			goto prepare_write_failed;
+		/*
+		 * It could be that there _is_ free space, but it's all tied up
+		 * in uncommitted bitmaps.  So force a commit here, which makes
+		 * those blocks allocatable and try again.
+		 */
+		tried_commit = 1;
+		handle->h_sync = 1;
+		ext3_journal_stop(handle);
+		goto retry;
+	}
 
 	if (ext3_should_journal_data(inode)) {
 		ret = walk_page_buffers(handle, page_buffers(page),
diff -Nru a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
--- a/fs/ext3/ioctl.c	Tue Jun 15 22:20:39 2004
+++ b/fs/ext3/ioctl.c	Tue Jun 15 22:20:39 2004
@@ -26,7 +26,7 @@
 	switch (cmd) {
 	case EXT3_IOC_GETFLAGS:
 		flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
-		return put_user(flags, (int *) arg);
+		return put_user(flags, (int __user *) arg);
 	case EXT3_IOC_SETFLAGS: {
 		handle_t *handle = NULL;
 		int err;
@@ -40,7 +40,7 @@
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EACCES;
 
-		if (get_user(flags, (int *) arg))
+		if (get_user(flags, (int __user *) arg))
 			return -EFAULT;
 
 		if (!S_ISDIR(inode->i_mode))
@@ -100,7 +100,7 @@
 	}
 	case EXT3_IOC_GETVERSION:
 	case EXT3_IOC_GETVERSION_OLD:
-		return put_user(inode->i_generation, (int *) arg);
+		return put_user(inode->i_generation, (int __user *) arg);
 	case EXT3_IOC_SETVERSION:
 	case EXT3_IOC_SETVERSION_OLD: {
 		handle_t *handle;
@@ -112,7 +112,7 @@
 			return -EPERM;
 		if (IS_RDONLY(inode))
 			return -EROFS;
-		if (get_user(generation, (int *) arg))
+		if (get_user(generation, (int __user *) arg))
 			return -EFAULT;
 
 		handle = ext3_journal_start(inode, 1);
diff -Nru a/fs/ext3/namei.c b/fs/ext3/namei.c
--- a/fs/ext3/namei.c	Tue Jun 15 22:20:41 2004
+++ b/fs/ext3/namei.c	Tue Jun 15 22:20:41 2004
@@ -872,6 +872,8 @@
 		wait_on_buffer(bh);
 		if (!buffer_uptodate(bh)) {
 			/* read error, skip block & hope for the best */
+			ext3_error(sb, __FUNCTION__, "reading directory #%lu "
+				   "offset %lu\n", dir->i_ino, block);
 			brelse(bh);
 			goto next;
 		}
@@ -1763,14 +1765,19 @@
 	struct buffer_head * bh;
 	struct ext3_dir_entry_2 * de, * de1;
 	struct super_block * sb;
-	int err;
+	int err = 0;
 
 	sb = inode->i_sb;
 	if (inode->i_size < EXT3_DIR_REC_LEN(1) + EXT3_DIR_REC_LEN(2) ||
 	    !(bh = ext3_bread (NULL, inode, 0, 0, &err))) {
-	    	ext3_warning (inode->i_sb, "empty_dir",
-			      "bad directory (dir #%lu) - no data block",
-			      inode->i_ino);
+		if (err)
+			ext3_error(inode->i_sb, __FUNCTION__,
+				   "error %d reading directory #%lu offset 0",
+				   err, inode->i_ino);
+		else
+			ext3_warning(inode->i_sb, __FUNCTION__,
+				     "bad directory (dir #%lu) - no data block",
+				     inode->i_ino);
 		return 1;
 	}
 	de = (struct ext3_dir_entry_2 *) bh->b_data;
@@ -1792,24 +1799,26 @@
 	while (offset < inode->i_size ) {
 		if (!bh ||
 			(void *) de >= (void *) (bh->b_data+sb->s_blocksize)) {
+			err = 0;
 			brelse (bh);
 			bh = ext3_bread (NULL, inode,
 				offset >> EXT3_BLOCK_SIZE_BITS(sb), 0, &err);
 			if (!bh) {
-#if 0
-				ext3_error (sb, "empty_dir",
-				"directory #%lu contains a hole at offset %lu",
-					inode->i_ino, offset);
-#endif
+				if (err)
+					ext3_error(sb, __FUNCTION__,
+						   "error %d reading directory"
+						   " #%lu offset %lu",
+						   err, inode->i_ino, offset);
 				offset += sb->s_blocksize;
 				continue;
 			}
 			de = (struct ext3_dir_entry_2 *) bh->b_data;
 		}
-		if (!ext3_check_dir_entry ("empty_dir", inode, de, bh,
-					   offset)) {
-			brelse (bh);
-			return 1;
+		if (!ext3_check_dir_entry("empty_dir", inode, de, bh, offset)) {
+			de = (struct ext3_dir_entry_2 *)(bh->b_data +
+							 sb->s_blocksize);
+			offset = (offset | (sb->s_blocksize - 1)) + 1;
+			continue;
 		}
 		if (le32_to_cpu(de->inode)) {
 			brelse (bh);
@@ -1953,8 +1962,6 @@
 		goto out_brelse;
 	NEXT_ORPHAN(inode) = 0;
 	err = ext3_mark_iloc_dirty(handle, inode, &iloc);
-	if (err)
-		goto out_brelse;
 
 out_err:
 	ext3_std_error(inode->i_sb, err);
@@ -2255,11 +2262,15 @@
 	/*
 	 * ok, that's it
 	 */
-	retval = ext3_delete_entry(handle, old_dir, old_de, old_bh);
-	if (retval == -ENOENT) {
-		/*
-		 * old_de could have moved out from under us.
-		 */
+	if (le32_to_cpu(old_de->inode) != old_inode->i_ino ||
+	    old_de->name_len != old_dentry->d_name.len ||
+	    strncmp(old_de->name, old_dentry->d_name.name, old_de->name_len) ||
+	    (retval = ext3_delete_entry(handle, old_dir,
+					old_de, old_bh)) == -ENOENT) {
+		/* old_de could have moved from under us during htree split, so
+		 * make sure that we are deleting the right entry.  We might
+		 * also be pointing to a stale entry in the unused part of
+		 * old_bh so just checking inum and the name isn't enough. */
 		struct buffer_head *old_bh2;
 		struct ext3_dir_entry_2 *old_de2;
 
diff -Nru a/fs/ext3/super.c b/fs/ext3/super.c
--- a/fs/ext3/super.c	Tue Jun 15 22:20:58 2004
+++ b/fs/ext3/super.c	Tue Jun 15 22:20:58 2004
@@ -521,6 +521,8 @@
 static int ext3_dquot_initialize(struct inode *inode, int type);
 static int ext3_dquot_drop(struct inode *inode);
 static int ext3_write_dquot(struct dquot *dquot);
+static int ext3_acquire_dquot(struct dquot *dquot);
+static int ext3_release_dquot(struct dquot *dquot);
 static int ext3_mark_dquot_dirty(struct dquot *dquot);
 static int ext3_write_info(struct super_block *sb, int type);
 static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path);
@@ -536,6 +538,8 @@
 	.free_inode	= dquot_free_inode,
 	.transfer	= dquot_transfer,
 	.write_dquot	= ext3_write_dquot,
+	.acquire_dquot	= ext3_acquire_dquot,
+	.release_dquot	= ext3_release_dquot,
 	.mark_dirty	= ext3_mark_dquot_dirty,
 	.write_info	= ext3_write_info
 };
@@ -1639,6 +1643,7 @@
 	if (!journal) {
 		printk(KERN_ERR "EXT3-fs: Could not load journal inode\n");
 		iput(journal_inode);
+		return NULL;
 	}
 	journal->j_private = sb;
 	ext3_init_journal_params(EXT3_SB(sb), journal);
@@ -1870,13 +1875,17 @@
 static void ext3_mark_recovery_complete(struct super_block * sb,
 					struct ext3_super_block * es)
 {
-	journal_flush(EXT3_SB(sb)->s_journal);
+	journal_t *journal = EXT3_SB(sb)->s_journal;
+
+	journal_lock_updates(journal);
+	journal_flush(journal);
 	if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) &&
 	    sb->s_flags & MS_RDONLY) {
 		EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER);
 		sb->s_dirt = 0;
 		ext3_commit_super(sb, es, 1);
 	}
+	journal_unlock_updates(journal);
 }
 
 /*
@@ -2175,6 +2184,38 @@
 	if (IS_ERR(handle))
 		return PTR_ERR(handle);
 	ret = dquot_commit(dquot);
+	err = ext3_journal_stop(handle);
+	if (!ret)
+		ret = err;
+	return ret;
+}
+
+static int ext3_acquire_dquot(struct dquot *dquot)
+{
+	int ret, err;
+	handle_t *handle;
+
+	handle = ext3_journal_start(dquot_to_inode(dquot),
+					EXT3_QUOTA_INIT_BLOCKS);
+	if (IS_ERR(handle))
+		return PTR_ERR(handle);
+	ret = dquot_acquire(dquot);
+	err = ext3_journal_stop(handle);
+	if (!ret)
+		ret = err;
+	return ret;
+}
+
+static int ext3_release_dquot(struct dquot *dquot)
+{
+	int ret, err;
+	handle_t *handle;
+
+	handle = ext3_journal_start(dquot_to_inode(dquot),
+					EXT3_QUOTA_INIT_BLOCKS);
+	if (IS_ERR(handle))
+		return PTR_ERR(handle);
+	ret = dquot_release(dquot);
 	err = ext3_journal_stop(handle);
 	if (!ret)
 		ret = err;
diff -Nru a/fs/fat/file.c b/fs/fat/file.c
--- a/fs/fat/file.c	Tue Jun 15 22:20:38 2004
+++ b/fs/fat/file.c	Tue Jun 15 22:20:38 2004
@@ -47,7 +47,8 @@
 	if (!create)
 		return 0;
 	if (iblock != MSDOS_I(inode)->mmu_private >> sb->s_blocksize_bits) {
-		BUG();
+		fat_fs_panic(sb, "corrupted file size (i_pos %lld, %lld)",
+			     MSDOS_I(inode)->i_pos, MSDOS_I(inode)->mmu_private);
 		return -EIO;
 	}
 	if (!((unsigned long)iblock & (MSDOS_SB(sb)->sec_per_clus - 1))) {
diff -Nru a/fs/fat/inode.c b/fs/fat/inode.c
--- a/fs/fat/inode.c	Tue Jun 15 22:20:40 2004
+++ b/fs/fat/inode.c	Tue Jun 15 22:20:40 2004
@@ -1245,7 +1245,7 @@
 	lock_kernel();
 	if (!(bh = sb_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) {
 		printk(KERN_ERR "FAT: unable to read inode block "
-		       "for updating (i_pos %lld)", i_pos);
+		       "for updating (i_pos %lld)\n", i_pos);
 		unlock_kernel();
 		return /* -EIO */;
 	}
diff -Nru a/fs/fcntl.c b/fs/fcntl.c
--- a/fs/fcntl.c	Tue Jun 15 22:20:42 2004
+++ b/fs/fcntl.c	Tue Jun 15 22:20:42 2004
@@ -627,15 +627,12 @@
 		read_unlock(&fasync_lock);
 	}
 }
-
 EXPORT_SYMBOL(kill_fasync);
 
 static int __init fasync_init(void)
 {
 	fasync_cache = kmem_cache_create("fasync_cache",
-		sizeof(struct fasync_struct), 0, 0, NULL, NULL);
-	if (!fasync_cache)
-		panic("cannot create fasync slab cache");
+		sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL, NULL);
 	return 0;
 }
 
diff -Nru a/fs/fs-writeback.c b/fs/fs-writeback.c
--- a/fs/fs-writeback.c	Tue Jun 15 22:21:05 2004
+++ b/fs/fs-writeback.c	Tue Jun 15 22:21:05 2004
@@ -75,8 +75,23 @@
 	if ((inode->i_state & flags) == flags)
 		return;
 
-	if (unlikely(block_dump))
-		printk("%s(%d): dirtied file\n", current->comm, current->pid);
+	if (unlikely(block_dump)) {
+		struct dentry *dentry = NULL;
+		const char *name = "?";
+
+		if (!list_empty(&inode->i_dentry)) {
+			dentry = list_entry(inode->i_dentry.next,
+					    struct dentry, d_alias);
+			if (dentry && dentry->d_name.name)
+				name = (const char *) dentry->d_name.name;
+		}
+
+		if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev"))
+			printk(KERN_DEBUG
+			       "%s(%d): dirtied inode %lu (%s) on %s\n",
+			       current->comm, current->pid, inode->i_ino,
+			       name, inode->i_sb->s_id);
+	}
 
 	spin_lock(&inode_lock);
 	if ((inode->i_state & flags) != flags) {
@@ -295,11 +310,6 @@
 				list_move(&inode->i_list, &sb->s_dirty);
 				continue;
 			}
-			/*
-			 * Assume that all inodes on this superblock are memory
-			 * backed.  Skip the superblock.
-			 */
-			break;
 		}
 
 		if (wbc->nonblocking && bdi_write_congested(bdi)) {
@@ -382,12 +392,26 @@
 
 	spin_lock(&inode_lock);
 	spin_lock(&sb_lock);
+restart:
 	sb = sb_entry(super_blocks.prev);
 	for (; sb != sb_entry(&super_blocks); sb = sb_entry(sb->s_list.prev)) {
 		if (!list_empty(&sb->s_dirty) || !list_empty(&sb->s_io)) {
+			/* we're making our own get_super here */
+			sb->s_count++;
 			spin_unlock(&sb_lock);
-			sync_sb_inodes(sb, wbc);
+			/*
+			 * If we can't get the readlock, there's no sense in
+			 * waiting around, most of the time the FS is going to
+			 * be unmounted by the time it is released.
+			 */
+			if (down_read_trylock(&sb->s_umount)) {
+				if (sb->s_root)
+					sync_sb_inodes(sb, wbc);
+				up_read(&sb->s_umount);
+			}
 			spin_lock(&sb_lock);
+			if (__put_super(sb))
+				goto restart;
 		}
 		if (wbc->nr_to_write <= 0)
 			break;
@@ -409,18 +433,15 @@
  */
 void sync_inodes_sb(struct super_block *sb, int wait)
 {
-	struct page_state ps;
 	struct writeback_control wbc = {
-		.bdi		= NULL,
 		.sync_mode	= wait ? WB_SYNC_ALL : WB_SYNC_HOLD,
-		.older_than_this = NULL,
-		.nr_to_write	= 0,
 	};
+	unsigned long nr_dirty = read_page_state(nr_dirty);
+	unsigned long nr_unstable = read_page_state(nr_unstable);
 
-	get_page_state(&ps);
-	wbc.nr_to_write = ps.nr_dirty + ps.nr_unstable +
+	wbc.nr_to_write = nr_dirty + nr_unstable +
 			(inodes_stat.nr_inodes - inodes_stat.nr_unused) +
-			ps.nr_dirty + ps.nr_unstable;
+			nr_dirty + nr_unstable;
 	wbc.nr_to_write += wbc.nr_to_write / 2;		/* Bit more for luck */
 	spin_lock(&inode_lock);
 	sync_sb_inodes(sb, &wbc);
@@ -520,6 +541,9 @@
 		.nr_to_write = LONG_MAX,
 		.sync_mode = WB_SYNC_ALL,
 	};
+
+	if (inode->i_mapping->backing_dev_info->memory_backed)
+		return;
 
 	spin_lock(&inode_lock);
 	__writeback_single_inode(inode, &wbc);
diff -Nru a/fs/hfs/catalog.c b/fs/hfs/catalog.c
--- a/fs/hfs/catalog.c	Tue Jun 15 22:20:43 2004
+++ b/fs/hfs/catalog.c	Tue Jun 15 22:20:43 2004
@@ -101,11 +101,11 @@
 	if (err != -ENOENT) {
 		if (!err)
 			err = -EEXIST;
-		goto out;
+		goto err2;
 	}
 	err = hfs_brec_insert(&fd, &entry, entry_size);
 	if (err)
-		goto out;
+		goto err2;
 
 	hfs_cat_build_key(fd.search_key, dir->i_ino, str);
 	entry_size = hfs_cat_build_record(&entry, cnid, inode);
@@ -114,16 +114,24 @@
 		/* panic? */
 		if (!err)
 			err = -EEXIST;
-		goto out;
+		goto err1;
 	}
 	err = hfs_brec_insert(&fd, &entry, entry_size);
-	if (!err) {
-		dir->i_size++;
-		mark_inode_dirty(dir);
-	}
-out:
+	if (err)
+		goto err1;
+
+	dir->i_size++;
+	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+	mark_inode_dirty(dir);
 	hfs_find_exit(&fd);
+	return 0;
 
+err1:
+	hfs_cat_build_key(fd.search_key, cnid, NULL);
+	if (!hfs_brec_find(&fd))
+		hfs_brec_remove(&fd);
+err2:
+	hfs_find_exit(&fd);
 	return err;
 }
 
@@ -240,6 +248,7 @@
 	}
 
 	dir->i_size--;
+	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
 	mark_inode_dirty(dir);
 	res = 0;
 out:
@@ -292,6 +301,7 @@
 	if (err)
 		goto out;
 	dst_dir->i_size++;
+	dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME;
 	mark_inode_dirty(dst_dir);
 
 	/* finally remove the old entry */
@@ -303,6 +313,7 @@
 	if (err)
 		goto out;
 	src_dir->i_size--;
+	src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME;
 	mark_inode_dirty(src_dir);
 
 	type = entry.type;
diff -Nru a/fs/hfs/inode.c b/fs/hfs/inode.c
--- a/fs/hfs/inode.c	Tue Jun 15 22:21:05 2004
+++ b/fs/hfs/inode.c	Tue Jun 15 22:21:05 2004
@@ -96,7 +96,7 @@
 			}
 			hfs_bnode_unhash(node);
 			hfs_bnode_free(node);
-		} while (--i);
+		} while (--i && nidx < tree->node_count);
 		spin_unlock(&tree->hash_lock);
 	}
 	//printk("releasepage: %lu,%x = %d\n", page->index, mask, res);
diff -Nru a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
--- a/fs/hfsplus/brec.c	Tue Jun 15 22:20:58 2004
+++ b/fs/hfsplus/brec.c	Tue Jun 15 22:20:58 2004
@@ -33,7 +33,7 @@
 
 	if ((node->type == HFS_NODE_INDEX) &&
 	   !(node->tree->attributes & HFS_TREE_VARIDXKEYS)) {
-		retval = node->tree->max_key_len;
+		retval = node->tree->max_key_len + 2;
 	} else {
 		recoff = hfs_bnode_read_u16(node, node->tree->node_size - (rec + 1) * 2);
 		if (!recoff)
@@ -144,7 +144,7 @@
 		if (tree->attributes & HFS_TREE_VARIDXKEYS)
 			key_len = be16_to_cpu(fd->search_key->key_len) + 2;
 		else {
-			fd->search_key->key_len = tree->max_key_len;
+			fd->search_key->key_len = cpu_to_be16(tree->max_key_len);
 			key_len = tree->max_key_len + 2;
 		}
 		goto again;
diff -Nru a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
--- a/fs/hfsplus/catalog.c	Tue Jun 15 22:20:41 2004
+++ b/fs/hfsplus/catalog.c	Tue Jun 15 22:20:41 2004
@@ -165,11 +165,11 @@
 	if (err != -ENOENT) {
 		if (!err)
 			err = -EEXIST;
-		goto out;
+		goto err2;
 	}
 	err = hfs_brec_insert(&fd, &entry, entry_size);
 	if (err)
-		goto out;
+		goto err2;
 
 	hfsplus_cat_build_key(fd.search_key, dir->i_ino, str);
 	entry_size = hfsplus_cat_build_record(&entry, cnid, inode);
@@ -178,16 +178,24 @@
 		/* panic? */
 		if (!err)
 			err = -EEXIST;
-		goto out;
+		goto err1;
 	}
 	err = hfs_brec_insert(&fd, &entry, entry_size);
-	if (!err) {
-		dir->i_size++;
-		mark_inode_dirty(dir);
-	}
-out:
+	if (err)
+		goto err1;
+
+	dir->i_size++;
+	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+	mark_inode_dirty(dir);
 	hfs_find_exit(&fd);
+	return 0;
 
+err1:
+	hfsplus_cat_build_key(fd.search_key, cnid, NULL);
+	if (!hfs_brec_find(&fd))
+		hfs_brec_remove(&fd);
+err2:
+	hfs_find_exit(&fd);
 	return err;
 }
 
@@ -259,6 +267,7 @@
 		goto out;
 
 	dir->i_size--;
+	dir->i_mtime = dir->i_ctime = CURRENT_TIME;
 	mark_inode_dirty(dir);
 out:
 	hfs_find_exit(&fd);
@@ -304,6 +313,7 @@
 	if (err)
 		goto out;
 	dst_dir->i_size++;
+	dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME;
 	mark_inode_dirty(dst_dir);
 
 	/* finally remove the old entry */
@@ -315,6 +325,7 @@
 	if (err)
 		goto out;
 	src_dir->i_size--;
+	src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME;
 	mark_inode_dirty(src_dir);
 
 	/* remove old thread entry */
diff -Nru a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
--- a/fs/hfsplus/dir.c	Tue Jun 15 22:20:38 2004
+++ b/fs/hfsplus/dir.c	Tue Jun 15 22:20:38 2004
@@ -18,6 +18,13 @@
 #include "hfsplus_fs.h"
 #include "hfsplus_raw.h"
 
+static inline void hfsplus_instantiate(struct dentry *dentry,
+				       struct inode *inode, u32 cnid)
+{
+	dentry->d_fsdata = (void *)(unsigned long)cnid;
+	d_instantiate(dentry, inode);
+}
+
 /* Find the entry inside dir named dentry->d_name */
 static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
 				     struct nameidata *nd)
@@ -52,6 +59,7 @@
 			goto fail;
 		}
 		cnid = be32_to_cpu(entry.folder.id);
+		dentry->d_fsdata = (void *)(unsigned long)cnid;
 	} else if (type == HFSPLUS_FILE) {
 		if (fd.entrylength < sizeof(struct hfsplus_cat_file)) {
 			err = -EIO;
@@ -233,11 +241,11 @@
 	res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
 	if (res) {
 		inode->i_nlink = 0;
+		hfsplus_delete_inode(inode);
 		iput(inode);
 		return res;
 	}
-	dentry->d_fsdata = (void *)inode->i_ino;
-	d_instantiate(dentry, inode);
+	hfsplus_instantiate(dentry, inode, inode->i_ino);
 	mark_inode_dirty(inode);
 	return 0;
 }
@@ -284,8 +292,7 @@
 		return res;
 
 	inode->i_nlink++;
-	dst_dentry->d_fsdata = (void *)(unsigned long)cnid;
-	d_instantiate(dst_dentry, inode);
+	hfsplus_instantiate(dst_dentry, inode, cnid);
 	atomic_inc(&inode->i_count);
 	inode->i_ctime = CURRENT_TIME;
 	mark_inode_dirty(inode);
@@ -351,10 +358,11 @@
 	res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
 	if (res) {
 		inode->i_nlink = 0;
+		hfsplus_delete_inode(inode);
 		iput(inode);
 		return res;
 	}
-	d_instantiate(dentry, inode);
+	hfsplus_instantiate(dentry, inode, inode->i_ino);
 	mark_inode_dirty(inode);
 	return 0;
 }
@@ -391,7 +399,8 @@
 	res = page_symlink(inode, symname, strlen(symname) + 1);
 	if (res) {
 		inode->i_nlink = 0;
-		iput (inode);
+		hfsplus_delete_inode(inode);
+		iput(inode);
 		return res;
 	}
 
@@ -399,8 +408,7 @@
 	res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
 
 	if (!res) {
-		dentry->d_fsdata = (void *)inode->i_ino;
-		d_instantiate(dentry, inode);
+		hfsplus_instantiate(dentry, inode, inode->i_ino);
 		mark_inode_dirty(inode);
 	}
 
@@ -421,12 +429,12 @@
 	res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
 	if (res) {
 		inode->i_nlink = 0;
+		hfsplus_delete_inode(inode);
 		iput(inode);
 		return res;
 	}
 	init_special_inode(inode, mode, rdev);
-	dentry->d_fsdata = (void *)inode->i_ino;
-	d_instantiate(dentry, inode);
+	hfsplus_instantiate(dentry, inode, inode->i_ino);
 	mark_inode_dirty(inode);
 
 	return 0;
diff -Nru a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
--- a/fs/hfsplus/inode.c	Tue Jun 15 22:20:38 2004
+++ b/fs/hfsplus/inode.c	Tue Jun 15 22:20:38 2004
@@ -96,7 +96,7 @@
 			}
 			hfs_bnode_unhash(node);
 			hfs_bnode_free(node);
-		} while (--i);
+		} while (--i && nidx < tree->node_count);
 		spin_unlock(&tree->hash_lock);
 	}
 	//printk("releasepage: %lu,%x = %d\n", page->index, mask, res);
diff -Nru a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
--- a/fs/hfsplus/ioctl.c	Tue Jun 15 22:20:38 2004
+++ b/fs/hfsplus/ioctl.c	Tue Jun 15 22:20:38 2004
@@ -31,7 +31,7 @@
 			flags |= EXT2_FLAG_APPEND; /* EXT2_APPEND_FL */
 		if (HFSPLUS_I(inode).userflags & HFSPLUS_FLG_NODUMP)
 			flags |= EXT2_FLAG_NODUMP; /* EXT2_NODUMP_FL */
-		return put_user(flags, (int *)arg);
+		return put_user(flags, (int __user *)arg);
 	case HFSPLUS_IOC_EXT2_SETFLAGS: {
 		if (IS_RDONLY(inode))
 			return -EROFS;
@@ -39,7 +39,7 @@
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EACCES;
 
-		if (get_user(flags, (int *)arg))
+		if (get_user(flags, (int __user *)arg))
 			return -EFAULT;
 
 		if (flags & (EXT2_FLAG_IMMUTABLE|EXT2_FLAG_APPEND) ||
diff -Nru a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
--- a/fs/hugetlbfs/inode.c	Tue Jun 15 22:20:58 2004
+++ b/fs/hugetlbfs/inode.c	Tue Jun 15 22:20:58 2004
@@ -43,6 +43,8 @@
 	.memory_backed	= 1,	/* Does not contribute to dirty memory */
 };
 
+int sysctl_hugetlb_shm_group;
+
 static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct inode *inode = file->f_dentry->d_inode;
@@ -264,40 +266,28 @@
  * h_pgoff is in HPAGE_SIZE units.
  * vma->vm_pgoff is in PAGE_SIZE units.
  */
-static void
-hugetlb_vmtruncate_list(struct list_head *list, unsigned long h_pgoff)
+static inline void
+hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff)
 {
-	struct vm_area_struct *vma;
+	struct vm_area_struct *vma = NULL;
+	struct prio_tree_iter iter;
 
-	list_for_each_entry(vma, list, shared) {
+	while ((vma = vma_prio_tree_next(vma, root, &iter,
+					h_pgoff, ULONG_MAX)) != NULL) {
 		unsigned long h_vm_pgoff;
 		unsigned long v_length;
-		unsigned long h_length;
 		unsigned long v_offset;
 
 		h_vm_pgoff = vma->vm_pgoff << (HPAGE_SHIFT - PAGE_SHIFT);
 		v_length = vma->vm_end - vma->vm_start;
-		h_length = v_length >> HPAGE_SHIFT;
 		v_offset = (h_pgoff - h_vm_pgoff) << HPAGE_SHIFT;
 
 		/*
 		 * Is this VMA fully outside the truncation point?
 		 */
-		if (h_vm_pgoff >= h_pgoff) {
-			zap_hugepage_range(vma, vma->vm_start, v_length);
-			continue;
-		}
-
-		/*
-		 * Is this VMA fully inside the truncaton point?
-		 */
-		if (h_vm_pgoff + (v_length >> HPAGE_SHIFT) <= h_pgoff)
-			continue;
+		if (h_vm_pgoff >= h_pgoff)
+			v_offset = 0;
 
-		/*
-		 * The VMA straddles the truncation point.  v_offset is the
-		 * offset (in bytes) into the VMA where the point lies.
-		 */
 		zap_hugepage_range(vma,
 				vma->vm_start + v_offset,
 				v_length - v_offset);
@@ -319,12 +309,10 @@
 	pgoff = offset >> HPAGE_SHIFT;
 
 	inode->i_size = offset;
-	down(&mapping->i_shared_sem);
-	if (!list_empty(&mapping->i_mmap))
+	spin_lock(&mapping->i_mmap_lock);
+	if (!prio_tree_empty(&mapping->i_mmap))
 		hugetlb_vmtruncate_list(&mapping->i_mmap, pgoff);
-	if (!list_empty(&mapping->i_mmap_shared))
-		hugetlb_vmtruncate_list(&mapping->i_mmap_shared, pgoff);
-	up(&mapping->i_shared_sem);
+	spin_unlock(&mapping->i_mmap_lock);
 	truncate_hugepages(mapping, offset);
 	return 0;
 }
@@ -375,6 +363,7 @@
 
 	inode = new_inode(sb);
 	if (inode) {
+		struct hugetlbfs_inode_info *info;
 		inode->i_mode = mode;
 		inode->i_uid = uid;
 		inode->i_gid = gid;
@@ -383,6 +372,8 @@
 		inode->i_mapping->a_ops = &hugetlbfs_aops;
 		inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+		info = HUGETLBFS_I(inode);
+		mpol_shared_policy_init(&info->policy);
 		switch (mode & S_IFMT) {
 		default:
 			init_special_inode(inode, mode, dev);
@@ -510,6 +501,33 @@
 	}
 }
 
+static kmem_cache_t *hugetlbfs_inode_cachep;
+
+static struct inode *hugetlbfs_alloc_inode(struct super_block *sb)
+{
+	struct hugetlbfs_inode_info *p;
+
+	p = kmem_cache_alloc(hugetlbfs_inode_cachep, SLAB_KERNEL);
+	if (!p)
+		return NULL;
+	return &p->vfs_inode;
+}
+
+static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags)
+{
+	struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo;
+
+	if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
+	    SLAB_CTOR_CONSTRUCTOR)
+		inode_init_once(&ei->vfs_inode);
+}
+
+static void hugetlbfs_destroy_inode(struct inode *inode)
+{
+	mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy);
+	kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode));
+}
+
 static struct address_space_operations hugetlbfs_aops = {
 	.readpage	= hugetlbfs_readpage,
 	.prepare_write	= hugetlbfs_prepare_write,
@@ -541,6 +559,8 @@
 };
 
 static struct super_operations hugetlbfs_ops = {
+	.alloc_inode    = hugetlbfs_alloc_inode,
+	.destroy_inode  = hugetlbfs_destroy_inode,
 	.statfs		= hugetlbfs_statfs,
 	.drop_inode	= hugetlbfs_drop_inode,
 	.put_super	= hugetlbfs_put_super,
@@ -698,6 +718,12 @@
 	return ret;
 }
 
+static int can_do_hugetlb_shm(void)
+{
+	return likely(capable(CAP_IPC_LOCK) ||
+			in_group_p(sysctl_hugetlb_shm_group));
+}
+
 struct file *hugetlb_zero_setup(size_t size)
 {
 	int error;
@@ -707,7 +733,7 @@
 	struct qstr quick_string;
 	char buf[16];
 
-	if (!capable(CAP_IPC_LOCK))
+	if (!can_do_hugetlb_shm())
 		return ERR_PTR(-EPERM);
 
 	if (!is_hugepage_mem_enough(size))
@@ -755,9 +781,16 @@
 	int error;
 	struct vfsmount *vfsmount;
 
+	hugetlbfs_inode_cachep = kmem_cache_create("hugetlbfs_inode_cache",
+					sizeof(struct hugetlbfs_inode_info),
+					0, SLAB_RECLAIM_ACCOUNT,
+					init_once, NULL);
+	if (hugetlbfs_inode_cachep == NULL)
+		return -ENOMEM;
+
 	error = register_filesystem(&hugetlbfs_fs_type);
 	if (error)
-		return error;
+		goto out;
 
 	vfsmount = kern_mount(&hugetlbfs_fs_type);
 
@@ -767,11 +800,16 @@
 	}
 
 	error = PTR_ERR(vfsmount);
+
+ out:
+	if (error)
+		kmem_cache_destroy(hugetlbfs_inode_cachep);
 	return error;
 }
 
 static void __exit exit_hugetlbfs_fs(void)
 {
+	kmem_cache_destroy(hugetlbfs_inode_cachep);
 	unregister_filesystem(&hugetlbfs_fs_type);
 }
 
diff -Nru a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c	Tue Jun 15 22:21:04 2004
+++ b/fs/inode.c	Tue Jun 15 22:21:04 2004
@@ -149,8 +149,20 @@
 		mapping_set_gfp_mask(mapping, GFP_HIGHUSER);
 		mapping->assoc_mapping = NULL;
 		mapping->backing_dev_info = &default_backing_dev_info;
-		if (sb->s_bdev)
-			mapping->backing_dev_info = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
+
+		/*
+		 * If the block_device provides a backing_dev_info for client
+		 * inodes then use that.  Otherwise the inode share the bdev's
+		 * backing_dev_info.
+		 */
+		if (sb->s_bdev) {
+			struct backing_dev_info *bdi;
+
+			bdi = sb->s_bdev->bd_inode_backing_dev_info;
+			if (!bdi)
+				bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
+			mapping->backing_dev_info = bdi;
+		}
 		memset(&inode->u, 0, sizeof(inode->u));
 		inode->i_mapping = mapping;
 	}
@@ -184,12 +196,12 @@
 	init_rwsem(&inode->i_alloc_sem);
 	INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC);
 	spin_lock_init(&inode->i_data.tree_lock);
-	init_MUTEX(&inode->i_data.i_shared_sem);
+	spin_lock_init(&inode->i_data.i_mmap_lock);
 	atomic_set(&inode->i_data.truncate_count, 0);
 	INIT_LIST_HEAD(&inode->i_data.private_list);
 	spin_lock_init(&inode->i_data.private_lock);
-	INIT_LIST_HEAD(&inode->i_data.i_mmap);
-	INIT_LIST_HEAD(&inode->i_data.i_mmap_shared);
+	INIT_PRIO_TREE_ROOT(&inode->i_data.i_mmap);
+	INIT_LIST_HEAD(&inode->i_data.i_mmap_nonlinear);
 	spin_lock_init(&inode->i_lock);
 	i_size_ordered_init(inode);
 }
@@ -671,13 +683,14 @@
 
 static inline unsigned long hash(struct super_block *sb, unsigned long hashval)
 {
-	unsigned long tmp = hashval + ((unsigned long) sb / L1_CACHE_BYTES);
-	tmp = tmp + (tmp >> I_HASHBITS);
+	unsigned long tmp;
+
+	tmp = (hashval * (unsigned long)sb) ^ (GOLDEN_RATIO_PRIME + hashval) /
+			L1_CACHE_BYTES;
+	tmp = tmp ^ ((tmp ^ GOLDEN_RATIO_PRIME) >> I_HASHBITS);
 	return tmp & I_HASHMASK;
 }
 
-/* Yeah, I know about quadratic hash. Maybe, later. */
-
 /**
  *	iunique - get a unique inode number
  *	@sb: superblock
@@ -1383,11 +1396,8 @@
 
 	/* inode slab cache */
 	inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode),
-					 0, SLAB_HWCACHE_ALIGN, init_once,
-					 NULL);
-	if (!inode_cachep)
-		panic("cannot create inode slab cache");
-
+				0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, init_once,
+				NULL);
 	set_shrinker(DEFAULT_SEEKS, shrink_icache_memory);
 }
 
@@ -1408,5 +1418,4 @@
 		printk(KERN_DEBUG "init_special_inode: bogus i_mode (%o)\n",
 		       mode);
 }
-
 EXPORT_SYMBOL(init_special_inode);
diff -Nru a/fs/intermezzo/Makefile b/fs/intermezzo/Makefile
--- a/fs/intermezzo/Makefile	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,11 +0,0 @@
-#
-# Makefile 1.00 Peter Braam <braam@clusterfs.com>
-#
-
-obj-$(CONFIG_INTERMEZZO_FS) += intermezzo.o
-
-intermezzo-objs := cache.o dcache.o dir.o ext_attr.o file.o fileset.o \
-	           inode.o journal.o journal_ext2.o journal_ext3.o \
-	           journal_obdfs.o journal_reiserfs.o journal_tmpfs.o journal_xfs.o \
-	           kml_reint.o kml_unpack.o methods.o presto.o psdev.o replicator.o \
-	           super.o sysctl.o upcall.o vfs.o
diff -Nru a/fs/intermezzo/cache.c b/fs/intermezzo/cache.c
--- a/fs/intermezzo/cache.c	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,207 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2000 Stelias Computing, Inc.
- *  Copyright (C) 2000 Red Hat, Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/module.h>
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/string.h>
-#include <linux/blkdev.h>
-#include <linux/init.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-/*
-   This file contains the routines associated with managing a
-   cache of files for InterMezzo.  These caches have two reqs:
-   - need to be found fast so they are hashed by the device, 
-     with an attempt to have collision chains of length 1.
-   The methods for the cache are set up in methods.
-*/
-
-extern kmem_cache_t * presto_dentry_slab;
-
-/* the intent of this hash is to have collision chains of length 1 */
-#define CACHES_BITS 8
-#define CACHES_SIZE (1 << CACHES_BITS)
-#define CACHES_MASK CACHES_SIZE - 1
-static struct list_head presto_caches[CACHES_SIZE];
-
-static inline int presto_cache_hash(struct super_block *s)
-{
-        return (CACHES_MASK) & ((unsigned long)s >> L1_CACHE_SHIFT);
-}
-
-inline void presto_cache_add(struct presto_cache *cache)
-{
-        list_add(&cache->cache_chain,
-                 &presto_caches[presto_cache_hash(cache->cache_sb)]);
-}
-
-inline void presto_cache_init_hash(void)
-{
-        int i;
-        for ( i = 0; i < CACHES_SIZE; i++ ) {
-                INIT_LIST_HEAD(&presto_caches[i]);
-        }
-}
-
-int izo_ioctl_packlen(struct izo_ioctl_data *data)
-{
-        int len = sizeof(struct izo_ioctl_data);
-        len += size_round(data->ioc_inllen1);
-        len += size_round(data->ioc_inllen2);
-        return len;
-}
-
-/* map a device to a cache */
-struct presto_cache *presto_cache_find(struct super_block *s)
-{
-        struct presto_cache *cache;
-        struct list_head *lh, *tmp;
-
-        lh = tmp = &(presto_caches[presto_cache_hash(s)]);
-        while ( (tmp = lh->next) != lh ) {
-                cache = list_entry(tmp, struct presto_cache, cache_chain);
-                if (cache->cache_sb == s)
-                        return cache;
-        }
-        return NULL;
-}
-
-
-/* map an inode to a cache */
-struct presto_cache *presto_get_cache(struct inode *inode)
-{
-        struct presto_cache *cache;
-        ENTRY;
-        /* find the correct presto_cache here, based on the device */
-        cache = presto_cache_find(inode->i_sb);
-        if ( !cache ) {
-                CERROR("WARNING: no presto cache for %s, ino %ld\n",
-                       inode->i_sb->s_id, inode->i_ino);
-                EXIT;
-                return NULL;
-        }
-        EXIT;
-        return cache;
-}
-
-/* another debugging routine: check fs is InterMezzo fs */
-int presto_ispresto(struct inode *inode)
-{
-        struct presto_cache *cache;
-
-        if ( !inode )
-                return 0;
-        cache = presto_get_cache(inode);
-        if ( !cache )
-                return 0;
-        return inode->i_sb == cache->cache_sb;
-}
-
-/* setup a cache structure when we need one */
-struct presto_cache *presto_cache_init(void)
-{
-        struct presto_cache *cache;
-
-        PRESTO_ALLOC(cache, sizeof(struct presto_cache));
-        if ( cache ) {
-                memset(cache, 0, sizeof(struct presto_cache));
-                INIT_LIST_HEAD(&cache->cache_chain);
-                INIT_LIST_HEAD(&cache->cache_fset_list);
-                cache->cache_lock = SPIN_LOCK_UNLOCKED;
-                cache->cache_reserved = 0; 
-        }
-        return cache;
-}
-
-/* free a cache structure and all of the memory it is pointing to */
-inline void presto_free_cache(struct presto_cache *cache)
-{
-        if (!cache)
-                return;
-
-        list_del(&cache->cache_chain);
-        if (cache->cache_sb && cache->cache_sb->s_root &&
-                        presto_d2d(cache->cache_sb->s_root)) {
-                kmem_cache_free(presto_dentry_slab, 
-                                presto_d2d(cache->cache_sb->s_root));
-                cache->cache_sb->s_root->d_fsdata = NULL;
-        }
-
-        PRESTO_FREE(cache, sizeof(struct presto_cache));
-}
-
-int presto_reserve_space(struct presto_cache *cache, loff_t req)
-{
-        struct filter_fs *filter; 
-        loff_t avail; 
-        struct super_block *sb = cache->cache_sb;
-        filter = cache->cache_filter;
-        if (!filter ) {
-                EXIT;
-                return 0; 
-        }
-        if (!filter->o_trops ) {
-                EXIT;
-                return 0; 
-        }
-        if (!filter->o_trops->tr_avail ) {
-                EXIT;
-                return 0; 
-        }
-
-        spin_lock(&cache->cache_lock);
-        avail = filter->o_trops->tr_avail(cache, sb); 
-        CDEBUG(D_SUPER, "ESC::%ld +++> %ld \n", (long) cache->cache_reserved,
-                 (long) (cache->cache_reserved + req)); 
-        CDEBUG(D_SUPER, "ESC::Avail::%ld \n", (long) avail);
-        if (req + cache->cache_reserved > avail) {
-                spin_unlock(&cache->cache_lock);
-                EXIT;
-                return -ENOSPC;
-        }
-        cache->cache_reserved += req; 
-        spin_unlock(&cache->cache_lock);
-
-        EXIT;
-        return 0;
-}
-
-void presto_release_space(struct presto_cache *cache, loff_t req)
-{
-        CDEBUG(D_SUPER, "ESC::%ld ---> %ld \n", (long) cache->cache_reserved,
-                 (long) (cache->cache_reserved - req)); 
-        spin_lock(&cache->cache_lock);
-        cache->cache_reserved -= req; 
-        spin_unlock(&cache->cache_lock);
-}
diff -Nru a/fs/intermezzo/dcache.c b/fs/intermezzo/dcache.c
--- a/fs/intermezzo/dcache.c	Tue Jun 15 22:20:44 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,342 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Original version: Copyright (C) 1996 P. Braam and M. Callahan
- *  Rewritten for Linux 2.1. Copyright (C) 1997 Carnegie Mellon University
- *  d_fsdata and NFS compatiblity fixes Copyright (C) 2001 Tacit Networks, Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Directory operations for InterMezzo filesystem
- */
-
-/* inode dentry alias list walking code adapted from linux/fs/dcache.c
- *
- * fs/dcache.c
- *
- * (C) 1997 Thomas Schoebel-Theuer,
- * with heavy changes by Linus Torvalds
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-#include <linux/vmalloc.h>
-
-#include "intermezzo_fs.h"
-
-kmem_cache_t * presto_dentry_slab;
-
-/* called when a cache lookup succeeds */
-static int presto_d_revalidate(struct dentry *de, struct nameidata *nd)
-{
-        struct inode *inode = de->d_inode;
-        struct presto_file_set * root_fset;
-
-        ENTRY;
-        if (!inode) {
-                EXIT;
-                return 0;
-        }
-
-        if (is_bad_inode(inode)) {
-                EXIT;
-                return 0;
-        }
-
-        if (!presto_d2d(de)) {
-                presto_set_dd(de);
-        }
-
-        if (!presto_d2d(de)) {
-                EXIT;
-                return 0;
-        }
-
-        root_fset = presto_d2d(de->d_inode->i_sb->s_root)->dd_fset;
-        if (root_fset->fset_flags & FSET_FLAT_BRANCH && 
-            (presto_d2d(de)->dd_fset != root_fset )) {
-                presto_d2d(de)->dd_fset = root_fset;
-        }
-
-        EXIT;
-        return 1;
-
-#if 0
-        /* The following is needed for metadata on demand. */
-        if ( S_ISDIR(inode->i_mode) ) {
-                EXIT;
-                return (presto_chk(de, PRESTO_DATA) &&
-                        (presto_chk(de, PRESTO_ATTR)));
-        } else {
-                EXIT;
-                return presto_chk(de, PRESTO_ATTR);
-        }
-#endif
-}
-
-static void presto_d_release(struct dentry *dentry)
-{
-        if (!presto_d2d(dentry)) {
-                /* This can happen for dentries from NFSd */
-                return;
-        }
-        presto_d2d(dentry)->dd_count--;
-
-        if (!presto_d2d(dentry)->dd_count) {
-                kmem_cache_free(presto_dentry_slab, presto_d2d(dentry));
-                dentry->d_fsdata = NULL;
-        }
-}
-
-struct dentry_operations presto_dentry_ops = 
-{
-        .d_revalidate =  presto_d_revalidate,
-        .d_release = presto_d_release
-};
-
-static inline int presto_is_dentry_ROOT (struct dentry *dentry)
-{
-        return(dentry_name_cmp(dentry,"ROOT") &&
-               !dentry_name_cmp(dentry->d_parent,".intermezzo"));
-}
-
-static struct presto_file_set* presto_try_find_fset(struct dentry* dentry,
-                int *is_under_d_intermezzo)
-{
-        struct dentry* temp_dentry;
-        struct presto_dentry_data *d_data;
-        int found_root=0;
-
-        ENTRY;
-        CDEBUG(D_FSDATA, "finding fileset for %p:%s\n", dentry, 
-                        dentry->d_name.name);
-
-        *is_under_d_intermezzo = 0;
-
-        /* walk up through the branch to get the fileset */
-        /* The dentry we are passed presumably does not have the correct
-         * fset information. However, we still want to start walking up
-         * the branch from this dentry to get our found_root and 
-         * is_under_d_intermezzo decisions correct
-         */
-        for (temp_dentry = dentry ; ; temp_dentry = temp_dentry->d_parent) {
-                CDEBUG(D_FSDATA, "--->dentry %p:%*s\n", temp_dentry, 
-                        temp_dentry->d_name.len,temp_dentry->d_name.name);
-                if (presto_is_dentry_ROOT(temp_dentry))
-                        found_root = 1;
-                if (!found_root &&
-                    dentry_name_cmp(temp_dentry, ".intermezzo")) {
-                        *is_under_d_intermezzo = 1;
-                }
-                d_data = presto_d2d(temp_dentry);
-                if (d_data) {
-                        /* If we found a "ROOT" dentry while walking up the
-                         * branch, we will journal regardless of whether
-                         * we are under .intermezzo or not.
-                         * If we are already under d_intermezzo don't reverse
-                         * the decision here...even if we found a "ROOT"
-                         * dentry above .intermezzo (if we were ever to
-                         * modify the directory structure).
-                         */
-                        if (!*is_under_d_intermezzo)  
-                                *is_under_d_intermezzo = !found_root &&
-                                  (d_data->dd_flags & PRESTO_DONT_JOURNAL);
-                        EXIT;
-                        return d_data->dd_fset;
-                }
-                if (temp_dentry->d_parent == temp_dentry) {
-                        break;
-                }
-        }
-        EXIT;
-        return NULL;
-}
-
-/* Only call this function on positive dentries */
-static struct presto_dentry_data* presto_try_find_alias_with_dd (
-                  struct dentry* dentry)
-{
-        struct inode *inode=dentry->d_inode;
-        struct list_head *head, *next, *tmp;
-        struct dentry *tmp_dentry;
-
-        /* Search through the alias list for dentries with d_fsdata */
-        spin_lock(&dcache_lock);
-        head = &inode->i_dentry;
-        next = inode->i_dentry.next;
-        while (next != head) {
-                tmp = next;
-                next = tmp->next;
-                tmp_dentry = list_entry(tmp, struct dentry, d_alias);
-                if (!presto_d2d(tmp_dentry)) {
-                        spin_unlock(&dcache_lock);
-                        return presto_d2d(tmp_dentry);
-                }
-        }
-        spin_unlock(&dcache_lock);
-        return NULL;
-}
-
-/* Only call this function on positive dentries */
-static void presto_set_alias_dd (struct dentry *dentry, 
-                struct presto_dentry_data* dd)
-{
-        struct inode *inode=dentry->d_inode;
-        struct list_head *head, *next, *tmp;
-        struct dentry *tmp_dentry;
-
-        /* Set d_fsdata for this dentry */
-        dd->dd_count++;
-        dentry->d_fsdata = dd;
-
-        /* Now set d_fsdata for all dentries in the alias list. */
-        spin_lock(&dcache_lock);
-        head = &inode->i_dentry;
-        next = inode->i_dentry.next;
-        while (next != head) {
-                tmp = next;
-                next = tmp->next;
-                tmp_dentry = list_entry(tmp, struct dentry, d_alias);
-                if (!presto_d2d(tmp_dentry)) {
-                        dd->dd_count++;
-                        tmp_dentry->d_fsdata = dd;
-                }
-        }
-        spin_unlock(&dcache_lock);
-        return;
-}
-
-inline struct presto_dentry_data *izo_alloc_ddata(void)
-{
-        struct presto_dentry_data *dd;
-
-        dd = kmem_cache_alloc(presto_dentry_slab, SLAB_KERNEL);
-        if (dd == NULL) {
-                CERROR("IZO: out of memory trying to allocate presto_dentry_data\n");
-                return NULL;
-        }
-        memset(dd, 0, sizeof(*dd));
-        dd->dd_count = 1;
-
-        return dd;
-}
-
-/* This uses the BKL! */
-int presto_set_dd(struct dentry * dentry)
-{
-        struct presto_file_set *fset;
-        struct presto_dentry_data *dd;
-        int is_under_d_izo;
-        int error=0;
-
-        ENTRY;
-
-        if (!dentry)
-                BUG();
-
-        lock_kernel();
-
-        /* Did we lose a race? */
-        if (dentry->d_fsdata) {
-                CERROR("dentry %p already has d_fsdata set\n", dentry);
-                if (dentry->d_inode)
-                        CERROR("    inode: %ld\n", dentry->d_inode->i_ino);
-                EXIT;
-                goto out_unlock;
-        }
-
-        if (dentry->d_inode != NULL) {
-                /* NFSd runs find_fh_dentry which instantiates disconnected
-                 * dentries which are then connected without a lookup(). 
-                 * So it is possible to have connected dentries that do not 
-                 * have d_fsdata set. So we walk the list trying to find 
-                 * an alias which has its d_fsdata set and then use that 
-                 * for all the other dentries  as well. 
-                 * - SHP,Vinny. 
-                 */
-
-                /* If there is an alias with d_fsdata use it. */
-                if ((dd = presto_try_find_alias_with_dd (dentry))) {
-                        presto_set_alias_dd (dentry, dd);
-                        EXIT;
-                        goto out_unlock;
-                }
-        } else {
-                /* Negative dentry */
-                CDEBUG(D_FSDATA,"negative dentry %p: %*s\n", dentry, 
-                                dentry->d_name.len, dentry->d_name.name);
-        }
-
-        /* No pre-existing d_fsdata, we need to construct one.
-         * First, we must walk up the tree to find the fileset 
-         * If a fileset can't be found, we leave a null fsdata
-         * and return EROFS to indicate that we can't journal
-         * updates. 
-         */
-        fset = presto_try_find_fset (dentry, &is_under_d_izo);
-        if (!fset) { 
-#ifdef PRESTO_NO_NFS
-                CERROR("No fileset for dentry %p: %*s\n", dentry,
-                                dentry->d_name.len, dentry->d_name.name);
-#endif
-                error = -EROFS;
-                EXIT;
-                goto out_unlock;
-        }
-
-        dentry->d_fsdata = izo_alloc_ddata();
-        if (!presto_d2d(dentry)) {
-                CERROR ("InterMezzo: out of memory allocating d_fsdata\n");
-                error = -ENOMEM;
-                goto out_unlock;
-        }
-        presto_d2d(dentry)->dd_fset = fset;
-        if (is_under_d_izo)
-                presto_d2d(dentry)->dd_flags |= PRESTO_DONT_JOURNAL;
-        EXIT;
-
-out_unlock:    
-        CDEBUG(D_FSDATA,"presto_set_dd dentry %p: %*s, d_fsdata %p\n", 
-                        dentry, dentry->d_name.len, dentry->d_name.name, 
-                        dentry->d_fsdata);
-        unlock_kernel();
-        return error; 
-}
-
-int presto_init_ddata_cache(void)
-{
-        ENTRY;
-        presto_dentry_slab =
-                kmem_cache_create("presto_cache",
-                                  sizeof(struct presto_dentry_data), 0,
-                                  SLAB_HWCACHE_ALIGN, NULL,
-                                  NULL);
-        EXIT;
-        return (presto_dentry_slab != NULL);
-}
-
-void presto_cleanup_ddata_cache(void)
-{
-        kmem_cache_destroy(presto_dentry_slab);
-}
diff -Nru a/fs/intermezzo/dir.c b/fs/intermezzo/dir.c
--- a/fs/intermezzo/dir.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1333 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2000 Stelias Computing, Inc.
- *  Copyright (C) 2000 Red Hat, Inc.
- *  Copyright (C) 2000 Tacitus Systems
- *  Copyright (C) 2000 Peter J. Braam
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <asm/bitops.h>
-#include <asm/termios.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/namei.h>
-#include <linux/ext2_fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/string.h>
-#include <linux/blkdev.h>
-#include <linux/init.h>
-#include <linux/module.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-static inline void presto_relock_sem(struct inode *dir) 
-{
-        /* the lock from sys_mkdir / lookup_create */
-        down(&dir->i_sem);
-        /* the rest is done by the do_{create,mkdir, ...} */
-}
-
-static inline void presto_relock_other(struct inode *dir) 
-{
-        /* vfs_mkdir locks */
-        //        down(&dir->i_zombie);
-        //lock_kernel(); 
-}
-
-static inline void presto_fulllock(struct inode *dir) 
-{
-        /* the lock from sys_mkdir / lookup_create */
-        down(&dir->i_sem);
-        /* vfs_mkdir locks */
-        //        down(&dir->i_zombie);
-        //lock_kernel(); 
-}
-
-static inline void presto_unlock(struct inode *dir) 
-{
-        /* vfs_mkdir locks */
-        //unlock_kernel(); 
-        //        up(&dir->i_zombie);
-        /* the lock from sys_mkdir / lookup_create */
-        up(&dir->i_sem);
-}
-
-
-/*
- * these are initialized in super.c
- */
-extern int presto_permission(struct inode *inode, int mask, struct nameidata *nd);
-static int izo_authorized_uid;
-
-int izo_dentry_is_ilookup(struct dentry *dentry, ino_t *id,
-                          unsigned int *generation)
-{
-        char tmpname[64];
-        char *next;
-
-        ENTRY;
-        /* prefix is 7 characters: '...ino:' */
-        if ( dentry->d_name.len < 7 || dentry->d_name.len > 64 ||
-             memcmp(dentry->d_name.name, PRESTO_ILOOKUP_MAGIC, 7) != 0 ) {
-                EXIT;
-                return 0;
-        }
-
-        memcpy(tmpname, dentry->d_name.name + 7, dentry->d_name.len - 7);
-        *(tmpname + dentry->d_name.len - 7) = '\0';
-
-        /* name is of the form ...ino:<inode number>:<generation> */
-        *id = simple_strtoul(tmpname, &next, 16);
-        if ( *next == PRESTO_ILOOKUP_SEP ) {
-                *generation = simple_strtoul(next + 1, 0, 16);
-                CDEBUG(D_INODE, "ino string: %s, Id = %lx (%lu), "
-                       "generation %x (%d)\n",
-                       tmpname, *id, *id, *generation, *generation);
-                EXIT;
-                return 1;
-        } else {
-                EXIT;
-                return 0;
-        }
-}
-
-struct dentry *presto_tmpfs_ilookup(struct inode *dir, 
-                                    struct dentry *dentry,
-                                    ino_t ino, 
-                                    unsigned int generation)
-{
-        return dentry; 
-}
-
-
-inline int presto_can_ilookup(void)
-{
-        return (current->euid == izo_authorized_uid ||
-                capable(CAP_DAC_READ_SEARCH));
-}
-
-struct dentry *presto_iget_ilookup(struct inode *dir, 
-                                          struct dentry *dentry,
-                                          ino_t ino, 
-                                          unsigned int generation)
-{
-        struct inode *inode;
-        int error;
-
-        ENTRY;
-
-        if ( !presto_can_ilookup() ) {
-                CERROR("ilookup denied: euid %u, authorized_uid %u\n",
-                       current->euid, izo_authorized_uid);
-                return ERR_PTR(-EPERM);
-        }
-        error = -ENOENT;
-        inode = iget(dir->i_sb, ino);
-        if (!inode) { 
-                CERROR("fatal: NULL inode ino %lu\n", ino); 
-                goto cleanup_iput;
-        }
-        if (is_bad_inode(inode) || inode->i_nlink == 0) {
-                CERROR("fatal: bad inode ino %lu, links %d\n", ino, inode->i_nlink); 
-                goto cleanup_iput;
-        }
-        if (inode->i_generation != generation) {
-                CERROR("fatal: bad generation %u (want %u)\n",
-                       inode->i_generation, generation);
-                goto cleanup_iput;
-        }
-
-        d_instantiate(dentry, inode);
-        dentry->d_flags |= DCACHE_DISCONNECTED; /* NFS hack */
-
-        EXIT;
-        return NULL;
-
-cleanup_iput:
-        if (inode)
-                iput(inode);
-        return ERR_PTR(error);
-}
-
-struct dentry *presto_add_ilookup_dentry(struct dentry *parent,
-                                         struct dentry *real)
-{
-        struct inode *inode = real->d_inode;
-        struct dentry *de;
-        char buf[32];
-        char *ptr = buf;
-        struct dentry *inodir;
-        struct presto_dentry_data *dd;
-
-        inodir = lookup_one_len("..iopen..", parent,  strlen("..iopen..")); 
-        if (!inodir || IS_ERR(inodir) || !inodir->d_inode ) { 
-                CERROR("%s: bad ..iopen.. lookup\n", __FUNCTION__); 
-                return NULL; 
-        }
-        inodir->d_inode->i_op = &presto_dir_iops;
-
-        snprintf(ptr, 32, "...ino:%lx:%x", inode->i_ino, inode->i_generation);
-
-        de = lookup_one_len(ptr, inodir,  strlen(ptr)); 
-        if (!de || IS_ERR(de)) {
-                CERROR("%s: bad ...ino lookup %ld\n", 
-                       __FUNCTION__, PTR_ERR(de)); 
-                dput(inodir);
-                return NULL; 
-        }
-
-        dd = presto_d2d(real);
-        if (!dd) 
-                BUG();
-
-        /* already exists */
-        if (de->d_inode)
-                BUG();
-#if 0 
-                if (de->d_inode != inode ) { 
-                        CERROR("XX de->d_inode %ld, inode %ld\n", 
-                               de->d_inode->i_ino, inode->i_ino); 
-                        BUG();
-                }
-                if (dd->dd_inodentry) { 
-                        CERROR("inodentry exists %ld \n", inode->i_ino);
-                        BUG();
-                }
-                dput(inodir);
-                return de;
-        }
-#endif 
-
-        if (presto_d2d(de)) 
-                BUG();
-
-        atomic_inc(&inode->i_count);
-        de->d_op = &presto_dentry_ops;
-        d_add(de, inode);
-        if (!de->d_op)
-                CERROR("DD: no ops dentry %p, dd %p\n", de, dd);
-        dd->dd_inodentry = de;
-        dd->dd_count++;
-        de->d_fsdata = dd;
-
-        dput(inodir);
-        return de;
-}
-
-struct dentry *presto_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd)
-{
-        int rc = 0;
-        struct dentry *de;
-        struct presto_cache *cache;
-        int minor;
-        ino_t ino;
-        unsigned int generation;
-        struct inode_operations *iops;
-        int is_ilookup = 0;
-
-        ENTRY;
-        cache = presto_get_cache(dir);
-        if (cache == NULL) {
-                CERROR("InterMezzo BUG: no cache in presto_lookup "
-                       "(dir ino: %ld)!\n", dir->i_ino);
-                EXIT;
-                return NULL;
-        }
-        minor = presto_c2m(cache);
-
-        iops = filter_c2cdiops(cache->cache_filter);
-        if (!iops || !iops->lookup) {
-                CERROR("InterMezzo BUG: filesystem has no lookup\n");
-                EXIT;
-                return NULL;
-        }
-
-
-        CDEBUG(D_CACHE, "dentry %p, dir ino: %ld, name: %*s, islento: %d\n",
-               dentry, dir->i_ino, dentry->d_name.len, dentry->d_name.name,
-               ISLENTO(minor));
-
-        if (dentry->d_fsdata)
-                CERROR("DD -- BAD dentry %p has data\n", dentry);
-                       
-        dentry->d_fsdata = NULL;
-#if 0
-        if (ext2_check_for_iopen(dir, dentry))
-                de = NULL;
-        else {
-#endif
-                if ( izo_dentry_is_ilookup(dentry, &ino, &generation) ) { 
-                        de = cache->cache_filter->o_trops->tr_ilookup
-                                (dir, dentry, ino, generation);
-                        is_ilookup = 1;
-                } else
-                        de = iops->lookup(dir, dentry, nd);
-#if 0
-        }
-#endif
-
-        if ( IS_ERR(de) ) {
-                CERROR("dentry lookup error %ld\n", PTR_ERR(de));
-                return de;
-        }
-
-        /* some file systems have no read_inode: set methods here */
-        if (dentry->d_inode)
-                presto_set_ops(dentry->d_inode, cache->cache_filter);
-
-        filter_setup_dentry_ops(cache->cache_filter,
-                                dentry->d_op, &presto_dentry_ops);
-        dentry->d_op = filter_c2udops(cache->cache_filter);
-
-        /* In lookup we will tolerate EROFS return codes from presto_set_dd
-         * to placate NFS. EROFS indicates that a fileset was not found but
-         * we should still be able to continue through a lookup.
-         * Anything else is a hard error and must be returned to VFS. */
-        if (!is_ilookup)
-                rc = presto_set_dd(dentry);
-        if (rc && rc != -EROFS) {
-                CERROR("presto_set_dd failed (dir %ld, name %*s): %d\n",
-                       dir->i_ino, dentry->d_name.len, dentry->d_name.name, rc);
-                return ERR_PTR(rc);
-        }
-
-        EXIT;
-        return NULL;
-}
-
-static inline int presto_check_set_fsdata (struct dentry *de)
-{
-        if (presto_d2d(de) == NULL) {
-#ifdef PRESTO_NO_NFS
-                CERROR("dentry without fsdata: %p: %*s\n", de, 
-                                de->d_name.len, de->d_name.name);
-                BUG();
-#endif
-                return presto_set_dd (de);
-        }
-
-        return 0;
-}
-
-int presto_setattr(struct dentry *de, struct iattr *iattr)
-{
-        int error;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct lento_vfs_context info = { 0, {0}, 0 };
-
-        ENTRY;
-
-        error = presto_prep(de, &cache, &fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        if (!iattr->ia_valid)
-                CDEBUG(D_INODE, "presto_setattr: iattr is not valid\n");
-
-        CDEBUG(D_INODE, "valid %#x, mode %#o, uid %u, gid %u, size %Lu, "
-               "atime %lu mtime %lu ctime %lu flags %d\n",
-               iattr->ia_valid, iattr->ia_mode, iattr->ia_uid, iattr->ia_gid,
-               iattr->ia_size, iattr->ia_atime.tv_sec, iattr->ia_mtime.tv_sec,
-               iattr->ia_ctime.tv_sec, iattr->ia_attr_flags);
-        
-        if ( presto_get_permit(de->d_inode) < 0 ) {
-                EXIT;
-                return -EROFS;
-        }
-
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-        error = presto_do_setattr(fset, de, iattr, &info);
-        presto_put_permit(de->d_inode);
-        return error;
-}
-
-/*
- *  Now the meat: the fs operations that require journaling
- *
- *
- *  XXX: some of these need modifications for hierarchical filesets
- */
-
-int presto_prep(struct dentry *dentry, struct presto_cache **cache,
-                struct presto_file_set **fset)
-{       
-        int rc;
-
-        /* NFS might pass us dentries which have not gone through lookup.
-         * Test and set d_fsdata for such dentries
-         */
-        rc = presto_check_set_fsdata (dentry);
-        if (rc) return rc;
-
-        *fset = presto_fset(dentry);
-        if ( *fset == NULL ) {
-                CERROR("No file set for dentry at %p: %*s\n", dentry,
-                                dentry->d_name.len, dentry->d_name.name);
-                return -EROFS;
-        }
-
-        *cache = (*fset)->fset_cache;
-        if ( *cache == NULL ) {
-                CERROR("PRESTO: BAD, BAD: cannot find cache\n");
-                return -EBADF;
-        }
-
-        CDEBUG(D_PIOCTL, "---> cache flags %x, fset flags %x\n",
-              (*cache)->cache_flags, (*fset)->fset_flags);
-        if( presto_is_read_only(*fset) ) {
-                CERROR("PRESTO: cannot modify read-only fileset, minor %d.\n",
-                       presto_c2m(*cache));
-                return -EROFS;
-        }
-        return 0;
-}
-
-static int presto_create(struct inode * dir, struct dentry * dentry, int mode,
-                struct nameidata *nd)
-{
-        int error;
-        struct presto_cache *cache;
-        struct dentry *parent = dentry->d_parent;
-        struct lento_vfs_context info;
-        struct presto_file_set *fset;
-
-        ENTRY;
-        error = presto_check_set_fsdata(dentry);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_prep(dentry->d_parent, &cache, &fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-        presto_unlock(dir);
-
-        /* Does blocking and non-blocking behavious need to be 
-           checked for.  Without blocking (return 1), the permit
-           was acquired without reintegration
-        */
-        if ( presto_get_permit(dir) < 0 ) {
-                EXIT;
-                presto_fulllock(dir);
-                return -EROFS;
-        }
-
-        presto_relock_sem(dir);
-        parent = dentry->d_parent; 
-        memset(&info, 0, sizeof(info));
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-        error = presto_do_create(fset, parent, dentry, mode, &info);
-
-        presto_relock_other(dir);
-        presto_put_permit(dir);
-        EXIT;
-        return error;
-}
-
-static int presto_link(struct dentry *old_dentry, struct inode *dir,
-                struct dentry *new_dentry)
-{
-        int error;
-        struct presto_cache *cache, *new_cache;
-        struct presto_file_set *fset, *new_fset;
-        struct dentry *parent = new_dentry->d_parent;
-        struct lento_vfs_context info;
-
-        ENTRY;
-        error = presto_prep(old_dentry, &cache, &fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_check_set_fsdata(new_dentry);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_prep(new_dentry->d_parent, &new_cache, &new_fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        if (fset != new_fset) { 
-                EXIT;
-                return -EXDEV;
-        }
-
-        presto_unlock(dir);
-        if ( presto_get_permit(old_dentry->d_inode) < 0 ) {
-                EXIT;
-                presto_fulllock(dir);
-                return -EROFS;
-        }
-
-        if ( presto_get_permit(dir) < 0 ) {
-                EXIT;
-                presto_fulllock(dir);
-                return -EROFS;
-        }
-
-        presto_relock_sem(dir);
-        parent = new_dentry->d_parent;
-
-        memset(&info, 0, sizeof(info));
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-        error = presto_do_link(fset, old_dentry, parent,
-                               new_dentry, &info);
-
-#if 0
-        /* XXX for links this is not right */
-        if (cache->cache_filter->o_trops->tr_add_ilookup ) { 
-                struct dentry *d;
-                d = cache->cache_filter->o_trops->tr_add_ilookup
-                        (dir->i_sb->s_root, new_dentry, 1); 
-        }
-#endif 
-
-        presto_relock_other(dir);
-        presto_put_permit(dir);
-        presto_put_permit(old_dentry->d_inode);
-        return error;
-}
-
-static int presto_mkdir(struct inode * dir, struct dentry * dentry, int mode)
-{
-        int error;
-        struct presto_file_set *fset;
-        struct presto_cache *cache;
-        struct dentry *parent = dentry->d_parent;
-        struct lento_vfs_context info;
-
-        ENTRY;
-
-        error = presto_check_set_fsdata(dentry);
-        if ( error  ) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_prep(dentry->d_parent, &cache, &fset);
-        if ( error  ) {
-                EXIT;
-                return error;
-        }
-
-        presto_unlock(dir); 
-
-        if ( presto_get_permit(dir) < 0 ) {
-                EXIT;
-                presto_fulllock(dir);
-                return -EROFS;
-        }
-
-        memset(&info, 0, sizeof(info));
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-
-        presto_relock_sem(dir); 
-        parent = dentry->d_parent;
-        error = presto_do_mkdir(fset, parent, dentry, mode, &info);
-        presto_relock_other(dir); 
-        presto_put_permit(dir);
-        return error;
-}
-
-
-
-static int presto_symlink(struct inode *dir, struct dentry *dentry,
-                   const char *name)
-{
-        int error;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct dentry *parent = dentry->d_parent;
-        struct lento_vfs_context info;
-
-        ENTRY;
-        error = presto_check_set_fsdata(dentry);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_prep(dentry->d_parent, &cache, &fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        presto_unlock(dir);
-        if ( presto_get_permit(dir) < 0 ) {
-                EXIT;
-                presto_fulllock(dir);
-                return -EROFS;
-        }
-
-        presto_relock_sem(dir);
-        parent = dentry->d_parent;
-        memset(&info, 0, sizeof(info));
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-        error = presto_do_symlink(fset, parent, dentry, name, &info);
-        presto_relock_other(dir);
-        presto_put_permit(dir);
-        return error;
-}
-
-int presto_unlink(struct inode *dir, struct dentry *dentry)
-{
-        int error;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct dentry *parent = dentry->d_parent;
-        struct lento_vfs_context info;
-
-        ENTRY;
-        error = presto_check_set_fsdata(dentry);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_prep(dentry->d_parent, &cache, &fset);
-        if ( error  ) {
-                EXIT;
-                return error;
-        }
-
-        presto_unlock(dir);
-        if ( presto_get_permit(dir) < 0 ) {
-                EXIT;
-                presto_fulllock(dir);
-                return -EROFS;
-        }
-
-        presto_relock_sem(dir);
-        parent = dentry->d_parent;
-        memset(&info, 0, sizeof(info));
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-
-        error = presto_do_unlink(fset, parent, dentry, &info);
-
-        presto_relock_other(dir);
-        presto_put_permit(dir);
-        return error;
-}
-
-static int presto_rmdir(struct inode *dir, struct dentry *dentry)
-{
-        int error;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct dentry *parent = dentry->d_parent;
-        struct lento_vfs_context info;
-
-        ENTRY;
-        CDEBUG(D_FILE, "prepping presto\n");
-        error = presto_check_set_fsdata(dentry);
-
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_prep(dentry->d_parent, &cache, &fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        CDEBUG(D_FILE, "unlocking\n");
-        /* We need to dget() before the dput in double_unlock, to ensure we
-         * still have dentry references.  double_lock doesn't do dget for us.
-         */
-        if (d_unhashed(dentry))
-                d_rehash(dentry);
-        //        double_up(&dir->i_zombie, &dentry->d_inode->i_zombie);
-        up(&dentry->d_inode->i_sem);
-        up(&dir->i_sem);
-
-        CDEBUG(D_FILE, "getting permit\n");
-        if ( presto_get_permit(parent->d_inode) < 0 ) {
-                EXIT;
-                down(&dir->i_sem);
-                down(&dentry->d_inode->i_sem);
-                //                double_down(&dir->i_sem, &dentry->d_inode->i_sem);
-                //                double_down(&dir->i_zombie, &dentry->d_inode->i_zombie);
-                
-                lock_kernel();
-                return -EROFS;
-        }
-        CDEBUG(D_FILE, "locking\n");
-
-        down(&dir->i_sem);
-        down(&dentry->d_inode->i_sem);
-        parent = dentry->d_parent;
-        memset(&info, 0, sizeof(info));
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-        error = presto_do_rmdir(fset, parent, dentry, &info);
-        presto_put_permit(parent->d_inode);
-        lock_kernel();
-        EXIT;
-        return error;
-}
-
-static int presto_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t rdev)
-{
-        int error;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct dentry *parent = dentry->d_parent;
-        struct lento_vfs_context info;
-
-	if (!old_valid_dev(rdev))
-		return -EINVAL;
-
-        ENTRY;
-        error = presto_check_set_fsdata(dentry);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_prep(dentry->d_parent, &cache, &fset);
-        if ( error  ) {
-                EXIT;
-                return error;
-        }
-
-        presto_unlock(dir);
-        if ( presto_get_permit(dir) < 0 ) {
-                EXIT;
-                presto_fulllock(dir);
-                return -EROFS;
-        }
-        
-        presto_relock_sem(dir);
-        parent = dentry->d_parent;
-        memset(&info, 0, sizeof(info));
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-        error = presto_do_mknod(fset, parent, dentry, mode, rdev, &info);
-        presto_relock_other(dir);
-        presto_put_permit(dir);
-        EXIT;
-        return error;
-}
-
-
-
-// XXX this can be optimized: renamtes across filesets only require 
-//     multiple KML records, but can locally be executed normally. 
-int presto_rename(struct inode *old_dir, struct dentry *old_dentry,
-                  struct inode *new_dir, struct dentry *new_dentry)
-{
-        int error;
-        struct presto_cache *cache, *new_cache;
-        struct presto_file_set *fset, *new_fset;
-        struct lento_vfs_context info;
-        struct dentry *old_parent = old_dentry->d_parent;
-        struct dentry *new_parent = new_dentry->d_parent;
-        int triple;
-
-        ENTRY;
-        error = presto_prep(old_dentry, &cache, &fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-        error = presto_prep(new_parent, &new_cache, &new_fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        if ( fset != new_fset ) {
-                EXIT;
-                return -EXDEV;
-        }
-
-        /* We need to do dget before the dput in double_unlock, to ensure we
-         * still have dentry references.  double_lock doesn't do dget for us.
-         */
-
-        triple = (S_ISDIR(old_dentry->d_inode->i_mode) && new_dentry->d_inode)?
-                1:0;
-
-        unlock_rename(new_dentry->d_parent, old_dentry->d_parent);
-
-        if ( presto_get_permit(old_dir) < 0 ) {
-                EXIT;
-                return -EROFS;
-        }
-        if ( presto_get_permit(new_dir) < 0 ) {
-                EXIT;
-                return -EROFS;
-        }
-
-        lock_rename(new_dentry->d_parent, old_dentry->d_parent);
-        memset(&info, 0, sizeof(info));
-        if (!ISLENTO(presto_c2m(cache)))
-                info.flags = LENTO_FL_KML;
-        info.flags |= LENTO_FL_IGNORE_TIME;
-        error = do_rename(fset, old_parent, old_dentry, new_parent,
-                          new_dentry, &info);
-
-        presto_put_permit(new_dir);
-        presto_put_permit(old_dir);
-        return error;
-}
-
-/* basically this allows the ilookup processes access to all files for
- * reading, while not making ilookup totally insecure.  This could all
- * go away if we could set the CAP_DAC_READ_SEARCH capability for the client.
- */
-/* If posix acls are available, the underlying cache fs will export the
- * appropriate permission function. Thus we do not worry here about ACLs
- * or EAs. -SHP
- */
-int presto_permission(struct inode *inode, int mask, struct nameidata *nd)
-{
-        unsigned short mode = inode->i_mode;
-        struct presto_cache *cache;
-        int rc;
-
-        ENTRY;
-        if ( presto_can_ilookup() && !(mask & S_IWOTH)) {
-                CDEBUG(D_CACHE, "ilookup on %ld OK\n", inode->i_ino);
-                EXIT;
-                return 0;
-        }
-
-        cache = presto_get_cache(inode);
-
-        if ( cache ) {
-                /* we only override the file/dir permission operations */
-                struct inode_operations *fiops = filter_c2cfiops(cache->cache_filter);
-                struct inode_operations *diops = filter_c2cdiops(cache->cache_filter);
-
-                if ( S_ISREG(mode) && fiops && fiops->permission ) {
-                        EXIT;
-                        return fiops->permission(inode, mask, nd);
-                }
-                if ( S_ISDIR(mode) && diops && diops->permission ) {
-                        EXIT;
-                        return diops->permission(inode, mask, nd);
-                }
-        }
-
-        /* The cache filesystem doesn't have its own permission function,
-         * so we call the default one.
-         */
-        rc = vfs_permission(inode, mask);
-
-        EXIT;
-        return rc;
-}
-
-
-int presto_ioctl(struct inode *inode, struct file *file,
-                        unsigned int cmd, unsigned long arg)
-{
-        char buf[1024];
-        struct izo_ioctl_data *data = NULL;
-        struct presto_dentry_data *dd;
-        int rc;
-
-        ENTRY;
-
-        /* Try the filesystem's ioctl first, and return if it succeeded. */
-        dd = presto_d2d(file->f_dentry); 
-        if (dd && dd->dd_fset) { 
-                int (*cache_ioctl)(struct inode *, struct file *, unsigned int, unsigned long ) = filter_c2cdfops(dd->dd_fset->fset_cache->cache_filter)->ioctl;
-                rc = -ENOTTY;
-                if (cache_ioctl)
-                        rc = cache_ioctl(inode, file, cmd, arg);
-                if (rc != -ENOTTY) {
-                        EXIT;
-                        return rc;
-                }
-        }
-
-        if (current->euid != 0 && current->euid != izo_authorized_uid) {
-                EXIT;
-                return -EPERM;
-        }
-
-        memset(buf, 0, sizeof(buf));
-        
-        if (izo_ioctl_getdata(buf, buf + 1024, (void *)arg)) { 
-                CERROR("intermezzo ioctl: data error\n");
-                return -EINVAL;
-        }
-        data = (struct izo_ioctl_data *)buf;
-        
-        switch(cmd) {
-        case IZO_IOC_REINTKML: { 
-                int rc;
-                int cperr;
-                rc = kml_reint_rec(file, data);
-
-                EXIT;
-                cperr = copy_to_user((char *)arg, data, sizeof(*data));
-                if (cperr) { 
-                        CERROR("WARNING: cperr %d\n", cperr); 
-                        rc = -EFAULT;
-                }
-                return rc;
-        }
-
-        case IZO_IOC_GET_RCVD: {
-                struct izo_rcvd_rec rec;
-                struct presto_file_set *fset;
-                int rc;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                rc = izo_rcvd_get(&rec, fset, data->ioc_uuid);
-                if (rc < 0) {
-                        EXIT;
-                        return rc;
-                }
-
-                EXIT;
-                return copy_to_user((char *)arg, &rec, sizeof(rec))? -EFAULT : 0;
-        }
-
-        case IZO_IOC_REPSTATUS: {
-                __u64 client_kmlsize;
-                struct izo_rcvd_rec *lr_client;
-                struct izo_rcvd_rec rec;
-                struct presto_file_set *fset;
-                int minor;
-                int rc;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                minor = presto_f2m(fset);
-
-                client_kmlsize = data->ioc_kmlsize;
-                lr_client =  (struct izo_rcvd_rec *) data->ioc_pbuf1;
-
-                rc = izo_repstatus(fset, client_kmlsize, 
-                                       lr_client, &rec);
-                if (rc < 0) {
-                        EXIT;
-                        return rc;
-                }
-
-                EXIT;
-                return copy_to_user((char *)arg, &rec, sizeof(rec))? -EFAULT : 0;
-        }
-
-        case IZO_IOC_GET_CHANNEL: {
-                struct presto_file_set *fset;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                
-                data->ioc_dev = fset->fset_cache->cache_psdev->uc_minor;
-                CDEBUG(D_PSDEV, "CHANNEL %d\n", data->ioc_dev); 
-                EXIT;
-                return copy_to_user((char *)arg, data, sizeof(*data))? -EFAULT : 0;
-        }
-
-        case IZO_IOC_SET_IOCTL_UID:
-                izo_authorized_uid = data->ioc_uid;
-                EXIT;
-                return 0;
-
-        case IZO_IOC_SET_PID:
-                rc = izo_psdev_setpid(data->ioc_dev);
-                EXIT;
-                return rc;
-
-        case IZO_IOC_SET_CHANNEL:
-                rc = izo_psdev_setchannel(file, data->ioc_dev);
-                EXIT;
-                return rc;
-
-        case IZO_IOC_GET_KML_SIZE: {
-                struct presto_file_set *fset;
-                __u64 kmlsize;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-
-                kmlsize = presto_kml_offset(fset) + fset->fset_kml_logical_off;
-
-                EXIT;
-                return copy_to_user((char *)arg, &kmlsize, sizeof(kmlsize))?-EFAULT : 0;
-        }
-
-        case IZO_IOC_PURGE_FILE_DATA: {
-                struct presto_file_set *fset;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-
-                rc = izo_purge_file(fset, data->ioc_inlbuf1);
-                EXIT;
-                return rc;
-        }
-
-        case IZO_IOC_GET_FILEID: {
-                rc = izo_get_fileid(file, data);
-                EXIT;
-                if (rc)
-                        return rc;
-                return copy_to_user((char *)arg, data, sizeof(*data))? -EFAULT : 0;
-        }
-
-        case IZO_IOC_SET_FILEID: {
-                rc = izo_set_fileid(file, data);
-                EXIT;
-                if (rc)
-                        return rc;
-                return copy_to_user((char *)arg, data, sizeof(*data))? -EFAULT  : 0;
-        }
-
-        case IZO_IOC_ADJUST_LML: { 
-                struct lento_vfs_context *info; 
-                info = (struct lento_vfs_context *)data->ioc_inlbuf1;
-                rc = presto_adjust_lml(file, info); 
-                EXIT;
-                return rc;
-        }
-
-        case IZO_IOC_CONNECT: {
-                struct presto_file_set *fset;
-                int minor;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                minor = presto_f2m(fset);
-
-                rc = izo_upc_connect(minor, data->ioc_ino,
-                                     data->ioc_generation, data->ioc_uuid,
-                                     data->ioc_flags);
-                EXIT;
-                return rc;
-        }
-
-        case IZO_IOC_GO_FETCH_KML: {
-                struct presto_file_set *fset;
-                int minor;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                minor = presto_f2m(fset);
-
-                rc = izo_upc_go_fetch_kml(minor, fset->fset_name,
-                                          data->ioc_uuid, data->ioc_kmlsize);
-                EXIT;
-                return rc;
-        }
-
-        case IZO_IOC_REVOKE_PERMIT:
-                if (data->ioc_flags)
-                        rc = izo_revoke_permit(file->f_dentry, data->ioc_uuid);
-                else
-                        rc = izo_revoke_permit(file->f_dentry, NULL);
-                EXIT;
-                return rc;
-
-        case IZO_IOC_CLEAR_FSET:
-                rc = izo_clear_fsetroot(file->f_dentry);
-                EXIT;
-                return rc;
-
-        case IZO_IOC_CLEAR_ALL_FSETS: { 
-                struct presto_file_set *fset;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-
-                rc = izo_clear_all_fsetroots(fset->fset_cache);
-                EXIT;
-                return rc;
-        }
-
-        case IZO_IOC_SET_FSET:
-                /*
-                 * Mark this dentry as being a fileset root.
-                 */
-                rc = presto_set_fsetroot_from_ioc(file->f_dentry, 
-                                                  data->ioc_inlbuf1,
-                                                  data->ioc_flags);
-                EXIT;
-                return rc;
-
-
-        case IZO_IOC_MARK: {
-                int res = 0;  /* resulting flags - returned to user */
-                int error;
-
-                CDEBUG(D_DOWNCALL, "mark inode: %ld, and: %x, or: %x, what %d\n",
-                       file->f_dentry->d_inode->i_ino, data->ioc_and_flag,
-                       data->ioc_or_flag, data->ioc_mark_what);
-
-                switch (data->ioc_mark_what) {
-                case MARK_DENTRY:               
-                        error = izo_mark_dentry(file->f_dentry,
-                                                   data->ioc_and_flag,
-                                                   data->ioc_or_flag, &res);
-                        break;
-                case MARK_FSET:
-                        error = izo_mark_fset(file->f_dentry,
-                                                 data->ioc_and_flag,
-                                                 data->ioc_or_flag, &res);
-                        break;
-                case MARK_CACHE:
-                        error = izo_mark_cache(file->f_dentry,
-                                                  data->ioc_and_flag,
-                                                  data->ioc_or_flag, &res);
-                        break;
-                case MARK_GETFL: {
-                        int fflags, cflags;
-                        data->ioc_and_flag = 0xffffffff;
-                        data->ioc_or_flag = 0; 
-                        error = izo_mark_dentry(file->f_dentry,
-                                                   data->ioc_and_flag,
-                                                   data->ioc_or_flag, &res);
-                        if (error) 
-                                break;
-                        error = izo_mark_fset(file->f_dentry,
-                                                 data->ioc_and_flag,
-                                                 data->ioc_or_flag, &fflags);
-                        if (error) 
-                                break;
-                        error = izo_mark_cache(file->f_dentry,
-                                                  data->ioc_and_flag,
-                                                  data->ioc_or_flag,
-                                                  &cflags);
-
-                        if (error) 
-                                break;
-                        data->ioc_and_flag = fflags;
-                        data->ioc_or_flag = cflags;
-                        break;
-                }
-                default:
-                        error = -EINVAL;
-                }
-
-                if (error) { 
-                        EXIT;
-                        return error;
-                }
-                data->ioc_mark_what = res;
-                CDEBUG(D_DOWNCALL, "mark inode: %ld, and: %x, or: %x, what %x\n",
-                       file->f_dentry->d_inode->i_ino, data->ioc_and_flag,
-                       data->ioc_or_flag, data->ioc_mark_what);
-
-                EXIT;
-                return copy_to_user((char *)arg, data, sizeof(*data))? -EFAULT : 0;
-        }
-#if 0
-        case IZO_IOC_CLIENT_MAKE_BRANCH: {
-                struct presto_file_set *fset;
-                int minor;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                minor = presto_f2m(fset);
-
-                rc = izo_upc_client_make_branch(minor, fset->fset_name,
-                                                data->ioc_inlbuf1,
-                                                data->ioc_inlbuf2);
-                EXIT;
-                return rc;
-        }
-#endif
-        case IZO_IOC_SERVER_MAKE_BRANCH: {
-                struct presto_file_set *fset;
-                int minor;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                minor = presto_f2m(fset);
-
-                izo_upc_server_make_branch(minor, data->ioc_inlbuf1);
-                EXIT;
-                return 0;
-        }
-        case IZO_IOC_SET_KMLSIZE: {
-                struct presto_file_set *fset;
-                int minor;
-                struct izo_rcvd_rec rec;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                minor = presto_f2m(fset);
-
-                rc = izo_upc_set_kmlsize(minor, fset->fset_name, data->ioc_uuid,
-                                         data->ioc_kmlsize);
-
-                if (rc != 0) {
-                        EXIT;
-                        return rc;
-                }
-
-                rc = izo_rcvd_get(&rec, fset, data->ioc_uuid);
-                if (rc == -EINVAL) {
-                        /* We don't know anything about this uuid yet; no
-                         * worries. */
-                        memset(&rec, 0, sizeof(rec));
-                } else if (rc <= 0) {
-                        CERROR("InterMezzo: error reading last_rcvd: %d\n", rc);
-                        EXIT;
-                        return rc;
-                }
-                rec.lr_remote_offset = data->ioc_kmlsize;
-                rc = izo_rcvd_write(fset, &rec);
-                if (rc <= 0) {
-                        CERROR("InterMezzo: error writing last_rcvd: %d\n", rc);
-                        EXIT;
-                        return rc;
-                }
-                EXIT;
-                return rc;
-        }
-        case IZO_IOC_BRANCH_UNDO: {
-                struct presto_file_set *fset;
-                int minor;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                minor = presto_f2m(fset);
-
-                rc = izo_upc_branch_undo(minor, fset->fset_name,
-                                         data->ioc_inlbuf1);
-                EXIT;
-                return rc;
-        }
-        case IZO_IOC_BRANCH_REDO: {
-                struct presto_file_set *fset;
-                int minor;
-
-                fset = presto_fset(file->f_dentry);
-                if (fset == NULL) {
-                        EXIT;
-                        return -ENODEV;
-                }
-                minor = presto_f2m(fset);
-
-                rc = izo_upc_branch_redo(minor, fset->fset_name,
-                                         data->ioc_inlbuf1);
-                EXIT;
-                return rc;
-        }
-
-        default:
-                EXIT;
-                return -ENOTTY;
-                
-        }
-        EXIT;
-        return 0;
-}
-
-struct file_operations presto_dir_fops = {
-        .ioctl =  presto_ioctl
-};
-
-struct inode_operations presto_dir_iops = {
-        .create       = presto_create,
-        .lookup       = presto_lookup,
-        .link         = presto_link,
-        .unlink       = presto_unlink,
-        .symlink      = presto_symlink,
-        .mkdir        = presto_mkdir,
-        .rmdir        = presto_rmdir,
-        .mknod        = presto_mknod,
-        .rename       = presto_rename,
-        .permission   = presto_permission,
-        .setattr      = presto_setattr,
-#ifdef CONFIG_FS_EXT_ATTR
-        .set_ext_attr = presto_set_ext_attr,
-#endif
-};
-
-
diff -Nru a/fs/intermezzo/ext_attr.c b/fs/intermezzo/ext_attr.c
--- a/fs/intermezzo/ext_attr.c	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,197 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- * 
- *  Copyright (C) 2001 Tacit Networks, Inc.
- *    Author: Shirish H. Phatak <shirish@tacitnetworks.com>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Extended attribute handling for presto.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <asm/segment.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#ifdef CONFIG_FS_EXT_ATTR
-#include <linux/ext_attr.h>
-
-extern inline void presto_debug_fail_blkdev(struct presto_file_set *fset,
-                                            unsigned long value);
-
-
-/* VFS interface */
-/* XXX! Fixme test for user defined attributes */
-int presto_set_ext_attr(struct inode *inode, 
-                        const char *name, void *buffer,
-                        size_t buffer_len, int flags) 
-{
-        int error;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct lento_vfs_context info;
-        struct dentry *dentry;
-        int minor = presto_i2m(inode);
-        char *buf = NULL;
-
-        ENTRY;
-        if (minor < 0) {
-                EXIT;
-                return -1;
-        }
-
-        if ( ISLENTO(minor) ) {
-                EXIT;
-                return -EINVAL;
-        }
-
-        /* BAD...vfs should really pass down the dentry to use, especially
-         * since every other operation in iops does. But for now
-         * we do a reverse mapping from inode to the first dentry 
-         */
-        if (list_empty(&inode->i_dentry)) {
-                CERROR("No alias for inode %d\n", (int) inode->i_ino);
-                EXIT;
-                return -EINVAL;
-        }
-
-        dentry = list_entry(inode->i_dentry.next, struct dentry, d_alias);
-
-        error = presto_prep(dentry, &cache, &fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        if ((buffer != NULL) && (buffer_len != 0)) {
-            /* If buffer is a user space pointer copy it to kernel space
-            * and reset the flag. We do this since the journal functions need
-            * access to the contents of the buffer, and the file system
-            * does not care. When we actually invoke the function, we remove
-            * the EXT_ATTR_FLAG_USER flag.
-            *
-            * XXX:Check if the "fs does not care" assertion is always true -SHP
-            * (works for ext3)
-            */
-            if (flags & EXT_ATTR_FLAG_USER) {
-                PRESTO_ALLOC(buf, buffer_len);
-                if (!buf) {
-                        CERROR("InterMezzo: out of memory!!!\n");
-                        return -ENOMEM;
-                }
-                error = copy_from_user(buf, buffer, buffer_len);
-                if (error) 
-                        return -EFAULT;
-            } else 
-                buf = buffer;
-        } else
-                buf = buffer;
-
-        if ( presto_get_permit(inode) < 0 ) {
-                EXIT;
-                if (buffer_len && (flags & EXT_ATTR_FLAG_USER))
-                        PRESTO_FREE(buf, buffer_len);
-                return -EROFS;
-        }
-
-        /* Simulate presto_setup_info */
-        memset(&info, 0, sizeof(info));
-        /* For now redundant..but we keep it around just in case */
-        info.flags = LENTO_FL_IGNORE_TIME;
-        if (!ISLENTO(cache->cache_psdev->uc_minor))
-            info.flags |= LENTO_FL_KML;
-
-        /* We pass in the kernel space pointer and reset the 
-         * EXT_ATTR_FLAG_USER flag.
-         * See comments above. 
-         */ 
-        /* Note that mode is already set by VFS so we send in a NULL */
-        error = presto_do_set_ext_attr(fset, dentry, name, buf,
-                                       buffer_len, flags & ~EXT_ATTR_FLAG_USER,
-                                       NULL, &info);
-        presto_put_permit(inode);
-
-        if (buffer_len && (flags & EXT_ATTR_FLAG_USER))
-                PRESTO_FREE(buf, buffer_len);
-        EXIT;
-        return error;
-}
-
-/* Lento Interface */
-/* XXX: ignore flags? We should be forcing these operations through? -SHP*/
-int lento_set_ext_attr(const char *path, const char *name, 
-                       void *buffer, size_t buffer_len, int flags, mode_t mode, 
-                       struct lento_vfs_context *info) 
-{
-        int error;
-        char * pathname;
-        struct nameidata nd;
-        struct dentry *dentry;
-        struct presto_file_set *fset;
-
-        ENTRY;
-        lock_kernel();
-
-        pathname=getname(path);
-        error = PTR_ERR(pathname);
-        if (IS_ERR(pathname)) {
-                EXIT;
-                goto exit;
-        }
-
-        /* Note that ext_attrs apply to both files and directories..*/
-        error=presto_walk(pathname,&nd);
-        if (error) 
-		goto exit;
-        dentry = nd.dentry;
-
-        fset = presto_fset(dentry);
-        error = -EINVAL;
-        if ( !fset ) {
-                CERROR("No fileset!\n");
-                EXIT;
-                goto exit_dentry;
-        }
-
-        if (buffer==NULL) buffer_len=0;
-
-        error = presto_do_set_ext_attr(fset, dentry, name, buffer,
-                                       buffer_len, flags, &mode, info);
-exit_dentry:
-        path_release(&nd);
-exit_path:
-        putname(pathname);
-exit:
-        unlock_kernel();
-        return error; 
-}
-
-#endif /*CONFIG_FS_EXT_ATTR*/
diff -Nru a/fs/intermezzo/file.c b/fs/intermezzo/file.c
--- a/fs/intermezzo/file.c	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,534 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2000 Stelias Computing, Inc.
- *  Copyright (C) 2000 Red Hat, Inc.
- *  Copyright (C) 2000 TurboLinux, Inc.
- *  Copyright (C) 2000 Los Alamos National Laboratory.
- *  Copyright (C) 2000, 2001 Tacit Networks, Inc.
- *  Copyright (C) 2000 Peter J. Braam
- *  Copyright (C) 2001 Mountain View Data, Inc. 
- *  Copyright (C) 2001 Cluster File Systems, Inc. 
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  This file manages file I/O
- * 
- */
-
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/string.h>
-#include <linux/blkdev.h>
-#include <linux/init.h>
-#include <linux/module.h>
-
-#include <linux/fsfilter.h>
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-/*
- * these are initialized in super.c
- */
-extern int presto_permission(struct inode *inode, int mask, struct nameidata *nd);
-
-
-static int presto_open_upcall(int minor, struct dentry *de)
-{
-        int rc = 0;
-        char *path, *buffer;
-        struct presto_file_set *fset;
-        int pathlen;
-        struct lento_vfs_context info;
-        struct presto_dentry_data *dd = presto_d2d(de);
-
-        PRESTO_ALLOC(buffer, PAGE_SIZE);
-        if ( !buffer ) {
-                CERROR("PRESTO: out of memory!\n");
-                return -ENOMEM;
-        }
-        fset = presto_fset(de);
-        path = presto_path(de, fset->fset_dentry, buffer, PAGE_SIZE);
-        pathlen = MYPATHLEN(buffer, path);
-        
-        CDEBUG(D_FILE, "de %p, dd %p\n", de, dd);
-        if (dd->remote_ino == 0) {
-                rc = presto_get_fileid(minor, fset, de);
-        }
-        memset (&info, 0, sizeof(info));
-        if (dd->remote_ino > 0) {
-                info.remote_ino = dd->remote_ino;
-                info.remote_generation = dd->remote_generation;
-        } else
-                CERROR("get_fileid failed %d, ino: %Lx, fetching by name\n", rc,
-                       (unsigned long long) dd->remote_ino);
-
-        rc = izo_upc_open(minor, pathlen, path, fset->fset_name, &info);
-        PRESTO_FREE(buffer, PAGE_SIZE);
-        return rc;
-}
-
-static inline int open_check_dod(struct file *file,
-                                 struct presto_file_set *fset)
-{
-        int gen, is_iopen = 0, minor;
-        struct presto_cache *cache = fset->fset_cache;
-        ino_t inum;
-
-        minor = presto_c2m(cache);
-
-        if ( ISLENTO(minor) ) {
-                CDEBUG(D_CACHE, "is lento, not doing DOD.\n");
-                return 0;
-        }
-
-        /* Files are only ever opened by inode during backfetches, when by
-         * definition we have the authoritative copy of the data.  No DOD. */
-        is_iopen = izo_dentry_is_ilookup(file->f_dentry, &inum, &gen);
-
-        if (is_iopen) {
-                CDEBUG(D_CACHE, "doing iopen, not doing DOD.\n");
-                return 0;
-        }
-
-        if (!(fset->fset_flags & FSET_DATA_ON_DEMAND)) {
-                CDEBUG(D_CACHE, "fileset not on demand.\n");
-                return 0;
-        }
-                
-        if (file->f_flags & O_TRUNC) {
-                CDEBUG(D_CACHE, "fileset dod: O_TRUNC.\n");
-                return 0;
-        }
-                
-        if (presto_chk(file->f_dentry, PRESTO_DONT_JOURNAL)) {
-                CDEBUG(D_CACHE, "file under .intermezzo, not doing DOD\n");
-                return 0;
-        }
-
-        if (presto_chk(file->f_dentry, PRESTO_DATA)) {
-                CDEBUG(D_CACHE, "PRESTO_DATA is set, not doing DOD.\n");
-                return 0;
-        }
-
-        if (cache->cache_filter->o_trops->tr_all_data(file->f_dentry->d_inode)) {
-                CDEBUG(D_CACHE, "file not sparse, not doing DOD.\n");
-                return 0;
-        }
-
-        return 1;
-}
-
-static int presto_file_open(struct inode *inode, struct file *file)
-{
-        int rc = 0;
-        struct file_operations *fops;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct presto_file_data *fdata;
-        int writable = (file->f_flags & (O_RDWR | O_WRONLY));
-        int minor, i;
-
-        ENTRY;
-
-        if (presto_prep(file->f_dentry, &cache, &fset) < 0) {
-                EXIT;
-                return -EBADF;
-        }
-
-        minor = presto_c2m(cache);
-
-        CDEBUG(D_CACHE, "DATA_OK: %d, ino: %ld, islento: %d\n",
-               presto_chk(file->f_dentry, PRESTO_DATA), inode->i_ino,
-               ISLENTO(minor));
-
-        if ( !ISLENTO(minor) && (file->f_flags & O_RDWR ||
-                                 file->f_flags & O_WRONLY)) {
-                CDEBUG(D_CACHE, "calling presto_get_permit\n");
-                if ( presto_get_permit(inode) < 0 ) {
-                        EXIT;
-                        return -EROFS;
-                }
-                presto_put_permit(inode);
-        }
-
-        if (open_check_dod(file, fset)) {
-                CDEBUG(D_CACHE, "presto_open_upcall\n");
-                CDEBUG(D_CACHE, "dentry: %p setting DATA, ATTR\n", file->f_dentry);
-                presto_set(file->f_dentry, PRESTO_ATTR | PRESTO_DATA);
-                rc = presto_open_upcall(minor, file->f_dentry);
-                if (rc) {
-                        EXIT;
-                        CERROR("%s: returning error %d\n", __FUNCTION__, rc);
-                        return rc;
-                }
-
-        }
-
-        /* file was truncated upon open: do not refetch */
-        if (file->f_flags & O_TRUNC) { 
-                CDEBUG(D_CACHE, "setting DATA, ATTR\n");
-                presto_set(file->f_dentry, PRESTO_ATTR | PRESTO_DATA);
-        }
-
-        fops = filter_c2cffops(cache->cache_filter);
-        if ( fops->open ) {
-                CDEBUG(D_CACHE, "calling fs open\n");
-                rc = fops->open(inode, file);
-
-                if (rc) {
-                        EXIT;
-                        return rc;
-                }
-        }
-
-        if (writable) {
-                PRESTO_ALLOC(fdata, sizeof(*fdata));
-                if (!fdata) {
-                        EXIT;
-                        return -ENOMEM;
-                }
-                /* LOCK: XXX check that the kernel lock protects this alloc */
-                fdata->fd_do_lml = 0;
-                fdata->fd_bytes_written = 0;
-                fdata->fd_fsuid = current->fsuid;
-                fdata->fd_fsgid = current->fsgid;
-                fdata->fd_mode = file->f_dentry->d_inode->i_mode;
-                fdata->fd_uid = file->f_dentry->d_inode->i_uid;
-                fdata->fd_gid = file->f_dentry->d_inode->i_gid;
-                fdata->fd_ngroups = current->group_info->ngroups;
-                for (i=0 ; i < current->group_info->ngroups ; i++)
-                        fdata->fd_groups[i] = GROUP_AT(current->group_info,i);
-                if (!ISLENTO(minor)) 
-                        fdata->fd_info.flags = LENTO_FL_KML; 
-                else { 
-                        /* this is for the case of DOD, 
-                           reint_close will adjust flags if needed */
-                        fdata->fd_info.flags = 0;
-                }
-
-                presto_getversion(&fdata->fd_version, inode);
-                file->private_data = fdata;
-        } else {
-                file->private_data = NULL;
-        }
-
-        EXIT;
-        return 0;
-}
-
-int presto_adjust_lml(struct file *file, struct lento_vfs_context *info)
-{
-        struct presto_file_data *fdata = 
-                (struct presto_file_data *) file->private_data;
-
-        if (!fdata) { 
-                EXIT;
-                return -EINVAL;
-        }
-                
-        memcpy(&fdata->fd_info, info, sizeof(*info));
-        EXIT;
-        return 0; 
-}
-
-
-static int presto_file_release(struct inode *inode, struct file *file)
-{
-        int rc;
-        struct file_operations *fops;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct presto_file_data *fdata = 
-                (struct presto_file_data *)file->private_data;
-        ENTRY;
-
-        rc = presto_prep(file->f_dentry, &cache, &fset);
-        if ( rc ) {
-                EXIT;
-                return rc;
-        }
-
-        fops = filter_c2cffops(cache->cache_filter);
-        if (fops && fops->release)
-                rc = fops->release(inode, file);
-
-        CDEBUG(D_CACHE, "islento = %d (minor %d), rc %d, data %p\n",
-               ISLENTO(cache->cache_psdev->uc_minor), 
-               cache->cache_psdev->uc_minor, rc, fdata);
-
-        /* this file was modified: ignore close errors, write KML */
-        if (fdata && fdata->fd_do_lml) {
-                /* XXX: remove when lento gets file granularity cd */
-                if ( presto_get_permit(inode) < 0 ) {
-                        EXIT;
-                        return -EROFS;
-                }
-        
-                fdata->fd_info.updated_time = file->f_dentry->d_inode->i_mtime;
-                rc = presto_do_close(fset, file); 
-                presto_put_permit(inode);
-        }
-
-        if (!rc && fdata) {
-                PRESTO_FREE(fdata, sizeof(*fdata));
-                file->private_data = NULL; 
-        }
-        
-        EXIT;
-        return rc;
-}
-
-static void presto_apply_write_policy(struct file *file,
-                                      struct presto_file_set *fset, loff_t res)
-{
-        struct presto_file_data *fdata =
-                (struct presto_file_data *)file->private_data;
-        struct presto_cache *cache = fset->fset_cache;
-        struct presto_version new_file_ver;
-        int error;
-        struct rec_info rec;
-
-        /* Here we do a journal close after a fixed or a specified
-         amount of KBytes, currently a global parameter set with
-         sysctl. If files are open for a long time, this gives added
-         protection. (XXX todo: per cache, add ioctl, handle
-         journaling in a thread, add more options etc.)
-        */ 
- 
-        if ((fset->fset_flags & FSET_JCLOSE_ON_WRITE) &&
-            (!ISLENTO(cache->cache_psdev->uc_minor))) {
-                fdata->fd_bytes_written += res;
- 
-                if (fdata->fd_bytes_written >= fset->fset_file_maxio) {
-                        presto_getversion(&new_file_ver,
-                                          file->f_dentry->d_inode);
-                        /* This is really heavy weight and should be fixed
-                           ASAP. At most we should be recording the number
-                           of bytes written and not locking the kernel, 
-                           wait for permits, etc, on the write path. SHP
-                        */
-                        lock_kernel();
-                        if ( presto_get_permit(file->f_dentry->d_inode) < 0 ) {
-                                EXIT;
-                                /* we must be disconnected, not to worry */
-                                unlock_kernel();
-                                return; 
-                        }
-                        error = presto_journal_close(&rec, fset, fdata,
-                                                     file->f_dentry,
-                                                     &fdata->fd_version,
-                                                     &new_file_ver);
-                        presto_put_permit(file->f_dentry->d_inode);
-                        unlock_kernel();
-                        if ( error ) {
-                                CERROR("presto_close: cannot journal close\n");
-                                /* XXX these errors are really bad */
-                                /* panic(); */
-                                return;
-                        }
-                        fdata->fd_bytes_written = 0;
-                }
-        }
-}
-
-static ssize_t presto_file_write(struct file *file, const char *buf,
-                                 size_t size, loff_t *off)
-{
-        struct rec_info rec;
-        int error;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct file_operations *fops;
-        ssize_t res;
-        int do_lml_here;
-        void *handle = NULL;
-        unsigned long blocks;
-        struct presto_file_data *fdata;
-        loff_t res_size; 
-
-        error = presto_prep(file->f_dentry, &cache, &fset);
-        if ( error ) {
-                EXIT;
-                return error;
-        }
-
-        blocks = (size >> file->f_dentry->d_inode->i_sb->s_blocksize_bits) + 1;
-        /* XXX 3 is for ext2 indirect blocks ... */ 
-        res_size = 2 * PRESTO_REQHIGH + ((blocks+3) 
-                << file->f_dentry->d_inode->i_sb->s_blocksize_bits);
-
-        error = presto_reserve_space(fset->fset_cache, res_size); 
-        CDEBUG(D_INODE, "Reserved %Ld for %Zd\n", res_size, size);
-        if ( error ) { 
-                EXIT;
-                return -ENOSPC;
-        }
-
-        CDEBUG(D_INODE, "islento %d, minor: %d\n", 
-               ISLENTO(cache->cache_psdev->uc_minor),
-               cache->cache_psdev->uc_minor); 
-
-        /* 
-         *  XXX this lock should become a per inode lock when 
-         *  Vinny's changes are in; we could just use i_sem.
-         */
-        read_lock(&fset->fset_lml.fd_lock); 
-        fdata = (struct presto_file_data *)file->private_data;
-        do_lml_here = size && (fdata->fd_do_lml == 0) &&
-                !presto_chk(file->f_dentry, PRESTO_DONT_JOURNAL);
-
-        if (do_lml_here)
-                fdata->fd_do_lml = 1;
-        read_unlock(&fset->fset_lml.fd_lock); 
-
-        /* XXX 
-           There might be a bug here.  We need to make 
-           absolutely sure that the ext3_file_write commits 
-           after our transaction that writes the LML record.
-           Nesting the file write helps if new blocks are allocated. 
-        */
-        res = 0;
-        if (do_lml_here) {
-                struct presto_version file_version;
-                /* handle different space reqs from file system below! */
-                handle = presto_trans_start(fset, file->f_dentry->d_inode, 
-                                            KML_OPCODE_WRITE);
-                if ( IS_ERR(handle) ) {
-                        presto_release_space(fset->fset_cache, res_size); 
-                        CERROR("presto_write: no space for transaction\n");
-                        return -ENOSPC;
-                }
-
-                presto_getversion(&file_version, file->f_dentry->d_inode); 
-                res = presto_write_lml_close(&rec, fset, file, 
-                                             fdata->fd_info.remote_ino, 
-                                             fdata->fd_info.remote_generation, 
-                                             &fdata->fd_info.remote_version, 
-                                             &file_version);
-                fdata->fd_lml_offset = rec.offset;
-                if ( res ) {
-                        CERROR("intermezzo: PANIC failed to write LML\n");
-                        *(int *)0 = 1;
-                        EXIT;
-                        goto exit_write;
-                }
-                presto_trans_commit(fset, handle);
-        }
-
-        fops = filter_c2cffops(cache->cache_filter);
-        res = fops->write(file, buf, size, off);
-        if ( res != size ) {
-                CDEBUG(D_FILE, "file write returns short write: size %Zd, res %Zd\n", size, res); 
-        }
-
-        if ( (res > 0) && fdata ) 
-                 presto_apply_write_policy(file, fset, res);
-
- exit_write:
-        presto_release_space(fset->fset_cache, res_size); 
-        return res;
-}
-
-struct file_operations presto_file_fops = {
-        .write   = presto_file_write,
-        .open    = presto_file_open,
-        .release = presto_file_release,
-        .ioctl   = presto_ioctl
-};
-
-struct inode_operations presto_file_iops = {
-        .permission   = presto_permission,
-        .setattr      = presto_setattr,
-#ifdef CONFIG_FS_EXT_ATTR
-        .set_ext_attr = presto_set_ext_attr,
-#endif
-};
-
-/* FIXME: I bet we want to add a lock here and in presto_file_open. */
-int izo_purge_file(struct presto_file_set *fset, char *file)
-{
-#if 0
-        void *handle = NULL;
-        char *path = NULL;
-        struct nameidata nd;
-        struct dentry *dentry;
-        int rc = 0, len;
-        loff_t oldsize;
-
-        /* FIXME: not mtpt it's gone */
-        len = strlen(fset->fset_cache->cache_mtpt) + strlen(file) + 1;
-        PRESTO_ALLOC(path, len + 1);
-        if (path == NULL)
-                return -1;
-
-        sprintf(path, "%s/%s", fset->fset_cache->cache_mtpt, file);
-        rc = izo_lookup_file(fset, path, &nd);
-        if (rc)
-                goto error;
-        dentry = nd.dentry;
-
-        /* FIXME: take a lock here */
-
-        if (dentry->d_inode->i_atime.tv_sec > get_seconds() - 5) {
-                /* We lost the race; this file was accessed while we were doing
-                 * ioctls and lookups and whatnot. */
-                rc = -EBUSY;
-                goto error_unlock;
-        }
-
-        /* FIXME: Check if this file is open. */
-
-        handle = presto_trans_start(fset, dentry->d_inode, KML_OPCODE_TRUNC);
-        if (IS_ERR(handle)) {
-                rc = -ENOMEM;
-                goto error_unlock;
-        }
-
-        /* FIXME: Write LML record */
-
-        oldsize = dentry->d_inode->i_size;
-        rc = izo_do_truncate(fset, dentry, 0, oldsize);
-        if (rc != 0)
-                goto error_clear;
-        rc = izo_do_truncate(fset, dentry, oldsize, 0);
-        if (rc != 0)
-                goto error_clear;
-
- error_clear:
-        /* FIXME: clear LML record */
-
- error_unlock:
-        /* FIXME: release the lock here */
-
- error:
-        if (handle != NULL && !IS_ERR(handle))
-                presto_trans_commit(fset, handle);
-        if (path != NULL)
-                PRESTO_FREE(path, len + 1);
-        return rc;
-#else
-        return 0;
-#endif
-}
diff -Nru a/fs/intermezzo/fileset.c b/fs/intermezzo/fileset.c
--- a/fs/intermezzo/fileset.c	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,674 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  Managing filesets
- *
- */
-
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/namei.h>
-#include <linux/ext2_fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/string.h>
-#include <linux/blkdev.h>
-#include <linux/init.h>
-#include <linux/module.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-static inline struct presto_file_set *presto_dentry2fset(struct dentry *dentry)
-{
-        if (presto_d2d(dentry) == NULL) {
-                EXIT;
-                return NULL;
-        }
-        return presto_d2d(dentry)->dd_fset;
-}
-
-/* find the fileset dentry for this dentry */
-struct presto_file_set *presto_fset(struct dentry *de)
-{
-        struct dentry *fsde;
-        ENTRY;
-        if ( !de->d_inode ) {
-                /* FIXME: is this ok to be NULL? */
-                CDEBUG(D_INODE,"presto_fset: warning %*s has NULL inode.\n",
-                de->d_name.len, de->d_name.name);
-        }
-        for (fsde = de;; fsde = fsde->d_parent) {
-                if ( presto_dentry2fset(fsde) ) {
-                        EXIT;
-                        return presto_dentry2fset(fsde);
-                }
-                if (fsde->d_parent == fsde)
-                        break;
-        }
-        EXIT;
-        return NULL;
-}
-
-int presto_get_lastrecno(char *path, off_t *recno)
-{
-        struct nameidata nd; 
-        struct presto_file_set *fset;
-        struct dentry *dentry;
-        int error;
-        ENTRY;
-
-        error = presto_walk(path, &nd);
-        if (error) {
-                EXIT;
-                return error;
-        }
-
-        dentry = nd.dentry;
-
-        error = -ENXIO;
-        if ( !presto_ispresto(dentry->d_inode) ) {
-                EXIT;
-                goto kml_out;
-        }
-
-        error = -EINVAL;
-        if ( ! presto_dentry2fset(dentry)) {
-                EXIT;
-                goto kml_out;
-        }
-
-        fset = presto_dentry2fset(dentry);
-        if (!fset) {
-                EXIT;
-                goto kml_out;
-        }
-        error = 0;
-        *recno = fset->fset_kml.fd_recno;
-
- kml_out:
-        path_release(&nd);
-        return error;
-}
-
-static char * _izo_make_path(char *fsetname, char *name)
-{
-        char *path = NULL;
-        int len;
-
-        len = strlen("/.intermezzo/") + strlen(fsetname) 
-                + 1 + strlen(name) + 1;
-
-        PRESTO_ALLOC(path, len);
-        if (path == NULL)
-                return NULL;
-
-        sprintf(path, "/.intermezzo/%s/%s", fsetname, name);
-
-        return path;
-}
-
-char * izo_make_path(struct presto_file_set *fset, char *name)
-{
-        return _izo_make_path(fset->fset_name, name);
-}
-
-static struct file *_izo_fset_open(char *fsetname, char *name, int flags, int mode) 
-{
-        char *path;
-        struct file *f;
-        int error;
-        ENTRY;
-
-        path = _izo_make_path(fsetname, name);
-        if (path == NULL) {
-                EXIT;
-                return ERR_PTR(-ENOMEM);
-        }
-
-        CDEBUG(D_INODE, "opening file %s\n", path);
-        f = filp_open(path, flags, mode);
-        error = PTR_ERR(f);
-        if (IS_ERR(f)) {
-                CDEBUG(D_INODE, "Error %d\n", error);
-        }
-
-        PRESTO_FREE(path, strlen(path));
-
-        EXIT;
-        return f;
-
-}
-
-struct file *izo_fset_open(struct presto_file_set *fset, char *name, int flags, int mode) 
-{
-        return _izo_fset_open(fset->fset_name, name, flags, mode);
-}
-
-
-
-/*
- *  note: this routine "pins" a dentry for a fileset root
- */
-int presto_set_fsetroot(struct dentry *ioctl_dentry, char *fsetname,
-                        unsigned int flags)
-{
-        struct presto_file_set *fset = NULL;
-        struct presto_cache *cache;
-        int error;
-        struct file  *fset_root;
-        struct dentry *dentry;
-
-        ENTRY;
-
-        fset_root = _izo_fset_open(fsetname, "ROOT",  O_RDONLY, 000);
-        if (IS_ERR(fset_root)) {
-                CERROR("Can't open %s/ROOT\n", fsetname);
-                EXIT;
-                error = PTR_ERR(fset_root);
-                goto out;
-        }
-        dentry = dget(fset_root->f_dentry);
-        filp_close(fset_root, NULL);
-
-        dentry->d_inode->i_op = ioctl_dentry->d_inode->i_op;
-        dentry->d_inode->i_fop = ioctl_dentry->d_inode->i_fop;
-        dentry->d_op = ioctl_dentry->d_op;
-        fset = presto_dentry2fset(dentry);
-        if (fset && (fset->fset_dentry == dentry) ) { 
-                CERROR("Fsetroot already set (inode %ld)\n",
-                       dentry->d_inode->i_ino);
-                /* XXX: ignore because clear_fsetroot is broken  */
-#if 0
-                dput(dentry);
-                EXIT;
-                error = -EEXIST;
-                goto out;
-#endif
-        }
-
-        cache = presto_get_cache(dentry->d_inode);
-        if (!cache) { 
-                CERROR("No cache found for inode %ld\n",
-                       dentry->d_inode->i_ino);
-                EXIT;
-                error = -ENODEV;
-                goto out_free;
-        }
-
-        PRESTO_ALLOC(fset, sizeof(*fset));
-        if ( !fset ) {
-                CERROR("No memory allocating fset for %s\n", fsetname);
-                EXIT;
-                error = -ENOMEM;
-                goto out_free;
-        }
-        CDEBUG(D_INODE, "fset at %p\n", fset);
-
-        CDEBUG(D_INODE, "InterMezzo: fsetroot: inode %ld, fileset name %s\n",
-               dentry->d_inode->i_ino, fsetname);
-
-        fset->fset_mnt = mntget(current->fs->pwdmnt); 
-        fset->fset_cache = cache;
-        fset->fset_dentry = dentry; 
-        fset->fset_name = strdup(fsetname);
-        fset->fset_chunkbits = CHUNK_BITS;
-        fset->fset_flags = flags;
-        fset->fset_file_maxio = FSET_DEFAULT_MAX_FILEIO; 
-        fset->fset_permit_lock = SPIN_LOCK_UNLOCKED;
-        PRESTO_ALLOC(fset->fset_reint_buf, 64 * 1024);
-        if (fset->fset_reint_buf == NULL) {
-                EXIT;
-                error = -ENOMEM;
-                goto out_free;
-        }
-        init_waitqueue_head(&fset->fset_permit_queue);
-
-        if (presto_d2d(dentry) == NULL) { 
-                dentry->d_fsdata = izo_alloc_ddata();
-        }
-        if (presto_d2d(dentry) == NULL) {
-                CERROR("InterMezzo: %s: no memory\n", __FUNCTION__);
-                EXIT;
-                error = -ENOMEM;
-                goto out_free;
-        }
-        presto_d2d(dentry)->dd_fset = fset;
-        list_add(&fset->fset_list, &cache->cache_fset_list);
-
-        error = izo_init_kml_file(fset, &fset->fset_kml);
-        if ( error ) {
-                EXIT;
-                CDEBUG(D_JOURNAL, "Error init_kml %d\n", error);
-                goto out_list_del;
-        }
-
-        error = izo_init_lml_file(fset, &fset->fset_lml);
-        if ( error ) {
-                int rc;
-                EXIT;
-                rc = izo_log_close(&fset->fset_kml);
-                CDEBUG(D_JOURNAL, "Error init_lml %d, cleanup %d\n", error, rc);
-                goto out_list_del;
-        }
-
-        /* init_last_rcvd_file could trigger a presto_file_write(), which
-         * requires that the lml structure be initialized. -phil */
-        error = izo_init_last_rcvd_file(fset, &fset->fset_rcvd);
-        if ( error ) {
-                int rc;
-                EXIT;
-                rc = izo_log_close(&fset->fset_kml);
-                rc = izo_log_close(&fset->fset_lml);
-                CDEBUG(D_JOURNAL, "Error init_lastrcvd %d, cleanup %d\n", error, rc);
-                goto out_list_del;
-        }
-
-        CDEBUG(D_PIOCTL, "-------> fset at %p, dentry at %p, mtpt %p,"
-               "fset %s, cache %p, presto_d2d(dentry)->dd_fset %p\n",
-               fset, dentry, fset->fset_dentry, fset->fset_name, cache,
-               presto_d2d(dentry)->dd_fset);
-
-        EXIT;
-        return 0;
-
- out_list_del:
-        list_del(&fset->fset_list);
-        presto_d2d(dentry)->dd_fset = NULL;
- out_free:
-        if (fset) {
-                mntput(fset->fset_mnt); 
-                if (fset->fset_reint_buf != NULL)
-                        PRESTO_FREE(fset->fset_reint_buf, 64 * 1024);
-                PRESTO_FREE(fset, sizeof(*fset));
-        }
-        dput(dentry); 
- out:
-        return error;
-}
-
-static int izo_cleanup_fset(struct presto_file_set *fset)
-{
-        int error;
-        struct presto_cache *cache;
-
-        ENTRY;
-
-        CERROR("Cleaning up fset %s\n", fset->fset_name);
-
-        error = izo_log_close(&fset->fset_kml);
-        if (error)
-                CERROR("InterMezzo: Closing kml for fset %s: %d\n",
-                       fset->fset_name, error);
-        error = izo_log_close(&fset->fset_lml);
-        if (error)
-                CERROR("InterMezzo: Closing lml for fset %s: %d\n",
-                       fset->fset_name, error);
-        error = izo_log_close(&fset->fset_rcvd);
-        if (error)
-                CERROR("InterMezzo: Closing last_rcvd for fset %s: %d\n",
-                       fset->fset_name, error);
-
-        cache = fset->fset_cache;
-
-        list_del(&fset->fset_list);
-
-        presto_d2d(fset->fset_dentry)->dd_fset = NULL;
-        dput(fset->fset_dentry);
-        mntput(fset->fset_mnt);
-
-        PRESTO_FREE(fset->fset_name, strlen(fset->fset_name) + 1);
-        PRESTO_FREE(fset->fset_reint_buf, 64 * 1024);
-        PRESTO_FREE(fset, sizeof(*fset));
-        EXIT;
-        return error;
-}
-
-int izo_clear_fsetroot(struct dentry *dentry)
-{
-        struct presto_file_set *fset;
-
-        ENTRY;
-
-        fset = presto_dentry2fset(dentry);
-        if (!fset) {
-                EXIT;
-                return -EINVAL;
-        }
-
-        izo_cleanup_fset(fset);
-        EXIT;
-        return 0;
-}
-
-int izo_clear_all_fsetroots(struct presto_cache *cache)
-{
-        struct presto_file_set *fset;
-        struct list_head *tmp,*tmpnext;
-        int error;
- 
-        error = 0;
-        tmp = &cache->cache_fset_list;
-        tmpnext = tmp->next;
-        while ( tmpnext != &cache->cache_fset_list) {
-                tmp = tmpnext;
-                tmpnext = tmp->next;
-                fset = list_entry(tmp, struct presto_file_set, fset_list);
-
-                error = izo_cleanup_fset(fset);
-                if (error)
-                        break;
-        }
-        return error;
-}
-
-static struct vfsmount *izo_alloc_vfsmnt(void)
-{
-        struct vfsmount *mnt;
-        PRESTO_ALLOC(mnt, sizeof(*mnt));
-        if (mnt) {
-                memset(mnt, 0, sizeof(struct vfsmount));
-                atomic_set(&mnt->mnt_count,1);
-                INIT_LIST_HEAD(&mnt->mnt_hash);
-                INIT_LIST_HEAD(&mnt->mnt_child);
-                INIT_LIST_HEAD(&mnt->mnt_mounts);
-                INIT_LIST_HEAD(&mnt->mnt_list);
-        }
-        return mnt;
-}
-
-
-static void izo_setup_ctxt(struct dentry *root, struct vfsmount *mnt,
-                           struct run_ctxt *save) 
-{
-        struct run_ctxt new;
-
-        mnt->mnt_root = root;
-        mnt->mnt_sb = root->d_inode->i_sb;
-        unlock_super(mnt->mnt_sb);
-
-        new.rootmnt = mnt;
-        new.root = root;
-        new.pwdmnt = mnt;
-        new.pwd = root;
-        new.fsuid = 0;
-        new.fsgid = 0;
-        new.fs = get_fs(); 
-        /* XXX where can we get the groups from? */
-        new.group_info = groups_alloc(0);
-
-        push_ctxt(save, &new); 
-}
-
-static void izo_cleanup_ctxt(struct vfsmount *mnt, struct run_ctxt *save) 
-{
-        lock_super(mnt->mnt_sb);
-        pop_ctxt(save); 
-}
-
-static int izo_simple_mkdir(struct dentry *dir, char *name, int mode)
-{
-        struct dentry *dchild; 
-        int err;
-        ENTRY;
-        
-        dchild = lookup_one_len(name, dir, strlen(name));
-        if (IS_ERR(dchild)) { 
-                EXIT;
-                return PTR_ERR(dchild); 
-        }
-
-        if (dchild->d_inode) { 
-                dput(dchild);
-                EXIT;
-                return -EEXIST;
-        }
-
-        err = vfs_mkdir(dir->d_inode, dchild, mode);
-        dput(dchild);
-        
-        EXIT;
-        return err;
-}
-
-static int izo_simple_symlink(struct dentry *dir, char *name, char *tgt)
-{
-        struct dentry *dchild; 
-        int err;
-        ENTRY;
-        
-        dchild = lookup_one_len(name, dir, strlen(name));
-        if (IS_ERR(dchild)) { 
-                EXIT;
-                return PTR_ERR(dchild); 
-        }
-
-        if (dchild->d_inode) { 
-                dput(dchild);
-                EXIT;
-                return -EEXIST;
-        }
-
-        err = vfs_symlink(dir->d_inode, dchild, tgt);
-        dput(dchild);
-        
-        EXIT;
-        return err;
-}
-
-/*
- * run set_fsetroot in chroot environment
- */
-int presto_set_fsetroot_from_ioc(struct dentry *root, char *fsetname,
-                                 unsigned int flags)
-{
-        int rc;
-        struct presto_cache *cache;
-        struct vfsmount *mnt;
-        struct run_ctxt save;
-
-        if (root != root->d_inode->i_sb->s_root) {
-                CERROR ("IOC_SET_FSET must be called on mount point\n");
-                return -ENODEV;
-        }
-
-        cache = presto_get_cache(root->d_inode);
-        mnt = cache->cache_vfsmount;
-        if (!mnt) { 
-                EXIT;
-                return -ENOMEM;
-        }
-        
-        izo_setup_ctxt(root, mnt, &save); 
-        rc = presto_set_fsetroot(root, fsetname, flags);
-        izo_cleanup_ctxt(mnt, &save);
-        return rc;
-}
-
-/* XXX: this function should detect if fsetname is already in use for
-   the cache under root
-*/ 
-int izo_prepare_fileset(struct dentry *root, char *fsetname) 
-{
-        int err;
-        struct dentry *dotizo = NULL, *fsetdir = NULL, *dotiopen = NULL; 
-        struct presto_cache *cache;
-        struct vfsmount *mnt;
-        struct run_ctxt save;
-
-        cache = presto_get_cache(root->d_inode);
-        mnt = cache->cache_vfsmount = izo_alloc_vfsmnt();
-        if (!mnt) { 
-                EXIT;
-                return -ENOMEM;
-        }
-        
-        if (!fsetname) 
-                fsetname = "rootfset"; 
-
-        izo_setup_ctxt(root, mnt, &save); 
-
-        err = izo_simple_mkdir(root, ".intermezzo", 0755);
-        CDEBUG(D_CACHE, "mkdir on .intermezzo err %d\n", err); 
-
-        err = izo_simple_mkdir(root, "..iopen..", 0755);
-        CDEBUG(D_CACHE, "mkdir on ..iopen.. err %d\n", err); 
-
-        dotiopen = lookup_one_len("..iopen..", root, strlen("..iopen.."));
-        if (IS_ERR(dotiopen)) { 
-                EXIT;
-                goto out;
-        }
-        dotiopen->d_inode->i_op = &presto_dir_iops;
-        dput(dotiopen);
-
-
-        dotizo = lookup_one_len(".intermezzo", root, strlen(".intermezzo"));
-        if (IS_ERR(dotizo)) { 
-                EXIT;
-                goto out;
-        }
-
-
-        err = izo_simple_mkdir(dotizo, fsetname, 0755);
-        CDEBUG(D_CACHE, "mkdir err %d\n", err); 
-
-        /* XXX find the dentry of the root of the fileset (root for now) */ 
-        fsetdir = lookup_one_len(fsetname, dotizo, strlen(fsetname));
-        if (IS_ERR(fsetdir)) { 
-                EXIT;
-                goto out;
-        }
-
-        err = izo_simple_symlink(fsetdir, "ROOT", "../.."); 
-
-        /* XXX read flags from flags file */ 
-        err =  presto_set_fsetroot(root, fsetname, 0); 
-        CDEBUG(D_CACHE, "set_fsetroot err %d\n", err); 
-
- out:
-        if (dotizo && !IS_ERR(dotizo)) 
-                dput(dotizo); 
-        if (fsetdir && !IS_ERR(fsetdir)) 
-                dput(fsetdir); 
-        izo_cleanup_ctxt(mnt, &save);
-        return err; 
-}
-
-int izo_set_fileid(struct file *dir, struct izo_ioctl_data *data)
-{
-        int rc = 0;
-        struct presto_cache *cache;
-        struct vfsmount *mnt;
-        struct run_ctxt save;
-        struct nameidata nd;
-        struct dentry *dentry;
-        struct presto_dentry_data *dd;
-        struct dentry *root;
-        char *buf = NULL; 
-
-        ENTRY;
-
-
-        root = dir->f_dentry;
-
-        /* actually, needs to be called on ROOT of fset, not mount point  
-        if (root != root->d_inode->i_sb->s_root) {
-                CERROR ("IOC_SET_FSET must be called on mount point\n");
-                return -ENODEV;
-        }
-        */
-
-        cache = presto_get_cache(root->d_inode);
-        mnt = cache->cache_vfsmount;
-        if (!mnt) { 
-                EXIT;
-                return -ENOMEM;
-        }
-        
-        izo_setup_ctxt(root, mnt, &save); 
-        
-        PRESTO_ALLOC(buf, data->ioc_plen1);
-        if (!buf) { 
-                rc = -ENOMEM;
-                EXIT;
-                goto out;
-        }
-        if (copy_from_user(buf, data->ioc_pbuf1, data->ioc_plen1)) { 
-                rc =  -EFAULT;
-                EXIT;
-                goto out;
-        }
-
-        rc = presto_walk(buf, &nd);
-        if (rc) {
-                CERROR("Unable to open: %s\n", buf);
-                EXIT;
-                goto out;
-        }
-        dentry = nd.dentry;
-        if (!dentry) {
-                CERROR("no dentry!\n");
-                rc =  -EINVAL;
-                EXIT;
-                goto out_close;
-        }
-        dd = presto_d2d(dentry);
-        if (!dd) {
-                CERROR("no dentry_data!\n");
-                rc = -EINVAL;
-                EXIT;
-                goto out_close;
-        }
-
-        CDEBUG(D_FILE,"de:%p dd:%p\n", dentry, dd);
-
-        if (dd->remote_ino != 0) {
-                CERROR("remote_ino already set? %Lx:%Lx\n",
-                       (unsigned long long) dd->remote_ino,
-                       (unsigned long long) dd->remote_generation);
-                rc = 0;
-                EXIT;
-                goto out_close;
-        }
-
-
-        CDEBUG(D_FILE,"setting %p %p, %s to %Lx:%Lx\n", dentry, dd, 
-               buf,
-               (unsigned long long) data->ioc_ino,
-               (unsigned long long) data->ioc_generation);
-        dd->remote_ino = data->ioc_ino;
-        dd->remote_generation = data->ioc_generation;
-
-        EXIT;
- out_close:
-        path_release(&nd);
- out:
-        if (buf)
-                PRESTO_FREE(buf, data->ioc_plen1);
-        izo_cleanup_ctxt(mnt, &save);
-        return rc;
-}
diff -Nru a/fs/intermezzo/inode.c b/fs/intermezzo/inode.c
--- a/fs/intermezzo/inode.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,179 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1996 Peter J. Braam <braam@maths.ox.ac.uk> and
- *    Michael Callahan <callahan@maths.ox.ac.uk>
- *  Copyright (C) 1999 Carnegie Mellon University
- *    Rewritten for Linux 2.1.  Peter Braam <braam@cs.cmu.edu>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Super block/filesystem wide operations
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <asm/segment.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-extern void presto_free_cache(struct presto_cache *);
-
-void presto_set_ops(struct inode *inode, struct  filter_fs *filter)
-{
-        ENTRY; 
-
-        if (!inode || is_bad_inode(inode))
-                return;
-
-        if (S_ISREG(inode->i_mode)) {
-                if ( !filter_c2cfiops(filter) ) {
-                       filter_setup_file_ops(filter, 
-                                             inode, &presto_file_iops,
-                                             &presto_file_fops);
-                }
-                inode->i_op = filter_c2ufiops(filter);
-                inode->i_fop = filter_c2uffops(filter);
-                CDEBUG(D_INODE, "set file methods for %ld to %p\n",
-                       inode->i_ino, inode->i_op);
-        } else if (S_ISDIR(inode->i_mode)) {
-                inode->i_op = filter_c2udiops(filter);
-                inode->i_fop = filter_c2udfops(filter);
-                CDEBUG(D_INODE, "set dir methods for %ld to %p ioctl %p\n",
-                       inode->i_ino, inode->i_op, inode->i_fop->ioctl);
-        } else if (S_ISLNK(inode->i_mode)) {
-                if ( !filter_c2csiops(filter)) {
-                        filter_setup_symlink_ops(filter, 
-                                                 inode,
-                                                 &presto_sym_iops, 
-                                                 &presto_sym_fops);
-                }
-                inode->i_op = filter_c2usiops(filter);
-                inode->i_fop = filter_c2usfops(filter);
-                CDEBUG(D_INODE, "set link methods for %ld to %p\n",
-                       inode->i_ino, inode->i_op);
-        }
-        EXIT;
-}
-
-void presto_read_inode(struct inode *inode)
-{
-        struct presto_cache *cache;
-
-        cache = presto_get_cache(inode);
-        if ( !cache ) {
-                CERROR("PRESTO: BAD, BAD: cannot find cache\n");
-                make_bad_inode(inode);
-                return ;
-        }
-
-        filter_c2csops(cache->cache_filter)->read_inode(inode);
-
-        CDEBUG(D_INODE, "presto_read_inode: ino %ld, gid %d\n", 
-               inode->i_ino, inode->i_gid);
-
-        presto_set_ops(inode, cache->cache_filter); 
-        /* XXX handle special inodes here or not - probably not? */
-}
-
-static void presto_put_super(struct super_block *sb)
-{
-        struct presto_cache *cache;
-        struct upc_channel *channel;
-        struct super_operations *sops;
-        struct list_head *lh;
-        int err;
-
-        ENTRY;
-        cache = presto_cache_find(sb);
-        if (!cache) {
-                EXIT;
-                goto exit;
-        }
-        channel = &izo_channels[presto_c2m(cache)];
-        sops = filter_c2csops(cache->cache_filter);
-        err = izo_clear_all_fsetroots(cache); 
-        if (err) { 
-                CERROR("%s: err %d\n", __FUNCTION__, err);
-        }
-        PRESTO_FREE(cache->cache_vfsmount, sizeof(struct vfsmount));
-
-        /* look at kill_super - fsync_super is not exported GRRR but 
-           probably not needed */ 
-        unlock_super(sb);
-        shrink_dcache_parent(cache->cache_root); 
-        dput(cache->cache_root); 
-        //fsync_super(sb); 
-        lock_super(sb);
-
-        if (sops->write_super)
-                sops->write_super(sb); 
-
-        if (sops->put_super)
-                sops->put_super(sb);
-
-        /* free any remaining async upcalls when the filesystem is unmounted */
-        spin_lock(&channel->uc_lock);
-        lh = channel->uc_pending.next;
-        while ( lh != &channel->uc_pending) {
-                struct upc_req *req;
-                req = list_entry(lh, struct upc_req, rq_chain);
-
-                /* assignment must be here: we are about to free &lh */
-                lh = lh->next;
-                if ( ! (req->rq_flags & REQ_ASYNC) ) 
-                        continue;
-                list_del(&(req->rq_chain));
-                PRESTO_FREE(req->rq_data, req->rq_bufsize);
-                PRESTO_FREE(req, sizeof(struct upc_req));
-        }
-        list_del(&cache->cache_channel_list); 
-        spin_unlock(&channel->uc_lock);
-
-        presto_free_cache(cache);
-
-exit:
-        CDEBUG(D_MALLOC, "after umount: kmem %ld, vmem %ld\n",
-               presto_kmemory, presto_vmemory);
-        return ;
-}
-
-struct super_operations presto_super_ops = {
-        .read_inode    = presto_read_inode,
-        .put_super     = presto_put_super,
-};
-
-
-/* symlinks can be chowned */
-struct inode_operations presto_sym_iops = {
-        .setattr       = presto_setattr
-};
-
-/* NULL for now */
-struct file_operations presto_sym_fops; 
diff -Nru a/fs/intermezzo/intermezzo_fs.h b/fs/intermezzo/intermezzo_fs.h
--- a/fs/intermezzo/intermezzo_fs.h	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,923 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *  Copyright (C) 2001 Tacitus Systems, Inc.
- *  Copyright (C) 2000 Stelias Computing, Inc.
- *  Copyright (C) 2000 Red Hat, Inc.
- *  Copyright (C) 2000 TurboLinux, Inc.
- *  Copyright (C) 2000 Los Alamos National Laboratory.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __INTERMEZZO_FS_H_
-#define __INTERMEZZO_FS_H_ 1
-
-#include "intermezzo_lib.h"
-#include "intermezzo_idl.h"
-
-
-#ifdef __KERNEL__
-typedef __u8 uuid_t[16];
-#else
-# include <uuid/uuid.h>
-#endif
-
-struct lento_vfs_context {
-        __u64 kml_offset;
-        struct timespec updated_time;
-        __u64 remote_ino;
-        __u64 remote_generation;
-        __u32 slot_offset;
-        __u32 recno;
-        __u32 flags;
-        uuid_t uuid;
-        struct presto_version remote_version;
-};
-
-#ifdef __KERNEL__
-# include <linux/smp.h>
-# include <linux/fsfilter.h>
-# include <linux/mount.h>
-# include <linux/slab.h>
-# include <linux/vmalloc.h>
-# include <linux/smp_lock.h>
-
-/* fixups for fs.h */
-# ifndef fs_down
-#  define fs_down(sem) down(sem)
-# endif
-
-# ifndef fs_up
-#  define fs_up(sem) up(sem)
-# endif
-
-# define KML_IDLE                        0
-# define KML_DECODE                      1
-# define KML_OPTIMIZE                    2
-# define KML_REINT                       3
-
-# define KML_OPEN_REINT                  0x0100
-# define KML_REINT_BEGIN                 0x0200
-# define KML_BACKFETCH                   0x0400
-# define KML_REINT_END                   0x0800
-# define KML_CLOSE_REINT                 0x1000
-# define KML_REINT_MAXBUF                (64 * 1024)
-
-# define CACHE_CLIENT_RO       0x4
-# define CACHE_LENTO_RO        0x8
-
-/* global variables */
-extern int presto_debug;
-extern int presto_print_entry;
-extern long presto_kmemory;
-extern long presto_vmemory;
-
-# define PRESTO_DEBUG
-# ifdef PRESTO_DEBUG
-/* debugging masks */
-#  define D_SUPER       1
-#  define D_INODE       2
-#  define D_FILE        4
-#  define D_CACHE       8  /* cache debugging */
-#  define D_MALLOC     16  /* print malloc, de-alloc information */
-#  define D_JOURNAL    32
-#  define D_UPCALL     64  /* up and downcall debugging */
-#  define D_PSDEV     128
-#  define D_PIOCTL    256
-#  define D_SPECIAL   512
-#  define D_TIMING   1024
-#  define D_DOWNCALL 2048
-#  define D_KML      4096
-#  define D_FSDATA   8192
-
-#  define CDEBUG(mask, format, a...)                                    \
-        do {                                                            \
-                if (presto_debug & mask) {                              \
-                        printk("(%s:%s,l. %d %d): " format, __FILE__,   \
-                               __FUNCTION__, __LINE__, current->pid     \
-                               , ## a);                                 \
-                }                                                       \
-        } while (0)
-
-#define CERROR(format, a...)                                            \
-do {                                                                    \
-        printk("(%s:%s,l. %d %d): " format, __FILE__, __FUNCTION__,     \
-               __LINE__, current->pid , ## a);                          \
-} while (0)
-
-#  define ENTRY                                                         \
-        if (presto_print_entry)                                         \
-                printk("Process %d entered %s\n", current->pid, __FUNCTION__)
-
-#  define EXIT                                                          \
-        if (presto_print_entry)                                         \
-                printk("Process %d leaving %s at %d\n", current->pid,   \
-                       __FUNCTION__, __LINE__)
-
-#  define presto_kmem_inc(ptr, size) presto_kmemory += (size)
-#  define presto_kmem_dec(ptr, size) presto_kmemory -= (size)
-#  define presto_vmem_inc(ptr, size) presto_vmemory += (size)
-#  define presto_vmem_dec(ptr, size) presto_vmemory -= (size)
-# else /* !PRESTO_DEBUG */
-#  define CDEBUG(mask, format, a...) do {} while (0)
-#  define ENTRY do {} while (0)
-#  define EXIT do {} while (0)
-#  define presto_kmem_inc(ptr, size) do {} while (0)
-#  define presto_kmem_dec(ptr, size) do {} while (0)
-#  define presto_vmem_inc(ptr, size) do {} while (0)
-#  define presto_vmem_dec(ptr, size) do {} while (0)
-# endif /* PRESTO_DEBUG */
-
-
-struct run_ctxt {
-        struct vfsmount *pwdmnt;
-        struct dentry   *pwd;
-        struct vfsmount *rootmnt;
-        struct dentry   *root;
-        uid_t            fsuid;
-        gid_t            fsgid;
-        mm_segment_t     fs;
-        struct group_info * group_info;
-/*	int              ngroups;
-	gid_t	         groups[NGROUPS];*/
-
-};
-
-static inline void push_ctxt(struct run_ctxt *save, struct run_ctxt *new)
-{
-        save->fs = get_fs();
-        save->pwd = dget(current->fs->pwd);
-        save->pwdmnt = mntget(current->fs->pwdmnt);
-        save->fsgid = current->fsgid;
-        save->fsuid = current->fsuid;
-        save->root = current->fs->root;
-        save->rootmnt = current->fs->rootmnt;
-        save->group_info = current->group_info;
-/*      save->ngroups = current->ngroups;
-        for (i = 0; i< current->ngroups; i++) 
-                save->groups[i] = current->groups[i];*/
-
-        set_fs(new->fs);
-        lock_kernel();
-        set_fs_pwd(current->fs, new->pwdmnt, new->pwd);
-        if (new->root)
-                set_fs_root(current->fs, new->rootmnt, new->root);
-        unlock_kernel();
-        current->fsuid = new->fsuid;
-        current->fsgid = new->fsgid;
-        /*if (new->ngroups > 0) {
-                current->ngroups = new->ngroups;
-                for (i = 0; i< new->ngroups; i++) 
-                        current->groups[i] = new->groups[i];
-        }*/
-        current->group_info = new->group_info;
-        
-}
-
-static inline void pop_ctxt(struct run_ctxt *saved)
-{
-        set_fs(saved->fs);
-        lock_kernel();
-        set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
-        if (saved->root)
-                set_fs_root(current->fs, saved->rootmnt, saved->root);
-        unlock_kernel();
-        current->fsuid = saved->fsuid;
-        current->fsgid = saved->fsgid;
-        current->group_info = saved->group_info;
-/*
-        current->ngroups = saved->ngroups;
-        for (i = 0; i< saved->ngroups; i++) 
-                current->groups[i] = saved->groups[i];
-*/
-        mntput(saved->pwdmnt);
-        dput(saved->pwd);
-}
-
-static inline struct presto_dentry_data *presto_d2d(struct dentry *dentry)
-{
-        return (struct presto_dentry_data *)(dentry->d_fsdata);
-}
-
-struct presto_cache {
-        spinlock_t          cache_lock;
-        loff_t              cache_reserved;
-        struct  vfsmount   *cache_vfsmount;
-        struct super_block *cache_sb;
-        struct  dentry     *cache_root;
-        struct list_head    cache_chain; /* for the dev/cache hash */
-
-        int   cache_flags;
-
-        char *cache_type;            /* filesystem type of cache */
-        struct filter_fs *cache_filter;
-
-        struct upc_channel *cache_psdev;  /* points to channel used */
-        struct list_head cache_channel_list; 
-        struct list_head cache_fset_list; /* filesets mounted in cache */
-};
-
-struct presto_log_fd {
-        rwlock_t         fd_lock;
-        loff_t           fd_offset;  /* offset where next record should go */
-        struct file    *fd_file;
-        int             fd_truncating;
-        unsigned int   fd_recno;   /* last recno written */
-        struct list_head  fd_reservations;
-};
-
-/* file sets */
-# define CHUNK_BITS  16
-
-struct presto_file_set {
-        struct list_head fset_list;
-        struct presto_log_fd fset_kml;
-        struct presto_log_fd fset_lml;
-        struct presto_log_fd fset_rcvd;
-        struct list_head *fset_clients;  /* cache of clients */
-        struct dentry *fset_dentry;
-        struct vfsmount *fset_mnt;
-        struct presto_cache *fset_cache;
-
-        unsigned int fset_lento_recno;  /* last recno mentioned to lento */
-        loff_t fset_lento_off;    /* last offset mentioned to lento */
-        loff_t fset_kml_logical_off; /* logical offset of kml file byte 0 */
-        char * fset_name;
-
-        int fset_flags;
-        int fset_chunkbits;
-        char *fset_reint_buf; /* temporary buffer holds kml during reint */
-
-        spinlock_t fset_permit_lock;
-        int fset_permit_count;
-        int fset_permit_upcall_count;
-        /* This queue is used both for processes waiting for the kernel to give
-         * up the permit as well as processes waiting for the kernel to be given
-         * the permit, depending on the state of FSET_HASPERMIT. */
-        wait_queue_head_t fset_permit_queue;
-
-        loff_t  fset_file_maxio;  /* writing more than this causes a close */
-        unsigned long int kml_truncate_size;
-};
-
-/* This is the default number of bytes written before a close is recorded*/
-#define FSET_DEFAULT_MAX_FILEIO (1024<<10)
-
-struct dentry *presto_tmpfs_ilookup(struct inode *dir, struct dentry *dentry, 
-                                    ino_t ino, unsigned int generation);
-struct dentry *presto_iget_ilookup(struct inode *dir, struct dentry *dentry, 
-                                    ino_t ino, unsigned int generation);
-struct dentry *presto_add_ilookup_dentry(struct dentry *parent,
-                                         struct dentry *real);
-
-struct journal_ops {
-        int (*tr_all_data)(struct inode *);
-        loff_t (*tr_avail)(struct presto_cache *fset, struct super_block *);
-        void *(*tr_start)(struct presto_file_set *, struct inode *, int op);
-        void (*tr_commit)(struct presto_file_set *, void *handle);
-        void (*tr_journal_data)(struct inode *);
-        struct dentry *(*tr_ilookup)(struct inode *dir, struct dentry *dentry, ino_t ino, unsigned int generation);
-        struct dentry *(*tr_add_ilookup)(struct dentry *parent, struct dentry *real);
-};
-
-extern struct journal_ops presto_ext2_journal_ops;
-extern struct journal_ops presto_ext3_journal_ops;
-extern struct journal_ops presto_tmpfs_journal_ops;
-extern struct journal_ops presto_xfs_journal_ops;
-extern struct journal_ops presto_reiserfs_journal_ops;
-extern struct journal_ops presto_obdfs_journal_ops;
-
-# define LENTO_FL_KML            0x0001
-# define LENTO_FL_EXPECT         0x0002
-# define LENTO_FL_VFSCHECK       0x0004
-# define LENTO_FL_JUSTLOG        0x0008
-# define LENTO_FL_WRITE_KML      0x0010
-# define LENTO_FL_CANCEL_LML     0x0020
-# define LENTO_FL_WRITE_EXPECT   0x0040
-# define LENTO_FL_IGNORE_TIME    0x0080
-# define LENTO_FL_TOUCH_PARENT   0x0100
-# define LENTO_FL_TOUCH_NEWOBJ   0x0200
-# define LENTO_FL_SET_DDFILEID   0x0400
-
-struct presto_cache *presto_get_cache(struct inode *inode);
-int presto_sprint_mounts(char *buf, int buflen, int minor);
-struct presto_file_set *presto_fset(struct dentry *de);
-int presto_journal(struct dentry *dentry, char *buf, size_t size);
-int presto_fwrite(struct file *file, const char *str, int len, loff_t *off);
-int presto_ispresto(struct inode *);
-
-/* super.c */
-extern struct file_system_type presto_fs_type;
-extern int init_intermezzo_fs(void);
-
-/* fileset.c */
-extern int izo_prepare_fileset(struct dentry *root, char *fsetname);
-char * izo_make_path(struct presto_file_set *fset, char *name);
-struct file *izo_fset_open(struct presto_file_set *fset, char *name, int flags, int mode);
-
-/* psdev.c */
-int izo_psdev_get_free_channel(void);
-int presto_psdev_init(void);
-int izo_psdev_setpid(int minor);
-extern void presto_psdev_cleanup(void);
-int presto_lento_up(int minor);
-int izo_psdev_setchannel(struct file *file, int fd);
-
-/* inode.c */
-extern struct super_operations presto_super_ops;
-void presto_set_ops(struct inode *inode, struct  filter_fs *filter);
-
-/* dcache.c */
-void presto_frob_dop(struct dentry *de);
-char *presto_path(struct dentry *dentry, struct dentry *root,
-                  char *buffer, int buflen);
-struct presto_dentry_data *izo_alloc_ddata(void);
-int presto_set_dd(struct dentry *);
-int presto_init_ddata_cache(void);
-void presto_cleanup_ddata_cache(void);
-extern struct dentry_operations presto_dentry_ops;
-
-/* dir.c */
-extern struct inode_operations presto_dir_iops;
-extern struct inode_operations presto_file_iops;
-extern struct inode_operations presto_sym_iops;
-extern struct file_operations presto_dir_fops;
-extern struct file_operations presto_file_fops;
-extern struct file_operations presto_sym_fops;
-int presto_setattr(struct dentry *de, struct iattr *iattr);
-int presto_settime(struct presto_file_set *fset, struct dentry *newobj,
-                   struct dentry *parent, struct dentry *target,
-                   struct lento_vfs_context *ctx, int valid);
-int presto_ioctl(struct inode *inode, struct file *file,
-                 unsigned int cmd, unsigned long arg);
-
-extern int presto_ilookup_uid;
-# define PRESTO_ILOOKUP_MAGIC "...ino:"
-# define PRESTO_ILOOKUP_SEP ':'
-int izo_dentry_is_ilookup(struct dentry *, ino_t *id, unsigned int *generation);
-struct dentry *presto_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd);
-
-struct presto_dentry_data {
-        int dd_count; /* how mnay dentries are using this dentry */
-        struct presto_file_set *dd_fset;
-        struct dentry *dd_inodentry; 
-        loff_t dd_kml_offset;
-        int dd_flags;
-        __u64 remote_ino;
-        __u64 remote_generation;
-};
-
-struct presto_file_data {
-        int fd_do_lml;
-        loff_t fd_lml_offset;
-        size_t fd_bytes_written;
-        /* authorization related data of file at open time */
-        uid_t fd_uid;
-        gid_t fd_gid;
-        mode_t fd_mode;
-        /* identification data of calling process */
-        uid_t fd_fsuid;
-        gid_t fd_fsgid;
-        int fd_ngroups;
-        gid_t fd_groups[NGROUPS_SMALL];
-        /* information how to complete the close operation */
-        struct lento_vfs_context fd_info;
-        struct presto_version fd_version;
-};
-
-/* presto.c and Lento::Downcall */
-
-int presto_walk(const char *name, struct nameidata *nd);
-int izo_clear_fsetroot(struct dentry *dentry);
-int izo_clear_all_fsetroots(struct presto_cache *cache);
-int presto_get_kmlsize(char *path, __u64 *size);
-int presto_get_lastrecno(char *path, off_t *size);
-int presto_set_fsetroot(struct dentry *dentry, char *fsetname,
-                       unsigned int flags);
-int presto_set_fsetroot_from_ioc(struct dentry *dentry, char *fsetname,
-                                 unsigned int flags);
-int presto_is_read_only(struct presto_file_set *);
-int presto_truncate_lml(struct presto_file_set *fset);
-int lento_write_lml(char *path,
-                     __u64 remote_ino,
-                     __u32 remote_generation,
-                     __u32 remote_version,
-                    struct presto_version *remote_file_version);
-int lento_complete_closes(char *path);
-int presto_f2m(struct presto_file_set *fset);
-int presto_prep(struct dentry *, struct presto_cache **,
-                       struct presto_file_set **);
-/* cache.c */
-extern struct presto_cache *presto_cache_init(void);
-extern void presto_cache_add(struct presto_cache *cache);
-extern void presto_cache_init_hash(void);
-
-struct presto_cache *presto_cache_find(struct super_block *sb);
-
-#define PRESTO_REQLOW  (3 * 4096)
-#define PRESTO_REQHIGH (6 * 4096)
-void presto_release_space(struct presto_cache *cache, loff_t req);
-int presto_reserve_space(struct presto_cache *cache, loff_t req);
-
-#define PRESTO_DATA             0x00000002 /* cached data is valid */
-#define PRESTO_ATTR             0x00000004 /* attributes cached */
-#define PRESTO_DONT_JOURNAL     0x00000008 /* things like .intermezzo/ */
-
-struct presto_file_set *presto_path2fileset(const char *name);
-int izo_revoke_permit(struct dentry *, uuid_t uuid);
-int presto_chk(struct dentry *dentry, int flag);
-void presto_set(struct dentry *dentry, int flag);
-int presto_get_permit(struct inode *inode);
-int presto_put_permit(struct inode *inode);
-int presto_set_max_kml_size(const char *path, unsigned long max_size);
-int izo_mark_dentry(struct dentry *dentry, int and, int or, int *res);
-int izo_mark_cache(struct dentry *dentry, int and_bits, int or_bits, int *);
-int izo_mark_fset(struct dentry *dentry, int and_bits, int or_bits, int *);
-void presto_getversion(struct presto_version *pv, struct inode *inode);
-int presto_i2m(struct inode *inode);
-int presto_c2m(struct presto_cache *cache);
-
-
-/* file.c */
-int izo_purge_file(struct presto_file_set *fset, char *file);
-int presto_adjust_lml(struct file *file, struct lento_vfs_context *info);
-
-/* journal.c */
-struct rec_info {
-        loff_t offset;
-        int size;
-        int recno;
-        int is_kml;
-};
-
-void presto_trans_commit(struct presto_file_set *fset, void *handle);
-void *presto_trans_start(struct presto_file_set *fset, struct inode *inode,
-                         int op);
-int presto_fread(struct file *file, char *str, int len, loff_t *off);
-int presto_clear_lml_close(struct presto_file_set *fset,
-                           loff_t  lml_offset);
-int presto_complete_lml(struct presto_file_set *fset);
-int presto_read_kml_logical_offset(struct rec_info *recinfo,
-                                   struct presto_file_set *fset);
-int presto_write_kml_logical_offset(struct presto_file_set *fset);
-struct file *presto_copy_kml_tail(struct presto_file_set *fset,
-                                  unsigned long int start);
-int presto_finish_kml_truncate(struct presto_file_set *fset,
-                               unsigned long int offset);
-int izo_lookup_file(struct presto_file_set *fset, char *path,
-                    struct nameidata *nd);
-int izo_do_truncate(struct presto_file_set *fset, struct dentry *dentry,
-                    loff_t length,  loff_t size_check);
-int izo_log_close(struct presto_log_fd *logfd);
-struct file *izo_log_open(struct presto_file_set *fset, char *name, int flags);
-int izo_init_kml_file(struct presto_file_set *, struct presto_log_fd *);
-int izo_init_lml_file(struct presto_file_set *, struct presto_log_fd *);
-int izo_init_last_rcvd_file(struct presto_file_set *, struct presto_log_fd *);
-
-/* vfs.c */
-
-/* Extra data needed in the KML for rollback operations; this structure is
- * passed around during the KML-writing process. */
-struct izo_rollback_data {
-        __u32 rb_mode;
-        __u32 rb_rdev;
-        __u64 rb_uid;
-        __u64 rb_gid;
-};
-
-int presto_write_last_rcvd(struct rec_info *recinfo,
-                           struct presto_file_set *fset,
-                           struct lento_vfs_context *info);
-void izo_get_rollback_data(struct inode *inode, struct izo_rollback_data *rb);
-int presto_do_close(struct presto_file_set *fset, struct file *file);
-int presto_do_setattr(struct presto_file_set *fset, struct dentry *dentry,
-                      struct iattr *iattr, struct lento_vfs_context *info);
-int presto_do_create(struct presto_file_set *fset, struct dentry *dir,
-                     struct dentry *dentry, int mode,
-                     struct lento_vfs_context *info);
-int presto_do_link(struct presto_file_set *fset, struct dentry *dir,
-                   struct dentry *old_dentry, struct dentry *new_dentry,
-                   struct lento_vfs_context *info);
-int presto_do_unlink(struct presto_file_set *fset, struct dentry *dir,
-                     struct dentry *dentry, struct lento_vfs_context *info);
-int presto_do_symlink(struct presto_file_set *fset, struct dentry *dir,
-                      struct dentry *dentry, const char *name,
-                      struct lento_vfs_context *info);
-int presto_do_mkdir(struct presto_file_set *fset, struct dentry *dir,
-                    struct dentry *dentry, int mode,
-                    struct lento_vfs_context *info);
-int presto_do_rmdir(struct presto_file_set *fset, struct dentry *dir,
-                    struct dentry *dentry, struct lento_vfs_context *info);
-int presto_do_mknod(struct presto_file_set *fset, struct dentry *dir,
-                    struct dentry *dentry, int mode, dev_t dev,
-                    struct lento_vfs_context *info);
-int do_rename(struct presto_file_set *fset, struct dentry *old_dir,
-              struct dentry *old_dentry, struct dentry *new_dir,
-              struct dentry *new_dentry, struct lento_vfs_context *info);
-int presto_do_statfs (struct presto_file_set *fset,
-                      struct kstatfs * buf);
-
-int lento_setattr(const char *name, struct iattr *iattr,
-                  struct lento_vfs_context *info);
-int lento_create(const char *name, int mode, struct lento_vfs_context *info);
-int lento_link(const char *oldname, const char *newname,
-               struct lento_vfs_context *info);
-int lento_unlink(const char *name, struct lento_vfs_context *info);
-int lento_symlink(const char *oldname,const char *newname,
-                  struct lento_vfs_context *info);
-int lento_mkdir(const char *name, int mode, struct lento_vfs_context *info);
-int lento_rmdir(const char *name, struct lento_vfs_context *info);
-int lento_mknod(const char *name, int mode, dev_t dev,
-                struct lento_vfs_context *info);
-int lento_rename(const char *oldname, const char *newname,
-                 struct lento_vfs_context *info);
-int lento_iopen(const char *name, ino_t ino, unsigned int generation,int flags);
-
-/* journal.c */
-
-#define JOURNAL_PAGE_SZ  PAGE_SIZE
-
-int presto_no_journal(struct presto_file_set *fset);
-int journal_fetch(int minor);
-int presto_log(struct presto_file_set *fset, struct rec_info *rec,
-               const char *buf, size_t size,
-               const char *string1, int len1, 
-               const char *string2, int len2,
-               const char *string3, int len3);
-int presto_get_fileid(int minor, struct presto_file_set *fset,
-                      struct dentry *dentry);
-int presto_journal_setattr(struct rec_info *rec, struct presto_file_set *fset,
-                           struct dentry *dentry, struct presto_version *old_ver,
-                           struct izo_rollback_data *, struct iattr *iattr);
-int presto_journal_create(struct rec_info *rec, struct presto_file_set *fset,
-                          struct dentry *dentry,
-                          struct presto_version *tgt_dir_ver,
-                          struct presto_version *new_file_ver, int mode);
-int presto_journal_link(struct rec_info *rec, struct presto_file_set *fset,
-                        struct dentry *src, struct dentry *tgt,
-                        struct presto_version *tgt_dir_ver,
-                        struct presto_version *new_link_ver);
-int presto_journal_unlink(struct rec_info *rec, struct presto_file_set *fset,
-                          struct dentry *dir,
-                          struct presto_version *tgt_dir_ver,
-                          struct presto_version *old_file_ver,
-                          struct izo_rollback_data *, struct dentry *dentry,
-                          char *old_target, int old_targetlen);
-int presto_journal_symlink(struct rec_info *rec, struct presto_file_set *fset,
-                           struct dentry *dentry, const char *target,
-                           struct presto_version *tgt_dir_ver,
-                           struct presto_version *new_link_ver);
-int presto_journal_mkdir(struct rec_info *rec, struct presto_file_set *fset,
-                         struct dentry *dentry,
-                         struct presto_version *tgt_dir_ver,
-                         struct presto_version *new_dir_ver, int mode);
-int presto_journal_rmdir(struct rec_info *rec, struct presto_file_set *fset,
-                         struct dentry *dentry,
-                         struct presto_version *tgt_dir_ver,
-                         struct presto_version *old_dir_ver,
-                         struct izo_rollback_data *, int len, const char *name);
-int presto_journal_mknod(struct rec_info *rec, struct presto_file_set *fset,
-                         struct dentry *dentry,
-                         struct presto_version *tgt_dir_ver,
-                         struct presto_version *new_node_ver, int mode,
-                         int dmajor, int dminor);
-int presto_journal_rename(struct rec_info *rec, struct presto_file_set *fset,
-                          struct dentry *src, struct dentry *tgt,
-                          struct presto_version *src_dir_ver,
-                          struct presto_version *tgt_dir_ver);
-int presto_journal_open(struct rec_info *, struct presto_file_set *,
-                        struct dentry *, struct presto_version *old_ver);
-int presto_journal_close(struct rec_info *rec, struct presto_file_set *,
-                         struct presto_file_data *, struct dentry *,
-                         struct presto_version *old_file_ver,
-                         struct presto_version *new_file_ver);
-int presto_write_lml_close(struct rec_info *rec,
-                           struct presto_file_set *fset, 
-                           struct file *file,
-                           __u64 remote_ino,
-                           __u64 remote_generation,
-                           struct presto_version *remote_version,
-                           struct presto_version *new_file_ver);
-void presto_log_op(void *data, int len);
-loff_t presto_kml_offset(struct presto_file_set *fset);
-
-/* upcall.c */
-#define SYNCHRONOUS 0
-#define ASYNCHRONOUS 1
-/* asynchronous calls */
-int izo_upc_kml(int minor, __u64 offset, __u32 first_recno, __u64 length,
-                __u32 last_recno, char *fsetname);
-int izo_upc_kml_truncate(int minor, __u64 length, __u32 last_recno,
-                         char *fsetname);
-int izo_upc_go_fetch_kml(int minor, char *fsetname, uuid_t uuid, __u64 kmlsize);
-int izo_upc_backfetch(int minor, char *path, char *fileset, 
-                      struct lento_vfs_context *);
-
-/* synchronous calls */
-int izo_upc_get_fileid(int minor, __u32 reclen, char *rec, 
-                       __u32 pathlen, char *path, char *fsetname);
-int izo_upc_permit(int minor, struct dentry *, __u32 pathlen, char *path,
-                   char *fset);
-int izo_upc_open(int minor, __u32 pathlen, char *path, char *fsetname, 
-                 struct lento_vfs_context *info);
-int izo_upc_connect(int minor, __u64 ip_address, __u64 port, __u8 uuid[16],
-                    int client_flag);
-int izo_upc_revoke_permit(int minor, char *fsetname, uuid_t uuid);
-int izo_upc_set_kmlsize(int minor, char *fsetname, uuid_t uuid, __u64 kmlsize);
-int izo_upc_client_make_branch(int minor, char *fsetname);
-int izo_upc_server_make_branch(int minor, char *fsetname);
-int izo_upc_branch_undo(int minor, char *fsetname, char *branchname);
-int izo_upc_branch_redo(int minor, char *fsetname, char *branchname);
-int izo_upc_repstatus(int minor,  char * fsetname, struct izo_rcvd_rec *lr_server);
-
-/* general mechanism */
-int izo_upc_upcall(int minor, int *size, struct izo_upcall_hdr *, int async);
-
-/* replicator.c */
-int izo_repstatus(struct presto_file_set *fset, __u64 client_kmlsize, 
-                  struct izo_rcvd_rec *lr_client, struct izo_rcvd_rec *lr_server);
-int izo_rep_cache_init(struct presto_file_set *);
-loff_t izo_rcvd_get(struct izo_rcvd_rec *, struct presto_file_set *, char *uuid);
-loff_t izo_rcvd_write(struct presto_file_set *, struct izo_rcvd_rec *);
-loff_t izo_rcvd_upd_remote(struct presto_file_set *fset, char * uuid,  __u64 remote_recno,
-                           __u64 remote_offset);
-
-int izo_ioctl_packlen(struct izo_ioctl_data *data);
-
-/* sysctl.c */
-int init_intermezzo_sysctl(void);
-void cleanup_intermezzo_sysctl(void);
-
-/* ext_attr.c */
-/* We will be more tolerant than the default ea patch with attr name sizes and
- * the size of value. If these come via VFS from the default ea patches, the
- * corresponding character strings will be truncated anyway. During journalling- * we journal length for both name and value. See journal_set_ext_attr.
- */
-#define PRESTO_EXT_ATTR_NAME_MAX 128
-#define PRESTO_EXT_ATTR_VALUE_MAX 8192
-
-#define PRESTO_ALLOC(ptr, size)                                         \
-do {                                                                    \
-        long s = (size);                                                \
-        (ptr) = kmalloc(s, GFP_KERNEL);                                 \
-        if ((ptr) == NULL)                                              \
-                CERROR("IZO: out of memory at %s:%d (trying to "        \
-                       "allocate %ld)\n", __FILE__, __LINE__, s);       \
-        else {                                                          \
-                presto_kmem_inc((ptr), s);                              \
-                memset((ptr), 0, s);                                    \
-        }                                                               \
-        CDEBUG(D_MALLOC, "kmalloced: %ld at %p (tot %ld).\n",           \
-               s, (ptr), presto_kmemory);                               \
-} while (0)
-
-#define PRESTO_FREE(ptr, size)                                          \
-do {                                                                    \
-        long s = (size);                                                \
-        if ((ptr) == NULL) {                                            \
-                CERROR("IZO: free NULL pointer (%ld bytes) at "         \
-                       "%s:%d\n", s, __FILE__, __LINE__);               \
-                break;                                                  \
-        }                                                               \
-        kfree(ptr);                                                     \
-        CDEBUG(D_MALLOC, "kfreed: %ld at %p (tot %ld).\n",              \
-               s, (ptr), presto_kmemory);                               \
-        presto_kmem_dec((ptr), s);                                      \
-} while (0)
-
-static inline int dentry_name_cmp(struct dentry *dentry, char *name)
-{
-        return (strlen(name) == dentry->d_name.len &&
-                memcmp(name, dentry->d_name.name, dentry->d_name.len) == 0);
-}
-
-static inline char *strdup(char *str)
-{
-        char *tmp;
-        tmp = kmalloc(strlen(str) + 1, GFP_KERNEL);
-        if (tmp)
-                memcpy(tmp, str, strlen(str) + 1);
-               
-        return tmp;
-}
-
-static inline int izo_ioctl_is_invalid(struct izo_ioctl_data *data)
-{
-        if (data->ioc_len > (1<<30)) {
-                CERROR("IZO ioctl: ioc_len larger than 1<<30\n");
-                return 1;
-        }
-        if (data->ioc_inllen1 > (1<<30)) {
-                CERROR("IZO ioctl: ioc_inllen1 larger than 1<<30\n");
-                return 1;
-        }
-        if (data->ioc_inllen2 > (1<<30)) {
-                CERROR("IZO ioctl: ioc_inllen2 larger than 1<<30\n");
-                return 1;
-        }
-        if (data->ioc_inlbuf1 && !data->ioc_inllen1) {
-                CERROR("IZO ioctl: inlbuf1 pointer but 0 length\n");
-                return 1;
-        }
-        if (data->ioc_inlbuf2 && !data->ioc_inllen2) {
-                CERROR("IZO ioctl: inlbuf2 pointer but 0 length\n");
-                return 1;
-        }
-        if (data->ioc_pbuf1 && !data->ioc_plen1) {
-                CERROR("IZO ioctl: pbuf1 pointer but 0 length\n");
-                return 1;
-        }
-        if (data->ioc_pbuf2 && !data->ioc_plen2) {
-                CERROR("IZO ioctl: pbuf2 pointer but 0 length\n");
-                return 1;
-        }
-        if (izo_ioctl_packlen(data) != data->ioc_len ) {
-                CERROR("IZO ioctl: packlen exceeds ioc_len\n");
-                return 1;
-        }
-        if (data->ioc_inllen1 &&
-            data->ioc_bulk[data->ioc_inllen1 - 1] != '\0') {
-                CERROR("IZO ioctl: inlbuf1 not 0 terminated\n");
-                return 1;
-        }
-        if (data->ioc_inllen2 &&
-            data->ioc_bulk[size_round(data->ioc_inllen1) + data->ioc_inllen2
-                           - 1] != '\0') {
-                CERROR("IZO ioctl: inlbuf2 not 0 terminated\n");
-                return 1;
-        }
-        return 0;
-}
-
-/* buffer MUST be at least the size of izo_ioctl_hdr */
-static inline int izo_ioctl_getdata(char *buf, char *end, void *arg)
-{
-        struct izo_ioctl_hdr *hdr;
-        struct izo_ioctl_data *data;
-        int err;
-        ENTRY;
-
-        hdr = (struct izo_ioctl_hdr *)buf;
-        data = (struct izo_ioctl_data *)buf;
-
-        err = copy_from_user(buf, (void *)arg, sizeof(*hdr));
-        if ( err ) {
-                EXIT;
-                return err;
-        }
-
-        if (hdr->ioc_version != IZO_IOCTL_VERSION) {
-                CERROR("IZO: version mismatch kernel vs application\n");
-                return -EINVAL;
-        }
-
-        if (hdr->ioc_len + buf >= end) {
-                CERROR("IZO: user buffer exceeds kernel buffer\n");
-                return -EINVAL;
-        }
-
-        if (hdr->ioc_len < sizeof(struct izo_ioctl_data)) {
-                CERROR("IZO: user buffer too small for ioctl\n");
-                return -EINVAL;
-        }
-
-        err = copy_from_user(buf, (void *)arg, hdr->ioc_len);
-        if ( err ) {
-                EXIT;
-                return err;
-        }
-
-        if (izo_ioctl_is_invalid(data)) {
-                CERROR("IZO: ioctl not correctly formatted\n");
-                return -EINVAL;
-        }
-
-        if (data->ioc_inllen1) {
-                data->ioc_inlbuf1 = &data->ioc_bulk[0];
-        }
-
-        if (data->ioc_inllen2) {
-                data->ioc_inlbuf2 = &data->ioc_bulk[0] +
-                        size_round(data->ioc_inllen1);
-        }
-
-        EXIT;
-        return 0;
-}
-
-# define MYPATHLEN(buffer, path) ((buffer) + PAGE_SIZE - (path))
-
-# define free kfree
-# define malloc(a) kmalloc(a, GFP_KERNEL)
-# define printf printk
-int kml_reint_rec(struct file *dir, struct izo_ioctl_data *data);
-int izo_get_fileid(struct file *dir, struct izo_ioctl_data *data);
-int izo_set_fileid(struct file *dir, struct izo_ioctl_data *data);
-
-#else /* __KERNEL__ */
-# include <stdlib.h>
-# include <stdio.h>
-# include <sys/types.h>
-# include <sys/ioctl.h>
-# include <string.h>
-
-# define printk printf
-# ifndef CERROR
-#   define CERROR printf
-# endif
-# define kmalloc(a,b) malloc(a)
-
-void init_fsreintdata (void);
-int kml_fsreint(struct kml_rec *rec, char *basedir);
-int kml_iocreint(__u32 size, char *ptr, __u32 offset, int dird,
-                 uuid_t uuid, __u32 generate_kml);
-
-static inline void izo_ioctl_init(struct izo_ioctl_data *data)
-{
-        memset(data, 0, sizeof(*data));
-        data->ioc_len = sizeof(*data);
-        data->ioc_version = IZO_IOCTL_VERSION;
-}
-
-static inline int
-izo_ioctl_pack(struct izo_ioctl_data *data, char **pbuf, int max)
-{
-        char *ptr;
-        struct izo_ioctl_data *overlay;
-        data->ioc_len = izo_ioctl_packlen(data);
-        data->ioc_version = IZO_IOCTL_VERSION;
-
-        if (*pbuf && izo_ioctl_packlen(data) > max)
-                return 1;
-        if (*pbuf == NULL)
-                *pbuf = malloc(data->ioc_len);
-        if (*pbuf == NULL)
-                return 1;
-        overlay = (struct izo_ioctl_data *)*pbuf;
-        memcpy(*pbuf, data, sizeof(*data));
-
-        ptr = overlay->ioc_bulk;
-        if (data->ioc_inlbuf1)
-                LOGL(data->ioc_inlbuf1, data->ioc_inllen1, ptr);
-        if (data->ioc_inlbuf2)
-                LOGL(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
-        if (izo_ioctl_is_invalid(overlay))
-                return 1;
-
-        return 0;
-}
-
-#endif /* __KERNEL__*/
-
-#define IZO_ERROR_NAME 1
-#define IZO_ERROR_UPDATE 2
-#define IZO_ERROR_DELETE 3
-#define IZO_ERROR_RENAME 4
-
-static inline char *izo_error(int err)
-{
-#ifndef __KERNEL__
-        if (err <= 0)
-                return strerror(-err);
-#endif
-        switch (err) {
-        case IZO_ERROR_NAME:
-                return "InterMezzo name/name conflict";
-        case IZO_ERROR_UPDATE:
-                return "InterMezzo update/update conflict";
-        case IZO_ERROR_DELETE:
-                return "InterMezzo update/delete conflict";
-        case IZO_ERROR_RENAME:
-                return "InterMezzo rename/rename conflict";
-        }
-        return "Unknown InterMezzo error";
-}
-
-/* kml_unpack.c */
-char *kml_print_rec(struct kml_rec *rec, int brief);
-int kml_unpack(struct kml_rec *rec, char **buf, char *end);
-
-/* fs 2.5 compat */
-
-/* is_read_only() is replaced by bdev_read_only which takes struct
-   block_device *.  Since this is only needed for debugging, it can be
-   safely ignored now.
-*/
-#define is_read_only(dev) 0
-
-#endif
diff -Nru a/fs/intermezzo/intermezzo_idl.h b/fs/intermezzo/intermezzo_idl.h
--- a/fs/intermezzo/intermezzo_idl.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,304 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *  Copyright (C) 2001 Tacit Networks, Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __INTERMEZZO_IDL_H__
-#define __INTERMEZZO_IDL_H__
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-
-/* this file contains all data structures used in InterMezzo's interfaces:
- * - upcalls
- * - ioctl's
- * - KML records
- * - RCVD records
- * - rpc's
- */ 
-
-/* UPCALL */
-#define INTERMEZZO_MINOR 248   
-
-
-#define IZO_UPC_VERSION 0x00010002
-#define IZO_UPC_PERMIT        1
-#define IZO_UPC_CONNECT       2
-#define IZO_UPC_GO_FETCH_KML  3
-#define IZO_UPC_OPEN          4
-#define IZO_UPC_REVOKE_PERMIT 5
-#define IZO_UPC_KML           6
-#define IZO_UPC_BACKFETCH     7
-#define IZO_UPC_KML_TRUNC     8
-#define IZO_UPC_SET_KMLSIZE   9
-#define IZO_UPC_BRANCH_UNDO   10
-#define IZO_UPC_BRANCH_REDO   11
-#define IZO_UPC_GET_FILEID    12
-#define IZO_UPC_CLIENT_MAKE_BRANCH    13
-#define IZO_UPC_SERVER_MAKE_BRANCH    14
-#define IZO_UPC_REPSTATUS    15
-
-#define IZO_UPC_LARGEST_OPCODE 15
-
-struct izo_upcall_hdr {
-        __u32 u_len;
-        __u32 u_version;
-        __u32 u_opc;
-        __u32 u_uniq;
-        __u32 u_pid;
-        __u32 u_uid;
-        __u32 u_pathlen;
-        __u32 u_fsetlen;
-        __u64 u_offset;
-        __u64 u_length;
-        __u32 u_first_recno;
-        __u32 u_last_recno;
-        __u32 u_async;
-        __u32 u_reclen;
-        __u8  u_uuid[16];
-};
-
-/* This structure _must_ sit at the beginning of the buffer */
-struct izo_upcall_resp {
-        __u32 opcode;
-        __u32 unique;    
-        __u32 result;
-};
-
-
-/* IOCTL */
-
-#define IZO_IOCTL_VERSION 0x00010003
-
-/* maximum size supported for ioc_pbuf1 */
-#define KML_MAX_BUF (64*1024)
-
-struct izo_ioctl_hdr { 
-        __u32  ioc_len;
-        __u32  ioc_version;
-};
-
-struct izo_ioctl_data {
-        __u32 ioc_len;
-        __u32 ioc_version;
-        __u32 ioc_izodev;
-        __u32 ioc_kmlrecno;
-        __u64 ioc_kmlsize;
-        __u32 ioc_flags;
-        __s32 ioc_inofd;
-        __u64 ioc_ino;
-        __u64 ioc_generation;
-        __u32 ioc_mark_what;
-        __u32 ioc_and_flag;
-        __u32 ioc_or_flag;
-        __u32 ioc_dev;
-        __u32 ioc_offset;
-        __u32 ioc_slot;
-        __u64 ioc_uid;
-        __u8  ioc_uuid[16];
-
-        __u32 ioc_inllen1;   /* path */
-        char *ioc_inlbuf1;
-        __u32 ioc_inllen2;   /* fileset */
-        char *ioc_inlbuf2;
-
-        __u32 ioc_plen1;     /* buffers in user space (KML) */
-        char *ioc_pbuf1;
-        __u32 ioc_plen2;     /* buffers in user space (KML) */
-        char *ioc_pbuf2;
-
-        char  ioc_bulk[0];
-};
-
-#define IZO_IOC_DEVICE          _IOW ('p',0x50, void *)
-#define IZO_IOC_REINTKML        _IOW ('p',0x51, void *)
-#define IZO_IOC_GET_RCVD        _IOW ('p',0x52, void *)
-#define IZO_IOC_SET_IOCTL_UID   _IOW ('p',0x53, void *)
-#define IZO_IOC_GET_KML_SIZE    _IOW ('p',0x54, void *)
-#define IZO_IOC_PURGE_FILE_DATA _IOW ('p',0x55, void *)
-#define IZO_IOC_CONNECT         _IOW ('p',0x56, void *)
-#define IZO_IOC_GO_FETCH_KML    _IOW ('p',0x57, void *)
-#define IZO_IOC_MARK            _IOW ('p',0x58, void *)
-#define IZO_IOC_CLEAR_FSET      _IOW ('p',0x59, void *)
-#define IZO_IOC_CLEAR_ALL_FSETS _IOW ('p',0x60, void *)
-#define IZO_IOC_SET_FSET        _IOW ('p',0x61, void *)
-#define IZO_IOC_REVOKE_PERMIT   _IOW ('p',0x62, void *)
-#define IZO_IOC_SET_KMLSIZE     _IOW ('p',0x63, void *)
-#define IZO_IOC_CLIENT_MAKE_BRANCH _IOW ('p',0x64, void *)
-#define IZO_IOC_SERVER_MAKE_BRANCH _IOW ('p',0x65, void *)
-#define IZO_IOC_BRANCH_UNDO    _IOW ('p',0x66, void *)
-#define IZO_IOC_BRANCH_REDO    _IOW ('p',0x67, void *)
-#define IZO_IOC_SET_PID        _IOW ('p',0x68, void *)
-#define IZO_IOC_SET_CHANNEL    _IOW ('p',0x69, void *)
-#define IZO_IOC_GET_CHANNEL    _IOW ('p',0x70, void *)
-#define IZO_IOC_GET_FILEID    _IOW ('p',0x71, void *)
-#define IZO_IOC_ADJUST_LML    _IOW ('p',0x72, void *)
-#define IZO_IOC_SET_FILEID    _IOW ('p',0x73, void *)
-#define IZO_IOC_REPSTATUS    _IOW ('p',0x74, void *)
-
-/* marking flags for fsets */
-#define FSET_CLIENT_RO        0x00000001
-#define FSET_LENTO_RO         0x00000002
-#define FSET_HASPERMIT        0x00000004 /* we have a permit to WB */
-#define FSET_INSYNC           0x00000008 /* this fileset is in sync */
-#define FSET_PERMIT_WAITING   0x00000010 /* Lento is waiting for permit */
-#define FSET_STEAL_PERMIT     0x00000020 /* take permit if Lento is dead */
-#define FSET_JCLOSE_ON_WRITE  0x00000040 /* Journal closes on writes */
-#define FSET_DATA_ON_DEMAND   0x00000080 /* update data on file_open() */
-#define FSET_PERMIT_EXCLUSIVE 0x00000100 /* only one permitholder allowed */
-#define FSET_HAS_BRANCHES     0x00000200 /* this fileset contains branches */
-#define FSET_IS_BRANCH        0x00000400 /* this fileset is a branch */
-#define FSET_FLAT_BRANCH      0x00000800 /* this fileset is ROOT with branches */
-
-/* what to mark indicator (ioctl parameter) */
-#define MARK_DENTRY   101
-#define MARK_FSET     102
-#define MARK_CACHE    103
-#define MARK_GETFL    104
-
-/* KML */
-
-#define KML_MAJOR_VERSION 0x00010000
-#define KML_MINOR_VERSION 0x00000002
-#define KML_OPCODE_NOOP          0
-#define KML_OPCODE_CREATE        1
-#define KML_OPCODE_MKDIR         2
-#define KML_OPCODE_UNLINK        3
-#define KML_OPCODE_RMDIR         4
-#define KML_OPCODE_CLOSE         5
-#define KML_OPCODE_SYMLINK       6
-#define KML_OPCODE_RENAME        7
-#define KML_OPCODE_SETATTR       8
-#define KML_OPCODE_LINK          9
-#define KML_OPCODE_OPEN          10
-#define KML_OPCODE_MKNOD         11
-#define KML_OPCODE_WRITE         12
-#define KML_OPCODE_RELEASE       13
-#define KML_OPCODE_TRUNC         14
-#define KML_OPCODE_SETEXTATTR    15
-#define KML_OPCODE_DELEXTATTR    16
-#define KML_OPCODE_KML_TRUNC     17
-#define KML_OPCODE_GET_FILEID    18
-#define KML_OPCODE_NUM           19
-/* new stuff */
-struct presto_version {
-        __u32 pv_mtime_sec;
-        __u32 pv_mtime_nsec;
-        __u32 pv_ctime_sec;
-        __u32 pv_ctime_nsec;
-        __u64 pv_size;
-};
-
-struct kml_prefix_hdr {
-        __u32                    len;
-        __u32                    version;
-        __u32                    pid;
-        __u32                    auid;
-        __u32                    fsuid;
-        __u32                    fsgid;
-        __u32                    opcode;
-        __u32                    ngroups;
-};
-
-struct kml_prefix { 
-        struct kml_prefix_hdr    *hdr;
-        __u32                    *groups;
-};
-
-struct kml_suffix { 
-        __u32                    prevrec;
-        __u32                    recno;
-        __u32                    time;
-        __u32                    len;
-};
-
-struct kml_rec {
-        char                   *buf;
-        struct kml_prefix       prefix;
-        __u64                   offset;
-        char                   *path;
-        int                     pathlen;
-        char                   *name;
-        int                     namelen;
-        char                   *target;
-        int                     targetlen;
-        struct presto_version  *old_objectv;
-        struct presto_version  *new_objectv;
-        struct presto_version  *old_parentv;
-        struct presto_version  *new_parentv;
-        struct presto_version  *old_targetv;
-        struct presto_version  *new_targetv;
-        __u32                   valid;
-        __u32                   mode;
-        __u32                   uid;
-        __u32                   gid;
-        __u64                   size;
-        __u32                   mtime_sec;
-        __u32                   mtime_nsec;
-        __u32                   ctime_sec;
-        __u32                   ctime_nsec;
-        __u32                   flags;
-        __u32                   ino;
-        __u32                   rdev;
-        __u32                   major;
-        __u32                   minor;
-        __u32                   generation;
-        __u32                   old_mode;
-        __u32                   old_rdev;
-        __u64                   old_uid;
-        __u64                   old_gid;
-        char                   *old_target;
-        int                     old_targetlen;
-        struct kml_suffix      *suffix;
-};
-
-
-/* RCVD */ 
-
-/* izo_rcvd_rec fills the .intermezzo/fset/last_rcvd file and provides data about
- * our view of reintegration offsets for a given peer.
- *
- * The only exception is the last_rcvd record which has a UUID consisting of all
- * zeroes; this record's lr_local_offset field is the logical byte offset of our
- * KML, which is updated when KML truncation takes place.  All other fields are
- * reserved. */
-
-/* XXX - document how clean shutdowns are recorded */
-
-struct izo_rcvd_rec { 
-        __u8    lr_uuid[16];       /* which peer? */
-        __u64   lr_remote_recno;   /* last confirmed remote recno  */
-        __u64   lr_remote_offset;  /* last confirmed remote offset */
-        __u64   lr_local_recno;    /* last locally reinted recno   */
-        __u64   lr_local_offset;   /* last locally reinted offset  */
-        __u64   lr_last_ctime;     /* the largest ctime that has reintegrated */
-};
-
-/* Cache purge database
- *
- * Each DB entry is this structure followed by the path name, no trailing NUL. */
-struct izo_purge_entry {
-        __u64 p_atime;
-        __u32 p_pathlen;
-};
-
-/* RPC */
-
-#endif
diff -Nru a/fs/intermezzo/intermezzo_journal.h b/fs/intermezzo/intermezzo_journal.h
--- a/fs/intermezzo/intermezzo_journal.h	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,24 +0,0 @@
-#ifndef __PRESTO_JOURNAL_H
-#define __PRESTO_JOURNAL_H
-
-
-struct journal_prefix {
-	int len;
-        u32 version;
-	int pid;
-	int uid;
-	int fsuid;
-	int fsgid;
-	int opcode;
-        u32 ngroups;
-        u32 groups[0];
-};
-
-struct journal_suffix {
-	unsigned long prevrec;  /* offset of previous record for dentry */
-	int recno;
-	int time;
-	int len;
-};
-
-#endif
diff -Nru a/fs/intermezzo/intermezzo_kml.h b/fs/intermezzo/intermezzo_kml.h
--- a/fs/intermezzo/intermezzo_kml.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,260 +0,0 @@
-#ifndef __INTERMEZZO_KML_H
-#define __INTERMEZZO_KML_H
-
-#include "intermezzo_psdev.h"
-#include <linux/fs.h>
-#include "intermezzo_journal.h"
-
-#define PRESTO_KML_MAJOR_VERSION 0x00010000
-#define PRESTO_KML_MINOR_VERSION 0x00002001
-#define PRESTO_OP_NOOP          0
-#define PRESTO_OP_CREATE        1
-#define PRESTO_OP_MKDIR         2
-#define PRESTO_OP_UNLINK        3
-#define PRESTO_OP_RMDIR         4
-#define PRESTO_OP_CLOSE         5
-#define PRESTO_OP_SYMLINK       6
-#define PRESTO_OP_RENAME        7
-#define PRESTO_OP_SETATTR       8
-#define PRESTO_OP_LINK          9
-#define PRESTO_OP_OPEN          10
-#define PRESTO_OP_MKNOD         11
-#define PRESTO_OP_WRITE         12
-#define PRESTO_OP_RELEASE       13
-#define PRESTO_OP_TRUNC         14
-#define PRESTO_OP_SETEXTATTR    15
-#define PRESTO_OP_DELEXTATTR    16
-
-#define PRESTO_LML_DONE     	1 /* flag to get first write to do LML */
-#define KML_KOP_MARK            0xffff
-
-struct presto_lml_data {
-        loff_t   rec_offset;
-};
-
-struct big_journal_prefix {
-        u32 len;
-        u32 version; 
-        u32 pid;
-        u32 uid;
-        u32 fsuid;
-        u32 fsgid;
-        u32 opcode;
-        u32 ngroups;
-        u32 groups[NGROUPS_SMALL];
-};
-
-enum kml_opcode {
-        KML_CREATE = 1,
-        KML_MKDIR,
-        KML_UNLINK,
-        KML_RMDIR,
-        KML_CLOSE,
-        KML_SYMLINK,
-        KML_RENAME,
-        KML_SETATTR,
-        KML_LINK,
-        KML_OPEN,
-        KML_MKNOD,
-        KML_ENDMARK = 0xff
-};
-
-struct kml_create {
-	char 			*path;
-	struct presto_version 	new_objectv, 
-				old_parentv, 
-				new_parentv;
-	int 			mode;
-	int 			uid;
-	int 			gid;
-};
-
-struct kml_open {
-};
-
-struct kml_mkdir {
-	char 			*path;
-	struct presto_version 	new_objectv, 
-				old_parentv, 
-				new_parentv;
-	int 			mode;
-	int 			uid;
-	int 			gid;
-};
-
-struct kml_unlink {
-	char 			*path, 	
-				*name;
-	struct presto_version 	old_tgtv, 
-				old_parentv, 
-				new_parentv;
-};
-
-struct kml_rmdir {
-	char 			*path, 
-				*name;
-	struct presto_version 	old_tgtv, 
-				old_parentv, 
-				new_parentv;
-};
-
-struct kml_close {
-	int 			open_mode, 
-				open_uid, 
-				open_gid;
-	char 			*path;
-	struct presto_version 	new_objectv;
-	__u64 			ino;
-      	int 			generation;
-};
-
-struct kml_symlink {
-	char 			*sourcepath, 	
-				*targetpath;
-	struct presto_version 	new_objectv, 
-				old_parentv, 
-				new_parentv;
-      	int 			uid;
-	int 			gid;
-};
-
-struct kml_rename {
-	char 			*sourcepath, 
-				*targetpath;
-	struct presto_version 	old_objectv, 
-				new_objectv, 
-				old_tgtv, 
-				new_tgtv;
-};
-
-struct kml_setattr {
-	char 			*path;
-	struct presto_version 	old_objectv;
-	struct iattr 		iattr;
-};
-
-struct kml_link {
-	char 			*sourcepath, 	
-				*targetpath;
-	struct presto_version 	new_objectv, 
-				old_parentv, 
-				new_parentv;
-};
-
-struct kml_mknod {
-	char 			*path;
-	struct presto_version 	new_objectv, 
-				old_parentv, 
-				new_parentv;
-	int 			mode;
-      	int 			uid;
-	int 			gid;
-       	int 			major;
-	int 			minor;
-};
-
-/* kml record items for optimizing */
-struct kml_kop_node
-{
-        u32             kml_recno;
-        u32             kml_flag;
-        u32             kml_op;
-        nlink_t         i_nlink;
-        u32             i_ino;
-};
-
-struct kml_kop_lnode
-{
-        struct list_head chains;
-        struct kml_kop_node node;
-};
-
-struct kml_endmark {
-	u32			total;
-	struct kml_kop_node 	*kop;
-};
-
-/* kml_flag */
-#define  KML_REC_DELETE               1
-#define  KML_REC_EXIST                0
-
-struct kml_optimize {
-	struct list_head kml_chains;
-        u32              kml_flag;
-        u32              kml_op;
-        nlink_t          i_nlink;
-        u32              i_ino;
-};
-
-struct kml_rec {
-	/* attribute of this record */
-	int 				rec_size;
-        int     			rec_kml_offset;
-
-	struct 	big_journal_prefix 	rec_head;
-	union {
-		struct kml_create 	create;
-		struct kml_open 	open;
-		struct kml_mkdir 	mkdir;
-		struct kml_unlink 	unlink;
-		struct kml_rmdir 	rmdir;
-		struct kml_close 	close;
-		struct kml_symlink 	symlink;
-		struct kml_rename 	rename;
-		struct kml_setattr 	setattr;
-		struct kml_mknod 	mknod;
-		struct kml_link 	link;
-		struct kml_endmark      endmark;
-	} rec_kml;
-        struct 	journal_suffix 		rec_tail;
-
-        /* for kml optimize only */
-        struct  kml_optimize kml_optimize;
-};
-
-/* kml record items for optimizing */
-extern void kml_kop_init (struct presto_file_set *fset);
-extern void kml_kop_addrec (struct presto_file_set *fset, 
-		struct inode *ino, u32 op, u32 flag);
-extern int  kml_kop_flush (struct presto_file_set *fset);
-
-/* defined in kml_setup.c */
-extern int kml_init (struct presto_file_set *fset);
-extern int kml_cleanup (struct presto_file_set *fset);
-
-/* defined in kml.c */
-extern int begin_kml_reint (struct file *file, unsigned long arg);
-extern int do_kml_reint (struct file *file, unsigned long arg);
-extern int end_kml_reint (struct file *file, unsigned long arg);
-
-/* kml_utils.c */
-extern char *dlogit (void *tbuf, const void *sbuf, int size);
-extern char * bdup_printf (char *format, ...);
-
-/* defined in kml_decode.c */
-/* printop */
-#define  PRINT_KML_PREFIX             0x1
-#define  PRINT_KML_SUFFIX             0x2
-#define  PRINT_KML_REC                0x4
-#define  PRINT_KML_OPTIMIZE           0x8
-#define  PRINT_KML_EXIST              0x10
-#define  PRINT_KML_DELETE             0x20
-extern void   kml_printrec (struct kml_rec *rec, int printop);
-extern int    print_allkmlrec (struct list_head *head, int printop);
-extern int    delete_kmlrec (struct list_head *head);
-extern int    kml_decoderec (char *buf, int pos, int buflen, int *size,
-	                     struct kml_rec **newrec);
-extern int decode_kmlrec (struct list_head *head, char *kml_buf, int buflen);
-extern void kml_freerec (struct kml_rec *rec);
-
-/* defined in kml_reint.c */
-#define KML_CLOSE_BACKFETCH            1
-extern int kml_reintbuf (struct  kml_fsdata *kml_fsdata,
-                  	char *mtpt, struct kml_rec **rec);
-
-/* defined in kml_setup.c */
-extern int kml_init (struct presto_file_set *fset);
-extern int kml_cleanup (struct presto_file_set *fset);
-
-#endif
-
diff -Nru a/fs/intermezzo/intermezzo_lib.h b/fs/intermezzo/intermezzo_lib.h
--- a/fs/intermezzo/intermezzo_lib.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,162 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Data structures unpacking/packing macros & inlines
- *
- */
-
-#ifndef _INTERMEZZO_LIB_H
-#define _INTERMEZZO_LIB_H
-
-#ifdef __KERNEL__
-# include <linux/types.h>
-#else
-# include <string.h>
-# include <sys/types.h>
-#endif
-
-static inline int size_round (int val)
-{
-	return (val + 3) & (~0x3);
-}
-
-static inline int size_round0(int val)
-{
-        if (!val) 
-                return 0;
-	return (val + 1 + 3) & (~0x3);
-}
-
-static inline size_t round_strlen(char *fset)
-{
-	return size_round(strlen(fset) + 1);
-}
-
-#ifdef __KERNEL__
-# define NTOH__u32(var) le32_to_cpu(var)
-# define NTOH__u64(var) le64_to_cpu(var)
-# define HTON__u32(var) cpu_to_le32(var)
-# define HTON__u64(var) cpu_to_le64(var)
-#else
-# include <glib.h>
-# define NTOH__u32(var) GUINT32_FROM_LE(var)
-# define NTOH__u64(var) GUINT64_FROM_LE(var)
-# define HTON__u32(var) GUINT32_TO_LE(var)
-# define HTON__u64(var) GUINT64_TO_LE(var)
-#endif
-
-/* 
- * copy sizeof(type) bytes from pointer to var and move ptr forward.
- * return EFAULT if pointer goes beyond end
- */
-#define UNLOGV(var,type,ptr,end)                \
-do {                                            \
-        var = *(type *)ptr;                     \
-        ptr += sizeof(type);                    \
-        if (ptr > end )                         \
-                return -EFAULT;                 \
-} while (0)
-
-/* the following two macros convert to little endian */
-/* type MUST be __u32 or __u64 */
-#define LUNLOGV(var,type,ptr,end)               \
-do {                                            \
-        var = NTOH##type(*(type *)ptr);         \
-        ptr += sizeof(type);                    \
-        if (ptr > end )                         \
-                return -EFAULT;                 \
-} while (0)
-
-/* now log values */
-#define LOGV(var,type,ptr)                      \
-do {                                            \
-        *((type *)ptr) = var;                   \
-        ptr += sizeof(type);                    \
-} while (0)
-
-/* and in network order */
-#define LLOGV(var,type,ptr)                     \
-do {                                            \
-        *((type *)ptr) = HTON##type(var);       \
-        ptr += sizeof(type);                    \
-} while (0)
-
-
-/* 
- * set var to point at (type *)ptr, move ptr forward with sizeof(type)
- * return from function with EFAULT if ptr goes beyond end
- */
-#define UNLOGP(var,type,ptr,end)                \
-do {                                            \
-        var = (type *)ptr;                      \
-        ptr += sizeof(type);                    \
-        if (ptr > end )                         \
-                return -EFAULT;                 \
-} while (0)
-
-#define LOGP(var,type,ptr)                      \
-do {                                            \
-        memcpy(ptr, var, sizeof(type));         \
-        ptr += sizeof(type);                    \
-} while (0)
-
-/* 
- * set var to point at (char *)ptr, move ptr forward by size_round(len);
- * return from function with EFAULT if ptr goes beyond end
- */
-#define UNLOGL(var,type,len,ptr,end)                    \
-do {                                                    \
-        if (len == 0)                                   \
-                var = (type *)0;                        \
-        else {                                          \
-                var = (type *)ptr;                      \
-                ptr += size_round(len * sizeof(type));  \
-        }                                               \
-        if (ptr > end )                                 \
-                return -EFAULT;                         \
-} while (0)
-
-#define UNLOGL0(var,type,len,ptr,end)                           \
-do {                                                            \
-        UNLOGL(var,type,len+1,ptr,end);                         \
-        if ( *((char *)ptr - size_round(len+1) + len) != '\0')  \
-                        return -EFAULT;                         \
-} while (0)
-
-#define LOGL(var,len,ptr)                               \
-do {                                                    \
-        size_t __fill = size_round(len);                \
-        /* Prevent data leakage. */                     \
-        if (__fill > 0)                                 \
-                memset((char *)ptr, 0, __fill);         \
-        memcpy((char *)ptr, (const char *)var, len);    \
-        ptr += __fill;                                  \
-} while (0)
-
-#define LOGL0(var,len,ptr)                              \
-do {                                                    \
-        if (!len) break;                                \
-        memcpy((char *)ptr, (const char *)var, len);    \
-        *((char *)(ptr) + len) = 0;                     \
-        ptr += size_round(len + 1);                     \
-} while (0)
-
-#endif /* _INTERMEZZO_LIB_H */
-
diff -Nru a/fs/intermezzo/intermezzo_psdev.h b/fs/intermezzo/intermezzo_psdev.h
--- a/fs/intermezzo/intermezzo_psdev.h	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,55 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- */
-
-#ifndef __PRESTO_PSDEV_H
-#define __PRESTO_PSDEV_H
-
-#define MAX_CHANNEL 16
-#define PROCNAME_SIZE 32
-#include <linux/smp_lock.h>
-
-/* represents state of an instance reached with /dev/intermezzo */
-/* communication pending & processing queues */
-struct upc_channel {
-        unsigned int         uc_seq;
-        wait_queue_head_t    uc_waitq;    /* Lento wait queue */
-        struct list_head     uc_pending;
-        struct list_head     uc_processing;
-        spinlock_t            uc_lock;
-        int                  uc_pid;      /* Lento's pid */
-        int                  uc_hard;     /* allows signals during upcalls */
-        int                  uc_no_filter;
-        int                  uc_no_journal;
-        int                  uc_no_upcall;
-        int                  uc_timeout;  /* . sec: signals will dequeue upc */
-        long                 uc_errorval; /* for testing I/O failures */
-        struct list_head     uc_cache_list;
-        int                  uc_minor;
-};
-
-#define ISLENTO(minor) (current->pid == izo_channels[minor].uc_pid \
-                || current->real_parent->pid == izo_channels[minor].uc_pid \
-                || current->real_parent->real_parent->pid == izo_channels[minor].uc_pid)
-
-extern struct upc_channel izo_channels[MAX_CHANNEL];
-
-/* message types between presto filesystem in kernel */
-#define REQ_READ   1
-#define REQ_WRITE  2
-#define REQ_ASYNC  4
-#define REQ_DEAD   8
-
-struct upc_req {
-        struct list_head   rq_chain;
-        caddr_t            rq_data;
-        int                rq_flags;
-        int                rq_bufsize;
-        int                rq_rep_size;
-        int                rq_opcode;  /* copied from data to save lookup */
-        int                rq_unique;
-        wait_queue_head_t  rq_sleep;   /* process' wait queue */
-        unsigned long      rq_posttime;
-};
-
-#endif
diff -Nru a/fs/intermezzo/intermezzo_upcall.h b/fs/intermezzo/intermezzo_upcall.h
--- a/fs/intermezzo/intermezzo_upcall.h	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,146 +0,0 @@
-/*
- * Based on cfs.h from Coda, but revamped for increased simplicity.
- * Linux modifications by Peter Braam, Aug 1996
- * Rewritten for InterMezzo
- */
-
-#ifndef _PRESTO_HEADER_
-#define _PRESTO_HEADER_
-
-
-/* upcall.c */
-#define SYNCHRONOUS 0
-#define ASYNCHRONOUS 1
-
-int lento_permit(int minor, int pathlen, int fsetnamelen, char *path, char *fset);
-int lento_opendir(int minor, int pathlen, char *path, int async);
-int lento_kml(int minor, unsigned int offset, unsigned int first_recno,
-              unsigned int length, unsigned int last_recno, int namelen,
-              char *fsetname);
-int lento_open(int minor, int pathlen, char *path);
-int lento_journal(int minor, char *page, int async);
-int lento_release_permit(int minor, int cookie);
-
-/*
- * Kernel <--> Lento communications.
- */
-/* upcalls */
-#define LENTO_PERMIT    1
-#define LENTO_JOURNAL   2
-#define LENTO_OPENDIR   3
-#define LENTO_OPEN      4
-#define LENTO_SIGNAL    5
-#define LENTO_KML       6
-#define LENTO_COOKIE    7
-
-/*         Lento <-> Presto  RPC arguments       */
-struct lento_up_hdr {
-        unsigned int opcode;
-        unsigned int unique;    /* Keep multiple outstanding msgs distinct */
-        u_short pid;            /* Common to all */
-        u_short uid;
-};
-
-/* This structure _must_ sit at the beginning of the buffer */
-struct lento_down_hdr {
-        unsigned int opcode;
-        unsigned int unique;    
-        unsigned int result;
-};
-
-/* lento_permit: */
-struct lento_permit_in {
-        struct lento_up_hdr uh;
-        int pathlen;
-        int fsetnamelen;
-        char path[0];
-};
-struct lento_permit_out {
-        struct lento_down_hdr dh;
-};
-
-
-/* lento_opendir: */
-struct lento_opendir_in {
-        struct lento_up_hdr uh;
-        int async;
-        int pathlen;
-        char path[0];
-};
-struct lento_opendir_out {
-        struct lento_down_hdr dh;
-};
-
-
-/* lento_kml: */
-struct lento_kml_in {
-        struct lento_up_hdr uh;
-        unsigned int offset;
-        unsigned int first_recno;
-        unsigned int length;
-        unsigned int last_recno;
-        int namelen;
-        char fsetname[0];
-};
-
-struct lento_kml_out {
-        struct lento_down_hdr dh;
-};
-
-
-/* lento_open: */
-struct lento_open_in {
-        struct lento_up_hdr uh;
-        int pathlen;
-        char path[0];
-};
-struct lento_open_out {
-    struct lento_down_hdr dh;
-};
-
-/* lento_response_cookie */
-struct lento_response_cookie_in {
-        struct lento_up_hdr uh;
-        int cookie;
-};
-
-struct lento_response_cookie_out {
-    struct lento_down_hdr dh;
-};
-
-
-struct lento_mknod {
-  struct lento_down_hdr dh;
-  int    major;
-  int    minor;
-  int    mode;
-  char   path[0];
-};
-
-
-/* NB: every struct below begins with an up_hdr */
-union up_args {
-    struct lento_up_hdr uh;             
-    struct lento_permit_in lento_permit;
-    struct lento_open_in lento_open;
-    struct lento_opendir_in lento_opendir;
-    struct lento_kml_in lento_kml;
-    struct lento_response_cookie_in lento_response_cookie;
-};
-
-union down_args {
-    struct lento_down_hdr dh;
-    struct lento_permit_out lento_permit;
-    struct lento_open_out lento_open;
-    struct lento_opendir_out lento_opendir;
-    struct lento_kml_out lento_kml;
-    struct lento_response_cookie_out lento_response_cookie;
-};    
-
-#include "intermezzo_psdev.h"
-
-int lento_upcall(int minor, int read_size, int *rep_size, 
-                 union up_args *buffer, int async,
-                 struct upc_req *rq );
-#endif 
-
diff -Nru a/fs/intermezzo/journal.c b/fs/intermezzo/journal.c
--- a/fs/intermezzo/journal.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2452 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1998 Peter J. Braam
- *  Copyright (C) 2001 Cluster File Systems, Inc. 
- *  Copyright (C) 2001 Tacit Networks, Inc. <phil@off.net>
- *
- *  Support for journalling extended attributes
- *  Copyright (C) 2001 Shirish H. Phatak, Tacit Networks, Inc.
- * 
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/namei.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/time.h>
-#include <linux/errno.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-struct presto_reservation_data {
-        unsigned int ri_recno;
-        loff_t ri_offset;
-        loff_t ri_size;
-        struct list_head ri_list;
-};
-
-/* 
- *  Locking Semantics
- * 
- * write lock in struct presto_log_fd: 
- *  - name: fd_lock
- *  - required for: accessing any field in a presto_log_fd 
- *  - may not be held across I/O
- *  - 
- *  
- */
-
-/*
- *  reserve record space and/or atomically request state of the log
- *  rec will hold the location reserved record upon return
- *  this reservation will be placed in the queue
- */ 
-static void presto_reserve_record(struct presto_file_set *fset, 
-                           struct presto_log_fd *fd, 
-                           struct rec_info *rec,
-                           struct presto_reservation_data *rd)
-{
-        int chunked_record = 0; 
-        ENTRY;
-        
-        write_lock(&fd->fd_lock);
-        if ( rec->is_kml ) { 
-                int chunk = 1 << fset->fset_chunkbits;
-                int chunk_mask = ~(chunk -1); 
-                loff_t boundary; 
-
-                boundary =  (fd->fd_offset + chunk - 1) & chunk_mask;
-                if ( fd->fd_offset + rec->size >= boundary ) {
-                        chunked_record = 1;
-                        fd->fd_offset = boundary; 
-                }
-        }
-
-        fd->fd_recno++;
-        
-        /* this moves the fd_offset back after truncation */ 
-        if ( list_empty(&fd->fd_reservations) && 
-             !chunked_record) { 
-                fd->fd_offset = fd->fd_file->f_dentry->d_inode->i_size;
-        }
-
-        rec->offset = fd->fd_offset;
-        if (rec->is_kml)
-                rec->offset += fset->fset_kml_logical_off;
-
-        rec->recno = fd->fd_recno;
-
-        /* add the reservation data to the end of the list */
-        rd->ri_offset = fd->fd_offset;
-        rd->ri_size = rec->size;
-        rd->ri_recno = rec->recno; 
-        list_add(&rd->ri_list, fd->fd_reservations.prev);
-
-        fd->fd_offset += rec->size;
-
-        write_unlock(&fd->fd_lock); 
-
-        EXIT;
-}
-
-static inline void presto_release_record(struct presto_log_fd *fd,
-                                         struct presto_reservation_data *rd)
-{
-        write_lock(&fd->fd_lock);
-        list_del(&rd->ri_list);
-        write_unlock(&fd->fd_lock);
-}
-
-/* XXX should we ask for do_truncate to be exported? */
-int izo_do_truncate(struct presto_file_set *fset, struct dentry *dentry,
-                    loff_t length,  loff_t size_check)
-{
-        struct inode *inode = dentry->d_inode;
-        int error;
-        struct iattr newattrs;
-
-        ENTRY;
-
-        if (length < 0) {
-                EXIT;
-                return -EINVAL;
-        }
-
-        down(&inode->i_sem);
-        lock_kernel();
-        
-        if (size_check != inode->i_size) { 
-                unlock_kernel();
-                up(&inode->i_sem);
-                EXIT;
-                return -EALREADY; 
-        }
-
-        newattrs.ia_size = length;
-        newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
-
-        if (inode->i_op && inode->i_op->setattr)
-                error = inode->i_op->setattr(dentry, &newattrs);
-        else {
-                inode_setattr(dentry->d_inode, &newattrs);
-                error = 0;
-        }
-
-        unlock_kernel();
-        up(&inode->i_sem);
-        EXIT;
-        return error;
-}
-
-static void presto_kml_truncate(struct presto_file_set *fset)
-{
-        int rc;
-        ENTRY;
-
-        write_lock(&fset->fset_kml.fd_lock);
-        if (fset->fset_kml.fd_truncating == 1 ) {
-                write_unlock(&fset->fset_kml.fd_lock);
-                EXIT;
-                return;
-        }
-
-        fset->fset_kml.fd_truncating = 1;
-        write_unlock(&fset->fset_kml.fd_lock);
-
-        CERROR("islento: %d, count: %d\n",
-               ISLENTO(presto_i2m(fset->fset_dentry->d_inode)),
-               fset->fset_permit_count);
-
-        rc = izo_upc_kml_truncate(fset->fset_cache->cache_psdev->uc_minor,
-                                fset->fset_lento_off, fset->fset_lento_recno,
-                                fset->fset_name);
-
-        /* Userspace is the only permitholder now, and will retain an exclusive
-         * hold on the permit until KML truncation completes. */
-        /* FIXME: double check this code path now that the precise semantics of
-         * fset->fset_permit_count have changed. */
-
-        if (rc != 0) {
-                write_lock(&fset->fset_kml.fd_lock);
-                fset->fset_kml.fd_truncating = 0;
-                write_unlock(&fset->fset_kml.fd_lock);
-        }
-
-        EXIT;
-}
-
-void *presto_trans_start(struct presto_file_set *fset, struct inode *inode,
-                         int op)
-{
-        ENTRY;
-        if ( !fset->fset_cache->cache_filter->o_trops ) {
-                EXIT;
-                return NULL;
-        }
-        EXIT;
-        return fset->fset_cache->cache_filter->o_trops->tr_start
-                (fset, inode, op);
-}
-
-void presto_trans_commit(struct presto_file_set *fset, void *handle)
-{
-        ENTRY;
-        if (!fset->fset_cache->cache_filter->o_trops ) {
-                EXIT;
-                return;
-        }
-
-        fset->fset_cache->cache_filter->o_trops->tr_commit(fset, handle);
-
-        /* Check to see if the KML needs truncated. */
-        if (fset->kml_truncate_size > 0 &&
-            !fset->fset_kml.fd_truncating &&
-            fset->fset_kml.fd_offset > fset->kml_truncate_size) {
-                CDEBUG(D_JOURNAL, "kml size: %lu; truncating\n",
-                       (unsigned long)fset->fset_kml.fd_offset);
-                presto_kml_truncate(fset);
-        }
-        EXIT;
-}
-
-inline int presto_no_journal(struct presto_file_set *fset)
-{
-        int minor = fset->fset_cache->cache_psdev->uc_minor;
-        return izo_channels[minor].uc_no_journal;
-}
-
-#define size_round(x)  (((x)+3) & ~0x3)
-
-#define BUFF_FREE(buf) PRESTO_FREE(buf, PAGE_SIZE)
-#define BUFF_ALLOC(newbuf, oldbuf)              \
-        PRESTO_ALLOC(newbuf, PAGE_SIZE);        \
-        if ( !newbuf ) {                        \
-                if (oldbuf)                     \
-                        BUFF_FREE(oldbuf);      \
-                return -ENOMEM;                 \
-        }
-
-/*
- * "buflen" should be PAGE_SIZE or more.
- * Give relative path wrt to a fsetroot
- */
-char * presto_path(struct dentry *dentry, struct dentry *root,
-                   char *buffer, int buflen)
-{
-        char * end = buffer+buflen;
-        char * retval;
-
-        *--end = '\0';
-        buflen--;
-        if (dentry->d_parent != dentry && d_unhashed(dentry)) {
-                buflen -= 10;
-                end -= 10;
-                memcpy(end, " (deleted)", 10);
-        }
-
-        /* Get '/' right */
-        retval = end-1;
-        *retval = '/';
-
-        for (;;) {
-                struct dentry * parent;
-                int namelen;
-
-                if (dentry == root)
-                        break;
-                parent = dentry->d_parent;
-                if (dentry == parent)
-                        break;
-                namelen = dentry->d_name.len;
-                buflen -= namelen + 1;
-                if (buflen < 0)
-                        break;
-                end -= namelen;
-                memcpy(end, dentry->d_name.name, namelen);
-                *--end = '/';
-                retval = end;
-                dentry = parent;
-        }
-        return retval;
-}
-
-static inline char *logit(char *buf, const void *value, int size)
-{
-        char *ptr = (char *)value;
-
-        memcpy(buf, ptr, size);
-        buf += size;
-        return buf;
-}
-
-
-static inline char *
-journal_log_prefix_with_groups_and_ids(char *buf, int opcode, 
-                                       struct rec_info *rec,
-                                       __u32 ngroups, gid_t *groups,
-                                       __u32 fsuid, __u32 fsgid)
-{
-        struct kml_prefix_hdr p;
-        u32 loggroups[NGROUPS_SMALL];
-
-        int i; 
-
-        p.len = cpu_to_le32(rec->size);
-        p.version = KML_MAJOR_VERSION | KML_MINOR_VERSION;
-        p.pid = cpu_to_le32(current->pid);
-        p.auid = cpu_to_le32(current->uid);
-        p.fsuid = cpu_to_le32(fsuid);
-        p.fsgid = cpu_to_le32(fsgid);
-        p.ngroups = cpu_to_le32(ngroups);
-        p.opcode = cpu_to_le32(opcode);
-        for (i=0 ; i < ngroups ; i++)
-                loggroups[i] = cpu_to_le32((__u32) groups[i]);
-
-        buf = logit(buf, &p, sizeof(struct kml_prefix_hdr));
-        buf = logit(buf, &loggroups, sizeof(__u32) * ngroups);
-        return buf;
-}
-
-static inline char *
-journal_log_prefix(char *buf, int opcode, struct rec_info *rec)
-{
-        __u32 groups[NGROUPS_SMALL]; 
-        int i; 
-
-        /* convert 16 bit gid's to 32 bit gid's */
-        for (i=0; i<current->group_info->ngroups; i++) 
-                groups[i] = GROUP_AT(current->group_info,i);
-        
-        return journal_log_prefix_with_groups_and_ids(buf, opcode, rec,
-                                                      (__u32)current->group_info->ngroups,
-                                                      groups,
-                                                      (__u32)current->fsuid,
-                                                      (__u32)current->fsgid);
-}
-
-static inline char *
-journal_log_prefix_with_groups(char *buf, int opcode, struct rec_info *rec, 
-                               __u32 ngroups, gid_t *groups)
-{
-        return journal_log_prefix_with_groups_and_ids(buf, opcode, rec,
-                                                      ngroups, groups,
-                                                      (__u32)current->fsuid,
-                                                      (__u32)current->fsgid);
-}
-
-static inline char *log_dentry_version(char *buf, struct dentry *dentry)
-{
-        struct presto_version version;
-
-        presto_getversion(&version, dentry->d_inode);
-        
-        version.pv_mtime_sec = HTON__u32(version.pv_mtime_sec);
-        version.pv_ctime_sec = HTON__u32(version.pv_ctime_sec);
-        version.pv_mtime_nsec = HTON__u32(version.pv_mtime_nsec);
-        version.pv_ctime_nsec = HTON__u32(version.pv_ctime_nsec);
-        version.pv_size = HTON__u64(version.pv_size);
-
-        return logit(buf, &version, sizeof(version));
-}
-
-static inline char *log_version(char *buf, struct presto_version *pv)
-{
-        struct presto_version version;
-
-        memcpy(&version, pv, sizeof(version));
-        
-        version.pv_mtime_sec = HTON__u32(version.pv_mtime_sec);
-        version.pv_mtime_nsec = HTON__u32(version.pv_mtime_nsec);
-        version.pv_ctime_sec = HTON__u32(version.pv_ctime_sec);
-        version.pv_ctime_nsec = HTON__u32(version.pv_ctime_nsec);
-        version.pv_size = HTON__u64(version.pv_size);
-
-        return logit(buf, &version, sizeof(version));
-}
-
-static inline char *log_rollback(char *buf, struct izo_rollback_data *rb)
-{
-        struct izo_rollback_data rollback;
-        
-        rollback.rb_mode = HTON__u32(rb->rb_mode);
-        rollback.rb_rdev = HTON__u32(rb->rb_rdev);
-        rollback.rb_uid = HTON__u64(rb->rb_uid);
-        rollback.rb_gid = HTON__u64(rb->rb_gid);
-
-        return logit(buf, &rollback, sizeof(rollback));
-}
-
-static inline char *journal_log_suffix(char *buf, char *log,
-                                       struct presto_file_set *fset,
-                                       struct dentry *dentry,
-                                       struct rec_info *rec)
-{
-        struct kml_suffix s;
-        struct kml_prefix_hdr *p = (struct kml_prefix_hdr *)log;
-
-#if 0
-        /* XXX needs to be done after reservation, 
-           disable ths until version 1.2 */
-        if ( dentry ) { 
-                s.prevrec = cpu_to_le32(rec->offset - 
-                                        presto_d2d(dentry)->dd_kml_offset);
-                presto_d2d(dentry)->dd_kml_offset = rec->offset;
-        } else { 
-                s.prevrec = -1;
-        }
-#endif
-        s.prevrec = 0; 
-
-        /* record number needs to be filled in after reservation 
-           s.recno = cpu_to_le32(rec->recno); */ 
-        s.time = cpu_to_le32(get_seconds());
-        s.len = p->len;
-        return logit(buf, &s, sizeof(s));
-}
-
-int izo_log_close(struct presto_log_fd *logfd)
-{
-        int rc = 0;
-
-        if (logfd->fd_file) {
-                rc = filp_close(logfd->fd_file, 0);
-                logfd->fd_file = NULL;
-        } else
-                CERROR("InterMezzo: %s: no filp\n", __FUNCTION__);
-        if (rc != 0)
-                CERROR("InterMezzo: close files: filp won't close: %d\n", rc);
-
-        return rc;
-}
-
-int presto_fwrite(struct file *file, const char *str, int len, loff_t *off)
-{
-        int rc;
-        mm_segment_t old_fs;
-        ENTRY;
-
-        rc = -EINVAL;
-        if ( !off ) {
-                EXIT;
-                return rc;
-        }
-
-        if ( ! file ) {
-                EXIT;
-                return rc;
-        }
-
-        if ( ! file->f_op ) {
-                EXIT;
-                return rc;
-        }
-
-        if ( ! file->f_op->write ) {
-                EXIT;
-                return rc;
-        }
-
-        old_fs = get_fs();
-        set_fs(get_ds());
-        rc = file->f_op->write(file, str, len, off);
-        if (rc != len) {
-                CERROR("presto_fwrite: wrote %d bytes instead of "
-                       "%d at %ld\n", rc, len, (long)*off);
-                rc = -EIO; 
-        }
-        set_fs(old_fs);
-        EXIT;
-        return rc;
-}
-
-int presto_fread(struct file *file, char *str, int len, loff_t *off)
-{
-        int rc;
-        mm_segment_t old_fs;
-        ENTRY;
-
-        if (len > 512)
-                CERROR("presto_fread: read at %Ld for %d bytes, ino %ld\n",
-                       *off, len, file->f_dentry->d_inode->i_ino); 
-
-        rc = -EINVAL;
-        if ( !off ) {
-                EXIT;
-                return rc;
-        }
-
-        if ( ! file ) {
-                EXIT;
-                return rc;
-        }
-
-        if ( ! file->f_op ) {
-                EXIT;
-                return rc;
-        }
-
-        if ( ! file->f_op->read ) {
-                EXIT;
-                return rc;
-        }
-
-        old_fs = get_fs();
-        set_fs(get_ds());
-        rc = file->f_op->read(file, str, len, off);
-        if (rc != len) {
-                CDEBUG(D_FILE, "presto_fread: read %d bytes instead of "
-                       "%d at %Ld\n", rc, len, *off);
-                rc = -EIO; 
-        }
-        set_fs(old_fs);
-        EXIT;
-        return rc;
-}
-
-loff_t presto_kml_offset(struct presto_file_set *fset)
-{
-        unsigned int kml_recno;
-        struct presto_log_fd *fd = &fset->fset_kml;
-        loff_t  offset;
-        ENTRY;
-
-        write_lock(&fd->fd_lock); 
-
-        /* Determine the largest valid offset, i.e. up until the first
-         * reservation held on the file. */
-        if ( !list_empty(&fd->fd_reservations) ) {
-                struct presto_reservation_data *rd;
-                rd = list_entry(fd->fd_reservations.next, 
-                                struct presto_reservation_data, 
-                                ri_list);
-                offset = rd->ri_offset;
-                kml_recno = rd->ri_recno;
-        } else {
-                offset = fd->fd_file->f_dentry->d_inode->i_size;
-                kml_recno = fset->fset_kml.fd_recno; 
-        }
-        write_unlock(&fd->fd_lock); 
-        return offset; 
-}
-
-static int presto_kml_dispatch(struct presto_file_set *fset)
-{
-        int rc = 0;
-        unsigned int kml_recno;
-        struct presto_log_fd *fd = &fset->fset_kml;
-        loff_t offset;
-        ENTRY;
-
-        write_lock(&fd->fd_lock); 
-
-        /* Determine the largest valid offset, i.e. up until the first
-         * reservation held on the file. */
-        if ( !list_empty(&fd->fd_reservations) ) {
-                struct presto_reservation_data *rd;
-                rd = list_entry(fd->fd_reservations.next, 
-                                struct presto_reservation_data, 
-                                ri_list);
-                offset = rd->ri_offset;
-                kml_recno = rd->ri_recno;
-        } else {
-                offset = fd->fd_file->f_dentry->d_inode->i_size;
-                kml_recno = fset->fset_kml.fd_recno; 
-        }
-
-        if ( kml_recno < fset->fset_lento_recno ) {
-                CERROR("presto_kml_dispatch: smoke is coming\n"); 
-                write_unlock(&fd->fd_lock);
-                EXIT;
-                return 0; 
-        } else if ( kml_recno == fset->fset_lento_recno ) {
-                write_unlock(&fd->fd_lock);
-                EXIT;
-                return 0; 
-                /* XXX add a further "if" here to delay the KML upcall */ 
-#if 0
-        } else if ( kml_recno < fset->fset_lento_recno + 100) {
-                write_unlock(&fd->fd_lock);
-                EXIT;
-                return 0;
-#endif
-        }
-        CDEBUG(D_PIOCTL, "fset: %s\n", fset->fset_name);
-
-        rc = izo_upc_kml(fset->fset_cache->cache_psdev->uc_minor,
-                       fset->fset_lento_off, fset->fset_lento_recno,
-                       offset + fset->fset_kml_logical_off, kml_recno,
-                       fset->fset_name);
-
-        if ( rc ) {
-                write_unlock(&fd->fd_lock);
-                EXIT;
-                return rc;
-        }
-
-        fset->fset_lento_off = offset;
-        fset->fset_lento_recno = kml_recno; 
-        write_unlock(&fd->fd_lock);
-        EXIT;
-        return 0;
-}
-
-int izo_lookup_file(struct presto_file_set *fset, char *path,
-                    struct nameidata *nd)
-{
-        int error = 0;
-
-        CDEBUG(D_CACHE, "looking up: %s\n", path);
-
-        error = path_lookup(path, LOOKUP_PARENT, nd);
-        if (error) {
-                EXIT;
-                return error;
-        }
-
-        return 0;
-}
-
-/* FIXME: this function is a mess of locking and error handling.  There's got to
- * be a better way. */
-static int do_truncate_rename(struct presto_file_set *fset, char *oldname,
-                              char *newname)
-{
-        struct dentry *old_dentry, *new_dentry;
-        struct nameidata oldnd, newnd;
-        char *oldpath, *newpath;
-        int error;
-
-        ENTRY;
-
-        oldpath = izo_make_path(fset, oldname);
-        if (oldpath == NULL) {
-                EXIT;
-                return -ENOENT;
-        }
-
-        newpath = izo_make_path(fset, newname);
-        if (newpath == NULL) {
-                error = -ENOENT;
-                EXIT;
-                goto exit;
-        }
-
-        if ((error = izo_lookup_file(fset, oldpath, &oldnd)) != 0) {
-                EXIT;
-                goto exit1;
-        }
-
-        if ((error = izo_lookup_file(fset, newpath, &newnd)) != 0) {
-                EXIT;
-                goto exit2;
-        }
-
-        lock_rename(newnd.dentry, oldnd.dentry);
-        old_dentry = lookup_hash(&oldnd.last, oldnd.dentry);
-        error = PTR_ERR(old_dentry);
-        if (IS_ERR(old_dentry)) {
-                EXIT;
-                goto exit3;
-        }
-        error = -ENOENT;
-        if (!old_dentry->d_inode) {
-                EXIT;
-                goto exit4;
-        }
-        new_dentry = lookup_hash(&newnd.last, newnd.dentry);
-        error = PTR_ERR(new_dentry);
-        if (IS_ERR(new_dentry)) {
-                EXIT;
-                goto exit4;
-        }
-
-        {
-        extern int presto_rename(struct inode *old_dir,struct dentry *old_dentry,
-                                struct inode *new_dir,struct dentry *new_dentry);
-        error = presto_rename(old_dentry->d_parent->d_inode, old_dentry,
-                              new_dentry->d_parent->d_inode, new_dentry);
-        }
-
-        dput(new_dentry);
-        EXIT;
- exit4:
-        dput(old_dentry);
- exit3:
-        unlock_rename(newnd.dentry, oldnd.dentry);
-        path_release(&newnd);
- exit2:
-        path_release(&oldnd);
- exit1:
-        PRESTO_FREE(newpath, strlen(newpath) + 1);
- exit:
-        PRESTO_FREE(oldpath, strlen(oldpath) + 1);
-        return error;
-}
-
-/* This function is called with the fset->fset_kml.fd_lock held */
-int presto_finish_kml_truncate(struct presto_file_set *fset,
-                               unsigned long int offset)
-{
-        struct lento_vfs_context info;
-        void *handle;
-        struct file *f;
-        struct dentry *dentry;
-        int error = 0, len;
-        struct nameidata nd;
-        char *kmlpath = NULL, *smlpath = NULL;
-        ENTRY;
-
-        if (offset == 0) {
-                /* Lento couldn't do what it needed to; abort the truncation. */
-                fset->fset_kml.fd_truncating = 0;
-                EXIT;
-                return 0;
-        }
-
-        /* someone is about to write to the end of the KML; try again later. */
-        if ( !list_empty(&fset->fset_kml.fd_reservations) ) {
-                EXIT;
-                return -EAGAIN;
-        }
-
-        f = presto_copy_kml_tail(fset, offset);
-        if (IS_ERR(f)) {
-                EXIT;
-                return PTR_ERR(f);
-        }                        
-
-        /* In a single transaction:
-         *
-         *   - unlink 'kml'
-         *   - rename 'kml_tmp' to 'kml'
-         *   - unlink 'sml'
-         *   - rename 'sml_tmp' to 'sml'
-         *   - rewrite the first record of last_rcvd with the new kml
-         *     offset.
-         */
-        handle = presto_trans_start(fset, fset->fset_dentry->d_inode,
-                                    KML_OPCODE_KML_TRUNC);
-        if (IS_ERR(handle)) {
-                presto_release_space(fset->fset_cache, PRESTO_REQLOW);
-                CERROR("ERROR: presto_finish_kml_truncate: no space for transaction\n");
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memset(&info, 0, sizeof(info));
-        info.flags = LENTO_FL_IGNORE_TIME;
-
-        kmlpath = izo_make_path(fset, "kml");
-        if (kmlpath == NULL) {
-                error = -ENOMEM;
-                CERROR("make_path failed: ENOMEM\n");
-                EXIT;
-                goto exit_commit;
-        }
-
-        if ((error = izo_lookup_file(fset, kmlpath, &nd)) != 0) {
-                CERROR("izo_lookup_file(kml) failed: %d.\n", error);
-                EXIT;
-                goto exit_commit;
-        }
-        down(&nd.dentry->d_inode->i_sem);
-        dentry = lookup_hash(&nd.last, nd.dentry);
-        error = PTR_ERR(dentry);
-        if (IS_ERR(dentry)) {
-                up(&nd.dentry->d_inode->i_sem);
-                path_release(&nd);
-                CERROR("lookup_hash failed\n");
-                EXIT;
-                goto exit_commit;
-        }
-        error = presto_do_unlink(fset, dentry->d_parent, dentry, &info);
-        dput(dentry);
-        up(&nd.dentry->d_inode->i_sem);
-        path_release(&nd);
-
-        if (error != 0) {
-                CERROR("presto_do_unlink(kml) failed: %d.\n", error);
-                EXIT;
-                goto exit_commit;
-        }
-
-        smlpath = izo_make_path(fset, "sml");
-        if (smlpath == NULL) {
-                error = -ENOMEM;
-                CERROR("make_path() failed: ENOMEM\n");
-                EXIT;
-                goto exit_commit;
-        }
-
-        if ((error = izo_lookup_file(fset, smlpath, &nd)) != 0) {
-                CERROR("izo_lookup_file(sml) failed: %d.\n", error);
-                EXIT;
-                goto exit_commit;
-        }
-        down(&nd.dentry->d_inode->i_sem);
-        dentry = lookup_hash(&nd.last, nd.dentry);
-        error = PTR_ERR(dentry);
-        if (IS_ERR(dentry)) {
-                up(&nd.dentry->d_inode->i_sem);
-                path_release(&nd);
-                CERROR("lookup_hash failed\n");
-                EXIT;
-                goto exit_commit;
-        }
-        error = presto_do_unlink(fset, dentry->d_parent, dentry, &info);
-        dput(dentry);
-        up(&nd.dentry->d_inode->i_sem);
-        path_release(&nd);
-
-        if (error != 0) {
-                CERROR("presto_do_unlink(sml) failed: %d.\n", error);
-                EXIT;
-                goto exit_commit;
-        }
-
-        error = do_truncate_rename(fset, "kml_tmp", "kml");
-        if (error != 0)
-                CERROR("do_truncate_rename(kml_tmp, kml) failed: %d\n", error);
-        error = do_truncate_rename(fset, "sml_tmp", "sml");
-        if (error != 0)
-                CERROR("do_truncate_rename(sml_tmp, sml) failed: %d\n", error);
-
-        /* Write a new 'last_rcvd' record with the new KML offset */
-        fset->fset_kml_logical_off += offset;
-        CDEBUG(D_CACHE, "new kml_logical_offset: %Lu\n",
-               fset->fset_kml_logical_off);
-        if (presto_write_kml_logical_offset(fset) != 0) {
-                CERROR("presto_write_kml_logical_offset failed\n");
-        }
-
-        presto_trans_commit(fset, handle);
-
-        /* Everything was successful, so swap the KML file descriptors */
-        filp_close(fset->fset_kml.fd_file, NULL);
-        fset->fset_kml.fd_file = f;
-        fset->fset_kml.fd_offset -= offset;
-        fset->fset_kml.fd_truncating = 0;
-
-        EXIT;
-        return 0;
-
- exit_commit:
-        presto_trans_commit(fset, handle);
-        len = strlen("/.intermezzo/") + strlen(fset->fset_name) +strlen("sml");
-        if (kmlpath != NULL)
-                PRESTO_FREE(kmlpath, len);
-        if (smlpath != NULL)
-                PRESTO_FREE(smlpath, len);
-        return error;
-}
-
-/* structure of an extended log record:
-
-   buf-prefix  buf-body [string1 [string2 [string3]]] buf-suffix
-
-   note: moves offset forward
-*/
-static inline int presto_write_record(struct file *f, loff_t *off,
-                        const char *buf, size_t size,
-                        const char *string1, int len1, 
-                        const char *string2, int len2,
-                        const char *string3, int len3)
-{
-        size_t prefix_size; 
-        int rc;
-
-        prefix_size = size - sizeof(struct kml_suffix);
-        rc = presto_fwrite(f, buf, prefix_size, off);
-        if ( rc != prefix_size ) {
-                CERROR("Write error!\n");
-                EXIT;
-                return -EIO;
-        }
-
-        if  ( string1  && len1 ) {
-                rc = presto_fwrite(f, string1, len1, off);
-                if ( rc != len1 ) {
-                        CERROR("Write error!\n");
-                        EXIT;
-                        return -EIO;
-                }
-        }
-
-        if  ( string2 && len2 ) {
-                rc = presto_fwrite(f, string2, len2, off);
-                if ( rc != len2 ) {
-                        CERROR("Write error!\n");
-                        EXIT;
-                        return -EIO;
-                }
-        }
-
-        if  ( string3 && len3 ) {
-                rc = presto_fwrite(f, string3, len3, off);
-                if ( rc != len3 ) {
-                        CERROR("Write error!\n");
-                        EXIT;
-                        return -EIO;
-                }
-        }
-
-        rc = presto_fwrite(f, buf + prefix_size,
-                           sizeof(struct kml_suffix), off);
-        if ( rc != sizeof(struct kml_suffix) ) {
-                CERROR("Write error!\n");
-                EXIT;
-                return -EIO;
-        }
-        return 0;
-}
-
-
-/*
- * rec->size must be valid prior to calling this function.
- *
- * had to export this for branch_reinter in kml_reint.c 
- */
-int presto_log(struct presto_file_set *fset, struct rec_info *rec,
-               const char *buf, size_t size,
-               const char *string1, int len1, 
-               const char *string2, int len2,
-               const char *string3, int len3)
-{
-        int rc;
-        struct presto_reservation_data rd;
-        loff_t offset;
-        struct presto_log_fd *fd;
-        struct kml_suffix *s;
-        int prefix_size; 
-
-        ENTRY;
-
-        /* buf is NULL when no_journal is in effect */
-        if (!buf) {
-                EXIT;
-                return -EINVAL;
-        }
-
-        if (rec->is_kml) {
-                fd = &fset->fset_kml;
-        } else {
-                fd = &fset->fset_lml;
-        }
-
-        presto_reserve_record(fset, fd, rec, &rd);
-
-        if (rec->is_kml) {
-                if (rec->offset < fset->fset_kml_logical_off) {
-                        CERROR("record with pre-trunc offset.  tell phil.\n");
-                        BUG();
-                }
-                offset = rec->offset - fset->fset_kml_logical_off;
-        } else {
-                offset = rec->offset;
-        }
-
-        /* now we know the record number */ 
-        prefix_size = size - sizeof(struct kml_suffix);
-        s = (struct kml_suffix *) (buf + prefix_size); 
-        s->recno = cpu_to_le32(rec->recno); 
-
-        rc = presto_write_record(fd->fd_file, &offset, buf, size, 
-                                 string1, len1, string2, len2, string3, len3); 
-        if (rc) {
-                CERROR("presto: error writing record to %s\n",
-                        rec->is_kml ? "KML" : "LML"); 
-                return rc;
-        }
-        presto_release_record(fd, &rd);
-
-        rc = presto_kml_dispatch(fset);
-
-        EXIT;
-        return rc;
-}
-
-/* read from the record at tail */
-static int presto_last_record(struct presto_log_fd *fd, loff_t *size, 
-                             loff_t *tail_offset, __u32 *recno, loff_t tail)
-{
-        struct kml_suffix suffix;
-        int rc;
-        loff_t zeroes;
-
-        *recno = 0;
-        *tail_offset = 0;
-        *size = 0;
-        
-        if (tail < sizeof(struct kml_prefix_hdr) + sizeof(suffix)) {
-                EXIT;
-                return 0;
-        }
-
-        zeroes = tail - sizeof(int);
-        while ( zeroes >= 0 ) {
-                int data;
-                rc = presto_fread(fd->fd_file, (char *)&data, sizeof(data), 
-                                  &zeroes);
-                if ( rc != sizeof(data) ) { 
-                        rc = -EIO;
-                        return rc;
-                }
-                if (data)
-                        break;
-                zeroes -= 2 * sizeof(data);
-        }
-
-        /* zeroes at the begining of file. this is needed to prevent
-           presto_fread errors  -SHP
-        */
-        if (zeroes <= 0) return 0;
-                       
-        zeroes -= sizeof(suffix) + sizeof(int);
-        rc = presto_fread(fd->fd_file, (char *)&suffix, sizeof(suffix), &zeroes);
-        if ( rc != sizeof(suffix) ) {
-                EXIT;
-                return rc;
-        }
-        if ( suffix.len > 500 ) {
-                CERROR("InterMezzo: Warning long record tail at %ld, rec tail_offset at %ld (size %d)\n", 
-                        (long) zeroes, (long)*tail_offset, suffix.len); 
-        }
-
-        *recno = suffix.recno;
-        *size = suffix.len;
-        *tail_offset = zeroes;
-        return 0;
-}
-
-static int izo_kml_last_recno(struct presto_log_fd *logfd)
-{
-        int rc; 
-        loff_t size;
-        loff_t tail_offset;
-        int recno;
-        loff_t tail = logfd->fd_file->f_dentry->d_inode->i_size;
-
-        rc = presto_last_record(logfd, &size, &tail_offset, &recno, tail);
-        if (rc != 0) {
-                EXIT;
-                return rc;
-        }
-
-        logfd->fd_offset = tail_offset;
-        logfd->fd_recno = recno;
-        CDEBUG(D_JOURNAL, "setting fset_kml->fd_recno to %d, offset  %Ld\n",
-               recno, tail_offset); 
-        EXIT;
-        return 0;
-}
-
-struct file *izo_log_open(struct presto_file_set *fset, char *name, int flags)
-{
-        struct presto_cache *cache = fset->fset_cache;
-        struct file *f;
-        int error;
-        ENTRY;
-
-        f = izo_fset_open(fset, name, flags, 0644);
-        error = PTR_ERR(f);
-        if (IS_ERR(f)) {
-                EXIT;
-                return f;
-        }
-
-        error = -EINVAL;
-        if ( cache != presto_get_cache(f->f_dentry->d_inode) ) {
-                CERROR("InterMezzo: %s cache does not match fset cache!\n",name);
-                fset->fset_kml.fd_file = NULL;
-                filp_close(f, NULL);
-                f = NULL;
-                EXIT;
-                return f;
-        }
-
-        if (cache->cache_filter &&  cache->cache_filter->o_trops &&
-            cache->cache_filter->o_trops->tr_journal_data) {
-                cache->cache_filter->o_trops->tr_journal_data
-                        (f->f_dentry->d_inode);
-        } else {
-                CERROR("InterMezzo WARNING: no file data logging!\n"); 
-        }
-
-        EXIT;
-
-        return f;
-}
-
-int izo_init_kml_file(struct presto_file_set *fset, struct presto_log_fd *logfd)
-{
-        int error = 0;
-        struct file *f;
-
-        ENTRY;
-        if (logfd->fd_file) {
-                CDEBUG(D_INODE, "fset already has KML open\n");
-                EXIT;
-                return 0;
-        }
-
-        logfd->fd_lock = RW_LOCK_UNLOCKED;
-        INIT_LIST_HEAD(&logfd->fd_reservations); 
-        f = izo_log_open(fset, "kml",  O_RDWR | O_CREAT);
-        if (IS_ERR(f)) {
-                error = PTR_ERR(f);
-                return error;
-        }
-
-        logfd->fd_file = f;
-        error = izo_kml_last_recno(logfd);
-
-        if (error) {
-                logfd->fd_file = NULL;
-                filp_close(f, NULL);
-                CERROR("InterMezzo: IO error in KML of fset %s\n",
-                       fset->fset_name);
-                EXIT;
-                return error;
-        }
-        fset->fset_lento_off = logfd->fd_offset;
-        fset->fset_lento_recno = logfd->fd_recno;
-
-        EXIT;
-        return error;
-}
-
-int izo_init_last_rcvd_file(struct presto_file_set *fset, struct presto_log_fd *logfd)
-{
-        int error = 0;
-        struct file *f;
-        struct rec_info recinfo;
-
-        ENTRY;
-        if (logfd->fd_file != NULL) {
-                CDEBUG(D_INODE, "fset already has last_rcvd open\n");
-                EXIT;
-                return 0;
-        }
-
-        logfd->fd_lock = RW_LOCK_UNLOCKED;
-        INIT_LIST_HEAD(&logfd->fd_reservations); 
-        f = izo_log_open(fset, "last_rcvd", O_RDWR | O_CREAT);
-        if (IS_ERR(f)) {
-                error = PTR_ERR(f);
-                return error;
-        }
-
-        logfd->fd_file = f;
-        logfd->fd_offset = f->f_dentry->d_inode->i_size;
-
-        error = izo_rep_cache_init(fset);
-
-        if (presto_read_kml_logical_offset(&recinfo, fset) == 0) {
-                fset->fset_kml_logical_off = recinfo.offset;
-        } else {
-                /* The 'last_rcvd' file doesn't contain a kml offset record,
-                 * probably because we just created 'last_rcvd'.  Write one. */
-                fset->fset_kml_logical_off = 0;
-                presto_write_kml_logical_offset(fset);
-        }
-
-        EXIT;
-        return error;
-}
-
-int izo_init_lml_file(struct presto_file_set *fset, struct presto_log_fd *logfd)
-{
-        int error = 0;
-        struct file *f;
-
-        ENTRY;
-        if (logfd->fd_file) {
-                CDEBUG(D_INODE, "fset already has lml open\n");
-                EXIT;
-                return 0;
-        }
-
-        logfd->fd_lock = RW_LOCK_UNLOCKED;
-        INIT_LIST_HEAD(&logfd->fd_reservations); 
-        f = izo_log_open(fset, "lml", O_RDWR | O_CREAT);
-        if (IS_ERR(f)) {
-                error = PTR_ERR(f);
-                return error;
-        }
-
-        logfd->fd_file = f;
-        logfd->fd_offset = f->f_dentry->d_inode->i_size;
-
-        EXIT;
-        return error;
-}
-
-/* Get the KML-offset record from the last_rcvd file */
-int presto_read_kml_logical_offset(struct rec_info *recinfo,
-                                   struct presto_file_set *fset)
-{
-        loff_t off;
-        struct izo_rcvd_rec rec;
-        char uuid[16] = {0};
-
-        off = izo_rcvd_get(&rec, fset, uuid);
-        if (off < 0)
-                return -1;
-
-        recinfo->offset = rec.lr_local_offset;
-        return 0;
-}
-
-int presto_write_kml_logical_offset(struct presto_file_set *fset)
-{
-        loff_t rc;
-        struct izo_rcvd_rec rec;
-        char uuid[16] = {0};
-
-        rc = izo_rcvd_get(&rec, fset, uuid);
-        if (rc < 0)
-                memset(&rec, 0, sizeof(rec));
-
-        rec.lr_local_offset =
-                cpu_to_le64(fset->fset_kml_logical_off);
-
-        return izo_rcvd_write(fset, &rec);
-}
-
-struct file * presto_copy_kml_tail(struct presto_file_set *fset,
-                                   unsigned long int start)
-{
-        struct file *f;
-        int len;
-        loff_t read_off, write_off, bytes;
-
-        ENTRY;
-
-        /* Copy the tail of 'kml' to 'kml_tmp' */
-        f = izo_log_open(fset, "kml_tmp", O_RDWR);
-        if (IS_ERR(f)) {
-                EXIT;
-                return f;
-        }
-
-        write_off = 0;
-        read_off = start;
-        bytes = fset->fset_kml.fd_offset - start;
-        while (bytes > 0) {
-                char buf[4096];
-                int toread;
-
-                if (bytes > sizeof(buf))
-                        toread = sizeof(buf);
-                else
-                        toread = bytes;
-
-                len = presto_fread(fset->fset_kml.fd_file, buf, toread,
-                                   &read_off);
-                if (len <= 0)
-                        break;
-
-                if (presto_fwrite(f, buf, len, &write_off) != len) {
-                        filp_close(f, NULL);
-                        EXIT;
-                        return ERR_PTR(-EIO);
-                }
-
-                bytes -= len;
-        }
-
-        EXIT;
-        return f;
-}
-
-
-/* LML records here */
-/* this writes an LML record to the LML file (rec->is_kml =0)  */
-int presto_write_lml_close(struct rec_info *rec,
-                           struct presto_file_set *fset, 
-                           struct file *file,
-                           __u64 remote_ino,
-                           __u64 remote_generation,
-                           struct presto_version *remote_version,
-                           struct presto_version *new_file_ver)
-{
-        int opcode = KML_OPCODE_CLOSE;
-        char *buffer;
-        struct dentry *dentry = file->f_dentry; 
-        __u64 ino;
-        __u32 pathlen;
-        char *path;
-        __u32 generation;
-        int size;
-        char *logrecord;
-        char record[292];
-        struct dentry *root;
-        int error;
-
-        ENTRY;
-
-        if ( presto_no_journal(fset) ) {
-          EXIT;
-          return 0;
-        }
-        root = fset->fset_dentry;
-
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dentry, root, buffer, PAGE_SIZE);
-        CDEBUG(D_INODE, "Path: %s\n", path);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        ino = cpu_to_le64(dentry->d_inode->i_ino);
-        generation = cpu_to_le32(dentry->d_inode->i_generation);
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + sizeof(*new_file_ver) +
-                sizeof(ino) + sizeof(generation) + sizeof(pathlen) +
-                sizeof(remote_ino) + sizeof(remote_generation) + 
-                sizeof(remote_version) + sizeof(rec->offset) +
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-        
-        rec->is_kml = 0;
-        rec->size = size + size_round(le32_to_cpu(pathlen));
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, new_file_ver);
-        logrecord = logit(logrecord, &ino, sizeof(ino));
-        logrecord = logit(logrecord, &generation, sizeof(generation));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = logit(logrecord, &remote_ino, sizeof(remote_ino));
-        logrecord = logit(logrecord, &remote_generation,
-                          sizeof(remote_generation));
-        logrecord = log_version(logrecord, remote_version);
-        logrecord = logit(logrecord, &rec->offset, sizeof(rec->offset));
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0, NULL, 0);
-
-        BUFF_FREE(buffer);
-
-        EXIT;
-        return error;
-}
-
-/* 
- * Check if the given record is at the end of the file. If it is, truncate
- * the lml to the record's offset, removing it. Repeat on prior record,
- * until we reach an active record or a reserved record (as defined by the
- * reservations list).
- */
-static int presto_truncate_lml_tail(struct presto_file_set *fset)
-{
-        loff_t lml_tail;
-        loff_t lml_last_rec;
-        loff_t lml_last_recsize;
-        loff_t local_offset;
-        int recno;
-        struct kml_prefix_hdr prefix;
-        struct inode *inode = fset->fset_lml.fd_file->f_dentry->d_inode;
-        void *handle;
-        int rc;
-
-        ENTRY;
-        /* If someone else is already truncating the LML, return. */
-        write_lock(&fset->fset_lml.fd_lock); 
-        if (fset->fset_lml.fd_truncating == 1 ) {
-                write_unlock(&fset->fset_lml.fd_lock); 
-                EXIT;
-                return 0;
-        }
-        /* someone is about to write to the end of the LML */ 
-        if ( !list_empty(&fset->fset_lml.fd_reservations) ) {
-                write_unlock(&fset->fset_lml.fd_lock); 
-                EXIT;
-                return 0;
-        }
-       lml_tail = fset->fset_lml.fd_file->f_dentry->d_inode->i_size;
-       /* Nothing to truncate?*/
-       if (lml_tail == 0) {
-                write_unlock(&fset->fset_lml.fd_lock); 
-                EXIT;
-                return 0;
-       }
-       fset->fset_lml.fd_truncating = 1;
-       write_unlock(&fset->fset_lml.fd_lock); 
-
-       presto_last_record(&fset->fset_lml, &lml_last_recsize,
-                          &lml_last_rec, &recno, lml_tail);
-       /* Do we have a record to check? If not we have zeroes at the
-          beginning of the file. -SHP
-       */
-       if (lml_last_recsize != 0) {
-                local_offset = lml_last_rec - lml_last_recsize;
-                rc = presto_fread(fset->fset_lml.fd_file, (char *)&prefix,  
-                                        sizeof(prefix), &local_offset); 
-                if (rc != sizeof(prefix)) {
-                        EXIT;
-                        goto tr_out;
-                }
-       
-                if ( prefix.opcode != KML_OPCODE_NOOP ) {
-                        EXIT;
-                        rc = 0;
-                        /* We may have zeroes at the end of the file, should
-                           we clear them out? -SHP
-                        */
-                        goto tr_out;
-                }
-        } else 
-                lml_last_rec=0;
-
-        handle = presto_trans_start(fset, inode, KML_OPCODE_TRUNC);
-        if ( IS_ERR(handle) ) {
-                EXIT;
-                rc = -ENOMEM;
-                goto tr_out;
-        }
-
-        rc = izo_do_truncate(fset, fset->fset_lml.fd_file->f_dentry, 
-                                lml_last_rec - lml_last_recsize, lml_tail);
-        presto_trans_commit(fset, handle); 
-        if ( rc == 0 ) {
-                rc = 1;
-        }
-        EXIT;
-
- tr_out:
-        CDEBUG(D_JOURNAL, "rc = %d\n", rc);
-        write_lock(&fset->fset_lml.fd_lock);
-        fset->fset_lml.fd_truncating = 0;
-        write_unlock(&fset->fset_lml.fd_lock);
-        return rc;
-}
-
-int presto_truncate_lml(struct presto_file_set *fset)
-{
-        int rc; 
-        ENTRY;
-        
-        while ( (rc = presto_truncate_lml_tail(fset)) > 0);
-        if ( rc < 0 && rc != -EALREADY) {
-                CERROR("truncate_lml error %d\n", rc); 
-        }
-        EXIT;
-        return rc;
-}
-
-int presto_clear_lml_close(struct presto_file_set *fset, loff_t lml_offset)
-{
-        int rc;
-        struct kml_prefix_hdr record;
-        loff_t offset = lml_offset;
-
-        ENTRY;
-
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        CDEBUG(D_JOURNAL, "reading prefix: off %ld, size %Zd\n", 
-               (long)lml_offset, sizeof(record));
-        rc = presto_fread(fset->fset_lml.fd_file, (char *)&record,
-                          sizeof(record), &offset);
-
-        if ( rc != sizeof(record) ) {
-                CERROR("presto: clear_lml io error %d\n", rc); 
-                EXIT;
-                return -EIO;
-        }
-
-        /* overwrite the prefix */ 
-        CDEBUG(D_JOURNAL, "overwriting prefix: off %ld\n", (long)lml_offset);
-        record.opcode = KML_OPCODE_NOOP;
-        offset = lml_offset;
-        /* note: this does just a single transaction in the cache */
-        rc = presto_fwrite(fset->fset_lml.fd_file, (char *)(&record), 
-                              sizeof(record), &offset);
-        if ( rc != sizeof(record) ) {
-                EXIT;
-                return -EIO;
-        }
-
-        EXIT;
-        return 0; 
-}
-
-
-
-/* now a journal function for every operation */
-
-int presto_journal_setattr(struct rec_info *rec, struct presto_file_set *fset,
-                           struct dentry *dentry, struct presto_version *old_ver,
-                           struct izo_rollback_data *rb, struct iattr *iattr)
-{
-        int opcode = KML_OPCODE_SETATTR;
-        char *buffer, *path, *logrecord, record[316];
-        struct dentry *root;
-        __u32 uid, gid, mode, valid, flags, pathlen;
-        __u64 fsize, mtime, ctime;
-        int error, size;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        if (!dentry->d_inode || (dentry->d_inode->i_nlink == 0) 
-            || ((dentry->d_parent != dentry) && d_unhashed(dentry))) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dentry, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + sizeof(*old_ver) +
-                sizeof(valid) + sizeof(mode) + sizeof(uid) + sizeof(gid) +
-                sizeof(fsize) + sizeof(mtime) + sizeof(ctime) + sizeof(flags) +
-                sizeof(pathlen) + sizeof(*rb) + sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        /* Only journal one kind of mtime, and not atime at all.  Also don't
-         * journal bogus data in iattr, to make the journal more compressible.
-         */
-        if (iattr->ia_valid & ATTR_MTIME_SET)
-                iattr->ia_valid = iattr->ia_valid | ATTR_MTIME;
-        valid = cpu_to_le32(iattr->ia_valid & ~(ATTR_ATIME | ATTR_MTIME_SET |
-                                                ATTR_ATIME_SET));
-        mode = iattr->ia_valid & ATTR_MODE ? cpu_to_le32(iattr->ia_mode): 0;
-        uid = iattr->ia_valid & ATTR_UID ? cpu_to_le32(iattr->ia_uid): 0;
-        gid = iattr->ia_valid & ATTR_GID ? cpu_to_le32(iattr->ia_gid): 0;
-        fsize = iattr->ia_valid & ATTR_SIZE ? cpu_to_le64(iattr->ia_size): 0;
-        mtime = iattr->ia_valid & ATTR_MTIME ? cpu_to_le64(iattr->ia_mtime.tv_sec): 0;
-        ctime = iattr->ia_valid & ATTR_CTIME ? cpu_to_le64(iattr->ia_ctime.tv_sec): 0;
-        flags = iattr->ia_valid & ATTR_ATTR_FLAG ?
-                cpu_to_le32(iattr->ia_attr_flags): 0;
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen));
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, old_ver);
-        logrecord = logit(logrecord, &valid, sizeof(valid));
-        logrecord = logit(logrecord, &mode, sizeof(mode));
-        logrecord = logit(logrecord, &uid, sizeof(uid));
-        logrecord = logit(logrecord, &gid, sizeof(gid));
-        logrecord = logit(logrecord, &fsize, sizeof(fsize));
-        logrecord = logit(logrecord, &mtime, sizeof(mtime));
-        logrecord = logit(logrecord, &ctime, sizeof(ctime));
-        logrecord = logit(logrecord, &flags, sizeof(flags));
-        logrecord = log_rollback(logrecord, rb);
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0, NULL, 0);
-
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-int presto_get_fileid(int minor, struct presto_file_set *fset,
-                      struct dentry *dentry)
-{
-        int opcode = KML_OPCODE_GET_FILEID;
-        struct rec_info rec;
-        char *buffer, *path, *logrecord, record[4096]; /*include path*/
-        struct dentry *root;
-        __u32 uid, gid, pathlen;
-        int error, size;
-        struct kml_suffix *suffix;
-
-        ENTRY;
-
-        root = fset->fset_dentry;
-
-        uid = cpu_to_le32(dentry->d_inode->i_uid);
-        gid = cpu_to_le32(dentry->d_inode->i_gid);
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dentry, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + sizeof(pathlen) +
-                size_round(le32_to_cpu(pathlen)) +
-                sizeof(struct kml_suffix);
-
-        CDEBUG(D_FILE, "kml size: %d\n", size);
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        memset(&rec, 0, sizeof(rec));
-        rec.is_kml = 1;
-        rec.size = size;
-
-        logrecord = journal_log_prefix(record, opcode, &rec);
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = logit(logrecord, path, size_round(le32_to_cpu(pathlen)));
-        suffix = (struct kml_suffix *)logrecord;
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, &rec);
-        /* journal_log_suffix expects journal_log to set this */
-        suffix->recno = 0;
-
-        CDEBUG(D_FILE, "actual kml size: %Zd\n", logrecord - record);
-        CDEBUG(D_FILE, "get fileid: uid %d, gid %d, path: %s\n", uid, gid,path);
-
-        error = izo_upc_get_fileid(minor, size, record, 
-                                   size_round(le32_to_cpu(pathlen)), path,
-                                   fset->fset_name);
-
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-int presto_journal_create(struct rec_info *rec, struct presto_file_set *fset,
-                          struct dentry *dentry,
-                          struct presto_version *tgt_dir_ver,
-                          struct presto_version *new_file_ver, int mode)
-{
-        int opcode = KML_OPCODE_CREATE;
-        char *buffer, *path, *logrecord, record[292];
-        struct dentry *root;
-        __u32 uid, gid, lmode, pathlen;
-        int error, size;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        uid = cpu_to_le32(dentry->d_inode->i_uid);
-        gid = cpu_to_le32(dentry->d_inode->i_gid);
-        lmode = cpu_to_le32(mode);
- 
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dentry, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
-                sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen));
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, tgt_dir_ver);
-        logrecord = log_dentry_version(logrecord, dentry->d_parent);
-        logrecord = log_version(logrecord, new_file_ver);
-        logrecord = logit(logrecord, &lmode, sizeof(lmode));
-        logrecord = logit(logrecord, &uid, sizeof(uid));
-        logrecord = logit(logrecord, &gid, sizeof(gid));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0, NULL, 0);
-
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-int presto_journal_symlink(struct rec_info *rec, struct presto_file_set *fset,
-                           struct dentry *dentry, const char *target,
-                           struct presto_version *tgt_dir_ver,
-                           struct presto_version *new_link_ver)
-{
-        int opcode = KML_OPCODE_SYMLINK;
-        char *buffer, *path, *logrecord, record[292];
-        struct dentry *root;
-        __u32 uid, gid, pathlen;
-        __u32 targetlen = cpu_to_le32(strlen(target));
-        int error, size;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        uid = cpu_to_le32(dentry->d_inode->i_uid);
-        gid = cpu_to_le32(dentry->d_inode->i_gid);
-
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dentry, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
-                sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
-                sizeof(targetlen) + sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen)) +
-                size_round(le32_to_cpu(targetlen));
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, tgt_dir_ver);
-        logrecord = log_dentry_version(logrecord, dentry->d_parent);
-        logrecord = log_version(logrecord, new_link_ver);
-        logrecord = logit(logrecord, &uid, sizeof(uid));
-        logrecord = logit(logrecord, &gid, sizeof(gid));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = logit(logrecord, &targetlen, sizeof(targetlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           target, size_round(le32_to_cpu(targetlen)),
-                           NULL, 0);
-
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-int presto_journal_mkdir(struct rec_info *rec, struct presto_file_set *fset,
-                         struct dentry *dentry,
-                         struct presto_version *tgt_dir_ver,
-                         struct presto_version *new_dir_ver, int mode)
-{
-        int opcode = KML_OPCODE_MKDIR;
-        char *buffer, *path, *logrecord, record[292];
-        struct dentry *root;
-        __u32 uid, gid, lmode, pathlen;
-        int error, size;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        uid = cpu_to_le32(dentry->d_inode->i_uid);
-        gid = cpu_to_le32(dentry->d_inode->i_gid);
-        lmode = cpu_to_le32(mode);
-
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dentry, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size = sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
-                sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(pathlen) +
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen));
-        logrecord = journal_log_prefix(record, opcode, rec);
-
-        logrecord = log_version(logrecord, tgt_dir_ver);
-        logrecord = log_dentry_version(logrecord, dentry->d_parent);
-        logrecord = log_version(logrecord, new_dir_ver);
-        logrecord = logit(logrecord, &lmode, sizeof(lmode));
-        logrecord = logit(logrecord, &uid, sizeof(uid));
-        logrecord = logit(logrecord, &gid, sizeof(gid));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0, NULL, 0);
-
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-
-int
-presto_journal_rmdir(struct rec_info *rec, struct presto_file_set *fset,
-                     struct dentry *dir, struct presto_version *tgt_dir_ver,
-                     struct presto_version *old_dir_ver,
-                     struct izo_rollback_data *rb, int len, const char *name)
-{
-        int opcode = KML_OPCODE_RMDIR;
-        char *buffer, *path, *logrecord, record[316];
-        __u32 pathlen, llen;
-        struct dentry *root;
-        int error, size;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        llen = cpu_to_le32(len);
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dir, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
-                sizeof(pathlen) + sizeof(llen) + sizeof(*rb) +
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        CDEBUG(D_JOURNAL, "path: %s (%d), name: %s (%d), size %d\n",
-               path, pathlen, name, len, size);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen)) + 
-                size_round(len);
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, tgt_dir_ver);
-        logrecord = log_dentry_version(logrecord, dir);
-        logrecord = log_version(logrecord, old_dir_ver);
-        logrecord = logit(logrecord, rb, sizeof(*rb));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = logit(logrecord, &llen, sizeof(llen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dir, rec);
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           name, size_round(len),
-                           NULL, 0);
-
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-
-int
-presto_journal_mknod(struct rec_info *rec, struct presto_file_set *fset,
-                     struct dentry *dentry, struct presto_version *tgt_dir_ver,
-                     struct presto_version *new_node_ver, int mode,
-                     int dmajor, int dminor )
-{
-        int opcode = KML_OPCODE_MKNOD;
-        char *buffer, *path, *logrecord, record[292];
-        struct dentry *root;
-        __u32 uid, gid, lmode, lmajor, lminor, pathlen;
-        int error, size;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        uid = cpu_to_le32(dentry->d_inode->i_uid);
-        gid = cpu_to_le32(dentry->d_inode->i_gid);
-        lmode = cpu_to_le32(mode);
-        lmajor = cpu_to_le32(dmajor);
-        lminor = cpu_to_le32(dminor);
-
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dentry, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size = sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
-                sizeof(lmode) + sizeof(uid) + sizeof(gid) + sizeof(lmajor) +
-                sizeof(lminor) + sizeof(pathlen) +
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen));
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, tgt_dir_ver);
-        logrecord = log_dentry_version(logrecord, dentry->d_parent);
-        logrecord = log_version(logrecord, new_node_ver);
-        logrecord = logit(logrecord, &lmode, sizeof(lmode));
-        logrecord = logit(logrecord, &uid, sizeof(uid));
-        logrecord = logit(logrecord, &gid, sizeof(gid));
-        logrecord = logit(logrecord, &lmajor, sizeof(lmajor));
-        logrecord = logit(logrecord, &lminor, sizeof(lminor));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0, NULL, 0);
-
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-int
-presto_journal_link(struct rec_info *rec, struct presto_file_set *fset,
-                    struct dentry *src, struct dentry *tgt,
-                    struct presto_version *tgt_dir_ver,
-                    struct presto_version *new_link_ver)
-{
-        int opcode = KML_OPCODE_LINK;
-        char *buffer, *srcbuffer, *path, *srcpath, *logrecord, record[292];
-        __u32 pathlen, srcpathlen;
-        struct dentry *root;
-        int error, size;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        BUFF_ALLOC(srcbuffer, NULL);
-        srcpath = presto_path(src, root, srcbuffer, PAGE_SIZE);
-        srcpathlen = cpu_to_le32(MYPATHLEN(srcbuffer, srcpath));
-
-        BUFF_ALLOC(buffer, srcbuffer);
-        path = presto_path(tgt, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
-                sizeof(srcpathlen) + sizeof(pathlen) +
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen)) + 
-                size_round(le32_to_cpu(srcpathlen));
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, tgt_dir_ver);
-        logrecord = log_dentry_version(logrecord, tgt->d_parent);
-        logrecord = log_version(logrecord, new_link_ver);
-        logrecord = logit(logrecord, &srcpathlen, sizeof(srcpathlen));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, tgt, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           srcpath, size_round(le32_to_cpu(srcpathlen)),
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0);
-
-        BUFF_FREE(srcbuffer);
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-
-int presto_journal_rename(struct rec_info *rec, struct presto_file_set *fset,
-                          struct dentry *src, struct dentry *tgt,
-                          struct presto_version *src_dir_ver,
-                          struct presto_version *tgt_dir_ver)
-{
-        int opcode = KML_OPCODE_RENAME;
-        char *buffer, *srcbuffer, *path, *srcpath, *logrecord, record[292];
-        __u32 pathlen, srcpathlen;
-        struct dentry *root;
-        int error, size;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        BUFF_ALLOC(srcbuffer, NULL);
-        srcpath = presto_path(src, root, srcbuffer, PAGE_SIZE);
-        srcpathlen = cpu_to_le32(MYPATHLEN(srcbuffer, srcpath));
-
-        BUFF_ALLOC(buffer, srcbuffer);
-        path = presto_path(tgt, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 4 * sizeof(*src_dir_ver) +
-                sizeof(srcpathlen) + sizeof(pathlen) +
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen)) + 
-                size_round(le32_to_cpu(srcpathlen));
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, src_dir_ver);
-        logrecord = log_dentry_version(logrecord, src->d_parent);
-        logrecord = log_version(logrecord, tgt_dir_ver);
-        logrecord = log_dentry_version(logrecord, tgt->d_parent);
-        logrecord = logit(logrecord, &srcpathlen, sizeof(srcpathlen));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, tgt, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           srcpath, size_round(le32_to_cpu(srcpathlen)),
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0);
-
-        BUFF_FREE(buffer);
-        BUFF_FREE(srcbuffer);
-        EXIT;
-        return error;
-}
-
-int presto_journal_unlink(struct rec_info *rec, struct presto_file_set *fset,
-                          struct dentry *dir, struct presto_version *tgt_dir_ver,
-                          struct presto_version *old_file_ver,
-                          struct izo_rollback_data *rb, struct dentry *dentry,
-                          char *old_target, int old_targetlen)
-{
-        int opcode = KML_OPCODE_UNLINK;
-        char *buffer, *path, *logrecord, record[316];
-        const char *name;
-        __u32 pathlen, llen;
-        struct dentry *root;
-        int error, size, len;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        name = dentry->d_name.name;
-        len = dentry->d_name.len;
-
-        llen = cpu_to_le32(len);
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dir, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        size = sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 3 * sizeof(*tgt_dir_ver) +
-                sizeof(pathlen) + sizeof(llen) + sizeof(*rb) +
-                sizeof(old_targetlen) + sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen)) + size_round(len) +
-                size_round(old_targetlen);
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, tgt_dir_ver);
-        logrecord = log_dentry_version(logrecord, dir);
-        logrecord = log_version(logrecord, old_file_ver);
-        logrecord = log_rollback(logrecord, rb);
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = logit(logrecord, &llen, sizeof(llen));
-        logrecord = logit(logrecord, &old_targetlen, sizeof(old_targetlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dir, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           name, size_round(len),
-                           old_target, size_round(old_targetlen));
-
-        BUFF_FREE(buffer);
-        EXIT;
-        return error;
-}
-
-int
-presto_journal_close(struct rec_info *rec, struct presto_file_set *fset,
-                     struct presto_file_data *fd, struct dentry *dentry,
-                     struct presto_version *old_file_ver,
-                     struct presto_version *new_file_ver)
-{
-        int opcode = KML_OPCODE_CLOSE;
-        char *buffer, *path, *logrecord, record[316];
-        struct dentry *root;
-        int error, size, i;
-        __u32 pathlen, generation;
-        __u64 ino;
-        __u32 open_fsuid;
-        __u32 open_fsgid;
-        __u32 open_ngroups;
-        __u32 open_groups[NGROUPS_SMALL];
-        __u32 open_mode;
-        __u32 open_uid;
-        __u32 open_gid;
-
-        ENTRY;
-
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        if (!dentry->d_inode || (dentry->d_inode->i_nlink == 0) 
-            || ((dentry->d_parent != dentry) && d_unhashed(dentry))) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        if (fd) {
-                open_ngroups = fd->fd_ngroups;
-                for (i = 0; i < fd->fd_ngroups; i++)
-                        open_groups[i] = (__u32) fd->fd_groups[i];
-                open_mode = fd->fd_mode;
-                open_uid = fd->fd_uid;
-                open_gid = fd->fd_gid;
-                open_fsuid = fd->fd_fsuid;
-                open_fsgid = fd->fd_fsgid;
-        } else {
-                open_ngroups = current->group_info->ngroups;
-                for (i=0; i<current->group_info->ngroups; i++)
-                        open_groups[i] =  (__u32) GROUP_AT(current->group_info,i); 
-                open_mode = dentry->d_inode->i_mode;
-                open_uid = dentry->d_inode->i_uid;
-                open_gid = dentry->d_inode->i_gid;
-                open_fsuid = current->fsuid;
-                open_fsgid = current->fsgid;
-        }
-        BUFF_ALLOC(buffer, NULL);
-        path = presto_path(dentry, root, buffer, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(buffer, path));
-        ino = cpu_to_le64(dentry->d_inode->i_ino);
-        generation = cpu_to_le32(dentry->d_inode->i_generation);
-        size =  sizeof(__u32) * open_ngroups +
-                sizeof(open_mode) + sizeof(open_uid) + sizeof(open_gid) +
-                sizeof(struct kml_prefix_hdr) + sizeof(*old_file_ver) +
-                sizeof(*new_file_ver) + sizeof(ino) + sizeof(generation) +
-                sizeof(pathlen) + sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen));
-
-        logrecord = journal_log_prefix_with_groups_and_ids(
-                record, opcode, rec, open_ngroups, open_groups,
-                open_fsuid, open_fsgid);
-        logrecord = logit(logrecord, &open_mode, sizeof(open_mode));
-        logrecord = logit(logrecord, &open_uid, sizeof(open_uid));
-        logrecord = logit(logrecord, &open_gid, sizeof(open_gid));
-        logrecord = log_version(logrecord, old_file_ver);
-        logrecord = log_version(logrecord, new_file_ver);
-        logrecord = logit(logrecord, &ino, sizeof(ino));
-        logrecord = logit(logrecord, &generation, sizeof(generation));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0, NULL, 0);
-        BUFF_FREE(buffer);
-
-        EXIT;
-        return error;
-}
-
-int presto_rewrite_close(struct rec_info *rec, struct presto_file_set *fset, 
-                         char *path, __u32 pathlen, 
-                         int ngroups, __u32 *groups, 
-                         __u64 ino,     __u32 generation, 
-                         struct presto_version *new_file_ver)
-{
-        int opcode = KML_OPCODE_CLOSE;
-        char *logrecord, record[292];
-        struct dentry *root;
-        int error, size;
-
-        ENTRY;
-
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        size =  sizeof(__u32) * ngroups + 
-                sizeof(struct kml_prefix_hdr) + sizeof(*new_file_ver) +
-                sizeof(ino) + sizeof(generation) + 
-                sizeof(le32_to_cpu(pathlen)) +
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        rec->size = size + size_round(le32_to_cpu(pathlen));
-
-        logrecord = journal_log_prefix_with_groups(record, opcode, rec,
-                                                   ngroups, groups);
-        logrecord = log_version(logrecord, new_file_ver);
-        logrecord = logit(logrecord, &ino, sizeof(ino));
-        logrecord = logit(logrecord, &generation, sizeof(generation));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = journal_log_suffix(logrecord, record, fset, NULL, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           NULL, 0, NULL, 0);
-
-        EXIT;
-        return error;
-}
-
-
-/* write closes for the local close records in the LML */ 
-int presto_complete_lml(struct presto_file_set *fset)
-{
-        __u32 groups[NGROUPS_SMALL];
-        loff_t lml_offset;
-        loff_t read_offset; 
-        char *buffer;
-        void *handle;
-        struct rec_info rec;
-        struct close_rec { 
-                struct presto_version new_file_ver;
-                __u64 ino;
-                __u32 generation;
-                __u32 pathlen;
-                __u64 remote_ino;
-                __u32 remote_generation;
-                __u32 remote_version;
-                __u64 lml_offset;
-        } close_rec; 
-        struct file *file = fset->fset_lml.fd_file;
-        struct kml_prefix_hdr prefix;
-        int rc = 0;
-        ENTRY;
-
-        lml_offset = 0; 
- again: 
-        if (lml_offset >= file->f_dentry->d_inode->i_size) {
-                EXIT;
-                return rc;
-        }
-
-        read_offset = lml_offset;
-        rc = presto_fread(file, (char *)&prefix,
-                          sizeof(prefix), &read_offset);
-        if ( rc != sizeof(prefix) ) {
-                EXIT;
-                CERROR("presto_complete_lml: ioerror - 1, tell Peter\n");
-                return -EIO;
-        }
-
-        if ( prefix.opcode == KML_OPCODE_NOOP ) {
-                lml_offset += prefix.len; 
-                goto again; 
-        }
-
-        rc = presto_fread(file, (char *)groups, 
-                          prefix.ngroups * sizeof(__u32), &read_offset); 
-        if ( rc != prefix.ngroups * sizeof(__u32) ) {
-                EXIT;
-                CERROR("presto_complete_lml: ioerror - 2, tell Peter\n");
-                return -EIO;
-        }
-
-        rc = presto_fread(file, (char *)&close_rec, 
-                          sizeof(close_rec), &read_offset); 
-        if ( rc != sizeof(close_rec) ) {
-                EXIT;
-                CERROR("presto_complete_lml: ioerror - 3, tell Peter\n");
-                return -EIO;
-        }
-
-        /* is this a backfetch or a close record? */ 
-        if ( le64_to_cpu(close_rec.remote_ino) != 0 ) { 
-                lml_offset += prefix.len;
-                goto again; 
-        }
-
-        BUFF_ALLOC(buffer, NULL);
-        rc = presto_fread(file, (char *)buffer, 
-                          le32_to_cpu(close_rec.pathlen), &read_offset); 
-        if ( rc != le32_to_cpu(close_rec.pathlen) ) {
-                EXIT;
-                CERROR("presto_complete_lml: ioerror - 4, tell Peter\n");
-                return -EIO;
-        }
-        
-        handle = presto_trans_start(fset, file->f_dentry->d_inode, 
-                                    KML_OPCODE_RELEASE);
-        if ( IS_ERR(handle) ) {
-                EXIT;
-                return -ENOMEM; 
-        }
-
-        rc = presto_clear_lml_close(fset, lml_offset); 
-        if ( rc ) {
-                CERROR("error during clearing: %d\n", rc);
-                presto_trans_commit(fset, handle);
-                EXIT; 
-                return rc; 
-        }
-
-        rc = presto_rewrite_close(&rec, fset, buffer, close_rec.pathlen, 
-                                  prefix.ngroups, groups, 
-                                  close_rec.ino, close_rec.generation,
-                                  &close_rec.new_file_ver); 
-        if ( rc ) {
-                CERROR("error during rewrite close: %d\n", rc);
-                presto_trans_commit(fset, handle);
-                EXIT; 
-                return rc; 
-        }
-
-        presto_trans_commit(fset, handle); 
-        if ( rc ) { 
-                CERROR("error during truncation: %d\n", rc);
-                EXIT; 
-                return rc;
-        }
-        
-        lml_offset += prefix.len; 
-        CDEBUG(D_JOURNAL, "next LML record at: %ld\n", (long)lml_offset);
-        goto again;
-
-        EXIT;
-        return -EINVAL;
-}
-
-
-#ifdef CONFIG_FS_EXT_ATTR
-/* Journal an ea operation. A NULL buffer implies the attribute is 
- * getting deleted. In this case we simply change the opcode, but nothing
- * else is affected.
- */
-int presto_journal_set_ext_attr (struct rec_info *rec, 
-                                 struct presto_file_set *fset, 
-                                 struct dentry *dentry, 
-                                 struct presto_version *ver, const char *name, 
-                                 const char *buffer, int buffer_len, 
-                                 int flags) 
-{ 
-        int opcode = (buffer == NULL) ? 
-                     KML_OPCODE_DELEXTATTR : 
-                     KML_OPCODE_SETEXTATTR ;
-        char *temp, *path, *logrecord, record[292];
-        struct dentry *root;
-        int error, size;
-        __u32 namelen=cpu_to_le32(strnlen(name,PRESTO_EXT_ATTR_NAME_MAX));
-        __u32 buflen=(buffer != NULL)? cpu_to_le32(buffer_len): cpu_to_le32(0);
-        __u32 mode, pathlen;
-
-        ENTRY;
-        if ( presto_no_journal(fset) ) {
-                EXIT;
-                return 0;
-        }
-
-        if (!dentry->d_inode || (dentry->d_inode->i_nlink == 0) 
-            || ((dentry->d_parent != dentry) && d_unhashed(dentry))) {
-                EXIT;
-                return 0;
-        }
-
-        root = fset->fset_dentry;
-
-        BUFF_ALLOC(temp, NULL);
-        path = presto_path(dentry, root, temp, PAGE_SIZE);
-        pathlen = cpu_to_le32(MYPATHLEN(temp, path));
-
-        flags=cpu_to_le32(flags);
-        /* Ugly, but needed. posix ACLs change the mode without using
-         * setattr, we need to record these changes. The EA code per se
-         * is not really affected.
-         */
-        mode=cpu_to_le32(dentry->d_inode->i_mode);
-
-        size =  sizeof(__u32) * current->group_info->ngroups + 
-                sizeof(struct kml_prefix_hdr) + 
-                2 * sizeof(struct presto_version) +
-                sizeof(flags) + sizeof(mode) + sizeof(namelen) + 
-                sizeof(buflen) + sizeof(pathlen) + 
-                sizeof(struct kml_suffix);
-
-        if ( size > sizeof(record) )
-                CERROR("InterMezzo: BUFFER OVERFLOW in %s!\n", __FUNCTION__);
-
-        rec->is_kml = 1;
-        /* Make space for a path, a attr name and value*/
-        /* We use the buflen instead of buffer_len to make sure that we 
-         * journal the right length. This may be a little paranoid, but
-         * with 64 bits round the corner, I would rather be safe than sorry!
-         * Also this handles deletes with non-zero buffer_lengths correctly.
-         * SHP
-         */
-        rec->size = size + size_round(le32_to_cpu(pathlen)) +
-                    size_round(le32_to_cpu(namelen)) + 
-                    size_round(le32_to_cpu(buflen));
-
-        logrecord = journal_log_prefix(record, opcode, rec);
-        logrecord = log_version(logrecord, ver);
-        logrecord = log_dentry_version(logrecord, dentry);
-        logrecord = logit(logrecord, &flags, sizeof(flags));
-        logrecord = logit(logrecord, &mode, sizeof(flags));
-        logrecord = logit(logrecord, &pathlen, sizeof(pathlen));
-        logrecord = logit(logrecord, &namelen, sizeof(namelen));
-        logrecord = logit(logrecord, &buflen, sizeof(buflen));
-        logrecord = journal_log_suffix(logrecord, record, fset, dentry, rec);
-
-        error = presto_log(fset, rec, record, size,
-                           path, size_round(le32_to_cpu(pathlen)),
-                           name, size_round(le32_to_cpu(namelen)),
-                           buffer, size_round(le32_to_cpu(buflen)));
-
-        BUFF_FREE(temp);
-        EXIT;
-        return error;
-}
-#endif
diff -Nru a/fs/intermezzo/journal_ext2.c b/fs/intermezzo/journal_ext2.c
--- a/fs/intermezzo/journal_ext2.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,90 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1998 Peter J. Braam <braam@clusterfs.com>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-#include <linux/ext2_fs.h> 
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#if defined(CONFIG_EXT2_FS)
-
-/* EXT2 has no journalling, so these functions do nothing */
-static loff_t presto_e2_freespace(struct presto_cache *cache,
-                                         struct super_block *sb)
-{
-        unsigned long freebl = le32_to_cpu(EXT2_SB(sb)->s_es->s_free_blocks_count);
-        unsigned long avail =   freebl - le32_to_cpu(EXT2_SB(sb)->s_es->s_r_blocks_count);
-	return (avail <<  EXT2_BLOCK_SIZE_BITS(sb));
-}
-
-/* start the filesystem journal operations */
-static void *presto_e2_trans_start(struct presto_file_set *fset, struct inode *inode, int op)
-{
-        __u32 avail_kmlblocks;
-
-        if ( presto_no_journal(fset) ||
-             strcmp(fset->fset_cache->cache_type, "ext2"))
-                return NULL;
-
-        avail_kmlblocks = EXT2_SB(inode->i_sb)->s_es->s_free_blocks_count;
-        
-        if ( avail_kmlblocks < 3 ) {
-                return ERR_PTR(-ENOSPC);
-        }
-        
-        if (  (op != KML_OPCODE_UNLINK && op != KML_OPCODE_RMDIR)
-              && avail_kmlblocks < 6 ) {
-                return ERR_PTR(-ENOSPC);
-        }            
-	return (void *) 1;
-}
-
-static void presto_e2_trans_commit(struct presto_file_set *fset, void *handle)
-{
-        do {} while (0);
-}
-
-static int presto_e2_has_all_data(struct inode *inode)
-{
-        BUG();
-        return 0;
-}
-
-struct journal_ops presto_ext2_journal_ops = {
-        .tr_all_data            = presto_e2_has_all_data,
-        .tr_avail               = presto_e2_freespace,
-        .tr_start               = presto_e2_trans_start,
-        .tr_commit              = presto_e2_trans_commit,
-        .tr_journal_data        = NULL
-};
-
-#endif /* CONFIG_EXT2_FS */
diff -Nru a/fs/intermezzo/journal_ext3.c b/fs/intermezzo/journal_ext3.c
--- a/fs/intermezzo/journal_ext3.c	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,283 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1998 Peter J. Braam <braam@clusterfs.com>
- *  Copyright (C) 2000 Red Hat, Inc.
- *  Copyright (C) 2000 Los Alamos National Laboratory
- *  Copyright (C) 2000 TurboLinux, Inc.
- *  Copyright (C) 2001 Mountain View Data, Inc.
- *  Copyright (C) 2001 Tacit Networks, Inc. <phil@off.net>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/types.h>
-#include <linux/param.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-#if defined(CONFIG_EXT3_FS) || defined (CONFIG_EXT3_FS_MODULE)
-#include <linux/jbd.h>
-#include <linux/ext3_fs.h>
-#include <linux/ext3_jbd.h>
-#endif
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#if defined(CONFIG_EXT3_FS) || defined (CONFIG_EXT3_FS_MODULE)
-
-#define MAX_PATH_BLOCKS(inode) (PATH_MAX >> EXT3_BLOCK_SIZE_BITS((inode)->i_sb))
-#define MAX_NAME_BLOCKS(inode) (NAME_MAX >> EXT3_BLOCK_SIZE_BITS((inode)->i_sb))
-
-/* space requirements: 
-   presto_do_truncate: 
-        used to truncate the KML forward to next fset->chunksize boundary
-          - zero partial block
-          - update inode
-   presto_write_record: 
-        write header (< one block) 
-        write one path (< MAX_PATHLEN) 
-        possibly write another path (< MAX_PATHLEN)
-        write suffix (< one block) 
-   presto_update_last_rcvd
-        write one block
-*/
-
-static loff_t presto_e3_freespace(struct presto_cache *cache,
-                                         struct super_block *sb)
-{
-        loff_t freebl = le32_to_cpu(EXT3_SB(sb)->s_es->s_free_blocks_count);
-        loff_t avail =   freebl - 
-                le32_to_cpu(EXT3_SB(sb)->s_es->s_r_blocks_count);
-        return (avail <<  EXT3_BLOCK_SIZE_BITS(sb));
-}
-
-/* start the filesystem journal operations */
-static void *presto_e3_trans_start(struct presto_file_set *fset, 
-                                   struct inode *inode, 
-                                   int op)
-{
-        int jblocks;
-        int trunc_blks, one_path_blks, extra_path_blks, 
-                extra_name_blks, lml_blks; 
-        __u32 avail_kmlblocks;
-        handle_t *handle;
-
-        if ( presto_no_journal(fset) ||
-             strcmp(fset->fset_cache->cache_type, "ext3"))
-          {
-            CDEBUG(D_JOURNAL, "got cache_type \"%s\"\n",
-                   fset->fset_cache->cache_type);
-            return NULL;
-          }
-
-        avail_kmlblocks = EXT3_SB(inode->i_sb)->s_es->s_free_blocks_count;
-        
-        if ( avail_kmlblocks < 3 ) {
-                return ERR_PTR(-ENOSPC);
-        }
-        
-        if (  (op != KML_OPCODE_UNLINK && op != KML_OPCODE_RMDIR)
-              && avail_kmlblocks < 6 ) {
-                return ERR_PTR(-ENOSPC);
-        }            
-
-        /* Need journal space for:
-             at least three writes to KML (two one block writes, one a path) 
-             possibly a second name (unlink, rmdir)
-             possibly a second path (symlink, rename)
-             a one block write to the last rcvd file 
-        */
-
-        trunc_blks = EXT3_DATA_TRANS_BLOCKS + 1; 
-        one_path_blks = 4*EXT3_DATA_TRANS_BLOCKS + MAX_PATH_BLOCKS(inode) + 3;
-        lml_blks = 4*EXT3_DATA_TRANS_BLOCKS + MAX_PATH_BLOCKS(inode) + 2;
-        extra_path_blks = EXT3_DATA_TRANS_BLOCKS + MAX_PATH_BLOCKS(inode); 
-        extra_name_blks = EXT3_DATA_TRANS_BLOCKS + MAX_NAME_BLOCKS(inode); 
-
-        /* additional blocks appear for "two pathname" operations
-           and operations involving the LML records 
-        */
-        switch (op) {
-        case KML_OPCODE_TRUNC:
-                jblocks = one_path_blks + extra_name_blks + trunc_blks
-                        + EXT3_DELETE_TRANS_BLOCKS; 
-                break;
-        case KML_OPCODE_KML_TRUNC:
-                /* Hopefully this is a little better, but I'm still mostly
-                 * guessing here. */
-                /* unlink 1 */
-                jblocks = extra_name_blks + trunc_blks +
-                        EXT3_DELETE_TRANS_BLOCKS + 2; 
-
-                /* unlink 2 */
-                jblocks += extra_name_blks + trunc_blks +
-                        EXT3_DELETE_TRANS_BLOCKS + 2; 
-
-                /* rename 1 */
-                jblocks += 2 * extra_path_blks + trunc_blks + 
-                        2 * EXT3_DATA_TRANS_BLOCKS + 2 + 3;
-
-                /* rename 2 */
-                jblocks += 2 * extra_path_blks + trunc_blks + 
-                        2 * EXT3_DATA_TRANS_BLOCKS + 2 + 3;
-                break;
-        case KML_OPCODE_RELEASE:
-                /* 
-                jblocks = one_path_blks + lml_blks + 2*trunc_blks; 
-                */
-                jblocks = one_path_blks; 
-                break;
-        case KML_OPCODE_SETATTR:
-                jblocks = one_path_blks + trunc_blks + 1 ; 
-                break;
-        case KML_OPCODE_CREATE:
-                jblocks = one_path_blks + trunc_blks 
-                        + EXT3_DATA_TRANS_BLOCKS + 3 + 2; 
-                break;
-        case KML_OPCODE_LINK:
-                jblocks = one_path_blks + trunc_blks 
-                        + EXT3_DATA_TRANS_BLOCKS + 2; 
-                break;
-        case KML_OPCODE_UNLINK:
-                jblocks = one_path_blks + extra_name_blks + trunc_blks
-                        + EXT3_DELETE_TRANS_BLOCKS + 2; 
-                break;
-        case KML_OPCODE_SYMLINK:
-                jblocks = one_path_blks + extra_path_blks + trunc_blks
-                        + EXT3_DATA_TRANS_BLOCKS + 5; 
-                break;
-        case KML_OPCODE_MKDIR:
-                jblocks = one_path_blks + trunc_blks
-                        + EXT3_DATA_TRANS_BLOCKS + 4 + 2;
-                break;
-        case KML_OPCODE_RMDIR:
-                jblocks = one_path_blks + extra_name_blks + trunc_blks
-                        + EXT3_DELETE_TRANS_BLOCKS + 1; 
-                break;
-        case KML_OPCODE_MKNOD:
-                jblocks = one_path_blks + trunc_blks + 
-                        EXT3_DATA_TRANS_BLOCKS + 3 + 2;
-                break;
-        case KML_OPCODE_RENAME:
-                jblocks = one_path_blks + extra_path_blks + trunc_blks + 
-                        2 * EXT3_DATA_TRANS_BLOCKS + 2 + 3;
-                break;
-        case KML_OPCODE_WRITE:
-                jblocks = one_path_blks; 
-                /*  add this when we can wrap our transaction with 
-                    that of ext3_file_write (ordered writes)
-                    +  EXT3_DATA_TRANS_BLOCKS;
-                */
-                break;
-        default:
-                CDEBUG(D_JOURNAL, "invalid operation %d for journal\n", op);
-                return NULL;
-        }
-
-        CDEBUG(D_JOURNAL, "creating journal handle (%d blocks) for op %d\n",
-               jblocks, op);
-        /* journal_start/stop does not do its own locking while updating
-         * the handle/transaction information. Hence we create our own
-         * critical section to protect these calls. -SHP
-         */
-        lock_kernel();
-        handle = journal_start(EXT3_JOURNAL(inode), jblocks);
-        unlock_kernel();
-        return handle;
-}
-
-static void presto_e3_trans_commit(struct presto_file_set *fset, void *handle)
-{
-        if ( presto_no_journal(fset) || !handle)
-                return;
-
-        /* See comments before journal_start above. -SHP */
-        lock_kernel();
-        journal_stop(handle);
-        unlock_kernel();
-}
-
-static void presto_e3_journal_file_data(struct inode *inode)
-{
-#ifdef EXT3_JOURNAL_DATA_FL
-        EXT3_I(inode)->i_flags |= EXT3_JOURNAL_DATA_FL;
-#else
-#warning You must have a facility to enable journaled writes for recovery!
-#endif
-}
-
-/* The logic here is a slightly modified version of ext3/inode.c:block_to_path
- */
-static int presto_e3_has_all_data(struct inode *inode)
-{
-        int ptrs = EXT3_ADDR_PER_BLOCK(inode->i_sb);
-        int ptrs_bits = EXT3_ADDR_PER_BLOCK_BITS(inode->i_sb);
-        const long direct_blocks = EXT3_NDIR_BLOCKS,
-                indirect_blocks = ptrs,
-                double_blocks = (1 << (ptrs_bits * 2));
-        long block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
-                inode->i_sb->s_blocksize_bits;
-
-        ENTRY;
-
-        if (inode->i_size == 0) {
-                EXIT;
-                return 1;
-        }
-
-        if (block < direct_blocks) {
-                /* No indirect blocks, no problem. */
-        } else if (block < indirect_blocks + direct_blocks) {
-                block++;
-        } else if (block < double_blocks + indirect_blocks + direct_blocks) {
-                block += 2;
-        } else if (((block - double_blocks - indirect_blocks - direct_blocks)
-                    >> (ptrs_bits * 2)) < ptrs) {
-                block += 3;
-        }
-
-        block *= (inode->i_sb->s_blocksize / 512);
-
-        CDEBUG(D_CACHE, "Need %ld blocks, have %ld.\n", block, inode->i_blocks);
-
-        if (block > inode->i_blocks) {
-                EXIT;
-                return 0;
-        }
-
-        EXIT;
-        return 1;
-}
-
-struct journal_ops presto_ext3_journal_ops = {
-        .tr_all_data     = presto_e3_has_all_data,
-        .tr_avail        = presto_e3_freespace,
-        .tr_start        =  presto_e3_trans_start,
-        .tr_commit       = presto_e3_trans_commit,
-        .tr_journal_data = presto_e3_journal_file_data,
-        .tr_ilookup      = presto_iget_ilookup
-};
-
-#endif /* CONFIG_EXT3_FS */
diff -Nru a/fs/intermezzo/journal_obdfs.c b/fs/intermezzo/journal_obdfs.c
--- a/fs/intermezzo/journal_obdfs.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,193 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1998 Peter J. Braam <braam@clusterfs.com>
- *  Copyright (C) 2000 Red Hat, Inc.
- *  Copyright (C) 2000 Los Alamos National Laboratory
- *  Copyright (C) 2000 TurboLinux, Inc.
- *  Copyright (C) 2001 Mountain View Data, Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/types.h>
-#include <linux/param.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-#ifdef CONFIG_OBDFS_FS
-#include /usr/src/obd/include/linux/obdfs.h
-#endif
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#ifdef CONFIG_OBDFS_FS
-
-
-static unsigned long presto_obdfs_freespace(struct presto_file_set *fset,
-                                         struct super_block *sb)
-{
-        return 0x0fffff; 
-}
-
-/* start the filesystem journal operations */
-static void *presto_obdfs_trans_start(struct presto_file_set *fset, 
-                                   struct inode *inode, 
-                                   int op)
-{
-
-        return (void *) 1;
-}
-
-#if 0
-        int jblocks;
-        int trunc_blks, one_path_blks, extra_path_blks, 
-                extra_name_blks, lml_blks; 
-        __u32 avail_kmlblocks;
-
-        if ( presto_no_journal(fset) ||
-             strcmp(fset->fset_cache->cache_type, "ext3"))
-          {
-            CDEBUG(D_JOURNAL, "got cache_type \"%s\"\n",
-                   fset->fset_cache->cache_type);
-            return NULL;
-          }
-
-        avail_kmlblocks = inode->i_sb->u.ext3_sb.s_es->s_free_blocks_count;
-        
-        if ( avail_kmlblocks < 3 ) {
-                return ERR_PTR(-ENOSPC);
-        }
-        
-        if (  (op != PRESTO_OP_UNLINK && op != PRESTO_OP_RMDIR)
-              && avail_kmlblocks < 6 ) {
-                return ERR_PTR(-ENOSPC);
-        }            
-
-        /* Need journal space for:
-             at least three writes to KML (two one block writes, one a path) 
-             possibly a second name (unlink, rmdir)
-             possibly a second path (symlink, rename)
-             a one block write to the last rcvd file 
-        */
-
-        trunc_blks = EXT3_DATA_TRANS_BLOCKS + 1; 
-        one_path_blks = 4*EXT3_DATA_TRANS_BLOCKS + MAX_PATH_BLOCKS(inode) + 3;
-        lml_blks = 4*EXT3_DATA_TRANS_BLOCKS + MAX_PATH_BLOCKS(inode) + 2;
-        extra_path_blks = EXT3_DATA_TRANS_BLOCKS + MAX_PATH_BLOCKS(inode); 
-        extra_name_blks = EXT3_DATA_TRANS_BLOCKS + MAX_NAME_BLOCKS(inode); 
-
-        /* additional blocks appear for "two pathname" operations
-           and operations involving the LML records 
-        */
-        switch (op) {
-        case PRESTO_OP_TRUNC:
-                jblocks = one_path_blks + extra_name_blks + trunc_blks
-                        + EXT3_DELETE_TRANS_BLOCKS; 
-                break;
-        case PRESTO_OP_RELEASE:
-                /* 
-                jblocks = one_path_blks + lml_blks + 2*trunc_blks; 
-                */
-                jblocks = one_path_blks; 
-                break;
-        case PRESTO_OP_SETATTR:
-                jblocks = one_path_blks + trunc_blks + 1 ; 
-                break;
-        case PRESTO_OP_CREATE:
-                jblocks = one_path_blks + trunc_blks 
-                        + EXT3_DATA_TRANS_BLOCKS + 3; 
-                break;
-        case PRESTO_OP_LINK:
-                jblocks = one_path_blks + trunc_blks 
-                        + EXT3_DATA_TRANS_BLOCKS; 
-                break;
-        case PRESTO_OP_UNLINK:
-                jblocks = one_path_blks + extra_name_blks + trunc_blks
-                        + EXT3_DELETE_TRANS_BLOCKS; 
-                break;
-        case PRESTO_OP_SYMLINK:
-                jblocks = one_path_blks + extra_path_blks + trunc_blks
-                        + EXT3_DATA_TRANS_BLOCKS + 5; 
-                break;
-        case PRESTO_OP_MKDIR:
-                jblocks = one_path_blks + trunc_blks
-                        + EXT3_DATA_TRANS_BLOCKS + 4;
-                break;
-        case PRESTO_OP_RMDIR:
-                jblocks = one_path_blks + extra_name_blks + trunc_blks
-                        + EXT3_DELETE_TRANS_BLOCKS; 
-                break;
-        case PRESTO_OP_MKNOD:
-                jblocks = one_path_blks + trunc_blks + 
-                        EXT3_DATA_TRANS_BLOCKS + 3;
-                break;
-        case PRESTO_OP_RENAME:
-                jblocks = one_path_blks + extra_path_blks + trunc_blks + 
-                        2 * EXT3_DATA_TRANS_BLOCKS + 2;
-                break;
-        case PRESTO_OP_WRITE:
-                jblocks = one_path_blks; 
-                /*  add this when we can wrap our transaction with 
-                    that of ext3_file_write (ordered writes)
-                    +  EXT3_DATA_TRANS_BLOCKS;
-                */
-                break;
-        default:
-                CDEBUG(D_JOURNAL, "invalid operation %d for journal\n", op);
-                return NULL;
-        }
-
-        CDEBUG(D_JOURNAL, "creating journal handle (%d blocks)\n", jblocks);
-        return journal_start(EXT3_JOURNAL(inode), jblocks);
-}
-#endif
-
-void presto_obdfs_trans_commit(struct presto_file_set *fset, void *handle)
-{
-#if 0
-        if ( presto_no_journal(fset) || !handle)
-                return;
-
-        journal_stop(handle);
-#endif
-}
-
-void presto_obdfs_journal_file_data(struct inode *inode)
-{
-#ifdef EXT3_JOURNAL_DATA_FL
-        inode->u.ext3_i.i_flags |= EXT3_JOURNAL_DATA_FL;
-#else
-#warning You must have a facility to enable journaled writes for recovery!
-#endif
-}
-
-struct journal_ops presto_obdfs_journal_ops = {
-        .tr_avail        = presto_obdfs_freespace,
-        .tr_start        =  presto_obdfs_trans_start,
-        .tr_commit       = presto_obdfs_trans_commit,
-        .tr_journal_data = presto_obdfs_journal_file_data
-};
-
-#endif
diff -Nru a/fs/intermezzo/journal_reiserfs.c b/fs/intermezzo/journal_reiserfs.c
--- a/fs/intermezzo/journal_reiserfs.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,140 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1998 Peter J. Braam <braam@clusterfs.com>
- *  Copyright (C) 2000 Red Hat, Inc.
- *  Copyright (C) 2000 Los Alamos National Laboratory
- *  Copyright (C) 2000 TurboLinux, Inc.
- *  Copyright (C) 2001 Mountain View Data, Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/types.h>
-#include <linux/param.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-#if 0
-#if defined(CONFIG_REISERFS_FS) || defined(CONFIG_REISERFS_FS_MODULE)
-#include <linux/reiserfs_fs.h>
-#include <linux/reiserfs_fs_sb.h>
-#include <linux/reiserfs_fs_i.h>
-#endif
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#if defined(CONFIG_REISERFS_FS) || defined(CONFIG_REISERFS_FS_MODULE)
-
-
-static loff_t presto_reiserfs_freespace(struct presto_cache *cache,
-                                         struct super_block *sb)
-{
-        struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (sb);
-	loff_t avail;
-
-        avail =   le32_to_cpu(rs->s_free_blocks) * 
-		le16_to_cpu(rs->s_blocksize);
-        return avail; 
-}
-
-/* start the filesystem journal operations */
-static void *presto_reiserfs_trans_start(struct presto_file_set *fset, 
-                                   struct inode *inode, 
-                                   int op)
-{
-	int jblocks;
-        __u32 avail_kmlblocks;
-	struct reiserfs_transaction_handle *th ;
-
-	PRESTO_ALLOC(th, sizeof(*th));
-	if (!th) { 
-		CERROR("presto: No memory for trans handle\n");
-		return NULL;
-	}
-
-        avail_kmlblocks = presto_reiserfs_freespace(fset->fset_cache, 
-						    inode->i_sb);
-        if ( presto_no_journal(fset) ||
-             strcmp(fset->fset_cache->cache_type, "reiserfs"))
-		{
-			CDEBUG(D_JOURNAL, "got cache_type \"%s\"\n",
-			       fset->fset_cache->cache_type);
-			return NULL;
-		}
-
-        if ( avail_kmlblocks < 3 ) {
-                return ERR_PTR(-ENOSPC);
-        }
-        
-        if (  (op != PRESTO_OP_UNLINK && op != PRESTO_OP_RMDIR)
-              && avail_kmlblocks < 6 ) {
-                return ERR_PTR(-ENOSPC);
-        }            
-
-	jblocks = 3 + JOURNAL_PER_BALANCE_CNT * 4;
-        CDEBUG(D_JOURNAL, "creating journal handle (%d blocks)\n", jblocks);
-
-	lock_kernel();
-	journal_begin(th, inode->i_sb, jblocks);
-	unlock_kernel();
-	return th; 
-}
-
-static void presto_reiserfs_trans_commit(struct presto_file_set *fset,
-                                         void *handle)
-{
-	int jblocks;
-	jblocks = 3 + JOURNAL_PER_BALANCE_CNT * 4;
-	
-	lock_kernel();
-	journal_end(handle, fset->fset_cache->cache_sb, jblocks);
-	unlock_kernel();
-	PRESTO_FREE(handle, sizeof(struct reiserfs_transaction_handle));
-}
-
-static void presto_reiserfs_journal_file_data(struct inode *inode)
-{
-#ifdef EXT3_JOURNAL_DATA_FL
-        inode->u.ext3_i.i_flags |= EXT3_JOURNAL_DATA_FL;
-#else
-#warning You must have a facility to enable journaled writes for recovery!
-#endif
-}
-
-static int presto_reiserfs_has_all_data(struct inode *inode)
-{
-        BUG();
-        return 0;
-}
-
-struct journal_ops presto_reiserfs_journal_ops = {
-        .tr_all_data     = presto_reiserfs_has_all_data,
-        .tr_avail        = presto_reiserfs_freespace,
-        .tr_start        = presto_reiserfs_trans_start,
-        .tr_commit       = presto_reiserfs_trans_commit,
-        .tr_journal_data = presto_reiserfs_journal_file_data
-};
-
-#endif
-#endif
diff -Nru a/fs/intermezzo/journal_tmpfs.c b/fs/intermezzo/journal_tmpfs.c
--- a/fs/intermezzo/journal_tmpfs.c	Tue Jun 15 22:21:03 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,107 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1998 Peter J. Braam <braam@clusterfs.com>
- *  Copyright (C) 2000 Red Hat, Inc.
- *  Copyright (C) 2000 Los Alamos National Laboratory
- *  Copyright (C) 2000 TurboLinux, Inc.
- *  Copyright (C) 2001 Mountain View Data, Inc.
- *  Copyright (C) 2001 Tacit Networks, Inc. <phil@off.net>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/types.h>
-#include <linux/param.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-#if defined(CONFIG_TMPFS)
-#include <linux/jbd.h>
-#if defined(CONFIG_EXT3)
-#include <linux/ext3_fs.h>
-#include <linux/ext3_jbd.h>
-#endif
-#endif
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#if defined(CONFIG_TMPFS)
-
-/* space requirements: 
-   presto_do_truncate: 
-        used to truncate the KML forward to next fset->chunksize boundary
-          - zero partial block
-          - update inode
-   presto_write_record: 
-        write header (< one block) 
-        write one path (< MAX_PATHLEN) 
-        possibly write another path (< MAX_PATHLEN)
-        write suffix (< one block) 
-   presto_update_last_rcvd
-        write one block
-*/
-
-static loff_t presto_tmpfs_freespace(struct presto_cache *cache,
-                                         struct super_block *sb)
-{
-        return (1<<30);
-}
-
-/* start the filesystem journal operations */
-static void *presto_tmpfs_trans_start(struct presto_file_set *fset, 
-                                   struct inode *inode, 
-                                   int op)
-{
-        return (void *)1; 
-}
-
-static void presto_tmpfs_trans_commit(struct presto_file_set *fset, void *handle)
-{
-        return;
-}
-
-static void presto_tmpfs_journal_file_data(struct inode *inode)
-{
-        return; 
-}
-
-/* The logic here is a slightly modified version of ext3/inode.c:block_to_path
- */
-static int presto_tmpfs_has_all_data(struct inode *inode)
-{
-        return 0;
-}
-
-struct journal_ops presto_tmpfs_journal_ops = {
-        .tr_all_data            = presto_tmpfs_has_all_data,
-        .tr_avail               = presto_tmpfs_freespace,
-        .tr_start               = presto_tmpfs_trans_start,
-        .tr_commit              = presto_tmpfs_trans_commit,
-        .tr_journal_data        = presto_tmpfs_journal_file_data,
-        .tr_ilookup             = presto_tmpfs_ilookup,
-        .tr_add_ilookup         = presto_add_ilookup_dentry
-};
-
-#endif /* CONFIG_EXT3_FS */
diff -Nru a/fs/intermezzo/journal_xfs.c b/fs/intermezzo/journal_xfs.c
--- a/fs/intermezzo/journal_xfs.c	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,161 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1998 Peter J. Braam <braam@clusterfs.com>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-#if 0
-/* XFS Support not there yet */
-#ifdef CONFIG_FS_XFS
-#include <linux/xfs_fs.h>
-#endif
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-#include "intermezzo_journal.h"
-
-#if 0
-
-/* XFS has journalling, but these functions do nothing yet... */
-
-static unsigned long presto_xfs_freespace(struct presto_file_set *fset,
-                                         struct super_block *sb)
-{
-
-#if 0
-        vfs_t *vfsp = LINVFS_GET_VFS(sb);
-        struct statvfs_t stat; 
-        bhv_desc_t *bdp;
-        unsigned long avail; 
-        int rc;
-
-        VFS_STATVFS(vfsp, &stat, NULL, rc);
-        avail = statp.f_bfree;
-
-        return sbp->sb_fdblocks;
-#endif
-        return 0x0fffffff;
-}
-
-
-/* start the filesystem journal operations */
-static void *
-presto_xfs_trans_start(struct presto_file_set *fset,
-		       struct inode *inode, int op)
-{
-	int xfs_op;
-	/* do a free blocks check as in journal_ext3? does anything protect
-	 * the space in that case or can it disappear out from under us
-	 * anyway? */
-	
-/* copied from xfs_trans.h, skipping header maze for now */
-#define XFS_TRANS_SETATTR_NOT_SIZE      1
-#define XFS_TRANS_SETATTR_SIZE          2
-#define XFS_TRANS_INACTIVE              3
-#define XFS_TRANS_CREATE                4
-#define XFS_TRANS_CREATE_TRUNC          5
-#define XFS_TRANS_TRUNCATE_FILE         6
-#define XFS_TRANS_REMOVE                7
-#define XFS_TRANS_LINK                  8
-#define XFS_TRANS_RENAME                9
-#define XFS_TRANS_MKDIR                 10
-#define XFS_TRANS_RMDIR                 11
-#define XFS_TRANS_SYMLINK               12
-
-	/* map the op onto the values for XFS so it can do reservation. if
-	 * we don't have enough info to differentiate between e.g. setattr
-	 * with or without size, what do we do? will it adjust? */
-	switch (op) {
-	case PRESTO_OP_SETATTR:
-		/* or XFS_TRANS_SETATTR_NOT_SIZE? */
-	        xfs_op = XFS_TRANS_SETATTR_SIZE;
-		break;
-	case PRESTO_OP_CREATE:
-		/* or CREATE_TRUNC? */
-		xfs_op = XFS_TRANS_CREATE;
-		break;
-	case PRESTO_OP_LINK:
-		xfs_op = XFS_TRANS_LINK;
-		break;
-	case PRESTO_OP_UNLINK:
-		xfs_op = XFS_TRANS_REMOVE;
-		break;
-	case PRESTO_OP_SYMLINK:
-		xfs_op = XFS_TRANS_SYMLINK;
-		break;
-	case PRESTO_OP_MKDIR:
-		xfs_op = XFS_TRANS_MKDIR;
-		break;
-	case PRESTO_OP_RMDIR:
-		xfs_op = XFS_TRANS_RMDIR;
-		break;
-	case PRESTO_OP_MKNOD:
-		/* XXX can't find an analog for mknod? */
-		xfs_op = XFS_TRANS_CREATE;
-		break;
-	case PRESTO_OP_RENAME:
-		xfs_op = XFS_TRANS_RENAME;
-		break;
-	default:
-		CDEBUG(D_JOURNAL, "invalid operation %d for journal\n", op);
-		return NULL;
-	}
-
-	return xfs_trans_start(inode, xfs_op);
-}
-
-static void presto_xfs_trans_commit(struct presto_file_set *fset, void *handle)
-{
-	/* assert (handle == current->j_handle) */
-	xfs_trans_stop(handle);
-}
-
-static void presto_xfs_journal_file_data(struct inode *inode)
-{
-        return; 
-}
-
-static int presto_xfs_has_all_data(struct inode *inode)
-{
-        BUG();
-        return 0;
-}
-
-struct journal_ops presto_xfs_journal_ops = {
-        .tr_all_data     = presto_xfs_has_all_data,
-        .tr_avail        = presto_xfs_freespace,
-        .tr_start        = presto_xfs_trans_start,
-        .tr_commit       = presto_xfs_trans_commit,
-        .tr_journal_data = presto_xfs_journal_file_data
-};
-
-#endif
-
-
-#endif /* CONFIG_XFS_FS */
-
diff -Nru a/fs/intermezzo/kml.c b/fs/intermezzo/kml.c
--- a/fs/intermezzo/kml.c	Tue Jun 15 22:20:35 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,194 +0,0 @@
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/module.h>
-#include <asm/uaccess.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_upcall.h"
-#include "intermezzo_psdev.h"
-#include "intermezzo_kml.h"
-
-static struct presto_file_set * kml_getfset (char *path)
-{
-        return presto_path2fileset(path);
-}
-
-/* Send the KML buffer and related volume info into kernel */
-int begin_kml_reint (struct file *file, unsigned long arg)
-{
-        struct {
-                char *volname;
-                int   namelen;  
-                char *recbuf;
-                int   reclen;     /* int   newpos; */
-        } input;
-        struct kml_fsdata *kml_fsdata = NULL;
-        struct presto_file_set *fset = NULL;
-        char   *path;
-        int    error;
-
-        ENTRY;
-        /* allocate buffer & copy it to kernel space */
-        if (copy_from_user(&input, (char *)arg, sizeof(input))) {
-                EXIT;
-                return -EFAULT;
-        }
-
-        if (input.reclen > kml_fsdata->kml_maxsize)
-                return -ENOMEM; /* we'll find solution to this in the future */
-
-        PRESTO_ALLOC(path, char *, input.namelen + 1);
-        if ( !path ) {
-                EXIT;
-                return -ENOMEM;
-        }
-        if (copy_from_user(path, input.volname, input.namelen)) {
-                PRESTO_FREE(path, input.namelen + 1);
-                EXIT;
-                return -EFAULT;
-        }
-        path[input.namelen] = '\0';
-        fset = kml_getfset (path);
-        PRESTO_FREE(path, input.namelen + 1);
-
-        kml_fsdata = FSET_GET_KMLDATA(fset);
-        /* read the buf from user memory here */
-        if (copy_from_user(kml_fsdata->kml_buf, input.recbuf, input.reclen)) {
-                EXIT;
-                return -EFAULT;
-        }
-        kml_fsdata->kml_len = input.reclen;
-
-        decode_kmlrec (&kml_fsdata->kml_reint_cache,
-                        kml_fsdata->kml_buf, kml_fsdata->kml_len);
-
-        kml_fsdata->kml_reint_current = kml_fsdata->kml_reint_cache.next;
-        kml_fsdata->kml_reintpos = 0;
-        kml_fsdata->kml_count = 0;
-        return 0;
-}
-
-/* DO_KML_REINT  */
-int do_kml_reint (struct file *file, unsigned long arg)
-{
-        struct {
-                char *volname;
-                int   namelen;  
-                char *path;
-                int pathlen;
-                int recno;
-                int offset;
-                int len;
-                int generation;
-                __u64 ino;
-        } input;
-        int error;
-        char   *path;
-        struct kml_rec *close_rec;
-        struct kml_fsdata *kml_fsdata;
-        struct presto_file_set *fset;
-
-        ENTRY;
-        if (copy_from_user(&input, (char *)arg, sizeof(input))) {
-                EXIT;
-                return -EFAULT;
-        }
-        PRESTO_ALLOC(path, char *, input.namelen + 1);
-        if ( !path ) {
-                EXIT;
-                return -ENOMEM;
-        }
-        if (copy_from_user(path, input.volname, input.namelen)) {
-                PRESTO_FREE(path, input.namelen + 1);
-                EXIT;
-                return -EFAULT;
-        }
-        path[input.namelen] = '\0';
-        fset = kml_getfset (path);
-        PRESTO_FREE(path, input.namelen + 1);
-
-        kml_fsdata = FSET_GET_KMLDATA(fset);
-
-        error = kml_reintbuf(kml_fsdata, 
-                fset->fset_mtpt->d_name.name, 
-                &close_rec);
-
-        if (error == KML_CLOSE_BACKFETCH && close_rec != NULL) {
-                struct kml_close *close = &close_rec->rec_kml.close;
-                input.ino = close->ino;
-                input.generation = close->generation;
-                if (strlen (close->path) + 1 < input.pathlen) {
-                        strcpy (input.path, close->path);
-                        input.pathlen = strlen (close->path) + 1;
-                        input.recno = close_rec->rec_tail.recno;
-                        input.offset = close_rec->rec_kml_offset;
-                        input.len = close_rec->rec_size;
-                        input.generation = close->generation;
-                        input.ino = close->ino;
-                }
-                else {
-                        CDEBUG(D_KML, "KML_DO_REINT::no space to save:%d < %d",
-                                strlen (close->path) + 1, input.pathlen);
-                        error = -ENOMEM;
-                }
-                if (copy_to_user((char *)arg, &input, sizeof (input)))
-			return -EFAULT;
-        }
-        return error;
-}
-
-/* END_KML_REINT */
-int end_kml_reint (struct file *file, unsigned long arg)
-{
-        /* Free KML buffer and related volume info */
-        struct {
-                char *volname;
-                int   namelen;  
-#if 0
-                int   count; 
-                int   newpos; 
-#endif
-        } input;
-        struct presto_file_set *fset = NULL;
-        struct kml_fsdata *kml_fsdata = NULL;
-        int error;
-        char *path;
-
-        ENTRY;
-        if (copy_from_user(&input, (char *)arg, sizeof(input))) { 
-               EXIT;
-               return -EFAULT;
-        }
-
-        PRESTO_ALLOC(path, char *, input.namelen + 1);
-        if ( !path ) {
-                EXIT;
-                return -ENOMEM;
-        }
-        if (copy_from_user(path, input.volname, input.namelen)) {
-        if ( error ) {
-                PRESTO_FREE(path, input.namelen + 1);
-                EXIT;
-                return -EFAULT;
-        }
-        path[input.namelen] = '\0';
-        fset = kml_getfset (path);
-        PRESTO_FREE(path, input.namelen + 1);
-
-        kml_fsdata = FSET_GET_KMLDATA(fset);
-        delete_kmlrec (&kml_fsdata->kml_reint_cache);
-
-        /* kml reint support */
-        kml_fsdata->kml_reint_current = NULL;
-        kml_fsdata->kml_len = 0;
-        kml_fsdata->kml_reintpos = 0;
-        kml_fsdata->kml_count = 0;
-#if 0
-        input.newpos = kml_upc->newpos;
-        input.count = kml_upc->count;
-        if (copy_to_user((char *)arg, &input, sizeof (input)))
-		return -EFAULT;
-#endif
-        return error;
-}
diff -Nru a/fs/intermezzo/kml_decode.c b/fs/intermezzo/kml_decode.c
--- a/fs/intermezzo/kml_decode.c	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1016 +0,0 @@
-/*
- * KML Decoding
- *
- * Copryright (C) 1996 Arthur Ma <arthur.ma@mountainviewdata.com> 
- *
- * Copyright (C) 2001 Mountainview Data, Inc.
- */
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-#include "intermezzo_fs.h"
-#include "intermezzo_kml.h"
-
-static int size_round (int val);
-static int unpack_create (struct kml_create *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_open (struct kml_open *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_symlink (struct kml_symlink *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_mknod (struct kml_mknod *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_link (struct kml_link *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_rename (struct kml_rename *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_unlink (struct kml_unlink *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_rmdir (struct kml_rmdir *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_setattr (struct kml_setattr *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_close (struct kml_close *rec, char *buf,
-                                int pos, int *rec_offs);
-static int unpack_mkdir (struct kml_mkdir *rec, char *buf,
-                                int pos, int *rec_offs);
-
-#if 0
-static int unpack_endmark (struct kml_endmark *rec, char *buf,
-                                int pos, int *rec_offs);
-static void print_kml_endmark (struct kml_endmark *rec);
-#endif
-
-static int kml_unpack (char *kml_buf, int rec_size, int kml_offset,
-                        struct kml_rec **newrec);
-static char *kml_version (struct presto_version *ver);
-static void print_kml_prefix (struct big_journal_prefix *head);
-static void print_kml_create (struct kml_create *rec);
-static void print_kml_mkdir (struct kml_mkdir *rec);
-static void print_kml_unlink (struct kml_unlink *rec);
-static void print_kml_rmdir (struct kml_rmdir *rec);
-static void print_kml_close (struct kml_close *rec);
-static void print_kml_symlink (struct kml_symlink *rec);
-static void print_kml_rename (struct kml_rename *rec);
-static void print_kml_setattr (struct kml_setattr *rec);
-static void print_kml_link (struct kml_link *rec);
-static void print_kml_mknod (struct kml_mknod *rec);
-static void print_kml_open (struct kml_open *rec);
-static void print_kml_suffix (struct journal_suffix *tail);
-static char *readrec (char *recbuf, int reclen, int pos, int *size);
-
-#define  KML_PREFIX_WORDS           8
-static int kml_unpack (char *kml_buf, int rec_size, int kml_offset, 
-                        struct kml_rec **newrec)
-{
-        struct kml_rec  *rec;
-        char            *p;
-        int             pos, rec_offs;
-        int             error;
-
-        ENTRY;
-        if (rec_size < sizeof (struct journal_prefix) +
-                       sizeof (struct journal_suffix))
-                return -EBADF;
-
-        PRESTO_ALLOC(rec, struct kml_rec *, sizeof (struct kml_rec));
-        if (rec == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-        rec->rec_kml_offset = kml_offset;
-        rec->rec_size = rec_size;
-        p = kml_buf;
-        p = dlogit (&rec->rec_head, p, KML_PREFIX_WORDS * sizeof (int));
-        p = dlogit (&rec->rec_head.groups, p, 
-                        sizeof (int) * rec->rec_head.ngroups);
-
-        pos = sizeof (struct journal_prefix) + 
-                        sizeof (int) * rec->rec_head.ngroups;
-        switch (rec->rec_head.opcode)
-        {
-                case KML_CREATE:
-                        error = unpack_create (&rec->rec_kml.create, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_MKDIR:
-                        error = unpack_mkdir (&rec->rec_kml.mkdir, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_UNLINK:
-                        error = unpack_unlink (&rec->rec_kml.unlink, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_RMDIR:
-                        error = unpack_rmdir (&rec->rec_kml.rmdir, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_CLOSE:
-                        error = unpack_close (&rec->rec_kml.close, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_SYMLINK:
-                        error = unpack_symlink (&rec->rec_kml.symlink, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_RENAME:
-                        error = unpack_rename (&rec->rec_kml.rename, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_SETATTR:
-                        error = unpack_setattr (&rec->rec_kml.setattr, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_LINK:
-                        error = unpack_link (&rec->rec_kml.link, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_OPEN:
-                        error = unpack_open (&rec->rec_kml.open, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-                case KML_MKNOD:
-                        error = unpack_mknod (&rec->rec_kml.mknod, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-#if 0
-                case KML_ENDMARK:
-                        error = unpack_endmark (&rec->rec_kml.endmark, 
-                                        kml_buf, pos, &rec_offs);
-                        break;
-#endif
-                default:
-                        CDEBUG (D_KML, "wrong opcode::%u\n", 
-                                        rec->rec_head.opcode);
-                        EXIT;
-                        return -EINVAL;
-        } 
-        if (error) {
-                PRESTO_FREE (rec, sizeof (struct kml_rec));
-                return -EINVAL;
-        }
-        p = kml_buf + rec_offs;
-        p = dlogit (&rec->rec_tail, p, sizeof (struct journal_suffix));
-        memset (&rec->kml_optimize, 0, sizeof (struct kml_optimize));
-        *newrec = rec;
-        EXIT;
-        return 0;
-}
-
-static int size_round (int val)
-{
-        return (val + 3) & (~0x3);
-}
-
-static int unpack_create (struct kml_create *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 88;
-        int pathlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->mode, p, sizeof (int));
-        p = dlogit (&rec->uid, p, sizeof (int));
-        p = dlogit (&rec->gid, p, sizeof (int));
-        p = dlogit (&pathlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->path = q;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_open (struct kml_open *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        *rec_offs = pos;
-        return 0;
-}
-
-static int unpack_symlink (struct kml_symlink *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 88;
-        int pathlen, targetlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->uid, p, sizeof (int));
-        p = dlogit (&rec->gid, p, sizeof (int));
-        p = dlogit (&pathlen, p, sizeof (int));
-        p = dlogit (&targetlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->sourcepath = q;
-
-        PRESTO_ALLOC(q, char *, targetlen + 1);
-        if (q == NULL) {
-                PRESTO_FREE (rec->sourcepath, pathlen + 1);
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, targetlen);
-        q[targetlen] = '\0';
-        rec->targetpath = q;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen) +
-                        size_round(targetlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_mknod (struct kml_mknod *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 96;
-        int pathlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->mode, p, sizeof (int));
-        p = dlogit (&rec->uid, p, sizeof (int));
-        p = dlogit (&rec->gid, p, sizeof (int));
-        p = dlogit (&rec->major, p, sizeof (int));
-        p = dlogit (&rec->minor, p, sizeof (int));
-        p = dlogit (&pathlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->path = q;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_link (struct kml_link *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 80;
-        int pathlen, targetlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&pathlen, p, sizeof (int));
-        p = dlogit (&targetlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->sourcepath = q;
-        p += size_round (pathlen);
-
-        PRESTO_ALLOC(q, char *, targetlen + 1);
-        if (q == NULL) {
-                PRESTO_FREE (rec->sourcepath, pathlen + 1);
-                EXIT;
-                return -ENOMEM;
-        }
-        memcpy (q, p, targetlen);
-        q[targetlen] = '\0';
-        rec->targetpath = q;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen) +
-                        size_round(targetlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_rename (struct kml_rename *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 104;
-        int pathlen, targetlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_tgtv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->old_tgtv, p, sizeof (struct presto_version));
-        p = dlogit (&pathlen, p, sizeof (int));
-        p = dlogit (&targetlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->sourcepath = q;
-        p += size_round (pathlen);
-
-        PRESTO_ALLOC(q, char *, targetlen + 1);
-        if (q == NULL) {
-                PRESTO_FREE (rec->sourcepath, pathlen + 1);
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, targetlen);
-        q[targetlen] = '\0';
-        rec->targetpath = q;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen) +
-                        size_round(targetlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_unlink (struct kml_unlink *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 80;
-        int pathlen, targetlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->old_tgtv, p, sizeof (struct presto_version));
-        p = dlogit (&pathlen, p, sizeof (int));
-        p = dlogit (&targetlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->path = q;
-        p += size_round (pathlen);
-
-        PRESTO_ALLOC(q, char *, targetlen + 1);
-        if (q == NULL) {
-                PRESTO_FREE (rec->path, pathlen + 1);
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, targetlen);
-        q[targetlen] = '\0';
-        rec->name = q;
-
-        /* fix the presto_journal_unlink problem */
-        *rec_offs = pos + unpack_size + size_round(pathlen) +
-                        size_round(targetlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_rmdir (struct kml_rmdir *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 80;
-        int pathlen, targetlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->old_tgtv, p, sizeof (struct presto_version));
-        p = dlogit (&pathlen, p, sizeof (int));
-        p = dlogit (&targetlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->path = q;
-        p += size_round (pathlen);
-
-        PRESTO_ALLOC(q, char *, targetlen + 1);
-        if (q == NULL) {
-                PRESTO_FREE (rec->path, pathlen + 1);
-                EXIT;
-                return -ENOMEM;
-        }
-        memcpy (q, p, targetlen);
-        q[targetlen] = '\0';
-        rec->name = q;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen) +
-                        size_round(targetlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_setattr (struct kml_setattr *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 72;
-        struct kml_attr {
-                __u64   size, mtime, ctime;
-        } objattr;
-        int     valid, mode, uid, gid, flags;
-        int pathlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&valid, p, sizeof (int));
-        p = dlogit (&mode, p, sizeof (int));
-        p = dlogit (&uid, p, sizeof (int));
-        p = dlogit (&gid, p, sizeof (int));
-        p = dlogit (&objattr, p, sizeof (struct kml_attr));
-        p = dlogit (&flags, p, sizeof (int));
-        p = dlogit (&pathlen, p, sizeof (int));
-
-        rec->iattr.ia_valid = valid;
-        rec->iattr.ia_mode = mode;
-        rec->iattr.ia_uid = uid;
-        rec->iattr.ia_gid = gid;
-        rec->iattr.ia_size = objattr.size;
-        rec->iattr.ia_mtime = objattr.mtime;
-        rec->iattr.ia_ctime = objattr.ctime;
-        rec->iattr.ia_atime = 0;
-        rec->iattr.ia_attr_flags = flags;
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->path = q;
-        p += pathlen;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_close (struct kml_close *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 52;
-        int pathlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->open_mode, p, sizeof (int));
-        p = dlogit (&rec->open_uid, p, sizeof (int));
-        p = dlogit (&rec->open_gid, p, sizeof (int));
-        p = dlogit (&rec->new_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->ino, p, sizeof (__u64));
-        p = dlogit (&rec->generation, p, sizeof (int));
-        p = dlogit (&pathlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->path = q;
-        p += pathlen;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen);
-        EXIT;
-        return 0;
-}
-
-static int unpack_mkdir (struct kml_mkdir *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p, *q;
-        int unpack_size = 88;
-        int pathlen;
-
-        ENTRY;
-        p = buf + pos;
-        p = dlogit (&rec->old_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_parentv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->new_objectv, p, sizeof (struct presto_version));
-        p = dlogit (&rec->mode, p, sizeof (int));
-        p = dlogit (&rec->uid, p, sizeof (int));
-        p = dlogit (&rec->gid, p, sizeof (int));
-        p = dlogit (&pathlen, p, sizeof (int));
-
-        PRESTO_ALLOC(q, char *, pathlen + 1);
-        if (q == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        memcpy (q, p, pathlen);
-        q[pathlen] = '\0';
-        rec->path = q;
-        p += pathlen;
-
-        *rec_offs = pos + unpack_size + size_round(pathlen);
-        EXIT;
-        return 0;
-}
-
-#if 0
-static int unpack_endmark (struct kml_endmark *rec, char *buf, 
-                                int pos, int *rec_offs)
-{
-        char *p;
-        p = buf + pos;
-        p = dlogit (&rec->total, p, sizeof (int));
-
-        PRESTO_ALLOC (rec->kop, struct kml_kop_node *, 
-                        sizeof (struct kml_kop_node) * rec->total);
-        if (rec->kop == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        p = dlogit (rec->kop, p, sizeof (struct kml_kop_node) * rec->total);
-
-        *rec_offs = pos + sizeof (int) + sizeof (struct kml_kop_node) * rec->total;
-        return 0;
-}
-#endif
-
-static char *kml_version (struct presto_version *ver)
-{
-        static char buf[256];
-        sprintf (buf, "mt::%lld, ct::%lld, size::%lld",
-                ver->pv_mtime, ver->pv_ctime, ver->pv_size); 
-        return buf;
-}
-
-static void print_kml_prefix (struct big_journal_prefix *head)
-{
-        int i;
-
-        CDEBUG (D_KML, " === KML PREFIX\n");
-        CDEBUG (D_KML, "     len        = %u\n", head->len);
-        CDEBUG (D_KML, "     version    = %u\n", head->version);
-        CDEBUG (D_KML, "     pid        = %u\n", head->pid);
-        CDEBUG (D_KML, "     uid        = %u\n", head->uid);
-        CDEBUG (D_KML, "     fsuid      = %u\n", head->fsuid);
-        CDEBUG (D_KML, "     fsgid      = %u\n", head->fsgid);
-        CDEBUG (D_KML, "     opcode     = %u\n", head->opcode);
-        CDEBUG (D_KML, "     ngroup     = %u",  head->ngroups);
-        for (i = 0; i < head->ngroups; i++)
-                CDEBUG (D_KML, "%u  ",  head->groups[i]);
-        CDEBUG (D_KML, "\n");
-}
-
-static void print_kml_create (struct kml_create *rec)
-{
-        CDEBUG (D_KML, " === CREATE\n");
-        CDEBUG (D_KML, "     path::%s\n", rec->path);
-        CDEBUG (D_KML, "     new_objv::%s\n", kml_version (&rec->new_objectv));
-        CDEBUG (D_KML, "     old_parv::%s\n", kml_version (&rec->old_parentv));
-        CDEBUG (D_KML, "     new_parv::%s\n", kml_version (&rec->new_parentv));
-        CDEBUG (D_KML, "     mode::%o\n", rec->mode);
-        CDEBUG (D_KML, "     uid::%d\n", rec->uid);
-        CDEBUG (D_KML, "     gid::%d\n", rec->gid);
-}
-
-static void print_kml_mkdir (struct kml_mkdir *rec)
-{
-        CDEBUG (D_KML, " === MKDIR\n");
-        CDEBUG (D_KML, "     path::%s\n", rec->path);
-        CDEBUG (D_KML, "     new_objv::%s\n", kml_version (&rec->new_objectv));
-        CDEBUG (D_KML, "     old_parv::%s\n", kml_version (&rec->old_parentv));
-        CDEBUG (D_KML, "     new_parv::%s\n", kml_version (&rec->new_parentv));
-        CDEBUG (D_KML, "     mode::%o\n", rec->mode);
-        CDEBUG (D_KML, "     uid::%d\n", rec->uid);
-        CDEBUG (D_KML, "     gid::%d\n", rec->gid);
-}
-
-static void print_kml_unlink (struct kml_unlink *rec)
-{
-        CDEBUG (D_KML, " === UNLINK\n");
-        CDEBUG (D_KML, "     path::%s/%s\n", rec->path, rec->name);
-        CDEBUG (D_KML, "     old_tgtv::%s\n", kml_version (&rec->old_tgtv));
-        CDEBUG (D_KML, "     old_parv::%s\n", kml_version (&rec->old_parentv));
-        CDEBUG (D_KML, "     new_parv::%s\n", kml_version (&rec->new_parentv));
-}
-
-static void print_kml_rmdir (struct kml_rmdir *rec)
-{
-        CDEBUG (D_KML, " === RMDIR\n");
-        CDEBUG (D_KML, "     path::%s/%s\n", rec->path, rec->name);
-        CDEBUG (D_KML, "     old_tgtv::%s\n", kml_version (&rec->old_tgtv));
-        CDEBUG (D_KML, "     old_parv::%s\n", kml_version (&rec->old_parentv));
-        CDEBUG (D_KML, "     new_parv::%s\n", kml_version (&rec->new_parentv));
-}
-
-static void print_kml_close (struct kml_close *rec)
-{
-        CDEBUG (D_KML, " === CLOSE\n");
-        CDEBUG (D_KML, "     mode::%o\n", rec->open_mode);
-        CDEBUG (D_KML, "     uid::%d\n", rec->open_uid);
-        CDEBUG (D_KML, "     gid::%d\n", rec->open_gid);
-        CDEBUG (D_KML, "     path::%s\n", rec->path);
-        CDEBUG (D_KML, "     new_objv::%s\n", kml_version (&rec->new_objectv));
-        CDEBUG (D_KML, "     ino::%lld\n", rec->ino);
-        CDEBUG (D_KML, "     gen::%u\n", rec->generation);
-}
-
-static void print_kml_symlink (struct kml_symlink *rec)
-{
-        CDEBUG (D_KML, " === SYMLINK\n");
-        CDEBUG (D_KML, "     s-path::%s\n", rec->sourcepath);
-        CDEBUG (D_KML, "     t-path::%s\n", rec->targetpath);
-        CDEBUG (D_KML, "     old_parv::%s\n", kml_version (&rec->old_parentv));
-        CDEBUG (D_KML, "     new_parv::%s\n", kml_version (&rec->new_parentv));
-        CDEBUG (D_KML, "     new_objv::%s\n", kml_version (&rec->new_objectv));
-        CDEBUG (D_KML, "     uid::%d\n", rec->uid);
-        CDEBUG (D_KML, "     gid::%d\n", rec->gid);
-}
-
-static void print_kml_rename (struct kml_rename *rec)
-{
-        CDEBUG (D_KML, " === RENAME\n");
-        CDEBUG (D_KML, "     s-path::%s\n", rec->sourcepath);
-        CDEBUG (D_KML, "     t-path::%s\n", rec->targetpath);
-        CDEBUG (D_KML, "     old_tgtv::%s\n", kml_version (&rec->old_tgtv));
-        CDEBUG (D_KML, "     new_tgtv::%s\n", kml_version (&rec->new_tgtv));
-        CDEBUG (D_KML, "     new_objv::%s\n", kml_version (&rec->new_objectv));
-        CDEBUG (D_KML, "     old_objv::%s\n", kml_version (&rec->old_objectv));
-}
-
-static void print_kml_setattr (struct kml_setattr *rec)
-{
-        CDEBUG (D_KML, " === SETATTR\n");
-        CDEBUG (D_KML, "     path::%s\n", rec->path);
-        CDEBUG (D_KML, "     old_objv::%s\n", kml_version (&rec->old_objectv));
-        CDEBUG (D_KML, "     valid::0x%x\n", rec->iattr.ia_valid);
-        CDEBUG (D_KML, "     mode::%o\n", rec->iattr.ia_mode);
-        CDEBUG (D_KML, "     uid::%d\n", rec->iattr.ia_uid);
-        CDEBUG (D_KML, "     gid::%d\n", rec->iattr.ia_gid);
-        CDEBUG (D_KML, "     size::%u\n", (u32) rec->iattr.ia_size);
-        CDEBUG (D_KML, "     mtime::%u\n", (u32) rec->iattr.ia_mtime);
-        CDEBUG (D_KML, "     ctime::%u\n", (u32) rec->iattr.ia_ctime);
-        CDEBUG (D_KML, "     flags::%u\n", (u32) rec->iattr.ia_attr_flags);
-}
-
-static void print_kml_link (struct kml_link *rec)
-{
-        CDEBUG (D_KML, " === LINK\n");
-        CDEBUG (D_KML, "     path::%s ==> %s\n", rec->sourcepath, rec->targetpath);
-        CDEBUG (D_KML, "     old_parv::%s\n", kml_version (&rec->old_parentv));
-        CDEBUG (D_KML, "     new_obj::%s\n", kml_version (&rec->new_objectv));
-        CDEBUG (D_KML, "     new_parv::%s\n", kml_version (&rec->new_parentv));
-}
-
-static void print_kml_mknod (struct kml_mknod *rec)
-{
-        CDEBUG (D_KML, " === MKNOD\n");
-        CDEBUG (D_KML, "     path::%s\n", rec->path);
-        CDEBUG (D_KML, "     new_obj::%s\n", kml_version (&rec->new_objectv));
-        CDEBUG (D_KML, "     old_parv::%s\n", kml_version (&rec->old_parentv));
-        CDEBUG (D_KML, "     new_parv::%s\n", kml_version (&rec->new_parentv));
-        CDEBUG (D_KML, "     mode::%o\n", rec->mode);
-        CDEBUG (D_KML, "     uid::%d\n", rec->uid);
-        CDEBUG (D_KML, "     gid::%d\n", rec->gid);
-        CDEBUG (D_KML, "     major::%d\n", rec->major);
-        CDEBUG (D_KML, "     minor::%d\n", rec->minor);
-}
-
-static void print_kml_open (struct kml_open *rec)
-{
-        CDEBUG (D_KML, " === OPEN\n");
-}
-
-#if 0
-static void print_kml_endmark (struct kml_endmark *rec)
-{
-        int i;
-        CDEBUG (D_KML, " === ENDMARK\n");
-        CDEBUG (D_KML, "     total::%u\n", rec->total);
-        for (i = 0; i < rec->total; i++)
-        {       
-                CDEBUG (D_KML, "         recno=%ld::flag=%ld,op=%ld, i_ino=%ld, \
-                        i_nlink=%ld\n", (long) rec->kop[i].kml_recno, 
-                        (long) rec->kop[i].kml_flag, (long) rec->kop[i].kml_op, 
-                        (long) rec->kop[i].i_ino, (long) rec->kop[i].i_nlink);
-        }
-}
-#endif
-
-static void print_kml_optimize (struct kml_optimize  *rec)
-{
-        CDEBUG (D_KML, " === OPTIMIZE\n");
-        if (rec->kml_flag == KML_REC_DELETE)
-                CDEBUG (D_KML, "     kml_flag::deleted\n");
-        else
-                CDEBUG (D_KML, "     kml_flag::exist\n");
-        CDEBUG (D_KML, "     kml_op::%u\n", rec->kml_op);
-        CDEBUG (D_KML, "     i_nlink::%d\n", rec->i_nlink);
-        CDEBUG (D_KML, "     i_ino::%u\n", rec->i_ino);
-}
-
-static void print_kml_suffix (struct journal_suffix *tail)
-{
-        CDEBUG (D_KML, " === KML SUFFIX\n");
-        CDEBUG (D_KML, "     prevrec::%ld\n", tail->prevrec);
-        CDEBUG (D_KML, "     recno::%ld\n", (long) tail->recno);
-        CDEBUG (D_KML, "     time::%d\n", tail->time);
-        CDEBUG (D_KML, "     len::%d\n", tail->len);
-}
-
-void kml_printrec (struct kml_rec *rec, int kml_printop)
-{
-        if (kml_printop & PRINT_KML_PREFIX)
-                print_kml_prefix (&rec->rec_head);
-        if (kml_printop & PRINT_KML_REC) 
-        { 
-                switch (rec->rec_head.opcode)
-                {
-                        case KML_CREATE:
-                                print_kml_create (&rec->rec_kml.create);
-                                break;
-                        case KML_MKDIR:
-                                print_kml_mkdir (&rec->rec_kml.mkdir);
-                                break;
-                        case KML_UNLINK:
-                                print_kml_unlink (&rec->rec_kml.unlink);
-                                break;
-                        case KML_RMDIR:
-                                print_kml_rmdir (&rec->rec_kml.rmdir);
-                                break;
-                        case KML_CLOSE:
-                                print_kml_close (&rec->rec_kml.close);
-                                break;
-                        case KML_SYMLINK:
-                                print_kml_symlink (&rec->rec_kml.symlink);
-                                break;
-                        case KML_RENAME:
-                                print_kml_rename (&rec->rec_kml.rename);
-                                break;
-                        case KML_SETATTR:
-                                print_kml_setattr (&rec->rec_kml.setattr);
-                                break;
-                        case KML_LINK:
-                                print_kml_link (&rec->rec_kml.link);
-                                break;
-                        case KML_OPEN:
-                                print_kml_open (&rec->rec_kml.open);
-                                break;
-                        case KML_MKNOD:
-                                print_kml_mknod (&rec->rec_kml.mknod);
-                                break;
-#if 0
-                        case KML_ENDMARK:
-                                print_kml_endmark (&rec->rec_kml.endmark);
-#endif
-                                break;
-                        default:
-                                CDEBUG (D_KML, " === BAD RECORD, opcode=%u\n",
-                                        rec->rec_head.opcode);
-                                break;
-                }
-        }
-        if (kml_printop & PRINT_KML_SUFFIX)
-                print_kml_suffix (&rec->rec_tail);
-        if (kml_printop & PRINT_KML_OPTIMIZE)
-                print_kml_optimize (&rec->kml_optimize);
-}
-
-void kml_freerec (struct kml_rec *rec)
-{
-        char *sourcepath = NULL,
-             *targetpath = NULL;
-        switch (rec->rec_head.opcode)
-        {
-                case KML_CREATE:
-                        sourcepath = rec->rec_kml.create.path;
-                        break;
-                case KML_MKDIR:
-                        sourcepath = rec->rec_kml.create.path;
-                        break;
-                case KML_UNLINK:
-                        sourcepath = rec->rec_kml.unlink.path;
-                        targetpath = rec->rec_kml.unlink.name;
-                        break;
-                case KML_RMDIR:
-                        sourcepath = rec->rec_kml.rmdir.path;
-                        targetpath = rec->rec_kml.rmdir.name;
-                        break;
-                case KML_CLOSE:
-                        sourcepath = rec->rec_kml.close.path;
-                        break;
-                case KML_SYMLINK:
-                        sourcepath = rec->rec_kml.symlink.sourcepath;
-                        targetpath = rec->rec_kml.symlink.targetpath;
-                        break;
-                case KML_RENAME:
-                        sourcepath = rec->rec_kml.rename.sourcepath;
-                        targetpath = rec->rec_kml.rename.targetpath;
-                        break;
-                case KML_SETATTR:
-                        sourcepath = rec->rec_kml.setattr.path;
-                        break;
-                case KML_LINK:
-                        sourcepath = rec->rec_kml.link.sourcepath;
-                        targetpath = rec->rec_kml.link.targetpath;
-                        break;
-                case KML_OPEN:
-                        break;
-                case KML_MKNOD:
-                        sourcepath = rec->rec_kml.mknod.path;
-                        break;
-#if 0
-                case KML_ENDMARK:
-                        PRESTO_FREE (rec->rec_kml.endmark.kop, sizeof (int) + 
-                                sizeof (struct kml_kop_node) * 
-                                rec->rec_kml.endmark.total);
-#endif
-                        break;
-                default:
-                        break;
-        }
-        if (sourcepath != NULL)
-                PRESTO_FREE (sourcepath, strlen (sourcepath) + 1);
-        if (targetpath != NULL)
-                PRESTO_FREE (targetpath, strlen (targetpath) + 1);
-}
-
-char *readrec (char *recbuf, int reclen, int pos, int *size)
-{
-        char *p = recbuf + pos;
-        *size = *((int *) p);
-        if (*size > (reclen - pos))
-            return NULL;
-        return p; 
-}
-
-int kml_decoderec (char *buf, int pos, int buflen, int *size, 
-                        struct kml_rec **newrec)
-{
-        char *tmp;
-        int  error;
-        tmp = readrec (buf, buflen, pos, size);
-        if (tmp == NULL)
-                return -EBADF;
-        error = kml_unpack (tmp, *size, pos, newrec); 
-        return error;
-}
-
-#if 0
-static void fill_kmlrec_optimize (struct list_head *head, 
-                struct kml_rec *optrec)
-{
-        struct kml_rec *kmlrec;
-        struct list_head *tmp;
-        struct kml_endmark *km;
-        struct kml_optimize *ko;
-        int    n;
-
-        if (optrec->rec_kml.endmark.total == 0)
-                return;
-        n = optrec->rec_kml.endmark.total - 1;
-        tmp = head->prev;
-        km = &optrec->rec_kml.endmark;
-        while ( n >= 0 && tmp != head ) 
-        {
-                kmlrec = list_entry(tmp, struct kml_rec,
-                        kml_optimize.kml_chains);
-                tmp = tmp->prev;
-                if (kmlrec->rec_tail.recno == km->kop[n].kml_recno) 
-                {
-                        ko = &kmlrec->kml_optimize;
-                        ko->kml_flag = km->kop[n].kml_flag;
-                        ko->kml_op   = km->kop[n].kml_op;
-                        ko->i_nlink  = km->kop[n].i_nlink;
-                        ko->i_ino    = km->kop[n].i_ino;
-                        n --;
-                }
-        }
-        if (n != -1)
-                CDEBUG (D_KML, "Yeah!!!, KML optimize error, recno=%d, n=%d\n",
-                        optrec->rec_tail.recno, n);     
-}
-#endif
-
-int decode_kmlrec (struct list_head *head, char *kml_buf, int buflen)
-{
-        struct kml_rec *rec;
-        int    pos = 0, size;
-        int    err;
-        while (pos < buflen) {
-                err = kml_decoderec (kml_buf, pos, buflen, &size, &rec);
-                if (err != 0)
-                        break;
-#if 0
-                if (rec->rec_head.opcode == KML_ENDMARK) {
-                        fill_kmlrec_optimize (head, rec);
-                        mark_rec_deleted (rec);
-                }
-#endif
-                list_add_tail (&rec->kml_optimize.kml_chains, head);
-                pos += size;
-        }
-        return err;
-}
-
-int delete_kmlrec (struct list_head *head)
-{
-        struct kml_rec *rec;
-        struct list_head *tmp;
-
-        if (list_empty(head))
-                return 0;
-        tmp = head->next;
-        while ( tmp != head ) {
-                rec = list_entry(tmp, struct kml_rec, 
-                        kml_optimize.kml_chains);
-                tmp = tmp->next;
-                kml_freerec (rec);
-        }
-        INIT_LIST_HEAD(head);
-        return 0;
-}
-
-int print_allkmlrec (struct list_head *head, int printop)
-{
-        struct kml_rec *rec;
-        struct list_head *tmp;
-
-        if (list_empty(head))
-                return 0;
-        tmp = head->next;
-        while ( tmp != head ) {
-                rec = list_entry(tmp, struct kml_rec,
-                        kml_optimize.kml_chains);
-                tmp = tmp->next;
-#if 0
-                if (printop & PRINT_KML_EXIST) {
-                        if (is_deleted_node (rec))
-                                continue;
-                }
-                else if (printop & PRINT_KML_DELETE) {
-                        if (! is_deleted_node (rec))
-                                continue;
-                }
-#endif
-                kml_printrec (rec, printop);
-        }
-        INIT_LIST_HEAD(head);
-        return 0;
-}
-
diff -Nru a/fs/intermezzo/kml_reint.c b/fs/intermezzo/kml_reint.c
--- a/fs/intermezzo/kml_reint.c	Tue Jun 15 22:20:44 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,647 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Reintegration of KML records
- *
- */
-
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/mmu_context.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-static void kmlreint_pre_secure(struct kml_rec *rec, struct file *dir,
-                                struct run_ctxt *saved)
-{
-        struct run_ctxt ctxt; 
-        struct presto_dentry_data *dd = presto_d2d(dir->f_dentry);
-        int i;
-
-        ctxt.fsuid = rec->prefix.hdr->fsuid;
-        ctxt.fsgid = rec->prefix.hdr->fsgid;
-        ctxt.fs = KERNEL_DS; 
-        ctxt.pwd = dd->dd_fset->fset_dentry;
-        ctxt.pwdmnt = dd->dd_fset->fset_mnt;
-
-        ctxt.root = ctxt.pwd;
-        ctxt.rootmnt = ctxt.pwdmnt;
-        if (rec->prefix.hdr->ngroups > 0) {
-                ctxt.group_info = groups_alloc(rec->prefix.hdr->ngroups);
-                for (i = 0; i< ctxt.group_info->ngroups; i++) 
-                        GROUP_AT(ctxt.group_info,i)= rec->prefix.groups[i];
-        } else
-                ctxt.group_info = groups_alloc(0);
-
-        push_ctxt(saved, &ctxt);
-}
-
-
-/* Append two strings in a less-retarded fashion. */
-static char * path_join(char *p1, int p1len, char *p2, int p2len)
-{
-        int size = p1len + p2len + 2; /* possibly one extra /, one NULL */
-        char *path;
-
-        path = kmalloc(size, GFP_KERNEL);
-        if (path == NULL)
-                return NULL;
-
-        memcpy(path, p1, p1len);
-        if (path[p1len - 1] != '/') {
-                path[p1len] = '/';
-                p1len++;
-        }
-        memcpy(path + p1len, p2, p2len);
-        path[p1len + p2len] = '\0';
-
-        return path;
-}
-
-static inline int kml_recno_equal(struct kml_rec *rec,
-                                  struct presto_file_set *fset)
-{
-        return (rec->suffix->recno == fset->fset_lento_recno + 1);
-}
-
-static inline int version_equal(struct presto_version *a, struct inode *inode)
-{
-        if (a == NULL)
-                return 1;
-
-        if (inode == NULL) {
-                CERROR("InterMezzo: NULL inode in version_equal()\n");
-                return 0;
-        }
-
-        if (inode->i_mtime.tv_sec == a->pv_mtime_sec &&
-            inode->i_mtime.tv_nsec == a->pv_mtime_nsec &&
-            (S_ISDIR(inode->i_mode) || inode->i_size == a->pv_size))
-                return 1;
-
-        return 0;
-}
-
-static int reint_close(struct kml_rec *rec, struct file *file,
-                       struct lento_vfs_context *given_info)
-{
-        struct run_ctxt saved_ctxt;
-        int error;
-        struct presto_file_set *fset;
-        struct lento_vfs_context info; 
-        ENTRY;
-
-        memcpy(&info, given_info, sizeof(*given_info));
-
-
-        CDEBUG (D_KML, "=====REINT_CLOSE::%s\n", rec->path);
-
-        fset = presto_fset(file->f_dentry);
-        if (fset->fset_flags & FSET_DATA_ON_DEMAND) {
-                struct iattr iattr;
-
-                iattr.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_SIZE;
-                iattr.ia_mtime.tv_sec = (time_t)rec->new_objectv->pv_mtime_sec;
-                iattr.ia_mtime.tv_nsec = (time_t)rec->new_objectv->pv_mtime_nsec;
-                iattr.ia_ctime.tv_sec = (time_t)rec->new_objectv->pv_ctime_sec;
-                iattr.ia_ctime.tv_nsec = (time_t)rec->new_objectv->pv_ctime_nsec;
-                iattr.ia_size = (time_t)rec->new_objectv->pv_size;
-
-                /* no kml record, but update last rcvd */
-                /* save fileid in dentry for later backfetch */
-                info.flags |= LENTO_FL_EXPECT | LENTO_FL_SET_DDFILEID;
-                info.remote_ino = rec->ino;
-                info.remote_generation = rec->generation;
-                info.flags &= ~LENTO_FL_KML;
-                kmlreint_pre_secure(rec, file, &saved_ctxt);
-                error = lento_setattr(rec->path, &iattr, &info);
-                pop_ctxt(&saved_ctxt);
-
-                presto_d2d(file->f_dentry)->dd_flags &= ~PRESTO_DATA;
-        } else {
-                int minor = presto_f2m(fset);
-
-                info.updated_time.tv_sec = rec->new_objectv->pv_mtime_sec;
-                info.updated_time.tv_nsec = rec->new_objectv->pv_mtime_nsec;
-                memcpy(&info.remote_version, rec->old_objectv, 
-                       sizeof(*rec->old_objectv));
-                info.remote_ino = rec->ino;
-                info.remote_generation = rec->generation;
-                error = izo_upc_backfetch(minor, rec->path, fset->fset_name,
-                                          &info);
-                if (error) {
-                        CERROR("backfetch error %d\n", error);
-                        /* if file doesn't exist anymore,  then ignore the CLOSE
-                         * and just update the last_rcvd.
-                         */
-                        if (error == ENOENT) {
-                                CDEBUG(D_KML, "manually updating remote offset uuid %s"
-                                       "recno %d offset %Lu\n", info.uuid, info.recno,
-                                       (unsigned long long) info.kml_offset);
-                                error = izo_rcvd_upd_remote(fset, info.uuid, info.recno, info.kml_offset);
-                                if(error)
-                                        CERROR("izo_rcvd_upd_remote error %d\n", error);
-
-                        } 
-                }
-                        
-                /* propagate error to avoid further reint */
-        }
-
-        EXIT;
-        return error;
-}
-
-static int reint_create(struct kml_rec *rec, struct file *dir,
-                        struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        int     error;        ENTRY;
-
-        CDEBUG (D_KML, "=====REINT_CREATE::%s\n", rec->path);
-        info->updated_time.tv_sec = rec->new_objectv->pv_ctime_sec;
-        info->updated_time.tv_nsec = rec->new_objectv->pv_ctime_nsec;
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-        error = lento_create(rec->path, rec->mode, info);
-        pop_ctxt(&saved_ctxt); 
-
-        EXIT;
-        return error;
-}
-
-static int reint_link(struct kml_rec *rec, struct file *dir,
-                      struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        int     error;
-
-        ENTRY;
-
-        CDEBUG (D_KML, "=====REINT_LINK::%s -> %s\n", rec->path, rec->target);
-        info->updated_time.tv_sec = rec->new_objectv->pv_mtime_sec;
-        info->updated_time.tv_nsec = rec->new_objectv->pv_mtime_nsec;
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-        error = lento_link(rec->path, rec->target, info);
-        pop_ctxt(&saved_ctxt); 
-
-        EXIT;
-        return error;
-}
-
-static int reint_mkdir(struct kml_rec *rec, struct file *dir,
-                       struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        int     error;
-
-        ENTRY;
-
-        CDEBUG (D_KML, "=====REINT_MKDIR::%s\n", rec->path);
-        info->updated_time.tv_sec = rec->new_objectv->pv_ctime_sec;
-        info->updated_time.tv_nsec = rec->new_objectv->pv_ctime_nsec;
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-        error = lento_mkdir(rec->path, rec->mode, info);
-        pop_ctxt(&saved_ctxt); 
-
-        EXIT;
-        return error;
-}
-
-static int reint_mknod(struct kml_rec *rec, struct file *dir,
-                       struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        int     error;
-	dev_t dev;
-
-        ENTRY;
-
-        CDEBUG (D_KML, "=====REINT_MKNOD::%s\n", rec->path);
-        info->updated_time.tv_sec = rec->new_objectv->pv_ctime_sec;
-        info->updated_time.tv_nsec = rec->new_objectv->pv_ctime_nsec;
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-
-        dev = rec->rdev ? old_decode_dev(rec->rdev) : MKDEV(rec->major, rec->minor);
-
-        error = lento_mknod(rec->path, rec->mode, dev, info);
-        pop_ctxt(&saved_ctxt); 
-
-        EXIT;
-        return error;
-}
-
-
-static int reint_noop(struct kml_rec *rec, struct file *dir,
-                      struct lento_vfs_context *info)
-{
-        return 0;
-}
-
-static int reint_rename(struct kml_rec *rec, struct file *dir,
-                        struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        int     error;
-
-        ENTRY;
-
-        CDEBUG (D_KML, "=====REINT_RENAME::%s -> %s\n", rec->path, rec->target);
-        info->updated_time.tv_sec = rec->new_objectv->pv_mtime_sec;
-        info->updated_time.tv_nsec = rec->new_objectv->pv_mtime_nsec;
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-        error = lento_rename(rec->path, rec->target, info);
-        pop_ctxt(&saved_ctxt); 
-
-        EXIT;
-        return error;
-}
-
-static int reint_rmdir(struct kml_rec *rec, struct file *dir,
-                       struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        int     error;
-        char *path;
-
-        ENTRY;
-
-        path = path_join(rec->path, rec->pathlen - 1, rec->target, rec->targetlen);
-        if (path == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        CDEBUG (D_KML, "=====REINT_RMDIR::%s\n", path);
-        info->updated_time.tv_sec = rec->new_parentv->pv_mtime_sec;
-        info->updated_time.tv_nsec = rec->new_parentv->pv_mtime_nsec;
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-        error = lento_rmdir(path, info);
-        pop_ctxt(&saved_ctxt); 
-
-        kfree(path);
-        EXIT;
-        return error;
-}
-
-static int reint_setattr(struct kml_rec *rec, struct file *dir,
-                         struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        struct iattr iattr;
-        int     error;
-
-        ENTRY;
-
-        iattr.ia_valid = rec->valid;
-        iattr.ia_mode  = (umode_t)rec->mode;
-        iattr.ia_uid   = (uid_t)rec->uid;
-        iattr.ia_gid   = (gid_t)rec->gid;
-        iattr.ia_size  = (off_t)rec->size;
-        iattr.ia_ctime.tv_sec = rec->ctime_sec;
-        iattr.ia_ctime.tv_nsec = rec->ctime_nsec;
-        iattr.ia_mtime.tv_sec = rec->mtime_sec;
-        iattr.ia_mtime.tv_nsec = rec->mtime_nsec;
-        iattr.ia_atime = iattr.ia_mtime; /* We don't track atimes. */
-        iattr.ia_attr_flags = rec->flags;
-
-        CDEBUG (D_KML, "=====REINT_SETATTR::%s (%d)\n", rec->path, rec->valid);
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-        error = lento_setattr(rec->path, &iattr, info);
-        pop_ctxt(&saved_ctxt); 
-
-        EXIT;
-        return error;
-}
-
-static int reint_symlink(struct kml_rec *rec, struct file *dir,
-                         struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        int     error;
-
-        ENTRY;
-
-        CDEBUG (D_KML, "=====REINT_SYMLINK::%s -> %s\n", rec->path, rec->target);
-        info->updated_time.tv_sec = rec->new_objectv->pv_ctime_sec;
-        info->updated_time.tv_nsec = rec->new_objectv->pv_ctime_nsec;
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-        error = lento_symlink(rec->target, rec->path, info);
-        pop_ctxt(&saved_ctxt); 
-
-        EXIT;
-        return error;
-}
-
-static int reint_unlink(struct kml_rec *rec, struct file *dir,
-                        struct lento_vfs_context *info)
-{
-        struct run_ctxt saved_ctxt;
-        int     error;
-        char *path;
-
-        ENTRY;
-
-        path = path_join(rec->path, rec->pathlen - 1, rec->target, rec->targetlen);
-        if (path == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-
-        CDEBUG (D_KML, "=====REINT_UNLINK::%s\n", path);
-        info->updated_time.tv_sec = rec->new_parentv->pv_mtime_sec;
-        info->updated_time.tv_nsec = rec->new_parentv->pv_mtime_nsec;
-        kmlreint_pre_secure(rec, dir, &saved_ctxt);
-        error = lento_unlink(path, info);
-        pop_ctxt(&saved_ctxt); 
-
-        kfree(path);
-        EXIT;
-        return error;
-}
-
-static int branch_reint_rename(struct presto_file_set *fset, struct kml_rec *rec, 
-                   struct file *dir, struct lento_vfs_context *info,
-                   char * kml_data, __u64 kml_size)
-{
-        int     error;
-
-        ENTRY;
-
-        error = reint_rename(rec, dir, info);
-        if (error == -ENOENT) {
-                /* normal reint failed because path was not found */
-                struct rec_info rec;
-                
-                CDEBUG(D_KML, "saving branch rename kml\n");
-                rec.is_kml = 1;
-                rec.size = kml_size;
-                error = presto_log(fset, &rec, kml_data, kml_size,
-                           NULL, 0, NULL, 0,  NULL, 0);
-                if (error == 0)
-                        error = presto_write_last_rcvd(&rec, fset, info);
-        }
-
-        EXIT;
-        return error;
-}
-
-int branch_reinter(struct presto_file_set *fset, struct kml_rec *rec, 
-                   struct file *dir, struct lento_vfs_context *info,
-                   char * kml_data, __u64 kml_size)
-{
-        int error = 0;
-        int op = rec->prefix.hdr->opcode;
-
-        if (op == KML_OPCODE_CLOSE) {
-                /* regular close and backfetch */
-                error = reint_close(rec, dir, info);
-        } else if  (op == KML_OPCODE_RENAME) {
-                /* rename only if name already exists  */
-                error = branch_reint_rename(fset, rec, dir, info,
-                                            kml_data, kml_size);
-        } else {
-                /* just rewrite kml into branch/kml and update last_rcvd */
-                struct rec_info rec;
-                
-                CDEBUG(D_KML, "Saving branch kml\n");
-                rec.is_kml = 1;
-                rec.size = kml_size;
-                error = presto_log(fset, &rec, kml_data, kml_size,
-                           NULL, 0, NULL, 0,  NULL, 0);
-                if (error == 0)
-                        error = presto_write_last_rcvd(&rec, fset, info);
-        }
-                
-        return error;
-}
-
-typedef int (*reinter_t)(struct kml_rec *rec, struct file *basedir,
-                         struct lento_vfs_context *info);
-
-static reinter_t presto_reinters[KML_OPCODE_NUM] =
-{
-        [KML_OPCODE_CLOSE] = reint_close,
-        [KML_OPCODE_CREATE] = reint_create,
-        [KML_OPCODE_LINK] = reint_link,
-        [KML_OPCODE_MKDIR] = reint_mkdir,
-        [KML_OPCODE_MKNOD] = reint_mknod,
-        [KML_OPCODE_NOOP] = reint_noop,
-        [KML_OPCODE_RENAME] = reint_rename,
-        [KML_OPCODE_RMDIR] = reint_rmdir,
-        [KML_OPCODE_SETATTR] = reint_setattr,
-        [KML_OPCODE_SYMLINK] = reint_symlink,
-        [KML_OPCODE_UNLINK] = reint_unlink,
-};
-
-static inline reinter_t get_reinter(int op)
-{
-        if (op < 0 || op >= sizeof(presto_reinters) / sizeof(reinter_t)) 
-                return NULL; 
-        else 
-                return  presto_reinters[op];
-}
-
-int kml_reint_rec(struct file *dir, struct izo_ioctl_data *data)
-{
-        char *ptr;
-        char *end;
-        struct kml_rec rec;
-        int error = 0;
-        struct lento_vfs_context info;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct presto_dentry_data *dd = presto_d2d(dir->f_dentry);
-        int op;
-        reinter_t reinter;
-
-        struct izo_rcvd_rec lr_rec;
-        int off;
-
-        ENTRY;
-
-        error = presto_prep(dir->f_dentry, &cache, &fset);
-        if ( error  ) {
-                CERROR("intermezzo: Reintegration on invalid file\n");
-                return error;
-        }
-
-        if (!dd || !dd->dd_fset || dd->dd_fset->fset_dentry != dir->f_dentry) { 
-                CERROR("intermezzo: reintegration on non-fset root (ino %ld)\n",
-                       dir->f_dentry->d_inode->i_ino);
-                    
-                return -EINVAL;
-        }
-
-        if (data->ioc_plen1 > 64 * 1024) {
-                EXIT;
-                return -ENOSPC;
-        }
-
-        ptr = fset->fset_reint_buf;
-        end = ptr + data->ioc_plen1;
-
-        if (copy_from_user(ptr, data->ioc_pbuf1, data->ioc_plen1)) { 
-                EXIT;
-                error = -EFAULT;
-                goto out;
-        }
-
-        error = kml_unpack(&rec, &ptr, end);
-        if (error) { 
-                EXIT;
-                error = -EFAULT;
-                goto out;
-        }
-
-        off = izo_rcvd_get(&lr_rec, fset, data->ioc_uuid);
-        if (off < 0) {
-                CERROR("No last_rcvd record, setting to 0\n");
-                memset(&lr_rec, 0, sizeof(lr_rec));
-        }
- 
-        data->ioc_kmlsize = ptr - fset->fset_reint_buf;
-
-        if (rec.suffix->recno != lr_rec.lr_remote_recno + 1) {
-                CERROR("KML record number %Lu expected, not %d\n",
-                       (unsigned long long) (lr_rec.lr_remote_recno + 1),
-                       rec.suffix->recno);
-
-#if 0
-                if (!version_check(&rec, dd->dd_fset, &info)) {
-                        /* FIXME: do an upcall to resolve conflicts */
-                        CERROR("intermezzo: would be a conflict!\n");
-                        error = -EINVAL;
-                        EXIT;
-                        goto out;
-                }
-#endif
-        }
-
-        op = rec.prefix.hdr->opcode;
-
-        reinter = get_reinter(op);
-        if (!reinter) { 
-                CERROR("%s: Unrecognized KML opcode %d\n", __FUNCTION__, op);
-                error = -EINVAL;
-                EXIT;
-                goto out;
-        }
-
-        info.kml_offset = data->ioc_offset + data->ioc_kmlsize;
-        info.recno = rec.suffix->recno;
-        info.flags = LENTO_FL_EXPECT;
-        if (data->ioc_flags)
-                info.flags |= LENTO_FL_KML;
-
-        memcpy(info.uuid, data->ioc_uuid, sizeof(info.uuid));
-
-        if (fset->fset_flags & FSET_IS_BRANCH && data->ioc_flags)
-                error = branch_reinter(fset, &rec, dir, &info, fset->fset_reint_buf,
-                                       data->ioc_kmlsize);
-        else 
-                error = reinter(&rec, dir, &info);
- out: 
-        EXIT;
-        return error;
-}
-
-int izo_get_fileid(struct file *dir, struct izo_ioctl_data *data)
-{
-        char *buf = NULL; 
-        char *ptr;
-        char *end;
-        struct kml_rec rec;
-        struct file *file;
-        struct presto_cache *cache;
-        struct presto_file_set *fset;
-        struct presto_dentry_data *dd = presto_d2d(dir->f_dentry);
-        struct run_ctxt saved_ctxt;
-        int     error;
-
-        ENTRY;
-
-        error = presto_prep(dir->f_dentry, &cache, &fset);
-        if ( error  ) {
-                CERROR("intermezzo: Reintegration on invalid file\n");
-                return error;
-        }
-
-        if (!dd || !dd->dd_fset || dd->dd_fset->fset_dentry != dir->f_dentry) { 
-                CERROR("intermezzo: reintegration on non-fset root (ino %ld)\n",
-                       dir->f_dentry->d_inode->i_ino);
-                    
-                return -EINVAL;
-        }
-
-
-        PRESTO_ALLOC(buf, data->ioc_plen1);
-        if (!buf) { 
-                EXIT;
-                return -ENOMEM;
-        }
-        ptr = buf;
-        end = buf + data->ioc_plen1;
-
-        if (copy_from_user(buf, data->ioc_pbuf1, data->ioc_plen1)) { 
-                EXIT;
-                PRESTO_FREE(buf, data->ioc_plen1);
-                return -EFAULT;
-        }
-
-        error = kml_unpack(&rec, &ptr, end);
-        if (error) { 
-                EXIT;
-                PRESTO_FREE(buf, data->ioc_plen1);
-                return -EFAULT;
-        }
-
-        kmlreint_pre_secure(&rec, dir, &saved_ctxt);
-
-        file = filp_open(rec.path, O_RDONLY, 0);
-        if (!file || IS_ERR(file)) { 
-                error = PTR_ERR(file);
-                goto out;
-        }
-        data->ioc_ino = file->f_dentry->d_inode->i_ino;
-        data->ioc_generation = file->f_dentry->d_inode->i_generation; 
-        filp_close(file, 0); 
-
-        CDEBUG(D_FILE, "%s ino %Lx, gen %Lx\n", rec.path,
-               (unsigned long long) data->ioc_ino,
-               (unsigned long long) data->ioc_generation);
-
- out:
-        if (buf) 
-                PRESTO_FREE(buf, data->ioc_plen1);
-        pop_ctxt(&saved_ctxt); 
-        EXIT;
-        return error;
-}
-
-
diff -Nru a/fs/intermezzo/kml_setup.c b/fs/intermezzo/kml_setup.c
--- a/fs/intermezzo/kml_setup.c	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,58 +0,0 @@
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/module.h>
-#include <asm/uaccess.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_upcall.h"
-#include "intermezzo_psdev.h"
-#include "intermezzo_kml.h"
-
-int kml_init (struct presto_file_set *fset)
-{
-        struct kml_fsdata *data;
-
-        ENTRY;
-        PRESTO_ALLOC (data, struct kml_fsdata *, sizeof (struct kml_fsdata));
-        if (data == NULL) {
-                EXIT;
-                return -ENOMEM;
-        }
-        INIT_LIST_HEAD (&data->kml_reint_cache);
-        INIT_LIST_HEAD (&data->kml_kop_cache);
-
-        PRESTO_ALLOC (data->kml_buf, char *, KML_REINT_MAXBUF);
-        if (data->kml_buf == NULL) {
-                PRESTO_FREE (data, sizeof (struct kml_fsdata));
-                EXIT;
-                return -ENOMEM;
-        }
-
-        data->kml_maxsize = KML_REINT_MAXBUF;
-        data->kml_len = 0;
-        data->kml_reintpos = 0;
-        data->kml_count = 0;
-        fset->fset_kmldata = data;
-        EXIT;
-        return 0;
-}
-
-int kml_cleanup (struct presto_file_set *fset)
-{
-        struct kml_fsdata *data = fset->fset_kmldata;
-
-        if (data == NULL)
-                return 0;
-
-        fset->fset_kmldata = NULL;
-#if 0
-        kml_sop_cleanup (&data->kml_reint_cache);
-        kml_kop_cleanup (&data->kml_kop_cache);
-#endif
-        PRESTO_FREE (data->kml_buf, KML_REINT_MAXBUF);
-        PRESTO_FREE (data, sizeof (struct kml_fsdata));
-        return 0;
-}
-
-
diff -Nru a/fs/intermezzo/kml_unpack.c b/fs/intermezzo/kml_unpack.c
--- a/fs/intermezzo/kml_unpack.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,712 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Unpacking of KML records
- *
- */
-
-#ifdef __KERNEL__
-#  include <linux/module.h>
-#  include <linux/errno.h>
-#  include <linux/kernel.h>
-#  include <linux/major.h>
-#  include <linux/sched.h>
-#  include <linux/lp.h>
-#  include <linux/slab.h>
-#  include <linux/ioport.h>
-#  include <linux/fcntl.h>
-#  include <linux/delay.h>
-#  include <linux/skbuff.h>
-#  include <linux/proc_fs.h>
-#  include <linux/vmalloc.h>
-#  include <linux/fs.h>
-#  include <linux/poll.h>
-#  include <linux/init.h>
-#  include <linux/list.h>
-#  include <linux/stat.h>
-#  include <asm/io.h>
-#  include <asm/segment.h>
-#  include <asm/system.h>
-#  include <asm/poll.h>
-#  include <asm/uaccess.h>
-#else
-#  include <time.h>
-#  include <stdio.h>
-#  include <string.h>
-#  include <stdlib.h>
-#  include <errno.h>
-#  include <sys/stat.h>
-#  include <glib.h>
-#endif
-
-#include "intermezzo_lib.h"
-#include "intermezzo_idl.h"
-#include "intermezzo_fs.h"
-
-int kml_unpack_version(struct presto_version **ver, char **buf, char *end) 
-{
-	char *ptr = *buf;
-        struct presto_version *pv;
-
-	UNLOGP(*ver, struct presto_version, ptr, end);
-        pv = *ver;
-        pv->pv_mtime_sec   = NTOH__u32(pv->pv_mtime_sec);
-        pv->pv_mtime_nsec   = NTOH__u32(pv->pv_mtime_nsec);
-        pv->pv_ctime_sec   = NTOH__u32(pv->pv_ctime_sec);
-        pv->pv_ctime_nsec   = NTOH__u32(pv->pv_ctime_nsec);
-        pv->pv_size    = NTOH__u64(pv->pv_size);
-
-	*buf = ptr;
-
-        return 0;
-}
-
-
-static int kml_unpack_noop(struct kml_rec *rec, char **buf, char *end)
-{
-	return 0;
-}
-
- 
-static int kml_unpack_get_fileid(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-
-	*buf = ptr;
-	return 0;
-}
-
-static int kml_unpack_create(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	LUNLOGV(rec->mode, __u32, ptr, end);
-	LUNLOGV(rec->uid, __u32, ptr, end);
-	LUNLOGV(rec->gid, __u32, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
- 
-static int kml_unpack_mkdir(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	LUNLOGV(rec->mode, __u32, ptr, end);
-	LUNLOGV(rec->uid, __u32, ptr, end);
-	LUNLOGV(rec->gid, __u32, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_unlink(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_parentv, &ptr, end);
-	kml_unpack_version(&rec->old_objectv, &ptr, end);
-        LUNLOGV(rec->old_mode, __u32, ptr, end);
-        LUNLOGV(rec->old_rdev, __u32, ptr, end);
-        LUNLOGV(rec->old_uid, __u64, ptr, end);
-        LUNLOGV(rec->old_gid, __u64, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	LUNLOGV(rec->targetlen, __u32, ptr, end);
-        LUNLOGV(rec->old_targetlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-	UNLOGL(rec->target, char, rec->targetlen, ptr, end);
-        UNLOGL(rec->old_target, char, rec->old_targetlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_rmdir(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_parentv, &ptr, end);
-	kml_unpack_version(&rec->old_objectv, &ptr, end);
-        LUNLOGV(rec->old_mode, __u32, ptr, end);
-        LUNLOGV(rec->old_rdev, __u32, ptr, end);
-        LUNLOGV(rec->old_uid, __u64, ptr, end);
-        LUNLOGV(rec->old_gid, __u64, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	LUNLOGV(rec->targetlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-	UNLOGL(rec->target, char, rec->targetlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_close(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	LUNLOGV(rec->mode, __u32, ptr, end);  // used for open_mode
-	LUNLOGV(rec->uid, __u32, ptr, end);   // used for open_uid
-	LUNLOGV(rec->gid, __u32, ptr, end);   // used for open_gid
-	kml_unpack_version(&rec->old_objectv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	LUNLOGV(rec->ino, __u64, ptr, end);
-	LUNLOGV(rec->generation, __u32, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_symlink(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	LUNLOGV(rec->uid, __u32, ptr, end);
-	LUNLOGV(rec->gid, __u32, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	LUNLOGV(rec->targetlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-	UNLOGL(rec->target, char, rec->targetlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_rename(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_objectv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	kml_unpack_version(&rec->old_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_parentv, &ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	LUNLOGV(rec->targetlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-	UNLOGL(rec->target, char, rec->targetlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_setattr(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_objectv, &ptr, end);
-	LUNLOGV(rec->valid, __u32, ptr, end);
-	LUNLOGV(rec->mode, __u32, ptr, end);
-	LUNLOGV(rec->uid, __u32, ptr, end);
-	LUNLOGV(rec->gid, __u32, ptr, end);
-	LUNLOGV(rec->size, __u64, ptr, end);
-	LUNLOGV(rec->mtime_sec, __u32, ptr, end);
-	LUNLOGV(rec->mtime_nsec, __u32, ptr, end);
-	LUNLOGV(rec->ctime_sec, __u32, ptr, end);
-	LUNLOGV(rec->ctime_nsec, __u32, ptr, end);
-	LUNLOGV(rec->flags, __u32, ptr, end);
-        LUNLOGV(rec->old_mode, __u32, ptr, end);
-        LUNLOGV(rec->old_rdev, __u32, ptr, end);
-        LUNLOGV(rec->old_uid, __u64, ptr, end);
-        LUNLOGV(rec->old_gid, __u64, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-	
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_link(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	LUNLOGV(rec->targetlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-	UNLOGL(rec->target, char, rec->targetlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-static int kml_unpack_mknod(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_parentv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	LUNLOGV(rec->mode, __u32, ptr, end);
-	LUNLOGV(rec->uid, __u32, ptr, end);
-	LUNLOGV(rec->gid, __u32, ptr, end);
-	LUNLOGV(rec->major, __u32, ptr, end);
-	LUNLOGV(rec->minor, __u32, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_write(struct kml_rec *rec, char **buf, char *end)
-{
-	printf("NOT IMPLEMENTED");
-	return 0;
-}
-
-
-static int kml_unpack_release(struct kml_rec *rec, char **buf, char *end)
-{
-	printf("NOT IMPLEMENTED");
-	return 0;
-}
-
-
-static int kml_unpack_trunc(struct kml_rec *rec, char **buf, char *end)
-{
-	printf("NOT IMPLEMENTED");
-	return 0;
-}
-
-
-static int kml_unpack_setextattr(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_objectv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	LUNLOGV(rec->flags, __u32, ptr, end);
-	LUNLOGV(rec->mode, __u32, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	LUNLOGV(rec->namelen, __u32, ptr, end);
-	LUNLOGV(rec->targetlen, __u32, ptr, end);
-        UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-	UNLOGL(rec->name, char, rec->namelen, ptr, end);
-	UNLOGL(rec->target, char, rec->targetlen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-
-static int kml_unpack_delextattr(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-
-	kml_unpack_version(&rec->old_objectv, &ptr, end);
-	kml_unpack_version(&rec->new_objectv, &ptr, end);
-	LUNLOGV(rec->flags, __u32, ptr, end);
-	LUNLOGV(rec->mode, __u32, ptr, end);
-	LUNLOGV(rec->pathlen, __u32, ptr, end);
-	LUNLOGV(rec->namelen, __u32, ptr, end);
-	LUNLOGV(rec->targetlen, __u32, ptr, end);
-	UNLOGL(rec->path, char, rec->pathlen, ptr, end);
-	UNLOGL(rec->name, char, rec->namelen, ptr, end);
-
-	*buf = ptr;
-
-	return 0;
-}
-
-static int kml_unpack_open(struct kml_rec *rec, char **buf, char *end)
-{
-	printf("NOT IMPLEMENTED");
-	return 0;
-}
-
-static int kml_unpack_kml_trunc(struct kml_rec *rec, char **buf, char *end)
-{
-
-	printf("NOT IMPLEMENTED");
-	return 0;
-}
-
-
-typedef int (*unpacker)(struct kml_rec *rec, char **buf, char *end);
-
-static unpacker unpackers[KML_OPCODE_NUM] = 
-{
-	[KML_OPCODE_NOOP] = kml_unpack_noop,
-	[KML_OPCODE_CREATE] = kml_unpack_create, 
-	[KML_OPCODE_MKDIR] = kml_unpack_mkdir,
-	[KML_OPCODE_UNLINK] = kml_unpack_unlink,
-	[KML_OPCODE_RMDIR] = kml_unpack_rmdir,
-	[KML_OPCODE_CLOSE] = kml_unpack_close,
-	[KML_OPCODE_SYMLINK] = kml_unpack_symlink,
-	[KML_OPCODE_RENAME] = kml_unpack_rename,
-	[KML_OPCODE_SETATTR] = kml_unpack_setattr,
-	[KML_OPCODE_LINK] = kml_unpack_link,
-	[KML_OPCODE_OPEN] = kml_unpack_open,
-	[KML_OPCODE_MKNOD] = kml_unpack_mknod,
-	[KML_OPCODE_WRITE] = kml_unpack_write,
-	[KML_OPCODE_RELEASE] = kml_unpack_release,
-	[KML_OPCODE_TRUNC] = kml_unpack_trunc,
-	[KML_OPCODE_SETEXTATTR] = kml_unpack_setextattr,
-	[KML_OPCODE_DELEXTATTR] = kml_unpack_delextattr,
-	[KML_OPCODE_KML_TRUNC] = kml_unpack_kml_trunc,
-	[KML_OPCODE_GET_FILEID] = kml_unpack_get_fileid
-};
-
-int kml_unpack_prefix(struct kml_rec *rec, char **buf, char *end) 
-{
-	char *ptr = *buf;
-        int n;
-
-        UNLOGP(rec->prefix.hdr, struct kml_prefix_hdr, ptr, end);
-        rec->prefix.hdr->len     = NTOH__u32(rec->prefix.hdr->len);
-        rec->prefix.hdr->version = NTOH__u32(rec->prefix.hdr->version);
-        rec->prefix.hdr->pid     = NTOH__u32(rec->prefix.hdr->pid);
-        rec->prefix.hdr->auid    = NTOH__u32(rec->prefix.hdr->auid);
-        rec->prefix.hdr->fsuid   = NTOH__u32(rec->prefix.hdr->fsuid);
-        rec->prefix.hdr->fsgid   = NTOH__u32(rec->prefix.hdr->fsgid);
-        rec->prefix.hdr->opcode  = NTOH__u32(rec->prefix.hdr->opcode);
-        rec->prefix.hdr->ngroups = NTOH__u32(rec->prefix.hdr->ngroups);
-
-	UNLOGL(rec->prefix.groups, __u32, rec->prefix.hdr->ngroups, ptr, end);
-        for (n = 0; n < rec->prefix.hdr->ngroups; n++) {
-                rec->prefix.groups[n] = NTOH__u32(rec->prefix.groups[n]);
-        }
-
-	*buf = ptr;
-
-        return 0;
-}
-
-int kml_unpack_suffix(struct kml_rec *rec, char **buf, char *end) 
-{
-	char *ptr = *buf;
-
-	UNLOGP(rec->suffix, struct kml_suffix, ptr, end);
-        rec->suffix->prevrec   = NTOH__u32(rec->suffix->prevrec);
-        rec->suffix->recno    = NTOH__u32(rec->suffix->recno);
-        rec->suffix->time     = NTOH__u32(rec->suffix->time);
-        rec->suffix->len      = NTOH__u32(rec->suffix->len);
-
-	*buf = ptr;
-
-        return 0;
-}
-
-int kml_unpack(struct kml_rec *rec, char **buf, char *end)
-{
-	char *ptr = *buf;
-	int err; 
-
-        if (((unsigned long)ptr % 4) != 0) {
-                printf("InterMezzo: %s: record misaligned.\n", __FUNCTION__);
-                return -EINVAL;
-        }
-
-        while (ptr < end) { 
-                __u32 *i = (__u32 *)ptr;
-                if (*i)
-                        break;
-                ptr += sizeof(*i);
-        }
-	*buf = ptr;
-
-	memset(rec, 0, sizeof(*rec));
-
-        err = kml_unpack_prefix(rec, &ptr, end);
-	if (err) {
-                printf("InterMezzo: %s: unpack_prefix failed: %d\n",
-                       __FUNCTION__, err);
-		return err;
-        }
-
-        if (rec->prefix.hdr->opcode < 0  ||
-            rec->prefix.hdr->opcode >= KML_OPCODE_NUM) {
-                printf("InterMezzo: %s: invalid opcode (%d)\n",
-                       __FUNCTION__, rec->prefix.hdr->opcode);
-		return -EINVAL;
-        }
-	err = unpackers[rec->prefix.hdr->opcode](rec, &ptr, end);
-	if (err) {
-                printf("InterMezzo: %s: unpacker failed: %d\n",
-                       __FUNCTION__, err);
-		return err;
-        }
-
-        err = kml_unpack_suffix(rec, &ptr, end);
-	if (err) {
-                printf("InterMezzo: %s: unpack_suffix failed: %d\n",
-                       __FUNCTION__, err);
-		return err;
-        }
-
-
-	if (rec->prefix.hdr->len != rec->suffix->len) {
-                printf("InterMezzo: %s: lengths don't match\n",
-                       __FUNCTION__);
-		return -EINVAL;
-        }
-        if ((rec->prefix.hdr->len % 4) != 0) {
-                printf("InterMezzo: %s: record length not a "
-                       "multiple of 4.\n", __FUNCTION__);
-                return -EINVAL;
-        }
-        if (ptr - *buf != rec->prefix.hdr->len) {
-                printf("InterMezzo: %s: unpacking error\n",
-                       __FUNCTION__);
-                return -EINVAL;
-        }
-        while (ptr < end) { 
-                __u32 *i = (__u32 *)ptr;
-                if (*i)
-                        break;
-                ptr += sizeof(*i);
-        }
-	*buf = ptr;
-	return 0;
-}
-
-
-#ifndef __KERNEL__
-#define STR(ptr) ((ptr))? (ptr) : ""
-
-#define OPNAME(n) [KML_OPCODE_##n] = #n
-static char *opnames[KML_OPCODE_NUM] = {
-	OPNAME(NOOP),
-	OPNAME(CREATE),
-	OPNAME(MKDIR), 
-	OPNAME(UNLINK),
-	OPNAME(RMDIR),
-	OPNAME(CLOSE),
-	OPNAME(SYMLINK),
-	OPNAME(RENAME),
-	OPNAME(SETATTR),
-	OPNAME(LINK),
-	OPNAME(OPEN),
-	OPNAME(MKNOD),
-	OPNAME(WRITE),
-	OPNAME(RELEASE),
-	OPNAME(TRUNC),
-	OPNAME(SETEXTATTR),
-	OPNAME(DELEXTATTR),
-	OPNAME(KML_TRUNC),
-	OPNAME(GET_FILEID)
-};
-#undef OPNAME
-
-static char *print_opname(int op)
-{
-	if (op < 0 || op >= sizeof (opnames) / sizeof (*opnames))
-		return NULL;
-	return opnames[op];
-}
-
-
-static char *print_time(__u64 i)
-{
-	char buf[128];
-	
-	memset(buf, 0, 128);
-
-#ifndef __KERNEL__
-	strftime(buf, 128, "%Y/%m/%d %H:%M:%S", gmtime((time_t *)&i));
-#else
-	sprintf(buf, "%Ld\n", i);
-#endif
-
-	return strdup(buf);
-}
-
-static char *print_version(struct presto_version *ver)
-{
-	char ver_buf[128];
-	char *mtime;
-	char *ctime;
-
-	if (!ver || ver->pv_ctime == 0) {
-		return strdup("");
-	} 
-	mtime = print_time(ver->pv_mtime);
-	ctime = print_time(ver->pv_ctime);
-	sprintf(ver_buf, "mtime %s, ctime %s, len %lld", 
-		mtime, ctime, ver->pv_size);
-	free(mtime);
-	free(ctime);
-	return strdup(ver_buf);
-}
-
-
-char *kml_print_rec(struct kml_rec *rec, int brief)
-{
-	char *str;
-	char *nov, *oov, *ntv, *otv, *npv, *opv;
-	char *rectime, *mtime, *ctime;
-
-        if (brief) {
-		str = g_strdup_printf(" %08d %7s %*s %*s", 
-                                      rec->suffix->recno,
-                                      print_opname (rec->prefix.hdr->opcode),
-                                      rec->pathlen, STR(rec->path),
-                                      rec->targetlen, STR(rec->target));
-                
-		return str;
-	}
-
-	rectime = print_time(rec->suffix->time);
-	mtime = print_time(rec->mtime);
-	ctime = print_time(rec->ctime);
-
-	nov = print_version(rec->new_objectv);
-	oov = print_version(rec->old_objectv);
-	ntv = print_version(rec->new_targetv);
-	otv = print_version(rec->old_targetv);
-	npv = print_version(rec->new_parentv);
-	opv = print_version(rec->old_parentv);
-
-	str = g_strdup_printf("\n -- Record:\n"
-		"    Recno     %d\n"
-		"    KML off   %lld\n" 
-		"    Version   %d\n" 
-		"    Len       %d\n"
-		"    Suf len   %d\n"
-		"    Time      %s\n"
-		"    Opcode    %d\n"
-		"    Op        %s\n"
-		"    Pid       %d\n"
-		"    AUid      %d\n"
-		"    Fsuid     %d\n" 
-		"    Fsgid     %d\n"
-		"    Prevrec   %d\n" 
-		"    Ngroups   %d\n"
-		//"    Groups    @{$self->{groups}}\n" 
-		" -- Path:\n"
-		"    Inode     %d\n"
-		"    Gen num   %u\n"
-                "    Old mode  %o\n"
-                "    Old rdev  %x\n"
-                "    Old uid   %llu\n"
-                "    Old gid   %llu\n"
-		"    Path      %*s\n"
-		//"    Open_mode %o\n",
-		"    Pathlen   %d\n"
-		"    Tgt       %*s\n"
-		"    Tgtlen    %d\n" 
-		"    Old Tgt   %*s\n"
-		"    Old Tgtln %d\n" 
-		" -- Attr:\n"
-		"    Valid     %x\n"
-		"    mode %o, uid %d, gid %d, size %lld, mtime %s, ctime %s rdev %x (%d:%d)\n"
-		" -- Versions:\n"
-		"    New object %s\n"
-		"    Old object %s\n"
-		"    New target %s\n"
-		"    Old target %s\n"
-		"    New parent %s\n"
-		"    Old parent %s\n", 
-		
-		rec->suffix->recno, 
-		rec->offset, 
-		rec->prefix.hdr->version, 
-		rec->prefix.hdr->len, 
-		rec->suffix->len, 
-		rectime,
-		rec->prefix.hdr->opcode, 
-		print_opname (rec->prefix.hdr->opcode),
-		rec->prefix.hdr->pid,
-		rec->prefix.hdr->auid,
-		rec->prefix.hdr->fsuid,
-		rec->prefix.hdr->fsgid,
-		rec->suffix->prevrec,
-		rec->prefix.hdr->ngroups,
-		rec->ino,
-		rec->generation,
-                rec->old_mode,
-                rec->old_rdev,
-                rec->old_uid,
-                rec->old_gid,
-		rec->pathlen,
-		STR(rec->path),
-		rec->pathlen,
-		rec->targetlen,
-		STR(rec->target),
-		rec->targetlen,
-		rec->old_targetlen,
-		STR(rec->old_target),
-		rec->old_targetlen,
-		
-		rec->valid, 
-		rec->mode,
-		rec->uid,
-		rec->gid,
-		rec->size,
-		mtime,
-		ctime,
-		rec->rdev, rec->major, rec->minor,
-		nov, oov, ntv, otv, npv, opv);
-		
-	free(nov);
-	free(oov);
-	free(ntv);
-	free(otv);
-	free(npv);
-	free(opv);
-
-	free(rectime); 
-	free(ctime);
-	free(mtime);
-
-	return str;
-}
-#endif
diff -Nru a/fs/intermezzo/kml_utils.c b/fs/intermezzo/kml_utils.c
--- a/fs/intermezzo/kml_utils.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,43 +0,0 @@
-#include <linux/list.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_kml.h"
-
-
-// dlogit -- oppsite to logit ()
-//         return the sbuf + size;
-char *dlogit (void *tbuf, const void *sbuf, int size)
-{
-        char *ptr = (char *)sbuf;
-        memcpy(tbuf, ptr, size);
-        ptr += size;
-        return ptr;
-}
-
-static spinlock_t kml_lock = SPIN_LOCK_UNLOCKED;
-static char  buf[1024];
-char * bdup_printf (char *format, ...)
-{
-        va_list args;
-        int  i;
-        char *path;
-        unsigned long flags;
-
-        spin_lock_irqsave(&kml_lock, flags);
-        va_start(args, format);
-        i = vsprintf(buf, format, args); /* hopefully i < sizeof(buf) */
-        va_end(args);
-
-        PRESTO_ALLOC (path, char *, i + 1);
-        if (path == NULL)
-                return NULL;
-        strcpy (path, buf);
-
-        spin_unlock_irqrestore(&kml_lock, flags);
-        return path;
-}
-
-
diff -Nru a/fs/intermezzo/methods.c b/fs/intermezzo/methods.c
--- a/fs/intermezzo/methods.c	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,493 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2000 Stelias Computing, Inc.
- *  Copyright (C) 2000 Red Hat, Inc.
- *  Copyright (C) 2000 Mountain View Data, Inc.
- *
- *  Extended Attribute Support
- *  Copyright (C) 2001 Shirish H. Phatak, Tacit Networks, Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/string.h>
-#include <linux/blkdev.h>
-#include <linux/init.h>
-#include <linux/module.h>
-
-#include <linux/fsfilter.h>
-#include "intermezzo_fs.h"
-
-
-int filter_print_entry = 0;
-int filter_debug = 0xfffffff;
-/*
- * The function in this file are responsible for setting up the 
- * correct methods layered file systems like InterMezzo and snapfs
- */
-
-
-static struct filter_fs filter_oppar[FILTER_FS_TYPES];
-
-/* get to the upper methods (intermezzo, snapfs) */
-inline struct super_operations *filter_c2usops(struct filter_fs *cache)
-{
-        return &cache->o_fops.filter_sops;
-}
-
-inline struct inode_operations *filter_c2udiops(struct filter_fs *cache)
-{
-        return &cache->o_fops.filter_dir_iops;
-}
-
-
-inline struct inode_operations *filter_c2ufiops(struct filter_fs *cache)
-{
-        return &cache->o_fops.filter_file_iops;
-}
-
-inline struct inode_operations *filter_c2usiops(struct filter_fs *cache)
-{
-        return &cache->o_fops.filter_sym_iops;
-}
-
-
-inline struct file_operations *filter_c2udfops(struct filter_fs *cache)
-{
-        return &cache->o_fops.filter_dir_fops;
-}
-
-inline struct file_operations *filter_c2uffops(struct filter_fs *cache)
-{
-        return &cache->o_fops.filter_file_fops;
-}
-
-inline struct file_operations *filter_c2usfops(struct filter_fs *cache)
-{
-        return &cache->o_fops.filter_sym_fops;
-}
-
-inline struct dentry_operations *filter_c2udops(struct filter_fs *cache)
-{
-        return &cache->o_fops.filter_dentry_ops;
-}
-
-/* get to the cache (lower) methods */
-inline struct super_operations *filter_c2csops(struct filter_fs *cache)
-{
-        return cache->o_caops.cache_sops;
-}
-
-inline struct inode_operations *filter_c2cdiops(struct filter_fs *cache)
-{
-        return cache->o_caops.cache_dir_iops;
-}
-
-inline struct inode_operations *filter_c2cfiops(struct filter_fs *cache)
-{
-        return cache->o_caops.cache_file_iops;
-}
-
-inline struct inode_operations *filter_c2csiops(struct filter_fs *cache)
-{
-        return cache->o_caops.cache_sym_iops;
-}
-
-inline struct file_operations *filter_c2cdfops(struct filter_fs *cache)
-{
-        return cache->o_caops.cache_dir_fops;
-}
-
-inline struct file_operations *filter_c2cffops(struct filter_fs *cache)
-{
-        return cache->o_caops.cache_file_fops;
-}
-
-inline struct file_operations *filter_c2csfops(struct filter_fs *cache)
-{
-        return cache->o_caops.cache_sym_fops;
-}
-
-inline struct dentry_operations *filter_c2cdops(struct filter_fs *cache)
-{
-        return cache->o_caops.cache_dentry_ops;
-}
-
-
-void filter_setup_journal_ops(struct filter_fs *ops, char *cache_type)
-{
-        if ( strlen(cache_type) == strlen("ext2") &&
-             memcmp(cache_type, "ext2", strlen("ext2")) == 0 ) {
-#ifdef CONFIG_EXT2_FS
-                ops->o_trops = &presto_ext2_journal_ops;
-#else
-                ops->o_trops = NULL;
-#endif
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("ext3") &&
-             memcmp(cache_type, "ext3", strlen("ext3")) == 0 ) {
-#if defined(CONFIG_EXT3_FS) || defined (CONFIG_EXT3_FS_MODULE)
-                ops->o_trops = &presto_ext3_journal_ops;
-#else
-                ops->o_trops = NULL;
-#endif
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("tmpfs") &&
-             memcmp(cache_type, "tmpfs", strlen("tmpfs")) == 0 ) {
-#if defined(CONFIG_TMPFS)
-                ops->o_trops = &presto_tmpfs_journal_ops;
-#else
-                ops->o_trops = NULL;
-#endif
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("reiserfs") &&
-             memcmp(cache_type, "reiserfs", strlen("reiserfs")) == 0 ) {
-#if 0
-		/* #if defined(CONFIG_REISERFS_FS) || defined(CONFIG_REISERFS_FS_MODULE) */
-                ops->o_trops = &presto_reiserfs_journal_ops;
-#else
-                ops->o_trops = NULL;
-#endif
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("xfs") &&
-             memcmp(cache_type, "xfs", strlen("xfs")) == 0 ) {
-#if 0
-/*#if defined(CONFIG_XFS_FS) || defined (CONFIG_XFS_FS_MODULE) */
-                ops->o_trops = &presto_xfs_journal_ops;
-#else
-                ops->o_trops = NULL;
-#endif
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("obdfs") &&
-             memcmp(cache_type, "obdfs", strlen("obdfs")) == 0 ) {
-#if defined(CONFIG_OBDFS_FS) || defined (CONFIG_OBDFS_FS_MODULE)
-                ops->o_trops = presto_obdfs_journal_ops;
-#else
-                ops->o_trops = NULL;
-#endif
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-}
-
-
-/* find the cache for this FS */
-struct filter_fs *filter_get_filter_fs(const char *cache_type)
-{
-        struct filter_fs *ops = NULL;
-        FENTRY;
-
-        if ( strlen(cache_type) == strlen("ext2") &&
-             memcmp(cache_type, "ext2", strlen("ext2")) == 0 ) {
-                ops = &filter_oppar[FILTER_FS_EXT2];
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("xfs") &&
-             memcmp(cache_type, "xfs", strlen("xfs")) == 0 ) {
-                ops = &filter_oppar[FILTER_FS_XFS];
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("ext3") &&
-             memcmp(cache_type, "ext3", strlen("ext3")) == 0 ) {
-                ops = &filter_oppar[FILTER_FS_EXT3];
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("tmpfs") &&
-             memcmp(cache_type, "tmpfs", strlen("tmpfs")) == 0 ) {
-                ops = &filter_oppar[FILTER_FS_TMPFS];
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if ( strlen(cache_type) == strlen("reiserfs") &&
-             memcmp(cache_type, "reiserfs", strlen("reiserfs")) == 0 ) {
-                ops = &filter_oppar[FILTER_FS_REISERFS];
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-        if ( strlen(cache_type) == strlen("obdfs") &&
-             memcmp(cache_type, "obdfs", strlen("obdfs")) == 0 ) {
-                ops = &filter_oppar[FILTER_FS_OBDFS];
-                FDEBUG(D_SUPER, "ops at %p\n", ops);
-        }
-
-        if (ops == NULL) {
-                CERROR("prepare to die: unrecognized cache type for Filter\n");
-        }
-        FEXIT;
-        return ops;
-}
-
-
-/*
- *  Frobnicate the InterMezzo operations
- *    this establishes the link between the InterMezzo file system
- *    and the underlying file system used for the cache.
- */
-
-void filter_setup_super_ops(struct filter_fs *cache, struct super_operations *cache_sops, struct super_operations *filter_sops)
-{
-        /* Get ptr to the shared struct snapfs_ops structure. */
-        struct filter_ops *props = &cache->o_fops;
-        /* Get ptr to the shared struct cache_ops structure. */
-        struct cache_ops *caops = &cache->o_caops;
-
-        FENTRY;
-
-        if ( cache->o_flags & FILTER_DID_SUPER_OPS ) {
-                FEXIT;
-                return;
-        }
-        cache->o_flags |= FILTER_DID_SUPER_OPS;
-
-        /* Set the cache superblock operations to point to the
-           superblock operations of the underlying file system.  */
-        caops->cache_sops = cache_sops;
-
-        /*
-         * Copy the cache (real fs) superblock ops to the "filter"
-         * superblock ops as defaults. Some will be changed below
-         */
-        memcpy(&props->filter_sops, cache_sops, sizeof(*cache_sops));
-
-        /* 'put_super' unconditionally is that of filter */
-        if (filter_sops->put_super) { 
-                props->filter_sops.put_super = filter_sops->put_super;
-        }
-
-        if (cache_sops->read_inode) {
-                props->filter_sops.read_inode = filter_sops->read_inode;
-                FDEBUG(D_INODE, "setting filter_read_inode, cache_ops %p, cache %p, ri at %p\n",
-                      cache, cache, props->filter_sops.read_inode);
-        }
-
-        if (cache_sops->remount_fs)
-                props->filter_sops.remount_fs = filter_sops->remount_fs;
-        FEXIT;
-}
-
-
-void filter_setup_dir_ops(struct filter_fs *cache, struct inode *inode, struct inode_operations *filter_iops, struct file_operations *filter_fops)
-{
-        struct inode_operations *cache_filter_iops;
-        struct inode_operations *cache_iops = inode->i_op;
-        struct file_operations *cache_fops = inode->i_fop;
-        FENTRY;
-
-        if ( cache->o_flags & FILTER_DID_DIR_OPS ) {
-                FEXIT;
-                return;
-        }
-        cache->o_flags |= FILTER_DID_DIR_OPS;
-
-        /* former ops become cache_ops */
-        cache->o_caops.cache_dir_iops = cache_iops;
-        cache->o_caops.cache_dir_fops = cache_fops;
-        FDEBUG(D_SUPER, "filter at %p, cache iops %p, iops %p\n",
-               cache, cache_iops, filter_c2udiops(cache));
-
-        /* setup our dir iops: copy and modify */
-        memcpy(filter_c2udiops(cache), cache_iops, sizeof(*cache_iops));
-
-        /* abbreviate */
-        cache_filter_iops = filter_c2udiops(cache);
-
-        /* methods that filter if cache filesystem has these ops */
-        if (cache_iops->lookup && filter_iops->lookup)
-                cache_filter_iops->lookup = filter_iops->lookup;
-        if (cache_iops->create && filter_iops->create)
-                cache_filter_iops->create = filter_iops->create;
-        if (cache_iops->link && filter_iops->link)
-                cache_filter_iops->link = filter_iops->link;
-        if (cache_iops->unlink && filter_iops->unlink)
-                cache_filter_iops->unlink = filter_iops->unlink;
-        if (cache_iops->mkdir && filter_iops->mkdir)
-                cache_filter_iops->mkdir = filter_iops->mkdir;
-        if (cache_iops->rmdir && filter_iops->rmdir)
-                cache_filter_iops->rmdir = filter_iops->rmdir;
-        if (cache_iops->symlink && filter_iops->symlink)
-                cache_filter_iops->symlink = filter_iops->symlink;
-        if (cache_iops->rename && filter_iops->rename)
-                cache_filter_iops->rename = filter_iops->rename;
-        if (cache_iops->mknod && filter_iops->mknod)
-                cache_filter_iops->mknod = filter_iops->mknod;
-        if (cache_iops->permission && filter_iops->permission)
-                cache_filter_iops->permission = filter_iops->permission;
-        if (cache_iops->getattr)
-                cache_filter_iops->getattr = filter_iops->getattr;
-        /* Some filesystems do not use a setattr method of their own
-           instead relying on inode_setattr/write_inode. We still need to
-           journal these so we make setattr an unconditional operation. 
-           XXX: we should probably check for write_inode. SHP
-        */
-        /*if (cache_iops->setattr)*/
-                cache_filter_iops->setattr = filter_iops->setattr;
-#ifdef CONFIG_FS_EXT_ATTR
-	/* For now we assume that posix acls are handled through extended
-	* attributes. If this is not the case, we must explicitly trap 
-	* posix_set_acl. SHP
-	*/
-	if (cache_iops->set_ext_attr && filter_iops->set_ext_attr)
-		cache_filter_iops->set_ext_attr = filter_iops->set_ext_attr;
-#endif
-
-
-        /* copy dir fops */
-        memcpy(filter_c2udfops(cache), cache_fops, sizeof(*cache_fops));
-
-        /* unconditional filtering operations */
-        filter_c2udfops(cache)->ioctl = filter_fops->ioctl;
-
-        FEXIT;
-}
-
-
-void filter_setup_file_ops(struct filter_fs *cache, struct inode *inode, struct inode_operations *filter_iops, struct file_operations *filter_fops)
-{
-        struct inode_operations *pr_iops;
-        struct inode_operations *cache_iops = inode->i_op;
-        struct file_operations *cache_fops = inode->i_fop;
-        FENTRY;
-
-        if ( cache->o_flags & FILTER_DID_FILE_OPS ) {
-                FEXIT;
-                return;
-        }
-        cache->o_flags |= FILTER_DID_FILE_OPS;
-
-        /* steal the old ops */
-        /* former ops become cache_ops */
-        cache->o_caops.cache_file_iops = cache_iops;
-        cache->o_caops.cache_file_fops = cache_fops;
-        
-        /* abbreviate */
-        pr_iops = filter_c2ufiops(cache); 
-
-        /* setup our dir iops: copy and modify */
-        memcpy(pr_iops, cache_iops, sizeof(*cache_iops));
-
-        /* copy dir fops */
-        CERROR("*** cache file ops at %p\n", cache_fops);
-        memcpy(filter_c2uffops(cache), cache_fops, sizeof(*cache_fops));
-
-        /* assign */
-        /* See comments above in filter_setup_dir_ops. SHP */
-        /*if (cache_iops->setattr)*/
-                pr_iops->setattr = filter_iops->setattr;
-        if (cache_iops->getattr)
-                pr_iops->getattr = filter_iops->getattr;
-        /* XXX Should this be conditional rmr ? */
-        pr_iops->permission = filter_iops->permission;
-#ifdef CONFIG_FS_EXT_ATTR
-    	/* For now we assume that posix acls are handled through extended
-	* attributes. If this is not the case, we must explicitly trap and 
-	* posix_set_acl
-	*/
-	if (cache_iops->set_ext_attr && filter_iops->set_ext_attr)
-		pr_iops->set_ext_attr = filter_iops->set_ext_attr;
-#endif
-
-
-        /* unconditional filtering operations */
-        filter_c2uffops(cache)->open = filter_fops->open;
-        filter_c2uffops(cache)->release = filter_fops->release;
-        filter_c2uffops(cache)->write = filter_fops->write;
-        filter_c2uffops(cache)->ioctl = filter_fops->ioctl;
-
-        FEXIT;
-}
-
-/* XXX in 2.3 there are "fast" and "slow" symlink ops for ext2 XXX */
-void filter_setup_symlink_ops(struct filter_fs *cache, struct inode *inode, struct inode_operations *filter_iops, struct file_operations *filter_fops)
-{
-        struct inode_operations *pr_iops;
-        struct inode_operations *cache_iops = inode->i_op;
-        struct file_operations *cache_fops = inode->i_fop;
-        FENTRY;
-
-        if ( cache->o_flags & FILTER_DID_SYMLINK_OPS ) {
-                FEXIT;
-                return;
-        }
-        cache->o_flags |= FILTER_DID_SYMLINK_OPS;
-
-        /* steal the old ops */
-        cache->o_caops.cache_sym_iops = cache_iops;
-        cache->o_caops.cache_sym_fops = cache_fops;
-
-        /* abbreviate */
-        pr_iops = filter_c2usiops(cache); 
-
-        /* setup our dir iops: copy and modify */
-        memcpy(pr_iops, cache_iops, sizeof(*cache_iops));
-
-        /* See comments above in filter_setup_dir_ops. SHP */
-        /* if (cache_iops->setattr) */
-                pr_iops->setattr = filter_iops->setattr;
-        if (cache_iops->getattr)
-                pr_iops->getattr = filter_iops->getattr;
-
-        /* assign */
-        /* copy fops - careful for symlinks they might be NULL */
-        if ( cache_fops ) { 
-                memcpy(filter_c2usfops(cache), cache_fops, sizeof(*cache_fops));
-        }
-
-        FEXIT;
-}
-
-void filter_setup_dentry_ops(struct filter_fs *cache,
-                             struct dentry_operations *cache_dop,
-                             struct dentry_operations *filter_dop)
-{
-        if ( cache->o_flags & FILTER_DID_DENTRY_OPS ) {
-                FEXIT;
-                return;
-        }
-        cache->o_flags |= FILTER_DID_DENTRY_OPS;
-
-        cache->o_caops.cache_dentry_ops = cache_dop;
-        memcpy(&cache->o_fops.filter_dentry_ops,
-               filter_dop, sizeof(*filter_dop));
-        
-        if (cache_dop &&  cache_dop != filter_dop && cache_dop->d_revalidate){
-                CERROR("WARNING: filter overriding revalidation!\n");
-        }
-        return;
-}
diff -Nru a/fs/intermezzo/presto.c b/fs/intermezzo/presto.c
--- a/fs/intermezzo/presto.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,736 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Author: Peter J. Braam <braam@clusterfs.com>
- *  Copyright (C) 1998 Stelias Computing Inc
- *  Copyright (C) 1999 Red Hat Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * This file implements basic routines supporting the semantics
- */
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/namei.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/vmalloc.h>
-#include <linux/slab.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-int presto_walk(const char *name, struct nameidata *nd)
-{
-        int err;
-        /* we do not follow symlinks to support symlink operations 
-           correctly. The vfs should always hand us resolved dentries
-           so we should not be required to use LOOKUP_FOLLOW. At the
-           reintegrating end, lento again should be working with the 
-           resolved pathname and not the symlink. SHP
-           XXX: This code implies that direct symlinks do not work. SHP
-        */
-        unsigned int flags = 0; //LOOKUP_POSITIVE;
-
-        ENTRY;
-        err = path_lookup(name, flags, nd);
-        return err;
-}
-
-
-/* find the presto minor device for this inode */
-int presto_i2m(struct inode *inode)
-{
-        struct presto_cache *cache;
-        ENTRY;
-        cache = presto_get_cache(inode);
-        CDEBUG(D_PSDEV, "\n");
-        if ( !cache ) {
-                CERROR("PRESTO: BAD: cannot find cache for dev %s, ino %ld\n",
-                       inode->i_sb->s_id, inode->i_ino);
-                EXIT;
-                return -1;
-        }
-        EXIT;
-        return cache->cache_psdev->uc_minor;
-}
-
-inline int presto_f2m(struct presto_file_set *fset)
-{
-        return fset->fset_cache->cache_psdev->uc_minor;
-
-}
-
-inline int presto_c2m(struct presto_cache *cache)
-{
-        return cache->cache_psdev->uc_minor;
-
-}
-
-/* XXX check this out */
-struct presto_file_set *presto_path2fileset(const char *name)
-{
-        struct nameidata nd;
-        struct presto_file_set *fileset;
-        int error;
-        ENTRY;
-
-        error = presto_walk(name, &nd);
-        if (!error) { 
-#if 0
-                error = do_revalidate(nd.dentry);
-#endif
-                if (!error) 
-                        fileset = presto_fset(nd.dentry); 
-                path_release(&nd); 
-                EXIT;
-        } else 
-                fileset = ERR_PTR(error);
-
-        EXIT;
-        return fileset;
-}
-
-/* check a flag on this dentry or fset root.  Semantics:
-   - most flags: test if it is set
-   - PRESTO_ATTR, PRESTO_DATA return 1 if PRESTO_FSETINSYNC is set
-*/
-int presto_chk(struct dentry *dentry, int flag)
-{
-        int minor;
-        struct presto_file_set *fset = presto_fset(dentry);
-
-        ENTRY;
-        minor = presto_i2m(dentry->d_inode);
-        if ( izo_channels[minor].uc_no_filter ) {
-                EXIT;
-                return ~0;
-        }
-
-        /* if the fileset is in sync DATA and ATTR are OK */
-        if ( fset &&
-             (flag == PRESTO_ATTR || flag == PRESTO_DATA) &&
-             (fset->fset_flags & FSET_INSYNC) ) {
-                CDEBUG(D_INODE, "fset in sync (ino %ld)!\n",
-                       fset->fset_dentry->d_inode->i_ino);
-                EXIT;
-                return 1;
-        }
-
-        EXIT;
-        return (presto_d2d(dentry)->dd_flags & flag);
-}
-
-/* set a bit in the dentry flags */
-void presto_set(struct dentry *dentry, int flag)
-{
-        ENTRY;
-        if ( dentry->d_inode ) {
-                CDEBUG(D_INODE, "SET ino %ld, flag %x\n",
-                       dentry->d_inode->i_ino, flag);
-        }
-        if ( presto_d2d(dentry) == NULL) {
-                CERROR("dentry without d_fsdata in presto_set: %p: %*s", dentry,
-                                dentry->d_name.len, dentry->d_name.name);
-                BUG();
-        }
-        presto_d2d(dentry)->dd_flags |= flag;
-        EXIT;
-}
-
-/* given a path: complete the closes on the fset */
-int lento_complete_closes(char *path)
-{
-        struct nameidata nd;
-        struct dentry *dentry;
-        int error;
-        struct presto_file_set *fset;
-        ENTRY;
-
-        error = presto_walk(path, &nd);
-        if (error) {
-                EXIT;
-                return error;
-        }
-
-        dentry = nd.dentry;
-
-        error = -ENXIO;
-        if ( !presto_ispresto(dentry->d_inode) ) {
-                EXIT;
-                goto out_complete;
-        }
-        
-        fset = presto_fset(dentry);
-        error = -EINVAL;
-        if ( !fset ) {
-                CERROR("No fileset!\n");
-                EXIT;
-                goto out_complete;
-        }
-        
-        /* transactions and locking are internal to this function */ 
-        error = presto_complete_lml(fset);
-        
-        EXIT;
- out_complete:
-        path_release(&nd); 
-        return error;
-}       
-
-#if 0
-/* given a path: write a close record and cancel an LML record, finally
-   call truncate LML.  Lento is doing this so it goes in with uid/gid's 
-   root. 
-*/ 
-int lento_cancel_lml(char *path, 
-                     __u64 lml_offset, 
-                     __u64 remote_ino, 
-                     __u32 remote_generation,
-                     __u32 remote_version, 
-                     struct lento_vfs_context *info)
-{
-        struct nameidata nd;
-        struct rec_info rec;
-        struct dentry *dentry;
-        int error;
-        struct presto_file_set *fset;
-        void *handle; 
-        struct presto_version new_ver;
-        ENTRY;
-
-
-        error = presto_walk(path, &nd);
-        if (error) {
-                EXIT;
-                return error;
-        }
-        dentry = nd.dentry;
-
-        error = -ENXIO;
-        if ( !presto_ispresto(dentry->d_inode) ) {
-                EXIT;
-                goto out_cancel_lml;
-        }
-        
-        fset = presto_fset(dentry);
-
-        error=-EINVAL;
-        if (fset==NULL) {
-                CERROR("No fileset!\n");
-                EXIT;
-                goto out_cancel_lml;
-        }
-        
-        /* this only requires a transaction below which is automatic */
-        handle = presto_trans_start(fset, dentry->d_inode, PRESTO_OP_RELEASE); 
-        if ( IS_ERR(handle) ) {
-                error = -ENOMEM; 
-                EXIT; 
-                goto out_cancel_lml; 
-        } 
-        
-        if (info->flags & LENTO_FL_CANCEL_LML) {
-                error = presto_clear_lml_close(fset, lml_offset);
-                if ( error ) {
-                        presto_trans_commit(fset, handle);
-                        EXIT; 
-                        goto out_cancel_lml;
-                }
-        }
-
-
-        if (info->flags & LENTO_FL_WRITE_KML) {
-                presto_getversion(&new_ver, dentry->d_inode);
-                error = presto_journal_close(&rec, fset, NULL, dentry,
-                                             &new_ver);
-                if ( error ) {
-                        EXIT; 
-                        presto_trans_commit(fset, handle);
-                        goto out_cancel_lml;
-                }
-        }
-
-        if (info->flags & LENTO_FL_WRITE_EXPECT) {
-                error = presto_write_last_rcvd(&rec, fset, info); 
-                if ( error < 0 ) {
-                        EXIT; 
-                        presto_trans_commit(fset, handle);
-                        goto out_cancel_lml;
-                }
-        }
-
-        presto_trans_commit(fset, handle);
-
-        if (info->flags & LENTO_FL_CANCEL_LML) {
-            presto_truncate_lml(fset); 
-        }
-                
-
- out_cancel_lml:
-        EXIT;
-        path_release(&nd); 
-        return error;
-}       
-#endif 
-
-/* given a dentry, operate on the flags in its dentry.  Used by downcalls */
-int izo_mark_dentry(struct dentry *dentry, int and_flag, int or_flag, 
-                       int *res)
-{
-        int error = 0;
-
-        if (presto_d2d(dentry) == NULL) {
-                CERROR("InterMezzo: no ddata for inode %ld in %s\n",
-                       dentry->d_inode->i_ino, __FUNCTION__);
-                return -EINVAL;
-        }
-
-        CDEBUG(D_INODE, "inode: %ld, and flag %x, or flag %x, dd_flags %x\n",
-               dentry->d_inode->i_ino, and_flag, or_flag,
-               presto_d2d(dentry)->dd_flags);
-
-        presto_d2d(dentry)->dd_flags &= and_flag;
-        presto_d2d(dentry)->dd_flags |= or_flag;
-        if (res) 
-                *res = presto_d2d(dentry)->dd_flags;
-
-        return error;
-}
-
-/* given a path, operate on the flags in its cache.  Used by mark_ioctl */
-int izo_mark_cache(struct dentry *dentry, int and_flag, int or_flag, 
-                   int *res)
-{
-        struct presto_cache *cache;
-
-        if (presto_d2d(dentry) == NULL) {
-                CERROR("InterMezzo: no ddata for inode %ld in %s\n",
-                       dentry->d_inode->i_ino, __FUNCTION__);
-                return -EINVAL;
-        }
-
-        CDEBUG(D_INODE, "inode: %ld, and flag %x, or flag %x, dd_flags %x\n",
-               dentry->d_inode->i_ino, and_flag, or_flag,
-               presto_d2d(dentry)->dd_flags);
-
-        cache = presto_get_cache(dentry->d_inode);
-        if ( !cache ) {
-                CERROR("PRESTO: BAD: cannot find cache in izo_mark_cache\n");
-                return -EBADF;
-        }
-
-        cache->cache_flags &= and_flag;
-        cache->cache_flags |= or_flag;
-        if (res)
-                *res = (int)cache->cache_flags;
-
-        return 0;
-}
-
-int presto_set_max_kml_size(const char *path, unsigned long max_size)
-{
-        struct presto_file_set *fset;
-
-        ENTRY;
-
-        fset = presto_path2fileset(path);
-        if (IS_ERR(fset)) {
-                EXIT;
-                return PTR_ERR(fset);
-        }
-
-        fset->kml_truncate_size = max_size;
-        CDEBUG(D_CACHE, "KML truncate size set to %lu bytes for fset %s.\n",
-               max_size, path);
-
-        EXIT;
-        return 0;
-}
-
-int izo_mark_fset(struct dentry *dentry, int and_flag, int or_flag, 
-                  int * res)
-{
-        struct presto_file_set *fset;
-        
-        fset = presto_fset(dentry);
-        if ( !fset ) {
-                CERROR("PRESTO: BAD: cannot find cache in izo_mark_cache\n");
-                make_bad_inode(dentry->d_inode);
-                return -EBADF;
-        }
-        fset->fset_flags &= and_flag;
-        fset->fset_flags |= or_flag;
-        if (res)
-                *res = (int)fset->fset_flags;
-
-        return 0;
-}
-
-/* talk to Lento about the permit */
-static int presto_permit_upcall(struct dentry *dentry)
-{
-        int rc;
-        char *path, *buffer;
-        int pathlen;
-        int minor;
-        int fsetnamelen;
-        struct presto_file_set *fset = NULL;
-
-        ENTRY;
-
-        if ( (minor = presto_i2m(dentry->d_inode)) < 0) {
-                EXIT;
-                return -EINVAL;
-        }
-
-        fset = presto_fset(dentry);
-        if (!fset) {
-                EXIT;
-                return -ENOTCONN;
-        }
-        
-        if ( !presto_lento_up(minor) ) {
-                if ( fset->fset_flags & FSET_STEAL_PERMIT ) {
-                        EXIT;
-                        return 0;
-                } else {
-                        EXIT;
-                        return -ENOTCONN;
-                }
-        }
-
-        PRESTO_ALLOC(buffer, PAGE_SIZE);
-        if ( !buffer ) {
-                CERROR("PRESTO: out of memory!\n");
-                EXIT;
-                return -ENOMEM;
-        }
-        path = presto_path(dentry, fset->fset_dentry, buffer, PAGE_SIZE);
-        pathlen = MYPATHLEN(buffer, path);
-        fsetnamelen = strlen(fset->fset_name); 
-        rc = izo_upc_permit(minor, dentry, pathlen, path, fset->fset_name);
-        PRESTO_FREE(buffer, PAGE_SIZE);
-        EXIT;
-        return rc;
-}
-
-/* get a write permit for the fileset of this inode
- *  - if this returns a negative value there was an error
- *  - if 0 is returned the permit was already in the kernel -- or --
- *    Lento gave us the permit without reintegration
- *  - lento returns the number of records it reintegrated 
- *
- * Note that if this fileset has branches, a permit will -never- to a normal
- * process for writing in the data area (ie, outside of .intermezzo)
- */
-int presto_get_permit(struct inode * inode)
-{
-        struct dentry *de;
-        struct presto_file_set *fset;
-        int minor = presto_i2m(inode);
-        int rc = 0;
-
-        ENTRY;
-        if (minor < 0) {
-                EXIT;
-                return -1;
-        }
-
-        if ( ISLENTO(minor) ) {
-                EXIT;
-                return 0;
-        }
-
-        if (list_empty(&inode->i_dentry)) {
-                CERROR("No alias for inode %d\n", (int) inode->i_ino);
-                EXIT;
-                return -EINVAL;
-        }
-
-        de = list_entry(inode->i_dentry.next, struct dentry, d_alias);
-
-        if (presto_chk(de, PRESTO_DONT_JOURNAL)) {
-                EXIT;
-                return 0;
-        }
-
-        fset = presto_fset(de);
-        if ( !fset ) {
-                CERROR("Presto: no fileset in presto_get_permit!\n");
-                EXIT;
-                return -EINVAL;
-        }
-
-        if (fset->fset_flags & FSET_HAS_BRANCHES) {
-                EXIT;
-                return -EROFS;
-        }
-
-        spin_lock(&fset->fset_permit_lock);
-        if (fset->fset_flags & FSET_HASPERMIT) {
-                fset->fset_permit_count++;
-                CDEBUG(D_INODE, "permit count now %d, inode %lx\n", 
-                       fset->fset_permit_count, inode->i_ino);
-                spin_unlock(&fset->fset_permit_lock);
-                EXIT;
-                return 0;
-        }
-
-        /* Allow reintegration to proceed without locks -SHP */
-        fset->fset_permit_upcall_count++;
-        if (fset->fset_permit_upcall_count == 1) {
-                spin_unlock(&fset->fset_permit_lock);
-                rc = presto_permit_upcall(fset->fset_dentry);
-                spin_lock(&fset->fset_permit_lock);
-                fset->fset_permit_upcall_count--;
-                if (rc == 0) {
-                        izo_mark_fset(fset->fset_dentry, ~0, FSET_HASPERMIT,
-                                      NULL);
-                        fset->fset_permit_count++;
-                } else if (rc == ENOTCONN) {
-                        CERROR("InterMezzo: disconnected operation. stealing permit.\n");
-                        izo_mark_fset(fset->fset_dentry, ~0, FSET_HASPERMIT,
-                                      NULL);
-                        fset->fset_permit_count++;
-                        /* set a disconnected flag here to stop upcalls */
-                        rc = 0;
-                } else {
-                        CERROR("InterMezzo: presto_permit_upcall failed: %d\n", rc);
-                        rc = -EROFS;
-                        /* go to sleep here and try again? */
-                }
-                wake_up_interruptible(&fset->fset_permit_queue);
-        } else {
-                /* Someone is already doing an upcall; go to sleep. */
-                DECLARE_WAITQUEUE(wait, current);
-
-                spin_unlock(&fset->fset_permit_lock);
-                add_wait_queue(&fset->fset_permit_queue, &wait);
-                while (1) {
-                        set_current_state(TASK_INTERRUPTIBLE);
-
-                        spin_lock(&fset->fset_permit_lock);
-                        if (fset->fset_permit_upcall_count == 0)
-                                break;
-                        spin_unlock(&fset->fset_permit_lock);
-
-                        if (signal_pending(current)) {
-                                remove_wait_queue(&fset->fset_permit_queue,
-                                                  &wait);
-                                return -ERESTARTSYS;
-                        }
-                        schedule();
-                }
-                remove_wait_queue(&fset->fset_permit_queue, &wait);
-                /* We've been woken up: do we have the permit? */
-                if (fset->fset_flags & FSET_HASPERMIT)
-                        /* FIXME: Is this the right thing? */
-                        rc = -EAGAIN;
-        }
-
-        CDEBUG(D_INODE, "permit count now %d, ino %ld (likely 1), "
-               "rc %d\n", fset->fset_permit_count, inode->i_ino, rc);
-        spin_unlock(&fset->fset_permit_lock);
-        EXIT;
-        return rc;
-}
-
-int presto_put_permit(struct inode * inode)
-{
-        struct dentry *de;
-        struct presto_file_set *fset;
-        int minor = presto_i2m(inode);
-
-        ENTRY;
-        if (minor < 0) {
-                EXIT;
-                return -1;
-        }
-
-        if ( ISLENTO(minor) ) {
-                EXIT;
-                return 0;
-        }
-
-        if (list_empty(&inode->i_dentry)) {
-                CERROR("No alias for inode %d\n", (int) inode->i_ino);
-                EXIT;
-                return -1;
-        }
-
-        de = list_entry(inode->i_dentry.next, struct dentry, d_alias);
-
-        fset = presto_fset(de);
-        if ( !fset ) {
-                CERROR("InterMezzo: no fileset in %s!\n", __FUNCTION__);
-                EXIT;
-                return -1;
-        }
-
-        if (presto_chk(de, PRESTO_DONT_JOURNAL)) {
-                EXIT;
-                return 0;
-        }
-
-        spin_lock(&fset->fset_permit_lock);
-        if (fset->fset_flags & FSET_HASPERMIT) {
-                if (fset->fset_permit_count > 0)
-                        fset->fset_permit_count--;
-                else
-                        CERROR("Put permit while permit count is 0, "
-                               "inode %ld!\n", inode->i_ino); 
-        } else {
-                fset->fset_permit_count = 0;
-                CERROR("InterMezzo: put permit while no permit, inode %ld, "
-                       "flags %x!\n", inode->i_ino, fset->fset_flags);
-        }
-
-        CDEBUG(D_INODE, "permit count now %d, inode %ld\n",
-               fset->fset_permit_count, inode->i_ino);
-
-        if (fset->fset_flags & FSET_PERMIT_WAITING &&
-            fset->fset_permit_count == 0) {
-                CDEBUG(D_INODE, "permit count now 0, ino %ld, wake sleepers\n",
-                       inode->i_ino);
-                wake_up_interruptible(&fset->fset_permit_queue);
-        }
-        spin_unlock(&fset->fset_permit_lock);
-
-        EXIT;
-        return 0;
-}
-
-void presto_getversion(struct presto_version * presto_version,
-                       struct inode * inode)
-{
-        presto_version->pv_mtime_sec = inode->i_mtime.tv_sec;
-        presto_version->pv_mtime_nsec = inode->i_mtime.tv_nsec;
-        presto_version->pv_ctime_sec = inode->i_ctime.tv_sec;
-        presto_version->pv_ctime_nsec = inode->i_ctime.tv_nsec;
-        presto_version->pv_size  = (__u64)inode->i_size;
-}
-
-
-/* If uuid is non-null, it is the uuid of the peer that's making the revocation
- * request.  If it is null, this request was made locally, without external
- * pressure to give up the permit.  This most often occurs when a client
- * starts up.
- *
- * FIXME: this function needs to be refactored slightly once we start handling
- * multiple clients.
- */
-int izo_revoke_permit(struct dentry *dentry, __u8 uuid[16])
-{
-        struct presto_file_set *fset; 
-        DECLARE_WAITQUEUE(wait, current);
-        int minor, rc;
-
-        ENTRY;
-
-        minor = presto_i2m(dentry->d_inode);
-        if (minor < 0) {
-                EXIT;
-                return -ENODEV;
-        }
-
-        fset = presto_fset(dentry);
-        if (fset == NULL) {
-                EXIT;
-                return -ENODEV;
-        }
-
-        spin_lock(&fset->fset_permit_lock);
-        if (fset->fset_flags & FSET_PERMIT_WAITING) {
-                CERROR("InterMezzo: Two processes are waiting on the same permit--this not yet supported!  Aborting this particular permit request...\n");
-                EXIT;
-                spin_unlock(&fset->fset_permit_lock);
-                return -EINVAL;
-        }
-
-        if (fset->fset_permit_count == 0)
-                goto got_permit;
-
-        /* Something is still using this permit.  Mark that we're waiting for it
-         * and go to sleep. */
-        rc = izo_mark_fset(dentry, ~0, FSET_PERMIT_WAITING, NULL);
-        spin_unlock(&fset->fset_permit_lock);
-        if (rc < 0) {
-                EXIT;
-                return rc;
-        }
-
-        add_wait_queue(&fset->fset_permit_queue, &wait);
-        while (1) {
-                set_current_state(TASK_INTERRUPTIBLE);
-
-                spin_lock(&fset->fset_permit_lock);
-                if (fset->fset_permit_count == 0)
-                        break;
-                spin_unlock(&fset->fset_permit_lock);
-
-                if (signal_pending(current)) {
-                        /* FIXME: there must be a better thing to return... */
-                        remove_wait_queue(&fset->fset_permit_queue, &wait);
-                        EXIT;
-                        return -ERESTARTSYS;
-                }
-
-                /* FIXME: maybe there should be a timeout here. */
-
-                schedule();
-        }
-
-        remove_wait_queue(&fset->fset_permit_queue, &wait);
- got_permit:
-        /* By this point fset->fset_permit_count is zero and we're holding the
-         * lock. */
-        CDEBUG(D_CACHE, "InterMezzo: releasing permit inode %ld\n",
-               dentry->d_inode->i_ino);
-
-        if (uuid != NULL) {
-                rc = izo_upc_revoke_permit(minor, fset->fset_name, uuid);
-                if (rc < 0) {
-                        spin_unlock(&fset->fset_permit_lock);
-                        EXIT;
-                        return rc;
-                }
-        }
-
-        izo_mark_fset(fset->fset_dentry, ~FSET_PERMIT_WAITING, 0, NULL);
-        izo_mark_fset(fset->fset_dentry, ~FSET_HASPERMIT, 0, NULL);
-        spin_unlock(&fset->fset_permit_lock);
-        EXIT;
-        return 0;
-}
-
-inline int presto_is_read_only(struct presto_file_set * fset)
-{
-        int minor, mask;
-        struct presto_cache *cache = fset->fset_cache;
-
-        minor= cache->cache_psdev->uc_minor;
-        mask= (ISLENTO(minor)? FSET_LENTO_RO : FSET_CLIENT_RO);
-        if ( fset->fset_flags & mask )
-                return 1;
-        mask= (ISLENTO(minor)? CACHE_LENTO_RO : CACHE_CLIENT_RO);
-        return  ((cache->cache_flags & mask)? 1 : 0);
-}
diff -Nru a/fs/intermezzo/psdev.c b/fs/intermezzo/psdev.c
--- a/fs/intermezzo/psdev.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,647 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *              An implementation of a loadable kernel mode driver providing
- *              multiple kernel/user space bidirectional communications links.
- *
- *              Author:         Alan Cox <alan@cymru.net>
- *
- *              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.
- *
- *              Adapted to become the Linux 2.0 Coda pseudo device
- *              Peter  Braam  <braam@maths.ox.ac.uk>
- *              Michael Callahan <mjc@emmy.smith.edu>
- *
- *              Changes for Linux 2.1
- *              Copyright (c) 1997 Carnegie-Mellon University
- *
- *              Redone again for InterMezzo
- *              Copyright (c) 1998 Peter J. Braam
- *              Copyright (c) 2000 Mountain View Data, Inc.
- *              Copyright (c) 2000 Tacitus Systems, Inc.
- *              Copyright (c) 2001 Cluster File Systems, Inc.
- *
- */
-
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/sched.h>
-#include <linux/lp.h>
-#include <linux/slab.h>
-#include <linux/ioport.h>
-#include <linux/fcntl.h>
-#include <linux/delay.h>
-#include <linux/skbuff.h>
-#include <linux/proc_fs.h>
-#include <linux/vmalloc.h>
-#include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/poll.h>
-#include <linux/init.h>
-#include <linux/list.h>
-#include <linux/devfs_fs_kernel.h>
-#include <asm/io.h>
-#include <asm/segment.h>
-#include <asm/system.h>
-#include <asm/poll.h>
-#include <asm/uaccess.h>
-#include <linux/miscdevice.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-
-#ifdef PRESTO_DEVEL
-int  presto_print_entry = 1;
-int  presto_debug = 4095;
-#else
-int  presto_print_entry = 0;
-int  presto_debug = 0;
-#endif
-
-/* Like inode.c (presto_sym_iops), the initializer is just to prevent
-   izo_channels from appearing as a COMMON symbol (and therefore
-   interfering with other modules that use the same variable name). */
-struct upc_channel izo_channels[MAX_CHANNEL] = {{0}};
-
-int izo_psdev_get_free_channel(void)
-{
-        int i, result = -1;
-        
-        for (i = 0 ; i < MAX_CHANNEL ; i++ ) {
-                if (list_empty(&(izo_channels[i].uc_cache_list))) { 
-                    result = i;
-                    break;
-                }
-        }
-        return result;
-}
-
-
-int izo_psdev_setpid(int minor)
-{
-        struct upc_channel *channel; 
-        if (minor < 0 || minor >= MAX_CHANNEL) { 
-                return -EINVAL;
-        }
-
-        channel = &(izo_channels[minor]); 
-        /*
-         * This ioctl is performed by each Lento that starts up
-         * and wants to do further communication with presto.
-         */
-        CDEBUG(D_PSDEV, "Setting current pid to %d channel %d\n", 
-               current->pid, minor);
-        channel->uc_pid = current->pid;
-        spin_lock(&channel->uc_lock); 
-        if ( !list_empty(&channel->uc_processing) ) {
-                struct list_head *lh;
-                struct upc_req *req;
-                CERROR("WARNING: setpid & processing not empty!\n");
-		list_for_each(lh, &channel->uc_processing) {
-                        req = list_entry(lh, struct upc_req, rq_chain);
-                        /* freeing of req and data is done by the sleeper */
-                        wake_up(&req->rq_sleep);
-                }
-        }
-        if ( !list_empty(&channel->uc_processing) ) {
-                CERROR("BAD: FAILDED TO CLEAN PROCESSING LIST!\n");
-        }
-        spin_unlock(&channel->uc_lock); 
-        EXIT;
-        return 0;
-}
-
-int izo_psdev_setchannel(struct file *file, int fd)
-{
-
-        struct file *psdev_file = fget(fd); 
-        struct presto_cache *cache = presto_get_cache(file->f_dentry->d_inode);
-
-        if (!psdev_file) { 
-                CERROR("%s: no psdev_file!\n", __FUNCTION__);
-                return -EINVAL;
-        }
-
-        if (!cache) { 
-                CERROR("%s: no cache!\n", __FUNCTION__);
-                fput(psdev_file); 
-                return -EINVAL;
-        } 
-
-        if (psdev_file->private_data) { 
-                CERROR("%s: channel already set!\n", __FUNCTION__);
-                fput(psdev_file); 
-                return -EINVAL;
-        }
-
-        psdev_file->private_data = cache->cache_psdev;
-        fput(psdev_file); 
-        EXIT; 
-        return 0; 
-}
-
-inline int presto_lento_up(int minor) 
-{
-        return izo_channels[minor].uc_pid;
-}
-
-static unsigned int presto_psdev_poll(struct file *file, poll_table * wait)
- {
-        struct upc_channel *channel = (struct upc_channel *)file->private_data;
-        unsigned int mask = POLLOUT | POLLWRNORM;
-
-        /* ENTRY; this will flood you */
-        if ( ! channel ) { 
-                CERROR("%s: bad psdev file\n", __FUNCTION__);
-                return -EBADF;
-        }
-
-        poll_wait(file, &(channel->uc_waitq), wait);
-
-        spin_lock(&channel->uc_lock);
-        if (!list_empty(&channel->uc_pending)) {
-                CDEBUG(D_PSDEV, "Non-empty pending list.\n");
-                mask |= POLLIN | POLLRDNORM;
-        }
-        spin_unlock(&channel->uc_lock);
-
-        /* EXIT; will flood you */
-        return mask;
-}
-
-/*
- *      Receive a message written by Lento to the psdev
- */
-static ssize_t presto_psdev_write(struct file *file, const char *buf,
-                                  size_t count, loff_t *off)
-{
-        struct upc_channel *channel = (struct upc_channel *)file->private_data;
-        struct upc_req *req = NULL;
-        struct upc_req *tmp;
-        struct list_head *lh;
-        struct izo_upcall_resp hdr;
-        int error;
-
-        if ( ! channel ) { 
-                CERROR("%s: bad psdev file\n", __FUNCTION__);
-                return -EBADF;
-        }
-
-        /* Peek at the opcode, uniquefier */
-        if ( count < sizeof(hdr) ) {
-              CERROR("presto_psdev_write: Lento didn't write full hdr.\n");
-                return -EINVAL;
-        }
-
-        error = copy_from_user(&hdr, buf, sizeof(hdr));
-        if ( error )
-                return -EFAULT;
-
-        CDEBUG(D_PSDEV, "(process,opc,uniq)=(%d,%d,%d)\n",
-               current->pid, hdr.opcode, hdr.unique);
-
-        spin_lock(&channel->uc_lock); 
-        /* Look for the message on the processing queue. */
-	list_for_each(lh, &channel->uc_processing) {
-                tmp = list_entry(lh, struct upc_req , rq_chain);
-                if (tmp->rq_unique == hdr.unique) {
-                        req = tmp;
-                        /* unlink here: keeps search length minimal */
-                        list_del_init(&req->rq_chain);
-                        CDEBUG(D_PSDEV,"Eureka opc %d uniq %d!\n",
-                               hdr.opcode, hdr.unique);
-                        break;
-                }
-        }
-        spin_unlock(&channel->uc_lock); 
-        if (!req) {
-                CERROR("psdev_write: msg (%d, %d) not found\n",
-                       hdr.opcode, hdr.unique);
-                return(-ESRCH);
-        }
-
-        /* move data into response buffer. */
-        if (req->rq_bufsize < count) {
-                CERROR("psdev_write: too much cnt: %d, cnt: %Zd, "
-                       "opc: %d, uniq: %d.\n",
-                       req->rq_bufsize, count, hdr.opcode, hdr.unique);
-                count = req->rq_bufsize; /* don't have more space! */
-        }
-        error = copy_from_user(req->rq_data, buf, count);
-        if ( error )
-                return -EFAULT;
-
-        /* adjust outsize: good upcalls can be aware of this */
-        req->rq_rep_size = count;
-        req->rq_flags |= REQ_WRITE;
-
-        wake_up(&req->rq_sleep);
-        return(count);
-}
-
-/*
- *      Read a message from the kernel to Lento
- */
-static ssize_t presto_psdev_read(struct file * file, char * buf,
-                                 size_t count, loff_t *off)
-{
-        struct upc_channel *channel = (struct upc_channel *)file->private_data;
-        struct upc_req *req;
-        int result = count;
-
-        if ( ! channel ) { 
-                CERROR("%s: bad psdev file\n", __FUNCTION__);
-                return -EBADF;
-        }
-
-        spin_lock(&channel->uc_lock); 
-        if (list_empty(&(channel->uc_pending))) {
-                CDEBUG(D_UPCALL, "Empty pending list in read, not good\n");
-                spin_unlock(&channel->uc_lock); 
-                return -EINVAL;
-        }
-        req = list_entry((channel->uc_pending.next), struct upc_req, rq_chain);
-        list_del(&(req->rq_chain));
-        if (! (req->rq_flags & REQ_ASYNC) ) {
-                list_add(&(req->rq_chain), channel->uc_processing.prev);
-        }
-        spin_unlock(&channel->uc_lock); 
-
-        req->rq_flags |= REQ_READ;
-
-        /* Move the input args into userspace */
-        CDEBUG(D_PSDEV, "\n");
-        if (req->rq_bufsize <= count) {
-                result = req->rq_bufsize;
-        }
-
-        if (count < req->rq_bufsize) {
-                CERROR ("psdev_read: buffer too small, read %Zd of %d bytes\n",
-                        count, req->rq_bufsize);
-        }
-
-        if ( copy_to_user(buf, req->rq_data, result) ) {
-                BUG();
-                return -EFAULT;
-        }
-
-        /* If request was asynchronous don't enqueue, but free */
-        if (req->rq_flags & REQ_ASYNC) {
-                CDEBUG(D_PSDEV, "psdev_read: async msg (%d, %d), result %d\n",
-                       req->rq_opcode, req->rq_unique, result);
-                PRESTO_FREE(req->rq_data, req->rq_bufsize);
-                PRESTO_FREE(req, sizeof(*req));
-                return result;
-        }
-
-        return result;
-}
-
-
-static int presto_psdev_open(struct inode * inode, struct file * file)
-{
-        ENTRY;
-
-        file->private_data = NULL;  
-
-        CDEBUG(D_PSDEV, "Psdev_open: caller: %d, flags: %d\n", current->pid, file->f_flags);
-
-        EXIT;
-        return 0;
-}
-
-
-
-static int presto_psdev_release(struct inode * inode, struct file * file)
-{
-        struct upc_channel *channel = (struct upc_channel *)file->private_data;
-        struct upc_req *req;
-        struct list_head *lh;
-        ENTRY;
-
-        if ( ! channel ) { 
-                CERROR("%s: bad psdev file\n", __FUNCTION__);
-                return -EBADF;
-        }
-
-        CDEBUG(D_PSDEV, "Lento: pid %d\n", current->pid);
-        channel->uc_pid = 0;
-
-        /* Wake up clients so they can return. */
-        CDEBUG(D_PSDEV, "Wake up clients sleeping for pending.\n");
-        spin_lock(&channel->uc_lock); 
-	list_for_each(lh, &channel->uc_pending) {
-                req = list_entry(lh, struct upc_req, rq_chain);
-
-                /* Async requests stay around for a new lento */
-                if (req->rq_flags & REQ_ASYNC) {
-                        continue;
-                }
-                /* the sleeper will free the req and data */
-                req->rq_flags |= REQ_DEAD; 
-                wake_up(&req->rq_sleep);
-        }
-
-        CDEBUG(D_PSDEV, "Wake up clients sleeping for processing\n");
-	list_for_each(lh, &channel->uc_processing) {
-                req = list_entry(lh, struct upc_req, rq_chain);
-                /* freeing of req and data is done by the sleeper */
-                req->rq_flags |= REQ_DEAD; 
-                wake_up(&req->rq_sleep);
-        }
-        spin_unlock(&channel->uc_lock); 
-        CDEBUG(D_PSDEV, "Done.\n");
-
-        EXIT;
-        return 0;
-}
-
-static struct file_operations presto_psdev_fops = {
-	.owner	 = THIS_MODULE,
-        .read    = presto_psdev_read,
-        .write   = presto_psdev_write,
-        .poll    = presto_psdev_poll,
-        .open    = presto_psdev_open,
-        .release = presto_psdev_release
-};
-
-/* modules setup */
-static struct miscdevice intermezzo_psdev = {
-        INTERMEZZO_MINOR,
-        "intermezzo",
-        &presto_psdev_fops
-};
-
-int  presto_psdev_init(void)
-{
-        int i;
-        int err; 
-
-        if ( (err = misc_register(&intermezzo_psdev)) ) { 
-                CERROR("%s: cannot register %d err %d\n", 
-                       __FUNCTION__, INTERMEZZO_MINOR, err);
-                return -EIO;
-        }
-
-        memset(&izo_channels, 0, sizeof(izo_channels));
-        for ( i = 0 ; i < MAX_CHANNEL ; i++ ) {
-                struct upc_channel *channel = &(izo_channels[i]);
-                INIT_LIST_HEAD(&channel->uc_pending);
-                INIT_LIST_HEAD(&channel->uc_processing);
-                INIT_LIST_HEAD(&channel->uc_cache_list);
-                init_waitqueue_head(&channel->uc_waitq);
-                channel->uc_lock = SPIN_LOCK_UNLOCKED;
-                channel->uc_hard = 0;
-                channel->uc_no_filter = 0;
-                channel->uc_no_journal = 0;
-                channel->uc_no_upcall = 0;
-                channel->uc_timeout = 30;
-                channel->uc_errorval = 0;
-                channel->uc_minor = i;
-        }
-        return 0;
-}
-
-void presto_psdev_cleanup(void)
-{
-        int i;
-
-        misc_deregister(&intermezzo_psdev);
-
-        for ( i = 0 ; i < MAX_CHANNEL ; i++ ) {
-                struct upc_channel *channel = &(izo_channels[i]);
-                struct list_head *lh, *next;
-
-                spin_lock(&channel->uc_lock); 
-                if ( ! list_empty(&channel->uc_pending)) { 
-                        CERROR("Weird, tell Peter: module cleanup and pending list not empty dev %d\n", i);
-                }
-                if ( ! list_empty(&channel->uc_processing)) { 
-                        CERROR("Weird, tell Peter: module cleanup and processing list not empty dev %d\n", i);
-                }
-                if ( ! list_empty(&channel->uc_cache_list)) { 
-                        CERROR("Weird, tell Peter: module cleanup and cache listnot empty dev %d\n", i);
-                }
-		list_for_each_safe(lh, next, &channel->uc_pending) {
-                        struct upc_req *req;
-
-                        req = list_entry(lh, struct upc_req, rq_chain);
-                        if ( req->rq_flags & REQ_ASYNC ) {
-                                list_del(&(req->rq_chain));
-                                CDEBUG(D_UPCALL, "free pending upcall type %d\n",
-                                       req->rq_opcode);
-                                PRESTO_FREE(req->rq_data, req->rq_bufsize);
-                                PRESTO_FREE(req, sizeof(struct upc_req));
-                        } else {
-                                req->rq_flags |= REQ_DEAD; 
-                                wake_up(&req->rq_sleep);
-                        }
-                }
-		list_for_each(lh, &channel->uc_processing) {
-                        struct upc_req *req;
-                        req = list_entry(lh, struct upc_req, rq_chain);
-                        list_del(&(req->rq_chain));
-                        req->rq_flags |= REQ_DEAD; 
-                        wake_up(&req->rq_sleep);
-                }
-                spin_unlock(&channel->uc_lock); 
-        }
-}
-
-/*
- * lento_upcall and lento_downcall routines
- */
-static inline unsigned long lento_waitfor_upcall
-            (struct upc_channel *channel, struct upc_req *req, int minor)
-{
-        DECLARE_WAITQUEUE(wait, current);
-        unsigned long posttime;
-
-        req->rq_posttime = posttime = jiffies;
-
-        add_wait_queue(&req->rq_sleep, &wait);
-        for (;;) {
-                if ( izo_channels[minor].uc_hard == 0 )
-                        set_current_state(TASK_INTERRUPTIBLE);
-                else
-                        set_current_state(TASK_UNINTERRUPTIBLE);
-
-                /* got a reply */
-                if ( req->rq_flags & (REQ_WRITE | REQ_DEAD) )
-                        break;
-
-                /* these cases only apply when TASK_INTERRUPTIBLE */ 
-                if ( !izo_channels[minor].uc_hard && signal_pending(current) ) {
-                        /* if this process really wants to die, let it go */
-                        if (sigismember(&(current->pending.signal), SIGKILL)||
-                            sigismember(&(current->pending.signal), SIGINT) )
-                                break;
-                        /* signal is present: after timeout always return
-                           really smart idea, probably useless ... */
-                        if ( time_after(jiffies, req->rq_posttime +
-                             izo_channels[minor].uc_timeout * HZ) )
-                                break;
-                }
-                schedule();
-        }
-
-        spin_lock(&channel->uc_lock);
-        list_del_init(&req->rq_chain); 
-        spin_unlock(&channel->uc_lock);
-        remove_wait_queue(&req->rq_sleep, &wait);
-        set_current_state(TASK_RUNNING);
-
-        CDEBUG(D_SPECIAL, "posttime: %ld, returned: %ld\n",
-               posttime, jiffies-posttime);
-        return  (jiffies - posttime);
-}
-
-/*
- * lento_upcall will return an error in the case of
- * failed communication with Lento _or_ will peek at Lento
- * reply and return Lento's error.
- *
- * As lento has 2 types of errors, normal errors (positive) and internal
- * errors (negative), normal errors are negated, while internal errors
- * are all mapped to -EINTR, while showing a nice warning message. (jh)
- *
- * lento_upcall will always free buffer, either directly, when an upcall
- * is read (in presto_psdev_read), when the filesystem is unmounted, or
- * when the module is unloaded.
- */
-int izo_upc_upcall(int minor, int *size, struct izo_upcall_hdr *buffer, 
-                   int async)
-{
-        unsigned long runtime;
-        struct upc_channel *channel;
-        struct izo_upcall_resp *out;
-        struct upc_req *req;
-        int error = 0;
-
-        ENTRY;
-        channel = &(izo_channels[minor]);
-
-        if (channel->uc_no_upcall) {
-                EXIT;
-                goto exit_buf;
-        }
-        if (!channel->uc_pid && !async) {
-                EXIT;
-                error = -ENXIO;
-                goto exit_buf;
-        }
-
-        /* Format the request message. */
-        PRESTO_ALLOC(req, sizeof(struct upc_req));
-        if ( !req ) {
-                EXIT;
-                error = -ENOMEM;
-                goto exit_buf;
-        }
-        req->rq_data = (void *)buffer;
-        req->rq_flags = 0;
-        req->rq_bufsize = *size;
-        req->rq_rep_size = 0;
-        req->rq_opcode = buffer->u_opc;
-        req->rq_unique = ++channel->uc_seq;
-        init_waitqueue_head(&req->rq_sleep);
-
-        /* Fill in the common input args. */
-        buffer->u_uniq = req->rq_unique;
-        buffer->u_async = async;
-
-        /* Remove potential datarace possibility*/
-        if ( async ) 
-                req->rq_flags = REQ_ASYNC;
-
-        spin_lock(&channel->uc_lock); 
-        /* Append msg to pending queue and poke Lento. */
-        list_add(&req->rq_chain, channel->uc_pending.prev);
-        spin_unlock(&channel->uc_lock); 
-        CDEBUG(D_UPCALL,
-               "Proc %d waking Lento %d for(opc,uniq) =(%d,%d) msg at %p.\n",
-               current->pid, channel->uc_pid, req->rq_opcode,
-               req->rq_unique, req);
-        wake_up_interruptible(&channel->uc_waitq);
-
-        if ( async ) {
-                /* req, rq_data are freed in presto_psdev_read for async */
-                /* req->rq_flags = REQ_ASYNC;*/
-                EXIT;
-                return 0;
-        }
-
-        /* We can be interrupted while we wait for Lento to process
-         * our request.  If the interrupt occurs before Lento has read
-         * the request, we dequeue and return. If it occurs after the
-         * read but before the reply, we dequeue, send a signal
-         * message, and return. If it occurs after the reply we ignore
-         * it. In no case do we want to restart the syscall.  If it
-         * was interrupted by a lento shutdown (psdev_close), return
-         * ENODEV.  */
-
-        /* Go to sleep.  Wake up on signals only after the timeout. */
-        runtime = lento_waitfor_upcall(channel, req, minor);
-
-        CDEBUG(D_TIMING, "opc: %d time: %ld uniq: %d size: %d\n",
-               req->rq_opcode, jiffies - req->rq_posttime,
-               req->rq_unique, req->rq_rep_size);
-        CDEBUG(D_UPCALL,
-               "..process %d woken up by Lento for req at 0x%p, data at %p\n",
-               current->pid, req, req->rq_data);
-
-        if (channel->uc_pid) {      /* i.e. Lento is still alive */
-          /* Op went through, interrupt or not we go on */
-            if (req->rq_flags & REQ_WRITE) {
-                    out = (struct izo_upcall_resp *)req->rq_data;
-                    /* here we map positive Lento errors to kernel errors */
-                    if ( out->result < 0 ) {
-                            CERROR("Tell Peter: Lento returns negative error %d, for oc %d!\n",
-                                   out->result, out->opcode);
-                          out->result = EINVAL;
-                    }
-                    error = -out->result;
-                    CDEBUG(D_UPCALL, "upcall: (u,o,r) (%d, %d, %d) out at %p\n",
-                           out->unique, out->opcode, out->result, out);
-                    *size = req->rq_rep_size;
-                    EXIT;
-                    goto exit_req;
-            }
-            /* Interrupted before lento read it. */
-            if ( !(req->rq_flags & REQ_READ) && signal_pending(current)) {
-                    CDEBUG(D_UPCALL,
-                           "Interrupt before read: (op,un)=(%d,%d), flags %x\n",
-                           req->rq_opcode, req->rq_unique, req->rq_flags);
-                    /* perhaps the best way to convince the app to give up? */
-                    error = -EINTR;
-                    EXIT;
-                    goto exit_req;
-            }
-
-            /* interrupted after Lento did its read, send signal */
-            if ( (req->rq_flags & REQ_READ) && signal_pending(current) ) {
-                    CDEBUG(D_UPCALL,"Interrupt after read: op = %d.%d, flags = %x\n",
-                           req->rq_opcode, req->rq_unique, req->rq_flags);
-
-                    error = -EINTR;
-            } else {
-                  CERROR("Lento: Strange interruption - tell Peter.\n");
-                    error = -EINTR;
-            }
-        } else {        /* If lento died i.e. !UC_OPEN(channel) */
-                CERROR("lento_upcall: Lento dead on (op,un) (%d.%d) flags %d\n",
-                       req->rq_opcode, req->rq_unique, req->rq_flags);
-                error = -ENODEV;
-        }
-
-exit_req:
-        PRESTO_FREE(req, sizeof(struct upc_req));
-exit_buf:
-        PRESTO_FREE(buffer,*size);
-        return error;
-}
diff -Nru a/fs/intermezzo/replicator.c b/fs/intermezzo/replicator.c
--- a/fs/intermezzo/replicator.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,290 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- * Copyright (C) 2001 Tacit Networks, Inc. <phil@off.net>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Manage RCVD records for clients in the kernel
- *
- */
-
-#include <linux/module.h>
-#include <asm/uaccess.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/fsfilter.h>
-
-#include "intermezzo_fs.h"
-
-/*
- * this file contains a hash table of replicators/clients for a
- * fileset. It allows fast lookup and update of reintegration status
- */
-
-struct izo_offset_rec {
-	struct list_head or_list;
-	char             or_uuid[16];
-	loff_t           or_offset;
-};
-
-#define RCACHE_BITS 8
-#define RCACHE_SIZE (1 << RCACHE_BITS)
-#define RCACHE_MASK (RCACHE_SIZE - 1)
-
-static struct list_head *
-izo_rep_cache(void)
-{
-	int i;
-	struct list_head *cache;
-	PRESTO_ALLOC(cache, sizeof(struct list_head) * RCACHE_SIZE);
-	if (cache == NULL) {
-		CERROR("intermezzo-fatal: no memory for replicator cache\n");
-                return NULL;
-	}
-	memset(cache, 0, sizeof(struct list_head) * RCACHE_SIZE);
-	for (i = 0; i < RCACHE_SIZE; i++)
-		INIT_LIST_HEAD(&cache[i]);
-
-	return cache;
-}
-
-static struct list_head *
-izo_rep_hash(struct list_head *cache, char *uuid)
-{
-        return &cache[(RCACHE_MASK & uuid[1])];
-}
-
-static void
-izo_rep_cache_clean(struct presto_file_set *fset)
-{
-	int i;
-	struct list_head *bucket;
-	struct list_head *tmp;
-
-        if (fset->fset_clients == NULL)
-		return;
-        for (i = 0; i < RCACHE_SIZE; i++) {
-		tmp = bucket = &fset->fset_clients[i];
-
-		tmp = tmp->next;
-                while (tmp != bucket) {
-			struct izo_offset_rec *offrec;
-			tmp = tmp->next;
-			list_del(tmp);
-			offrec = list_entry(tmp, struct izo_offset_rec,
-					    or_list);
-			PRESTO_FREE(offrec, sizeof(struct izo_offset_rec));
-		}
-	}
-}
-
-struct izo_offset_rec *
-izo_rep_cache_find(struct presto_file_set *fset, char *uuid)
-{
-	struct list_head *tmp, *buck = izo_rep_hash(fset->fset_clients, uuid);
-        struct izo_offset_rec *rec = NULL;
-
-	list_for_each(tmp, buck) {
-		rec = list_entry(tmp, struct izo_offset_rec, or_list);
-                if ( memcmp(rec->or_uuid, uuid, sizeof(rec->or_uuid)) == 0 )
-			return rec;
-	}
-
-	return NULL;
-}
-
-static int
-izo_rep_cache_add(struct presto_file_set *fset, struct izo_rcvd_rec *rec,
-                  loff_t offset)
-{
-        struct izo_offset_rec *offrec;
-
-        if (izo_rep_cache_find(fset, rec->lr_uuid)) {
-                CERROR("izo: duplicate client entry %s off %Ld\n",
-                       fset->fset_name, offset);
-                return -EINVAL;
-        }
-
-        PRESTO_ALLOC(offrec, sizeof(*offrec));
-        if (offrec == NULL) {
-                CERROR("izo: cannot allocate offrec\n");
-                return -ENOMEM;
-        }
-
-        memcpy(offrec->or_uuid, rec->lr_uuid, sizeof(rec->lr_uuid));
-        offrec->or_offset = offset;
-
-        list_add(&offrec->or_list,
-                 izo_rep_hash(fset->fset_clients, rec->lr_uuid));
-        return 0;
-}
-
-int
-izo_rep_cache_init(struct presto_file_set *fset)
-{
-	struct izo_rcvd_rec rec;
-        loff_t offset = 0, last_offset = 0;
-
-	fset->fset_clients = izo_rep_cache();
-        if (fset->fset_clients == NULL) {
-		CERROR("Error initializing client cache\n");
-		return -ENOMEM;
-	}
-
-        while ( presto_fread(fset->fset_rcvd.fd_file, (char *)&rec,
-                             sizeof(rec), &offset) == sizeof(rec) ) {
-                int rc;
-
-                if ((rc = izo_rep_cache_add(fset, &rec, last_offset)) < 0) {
-			izo_rep_cache_clean(fset);
-			return rc;
-		}
-
-                last_offset = offset;
-	}
-
-	return 0;
-}
-
-/*
- * Return local last_rcvd record for the client. Update or create 
- * if necessary.
- *
- * XXX: After this call, any -EINVAL from izo_rcvd_get is a real error.
- */
-int
-izo_repstatus(struct presto_file_set *fset,  __u64 client_kmlsize, 
-              struct izo_rcvd_rec *lr_client, struct izo_rcvd_rec *lr_server)
-{
-        int rc;
-        rc = izo_rcvd_get(lr_server, fset, lr_client->lr_uuid);
-        if (rc < 0 && rc != -EINVAL) {
-                return rc;
-        }
-
-        /* client is new or has been reset. */
-        if (rc < 0 || (client_kmlsize == 0 && lr_client->lr_remote_offset == 0)) {
-                memset(lr_server, 0, sizeof(*lr_server));
-                memcpy(lr_server->lr_uuid, lr_client->lr_uuid, sizeof(lr_server->lr_uuid));
-                rc = izo_rcvd_write(fset, lr_server);
-                if (rc < 0)
-                        return rc;
-        }
-
-        /* update intersync */
-        rc = izo_upc_repstatus(presto_f2m(fset), fset->fset_name, lr_server);
-        return rc;
-}
-
-loff_t
-izo_rcvd_get(struct izo_rcvd_rec *rec, struct presto_file_set *fset, char *uuid)
-{
-        struct izo_offset_rec *offrec;
-        struct izo_rcvd_rec tmprec;
-        loff_t offset;
-
-        offrec = izo_rep_cache_find(fset, uuid);
-        if (offrec == NULL) {
-                CDEBUG(D_SPECIAL, "izo_get_rcvd: uuid not in hash.\n");
-                return -EINVAL;
-        }
-        offset = offrec->or_offset;
-
-        if (rec == NULL)
-                return offset;
-
-        if (presto_fread(fset->fset_rcvd.fd_file, (char *)&tmprec,
-                         sizeof(tmprec), &offset) != sizeof(tmprec)) {
-                CERROR("izo_get_rcvd: Unable to read from last_rcvd file offset "
-                       "%Lu\n", offset);
-                return -EIO;
-        }
-
-        memcpy(rec->lr_uuid, tmprec.lr_uuid, sizeof(tmprec.lr_uuid));
-        rec->lr_remote_recno = le64_to_cpu(tmprec.lr_remote_recno);
-        rec->lr_remote_offset = le64_to_cpu(tmprec.lr_remote_offset);
-        rec->lr_local_recno = le64_to_cpu(tmprec.lr_local_recno);
-        rec->lr_local_offset = le64_to_cpu(tmprec.lr_local_offset);
-        rec->lr_last_ctime = le64_to_cpu(tmprec.lr_last_ctime);
-
-        return offrec->or_offset;
-}
-
-/* Try to lookup the UUID in the hash.  Insert it if it isn't found.  Write the
- * data to the file.
- *
- * Returns the offset of the beginning of the record in the last_rcvd file. */
-loff_t
-izo_rcvd_write(struct presto_file_set *fset, struct izo_rcvd_rec *rec)
-{
-        struct izo_offset_rec *offrec;
-        loff_t offset, rc;
-
-        ENTRY;
-
-        offrec = izo_rep_cache_find(fset, rec->lr_uuid);
-        if (offrec == NULL) {
-                /* I don't think it should be possible for an entry to be not in
-                 * the hash table without also having an invalid offset, but we
-                 * handle it gracefully regardless. */
-                write_lock(&fset->fset_rcvd.fd_lock);
-                offset = fset->fset_rcvd.fd_offset;
-                fset->fset_rcvd.fd_offset += sizeof(*rec);
-                write_unlock(&fset->fset_rcvd.fd_lock);
-
-                rc = izo_rep_cache_add(fset, rec, offset);
-                if (rc < 0) {
-                        EXIT;
-                        return rc;
-                }
-        } else
-                offset = offrec->or_offset;
-        
-
-        rc = presto_fwrite(fset->fset_rcvd.fd_file, (char *)rec, sizeof(*rec),
-                           &offset);
-        if (rc == sizeof(*rec))
-                /* presto_fwrite() advances 'offset' */
-                rc = offset - sizeof(*rec);
-
-        EXIT;
-        return rc;
-}
-
-loff_t
-izo_rcvd_upd_remote(struct presto_file_set *fset, char * uuid,  __u64 remote_recno, 
-                    __u64 remote_offset)
-{
-        struct izo_rcvd_rec rec;
-        
-        loff_t rc;
-
-        ENTRY;
-        rc = izo_rcvd_get(&rec, fset, uuid);
-        if (rc < 0)
-                return rc;
-        rec.lr_remote_recno = remote_recno;
-        rec.lr_remote_offset = remote_offset;
-
-        rc = izo_rcvd_write(fset, &rec);
-        EXIT;
-        if (rc < 0)
-                return rc;
-        return 0;
-}
diff -Nru a/fs/intermezzo/super.c b/fs/intermezzo/super.c
--- a/fs/intermezzo/super.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,407 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1998 Peter J. Braam <braam@clusterfs.com>
- *  Copyright (C) 2000 Stelias Computing, Inc.
- *  Copyright (C) 2000 Red Hat, Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  presto's super.c
- */
-
-static char rcsid[] __attribute ((unused)) = "$Id: super.c,v 1.4 2002/10/12 02:16:19 rread Exp $";
-#define INTERMEZZO_VERSION "$Revision: 1.4 $"
-
-#include <asm/bitops.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/ext2_fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/sched.h>
-#include <linux/stat.h>
-#include <linux/string.h>
-#include <linux/blkdev.h>
-#include <linux/init.h>
-#include <linux/devfs_fs_kernel.h>
-#include <linux/module.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#ifdef PRESTO_DEBUG
-long presto_vmemory = 0;
-long presto_kmemory = 0;
-#endif
-
-/* returns an allocated string, copied out from data if opt is found */
-static char *opt_read(const char *opt, char *data)
-{
-        char *value;
-        char *retval;
-
-        CDEBUG(D_SUPER, "option: %s, data %s\n", opt, data);
-        if ( strncmp(opt, data, strlen(opt)) )
-                return NULL;
-
-        if ( (value = strchr(data, '=')) == NULL )
-                return NULL;
-
-        value++;
-        PRESTO_ALLOC(retval, strlen(value) + 1);
-        if ( !retval ) {
-                CERROR("InterMezzo: Out of memory!\n");
-                return NULL;
-        }
-
-        strcpy(retval, value);
-        CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
-        return retval;
-}
-
-static void opt_store(char **dst, char *opt)
-{
-        if (!dst) 
-                CERROR("intermezzo: store_opt, error dst == NULL\n"); 
-
-        if (*dst)
-                PRESTO_FREE(*dst, strlen(*dst) + 1);
-        *dst = opt;
-}
-
-static void opt_set_default(char **dst, char *defval)
-{
-        if (!dst) 
-                CERROR("intermezzo: store_opt, error dst == NULL\n"); 
-
-        if (*dst)
-                PRESTO_FREE(*dst, strlen(*dst) + 1);
-        if (defval) {
-                char *def_alloced; 
-                PRESTO_ALLOC(def_alloced, strlen(defval)+1);
-                if (!def_alloced) {
-                        CERROR("InterMezzo: Out of memory!\n");
-                        return ;
-                }
-                strcpy(def_alloced, defval);
-                *dst = def_alloced; 
-        }
-}
-
-
-/* Find the options for InterMezzo in "options", saving them into the
- * passed pointers.  If the pointer is null, the option is discarded.
- * Copy out all non-InterMezzo options into cache_data (to be passed
- * to the read_super operation of the cache).  The return value will
- * be a pointer to the end of the cache_data.
- */
-static char *presto_options(struct file_system_type *fstype, 
-                            char *options, char *cache_data,
-                            char **cache_type, char **fileset,
-                            char **channel)
-{
-        char *this_char;
-        char *opt_ptr = options;
-        char *cache_data_end = cache_data;
-
-        /* set the defaults */ 
-        if (strcmp(fstype->name, "intermezzo") == 0)
-            opt_set_default(cache_type, "ext3"); 
-        else 
-            opt_set_default(cache_type, "tmpfs"); 
-            
-        if (!options || !cache_data)
-                return cache_data_end;
-
-
-        CDEBUG(D_SUPER, "parsing options\n");
-        while ((this_char = strsep (&opt_ptr, ",")) != NULL) {
-                char *opt;
-                if (!*this_char)
-                        continue;
-                CDEBUG(D_SUPER, "this_char %s\n", this_char);
-
-                if ( (opt = opt_read("fileset", this_char)) ) {
-                        opt_store(fileset, opt);
-                        continue;
-                }
-                if ( (opt = opt_read("cache_type", this_char)) ) {
-                        opt_store(cache_type, opt);
-                        continue;
-                }
-                if ( (opt = opt_read("channel", this_char)) ) {
-                        opt_store(channel, opt);
-                        continue;
-                }
-
-                cache_data_end += 
-                        sprintf(cache_data_end, "%s%s",
-                                cache_data_end != cache_data ? ",":"", 
-                                this_char);
-        }
-
-        return cache_data_end;
-}
-
-static int presto_set_channel(struct presto_cache *cache, char *channel)
-{
-        int minor; 
-
-        ENTRY;
-        if (!channel) {
-                minor = izo_psdev_get_free_channel();
-        } else {
-                minor = simple_strtoul(channel, NULL, 0); 
-        }
-        if (minor < 0 || minor >= MAX_CHANNEL) { 
-                CERROR("all channels in use or channel too large %d\n", 
-                       minor);
-                return -EINVAL;
-        }
-        
-        cache->cache_psdev = &(izo_channels[minor]);
-        list_add(&cache->cache_channel_list, 
-                 &cache->cache_psdev->uc_cache_list); 
-
-        EXIT;
-        return minor;
-}
-
-/* We always need to remove the presto options before passing 
-   mount options to cache FS */
-struct super_block *
-presto_get_sb(struct file_system_type *izo_type, int flags,
-	      const char *devname, void *data)
-{
-        struct file_system_type *fstype;
-        struct presto_cache *cache = NULL;
-        char *cache_data = NULL;
-        char *cache_data_end;
-        char *cache_type = NULL;
-        char *fileset = NULL;
-        char *channel = NULL;
-        struct super_block *sb;
-        int err; 
-        unsigned int minor;
-
-        ENTRY;
-
-        /* reserve space for the cache's data */
-        PRESTO_ALLOC(cache_data, PAGE_SIZE);
-        if ( !cache_data ) {
-                CERROR("presto_read_super: Cannot allocate data page.\n");
-                EXIT;
-                goto out_err;
-        }
-
-        /* read and validate options */
-        cache_data_end = presto_options(izo_type, data, cache_data, &cache_type, 
-                                        &fileset, &channel);
-
-        /* was there anything for the cache filesystem in the data? */
-        if (cache_data_end == cache_data) {
-                PRESTO_FREE(cache_data, PAGE_SIZE);
-                cache_data_end = cache_data = NULL;
-        } else {
-                CDEBUG(D_SUPER, "cache_data at %p is: %s\n", cache_data,
-                       cache_data);
-        }
-
-        /* set up the cache */
-        cache = presto_cache_init();
-        if ( !cache ) {
-                CERROR("presto_read_super: failure allocating cache.\n");
-                EXIT;
-                goto out_err;
-        }
-        cache->cache_type = cache_type;
-
-        /* link cache to channel */ 
-        minor = presto_set_channel(cache, channel);
-        if (minor < 0) { 
-                EXIT;
-                goto out_err;
-        }
-
-        CDEBUG(D_SUPER, "Presto: type=%s, fset=%s, dev= %d, flags %x\n",
-               cache_type, fileset?fileset:"NULL", minor, cache->cache_flags);
-
-        /* get the filter for the cache */
-        fstype = get_fs_type(cache_type);
-        cache->cache_filter = filter_get_filter_fs((const char *)cache_type); 
-        if ( !fstype || !cache->cache_filter) {
-                CERROR("Presto: unrecognized fs type or cache type\n");
-                EXIT;
-                goto out_err;
-        }
-
-        sb = fstype->get_sb(fstype, flags, devname, cache_data);
-
-        if ( !sb || IS_ERR(sb)) {
-                CERROR("InterMezzo: cache mount failure.\n");
-                EXIT;
-                goto out_err;
-        }
-
-        /* can we in fact mount the cache */ 
-        if (sb->s_bdev && (strcmp(fstype->name, "vintermezzo") == 0)) {
-                CERROR("vintermezzo must not be used with a  block device\n");
-                EXIT;
-                goto out_err;
-        }
-
-        /* this might have been freed above */
-        if (cache_data) {
-                PRESTO_FREE(cache_data, PAGE_SIZE);
-                cache_data = NULL;
-        }
-
-        cache->cache_sb = sb;
-        cache->cache_root = dget(sb->s_root);
-
-        /* we now know the dev of the cache: hash the cache */
-        presto_cache_add(cache);
-        err = izo_prepare_fileset(sb->s_root, fileset); 
-
-        filter_setup_journal_ops(cache->cache_filter, cache->cache_type); 
-
-        /* make sure we have our own super operations: sb
-           still contains the cache operations */
-        filter_setup_super_ops(cache->cache_filter, sb->s_op, 
-                               &presto_super_ops);
-        sb->s_op = filter_c2usops(cache->cache_filter);
-
-        /* get izo directory operations: sb->s_root->d_inode exists now */
-        filter_setup_dir_ops(cache->cache_filter, sb->s_root->d_inode,
-                             &presto_dir_iops, &presto_dir_fops);
-        filter_setup_dentry_ops(cache->cache_filter, sb->s_root->d_op, 
-                                &presto_dentry_ops);
-        sb->s_root->d_inode->i_op = filter_c2udiops(cache->cache_filter);
-        sb->s_root->d_inode->i_fop = filter_c2udfops(cache->cache_filter);
-        sb->s_root->d_op = filter_c2udops(cache->cache_filter);
-
-        EXIT;
-        return sb;
-
- out_err:
-        CDEBUG(D_SUPER, "out_err called\n");
-        if (cache)
-                PRESTO_FREE(cache, sizeof(struct presto_cache));
-        if (cache_data)
-                PRESTO_FREE(cache_data, PAGE_SIZE);
-        if (fileset)
-                PRESTO_FREE(fileset, strlen(fileset) + 1);
-        if (channel)
-                PRESTO_FREE(channel, strlen(channel) + 1);
-        if (cache_type)
-                PRESTO_FREE(cache_type, strlen(cache_type) + 1);
-
-        CDEBUG(D_MALLOC, "mount error exit: kmem %ld, vmem %ld\n",
-               presto_kmemory, presto_vmemory);
-        return ERR_PTR(-EINVAL);
-}
-
-
-
-
-#ifdef PRESTO_DEVEL
-static DECLARE_FSTYPE(presto_fs_type, "izo", presto_read_super, FS_REQUIRES_DEV);
-static DECLARE_FSTYPE(vpresto_fs_type, "vintermezzo", presto_read_super, FS_LITTER);
-#else 
-static struct file_system_type vpresto_fs_type = {
-	.owner		= THIS_MODULE,
-	.name		= "vintermezzo",
-	.get_sb		= presto_get_sb,
-	.kill_sb	= kill_litter_super,
-};
-static struct file_system_type presto_fs_type = {
-	.owner		= THIS_MODULE,
-	.name		= "intermezzo",
-	.get_sb		= presto_get_sb,
-	.kill_sb	= kill_block_super,
-	.fs_flags	= FS_REQUIRES_DEV,
-};
-#endif
-
-
-
-int __init init_intermezzo_fs(void)
-{
-        int status;
-
-        printk(KERN_INFO "InterMezzo Kernel/Intersync communications " INTERMEZZO_VERSION
-               " info@clusterfs.com\n");
-
-        status = presto_psdev_init();
-        if ( status ) {
-                CERROR("Problem (%d) in init_intermezzo_psdev\n", status);
-                return status;
-        }
-
-        status = init_intermezzo_sysctl();
-        if (status) {
-                CERROR("presto: failed in init_intermezzo_sysctl!\n");
-        }
-
-        presto_cache_init_hash();
-
-        if (!presto_init_ddata_cache()) {
-                CERROR("presto out of memory!\n");
-                return -ENOMEM;
-        }
-
-        status = register_filesystem(&presto_fs_type);
-        if (status) {
-                CERROR("presto: failed in register_filesystem!\n");
-        }
-        status = register_filesystem(&vpresto_fs_type);
-        if (status) {
-                CERROR("vpresto: failed in register_filesystem!\n");
-        }
-        return status;
-}
-
-void __exit exit_intermezzo_fs(void)
-{
-        int err;
-
-        ENTRY;
-
-        if ( (err = unregister_filesystem(&presto_fs_type)) != 0 ) {
-                CERROR("presto: failed to unregister filesystem\n");
-        }
-        if ( (err = unregister_filesystem(&vpresto_fs_type)) != 0 ) {
-                CERROR("vpresto: failed to unregister filesystem\n");
-        }
-
-        presto_psdev_cleanup();
-        cleanup_intermezzo_sysctl();
-        presto_cleanup_ddata_cache();
-        CERROR("after cleanup: kmem %ld, vmem %ld\n",
-               presto_kmemory, presto_vmemory);
-}
-
-
-MODULE_AUTHOR("Cluster Filesystems Inc. <info@clusterfs.com>");
-MODULE_DESCRIPTION("InterMezzo Kernel/Intersync communications " INTERMEZZO_VERSION);
-MODULE_LICENSE("GPL");
-
-module_init(init_intermezzo_fs)
-module_exit(exit_intermezzo_fs)
diff -Nru a/fs/intermezzo/sysctl.c b/fs/intermezzo/sysctl.c
--- a/fs/intermezzo/sysctl.c	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,368 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 1999 Peter J. Braam <braam@clusterfs.com>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  Sysctrl entries for Intermezzo!
- */
-
-#include <linux/config.h> /* for CONFIG_PROC_FS */
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/sysctl.h>
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/stat.h>
-#include <linux/ctype.h>
-#include <linux/init.h>
-#include <asm/bitops.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
-#include <linux/utsname.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-/* /proc entries */
-
-#ifdef CONFIG_PROC_FS
-struct proc_dir_entry *proc_fs_intermezzo;
-int intermezzo_mount_get_info( char * buffer, char ** start, off_t offset,
-			       int length)
-{
-	int len=0;
-
-	/* this works as long as we are below 1024 characters! */
-	*start = buffer + offset;
-	len -= offset;
-
-	if ( len < 0 )
-		return -EINVAL;
-
-	return len;
-}
-
-#endif
-
-
-/* SYSCTL below */
-
-static struct ctl_table_header *intermezzo_table_header = NULL;
-/* 0x100 to avoid any chance of collisions at any point in the tree with
- * non-directories
- */
-#define PSDEV_INTERMEZZO  (0x100)
-
-#define PSDEV_DEBUG	   1      /* control debugging */
-#define PSDEV_TRACE	   2      /* control enter/leave pattern */
-#define PSDEV_TIMEOUT      3      /* timeout on upcalls to become intrble */
-#define PSDEV_HARD         4      /* mount type "hard" or "soft" */
-#define PSDEV_NO_FILTER    5      /* controls presto_chk */
-#define PSDEV_NO_JOURNAL   6      /* controls presto_chk */
-#define PSDEV_NO_UPCALL    7      /* controls lento_upcall */
-#define PSDEV_ERRORVAL     8      /* controls presto_debug_fail_blkdev */
-#define PSDEV_EXCL_GID     9      /* which GID is ignored by presto */
-#define PSDEV_BYTES_TO_CLOSE 11   /* bytes to write before close */
-
-/* These are global presto control options */
-#define PRESTO_PRIMARY_CTLCNT 2
-static struct ctl_table presto_table[ PRESTO_PRIMARY_CTLCNT + MAX_CHANNEL + 1] =
-{
-	{PSDEV_DEBUG, "debug", &presto_debug, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_TRACE, "trace", &presto_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
-};
-
-/*
- * Intalling the sysctl entries: strategy
- * - have templates for each /proc/sys/intermezzo/ entry
- *   such an entry exists for each /dev/presto
- *    (proto_channel_entry)
- * - have a template for the contents of such directories
- *    (proto_psdev_table)
- * - have the master table (presto_table)
- *
- * When installing, malloc, memcpy and fix up the pointers to point to
- * the appropriate constants in izo_channels[your_minor]
- */
-
-static ctl_table proto_psdev_table[] = {
-	{PSDEV_HARD, "hard", 0, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_NO_FILTER, "no_filter", 0, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_NO_JOURNAL, "no_journal", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_NO_UPCALL, "no_upcall", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
-	{PSDEV_TIMEOUT, "timeout", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
-#ifdef PRESTO_DEBUG
-	{PSDEV_ERRORVAL, "errorval", NULL, sizeof(int), 0644, NULL, &proc_dointvec},
-#endif
-	{ 0 }
-};
-
-static ctl_table proto_channel_entry = {
-	PSDEV_INTERMEZZO, 0,  NULL, 0, 0555, 0,
-};
-
-static ctl_table intermezzo_table[2] = {
-	{PSDEV_INTERMEZZO, "intermezzo",    NULL, 0, 0555, presto_table},
-	{0}
-};
-
-/* support for external setting and getting of opts. */
-/* particularly via ioctl. The Right way to do this is via sysctl,
- * but that will have to wait until intermezzo gets its own nice set of
- * sysctl IDs
- */
-/* we made these separate as setting may in future be more restricted
- * than getting
- */
-#ifdef RON_MINNICH
-int dosetopt(int minor, struct psdev_opt *opt)
-{
-	int retval = 0;
-	int newval = opt->optval;
-
-	ENTRY;
-
-	switch(opt->optname) {
-
-	case PSDEV_TIMEOUT:
-		izo_channels[minor].uc_timeout = newval;
-		break;
-
-	case PSDEV_HARD:
-		izo_channels[minor].uc_hard = newval;
-		break;
-
-	case PSDEV_NO_FILTER:
-		izo_channels[minor].uc_no_filter = newval;
-		break;
-
-	case PSDEV_NO_JOURNAL:
-		izo_channels[minor].uc_no_journal = newval;
-		break;
-
-	case PSDEV_NO_UPCALL:
-		izo_channels[minor].uc_no_upcall = newval;
-		break;
-
-#ifdef PRESTO_DEBUG
-	case PSDEV_ERRORVAL: {
-		/* If we have a positive arg, set a breakpoint for that
-		 * value.  If we have a negative arg, make that device
-		 * read-only.  FIXME  It would be much better to only
-		 * allow setting the underlying device read-only for the
-		 * current presto cache.
-		 */
-		int errorval = izo_channels[minor].uc_errorval;
-		if (errorval < 0) {
-			if (newval == 0)
-				set_device_ro(-errorval, 0);
-			else
-				CERROR("device %s already read only\n",
-				       kdevname(-errorval));
-		} else {
-			if (newval < 0)
-				set_device_ro(-newval, 1);
-			izo_channels[minor].uc_errorval = newval;
-			CDEBUG(D_PSDEV, "setting errorval to %d\n", newval);
-		}
-
-		break;
-	}
-#endif
-
-	case PSDEV_TRACE:
-	case PSDEV_DEBUG:
-	case PSDEV_BYTES_TO_CLOSE:
-	default:
-		CDEBUG(D_PSDEV,
-		       "ioctl: dosetopt: minor %d, bad optname 0x%x, \n",
-		       minor, opt->optname);
-
-		retval = -EINVAL;
-	}
-
-	EXIT;
-	return retval;
-}
-
-int dogetopt(int minor, struct psdev_opt *opt)
-{
-	int retval = 0;
-
-	ENTRY;
-
-	switch(opt->optname) {
-
-	case PSDEV_TIMEOUT:
-		opt->optval = izo_channels[minor].uc_timeout;
-		break;
-
-	case PSDEV_HARD:
-		opt->optval = izo_channels[minor].uc_hard;
-		break;
-
-	case PSDEV_NO_FILTER:
-		opt->optval = izo_channels[minor].uc_no_filter;
-		break;
-
-	case PSDEV_NO_JOURNAL:
-		opt->optval = izo_channels[minor].uc_no_journal;
-		break;
-
-	case PSDEV_NO_UPCALL:
-		opt->optval = izo_channels[minor].uc_no_upcall;
-		break;
-
-#ifdef PSDEV_DEBUG
-	case PSDEV_ERRORVAL: {
-		int errorval = izo_channels[minor].uc_errorval;
-		if (errorval < 0 && is_read_only(-errorval))
-			CERROR("device %s has been set read-only\n",
-			       kdevname(-errorval));
-		opt->optval = izo_channels[minor].uc_errorval;
-		break;
-	}
-#endif
-
-	case PSDEV_TRACE:
-	case PSDEV_DEBUG:
-	case PSDEV_BYTES_TO_CLOSE:
-	default:
-		CDEBUG(D_PSDEV,
-		       "ioctl: dogetopt: minor %d, bad optval 0x%x, \n",
-		       minor, opt->optname);
-
-		retval = -EINVAL;
-	}
-
-	EXIT;
-	return retval;
-}
-#endif
-
-
-/* allocate the tables for the presto devices. We need
- * sizeof(proto_channel_table)/sizeof(proto_channel_table[0])
- * entries for each dev
- */
-int /* __init */ init_intermezzo_sysctl(void)
-{
-	int i;
-	int total_dev = MAX_CHANNEL;
-	int entries_per_dev = sizeof(proto_psdev_table) /
-		sizeof(proto_psdev_table[0]);
-	int total_entries = entries_per_dev * total_dev;
-	ctl_table *dev_ctl_table;
-
-	PRESTO_ALLOC(dev_ctl_table, sizeof(ctl_table) * total_entries);
-
-	if (! dev_ctl_table) {
-		CERROR("WARNING: presto couldn't allocate dev_ctl_table\n");
-		EXIT;
-		return -ENOMEM;
-	}
-
-	/* now fill in the entries ... we put the individual presto<x>
-	 * entries at the end of the table, and the per-presto stuff
-	 * starting at the front.  We assume that the compiler makes
-	 * this code more efficient, but really, who cares ... it
-	 * happens once per reboot.
-	 */
-	for(i = 0; i < total_dev; i++) {
-		void *p;
-
-		/* entry for this /proc/sys/intermezzo/intermezzo"i" */
-		ctl_table *psdev = &presto_table[i + PRESTO_PRIMARY_CTLCNT];
-		/* entries for the individual "files" in this "directory" */
-		ctl_table *psdev_entries = &dev_ctl_table[i * entries_per_dev];
-		/* init the psdev and psdev_entries with the prototypes */
-		*psdev = proto_channel_entry;
-		memcpy(psdev_entries, proto_psdev_table,
-		       sizeof(proto_psdev_table));
-		/* now specialize them ... */
-		/* the psdev has to point to psdev_entries, and fix the number */
-		psdev->ctl_name = psdev->ctl_name + i + 1; /* sorry */
-
-		PRESTO_ALLOC(p, PROCNAME_SIZE);
-		psdev->procname = p;
-		if (!psdev->procname) {
-			PRESTO_FREE(dev_ctl_table,
-				    sizeof(ctl_table) * total_entries);
-			return -ENOMEM;
-		}
-		sprintf((char *) psdev->procname, "intermezzo%d", i);
-		/* hook presto into */
-		psdev->child = psdev_entries;
-
-		/* now for each psdev entry ... */
-		psdev_entries[0].data = &(izo_channels[i].uc_hard);
-		psdev_entries[1].data = &(izo_channels[i].uc_no_filter);
-		psdev_entries[2].data = &(izo_channels[i].uc_no_journal);
-		psdev_entries[3].data = &(izo_channels[i].uc_no_upcall);
-		psdev_entries[4].data = &(izo_channels[i].uc_timeout);
-#ifdef PRESTO_DEBUG
-		psdev_entries[5].data = &(izo_channels[i].uc_errorval);
-#endif
-	}
-
-
-#ifdef CONFIG_SYSCTL
-	if ( !intermezzo_table_header )
-		intermezzo_table_header =
-			register_sysctl_table(intermezzo_table, 0);
-#endif
-#ifdef CONFIG_PROC_FS
-	proc_fs_intermezzo = proc_mkdir("intermezzo", proc_root_fs);
-	proc_fs_intermezzo->owner = THIS_MODULE;
-	create_proc_info_entry("mounts", 0, proc_fs_intermezzo, 
-			       intermezzo_mount_get_info);
-#endif
-	return 0;
-}
-
-void cleanup_intermezzo_sysctl(void)
-{
-	int total_dev = MAX_CHANNEL;
-	int entries_per_dev = sizeof(proto_psdev_table) /
-		sizeof(proto_psdev_table[0]);
-	int total_entries = entries_per_dev * total_dev;
-	int i;
-
-#ifdef CONFIG_SYSCTL
-	if ( intermezzo_table_header )
-		unregister_sysctl_table(intermezzo_table_header);
-	intermezzo_table_header = NULL;
-#endif
-	for(i = 0; i < total_dev; i++) {
-		/* entry for this /proc/sys/intermezzo/intermezzo"i" */
-		ctl_table *psdev = &presto_table[i + PRESTO_PRIMARY_CTLCNT];
-		PRESTO_FREE(psdev->procname, PROCNAME_SIZE);
-	}
-	/* presto_table[PRESTO_PRIMARY_CTLCNT].child points to the
-	 * dev_ctl_table previously allocated in init_intermezzo_psdev()
-	 */
-	PRESTO_FREE(presto_table[PRESTO_PRIMARY_CTLCNT].child, sizeof(ctl_table) * total_entries);
-
-#ifdef CONFIG_PROC_FS
-	remove_proc_entry("mounts", proc_fs_intermezzo);
-	remove_proc_entry("intermezzo", proc_root_fs);
-#endif
-}
-
diff -Nru a/fs/intermezzo/upcall.c b/fs/intermezzo/upcall.c
--- a/fs/intermezzo/upcall.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,559 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Copyright (C) 2001, 2002 Cluster File Systems, Inc. <braam@clusterfs.com>
- * Copyright (C) 2001 Tacit Networks, Inc. <phil@off.net>
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Mostly platform independent upcall operations to a cache manager:
- *  -- upcalls
- *  -- upcall routines
- *
- */
-
-#include <asm/system.h>
-#include <asm/segment.h>
-#include <asm/signal.h>
-#include <linux/signal.h>
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/vmalloc.h>
-#include <linux/slab.h>
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <asm/uaccess.h>
-
-#include "intermezzo_lib.h"
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#include "intermezzo_idl.h"
-
-/*
-  At present:
-  -- Asynchronous calls:
-   - kml:            give a "more" kml indication to userland
-   - kml_truncate:   initiate KML truncation
-   - release_permit: kernel is done with permit
-  -- Synchronous
-   - open:           fetch file
-   - permit:         get a permit
-
-  Errors returned by user level code are positive
-
- */
-
-static struct izo_upcall_hdr *upc_pack(__u32 opcode, int pathlen, char *path,
-                                       char *fsetname, int reclen, char *rec,
-                                       int *size)
-{
-        struct izo_upcall_hdr *hdr;
-        char *ptr;
-        ENTRY;
-
-        *size = sizeof(struct izo_upcall_hdr);
-        if ( fsetname ) {
-                *size += round_strlen(fsetname);
-        }
-        if ( path ) { 
-                *size += round_strlen(path);
-        }
-        if ( rec ) { 
-                *size += size_round(reclen);
-        }
-        PRESTO_ALLOC(hdr, *size);
-        if (!hdr) { 
-                CERROR("intermezzo upcall: out of memory (opc %d)\n", opcode);
-                EXIT;
-                return NULL;
-        }
-        memset(hdr, 0, *size);
-
-        ptr = (char *)hdr + sizeof(*hdr);
-
-        /* XXX do we need fsuid ? */
-        hdr->u_len = *size;
-        hdr->u_version = IZO_UPC_VERSION;
-        hdr->u_opc = opcode;
-        hdr->u_pid = current->pid;
-        hdr->u_uid = current->fsuid;
-
-        if (path) { 
-                /*XXX Robert: please review what len to pass in for 
-                  NUL terminated strings */
-                hdr->u_pathlen = strlen(path);
-                LOGL0(path, hdr->u_pathlen, ptr);
-        }
-        if (fsetname) { 
-                hdr->u_fsetlen = strlen(fsetname);
-                LOGL0(fsetname, strlen(fsetname), ptr);
-        }
-        if (rec) { 
-                hdr->u_reclen = reclen;
-                LOGL(rec, reclen, ptr);
-        }
-        
-        EXIT;
-        return hdr;
-}
-
-/* the upcalls */
-int izo_upc_kml(int minor, __u64 offset, __u32 first_recno, __u64 length, __u32 last_recno, char *fsetname)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-
-        ENTRY;
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return 0;
-        }
-
-        hdr = upc_pack(IZO_UPC_KML, 0, NULL, fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        hdr->u_offset = offset;
-        hdr->u_first_recno = first_recno;
-        hdr->u_length = length;
-        hdr->u_last_recno = last_recno;
-
-        CDEBUG(D_UPCALL, "KML: fileset %s, offset %Lu, length %Lu, "
-               "first %u, last %d; minor %d\n",
-               fsetname,
-               (unsigned long long) hdr->u_offset,
-               (unsigned long long) hdr->u_length,
-               hdr->u_first_recno,
-               hdr->u_last_recno, minor);
-
-        error = izo_upc_upcall(minor, &size, hdr, ASYNCHRONOUS);
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_kml_truncate(int minor, __u64 length, __u32 last_recno, char *fsetname)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-
-        ENTRY;
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return 0;
-        }
-
-        hdr = upc_pack(IZO_UPC_KML_TRUNC, 0, NULL, fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        hdr->u_length = length;
-        hdr->u_last_recno = last_recno;
-
-        CDEBUG(D_UPCALL, "KML TRUNCATE: fileset %s, length %Lu, "
-               "last recno %d, minor %d\n",
-               fsetname,
-               (unsigned long long) hdr->u_length,
-               hdr->u_last_recno, minor);
-
-        error = izo_upc_upcall(minor, &size, hdr, ASYNCHRONOUS);
-
-        EXIT;
-        return error;
-}
-
-int izo_upc_open(int minor, __u32 pathlen, char *path, char *fsetname, struct lento_vfs_context *info)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_OPEN, pathlen, path, fsetname, 
-                       sizeof(*info), (char*)info, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        CDEBUG(D_UPCALL, "path %s\n", path);
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_get_fileid(int minor, __u32 reclen, char *rec, 
-                       __u32 pathlen, char *path, char *fsetname)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_GET_FILEID, pathlen, path, fsetname, reclen, rec, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        CDEBUG(D_UPCALL, "path %s\n", path);
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_backfetch(int minor, char *path, char *fsetname, struct lento_vfs_context *info)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_BACKFETCH, strlen(path), path, fsetname, 
-                       sizeof(*info), (char *)info, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        /* This is currently synchronous, kml_reint_record blocks */
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_permit(int minor, struct dentry *dentry, __u32 pathlen, char *path,
-                   char *fsetname)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-
-        ENTRY;
-
-        hdr = upc_pack(IZO_UPC_PERMIT, pathlen, path, fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        CDEBUG(D_UPCALL, "Permit minor %d path %s\n", minor, path);
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-
-        if (error == -EROFS) {
-                int err;
-                CERROR("InterMezzo: ERROR - requested permit for read-only "
-                       "fileset.\n   Setting \"%s\" read-only!\n", path);
-                err = izo_mark_cache(dentry, 0xFFFFFFFF, CACHE_CLIENT_RO, NULL);
-                if (err)
-                        CERROR("InterMezzo ERROR: mark_cache %d\n", err);
-        } else if (error) {
-                CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error);
-        }
-
-        EXIT;
-        return error;
-}
-
-/* This is a ping-pong upcall handled on the server when a client (uuid)
- * requests the permit for itself. */
-int izo_upc_revoke_permit(int minor, char *fsetname, __u8 uuid[16])
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-
-        ENTRY;
-
-        hdr = upc_pack(IZO_UPC_REVOKE_PERMIT, 0, NULL, fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        memcpy(hdr->u_uuid, uuid, sizeof(hdr->u_uuid));
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-
-        if (error)
-                CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_go_fetch_kml(int minor, char *fsetname, __u8 uuid[16],
-                         __u64 kmlsize)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_GO_FETCH_KML, 0, NULL, fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        hdr->u_offset = kmlsize;
-        memcpy(hdr->u_uuid, uuid, sizeof(hdr->u_uuid));
-
-        error = izo_upc_upcall(minor, &size, hdr, ASYNCHRONOUS);
-        if (error)
-                CERROR("%s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_connect(int minor, __u64 ip_address, __u64 port, __u8 uuid[16],
-                    int client_flag)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_CONNECT, 0, NULL, NULL, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        hdr->u_offset = ip_address;
-        hdr->u_length = port;
-        memcpy(hdr->u_uuid, uuid, sizeof(hdr->u_uuid));
-        hdr->u_first_recno = client_flag;
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error) {
-                CERROR("%s: error %d\n", __FUNCTION__, error);
-        }
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_set_kmlsize(int minor, char *fsetname, __u8 uuid[16], __u64 kmlsize)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_SET_KMLSIZE, 0, NULL, fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        memcpy(hdr->u_uuid, uuid, sizeof(hdr->u_uuid));
-        hdr->u_length = kmlsize;
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("%s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_repstatus(int minor,  char * fsetname, struct izo_rcvd_rec *lr_server)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_REPSTATUS, 0, NULL, fsetname, 
-                       sizeof(*lr_server), (char*)lr_server, 
-                       &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("%s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
-
-
-#if 0
-int izo_upc_client_make_branch(int minor, char *fsetname, char *tagname,
-                               char *branchname)
-{
-        int size, error;
-        struct izo_upcall_hdr *hdr;
-        int pathlen;
-        char *path;
-        ENTRY;
-
-        hdr = upc_pack(IZO_UPC_CLIENT_MAKE_BRANCH, strlen(tagname), tagname,
-                       fsetname, strlen(branchname) + 1, branchname, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                error = -PTR_ERR(hdr);
-                goto error;
-        }
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("InterMezzo: error %d\n", error);
-
- error:
-        PRESTO_FREE(path, pathlen);
-        EXIT;
-        return error;
-}
-#endif
-
-int izo_upc_server_make_branch(int minor, char *fsetname)
-{
-        int size, error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        hdr = upc_pack(IZO_UPC_SERVER_MAKE_BRANCH, 0, NULL, fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                error = -PTR_ERR(hdr);
-                goto error;
-        }
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("InterMezzo: error %d\n", error);
-
- error:
-        EXIT;
-        return -error;
-}
-
-int izo_upc_branch_undo(int minor, char *fsetname, char *branchname)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_BRANCH_UNDO, strlen(branchname), branchname,
-                       fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
-
-int izo_upc_branch_redo(int minor, char *fsetname, char *branchname)
-{
-        int size;
-        int error;
-        struct izo_upcall_hdr *hdr;
-        ENTRY;
-
-        if (!presto_lento_up(minor)) {
-                EXIT;
-                return -EIO;
-        }
-
-        hdr = upc_pack(IZO_UPC_BRANCH_REDO, strlen(branchname) + 1, branchname,
-                       fsetname, 0, NULL, &size);
-        if (!hdr || IS_ERR(hdr)) {
-                EXIT;
-                return -PTR_ERR(hdr);
-        }
-
-        error = izo_upc_upcall(minor, &size, hdr, SYNCHRONOUS);
-        if (error)
-                CERROR("InterMezzo: %s: error %d\n", __FUNCTION__, error);
-
-        EXIT;
-        return -error;
-}
diff -Nru a/fs/intermezzo/vfs.c b/fs/intermezzo/vfs.c
--- a/fs/intermezzo/vfs.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2416 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
- *  Copyright (C) 2000 Stelias Computing, Inc.
- *  Copyright (C) 2000 Red Hat, Inc.
- *
- *   This file is part of InterMezzo, http://www.inter-mezzo.org.
- *
- *   InterMezzo is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   InterMezzo 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 InterMezzo; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * vfs.c
- *
- * This file implements kernel downcalls from lento.
- *
- * Author: Rob Simmonds <simmonds@stelias.com>
- *         Andreas Dilger <adilger@stelias.com>
- * Copyright (C) 2000 Stelias Computing Inc
- * Copyright (C) 2000 Red Hat Inc.
- *
- * Extended attribute support
- * Copyright (C) 2001 Shirish H. Phatak, Tacit Networks, Inc.
- *
- * This code is based on code from namei.c in the linux file system;
- * see copyright notice below.
- */
-
-/** namei.c copyright **/
-
-/*
- *  linux/fs/namei.c
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- */
-/*
- * Some corrections by tytso.
- */
-
-/* [Feb 1997 T. Schoebel-Theuer] Complete rewrite of the pathname
- * lookup logic.
- */
-
-/** end of namei.c copyright **/
-
-#include <linux/mm.h>
-#include <linux/proc_fs.h>
-#include <linux/quotaops.h>
-
-#include <asm/uaccess.h>
-#include <asm/unaligned.h>
-#include <asm/semaphore.h>
-#include <asm/pgtable.h>
-
-#include <linux/file.h>
-#include <linux/fs.h>
-#include <linux/namei.h>
-#include <linux/genhd.h>
-
-#include "intermezzo_fs.h"
-#include "intermezzo_psdev.h"
-
-#ifdef CONFIG_FS_EXT_ATTR
-# include <linux/ext_attr.h>
-
-# if 0 /* was a broken check for Posix ACLs */
-#  include <linux/posix_acl.h>
-# endif
-#endif
-
-extern struct inode_operations presto_sym_iops;
-
-/* Write the last_rcvd values to the last_rcvd file.  We don't know what the
- * UUID or last_ctime values are, so we have to read from the file first
- * (sigh). 
- * exported for branch_reinter in kml_reint.c*/
-int presto_write_last_rcvd(struct rec_info *recinfo,
-                           struct presto_file_set *fset,
-                           struct lento_vfs_context *info)
-{
-        int rc;
-        struct izo_rcvd_rec rcvd_rec;
-
-        ENTRY;
-
-        memset(&rcvd_rec, 0, sizeof(rcvd_rec));
-        memcpy(rcvd_rec.lr_uuid, info->uuid, sizeof(rcvd_rec.lr_uuid));
-        rcvd_rec.lr_remote_recno = HTON__u64(info->recno);
-        rcvd_rec.lr_remote_offset = HTON__u64(info->kml_offset);
-        rcvd_rec.lr_local_recno = HTON__u64(recinfo->recno);
-        rcvd_rec.lr_local_offset = HTON__u64(recinfo->offset + recinfo->size);
-
-        rc = izo_rcvd_write(fset, &rcvd_rec);
-        if (rc < 0) {
-                /* izo_rcvd_write returns negative errors and non-negative
-                 * offsets */
-                CERROR("InterMezzo: izo_rcvd_write failed: %d\n", rc);
-                EXIT;
-                return rc;
-        }
-        EXIT;
-        return 0;
-}
-
-/*
- * It's inline, so penalty for filesystems that don't use sticky bit is
- * minimal.
- */
-static inline int check_sticky(struct inode *dir, struct inode *inode)
-{
-        if (!(dir->i_mode & S_ISVTX))
-                return 0;
-        if (inode->i_uid == current->fsuid)
-                return 0;
-        if (dir->i_uid == current->fsuid)
-                return 0;
-        return !capable(CAP_FOWNER);
-}
-
-/* from linux/fs/namei.c */
-static inline int may_delete(struct inode *dir,struct dentry *victim, int isdir)
-{
-        int error;
-        if (!victim->d_inode || victim->d_parent->d_inode != dir)
-                return -ENOENT;
-        error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
-        if (error)
-                return error;
-        if (IS_APPEND(dir))
-                return -EPERM;
-        if (check_sticky(dir, victim->d_inode)||IS_APPEND(victim->d_inode)||
-            IS_IMMUTABLE(victim->d_inode))
-                return -EPERM;
-        if (isdir) {
-                if (!S_ISDIR(victim->d_inode->i_mode))
-                        return -ENOTDIR;
-                if (IS_ROOT(victim))
-                        return -EBUSY;
-        } else if (S_ISDIR(victim->d_inode->i_mode))
-                return -EISDIR;
-        return 0;
-}
-
-/* from linux/fs/namei.c */
-static inline int may_create(struct inode *dir, struct dentry *child) {
-        if (child->d_inode)
-                return -EEXIST;
-        if (IS_DEADDIR(dir))
-                return -ENOENT;
-        return permission(dir,MAY_WRITE | MAY_EXEC, NULL);
-}
-
-#ifdef PRESTO_DEBUG
-/* The loop_discard_io() function is available via a kernel patch to the
- * loop block device.  It "works" by accepting writes, but throwing them
- * away, rather than trying to write them to disk.  The old method worked
- * by setting the underlying device read-only, but that has the problem
- * that dirty buffers are kept in memory, and ext3 didn't like that at all.
- */
-#ifdef CONFIG_LOOP_DISCARD
-#define BLKDEV_FAIL(dev,fail) loop_discard_io(dev,fail)
-#else
-#define BLKDEV_FAIL(dev,fail) set_device_ro(dev, 1)
-#endif
-
-/* If a breakpoint has been set via /proc/sys/intermezzo/intermezzoX/errorval,
- * that is the same as "value", the underlying device will "fail" now.
- */
-inline void presto_debug_fail_blkdev(struct presto_file_set *fset,
-                                     unsigned long value)
-{
-        int minor = presto_f2m(fset);
-        int errorval = izo_channels[minor].uc_errorval;
-	struct block_device *bdev = fset->fset_dentry->d_inode->i_sb->s_bdev;
-	char b[BDEVNAME_SIZE];
-
-        if (errorval && errorval == (long)value && !bdev_read_only(bdev)) {
-                CDEBUG(D_SUPER, "setting device %s read only\n",
-				bdevname(bdev, b));
-                BLKDEV_FAIL(bdev, 1);
-                izo_channels[minor].uc_errorval = -bdev->bd_dev;
-        }
-}
-#else
-#define presto_debug_fail_blkdev(dev,value) do {} while (0)
-#endif
-
-
-static inline int presto_do_kml(struct lento_vfs_context *info,
-                                struct dentry *dentry)
-{
-        if ( ! (info->flags & LENTO_FL_KML) )
-                return 0;
-        if ( presto_chk(dentry, PRESTO_DONT_JOURNAL) )
-                return 0;
-        return 1;
-}
-
-static inline int presto_do_rcvd(struct lento_vfs_context *info,
-                                 struct dentry *dentry)
-{
-        if ( ! (info->flags & LENTO_FL_EXPECT) ) 
-                return 0;
-        if ( presto_chk(dentry, PRESTO_DONT_JOURNAL) )
-                return 0;
-        return 1;
-}
-
-
-/* XXX fixme: this should not fail, all these dentries are in memory
-   when _we_ call this */
-int presto_settime(struct presto_file_set *fset, 
-                   struct dentry *newobj,
-                   struct dentry *parent,
-                   struct dentry *target,
-                   struct lento_vfs_context *ctx, 
-                   int valid)
-{
-        int error = 0;
-        struct dentry *dentry;
-        struct inode *inode;
-        struct inode_operations *iops;
-        struct iattr iattr;
-
-        ENTRY;
-        if (ctx->flags &  LENTO_FL_IGNORE_TIME ) { 
-                EXIT;
-                return 0;
-        }
-
-        iattr.ia_ctime = ctx->updated_time;
-        iattr.ia_mtime = ctx->updated_time;
-        iattr.ia_valid = valid;
-
-        while (1) {
-                if (parent && ctx->flags & LENTO_FL_TOUCH_PARENT) {
-                        dentry = parent;
-                        parent = NULL;
-                } else if (newobj && ctx->flags & LENTO_FL_TOUCH_NEWOBJ) {
-                        dentry = newobj;
-                        newobj = NULL;
-                } else if (target) {
-                        dentry = target;
-                        target = NULL;
-                } else
-                        break;
-
-                inode = dentry->d_inode;
-
-                error = -EROFS;
-                if (IS_RDONLY(inode)) {
-                        EXIT;
-                        return -EROFS;
-                }
-
-                if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
-                        EXIT;
-                        return -EPERM;
-                }
-
-                error = -EPERM;
-                iops = filter_c2cdiops(fset->fset_cache->cache_filter); 
-                if (!iops) { 
-                        EXIT;
-                        return error;
-                }
-
-                if (iops->setattr != NULL)
-                        error = iops->setattr(dentry, &iattr);
-                else {
-                        error = 0;
-                        inode_setattr(dentry->d_inode, &iattr);
-                }
-        }
-        EXIT;
-        return error;
-}
-
-void izo_get_rollback_data(struct inode *inode, struct izo_rollback_data *rb)
-{
-        rb->rb_mode = (__u32)inode->i_mode;
-        rb->rb_rdev = (__u32)old_encode_dev(inode->i_rdev);
-        rb->rb_uid  = (__u64)inode->i_uid;
-        rb->rb_gid  = (__u64)inode->i_gid;
-}
-
-
-int presto_do_close(struct presto_file_set *fset, struct file *file)
-{
-        struct rec_info rec;
-        int rc = -ENOSPC; 
-        void *handle;
-        struct inode *inode = file->f_dentry->d_inode;
-        struct presto_file_data *fdata = 
-                (struct presto_file_data *)file->private_data;
-
-        ENTRY;
-        presto_getversion(&fdata->fd_info.remote_version, inode);
-
-        rc = presto_reserve_space(fset->fset_cache, PRESTO_REQHIGH); 
-        if (rc) { 
-                EXIT;
-                return rc;
-        }
-
-        handle = presto_trans_start(fset, file->f_dentry->d_inode, 
-                                            KML_OPCODE_RELEASE);
-        if ( IS_ERR(handle) ) {
-                CERROR("presto_release: no space for transaction\n");
-                return rc;
-        }
-
-        if (fdata->fd_info.flags & LENTO_FL_KML) 
-                rc = presto_journal_close(&rec, fset, fdata, file->f_dentry,
-                                          &fdata->fd_version, 
-                                          &fdata->fd_info.remote_version);
-        if (rc) { 
-                CERROR("presto_close: cannot journal close\n");
-                goto out;
-        }
-
-        if (fdata->fd_info.flags & LENTO_FL_EXPECT) 
-                rc = presto_write_last_rcvd(&rec, fset, &fdata->fd_info);
-
-        if (rc) { 
-                CERROR("presto_close: cannot journal last_rcvd\n");
-                goto out;
-        }
-        presto_trans_commit(fset, handle); 
-        
-        /* cancel the LML record */ 
-        handle = presto_trans_start(fset, inode, KML_OPCODE_WRITE);
-        if ( IS_ERR(handle) ) {
-                CERROR("presto_release: no space for clear\n");
-                return -ENOSPC;
-        }
-
-        rc = presto_clear_lml_close(fset, fdata->fd_lml_offset); 
-        if (rc < 0 ) { 
-                CERROR("presto_close: cannot journal close\n");
-                goto out;
-        }
-        presto_truncate_lml(fset);
-
- out:
-        presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-        presto_trans_commit(fset, handle); 
-        EXIT;
-        return rc;
-}
-
-int presto_do_setattr(struct presto_file_set *fset, struct dentry *dentry,
-                      struct iattr *iattr, struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        struct inode *inode = dentry->d_inode;
-        struct inode_operations *iops;
-        int error;
-        struct presto_version old_ver, new_ver;
-        struct izo_rollback_data rb;
-        void *handle;
-        loff_t old_size=inode->i_size;
-
-        ENTRY;
-        error = -EROFS;
-        if (IS_RDONLY(inode)) {
-                EXIT;
-                return -EROFS;
-        }
-
-        if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
-                EXIT;
-                return -EPERM;
-        }
-
-        presto_getversion(&old_ver, dentry->d_inode);
-        izo_get_rollback_data(dentry->d_inode, &rb);
-        error = -EPERM;
-        iops = filter_c2cdiops(fset->fset_cache->cache_filter); 
-
-        error = presto_reserve_space(fset->fset_cache, 2*PRESTO_REQHIGH); 
-        if (error) {
-                EXIT;
-                return error;
-        }
-
-        if  (iattr->ia_valid & ATTR_SIZE) {
-                if (izo_mark_dentry(dentry, ~PRESTO_DATA, 0, NULL) != 0)
-                        CERROR("izo_mark_dentry(inode %ld, ~PRESTO_DATA) "
-                               "failed\n", dentry->d_inode->i_ino);
-                handle = presto_trans_start(fset, dentry->d_inode,
-                                            KML_OPCODE_TRUNC);
-        } else {
-                handle = presto_trans_start(fset, dentry->d_inode,
-                                            KML_OPCODE_SETATTR);
-        }
-
-        if ( IS_ERR(handle) ) {
-                CERROR("presto_do_setattr: no space for transaction\n");
-                presto_release_space(fset->fset_cache, 2*PRESTO_REQHIGH); 
-                return -ENOSPC;
-        }
-
-        if (dentry->d_inode && iops && iops->setattr) {
-                error = iops->setattr(dentry, iattr);
-        } else {
-                error = inode_change_ok(dentry->d_inode, iattr);
-                if (!error) 
-                        inode_setattr(inode, iattr);
-        }
-
-        if (!error && (iattr->ia_valid & ATTR_SIZE))
-                vmtruncate(inode, iattr->ia_size);
-
-        if (error) {
-                EXIT;
-                goto exit;
-        }
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SETATTR | 0x10);
-
-        if ( presto_do_kml(info, dentry) ) {
-                if ((iattr->ia_valid & ATTR_SIZE) && (old_size != inode->i_size)) {
-                        /* Journal a close whenever we see a potential truncate
-                        * At the receiving end, lento should explicitly remove
-                        * ATTR_SIZE from the list of valid attributes */
-                        presto_getversion(&new_ver, inode);
-                        error = presto_journal_close(&rec, fset, NULL, dentry,
-                                                     &old_ver, &new_ver);
-                }
-
-                if (!error)
-                        error = presto_journal_setattr(&rec, fset, dentry,
-                                                       &old_ver, &rb, iattr);
-        }
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SETATTR | 0x20);
-        if ( presto_do_rcvd(info, dentry) )
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SETATTR | 0x30);
-
-        EXIT;
-exit:
-        presto_release_space(fset->fset_cache, 2*PRESTO_REQHIGH); 
-        presto_trans_commit(fset, handle);
-        return error;
-}
-
-int lento_setattr(const char *name, struct iattr *iattr,
-                  struct lento_vfs_context *info)
-{
-        struct nameidata nd;
-        struct dentry *dentry;
-        struct presto_file_set *fset;
-        int error;
-#if 0 /* was a broken check for Posix ACLs */
-        int (*set_posix_acl)(struct inode *, int type, posix_acl_t *)=NULL;
-#endif
-
-        ENTRY;
-        CDEBUG(D_PIOCTL,"name %s, valid %#x, mode %#o, uid %d, gid %d, size %Ld\n",
-               name, iattr->ia_valid, iattr->ia_mode, iattr->ia_uid,
-               iattr->ia_gid, iattr->ia_size);
-        CDEBUG(D_PIOCTL, "atime %#lx, mtime %#lx, ctime %#lx, attr_flags %#x\n",
-               iattr->ia_atime.tv_sec, iattr->ia_mtime.tv_sec, iattr->ia_ctime.tv_sec,
-               iattr->ia_attr_flags);
-        CDEBUG(D_PIOCTL, "offset %d, recno %d, flags %#x\n",
-               info->slot_offset, info->recno, info->flags);
-
-        lock_kernel();
-        error = presto_walk(name, &nd);
-        if (error) {
-                EXIT;
-                goto exit;
-        }
-        dentry = nd.dentry;
-        
-        fset = presto_fset(dentry);
-        error = -EINVAL;
-        if ( !fset ) {
-                CERROR("No fileset!\n");
-                EXIT;
-                goto exit_lock;
-        }
-
-        /* NOTE: this prevents us from changing the filetype on setattr,
-         *       as we normally only want to change permission bits.
-         *       If this is not correct, then we need to fix the perl code
-         *       to always send the file type OR'ed with the permission.
-         */
-        if (iattr->ia_valid & ATTR_MODE) {
-                int set_mode = iattr->ia_mode;
-                iattr->ia_mode = (iattr->ia_mode & S_IALLUGO) |
-                                 (dentry->d_inode->i_mode & ~S_IALLUGO);
-                CDEBUG(D_PIOCTL, "chmod: orig %#o, set %#o, result %#o\n",
-                       dentry->d_inode->i_mode, set_mode, iattr->ia_mode);
-#if 0 /* was a broken check for Posix ACLs */
-                /* ACl code interacts badly with setattr 
-                 * since it tries to modify the ACL using 
-                 * set_ext_attr which recurses back into presto.  
-                 * This only happens if ATTR_MODE is set.
-                 * Here we are doing a "forced" mode set 
-                 * (initiated by lento), so we disable the 
-                 * set_posix_acl operation which 
-                 * prevents such recursion.  -SHP
-                 *
-                 * This will probably still be required when native
-                 * acl journalling is in place.
-                 */
-                set_posix_acl=dentry->d_inode->i_op->set_posix_acl;
-                dentry->d_inode->i_op->set_posix_acl=NULL;
-#endif
-        }
-
-        error = presto_do_setattr(fset, dentry, iattr, info);
-
-        if (info->flags & LENTO_FL_SET_DDFILEID) {
-                struct presto_dentry_data *dd = presto_d2d(dentry);
-                if (dd) {
-                        dd->remote_ino = info->remote_ino;
-                        dd->remote_generation = info->remote_generation;
-                }
-        }
-
-#if 0 /* was a broken check for Posix ACLs */
-        /* restore the inode_operations if we changed them*/
-        if (iattr->ia_valid & ATTR_MODE) 
-                dentry->d_inode->i_op->set_posix_acl=set_posix_acl;
-#endif
-
-
-        EXIT;
-exit_lock:
-        path_release(&nd);
-exit:
-        unlock_kernel();
-        return error;
-}
-
-int presto_do_create(struct presto_file_set *fset, struct dentry *dir,
-                     struct dentry *dentry, int mode,
-                     struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        int error;
-        struct presto_version tgt_dir_ver, new_file_ver;
-        struct inode_operations *iops;
-        void *handle;
-
-        ENTRY;
-        mode &= S_IALLUGO;
-        mode |= S_IFREG;
-
-        //        down(&dir->d_inode->i_zombie);
-        error = presto_reserve_space(fset->fset_cache, PRESTO_REQHIGH); 
-        if (error) {
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return error;
-        }
-
-        error = may_create(dir->d_inode, dentry);
-        if (error) {
-                EXIT;
-                goto exit_pre_lock;
-        }
-
-        error = -EPERM;
-        iops = filter_c2cdiops(fset->fset_cache->cache_filter);
-        if (!iops->create) {
-                EXIT;
-                goto exit_pre_lock;
-        }
-
-        presto_getversion(&tgt_dir_ver, dir->d_inode);
-        handle = presto_trans_start(fset, dir->d_inode, KML_OPCODE_CREATE);
-        if ( IS_ERR(handle) ) {
-                EXIT;
-                presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-                CERROR("presto_do_create: no space for transaction\n");
-                error=-ENOSPC;
-                goto exit_pre_lock;
-        }
-        DQUOT_INIT(dir->d_inode);
-        lock_kernel();
-        error = iops->create(dir->d_inode, dentry, mode, NULL);
-        if (error) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        if (dentry->d_inode) {
-                struct presto_cache *cache = fset->fset_cache;
-                /* was this already done? */
-                presto_set_ops(dentry->d_inode, cache->cache_filter);
-
-                filter_setup_dentry_ops(cache->cache_filter, 
-                                        dentry->d_op, 
-                                        &presto_dentry_ops);
-                dentry->d_op = filter_c2udops(cache->cache_filter);
-
-                /* if Lento creates this file, we won't have data */
-                if ( ISLENTO(presto_c2m(cache)) ) {
-                        presto_set(dentry, PRESTO_ATTR);
-                } else {
-                        presto_set(dentry, PRESTO_ATTR | PRESTO_DATA);
-                }
-        }
-
-        info->flags |= LENTO_FL_TOUCH_PARENT;
-        error = presto_settime(fset, NULL, dir, dentry,
-                               info, ATTR_CTIME | ATTR_MTIME);
-        if (error) { 
-                EXIT;
-                goto exit_lock;
-        }
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_CREATE | 0x10);
-
-        if ( presto_do_kml(info, dentry) ) { 
-                presto_getversion(&new_file_ver, dentry->d_inode);
-                error = presto_journal_create(&rec, fset, dentry, &tgt_dir_ver,
-                                              &new_file_ver, 
-                                              dentry->d_inode->i_mode);
-        }
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_CREATE | 0x20);
-
-        if ( presto_do_rcvd(info, dentry) )
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_CREATE | 0x30);
-
-        /* add inode dentry */
-        if (fset->fset_cache->cache_filter->o_trops->tr_add_ilookup ) { 
-                struct dentry *d;
-                d = fset->fset_cache->cache_filter->o_trops->tr_add_ilookup
-                        (dir->d_inode->i_sb->s_root, dentry);
-        }
-
-        EXIT;
-
- exit_lock:
-        unlock_kernel();
-        presto_trans_commit(fset, handle);
- exit_pre_lock:
-        presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-        //        up(&dir->d_inode->i_zombie);
-        return error;
-}
-
-int lento_create(const char *name, int mode, struct lento_vfs_context *info)
-{
-        int error;
-        struct nameidata nd;
-        char * pathname;
-        struct dentry *dentry;
-        struct presto_file_set *fset;
-
-        ENTRY;
-        pathname = getname(name);
-        error = PTR_ERR(pathname);
-        if (IS_ERR(pathname)) {
-                EXIT;
-                goto exit;
-        }
-
-        /* this looks up the parent */
-        error = path_lookup(pathname,  LOOKUP_PARENT, &nd);
-        if (error) {
-                EXIT;
-                goto exit;
-        }
-        dentry = lookup_create(&nd, 0);
-        error = PTR_ERR(dentry);
-        if (IS_ERR(dentry)) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        fset = presto_fset(dentry);
-        error = -EINVAL;
-        if ( !fset ) {
-                CERROR("No fileset!\n");
-                EXIT;
-                goto exit_lock;
-        }
-        error = presto_do_create(fset, dentry->d_parent, dentry, (mode&S_IALLUGO)|S_IFREG,
-                                 info);
-
-        EXIT;
-
- exit_lock:
-        path_release (&nd);
-        dput(dentry); 
-        up(&dentry->d_parent->d_inode->i_sem);
-        putname(pathname);
-exit:
-        return error;
-}
-
-int presto_do_link(struct presto_file_set *fset, struct dentry *old_dentry,
-                   struct dentry *dir, struct dentry *new_dentry,
-                   struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        struct inode *inode;
-        int error;
-        struct inode_operations *iops;
-        struct presto_version tgt_dir_ver;
-        struct presto_version new_link_ver;
-        void *handle;
-
-        //        down(&dir->d_inode->i_zombie);
-        error = presto_reserve_space(fset->fset_cache, PRESTO_REQHIGH); 
-        if (error) {
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return error;
-        }
-        error = -ENOENT;
-        inode = old_dentry->d_inode;
-        if (!inode)
-                goto exit_lock;
-
-        error = may_create(dir->d_inode, new_dentry);
-        if (error)
-                goto exit_lock;
-
-        error = -EXDEV;
-        if (dir->d_inode->i_sb != inode->i_sb)
-                goto exit_lock;
-
-        /*
-         * A link to an append-only or immutable file cannot be created.
-         */
-        error = -EPERM;
-        if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        iops = filter_c2cdiops(fset->fset_cache->cache_filter);
-        if (!iops->link) {
-                EXIT;
-                goto exit_lock;
-        }
-
-
-        presto_getversion(&tgt_dir_ver, dir->d_inode);
-        handle = presto_trans_start(fset, dir->d_inode, KML_OPCODE_LINK);
-        if ( IS_ERR(handle) ) {
-                presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-                CERROR("presto_do_link: no space for transaction\n");
-                return -ENOSPC;
-        }
-
-        DQUOT_INIT(dir->d_inode);
-        lock_kernel();
-        error = iops->link(old_dentry, dir->d_inode, new_dentry);
-        unlock_kernel();
-        if (error) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        /* link dd data to that of existing dentry */
-        old_dentry->d_op->d_release(new_dentry); 
-        if (!presto_d2d(old_dentry)) 
-                BUG();
-        presto_d2d(old_dentry)->dd_count++;
-
-        new_dentry->d_fsdata = presto_d2d(old_dentry);
-
-        info->flags |= LENTO_FL_TOUCH_PARENT;
-        error = presto_settime(fset, NULL, dir, new_dentry,
-                               info, ATTR_CTIME);
-        if (error) { 
-                EXIT;
-                goto exit_lock;
-        }
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_LINK | 0x10);
-        presto_getversion(&new_link_ver, new_dentry->d_inode);
-        if ( presto_do_kml(info, old_dentry) )
-                error = presto_journal_link(&rec, fset, old_dentry, new_dentry,
-                                            &tgt_dir_ver, &new_link_ver);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_LINK | 0x20);
-        if ( presto_do_rcvd(info, old_dentry) )
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_LINK | 0x30);
-        EXIT;
-        presto_trans_commit(fset, handle);
-exit_lock:
-        presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-        //        up(&dir->d_inode->i_zombie);
-        return error;
-}
-
-
-int lento_link(const char * oldname, const char * newname, 
-                         struct lento_vfs_context *info)
-{
-        int error;
-        char * to;
-        struct presto_file_set *fset;
-
-        to = getname(newname);
-        error = PTR_ERR(to);
-        if (!IS_ERR(to)) {
-                struct dentry *new_dentry;
-                struct nameidata nd, old_nd;
-
-                error = __user_walk(oldname, 0, &old_nd);
-                if (error)
-                        goto exit;
-                error = path_lookup(to, LOOKUP_PARENT, &nd);
-                if (error)
-                        goto out;
-                error = -EXDEV;
-                if (old_nd.mnt != nd.mnt)
-                        goto out;
-                new_dentry = lookup_create(&nd, 0);
-                error = PTR_ERR(new_dentry);
-
-                if (!IS_ERR(new_dentry)) {
-                        fset = presto_fset(new_dentry);
-                        error = -EINVAL;
-                        if ( !fset ) {
-                                CERROR("No fileset!\n");
-                                EXIT;
-                                goto out2;
-                        }
-                        error = presto_do_link(fset, old_nd.dentry, 
-                                               nd.dentry,
-                                               new_dentry, info);
-                        dput(new_dentry);
-                }
-        out2:
-                up(&nd.dentry->d_inode->i_sem);
-                path_release(&nd);
-        out:
-                path_release(&old_nd);
-        exit:
-                putname(to);
-        }
-        return error;
-}
-
-int presto_do_unlink(struct presto_file_set *fset, struct dentry *dir,
-                     struct dentry *dentry, struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        struct inode_operations *iops;
-        struct presto_version tgt_dir_ver, old_file_ver;
-        struct izo_rollback_data rb;
-        void *handle;
-        int do_kml = 0, do_rcvd = 0, linkno = 0, error, old_targetlen = 0;
-        char *old_target = NULL;
-
-        ENTRY;
-        //        down(&dir->d_inode->i_zombie);
-        error = may_delete(dir->d_inode, dentry, 0);
-        if (error) {
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return error;
-        }
-
-        error = -EPERM;
-        iops = filter_c2cdiops(fset->fset_cache->cache_filter);
-        if (!iops->unlink) {
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return error;
-        }
-
-        error = presto_reserve_space(fset->fset_cache, PRESTO_REQLOW); 
-        if (error) {
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return error;
-        }
-
-
-        if (presto_d2d(dentry)) { 
-                struct presto_dentry_data *dd = presto_d2d(dentry); 
-                struct dentry *de = dd->dd_inodentry;
-                if (de && dentry->d_inode->i_nlink == 1) { 
-                        dd->dd_count--;
-                        dd->dd_inodentry = NULL; 
-                        de->d_fsdata = NULL; 
-                        atomic_dec(&de->d_inode->i_count); 
-                        de->d_inode = NULL;
-                        dput(de); 
-                }
-        }
-
-        presto_getversion(&tgt_dir_ver, dir->d_inode);
-        presto_getversion(&old_file_ver, dentry->d_inode);
-        izo_get_rollback_data(dentry->d_inode, &rb);
-        handle = presto_trans_start(fset, dir->d_inode, KML_OPCODE_UNLINK);
-        if ( IS_ERR(handle) ) {
-                presto_release_space(fset->fset_cache, PRESTO_REQLOW); 
-                CERROR("ERROR: presto_do_unlink: no space for transaction. Tell Peter.\n");
-                //                up(&dir->d_inode->i_zombie);
-                return -ENOSPC;
-        }
-        DQUOT_INIT(dir->d_inode);
-        if (d_mountpoint(dentry))
-                error = -EBUSY;
-        else {
-                lock_kernel();
-                linkno = dentry->d_inode->i_nlink;
-                if (linkno > 1) {
-                        dget(dentry);
-                }
-
-                if (S_ISLNK(dentry->d_inode->i_mode)) {
-                        mm_segment_t old_fs;
-                        struct inode_operations *riops;
-                        riops = filter_c2csiops(fset->fset_cache->cache_filter);
-
-                        PRESTO_ALLOC(old_target, PATH_MAX);
-                        if (old_target == NULL) {
-                                error = -ENOMEM;
-                                EXIT;
-                                goto exit;
-                        }
-
-                        old_fs = get_fs();
-                        set_fs(get_ds());
-
-                        if (riops->readlink == NULL)
-                                CERROR("InterMezzo %s: no readlink iops.\n",
-                                       __FUNCTION__);
-                        else
-                                old_targetlen =
-                                        riops->readlink(dentry, old_target,
-                                                        PATH_MAX);
-                        if (old_targetlen < 0) {
-                                CERROR("InterMezzo: readlink failed: %ld\n",
-                                       PTR_ERR(old_target));
-                                PRESTO_FREE(old_target, PATH_MAX);
-                                old_target = NULL;
-                                old_targetlen = 0;
-                        }
-                        set_fs(old_fs);
-                }
-
-                do_kml = presto_do_kml(info, dir);
-                do_rcvd = presto_do_rcvd(info, dir);
-                error = iops->unlink(dir->d_inode, dentry);
-                unlock_kernel();
-        }
-
-        if (linkno > 1) { 
-                /* FIXME: Combine this with the next call? */
-                error = presto_settime(fset, NULL, NULL, dentry,
-                                       info, ATTR_CTIME);
-                dput(dentry); 
-                if (error) { 
-                        EXIT;
-                        goto exit;
-                }
-        }
-
-        error = presto_settime(fset, NULL, NULL, dir,
-                               info, ATTR_CTIME | ATTR_MTIME);
-        if (error) { 
-                EXIT;
-                goto exit;
-        }
-
-        //        up(&dir->d_inode->i_zombie);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_UNLINK | 0x10);
-        if ( do_kml )
-                error = presto_journal_unlink(&rec, fset, dir, &tgt_dir_ver,
-                                              &old_file_ver, &rb, dentry,
-                                              old_target, old_targetlen);
-        presto_debug_fail_blkdev(fset, KML_OPCODE_UNLINK | 0x20);
-        if ( do_rcvd ) { 
-                error = presto_write_last_rcvd(&rec, fset, info);
-        }
-        presto_debug_fail_blkdev(fset, KML_OPCODE_UNLINK | 0x30);
-        EXIT;
-exit:
-        presto_release_space(fset->fset_cache, PRESTO_REQLOW); 
-        presto_trans_commit(fset, handle);
-        if (old_target != NULL)
-                PRESTO_FREE(old_target, PATH_MAX);
-        return error;
-}
-
-
-int lento_unlink(const char *pathname, struct lento_vfs_context *info)
-{
-        int error = 0;
-        char * name;
-        struct dentry *dentry;
-        struct nameidata nd;
-        struct presto_file_set *fset;
-
-        ENTRY;
-
-        name = getname(pathname);
-        if(IS_ERR(name))
-                return PTR_ERR(name);
-
-        error = path_lookup(name, LOOKUP_PARENT, &nd);
-        if (error)
-                goto exit;
-        error = -EISDIR;
-        if (nd.last_type != LAST_NORM)
-                goto exit1;
-        down(&nd.dentry->d_inode->i_sem);
-        dentry = lookup_hash(&nd.last, nd.dentry);
-        error = PTR_ERR(dentry);
-        if (!IS_ERR(dentry)) {
-                fset = presto_fset(dentry);
-                error = -EINVAL;
-                if ( !fset ) {
-                        CERROR("No fileset!\n");
-                        EXIT;
-                        goto exit2;
-                }
-                /* Why not before? Because we want correct error value */
-                if (nd.last.name[nd.last.len])
-                        goto slashes;
-                error = presto_do_unlink(fset, nd.dentry, dentry, info);
-                if (!error)
-                        d_delete(dentry);
-        exit2:
-                EXIT;
-                dput(dentry);
-        }
-        up(&nd.dentry->d_inode->i_sem);
-exit1:
-        path_release(&nd);
-exit:
-        putname(name);
-
-        return error;
-
-slashes:
-        error = !dentry->d_inode ? -ENOENT :
-                S_ISDIR(dentry->d_inode->i_mode) ? -EISDIR : -ENOTDIR;
-        goto exit2;
-}
-
-int presto_do_symlink(struct presto_file_set *fset, struct dentry *dir,
-                      struct dentry *dentry, const char *oldname,
-                      struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        int error;
-        struct presto_version tgt_dir_ver, new_link_ver;
-        struct inode_operations *iops;
-        void *handle;
-
-        ENTRY;
-        //        down(&dir->d_inode->i_zombie);
-        /* record + max path len + space to free */ 
-        error = presto_reserve_space(fset->fset_cache, PRESTO_REQHIGH + 4096); 
-        if (error) {
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return error;
-        }
-
-        error = may_create(dir->d_inode, dentry);
-        if (error) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        error = -EPERM;
-        iops = filter_c2cdiops(fset->fset_cache->cache_filter);
-        if (!iops->symlink) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        presto_getversion(&tgt_dir_ver, dir->d_inode);
-        handle = presto_trans_start(fset, dir->d_inode, KML_OPCODE_SYMLINK);
-        if ( IS_ERR(handle) ) {
-                presto_release_space(fset->fset_cache, PRESTO_REQHIGH + 4096); 
-                CERROR("ERROR: presto_do_symlink: no space for transaction. Tell Peter.\n"); 
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return -ENOSPC;
-        }
-        DQUOT_INIT(dir->d_inode);
-        lock_kernel();
-        error = iops->symlink(dir->d_inode, dentry, oldname);
-        if (error) {
-                EXIT;
-                goto exit;
-        }
-
-        if (dentry->d_inode) {
-                struct presto_cache *cache = fset->fset_cache;
-                
-                presto_set_ops(dentry->d_inode, cache->cache_filter);
-
-                filter_setup_dentry_ops(cache->cache_filter, dentry->d_op, 
-                                        &presto_dentry_ops);
-                dentry->d_op = filter_c2udops(cache->cache_filter);
-                /* XXX ? Cache state ? if Lento creates a symlink */
-                if ( ISLENTO(presto_c2m(cache)) ) {
-                        presto_set(dentry, PRESTO_ATTR);
-                } else {
-                        presto_set(dentry, PRESTO_ATTR | PRESTO_DATA);
-                }
-        }
-
-        info->flags |= LENTO_FL_TOUCH_PARENT;
-        error = presto_settime(fset, NULL, dir, dentry,
-                               info, ATTR_CTIME | ATTR_MTIME);
-        if (error) { 
-                EXIT;
-                goto exit;
-        }
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SYMLINK | 0x10);
-        presto_getversion(&new_link_ver, dentry->d_inode);
-        if ( presto_do_kml(info, dentry) )
-                error = presto_journal_symlink(&rec, fset, dentry, oldname,
-                                               &tgt_dir_ver, &new_link_ver);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SYMLINK | 0x20);
-        if ( presto_do_rcvd(info, dentry) )
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SYMLINK | 0x30);
-        EXIT;
-exit:
-        unlock_kernel();
-        presto_trans_commit(fset, handle);
- exit_lock:
-        presto_release_space(fset->fset_cache, PRESTO_REQHIGH + 4096); 
-        //        up(&dir->d_inode->i_zombie);
-        return error;
-}
-
-int lento_symlink(const char *oldname, const char *newname,
-                  struct lento_vfs_context *info)
-{
-        int error;
-        char *from;
-        char *to;
-        struct dentry *dentry;
-        struct presto_file_set *fset;
-        struct nameidata nd;
-
-        ENTRY;
-        lock_kernel();
-        from = getname(oldname);
-        error = PTR_ERR(from);
-        if (IS_ERR(from)) {
-                EXIT;
-                goto exit;
-        }
-
-        to = getname(newname);
-        error = PTR_ERR(to);
-        if (IS_ERR(to)) {
-                EXIT;
-                goto exit_from;
-        }
-
-        error = path_lookup(to, LOOKUP_PARENT, &nd);
-        if (error) {
-                EXIT;
-                goto exit_to;
-        }
-
-        dentry = lookup_create(&nd, 0);
-        error = PTR_ERR(dentry);
-        if (IS_ERR(dentry)) {
-                path_release(&nd);
-                EXIT;
-                goto exit_to;
-        }
-
-        fset = presto_fset(dentry);
-        error = -EINVAL;
-        if ( !fset ) {
-                CERROR("No fileset!\n");
-                path_release(&nd);
-                EXIT;
-                goto exit_lock;
-        }
-        error = presto_do_symlink(fset, nd.dentry,
-                                  dentry, from, info);
-        path_release(&nd);
-        EXIT;
- exit_lock:
-        up(&nd.dentry->d_inode->i_sem);
-        dput(dentry);
- exit_to:
-        putname(to);
- exit_from:
-        putname(from);
- exit:
-        unlock_kernel();
-        return error;
-}
-
-int presto_do_mkdir(struct presto_file_set *fset, struct dentry *dir,
-                    struct dentry *dentry, int mode,
-                    struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        int error;
-        struct presto_version tgt_dir_ver, new_dir_ver;
-        void *handle;
-
-        ENTRY;
-        //        down(&dir->d_inode->i_zombie);
-
-        /* one journal record + directory block + room for removals*/ 
-        error = presto_reserve_space(fset->fset_cache, PRESTO_REQHIGH + 4096); 
-        if (error) { 
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return error;
-        }
-
-        error = may_create(dir->d_inode, dentry);
-        if (error) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        error = -EPERM;
-        if (!filter_c2cdiops(fset->fset_cache->cache_filter)->mkdir) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        error = -ENOSPC;
-        presto_getversion(&tgt_dir_ver, dir->d_inode);
-        handle = presto_trans_start(fset, dir->d_inode, KML_OPCODE_MKDIR);
-        if ( IS_ERR(handle) ) {
-                presto_release_space(fset->fset_cache, PRESTO_REQHIGH + 4096); 
-                CERROR("presto_do_mkdir: no space for transaction\n");
-                goto exit_lock;
-        }
-
-        DQUOT_INIT(dir->d_inode);
-        mode &= (S_IRWXUGO|S_ISVTX);
-        lock_kernel();
-        error = filter_c2cdiops(fset->fset_cache->cache_filter)->mkdir(dir->d_inode, dentry, mode);
-        if (error) {
-                EXIT;
-                goto exit;
-        }
-
-        if ( dentry->d_inode && !error) {
-                struct presto_cache *cache = fset->fset_cache;
-
-                presto_set_ops(dentry->d_inode, cache->cache_filter);
-
-                filter_setup_dentry_ops(cache->cache_filter, 
-                                        dentry->d_op, 
-                                        &presto_dentry_ops);
-                dentry->d_op = filter_c2udops(cache->cache_filter);
-                /* if Lento does this, we won't have data */
-                if ( ISLENTO(presto_c2m(cache)) ) {
-                        presto_set(dentry, PRESTO_ATTR);
-                } else {
-                        presto_set(dentry, PRESTO_ATTR | PRESTO_DATA);
-                }
-        }
-
-        info->flags |= LENTO_FL_TOUCH_PARENT;
-        error = presto_settime(fset, NULL, dir, dentry,
-                             info, ATTR_CTIME | ATTR_MTIME);
-        if (error) { 
-                EXIT;
-                goto exit;
-        }
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_MKDIR | 0x10);
-        presto_getversion(&new_dir_ver, dentry->d_inode);
-        if ( presto_do_kml(info, dir) )
-                error = presto_journal_mkdir(&rec, fset, dentry, &tgt_dir_ver,
-                                             &new_dir_ver, 
-                                             dentry->d_inode->i_mode);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_MKDIR | 0x20);
-        if ( presto_do_rcvd(info, dentry) )
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_MKDIR | 0x30);
-        EXIT;
-exit:
-        unlock_kernel();
-        presto_trans_commit(fset, handle);
- exit_lock:
-        presto_release_space(fset->fset_cache, PRESTO_REQHIGH + 4096); 
-        //        up(&dir->d_inode->i_zombie);
-        return error;
-}
-
-/*
- * Look out: this function may change a normal dentry
- * into a directory dentry (different size)..
- */
-int lento_mkdir(const char *name, int mode, struct lento_vfs_context *info)
-{
-        int error;
-        char *pathname;
-        struct dentry *dentry;
-        struct presto_file_set *fset;
-        struct nameidata nd;
-
-        ENTRY;
-        CDEBUG(D_PIOCTL, "name: %s, mode %o, offset %d, recno %d, flags %x\n",
-               name, mode, info->slot_offset, info->recno, info->flags);
-        pathname = getname(name);
-        error = PTR_ERR(pathname);
-        if (IS_ERR(pathname)) {
-                EXIT;
-                return error;
-        }
-
-        error = path_lookup(pathname, LOOKUP_PARENT, &nd);
-        if (error)
-                goto out_name;
-
-        dentry = lookup_create(&nd, 1);
-        error = PTR_ERR(dentry);
-        if (!IS_ERR(dentry)) {
-                fset = presto_fset(dentry);
-                error = -EINVAL;
-                if (!fset) {
-                        CERROR("No fileset!\n");
-                        EXIT;
-                        goto out_dput;
-                }
-
-                error = presto_do_mkdir(fset, nd.dentry, dentry, 
-                                        mode & S_IALLUGO, info);
-out_dput:
-                dput(dentry);
-        }
-        up(&nd.dentry->d_inode->i_sem);
-        path_release(&nd);
-out_name:
-        EXIT;
-        putname(pathname);
-        CDEBUG(D_PIOCTL, "error: %d\n", error);
-        return error;
-}
-
-static void d_unhash(struct dentry *dentry)
-{
-        dget(dentry);
-        switch (atomic_read(&dentry->d_count)) {
-        default:
-                shrink_dcache_parent(dentry);
-                if (atomic_read(&dentry->d_count) != 2)
-                        break;
-        case 2:
-                d_drop(dentry);
-        }
-}
-
-int presto_do_rmdir(struct presto_file_set *fset, struct dentry *dir,
-                    struct dentry *dentry, struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        int error;
-        struct presto_version tgt_dir_ver, old_dir_ver;
-        struct izo_rollback_data rb;
-        struct inode_operations *iops;
-        void *handle;
-        int do_kml, do_rcvd;
-        int size;
-
-        ENTRY;
-        error = may_delete(dir->d_inode, dentry, 1);
-        if (error)
-                return error;
-
-        error = -EPERM;
-        iops = filter_c2cdiops(fset->fset_cache->cache_filter);
-        if (!iops->rmdir) {
-                EXIT;
-                return error;
-        }
-
-        size = PRESTO_REQHIGH - dentry->d_inode->i_size; 
-        error = presto_reserve_space(fset->fset_cache, size); 
-        if (error) { 
-                EXIT;
-                return error;
-        }
-
-        presto_getversion(&tgt_dir_ver, dir->d_inode);
-        presto_getversion(&old_dir_ver, dentry->d_inode);
-        izo_get_rollback_data(dentry->d_inode, &rb);
-        handle = presto_trans_start(fset, dir->d_inode, KML_OPCODE_RMDIR);
-        if ( IS_ERR(handle) ) {
-                presto_release_space(fset->fset_cache, size); 
-                CERROR("ERROR: presto_do_rmdir: no space for transaction. Tell Peter.\n");
-                return -ENOSPC;
-        }
-
-        DQUOT_INIT(dir->d_inode);
-
-        do_kml = presto_do_kml(info, dir);
-        do_rcvd = presto_do_rcvd(info, dir);
-
-        //        double_down(&dir->d_inode->i_zombie, &dentry->d_inode->i_zombie);
-        d_unhash(dentry);
-        if (IS_DEADDIR(dir->d_inode))
-                error = -ENOENT;
-        else if (d_mountpoint(dentry)) {
-                CERROR("foo: d_mountpoint(dentry): ino %ld\n",
-                       dentry->d_inode->i_ino);
-                error = -EBUSY;
-        } else {
-                lock_kernel();
-                error = iops->rmdir(dir->d_inode, dentry);
-                unlock_kernel();
-                if (!error) {
-                        dentry->d_inode->i_flags |= S_DEAD;
-                        error = presto_settime(fset, NULL, NULL, dir, info,
-                                               ATTR_CTIME | ATTR_MTIME);
-                }
-        }
-        //        double_up(&dir->d_inode->i_zombie, &dentry->d_inode->i_zombie);
-        if (!error)
-                d_delete(dentry);
-        dput(dentry);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_RMDIR | 0x10);
-        if ( !error && do_kml )
-                error = presto_journal_rmdir(&rec, fset, dir, &tgt_dir_ver,
-                                             &old_dir_ver, &rb,
-                                             dentry->d_name.len,
-                                             dentry->d_name.name);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_RMDIR | 0x20);
-        if ( !error && do_rcvd ) 
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_RMDIR | 0x30);
-        EXIT;
-
-        presto_trans_commit(fset, handle);
-        presto_release_space(fset->fset_cache, size); 
-        return error;
-}
-
-int lento_rmdir(const char *pathname, struct lento_vfs_context *info)
-{
-        int error = 0;
-        char * name;
-        struct dentry *dentry;
-        struct presto_file_set *fset;
-        struct nameidata nd;
-
-        ENTRY;
-        name = getname(pathname);
-        if(IS_ERR(name)) {
-                EXIT;
-                return PTR_ERR(name);
-        }
-
-        error = path_lookup(name, LOOKUP_PARENT, &nd);
-        if (error) {
-                EXIT;
-                goto exit;
-        }
-        switch(nd.last_type) {
-        case LAST_DOTDOT:
-                error = -ENOTEMPTY;
-                EXIT;
-                goto exit1;
-        case LAST_ROOT:
-        case LAST_DOT:
-                error = -EBUSY;
-                EXIT;
-                goto exit1;
-        }
-        down(&nd.dentry->d_inode->i_sem);
-        dentry = lookup_hash(&nd.last, nd.dentry);
-        error = PTR_ERR(dentry);
-        if (!IS_ERR(dentry)) {
-                fset = presto_fset(dentry);
-                error = -EINVAL;
-                if ( !fset ) {
-                        CERROR("No fileset!\n");
-                        EXIT;
-                        goto exit_put;
-                }
-                error = presto_do_rmdir(fset, nd.dentry, dentry, info);
-        exit_put:
-                dput(dentry);
-        }
-        up(&nd.dentry->d_inode->i_sem);
-exit1:
-        path_release(&nd);
-exit:
-        putname(name);
-        EXIT;
-        return error;
-}
-
-int presto_do_mknod(struct presto_file_set *fset, struct dentry *dir,
-                    struct dentry *dentry, int mode, dev_t dev,
-                    struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        int error = -EPERM;
-        struct presto_version tgt_dir_ver, new_node_ver;
-        struct inode_operations *iops;
-        void *handle;
-
-        ENTRY;
-
-        //        down(&dir->d_inode->i_zombie);
-        /* one KML entry */ 
-        error = presto_reserve_space(fset->fset_cache, PRESTO_REQHIGH); 
-        if (error) {
-                EXIT;
-                //                up(&dir->d_inode->i_zombie);
-                return error;
-        }
-
-        if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD)) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        error = may_create(dir->d_inode, dentry);
-        if (error) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        error = -EPERM;
-        iops = filter_c2cdiops(fset->fset_cache->cache_filter);
-        if (!iops->mknod) {
-                EXIT;
-                goto exit_lock;
-        }
-
-        DQUOT_INIT(dir->d_inode);
-        lock_kernel();
-        
-        error = -ENOSPC;
-        presto_getversion(&tgt_dir_ver, dir->d_inode);
-        handle = presto_trans_start(fset, dir->d_inode, KML_OPCODE_MKNOD);
-        if ( IS_ERR(handle) ) {
-                presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-                CERROR("presto_do_mknod: no space for transaction\n");
-                goto exit_lock2;
-        }
-
-        error = iops->mknod(dir->d_inode, dentry, mode, dev);
-        if (error) {
-                EXIT;
-                goto exit_commit;
-        }
-        if ( dentry->d_inode) {
-                struct presto_cache *cache = fset->fset_cache;
-
-                presto_set_ops(dentry->d_inode, cache->cache_filter);
-
-                filter_setup_dentry_ops(cache->cache_filter, dentry->d_op, 
-                                        &presto_dentry_ops);
-                dentry->d_op = filter_c2udops(cache->cache_filter);
-
-                /* if Lento does this, we won't have data */
-                if ( ISLENTO(presto_c2m(cache)) ) {
-                        presto_set(dentry, PRESTO_ATTR);
-                } else {
-                        presto_set(dentry, PRESTO_ATTR | PRESTO_DATA);
-                }
-        }
-
-        error = presto_settime(fset, NULL, NULL, dir,
-                               info, ATTR_MTIME);
-        if (error) { 
-                EXIT;
-        }
-        error = presto_settime(fset, NULL, NULL, dentry,
-                               info, ATTR_CTIME | ATTR_MTIME);
-        if (error) { 
-                EXIT;
-        }
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_MKNOD | 0x10);
-        presto_getversion(&new_node_ver, dentry->d_inode);
-        if ( presto_do_kml(info, dentry) )
-                error = presto_journal_mknod(&rec, fset, dentry, &tgt_dir_ver,
-                                             &new_node_ver, 
-                                             dentry->d_inode->i_mode,
-                                             MAJOR(dev), MINOR(dev) );
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_MKNOD | 0x20);
-        if ( presto_do_rcvd(info, dentry) )
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_MKNOD | 0x30);
-        EXIT;
- exit_commit:
-        presto_trans_commit(fset, handle);
- exit_lock2:
-        unlock_kernel();
- exit_lock:
-        presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-        //        up(&dir->d_inode->i_zombie);
-        return error;
-}
-
-int lento_mknod(const char *filename, int mode, dev_t dev,
-                struct lento_vfs_context *info)
-{
-        int error = 0;
-        char * tmp;
-        struct dentry * dentry;
-        struct nameidata nd;
-        struct presto_file_set *fset;
-
-        ENTRY;
-
-        if (S_ISDIR(mode))
-                return -EPERM;
-        tmp = getname(filename);
-        if (IS_ERR(tmp))
-                return PTR_ERR(tmp);
-
-        error = path_lookup(tmp, LOOKUP_PARENT, &nd);
-        if (error)
-                goto out;
-        dentry = lookup_create(&nd, 0);
-        error = PTR_ERR(dentry);
-        if (!IS_ERR(dentry)) {
-                fset = presto_fset(dentry);
-                error = -EINVAL;
-                if ( !fset ) {
-                        CERROR("No fileset!\n");
-                        EXIT;
-                        goto exit_put;
-                }
-                switch (mode & S_IFMT) {
-                case 0: case S_IFREG:
-                        error = -EOPNOTSUPP;
-                        break;
-                case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
-                        error = presto_do_mknod(fset, nd.dentry, dentry, 
-                                                mode, dev, info);
-                        break;
-                case S_IFDIR:
-                        error = -EPERM;
-                        break;
-                default:
-                        error = -EINVAL;
-                }
-        exit_put:
-                dput(dentry);
-        }
-        up(&nd.dentry->d_inode->i_sem);
-        path_release(&nd);
-out:
-        putname(tmp);
-
-        return error;
-}
-
-int do_rename(struct presto_file_set *fset,
-                     struct dentry *old_parent, struct dentry *old_dentry,
-                     struct dentry *new_parent, struct dentry *new_dentry,
-                     struct lento_vfs_context *info)
-{
-        struct rec_info rec;
-        int error;
-        struct inode_operations *iops;
-        struct presto_version src_dir_ver, tgt_dir_ver;
-        void *handle;
-        int new_inode_unlink = 0;
-        struct inode *old_dir = old_parent->d_inode;
-        struct inode *new_dir = new_parent->d_inode;
-
-        ENTRY;
-        presto_getversion(&src_dir_ver, old_dir);
-        presto_getversion(&tgt_dir_ver, new_dir);
-
-        error = -EPERM;
-        iops = filter_c2cdiops(fset->fset_cache->cache_filter);
-        if (!iops || !iops->rename) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_reserve_space(fset->fset_cache, PRESTO_REQHIGH); 
-        if (error) {
-                EXIT;
-                return error;
-        }
-        handle = presto_trans_start(fset, old_dir, KML_OPCODE_RENAME);
-        if ( IS_ERR(handle) ) {
-                presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-                CERROR("presto_do_rename: no space for transaction\n");
-                return -ENOSPC;
-        }
-        if (new_dentry->d_inode && new_dentry->d_inode->i_nlink > 1) { 
-                dget(new_dentry); 
-                new_inode_unlink = 1;
-        }
-
-        error = iops->rename(old_dir, old_dentry, new_dir, new_dentry);
-
-        if (error) {
-                EXIT;
-                goto exit;
-        }
-
-        if (new_inode_unlink) { 
-                error = presto_settime(fset, NULL, NULL, old_dentry,
-                                       info, ATTR_CTIME);
-                dput(old_dentry); 
-                if (error) { 
-                        EXIT;
-                        goto exit;
-                }
-        }
-        info->flags |= LENTO_FL_TOUCH_PARENT;
-        error = presto_settime(fset, NULL, new_parent, old_parent,
-                               info, ATTR_CTIME | ATTR_MTIME);
-        if (error) { 
-                EXIT;
-                goto exit;
-        }
-
-        /* XXX make a distinction between cross file set
-         * and intra file set renames here
-         */
-        presto_debug_fail_blkdev(fset, KML_OPCODE_RENAME | 0x10);
-        if ( presto_do_kml(info, old_dentry) )
-                error = presto_journal_rename(&rec, fset, old_dentry,
-                                              new_dentry,
-                                              &src_dir_ver, &tgt_dir_ver);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_RENAME | 0x20);
-
-        if ( presto_do_rcvd(info, old_dentry) )
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_RENAME | 0x30);
-        EXIT;
-exit:
-        presto_trans_commit(fset, handle);
-        presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-        return error;
-}
-
-static
-int presto_rename_dir(struct presto_file_set *fset, struct dentry *old_parent,
-                      struct dentry *old_dentry, struct dentry *new_parent,
-                      struct dentry *new_dentry, struct lento_vfs_context *info)
-{
-        int error;
-        struct inode *target;
-        struct inode *old_dir = old_parent->d_inode;
-        struct inode *new_dir = new_parent->d_inode;
-
-        if (old_dentry->d_inode == new_dentry->d_inode)
-                return 0;
-
-        error = may_delete(old_dir, old_dentry, 1);
-        if (error)
-                return error;
-
-        if (new_dir->i_sb != old_dir->i_sb)
-                return -EXDEV;
-
-        if (!new_dentry->d_inode)
-                error = may_create(new_dir, new_dentry);
-        else
-                error = may_delete(new_dir, new_dentry, 1);
-        if (error)
-                return error;
-
-        if (!old_dir->i_op || !old_dir->i_op->rename)
-                return -EPERM;
-
-        /*
-         * If we are going to change the parent - check write permissions,
-         * we'll need to flip '..'.
-         */
-        if (new_dir != old_dir) {
-                error = permission(old_dentry->d_inode, MAY_WRITE, NULL);
-        }
-        if (error)
-                return error;
-
-        DQUOT_INIT(old_dir);
-        DQUOT_INIT(new_dir);
-        down(&old_dir->i_sb->s_vfs_rename_sem);
-        error = -EINVAL;
-        if (is_subdir(new_dentry, old_dentry))
-                goto out_unlock;
-        target = new_dentry->d_inode;
-        if (target) { /* Hastur! Hastur! Hastur! */
-                //                triple_down(&old_dir->i_zombie,
-                //                            &new_dir->i_zombie,
-                //                            &target->i_zombie);
-                d_unhash(new_dentry);
-        } else
-                //                double_down(&old_dir->i_zombie,
-                //                            &new_dir->i_zombie);
-        if (IS_DEADDIR(old_dir)||IS_DEADDIR(new_dir))
-                error = -ENOENT;
-        else if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry))
-                error = -EBUSY;
-        else 
-                error = do_rename(fset, old_parent, old_dentry,
-                                         new_parent, new_dentry, info);
-        if (target) {
-                if (!error)
-                        target->i_flags |= S_DEAD;
-                //                triple_up(&old_dir->i_zombie,
-                //                          &new_dir->i_zombie,
-                //                          &target->i_zombie);
-                if (d_unhashed(new_dentry))
-                        d_rehash(new_dentry);
-                dput(new_dentry);
-        } else
-                //                double_up(&old_dir->i_zombie,
-                //                          &new_dir->i_zombie);
-                
-        if (!error)
-                d_move(old_dentry,new_dentry);
-out_unlock:
-        up(&old_dir->i_sb->s_vfs_rename_sem);
-        return error;
-}
-
-static
-int presto_rename_other(struct presto_file_set *fset, struct dentry *old_parent,
-                        struct dentry *old_dentry, struct dentry *new_parent,
-                        struct dentry *new_dentry, struct lento_vfs_context *info)
-{
-        struct inode *old_dir = old_parent->d_inode;
-        struct inode *new_dir = new_parent->d_inode;
-        int error;
-
-        if (old_dentry->d_inode == new_dentry->d_inode)
-                return 0;
-
-        error = may_delete(old_dir, old_dentry, 0);
-        if (error)
-                return error;
-
-        if (new_dir->i_sb != old_dir->i_sb)
-                return -EXDEV;
-
-        if (!new_dentry->d_inode)
-                error = may_create(new_dir, new_dentry);
-        else
-                error = may_delete(new_dir, new_dentry, 0);
-        if (error)
-                return error;
-
-        if (!old_dir->i_op || !old_dir->i_op->rename)
-                return -EPERM;
-
-        DQUOT_INIT(old_dir);
-        DQUOT_INIT(new_dir);
-        //        double_down(&old_dir->i_zombie, &new_dir->i_zombie);
-        if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry))
-                error = -EBUSY;
-        else
-                error = do_rename(fset, old_parent, old_dentry,
-                                  new_parent, new_dentry, info);
-        //        double_up(&old_dir->i_zombie, &new_dir->i_zombie);
-        if (error)
-                return error;
-        /* The following d_move() should become unconditional */
-        if (!(old_dir->i_sb->s_type->fs_flags & FS_ODD_RENAME)) {
-                d_move(old_dentry, new_dentry);
-        }
-        return 0;
-}
-
-int presto_do_rename(struct presto_file_set *fset, 
-              struct dentry *old_parent, struct dentry *old_dentry,
-              struct dentry *new_parent, struct dentry *new_dentry,
-              struct lento_vfs_context *info)
-{
-        if (S_ISDIR(old_dentry->d_inode->i_mode))
-                return presto_rename_dir(fset, old_parent,old_dentry,new_parent,
-                                      new_dentry, info);
-        else
-                return presto_rename_other(fset, old_parent, old_dentry,
-                                           new_parent,new_dentry, info);
-}
-
-
-int lento_do_rename(const char *oldname, const char *newname,
-                 struct lento_vfs_context *info)
-{
-        int error = 0;
-        struct dentry * old_dir, * new_dir;
-        struct dentry * old_dentry, *new_dentry;
-        struct nameidata oldnd, newnd;
-        struct presto_file_set *fset;
-
-        ENTRY;
-
-        error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
-        if (error)
-                goto exit;
-
-        error = path_lookup(newname, LOOKUP_PARENT, &newnd);
-        if (error)
-                goto exit1;
-
-        error = -EXDEV;
-        if (oldnd.mnt != newnd.mnt)
-                goto exit2;
-
-        old_dir = oldnd.dentry;
-        error = -EBUSY;
-        if (oldnd.last_type != LAST_NORM)
-                goto exit2;
-
-        new_dir = newnd.dentry;
-        if (newnd.last_type != LAST_NORM)
-                goto exit2;
-
-        lock_rename(new_dir, old_dir);
-
-        old_dentry = lookup_hash(&oldnd.last, old_dir);
-        error = PTR_ERR(old_dentry);
-        if (IS_ERR(old_dentry))
-                goto exit3;
-        /* source must exist */
-        error = -ENOENT;
-        if (!old_dentry->d_inode)
-                goto exit4;
-        fset = presto_fset(old_dentry);
-        error = -EINVAL;
-        if ( !fset ) {
-                CERROR("No fileset!\n");
-                EXIT;
-                goto exit4;
-        }
-        /* unless the source is a directory trailing slashes give -ENOTDIR */
-        if (!S_ISDIR(old_dentry->d_inode->i_mode)) {
-                error = -ENOTDIR;
-                if (oldnd.last.name[oldnd.last.len])
-                        goto exit4;
-                if (newnd.last.name[newnd.last.len])
-                        goto exit4;
-        }
-        new_dentry = lookup_hash(&newnd.last, new_dir);
-        error = PTR_ERR(new_dentry);
-        if (IS_ERR(new_dentry))
-                goto exit4;
-
-        lock_kernel();
-        error = presto_do_rename(fset, old_dir, old_dentry,
-                                   new_dir, new_dentry, info);
-        unlock_kernel();
-
-        dput(new_dentry);
-exit4:
-        dput(old_dentry);
-exit3:
-        unlock_rename(new_dir, old_dir);
-exit2:
-        path_release(&newnd);
-exit1:
-        path_release(&oldnd);
-exit:
-        return error;
-}
-
-int  lento_rename(const char * oldname, const char * newname,
-                  struct lento_vfs_context *info)
-{
-        int error;
-        char * from;
-        char * to;
-
-        from = getname(oldname);
-        if(IS_ERR(from))
-                return PTR_ERR(from);
-        to = getname(newname);
-        error = PTR_ERR(to);
-        if (!IS_ERR(to)) {
-                error = lento_do_rename(from,to, info);
-                putname(to);
-        } 
-        putname(from);
-        return error;
-}
-
-struct dentry *presto_iopen(struct dentry *dentry,
-                            ino_t ino, unsigned int generation)
-{
-        struct presto_file_set *fset;
-        char name[48];
-        int error;
-
-        ENTRY;
-        /* see if we already have the dentry we want */
-        if (dentry->d_inode && dentry->d_inode->i_ino == ino &&
-            dentry->d_inode->i_generation == generation) {
-                EXIT;
-                return dentry;
-        }
-
-        /* Make sure we have a cache beneath us.  We should always find at
-         * least one dentry inside the cache (if it exists), otherwise not
-         * even the cache root exists, or we passed in a bad name.
-         */
-        fset = presto_fset(dentry);
-        error = -EINVAL;
-        if (!fset) {
-                CERROR("No fileset for %*s!\n",
-                       dentry->d_name.len, dentry->d_name.name);
-                EXIT;
-                dput(dentry);
-                return ERR_PTR(error);
-        }
-        dput(dentry);
-
-        sprintf(name, "%s%#lx%c%#x",
-                PRESTO_ILOOKUP_MAGIC, ino, PRESTO_ILOOKUP_SEP, generation);
-        CDEBUG(D_PIOCTL, "opening %ld by number (as %s)\n", ino, name);
-        return lookup_one_len(name, fset->fset_dentry, strlen(name));
-}
-
-static struct file *presto_filp_dopen(struct dentry *dentry, int flags)
-{
-        struct file *f;
-        struct inode *inode;
-        int flag, error;
-
-        ENTRY;
-        error = -ENFILE;
-        f = get_empty_filp();
-        if (!f) {
-                CDEBUG(D_PIOCTL, "error getting file pointer\n");
-                EXIT;
-                goto out;
-        }
-        f->f_flags = flag = flags;
-        f->f_mode = (flag+1) & O_ACCMODE;
-        inode = dentry->d_inode;
-        if (f->f_mode & FMODE_WRITE) {
-                error = get_write_access(inode);
-                if (error) {
-                        CDEBUG(D_PIOCTL, "error getting write access\n");
-                        EXIT;                        goto cleanup_file;
-                }
-        }
-
-	/* XXX: where the fuck is ->f_vfsmnt? */
-        f->f_dentry = dentry;
-        f->f_mapping = dentry->d_inode->i_mapping;
-        f->f_pos = 0;
-        //f->f_reada = 0;
-        f->f_op = NULL;
-        if (inode->i_op)
-                /* XXX should we set to presto ops, or leave at cache ops? */
-                f->f_op = inode->i_fop;
-        if (f->f_op && f->f_op->open) {
-                error = f->f_op->open(inode, f);
-                if (error) {
-                        CDEBUG(D_PIOCTL, "error calling cache 'open'\n");
-                        EXIT;
-                        goto cleanup_all;
-                }
-        }
-        f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
-
-        return f;
-
-cleanup_all:
-        if (f->f_mode & FMODE_WRITE)
-                put_write_access(inode);
-cleanup_file:
-        put_filp(f);
-out:
-        return ERR_PTR(error);
-}
-
-
-/* Open an inode by number.  We pass in the cache root name (or a subdirectory
- * from the cache that is guaranteed to exist) to be able to access the cache.
- */
-int lento_iopen(const char *name, ino_t ino, unsigned int generation,
-                int flags)
-{
-        char * tmp;
-        struct dentry *dentry;
-        struct nameidata nd;
-        int fd;
-        int error;
-
-        ENTRY;
-        CDEBUG(D_PIOCTL,
-               "open %s:inode %#lx (%ld), generation %x (%d), flags %d \n",
-               name, ino, ino, generation, generation, flags);
-        /* We don't allow creation of files by number only, as it would
-         * lead to a dangling files not in any directory.  We could also
-         * just turn off the flag and ignore it.
-         */
-        if (flags & O_CREAT) {
-                CERROR("%s: create file by inode number (%ld) not allowed\n",
-                       __FUNCTION__, ino);
-                EXIT;
-                return -EACCES;
-        }
-
-        tmp = getname(name);
-        if (IS_ERR(tmp)) {
-                EXIT;
-                return PTR_ERR(tmp);
-        }
-
-        lock_kernel();
-again:  /* look the named file or a parent directory so we can get the cache */
-        error = presto_walk(tmp, &nd);
-        if ( error && error != -ENOENT ) {
-                EXIT;
-                unlock_kernel();
-		putname(tmp);
-                return error;
-        } 
-        if (error == -ENOENT)
-                dentry = NULL;
-        else 
-                dentry = nd.dentry;
-
-        /* we didn't find the named file, so see if a parent exists */
-        if (!dentry) {
-                char *slash;
-
-                slash = strrchr(tmp, '/');
-                if (slash && slash != tmp) {
-                        *slash = '\0';
-                        path_release(&nd);
-                        goto again;
-                }
-                /* we should never get here... */
-                CDEBUG(D_PIOCTL, "no more path components to try!\n");
-                fd = -ENOENT;
-                goto exit;
-        }
-        CDEBUG(D_PIOCTL, "returned dentry %p\n", dentry);
-
-        dentry = presto_iopen(dentry, ino, generation);
-        fd = PTR_ERR(dentry);
-        if (IS_ERR(dentry)) {
-                EXIT;
-                goto exit;
-        }
-
-        /* XXX start of code that might be replaced by something like:
-         * if (flags & (O_WRONLY | O_RDWR)) {
-         *      error = get_write_access(dentry->d_inode);
-         *      if (error) {
-         *              EXIT;
-         *              goto cleanup_dput;
-         *      }
-         * }
-         * fd = open_dentry(dentry, flags);
-         *
-         * including the presto_filp_dopen() function (check dget counts!)
-         */
-        fd = get_unused_fd();
-        if (fd < 0) {
-                EXIT;
-                goto exit;
-        }
-
-        {
-                int error;
-                struct file * f = presto_filp_dopen(dentry, flags);
-                error = PTR_ERR(f);
-                if (IS_ERR(f)) {
-                        put_unused_fd(fd);
-                        fd = error;
-                } else {
-	                fd_install(fd, f);
-		}
-        }
-        /* end of code that might be replaced by open_dentry */
-
-        EXIT;
-exit:
-        unlock_kernel();
-        path_release(&nd);
-        putname(tmp);
-        return fd;
-}
-
-#ifdef CONFIG_FS_EXT_ATTR
-
-#if 0 /* was a broken check for Posix ACLs */
-/* Posix ACL code changes i_mode without using a notify_change (or
- * a mark_inode_dirty!). We need to duplicate this at the reintegrator
- * which is done by this function. This function also takes care of 
- * resetting the cached posix acls in this inode. If we don't reset these
- * VFS continues using the old acl information, which by now may be out of
- * date.
- */
-int presto_setmode(struct presto_file_set *fset, struct dentry *dentry,
-                   mode_t mode)
-{
-        struct inode *inode = dentry->d_inode;
-
-        ENTRY;
-        /* The extended attributes for this inode were modified. 
-         * At this point we can not be sure if any of the ACL 
-         * information for this inode was updated. So we will 
-         * force VFS to reread the acls. Note that we do this 
-         * only when called from the SETEXTATTR ioctl, which is why we
-         * do this while setting the mode of the file. Also note
-         * that mark_inode_dirty is not be needed for i_*acl only
-         * to force i_mode info to disk, and should be removed once
-         * we use notify_change to update the mode.
-         * XXX: is mode setting really needed? Just setting acl's should
-         * be enough! VFS should change the i_mode as needed? SHP
-         */
-        if (inode->i_acl && 
-            inode->i_acl != POSIX_ACL_NOT_CACHED) 
-            posix_acl_release(inode->i_acl);
-        if (inode->i_default_acl && 
-            inode->i_default_acl != POSIX_ACL_NOT_CACHED) 
-            posix_acl_release(inode->i_default_acl);
-        inode->i_acl = POSIX_ACL_NOT_CACHED;
-        inode->i_default_acl = POSIX_ACL_NOT_CACHED;
-        inode->i_mode = mode;
-        /* inode should already be dirty...but just in case */
-        mark_inode_dirty(inode);
-        return 0;
-
-#if 0
-        /* XXX: The following code is the preferred way to set mode, 
-         * however, I need to carefully go through possible recursion
-         * paths back into presto. See comments in presto_do_setattr.
-         */
-        {    
-        int error=0; 
-        struct super_operations *sops;
-        struct iattr iattr;
-
-        iattr.ia_mode = mode;
-        iattr.ia_valid = ATTR_MODE|ATTR_FORCE;
-
-        error = -EPERM;
-        sops = filter_c2csops(fset->fset_cache->cache_filter); 
-        if (!sops &&
-            !sops->notify_change) {
-                EXIT;
-                return error;
-        }
-
-        error = sops->notify_change(dentry, &iattr);
-
-        EXIT;
-        return error;
-        }
-#endif
-}
-#endif
-
-/* setextattr Interface to cache filesystem */
-int presto_do_set_ext_attr(struct presto_file_set *fset, 
-                           struct dentry *dentry, 
-                           const char *name, void *buffer,
-                           size_t buffer_len, int flags, mode_t *mode,
-                           struct lento_vfs_context *info) 
-{
-        struct rec_info rec;
-        struct inode *inode = dentry->d_inode;
-        struct inode_operations *iops;
-        int error;
-        struct presto_version ver;
-        void *handle;
-        char temp[PRESTO_EXT_ATTR_NAME_MAX+1];
-
-        ENTRY;
-        error = -EROFS;
-        if (IS_RDONLY(inode)) {
-                EXIT;
-                return -EROFS;
-        }
-
-        if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
-                EXIT;
-                return -EPERM;
-        }
-
-        presto_getversion(&ver, inode);
-        error = -EPERM;
-        /* We need to invoke different filters based on whether
-         * this dentry is a regular file, directory or symlink.
-         */
-        switch (inode->i_mode & S_IFMT) {
-                case S_IFLNK: /* symlink */
-                    iops = filter_c2csiops(fset->fset_cache->cache_filter); 
-                    break;
-                case S_IFDIR: /* directory */
-                    iops = filter_c2cdiops(fset->fset_cache->cache_filter); 
-                    break;
-                case S_IFREG:
-                default: /* everything else including regular files */
-                    iops = filter_c2cfiops(fset->fset_cache->cache_filter); 
-        }
-
-        if (!iops && !iops->set_ext_attr) {
-                EXIT;
-                return error;
-        }
-
-        error = presto_reserve_space(fset->fset_cache, PRESTO_REQHIGH); 
-        if (error) {
-                EXIT;
-                return error;
-        }
-
-        
-        handle = presto_trans_start(fset,dentry->d_inode,KML_OPCODE_SETEXTATTR);
-        if ( IS_ERR(handle) ) {
-                CERROR("presto_do_set_ext_attr: no space for transaction\n");
-                presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-                return -ENOSPC;
-        }
-
-        /* We first "truncate" name to the maximum allowable in presto */
-        /* This simulates the strncpy_from_use code in fs/ext_attr.c */
-        strlcpy(temp,name,sizeof(temp));
-
-        /* Pass down to cache*/
-        error = iops->set_ext_attr(inode,temp,buffer,buffer_len,flags);
-        if (error) {
-                EXIT;
-                goto exit;
-        }
-
-#if 0 /* was a broken check for Posix ACLs */
-        /* Reset mode if specified*/
-        /* XXX: when we do native acl support, move this code out! */
-        if (mode != NULL) {
-                error = presto_setmode(fset, dentry, *mode);
-                if (error) { 
-                    EXIT;
-                    goto exit;
-                }
-        }
-#endif
-
-        /* Reset ctime. Only inode change time (ctime) is affected */
-        error = presto_settime(fset, NULL, NULL, dentry, info, ATTR_CTIME);
-        if (error) { 
-                EXIT;
-                goto exit;
-        }
-
-        if (flags & EXT_ATTR_FLAG_USER) {
-                CERROR(" USER flag passed to presto_do_set_ext_attr!\n");
-                BUG();
-        }
-
-        /* We are here, so set_ext_attr succeeded. We no longer need to keep
-         * track of EXT_ATTR_FLAG_{EXISTS,CREATE}, instead, we will force
-         * the attribute value during log replay. -SHP
-         */
-        flags &= ~(EXT_ATTR_FLAG_EXISTS | EXT_ATTR_FLAG_CREATE);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SETEXTATTR | 0x10);
-        if ( presto_do_kml(info, dentry) )
-                error = presto_journal_set_ext_attr
-                        (&rec, fset, dentry, &ver, name, buffer, 
-                         buffer_len, flags);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SETEXTATTR | 0x20);
-        if ( presto_do_rcvd(info, dentry) )
-                error = presto_write_last_rcvd(&rec, fset, info);
-
-        presto_debug_fail_blkdev(fset, KML_OPCODE_SETEXTATTR | 0x30);
-        EXIT;
-exit:
-        presto_release_space(fset->fset_cache, PRESTO_REQHIGH); 
-        presto_trans_commit(fset, handle);
-
-        return error;
-}
-#endif
diff -Nru a/fs/ioctl.c b/fs/ioctl.c
--- a/fs/ioctl.c	Tue Jun 15 22:20:37 2004
+++ b/fs/ioctl.c	Tue Jun 15 22:20:37 2004
@@ -18,6 +18,7 @@
 	int error;
 	int block;
 	struct inode * inode = filp->f_dentry->d_inode;
+	int __user *p = (int __user *)arg;
 
 	switch (cmd) {
 		case FIBMAP:
@@ -29,18 +30,18 @@
 				return -EINVAL;
 			if (!capable(CAP_SYS_RAWIO))
 				return -EPERM;
-			if ((error = get_user(block, (int *) arg)) != 0)
+			if ((error = get_user(block, p)) != 0)
 				return error;
 
 			res = mapping->a_ops->bmap(mapping, block);
-			return put_user(res, (int *) arg);
+			return put_user(res, p);
 		}
 		case FIGETBSZ:
 			if (inode->i_sb == NULL)
 				return -EBADF;
-			return put_user(inode->i_sb->s_blocksize, (int *) arg);
+			return put_user(inode->i_sb->s_blocksize, p);
 		case FIONREAD:
-			return put_user(i_size_read(inode) - filp->f_pos, (int *) arg);
+			return put_user(i_size_read(inode) - filp->f_pos, p);
 	}
 	if (filp->f_op && filp->f_op->ioctl)
 		return filp->f_op->ioctl(inode, filp, cmd, arg);
diff -Nru a/fs/isofs/inode.c b/fs/isofs/inode.c
--- a/fs/isofs/inode.c	Tue Jun 15 22:21:03 2004
+++ b/fs/isofs/inode.c	Tue Jun 15 22:21:03 2004
@@ -1207,7 +1207,7 @@
 	struct iso_directory_record * tmpde = NULL;
 	unsigned int de_len;
 	unsigned long offset;
-	int volume_seq_no, i;
+	int i;
 	struct iso_inode_info *ei = ISOFS_I(inode);
 
 	bh = sb_bread(inode->i_sb, block);
@@ -1347,9 +1347,6 @@
 		test_and_set_uid(&inode->i_uid, sbi->s_uid);
 		test_and_set_gid(&inode->i_gid, sbi->s_gid);
 	}
-
-	/* get the volume sequence number */
-	volume_seq_no = isonum_723 (de->volume_sequence_number) ;
 
 	/* Install the inode operations vector */
 	if (S_ISREG(inode->i_mode)) {
diff -Nru a/fs/jbd/commit.c b/fs/jbd/commit.c
--- a/fs/jbd/commit.c	Tue Jun 15 22:20:44 2004
+++ b/fs/jbd/commit.c	Tue Jun 15 22:20:44 2004
@@ -412,7 +412,8 @@
 			tagp = &bh->b_data[sizeof(journal_header_t)];
 			space_left = bh->b_size - sizeof(journal_header_t);
 			first_tag = 1;
-			set_bit(BH_JWrite, &bh->b_state);
+			set_buffer_jwrite(bh);
+			set_buffer_dirty(bh);
 			wbuf[bufs++] = bh;
 
 			/* Record it so that we can wait for IO
@@ -638,7 +639,8 @@
 	JBUFFER_TRACE(descriptor, "write commit block");
 	{
 		struct buffer_head *bh = jh2bh(descriptor);
-		set_buffer_uptodate(bh);
+
+		set_buffer_dirty(bh);
 		sync_dirty_buffer(bh);
 		if (unlikely(!buffer_uptodate(bh)))
 			err = -EIO;
diff -Nru a/fs/jbd/journal.c b/fs/jbd/journal.c
--- a/fs/jbd/journal.c	Tue Jun 15 22:20:37 2004
+++ b/fs/jbd/journal.c	Tue Jun 15 22:20:37 2004
@@ -585,9 +585,13 @@
  * We play buffer_head aliasing tricks to write data/metadata blocks to
  * the journal without copying their contents, but for journal
  * descriptor blocks we do need to generate bona fide buffers.
+ *
+ * After the caller of journal_get_descriptor_buffer() has finished modifying
+ * the buffer's contents they really should run flush_dcache_page(bh->b_page).
+ * But we don't bother doing that, so there will be coherency problems with
+ * mmaps of blockdevs which hold live JBD-controlled filesystems.
  */
-
-struct journal_head * journal_get_descriptor_buffer(journal_t *journal)
+struct journal_head *journal_get_descriptor_buffer(journal_t *journal)
 {
 	struct buffer_head *bh;
 	unsigned long blocknr;
@@ -599,8 +603,10 @@
 		return NULL;
 
 	bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
+	lock_buffer(bh);
 	memset(bh->b_data, 0, journal->j_blocksize);
-	bh->b_state |= (1 << BH_Dirty);
+	set_buffer_uptodate(bh);
+	unlock_buffer(bh);
 	BUFFER_TRACE(bh, "return this buffer");
 	return journal_add_journal_head(bh);
 }
diff -Nru a/fs/jbd/revoke.c b/fs/jbd/revoke.c
--- a/fs/jbd/revoke.c	Tue Jun 15 22:20:36 2004
+++ b/fs/jbd/revoke.c	Tue Jun 15 22:20:36 2004
@@ -522,7 +522,7 @@
 			kmem_cache_free(revoke_record_cache, record);
 		}
 	}
-	if (descriptor) 
+	if (descriptor)
 		flush_descriptor(journal, descriptor, offset);
 	jbd_debug(1, "Wrote %d revoke records\n", count);
 }
@@ -606,7 +606,7 @@
 	header->r_count = htonl(offset);
 	set_buffer_jwrite(bh);
 	BUFFER_TRACE(bh, "write");
-	set_buffer_uptodate(bh);
+	set_buffer_dirty(bh);
 	ll_rw_block(WRITE, 1, &bh);
 }
 #endif
diff -Nru a/fs/jbd/transaction.c b/fs/jbd/transaction.c
--- a/fs/jbd/transaction.c	Tue Jun 15 22:20:38 2004
+++ b/fs/jbd/transaction.c	Tue Jun 15 22:20:38 2004
@@ -633,12 +633,20 @@
 
 		if (jh->b_jlist == BJ_Shadow) {
 			wait_queue_head_t *wqh;
+			DEFINE_WAIT(wait);
 
 			JBUFFER_TRACE(jh, "on shadow: sleep");
 			jbd_unlock_bh_state(bh);
 			/* commit wakes up all shadow buffers after IO */
-			wqh = bh_waitq_head(jh2bh(jh));
-			wait_event(*wqh, (jh->b_jlist != BJ_Shadow));
+			wqh = bh_waitq_head(bh);
+			for ( ; ; ) {
+				prepare_to_wait(wqh, &wait,
+						TASK_UNINTERRUPTIBLE);
+				if (jh->b_jlist != BJ_Shadow)
+					break;
+				schedule();
+			}
+			finish_wait(wqh, &wait);
 			goto repeat;
 		}
 
diff -Nru a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
--- a/fs/jffs/inode-v23.c	Tue Jun 15 22:20:41 2004
+++ b/fs/jffs/inode-v23.c	Tue Jun 15 22:20:41 2004
@@ -1582,7 +1582,7 @@
 			struct jffs_fmcontrol *fmc = c->fmc;
 			printk("Flash status -- ");
 			if (!access_ok(VERIFY_WRITE,
-				       (struct jffs_flash_status *)arg,
+				       (struct jffs_flash_status __user *)arg,
 				       sizeof(struct jffs_flash_status))) {
 				D(printk("jffs_ioctl(): Bad arg in "
 					 "JFFS_GET_STATUS ioctl!\n"));
@@ -1598,7 +1598,7 @@
 			       "begin: %d, end: %d\n",
 			       fst.size, fst.used, fst.dirty,
 			       fst.begin, fst.end);
-			if (copy_to_user((struct jffs_flash_status *)arg,
+			if (copy_to_user((struct jffs_flash_status __user *)arg,
 					 &fst,
 					 sizeof(struct jffs_flash_status))) {
 				ret = -EFAULT;
diff -Nru a/fs/jffs2/Makefile b/fs/jffs2/Makefile
--- a/fs/jffs2/Makefile	Tue Jun 15 22:20:38 2004
+++ b/fs/jffs2/Makefile	Tue Jun 15 22:20:38 2004
@@ -6,16 +6,10 @@
 
 obj-$(CONFIG_JFFS2_FS) += jffs2.o
 
-COMPR_OBJS	:= compr.o compr_rubin.o compr_rtime.o compr_zlib.o
-JFFS2_OBJS	:= dir.o file.o ioctl.o nodelist.o malloc.o \
-	read.o nodemgmt.o readinode.o write.o scan.o gc.o \
-	symlink.o build.o erase.o background.o fs.o writev.o
+jffs2-y	:= compr.o compr_rubin.o compr_rtime.o compr_zlib.o
+jffs2-y	+= dir.o file.o ioctl.o nodelist.o malloc.o
+jffs2-y	+= read.o nodemgmt.o readinode.o write.o scan.o gc.o
+jffs2-y	+= symlink.o build.o erase.o background.o fs.o writev.o
+jffs2-y	+= super.o
 
-LINUX_OBJS-24	:= super-v24.o crc32.o
-LINUX_OBJS-25	:= super.o
-LINUX_OBJS-26	:= super.o
-
-NAND_OBJS-$(CONFIG_JFFS2_FS_NAND)	:= wbuf.o
-
-jffs2-objs := $(COMPR_OBJS) $(JFFS2_OBJS) $(VERS_OBJS) $(NAND_OBJS-y) \
-	      $(LINUX_OBJS-$(VERSION)$(PATCHLEVEL))
+jffs2-$(CONFIG_JFFS2_FS_NAND)	+= wbuf.o
diff -Nru a/fs/jfs/jfs_btree.h b/fs/jfs/jfs_btree.h
--- a/fs/jfs/jfs_btree.h	Tue Jun 15 22:20:36 2004
+++ b/fs/jfs/jfs_btree.h	Tue Jun 15 22:20:36 2004
@@ -1,5 +1,5 @@
 /*
- *   Copyright (c) International Business Machines Corp., 2000-2001
+ *   Copyright (C) International Business Machines Corp., 2000-2004
  *
  *   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
@@ -108,13 +108,12 @@
  * record the path traversed during the search;
  * top frame record the leaf page/entry selected.
  */
-#define	MAXTREEHEIGHT		8
 struct btframe {	/* stack frame */
 	s64 bn;			/* 8: */
 	s16 index;		/* 2: */
-	s16 lastindex;		/* 2: */
-	struct metapage *mp;	/* 4: */
-};				/* (16) */
+	s16 lastindex;		/* 2: unused */
+	struct metapage *mp;	/* 4/8: */
+};				/* (16/24) */
 
 struct btstack {
 	struct btframe *top;
@@ -125,12 +124,15 @@
 #define BT_CLR(btstack)\
 	(btstack)->top = (btstack)->stack
 
+#define BT_STACK_FULL(btstack)\
+	( (btstack)->top == &((btstack)->stack[MAXTREEHEIGHT-1]))
+
 #define BT_PUSH(BTSTACK, BN, INDEX)\
 {\
+	assert(!BT_STACK_FULL(BTSTACK));\
 	(BTSTACK)->top->bn = BN;\
 	(BTSTACK)->top->index = INDEX;\
 	++(BTSTACK)->top;\
-	assert((BTSTACK)->top != &((BTSTACK)->stack[MAXTREEHEIGHT]));\
 }
 
 #define BT_POP(btstack)\
@@ -138,6 +140,16 @@
 
 #define BT_STACK(btstack)\
 	( (btstack)->top == (btstack)->stack ? NULL : (btstack)->top )
+
+static inline void BT_STACK_DUMP(struct btstack *btstack)
+{
+	int i;
+	printk("btstack dump:\n");
+	for (i = 0; i < MAXTREEHEIGHT; i++)
+		printk(KERN_ERR "bn = %Lx, index = %d\n",
+		       btstack->stack[i].bn,
+		       btstack->stack[i].index);
+}
 
 /* retrieve search results */
 #define BT_GETSEARCH(IP, LEAF, BN, MP, TYPE, P, INDEX, ROOT)\
diff -Nru a/fs/jfs/jfs_debug.c b/fs/jfs/jfs_debug.c
--- a/fs/jfs/jfs_debug.c	Tue Jun 15 22:20:43 2004
+++ b/fs/jfs/jfs_debug.c	Tue Jun 15 22:20:43 2004
@@ -1,6 +1,6 @@
 /*
- *   Copyright (c) International Business Machines Corp., 2000-2002
- *   Portions Copyright (c) Christoph Hellwig, 2001-2002
+ *   Copyright (C) International Business Machines Corp., 2000-2004
+ *   Portions Copyright (C) Christoph Hellwig, 2001-2002
  *
  *   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
@@ -147,7 +147,7 @@
 	if (base) {
 		for (i = 0; i < NPROCENT; i++)
 			remove_proc_entry(Entries[i].name, base);
-		remove_proc_entry("jfs", base);
+		remove_proc_entry("jfs", proc_root_fs);
 	}
 }
 
diff -Nru a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
--- a/fs/jfs/jfs_dmap.c	Tue Jun 15 22:20:44 2004
+++ b/fs/jfs/jfs_dmap.c	Tue Jun 15 22:20:44 2004
@@ -1,5 +1,5 @@
 /*
- *   Copyright (C) International Business Machines Corp., 2000-2003
+ *   Copyright (C) International Business Machines Corp., 2000-2004
  *
  *   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
@@ -382,7 +382,7 @@
 	IREAD_LOCK(ipbmap);
 
 	/* block to be freed better be within the mapsize. */
-	if (blkno + nblocks > bmp->db_mapsize) {
+	if (unlikely((blkno == 0) || (blkno + nblocks > bmp->db_mapsize))) {
 		IREAD_UNLOCK(ipbmap);
 		printk(KERN_ERR "blkno = %Lx, nblocks = %Lx\n",
 		       (unsigned long long) blkno,
diff -Nru a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
--- a/fs/jfs/jfs_dtree.c	Tue Jun 15 22:20:42 2004
+++ b/fs/jfs/jfs_dtree.c	Tue Jun 15 22:20:42 2004
@@ -1,5 +1,5 @@
 /*
- *   Copyright (C) International Business Machines Corp., 2000-2003
+ *   Copyright (C) International Business Machines Corp., 2000-2004
  *
  *   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
@@ -177,8 +177,8 @@
 static void dtGetKey(dtpage_t * p, int i, struct component_name * key,
 		     int flag);
 
-static void ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
-			       int ri, struct component_name * key, int flag);
+static int ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
+			      int ri, struct component_name * key, int flag);
 
 static void dtInsertEntry(dtpage_t * p, int index, struct component_name * key,
 			  ddata_t * data, struct dt_lock **);
@@ -342,7 +342,6 @@
 	struct metapage *mp;
 	s64 offset;
 	uint page_offset;
-	int rc;
 	struct tlock *tlck;
 	s64 xaddr;
 
@@ -379,6 +378,8 @@
 		 * It's time to move the inline table to an external
 		 * page and begin to build the xtree
 		 */
+		if (dbAlloc(ip, 0, sbi->nbperpage, &xaddr))
+			goto clean_up;	/* No space */
 
 		/*
 		 * Save the table, we're going to overwrite it with the
@@ -395,12 +396,12 @@
 		/*
 		 * Allocate the first block & add it to the xtree
 		 */
-		xaddr = 0;
-		if ((rc =
-		     xtInsert(tid, ip, 0, 0, sbi->nbperpage,
-			      &xaddr, 0))) {
+		if (xtInsert(tid, ip, 0, 0, sbi->nbperpage, &xaddr, 0)) {
+			/* This really shouldn't fail */
 			jfs_warn("add_index: xtInsert failed!");
-			return -EPERM;
+			memcpy(&jfs_ip->i_dirtable, temp_table,
+			       sizeof (temp_table));
+			goto clean_up;
 		}
 		ip->i_size = PSIZE;
 		ip->i_blocks += LBLK2PBLK(sb, sbi->nbperpage);
@@ -408,7 +409,9 @@
 		if ((mp = get_index_page(ip, 0)) == 0) {
 			jfs_err("add_index: get_metapage failed!");
 			xtTruncate(tid, ip, 0, COMMIT_PWMAP);
-			return -EPERM;
+			memcpy(&jfs_ip->i_dirtable, temp_table,
+			       sizeof (temp_table));
+			goto clean_up;
 		}
 		tlck = txLock(tid, ip, mp, tlckDATA);
 		llck = (struct linelock *) & tlck->lock;
@@ -438,12 +441,9 @@
 		 * This will be the beginning of a new page
 		 */
 		xaddr = 0;
-		if ((rc =
-		     xtInsert(tid, ip, 0, blkno, sbi->nbperpage,
-			      &xaddr, 0))) {
+		if (xtInsert(tid, ip, 0, blkno, sbi->nbperpage, &xaddr, 0)) {
 			jfs_warn("add_index: xtInsert failed!");
-			jfs_ip->next_index--;
-			return -EPERM;
+			goto clean_up;
 		}
 		ip->i_size += PSIZE;
 		ip->i_blocks += LBLK2PBLK(sb, sbi->nbperpage);
@@ -457,7 +457,7 @@
 
 	if (mp == 0) {
 		jfs_err("add_index: get/read_metapage failed!");
-		return -EPERM;
+		goto clean_up;
 	}
 
 	lock_index(tid, ip, mp, index);
@@ -472,6 +472,12 @@
 	release_metapage(mp);
 
 	return index;
+
+      clean_up:
+
+	jfs_ip->next_index--;
+
+	return 0;
 }
 
 /*
@@ -760,11 +766,12 @@
 		 */
 	      getChild:
 		/* update max. number of pages to split */
-		if (btstack->nsplit >= 8) {
+		if (BT_STACK_FULL(btstack)) {
 			/* Something's corrupted, mark filesytem dirty so
 			 * chkdsk will fix it.
 			 */
 			jfs_error(sb, "stack overrun in dtSearch!");
+			BT_STACK_DUMP(btstack);
 			rc = -EIO;
 			goto out;
 		}
@@ -971,8 +978,10 @@
 		n -= DTROOTMAXSLOT - sp->header.freecnt; /* header + entries */
 		if (n <= split->nslot)
 			xlen++;
-		if ((rc = dbAlloc(ip, 0, (s64) xlen, &xaddr)))
+		if ((rc = dbAlloc(ip, 0, (s64) xlen, &xaddr))) {
+			DT_PUTPAGE(smp);
 			goto freeKeyName;
+		}
 
 		pxdlist.maxnpxd = 1;
 		pxdlist.npxd = 0;
@@ -1152,9 +1161,16 @@
 			if ((sp->header.flag & BT_ROOT && skip > 1) ||
 			    sp->header.prev != 0 || skip > 1) {
 				/* compute uppercase router prefix key */
-				ciGetLeafPrefixKey(lp,
-						   lp->header.nextindex - 1,
-						   rp, 0, &key, sbi->mntflag);
+				rc = ciGetLeafPrefixKey(lp,
+							lp->header.nextindex-1,
+							rp, 0, &key,
+							sbi->mntflag);
+				if (rc) {
+					DT_PUTPAGE(lmp);
+					DT_PUTPAGE(rmp);
+					DT_PUTPAGE(smp);
+					goto splitOut;
+				}
 			} else {
 				/* next to leftmost entry of
 				   lowest internal level */
@@ -3331,6 +3347,12 @@
 		/*
 		 * descend down to leftmost child page
 		 */
+		if (BT_STACK_FULL(btstack)) {
+			DT_PUTPAGE(mp);
+			jfs_error(ip->i_sb, "dtReadFirst: btstack overrun");
+			BT_STACK_DUMP(btstack);
+			return -EIO;
+		}
 		/* push (bn, index) of the parent page/entry */
 		BT_PUSH(btstack, bn, 0);
 
@@ -3713,18 +3735,28 @@
  *	     from two adjacent leaf entries
  *	     across page boundary
  *
- * return:
- *	Number of prefix bytes needed to distinguish b from a.
+ * return: non-zero on error
+ *	
  */
-static void ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
+static int ciGetLeafPrefixKey(dtpage_t * lp, int li, dtpage_t * rp,
 			       int ri, struct component_name * key, int flag)
 {
 	int klen, namlen;
 	wchar_t *pl, *pr, *kname;
-	wchar_t lname[JFS_NAME_MAX + 1];
-	struct component_name lkey = { 0, lname };
-	wchar_t rname[JFS_NAME_MAX + 1];
-	struct component_name rkey = { 0, rname };
+	struct component_name lkey;
+	struct component_name rkey;
+
+	lkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
+					GFP_KERNEL);
+	if (lkey.name == NULL)
+		return -ENOSPC;
+
+	rkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t),
+					GFP_KERNEL);
+	if (rkey.name == NULL) {
+		kfree(lkey.name);
+		return -ENOSPC;
+	}
 
 	/* get left and right key */
 	dtGetKey(lp, li, &lkey, flag);
@@ -3749,7 +3781,7 @@
 		*kname = *pr;
 		if (*pl != *pr) {
 			key->namlen = klen + 1;
-			return;
+			goto free_names;
 		}
 	}
 
@@ -3760,7 +3792,10 @@
 	} else			/* l->namelen == r->namelen */
 		key->namlen = klen;
 
-	return;
+free_names:
+	kfree(lkey.name);
+	kfree(rkey.name);
+	return 0;
 }
 
 
diff -Nru a/fs/jfs/jfs_incore.h b/fs/jfs/jfs_incore.h
--- a/fs/jfs/jfs_incore.h	Tue Jun 15 22:20:36 2004
+++ b/fs/jfs/jfs_incore.h	Tue Jun 15 22:20:36 2004
@@ -152,6 +152,11 @@
 	pxd_t		ait2;		/* pxd describing AIT copy	*/
 	char		uuid[16];	/* 128-bit uuid for volume	*/
 	char		loguuid[16];	/* 128-bit uuid for log	*/
+	/*
+	 * commit_state is used for synchronization of the jfs_commit
+	 * threads.  It is protected by LAZY_LOCK().
+	 */
+	int		commit_state;	/* commit state */
 	/* Formerly in ipimap */
 	uint		gengen;		/* inode generation generator*/
 	uint		inostamp;	/* shows inode belongs to fileset*/
@@ -163,6 +168,9 @@
 	unsigned long	flag;		/* mount time flags */
 	uint		p_state;	/* state prior to going no integrity */
 };
+
+/* jfs_sb_info commit_state */
+#define IN_LAZYCOMMIT 1
 
 static inline struct jfs_inode_info *JFS_IP(struct inode *inode)
 {
diff -Nru a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
--- a/fs/jfs/jfs_logmgr.c	Tue Jun 15 22:20:40 2004
+++ b/fs/jfs/jfs_logmgr.c	Tue Jun 15 22:20:40 2004
@@ -171,6 +171,7 @@
 extern void txLazyUnlock(struct tblock * tblk);
 extern int jfs_stop_threads;
 extern struct completion jfsIOwait;
+extern int jfs_tlocks_low;
 
 /*
  * forward references
@@ -524,12 +525,7 @@
 			tblk->eor = log->eor;
 
 			/* enqueue transaction to commit queue */
-			tblk->cqnext = NULL;
-			if (log->cqueue.head) {
-				log->cqueue.tail->cqnext = tblk;
-				log->cqueue.tail = tblk;
-			} else
-				log->cqueue.head = log->cqueue.tail = tblk;
+			list_add_tail(&tblk->cqueue, &log->cqueue);
 
 			LOGGC_UNLOCK(log);
 		}
@@ -587,7 +583,10 @@
 	 *      write or queue the full page at the tail of write queue
 	 */
 	/* get the tail tblk on commit queue */
-	tblk = log->cqueue.tail;
+	if (list_empty(&log->cqueue))
+		tblk = NULL;
+	else
+		tblk = list_entry(log->cqueue.prev, struct tblock, cqueue);
 
 	/* every tblk who has COMMIT record on the current page,
 	 * and has not been committed, must be on commit queue
@@ -688,8 +687,9 @@
 	if (tblk->xflag & COMMIT_LAZY)
 		tblk->flag |= tblkGC_LAZY;
 
-	if ((!(log->cflag & logGC_PAGEOUT)) && log->cqueue.head &&
-	    (!(tblk->xflag & COMMIT_LAZY) || test_bit(log_FLUSH, &log->flag))) {
+	if ((!(log->cflag & logGC_PAGEOUT)) && (!list_empty(&log->cqueue)) &&
+	    (!(tblk->xflag & COMMIT_LAZY) || test_bit(log_FLUSH, &log->flag)
+	     || jfs_tlocks_low)) {
 		/*
 		 * No pageout in progress
 		 *
@@ -753,7 +753,7 @@
 	struct logpage *lp;
 	int gcpn;		/* group commit page number */
 	struct tblock *tblk;
-	struct tblock *xtblk;
+	struct tblock *xtblk = NULL;
 
 	/*
 	 * build the commit group of a log page
@@ -762,15 +762,16 @@
 	 * transactions with COMMIT records on the same log page.
 	 */
 	/* get the head tblk on the commit queue */
-	tblk = xtblk = log->cqueue.head;
-	gcpn = tblk->pn;
+	gcpn = list_entry(log->cqueue.next, struct tblock, cqueue)->pn;
+
+	list_for_each_entry(tblk, &log->cqueue, cqueue) {
+		if (tblk->pn != gcpn)
+			break;
 
-	while (tblk && tblk->pn == gcpn) {
 		xtblk = tblk;
 
 		/* state transition: (QUEUE, READY) -> COMMIT */
 		tblk->flag |= tblkGC_COMMIT;
-		tblk = tblk->cqnext;
 	}
 	tblk = xtblk;		/* last tblk of the page */
 
@@ -816,7 +817,7 @@
 	unsigned long flags;
 	struct jfs_log *log = bp->l_log;
 	struct logpage *lp;
-	struct tblock *tblk;
+	struct tblock *tblk, *temp;
 
 	//LOGGC_LOCK(log);
 	spin_lock_irqsave(&log->gclock, flags);
@@ -826,7 +827,9 @@
 	 * remove/wakeup transactions from commit queue who were
 	 * group committed with the current log page
 	 */
-	while ((tblk = log->cqueue.head) && (tblk->flag & tblkGC_COMMIT)) {
+	list_for_each_entry_safe(tblk, temp, &log->cqueue, cqueue) {
+		if (!(tblk->flag & tblkGC_COMMIT))
+			break;
 		/* if transaction was marked GC_COMMIT then
 		 * it has been shipped in the current pageout
 		 * and made it to disk - it is committed.
@@ -836,11 +839,8 @@
 			tblk->flag |= tblkGC_ERROR;
 
 		/* remove it from the commit queue */
-		log->cqueue.head = tblk->cqnext;
-		if (log->cqueue.head == NULL)
-			log->cqueue.tail = NULL;
+		list_del(&tblk->cqueue);
 		tblk->flag &= ~tblkGC_QUEUE;
-		tblk->cqnext = 0;
 
 		if (tblk == log->flush_tblk) {
 			/* we can stop flushing the log now */
@@ -893,9 +893,9 @@
 	 * select the latest ready transaction as new group leader and
 	 * wake her up to lead her group.
 	 */
-	if ((tblk = log->cqueue.head) &&
+	if ((!list_empty(&log->cqueue)) &&
 	    ((log->gcrtc > 0) || (tblk->bp->l_wqnext != NULL) ||
-	     test_bit(log_FLUSH, &log->flag)))
+	     test_bit(log_FLUSH, &log->flag) || jfs_tlocks_low))
 		/*
 		 * Call lmGCwrite with new group leader
 		 */
@@ -1288,7 +1288,7 @@
 
 	init_waitqueue_head(&log->syncwait);
 
-	log->cqueue.head = log->cqueue.tail = NULL;
+	INIT_LIST_HEAD(&log->cqueue);
 	log->flush_tblk = NULL;
 
 	log->count = 0;
@@ -1486,6 +1486,7 @@
 		 *      in-line log in host file system
 		 */
 		rc = lmLogShutdown(log);
+		kfree(log);
 		goto out;
 	}
 
@@ -1515,6 +1516,8 @@
 	bd_release(bdev);
 	blkdev_put(bdev);
 
+	kfree(log);
+
       out:
 	up(&jfs_log_sem);
 	jfs_info("lmLogClose: exit(%d)", rc);
@@ -1535,7 +1538,7 @@
 void jfs_flush_journal(struct jfs_log *log, int wait)
 {
 	int i;
-	struct tblock *target;
+	struct tblock *target = NULL;
 
 	/* jfs_write_inode may call us during read-only mount */
 	if (!log)
@@ -1545,13 +1548,12 @@
 
 	LOGGC_LOCK(log);
 
-	target = log->cqueue.head;
-
-	if (target) {
+	if (!list_empty(&log->cqueue)) {
 		/*
 		 * This ensures that we will keep writing to the journal as long
 		 * as there are unwritten commit records
 		 */
+		target = list_entry(log->cqueue.prev, struct tblock, cqueue);
 
 		if (test_bit(log_FLUSH, &log->flag)) {
 			/*
@@ -1602,16 +1604,16 @@
 	 * If there was recent activity, we may need to wait
 	 * for the lazycommit thread to catch up
 	 */
-	if (log->cqueue.head || !list_empty(&log->synclist)) {
+	if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) {
 		for (i = 0; i < 800; i++) {	/* Too much? */
 			current->state = TASK_INTERRUPTIBLE;
 			schedule_timeout(HZ / 4);
-			if ((log->cqueue.head == NULL) &&
+			if (list_empty(&log->cqueue) &&
 			    list_empty(&log->synclist))
 				break;
 		}
 	}
-	assert(log->cqueue.head == NULL);
+	assert(list_empty(&log->cqueue));
 	assert(list_empty(&log->synclist));
 	clear_bit(log_FLUSH, &log->flag);
 }
diff -Nru a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h
--- a/fs/jfs/jfs_logmgr.h	Tue Jun 15 22:20:38 2004
+++ b/fs/jfs/jfs_logmgr.h	Tue Jun 15 22:20:38 2004
@@ -398,10 +398,7 @@
 
 	/* commit */
 	uint cflag;		/* 4: */
-	struct {		/* 8: FIFO commit queue header */
-		struct tblock *head;
-		struct tblock *tail;
-	} cqueue;
+	struct list_head	cqueue; /* FIFO commit queue */
 	struct tblock *flush_tblk; /* tblk we're waiting on for flush */
 	int gcrtc;		/* 4: GC_READY transaction count */
 	struct tblock *gclrt;	/* 4: latest GC_READY transaction */
diff -Nru a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
--- a/fs/jfs/jfs_metapage.c	Tue Jun 15 22:20:38 2004
+++ b/fs/jfs/jfs_metapage.c	Tue Jun 15 22:20:38 2004
@@ -228,31 +228,37 @@
 	else
 		mapping = inode->i_mapping;
 
-	spin_lock(&meta_lock);
 	hash_ptr = meta_hash(mapping, lblock);
+again:
+	spin_lock(&meta_lock);
 	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 */
+			goto again;
+		}
 		if (test_bit(META_discard, &mp->flag)) {
 			if (!new) {
-				spin_unlock(&meta_lock);
 				jfs_error(inode->i_sb,
 					  "__get_metapage: using a "
 					  "discarded metapage");
+				release_metapage(mp);
 				return NULL;
 			}
 			clear_bit(META_discard, &mp->flag);
 		}
-		mp->count++;
 		jfs_info("__get_metapage: found 0x%p, in hash", mp);
 		if (mp->logical_size != size) {
-			spin_unlock(&meta_lock);
 			jfs_error(inode->i_sb,
 				  "__get_metapage: mp->logical_size != size");
+			release_metapage(mp);
 			return NULL;
 		}
-		lock_metapage(mp);
-		spin_unlock(&meta_lock);
 	} else {
 		l2bsize = inode->i_blkbits;
 		l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
@@ -451,46 +457,57 @@
 	if (--mp->count || atomic_read(&mp->nohomeok)) {
 		unlock_metapage(mp);
 		spin_unlock(&meta_lock);
-	} else {
-		remove_from_hash(mp, meta_hash(mp->mapping, mp->index));
-		spin_unlock(&meta_lock);
-
-		if (mp->page) {
-			kunmap(mp->page);
-			mp->data = 0;
-			if (test_bit(META_dirty, &mp->flag))
-				__write_metapage(mp);
-			if (test_bit(META_sync, &mp->flag)) {
-				sync_metapage(mp);
-				clear_bit(META_sync, &mp->flag);
-			}
-
-			if (test_bit(META_discard, &mp->flag)) {
-				lock_page(mp->page);
-				block_invalidatepage(mp->page, 0);
-				unlock_page(mp->page);
-			}
+		return;
+	}
 
-			page_cache_release(mp->page);
-			INCREMENT(mpStat.pagefree);
+	if (mp->page) {
+		/* Releasing spinlock, we have to check mp->count later */
+		set_bit(META_stale, &mp->flag);
+		spin_unlock(&meta_lock);
+		kunmap(mp->page);
+		mp->data = 0;
+		if (test_bit(META_dirty, &mp->flag))
+			__write_metapage(mp);
+		if (test_bit(META_sync, &mp->flag)) {
+			sync_metapage(mp);
+			clear_bit(META_sync, &mp->flag);
 		}
 
-		if (mp->lsn) {
-			/*
-			 * Remove metapage from logsynclist.
-			 */
-			log = mp->log;
-			LOGSYNC_LOCK(log);
-			mp->log = 0;
-			mp->lsn = 0;
-			mp->clsn = 0;
-			log->count--;
-			list_del(&mp->synclist);
-			LOGSYNC_UNLOCK(log);
+		if (test_bit(META_discard, &mp->flag)) {
+			lock_page(mp->page);
+			block_invalidatepage(mp->page, 0);
+			unlock_page(mp->page);
 		}
 
-		free_metapage(mp);
+		page_cache_release(mp->page);
+		mp->page = NULL;
+		INCREMENT(mpStat.pagefree);
+		spin_lock(&meta_lock);
+	}
+
+	if (mp->lsn) {
+		/*
+		 * Remove metapage from logsynclist.
+		 */
+		log = mp->log;
+		LOGSYNC_LOCK(log);
+		mp->log = 0;
+		mp->lsn = 0;
+		mp->clsn = 0;
+		log->count--;
+		list_del(&mp->synclist);
+		LOGSYNC_UNLOCK(log);
 	}
+	if (mp->count) {
+		/* Someone else is trying to get this metpage */
+		unlock_metapage(mp);
+		spin_unlock(&meta_lock);
+		return;
+	}
+	remove_from_hash(mp, meta_hash(mp->mapping, mp->index));
+	spin_unlock(&meta_lock);
+
+	free_metapage(mp);
 }
 
 void __invalidate_metapages(struct inode *ip, s64 addr, int len)
@@ -510,9 +527,20 @@
 	for (lblock = addr; lblock < addr + len;
 	     lblock += 1 << l2BlocksPerPage) {
 		hash_ptr = meta_hash(mapping, lblock);
+again:
 		spin_lock(&meta_lock);
 		mp = search_hash(hash_ptr, mapping, lblock);
 		if (mp) {
+			if (test_bit(META_stale, &mp->flag)) {
+				/* Racing with release_metapage */
+				mp->count++;
+				lock_metapage(mp);
+				spin_unlock(&meta_lock);
+				/* racing release_metapage should be done now */
+				release_metapage(mp);
+				goto again;
+			}
+
 			set_bit(META_discard, &mp->flag);
 			spin_unlock(&meta_lock);
 		} else {
diff -Nru a/fs/jfs/jfs_metapage.h b/fs/jfs/jfs_metapage.h
--- a/fs/jfs/jfs_metapage.h	Tue Jun 15 22:20:41 2004
+++ b/fs/jfs/jfs_metapage.h	Tue Jun 15 22:20:41 2004
@@ -64,6 +64,7 @@
 #define META_sync	4
 #define META_discard	5
 #define META_forced	6
+#define META_stale	7
 
 #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag)
 
diff -Nru a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c
--- a/fs/jfs/jfs_mount.c	Tue Jun 15 22:20:38 2004
+++ b/fs/jfs/jfs_mount.c	Tue Jun 15 22:20:38 2004
@@ -288,6 +288,11 @@
 	 */
 	logMOUNT(sb);
 
+	/*
+	 * Set page cache allocation policy
+	 */
+	mapping_set_gfp_mask(sb->s_bdev->bd_inode->i_mapping, GFP_NOFS);
+
 	return rc;
 }
 
diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
--- a/fs/jfs/jfs_txnmgr.c	Tue Jun 15 22:20:41 2004
+++ b/fs/jfs/jfs_txnmgr.c	Tue Jun 15 22:20:41 2004
@@ -48,6 +48,8 @@
 #include <linux/smp_lock.h>
 #include <linux/completion.h>
 #include <linux/suspend.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include "jfs_incore.h"
 #include "jfs_filsys.h"
 #include "jfs_metapage.h"
@@ -61,25 +63,22 @@
  *      transaction management structures
  */
 static struct {
-	/* tblock */
 	int freetid;		/* index of a free tid structure */
-	wait_queue_head_t freewait;	/* eventlist of free tblock */
-
-	/* tlock */
 	int freelock;		/* index first free lock word */
+	wait_queue_head_t freewait;	/* eventlist of free tblock */
 	wait_queue_head_t freelockwait;	/* eventlist of free tlock */
 	wait_queue_head_t lowlockwait;	/* eventlist of ample tlocks */
 	int tlocksInUse;	/* Number of tlocks in use */
-	int TlocksLow;		/* Indicates low number of available tlocks */
 	spinlock_t LazyLock;	/* synchronize sync_queue & unlock_queue */
 /*	struct tblock *sync_queue; * Transactions waiting for data sync */
-	struct tblock *unlock_queue;	/* Txns waiting to be released */
-	struct tblock *unlock_tail;	/* Tail of unlock_queue */
+	struct list_head unlock_queue;	/* Txns waiting to be released */
 	struct list_head anon_list;	/* inodes having anonymous txns */
 	struct list_head anon_list2;	/* inodes having anonymous txns
 					   that couldn't be sync'ed */
 } TxAnchor;
 
+int jfs_tlocks_low;		/* Indicates low number of available tlocks */
+
 #ifdef CONFIG_JFS_STATISTICS
 struct {
 	uint txBegin;
@@ -95,11 +94,19 @@
 #endif
 
 static int nTxBlock = 512;	/* number of transaction blocks */
-struct tblock *TxBlock;	        /* transaction block table */
+module_param(nTxBlock, int, 0);
+MODULE_PARM_DESC(nTxBlock,
+		 "Number of transaction blocks (default:512, max:65536)");
 
 static int nTxLock = 4096;	/* number of transaction locks */
-static int TxLockLWM = 4096*.4;	/* Low water mark for number of txLocks used */
-static int TxLockHWM = 4096*.8;	/* High water mark for number of txLocks used */
+module_param(nTxLock, int, 0);
+MODULE_PARM_DESC(nTxLock,
+		 "Number of transaction locks (default:4096, max:65536)");
+
+struct tblock *TxBlock;	        /* transaction block table */
+static int TxLockLWM;		/* Low water mark for number of txLocks used */
+static int TxLockHWM;		/* High water mark for number of txLocks used */
+static int TxLockVHWM;		/* Very High water mark */
 struct tlock *TxLock;           /* transaction lock table */
 
 
@@ -162,7 +169,6 @@
 extern int jfs_commit_inode(struct inode *, int);
 extern int jfs_stop_threads;
 
-struct task_struct *jfsCommitTask;
 extern struct completion jfsIOwait;
 
 /*
@@ -210,9 +216,9 @@
 		TXN_SLEEP(&TxAnchor.freelockwait);
 	TxAnchor.freelock = TxLock[lid].next;
 	HIGHWATERMARK(stattx.maxlid, lid);
-	if ((++TxAnchor.tlocksInUse > TxLockHWM) && (TxAnchor.TlocksLow == 0)) {
-		jfs_info("txLockAlloc TlocksLow");
-		TxAnchor.TlocksLow = 1;
+	if ((++TxAnchor.tlocksInUse > TxLockHWM) && (jfs_tlocks_low == 0)) {
+		jfs_info("txLockAlloc tlocks low");
+		jfs_tlocks_low = 1;
 		wake_up(&jfs_sync_thread_wait);
 	}
 
@@ -224,9 +230,9 @@
 	TxLock[lid].next = TxAnchor.freelock;
 	TxAnchor.freelock = lid;
 	TxAnchor.tlocksInUse--;
-	if (TxAnchor.TlocksLow && (TxAnchor.tlocksInUse < TxLockLWM)) {
-		jfs_info("txLockFree TlocksLow no more");
-		TxAnchor.TlocksLow = 0;
+	if (jfs_tlocks_low && (TxAnchor.tlocksInUse < TxLockLWM)) {
+		jfs_info("txLockFree jfs_tlocks_low no more");
+		jfs_tlocks_low = 0;
 		TXN_WAKEUP(&TxAnchor.lowlockwait);
 	}
 	TXN_WAKEUP(&TxAnchor.freelockwait);
@@ -245,12 +251,25 @@
 {
 	int k, size;
 
+	/* Verify tunable parameters */
+	if (nTxBlock < 16)
+		nTxBlock = 16;	/* No one should set it this low */
+	if (nTxBlock > 65536)
+		nTxBlock = 65536;
+	if (nTxLock < 256)
+		nTxLock = 256;	/* No one should set it this low */
+	if (nTxLock > 65536)
+		nTxLock = 65536;
 	/*
 	 * initialize transaction block (tblock) table
 	 *
 	 * transaction id (tid) = tblock index
 	 * tid = 0 is reserved.
 	 */
+	TxLockLWM = (nTxLock * 4) / 10;
+	TxLockHWM = (nTxLock * 8) / 10;
+	TxLockVHWM = (nTxLock * 9) / 10;
+
 	size = sizeof(struct tblock) * nTxBlock;
 	TxBlock = (struct tblock *) vmalloc(size);
 	if (TxBlock == NULL)
@@ -295,6 +314,9 @@
 	INIT_LIST_HEAD(&TxAnchor.anon_list);
 	INIT_LIST_HEAD(&TxAnchor.anon_list2);
 
+	LAZY_LOCK_INIT();
+	INIT_LIST_HEAD(&TxAnchor.unlock_queue);
+
 	stattx.maxlid = 1;	/* statistics */
 
 	return 0;
@@ -358,7 +380,7 @@
 		 * unless COMMIT_FORCE or COMMIT_INODE (which may ultimately
 		 * free tlocks)
 		 */
-		if (TxAnchor.TlocksLow) {
+		if (TxAnchor.tlocksInUse > TxLockVHWM) {
 			INCREMENT(TxStat.txBegin_lockslow);
 			TXN_SLEEP(&TxAnchor.lowlockwait);
 			goto retry;
@@ -450,7 +472,7 @@
 	/*
 	 * Don't begin transaction if we're getting starved for tlocks
 	 */
-	if (TxAnchor.TlocksLow) {
+	if (TxAnchor.tlocksInUse > TxLockVHWM) {
 		INCREMENT(TxStat.txBeginAnon_lockslow);
 		TXN_SLEEP(&TxAnchor.lowlockwait);
 		goto retry;
@@ -1725,7 +1747,10 @@
 
 		if (lwm == next)
 			goto out;
-		assert(lwm < next);
+		if (lwm > next) {
+			jfs_err("xtLog: lwm > next\n");
+			goto out;
+		}
 		tlck->flag |= tlckUPDATEMAP;
 		xadlock->flag = mlckALLOCXADLIST;
 		xadlock->count = next - lwm;
@@ -1891,25 +1916,18 @@
 		/*
 		 *      write log records
 		 */
-		/*
-		 * allocate entries XAD[lwm:next]:
+		/* log after-image for logredo():
+		 *
+		 * logredo() will update bmap for alloc of new/extended
+		 * extents (XAD_NEW|XAD_EXTEND) of XAD[lwm:next) from
+		 * after-image of XADlist;
+		 * logredo() resets (XAD_NEW|XAD_EXTEND) flag when
+		 * applying the after-image to the meta-data page.
 		 */
-		if (lwm < next) {
-			/* log after-image for logredo():
-			 * logredo() will update bmap for alloc of new/extended
-			 * extents (XAD_NEW|XAD_EXTEND) of XAD[lwm:next) from
-			 * after-image of XADlist;
-			 * logredo() resets (XAD_NEW|XAD_EXTEND) flag when
-			 * applying the after-image to the meta-data page.
-			 */
-			lrd->type = cpu_to_le16(LOG_REDOPAGE);
-			PXDaddress(pxd, mp->index);
-			PXDlength(pxd,
-				  mp->logical_size >> tblk->sb->
-				  s_blocksize_bits);
-			lrd->backchain =
-			    cpu_to_le32(lmLog(log, tblk, lrd, tlck));
-		}
+		lrd->type = cpu_to_le16(LOG_REDOPAGE);
+		PXDaddress(pxd, mp->index);
+		PXDlength(pxd, mp->logical_size >> tblk->sb->s_blocksize_bits);
+		lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck));
 
 		/*
 		 * truncate entry XAD[twm == next - 1]:
@@ -2559,6 +2577,7 @@
 	if (!jfs_ip->atlhead)
 		return;
 
+	TXN_LOCK();
 	xtlck = (struct tlock *) &jfs_ip->atlhead;
 
 	while ((lid = xtlck->next)) {
@@ -2579,10 +2598,9 @@
 		/*
 		 * If inode was on anon_list, remove it
 		 */
-		TXN_LOCK();
 		list_del_init(&jfs_ip->anon_inode_list);
-		TXN_UNLOCK();
 	}
+	TXN_UNLOCK();
 }
 
 
@@ -2602,6 +2620,7 @@
 	lid_t lid, next;
 	struct metapage *mp;
 	struct tblock *tblk = tid_to_tblock(tid);
+	struct tlock *tlck;
 
 	jfs_warn("txAbort: tid:%d dirty:0x%x", tid, dirty);
 
@@ -2609,9 +2628,10 @@
 	 * free tlocks of the transaction
 	 */
 	for (lid = tblk->next; lid; lid = next) {
-		next = lid_to_tlock(lid)->next;
-
-		mp = lid_to_tlock(lid)->mp;
+		tlck = lid_to_tlock(lid);
+		next = tlck->next;
+		mp = tlck->mp;
+		JFS_IP(tlck->ip)->xtlid = 0;
 
 		if (mp) {
 			mp->lid = 0;
@@ -2707,50 +2727,54 @@
 	int WorkDone;
 	struct tblock *tblk;
 	unsigned long flags;
+	struct jfs_sb_info *sbi;
 
 	daemonize("jfsCommit");
 
-	jfsCommitTask = current;
-
-	LAZY_LOCK_INIT();
-	TxAnchor.unlock_queue = TxAnchor.unlock_tail = 0;
-
 	complete(&jfsIOwait);
 
 	do {
 		LAZY_LOCK(flags);
-restart:
-		WorkDone = 0;
-		while ((tblk = TxAnchor.unlock_queue)) {
-			/*
-			 * We can't get ahead of user thread.  Spinning is
-			 * simpler than blocking/waking.  We shouldn't spin
-			 * very long, since user thread shouldn't be blocking
-			 * between lmGroupCommit & txEnd.
-			 */
-			WorkDone = 1;
+		while (!list_empty(&TxAnchor.unlock_queue)) {
+			WorkDone = 0;
+			list_for_each_entry(tblk, &TxAnchor.unlock_queue,
+					    cqueue) {
 
-			/*
-			 * Remove first transaction from queue
-			 */
-			TxAnchor.unlock_queue = tblk->cqnext;
-			tblk->cqnext = 0;
-			if (TxAnchor.unlock_tail == tblk)
-				TxAnchor.unlock_tail = 0;
+				sbi = JFS_SBI(tblk->sb);
+				/*
+				 * For each volume, the transactions must be
+				 * handled in order.  If another commit thread
+				 * is handling a tblk for this superblock,
+				 * skip it
+				 */
+				if (sbi->commit_state & IN_LAZYCOMMIT)
+					continue;
 
-			LAZY_UNLOCK(flags);
-			txLazyCommit(tblk);
+				sbi->commit_state |= IN_LAZYCOMMIT;
+				WorkDone = 1;
 
-			/*
-			 * We can be running indefinitely if other processors
-			 * are adding transactions to this list
-			 */
-			cond_resched();
-			LAZY_LOCK(flags);
-		}
+				/*
+				 * Remove transaction from queue
+				 */
+				list_del(&tblk->cqueue);
+
+				LAZY_UNLOCK(flags);
+				txLazyCommit(tblk);
+				LAZY_LOCK(flags);
 
-		if (WorkDone)
-			goto restart;
+				sbi->commit_state &= ~IN_LAZYCOMMIT;
+				/*
+				 * Don't continue in the for loop.  (We can't
+				 * anyway, it's unsafe!)  We want to go back to
+				 * the beginning of the list.
+				 */
+				break;
+			}
+
+			/* If there was nothing to do, don't continue */
+			if (!WorkDone)
+				break;
+		}
 
 		if (current->flags & PF_FREEZE) {
 			LAZY_UNLOCK(flags);
@@ -2767,7 +2791,7 @@
 		}
 	} while (!jfs_stop_threads);
 
-	if (TxAnchor.unlock_queue)
+	if (!list_empty(&TxAnchor.unlock_queue))
 		jfs_err("jfs_lazycommit being killed w/pending transactions!");
 	else
 		jfs_info("jfs_lazycommit being killed\n");
@@ -2780,14 +2804,14 @@
 
 	LAZY_LOCK(flags);
 
-	if (TxAnchor.unlock_tail)
-		TxAnchor.unlock_tail->cqnext = tblk;
-	else
-		TxAnchor.unlock_queue = tblk;
-	TxAnchor.unlock_tail = tblk;
-	tblk->cqnext = 0;
+	list_add_tail(&tblk->cqueue, &TxAnchor.unlock_queue);
+	/*
+	 * Don't wake up a commit thread if there is already one servicing
+	 * this superblock.
+	 */
+	if (!(JFS_SBI(tblk->sb)->commit_state & IN_LAZYCOMMIT))
+		wake_up(&jfs_commit_thread_wait);
 	LAZY_UNLOCK(flags);
-	wake_up(&jfs_commit_thread_wait);
 }
 
 static void LogSyncRelease(struct metapage * mp)
@@ -2821,7 +2845,7 @@
  *	completion
  *
  *	This does almost the same thing as jfs_sync below.  We don't
- *	worry about deadlocking when TlocksLow is set, since we would
+ *	worry about deadlocking when jfs_tlocks_low is set, since we would
  *	expect jfs_sync to get us out of that jam.
  */
 void txQuiesce(struct super_block *sb)
@@ -2912,7 +2936,7 @@
 		 * write each inode on the anonymous inode list
 		 */
 		TXN_LOCK();
-		while (TxAnchor.TlocksLow && !list_empty(&TxAnchor.anon_list)) {
+		while (jfs_tlocks_low && !list_empty(&TxAnchor.anon_list)) {
 			jfs_ip = list_entry(TxAnchor.anon_list.next,
 					    struct jfs_inode_info,
 					    anon_inode_list);
@@ -3008,18 +3032,16 @@
 		       "freelockwait = %s\n"
 		       "lowlockwait = %s\n"
 		       "tlocksInUse = %d\n"
-		       "TlocksLow = %d\n"
-		       "unlock_queue = 0x%p\n"
-		       "unlock_tail = 0x%p\n",
+		       "jfs_tlocks_low = %d\n"
+		       "unlock_queue is %sempty\n",
 		       TxAnchor.freetid,
 		       freewait,
 		       TxAnchor.freelock,
 		       freelockwait,
 		       lowlockwait,
 		       TxAnchor.tlocksInUse,
-		       TxAnchor.TlocksLow,
-		       TxAnchor.unlock_queue,
-		       TxAnchor.unlock_tail);
+		       jfs_tlocks_low,
+		       list_empty(&TxAnchor.unlock_queue) ? "" : "not ");
 
 	begin = offset;
 	*start = buffer + begin;
diff -Nru a/fs/jfs/jfs_txnmgr.h b/fs/jfs/jfs_txnmgr.h
--- a/fs/jfs/jfs_txnmgr.h	Tue Jun 15 22:20:43 2004
+++ b/fs/jfs/jfs_txnmgr.h	Tue Jun 15 22:20:43 2004
@@ -1,5 +1,5 @@
 /*
- *   Copyright (c) International Business Machines Corp., 2000-2002
+ *   Copyright (C) International Business Machines Corp., 2000-2004
  *
  *   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
@@ -53,7 +53,7 @@
 	u32 logtid;		/* log transaction id */
 
 	/* commit management */
-	struct tblock *cqnext;	/* commit queue link */
+	struct list_head cqueue;	/* commit queue list */
 	s32 clsn;		/* commit lsn */
 	struct lbuf *bp;
 	s32 pn;			/* commit record log page number */
@@ -93,16 +93,16 @@
  *	transaction lock
  */
 struct tlock {
-	lid_t next;		/* index next lockword on tid locklist
+	lid_t next;		/* 2: index next lockword on tid locklist
 				 *          next lockword on freelist
 				 */
-	tid_t tid;		/* transaction id holding lock */
+	tid_t tid;		/* 2: transaction id holding lock */
 
 	u16 flag;		/* 2: lock control */
 	u16 type;		/* 2: log type */
 
-	struct metapage *mp;	/* 4: object page buffer locked */
-	struct inode *ip;	/* 4: object */
+	struct metapage *mp;	/* 4/8: object page buffer locked */
+	struct inode *ip;	/* 4/8: object */
 	/* (16) */
 
 	s16 lock[24];		/* 48: overlay area */
@@ -167,7 +167,7 @@
 #define	TLOCKLONG	28
 
 struct linelock {
-	u16 next;		/* 2: next linelock */
+	lid_t next;		/* 2: next linelock */
 
 	s8 maxcnt;		/* 1: */
 	s8 index;		/* 1: */
@@ -183,7 +183,7 @@
 #define dt_lock	linelock
 
 struct xtlock {
-	u16 next;		/* 2: */
+	lid_t next;		/* 2: */
 
 	s8 maxcnt;		/* 1: */
 	s8 index;		/* 1: */
@@ -214,7 +214,7 @@
  * free maplock (i.e., number of maplock) in the tlock; 
  */
 struct maplock {
-	u16 next;		/* 2: */
+	lid_t next;		/* 2: */
 
 	u8 maxcnt;		/* 2: */
 	u8 index;		/* 2: next free maplock index */
@@ -242,7 +242,7 @@
 #define	pxd_lock	maplock
 
 struct xdlistlock {
-	u16 next;		/* 2: */
+	lid_t next;		/* 2: */
 
 	u8 maxcnt;		/* 2: */
 	u8 index;		/* 2: */
diff -Nru a/fs/jfs/jfs_types.h b/fs/jfs/jfs_types.h
--- a/fs/jfs/jfs_types.h	Tue Jun 15 22:20:40 2004
+++ b/fs/jfs/jfs_types.h	Tue Jun 15 22:20:40 2004
@@ -1,5 +1,5 @@
 /*
- *   Copyright (c) International Business Machines Corp., 2000-2002
+ *   Copyright (C) International Business Machines Corp., 2000-2004
  *
  *   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
@@ -34,9 +34,12 @@
 
 /*
  * transaction and lock id's
+ *
+ * Don't change these without carefully considering the impact on the
+ * size and alignment of all of the linelock variants
  */
-typedef uint tid_t;
-typedef uint lid_t;
+typedef u16 tid_t;
+typedef u16 lid_t;
 
 /*
  * Almost identical to Linux's timespec, but not quite
@@ -110,11 +113,12 @@
 #define	addressPXD(pxd)\
 	( ((s64)((pxd)->addr1)) << 32 | __le32_to_cpu((pxd)->addr2))
 
+#define MAXTREEHEIGHT 8
 /* pxd list */
 struct pxdlist {
 	s16 maxnpxd;
 	s16 npxd;
-	pxd_t pxd[8];
+	pxd_t pxd[MAXTREEHEIGHT];
 };
 
 
diff -Nru a/fs/jfs/jfs_umount.c b/fs/jfs/jfs_umount.c
--- a/fs/jfs/jfs_umount.c	Tue Jun 15 22:20:40 2004
+++ b/fs/jfs/jfs_umount.c	Tue Jun 15 22:20:40 2004
@@ -121,7 +121,10 @@
 	 * list (to signify skip logredo()).
 	 */
 	if (log) {		/* log = NULL if read-only mount */
-		rc = updateSuper(sb, FM_CLEAN);
+		updateSuper(sb, FM_CLEAN);
+
+		/* Restore default gfp_mask for bdev */
+		mapping_set_gfp_mask(bdev_mapping, GFP_USER);
 
 		/*
 		 * close log: 
@@ -167,6 +170,9 @@
 	filemap_fdatawait(bdev_mapping);
 
 	updateSuper(sb, FM_CLEAN);
+
+	/* Restore default gfp_mask for bdev */
+	mapping_set_gfp_mask(bdev_mapping, GFP_USER);
 
 	return lmLogClose(sb);
 }
diff -Nru a/fs/jfs/namei.c b/fs/jfs/namei.c
--- a/fs/jfs/namei.c	Tue Jun 15 22:20:43 2004
+++ b/fs/jfs/namei.c	Tue Jun 15 22:20:43 2004
@@ -135,7 +135,6 @@
 
 	insert_inode_hash(ip);
 	mark_inode_dirty(ip);
-	d_instantiate(dentry, ip);
 
 	dip->i_ctime = dip->i_mtime = CURRENT_TIME;
 
@@ -150,7 +149,8 @@
 	if (rc) {
 		ip->i_nlink = 0;
 		iput(ip);
-	}
+	} else
+		d_instantiate(dentry, ip);
 
       out2:
 	free_UCSname(&dname);
@@ -265,7 +265,6 @@
 
 	insert_inode_hash(ip);
 	mark_inode_dirty(ip);
-	d_instantiate(dentry, ip);
 
 	/* update parent directory inode */
 	dip->i_nlink++;		/* for '..' from child directory */
@@ -281,7 +280,8 @@
 	if (rc) {
 		ip->i_nlink = 0;
 		iput(ip);
-	}
+	} else
+		d_instantiate(dentry, ip);
 
       out2:
 	free_UCSname(&dname);
@@ -806,12 +806,14 @@
 	ip->i_ctime = CURRENT_TIME;
 	mark_inode_dirty(dir);
 	atomic_inc(&ip->i_count);
-	d_instantiate(dentry, ip);
 
 	iplist[0] = ip;
 	iplist[1] = dir;
 	rc = txCommit(tid, 2, &iplist[0], 0);
 
+	if (!rc)
+		d_instantiate(dentry, ip);
+
       free_dname:
 	free_UCSname(&dname);
 
@@ -856,7 +858,7 @@
 	unchar *i_fastsymlink;
 	s64 xlen = 0;
 	int bmask = 0, xsize;
-	s64 xaddr;
+	s64 extent = 0, xaddr;
 	struct metapage *mp;
 	struct super_block *sb;
 	struct tblock *tblk;
@@ -890,29 +892,11 @@
 	down(&JFS_IP(dip)->commit_sem);
 	down(&JFS_IP(ip)->commit_sem);
 
-	if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE)))
-		goto out3;
-
 	tblk = tid_to_tblock(tid);
 	tblk->xflag |= COMMIT_CREATE;
 	tblk->ino = ip->i_ino;
 	tblk->u.ixpxd = JFS_IP(ip)->ixpxd;
 
-	/*
-	 * create entry for symbolic link in parent directory
-	 */
-
-	ino = ip->i_ino;
-
-
-
-	if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) {
-		jfs_err("jfs_symlink: dtInsert returned %d", rc);
-		/* discard ne inode */
-		goto out3;
-
-	}
-
 	/* fix symlink access permission
 	 * (dir_create() ANDs in the u.u_cmask, 
 	 * but symlinks really need to be 777 access)
@@ -920,7 +904,7 @@
 	ip->i_mode |= 0777;
 
 	/*
-	   *       write symbolic link target path name
+	 * write symbolic link target path name
 	 */
 	xtInitRoot(tid, ip);
 
@@ -964,62 +948,60 @@
 		xsize = (ssize + bmask) & ~bmask;
 		xaddr = 0;
 		xlen = xsize >> JFS_SBI(sb)->l2bsize;
-		if ((rc = xtInsert(tid, ip, 0, 0, xlen, &xaddr, 0)) == 0) {
-			ip->i_size = ssize - 1;
-			while (ssize) {
-				int copy_size = min(ssize, PSIZE);
-
-				mp = get_metapage(ip, xaddr, PSIZE, 1);
-
-				if (mp == NULL) {
-					dtDelete(tid, dip, &dname, &ino,
-						 JFS_REMOVE);
-					rc = -EIO;
-					goto out3;
-				}
-				memcpy(mp->data, name, copy_size);
-				flush_metapage(mp);
-#if 0
-				set_buffer_uptodate(bp);
-				mark_buffer_dirty(bp, 1);
-				if (IS_SYNC(dip))
-					sync_dirty_buffer(bp);
-				brelse(bp);
-#endif				/* 0 */
-				ssize -= copy_size;
-				xaddr += JFS_SBI(sb)->nbperpage;
-			}
-			ip->i_blocks = LBLK2PBLK(sb, xlen);
-		} else {
-			dtDelete(tid, dip, &dname, &ino, JFS_REMOVE);
+		if ((rc = xtInsert(tid, ip, 0, 0, xlen, &xaddr, 0))) {
+			txAbort(tid, 0);
 			rc = -ENOSPC;
 			goto out3;
 		}
+		extent = xaddr;
+		ip->i_size = ssize - 1;
+		while (ssize) {
+			/* This is kind of silly since PATH_MAX == 4K */
+			int copy_size = min(ssize, PSIZE);
+
+			mp = get_metapage(ip, xaddr, PSIZE, 1);
+
+			if (mp == NULL) {
+				dbFree(ip, extent, xlen);
+				rc = -EIO;
+				txAbort(tid, 0);
+				goto out3;
+			}
+			memcpy(mp->data, name, copy_size);
+			flush_metapage(mp);
+			ssize -= copy_size;
+			name += copy_size;
+			xaddr += JFS_SBI(sb)->nbperpage;
+		}
+		ip->i_blocks = LBLK2PBLK(sb, xlen);
+	}
+
+	/*
+	 * create entry for symbolic link in parent directory
+	 */
+	rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE);
+	if (rc == 0) {
+		ino = ip->i_ino;
+		rc = dtInsert(tid, dip, &dname, &ino, &btstack);
+	}
+	if (rc) {
+		if (xlen)
+			dbFree(ip, extent, xlen);
+		txAbort(tid, 0);
+		/* discard new inode */
+		goto out3;
 	}
 
 	insert_inode_hash(ip);
 	mark_inode_dirty(ip);
-	d_instantiate(dentry, ip);
 
 	/*
 	 * commit update of parent directory and link object
-	 *
-	 * if extent allocation failed (ENOSPC),
-	 * the parent inode is committed regardless to avoid
-	 * backing out parent directory update (by dtInsert())
-	 * and subsequent dtDelete() which is harmless wrt 
-	 * integrity concern.  
-	 * the symlink inode will be freed by iput() at exit
-	 * as it has a zero link count (by dtDelete()) and 
-	 * no permanant resources. 
 	 */
 
 	iplist[0] = dip;
-	if (rc == 0) {
-		iplist[1] = ip;
-		rc = txCommit(tid, 2, &iplist[0], 0);
-	} else
-		rc = txCommit(tid, 1, &iplist[0], 0);
+	iplist[1] = ip;
+	rc = txCommit(tid, 2, &iplist[0], 0);
 
       out3:
 	txEnd(tid);
@@ -1028,7 +1010,8 @@
 	if (rc) {
 		ip->i_nlink = 0;
 		iput(ip);
-	}
+	} else
+		d_instantiate(dentry, ip);
 
       out2:
 	free_UCSname(&dname);
@@ -1221,7 +1204,7 @@
 			/* Linelock header of dtree */
 			tlck = txLock(tid, old_ip,
 				    (struct metapage *) &JFS_IP(old_ip)->bxflag,
-				      tlckDTREE | tlckBTROOT);
+				      tlckDTREE | tlckBTROOT | tlckRELINK);
 			dtlck = (struct dt_lock *) & tlck->lock;
 			ASSERT(dtlck->index == 0);
 			lv = & dtlck->lv[0];
@@ -1368,7 +1351,6 @@
 
 	insert_inode_hash(ip);
 	mark_inode_dirty(ip);
-	d_instantiate(dentry, ip);
 
 	dir->i_ctime = dir->i_mtime = CURRENT_TIME;
 
@@ -1385,7 +1367,8 @@
 	if (rc) {
 		ip->i_nlink = 0;
 		iput(ip);
-	}
+	} else
+		d_instantiate(dentry, ip);
 
       out1:
 	free_UCSname(&dname);
diff -Nru a/fs/jfs/super.c b/fs/jfs/super.c
--- a/fs/jfs/super.c	Tue Jun 15 22:20:40 2004
+++ b/fs/jfs/super.c	Tue Jun 15 22:20:40 2004
@@ -23,6 +23,7 @@
 #include <linux/parser.h>
 #include <linux/completion.h>
 #include <linux/vfs.h>
+#include <linux/moduleparam.h>
 #include <asm/uaccess.h>
 
 #include "jfs_incore.h"
@@ -44,15 +45,20 @@
 static struct export_operations jfs_export_operations;
 static struct file_system_type jfs_fs_type;
 
+#define MAX_COMMIT_THREADS 64
+static int commit_threads = 0;
+module_param(commit_threads, int, 0);
+MODULE_PARM_DESC(commit_threads, "Number of commit threads");
+
 int jfs_stop_threads;
 static pid_t jfsIOthread;
-static pid_t jfsCommitThread;
+static pid_t jfsCommitThread[MAX_COMMIT_THREADS];
 static pid_t jfsSyncThread;
 DECLARE_COMPLETION(jfsIOwait);
 
 #ifdef CONFIG_JFS_DEBUG
 int jfsloglevel = JFS_LOGLEVEL_WARN;
-MODULE_PARM(jfsloglevel, "i");
+module_param(jfsloglevel, int, 644);
 MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)");
 #endif
 
@@ -564,6 +570,7 @@
 
 static int __init init_jfs_fs(void)
 {
+	int i;
 	int rc;
 
 	jfs_inode_cachep =
@@ -600,12 +607,23 @@
 	}
 	wait_for_completion(&jfsIOwait);	/* Wait until thread starts */
 
-	jfsCommitThread = kernel_thread(jfs_lazycommit, 0, CLONE_KERNEL);
-	if (jfsCommitThread < 0) {
-		jfs_err("init_jfs_fs: fork failed w/rc = %d", jfsCommitThread);
-		goto kill_iotask;
+	if (commit_threads < 1)
+		commit_threads = num_online_cpus();
+	else if (commit_threads > MAX_COMMIT_THREADS)
+		commit_threads = MAX_COMMIT_THREADS;
+
+	for (i = 0; i < commit_threads; i++) {
+		jfsCommitThread[i] = kernel_thread(jfs_lazycommit, 0,
+						   CLONE_KERNEL);
+		if (jfsCommitThread[i] < 0) {
+			jfs_err("init_jfs_fs: fork failed w/rc = %d",
+				jfsCommitThread[i]);
+			commit_threads = i;
+			goto kill_committask;
+		}
+		/* Wait until thread starts */
+		wait_for_completion(&jfsIOwait);
 	}
-	wait_for_completion(&jfsIOwait);	/* Wait until thread starts */
 
 	jfsSyncThread = kernel_thread(jfs_sync, 0, CLONE_KERNEL);
 	if (jfsSyncThread < 0) {
@@ -622,10 +640,10 @@
 
 kill_committask:
 	jfs_stop_threads = 1;
-	wake_up(&jfs_commit_thread_wait);
-	wait_for_completion(&jfsIOwait);	/* Wait for thread exit */
-kill_iotask:
-	jfs_stop_threads = 1;
+	wake_up_all(&jfs_commit_thread_wait);
+	for (i = 0; i < commit_threads; i++)
+		wait_for_completion(&jfsIOwait);
+
 	wake_up(&jfs_IO_thread_wait);
 	wait_for_completion(&jfsIOwait);	/* Wait for thread exit */
 end_txmngr:
@@ -639,6 +657,8 @@
 
 static void __exit exit_jfs_fs(void)
 {
+	int i;
+
 	jfs_info("exit_jfs_fs called");
 
 	jfs_stop_threads = 1;
@@ -646,8 +666,9 @@
 	metapage_exit();
 	wake_up(&jfs_IO_thread_wait);
 	wait_for_completion(&jfsIOwait);	/* Wait until IO thread exits */
-	wake_up(&jfs_commit_thread_wait);
-	wait_for_completion(&jfsIOwait);	/* Wait until Commit thread exits */
+	wake_up_all(&jfs_commit_thread_wait);
+	for (i = 0; i < commit_threads; i++)
+		wait_for_completion(&jfsIOwait);
 	wake_up(&jfs_sync_thread_wait);
 	wait_for_completion(&jfsIOwait);	/* Wait until Sync thread exits */
 #ifdef PROC_FS_JFS
diff -Nru a/fs/jfs/xattr.c b/fs/jfs/xattr.c
--- a/fs/jfs/xattr.c	Tue Jun 15 22:20:39 2004
+++ b/fs/jfs/xattr.c	Tue Jun 15 22:20:39 2004
@@ -550,7 +550,8 @@
 	}
 	ea_buf->flag = EA_EXTENT;
 	ea_buf->mp = read_metapage(inode, addressDXD(&ji->ea),
-				   lengthDXD(&ji->ea), 1);
+				   lengthDXD(&ji->ea) << sb->s_blocksize_bits,
+				   1);
 	if (ea_buf->mp == NULL)
 		return -EIO;
 	ea_buf->xattr = ea_buf->mp->data;
@@ -687,17 +688,26 @@
 			}
 			inode->i_mode = mode;
 			mark_inode_dirty(inode);
-			if (rc == 0)
-				value = NULL;
 		}
 		/*
 		 * We're changing the ACL.  Get rid of the cached one
 		 */
 		acl =JFS_IP(inode)->i_acl;
-		if (acl && (acl != JFS_ACL_NOT_CACHED))
+		if (acl != JFS_ACL_NOT_CACHED)
 			posix_acl_release(acl);
 		JFS_IP(inode)->i_acl = JFS_ACL_NOT_CACHED;
+
+		return 0;
 	} else if (strcmp(name, XATTR_NAME_ACL_DEFAULT) == 0) {
+		acl = posix_acl_from_xattr(value, value_len);
+		if (IS_ERR(acl)) {
+			rc = PTR_ERR(acl);
+			printk(KERN_ERR "posix_acl_from_xattr returned %d\n",
+			       rc);
+			return rc;
+		}
+		posix_acl_release(acl);
+
 		/*
 		 * We're changing the default ACL.  Get rid of the cached one
 		 */
@@ -705,13 +715,11 @@
 		if (acl && (acl != JFS_ACL_NOT_CACHED))
 			posix_acl_release(acl);
 		JFS_IP(inode)->i_default_acl = JFS_ACL_NOT_CACHED;
-	} else
-		/* Invalid xattr name */
-		return -EINVAL;
-	return 0;
-#else			/* CONFIG_JFS_POSIX_ACL */
-	return -EOPNOTSUPP;
+
+		return 0;
+	}
 #endif			/* CONFIG_JFS_POSIX_ACL */
+	return -EOPNOTSUPP;
 }
 
 static int can_set_xattr(struct inode *inode, const char *name,
@@ -737,11 +745,7 @@
 	    (!S_ISDIR(inode->i_mode) || inode->i_mode &S_ISVTX))
 		return -EPERM;
 
-#ifdef CONFIG_JFS_POSIX_ACL
-	return jfs_permission(inode, MAY_WRITE, NULL);
-#else
 	return permission(inode, MAY_WRITE, NULL);
-#endif
 }
 
 int __jfs_setxattr(struct inode *inode, const char *name, const void *value,
@@ -900,13 +904,9 @@
 
 static int can_get_xattr(struct inode *inode, const char *name)
 {
-#ifdef CONFIG_JFS_POSIX_ACL
 	if(strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) == 0)
 		return 0;
-	return jfs_permission(inode, MAY_READ, NULL);
-#else
 	return permission(inode, MAY_READ, NULL);
-#endif
 }
 
 ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
diff -Nru a/fs/locks.c b/fs/locks.c
--- a/fs/locks.c	Tue Jun 15 22:21:03 2004
+++ b/fs/locks.c	Tue Jun 15 22:21:03 2004
@@ -1720,6 +1720,9 @@
 				lease_modify(before, F_UNLCK);
 				continue;
 			}
+			/* FL_POSIX locks of this process have already been
+			 * removed in filp_close->locks_remove_posix.
+			 */
 			BUG();
  		}
 		before = &fl->fl_next;
@@ -1813,7 +1816,7 @@
 			       : (fl->fl_type & F_WRLCK) ? "WRITE" : "READ ");
 	}
 	if (inode) {
-#if WE_CAN_BREAK_LSLK_NOW
+#ifdef WE_CAN_BREAK_LSLK_NOW
 		out += sprintf(out, "%d %s:%ld ", fl->fl_pid,
 				inode->i_sb->s_id, inode->i_ino);
 #else
@@ -1979,30 +1982,59 @@
 
 EXPORT_SYMBOL(lock_may_write);
 
+static inline void __steal_locks(struct file *file, fl_owner_t from)
+{
+	struct inode *inode = file->f_dentry->d_inode;
+	struct file_lock *fl = inode->i_flock;
+
+	while (fl) {
+		if (fl->fl_file == file && fl->fl_owner == from)
+			fl->fl_owner = current->files;
+		fl = fl->fl_next;
+	}
+}
+
+/* When getting ready for executing a binary, we make sure that current
+ * has a files_struct on its own. Before dropping the old files_struct,
+ * we take over ownership of all locks for all file descriptors we own.
+ * Note that we may accidentally steal a lock for a file that a sibling
+ * has created since the unshare_files() call.
+ */
 void steal_locks(fl_owner_t from)
 {
-	struct list_head *tmp;
+	struct files_struct *files = current->files;
+	int i, j;
 
-	if (from == current->files)
+	if (from == files)
 		return;
 
 	lock_kernel();
-	list_for_each(tmp, &file_lock_list) {
-		struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
-		if (fl->fl_owner == from)
-			fl->fl_owner = current->files;
+	j = 0;
+	for (;;) {
+		unsigned long set;
+		i = j * __NFDBITS;
+		if (i >= files->max_fdset || i >= files->max_fds)
+			break;
+		set = files->open_fds->fds_bits[j++];
+		while (set) {
+			if (set & 1) {
+				struct file *file = files->fd[i];
+				if (file)
+					__steal_locks(file, from);
+			}
+			i++;
+			set >>= 1;
+		}
 	}
 	unlock_kernel();
 }
-
 EXPORT_SYMBOL(steal_locks);
 
 static int __init filelock_init(void)
 {
 	filelock_cache = kmem_cache_create("file_lock_cache",
-			sizeof(struct file_lock), 0, 0, init_once, NULL);
-	if (!filelock_cache)
-		panic("cannot create file lock slab cache");
+			sizeof(struct file_lock), 0, SLAB_PANIC,
+			init_once, NULL);
 	return 0;
 }
 
diff -Nru a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c	Tue Jun 15 22:20:39 2004
+++ b/fs/namei.c	Tue Jun 15 22:20:39 2004
@@ -1759,7 +1759,7 @@
 	goto exit2;
 }
 
-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
+int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
 {
 	int error = may_create(dir, dentry, NULL);
 
@@ -1803,7 +1803,7 @@
 		dentry = lookup_create(&nd, 0);
 		error = PTR_ERR(dentry);
 		if (!IS_ERR(dentry)) {
-			error = vfs_symlink(nd.dentry->d_inode, dentry, from);
+			error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
 			dput(dentry);
 		}
 		up(&nd.dentry->d_inode->i_sem);
diff -Nru a/fs/namespace.c b/fs/namespace.c
--- a/fs/namespace.c	Tue Jun 15 22:20:42 2004
+++ b/fs/namespace.c	Tue Jun 15 22:20:42 2004
@@ -22,6 +22,7 @@
 #include <linux/security.h>
 #include <linux/mount.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 extern int __init init_rootfs(void);
 
@@ -36,6 +37,7 @@
 
 /* spinlock for vfsmount related operations, inplace of dcache_lock */
 spinlock_t vfsmount_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
+
 static struct list_head *mount_hashtable;
 static int hash_mask, hash_bits;
 static kmem_cache_t *mnt_cache; 
@@ -259,7 +261,65 @@
 	.show	= show_vfsmnt
 };
 
-/*
+/**
+ * may_umount_tree - check if a mount tree is busy
+ * @mnt: root of mount tree
+ *
+ * This is called to check if a tree of mounts has any
+ * open files, pwds, chroots or sub mounts that are
+ * busy.
+ */
+int may_umount_tree(struct vfsmount *mnt)
+{
+	struct list_head *next;
+	struct vfsmount *this_parent = mnt;
+	int actual_refs;
+	int minimum_refs;
+
+	spin_lock(&vfsmount_lock);
+	actual_refs = atomic_read(&mnt->mnt_count);
+	minimum_refs = 2;
+repeat:
+	next = this_parent->mnt_mounts.next;
+resume:
+	while (next != &this_parent->mnt_mounts) {
+		struct vfsmount *p = list_entry(next, struct vfsmount, mnt_child);
+
+		next = next->next;
+
+		actual_refs += atomic_read(&p->mnt_count);
+		minimum_refs += 2;
+
+		if (!list_empty(&p->mnt_mounts)) {
+			this_parent = p;
+			goto repeat;
+		}
+	}
+
+	if (this_parent != mnt) {
+		next = this_parent->mnt_child.next;
+		this_parent = this_parent->mnt_parent;
+		goto resume;
+	}
+	spin_unlock(&vfsmount_lock);
+
+	if (actual_refs > minimum_refs)
+		return -EBUSY;
+
+	return 0;
+}
+
+EXPORT_SYMBOL(may_umount_tree);
+
+/**
+ * may_umount - check if a mount point is busy
+ * @mnt: root of mount
+ *
+ * This is called to check if a mount point has any
+ * open files, pwds, chroots or sub mounts. If the
+ * mount has sub mounts this will return busy
+ * regardless of whether the sub mounts are busy.
+ *
  * Doesn't take quota and stuff into account. IOW, in some cases it will
  * give false negatives. The main reason why it's here is that we need
  * a non-destructive way to look for easily umountable filesystems.
@@ -406,6 +466,8 @@
 	return retval;
 }
 
+#ifdef __ARCH_WANT_SYS_OLDUMOUNT
+
 /*
  *	The 2.0 compatible umount. No flags. 
  */
@@ -415,6 +477,8 @@
 	return sys_umount(name,0);
 }
 
+#endif
+
 static int mount_is_safe(struct nameidata *nd)
 {
 	if (capable(CAP_SYS_ADMIN))
@@ -1142,9 +1206,7 @@
 	int i;
 
 	mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct vfsmount),
-					0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!mnt_cache)
-		panic("Cannot create vfsmount cache");
+			0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 
 	order = 0; 
 	mount_hashtable = (struct list_head *)
diff -Nru a/fs/ncpfs/file.c b/fs/ncpfs/file.c
--- a/fs/ncpfs/file.c	Tue Jun 15 22:20:36 2004
+++ b/fs/ncpfs/file.c	Tue Jun 15 22:20:36 2004
@@ -99,7 +99,7 @@
 }
 
 static ssize_t
-ncp_file_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
 	struct dentry *dentry = file->f_dentry;
 	struct inode *inode = dentry->d_inode;
@@ -187,7 +187,7 @@
 }
 
 static ssize_t
-ncp_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
 	struct dentry *dentry = file->f_dentry;
 	struct inode *inode = dentry->d_inode;
diff -Nru a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c
--- a/fs/ncpfs/ncplib_kernel.c	Tue Jun 15 22:20:40 2004
+++ b/fs/ncpfs/ncplib_kernel.c	Tue Jun 15 22:20:40 2004
@@ -1002,7 +1002,7 @@
  */
 int
 ncp_read_bounce(struct ncp_server *server, const char *file_id,
-	 __u32 offset, __u16 to_read, char *target, int *bytes_read,
+	 __u32 offset, __u16 to_read, char __user *target, int *bytes_read,
 	 void* bounce, __u32 bufsize)
 {
 	int result;
diff -Nru a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h
--- a/fs/ncpfs/ncplib_kernel.h	Tue Jun 15 22:20:38 2004
+++ b/fs/ncpfs/ncplib_kernel.h	Tue Jun 15 22:20:38 2004
@@ -56,7 +56,7 @@
 	return sizeof(struct ncp_reply_header) + 2 + 2 + size + 8;
 };
 int ncp_read_bounce(struct ncp_server *, const char *, __u32, __u16, 
-		char *, int *, void* bounce, __u32 bouncelen);
+		char __user *, int *, void* bounce, __u32 bouncelen);
 int ncp_read_kernel(struct ncp_server *, const char *, __u32, __u16, 
 		char *, int *);
 int ncp_write_kernel(struct ncp_server *, const char *, __u32, __u16,
diff -Nru a/fs/nfs/direct.c b/fs/nfs/direct.c
--- a/fs/nfs/direct.c	Tue Jun 15 22:20:58 2004
+++ b/fs/nfs/direct.c	Tue Jun 15 22:20:58 2004
@@ -32,6 +32,7 @@
  * 18 Dec 2001	Initial implementation for 2.4  --cel
  * 08 Jul 2002	Version for 2.4.19, with bug fixes --trondmy
  * 08 Jun 2003	Port to 2.5 APIs  --cel
+ * 31 Mar 2004	Handle direct I/O without VFS support  --cel
  *
  */
 
@@ -252,9 +253,7 @@
 {
 	const unsigned int wsize = NFS_SERVER(inode)->wsize;
 	size_t request;
-	int need_commit;
-	int tot_bytes;
-	int curpage;
+	int curpage, need_commit, result, tot_bytes;
 	struct nfs_writeverf first_verf;
 	struct nfs_write_data	wdata = {
 		.inode		= inode,
@@ -281,8 +280,6 @@
 	wdata.args.pgbase = user_addr & ~PAGE_MASK;
 	wdata.args.offset = file_offset;
         do {
-		int result;
-
 		wdata.args.count = request;
                 if (wdata.args.count > wsize)
                         wdata.args.count = wsize;
@@ -299,7 +296,7 @@
 		if (result <= 0) {
 			if (tot_bytes > 0)
 				break;
-			return result;
+			goto out;
 		}
 
 		if (tot_bytes == 0)
@@ -324,8 +321,6 @@
 	 * Commit data written so far, even in the event of an error
 	 */
 	if (need_commit) {
-		int result;
-
 		wdata.args.count = tot_bytes;
 		wdata.args.offset = file_offset;
 
@@ -338,9 +333,12 @@
 						VERF_SIZE) != 0)
 			goto sync_retry;
 	}
+	result = tot_bytes;
+
+out:
 	nfs_end_data_update_defer(inode);
 
-	return tot_bytes;
+	return result;
 
 sync_retry:
 	wdata.args.stable = NFS_FILE_SYNC;
@@ -409,12 +407,6 @@
  * file_offset: offset in file to begin the operation
  * nr_segs: size of iovec array
  *
- * Usually a file system implements direct I/O by calling out to
- * blockdev_direct_IO.  The NFS client doesn't have a backing block
- * device, so we do everything by hand instead.
- *
- * The inode's i_sem is no longer held by the VFS layer before it calls
- * this function to do a write.
  */
 ssize_t
 nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
@@ -429,11 +421,7 @@
 	 * No support for async yet
 	 */
 	if (!is_sync_kiocb(iocb))
-		goto out;
-
-	result = nfs_revalidate_inode(NFS_SERVER(inode), inode);
-	if (result < 0)
-		goto out;
+		return result;
 
 	switch (rw) {
 	case READ:
@@ -453,8 +441,160 @@
 	default:
 		break;
 	}
+	return result;
+}
+
+/**
+ * nfs_file_direct_read - file direct read operation for NFS files
+ * @iocb: target I/O control block
+ * @buf: user's buffer into which to read data
+ * count: number of bytes to read
+ * pos: byte offset in file where reading starts
+ *
+ * We use this function for direct reads instead of calling
+ * generic_file_aio_read() in order to avoid gfar's check to see if
+ * the request starts before the end of the file.  For that check
+ * to work, we must generate a GETATTR before each direct read, and
+ * even then there is a window between the GETATTR and the subsequent
+ * READ where the file size could change.  So our preference is simply
+ * to do all reads the application wants, and the server will take
+ * care of managing the end of file boundary.
+ * 
+ * This function also eliminates unnecessarily updating the file's
+ * atime locally, as the NFS server sets the file's atime, and this
+ * client must read the updated atime from the server back into its
+ * cache.
+ */
+ssize_t
+nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos)
+{
+	ssize_t retval = -EINVAL;
+	loff_t *ppos = &iocb->ki_pos;
+	struct file *file = iocb->ki_filp;
+	struct dentry *dentry = file->f_dentry;
+	struct address_space *mapping = file->f_mapping;
+	struct inode *inode = mapping->host;
+	struct iovec iov = {
+		.iov_base = (char *)buf,
+		.iov_len = count,
+	};
+
+	dprintk("nfs: direct read(%s/%s, %lu@%lu)\n",
+		dentry->d_parent->d_name.name, dentry->d_name.name,
+		(unsigned long) count, (unsigned long) pos);
+
+	if (!is_sync_kiocb(iocb))
+		goto out;
+	if (count < 0)
+		goto out;
+	retval = -EFAULT;
+	if (!access_ok(VERIFY_WRITE, iov.iov_base, iov.iov_len))
+		goto out;
+	retval = 0;
+	if (!count)
+		goto out;
+
+	if (mapping->nrpages) {
+		retval = filemap_fdatawrite(mapping);
+		if (retval == 0)
+			retval = filemap_fdatawait(mapping);
+		if (retval)
+			goto out;
+	}
+
+	retval = nfs_direct_read(inode, file, &iov, pos, 1);
+	if (retval > 0)
+		*ppos = pos + retval;
 
 out:
-	dprintk("NFS: direct_IO result=%zd\n", result);
-	return result;
+	return retval;
+}
+
+/**
+ * nfs_file_direct_write - file direct write operation for NFS files
+ * @iocb: target I/O control block
+ * @buf: user's buffer from which to write data
+ * count: number of bytes to write
+ * pos: byte offset in file where writing starts
+ *
+ * We use this function for direct writes instead of calling
+ * generic_file_aio_write() in order to avoid taking the inode
+ * semaphore and updating the i_size.  The NFS server will set
+ * the new i_size and this client must read the updated size
+ * back into its cache.  We let the server do generic write
+ * parameter checking and report problems.
+ *
+ * We also avoid an unnecessary invocation of generic_osync_inode(),
+ * as it is fairly meaningless to sync the metadata of an NFS file.
+ *
+ * We eliminate local atime updates, see direct read above.
+ *
+ * We avoid unnecessary page cache invalidations for normal cached
+ * readers of this file.
+ *
+ * Note that O_APPEND is not supported for NFS direct writes, as there
+ * is no atomic O_APPEND write facility in the NFS protocol.
+ */
+ssize_t
+nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos)
+{
+	ssize_t retval = -EINVAL;
+	loff_t *ppos = &iocb->ki_pos;
+	unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
+	struct file *file = iocb->ki_filp;
+	struct dentry *dentry = file->f_dentry;
+	struct address_space *mapping = file->f_mapping;
+	struct inode *inode = mapping->host;
+	struct iovec iov = {
+		.iov_base = (char __user *)buf,
+		.iov_len = count,
+	};
+
+	dfprintk(VFS, "nfs: direct write(%s/%s(%ld), %lu@%lu)\n",
+		dentry->d_parent->d_name.name, dentry->d_name.name,
+		inode->i_ino, (unsigned long) count, (unsigned long) pos);
+
+	if (!is_sync_kiocb(iocb))
+		goto out;
+	if (count < 0)
+		goto out;
+        if (pos < 0)
+		goto out;
+	retval = -EFAULT;
+	if (!access_ok(VERIFY_READ, iov.iov_base, iov.iov_len))
+		goto out;
+        if (file->f_error) {
+                retval = file->f_error;
+                file->f_error = 0;
+                goto out;
+        }
+	retval = -EFBIG;
+	if (limit != RLIM_INFINITY) {
+		if (pos >= limit) {
+			send_sig(SIGXFSZ, current, 0);
+			goto out;
+		}
+		if (count > limit - (unsigned long) pos)
+			count = limit - (unsigned long) pos;
+	}
+	retval = 0;
+	if (!count)
+		goto out;
+
+	if (mapping->nrpages) {
+		retval = filemap_fdatawrite(mapping);
+		if (retval == 0)
+			retval = filemap_fdatawait(mapping);
+		if (retval)
+			goto out;
+	}
+
+	retval = nfs_direct_write(inode, file, &iov, pos, 1);
+	if (mapping->nrpages)
+		invalidate_inode_pages2(mapping);
+	if (retval > 0)
+		*ppos = pos + retval;
+
+out:
+	return retval;
 }
diff -Nru a/fs/nfs/file.c b/fs/nfs/file.c
--- a/fs/nfs/file.c	Tue Jun 15 22:20:42 2004
+++ b/fs/nfs/file.c	Tue Jun 15 22:20:42 2004
@@ -38,9 +38,9 @@
 static int nfs_file_open(struct inode *, struct file *);
 static int nfs_file_release(struct inode *, struct file *);
 static int  nfs_file_mmap(struct file *, struct vm_area_struct *);
-static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
-static ssize_t nfs_file_read(struct kiocb *, char *, size_t, loff_t);
-static ssize_t nfs_file_write(struct kiocb *, const char *, size_t, loff_t);
+static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void __user *);
+static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t);
+static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t);
 static int  nfs_file_flush(struct file *);
 static int  nfs_fsync(struct file *, struct dentry *dentry, int datasync);
 
@@ -148,12 +148,17 @@
 }
 
 static ssize_t
-nfs_file_read(struct kiocb *iocb, char * buf, size_t count, loff_t pos)
+nfs_file_read(struct kiocb *iocb, char __user * buf, size_t count, loff_t pos)
 {
 	struct dentry * dentry = iocb->ki_filp->f_dentry;
 	struct inode * inode = dentry->d_inode;
 	ssize_t result;
 
+#ifdef CONFIG_NFS_DIRECTIO
+	if (iocb->ki_filp->f_flags & O_DIRECT)
+		return nfs_file_direct_read(iocb, buf, count, pos);
+#endif
+
 	dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n",
 		dentry->d_parent->d_name.name, dentry->d_name.name,
 		(unsigned long) count, (unsigned long) pos);
@@ -166,7 +171,7 @@
 
 static ssize_t
 nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count,
-		read_actor_t actor, void *target)
+		read_actor_t actor, void __user *target)
 {
 	struct dentry *dentry = filp->f_dentry;
 	struct inode *inode = dentry->d_inode;
@@ -262,11 +267,16 @@
  * Write to a file (through the page cache).
  */
 static ssize_t
-nfs_file_write(struct kiocb *iocb, const char *buf, size_t count, loff_t pos)
+nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos)
 {
 	struct dentry * dentry = iocb->ki_filp->f_dentry;
 	struct inode * inode = dentry->d_inode;
 	ssize_t result;
+
+#ifdef CONFIG_NFS_DIRECTIO
+	if (iocb->ki_filp->f_flags & O_DIRECT)
+		return nfs_file_direct_write(iocb, buf, count, pos);
+#endif
 
 	dfprintk(VFS, "nfs: write(%s/%s(%ld), %lu@%lu)\n",
 		dentry->d_parent->d_name.name, dentry->d_name.name,
diff -Nru a/fs/nfs/inode.c b/fs/nfs/inode.c
--- a/fs/nfs/inode.c	Tue Jun 15 22:20:43 2004
+++ b/fs/nfs/inode.c	Tue Jun 15 22:20:43 2004
@@ -237,7 +237,7 @@
 
 	error = server->rpc_ops->getroot(server, rootfh, fsinfo);
 	if (error < 0) {
-		printk(KERN_NOTICE "nfs_get_root: getattr error = %d\n", -error);
+		dprintk("nfs_get_root: getattr error = %d\n", -error);
 		return ERR_PTR(error);
 	}
 
@@ -262,6 +262,7 @@
 	struct nfs_pathconf pathinfo = {
 			.fattr = &fattr,
 	};
+	int no_root_error = 0;
 
 	/* We probably want something more informative here */
 	snprintf(sb->s_id, sizeof(sb->s_id), "%x:%x", MAJOR(sb->s_dev), MINOR(sb->s_dev));
@@ -272,12 +273,15 @@
 
 	root_inode = nfs_get_root(sb, &server->fh, &fsinfo);
 	/* Did getting the root inode fail? */
-	if (IS_ERR(root_inode))
+	if (IS_ERR(root_inode)) {
+		no_root_error = PTR_ERR(root_inode);
 		goto out_no_root;
+	}
 	sb->s_root = d_alloc_root(root_inode);
-	if (!sb->s_root)
+	if (!sb->s_root) {
+		no_root_error = -ENOMEM;
 		goto out_no_root;
-
+	}
 	sb->s_root->d_op = server->rpc_ops->dentry_ops;
 
 	/* Get some general file system info */
@@ -337,10 +341,10 @@
 	return 0;
 	/* Yargs. It didn't work out. */
 out_no_root:
-	printk("nfs_read_super: get root inode failed\n");
+	dprintk("nfs_sb_init: get root inode failed: errno %d\n", -no_root_error);
 	if (!IS_ERR(root_inode))
 		iput(root_inode);
-	return -EINVAL;
+	return no_root_error;
 }
 
 /*
diff -Nru a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
--- a/fs/nfs/nfs2xdr.c	Tue Jun 15 22:20:39 2004
+++ b/fs/nfs/nfs2xdr.c	Tue Jun 15 22:20:39 2004
@@ -511,8 +511,8 @@
 nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args)
 {
 	struct rpc_auth *auth = req->rq_task->tk_auth;
+	unsigned int count = args->count - 5;
 	unsigned int replen;
-	u32 count = args->count - 4;
 
 	p = xdr_encode_fhandle(p, args->fh);
 	req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
@@ -547,12 +547,15 @@
 	strlen = (u32*)kmap_atomic(rcvbuf->pages[0], KM_USER0);
 	/* Convert length of symlink */
 	len = ntohl(*strlen);
-	if (len > rcvbuf->page_len)
-		len = rcvbuf->page_len;
+	if (len > rcvbuf->page_len) {
+		dprintk(KERN_WARNING "nfs: server returned giant symlink!\n");
+		kunmap_atomic(strlen, KM_USER0);
+		return -ENAMETOOLONG;
+	}
 	*strlen = len;
 	/* NULL terminate the string we got */
 	string = (char *)(strlen + 1);
-	string[len] = 0;
+	string[len] = '\0';
 	kunmap_atomic(strlen, KM_USER0);
 	return 0;
 }
diff -Nru a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
--- a/fs/nfs/nfs3xdr.c	Tue Jun 15 22:21:05 2004
+++ b/fs/nfs/nfs3xdr.c	Tue Jun 15 22:21:05 2004
@@ -702,8 +702,8 @@
 nfs3_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs3_readlinkargs *args)
 {
 	struct rpc_auth *auth = req->rq_task->tk_auth;
+	unsigned int count = args->count - 5;
 	unsigned int replen;
-	u32 count = args->count - 4;
 
 	p = xdr_encode_fhandle(p, args->fh);
 	req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
@@ -742,12 +742,15 @@
 	strlen = (u32*)kmap_atomic(rcvbuf->pages[0], KM_USER0);
 	/* Convert length of symlink */
 	len = ntohl(*strlen);
-	if (len > rcvbuf->page_len)
-		len = rcvbuf->page_len;
+	if (len > rcvbuf->page_len) {
+		dprintk(KERN_WARNING "nfs: server returned giant symlink!\n");
+		kunmap_atomic(strlen, KM_USER0);
+		return -ENAMETOOLONG;
+	}
 	*strlen = len;
 	/* NULL terminate the string we got */
 	string = (char *)(strlen + 1);
-	string[len] = 0;
+	string[len] = '\0';
 	kunmap_atomic(strlen, KM_USER0);
 	return 0;
 }
diff -Nru a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
--- a/fs/nfs/nfs4state.c	Tue Jun 15 22:20:36 2004
+++ b/fs/nfs/nfs4state.c	Tue Jun 15 22:20:36 2004
@@ -731,6 +731,8 @@
 	int status = 0;
 
 	list_for_each_entry(state, &sp->so_states, open_states) {
+		if (state->state == 0)
+			continue;
 		status = nfs4_open_reclaim(sp, state);
 		if (status >= 0)
 			continue;
diff -Nru a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
--- a/fs/nfs/nfs4xdr.c	Tue Jun 15 22:21:05 2004
+++ b/fs/nfs/nfs4xdr.c	Tue Jun 15 22:21:05 2004
@@ -947,7 +947,8 @@
 static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req)
 {
 	struct rpc_auth *auth = req->rq_task->tk_auth;
-	int replen;
+	unsigned int count = readlink->count - 5;
+	unsigned int replen;
 	uint32_t *p;
 
 	RESERVE_SPACE(4);
@@ -958,7 +959,7 @@
 	 *      + OP_READLINK + status  = 7
 	 */
 	replen = (RPC_REPHDRSIZE + auth->au_rslack + 7) << 2;
-	xdr_inline_pages(&req->rq_rcv_buf, replen, readlink->pages, 0, readlink->count);
+	xdr_inline_pages(&req->rq_rcv_buf, replen, readlink->pages, 0, count);
 	
 	return 0;
 }
@@ -2921,10 +2922,10 @@
 	 */
 	strlen = (uint32_t *) kmap_atomic(rcvbuf->pages[0], KM_USER0);
 	len = ntohl(*strlen);
-	if (len > PAGE_CACHE_SIZE - 5) {
-		printk(KERN_WARNING "nfs: server returned giant symlink!\n");
+	if (len > rcvbuf->page_len) {
+		dprintk(KERN_WARNING "nfs: server returned giant symlink!\n");
 		kunmap_atomic(strlen, KM_USER0);
-		return -EIO;
+		return -ENAMETOOLONG;
 	}
 	*strlen = len;
 
diff -Nru a/fs/nfs/read.c b/fs/nfs/read.c
--- a/fs/nfs/read.c	Tue Jun 15 22:20:35 2004
+++ b/fs/nfs/read.c	Tue Jun 15 22:20:35 2004
@@ -43,14 +43,12 @@
 
 #define MIN_POOL_READ	(32)
 
-static __inline__ struct nfs_read_data *nfs_readdata_alloc(void)
+static struct nfs_read_data *nfs_readdata_alloc(void)
 {
 	struct nfs_read_data   *p;
 	p = (struct nfs_read_data *)mempool_alloc(nfs_rdata_mempool, SLAB_NOFS);
-	if (p) {
+	if (p)
 		memset(p, 0, sizeof(*p));
-		INIT_LIST_HEAD(&p->pages);
-	}
 	return p;
 }
 
@@ -99,21 +97,22 @@
 	unsigned int	rsize = NFS_SERVER(inode)->rsize;
 	unsigned int	count = PAGE_CACHE_SIZE;
 	int		result;
-	struct nfs_read_data	rdata = {
-		.flags		= (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0),
-		.cred		= NULL,
-		.inode		= inode,
-		.args		= {
-			.fh		= NFS_FH(inode),
-			.lockowner	= current->files,
-			.pages		= &page,
-			.pgbase		= 0UL,
-			.count		= rsize,
-		},
-		.res		= {
-			.fattr		= &rdata.fattr,
-		}
-	};
+	struct nfs_read_data *rdata;
+
+	rdata = nfs_readdata_alloc();
+	if (!rdata)
+		return -ENOMEM;
+
+	memset(rdata, 0, sizeof(*rdata));
+	rdata->flags = (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
+	rdata->inode = inode;
+	INIT_LIST_HEAD(&rdata->pages);
+	rdata->args.fh = NFS_FH(inode);
+	rdata->args.lockowner = current->files;
+	rdata->args.pages = &page;
+	rdata->args.pgbase = 0UL;
+	rdata->args.count = rsize;
+	rdata->res.fattr = &rdata->fattr;
 
 	dprintk("NFS: nfs_readpage_sync(%p)\n", page);
 
@@ -123,19 +122,19 @@
 	 */
 	do {
 		if (count < rsize)
-			rdata.args.count = count;
-		rdata.res.count = rdata.args.count;
-		rdata.args.offset = page_offset(page) + rdata.args.pgbase;
+			rdata->args.count = count;
+		rdata->res.count = rdata->args.count;
+		rdata->args.offset = page_offset(page) + rdata->args.pgbase;
 
 		dprintk("NFS: nfs_proc_read(%s, (%s/%Ld), %Lu, %u)\n",
 			NFS_SERVER(inode)->hostname,
 			inode->i_sb->s_id,
 			(long long)NFS_FILEID(inode),
-			(unsigned long long)rdata.args.pgbase,
-			rdata.args.count);
+			(unsigned long long)rdata->args.pgbase,
+			rdata->args.count);
 
 		lock_kernel();
-		result = NFS_PROTO(inode)->read(&rdata, file);
+		result = NFS_PROTO(inode)->read(rdata, file);
 		unlock_kernel();
 
 		/*
@@ -148,17 +147,17 @@
 			goto io_error;
 		}
 		count -= result;
-		rdata.args.pgbase += result;
+		rdata->args.pgbase += result;
 		/* Note: result == 0 should only happen if we're caching
 		 * a write that extends the file and punches a hole.
 		 */
-		if (rdata.res.eof != 0 || result == 0)
+		if (rdata->res.eof != 0 || result == 0)
 			break;
 	} while (count);
 	NFS_FLAGS(inode) |= NFS_INO_INVALID_ATIME;
 
 	if (count)
-		memclear_highpage_flush(page, rdata.args.pgbase, count);
+		memclear_highpage_flush(page, rdata->args.pgbase, count);
 	SetPageUptodate(page);
 	if (PageError(page))
 		ClearPageError(page);
@@ -166,6 +165,7 @@
 
 io_error:
 	unlock_page(page);
+	nfs_readdata_free(rdata);
 	return result;
 }
 
@@ -305,6 +305,7 @@
 		data = nfs_readdata_alloc();
 		if (!data)
 			goto out_bad;
+		INIT_LIST_HEAD(&data->pages);
 		list_add(&data->pages, &list);
 		requests++;
 		if (nbytes <= rsize)
@@ -361,6 +362,7 @@
 	if (!data)
 		goto out_bad;
 
+	INIT_LIST_HEAD(&data->pages);
 	pages = data->pagevec;
 	count = 0;
 	while (!list_empty(head)) {
diff -Nru a/fs/nfs/unlink.c b/fs/nfs/unlink.c
--- a/fs/nfs/unlink.c	Tue Jun 15 22:21:03 2004
+++ b/fs/nfs/unlink.c	Tue Jun 15 22:21:03 2004
@@ -180,7 +180,9 @@
 	task->tk_action = nfs_async_unlink_init;
 	task->tk_release = nfs_async_unlink_release;
 
+	spin_lock(&dentry->d_lock);
 	dentry->d_flags |= DCACHE_NFSFS_RENAMED;
+	spin_unlock(&dentry->d_lock);
 	data->cred = rpcauth_lookupcred(clnt->cl_auth, 0);
 
 	rpc_sleep_on(&nfs_delete_queue, task, NULL, NULL);
@@ -210,7 +212,9 @@
 		return;
 	data->count++;
 	nfs_copy_dname(dentry, data);
+	spin_lock(&dentry->d_lock);
 	dentry->d_flags &= ~DCACHE_NFSFS_RENAMED;
+	spin_unlock(&dentry->d_lock);
 	if (data->task.tk_rpcwait == &nfs_delete_queue)
 		rpc_wake_up_task(&data->task);
 	nfs_put_unlinkdata(data);
diff -Nru a/fs/nfs/write.c b/fs/nfs/write.c
--- a/fs/nfs/write.c	Tue Jun 15 22:20:43 2004
+++ b/fs/nfs/write.c	Tue Jun 15 22:20:43 2004
@@ -179,23 +179,23 @@
 {
 	unsigned int	wsize = NFS_SERVER(inode)->wsize;
 	int		result, written = 0;
-	struct nfs_write_data	wdata = {
-		.flags		= how,
-		.cred		= NULL,
-		.inode		= inode,
-		.args		= {
-			.fh		= NFS_FH(inode),
-			.lockowner	= current->files,
-			.pages		= &page,
-			.stable		= NFS_FILE_SYNC,
-			.pgbase		= offset,
-			.count		= wsize,
-		},
-		.res		= {
-			.fattr		= &wdata.fattr,
-			.verf		= &wdata.verf,
-		},
-	};
+	struct nfs_write_data *wdata;
+
+	wdata = kmalloc(sizeof(*wdata), GFP_NOFS);
+	if (!wdata)
+		return -ENOMEM;
+
+	memset(wdata, 0, sizeof(*wdata));
+	wdata->flags = how;
+	wdata->inode = inode;
+	wdata->args.fh = NFS_FH(inode);
+	wdata->args.lockowner = current->files;
+	wdata->args.pages = &page;
+	wdata->args.stable = NFS_FILE_SYNC;
+	wdata->args.pgbase = offset;
+	wdata->args.count = wsize;
+	wdata->res.fattr = &wdata->fattr;
+	wdata->res.verf = &wdata->verf;
 
 	dprintk("NFS:      nfs_writepage_sync(%s/%Ld %d@%Ld)\n",
 		inode->i_sb->s_id,
@@ -205,22 +205,22 @@
 	nfs_begin_data_update(inode);
 	do {
 		if (count < wsize)
-			wdata.args.count = count;
-		wdata.args.offset = page_offset(page) + wdata.args.pgbase;
+			wdata->args.count = count;
+		wdata->args.offset = page_offset(page) + wdata->args.pgbase;
 
-		result = NFS_PROTO(inode)->write(&wdata, file);
+		result = NFS_PROTO(inode)->write(wdata, file);
 
 		if (result < 0) {
 			/* Must mark the page invalid after I/O error */
 			ClearPageUptodate(page);
 			goto io_error;
 		}
-		if (result < wdata.args.count)
+		if (result < wdata->args.count)
 			printk(KERN_WARNING "NFS: short write, count=%u, result=%d\n",
-					wdata.args.count, result);
+					wdata->args.count, result);
 
-		wdata.args.offset += result;
-	        wdata.args.pgbase += result;
+		wdata->args.offset += result;
+	        wdata->args.pgbase += result;
 		written += result;
 		count -= result;
 	} while (count);
@@ -234,9 +234,10 @@
 
 io_error:
 	nfs_end_data_update_defer(inode);
-	if (wdata.cred)
-		put_rpccred(wdata.cred);
+	if (wdata->cred)
+		put_rpccred(wdata->cred);
 
+	kfree(wdata);
 	return written ? written : result;
 }
 
@@ -313,7 +314,7 @@
 		if (err >= 0) {
 			err = 0;
 			if (wbc->for_reclaim)
-				err = WRITEPAGE_ACTIVATE;
+				nfs_flush_inode(inode, 0, 0, FLUSH_STABLE);
 		}
 	} else {
 		err = nfs_writepage_sync(NULL, inode, page, 0,
@@ -326,8 +327,7 @@
 	}
 	unlock_kernel();
 out:
-	if (err != WRITEPAGE_ACTIVATE)
-		unlock_page(page);
+	unlock_page(page);
 	if (inode_referenced)
 		iput(inode);
 	return err; 
diff -Nru a/fs/nfsd/export.c b/fs/nfsd/export.c
--- a/fs/nfsd/export.c	Tue Jun 15 22:20:41 2004
+++ b/fs/nfsd/export.c	Tue Jun 15 22:20:41 2004
@@ -899,7 +899,7 @@
 	 * fh must be initialized before calling fh_compose
 	 */
 	fh_init(&fh, maxsize);
-	if (fh_compose(&fh, exp, dget(nd.dentry), NULL))
+	if (fh_compose(&fh, exp, nd.dentry, NULL))
 		err = -EINVAL;
 	else
 		err = 0;
@@ -932,7 +932,6 @@
 	if (!fsid_key || IS_ERR(fsid_key))
 		return nfserr_perm;
 
-	dget(fsid_key->ek_export->ex_dentry);
 	rv = fh_compose(fhp, fsid_key->ek_export, 
 			  fsid_key->ek_export->ex_dentry, NULL);
 	expkey_put(&fsid_key->h, &svc_expkey_cache);
diff -Nru a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
--- a/fs/nfsd/nfs3proc.c	Tue Jun 15 22:20:39 2004
+++ b/fs/nfsd/nfs3proc.c	Tue Jun 15 22:20:39 2004
@@ -436,7 +436,6 @@
 	resp->buflen = count;
 	resp->common.err = nfs_ok;
 	resp->buffer = argp->buffer;
-	resp->offset = NULL;
 	resp->rqstp = rqstp;
 	nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie, 
 					&resp->common, nfs3svc_encode_entry);
diff -Nru a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
--- a/fs/nfsd/nfs3xdr.c	Tue Jun 15 22:20:35 2004
+++ b/fs/nfsd/nfs3xdr.c	Tue Jun 15 22:20:35 2004
@@ -799,6 +799,7 @@
 {
 	struct svc_export	*exp;
 	struct dentry		*dparent, *dchild;
+	int rv = 0;
 
 	dparent = cd->fh.fh_dentry;
 	exp  = cd->fh.fh_export;
@@ -813,11 +814,12 @@
 		dchild = lookup_one_len(name, dparent, namlen);
 	if (IS_ERR(dchild))
 		return 1;
-	if (d_mountpoint(dchild))
-		return 1;
-	if (fh_compose(fhp, exp, dchild, &cd->fh) != 0 || !dchild->d_inode)
-		return 1;
-	return 0;
+	if (d_mountpoint(dchild) ||
+	    fh_compose(fhp, exp, dchild, &cd->fh) != 0 ||
+	    !dchild->d_inode)
+		rv = 1;
+	dput(dchild);
+	return rv;
 }
 
 /*
@@ -845,8 +847,18 @@
 	int		elen;		/* estimated entry length in words */
 	int		num_entry_words = 0;	/* actual number of words */
 
-	if (cd->offset)
-		xdr_encode_hyper(cd->offset, (u64) offset);
+	if (cd->offset) {
+		u64 offset64 = offset;
+
+		if (unlikely(cd->offset1)) {
+			/* we ended up with offset on a page boundary */
+			*cd->offset = htonl(offset64 >> 32);
+			*cd->offset1 = htonl(offset64 & 0xffffffff);
+			cd->offset1 = NULL;
+		} else {
+			xdr_encode_hyper(cd->offset, (u64) offset);
+		}
+	}
 
 	/*
 	dprintk("encode_entry(%.*s @%ld%s)\n",
@@ -927,17 +939,32 @@
 			/* update offset */
 			cd->offset = cd->buffer + (cd->offset - tmp);
 		} else {
+			unsigned int offset_r = (cd->offset - tmp) << 2;
+
+			/* update pointer to offset location.
+			 * This is a 64bit quantity, so we need to
+			 * deal with 3 cases:
+			 *  -	entirely in first page
+			 *  -	entirely in second page
+			 *  -	4 bytes in each page
+			 */
+			if (offset_r + 8 <= len1) {
+				cd->offset = p + (cd->offset - tmp);
+			} else if (offset_r >= len1) {
+				cd->offset -= len1 >> 2;
+			} else {
+				/* sitting on the fence */
+				BUG_ON(offset_r != len1 - 4);
+				cd->offset = p + (cd->offset - tmp);
+				cd->offset1 = tmp;
+			}
+
 			len2 = (num_entry_words << 2) - len1;
 
 			/* move from temp page to current and next pages */
 			memmove(p, tmp, len1);
 			memmove(tmp, (caddr_t)tmp+len1, len2);
 
-			/* update offset */
-			if (((cd->offset - tmp) << 2) <= len1)
-				cd->offset = p + (cd->offset - tmp);
-			else
-				cd->offset -= len1 >> 2;
 			p = tmp + (len2 >> 2);
 		}
 	}
diff -Nru a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
--- a/fs/nfsd/nfs4idmap.c	Tue Jun 15 22:20:43 2004
+++ b/fs/nfsd/nfs4idmap.c	Tue Jun 15 22:20:43 2004
@@ -175,6 +175,14 @@
 	return 0;
 }
 
+static void
+warn_no_idmapd(struct cache_detail *detail)
+{
+	printk("nfsd: nfsv4 idmapping failing: has idmapd %s?\n",
+			detail->last_close? "died" : "not been started");
+}
+
+
 static int         idtoname_parse(struct cache_detail *, char *, int);
 static struct ent *idtoname_lookup(struct ent *, int);
 
@@ -186,6 +194,7 @@
 	.cache_request	= idtoname_request,
 	.cache_parse	= idtoname_parse,
 	.cache_show	= idtoname_show,
+	.warn_no_listener = warn_no_idmapd,
 };
 
 int
@@ -318,6 +327,7 @@
 	.cache_request	= nametoid_request,
 	.cache_parse	= nametoid_parse,
 	.cache_show	= nametoid_show,
+	.warn_no_listener = warn_no_idmapd,
 };
 
 int
@@ -409,13 +419,19 @@
        atomic_t			count;
 };
 
-static void
+static inline void
 put_mdr(struct idmap_defer_req *mdr)
 {
 	if (atomic_dec_and_test(&mdr->count))
 		kfree(mdr);
 }
 
+static inline void
+get_mdr(struct idmap_defer_req *mdr)
+{
+	atomic_inc(&mdr->count);
+}
+
 static void
 idmap_revisit(struct cache_deferred_req *dreq, int toomany)
 {
@@ -433,31 +449,44 @@
 		container_of(req, struct idmap_defer_req, req);
 
 	mdr->deferred_req.revisit = idmap_revisit;
+	get_mdr(mdr);
 	return (&mdr->deferred_req);
 }
 
-static int threads_waiting = 0;
+static inline int
+do_idmap_lookup(struct ent *(*lookup_fn)(struct ent *, int), struct ent *key,
+		struct cache_detail *detail, struct ent **item,
+		struct idmap_defer_req *mdr)
+{
+	*item = lookup_fn(key, 0);
+	if (!*item)
+		return -ENOMEM;
+	return cache_check(detail, &(*item)->h, &mdr->req);
+}
 
 static inline int
-idmap_lookup_wait(struct idmap_defer_req *mdr, wait_queue_t waitq, struct
-		svc_rqst *rqstp) {
-	int ret = -ETIMEDOUT;
-
-	set_task_state(current, TASK_INTERRUPTIBLE);
-	lock_kernel();
-	/* XXX: Does it matter that threads_waiting isn't per-server? */
-	/* Note: BKL prevents races with nfsd_svc and other lookups */
-	if (2 * threads_waiting > rqstp->rq_server->sv_nrthreads)
-		goto out;
-	threads_waiting++;
-	schedule_timeout(10 * HZ);
-	threads_waiting--;
-	ret = 0;
-out:
-	unlock_kernel();
-	remove_wait_queue(&mdr->waitq, &waitq);
-	set_task_state(current, TASK_RUNNING);
-	put_mdr(mdr);
+do_idmap_lookup_nowait(struct ent *(*lookup_fn)(struct ent *, int),
+			struct ent *key, struct cache_detail *detail,
+			struct ent **item)
+{
+	int ret = -ENOMEM;
+
+	*item = lookup_fn(key, 0);
+	if (!*item)
+		goto out_err;
+	ret = -ETIMEDOUT;
+	if (!test_bit(CACHE_VALID, &(*item)->h.flags)
+			|| (*item)->h.expiry_time < get_seconds()
+			|| detail->flush_time > (*item)->h.last_refresh)
+		goto out_put;
+	ret = -ENOENT;
+	if (test_bit(CACHE_NEGATIVE, &(*item)->h.flags))
+		goto out_put;
+	return 0;
+out_put:
+	ent_put(&(*item)->h, detail);
+out_err:
+	*item = NULL;
 	return ret;
 }
 
@@ -467,36 +496,22 @@
 		struct cache_detail *detail, struct ent **item)
 {
 	struct idmap_defer_req *mdr;
-	DECLARE_WAITQUEUE(waitq, current);
 	int ret;
 
-	*item = lookup_fn(key, 0);
-	if (!*item)
-		return -ENOMEM;
 	mdr = kmalloc(sizeof(*mdr), GFP_KERNEL);
+	if (!mdr)
+		return -ENOMEM;
 	memset(mdr, 0, sizeof(*mdr));
+	atomic_set(&mdr->count, 1);
 	init_waitqueue_head(&mdr->waitq);
-	add_wait_queue(&mdr->waitq, &waitq);
-	atomic_set(&mdr->count, 2);
 	mdr->req.defer = idmap_defer;
-	ret = cache_check(detail, &(*item)->h, &mdr->req);
+	ret = do_idmap_lookup(lookup_fn, key, detail, item, mdr);
 	if (ret == -EAGAIN) {
-		ret = idmap_lookup_wait(mdr, waitq, rqstp);
-		if (ret)
-			goto out;
-		/* Try again, but don't wait. */
-		*item = lookup_fn(key, 0);
-		ret = -ENOMEM;
-		if (!*item)
-			goto out;
-		ret = -ETIMEDOUT;
-		if (!test_bit(CACHE_VALID, &(*item)->h.flags)) {
-			ent_put(&(*item)->h, detail);
-			goto out;
-		}
-		ret = cache_check(detail, &(*item)->h, NULL);
+		wait_event_interruptible_timeout(mdr->waitq,
+			test_bit(CACHE_VALID, &(*item)->h.flags), 1 * HZ);
+		ret = do_idmap_lookup_nowait(lookup_fn, key, detail, item);
 	}
-out:
+	put_mdr(mdr);
 	return ret;
 }
 
@@ -515,6 +530,8 @@
 	key.name[namelen] = '\0';
 	strlcpy(key.authname, rqstp->rq_client->name, sizeof(key.authname));
 	ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item);
+	if (ret == -ENOENT)
+		ret = -ESRCH; /* nfserr_badname */
 	if (ret)
 		return ret;
 	*id = item->id;
@@ -533,6 +550,8 @@
 
 	strlcpy(key.authname, rqstp->rq_client->name, sizeof(key.authname));
 	ret = idmap_lookup(rqstp, idtoname_lookup, &key, &idtoname_cache, &item);
+	if (ret == -ENOENT)
+		return sprintf(name, "%u", id);
 	if (ret)
 		return ret;
 	ret = strlen(item->name);
diff -Nru a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
--- a/fs/nfsd/nfs4proc.c	Tue Jun 15 22:21:05 2004
+++ b/fs/nfsd/nfs4proc.c	Tue Jun 15 22:21:05 2004
@@ -389,7 +389,7 @@
 		break;
 
 	default:
-		BUG();
+		status = nfserr_badtype;
 	}
 
 	if (!status) {
diff -Nru a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
--- a/fs/nfsd/nfs4state.c	Tue Jun 15 22:20:43 2004
+++ b/fs/nfsd/nfs4state.c	Tue Jun 15 22:20:43 2004
@@ -495,15 +495,13 @@
 		gen_clid(new);
 		gen_confirm(new);
 		add_to_unconfirmed(new, strhashval);
-	} else if (!cmp_clid(&conf->cl_clientid, &unconf->cl_clientid) &&
-	      !cmp_verf(&conf->cl_confirm, &unconf->cl_confirm)) {
+	} else if (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm)) {
 		/*	
 		 * CASE3:
 		 * confirmed found (name, principal match)
 		 * confirmed verifier does not match input clverifier
 		 *
 		 * unconfirmed found (name match)
-		 * confirmed->cl_clientid != unconfirmed->cl_clientid and
 		 * confirmed->cl_confirm != unconfirmed->cl_confirm
 		 *
 		 * remove unconfirmed.
@@ -2334,28 +2332,27 @@
 
 	/* find the lockowner */
         status = nfs_ok;
-	for (i=0; i < LOCK_HASH_SIZE; i++) {
-		list_for_each_entry(local, &lock_ownerstr_hashtbl[i], so_strhash) {
-			if(cmp_owner_str(local, owner, clid))
-				break;
-		}
-	}
-	if (local) {
-		struct nfs4_stateid *stp;
-
-		/* check for any locks held by any stateid associated with the
-		 * (lock) stateowner */
-		status = nfserr_locks_held;
-		list_for_each_entry(stp, &local->so_perfilestate, st_perfilestate) {
-			if(stp->st_vfs_set) {
-				if (check_for_locks(&stp->st_vfs_file, local))
-					goto out;
+	for (i=0; i < LOCK_HASH_SIZE; i++)
+		list_for_each_entry(local, &lock_ownerstr_hashtbl[i], so_strhash)
+			if(cmp_owner_str(local, owner, clid)) {
+				struct nfs4_stateid *stp;
+
+				/* check for any locks held by any stateid
+				 * associated with the (lock) stateowner */
+				status = nfserr_locks_held;
+				list_for_each_entry(stp, &local->so_perfilestate,
+						    st_perfilestate) {
+					if(stp->st_vfs_set) {
+						if (check_for_locks(&stp->st_vfs_file,
+								    local))
+							goto out;
+					}
+				}
+				/* no locks held by (lock) stateowner */
+				status = nfs_ok;
+				release_stateowner(local);
+				goto out;
 			}
-		}
-		/* no locks held by (lock) stateowner */
-		status = nfs_ok;
-		release_stateowner(local);
-	}
 out:
 	nfs4_unlock_state();
 	return status;
diff -Nru a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
--- a/fs/nfsd/nfs4xdr.c	Tue Jun 15 22:20:44 2004
+++ b/fs/nfsd/nfs4xdr.c	Tue Jun 15 22:20:44 2004
@@ -538,9 +538,8 @@
 	case NF4SOCK:
 	case NF4FIFO:
 	case NF4DIR:
-		break;
 	default:
-		goto xdr_error;
+		break;
 	}
 
 	READ_BUF(4);
@@ -1289,6 +1288,49 @@
         NF4SOCK, NF4BAD,  NF4LNK, NF4BAD,
 };
 
+static inline int
+xdr_padding(int l)
+{
+       return 3 - ((l - 1) & 3); /* smallest i>=0 such that (l+i)%4 = 0 */
+}
+
+static int
+nfsd4_encode_name(struct svc_rqst *rqstp, int group, uid_t id,
+			u32 **p, int *buflen)
+{
+	int status;
+	u32 len;
+
+	if (*buflen < (XDR_QUADLEN(IDMAP_NAMESZ) << 2) + 4)
+		return nfserr_resource;
+	if (group)
+		status = nfsd_map_gid_to_name(rqstp, id, (u8 *)(*p + 1));
+	else
+		status = nfsd_map_uid_to_name(rqstp, id, (u8 *)(*p + 1));
+	if (status < 0)
+		return nfserrno(status);
+	len = (unsigned)status;
+	*(*p)++ = htonl(len);
+	memset((u8 *)*p + len, 0, xdr_padding(len));
+	*p += XDR_QUADLEN(len);
+	*buflen -= (XDR_QUADLEN(len) << 2) + 4;
+	BUG_ON(*buflen < 0);
+	return 0;
+}
+
+static inline int
+nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, u32 **p, int *buflen)
+{
+	return nfsd4_encode_name(rqstp, uid, 0, p, buflen);
+}
+
+static inline int
+nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, u32 **p, int *buflen)
+{
+	return nfsd4_encode_name(rqstp, gid, 1, p, buflen);
+}
+
+
 /*
  * Note: @fhp can be NULL; in this case, we might have to compose the filehandle
  * ourselves.
@@ -1304,10 +1346,6 @@
 	u32 bmval0 = bmval[0];
 	u32 bmval1 = bmval[1];
 	struct kstat stat;
-	char owner[IDMAP_NAMESZ];
-	u32 ownerlen = 0;
-	char group[IDMAP_NAMESZ];
-	u32 grouplen = 0;
 	struct svc_fh tempfh;
 	struct kstatfs statfs;
 	int buflen = *countp << 2;
@@ -1338,23 +1376,6 @@
 			goto out;
 		fhp = &tempfh;
 	}
-	if (bmval1 & FATTR4_WORD1_OWNER) {
-		int temp = nfsd_map_uid_to_name(rqstp, stat.uid, owner);
-		if (temp < 0) {
-			status = temp;
-			goto out_nfserr;
-		}
-		ownerlen = (unsigned) temp;
-	}
-	if (bmval1 & FATTR4_WORD1_OWNER_GROUP) {
-		int temp = nfsd_map_gid_to_name(rqstp, stat.gid, group);
-		if (temp < 0) {
-			status = temp;
-			goto out_nfserr;
-		}
-		grouplen = (unsigned) temp;
-	}
-
 	if ((buflen -= 16) < 0)
 		goto out_resource;
 
@@ -1536,18 +1557,18 @@
 		WRITE32(stat.nlink);
 	}
 	if (bmval1 & FATTR4_WORD1_OWNER) {
-		buflen -= (XDR_QUADLEN(ownerlen) << 2) + 4;
-		if (buflen < 0)
+		status = nfsd4_encode_user(rqstp, stat.uid, &p, &buflen);
+		if (status == nfserr_resource)
 			goto out_resource;
-		WRITE32(ownerlen);
-		WRITEMEM(owner, ownerlen);
+		if (status)
+			goto out;
 	}
 	if (bmval1 & FATTR4_WORD1_OWNER_GROUP) {
-		buflen -= (XDR_QUADLEN(grouplen) << 2) + 4;
-		if (buflen < 0)
+		status = nfsd4_encode_group(rqstp, stat.gid, &p, &buflen);
+		if (status == nfserr_resource)
 			goto out_resource;
-		WRITE32(grouplen);
-		WRITEMEM(group, grouplen);
+		if (status)
+			goto out;
 	}
 	if (bmval1 & FATTR4_WORD1_RAWDEV) {
 		if ((buflen -= 8) < 0)
@@ -1686,6 +1707,7 @@
 			goto error;
 		}
 
+		exp_get(exp);
 		if (d_mountpoint(dentry)) {
 			if ((nfserr = nfsd_cross_mnt(cd->rd_rqstp, &dentry, 
 					 &exp))) {	
@@ -1697,6 +1719,7 @@
 			 * this call will be retried.
 			 */
 				dput(dentry);
+				exp_put(exp);
 				nfserr = nfserr_dropit;
 				goto error;
 			}
@@ -1706,6 +1729,8 @@
 		nfserr = nfsd4_encode_fattr(NULL, exp,
 				dentry, p, &buflen, cd->rd_bmval,
 				cd->rd_rqstp);
+		dput(dentry);
+		exp_put(exp);
 		if (!nfserr) {
 			p += buflen;
 			goto out;
diff -Nru a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
--- a/fs/nfsd/nfsctl.c	Tue Jun 15 22:20:37 2004
+++ b/fs/nfsd/nfsctl.c	Tue Jun 15 22:20:37 2004
@@ -91,7 +91,7 @@
  * possibly a read which collects the result - which is stored in a 
  * file-local buffer.
  */
-static ssize_t TA_write(struct file *file, const char *buf, size_t size, loff_t *pos)
+static ssize_t TA_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
 {
 	ino_t ino =  file->f_dentry->d_inode->i_ino;
 	struct argresp *ar;
@@ -130,7 +130,7 @@
 }
 
 
-static ssize_t TA_read(struct file *file, char *buf, size_t size, loff_t *pos)
+static ssize_t TA_read(struct file *file, char __user *buf, size_t size, loff_t *pos)
 {
 	struct argresp *ar;
 	ssize_t rv = 0;
diff -Nru a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
--- a/fs/nfsd/nfsfh.c	Tue Jun 15 22:20:39 2004
+++ b/fs/nfsd/nfsfh.c	Tue Jun 15 22:20:39 2004
@@ -56,7 +56,7 @@
 		/* make sure parents give x permission to user */
 		int err;
 		parent = dget_parent(tdentry);
-		err = permission(parent->d_inode, S_IXOTH, NULL);
+		err = permission(parent->d_inode, MAY_EXEC, NULL);
 		if (err < 0) {
 			dput(parent);
 			break;
@@ -367,7 +367,7 @@
 		printk(KERN_ERR "fh_compose: called with maxsize %d! %s/%s\n",
 		       fhp->fh_maxsize, parent->d_name.name, dentry->d_name.name);
 
-	fhp->fh_dentry = dentry; /* our internal copy */
+	fhp->fh_dentry = dget(dentry); /* our internal copy */
 	fhp->fh_export = exp;
 	cache_get(&exp->h);
 
diff -Nru a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
--- a/fs/nfsd/nfsproc.c	Tue Jun 15 22:20:38 2004
+++ b/fs/nfsd/nfsproc.c	Tue Jun 15 22:20:38 2004
@@ -212,6 +212,7 @@
 	nfserr = fh_compose(newfhp, dirfhp->fh_export, dchild, dirfhp);
 	if (!nfserr && !dchild->d_inode)
 		nfserr = nfserr_noent;
+	dput(dchild);
 	if (nfserr) {
 		if (nfserr != nfserr_noent)
 			goto out_unlock;
@@ -588,6 +589,7 @@
 		{ nfserr_jukebox, -ETIMEDOUT },
 		{ nfserr_dropit, -EAGAIN },
 		{ nfserr_dropit, -ENOMEM },
+		{ nfserr_badname, -ESRCH },
 		{ -1, -EIO }
 	};
 	int	i;
diff -Nru a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
--- a/fs/nfsd/vfs.c	Tue Jun 15 22:20:39 2004
+++ b/fs/nfsd/vfs.c	Tue Jun 15 22:20:39 2004
@@ -141,10 +141,11 @@
 	/* Obtain dentry and export. */
 	err = fh_verify(rqstp, fhp, S_IFDIR, MAY_EXEC);
 	if (err)
-		goto out;
+		return err;
 
 	dparent = fhp->fh_dentry;
 	exp  = fhp->fh_export;
+	exp_get(exp);
 
 	err = nfserr_acces;
 
@@ -208,7 +209,9 @@
 	err = fh_compose(resfh, exp, dentry, fhp);
 	if (!err && !dentry->d_inode)
 		err = nfserr_noent;
+	dput(dentry);
 out:
+	exp_put(exp);
 	return err;
 
 out_nfserr:
@@ -564,7 +567,7 @@
 static spinlock_t ra_lock = SPIN_LOCK_UNLOCKED;
 
 static inline struct raparms *
-nfsd_get_raparms(dev_t dev, ino_t ino)
+nfsd_get_raparms(dev_t dev, ino_t ino, struct address_space *mapping)
 {
 	struct raparms	*ra, **rap, **frap = NULL;
 	int depth = 0;
@@ -586,7 +589,7 @@
 	ra = *frap;
 	ra->p_dev = dev;
 	ra->p_ino = ino;
-	memset(&ra->p_ra, 0, sizeof(ra->p_ra));
+	file_ra_state_init(&ra->p_ra, mapping);
 found:
 	if (rap != &raparm_cache) {
 		*rap = ra->p_next;
@@ -658,7 +661,8 @@
 #endif
 
 	/* Get readahead parameters */
-	ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino);
+	ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino,
+			      inode->i_mapping->host->i_mapping);
 	if (ra)
 		file.f_ra = ra->p_ra;
 
@@ -674,9 +678,12 @@
 	}
 
 	/* Write back readahead params */
-	if (ra)
+	if (ra) {
+		spin_lock(&ra_lock);
 		ra->p_ra = file.f_ra;
-
+		ra->p_count--;
+		spin_unlock(&ra_lock);
+	}
 	if (err >= 0) {
 		nfsdstats.io_read += err;
 		*count = err;
@@ -859,7 +866,7 @@
 		char *fname, int flen, struct iattr *iap,
 		int type, dev_t rdev, struct svc_fh *resfhp)
 {
-	struct dentry	*dentry, *dchild;
+	struct dentry	*dentry, *dchild = NULL;
 	struct inode	*dirp;
 	int		err;
 
@@ -896,7 +903,7 @@
 			goto out;
 	} else {
 		/* called from nfsd_proc_create */
-		dchild = resfhp->fh_dentry;
+		dchild = dget(resfhp->fh_dentry);
 		if (!fhp->fh_locked) {
 			/* not actually possible */
 			printk(KERN_ERR
@@ -965,6 +972,8 @@
 	if (!err)
 		err = fh_update(resfhp);
 out:
+	if (dchild && !IS_ERR(dchild))
+		dput(dchild);
 	return err;
 
 out_nfserr:
@@ -982,7 +991,7 @@
 		struct svc_fh *resfhp, int createmode, u32 *verifier,
 	        int *truncp)
 {
-	struct dentry	*dentry, *dchild;
+	struct dentry	*dentry, *dchild = NULL;
 	struct inode	*dirp;
 	int		err;
 	__u32		v_mtime=0, v_atime=0;
@@ -1111,6 +1120,8 @@
 
  out:
 	fh_unlock(fhp);
+	if (dchild && !IS_ERR(dchild))
+		dput(dchild);
  	return err;
  
  out_nfserr:
@@ -1177,6 +1188,7 @@
 {
 	struct dentry	*dentry, *dnew;
 	int		err, cerr;
+	umode_t		mode;
 
 	err = nfserr_noent;
 	if (!flen || !plen)
@@ -1195,6 +1207,11 @@
 	if (IS_ERR(dnew))
 		goto out_nfserr;
 
+	mode = S_IALLUGO;
+	/* Only the MODE ATTRibute is even vaguely meaningful */
+	if (iap && (iap->ia_valid & ATTR_MODE))
+		mode = iap->ia_mode & S_IALLUGO;
+
 	if (unlikely(path[plen] != 0)) {
 		char *path_alloced = kmalloc(plen+1, GFP_KERNEL);
 		if (path_alloced == NULL)
@@ -1202,34 +1219,21 @@
 		else {
 			strncpy(path_alloced, path, plen);
 			path_alloced[plen] = 0;
-			err = vfs_symlink(dentry->d_inode, dnew, path_alloced);
+			err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
 			kfree(path_alloced);
 		}
 	} else
-		err = vfs_symlink(dentry->d_inode, dnew, path);
+		err = vfs_symlink(dentry->d_inode, dnew, path, mode);
 
 	if (!err) {
 		if (EX_ISSYNC(fhp->fh_export))
 			nfsd_sync_dir(dentry);
-		if (iap) {
-			iap->ia_valid &= ATTR_MODE /* ~(ATTR_MODE|ATTR_UID|ATTR_GID)*/;
-			if (iap->ia_valid) {
-				iap->ia_valid |= ATTR_CTIME;
-				iap->ia_mode = (iap->ia_mode&S_IALLUGO)
-					| S_IFLNK;
-				err = notify_change(dnew, iap);
-				if (err)
-					err = nfserrno(err);
-				else if (EX_ISSYNC(fhp->fh_export))
-					write_inode_now(dentry->d_inode, 1);
-		       }
-		}
 	} else
 		err = nfserrno(err);
 	fh_unlock(fhp);
 
-	/* Compose the fh so the dentry will be freed ... */
 	cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp);
+	dput(dnew);
 	if (err==0) err = cerr;
 out:
 	return err;
diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog	Tue Jun 15 22:20:38 2004
+++ b/fs/ntfs/ChangeLog	Tue Jun 15 22:20:38 2004
@@ -1,12 +1,20 @@
-ToDo:
+ToDo/Notes:
 	- Find and fix bugs.
+	- Either invalidate quotas or update the quota charges on NTFS 3.x
+	  volumes with quota tracking enabled ($Quota).
+	- Checkpoint or disable the user space journal ($UsnJrnl).
 	- Implement aops->set_page_dirty() in order to take control of buffer
 	  dirtying. Not having it means if page_has_buffers(), all buffers
 	  will be dirtied with the page. And if not they won't be. That is
 	  fine for the moment but will break once we enable metadata updates.
-	- Implement sops->dirty_inode() to implement {a,m,c} time updates and
-	  such things.
-	- Implement sops->write_inode().
+	  For now just always using __set_page_dirty_nobuffers() for metadata
+	  pages as nothing can dirty a page other than ourselves. Should this
+	  change, we will really need to roll our own ->set_page_dirty().
+	- Implement sops->dirty_inode() to implement {a,m,c}time updates and
+	  such things.  This should probably just flag the ntfs inode such that
+	  sops->write_inode(), i.e. ntfs_write_inode(), will copy the times
+	  when it is invoked rather than having to update the mft record
+	  every time.
 	- In between ntfs_prepare/commit_write, need exclusion between
 	  simultaneous file extensions. Need perhaps an NInoResizeUnderway()
 	  flag which we can set in ntfs_prepare_write() and clear again in
@@ -18,8 +26,128 @@
 	  OTOH, perhaps i_sem, which is held accross generic_file_write is
 	  sufficient for synchronisation here. We then just need to make sure
 	  ntfs_readpage/writepage/truncate interoperate properly with us.
+	- Implement mft.c::sync_mft_mirror_umount().  We currently will just
+	  leave the volume dirty on umount if the final iput(vol->mft_ino)
+	  causes a write of any mirrored mft records due to the mft mirror
+	  inode having been discarded already.  Whether this can actually ever
+	  happen is unclear however so it is worth waiting until someone hits
+	  the problem.
+	- Enable the code for setting the NT4 compatibility flag when we start
+	  making NTFS 1.2 specific modifications.
+
+2.1.14 - Fix an NFSd caused deadlock reported by several users.
+
+	- Modify fs/ntfs/ntfs_readdir() to copy the index root attribute value
+	  to a buffer so that we can put the search context and unmap the mft
+	  record before calling the filldir() callback.  We need to do this
+	  because of NFSd which calls ->lookup() from its filldir callback()
+	  and this causes NTFS to deadlock as ntfs_lookup() maps the mft record
+	  of the directory and since ntfs_readdir() has got it mapped already
+	  ntfs_lookup() deadlocks.
+
+2.1.13 - Enable overwriting of resident files and housekeeping of system files.
+
+	- Implement writing of mft records (fs/ntfs/mft.[hc]), which includes
+	  keeping the mft mirror in sync with the mft when mirrored mft records
+	  are written.  The functions are write_mft_record{,_nolock}().  The
+	  implementation is quite rudimentary for now with lots of things not
+	  implemented yet but I am not sure any of them can actually occur so
+	  I will wait for people to hit each one and only then implement it.
+	- Commit open system inodes at umount time.  This should make it
+	  virtually impossible for sync_mft_mirror_umount() to ever be needed.
+	- Implement ->write_inode (fs/ntfs/inode.c::ntfs_write_inode()) for the
+	  ntfs super operations.  This gives us inode writing via the VFS inode
+	  dirty code paths.  Note:  Access time updates are not implemented yet.
+	- Implement fs/ntfs/mft.[hc]::{,__}mark_mft_record_dirty() and make
+	  fs/ntfs/aops.c::ntfs_writepage() and ntfs_commit_write() use it, thus
+	  finally enabling resident file overwrite!  (-8  This also includes a
+	  placeholder for ->writepage (ntfs_mft_writepage()), which for now
+	  just redirties the page and returns.  Also, at umount time, we for
+	  now throw away all mft data page cache pages after the last call to
+	  ntfs_commit_inode() in the hope that all inodes will have been
+	  written out by then and hence no dirty (meta)data will be lost.  We
+	  also check for this case and emit an error message telling the user
+	  to run chkdsk.
+	- Use set_page_writeback() and end_page_writeback() in the resident
+	  attribute code path of fs/ntfs/aops.c::ntfs_writepage() otherwise
+	  the radix-tree tag PAGECACHE_TAG_DIRTY remains set even though the
+	  page is clean.
+	- Implement ntfs_mft_writepage() so it now checks if any of the mft
+	  records in the page are dirty and if so redirties the page and
+	  returns.  Otherwise it just returns (after doing set_page_writeback(),
+	  unlock_page(), end_page_writeback() or the radix-tree tag
+	  PAGECACHE_TAG_DIRTY remains set even though the page is clean), thus
+	  alowing the VM to do with the page as it pleases.  Also, at umount
+	  time, now only throw away dirty mft (meta)data pages if dirty inodes
+	  are present and ask the user to email us if they see this happening.
+	- Add functions ntfs_{clear,set}_volume_flags(), to modify the volume
+	  information flags (fs/ntfs/super.c).
+	- Mark the volume dirty when (re)mounting read-write and mark it clean
+	  when unmounting or remounting read-only.  If any volume errors are
+	  found, the volume is left marked dirty to force chkdsk to run.
+	- Add code to set the NT4 compatibility flag when (re)mounting
+	  read-write for newer NTFS versions but leave it commented out for now
+	  since we do not make any modifications that are NTFS 1.2 specific yet
+	  and since setting this flag breaks Captive-NTFS which is not nice.
+	  This code must be enabled once we start writing NTFS 1.2 specific
+	  changes otherwise Windows NTFS driver might crash / cause corruption.
+
+2.1.12 - Fix the second fix to the decompression engine and some cleanups.
+
+	- Add a new address space operations struct, ntfs_mst_aops, for mst
+	  protected attributes.  This is because the default ntfs_aops do not
+	  make sense with mst protected data and were they to write anything to
+	  such an attribute they would cause data corruption so we provide
+	  ntfs_mst_aops which does not have any write related operations set.
+	- Cleanup dirty ntfs inode handling (fs/ntfs/inode.[hc]) which also
+	  includes an adapted ntfs_commit_inode() and an implementation of
+	  ntfs_write_inode() which for now just cleans dirty inodes without
+	  writing them (it does emit a warning that this is happening).
+	- Undo the second decompression engine fix (see 2.1.9 release ChangeLog
+	  entry) as it was only fixing a theoretical bug but at the same time
+	  it badly broke the handling of sparse and uncompressed compression
+	  blocks.
+
+2.1.11 - Driver internal cleanups.
+
+	- Only build logfile.o if building the driver with read-write support.
+	- Really final white space cleanups.
+	- Use generic_ffs() instead of ffs() in logfile.c which allows the
+	  log_page_size variable to be optimized by gcc into a constant.
+	- Rename uchar_t to ntfschar everywhere as uchar_t is unsigned 1-byte
+	  char as defined by POSIX and as found on some systems.
+
+2.1.10 - Force read-only (re)mounting of volumes with unsupported volume flags.
+
+	- Finish off the white space cleanups (remove trailing spaces, etc).
+	- Clean up ntfs_fill_super() and ntfs_read_inode_mount() by removing
+	  the kludges around the first iget().  Instead of (re)setting ->s_op
+	  we have the $MFT inode set up by explicit new_inode() / set ->i_ino /
+	  insert_inode_hash() / call ntfs_read_inode_mount() directly.  This
+	  kills the need for second super_operations and allows to return error
+	  from ntfs_read_inode_mount() without resorting to ugly "poisoning"
+	  tricks.  (Al Viro)
+	- Force read-only (re)mounting if any of the following bits are set in
+	  the volume information flags:
+	  	VOLUME_IS_DIRTY, VOLUME_RESIZE_LOG_FILE,
+		VOLUME_UPGRADE_ON_MOUNT, VOLUME_DELETE_USN_UNDERWAY,
+		VOLUME_REPAIR_OBJECT_ID, VOLUME_MODIFIED_BY_CHKDSK
+	  To make this easier we define VOLUME_MUST_MOUNT_RO_MASK with all the
+	  above bits set so the test is made easy.
+
+2.1.9 - Fix two bugs in decompression engine.
+
+	- Fix a bug where we would not always detect that we have reached the
+	  end of a compression block because we were ending at minus one byte
+	  which is effectively the same as being at the end.  The fix is to
+	  check whether the uncompressed buffer has been fully filled and if so
+	  we assume we have reached the end of the compression block.  A big
+	  thank you to Marcin GibuÅ‚a for the bug report, the assistance in
+	  tracking down the bug and testing the fix.
+	- Fix a possible bug where when a compressed read is truncated to the
+	  end of the file, the offset inside the last page was not truncated.
 
-2.1.8 - Handle $MFT mirror and $LogFile, improve time ihandling, and cleanups.
+2.1.8 - Handle $MFT mirror and $LogFile, improve time handling, and cleanups.
 
 	- Use get_bh() instead of manual atomic_inc() in fs/ntfs/compress.c.
 	- Modify fs/ntfs/time.c::ntfs2utc(), get_current_ntfs_time(), and
@@ -570,12 +698,12 @@
 	  types of inode names readdir() returns and modify ntfs_filldir()
 	  accordingly. There are several parameters to show_inodes:
 		system:	system files
-	  	win32:	long file names (including POSIX file names) [DEFAULT]
+		win32:	long file names (including POSIX file names) [DEFAULT]
 		long:	same as win32
-	  	dos:	short file names only (excluding POSIX file names)
+		dos:	short file names only (excluding POSIX file names)
 		short:	same as dos
 		posix:	same as both win32 and dos
-	  	all:	all file names
+		all:	all file names
 	  Note that the options are additive, i.e. specifying:
 		-o show_inodes=system,show_inodes=win32,show_inodes=dos
 	  is the same as specifying:
@@ -868,4 +996,3 @@
 	working nicely, too. Proof of inode metadata in the page cache and non-
 	resident file unnamed stream data in the page cache concepts is thus
 	complete.
-
diff -Nru a/fs/ntfs/Makefile b/fs/ntfs/Makefile
--- a/fs/ntfs/Makefile	Tue Jun 15 22:20:41 2004
+++ b/fs/ntfs/Makefile	Tue Jun 15 22:20:41 2004
@@ -2,10 +2,10 @@
 
 obj-$(CONFIG_NTFS_FS) += ntfs.o
 
-ntfs-objs := aops.o attrib.o compress.o debug.o dir.o file.o inode.o logfile.o \
-	     mft.o mst.o namei.o super.o sysctl.o unistr.o upcase.o
+ntfs-objs := aops.o attrib.o compress.o debug.o dir.o file.o inode.o mft.o \
+	     mst.o namei.o super.o sysctl.o unistr.o upcase.o
 
-EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.8\"
+EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.14\"
 
 ifeq ($(CONFIG_NTFS_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
@@ -13,4 +13,6 @@
 
 ifeq ($(CONFIG_NTFS_RW),y)
 EXTRA_CFLAGS += -DNTFS_RW
+
+ntfs-objs += logfile.o
 endif
diff -Nru a/fs/ntfs/aops.c b/fs/ntfs/aops.c
--- a/fs/ntfs/aops.c	Tue Jun 15 22:20:43 2004
+++ b/fs/ntfs/aops.c	Tue Jun 15 22:20:43 2004
@@ -478,8 +478,8 @@
 	ni = NTFS_I(vi);
 	vol = ni->vol;
 
-	ntfs_debug("Entering for inode %li, attribute type 0x%x, page index "
-			"0x%lx.\n", vi->i_ino, ni->type, page->index);
+	ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, page index "
+			"0x%lx.", vi->i_ino, ni->type, page->index);
 
 	BUG_ON(!NInoNonResident(ni));
 	BUG_ON(NInoMstProtected(ni));
@@ -778,9 +778,8 @@
  *
  * For resident attributes, OTOH, ntfs_writepage() writes the @page by copying
  * the data to the mft record (which at this stage is most likely in memory).
- * Thus, in this case, I/O is synchronous, as even if the mft record is not
- * cached at this point in time, we need to wait for it to be read in before we
- * can do the copy.
+ * The mft record is then marked dirty and written out asynchronously via the
+ * vfs inode dirty code path.
  *
  * Note the caller clears the page dirty flag before calling ntfs_writepage().
  *
@@ -875,16 +874,6 @@
 	BUG_ON(page_has_buffers(page));
 	BUG_ON(!PageUptodate(page));
 
-	// TODO: Consider using PageWriteback() + unlock_page() in 2.5 once the
-	// "VM fiddling has ended". Note, don't forget to replace all the
-	// unlock_page() calls further below with end_page_writeback() ones.
-	// FIXME: Make sure it is ok to SetPageError() on unlocked page under
-	// writeback before doing the change!
-#if 0
-	set_page_writeback(page);
-	unlock_page(page);
-#endif
-
 	if (!NInoAttr(ni))
 		base_ni = ni;
 	else
@@ -935,6 +924,14 @@
 		bytes = PAGE_CACHE_SIZE;
 
 	/*
+	 * Keep the VM happy.  This must be done otherwise the radix-tree tag
+	 * PAGECACHE_TAG_DIRTY remains set even though the page is clean.
+	 */
+	BUG_ON(PageWriteback(page));
+	set_page_writeback(page);
+	unlock_page(page);
+
+	/*
 	 * Here, we don't need to zero the out of bounds area everytime because
 	 * the below memcpy() already takes care of the mmap-at-end-of-file
 	 * requirements. If the file is converted to a non-resident one, then
@@ -948,7 +945,10 @@
 	 * expose data to userspace/disk which should never have been exposed.
 	 *
 	 * FIXME: Ensure that i_size increases do the zeroing/overwriting and
-	 * if we cannot guarantee that, then enable the zeroing below.
+	 * if we cannot guarantee that, then enable the zeroing below.  If the
+	 * zeroing below is enabled, we MUST move the unlock_page() from above
+	 * to after the kunmap_atomic(), i.e. just before the
+	 * end_page_writeback().
 	 */
 
 	kaddr = kmap_atomic(page, KM_USER0);
@@ -966,11 +966,10 @@
 #endif
 	kunmap_atomic(kaddr, KM_USER0);
 
-	unlock_page(page);
+	end_page_writeback(page);
 
-	// TODO: Mark mft record dirty so it gets written back.
-	ntfs_error(vi->i_sb, "Writing to resident files is not supported yet. "
-			"Wrote to memory only...");
+	/* Mark the mft record dirty, so it gets written back. */
+	mark_mft_record_dirty(ctx->ntfs_ino);
 
 	put_attr_search_ctx(ctx);
 	unmap_mft_record(base_ni);
@@ -1022,7 +1021,7 @@
 	ni = NTFS_I(vi);
 	vol = ni->vol;
 
-	ntfs_debug("Entering for inode %li, attribute type 0x%x, page index "
+	ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, page index "
 			"0x%lx, from = %u, to = %u.", vi->i_ino, ni->type,
 			page->index, from, to);
 
@@ -1379,7 +1378,7 @@
 	struct inode *vi = page->mapping->host;
 	ntfs_inode   *ni = NTFS_I(vi);
 
-	ntfs_debug("Entering for inode %li, attribute type 0x%x, page index "
+	ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, page index "
 			"0x%lx, from = %u, to = %u.", vi->i_ino, ni->type,
 			page->index, from, to);
 
@@ -1487,7 +1486,7 @@
 
 	vi = page->mapping->host;
 
-	ntfs_debug("Entering for inode %li, attribute type 0x%x, page index "
+	ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, page index "
 			"0x%lx, from = %u, to = %u.", vi->i_ino,
 			NTFS_I(vi)->type, page->index, from, to);
 
@@ -1583,7 +1582,7 @@
 	vi = page->mapping->host;
 	ni = NTFS_I(vi);
 
-	ntfs_debug("Entering for inode %li, attribute type 0x%x, page index "
+	ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, page index "
 			"0x%lx, from = %u, to = %u.", vi->i_ino, ni->type,
 			page->index, from, to);
 
@@ -1734,9 +1733,8 @@
 	}
 	kunmap_atomic(kaddr, KM_USER0);
 
-	// TODO: Mark mft record dirty so it gets written back.
-	ntfs_error(vi->i_sb, "Writing to resident files is not supported yet. "
-			"Wrote to memory only...");
+	/* Mark the mft record dirty, so it gets written back. */
+	mark_mft_record_dirty(ctx->ntfs_ino);
 
 	put_attr_search_ctx(ctx);
 	unmap_mft_record(base_ni);
@@ -1788,3 +1786,12 @@
 #endif
 };
 
+/**
+ * ntfs_mst_aops - general address space operations for mst protecteed inodes
+ *		   and attributes
+ */
+struct address_space_operations ntfs_mst_aops = {
+	.readpage	= ntfs_readpage,	/* Fill page with data. */
+	.sync_page	= block_sync_page,	/* Currently, just unplugs the
+						   disk request queue. */
+};
diff -Nru a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
--- a/fs/ntfs/attrib.c	Tue Jun 15 22:21:05 2004
+++ b/fs/ntfs/attrib.c	Tue Jun 15 22:21:05 2004
@@ -105,7 +105,7 @@
  * It is up to the caller to serialize access to the run lists @dst and @src.
  *
  * Return: TRUE   Success, the run lists can be merged.
- *         FALSE  Failure, the run lists cannot be merged.
+ *	   FALSE  Failure, the run lists cannot be merged.
  */
 static inline BOOL ntfs_are_rl_mergeable(run_list_element *dst,
 		run_list_element *src)
@@ -151,7 +151,7 @@
  * It is up to the caller to serialize access to the run lists @dst and @src.
  *
  * Return: TRUE   Success, the run lists have been merged.
- *         FALSE  Failure, the run lists cannot be merged and have not been
+ *	   FALSE  Failure, the run lists cannot be merged and have not been
  *		  modified.
  */
 static inline BOOL ntfs_rl_merge(run_list_element *dst, run_list_element *src)
@@ -264,9 +264,9 @@
 	BUG_ON(!src);
 
 	/* disc => Discontinuity between the end of @dst and the start of @src.
-	 *         This means we might need to insert a hole.
+	 *	   This means we might need to insert a hole.
 	 * hole => @dst ends with a hole or an unmapped region which we can
-	 *         extend to match the discontinuity. */
+	 *	   extend to match the discontinuity. */
 	if (loc == 0)
 		disc = (src[0].vcn > 0);
 	else {
@@ -444,7 +444,7 @@
 	ntfs_rl_mc(dst, loc + 1, src, 0, ssize);
 
 	/* Adjust the size of the holes either size of @src. */
-	dst[loc].length         = dst[loc+1].vcn       - dst[loc].vcn;
+	dst[loc].length		= dst[loc+1].vcn       - dst[loc].vcn;
 	dst[loc+ssize+1].vcn    = dst[loc+ssize].vcn   + dst[loc+ssize].length;
 	dst[loc+ssize+1].length = dst[loc+ssize+2].vcn - dst[loc+ssize+1].vcn;
 
@@ -504,7 +504,7 @@
 	ntfs_debug_dump_runlist(srl);
 #endif
 
- 	/* Check for silly calling... */
+	/* Check for silly calling... */
 	if (unlikely(!srl))
 		return drl;
 	if (unlikely(IS_ERR(srl) || IS_ERR(drl)))
@@ -624,7 +624,7 @@
 
 			if (drl[ds].vcn == marker_vcn) {
 				ntfs_debug("Old marker = 0x%llx, replacing "
-						"with LCN_ENOENT.\n",
+						"with LCN_ENOENT.",
 						(unsigned long long)
 						drl[ds].lcn);
 				drl[ds].lcn = (LCN)LCN_ENOENT;
@@ -706,9 +706,9 @@
  *
  * The following error codes are defined:
  *	-ENOMEM	- Not enough memory to allocate run list array.
- * 	-EIO	- Corrupt run list.
- * 	-EINVAL	- Invalid parameters were passed in.
- * 	-ERANGE	- The two run lists overlap.
+ *	-EIO	- Corrupt run list.
+ *	-EINVAL	- Invalid parameters were passed in.
+ *	-ERANGE	- The two run lists overlap.
  *
  * FIXME: For now we take the conceptionally simplest approach of creating the
  * new run list disregarding the already existing one and then splicing the
@@ -719,7 +719,7 @@
 		const ATTR_RECORD *attr, run_list_element *old_rl)
 {
 	VCN vcn;		/* Current vcn. */
-	LCN lcn; 		/* Current lcn. */
+	LCN lcn;		/* Current lcn. */
 	s64 deltaxcn;		/* Change in [vl]cn. */
 	run_list_element *rl;	/* The output run list. */
 	u8 *buf;		/* Current position in mapping pairs array. */
@@ -769,7 +769,7 @@
 		 */
 		if (((rlpos + 3) * sizeof(*old_rl)) > rlsize) {
 			run_list_element *rl2;
-			
+
 			rl2 = ntfs_malloc_nofs(rlsize + (int)PAGE_SIZE);
 			if (unlikely(!rl2)) {
 				ntfs_free(rl);
@@ -946,7 +946,7 @@
 	attr_search_context *ctx;
 	MFT_RECORD *mrec;
 	int err = 0;
-	
+
 	ntfs_debug("Mapping run list part containing vcn 0x%llx.",
 			(unsigned long long)vcn);
 
@@ -983,7 +983,7 @@
 			ni->run_list.rl = rl;
 	}
 	up_write(&ni->run_list.lock);
-	
+
 	put_attr_search_ctx(ctx);
 err_out:
 	unmap_mft_record(base_ni);
@@ -1096,13 +1096,13 @@
  * Warning: Never use @val when looking for attribute types which can be
  *	    non-resident as this most likely will result in a crash!
  */
-BOOL find_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
+BOOL find_attr(const ATTR_TYPES type, const ntfschar *name, const u32 name_len,
 		const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len,
 		attr_search_context *ctx)
 {
 	ATTR_RECORD *a;
 	ntfs_volume *vol;
-	uchar_t *upcase;
+	ntfschar *upcase;
 	u32 upcase_len;
 
 	if (ic == IGNORE_CASE) {
@@ -1145,12 +1145,12 @@
 			if (a->name_length)
 				return FALSE;
 		} else if (!ntfs_are_names_equal(name, name_len,
-			    (uchar_t*)((u8*)a + le16_to_cpu(a->name_offset)),
+			    (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)),
 			    a->name_length, ic, upcase, upcase_len)) {
 			register int rc;
-			
+
 			rc = ntfs_collate_names(name, name_len,
-					(uchar_t*)((u8*)a +
+					(ntfschar*)((u8*)a +
 						le16_to_cpu(a->name_offset)),
 					a->name_length, 1, IGNORE_CASE,
 					upcase, upcase_len);
@@ -1162,9 +1162,9 @@
 				return FALSE;
 			/* If the strings are not equal, continue search. */
 			if (rc)
-	 			continue;
+				continue;
 			rc = ntfs_collate_names(name, name_len,
-					(uchar_t*)((u8*)a +
+					(ntfschar*)((u8*)a +
 						le16_to_cpu(a->name_offset)),
 					a->name_length, 1, CASE_SENSITIVE,
 					upcase, upcase_len);
@@ -1354,7 +1354,7 @@
  * and if there is not enough space, the attribute should be placed in an
  * extent mft record.
  */
-static BOOL find_external_attr(const ATTR_TYPES type, const uchar_t *name,
+static BOOL find_external_attr(const ATTR_TYPES type, const ntfschar *name,
 		const u32 name_len, const IGNORE_CASE_BOOL ic,
 		const VCN lowest_vcn, const u8 *val, const u32 val_len,
 		attr_search_context *ctx)
@@ -1364,7 +1364,7 @@
 	ATTR_LIST_ENTRY *al_entry, *next_al_entry;
 	u8 *al_start, *al_end;
 	ATTR_RECORD *a;
-	uchar_t *al_name;
+	ntfschar *al_name;
 	u32 al_name_len;
 
 	ni = ctx->ntfs_ino;
@@ -1417,7 +1417,7 @@
 		 * missing, assume we want an unnamed attribute.
 		 */
 		al_name_len = al_entry->name_length;
-		al_name = (uchar_t*)((u8*)al_entry + al_entry->name_offset);
+		al_name = (ntfschar*)((u8*)al_entry + al_entry->name_offset);
 		if (!name) {
 			if (al_name_len)
 				goto not_found;
@@ -1461,12 +1461,12 @@
 		if (lowest_vcn && (u8*)next_al_entry >= al_start	    &&
 				(u8*)next_al_entry + 6 < al_end		    &&
 				(u8*)next_al_entry + le16_to_cpu(
-					next_al_entry->length) <= al_end    &&	
+					next_al_entry->length) <= al_end    &&
 				sle64_to_cpu(next_al_entry->lowest_vcn) <=
 					sle64_to_cpu(lowest_vcn)	    &&
 				next_al_entry->type == al_entry->type	    &&
 				next_al_entry->name_length == al_name_len   &&
-				ntfs_are_names_equal((uchar_t*)((u8*)
+				ntfs_are_names_equal((ntfschar*)((u8*)
 					next_al_entry +
 					next_al_entry->name_offset),
 					next_al_entry->name_length,
@@ -1539,7 +1539,7 @@
 		if (name) {
 			if (a->name_length != al_name_len)
 				continue;
-			if (!ntfs_are_names_equal((uchar_t*)((u8*)a +
+			if (!ntfs_are_names_equal((ntfschar*)((u8*)a +
 					le16_to_cpu(a->name_offset)),
 					a->name_length, al_name, al_name_len,
 					CASE_SENSITIVE, vol->upcase,
@@ -1565,7 +1565,7 @@
 		goto do_next_attr_loop;
 	}
 	ntfs_error(base_ni->vol->sb, "Inode contains corrupt attribute list "
-			"attribute.\n");
+			"attribute.");
 	if (ni != base_ni) {
 		unmap_extent_mft_record(ni);
 		ctx->ntfs_ino = base_ni;
@@ -1623,9 +1623,10 @@
  * being searched for, i.e. if one wants to add the attribute to the mft
  * record this is the correct place to insert it into.
  */
-BOOL lookup_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
-		const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val,
-		const u32 val_len, attr_search_context *ctx)
+BOOL lookup_attr(const ATTR_TYPES type, const ntfschar *name,
+		const u32 name_len, const IGNORE_CASE_BOOL ic,
+		const VCN lowest_vcn, const u8 *val, const u32 val_len,
+		attr_search_context *ctx)
 {
 	ntfs_inode *base_ni;
 
diff -Nru a/fs/ntfs/attrib.h b/fs/ntfs/attrib.h
--- a/fs/ntfs/attrib.h	Tue Jun 15 22:20:39 2004
+++ b/fs/ntfs/attrib.h	Tue Jun 15 22:20:39 2004
@@ -2,7 +2,7 @@
  * attrib.h - Defines for attribute handling in NTFS Linux kernel driver.
  *	      Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2003 Anton Altaparmakov
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  * Copyright (c) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
@@ -10,13 +10,13 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -79,13 +79,14 @@
 
 extern LCN vcn_to_lcn(const run_list_element *rl, const VCN vcn);
 
-extern BOOL find_attr(const ATTR_TYPES type, const uchar_t *name,
+extern BOOL find_attr(const ATTR_TYPES type, const ntfschar *name,
 		const u32 name_len, const IGNORE_CASE_BOOL ic, const u8 *val,
 		const u32 val_len, attr_search_context *ctx);
 
-BOOL lookup_attr(const ATTR_TYPES type, const uchar_t *name, const u32 name_len,
-		const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val,
-		const u32 val_len, attr_search_context *ctx);
+BOOL lookup_attr(const ATTR_TYPES type, const ntfschar *name,
+		const u32 name_len, const IGNORE_CASE_BOOL ic,
+		const VCN lowest_vcn, const u8 *val, const u32 val_len,
+		attr_search_context *ctx);
 
 extern int load_attribute_list(ntfs_volume *vol, run_list *rl, u8 *al_start,
 		const s64 size, const s64 initialized_size);
@@ -103,4 +104,3 @@
 extern void put_attr_search_ctx(attr_search_context *ctx);
 
 #endif /* _LINUX_NTFS_ATTRIB_H */
-
diff -Nru a/fs/ntfs/compress.c b/fs/ntfs/compress.c
--- a/fs/ntfs/compress.c	Tue Jun 15 22:20:40 2004
+++ b/fs/ntfs/compress.c	Tue Jun 15 22:20:40 2004
@@ -197,9 +197,15 @@
 do_next_sb:
 	ntfs_debug("Beginning sub-block at offset = 0x%x in the cb.",
 			cb - cb_start);
-
-	/* Have we reached the end of the compression block? */
-	if (cb == cb_end || !le16_to_cpup((u16*)cb)) {
+	/*
+	 * Have we reached the end of the compression block or the end of the
+	 * decompressed data?  The latter can happen for example if the current
+	 * position in the compression block is one byte before its end so the
+	 * first two checks do not detect it.
+	 */
+	if (cb == cb_end || !le16_to_cpup((u16*)cb) ||
+			(*dest_index == dest_max_index &&
+			*dest_ofs == dest_max_ofs)) {
 		int i;
 
 		ntfs_debug("Completed. Returning success (0).");
@@ -427,7 +433,7 @@
 	goto do_next_tag;
 
 return_overflow:
-	ntfs_error(NULL, "Failed. Returning -EOVERFLOW.\n");
+	ntfs_error(NULL, "Failed. Returning -EOVERFLOW.");
 	goto return_error;
 }
 
@@ -845,7 +851,7 @@
 		if (err) {
 			ntfs_error(vol->sb, "ntfs_decompress() failed in inode "
 					"0x%lx with error code %i. Skipping "
-					"this compression block.\n",
+					"this compression block.",
 					ni->mft_no, -err);
 			/* Release the unfinished pages. */
 			for (; prev_cur_page < cur_page; prev_cur_page++) {
@@ -882,7 +888,8 @@
 		if (page) {
 			ntfs_error(vol->sb, "Still have pages left! "
 					"Terminating them with extreme "
-					"prejudice.");
+					"prejudice.  Inode 0x%lx, page index "
+					"0x%lx.", ni->mft_no, page->index);
 			if (cur_page == xpage && !xpage_done)
 				SetPageError(page);
 			flush_dcache_page(page);
diff -Nru a/fs/ntfs/debug.c b/fs/ntfs/debug.c
--- a/fs/ntfs/debug.c	Tue Jun 15 22:21:05 2004
+++ b/fs/ntfs/debug.c	Tue Jun 15 22:21:05 2004
@@ -1,20 +1,20 @@
 /*
  * debug.c - NTFS kernel debug support. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -172,4 +172,3 @@
 }
 
 #endif
-
diff -Nru a/fs/ntfs/debug.h b/fs/ntfs/debug.h
--- a/fs/ntfs/debug.h	Tue Jun 15 22:20:42 2004
+++ b/fs/ntfs/debug.h	Tue Jun 15 22:20:42 2004
@@ -1,20 +1,20 @@
 /*
  * debug.h - NTFS kernel debug support. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -69,4 +69,3 @@
 #define ntfs_error(sb, f, a...)		__ntfs_error(__FUNCTION__, sb, f, ##a)
 
 #endif /* _LINUX_NTFS_DEBUG_H */
-
diff -Nru a/fs/ntfs/dir.c b/fs/ntfs/dir.c
--- a/fs/ntfs/dir.c	Tue Jun 15 22:20:38 2004
+++ b/fs/ntfs/dir.c	Tue Jun 15 22:20:38 2004
@@ -27,7 +27,7 @@
 /**
  * The little endian Unicode string $I30 as a global constant.
  */
-uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'),
+ntfschar I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'),
 		const_cpu_to_le16('3'),	const_cpu_to_le16('0'),
 		const_cpu_to_le16(0) };
 
@@ -64,7 +64,7 @@
  * work but we don't care for how quickly one can access them. This also fixes
  * the dcache aliasing issues.
  */
-MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
+MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
 		const int uname_len, ntfs_name **res)
 {
 	ntfs_volume *vol = dir_ni->vol;
@@ -135,7 +135,7 @@
 		 * returning.
 		 */
 		if (ntfs_are_names_equal(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length,
 				CASE_SENSITIVE, vol->upcase, vol->upcase_len)) {
 found_it:
@@ -186,7 +186,7 @@
 		if (!NVolCaseSensitive(vol) &&
 				ie->key.file_name.file_name_type &&
 				ntfs_are_names_equal(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length,
 				IGNORE_CASE, vol->upcase, vol->upcase_len)) {
 			int name_size = sizeof(ntfs_name);
@@ -206,7 +206,7 @@
 			}
 
 			if (type != FILE_NAME_DOS)
-				name_size += len * sizeof(uchar_t);
+				name_size += len * sizeof(ntfschar);
 			name = kmalloc(name_size, GFP_NOFS);
 			if (!name) {
 				err = -ENOMEM;
@@ -217,7 +217,7 @@
 			if (type != FILE_NAME_DOS) {
 				name->len = len;
 				memcpy(name->name, ie->key.file_name.file_name,
-						len * sizeof(uchar_t));
+						len * sizeof(ntfschar));
 			} else
 				name->len = 0;
 			*res = name;
@@ -227,7 +227,7 @@
 		 * know which way in the B+tree we have to go.
 		 */
 		rc = ntfs_collate_names(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, 1,
 				IGNORE_CASE, vol->upcase, vol->upcase_len);
 		/*
@@ -246,7 +246,7 @@
 		 * collation.
 		 */
 		rc = ntfs_collate_names(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, 1,
 				CASE_SENSITIVE, vol->upcase, vol->upcase_len);
 		if (rc == -1)
@@ -395,7 +395,7 @@
 		 * returning.
 		 */
 		if (ntfs_are_names_equal(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length,
 				CASE_SENSITIVE, vol->upcase, vol->upcase_len)) {
 found_it2:
@@ -445,7 +445,7 @@
 		if (!NVolCaseSensitive(vol) &&
 				ie->key.file_name.file_name_type &&
 				ntfs_are_names_equal(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length,
 				IGNORE_CASE, vol->upcase, vol->upcase_len)) {
 			int name_size = sizeof(ntfs_name);
@@ -466,7 +466,7 @@
 			}
 
 			if (type != FILE_NAME_DOS)
-				name_size += len * sizeof(uchar_t);
+				name_size += len * sizeof(ntfschar);
 			name = kmalloc(name_size, GFP_NOFS);
 			if (!name) {
 				err = -ENOMEM;
@@ -477,7 +477,7 @@
 			if (type != FILE_NAME_DOS) {
 				name->len = len;
 				memcpy(name->name, ie->key.file_name.file_name,
-						len * sizeof(uchar_t));
+						len * sizeof(ntfschar));
 			} else
 				name->len = 0;
 			*res = name;
@@ -487,7 +487,7 @@
 		 * know which way in the B+tree we have to go.
 		 */
 		rc = ntfs_collate_names(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, 1,
 				IGNORE_CASE, vol->upcase, vol->upcase_len);
 		/*
@@ -506,7 +506,7 @@
 		 * collation.
 		 */
 		rc = ntfs_collate_names(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, 1,
 				CASE_SENSITIVE, vol->upcase, vol->upcase_len);
 		if (rc == -1)
@@ -607,7 +607,7 @@
  *
  * Note, @uname_len does not include the (optional) terminating NULL character.
  */
-u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname,
+u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
 		const int uname_len)
 {
 	ntfs_volume *vol = dir_ni->vol;
@@ -689,7 +689,7 @@
 		 * convert it to cpu format before returning.
 		 */
 		if (ntfs_are_names_equal(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, ic,
 				vol->upcase, vol->upcase_len)) {
 found_it:
@@ -703,7 +703,7 @@
 		 * know which way in the B+tree we have to go.
 		 */
 		rc = ntfs_collate_names(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, 1,
 				IGNORE_CASE, vol->upcase, vol->upcase_len);
 		/*
@@ -722,7 +722,7 @@
 		 * collation.
 		 */
 		rc = ntfs_collate_names(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, 1,
 				CASE_SENSITIVE, vol->upcase, vol->upcase_len);
 		if (rc == -1)
@@ -875,7 +875,7 @@
 		 * convert it to cpu format before returning.
 		 */
 		if (ntfs_are_names_equal(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, ic,
 				vol->upcase, vol->upcase_len)) {
 found_it2:
@@ -888,7 +888,7 @@
 		 * know which way in the B+tree we have to go.
 		 */
 		rc = ntfs_collate_names(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, 1,
 				IGNORE_CASE, vol->upcase, vol->upcase_len);
 		/*
@@ -907,7 +907,7 @@
 		 * collation.
 		 */
 		rc = ntfs_collate_names(uname, uname_len,
-				(uchar_t*)&ie->key.file_name.file_name,
+				(ntfschar*)&ie->key.file_name.file_name,
 				ie->key.file_name.file_name_length, 1,
 				CASE_SENSITIVE, vol->upcase, vol->upcase_len);
 		if (rc == -1)
@@ -1027,7 +1027,7 @@
 		ntfs_debug("Skipping system file.");
 		return 0;
 	}
-	name_len = ntfs_ucstonls(vol, (uchar_t*)&ie->key.file_name.file_name,
+	name_len = ntfs_ucstonls(vol, (ntfschar*)&ie->key.file_name.file_name,
 			ie->key.file_name.file_name_length, &name,
 			NTFS_MAX_NAME_LEN * NLS_MAX_CHARSET_SIZE + 1);
 	if (name_len <= 0) {
@@ -1067,7 +1067,7 @@
 	ntfs_inode *ndir = NTFS_I(vdir);
 	ntfs_volume *vol = NTFS_SB(sb);
 	MFT_RECORD *m;
-	INDEX_ROOT *ir;
+	INDEX_ROOT *ir = NULL;
 	INDEX_ENTRY *ie;
 	INDEX_ALLOCATION *ia;
 	u8 *name = NULL;
@@ -1139,9 +1139,29 @@
 				"inode 0x%lx.", vdir->i_ino);
 		goto err_out;
 	}
-	/* Get to the index root value (it's been verified in read_inode). */
-	ir = (INDEX_ROOT*)((u8*)ctx->attr +
-			le16_to_cpu(ctx->attr->data.resident.value_offset));
+	/*
+	 * Copy the index root attribute value to a buffer so that we can put
+	 * the search context and unmap the mft record before calling the
+	 * filldir() callback.  We need to do this because of NFSd which calls
+	 * ->lookup() from its filldir callback() and this causes NTFS to
+	 * deadlock as ntfs_lookup() maps the mft record of the directory and
+	 * we have got it mapped here already.  The only solution is for us to
+	 * unmap the mft record here so that a call to ntfs_lookup() is able to
+	 * map the mft record without deadlocking.
+	 */
+	rc = le32_to_cpu(ctx->attr->data.resident.value_length);
+	ir = (INDEX_ROOT*)kmalloc(rc, GFP_NOFS);
+	if (unlikely(!ir)) {
+		err = -ENOMEM;
+		goto err_out;
+	}
+	/* Copy the index root value (it has been verified in read_inode). */
+	memcpy(ir, (u8*)ctx->attr +
+			le16_to_cpu(ctx->attr->data.resident.value_offset), rc);
+	put_attr_search_ctx(ctx);
+	unmap_mft_record(ndir);
+	ctx = NULL;
+	m = NULL;
 	index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length);
 	/* The first index entry. */
 	ie = (INDEX_ENTRY*)((u8*)&ir->index +
@@ -1154,7 +1174,7 @@
 	for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
 		ntfs_debug("In index root, offset 0x%x.", (u8*)ie - (u8*)ir);
 		/* Bounds checks. */
-		if (unlikely((u8*)ie < (u8*)ctx->mrec || (u8*)ie +
+		if (unlikely((u8*)ie < (u8*)ir || (u8*)ie +
 				sizeof(INDEX_ENTRY_HEADER) > index_end ||
 				(u8*)ie + le16_to_cpu(ie->key_length) >
 				index_end))
@@ -1169,20 +1189,13 @@
 		rc = ntfs_filldir(vol, &fpos, ndir, INDEX_TYPE_ROOT, ir, ie,
 				name, dirent, filldir);
 		if (rc) {
-			put_attr_search_ctx(ctx);
-			unmap_mft_record(ndir);
+			kfree(ir);
 			goto abort;
 		}
 	}
-	/*
-	 * We are done with the index root and the mft record for that matter.
-	 * We need to release it, otherwise we deadlock on ntfs_attr_iget()
-	 * and/or ntfs_read_page().
-	 */
-	put_attr_search_ctx(ctx);
-	unmap_mft_record(ndir);
-	m = NULL;
-	ctx = NULL;
+	/* We are done with the index root and can free the buffer. */
+	kfree(ir);
+	ir = NULL;
 	/* If there is no index allocation attribute we are finished. */
 	if (!NInoIndexAllocPresent(ndir))
 		goto EOD;
@@ -1196,7 +1209,7 @@
 	ia_mapping = vdir->i_mapping;
 	bmp_vi = ndir->itype.index.bmp_ino;
 	if (unlikely(!bmp_vi)) {
-		ntfs_debug("Inode %lu, regetting index bitmap.", vdir->i_ino);
+		ntfs_debug("Inode 0x%lx, regetting index bitmap.", vdir->i_ino);
 		bmp_vi = ntfs_attr_iget(vdir, AT_BITMAP, I30, 4);
 		if (unlikely(IS_ERR(bmp_vi))) {
 			ntfs_error(sb, "Failed to get bitmap attribute.");
@@ -1379,6 +1392,8 @@
 		ntfs_unmap_page(bmp_page);
 	if (ia_page)
 		ntfs_unmap_page(ia_page);
+	if (ir)
+		kfree(ir);
 	if (name)
 		kfree(name);
 	if (ctx)
diff -Nru a/fs/ntfs/dir.h b/fs/ntfs/dir.h
--- a/fs/ntfs/dir.h	Tue Jun 15 22:20:42 2004
+++ b/fs/ntfs/dir.h	Tue Jun 15 22:20:42 2004
@@ -2,20 +2,20 @@
  * dir.h - Defines for directory handling in NTFS Linux kernel driver. Part of
  *	   the Linux-NTFS project.
  *
- * Copyright (c) 2002 Anton Altaparmakov.
+ * Copyright (c) 2002-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -34,14 +34,13 @@
 	MFT_REF mref;
 	FILE_NAME_TYPE_FLAGS type;
 	u8 len;
-	uchar_t name[0];
+	ntfschar name[0];
 } __attribute__ ((__packed__)) ntfs_name;
 
 /* The little endian Unicode string $I30 as a global constant. */
-extern uchar_t I30[5];
+extern ntfschar I30[5];
 
 extern MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni,
-		const uchar_t *uname, const int uname_len, ntfs_name **res);
+		const ntfschar *uname, const int uname_len, ntfs_name **res);
 
 #endif /* _LINUX_NTFS_FS_DIR_H */
-
diff -Nru a/fs/ntfs/endian.h b/fs/ntfs/endian.h
--- a/fs/ntfs/endian.h	Tue Jun 15 22:20:43 2004
+++ b/fs/ntfs/endian.h	Tue Jun 15 22:20:43 2004
@@ -2,20 +2,20 @@
  * endian.h - Defines for endianness handling in NTFS Linux kernel driver.
  *	      Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -45,4 +45,3 @@
 #define cpu_to_sle64p(x)	((s64)__cpu_to_le64(*(s64*)(x)))
 
 #endif /* _LINUX_NTFS_ENDIAN_H */
-
diff -Nru a/fs/ntfs/file.c b/fs/ntfs/file.c
--- a/fs/ntfs/file.c	Tue Jun 15 22:20:44 2004
+++ b/fs/ntfs/file.c	Tue Jun 15 22:20:44 2004
@@ -1,20 +1,20 @@
 /*
  * file.c - NTFS kernel file operations. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -73,4 +73,3 @@
 struct file_operations ntfs_empty_file_ops = {};
 
 struct inode_operations ntfs_empty_inode_ops = {};
-
diff -Nru a/fs/ntfs/inode.c b/fs/ntfs/inode.c
--- a/fs/ntfs/inode.c	Tue Jun 15 22:20:58 2004
+++ b/fs/ntfs/inode.c	Tue Jun 15 22:20:58 2004
@@ -66,7 +66,7 @@
 		if (ni->name_len != na->name_len)
 			return 0;
 		if (na->name_len && memcmp(ni->name, na->name,
-				na->name_len * sizeof(uchar_t)))
+				na->name_len * sizeof(ntfschar)))
 			return 0;
 	}
 	/* Match! */
@@ -121,8 +121,8 @@
 	if (na->name && na->name_len && na->name != I30) {
 		unsigned int i;
 
-		i = na->name_len * sizeof(uchar_t);
-		ni->name = (uchar_t*)kmalloc(i + sizeof(uchar_t), GFP_ATOMIC);
+		i = na->name_len * sizeof(ntfschar);
+		ni->name = (ntfschar*)kmalloc(i + sizeof(ntfschar), GFP_ATOMIC);
 		if (!ni->name)
 			return -ENOMEM;
 		memcpy(ni->name, na->name, i);
@@ -206,7 +206,7 @@
  * obtained from PTR_ERR().
  */
 struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPES type,
-		uchar_t *name, u32 name_len)
+		ntfschar *name, u32 name_len)
 {
 	struct inode *vi;
 	ntfs_attr na;
@@ -872,7 +872,7 @@
 		/* Setup the operations for this inode. */
 		vi->i_op = &ntfs_dir_inode_ops;
 		vi->i_fop = &ntfs_dir_ops;
-		vi->i_mapping->a_ops = &ntfs_aops;
+		vi->i_mapping->a_ops = &ntfs_mst_aops;
 	} else {
 		/* It is a file. */
 		reinit_attr_search_ctx(ctx);
@@ -1249,7 +1249,10 @@
 	/* Setup the operations for this attribute inode. */
 	vi->i_op = NULL;
 	vi->i_fop = NULL;
-	vi->i_mapping->a_ops = &ntfs_aops;
+	if (NInoMstProtected(ni))
+		vi->i_mapping->a_ops = &ntfs_mst_aops;
+	else
+		vi->i_mapping->a_ops = &ntfs_aops;
 
 	if (!NInoCompressed(ni))
 		vi->i_blocks = ni->allocated_size >> 9;
@@ -1310,7 +1313,7 @@
  * This should work but there are two possible pit falls (see inline comments
  * below), but only time will tell if they are real pits or just smoke...
  */
-void ntfs_read_inode_mount(struct inode *vi)
+int ntfs_read_inode_mount(struct inode *vi)
 {
 	VCN next_vcn, last_vcn, highest_vcn;
 	s64 block;
@@ -1326,12 +1329,6 @@
 
 	ntfs_debug("Entering.");
 
-	if (vi->i_ino != FILE_MFT) {
-		ntfs_error(sb, "Called for inode 0x%lx but only inode %d "
-				"allowed.", vi->i_ino, FILE_MFT);
-		goto err_out;
-	}
-
 	/* Initialize the ntfs specific part of @vi. */
 	ntfs_init_big_inode(vi);
 
@@ -1345,7 +1342,7 @@
 	ni->name_len = 0;
 
 	/*
-	 * This sets up our little cheat allowing us to reuse the async io
+	 * This sets up our little cheat allowing us to reuse the async read io
 	 * completion handler for directories.
 	 */
 	ni->itype.index.block_size = vol->mft_record_size;
@@ -1616,13 +1613,7 @@
 			/*
 			 * We have got the first extent of the run_list for
 			 * $MFT which means it is now relatively safe to call
-			 * the normal ntfs_read_inode() function. Thus, take
-			 * us out of the calling chain. Also we need to do this
-			 * now because we need ntfs_read_inode() in place to
-			 * get at subsequent extents.
-			 */
-			sb->s_op = &ntfs_sops;
-			/*
+			 * the normal ntfs_read_inode() function.
 			 * Complete reading the inode, this will actually
 			 * re-read the mft record for $MFT, this time entering
 			 * it into the page cache with which we complete the
@@ -1649,8 +1640,8 @@
 						"sourceforge.net");
 				put_attr_search_ctx(ctx);
 				/* Revert to the safe super operations. */
-				sb->s_op = &ntfs_mount_sops;
-				goto out_now;
+				ntfs_free(m);
+				return -1;
 			}
 			/*
 			 * Re-initialize some specifics about $MFT's inode as
@@ -1699,32 +1690,19 @@
 	}
 	put_attr_search_ctx(ctx);
 	ntfs_debug("Done.");
-out_now:
 	ntfs_free(m);
-	return;
+	return 0;
+
 em_put_err_out:
 	ntfs_error(sb, "Couldn't find first extent of $DATA attribute in "
 			"attribute list. $MFT is corrupt. Run chkdsk.");
 put_err_out:
 	put_attr_search_ctx(ctx);
 err_out:
-	/* Make sure we revert to the safe super operations. */
-	sb->s_op = &ntfs_mount_sops;
 	ntfs_error(sb, "Failed. Marking inode as bad.");
 	make_bad_inode(vi);
-	goto out_now;
-}
-
-/**
- * ntfs_commit_inode - write out a dirty inode
- * @ni:		inode to write out
- *
- */
-int ntfs_commit_inode(ntfs_inode *ni)
-{
-	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
-	NInoClearDirty(ni);
-	return 0;
+	ntfs_free(m);
+	return -1;
 }
 
 /**
@@ -1755,34 +1733,6 @@
 
 void __ntfs_clear_inode(ntfs_inode *ni)
 {
-	int err;
-
-	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
-	if (NInoDirty(ni)) {
-		err = ntfs_commit_inode(ni);
-		if (err) {
-			ntfs_error(ni->vol->sb, "Failed to commit dirty "
-					"inode synchronously.");
-			// FIXME: Do something!!!
-		}
-	}
-	/* Synchronize with ntfs_commit_inode(). */
-	down(&ni->mrec_lock);
-	up(&ni->mrec_lock);
-	if (NInoDirty(ni)) {
-		ntfs_error(ni->vol->sb, "Failed to commit dirty inode "
-				"asynchronously.");
-		// FIXME: Do something!!!
-	}
-	/* No need to lock at this stage as no one else has a reference. */
-	if (ni->nr_extents > 0) {
-		int i;
-
-		// FIXME: Handle dirty case for each extent inode!
-		for (i = 0; i < ni->nr_extents; i++)
-			ntfs_clear_extent_inode(ni->ext.extent_ntfs_inos[i]);
-		kfree(ni->ext.extent_ntfs_inos);
-	}
 	/* Free all alocated memory. */
 	down_write(&ni->run_list.lock);
 	if (ni->run_list.rl) {
@@ -1812,6 +1762,20 @@
 
 void ntfs_clear_extent_inode(ntfs_inode *ni)
 {
+	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
+
+	BUG_ON(NInoAttr(ni));
+	BUG_ON(ni->nr_extents != -1);
+
+#ifdef NTFS_RW
+	if (NInoDirty(ni)) {
+		if (!is_bad_inode(VFS_I(ni->ext.base_ntfs_ino)))
+			ntfs_error(ni->vol->sb, "Clearing dirty extent inode!  "
+					"Losing data!  This is a BUG!!!");
+		// FIXME:  Do something!!!
+	}
+#endif /* NTFS_RW */
+
 	__ntfs_clear_inode(ni);
 
 	/* Bye, bye... */
@@ -1832,6 +1796,30 @@
 {
 	ntfs_inode *ni = NTFS_I(vi);
 
+#ifdef NTFS_RW
+	if (NInoDirty(ni)) {
+		BOOL was_bad = (is_bad_inode(vi));
+
+		/* Committing the inode also commits all extent inodes. */
+		ntfs_commit_inode(vi);
+
+		if (!was_bad && (is_bad_inode(vi) || NInoDirty(ni))) {
+			ntfs_error(vi->i_sb, "Failed to commit dirty inode "
+					"0x%lx.  Losing data!", vi->i_ino);
+			// FIXME:  Do something!!!
+		}
+	}
+#endif /* NTFS_RW */
+
+	/* No need to lock at this stage as no one else has a reference. */
+	if (ni->nr_extents > 0) {
+		int i;
+
+		for (i = 0; i < ni->nr_extents; i++)
+			ntfs_clear_extent_inode(ni->ext.extent_ntfs_inos[i]);
+		kfree(ni->ext.extent_ntfs_inos);
+	}
+
 	__ntfs_clear_inode(ni);
 
 	if (NInoAttr(ni)) {
@@ -1972,4 +1960,134 @@
 	return err;
 }
 
+/**
+ * ntfs_write_inode - write out a dirty inode
+ * @vi:		inode to write out
+ * @sync:	if true, write out synchronously
+ *
+ * Write out a dirty inode to disk including any extent inodes if present.
+ *
+ * If @sync is true, commit the inode to disk and wait for io completion.  This
+ * is done using write_mft_record().
+ *
+ * If @sync is false, just schedule the write to happen but do not wait for i/o
+ * completion.  In 2.6 kernels, scheduling usually happens just by virtue of
+ * marking the page (and in this case mft record) dirty but we do not implement
+ * this yet as write_mft_record() largely ignores the @sync parameter and
+ * always performs synchronous writes.
+ */
+void ntfs_write_inode(struct inode *vi, int sync)
+{
+	ntfs_inode *ni = NTFS_I(vi);
+#if 0
+	attr_search_context *ctx;
 #endif
+	MFT_RECORD *m;
+	int err = 0;
+
+	ntfs_debug("Entering for %sinode 0x%lx.", NInoAttr(ni) ? "attr " : "",
+			vi->i_ino);
+	/*
+	 * Dirty attribute inodes are written via their real inodes so just
+	 * clean them here.  TODO:  Take care of access time updates.
+	 */
+	if (NInoAttr(ni)) {
+		NInoClearDirty(ni);
+		return;
+	}
+	/* Map, pin, and lock the mft record belonging to the inode. */
+	m = map_mft_record(ni);
+	if (unlikely(IS_ERR(m))) {
+		err = PTR_ERR(m);
+		goto err_out;
+	}
+#if 0
+	/* Obtain the standard information attribute. */
+	ctx = get_attr_search_ctx(ni, m);
+	if (unlikely(!ctx)) {
+		err = -ENOMEM;
+		goto unm_err_out;
+	}
+	if (unlikely(!lookup_attr(AT_STANDARD_INFORMATION, NULL, 0,
+			IGNORE_CASE, 0, NULL, 0, ctx))) {
+		put_attr_search_ctx(ctx);
+		err = -ENOENT;
+		goto unm_err_out;
+	}
+	// TODO:  Update the access times in the standard information attribute
+	// which is now in ctx->attr.
+	// - Probably want to have use sops->dirty_inode() to set a flag that
+	//   we need to update the times here rather than having to blindly do
+	//   it every time.  Or even don't do it here at all and do it in
+	//   sops->dirty_inode() instead.  Problem with this would be that
+	//   sops->dirty_inode() must be atomic under certain circumstances
+	//   and mapping mft records and such like is not atomic.
+	// - For atime updates also need to check whether they are enabled in
+	//   the superblock flags.
+	ntfs_warning(vi->i_sb, "Access time updates not implement yet.");
+	/*
+	 * We just modified the mft record containing the standard information
+	 * attribute.  So need to mark the mft record dirty, too, but we do it
+	 * manually so that mark_inode_dirty() is not called again.
+	 * TODO:  Only do this if there was a change in any of the times!
+	 */
+	if (!NInoTestSetDirty(ctx->ntfs_ino))
+		__set_page_dirty_nobuffers(ctx->ntfs_ino->page);
+	put_attr_search_ctx(ctx);
+#endif
+	/* Write this base mft record. */
+	if (NInoDirty(ni))
+		err = write_mft_record(ni, m, sync);
+	/* Write all attached extent mft records. */
+	down(&ni->extent_lock);
+	if (ni->nr_extents > 0) {
+		ntfs_inode **extent_nis = ni->ext.extent_ntfs_inos;
+		int i;
+
+		ntfs_debug("Writing %i extent inodes.", ni->nr_extents);
+		for (i = 0; i < ni->nr_extents; i++) {
+			ntfs_inode *tni = extent_nis[i];
+
+			if (NInoDirty(tni)) {
+				MFT_RECORD *tm = map_mft_record(tni);
+				int ret;
+
+				if (unlikely(IS_ERR(tm))) {
+					if (!err || err == -ENOMEM)
+						err = PTR_ERR(tm);
+					continue;
+				}
+				ret = write_mft_record(tni, tm, sync);
+				unmap_mft_record(tni);
+				if (unlikely(ret)) {
+					if (!err || err == -ENOMEM)
+						err = ret;
+				}
+			}
+		}
+	}
+	up(&ni->extent_lock);
+	unmap_mft_record(ni);
+	if (unlikely(err))
+		goto err_out;
+	ntfs_debug("Done.");
+	return;
+#if 0
+unm_err_out:
+	unmap_mft_record(ni);
+#endif
+err_out:
+	if (err == -ENOMEM) {
+		ntfs_warning(vi->i_sb, "Not enough memory to write inode.  "
+				"Marking the inode dirty again, so the VFS "
+				"retries later.");
+		mark_inode_dirty(vi);
+	} else {
+		ntfs_error(vi->i_sb, "Failed (error code %i):  Marking inode "
+				"as bad.  You should run chkdsk.", -err);
+		make_bad_inode(vi);
+	}
+	return;
+}
+
+#endif /* NTFS_RW */
diff -Nru a/fs/ntfs/inode.h b/fs/ntfs/inode.h
--- a/fs/ntfs/inode.h	Tue Jun 15 22:20:43 2004
+++ b/fs/ntfs/inode.h	Tue Jun 15 22:20:43 2004
@@ -54,7 +54,7 @@
 	 * name_len = 4 for directories.
 	 */
 	ATTR_TYPES type;	/* Attribute type of this fake inode. */
-	uchar_t *name;		/* Attribute name of this fake inode. */
+	ntfschar *name;		/* Attribute name of this fake inode. */
 	u32 name_len;		/* Attribute name length of this fake inode. */
 	run_list run_list;	/* If state has the NI_NonResident bit set,
 				   the run list of the unnamed data attribute
@@ -248,7 +248,7 @@
  */
 typedef struct {
 	unsigned long mft_no;
-	uchar_t *name;
+	ntfschar *name;
 	u32 name_len;
 	ATTR_TYPES type;
 } ntfs_attr;
@@ -259,7 +259,7 @@
 
 extern struct inode *ntfs_iget(struct super_block *sb, unsigned long mft_no);
 extern struct inode *ntfs_attr_iget(struct inode *base_vi, ATTR_TYPES type,
-		uchar_t *name, u32 name_len);
+		ntfschar *name, u32 name_len);
 
 extern struct inode *ntfs_alloc_big_inode(struct super_block *sb);
 extern void ntfs_destroy_big_inode(struct inode *inode);
@@ -269,7 +269,7 @@
 		unsigned long mft_no);
 extern void ntfs_clear_extent_inode(ntfs_inode *ni);
 
-extern void ntfs_read_inode_mount(struct inode *vi);
+extern int ntfs_read_inode_mount(struct inode *vi);
 
 extern void ntfs_put_inode(struct inode *vi);
 
@@ -280,6 +280,15 @@
 extern void ntfs_truncate(struct inode *vi);
 
 extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr);
+
+extern void ntfs_write_inode(struct inode *vi, int sync);
+
+static inline void ntfs_commit_inode(struct inode *vi)
+{
+	if (!is_bad_inode(vi))
+		ntfs_write_inode(vi, 1);
+	return;
+}
 
 #endif /* NTFS_RW */
 
diff -Nru a/fs/ntfs/layout.h b/fs/ntfs/layout.h
--- a/fs/ntfs/layout.h	Tue Jun 15 22:20:41 2004
+++ b/fs/ntfs/layout.h	Tue Jun 15 22:20:41 2004
@@ -504,7 +504,7 @@
  */
 typedef struct {
 /*hex ofs*/
-/*  0*/	uchar_t name[0x40];		/* Unicode name of the attribute. Zero
+/*  0*/	ntfschar name[0x40];		/* Unicode name of the attribute. Zero
 					   terminated. */
 /* 80*/	ATTR_TYPES type;		/* Type of the attribute. */
 /* 84*/	u32 display_rule;		/* Default display rule.
@@ -910,7 +910,7 @@
 				   attribute value. */
 /* 24*/	u16 instance;		/* If lowest_vcn = 0, the instance of the
 				   attribute being referenced; otherwise 0. */
-/* 26*/	uchar_t name[0];	/* Use when creating only. When reading use
+/* 26*/	ntfschar name[0];	/* Use when creating only. When reading use
 				   name_offset to determine the location of the
 				   name. */
 /* sizeof() = 26 + (attribute_name_length * 2) bytes */
@@ -994,7 +994,7 @@
 /* 40*/	u8 file_name_length;			/* Length of file name in
 						   (Unicode) characters. */
 /* 41*/	FILE_NAME_TYPE_FLAGS file_name_type;	/* Namespace of the file name.*/
-/* 42*/	uchar_t file_name[0];			/* File name in Unicode. */
+/* 42*/	ntfschar file_name[0];			/* File name in Unicode. */
 } __attribute__ ((__packed__)) FILE_NAME_ATTR;
 
 /*
@@ -1090,7 +1090,7 @@
 	SECURITY_NULL_RID		  = 0,	/* S-1-0 */
 	SECURITY_WORLD_RID		  = 0,	/* S-1-1 */
 	SECURITY_LOCAL_RID		  = 0,	/* S-1-2 */
-	
+
 	SECURITY_CREATOR_OWNER_RID	  = 0,	/* S-1-3 */
 	SECURITY_CREATOR_GROUP_RID	  = 1,	/* S-1-3 */
 
@@ -1110,10 +1110,10 @@
 	SECURITY_AUTHENTICATED_USER_RID	  = 0xb,
 	SECURITY_RESTRICTED_CODE_RID	  = 0xc,
 	SECURITY_TERMINAL_SERVER_RID	  = 0xd,
-	
+
 	SECURITY_LOGON_IDS_RID		  = 5,
 	SECURITY_LOGON_IDS_RID_COUNT	  = 3,
-	
+
 	SECURITY_LOCAL_SYSTEM_RID	  = 0x12,
 
 	SECURITY_NT_NON_UNIQUE		  = 0x15,
@@ -1123,12 +1123,12 @@
 	/*
 	 * Well-known domain relative sub-authority values (RIDs).
 	 */
-	
+
 	/* Users. */
 	DOMAIN_USER_RID_ADMIN		  = 0x1f4,
 	DOMAIN_USER_RID_GUEST		  = 0x1f5,
 	DOMAIN_USER_RID_KRBTGT		  = 0x1f6,
-	
+
 	/* Groups. */
 	DOMAIN_GROUP_RID_ADMINS		  = 0x200,
 	DOMAIN_GROUP_RID_USERS		  = 0x201,
@@ -1145,12 +1145,12 @@
 	DOMAIN_ALIAS_RID_USERS		  = 0x221,
 	DOMAIN_ALIAS_RID_GUESTS		  = 0x222,
 	DOMAIN_ALIAS_RID_POWER_USERS	  = 0x223,
-	
+
 	DOMAIN_ALIAS_RID_ACCOUNT_OPS	  = 0x224,
 	DOMAIN_ALIAS_RID_SYSTEM_OPS	  = 0x225,
 	DOMAIN_ALIAS_RID_PRINT_OPS	  = 0x226,
 	DOMAIN_ALIAS_RID_BACKUP_OPS	  = 0x227,
-	
+
 	DOMAIN_ALIAS_RID_REPLICATOR	  = 0x228,
 	DOMAIN_ALIAS_RID_RAS_SERVERS	  = 0x229,
 	DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a,
@@ -1258,7 +1258,7 @@
 
 	ACCESS_ALLOWED_COMPOUND_ACE_TYPE= 4,
 	ACCESS_MAX_MS_V3_ACE_TYPE	= 4,
-	
+
 	/* The following are Win2k only. */
 	ACCESS_MIN_MS_OBJECT_ACE_TYPE	= 5,
 	ACCESS_ALLOWED_OBJECT_ACE_TYPE	= 5,
@@ -1325,33 +1325,33 @@
 	 */
 
 	/* Specific rights for files and directories are as follows: */
-	
+
 	/* Right to read data from the file. (FILE) */
 	FILE_READ_DATA			= const_cpu_to_le32(0x00000001),
 	/* Right to list contents of a directory. (DIRECTORY) */
 	FILE_LIST_DIRECTORY		= const_cpu_to_le32(0x00000001),
-	
+
 	/* Right to write data to the file. (FILE) */
 	FILE_WRITE_DATA			= const_cpu_to_le32(0x00000002),
 	/* Right to create a file in the directory. (DIRECTORY) */
 	FILE_ADD_FILE			= const_cpu_to_le32(0x00000002),
-	
+
 	/* Right to append data to the file. (FILE) */
 	FILE_APPEND_DATA		= const_cpu_to_le32(0x00000004),
 	/* Right to create a subdirectory. (DIRECTORY) */
 	FILE_ADD_SUBDIRECTORY		= const_cpu_to_le32(0x00000004),
-	
+
 	/* Right to read extended attributes. (FILE/DIRECTORY) */
 	FILE_READ_EA			= const_cpu_to_le32(0x00000008),
-	
+
 	/* Right to write extended attributes. (FILE/DIRECTORY) */
 	FILE_WRITE_EA			= const_cpu_to_le32(0x00000010),
-	
+
 	/* Right to execute a file. (FILE) */
 	FILE_EXECUTE			= const_cpu_to_le32(0x00000020),
 	/* Right to traverse the directory. (DIRECTORY) */
 	FILE_TRAVERSE			= const_cpu_to_le32(0x00000020),
-	
+
 	/*
 	 * Right to delete a directory and all the files it contains (its
 	 * children), even if the files are read-only. (DIRECTORY)
@@ -1360,10 +1360,10 @@
 
 	/* Right to read file attributes. (FILE/DIRECTORY) */
 	FILE_READ_ATTRIBUTES		= const_cpu_to_le32(0x00000080),
-	
+
 	/* Right to change file attributes. (FILE/DIRECTORY) */
 	FILE_WRITE_ATTRIBUTES		= const_cpu_to_le32(0x00000100),
-	
+
 	/*
 	 * The standard rights (bits 16 to 23). Are independent of the type of
 	 * object being secured.
@@ -1396,15 +1396,15 @@
 	 * The following STANDARD_RIGHTS_* are combinations of the above for
 	 * convenience and are defined by the Win32 API.
 	 */
-	
+
 	/* These are currently defined to READ_CONTROL. */
 	STANDARD_RIGHTS_READ		= const_cpu_to_le32(0x00020000),
 	STANDARD_RIGHTS_WRITE		= const_cpu_to_le32(0x00020000),
 	STANDARD_RIGHTS_EXECUTE		= const_cpu_to_le32(0x00020000),
-	
+
 	/* Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. */
 	STANDARD_RIGHTS_REQUIRED	= const_cpu_to_le32(0x000f0000),
-	
+
 	/*
 	 * Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and
 	 * SYNCHRONIZE access.
@@ -1775,7 +1775,7 @@
  * NOTE: Present only in FILE_Volume.
  */
 typedef struct {
-	uchar_t name[0];		/* The name of the volume in Unicode. */
+	ntfschar name[0];	/* The name of the volume in Unicode. */
 } __attribute__ ((__packed__)) VOLUME_NAME;
 
 /*
@@ -1790,6 +1790,9 @@
 	VOLUME_REPAIR_OBJECT_ID		= const_cpu_to_le16(0x0020),
 	VOLUME_MODIFIED_BY_CHKDSK	= const_cpu_to_le16(0x8000),
 	VOLUME_FLAGS_MASK		= const_cpu_to_le16(0x803f),
+
+	/* To make our life easier when checking if we must mount read-only. */
+	VOLUME_MUST_MOUNT_RO_MASK	= const_cpu_to_le16(0x8037),
 } __attribute__ ((__packed__)) VOLUME_FLAGS;
 
 /*
@@ -1973,7 +1976,7 @@
 
 	QUOTA_FLAG_USER_MASK		= const_cpu_to_le32(0x00000007),
 		/* Bit mask for user quota flags. */
-	
+
 	/* These flags are only present in the quota defaults index entry,
 	   i.e. in the entry where owner_id = QUOTA_DEFAULTS_ID. */
 	QUOTA_FLAG_TRACKING_ENABLED	= const_cpu_to_le32(0x00000010),
@@ -2177,7 +2180,7 @@
 	IO_REPARSE_TAG_IS_ALIAS		= const_cpu_to_le32(0x20000000),
 	IO_REPARSE_TAG_IS_HIGH_LATENCY	= const_cpu_to_le32(0x40000000),
 	IO_REPARSE_TAG_IS_MICROSOFT	= const_cpu_to_le32(0x80000000),
-	
+
 	IO_REPARSE_TAG_RESERVED_ZERO	= const_cpu_to_le32(0x00000000),
 	IO_REPARSE_TAG_RESERVED_ONE	= const_cpu_to_le32(0x00000001),
 	IO_REPARSE_TAG_RESERVED_RANGE	= const_cpu_to_le32(0x00000001),
@@ -2280,4 +2283,3 @@
 } __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM, EFS_ATTR;
 
 #endif /* _LINUX_NTFS_LAYOUT_H */
-
diff -Nru a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
--- a/fs/ntfs/logfile.c	Tue Jun 15 22:20:39 2004
+++ b/fs/ntfs/logfile.c	Tue Jun 15 22:20:39 2004
@@ -1,7 +1,7 @@
 /*
  * logfile.c - NTFS kernel journal handling. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2002-2004 Anton Altaparmakov.
+ * Copyright (c) 2002-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -25,6 +25,7 @@
 #include <linux/fs.h>
 #include <linux/highmem.h>
 #include <linux/buffer_head.h>
+#include <linux/bitops.h>
 
 #include "logfile.h"
 #include "volume.h"
@@ -455,7 +456,11 @@
 	else
 		log_page_size = PAGE_CACHE_SIZE;
 	log_page_mask = log_page_size - 1;
-	log_page_bits = ffs(log_page_size) - 1;
+	/*
+	 * Use generic_ffs() instead of ffs() to enable the compiler to
+	 * optimize log_page_size and log_page_bits into constants.
+	 */
+	log_page_bits = generic_ffs(log_page_size) - 1;
 	size &= ~(log_page_size - 1);
 	/*
 	 * Ensure the log file is big enough to store at least the two restart
diff -Nru a/fs/ntfs/logfile.h b/fs/ntfs/logfile.h
--- a/fs/ntfs/logfile.h	Tue Jun 15 22:20:43 2004
+++ b/fs/ntfs/logfile.h	Tue Jun 15 22:20:43 2004
@@ -288,7 +288,7 @@
 /* 22*/	u8 reserved[6];		/* Reserved/alignment. */
 /* 28*/	u32 client_name_length; /* Length of client name in bytes.  Should
 				   always be 8. */
-/* 32*/	uchar_t client_name[64];/* Name of the client in Unicode.  Should
+/* 32*/	ntfschar client_name[64];/* Name of the client in Unicode.  Should
 				   always be "NTFS" with the remaining bytes
 				   set to 0. */
 /* sizeof() = 160 (0xa0) bytes */
diff -Nru a/fs/ntfs/malloc.h b/fs/ntfs/malloc.h
--- a/fs/ntfs/malloc.h	Tue Jun 15 22:20:37 2004
+++ b/fs/ntfs/malloc.h	Tue Jun 15 22:20:37 2004
@@ -1,7 +1,7 @@
 /*
  * malloc.h - NTFS kernel memory handling. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
diff -Nru a/fs/ntfs/mft.c b/fs/ntfs/mft.c
--- a/fs/ntfs/mft.c	Tue Jun 15 22:20:42 2004
+++ b/fs/ntfs/mft.c	Tue Jun 15 22:20:42 2004
@@ -1,7 +1,7 @@
 /**
  * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2003 Anton Altaparmakov
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  * Copyright (c) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
@@ -9,13 +9,13 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -102,6 +102,13 @@
  */
 extern int ntfs_readpage(struct file *, struct page *);
 
+#ifdef NTFS_RW
+/**
+ * ntfs_mft_writepage - forward declaration, function is further below
+ */
+static int ntfs_mft_writepage(struct page *page, struct writeback_control *wbc);
+#endif /* NTFS_RW */
+
 /**
  * ntfs_mft_aops - address space operations for access to $MFT
  *
@@ -112,6 +119,10 @@
 	.readpage	= ntfs_readpage,	/* Fill page with data. */
 	.sync_page	= block_sync_page,	/* Currently, just unplugs the
 						   disk request queue. */
+#ifdef NTFS_RW
+	.writepage	= ntfs_mft_writepage,	/* Write out the dirty mft
+						   records in a page. */
+#endif /* NTFS_RW */
 };
 
 /**
@@ -430,3 +441,653 @@
 	return m;
 }
 
+#ifdef NTFS_RW
+
+/**
+ * __mark_mft_record_dirty - set the mft record and the page containing it dirty
+ * @ni:		ntfs inode describing the mapped mft record
+ *
+ * Internal function.  Users should call mark_mft_record_dirty() instead.
+ *
+ * Set the mapped (extent) mft record of the (base or extent) ntfs inode @ni,
+ * as well as the page containing the mft record, dirty.  Also, mark the base
+ * vfs inode dirty.  This ensures that any changes to the mft record are
+ * written out to disk.
+ *
+ * NOTE:  We only set I_DIRTY_SYNC and I_DIRTY_DATASYNC (and not I_DIRTY_PAGES)
+ * on the base vfs inode, because even though file data may have been modified,
+ * it is dirty in the inode meta data rather than the data page cache of the
+ * inode, and thus there are no data pages that need writing out.  Therefore, a
+ * full mark_inode_dirty() is overkill.  A mark_inode_dirty_sync(), on the
+ * other hand, is not sufficient, because I_DIRTY_DATASYNC needs to be set to
+ * ensure ->write_inode is called from generic_osync_inode() and this needs to
+ * happen or the file data would not necessarily hit the device synchronously,
+ * even though the vfs inode has the O_SYNC flag set.  Also, I_DIRTY_DATASYNC
+ * simply "feels" better than just I_DIRTY_SYNC, since the file data has not
+ * actually hit the block device yet, which is not what I_DIRTY_SYNC on its own
+ * would suggest.
+ */
+void __mark_mft_record_dirty(ntfs_inode *ni)
+{
+	struct page *page = ni->page;
+	ntfs_inode *base_ni;
+
+	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
+	BUG_ON(!page);
+	BUG_ON(NInoAttr(ni));
+
+	/*
+	 * Set the page containing the mft record dirty.  This also marks the
+	 * $MFT inode dirty (I_DIRTY_PAGES).
+	 */
+	__set_page_dirty_nobuffers(page);
+
+	/* Determine the base vfs inode and mark it dirty, too. */
+	down(&ni->extent_lock);
+	if (likely(ni->nr_extents >= 0))
+		base_ni = ni;
+	else
+		base_ni = ni->ext.base_ntfs_ino;
+	up(&ni->extent_lock);
+	__mark_inode_dirty(VFS_I(base_ni), I_DIRTY_SYNC | I_DIRTY_DATASYNC);
+}
+
+static const char *ntfs_please_email = "Please email "
+		"linux-ntfs-dev@lists.sourceforge.net and say that you saw "
+		"this message.  Thank you.";
+
+/**
+ * sync_mft_mirror_umount - synchronise an mft record to the mft mirror
+ * @ni:		ntfs inode whose mft record to synchronize
+ * @m:		mapped, mst protected (extent) mft record to synchronize
+ *
+ * Write the mapped, mst protected (extent) mft record @m described by the
+ * (regular or extent) ntfs inode @ni to the mft mirror ($MFTMirr) bypassing
+ * the page cache and the $MFTMirr inode itself.
+ *
+ * This function is only for use at umount time when the mft mirror inode has
+ * already been disposed off.  We BUG() if we are called while the mft mirror
+ * inode is still attached to the volume.
+ *
+ * On success return 0.  On error return -errno.
+ *
+ * NOTE:  This function is not implemented yet as I am not convinced it can
+ * actually be triggered considering the sequence of commits we do in super.c::
+ * ntfs_put_super().  But just in case we provide this place holder as the
+ * alternative would be either to BUG() or to get a NULL pointer dereference
+ * and Oops.
+ */
+static int sync_mft_mirror_umount(ntfs_inode *ni, MFT_RECORD *m)
+{
+	ntfs_volume *vol = ni->vol;
+
+	BUG_ON(vol->mftmirr_ino);
+	ntfs_error(vol->sb, "Umount time mft mirror syncing is not "
+			"implemented yet.  %s", ntfs_please_email);
+	return -EOPNOTSUPP;
+}
+
+/**
+ * sync_mft_mirror - synchronize an mft record to the mft mirror
+ * @ni:		ntfs inode whose mft record to synchronize
+ * @m:		mapped, mst protected (extent) mft record to synchronize
+ * @sync:	if true, wait for i/o completion
+ *
+ * Write the mapped, mst protected (extent) mft record @m described by the
+ * (regular or extent) ntfs inode @ni to the mft mirror ($MFTMirr).
+ *
+ * On success return 0.  On error return -errno and set the volume errors flag
+ * in the ntfs_volume to which @ni belongs.
+ *
+ * NOTE:  We always perform synchronous i/o and ignore the @sync parameter.
+ *
+ * TODO:  If @sync is false, want to do truly asynchronous i/o, i.e. just
+ * schedule i/o via ->writepage or do it via kntfsd or whatever.
+ */
+static int sync_mft_mirror(ntfs_inode *ni, MFT_RECORD *m, int sync)
+{
+	ntfs_volume *vol = ni->vol;
+	struct page *page;
+	unsigned int blocksize = vol->sb->s_blocksize;
+	int max_bhs = vol->mft_record_size / blocksize;
+	struct buffer_head *bhs[max_bhs];
+	struct buffer_head *bh, *head;
+	u8 *kmirr;
+	unsigned int block_start, block_end, m_start, m_end;
+	int i_bhs, nr_bhs, err = 0;
+
+	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
+	BUG_ON(!max_bhs);
+	if (unlikely(!vol->mftmirr_ino)) {
+		/* This could happen during umount... */
+		err = sync_mft_mirror_umount(ni, m);
+		if (likely(!err))
+			return err;
+		goto err_out;
+	}
+	/* Get the page containing the mirror copy of the mft record @m. */
+	page = ntfs_map_page(vol->mftmirr_ino->i_mapping, ni->mft_no >>
+			(PAGE_CACHE_SHIFT - vol->mft_record_size_bits));
+	if (unlikely(IS_ERR(page))) {
+		ntfs_error(vol->sb, "Failed to map mft mirror page.");
+		err = PTR_ERR(page);
+		goto err_out;
+	}
+	/*
+	 * Exclusion against other writers.   This should never be a problem
+	 * since the page in which the mft record @m resides is also locked and
+	 * hence any other writers would be held up there but it is better to
+	 * make sure no one is writing from elsewhere.
+	 */
+	lock_page(page);
+	/* The address in the page of the mirror copy of the mft record @m. */
+	kmirr = page_address(page) + ((ni->mft_no << vol->mft_record_size_bits)
+			& ~PAGE_CACHE_MASK);
+	/* Copy the mst protected mft record to the mirror. */
+	memcpy(kmirr, m, vol->mft_record_size);
+	/* Make sure we have mapped buffers. */
+	if (!page_has_buffers(page)) {
+no_buffers_err_out:
+		ntfs_error(vol->sb, "Writing mft mirror records without "
+				"existing buffers is not implemented yet.  %s",
+				ntfs_please_email);
+		err = -EOPNOTSUPP;
+		goto unlock_err_out;
+	}
+	bh = head = page_buffers(page);
+	if (!bh)
+		goto no_buffers_err_out;
+	nr_bhs = 0;
+	block_start = 0;
+	m_start = kmirr - (u8*)page_address(page);
+	m_end = m_start + vol->mft_record_size;
+	do {
+		block_end = block_start + blocksize;
+		/*
+		 * If the buffer is outside the mft record, just skip it,
+		 * clearing it if it is dirty to make sure it is not written
+		 * out.  It should never be marked dirty but better be safe.
+		 */
+		if ((block_end <= m_start) || (block_start >= m_end)) {
+			if (buffer_dirty(bh)) {
+				ntfs_warning(vol->sb, "Clearing dirty mft "
+						"record page buffer.  %s",
+						ntfs_please_email);
+				clear_buffer_dirty(bh);
+			}
+			continue;
+		}
+		if (!buffer_mapped(bh)) {
+			ntfs_error(vol->sb, "Writing mft mirror records "
+					"without existing mapped buffers is "
+					"not implemented yet.  %s",
+					ntfs_please_email);
+			err = -EOPNOTSUPP;
+			continue;
+		}
+		if (!buffer_uptodate(bh)) {
+			ntfs_error(vol->sb, "Writing mft mirror records "
+					"without existing uptodate buffers is "
+					"not implemented yet.  %s",
+					ntfs_please_email);
+			err = -EOPNOTSUPP;
+			continue;
+		}
+		BUG_ON(!nr_bhs && (m_start != block_start));
+		BUG_ON(nr_bhs >= max_bhs);
+		bhs[nr_bhs++] = bh;
+		BUG_ON((nr_bhs >= max_bhs) && (m_end != block_end));
+	} while (block_start = block_end, (bh = bh->b_this_page) != head);
+	if (likely(!err)) {
+		/* Lock buffers and start synchronous write i/o on them. */
+		for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
+			struct buffer_head *tbh = bhs[i_bhs];
+
+			if (unlikely(test_set_buffer_locked(tbh)))
+				BUG();
+			BUG_ON(!buffer_uptodate(tbh));
+			if (buffer_dirty(tbh))
+				clear_buffer_dirty(tbh);
+			get_bh(tbh);
+			tbh->b_end_io = end_buffer_write_sync;
+			submit_bh(WRITE, tbh);
+		}
+		/* Wait on i/o completion of buffers. */
+		for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
+			struct buffer_head *tbh = bhs[i_bhs];
+
+			wait_on_buffer(tbh);
+			if (unlikely(!buffer_uptodate(tbh))) {
+				err = -EIO;
+				/*
+				 * Set the buffer uptodate so the page & buffer
+				 * states don't become out of sync.
+				 */
+				if (PageUptodate(page))
+					set_buffer_uptodate(tbh);
+			}
+		}
+	} else /* if (unlikely(err)) */ {
+		/* Clean the buffers. */
+		for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++)
+			clear_buffer_dirty(bhs[i_bhs]);
+	}
+unlock_err_out:
+	/* Current state: all buffers are clean, unlocked, and uptodate. */
+	/* Remove the mst protection fixups again. */
+	post_write_mst_fixup((NTFS_RECORD*)kmirr);
+	flush_dcache_page(page);
+	unlock_page(page);
+	ntfs_unmap_page(page);
+	if (unlikely(err)) {
+		/* I/O error during writing.  This is really bad! */
+		ntfs_error(vol->sb, "I/O error while writing mft mirror "
+				"record 0x%lx!  You should unmount the volume "
+				"and run chkdsk or ntfsfix.", ni->mft_no);
+		goto err_out;
+	}
+	ntfs_debug("Done.");
+	return 0;
+err_out:
+	ntfs_error(vol->sb, "Failed to synchronize $MFTMirr (error code %i).  "
+			"Volume will be left marked dirty on umount.  Run "
+			"ntfsfix on the partition after umounting to correct "
+			"this.", -err);
+	/* We don't want to clear the dirty bit on umount. */
+	NVolSetErrors(vol);
+	return err;
+}
+
+/**
+ * write_mft_record_nolock - write out a mapped (extent) mft record
+ * @ni:		ntfs inode describing the mapped (extent) mft record
+ * @m:		mapped (extent) mft record to write
+ * @sync:	if true, wait for i/o completion
+ *
+ * Write the mapped (extent) mft record @m described by the (regular or extent)
+ * ntfs inode @ni to backing store.  If the mft record @m has a counterpart in
+ * the mft mirror, that is also updated.
+ *
+ * On success, clean the mft record and return 0.  On error, leave the mft
+ * record dirty and return -errno.  The caller should call make_bad_inode() on
+ * the base inode to ensure no more access happens to this inode.  We do not do
+ * it here as the caller may want to finish writing other extent mft records
+ * first to minimize on-disk metadata inconsistencies.
+ *
+ * NOTE:  We always perform synchronous i/o and ignore the @sync parameter.
+ * However, if the mft record has a counterpart in the mft mirror and @sync is
+ * true, we write the mft record, wait for i/o completion, and only then write
+ * the mft mirror copy.  This ensures that if the system crashes either the mft
+ * or the mft mirror will contain a self-consistent mft record @m.  If @sync is
+ * false on the other hand, we start i/o on both and then wait for completion
+ * on them.  This provides a speedup but no longer guarantees that you will end
+ * up with a self-consistent mft record in the case of a crash but if you asked
+ * for asynchronous writing you probably do not care about that anyway.
+ *
+ * TODO:  If @sync is false, want to do truly asynchronous i/o, i.e. just
+ * schedule i/o via ->writepage or do it via kntfsd or whatever.
+ */
+int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync)
+{
+	ntfs_volume *vol = ni->vol;
+	struct page *page = ni->page;
+	unsigned int blocksize = vol->sb->s_blocksize;
+	int max_bhs = vol->mft_record_size / blocksize;
+	struct buffer_head *bhs[max_bhs];
+	struct buffer_head *bh, *head;
+	unsigned int block_start, block_end, m_start, m_end;
+	int i_bhs, nr_bhs, err = 0;
+
+	ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
+	BUG_ON(NInoAttr(ni));
+	BUG_ON(!max_bhs);
+	BUG_ON(!page);
+	BUG_ON(!PageLocked(page));
+	/*
+	 * If the ntfs_inode is clean no need to do anything.  If it is dirty,
+	 * mark it as clean now so that it can be redirtied later on if needed.
+	 * There is no danger of races as as long as the caller is holding the
+	 * locks for the mft record @m and the page it is in.
+	 */
+	if (!NInoTestClearDirty(ni))
+		goto done;
+	/* Make sure we have mapped buffers. */
+	if (!page_has_buffers(page)) {
+no_buffers_err_out:
+		ntfs_error(vol->sb, "Writing mft records without existing "
+				"buffers is not implemented yet.  %s",
+				ntfs_please_email);
+		err = -EOPNOTSUPP;
+		goto err_out;
+	}
+	bh = head = page_buffers(page);
+	if (!bh)
+		goto no_buffers_err_out;
+	nr_bhs = 0;
+	block_start = 0;
+	m_start = ni->page_ofs;
+	m_end = m_start + vol->mft_record_size;
+	do {
+		block_end = block_start + blocksize;
+		/*
+		 * If the buffer is outside the mft record, just skip it,
+		 * clearing it if it is dirty to make sure it is not written
+		 * out.  It should never be marked dirty but better be safe.
+		 */
+		if ((block_end <= m_start) || (block_start >= m_end)) {
+			if (buffer_dirty(bh)) {
+				ntfs_warning(vol->sb, "Clearing dirty mft "
+						"record page buffer.  %s",
+						ntfs_please_email);
+				clear_buffer_dirty(bh);
+			}
+			continue;
+		}
+		if (!buffer_mapped(bh)) {
+			ntfs_error(vol->sb, "Writing mft records without "
+					"existing mapped buffers is not "
+					"implemented yet.  %s",
+					ntfs_please_email);
+			err = -EOPNOTSUPP;
+			continue;
+		}
+		if (!buffer_uptodate(bh)) {
+			ntfs_error(vol->sb, "Writing mft records without "
+					"existing uptodate buffers is not "
+					"implemented yet.  %s",
+					ntfs_please_email);
+			err = -EOPNOTSUPP;
+			continue;
+		}
+		BUG_ON(!nr_bhs && (m_start != block_start));
+		BUG_ON(nr_bhs >= max_bhs);
+		bhs[nr_bhs++] = bh;
+		BUG_ON((nr_bhs >= max_bhs) && (m_end != block_end));
+	} while (block_start = block_end, (bh = bh->b_this_page) != head);
+	if (unlikely(err))
+		goto cleanup_out;
+	/* Apply the mst protection fixups. */
+	err = pre_write_mst_fixup((NTFS_RECORD*)m, vol->mft_record_size);
+	if (err) {
+		ntfs_error(vol->sb, "Failed to apply mst fixups!");
+		goto cleanup_out;
+	}
+	flush_dcache_mft_record_page(ni);
+	/* Lock buffers and start synchronous write i/o on them. */
+	for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
+		struct buffer_head *tbh = bhs[i_bhs];
+
+		if (unlikely(test_set_buffer_locked(tbh)))
+			BUG();
+		BUG_ON(!buffer_uptodate(tbh));
+		if (buffer_dirty(tbh))
+			clear_buffer_dirty(tbh);
+		get_bh(tbh);
+		tbh->b_end_io = end_buffer_write_sync;
+		submit_bh(WRITE, tbh);
+	}
+	/* Synchronize the mft mirror now if not @sync. */
+	if (!sync && ni->mft_no < vol->mftmirr_size)
+		sync_mft_mirror(ni, m, sync);
+	/* Wait on i/o completion of buffers. */
+	for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
+		struct buffer_head *tbh = bhs[i_bhs];
+
+		wait_on_buffer(tbh);
+		if (unlikely(!buffer_uptodate(tbh))) {
+			err = -EIO;
+			/*
+			 * Set the buffer uptodate so the page & buffer states
+			 * don't become out of sync.
+			 */
+			if (PageUptodate(page))
+				set_buffer_uptodate(tbh);
+		}
+	}
+	/* If @sync, now synchronize the mft mirror. */
+	if (sync && ni->mft_no < vol->mftmirr_size)
+		sync_mft_mirror(ni, m, sync);
+	/* Remove the mst protection fixups again. */
+	post_write_mst_fixup((NTFS_RECORD*)m);
+	flush_dcache_mft_record_page(ni);
+	if (unlikely(err)) {
+		/* I/O error during writing.  This is really bad! */
+		ntfs_error(vol->sb, "I/O error while writing mft record "
+				"0x%lx!  Marking base inode as bad.  You "
+				"should unmount the volume and run chkdsk.",
+				ni->mft_no);
+		goto err_out;
+	}
+done:
+	ntfs_debug("Done.");
+	return 0;
+cleanup_out:
+	/* Clean the buffers. */
+	for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++)
+		clear_buffer_dirty(bhs[i_bhs]);
+err_out:
+	/*
+	 * Current state: all buffers are clean, unlocked, and uptodate.
+	 * The caller should mark the base inode as bad so that no more i/o
+	 * happens.  ->clear_inode() will still be invoked so all extent inodes
+	 * and other allocated memory will be freed.
+	 */
+	if (err == -ENOMEM) {
+		ntfs_error(vol->sb, "Not enough memory to write mft record.  "
+				"Redirtying so the write is retried later.");
+		mark_mft_record_dirty(ni);
+		err = 0;
+	}
+	return err;
+}
+
+/**
+ * ntfs_mft_writepage - check if a metadata page contains dirty mft records
+ * @page:	metadata page possibly containing dirty mft records
+ * @wbc:	writeback control structure
+ *
+ * This is called from the VM when it wants to have a dirty $MFT/$DATA metadata
+ * page cache page cleaned.  The VM has already locked the page and marked it
+ * clean.  Instead of writing the page as a conventional ->writepage function
+ * would do, we check if the page still contains any dirty mft records (it must
+ * have done at some point in the past since the page was marked dirty) and if
+ * none are found, i.e. all mft records are clean, we unlock the page and
+ * return.  The VM is then free to do with the page as it pleases.  If on the
+ * other hand we do find any dirty mft records in the page, we redirty the page
+ * before unlocking it and returning so the VM knows that the page is still
+ * busy and cannot be thrown out.
+ *
+ * Note, we do not actually write any dirty mft records here because they are
+ * dirty inodes and hence will be written by the VFS inode dirty code paths.
+ * There is no need to write them from the VM page dirty code paths, too and in
+ * fact once we implement journalling it would be a complete nightmare having
+ * two code paths leading to mft record writeout.
+ */
+static int ntfs_mft_writepage(struct page *page, struct writeback_control *wbc)
+{
+	struct inode *mft_vi = page->mapping->host;
+	struct super_block *sb = mft_vi->i_sb;
+	ntfs_volume *vol = NTFS_SB(sb);
+	u8 *maddr;
+	MFT_RECORD *m;
+	ntfs_inode **extent_nis;
+	unsigned long mft_no;
+	int nr, i, j;
+	BOOL is_dirty = FALSE;
+
+	BUG_ON(mft_vi != vol->mft_ino);
+	/* The first mft record number in the page. */
+	mft_no = page->index << (PAGE_CACHE_SHIFT - vol->mft_record_size_bits);
+	/* Number of mft records in the page. */
+	nr = PAGE_CACHE_SIZE >> vol->mft_record_size_bits;
+	BUG_ON(!nr);
+	ntfs_debug("Entering for %i inodes starting at 0x%lx.", nr, mft_no);
+	/* Iterate over the mft records in the page looking for a dirty one. */
+	maddr = (u8*)kmap(page);
+	for (i = 0; i < nr; ++i, ++mft_no, maddr += vol->mft_record_size) {
+		struct inode *vi;
+		ntfs_inode *ni, *eni;
+		ntfs_attr na;
+
+		na.mft_no = mft_no;
+		na.name = NULL;
+		na.name_len = 0;
+		na.type = AT_UNUSED;
+		/*
+		 * Check if the inode corresponding to this mft record is in
+		 * the VFS inode cache and obtain a reference to it if it is.
+		 */
+		ntfs_debug("Looking for inode 0x%lx in icache.", mft_no);
+		/*
+		 * For inode 0, i.e. $MFT itself, we cannot use ilookup5() from
+		 * here or we deadlock because the inode is already locked by
+		 * the kernel (fs/fs-writeback.c::__sync_single_inode()) and
+		 * ilookup5() waits until the inode is unlocked before
+		 * returning it and it never gets unlocked because
+		 * ntfs_mft_writepage() never returns.  )-:  Fortunately, we
+		 * have inode 0 pinned in icache for the duration of the mount
+		 * so we can access it directly.
+		 */
+		if (!mft_no) {
+			/* Balance the below iput(). */
+			vi = igrab(mft_vi);
+			BUG_ON(vi != mft_vi);
+		} else
+			vi = ilookup5(sb, mft_no, (test_t)ntfs_test_inode, &na);
+		if (vi) {
+			ntfs_debug("Inode 0x%lx is in icache.", mft_no);
+			/* The inode is in icache.  Check if it is dirty. */
+			ni = NTFS_I(vi);
+			if (!NInoDirty(ni)) {
+				/* The inode is not dirty, skip this record. */
+				ntfs_debug("Inode 0x%lx is not dirty, "
+						"continuing search.", mft_no);
+				iput(vi);
+				continue;
+			}
+			ntfs_debug("Inode 0x%lx is dirty, aborting search.",
+					mft_no);
+			/* The inode is dirty, no need to search further. */
+			iput(vi);
+			is_dirty = TRUE;
+			break;
+		}
+		ntfs_debug("Inode 0x%lx is not in icache.", mft_no);
+		/* The inode is not in icache. */
+		/* Skip the record if it is not a mft record (type "FILE"). */
+		if (!ntfs_is_mft_recordp(maddr)) {
+			ntfs_debug("Mft record 0x%lx is not a FILE record, "
+					"continuing search.", mft_no);
+			continue;
+		}
+		m = (MFT_RECORD*)maddr;
+		/*
+		 * Skip the mft record if it is not in use.  FIXME:  What about
+		 * deleted/deallocated (extent) inodes?  (AIA)
+		 */
+		if (!(m->flags & MFT_RECORD_IN_USE)) {
+			ntfs_debug("Mft record 0x%lx is not in use, "
+					"continuing search.", mft_no);
+			continue;
+		}
+		/* Skip the mft record if it is a base inode. */
+		if (!m->base_mft_record) {
+			ntfs_debug("Mft record 0x%lx is a base record, "
+					"continuing search.", mft_no);
+			continue;
+		}
+		/*
+		 * This is an extent mft record.  Check if the inode
+		 * corresponding to its base mft record is in icache.
+		 */
+		na.mft_no = MREF_LE(m->base_mft_record);
+		ntfs_debug("Mft record 0x%lx is an extent record.  Looking "
+				"for base inode 0x%lx in icache.", mft_no,
+				na.mft_no);
+		vi = ilookup5(sb, na.mft_no, (test_t)ntfs_test_inode,
+				&na);
+		if (!vi) {
+			/*
+			 * The base inode is not in icache.  Skip this extent
+			 * mft record.
+			 */
+			ntfs_debug("Base inode 0x%lx is not in icache, "
+					"continuing search.", na.mft_no);
+			continue;
+		}
+		ntfs_debug("Base inode 0x%lx is in icache.", na.mft_no);
+		/*
+		 * The base inode is in icache.  Check if it has the extent
+		 * inode corresponding to this extent mft record attached.
+		 */
+		ni = NTFS_I(vi);
+		down(&ni->extent_lock);
+		if (ni->nr_extents <= 0) {
+			/*
+			 * The base inode has no attached extent inodes.  Skip
+			 * this extent mft record.
+			 */
+			up(&ni->extent_lock);
+			iput(vi);
+			continue;
+		}
+		/* Iterate over the attached extent inodes. */
+		extent_nis = ni->ext.extent_ntfs_inos;
+		for (eni = NULL, j = 0; j < ni->nr_extents; ++j) {
+			if (mft_no == extent_nis[j]->mft_no) {
+				/*
+				 * Found the extent inode corresponding to this
+				 * extent mft record.
+				 */
+				eni = extent_nis[j];
+				break;
+			}
+		}
+		/*
+		 * If the extent inode was not attached to the base inode, skip
+		 * this extent mft record.
+		 */
+		if (!eni) {
+			up(&ni->extent_lock);
+			iput(vi);
+			continue;
+		}
+		/*
+		 * Found the extent inode corrsponding to this extent mft
+		 * record.  If it is dirty, no need to search further.
+		 */
+		if (NInoDirty(eni)) {
+			up(&ni->extent_lock);
+			iput(vi);
+			is_dirty = TRUE;
+			break;
+		}
+		/* The extent inode is not dirty, so do the next record. */
+		up(&ni->extent_lock);
+		iput(vi);
+	}
+	kunmap(page);
+	/* If a dirty mft record was found, redirty the page. */
+	if (is_dirty) {
+		ntfs_debug("Inode 0x%lx is dirty.  Redirtying the page "
+				"starting at inode 0x%lx.", mft_no,
+				page->index << (PAGE_CACHE_SHIFT -
+				vol->mft_record_size_bits));
+		redirty_page_for_writepage(wbc, page);
+		unlock_page(page);
+	} else {
+		/*
+		 * Keep the VM happy.  This must be done otherwise the
+		 * radix-tree tag PAGECACHE_TAG_DIRTY remains set even though
+		 * the page is clean.
+		 */
+		BUG_ON(PageWriteback(page));
+		set_page_writeback(page);
+		unlock_page(page);
+		end_page_writeback(page);
+	}
+	ntfs_debug("Done.");
+	return 0;
+}
+
+#endif /* NTFS_RW */
diff -Nru a/fs/ntfs/mft.h b/fs/ntfs/mft.h
--- a/fs/ntfs/mft.h	Tue Jun 15 22:20:37 2004
+++ b/fs/ntfs/mft.h	Tue Jun 15 22:20:37 2004
@@ -2,7 +2,7 @@
  * mft.h - Defines for mft record handling in NTFS Linux kernel driver.
  *	   Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -28,8 +28,6 @@
 #include "inode.h"
 
 extern int format_mft_record(ntfs_inode *ni, MFT_RECORD *m);
-//extern int format_mft_record2(struct super_block *vfs_sb,
-//		const unsigned long inum, MFT_RECORD *m);
 
 extern MFT_RECORD *map_mft_record(ntfs_inode *ni);
 extern void unmap_mft_record(ntfs_inode *ni);
@@ -57,6 +55,60 @@
 static inline void flush_dcache_mft_record_page(ntfs_inode *ni)
 {
 	flush_dcache_page(ni->page);
+}
+
+extern void __mark_mft_record_dirty(ntfs_inode *ni);
+
+/**
+ * mark_mft_record_dirty - set the mft record and the page containing it dirty
+ * @ni:		ntfs inode describing the mapped mft record
+ *
+ * Set the mapped (extent) mft record of the (base or extent) ntfs inode @ni,
+ * as well as the page containing the mft record, dirty.  Also, mark the base
+ * vfs inode dirty.  This ensures that any changes to the mft record are
+ * written out to disk.
+ *
+ * NOTE:  Do not do anything if the mft record is already marked dirty.
+ */
+static inline void mark_mft_record_dirty(ntfs_inode *ni)
+{
+	if (!NInoTestSetDirty(ni))
+		__mark_mft_record_dirty(ni);
+}
+
+extern int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync);
+
+/**
+ * write_mft_record - write out a mapped (extent) mft record
+ * @ni:		ntfs inode describing the mapped (extent) mft record
+ * @m:		mapped (extent) mft record to write
+ * @sync:	if true, wait for i/o completion
+ *
+ * This is just a wrapper for write_mft_record_nolock() (see mft.c), which
+ * locks the page for the duration of the write.  This ensures that there are
+ * no race conditions between writing the mft record via the dirty inode code
+ * paths and via the page cache write back code paths or between writing
+ * neighbouring mft records residing in the same page.
+ *
+ * Locking the page also serializes us against ->readpage() if the page is not
+ * uptodate.
+ *
+ * On success, clean the mft record and return 0.  On error, leave the mft
+ * record dirty and return -errno.  The caller should call make_bad_inode() on
+ * the base inode to ensure no more access happens to this inode.  We do not do
+ * it here as the caller may want to finish writing other extent mft records
+ * first to minimize on-disk metadata inconsistencies.
+ */
+static inline int write_mft_record(ntfs_inode *ni, MFT_RECORD *m, int sync)
+{
+	struct page *page = ni->page;
+	int err;
+
+	BUG_ON(!page);
+	lock_page(page);
+	err = write_mft_record_nolock(ni, m, sync);
+	unlock_page(page);
+	return err;
 }
 
 #endif /* NTFS_RW */
diff -Nru a/fs/ntfs/mst.c b/fs/ntfs/mst.c
--- a/fs/ntfs/mst.c	Tue Jun 15 22:20:41 2004
+++ b/fs/ntfs/mst.c	Tue Jun 15 22:20:41 2004
@@ -2,7 +2,7 @@
  * mst.c - NTFS multi sector transfer protection handling code. Part of the
  *	   Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
diff -Nru a/fs/ntfs/namei.c b/fs/ntfs/namei.c
--- a/fs/ntfs/namei.c	Tue Jun 15 22:20:43 2004
+++ b/fs/ntfs/namei.c	Tue Jun 15 22:20:43 2004
@@ -1,6 +1,6 @@
 /*
  * namei.c - NTFS kernel directory inode operations. Part of the Linux-NTFS
- * 	     project.
+ *	     project.
  *
  * Copyright (c) 2001-2004 Anton Altaparmakov
  *
@@ -9,13 +9,13 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -98,7 +98,7 @@
 {
 	ntfs_volume *vol = NTFS_SB(dir_ino->i_sb);
 	struct inode *dent_inode;
-	uchar_t *uname;
+	ntfschar *uname;
 	ntfs_name *name = NULL;
 	MFT_REF mref;
 	unsigned long dent_ino;
@@ -177,7 +177,7 @@
 	nls_name.name = NULL;
 	if (name->type != FILE_NAME_DOS) {			/* Case 2. */
 		nls_name.len = (unsigned)ntfs_ucstonls(vol,
-				(uchar_t*)&name->name, name->len,
+				(ntfschar*)&name->name, name->len,
 				(unsigned char**)&nls_name.name, 0);
 		kfree(name);
 	} else /* if (name->type == FILE_NAME_DOS) */ {		/* Case 3. */
@@ -221,14 +221,14 @@
 				goto eio_err_out;
 			fn = (FILE_NAME_ATTR*)((u8*)ctx->attr + le16_to_cpu(
 					ctx->attr->data.resident.value_offset));
-			if ((u32)(fn->file_name_length * sizeof(uchar_t) +
+			if ((u32)(fn->file_name_length * sizeof(ntfschar) +
 					sizeof(FILE_NAME_ATTR)) > val_len)
 				goto eio_err_out;
 		} while (fn->file_name_type != FILE_NAME_WIN32);
 
 		/* Convert the found WIN32 name to current NLS code page. */
 		nls_name.len = (unsigned)ntfs_ucstonls(vol,
-				(uchar_t*)&fn->file_name, fn->file_name_length,
+				(ntfschar*)&fn->file_name, fn->file_name_length,
 				(unsigned char**)&nls_name.name, 0);
 
 		put_attr_search_ctx(ctx);
diff -Nru a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h
--- a/fs/ntfs/ntfs.h	Tue Jun 15 22:20:39 2004
+++ b/fs/ntfs/ntfs.h	Tue Jun 15 22:20:39 2004
@@ -2,8 +2,8 @@
  * ntfs.h - Defines for NTFS Linux kernel driver. Part of the Linux-NTFS
  *	    project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
- * Copyright (C) 2002 Richard Russon.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
+ * Copyright (C) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -61,9 +61,8 @@
 
 /* The various operations structs defined throughout the driver files. */
 extern struct super_operations ntfs_sops;
-extern struct super_operations ntfs_mount_sops;
-
 extern struct address_space_operations ntfs_aops;
+extern struct address_space_operations ntfs_mst_aops;
 extern struct address_space_operations ntfs_mft_aops;
 
 extern struct  file_operations ntfs_file_ops;
@@ -75,14 +74,6 @@
 extern struct  file_operations ntfs_empty_file_ops;
 extern struct inode_operations ntfs_empty_inode_ops;
 
-/* Generic macros to convert pointers to values and vice versa. */
-#ifndef p2n
-#define p2n(p)		((ptrdiff_t)((ptrdiff_t*)(p)))
-#endif
-#ifndef n2p
-#define n2p(p)		((ptrdiff_t*)((ptrdiff_t)(p)))
-#endif
-
 /**
  * NTFS_SB - return the ntfs volume given a vfs super block
  * @sb:		VFS super block
@@ -184,32 +175,31 @@
 extern void post_write_mst_fixup(NTFS_RECORD *b);
 
 /* From fs/ntfs/unistr.c */
-extern BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len,
-		const uchar_t *s2, size_t s2_len,
+extern BOOL ntfs_are_names_equal(const ntfschar *s1, size_t s1_len,
+		const ntfschar *s2, size_t s2_len,
 		const IGNORE_CASE_BOOL ic,
-		const uchar_t *upcase, const u32 upcase_size);
-extern int ntfs_collate_names(const uchar_t *name1, const u32 name1_len,
-		const uchar_t *name2, const u32 name2_len,
+		const ntfschar *upcase, const u32 upcase_size);
+extern int ntfs_collate_names(const ntfschar *name1, const u32 name1_len,
+		const ntfschar *name2, const u32 name2_len,
 		const int err_val, const IGNORE_CASE_BOOL ic,
-		const uchar_t *upcase, const u32 upcase_len);
-extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n);
-extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n,
-		const uchar_t *upcase, const u32 upcase_size);
-extern void ntfs_upcase_name(uchar_t *name, u32 name_len,
-		const uchar_t *upcase, const u32 upcase_len);
+		const ntfschar *upcase, const u32 upcase_len);
+extern int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n);
+extern int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n,
+		const ntfschar *upcase, const u32 upcase_size);
+extern void ntfs_upcase_name(ntfschar *name, u32 name_len,
+		const ntfschar *upcase, const u32 upcase_len);
 extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr,
-		const uchar_t *upcase, const u32 upcase_len);
+		const ntfschar *upcase, const u32 upcase_len);
 extern int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
 		FILE_NAME_ATTR *file_name_attr2,
 		const int err_val, const IGNORE_CASE_BOOL ic,
-		const uchar_t *upcase, const u32 upcase_len);
+		const ntfschar *upcase, const u32 upcase_len);
 extern int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
-		const int ins_len, uchar_t **outs);
-extern int ntfs_ucstonls(const ntfs_volume *vol, const uchar_t *ins,
+		const int ins_len, ntfschar **outs);
+extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
 		const int ins_len, unsigned char **outs, int outs_len);
 
 /* From fs/ntfs/upcase.c */
-extern uchar_t *generate_default_upcase(void);
+extern ntfschar *generate_default_upcase(void);
 
 #endif /* _LINUX_NTFS_H */
-
diff -Nru a/fs/ntfs/super.c b/fs/ntfs/super.c
--- a/fs/ntfs/super.c	Tue Jun 15 22:20:42 2004
+++ b/fs/ntfs/super.c	Tue Jun 15 22:20:42 2004
@@ -291,6 +291,101 @@
 	return FALSE;
 }
 
+#ifdef NTFS_RW
+
+/**
+ * ntfs_write_volume_flags - write new flags to the volume information flags
+ * @vol:	ntfs volume on which to modify the flags
+ * @flags:	new flags value for the volume information flags
+ *
+ * Internal function.  You probably want to use ntfs_{set,clear}_volume_flags()
+ * instead (see below).
+ *
+ * Replace the volume information flags on the volume @vol with the value
+ * supplied in @flags.  Note, this overwrites the volume information flags, so
+ * make sure to combine the flags you want to modify with the old flags and use
+ * the result when calling ntfs_write_volume_flags().
+ *
+ * Return 0 on success and -errno on error.
+ */
+static int ntfs_write_volume_flags(ntfs_volume *vol, const VOLUME_FLAGS flags)
+{
+	ntfs_inode *ni = NTFS_I(vol->vol_ino);
+	MFT_RECORD *m;
+	VOLUME_INFORMATION *vi;
+	attr_search_context *ctx;
+	int err;
+
+	ntfs_debug("Entering, old flags = 0x%x, new flags = 0x%x.",
+			vol->vol_flags, flags);
+	if (vol->vol_flags == flags)
+		goto done;
+	BUG_ON(!ni);
+	m = map_mft_record(ni);
+	if (IS_ERR(m)) {
+		err = PTR_ERR(m);
+		goto err_out;
+	}
+	ctx = get_attr_search_ctx(ni, m);
+	if (!ctx) {
+		err = -ENOMEM;
+		goto put_unm_err_out;
+	}
+	if (!lookup_attr(AT_VOLUME_INFORMATION, NULL, 0, 0, 0, NULL, 0, ctx)) {
+		err = -EIO;
+		goto put_unm_err_out;
+	}
+	vi = (VOLUME_INFORMATION*)((u8*)ctx->attr +
+			le16_to_cpu(ctx->attr->data.resident.value_offset));
+	vol->vol_flags = vi->flags = flags;
+	flush_dcache_mft_record_page(ctx->ntfs_ino);
+	mark_mft_record_dirty(ctx->ntfs_ino);
+	put_attr_search_ctx(ctx);
+	unmap_mft_record(ni);
+done:
+	ntfs_debug("Done.");
+	return 0;
+put_unm_err_out:
+	if (ctx)
+		put_attr_search_ctx(ctx);
+	unmap_mft_record(ni);
+err_out:
+	ntfs_error(vol->sb, "Failed with error code %i.", -err);
+	return err;
+}
+
+/**
+ * ntfs_set_volume_flags - set bits in the volume information flags
+ * @vol:	ntfs volume on which to modify the flags
+ * @flags:	flags to set on the volume
+ *
+ * Set the bits in @flags in the volume information flags on the volume @vol.
+ *
+ * Return 0 on success and -errno on error.
+ */
+static inline int ntfs_set_volume_flags(ntfs_volume *vol, VOLUME_FLAGS flags)
+{
+	flags &= VOLUME_FLAGS_MASK;
+	return ntfs_write_volume_flags(vol, vol->vol_flags | flags);
+}
+
+/**
+ * ntfs_clear_volume_flags - clear bits in the volume information flags
+ * @vol:	ntfs volume on which to modify the flags
+ * @flags:	flags to clear on the volume
+ *
+ * Clear the bits in @flags in the volume information flags on the volume @vol.
+ *
+ * Return 0 on success and -errno on error.
+ */
+static inline int ntfs_clear_volume_flags(ntfs_volume *vol, VOLUME_FLAGS flags)
+{
+	flags &= VOLUME_FLAGS_MASK;
+	return ntfs_write_volume_flags(vol, vol->vol_flags & ~flags);
+}
+
+#endif /* NTFS_RW */
+
 /**
  * ntfs_remount - change the mount options of a mounted ntfs filesystem
  * @sb:		superblock of mounted ntfs filesystem
@@ -314,25 +409,74 @@
 #else /* ! NTFS_RW */
 	/*
 	 * For the read-write compiled driver, if we are remounting read-write,
-	 * make sure there aren't any volume errors and empty the lofgile.
+	 * make sure there are no volume errors and that no unsupported volume
+	 * flags are set.  Also, empty the logfile journal as it would become
+	 * stale as soon as something is written to the volume and mark the
+	 * volume dirty so that chkdsk is run if the volume is not umounted
+	 * cleanly.
+	 *
+	 * When remounting read-only, mark the volume clean if no volume errors
+	 * have occured.
 	 */
 	if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
 		static const char *es = ".  Cannot remount read-write.";
 
+		/* Remounting read-write. */
 		if (NVolErrors(vol)) {
 			ntfs_error(sb, "Volume has errors and is read-only%s",
 					es);
 			return -EROFS;
 		}
+		if (vol->vol_flags & VOLUME_IS_DIRTY) {
+			ntfs_error(sb, "Volume is dirty and read-only%s", es);
+			return -EROFS;
+		}
+		if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
+			ntfs_error(sb, "Volume has unsupported flags set and "
+					"is read-only%s", es);
+			return -EROFS;
+		}
+		if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) {
+			ntfs_error(sb, "Failed to set dirty bit in volume "
+					"information flags%s", es);
+			return -EROFS;
+		}
+#if 0
+		// TODO: Enable this code once we start modifying anything that
+		//	 is different between NTFS 1.2 and 3.x...
+		/* Set NT4 compatibility flag on newer NTFS version volumes. */
+		if ((vol->major_ver > 1)) {
+			if (ntfs_set_volume_flags(vol, VOLUME_MOUNTED_ON_NT4)) {
+				ntfs_error(sb, "Failed to set NT4 "
+						"compatibility flag%s", es);
+				NVolSetErrors(vol);
+				return -EROFS;
+			}
+		}
+#endif
 		if (!ntfs_empty_logfile(vol->logfile_ino)) {
 			ntfs_error(sb, "Failed to empty journal $LogFile%s",
 					es);
 			NVolSetErrors(vol);
 			return -EROFS;
 		}
+	} else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
+		/* Remounting read-only. */
+		if (!NVolErrors(vol)) {
+			if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY))
+				ntfs_warning(sb, "Failed to clear dirty bit "
+						"in volume information "
+						"flags.  Run chkdsk.");
+		}
 	}
 	// TODO:  For now we enforce no atime and dir atime updates as they are
 	// not implemented.
+	if ((sb->s_flags & MS_NOATIME) && !(*flags & MS_NOATIME))
+		ntfs_warning(sb, "Atime updates are not implemented yet.  "
+				"Leaving them disabled.");
+	else if ((sb->s_flags & MS_NODIRATIME) && !(*flags & MS_NODIRATIME))
+		ntfs_warning(sb, "Directory atime updates are not implemented "
+				"yet.  Leaving them disabled.");
 	*flags |= MS_NOATIME | MS_NODIRATIME;
 #endif /* ! NTFS_RW */
 
@@ -756,7 +900,7 @@
 	/* The $MFTMirr, like the $MFT is multi sector transfer protected. */
 	NInoSetMstProtected(tmp_ni);
 	/*
-	 * Set up our little cheat allowing us to reuse the async io
+	 * Set up our little cheat allowing us to reuse the async read io
 	 * completion handler for directories.
 	 */
 	tmp_ni->itype.index.block_size = vol->mft_record_size;
@@ -937,12 +1081,12 @@
 	}
 	/*
 	 * The upcase size must not be above 64k Unicode characters, must not
-	 * be zero and must be a multiple of sizeof(uchar_t).
+	 * be zero and must be a multiple of sizeof(ntfschar).
 	 */
-	if (!ino->i_size || ino->i_size & (sizeof(uchar_t) - 1) ||
-			ino->i_size > 64ULL * 1024 * sizeof(uchar_t))
+	if (!ino->i_size || ino->i_size & (sizeof(ntfschar) - 1) ||
+			ino->i_size > 64ULL * 1024 * sizeof(ntfschar))
 		goto iput_upcase_failed;
-	vol->upcase = (uchar_t*)ntfs_malloc_nofs(ino->i_size);
+	vol->upcase = (ntfschar*)ntfs_malloc_nofs(ino->i_size);
 	if (!vol->upcase)
 		goto iput_upcase_failed;
 	index = 0;
@@ -965,7 +1109,7 @@
 	}
 	vol->upcase_len = ino->i_size >> UCHAR_T_SIZE_BITS;
 	ntfs_debug("Read %llu bytes from $UpCase (expected %u bytes).",
-			ino->i_size, 64 * 1024 * sizeof(uchar_t));
+			ino->i_size, 64 * 1024 * sizeof(ntfschar));
 	iput(ino);
 	down(&ntfs_lock);
 	if (!default_upcase) {
@@ -1124,7 +1268,7 @@
 			le32_to_cpu(ctx->attr->data.resident.value_length) >
 			(u8*)ctx->attr + le32_to_cpu(ctx->attr->length))
 		goto err_put_vol;
-	/* Setup volume flags and version. */
+	/* Copy the volume flags and version to the ntfs_volume structure. */
 	vol->vol_flags = vi->flags;
 	vol->major_ver = vi->major_ver;
 	vol->minor_ver = vi->minor_ver;
@@ -1133,16 +1277,46 @@
 	printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver,
 			vol->minor_ver);
 #ifdef NTFS_RW
+	/* Make sure that no unsupported volume flags are set. */
+	if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
+		static const char *es1a = "Volume is dirty";
+		static const char *es1b = "Volume has unsupported flags set";
+		static const char *es2 = ".  Run chkdsk and mount in Windows.";
+		const char *es1;
+		
+		es1 = vol->vol_flags & VOLUME_IS_DIRTY ? es1a : es1b;
+		/* If a read-write mount, convert it to a read-only mount. */
+		if (!(sb->s_flags & MS_RDONLY)) {
+			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
+					ON_ERRORS_CONTINUE))) {
+				ntfs_error(sb, "%s and neither on_errors="
+						"continue nor on_errors="
+						"remount-ro was specified%s",
+						es1, es2);
+				goto iput_vol_err_out;
+			}
+			sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
+			ntfs_error(sb, "%s.  Mounting read-only%s", es1, es2);
+		} else
+			ntfs_warning(sb, "%s.  Will not be able to remount "
+					"read-write%s", es1, es2);
+		/*
+		 * Do not set NVolErrors() because ntfs_remount() re-checks the
+		 * flags which we need to do in case any flags have changed.
+		 */
+	}
 	/*
 	 * Get the inode for the logfile, check it and determine if the volume
 	 * was shutdown cleanly.
 	 */
 	if (!load_and_check_logfile(vol) ||
 			!ntfs_is_logfile_clean(vol->logfile_ino)) {
-		static const char *es1 = "Failed to load $LogFile";
-		static const char *es2 = "$LogFile is not clean";
-		static const char *es3 = ".  Mount in Windows.";
+		static const char *es1a = "Failed to load $LogFile";
+		static const char *es1b = "$LogFile is not clean";
+		static const char *es2 = ".  Mount in Windows.";
+		const char *es1;
 
+		es1 = !vol->logfile_ino ? es1a : es1b;
 		/* If a read-write mount, convert it to a read-only mount. */
 		if (!(sb->s_flags & MS_RDONLY)) {
 			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
@@ -1150,21 +1324,66 @@
 				ntfs_error(sb, "%s and neither on_errors="
 						"continue nor on_errors="
 						"remount-ro was specified%s",
-						!vol->logfile_ino ? es1 : es2,
-						es3);
+						es1, es2);
 				goto iput_logfile_err_out;
 			}
 			sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
-			ntfs_error(sb, "%s.  Mounting read-only%s",
-					!vol->logfile_ino ? es1 : es2, es3);
+			ntfs_error(sb, "%s.  Mounting read-only%s", es1, es2);
 		} else
 			ntfs_warning(sb, "%s.  Will not be able to remount "
-					"read-write%s",
-					!vol->logfile_ino ? es1 : es2, es3);
+					"read-write%s", es1, es2);
 		/* This will prevent a read-write remount. */
 		NVolSetErrors(vol);
-	/* If a read-write mount, empty the logfile. */
-	} else if (!(sb->s_flags & MS_RDONLY) &&
+	}
+	/* If (still) a read-write mount, mark the volume dirty. */
+	if (!(sb->s_flags & MS_RDONLY) &&
+			ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) {
+		static const char *es1 = "Failed to set dirty bit in volume "
+				"information flags";
+		static const char *es2 = ".  Run chkdsk.";
+
+		/* Convert to a read-only mount. */
+		if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
+				ON_ERRORS_CONTINUE))) {
+			ntfs_error(sb, "%s and neither on_errors=continue nor "
+					"on_errors=remount-ro was specified%s",
+					es1, es2);
+			goto iput_logfile_err_out;
+		}
+		ntfs_error(sb, "%s.  Mounting read-only%s", es1, es2);
+		sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
+		/*
+		 * Do not set NVolErrors() because ntfs_remount() might manage
+		 * to set the dirty flag in which case all would be well.
+		 */
+	}
+#if 0
+	// TODO: Enable this code once we start modifying anything that is
+	//	 different between NTFS 1.2 and 3.x...
+	/*
+	 * If (still) a read-write mount, set the NT4 compatibility flag on
+	 * newer NTFS version volumes.
+	 */
+	if (!(sb->s_flags & MS_RDONLY) && (vol->major_ver > 1) &&
+			ntfs_set_volume_flags(vol, VOLUME_MOUNTED_ON_NT4)) {
+		static const char *es1 = "Failed to set NT4 compatibility flag";
+		static const char *es2 = ".  Run chkdsk.";
+
+		/* Convert to a read-only mount. */
+		if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
+				ON_ERRORS_CONTINUE))) {
+			ntfs_error(sb, "%s and neither on_errors=continue nor "
+					"on_errors=remount-ro was specified%s",
+					es1, es2);
+			goto iput_logfile_err_out;
+		}
+		ntfs_error(sb, "%s.  Mounting read-only%s", es1, es2);
+		sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
+		NVolSetErrors(vol);
+	}
+#endif
+	/* If (still) a read-write mount, empty the logfile. */
+	if (!(sb->s_flags & MS_RDONLY) &&
 			!ntfs_empty_logfile(vol->logfile_ino)) {
 		static const char *es1 = "Failed to empty $LogFile";
 		static const char *es2 = ".  Mount in Windows.";
@@ -1177,12 +1396,11 @@
 					es1, es2);
 			goto iput_logfile_err_out;
 		}
-		sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
 		ntfs_error(sb, "%s.  Mounting read-only%s", es1, es2);
-		/* This will prevent a read-write remount. */
+		sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
 		NVolSetErrors(vol);
 	}
-#endif
+#endif /* NTFS_RW */
 	/*
 	 * Get the inode for the attribute definitions file and parse the
 	 * attribute definitions.
@@ -1240,6 +1458,7 @@
 #ifdef NTFS_RW
 	if (vol->logfile_ino)
 		iput(vol->logfile_ino);
+iput_vol_err_out:
 #endif /* NTFS_RW */
 	iput(vol->vol_ino);
 iput_lcnbmp_err_out:
@@ -1256,18 +1475,69 @@
 
 /**
  * ntfs_put_super - called by the vfs to unmount a volume
- * @vfs_sb:	vfs superblock of volume to unmount
+ * @sb:		vfs superblock of volume to unmount
  *
  * ntfs_put_super() is called by the VFS (from fs/super.c::do_umount()) when
  * the volume is being unmounted (umount system call has been invoked) and it
  * releases all inodes and memory belonging to the NTFS specific part of the
  * super block.
  */
-static void ntfs_put_super(struct super_block *vfs_sb)
+static void ntfs_put_super(struct super_block *sb)
 {
-	ntfs_volume *vol = NTFS_SB(vfs_sb);
+	ntfs_volume *vol = NTFS_SB(sb);
 
 	ntfs_debug("Entering.");
+#ifdef NTFS_RW
+	/*
+	 * Commit all inodes while they are still open in case some of them
+	 * cause others to be dirtied.
+	 */
+	ntfs_commit_inode(vol->vol_ino);
+
+	/* NTFS 3.0+ specific. */
+	if (vol->major_ver >= 3) {
+		if (vol->secure_ino)
+			ntfs_commit_inode(vol->secure_ino);
+	}
+
+	ntfs_commit_inode(vol->root_ino);
+
+	down_write(&vol->lcnbmp_lock);
+	ntfs_commit_inode(vol->lcnbmp_ino);
+	up_write(&vol->lcnbmp_lock);
+
+	down_write(&vol->mftbmp_lock);
+	ntfs_commit_inode(vol->mftbmp_ino);
+	up_write(&vol->mftbmp_lock);
+
+	if (vol->logfile_ino)
+		ntfs_commit_inode(vol->logfile_ino);
+
+	if (vol->mftmirr_ino)
+		ntfs_commit_inode(vol->mftmirr_ino);
+	ntfs_commit_inode(vol->mft_ino);
+
+	/*
+	 * If a read-write mount and no volume errors have occured, mark the
+	 * volume clean.  Also, re-commit all affected inodes.
+	 */
+	if (!(sb->s_flags & MS_RDONLY)) {
+		if (!NVolErrors(vol)) {
+			if (ntfs_clear_volume_flags(vol, VOLUME_IS_DIRTY))
+				ntfs_warning(sb, "Failed to clear dirty bit "
+						"in volume information "
+						"flags.  Run chkdsk.");
+			ntfs_commit_inode(vol->vol_ino);
+			ntfs_commit_inode(vol->root_ino);
+			if (vol->mftmirr_ino)
+				ntfs_commit_inode(vol->mftmirr_ino);
+			ntfs_commit_inode(vol->mft_ino);
+		} else {
+			ntfs_warning(sb, "Volume has errors.  Leaving volume "
+					"marked dirty.  Run chkdsk.");
+		}
+	}
+#endif /* NTFS_RW */
 
 	iput(vol->vol_ino);
 	vol->vol_ino = NULL;
@@ -1298,11 +1568,47 @@
 		iput(vol->logfile_ino);
 		vol->logfile_ino = NULL;
 	}
-
 	if (vol->mftmirr_ino) {
+		/* Re-commit the mft mirror and mft just in case. */
+		ntfs_commit_inode(vol->mftmirr_ino);
+		ntfs_commit_inode(vol->mft_ino);
 		iput(vol->mftmirr_ino);
 		vol->mftmirr_ino = NULL;
 	}
+	/*
+	 * If any dirty inodes are left, throw away all mft data page cache
+	 * pages to allow a clean umount.  This should never happen any more
+	 * due to mft.c::ntfs_mft_writepage() cleaning all the dirty pages as
+	 * the underlying mft records are written out and cleaned.  If it does,
+	 * happen anyway, we want to know...
+	 */
+	ntfs_commit_inode(vol->mft_ino);
+	write_inode_now(vol->mft_ino, 1);
+	if (!list_empty(&sb->s_dirty)) {
+		const char *s1, *s2;
+
+		down(&vol->mft_ino->i_sem);
+		truncate_inode_pages(vol->mft_ino->i_mapping, 0);
+		up(&vol->mft_ino->i_sem);
+		write_inode_now(vol->mft_ino, 1);
+		if (!list_empty(&sb->s_dirty)) {
+			static const char *_s1 = "inodes";
+			static const char *_s2 = "";
+			s1 = _s1;
+			s2 = _s2;
+		} else {
+			static const char *_s1 = "mft pages";
+			static const char *_s2 = "They have been thrown "
+					"away.  ";
+			s1 = _s1;
+			s2 = _s2;
+		}
+		ntfs_error(sb, "Dirty %s found at umount time.  %sYou should "
+				"run chkdsk.  Please email "
+				"linux-ntfs-dev@lists.sourceforge.net and say "
+				"that you saw this message.  Thank you.", s1,
+				s2);
+	}
 #endif /* NTFS_RW */
 
 	iput(vol->mft_ino);
@@ -1311,7 +1617,7 @@
 	vol->upcase_len = 0;
 	/*
 	 * Decrease the number of mounts and destroy the global default upcase
-	 * table if necessary. Also decrease the number of upcase users if we
+	 * table if necessary.  Also decrease the number of upcase users if we
 	 * are a user.
 	 */
 	down(&ntfs_lock);
@@ -1335,7 +1641,7 @@
 		unload_nls(vol->nls_map);
 		vol->nls_map = NULL;
 	}
-	vfs_sb->s_fs_info = NULL;
+	sb->s_fs_info = NULL;
 	kfree(vol);
 	return;
 }
@@ -1585,19 +1891,6 @@
 }
 
 /**
- * Super operations for mount time when we don't have enough setup to use the
- * proper functions.
- */
-struct super_operations ntfs_mount_sops = {
-	.alloc_inode	= ntfs_alloc_big_inode,	  /* VFS: Allocate new inode. */
-	.destroy_inode	= ntfs_destroy_big_inode, /* VFS: Deallocate inode. */
-	.read_inode	= ntfs_read_inode_mount,  /* VFS: Load inode from disk,
-						     called from iget(). */
-	.clear_inode	= ntfs_clear_big_inode,	  /* VFS: Called when inode is
-						     removed from memory. */
-};
-
-/**
  * The complete super operations.
  */
 struct super_operations ntfs_sops = {
@@ -1609,8 +1902,8 @@
 #ifdef NTFS_RW
 	//.dirty_inode	= NULL,			/* VFS: Called from
 	//					   __mark_inode_dirty(). */
-	//.write_inode	= NULL,			/* VFS: Write dirty inode to
-	//					   disk. */
+	.write_inode	= ntfs_write_inode,	/* VFS: Write dirty inode to
+						   disk. */
 	//.drop_inode	= NULL,			/* VFS: Called just after the
 	//					   inode reference count has
 	//					   been decreased to zero.
@@ -1699,8 +1992,12 @@
 #ifndef NTFS_RW
 	sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
 #else
-	// TODO:  For now we enforce no atime and dir atime updates as they are
-	// not implemented.
+	if (!(sb->s_flags & MS_NOATIME))
+		ntfs_warning(sb, "Atime updates are not implemented yet.  "
+				"Disabling them.");
+	else if (!(sb->s_flags & MS_NODIRATIME))
+		ntfs_warning(sb, "Directory atime updates are not implemented "
+				"yet.  Disabling them.");
 	sb->s_flags |= MS_NOATIME | MS_NODIRATIME;
 #endif
 	/* Allocate a new ntfs_volume and place it in sb->s_fs_info. */
@@ -1814,28 +2111,20 @@
 	 * the inode for $MFT which is sufficient to allow our normal inode
 	 * operations and associated address space operations to function.
 	 */
-	/*
-	 * Poison vol->mft_ino so we know whether iget() called into our
-	 * ntfs_read_inode_mount() method.
-	 */
-#define OGIN	((struct inode*)n2p(le32_to_cpu(0x4e49474f)))	/* OGIN */
-	vol->mft_ino = OGIN;
-	sb->s_op = &ntfs_mount_sops;
-	tmp_ino = iget(vol->sb, FILE_MFT);
-	if (!tmp_ino || tmp_ino != vol->mft_ino || is_bad_inode(tmp_ino)) {
+	sb->s_op = &ntfs_sops;
+	tmp_ino = new_inode(sb);
+	if (!tmp_ino) {
+		if (!silent)
+			ntfs_error(sb, "Failed to load essential metadata.");
+		goto err_out_now;
+	}
+	tmp_ino->i_ino = FILE_MFT;
+	insert_inode_hash(tmp_ino);
+	if (ntfs_read_inode_mount(tmp_ino) < 0) {
 		if (!silent)
 			ntfs_error(sb, "Failed to load essential metadata.");
-		if (tmp_ino && vol->mft_ino == OGIN)
-			ntfs_error(sb, "BUG: iget() did not call "
-					"ntfs_read_inode_mount() method!\n");
-		if (!tmp_ino)
-			goto cond_iput_mft_ino_err_out_now;
 		goto iput_tmp_ino_err_out_now;
 	}
-	/*
-	 * Note: sb->s_op has already been set to &ntfs_sops by our specialized
-	 * ntfs_read_inode_mount() method when it was invoked by iget().
-	 */
 	down(&ntfs_lock);
 	/*
 	 * The current mount is a compression user if the cluster size is
@@ -1931,12 +2220,10 @@
 	up(&ntfs_lock);
 iput_tmp_ino_err_out_now:
 	iput(tmp_ino);
-cond_iput_mft_ino_err_out_now:
-	if (vol->mft_ino && vol->mft_ino != OGIN && vol->mft_ino != tmp_ino) {
+	if (vol->mft_ino && vol->mft_ino != tmp_ino) {
 		iput(vol->mft_ino);
 		vol->mft_ino = NULL;
 	}
-#undef OGIN
 	/*
 	 * This is needed to get ntfs_clear_extent_inode() called for each
 	 * inode we have ever called ntfs_iget()/iput() on, otherwise we A)
@@ -2049,7 +2336,7 @@
 	}
 
 	ntfs_name_cache = kmem_cache_create(ntfs_name_cache_name,
-			(NTFS_MAX_NAME_LEN+1) * sizeof(uchar_t), 0,
+			(NTFS_MAX_NAME_LEN+1) * sizeof(ntfschar), 0,
 			SLAB_HWCACHE_ALIGN, NULL, NULL);
 	if (!ntfs_name_cache) {
 		printk(KERN_CRIT "NTFS: Failed to create %s!\n",
diff -Nru a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c
--- a/fs/ntfs/sysctl.c	Tue Jun 15 22:20:36 2004
+++ b/fs/ntfs/sysctl.c	Tue Jun 15 22:20:36 2004
@@ -1,22 +1,22 @@
 /*
  * sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of
  *	      the Linux-NTFS project. Adapted from the old NTFS driver,
- *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne.
+ *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne
  *
- * Copyright (c) 2002 Anton Altaparmakov.
+ * Copyright (c) 2002-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -37,7 +37,7 @@
 
 /* Definition of the ntfs sysctl. */
 static ctl_table ntfs_sysctls[] = {
-	{ FS_NTFS, "ntfs-debug", 		/* Binary and text IDs. */
+	{ FS_NTFS, "ntfs-debug",		/* Binary and text IDs. */
 	  &debug_msgs,sizeof(debug_msgs),	/* Data pointer and size. */
 	  0644,	NULL, &proc_dointvec },		/* Mode, child, proc handler. */
 	{ 0 }
@@ -83,4 +83,3 @@
 
 #endif /* CONFIG_SYSCTL */
 #endif /* DEBUG */
-
diff -Nru a/fs/ntfs/sysctl.h b/fs/ntfs/sysctl.h
--- a/fs/ntfs/sysctl.h	Tue Jun 15 22:20:39 2004
+++ b/fs/ntfs/sysctl.h	Tue Jun 15 22:20:39 2004
@@ -1,22 +1,22 @@
 /*
  * sysctl.h - Defines for sysctl handling in NTFS Linux kernel driver. Part of
  *	      the Linux-NTFS project. Adapted from the old NTFS driver,
- *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne.
- * 
- * Copyright (c) 2002 Anton Altaparmakov.
+ *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne
+ *
+ * Copyright (c) 2002-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -40,4 +40,3 @@
 
 #endif /* DEBUG && CONFIG_SYSCTL */
 #endif /* _LINUX_NTFS_SYSCTL_H */
-
diff -Nru a/fs/ntfs/time.h b/fs/ntfs/time.h
--- a/fs/ntfs/time.h	Tue Jun 15 22:20:42 2004
+++ b/fs/ntfs/time.h	Tue Jun 15 22:20:42 2004
@@ -1,7 +1,7 @@
 /*
  * time.h - NTFS time conversion functions.  Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
diff -Nru a/fs/ntfs/types.h b/fs/ntfs/types.h
--- a/fs/ntfs/types.h	Tue Jun 15 22:20:44 2004
+++ b/fs/ntfs/types.h	Tue Jun 15 22:20:44 2004
@@ -2,7 +2,7 @@
  * types.h - Defines for NTFS Linux kernel driver specific types.
  *	     Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -24,7 +24,7 @@
 #define _LINUX_NTFS_TYPES_H
 
 /* 2-byte Unicode character type. */
-typedef u16 uchar_t;
+typedef u16 ntfschar;
 #define UCHAR_T_SIZE_BITS 1
 
 /*
diff -Nru a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c
--- a/fs/ntfs/unistr.c	Tue Jun 15 22:20:42 2004
+++ b/fs/ntfs/unistr.c	Tue Jun 15 22:20:42 2004
@@ -8,13 +8,13 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file 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 (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -61,10 +61,9 @@
  * identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE,
  * the @upcase table is used to performa a case insensitive comparison.
  */
-BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len,
-		     const uchar_t *s2, size_t s2_len,
-		     const IGNORE_CASE_BOOL ic,
-		     const uchar_t *upcase, const u32 upcase_size)
+BOOL ntfs_are_names_equal(const ntfschar *s1, size_t s1_len,
+		const ntfschar *s2, size_t s2_len, const IGNORE_CASE_BOOL ic,
+		const ntfschar *upcase, const u32 upcase_size)
 {
 	if (s1_len != s2_len)
 		return FALSE;
@@ -78,12 +77,12 @@
  * @name1:	first Unicode name to compare
  * @name2:	second Unicode name to compare
  * @err_val:	if @name1 contains an invalid character return this value
- * @ic:         either CASE_SENSITIVE or IGNORE_CASE
+ * @ic:		either CASE_SENSITIVE or IGNORE_CASE
  * @upcase:	upcase table (ignored if @ic is CASE_SENSITIVE)
  * @upcase_len:	upcase table size (ignored if @ic is CASE_SENSITIVE)
  *
  * ntfs_collate_names collates two Unicode names and returns:
- * 
+ *
  *  -1 if the first name collates before the second one,
  *   0 if the names match,
  *   1 if the second name collates before the first one, or
@@ -91,13 +90,13 @@
  *
  * The following characters are considered invalid: '"', '*', '<', '>' and '?'.
  */
-int ntfs_collate_names(const uchar_t *name1, const u32 name1_len,
-		const uchar_t *name2, const u32 name2_len,
+int ntfs_collate_names(const ntfschar *name1, const u32 name1_len,
+		const ntfschar *name2, const u32 name2_len,
 		const int err_val, const IGNORE_CASE_BOOL ic,
-		const uchar_t *upcase, const u32 upcase_len)
+		const ntfschar *upcase, const u32 upcase_len)
 {
 	u32 cnt, min_len;
-	uchar_t c1, c2;
+	ntfschar c1, c2;
 
 	min_len = name1_len;
 	if (name1_len > name2_len)
@@ -138,14 +137,14 @@
  * Compare the first @n characters of the Unicode strings @s1 and @s2,
  * The strings in little endian format and appropriate le16_to_cpu()
  * conversion is performed on non-little endian machines.
- * 
+ *
  * The function returns an integer less than, equal to, or greater than zero
  * if @s1 (or the first @n Unicode characters thereof) is found, respectively,
  * to be less than, to match, or be greater than @s2.
  */
-int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n)
+int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n)
 {
-	uchar_t c1, c2;
+	ntfschar c1, c2;
 	size_t i;
 
 	for (i = 0; i < n; ++i) {
@@ -172,17 +171,17 @@
  * Compare the first @n characters of the Unicode strings @s1 and @s2,
  * ignoring case. The strings in little endian format and appropriate
  * le16_to_cpu() conversion is performed on non-little endian machines.
- * 
+ *
  * Each character is uppercased using the @upcase table before the comparison.
  *
  * The function returns an integer less than, equal to, or greater than zero
  * if @s1 (or the first @n Unicode characters thereof) is found, respectively,
  * to be less than, to match, or be greater than @s2.
  */
-int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n,
-		     const uchar_t *upcase, const u32 upcase_size)
+int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n,
+		const ntfschar *upcase, const u32 upcase_size)
 {
-	uchar_t c1, c2;
+	ntfschar c1, c2;
 	size_t i;
 
 	for (i = 0; i < n; ++i) {
@@ -200,11 +199,11 @@
 	return 0;
 }
 
-void ntfs_upcase_name(uchar_t *name, u32 name_len, const uchar_t *upcase,
+void ntfs_upcase_name(ntfschar *name, u32 name_len, const ntfschar *upcase,
 		const u32 upcase_len)
 {
 	u32 i;
-	uchar_t u;
+	ntfschar u;
 
 	for (i = 0; i < name_len; i++)
 		if ((u = le16_to_cpu(name[i])) < upcase_len)
@@ -212,20 +211,20 @@
 }
 
 void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr,
-		const uchar_t *upcase, const u32 upcase_len)
+		const ntfschar *upcase, const u32 upcase_len)
 {
-	ntfs_upcase_name((uchar_t*)&file_name_attr->file_name,
+	ntfs_upcase_name((ntfschar*)&file_name_attr->file_name,
 			file_name_attr->file_name_length, upcase, upcase_len);
 }
 
 int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
 		FILE_NAME_ATTR *file_name_attr2,
 		const int err_val, const IGNORE_CASE_BOOL ic,
-		const uchar_t *upcase, const u32 upcase_len)
+		const ntfschar *upcase, const u32 upcase_len)
 {
-	return ntfs_collate_names((uchar_t*)&file_name_attr1->file_name,
+	return ntfs_collate_names((ntfschar*)&file_name_attr1->file_name,
 			file_name_attr1->file_name_length,
-			(uchar_t*)&file_name_attr2->file_name,
+			(ntfschar*)&file_name_attr2->file_name,
 			file_name_attr2->file_name_length,
 			err_val, ic, upcase, upcase_len);
 }
@@ -254,16 +253,16 @@
  * This might look a bit odd due to fast path optimization...
  */
 int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
-		const int ins_len, uchar_t **outs)
+		const int ins_len, ntfschar **outs)
 {
 	struct nls_table *nls = vol->nls_map;
-	uchar_t *ucs;
+	ntfschar *ucs;
 	wchar_t wc;
 	int i, o, wc_len;
 
 	/* We don't trust outside sources. */
 	if (ins) {
-		ucs = (uchar_t*)kmem_cache_alloc(ntfs_name_cache, SLAB_NOFS);
+		ucs = (ntfschar*)kmem_cache_alloc(ntfs_name_cache, SLAB_NOFS);
 		if (ucs) {
 			for (i = o = 0; i < ins_len; i += wc_len) {
 				wc_len = nls->char2uni(ins + i, ins_len - i,
@@ -319,7 +318,7 @@
  *
  * This might look a bit odd due to fast path optimization...
  */
-int ntfs_ucstonls(const ntfs_volume *vol, const uchar_t *ins,
+int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
 		const int ins_len, unsigned char **outs, int outs_len)
 {
 	struct nls_table *nls = vol->nls_map;
@@ -381,4 +380,3 @@
 	ntfs_error(vol->sb, "Failed to allocate name!");
 	return -ENOMEM;
 }
-
diff -Nru a/fs/ntfs/upcase.c b/fs/ntfs/upcase.c
--- a/fs/ntfs/upcase.c	Tue Jun 15 22:20:36 2004
+++ b/fs/ntfs/upcase.c	Tue Jun 15 22:20:36 2004
@@ -26,7 +26,7 @@
 
 #include "ntfs.h"
 
-uchar_t *generate_default_upcase(void)
+ntfschar *generate_default_upcase(void)
 {
 	static const int uc_run_table[][3] = { /* Start, End, Add */
 	{0x0061, 0x007B,  -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72,  74},
@@ -68,12 +68,12 @@
 	};
 
 	int i, r;
-	uchar_t *uc;
+	ntfschar *uc;
 
-	uc = ntfs_malloc_nofs(default_upcase_len * sizeof(uchar_t));
+	uc = ntfs_malloc_nofs(default_upcase_len * sizeof(ntfschar));
 	if (!uc)
 		return uc;
-	memset(uc, 0, default_upcase_len * sizeof(uchar_t));
+	memset(uc, 0, default_upcase_len * sizeof(ntfschar));
 	for (i = 0; i < default_upcase_len; i++)
 		uc[i] = cpu_to_le16(i);
 	for (r = 0; uc_run_table[r][0]; r++)
diff -Nru a/fs/ntfs/volume.h b/fs/ntfs/volume.h
--- a/fs/ntfs/volume.h	Tue Jun 15 22:20:37 2004
+++ b/fs/ntfs/volume.h	Tue Jun 15 22:20:37 2004
@@ -2,8 +2,8 @@
  * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part
  *	      of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
- * Copyright (c) 2002 Richard Russon.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
+ * Copyright (c) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -72,7 +72,7 @@
 	u64 serial_no;			/* The volume serial number. */
 	/* Mount specific NTFS information. */
 	u32 upcase_len;			/* Number of entries in upcase[]. */
-	uchar_t *upcase;		/* The upcase table. */
+	ntfschar *upcase;		/* The upcase table. */
 	LCN mft_zone_start;		/* First cluster of the mft zone. */
 	LCN mft_zone_end;		/* First cluster beyond the mft zone. */
 	struct inode *mft_ino;		/* The VFS inode of $MFT. */
diff -Nru a/fs/open.c b/fs/open.c
--- a/fs/open.c	Tue Jun 15 22:20:36 2004
+++ b/fs/open.c	Tue Jun 15 22:20:36 2004
@@ -23,6 +23,8 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 
+#include <asm/unistd.h>
+
 int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
 {
 	int retval = -ENODEV;
@@ -335,7 +337,7 @@
 }
 #endif
 
-#if !(defined(__alpha__) || defined(__ia64__))
+#ifdef __ARCH_WANT_SYS_UTIME
 
 /*
  * sys_utime() can be implemented in user-level using sys_utimes().
@@ -788,7 +790,6 @@
 	}
 
 	f->f_mapping = inode->i_mapping;
-	file_ra_state_init(&f->f_ra, f->f_mapping);
 	f->f_dentry = dentry;
 	f->f_vfsmnt = mnt;
 	f->f_pos = 0;
@@ -802,12 +803,13 @@
 	}
 	f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
 
+	file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);
+
 	/* NB: we're sure to have correct a_ops only after f_op->open */
 	if (f->f_flags & O_DIRECT) {
-		if (!f->f_mapping || !f->f_mapping->a_ops ||
-			!f->f_mapping->a_ops->direct_IO) {
-				fput(f);
-				f = ERR_PTR(-EINVAL);
+		if (!f->f_mapping->a_ops || !f->f_mapping->a_ops->direct_IO) {
+			fput(f);
+			f = ERR_PTR(-EINVAL);
 		}
 	}
 
diff -Nru a/fs/partitions/check.c b/fs/partitions/check.c
--- a/fs/partitions/check.c	Tue Jun 15 22:21:02 2004
+++ b/fs/partitions/check.c	Tue Jun 15 22:21:02 2004
@@ -367,6 +367,9 @@
 		return;
 
 	bdev = bdget_disk(disk, 0);
+	if (!bdev)
+		return;
+
 	if (blkdev_get(bdev, FMODE_READ, 0) < 0)
 		return;
 	state = check_partition(disk, bdev);
diff -Nru a/fs/partitions/msdos.c b/fs/partitions/msdos.c
--- a/fs/partitions/msdos.c	Tue Jun 15 22:20:42 2004
+++ b/fs/partitions/msdos.c	Tue Jun 15 22:20:42 2004
@@ -389,8 +389,23 @@
 		put_dev_sector(sect);
 		return 0;
 	}
+
+	/*
+	 * Now that the 55aa signature is present, this is probably
+	 * either the boot sector of a FAT filesystem or a DOS-type
+	 * partition table. Reject this in case the boot indicator
+	 * is not 0 or 0x80.
+	 */
 	p = (struct partition *) (data + 0x1be);
+	for (slot = 1; slot <= 4; slot++, p++) {
+		if (p->boot_ind != 0 && p->boot_ind != 0x80) {
+			put_dev_sector(sect);
+			return 0;
+		}
+	}
+
 #ifdef CONFIG_EFI_PARTITION
+	p = (struct partition *) (data + 0x1be);
 	for (slot = 1 ; slot <= 4 ; slot++, p++) {
 		/* If this is an EFI GPT disk, msdos should ignore it. */
 		if (SYS_IND(p) == EFI_PMBR_OSTYPE_EFI_GPT) {
@@ -398,8 +413,8 @@
 			return 0;
 		}
 	}
-	p = (struct partition *) (data + 0x1be);
 #endif
+	p = (struct partition *) (data + 0x1be);
 
 	/*
 	 * Look for partitions in two passes:
@@ -407,8 +422,8 @@
 	 * On the second pass look inside *BSD, Unixware and Solaris partitions.
 	 */
 
-	state->next = 5;
-	for (slot = 1 ; slot <= 4 ; slot++, p++) {
+	state->next = DOS_EXTENDED_PARTITION;
+	for (slot = 1 ; slot < DOS_EXTENDED_PARTITION ; slot++, p++) {
 		u32 start = START_SECT(p)*sector_size;
 		u32 size = NR_SECTS(p)*sector_size;
 		if (!size)
@@ -435,7 +450,7 @@
 
 	/* second pass - output for each on a separate line */
 	p = (struct partition *) (0x1be + data);
-	for (slot = 1 ; slot <= 4 ; slot++, p++) {
+	for (slot = 1 ; slot < DOS_EXTENDED_PARTITION ; slot++, p++) {
 		unsigned char id = SYS_IND(p);
 		int n;
 
diff -Nru a/fs/proc/array.c b/fs/proc/array.c
--- a/fs/proc/array.c	Tue Jun 15 22:20:41 2004
+++ b/fs/proc/array.c	Tue Jun 15 22:20:41 2004
@@ -149,6 +149,7 @@
 
 static inline char * task_state(struct task_struct *p, char *buffer)
 {
+	struct group_info *group_info;
 	int g;
 
 	read_lock(&tasklist_lock);
@@ -174,12 +175,14 @@
 		"FDSize:\t%d\n"
 		"Groups:\t",
 		p->files ? p->files->max_fds : 0);
+
+	group_info = p->group_info;
+	get_group_info(group_info);
 	task_unlock(p);
 
-	get_group_info(p->group_info);
-	for (g = 0; g < min(p->group_info->ngroups,NGROUPS_SMALL); g++)
-		buffer += sprintf(buffer, "%d ", GROUP_AT(p->group_info,g));
-	put_group_info(p->group_info);
+	for (g = 0; g < min(group_info->ngroups,NGROUPS_SMALL); g++)
+		buffer += sprintf(buffer, "%d ", GROUP_AT(group_info,g));
+	put_group_info(group_info);
 
 	buffer += sprintf(buffer, "\n");
 	return buffer;
diff -Nru a/fs/proc/base.c b/fs/proc/base.c
--- a/fs/proc/base.c	Tue Jun 15 22:20:42 2004
+++ b/fs/proc/base.c	Tue Jun 15 22:20:42 2004
@@ -511,7 +511,7 @@
 
 #define PROC_BLOCK_SIZE	(3*1024)		/* 4K page size but our output routines use some slack for overruns */
 
-static ssize_t proc_info_read(struct file * file, char * buf,
+static ssize_t proc_info_read(struct file * file, char __user * buf,
 			  size_t count, loff_t *ppos)
 {
 	struct inode * inode = file->f_dentry->d_inode;
@@ -557,7 +557,7 @@
 	return 0;
 }
 
-static ssize_t mem_read(struct file * file, char * buf,
+static ssize_t mem_read(struct file * file, char __user * buf,
 			size_t count, loff_t *ppos)
 {
 	struct task_struct *task = proc_task(file->f_dentry->d_inode);
@@ -710,7 +710,7 @@
 }
 
 static int do_proc_readlink(struct dentry *dentry, struct vfsmount *mnt,
-			    char *buffer, int buflen)
+			    char __user *buffer, int buflen)
 {
 	struct inode * inode;
 	char *tmp = (char*)__get_free_page(GFP_KERNEL), *path;
@@ -735,7 +735,7 @@
 	return len;
 }
 
-static int proc_pid_readlink(struct dentry * dentry, char * buffer, int buflen)
+static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen)
 {
 	int error = -EACCES;
 	struct inode *inode = dentry->d_inode;
@@ -1162,7 +1162,7 @@
 };
 
 #ifdef CONFIG_SECURITY
-static ssize_t proc_pid_attr_read(struct file * file, char * buf,
+static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
 				  size_t count, loff_t *ppos)
 {
 	struct inode * inode = file->f_dentry->d_inode;
@@ -1199,7 +1199,7 @@
 	return count;
 }
 
-static ssize_t proc_pid_attr_write(struct file * file, const char * buf,
+static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
 				   size_t count, loff_t *ppos)
 { 
 	struct inode * inode = file->f_dentry->d_inode;
diff -Nru a/fs/proc/kcore.c b/fs/proc/kcore.c
--- a/fs/proc/kcore.c	Tue Jun 15 22:20:41 2004
+++ b/fs/proc/kcore.c	Tue Jun 15 22:20:41 2004
@@ -183,7 +183,11 @@
 	elf->e_entry	= 0;
 	elf->e_phoff	= sizeof(struct elfhdr);
 	elf->e_shoff	= 0;
+#if defined(CONFIG_H8300)
+	elf->e_flags	= ELF_FLAGS;
+#else
 	elf->e_flags	= 0;
+#endif
 	elf->e_ehsize	= sizeof(struct elfhdr);
 	elf->e_phentsize= sizeof(struct elf_phdr);
 	elf->e_phnum	= nphdr;
diff -Nru a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
--- a/fs/proc/proc_misc.c	Tue Jun 15 22:20:37 2004
+++ b/fs/proc/proc_misc.c	Tue Jun 15 22:20:37 2004
@@ -390,7 +390,7 @@
 		(unsigned long long)jiffies_64_to_clock_t(iowait),
 		(unsigned long long)jiffies_64_to_clock_t(irq),
 		(unsigned long long)jiffies_64_to_clock_t(softirq));
-	for_each_cpu(i) {
+	for_each_online_cpu(i) {
 
 		/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
 		user = kstat_cpu(i).cpustat.user;
@@ -631,7 +631,7 @@
 
 		if (get_user(c, buf))
 			return -EFAULT;
-		handle_sysrq(c, NULL, NULL);
+		__handle_sysrq(c, NULL, NULL);
 	}
 	return count;
 }
diff -Nru a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c	Tue Jun 15 22:20:37 2004
+++ b/fs/proc/task_mmu.c	Tue Jun 15 22:20:37 2004
@@ -65,7 +65,7 @@
 				*shared += pages;
 			continue;
 		}
-		if (vma->vm_flags & VM_SHARED || !list_empty(&vma->shared))
+		if (vma->vm_file)
 			*shared += pages;
 		if (vma->vm_flags & VM_EXECUTABLE)
 			*text += pages;
diff -Nru a/fs/quota_v1.c b/fs/quota_v1.c
--- a/fs/quota_v1.c	Tue Jun 15 22:20:43 2004
+++ b/fs/quota_v1.c	Tue Jun 15 22:20:43 2004
@@ -52,6 +52,8 @@
 
 	/* Now we are sure filp is valid */
 	offset = v1_dqoff(dquot->dq_id);
+	/* Set structure to 0s in case read fails/is after end of file */
+	memset(&dqblk, 0, sizeof(struct v1_disk_dqblk));
 	fs = get_fs();
 	set_fs(KERNEL_DS);
 	filp->f_op->read(filp, (char *)&dqblk, sizeof(struct v1_disk_dqblk), &offset);
diff -Nru a/fs/quota_v2.c b/fs/quota_v2.c
--- a/fs/quota_v2.c	Tue Jun 15 22:20:43 2004
+++ b/fs/quota_v2.c	Tue Jun 15 22:20:43 2004
@@ -135,7 +135,7 @@
 
 static dqbuf_t getdqbuf(void)
 {
-	dqbuf_t buf = kmalloc(V2_DQBLKSIZE, GFP_KERNEL);
+	dqbuf_t buf = kmalloc(V2_DQBLKSIZE, GFP_NOFS);
 	if (!buf)
 		printk(KERN_WARNING "VFS: Not enough memory for quota buffers.\n");
 	return buf;
@@ -420,7 +420,7 @@
 	mm_segment_t fs;
 	loff_t offset;
 	ssize_t ret;
-	struct v2_disk_dqblk ddquot;
+	struct v2_disk_dqblk ddquot, empty;
 
 	/* dq_off is guarded by dqio_sem */
 	if (!dquot->dq_off)
@@ -432,6 +432,12 @@
 	offset = dquot->dq_off;
 	spin_lock(&dq_data_lock);
 	mem2diskdqb(&ddquot, &dquot->dq_dqb, dquot->dq_id);
+	/* Argh... We may need to write structure full of zeroes but that would be
+	 * treated as an empty place by the rest of the code. Format change would
+	 * be definitely cleaner but the problems probably are not worth it */
+	memset(&empty, 0, sizeof(struct v2_disk_dqblk));
+	if (!memcmp(&empty, &ddquot, sizeof(struct v2_disk_dqblk)))
+		ddquot.dqb_itime = cpu_to_le64(1);
 	spin_unlock(&dq_data_lock);
 	fs = get_fs();
 	set_fs(KERNEL_DS);
@@ -622,7 +628,7 @@
 	struct file *filp;
 	mm_segment_t fs;
 	loff_t offset;
-	struct v2_disk_dqblk ddquot;
+	struct v2_disk_dqblk ddquot, empty;
 	int ret = 0;
 
 	filp = sb_dqopt(dquot->dq_sb)->files[type];
@@ -652,8 +658,14 @@
 			printk(KERN_ERR "VFS: Error while reading quota structure for id %u.\n", dquot->dq_id);
 			memset(&ddquot, 0, sizeof(struct v2_disk_dqblk));
 		}
-		else
+		else {
 			ret = 0;
+			/* We need to escape back all-zero structure */
+			memset(&empty, 0, sizeof(struct v2_disk_dqblk));
+			empty.dqb_itime = cpu_to_le64(1);
+			if (!memcmp(&empty, &ddquot, sizeof(struct v2_disk_dqblk)))
+				ddquot.dqb_itime = 0;
+		}
 		set_fs(fs);
 		disk2memdqb(&dquot->dq_dqb, &ddquot);
 		if (!dquot->dq_dqb.dqb_bhardlimit &&
diff -Nru a/fs/ramfs/inode.c b/fs/ramfs/inode.c
--- a/fs/ramfs/inode.c	Tue Jun 15 22:20:39 2004
+++ b/fs/ramfs/inode.c	Tue Jun 15 22:20:39 2004
@@ -181,6 +181,7 @@
 	struct inode * inode;
 	struct dentry * root;
 
+	sb->s_maxbytes = MAX_LFS_FILESIZE;
 	sb->s_blocksize = PAGE_CACHE_SIZE;
 	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
 	sb->s_magic = RAMFS_MAGIC;
diff -Nru a/fs/read_write.c b/fs/read_write.c
--- a/fs/read_write.c	Tue Jun 15 22:20:42 2004
+++ b/fs/read_write.c	Tue Jun 15 22:20:42 2004
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 struct file_operations generic_ro_fops = {
 	.llseek		= generic_file_llseek,
@@ -145,7 +146,7 @@
 }
 EXPORT_SYMBOL_GPL(sys_lseek);
 
-#if !defined(__alpha__)
+#ifdef __ARCH_WANT_SYS_LLSEEK
 asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
 			   unsigned long offset_low, loff_t __user * result,
 			   unsigned int origin)
diff -Nru a/fs/readdir.c b/fs/readdir.c
--- a/fs/readdir.c	Tue Jun 15 22:20:40 2004
+++ b/fs/readdir.c	Tue Jun 15 22:20:40 2004
@@ -14,6 +14,7 @@
 #include <linux/fs.h>
 #include <linux/dirent.h>
 #include <linux/security.h>
+#include <linux/unistd.h>
 
 #include <asm/uaccess.h>
 
@@ -49,10 +50,10 @@
  * anyway. Thus the special "fillonedir()" function for that
  * case (the low-level handlers don't need to care about this).
  */
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
-#ifndef __ia64__
+#ifdef __ARCH_WANT_OLD_READDIR
 
 struct old_linux_dirent {
 	unsigned long	d_ino;
@@ -76,7 +77,7 @@
 		return -EINVAL;
 	buf->result++;
 	dirent = buf->dirent;
-	if (!access_ok(VERIFY_WRITE, (unsigned long)dirent,
+	if (!access_ok(VERIFY_WRITE, dirent,
 			(unsigned long)(dirent->d_name + namlen + 1) -
 				(unsigned long)dirent))
 		goto efault;
@@ -115,7 +116,7 @@
 	return error;
 }
 
-#endif /* !__ia64__ */
+#endif /* __ARCH_WANT_OLD_READDIR */
 
 /*
  * New, all-improved, singing, dancing, iBCS2-compliant getdents()
@@ -159,7 +160,7 @@
 		goto efault;
 	if (__put_user(0, dirent->d_name + namlen))
 		goto efault;
-	if (__put_user(d_type, (char *) dirent + reclen - 1))
+	if (__put_user(d_type, (char __user *) dirent + reclen - 1))
 		goto efault;
 	buf->previous = dirent;
 	dirent = (void __user *)dirent + reclen;
diff -Nru a/fs/reiserfs/Makefile b/fs/reiserfs/Makefile
--- a/fs/reiserfs/Makefile	Tue Jun 15 22:21:05 2004
+++ b/fs/reiserfs/Makefile	Tue Jun 15 22:21:05 2004
@@ -9,6 +9,18 @@
 		 hashes.o tail_conversion.o journal.o resize.o \
 		 item_ops.o ioctl.o procfs.o
 
+ifeq ($(CONFIG_REISERFS_FS_XATTR),y)
+reiserfs-objs += xattr.o xattr_user.o xattr_trusted.o
+endif
+
+ifeq ($(CONFIG_REISERFS_FS_SECURITY),y)
+reiserfs-objs += xattr_security.o
+endif
+
+ifeq ($(CONFIG_REISERFS_FS_POSIX_ACL),y)
+reiserfs-objs += xattr_acl.o
+endif
+
 # gcc -O2 (the kernel default)  is overaggressive on ppc32 when many inline
 # functions are used.  This causes the compiler to advance the stack
 # pointer out of the available stack space, corrupting kernel space,
diff -Nru a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
--- a/fs/reiserfs/bitmap.c	Tue Jun 15 22:20:42 2004
+++ b/fs/reiserfs/bitmap.c	Tue Jun 15 22:20:42 2004
@@ -12,6 +12,7 @@
 #include <linux/pagemap.h>
 #include <linux/reiserfs_fs_sb.h>
 #include <linux/reiserfs_fs_i.h>
+#include <linux/quotaops.h>
 
 #define PREALLOCATION_SIZE 9
 
@@ -36,7 +37,7 @@
 
 #define SET_OPTION(optname) \
    do { \
-        reiserfs_warning("reiserfs: option \"%s\" is set\n", #optname); \
+        reiserfs_warning(s, "reiserfs: option \"%s\" is set", #optname); \
         set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \
     } while(0)
 #define TEST_OPTION(optname, s) \
@@ -59,7 +60,7 @@
     int i, j;
 
     if (block == 0 || block >= SB_BLOCK_COUNT (s)) {
-	reiserfs_warning ("vs-4010: is_reusable: block number is out of range %lu (%u)\n",
+	reiserfs_warning (s, "vs-4010: is_reusable: block number is out of range %lu (%u)",
 			  block, SB_BLOCK_COUNT (s));
 	return 0;
     }
@@ -67,8 +68,8 @@
     /* it can't be one of the bitmap blocks */
     for (i = 0; i < SB_BMAP_NR (s); i ++)
 	if (block == SB_AP_BITMAP (s)[i].bh->b_blocknr) {
-	    reiserfs_warning ("vs: 4020: is_reusable: "
-			      "bitmap block %lu(%u) can't be freed or reused\n",
+	    reiserfs_warning (s, "vs: 4020: is_reusable: "
+			      "bitmap block %lu(%u) can't be freed or reused",
 			      block, SB_BMAP_NR (s));
 	    return 0;
 	}
@@ -76,8 +77,8 @@
     get_bit_address (s, block, &i, &j);
 
     if (i >= SB_BMAP_NR (s)) {
-	reiserfs_warning ("vs-4030: is_reusable: there is no so many bitmap blocks: "
-			  "block=%lu, bitmap_nr=%d\n", block, i);
+	reiserfs_warning (s, "vs-4030: is_reusable: there is no so many bitmap blocks: "
+			  "block=%lu, bitmap_nr=%d", block, i);
 	return 0;
     }
 
@@ -85,16 +86,16 @@
          reiserfs_test_le_bit(j, SB_AP_BITMAP(s)[i].bh->b_data)) ||
 	(bit_value == 1 && 
 	 reiserfs_test_le_bit(j, SB_AP_BITMAP (s)[i].bh->b_data) == 0)) {
-	reiserfs_warning ("vs-4040: is_reusable: corresponding bit of block %lu does not "
-			  "match required value (i==%d, j==%d) test_bit==%d\n",
+	reiserfs_warning (s, "vs-4040: is_reusable: corresponding bit of block %lu does not "
+			  "match required value (i==%d, j==%d) test_bit==%d",
 		block, i, j, reiserfs_test_le_bit (j, SB_AP_BITMAP (s)[i].bh->b_data));
 
 	return 0;
     }
 
     if (bit_value == 0 && block == SB_ROOT_BLOCK (s)) {
-	reiserfs_warning ("vs-4050: is_reusable: this is root block (%u), "
-			  "it must be busy\n", SB_ROOT_BLOCK (s));
+	reiserfs_warning (s, "vs-4050: is_reusable: this is root block (%u), "
+			  "it must be busy", SB_ROOT_BLOCK (s));
 	return 0;
     }
 
@@ -133,7 +134,7 @@
     int end, next;
     int org = *beg;
 
-    RFALSE(bmap_n >= SB_BMAP_NR (s), "Bitmap %d is out of range (0..%d)\n",bmap_n, SB_BMAP_NR (s) - 1);
+    RFALSE(bmap_n >= SB_BMAP_NR (s), "Bitmap %d is out of range (0..%d)",bmap_n, SB_BMAP_NR (s) - 1);
     PROC_INFO_INC( s, scan_bitmap.bmap );
 /* this is unclear and lacks comments, explain how journal bitmaps
    work here for the reader.  Convey a sense of the design here. What
@@ -141,7 +142,7 @@
 /* - I mean `a window of zero bits' as in description of this function - Zam. */
   
     if ( !bi ) {
-	printk("Hey, bitmap info pointer is zero for bitmap %d!\n",bmap_n);
+	reiserfs_warning (s, "NULL bitmap info pointer for bitmap %d", bmap_n);
 	return 0;
     }
     if (buffer_locked (bi->bh)) {
@@ -281,7 +282,8 @@
 }
 
 static void _reiserfs_free_block (struct reiserfs_transaction_handle *th,
-				  b_blocknr_t block)
+				  struct inode *inode, b_blocknr_t block,
+				  int for_unformatted)
 {
     struct super_block * s = th->t_super;
     struct reiserfs_super_block * rs;
@@ -298,8 +300,8 @@
     get_bit_address (s, block, &nr, &offset);
 
     if (nr >= sb_bmap_nr (rs)) {
-	reiserfs_warning ("vs-4075: reiserfs_free_block: "
-			  "block %lu is out of range on %s\n", 
+	reiserfs_warning (s, "vs-4075: reiserfs_free_block: "
+			  "block %lu is out of range on %s",
 			  block, reiserfs_bdevname (s));
 	return;
     }
@@ -308,8 +310,8 @@
 
     /* clear bit for the given block in bit map */
     if (!reiserfs_test_and_clear_le_bit (offset, apbi[nr].bh->b_data)) {
-	reiserfs_warning ("vs-4080: reiserfs_free_block: "
-			  "free_block (%s:%lu)[dev:blocknr]: bit already cleared\n", 
+	reiserfs_warning (s, "vs-4080: reiserfs_free_block: "
+			  "free_block (%s:%lu)[dev:blocknr]: bit already cleared",
 			  reiserfs_bdevname (s), block);
     }
     if (offset < apbi[nr].first_zero_hint) {
@@ -323,11 +325,13 @@
     set_sb_free_blocks( rs, sb_free_blocks(rs) + 1 );
 
     journal_mark_dirty (th, s, sbh);
-  s->s_dirt = 1;
+    if (for_unformatted)
+        DQUOT_FREE_BLOCK_NODIRTY(inode, 1);
 }
 
 void reiserfs_free_block (struct reiserfs_transaction_handle *th, 
-                          b_blocknr_t block)
+			  struct inode *inode, b_blocknr_t block,
+			  int for_unformatted)
 {
     struct super_block * s = th->t_super;
 
@@ -335,42 +339,46 @@
     RFALSE(is_reusable (s, block, 1) == 0, "vs-4071: can not free such block");
     /* mark it before we clear it, just in case */
     journal_mark_freed(th, s, block) ;
-    _reiserfs_free_block(th, block) ;
+    _reiserfs_free_block(th, inode, block, for_unformatted) ;
 }
 
 /* preallocated blocks don't need to be run through journal_mark_freed */
 void reiserfs_free_prealloc_block (struct reiserfs_transaction_handle *th, 
-                          b_blocknr_t block) {
+			  struct inode *inode, b_blocknr_t block) {
     RFALSE(!th->t_super, "vs-4060: trying to free block on nonexistent device");
     RFALSE(is_reusable (th->t_super, block, 1) == 0, "vs-4070: can not free such block");
-    _reiserfs_free_block(th, block) ;
+    _reiserfs_free_block(th, inode, block, 1) ;
 }
 
 static void __discard_prealloc (struct reiserfs_transaction_handle * th,
 				struct reiserfs_inode_info *ei)
 {
     unsigned long save = ei->i_prealloc_block ;
+    int dirty = 0;
+    struct inode *inode = &ei->vfs_inode;
 #ifdef CONFIG_REISERFS_CHECK
     if (ei->i_prealloc_count < 0)
-	reiserfs_warning("zam-4001:%s: inode has negative prealloc blocks count.\n", __FUNCTION__ );
+	reiserfs_warning (th->t_super, "zam-4001:%s: inode has negative prealloc blocks count.", __FUNCTION__ );
 #endif
     while (ei->i_prealloc_count > 0) {
-	reiserfs_free_prealloc_block(th,ei->i_prealloc_block);
+	reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block);
 	ei->i_prealloc_block++;
 	ei->i_prealloc_count --;
+	dirty = 1;
     }
+    if (dirty)
+    	reiserfs_update_sd(th, inode);
     ei->i_prealloc_block = save;
     list_del_init(&(ei->i_prealloc_list));
 }
 
 /* FIXME: It should be inline function */
 void reiserfs_discard_prealloc (struct reiserfs_transaction_handle *th, 
-				struct inode * inode)
+				struct inode *inode)
 {
     struct reiserfs_inode_info *ei = REISERFS_I(inode);
-    if (ei->i_prealloc_count) {
+    if (ei->i_prealloc_count)
 	__discard_prealloc(th, ei);
-    }
 }
 
 void reiserfs_discard_all_prealloc (struct reiserfs_transaction_handle *th)
@@ -382,7 +390,7 @@
 	ei = list_entry(plist->next, struct reiserfs_inode_info, i_prealloc_list);
 #ifdef CONFIG_REISERFS_CHECK
 	if (!ei->i_prealloc_count) {
-	    reiserfs_warning("zam-4001:%s: inode is in prealloc list but has no preallocated blocks.\n", __FUNCTION__);
+	    reiserfs_warning (th->t_super, "zam-4001:%s: inode is in prealloc list but has no preallocated blocks.", __FUNCTION__);
 	}
 #endif
 	__discard_prealloc(th, ei);
@@ -468,7 +476,8 @@
 	    continue;
 	}
 
-	reiserfs_warning("zam-4001: %s : unknown option - %s\n", __FUNCTION__ , this_char);
+	reiserfs_warning (s, "zam-4001: %s : unknown option - %s",
+			  __FUNCTION__ , this_char);
 	return 1;
       }
   
@@ -508,7 +517,7 @@
 
     path = hint->path;
     bh = get_last_bh(path);
-    RFALSE( !bh, "green-4002: Illegal path specified to get_left_neighbor\n");
+    RFALSE( !bh, "green-4002: Illegal path specified to get_left_neighbor");
     ih = get_ih(path);
     pos_in_item = path->pos_in_item;
     item = get_item (path);
@@ -772,6 +781,24 @@
     int nr_allocated = 0;
 
     determine_prealloc_size(hint);
+    if (!hint->formatted_node) {
+        int quota_ret;
+#ifdef REISERQUOTA_DEBUG
+	reiserfs_debug (s, "reiserquota: allocating %d blocks id=%u", amount_needed, hint->inode->i_uid);
+#endif
+	quota_ret = DQUOT_ALLOC_BLOCK_NODIRTY(hint->inode, amount_needed);
+	if (quota_ret)    /* Quota exceeded? */
+	    return QUOTA_EXCEEDED;
+	if (hint->preallocate && hint->prealloc_size ) {
+#ifdef REISERQUOTA_DEBUG
+	    reiserfs_debug (s, "reiserquota: allocating (prealloc) %d blocks id=%u", hint->prealloc_size, hint->inode->i_uid);
+#endif
+	    quota_ret = DQUOT_PREALLOC_BLOCK_NODIRTY(hint->inode, hint->prealloc_size);
+	    if (quota_ret)
+		hint->preallocate=hint->prealloc_size=0;
+	}
+    }
+
     while((nr_allocated
 	  += allocate_without_wrapping_disk(hint, new_blocknrs + nr_allocated, start, finish,
 					  amount_needed - nr_allocated, hint->prealloc_size))
@@ -779,8 +806,14 @@
 
 	/* not all blocks were successfully allocated yet*/
 	if (second_pass) {	/* it was a second pass; we must free all blocks */
+	    if (!hint->formatted_node) {
+#ifdef REISERQUOTA_DEBUG
+		reiserfs_debug (s, "reiserquota: freeing (nospace) %d blocks id=%u", amount_needed + hint->prealloc_size - nr_allocated, hint->inode->i_uid);
+#endif
+		DQUOT_FREE_BLOCK_NODIRTY(hint->inode, amount_needed + hint->prealloc_size - nr_allocated);     /* Free not allocated blocks */
+	    }
 	    while (nr_allocated --)
-		reiserfs_free_block(hint->th, new_blocknrs[nr_allocated]);
+		reiserfs_free_block(hint->th, hint->inode, new_blocknrs[nr_allocated], !hint->formatted_node);
 
 	    return NO_DISK_SPACE;
 	} else {		/* refine search parameters for next pass */
@@ -789,7 +822,19 @@
 	    start = 0;
 	    continue;
 	}
-      }
+    }
+    if ( !hint->formatted_node &&
+         amount_needed + hint->prealloc_size >
+	 nr_allocated + REISERFS_I(hint->inode)->i_prealloc_count) {
+    /* Some of preallocation blocks were not allocated */
+#ifdef REISERQUOTA_DEBUG
+	reiserfs_debug (s, "reiserquota: freeing (failed prealloc) %d blocks id=%u", amount_needed + hint->prealloc_size - nr_allocated - INODE_INFO(hint->inode)->i_prealloc_count, hint->inode->i_uid);
+#endif
+	DQUOT_FREE_BLOCK_NODIRTY(hint->inode, amount_needed +
+	                         hint->prealloc_size - nr_allocated -
+				 REISERFS_I(hint->inode)->i_prealloc_count);
+    }
+
     return CARRY_ON;
 }
 
@@ -858,7 +903,7 @@
 
     if (ret != CARRY_ON) {
 	while (amount_needed ++ < initial_amount_needed) {
-	    reiserfs_free_block(hint->th, *(--new_blocknrs));
+	    reiserfs_free_block(hint->th, hint->inode, *(--new_blocknrs), 1);
 	}
     }
     return ret;
diff -Nru a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
--- a/fs/reiserfs/dir.c	Tue Jun 15 22:20:41 2004
+++ b/fs/reiserfs/dir.c	Tue Jun 15 22:20:41 2004
@@ -54,7 +54,7 @@
 
     reiserfs_write_lock(inode->i_sb);
 
-    reiserfs_check_lock_depth("readdir") ;
+    reiserfs_check_lock_depth(inode->i_sb, "readdir") ;
 
     /* form key for search the next directory entry using f_pos field of
        file structure */
@@ -62,7 +62,7 @@
 		  TYPE_DIRENTRY, 3);
     next_pos = cpu_key_k_offset (&pos_key);
 
-    /*  reiserfs_warning ("reiserfs_readdir 1: f_pos = %Ld\n", filp->f_pos);*/
+    /*  reiserfs_warning (inode->i_sb, "reiserfs_readdir 1: f_pos = %Ld", filp->f_pos);*/
 
     while (1) {
     research:
@@ -115,6 +115,17 @@
 		    /* too big to send back to VFS */
 		    continue ;
 		}
+
+                /* Ignore the .reiserfs_priv entry */
+                if (reiserfs_xattrs (inode->i_sb) &&
+                    !old_format_only(inode->i_sb) &&
+                    filp->f_dentry == inode->i_sb->s_root &&
+                    REISERFS_SB(inode->i_sb)->priv_root &&
+                    REISERFS_SB(inode->i_sb)->priv_root->d_inode &&
+                    deh_objectid(deh) == le32_to_cpu (INODE_PKEY(REISERFS_SB(inode->i_sb)->priv_root->d_inode)->k_objectid)) {
+                  continue;
+                }
+
 		d_off = deh_offset (deh);
 		filp->f_pos = d_off ;
 		d_ino = deh_objectid (deh);
diff -Nru a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c
--- a/fs/reiserfs/do_balan.c	Tue Jun 15 22:20:37 2004
+++ b/fs/reiserfs/do_balan.c	Tue Jun 15 22:20:37 2004
@@ -83,7 +83,7 @@
     struct item_head * ih;
 
     RFALSE( tb->FR[0] && B_LEVEL (tb->FR[0]) != DISK_LEAF_NODE_LEVEL + 1,
-	    "vs- 12000: level: wrong FR %z\n", tb->FR[0]);
+	    "vs- 12000: level: wrong FR %z", tb->FR[0]);
     RFALSE( tb->blknum[0] > 1,
 	    "PAP-12005: tb->blknum == %d, can not be > 1", tb->blknum[0]);
     RFALSE( ! tb->blknum[0] && ! PATH_H_PPARENT(tb->tb_path, 0),
@@ -1056,7 +1056,7 @@
 
 	RFALSE (!buffer_journaled (S_new [i]) || buffer_journal_dirty (S_new [i]) ||
 		buffer_dirty (S_new [i]),
-		"PAP-12247: S_new[%d] : (%b)\n", i, S_new[i]);
+		"PAP-12247: S_new[%d] : (%b)", i, S_new[i]);
     }
 
     /* if the affected item was not wholly shifted then we perform all necessary operations on that part or whole of the
@@ -1215,14 +1215,14 @@
     int i;
 
     if (buffer_dirty (bh))
-      printk ("store_thrown deals with dirty buffer\n");
+      reiserfs_warning (tb->tb_sb, "store_thrown deals with dirty buffer");
     for (i = 0; i < sizeof (tb->thrown)/sizeof (tb->thrown[0]); i ++)
 	if (!tb->thrown[i]) {
 	    tb->thrown[i] = bh;
 	    get_bh(bh) ; /* free_thrown puts this */
 	    return;
 	}
-    reiserfs_warning ("store_thrown: too many thrown buffers\n");
+    reiserfs_warning (tb->tb_sb, "store_thrown: too many thrown buffers");
 }
 
 static void free_thrown(struct tree_balance *tb) {
@@ -1232,9 +1232,11 @@
 	if (tb->thrown[i]) {
 	    blocknr = tb->thrown[i]->b_blocknr ;
 	    if (buffer_dirty (tb->thrown[i]))
-	      printk ("free_thrown deals with dirty buffer %d\n", blocknr);
+	      reiserfs_warning (tb->tb_sb,
+				"free_thrown deals with dirty buffer %d",
+				blocknr);
 	    brelse(tb->thrown[i]) ; /* incremented in store_thrown */
-	    reiserfs_free_block (tb->transaction_handle, blocknr);
+	    reiserfs_free_block (tb->transaction_handle, NULL, blocknr, 0);
 	}
     }
 }
@@ -1247,10 +1249,6 @@
     set_blkh_nr_item( blkh, 0 );
     
     clear_buffer_dirty(bh);
-    /* reiserfs_free_block is no longer schedule safe 
-    reiserfs_free_block (tb->transaction_handle, tb->tb_sb, bh->b_blocknr);
-    */
-
     store_thrown (tb, bh);
 }
 
@@ -1345,7 +1343,8 @@
 {
   if ( (!reiserfs_buffer_prepared(bh) && buffer_locked (bh)) ||
         !B_IS_IN_TREE (bh) ) {
-    reiserfs_warning ("vs-12339: locked_or_not_in_tree: %s (%b)\n", which, bh);
+    reiserfs_warning (NULL, "vs-12339: locked_or_not_in_tree: %s (%b)",
+                      which, bh);
     return 1;
   } 
   return 0;
@@ -1409,9 +1408,9 @@
 		    dc_size(B_N_CHILD (PATH_H_PBUFFER(tb->tb_path,1),
 			PATH_H_POSITION (tb->tb_path, 1))));
 	print_cur_tb ("12223");
-	reiserfs_warning(
+	reiserfs_warning (tb->tb_sb,
 	    "B_FREE_SPACE (PATH_H_PBUFFER(tb->tb_path,0)) = %d; "
-    	    "MAX_CHILD_SIZE (%d) - dc_size( %y, %d ) [%d] = %d\n",
+    	    "MAX_CHILD_SIZE (%d) - dc_size( %y, %d ) [%d] = %d",
 	    left,
 	    MAX_CHILD_SIZE (PATH_H_PBUFFER(tb->tb_path,0)),
 	    PATH_H_PBUFFER(tb->tb_path,1),
@@ -1568,7 +1567,8 @@
     }
     /* if we have no real work to do  */
     if ( ! tb->insert_size[0] ) {
-	reiserfs_warning ("PAP-12350: do_balance: insert_size == 0, mode == %c",
+	reiserfs_warning (tb->tb_sb,
+			  "PAP-12350: do_balance: insert_size == 0, mode == %c",
 			  flag);
 	unfix_nodes(tb);
 	return;
diff -Nru a/fs/reiserfs/file.c b/fs/reiserfs/file.c
--- a/fs/reiserfs/file.c	Tue Jun 15 22:20:36 2004
+++ b/fs/reiserfs/file.c	Tue Jun 15 22:20:36 2004
@@ -5,12 +5,16 @@
 
 #include <linux/time.h>
 #include <linux/reiserfs_fs.h>
+#include <linux/reiserfs_acl.h>
+#include <linux/reiserfs_xattr.h>
 #include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <linux/pagemap.h>
+#include <linux/swap.h>
 #include <linux/writeback.h>
 #include <linux/blkdev.h>
 #include <linux/buffer_head.h>
+#include <linux/quotaops.h>
 
 /*
 ** We pack the tails of files on file close, not at the time they are written.
@@ -97,51 +101,6 @@
   return ( n_err < 0 ) ? -EIO : 0;
 }
 
-static int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
-    struct inode *inode = dentry->d_inode ;
-    int error ;
-    reiserfs_write_lock(inode->i_sb);
-    if (attr->ia_valid & ATTR_SIZE) {
-	/* version 2 items will be caught by the s_maxbytes check
-	** done for us in vmtruncate
-	*/
-	if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5 &&
-	    attr->ia_size > MAX_NON_LFS) {
-	    error = -EFBIG ;
-	    goto out;
-	}
-	/* fill in hole pointers in the expanding truncate case. */
-        if (attr->ia_size > inode->i_size) {
-	    error = generic_cont_expand(inode, attr->ia_size) ;
-	    if (REISERFS_I(inode)->i_prealloc_count > 0) {
-		struct reiserfs_transaction_handle th ;
-		/* we're changing at most 2 bitmaps, inode + super */
-		journal_begin(&th, inode->i_sb, 4) ;
-		reiserfs_discard_prealloc (&th, inode);
-		journal_end(&th, inode->i_sb, 4) ;
-	    }
-	    if (error)
-	        goto out;
-	}
-    }
-
-    if ((((attr->ia_valid & ATTR_UID) && (attr->ia_uid & ~0xffff)) ||
-	 ((attr->ia_valid & ATTR_GID) && (attr->ia_gid & ~0xffff))) &&
-	(get_inode_sd_version (inode) == STAT_DATA_V1)) {
-		/* stat data of format v3.5 has 16 bit uid and gid */
-	    error = -EINVAL;
-	    goto out;	
-	}
-
-    error = inode_change_ok(inode, attr) ;
-    if (!error)
-        inode_setattr(inode, attr) ;
-
-out:
-    reiserfs_write_unlock(inode->i_sb);
-    return error ;
-}
-
 /* I really do not want to play with memory shortage right now, so
    to simplify the code, we are not going to write more than this much pages at
    a time. This still should considerably improve performance compared to 4k
@@ -317,7 +276,7 @@
 		    /* Ok, there is existing indirect item already. Need to append it */
 		    /* Calculate position past inserted item */
 		    make_cpu_key( &key, inode, le_key_k_offset( get_inode_item_key_version(inode), &(ih->ih_key)) + op_bytes_number(ih, inode->i_sb->s_blocksize), TYPE_INDIRECT, 3);
-		    res = reiserfs_paste_into_item( th, &path, &key, (char *)zeros, UNFM_P_SIZE*to_paste);
+		    res = reiserfs_paste_into_item( th, &path, &key, inode, (char *)zeros, UNFM_P_SIZE*to_paste);
 		    if ( res ) {
 			kfree(zeros);
 			goto error_exit_free_blocks;
@@ -340,14 +299,15 @@
 		    if ( res != ITEM_NOT_FOUND ) {
 			/* item should not exist, otherwise we have error */
 			if ( res != -ENOSPC ) {
-			    reiserfs_warning ("green-9008: search_by_key (%K) returned %d\n",
-					       &key, res);
+			    reiserfs_warning (inode->i_sb,
+				"green-9008: search_by_key (%K) returned %d",
+					      &key, res);
 			}
 			res = -EIO;
 		        kfree(zeros);
 			goto error_exit_free_blocks;
 		    }
-		    res = reiserfs_insert_item( th, &path, &key, &ins_ih, (char *)zeros);
+		    res = reiserfs_insert_item( th, &path, &key, &ins_ih, inode, (char *)zeros);
 		} else {
 		    reiserfs_panic(inode->i_sb, "green-9011: Unexpected key type %K\n", &key);
 		}
@@ -464,7 +424,7 @@
 	    // position. We do not need to recalculate path as it should
 	    // already point to correct place.
 	    make_cpu_key( &key, inode, le_key_k_offset( get_inode_item_key_version(inode), &(ih->ih_key)) + op_bytes_number(ih, inode->i_sb->s_blocksize), TYPE_INDIRECT, 3);
-	    res = reiserfs_paste_into_item( th, &path, &key, (char *)(allocated_blocks+curr_block), UNFM_P_SIZE*(blocks_to_allocate-curr_block));
+	    res = reiserfs_paste_into_item( th, &path, &key, inode, (char *)(allocated_blocks+curr_block), UNFM_P_SIZE*(blocks_to_allocate-curr_block));
 	    if ( res ) {
 		goto error_exit_free_blocks;
 	    }
@@ -488,14 +448,15 @@
 		/* Well, if we have found such item already, or some error
 		   occured, we need to warn user and return error */
 		if ( res != -ENOSPC ) {
-		    reiserfs_warning ("green-9009: search_by_key (%K) returned %d\n",
-			              &key, res);
+		    reiserfs_warning (inode->i_sb,
+				      "green-9009: search_by_key (%K) "
+				      "returned %d", &key, res);
 		}
 		res = -EIO;
 		goto error_exit_free_blocks;
 	    }
 	    /* Insert item into the tree with the data as its body */
-	    res = reiserfs_insert_item( th, &path, &key, &ins_ih, (char *)(allocated_blocks+curr_block));
+	    res = reiserfs_insert_item( th, &path, &key, &ins_ih, inode, (char *)(allocated_blocks+curr_block));
 	} else {
 	    reiserfs_panic(inode->i_sb, "green-9010: unexpected item type for key %K\n",&key);
 	}
@@ -505,7 +466,6 @@
     // unless we return an error, they are also responsible for logging
     // the inode.
     //
-    inode->i_blocks += blocks_to_allocate << (inode->i_blkbits - 9);
     pathrelse(&path);
     reiserfs_write_unlock(inode->i_sb);
 
@@ -551,7 +511,7 @@
     pathrelse(&path);
     // free blocks
     for( i = 0; i < blocks_to_allocate; i++ )
-	reiserfs_free_block(th, le32_to_cpu(allocated_blocks[i]));
+	reiserfs_free_block(th, inode, le32_to_cpu(allocated_blocks[i]), 1);
 
 error_exit:
     reiserfs_update_sd(th, inode); // update any changes we made to blk count
@@ -585,7 +545,7 @@
 								 array to
 								 prepared pages
 								*/
-				const char *buf /* Pointer to user-supplied
+				const char __user *buf /* Pointer to user-supplied
 						   data*/
 				)
 {
@@ -696,10 +656,6 @@
 			     // we only remember error status to report it on
 			     // exit.
 	write_bytes-=count;
-	SetPageReferenced(page);
-	unlock_page(page); // We unlock the page as it was locked by earlier call
-			  // to grab_cache_page
-	page_cache_release(page);
     }
     /* now that we've gotten all the ordered buffers marked dirty,
      * we can safely update i_size and close any running transaction
@@ -736,6 +692,17 @@
 	reiserfs_write_unlock(inode->i_sb);
     }
     th->t_trans_id = 0;
+
+    /* 
+     * we have to unlock the pages after updating i_size, otherwise
+     * we race with writepage
+     */
+    for ( i = 0; i < num_pages ; i++) {
+	struct page *page=prepared_pages[i];
+	unlock_page(page); 
+	mark_page_accessed(page);
+	page_cache_release(page);
+    }
     return retval;
 }
 
@@ -842,7 +809,9 @@
 
 
     if ( num_pages < 1 ) {
-	reiserfs_warning("green-9001: reiserfs_prepare_file_region_for_write called with zero number of pages to process\n");
+	reiserfs_warning (inode->i_sb,
+			  "green-9001: reiserfs_prepare_file_region_for_write "
+			  "called with zero number of pages to process");
 	return -EFAULT;
     }
 
@@ -1093,7 +1062,7 @@
 
 */
 ssize_t reiserfs_file_write( struct file *file, /* the file we are going to write into */
-                             const char *buf, /*  pointer to user supplied data
+                             const char __user *buf, /*  pointer to user supplied data
 (in userspace) */
                              size_t count, /* amount of bytes to write */
                              loff_t *ppos /* pointer to position in file that we start writing at. Should be updated to
@@ -1321,6 +1290,11 @@
 struct  inode_operations reiserfs_file_inode_operations = {
     .truncate	= reiserfs_vfs_truncate_file,
     .setattr    = reiserfs_setattr,
+    .setxattr   = reiserfs_setxattr,
+    .getxattr   = reiserfs_getxattr,
+    .listxattr  = reiserfs_listxattr,
+    .removexattr = reiserfs_removexattr,
+    .permission = reiserfs_permission,
 };
 
 
diff -Nru a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c
--- a/fs/reiserfs/fix_node.c	Tue Jun 15 22:20:38 2004
+++ b/fs/reiserfs/fix_node.c	Tue Jun 15 22:20:38 2004
@@ -483,7 +483,8 @@
 	snum012[needed_nodes - 1 + 3] = units;
 
 	if (needed_nodes > 2)
-	    reiserfs_warning ("vs-8111: get_num_ver: split_item_position is out of boundary\n");
+	    reiserfs_warning (tb->tb_sb, "vs-8111: get_num_ver: "
+			      "split_item_position is out of boundary");
 	snum012[needed_nodes - 1] ++;
 	split_item_positions[needed_nodes - 1] = i;
 	needed_nodes ++;
@@ -510,7 +511,8 @@
 	snum012[4] = op_unit_num (&vn->vn_vi[split_item_num]) - snum012[4] - bytes_to_r - bytes_to_l - bytes_to_S1new;
 
 	if (vn->vn_vi[split_item_num].vi_index != TYPE_DIRENTRY)
-	    reiserfs_warning ("vs-8115: get_num_ver: not directory item\n");
+	    reiserfs_warning (tb->tb_sb, "vs-8115: get_num_ver: not "
+			      "directory item");
     }
 
     /* now we know S2bytes, calculate S1bytes */
@@ -795,8 +797,9 @@
   else /* If we have enough already then there is nothing to do. */
     return CARRY_ON;
 
-  if ( reiserfs_new_form_blocknrs (p_s_tb, a_n_blocknrs,
-                                   n_amount_needed) == NO_DISK_SPACE )
+  /* No need to check quota - is not allocated for blocks used for formatted nodes */
+  if (reiserfs_new_form_blocknrs (p_s_tb, a_n_blocknrs,
+                                   n_amount_needed) == NO_DISK_SPACE)
     return NO_DISK_SPACE;
 
   /* for each blocknumber we just got, get a buffer and stick it on FEB */
@@ -1973,11 +1976,12 @@
     if (vp) {
 	REISERFS_SB(s)->s_kmallocs += size;
 	if (REISERFS_SB(s)->s_kmallocs > malloced + 200000) {
-	    reiserfs_warning ("vs-8301: reiserfs_kmalloc: allocated memory %d\n", REISERFS_SB(s)->s_kmallocs);
+	    reiserfs_warning (s,
+			      "vs-8301: reiserfs_kmalloc: allocated memory %d",
+			      REISERFS_SB(s)->s_kmallocs);
 	    malloced = REISERFS_SB(s)->s_kmallocs;
 	}
     }
-/*printk ("malloc : size %d, allocated %d\n", size, REISERFS_SB(s)->s_kmallocs);*/
     return vp;
 }
 
@@ -1987,7 +1991,8 @@
   
     REISERFS_SB(s)->s_kmallocs -= size;
     if (REISERFS_SB(s)->s_kmallocs < 0)
-	reiserfs_warning ("vs-8302: reiserfs_kfree: allocated memory %d\n", REISERFS_SB(s)->s_kmallocs);
+	reiserfs_warning (s, "vs-8302: reiserfs_kfree: allocated memory %d",
+			  REISERFS_SB(s)->s_kmallocs);
 
 }
 #endif
@@ -2047,8 +2052,9 @@
 	    buf = reiserfs_kmalloc(size, GFP_NOFS, tb->tb_sb);
 	    if ( !buf ) {
 #ifdef CONFIG_REISERFS_CHECK
-		reiserfs_warning ("vs-8345: get_mem_for_virtual_node: "
-				  "kmalloc failed. reiserfs kmalloced %d bytes\n",
+		reiserfs_warning (tb->tb_sb,
+				  "vs-8345: get_mem_for_virtual_node: "
+				  "kmalloc failed. reiserfs kmalloced %d bytes",
 				  REISERFS_SB(tb->tb_sb)->s_kmallocs);
 #endif
 		tb->vn_buf_size = 0;
@@ -2210,7 +2216,10 @@
 #ifdef CONFIG_REISERFS_CHECK
 	    repeat_counter++;
 	    if ( (repeat_counter % 10000) == 0) {
-		reiserfs_warning ("wait_tb_buffers_until_released(): too many iterations waiting for buffer to unlock (%b)\n", locked);
+		reiserfs_warning (p_s_tb->tb_sb,
+				  "wait_tb_buffers_until_released(): too many "
+				  "iterations waiting for buffer to unlock "
+				  "(%b)", locked);
 
 		/* Don't loop forever.  Try to recover from possible error. */
 
@@ -2323,8 +2332,7 @@
     case M_CUT:
 	if ( n_item_num < 0 || n_item_num >= B_NR_ITEMS(p_s_tbS0) ) {
 	    print_block (p_s_tbS0, 0, -1, -1);
-	    printk("mode = %c insert_size = %d\n", n_op_mode, p_s_tb->insert_size[0]);
-	    reiserfs_panic(p_s_tb->tb_sb,"PAP-8335: fix_nodes: Incorrect item number(%d)", n_item_num);
+	    reiserfs_panic(p_s_tb->tb_sb,"PAP-8335: fix_nodes: Incorrect item number(%d); mode = %c insert_size = %d\n", n_item_num, n_op_mode, p_s_tb->insert_size[0]);
 	}
 	break;
     default:
@@ -2492,7 +2500,7 @@
 	    /* de-allocated block which was not used by balancing and
                bforget about buffer for it */
 	    brelse (tb->FEB[i]);
-	    reiserfs_free_block (tb->transaction_handle, blocknr);
+	    reiserfs_free_block (tb->transaction_handle, NULL, blocknr, 0);
 	}
 	if (tb->used[i]) {
 	    /* release used as new nodes including a new root */
diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
--- a/fs/reiserfs/inode.c	Tue Jun 15 22:20:38 2004
+++ b/fs/reiserfs/inode.c	Tue Jun 15 22:20:38 2004
@@ -4,7 +4,10 @@
 
 #include <linux/config.h>
 #include <linux/time.h>
+#include <linux/fs.h>
 #include <linux/reiserfs_fs.h>
+#include <linux/reiserfs_acl.h>
+#include <linux/reiserfs_xattr.h>
 #include <linux/smp_lock.h>
 #include <linux/pagemap.h>
 #include <linux/highmem.h>
@@ -13,6 +16,7 @@
 #include <linux/buffer_head.h>
 #include <linux/mpage.h>
 #include <linux/writeback.h>
+#include <linux/quotaops.h>
 
 extern int reiserfs_default_io_size; /* default io size devuned in super.c */
 
@@ -36,10 +40,13 @@
   
     reiserfs_write_lock(inode->i_sb);
 
+    DQUOT_FREE_INODE(inode);
     /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
     if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */
 	down (&inode->i_sem); 
 
+	reiserfs_delete_xattrs (inode);
+
 	journal_begin(&th, inode->i_sb, jbegin_count) ;
 	reiserfs_update_inode_transaction(inode) ;
 
@@ -642,7 +649,7 @@
 
 	repeat = _allocate_block(th, block, inode, &allocated_block_nr, &path, create);
 
-	if (repeat == NO_DISK_SPACE) {
+	if (repeat == NO_DISK_SPACE || repeat == QUOTA_EXCEEDED) {
 	    /* restart the transaction to give the journal a chance to free
 	    ** some blocks.  releases the path, so we have to go back to
 	    ** research if we succeed on the second try
@@ -651,10 +658,13 @@
 	    restart_transaction(th, inode, &path) ;
 	    repeat = _allocate_block(th, block, inode, &allocated_block_nr, NULL, create);
 
-	    if (repeat != NO_DISK_SPACE) {
+	    if (repeat != NO_DISK_SPACE && repeat != QUOTA_EXCEEDED) {
 		goto research ;
 	    }
-	    retval = -ENOSPC;
+	    if (repeat == QUOTA_EXCEEDED)
+		retval = -EDQUOT;
+	    else
+		retval = -ENOSPC;
 	    goto failure;
 	}
 
@@ -682,7 +692,6 @@
 	    put_block_num(item, pos_in_item, allocated_block_nr) ;
             unfm_ptr = allocated_block_nr;
 	    journal_mark_dirty (th, inode->i_sb, bh);
-	    inode->i_blocks += (inode->i_sb->s_blocksize / 512) ;
 	    reiserfs_update_sd(th, inode) ;
 	}
 	set_block_dev_mapped(bh_result, unfm_ptr, inode);
@@ -729,13 +738,11 @@
 	    set_cpu_key_k_offset (&tmp_key, 1);
 	    PATH_LAST_POSITION(&path) ++;
 
-	    retval = reiserfs_insert_item (th, &path, &tmp_key, &tmp_ih, (char *)&unp);
+	    retval = reiserfs_insert_item (th, &path, &tmp_key, &tmp_ih, inode, (char *)&unp);
 	    if (retval) {
-		reiserfs_free_block (th, allocated_block_nr);
-		goto failure; // retval == -ENOSPC or -EIO or -EEXIST
+		reiserfs_free_block (th, inode, allocated_block_nr, 1);
+		goto failure; // retval == -ENOSPC, -EDQUOT or -EIO or -EEXIST
 	    }
-	    if (unp)
-		inode->i_blocks += inode->i_sb->s_blocksize / 512;
 	    //mark_tail_converted (inode);
 	} else if (is_direct_le_ih (ih)) {
 	    /* direct item has to be converted */
@@ -767,13 +774,13 @@
 		retval = convert_tail_for_hole(inode, bh_result, tail_offset) ;
 		if (retval) {
 		    if ( retval != -ENOSPC )
-			printk("clm-6004: convert tail failed inode %lu, error %d\n", inode->i_ino, retval) ;
+			reiserfs_warning (inode->i_sb, "clm-6004: convert tail failed inode %lu, error %d", inode->i_ino, retval) ;
 		    if (allocated_block_nr) {
 			/* the bitmap, the super, and the stat data == 3 */
 			if (!th)
 			    th = reiserfs_persistent_transaction(inode->i_sb,3);
 			if (th)
-			    reiserfs_free_block (th, allocated_block_nr);
+			    reiserfs_free_block (th,inode,allocated_block_nr,1);
 		    }
 		    goto failure ;
 		}
@@ -782,7 +789,7 @@
 	    retval = direct2indirect (th, inode, &path, unbh, tail_offset);
 	    if (retval) {
 		reiserfs_unmap_buffer(unbh);
-		reiserfs_free_block (th, allocated_block_nr);
+		reiserfs_free_block (th, inode, allocated_block_nr, 1);
 		goto failure;
 	    }
 	    /* it is important the set_buffer_uptodate is done after
@@ -815,9 +822,6 @@
 		 */
 		mark_buffer_dirty(unbh) ;
 	    }
-
-	    //inode->i_blocks += inode->i_sb->s_blocksize / 512;
-	    //mark_tail_converted (inode);
 	} else {
 	    /* append indirect item with holes if needed, when appending
 	       pointer to 'block'-th block use block, which is already
@@ -865,24 +869,21 @@
 		   only have space for one block */
 		blocks_needed=max_to_insert?max_to_insert:1;
 	    }
-	    retval = reiserfs_paste_into_item (th, &path, &tmp_key, (char *)un, UNFM_P_SIZE * blocks_needed);
+	    retval = reiserfs_paste_into_item (th, &path, &tmp_key, inode, (char *)un, UNFM_P_SIZE * blocks_needed);
 
 	    if (blocks_needed != 1)
 		kfree(un);
 
 	    if (retval) {
-		reiserfs_free_block (th, allocated_block_nr);
+		reiserfs_free_block (th, inode, allocated_block_nr, 1);
 		goto failure;
 	    }
-	    if (done) {
-		inode->i_blocks += inode->i_sb->s_blocksize / 512;
-	    } else {
+	    if (!done) {
 		/* We need to mark new file size in case this function will be
 		   interrupted/aborted later on. And we may do this only for
 		   holes. */
 		inode->i_size += inode->i_sb->s_blocksize * blocks_needed;
 	    }
-	    //mark_tail_converted (inode);
 	}
 
 	if (done == 1)
@@ -910,11 +911,11 @@
 	    goto failure;
 	}
 	if (retval == POSITION_FOUND) {
-	    reiserfs_warning ("vs-825: reiserfs_get_block: "
-			      "%K should not be found\n", &key);
+	    reiserfs_warning (inode->i_sb, "vs-825: reiserfs_get_block: "
+			      "%K should not be found", &key);
 	    retval = -EEXIST;
 	    if (allocated_block_nr)
-	        reiserfs_free_block (th, allocated_block_nr);
+	        reiserfs_free_block (th, inode, allocated_block_nr, 1);
 	    pathrelse(&path) ;
 	    goto failure;
 	}
@@ -944,6 +945,58 @@
     return mpage_readpages(mapping, pages, nr_pages, reiserfs_get_block);
 }
 
+/* Compute real number of used bytes by file
+ * Following three functions can go away when we'll have enough space in stat item
+ */
+static int real_space_diff(struct inode *inode, int sd_size)
+{
+    int bytes;
+    loff_t blocksize = inode->i_sb->s_blocksize ;
+
+    if (S_ISLNK(inode->i_mode) || S_ISDIR(inode->i_mode))
+        return sd_size ;
+
+    /* End of file is also in full block with indirect reference, so round
+    ** up to the next block.
+    **
+    ** there is just no way to know if the tail is actually packed
+    ** on the file, so we have to assume it isn't.  When we pack the
+    ** tail, we add 4 bytes to pretend there really is an unformatted
+    ** node pointer
+    */
+    bytes = ((inode->i_size + (blocksize-1)) >> inode->i_sb->s_blocksize_bits) * UNFM_P_SIZE + sd_size;
+    return bytes ;
+}
+
+static inline loff_t to_real_used_space(struct inode *inode, ulong blocks,
+                                        int sd_size)
+{
+    if (S_ISLNK(inode->i_mode) || S_ISDIR(inode->i_mode)) {
+        return inode->i_size + (loff_t)(real_space_diff(inode, sd_size)) ;
+    }
+    return ((loff_t)real_space_diff(inode, sd_size)) + (((loff_t)blocks) << 9);
+}
+
+/* Compute number of blocks used by file in ReiserFS counting */
+static inline ulong to_fake_used_blocks(struct inode *inode, int sd_size)
+{
+    loff_t bytes = inode_get_bytes(inode) ;
+    loff_t real_space = real_space_diff(inode, sd_size) ;
+
+    /* keeps fsck and non-quota versions of reiserfs happy */
+    if (S_ISLNK(inode->i_mode) || S_ISDIR(inode->i_mode)) {
+        bytes += (loff_t)511 ;
+    }
+
+    /* files from before the quota patch might i_blocks such that
+    ** bytes < real_space.  Deal with that here to prevent it from
+    ** going negative.
+    */
+    if (bytes < real_space)
+        return 0 ;
+    return (bytes - real_space) >> 9;
+}
+
 //
 // BAD: new directories have stat data of new type and all other items
 // of old type. Version stored in the inode says about body items, so
@@ -972,6 +1025,9 @@
     REISERFS_I(inode)->i_prealloc_count = 0;
     REISERFS_I(inode)->i_trans_id = 0;
     REISERFS_I(inode)->i_jl = NULL;
+    REISERFS_I(inode)->i_acl_access = NULL;
+    REISERFS_I(inode)->i_acl_default = NULL;
+    init_rwsem (&REISERFS_I(inode)->xattr_sem);
 
     if (stat_data_v1 (ih)) {
 	struct stat_data_v1 * sd = (struct stat_data_v1 *)B_I_PITEM (bh, ih);
@@ -1006,6 +1062,14 @@
 
         rdev = sd_v1_rdev(sd);
 	REISERFS_I(inode)->i_first_direct_byte = sd_v1_first_direct_byte(sd);
+	/* an early bug in the quota code can give us an odd number for the
+	** block count.  This is incorrect, fix it here.
+	*/
+	if (inode->i_blocks & 1) {
+	    inode->i_blocks++ ;
+	}
+	inode_set_bytes(inode, to_real_used_space(inode, inode->i_blocks,
+	                                          SD_V1_SIZE));
 	/* nopack is initially zero for v1 objects. For v2 objects,
 	   nopack is initialised from sd_attrs */
 	REISERFS_I(inode)->i_flags &= ~i_nopack_mask;
@@ -1038,6 +1102,8 @@
 	    set_inode_item_key_version (inode, KEY_FORMAT_3_6);
 	REISERFS_I(inode)->i_first_direct_byte = 0;
 	set_inode_sd_version (inode, STAT_DATA_V2);
+	inode_set_bytes(inode, to_real_used_space(inode, inode->i_blocks,
+	                                          SD_V2_SIZE));
 	/* read persistent inode attributes from sd and initalise
 	   generic inode flags from them */
 	REISERFS_I(inode)->i_attrs = sd_v2_attrs( sd );
@@ -1053,17 +1119,18 @@
 	inode->i_op = &reiserfs_dir_inode_operations;
 	inode->i_fop = &reiserfs_dir_operations;
     } else if (S_ISLNK (inode->i_mode)) {
-	inode->i_op = &page_symlink_inode_operations;
+	inode->i_op = &reiserfs_symlink_inode_operations;
 	inode->i_mapping->a_ops = &reiserfs_address_space_operations;
     } else {
 	inode->i_blocks = 0;
+	inode->i_op = &reiserfs_special_inode_operations;
 	init_special_inode(inode, inode->i_mode, new_decode_dev(rdev));
     }
 }
 
 
 // update new stat data with inode fields
-static void inode2sd (void * sd, struct inode * inode)
+static void inode2sd (void * sd, struct inode * inode, loff_t size)
 {
     struct stat_data * sd_v2 = (struct stat_data *)sd;
     __u16 flags;
@@ -1071,12 +1138,12 @@
     set_sd_v2_mode(sd_v2, inode->i_mode );
     set_sd_v2_nlink(sd_v2, inode->i_nlink );
     set_sd_v2_uid(sd_v2, inode->i_uid );
-    set_sd_v2_size(sd_v2, inode->i_size );
+    set_sd_v2_size(sd_v2, size );
     set_sd_v2_gid(sd_v2, inode->i_gid );
     set_sd_v2_mtime(sd_v2, inode->i_mtime.tv_sec );
     set_sd_v2_atime(sd_v2, inode->i_atime.tv_sec );
     set_sd_v2_ctime(sd_v2, inode->i_ctime.tv_sec );
-    set_sd_v2_blocks(sd_v2, inode->i_blocks );
+    set_sd_v2_blocks(sd_v2, to_fake_used_blocks(inode, SD_V2_SIZE));
     if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
 	set_sd_v2_rdev(sd_v2, new_encode_dev(inode->i_rdev));
     else
@@ -1088,7 +1155,7 @@
 
 
 // used to copy inode's fields to old stat data
-static void inode2sd_v1 (void * sd, struct inode * inode)
+static void inode2sd_v1 (void * sd, struct inode * inode, loff_t size)
 {
     struct stat_data_v1 * sd_v1 = (struct stat_data_v1 *)sd;
 
@@ -1096,7 +1163,7 @@
     set_sd_v1_uid(sd_v1, inode->i_uid );
     set_sd_v1_gid(sd_v1, inode->i_gid );
     set_sd_v1_nlink(sd_v1, inode->i_nlink );
-    set_sd_v1_size(sd_v1, inode->i_size );
+    set_sd_v1_size(sd_v1, size );
     set_sd_v1_atime(sd_v1, inode->i_atime.tv_sec );
     set_sd_v1_ctime(sd_v1, inode->i_ctime.tv_sec );
     set_sd_v1_mtime(sd_v1, inode->i_mtime.tv_sec );
@@ -1104,7 +1171,7 @@
     if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
         set_sd_v1_rdev(sd_v1, new_encode_dev(inode->i_rdev));
     else
-        set_sd_v1_blocks(sd_v1, inode->i_blocks );
+        set_sd_v1_blocks(sd_v1, to_fake_used_blocks(inode, SD_V1_SIZE));
 
     // Sigh. i_first_direct_byte is back
     set_sd_v1_first_direct_byte(sd_v1, REISERFS_I(inode)->i_first_direct_byte);
@@ -1114,7 +1181,8 @@
 /* NOTE, you must prepare the buffer head before sending it here,
 ** and then log it after the call
 */
-static void update_stat_data (struct path * path, struct inode * inode)
+static void update_stat_data (struct path * path, struct inode * inode,
+                              loff_t size)
 {
     struct buffer_head * bh;
     struct item_head * ih;
@@ -1128,17 +1196,17 @@
   
     if (stat_data_v1 (ih)) {
 	// path points to old stat data
-	inode2sd_v1 (B_I_PITEM (bh, ih), inode);
+	inode2sd_v1 (B_I_PITEM (bh, ih), inode, size);
     } else {
-	inode2sd (B_I_PITEM (bh, ih), inode);
+	inode2sd (B_I_PITEM (bh, ih), inode, size);
     }
 
     return;
 }
 
 
-void reiserfs_update_sd (struct reiserfs_transaction_handle *th, 
-			 struct inode * inode)
+void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th,
+			      struct inode * inode, loff_t size)
 {
     struct cpu_key key;
     INITIALIZE_PATH(path);
@@ -1154,7 +1222,7 @@
 	/* look for the object's stat data */
 	retval = search_item (inode->i_sb, &key, &path);
 	if (retval == IO_ERROR) {
-	    reiserfs_warning ("vs-13050: reiserfs_update_sd: "
+	    reiserfs_warning (inode->i_sb, "vs-13050: reiserfs_update_sd: "
 			      "i/o failure occurred trying to update %K stat data",
 			      &key);
 	    return;
@@ -1163,11 +1231,11 @@
 	    pos = PATH_LAST_POSITION (&path);
 	    pathrelse(&path) ;
 	    if (inode->i_nlink == 0) {
-		/*printk ("vs-13050: reiserfs_update_sd: i_nlink == 0, stat data not found\n");*/
+		/*reiserfs_warning (inode->i_sb, "vs-13050: reiserfs_update_sd: i_nlink == 0, stat data not found");*/
 		return;
 	    }
-	    reiserfs_warning ("vs-13060: reiserfs_update_sd: "
-			      "stat data of object %k (nlink == %d) not found (pos %d)\n", 
+	    reiserfs_warning (inode->i_sb, "vs-13060: reiserfs_update_sd: "
+			      "stat data of object %k (nlink == %d) not found (pos %d)",
 			      INODE_PKEY (inode), inode->i_nlink, pos);
 	    reiserfs_check_path(&path) ;
 	    return;
@@ -1188,7 +1256,7 @@
 	}
 	break;
     }
-    update_stat_data (&path, inode);
+    update_stat_data (&path, inode, size);
     journal_mark_dirty(th, th->t_super, bh) ; 
     pathrelse (&path);
     return;
@@ -1240,9 +1308,9 @@
     /* look for the object's stat data */
     retval = search_item (inode->i_sb, &key, &path_to_sd);
     if (retval == IO_ERROR) {
-	reiserfs_warning ("vs-13070: reiserfs_read_locked_inode: "
-                    "i/o failure occurred trying to find stat data of %K\n",
-                    &key);
+	reiserfs_warning (inode->i_sb, "vs-13070: reiserfs_read_locked_inode: "
+			  "i/o failure occurred trying to find stat data of %K",
+			  &key);
 	reiserfs_make_bad_inode(inode) ;
 	return;
     }
@@ -1272,9 +1340,10 @@
        during mount (fs/reiserfs/super.c:finish_unfinished()). */
     if( ( inode -> i_nlink == 0 ) && 
 	! REISERFS_SB(inode -> i_sb) -> s_is_unlinked_ok ) {
-	    reiserfs_warning( "vs-13075: reiserfs_read_locked_inode: "
+	    reiserfs_warning (inode->i_sb,
+			      "vs-13075: reiserfs_read_locked_inode: "
 			      "dead inode read from disk %K. "
-			      "This is likely to be race with knfsd. Ignore\n", 
+			      "This is likely to be race with knfsd. Ignore",
 			      &key );
 	    reiserfs_make_bad_inode( inode );
     }
@@ -1377,7 +1446,7 @@
      */
     if (fhtype > len) {
 	    if (fhtype != 6 || len != 5)
-		    printk(KERN_WARNING "nfsd/reiserfs, fhtype=%d, len=%d - odd\n",
+		    reiserfs_warning (sb, "nfsd/reiserfs, fhtype=%d, len=%d - odd",
 			   fhtype, len);
 	    fhtype = 5;
     }
@@ -1440,8 +1509,9 @@
     int jbegin_count = 1 ;
 
     if (inode->i_sb->s_flags & MS_RDONLY) {
-        reiserfs_warning("clm-6005: writing inode %lu on readonly FS\n", 
-	                  inode->i_ino) ;
+        reiserfs_warning (inode->i_sb,
+			  "clm-6005: writing inode %lu on readonly FS",
+			  inode->i_ino) ;
         return ;
     }
     /* memory pressure can sometimes initiate write_inode calls with sync == 1,
@@ -1471,6 +1541,7 @@
 /* stat data of new object is inserted already, this inserts the item
    containing "." and ".." entries */
 static int reiserfs_new_directory (struct reiserfs_transaction_handle *th, 
+				   struct inode *inode,
 				   struct item_head * ih, struct path * path,
 				   struct inode * dir)
 {
@@ -1503,25 +1574,26 @@
     /* look for place in the tree for new item */
     retval = search_item (sb, &key, path);
     if (retval == IO_ERROR) {
-	reiserfs_warning ("vs-13080: reiserfs_new_directory: "
-			  "i/o failure occurred creating new directory\n");
+	reiserfs_warning (sb, "vs-13080: reiserfs_new_directory: "
+			  "i/o failure occurred creating new directory");
 	return -EIO;
     }
     if (retval == ITEM_FOUND) {
 	pathrelse (path);
-	reiserfs_warning ("vs-13070: reiserfs_new_directory: "
+	reiserfs_warning (sb, "vs-13070: reiserfs_new_directory: "
 			  "object with this key exists (%k)", &(ih->ih_key));
 	return -EEXIST;
     }
 
     /* insert item, that is empty directory item */
-    return reiserfs_insert_item (th, path, &key, ih, body);
+    return reiserfs_insert_item (th, path, &key, ih, inode, body);
 }
 
 
 /* stat data of object has been inserted, this inserts the item
    containing the body of symlink */
 static int reiserfs_new_symlink (struct reiserfs_transaction_handle *th, 
+				 struct inode *inode,	/* Inode of symlink */
 				 struct item_head * ih,
 				 struct path * path, const char * symname, int item_len)
 {
@@ -1539,19 +1611,19 @@
     /* look for place in the tree for new item */
     retval = search_item (sb, &key, path);
     if (retval == IO_ERROR) {
-	reiserfs_warning ("vs-13080: reiserfs_new_symlinik: "
-			  "i/o failure occurred creating new symlink\n");
+	reiserfs_warning (sb, "vs-13080: reiserfs_new_symlinik: "
+			  "i/o failure occurred creating new symlink");
 	return -EIO;
     }
     if (retval == ITEM_FOUND) {
 	pathrelse (path);
-	reiserfs_warning ("vs-13080: reiserfs_new_symlink: "
+	reiserfs_warning (sb, "vs-13080: reiserfs_new_symlink: "
 			  "object with this key exists (%k)", &(ih->ih_key));
 	return -EEXIST;
     }
 
     /* insert item, that is body of symlink */
-    return reiserfs_insert_item (th, path, &key, ih, symname);
+    return reiserfs_insert_item (th, path, &key, ih, inode, symname);
 }
 
 
@@ -1619,7 +1691,8 @@
 
     inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
     inode->i_size = i_size;
-    inode->i_blocks = (inode->i_size + 511) >> 9;
+    inode->i_blocks = 0;
+    inode->i_bytes = 0;
     REISERFS_I(inode)->i_first_direct_byte = S_ISLNK(mode) ? 1 : 
       U32_MAX/*NO_BYTES_IN_DIRECT_ITEM*/;
 
@@ -1632,6 +1705,9 @@
     REISERFS_I(inode)->i_attrs =
 	REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK;
     sd_attrs_to_i_attrs( REISERFS_I(inode) -> i_attrs, inode );
+    REISERFS_I(inode)->i_acl_access = NULL;
+    REISERFS_I(inode)->i_acl_default = NULL;
+    init_rwsem (&REISERFS_I(inode)->xattr_sem);
 
     if (old_format_only (sb))
 	make_le_item_head (&ih, 0, KEY_FORMAT_3_5, SD_OFFSET, TYPE_STAT_DATA, SD_V1_SIZE, MAX_US_INT);
@@ -1661,9 +1737,9 @@
 	    err = -EINVAL;
 	    goto out_bad_inode;
 	}
-	inode2sd_v1 (&sd, inode);
+	inode2sd_v1 (&sd, inode, inode->i_size);
     } else {
-	inode2sd (&sd, inode);
+	inode2sd (&sd, inode, inode->i_size);
     }
     // these do not go to on-disk stat data
     inode->i_ino = le32_to_cpu (ih.ih_key.k_objectid);
@@ -1687,7 +1763,7 @@
     if (REISERFS_I(dir)->new_packing_locality)
 	th->displace_new_blocks = 1;
 #endif
-    retval = reiserfs_insert_item (th, &path_to_key, &key, &ih, (char *)(&sd));
+    retval = reiserfs_insert_item (th, &path_to_key, &key, &ih, inode, (char *)(&sd));
     if (retval) {
 	err = retval;
 	reiserfs_check_path(&path_to_key) ;
@@ -1700,14 +1776,14 @@
 #endif
     if (S_ISDIR(mode)) {
 	/* insert item with "." and ".." */
-	retval = reiserfs_new_directory (th, &ih, &path_to_key, dir);
+	retval = reiserfs_new_directory (th, inode, &ih, &path_to_key, dir);
     }
 
     if (S_ISLNK(mode)) {
 	/* insert body of symlink */
 	if (!old_format_only (sb))
 	    i_size = ROUND_UP(i_size);
-	retval = reiserfs_new_symlink (th, &ih, &path_to_key, symname, i_size);
+	retval = reiserfs_new_symlink (th, inode, &ih, &path_to_key, symname, i_size);
     }
     if (retval) {
 	err = retval;
@@ -1716,6 +1792,20 @@
 	goto out_inserted_sd;
     }
 
+    /* XXX CHECK THIS */
+    if (reiserfs_posixacl (inode->i_sb)) {
+        retval = reiserfs_inherit_default_acl (dir, dentry, inode);
+        if (retval) {
+            err = retval;
+            reiserfs_check_path(&path_to_key) ;
+            journal_end(th, th->t_super, th->t_blocks_allocated);
+            goto out_inserted_sd;
+        }
+    } 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!");
+    }
+
     insert_inode_hash (inode);
     reiserfs_update_sd(th, inode);
     reiserfs_check_path(&path_to_key) ;
@@ -1732,6 +1822,9 @@
 
     /* dquot_drop must be done outside a transaction */
     journal_end(th, th->t_super, th->t_blocks_allocated) ;
+    DQUOT_FREE_INODE(inode);
+    DQUOT_DROP(inode);
+    inode->i_flags |= S_NOQUOTA;
     make_bad_inode(inode);
 
 out_inserted_sd:
@@ -1808,9 +1901,10 @@
 	** I've screwed up the code to find the buffer, or the code to
 	** call prepare_write
 	*/
-	reiserfs_warning("clm-6000: error reading block %lu on dev %s\n",
-			 bh->b_blocknr,
-			 reiserfs_bdevname (p_s_inode->i_sb)) ;
+	reiserfs_warning (p_s_inode->i_sb,
+			  "clm-6000: error reading block %lu on dev %s",
+			  bh->b_blocknr,
+			  reiserfs_bdevname (p_s_inode->i_sb)) ;
 	error = -EIO ;
 	goto unlock ;
     }
@@ -1850,7 +1944,9 @@
 	    // and get_block_create_0 could not find a block to read in,
 	    // which is ok.
 	    if (error != -ENOENT)
-	        reiserfs_warning("clm-6001: grab_tail_page failed %d\n", error);
+	        reiserfs_warning (p_s_inode->i_sb,
+				  "clm-6001: grab_tail_page failed %d",
+				  error);
 	    page = NULL ;
 	    bh = NULL ;
 	}
@@ -1948,7 +2044,8 @@
     /* we've found an unformatted node */
     if (indirect_item_found(retval, ih)) {
 	if (bytes_copied > 0) {
-	    reiserfs_warning("clm-6002: bytes_copied %d\n", bytes_copied) ;
+	    reiserfs_warning (inode->i_sb, "clm-6002: bytes_copied %d",
+			      bytes_copied) ;
 	}
         if (!get_block_num(item, pos_in_item)) {
 	    /* crap, we are writing to a hole */
@@ -1996,7 +2093,9 @@
 	    goto research ;
 	}
     } else {
-        reiserfs_warning("clm-6003: bad item inode %lu, device %s\n", inode->i_ino, reiserfs_bdevname (inode->i_sb)) ;
+        reiserfs_warning (inode->i_sb,
+			  "clm-6003: bad item inode %lu, device %s",
+			  inode->i_ino, reiserfs_bdevname (inode->i_sb)) ;
         retval = -EIO ;
 	goto out ;
     }
@@ -2269,6 +2368,7 @@
     struct inode *inode = page->mapping->host ;
     loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
     int ret = 0;
+    int update_sd = 0;
     struct reiserfs_transaction_handle *th = NULL;
     
     reiserfs_wait_on_write_block(inode->i_sb) ;
@@ -2295,11 +2395,14 @@
 	reiserfs_update_inode_transaction(inode) ;
 	inode->i_size = pos ;
 	reiserfs_update_sd(&myth, inode) ;
+	update_sd = 1;
 	journal_end(&myth, inode->i_sb, 1) ;
 	reiserfs_write_unlock(inode->i_sb);
     }
     if (th) {
 	reiserfs_write_lock(inode->i_sb);
+	if (!update_sd)
+	    reiserfs_update_sd(th, inode) ;
         reiserfs_end_persistent_transaction(th);
 	reiserfs_write_unlock(inode->i_sb);
     }
@@ -2507,6 +2610,68 @@
     return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
 			offset, nr_segs, reiserfs_get_blocks_direct_io, NULL);
 }
+
+int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
+    struct inode *inode = dentry->d_inode ;
+    int error ;
+    unsigned int ia_valid = attr->ia_valid;
+    reiserfs_write_lock(inode->i_sb);
+    if (attr->ia_valid & ATTR_SIZE) {
+	/* version 2 items will be caught by the s_maxbytes check
+	** done for us in vmtruncate
+	*/
+	if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5 &&
+	    attr->ia_size > MAX_NON_LFS) {
+	    error = -EFBIG ;
+	    goto out;
+	}
+	/* fill in hole pointers in the expanding truncate case. */
+        if (attr->ia_size > inode->i_size) {
+	    error = generic_cont_expand(inode, attr->ia_size) ;
+	    if (REISERFS_I(inode)->i_prealloc_count > 0) {
+		struct reiserfs_transaction_handle th ;
+		/* we're changing at most 2 bitmaps, inode + super */
+		journal_begin(&th, inode->i_sb, 4) ;
+		reiserfs_discard_prealloc (&th, inode);
+		journal_end(&th, inode->i_sb, 4) ;
+	    }
+	    if (error)
+	        goto out;
+	}
+    }
+
+    if ((((attr->ia_valid & ATTR_UID) && (attr->ia_uid & ~0xffff)) ||
+	 ((attr->ia_valid & ATTR_GID) && (attr->ia_gid & ~0xffff))) &&
+	(get_inode_sd_version (inode) == STAT_DATA_V1)) {
+		/* stat data of format v3.5 has 16 bit uid and gid */
+	    error = -EINVAL;
+	    goto out;
+	}
+
+    error = inode_change_ok(inode, attr) ;
+    if (!error) {
+	if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
+	    (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
+                error = reiserfs_chown_xattrs (inode, attr);
+
+                if (!error)
+                    error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
+        }
+        if (!error)
+            inode_setattr(inode, attr) ;
+    }
+
+
+    if (!error && reiserfs_posixacl (inode->i_sb)) {
+        if (attr->ia_valid & ATTR_MODE)
+            error = reiserfs_acl_chmod (inode);
+    }
+
+out:
+    reiserfs_write_unlock(inode->i_sb);
+    return error ;
+}
+
 
 
 struct address_space_operations reiserfs_address_space_operations = {
diff -Nru a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
--- a/fs/reiserfs/ioctl.c	Tue Jun 15 22:20:39 2004
+++ b/fs/reiserfs/ioctl.c	Tue Jun 15 22:20:39 2004
@@ -36,7 +36,7 @@
 	case REISERFS_IOC_GETFLAGS:
 		flags = REISERFS_I(inode) -> i_attrs;
 		i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags );
-		return put_user(flags, (int *) arg);
+		return put_user(flags, (int __user *) arg);
 	case REISERFS_IOC_SETFLAGS: {
 		if (IS_RDONLY(inode))
 			return -EROFS;
@@ -44,7 +44,7 @@
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
 
-		if (get_user(flags, (int *) arg))
+		if (get_user(flags, (int __user *) arg))
 			return -EFAULT;
 
 		if ( ( ( flags ^ REISERFS_I(inode) -> i_attrs) & ( REISERFS_IMMUTABLE_FL | REISERFS_APPEND_FL)) &&
@@ -66,13 +66,13 @@
 		return 0;
 	}
 	case REISERFS_IOC_GETVERSION:
-		return put_user(inode->i_generation, (int *) arg);
+		return put_user(inode->i_generation, (int __user *) arg);
 	case REISERFS_IOC_SETVERSION:
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
 		if (IS_RDONLY(inode))
 			return -EROFS;
-		if (get_user(inode->i_generation, (int *) arg))
+		if (get_user(inode->i_generation, (int __user *) arg))
 			return -EFAULT;	
 		inode->i_ctime = CURRENT_TIME;
 		mark_inode_dirty(inode);
diff -Nru a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c
--- a/fs/reiserfs/item_ops.c	Tue Jun 15 22:20:42 2004
+++ b/fs/reiserfs/item_ops.c	Tue Jun 15 22:20:42 2004
@@ -106,7 +106,7 @@
 
 static void sd_print_vi (struct virtual_item * vi)
 {
-    reiserfs_warning ("STATDATA, index %d, type 0x%x, %h\n", 
+    reiserfs_warning (NULL, "STATDATA, index %d, type 0x%x, %h",
 		      vi->vi_index, vi->vi_type, vi->vi_ih);
 }
 
@@ -209,7 +209,7 @@
 
 static void direct_print_vi (struct virtual_item * vi)
 {
-    reiserfs_warning ("DIRECT, index %d, type 0x%x, %h\n", 
+    reiserfs_warning (NULL, "DIRECT, index %d, type 0x%x, %h",
 		      vi->vi_index, vi->vi_type, vi->vi_ih);
 }
 
@@ -302,7 +302,7 @@
     unp = (__u32 *)item;
 
     if (ih_item_len(ih) % UNFM_P_SIZE)
-	printk ("indirect_print_item: invalid item len");  
+	reiserfs_warning (NULL, "indirect_print_item: invalid item len");
 
     printk ("%d pointers\n[ ", (int)I_UNFM_NUM (ih));
     for (j = 0; j < I_UNFM_NUM (ih); j ++) {
@@ -363,7 +363,7 @@
 
 static void indirect_print_vi (struct virtual_item * vi)
 {
-    reiserfs_warning ("INDIRECT, index %d, type 0x%x, %h\n", 
+    reiserfs_warning (NULL, "INDIRECT, index %d, type 0x%x, %h",
 		      vi->vi_index, vi->vi_type, vi->vi_ih);
 }
 
@@ -390,7 +390,7 @@
 
 static int direntry_bytes_number (struct item_head * ih, int block_size)
 {
-    reiserfs_warning ("vs-16090: direntry_bytes_number: "
+    reiserfs_warning (NULL, "vs-16090: direntry_bytes_number: "
 		      "bytes number is asked for direntry");
     return 0;
 }
@@ -582,8 +582,7 @@
     }
 
     if (entries == dir_u->entry_count) {
-	printk ("free spze %d, entry_count %d\n", free, dir_u->entry_count);
-	BUG ();
+	reiserfs_panic (NULL, "free space %d, entry_count %d\n", free, dir_u->entry_count);
     }
 
     /* "." and ".." can not be separated from each other */
@@ -653,7 +652,7 @@
     int i;
     struct direntry_uarea * dir_u = vi->vi_uarea;
 
-    reiserfs_warning ("DIRENTRY, index %d, type 0x%x, %h, flags 0x%x\n", 
+    reiserfs_warning (NULL, "DIRENTRY, index %d, type 0x%x, %h, flags 0x%x",
 		      vi->vi_index, vi->vi_type, vi->vi_ih, dir_u->flags);
     printk ("%d entries: ", dir_u->entry_count);
     for (i = 0; i < dir_u->entry_count; i ++)
@@ -682,32 +681,32 @@
 //
 static int errcatch_bytes_number (struct item_head * ih, int block_size)
 {
-    reiserfs_warning ("green-16001: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16001: Invalid item type observed, run fsck ASAP");
     return 0;
 }
 
 static void errcatch_decrement_key (struct cpu_key * key)
 {
-    reiserfs_warning ("green-16002: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16002: Invalid item type observed, run fsck ASAP");
 }
 
 
 static int errcatch_is_left_mergeable (struct key * key, unsigned long bsize)
 {
-    reiserfs_warning ("green-16003: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16003: Invalid item type observed, run fsck ASAP");
     return 0;
 }
 
 
 static void errcatch_print_item (struct item_head * ih, char * item)
 {
-    reiserfs_warning ("green-16004: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16004: Invalid item type observed, run fsck ASAP");
 }
 
 
 static void errcatch_check_item (struct item_head * ih, char * item)
 {
-    reiserfs_warning ("green-16005: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16005: Invalid item type observed, run fsck ASAP");
 }
 
 static int errcatch_create_vi (struct virtual_node * vn,
@@ -715,7 +714,7 @@
 			       int is_affected, 
 			       int insert_size)
 {
-    reiserfs_warning ("green-16006: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16006: Invalid item type observed, run fsck ASAP");
     return 0;	// We might return -1 here as well, but it won't help as create_virtual_node() from where
 		// this operation is called from is of return type void.
 }
@@ -723,32 +722,32 @@
 static int errcatch_check_left (struct virtual_item * vi, int free,
 				int start_skip, int end_skip)
 {
-    reiserfs_warning ("green-16007: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16007: Invalid item type observed, run fsck ASAP");
     return -1;
 }
 
 
 static int errcatch_check_right (struct virtual_item * vi, int free)
 {
-    reiserfs_warning ("green-16008: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16008: Invalid item type observed, run fsck ASAP");
     return -1;
 }
 
 static int errcatch_part_size (struct virtual_item * vi, int first, int count)
 {
-    reiserfs_warning ("green-16009: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16009: Invalid item type observed, run fsck ASAP");
     return 0;
 }
 
 static int errcatch_unit_num (struct virtual_item * vi)
 {
-    reiserfs_warning ("green-16010: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16010: Invalid item type observed, run fsck ASAP");
     return 0;
 }
 
 static void errcatch_print_vi (struct virtual_item * vi)
 {
-    reiserfs_warning ("green-16011: Invalid item type observed, run fsck ASAP\n");
+    reiserfs_warning (NULL, "green-16011: Invalid item type observed, run fsck ASAP");
 }
 
 struct item_operations errcatch_ops = {
diff -Nru a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
--- a/fs/reiserfs/journal.c	Tue Jun 15 22:20:41 2004
+++ b/fs/reiserfs/journal.c	Tue Jun 15 22:20:41 2004
@@ -271,7 +271,7 @@
     jb->journal_list = NULL ;
     jb->bitmaps = vmalloc( mem ) ;
     if (!jb->bitmaps) {
-      reiserfs_warning("clm-2000, unable to allocate bitmaps for journal lists\n") ;
+      reiserfs_warning(p_s_sb, "clm-2000, unable to allocate bitmaps for journal lists") ;
       failed = 1;   
       break ;
     }
@@ -345,7 +345,7 @@
 static struct reiserfs_journal_cnode *get_cnode(struct super_block *p_s_sb) {
   struct reiserfs_journal_cnode *cn ;
 
-  reiserfs_check_lock_depth("get_cnode") ;
+  reiserfs_check_lock_depth(p_s_sb, "get_cnode") ;
 
   if (SB_JOURNAL(p_s_sb)->j_cnode_free <= 0) {
     return NULL ;
@@ -369,7 +369,7 @@
 */
 static void free_cnode(struct super_block *p_s_sb, struct reiserfs_journal_cnode *cn) {
 
-  reiserfs_check_lock_depth("free_cnode") ;
+  reiserfs_check_lock_depth(p_s_sb, "free_cnode") ;
 
   SB_JOURNAL(p_s_sb)->j_cnode_used-- ;
   SB_JOURNAL(p_s_sb)->j_cnode_free++ ;
@@ -422,11 +422,10 @@
 /* utility function to force a BUG if it is called without the big
 ** kernel lock held.  caller is the string printed just before calling BUG()
 */
-void reiserfs_check_lock_depth(char *caller) {
+void reiserfs_check_lock_depth(struct super_block *sb, char *caller) {
 #ifdef CONFIG_SMP
   if (current->lock_depth < 0) {
-    printk("%s called without kernel lock held\n", caller) ;
-    BUG() ;
+    reiserfs_panic (sb, "%s called without kernel lock held", caller) ;
   }
 #else
   ;
@@ -559,9 +558,8 @@
                                    struct reiserfs_journal_list *jl)
 {
     if (jl->j_refcount < 1) {
-        printk("trans id %lu, refcount at %d\n", jl->j_trans_id,
+        reiserfs_panic (s, "trans id %lu, refcount at %d", jl->j_trans_id,
 	                                         jl->j_refcount);
-        BUG();
     }
     if (--jl->j_refcount == 0)
         reiserfs_kfree(jl, sizeof(struct reiserfs_journal_list), s);
@@ -601,7 +599,7 @@
     char b[BDEVNAME_SIZE];
 
     if (buffer_journaled(bh)) {
-        reiserfs_warning("clm-2084: pinned buffer %lu:%s sent to disk\n",
+        reiserfs_warning(NULL, "clm-2084: pinned buffer %lu:%s sent to disk",
 	                 bh->b_blocknr, bdevname(bh->b_bdev, b)) ;
     }
     if (uptodate)
@@ -912,7 +910,7 @@
   struct buffer_head *tbh = NULL ;
   unsigned long trans_id = jl->j_trans_id;
 
-  reiserfs_check_lock_depth("flush_commit_list") ;
+  reiserfs_check_lock_depth(s, "flush_commit_list") ;
 
   if (atomic_read(&jl->j_older_commits_done)) {
     return 0 ;
@@ -1007,7 +1005,7 @@
   bforget(jl->j_commit_bh) ;
   if (SB_JOURNAL(s)->j_last_commit_id != 0 &&
      (jl->j_trans_id - SB_JOURNAL(s)->j_last_commit_id) != 1) {
-      reiserfs_warning("clm-2200: last commit %lu, current %lu\n",
+      reiserfs_warning(s, "clm-2200: last commit %lu, current %lu",
                        SB_JOURNAL(s)->j_last_commit_id,
 		       jl->j_trans_id);
   }
@@ -1066,8 +1064,8 @@
   while(cn) {
     if (cn->blocknr != 0) {
       if (debug) {
-        printk("block %u, bh is %d, state %ld\n", cn->blocknr, cn->bh ? 1: 0,
-	        cn->state) ;
+       reiserfs_warning (p_s_sb, "block %u, bh is %d, state %ld", cn->blocknr,
+                         cn->bh ? 1: 0, cn->state) ;
       }
       cn->state = 0 ;
       remove_journal_hash(p_s_sb, SB_JOURNAL(p_s_sb)->j_list_hash_table, jl, cn->blocknr, 1) ;
@@ -1104,7 +1102,7 @@
     set_buffer_dirty(SB_JOURNAL(p_s_sb)->j_header_bh) ;
     sync_dirty_buffer(SB_JOURNAL(p_s_sb)->j_header_bh) ;
     if (!buffer_uptodate(SB_JOURNAL(p_s_sb)->j_header_bh)) {
-      printk( "reiserfs: journal-837: IO error during journal replay\n" );
+      reiserfs_warning (p_s_sb, "journal-837: IO error during journal replay");
       return -EIO ;
     }
   }
@@ -1178,7 +1176,7 @@
   }
 
   if (atomic_read(&SB_JOURNAL(s)->j_wcount) != 0) {
-    reiserfs_warning("clm-2048: flush_journal_list called with wcount %d\n",
+    reiserfs_warning(s, "clm-2048: flush_journal_list called with wcount %d",
                       atomic_read(&SB_JOURNAL(s)->j_wcount)) ;
   }
   if (jl->j_trans_id == 0)
@@ -1277,8 +1275,10 @@
     ** is not marked JDirty_wait
     */
     if ((!was_jwait) && !buffer_locked(saved_bh)) {
-printk("journal-813: BAD! buffer %llu %cdirty %cjwait, not in a newer tranasction\n", (unsigned long long)saved_bh->b_blocknr,
-        was_dirty ? ' ' : '!', was_jwait ? ' ' : '!') ;
+	reiserfs_warning (s, "journal-813: BAD! buffer %llu %cdirty %cjwait, "
+			  "not in a newer tranasction",
+			  (unsigned long long)saved_bh->b_blocknr,
+			  was_dirty ? ' ' : '!', was_jwait ? ' ' : '!') ;
     }
     if (was_dirty) { 
       /* we inc again because saved_bh gets decremented at free_cnode */
@@ -1293,8 +1293,8 @@
         unlock_buffer(saved_bh);
       count++ ;
     } else {
-      printk("clm-2082: Unable to flush buffer %llu in flush_journal_list\n",
-              (unsigned long long)saved_bh->b_blocknr) ;
+      reiserfs_warning (s, "clm-2082: Unable to flush buffer %llu in %s",
+                        (unsigned long long)saved_bh->b_blocknr, __FUNCTION__);
     }
 free_cnode:
     last = cn ;
@@ -1303,7 +1303,7 @@
       /* we incremented this to keep others from taking the buffer head away */
       put_bh(saved_bh) ;
       if (atomic_read(&(saved_bh->b_count)) < 0) {
-        printk("journal-945: saved_bh->b_count < 0") ;
+        reiserfs_warning (s, "journal-945: saved_bh->b_count < 0");
       }
     }
   }
@@ -1363,7 +1363,7 @@
 
   if (SB_JOURNAL(s)->j_last_flush_id != 0 &&
      (jl->j_trans_id - SB_JOURNAL(s)->j_last_flush_id) != 1) {
-      reiserfs_warning("clm-2201: last flush %lu, current %lu\n",
+      reiserfs_warning(s, "clm-2201: last flush %lu, current %lu",
                        SB_JOURNAL(s)->j_last_flush_id,
 		       jl->j_trans_id);
   }
@@ -1712,19 +1712,19 @@
     if (oldest_invalid_trans_id && *oldest_invalid_trans_id && get_desc_trans_id(desc) > *oldest_invalid_trans_id) {
       reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-986: transaction "
 	              "is valid returning because trans_id %d is greater than "
-		      "oldest_invalid %lu\n", get_desc_trans_id(desc), 
+		      "oldest_invalid %lu", get_desc_trans_id(desc),
 		       *oldest_invalid_trans_id);
       return 0 ;
     }
     if (newest_mount_id && *newest_mount_id > get_desc_mount_id (desc)) {
       reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1087: transaction "
                      "is valid returning because mount_id %d is less than "
-		     "newest_mount_id %lu\n", get_desc_mount_id (desc), 
+		     "newest_mount_id %lu", get_desc_mount_id (desc),
 		     *newest_mount_id) ;
       return -1 ;
     }
     if ( get_desc_trans_len(desc) > SB_JOURNAL_TRANS_MAX(p_s_sb) ) {
-      reiserfs_warning("journal-2018: Bad transaction length %d encountered, ignoring transaction\n", get_desc_trans_len(desc));
+      reiserfs_warning(p_s_sb, "journal-2018: Bad transaction length %d encountered, ignoring transaction", get_desc_trans_len(desc));
       return -1 ;
     }
     offset = d_bh->b_blocknr - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) ;
@@ -1738,7 +1738,7 @@
     if (journal_compare_desc_commit(p_s_sb, desc, commit)) {
       reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, 
                      "journal_transaction_is_valid, commit offset %ld had bad "
-		     "time %d or length %d\n", 
+		     "time %d or length %d",
 		     c_bh->b_blocknr -  SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb),
 		     get_commit_trans_id (commit), 
 		     get_commit_trans_len(commit));
@@ -1746,14 +1746,14 @@
       if (oldest_invalid_trans_id) {
 	*oldest_invalid_trans_id = get_desc_trans_id(desc) ;
 	reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1004: "
-	               "transaction_is_valid setting oldest invalid trans_id "
-		       "to %d\n", get_desc_trans_id(desc)) ;
+		       "transaction_is_valid setting oldest invalid trans_id "
+		       "to %d", get_desc_trans_id(desc)) ;
       }
       return -1; 
     }
     brelse(c_bh) ;
     reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1006: found valid "
-                   "transaction start offset %llu, len %d id %d\n",
+                   "transaction start offset %llu, len %d id %d",
 		   d_bh->b_blocknr - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb), 
 		   get_desc_trans_len(desc), get_desc_trans_id(desc)) ;
     return 1 ;
@@ -1793,12 +1793,12 @@
   desc = (struct reiserfs_journal_desc *)d_bh->b_data ;
   trans_offset = d_bh->b_blocknr - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) ;
   reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1037: "
-                 "journal_read_transaction, offset %llu, len %d mount_id %d\n",
+                 "journal_read_transaction, offset %llu, len %d mount_id %d",
 		 d_bh->b_blocknr - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb), 
 		 get_desc_trans_len(desc), get_desc_mount_id(desc)) ;
   if (get_desc_trans_id(desc) < oldest_trans_id) {
     reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1039: "
-                   "journal_read_trans skipping because %lu is too old\n", 
+                   "journal_read_trans skipping because %lu is too old",
 		   cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb)) ;
     brelse(d_bh) ;
     return 1 ;
@@ -1806,7 +1806,7 @@
   if (get_desc_mount_id(desc) != newest_mount_id) {
     reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1146: "
                    "journal_read_trans skipping because %d is != "
-		   "newest_mount_id %lu\n", get_desc_mount_id(desc), 
+		   "newest_mount_id %lu", get_desc_mount_id(desc),
 		    newest_mount_id) ;
     brelse(d_bh) ;
     return 1 ;
@@ -1821,7 +1821,7 @@
   commit = (struct reiserfs_journal_commit *)c_bh->b_data ;
   if (journal_compare_desc_commit(p_s_sb, desc, commit)) {
     reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal_read_transaction, "
-                   "commit offset %llu had bad time %d or length %d\n",
+                   "commit offset %llu had bad time %d or length %d",
 		   c_bh->b_blocknr -  SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb), 
 		   get_commit_trans_id(commit), get_commit_trans_len(commit));
     brelse(c_bh) ;
@@ -1837,7 +1837,7 @@
     brelse(d_bh) ;
     reiserfs_kfree(log_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
     reiserfs_kfree(real_blocks, get_desc_trans_len(desc) * sizeof(struct buffer_head *), p_s_sb) ;
-    reiserfs_warning("journal-1169: kmalloc failed, unable to mount FS\n") ;
+    reiserfs_warning(p_s_sb, "journal-1169: kmalloc failed, unable to mount FS") ;
     return -1 ;
   }
   /* get all the buffer heads */
@@ -1850,12 +1850,12 @@
       real_blocks[i] = sb_getblk(p_s_sb, le32_to_cpu(commit->j_realblock[i - trans_half])) ;
     }
     if ( real_blocks[i]->b_blocknr > SB_BLOCK_COUNT(p_s_sb) ) {
-      reiserfs_warning("journal-1207: REPLAY FAILURE fsck required! Block to replay is outside of filesystem\n");
+      reiserfs_warning(p_s_sb, "journal-1207: REPLAY FAILURE fsck required! Block to replay is outside of filesystem");
       goto abort_replay;
     }
     /* make sure we don't try to replay onto log or reserved area */
     if (is_block_in_log_or_reserved_area(p_s_sb, real_blocks[i]->b_blocknr)) {
-      reiserfs_warning("journal-1204: REPLAY FAILURE fsck required! Trying to replay onto a log block\n") ;
+      reiserfs_warning(p_s_sb, "journal-1204: REPLAY FAILURE fsck required! Trying to replay onto a log block") ;
 abort_replay:
       brelse_array(log_blocks, i) ;
       brelse_array(real_blocks, i) ;
@@ -1871,7 +1871,7 @@
   for (i = 0 ; i < get_desc_trans_len(desc) ; i++) {
     wait_on_buffer(log_blocks[i]) ;
     if (!buffer_uptodate(log_blocks[i])) {
-      reiserfs_warning("journal-1212: REPLAY FAILURE fsck required! buffer write failed\n") ;
+      reiserfs_warning(p_s_sb, "journal-1212: REPLAY FAILURE fsck required! buffer write failed") ;
       brelse_array(log_blocks + i, get_desc_trans_len(desc) - i) ;
       brelse_array(real_blocks, get_desc_trans_len(desc)) ;
       brelse(c_bh) ;
@@ -1892,7 +1892,7 @@
   for (i = 0 ; i < get_desc_trans_len(desc) ; i++) {
     wait_on_buffer(real_blocks[i]) ; 
     if (!buffer_uptodate(real_blocks[i])) {
-      reiserfs_warning("journal-1226: REPLAY FAILURE, fsck required! buffer write failed\n") ;
+      reiserfs_warning(p_s_sb, "journal-1226: REPLAY FAILURE, fsck required! buffer write failed") ;
       brelse_array(real_blocks + i, get_desc_trans_len(desc) - i) ;
       brelse(c_bh) ;
       brelse(d_bh) ;
@@ -1904,7 +1904,7 @@
   }
   cur_dblock =  SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) + ((trans_offset + get_desc_trans_len(desc) + 2) % SB_ONDISK_JOURNAL_SIZE(p_s_sb)) ;
   reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1095: setting journal "
-                 "start to offset %ld\n", 
+                 "start to offset %ld",
 		 cur_dblock -  SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb)) ;
   
   /* init starting values for the first transaction, in case this is the last transaction to be replayed. */
@@ -1986,9 +1986,8 @@
   char b[BDEVNAME_SIZE];
 
   cur_dblock = SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) ;
-  printk("reiserfs: checking transaction log (%s) for (%s)\n",
-	 bdevname(SB_JOURNAL(p_s_sb)->j_dev_bd, b),
-	 reiserfs_bdevname(p_s_sb));
+  reiserfs_info (p_s_sb, "checking transaction log (%s)\n",
+	 bdevname(SB_JOURNAL(p_s_sb)->j_dev_bd, b));
   start = get_seconds();
 
   /* step 1, read in the journal header block.  Check the transaction it says 
@@ -2011,7 +2010,7 @@
     newest_mount_id = le32_to_cpu(jh->j_mount_id);
     reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1153: found in "
                    "header: first_unflushed_offset %d, last_flushed_trans_id "
-		   "%lu\n", le32_to_cpu(jh->j_first_unflushed_offset), 
+		   "%lu", le32_to_cpu(jh->j_first_unflushed_offset),
 		   le32_to_cpu(jh->j_last_flush_trans_id)) ;
     valid_journal_header = 1 ;
 
@@ -2029,7 +2028,8 @@
   }
 
   if (continue_replay && bdev_read_only(p_s_sb->s_bdev)) {
-    printk("clm-2076: device is readonly, unable to replay log\n") ;
+    reiserfs_warning (p_s_sb,
+		      "clm-2076: device is readonly, unable to replay log") ;
     return -1 ;
   }
 
@@ -2049,7 +2049,7 @@
 	oldest_start = d_bh->b_blocknr ;
 	newest_mount_id = get_desc_mount_id(desc) ;
 	reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1179: Setting "
-	               "oldest_start to offset %llu, trans_id %lu\n",
+	               "oldest_start to offset %llu, trans_id %lu",
 		       oldest_start - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb), 
 		       oldest_trans_id) ;
       } else if (oldest_trans_id > get_desc_trans_id(desc)) { 
@@ -2057,14 +2057,14 @@
         oldest_trans_id = get_desc_trans_id(desc) ;
 	oldest_start = d_bh->b_blocknr ;
 	reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1180: Resetting "
-	               "oldest_start to offset %lu, trans_id %lu\n", 
+	               "oldest_start to offset %lu, trans_id %lu",
 			oldest_start - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb), 
 			oldest_trans_id) ;
       }
       if (newest_mount_id < get_desc_mount_id(desc)) {
         newest_mount_id = get_desc_mount_id(desc) ;
 	reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1299: Setting "
-	              "newest_mount_id to %d\n", get_desc_mount_id(desc));
+	              "newest_mount_id to %d", get_desc_mount_id(desc));
       }
       cur_dblock += get_desc_trans_len(desc) + 2 ;
     } else {
@@ -2077,7 +2077,7 @@
   cur_dblock = oldest_start ;
   if (oldest_trans_id)  {
     reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1206: Starting replay "
-                   "from offset %llu, trans_id %lu\n",
+                   "from offset %llu, trans_id %lu",
 		   cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb), 
 		   oldest_trans_id) ;
 
@@ -2098,7 +2098,7 @@
 
   if (oldest_trans_id == 0) {
     reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1225: No valid "
-                   "transactions found\n") ;
+                   "transactions found") ;
   }
   /* j_start does not get set correctly if we don't replay any transactions.
   ** if we had a valid journal_header, set j_start to the first unflushed transaction value,
@@ -2113,11 +2113,11 @@
     SB_JOURNAL(p_s_sb)->j_mount_id = newest_mount_id + 1 ;
   }
   reiserfs_debug(p_s_sb, REISERFS_DEBUG_CODE, "journal-1299: Setting "
-                 "newest_mount_id to %lu\n", SB_JOURNAL(p_s_sb)->j_mount_id) ;
+                 "newest_mount_id to %lu", SB_JOURNAL(p_s_sb)->j_mount_id) ;
   SB_JOURNAL(p_s_sb)->j_first_unflushed_offset = SB_JOURNAL(p_s_sb)->j_start ; 
   if (replay_count > 0) {
-    printk("reiserfs: replayed %d transactions in %lu seconds\n", replay_count, 
-	    get_seconds() - start) ;
+    reiserfs_info (p_s_sb, "replayed %d transactions in %lu seconds\n",
+		   replay_count, get_seconds() - start) ;
   }
   if (!bdev_read_only(p_s_sb->s_bdev) && 
        _update_journal_header_block(p_s_sb, SB_JOURNAL(p_s_sb)->j_start, 
@@ -2172,7 +2172,7 @@
     }
 
     if( result != 0 ) {
-	reiserfs_warning("sh-457: release_journal_dev: Cannot release journal device: %i\n", result );
+	reiserfs_warning(super, "sh-457: release_journal_dev: Cannot release journal device: %i", result );
     }
     return result;
 }
@@ -2202,8 +2202,9 @@
 		if (IS_ERR(journal->j_dev_bd)) {
 			result = PTR_ERR(journal->j_dev_bd);
 			journal->j_dev_bd = NULL;
-			printk( "sh-458: journal_init_dev: cannot init journal device\n '%s': %i", 
-				__bdevname(jdev, b), result );
+			reiserfs_warning (super, "sh-458: journal_init_dev: "
+					  "cannot init journal device '%s': %i",
+					  __bdevname(jdev, b), result );
 			return result;
 		} else if (jdev != super->s_dev)
 			set_blocksize(journal->j_dev_bd, super->s_blocksize);
@@ -2214,7 +2215,8 @@
 	if( !IS_ERR( journal -> j_dev_file ) ) {
 		struct inode *jdev_inode = journal->j_dev_file->f_mapping->host;
 		if( !S_ISBLK( jdev_inode -> i_mode ) ) {
-			printk( "journal_init_dev: '%s' is not a block device\n", jdev_name );
+			reiserfs_warning  (super, "journal_init_dev: '%s' is "
+					   "not a block device", jdev_name );
 			result = -ENOTBLK;
 		} else  {
 			/* ok */
@@ -2224,12 +2226,14 @@
 	} else {
 		result = PTR_ERR( journal -> j_dev_file );
 		journal -> j_dev_file = NULL;
-		printk( "journal_init_dev: Cannot open '%s': %i\n", jdev_name, result );
+		reiserfs_warning (super,
+				  "journal_init_dev: Cannot open '%s': %i",
+				  jdev_name, result );
 	}
 	if( result != 0 ) {
 		release_journal_dev( super, journal );
 	}
-	printk( "journal_init_dev: journal device: %s\n",
+	reiserfs_info(super, "journal_init_dev: journal device: %s\n",
 		bdevname(journal->j_dev_bd, b));
 	return result;
 }
@@ -2248,7 +2252,7 @@
 
     journal = SB_JOURNAL(p_s_sb) = vmalloc(sizeof (struct reiserfs_journal)) ;
     if (!journal) {
-	printk("journal-1256: unable to get memory for journal structure\n") ;
+	reiserfs_warning (p_s_sb, "journal-1256: unable to get memory for journal structure") ;
 	return 1 ;
     }
     memset(journal, 0, sizeof(struct reiserfs_journal)) ;
@@ -2256,8 +2260,10 @@
     INIT_LIST_HEAD (&SB_JOURNAL(p_s_sb)->j_prealloc_list);
     INIT_LIST_HEAD(&SB_JOURNAL(p_s_sb)->j_working_list);
     INIT_LIST_HEAD(&SB_JOURNAL(p_s_sb)->j_journal_list);
-    reiserfs_allocate_list_bitmaps(p_s_sb, SB_JOURNAL(p_s_sb)->j_list_bitmap, 
- 				   SB_BMAP_NR(p_s_sb)) ;
+    if (reiserfs_allocate_list_bitmaps(p_s_sb,
+				       SB_JOURNAL(p_s_sb)->j_list_bitmap,
+ 				       SB_BMAP_NR(p_s_sb)))
+	goto free_and_return ;
     allocate_bitmap_nodes(p_s_sb) ;
 
     /* reserved for journal area support */
@@ -2270,14 +2276,16 @@
        (actual for small blocksizes) */
     if ( !SB_ONDISK_JOURNAL_DEVICE( p_s_sb ) &&
          (SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb) + SB_ONDISK_JOURNAL_SIZE(p_s_sb) > p_s_sb->s_blocksize * 8) ) {
-	printk("journal-1393: journal does not fit for area addressed by first of bitmap blocks. "
-	       "It starts at %u and its size is %u. Block size %ld\n",
-		SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb), SB_ONDISK_JOURNAL_SIZE(p_s_sb), p_s_sb->s_blocksize) ;
+	reiserfs_warning (p_s_sb, "journal-1393: journal does not fit for area "
+			  "addressed by first of bitmap blocks. It starts at "
+			  "%u and its size is %u. Block size %ld",
+			  SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb),
+			  SB_ONDISK_JOURNAL_SIZE(p_s_sb), p_s_sb->s_blocksize);
 	goto free_and_return;
     }
 
     if( journal_init_dev( p_s_sb, journal, j_dev_name ) != 0 ) {
-      printk( "sh-462: unable to initialize jornal device\n");
+      reiserfs_warning (p_s_sb, "sh-462: unable to initialize jornal device");
       goto free_and_return;
     }
 
@@ -2287,18 +2295,19 @@
      bhjh = journal_bread(p_s_sb,
 		   SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) + SB_ONDISK_JOURNAL_SIZE(p_s_sb));
      if (!bhjh) {
-	 printk("sh-459: unable to read  journal header\n") ;
+	 reiserfs_warning (p_s_sb, "sh-459: unable to read journal header");
 	 goto free_and_return;
      }
      jh = (struct reiserfs_journal_header *)(bhjh->b_data);
      
      /* make sure that journal matches to the super block */
      if (is_reiserfs_jr(rs) && (jh->jh_journal.jp_journal_magic != sb_jp_journal_magic(rs))) {
-	 printk("sh-460: journal header magic %x (device %s) does not match "
-		"to magic found in super block %x (device %s)\n",
-		jh->jh_journal.jp_journal_magic,
-		bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd, b),
-		sb_jp_journal_magic(rs), reiserfs_bdevname (p_s_sb));
+	 reiserfs_warning (p_s_sb, "sh-460: journal header magic %x "
+			   "(device %s) does not match to magic found in super "
+			   "block %x",
+			   jh->jh_journal.jp_journal_magic,
+			   bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd, b),
+			   sb_jp_journal_magic(rs));
 	 brelse (bhjh);
 	 goto free_and_return;
   }
@@ -2324,7 +2333,7 @@
       SB_JOURNAL_TRANS_MAX(p_s_sb) = JOURNAL_TRANS_MIN_DEFAULT / ratio;
     
     if (SB_JOURNAL_TRANS_MAX(p_s_sb) != initial)
-      printk ("sh-461: journal_init: wrong transaction max size (%u). Changed to %u\n",
+      reiserfs_warning (p_s_sb, "sh-461: journal_init: wrong transaction max size (%u). Changed to %u",
 	      initial, SB_JOURNAL_TRANS_MAX(p_s_sb));
 
     SB_JOURNAL_MAX_BATCH(p_s_sb) = SB_JOURNAL_TRANS_MAX(p_s_sb)*
@@ -2353,16 +2362,16 @@
       SB_JOURNAL_MAX_TRANS_AGE(p_s_sb) = commit_max_age;
   }
 
-  printk ("Reiserfs journal params: device %s, size %u, "
-	  "journal first block %u, max trans len %u, max batch %u, "
-	  "max commit age %u, max trans age %u\n",
-	  bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd, b),
-	  SB_ONDISK_JOURNAL_SIZE(p_s_sb),
-	  SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb),
-	  SB_JOURNAL_TRANS_MAX(p_s_sb),
-	  SB_JOURNAL_MAX_BATCH(p_s_sb),
-	  SB_JOURNAL_MAX_COMMIT_AGE(p_s_sb),
-	  SB_JOURNAL_MAX_TRANS_AGE(p_s_sb));
+  reiserfs_info (p_s_sb, "journal params: device %s, size %u, "
+		 "journal first block %u, max trans len %u, max batch %u, "
+		 "max commit age %u, max trans age %u\n",
+		 bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd, b),
+		 SB_ONDISK_JOURNAL_SIZE(p_s_sb),
+		 SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb),
+		 SB_JOURNAL_TRANS_MAX(p_s_sb),
+		 SB_JOURNAL_MAX_BATCH(p_s_sb),
+		 SB_JOURNAL_MAX_COMMIT_AGE(p_s_sb),
+		 SB_JOURNAL_MAX_TRANS_AGE(p_s_sb));
 
   brelse (bhjh);
      
@@ -2401,11 +2410,11 @@
   jl = SB_JOURNAL(p_s_sb)->j_current_jl;
   jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl);
   if (!jl->j_list_bitmap) {
-    reiserfs_warning("journal-2005, get_list_bitmap failed for journal list 0\n") ;
+    reiserfs_warning(p_s_sb, "journal-2005, get_list_bitmap failed for journal list 0") ;
     goto free_and_return;
   }
   if (journal_read(p_s_sb) < 0) {
-    reiserfs_warning("Replay Failure, unable to mount\n") ;
+    reiserfs_warning(p_s_sb, "Replay Failure, unable to mount") ;
     goto free_and_return;
   }
 
@@ -2522,7 +2531,7 @@
   struct reiserfs_transaction_handle myth;
   int sched_count = 0;
 
-  reiserfs_check_lock_depth("journal_begin") ;
+  reiserfs_check_lock_depth(p_s_sb, "journal_begin") ;
   RFALSE( p_s_sb->s_flags & MS_RDONLY, 
 	  "clm-2078: calling journal_begin on readonly FS") ;
 
@@ -2664,14 +2673,14 @@
 	      cur_th->t_refcount++ ;
 	      memcpy(th, cur_th, sizeof(*th));
 	      if (th->t_refcount <= 1)
-		      printk("BAD: refcount <= 1, but journal_info != 0\n");
+		      reiserfs_warning (p_s_sb, "BAD: refcount <= 1, but journal_info != 0");
 	      return 0;
 	} else {
 	    /* we've ended up with a handle from a different filesystem.
 	    ** save it and restore on journal_end.  This should never
 	    ** really happen...
 	    */
-	    reiserfs_warning("clm-2100: nesting info a different FS\n") ;
+	    reiserfs_warning(p_s_sb, "clm-2100: nesting info a different FS") ;
 	    th->t_handle_save = current->journal_info ;
 	    current->journal_info = th;
 	}
@@ -2718,14 +2727,16 @@
   ** could get to disk too early.  NOT GOOD.
   */
   if (!prepared || buffer_dirty(bh)) {
-    printk("journal-1777: buffer %llu bad state %cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT\n", (unsigned long long)bh->b_blocknr, prepared ? ' ' : '!', 
-                            buffer_locked(bh) ? ' ' : '!',
+    reiserfs_warning (p_s_sb, "journal-1777: buffer %llu bad state "
+		      "%cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT",
+		      (unsigned long long)bh->b_blocknr, prepared ? ' ' : '!',
+			    buffer_locked(bh) ? ' ' : '!',
 			    buffer_dirty(bh) ? ' ' : '!',
 			    buffer_journal_dirty(bh) ? ' ' : '!') ;
   }
 
   if (atomic_read(&(SB_JOURNAL(p_s_sb)->j_wcount)) <= 0) {
-    printk("journal-1409: journal_mark_dirty returning because j_wcount was %d\n", atomic_read(&(SB_JOURNAL(p_s_sb)->j_wcount))) ;
+    reiserfs_warning (p_s_sb, "journal-1409: journal_mark_dirty returning because j_wcount was %d", atomic_read(&(SB_JOURNAL(p_s_sb)->j_wcount))) ;
     return 1 ;
   }
   /* this error means I've screwed up, and we've overflowed the transaction.  
@@ -2785,7 +2796,8 @@
 
 int journal_end(struct reiserfs_transaction_handle *th, struct super_block *p_s_sb, unsigned long nblocks) {
   if (!current->journal_info && th->t_refcount > 1)
-    printk("REISER-NESTING: th NULL, refcount %d\n", th->t_refcount);
+    reiserfs_warning (p_s_sb, "REISER-NESTING: th NULL, refcount %d",
+                      th->t_refcount);
 
   th->t_refcount--;
   if (th->t_refcount > 0) {
@@ -2844,7 +2856,7 @@
     mark_buffer_notjournal_dirty(bh) ; 
     put_bh(bh) ;
     if (atomic_read(&(bh->b_count)) < 0) {
-      printk("journal-1752: remove from trans, b_count < 0\n") ;
+      reiserfs_warning (p_s_sb, "journal-1752: remove from trans, b_count < 0");
     }
     ret = 1 ;
   }
@@ -3142,7 +3154,7 @@
 	    cleaned = 1 ;
 	    put_bh(cn->bh) ;
 	    if (atomic_read(&(cn->bh->b_count)) < 0) {
-	      printk("journal-2138: cn->bh->b_count < 0\n") ;
+	      reiserfs_warning (p_s_sb, "journal-2138: cn->bh->b_count < 0");
 	    }
 	  }
 	  if (cn->jlist) { /* since we are clearing the bh, we MUST dec nonzerolen */
@@ -3158,7 +3170,7 @@
   if (bh) {
     put_bh(bh) ; /* get_hash grabs the buffer */
     if (atomic_read(&(bh->b_count)) < 0) {
-      printk("journal-2165: bh->b_count < 0\n") ;
+      reiserfs_warning (p_s_sb, "journal-2165: bh->b_count < 0");
     }
   }
   return 0 ;
@@ -3318,7 +3330,7 @@
     BUG() ;
 
   current->journal_info = th->t_handle_save;
-  reiserfs_check_lock_depth("journal end");
+  reiserfs_check_lock_depth(p_s_sb, "journal end");
   if (SB_JOURNAL(p_s_sb)->j_len == 0) {
       reiserfs_prepare_for_journal(p_s_sb, SB_BUFFER_WITH_SB(p_s_sb), 1) ;
       journal_mark_dirty(th, p_s_sb, SB_BUFFER_WITH_SB(p_s_sb)) ;
@@ -3480,7 +3492,7 @@
       clear_bit(BH_JDirty, &(cn->bh->b_state)) ;
     } else {
       /* JDirty cleared sometime during transaction.  don't log this one */
-      reiserfs_warning("journal-2048: do_journal_end: BAD, buffer in journal hash, but not JDirty!\n") ;
+      reiserfs_warning(p_s_sb, "journal-2048: do_journal_end: BAD, buffer in journal hash, but not JDirty!") ;
       brelse(cn->bh) ;
     }
     next = cn->next ;
@@ -3612,7 +3624,7 @@
 	  flush_commit_list(p_s_sb, jl, 1) ;
   }
 out:
-  reiserfs_check_lock_depth("journal end2");
+  reiserfs_check_lock_depth(p_s_sb, "journal end2");
   th->t_trans_id = 0;
   return 0 ;
 }
diff -Nru a/fs/reiserfs/lbalance.c b/fs/reiserfs/lbalance.c
--- a/fs/reiserfs/lbalance.c	Tue Jun 15 22:21:05 2004
+++ b/fs/reiserfs/lbalance.c	Tue Jun 15 22:21:05 2004
@@ -1210,10 +1210,10 @@
       prev = (i != 0) ? deh_location( &(deh[i - 1]) ) : 0;
       
       if (prev && prev <= deh_location( &(deh[i])))
-	reiserfs_warning ("vs-10240: leaf_paste_entries: directory item (%h) corrupted (prev %a, cur(%d) %a)\n", 
+	reiserfs_warning (NULL, "vs-10240: leaf_paste_entries: directory item (%h) corrupted (prev %a, cur(%d) %a)",
 			  ih, deh + i - 1, i, deh + i);
       if (next && next >= deh_location( &(deh[i])))
-	reiserfs_warning ("vs-10250: leaf_paste_entries: directory item (%h) corrupted (cur(%d) %a, next %a)\n",
+	reiserfs_warning (NULL, "vs-10250: leaf_paste_entries: directory item (%h) corrupted (cur(%d) %a, next %a)",
 			  ih, i, deh + i, deh + i + 1);
     }
   }
diff -Nru a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
--- a/fs/reiserfs/namei.c	Tue Jun 15 22:20:41 2004
+++ b/fs/reiserfs/namei.c	Tue Jun 15 22:20:41 2004
@@ -15,7 +15,10 @@
 #include <linux/time.h>
 #include <linux/bitops.h>
 #include <linux/reiserfs_fs.h>
+#include <linux/reiserfs_acl.h>
+#include <linux/reiserfs_xattr.h>
 #include <linux/smp_lock.h>
+#include <linux/quotaops.h>
 
 #define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { i->i_nlink++; if (i->i_nlink >= REISERFS_LINK_MAX) i->i_nlink=1; }
 #define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) i->i_nlink--;
@@ -123,7 +126,7 @@
     switch (retval) {
     case ITEM_NOT_FOUND:
 	if (!PATH_LAST_POSITION (path)) {
-	    reiserfs_warning ("vs-7000: search_by_entry_key: search_by_key returned item position == 0");
+	    reiserfs_warning (sb, "vs-7000: search_by_entry_key: search_by_key returned item position == 0");
 	    pathrelse(path) ;
 	    return IO_ERROR ;
 	}
@@ -137,7 +140,7 @@
 
     default:
 	pathrelse (path);
-	reiserfs_warning ("vs-7002: search_by_entry_key: no path to here");
+	reiserfs_warning (sb, "vs-7002: search_by_entry_key: no path to here");
 	return IO_ERROR;
     }
 
@@ -296,7 +299,8 @@
     while (1) {
 	retval = search_by_entry_key (dir->i_sb, &key_to_search, path_to_entry, de);
 	if (retval == IO_ERROR) {
-	    reiserfs_warning ("zam-7001: io error in %s\n", __FUNCTION__);
+	    reiserfs_warning (dir->i_sb, "zam-7001: io error in %s",
+			      __FUNCTION__);
 	    return IO_ERROR;
 	}
 
@@ -331,11 +335,24 @@
     retval = reiserfs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &path_to_entry, &de);
     pathrelse (&path_to_entry);
     if (retval == NAME_FOUND) {
+        /* Hide the .reiserfs_priv directory */
+	if (reiserfs_xattrs (dir->i_sb) &&
+	    !old_format_only(dir->i_sb) &&
+            REISERFS_SB(dir->i_sb)->priv_root &&
+            REISERFS_SB(dir->i_sb)->priv_root->d_inode &&
+	    de.de_objectid == le32_to_cpu (INODE_PKEY(REISERFS_SB(dir->i_sb)->priv_root->d_inode)->k_objectid)) {
+	  return ERR_PTR (-EACCES);
+	}
+
 	inode = reiserfs_iget (dir->i_sb, (struct cpu_key *)&(de.de_dir_id));
 	if (!inode || IS_ERR(inode)) {
 	    reiserfs_write_unlock(dir->i_sb);
 	    return ERR_PTR(-EACCES);
         }
+
+	/* 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_write_unlock(dir->i_sb);
     if ( retval == IO_ERROR ) {
@@ -468,8 +485,9 @@
 	}
 
         if (retval != NAME_FOUND) {
-	    reiserfs_warning ("zam-7002:%s: \"reiserfs_find_entry\" has returned"
-                              " unexpected value (%d)\n", __FUNCTION__, retval);
+	    reiserfs_warning (dir->i_sb, "zam-7002:%s: \"reiserfs_find_entry\" "
+			      "has returned unexpected value (%d)",
+			      __FUNCTION__, retval);
        }
 
 	return -EEXIST;
@@ -478,7 +496,7 @@
     gen_number = find_first_zero_bit ((unsigned long *)bit_string, MAX_GENERATION_NUMBER + 1);
     if (gen_number > MAX_GENERATION_NUMBER) {
       /* there is no free generation number */
-      reiserfs_warning ("reiserfs_add_entry: Congratulations! we have got hash function screwed up\n");
+      reiserfs_warning (dir->i_sb, "reiserfs_add_entry: Congratulations! we have got hash function screwed up");
       if (buffer != small_buf)
           reiserfs_kfree (buffer, buflen, dir->i_sb);
       pathrelse (&path);
@@ -493,8 +511,9 @@
  		  
     if (gen_number != 0) {	/* we need to re-search for the insertion point */
       if (search_by_entry_key (dir->i_sb, &entry_key, &path, &de) != NAME_NOT_FOUND) {
-            reiserfs_warning ("vs-7032: reiserfs_add_entry: "
-                            "entry with this key (%K) already exists\n", &entry_key);
+            reiserfs_warning (dir->i_sb, "vs-7032: reiserfs_add_entry: "
+                              "entry with this key (%K) already exists",
+                              &entry_key);
 
 	    if (buffer != small_buf)
 		reiserfs_kfree (buffer, buflen, dir->i_sb);
@@ -504,7 +523,7 @@
     }
   
     /* perform the insertion of the entry that we have prepared */
-    retval = reiserfs_paste_into_item (th, &path, &entry_key, buffer, paste_size);
+    retval = reiserfs_paste_into_item (th, &path, &entry_key, dir, buffer, paste_size);
     if (buffer != small_buf)
 	reiserfs_kfree (buffer, buflen, dir->i_sb);
     if (retval) {
@@ -513,7 +532,6 @@
     }
 
     dir->i_size += paste_size;
-    dir->i_blocks = ((dir->i_size + 511) >> 9);
     dir->i_mtime = dir->i_ctime = CURRENT_TIME;
     if (!S_ISDIR (inode->i_mode) && visible)
 	// reiserfs_mkdir or reiserfs_rename will do that by itself
@@ -529,7 +547,9 @@
 ** inserted into the tree yet.
 */
 static int drop_new_inode(struct inode *inode) {
+    DQUOT_DROP(inode);
     make_bad_inode(inode) ;
+    inode->i_flags |= S_NOQUOTA;
     iput(inode) ;
     return 0 ;
 }
@@ -555,6 +575,11 @@
     } else {
         inode->i_gid = current->fsgid;
     }
+    DQUOT_INIT(inode);
+    if (DQUOT_ALLOC_INODE(inode)) {
+        drop_new_inode(inode);
+	return -EDQUOT;
+    }
     return 0 ;
 }
 
@@ -565,6 +590,7 @@
     struct inode * inode;
     int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 ;
     struct reiserfs_transaction_handle th ;
+    int locked;
 
     if (!(inode = new_inode(dir->i_sb))) {
 	return -ENOMEM ;
@@ -573,9 +599,19 @@
     if (retval)
         return retval;
 
+    locked = reiserfs_cache_default_acl (dir);
+
     reiserfs_write_lock(dir->i_sb);
+
+    if (locked)
+        reiserfs_write_lock_xattrs (dir->i_sb);
+
     journal_begin(&th, dir->i_sb, jbegin_count) ;
     retval = reiserfs_new_inode (&th, dir, mode, 0, 0/*i_size*/, dentry, inode);
+
+    if (locked)
+        reiserfs_write_unlock_xattrs (dir->i_sb);
+
     if (retval) {
         goto out_failed;
     }
@@ -611,6 +647,7 @@
     struct inode * inode;
     struct reiserfs_transaction_handle th ;
     int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3; 
+    int locked;
 
     if (!new_valid_dev(rdev))
 	return -EINVAL;
@@ -622,15 +659,26 @@
     if (retval)
         return retval;
 
+    locked = reiserfs_cache_default_acl (dir);
+
     reiserfs_write_lock(dir->i_sb);
+
+    if (locked)
+        reiserfs_write_lock_xattrs (dir->i_sb);
+
     journal_begin(&th, dir->i_sb, jbegin_count) ;
 
     retval = reiserfs_new_inode (&th, dir, mode, 0, 0/*i_size*/, dentry, inode);
+
+    if (locked)
+        reiserfs_write_unlock_xattrs (dir->i_sb);
+
     if (retval) {
         goto out_failed;
     }
 
-    init_special_inode(inode, mode, rdev) ;
+    inode->i_op = &reiserfs_special_inode_operations;
+    init_special_inode(inode, inode->i_mode, rdev) ;
 
     //FIXME: needed for block and char devices only
     reiserfs_update_sd (&th, inode);
@@ -663,6 +711,7 @@
     struct inode * inode;
     struct reiserfs_transaction_handle th ;
     int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3; 
+    int locked;
 
 #ifdef DISPLACE_NEW_PACKING_LOCALITIES
     /* set flag that new packing locality created and new blocks for the content     * of that directory are not displaced yet */
@@ -676,7 +725,11 @@
     if (retval)
         return retval;
 
+    locked = reiserfs_cache_default_acl (dir);
+
     reiserfs_write_lock(dir->i_sb);
+    if (locked)
+        reiserfs_write_lock_xattrs (dir->i_sb);
     journal_begin(&th, dir->i_sb, jbegin_count) ;
 
     /* inc the link count now, so another writer doesn't overflow it while
@@ -688,6 +741,9 @@
 				old_format_only (dir->i_sb) ? 
 				EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
 				dentry, inode);
+    if (locked)
+        reiserfs_write_unlock_xattrs (dir->i_sb);
+
     if (retval) {
 	dir->i_nlink-- ;
 	goto out_failed;
@@ -782,7 +838,8 @@
 	goto end_rmdir;
 
     if ( inode->i_nlink != 2 && inode->i_nlink != 1 )
-	printk ("reiserfs_rmdir: empty directory has nlink != 2 (%d)\n", inode->i_nlink);
+	reiserfs_warning (inode->i_sb, "%s: empty directory has nlink "
+			  "!= 2 (%d)", __FUNCTION__, inode->i_nlink);
 
     inode->i_nlink = 0;
     inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
@@ -790,7 +847,6 @@
 
     DEC_DIR_INODE_NLINK(dir)
     dir->i_size -= (DEH_SIZE + de.de_entrylen);
-    dir->i_blocks = ((dir->i_size + 511) >> 9);
     reiserfs_update_sd (&th, dir);
 
     /* prevent empty directory from getting lost */
@@ -850,8 +906,10 @@
     }
   
     if (!inode->i_nlink) {
-	printk("reiserfs_unlink: deleting nonexistent file (%s:%lu), %d\n",
-	       reiserfs_bdevname (inode->i_sb), inode->i_ino, inode->i_nlink);
+	reiserfs_warning (inode->i_sb, "%s: deleting nonexistent file "
+			  "(%s:%lu), %d", __FUNCTION__,
+			  reiserfs_bdevname (inode->i_sb), inode->i_ino,
+			  inode->i_nlink);
 	inode->i_nlink = 1;
     }
 
@@ -873,7 +931,6 @@
     reiserfs_update_sd (&th, inode);
 
     dir->i_size -= (de.de_entrylen + DEH_SIZE);
-    dir->i_blocks = ((dir->i_size + 511) >> 9);
     dir->i_ctime = dir->i_mtime = CURRENT_TIME;
     reiserfs_update_sd (&th, dir);
 
@@ -930,6 +987,8 @@
     memcpy (name, symname, strlen (symname));
     padd_item (name, item_len, strlen (symname));
 
+    /* We would inherit the default ACL here, but symlinks don't get ACLs */
+
     journal_begin(&th, parent_dir->i_sb, jbegin_count) ;
 
     retval = reiserfs_new_inode (&th, parent_dir, mode, name, strlen (symname), 
@@ -942,7 +1001,7 @@
     reiserfs_update_inode_transaction(inode) ;
     reiserfs_update_inode_transaction(parent_dir) ;
 
-    inode->i_op = &page_symlink_inode_operations;
+    inode->i_op = &reiserfs_symlink_inode_operations;
     inode->i_mapping->a_ops = &reiserfs_address_space_operations;
 
     // must be sure this inode is written with this transaction
@@ -1284,10 +1343,9 @@
     // anybody, but it will panic if will not be able to find the
     // entry. This needs one more clean up
     if (reiserfs_cut_from_item (&th, &old_entry_path, &(old_de.de_entry_key), old_dir, NULL, 0) < 0)
-	reiserfs_warning ("vs-7060: reiserfs_rename: couldn't not cut old name. Fsck later?\n");
+	reiserfs_warning (old_dir->i_sb, "vs-7060: reiserfs_rename: couldn't not cut old name. Fsck later?");
 
     old_dir->i_size -= DEH_SIZE + old_de.de_entrylen;
-    old_dir->i_blocks = ((old_dir->i_size + 511) >> 9);
 
     reiserfs_update_sd (&th, old_dir);
     reiserfs_update_sd (&th, new_dir);
@@ -1318,5 +1376,42 @@
     .rmdir	= reiserfs_rmdir,
     .mknod	= reiserfs_mknod,
     .rename	= reiserfs_rename,
+    .setattr    = reiserfs_setattr,
+    .setxattr   = reiserfs_setxattr,
+    .getxattr   = reiserfs_getxattr,
+    .listxattr  = reiserfs_listxattr,
+    .removexattr = reiserfs_removexattr,
+    .permission     = reiserfs_permission,
+};
+
+/*
+ * symlink operations.. same as page_symlink_inode_operations, with xattr
+ * stuff added
+ */
+struct inode_operations reiserfs_symlink_inode_operations = {
+    .readlink       = page_readlink,
+    .follow_link    = page_follow_link,
+    .setattr        = reiserfs_setattr,
+    .setxattr       = reiserfs_setxattr,
+    .getxattr       = reiserfs_getxattr,
+    .listxattr      = reiserfs_listxattr,
+    .removexattr    = reiserfs_removexattr,
+    .permission     = reiserfs_permission,
+
 };
+
+
+/*
+ * special file operations.. just xattr/acl stuff
+ */
+struct inode_operations reiserfs_special_inode_operations = {
+    .setattr        = reiserfs_setattr,
+    .setxattr       = reiserfs_setxattr,
+    .getxattr       = reiserfs_getxattr,
+    .listxattr      = reiserfs_listxattr,
+    .removexattr    = reiserfs_removexattr,
+    .permission     = reiserfs_permission,
+
+};
+
 
diff -Nru a/fs/reiserfs/objectid.c b/fs/reiserfs/objectid.c
--- a/fs/reiserfs/objectid.c	Tue Jun 15 22:20:39 2004
+++ b/fs/reiserfs/objectid.c	Tue Jun 15 22:20:39 2004
@@ -62,7 +62,7 @@
                                 /* comment needed -Hans */
     unused_objectid = le32_to_cpu (map[1]);
     if (unused_objectid == U32_MAX) {
-	printk ("REISERFS: get_objectid: no more object ids\n");
+	reiserfs_warning (s, "%s: no more object ids", __FUNCTION__);
 	reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s)) ;
 	return 0;
     }
@@ -159,7 +159,7 @@
 	i += 2;
     }
 
-    reiserfs_warning ("vs-15011: reiserfs_release_objectid: tried to free free object id (%lu)\n", 
+    reiserfs_warning (s, "vs-15011: reiserfs_release_objectid: tried to free free object id (%lu)",
 		      ( long unsigned ) objectid_to_release);
 }
 
diff -Nru a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c
--- a/fs/reiserfs/prints.c	Tue Jun 15 22:20:41 2004
+++ b/fs/reiserfs/prints.c	Tue Jun 15 22:20:41 2004
@@ -264,20 +264,43 @@
     va_end( args );\
 }
 
-void reiserfs_warning (const char * fmt, ...)
+void reiserfs_warning (struct super_block *sb, const char * fmt, ...)
 {
   do_reiserfs_warning(fmt);
-  /* console_print (error_buf); */
-  printk (KERN_WARNING "%s", error_buf);
+  if (sb)
+      printk (KERN_WARNING "ReiserFS: %s: warning: %s\n",
+             reiserfs_bdevname (sb), error_buf);
+  else
+      printk (KERN_WARNING "ReiserFS: warning: %s\n", error_buf);
+}
+
+/* No newline.. reiserfs_info calls can be followed by printk's */
+void reiserfs_info (struct super_block *sb, const char * fmt, ...)
+{
+  do_reiserfs_warning(fmt);
+  if (sb)
+      printk (KERN_NOTICE "ReiserFS: %s: %s",
+             reiserfs_bdevname (sb), error_buf);
+  else
+      printk (KERN_NOTICE "ReiserFS: %s", error_buf);
+}
+
+/* No newline.. reiserfs_printk calls can be followed by printk's */
+void reiserfs_printk (const char * fmt, ...)
+{
+  do_reiserfs_warning(fmt);
+  printk (error_buf);
 }
 
 void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...)
 {
 #ifdef CONFIG_REISERFS_CHECK
   do_reiserfs_warning(fmt);
-  printk (KERN_DEBUG "%s", error_buf);
-#else
-  ; 
+  if (s)
+      printk (KERN_DEBUG "ReiserFS: %s: %s\n",
+             reiserfs_bdevname (s), error_buf);
+  else
+      printk (KERN_DEBUG "ReiserFS: %s\n", error_buf);
 #endif
 }
 
@@ -334,7 +357,8 @@
 void reiserfs_panic (struct super_block * sb, const char * fmt, ...)
 {
   do_reiserfs_warning(fmt);
-  printk ( KERN_EMERG "%s", error_buf);
+  printk (KERN_EMERG "REISERFS: panic (device %s): %s\n",
+          reiserfs_bdevname (sb), error_buf);
   BUG ();
 
   /* this is not actually called, but makes reiserfs_panic() "noreturn" */
@@ -413,13 +437,13 @@
 	to = last < B_NR_ITEMS (bh) ? last : B_NR_ITEMS (bh);
     }
 
-    reiserfs_warning ("INTERNAL NODE (%ld) contains %z\n",  bh->b_blocknr, bh);
+    reiserfs_printk ("INTERNAL NODE (%ld) contains %z\n",  bh->b_blocknr, bh);
     
     dc = B_N_CHILD (bh, from);
-    reiserfs_warning ("PTR %d: %y ", from, dc);
+    reiserfs_printk ("PTR %d: %y ", from, dc);
     
     for (i = from, key = B_N_PDELIM_KEY (bh, from), dc ++; i < to; i ++, key ++, dc ++) {
-	reiserfs_warning ("KEY %d: %k PTR %d: %y ", i, key, i + 1, dc);
+	reiserfs_printk ("KEY %d: %k PTR %d: %y ", i, key, i + 1, dc);
 	if (i && i % 4 == 0)
 	    printk ("\n");
     }
@@ -448,10 +472,10 @@
     nr = blkh_nr_item(blkh);
 
     printk ("\n===================================================================\n");
-    reiserfs_warning ("LEAF NODE (%ld) contains %z\n", bh->b_blocknr, bh);
+    reiserfs_printk ("LEAF NODE (%ld) contains %z\n", bh->b_blocknr, bh);
 
     if (!(print_mode & PRINT_LEAF_ITEMS)) {
-	reiserfs_warning ("FIRST ITEM_KEY: %k, LAST ITEM KEY: %k\n",
+	reiserfs_printk ("FIRST ITEM_KEY: %k, LAST ITEM KEY: %k\n",
 			  &(ih->ih_key), &((ih + nr - 1)->ih_key));
 	return 0;
     }
@@ -471,7 +495,7 @@
     printk ("|##|   type    |           key           | ilen | free_space | version | loc  |\n");
     for (i = from; i < to; i++, ih ++) {
 	printk ("-------------------------------------------------------------------------------\n");
-	reiserfs_warning ("|%2d| %h |\n", i, ih);
+	reiserfs_printk ("|%2d| %h |\n", i, ih);
 	if (print_mode & PRINT_LEAF_ITEMS)
 	    op_print_item (ih, B_I_PITEM (bh, ih));
     }
diff -Nru a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
--- a/fs/reiserfs/procfs.c	Tue Jun 15 22:20:38 2004
+++ b/fs/reiserfs/procfs.c	Tue Jun 15 22:20:38 2004
@@ -548,8 +548,8 @@
 		add_file(sb, "journal", show_journal);
 		return 0;
 	}
-	reiserfs_warning( "reiserfs: cannot create /proc/%s/%s\n",
-			  proc_info_root_name, reiserfs_bdevname (sb) );
+	reiserfs_warning(sb, "reiserfs: cannot create /proc/%s/%s",
+			 proc_info_root_name, reiserfs_bdevname (sb) );
 	return 1;
 }
 
@@ -595,7 +595,8 @@
 		if( proc_info_root ) {
 			proc_info_root -> owner = THIS_MODULE;
 		} else {
-			reiserfs_warning( "reiserfs: cannot create /proc/%s\n",
+			reiserfs_warning (NULL,
+					  "reiserfs: cannot create /proc/%s",
 					  proc_info_root_name );
 			return 1;
 		}
diff -Nru a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
--- a/fs/reiserfs/stree.c	Tue Jun 15 22:20:42 2004
+++ b/fs/reiserfs/stree.c	Tue Jun 15 22:20:42 2004
@@ -60,6 +60,7 @@
 #include <linux/reiserfs_fs.h>
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
+#include <linux/quotaops.h>
 
 /* Does the buffer contain a disk block which is in the tree. */
 inline int B_IS_IN_TREE (const struct buffer_head * p_s_bh)
@@ -71,9 +72,6 @@
   return ( B_LEVEL (p_s_bh) != FREE_LEVEL );
 }
 
-
-
-
 inline void copy_short_key (void * to, const void * from)
 {
     memcpy (to, from, SHORT_KEY_SIZE);
@@ -166,7 +164,7 @@
     if (cpu_key_k_offset (key1) > cpu_key_k_offset (key2))
 	return 1;
 
-    reiserfs_warning ("comp_cpu_keys: type are compared for %K and %K\n",
+    reiserfs_warning (NULL, "comp_cpu_keys: type are compared for %K and %K",
 		      key1, key2);
 
     if (cpu_key_k_type (key1) < cpu_key_k_type (key2))
@@ -499,21 +497,21 @@
 
     blkh = (struct block_head *)buf;
     if ( blkh_level(blkh) != DISK_LEAF_NODE_LEVEL) {
-	printk ("is_leaf: this should be caught earlier\n");
+	reiserfs_warning (NULL, "is_leaf: this should be caught earlier");
 	return 0;
     }
 
     nr = blkh_nr_item(blkh);
     if (nr < 1 || nr > ((blocksize - BLKH_SIZE) / (IH_SIZE + MIN_ITEM_LEN))) {
 	/* item number is too big or too small */
-	reiserfs_warning ("is_leaf: nr_item seems wrong: %z\n", bh);
+	reiserfs_warning (NULL, "is_leaf: nr_item seems wrong: %z", bh);
 	return 0;
     }
     ih = (struct item_head *)(buf + BLKH_SIZE) + nr - 1;
     used_space = BLKH_SIZE + IH_SIZE * nr + (blocksize - ih_location (ih));
     if (used_space != blocksize - blkh_free_space(blkh)) {
 	/* free space does not match to calculated amount of use space */
-	reiserfs_warning ("is_leaf: free space seems wrong: %z\n", bh);
+	reiserfs_warning (NULL, "is_leaf: free space seems wrong: %z", bh);
 	return 0;
     }
 
@@ -525,19 +523,19 @@
     prev_location = blocksize;
     for (i = 0; i < nr; i ++, ih ++) {
 	if ( le_ih_k_type(ih) == TYPE_ANY) {
-	    reiserfs_warning ("is_leaf: wrong item type for item %h\n",ih);
+	    reiserfs_warning (NULL, "is_leaf: wrong item type for item %h",ih);
 	    return 0;
 	}
 	if (ih_location (ih) >= blocksize || ih_location (ih) < IH_SIZE * nr) {
-	    reiserfs_warning ("is_leaf: item location seems wrong: %h\n", ih);
+	    reiserfs_warning (NULL, "is_leaf: item location seems wrong: %h", ih);
 	    return 0;
 	}
 	if (ih_item_len (ih) < 1 || ih_item_len (ih) > MAX_ITEM_LEN (blocksize)) {
-	    reiserfs_warning ("is_leaf: item length seems wrong: %h\n", ih);
+	    reiserfs_warning (NULL, "is_leaf: item length seems wrong: %h", ih);
 	    return 0;
 	}
 	if (prev_location - ih_location (ih) != ih_item_len (ih)) {
-	    reiserfs_warning ("is_leaf: item location seems wrong (second one): %h\n", ih);
+	    reiserfs_warning (NULL, "is_leaf: item location seems wrong (second one): %h", ih);
 	    return 0;
 	}
 	prev_location = ih_location (ih);
@@ -559,20 +557,20 @@
     nr = blkh_level(blkh);
     if (nr <= DISK_LEAF_NODE_LEVEL || nr > MAX_HEIGHT) {
 	/* this level is not possible for internal nodes */
-	printk ("is_internal: this should be caught earlier\n");
+	reiserfs_warning (NULL, "is_internal: this should be caught earlier");
 	return 0;
     }
     
     nr = blkh_nr_item(blkh);
     if (nr > (blocksize - BLKH_SIZE - DC_SIZE) / (KEY_SIZE + DC_SIZE)) {
 	/* for internal which is not root we might check min number of keys */
-	reiserfs_warning ("is_internal: number of key seems wrong: %z\n", bh);
+	reiserfs_warning (NULL, "is_internal: number of key seems wrong: %z", bh);
 	return 0;
     }
 
     used_space = BLKH_SIZE + KEY_SIZE * nr + DC_SIZE * (nr + 1);
     if (used_space != blocksize - blkh_free_space(blkh)) {
-	reiserfs_warning ("is_internal: free space seems wrong: %z\n", bh);
+	reiserfs_warning (NULL, "is_internal: free space seems wrong: %z", bh);
 	return 0;
     }
 
@@ -586,7 +584,7 @@
 static int is_tree_node (struct buffer_head * bh, int level)
 {
     if (B_LEVEL (bh) != level) {
-	printk ("is_tree_node: node level %d does not match to the expected one %d\n",
+	reiserfs_warning (NULL, "is_tree_node: node level %d does not match to the expected one %d",
 		B_LEVEL (bh), level);
 	return 0;
     }
@@ -683,9 +681,9 @@
 
 #ifdef CONFIG_REISERFS_CHECK
 	if ( !(++n_repeat_counter % 50000) )
-	    reiserfs_warning ("PAP-5100: search_by_key: %s:"
+	    reiserfs_warning (p_s_sb, "PAP-5100: search_by_key: %s:"
 			      "there were %d iterations of while loop "
-			      "looking for key %K\n",
+			      "looking for key %K",
 			      current->comm, n_repeat_counter, p_s_key);
 #endif
 
@@ -748,8 +746,8 @@
 	// make sure, that the node contents look like a node of
 	// certain level
 	if (!is_tree_node (p_s_bh, expected_level)) {
-	    reiserfs_warning ("vs-5150: search_by_key: "
-			      "invalid format found in block %ld. Fsck?\n", 
+	    reiserfs_warning (p_s_sb, "vs-5150: search_by_key: "
+			      "invalid format found in block %ld. Fsck?",
 			      p_s_bh->b_blocknr);
 	    pathrelse (p_s_search_path);
 	    return IO_ERROR;
@@ -1125,8 +1123,7 @@
 		tmp = get_block_num(p_n_unfm_pointer,0);
 		put_block_num(p_n_unfm_pointer, 0, 0);
 		journal_mark_dirty (th, p_s_sb, p_s_bh);
-		inode->i_blocks -= p_s_sb->s_blocksize / 512;
-		reiserfs_free_block(th, tmp);
+		reiserfs_free_block(th, inode, tmp, 1);
 		if ( item_moved (&s_ih, p_s_path) )  {
 			need_research = 1;
 			break ;
@@ -1155,8 +1152,7 @@
     }
 }
 
-
-/* Calculate bytes number which will be deleted or cutted in the balance. */
+/* Calculate number of bytes which will be deleted or cut during balance */
 int calc_deleted_bytes_number(
     struct  tree_balance  * p_s_tb,
     char                    c_mode
@@ -1167,14 +1163,14 @@
     if ( is_statdata_le_ih (p_le_ih) )
 	return 0;
 
+    n_del_size = ( c_mode == M_DELETE ) ? ih_item_len(p_le_ih) : -p_s_tb->insert_size[0];
     if ( is_direntry_le_ih (p_le_ih) ) {
 	// return EMPTY_DIR_SIZE; /* We delete emty directoris only. */
 	// we can't use EMPTY_DIR_SIZE, as old format dirs have a different
 	// empty size.  ick. FIXME, is this right?
 	//
-	return ih_item_len(p_le_ih);
+	return n_del_size ;
     }
-    n_del_size = ( c_mode == M_DELETE ) ? ih_item_len(p_le_ih) : -p_s_tb->insert_size[0];
 
     if ( is_indirect_le_ih (p_le_ih) )
 	n_del_size = (n_del_size/UNFM_P_SIZE)*
@@ -1208,17 +1204,46 @@
 	item [--i] = 0;
 }
 
+#ifdef REISERQUOTA_DEBUG
+char key2type(struct key *ih)
+{
+  if (is_direntry_le_key(2, ih))
+    return 'd';
+  if (is_direct_le_key(2, ih))
+    return 'D';
+  if (is_indirect_le_key(2, ih))
+    return 'i';
+  if (is_statdata_le_key(2, ih))
+    return 's';
+  return 'u';
+}
+
+char head2type(struct item_head *ih)
+{
+  if (is_direntry_le_ih(ih))
+    return 'd';
+  if (is_direct_le_ih(ih))
+    return 'D';
+  if (is_indirect_le_ih(ih))
+    return 'i';
+  if (is_statdata_le_ih(ih))
+    return 's';
+  return 'u';
+}
+#endif
 
 /* Delete object item. */
 int reiserfs_delete_item (struct reiserfs_transaction_handle *th, 
 			  struct path * p_s_path, /* Path to the deleted item. */
 			  const struct cpu_key * p_s_item_key, /* Key to search for the deleted item.  */
-			  struct inode * p_s_inode,/* inode is here just to update i_blocks */
+			  struct inode * p_s_inode,/* inode is here just to update i_blocks and quotas */
 			  struct buffer_head  * p_s_un_bh)    /* NULL or unformatted node pointer.    */
 {
     struct super_block * p_s_sb = p_s_inode->i_sb;
     struct tree_balance   s_del_balance;
     struct item_head      s_ih;
+    struct item_head      *q_ih;
+    int			  quota_cut_bytes;
     int                   n_ret_value,
 	n_del_size,
 	n_removed;
@@ -1255,8 +1280,8 @@
 	if (n_ret_value == IO_ERROR)
 	    break;
 	if (n_ret_value == FILE_NOT_FOUND) {
-	    reiserfs_warning ("vs-5340: reiserfs_delete_item: "
-			      "no items of the file %K found\n", p_s_item_key);
+	    reiserfs_warning (p_s_sb, "vs-5340: reiserfs_delete_item: "
+			      "no items of the file %K found", p_s_item_key);
 	    break;
 	}
     } /* while (1) */
@@ -1268,6 +1293,22 @@
 
     // reiserfs_delete_item returns item length when success
     n_ret_value = calc_deleted_bytes_number(&s_del_balance, M_DELETE);
+    q_ih = get_ih(p_s_path) ;
+    quota_cut_bytes = ih_item_len(q_ih) ;
+
+    /* hack so the quota code doesn't have to guess if the file
+    ** has a tail.  On tail insert, we allocate quota for 1 unformatted node.
+    ** We test the offset because the tail might have been
+    ** split into multiple items, and we only want to decrement for
+    ** the unfm node once
+    */
+    if (!S_ISLNK (p_s_inode->i_mode) && is_direct_le_ih(q_ih)) {
+        if ((le_ih_k_offset(q_ih) & (p_s_sb->s_blocksize - 1)) == 1) {
+            quota_cut_bytes = p_s_sb->s_blocksize + UNFM_P_SIZE;
+        } else {
+	    quota_cut_bytes = 0 ;
+	}
+    }
 
     if ( p_s_un_bh )  {
 	int off;
@@ -1299,10 +1340,14 @@
 	       B_I_PITEM(PATH_PLAST_BUFFER(p_s_path), &s_ih), n_ret_value);
 	kunmap_atomic(data, KM_USER0);
     }
-
     /* Perform balancing after all resources have been collected at once. */ 
     do_balance(&s_del_balance, NULL, NULL, M_DELETE);
 
+#ifdef REISERQUOTA_DEBUG
+    reiserfs_debug (p_s_sb, "reiserquota delete_item(): freeing %u, id=%u type=%c", quota_cut_bytes, p_s_inode->i_uid, head2type(&s_ih));
+#endif
+    DQUOT_FREE_SPACE_NODIRTY(p_s_inode, quota_cut_bytes);
+
     /* Return deleted body length */
     return n_ret_value;
 }
@@ -1327,22 +1372,26 @@
 
 /* this deletes item which never gets split */
 void reiserfs_delete_solid_item (struct reiserfs_transaction_handle *th,
+				 struct inode *inode,
 				 struct key * key)
 {
     struct tree_balance tb;
     INITIALIZE_PATH (path);
-    int item_len;
+    int item_len = 0;
     int tb_init = 0 ;
     struct cpu_key cpu_key;
     int retval;
+    int quota_cut_bytes = 0;
     
     le_key2cpu_key (&cpu_key, key);
     
     while (1) {
 	retval = search_item (th->t_super, &cpu_key, &path);
 	if (retval == IO_ERROR) {
-	    reiserfs_warning ("vs-5350: reiserfs_delete_solid_item: "
-			      "i/o failure occurred trying to delete %K\n", &cpu_key);
+	    reiserfs_warning (th->t_super,
+			      "vs-5350: reiserfs_delete_solid_item: "
+			      "i/o failure occurred trying to delete %K",
+			      &cpu_key);
 	    break;
 	}
 	if (retval != ITEM_FOUND) {
@@ -1350,7 +1399,7 @@
 	    // No need for a warning, if there is just no free space to insert '..' item into the newly-created subdir
 	    if ( !( (unsigned long long) GET_HASH_VALUE (le_key_k_offset (le_key_version (key), key)) == 0 && \
 		 (unsigned long long) GET_GENERATION_NUMBER (le_key_k_offset (le_key_version (key), key)) == 1 ) )
-		reiserfs_warning ("vs-5355: reiserfs_delete_solid_item: %k not found", key);
+		reiserfs_warning (th->t_super, "vs-5355: reiserfs_delete_solid_item: %k not found", key);
 	    break;
 	}
 	if (!tb_init) {
@@ -1358,6 +1407,7 @@
 	    item_len = ih_item_len( PATH_PITEM_HEAD(&path) );
 	    init_tb_struct (th, &tb, th->t_super, &path, - (IH_SIZE + item_len));
 	}
+	quota_cut_bytes = ih_item_len(PATH_PITEM_HEAD(&path)) ;
 
 	retval = fix_nodes (M_DELETE, &tb, NULL, 0);
 	if (retval == REPEAT_SEARCH) {
@@ -1367,12 +1417,18 @@
 
 	if (retval == CARRY_ON) {
 	    do_balance (&tb, 0, 0, M_DELETE);
+	    if (inode) {	/* Should we count quota for item? (we don't count quotas for save-links) */
+#ifdef REISERQUOTA_DEBUG
+		reiserfs_debug (th->t_super, "reiserquota delete_solid_item(): freeing %u id=%u type=%c", quota_cut_bytes, inode->i_uid, key2type(key));
+#endif
+		DQUOT_FREE_SPACE_NODIRTY(inode, quota_cut_bytes);
+	    }
 	    break;
 	}
 
 	// IO_ERROR, NO_DISK_SPACE, etc
-	reiserfs_warning ("vs-5360: reiserfs_delete_solid_item: "
-			  "could not delete %K due to fix_nodes failure\n", &cpu_key);
+	reiserfs_warning (th->t_super, "vs-5360: reiserfs_delete_solid_item: "
+			  "could not delete %K due to fix_nodes failure", &cpu_key);
 	unfix_nodes (&tb);
 	break;
     }
@@ -1399,7 +1455,7 @@
       }
 /* USE_INODE_GENERATION_COUNTER */
 #endif
-    reiserfs_delete_solid_item (th, INODE_PKEY (inode));
+    reiserfs_delete_solid_item (th, inode, INODE_PKEY (inode));
 }
 
 
@@ -1466,7 +1522,7 @@
 	tail_len -= removed;
 	set_cpu_key_k_offset (&tail_key, cpu_key_k_offset (&tail_key) - removed);
     }
-    printk ("indirect_to_direct_roll_back: indirect_to_direct conversion has been rolled back due to lack of disk space\n");
+    reiserfs_warning (inode->i_sb, "indirect_to_direct_roll_back: indirect_to_direct conversion has been rolled back due to lack of disk space");
     //mark_file_without_tail (inode);
     mark_inode_dirty (inode);
 }
@@ -1486,12 +1542,14 @@
        structure by using the init_tb_struct and fix_nodes functions.
        After that we can make tree balancing. */
     struct tree_balance s_cut_balance;
+    struct item_head *p_le_ih;
     int n_cut_size = 0,        /* Amount to be cut. */
 	n_ret_value = CARRY_ON,
 	n_removed = 0,     /* Number of the removed unformatted nodes. */
 	n_is_inode_locked = 0;
     char                c_mode;            /* Mode of the balance. */
     int retval2 = -1;
+    int quota_cut_bytes;
     
     
     init_tb_struct(th, &s_cut_balance, p_s_inode->i_sb, p_s_path, n_cut_size);
@@ -1556,7 +1614,7 @@
 	if (n_ret_value == POSITION_FOUND)
 	    continue;
 
-	reiserfs_warning ("PAP-5610: reiserfs_cut_from_item: item %K not found\n", p_s_item_key);
+	reiserfs_warning (p_s_sb, "PAP-5610: reiserfs_cut_from_item: item %K not found", p_s_item_key);
 	unfix_nodes (&s_cut_balance);
 	return (n_ret_value == IO_ERROR) ? -EIO : -ENOENT;
     } /* while */
@@ -1569,7 +1627,7 @@
 	    indirect_to_direct_roll_back (th, p_s_inode, p_s_path);
 	}
 	if (n_ret_value == NO_DISK_SPACE)
-	    reiserfs_warning ("NO_DISK_SPACE");
+	    reiserfs_warning (p_s_sb, "NO_DISK_SPACE");
 	unfix_nodes (&s_cut_balance);
 	return -EIO;
     }
@@ -1579,23 +1637,27 @@
     RFALSE( c_mode == M_PASTE || c_mode == M_INSERT, "invalid mode");
 
     /* Calculate number of bytes that need to be cut from the item. */
+    quota_cut_bytes = ( c_mode == M_DELETE ) ? ih_item_len(get_ih(p_s_path)) : -s_cut_balance.insert_size[0];
     if (retval2 == -1)
 	n_ret_value = calc_deleted_bytes_number(&s_cut_balance, c_mode);
     else
 	n_ret_value = retval2;
-    
-    if ( c_mode == M_DELETE ) {
-	struct item_head * p_le_ih = PATH_PITEM_HEAD (s_cut_balance.tb_path);
-	
-	if ( is_direct_le_ih (p_le_ih) && (le_ih_k_offset (p_le_ih) & (p_s_sb->s_blocksize - 1)) == 1 ) {
-	    /* we delete first part of tail which was stored in direct
-               item(s) */
+
+
+    /* For direct items, we only change the quota when deleting the last
+    ** item.
+    */
+    p_le_ih = PATH_PITEM_HEAD (s_cut_balance.tb_path);
+    if (!S_ISLNK (p_s_inode->i_mode) && is_direct_le_ih(p_le_ih)) {
+        if (c_mode == M_DELETE &&
+	   (le_ih_k_offset (p_le_ih) & (p_s_sb->s_blocksize - 1)) == 1 ) {
 	    // FIXME: this is to keep 3.5 happy
 	    REISERFS_I(p_s_inode)->i_first_direct_byte = U32_MAX;
-	    p_s_inode->i_blocks -= p_s_sb->s_blocksize / 512;
+	    quota_cut_bytes = p_s_sb->s_blocksize + UNFM_P_SIZE ;
+        } else {
+	    quota_cut_bytes = 0 ;
 	}
     }
-
 #ifdef CONFIG_REISERFS_CHECK
     if (n_is_inode_locked) {
 	struct item_head * le_ih = PATH_PITEM_HEAD (s_cut_balance.tb_path);
@@ -1630,19 +1692,23 @@
 	*/
 	REISERFS_I(p_s_inode)->i_flags &= ~i_pack_on_close_mask ;
     }
+#ifdef REISERQUOTA_DEBUG
+    reiserfs_debug (p_s_inode->i_sb, "reiserquota cut_from_item(): freeing %u id=%u type=%c", quota_cut_bytes, p_s_inode->i_uid, '?');
+#endif
+    DQUOT_FREE_SPACE_NODIRTY(p_s_inode, quota_cut_bytes);
     return n_ret_value;
 }
 
-
 static void truncate_directory (struct reiserfs_transaction_handle *th, struct inode * inode)
 {
     if (inode->i_nlink)
-	reiserfs_warning ("vs-5655: truncate_directory: link count != 0\n");
+	reiserfs_warning (inode->i_sb,
+			  "vs-5655: truncate_directory: link count != 0");
 
     set_le_key_k_offset (KEY_FORMAT_3_5, INODE_PKEY (inode), DOT_OFFSET);
     set_le_key_k_type (KEY_FORMAT_3_5, INODE_PKEY (inode), TYPE_DIRENTRY);
-    reiserfs_delete_solid_item (th, INODE_PKEY (inode));
-
+    reiserfs_delete_solid_item (th, inode, INODE_PKEY (inode));
+    reiserfs_update_sd(th, inode) ;
     set_le_key_k_offset (KEY_FORMAT_3_5, INODE_PKEY (inode), SD_OFFSET);
     set_le_key_k_type (KEY_FORMAT_3_5, INODE_PKEY (inode), TYPE_STAT_DATA);    
 }
@@ -1686,14 +1752,14 @@
 
     retval = search_for_position_by_key(p_s_inode->i_sb, &s_item_key, &s_search_path);
     if (retval == IO_ERROR) {
-	reiserfs_warning ("vs-5657: reiserfs_do_truncate: "
-			  "i/o failure occurred trying to truncate %K\n", &s_item_key);
+	reiserfs_warning (p_s_inode->i_sb, "vs-5657: reiserfs_do_truncate: "
+			  "i/o failure occurred trying to truncate %K", &s_item_key);
 	return;
     }
     if (retval == POSITION_FOUND || retval == FILE_NOT_FOUND) {
 	pathrelse (&s_search_path);
-	reiserfs_warning ("PAP-5660: reiserfs_do_truncate: "
-			  "wrong result %d of search for %K\n", retval, &s_item_key);
+	reiserfs_warning (p_s_inode->i_sb, "PAP-5660: reiserfs_do_truncate: "
+			  "wrong result %d of search for %K", retval, &s_item_key);
 	return;
     }
 
@@ -1724,7 +1790,7 @@
 	/* Cut or delete file item. */
 	n_deleted = reiserfs_cut_from_item(th, &s_search_path, &s_item_key, p_s_inode,  page, n_new_file_size);
 	if (n_deleted < 0) {
-	    reiserfs_warning ("vs-5665: reiserfs_do_truncate: reiserfs_cut_from_item failed");
+	    reiserfs_warning (p_s_inode->i_sb, "vs-5665: reiserfs_do_truncate: reiserfs_cut_from_item failed");
 	    reiserfs_check_path(&s_search_path) ;
 	    return;
 	}
@@ -1764,7 +1830,7 @@
 	      search_for_position_by_key(p_s_inode->i_sb, &s_item_key, &s_search_path) == POSITION_FOUND )  ;
 
     RFALSE( n_file_size > ROUND_UP (n_new_file_size),
-	    "PAP-5680: truncate did not finish: new_file_size %Ld, current %Ld, oid %d\n",
+	    "PAP-5680: truncate did not finish: new_file_size %Ld, current %Ld, oid %d",
 	    n_new_file_size, n_file_size, s_item_key.on_disk_key.k_objectid);
 
 update_and_out:
@@ -1809,18 +1875,37 @@
 int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th, 
 			      struct path         * p_s_search_path,	/* Path to the pasted item.          */
 			      const struct cpu_key      * p_s_key,        	/* Key to search for the needed item.*/
+			      struct inode	  * inode,		/* Inode item belongs to */
 			      const char          * p_c_body,       	/* Pointer to the bytes to paste.    */
 			      int                   n_pasted_size)  	/* Size of pasted bytes.             */
 {
     struct tree_balance s_paste_balance;
     int                 retval;
+    int			fs_gen;
+
+    fs_gen = get_generation(inode->i_sb) ;
 
+#ifdef REISERQUOTA_DEBUG
+    reiserfs_debug (inode->i_sb, "reiserquota paste_into_item(): allocating %u id=%u type=%c", n_pasted_size, inode->i_uid, key2type(&(p_s_key->on_disk_key)));
+#endif
+
+    if (DQUOT_ALLOC_SPACE_NODIRTY(inode, n_pasted_size)) {
+	pathrelse(p_s_search_path);
+	return -EDQUOT;
+    }
     init_tb_struct(th, &s_paste_balance, th->t_super, p_s_search_path, n_pasted_size);
 #ifdef DISPLACE_NEW_PACKING_LOCALITIES
     s_paste_balance.key = p_s_key->on_disk_key;
 #endif
-    
-    while ( (retval = fix_nodes(M_PASTE, &s_paste_balance, NULL, p_c_body)) == REPEAT_SEARCH ) {
+
+    /* DQUOT_* can schedule, must check before the fix_nodes */
+    if (fs_changed(fs_gen, inode->i_sb)) {
+	goto search_again;
+    }
+
+    while ((retval = fix_nodes(M_PASTE, &s_paste_balance, NULL, p_c_body)) ==
+REPEAT_SEARCH ) {
+search_again:
 	/* file system changed while we were in the fix_nodes */
 	PROC_INFO_INC( th -> t_super, paste_into_item_restarted );
 	retval = search_for_position_by_key (th->t_super, p_s_key, p_s_search_path);
@@ -1829,7 +1914,7 @@
 	    goto error_out ;
 	}
 	if (retval == POSITION_FOUND) {
-	    reiserfs_warning ("PAP-5710: reiserfs_paste_into_item: entry or pasted byte (%K) exists\n", p_s_key);
+	    reiserfs_warning (inode->i_sb, "PAP-5710: reiserfs_paste_into_item: entry or pasted byte (%K) exists", p_s_key);
 	    retval = -EEXIST ;
 	    goto error_out ;
 	}
@@ -1849,6 +1934,10 @@
 error_out:
     /* this also releases the path */
     unfix_nodes(&s_paste_balance);
+#ifdef REISERQUOTA_DEBUG
+    reiserfs_debug (inode->i_sb, "reiserquota paste_into_item(): freeing %u id=%u type=%c", n_pasted_size, inode->i_uid, key2type(&(p_s_key->on_disk_key)));
+#endif
+    DQUOT_FREE_SPACE_NODIRTY(inode, n_pasted_size);
     return retval ;
 }
 
@@ -1858,23 +1947,45 @@
 			 struct path         * 	p_s_path,         /* Path to the inserteded item.         */
 			 const struct cpu_key      * key,
 			 struct item_head    * 	p_s_ih,           /* Pointer to the item header to insert.*/
+			 struct inode        * inode,
 			 const char          * 	p_c_body)         /* Pointer to the bytes to insert.      */
 {
     struct tree_balance s_ins_balance;
     int                 retval;
+    int fs_gen = 0 ;
+    int quota_bytes = 0 ;
 
+    if (inode) {      /* Do we count quotas for item? */
+	fs_gen = get_generation(inode->i_sb);
+	quota_bytes = ih_item_len(p_s_ih);
+
+	/* hack so the quota code doesn't have to guess if the file has
+	 ** a tail, links are always tails, so there's no guessing needed
+	 */
+	if (!S_ISLNK (inode->i_mode) && is_direct_le_ih(p_s_ih)) {
+	    quota_bytes = inode->i_sb->s_blocksize + UNFM_P_SIZE ;
+	}
+#ifdef REISERQUOTA_DEBUG
+	reiserfs_debug (inode->i_sb, "reiserquota insert_item(): allocating %u id=%u type=%c", quota_bytes, inode->i_uid, head2type(p_s_ih));
+#endif
+	/* We can't dirty inode here. It would be immediately written but
+	 * appropriate stat item isn't inserted yet... */
+	if (DQUOT_ALLOC_SPACE_NODIRTY(inode, quota_bytes)) {
+	    pathrelse(p_s_path);
+	    return -EDQUOT;
+	}
+    }
     init_tb_struct(th, &s_ins_balance, th->t_super, p_s_path, IH_SIZE + ih_item_len(p_s_ih));
 #ifdef DISPLACE_NEW_PACKING_LOCALITIES
     s_ins_balance.key = key->on_disk_key;
 #endif
-
-    /*
-    if (p_c_body == 0)
-      n_zeros_num = ih_item_len(p_s_ih);
-    */
-    //    le_key2cpu_key (&key, &(p_s_ih->ih_key));
+    /* DQUOT_* can schedule, must check to be sure calling fix_nodes is safe */
+    if (inode && fs_changed(fs_gen, inode->i_sb)) {
+	goto search_again;
+    }
 
     while ( (retval = fix_nodes(M_INSERT, &s_ins_balance, p_s_ih, p_c_body)) == REPEAT_SEARCH) {
+search_again:
 	/* file system changed while we were in the fix_nodes */
 	PROC_INFO_INC( th -> t_super, insert_item_restarted );
 	retval = search_item (th->t_super, key, p_s_path);
@@ -1883,8 +1994,8 @@
 	    goto error_out ;
 	}
 	if (retval == ITEM_FOUND) {
-	    reiserfs_warning ("PAP-5760: reiserfs_insert_item: "
-			      "key %K already exists in the tree\n", key);
+	    reiserfs_warning (th->t_super, "PAP-5760: reiserfs_insert_item: "
+			      "key %K already exists in the tree", key);
 	    retval = -EEXIST ;
 	    goto error_out; 
 	}
@@ -1900,6 +2011,11 @@
 error_out:
     /* also releases the path */
     unfix_nodes(&s_ins_balance);
+#ifdef REISERQUOTA_DEBUG
+    reiserfs_debug (th->t_super, "reiserquota insert_item(): freeing %u id=%u type=%c", quota_bytes, inode->i_uid, head2type(p_s_ih));
+#endif
+    if (inode)
+	DQUOT_FREE_SPACE_NODIRTY(inode, quota_bytes) ;
     return retval; 
 }
 
diff -Nru a/fs/reiserfs/super.c b/fs/reiserfs/super.c
--- a/fs/reiserfs/super.c	Tue Jun 15 22:20:40 2004
+++ b/fs/reiserfs/super.c	Tue Jun 15 22:20:40 2004
@@ -17,6 +17,8 @@
 #include <linux/time.h>
 #include <asm/uaccess.h>
 #include <linux/reiserfs_fs.h>
+#include <linux/reiserfs_acl.h>
+#include <linux/reiserfs_xattr.h>
 #include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <linux/blkdev.h>
@@ -113,7 +115,7 @@
      /* we are going to do one balancing */
      journal_begin (&th, s, JOURNAL_PER_BALANCE_CNT);
  
-     reiserfs_delete_solid_item (&th, key);
+     reiserfs_delete_solid_item (&th, NULL, key);
      if (oid_free)
         /* removals are protected by direct items */
         reiserfs_release_objectid (&th, le32_to_cpu (key->k_objectid));
@@ -148,7 +150,7 @@
     while (1) {
         retval = search_item (s, &max_cpu_key, &path);
         if (retval != ITEM_NOT_FOUND) {
-            reiserfs_warning ("vs-2140: finish_unfinished: search_by_key returned %d\n",
+            reiserfs_warning (s, "vs-2140: finish_unfinished: search_by_key returned %d",
                               retval);
             break;
         }
@@ -156,7 +158,7 @@
         bh = get_last_bh (&path);
         item_pos = get_item_pos (&path);
         if (item_pos != B_NR_ITEMS (bh)) {
-            reiserfs_warning ("vs-2060: finish_unfinished: wrong position found\n");
+            reiserfs_warning (s, "vs-2060: finish_unfinished: wrong position found");
             break;
         }
         item_pos --;
@@ -185,7 +187,7 @@
         if (!inode) {
             /* the unlink almost completed, it just did not manage to remove
 	       "save" link and release objectid */
-            reiserfs_warning ("vs-2180: finish_unfinished: iget failed for %K\n",
+            reiserfs_warning (s, "vs-2180: finish_unfinished: iget failed for %K",
                               &obj_key);
             remove_save_link_only (s, &save_link_key, 1);
             continue;
@@ -193,7 +195,7 @@
 
 	if (!truncate && inode->i_nlink) {
 	    /* file is not unlinked */
-            reiserfs_warning ("vs-2185: finish_unfinished: file %K is not unlinked\n",
+            reiserfs_warning (s, "vs-2185: finish_unfinished: file %K is not unlinked",
                               &obj_key);
             remove_save_link_only (s, &save_link_key, 0);
             continue;
@@ -204,7 +206,7 @@
 	       The only imaginable way is to execute unfinished truncate request
 	       then boot into old kernel, remove the file and create dir with
 	       the same key. */
-	    reiserfs_warning("green-2101: impossible truncate on a directory %k. Please report\n", INODE_PKEY (inode));
+	    reiserfs_warning(s, "green-2101: impossible truncate on a directory %k. Please report", INODE_PKEY (inode));
 	    remove_save_link_only (s, &save_link_key, 0);
 	    truncate = 0;
 	    iput (inode); 
@@ -215,14 +217,14 @@
             REISERFS_I(inode) -> i_flags |= i_link_saved_truncate_mask;
             /* not completed truncate found. New size was committed together
 	       with "save" link */
-            reiserfs_warning ("Truncating %k to %Ld ..",
+            reiserfs_info (s, "Truncating %k to %Ld ..",
                               INODE_PKEY (inode), inode->i_size);
             reiserfs_truncate_file (inode, 0/*don't update modification time*/);
             remove_save_link (inode, truncate);
         } else {
             REISERFS_I(inode) -> i_flags |= i_link_saved_unlink_mask;
             /* not completed unlink (rmdir) found */
-            reiserfs_warning ("Removing %k..", INODE_PKEY (inode));
+            reiserfs_info (s, "Removing %k..", INODE_PKEY (inode));
             /* removal gets completed in iput */
         }
  
@@ -234,7 +236,7 @@
      
     pathrelse (&path);
     if (done)
-        reiserfs_warning ("There were %d uncompleted unlinks/truncates. "
+        reiserfs_info (s, "There were %d uncompleted unlinks/truncates. "
                           "Completed\n", done);
 }
  
@@ -276,7 +278,7 @@
     } else {
 	/* truncate */
 	if (S_ISDIR (inode->i_mode))
-	    reiserfs_warning("green-2102: Adding a truncate savelink for a directory %k! Please report\n", INODE_PKEY(inode));
+	    reiserfs_warning(inode->i_sb, "green-2102: Adding a truncate savelink for a directory %k! Please report", INODE_PKEY(inode));
 	set_cpu_key_k_offset (&key, 1);
 	set_cpu_key_k_type (&key, TYPE_INDIRECT);
 
@@ -290,8 +292,8 @@
     retval = search_item (inode->i_sb, &key, &path);
     if (retval != ITEM_NOT_FOUND) {
 	if ( retval != -ENOSPC )
-	    reiserfs_warning ("vs-2100: add_save_link:"
-			  "search_by_key (%K) returned %d\n", &key, retval);
+	    reiserfs_warning (inode->i_sb, "vs-2100: add_save_link:"
+			  "search_by_key (%K) returned %d", &key, retval);
 	pathrelse (&path);
 	return;
     }
@@ -299,11 +301,11 @@
     /* body of "save" link */
     link = INODE_PKEY (inode)->k_dir_id;
 
-    /* put "save" link inot tree */
-    retval = reiserfs_insert_item (th, &path, &key, &ih, (char *)&link);
+    /* put "save" link inot tree, don't charge quota to anyone */
+    retval = reiserfs_insert_item (th, &path, &key, &ih, NULL, (char *)&link);
     if (retval) {
 	if (retval != -ENOSPC)
-	    reiserfs_warning ("vs-2120: add_save_link: insert_item returned %d\n",
+	    reiserfs_warning (inode->i_sb, "vs-2120: add_save_link: insert_item returned %d",
 			  retval);
     } else {
 	if( truncate )
@@ -342,7 +344,8 @@
           ( REISERFS_I(inode) -> i_flags & i_link_saved_truncate_mask ) ) ||
         ( !truncate && 
           ( REISERFS_I(inode) -> i_flags & i_link_saved_unlink_mask ) ) )
-	reiserfs_delete_solid_item (&th, &key);
+	/* don't take quota bytes from anywhere */
+	reiserfs_delete_solid_item (&th, NULL, &key);
     if (!truncate) {
 	reiserfs_release_objectid (&th, inode->i_ino);
 	REISERFS_I(inode) -> i_flags &= ~i_link_saved_unlink_mask;
@@ -357,7 +360,17 @@
 {
   int i;
   struct reiserfs_transaction_handle th ;
+
+  if (REISERFS_SB(s)->xattr_root) {
+    d_invalidate (REISERFS_SB(s)->xattr_root);
+    dput (REISERFS_SB(s)->xattr_root);
+  }
   
+  if (REISERFS_SB(s)->priv_root) {
+    d_invalidate (REISERFS_SB(s)->priv_root);
+    dput (REISERFS_SB(s)->priv_root);
+  }
+
   /* change file system state to current state if it was mounted with read-write permissions */
   if (!(s->s_flags & MS_RDONLY)) {
     journal_begin(&th, s, 10) ;
@@ -381,12 +394,12 @@
   print_statistics (s);
 
   if (REISERFS_SB(s)->s_kmallocs != 0) {
-    reiserfs_warning ("vs-2004: reiserfs_put_super: allocated memory left %d\n",
+    reiserfs_warning (s, "vs-2004: reiserfs_put_super: allocated memory left %d",
 		      REISERFS_SB(s)->s_kmallocs);
   }
 
   if (REISERFS_SB(s)->reserved_blocks != 0) {
-    reiserfs_warning ("green-2005: reiserfs_put_super: reserved blocks left %d\n",
+    reiserfs_warning (s, "green-2005: reiserfs_put_super: reserved blocks left %d",
 		      REISERFS_SB(s)->reserved_blocks);
   }
 
@@ -422,6 +435,8 @@
 	    SLAB_CTOR_CONSTRUCTOR) {
 		INIT_LIST_HEAD(&ei->i_prealloc_list) ;
 		inode_init_once(&ei->vfs_inode);
+		ei->i_acl_access = NULL;
+		ei->i_acl_default = NULL;
 	}
 }
  
@@ -439,7 +454,7 @@
 static void destroy_inodecache(void)
 {
 	if (kmem_cache_destroy(reiserfs_inode_cachep))
-		printk(KERN_INFO "reiserfs_inode_cache: not all structures were freed\n");
+		reiserfs_warning (NULL, "reiserfs_inode_cache: not all structures were freed");
 }
 
 /* we don't mark inodes dirty, we just log them */
@@ -447,7 +462,7 @@
     struct reiserfs_transaction_handle th ;
 
     if (inode->i_sb->s_flags & MS_RDONLY) {
-        reiserfs_warning("clm-6006: writing inode %lu on readonly FS\n", 
+        reiserfs_warning(inode->i_sb, "clm-6006: writing inode %lu on readonly FS",
 	                  inode->i_ino) ;
         return ;
     }
@@ -462,6 +477,22 @@
     reiserfs_write_unlock(inode->i_sb);
 }
 
+static void reiserfs_clear_inode (struct inode *inode)
+{
+    struct posix_acl *acl;
+
+    acl = REISERFS_I(inode)->i_acl_access;
+    if (acl && !IS_ERR (acl))
+        posix_acl_release (acl);
+    REISERFS_I(inode)->i_acl_access = NULL;
+
+    acl = REISERFS_I(inode)->i_acl_default;
+    if (acl && !IS_ERR (acl))
+        posix_acl_release (acl);
+    REISERFS_I(inode)->i_acl_default = NULL;
+}
+
+
 struct super_operations reiserfs_sops = 
 {
   .alloc_inode = reiserfs_alloc_inode,
@@ -469,6 +500,7 @@
   .write_inode = reiserfs_write_inode,
   .dirty_inode = reiserfs_dirty_inode,
   .delete_inode = reiserfs_delete_inode,
+  .clear_inode  = reiserfs_clear_inode,
   .put_super = reiserfs_put_super,
   .write_super = reiserfs_write_super,
   .write_super_lockfs = reiserfs_write_super_lockfs,
@@ -595,7 +627,7 @@
 	}
     }
     if (!opt->option_name) {
-	printk ("reiserfs_getopt: unknown option \"%s\"\n", p);
+	reiserfs_warning (s, "unknown mount option \"%s\"", p);
 	return -1;
     }
     
@@ -603,7 +635,7 @@
     switch (*p) {
     case '=':
 	if (!opt->arg_required) {
-	    printk ("reiserfs_getopt: the option \"%s\" does not require an argument\n",
+	    reiserfs_warning (s, "the option \"%s\" does not require an argument",
 		    opt->option_name);
 	    return -1;
 	}
@@ -611,12 +643,12 @@
 	
     case 0:
 	if (opt->arg_required) {
-	    printk ("reiserfs_getopt: the option \"%s\" requires an argument\n", opt->option_name);
+	    reiserfs_warning (s, "the option \"%s\" requires an argument", opt->option_name);
 	    return -1;
 	}
 	break;
     default:
-	printk ("reiserfs_getopt: head of option \"%s\" is only correct\n", opt->option_name);
+	reiserfs_warning (s, "head of option \"%s\" is only correct", opt->option_name);
 	return -1;
     }
 	
@@ -625,7 +657,7 @@
     
     if ( opt->arg_required && !strlen (p) ) {
 	/* this catches "option=," */
-	printk ("reiserfs_getopt: empty argument for \"%s\"\n", opt->option_name);
+	reiserfs_warning (s, "empty argument for \"%s\"", opt->option_name);
 	return -1;
     }
     
@@ -646,7 +678,7 @@
 	}
     }
     
-    printk ("reiserfs_getopt: bad value \"%s\" for option \"%s\"\n", p, opt->option_name);
+    reiserfs_warning (s, "bad value \"%s\" for option \"%s\"", p, opt->option_name);
     return -1;
 }
 
@@ -669,6 +701,12 @@
 	{"conv", 0, 0, 1<<REISERFS_CONVERT, 0},
 	{"attrs", 0, 0, 1<<REISERFS_ATTRS, 0},
 	{"noattrs", 0, 0, 0, 1<<REISERFS_ATTRS},
+	{"user_xattr", 0, 0, 1<<REISERFS_XATTRS_USER, 0},
+	{"nouser_xattr", 0, 0, 0, 1<<REISERFS_XATTRS_USER},
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
+	{"acl", 0, 0, 1<<REISERFS_POSIXACL, 0},
+	{"noacl", 0, 0, 0, 1<<REISERFS_POSIXACL},
+#endif
 	{"nolog", 0, 0, 0, 0}, /* This is unsupported */
 	{"replayonly", 0, 0, 1<<REPLAYONLY, 0},
 	{"block-allocator", 'a', balloc, 0, 0},
@@ -677,6 +715,8 @@
 	{"jdev", 'j', 0, 0, 0},
 	{"nolargeio", 'w', 0, 0, 0},
 	{"commit", 'c', 0, 0, 0},
+	{"usrquota", 0, 0, 0, 0},
+	{"grpquota", 0, 0, 0, 0},
 	{NULL, 0, 0, 0, 0}
     };
 	
@@ -700,20 +740,19 @@
 	    *blocks = simple_strtoul (arg, &p, 0);
 	    if (*p != '\0') {
 		/* NNN does not look like a number */
-		printk ("reiserfs_parse_options: bad value %s\n", arg);
+		reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg);
 		return 0;
 	    }
 	}
 
 	if ( c == 'c' ) {
 		char *p = 0;
-		int val = simple_strtoul (arg, &p, 0);
+		unsigned long val = simple_strtoul (arg, &p, 0);
 		/* commit=NNN (time in seconds) */
-		if ( *p != '\0' || val < 0) {
-			printk ("reiserfs_parse_options: bad value %s\n", arg);
-			return 0;
+		if ( *p != '\0' || val >= (unsigned int)-1) {
+			reiserfs_warning (s, "reiserfs_parse_options: bad value %s", arg);			return 0;
 		}
-		*commit_max_age = val;
+		*commit_max_age = (unsigned int)val;
 	}
 
 	if ( c == 'w' ) {
@@ -721,7 +760,7 @@
 		int val = simple_strtoul (arg, &p, 0);
 
 		if ( *p != '\0') {
-		    printk ("reiserfs_parse_options: non-numeric value %s for nolargeio option\n", arg);
+		    reiserfs_warning (s, "reiserfs_parse_options: non-numeric value %s for nolargeio option", arg);
 		    return 0;
 		}
 		if ( val ) 
@@ -733,7 +772,7 @@
 	if (c == 'j') {
 	    if (arg && *arg && jdev_name) {
 		if ( *jdev_name ) { //Hm, already assigned?
-		    printk("reiserfs_parse_options: journal device was already  specified to be %s\n", *jdev_name);
+		    reiserfs_warning (s, "reiserfs_parse_options: journal device was already  specified to be %s", *jdev_name);
 		    return 0;
 		}
 		*jdev_name = arg;
@@ -756,17 +795,17 @@
     if (mount_options & (1 << REISERFS_DATA_LOG)) {
         if (!reiserfs_data_log(s)) {
 	    switch_data_mode(s, REISERFS_DATA_LOG);
-	    printk("reiserfs: switching to journaled data mode\n");
+	    reiserfs_info (s, "switching to journaled data mode\n");
 	}
     } else if (mount_options & (1 << REISERFS_DATA_ORDERED)) {
         if (!reiserfs_data_ordered(s)) {
 	    switch_data_mode(s, REISERFS_DATA_ORDERED);
-	    printk("reiserfs: switching to ordered data mode\n");
+	    reiserfs_info (s, "switching to ordered data mode\n");
 	}
     } else if (mount_options & (1 << REISERFS_DATA_WRITEBACK)) {
         if (!reiserfs_data_writeback(s)) {
 	    switch_data_mode(s, REISERFS_DATA_WRITEBACK);
-	    printk("reiserfs: switching to writeback data mode\n");
+	    reiserfs_info (s, "switching to writeback data mode\n");
 	}
     }
 }
@@ -778,12 +817,12 @@
 	if( reiserfs_attrs( s ) ) {
 		rs = SB_DISK_SUPER_BLOCK (s);
 		if( old_format_only(s) ) {
-			reiserfs_warning( "reiserfs: cannot support attributes on 3.5.x disk format\n" );
+			reiserfs_warning(s, "reiserfs: cannot support attributes on 3.5.x disk format" );
 			REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS );
 			return;
 		}
 		if( !( le32_to_cpu( rs -> s_flags ) & reiserfs_attrs_cleared ) ) {
-				reiserfs_warning( "reiserfs: cannot support attributes until flag is set in super-block\n" );
+				reiserfs_warning(s, "reiserfs: cannot support attributes until flag is set in super-block" );
 				REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS );
 		}
 	}
@@ -796,7 +835,7 @@
   unsigned long blocks;
   unsigned long mount_options = REISERFS_SB(s)->s_mount_opt;
   unsigned long safe_mask = 0;
-  unsigned int commit_max_age = 0;
+  unsigned int commit_max_age = (unsigned int)-1;
 
   rs = SB_DISK_SUPER_BLOCK (s);
 
@@ -813,16 +852,18 @@
   safe_mask |= 1 << REISERFS_HASHED_RELOCATION;
   safe_mask |= 1 << REISERFS_TEST4;
   safe_mask |= 1 << REISERFS_ATTRS;
+  safe_mask |= 1 << REISERFS_XATTRS_USER;
+  safe_mask |= 1 << REISERFS_POSIXACL;
 
   /* Update the bitmask, taking care to keep
    * the bits we're not allowed to change here */
   REISERFS_SB(s)->s_mount_opt = (REISERFS_SB(s)->s_mount_opt & ~safe_mask) |  (mount_options & safe_mask);
 
-  if(commit_max_age != 0) {
+  if(commit_max_age != 0 && commit_max_age != (unsigned int)-1) {
     SB_JOURNAL_MAX_COMMIT_AGE(s) = commit_max_age;
     SB_JOURNAL_MAX_TRANS_AGE(s) = commit_max_age;
   }
-  else
+  else if(commit_max_age == 0)
   {
     /* 0 means restore defaults. */
     SB_JOURNAL_MAX_COMMIT_AGE(s) = SB_JOURNAL_DEFAULT_MAX_COMMIT_AGE(s);
@@ -836,6 +877,7 @@
   }
 
   if (*mount_flags & MS_RDONLY) {
+    reiserfs_xattr_init (s, *mount_flags);
     /* remount read-only */
     if (s->s_flags & MS_RDONLY)
       /* it is read-only already */
@@ -852,8 +894,10 @@
     journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
   } else {
     /* remount read-write */
-    if (!(s->s_flags & MS_RDONLY))
+    if (!(s->s_flags & MS_RDONLY)) {
+	reiserfs_xattr_init (s, *mount_flags);
 	return 0; /* We are read-write already */
+    }
 
     handle_data_mode(s, mount_options);
     REISERFS_SB(s)->s_mount_state = sb_umount_state(rs) ;
@@ -874,8 +918,10 @@
   journal_end(&th, s, 10) ;
   s->s_dirt = 0;
 
-  if (!( *mount_flags & MS_RDONLY ) )
+  if (!( *mount_flags & MS_RDONLY ) ) {
     finish_unfinished( s );
+    reiserfs_xattr_init (s, *mount_flags);
+  }
 
   return 0;
 }
@@ -926,7 +972,7 @@
 
 #ifdef CONFIG_REISERFS_CHECK
 // This outputs a lot of unneded info on big FSes
-//    reiserfs_warning ("bitmap loaded from block %d: %d free blocks\n",
+//    reiserfs_warning ("bitmap loaded from block %d: %d free blocks",
 //		      bi->bh->b_blocknr, bi->free_count);
 #endif
 }
@@ -948,8 +994,8 @@
     for (i = 0; i < SB_BMAP_NR(s); i++) {
 	wait_on_buffer(SB_AP_BITMAP (s)[i].bh);
 	if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) {
-	    reiserfs_warning("sh-2029: reiserfs read_bitmaps: "
-			 "bitmap block (#%lu) reading failed\n",
+	    reiserfs_warning(s,"sh-2029: reiserfs read_bitmaps: "
+			 "bitmap block (#%lu) reading failed",
 			 SB_AP_BITMAP(s)[i].bh->b_blocknr);
 	    for (i = 0; i < SB_BMAP_NR(s); i++)
 		brelse(SB_AP_BITMAP(s)[i].bh);
@@ -999,7 +1045,7 @@
   }
 
   if (free != SB_FREE_BLOCKS (s))
-    reiserfs_warning ("vs-4000: check_bitmap: %d free blocks, must be %d\n",
+    reiserfs_warning (s,"vs-4000: check_bitmap: %d free blocks, must be %d",
 		      free, SB_FREE_BLOCKS (s));
 }
 
@@ -1012,8 +1058,8 @@
 
     bh = sb_bread (s, offset / s->s_blocksize);
     if (!bh) {
-      printk ("sh-2006: read_super_block: "
-              "bread failed (dev %s, block %lu, size %lu)\n",
+      reiserfs_warning (s, "sh-2006: read_super_block: "
+              "bread failed (dev %s, block %lu, size %lu)",
               reiserfs_bdevname (s), offset / s->s_blocksize, s->s_blocksize);
       return 1;
     }
@@ -1033,7 +1079,7 @@
     
     bh = sb_bread (s, offset / s->s_blocksize);
     if (!bh) {
-	printk("sh-2007: read_super_block: "
+	reiserfs_warning (s, "sh-2007: read_super_block: "
                 "bread failed (dev %s, block %lu, size %lu)\n",
                 reiserfs_bdevname (s), offset / s->s_blocksize, s->s_blocksize);
 	return 1;
@@ -1041,7 +1087,7 @@
     
     rs = (struct reiserfs_super_block *)bh->b_data;
     if (sb_blocksize(rs) != s->s_blocksize) {
-	printk ("sh-2011: read_super_block: "
+	reiserfs_warning (s, "sh-2011: read_super_block: "
 		"can't find a reiserfs filesystem on (dev %s, block %Lu, size %lu)\n",
 		reiserfs_bdevname (s), (unsigned long long)bh->b_blocknr, s->s_blocksize);
 	brelse (bh);
@@ -1050,9 +1096,9 @@
 
     if ( rs->s_v1.s_root_block == -1 ) {
        brelse(bh) ;
-       printk("dev %s: Unfinished reiserfsck --rebuild-tree run detected. Please run\n"
+       reiserfs_warning (s, "Unfinished reiserfsck --rebuild-tree run detected. Please run\n"
               "reiserfsck --rebuild-tree and wait for a completion. If that fails\n"
-              "get newer reiserfsprogs package\n", reiserfs_bdevname (s));
+              "get newer reiserfsprogs package");
        return 1;
     }
 
@@ -1063,21 +1109,22 @@
 	/* magic is of non-standard journal filesystem, look at s_version to
 	   find which format is in use */
 	if (sb_version(rs) == REISERFS_VERSION_2)
-	  printk ("read_super_block: found reiserfs format \"3.6\" "
-		  "with non-standard journal\n");
+	  reiserfs_warning (s, "read_super_block: found reiserfs format \"3.6\""
+		  " with non-standard journal");
 	else if (sb_version(rs) == REISERFS_VERSION_1)
-	  printk ("read_super_block: found reiserfs format \"3.5\" "
-		  "with non-standard journal\n");
+	  reiserfs_warning (s, "read_super_block: found reiserfs format \"3.5\""
+		  " with non-standard journal");
 	else {
-	  printk ("sh-2012: read_super_block: found unknown format \"%u\" "
-	            "of reiserfs with non-standard magic\n", sb_version(rs));
+	  reiserfs_warning (s, "sh-2012: read_super_block: found unknown "
+			    "format \"%u\" of reiserfs with non-standard magic",
+			    sb_version(rs));
 	return 1;
 	}
     }
     else
       /* s_version of standard format may contain incorrect information,
 	 so we just look at the magic string */
-      printk ("found reiserfs format \"%s\" with standard journal\n",
+      reiserfs_info (s, "found reiserfs format \"%s\" with standard journal\n",
 	      is_reiserfs_3_5 (rs) ? "3.5" : "3.6");
 
     s->s_op = &reiserfs_sops;
@@ -1098,7 +1145,7 @@
   ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s))) ;
   wait_on_buffer(SB_BUFFER_WITH_SB(s)) ;
   if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
-    printk("reread_meta_blocks, error reading the super\n") ;
+    reiserfs_warning (s, "reread_meta_blocks, error reading the super") ;
     return 1 ;
   }
 
@@ -1106,7 +1153,7 @@
     ll_rw_block(READ, 1, &(SB_AP_BITMAP(s)[i].bh)) ;
     wait_on_buffer(SB_AP_BITMAP(s)[i].bh) ;
     if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) {
-      printk("reread_meta_blocks, error reading bitmap block number %d at %llu\n", 
+      reiserfs_warning (s, "reread_meta_blocks, error reading bitmap block number %d at %llu",
         i, (unsigned long long)SB_AP_BITMAP(s)[i].bh->b_blocknr) ;
       return 1 ;
     }
@@ -1153,8 +1200,8 @@
 	    if (reiserfs_rupasov_hash(s)) {
 		hash = YURA_HASH ;
 	    }
-	    reiserfs_warning("reiserfs: FS seems to be empty, autodetect "
-	                     "is using the default hash\n");
+	    reiserfs_warning(s,"FS seems to be empty, autodetect "
+	                     "is using the default hash");
 	    break;
 	}
 	r5hash=GET_HASH_VALUE (r5_hash (de.de_name, de.de_namelen));
@@ -1163,9 +1210,9 @@
 	if ( ( (teahash == r5hash) && (GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash) ) ||
 	     ( (teahash == yurahash) && (yurahash == GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])))) ) ||
 	     ( (r5hash == yurahash) && (yurahash == GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])))) ) ) {
-	    reiserfs_warning("reiserfs: Unable to automatically detect hash"
-		"function for device %s\n"
-		"please mount with -o hash={tea,rupasov,r5}\n", reiserfs_bdevname (s));
+	    reiserfs_warning(s,"Unable to automatically detect hash function. "
+			     "Please mount with -o hash={tea,rupasov,r5}",
+			     reiserfs_bdevname (s));
 	    hash = UNSET_HASH;
 	    break;
 	}
@@ -1176,8 +1223,7 @@
 	else if (GET_HASH_VALUE( deh_offset(&(de.de_deh[de.de_entry_num])) ) == r5hash)
 	    hash = R5_HASH;
 	else {
-	    reiserfs_warning("reiserfs: Unrecognised hash function for "
-			     "device %s\n", reiserfs_bdevname (s));
+	    reiserfs_warning (s,"Unrecognised hash function");
 	    hash = UNSET_HASH;
 	}
     } while (0);
@@ -1205,16 +1251,16 @@
 	** mount options 
 	*/
 	if (reiserfs_rupasov_hash(s) && code != YURA_HASH) {
-	    printk("REISERFS: Error, %s hash detected, "
-		   "unable to force rupasov hash\n", reiserfs_hashname(code)) ;
+	    reiserfs_warning (s, "Error, %s hash detected, "
+		   "unable to force rupasov hash", reiserfs_hashname(code)) ;
 	    code = UNSET_HASH ;
 	} else if (reiserfs_tea_hash(s) && code != TEA_HASH) {
-	    printk("REISERFS: Error, %s hash detected, "
-		   "unable to force tea hash\n", reiserfs_hashname(code)) ;
+	    reiserfs_warning (s, "Error, %s hash detected, "
+		   "unable to force tea hash", reiserfs_hashname(code)) ;
 	    code = UNSET_HASH ;
 	} else if (reiserfs_r5_hash(s) && code != R5_HASH) {
-	    printk("REISERFS: Error, %s hash detected, "
-		   "unable to force r5 hash\n", reiserfs_hashname(code)) ;
+	    reiserfs_warning (s, "Error, %s hash detected, "
+		   "unable to force r5 hash", reiserfs_hashname(code)) ;
 	    code = UNSET_HASH ;
 	} 
     } else { 
@@ -1244,13 +1290,13 @@
 {
     switch (what_hash (s)) {
     case TEA_HASH:
-	reiserfs_warning ("Using tea hash to sort names\n");
+	reiserfs_info (s, "Using tea hash to sort names\n");
 	return keyed_hash;
     case YURA_HASH:
-	reiserfs_warning ("Using rupasov hash to sort names\n");
+	reiserfs_info (s, "Using rupasov hash to sort names\n");
 	return yura_hash;
     case R5_HASH:
-	reiserfs_warning ("Using r5 hash to sort names\n");
+	reiserfs_info (s, "Using r5 hash to sort names\n");
 	return r5_hash;
     }
     return NULL;
@@ -1271,9 +1317,9 @@
     return 0;
 }
 
-#define SPRINTK(silent, ...)			\
+#define SWARN(silent, s, ...)			\
 	if (!(silent))				\
-		printk(__VA_ARGS__)
+		reiserfs_warning (s, __VA_ARGS__)
 
 static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
 {
@@ -1282,7 +1328,7 @@
     struct reiserfs_transaction_handle th ;
     int old_format = 0;
     unsigned long blocks;
-	unsigned int commit_max_age = 0;
+    unsigned int commit_max_age = 0;
     int jinit_done = 0 ;
     struct reiserfs_iget_args args ;
     struct reiserfs_super_block * rs;
@@ -1305,6 +1351,8 @@
     REISERFS_SB(s)->s_alloc_options.preallocmin = 4;
     /* Preallocate by 16 blocks (17-1) at once */
     REISERFS_SB(s)->s_alloc_options.preallocsize = 17;
+    /* Initialize the rwsem for xattr dir */
+    init_rwsem(&REISERFS_SB(s)->xattr_dir_sem);
 
     jdev_name = NULL;
     if (reiserfs_parse_options (s, (char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name, &commit_max_age) == 0) {
@@ -1312,7 +1360,8 @@
     }
 
     if (blocks) {
-	SPRINTK(silent, "jmacd-7: reiserfs_fill_super: resize option for remount only\n");
+	SWARN (silent, s, "jmacd-7: reiserfs_fill_super: resize option "
+	       "for remount only");
 	goto error;
     }	
 
@@ -1321,7 +1370,7 @@
       old_format = 1;
     /* try new format (64-th 1k block), which can contain reiserfs super block */
     else if (read_super_block (s, REISERFS_DISK_OFFSET_IN_BYTES)) {
-      SPRINTK(silent, "sh-2021: reiserfs_fill_super: can not find reiserfs on %s\n", reiserfs_bdevname (s));
+      SWARN(silent, s, "sh-2021: reiserfs_fill_super: can not find reiserfs on %s", reiserfs_bdevname (s));
       goto error;
     }
 
@@ -1330,9 +1379,9 @@
        smaller than the filesystem. If the check fails then abort and scream,
        because bad stuff will happen otherwise. */
     if ( s->s_bdev && s->s_bdev->bd_inode && i_size_read(s->s_bdev->bd_inode) < sb_block_count(rs)*sb_blocksize(rs)) {
-	SPRINTK(silent, "Filesystem on %s cannot be mounted because it is bigger than the device\n", reiserfs_bdevname(s));
-	SPRINTK(silent, "You may need to run fsck or increase size of your LVM partition\n");
-	SPRINTK(silent, "Or may be you forgot to reboot after fdisk when it told you to\n");
+	SWARN (silent, s, "Filesystem on %s cannot be mounted because it is bigger than the device", reiserfs_bdevname(s));
+	SWARN(silent, s, "You may need to run fsck or increase size of your LVM partition");
+	SWARN(silent, s, "Or may be you forgot to reboot after fdisk when it told you to");
 	goto error;
     }
 
@@ -1340,12 +1389,12 @@
     sbi->s_mount_state = REISERFS_VALID_FS ;
 
     if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
-	SPRINTK(silent, "jmacd-8: reiserfs_fill_super: unable to read bitmap\n");
+	SWARN(silent, s, "jmacd-8: reiserfs_fill_super: unable to read bitmap");
 	goto error;
     }
 #ifdef CONFIG_REISERFS_CHECK
-    SPRINTK(silent, "reiserfs:warning: CONFIG_REISERFS_CHECK is set ON\n");
-    SPRINTK(silent, "reiserfs:warning: - it is slow mode for debugging.\n");
+    SWARN (silent, s, "CONFIG_REISERFS_CHECK is set ON");
+    SWARN (silent, s, "- it is slow mode for debugging.");
 #endif
 
     /* make data=ordered the default */
@@ -1356,16 +1405,16 @@
     }
 
     if (reiserfs_data_log(s)) {
-        printk("reiserfs: using journaled data mode\n");
+        reiserfs_info (s, "using journaled data mode\n");
     } else if (reiserfs_data_ordered(s)) {
-        printk("reiserfs: using ordered data mode\n");
+        reiserfs_info (s, "using ordered data mode\n");
     } else {
-        printk("reiserfs: using writeback data mode\n");
+        reiserfs_info (s, "using writeback data mode\n");
     }
 
     // set_device_ro(s->s_dev, 1) ;
     if( journal_init(s, jdev_name, old_format, commit_max_age) ) {
-	SPRINTK(silent, "sh-2022: reiserfs_fill_super: unable to initialize journal space\n") ;
+	SWARN(silent, s, "sh-2022: reiserfs_fill_super: unable to initialize journal space") ;
 	goto error ;
     } else {
 	jinit_done = 1 ; /* once this is set, journal_release must be called
@@ -1373,7 +1422,7 @@
 			 */
     }
     if (reread_meta_blocks(s)) {
-	SPRINTK(silent, "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init\n") ;
+	SWARN(silent, s, "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init") ;
 	goto error ;
     }
 
@@ -1381,14 +1430,14 @@
 	goto error;
 
     if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {
-        SPRINTK(silent, "clm-7000: Detected readonly device, marking FS readonly\n") ;
+        SWARN(silent, s, "clm-7000: Detected readonly device, marking FS readonly") ;
 	s->s_flags |= MS_RDONLY ;
     }
     args.objectid = REISERFS_ROOT_OBJECTID ;
     args.dirid = REISERFS_ROOT_PARENT_OBJECTID ;
     root_inode = iget5_locked (s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor, reiserfs_init_locked_inode, (void *)(&args));
     if (!root_inode) {
-	SPRINTK(silent, "jmacd-10: reiserfs_fill_super: get root inode failed\n");
+	SWARN(silent, s, "jmacd-10: reiserfs_fill_super: get root inode failed");
 	goto error;
     }
 
@@ -1430,7 +1479,7 @@
 	  if (convert_reiserfs (s)) {
 	    /* and -o conv is given */
 	    if(!silent)
-	      reiserfs_warning ("reiserfs: converting 3.5 filesystem to the 3.6 format\n") ;
+	      reiserfs_info (s,"converting 3.5 filesystem to the 3.6 format") ;
 
 	    if (is_reiserfs_3_5 (rs))
 	      /* put magic string of 3.6 format. 2.2 will not be able to
@@ -1443,18 +1492,30 @@
 	    set_bit(REISERFS_3_6, &(sbi->s_properties));
 	    clear_bit(REISERFS_3_5, &(sbi->s_properties));
 	  } else if (!silent){
-	    reiserfs_warning("reiserfs: using 3.5.x disk format\n") ;
+	    reiserfs_info (s, "using 3.5.x disk format\n") ;
 	  }
 	}
 
 	journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB (s));
 	journal_end(&th, s, 1) ;
-	
+
+	if (reiserfs_xattr_init (s, s->s_flags)) {
+	    dput (s->s_root);
+	    s->s_root = NULL;
+	    goto error;
+	}
+
 	/* look for files which were to be removed in previous session */
 	finish_unfinished (s);
     } else {
 	if ( old_format_only(s) && !silent) {
-	    reiserfs_warning("reiserfs: using 3.5.x disk format\n") ;
+	    reiserfs_info (s, "using 3.5.x disk format\n") ;
+	}
+
+	if (reiserfs_xattr_init (s, s->s_flags)) {
+	    dput (s->s_root);
+	    s->s_root = NULL;
+	    goto error;
 	}
     }
     // mark hash in super block: it could be unset. overwrite should be ok
@@ -1523,6 +1584,9 @@
 		return ret;
 	}
 
+        if ((ret = reiserfs_xattr_register_handlers ()))
+            goto failed_reiserfs_xattr_register_handlers;
+
 	reiserfs_proc_info_global_init ();
 	reiserfs_proc_register_global ("version", reiserfs_global_version_in_proc);
 
@@ -1532,6 +1596,9 @@
 		return 0;
 	}
 
+        reiserfs_xattr_unregister_handlers ();
+
+failed_reiserfs_xattr_register_handlers:
 	reiserfs_proc_unregister_global ("version");
 	reiserfs_proc_info_global_done ();
 	destroy_inodecache ();
@@ -1542,6 +1609,7 @@
 static void __exit
 exit_reiserfs_fs ( void )
 {
+        reiserfs_xattr_unregister_handlers ();
 	reiserfs_proc_unregister_global ("version");
 	reiserfs_proc_info_global_done ();
         unregister_filesystem (& reiserfs_fs_type);
diff -Nru a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
--- a/fs/reiserfs/tail_conversion.c	Tue Jun 15 22:21:05 2004
+++ b/fs/reiserfs/tail_conversion.c	Tue Jun 15 22:21:05 2004
@@ -50,9 +50,9 @@
 
     // FIXME: we could avoid this 
     if ( search_for_position_by_key (sb, &end_key, path) == POSITION_FOUND ) {
-	reiserfs_warning ("PAP-14030: direct2indirect: "
+	reiserfs_warning (sb, "PAP-14030: direct2indirect: "
 			"pasted or inserted byte exists in the tree %K. "
-			"Use fsck to repair.\n", &end_key);
+			"Use fsck to repair.", &end_key);
 	pathrelse(path);
 	return -EIO;
     }
@@ -66,11 +66,11 @@
 	set_ih_free_space (&ind_ih, 0); /* delete at nearest future */
         put_ih_item_len( &ind_ih, UNFM_P_SIZE );
 	PATH_LAST_POSITION (path)++;
-	n_retval = reiserfs_insert_item (th, path, &end_key, &ind_ih, 
+	n_retval = reiserfs_insert_item (th, path, &end_key, &ind_ih, inode,
 					 (char *)&unfm_ptr);
     } else {
 	/* Paste into last indirect item of an object. */
-	n_retval = reiserfs_paste_into_item(th, path, &end_key,
+	n_retval = reiserfs_paste_into_item(th, path, &end_key, inode,
 					    (char *)&unfm_ptr, UNFM_P_SIZE);
     }
     if ( n_retval ) {
@@ -274,7 +274,7 @@
     set_cpu_key_k_type (&key, TYPE_DIRECT);
     key.key_length = 4;
     /* Insert tail as new direct item in the tree */
-    if ( reiserfs_insert_item(th, p_s_path, &key, &s_ih,
+    if ( reiserfs_insert_item(th, p_s_path, &key, &s_ih, p_s_inode,
 			      tail ? tail : NULL) < 0 ) {
 	/* No disk memory. So we can not convert last unformatted node
 	   to the direct item.  In this case we used to adjust
@@ -292,13 +292,15 @@
     */
     unmap_buffers(page, pos1) ;
 
+    /* make sure to get the i_blocks changes from reiserfs_insert_item */
+    reiserfs_update_sd(th, p_s_inode);
+
     // note: we have now the same as in above direct2indirect
     // conversion: there are two keys which have matching first three
     // key components. They only differ by the fouhth one.
 
     /* We have inserted new direct item and must remove last
        unformatted node. */
-    p_s_inode->i_blocks += (p_s_sb->s_blocksize / 512);
     *p_c_mode = M_CUT;
 
     /* we store position of first direct item in the in-core inode */
diff -Nru a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/reiserfs/xattr.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1441 @@
+/*
+ * linux/fs/reiserfs/xattr.c
+ *
+ * Copyright (c) 2002 by Jeff Mahoney, <jeffm@suse.com>
+ *
+ */
+
+/*
+ * In order to implement EA/ACLs in a clean, backwards compatible manner,
+ * they are implemented as files in a "private" directory.
+ * Each EA is in it's own file, with the directory layout like so (/ is assumed
+ * to be relative to fs root). Inside the /.reiserfs_priv/xattrs directory,
+ * directories named using the capital-hex form of the objectid and
+ * generation number are used. Inside each directory are individual files
+ * named with the name of the extended attribute.
+ *
+ * So, for objectid 12648430, we could have:
+ * /.reiserfs_priv/xattrs/C0FFEE.0/system.posix_acl_access
+ * /.reiserfs_priv/xattrs/C0FFEE.0/system.posix_acl_default
+ * /.reiserfs_priv/xattrs/C0FFEE.0/user.Content-Type
+ * .. or similar.
+ *
+ * The file contents are the text of the EA. The size is known based on the
+ * stat data describing the file.
+ *
+ * In the case of system.posix_acl_access and system.posix_acl_default, since
+ * these are special cases for filesystem ACLs, they are interpreted by the
+ * kernel, in addition, they are negatively and positively cached and attached
+ * to the inode so that unnecessary lookups are avoided.
+ */
+
+#include <linux/reiserfs_fs.h>
+#include <linux/dcache.h>
+#include <linux/namei.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/file.h>
+#include <linux/pagemap.h>
+#include <linux/xattr.h>
+#include <linux/reiserfs_xattr.h>
+#include <linux/reiserfs_acl.h>
+#include <linux/mbcache.h>
+#include <asm/uaccess.h>
+#include <asm/checksum.h>
+#include <linux/smp_lock.h>
+#include <linux/stat.h>
+#include <asm/semaphore.h>
+
+#define FL_READONLY 128
+#define FL_DIR_SEM_HELD 256
+#define PRIVROOT_NAME ".reiserfs_priv"
+#define XAROOT_NAME   "xattrs"
+
+static struct reiserfs_xattr_handler *find_xattr_handler_prefix (const char *prefix);
+
+static struct dentry *
+create_xa_root (struct super_block *sb)
+{
+    struct dentry *privroot = dget (REISERFS_SB(sb)->priv_root);
+    struct dentry *xaroot;
+
+    /* This needs to be created at mount-time */
+    if (!privroot)
+        return ERR_PTR(-EOPNOTSUPP);
+
+    xaroot = lookup_one_len (XAROOT_NAME, privroot, strlen (XAROOT_NAME));
+    if (IS_ERR (xaroot)) {
+        goto out;
+    } else if (!xaroot->d_inode) {
+        int err;
+        down (&privroot->d_inode->i_sem);
+        err = privroot->d_inode->i_op->mkdir (privroot->d_inode, xaroot, 0700);
+        up (&privroot->d_inode->i_sem);
+
+        if (err) {
+            dput (xaroot);
+            dput (privroot);
+            return ERR_PTR (err);
+        }
+        REISERFS_SB(sb)->xattr_root = dget (xaroot);
+    }
+
+out:
+    dput (privroot);
+    return xaroot;
+}
+
+/* This will return a dentry, or error, refering to the xa root directory.
+ * If the xa root doesn't exist yet, the dentry will be returned without
+ * an associated inode. This dentry can be used with ->mkdir to create
+ * the xa directory. */
+static struct dentry *
+__get_xa_root (struct super_block *s)
+{
+    struct dentry *privroot = dget (REISERFS_SB(s)->priv_root);
+    struct dentry *xaroot = NULL;
+
+    if (IS_ERR (privroot) || !privroot)
+        return privroot;
+
+    xaroot = lookup_one_len (XAROOT_NAME, privroot, strlen (XAROOT_NAME));
+    if (IS_ERR (xaroot)) {
+        goto out;
+    } else if (!xaroot->d_inode) {
+        dput (xaroot);
+        xaroot = NULL;
+        goto out;
+    }
+
+    REISERFS_SB(s)->xattr_root = dget (xaroot);
+
+out:
+    dput (privroot);
+    return xaroot;
+}
+
+/* Returns the dentry (or NULL) referring to the root of the extended
+ * attribute directory tree. If it has already been retreived, it is used.
+ * Otherwise, we attempt to retreive it from disk. It may also return
+ * a pointer-encoded error.
+ */
+static inline struct dentry *
+get_xa_root (struct super_block *s)
+{
+    struct dentry *dentry = dget (REISERFS_SB(s)->xattr_root);
+
+    if (!dentry)
+        dentry = __get_xa_root (s);
+
+    return dentry;
+}
+
+/* Opens the directory corresponding to the inode's extended attribute store.
+ * If flags allow, the tree to the directory may be created. If creation is
+ * prohibited, -ENODATA is returned. */
+static struct dentry *
+open_xa_dir (const struct inode *inode, int flags)
+{
+    struct dentry *xaroot, *xadir;
+    char namebuf[17];
+
+    xaroot = get_xa_root (inode->i_sb);
+    if (IS_ERR (xaroot)) {
+        return xaroot;
+    } else if (!xaroot) {
+        if (flags == 0 || flags & XATTR_CREATE) {
+            xaroot = create_xa_root (inode->i_sb);
+            if (IS_ERR (xaroot))
+                return xaroot;
+        }
+        if (!xaroot)
+            return ERR_PTR (-ENODATA);
+    }
+
+    /* ok, we have xaroot open */
+
+    snprintf (namebuf, sizeof (namebuf), "%X.%X",
+              le32_to_cpu (INODE_PKEY (inode)->k_objectid),
+              inode->i_generation);
+    xadir = lookup_one_len (namebuf, xaroot, strlen (namebuf));
+    if (IS_ERR (xadir)) {
+        dput (xaroot);
+        return xadir;
+    }
+
+    if (!xadir->d_inode) {
+        int err;
+        if (flags == 0 || flags & XATTR_CREATE) {
+            /* Although there is nothing else trying to create this directory,
+             * another directory with the same hash may be created, so we need
+             * to protect against that */
+            err = xaroot->d_inode->i_op->mkdir (xaroot->d_inode, xadir, 0700);
+            if (err) {
+                dput (xaroot);
+                dput (xadir);
+                return ERR_PTR (err);
+            }
+        }
+        if (!xadir->d_inode) {
+            dput (xaroot);
+            dput (xadir);
+            return ERR_PTR (-ENODATA);
+        }
+        /* Newly created object.. Need to mark it private */
+        REISERFS_I(xadir->d_inode)->i_flags |= i_priv_object;
+    }
+
+    dput (xaroot);
+    return xadir;
+}
+
+/* Returns a dentry corresponding to a specific extended attribute file
+ * for the inode. If flags allow, the file is created. Otherwise, a
+ * valid or negative dentry, or an error is returned. */
+static struct dentry *
+get_xa_file_dentry (const struct inode *inode, const char *name, int flags)
+{
+    struct dentry *xadir, *xafile;
+    int err = 0;
+
+    xadir = open_xa_dir (inode, flags);
+    if (IS_ERR (xadir)) {
+        return ERR_PTR (PTR_ERR (xadir));
+    } else if (xadir && !xadir->d_inode) {
+        dput (xadir);
+        return ERR_PTR (-ENODATA);
+    }
+
+    xafile = lookup_one_len (name, xadir, strlen (name));
+    if (IS_ERR (xafile)) {
+        dput (xadir);
+        return ERR_PTR (PTR_ERR (xafile));
+    }
+
+    if (xafile->d_inode) { /* file exists */
+        if (flags & XATTR_CREATE) {
+            err = -EEXIST;
+            dput (xafile);
+            goto out;
+        }
+    } else if (flags & XATTR_REPLACE || flags & FL_READONLY) {
+        goto out;
+    } else {
+        /* inode->i_sem is down, so nothing else can try to create
+         * the same xattr */
+        err = xadir->d_inode->i_op->create (xadir->d_inode, xafile,
+                                            0700|S_IFREG, NULL);
+
+        if (err) {
+            dput (xafile);
+            goto out;
+        }
+        /* Newly created object.. Need to mark it private */
+        REISERFS_I(xafile->d_inode)->i_flags |= i_priv_object;
+    }
+
+out:
+    dput (xadir);
+    if (err)
+        xafile = ERR_PTR (err);
+    return xafile;
+}
+
+
+/* Opens a file pointer to the attribute associated with inode */
+static struct file *
+open_xa_file (const struct inode *inode, const char *name, int flags)
+{
+    struct dentry *xafile;
+    struct file *fp;
+
+    xafile = get_xa_file_dentry (inode, name, flags);
+    if (IS_ERR (xafile))
+        return ERR_PTR (PTR_ERR (xafile));
+    else if (!xafile->d_inode) {
+        dput (xafile);
+        return ERR_PTR (-ENODATA);
+    }
+
+    fp = dentry_open (xafile, NULL, O_RDWR);
+    /* dentry_open dputs the dentry if it fails */
+
+    return fp;
+}
+
+
+/*
+ * this is very similar to fs/reiserfs/dir.c:reiserfs_readdir, but
+ * we need to drop the path before calling the filldir struct.  That
+ * would be a big performance hit to the non-xattr case, so I've copied
+ * the whole thing for now. --clm
+ *
+ * the big difference is that I go backwards through the directory,
+ * and don't mess with f->f_pos, but the idea is the same.  Do some
+ * action on each and every entry in the directory.
+ *
+ * we're called with i_sem held, so there are no worries about the directory
+ * changing underneath us.
+ */
+static int __xattr_readdir(struct file * filp, void * dirent, filldir_t filldir)
+{
+    struct inode *inode = filp->f_dentry->d_inode;
+    struct cpu_key pos_key;	/* key of current position in the directory (key of directory entry) */
+    INITIALIZE_PATH (path_to_entry);
+    struct buffer_head * bh;
+    int entry_num;
+    struct item_head * ih, tmp_ih;
+    int search_res;
+    char * local_buf;
+    loff_t next_pos;
+    char small_buf[32] ; /* avoid kmalloc if we can */
+    struct reiserfs_de_head *deh;
+    int d_reclen;
+    char * d_name;
+    off_t d_off;
+    ino_t d_ino;
+    struct reiserfs_dir_entry de;
+
+
+    /* form key for search the next directory entry using f_pos field of
+       file structure */
+    next_pos = max_reiserfs_offset(inode);
+
+    while (1) {
+research:
+	if (next_pos <= DOT_DOT_OFFSET)
+	    break;
+	make_cpu_key (&pos_key, inode, next_pos, TYPE_DIRENTRY, 3);
+
+	search_res = search_by_entry_key(inode->i_sb, &pos_key, &path_to_entry, &de);
+	if (search_res == IO_ERROR) {
+	    // FIXME: we could just skip part of directory which could
+	    // not be read
+	    pathrelse(&path_to_entry);
+	    return -EIO;
+	}
+
+	if (search_res == NAME_NOT_FOUND)
+	    de.de_entry_num--;
+
+	set_de_name_and_namelen(&de);
+	entry_num = de.de_entry_num;
+	deh = &(de.de_deh[entry_num]);
+
+	bh = de.de_bh;
+	ih = de.de_ih;
+
+	if (!is_direntry_le_ih(ih)) {
+            reiserfs_warning(inode->i_sb, "not direntry %h", ih);
+	    break;
+        }
+	copy_item_head(&tmp_ih, ih);
+
+	/* we must have found item, that is item of this directory, */
+	RFALSE( COMP_SHORT_KEYS (&(ih->ih_key), &pos_key),
+		"vs-9000: found item %h does not match to dir we readdir %K",
+		ih, &pos_key);
+
+	if (deh_offset(deh) <= DOT_DOT_OFFSET) {
+	    break;
+	}
+
+	/* look for the previous entry in the directory */
+	next_pos = deh_offset (deh) - 1;
+
+	if (!de_visible (deh))
+	    /* it is hidden entry */
+	    continue;
+
+	d_reclen = entry_length(bh, ih, entry_num);
+	d_name = B_I_DEH_ENTRY_FILE_NAME (bh, ih, deh);
+	d_off = deh_offset (deh);
+	d_ino = deh_objectid (deh);
+
+	if (!d_name[d_reclen - 1])
+	    d_reclen = strlen (d_name);
+
+	if (d_reclen > REISERFS_MAX_NAME(inode->i_sb->s_blocksize)){
+	    /* too big to send back to VFS */
+	    continue ;
+	}
+
+        /* Ignore the .reiserfs_priv entry */
+        if (reiserfs_xattrs (inode->i_sb) &&
+            !old_format_only(inode->i_sb) &&
+            deh_objectid (deh) == le32_to_cpu (INODE_PKEY(REISERFS_SB(inode->i_sb)->priv_root->d_inode)->k_objectid))
+          continue;
+
+	if (d_reclen <= 32) {
+	  local_buf = small_buf ;
+	} else {
+	    local_buf = reiserfs_kmalloc(d_reclen, GFP_NOFS, inode->i_sb) ;
+	    if (!local_buf) {
+		pathrelse (&path_to_entry);
+		return -ENOMEM ;
+	    }
+	    if (item_moved (&tmp_ih, &path_to_entry)) {
+		reiserfs_kfree(local_buf, d_reclen, inode->i_sb) ;
+
+		/* sigh, must retry.  Do this same offset again */
+		next_pos = d_off;
+		goto research;
+	    }
+	}
+
+	// Note, that we copy name to user space via temporary
+	// buffer (local_buf) because filldir will block if
+	// user space buffer is swapped out. At that time
+	// entry can move to somewhere else
+	memcpy (local_buf, d_name, d_reclen);
+
+	/* the filldir function might need to start transactions,
+	 * or do who knows what.  Release the path now that we've
+	 * copied all the important stuff out of the deh
+	 */
+	pathrelse (&path_to_entry);
+
+	if (filldir (dirent, local_buf, d_reclen, d_off, d_ino,
+		     DT_UNKNOWN) < 0) {
+	    if (local_buf != small_buf) {
+		reiserfs_kfree(local_buf, d_reclen, inode->i_sb) ;
+	    }
+	    goto end;
+	}
+	if (local_buf != small_buf) {
+	    reiserfs_kfree(local_buf, d_reclen, inode->i_sb) ;
+	}
+    } /* while */
+
+end:
+    pathrelse (&path_to_entry);
+    return 0;
+}
+
+/*
+ * this could be done with dedicated readdir ops for the xattr files,
+ * but I want to get something working asap
+ * this is stolen from vfs_readdir
+ *
+ */
+static
+int xattr_readdir(struct file *file, filldir_t filler, void *buf)
+{
+        struct inode *inode = file->f_dentry->d_inode;
+        int res = -ENOTDIR;
+        if (!file->f_op || !file->f_op->readdir)
+                goto out;
+        down(&inode->i_sem);
+//        down(&inode->i_zombie);
+        res = -ENOENT;
+        if (!IS_DEADDIR(inode)) {
+                lock_kernel();
+                res = __xattr_readdir(file, buf, filler);
+                unlock_kernel();
+        }
+//        up(&inode->i_zombie);
+        up(&inode->i_sem);
+out:
+        return res;
+}
+
+
+/* Internal operations on file data */
+static inline void
+reiserfs_put_page(struct page *page)
+{
+        kunmap(page);
+        page_cache_release(page);
+}
+
+static struct page *
+reiserfs_get_page(struct inode *dir, unsigned long n)
+{
+        struct address_space *mapping = dir->i_mapping;
+        struct page *page;
+        /* We can deadlock if we try to free dentries,
+           and an unlink/rmdir has just occured - GFP_NOFS avoids this */
+        mapping->flags = (mapping->flags & ~__GFP_BITS_MASK) | GFP_NOFS;
+        page = read_cache_page (mapping, n,
+                                (filler_t*)mapping->a_ops->readpage, NULL);
+        if (!IS_ERR(page)) {
+                wait_on_page_locked(page);
+                kmap(page);
+                if (!PageUptodate(page))
+                        goto fail;
+
+                if (PageError(page))
+                        goto fail;
+        }
+        return page;
+
+fail:
+        reiserfs_put_page(page);
+        return ERR_PTR(-EIO);
+}
+
+static inline __u32
+xattr_hash (const char *msg, int len)
+{
+    return csum_partial (msg, len, 0);
+}
+
+/* Generic extended attribute operations that can be used by xa plugins */
+
+/*
+ * inode->i_sem: down
+ */
+int
+reiserfs_xattr_set (struct inode *inode, const char *name, const void *buffer,
+                    size_t buffer_size, int flags)
+{
+    int err = 0;
+    struct file *fp;
+    struct page *page;
+    char *data;
+    struct address_space *mapping;
+    size_t file_pos = 0;
+    size_t buffer_pos = 0;
+    struct inode *xinode;
+    struct iattr newattrs;
+    __u32 xahash = 0;
+
+    if (IS_RDONLY (inode))
+        return -EROFS;
+
+    if (IS_IMMUTABLE (inode) || IS_APPEND (inode))
+        return -EPERM;
+
+    if (get_inode_sd_version (inode) == STAT_DATA_V1)
+        return -EOPNOTSUPP;
+
+    /* Empty xattrs are ok, they're just empty files, no hash */
+    if (buffer && buffer_size)
+        xahash = xattr_hash (buffer, buffer_size);
+
+open_file:
+    fp = open_xa_file (inode, name, flags);
+    if (IS_ERR (fp)) {
+        err = PTR_ERR (fp);
+        goto out;
+    }
+
+    xinode = fp->f_dentry->d_inode;
+    REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
+
+    /* we need to copy it off.. */
+    if (xinode->i_nlink > 1) {
+	fput(fp);
+        err = reiserfs_xattr_del (inode, name);
+        if (err < 0)
+            goto out;
+        /* We just killed the old one, we're not replacing anymore */
+        if (flags & XATTR_REPLACE)
+            flags &= ~XATTR_REPLACE;
+        goto open_file;
+    }
+
+    /* Resize it so we're ok to write there */
+    newattrs.ia_size = buffer_size;
+    newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
+    down (&xinode->i_sem);
+    err = notify_change(fp->f_dentry, &newattrs);
+    if (err)
+        goto out_filp;
+
+    mapping = xinode->i_mapping;
+    while (buffer_pos < buffer_size || buffer_pos == 0) {
+        size_t chunk;
+        size_t skip = 0;
+        size_t page_offset = (file_pos & (PAGE_CACHE_SIZE - 1));
+        if (buffer_size - buffer_pos > PAGE_CACHE_SIZE)
+            chunk = PAGE_CACHE_SIZE;
+        else
+            chunk = buffer_size - buffer_pos;
+
+        page = reiserfs_get_page (xinode, file_pos >> PAGE_CACHE_SHIFT);
+        if (IS_ERR (page)) {
+            err = PTR_ERR (page);
+            goto out_filp;
+        }
+
+        lock_page (page);
+        data = page_address (page);
+
+        if (file_pos == 0) {
+            struct reiserfs_xattr_header *rxh;
+            skip = file_pos = sizeof (struct reiserfs_xattr_header);
+            if (chunk + skip > PAGE_CACHE_SIZE)
+                chunk = PAGE_CACHE_SIZE - skip;
+            rxh = (struct reiserfs_xattr_header *)data;
+            rxh->h_magic = cpu_to_le32 (REISERFS_XATTR_MAGIC);
+            rxh->h_hash = cpu_to_le32 (xahash);
+        }
+
+        err = mapping->a_ops->prepare_write (fp, page, page_offset,
+                                             page_offset + chunk + skip);
+        if (!err) {
+	    if (buffer)
+		memcpy (data + skip, buffer + buffer_pos, chunk);
+            err = mapping->a_ops->commit_write (fp, page, page_offset,
+                                                page_offset + chunk + skip);
+	}
+        unlock_page (page);
+        reiserfs_put_page (page);
+        buffer_pos += chunk;
+        file_pos += chunk;
+        skip = 0;
+        if (err || buffer_size == 0 || !buffer)
+            break;
+    }
+
+    inode->i_ctime = CURRENT_TIME;
+    mark_inode_dirty (inode);
+
+out_filp:
+    up (&xinode->i_sem);
+    fput(fp);
+
+out:
+    return err;
+}
+
+/*
+ * inode->i_sem: down
+ */
+int
+reiserfs_xattr_get (const struct inode *inode, const char *name, void *buffer,
+                    size_t buffer_size)
+{
+    ssize_t err = 0;
+    struct file *fp;
+    size_t isize;
+    size_t file_pos = 0;
+    size_t buffer_pos = 0;
+    struct page *page;
+    struct inode *xinode;
+    __u32 hash = 0;
+
+    if (name == NULL)
+        return -EINVAL;
+
+    /* We can't have xattrs attached to v1 items since they don't have
+     * generation numbers */
+    if (get_inode_sd_version (inode) == STAT_DATA_V1)
+        return -EOPNOTSUPP;
+
+    fp = open_xa_file (inode, name, FL_READONLY);
+    if (IS_ERR (fp)) {
+        err = PTR_ERR (fp);
+        goto out;
+    }
+
+    xinode = fp->f_dentry->d_inode;
+    isize = xinode->i_size;
+    REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
+
+    /* Just return the size needed */
+    if (buffer == NULL) {
+        err = isize - sizeof (struct reiserfs_xattr_header);
+        goto out_dput;
+    }
+
+    if (buffer_size < isize - sizeof (struct reiserfs_xattr_header)) {
+        err = -ERANGE;
+        goto out_dput;
+    }
+
+    while (file_pos < isize) {
+        size_t chunk;
+        char *data;
+        size_t skip = 0;
+        if (isize - file_pos > PAGE_CACHE_SIZE)
+            chunk = PAGE_CACHE_SIZE;
+        else
+            chunk = isize - file_pos;
+
+        page = reiserfs_get_page (xinode, file_pos >> PAGE_CACHE_SHIFT);
+        if (IS_ERR (page)) {
+            err = PTR_ERR (page);
+            goto out_dput;
+        }
+
+        lock_page (page);
+        data = page_address (page);
+        if (file_pos == 0) {
+            struct reiserfs_xattr_header *rxh =
+                                        (struct reiserfs_xattr_header *)data;
+            skip = file_pos = sizeof (struct reiserfs_xattr_header);
+            chunk -= skip;
+            /* Magic doesn't match up.. */
+            if (rxh->h_magic != cpu_to_le32 (REISERFS_XATTR_MAGIC)) {
+                unlock_page (page);
+                reiserfs_put_page (page);
+                reiserfs_warning (inode->i_sb, "Invalid magic for xattr (%s) "
+                                  "associated with %k", name,
+                                  INODE_PKEY (inode));
+                err = -EIO;
+                goto out_dput;
+            }
+            hash = le32_to_cpu (rxh->h_hash);
+        }
+        memcpy (buffer + buffer_pos, data + skip, chunk);
+        unlock_page (page);
+        reiserfs_put_page (page);
+        file_pos += chunk;
+        buffer_pos += chunk;
+        skip = 0;
+    }
+    err = isize - sizeof (struct reiserfs_xattr_header);
+
+    if (xattr_hash (buffer, isize - sizeof (struct reiserfs_xattr_header)) != hash) {
+        reiserfs_warning (inode->i_sb, "Invalid hash for xattr (%s) associated "
+                          "with %k", name, INODE_PKEY (inode));
+        err = -EIO;
+    }
+
+out_dput:
+    fput(fp);
+
+out:
+    return err;
+}
+
+static int
+__reiserfs_xattr_del (struct dentry *xadir, const char *name, int namelen)
+{
+    struct dentry *dentry;
+    struct inode *dir = xadir->d_inode;
+    int err = 0;
+
+    dentry = lookup_one_len (name, xadir, namelen);
+    if (IS_ERR (dentry)) {
+        err = PTR_ERR (dentry);
+        goto out;
+    } else if (!dentry->d_inode) {
+        err = -ENODATA;
+        goto out_file;
+    }
+
+    /* Skip directories.. */
+    if (S_ISDIR (dentry->d_inode->i_mode))
+        goto out_file;
+
+    if (!is_reiserfs_priv_object (dentry->d_inode)) {
+        reiserfs_warning (dir->i_sb, "OID %08x [%.*s/%.*s] doesn't have "
+                                     "priv flag set [parent is %sset].",
+                        le32_to_cpu (INODE_PKEY (dentry->d_inode)->k_objectid),
+                        xadir->d_name.len, xadir->d_name.name, namelen, name,
+                        is_reiserfs_priv_object (xadir->d_inode) ? "" : "not ");
+        dput (dentry);
+        return -EIO;
+    }
+
+    err = dir->i_op->unlink (dir, dentry);
+    if (!err)
+        d_delete (dentry);
+
+out_file:
+    dput (dentry);
+
+out:
+    return err;
+}
+
+
+int
+reiserfs_xattr_del (struct inode *inode, const char *name)
+{
+    struct dentry *dir;
+    int err;
+
+    if (IS_RDONLY (inode))
+        return -EROFS;
+
+    dir = open_xa_dir (inode, FL_READONLY);
+    if (IS_ERR (dir)) {
+        err = PTR_ERR (dir);
+        goto out;
+    }
+
+    err = __reiserfs_xattr_del (dir, name, strlen (name));
+    dput (dir);
+
+out:
+    return err;
+}
+
+/* The following are side effects of other operations that aren't explicitly
+ * modifying extended attributes. This includes operations such as permissions
+ * or ownership changes, object deletions, etc. */
+
+static int
+reiserfs_delete_xattrs_filler (void *buf, const char *name, int namelen,
+                               loff_t offset, ino_t ino, unsigned int d_type)
+{
+    struct dentry *xadir = (struct dentry *)buf;
+
+    return __reiserfs_xattr_del (xadir, name, namelen);
+
+}
+
+/* This is called w/ inode->i_sem downed */
+int
+reiserfs_delete_xattrs (struct inode *inode)
+{
+    struct file *fp;
+    struct dentry *dir, *root;
+    int err = 0;
+
+    /* Skip out, an xattr has no xattrs associated with it */
+    if (is_reiserfs_priv_object (inode) ||
+        get_inode_sd_version (inode) == STAT_DATA_V1 ||
+        !reiserfs_xattrs(inode->i_sb))
+    {
+        return 0;
+    }
+    reiserfs_read_lock_xattrs (inode->i_sb);
+    dir = open_xa_dir (inode, FL_READONLY);
+    reiserfs_read_unlock_xattrs (inode->i_sb);
+    if (IS_ERR (dir)) {
+        err = PTR_ERR (dir);
+        goto out;
+    } else if (!dir->d_inode) {
+        dput (dir);
+        return 0;
+    }
+
+    fp = dentry_open (dir, NULL, O_RDWR);
+    if (IS_ERR (fp)) {
+        err = PTR_ERR (fp);
+        /* dentry_open dputs the dentry if it fails */
+        goto out;
+    }
+
+    lock_kernel ();
+    err = xattr_readdir (fp, reiserfs_delete_xattrs_filler, dir);
+    if (err) {
+        unlock_kernel ();
+        goto out_dir;
+    }
+
+    /* Leftovers besides . and .. -- that's not good. */
+    if (dir->d_inode->i_nlink <= 2) {
+        root = get_xa_root (inode->i_sb);
+        reiserfs_write_lock_xattrs (inode->i_sb);
+        err = vfs_rmdir (root->d_inode, dir);
+        reiserfs_write_unlock_xattrs (inode->i_sb);
+        dput (root);
+    } else {
+        reiserfs_warning (inode->i_sb,
+                          "Couldn't remove all entries in directory");
+    }
+    unlock_kernel ();
+
+out_dir:
+    fput(fp);
+
+out:
+    if (!err)
+        REISERFS_I(inode)->i_flags = REISERFS_I(inode)->i_flags & ~i_has_xattr_dir;
+    return err;
+}
+
+struct reiserfs_chown_buf {
+    struct inode *inode;
+    struct dentry *xadir;
+    struct iattr *attrs;
+};
+
+/* XXX: If there is a better way to do this, I'd love to hear about it */
+static int
+reiserfs_chown_xattrs_filler (void *buf, const char *name, int namelen,
+                               loff_t offset, ino_t ino, unsigned int d_type)
+{
+    struct reiserfs_chown_buf *chown_buf = (struct reiserfs_chown_buf *)buf;
+    struct dentry *xafile, *xadir = chown_buf->xadir;
+    struct iattr *attrs = chown_buf->attrs;
+    int err = 0;
+
+    xafile = lookup_one_len (name, xadir, namelen);
+    if (IS_ERR (xafile))
+        return PTR_ERR (xafile);
+    else if (!xafile->d_inode) {
+        dput (xafile);
+        return -ENODATA;
+    }
+
+    if (!S_ISDIR (xafile->d_inode->i_mode))
+        err = notify_change (xafile, attrs);
+    dput (xafile);
+
+    return err;
+}
+
+int
+reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs)
+{
+    struct file *fp;
+    struct dentry *dir;
+    int err = 0;
+    struct reiserfs_chown_buf buf;
+    unsigned int ia_valid = attrs->ia_valid;
+
+    /* Skip out, an xattr has no xattrs associated with it */
+    if (is_reiserfs_priv_object (inode) ||
+        get_inode_sd_version (inode) == STAT_DATA_V1 ||
+        !reiserfs_xattrs(inode->i_sb))
+    {
+        return 0;
+    }
+    reiserfs_read_lock_xattrs (inode->i_sb);
+    dir = open_xa_dir (inode, FL_READONLY);
+    reiserfs_read_unlock_xattrs (inode->i_sb);
+    if (IS_ERR (dir)) {
+        if (PTR_ERR (dir) != -ENODATA)
+            err = PTR_ERR (dir);
+        goto out;
+    } else if (!dir->d_inode) {
+        dput (dir);
+        goto out;
+    }
+
+    fp = dentry_open (dir, NULL, O_RDWR);
+    if (IS_ERR (fp)) {
+        err = PTR_ERR (fp);
+        /* dentry_open dputs the dentry if it fails */
+        goto out;
+    }
+
+    lock_kernel ();
+
+    attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME);
+    buf.xadir = dir;
+    buf.attrs = attrs;
+    buf.inode = inode;
+
+    err = xattr_readdir (fp, reiserfs_chown_xattrs_filler, &buf);
+    if (err) {
+        unlock_kernel ();
+        goto out_dir;
+    }
+
+    err = notify_change (dir, attrs);
+    unlock_kernel ();
+
+out_dir:
+    fput(fp);
+
+out:
+    attrs->ia_valid = ia_valid;
+    return err;
+}
+
+
+/* Actual operations that are exported to VFS-land */
+
+/*
+ * Inode operation getxattr()
+ * Preliminary locking: we down dentry->d_inode->i_sem
+ */
+ssize_t
+reiserfs_getxattr (struct dentry *dentry, const char *name, void *buffer,
+                   size_t size)
+{
+    struct reiserfs_xattr_handler *xah = find_xattr_handler_prefix (name);
+    int err;
+
+    if (!xah || !reiserfs_xattrs(dentry->d_sb) ||
+        get_inode_sd_version (dentry->d_inode) == STAT_DATA_V1)
+        return -EOPNOTSUPP;
+
+    reiserfs_read_lock_xattr_i (dentry->d_inode);
+    reiserfs_read_lock_xattrs (dentry->d_sb);
+    err = xah->get (dentry->d_inode, name, buffer, size);
+    reiserfs_read_unlock_xattrs (dentry->d_sb);
+    reiserfs_read_unlock_xattr_i (dentry->d_inode);
+    return err;
+}
+
+
+/*
+ * Inode operation setxattr()
+ *
+ * dentry->d_inode->i_sem down
+ */
+int
+reiserfs_setxattr (struct dentry *dentry, const char *name, const void *value,
+                   size_t size, int flags)
+{
+    struct reiserfs_xattr_handler *xah = find_xattr_handler_prefix (name);
+    int err;
+    int lock;
+
+    if (!xah || !reiserfs_xattrs(dentry->d_sb) ||
+        get_inode_sd_version (dentry->d_inode) == STAT_DATA_V1)
+        return -EOPNOTSUPP;
+
+    if (IS_RDONLY (dentry->d_inode))
+        return -EROFS;
+
+    if (IS_IMMUTABLE (dentry->d_inode) || IS_APPEND (dentry->d_inode))
+        return -EROFS;
+
+    reiserfs_write_lock_xattr_i (dentry->d_inode);
+    lock = !has_xattr_dir (dentry->d_inode);
+    if (lock)
+        reiserfs_write_lock_xattrs (dentry->d_sb);
+    else
+        reiserfs_read_lock_xattrs (dentry->d_sb);
+    err = xah->set (dentry->d_inode, name, value, size, flags);
+    if (lock)
+        reiserfs_write_unlock_xattrs (dentry->d_sb);
+    else
+        reiserfs_read_unlock_xattrs (dentry->d_sb);
+    reiserfs_write_unlock_xattr_i (dentry->d_inode);
+    return err;
+}
+
+/*
+ * Inode operation removexattr()
+ *
+ * dentry->d_inode->i_sem down
+ */
+int
+reiserfs_removexattr (struct dentry *dentry, const char *name)
+{
+    int err;
+    struct reiserfs_xattr_handler *xah = find_xattr_handler_prefix (name);
+
+    if (!xah || !reiserfs_xattrs(dentry->d_sb) ||
+        get_inode_sd_version (dentry->d_inode) == STAT_DATA_V1)
+        return -EOPNOTSUPP;
+
+    if (IS_RDONLY (dentry->d_inode))
+        return -EROFS;
+
+    if (IS_IMMUTABLE (dentry->d_inode) || IS_APPEND (dentry->d_inode))
+        return -EPERM;
+
+    reiserfs_write_lock_xattr_i (dentry->d_inode);
+    reiserfs_read_lock_xattrs (dentry->d_sb);
+
+    /* Deletion pre-operation */
+    if (xah->del) {
+        err = xah->del (dentry->d_inode, name);
+        if (err)
+            goto out;
+    }
+
+    err = reiserfs_xattr_del (dentry->d_inode, name);
+
+    dentry->d_inode->i_ctime = CURRENT_TIME;
+    mark_inode_dirty (dentry->d_inode);
+
+out:
+    reiserfs_read_unlock_xattrs (dentry->d_sb);
+    reiserfs_write_unlock_xattr_i (dentry->d_inode);
+    return err;
+}
+
+
+/* This is what filldir will use:
+ * r_pos will always contain the amount of space required for the entire
+ * list. If r_pos becomes larger than r_size, we need more space and we
+ * return an error indicating this. If r_pos is less than r_size, then we've
+ * filled the buffer successfully and we return success */
+struct reiserfs_listxattr_buf {
+    int r_pos;
+    int r_size;
+    char *r_buf;
+    struct inode *r_inode;
+};
+
+static int
+reiserfs_listxattr_filler (void *buf, const char *name, int namelen,
+                           loff_t offset, ino_t ino, unsigned int d_type)
+{
+    struct reiserfs_listxattr_buf *b = (struct reiserfs_listxattr_buf *)buf;
+    int len = 0;
+    if (name[0] != '.' || (namelen != 1 && (name[1] != '.' || namelen != 2))) {
+        struct reiserfs_xattr_handler *xah = find_xattr_handler_prefix (name);
+        if (!xah) return 0; /* Unsupported xattr name, skip it */
+
+        /* We call ->list() twice because the operation isn't required to just
+         * return the name back - we want to make sure we have enough space */
+        len += xah->list (b->r_inode, name, namelen, NULL);
+
+        if (len) {
+            if (b->r_pos + len + 1 <= b->r_size) {
+                char *p = b->r_buf + b->r_pos;
+                p += xah->list (b->r_inode, name, namelen, p);
+                *p++ = '\0';
+            }
+            b->r_pos += len + 1;
+        }
+    }
+
+    return 0;
+}
+/*
+ * Inode operation listxattr()
+ *
+ * Preliminary locking: we down dentry->d_inode->i_sem
+ */
+ssize_t
+reiserfs_listxattr (struct dentry *dentry, char *buffer, size_t size)
+{
+    struct file *fp;
+    struct dentry *dir;
+    int err = 0;
+    struct reiserfs_listxattr_buf buf;
+
+    if (!dentry->d_inode)
+        return -EINVAL;
+
+    if (!reiserfs_xattrs(dentry->d_sb) ||
+        get_inode_sd_version (dentry->d_inode) == STAT_DATA_V1)
+        return -EOPNOTSUPP;
+
+    reiserfs_read_lock_xattr_i (dentry->d_inode);
+    reiserfs_read_lock_xattrs (dentry->d_sb);
+    dir = open_xa_dir (dentry->d_inode, FL_READONLY);
+    reiserfs_read_unlock_xattrs (dentry->d_sb);
+    if (IS_ERR (dir)) {
+        err = PTR_ERR (dir);
+        if (err == -ENODATA)
+            err = 0; /* Not an error if there aren't any xattrs */
+        goto out;
+    }
+
+    fp = dentry_open (dir, NULL, O_RDWR);
+    if (IS_ERR (fp)) {
+        err = PTR_ERR (fp);
+        /* dentry_open dputs the dentry if it fails */
+        goto out;
+    }
+
+    buf.r_buf = buffer;
+    buf.r_size = buffer ? size : 0;
+    buf.r_pos = 0;
+    buf.r_inode = dentry->d_inode;
+
+    REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir;
+
+    err = xattr_readdir (fp, reiserfs_listxattr_filler, &buf);
+    if (err)
+        goto out_dir;
+
+    if (buf.r_pos > buf.r_size && buffer != NULL)
+        err = -ERANGE;
+    else
+        err = buf.r_pos;
+
+out_dir:
+    fput(fp);
+
+out:
+    reiserfs_read_unlock_xattr_i (dentry->d_inode);
+    return err;
+}
+
+/* This is the implementation for the xattr plugin infrastructure */
+static struct list_head xattr_handlers = LIST_HEAD_INIT (xattr_handlers);
+static rwlock_t handler_lock = RW_LOCK_UNLOCKED;
+
+static struct reiserfs_xattr_handler *
+find_xattr_handler_prefix (const char *prefix)
+{
+    struct reiserfs_xattr_handler *xah = NULL;
+    struct list_head *p;
+
+    read_lock (&handler_lock);
+    list_for_each (p, &xattr_handlers) {
+        xah = list_entry (p, struct reiserfs_xattr_handler, handlers);
+        if (strncmp (xah->prefix, prefix, strlen (xah->prefix)) == 0)
+            break;
+        xah = NULL;
+    }
+
+    read_unlock (&handler_lock);
+    return xah;
+}
+
+static void
+__unregister_handlers (void)
+{
+    struct reiserfs_xattr_handler *xah;
+    struct list_head *p, *tmp;
+
+    list_for_each_safe (p, tmp, &xattr_handlers) {
+        xah = list_entry (p, struct reiserfs_xattr_handler, handlers);
+        if (xah->exit)
+            xah->exit();
+
+        list_del_init (p);
+    }
+    INIT_LIST_HEAD (&xattr_handlers);
+}
+
+int __init
+reiserfs_xattr_register_handlers (void)
+{
+    int err = 0;
+    struct reiserfs_xattr_handler *xah;
+    struct list_head *p;
+
+    write_lock (&handler_lock);
+
+    /* If we're already initialized, nothing to do */
+    if (!list_empty (&xattr_handlers)) {
+        write_unlock (&handler_lock);
+        return 0;
+    }
+
+    /* Add the handlers */
+    list_add_tail (&user_handler.handlers, &xattr_handlers);
+    list_add_tail (&trusted_handler.handlers, &xattr_handlers);
+#ifdef CONFIG_REISERFS_FS_SECURITY
+    list_add_tail (&security_handler.handlers, &xattr_handlers);
+#endif
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
+    list_add_tail (&posix_acl_access_handler.handlers, &xattr_handlers);
+    list_add_tail (&posix_acl_default_handler.handlers, &xattr_handlers);
+#endif
+
+    /* Run initializers, if available */
+    list_for_each (p, &xattr_handlers) {
+        xah = list_entry (p, struct reiserfs_xattr_handler, handlers);
+        if (xah->init) {
+            err = xah->init ();
+            if (err) {
+                list_del_init (p);
+                break;
+            }
+        }
+    }
+
+    /* Clean up other handlers, if any failed */
+    if (err)
+        __unregister_handlers ();
+
+    write_unlock (&handler_lock);
+    return err;
+}
+
+void
+reiserfs_xattr_unregister_handlers (void)
+{
+    write_lock (&handler_lock);
+    __unregister_handlers ();
+    write_unlock (&handler_lock);
+}
+
+/* This will catch lookups from the fs root to .reiserfs_priv */
+static int
+xattr_lookup_poison (struct dentry *dentry, struct qstr *q1, struct qstr *name)
+{
+    struct dentry *priv_root = REISERFS_SB(dentry->d_sb)->priv_root;
+    if (name->len == priv_root->d_name.len &&
+        name->hash == priv_root->d_name.hash &&
+        !memcmp (name->name, priv_root->d_name.name, name->len)) {
+            return -ENOENT;
+    }
+    return 0;
+}
+
+static struct dentry_operations xattr_lookup_poison_ops = {
+    .d_compare = xattr_lookup_poison,
+};
+
+
+/* We need to take a copy of the mount flags since things like
+ * MS_RDONLY don't get set until *after* we're called.
+ * mount_flags != mount_options */
+int
+reiserfs_xattr_init (struct super_block *s, int mount_flags)
+{
+  int err = 0;
+
+  /* We need generation numbers to ensure that the oid mapping is correct
+   * v3.5 filesystems don't have them. */
+  if (!old_format_only (s)) {
+    set_bit (REISERFS_XATTRS, &(REISERFS_SB(s)->s_mount_opt));
+  } else if (reiserfs_xattrs_optional (s)) {
+    /* Old format filesystem, but optional xattrs have been enabled
+     * at mount time. Error out. */
+    reiserfs_warning (s, "xattrs/ACLs not supported on pre v3.6 "
+                      "format filesystem. Failing mount.");
+    err = -EOPNOTSUPP;
+    goto error;
+  } else {
+    /* Old format filesystem, but no optional xattrs have been enabled. This
+     * means we silently disable xattrs on the filesystem. */
+    clear_bit (REISERFS_XATTRS, &(REISERFS_SB(s)->s_mount_opt));
+  }
+
+  /* If we don't have the privroot located yet - go find it */
+  if (reiserfs_xattrs (s) && !REISERFS_SB(s)->priv_root) {
+      struct dentry *dentry;
+      dentry = lookup_one_len (PRIVROOT_NAME, s->s_root,
+                               strlen (PRIVROOT_NAME));
+      if (!IS_ERR (dentry)) {
+        if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) {
+            struct inode *inode = dentry->d_parent->d_inode;
+            down (&inode->i_sem);
+            err = inode->i_op->mkdir (inode, dentry, 0700);
+            up (&inode->i_sem);
+            if (err) {
+                dput (dentry);
+                dentry = NULL;
+            }
+
+            if (dentry && dentry->d_inode)
+                reiserfs_warning (s, "Created %s on %s - reserved for "
+                                  "xattr storage.", PRIVROOT_NAME,
+                                  reiserfs_bdevname (inode->i_sb));
+        } else if (!dentry->d_inode) {
+            dput (dentry);
+            dentry = NULL;
+        }
+      } else
+        err = PTR_ERR (dentry);
+
+      if (!err && dentry) {
+          s->s_root->d_op = &xattr_lookup_poison_ops;
+          REISERFS_I(dentry->d_inode)->i_flags |= i_priv_object;
+          REISERFS_SB(s)->priv_root = dentry;
+      } else if (!(mount_flags & MS_RDONLY)) { /* xattrs are unavailable */
+          /* If we're read-only it just means that the dir hasn't been
+           * created. Not an error -- just no xattrs on the fs. We'll
+           * check again if we go read-write */
+          reiserfs_warning (s, "xattrs/ACLs enabled and couldn't "
+                            "find/create .reiserfs_priv. Failing mount.");
+          err = -EOPNOTSUPP;
+      }
+  }
+
+error:
+   /* This is only nonzero if there was an error initializing the xattr
+    * directory or if there is a condition where we don't support them. */
+    if (err) {
+          clear_bit (REISERFS_XATTRS, &(REISERFS_SB(s)->s_mount_opt));
+          clear_bit (REISERFS_XATTRS_USER, &(REISERFS_SB(s)->s_mount_opt));
+          clear_bit (REISERFS_POSIXACL, &(REISERFS_SB(s)->s_mount_opt));
+    }
+
+    /* The super_block MS_POSIXACL must mirror the (no)acl mount option. */
+    s->s_flags = s->s_flags & ~MS_POSIXACL;
+    if (reiserfs_posixacl (s))
+	s->s_flags |= MS_POSIXACL;
+
+    return err;
+}
+
+static int
+__reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd,
+                       int need_lock)
+{
+	umode_t			mode = inode->i_mode;
+
+	if (mask & MAY_WRITE) {
+		/*
+		 * Nobody gets write access to a read-only fs.
+		 */
+		if (IS_RDONLY(inode) &&
+		    (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
+			return -EROFS;
+
+		/*
+		 * Nobody gets write access to an immutable file.
+		 */
+		if (IS_IMMUTABLE(inode))
+			return -EACCES;
+	}
+
+	/* We don't do permission checks on the internal objects.
+	* Permissions are determined by the "owning" object. */
+        if (is_reiserfs_priv_object (inode))
+		return 0;
+
+	if (current->fsuid == inode->i_uid) {
+		mode >>= 6;
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
+	} else if (reiserfs_posixacl(inode->i_sb) &&
+                   get_inode_sd_version (inode) != STAT_DATA_V1) {
+                struct posix_acl *acl;
+
+		/* ACL can't contain additional permissions if
+		   the ACL_MASK entry is 0 */
+		if (!(mode & S_IRWXG))
+			goto check_groups;
+
+                if (need_lock) {
+		    reiserfs_read_lock_xattr_i (inode);
+                    reiserfs_read_lock_xattrs (inode->i_sb);
+		}
+                acl = reiserfs_get_acl (inode, ACL_TYPE_ACCESS);
+                if (need_lock) {
+                    reiserfs_read_unlock_xattrs (inode->i_sb);
+		    reiserfs_read_unlock_xattr_i (inode);
+		}
+                if (IS_ERR (acl)) {
+                    if (PTR_ERR (acl) == -ENODATA)
+                        goto check_groups;
+                    return PTR_ERR (acl);
+                }
+
+                if (acl) {
+                    int err = posix_acl_permission (inode, acl, mask);
+                    posix_acl_release (acl);
+                    if (err == -EACCES) {
+                        goto check_capabilities;
+                    }
+                    return err;
+		} else {
+			goto check_groups;
+                }
+#endif
+	} else {
+check_groups:
+		if (in_group_p(inode->i_gid))
+			mode >>= 3;
+	}
+
+	/*
+	 * If the DACs are ok we don't need any capability check.
+	 */
+	if (((mode & mask & (MAY_READ|MAY_WRITE|MAY_EXEC)) == mask))
+		return 0;
+
+check_capabilities:
+	/*
+	 * Read/write DACs are always overridable.
+	 * Executable DACs are overridable if at least one exec bit is set.
+	 */
+	if (!(mask & MAY_EXEC) ||
+	    (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode))
+		if (capable(CAP_DAC_OVERRIDE))
+			return 0;
+
+	/*
+	 * Searching includes executable on directories, else just read.
+	 */
+	if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE)))
+		if (capable(CAP_DAC_READ_SEARCH))
+			return 0;
+
+	return -EACCES;
+}
+
+int
+reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd)
+{
+    return __reiserfs_permission (inode, mask, nd, 1);
+}
+
+int
+reiserfs_permission_locked (struct inode *inode, int mask, struct nameidata *nd)
+{
+    return __reiserfs_permission (inode, mask, nd, 0);
+}
diff -Nru a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/reiserfs/xattr_acl.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,563 @@
+#include <linux/fs.h>
+#include <linux/posix_acl.h>
+#include <linux/reiserfs_fs.h>
+#include <linux/errno.h>
+#include <linux/pagemap.h>
+#include <linux/xattr.h>
+#include <linux/xattr_acl.h>
+#include <linux/reiserfs_xattr.h>
+#include <linux/reiserfs_acl.h>
+#include <asm/uaccess.h>
+
+static int
+xattr_set_acl(struct inode *inode, int type, const void *value, size_t size)
+{
+	struct posix_acl *acl;
+	int error;
+
+	if (!reiserfs_posixacl(inode->i_sb))
+		return -EOPNOTSUPP;
+	if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+		return -EPERM;
+
+	if (value) {
+		acl = posix_acl_from_xattr(value, size);
+		if (IS_ERR(acl)) {
+			return PTR_ERR(acl);
+		} else if (acl) {
+			error = posix_acl_valid(acl);
+			if (error)
+				goto release_and_out;
+		}
+	} else
+		acl = NULL;
+
+	error = reiserfs_set_acl (inode, type, acl);
+
+release_and_out:
+	posix_acl_release(acl);
+	return error;
+}
+
+
+static int
+xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
+{
+	struct posix_acl *acl;
+	int error;
+
+	if (!reiserfs_posixacl(inode->i_sb))
+		return -EOPNOTSUPP;
+
+	acl = reiserfs_get_acl (inode, type);
+	if (IS_ERR(acl))
+		return PTR_ERR(acl);
+	if (acl == NULL)
+		return -ENODATA;
+	error = posix_acl_to_xattr(acl, buffer, size);
+	posix_acl_release(acl);
+
+	return error;
+}
+
+
+/*
+ * Convert from filesystem to in-memory representation.
+ */
+static struct posix_acl *
+posix_acl_from_disk(const void *value, size_t size)
+{
+	const char *end = (char *)value + size;
+	int n, count;
+	struct posix_acl *acl;
+
+	if (!value)
+		return NULL;
+	if (size < sizeof(reiserfs_acl_header))
+		 return ERR_PTR(-EINVAL);
+	if (((reiserfs_acl_header *)value)->a_version !=
+	    cpu_to_le32(REISERFS_ACL_VERSION))
+		return ERR_PTR(-EINVAL);
+	value = (char *)value + sizeof(reiserfs_acl_header);
+	count = reiserfs_acl_count(size);
+	if (count < 0)
+		return ERR_PTR(-EINVAL);
+	if (count == 0)
+		return NULL;
+	acl = posix_acl_alloc(count, GFP_NOFS);
+	if (!acl)
+		return ERR_PTR(-ENOMEM);
+	for (n=0; n < count; n++) {
+		reiserfs_acl_entry *entry =
+			(reiserfs_acl_entry *)value;
+		if ((char *)value + sizeof(reiserfs_acl_entry_short) > end)
+			goto fail;
+		acl->a_entries[n].e_tag  = le16_to_cpu(entry->e_tag);
+		acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
+		switch(acl->a_entries[n].e_tag) {
+			case ACL_USER_OBJ:
+			case ACL_GROUP_OBJ:
+			case ACL_MASK:
+			case ACL_OTHER:
+				value = (char *)value +
+					sizeof(reiserfs_acl_entry_short);
+				acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
+				break;
+
+			case ACL_USER:
+			case ACL_GROUP:
+				value = (char *)value + sizeof(reiserfs_acl_entry);
+				if ((char *)value > end)
+					goto fail;
+				acl->a_entries[n].e_id =
+					le32_to_cpu(entry->e_id);
+				break;
+
+			default:
+				goto fail;
+		}
+	}
+	if (value != end)
+		goto fail;
+	return acl;
+
+fail:
+	posix_acl_release(acl);
+	return ERR_PTR(-EINVAL);
+}
+
+/*
+ * Convert from in-memory to filesystem representation.
+ */
+static void *
+posix_acl_to_disk(const struct posix_acl *acl, size_t *size)
+{
+	reiserfs_acl_header *ext_acl;
+	char *e;
+	int n;
+
+	*size = reiserfs_acl_size(acl->a_count);
+	ext_acl = (reiserfs_acl_header *)kmalloc(sizeof(reiserfs_acl_header) +
+		acl->a_count * sizeof(reiserfs_acl_entry), GFP_NOFS);
+	if (!ext_acl)
+		return ERR_PTR(-ENOMEM);
+	ext_acl->a_version = cpu_to_le32(REISERFS_ACL_VERSION);
+	e = (char *)ext_acl + sizeof(reiserfs_acl_header);
+	for (n=0; n < acl->a_count; n++) {
+		reiserfs_acl_entry *entry = (reiserfs_acl_entry *)e;
+		entry->e_tag  = cpu_to_le16(acl->a_entries[n].e_tag);
+		entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
+		switch(acl->a_entries[n].e_tag) {
+			case ACL_USER:
+			case ACL_GROUP:
+				entry->e_id =
+					cpu_to_le32(acl->a_entries[n].e_id);
+				e += sizeof(reiserfs_acl_entry);
+				break;
+
+			case ACL_USER_OBJ:
+			case ACL_GROUP_OBJ:
+			case ACL_MASK:
+			case ACL_OTHER:
+				e += sizeof(reiserfs_acl_entry_short);
+				break;
+
+			default:
+				goto fail;
+		}
+	}
+	return (char *)ext_acl;
+
+fail:
+	kfree(ext_acl);
+	return ERR_PTR(-EINVAL);
+}
+
+/*
+ * Inode operation get_posix_acl().
+ *
+ * inode->i_sem: down
+ * BKL held [before 2.5.x]
+ */
+struct posix_acl *
+reiserfs_get_acl(struct inode *inode, int type)
+{
+	char *name, *value;
+	struct posix_acl *acl, **p_acl;
+	size_t size;
+	int retval;
+        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+
+        switch (type) {
+            case ACL_TYPE_ACCESS:
+                name = XATTR_NAME_ACL_ACCESS;
+                p_acl = &reiserfs_i->i_acl_access;
+                break;
+            case ACL_TYPE_DEFAULT:
+                name = XATTR_NAME_ACL_DEFAULT;
+                p_acl = &reiserfs_i->i_acl_default;
+                break;
+            default:
+                return ERR_PTR (-EINVAL);
+        }
+
+        if (IS_ERR (*p_acl)) {
+            if (PTR_ERR (*p_acl) == -ENODATA)
+                return NULL;
+        } else if (*p_acl != NULL)
+            return posix_acl_dup (*p_acl);
+
+        size = reiserfs_xattr_get (inode, name, NULL, 0);
+        if ((int)size < 0) {
+            if (size == -ENODATA || size == -ENOSYS) {
+		*p_acl = ERR_PTR (-ENODATA);
+		return NULL;
+            }
+            return ERR_PTR (size);
+        }
+
+        value = kmalloc (size, GFP_NOFS);
+        if (!value)
+            return ERR_PTR (-ENOMEM);
+
+	retval = reiserfs_xattr_get(inode, name, value, size);
+	if (retval == -ENODATA || retval == -ENOSYS) {
+		/* This shouldn't actually happen as it should have
+		   been caught above.. but just in case */
+		acl = NULL;
+		*p_acl = ERR_PTR (-ENODATA);
+        } else if (retval < 0) {
+		acl = ERR_PTR(retval);
+	} else {
+		acl = posix_acl_from_disk(value, retval);
+		*p_acl = posix_acl_dup (acl);
+        }
+
+	kfree(value);
+	return acl;
+}
+
+/*
+ * Inode operation set_posix_acl().
+ *
+ * inode->i_sem: down
+ * BKL held [before 2.5.x]
+ */
+int
+reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
+{
+        char *name;
+	void *value = NULL;
+	struct posix_acl **p_acl;
+	size_t size;
+	int error;
+        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+
+	if (S_ISLNK(inode->i_mode))
+		return -EOPNOTSUPP;
+
+        switch (type) {
+            case ACL_TYPE_ACCESS:
+                name = XATTR_NAME_ACL_ACCESS;
+                p_acl = &reiserfs_i->i_acl_access;
+                if (acl) {
+                    mode_t mode = inode->i_mode;
+                    error = posix_acl_equiv_mode (acl, &mode);
+                    if (error < 0)
+                        return error;
+                    else {
+                        inode->i_mode = mode;
+                        if (error == 0)
+                            acl = NULL;
+                    }
+                }
+                break;
+            case ACL_TYPE_DEFAULT:
+                name = XATTR_NAME_ACL_DEFAULT;
+                p_acl = &reiserfs_i->i_acl_default;
+                if (!S_ISDIR (inode->i_mode))
+                    return acl ? -EACCES : 0;
+                break;
+            default:
+                return -EINVAL;
+        }
+
+ 	if (acl) {
+            value = posix_acl_to_disk(acl, &size);
+            if (IS_ERR(value))
+                return (int)PTR_ERR(value);
+            error = reiserfs_xattr_set(inode, name, value, size, 0);
+	} else {
+            error = reiserfs_xattr_del (inode, name);
+            if (error == -ENODATA)
+                error = 0;
+        }
+
+	if (value)
+		kfree(value);
+
+        if (!error) {
+            /* Release the old one */
+            if (!IS_ERR (*p_acl) && *p_acl)
+                posix_acl_release (*p_acl);
+
+            if (acl == NULL)
+                *p_acl = ERR_PTR (-ENODATA);
+            else
+                *p_acl = posix_acl_dup (acl);
+        }
+
+	return error;
+}
+
+/* dir->i_sem: down,
+ * inode is new and not released into the wild yet */
+int
+reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode)
+{
+    struct posix_acl *acl;
+    int err = 0;
+
+    /* ACLs only get applied to files and directories */
+    if (S_ISLNK (inode->i_mode))
+        return 0;
+
+    /* ACLs can only be used on "new" objects, so if it's an old object
+     * there is nothing to inherit from */
+    if (get_inode_sd_version (dir) == STAT_DATA_V1)
+        goto apply_umask;
+
+    /* Don't apply ACLs to objects in the .reiserfs_priv tree.. This
+     * would be useless since permissions are ignored, and a pain because
+     * it introduces locking cycles */
+    if (is_reiserfs_priv_object (dir)) {
+        REISERFS_I(inode)->i_flags |= i_priv_object;
+        goto apply_umask;
+    }
+
+    acl = reiserfs_get_acl (dir, ACL_TYPE_DEFAULT);
+    if (IS_ERR (acl)) {
+        if (PTR_ERR (acl) == -ENODATA)
+            goto apply_umask;
+        return PTR_ERR (acl);
+    }
+
+    if (acl) {
+        struct posix_acl *acl_copy;
+        mode_t mode = inode->i_mode;
+        int need_acl;
+
+        /* Copy the default ACL to the default ACL of a new directory */
+        if (S_ISDIR (inode->i_mode)) {
+            err = reiserfs_set_acl (inode, ACL_TYPE_DEFAULT, acl);
+            if (err)
+                goto cleanup;
+        }
+
+        /* Now we reconcile the new ACL and the mode,
+           potentially modifying both */
+        acl_copy = posix_acl_clone (acl, GFP_NOFS);
+        if (!acl_copy) {
+            err = -ENOMEM;
+            goto cleanup;
+        }
+
+
+        need_acl = posix_acl_create_masq (acl_copy, &mode);
+        if (need_acl >= 0) {
+            if (mode != inode->i_mode) {
+                inode->i_mode = mode;
+            }
+
+            /* If we need an ACL.. */
+            if (need_acl > 0) {
+                err = reiserfs_set_acl (inode, ACL_TYPE_ACCESS, acl_copy);
+                if (err)
+                    goto cleanup_copy;
+            }
+        }
+cleanup_copy:
+        posix_acl_release (acl_copy);
+cleanup:
+        posix_acl_release (acl);
+    } else {
+apply_umask:
+        /* no ACL, apply umask */
+        inode->i_mode &= ~current->fs->umask;
+    }
+
+    return err;
+}
+
+/* Looks up and caches the result of the default ACL.
+ * We do this so that we don't need to carry the xattr_sem into
+ * reiserfs_new_inode if we don't need to */
+int
+reiserfs_cache_default_acl (struct inode *inode)
+{
+    int ret = 0;
+    if (reiserfs_posixacl (inode->i_sb) &&
+        !is_reiserfs_priv_object (inode)) {
+        struct posix_acl *acl;
+        reiserfs_read_lock_xattr_i (inode);
+        reiserfs_read_lock_xattrs (inode->i_sb);
+        acl = reiserfs_get_acl (inode, ACL_TYPE_DEFAULT);
+        reiserfs_read_unlock_xattrs (inode->i_sb);
+        reiserfs_read_unlock_xattr_i (inode);
+        ret = acl ? 1 : 0;
+        posix_acl_release (acl);
+    }
+
+    return ret;
+}
+
+int
+reiserfs_acl_chmod (struct inode *inode)
+{
+        struct posix_acl *acl, *clone;
+        int error;
+
+        if (S_ISLNK(inode->i_mode))
+                return -EOPNOTSUPP;
+
+	if (get_inode_sd_version (inode) == STAT_DATA_V1 ||
+	    !reiserfs_posixacl(inode->i_sb))
+        {
+	    return 0;
+	}
+
+        reiserfs_read_lock_xattrs (inode->i_sb);
+        acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
+        reiserfs_read_unlock_xattrs (inode->i_sb);
+        if (!acl)
+                return 0;
+        if (IS_ERR(acl))
+                return PTR_ERR(acl);
+        clone = posix_acl_clone(acl, GFP_NOFS);
+        posix_acl_release(acl);
+        if (!clone)
+                return -ENOMEM;
+        error = posix_acl_chmod_masq(clone, inode->i_mode);
+        if (!error) {
+                int lock = !has_xattr_dir (inode);
+                reiserfs_write_lock_xattr_i (inode);
+                if (lock)
+                    reiserfs_write_lock_xattrs (inode->i_sb);
+                else
+                    reiserfs_read_lock_xattrs (inode->i_sb);
+                error = reiserfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
+                if (lock)
+                    reiserfs_write_unlock_xattrs (inode->i_sb);
+                else
+                    reiserfs_read_unlock_xattrs (inode->i_sb);
+                reiserfs_write_unlock_xattr_i (inode);
+        }
+        posix_acl_release(clone);
+        return error;
+}
+
+static int
+posix_acl_access_get(struct inode *inode, const char *name,
+			  void *buffer, size_t size)
+{
+	if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1)
+		return -EINVAL;
+	return xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
+}
+
+static int
+posix_acl_access_set(struct inode *inode, const char *name,
+			  const void *value, size_t size, int flags)
+{
+	if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1)
+		return -EINVAL;
+	return xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
+}
+
+static int
+posix_acl_access_del (struct inode *inode, const char *name)
+{
+    struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+    struct posix_acl **acl = &reiserfs_i->i_acl_access;
+    if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1)
+	return -EINVAL;
+    if (!IS_ERR (*acl) && *acl) {
+        posix_acl_release (*acl);
+        *acl = ERR_PTR (-ENODATA);
+    }
+
+    return 0;
+}
+
+static int
+posix_acl_access_list (struct inode *inode, const char *name, int namelen, char *out)
+{
+    int len = namelen;
+    if (!reiserfs_posixacl (inode->i_sb))
+        return 0;
+    if (out)
+        memcpy (out, name, len);
+
+    return len;
+}
+
+struct reiserfs_xattr_handler posix_acl_access_handler = {
+    prefix: XATTR_NAME_ACL_ACCESS,
+    get: posix_acl_access_get,
+    set: posix_acl_access_set,
+    del: posix_acl_access_del,
+    list: posix_acl_access_list,
+};
+
+static int
+posix_acl_default_get (struct inode *inode, const char *name,
+			   void *buffer, size_t size)
+{
+	if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1)
+		return -EINVAL;
+	return xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
+}
+
+static int
+posix_acl_default_set(struct inode *inode, const char *name,
+			   const void *value, size_t size, int flags)
+{
+	if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1)
+		return -EINVAL;
+	return xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
+}
+
+static int
+posix_acl_default_del (struct inode *inode, const char *name)
+{
+    struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+    struct posix_acl **acl = &reiserfs_i->i_acl_default;
+    if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1)
+	return -EINVAL;
+    if (!IS_ERR (*acl) && *acl) {
+        posix_acl_release (*acl);
+        *acl = ERR_PTR (-ENODATA);
+    }
+
+    return 0;
+}
+
+static int
+posix_acl_default_list (struct inode *inode, const char *name, int namelen, char *out)
+{
+    int len = namelen;
+    if (!reiserfs_posixacl (inode->i_sb))
+        return 0;
+    if (out)
+        memcpy (out, name, len);
+
+    return len;
+}
+
+struct reiserfs_xattr_handler posix_acl_default_handler = {
+    prefix: XATTR_NAME_ACL_DEFAULT,
+    get: posix_acl_default_get,
+    set: posix_acl_default_set,
+    del: posix_acl_default_del,
+    list: posix_acl_default_list,
+};
diff -Nru a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/reiserfs/xattr_security.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,69 @@
+#include <linux/reiserfs_fs.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/pagemap.h>
+#include <linux/xattr.h>
+#include <linux/reiserfs_xattr.h>
+#include <asm/uaccess.h>
+
+#define XATTR_SECURITY_PREFIX "security."
+
+static int
+security_get (struct inode *inode, const char *name, void *buffer, size_t size)
+{
+    if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
+        return -EINVAL;
+
+    if (is_reiserfs_priv_object(inode))
+        return -EPERM;
+
+    return reiserfs_xattr_get (inode, name, buffer, size);
+}
+
+static int
+security_set (struct inode *inode, const char *name, const void *buffer,
+          size_t size, int flags)
+{
+    if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
+        return -EINVAL;
+
+    if (is_reiserfs_priv_object(inode))
+        return -EPERM;
+
+    return reiserfs_xattr_set (inode, name, buffer, size, flags);
+}
+
+static int
+security_del (struct inode *inode, const char *name)
+{
+    if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
+        return -EINVAL;
+
+    if (is_reiserfs_priv_object(inode))
+        return -EPERM;
+
+    return 0;
+}
+
+static int
+security_list (struct inode *inode, const char *name, int namelen, char *out)
+{
+    int len = namelen;
+
+    if (is_reiserfs_priv_object(inode))
+        return 0;
+
+    if (out)
+        memcpy (out, name, len);
+
+    return len;
+}
+
+
+struct reiserfs_xattr_handler security_handler = {
+    prefix: XATTR_SECURITY_PREFIX,
+    get: security_get,
+    set: security_set,
+    del: security_del,
+    list: security_list,
+};
diff -Nru a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/reiserfs/xattr_trusted.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,81 @@
+#include <linux/reiserfs_fs.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/pagemap.h>
+#include <linux/xattr.h>
+#include <linux/reiserfs_xattr.h>
+#include <asm/uaccess.h>
+
+#define XATTR_TRUSTED_PREFIX "trusted."
+
+static int
+trusted_get (struct inode *inode, const char *name, void *buffer, size_t size)
+{
+    if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
+        return -EINVAL;
+
+    if (!reiserfs_xattrs (inode->i_sb))
+        return -EOPNOTSUPP;
+
+    if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
+        return -EPERM;
+
+    return reiserfs_xattr_get (inode, name, buffer, size);
+}
+
+static int
+trusted_set (struct inode *inode, const char *name, const void *buffer,
+          size_t size, int flags)
+{
+    if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
+        return -EINVAL;
+
+    if (!reiserfs_xattrs (inode->i_sb))
+        return -EOPNOTSUPP;
+
+    if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
+        return -EPERM;
+
+    return reiserfs_xattr_set (inode, name, buffer, size, flags);
+}
+
+static int
+trusted_del (struct inode *inode, const char *name)
+{
+    if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
+        return -EINVAL;
+
+    if (!reiserfs_xattrs (inode->i_sb))
+        return -EOPNOTSUPP;
+
+    if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
+        return -EPERM;
+
+    return 0;
+}
+
+static int
+trusted_list (struct inode *inode, const char *name, int namelen, char *out)
+{
+    int len = namelen;
+
+    if (!reiserfs_xattrs (inode->i_sb))
+        return 0;
+
+    if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
+        return 0;
+
+    if (out)
+        memcpy (out, name, len);
+
+    return len;
+}
+
+
+struct reiserfs_xattr_handler trusted_handler = {
+    prefix: XATTR_TRUSTED_PREFIX,
+    get: trusted_get,
+    set: trusted_set,
+    del: trusted_del,
+    list: trusted_list,
+};
diff -Nru a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/reiserfs/xattr_user.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,99 @@
+#include <linux/reiserfs_fs.h>
+#include <linux/errno.h>
+#include <linux/fs.h>
+#include <linux/pagemap.h>
+#include <linux/xattr.h>
+#include <linux/reiserfs_xattr.h>
+#include <asm/uaccess.h>
+
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
+# include <linux/reiserfs_acl.h>
+#endif
+
+#define XATTR_USER_PREFIX "user."
+
+static int
+user_get (struct inode *inode, const char *name, void *buffer, size_t size)
+{
+
+    int error;
+
+    if (strlen(name) < sizeof(XATTR_USER_PREFIX))
+        return -EINVAL;
+
+    if (!reiserfs_xattrs_user (inode->i_sb))
+        return -EOPNOTSUPP;
+
+    error = reiserfs_permission_locked (inode, MAY_READ, NULL);
+    if (error)
+        return error;
+
+    return reiserfs_xattr_get (inode, name, buffer, size);
+}
+
+static int
+user_set (struct inode *inode, const char *name, const void *buffer,
+          size_t size, int flags)
+{
+
+    int error;
+
+    if (strlen(name) < sizeof(XATTR_USER_PREFIX))
+        return -EINVAL;
+
+    if (!reiserfs_xattrs_user (inode->i_sb))
+        return -EOPNOTSUPP;
+
+    if (!S_ISREG (inode->i_mode) &&
+        (!S_ISDIR (inode->i_mode) || inode->i_mode & S_ISVTX))
+        return -EPERM;
+
+    error = reiserfs_permission_locked (inode, MAY_WRITE, NULL);
+    if (error)
+        return error;
+
+    return reiserfs_xattr_set (inode, name, buffer, size, flags);
+}
+
+static int
+user_del (struct inode *inode, const char *name)
+{
+    int error;
+
+    if (strlen(name) < sizeof(XATTR_USER_PREFIX))
+        return -EINVAL;
+
+    if (!reiserfs_xattrs_user (inode->i_sb))
+        return -EOPNOTSUPP;
+
+    if (!S_ISREG (inode->i_mode) &&
+        (!S_ISDIR (inode->i_mode) || inode->i_mode & S_ISVTX))
+        return -EPERM;
+
+    error = reiserfs_permission_locked (inode, MAY_WRITE, NULL);
+    if (error)
+        return error;
+
+    return 0;
+}
+
+static int
+user_list (struct inode *inode, const char *name, int namelen, char *out)
+{
+    int len = namelen;
+    if (!reiserfs_xattrs_user (inode->i_sb))
+        return 0;
+
+    if (out)
+        memcpy (out, name, len);
+
+    return len;
+}
+
+struct reiserfs_xattr_handler user_handler = {
+    prefix: XATTR_USER_PREFIX,
+    get: user_get,
+    set: user_set,
+    del: user_del,
+    list: user_list,
+};
diff -Nru a/fs/smbfs/file.c b/fs/smbfs/file.c
--- a/fs/smbfs/file.c	Tue Jun 15 22:20:58 2004
+++ b/fs/smbfs/file.c	Tue Jun 15 22:20:58 2004
@@ -215,7 +215,7 @@
 }
 
 static ssize_t
-smb_file_read(struct file * file, char * buf, size_t count, loff_t *ppos)
+smb_file_read(struct file * file, char __user * buf, size_t count, loff_t *ppos)
 {
 	struct dentry * dentry = file->f_dentry;
 	ssize_t	status;
@@ -318,7 +318,7 @@
  * Write to a file (through the page cache).
  */
 static ssize_t
-smb_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+smb_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
 	struct dentry * dentry = file->f_dentry;
 	ssize_t	result;
diff -Nru a/fs/smbfs/ioctl.c b/fs/smbfs/ioctl.c
--- a/fs/smbfs/ioctl.c	Tue Jun 15 22:20:36 2004
+++ b/fs/smbfs/ioctl.c	Tue Jun 15 22:20:36 2004
@@ -35,11 +35,11 @@
 		uid_t uid32;
 	case SMB_IOC_GETMOUNTUID:
 		SET_UID(uid16, server->mnt->mounted_uid);
-		result = put_user(uid16, (uid16_t *) arg);
+		result = put_user(uid16, (uid16_t __user *) arg);
 		break;
 	case SMB_IOC_GETMOUNTUID32:
 		SET_UID(uid32, server->mnt->mounted_uid);
-		result = put_user(uid32, (uid_t *) arg);
+		result = put_user(uid32, (uid_t __user *) arg);
 		break;
 
 	case SMB_IOC_NEWCONN:
@@ -56,7 +56,7 @@
 		}
 
 		result = -EFAULT;
-		if (!copy_from_user(&opt, (void *)arg, sizeof(opt)))
+		if (!copy_from_user(&opt, (void __user *)arg, sizeof(opt)))
 			result = smb_newconn(server, &opt);
 		break;
 	default:
diff -Nru a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c
--- a/fs/smbfs/smbiod.c	Tue Jun 15 22:20:42 2004
+++ b/fs/smbfs/smbiod.c	Tue Jun 15 22:20:42 2004
@@ -54,7 +54,7 @@
 /*
  * called when there's work for us to do
  */
-void smbiod_wake_up()
+void smbiod_wake_up(void)
 {
 	if (smbiod_state == SMBIOD_DEAD)
 		return;
diff -Nru a/fs/stat.c b/fs/stat.c
--- a/fs/stat.c	Tue Jun 15 22:20:37 2004
+++ b/fs/stat.c	Tue Jun 15 22:20:37 2004
@@ -16,6 +16,7 @@
 #include <linux/security.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 void generic_fillattr(struct inode *inode, struct kstat *stat)
 {
@@ -105,10 +106,7 @@
 
 EXPORT_SYMBOL(vfs_fstat);
 
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) \
-  && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) \
-  && !defined(__arm__) && !defined(CONFIG_V850) && !defined(__powerpc64__) \
-  && !defined(__mips__)
+#ifdef __ARCH_WANT_OLD_STAT
 
 /*
  * For backward compatibility?  Maybe this should be moved
@@ -133,6 +131,8 @@
 	tmp.st_ino = stat->ino;
 	tmp.st_mode = stat->mode;
 	tmp.st_nlink = stat->nlink;
+	if (tmp.st_nlink != stat->nlink)
+		return -EOVERFLOW;
 	SET_UID(tmp.st_uid, stat->uid);
 	SET_GID(tmp.st_gid, stat->gid);
 	tmp.st_rdev = old_encode_dev(stat->rdev);
@@ -178,7 +178,7 @@
 	return error;
 }
 
-#endif
+#endif /* __ARCH_WANT_OLD_STAT */
 
 static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
 {
@@ -201,6 +201,8 @@
 	tmp.st_ino = stat->ino;
 	tmp.st_mode = stat->mode;
 	tmp.st_nlink = stat->nlink;
+	if (tmp.st_nlink != stat->nlink)
+		return -EOVERFLOW;
 	SET_UID(tmp.st_uid, stat->uid);
 	SET_GID(tmp.st_gid, stat->gid);
 #if BITS_PER_LONG == 32
@@ -284,7 +286,7 @@
 
 
 /* ---------- LFS-64 ----------- */
-#if !defined(__ia64__) && !defined(__mips64) && !defined(__x86_64__) && !defined(CONFIG_ARCH_S390X)
+#ifdef __ARCH_WANT_STAT64
 
 static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
 {
@@ -352,7 +354,7 @@
 	return error;
 }
 
-#endif /* LFS-64 */
+#endif /* __ARCH_WANT_STAT64 */
 
 void inode_add_bytes(struct inode *inode, loff_t bytes)
 {
diff -Nru a/fs/super.c b/fs/super.c
--- a/fs/super.c	Tue Jun 15 22:20:40 2004
+++ b/fs/super.c	Tue Jun 15 22:20:40 2004
@@ -101,6 +101,21 @@
 
 /* Superblock refcounting  */
 
+/*
+ * Drop a superblock's refcount.  Returns non-zero if the superblock was
+ * destroyed.  The caller must hold sb_lock.
+ */
+int __put_super(struct super_block *sb)
+{
+	int ret = 0;
+
+	if (!--sb->s_count) {
+		destroy_super(sb);
+		ret = 1;
+	}
+	return ret;
+}
+
 /**
  *	put_super	-	drop a temporary reference to superblock
  *	@s: superblock in question
@@ -108,14 +123,14 @@
  *	Drops a temporary reference, frees superblock if there's no
  *	references left.
  */
-static inline void put_super(struct super_block *s)
+static void put_super(struct super_block *sb)
 {
 	spin_lock(&sb_lock);
-	if (!--s->s_count)
-		destroy_super(s);
+	__put_super(sb);
 	spin_unlock(&sb_lock);
 }
 
+
 /**
  *	deactivate_super	-	drop an active reference to superblock
  *	@s: superblock to deactivate
@@ -266,6 +281,7 @@
 		return ERR_PTR(err);
 	}
 	s->s_type = type;
+	strlcpy(s->s_id, type->name, sizeof(s->s_id));
 	list_add(&s->s_list, super_blocks.prev);
 	list_add(&s->s_instances, &type->fs_supers);
 	spin_unlock(&sb_lock);
diff -Nru a/fs/sysfs/bin.c b/fs/sysfs/bin.c
--- a/fs/sysfs/bin.c	Tue Jun 15 22:20:40 2004
+++ b/fs/sysfs/bin.c	Tue Jun 15 22:20:40 2004
@@ -94,7 +94,7 @@
 
 static int open(struct inode * inode, struct file * file)
 {
-	struct kobject * kobj = kobject_get(file->f_dentry->d_parent->d_fsdata);
+	struct kobject *kobj = sysfs_get_kobject(file->f_dentry->d_parent);
 	struct bin_attribute * attr = file->f_dentry->d_fsdata;
 	int error = -EINVAL;
 
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
--- a/fs/sysfs/dir.c	Tue Jun 15 22:20:39 2004
+++ b/fs/sysfs/dir.c	Tue Jun 15 22:20:39 2004
@@ -10,6 +10,8 @@
 #include <linux/kobject.h>
 #include "sysfs.h"
 
+DECLARE_RWSEM(sysfs_rename_sem);
+
 static int init_dir(struct inode * inode)
 {
 	inode->i_op = &simple_dir_inode_operations;
@@ -134,8 +136,14 @@
 			/**
 			 * Unlink and unhash.
 			 */
+			__d_drop(d);
 			spin_unlock(&dcache_lock);
-			d_delete(d);
+			/* release the target kobject in case of 
+			 * a symlink
+			 */
+			if (S_ISLNK(d->d_inode->i_mode))
+				kobject_put(d->d_fsdata);
+			
 			simple_unlink(dentry->d_inode,d);
 			dput(d);
 			pr_debug(" done\n");
@@ -154,24 +162,35 @@
 	dput(dentry);
 }
 
-void sysfs_rename_dir(struct kobject * kobj, const char *new_name)
+int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
 {
+	int error = 0;
 	struct dentry * new_dentry, * parent;
 
 	if (!strcmp(kobject_name(kobj), new_name))
-		return;
+		return -EINVAL;
 
 	if (!kobj->parent)
-		return;
+		return -EINVAL;
 
+	down_write(&sysfs_rename_sem);
 	parent = kobj->parent->dentry;
 
 	down(&parent->d_inode->i_sem);
 
 	new_dentry = sysfs_get_dentry(parent, new_name);
-	d_move(kobj->dentry, new_dentry);
-	kobject_set_name(kobj,new_name);
+	if (!IS_ERR(new_dentry)) {
+  		if (!new_dentry->d_inode) {
+			error = kobject_set_name(kobj,new_name);
+			if (!error)
+				d_move(kobj->dentry, new_dentry);
+		}
+		dput(new_dentry);
+	}
 	up(&parent->d_inode->i_sem);	
+	up_write(&sysfs_rename_sem);
+
+	return error;
 }
 
 EXPORT_SYMBOL(sysfs_create_dir);
diff -Nru a/fs/sysfs/file.c b/fs/sysfs/file.c
--- a/fs/sysfs/file.c	Tue Jun 15 22:20:36 2004
+++ b/fs/sysfs/file.c	Tue Jun 15 22:20:36 2004
@@ -89,6 +89,7 @@
 		return -ENOMEM;
 
 	count = ops->show(kobj,attr,buffer->page);
+	BUG_ON(count > PAGE_SIZE);
 	if (count >= 0)
 		buffer->count = count;
 	else
@@ -238,7 +239,7 @@
 
 static int check_perm(struct inode * inode, struct file * file)
 {
-	struct kobject * kobj = kobject_get(file->f_dentry->d_parent->d_fsdata);
+	struct kobject *kobj = sysfs_get_kobject(file->f_dentry->d_parent);
 	struct attribute * attr = file->f_dentry->d_fsdata;
 	struct sysfs_buffer * buffer;
 	struct sysfs_ops * ops = NULL;
diff -Nru a/fs/sysfs/inode.c b/fs/sysfs/inode.c
--- a/fs/sysfs/inode.c	Tue Jun 15 22:20:44 2004
+++ b/fs/sysfs/inode.c	Tue Jun 15 22:20:44 2004
@@ -96,7 +96,12 @@
 			pr_debug("sysfs: Removing %s (%d)\n", victim->d_name.name,
 				 atomic_read(&victim->d_count));
 
-			d_delete(victim);
+			d_drop(victim);
+			/* release the target kobject in case of 
+			 * a symlink
+			 */
+			if (S_ISLNK(victim->d_inode->i_mode))
+				kobject_put(victim->d_fsdata);
 			simple_unlink(dir->d_inode,victim);
 		}
 		/*
diff -Nru a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
--- a/fs/sysfs/symlink.c	Tue Jun 15 22:20:40 2004
+++ b/fs/sysfs/symlink.c	Tue Jun 15 22:20:40 2004
@@ -8,27 +8,17 @@
 
 #include "sysfs.h"
 
+static struct inode_operations sysfs_symlink_inode_operations = {
+	.readlink = sysfs_readlink,
+	.follow_link = sysfs_follow_link,
+};
 
 static int init_symlink(struct inode * inode)
 {
-	inode->i_op = &page_symlink_inode_operations;
+	inode->i_op = &sysfs_symlink_inode_operations;
 	return 0;
 }
 
-static int sysfs_symlink(struct inode * dir, struct dentry *dentry, const char * symname)
-{
-	int error;
-
-	error = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink);
-	if (!error) {
-		int l = strlen(symname)+1;
-		error = page_symlink(dentry->d_inode, symname, l);
-		if (error)
-			iput(dentry->d_inode);
-	}
-	return error;
-}
-
 static int object_depth(struct kobject * kobj)
 {
 	struct kobject * p = kobj;
@@ -74,37 +64,20 @@
 	struct dentry * dentry = kobj->dentry;
 	struct dentry * d;
 	int error = 0;
-	int size;
-	int depth;
-	char * path;
-	char * s;
-
-	depth = object_depth(kobj);
-	size = object_path_length(target) + depth * 3 - 1;
-	if (size > PATH_MAX)
-		return -ENAMETOOLONG;
-	pr_debug("%s: depth = %d, size = %d\n",__FUNCTION__,depth,size);
-
-	path = kmalloc(size,GFP_KERNEL);
-	if (!path)
-		return -ENOMEM;
-	memset(path,0,size);
-
-	for (s = path; depth--; s += 3)
-		strcpy(s,"../");
-
-	fill_object_path(target,path,size);
-	pr_debug("%s: path = '%s'\n",__FUNCTION__,path);
 
 	down(&dentry->d_inode->i_sem);
 	d = sysfs_get_dentry(dentry,name);
-	if (!IS_ERR(d))
-		error = sysfs_symlink(dentry->d_inode,d,path);
-	else
+	if (!IS_ERR(d)) {
+		error = sysfs_create(d, S_IFLNK|S_IRWXUGO, init_symlink);
+		if (!error)
+			/* 
+			 * associate the link dentry with the target kobject 
+			 */
+			d->d_fsdata = kobject_get(target);
+		dput(d);
+	} else 
 		error = PTR_ERR(d);
-	dput(d);
 	up(&dentry->d_inode->i_sem);
-	kfree(path);
 	return error;
 }
 
@@ -120,6 +93,86 @@
 	sysfs_hash_and_remove(kobj->dentry,name);
 }
 
+static int sysfs_get_target_path(struct kobject * kobj, struct kobject * target,
+				   char *path)
+{
+	char * s;
+	int depth, size;
+
+	depth = object_depth(kobj);
+	size = object_path_length(target) + depth * 3 - 1;
+	if (size > PATH_MAX)
+		return -ENAMETOOLONG;
+
+	pr_debug("%s: depth = %d, size = %d\n", __FUNCTION__, depth, size);
+
+	for (s = path; depth--; s += 3)
+		strcpy(s,"../");
+
+	fill_object_path(target, path, size);
+	pr_debug("%s: path = '%s'\n", __FUNCTION__, path);
+
+	return 0;
+}
+
+static int sysfs_getlink(struct dentry *dentry, char * path)
+{
+	struct kobject *kobj, *target_kobj;
+	int error = 0;
+
+	kobj = sysfs_get_kobject(dentry->d_parent);
+	if (!kobj)
+		return -EINVAL;
+
+	target_kobj = sysfs_get_kobject(dentry);
+	if (!target_kobj) {
+		kobject_put(kobj);
+		return -EINVAL;
+	}
+
+	down_read(&sysfs_rename_sem);
+	error = sysfs_get_target_path(kobj, target_kobj, path);
+	up_read(&sysfs_rename_sem);
+	
+	kobject_put(kobj);
+	kobject_put(target_kobj);
+	return error;
+
+}
+
+int sysfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
+{
+	int error = 0;
+	unsigned long page = get_zeroed_page(GFP_KERNEL);
+
+	if (!page)
+		return -ENOMEM;
+
+	error = sysfs_getlink(dentry, (char *) page);
+	if (!error)
+	        error = vfs_readlink(dentry, buffer, buflen, (char *) page);
+
+	free_page(page);
+
+	return error;
+}
+
+int sysfs_follow_link(struct dentry *dentry, struct nameidata *nd)
+{
+	int error = 0;
+	unsigned long page = get_zeroed_page(GFP_KERNEL);
+
+	if (!page)
+		return -ENOMEM;
+
+	error = sysfs_getlink(dentry, (char *) page); 
+	if (!error)
+	        error = vfs_follow_link(nd, (char *) page);
+
+	free_page(page);
+
+	return error;
+}
 
 EXPORT_SYMBOL(sysfs_create_link);
 EXPORT_SYMBOL(sysfs_remove_link);
diff -Nru a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
--- a/fs/sysfs/sysfs.h	Tue Jun 15 22:20:43 2004
+++ b/fs/sysfs/sysfs.h	Tue Jun 15 22:20:43 2004
@@ -11,3 +11,19 @@
 
 extern int sysfs_create_subdir(struct kobject *, const char *, struct dentry **);
 extern void sysfs_remove_subdir(struct dentry *);
+
+extern int sysfs_readlink(struct dentry *, char __user *, int );
+extern int sysfs_follow_link(struct dentry *, struct nameidata *);
+extern struct rw_semaphore sysfs_rename_sem;
+
+static inline struct kobject *sysfs_get_kobject(struct dentry *dentry)
+{
+	struct kobject * kobj = NULL;
+
+	spin_lock(&dcache_lock);
+	if (!d_unhashed(dentry))
+		kobj = kobject_get(dentry->d_fsdata);
+	spin_unlock(&dcache_lock);
+
+	return kobj;
+}
diff -Nru a/fs/udf/file.c b/fs/udf/file.c
--- a/fs/udf/file.c	Tue Jun 15 22:20:41 2004
+++ b/fs/udf/file.c	Tue Jun 15 22:20:41 2004
@@ -109,7 +109,7 @@
 	.commit_write		= udf_adinicb_commit_write,
 };
 
-static ssize_t udf_file_write(struct file * file, const char * buf,
+static ssize_t udf_file_write(struct file * file, const char __user * buf,
 	size_t count, loff_t *ppos)
 {
 	ssize_t retval;
@@ -204,26 +204,26 @@
 	switch (cmd)
 	{
 		case UDF_GETVOLIDENT:
-			return copy_to_user((char *)arg,
+			return copy_to_user((char __user *)arg,
 				UDF_SB_VOLIDENT(inode->i_sb), 32) ? -EFAULT : 0;
 		case UDF_RELOCATE_BLOCKS:
 		{
 			long old, new;
 
 			if (!capable(CAP_SYS_ADMIN)) return -EACCES;
-			if (get_user(old, (long *)arg)) return -EFAULT;
+			if (get_user(old, (long __user *)arg)) return -EFAULT;
 			if ((result = udf_relocate_blocks(inode->i_sb,
 					old, &new)) == 0)
-				result = put_user(new, (long *)arg);
+				result = put_user(new, (long __user *)arg);
 
 			return result;
 		}
 		case UDF_GETEASIZE:
-			result = put_user(UDF_I_LENEATTR(inode), (int *)arg);
+			result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg);
 			break;
 
 		case UDF_GETEABLOCK:
-			result = copy_to_user((char *)arg, UDF_I_DATA(inode),
+			result = copy_to_user((char __user *)arg, UDF_I_DATA(inode),
 				UDF_I_LENEATTR(inode)) ? -EFAULT : 0;
 			break;
 	}
diff -Nru a/fs/udf/namei.c b/fs/udf/namei.c
--- a/fs/udf/namei.c	Tue Jun 15 22:20:44 2004
+++ b/fs/udf/namei.c	Tue Jun 15 22:20:44 2004
@@ -154,8 +154,8 @@
 {
 	struct fileIdentDesc *fi=NULL;
 	loff_t f_pos;
-	int block, namelen;
-	char name[UDF_NAME_LEN], fname[UDF_NAME_LEN];
+	int block, flen;
+	char fname[UDF_NAME_LEN];
 	char *nameptr;
 	uint8_t lfi;
 	uint16_t liu;
@@ -167,9 +167,6 @@
 	if (!dir)
 		return NULL;
 
-	if ( !(namelen = udf_put_filename(dir->i_sb, dentry->d_name.name, name, dentry->d_name.len)))
-		return NULL;
-
 	f_pos = (udf_ext0_offset(dir) >> 2);
 
 	fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
@@ -253,10 +250,13 @@
 		if (!lfi)
 			continue;
 
-		if (udf_match(namelen, name, lfi, nameptr))
+		if ((flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi)))
 		{
-			udf_release_data(bh);
-			return fi;
+			if (udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name))
+			{
+				udf_release_data(bh);
+				return fi;
+			}
 		}
 	}
 	if (fibh->sbh != fibh->ebh)
@@ -353,6 +353,7 @@
 	char name[UDF_NAME_LEN], fname[UDF_NAME_LEN];
 	int namelen;
 	loff_t f_pos;
+	int flen;
 	char *nameptr;
 	loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
 	int nfidlen;
@@ -480,7 +481,8 @@
 		if (!lfi || !dentry)
 			continue;
 
-		if (udf_match(namelen, name, lfi, nameptr))
+		if ((flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi)) &&
+			udf_match(flen, fname, dentry->d_name.len, dentry->d_name.name))
 		{
 			if (fibh->sbh != fibh->ebh)
 				udf_release_data(fibh->ebh);
diff -Nru a/fs/xfs/Makefile b/fs/xfs/Makefile
--- a/fs/xfs/Makefile	Tue Jun 15 22:20:42 2004
+++ b/fs/xfs/Makefile	Tue Jun 15 22:20:42 2004
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of version 2 of the GNU General Public License as
@@ -30,10 +30,10 @@
 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
 #
 
-EXTRA_CFLAGS +=	 -Ifs/xfs -Ifs/xfs/linux -funsigned-char
+EXTRA_CFLAGS +=	 -Ifs/xfs -Ifs/xfs/linux-2.6 -funsigned-char
 
 ifeq ($(CONFIG_XFS_DEBUG),y)
-	EXTRA_CFLAGS += -g -DSTATIC="" -DDEBUG -DXFSDEBUG
+	EXTRA_CFLAGS += -g -DSTATIC="" -DDEBUG
 	EXTRA_CFLAGS += -DPAGEBUF_LOCK_TRACKING
 endif
 ifeq ($(CONFIG_XFS_TRACE),y)
@@ -69,8 +69,8 @@
 xfs-$(CONFIG_XFS_POSIX_ACL)	+= xfs_acl.o
 xfs-$(CONFIG_XFS_POSIX_CAP)	+= xfs_cap.o
 xfs-$(CONFIG_XFS_POSIX_MAC)	+= xfs_mac.o
-xfs-$(CONFIG_PROC_FS)		+= linux/xfs_stats.o
-xfs-$(CONFIG_SYSCTL)		+= linux/xfs_sysctl.o
+xfs-$(CONFIG_PROC_FS)		+= linux-2.6/xfs_stats.o
+xfs-$(CONFIG_SYSCTL)		+= linux-2.6/xfs_sysctl.o
 
 
 xfs-y				+= xfs_alloc.o \
@@ -124,8 +124,8 @@
 
 xfs-$(CONFIG_XFS_TRACE)		+= xfs_dir2_trace.o
 
-# Objects in linux/
-xfs-y				+= $(addprefix linux/, \
+# Objects in linux-2.6/
+xfs-y				+= $(addprefix linux-2.6/, \
 				   xfs_aops.o \
 				   xfs_buf.o \
 				   xfs_file.o \
diff -Nru a/fs/xfs/linux/kmem.h b/fs/xfs/linux/kmem.h
--- a/fs/xfs/linux/kmem.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_SUPPORT_KMEM_H__
-#define __XFS_SUPPORT_KMEM_H__
-
-#include <linux/mm.h>
-#include <linux/highmem.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-
-/*
- * Cutoff point to use vmalloc instead of kmalloc.
- */
-#define MAX_SLAB_SIZE	0x10000
-
-/*
- * XFS uses slightly different names for these due to the
- * IRIX heritage.
- */
-#define	kmem_zone	kmem_cache_s
-#define kmem_zone_t	kmem_cache_t
-
-#define KM_SLEEP	0x0001
-#define KM_NOSLEEP	0x0002
-#define KM_NOFS		0x0004
-
-typedef unsigned long xfs_pflags_t;
-
-#define PFLAGS_TEST_FSTRANS()           (current->flags & PF_FSTRANS)
-
-/* these could be nested, so we save state */
-#define PFLAGS_SET_FSTRANS(STATEP) do {	\
-	*(STATEP) = current->flags;	\
-	current->flags |= PF_FSTRANS;	\
-} while (0)
-
-#define PFLAGS_CLEAR_FSTRANS(STATEP) do { \
-	*(STATEP) = current->flags;	\
-	current->flags &= ~PF_FSTRANS;	\
-} while (0)
-
-/* Restore the PF_FSTRANS state to what was saved in STATEP */
-#define PFLAGS_RESTORE_FSTRANS(STATEP) do {     		\
-	current->flags = ((current->flags & ~PF_FSTRANS) |	\
-			  (*(STATEP) & PF_FSTRANS));		\
-} while (0)
-
-#define PFLAGS_DUP(OSTATEP, NSTATEP) do { \
-	*(NSTATEP) = *(OSTATEP);	\
-} while (0)
-
-/*
- * XXX get rid of the unconditional  __GFP_NOFAIL by adding
- * a KM_FAIL flag and using it where we're allowed to fail.
- */
-static __inline unsigned int
-kmem_flags_convert(int flags)
-{
-	int lflags;
-
-#if DEBUG
-	if (unlikely(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS))) {
-		printk(KERN_WARNING
-		    "XFS: memory allocation with wrong flags (%x)\n", flags);
-		BUG();
-	}
-#endif
-
-	lflags = (flags & KM_NOSLEEP) ? GFP_ATOMIC : (GFP_KERNEL|__GFP_NOFAIL);
-
-	/* avoid recusive callbacks to filesystem during transactions */
-	if (PFLAGS_TEST_FSTRANS() || (flags & KM_NOFS))
-		lflags &= ~__GFP_FS;
-
-	return lflags;
-}
-
-static __inline void *
-kmem_alloc(size_t size, int flags)
-{
-	if (unlikely(MAX_SLAB_SIZE < size))
-		/* Avoid doing filesystem sensitive stuff to get this */
-		return __vmalloc(size, kmem_flags_convert(flags), PAGE_KERNEL);
-	return kmalloc(size, kmem_flags_convert(flags));
-}
-
-static __inline void *
-kmem_zalloc(size_t size, int flags)
-{
-	void *ptr = kmem_alloc(size, flags);
-	if (likely(ptr != NULL))
-		memset(ptr, 0, size);
-	return ptr;
-}
-
-static __inline void
-kmem_free(void *ptr, size_t size)
-{
-	if (unlikely((unsigned long)ptr < VMALLOC_START ||
-		     (unsigned long)ptr >= VMALLOC_END))
-		kfree(ptr);
-	else
-		vfree(ptr);
-}
-
-static __inline void *
-kmem_realloc(void *ptr, size_t newsize, size_t oldsize, int flags)
-{
-	void *new = kmem_alloc(newsize, flags);
-
-	if (likely(ptr != NULL)) {
-		if (likely(new != NULL))
-			memcpy(new, ptr, min(oldsize, newsize));
-		kmem_free(ptr, oldsize);
-	}
-
-	return new;
-}
-
-static __inline kmem_zone_t *
-kmem_zone_init(int size, char *zone_name)
-{
-	return kmem_cache_create(zone_name, size, 0, 0, NULL, NULL);
-}
-
-static __inline void *
-kmem_zone_alloc(kmem_zone_t *zone, int flags)
-{
-	return kmem_cache_alloc(zone, kmem_flags_convert(flags));
-}
-
-static __inline void *
-kmem_zone_zalloc(kmem_zone_t *zone, int flags)
-{
-	void *ptr = kmem_zone_alloc(zone, flags);
-	if (likely(ptr != NULL))
-		memset(ptr, 0, kmem_cache_size(zone));
-	return ptr;
-}
-
-static __inline void
-kmem_zone_free(kmem_zone_t *zone, void *ptr)
-{
-	kmem_cache_free(zone, ptr);
-}
-
-typedef struct shrinker *kmem_shaker_t;
-typedef int (*kmem_shake_func_t)(int, unsigned int);
-
-static __inline kmem_shaker_t
-kmem_shake_register(kmem_shake_func_t sfunc)
-{
-	return set_shrinker(DEFAULT_SEEKS, sfunc);
-}
-
-static __inline void
-kmem_shake_deregister(kmem_shaker_t shrinker)
-{
-	remove_shrinker(shrinker);
-}
-
-static __inline int
-kmem_shake_allow(unsigned int gfp_mask)
-{
-	return (gfp_mask & __GFP_WAIT);
-}
-
-#endif /* __XFS_SUPPORT_KMEM_H__ */
diff -Nru a/fs/xfs/linux/mrlock.h b/fs/xfs/linux/mrlock.h
--- a/fs/xfs/linux/mrlock.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_SUPPORT_MRLOCK_H__
-#define __XFS_SUPPORT_MRLOCK_H__
-
-#include <linux/rwsem.h>
-
-enum { MR_NONE, MR_ACCESS, MR_UPDATE };
-
-typedef struct {
-	struct rw_semaphore	mr_lock;
-	int			mr_writer;
-} mrlock_t;
-
-#define mrinit(mrp, name)	\
-	( (mrp)->mr_writer = 0, init_rwsem(&(mrp)->mr_lock) )
-#define mrlock_init(mrp, t,n,s)	mrinit(mrp, n)
-#define mrfree(mrp)		do { } while (0)
-#define mraccess(mrp)		mraccessf(mrp, 0)
-#define mrupdate(mrp)		mrupdatef(mrp, 0)
-
-static inline void mraccessf(mrlock_t *mrp, int flags)
-{
-	down_read(&mrp->mr_lock);
-}
-
-static inline void mrupdatef(mrlock_t *mrp, int flags)
-{
-	down_write(&mrp->mr_lock);
-	mrp->mr_writer = 1;
-}
-
-static inline int mrtryaccess(mrlock_t *mrp)
-{
-	return down_read_trylock(&mrp->mr_lock);
-}
-
-static inline int mrtryupdate(mrlock_t *mrp)
-{
-	if (!down_write_trylock(&mrp->mr_lock))
-		return 0;
-	mrp->mr_writer = 1;
-	return 1;
-}
-
-static inline void mrunlock(mrlock_t *mrp)
-{
-	if (mrp->mr_writer) {
-		mrp->mr_writer = 0;
-		up_write(&mrp->mr_lock);
-	} else {
-		up_read(&mrp->mr_lock);
-	}
-}
-
-static inline void mrdemote(mrlock_t *mrp)
-{
-	mrp->mr_writer = 0;
-	downgrade_write(&mrp->mr_lock);
-}
-
-#ifdef DEBUG
-/*
- * Debug-only routine, without some platform-specific asm code, we can
- * now only answer requests regarding whether we hold the lock for write
- * (reader state is outside our visibility, we only track writer state).
- * Note: means !ismrlocked would give false positivies, so don't do that.
- */
-static inline int ismrlocked(mrlock_t *mrp, int type)
-{
-	if (mrp && type == MR_UPDATE)
-		return mrp->mr_writer;
-	return 1;
-}
-#endif
-
-#endif /* __XFS_SUPPORT_MRLOCK_H__ */
diff -Nru a/fs/xfs/linux/mutex.h b/fs/xfs/linux/mutex.h
--- a/fs/xfs/linux/mutex.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_SUPPORT_MUTEX_H__
-#define __XFS_SUPPORT_MUTEX_H__
-
-#include <linux/spinlock.h>
-#include <asm/semaphore.h>
-
-/*
- * Map the mutex'es from IRIX to Linux semaphores.
- *
- * Destroy just simply initializes to -99 which should block all other
- * callers.
- */
-#define MUTEX_DEFAULT		0x0
-typedef struct semaphore	mutex_t;
-
-#define mutex_init(lock, type, name)		sema_init(lock, 1)
-#define mutex_destroy(lock)			sema_init(lock, -99)
-#define mutex_lock(lock, num)			down(lock)
-#define mutex_trylock(lock)			(down_trylock(lock) ? 0 : 1)
-#define mutex_unlock(lock)			up(lock)
-
-#endif /* __XFS_SUPPORT_MUTEX_H__ */
diff -Nru a/fs/xfs/linux/sema.h b/fs/xfs/linux/sema.h
--- a/fs/xfs/linux/sema.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_SUPPORT_SEMA_H__
-#define __XFS_SUPPORT_SEMA_H__
-
-#include <linux/time.h>
-#include <linux/wait.h>
-#include <asm/atomic.h>
-#include <asm/semaphore.h>
-
-/*
- * sema_t structure just maps to struct semaphore in Linux kernel.
- */
-
-typedef struct semaphore sema_t;
-
-#define init_sema(sp, val, c, d)	sema_init(sp, val)
-#define initsema(sp, val)		sema_init(sp, val)
-#define initnsema(sp, val, name)	sema_init(sp, val)
-#define psema(sp, b)			down(sp)
-#define vsema(sp)			up(sp)
-#define valusema(sp)			(atomic_read(&(sp)->count))
-#define freesema(sema)
-
-/*
- * Map cpsema (try to get the sema) to down_trylock. We need to switch
- * the return values since cpsema returns 1 (acquired) 0 (failed) and
- * down_trylock returns the reverse 0 (acquired) 1 (failed).
- */
-
-#define cpsema(sp)			(down_trylock(sp) ? 0 : 1)
-
-/*
- * Didn't do cvsema(sp). Not sure how to map this to up/down/...
- * It does a vsema if the values is < 0 other wise nothing.
- */
-
-#endif /* __XFS_SUPPORT_SEMA_H__ */
diff -Nru a/fs/xfs/linux/spin.h b/fs/xfs/linux/spin.h
--- a/fs/xfs/linux/spin.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_SUPPORT_SPIN_H__
-#define __XFS_SUPPORT_SPIN_H__
-
-#include <linux/sched.h>	/* preempt needs this */
-#include <linux/spinlock.h>
-
-/*
- * Map lock_t from IRIX to Linux spinlocks.
- *
- * Note that linux turns on/off spinlocks depending on CONFIG_SMP.
- * We don't need to worry about SMP or not here.
- */
-
-#define SPLDECL(s)		unsigned long s
-
-typedef spinlock_t lock_t;
-
-#define spinlock_init(lock, name)	spin_lock_init(lock)
-#define	spinlock_destroy(lock)
-
-static inline unsigned long mutex_spinlock(lock_t *lock)
-{
-	spin_lock(lock);
-	return 0;
-}
-
-/*ARGSUSED*/
-static inline void mutex_spinunlock(lock_t *lock, unsigned long s)
-{
-	spin_unlock(lock);
-}
-
-static inline void nested_spinlock(lock_t *lock)
-{
-	spin_lock(lock);
-}
-
-static inline void nested_spinunlock(lock_t *lock)
-{
-	spin_unlock(lock);
-}
-
-#endif /* __XFS_SUPPORT_SPIN_H__ */
diff -Nru a/fs/xfs/linux/sv.h b/fs/xfs/linux/sv.h
--- a/fs/xfs/linux/sv.h	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_SUPPORT_SV_H__
-#define __XFS_SUPPORT_SV_H__
-
-#include <linux/wait.h>
-#include <linux/sched.h>
-#include <linux/spinlock.h>
-
-/*
- * Synchronisation variables.
- *
- * (Parameters "pri", "svf" and "rts" are not implemented)
- */
-
-typedef struct sv_s {
-	wait_queue_head_t waiters;
-} sv_t;
-
-#define SV_FIFO		0x0		/* sv_t is FIFO type */
-#define SV_LIFO		0x2		/* sv_t is LIFO type */
-#define SV_PRIO		0x4		/* sv_t is PRIO type */
-#define SV_KEYED	0x6		/* sv_t is KEYED type */
-#define SV_DEFAULT      SV_FIFO
-
-
-static inline void _sv_wait(sv_t *sv, spinlock_t *lock, int state,
-			     unsigned long timeout)
-{
-	DECLARE_WAITQUEUE(wait, current);
-
-	add_wait_queue_exclusive(&sv->waiters, &wait);
-	__set_current_state(state);
-	spin_unlock(lock);
-
-	schedule_timeout(timeout);
-
-	remove_wait_queue(&sv->waiters, &wait);
-}
-
-#define init_sv(sv,type,name,flag) \
-	init_waitqueue_head(&(sv)->waiters)
-#define sv_init(sv,flag,name) \
-	init_waitqueue_head(&(sv)->waiters)
-#define sv_destroy(sv) \
-	/*NOTHING*/
-#define sv_wait(sv, pri, lock, s) \
-	_sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT)
-#define sv_wait_sig(sv, pri, lock, s)   \
-	_sv_wait(sv, lock, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT)
-#define sv_timedwait(sv, pri, lock, s, svf, ts, rts) \
-	_sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, timespec_to_jiffies(ts))
-#define sv_timedwait_sig(sv, pri, lock, s, svf, ts, rts) \
-	_sv_wait(sv, lock, TASK_INTERRUPTIBLE, timespec_to_jiffies(ts))
-#define sv_signal(sv) \
-	wake_up(&(sv)->waiters)
-#define sv_broadcast(sv) \
-	wake_up_all(&(sv)->waiters)
-
-#endif /* __XFS_SUPPORT_SV_H__ */
diff -Nru a/fs/xfs/linux/time.h b/fs/xfs/linux/time.h
--- a/fs/xfs/linux/time.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_SUPPORT_TIME_H__
-#define __XFS_SUPPORT_TIME_H__
-
-#include <linux/sched.h>
-#include <linux/time.h>
-
-typedef struct timespec timespec_t;
-
-static inline void delay(long ticks)
-{
-	current->state = TASK_UNINTERRUPTIBLE;
-	schedule_timeout(ticks);
-}
-
-static inline void nanotime(struct timespec *tvp)
-{
-	*tvp = CURRENT_TIME;
-}
-
-#endif /* __XFS_SUPPORT_TIME_H__ */
diff -Nru a/fs/xfs/linux/xfs_aops.c b/fs/xfs/linux/xfs_aops.c
--- a/fs/xfs/linux/xfs_aops.c	Tue Jun 15 22:20:58 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1276 +0,0 @@
-/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.	 Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-#include "xfs_inum.h"
-#include "xfs_log.h"
-#include "xfs_sb.h"
-#include "xfs_dir.h"
-#include "xfs_dir2.h"
-#include "xfs_trans.h"
-#include "xfs_dmapi.h"
-#include "xfs_mount.h"
-#include "xfs_bmap_btree.h"
-#include "xfs_alloc_btree.h"
-#include "xfs_ialloc_btree.h"
-#include "xfs_alloc.h"
-#include "xfs_btree.h"
-#include "xfs_attr_sf.h"
-#include "xfs_dir_sf.h"
-#include "xfs_dir2_sf.h"
-#include "xfs_dinode.h"
-#include "xfs_inode.h"
-#include "xfs_error.h"
-#include "xfs_rw.h"
-#include "xfs_iomap.h"
-#include <linux/mpage.h>
-
-STATIC void xfs_count_page_state(struct page *, int *, int *, int *);
-STATIC void xfs_convert_page(struct inode *, struct page *,
-				xfs_iomap_t *, void *, int, int);
-
-#if defined(XFS_RW_TRACE)
-void
-xfs_page_trace(
-	int		tag,
-	struct inode	*inode,
-	struct page	*page,
-	int		mask)
-{
-	xfs_inode_t	*ip;
-	bhv_desc_t	*bdp;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	loff_t		isize = i_size_read(inode);
-	loff_t		offset = page->index << PAGE_CACHE_SHIFT;
-	int		delalloc = -1, unmapped = -1, unwritten = -1;
-
-	if (page_has_buffers(page))
-		xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
-
-	bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops);
-	ip = XFS_BHVTOI(bdp);
-	if (!ip->i_rwtrace)
-		return;
-
-	ktrace_enter(ip->i_rwtrace,
-		(void *)((unsigned long)tag),
-		(void *)ip,
-		(void *)inode,
-		(void *)page,
-		(void *)((unsigned long)mask),
-		(void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
-		(void *)((unsigned long)((isize >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(isize & 0xffffffff)),
-		(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(offset & 0xffffffff)),
-		(void *)((unsigned long)delalloc),
-		(void *)((unsigned long)unmapped),
-		(void *)((unsigned long)unwritten),
-		(void *)NULL,
-		(void *)NULL);
-}
-#else
-#define xfs_page_trace(tag, inode, page, mask)
-#endif
-
-void
-linvfs_unwritten_done(
-	struct buffer_head	*bh,
-	int			uptodate)
-{
-	xfs_buf_t		*pb = (xfs_buf_t *)bh->b_private;
-
-	ASSERT(buffer_unwritten(bh));
-	bh->b_end_io = NULL;
-	clear_buffer_unwritten(bh);
-	if (!uptodate)
-		pagebuf_ioerror(pb, EIO);
-	if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
-		pagebuf_iodone(pb, 1, 1);
-	}
-	end_buffer_async_write(bh, uptodate);
-}
-
-/*
- * Issue transactions to convert a buffer range from unwritten
- * to written extents (buffered IO).
- */
-STATIC void
-linvfs_unwritten_convert(
-	xfs_buf_t	*bp)
-{
-	vnode_t		*vp = XFS_BUF_FSPRIVATE(bp, vnode_t *);
-	int		error;
-
-	BUG_ON(atomic_read(&bp->pb_hold) < 1);
-	VOP_BMAP(vp, XFS_BUF_OFFSET(bp), XFS_BUF_SIZE(bp),
-			BMAPI_UNWRITTEN, NULL, NULL, error);
-	XFS_BUF_SET_FSPRIVATE(bp, NULL);
-	XFS_BUF_CLR_IODONE_FUNC(bp);
-	XFS_BUF_UNDATAIO(bp);
-	iput(LINVFS_GET_IP(vp));
-	pagebuf_iodone(bp, 0, 0);
-}
-
-/*
- * Issue transactions to convert a buffer range from unwritten
- * to written extents (direct IO).
- */
-STATIC void
-linvfs_unwritten_convert_direct(
-	struct inode	*inode,
-	loff_t		offset,
-	ssize_t		size,
-	void		*private)
-{
-	ASSERT(!private || inode == (struct inode *)private);
-
-	/* private indicates an unwritten extent lay beneath this IO,
-	 * see linvfs_get_block_core.
-	 */
-	if (private && size > 0) {
-		vnode_t	*vp = LINVFS_GET_VP(inode);
-		int	error;
-
-		VOP_BMAP(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL, error);
-	}
-}
-
-STATIC int
-xfs_map_blocks(
-	struct inode		*inode,
-	loff_t			offset,
-	ssize_t			count,
-	xfs_iomap_t		*iomapp,
-	int			flags)
-{
-	vnode_t			*vp = LINVFS_GET_VP(inode);
-	int			error, niomaps = 1;
-
-	if (((flags & (BMAPI_DIRECT|BMAPI_SYNC)) == BMAPI_DIRECT) &&
-	    (offset >= i_size_read(inode)))
-		count = max_t(ssize_t, count, XFS_WRITE_IO_LOG);
-retry:
-	VOP_BMAP(vp, offset, count, flags, iomapp, &niomaps, error);
-	if ((error == EAGAIN) || (error == EIO))
-		return -error;
-	if (unlikely((flags & (BMAPI_WRITE|BMAPI_DIRECT)) ==
-					(BMAPI_WRITE|BMAPI_DIRECT) && niomaps &&
-					(iomapp->iomap_flags & IOMAP_DELAY))) {
-		flags = BMAPI_ALLOCATE;
-		goto retry;
-	}
-	if (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)) {
-		VMODIFY(vp);
-	}
-	return -error;
-}
-
-/*
- * Finds the corresponding mapping in block @map array of the
- * given @offset within a @page.
- */
-STATIC xfs_iomap_t *
-xfs_offset_to_map(
-	struct page		*page,
-	xfs_iomap_t		*iomapp,
-	unsigned long		offset)
-{
-	loff_t			full_offset;	/* offset from start of file */
-
-	ASSERT(offset < PAGE_CACHE_SIZE);
-
-	full_offset = page->index;		/* NB: using 64bit number */
-	full_offset <<= PAGE_CACHE_SHIFT;	/* offset from file start */
-	full_offset += offset;			/* offset from page start */
-
-	if (full_offset < iomapp->iomap_offset)
-		return NULL;
-	if (iomapp->iomap_offset + iomapp->iomap_bsize > full_offset)
-		return iomapp;
-	return NULL;
-}
-
-STATIC void
-xfs_map_at_offset(
-	struct page		*page,
-	struct buffer_head	*bh,
-	unsigned long		offset,
-	int			block_bits,
-	xfs_iomap_t		*iomapp)
-{
-	xfs_daddr_t		bn;
-	loff_t			delta;
-	int			sector_shift;
-
-	ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE));
-	ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY));
-	ASSERT(iomapp->iomap_bn != IOMAP_DADDR_NULL);
-
-	delta = page->index;
-	delta <<= PAGE_CACHE_SHIFT;
-	delta += offset;
-	delta -= iomapp->iomap_offset;
-	delta >>= block_bits;
-
-	sector_shift = block_bits - BBSHIFT;
-	bn = iomapp->iomap_bn >> sector_shift;
-	bn += delta;
-	ASSERT((bn << sector_shift) >= iomapp->iomap_bn);
-
-	lock_buffer(bh);
-	bh->b_blocknr = bn;
-	bh->b_bdev = iomapp->iomap_target->pbr_bdev;
-	set_buffer_mapped(bh);
-	clear_buffer_delay(bh);
-}
-
-/*
- * Look for a page at index which is unlocked and contains our
- * unwritten extent flagged buffers at its head.  Returns page
- * locked and with an extra reference count, and length of the
- * unwritten extent component on this page that we can write,
- * in units of filesystem blocks.
- */
-STATIC struct page *
-xfs_probe_unwritten_page(
-	struct address_space	*mapping,
-	pgoff_t			index,
-	xfs_iomap_t		*iomapp,
-	xfs_buf_t		*pb,
-	unsigned long		max_offset,
-	unsigned long		*fsbs,
-	unsigned int            bbits)
-{
-	struct page		*page;
-
-	page = find_trylock_page(mapping, index);
-	if (!page)
-		return 0;
-	if (PageWriteback(page))
-		goto out;
-
-	if (page->mapping && page_has_buffers(page)) {
-		struct buffer_head	*bh, *head;
-		unsigned long		p_offset = 0;
-
-		*fsbs = 0;
-		bh = head = page_buffers(page);
-		do {
-			if (!buffer_unwritten(bh))
-				break;
-			if (!xfs_offset_to_map(page, iomapp, p_offset))
-				break;
-			if (p_offset >= max_offset)
-				break;
-			xfs_map_at_offset(page, bh, p_offset, bbits, iomapp);
-			set_buffer_unwritten_io(bh);
-			bh->b_private = pb;
-			p_offset += bh->b_size;
-			(*fsbs)++;
-		} while ((bh = bh->b_this_page) != head);
-
-		if (p_offset)
-			return page;
-	}
-
-out:
-	unlock_page(page);
-	return NULL;
-}
-
-/*
- * Look for a page at index which is unlocked and not mapped
- * yet - clustering for mmap write case.
- */
-STATIC unsigned int
-xfs_probe_unmapped_page(
-	struct address_space	*mapping,
-	pgoff_t			index,
-	unsigned int		pg_offset)
-{
-	struct page		*page;
-	int			ret = 0;
-
-	page = find_trylock_page(mapping, index);
-	if (!page)
-		return 0;
-	if (PageWriteback(page))
-		goto out;
-
-	if (page->mapping && PageDirty(page)) {
-		if (page_has_buffers(page)) {
-			struct buffer_head	*bh, *head;
-
-			bh = head = page_buffers(page);
-			do {
-				if (buffer_mapped(bh) || !buffer_uptodate(bh))
-					break;
-				ret += bh->b_size;
-				if (ret >= pg_offset)
-					break;
-			} while ((bh = bh->b_this_page) != head);
-		} else
-			ret = PAGE_CACHE_SIZE;
-	}
-
-out:
-	unlock_page(page);
-	return ret;
-}
-
-STATIC unsigned int
-xfs_probe_unmapped_cluster(
-	struct inode		*inode,
-	struct page		*startpage,
-	struct buffer_head	*bh,
-	struct buffer_head	*head)
-{
-	pgoff_t			tindex, tlast, tloff;
-	unsigned int		pg_offset, len, total = 0;
-	struct address_space	*mapping = inode->i_mapping;
-
-	/* First sum forwards in this page */
-	do {
-		if (buffer_mapped(bh))
-			break;
-		total += bh->b_size;
-	} while ((bh = bh->b_this_page) != head);
-
-	/* If we reached the end of the page, sum forwards in
-	 * following pages.
-	 */
-	if (bh == head) {
-		tlast = i_size_read(inode) >> PAGE_CACHE_SHIFT;
-		/* Prune this back to avoid pathological behavior */
-		tloff = min(tlast, startpage->index + 64);
-		for (tindex = startpage->index + 1; tindex < tloff; tindex++) {
-			len = xfs_probe_unmapped_page(mapping, tindex,
-							PAGE_CACHE_SIZE);
-			if (!len)
-				return total;
-			total += len;
-		}
-		if (tindex == tlast &&
-		    (pg_offset = i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
-			total += xfs_probe_unmapped_page(mapping,
-							tindex, pg_offset);
-		}
-	}
-	return total;
-}
-
-/*
- * Probe for a given page (index) in the inode and test if it is delayed
- * and without unwritten buffers.  Returns page locked and with an extra
- * reference count.
- */
-STATIC struct page *
-xfs_probe_delalloc_page(
-	struct inode		*inode,
-	pgoff_t			index)
-{
-	struct page		*page;
-
-	page = find_trylock_page(inode->i_mapping, index);
-	if (!page)
-		return NULL;
-	if (PageWriteback(page))
-		goto out;
-
-	if (page->mapping && page_has_buffers(page)) {
-		struct buffer_head	*bh, *head;
-		int			acceptable = 0;
-
-		bh = head = page_buffers(page);
-		do {
-			if (buffer_unwritten(bh)) {
-				acceptable = 0;
-				break;
-			} else if (buffer_delay(bh)) {
-				acceptable = 1;
-			}
-		} while ((bh = bh->b_this_page) != head);
-
-		if (acceptable)
-			return page;
-	}
-
-out:
-	unlock_page(page);
-	return NULL;
-}
-
-STATIC int
-xfs_map_unwritten(
-	struct inode		*inode,
-	struct page		*start_page,
-	struct buffer_head	*head,
-	struct buffer_head	*curr,
-	unsigned long		p_offset,
-	int			block_bits,
-	xfs_iomap_t		*iomapp,
-	int			startio,
-	int			all_bh)
-{
-	struct buffer_head	*bh = curr;
-	xfs_iomap_t		*tmp;
-	xfs_buf_t		*pb;
-	loff_t			offset, size;
-	unsigned long		nblocks = 0;
-
-	offset = start_page->index;
-	offset <<= PAGE_CACHE_SHIFT;
-	offset += p_offset;
-
-	/* get an "empty" pagebuf to manage IO completion
-	 * Proper values will be set before returning */
-	pb = pagebuf_lookup(iomapp->iomap_target, 0, 0, 0);
-	if (!pb)
-		return -EAGAIN;
-
-	/* Take a reference to the inode to prevent it from
-	 * being reclaimed while we have outstanding unwritten
-	 * extent IO on it.
-	 */
-	if ((igrab(inode)) != inode) {
-		pagebuf_free(pb);
-		return -EAGAIN;
-	}
-
-	/* Set the count to 1 initially, this will stop an I/O
-	 * completion callout which happens before we have started
-	 * all the I/O from calling pagebuf_iodone too early.
-	 */
-	atomic_set(&pb->pb_io_remaining, 1);
-
-	/* First map forwards in the page consecutive buffers
-	 * covering this unwritten extent
-	 */
-	do {
-		if (!buffer_unwritten(bh))
-			break;
-		tmp = xfs_offset_to_map(start_page, iomapp, p_offset);
-		if (!tmp)
-			break;
-		xfs_map_at_offset(start_page, bh, p_offset, block_bits, iomapp);
-		set_buffer_unwritten_io(bh);
-		bh->b_private = pb;
-		p_offset += bh->b_size;
-		nblocks++;
-	} while ((bh = bh->b_this_page) != head);
-
-	atomic_add(nblocks, &pb->pb_io_remaining);
-
-	/* If we reached the end of the page, map forwards in any
-	 * following pages which are also covered by this extent.
-	 */
-	if (bh == head) {
-		struct address_space	*mapping = inode->i_mapping;
-		pgoff_t			tindex, tloff, tlast;
-		unsigned long		bs;
-		unsigned int		pg_offset, bbits = inode->i_blkbits;
-		struct page		*page;
-
-		tlast = i_size_read(inode) >> PAGE_CACHE_SHIFT;
-		tloff = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
-		tloff = min(tlast, tloff);
-		for (tindex = start_page->index + 1; tindex < tloff; tindex++) {
-			page = xfs_probe_unwritten_page(mapping,
-						tindex, iomapp, pb,
-						PAGE_CACHE_SIZE, &bs, bbits);
-			if (!page)
-				break;
-			nblocks += bs;
-			atomic_add(bs, &pb->pb_io_remaining);
-			xfs_convert_page(inode, page, iomapp, pb,
-							startio, all_bh);
-			/* stop if converting the next page might add
-			 * enough blocks that the corresponding byte
-			 * count won't fit in our ulong page buf length */
-			if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
-				goto enough;
-		}
-
-		if (tindex == tlast &&
-		    (pg_offset = (i_size_read(inode) & (PAGE_CACHE_SIZE - 1)))) {
-			page = xfs_probe_unwritten_page(mapping,
-							tindex, iomapp, pb,
-							pg_offset, &bs, bbits);
-			if (page) {
-				nblocks += bs;
-				atomic_add(bs, &pb->pb_io_remaining);
-				xfs_convert_page(inode, page, iomapp, pb,
-							startio, all_bh);
-				if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
-					goto enough;
-			}
-		}
-	}
-
-enough:
-	size = nblocks;		/* NB: using 64bit number here */
-	size <<= block_bits;	/* convert fsb's to byte range */
-
-	XFS_BUF_DATAIO(pb);
-	XFS_BUF_ASYNC(pb);
-	XFS_BUF_SET_SIZE(pb, size);
-	XFS_BUF_SET_COUNT(pb, size);
-	XFS_BUF_SET_OFFSET(pb, offset);
-	XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode));
-	XFS_BUF_SET_IODONE_FUNC(pb, linvfs_unwritten_convert);
-
-	if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
-		pagebuf_iodone(pb, 1, 1);
-	}
-
-	return 0;
-}
-
-STATIC void
-xfs_submit_page(
-	struct page		*page,
-	struct buffer_head	*bh_arr[],
-	int			cnt)
-{
-	struct buffer_head	*bh;
-	int			i;
-
-	BUG_ON(PageWriteback(page));
-	set_page_writeback(page);
-	clear_page_dirty(page);
-	unlock_page(page);
-
-	if (cnt) {
-		for (i = 0; i < cnt; i++) {
-			bh = bh_arr[i];
-			mark_buffer_async_write(bh);
-			if (buffer_unwritten(bh))
-				set_buffer_unwritten_io(bh);
-			set_buffer_uptodate(bh);
-			clear_buffer_dirty(bh);
-		}
-
-		for (i = 0; i < cnt; i++)
-			submit_bh(WRITE, bh_arr[i]);
-	} else
-		end_page_writeback(page);
-}
-
-/*
- * Allocate & map buffers for page given the extent map. Write it out.
- * except for the original page of a writepage, this is called on
- * delalloc/unwritten pages only, for the original page it is possible
- * that the page has no mapping at all.
- */
-STATIC void
-xfs_convert_page(
-	struct inode		*inode,
-	struct page		*page,
-	xfs_iomap_t		*iomapp,
-	void			*private,
-	int			startio,
-	int			all_bh)
-{
-	struct buffer_head	*bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
-	xfs_iomap_t		*mp = iomapp, *tmp;
-	unsigned long		end, offset;
-	pgoff_t			end_index;
-	int			i = 0, index = 0;
-	int			bbits = inode->i_blkbits;
-
-	end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT;
-	if (page->index < end_index) {
-		end = PAGE_CACHE_SIZE;
-	} else {
-		end = i_size_read(inode) & (PAGE_CACHE_SIZE-1);
-	}
-	bh = head = page_buffers(page);
-	do {
-		offset = i << bbits;
-		if (!(PageUptodate(page) || buffer_uptodate(bh)))
-			continue;
-		if (buffer_mapped(bh) && all_bh &&
-		    !buffer_unwritten(bh) && !buffer_delay(bh)) {
-			if (startio && (offset < end)) {
-				lock_buffer(bh);
-				bh_arr[index++] = bh;
-			}
-			continue;
-		}
-		tmp = xfs_offset_to_map(page, mp, offset);
-		if (!tmp)
-			continue;
-		ASSERT(!(tmp->iomap_flags & IOMAP_HOLE));
-		ASSERT(!(tmp->iomap_flags & IOMAP_DELAY));
-
-		/* If this is a new unwritten extent buffer (i.e. one
-		 * that we haven't passed in private data for, we must
-		 * now map this buffer too.
-		 */
-		if (buffer_unwritten(bh) && !bh->b_end_io) {
-			ASSERT(tmp->iomap_flags & IOMAP_UNWRITTEN);
-			xfs_map_unwritten(inode, page, head, bh,
-					offset, bbits, tmp, startio, all_bh);
-		} else if (! (buffer_unwritten(bh) && buffer_locked(bh))) {
-			xfs_map_at_offset(page, bh, offset, bbits, tmp);
-			if (buffer_unwritten(bh)) {
-				set_buffer_unwritten_io(bh);
-				bh->b_private = private;
-				ASSERT(private);
-			}
-		}
-		if (startio && (offset < end)) {
-			bh_arr[index++] = bh;
-		} else {
-			set_buffer_dirty(bh);
-			unlock_buffer(bh);
-			mark_buffer_dirty(bh);
-		}
-	} while (i++, (bh = bh->b_this_page) != head);
-
-	if (startio) {
-		xfs_submit_page(page, bh_arr, index);
-	} else {
-		unlock_page(page);
-	}
-}
-
-/*
- * Convert & write out a cluster of pages in the same extent as defined
- * by mp and following the start page.
- */
-STATIC void
-xfs_cluster_write(
-	struct inode		*inode,
-	pgoff_t			tindex,
-	xfs_iomap_t		*iomapp,
-	int			startio,
-	int			all_bh)
-{
-	pgoff_t			tlast;
-	struct page		*page;
-
-	tlast = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
-	for (; tindex < tlast; tindex++) {
-		page = xfs_probe_delalloc_page(inode, tindex);
-		if (!page)
-			break;
-		xfs_convert_page(inode, page, iomapp, NULL, startio, all_bh);
-	}
-}
-
-/*
- * Calling this without startio set means we are being asked to make a dirty
- * page ready for freeing it's buffers.  When called with startio set then
- * we are coming from writepage.
- *
- * When called with startio set it is important that we write the WHOLE
- * page if possible.
- * The bh->b_state's cannot know if any of the blocks or which block for
- * that matter are dirty due to mmap writes, and therefore bh uptodate is
- * only vaild if the page itself isn't completely uptodate.  Some layers
- * may clear the page dirty flag prior to calling write page, under the
- * assumption the entire page will be written out; by not writing out the
- * whole page the page can be reused before all valid dirty data is
- * written out.  Note: in the case of a page that has been dirty'd by
- * mapwrite and but partially setup by block_prepare_write the
- * bh->b_states's will not agree and only ones setup by BPW/BCW will have
- * valid state, thus the whole page must be written out thing.
- */
-
-STATIC int
-xfs_page_state_convert(
-	struct inode	*inode,
-	struct page	*page,
-	int		startio,
-	int		unmapped) /* also implies page uptodate */
-{
-	struct buffer_head	*bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
-	xfs_iomap_t		*iomp, iomap;
-	unsigned long		p_offset = 0;
-	pgoff_t			end_index;
-	loff_t			offset;
-	unsigned long long	end_offset;
-	int			len, err, i, cnt = 0, uptodate = 1;
-	int			flags = startio ? 0 : BMAPI_TRYLOCK;
-	int			page_dirty = 1;
-
-
-	/* Are we off the end of the file ? */
-	end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT;
-	if (page->index >= end_index) {
-		if ((page->index >= end_index + 1) ||
-		    !(i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
-			err = -EIO;
-			goto error;
-		}
-	}
-
-	offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
-	end_offset = min_t(unsigned long long,
-			offset + PAGE_CACHE_SIZE, i_size_read(inode));
-
-	bh = head = page_buffers(page);
-	iomp = NULL;
-
-	len = bh->b_size;
-	do {
-		if (offset >= end_offset)
-			break;
-		if (!buffer_uptodate(bh))
-			uptodate = 0;
-		if (!(PageUptodate(page) || buffer_uptodate(bh)) && !startio)
-			continue;
-
-		if (iomp) {
-			iomp = xfs_offset_to_map(page, &iomap, p_offset);
-		}
-
-		/*
-		 * First case, map an unwritten extent and prepare for
-		 * extent state conversion transaction on completion.
-		 */
-		if (buffer_unwritten(bh)) {
-			if (!iomp) {
-				err = xfs_map_blocks(inode, offset, len, &iomap,
-						BMAPI_READ|BMAPI_IGNSTATE);
-				if (err) {
-					goto error;
-				}
-				iomp = xfs_offset_to_map(page, &iomap,
-								p_offset);
-			}
-			if (iomp && startio) {
-				if (!bh->b_end_io) {
-					err = xfs_map_unwritten(inode, page,
-							head, bh, p_offset,
-							inode->i_blkbits, iomp,
-							startio, unmapped);
-					if (err) {
-						goto error;
-					}
-				}
-				bh_arr[cnt++] = bh;
-				page_dirty = 0;
-			}
-		/*
-		 * Second case, allocate space for a delalloc buffer.
-		 * We can return EAGAIN here in the release page case.
-		 */
-		} else if (buffer_delay(bh)) {
-			if (!iomp) {
-				err = xfs_map_blocks(inode, offset, len, &iomap,
-						BMAPI_ALLOCATE | flags);
-				if (err) {
-					goto error;
-				}
-				iomp = xfs_offset_to_map(page, &iomap,
-								p_offset);
-			}
-			if (iomp) {
-				xfs_map_at_offset(page, bh, p_offset,
-						inode->i_blkbits, iomp);
-				if (startio) {
-					bh_arr[cnt++] = bh;
-				} else {
-					set_buffer_dirty(bh);
-					unlock_buffer(bh);
-					mark_buffer_dirty(bh);
-				}
-				page_dirty = 0;
-			}
-		} else if ((buffer_uptodate(bh) || PageUptodate(page)) &&
-			   (unmapped || startio)) {
-
-			if (!buffer_mapped(bh)) {
-				int	size;
-
-				/*
-				 * Getting here implies an unmapped buffer
-				 * was found, and we are in a path where we
-				 * need to write the whole page out.
-				 */
-				if (!iomp) {
-					size = xfs_probe_unmapped_cluster(
-							inode, page, bh, head);
-					err = xfs_map_blocks(inode, offset,
-							size, &iomap,
-							BMAPI_WRITE|BMAPI_MMAP);
-					if (err) {
-						goto error;
-					}
-					iomp = xfs_offset_to_map(page, &iomap,
-								     p_offset);
-				}
-				if (iomp) {
-					xfs_map_at_offset(page,
-							bh, p_offset,
-							inode->i_blkbits, iomp);
-					if (startio) {
-						bh_arr[cnt++] = bh;
-					} else {
-						set_buffer_dirty(bh);
-						unlock_buffer(bh);
-						mark_buffer_dirty(bh);
-					}
-					page_dirty = 0;
-				}
-			} else if (startio) {
-				if (buffer_uptodate(bh) &&
-				    !test_and_set_bit(BH_Lock, &bh->b_state)) {
-					bh_arr[cnt++] = bh;
-					page_dirty = 0;
-				}
-			}
-		}
-	} while (offset += len, p_offset += len,
-		((bh = bh->b_this_page) != head));
-
-	if (uptodate && bh == head)
-		SetPageUptodate(page);
-
-	if (startio)
-		xfs_submit_page(page, bh_arr, cnt);
-
-	if (iomp)
-		xfs_cluster_write(inode, page->index + 1, iomp, startio, unmapped);
-
-	return page_dirty;
-
-error:
-	for (i = 0; i < cnt; i++) {
-		unlock_buffer(bh_arr[i]);
-	}
-
-	/*
-	 * If it's delalloc and we have nowhere to put it,
-	 * throw it away, unless the lower layers told
-	 * us to try again.
-	 */
-	if (err != -EAGAIN) {
-		if (!unmapped) {
-			block_invalidatepage(page, 0);
-		}
-		ClearPageUptodate(page);
-	}
-	return err;
-}
-
-STATIC int
-linvfs_get_block_core(
-	struct inode		*inode,
-	sector_t		iblock,
-	unsigned long		blocks,
-	struct buffer_head	*bh_result,
-	int			create,
-	int			direct,
-	bmapi_flags_t		flags)
-{
-	vnode_t			*vp = LINVFS_GET_VP(inode);
-	xfs_iomap_t		iomap;
-	int			retpbbm = 1;
-	int			error;
-	ssize_t			size;
-	loff_t			offset = (loff_t)iblock << inode->i_blkbits;
-
-	/* If we are doing writes at the end of the file,
-	 * allocate in chunks
-	 */
-	if (blocks)
-		size = blocks << inode->i_blkbits;
-	else if (create && (offset >= i_size_read(inode)))
-		size = 1 << XFS_WRITE_IO_LOG;
-	else
-		size = 1 << inode->i_blkbits;
-
-	VOP_BMAP(vp, offset, size,
-		create ? flags : BMAPI_READ, &iomap, &retpbbm, error);
-	if (error)
-		return -error;
-
-	if (retpbbm == 0)
-		return 0;
-
-	if (iomap.iomap_bn != IOMAP_DADDR_NULL) {
-		xfs_daddr_t		bn;
-		loff_t			delta;
-
-		/* For unwritten extents do not report a disk address on
-		 * the read case (treat as if we're reading into a hole).
-		 */
-		if (create || !(iomap.iomap_flags & IOMAP_UNWRITTEN)) {
-			delta = offset - iomap.iomap_offset;
-			delta >>= inode->i_blkbits;
-
-			bn = iomap.iomap_bn >> (inode->i_blkbits - BBSHIFT);
-			bn += delta;
-
-			bh_result->b_blocknr = bn;
-			bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
-			set_buffer_mapped(bh_result);
-		}
-		if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) {
-			if (direct)
-				bh_result->b_private = inode;
-			set_buffer_unwritten(bh_result);
-			set_buffer_delay(bh_result);
-		}
-	}
-
-	/* If this is a realtime file, data might be on a new device */
-	bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
-
-	/* If we previously allocated a block out beyond eof and
-	 * we are now coming back to use it then we will need to
-	 * flag it as new even if it has a disk address.
-	 */
-	if (create &&
-	    ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) ||
-	     (offset >= i_size_read(inode)) || (iomap.iomap_flags & IOMAP_NEW))) {
-		set_buffer_new(bh_result);
-	}
-
-	if (iomap.iomap_flags & IOMAP_DELAY) {
-		if (unlikely(direct))
-			BUG();
-		if (create) {
-			set_buffer_mapped(bh_result);
-			set_buffer_uptodate(bh_result);
-		}
-		bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
-		set_buffer_delay(bh_result);
-	}
-
-	if (blocks) {
-		loff_t iosize;
-		iosize = (iomap.iomap_bsize - iomap.iomap_delta);
-		bh_result->b_size =
-		    (ssize_t)min(iosize, (loff_t)(blocks << inode->i_blkbits));
-	}
-
-	return 0;
-}
-
-int
-linvfs_get_block(
-	struct inode		*inode,
-	sector_t		iblock,
-	struct buffer_head	*bh_result,
-	int			create)
-{
-	return linvfs_get_block_core(inode, iblock, 0, bh_result,
-					create, 0, BMAPI_WRITE);
-}
-
-STATIC int
-linvfs_get_block_sync(
-	struct inode		*inode,
-	sector_t		iblock,
-	struct buffer_head	*bh_result,
-	int			create)
-{
-	return linvfs_get_block_core(inode, iblock, 0, bh_result,
-					create, 0, BMAPI_SYNC|BMAPI_WRITE);
-}
-
-STATIC int
-linvfs_get_blocks_direct(
-	struct inode		*inode,
-	sector_t		iblock,
-	unsigned long		max_blocks,
-	struct buffer_head	*bh_result,
-	int			create)
-{
-	return linvfs_get_block_core(inode, iblock, max_blocks, bh_result,
-					create, 1, BMAPI_WRITE|BMAPI_DIRECT);
-}
-
-STATIC ssize_t
-linvfs_direct_IO(
-	int			rw,
-	struct kiocb		*iocb,
-	const struct iovec	*iov,
-	loff_t			offset,
-	unsigned long		nr_segs)
-{
-	struct file	*file = iocb->ki_filp;
-	struct inode	*inode = file->f_mapping->host;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	xfs_iomap_t	iomap;
-	int		maps = 1;
-	int		error;
-
-	VOP_BMAP(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps, error);
-	if (error)
-		return -error;
-
-	return blockdev_direct_IO_no_locking(rw, iocb, inode,
-		iomap.iomap_target->pbr_bdev,
-		iov, offset, nr_segs,
-		linvfs_get_blocks_direct,
-		linvfs_unwritten_convert_direct);
-}
-
-
-STATIC sector_t
-linvfs_bmap(
-	struct address_space	*mapping,
-	sector_t		block)
-{
-	struct inode		*inode = (struct inode *)mapping->host;
-	vnode_t			*vp = LINVFS_GET_VP(inode);
-	int			error;
-
-	vn_trace_entry(vp, "linvfs_bmap", (inst_t *)__return_address);
-
-	VOP_RWLOCK(vp, VRWLOCK_READ);
-	VOP_FLUSH_PAGES(vp, (xfs_off_t)0, -1, 0, FI_REMAPF, error);
-	VOP_RWUNLOCK(vp, VRWLOCK_READ);
-	return generic_block_bmap(mapping, block, linvfs_get_block);
-}
-
-STATIC int
-linvfs_readpage(
-	struct file		*unused,
-	struct page		*page)
-{
-	return mpage_readpage(page, linvfs_get_block);
-}
-
-STATIC int
-linvfs_readpages(
-	struct file		*unused,
-	struct address_space	*mapping,
-	struct list_head	*pages,
-	unsigned		nr_pages)
-{
-	return mpage_readpages(mapping, pages, nr_pages, linvfs_get_block);
-}
-
-STATIC void
-xfs_count_page_state(
-	struct page		*page,
-	int			*delalloc,
-	int			*unmapped,
-	int			*unwritten)
-{
-	struct buffer_head	*bh, *head;
-
-	*delalloc = *unmapped = *unwritten = 0;
-
-	bh = head = page_buffers(page);
-	do {
-		if (buffer_uptodate(bh) && !buffer_mapped(bh))
-			(*unmapped) = 1;
-		else if (buffer_unwritten(bh) && !buffer_delay(bh))
-			clear_buffer_unwritten(bh);
-		else if (buffer_unwritten(bh))
-			(*unwritten) = 1;
-		else if (buffer_delay(bh))
-			(*delalloc) = 1;
-	} while ((bh = bh->b_this_page) != head);
-}
-
-
-/*
- * writepage: Called from one of two places:
- *
- * 1. we are flushing a delalloc buffer head.
- *
- * 2. we are writing out a dirty page. Typically the page dirty
- *    state is cleared before we get here. In this case is it
- *    conceivable we have no buffer heads.
- *
- * For delalloc space on the page we need to allocate space and
- * flush it. For unmapped buffer heads on the page we should
- * allocate space if the page is uptodate. For any other dirty
- * buffer heads on the page we should flush them.
- *
- * If we detect that a transaction would be required to flush
- * the page, we have to check the process flags first, if we
- * are already in a transaction or disk I/O during allocations
- * is off, we need to fail the writepage and redirty the page.
- */
-
-STATIC int
-linvfs_writepage(
-	struct page		*page,
-	struct writeback_control *wbc)
-{
-	int			error;
-	int			need_trans;
-	int			delalloc, unmapped, unwritten;
-	struct inode		*inode = page->mapping->host;
-
-	xfs_page_trace(XFS_WRITEPAGE_ENTER, inode, page, 0);
-
-	/*
-	 * We need a transaction if:
-	 *  1. There are delalloc buffers on the page
-	 *  2. The page is uptodate and we have unmapped buffers
-	 *  3. The page is uptodate and we have no buffers
-	 *  4. There are unwritten buffers on the page
-	 */
-
-	if (!page_has_buffers(page)) {
-		unmapped = 1;
-		need_trans = 1;
-	} else {
-		xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
-		if (!PageUptodate(page))
-			unmapped = 0;
-		need_trans = delalloc + unmapped + unwritten;
-	}
-
-	/*
-	 * If we need a transaction and the process flags say
-	 * we are already in a transaction, or no IO is allowed
-	 * then mark the page dirty again and leave the page
-	 * as is.
-	 */
-	if (PFLAGS_TEST_FSTRANS() && need_trans)
-		goto out_fail;
-
-	/*
-	 * Delay hooking up buffer heads until we have
-	 * made our go/no-go decision.
-	 */
-	if (!page_has_buffers(page))
-		create_empty_buffers(page, 1 << inode->i_blkbits, 0);
-
-	/*
-	 * Convert delayed allocate, unwritten or unmapped space
-	 * to real space and flush out to disk.
-	 */
-	error = xfs_page_state_convert(inode, page, 1, unmapped);
-	if (error == -EAGAIN)
-		goto out_fail;
-	if (unlikely(error < 0))
-		goto out_unlock;
-
-	return 0;
-
-out_fail:
-	set_page_dirty(page);
-	unlock_page(page);
-	return 0;
-out_unlock:
-	unlock_page(page);
-	return error;
-}
-
-/*
- * Called to move a page into cleanable state - and from there
- * to be released. Possibly the page is already clean. We always
- * have buffer heads in this call.
- *
- * Returns 0 if the page is ok to release, 1 otherwise.
- *
- * Possible scenarios are:
- *
- * 1. We are being called to release a page which has been written
- *    to via regular I/O. buffer heads will be dirty and possibly
- *    delalloc. If no delalloc buffer heads in this case then we
- *    can just return zero.
- *
- * 2. We are called to release a page which has been written via
- *    mmap, all we need to do is ensure there is no delalloc
- *    state in the buffer heads, if not we can let the caller
- *    free them and we should come back later via writepage.
- */
-STATIC int
-linvfs_release_page(
-	struct page		*page,
-	int			gfp_mask)
-{
-	struct inode		*inode = page->mapping->host;
-	int			dirty, delalloc, unmapped, unwritten;
-
-	xfs_page_trace(XFS_RELEASEPAGE_ENTER, inode, page, gfp_mask);
-
-	xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
-	if (!delalloc && !unwritten)
-		goto free_buffers;
-
-	if (!(gfp_mask & __GFP_FS))
-		return 0;
-
-	/* If we are already inside a transaction or the thread cannot
-	 * do I/O, we cannot release this page.
-	 */
-	if (PFLAGS_TEST_FSTRANS())
-		return 0;
-
-	/*
-	 * Convert delalloc space to real space, do not flush the
-	 * data out to disk, that will be done by the caller.
-	 * Never need to allocate space here - we will always
-	 * come back to writepage in that case.
-	 */
-	dirty = xfs_page_state_convert(inode, page, 0, 0);
-	if (dirty == 0 && !unwritten)
-		goto free_buffers;
-	return 0;
-
-free_buffers:
-	return try_to_free_buffers(page);
-}
-
-STATIC int
-linvfs_prepare_write(
-	struct file		*file,
-	struct page		*page,
-	unsigned int		from,
-	unsigned int		to)
-{
-	if (file && (file->f_flags & O_SYNC)) {
-		return block_prepare_write(page, from, to,
-						linvfs_get_block_sync);
-	} else {
-		return block_prepare_write(page, from, to,
-						linvfs_get_block);
-	}
-}
-
-struct address_space_operations linvfs_aops = {
-	.readpage		= linvfs_readpage,
-	.readpages		= linvfs_readpages,
-	.writepage		= linvfs_writepage,
-	.sync_page		= block_sync_page,
-	.releasepage		= linvfs_release_page,
-	.prepare_write		= linvfs_prepare_write,
-	.commit_write		= generic_commit_write,
-	.bmap			= linvfs_bmap,
-	.direct_IO		= linvfs_direct_IO,
-};
diff -Nru a/fs/xfs/linux/xfs_buf.c b/fs/xfs/linux/xfs_buf.c
--- a/fs/xfs/linux/xfs_buf.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1811 +0,0 @@
-/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-/*
- *	The xfs_buf.c code provides an abstract buffer cache model on top
- *	of the Linux page cache.  Cached metadata blocks for a file system
- *	are hashed to the inode for the block device.  xfs_buf.c assembles
- *	buffers (xfs_buf_t) on demand to aggregate such cached pages for I/O.
- *
- *      Written by Steve Lord, Jim Mostek, Russell Cattelan
- *		    and Rajagopal Ananthanarayanan ("ananth") at SGI.
- *
- */
-
-#include <linux/stddef.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/pagemap.h>
-#include <linux/init.h>
-#include <linux/vmalloc.h>
-#include <linux/bio.h>
-#include <linux/sysctl.h>
-#include <linux/proc_fs.h>
-#include <linux/workqueue.h>
-#include <linux/suspend.h>
-#include <linux/percpu.h>
-
-#include "xfs_linux.h"
-
-#ifndef GFP_READAHEAD
-#define GFP_READAHEAD	(__GFP_NOWARN|__GFP_NORETRY)
-#endif
-
-/*
- * File wide globals
- */
-
-STATIC kmem_cache_t *pagebuf_cache;
-STATIC void pagebuf_daemon_wakeup(void);
-STATIC void pagebuf_delwri_queue(xfs_buf_t *, int);
-STATIC struct workqueue_struct *pagebuf_logio_workqueue;
-STATIC struct workqueue_struct *pagebuf_dataio_workqueue;
-
-/*
- * Pagebuf debugging
- */
-
-#ifdef PAGEBUF_TRACE
-void
-pagebuf_trace(
-	xfs_buf_t	*pb,
-	char		*id,
-	void		*data,
-	void		*ra)
-{
-	ktrace_enter(pagebuf_trace_buf,
-		pb, id,
-		(void *)(unsigned long)pb->pb_flags,
-		(void *)(unsigned long)pb->pb_hold.counter,
-		(void *)(unsigned long)pb->pb_sema.count.counter,
-		(void *)current,
-		data, ra,
-		(void *)(unsigned long)((pb->pb_file_offset>>32) & 0xffffffff),
-		(void *)(unsigned long)(pb->pb_file_offset & 0xffffffff),
-		(void *)(unsigned long)pb->pb_buffer_length,
-		NULL, NULL, NULL, NULL, NULL);
-}
-ktrace_t *pagebuf_trace_buf;
-#define PAGEBUF_TRACE_SIZE	4096
-#define PB_TRACE(pb, id, data)	\
-	pagebuf_trace(pb, id, (void *)data, (void *)__builtin_return_address(0))
-#else
-#define PB_TRACE(pb, id, data)	do { } while (0)
-#endif
-
-#ifdef PAGEBUF_LOCK_TRACKING
-# define PB_SET_OWNER(pb)	((pb)->pb_last_holder = current->pid)
-# define PB_CLEAR_OWNER(pb)	((pb)->pb_last_holder = -1)
-# define PB_GET_OWNER(pb)	((pb)->pb_last_holder)
-#else
-# define PB_SET_OWNER(pb)	do { } while (0)
-# define PB_CLEAR_OWNER(pb)	do { } while (0)
-# define PB_GET_OWNER(pb)	do { } while (0)
-#endif
-
-/*
- * Pagebuf allocation / freeing.
- */
-
-#define pb_to_gfp(flags) \
-	(((flags) & PBF_READ_AHEAD) ? GFP_READAHEAD : \
-	 ((flags) & PBF_DONT_BLOCK) ? GFP_NOFS : GFP_KERNEL)
-
-#define pb_to_km(flags) \
-	 (((flags) & PBF_DONT_BLOCK) ? KM_NOFS : KM_SLEEP)
-
-
-#define pagebuf_allocate(flags) \
-	kmem_zone_alloc(pagebuf_cache, pb_to_km(flags))
-#define pagebuf_deallocate(pb) \
-	kmem_zone_free(pagebuf_cache, (pb));
-
-/*
- * Pagebuf hashing
- */
-
-#define NBITS	8
-#define NHASH	(1<<NBITS)
-
-typedef struct {
-	struct list_head	pb_hash;
-	spinlock_t		pb_hash_lock;
-} pb_hash_t;
-
-STATIC pb_hash_t	pbhash[NHASH];
-#define pb_hash(pb)	&pbhash[pb->pb_hash_index]
-
-STATIC int
-_bhash(
-	struct block_device *bdev,
-	loff_t		base)
-{
-	int		bit, hval;
-
-	base >>= 9;
-	base ^= (unsigned long)bdev / L1_CACHE_BYTES;
-	for (bit = hval = 0; base && bit < sizeof(base) * 8; bit += NBITS) {
-		hval ^= (int)base & (NHASH-1);
-		base >>= NBITS;
-	}
-	return hval;
-}
-
-/*
- * Mapping of multi-page buffers into contiguous virtual space
- */
-
-typedef struct a_list {
-	void		*vm_addr;
-	struct a_list	*next;
-} a_list_t;
-
-STATIC a_list_t		*as_free_head;
-STATIC int		as_list_len;
-STATIC spinlock_t	as_lock = SPIN_LOCK_UNLOCKED;
-
-/*
- * Try to batch vunmaps because they are costly.
- */
-STATIC void
-free_address(
-	void		*addr)
-{
-	a_list_t	*aentry;
-
-	aentry = kmalloc(sizeof(a_list_t), GFP_ATOMIC);
-	if (aentry) {
-		spin_lock(&as_lock);
-		aentry->next = as_free_head;
-		aentry->vm_addr = addr;
-		as_free_head = aentry;
-		as_list_len++;
-		spin_unlock(&as_lock);
-	} else {
-		vunmap(addr);
-	}
-}
-
-STATIC void
-purge_addresses(void)
-{
-	a_list_t	*aentry, *old;
-
-	if (as_free_head == NULL)
-		return;
-
-	spin_lock(&as_lock);
-	aentry = as_free_head;
-	as_free_head = NULL;
-	as_list_len = 0;
-	spin_unlock(&as_lock);
-
-	while ((old = aentry) != NULL) {
-		vunmap(aentry->vm_addr);
-		aentry = aentry->next;
-		kfree(old);
-	}
-}
-
-/*
- *	Internal pagebuf object manipulation
- */
-
-STATIC void
-_pagebuf_initialize(
-	xfs_buf_t		*pb,
-	xfs_buftarg_t		*target,
-	loff_t			range_base,
-	size_t			range_length,
-	page_buf_flags_t	flags)
-{
-	/*
-	 * We don't want certain flags to appear in pb->pb_flags.
-	 */
-	flags &= ~(PBF_LOCK|PBF_MAPPED|PBF_DONT_BLOCK|PBF_READ_AHEAD);
-
-	memset(pb, 0, sizeof(xfs_buf_t));
-	atomic_set(&pb->pb_hold, 1);
-	init_MUTEX_LOCKED(&pb->pb_iodonesema);
-	INIT_LIST_HEAD(&pb->pb_list);
-	INIT_LIST_HEAD(&pb->pb_hash_list);
-	init_MUTEX_LOCKED(&pb->pb_sema); /* held, no waiters */
-	PB_SET_OWNER(pb);
-	pb->pb_target = target;
-	pb->pb_file_offset = range_base;
-	/*
-	 * Set buffer_length and count_desired to the same value initially.
-	 * I/O routines should use count_desired, which will be the same in
-	 * most cases but may be reset (e.g. XFS recovery).
-	 */
-	pb->pb_buffer_length = pb->pb_count_desired = range_length;
-	pb->pb_flags = flags | PBF_NONE;
-	pb->pb_bn = XFS_BUF_DADDR_NULL;
-	atomic_set(&pb->pb_pin_count, 0);
-	init_waitqueue_head(&pb->pb_waiters);
-
-	XFS_STATS_INC(pb_create);
-	PB_TRACE(pb, "initialize", target);
-}
-
-/*
- * Allocate a page array capable of holding a specified number
- * of pages, and point the page buf at it.
- */
-STATIC int
-_pagebuf_get_pages(
-	xfs_buf_t		*pb,
-	int			page_count,
-	page_buf_flags_t	flags)
-{
-	/* Make sure that we have a page list */
-	if (pb->pb_pages == NULL) {
-		pb->pb_offset = page_buf_poff(pb->pb_file_offset);
-		pb->pb_page_count = page_count;
-		if (page_count <= PB_PAGES) {
-			pb->pb_pages = pb->pb_page_array;
-		} else {
-			pb->pb_pages = kmem_alloc(sizeof(struct page *) *
-					page_count, pb_to_km(flags));
-			if (pb->pb_pages == NULL)
-				return -ENOMEM;
-		}
-		memset(pb->pb_pages, 0, sizeof(struct page *) * page_count);
-	}
-	return 0;
-}
-
-/*
- *	Frees pb_pages if it was malloced.
- */
-STATIC void
-_pagebuf_free_pages(
-	xfs_buf_t	*bp)
-{
-	if (bp->pb_pages != bp->pb_page_array) {
-		kmem_free(bp->pb_pages,
-			  bp->pb_page_count * sizeof(struct page *));
-	}
-}
-
-/*
- *	Releases the specified buffer.
- *
- * 	The modification state of any associated pages is left unchanged.
- * 	The buffer most not be on any hash - use pagebuf_rele instead for
- * 	hashed and refcounted buffers
- */
-void
-pagebuf_free(
-	xfs_buf_t		*bp)
-{
-	PB_TRACE(bp, "free", 0);
-
-	ASSERT(list_empty(&bp->pb_hash_list));
-
-	if (bp->pb_flags & _PBF_PAGE_CACHE) {
-		uint		i;
-
-		if ((bp->pb_flags & PBF_MAPPED) && (bp->pb_page_count > 1))
-			free_address(bp->pb_addr - bp->pb_offset);
-
-		for (i = 0; i < bp->pb_page_count; i++)
-			page_cache_release(bp->pb_pages[i]);
-		_pagebuf_free_pages(bp);
-	} else if (bp->pb_flags & _PBF_KMEM_ALLOC) {
-		 /*
-		  * XXX(hch): bp->pb_count_desired might be incorrect (see
-		  * pagebuf_associate_memory for details), but fortunately
-		  * the Linux version of kmem_free ignores the len argument..
-		  */
-		kmem_free(bp->pb_addr, bp->pb_count_desired);
-		_pagebuf_free_pages(bp);
-	}
-
-	pagebuf_deallocate(bp);
-}
-
-/*
- *	Finds all pages for buffer in question and builds it's page list.
- */
-STATIC int
-_pagebuf_lookup_pages(
-	xfs_buf_t		*bp,
-	uint			flags)
-{
-	struct address_space	*mapping = bp->pb_target->pbr_mapping;
-	unsigned int		sectorshift = bp->pb_target->pbr_sshift;
-	size_t			blocksize = bp->pb_target->pbr_bsize;
-	size_t			size = bp->pb_count_desired;
-	size_t			nbytes, offset;
-	int			gfp_mask = pb_to_gfp(flags);
-	unsigned short		page_count, i;
-	pgoff_t			first;
-	loff_t			end;
-	int			error;
-
-	end = bp->pb_file_offset + bp->pb_buffer_length;
-	page_count = page_buf_btoc(end) - page_buf_btoct(bp->pb_file_offset);
-
-	error = _pagebuf_get_pages(bp, page_count, flags);
-	if (unlikely(error))
-		return error;
-
-	offset = bp->pb_offset;
-	first = bp->pb_file_offset >> PAGE_CACHE_SHIFT;
-
-	for (i = 0; i < bp->pb_page_count; i++) {
-		struct page	*page;
-		uint		retries = 0;
-
-	      retry:
-		page = find_or_create_page(mapping, first + i, gfp_mask);
-		if (unlikely(page == NULL)) {
-			if (flags & PBF_READ_AHEAD)
-				return -ENOMEM;
-
-			/*
-			 * This could deadlock.
-			 *
-			 * But until all the XFS lowlevel code is revamped to
-			 * handle buffer allocation failures we can't do much.
-			 */
-			if (!(++retries % 100)) {
-				printk(KERN_ERR "possibly deadlocking in %s\n",
-						__FUNCTION__);
-			}
-
-			XFS_STATS_INC(pb_page_retries);
-			pagebuf_daemon_wakeup();
-			current->state = TASK_UNINTERRUPTIBLE;
-			schedule_timeout(10);
-			goto retry;
-		}
-
-		XFS_STATS_INC(pb_page_found);
-
-		nbytes = min_t(size_t, size, PAGE_CACHE_SIZE - offset);
-		size -= nbytes;
-
-		if (!PageUptodate(page)) {
-			page_count--;
-			if (blocksize == PAGE_CACHE_SIZE) {
-				if (flags & PBF_READ)
-					bp->pb_locked = 1;
-			} else if (!PagePrivate(page)) {
-				unsigned long	j, range;
-
-				/*
-				 * In this case page->private holds a bitmap
-				 * of uptodate sectors within the page
-				 */
-				ASSERT(blocksize < PAGE_CACHE_SIZE);
-				range = (offset + nbytes) >> sectorshift;
-				for (j = offset >> sectorshift; j < range; j++)
-					if (!test_bit(j, &page->private))
-						break;
-				if (j == range)
-					page_count++;
-			}
-		}
-
-		bp->pb_pages[i] = page;
-		offset = 0;
-	}
-
-	if (!bp->pb_locked) {
-		for (i = 0; i < bp->pb_page_count; i++)
-			unlock_page(bp->pb_pages[i]);
-	}
-
-	bp->pb_flags |= _PBF_PAGE_CACHE;
-
-	if (page_count) {
-		/* if we have any uptodate pages, mark that in the buffer */
-		bp->pb_flags &= ~PBF_NONE;
-
-		/* if some pages aren't uptodate, mark that in the buffer */
-		if (page_count != bp->pb_page_count)
-			bp->pb_flags |= PBF_PARTIAL;
-	}
-
-	PB_TRACE(bp, "lookup_pages", (long)page_count);
-	return error;
-}
-
-/*
- *	Map buffer into kernel address-space if nessecary.
- */
-STATIC int
-_pagebuf_map_pages(
-	xfs_buf_t		*bp,
-	uint			flags)
-{
-	/* A single page buffer is always mappable */
-	if (bp->pb_page_count == 1) {
-		bp->pb_addr = page_address(bp->pb_pages[0]) + bp->pb_offset;
-		bp->pb_flags |= PBF_MAPPED;
-	} else if (flags & PBF_MAPPED) {
-		if (as_list_len > 64)
-			purge_addresses();
-		bp->pb_addr = vmap(bp->pb_pages, bp->pb_page_count,
-				VM_MAP, PAGE_KERNEL);
-		if (unlikely(bp->pb_addr == NULL))
-			return -ENOMEM;
-		bp->pb_addr += bp->pb_offset;
-		bp->pb_flags |= PBF_MAPPED;
-	}
-
-	return 0;
-}
-
-/*
- *	Finding and Reading Buffers
- */
-
-/*
- *	_pagebuf_find
- *
- *	Looks up, and creates if absent, a lockable buffer for
- *	a given range of an inode.  The buffer is returned
- *	locked.	 If other overlapping buffers exist, they are
- *	released before the new buffer is created and locked,
- *	which may imply that this call will block until those buffers
- *	are unlocked.  No I/O is implied by this call.
- */
-STATIC xfs_buf_t *
-_pagebuf_find(				/* find buffer for block	*/
-	xfs_buftarg_t		*target,/* target for block		*/
-	loff_t			ioff,	/* starting offset of range	*/
-	size_t			isize,	/* length of range		*/
-	page_buf_flags_t	flags,	/* PBF_TRYLOCK			*/
-	xfs_buf_t		*new_pb)/* newly allocated buffer	*/
-{
-	loff_t			range_base;
-	size_t			range_length;
-	int			hval;
-	pb_hash_t		*h;
-	xfs_buf_t		*pb, *n;
-	int			not_locked;
-
-	range_base = (ioff << BBSHIFT);
-	range_length = (isize << BBSHIFT);
-
-	/* Ensure we never do IOs smaller than the sector size */
-	BUG_ON(range_length < (1 << target->pbr_sshift));
-
-	/* Ensure we never do IOs that are not sector aligned */
-	BUG_ON(range_base & (loff_t)target->pbr_smask);
-
-	hval = _bhash(target->pbr_bdev, range_base);
-	h = &pbhash[hval];
-
-	spin_lock(&h->pb_hash_lock);
-	list_for_each_entry_safe(pb, n, &h->pb_hash, pb_hash_list) {
-		if (pb->pb_target == target &&
-		    pb->pb_file_offset == range_base &&
-		    pb->pb_buffer_length == range_length) {
-			/* If we look at something bring it to the
-			 * front of the list for next time
-			 */
-			atomic_inc(&pb->pb_hold);
-			list_move(&pb->pb_hash_list, &h->pb_hash);
-			goto found;
-		}
-	}
-
-	/* No match found */
-	if (new_pb) {
-		_pagebuf_initialize(new_pb, target, range_base,
-				range_length, flags);
-		new_pb->pb_hash_index = hval;
-		list_add(&new_pb->pb_hash_list, &h->pb_hash);
-	} else {
-		XFS_STATS_INC(pb_miss_locked);
-	}
-
-	spin_unlock(&h->pb_hash_lock);
-	return (new_pb);
-
-found:
-	spin_unlock(&h->pb_hash_lock);
-
-	/* Attempt to get the semaphore without sleeping,
-	 * if this does not work then we need to drop the
-	 * spinlock and do a hard attempt on the semaphore.
-	 */
-	not_locked = down_trylock(&pb->pb_sema);
-	if (not_locked) {
-		if (!(flags & PBF_TRYLOCK)) {
-			/* wait for buffer ownership */
-			PB_TRACE(pb, "get_lock", 0);
-			pagebuf_lock(pb);
-			XFS_STATS_INC(pb_get_locked_waited);
-		} else {
-			/* We asked for a trylock and failed, no need
-			 * to look at file offset and length here, we
-			 * know that this pagebuf at least overlaps our
-			 * pagebuf and is locked, therefore our buffer
-			 * either does not exist, or is this buffer
-			 */
-
-			pagebuf_rele(pb);
-			XFS_STATS_INC(pb_busy_locked);
-			return (NULL);
-		}
-	} else {
-		/* trylock worked */
-		PB_SET_OWNER(pb);
-	}
-
-	if (pb->pb_flags & PBF_STALE)
-		pb->pb_flags &= PBF_MAPPED;
-	PB_TRACE(pb, "got_lock", 0);
-	XFS_STATS_INC(pb_get_locked);
-	return (pb);
-}
-
-
-/*
- *	pagebuf_find
- *
- *	pagebuf_find returns a buffer matching the specified range of
- *	data for the specified target, if any of the relevant blocks
- *	are in memory.  The buffer may have unallocated holes, if
- *	some, but not all, of the blocks are in memory.  Even where
- *	pages are present in the buffer, not all of every page may be
- *	valid.
- */
-xfs_buf_t *
-pagebuf_find(				/* find buffer for block	*/
-					/* if the block is in memory	*/
-	xfs_buftarg_t		*target,/* target for block		*/
-	loff_t			ioff,	/* starting offset of range	*/
-	size_t			isize,	/* length of range		*/
-	page_buf_flags_t	flags)	/* PBF_TRYLOCK			*/
-{
-	return _pagebuf_find(target, ioff, isize, flags, NULL);
-}
-
-/*
- *	pagebuf_get
- *
- *	pagebuf_get assembles a buffer covering the specified range.
- *	Some or all of the blocks in the range may be valid.  Storage
- *	in memory for all portions of the buffer will be allocated,
- *	although backing storage may not be.  If PBF_READ is set in
- *	flags, pagebuf_iostart is called also.
- */
-xfs_buf_t *
-pagebuf_get(				/* allocate a buffer		*/
-	xfs_buftarg_t		*target,/* target for buffer		*/
-	loff_t			ioff,	/* starting offset of range	*/
-	size_t			isize,	/* length of range		*/
-	page_buf_flags_t	flags)	/* PBF_TRYLOCK			*/
-{
-	xfs_buf_t		*pb, *new_pb;
-	int			error = 0, i;
-
-	new_pb = pagebuf_allocate(flags);
-	if (unlikely(!new_pb))
-		return NULL;
-
-	pb = _pagebuf_find(target, ioff, isize, flags, new_pb);
-	if (pb == new_pb) {
-		error = _pagebuf_lookup_pages(pb, flags);
-		if (unlikely(error)) {
-			printk(KERN_WARNING
-			       "pagebuf_get: failed to lookup pages\n");
-			goto no_buffer;
-		}
-	} else {
-		pagebuf_deallocate(new_pb);
-		if (unlikely(pb == NULL))
-			return NULL;
-	}
-
-	for (i = 0; i < pb->pb_page_count; i++)
-		mark_page_accessed(pb->pb_pages[i]);
-
-	if (!(pb->pb_flags & PBF_MAPPED)) {
-		error = _pagebuf_map_pages(pb, flags);
-		if (unlikely(error)) {
-			printk(KERN_WARNING
-			       "pagebuf_get: failed to map pages\n");
-			goto no_buffer;
-		}
-	}
-
-	XFS_STATS_INC(pb_get);
-
-	/*
-	 * Always fill in the block number now, the mapped cases can do
-	 * their own overlay of this later.
-	 */
-	pb->pb_bn = ioff;
-	pb->pb_count_desired = pb->pb_buffer_length;
-
-	if (flags & PBF_READ) {
-		if (PBF_NOT_DONE(pb)) {
-			PB_TRACE(pb, "get_read", (unsigned long)flags);
-			XFS_STATS_INC(pb_get_read);
-			pagebuf_iostart(pb, flags);
-		} else if (flags & PBF_ASYNC) {
-			PB_TRACE(pb, "get_read_async", (unsigned long)flags);
-			/*
-			 * Read ahead call which is already satisfied,
-			 * drop the buffer
-			 */
-			goto no_buffer;
-		} else {
-			PB_TRACE(pb, "get_read_done", (unsigned long)flags);
-			/* We do not want read in the flags */
-			pb->pb_flags &= ~PBF_READ;
-		}
-	} else {
-		PB_TRACE(pb, "get_write", (unsigned long)flags);
-	}
-
-	return pb;
-
-no_buffer:
-	if (flags & (PBF_LOCK | PBF_TRYLOCK))
-		pagebuf_unlock(pb);
-	pagebuf_rele(pb);
-	return NULL;
-}
-
-/*
- * Create a skeletal pagebuf (no pages associated with it).
- */
-xfs_buf_t *
-pagebuf_lookup(
-	xfs_buftarg_t		*target,
-	loff_t			ioff,
-	size_t			isize,
-	page_buf_flags_t	flags)
-{
-	xfs_buf_t		*pb;
-
-	pb = pagebuf_allocate(flags);
-	if (pb) {
-		_pagebuf_initialize(pb, target, ioff, isize, flags);
-	}
-	return pb;
-}
-
-/*
- * If we are not low on memory then do the readahead in a deadlock
- * safe manner.
- */
-void
-pagebuf_readahead(
-	xfs_buftarg_t		*target,
-	loff_t			ioff,
-	size_t			isize,
-	page_buf_flags_t	flags)
-{
-	struct backing_dev_info *bdi;
-
-	bdi = target->pbr_mapping->backing_dev_info;
-	if (bdi_read_congested(bdi))
-		return;
-	if (bdi_write_congested(bdi))
-		return;
-
-	flags |= (PBF_TRYLOCK|PBF_READ|PBF_ASYNC|PBF_READ_AHEAD);
-	pagebuf_get(target, ioff, isize, flags);
-}
-
-xfs_buf_t *
-pagebuf_get_empty(
-	size_t			len,
-	xfs_buftarg_t		*target)
-{
-	xfs_buf_t		*pb;
-
-	pb = pagebuf_allocate(0);
-	if (pb)
-		_pagebuf_initialize(pb, target, 0, len, 0);
-	return pb;
-}
-
-static inline struct page *
-mem_to_page(
-	void			*addr)
-{
-	if (((unsigned long)addr < VMALLOC_START) ||
-	    ((unsigned long)addr >= VMALLOC_END)) {
-		return virt_to_page(addr);
-	} else {
-		return vmalloc_to_page(addr);
-	}
-}
-
-int
-pagebuf_associate_memory(
-	xfs_buf_t		*pb,
-	void			*mem,
-	size_t			len)
-{
-	int			rval;
-	int			i = 0;
-	size_t			ptr;
-	size_t			end, end_cur;
-	off_t			offset;
-	int			page_count;
-
-	page_count = PAGE_CACHE_ALIGN(len) >> PAGE_CACHE_SHIFT;
-	offset = (off_t) mem - ((off_t)mem & PAGE_CACHE_MASK);
-	if (offset && (len > PAGE_CACHE_SIZE))
-		page_count++;
-
-	/* Free any previous set of page pointers */
-	if (pb->pb_pages)
-		_pagebuf_free_pages(pb);
-
-	pb->pb_pages = NULL;
-	pb->pb_addr = mem;
-
-	rval = _pagebuf_get_pages(pb, page_count, 0);
-	if (rval)
-		return rval;
-
-	pb->pb_offset = offset;
-	ptr = (size_t) mem & PAGE_CACHE_MASK;
-	end = PAGE_CACHE_ALIGN((size_t) mem + len);
-	end_cur = end;
-	/* set up first page */
-	pb->pb_pages[0] = mem_to_page(mem);
-
-	ptr += PAGE_CACHE_SIZE;
-	pb->pb_page_count = ++i;
-	while (ptr < end) {
-		pb->pb_pages[i] = mem_to_page((void *)ptr);
-		pb->pb_page_count = ++i;
-		ptr += PAGE_CACHE_SIZE;
-	}
-	pb->pb_locked = 0;
-
-	pb->pb_count_desired = pb->pb_buffer_length = len;
-	pb->pb_flags |= PBF_MAPPED;
-
-	return 0;
-}
-
-xfs_buf_t *
-pagebuf_get_no_daddr(
-	size_t			len,
-	xfs_buftarg_t		*target)
-{
-	size_t			malloc_len = len;
-	xfs_buf_t		*bp;
-	void			*data;
-	int			error;
-
-	if (unlikely(len > 0x20000))
-		goto fail;
-
-	bp = pagebuf_allocate(0);
-	if (unlikely(bp == NULL))
-		goto fail;
-	_pagebuf_initialize(bp, target, 0, len, PBF_FORCEIO);
-
- try_again:
-	data = kmem_alloc(malloc_len, KM_SLEEP);
-	if (unlikely(data == NULL))
-		goto fail_free_buf;
-
-	/* check whether alignment matches.. */
-	if ((__psunsigned_t)data !=
-	    ((__psunsigned_t)data & ~target->pbr_smask)) {
-		/* .. else double the size and try again */
-		kmem_free(data, malloc_len);
-		malloc_len <<= 1;
-		goto try_again;
-	}
-
-	error = pagebuf_associate_memory(bp, data, len);
-	if (error)
-		goto fail_free_mem;
-	bp->pb_flags |= _PBF_KMEM_ALLOC;
-
-	pagebuf_unlock(bp);
-
-	PB_TRACE(bp, "no_daddr", data);
-	return bp;
- fail_free_mem:
-	kmem_free(data, malloc_len);
- fail_free_buf:
-	pagebuf_free(bp);
- fail:
-	return NULL;
-}
-
-/*
- *	pagebuf_hold
- *
- *	Increment reference count on buffer, to hold the buffer concurrently
- *	with another thread which may release (free) the buffer asynchronously.
- *
- *	Must hold the buffer already to call this function.
- */
-void
-pagebuf_hold(
-	xfs_buf_t		*pb)
-{
-	atomic_inc(&pb->pb_hold);
-	PB_TRACE(pb, "hold", 0);
-}
-
-/*
- *	pagebuf_rele
- *
- *	pagebuf_rele releases a hold on the specified buffer.  If the
- *	the hold count is 1, pagebuf_rele calls pagebuf_free.
- */
-void
-pagebuf_rele(
-	xfs_buf_t		*pb)
-{
-	pb_hash_t		*hash = pb_hash(pb);
-
-	PB_TRACE(pb, "rele", pb->pb_relse);
-
-	if (atomic_dec_and_lock(&pb->pb_hold, &hash->pb_hash_lock)) {
-		int		do_free = 1;
-
-		if (pb->pb_relse) {
-			atomic_inc(&pb->pb_hold);
-			spin_unlock(&hash->pb_hash_lock);
-			(*(pb->pb_relse)) (pb);
-			spin_lock(&hash->pb_hash_lock);
-			do_free = 0;
-		}
-
-		if (pb->pb_flags & PBF_DELWRI) {
-			pb->pb_flags |= PBF_ASYNC;
-			atomic_inc(&pb->pb_hold);
-			pagebuf_delwri_queue(pb, 0);
-			do_free = 0;
-		} else if (pb->pb_flags & PBF_FS_MANAGED) {
-			do_free = 0;
-		}
-
-		if (do_free) {
-			list_del_init(&pb->pb_hash_list);
-			spin_unlock(&hash->pb_hash_lock);
-			pagebuf_free(pb);
-		} else {
-			spin_unlock(&hash->pb_hash_lock);
-		}
-	}
-}
-
-
-/*
- *	Mutual exclusion on buffers.  Locking model:
- *
- *	Buffers associated with inodes for which buffer locking
- *	is not enabled are not protected by semaphores, and are
- *	assumed to be exclusively owned by the caller.  There is a
- *	spinlock in the buffer, used by the caller when concurrent
- *	access is possible.
- */
-
-/*
- *	pagebuf_cond_lock
- *
- *	pagebuf_cond_lock locks a buffer object, if it is not already locked.
- *	Note that this in no way
- *	locks the underlying pages, so it is only useful for synchronizing
- *	concurrent use of page buffer objects, not for synchronizing independent
- *	access to the underlying pages.
- */
-int
-pagebuf_cond_lock(			/* lock buffer, if not locked	*/
-					/* returns -EBUSY if locked)	*/
-	xfs_buf_t		*pb)
-{
-	int			locked;
-
-	locked = down_trylock(&pb->pb_sema) == 0;
-	if (locked) {
-		PB_SET_OWNER(pb);
-	}
-	PB_TRACE(pb, "cond_lock", (long)locked);
-	return(locked ? 0 : -EBUSY);
-}
-
-/*
- *	pagebuf_lock_value
- *
- *	Return lock value for a pagebuf
- */
-int
-pagebuf_lock_value(
-	xfs_buf_t		*pb)
-{
-	return(atomic_read(&pb->pb_sema.count));
-}
-
-/*
- *	pagebuf_lock
- *
- *	pagebuf_lock locks a buffer object.  Note that this in no way
- *	locks the underlying pages, so it is only useful for synchronizing
- *	concurrent use of page buffer objects, not for synchronizing independent
- *	access to the underlying pages.
- */
-int
-pagebuf_lock(
-	xfs_buf_t		*pb)
-{
-	PB_TRACE(pb, "lock", 0);
-	if (atomic_read(&pb->pb_io_remaining))
-		blk_run_address_space(pb->pb_target->pbr_mapping);
-	down(&pb->pb_sema);
-	PB_SET_OWNER(pb);
-	PB_TRACE(pb, "locked", 0);
-	return 0;
-}
-
-/*
- *	pagebuf_unlock
- *
- *	pagebuf_unlock releases the lock on the buffer object created by
- *	pagebuf_lock or pagebuf_cond_lock (not any
- *	pinning of underlying pages created by pagebuf_pin).
- */
-void
-pagebuf_unlock(				/* unlock buffer		*/
-	xfs_buf_t		*pb)	/* buffer to unlock		*/
-{
-	PB_CLEAR_OWNER(pb);
-	up(&pb->pb_sema);
-	PB_TRACE(pb, "unlock", 0);
-}
-
-
-/*
- *	Pinning Buffer Storage in Memory
- */
-
-/*
- *	pagebuf_pin
- *
- *	pagebuf_pin locks all of the memory represented by a buffer in
- *	memory.  Multiple calls to pagebuf_pin and pagebuf_unpin, for
- *	the same or different buffers affecting a given page, will
- *	properly count the number of outstanding "pin" requests.  The
- *	buffer may be released after the pagebuf_pin and a different
- *	buffer used when calling pagebuf_unpin, if desired.
- *	pagebuf_pin should be used by the file system when it wants be
- *	assured that no attempt will be made to force the affected
- *	memory to disk.	 It does not assure that a given logical page
- *	will not be moved to a different physical page.
- */
-void
-pagebuf_pin(
-	xfs_buf_t		*pb)
-{
-	atomic_inc(&pb->pb_pin_count);
-	PB_TRACE(pb, "pin", (long)pb->pb_pin_count.counter);
-}
-
-/*
- *	pagebuf_unpin
- *
- *	pagebuf_unpin reverses the locking of memory performed by
- *	pagebuf_pin.  Note that both functions affected the logical
- *	pages associated with the buffer, not the buffer itself.
- */
-void
-pagebuf_unpin(
-	xfs_buf_t		*pb)
-{
-	if (atomic_dec_and_test(&pb->pb_pin_count)) {
-		wake_up_all(&pb->pb_waiters);
-	}
-	PB_TRACE(pb, "unpin", (long)pb->pb_pin_count.counter);
-}
-
-int
-pagebuf_ispin(
-	xfs_buf_t		*pb)
-{
-	return atomic_read(&pb->pb_pin_count);
-}
-
-/*
- *	pagebuf_wait_unpin
- *
- *	pagebuf_wait_unpin waits until all of the memory associated
- *	with the buffer is not longer locked in memory.  It returns
- *	immediately if none of the affected pages are locked.
- */
-static inline void
-_pagebuf_wait_unpin(
-	xfs_buf_t		*pb)
-{
-	DECLARE_WAITQUEUE	(wait, current);
-
-	if (atomic_read(&pb->pb_pin_count) == 0)
-		return;
-
-	add_wait_queue(&pb->pb_waiters, &wait);
-	for (;;) {
-		current->state = TASK_UNINTERRUPTIBLE;
-		if (atomic_read(&pb->pb_pin_count) == 0)
-			break;
-		if (atomic_read(&pb->pb_io_remaining))
-			blk_run_address_space(pb->pb_target->pbr_mapping);
-		schedule();
-	}
-	remove_wait_queue(&pb->pb_waiters, &wait);
-	current->state = TASK_RUNNING;
-}
-
-/*
- *	Buffer Utility Routines
- */
-
-/*
- *	pagebuf_iodone
- *
- *	pagebuf_iodone marks a buffer for which I/O is in progress
- *	done with respect to that I/O.	The pb_iodone routine, if
- *	present, will be called as a side-effect.
- */
-void
-pagebuf_iodone_work(
-	void			*v)
-{
-	xfs_buf_t		*bp = (xfs_buf_t *)v;
-
-	if (bp->pb_iodone)
-		(*(bp->pb_iodone))(bp);
-	else if (bp->pb_flags & PBF_ASYNC)
-		xfs_buf_relse(bp);
-}
-
-void
-pagebuf_iodone(
-	xfs_buf_t		*pb,
-	int			dataio,
-	int			schedule)
-{
-	pb->pb_flags &= ~(PBF_READ | PBF_WRITE);
-	if (pb->pb_error == 0) {
-		pb->pb_flags &= ~(PBF_PARTIAL | PBF_NONE);
-	}
-
-	PB_TRACE(pb, "iodone", pb->pb_iodone);
-
-	if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) {
-		if (schedule) {
-			INIT_WORK(&pb->pb_iodone_work, pagebuf_iodone_work, pb);
-			queue_work(dataio ? pagebuf_dataio_workqueue :
-				pagebuf_logio_workqueue, &pb->pb_iodone_work);
-		} else {
-			pagebuf_iodone_work(pb);
-		}
-	} else {
-		up(&pb->pb_iodonesema);
-	}
-}
-
-/*
- *	pagebuf_ioerror
- *
- *	pagebuf_ioerror sets the error code for a buffer.
- */
-void
-pagebuf_ioerror(			/* mark/clear buffer error flag */
-	xfs_buf_t		*pb,	/* buffer to mark		*/
-	int			error)	/* error to store (0 if none)	*/
-{
-	ASSERT(error >= 0 && error <= 0xffff);
-	pb->pb_error = (unsigned short)error;
-	PB_TRACE(pb, "ioerror", (unsigned long)error);
-}
-
-/*
- *	pagebuf_iostart
- *
- *	pagebuf_iostart initiates I/O on a buffer, based on the flags supplied.
- *	If necessary, it will arrange for any disk space allocation required,
- *	and it will break up the request if the block mappings require it.
- *	The pb_iodone routine in the buffer supplied will only be called
- *	when all of the subsidiary I/O requests, if any, have been completed.
- *	pagebuf_iostart calls the pagebuf_ioinitiate routine or
- *	pagebuf_iorequest, if the former routine is not defined, to start
- *	the I/O on a given low-level request.
- */
-int
-pagebuf_iostart(			/* start I/O on a buffer	  */
-	xfs_buf_t		*pb,	/* buffer to start		  */
-	page_buf_flags_t	flags)	/* PBF_LOCK, PBF_ASYNC, PBF_READ, */
-					/* PBF_WRITE, PBF_DELWRI,	  */
-					/* PBF_DONT_BLOCK		  */
-{
-	int			status = 0;
-
-	PB_TRACE(pb, "iostart", (unsigned long)flags);
-
-	if (flags & PBF_DELWRI) {
-		pb->pb_flags &= ~(PBF_READ | PBF_WRITE | PBF_ASYNC);
-		pb->pb_flags |= flags & (PBF_DELWRI | PBF_ASYNC);
-		pagebuf_delwri_queue(pb, 1);
-		return status;
-	}
-
-	pb->pb_flags &= ~(PBF_READ | PBF_WRITE | PBF_ASYNC | PBF_DELWRI | \
-			PBF_READ_AHEAD | _PBF_RUN_QUEUES);
-	pb->pb_flags |= flags & (PBF_READ | PBF_WRITE | PBF_ASYNC | \
-			PBF_READ_AHEAD | _PBF_RUN_QUEUES);
-
-	BUG_ON(pb->pb_bn == XFS_BUF_DADDR_NULL);
-
-	/* For writes allow an alternate strategy routine to precede
-	 * the actual I/O request (which may not be issued at all in
-	 * a shutdown situation, for example).
-	 */
-	status = (flags & PBF_WRITE) ?
-		pagebuf_iostrategy(pb) : pagebuf_iorequest(pb);
-
-	/* Wait for I/O if we are not an async request.
-	 * Note: async I/O request completion will release the buffer,
-	 * and that can already be done by this point.  So using the
-	 * buffer pointer from here on, after async I/O, is invalid.
-	 */
-	if (!status && !(flags & PBF_ASYNC))
-		status = pagebuf_iowait(pb);
-
-	return status;
-}
-
-/*
- * Helper routine for pagebuf_iorequest
- */
-
-STATIC __inline__ int
-_pagebuf_iolocked(
-	xfs_buf_t		*pb)
-{
-	ASSERT(pb->pb_flags & (PBF_READ|PBF_WRITE));
-	if (pb->pb_flags & PBF_READ)
-		return pb->pb_locked;
-	return 0;
-}
-
-STATIC __inline__ void
-_pagebuf_iodone(
-	xfs_buf_t		*pb,
-	int			schedule)
-{
-	if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
-		pb->pb_locked = 0;
-		pagebuf_iodone(pb, (pb->pb_flags & PBF_FS_DATAIOD), schedule);
-	}
-}
-
-STATIC int
-bio_end_io_pagebuf(
-	struct bio		*bio,
-	unsigned int		bytes_done,
-	int			error)
-{
-	xfs_buf_t		*pb = (xfs_buf_t *)bio->bi_private;
-	unsigned int		i, blocksize = pb->pb_target->pbr_bsize;
-	unsigned int		sectorshift = pb->pb_target->pbr_sshift;
-	struct bio_vec		*bvec = bio->bi_io_vec;
-
-	if (bio->bi_size)
-		return 1;
-
-	if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
-		pb->pb_error = EIO;
-
-	for (i = 0; i < bio->bi_vcnt; i++, bvec++) {
-		struct page	*page = bvec->bv_page;
-
-		if (pb->pb_error) {
-			SetPageError(page);
-		} else if (blocksize == PAGE_CACHE_SIZE) {
-			SetPageUptodate(page);
-		} else if (!PagePrivate(page) &&
-				(pb->pb_flags & _PBF_PAGE_CACHE)) {
-			unsigned long	j, range;
-
-			ASSERT(blocksize < PAGE_CACHE_SIZE);
-			range = (bvec->bv_offset + bvec->bv_len) >> sectorshift;
-			for (j = bvec->bv_offset >> sectorshift; j < range; j++)
-				set_bit(j, &page->private);
-			if (page->private == (unsigned long)(PAGE_CACHE_SIZE-1))
-				SetPageUptodate(page);
-		}
-
-		if (_pagebuf_iolocked(pb)) {
-			unlock_page(page);
-		}
-	}
-
-	_pagebuf_iodone(pb, 1);
-	bio_put(bio);
-	return 0;
-}
-
-void
-_pagebuf_ioapply(
-	xfs_buf_t		*pb)
-{
-	int			i, map_i, total_nr_pages, nr_pages;
-	struct bio		*bio;
-	int			offset = pb->pb_offset;
-	int			size = pb->pb_count_desired;
-	sector_t		sector = pb->pb_bn;
-	unsigned int		blocksize = pb->pb_target->pbr_bsize;
-	int			locking = _pagebuf_iolocked(pb);
-
-	total_nr_pages = pb->pb_page_count;
-	map_i = 0;
-
-	/* Special code path for reading a sub page size pagebuf in --
-	 * we populate up the whole page, and hence the other metadata
-	 * in the same page.  This optimization is only valid when the
-	 * filesystem block size and the page size are equal.
-	 */
-	if ((pb->pb_buffer_length < PAGE_CACHE_SIZE) &&
-	    (pb->pb_flags & PBF_READ) && locking &&
-	    (blocksize == PAGE_CACHE_SIZE)) {
-		bio = bio_alloc(GFP_NOIO, 1);
-
-		bio->bi_bdev = pb->pb_target->pbr_bdev;
-		bio->bi_sector = sector - (offset >> BBSHIFT);
-		bio->bi_end_io = bio_end_io_pagebuf;
-		bio->bi_private = pb;
-
-		bio_add_page(bio, pb->pb_pages[0], PAGE_CACHE_SIZE, 0);
-		size = 0;
-
-		atomic_inc(&pb->pb_io_remaining);
-
-		goto submit_io;
-	}
-
-	/* Lock down the pages which we need to for the request */
-	if (locking && (pb->pb_flags & PBF_WRITE) && (pb->pb_locked == 0)) {
-		for (i = 0; size; i++) {
-			int		nbytes = PAGE_CACHE_SIZE - offset;
-			struct page	*page = pb->pb_pages[i];
-
-			if (nbytes > size)
-				nbytes = size;
-
-			lock_page(page);
-
-			size -= nbytes;
-			offset = 0;
-		}
-		offset = pb->pb_offset;
-		size = pb->pb_count_desired;
-	}
-
-next_chunk:
-	atomic_inc(&pb->pb_io_remaining);
-	nr_pages = BIO_MAX_SECTORS >> (PAGE_SHIFT - BBSHIFT);
-	if (nr_pages > total_nr_pages)
-		nr_pages = total_nr_pages;
-
-	bio = bio_alloc(GFP_NOIO, nr_pages);
-	bio->bi_bdev = pb->pb_target->pbr_bdev;
-	bio->bi_sector = sector;
-	bio->bi_end_io = bio_end_io_pagebuf;
-	bio->bi_private = pb;
-
-	for (; size && nr_pages; nr_pages--, map_i++) {
-		int	nbytes = PAGE_CACHE_SIZE - offset;
-
-		if (nbytes > size)
-			nbytes = size;
-
-		if (bio_add_page(bio, pb->pb_pages[map_i],
-					nbytes, offset) < nbytes)
-			break;
-
-		offset = 0;
-		sector += nbytes >> BBSHIFT;
-		size -= nbytes;
-		total_nr_pages--;
-	}
-
-submit_io:
-	if (likely(bio->bi_size)) {
-		submit_bio((pb->pb_flags & PBF_READ) ? READ : WRITE, bio);
-		if (size)
-			goto next_chunk;
-	} else {
-		bio_put(bio);
-		pagebuf_ioerror(pb, EIO);
-	}
-
-	if (pb->pb_flags & _PBF_RUN_QUEUES) {
-		pb->pb_flags &= ~_PBF_RUN_QUEUES;
-		if (atomic_read(&pb->pb_io_remaining) > 1)
-			blk_run_address_space(pb->pb_target->pbr_mapping);
-	}
-}
-
-/*
- *	pagebuf_iorequest -- the core I/O request routine.
- */
-int
-pagebuf_iorequest(			/* start real I/O		*/
-	xfs_buf_t		*pb)	/* buffer to convey to device	*/
-{
-	PB_TRACE(pb, "iorequest", 0);
-
-	if (pb->pb_flags & PBF_DELWRI) {
-		pagebuf_delwri_queue(pb, 1);
-		return 0;
-	}
-
-	if (pb->pb_flags & PBF_WRITE) {
-		_pagebuf_wait_unpin(pb);
-	}
-
-	pagebuf_hold(pb);
-
-	/* Set the count to 1 initially, this will stop an I/O
-	 * completion callout which happens before we have started
-	 * all the I/O from calling pagebuf_iodone too early.
-	 */
-	atomic_set(&pb->pb_io_remaining, 1);
-	_pagebuf_ioapply(pb);
-	_pagebuf_iodone(pb, 0);
-
-	pagebuf_rele(pb);
-	return 0;
-}
-
-/*
- *	pagebuf_iowait
- *
- *	pagebuf_iowait waits for I/O to complete on the buffer supplied.
- *	It returns immediately if no I/O is pending.  In any case, it returns
- *	the error code, if any, or 0 if there is no error.
- */
-int
-pagebuf_iowait(
-	xfs_buf_t		*pb)
-{
-	PB_TRACE(pb, "iowait", 0);
-	if (atomic_read(&pb->pb_io_remaining))
-		blk_run_address_space(pb->pb_target->pbr_mapping);
-	down(&pb->pb_iodonesema);
-	PB_TRACE(pb, "iowaited", (long)pb->pb_error);
-	return pb->pb_error;
-}
-
-caddr_t
-pagebuf_offset(
-	xfs_buf_t		*pb,
-	size_t			offset)
-{
-	struct page		*page;
-
-	offset += pb->pb_offset;
-
-	page = pb->pb_pages[offset >> PAGE_CACHE_SHIFT];
-	return (caddr_t) page_address(page) + (offset & (PAGE_CACHE_SIZE - 1));
-}
-
-/*
- *	pagebuf_iomove
- *
- *	Move data into or out of a buffer.
- */
-void
-pagebuf_iomove(
-	xfs_buf_t		*pb,	/* buffer to process		*/
-	size_t			boff,	/* starting buffer offset	*/
-	size_t			bsize,	/* length to copy		*/
-	caddr_t			data,	/* data address			*/
-	page_buf_rw_t		mode)	/* read/write flag		*/
-{
-	size_t			bend, cpoff, csize;
-	struct page		*page;
-
-	bend = boff + bsize;
-	while (boff < bend) {
-		page = pb->pb_pages[page_buf_btoct(boff + pb->pb_offset)];
-		cpoff = page_buf_poff(boff + pb->pb_offset);
-		csize = min_t(size_t,
-			      PAGE_CACHE_SIZE-cpoff, pb->pb_count_desired-boff);
-
-		ASSERT(((csize + cpoff) <= PAGE_CACHE_SIZE));
-
-		switch (mode) {
-		case PBRW_ZERO:
-			memset(page_address(page) + cpoff, 0, csize);
-			break;
-		case PBRW_READ:
-			memcpy(data, page_address(page) + cpoff, csize);
-			break;
-		case PBRW_WRITE:
-			memcpy(page_address(page) + cpoff, data, csize);
-		}
-
-		boff += csize;
-		data += csize;
-	}
-}
-
-/*
- *	Handling of buftargs.
- */
-
-void
-xfs_free_buftarg(
-	xfs_buftarg_t		*btp,
-	int			external)
-{
-	xfs_flush_buftarg(btp, 1);
-	if (external)
-		xfs_blkdev_put(btp->pbr_bdev);
-	kmem_free(btp, sizeof(*btp));
-}
-
-void
-xfs_incore_relse(
-	xfs_buftarg_t		*btp,
-	int			delwri_only,
-	int			wait)
-{
-	invalidate_bdev(btp->pbr_bdev, 1);
-	truncate_inode_pages(btp->pbr_mapping, 0LL);
-}
-
-void
-xfs_setsize_buftarg(
-	xfs_buftarg_t		*btp,
-	unsigned int		blocksize,
-	unsigned int		sectorsize)
-{
-	btp->pbr_bsize = blocksize;
-	btp->pbr_sshift = ffs(sectorsize) - 1;
-	btp->pbr_smask = sectorsize - 1;
-
-	if (set_blocksize(btp->pbr_bdev, sectorsize)) {
-		printk(KERN_WARNING
-			"XFS: Cannot set_blocksize to %u on device %s\n",
-			sectorsize, XFS_BUFTARG_NAME(btp));
-	}
-}
-
-xfs_buftarg_t *
-xfs_alloc_buftarg(
-	struct block_device	*bdev)
-{
-	xfs_buftarg_t		*btp;
-
-	btp = kmem_zalloc(sizeof(*btp), KM_SLEEP);
-
-	btp->pbr_dev =  bdev->bd_dev;
-	btp->pbr_bdev = bdev;
-	btp->pbr_mapping = bdev->bd_inode->i_mapping;
-	xfs_setsize_buftarg(btp, PAGE_CACHE_SIZE, bdev_hardsect_size(bdev));
-
-	return btp;
-}
-
-
-/*
- * Pagebuf delayed write buffer handling
- */
-
-STATIC LIST_HEAD(pbd_delwrite_queue);
-STATIC spinlock_t pbd_delwrite_lock = SPIN_LOCK_UNLOCKED;
-
-STATIC void
-pagebuf_delwri_queue(
-	xfs_buf_t		*pb,
-	int			unlock)
-{
-	PB_TRACE(pb, "delwri_q", (long)unlock);
-	ASSERT(pb->pb_flags & PBF_DELWRI);
-
-	spin_lock(&pbd_delwrite_lock);
-	/* If already in the queue, dequeue and place at tail */
-	if (!list_empty(&pb->pb_list)) {
-		if (unlock) {
-			atomic_dec(&pb->pb_hold);
-		}
-		list_del(&pb->pb_list);
-	}
-
-	list_add_tail(&pb->pb_list, &pbd_delwrite_queue);
-	pb->pb_queuetime = jiffies;
-	spin_unlock(&pbd_delwrite_lock);
-
-	if (unlock)
-		pagebuf_unlock(pb);
-}
-
-void
-pagebuf_delwri_dequeue(
-	xfs_buf_t		*pb)
-{
-	PB_TRACE(pb, "delwri_uq", 0);
-	spin_lock(&pbd_delwrite_lock);
-	list_del_init(&pb->pb_list);
-	pb->pb_flags &= ~PBF_DELWRI;
-	spin_unlock(&pbd_delwrite_lock);
-}
-
-STATIC void
-pagebuf_runall_queues(
-	struct workqueue_struct	*queue)
-{
-	flush_workqueue(queue);
-}
-
-/* Defines for pagebuf daemon */
-STATIC DECLARE_COMPLETION(pagebuf_daemon_done);
-STATIC struct task_struct *pagebuf_daemon_task;
-STATIC int pagebuf_daemon_active;
-STATIC int force_flush;
-
-STATIC void
-pagebuf_daemon_wakeup(void)
-{
-	force_flush = 1;
-	barrier();
-	wake_up_process(pagebuf_daemon_task);
-}
-
-STATIC int
-pagebuf_daemon(
-	void			*data)
-{
-	struct list_head	tmp;
-	xfs_buf_t		*pb, *n;
-
-	/*  Set up the thread  */
-	daemonize("xfsbufd");
-	current->flags |= PF_MEMALLOC;
-
-	pagebuf_daemon_task = current;
-	pagebuf_daemon_active = 1;
-	barrier();
-
-	INIT_LIST_HEAD(&tmp);
-	do {
-		/* swsusp */
-		if (current->flags & PF_FREEZE)
-			refrigerator(PF_FREEZE);
-
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(xfs_flush_interval);
-
-		spin_lock(&pbd_delwrite_lock);
-		list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) {
-			PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb));
-			ASSERT(pb->pb_flags & PBF_DELWRI);
-
-			if (!pagebuf_ispin(pb) && !pagebuf_cond_lock(pb)) {
-				if (!force_flush &&
-				    time_before(jiffies,
-						pb->pb_queuetime +
-						xfs_age_buffer)) {
-					pagebuf_unlock(pb);
-					break;
-				}
-
-				pb->pb_flags &= ~PBF_DELWRI;
-				pb->pb_flags |= PBF_WRITE;
-				list_move(&pb->pb_list, &tmp);
-			}
-		}
-		spin_unlock(&pbd_delwrite_lock);
-
-		while (!list_empty(&tmp)) {
-			pb = list_entry(tmp.next, xfs_buf_t, pb_list);
-			list_del_init(&pb->pb_list);
-			pagebuf_iostrategy(pb);
-			blk_run_address_space(pb->pb_target->pbr_mapping);
-		}
-
-		if (as_list_len > 0)
-			purge_addresses();
-
-		force_flush = 0;
-	} while (pagebuf_daemon_active);
-
-	complete_and_exit(&pagebuf_daemon_done, 0);
-}
-
-/*
- * Go through all incore buffers, and release buffers if they belong to
- * the given device. This is used in filesystem error handling to
- * preserve the consistency of its metadata.
- */
-int
-xfs_flush_buftarg(
-	xfs_buftarg_t		*target,
-	int			wait)
-{
-	struct list_head	tmp;
-	xfs_buf_t		*pb, *n;
-	int			pincount = 0;
-
-	pagebuf_runall_queues(pagebuf_dataio_workqueue);
-	pagebuf_runall_queues(pagebuf_logio_workqueue);
-
-	INIT_LIST_HEAD(&tmp);
-	spin_lock(&pbd_delwrite_lock);
-	list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) {
-
-		if (pb->pb_target != target)
-			continue;
-
-		ASSERT(pb->pb_flags & PBF_DELWRI);
-		PB_TRACE(pb, "walkq2", (long)pagebuf_ispin(pb));
-		if (pagebuf_ispin(pb)) {
-			pincount++;
-			continue;
-		}
-
-		pb->pb_flags &= ~PBF_DELWRI;
-		pb->pb_flags |= PBF_WRITE;
-		list_move(&pb->pb_list, &tmp);
-	}
-	spin_unlock(&pbd_delwrite_lock);
-
-	/*
-	 * Dropped the delayed write list lock, now walk the temporary list
-	 */
-	list_for_each_entry_safe(pb, n, &tmp, pb_list) {
-		if (wait)
-			pb->pb_flags &= ~PBF_ASYNC;
-		else
-			list_del_init(&pb->pb_list);
-
-		pagebuf_lock(pb);
-		pagebuf_iostrategy(pb);
-	}
-
-	/*
-	 * Remaining list items must be flushed before returning
-	 */
-	while (!list_empty(&tmp)) {
-		pb = list_entry(tmp.next, xfs_buf_t, pb_list);
-
-		list_del_init(&pb->pb_list);
-		xfs_iowait(pb);
-		xfs_buf_relse(pb);
-	}
-
-	if (wait)
-		blk_run_address_space(target->pbr_mapping);
-
-	return pincount;
-}
-
-STATIC int
-pagebuf_daemon_start(void)
-{
-	int		rval;
-
-	pagebuf_logio_workqueue = create_workqueue("xfslogd");
-	if (!pagebuf_logio_workqueue)
-		return -ENOMEM;
-
-	pagebuf_dataio_workqueue = create_workqueue("xfsdatad");
-	if (!pagebuf_dataio_workqueue) {
-		destroy_workqueue(pagebuf_logio_workqueue);
-		return -ENOMEM;
-	}
-
-	rval = kernel_thread(pagebuf_daemon, NULL, CLONE_FS|CLONE_FILES);
-	if (rval < 0) {
-		destroy_workqueue(pagebuf_logio_workqueue);
-		destroy_workqueue(pagebuf_dataio_workqueue);
-	}
-
-	return rval;
-}
-
-/*
- * pagebuf_daemon_stop
- *
- * Note: do not mark as __exit, it is called from pagebuf_terminate.
- */
-STATIC void
-pagebuf_daemon_stop(void)
-{
-	pagebuf_daemon_active = 0;
-	barrier();
-	wait_for_completion(&pagebuf_daemon_done);
-
-	destroy_workqueue(pagebuf_logio_workqueue);
-	destroy_workqueue(pagebuf_dataio_workqueue);
-}
-
-/*
- *	Initialization and Termination
- */
-
-int __init
-pagebuf_init(void)
-{
-	int			i;
-
-	pagebuf_cache = kmem_cache_create("xfs_buf_t", sizeof(xfs_buf_t), 0,
-			SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (pagebuf_cache == NULL) {
-		printk("pagebuf: couldn't init pagebuf cache\n");
-		pagebuf_terminate();
-		return -ENOMEM;
-	}
-
-	for (i = 0; i < NHASH; i++) {
-		spin_lock_init(&pbhash[i].pb_hash_lock);
-		INIT_LIST_HEAD(&pbhash[i].pb_hash);
-	}
-
-#ifdef PAGEBUF_TRACE
-	pagebuf_trace_buf = ktrace_alloc(PAGEBUF_TRACE_SIZE, KM_SLEEP);
-#endif
-
-	pagebuf_daemon_start();
-	return 0;
-}
-
-
-/*
- *	pagebuf_terminate.
- *
- *	Note: do not mark as __exit, this is also called from the __init code.
- */
-void
-pagebuf_terminate(void)
-{
-	pagebuf_daemon_stop();
-
-#ifdef PAGEBUF_TRACE
-	ktrace_free(pagebuf_trace_buf);
-#endif
-
-	kmem_cache_destroy(pagebuf_cache);
-}
diff -Nru a/fs/xfs/linux/xfs_buf.h b/fs/xfs/linux/xfs_buf.h
--- a/fs/xfs/linux/xfs_buf.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,594 +0,0 @@
-/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-/*
- * Written by Steve Lord, Jim Mostek, Russell Cattelan at SGI
- */
-
-#ifndef __XFS_BUF_H__
-#define __XFS_BUF_H__
-
-#include <linux/config.h>
-#include <linux/list.h>
-#include <linux/types.h>
-#include <linux/spinlock.h>
-#include <asm/system.h>
-#include <linux/mm.h>
-#include <linux/fs.h>
-#include <linux/buffer_head.h>
-#include <linux/uio.h>
-
-/*
- *	Base types
- */
-
-#define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL))
-
-#define page_buf_ctob(pp)	((pp) * PAGE_CACHE_SIZE)
-#define page_buf_btoc(dd)	(((dd) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)
-#define page_buf_btoct(dd)	((dd) >> PAGE_CACHE_SHIFT)
-#define page_buf_poff(aa)	((aa) & ~PAGE_CACHE_MASK)
-
-typedef enum page_buf_rw_e {
-	PBRW_READ = 1,			/* transfer into target memory */
-	PBRW_WRITE = 2,			/* transfer from target memory */
-	PBRW_ZERO = 3			/* Zero target memory */
-} page_buf_rw_t;
-
-
-typedef enum page_buf_flags_e {		/* pb_flags values */
-	PBF_READ = (1 << 0),	/* buffer intended for reading from device */
-	PBF_WRITE = (1 << 1),	/* buffer intended for writing to device   */
-	PBF_MAPPED = (1 << 2),  /* buffer mapped (pb_addr valid)           */
-	PBF_PARTIAL = (1 << 3), /* buffer partially read                   */
-	PBF_ASYNC = (1 << 4),   /* initiator will not wait for completion  */
-	PBF_NONE = (1 << 5),    /* buffer not read at all                  */
-	PBF_DELWRI = (1 << 6),  /* buffer has dirty pages                  */
-	PBF_STALE = (1 << 7),	/* buffer has been staled, do not find it  */
-	PBF_FS_MANAGED = (1 << 8),  /* filesystem controls freeing memory  */
-	PBF_FS_DATAIOD = (1 << 9),  /* schedule IO completion on fs datad  */
-	PBF_FORCEIO = (1 << 10),    /* ignore any cache state		   */
-	PBF_FLUSH = (1 << 11),	    /* flush disk write cache		   */
-	PBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead		   */
-
-	/* flags used only as arguments to access routines */
-	PBF_LOCK = (1 << 14),       /* lock requested			   */
-	PBF_TRYLOCK = (1 << 15),    /* lock requested, but do not wait	   */
-	PBF_DONT_BLOCK = (1 << 16), /* do not block in current thread	   */
-
-	/* flags used only internally */
-	_PBF_PAGE_CACHE = (1 << 17),/* backed by pagecache		   */
-	_PBF_KMEM_ALLOC = (1 << 18),/* backed by kmem_alloc()		   */
-	_PBF_RUN_QUEUES = (1 << 19),/* run block device task queue	   */
-} page_buf_flags_t;
-
-#define PBF_UPDATE (PBF_READ | PBF_WRITE)
-#define PBF_NOT_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) != 0)
-#define PBF_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) == 0)
-
-typedef struct xfs_buftarg {
-	dev_t			pbr_dev;
-	struct block_device	*pbr_bdev;
-	struct address_space	*pbr_mapping;
-	unsigned int		pbr_bsize;
-	unsigned int		pbr_sshift;
-	size_t			pbr_smask;
-} xfs_buftarg_t;
-
-/*
- *	xfs_buf_t:  Buffer structure for page cache-based buffers
- *
- * This buffer structure is used by the page cache buffer management routines
- * to refer to an assembly of pages forming a logical buffer.  The actual
- * I/O is performed with buffer_head or bio structures, as required by drivers,
- * for drivers which do not understand this structure.  The buffer structure is
- * used on temporary basis only, and discarded when released.
- *
- * The real data storage is recorded in the page cache.  Metadata is
- * hashed to the inode for the block device on which the file system resides.
- * File data is hashed to the inode for the file.  Pages which are only
- * partially filled with data have bits set in their block_map entry
- * to indicate which disk blocks in the page are not valid.
- */
-
-struct xfs_buf;
-typedef void (*page_buf_iodone_t)(struct xfs_buf *);
-			/* call-back function on I/O completion */
-typedef void (*page_buf_relse_t)(struct xfs_buf *);
-			/* call-back function on I/O completion */
-typedef int (*page_buf_bdstrat_t)(struct xfs_buf *);
-
-#define PB_PAGES	4
-
-typedef struct xfs_buf {
-	struct semaphore	pb_sema;	/* semaphore for lockables  */
-	unsigned long		pb_queuetime;	/* time buffer was queued   */
-	atomic_t		pb_pin_count;	/* pin count		    */
-	wait_queue_head_t	pb_waiters;	/* unpin waiters	    */
-	struct list_head	pb_list;
-	page_buf_flags_t	pb_flags;	/* status flags */
-	struct list_head	pb_hash_list;
-	xfs_buftarg_t		*pb_target;	/* logical object */
-	atomic_t		pb_hold;	/* reference count */
-	xfs_daddr_t		pb_bn;		/* block number for I/O */
-	loff_t			pb_file_offset;	/* offset in file */
-	size_t			pb_buffer_length; /* size of buffer in bytes */
-	size_t			pb_count_desired; /* desired transfer size */
-	void			*pb_addr;	/* virtual address of buffer */
-	struct work_struct	pb_iodone_work;
-	atomic_t		pb_io_remaining;/* #outstanding I/O requests */
-	page_buf_iodone_t	pb_iodone;	/* I/O completion function */
-	page_buf_relse_t	pb_relse;	/* releasing function */
-	page_buf_bdstrat_t	pb_strat;	/* pre-write function */
-	struct semaphore	pb_iodonesema;	/* Semaphore for I/O waiters */
-	void			*pb_fspriv;
-	void			*pb_fspriv2;
-	void			*pb_fspriv3;
-	unsigned short		pb_error;	/* error code on I/O */
-	unsigned short		pb_page_count;	/* size of page array */
-	unsigned short		pb_offset;	/* page offset in first page */
-	unsigned char		pb_locked;	/* page array is locked */
-	unsigned char		pb_hash_index;	/* hash table index	*/
-	struct page		**pb_pages;	/* array of page pointers */
-	struct page		*pb_page_array[PB_PAGES]; /* inline pages */
-#ifdef PAGEBUF_LOCK_TRACKING
-	int			pb_last_holder;
-#endif
-} xfs_buf_t;
-
-
-/* Finding and Reading Buffers */
-
-extern xfs_buf_t *pagebuf_find(	/* find buffer for block if	*/
-					/* the block is in memory	*/
-		xfs_buftarg_t *,	/* inode for block		*/
-		loff_t,			/* starting offset of range	*/
-		size_t,			/* length of range		*/
-		page_buf_flags_t);	/* PBF_LOCK			*/
-
-extern xfs_buf_t *pagebuf_get(		/* allocate a buffer		*/
-		xfs_buftarg_t *,	/* inode for buffer		*/
-		loff_t,			/* starting offset of range     */
-		size_t,			/* length of range              */
-		page_buf_flags_t);	/* PBF_LOCK, PBF_READ,		*/
-					/* PBF_ASYNC			*/
-
-extern xfs_buf_t *pagebuf_lookup(
-		xfs_buftarg_t *,
-		loff_t,			/* starting offset of range	*/
-		size_t,			/* length of range		*/
-		page_buf_flags_t);	/* PBF_READ, PBF_WRITE,		*/
-					/* PBF_FORCEIO, 		*/
-
-extern xfs_buf_t *pagebuf_get_empty(	/* allocate pagebuf struct with	*/
-					/*  no memory or disk address	*/
-		size_t len,
-		xfs_buftarg_t *);	/* mount point "fake" inode	*/
-
-extern xfs_buf_t *pagebuf_get_no_daddr(/* allocate pagebuf struct	*/
-					/* without disk address		*/
-		size_t len,
-		xfs_buftarg_t *);	/* mount point "fake" inode	*/
-
-extern int pagebuf_associate_memory(
-		xfs_buf_t *,
-		void *,
-		size_t);
-
-extern void pagebuf_hold(		/* increment reference count	*/
-		xfs_buf_t *);		/* buffer to hold		*/
-
-extern void pagebuf_readahead(		/* read ahead into cache	*/
-		xfs_buftarg_t  *,	/* target for buffer (or NULL)	*/
-		loff_t,			/* starting offset of range     */
-		size_t,			/* length of range              */
-		page_buf_flags_t);	/* additional read flags	*/
-
-/* Releasing Buffers */
-
-extern void pagebuf_free(		/* deallocate a buffer		*/
-		xfs_buf_t *);		/* buffer to deallocate		*/
-
-extern void pagebuf_rele(		/* release hold on a buffer	*/
-		xfs_buf_t *);		/* buffer to release		*/
-
-/* Locking and Unlocking Buffers */
-
-extern int pagebuf_cond_lock(		/* lock buffer, if not locked	*/
-					/* (returns -EBUSY if locked)	*/
-		xfs_buf_t *);		/* buffer to lock		*/
-
-extern int pagebuf_lock_value(		/* return count on lock		*/
-		xfs_buf_t *);          /* buffer to check              */
-
-extern int pagebuf_lock(		/* lock buffer                  */
-		xfs_buf_t *);          /* buffer to lock               */
-
-extern void pagebuf_unlock(		/* unlock buffer		*/
-		xfs_buf_t *);		/* buffer to unlock		*/
-
-/* Buffer Read and Write Routines */
-
-extern void pagebuf_iodone(		/* mark buffer I/O complete	*/
-		xfs_buf_t *,		/* buffer to mark		*/
-		int,			/* use data/log helper thread.	*/
-		int);			/* run completion locally, or in
-					 * a helper thread.		*/
-
-extern void pagebuf_ioerror(		/* mark buffer in error	(or not) */
-		xfs_buf_t *,		/* buffer to mark		*/
-		int);			/* error to store (0 if none)	*/
-
-extern int pagebuf_iostart(		/* start I/O on a buffer	*/
-		xfs_buf_t *,		/* buffer to start		*/
-		page_buf_flags_t);	/* PBF_LOCK, PBF_ASYNC,		*/
-					/* PBF_READ, PBF_WRITE,		*/
-					/* PBF_DELWRI			*/
-
-extern int pagebuf_iorequest(		/* start real I/O		*/
-		xfs_buf_t *);		/* buffer to convey to device	*/
-
-extern int pagebuf_iowait(		/* wait for buffer I/O done	*/
-		xfs_buf_t *);		/* buffer to wait on		*/
-
-extern void pagebuf_iomove(		/* move data in/out of pagebuf	*/
-		xfs_buf_t *,		/* buffer to manipulate		*/
-		size_t,			/* starting buffer offset	*/
-		size_t,			/* length in buffer		*/
-		caddr_t,		/* data pointer			*/
-		page_buf_rw_t);		/* direction			*/
-
-static inline int pagebuf_iostrategy(xfs_buf_t *pb)
-{
-	return pb->pb_strat ? pb->pb_strat(pb) : pagebuf_iorequest(pb);
-}
-
-static inline int pagebuf_geterror(xfs_buf_t *pb)
-{
-	return pb ? pb->pb_error : ENOMEM;
-}
-
-/* Buffer Utility Routines */
-
-extern caddr_t pagebuf_offset(		/* pointer at offset in buffer	*/
-		xfs_buf_t *,		/* buffer to offset into	*/
-		size_t);		/* offset			*/
-
-/* Pinning Buffer Storage in Memory */
-
-extern void pagebuf_pin(		/* pin buffer in memory		*/
-		xfs_buf_t *);		/* buffer to pin		*/
-
-extern void pagebuf_unpin(		/* unpin buffered data		*/
-		xfs_buf_t *);		/* buffer to unpin		*/
-
-extern int pagebuf_ispin(		/* check if buffer is pinned	*/
-		xfs_buf_t *);		/* buffer to check		*/
-
-/* Delayed Write Buffer Routines */
-
-extern void pagebuf_delwri_dequeue(xfs_buf_t *);
-
-/* Buffer Daemon Setup Routines */
-
-extern int pagebuf_init(void);
-extern void pagebuf_terminate(void);
-
-
-#ifdef PAGEBUF_TRACE
-extern ktrace_t *pagebuf_trace_buf;
-extern void pagebuf_trace(
-		xfs_buf_t *,		/* buffer being traced		*/
-		char *,			/* description of operation	*/
-		void *,			/* arbitrary diagnostic value	*/
-		void *);		/* return address		*/
-#else
-# define pagebuf_trace(pb, id, ptr, ra)	do { } while (0)
-#endif
-
-#define pagebuf_target_name(target)	\
-	({ char __b[BDEVNAME_SIZE]; bdevname((target)->pbr_bdev, __b); __b; })
-
-
-
-
-
-/* These are just for xfs_syncsub... it sets an internal variable
- * then passes it to VOP_FLUSH_PAGES or adds the flags to a newly gotten buf_t
- */
-#define XFS_B_ASYNC		PBF_ASYNC
-#define XFS_B_DELWRI		PBF_DELWRI
-#define XFS_B_READ		PBF_READ
-#define XFS_B_WRITE		PBF_WRITE
-#define XFS_B_STALE		PBF_STALE
-
-#define XFS_BUF_TRYLOCK		PBF_TRYLOCK
-#define XFS_INCORE_TRYLOCK	PBF_TRYLOCK
-#define XFS_BUF_LOCK		PBF_LOCK
-#define XFS_BUF_MAPPED		PBF_MAPPED
-
-#define BUF_BUSY		PBF_DONT_BLOCK
-
-#define XFS_BUF_BFLAGS(x)	((x)->pb_flags)
-#define XFS_BUF_ZEROFLAGS(x)	\
-	((x)->pb_flags &= ~(PBF_READ|PBF_WRITE|PBF_ASYNC|PBF_DELWRI))
-
-#define XFS_BUF_STALE(x)	((x)->pb_flags |= XFS_B_STALE)
-#define XFS_BUF_UNSTALE(x)	((x)->pb_flags &= ~XFS_B_STALE)
-#define XFS_BUF_ISSTALE(x)	((x)->pb_flags & XFS_B_STALE)
-#define XFS_BUF_SUPER_STALE(x)	do {				\
-					XFS_BUF_STALE(x);	\
-					xfs_buf_undelay(x);	\
-					XFS_BUF_DONE(x);	\
-				} while (0)
-
-#define XFS_BUF_MANAGE		PBF_FS_MANAGED
-#define XFS_BUF_UNMANAGE(x)	((x)->pb_flags &= ~PBF_FS_MANAGED)
-
-static inline void xfs_buf_undelay(xfs_buf_t *pb)
-{
-	if (pb->pb_flags & PBF_DELWRI) {
-		if (pb->pb_list.next != &pb->pb_list) {
-			pagebuf_delwri_dequeue(pb);
-			pagebuf_rele(pb);
-		} else {
-			pb->pb_flags &= ~PBF_DELWRI;
-		}
-	}
-}
-
-#define XFS_BUF_DELAYWRITE(x)	 ((x)->pb_flags |= PBF_DELWRI)
-#define XFS_BUF_UNDELAYWRITE(x)	 xfs_buf_undelay(x)
-#define XFS_BUF_ISDELAYWRITE(x)	 ((x)->pb_flags & PBF_DELWRI)
-
-#define XFS_BUF_ERROR(x,no)	 pagebuf_ioerror(x,no)
-#define XFS_BUF_GETERROR(x)	 pagebuf_geterror(x)
-#define XFS_BUF_ISERROR(x)	 (pagebuf_geterror(x)?1:0)
-
-#define XFS_BUF_DONE(x)		 ((x)->pb_flags &= ~(PBF_PARTIAL|PBF_NONE))
-#define XFS_BUF_UNDONE(x)	 ((x)->pb_flags |= PBF_PARTIAL|PBF_NONE)
-#define XFS_BUF_ISDONE(x)	 (!(PBF_NOT_DONE(x)))
-
-#define XFS_BUF_BUSY(x)		 ((x)->pb_flags |= PBF_FORCEIO)
-#define XFS_BUF_UNBUSY(x)	 ((x)->pb_flags &= ~PBF_FORCEIO)
-#define XFS_BUF_ISBUSY(x)	 (1)
-
-#define XFS_BUF_ASYNC(x)	 ((x)->pb_flags |= PBF_ASYNC)
-#define XFS_BUF_UNASYNC(x)	 ((x)->pb_flags &= ~PBF_ASYNC)
-#define XFS_BUF_ISASYNC(x)	 ((x)->pb_flags & PBF_ASYNC)
-
-#define XFS_BUF_FLUSH(x)	 ((x)->pb_flags |= PBF_FLUSH)
-#define XFS_BUF_UNFLUSH(x)	 ((x)->pb_flags &= ~PBF_FLUSH)
-#define XFS_BUF_ISFLUSH(x)	 ((x)->pb_flags & PBF_FLUSH)
-
-#define XFS_BUF_SHUT(x)		 printk("XFS_BUF_SHUT not implemented yet\n")
-#define XFS_BUF_UNSHUT(x)	 printk("XFS_BUF_UNSHUT not implemented yet\n")
-#define XFS_BUF_ISSHUT(x)	 (0)
-
-#define XFS_BUF_HOLD(x)		pagebuf_hold(x)
-#define XFS_BUF_READ(x)		((x)->pb_flags |= PBF_READ)
-#define XFS_BUF_UNREAD(x)	((x)->pb_flags &= ~PBF_READ)
-#define XFS_BUF_ISREAD(x)	((x)->pb_flags & PBF_READ)
-
-#define XFS_BUF_WRITE(x)	((x)->pb_flags |= PBF_WRITE)
-#define XFS_BUF_UNWRITE(x)	((x)->pb_flags &= ~PBF_WRITE)
-#define XFS_BUF_ISWRITE(x)	((x)->pb_flags & PBF_WRITE)
-
-#define XFS_BUF_ISUNINITIAL(x)	 (0)
-#define XFS_BUF_UNUNINITIAL(x)	 (0)
-
-#define XFS_BUF_BP_ISMAPPED(bp)	 1
-
-#define XFS_BUF_DATAIO(x)	((x)->pb_flags |= PBF_FS_DATAIOD)
-#define XFS_BUF_UNDATAIO(x)	((x)->pb_flags &= ~PBF_FS_DATAIOD)
-
-#define XFS_BUF_IODONE_FUNC(buf)	(buf)->pb_iodone
-#define XFS_BUF_SET_IODONE_FUNC(buf, func)	\
-			(buf)->pb_iodone = (func)
-#define XFS_BUF_CLR_IODONE_FUNC(buf)		\
-			(buf)->pb_iodone = NULL
-#define XFS_BUF_SET_BDSTRAT_FUNC(buf, func)	\
-			(buf)->pb_strat = (func)
-#define XFS_BUF_CLR_BDSTRAT_FUNC(buf)		\
-			(buf)->pb_strat = NULL
-
-#define XFS_BUF_FSPRIVATE(buf, type)		\
-			((type)(buf)->pb_fspriv)
-#define XFS_BUF_SET_FSPRIVATE(buf, value)	\
-			(buf)->pb_fspriv = (void *)(value)
-#define XFS_BUF_FSPRIVATE2(buf, type)		\
-			((type)(buf)->pb_fspriv2)
-#define XFS_BUF_SET_FSPRIVATE2(buf, value)	\
-			(buf)->pb_fspriv2 = (void *)(value)
-#define XFS_BUF_FSPRIVATE3(buf, type)		\
-			((type)(buf)->pb_fspriv3)
-#define XFS_BUF_SET_FSPRIVATE3(buf, value)	\
-			(buf)->pb_fspriv3  = (void *)(value)
-#define XFS_BUF_SET_START(buf)
-
-#define XFS_BUF_SET_BRELSE_FUNC(buf, value) \
-			(buf)->pb_relse = (value)
-
-#define XFS_BUF_PTR(bp)		(xfs_caddr_t)((bp)->pb_addr)
-
-extern inline xfs_caddr_t xfs_buf_offset(xfs_buf_t *bp, size_t offset)
-{
-	if (bp->pb_flags & PBF_MAPPED)
-		return XFS_BUF_PTR(bp) + offset;
-	return (xfs_caddr_t) pagebuf_offset(bp, offset);
-}
-
-#define XFS_BUF_SET_PTR(bp, val, count)		\
-				pagebuf_associate_memory(bp, val, count)
-#define XFS_BUF_ADDR(bp)	((bp)->pb_bn)
-#define XFS_BUF_SET_ADDR(bp, blk)		\
-			((bp)->pb_bn = (blk))
-#define XFS_BUF_OFFSET(bp)	((bp)->pb_file_offset)
-#define XFS_BUF_SET_OFFSET(bp, off)		\
-			((bp)->pb_file_offset = (off))
-#define XFS_BUF_COUNT(bp)	((bp)->pb_count_desired)
-#define XFS_BUF_SET_COUNT(bp, cnt)		\
-			((bp)->pb_count_desired = (cnt))
-#define XFS_BUF_SIZE(bp)	((bp)->pb_buffer_length)
-#define XFS_BUF_SET_SIZE(bp, cnt)		\
-			((bp)->pb_buffer_length = (cnt))
-#define XFS_BUF_SET_VTYPE_REF(bp, type, ref)
-#define XFS_BUF_SET_VTYPE(bp, type)
-#define XFS_BUF_SET_REF(bp, ref)
-
-#define XFS_BUF_ISPINNED(bp)	pagebuf_ispin(bp)
-
-#define XFS_BUF_VALUSEMA(bp)	pagebuf_lock_value(bp)
-#define XFS_BUF_CPSEMA(bp)	(pagebuf_cond_lock(bp) == 0)
-#define XFS_BUF_VSEMA(bp)	pagebuf_unlock(bp)
-#define XFS_BUF_PSEMA(bp,x)	pagebuf_lock(bp)
-#define XFS_BUF_V_IODONESEMA(bp) up(&bp->pb_iodonesema);
-
-/* setup the buffer target from a buftarg structure */
-#define XFS_BUF_SET_TARGET(bp, target)	\
-		(bp)->pb_target = (target)
-#define XFS_BUF_TARGET(bp)	((bp)->pb_target)
-#define XFS_BUFTARG_NAME(target)	\
-		pagebuf_target_name(target)
-
-#define XFS_BUF_SET_VTYPE_REF(bp, type, ref)
-#define XFS_BUF_SET_VTYPE(bp, type)
-#define XFS_BUF_SET_REF(bp, ref)
-
-#define xfs_buf_read(target, blkno, len, flags) \
-		pagebuf_get((target), (blkno), (len), \
-			PBF_LOCK | PBF_READ | PBF_MAPPED)
-#define xfs_buf_get(target, blkno, len, flags) \
-		pagebuf_get((target), (blkno), (len), \
-			PBF_LOCK | PBF_MAPPED)
-
-#define xfs_buf_read_flags(target, blkno, len, flags) \
-		pagebuf_get((target), (blkno), (len), PBF_READ | (flags))
-#define xfs_buf_get_flags(target, blkno, len, flags) \
-		pagebuf_get((target), (blkno), (len), (flags))
-
-static inline int	xfs_bawrite(void *mp, xfs_buf_t *bp)
-{
-	bp->pb_fspriv3 = mp;
-	bp->pb_strat = xfs_bdstrat_cb;
-	xfs_buf_undelay(bp);
-	return pagebuf_iostart(bp, PBF_WRITE | PBF_ASYNC | _PBF_RUN_QUEUES);
-}
-
-static inline void	xfs_buf_relse(xfs_buf_t *bp)
-{
-	if (!bp->pb_relse)
-		pagebuf_unlock(bp);
-	pagebuf_rele(bp);
-}
-
-#define xfs_bpin(bp)		pagebuf_pin(bp)
-#define xfs_bunpin(bp)		pagebuf_unpin(bp)
-
-#define xfs_buftrace(id, bp)	\
-	    pagebuf_trace(bp, id, NULL, (void *)__builtin_return_address(0))
-
-#define xfs_biodone(pb)		    \
-	    pagebuf_iodone(pb, (pb->pb_flags & PBF_FS_DATAIOD), 0)
-
-#define xfs_incore(buftarg,blkno,len,lockit) \
-	    pagebuf_find(buftarg, blkno ,len, lockit)
-
-
-#define xfs_biomove(pb, off, len, data, rw) \
-	    pagebuf_iomove((pb), (off), (len), (data), \
-		((rw) == XFS_B_WRITE) ? PBRW_WRITE : PBRW_READ)
-
-#define xfs_biozero(pb, off, len) \
-	    pagebuf_iomove((pb), (off), (len), NULL, PBRW_ZERO)
-
-
-static inline int	XFS_bwrite(xfs_buf_t *pb)
-{
-	int	iowait = (pb->pb_flags & PBF_ASYNC) == 0;
-	int	error = 0;
-
-	if (!iowait)
-		pb->pb_flags |= _PBF_RUN_QUEUES;
-
-	xfs_buf_undelay(pb);
-	pagebuf_iostrategy(pb);
-	if (iowait) {
-		error = pagebuf_iowait(pb);
-		xfs_buf_relse(pb);
-	}
-	return error;
-}
-
-#define XFS_bdwrite(pb)		     \
-	    pagebuf_iostart(pb, PBF_DELWRI | PBF_ASYNC)
-
-static inline int xfs_bdwrite(void *mp, xfs_buf_t *bp)
-{
-	bp->pb_strat = xfs_bdstrat_cb;
-	bp->pb_fspriv3 = mp;
-
-	return pagebuf_iostart(bp, PBF_DELWRI | PBF_ASYNC);
-}
-
-#define XFS_bdstrat(bp) pagebuf_iorequest(bp)
-
-#define xfs_iowait(pb)	pagebuf_iowait(pb)
-
-#define xfs_baread(target, rablkno, ralen)  \
-	pagebuf_readahead((target), (rablkno), (ralen), PBF_DONT_BLOCK)
-
-#define xfs_buf_get_empty(len, target)	pagebuf_get_empty((len), (target))
-#define xfs_buf_get_noaddr(len, target)	pagebuf_get_no_daddr((len), (target))
-#define xfs_buf_free(bp)		pagebuf_free(bp)
-
-
-/*
- *	Handling of buftargs.
- */
-
-extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *);
-extern void xfs_free_buftarg(xfs_buftarg_t *, int);
-extern void xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int);
-extern void xfs_incore_relse(xfs_buftarg_t *, int, int);
-extern int xfs_flush_buftarg(xfs_buftarg_t *, int);
-
-#define xfs_getsize_buftarg(buftarg) \
-	block_size((buftarg)->pbr_bdev)
-#define xfs_readonly_buftarg(buftarg) \
-	bdev_read_only((buftarg)->pbr_bdev)
-#define xfs_binval(buftarg) \
-	xfs_flush_buftarg(buftarg, 1)
-#define XFS_bflush(buftarg) \
-	xfs_flush_buftarg(buftarg, 1)
-
-#endif	/* __XFS_BUF_H__ */
diff -Nru a/fs/xfs/linux/xfs_cred.h b/fs/xfs/linux/xfs_cred.h
--- a/fs/xfs/linux/xfs_cred.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_CRED_H__
-#define __XFS_CRED_H__
-
-/*
- * Credentials
- */
-typedef struct cred {
-	/* EMPTY */
-} cred_t;
-
-extern struct cred *sys_cred;
-
-/* this is a hack.. (assums sys_cred is the only cred_t in the system) */
-static __inline int capable_cred(cred_t *cr, int cid)
-{
-	return (cr == sys_cred) ? 1 : capable(cid);
-}
-
-#endif  /* __XFS_CRED_H__ */
diff -Nru a/fs/xfs/linux/xfs_file.c b/fs/xfs/linux/xfs_file.c
--- a/fs/xfs/linux/xfs_file.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,546 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-#include "xfs_inum.h"
-#include "xfs_log.h"
-#include "xfs_sb.h"
-#include "xfs_dir.h"
-#include "xfs_dir2.h"
-#include "xfs_trans.h"
-#include "xfs_dmapi.h"
-#include "xfs_mount.h"
-#include "xfs_bmap_btree.h"
-#include "xfs_alloc_btree.h"
-#include "xfs_ialloc_btree.h"
-#include "xfs_alloc.h"
-#include "xfs_btree.h"
-#include "xfs_attr_sf.h"
-#include "xfs_dir_sf.h"
-#include "xfs_dir2_sf.h"
-#include "xfs_dinode.h"
-#include "xfs_inode.h"
-#include "xfs_error.h"
-#include "xfs_rw.h"
-
-#include <linux/dcache.h>
-
-static struct vm_operations_struct linvfs_file_vm_ops;
-
-
-STATIC inline ssize_t
-__linvfs_read(
-	struct kiocb		*iocb,
-	char __user		*buf,
-	int			ioflags,
-	size_t			count,
-	loff_t			pos)
-{
-	struct iovec		iov = {buf, count};
-	struct file		*file = iocb->ki_filp;
-	vnode_t			*vp = LINVFS_GET_VP(file->f_dentry->d_inode);
-	ssize_t			rval;
-
-	BUG_ON(iocb->ki_pos != pos);
-
-	if (unlikely(file->f_flags & O_DIRECT))
-		ioflags |= IO_ISDIRECT;
-	VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
-	return rval;
-}
-
-
-STATIC ssize_t
-linvfs_read(
-	struct kiocb		*iocb,
-	char __user		*buf,
-	size_t			count,
-	loff_t			pos)
-{
-	return __linvfs_read(iocb, buf, 0, count, pos);
-}
-
-STATIC ssize_t
-linvfs_read_invis(
-	struct kiocb		*iocb,
-	char __user		*buf,
-	size_t			count,
-	loff_t			pos)
-{
-	return __linvfs_read(iocb, buf, IO_INVIS, count, pos);
-}
-
-
-STATIC inline ssize_t
-__linvfs_write(
-	struct kiocb	*iocb,
-	const char 	*buf,
-	int		ioflags,
-	size_t		count,
-	loff_t		pos)
-{
-	struct iovec	iov = {(void *)buf, count};
-	struct file	*file = iocb->ki_filp;
-	struct inode	*inode = file->f_mapping->host;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	ssize_t		rval;
-
-	BUG_ON(iocb->ki_pos != pos);
-	if (unlikely(file->f_flags & O_DIRECT)) {
-		ioflags |= IO_ISDIRECT;
-		VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos,
-				ioflags, NULL, rval);
-	} else {
-		down(&inode->i_sem);
-		VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos,
-				ioflags, NULL, rval);
-		up(&inode->i_sem);
-	}
-
-	return rval;
-}
-
-
-STATIC ssize_t
-linvfs_write(
-	struct kiocb		*iocb,
-	const char __user	*buf,
-	size_t			count,
-	loff_t			pos)
-{
-	return __linvfs_write(iocb, buf, 0, count, pos);
-}
-
-STATIC ssize_t
-linvfs_write_invis(
-	struct kiocb		*iocb,
-	const char __user	*buf,
-	size_t			count,
-	loff_t			pos)
-{
-	return __linvfs_write(iocb, buf, IO_INVIS, count, pos);
-}
-
-
-STATIC inline ssize_t
-__linvfs_readv(
-	struct file		*file,
-	const struct iovec 	*iov,
-	int			ioflags,
-	unsigned long		nr_segs,
-	loff_t			*ppos)
-{
-	struct inode	*inode = file->f_mapping->host;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	struct		kiocb kiocb;
-	ssize_t		rval;
-
-	init_sync_kiocb(&kiocb, file);
-	kiocb.ki_pos = *ppos;
-
-	if (unlikely(file->f_flags & O_DIRECT))
-		ioflags |= IO_ISDIRECT;
-	VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
-	if (rval == -EIOCBQUEUED)
-		rval = wait_on_sync_kiocb(&kiocb);
-
-	*ppos = kiocb.ki_pos;
-	return rval;
-}
-
-STATIC ssize_t
-linvfs_readv(
-	struct file		*file,
-	const struct iovec 	*iov,
-	unsigned long		nr_segs,
-	loff_t			*ppos)
-{
-	return __linvfs_readv(file, iov, 0, nr_segs, ppos);
-}
-
-STATIC ssize_t
-linvfs_readv_invis(
-	struct file		*file,
-	const struct iovec 	*iov,
-	unsigned long		nr_segs,
-	loff_t			*ppos)
-{
-	return __linvfs_readv(file, iov, IO_INVIS, nr_segs, ppos);
-}
-
-
-STATIC inline ssize_t
-__linvfs_writev(
-	struct file		*file,
-	const struct iovec 	*iov,
-	int			ioflags,
-	unsigned long		nr_segs,
-	loff_t			*ppos)
-{
-	struct inode	*inode = file->f_mapping->host;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	struct		kiocb kiocb;
-	ssize_t		rval;
-
-	init_sync_kiocb(&kiocb, file);
-	kiocb.ki_pos = *ppos;
-	if (unlikely(file->f_flags & O_DIRECT)) {
-		ioflags |= IO_ISDIRECT;
-		VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos,
-				ioflags, NULL, rval);
-	} else {
-		down(&inode->i_sem);
-		VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos,
-				ioflags, NULL, rval);
-		up(&inode->i_sem);
-	}
-
-	if (rval == -EIOCBQUEUED)
-		rval = wait_on_sync_kiocb(&kiocb);
-
-	*ppos = kiocb.ki_pos;
-	return rval;
-}
-
-
-STATIC ssize_t
-linvfs_writev(
-	struct file		*file,
-	const struct iovec 	*iov,
-	unsigned long		nr_segs,
-	loff_t			*ppos)
-{
-	return __linvfs_writev(file, iov, 0, nr_segs, ppos);
-}
-
-STATIC ssize_t
-linvfs_writev_invis(
-	struct file		*file,
-	const struct iovec 	*iov,
-	unsigned long		nr_segs,
-	loff_t			*ppos)
-{
-	return __linvfs_writev(file, iov, IO_INVIS, nr_segs, ppos);
-}
-
-STATIC ssize_t
-linvfs_sendfile(
-	struct file		*filp,
-	loff_t			*ppos,
-	size_t			count,
-	read_actor_t		actor,
-	void			*target)
-{
-	vnode_t			*vp = LINVFS_GET_VP(filp->f_dentry->d_inode);
-	int			error;
-
-	VOP_SENDFILE(vp, filp, ppos, 0, count, actor, target, NULL, error);
-	return error;
-}
-
-
-STATIC int
-linvfs_open(
-	struct inode	*inode,
-	struct file	*filp)
-{
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	int		error;
-
-	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
-		return -EFBIG;
-
-	ASSERT(vp);
-	VOP_OPEN(vp, NULL, error);
-	return -error;
-}
-
-
-STATIC int
-linvfs_release(
-	struct inode	*inode,
-	struct file	*filp)
-{
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	int		error = 0;
-
-	if (vp)
-		VOP_RELEASE(vp, error);
-	return -error;
-}
-
-
-STATIC int
-linvfs_fsync(
-	struct file	*filp,
-	struct dentry	*dentry,
-	int		datasync)
-{
-	struct inode	*inode = dentry->d_inode;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	int		error;
-	int		flags = FSYNC_WAIT;
-
-	if (datasync)
-		flags |= FSYNC_DATA;
-
-	ASSERT(vp);
-	VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error);
-	return -error;
-}
-
-/*
- * linvfs_readdir maps to VOP_READDIR().
- * We need to build a uio, cred, ...
- */
-
-#define nextdp(dp)      ((struct xfs_dirent *)((char *)(dp) + (dp)->d_reclen))
-
-STATIC int
-linvfs_readdir(
-	struct file	*filp,
-	void		*dirent,
-	filldir_t	filldir)
-{
-	int		error = 0;
-	vnode_t		*vp;
-	uio_t		uio;
-	iovec_t		iov;
-	int		eof = 0;
-	caddr_t		read_buf;
-	int		namelen, size = 0;
-	size_t		rlen = PAGE_CACHE_SIZE;
-	xfs_off_t	start_offset, curr_offset;
-	xfs_dirent_t	*dbp = NULL;
-
-	vp = LINVFS_GET_VP(filp->f_dentry->d_inode);
-	ASSERT(vp);
-
-	/* Try fairly hard to get memory */
-	do {
-		if ((read_buf = (caddr_t)kmalloc(rlen, GFP_KERNEL)))
-			break;
-		rlen >>= 1;
-	} while (rlen >= 1024);
-
-	if (read_buf == NULL)
-		return -ENOMEM;
-
-	uio.uio_iov = &iov;
-	uio.uio_segflg = UIO_SYSSPACE;
-	curr_offset = filp->f_pos;
-	if (filp->f_pos != 0x7fffffff)
-		uio.uio_offset = filp->f_pos;
-	else
-		uio.uio_offset = 0xffffffff;
-
-	while (!eof) {
-		uio.uio_resid = iov.iov_len = rlen;
-		iov.iov_base = read_buf;
-		uio.uio_iovcnt = 1;
-
-		start_offset = uio.uio_offset;
-
-		VOP_READDIR(vp, &uio, NULL, &eof, error);
-		if ((uio.uio_offset == start_offset) || error) {
-			size = 0;
-			break;
-		}
-
-		size = rlen - uio.uio_resid;
-		dbp = (xfs_dirent_t *)read_buf;
-		while (size > 0) {
-			namelen = strlen(dbp->d_name);
-
-			if (filldir(dirent, dbp->d_name, namelen,
-					(loff_t) curr_offset & 0x7fffffff,
-					(ino_t) dbp->d_ino,
-					DT_UNKNOWN)) {
-				goto done;
-			}
-			size -= dbp->d_reclen;
-			curr_offset = (loff_t)dbp->d_off /* & 0x7fffffff */;
-			dbp = nextdp(dbp);
-		}
-	}
-done:
-	if (!error) {
-		if (size == 0)
-			filp->f_pos = uio.uio_offset & 0x7fffffff;
-		else if (dbp)
-			filp->f_pos = curr_offset;
-	}
-
-	kfree(read_buf);
-	return -error;
-}
-
-
-STATIC int
-linvfs_file_mmap(
-	struct file	*filp,
-	struct vm_area_struct *vma)
-{
-	struct inode	*ip = filp->f_dentry->d_inode;
-	vnode_t		*vp = LINVFS_GET_VP(ip);
-	vattr_t		va = { .va_mask = XFS_AT_UPDATIME };
-	int		error;
-
-	if ((vp->v_type == VREG) && (vp->v_vfsp->vfs_flag & VFS_DMI)) {
-		xfs_mount_t	*mp = XFS_VFSTOM(vp->v_vfsp);
-
-		error = -XFS_SEND_MMAP(mp, vma, 0);
-		if (error)
-			return error;
-	}
-
-	vma->vm_ops = &linvfs_file_vm_ops;
-
-	VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error);
-	return 0;
-}
-
-
-STATIC int
-linvfs_ioctl(
-	struct inode	*inode,
-	struct file	*filp,
-	unsigned int	cmd,
-	unsigned long	arg)
-{
-	int		error;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-
-	ASSERT(vp);
-	VOP_IOCTL(vp, inode, filp, 0, cmd, arg, error);
-	VMODIFY(vp);
-
-	/* NOTE:  some of the ioctl's return positive #'s as a
-	 *	  byte count indicating success, such as
-	 *	  readlink_by_handle.  So we don't "sign flip"
-	 *	  like most other routines.  This means true
-	 *	  errors need to be returned as a negative value.
-	 */
-	return error;
-}
-
-STATIC int
-linvfs_ioctl_invis(
-	struct inode	*inode,
-	struct file	*filp,
-	unsigned int	cmd,
-	unsigned long	arg)
-{
-	int		error;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-
-	ASSERT(vp);
-	VOP_IOCTL(vp, inode, filp, IO_INVIS, cmd, arg, error);
-	VMODIFY(vp);
-
-	/* NOTE:  some of the ioctl's return positive #'s as a
-	 *	  byte count indicating success, such as
-	 *	  readlink_by_handle.  So we don't "sign flip"
-	 *	  like most other routines.  This means true
-	 *	  errors need to be returned as a negative value.
-	 */
-	return error;
-}
-
-#ifdef HAVE_VMOP_MPROTECT
-STATIC int
-linvfs_mprotect(
-	struct vm_area_struct *vma,
-	unsigned int	newflags)
-{
-	vnode_t		*vp = LINVFS_GET_VP(vma->vm_file->f_dentry->d_inode);
-	int		error = 0;
-
-	if ((vp->v_type == VREG) && (vp->v_vfsp->vfs_flag & VFS_DMI)) {
-		if ((vma->vm_flags & VM_MAYSHARE) &&
-		    (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE)) {
-			xfs_mount_t	*mp = XFS_VFSTOM(vp->v_vfsp);
-
-			error = XFS_SEND_MMAP(mp, vma, VM_WRITE);
-		    }
-	}
-	return error;
-}
-#endif /* HAVE_VMOP_MPROTECT */
-
-
-struct file_operations linvfs_file_operations = {
-	.llseek		= generic_file_llseek,
-	.read		= do_sync_read,
-	.write		= do_sync_write,
-	.readv		= linvfs_readv,
-	.writev		= linvfs_writev,
-	.aio_read	= linvfs_read,
-	.aio_write	= linvfs_write,
-	.sendfile	= linvfs_sendfile,
-	.ioctl		= linvfs_ioctl,
-	.mmap		= linvfs_file_mmap,
-	.open		= linvfs_open,
-	.release	= linvfs_release,
-	.fsync		= linvfs_fsync,
-};
-
-struct file_operations linvfs_invis_file_operations = {
-	.llseek		= generic_file_llseek,
-	.read		= do_sync_read,
-	.write		= do_sync_write,
-	.readv		= linvfs_readv_invis,
-	.writev		= linvfs_writev_invis,
-	.aio_read	= linvfs_read_invis,
-	.aio_write	= linvfs_write_invis,
-	.sendfile	= linvfs_sendfile,
-	.ioctl		= linvfs_ioctl_invis,
-	.mmap		= linvfs_file_mmap,
-	.open		= linvfs_open,
-	.release	= linvfs_release,
-	.fsync		= linvfs_fsync,
-};
-
-
-struct file_operations linvfs_dir_operations = {
-	.read		= generic_read_dir,
-	.readdir	= linvfs_readdir,
-	.ioctl		= linvfs_ioctl,
-	.fsync		= linvfs_fsync,
-};
-
-static struct vm_operations_struct linvfs_file_vm_ops = {
-	.nopage		= filemap_nopage,
-#ifdef HAVE_VMOP_MPROTECT
-	.mprotect	= linvfs_mprotect,
-#endif
-};
diff -Nru a/fs/xfs/linux/xfs_fs_subr.c b/fs/xfs/linux/xfs_fs_subr.c
--- a/fs/xfs/linux/xfs_fs_subr.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-
-/*
- * Stub for no-op vnode operations that return error status.
- */
-int
-fs_noerr()
-{
-	return 0;
-}
-
-/*
- * Operation unsupported under this file system.
- */
-int
-fs_nosys()
-{
-	return ENOSYS;
-}
-
-/*
- * Stub for inactive, strategy, and read/write lock/unlock.  Does nothing.
- */
-/* ARGSUSED */
-void
-fs_noval()
-{
-}
-
-/*
- * vnode pcache layer for vnode_tosspages.
- * 'last' parameter unused but left in for IRIX compatibility
- */
-void
-fs_tosspages(
-	bhv_desc_t	*bdp,
-	xfs_off_t	first,
-	xfs_off_t	last,
-	int		fiopt)
-{
-	vnode_t		*vp = BHV_TO_VNODE(bdp);
-	struct inode	*ip = LINVFS_GET_IP(vp);
-
-	if (VN_CACHED(vp))
-		truncate_inode_pages(ip->i_mapping, first);
-}
-
-
-/*
- * vnode pcache layer for vnode_flushinval_pages.
- * 'last' parameter unused but left in for IRIX compatibility
- */
-void
-fs_flushinval_pages(
-	bhv_desc_t	*bdp,
-	xfs_off_t	first,
-	xfs_off_t	last,
-	int		fiopt)
-{
-	vnode_t		*vp = BHV_TO_VNODE(bdp);
-	struct inode	*ip = LINVFS_GET_IP(vp);
-
-	if (VN_CACHED(vp)) {
-		filemap_fdatawrite(ip->i_mapping);
-		filemap_fdatawait(ip->i_mapping);
-
-		truncate_inode_pages(ip->i_mapping, first);
-	}
-}
-
-/*
- * vnode pcache layer for vnode_flush_pages.
- * 'last' parameter unused but left in for IRIX compatibility
- */
-int
-fs_flush_pages(
-	bhv_desc_t	*bdp,
-	xfs_off_t	first,
-	xfs_off_t	last,
-	uint64_t	flags,
-	int		fiopt)
-{
-	vnode_t		*vp = BHV_TO_VNODE(bdp);
-	struct inode	*ip = LINVFS_GET_IP(vp);
-
-	if (VN_CACHED(vp)) {
-		filemap_fdatawrite(ip->i_mapping);
-		filemap_fdatawait(ip->i_mapping);
-	}
-
-	return 0;
-}
diff -Nru a/fs/xfs/linux/xfs_fs_subr.h b/fs/xfs/linux/xfs_fs_subr.h
--- a/fs/xfs/linux/xfs_fs_subr.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2000, 2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef	__XFS_SUBR_H__
-#define __XFS_SUBR_H__
-
-/*
- * Utilities shared among file system implementations.
- */
-
-struct cred;
-
-extern int	fs_noerr(void);
-extern int	fs_nosys(void);
-extern int	fs_nodev(void);
-extern void	fs_noval(void);
-extern void	fs_tosspages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
-extern void	fs_flushinval_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
-extern int	fs_flush_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, uint64_t, int);
-
-#endif	/* __XFS_FS_SUBR_H__ */
diff -Nru a/fs/xfs/linux/xfs_globals.c b/fs/xfs/linux/xfs_globals.c
--- a/fs/xfs/linux/xfs_globals.c	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-/*
- * This file contains globals needed by XFS that were normally defined
- * somewhere else in IRIX.
- */
-
-#include "xfs.h"
-#include "xfs_cred.h"
-#include "xfs_sysctl.h"
-
-/*
- * System memory size - used to scale certain data structures in XFS.
- */
-unsigned long xfs_physmem;
-
-/*
- * Tunable XFS parameters.  xfs_params is required even when CONFIG_SYSCTL=n,
- * other XFS code uses these values.
- */
-
-xfs_param_t xfs_params = {
-			  /*	MIN		DFLT		MAX	*/
-	.restrict_chown	= {	0,		1,		1	},
-	.sgid_inherit	= {	0,		0,		1	},
-	.symlink_mode	= {	0,		0,		1	},
-	.panic_mask	= {	0,		0,		127	},
-	.error_level	= {	0,		3,		11	},
-	.sync_interval	= {	USER_HZ,	30*USER_HZ,	7200*USER_HZ },
-	.stats_clear	= {	0,		0,		1	},
-	.inherit_sync	= {	0,		1,		1	},
-	.inherit_nodump	= {	0,		1,		1	},
-	.inherit_noatim = {	0,		1,		1	},
-	.flush_interval	= {	USER_HZ/2,	USER_HZ,	30*USER_HZ },
-	.age_buffer	= {	1*USER_HZ,	15*USER_HZ,	7200*USER_HZ },
-};
-
-/*
- * Global system credential structure.
- */
-cred_t sys_cred_val, *sys_cred = &sys_cred_val;
-
diff -Nru a/fs/xfs/linux/xfs_globals.h b/fs/xfs/linux/xfs_globals.h
--- a/fs/xfs/linux/xfs_globals.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_GLOBALS_H__
-#define __XFS_GLOBALS_H__
-
-/*
- * This file declares globals needed by XFS that were normally defined
- * somewhere else in IRIX.
- */
-
-extern uint64_t	xfs_panic_mask;		/* set to cause more panics */
-extern unsigned long xfs_physmem;
-extern struct cred *sys_cred;
-
-#endif	/* __XFS_GLOBALS_H__ */
diff -Nru a/fs/xfs/linux/xfs_ioctl.c b/fs/xfs/linux/xfs_ioctl.c
--- a/fs/xfs/linux/xfs_ioctl.c	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1236 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-
-#include "xfs_fs.h"
-#include "xfs_inum.h"
-#include "xfs_log.h"
-#include "xfs_trans.h"
-#include "xfs_sb.h"
-#include "xfs_dir.h"
-#include "xfs_dir2.h"
-#include "xfs_alloc.h"
-#include "xfs_dmapi.h"
-#include "xfs_mount.h"
-#include "xfs_alloc_btree.h"
-#include "xfs_bmap_btree.h"
-#include "xfs_ialloc_btree.h"
-#include "xfs_btree.h"
-#include "xfs_ialloc.h"
-#include "xfs_attr_sf.h"
-#include "xfs_dir_sf.h"
-#include "xfs_dir2_sf.h"
-#include "xfs_dinode.h"
-#include "xfs_inode.h"
-#include "xfs_bmap.h"
-#include "xfs_bit.h"
-#include "xfs_rtalloc.h"
-#include "xfs_error.h"
-#include "xfs_itable.h"
-#include "xfs_rw.h"
-#include "xfs_acl.h"
-#include "xfs_cap.h"
-#include "xfs_mac.h"
-#include "xfs_attr.h"
-#include "xfs_buf_item.h"
-#include "xfs_utils.h"
-#include "xfs_dfrag.h"
-#include "xfs_fsops.h"
-
-#include <linux/dcache.h>
-#include <linux/mount.h>
-#include <linux/namei.h>
-#include <linux/pagemap.h>
-
-/*
- * ioctl commands that are used by Linux filesystems
- */
-#define XFS_IOC_GETXFLAGS	_IOR('f', 1, long)
-#define XFS_IOC_SETXFLAGS	_IOW('f', 2, long)
-#define XFS_IOC_GETVERSION	_IOR('v', 1, long)
-
-
-/*
- * xfs_find_handle maps from userspace xfs_fsop_handlereq structure to
- * a file or fs handle.
- *
- * XFS_IOC_PATH_TO_FSHANDLE
- *    returns fs handle for a mount point or path within that mount point
- * XFS_IOC_FD_TO_HANDLE
- *    returns full handle for a FD opened in user space
- * XFS_IOC_PATH_TO_HANDLE
- *    returns full handle for a path
- */
-STATIC int
-xfs_find_handle(
-	unsigned int		cmd,
-	unsigned long		arg)
-{
-	int			hsize;
-	xfs_handle_t		handle;
-	xfs_fsop_handlereq_t	hreq;
-	struct inode		*inode;
-	struct vnode		*vp;
-
-	if (copy_from_user(&hreq, (xfs_fsop_handlereq_t *)arg, sizeof(hreq)))
-		return -XFS_ERROR(EFAULT);
-
-	memset((char *)&handle, 0, sizeof(handle));
-
-	switch (cmd) {
-	case XFS_IOC_PATH_TO_FSHANDLE:
-	case XFS_IOC_PATH_TO_HANDLE: {
-		struct nameidata	nd;
-		int			error;
-
-		error = user_path_walk_link(hreq.path, &nd);
-		if (error)
-			return error;
-
-		ASSERT(nd.dentry);
-		ASSERT(nd.dentry->d_inode);
-		inode = igrab(nd.dentry->d_inode);
-		path_release(&nd);
-		break;
-	}
-
-	case XFS_IOC_FD_TO_HANDLE: {
-		struct file	*file;
-
-		file = fget(hreq.fd);
-		if (!file)
-		    return -EBADF;
-
-		ASSERT(file->f_dentry);
-		ASSERT(file->f_dentry->d_inode);
-		inode = igrab(file->f_dentry->d_inode);
-		fput(file);
-		break;
-	}
-
-	default:
-		ASSERT(0);
-		return -XFS_ERROR(EINVAL);
-	}
-
-	if (inode->i_sb->s_magic != XFS_SB_MAGIC) {
-		/* we're not in XFS anymore, Toto */
-		iput(inode);
-		return -XFS_ERROR(EINVAL);
-	}
-
-	/* we need the vnode */
-	vp = LINVFS_GET_VP(inode);
-	if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) {
-		iput(inode);
-		return -XFS_ERROR(EBADF);
-	}
-
-	/* now we can grab the fsid */
-	memcpy(&handle.ha_fsid, vp->v_vfsp->vfs_altfsid, sizeof(xfs_fsid_t));
-	hsize = sizeof(xfs_fsid_t);
-
-	if (cmd != XFS_IOC_PATH_TO_FSHANDLE) {
-		xfs_inode_t	*ip;
-		bhv_desc_t	*bhv;
-		int		lock_mode;
-
-		/* need to get access to the xfs_inode to read the generation */
-		bhv = vn_bhv_lookup_unlocked(VN_BHV_HEAD(vp), &xfs_vnodeops);
-		ASSERT(bhv);
-		ip = XFS_BHVTOI(bhv);
-		ASSERT(ip);
-		lock_mode = xfs_ilock_map_shared(ip);
-
-		/* fill in fid section of handle from inode */
-		handle.ha_fid.xfs_fid_len = sizeof(xfs_fid_t) -
-					    sizeof(handle.ha_fid.xfs_fid_len);
-		handle.ha_fid.xfs_fid_pad = 0;
-		handle.ha_fid.xfs_fid_gen = ip->i_d.di_gen;
-		handle.ha_fid.xfs_fid_ino = ip->i_ino;
-
-		xfs_iunlock_map_shared(ip, lock_mode);
-
-		hsize = XFS_HSIZE(handle);
-	}
-
-	/* now copy our handle into the user buffer & write out the size */
-	if (copy_to_user((xfs_handle_t *)hreq.ohandle, &handle, hsize) ||
-	    copy_to_user(hreq.ohandlen, &hsize, sizeof(__s32))) {
-		iput(inode);
-		return -XFS_ERROR(EFAULT);
-	}
-
-	iput(inode);
-	return 0;
-}
-
-
-/*
- * Convert userspace handle data into vnode (and inode).
- * We [ab]use the fact that all the fsop_handlereq ioctl calls
- * have a data structure argument whose first component is always
- * a xfs_fsop_handlereq_t, so we can cast to and from this type.
- * This allows us to optimise the copy_from_user calls and gives
- * a handy, shared routine.
- *
- * If no error, caller must always VN_RELE the returned vp.
- */
-STATIC int
-xfs_vget_fsop_handlereq(
-	xfs_mount_t		*mp,
-	struct inode		*parinode,	/* parent inode pointer    */
-	int			cap,		/* capability level for op */
-	unsigned long		arg,		/* userspace data pointer  */
-	unsigned long		size,		/* size of expected struct */
-	/* output arguments */
-	xfs_fsop_handlereq_t	*hreq,
-	vnode_t			**vp,
-	struct inode		**inode)
-{
-	void			*hanp;
-	size_t			hlen;
-	xfs_fid_t		*xfid;
-	xfs_handle_t		*handlep;
-	xfs_handle_t		handle;
-	xfs_inode_t		*ip;
-	struct inode		*inodep;
-	vnode_t			*vpp;
-	xfs_ino_t		ino;
-	__u32			igen;
-	int			error;
-
-	if (!capable(cap))
-		return XFS_ERROR(EPERM);
-
-	/*
-	 * Only allow handle opens under a directory.
-	 */
-	if (!S_ISDIR(parinode->i_mode))
-		return XFS_ERROR(ENOTDIR);
-
-	/*
-	 * Copy the handle down from the user and validate
-	 * that it looks to be in the correct format.
-	 */
-	if (copy_from_user(hreq, (struct xfs_fsop_handlereq *)arg, size))
-		return XFS_ERROR(EFAULT);
-
-	hanp = hreq->ihandle;
-	hlen = hreq->ihandlen;
-	handlep = &handle;
-
-	if (hlen < sizeof(handlep->ha_fsid) || hlen > sizeof(*handlep))
-		return XFS_ERROR(EINVAL);
-	if (copy_from_user(handlep, hanp, hlen))
-		return XFS_ERROR(EFAULT);
-	if (hlen < sizeof(*handlep))
-		memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen);
-	if (hlen > sizeof(handlep->ha_fsid)) {
-		if (handlep->ha_fid.xfs_fid_len !=
-				(hlen - sizeof(handlep->ha_fsid)
-					- sizeof(handlep->ha_fid.xfs_fid_len))
-		    || handlep->ha_fid.xfs_fid_pad)
-			return XFS_ERROR(EINVAL);
-	}
-
-	/*
-	 * Crack the handle, obtain the inode # & generation #
-	 */
-	xfid = (struct xfs_fid *)&handlep->ha_fid;
-	if (xfid->xfs_fid_len == sizeof(*xfid) - sizeof(xfid->xfs_fid_len)) {
-		ino  = xfid->xfs_fid_ino;
-		igen = xfid->xfs_fid_gen;
-	} else {
-		return XFS_ERROR(EINVAL);
-	}
-
-	/*
-	 * Get the XFS inode, building a vnode to go with it.
-	 */
-	error = xfs_iget(mp, NULL, ino, XFS_ILOCK_SHARED, &ip, 0);
-	if (error)
-		return error;
-	if (ip == NULL)
-		return XFS_ERROR(EIO);
-	if (ip->i_d.di_mode == 0 || ip->i_d.di_gen != igen) {
-		xfs_iput_new(ip, XFS_ILOCK_SHARED);
-		return XFS_ERROR(ENOENT);
-	}
-
-	vpp = XFS_ITOV(ip);
-	inodep = LINVFS_GET_IP(vpp);
-	xfs_iunlock(ip, XFS_ILOCK_SHARED);
-
-	*vp = vpp;
-	*inode = inodep;
-	return 0;
-}
-
-STATIC int
-xfs_open_by_handle(
-	xfs_mount_t		*mp,
-	unsigned long		arg,
-	struct file		*parfilp,
-	struct inode		*parinode)
-{
-	int			error;
-	int			new_fd;
-	int			permflag;
-	struct file		*filp;
-	struct inode		*inode;
-	struct dentry		*dentry;
-	vnode_t			*vp;
-	xfs_fsop_handlereq_t	hreq;
-
-	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
-					sizeof(xfs_fsop_handlereq_t),
-					&hreq, &vp, &inode);
-	if (error)
-		return -error;
-
-	/* Restrict xfs_open_by_handle to directories & regular files. */
-	if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) {
-		iput(inode);
-		return -XFS_ERROR(EINVAL);
-	}
-
-#if BITS_PER_LONG != 32
-	hreq.oflags |= O_LARGEFILE;
-#endif
-	/* Put open permission in namei format. */
-	permflag = hreq.oflags;
-	if ((permflag+1) & O_ACCMODE)
-		permflag++;
-	if (permflag & O_TRUNC)
-		permflag |= 2;
-
-	if ((!(permflag & O_APPEND) || (permflag & O_TRUNC)) &&
-	    (permflag & FMODE_WRITE) && IS_APPEND(inode)) {
-		iput(inode);
-		return -XFS_ERROR(EPERM);
-	}
-
-	if ((permflag & FMODE_WRITE) && IS_IMMUTABLE(inode)) {
-		iput(inode);
-		return -XFS_ERROR(EACCES);
-	}
-
-	/* Can't write directories. */
-	if ( S_ISDIR(inode->i_mode) && (permflag & FMODE_WRITE)) {
-		iput(inode);
-		return -XFS_ERROR(EISDIR);
-	}
-
-	if ((new_fd = get_unused_fd()) < 0) {
-		iput(inode);
-		return new_fd;
-	}
-
-	dentry = d_alloc_anon(inode);
-	if (dentry == NULL) {
-		iput(inode);
-		put_unused_fd(new_fd);
-		return -XFS_ERROR(ENOMEM);
-	}
-
-	/* Ensure umount returns EBUSY on umounts while this file is open. */
-	mntget(parfilp->f_vfsmnt);
-
-	/* Create file pointer. */
-	filp = dentry_open(dentry, parfilp->f_vfsmnt, hreq.oflags);
-	if (IS_ERR(filp)) {
-		put_unused_fd(new_fd);
-		return -XFS_ERROR(-PTR_ERR(filp));
-	}
-	if (inode->i_mode & S_IFREG)
-		filp->f_op = &linvfs_invis_file_operations;
-
-	fd_install(new_fd, filp);
-	return new_fd;
-}
-
-STATIC int
-xfs_readlink_by_handle(
-	xfs_mount_t		*mp,
-	unsigned long		arg,
-	struct file		*parfilp,
-	struct inode		*parinode)
-{
-	int			error;
-	struct iovec		aiov;
-	struct uio		auio;
-	struct inode		*inode;
-	xfs_fsop_handlereq_t	hreq;
-	vnode_t			*vp;
-	__u32			olen;
-
-	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
-					sizeof(xfs_fsop_handlereq_t),
-					&hreq, &vp, &inode);
-	if (error)
-		return -error;
-
-	/* Restrict this handle operation to symlinks only. */
-	if (vp->v_type != VLNK) {
-		VN_RELE(vp);
-		return -XFS_ERROR(EINVAL);
-	}
-
-	if (copy_from_user(&olen, hreq.ohandlen, sizeof(__u32))) {
-		VN_RELE(vp);
-		return -XFS_ERROR(EFAULT);
-	}
-	aiov.iov_len	= olen;
-	aiov.iov_base	= hreq.ohandle;
-
-	auio.uio_iov	= &aiov;
-	auio.uio_iovcnt	= 1;
-	auio.uio_offset	= 0;
-	auio.uio_segflg	= UIO_USERSPACE;
-	auio.uio_resid	= olen;
-
-	VOP_READLINK(vp, &auio, IO_INVIS, NULL, error);
-
-	VN_RELE(vp);
-	return (olen - auio.uio_resid);
-}
-
-STATIC int
-xfs_fssetdm_by_handle(
-	xfs_mount_t		*mp,
-	unsigned long		arg,
-	struct file		*parfilp,
-	struct inode		*parinode)
-{
-	int			error;
-	struct fsdmidata	fsd;
-	xfs_fsop_setdm_handlereq_t dmhreq;
-	struct inode		*inode;
-	bhv_desc_t		*bdp;
-	vnode_t			*vp;
-
-	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_MKNOD, arg,
-					sizeof(xfs_fsop_setdm_handlereq_t),
-					(xfs_fsop_handlereq_t *)&dmhreq,
-					&vp, &inode);
-	if (error)
-		return -error;
-
-	if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
-		VN_RELE(vp);
-		return -XFS_ERROR(EPERM);
-	}
-
-	if (copy_from_user(&fsd, dmhreq.data, sizeof(fsd))) {
-		VN_RELE(vp);
-		return -XFS_ERROR(EFAULT);
-	}
-
-	bdp = bhv_base_unlocked(VN_BHV_HEAD(vp));
-	error = xfs_set_dmattrs(bdp, fsd.fsd_dmevmask, fsd.fsd_dmstate, NULL);
-
-	VN_RELE(vp);
-	if (error)
-		return -error;
-	return 0;
-}
-
-STATIC int
-xfs_attrlist_by_handle(
-	xfs_mount_t		*mp,
-	unsigned long		arg,
-	struct file		*parfilp,
-	struct inode		*parinode)
-{
-	int			error;
-	attrlist_cursor_kern_t	*cursor;
-	xfs_fsop_attrlist_handlereq_t al_hreq;
-	struct inode		*inode;
-	vnode_t			*vp;
-
-	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
-					sizeof(xfs_fsop_attrlist_handlereq_t),
-					(xfs_fsop_handlereq_t *)&al_hreq,
-					&vp, &inode);
-	if (error)
-		return -error;
-
-	cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
-	VOP_ATTR_LIST(vp, al_hreq.buffer, al_hreq.buflen, al_hreq.flags,
-			cursor, NULL, error);
-	VN_RELE(vp);
-	if (error)
-		return -error;
-	return 0;
-}
-
-STATIC int
-xfs_attrmulti_by_handle(
-	xfs_mount_t		*mp,
-	unsigned long		arg,
-	struct file		*parfilp,
-	struct inode		*parinode)
-{
-	int			error;
-	xfs_attr_multiop_t	*ops;
-	xfs_fsop_attrmulti_handlereq_t am_hreq;
-	struct inode		*inode;
-	vnode_t			*vp;
-	int			i, size;
-
-	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
-					sizeof(xfs_fsop_attrmulti_handlereq_t),
-					(xfs_fsop_handlereq_t *)&am_hreq,
-					&vp, &inode);
-	if (error)
-		return -error;
-
-	size = am_hreq.opcount * sizeof(attr_multiop_t);
-	ops = (xfs_attr_multiop_t *)kmalloc(size, GFP_KERNEL);
-	if (!ops) {
-		VN_RELE(vp);
-		return -XFS_ERROR(ENOMEM);
-	}
-
-	if (copy_from_user(ops, am_hreq.ops, size)) {
-		kfree(ops);
-		VN_RELE(vp);
-		return -XFS_ERROR(EFAULT);
-	}
-
-	for (i = 0; i < am_hreq.opcount; i++) {
-		switch(ops[i].am_opcode) {
-		case ATTR_OP_GET:
-			VOP_ATTR_GET(vp,ops[i].am_attrname, ops[i].am_attrvalue,
-					&ops[i].am_length, ops[i].am_flags,
-					NULL, ops[i].am_error);
-			break;
-		case ATTR_OP_SET:
-			if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
-				ops[i].am_error = EPERM;
-				break;
-			}
-			VOP_ATTR_SET(vp,ops[i].am_attrname, ops[i].am_attrvalue,
-					ops[i].am_length, ops[i].am_flags,
-					NULL, ops[i].am_error);
-			break;
-		case ATTR_OP_REMOVE:
-			if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
-				ops[i].am_error = EPERM;
-				break;
-			}
-			VOP_ATTR_REMOVE(vp, ops[i].am_attrname, ops[i].am_flags,
-					NULL, ops[i].am_error);
-			break;
-		default:
-			ops[i].am_error = EINVAL;
-		}
-	}
-
-	if (copy_to_user(am_hreq.ops, ops, size))
-		error = -XFS_ERROR(EFAULT);
-
-	kfree(ops);
-	VN_RELE(vp);
-	return error;
-}
-
-/* prototypes for a few of the stack-hungry cases that have
- * their own functions.  Functions are defined after their use
- * so gcc doesn't get fancy and inline them with -03 */
-
-STATIC int
-xfs_ioc_space(
-	bhv_desc_t		*bdp,
-	vnode_t			*vp,
-	struct file		*filp,
-	int			flags,
-	unsigned int		cmd,
-	unsigned long		arg);
-
-STATIC int
-xfs_ioc_bulkstat(
-	xfs_mount_t		*mp,
-	unsigned int		cmd,
-	unsigned long		arg);
-
-STATIC int
-xfs_ioc_fsgeometry_v1(
-	xfs_mount_t		*mp,
-	unsigned long		arg);
-
-STATIC int
-xfs_ioc_fsgeometry(
-	xfs_mount_t		*mp,
-	unsigned long		arg);
-
-STATIC int
-xfs_ioc_xattr(
-	vnode_t			*vp,
-	xfs_inode_t		*ip,
-	struct file		*filp,
-	unsigned int		cmd,
-	unsigned long		arg);
-
-STATIC int
-xfs_ioc_getbmap(
-	bhv_desc_t		*bdp,
-	struct file		*filp,
-	int			flags,
-	unsigned int		cmd,
-	unsigned long		arg);
-
-STATIC int
-xfs_ioc_getbmapx(
-	bhv_desc_t		*bdp,
-	unsigned long		arg);
-
-int
-xfs_ioctl(
-	bhv_desc_t		*bdp,
-	struct inode		*inode,
-	struct file		*filp,
-	int			ioflags,
-	unsigned int		cmd,
-	unsigned long		arg)
-{
-	int			error;
-	vnode_t			*vp;
-	xfs_inode_t		*ip;
-	xfs_mount_t		*mp;
-
-	vp = LINVFS_GET_VP(inode);
-
-	vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address);
-
-	ip = XFS_BHVTOI(bdp);
-	mp = ip->i_mount;
-
-	switch (cmd) {
-
-	case XFS_IOC_ALLOCSP:
-	case XFS_IOC_FREESP:
-	case XFS_IOC_RESVSP:
-	case XFS_IOC_UNRESVSP:
-	case XFS_IOC_ALLOCSP64:
-	case XFS_IOC_FREESP64:
-	case XFS_IOC_RESVSP64:
-	case XFS_IOC_UNRESVSP64:
-		/*
-		 * Only allow the sys admin to reserve space unless
-		 * unwritten extents are enabled.
-		 */
-		if (!XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb) &&
-		    !capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		return xfs_ioc_space(bdp, vp, filp, ioflags, cmd, arg);
-
-	case XFS_IOC_DIOINFO: {
-		struct dioattr	da;
-		xfs_buftarg_t	*target =
-			(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
-			mp->m_rtdev_targp : mp->m_ddev_targp;
-
-		da.d_mem = da.d_miniosz = 1 << target->pbr_sshift;
-		/* The size dio will do in one go */
-		da.d_maxiosz = 64 * PAGE_CACHE_SIZE;
-
-		if (copy_to_user((struct dioattr *)arg, &da, sizeof(da)))
-			return -XFS_ERROR(EFAULT);
-		return 0;
-	}
-
-	case XFS_IOC_FSBULKSTAT_SINGLE:
-	case XFS_IOC_FSBULKSTAT:
-	case XFS_IOC_FSINUMBERS:
-		return xfs_ioc_bulkstat(mp, cmd, arg);
-
-	case XFS_IOC_FSGEOMETRY_V1:
-		return xfs_ioc_fsgeometry_v1(mp, arg);
-
-	case XFS_IOC_FSGEOMETRY:
-		return xfs_ioc_fsgeometry(mp, arg);
-
-	case XFS_IOC_GETVERSION:
-	case XFS_IOC_GETXFLAGS:
-	case XFS_IOC_SETXFLAGS:
-	case XFS_IOC_FSGETXATTR:
-	case XFS_IOC_FSSETXATTR:
-	case XFS_IOC_FSGETXATTRA:
-		return xfs_ioc_xattr(vp, ip, filp, cmd, arg);
-
-	case XFS_IOC_FSSETDM: {
-		struct fsdmidata	dmi;
-
-		if (copy_from_user(&dmi, (struct fsdmidata *)arg, sizeof(dmi)))
-			return -XFS_ERROR(EFAULT);
-
-		error = xfs_set_dmattrs(bdp, dmi.fsd_dmevmask, dmi.fsd_dmstate,
-							NULL);
-		return -error;
-	}
-
-	case XFS_IOC_GETBMAP:
-	case XFS_IOC_GETBMAPA:
-		return xfs_ioc_getbmap(bdp, filp, ioflags, cmd, arg);
-
-	case XFS_IOC_GETBMAPX:
-		return xfs_ioc_getbmapx(bdp, arg);
-
-	case XFS_IOC_FD_TO_HANDLE:
-	case XFS_IOC_PATH_TO_HANDLE:
-	case XFS_IOC_PATH_TO_FSHANDLE:
-		return xfs_find_handle(cmd, arg);
-
-	case XFS_IOC_OPEN_BY_HANDLE:
-		return xfs_open_by_handle(mp, arg, filp, inode);
-
-	case XFS_IOC_FSSETDM_BY_HANDLE:
-		return xfs_fssetdm_by_handle(mp, arg, filp, inode);
-
-	case XFS_IOC_READLINK_BY_HANDLE:
-		return xfs_readlink_by_handle(mp, arg, filp, inode);
-
-	case XFS_IOC_ATTRLIST_BY_HANDLE:
-		return xfs_attrlist_by_handle(mp, arg, filp, inode);
-
-	case XFS_IOC_ATTRMULTI_BY_HANDLE:
-		return xfs_attrmulti_by_handle(mp, arg, filp, inode);
-
-	case XFS_IOC_SWAPEXT: {
-		error = xfs_swapext((struct xfs_swapext *)arg);
-		return -error;
-	}
-
-	case XFS_IOC_FSCOUNTS: {
-		xfs_fsop_counts_t out;
-
-		error = xfs_fs_counts(mp, &out);
-		if (error)
-			return -error;
-
-		if (copy_to_user((char *)arg, &out, sizeof(out)))
-			return -XFS_ERROR(EFAULT);
-		return 0;
-	}
-
-	case XFS_IOC_SET_RESBLKS: {
-		xfs_fsop_resblks_t inout;
-		__uint64_t	   in;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		if (copy_from_user(&inout, (char *)arg, sizeof(inout)))
-			return -XFS_ERROR(EFAULT);
-
-		/* input parameter is passed in resblks field of structure */
-		in = inout.resblks;
-		error = xfs_reserve_blocks(mp, &in, &inout);
-		if (error)
-			return -error;
-
-		if (copy_to_user((char *)arg, &inout, sizeof(inout)))
-			return -XFS_ERROR(EFAULT);
-		return 0;
-	}
-
-	case XFS_IOC_GET_RESBLKS: {
-		xfs_fsop_resblks_t out;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		error = xfs_reserve_blocks(mp, NULL, &out);
-		if (error)
-			return -error;
-
-		if (copy_to_user((char *)arg, &out, sizeof(out)))
-			return -XFS_ERROR(EFAULT);
-
-		return 0;
-	}
-
-	case XFS_IOC_FSGROWFSDATA: {
-		xfs_growfs_data_t in;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		if (copy_from_user(&in, (char *)arg, sizeof(in)))
-			return -XFS_ERROR(EFAULT);
-
-		error = xfs_growfs_data(mp, &in);
-		return -error;
-	}
-
-	case XFS_IOC_FSGROWFSLOG: {
-		xfs_growfs_log_t in;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		if (copy_from_user(&in, (char *)arg, sizeof(in)))
-			return -XFS_ERROR(EFAULT);
-
-		error = xfs_growfs_log(mp, &in);
-		return -error;
-	}
-
-	case XFS_IOC_FSGROWFSRT: {
-		xfs_growfs_rt_t in;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		if (copy_from_user(&in, (char *)arg, sizeof(in)))
-			return -XFS_ERROR(EFAULT);
-
-		error = xfs_growfs_rt(mp, &in);
-		return -error;
-	}
-
-	case XFS_IOC_FREEZE:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		freeze_bdev(inode->i_sb->s_bdev);
-		return 0;
-
-	case XFS_IOC_THAW:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-		thaw_bdev(inode->i_sb->s_bdev, inode->i_sb);
-		return 0;
-
-	case XFS_IOC_GOINGDOWN: {
-		__uint32_t in;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		if (get_user(in, (__uint32_t *)arg))
-			return -XFS_ERROR(EFAULT);
-
-		error = xfs_fs_goingdown(mp, in);
-		return -error;
-	}
-
-	case XFS_IOC_ERROR_INJECTION: {
-		xfs_error_injection_t in;
-
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		if (copy_from_user(&in, (char *)arg, sizeof(in)))
-			return -XFS_ERROR(EFAULT);
-
-		error = xfs_errortag_add(in.errtag, mp);
-		return -error;
-	}
-
-	case XFS_IOC_ERROR_CLEARALL:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-
-		error = xfs_errortag_clearall(mp);
-		return -error;
-
-	default:
-		return -ENOTTY;
-	}
-}
-
-STATIC int
-xfs_ioc_space(
-	bhv_desc_t		*bdp,
-	vnode_t			*vp,
-	struct file		*filp,
-	int			ioflags,
-	unsigned int		cmd,
-	unsigned long		arg)
-{
-	xfs_flock64_t		bf;
-	int			attr_flags = 0;
-	int			error;
-
-	if (vp->v_inode.i_flags & (S_IMMUTABLE|S_APPEND))
-		return -XFS_ERROR(EPERM);
-
-	if (!(filp->f_flags & FMODE_WRITE))
-		return -XFS_ERROR(EBADF);
-
-	if (vp->v_type != VREG)
-		return -XFS_ERROR(EINVAL);
-
-	if (copy_from_user(&bf, (xfs_flock64_t *)arg, sizeof(bf)))
-		return -XFS_ERROR(EFAULT);
-
-	if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
-		attr_flags |= ATTR_NONBLOCK;
-	if (ioflags & IO_INVIS)
-		attr_flags |= ATTR_DMI;
-
-	error = xfs_change_file_space(bdp, cmd, &bf, filp->f_pos,
-					      NULL, attr_flags);
-	return -error;
-}
-
-STATIC int
-xfs_ioc_bulkstat(
-	xfs_mount_t		*mp,
-	unsigned int		cmd,
-	unsigned long		arg)
-{
-	xfs_fsop_bulkreq_t	bulkreq;
-	int			count;	/* # of records returned */
-	xfs_ino_t		inlast;	/* last inode number */
-	int			done;
-	int			error;
-
-	/* done = 1 if there are more stats to get and if bulkstat */
-	/* should be called again (unused here, but used in dmapi) */
-
-	if (!capable(CAP_SYS_ADMIN))
-		return -EPERM;
-
-	if (XFS_FORCED_SHUTDOWN(mp))
-		return -XFS_ERROR(EIO);
-
-	if (copy_from_user(&bulkreq, (xfs_fsop_bulkreq_t *)arg,
-					sizeof(xfs_fsop_bulkreq_t)))
-		return -XFS_ERROR(EFAULT);
-
-	if (copy_from_user(&inlast, (__s64 *)bulkreq.lastip,
-						sizeof(__s64)))
-		return -XFS_ERROR(EFAULT);
-
-	if ((count = bulkreq.icount) <= 0)
-		return -XFS_ERROR(EINVAL);
-
-	if (cmd == XFS_IOC_FSINUMBERS)
-		error = xfs_inumbers(mp, NULL, &inlast, &count,
-						bulkreq.ubuffer);
-	else if (cmd == XFS_IOC_FSBULKSTAT_SINGLE)
-		error = xfs_bulkstat_single(mp, &inlast,
-						bulkreq.ubuffer, &done);
-	else {	/* XFS_IOC_FSBULKSTAT */
-		if (count == 1 && inlast != 0) {
-			inlast++;
-			error = xfs_bulkstat_single(mp, &inlast,
-					bulkreq.ubuffer, &done);
-		} else {
-			error = xfs_bulkstat(mp, NULL, &inlast, &count,
-				(bulkstat_one_pf)xfs_bulkstat_one, NULL,
-				sizeof(xfs_bstat_t), bulkreq.ubuffer,
-				BULKSTAT_FG_QUICK, &done);
-		}
-	}
-
-	if (error)
-		return -error;
-
-	if (bulkreq.ocount != NULL) {
-		if (copy_to_user((xfs_ino_t *)bulkreq.lastip, &inlast,
-						sizeof(xfs_ino_t)))
-			return -XFS_ERROR(EFAULT);
-
-		if (copy_to_user((__s32 *)bulkreq.ocount, &count,
-						sizeof(count)))
-			return -XFS_ERROR(EFAULT);
-	}
-
-	return 0;
-}
-
-STATIC int
-xfs_ioc_fsgeometry_v1(
-	xfs_mount_t		*mp,
-	unsigned long		arg)
-{
-	xfs_fsop_geom_v1_t	fsgeo;
-	int			error;
-
-	error = xfs_fs_geometry(mp, (xfs_fsop_geom_t *)&fsgeo, 3);
-	if (error)
-		return -error;
-
-	if (copy_to_user((xfs_fsop_geom_t *)arg, &fsgeo, sizeof(fsgeo)))
-		return -XFS_ERROR(EFAULT);
-	return 0;
-}
-
-STATIC int
-xfs_ioc_fsgeometry(
-	xfs_mount_t		*mp,
-	unsigned long		arg)
-{
-	xfs_fsop_geom_t		fsgeo;
-	int			error;
-
-	error = xfs_fs_geometry(mp, &fsgeo, 4);
-	if (error)
-		return -error;
-
-	if (copy_to_user((xfs_fsop_geom_t *)arg, &fsgeo, sizeof(fsgeo)))
-		return -XFS_ERROR(EFAULT);
-	return 0;
-}
-
-/*
- * Linux extended inode flags interface.
- */
-#define LINUX_XFLAG_SYNC	0x00000008 /* Synchronous updates */
-#define LINUX_XFLAG_IMMUTABLE	0x00000010 /* Immutable file */
-#define LINUX_XFLAG_APPEND	0x00000020 /* writes to file may only append */
-#define LINUX_XFLAG_NODUMP	0x00000040 /* do not dump file */
-#define LINUX_XFLAG_NOATIME	0x00000080 /* do not update atime */
-
-STATIC unsigned int
-xfs_merge_ioc_xflags(
-	unsigned int	flags,
-	unsigned int	start)
-{
-	unsigned int	xflags = start;
-
-	if (flags & LINUX_XFLAG_IMMUTABLE)
-		xflags |= XFS_XFLAG_IMMUTABLE;
-	else
-		xflags &= ~XFS_XFLAG_IMMUTABLE;
-	if (flags & LINUX_XFLAG_APPEND)
-		xflags |= XFS_XFLAG_APPEND;
-	else
-		xflags &= ~XFS_XFLAG_APPEND;
-	if (flags & LINUX_XFLAG_SYNC)
-		xflags |= XFS_XFLAG_SYNC;
-	else
-		xflags &= ~XFS_XFLAG_SYNC;
-	if (flags & LINUX_XFLAG_NOATIME)
-		xflags |= XFS_XFLAG_NOATIME;
-	else
-		xflags &= ~XFS_XFLAG_NOATIME;
-	if (flags & LINUX_XFLAG_NODUMP)
-		xflags |= XFS_XFLAG_NODUMP;
-	else
-		xflags &= ~XFS_XFLAG_NODUMP;
-
-	return xflags;
-}
-
-STATIC int
-xfs_ioc_xattr(
-	vnode_t			*vp,
-	xfs_inode_t		*ip,
-	struct file		*filp,
-	unsigned int		cmd,
-	unsigned long		arg)
-{
-	struct fsxattr		fa;
-	vattr_t			va;
-	int			error;
-	int			attr_flags;
-	unsigned int		flags;
-
-	switch (cmd) {
-	case XFS_IOC_FSGETXATTR: {
-		va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_NEXTENTS;
-		VOP_GETATTR(vp, &va, 0, NULL, error);
-		if (error)
-			return -error;
-
-		fa.fsx_xflags	= va.va_xflags;
-		fa.fsx_extsize	= va.va_extsize;
-		fa.fsx_nextents = va.va_nextents;
-
-		if (copy_to_user((struct fsxattr *)arg, &fa, sizeof(fa)))
-			return -XFS_ERROR(EFAULT);
-		return 0;
-	}
-
-	case XFS_IOC_FSSETXATTR: {
-		if (copy_from_user(&fa, (struct fsxattr *)arg, sizeof(fa)))
-			return -XFS_ERROR(EFAULT);
-
-		attr_flags = 0;
-		if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
-			attr_flags |= ATTR_NONBLOCK;
-
-		va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE;
-		va.va_xflags  = fa.fsx_xflags;
-		va.va_extsize = fa.fsx_extsize;
-
-		VOP_SETATTR(vp, &va, attr_flags, NULL, error);
-		if (!error)
-			vn_revalidate(vp);	/* update Linux inode flags */
-		return -error;
-	}
-
-	case XFS_IOC_FSGETXATTRA: {
-		va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_ANEXTENTS;
-		VOP_GETATTR(vp, &va, 0, NULL, error);
-		if (error)
-			return -error;
-
-		fa.fsx_xflags	= va.va_xflags;
-		fa.fsx_extsize	= va.va_extsize;
-		fa.fsx_nextents = va.va_anextents;
-
-		if (copy_to_user((struct fsxattr *)arg, &fa, sizeof(fa)))
-			return -XFS_ERROR(EFAULT);
-		return 0;
-	}
-
-	case XFS_IOC_GETXFLAGS: {
-		flags = 0;
-		if (ip->i_d.di_flags & XFS_XFLAG_IMMUTABLE)
-			flags |= LINUX_XFLAG_IMMUTABLE;
-		if (ip->i_d.di_flags & XFS_XFLAG_APPEND)
-			flags |= LINUX_XFLAG_APPEND;
-		if (ip->i_d.di_flags & XFS_XFLAG_SYNC)
-			flags |= LINUX_XFLAG_SYNC;
-		if (ip->i_d.di_flags & XFS_XFLAG_NOATIME)
-			flags |= LINUX_XFLAG_NOATIME;
-		if (ip->i_d.di_flags & XFS_XFLAG_NODUMP)
-			flags |= LINUX_XFLAG_NODUMP;
-		if (copy_to_user((unsigned int *)arg, &flags, sizeof(flags)))
-			return -XFS_ERROR(EFAULT);
-		return 0;
-	}
-
-	case XFS_IOC_SETXFLAGS: {
-		if (copy_from_user(&flags, (unsigned int *)arg, sizeof(flags)))
-			return -XFS_ERROR(EFAULT);
-
-		if (flags & ~(LINUX_XFLAG_IMMUTABLE | LINUX_XFLAG_APPEND | \
-			      LINUX_XFLAG_NOATIME | LINUX_XFLAG_NODUMP | \
-			      LINUX_XFLAG_SYNC))
-			return -XFS_ERROR(EOPNOTSUPP);
-
-		attr_flags = 0;
-		if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
-			attr_flags |= ATTR_NONBLOCK;
-
-		va.va_mask = XFS_AT_XFLAGS;
-		va.va_xflags = xfs_merge_ioc_xflags(flags, ip->i_d.di_flags);
-
-		VOP_SETATTR(vp, &va, attr_flags, NULL, error);
-		if (!error)
-			vn_revalidate(vp);	/* update Linux inode flags */
-		return -error;
-	}
-
-	case XFS_IOC_GETVERSION: {
-		flags = LINVFS_GET_IP(vp)->i_generation;
-		if (copy_to_user((unsigned int *)arg, &flags, sizeof(flags)))
-			return -XFS_ERROR(EFAULT);
-		return 0;
-	}
-
-	default:
-		return -ENOTTY;
-	}
-}
-
-STATIC int
-xfs_ioc_getbmap(
-	bhv_desc_t		*bdp,
-	struct file		*filp,
-	int			ioflags,
-	unsigned int		cmd,
-	unsigned long		arg)
-{
-	struct getbmap		bm;
-	int			iflags;
-	int			error;
-
-	if (copy_from_user(&bm, (struct getbmap *)arg, sizeof(bm)))
-		return -XFS_ERROR(EFAULT);
-
-	if (bm.bmv_count < 2)
-		return -XFS_ERROR(EINVAL);
-
-	iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0);
-	if (ioflags & IO_INVIS)
-		iflags |= BMV_IF_NO_DMAPI_READ;
-
-	error = xfs_getbmap(bdp, &bm, (struct getbmap *)arg+1, iflags);
-	if (error)
-		return -error;
-
-	if (copy_to_user((struct getbmap *)arg, &bm, sizeof(bm)))
-		return -XFS_ERROR(EFAULT);
-	return 0;
-}
-
-STATIC int
-xfs_ioc_getbmapx(
-	bhv_desc_t		*bdp,
-	unsigned long		arg)
-{
-	struct getbmapx		bmx;
-	struct getbmap		bm;
-	int			iflags;
-	int			error;
-
-	if (copy_from_user(&bmx, (struct getbmapx *)arg, sizeof(bmx)))
-		return -XFS_ERROR(EFAULT);
-
-	if (bmx.bmv_count < 2)
-		return -XFS_ERROR(EINVAL);
-
-	/*
-	 * Map input getbmapx structure to a getbmap
-	 * structure for xfs_getbmap.
-	 */
-	GETBMAP_CONVERT(bmx, bm);
-
-	iflags = bmx.bmv_iflags;
-
-	if (iflags & (~BMV_IF_VALID))
-		return -XFS_ERROR(EINVAL);
-
-	iflags |= BMV_IF_EXTENDED;
-
-	error = xfs_getbmap(bdp, &bm, (struct getbmapx *)arg+1, iflags);
-	if (error)
-		return -error;
-
-	GETBMAP_CONVERT(bm, bmx);
-
-	if (copy_to_user((struct getbmapx *)arg, &bmx, sizeof(bmx)))
-		return -XFS_ERROR(EFAULT);
-
-	return 0;
-}
diff -Nru a/fs/xfs/linux/xfs_iops.c b/fs/xfs/linux/xfs_iops.c
--- a/fs/xfs/linux/xfs_iops.c	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,708 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-#include "xfs_fs.h"
-#include "xfs_inum.h"
-#include "xfs_log.h"
-#include "xfs_trans.h"
-#include "xfs_sb.h"
-#include "xfs_ag.h"
-#include "xfs_dir.h"
-#include "xfs_dir2.h"
-#include "xfs_alloc.h"
-#include "xfs_dmapi.h"
-#include "xfs_quota.h"
-#include "xfs_mount.h"
-#include "xfs_alloc_btree.h"
-#include "xfs_bmap_btree.h"
-#include "xfs_ialloc_btree.h"
-#include "xfs_btree.h"
-#include "xfs_ialloc.h"
-#include "xfs_attr_sf.h"
-#include "xfs_dir_sf.h"
-#include "xfs_dir2_sf.h"
-#include "xfs_dinode.h"
-#include "xfs_inode.h"
-#include "xfs_bmap.h"
-#include "xfs_bit.h"
-#include "xfs_rtalloc.h"
-#include "xfs_error.h"
-#include "xfs_itable.h"
-#include "xfs_rw.h"
-#include "xfs_acl.h"
-#include "xfs_cap.h"
-#include "xfs_mac.h"
-#include "xfs_attr.h"
-#include "xfs_buf_item.h"
-#include "xfs_utils.h"
-
-#include <linux/xattr.h>
-
-
-/*
- * Pull the link count and size up from the xfs inode to the linux inode
- */
-STATIC void
-validate_fields(
-	struct inode	*ip)
-{
-	vnode_t		*vp = LINVFS_GET_VP(ip);
-	vattr_t		va;
-	int		error;
-
-	va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
-	VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error);
-	if (likely(!error)) {
-		ip->i_nlink = va.va_nlink;
-		ip->i_blocks = va.va_nblocks;
-
-		/* we're under i_sem so i_size can't change under us */
-		if (i_size_read(ip) != va.va_size)
-			i_size_write(ip, va.va_size);
-	}
-}
-
-/*
- * Determine whether a process has a valid fs_struct (kernel daemons
- * like knfsd don't have an fs_struct).
- *
- * XXX(hch):  nfsd is broken, better fix it instead.
- */
-STATIC inline int
-has_fs_struct(struct task_struct *task)
-{
-	return (task->fs != init_task.fs);
-}
-
-STATIC int
-linvfs_mknod(
-	struct inode	*dir,
-	struct dentry	*dentry,
-	int		mode,
-	dev_t		rdev)
-{
-	struct inode	*ip;
-	vattr_t		va;
-	vnode_t		*vp = NULL, *dvp = LINVFS_GET_VP(dir);
-	xfs_acl_t	*default_acl = NULL;
-	attrexists_t	test_default_acl = _ACL_DEFAULT_EXISTS;
-	int		error;
-
-	/*
-	 * Irix uses Missed'em'V split, but doesn't want to see
-	 * the upper 5 bits of (14bit) major.
-	 */
-	if (!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff)
-		return -EINVAL;
-
-	if (test_default_acl && test_default_acl(dvp)) {
-		if (!_ACL_ALLOC(default_acl))
-			return -ENOMEM;
-		if (!_ACL_GET_DEFAULT(dvp, default_acl)) {
-			_ACL_FREE(default_acl);
-			default_acl = NULL;
-		}
-	}
-
-	if (IS_POSIXACL(dir) && !default_acl && has_fs_struct(current))
-		mode &= ~current->fs->umask;
-
-	memset(&va, 0, sizeof(va));
-	va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
-	va.va_type = IFTOVT(mode);
-	va.va_mode = mode;
-
-	switch (mode & S_IFMT) {
-	case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
-		va.va_rdev = sysv_encode_dev(rdev);
-		va.va_mask |= XFS_AT_RDEV;
-		/*FALLTHROUGH*/
-	case S_IFREG:
-		VOP_CREATE(dvp, dentry, &va, &vp, NULL, error);
-		break;
-	case S_IFDIR:
-		VOP_MKDIR(dvp, dentry, &va, &vp, NULL, error);
-		break;
-	default:
-		error = EINVAL;
-		break;
-	}
-
-	if (default_acl) {
-		if (!error) {
-			error = _ACL_INHERIT(vp, &va, default_acl);
-			if (!error) {
-				VMODIFY(vp);
-			} else {
-				struct dentry	teardown = {};
-				int		err2;
-
-				/* Oh, the horror.
-				 * If we can't add the ACL we must back out.
-				 * ENOSPC can hit here, among other things.
-				 */
-				teardown.d_inode = ip = LINVFS_GET_IP(vp);
-				teardown.d_name = dentry->d_name;
-				remove_inode_hash(ip);
-				make_bad_inode(ip);
-				if (S_ISDIR(mode))
-					VOP_RMDIR(dvp, &teardown, NULL, err2);
-				else
-					VOP_REMOVE(dvp, &teardown, NULL, err2);
-				VN_RELE(vp);
-			}
-		}
-		_ACL_FREE(default_acl);
-	}
-
-	if (!error) {
-		ASSERT(vp);
-		ip = LINVFS_GET_IP(vp);
-
-		if (S_ISCHR(mode) || S_ISBLK(mode))
-			ip->i_rdev = rdev;
-		else if (S_ISDIR(mode))
-			validate_fields(ip);
-		d_instantiate(dentry, ip);
-		validate_fields(dir);
-	}
-	return -error;
-}
-
-STATIC int
-linvfs_create(
-	struct inode	*dir,
-	struct dentry	*dentry,
-	int		mode,
-	struct nameidata *nd)
-{
-	return linvfs_mknod(dir, dentry, mode, 0);
-}
-
-STATIC int
-linvfs_mkdir(
-	struct inode	*dir,
-	struct dentry	*dentry,
-	int		mode)
-{
-	return linvfs_mknod(dir, dentry, mode|S_IFDIR, 0);
-}
-
-STATIC struct dentry *
-linvfs_lookup(
-	struct inode	*dir,
-	struct dentry	*dentry,
-	struct nameidata *nd)
-{
-	struct inode	*ip = NULL;
-	vnode_t		*vp, *cvp = NULL;
-	int		error;
-
-	if (dentry->d_name.len >= MAXNAMELEN)
-		return ERR_PTR(-ENAMETOOLONG);
-
-	vp = LINVFS_GET_VP(dir);
-	VOP_LOOKUP(vp, dentry, &cvp, 0, NULL, NULL, error);
-	if (!error) {
-		ASSERT(cvp);
-		ip = LINVFS_GET_IP(cvp);
-		if (!ip) {
-			VN_RELE(cvp);
-			return ERR_PTR(-EACCES);
-		}
-	}
-	if (error && (error != ENOENT))
-		return ERR_PTR(-error);
-	return d_splice_alias(ip, dentry);
-}
-
-STATIC int
-linvfs_link(
-	struct dentry	*old_dentry,
-	struct inode	*dir,
-	struct dentry	*dentry)
-{
-	struct inode	*ip;	/* inode of guy being linked to */
-	vnode_t		*tdvp;	/* target directory for new name/link */
-	vnode_t		*vp;	/* vp of name being linked */
-	int		error;
-
-	ip = old_dentry->d_inode;	/* inode being linked to */
-	if (S_ISDIR(ip->i_mode))
-		return -EPERM;
-
-	tdvp = LINVFS_GET_VP(dir);
-	vp = LINVFS_GET_VP(ip);
-
-	VOP_LINK(tdvp, vp, dentry, NULL, error);
-	if (!error) {
-		VMODIFY(tdvp);
-		VN_HOLD(vp);
-		validate_fields(ip);
-		d_instantiate(dentry, ip);
-	}
-	return -error;
-}
-
-STATIC int
-linvfs_unlink(
-	struct inode	*dir,
-	struct dentry	*dentry)
-{
-	struct inode	*inode;
-	vnode_t		*dvp;	/* directory containing name to remove */
-	int		error;
-
-	inode = dentry->d_inode;
-	dvp = LINVFS_GET_VP(dir);
-
-	VOP_REMOVE(dvp, dentry, NULL, error);
-	if (!error) {
-		validate_fields(dir);	/* For size only */
-		validate_fields(inode);
-	}
-
-	return -error;
-}
-
-STATIC int
-linvfs_symlink(
-	struct inode	*dir,
-	struct dentry	*dentry,
-	const char	*symname)
-{
-	struct inode	*ip;
-	vattr_t		va;
-	vnode_t		*dvp;	/* directory containing name to remove */
-	vnode_t		*cvp;	/* used to lookup symlink to put in dentry */
-	int		error;
-
-	dvp = LINVFS_GET_VP(dir);
-	cvp = NULL;
-
-	memset(&va, 0, sizeof(va));
-	va.va_type = VLNK;
-	va.va_mode = irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO;
-	va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
-
-	error = 0;
-	VOP_SYMLINK(dvp, dentry, &va, (char *)symname, &cvp, NULL, error);
-	if (!error && cvp) {
-		ASSERT(cvp->v_type == VLNK);
-		ip = LINVFS_GET_IP(cvp);
-		d_instantiate(dentry, ip);
-		validate_fields(dir);
-		validate_fields(ip); /* size needs update */
-	}
-	return -error;
-}
-
-STATIC int
-linvfs_rmdir(
-	struct inode	*dir,
-	struct dentry	*dentry)
-{
-	struct inode	*inode = dentry->d_inode;
-	vnode_t		*dvp = LINVFS_GET_VP(dir);
-	int		error;
-
-	VOP_RMDIR(dvp, dentry, NULL, error);
-	if (!error) {
-		validate_fields(inode);
-		validate_fields(dir);
-	}
-	return -error;
-}
-
-STATIC int
-linvfs_rename(
-	struct inode	*odir,
-	struct dentry	*odentry,
-	struct inode	*ndir,
-	struct dentry	*ndentry)
-{
-	struct inode	*new_inode = ndentry->d_inode;
-	vnode_t		*fvp;	/* from directory */
-	vnode_t		*tvp;	/* target directory */
-	int		error;
-
-	fvp = LINVFS_GET_VP(odir);
-	tvp = LINVFS_GET_VP(ndir);
-
-	VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error);
-	if (error)
-		return -error;
-
-	if (new_inode)
-		validate_fields(new_inode);
-
-	validate_fields(odir);
-	if (ndir != odir)
-		validate_fields(ndir);
-	return 0;
-}
-
-STATIC int
-linvfs_readlink(
-	struct dentry	*dentry,
-	char		*buf,
-	int		size)
-{
-	vnode_t		*vp = LINVFS_GET_VP(dentry->d_inode);
-	uio_t		uio;
-	iovec_t		iov;
-	int		error;
-
-	iov.iov_base = buf;
-	iov.iov_len = size;
-
-	uio.uio_iov = &iov;
-	uio.uio_offset = 0;
-	uio.uio_segflg = UIO_USERSPACE;
-	uio.uio_resid = size;
-	uio.uio_iovcnt = 1;
-
-	VOP_READLINK(vp, &uio, 0, NULL, error);
-	if (error)
-		return -error;
-
-	return (size - uio.uio_resid);
-}
-
-/*
- * careful here - this function can get called recursively, so
- * we need to be very careful about how much stack we use.
- * uio is kmalloced for this reason...
- */
-STATIC int
-linvfs_follow_link(
-	struct dentry		*dentry,
-	struct nameidata	*nd)
-{
-	vnode_t			*vp;
-	uio_t			*uio;
-	iovec_t			iov;
-	int			error;
-	char			*link;
-
-	ASSERT(dentry);
-	ASSERT(nd);
-
-	link = (char *)kmalloc(MAXNAMELEN+1, GFP_KERNEL);
-	if (!link)
-		return -ENOMEM;
-
-	uio = (uio_t *)kmalloc(sizeof(uio_t), GFP_KERNEL);
-	if (!uio) {
-		kfree(link);
-		return -ENOMEM;
-	}
-
-	vp = LINVFS_GET_VP(dentry->d_inode);
-
-	iov.iov_base = link;
-	iov.iov_len = MAXNAMELEN;
-
-	uio->uio_iov = &iov;
-	uio->uio_offset = 0;
-	uio->uio_segflg = UIO_SYSSPACE;
-	uio->uio_resid = MAXNAMELEN;
-	uio->uio_iovcnt = 1;
-
-	VOP_READLINK(vp, uio, 0, NULL, error);
-	if (error) {
-		kfree(uio);
-		kfree(link);
-		return -error;
-	}
-
-	link[MAXNAMELEN - uio->uio_resid] = '\0';
-	kfree(uio);
-
-	/* vfs_follow_link returns (-) errors */
-	error = vfs_follow_link(nd, link);
-	kfree(link);
-	return error;
-}
-
-#ifdef CONFIG_XFS_POSIX_ACL
-STATIC int
-linvfs_permission(
-	struct inode	*inode,
-	int		mode,
-	struct nameidata *nd)
-{
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	int		error;
-
-	mode <<= 6;		/* convert from linux to vnode access bits */
-	VOP_ACCESS(vp, mode, NULL, error);
-	return -error;
-}
-#else
-#define linvfs_permission NULL
-#endif
-
-STATIC int
-linvfs_getattr(
-	struct vfsmount	*mnt,
-	struct dentry	*dentry,
-	struct kstat	*stat)
-{
-	struct inode	*inode = dentry->d_inode;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	int		error = 0;
-
-	if (unlikely(vp->v_flag & VMODIFIED))
-		error = vn_revalidate(vp);
-	if (!error)
-		generic_fillattr(inode, stat);
-	return 0;
-}
-
-STATIC int
-linvfs_setattr(
-	struct dentry	*dentry,
-	struct iattr	*attr)
-{
-	struct inode	*inode = dentry->d_inode;
-	unsigned int	ia_valid = attr->ia_valid;
-	vnode_t		*vp = LINVFS_GET_VP(inode);
-	vattr_t		vattr;
-	int		flags = 0;
-	int		error;
-
-	memset(&vattr, 0, sizeof(vattr_t));
-	if (ia_valid & ATTR_UID) {
-		vattr.va_mask |= XFS_AT_UID;
-		vattr.va_uid = attr->ia_uid;
-	}
-	if (ia_valid & ATTR_GID) {
-		vattr.va_mask |= XFS_AT_GID;
-		vattr.va_gid = attr->ia_gid;
-	}
-	if (ia_valid & ATTR_SIZE) {
-		vattr.va_mask |= XFS_AT_SIZE;
-		vattr.va_size = attr->ia_size;
-	}
-	if (ia_valid & ATTR_ATIME) {
-		vattr.va_mask |= XFS_AT_ATIME;
-		vattr.va_atime = attr->ia_atime;
-	}
-	if (ia_valid & ATTR_MTIME) {
-		vattr.va_mask |= XFS_AT_MTIME;
-		vattr.va_mtime = attr->ia_mtime;
-	}
-	if (ia_valid & ATTR_CTIME) {
-		vattr.va_mask |= XFS_AT_CTIME;
-		vattr.va_ctime = attr->ia_ctime;
-	}
-	if (ia_valid & ATTR_MODE) {
-		vattr.va_mask |= XFS_AT_MODE;
-		vattr.va_mode = attr->ia_mode;
-		if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
-			inode->i_mode &= ~S_ISGID;
-	}
-
-	if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET))
-		flags = ATTR_UTIME;
-#ifdef ATTR_NO_BLOCK
-	if ((ia_valid & ATTR_NO_BLOCK))
-		flags |= ATTR_NONBLOCK;
-#endif
-
-	VOP_SETATTR(vp, &vattr, flags, NULL, error);
-	if (error)
-		return(-error);	/* Positive error up from XFS */
-	if (ia_valid & ATTR_SIZE) {
-		error = vmtruncate(inode, attr->ia_size);
-	}
-
-	if (!error) {
-		vn_revalidate(vp);
-	}
-	return error;
-}
-
-STATIC void
-linvfs_truncate(
-	struct inode	*inode)
-{
-	block_truncate_page(inode->i_mapping, inode->i_size, linvfs_get_block);
-}
-
-STATIC int
-linvfs_setxattr(
-	struct dentry	*dentry,
-	const char	*name,
-	const void	*data,
-	size_t		size,
-	int		flags)
-{
-	vnode_t		*vp = LINVFS_GET_VP(dentry->d_inode);
-	char		*attr = (char *)name;
-	attrnames_t	*namesp;
-	int		xflags = 0;
-	int		error;
-
-	namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
-	if (!namesp)
-		return -EOPNOTSUPP;
-	attr += namesp->attr_namelen;
-	error = namesp->attr_capable(vp, NULL);
-	if (error)
-		return error;
-
-	/* Convert Linux syscall to XFS internal ATTR flags */
-	if (flags & XATTR_CREATE)
-		xflags |= ATTR_CREATE;
-	if (flags & XATTR_REPLACE)
-		xflags |= ATTR_REPLACE;
-	xflags |= namesp->attr_flag;
-	return namesp->attr_set(vp, attr, (void *)data, size, xflags);
-}
-
-STATIC ssize_t
-linvfs_getxattr(
-	struct dentry	*dentry,
-	const char	*name,
-	void		*data,
-	size_t		size)
-{
-	vnode_t		*vp = LINVFS_GET_VP(dentry->d_inode);
-	char		*attr = (char *)name;
-	attrnames_t	*namesp;
-	int		xflags = 0;
-	ssize_t		error;
-
-	namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
-	if (!namesp)
-		return -EOPNOTSUPP;
-	attr += namesp->attr_namelen;
-	error = namesp->attr_capable(vp, NULL);
-	if (error)
-		return error;
-
-	/* Convert Linux syscall to XFS internal ATTR flags */
-	if (!size) {
-		xflags |= ATTR_KERNOVAL;
-		data = NULL;
-	}
-	xflags |= namesp->attr_flag;
-	return namesp->attr_get(vp, attr, (void *)data, size, xflags);
-}
-
-STATIC ssize_t
-linvfs_listxattr(
-	struct dentry		*dentry,
-	char			*data,
-	size_t			size)
-{
-	vnode_t			*vp = LINVFS_GET_VP(dentry->d_inode);
-	int			error, xflags = ATTR_KERNAMELS;
-	ssize_t			result;
-
-	if (!size)
-		xflags |= ATTR_KERNOVAL;
-	xflags |= capable(CAP_SYS_ADMIN) ? ATTR_KERNFULLS : ATTR_KERNORMALS;
-
-	error = attr_generic_list(vp, data, size, xflags, &result);
-	if (error < 0)
-		return error;
-	return result;
-}
-
-STATIC int
-linvfs_removexattr(
-	struct dentry	*dentry,
-	const char	*name)
-{
-	vnode_t		*vp = LINVFS_GET_VP(dentry->d_inode);
-	char		*attr = (char *)name;
-	attrnames_t	*namesp;
-	int		xflags = 0;
-	int		error;
-
-	namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
-	if (!namesp)
-		return -EOPNOTSUPP;
-	attr += namesp->attr_namelen;
-	error = namesp->attr_capable(vp, NULL);
-	if (error)
-		return error;
-	xflags |= namesp->attr_flag;
-	return namesp->attr_remove(vp, attr, xflags);
-}
-
-
-struct inode_operations linvfs_file_inode_operations = {
-	.permission		= linvfs_permission,
-	.truncate		= linvfs_truncate,
-	.getattr		= linvfs_getattr,
-	.setattr		= linvfs_setattr,
-	.setxattr		= linvfs_setxattr,
-	.getxattr		= linvfs_getxattr,
-	.listxattr		= linvfs_listxattr,
-	.removexattr		= linvfs_removexattr,
-};
-
-struct inode_operations linvfs_dir_inode_operations = {
-	.create			= linvfs_create,
-	.lookup			= linvfs_lookup,
-	.link			= linvfs_link,
-	.unlink			= linvfs_unlink,
-	.symlink		= linvfs_symlink,
-	.mkdir			= linvfs_mkdir,
-	.rmdir			= linvfs_rmdir,
-	.mknod			= linvfs_mknod,
-	.rename			= linvfs_rename,
-	.permission		= linvfs_permission,
-	.getattr		= linvfs_getattr,
-	.setattr		= linvfs_setattr,
-	.setxattr		= linvfs_setxattr,
-	.getxattr		= linvfs_getxattr,
-	.listxattr		= linvfs_listxattr,
-	.removexattr		= linvfs_removexattr,
-};
-
-struct inode_operations linvfs_symlink_inode_operations = {
-	.readlink		= linvfs_readlink,
-	.follow_link		= linvfs_follow_link,
-	.permission		= linvfs_permission,
-	.getattr		= linvfs_getattr,
-	.setattr		= linvfs_setattr,
-	.setxattr		= linvfs_setxattr,
-	.getxattr		= linvfs_getxattr,
-	.listxattr		= linvfs_listxattr,
-	.removexattr		= linvfs_removexattr,
-};
diff -Nru a/fs/xfs/linux/xfs_iops.h b/fs/xfs/linux/xfs_iops.h
--- a/fs/xfs/linux/xfs_iops.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_IOPS_H__
-#define __XFS_IOPS_H__
-
-extern struct inode_operations linvfs_file_inode_operations;
-extern struct inode_operations linvfs_dir_inode_operations;
-extern struct inode_operations linvfs_symlink_inode_operations;
-
-extern struct file_operations linvfs_file_operations;
-extern struct file_operations linvfs_invis_file_operations;
-extern struct file_operations linvfs_dir_operations;
-
-extern struct address_space_operations linvfs_aops;
-
-extern int linvfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
-extern void linvfs_unwritten_done(struct buffer_head *, int);
-
-extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *,
-                        int, unsigned int, unsigned long);
-
-#endif /* __XFS_IOPS_H__ */
diff -Nru a/fs/xfs/linux/xfs_linux.h b/fs/xfs/linux/xfs_linux.h
--- a/fs/xfs/linux/xfs_linux.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,367 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_LINUX__
-#define __XFS_LINUX__
-
-#include <linux/types.h>
-#include <linux/config.h>
-
-/*
- * Some types are conditional depending on the target system.
- * XFS_BIG_BLKNOS needs block layer disk addresses to be 64 bits.
- * XFS_BIG_INUMS needs the VFS inode number to be 64 bits, as well
- * as requiring XFS_BIG_BLKNOS to be set.
- */
-#if defined(CONFIG_LBD) || (BITS_PER_LONG == 64)
-# define XFS_BIG_BLKNOS	1
-# if BITS_PER_LONG == 64
-#  define XFS_BIG_INUMS	1
-# else
-#  define XFS_BIG_INUMS	0
-# endif
-#else
-# define XFS_BIG_BLKNOS	0
-# define XFS_BIG_INUMS	0
-#endif
-
-#include <xfs_types.h>
-#include <xfs_arch.h>
-
-#include <kmem.h>
-#include <mrlock.h>
-#include <spin.h>
-#include <sv.h>
-#include <mutex.h>
-#include <sema.h>
-#include <time.h>
-
-#include <support/qsort.h>
-#include <support/ktrace.h>
-#include <support/debug.h>
-#include <support/move.h>
-#include <support/uuid.h>
-
-#include <linux/mm.h>
-#include <linux/kernel.h>
-#include <linux/blkdev.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/file.h>
-#include <linux/swap.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/bitops.h>
-#include <linux/major.h>
-#include <linux/pagemap.h>
-#include <linux/vfs.h>
-#include <linux/seq_file.h>
-#include <linux/init.h>
-#include <linux/proc_fs.h>
-#include <linux/version.h>
-
-#include <asm/page.h>
-#include <asm/div64.h>
-#include <asm/param.h>
-#include <asm/uaccess.h>
-#include <asm/byteorder.h>
-#include <asm/unaligned.h>
-
-#include <xfs_behavior.h>
-#include <xfs_vfs.h>
-#include <xfs_cred.h>
-#include <xfs_vnode.h>
-#include <xfs_stats.h>
-#include <xfs_sysctl.h>
-#include <xfs_iops.h>
-#include <xfs_super.h>
-#include <xfs_globals.h>
-#include <xfs_fs_subr.h>
-#include <xfs_lrw.h>
-#include <xfs_buf.h>
-
-/*
- * Feature macros (disable/enable)
- */
-#undef  HAVE_REFCACHE	/* reference cache not needed for NFS in 2.6 */
-#define HAVE_SENDFILE	/* sendfile(2) exists in 2.6, but not in 2.4 */
-
-/*
- * State flag for unwritten extent buffers.
- *
- * We need to be able to distinguish between these and delayed
- * allocate buffers within XFS.  The generic IO path code does
- * not need to distinguish - we use the BH_Delay flag for both
- * delalloc and these ondisk-uninitialised buffers.
- */
-BUFFER_FNS(PrivateStart, unwritten);
-static inline void set_buffer_unwritten_io(struct buffer_head *bh)
-{
-	bh->b_end_io = linvfs_unwritten_done;
-}
-
-#define xfs_refcache_size	xfs_params.refcache_size.val
-#define xfs_refcache_purge_count xfs_params.refcache_purge.val
-#define restricted_chown	xfs_params.restrict_chown.val
-#define irix_sgid_inherit	xfs_params.sgid_inherit.val
-#define irix_symlink_mode	xfs_params.symlink_mode.val
-#define xfs_panic_mask		xfs_params.panic_mask.val
-#define xfs_error_level		xfs_params.error_level.val
-#define xfs_syncd_interval	(xfs_params.sync_interval.val * HZ / USER_HZ)
-#define xfs_stats_clear		xfs_params.stats_clear.val
-#define xfs_inherit_sync	xfs_params.inherit_sync.val
-#define xfs_inherit_nodump	xfs_params.inherit_nodump.val
-#define xfs_inherit_noatime	xfs_params.inherit_noatim.val
-#define xfs_flush_interval	(xfs_params.flush_interval.val * HZ / USER_HZ)
-#define xfs_age_buffer		(xfs_params.age_buffer.val * HZ / USER_HZ)
-
-#define current_cpu()		smp_processor_id()
-#define current_pid()		(current->pid)
-#define current_fsuid(cred)	(current->fsuid)
-#define current_fsgid(cred)	(current->fsgid)
-
-#define NBPP		PAGE_SIZE
-#define DPPSHFT		(PAGE_SHIFT - 9)
-#define NDPP		(1 << (PAGE_SHIFT - 9))
-#define dtop(DD)	(((DD) + NDPP - 1) >> DPPSHFT)
-#define dtopt(DD)	((DD) >> DPPSHFT)
-#define dpoff(DD)	((DD) & (NDPP-1))
-
-#define NBBY		8		/* number of bits per byte */
-#define	NBPC		PAGE_SIZE	/* Number of bytes per click */
-#define	BPCSHIFT	PAGE_SHIFT	/* LOG2(NBPC) if exact */
-
-/*
- * Size of block device i/o is parameterized here.
- * Currently the system supports page-sized i/o.
- */
-#define	BLKDEV_IOSHIFT		BPCSHIFT
-#define	BLKDEV_IOSIZE		(1<<BLKDEV_IOSHIFT)
-/* number of BB's per block device block */
-#define	BLKDEV_BB		BTOBB(BLKDEV_IOSIZE)
-
-/* bytes to clicks */
-#define	btoc(x)		(((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
-#define	btoct(x)	((__psunsigned_t)(x)>>BPCSHIFT)
-#define	btoc64(x)	(((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT)
-#define	btoct64(x)	((__uint64_t)(x)>>BPCSHIFT)
-#define	io_btoc(x)	(((__psunsigned_t)(x)+(IO_NBPC-1))>>IO_BPCSHIFT)
-#define	io_btoct(x)	((__psunsigned_t)(x)>>IO_BPCSHIFT)
-
-/* off_t bytes to clicks */
-#define offtoc(x)       (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT)
-#define offtoct(x)      ((xfs_off_t)(x)>>BPCSHIFT)
-
-/* clicks to off_t bytes */
-#define	ctooff(x)	((xfs_off_t)(x)<<BPCSHIFT)
-
-/* clicks to bytes */
-#define	ctob(x)		((__psunsigned_t)(x)<<BPCSHIFT)
-#define btoct(x)        ((__psunsigned_t)(x)>>BPCSHIFT)
-#define	ctob64(x)	((__uint64_t)(x)<<BPCSHIFT)
-#define	io_ctob(x)	((__psunsigned_t)(x)<<IO_BPCSHIFT)
-
-/* bytes to clicks */
-#define btoc(x)         (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
-
-#ifndef CELL_CAPABLE
-#define FSC_NOTIFY_NAME_CHANGED(vp)
-#endif
-
-#ifndef ENOATTR
-#define ENOATTR		ENODATA		/* Attribute not found */
-#endif
-
-/* Note: EWRONGFS never visible outside the kernel */
-#define	EWRONGFS	EINVAL		/* Mount with wrong filesystem type */
-
-/*
- * XXX EFSCORRUPTED needs a real value in errno.h. asm-i386/errno.h won't
- *     return codes out of its known range in errno.
- * XXX Also note: needs to be < 1000 and fairly unique on Linux (mustn't
- *     conflict with any code we use already or any code a driver may use)
- * XXX Some options (currently we do #2):
- *	1/ New error code ["Filesystem is corrupted", _after_ glibc updated]
- *	2/ 990 ["Unknown error 990"]
- *	3/ EUCLEAN ["Structure needs cleaning"]
- *	4/ Convert EFSCORRUPTED to EIO [just prior to return into userspace]
- */
-#define EFSCORRUPTED    990		/* Filesystem is corrupted */
-
-#define SYNCHRONIZE()	barrier()
-#define __return_address __builtin_return_address(0)
-
-/*
- * IRIX (BSD) quotactl makes use of separate commands for user/group,
- * whereas on Linux the syscall encodes this information into the cmd
- * field (see the QCMD macro in quota.h).  These macros help keep the
- * code portable - they are not visible from the syscall interface.
- */
-#define Q_XSETGQLIM	XQM_CMD(0x8)	/* set groups disk limits */
-#define Q_XGETGQUOTA	XQM_CMD(0x9)	/* get groups disk limits */
-
-/* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */
-/* we may well need to fine-tune this if it ever becomes an issue.  */
-#define DQUOT_MAX_HEURISTIC	1024	/* NR_DQUOTS */
-#define ndquot			DQUOT_MAX_HEURISTIC
-
-/* IRIX uses the current size of the name cache to guess a good value */
-/* - this isn't the same but is a good enough starting point for now. */
-#define DQUOT_HASH_HEURISTIC	files_stat.nr_files
-
-/* IRIX inodes maintain the project ID also, zero this field on Linux */
-#define DEFAULT_PROJID	0
-#define dfltprid	DEFAULT_PROJID
-
-#define MAXPATHLEN	1024
-
-#define MIN(a,b)	(min(a,b))
-#define MAX(a,b)	(max(a,b))
-#define howmany(x, y)	(((x)+((y)-1))/(y))
-#define roundup(x, y)	((((x)+((y)-1))/(y))*(y))
-
-#define xfs_stack_trace()	dump_stack()
-
-#define xfs_itruncate_data(ip, off)	\
-	(-vmtruncate(LINVFS_GET_IP(XFS_ITOV(ip)), (off)))
-
-
-/* Move the kernel do_div definition off to one side */
-
-#if defined __i386__
-/* For ia32 we need to pull some tricks to get past various versions
- * of the compiler which do not like us using do_div in the middle
- * of large functions.
- */
-static inline __u32 xfs_do_div(void *a, __u32 b, int n)
-{
-	__u32	mod;
-
-	switch (n) {
-		case 4:
-			mod = *(__u32 *)a % b;
-			*(__u32 *)a = *(__u32 *)a / b;
-			return mod;
-		case 8:
-			{
-			unsigned long __upper, __low, __high, __mod;
-			__u64	c = *(__u64 *)a;
-			__upper = __high = c >> 32;
-			__low = c;
-			if (__high) {
-				__upper = __high % (b);
-				__high = __high / (b);
-			}
-			asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (b), "0" (__low), "1" (__upper));
-			asm("":"=A" (c):"a" (__low),"d" (__high));
-			*(__u64 *)a = c;
-			return __mod;
-			}
-	}
-
-	/* NOTREACHED */
-	return 0;
-}
-
-/* Side effect free 64 bit mod operation */
-static inline __u32 xfs_do_mod(void *a, __u32 b, int n)
-{
-	switch (n) {
-		case 4:
-			return *(__u32 *)a % b;
-		case 8:
-			{
-			unsigned long __upper, __low, __high, __mod;
-			__u64	c = *(__u64 *)a;
-			__upper = __high = c >> 32;
-			__low = c;
-			if (__high) {
-				__upper = __high % (b);
-				__high = __high / (b);
-			}
-			asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (b), "0" (__low), "1" (__upper));
-			asm("":"=A" (c):"a" (__low),"d" (__high));
-			return __mod;
-			}
-	}
-
-	/* NOTREACHED */
-	return 0;
-}
-#else
-static inline __u32 xfs_do_div(void *a, __u32 b, int n)
-{
-	__u32	mod;
-
-	switch (n) {
-		case 4:
-			mod = *(__u32 *)a % b;
-			*(__u32 *)a = *(__u32 *)a / b;
-			return mod;
-		case 8:
-			mod = do_div(*(__u64 *)a, b);
-			return mod;
-	}
-
-	/* NOTREACHED */
-	return 0;
-}
-
-/* Side effect free 64 bit mod operation */
-static inline __u32 xfs_do_mod(void *a, __u32 b, int n)
-{
-	switch (n) {
-		case 4:
-			return *(__u32 *)a % b;
-		case 8:
-			{
-			__u64	c = *(__u64 *)a;
-			return do_div(c, b);
-			}
-	}
-
-	/* NOTREACHED */
-	return 0;
-}
-#endif
-
-#undef do_div
-#define do_div(a, b)	xfs_do_div(&(a), (b), sizeof(a))
-#define do_mod(a, b)	xfs_do_mod(&(a), (b), sizeof(a))
-
-static inline __uint64_t roundup_64(__uint64_t x, __uint32_t y)
-{
-	x += y - 1;
-	do_div(x, y);
-	return(x * y);
-}
-
-#endif /* __XFS_LINUX__ */
diff -Nru a/fs/xfs/linux/xfs_lrw.c b/fs/xfs/linux/xfs_lrw.c
--- a/fs/xfs/linux/xfs_lrw.c	Tue Jun 15 22:20:35 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,1028 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-/*
- *  fs/xfs/linux/xfs_lrw.c (Linux Read Write stuff)
- *
- */
-
-#include "xfs.h"
-
-#include "xfs_fs.h"
-#include "xfs_inum.h"
-#include "xfs_log.h"
-#include "xfs_trans.h"
-#include "xfs_sb.h"
-#include "xfs_ag.h"
-#include "xfs_dir.h"
-#include "xfs_dir2.h"
-#include "xfs_alloc.h"
-#include "xfs_dmapi.h"
-#include "xfs_quota.h"
-#include "xfs_mount.h"
-#include "xfs_alloc_btree.h"
-#include "xfs_bmap_btree.h"
-#include "xfs_ialloc_btree.h"
-#include "xfs_btree.h"
-#include "xfs_ialloc.h"
-#include "xfs_attr_sf.h"
-#include "xfs_dir_sf.h"
-#include "xfs_dir2_sf.h"
-#include "xfs_dinode.h"
-#include "xfs_inode.h"
-#include "xfs_bmap.h"
-#include "xfs_bit.h"
-#include "xfs_rtalloc.h"
-#include "xfs_error.h"
-#include "xfs_itable.h"
-#include "xfs_rw.h"
-#include "xfs_acl.h"
-#include "xfs_cap.h"
-#include "xfs_mac.h"
-#include "xfs_attr.h"
-#include "xfs_inode_item.h"
-#include "xfs_buf_item.h"
-#include "xfs_utils.h"
-#include "xfs_iomap.h"
-
-#include <linux/capability.h>
-
-
-#if defined(XFS_RW_TRACE)
-void
-xfs_rw_enter_trace(
-	int			tag,
-	xfs_iocore_t		*io,
-	const struct iovec	*iovp,
-	size_t			segs,
-	loff_t			offset,
-	int			ioflags)
-{
-	xfs_inode_t	*ip = XFS_IO_INODE(io);
-
-	if (ip->i_rwtrace == NULL)
-		return;
-	ktrace_enter(ip->i_rwtrace,
-		(void *)(unsigned long)tag,
-		(void *)ip,
-		(void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
-		(void *)(__psint_t)iovp,
-		(void *)((unsigned long)segs),
-		(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(offset & 0xffffffff)),
-		(void *)((unsigned long)ioflags),
-		(void *)((unsigned long)((io->io_new_size >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(io->io_new_size & 0xffffffff)),
-		(void *)NULL,
-		(void *)NULL,
-		(void *)NULL,
-		(void *)NULL,
-		(void *)NULL);
-}
-
-void
-xfs_inval_cached_trace(
-	xfs_iocore_t	*io,
-	xfs_off_t	offset,
-	xfs_off_t	len,
-	xfs_off_t	first,
-	xfs_off_t	last)
-{
-	xfs_inode_t	*ip = XFS_IO_INODE(io);
-
-	if (ip->i_rwtrace == NULL)
-		return;
-	ktrace_enter(ip->i_rwtrace,
-		(void *)(__psint_t)XFS_INVAL_CACHED,
-		(void *)ip,
-		(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(offset & 0xffffffff)),
-		(void *)((unsigned long)((len >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(len & 0xffffffff)),
-		(void *)((unsigned long)((first >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(first & 0xffffffff)),
-		(void *)((unsigned long)((last >> 32) & 0xffffffff)),
-		(void *)((unsigned long)(last & 0xffffffff)),
-		(void *)NULL,
-		(void *)NULL,
-		(void *)NULL,
-		(void *)NULL,
-		(void *)NULL,
-		(void *)NULL);
-}
-#endif
-
-/*
- *	xfs_iozero
- *
- *	xfs_iozero clears the specified range of buffer supplied,
- *	and marks all the affected blocks as valid and modified.  If
- *	an affected block is not allocated, it will be allocated.  If
- *	an affected block is not completely overwritten, and is not
- *	valid before the operation, it will be read from disk before
- *	being partially zeroed.
- */
-STATIC int
-xfs_iozero(
-	struct inode		*ip,	/* inode			*/
-	loff_t			pos,	/* offset in file		*/
-	size_t			count,	/* size of data to zero		*/
-	loff_t			end_size)	/* max file size to set */
-{
-	unsigned		bytes;
-	struct page		*page;
-	struct address_space	*mapping;
-	char			*kaddr;
-	int			status;
-
-	mapping = ip->i_mapping;
-	do {
-		unsigned long index, offset;
-
-		offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
-		index = pos >> PAGE_CACHE_SHIFT;
-		bytes = PAGE_CACHE_SIZE - offset;
-		if (bytes > count)
-			bytes = count;
-
-		status = -ENOMEM;
-		page = grab_cache_page(mapping, index);
-		if (!page)
-			break;
-
-		kaddr = kmap(page);
-		status = mapping->a_ops->prepare_write(NULL, page, offset,
-							offset + bytes);
-		if (status) {
-			goto unlock;
-		}
-
-		memset((void *) (kaddr + offset), 0, bytes);
-		flush_dcache_page(page);
-		status = mapping->a_ops->commit_write(NULL, page, offset,
-							offset + bytes);
-		if (!status) {
-			pos += bytes;
-			count -= bytes;
-			if (pos > i_size_read(ip))
-				i_size_write(ip, pos < end_size ? pos : end_size);
-		}
-
-unlock:
-		kunmap(page);
-		unlock_page(page);
-		page_cache_release(page);
-		if (status)
-			break;
-	} while (count);
-
-	return (-status);
-}
-
-/*
- * xfs_inval_cached_pages
- * 
- * This routine is responsible for keeping direct I/O and buffered I/O
- * somewhat coherent.  From here we make sure that we're at least
- * temporarily holding the inode I/O lock exclusively and then call
- * the page cache to flush and invalidate any cached pages.  If there
- * are no cached pages this routine will be very quick.
- */
-void
-xfs_inval_cached_pages(
-	vnode_t		*vp,
-	xfs_iocore_t	*io,
-	xfs_off_t	offset,
-	int		write,
-	int		relock)
-{
-	xfs_mount_t	*mp;
-
-	if (!VN_CACHED(vp)) {
-		return;
-	}
-
-	mp = io->io_mount;
-
-	/*
-	 * We need to get the I/O lock exclusively in order
-	 * to safely invalidate pages and mappings.
-	 */
-	if (relock) {
-		XFS_IUNLOCK(mp, io, XFS_IOLOCK_SHARED);
-		XFS_ILOCK(mp, io, XFS_IOLOCK_EXCL);
-	}
-
-	/* Writing beyond EOF creates a hole that must be zeroed */
-	if (write && (offset > XFS_SIZE(mp, io))) {
-		xfs_fsize_t	isize;
-
-		XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
-		isize = XFS_SIZE(mp, io);
-		if (offset > isize) {
-			xfs_zero_eof(vp, io, offset, isize, offset);
-		}
-		XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
-	}
-
-	xfs_inval_cached_trace(io, offset, -1, ctooff(offtoct(offset)), -1);
-	VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED);
-	if (relock) {
-		XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL);
-	}
-}
-
-ssize_t			/* bytes read, or (-)  error */
-xfs_read(
-	bhv_desc_t		*bdp,
-	struct kiocb		*iocb,
-	const struct iovec	*iovp,
-	unsigned int		segs,
-	loff_t			*offset,
-	int			ioflags,
-	cred_t			*credp)
-{
-	struct file		*file = iocb->ki_filp;
-	size_t			size = 0;
-	ssize_t			ret;
-	xfs_fsize_t		n;
-	xfs_inode_t		*ip;
-	xfs_mount_t		*mp;
-	vnode_t			*vp;
-	unsigned long		seg;
-
-	ip = XFS_BHVTOI(bdp);
-	vp = BHV_TO_VNODE(bdp);
-	mp = ip->i_mount;
-
-	XFS_STATS_INC(xs_read_calls);
-
-	/* START copy & waste from filemap.c */
-	for (seg = 0; seg < segs; seg++) {
-		const struct iovec *iv = &iovp[seg];
-
-		/*
-		 * If any segment has a negative length, or the cumulative
-		 * length ever wraps negative then return -EINVAL.
-		 */
-		size += iv->iov_len;
-		if (unlikely((ssize_t)(size|iv->iov_len) < 0))
-			return XFS_ERROR(-EINVAL);
-	}
-	/* END copy & waste from filemap.c */
-
-	if (ioflags & IO_ISDIRECT) {
-		xfs_buftarg_t	*target =
-			(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
-				mp->m_rtdev_targp : mp->m_ddev_targp;
-		if ((*offset & target->pbr_smask) ||
-		    (size & target->pbr_smask)) {
-			if (*offset == ip->i_d.di_size) {
-				return (0);
-			}
-			return -XFS_ERROR(EINVAL);
-		}
-	}
-
-	n = XFS_MAXIOFFSET(mp) - *offset;
-	if ((n <= 0) || (size == 0))
-		return 0;
-
-	if (n < size)
-		size = n;
-
-	if (XFS_FORCED_SHUTDOWN(mp)) {
-		return -EIO;
-	}
-
-	/* OK so we are holding the I/O lock for the duration
-	 * of the submission, then what happens if the I/O
-	 * does not really happen here, but is scheduled 
-	 * later?
-	 */
-	xfs_ilock(ip, XFS_IOLOCK_SHARED);
-
-	if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
-	    !(ioflags & IO_INVIS)) {
-		vrwlock_t locktype = VRWLOCK_READ;
-
-		ret = XFS_SEND_DATA(mp, DM_EVENT_READ,
-					BHV_TO_VNODE(bdp), *offset, size,
-					FILP_DELAY_FLAG(file), &locktype);
-		if (ret) {
-			xfs_iunlock(ip, XFS_IOLOCK_SHARED);
-			return -ret;
-		}
-	}
-
-	xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore,
-				iovp, segs, *offset, ioflags);
-	ret = __generic_file_aio_read(iocb, iovp, segs, offset);
-	xfs_iunlock(ip, XFS_IOLOCK_SHARED);
-
-	if (ret > 0)
-		XFS_STATS_ADD(xs_read_bytes, ret);
-
-	if (likely(!(ioflags & IO_INVIS)))
-		xfs_ichgtime(ip, XFS_ICHGTIME_ACC);
-
-	return ret;
-}
-
-ssize_t
-xfs_sendfile(
-	bhv_desc_t		*bdp,
-	struct file		*filp,
-	loff_t			*offset,
-	int			ioflags,
-	size_t			count,
-	read_actor_t		actor,
-	void			*target,
-	cred_t			*credp)
-{
-	ssize_t			ret;
-	xfs_fsize_t		n;
-	xfs_inode_t		*ip;
-	xfs_mount_t		*mp;
-	vnode_t			*vp;
-
-	ip = XFS_BHVTOI(bdp);
-	vp = BHV_TO_VNODE(bdp);
-	mp = ip->i_mount;
-
-	XFS_STATS_INC(xs_read_calls);
-
-	n = XFS_MAXIOFFSET(mp) - *offset;
-	if ((n <= 0) || (count == 0))
-		return 0;
-
-	if (n < count)
-		count = n;
-
-	if (XFS_FORCED_SHUTDOWN(ip->i_mount))
-		return -EIO;
-
-	xfs_ilock(ip, XFS_IOLOCK_SHARED);
-
-	if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
-	    (!(ioflags & IO_INVIS))) {
-		vrwlock_t locktype = VRWLOCK_READ;
-		int error;
-
-		error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), *offset, count,
-				      FILP_DELAY_FLAG(filp), &locktype);
-		if (error) {
-			xfs_iunlock(ip, XFS_IOLOCK_SHARED);
-			return -error;
-		}
-	}
-	xfs_rw_enter_trace(XFS_SENDFILE_ENTER, &ip->i_iocore,
-				target, count, *offset, ioflags);
-	ret = generic_file_sendfile(filp, offset, count, actor, target);
-	xfs_iunlock(ip, XFS_IOLOCK_SHARED);
-
-	XFS_STATS_ADD(xs_read_bytes, ret);
-	xfs_ichgtime(ip, XFS_ICHGTIME_ACC);
-	return ret;
-}
-
-/*
- * This routine is called to handle zeroing any space in the last
- * block of the file that is beyond the EOF.  We do this since the
- * size is being increased without writing anything to that block
- * and we don't want anyone to read the garbage on the disk.
- */
-STATIC int				/* error (positive) */
-xfs_zero_last_block(
-	struct inode	*ip,
-	xfs_iocore_t	*io,
-	xfs_off_t	offset,
-	xfs_fsize_t	isize,
-	xfs_fsize_t	end_size)
-{
-	xfs_fileoff_t	last_fsb;
-	xfs_mount_t	*mp;
-	int		nimaps;
-	int		zero_offset;
-	int		zero_len;
-	int		isize_fsb_offset;
-	int		error = 0;
-	xfs_bmbt_irec_t	imap;
-	loff_t		loff;
-	size_t		lsize;
-
-	ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0);
-	ASSERT(offset > isize);
-
-	mp = io->io_mount;
-
-	isize_fsb_offset = XFS_B_FSB_OFFSET(mp, isize);
-	if (isize_fsb_offset == 0) {
-		/*
-		 * There are no extra bytes in the last block on disk to
-		 * zero, so return.
-		 */
-		return 0;
-	}
-
-	last_fsb = XFS_B_TO_FSBT(mp, isize);
-	nimaps = 1;
-	error = XFS_BMAPI(mp, NULL, io, last_fsb, 1, 0, NULL, 0, &imap,
-			  &nimaps, NULL);
-	if (error) {
-		return error;
-	}
-	ASSERT(nimaps > 0);
-	/*
-	 * If the block underlying isize is just a hole, then there
-	 * is nothing to zero.
-	 */
-	if (imap.br_startblock == HOLESTARTBLOCK) {
-		return 0;
-	}
-	/*
-	 * Zero the part of the last block beyond the EOF, and write it
-	 * out sync.  We need to drop the ilock while we do this so we
-	 * don't deadlock when the buffer cache calls back to us.
-	 */
-	XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD);
-	loff = XFS_FSB_TO_B(mp, last_fsb);
-	lsize = XFS_FSB_TO_B(mp, 1);
-
-	zero_offset = isize_fsb_offset;
-	zero_len = mp->m_sb.sb_blocksize - isize_fsb_offset;
-
-	error = xfs_iozero(ip, loff + zero_offset, zero_len, end_size);
-
-	XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
-	ASSERT(error >= 0);
-	return error;
-}
-
-/*
- * Zero any on disk space between the current EOF and the new,
- * larger EOF.  This handles the normal case of zeroing the remainder
- * of the last block in the file and the unusual case of zeroing blocks
- * out beyond the size of the file.  This second case only happens
- * with fixed size extents and when the system crashes before the inode
- * size was updated but after blocks were allocated.  If fill is set,
- * then any holes in the range are filled and zeroed.  If not, the holes
- * are left alone as holes.
- */
-
-int					/* error (positive) */
-xfs_zero_eof(
-	vnode_t		*vp,
-	xfs_iocore_t	*io,
-	xfs_off_t	offset,		/* starting I/O offset */
-	xfs_fsize_t	isize,		/* current inode size */
-	xfs_fsize_t	end_size)	/* terminal inode size */
-{
-	struct inode	*ip = LINVFS_GET_IP(vp);
-	xfs_fileoff_t	start_zero_fsb;
-	xfs_fileoff_t	end_zero_fsb;
-	xfs_fileoff_t	prev_zero_fsb;
-	xfs_fileoff_t	zero_count_fsb;
-	xfs_fileoff_t	last_fsb;
-	xfs_extlen_t	buf_len_fsb;
-	xfs_extlen_t	prev_zero_count;
-	xfs_mount_t	*mp;
-	int		nimaps;
-	int		error = 0;
-	xfs_bmbt_irec_t	imap;
-	loff_t		loff;
-	size_t		lsize;
-
-	ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
-	ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
-
-	mp = io->io_mount;
-
-	/*
-	 * First handle zeroing the block on which isize resides.
-	 * We only zero a part of that block so it is handled specially.
-	 */
-	error = xfs_zero_last_block(ip, io, offset, isize, end_size);
-	if (error) {
-		ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
-		ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
-		return error;
-	}
-
-	/*
-	 * Calculate the range between the new size and the old
-	 * where blocks needing to be zeroed may exist.  To get the
-	 * block where the last byte in the file currently resides,
-	 * we need to subtract one from the size and truncate back
-	 * to a block boundary.  We subtract 1 in case the size is
-	 * exactly on a block boundary.
-	 */
-	last_fsb = isize ? XFS_B_TO_FSBT(mp, isize - 1) : (xfs_fileoff_t)-1;
-	start_zero_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)isize);
-	end_zero_fsb = XFS_B_TO_FSBT(mp, offset - 1);
-	ASSERT((xfs_sfiloff_t)last_fsb < (xfs_sfiloff_t)start_zero_fsb);
-	if (last_fsb == end_zero_fsb) {
-		/*
-		 * The size was only incremented on its last block.
-		 * We took care of that above, so just return.
-		 */
-		return 0;
-	}
-
-	ASSERT(start_zero_fsb <= end_zero_fsb);
-	prev_zero_fsb = NULLFILEOFF;
-	prev_zero_count = 0;
-	while (start_zero_fsb <= end_zero_fsb) {
-		nimaps = 1;
-		zero_count_fsb = end_zero_fsb - start_zero_fsb + 1;
-		error = XFS_BMAPI(mp, NULL, io, start_zero_fsb, zero_count_fsb,
-				  0, NULL, 0, &imap, &nimaps, NULL);
-		if (error) {
-			ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
-			ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
-			return error;
-		}
-		ASSERT(nimaps > 0);
-
-		if (imap.br_state == XFS_EXT_UNWRITTEN ||
-		    imap.br_startblock == HOLESTARTBLOCK) {
-			/*
-			 * This loop handles initializing pages that were
-			 * partially initialized by the code below this
-			 * loop. It basically zeroes the part of the page
-			 * that sits on a hole and sets the page as P_HOLE
-			 * and calls remapf if it is a mapped file.
-			 */
-			prev_zero_fsb = NULLFILEOFF;
-			prev_zero_count = 0;
-			start_zero_fsb = imap.br_startoff +
-					 imap.br_blockcount;
-			ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
-			continue;
-		}
-
-		/*
-		 * There are blocks in the range requested.
-		 * Zero them a single write at a time.  We actually
-		 * don't zero the entire range returned if it is
-		 * too big and simply loop around to get the rest.
-		 * That is not the most efficient thing to do, but it
-		 * is simple and this path should not be exercised often.
-		 */
-		buf_len_fsb = XFS_FILBLKS_MIN(imap.br_blockcount,
-					      mp->m_writeio_blocks << 8);
-		/*
-		 * Drop the inode lock while we're doing the I/O.
-		 * We'll still have the iolock to protect us.
-		 */
-		XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
-
-		loff = XFS_FSB_TO_B(mp, start_zero_fsb);
-		lsize = XFS_FSB_TO_B(mp, buf_len_fsb);
-
-		error = xfs_iozero(ip, loff, lsize, end_size);
-
-		if (error) {
-			goto out_lock;
-		}
-
-		prev_zero_fsb = start_zero_fsb;
-		prev_zero_count = buf_len_fsb;
-		start_zero_fsb = imap.br_startoff + buf_len_fsb;
-		ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
-
-		XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
-	}
-
-	return 0;
-
-out_lock:
-
-	XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
-	ASSERT(error >= 0);
-	return error;
-}
-
-ssize_t				/* bytes written, or (-) error */
-xfs_write(
-	bhv_desc_t		*bdp,
-	struct kiocb		*iocb,
-	const struct iovec	*iovp,
-	unsigned int		segs,
-	loff_t			*offset,
-	int			ioflags,
-	cred_t			*credp)
-{
-	struct file		*file = iocb->ki_filp;
-	size_t			size = 0;
-	xfs_inode_t		*xip;
-	xfs_mount_t		*mp;
-	ssize_t			ret;
-	int			error = 0;
-	xfs_fsize_t		isize, new_size;
-	xfs_fsize_t		n, limit;
-	xfs_iocore_t		*io;
-	vnode_t			*vp;
-	unsigned long		seg;
-	int			iolock;
-	int			eventsent = 0;
-	vrwlock_t		locktype;
-
-	XFS_STATS_INC(xs_write_calls);
-
-	vp = BHV_TO_VNODE(bdp);
-	xip = XFS_BHVTOI(bdp);
-
-	/* START copy & waste from filemap.c */
-	for (seg = 0; seg < segs; seg++) {
-		const struct iovec *iv = &iovp[seg];
-
-		/*
-		 * If any segment has a negative length, or the cumulative
-		 * length ever wraps negative then return -EINVAL.
-		 */
-		size += iv->iov_len;
-		if (unlikely((ssize_t)(size|iv->iov_len) < 0))
-			return XFS_ERROR(-EINVAL);
-	}
-	/* END copy & waste from filemap.c */
-
-	if (size == 0)
-		return 0;
-
-	io = &xip->i_iocore;
-	mp = io->io_mount;
-
-	if (XFS_FORCED_SHUTDOWN(mp)) {
-		return -EIO;
-	}
-
-	if (ioflags & IO_ISDIRECT) {
-		xfs_buftarg_t	*target =
-			(xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
-				mp->m_rtdev_targp : mp->m_ddev_targp;
-
-		if ((*offset & target->pbr_smask) ||
-		    (size & target->pbr_smask)) {
-			return XFS_ERROR(-EINVAL);
-		}
-		iolock = XFS_IOLOCK_SHARED;
-		locktype = VRWLOCK_WRITE_DIRECT;
-	} else {
-		iolock = XFS_IOLOCK_EXCL;
-		locktype = VRWLOCK_WRITE;
-	}
-
-	xfs_ilock(xip, XFS_ILOCK_EXCL|iolock);
-
-	isize = xip->i_d.di_size;
-	limit = XFS_MAXIOFFSET(mp);
-
-	if (file->f_flags & O_APPEND)
-		*offset = isize;
-
-start:
-	n = limit - *offset;
-	if (n <= 0) {
-		xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
-		return -EFBIG;
-	}
-
-	if (n < size)
-		size = n;
-
-	new_size = *offset + size;
-	if (new_size > isize) {
-		io->io_new_size = new_size;
-	}
-
-	if ((DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_WRITE) &&
-	    !(ioflags & IO_INVIS) && !eventsent)) {
-		loff_t		savedsize = *offset;
-		int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
-
-		xfs_iunlock(xip, XFS_ILOCK_EXCL);
-		error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, vp,
-				      *offset, size,
-				      dmflags, &locktype);
-		if (error) {
-			xfs_iunlock(xip, iolock);
-			return -error;
-		}
-		xfs_ilock(xip, XFS_ILOCK_EXCL);
-		eventsent = 1;
-
-		/*
-		 * The iolock was dropped and reaquired in XFS_SEND_DATA
-		 * so we have to recheck the size when appending.
-		 * We will only "goto start;" once, since having sent the
-		 * event prevents another call to XFS_SEND_DATA, which is
-		 * what allows the size to change in the first place.
-		 */
-		if ((file->f_flags & O_APPEND) &&
-		    savedsize != xip->i_d.di_size) {
-			*offset = isize = xip->i_d.di_size;
-			goto start;
-		}
-	}
-
-	/*
-	 * On Linux, generic_file_write updates the times even if
-	 * no data is copied in so long as the write had a size.
-	 *
-	 * We must update xfs' times since revalidate will overcopy xfs.
-	 */
-	if (size && !(ioflags & IO_INVIS))
-		xfs_ichgtime(xip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
-
-	/*
-	 * If the offset is beyond the size of the file, we have a couple
-	 * of things to do. First, if there is already space allocated
-	 * we need to either create holes or zero the disk or ...
-	 *
-	 * If there is a page where the previous size lands, we need
-	 * to zero it out up to the new size.
-	 */
-
-	if (!(ioflags & IO_ISDIRECT) && (*offset > isize && isize)) {
-		error = xfs_zero_eof(BHV_TO_VNODE(bdp), io, *offset,
-			isize, *offset + size);
-		if (error) {
-			xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
-			return(-error);
-		}
-	}
-	xfs_iunlock(xip, XFS_ILOCK_EXCL);
-
-	/*
-	 * If we're writing the file then make sure to clear the
-	 * setuid and setgid bits if the process is not being run
-	 * by root.  This keeps people from modifying setuid and
-	 * setgid binaries.
-	 */
-
-	if (((xip->i_d.di_mode & S_ISUID) ||
-	    ((xip->i_d.di_mode & (S_ISGID | S_IXGRP)) ==
-		(S_ISGID | S_IXGRP))) &&
-	     !capable(CAP_FSETID)) {
-		error = xfs_write_clear_setuid(xip);
-		if (error) {
-			xfs_iunlock(xip, iolock);
-			return -error;
-		}
-	}
-
-retry:
-	if (ioflags & IO_ISDIRECT) {
-		xfs_inval_cached_pages(vp, io, *offset, 1, 1);
-		xfs_rw_enter_trace(XFS_DIOWR_ENTER,
-				io, iovp, segs, *offset, ioflags);
-	} else {
-		xfs_rw_enter_trace(XFS_WRITE_ENTER,
-				io, iovp, segs, *offset, ioflags);
-	}
-	ret = generic_file_aio_write_nolock(iocb, iovp, segs, offset);
-
-	if ((ret == -ENOSPC) &&
-	    DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_NOSPACE) &&
-	    !(ioflags & IO_INVIS)) {
-
-		xfs_rwunlock(bdp, locktype);
-		error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
-				DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL,
-				0, 0, 0); /* Delay flag intentionally  unused */
-		if (error)
-			return -error;
-		xfs_rwlock(bdp, locktype);
-		*offset = xip->i_d.di_size;
-		goto retry;
-	}
-
-	if (*offset > xip->i_d.di_size) {
-		xfs_ilock(xip, XFS_ILOCK_EXCL);
-		if (*offset > xip->i_d.di_size) {
-			struct inode	*inode = LINVFS_GET_IP(vp);
-
-			xip->i_d.di_size = *offset;
-			i_size_write(inode, *offset);
-			xip->i_update_core = 1;
-			xip->i_update_size = 1;
-		}
-		xfs_iunlock(xip, XFS_ILOCK_EXCL);
-	}
-
-	if (ret <= 0) {
-		xfs_rwunlock(bdp, locktype);
-		return ret;
-	}
-
-	XFS_STATS_ADD(xs_write_bytes, ret);
-
-	/* Handle various SYNC-type writes */
-	if ((file->f_flags & O_SYNC) || IS_SYNC(file->f_dentry->d_inode)) {
-
-		/*
-		 * If we're treating this as O_DSYNC and we have not updated the
-		 * size, force the log.
-		 */
-
-		if (!(mp->m_flags & XFS_MOUNT_OSYNCISOSYNC)
-			&& !(xip->i_update_size)) {
-			/*
-			 * If an allocation transaction occurred
-			 * without extending the size, then we have to force
-			 * the log up the proper point to ensure that the
-			 * allocation is permanent.  We can't count on
-			 * the fact that buffered writes lock out direct I/O
-			 * writes - the direct I/O write could have extended
-			 * the size nontransactionally, then finished before
-			 * we started.  xfs_write_file will think that the file
-			 * didn't grow but the update isn't safe unless the
-			 * size change is logged.
-			 *
-			 * Force the log if we've committed a transaction
-			 * against the inode or if someone else has and
-			 * the commit record hasn't gone to disk (e.g.
-			 * the inode is pinned).  This guarantees that
-			 * all changes affecting the inode are permanent
-			 * when we return.
-			 */
-
-			xfs_inode_log_item_t *iip;
-			xfs_lsn_t lsn;
-
-			iip = xip->i_itemp;
-			if (iip && iip->ili_last_lsn) {
-				lsn = iip->ili_last_lsn;
-				xfs_log_force(mp, lsn,
-						XFS_LOG_FORCE | XFS_LOG_SYNC);
-			} else if (xfs_ipincount(xip) > 0) {
-				xfs_log_force(mp, (xfs_lsn_t)0,
-						XFS_LOG_FORCE | XFS_LOG_SYNC);
-			}
-
-		} else {
-			xfs_trans_t	*tp;
-
-			/*
-			 * O_SYNC or O_DSYNC _with_ a size update are handled
-			 * the same way.
-			 *
-			 * If the write was synchronous then we need to make
-			 * sure that the inode modification time is permanent.
-			 * We'll have updated the timestamp above, so here
-			 * we use a synchronous transaction to log the inode.
-			 * It's not fast, but it's necessary.
-			 *
-			 * If this a dsync write and the size got changed
-			 * non-transactionally, then we need to ensure that
-			 * the size change gets logged in a synchronous
-			 * transaction.
-			 */
-
-			tp = xfs_trans_alloc(mp, XFS_TRANS_WRITE_SYNC);
-			if ((error = xfs_trans_reserve(tp, 0,
-						      XFS_SWRITE_LOG_RES(mp),
-						      0, 0, 0))) {
-				/* Transaction reserve failed */
-				xfs_trans_cancel(tp, 0);
-			} else {
-				/* Transaction reserve successful */
-				xfs_ilock(xip, XFS_ILOCK_EXCL);
-				xfs_trans_ijoin(tp, xip, XFS_ILOCK_EXCL);
-				xfs_trans_ihold(tp, xip);
-				xfs_trans_log_inode(tp, xip, XFS_ILOG_CORE);
-				xfs_trans_set_sync(tp);
-				error = xfs_trans_commit(tp, 0, (xfs_lsn_t)0);
-				xfs_iunlock(xip, XFS_ILOCK_EXCL);
-			}
-		}
-	} /* (ioflags & O_SYNC) */
-
-	xfs_rwunlock(bdp, locktype);
-	return(ret);
-}
-
-/*
- * All xfs metadata buffers except log state machine buffers
- * get this attached as their b_bdstrat callback function.
- * This is so that we can catch a buffer
- * after prematurely unpinning it to forcibly shutdown the filesystem.
- */
-int
-xfs_bdstrat_cb(struct xfs_buf *bp)
-{
-	xfs_mount_t	*mp;
-
-	mp = XFS_BUF_FSPRIVATE3(bp, xfs_mount_t *);
-	if (!XFS_FORCED_SHUTDOWN(mp)) {
-		pagebuf_iorequest(bp);
-		return 0;
-	} else {
-		xfs_buftrace("XFS__BDSTRAT IOERROR", bp);
-		/*
-		 * Metadata write that didn't get logged but
-		 * written delayed anyway. These aren't associated
-		 * with a transaction, and can be ignored.
-		 */
-		if (XFS_BUF_IODONE_FUNC(bp) == NULL &&
-		    (XFS_BUF_ISREAD(bp)) == 0)
-			return (xfs_bioerror_relse(bp));
-		else
-			return (xfs_bioerror(bp));
-	}
-}
-
-
-int
-xfs_bmap(bhv_desc_t	*bdp,
-	xfs_off_t	offset,
-	ssize_t		count,
-	int		flags,
-	xfs_iomap_t	*iomapp,
-	int		*niomaps)
-{
-	xfs_inode_t	*ip = XFS_BHVTOI(bdp);
-	xfs_iocore_t	*io = &ip->i_iocore;
-
-	ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
-	ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
-	       ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
-
-	return xfs_iomap(io, offset, count, flags, iomapp, niomaps);
-}
-
-/*
- * Wrapper around bdstrat so that we can stop data
- * from going to disk in case we are shutting down the filesystem.
- * Typically user data goes thru this path; one of the exceptions
- * is the superblock.
- */
-int
-xfsbdstrat(
-	struct xfs_mount	*mp,
-	struct xfs_buf		*bp)
-{
-	ASSERT(mp);
-	if (!XFS_FORCED_SHUTDOWN(mp)) {
-		/* Grio redirection would go here
-		 * if (XFS_BUF_IS_GRIO(bp)) {
-		 */
-
-		pagebuf_iorequest(bp);
-		return 0;
-	}
-
-	xfs_buftrace("XFSBDSTRAT IOERROR", bp);
-	return (xfs_bioerror_relse(bp));
-}
-
-/*
- * If the underlying (data/log/rt) device is readonly, there are some
- * operations that cannot proceed.
- */
-int
-xfs_dev_is_read_only(
-	xfs_mount_t		*mp,
-	char			*message)
-{
-	if (xfs_readonly_buftarg(mp->m_ddev_targp) ||
-	    xfs_readonly_buftarg(mp->m_logdev_targp) ||
-	    (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) {
-		cmn_err(CE_NOTE,
-			"XFS: %s required on read-only device.", message);
-		cmn_err(CE_NOTE,
-			"XFS: write access unavailable, cannot proceed.");
-		return EROFS;
-	}
-	return 0;
-}
diff -Nru a/fs/xfs/linux/xfs_lrw.h b/fs/xfs/linux/xfs_lrw.h
--- a/fs/xfs/linux/xfs_lrw.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_LRW_H__
-#define __XFS_LRW_H__
-
-struct vnode;
-struct bhv_desc;
-struct xfs_mount;
-struct xfs_iocore;
-struct xfs_inode;
-struct xfs_bmbt_irec;
-struct xfs_buf;
-struct xfs_iomap;
-
-#if defined(XFS_RW_TRACE)
-/*
- * Defines for the trace mechanisms in xfs_lrw.c.
- */
-#define	XFS_RW_KTRACE_SIZE	128
-
-#define	XFS_READ_ENTER		1
-#define	XFS_WRITE_ENTER		2
-#define XFS_IOMAP_READ_ENTER	3
-#define	XFS_IOMAP_WRITE_ENTER	4
-#define	XFS_IOMAP_READ_MAP	5
-#define	XFS_IOMAP_WRITE_MAP	6
-#define	XFS_IOMAP_WRITE_NOSPACE	7
-#define	XFS_ITRUNC_START	8
-#define	XFS_ITRUNC_FINISH1	9
-#define	XFS_ITRUNC_FINISH2	10
-#define	XFS_CTRUNC1		11
-#define	XFS_CTRUNC2		12
-#define	XFS_CTRUNC3		13
-#define	XFS_CTRUNC4		14
-#define	XFS_CTRUNC5		15
-#define	XFS_CTRUNC6		16
-#define	XFS_BUNMAPI		17
-#define	XFS_INVAL_CACHED	18
-#define	XFS_DIORD_ENTER		19
-#define	XFS_DIOWR_ENTER		20
-#define	XFS_SENDFILE_ENTER	21
-#define	XFS_WRITEPAGE_ENTER	22
-#define	XFS_RELEASEPAGE_ENTER	23
-#define	XFS_IOMAP_ALLOC_ENTER	24
-#define	XFS_IOMAP_ALLOC_MAP	25
-#define	XFS_IOMAP_UNWRITTEN	26
-extern void xfs_rw_enter_trace(int, struct xfs_iocore *,
-			const struct iovec *, size_t, loff_t, int);
-extern void xfs_inval_cached_trace(struct xfs_iocore *,
-			xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t);
-#else
-#define xfs_rw_enter_trace(tag, io, iovec, segs, offset, ioflags)
-#define xfs_inval_cached_trace(io, offset, len, first, last)
-#endif
-
-/*
- * Maximum count of bmaps used by read and write paths.
- */
-#define	XFS_MAX_RW_NBMAPS	4
-
-extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
-			struct xfs_iomap *, int *);
-extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
-extern int xfs_bdstrat_cb(struct xfs_buf *);
-
-extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t,
-				xfs_fsize_t, xfs_fsize_t);
-extern void xfs_inval_cached_pages(struct vnode	*, struct xfs_iocore *,
-				xfs_off_t, int, int);
-extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
-				const struct iovec *, unsigned int,
-				loff_t *, int, struct cred *);
-extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
-				const struct iovec *, unsigned int,
-				loff_t *, int, struct cred *);
-extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
-				loff_t *, int, size_t, read_actor_t,
-				void *, struct cred *);
-
-extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
-
-#define XFS_FSB_TO_DB_IO(io,fsb) \
-		(((io)->io_flags & XFS_IOCORE_RT) ? \
-		 XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
-		 XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
-
-#endif	/* __XFS_LRW_H__ */
diff -Nru a/fs/xfs/linux/xfs_stats.c b/fs/xfs/linux/xfs_stats.c
--- a/fs/xfs/linux/xfs_stats.c	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-#include <linux/proc_fs.h>
-
-DEFINE_PER_CPU(struct xfsstats, xfsstats);
-
-STATIC int
-xfs_read_xfsstats(
-	char		*buffer,
-	char		**start,
-	off_t		offset,
-	int		count,
-	int		*eof,
-	void		*data)
-{
-	int		c, i, j, len, val;
-	__uint64_t	xs_xstrat_bytes = 0;
-	__uint64_t	xs_write_bytes = 0;
-	__uint64_t	xs_read_bytes = 0;
-
-	static struct xstats_entry {
-		char	*desc;
-		int	endpoint;
-	} xstats[] = {
-		{ "extent_alloc",	XFSSTAT_END_EXTENT_ALLOC	},
-		{ "abt",		XFSSTAT_END_ALLOC_BTREE		},
-		{ "blk_map",		XFSSTAT_END_BLOCK_MAPPING	},
-		{ "bmbt",		XFSSTAT_END_BLOCK_MAP_BTREE	},
-		{ "dir",		XFSSTAT_END_DIRECTORY_OPS	},
-		{ "trans",		XFSSTAT_END_TRANSACTIONS	},
-		{ "ig",			XFSSTAT_END_INODE_OPS		},
-		{ "log",		XFSSTAT_END_LOG_OPS		},
-		{ "push_ail",		XFSSTAT_END_TAIL_PUSHING	},
-		{ "xstrat",		XFSSTAT_END_WRITE_CONVERT	},
-		{ "rw",			XFSSTAT_END_READ_WRITE_OPS	},
-		{ "attr",		XFSSTAT_END_ATTRIBUTE_OPS	},
-		{ "icluster",		XFSSTAT_END_INODE_CLUSTER	},
-		{ "vnodes",		XFSSTAT_END_VNODE_OPS		},
-		{ "buf",		XFSSTAT_END_BUF			},
-	};
-
-	/* Loop over all stats groups */
-	for (i=j=len = 0; i < sizeof(xstats)/sizeof(struct xstats_entry); i++) {
-		len += sprintf(buffer + len, xstats[i].desc);
-		/* inner loop does each group */
-		while (j < xstats[i].endpoint) {
-			val = 0;
-			/* sum over all cpus */
-			for (c = 0; c < NR_CPUS; c++) {
-				if (!cpu_possible(c)) continue;
-				val += *(((__u32*)&per_cpu(xfsstats, c) + j));
-			}
-			len += sprintf(buffer + len, " %u", val);
-			j++;
-		}
-		buffer[len++] = '\n';
-	}
-	/* extra precision counters */
-	for (i = 0; i < NR_CPUS; i++) {
-		if (!cpu_possible(i)) continue;
-		xs_xstrat_bytes += per_cpu(xfsstats, i).xs_xstrat_bytes;
-		xs_write_bytes += per_cpu(xfsstats, i).xs_write_bytes;
-		xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes;
-	}
-
-	len += sprintf(buffer + len, "xpc %Lu %Lu %Lu\n",
-			xs_xstrat_bytes, xs_write_bytes, xs_read_bytes);
-	len += sprintf(buffer + len, "debug %u\n",
-#if defined(XFSDEBUG)
-		1);
-#else
-		0);
-#endif
-
-	if (offset >= len) {
-		*start = buffer;
-		*eof = 1;
-		return 0;
-	}
-	*start = buffer + offset;
-	if ((len -= offset) > count)
-		return count;
-	*eof = 1;
-
-	return len;
-}
-
-void
-xfs_init_procfs(void)
-{
-	if (!proc_mkdir("fs/xfs", 0))
-		return;
-	create_proc_read_entry("fs/xfs/stat", 0, 0, xfs_read_xfsstats, NULL);
-}
-
-void
-xfs_cleanup_procfs(void)
-{
-	remove_proc_entry("fs/xfs/stat", NULL);
-	remove_proc_entry("fs/xfs", NULL);
-}
diff -Nru a/fs/xfs/linux/xfs_stats.h b/fs/xfs/linux/xfs_stats.h
--- a/fs/xfs/linux/xfs_stats.h	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_STATS_H__
-#define __XFS_STATS_H__
-
-
-#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
-
-#include <linux/percpu.h>
-
-/*
- * XFS global statistics
- */
-struct xfsstats {
-# define XFSSTAT_END_EXTENT_ALLOC	4
-	__uint32_t		xs_allocx;
-	__uint32_t		xs_allocb;
-	__uint32_t		xs_freex;
-	__uint32_t		xs_freeb;
-# define XFSSTAT_END_ALLOC_BTREE	(XFSSTAT_END_EXTENT_ALLOC+4)
-	__uint32_t		xs_abt_lookup;
-	__uint32_t		xs_abt_compare;
-	__uint32_t		xs_abt_insrec;
-	__uint32_t		xs_abt_delrec;
-# define XFSSTAT_END_BLOCK_MAPPING	(XFSSTAT_END_ALLOC_BTREE+7)
-	__uint32_t		xs_blk_mapr;
-	__uint32_t		xs_blk_mapw;
-	__uint32_t		xs_blk_unmap;
-	__uint32_t		xs_add_exlist;
-	__uint32_t		xs_del_exlist;
-	__uint32_t		xs_look_exlist;
-	__uint32_t		xs_cmp_exlist;
-# define XFSSTAT_END_BLOCK_MAP_BTREE	(XFSSTAT_END_BLOCK_MAPPING+4)
-	__uint32_t		xs_bmbt_lookup;
-	__uint32_t		xs_bmbt_compare;
-	__uint32_t		xs_bmbt_insrec;
-	__uint32_t		xs_bmbt_delrec;
-# define XFSSTAT_END_DIRECTORY_OPS	(XFSSTAT_END_BLOCK_MAP_BTREE+4)
-	__uint32_t		xs_dir_lookup;
-	__uint32_t		xs_dir_create;
-	__uint32_t		xs_dir_remove;
-	__uint32_t		xs_dir_getdents;
-# define XFSSTAT_END_TRANSACTIONS	(XFSSTAT_END_DIRECTORY_OPS+3)
-	__uint32_t		xs_trans_sync;
-	__uint32_t		xs_trans_async;
-	__uint32_t		xs_trans_empty;
-# define XFSSTAT_END_INODE_OPS		(XFSSTAT_END_TRANSACTIONS+7)
-	__uint32_t		xs_ig_attempts;
-	__uint32_t		xs_ig_found;
-	__uint32_t		xs_ig_frecycle;
-	__uint32_t		xs_ig_missed;
-	__uint32_t		xs_ig_dup;
-	__uint32_t		xs_ig_reclaims;
-	__uint32_t		xs_ig_attrchg;
-# define XFSSTAT_END_LOG_OPS		(XFSSTAT_END_INODE_OPS+5)
-	__uint32_t		xs_log_writes;
-	__uint32_t		xs_log_blocks;
-	__uint32_t		xs_log_noiclogs;
-	__uint32_t		xs_log_force;
-	__uint32_t		xs_log_force_sleep;
-# define XFSSTAT_END_TAIL_PUSHING	(XFSSTAT_END_LOG_OPS+10)
-	__uint32_t		xs_try_logspace;
-	__uint32_t		xs_sleep_logspace;
-	__uint32_t		xs_push_ail;
-	__uint32_t		xs_push_ail_success;
-	__uint32_t		xs_push_ail_pushbuf;
-	__uint32_t		xs_push_ail_pinned;
-	__uint32_t		xs_push_ail_locked;
-	__uint32_t		xs_push_ail_flushing;
-	__uint32_t		xs_push_ail_restarts;
-	__uint32_t		xs_push_ail_flush;
-# define XFSSTAT_END_WRITE_CONVERT	(XFSSTAT_END_TAIL_PUSHING+2)
-	__uint32_t		xs_xstrat_quick;
-	__uint32_t		xs_xstrat_split;
-# define XFSSTAT_END_READ_WRITE_OPS	(XFSSTAT_END_WRITE_CONVERT+2)
-	__uint32_t		xs_write_calls;
-	__uint32_t		xs_read_calls;
-# define XFSSTAT_END_ATTRIBUTE_OPS	(XFSSTAT_END_READ_WRITE_OPS+4)
-	__uint32_t		xs_attr_get;
-	__uint32_t		xs_attr_set;
-	__uint32_t		xs_attr_remove;
-	__uint32_t		xs_attr_list;
-# define XFSSTAT_END_INODE_CLUSTER	(XFSSTAT_END_ATTRIBUTE_OPS+3)
-	__uint32_t		xs_iflush_count;
-	__uint32_t		xs_icluster_flushcnt;
-	__uint32_t		xs_icluster_flushinode;
-# define XFSSTAT_END_VNODE_OPS		(XFSSTAT_END_INODE_CLUSTER+8)
-	__uint32_t		vn_active;	/* # vnodes not on free lists */
-	__uint32_t		vn_alloc;	/* # times vn_alloc called */
-	__uint32_t		vn_get;		/* # times vn_get called */
-	__uint32_t		vn_hold;	/* # times vn_hold called */
-	__uint32_t		vn_rele;	/* # times vn_rele called */
-	__uint32_t		vn_reclaim;	/* # times vn_reclaim called */
-	__uint32_t		vn_remove;	/* # times vn_remove called */
-	__uint32_t		vn_free;	/* # times vn_free called */
-#define XFSSTAT_END_BUF			(XFSSTAT_END_VNODE_OPS+9)
-	__uint32_t		pb_get;
-	__uint32_t		pb_create;
-	__uint32_t		pb_get_locked;
-	__uint32_t		pb_get_locked_waited;
-	__uint32_t		pb_busy_locked;
-	__uint32_t		pb_miss_locked;
-	__uint32_t		pb_page_retries;
-	__uint32_t		pb_page_found;
-	__uint32_t		pb_get_read;
-/* Extra precision counters */
-	__uint64_t		xs_xstrat_bytes;
-	__uint64_t		xs_write_bytes;
-	__uint64_t		xs_read_bytes;
-};
-
-DECLARE_PER_CPU(struct xfsstats, xfsstats);
-
-/* We don't disable preempt, not too worried about poking the
- * wrong cpu's stat for now */
-#define XFS_STATS_INC(count)		(__get_cpu_var(xfsstats).count++)
-#define XFS_STATS_DEC(count)		(__get_cpu_var(xfsstats).count--)
-#define XFS_STATS_ADD(count, inc)	(__get_cpu_var(xfsstats).count += (inc))
-
-extern void xfs_init_procfs(void);
-extern void xfs_cleanup_procfs(void);
-
-
-#else	/* !CONFIG_PROC_FS */
-
-# define XFS_STATS_INC(count)
-# define XFS_STATS_DEC(count)
-# define XFS_STATS_ADD(count, inc)
-
-static __inline void xfs_init_procfs(void) { };
-static __inline void xfs_cleanup_procfs(void) { };
-
-#endif	/* !CONFIG_PROC_FS */
-
-#endif /* __XFS_STATS_H__ */
diff -Nru a/fs/xfs/linux/xfs_super.c b/fs/xfs/linux/xfs_super.c
--- a/fs/xfs/linux/xfs_super.c	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,850 +0,0 @@
-/*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-
-#include "xfs_inum.h"
-#include "xfs_log.h"
-#include "xfs_clnt.h"
-#include "xfs_trans.h"
-#include "xfs_sb.h"
-#include "xfs_dir.h"
-#include "xfs_dir2.h"
-#include "xfs_alloc.h"
-#include "xfs_dmapi.h"
-#include "xfs_quota.h"
-#include "xfs_mount.h"
-#include "xfs_alloc_btree.h"
-#include "xfs_bmap_btree.h"
-#include "xfs_ialloc_btree.h"
-#include "xfs_btree.h"
-#include "xfs_ialloc.h"
-#include "xfs_attr_sf.h"
-#include "xfs_dir_sf.h"
-#include "xfs_dir2_sf.h"
-#include "xfs_dinode.h"
-#include "xfs_inode.h"
-#include "xfs_bmap.h"
-#include "xfs_bit.h"
-#include "xfs_rtalloc.h"
-#include "xfs_error.h"
-#include "xfs_itable.h"
-#include "xfs_rw.h"
-#include "xfs_acl.h"
-#include "xfs_cap.h"
-#include "xfs_mac.h"
-#include "xfs_attr.h"
-#include "xfs_buf_item.h"
-#include "xfs_utils.h"
-#include "xfs_version.h"
-
-#include <linux/namei.h>
-#include <linux/init.h>
-#include <linux/mount.h>
-#include <linux/suspend.h>
-
-STATIC struct quotactl_ops linvfs_qops;
-STATIC struct super_operations linvfs_sops;
-STATIC struct export_operations linvfs_export_ops;
-STATIC kmem_cache_t * linvfs_inode_cachep;
-
-STATIC struct xfs_mount_args *
-xfs_args_allocate(
-	struct super_block	*sb)
-{
-	struct xfs_mount_args	*args;
-
-	args = kmem_zalloc(sizeof(struct xfs_mount_args), KM_SLEEP);
-	args->logbufs = args->logbufsize = -1;
-	strncpy(args->fsname, sb->s_id, MAXNAMELEN);
-
-	/* Copy the already-parsed mount(2) flags we're interested in */
-	if (sb->s_flags & MS_NOATIME)
-		args->flags |= XFSMNT_NOATIME;
-
-	/* Default to 32 bit inodes on Linux all the time */
-	args->flags |= XFSMNT_32BITINODES;
-
-	return args;
-}
-
-__uint64_t
-xfs_max_file_offset(
-	unsigned int		blockshift)
-{
-	unsigned int		pagefactor = 1;
-	unsigned int		bitshift = BITS_PER_LONG - 1;
-
-	/* Figure out maximum filesize, on Linux this can depend on
-	 * the filesystem blocksize (on 32 bit platforms).
-	 * __block_prepare_write does this in an [unsigned] long...
-	 *      page->index << (PAGE_CACHE_SHIFT - bbits)
-	 * So, for page sized blocks (4K on 32 bit platforms),
-	 * this wraps at around 8Tb (hence MAX_LFS_FILESIZE which is
-	 *      (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
-	 * but for smaller blocksizes it is less (bbits = log2 bsize).
-	 * Note1: get_block_t takes a long (implicit cast from above)
-	 * Note2: The Large Block Device (LBD and HAVE_SECTOR_T) patch
-	 * can optionally convert the [unsigned] long from above into
-	 * an [unsigned] long long.
-	 */
-
-#if BITS_PER_LONG == 32
-# if defined(CONFIG_LBD)
-	ASSERT(sizeof(sector_t) == 8);
-	pagefactor = PAGE_CACHE_SIZE;
-	bitshift = BITS_PER_LONG;
-# else
-	pagefactor = PAGE_CACHE_SIZE >> (PAGE_CACHE_SHIFT - blockshift);
-# endif
-#endif
-
-	return (((__uint64_t)pagefactor) << bitshift) - 1;
-}
-
-STATIC __inline__ void
-xfs_set_inodeops(
-	struct inode		*inode)
-{
-	vnode_t			*vp = LINVFS_GET_VP(inode);
-
-	if (vp->v_type == VNON) {
-		make_bad_inode(inode);
-	} else if (S_ISREG(inode->i_mode)) {
-		inode->i_op = &linvfs_file_inode_operations;
-		inode->i_fop = &linvfs_file_operations;
-		inode->i_mapping->a_ops = &linvfs_aops;
-	} else if (S_ISDIR(inode->i_mode)) {
-		inode->i_op = &linvfs_dir_inode_operations;
-		inode->i_fop = &linvfs_dir_operations;
-	} else if (S_ISLNK(inode->i_mode)) {
-		inode->i_op = &linvfs_symlink_inode_operations;
-		if (inode->i_blocks)
-			inode->i_mapping->a_ops = &linvfs_aops;
-	} else {
-		inode->i_op = &linvfs_file_inode_operations;
-		init_special_inode(inode, inode->i_mode, inode->i_rdev);
-	}
-}
-
-STATIC __inline__ void
-xfs_revalidate_inode(
-	xfs_mount_t		*mp,
-	vnode_t			*vp,
-	xfs_inode_t		*ip)
-{
-	struct inode		*inode = LINVFS_GET_IP(vp);
-
-	inode->i_mode	= (ip->i_d.di_mode & MODEMASK) | VTTOIF(vp->v_type);
-	inode->i_nlink	= ip->i_d.di_nlink;
-	inode->i_uid	= ip->i_d.di_uid;
-	inode->i_gid	= ip->i_d.di_gid;
-	if (((1 << vp->v_type) & ((1<<VBLK) | (1<<VCHR))) == 0) {
-		inode->i_rdev = 0;
-	} else {
-		xfs_dev_t dev = ip->i_df.if_u2.if_rdev;
-		inode->i_rdev = MKDEV(sysv_major(dev) & 0x1ff, sysv_minor(dev));
-	}
-	inode->i_blksize = PAGE_CACHE_SIZE;
-	inode->i_generation = ip->i_d.di_gen;
-	i_size_write(inode, ip->i_d.di_size);
-	inode->i_blocks =
-		XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
-	inode->i_atime.tv_sec	= ip->i_d.di_atime.t_sec;
-	inode->i_atime.tv_nsec	= ip->i_d.di_atime.t_nsec;
-	inode->i_mtime.tv_sec	= ip->i_d.di_mtime.t_sec;
-	inode->i_mtime.tv_nsec	= ip->i_d.di_mtime.t_nsec;
-	inode->i_ctime.tv_sec	= ip->i_d.di_ctime.t_sec;
-	inode->i_ctime.tv_nsec	= ip->i_d.di_ctime.t_nsec;
-	if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
-		inode->i_flags |= S_IMMUTABLE;
-	else
-		inode->i_flags &= ~S_IMMUTABLE;
-	if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
-		inode->i_flags |= S_APPEND;
-	else
-		inode->i_flags &= ~S_APPEND;
-	if (ip->i_d.di_flags & XFS_DIFLAG_SYNC)
-		inode->i_flags |= S_SYNC;
-	else
-		inode->i_flags &= ~S_SYNC;
-	if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME)
-		inode->i_flags |= S_NOATIME;
-	else
-		inode->i_flags &= ~S_NOATIME;
-	vp->v_flag &= ~VMODIFIED;
-}
-
-void
-xfs_initialize_vnode(
-	bhv_desc_t		*bdp,
-	vnode_t			*vp,
-	bhv_desc_t		*inode_bhv,
-	int			unlock)
-{
-	xfs_inode_t		*ip = XFS_BHVTOI(inode_bhv);
-	struct inode		*inode = LINVFS_GET_IP(vp);
-
-	if (!inode_bhv->bd_vobj) {
-		vp->v_vfsp = bhvtovfs(bdp);
-		bhv_desc_init(inode_bhv, ip, vp, &xfs_vnodeops);
-		bhv_insert(VN_BHV_HEAD(vp), inode_bhv);
-	}
-
-	vp->v_type = IFTOVT(ip->i_d.di_mode);
-
-	/* Have we been called during the new inode create process,
-	 * in which case we are too early to fill in the Linux inode.
-	 */
-	if (vp->v_type == VNON)
-		return;
-
-	xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip);
-
-	/* For new inodes we need to set the ops vectors,
-	 * and unlock the inode.
-	 */
-	if (unlock && (inode->i_state & I_NEW)) {
-		xfs_set_inodeops(inode);
-		unlock_new_inode(inode);
-	}
-}
-
-void
-xfs_flush_inode(
-	xfs_inode_t	*ip)
-{
-	struct inode	*inode = LINVFS_GET_IP(XFS_ITOV(ip));
-
-	filemap_flush(inode->i_mapping);
-}
-
-void
-xfs_flush_device(
-	xfs_inode_t	*ip)
-{
-	sync_blockdev(XFS_ITOV(ip)->v_vfsp->vfs_super->s_bdev);
-	xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
-}
-
-int
-xfs_blkdev_get(
-	xfs_mount_t		*mp,
-	const char		*name,
-	struct block_device	**bdevp)
-{
-	int			error = 0;
-
-	*bdevp = open_bdev_excl(name, 0, mp);
-	if (IS_ERR(*bdevp)) {
-		error = PTR_ERR(*bdevp);
-		printk("XFS: Invalid device [%s], error=%d\n", name, error);
-	}
-
-	return -error;
-}
-
-void
-xfs_blkdev_put(
-	struct block_device	*bdev)
-{
-	if (bdev)
-		close_bdev_excl(bdev);
-}
-
-
-STATIC struct inode *
-linvfs_alloc_inode(
-	struct super_block	*sb)
-{
-	vnode_t			*vp;
-
-	vp = (vnode_t *)kmem_cache_alloc(linvfs_inode_cachep, 
-                kmem_flags_convert(KM_SLEEP));
-	if (!vp)
-		return NULL;
-	return LINVFS_GET_IP(vp);
-}
-
-STATIC void
-linvfs_destroy_inode(
-	struct inode		*inode)
-{
-	kmem_cache_free(linvfs_inode_cachep, LINVFS_GET_VP(inode));
-}
-
-STATIC void
-init_once(
-	void			*data,
-	kmem_cache_t		*cachep,
-	unsigned long		flags)
-{
-	vnode_t			*vp = (vnode_t *)data;
-
-	if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
-	    SLAB_CTOR_CONSTRUCTOR)
-		inode_init_once(LINVFS_GET_IP(vp));
-}
-
-STATIC int
-init_inodecache( void )
-{
-	linvfs_inode_cachep = kmem_cache_create("linvfs_icache",
-				sizeof(vnode_t), 0,
-				SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
-				init_once, NULL);
-
-	if (linvfs_inode_cachep == NULL)
-		return -ENOMEM;
-	return 0;
-}
-
-STATIC void
-destroy_inodecache( void )
-{
-	if (kmem_cache_destroy(linvfs_inode_cachep))
-		printk(KERN_WARNING "%s: cache still in use!\n", __FUNCTION__);
-}
-
-/*
- * Attempt to flush the inode, this will actually fail
- * if the inode is pinned, but we dirty the inode again
- * at the point when it is unpinned after a log write,
- * since this is when the inode itself becomes flushable. 
- */
-STATIC void
-linvfs_write_inode(
-	struct inode		*inode,
-	int			sync)
-{
-	vnode_t			*vp = LINVFS_GET_VP(inode);
-	int			error, flags = FLUSH_INODE;
-
-	if (vp) {
-		vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
-		if (sync)
-			flags |= FLUSH_SYNC;
-		VOP_IFLUSH(vp, flags, error);
-	}
-}
-
-STATIC void
-linvfs_clear_inode(
-	struct inode		*inode)
-{
-	vnode_t			*vp = LINVFS_GET_VP(inode);
-
-	if (vp) {
-		vn_rele(vp);
-		vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
-		/*
-		 * Do all our cleanup, and remove this vnode.
-		 */
-		vn_remove(vp);
-	}
-}
-
-
-#define SYNCD_FLAGS	(SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR)
-
-STATIC int
-xfssyncd(
-	void			*arg)
-{
-	vfs_t			*vfsp = (vfs_t *) arg;
-	int			error;
-
-	daemonize("xfssyncd");
-
-	vfsp->vfs_sync_task = current;
-	wmb();
-	wake_up(&vfsp->vfs_wait_sync_task);
-
-	for (;;) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(xfs_syncd_interval);
-		/* swsusp */
-		if (current->flags & PF_FREEZE)
-			refrigerator(PF_FREEZE);
-		if (vfsp->vfs_flag & VFS_UMOUNT)
-			break;
-		if (vfsp->vfs_flag & VFS_RDONLY)
-			continue;
-		VFS_SYNC(vfsp, SYNCD_FLAGS, NULL, error);
-	}
-
-	vfsp->vfs_sync_task = NULL;
-	wmb();
-	wake_up(&vfsp->vfs_wait_sync_task);
-
-	return 0;
-}
-
-STATIC int
-linvfs_start_syncd(
-	vfs_t			*vfsp)
-{
-	int			pid;
-
-	pid = kernel_thread(xfssyncd, (void *) vfsp,
-			CLONE_VM | CLONE_FS | CLONE_FILES);
-	if (pid < 0)
-		return -pid;
-	wait_event(vfsp->vfs_wait_sync_task, vfsp->vfs_sync_task);
-	return 0;
-}
-
-STATIC void
-linvfs_stop_syncd(
-	vfs_t			*vfsp)
-{
-	vfsp->vfs_flag |= VFS_UMOUNT;
-	wmb();
-
-	wake_up_process(vfsp->vfs_sync_task);
-	wait_event(vfsp->vfs_wait_sync_task, !vfsp->vfs_sync_task);
-}
-
-STATIC void
-linvfs_put_super(
-	struct super_block	*sb)
-{
-	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
-	int			error;
-
-	linvfs_stop_syncd(vfsp);
-	VFS_SYNC(vfsp, SYNC_ATTR|SYNC_DELWRI, NULL, error);
-	if (!error)
-		VFS_UNMOUNT(vfsp, 0, NULL, error);
-	if (error) {
-		printk("XFS unmount got error %d\n", error);
-		printk("%s: vfsp/0x%p left dangling!\n", __FUNCTION__, vfsp);
-		return;
-	}
-
-	vfs_deallocate(vfsp);
-}
-
-STATIC void
-linvfs_write_super(
-	struct super_block	*sb)
-{
-	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
-	int			error;
-
-	if (sb->s_flags & MS_RDONLY) {
-		sb->s_dirt = 0; /* paranoia */
-		return;
-	}
-	/* Push the log and superblock a little */
-	VFS_SYNC(vfsp, SYNC_FSDATA, NULL, error);
-	sb->s_dirt = 0;
-}
-
-STATIC int
-linvfs_sync_super(
-	struct super_block	*sb,
-	int			wait)
-{
-	vfs_t		*vfsp = LINVFS_GET_VFS(sb);
-	int		error;
-	int		flags = SYNC_FSDATA;
-
-	if (wait)
-		flags |= SYNC_WAIT;
-
-	VFS_SYNC(vfsp, flags, NULL, error);
-	sb->s_dirt = 0;
-
-	return -error;
-}
-
-STATIC int
-linvfs_statfs(
-	struct super_block	*sb,
-	struct kstatfs		*statp)
-{
-	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
-	int			error;
-
-	VFS_STATVFS(vfsp, statp, NULL, error);
-	return -error;
-}
-
-STATIC int
-linvfs_remount(
-	struct super_block	*sb,
-	int			*flags,
-	char			*options)
-{
-	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
-	struct xfs_mount_args	*args = xfs_args_allocate(sb);
-	int			error;
-
-	VFS_PARSEARGS(vfsp, options, args, 1, error);
-	if (!error)
-		VFS_MNTUPDATE(vfsp, flags, args, error);
-	kmem_free(args, sizeof(*args));
-	return -error;
-}
-
-STATIC void
-linvfs_freeze_fs(
-	struct super_block	*sb)
-{
-	VFS_FREEZE(LINVFS_GET_VFS(sb));
-}
-
-STATIC struct dentry *
-linvfs_get_parent(
-	struct dentry		*child)
-{
-	int			error;
-	vnode_t			*vp, *cvp;
-	struct dentry		*parent;
-	struct inode		*ip = NULL;
-	struct dentry		dotdot;
-
-	dotdot.d_name.name = "..";
-	dotdot.d_name.len = 2;
-	dotdot.d_inode = 0;
-
-	cvp = NULL;
-	vp = LINVFS_GET_VP(child->d_inode);
-	VOP_LOOKUP(vp, &dotdot, &cvp, 0, NULL, NULL, error);
-
-	if (!error) {
-		ASSERT(cvp);
-		ip = LINVFS_GET_IP(cvp);
-		if (!ip) {
-			VN_RELE(cvp);
-			return ERR_PTR(-EACCES);
-		}
-	}
-	if (error)
-		return ERR_PTR(-error);
-	parent = d_alloc_anon(ip);
-	if (!parent) {
-		VN_RELE(cvp);
-		parent = ERR_PTR(-ENOMEM);
-	}
-	return parent;
-}
-
-STATIC struct dentry *
-linvfs_get_dentry(
-	struct super_block	*sb,
-	void			*data)
-{
-	vnode_t			*vp;
-	struct inode		*inode;
-	struct dentry		*result;
-	xfs_fid2_t		xfid;
-	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
-	int			error;
-
-	xfid.fid_len = sizeof(xfs_fid2_t) - sizeof(xfid.fid_len);
-	xfid.fid_pad = 0;
-	xfid.fid_gen = ((__u32 *)data)[1];
-	xfid.fid_ino = ((__u32 *)data)[0];
-
-	VFS_VGET(vfsp, &vp, (fid_t *)&xfid, error);
-	if (error || vp == NULL)
-		return ERR_PTR(-ESTALE) ;
-
-	inode = LINVFS_GET_IP(vp);
-	result = d_alloc_anon(inode);
-        if (!result) {
-		iput(inode);
-		return ERR_PTR(-ENOMEM);
-	}
-	return result;
-}
-
-STATIC int
-linvfs_show_options(
-	struct seq_file		*m,
-	struct vfsmount		*mnt)
-{
-	struct vfs		*vfsp = LINVFS_GET_VFS(mnt->mnt_sb);
-	int			error;
-
-	VFS_SHOWARGS(vfsp, m, error);
-	return error;
-}
-
-STATIC int
-linvfs_getxstate(
-	struct super_block	*sb,
-	struct fs_quota_stat	*fqs)
-{
-	struct vfs		*vfsp = LINVFS_GET_VFS(sb);
-	int			error;
-
-	VFS_QUOTACTL(vfsp, Q_XGETQSTAT, 0, (caddr_t)fqs, error);
-	return -error;
-}
-
-STATIC int
-linvfs_setxstate(
-	struct super_block	*sb,
-	unsigned int		flags,
-	int			op)
-{
-	struct vfs		*vfsp = LINVFS_GET_VFS(sb);
-	int			error;
-
-	VFS_QUOTACTL(vfsp, op, 0, (caddr_t)&flags, error);
-	return -error;
-}
-
-STATIC int
-linvfs_getxquota(
-	struct super_block	*sb,
-	int			type,
-	qid_t			id,
-	struct fs_disk_quota	*fdq)
-{
-	struct vfs		*vfsp = LINVFS_GET_VFS(sb);
-	int			error, getmode;
-
-	getmode = (type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETQUOTA;
-	VFS_QUOTACTL(vfsp, getmode, id, (caddr_t)fdq, error);
-	return -error;
-}
-
-STATIC int
-linvfs_setxquota(
-	struct super_block	*sb,
-	int			type,
-	qid_t			id,
-	struct fs_disk_quota	*fdq)
-{
-	struct vfs		*vfsp = LINVFS_GET_VFS(sb);
-	int			error, setmode;
-
-	setmode = (type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETQLIM;
-	VFS_QUOTACTL(vfsp, setmode, id, (caddr_t)fdq, error);
-	return -error;
-}
-
-STATIC int
-linvfs_fill_super(
-	struct super_block	*sb,
-	void			*data,
-	int			silent)
-{
-	vnode_t			*rootvp;
-	struct vfs		*vfsp = vfs_allocate();
-	struct xfs_mount_args	*args = xfs_args_allocate(sb);
-	struct kstatfs		statvfs;
-	int			error, error2;
-
-	vfsp->vfs_super = sb;
-	LINVFS_SET_VFS(sb, vfsp);
-	if (sb->s_flags & MS_RDONLY)
-		vfsp->vfs_flag |= VFS_RDONLY;
-	bhv_insert_all_vfsops(vfsp);
-
-	VFS_PARSEARGS(vfsp, (char *)data, args, 0, error);
-	if (error) {
-		bhv_remove_all_vfsops(vfsp, 1);
-		goto fail_vfsop;
-	}
-
-	sb_min_blocksize(sb, BBSIZE);
-	sb->s_export_op = &linvfs_export_ops;
-	sb->s_qcop = &linvfs_qops;
-	sb->s_op = &linvfs_sops;
-
-	VFS_MOUNT(vfsp, args, NULL, error);
-	if (error) {
-		bhv_remove_all_vfsops(vfsp, 1);
-		goto fail_vfsop;
-	}
-
-	VFS_STATVFS(vfsp, &statvfs, NULL, error);
-	if (error)
-		goto fail_unmount;
-
-	sb->s_dirt = 1;
-	sb->s_magic = statvfs.f_type;
-	sb->s_blocksize = statvfs.f_bsize;
-	sb->s_blocksize_bits = ffs(statvfs.f_bsize) - 1;
-	sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits);
-	set_posix_acl_flag(sb);
-
-	VFS_ROOT(vfsp, &rootvp, error);
-	if (error)
-		goto fail_unmount;
-
-	sb->s_root = d_alloc_root(LINVFS_GET_IP(rootvp));
-	if (!sb->s_root) {
-		error = ENOMEM;
-		goto fail_vnrele;
-	}
-	if (is_bad_inode(sb->s_root->d_inode)) {
-		error = EINVAL;
-		goto fail_vnrele;
-	}
-	if ((error = linvfs_start_syncd(vfsp)))
-		goto fail_vnrele;
-	vn_trace_exit(rootvp, __FUNCTION__, (inst_t *)__return_address);
-
-	kmem_free(args, sizeof(*args));
-	return 0;
-
-fail_vnrele:
-	if (sb->s_root) {
-		dput(sb->s_root);
-		sb->s_root = NULL;
-	} else {
-		VN_RELE(rootvp);
-	}
-
-fail_unmount:
-	VFS_UNMOUNT(vfsp, 0, NULL, error2);
-
-fail_vfsop:
-	vfs_deallocate(vfsp);
-	kmem_free(args, sizeof(*args));
-	return -error;
-}
-
-STATIC struct super_block *
-linvfs_get_sb(
-	struct file_system_type	*fs_type,
-	int			flags,
-	const char		*dev_name,
-	void			*data)
-{
-	return get_sb_bdev(fs_type, flags, dev_name, data, linvfs_fill_super);
-}
-
-
-STATIC struct export_operations linvfs_export_ops = {
-	.get_parent		= linvfs_get_parent,
-	.get_dentry		= linvfs_get_dentry,
-};
-
-STATIC struct super_operations linvfs_sops = {
-	.alloc_inode		= linvfs_alloc_inode,
-	.destroy_inode		= linvfs_destroy_inode,
-	.write_inode		= linvfs_write_inode,
-	.clear_inode		= linvfs_clear_inode,
-	.put_super		= linvfs_put_super,
-	.write_super		= linvfs_write_super,
-	.sync_fs		= linvfs_sync_super,
-	.write_super_lockfs	= linvfs_freeze_fs,
-	.statfs			= linvfs_statfs,
-	.remount_fs		= linvfs_remount,
-	.show_options		= linvfs_show_options,
-};
-
-STATIC struct quotactl_ops linvfs_qops = {
-	.get_xstate		= linvfs_getxstate,
-	.set_xstate		= linvfs_setxstate,
-	.get_xquota		= linvfs_getxquota,
-	.set_xquota		= linvfs_setxquota,
-};
-
-STATIC struct file_system_type xfs_fs_type = {
-	.owner			= THIS_MODULE,
-	.name			= "xfs",
-	.get_sb			= linvfs_get_sb,
-	.kill_sb		= kill_block_super,
-	.fs_flags		= FS_REQUIRES_DEV,
-};
-
-
-STATIC int __init
-init_xfs_fs( void )
-{
-	int			error;
-	struct sysinfo		si;
-	static char		message[] __initdata = KERN_INFO \
-		XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
-
-	printk(message);
-
-	si_meminfo(&si);
-	xfs_physmem = si.totalram;
-
-	ktrace_init(64);
-
-	error = init_inodecache();
-	if (error < 0)
-		goto undo_inodecache;
-
-	error = pagebuf_init();
-	if (error < 0)
-		goto undo_pagebuf;
-
-	vn_init();
-	xfs_init();
-	uuid_init();
-	vfs_initdmapi();
-	vfs_initquota();
-
-	error = register_filesystem(&xfs_fs_type);
-	if (error)
-		goto undo_register;
-	return 0;
-
-undo_register:
-	pagebuf_terminate();
-
-undo_pagebuf:
-	destroy_inodecache();
-
-undo_inodecache:
-	return error;
-}
-
-STATIC void __exit
-exit_xfs_fs( void )
-{
-	vfs_exitquota();
-	vfs_exitdmapi();
-	unregister_filesystem(&xfs_fs_type);
-	xfs_cleanup();
-	pagebuf_terminate();
-	destroy_inodecache();
-	ktrace_uninit();
-}
-
-module_init(init_xfs_fs);
-module_exit(exit_xfs_fs);
-
-MODULE_AUTHOR("Silicon Graphics, Inc.");
-MODULE_DESCRIPTION(XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled");
-MODULE_LICENSE("GPL");
diff -Nru a/fs/xfs/linux/xfs_super.h b/fs/xfs/linux/xfs_super.h
--- a/fs/xfs/linux/xfs_super.h	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_SUPER_H__
-#define __XFS_SUPER_H__
-
-#ifdef CONFIG_XFS_DMAPI
-# define vfs_insertdmapi(vfs)	vfs_insertops(vfsp, &xfs_dmops)
-# define vfs_initdmapi()	dmapi_init()
-# define vfs_exitdmapi()	dmapi_uninit()
-#else
-# define vfs_insertdmapi(vfs)	do { } while (0)
-# define vfs_initdmapi()	do { } while (0)
-# define vfs_exitdmapi()	do { } while (0)
-#endif
-
-#ifdef CONFIG_XFS_QUOTA
-# define vfs_insertquota(vfs)	vfs_insertops(vfsp, &xfs_qmops)
-extern void xfs_qm_init(void);
-extern void xfs_qm_exit(void);
-# define vfs_initquota()	xfs_qm_init()
-# define vfs_exitquota()	xfs_qm_exit()
-#else
-# define vfs_insertquota(vfs)	do { } while (0)
-# define vfs_initquota()	do { } while (0)
-# define vfs_exitquota()	do { } while (0)
-#endif
-
-#ifdef CONFIG_XFS_POSIX_ACL
-# define XFS_ACL_STRING		"ACLs, "
-# define set_posix_acl_flag(sb)	((sb)->s_flags |= MS_POSIXACL)
-#else
-# define XFS_ACL_STRING
-# define set_posix_acl_flag(sb)	do { } while (0)
-#endif
-
-#ifdef CONFIG_XFS_SECURITY
-# define XFS_SECURITY_STRING	"security attributes, "
-# define ENOSECURITY		0
-#else
-# define XFS_SECURITY_STRING
-# define ENOSECURITY		EOPNOTSUPP
-#endif
-
-#ifdef CONFIG_XFS_RT
-# define XFS_REALTIME_STRING	"realtime, "
-#else
-# define XFS_REALTIME_STRING
-#endif
-
-#if XFS_BIG_BLKNOS
-# if XFS_BIG_INUMS
-#  define XFS_BIGFS_STRING	"large block/inode numbers, "
-# else
-#  define XFS_BIGFS_STRING	"large block numbers, "
-# endif
-#else
-# define XFS_BIGFS_STRING
-#endif
-
-#ifdef CONFIG_XFS_TRACE
-# define XFS_TRACE_STRING	"tracing, "
-#else
-# define XFS_TRACE_STRING
-#endif
-
-#ifdef XFSDEBUG
-# define XFS_DBG_STRING		"debug"
-#else
-# define XFS_DBG_STRING		"no debug"
-#endif
-
-#define XFS_BUILD_OPTIONS	XFS_ACL_STRING \
-				XFS_SECURITY_STRING \
-				XFS_REALTIME_STRING \
-				XFS_BIGFS_STRING \
-				XFS_TRACE_STRING \
-				XFS_DBG_STRING /* DBG must be last */
-
-#define LINVFS_GET_VFS(s) \
-	(vfs_t *)((s)->s_fs_info)
-#define LINVFS_SET_VFS(s, vfsp) \
-	((s)->s_fs_info = vfsp)
-
-struct xfs_inode;
-struct xfs_mount;
-struct xfs_buftarg;
-struct block_device;
-
-extern __uint64_t xfs_max_file_offset(unsigned int);
-
-extern void xfs_initialize_vnode(bhv_desc_t *, vnode_t *, bhv_desc_t *, int);
-
-extern void xfs_flush_inode(struct xfs_inode *);
-extern void xfs_flush_device(struct xfs_inode *);
-
-extern int  xfs_blkdev_get(struct xfs_mount *, const char *,
-				struct block_device **);
-extern void xfs_blkdev_put(struct block_device *);
-
-#endif	/* __XFS_SUPER_H__ */
diff -Nru a/fs/xfs/linux/xfs_sysctl.c b/fs/xfs/linux/xfs_sysctl.c
--- a/fs/xfs/linux/xfs_sysctl.c	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-#include "xfs_rw.h"
-#include <linux/sysctl.h>
-#include <linux/proc_fs.h>
-
-
-static struct ctl_table_header *xfs_table_header;
-
-
-#ifdef CONFIG_PROC_FS
-STATIC int
-xfs_stats_clear_proc_handler(
-	ctl_table	*ctl,
-	int		write,
-	struct file	*filp,
-	void		*buffer,
-	size_t		*lenp)
-{
-	int		c, ret, *valp = ctl->data;
-	__uint32_t	vn_active;
-
-	ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
-
-	if (!ret && write && *valp) {
-		printk("XFS Clearing xfsstats\n");
-		for (c = 0; c < NR_CPUS; c++) {
-			if (!cpu_possible(c)) continue;
-			preempt_disable();
-			/* save vn_active, it's a universal truth! */
-			vn_active = per_cpu(xfsstats, c).vn_active;
-			memset(&per_cpu(xfsstats, c), 0,
-			       sizeof(struct xfsstats));
-			per_cpu(xfsstats, c).vn_active = vn_active;
-			preempt_enable();
-		}
-		xfs_stats_clear = 0;
-	}
-
-	return ret;
-}
-#endif /* CONFIG_PROC_FS */
-
-STATIC ctl_table xfs_table[] = {
-	{XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL, 
-	&xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
-
-	{XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
-	&xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max},
-
-	{XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL, 
-	&xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
-
-	{XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL, 
-	&xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
-
-	{XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL, 
-	&xfs_params.error_level.min, &xfs_params.error_level.max},
-
-	{XFS_SYNC_INTERVAL, "sync_interval", &xfs_params.sync_interval.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL, 
-	&xfs_params.sync_interval.min, &xfs_params.sync_interval.max},
-
-	{XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
-	&xfs_params.inherit_sync.min, &xfs_params.inherit_sync.max},
-
-	{XFS_INHERIT_NODUMP, "inherit_nodump", &xfs_params.inherit_nodump.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
-	&xfs_params.inherit_nodump.min, &xfs_params.inherit_nodump.max},
-
-	{XFS_INHERIT_NOATIME, "inherit_noatime", &xfs_params.inherit_noatim.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
-	&xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max},
-	
-	{XFS_FLUSH_INTERVAL, "flush_interval", &xfs_params.flush_interval.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
-	&xfs_params.flush_interval.min, &xfs_params.flush_interval.max},
-
-	{XFS_AGE_BUFFER, "age_buffer", &xfs_params.age_buffer.val,
-	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
-	&sysctl_intvec, NULL,
-	&xfs_params.age_buffer.min, &xfs_params.age_buffer.max},
-
-	/* please keep this the last entry */
-#ifdef CONFIG_PROC_FS
-	{XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
-	sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler,
-	&sysctl_intvec, NULL, 
-	&xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
-#endif /* CONFIG_PROC_FS */
-
-	{0}
-};
-
-STATIC ctl_table xfs_dir_table[] = {
-	{FS_XFS, "xfs", NULL, 0, 0555, xfs_table},
-	{0}
-};
-
-STATIC ctl_table xfs_root_table[] = {
-	{CTL_FS, "fs",  NULL, 0, 0555, xfs_dir_table},
-	{0}
-};
-
-void
-xfs_sysctl_register(void)
-{
-	xfs_table_header = register_sysctl_table(xfs_root_table, 1);
-}
-
-void
-xfs_sysctl_unregister(void)
-{
-	if (xfs_table_header)
-		unregister_sysctl_table(xfs_table_header);
-}
diff -Nru a/fs/xfs/linux/xfs_sysctl.h b/fs/xfs/linux/xfs_sysctl.h
--- a/fs/xfs/linux/xfs_sysctl.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#ifndef __XFS_SYSCTL_H__
-#define __XFS_SYSCTL_H__
-
-#include <linux/sysctl.h>
-
-/*
- * Tunable xfs parameters
- */
-
-typedef struct xfs_sysctl_val {
-	int min;
-	int val;
-	int max;
-} xfs_sysctl_val_t;
-
-typedef struct xfs_param {
-	xfs_sysctl_val_t restrict_chown;/* Root/non-root can give away files.*/
-	xfs_sysctl_val_t sgid_inherit;	/* Inherit S_ISGID bit if process' GID 
-					 * is not a member of the parent dir
-					 * GID */
-	xfs_sysctl_val_t symlink_mode;	/* Link creat mode affected by umask */
-	xfs_sysctl_val_t panic_mask;	/* bitmask to cause panic on errors. */
-	xfs_sysctl_val_t error_level;	/* Degree of reporting for problems  */
-	xfs_sysctl_val_t sync_interval;	/* time between sync calls           */
-	xfs_sysctl_val_t stats_clear;	/* Reset all XFS statistics to zero. */
-	xfs_sysctl_val_t inherit_sync;	/* Inherit the "sync" inode flag. */
-	xfs_sysctl_val_t inherit_nodump;/* Inherit the "nodump" inode flag. */
-	xfs_sysctl_val_t inherit_noatim;/* Inherit the "noatime" inode flag. */
-	xfs_sysctl_val_t flush_interval;/* interval between runs of the
-					 * delwri flush daemon.  */
-	xfs_sysctl_val_t age_buffer;	/* time for buffer to age before
-					 * we flush it.  */
-} xfs_param_t;
-
-/*
- * xfs_error_level:
- *
- * How much error reporting will be done when internal problems are
- * encountered.  These problems normally return an EFSCORRUPTED to their
- * caller, with no other information reported.
- *
- * 0	No error reports
- * 1	Report EFSCORRUPTED errors that will cause a filesystem shutdown
- * 5	Report all EFSCORRUPTED errors (all of the above errors, plus any
- *	additional errors that are known to not cause shutdowns)
- *
- * xfs_panic_mask bit 0x8 turns the error reports into panics
- */
-
-enum {
-	XFS_RESTRICT_CHOWN = 3,
-	XFS_SGID_INHERIT = 4,
-	XFS_SYMLINK_MODE = 5,
-	XFS_PANIC_MASK = 6,
-	XFS_ERRLEVEL = 7,
-	XFS_SYNC_INTERVAL = 8,
-	XFS_STATS_CLEAR = 12,
-	XFS_INHERIT_SYNC = 13,
-	XFS_INHERIT_NODUMP = 14,
-	XFS_INHERIT_NOATIME = 15,
-	XFS_FLUSH_INTERVAL = 16,
-	XFS_AGE_BUFFER = 17,
-};
-
-extern xfs_param_t	xfs_params;
-
-#ifdef CONFIG_SYSCTL
-extern void xfs_sysctl_register(void);
-extern void xfs_sysctl_unregister(void);
-#else
-# define xfs_sysctl_register()		do { } while (0)
-# define xfs_sysctl_unregister()	do { } while (0)
-#endif /* CONFIG_SYSCTL */
-
-#endif /* __XFS_SYSCTL_H__ */
diff -Nru a/fs/xfs/linux/xfs_version.h b/fs/xfs/linux/xfs_version.h
--- a/fs/xfs/linux/xfs_version.h	Tue Jun 15 22:21:03 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.	 Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-/*
- * Dummy file that can contain a timestamp to put into the
- * XFS init string, to help users keep track of what they're
- * running
- */
-
-#ifndef __XFS_VERSION_H__
-#define __XFS_VERSION_H__
-
-#define XFS_VERSION_STRING "SGI XFS"
-
-#endif /* __XFS_VERSION_H__ */
diff -Nru a/fs/xfs/linux/xfs_vfs.c b/fs/xfs/linux/xfs_vfs.c
--- a/fs/xfs/linux/xfs_vfs.c	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,327 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-#include "xfs_fs.h"
-#include "xfs_macros.h"
-#include "xfs_inum.h"
-#include "xfs_log.h"
-#include "xfs_clnt.h"
-#include "xfs_trans.h"
-#include "xfs_sb.h"
-#include "xfs_ag.h"
-#include "xfs_dir.h"
-#include "xfs_dir2.h"
-#include "xfs_imap.h"
-#include "xfs_alloc.h"
-#include "xfs_dmapi.h"
-#include "xfs_mount.h"
-#include "xfs_quota.h"
-
-int
-vfs_mount(
-	struct bhv_desc		*bdp,
-	struct xfs_mount_args	*args,
-	struct cred		*cr)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_mount)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_mount)(next, args, cr));
-}
-
-int
-vfs_parseargs(
-	struct bhv_desc		*bdp,
-	char			*s,
-	struct xfs_mount_args	*args,
-	int			f)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_parseargs)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_parseargs)(next, s, args, f));
-}
-
-int
-vfs_showargs(
-	struct bhv_desc		*bdp,
-	struct seq_file		*m)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_showargs)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_showargs)(next, m));
-}
-
-int
-vfs_unmount(
-	struct bhv_desc		*bdp,
-	int			fl,
-	struct cred		*cr)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_unmount)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_unmount)(next, fl, cr));
-}
-
-int
-vfs_mntupdate(
-	struct bhv_desc		*bdp,
-	int			*fl,
-	struct xfs_mount_args	*args)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_mntupdate)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_mntupdate)(next, fl, args));
-}
-
-int
-vfs_root(
-	struct bhv_desc		*bdp,
-	struct vnode		**vpp)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_root)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_root)(next, vpp));
-}
-
-int
-vfs_statvfs(
-	struct bhv_desc		*bdp,
-	xfs_statfs_t		*sp,
-	struct vnode		*vp)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_statvfs)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_statvfs)(next, sp, vp));
-}
-
-int
-vfs_sync(
-	struct bhv_desc		*bdp,
-	int			fl,
-	struct cred		*cr)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_sync)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_sync)(next, fl, cr));
-}
-
-int
-vfs_vget(
-	struct bhv_desc		*bdp,
-	struct vnode		**vpp,
-	struct fid		*fidp)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_vget)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_vget)(next, vpp, fidp));
-}
-
-int
-vfs_dmapiops(
-	struct bhv_desc		*bdp,
-	caddr_t			addr)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_dmapiops)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_dmapiops)(next, addr));
-}
-
-int
-vfs_quotactl(
-	struct bhv_desc		*bdp,
-	int			cmd,
-	int			id,
-	caddr_t			addr)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_quotactl)
-		next = BHV_NEXT(next);
-	return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
-}
-
-void
-vfs_init_vnode(
-	struct bhv_desc		*bdp,
-	struct vnode		*vp,
-	struct bhv_desc		*bp,
-	int			unlock)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_init_vnode)
-		next = BHV_NEXT(next);
-	((*bhvtovfsops(next)->vfs_init_vnode)(next, vp, bp, unlock));
-}
-
-void
-vfs_force_shutdown(
-	struct bhv_desc		*bdp,
-	int			fl,
-	char			*file,
-	int			line)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_force_shutdown)
-		next = BHV_NEXT(next);
-	((*bhvtovfsops(next)->vfs_force_shutdown)(next, fl, file, line));
-}
-
-void
-vfs_freeze(
-	struct bhv_desc		*bdp)
-{
-	struct bhv_desc		*next = bdp;
-
-	ASSERT(next);
-	while (! (bhvtovfsops(next))->vfs_freeze)
-		next = BHV_NEXT(next);
-	((*bhvtovfsops(next)->vfs_freeze)(next));
-}
-
-vfs_t *
-vfs_allocate( void )
-{
-	struct vfs		*vfsp;
-
-	vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
-	bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
-	init_waitqueue_head(&vfsp->vfs_wait_sync_task);
-	return vfsp;
-}
-
-void
-vfs_deallocate(
-	struct vfs		*vfsp)
-{
-	bhv_head_destroy(VFS_BHVHEAD(vfsp));
-	kmem_free(vfsp, sizeof(vfs_t));
-}
-
-void
-vfs_insertops(
-	struct vfs		*vfsp,
-	struct bhv_vfsops	*vfsops)
-{
-	struct bhv_desc		*bdp;
-
-	bdp = kmem_alloc(sizeof(struct bhv_desc), KM_SLEEP);
-	bhv_desc_init(bdp, NULL, vfsp, vfsops);
-	bhv_insert(&vfsp->vfs_bh, bdp);
-}
-
-void
-vfs_insertbhv(
-	struct vfs		*vfsp,
-	struct bhv_desc		*bdp,
-	struct vfsops		*vfsops,
-	void			*mount)
-{
-	bhv_desc_init(bdp, mount, vfsp, vfsops);
-	bhv_insert_initial(&vfsp->vfs_bh, bdp);
-}
-
-void
-bhv_remove_vfsops(
-	struct vfs		*vfsp,
-	int			pos)
-{
-	struct bhv_desc		*bhv;
-
-	bhv = bhv_lookup_range(&vfsp->vfs_bh, pos, pos);
-	if (!bhv)
-		return;
-	bhv_remove(&vfsp->vfs_bh, bhv);
-	kmem_free(bhv, sizeof(*bhv));
-}
-
-void
-bhv_remove_all_vfsops(
-	struct vfs		*vfsp,
-	int			freebase)
-{
-	struct xfs_mount	*mp;
-
-	bhv_remove_vfsops(vfsp, VFS_POSITION_QM);
-	bhv_remove_vfsops(vfsp, VFS_POSITION_DM);
-	if (!freebase)
-		return;
-	mp = XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfsp), &xfs_vfsops));
-	VFS_REMOVEBHV(vfsp, &mp->m_bhv);
-	xfs_mount_free(mp, 0);
-}
-
-void
-bhv_insert_all_vfsops(
-	struct vfs		*vfsp)
-{
-	struct xfs_mount	*mp;
-
-	mp = xfs_mount_init();
-	vfs_insertbhv(vfsp, &mp->m_bhv, &xfs_vfsops, mp);
-	vfs_insertdmapi(vfsp);
-	vfs_insertquota(vfsp);
-}
diff -Nru a/fs/xfs/linux/xfs_vfs.h b/fs/xfs/linux/xfs_vfs.h
--- a/fs/xfs/linux/xfs_vfs.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-#ifndef __XFS_VFS_H__
-#define __XFS_VFS_H__
-
-#include <linux/vfs.h>
-#include "xfs_fs.h"
-
-struct fid;
-struct cred;
-struct vnode;
-struct kstatfs;
-struct seq_file;
-struct super_block;
-struct xfs_mount_args;
-
-typedef struct kstatfs xfs_statfs_t;
-
-typedef struct vfs {
-	u_int			vfs_flag;	/* flags */
-	xfs_fsid_t		vfs_fsid;	/* file system ID */
-	xfs_fsid_t		*vfs_altfsid;	/* An ID fixed for life of FS */
-	bhv_head_t		vfs_bh;		/* head of vfs behavior chain */
-	struct super_block	*vfs_super;	/* Linux superblock structure */
-	struct task_struct	*vfs_sync_task;
-	wait_queue_head_t	vfs_wait_sync_task;
-} vfs_t;
-
-#define vfs_fbhv		vfs_bh.bh_first	/* 1st on vfs behavior chain */
-
-#define bhvtovfs(bdp)		( (struct vfs *)BHV_VOBJ(bdp) )
-#define bhvtovfsops(bdp)	( (struct vfsops *)BHV_OPS(bdp) )
-#define VFS_BHVHEAD(vfs)	( &(vfs)->vfs_bh )
-#define VFS_REMOVEBHV(vfs, bdp)	( bhv_remove(VFS_BHVHEAD(vfs), bdp) )
-
-#define VFS_POSITION_BASE	BHV_POSITION_BASE	/* chain bottom */
-#define VFS_POSITION_TOP	BHV_POSITION_TOP	/* chain top */
-#define VFS_POSITION_INVALID	BHV_POSITION_INVALID	/* invalid pos. num */
-
-typedef enum {
-	VFS_BHV_UNKNOWN,	/* not specified */
-	VFS_BHV_XFS,		/* xfs */
-	VFS_BHV_DM,		/* data migration */
-	VFS_BHV_QM,		/* quota manager */
-	VFS_BHV_IO,		/* IO path */
-	VFS_BHV_END		/* housekeeping end-of-range */
-} vfs_bhv_t;
-
-#define VFS_POSITION_XFS	(BHV_POSITION_BASE)
-#define VFS_POSITION_DM		(VFS_POSITION_BASE+10)
-#define VFS_POSITION_QM		(VFS_POSITION_BASE+20)
-#define VFS_POSITION_IO		(VFS_POSITION_BASE+30)
-
-#define VFS_RDONLY		0x0001	/* read-only vfs */
-#define VFS_GRPID		0x0002	/* group-ID assigned from directory */
-#define VFS_DMI			0x0004	/* filesystem has the DMI enabled */
-#define VFS_UMOUNT		0x0008	/* unmount in progress */
-#define VFS_END			0x0008	/* max flag */
-
-#define SYNC_ATTR		0x0001	/* sync attributes */
-#define SYNC_CLOSE		0x0002	/* close file system down */
-#define SYNC_DELWRI		0x0004	/* look at delayed writes */
-#define SYNC_WAIT		0x0008	/* wait for i/o to complete */
-#define SYNC_BDFLUSH		0x0010	/* BDFLUSH is calling -- don't block */
-#define SYNC_FSDATA		0x0020	/* flush fs data (e.g. superblocks) */
-#define SYNC_REFCACHE		0x0040  /* prune some of the nfs ref cache */
-#define SYNC_REMOUNT		0x0080  /* remount readonly, no dummy LRs */
-
-typedef int	(*vfs_mount_t)(bhv_desc_t *,
-				struct xfs_mount_args *, struct cred *);
-typedef int	(*vfs_parseargs_t)(bhv_desc_t *, char *,
-				struct xfs_mount_args *, int);
-typedef	int	(*vfs_showargs_t)(bhv_desc_t *, struct seq_file *);
-typedef int	(*vfs_unmount_t)(bhv_desc_t *, int, struct cred *);
-typedef int	(*vfs_mntupdate_t)(bhv_desc_t *, int *,
-				struct xfs_mount_args *);
-typedef int	(*vfs_root_t)(bhv_desc_t *, struct vnode **);
-typedef int	(*vfs_statvfs_t)(bhv_desc_t *, xfs_statfs_t *, struct vnode *);
-typedef int	(*vfs_sync_t)(bhv_desc_t *, int, struct cred *);
-typedef int	(*vfs_vget_t)(bhv_desc_t *, struct vnode **, struct fid *);
-typedef int	(*vfs_dmapiops_t)(bhv_desc_t *, caddr_t);
-typedef int	(*vfs_quotactl_t)(bhv_desc_t *, int, int, caddr_t);
-typedef void	(*vfs_init_vnode_t)(bhv_desc_t *,
-				struct vnode *, bhv_desc_t *, int);
-typedef void	(*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int);
-typedef void	(*vfs_freeze_t)(bhv_desc_t *);
-
-typedef struct vfsops {
-	bhv_position_t		vf_position;	/* behavior chain position */
-	vfs_mount_t		vfs_mount;	/* mount file system */
-	vfs_parseargs_t		vfs_parseargs;	/* parse mount options */
-	vfs_showargs_t		vfs_showargs;	/* unparse mount options */
-	vfs_unmount_t		vfs_unmount;	/* unmount file system */
-	vfs_mntupdate_t		vfs_mntupdate;	/* update file system options */
-	vfs_root_t		vfs_root;	/* get root vnode */
-	vfs_statvfs_t		vfs_statvfs;	/* file system statistics */
-	vfs_sync_t		vfs_sync;	/* flush files */
-	vfs_vget_t		vfs_vget;	/* get vnode from fid */
-	vfs_dmapiops_t		vfs_dmapiops;	/* data migration */
-	vfs_quotactl_t		vfs_quotactl;	/* disk quota */
-	vfs_init_vnode_t	vfs_init_vnode;	/* initialize a new vnode */
-	vfs_force_shutdown_t	vfs_force_shutdown;	/* crash and burn */
-	vfs_freeze_t		vfs_freeze;	/* freeze fs for snapshot */
-} vfsops_t;
-
-/*
- * VFS's.  Operates on vfs structure pointers (starts at bhv head).
- */
-#define VHEAD(v)			((v)->vfs_fbhv)
-#define VFS_MOUNT(v, ma,cr, rv)		((rv) = vfs_mount(VHEAD(v), ma,cr))
-#define VFS_PARSEARGS(v, o,ma,f, rv)	((rv) = vfs_parseargs(VHEAD(v), o,ma,f))
-#define VFS_SHOWARGS(v, m, rv)		((rv) = vfs_showargs(VHEAD(v), m))
-#define VFS_UNMOUNT(v, f, cr, rv)	((rv) = vfs_unmount(VHEAD(v), f,cr))
-#define VFS_MNTUPDATE(v, fl, args, rv)	((rv) = vfs_mntupdate(VHEAD(v), fl, args))
-#define VFS_ROOT(v, vpp, rv)		((rv) = vfs_root(VHEAD(v), vpp))
-#define VFS_STATVFS(v, sp,vp, rv)	((rv) = vfs_statvfs(VHEAD(v), sp,vp))
-#define VFS_SYNC(v, flag,cr, rv)	((rv) = vfs_sync(VHEAD(v), flag,cr))
-#define VFS_VGET(v, vpp,fidp, rv)	((rv) = vfs_vget(VHEAD(v), vpp,fidp))
-#define VFS_DMAPIOPS(v, p, rv)		((rv) = vfs_dmapiops(VHEAD(v), p))
-#define VFS_QUOTACTL(v, c,id,p, rv)	((rv) = vfs_quotactl(VHEAD(v), c,id,p))
-#define VFS_INIT_VNODE(v, vp,b,ul)	( vfs_init_vnode(VHEAD(v), vp,b,ul) )
-#define VFS_FORCE_SHUTDOWN(v, fl,f,l)	( vfs_force_shutdown(VHEAD(v), fl,f,l) )
-#define VFS_FREEZE(v)			( vfs_freeze(VHEAD(v)) )
-
-/*
- * PVFS's.  Operates on behavior descriptor pointers.
- */
-#define PVFS_MOUNT(b, ma,cr, rv)	((rv) = vfs_mount(b, ma,cr))
-#define PVFS_PARSEARGS(b, o,ma,f, rv)	((rv) = vfs_parseargs(b, o,ma,f))
-#define PVFS_SHOWARGS(b, m, rv)		((rv) = vfs_showargs(b, m))
-#define PVFS_UNMOUNT(b, f,cr, rv)	((rv) = vfs_unmount(b, f,cr))
-#define PVFS_MNTUPDATE(b, fl, args, rv)	((rv) = vfs_mntupdate(b, fl, args))
-#define PVFS_ROOT(b, vpp, rv)		((rv) = vfs_root(b, vpp))
-#define PVFS_STATVFS(b, sp,vp, rv)	((rv) = vfs_statvfs(b, sp,vp))
-#define PVFS_SYNC(b, flag,cr, rv)	((rv) = vfs_sync(b, flag,cr))
-#define PVFS_VGET(b, vpp,fidp, rv)	((rv) = vfs_vget(b, vpp,fidp))
-#define PVFS_DMAPIOPS(b, p, rv)		((rv) = vfs_dmapiops(b, p))
-#define PVFS_QUOTACTL(b, c,id,p, rv)	((rv) = vfs_quotactl(b, c,id,p))
-#define PVFS_INIT_VNODE(b, vp,b2,ul)	( vfs_init_vnode(b, vp,b2,ul) )
-#define PVFS_FORCE_SHUTDOWN(b, fl,f,l)	( vfs_force_shutdown(b, fl,f,l) )
-#define PVFS_FREEZE(b)			( vfs_freeze(b) )
-
-extern int vfs_mount(bhv_desc_t *, struct xfs_mount_args *, struct cred *);
-extern int vfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int);
-extern int vfs_showargs(bhv_desc_t *, struct seq_file *);
-extern int vfs_unmount(bhv_desc_t *, int, struct cred *);
-extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *);
-extern int vfs_root(bhv_desc_t *, struct vnode **);
-extern int vfs_statvfs(bhv_desc_t *, xfs_statfs_t *, struct vnode *);
-extern int vfs_sync(bhv_desc_t *, int, struct cred *);
-extern int vfs_vget(bhv_desc_t *, struct vnode **, struct fid *);
-extern int vfs_dmapiops(bhv_desc_t *, caddr_t);
-extern int vfs_quotactl(bhv_desc_t *, int, int, caddr_t);
-extern void vfs_init_vnode(bhv_desc_t *, struct vnode *, bhv_desc_t *, int);
-extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int);
-extern void vfs_freeze(bhv_desc_t *);
-
-typedef struct bhv_vfsops {
-	struct vfsops		bhv_common;
-	void *			bhv_custom;
-} bhv_vfsops_t;
-
-#define vfs_bhv_lookup(v, id)	( bhv_lookup_range(&(v)->vfs_bh, (id), (id)) )
-#define vfs_bhv_custom(b)	( ((bhv_vfsops_t *)BHV_OPS(b))->bhv_custom )
-#define vfs_bhv_set_custom(b,o)	( (b)->bhv_custom = (void *)(o))
-#define vfs_bhv_clr_custom(b)	( (b)->bhv_custom = NULL )
-
-extern vfs_t *vfs_allocate(void);
-extern void vfs_deallocate(vfs_t *);
-extern void vfs_insertops(vfs_t *, bhv_vfsops_t *);
-extern void vfs_insertbhv(vfs_t *, bhv_desc_t *, vfsops_t *, void *);
-
-extern void bhv_insert_all_vfsops(struct vfs *);
-extern void bhv_remove_all_vfsops(struct vfs *, int);
-extern void bhv_remove_vfsops(struct vfs *, int);
-
-#endif	/* __XFS_VFS_H__ */
diff -Nru a/fs/xfs/linux/xfs_vnode.c b/fs/xfs/linux/xfs_vnode.c
--- a/fs/xfs/linux/xfs_vnode.c	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,442 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- */
-
-#include "xfs.h"
-
-
-uint64_t vn_generation;		/* vnode generation number */
-spinlock_t vnumber_lock = SPIN_LOCK_UNLOCKED;
-
-/*
- * Dedicated vnode inactive/reclaim sync semaphores.
- * Prime number of hash buckets since address is used as the key.
- */
-#define NVSYNC                  37
-#define vptosync(v)             (&vsync[((unsigned long)v) % NVSYNC])
-sv_t vsync[NVSYNC];
-
-/*
- * Translate stat(2) file types to vnode types and vice versa.
- * Aware of numeric order of S_IFMT and vnode type values.
- */
-enum vtype iftovt_tab[] = {
-	VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
-	VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VNON
-};
-
-u_short vttoif_tab[] = {
-	0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, 0, S_IFSOCK
-};
-
-
-void
-vn_init(void)
-{
-	register sv_t *svp;
-	register int i;
-
-	for (svp = vsync, i = 0; i < NVSYNC; i++, svp++)
-		init_sv(svp, SV_DEFAULT, "vsy", i);
-}
-
-/*
- * Clean a vnode of filesystem-specific data and prepare it for reuse.
- */
-STATIC int
-vn_reclaim(
-	struct vnode	*vp)
-{
-	int		error;
-
-	XFS_STATS_INC(vn_reclaim);
-	vn_trace_entry(vp, "vn_reclaim", (inst_t *)__return_address);
-
-	/*
-	 * Only make the VOP_RECLAIM call if there are behaviors
-	 * to call.
-	 */
-	if (vp->v_fbhv) {
-		VOP_RECLAIM(vp, error);
-		if (error)
-			return -error;
-	}
-	ASSERT(vp->v_fbhv == NULL);
-
-	VN_LOCK(vp);
-	vp->v_flag &= (VRECLM|VWAIT);
-	VN_UNLOCK(vp, 0);
-
-	vp->v_type = VNON;
-	vp->v_fbhv = NULL;
-
-#ifdef XFS_VNODE_TRACE
-	ktrace_free(vp->v_trace);
-	vp->v_trace = NULL;
-#endif
-
-	return 0;
-}
-
-STATIC void
-vn_wakeup(
-	struct vnode	*vp)
-{
-	VN_LOCK(vp);
-	if (vp->v_flag & VWAIT)
-		sv_broadcast(vptosync(vp));
-	vp->v_flag &= ~(VRECLM|VWAIT|VMODIFIED);
-	VN_UNLOCK(vp, 0);
-}
-
-int
-vn_wait(
-	struct vnode	*vp)
-{
-	VN_LOCK(vp);
-	if (vp->v_flag & (VINACT | VRECLM)) {
-		vp->v_flag |= VWAIT;
-		sv_wait(vptosync(vp), PINOD, &vp->v_lock, 0);
-		return 1;
-	}
-	VN_UNLOCK(vp, 0);
-	return 0;
-}
-
-struct vnode *
-vn_initialize(
-	struct inode	*inode)
-{
-	struct vnode	*vp = LINVFS_GET_VP(inode);
-
-	XFS_STATS_INC(vn_active);
-	XFS_STATS_INC(vn_alloc);
-
-	vp->v_flag = VMODIFIED;
-	spinlock_init(&vp->v_lock, "v_lock");
-
-	spin_lock(&vnumber_lock);
-	if (!++vn_generation)	/* v_number shouldn't be zero */
-		vn_generation++;
-	vp->v_number = vn_generation;
-	spin_unlock(&vnumber_lock);
-
-	ASSERT(VN_CACHED(vp) == 0);
-
-	/* Initialize the first behavior and the behavior chain head. */
-	vn_bhv_head_init(VN_BHV_HEAD(vp), "vnode");
-
-#ifdef	XFS_VNODE_TRACE
-	vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);
-	printk("Allocated VNODE_TRACE at 0x%p\n", vp->v_trace);
-#endif	/* XFS_VNODE_TRACE */
-
-	vn_trace_exit(vp, "vn_initialize", (inst_t *)__return_address);
-	return vp;
-}
-
-/*
- * Get a reference on a vnode.
- */
-vnode_t *
-vn_get(
-	struct vnode	*vp,
-	vmap_t		*vmap)
-{
-	struct inode	*inode;
-
-	XFS_STATS_INC(vn_get);
-	inode = LINVFS_GET_IP(vp);
-	if (inode->i_state & I_FREEING)
-		return NULL;
-
-	inode = ilookup(vmap->v_vfsp->vfs_super, vmap->v_ino);
-	if (!inode)	/* Inode not present */
-		return NULL;
-
-	vn_trace_exit(vp, "vn_get", (inst_t *)__return_address);
-
-	return vp;
-}
-
-/*
- * Revalidate the Linux inode from the vnode.
- */
-int
-vn_revalidate(
-	struct vnode	*vp)
-{
-	struct inode	*inode;
-	vattr_t		va;
-	int		error;
-
-	vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address);
-	ASSERT(vp->v_fbhv != NULL);
-
-	va.va_mask = XFS_AT_STAT|XFS_AT_XFLAGS;
-	VOP_GETATTR(vp, &va, 0, NULL, error);
-	if (!error) {
-		inode = LINVFS_GET_IP(vp);
-		inode->i_mode	    = VTTOIF(va.va_type) | va.va_mode;
-		inode->i_nlink	    = va.va_nlink;
-		inode->i_uid	    = va.va_uid;
-		inode->i_gid	    = va.va_gid;
-		inode->i_blocks	    = va.va_nblocks;
-		inode->i_mtime	    = va.va_mtime;
-		inode->i_ctime	    = va.va_ctime;
-		inode->i_atime	    = va.va_atime;
-		if (va.va_xflags & XFS_XFLAG_IMMUTABLE)
-			inode->i_flags |= S_IMMUTABLE;
-		else
-			inode->i_flags &= ~S_IMMUTABLE;
-		if (va.va_xflags & XFS_XFLAG_APPEND)
-			inode->i_flags |= S_APPEND;
-		else
-			inode->i_flags &= ~S_APPEND;
-		if (va.va_xflags & XFS_XFLAG_SYNC)
-			inode->i_flags |= S_SYNC;
-		else
-			inode->i_flags &= ~S_SYNC;
-		if (va.va_xflags & XFS_XFLAG_NOATIME)
-			inode->i_flags |= S_NOATIME;
-		else
-			inode->i_flags &= ~S_NOATIME;
-		VUNMODIFY(vp);
-	}
-	return -error;
-}
-
-/*
- * purge a vnode from the cache
- * At this point the vnode is guaranteed to have no references (vn_count == 0)
- * The caller has to make sure that there are no ways someone could
- * get a handle (via vn_get) on the vnode (usually done via a mount/vfs lock).
- */
-void
-vn_purge(
-	struct vnode	*vp,
-	vmap_t		*vmap)
-{
-	vn_trace_entry(vp, "vn_purge", (inst_t *)__return_address);
-
-again:
-	/*
-	 * Check whether vp has already been reclaimed since our caller
-	 * sampled its version while holding a filesystem cache lock that
-	 * its VOP_RECLAIM function acquires.
-	 */
-	VN_LOCK(vp);
-	if (vp->v_number != vmap->v_number) {
-		VN_UNLOCK(vp, 0);
-		return;
-	}
-
-	/*
-	 * If vp is being reclaimed or inactivated, wait until it is inert,
-	 * then proceed.  Can't assume that vnode is actually reclaimed
-	 * just because the reclaimed flag is asserted -- a vn_alloc
-	 * reclaim can fail.
-	 */
-	if (vp->v_flag & (VINACT | VRECLM)) {
-		ASSERT(vn_count(vp) == 0);
-		vp->v_flag |= VWAIT;
-		sv_wait(vptosync(vp), PINOD, &vp->v_lock, 0);
-		goto again;
-	}
-
-	/*
-	 * Another process could have raced in and gotten this vnode...
-	 */
-	if (vn_count(vp) > 0) {
-		VN_UNLOCK(vp, 0);
-		return;
-	}
-
-	XFS_STATS_DEC(vn_active);
-	vp->v_flag |= VRECLM;
-	VN_UNLOCK(vp, 0);
-
-	/*
-	 * Call VOP_RECLAIM and clean vp. The FSYNC_INVAL flag tells
-	 * vp's filesystem to flush and invalidate all cached resources.
-	 * When vn_reclaim returns, vp should have no private data,
-	 * either in a system cache or attached to v_data.
-	 */
-	if (vn_reclaim(vp) != 0)
-		panic("vn_purge: cannot reclaim");
-
-	/*
-	 * Wakeup anyone waiting for vp to be reclaimed.
-	 */
-	vn_wakeup(vp);
-}
-
-/*
- * Add a reference to a referenced vnode.
- */
-struct vnode *
-vn_hold(
-	struct vnode	*vp)
-{
-	struct inode	*inode;
-
-	XFS_STATS_INC(vn_hold);
-
-	VN_LOCK(vp);
-	inode = igrab(LINVFS_GET_IP(vp));
-	ASSERT(inode);
-	VN_UNLOCK(vp, 0);
-
-	return vp;
-}
-
-/*
- *  Call VOP_INACTIVE on last reference.
- */
-void
-vn_rele(
-	struct vnode	*vp)
-{
-	int		vcnt;
-	int		cache;
-
-	XFS_STATS_INC(vn_rele);
-
-	VN_LOCK(vp);
-
-	vn_trace_entry(vp, "vn_rele", (inst_t *)__return_address);
-	vcnt = vn_count(vp);
-
-	/*
-	 * Since we always get called from put_inode we know
-	 * that i_count won't be decremented after we
-	 * return.
-	 */
-	if (!vcnt) {
-		/*
-		 * As soon as we turn this on, noone can find us in vn_get
-		 * until we turn off VINACT or VRECLM
-		 */
-		vp->v_flag |= VINACT;
-		VN_UNLOCK(vp, 0);
-
-		/*
-		 * Do not make the VOP_INACTIVE call if there
-		 * are no behaviors attached to the vnode to call.
-		 */
-		if (vp->v_fbhv)
-			VOP_INACTIVE(vp, NULL, cache);
-
-		VN_LOCK(vp);
-		if (vp->v_flag & VWAIT)
-			sv_broadcast(vptosync(vp));
-
-		vp->v_flag &= ~(VINACT|VWAIT|VRECLM|VMODIFIED);
-	}
-
-	VN_UNLOCK(vp, 0);
-
-	vn_trace_exit(vp, "vn_rele", (inst_t *)__return_address);
-}
-
-/*
- * Finish the removal of a vnode.
- */
-void
-vn_remove(
-	struct vnode	*vp)
-{
-	vmap_t		vmap;
-
-	/* Make sure we don't do this to the same vnode twice */
-	if (!(vp->v_fbhv))
-		return;
-
-	XFS_STATS_INC(vn_remove);
-	vn_trace_exit(vp, "vn_remove", (inst_t *)__return_address);
-
-	/*
-	 * After the following purge the vnode
-	 * will no longer exist.
-	 */
-	VMAP(vp, vmap);
-	vn_purge(vp, &vmap);
-}
-
-
-#ifdef	XFS_VNODE_TRACE
-
-#define KTRACE_ENTER(vp, vk, s, line, ra)			\
-	ktrace_enter(	(vp)->v_trace,				\
-/*  0 */		(void *)(__psint_t)(vk),		\
-/*  1 */		(void *)(s),				\
-/*  2 */		(void *)(__psint_t) line,		\
-/*  3 */		(void *)(vn_count(vp)), \
-/*  4 */		(void *)(ra),				\
-/*  5 */		(void *)(__psunsigned_t)(vp)->v_flag,	\
-/*  6 */		(void *)(__psint_t)smp_processor_id(),	\
-/*  7 */		(void *)(__psint_t)(current->pid),	\
-/*  8 */		(void *)__return_address,		\
-/*  9 */		0, 0, 0, 0, 0, 0, 0)
-
-/*
- * Vnode tracing code.
- */
-void
-vn_trace_entry(vnode_t *vp, char *func, inst_t *ra)
-{
-	KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra);
-}
-
-void
-vn_trace_exit(vnode_t *vp, char *func, inst_t *ra)
-{
-	KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra);
-}
-
-void
-vn_trace_hold(vnode_t *vp, char *file, int line, inst_t *ra)
-{
-	KTRACE_ENTER(vp, VNODE_KTRACE_HOLD, file, line, ra);
-}
-
-void
-vn_trace_ref(vnode_t *vp, char *file, int line, inst_t *ra)
-{
-	KTRACE_ENTER(vp, VNODE_KTRACE_REF, file, line, ra);
-}
-
-void
-vn_trace_rele(vnode_t *vp, char *file, int line, inst_t *ra)
-{
-	KTRACE_ENTER(vp, VNODE_KTRACE_RELE, file, line, ra);
-}
-#endif	/* XFS_VNODE_TRACE */
diff -Nru a/fs/xfs/linux/xfs_vnode.h b/fs/xfs/linux/xfs_vnode.h
--- a/fs/xfs/linux/xfs_vnode.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,651 +0,0 @@
-/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
- *
- * Portions Copyright (c) 1989, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS 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 REGENTS OR CONTRIBUTORS 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 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef __XFS_VNODE_H__
-#define __XFS_VNODE_H__
-
-struct uio;
-struct file;
-struct vattr;
-struct xfs_iomap;
-struct attrlist_cursor_kern;
-
-/*
- * Vnode types.  VNON means no type.
- */
-enum vtype	{ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VFIFO, VBAD, VSOCK };
-
-typedef xfs_ino_t vnumber_t;
-typedef struct dentry vname_t;
-typedef bhv_head_t vn_bhv_head_t;
-
-/*
- * MP locking protocols:
- *	v_flag, v_vfsp				VN_LOCK/VN_UNLOCK
- *	v_type					read-only or fs-dependent
- */
-typedef struct vnode {
-	__u32		v_flag;			/* vnode flags (see below) */
-	enum vtype	v_type;			/* vnode type */
-	struct vfs	*v_vfsp;		/* ptr to containing VFS */
-	vnumber_t	v_number;		/* in-core vnode number */
-	vn_bhv_head_t	v_bh;			/* behavior head */
-	spinlock_t	v_lock;			/* VN_LOCK/VN_UNLOCK */
-	struct inode	v_inode;		/* Linux inode */
-#ifdef XFS_VNODE_TRACE
-	struct ktrace	*v_trace;		/* trace header structure    */
-#endif
-} vnode_t;
-
-#define v_fbhv			v_bh.bh_first	       /* first behavior */
-#define v_fops			v_bh.bh_first->bd_ops  /* first behavior ops */
-
-#define VNODE_POSITION_BASE	BHV_POSITION_BASE	/* chain bottom */
-#define VNODE_POSITION_TOP	BHV_POSITION_TOP	/* chain top */
-#define VNODE_POSITION_INVALID	BHV_POSITION_INVALID	/* invalid pos. num */
-
-typedef enum {
-	VN_BHV_UNKNOWN,		/* not specified */
-	VN_BHV_XFS,		/* xfs */
-	VN_BHV_DM,		/* data migration */
-	VN_BHV_QM,		/* quota manager */
-	VN_BHV_IO,		/* IO path */
-	VN_BHV_END		/* housekeeping end-of-range */
-} vn_bhv_t;
-
-#define VNODE_POSITION_XFS	(VNODE_POSITION_BASE)
-#define VNODE_POSITION_DM	(VNODE_POSITION_BASE+10)
-#define VNODE_POSITION_QM	(VNODE_POSITION_BASE+20)
-#define VNODE_POSITION_IO	(VNODE_POSITION_BASE+30)
-
-/*
- * Macros for dealing with the behavior descriptor inside of the vnode.
- */
-#define BHV_TO_VNODE(bdp)	((vnode_t *)BHV_VOBJ(bdp))
-#define BHV_TO_VNODE_NULL(bdp)	((vnode_t *)BHV_VOBJNULL(bdp))
-
-#define VN_BHV_HEAD(vp)			((bhv_head_t *)(&((vp)->v_bh)))
-#define vn_bhv_head_init(bhp,name)	bhv_head_init(bhp,name)
-#define vn_bhv_remove(bhp,bdp)		bhv_remove(bhp,bdp)
-#define vn_bhv_lookup(bhp,ops)		bhv_lookup(bhp,ops)
-#define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops)
-
-/*
- * Vnode to Linux inode mapping.
- */
-#define LINVFS_GET_VP(inode)	((vnode_t *)list_entry(inode, vnode_t, v_inode))
-#define LINVFS_GET_IP(vp)	(&(vp)->v_inode)
-
-/*
- * Convert between vnode types and inode formats (since POSIX.1
- * defines mode word of stat structure in terms of inode formats).
- */
-extern enum vtype	iftovt_tab[];
-extern u_short		vttoif_tab[];
-#define IFTOVT(mode)	(iftovt_tab[((mode) & S_IFMT) >> 12])
-#define VTTOIF(indx)	(vttoif_tab[(int)(indx)])
-#define MAKEIMODE(indx, mode)	(int)(VTTOIF(indx) | (mode))
-
-
-/*
- * Vnode flags.
- */
-#define VINACT		       0x1	/* vnode is being inactivated	*/
-#define VRECLM		       0x2	/* vnode is being reclaimed	*/
-#define VWAIT		       0x4	/* waiting for VINACT/VRECLM to end */
-#define VMODIFIED	       0x8	/* XFS inode state possibly differs */
-					/* to the Linux inode state.	*/
-
-/*
- * Values for the VOP_RWLOCK and VOP_RWUNLOCK flags parameter.
- */
-typedef enum vrwlock {
-	VRWLOCK_NONE,
-	VRWLOCK_READ,
-	VRWLOCK_WRITE,
-	VRWLOCK_WRITE_DIRECT,
-	VRWLOCK_TRY_READ,
-	VRWLOCK_TRY_WRITE
-} vrwlock_t;
-
-/*
- * Return values for VOP_INACTIVE.  A return value of
- * VN_INACTIVE_NOCACHE implies that the file system behavior
- * has disassociated its state and bhv_desc_t from the vnode.
- */
-#define	VN_INACTIVE_CACHE	0
-#define	VN_INACTIVE_NOCACHE	1
-
-/*
- * Values for the cmd code given to VOP_VNODE_CHANGE.
- */
-typedef enum vchange {
-	VCHANGE_FLAGS_FRLOCKS		= 0,
-	VCHANGE_FLAGS_ENF_LOCKING	= 1,
-	VCHANGE_FLAGS_TRUNCATED		= 2,
-	VCHANGE_FLAGS_PAGE_DIRTY	= 3,
-	VCHANGE_FLAGS_IOEXCL_COUNT	= 4
-} vchange_t;
-
-
-typedef int	(*vop_open_t)(bhv_desc_t *, struct cred *);
-typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct kiocb *,
-				const struct iovec *, unsigned int,
-				loff_t *, int, struct cred *);
-typedef ssize_t (*vop_write_t)(bhv_desc_t *, struct kiocb *,
-				const struct iovec *, unsigned int,
-				loff_t *, int, struct cred *);
-typedef ssize_t (*vop_sendfile_t)(bhv_desc_t *, struct file *,
-				loff_t *, int, size_t, read_actor_t,
-				void *, struct cred *);
-typedef int	(*vop_ioctl_t)(bhv_desc_t *, struct inode *, struct file *,
-				int, unsigned int, unsigned long);
-typedef int	(*vop_getattr_t)(bhv_desc_t *, struct vattr *, int,
-				struct cred *);
-typedef int	(*vop_setattr_t)(bhv_desc_t *, struct vattr *, int,
-				struct cred *);
-typedef int	(*vop_access_t)(bhv_desc_t *, int, struct cred *);
-typedef int	(*vop_lookup_t)(bhv_desc_t *, vname_t *, vnode_t **,
-				int, vnode_t *, struct cred *);
-typedef int	(*vop_create_t)(bhv_desc_t *, vname_t *, struct vattr *,
-				vnode_t **, struct cred *);
-typedef int	(*vop_remove_t)(bhv_desc_t *, vname_t *, struct cred *);
-typedef int	(*vop_link_t)(bhv_desc_t *, vnode_t *, vname_t *,
-				struct cred *);
-typedef int	(*vop_rename_t)(bhv_desc_t *, vname_t *, vnode_t *, vname_t *,
-				struct cred *);
-typedef int	(*vop_mkdir_t)(bhv_desc_t *, vname_t *, struct vattr *,
-				vnode_t **, struct cred *);
-typedef int	(*vop_rmdir_t)(bhv_desc_t *, vname_t *, struct cred *);
-typedef int	(*vop_readdir_t)(bhv_desc_t *, struct uio *, struct cred *,
-				int *);
-typedef int	(*vop_symlink_t)(bhv_desc_t *, vname_t *, struct vattr *,
-				char *, vnode_t **, struct cred *);
-typedef int	(*vop_readlink_t)(bhv_desc_t *, struct uio *, int,
-				struct cred *);
-typedef int	(*vop_fsync_t)(bhv_desc_t *, int, struct cred *,
-				xfs_off_t, xfs_off_t);
-typedef int	(*vop_inactive_t)(bhv_desc_t *, struct cred *);
-typedef int	(*vop_fid2_t)(bhv_desc_t *, struct fid *);
-typedef int	(*vop_release_t)(bhv_desc_t *);
-typedef int	(*vop_rwlock_t)(bhv_desc_t *, vrwlock_t);
-typedef void	(*vop_rwunlock_t)(bhv_desc_t *, vrwlock_t);
-typedef int	(*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int,
-				struct xfs_iomap *, int *);
-typedef int	(*vop_reclaim_t)(bhv_desc_t *);
-typedef int	(*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int,
-				struct cred *);
-typedef	int	(*vop_attr_set_t)(bhv_desc_t *, char *, char *, int, int,
-				struct cred *);
-typedef	int	(*vop_attr_remove_t)(bhv_desc_t *, char *, int, struct cred *);
-typedef	int	(*vop_attr_list_t)(bhv_desc_t *, char *, int, int,
-				struct attrlist_cursor_kern *, struct cred *);
-typedef void	(*vop_link_removed_t)(bhv_desc_t *, vnode_t *, int);
-typedef void	(*vop_vnode_change_t)(bhv_desc_t *, vchange_t, __psint_t);
-typedef void	(*vop_ptossvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
-typedef void	(*vop_pflushinvalvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
-typedef int	(*vop_pflushvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t,
-				uint64_t, int);
-typedef int	(*vop_iflush_t)(bhv_desc_t *, int);
-
-
-typedef struct vnodeops {
-	bhv_position_t  vn_position;    /* position within behavior chain */
-	vop_open_t		vop_open;
-	vop_read_t		vop_read;
-	vop_write_t		vop_write;
-	vop_sendfile_t		vop_sendfile;
-	vop_ioctl_t		vop_ioctl;
-	vop_getattr_t		vop_getattr;
-	vop_setattr_t		vop_setattr;
-	vop_access_t		vop_access;
-	vop_lookup_t		vop_lookup;
-	vop_create_t		vop_create;
-	vop_remove_t		vop_remove;
-	vop_link_t		vop_link;
-	vop_rename_t		vop_rename;
-	vop_mkdir_t		vop_mkdir;
-	vop_rmdir_t		vop_rmdir;
-	vop_readdir_t		vop_readdir;
-	vop_symlink_t		vop_symlink;
-	vop_readlink_t		vop_readlink;
-	vop_fsync_t		vop_fsync;
-	vop_inactive_t		vop_inactive;
-	vop_fid2_t		vop_fid2;
-	vop_rwlock_t		vop_rwlock;
-	vop_rwunlock_t		vop_rwunlock;
-	vop_bmap_t		vop_bmap;
-	vop_reclaim_t		vop_reclaim;
-	vop_attr_get_t		vop_attr_get;
-	vop_attr_set_t		vop_attr_set;
-	vop_attr_remove_t	vop_attr_remove;
-	vop_attr_list_t		vop_attr_list;
-	vop_link_removed_t	vop_link_removed;
-	vop_vnode_change_t	vop_vnode_change;
-	vop_ptossvp_t		vop_tosspages;
-	vop_pflushinvalvp_t	vop_flushinval_pages;
-	vop_pflushvp_t		vop_flush_pages;
-	vop_release_t		vop_release;
-	vop_iflush_t		vop_iflush;
-} vnodeops_t;
-
-/*
- * VOP's.
- */
-#define _VOP_(op, vp)	(*((vnodeops_t *)(vp)->v_fops)->op)
-
-#define VOP_READ(vp,file,iov,segs,offset,ioflags,cr,rv)			\
-	rv = _VOP_(vop_read, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr)
-#define VOP_WRITE(vp,file,iov,segs,offset,ioflags,cr,rv)		\
-	rv = _VOP_(vop_write, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr)
-#define VOP_SENDFILE(vp,f,off,ioflags,cnt,act,targ,cr,rv)		\
-	rv = _VOP_(vop_sendfile, vp)((vp)->v_fbhv,f,off,ioflags,cnt,act,targ,cr)
-#define VOP_BMAP(vp,of,sz,rw,b,n,rv)					\
-	rv = _VOP_(vop_bmap, vp)((vp)->v_fbhv,of,sz,rw,b,n)
-#define VOP_OPEN(vp, cr, rv)						\
-	rv = _VOP_(vop_open, vp)((vp)->v_fbhv, cr)
-#define VOP_GETATTR(vp, vap, f, cr, rv)					\
-	rv = _VOP_(vop_getattr, vp)((vp)->v_fbhv, vap, f, cr)
-#define	VOP_SETATTR(vp, vap, f, cr, rv)					\
-	rv = _VOP_(vop_setattr, vp)((vp)->v_fbhv, vap, f, cr)
-#define	VOP_ACCESS(vp, mode, cr, rv)					\
-	rv = _VOP_(vop_access, vp)((vp)->v_fbhv, mode, cr)
-#define	VOP_LOOKUP(vp,d,vpp,f,rdir,cr,rv)				\
-	rv = _VOP_(vop_lookup, vp)((vp)->v_fbhv,d,vpp,f,rdir,cr)
-#define VOP_CREATE(dvp,d,vap,vpp,cr,rv)					\
-	rv = _VOP_(vop_create, dvp)((dvp)->v_fbhv,d,vap,vpp,cr)
-#define VOP_REMOVE(dvp,d,cr,rv)						\
-	rv = _VOP_(vop_remove, dvp)((dvp)->v_fbhv,d,cr)
-#define	VOP_LINK(tdvp,fvp,d,cr,rv)					\
-	rv = _VOP_(vop_link, tdvp)((tdvp)->v_fbhv,fvp,d,cr)
-#define	VOP_RENAME(fvp,fnm,tdvp,tnm,cr,rv)				\
-	rv = _VOP_(vop_rename, fvp)((fvp)->v_fbhv,fnm,tdvp,tnm,cr)
-#define	VOP_MKDIR(dp,d,vap,vpp,cr,rv)					\
-	rv = _VOP_(vop_mkdir, dp)((dp)->v_fbhv,d,vap,vpp,cr)
-#define	VOP_RMDIR(dp,d,cr,rv)	 					\
-	rv = _VOP_(vop_rmdir, dp)((dp)->v_fbhv,d,cr)
-#define	VOP_READDIR(vp,uiop,cr,eofp,rv)					\
-	rv = _VOP_(vop_readdir, vp)((vp)->v_fbhv,uiop,cr,eofp)
-#define	VOP_SYMLINK(dvp,d,vap,tnm,vpp,cr,rv)				\
-	rv = _VOP_(vop_symlink, dvp) ((dvp)->v_fbhv,d,vap,tnm,vpp,cr)
-#define	VOP_READLINK(vp,uiop,fl,cr,rv)					\
-	rv = _VOP_(vop_readlink, vp)((vp)->v_fbhv,uiop,fl,cr)
-#define	VOP_FSYNC(vp,f,cr,b,e,rv)					\
-	rv = _VOP_(vop_fsync, vp)((vp)->v_fbhv,f,cr,b,e)
-#define VOP_INACTIVE(vp, cr, rv)					\
-	rv = _VOP_(vop_inactive, vp)((vp)->v_fbhv, cr)
-#define VOP_RELEASE(vp, rv)						\
-	rv = _VOP_(vop_release, vp)((vp)->v_fbhv)
-#define VOP_FID2(vp, fidp, rv)						\
-	rv = _VOP_(vop_fid2, vp)((vp)->v_fbhv, fidp)
-#define VOP_RWLOCK(vp,i)						\
-	(void)_VOP_(vop_rwlock, vp)((vp)->v_fbhv, i)
-#define VOP_RWLOCK_TRY(vp,i)						\
-	_VOP_(vop_rwlock, vp)((vp)->v_fbhv, i)
-#define VOP_RWUNLOCK(vp,i)						\
-	(void)_VOP_(vop_rwunlock, vp)((vp)->v_fbhv, i)
-#define VOP_FRLOCK(vp,c,fl,flags,offset,fr,rv)				\
-	rv = _VOP_(vop_frlock, vp)((vp)->v_fbhv,c,fl,flags,offset,fr)
-#define VOP_RECLAIM(vp, rv)						\
-	rv = _VOP_(vop_reclaim, vp)((vp)->v_fbhv)
-#define VOP_ATTR_GET(vp, name, val, vallenp, fl, cred, rv)		\
-	rv = _VOP_(vop_attr_get, vp)((vp)->v_fbhv,name,val,vallenp,fl,cred)
-#define	VOP_ATTR_SET(vp, name, val, vallen, fl, cred, rv)		\
-	rv = _VOP_(vop_attr_set, vp)((vp)->v_fbhv,name,val,vallen,fl,cred)
-#define	VOP_ATTR_REMOVE(vp, name, flags, cred, rv)			\
-	rv = _VOP_(vop_attr_remove, vp)((vp)->v_fbhv,name,flags,cred)
-#define	VOP_ATTR_LIST(vp, buf, buflen, fl, cursor, cred, rv)		\
-	rv = _VOP_(vop_attr_list, vp)((vp)->v_fbhv,buf,buflen,fl,cursor,cred)
-#define VOP_LINK_REMOVED(vp, dvp, linkzero)				\
-	(void)_VOP_(vop_link_removed, vp)((vp)->v_fbhv, dvp, linkzero)
-#define VOP_VNODE_CHANGE(vp, cmd, val)					\
-	(void)_VOP_(vop_vnode_change, vp)((vp)->v_fbhv,cmd,val)
-/*
- * These are page cache functions that now go thru VOPs.
- * 'last' parameter is unused and left in for IRIX compatibility
- */
-#define VOP_TOSS_PAGES(vp, first, last, fiopt)				\
-	_VOP_(vop_tosspages, vp)((vp)->v_fbhv,first, last, fiopt)
-/*
- * 'last' parameter is unused and left in for IRIX compatibility
- */
-#define VOP_FLUSHINVAL_PAGES(vp, first, last, fiopt)			\
-	_VOP_(vop_flushinval_pages, vp)((vp)->v_fbhv,first,last,fiopt)
-/*
- * 'last' parameter is unused and left in for IRIX compatibility
- */
-#define VOP_FLUSH_PAGES(vp, first, last, flags, fiopt, rv)		\
-	rv = _VOP_(vop_flush_pages, vp)((vp)->v_fbhv,first,last,flags,fiopt)
-#define VOP_IOCTL(vp, inode, filp, fl, cmd, arg, rv)			\
-	rv = _VOP_(vop_ioctl, vp)((vp)->v_fbhv,inode,filp,fl,cmd,arg)
-#define VOP_IFLUSH(vp, flags, rv)					\
-	rv = _VOP_(vop_iflush, vp)((vp)->v_fbhv, flags)
-
-/*
- * Flags for read/write calls - same values as IRIX
- */
-#define IO_ISDIRECT	0x00004		/* bypass page cache */
-#define IO_INVIS	0x00020		/* don't update inode timestamps */
-
-/*
- * Flags for VOP_IFLUSH call
- */
-#define FLUSH_SYNC		1	/* wait for flush to complete	*/
-#define FLUSH_INODE		2	/* flush the inode itself	*/
-#define FLUSH_LOG		4	/* force the last log entry for
-					 * this inode out to disk	*/
-
-/*
- * Flush/Invalidate options for VOP_TOSS_PAGES, VOP_FLUSHINVAL_PAGES and
- *	VOP_FLUSH_PAGES.
- */
-#define FI_NONE			0	/* none */
-#define FI_REMAPF		1	/* Do a remapf prior to the operation */
-#define FI_REMAPF_LOCKED	2	/* Do a remapf prior to the operation.
-					   Prevent VM access to the pages until
-					   the operation completes. */
-
-/*
- * Vnode attributes.  va_mask indicates those attributes the caller
- * wants to set or extract.
- */
-typedef struct vattr {
-	int		va_mask;	/* bit-mask of attributes present */
-	enum vtype	va_type;	/* vnode type (for create) */
-	mode_t		va_mode;	/* file access mode and type */
-	nlink_t		va_nlink;	/* number of references to file */
-	uid_t		va_uid;		/* owner user id */
-	gid_t		va_gid;		/* owner group id */
-	xfs_ino_t	va_nodeid;	/* file id */
-	xfs_off_t	va_size;	/* file size in bytes */
-	u_long		va_blocksize;	/* blocksize preferred for i/o */
-	struct timespec	va_atime;	/* time of last access */
-	struct timespec	va_mtime;	/* time of last modification */
-	struct timespec	va_ctime;	/* time file changed */
-	u_int		va_gen;		/* generation number of file */
-	xfs_dev_t	va_rdev;	/* device the special file represents */
-	__int64_t	va_nblocks;	/* number of blocks allocated */
-	u_long		va_xflags;	/* random extended file flags */
-	u_long		va_extsize;	/* file extent size */
-	u_long		va_nextents;	/* number of extents in file */
-	u_long		va_anextents;	/* number of attr extents in file */
-	int		va_projid;	/* project id */
-} vattr_t;
-
-/*
- * setattr or getattr attributes
- */
-#define XFS_AT_TYPE		0x00000001
-#define XFS_AT_MODE		0x00000002
-#define XFS_AT_UID		0x00000004
-#define XFS_AT_GID		0x00000008
-#define XFS_AT_FSID		0x00000010
-#define XFS_AT_NODEID		0x00000020
-#define XFS_AT_NLINK		0x00000040
-#define XFS_AT_SIZE		0x00000080
-#define XFS_AT_ATIME		0x00000100
-#define XFS_AT_MTIME		0x00000200
-#define XFS_AT_CTIME		0x00000400
-#define XFS_AT_RDEV		0x00000800
-#define XFS_AT_BLKSIZE		0x00001000
-#define XFS_AT_NBLOCKS		0x00002000
-#define XFS_AT_VCODE		0x00004000
-#define XFS_AT_MAC		0x00008000
-#define XFS_AT_UPDATIME		0x00010000
-#define XFS_AT_UPDMTIME		0x00020000
-#define XFS_AT_UPDCTIME		0x00040000
-#define XFS_AT_ACL		0x00080000
-#define XFS_AT_CAP		0x00100000
-#define XFS_AT_INF		0x00200000
-#define XFS_AT_XFLAGS		0x00400000
-#define XFS_AT_EXTSIZE		0x00800000
-#define XFS_AT_NEXTENTS		0x01000000
-#define XFS_AT_ANEXTENTS	0x02000000
-#define XFS_AT_PROJID		0x04000000
-#define XFS_AT_SIZE_NOPERM	0x08000000
-#define XFS_AT_GENCOUNT		0x10000000
-
-#define XFS_AT_ALL	(XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
-		XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
-		XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
-		XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|XFS_AT_MAC|\
-		XFS_AT_ACL|XFS_AT_CAP|XFS_AT_INF|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|\
-		XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_PROJID|XFS_AT_GENCOUNT)
-
-#define XFS_AT_STAT	(XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
-		XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
-		XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
-		XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_PROJID)
-
-#define XFS_AT_TIMES	(XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME)
-
-#define XFS_AT_UPDTIMES	(XFS_AT_UPDATIME|XFS_AT_UPDMTIME|XFS_AT_UPDCTIME)
-
-#define XFS_AT_NOSET	(XFS_AT_NLINK|XFS_AT_RDEV|XFS_AT_FSID|XFS_AT_NODEID|\
-		XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\
-		XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT)
-
-/*
- *  Modes.
- */
-#define VSUID	S_ISUID		/* set user id on execution */
-#define VSGID	S_ISGID		/* set group id on execution */
-#define VSVTX	S_ISVTX		/* save swapped text even after use */
-#define VREAD	S_IRUSR		/* read, write, execute permissions */
-#define VWRITE	S_IWUSR
-#define VEXEC	S_IXUSR
-
-#define MODEMASK S_IALLUGO	/* mode bits plus permission bits */
-
-/*
- * Check whether mandatory file locking is enabled.
- */
-#define MANDLOCK(vp, mode)	\
-	((vp)->v_type == VREG && ((mode) & (VSGID|(VEXEC>>3))) == VSGID)
-
-extern void	vn_init(void);
-extern int	vn_wait(struct vnode *);
-extern vnode_t	*vn_initialize(struct inode *);
-
-/*
- * Acquiring and invalidating vnodes:
- *
- *	if (vn_get(vp, version, 0))
- *		...;
- *	vn_purge(vp, version);
- *
- * vn_get and vn_purge must be called with vmap_t arguments, sampled
- * while a lock that the vnode's VOP_RECLAIM function acquires is
- * held, to ensure that the vnode sampled with the lock held isn't
- * recycled (VOP_RECLAIMed) or deallocated between the release of the lock
- * and the subsequent vn_get or vn_purge.
- */
-
-/*
- * vnode_map structures _must_ match vn_epoch and vnode structure sizes.
- */
-typedef struct vnode_map {
-	vfs_t		*v_vfsp;
-	vnumber_t	v_number;		/* in-core vnode number */
-	xfs_ino_t	v_ino;			/* inode #	*/
-} vmap_t;
-
-#define VMAP(vp, vmap)	{(vmap).v_vfsp	 = (vp)->v_vfsp,	\
-			 (vmap).v_number = (vp)->v_number,	\
-			 (vmap).v_ino	 = (vp)->v_inode.i_ino; }
-
-extern void	vn_purge(struct vnode *, vmap_t *);
-extern vnode_t	*vn_get(struct vnode *, vmap_t *);
-extern int	vn_revalidate(struct vnode *);
-extern void	vn_remove(struct vnode *);
-
-static inline int vn_count(struct vnode *vp)
-{
-	return atomic_read(&LINVFS_GET_IP(vp)->i_count);
-}
-
-/*
- * Vnode reference counting functions (and macros for compatibility).
- */
-extern vnode_t	*vn_hold(struct vnode *);
-extern void	vn_rele(struct vnode *);
-
-#if defined(XFS_VNODE_TRACE)
-#define VN_HOLD(vp)		\
-	((void)vn_hold(vp),	\
-	  vn_trace_hold(vp, __FILE__, __LINE__, (inst_t *)__return_address))
-#define VN_RELE(vp)		\
-	  (vn_trace_rele(vp, __FILE__, __LINE__, (inst_t *)__return_address), \
-	   iput(LINVFS_GET_IP(vp)))
-#else
-#define VN_HOLD(vp)		((void)vn_hold(vp))
-#define VN_RELE(vp)		(iput(LINVFS_GET_IP(vp)))
-#endif
-
-/*
- * Vname handling macros.
- */
-#define VNAME(dentry)		((char *) (dentry)->d_name.name)
-#define VNAMELEN(dentry)	((dentry)->d_name.len)
-#define VNAME_TO_VNODE(dentry)	(LINVFS_GET_VP((dentry)->d_inode))
-
-/*
- * Vnode spinlock manipulation.
- */
-#define VN_LOCK(vp)		mutex_spinlock(&(vp)->v_lock)
-#define VN_UNLOCK(vp, s)	mutex_spinunlock(&(vp)->v_lock, s)
-#define VN_FLAGSET(vp,b)	vn_flagset(vp,b)
-#define VN_FLAGCLR(vp,b)	vn_flagclr(vp,b)
-
-static __inline__ void vn_flagset(struct vnode *vp, uint flag)
-{
-	spin_lock(&vp->v_lock);
-	vp->v_flag |= flag;
-	spin_unlock(&vp->v_lock);
-}
-
-static __inline__ void vn_flagclr(struct vnode *vp, uint flag)
-{
-	spin_lock(&vp->v_lock);
-	vp->v_flag &= ~flag;
-	spin_unlock(&vp->v_lock);
-}
-
-/*
- * Update modify/access/change times on the vnode
- */
-#define VN_MTIMESET(vp, tvp)	(LINVFS_GET_IP(vp)->i_mtime = *(tvp))
-#define VN_ATIMESET(vp, tvp)	(LINVFS_GET_IP(vp)->i_atime = *(tvp))
-#define VN_CTIMESET(vp, tvp)	(LINVFS_GET_IP(vp)->i_ctime = *(tvp))
-
-/*
- * Some useful predicates.
- */
-#define VN_MAPPED(vp)	mapping_mapped(LINVFS_GET_IP(vp)->i_mapping)
-#define VN_CACHED(vp)	(LINVFS_GET_IP(vp)->i_mapping->nrpages)
-#define VN_DIRTY(vp)	mapping_tagged(LINVFS_GET_IP(vp)->i_mapping, \
-					PAGECACHE_TAG_DIRTY)
-#define VMODIFY(vp)	VN_FLAGSET(vp, VMODIFIED)
-#define VUNMODIFY(vp)	VN_FLAGCLR(vp, VMODIFIED)
-
-/*
- * Flags to VOP_SETATTR/VOP_GETATTR.
- */
-#define	ATTR_UTIME	0x01	/* non-default utime(2) request */
-#define	ATTR_DMI	0x08	/* invocation from a DMI function */
-#define	ATTR_LAZY	0x80	/* set/get attributes lazily */
-#define	ATTR_NONBLOCK	0x100	/* return EAGAIN if operation would block */
-
-/*
- * Flags to VOP_FSYNC and VOP_RECLAIM.
- */
-#define FSYNC_NOWAIT	0	/* asynchronous flush */
-#define FSYNC_WAIT	0x1	/* synchronous fsync or forced reclaim */
-#define FSYNC_INVAL	0x2	/* flush and invalidate cached data */
-#define FSYNC_DATA	0x4	/* synchronous fsync of data only */
-
-/*
- * Tracking vnode activity.
- */
-#if defined(XFS_VNODE_TRACE)
-
-#define	VNODE_TRACE_SIZE	16		/* number of trace entries */
-#define	VNODE_KTRACE_ENTRY	1
-#define	VNODE_KTRACE_EXIT	2
-#define	VNODE_KTRACE_HOLD	3
-#define	VNODE_KTRACE_REF	4
-#define	VNODE_KTRACE_RELE	5
-
-extern void vn_trace_entry(struct vnode *, char *, inst_t *);
-extern void vn_trace_exit(struct vnode *, char *, inst_t *);
-extern void vn_trace_hold(struct vnode *, char *, int, inst_t *);
-extern void vn_trace_ref(struct vnode *, char *, int, inst_t *);
-extern void vn_trace_rele(struct vnode *, char *, int, inst_t *);
-
-#define	VN_TRACE(vp)		\
-	vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address)
-#else
-#define	vn_trace_entry(a,b,c)
-#define	vn_trace_exit(a,b,c)
-#define	vn_trace_hold(a,b,c,d)
-#define	vn_trace_ref(a,b,c,d)
-#define	vn_trace_rele(a,b,c,d)
-#define	VN_TRACE(vp)
-#endif
-
-#endif	/* __XFS_VNODE_H__ */
diff -Nru a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/kmem.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_SUPPORT_KMEM_H__
+#define __XFS_SUPPORT_KMEM_H__
+
+#include <linux/mm.h>
+#include <linux/highmem.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+
+/*
+ * Cutoff point to use vmalloc instead of kmalloc.
+ */
+#define MAX_SLAB_SIZE	0x20000
+
+/*
+ * XFS uses slightly different names for these due to the
+ * IRIX heritage.
+ */
+#define	kmem_zone	kmem_cache_s
+#define kmem_zone_t	kmem_cache_t
+
+#define KM_SLEEP	0x0001
+#define KM_NOSLEEP	0x0002
+#define KM_NOFS		0x0004
+#define KM_MAYFAIL	0x0005
+
+typedef unsigned long xfs_pflags_t;
+
+#define PFLAGS_TEST_FSTRANS()           (current->flags & PF_FSTRANS)
+
+/* these could be nested, so we save state */
+#define PFLAGS_SET_FSTRANS(STATEP) do {	\
+	*(STATEP) = current->flags;	\
+	current->flags |= PF_FSTRANS;	\
+} while (0)
+
+#define PFLAGS_CLEAR_FSTRANS(STATEP) do { \
+	*(STATEP) = current->flags;	\
+	current->flags &= ~PF_FSTRANS;	\
+} while (0)
+
+/* Restore the PF_FSTRANS state to what was saved in STATEP */
+#define PFLAGS_RESTORE_FSTRANS(STATEP) do {     		\
+	current->flags = ((current->flags & ~PF_FSTRANS) |	\
+			  (*(STATEP) & PF_FSTRANS));		\
+} while (0)
+
+#define PFLAGS_DUP(OSTATEP, NSTATEP) do { \
+	*(NSTATEP) = *(OSTATEP);	\
+} while (0)
+
+static __inline unsigned int
+kmem_flags_convert(int flags)
+{
+	int lflags;
+
+#if DEBUG
+	if (unlikely(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL))) {
+		printk(KERN_WARNING
+		    "XFS: memory allocation with wrong flags (%x)\n", flags);
+		BUG();
+	}
+#endif
+
+	if (flags & KM_NOSLEEP) {
+		lflags = GFP_ATOMIC;
+	} else {
+		lflags = GFP_KERNEL;
+
+		/* avoid recusive callbacks to filesystem during transactions */
+		if (PFLAGS_TEST_FSTRANS() || (flags & KM_NOFS))
+			lflags &= ~__GFP_FS;
+
+		if (!(flags & KM_MAYFAIL))
+			lflags |= __GFP_NOFAIL;
+	}
+
+	return lflags;
+}
+
+static __inline void *
+kmem_alloc(size_t size, int flags)
+{
+	if (unlikely(MAX_SLAB_SIZE < size))
+		/* Avoid doing filesystem sensitive stuff to get this */
+		return __vmalloc(size, kmem_flags_convert(flags), PAGE_KERNEL);
+	return kmalloc(size, kmem_flags_convert(flags));
+}
+
+static __inline void *
+kmem_zalloc(size_t size, int flags)
+{
+	void *ptr = kmem_alloc(size, flags);
+	if (likely(ptr != NULL))
+		memset(ptr, 0, size);
+	return ptr;
+}
+
+static __inline void
+kmem_free(void *ptr, size_t size)
+{
+	if (unlikely((unsigned long)ptr < VMALLOC_START ||
+		     (unsigned long)ptr >= VMALLOC_END))
+		kfree(ptr);
+	else
+		vfree(ptr);
+}
+
+static __inline void *
+kmem_realloc(void *ptr, size_t newsize, size_t oldsize, int flags)
+{
+	void *new = kmem_alloc(newsize, flags);
+
+	if (likely(ptr != NULL)) {
+		if (likely(new != NULL))
+			memcpy(new, ptr, min(oldsize, newsize));
+		kmem_free(ptr, oldsize);
+	}
+
+	return new;
+}
+
+static __inline kmem_zone_t *
+kmem_zone_init(int size, char *zone_name)
+{
+	return kmem_cache_create(zone_name, size, 0, 0, NULL, NULL);
+}
+
+static __inline void *
+kmem_zone_alloc(kmem_zone_t *zone, int flags)
+{
+	return kmem_cache_alloc(zone, kmem_flags_convert(flags));
+}
+
+static __inline void *
+kmem_zone_zalloc(kmem_zone_t *zone, int flags)
+{
+	void *ptr = kmem_zone_alloc(zone, flags);
+	if (likely(ptr != NULL))
+		memset(ptr, 0, kmem_cache_size(zone));
+	return ptr;
+}
+
+static __inline void
+kmem_zone_free(kmem_zone_t *zone, void *ptr)
+{
+	kmem_cache_free(zone, ptr);
+}
+
+typedef struct shrinker *kmem_shaker_t;
+typedef int (*kmem_shake_func_t)(int, unsigned int);
+
+static __inline kmem_shaker_t
+kmem_shake_register(kmem_shake_func_t sfunc)
+{
+	return set_shrinker(DEFAULT_SEEKS, sfunc);
+}
+
+static __inline void
+kmem_shake_deregister(kmem_shaker_t shrinker)
+{
+	remove_shrinker(shrinker);
+}
+
+static __inline int
+kmem_shake_allow(unsigned int gfp_mask)
+{
+	return (gfp_mask & __GFP_WAIT);
+}
+
+#endif /* __XFS_SUPPORT_KMEM_H__ */
diff -Nru a/fs/xfs/linux-2.6/mrlock.h b/fs/xfs/linux-2.6/mrlock.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/mrlock.h	Tue Jun 15 22:20:42 2004
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_SUPPORT_MRLOCK_H__
+#define __XFS_SUPPORT_MRLOCK_H__
+
+#include <linux/rwsem.h>
+
+enum { MR_NONE, MR_ACCESS, MR_UPDATE };
+
+typedef struct {
+	struct rw_semaphore	mr_lock;
+	int			mr_writer;
+} mrlock_t;
+
+#define mrinit(mrp, name)	\
+	( (mrp)->mr_writer = 0, init_rwsem(&(mrp)->mr_lock) )
+#define mrlock_init(mrp, t,n,s)	mrinit(mrp, n)
+#define mrfree(mrp)		do { } while (0)
+#define mraccess(mrp)		mraccessf(mrp, 0)
+#define mrupdate(mrp)		mrupdatef(mrp, 0)
+
+static inline void mraccessf(mrlock_t *mrp, int flags)
+{
+	down_read(&mrp->mr_lock);
+}
+
+static inline void mrupdatef(mrlock_t *mrp, int flags)
+{
+	down_write(&mrp->mr_lock);
+	mrp->mr_writer = 1;
+}
+
+static inline int mrtryaccess(mrlock_t *mrp)
+{
+	return down_read_trylock(&mrp->mr_lock);
+}
+
+static inline int mrtryupdate(mrlock_t *mrp)
+{
+	if (!down_write_trylock(&mrp->mr_lock))
+		return 0;
+	mrp->mr_writer = 1;
+	return 1;
+}
+
+static inline void mrunlock(mrlock_t *mrp)
+{
+	if (mrp->mr_writer) {
+		mrp->mr_writer = 0;
+		up_write(&mrp->mr_lock);
+	} else {
+		up_read(&mrp->mr_lock);
+	}
+}
+
+static inline void mrdemote(mrlock_t *mrp)
+{
+	mrp->mr_writer = 0;
+	downgrade_write(&mrp->mr_lock);
+}
+
+#ifdef DEBUG
+/*
+ * Debug-only routine, without some platform-specific asm code, we can
+ * now only answer requests regarding whether we hold the lock for write
+ * (reader state is outside our visibility, we only track writer state).
+ * Note: means !ismrlocked would give false positivies, so don't do that.
+ */
+static inline int ismrlocked(mrlock_t *mrp, int type)
+{
+	if (mrp && type == MR_UPDATE)
+		return mrp->mr_writer;
+	return 1;
+}
+#endif
+
+#endif /* __XFS_SUPPORT_MRLOCK_H__ */
diff -Nru a/fs/xfs/linux-2.6/mutex.h b/fs/xfs/linux-2.6/mutex.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/mutex.h	Tue Jun 15 22:20:36 2004
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_SUPPORT_MUTEX_H__
+#define __XFS_SUPPORT_MUTEX_H__
+
+#include <linux/spinlock.h>
+#include <asm/semaphore.h>
+
+/*
+ * Map the mutex'es from IRIX to Linux semaphores.
+ *
+ * Destroy just simply initializes to -99 which should block all other
+ * callers.
+ */
+#define MUTEX_DEFAULT		0x0
+typedef struct semaphore	mutex_t;
+
+#define mutex_init(lock, type, name)		sema_init(lock, 1)
+#define mutex_destroy(lock)			sema_init(lock, -99)
+#define mutex_lock(lock, num)			down(lock)
+#define mutex_trylock(lock)			(down_trylock(lock) ? 0 : 1)
+#define mutex_unlock(lock)			up(lock)
+
+#endif /* __XFS_SUPPORT_MUTEX_H__ */
diff -Nru a/fs/xfs/linux-2.6/sema.h b/fs/xfs/linux-2.6/sema.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/sema.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_SUPPORT_SEMA_H__
+#define __XFS_SUPPORT_SEMA_H__
+
+#include <linux/time.h>
+#include <linux/wait.h>
+#include <asm/atomic.h>
+#include <asm/semaphore.h>
+
+/*
+ * sema_t structure just maps to struct semaphore in Linux kernel.
+ */
+
+typedef struct semaphore sema_t;
+
+#define init_sema(sp, val, c, d)	sema_init(sp, val)
+#define initsema(sp, val)		sema_init(sp, val)
+#define initnsema(sp, val, name)	sema_init(sp, val)
+#define psema(sp, b)			down(sp)
+#define vsema(sp)			up(sp)
+#define valusema(sp)			(atomic_read(&(sp)->count))
+#define freesema(sema)
+
+/*
+ * Map cpsema (try to get the sema) to down_trylock. We need to switch
+ * the return values since cpsema returns 1 (acquired) 0 (failed) and
+ * down_trylock returns the reverse 0 (acquired) 1 (failed).
+ */
+
+#define cpsema(sp)			(down_trylock(sp) ? 0 : 1)
+
+/*
+ * Didn't do cvsema(sp). Not sure how to map this to up/down/...
+ * It does a vsema if the values is < 0 other wise nothing.
+ */
+
+#endif /* __XFS_SUPPORT_SEMA_H__ */
diff -Nru a/fs/xfs/linux-2.6/spin.h b/fs/xfs/linux-2.6/spin.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/spin.h	Tue Jun 15 22:20:41 2004
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_SUPPORT_SPIN_H__
+#define __XFS_SUPPORT_SPIN_H__
+
+#include <linux/sched.h>	/* preempt needs this */
+#include <linux/spinlock.h>
+
+/*
+ * Map lock_t from IRIX to Linux spinlocks.
+ *
+ * We do not make use of lock_t from interrupt context, so we do not
+ * have to worry about disabling interrupts at all (unlike IRIX).
+ */
+
+typedef spinlock_t lock_t;
+
+#define SPLDECL(s)			unsigned long s
+
+#define spinlock_init(lock, name)	spin_lock_init(lock)
+#define	spinlock_destroy(lock)
+#define mutex_spinlock(lock)		({ spin_lock(lock); 0; })
+#define mutex_spinunlock(lock, s)	do { spin_unlock(lock); (void)s; } while (0)
+#define nested_spinlock(lock)		spin_lock(lock)
+#define nested_spinunlock(lock)		spin_unlock(lock)
+
+#endif /* __XFS_SUPPORT_SPIN_H__ */
diff -Nru a/fs/xfs/linux-2.6/sv.h b/fs/xfs/linux-2.6/sv.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/sv.h	Tue Jun 15 22:20:38 2004
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_SUPPORT_SV_H__
+#define __XFS_SUPPORT_SV_H__
+
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/spinlock.h>
+
+/*
+ * Synchronisation variables.
+ *
+ * (Parameters "pri", "svf" and "rts" are not implemented)
+ */
+
+typedef struct sv_s {
+	wait_queue_head_t waiters;
+} sv_t;
+
+#define SV_FIFO		0x0		/* sv_t is FIFO type */
+#define SV_LIFO		0x2		/* sv_t is LIFO type */
+#define SV_PRIO		0x4		/* sv_t is PRIO type */
+#define SV_KEYED	0x6		/* sv_t is KEYED type */
+#define SV_DEFAULT      SV_FIFO
+
+
+static inline void _sv_wait(sv_t *sv, spinlock_t *lock, int state,
+			     unsigned long timeout)
+{
+	DECLARE_WAITQUEUE(wait, current);
+
+	add_wait_queue_exclusive(&sv->waiters, &wait);
+	__set_current_state(state);
+	spin_unlock(lock);
+
+	schedule_timeout(timeout);
+
+	remove_wait_queue(&sv->waiters, &wait);
+}
+
+#define init_sv(sv,type,name,flag) \
+	init_waitqueue_head(&(sv)->waiters)
+#define sv_init(sv,flag,name) \
+	init_waitqueue_head(&(sv)->waiters)
+#define sv_destroy(sv) \
+	/*NOTHING*/
+#define sv_wait(sv, pri, lock, s) \
+	_sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT)
+#define sv_wait_sig(sv, pri, lock, s)   \
+	_sv_wait(sv, lock, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT)
+#define sv_timedwait(sv, pri, lock, s, svf, ts, rts) \
+	_sv_wait(sv, lock, TASK_UNINTERRUPTIBLE, timespec_to_jiffies(ts))
+#define sv_timedwait_sig(sv, pri, lock, s, svf, ts, rts) \
+	_sv_wait(sv, lock, TASK_INTERRUPTIBLE, timespec_to_jiffies(ts))
+#define sv_signal(sv) \
+	wake_up(&(sv)->waiters)
+#define sv_broadcast(sv) \
+	wake_up_all(&(sv)->waiters)
+
+#endif /* __XFS_SUPPORT_SV_H__ */
diff -Nru a/fs/xfs/linux-2.6/time.h b/fs/xfs/linux-2.6/time.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/time.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_SUPPORT_TIME_H__
+#define __XFS_SUPPORT_TIME_H__
+
+#include <linux/sched.h>
+#include <linux/time.h>
+
+typedef struct timespec timespec_t;
+
+static inline void delay(long ticks)
+{
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_timeout(ticks);
+}
+
+static inline void nanotime(struct timespec *tvp)
+{
+	*tvp = CURRENT_TIME;
+}
+
+#endif /* __XFS_SUPPORT_TIME_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_aops.c	Tue Jun 15 22:20:58 2004
@@ -0,0 +1,1284 @@
+/*
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.	 Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+#include "xfs_inum.h"
+#include "xfs_log.h"
+#include "xfs_sb.h"
+#include "xfs_dir.h"
+#include "xfs_dir2.h"
+#include "xfs_trans.h"
+#include "xfs_dmapi.h"
+#include "xfs_mount.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_alloc.h"
+#include "xfs_btree.h"
+#include "xfs_attr_sf.h"
+#include "xfs_dir_sf.h"
+#include "xfs_dir2_sf.h"
+#include "xfs_dinode.h"
+#include "xfs_inode.h"
+#include "xfs_error.h"
+#include "xfs_rw.h"
+#include "xfs_iomap.h"
+#include <linux/mpage.h>
+#include <linux/writeback.h>
+
+STATIC void xfs_count_page_state(struct page *, int *, int *, int *);
+STATIC void xfs_convert_page(struct inode *, struct page *, xfs_iomap_t *,
+		struct writeback_control *wbc, void *, int, int);
+
+#if defined(XFS_RW_TRACE)
+void
+xfs_page_trace(
+	int		tag,
+	struct inode	*inode,
+	struct page	*page,
+	int		mask)
+{
+	xfs_inode_t	*ip;
+	bhv_desc_t	*bdp;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	loff_t		isize = i_size_read(inode);
+	loff_t		offset = page->index << PAGE_CACHE_SHIFT;
+	int		delalloc = -1, unmapped = -1, unwritten = -1;
+
+	if (page_has_buffers(page))
+		xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
+
+	bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops);
+	ip = XFS_BHVTOI(bdp);
+	if (!ip->i_rwtrace)
+		return;
+
+	ktrace_enter(ip->i_rwtrace,
+		(void *)((unsigned long)tag),
+		(void *)ip,
+		(void *)inode,
+		(void *)page,
+		(void *)((unsigned long)mask),
+		(void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
+		(void *)((unsigned long)((isize >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(isize & 0xffffffff)),
+		(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(offset & 0xffffffff)),
+		(void *)((unsigned long)delalloc),
+		(void *)((unsigned long)unmapped),
+		(void *)((unsigned long)unwritten),
+		(void *)NULL,
+		(void *)NULL);
+}
+#else
+#define xfs_page_trace(tag, inode, page, mask)
+#endif
+
+void
+linvfs_unwritten_done(
+	struct buffer_head	*bh,
+	int			uptodate)
+{
+	xfs_buf_t		*pb = (xfs_buf_t *)bh->b_private;
+
+	ASSERT(buffer_unwritten(bh));
+	bh->b_end_io = NULL;
+	clear_buffer_unwritten(bh);
+	if (!uptodate)
+		pagebuf_ioerror(pb, EIO);
+	if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
+		pagebuf_iodone(pb, 1, 1);
+	}
+	end_buffer_async_write(bh, uptodate);
+}
+
+/*
+ * Issue transactions to convert a buffer range from unwritten
+ * to written extents (buffered IO).
+ */
+STATIC void
+linvfs_unwritten_convert(
+	xfs_buf_t	*bp)
+{
+	vnode_t		*vp = XFS_BUF_FSPRIVATE(bp, vnode_t *);
+	int		error;
+
+	BUG_ON(atomic_read(&bp->pb_hold) < 1);
+	VOP_BMAP(vp, XFS_BUF_OFFSET(bp), XFS_BUF_SIZE(bp),
+			BMAPI_UNWRITTEN, NULL, NULL, error);
+	XFS_BUF_SET_FSPRIVATE(bp, NULL);
+	XFS_BUF_CLR_IODONE_FUNC(bp);
+	XFS_BUF_UNDATAIO(bp);
+	iput(LINVFS_GET_IP(vp));
+	pagebuf_iodone(bp, 0, 0);
+}
+
+/*
+ * Issue transactions to convert a buffer range from unwritten
+ * to written extents (direct IO).
+ */
+STATIC void
+linvfs_unwritten_convert_direct(
+	struct inode	*inode,
+	loff_t		offset,
+	ssize_t		size,
+	void		*private)
+{
+	ASSERT(!private || inode == (struct inode *)private);
+
+	/* private indicates an unwritten extent lay beneath this IO,
+	 * see linvfs_get_block_core.
+	 */
+	if (private && size > 0) {
+		vnode_t	*vp = LINVFS_GET_VP(inode);
+		int	error;
+
+		VOP_BMAP(vp, offset, size, BMAPI_UNWRITTEN, NULL, NULL, error);
+	}
+}
+
+STATIC int
+xfs_map_blocks(
+	struct inode		*inode,
+	loff_t			offset,
+	ssize_t			count,
+	xfs_iomap_t		*iomapp,
+	int			flags)
+{
+	vnode_t			*vp = LINVFS_GET_VP(inode);
+	int			error, niomaps = 1;
+
+	if (((flags & (BMAPI_DIRECT|BMAPI_SYNC)) == BMAPI_DIRECT) &&
+	    (offset >= i_size_read(inode)))
+		count = max_t(ssize_t, count, XFS_WRITE_IO_LOG);
+retry:
+	VOP_BMAP(vp, offset, count, flags, iomapp, &niomaps, error);
+	if ((error == EAGAIN) || (error == EIO))
+		return -error;
+	if (unlikely((flags & (BMAPI_WRITE|BMAPI_DIRECT)) ==
+					(BMAPI_WRITE|BMAPI_DIRECT) && niomaps &&
+					(iomapp->iomap_flags & IOMAP_DELAY))) {
+		flags = BMAPI_ALLOCATE;
+		goto retry;
+	}
+	if (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)) {
+		VMODIFY(vp);
+	}
+	return -error;
+}
+
+/*
+ * Finds the corresponding mapping in block @map array of the
+ * given @offset within a @page.
+ */
+STATIC xfs_iomap_t *
+xfs_offset_to_map(
+	struct page		*page,
+	xfs_iomap_t		*iomapp,
+	unsigned long		offset)
+{
+	loff_t			full_offset;	/* offset from start of file */
+
+	ASSERT(offset < PAGE_CACHE_SIZE);
+
+	full_offset = page->index;		/* NB: using 64bit number */
+	full_offset <<= PAGE_CACHE_SHIFT;	/* offset from file start */
+	full_offset += offset;			/* offset from page start */
+
+	if (full_offset < iomapp->iomap_offset)
+		return NULL;
+	if (iomapp->iomap_offset + (iomapp->iomap_bsize -1) >= full_offset)
+		return iomapp;
+	return NULL;
+}
+
+STATIC void
+xfs_map_at_offset(
+	struct page		*page,
+	struct buffer_head	*bh,
+	unsigned long		offset,
+	int			block_bits,
+	xfs_iomap_t		*iomapp)
+{
+	xfs_daddr_t		bn;
+	loff_t			delta;
+	int			sector_shift;
+
+	ASSERT(!(iomapp->iomap_flags & IOMAP_HOLE));
+	ASSERT(!(iomapp->iomap_flags & IOMAP_DELAY));
+	ASSERT(iomapp->iomap_bn != IOMAP_DADDR_NULL);
+
+	delta = page->index;
+	delta <<= PAGE_CACHE_SHIFT;
+	delta += offset;
+	delta -= iomapp->iomap_offset;
+	delta >>= block_bits;
+
+	sector_shift = block_bits - BBSHIFT;
+	bn = iomapp->iomap_bn >> sector_shift;
+	bn += delta;
+	ASSERT((bn << sector_shift) >= iomapp->iomap_bn);
+
+	lock_buffer(bh);
+	bh->b_blocknr = bn;
+	bh->b_bdev = iomapp->iomap_target->pbr_bdev;
+	set_buffer_mapped(bh);
+	clear_buffer_delay(bh);
+}
+
+/*
+ * Look for a page at index which is unlocked and contains our
+ * unwritten extent flagged buffers at its head.  Returns page
+ * locked and with an extra reference count, and length of the
+ * unwritten extent component on this page that we can write,
+ * in units of filesystem blocks.
+ */
+STATIC struct page *
+xfs_probe_unwritten_page(
+	struct address_space	*mapping,
+	pgoff_t			index,
+	xfs_iomap_t		*iomapp,
+	xfs_buf_t		*pb,
+	unsigned long		max_offset,
+	unsigned long		*fsbs,
+	unsigned int            bbits)
+{
+	struct page		*page;
+
+	page = find_trylock_page(mapping, index);
+	if (!page)
+		return 0;
+	if (PageWriteback(page))
+		goto out;
+
+	if (page->mapping && page_has_buffers(page)) {
+		struct buffer_head	*bh, *head;
+		unsigned long		p_offset = 0;
+
+		*fsbs = 0;
+		bh = head = page_buffers(page);
+		do {
+			if (!buffer_unwritten(bh))
+				break;
+			if (!xfs_offset_to_map(page, iomapp, p_offset))
+				break;
+			if (p_offset >= max_offset)
+				break;
+			xfs_map_at_offset(page, bh, p_offset, bbits, iomapp);
+			set_buffer_unwritten_io(bh);
+			bh->b_private = pb;
+			p_offset += bh->b_size;
+			(*fsbs)++;
+		} while ((bh = bh->b_this_page) != head);
+
+		if (p_offset)
+			return page;
+	}
+
+out:
+	unlock_page(page);
+	return NULL;
+}
+
+/*
+ * Look for a page at index which is unlocked and not mapped
+ * yet - clustering for mmap write case.
+ */
+STATIC unsigned int
+xfs_probe_unmapped_page(
+	struct address_space	*mapping,
+	pgoff_t			index,
+	unsigned int		pg_offset)
+{
+	struct page		*page;
+	int			ret = 0;
+
+	page = find_trylock_page(mapping, index);
+	if (!page)
+		return 0;
+	if (PageWriteback(page))
+		goto out;
+
+	if (page->mapping && PageDirty(page)) {
+		if (page_has_buffers(page)) {
+			struct buffer_head	*bh, *head;
+
+			bh = head = page_buffers(page);
+			do {
+				if (buffer_mapped(bh) || !buffer_uptodate(bh))
+					break;
+				ret += bh->b_size;
+				if (ret >= pg_offset)
+					break;
+			} while ((bh = bh->b_this_page) != head);
+		} else
+			ret = PAGE_CACHE_SIZE;
+	}
+
+out:
+	unlock_page(page);
+	return ret;
+}
+
+STATIC unsigned int
+xfs_probe_unmapped_cluster(
+	struct inode		*inode,
+	struct page		*startpage,
+	struct buffer_head	*bh,
+	struct buffer_head	*head)
+{
+	pgoff_t			tindex, tlast, tloff;
+	unsigned int		pg_offset, len, total = 0;
+	struct address_space	*mapping = inode->i_mapping;
+
+	/* First sum forwards in this page */
+	do {
+		if (buffer_mapped(bh))
+			break;
+		total += bh->b_size;
+	} while ((bh = bh->b_this_page) != head);
+
+	/* If we reached the end of the page, sum forwards in
+	 * following pages.
+	 */
+	if (bh == head) {
+		tlast = i_size_read(inode) >> PAGE_CACHE_SHIFT;
+		/* Prune this back to avoid pathological behavior */
+		tloff = min(tlast, startpage->index + 64);
+		for (tindex = startpage->index + 1; tindex < tloff; tindex++) {
+			len = xfs_probe_unmapped_page(mapping, tindex,
+							PAGE_CACHE_SIZE);
+			if (!len)
+				return total;
+			total += len;
+		}
+		if (tindex == tlast &&
+		    (pg_offset = i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
+			total += xfs_probe_unmapped_page(mapping,
+							tindex, pg_offset);
+		}
+	}
+	return total;
+}
+
+/*
+ * Probe for a given page (index) in the inode and test if it is delayed
+ * and without unwritten buffers.  Returns page locked and with an extra
+ * reference count.
+ */
+STATIC struct page *
+xfs_probe_delalloc_page(
+	struct inode		*inode,
+	pgoff_t			index)
+{
+	struct page		*page;
+
+	page = find_trylock_page(inode->i_mapping, index);
+	if (!page)
+		return NULL;
+	if (PageWriteback(page))
+		goto out;
+
+	if (page->mapping && page_has_buffers(page)) {
+		struct buffer_head	*bh, *head;
+		int			acceptable = 0;
+
+		bh = head = page_buffers(page);
+		do {
+			if (buffer_unwritten(bh)) {
+				acceptable = 0;
+				break;
+			} else if (buffer_delay(bh)) {
+				acceptable = 1;
+			}
+		} while ((bh = bh->b_this_page) != head);
+
+		if (acceptable)
+			return page;
+	}
+
+out:
+	unlock_page(page);
+	return NULL;
+}
+
+STATIC int
+xfs_map_unwritten(
+	struct inode		*inode,
+	struct page		*start_page,
+	struct buffer_head	*head,
+	struct buffer_head	*curr,
+	unsigned long		p_offset,
+	int			block_bits,
+	xfs_iomap_t		*iomapp,
+	struct writeback_control *wbc,
+	int			startio,
+	int			all_bh)
+{
+	struct buffer_head	*bh = curr;
+	xfs_iomap_t		*tmp;
+	xfs_buf_t		*pb;
+	loff_t			offset, size;
+	unsigned long		nblocks = 0;
+
+	offset = start_page->index;
+	offset <<= PAGE_CACHE_SHIFT;
+	offset += p_offset;
+
+	/* get an "empty" pagebuf to manage IO completion
+	 * Proper values will be set before returning */
+	pb = pagebuf_lookup(iomapp->iomap_target, 0, 0, 0);
+	if (!pb)
+		return -EAGAIN;
+
+	/* Take a reference to the inode to prevent it from
+	 * being reclaimed while we have outstanding unwritten
+	 * extent IO on it.
+	 */
+	if ((igrab(inode)) != inode) {
+		pagebuf_free(pb);
+		return -EAGAIN;
+	}
+
+	/* Set the count to 1 initially, this will stop an I/O
+	 * completion callout which happens before we have started
+	 * all the I/O from calling pagebuf_iodone too early.
+	 */
+	atomic_set(&pb->pb_io_remaining, 1);
+
+	/* First map forwards in the page consecutive buffers
+	 * covering this unwritten extent
+	 */
+	do {
+		if (!buffer_unwritten(bh))
+			break;
+		tmp = xfs_offset_to_map(start_page, iomapp, p_offset);
+		if (!tmp)
+			break;
+		xfs_map_at_offset(start_page, bh, p_offset, block_bits, iomapp);
+		set_buffer_unwritten_io(bh);
+		bh->b_private = pb;
+		p_offset += bh->b_size;
+		nblocks++;
+	} while ((bh = bh->b_this_page) != head);
+
+	atomic_add(nblocks, &pb->pb_io_remaining);
+
+	/* If we reached the end of the page, map forwards in any
+	 * following pages which are also covered by this extent.
+	 */
+	if (bh == head) {
+		struct address_space	*mapping = inode->i_mapping;
+		pgoff_t			tindex, tloff, tlast;
+		unsigned long		bs;
+		unsigned int		pg_offset, bbits = inode->i_blkbits;
+		struct page		*page;
+
+		tlast = i_size_read(inode) >> PAGE_CACHE_SHIFT;
+		tloff = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
+		tloff = min(tlast, tloff);
+		for (tindex = start_page->index + 1; tindex < tloff; tindex++) {
+			page = xfs_probe_unwritten_page(mapping,
+						tindex, iomapp, pb,
+						PAGE_CACHE_SIZE, &bs, bbits);
+			if (!page)
+				break;
+			nblocks += bs;
+			atomic_add(bs, &pb->pb_io_remaining);
+			xfs_convert_page(inode, page, iomapp, wbc, pb,
+							startio, all_bh);
+			/* stop if converting the next page might add
+			 * enough blocks that the corresponding byte
+			 * count won't fit in our ulong page buf length */
+			if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
+				goto enough;
+		}
+
+		if (tindex == tlast &&
+		    (pg_offset = (i_size_read(inode) & (PAGE_CACHE_SIZE - 1)))) {
+			page = xfs_probe_unwritten_page(mapping,
+							tindex, iomapp, pb,
+							pg_offset, &bs, bbits);
+			if (page) {
+				nblocks += bs;
+				atomic_add(bs, &pb->pb_io_remaining);
+				xfs_convert_page(inode, page, iomapp, wbc, pb,
+							startio, all_bh);
+				if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
+					goto enough;
+			}
+		}
+	}
+
+enough:
+	size = nblocks;		/* NB: using 64bit number here */
+	size <<= block_bits;	/* convert fsb's to byte range */
+
+	XFS_BUF_DATAIO(pb);
+	XFS_BUF_ASYNC(pb);
+	XFS_BUF_SET_SIZE(pb, size);
+	XFS_BUF_SET_COUNT(pb, size);
+	XFS_BUF_SET_OFFSET(pb, offset);
+	XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode));
+	XFS_BUF_SET_IODONE_FUNC(pb, linvfs_unwritten_convert);
+
+	if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
+		pagebuf_iodone(pb, 1, 1);
+	}
+
+	return 0;
+}
+
+STATIC void
+xfs_submit_page(
+	struct page		*page,
+	struct buffer_head	*bh_arr[],
+	int			cnt)
+{
+	struct buffer_head	*bh;
+	int			i;
+
+	BUG_ON(PageWriteback(page));
+	set_page_writeback(page);
+	clear_page_dirty(page);
+	unlock_page(page);
+
+	if (cnt) {
+		for (i = 0; i < cnt; i++) {
+			bh = bh_arr[i];
+			mark_buffer_async_write(bh);
+			if (buffer_unwritten(bh))
+				set_buffer_unwritten_io(bh);
+			set_buffer_uptodate(bh);
+			clear_buffer_dirty(bh);
+		}
+
+		for (i = 0; i < cnt; i++)
+			submit_bh(WRITE, bh_arr[i]);
+	} else
+		end_page_writeback(page);
+}
+
+/*
+ * Allocate & map buffers for page given the extent map. Write it out.
+ * except for the original page of a writepage, this is called on
+ * delalloc/unwritten pages only, for the original page it is possible
+ * that the page has no mapping at all.
+ */
+STATIC void
+xfs_convert_page(
+	struct inode		*inode,
+	struct page		*page,
+	xfs_iomap_t		*iomapp,
+	struct writeback_control *wbc,
+	void			*private,
+	int			startio,
+	int			all_bh)
+{
+	struct buffer_head	*bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
+	xfs_iomap_t		*mp = iomapp, *tmp;
+	unsigned long		end, offset;
+	pgoff_t			end_index;
+	int			i = 0, index = 0;
+	int			bbits = inode->i_blkbits;
+
+	end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT;
+	if (page->index < end_index) {
+		end = PAGE_CACHE_SIZE;
+	} else {
+		end = i_size_read(inode) & (PAGE_CACHE_SIZE-1);
+	}
+	bh = head = page_buffers(page);
+	do {
+		offset = i << bbits;
+		if (!(PageUptodate(page) || buffer_uptodate(bh)))
+			continue;
+		if (buffer_mapped(bh) && all_bh &&
+		    !buffer_unwritten(bh) && !buffer_delay(bh)) {
+			if (startio && (offset < end)) {
+				lock_buffer(bh);
+				bh_arr[index++] = bh;
+			}
+			continue;
+		}
+		tmp = xfs_offset_to_map(page, mp, offset);
+		if (!tmp)
+			continue;
+		ASSERT(!(tmp->iomap_flags & IOMAP_HOLE));
+		ASSERT(!(tmp->iomap_flags & IOMAP_DELAY));
+
+		/* If this is a new unwritten extent buffer (i.e. one
+		 * that we haven't passed in private data for, we must
+		 * now map this buffer too.
+		 */
+		if (buffer_unwritten(bh) && !bh->b_end_io) {
+			ASSERT(tmp->iomap_flags & IOMAP_UNWRITTEN);
+			xfs_map_unwritten(inode, page, head, bh, offset,
+					bbits, tmp, wbc, startio, all_bh);
+		} else if (! (buffer_unwritten(bh) && buffer_locked(bh))) {
+			xfs_map_at_offset(page, bh, offset, bbits, tmp);
+			if (buffer_unwritten(bh)) {
+				set_buffer_unwritten_io(bh);
+				bh->b_private = private;
+				ASSERT(private);
+			}
+		}
+		if (startio && (offset < end)) {
+			bh_arr[index++] = bh;
+		} else {
+			set_buffer_dirty(bh);
+			unlock_buffer(bh);
+			mark_buffer_dirty(bh);
+		}
+	} while (i++, (bh = bh->b_this_page) != head);
+
+	if (startio) {
+		wbc->nr_to_write--;
+		xfs_submit_page(page, bh_arr, index);
+	} else {
+		unlock_page(page);
+	}
+}
+
+/*
+ * Convert & write out a cluster of pages in the same extent as defined
+ * by mp and following the start page.
+ */
+STATIC void
+xfs_cluster_write(
+	struct inode		*inode,
+	pgoff_t			tindex,
+	xfs_iomap_t		*iomapp,
+	struct writeback_control *wbc,
+	int			startio,
+	int			all_bh)
+{
+	pgoff_t			tlast;
+	struct page		*page;
+
+	tlast = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
+	for (; tindex < tlast; tindex++) {
+		page = xfs_probe_delalloc_page(inode, tindex);
+		if (!page)
+			break;
+		xfs_convert_page(inode, page, iomapp, wbc, NULL,
+				startio, all_bh);
+	}
+}
+
+/*
+ * Calling this without startio set means we are being asked to make a dirty
+ * page ready for freeing it's buffers.  When called with startio set then
+ * we are coming from writepage.
+ *
+ * When called with startio set it is important that we write the WHOLE
+ * page if possible.
+ * The bh->b_state's cannot know if any of the blocks or which block for
+ * that matter are dirty due to mmap writes, and therefore bh uptodate is
+ * only vaild if the page itself isn't completely uptodate.  Some layers
+ * may clear the page dirty flag prior to calling write page, under the
+ * assumption the entire page will be written out; by not writing out the
+ * whole page the page can be reused before all valid dirty data is
+ * written out.  Note: in the case of a page that has been dirty'd by
+ * mapwrite and but partially setup by block_prepare_write the
+ * bh->b_states's will not agree and only ones setup by BPW/BCW will have
+ * valid state, thus the whole page must be written out thing.
+ */
+
+STATIC int
+xfs_page_state_convert(
+	struct inode	*inode,
+	struct page	*page,
+	struct writeback_control *wbc,
+	int		startio,
+	int		unmapped) /* also implies page uptodate */
+{
+	struct buffer_head	*bh_arr[MAX_BUF_PER_PAGE], *bh, *head;
+	xfs_iomap_t		*iomp, iomap;
+	unsigned long		p_offset = 0;
+	pgoff_t			end_index;
+	loff_t			offset;
+	unsigned long long	end_offset;
+	int			len, err, i, cnt = 0, uptodate = 1;
+	int			flags = startio ? 0 : BMAPI_TRYLOCK;
+	int			page_dirty = 1;
+
+
+	/* Are we off the end of the file ? */
+	end_index = i_size_read(inode) >> PAGE_CACHE_SHIFT;
+	if (page->index >= end_index) {
+		if ((page->index >= end_index + 1) ||
+		    !(i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
+			err = -EIO;
+			goto error;
+		}
+	}
+
+	offset = (loff_t)page->index << PAGE_CACHE_SHIFT;
+	end_offset = min_t(unsigned long long,
+			offset + PAGE_CACHE_SIZE, i_size_read(inode));
+
+	bh = head = page_buffers(page);
+	iomp = NULL;
+
+	len = bh->b_size;
+	do {
+		if (offset >= end_offset)
+			break;
+		if (!buffer_uptodate(bh))
+			uptodate = 0;
+		if (!(PageUptodate(page) || buffer_uptodate(bh)) && !startio)
+			continue;
+
+		if (iomp) {
+			iomp = xfs_offset_to_map(page, &iomap, p_offset);
+		}
+
+		/*
+		 * First case, map an unwritten extent and prepare for
+		 * extent state conversion transaction on completion.
+		 */
+		if (buffer_unwritten(bh)) {
+			if (!iomp) {
+				err = xfs_map_blocks(inode, offset, len, &iomap,
+						BMAPI_READ|BMAPI_IGNSTATE);
+				if (err) {
+					goto error;
+				}
+				iomp = xfs_offset_to_map(page, &iomap,
+								p_offset);
+			}
+			if (iomp && startio) {
+				if (!bh->b_end_io) {
+					err = xfs_map_unwritten(inode, page,
+							head, bh, p_offset,
+							inode->i_blkbits, iomp,
+							wbc, startio, unmapped);
+					if (err) {
+						goto error;
+					}
+				}
+				bh_arr[cnt++] = bh;
+				page_dirty = 0;
+			}
+		/*
+		 * Second case, allocate space for a delalloc buffer.
+		 * We can return EAGAIN here in the release page case.
+		 */
+		} else if (buffer_delay(bh)) {
+			if (!iomp) {
+				err = xfs_map_blocks(inode, offset, len, &iomap,
+						BMAPI_ALLOCATE | flags);
+				if (err) {
+					goto error;
+				}
+				iomp = xfs_offset_to_map(page, &iomap,
+								p_offset);
+			}
+			if (iomp) {
+				xfs_map_at_offset(page, bh, p_offset,
+						inode->i_blkbits, iomp);
+				if (startio) {
+					bh_arr[cnt++] = bh;
+				} else {
+					set_buffer_dirty(bh);
+					unlock_buffer(bh);
+					mark_buffer_dirty(bh);
+				}
+				page_dirty = 0;
+			}
+		} else if ((buffer_uptodate(bh) || PageUptodate(page)) &&
+			   (unmapped || startio)) {
+
+			if (!buffer_mapped(bh)) {
+				int	size;
+
+				/*
+				 * Getting here implies an unmapped buffer
+				 * was found, and we are in a path where we
+				 * need to write the whole page out.
+				 */
+				if (!iomp) {
+					size = xfs_probe_unmapped_cluster(
+							inode, page, bh, head);
+					err = xfs_map_blocks(inode, offset,
+							size, &iomap,
+							BMAPI_WRITE|BMAPI_MMAP);
+					if (err) {
+						goto error;
+					}
+					iomp = xfs_offset_to_map(page, &iomap,
+								     p_offset);
+				}
+				if (iomp) {
+					xfs_map_at_offset(page,
+							bh, p_offset,
+							inode->i_blkbits, iomp);
+					if (startio) {
+						bh_arr[cnt++] = bh;
+					} else {
+						set_buffer_dirty(bh);
+						unlock_buffer(bh);
+						mark_buffer_dirty(bh);
+					}
+					page_dirty = 0;
+				}
+			} else if (startio) {
+				if (buffer_uptodate(bh) &&
+				    !test_and_set_bit(BH_Lock, &bh->b_state)) {
+					bh_arr[cnt++] = bh;
+					page_dirty = 0;
+				}
+			}
+		}
+	} while (offset += len, p_offset += len,
+		((bh = bh->b_this_page) != head));
+
+	if (uptodate && bh == head)
+		SetPageUptodate(page);
+
+	if (startio)
+		xfs_submit_page(page, bh_arr, cnt);
+
+	if (iomp) {
+		xfs_cluster_write(inode, page->index + 1, iomp, wbc,
+				startio, unmapped);
+	}
+
+	return page_dirty;
+
+error:
+	for (i = 0; i < cnt; i++) {
+		unlock_buffer(bh_arr[i]);
+	}
+
+	/*
+	 * If it's delalloc and we have nowhere to put it,
+	 * throw it away, unless the lower layers told
+	 * us to try again.
+	 */
+	if (err != -EAGAIN) {
+		if (!unmapped) {
+			block_invalidatepage(page, 0);
+		}
+		ClearPageUptodate(page);
+	}
+	return err;
+}
+
+STATIC int
+linvfs_get_block_core(
+	struct inode		*inode,
+	sector_t		iblock,
+	unsigned long		blocks,
+	struct buffer_head	*bh_result,
+	int			create,
+	int			direct,
+	bmapi_flags_t		flags)
+{
+	vnode_t			*vp = LINVFS_GET_VP(inode);
+	xfs_iomap_t		iomap;
+	int			retpbbm = 1;
+	int			error;
+	ssize_t			size;
+	loff_t			offset = (loff_t)iblock << inode->i_blkbits;
+
+	if (blocks)
+		size = blocks << inode->i_blkbits;
+	else
+		size = 1 << inode->i_blkbits;
+
+	VOP_BMAP(vp, offset, size,
+		create ? flags : BMAPI_READ, &iomap, &retpbbm, error);
+	if (error)
+		return -error;
+
+	if (retpbbm == 0)
+		return 0;
+
+	if (iomap.iomap_bn != IOMAP_DADDR_NULL) {
+		xfs_daddr_t		bn;
+		loff_t			delta;
+
+		/* For unwritten extents do not report a disk address on
+		 * the read case (treat as if we're reading into a hole).
+		 */
+		if (create || !(iomap.iomap_flags & IOMAP_UNWRITTEN)) {
+			delta = offset - iomap.iomap_offset;
+			delta >>= inode->i_blkbits;
+
+			bn = iomap.iomap_bn >> (inode->i_blkbits - BBSHIFT);
+			bn += delta;
+
+			bh_result->b_blocknr = bn;
+			bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
+			set_buffer_mapped(bh_result);
+		}
+		if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) {
+			if (direct)
+				bh_result->b_private = inode;
+			set_buffer_unwritten(bh_result);
+			set_buffer_delay(bh_result);
+		}
+	}
+
+	/* If this is a realtime file, data might be on a new device */
+	bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
+
+	/* If we previously allocated a block out beyond eof and
+	 * we are now coming back to use it then we will need to
+	 * flag it as new even if it has a disk address.
+	 */
+	if (create &&
+	    ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) ||
+	     (offset >= i_size_read(inode)) || (iomap.iomap_flags & IOMAP_NEW))) {
+		set_buffer_new(bh_result);
+	}
+
+	if (iomap.iomap_flags & IOMAP_DELAY) {
+		if (unlikely(direct))
+			BUG();
+		if (create) {
+			set_buffer_mapped(bh_result);
+			set_buffer_uptodate(bh_result);
+		}
+		bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
+		set_buffer_delay(bh_result);
+	}
+
+	if (blocks) {
+		loff_t iosize;
+		iosize = (iomap.iomap_bsize - iomap.iomap_delta);
+		bh_result->b_size =
+		    (ssize_t)min(iosize, (loff_t)(blocks << inode->i_blkbits));
+	}
+
+	return 0;
+}
+
+int
+linvfs_get_block(
+	struct inode		*inode,
+	sector_t		iblock,
+	struct buffer_head	*bh_result,
+	int			create)
+{
+	return linvfs_get_block_core(inode, iblock, 0, bh_result,
+					create, 0, BMAPI_WRITE);
+}
+
+STATIC int
+linvfs_get_block_sync(
+	struct inode		*inode,
+	sector_t		iblock,
+	struct buffer_head	*bh_result,
+	int			create)
+{
+	return linvfs_get_block_core(inode, iblock, 0, bh_result,
+					create, 0, BMAPI_SYNC|BMAPI_WRITE);
+}
+
+STATIC int
+linvfs_get_blocks_direct(
+	struct inode		*inode,
+	sector_t		iblock,
+	unsigned long		max_blocks,
+	struct buffer_head	*bh_result,
+	int			create)
+{
+	return linvfs_get_block_core(inode, iblock, max_blocks, bh_result,
+					create, 1, BMAPI_WRITE|BMAPI_DIRECT);
+}
+
+STATIC ssize_t
+linvfs_direct_IO(
+	int			rw,
+	struct kiocb		*iocb,
+	const struct iovec	*iov,
+	loff_t			offset,
+	unsigned long		nr_segs)
+{
+	struct file	*file = iocb->ki_filp;
+	struct inode	*inode = file->f_mapping->host;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	xfs_iomap_t	iomap;
+	int		maps = 1;
+	int		error;
+
+	VOP_BMAP(vp, offset, 0, BMAPI_DEVICE, &iomap, &maps, error);
+	if (error)
+		return -error;
+
+	return blockdev_direct_IO_no_locking(rw, iocb, inode,
+		iomap.iomap_target->pbr_bdev,
+		iov, offset, nr_segs,
+		linvfs_get_blocks_direct,
+		linvfs_unwritten_convert_direct);
+}
+
+
+STATIC sector_t
+linvfs_bmap(
+	struct address_space	*mapping,
+	sector_t		block)
+{
+	struct inode		*inode = (struct inode *)mapping->host;
+	vnode_t			*vp = LINVFS_GET_VP(inode);
+	int			error;
+
+	vn_trace_entry(vp, "linvfs_bmap", (inst_t *)__return_address);
+
+	VOP_RWLOCK(vp, VRWLOCK_READ);
+	VOP_FLUSH_PAGES(vp, (xfs_off_t)0, -1, 0, FI_REMAPF, error);
+	VOP_RWUNLOCK(vp, VRWLOCK_READ);
+	return generic_block_bmap(mapping, block, linvfs_get_block);
+}
+
+STATIC int
+linvfs_readpage(
+	struct file		*unused,
+	struct page		*page)
+{
+	return mpage_readpage(page, linvfs_get_block);
+}
+
+STATIC int
+linvfs_readpages(
+	struct file		*unused,
+	struct address_space	*mapping,
+	struct list_head	*pages,
+	unsigned		nr_pages)
+{
+	return mpage_readpages(mapping, pages, nr_pages, linvfs_get_block);
+}
+
+STATIC void
+xfs_count_page_state(
+	struct page		*page,
+	int			*delalloc,
+	int			*unmapped,
+	int			*unwritten)
+{
+	struct buffer_head	*bh, *head;
+
+	*delalloc = *unmapped = *unwritten = 0;
+
+	bh = head = page_buffers(page);
+	do {
+		if (buffer_uptodate(bh) && !buffer_mapped(bh))
+			(*unmapped) = 1;
+		else if (buffer_unwritten(bh) && !buffer_delay(bh))
+			clear_buffer_unwritten(bh);
+		else if (buffer_unwritten(bh))
+			(*unwritten) = 1;
+		else if (buffer_delay(bh))
+			(*delalloc) = 1;
+	} while ((bh = bh->b_this_page) != head);
+}
+
+
+/*
+ * writepage: Called from one of two places:
+ *
+ * 1. we are flushing a delalloc buffer head.
+ *
+ * 2. we are writing out a dirty page. Typically the page dirty
+ *    state is cleared before we get here. In this case is it
+ *    conceivable we have no buffer heads.
+ *
+ * For delalloc space on the page we need to allocate space and
+ * flush it. For unmapped buffer heads on the page we should
+ * allocate space if the page is uptodate. For any other dirty
+ * buffer heads on the page we should flush them.
+ *
+ * If we detect that a transaction would be required to flush
+ * the page, we have to check the process flags first, if we
+ * are already in a transaction or disk I/O during allocations
+ * is off, we need to fail the writepage and redirty the page.
+ */
+
+STATIC int
+linvfs_writepage(
+	struct page		*page,
+	struct writeback_control *wbc)
+{
+	int			error;
+	int			need_trans;
+	int			delalloc, unmapped, unwritten;
+	struct inode		*inode = page->mapping->host;
+
+	xfs_page_trace(XFS_WRITEPAGE_ENTER, inode, page, 0);
+
+	/*
+	 * We need a transaction if:
+	 *  1. There are delalloc buffers on the page
+	 *  2. The page is uptodate and we have unmapped buffers
+	 *  3. The page is uptodate and we have no buffers
+	 *  4. There are unwritten buffers on the page
+	 */
+
+	if (!page_has_buffers(page)) {
+		unmapped = 1;
+		need_trans = 1;
+	} else {
+		xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
+		if (!PageUptodate(page))
+			unmapped = 0;
+		need_trans = delalloc + unmapped + unwritten;
+	}
+
+	/*
+	 * If we need a transaction and the process flags say
+	 * we are already in a transaction, or no IO is allowed
+	 * then mark the page dirty again and leave the page
+	 * as is.
+	 */
+	if (PFLAGS_TEST_FSTRANS() && need_trans)
+		goto out_fail;
+
+	/*
+	 * Delay hooking up buffer heads until we have
+	 * made our go/no-go decision.
+	 */
+	if (!page_has_buffers(page))
+		create_empty_buffers(page, 1 << inode->i_blkbits, 0);
+
+	/*
+	 * Convert delayed allocate, unwritten or unmapped space
+	 * to real space and flush out to disk.
+	 */
+	error = xfs_page_state_convert(inode, page, wbc, 1, unmapped);
+	if (error == -EAGAIN)
+		goto out_fail;
+	if (unlikely(error < 0))
+		goto out_unlock;
+
+	return 0;
+
+out_fail:
+	set_page_dirty(page);
+	unlock_page(page);
+	return 0;
+out_unlock:
+	unlock_page(page);
+	return error;
+}
+
+/*
+ * Called to move a page into cleanable state - and from there
+ * to be released. Possibly the page is already clean. We always
+ * have buffer heads in this call.
+ *
+ * Returns 0 if the page is ok to release, 1 otherwise.
+ *
+ * Possible scenarios are:
+ *
+ * 1. We are being called to release a page which has been written
+ *    to via regular I/O. buffer heads will be dirty and possibly
+ *    delalloc. If no delalloc buffer heads in this case then we
+ *    can just return zero.
+ *
+ * 2. We are called to release a page which has been written via
+ *    mmap, all we need to do is ensure there is no delalloc
+ *    state in the buffer heads, if not we can let the caller
+ *    free them and we should come back later via writepage.
+ */
+STATIC int
+linvfs_release_page(
+	struct page		*page,
+	int			gfp_mask)
+{
+	struct inode		*inode = page->mapping->host;
+	int			dirty, delalloc, unmapped, unwritten;
+	struct writeback_control wbc = {
+		.sync_mode = WB_SYNC_ALL,
+		.nr_to_write = 1,
+	};
+
+	xfs_page_trace(XFS_RELEASEPAGE_ENTER, inode, page, gfp_mask);
+
+	xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
+	if (!delalloc && !unwritten)
+		goto free_buffers;
+
+	if (!(gfp_mask & __GFP_FS))
+		return 0;
+
+	/* If we are already inside a transaction or the thread cannot
+	 * do I/O, we cannot release this page.
+	 */
+	if (PFLAGS_TEST_FSTRANS())
+		return 0;
+
+	/*
+	 * Convert delalloc space to real space, do not flush the
+	 * data out to disk, that will be done by the caller.
+	 * Never need to allocate space here - we will always
+	 * come back to writepage in that case.
+	 */
+	dirty = xfs_page_state_convert(inode, page, &wbc, 0, 0);
+	if (dirty == 0 && !unwritten)
+		goto free_buffers;
+	return 0;
+
+free_buffers:
+	return try_to_free_buffers(page);
+}
+
+STATIC int
+linvfs_prepare_write(
+	struct file		*file,
+	struct page		*page,
+	unsigned int		from,
+	unsigned int		to)
+{
+	if (file && (file->f_flags & O_SYNC)) {
+		return block_prepare_write(page, from, to,
+						linvfs_get_block_sync);
+	} else {
+		return block_prepare_write(page, from, to,
+						linvfs_get_block);
+	}
+}
+
+struct address_space_operations linvfs_aops = {
+	.readpage		= linvfs_readpage,
+	.readpages		= linvfs_readpages,
+	.writepage		= linvfs_writepage,
+	.sync_page		= block_sync_page,
+	.releasepage		= linvfs_release_page,
+	.prepare_write		= linvfs_prepare_write,
+	.commit_write		= generic_commit_write,
+	.bmap			= linvfs_bmap,
+	.direct_IO		= linvfs_direct_IO,
+};
diff -Nru a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_buf.c	Tue Jun 15 22:20:36 2004
@@ -0,0 +1,1812 @@
+/*
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+/*
+ *	The xfs_buf.c code provides an abstract buffer cache model on top
+ *	of the Linux page cache.  Cached metadata blocks for a file system
+ *	are hashed to the inode for the block device.  xfs_buf.c assembles
+ *	buffers (xfs_buf_t) on demand to aggregate such cached pages for I/O.
+ *
+ *      Written by Steve Lord, Jim Mostek, Russell Cattelan
+ *		    and Rajagopal Ananthanarayanan ("ananth") at SGI.
+ *
+ */
+
+#include <linux/stddef.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/pagemap.h>
+#include <linux/init.h>
+#include <linux/vmalloc.h>
+#include <linux/bio.h>
+#include <linux/sysctl.h>
+#include <linux/proc_fs.h>
+#include <linux/workqueue.h>
+#include <linux/suspend.h>
+#include <linux/percpu.h>
+
+#include "xfs_linux.h"
+
+#ifndef GFP_READAHEAD
+#define GFP_READAHEAD	(__GFP_NOWARN|__GFP_NORETRY)
+#endif
+
+/*
+ * File wide globals
+ */
+
+STATIC kmem_cache_t *pagebuf_cache;
+STATIC void pagebuf_daemon_wakeup(void);
+STATIC void pagebuf_delwri_queue(xfs_buf_t *, int);
+STATIC struct workqueue_struct *pagebuf_logio_workqueue;
+STATIC struct workqueue_struct *pagebuf_dataio_workqueue;
+
+/*
+ * Pagebuf debugging
+ */
+
+#ifdef PAGEBUF_TRACE
+void
+pagebuf_trace(
+	xfs_buf_t	*pb,
+	char		*id,
+	void		*data,
+	void		*ra)
+{
+	ktrace_enter(pagebuf_trace_buf,
+		pb, id,
+		(void *)(unsigned long)pb->pb_flags,
+		(void *)(unsigned long)pb->pb_hold.counter,
+		(void *)(unsigned long)pb->pb_sema.count.counter,
+		(void *)current,
+		data, ra,
+		(void *)(unsigned long)((pb->pb_file_offset>>32) & 0xffffffff),
+		(void *)(unsigned long)(pb->pb_file_offset & 0xffffffff),
+		(void *)(unsigned long)pb->pb_buffer_length,
+		NULL, NULL, NULL, NULL, NULL);
+}
+ktrace_t *pagebuf_trace_buf;
+#define PAGEBUF_TRACE_SIZE	4096
+#define PB_TRACE(pb, id, data)	\
+	pagebuf_trace(pb, id, (void *)data, (void *)__builtin_return_address(0))
+#else
+#define PB_TRACE(pb, id, data)	do { } while (0)
+#endif
+
+#ifdef PAGEBUF_LOCK_TRACKING
+# define PB_SET_OWNER(pb)	((pb)->pb_last_holder = current->pid)
+# define PB_CLEAR_OWNER(pb)	((pb)->pb_last_holder = -1)
+# define PB_GET_OWNER(pb)	((pb)->pb_last_holder)
+#else
+# define PB_SET_OWNER(pb)	do { } while (0)
+# define PB_CLEAR_OWNER(pb)	do { } while (0)
+# define PB_GET_OWNER(pb)	do { } while (0)
+#endif
+
+/*
+ * Pagebuf allocation / freeing.
+ */
+
+#define pb_to_gfp(flags) \
+	(((flags) & PBF_READ_AHEAD) ? GFP_READAHEAD : \
+	 ((flags) & PBF_DONT_BLOCK) ? GFP_NOFS : GFP_KERNEL)
+
+#define pb_to_km(flags) \
+	 (((flags) & PBF_DONT_BLOCK) ? KM_NOFS : KM_SLEEP)
+
+
+#define pagebuf_allocate(flags) \
+	kmem_zone_alloc(pagebuf_cache, pb_to_km(flags))
+#define pagebuf_deallocate(pb) \
+	kmem_zone_free(pagebuf_cache, (pb));
+
+/*
+ * Pagebuf hashing
+ */
+
+#define NBITS	8
+#define NHASH	(1<<NBITS)
+
+typedef struct {
+	struct list_head	pb_hash;
+	spinlock_t		pb_hash_lock;
+} pb_hash_t;
+
+STATIC pb_hash_t	pbhash[NHASH];
+#define pb_hash(pb)	&pbhash[pb->pb_hash_index]
+
+STATIC int
+_bhash(
+	struct block_device *bdev,
+	loff_t		base)
+{
+	int		bit, hval;
+
+	base >>= 9;
+	base ^= (unsigned long)bdev / L1_CACHE_BYTES;
+	for (bit = hval = 0; base && bit < sizeof(base) * 8; bit += NBITS) {
+		hval ^= (int)base & (NHASH-1);
+		base >>= NBITS;
+	}
+	return hval;
+}
+
+/*
+ * Mapping of multi-page buffers into contiguous virtual space
+ */
+
+typedef struct a_list {
+	void		*vm_addr;
+	struct a_list	*next;
+} a_list_t;
+
+STATIC a_list_t		*as_free_head;
+STATIC int		as_list_len;
+STATIC spinlock_t	as_lock = SPIN_LOCK_UNLOCKED;
+
+/*
+ * Try to batch vunmaps because they are costly.
+ */
+STATIC void
+free_address(
+	void		*addr)
+{
+	a_list_t	*aentry;
+
+	aentry = kmalloc(sizeof(a_list_t), GFP_ATOMIC);
+	if (aentry) {
+		spin_lock(&as_lock);
+		aentry->next = as_free_head;
+		aentry->vm_addr = addr;
+		as_free_head = aentry;
+		as_list_len++;
+		spin_unlock(&as_lock);
+	} else {
+		vunmap(addr);
+	}
+}
+
+STATIC void
+purge_addresses(void)
+{
+	a_list_t	*aentry, *old;
+
+	if (as_free_head == NULL)
+		return;
+
+	spin_lock(&as_lock);
+	aentry = as_free_head;
+	as_free_head = NULL;
+	as_list_len = 0;
+	spin_unlock(&as_lock);
+
+	while ((old = aentry) != NULL) {
+		vunmap(aentry->vm_addr);
+		aentry = aentry->next;
+		kfree(old);
+	}
+}
+
+/*
+ *	Internal pagebuf object manipulation
+ */
+
+STATIC void
+_pagebuf_initialize(
+	xfs_buf_t		*pb,
+	xfs_buftarg_t		*target,
+	loff_t			range_base,
+	size_t			range_length,
+	page_buf_flags_t	flags)
+{
+	/*
+	 * We don't want certain flags to appear in pb->pb_flags.
+	 */
+	flags &= ~(PBF_LOCK|PBF_MAPPED|PBF_DONT_BLOCK|PBF_READ_AHEAD);
+
+	memset(pb, 0, sizeof(xfs_buf_t));
+	atomic_set(&pb->pb_hold, 1);
+	init_MUTEX_LOCKED(&pb->pb_iodonesema);
+	INIT_LIST_HEAD(&pb->pb_list);
+	INIT_LIST_HEAD(&pb->pb_hash_list);
+	init_MUTEX_LOCKED(&pb->pb_sema); /* held, no waiters */
+	PB_SET_OWNER(pb);
+	pb->pb_target = target;
+	pb->pb_file_offset = range_base;
+	/*
+	 * Set buffer_length and count_desired to the same value initially.
+	 * I/O routines should use count_desired, which will be the same in
+	 * most cases but may be reset (e.g. XFS recovery).
+	 */
+	pb->pb_buffer_length = pb->pb_count_desired = range_length;
+	pb->pb_flags = flags | PBF_NONE;
+	pb->pb_bn = XFS_BUF_DADDR_NULL;
+	atomic_set(&pb->pb_pin_count, 0);
+	init_waitqueue_head(&pb->pb_waiters);
+
+	XFS_STATS_INC(pb_create);
+	PB_TRACE(pb, "initialize", target);
+}
+
+/*
+ * Allocate a page array capable of holding a specified number
+ * of pages, and point the page buf at it.
+ */
+STATIC int
+_pagebuf_get_pages(
+	xfs_buf_t		*pb,
+	int			page_count,
+	page_buf_flags_t	flags)
+{
+	/* Make sure that we have a page list */
+	if (pb->pb_pages == NULL) {
+		pb->pb_offset = page_buf_poff(pb->pb_file_offset);
+		pb->pb_page_count = page_count;
+		if (page_count <= PB_PAGES) {
+			pb->pb_pages = pb->pb_page_array;
+		} else {
+			pb->pb_pages = kmem_alloc(sizeof(struct page *) *
+					page_count, pb_to_km(flags));
+			if (pb->pb_pages == NULL)
+				return -ENOMEM;
+		}
+		memset(pb->pb_pages, 0, sizeof(struct page *) * page_count);
+	}
+	return 0;
+}
+
+/*
+ *	Frees pb_pages if it was malloced.
+ */
+STATIC void
+_pagebuf_free_pages(
+	xfs_buf_t	*bp)
+{
+	if (bp->pb_pages != bp->pb_page_array) {
+		kmem_free(bp->pb_pages,
+			  bp->pb_page_count * sizeof(struct page *));
+	}
+}
+
+/*
+ *	Releases the specified buffer.
+ *
+ * 	The modification state of any associated pages is left unchanged.
+ * 	The buffer most not be on any hash - use pagebuf_rele instead for
+ * 	hashed and refcounted buffers
+ */
+void
+pagebuf_free(
+	xfs_buf_t		*bp)
+{
+	PB_TRACE(bp, "free", 0);
+
+	ASSERT(list_empty(&bp->pb_hash_list));
+
+	if (bp->pb_flags & _PBF_PAGE_CACHE) {
+		uint		i;
+
+		if ((bp->pb_flags & PBF_MAPPED) && (bp->pb_page_count > 1))
+			free_address(bp->pb_addr - bp->pb_offset);
+
+		for (i = 0; i < bp->pb_page_count; i++)
+			page_cache_release(bp->pb_pages[i]);
+		_pagebuf_free_pages(bp);
+	} else if (bp->pb_flags & _PBF_KMEM_ALLOC) {
+		 /*
+		  * XXX(hch): bp->pb_count_desired might be incorrect (see
+		  * pagebuf_associate_memory for details), but fortunately
+		  * the Linux version of kmem_free ignores the len argument..
+		  */
+		kmem_free(bp->pb_addr, bp->pb_count_desired);
+		_pagebuf_free_pages(bp);
+	}
+
+	pagebuf_deallocate(bp);
+}
+
+/*
+ *	Finds all pages for buffer in question and builds it's page list.
+ */
+STATIC int
+_pagebuf_lookup_pages(
+	xfs_buf_t		*bp,
+	uint			flags)
+{
+	struct address_space	*mapping = bp->pb_target->pbr_mapping;
+	unsigned int		sectorshift = bp->pb_target->pbr_sshift;
+	size_t			blocksize = bp->pb_target->pbr_bsize;
+	size_t			size = bp->pb_count_desired;
+	size_t			nbytes, offset;
+	int			gfp_mask = pb_to_gfp(flags);
+	unsigned short		page_count, i;
+	pgoff_t			first;
+	loff_t			end;
+	int			error;
+
+	end = bp->pb_file_offset + bp->pb_buffer_length;
+	page_count = page_buf_btoc(end) - page_buf_btoct(bp->pb_file_offset);
+
+	error = _pagebuf_get_pages(bp, page_count, flags);
+	if (unlikely(error))
+		return error;
+	bp->pb_flags |= _PBF_PAGE_CACHE;
+
+	offset = bp->pb_offset;
+	first = bp->pb_file_offset >> PAGE_CACHE_SHIFT;
+
+	for (i = 0; i < bp->pb_page_count; i++) {
+		struct page	*page;
+		uint		retries = 0;
+
+	      retry:
+		page = find_or_create_page(mapping, first + i, gfp_mask);
+		if (unlikely(page == NULL)) {
+			if (flags & PBF_READ_AHEAD) {
+				bp->pb_page_count = i;
+				for (i = 0; i < bp->pb_page_count; i++)
+					unlock_page(bp->pb_pages[i]);
+				return -ENOMEM;
+			}
+
+			/*
+			 * This could deadlock.
+			 *
+			 * But until all the XFS lowlevel code is revamped to
+			 * handle buffer allocation failures we can't do much.
+			 */
+			if (!(++retries % 100)) {
+				printk(KERN_ERR "possibly deadlocking in %s\n",
+						__FUNCTION__);
+			}
+
+			XFS_STATS_INC(pb_page_retries);
+			pagebuf_daemon_wakeup();
+			set_current_state(TASK_UNINTERRUPTIBLE);
+			schedule_timeout(10);
+			goto retry;
+		}
+
+		XFS_STATS_INC(pb_page_found);
+
+		nbytes = min_t(size_t, size, PAGE_CACHE_SIZE - offset);
+		size -= nbytes;
+
+		if (!PageUptodate(page)) {
+			page_count--;
+			if (blocksize == PAGE_CACHE_SIZE) {
+				if (flags & PBF_READ)
+					bp->pb_locked = 1;
+			} else if (!PagePrivate(page)) {
+				unsigned long	j, range;
+
+				/*
+				 * In this case page->private holds a bitmap
+				 * of uptodate sectors within the page
+				 */
+				ASSERT(blocksize < PAGE_CACHE_SIZE);
+				range = (offset + nbytes) >> sectorshift;
+				for (j = offset >> sectorshift; j < range; j++)
+					if (!test_bit(j, &page->private))
+						break;
+				if (j == range)
+					page_count++;
+			}
+		}
+
+		bp->pb_pages[i] = page;
+		offset = 0;
+	}
+
+	if (!bp->pb_locked) {
+		for (i = 0; i < bp->pb_page_count; i++)
+			unlock_page(bp->pb_pages[i]);
+	}
+
+	if (page_count) {
+		/* if we have any uptodate pages, mark that in the buffer */
+		bp->pb_flags &= ~PBF_NONE;
+
+		/* if some pages aren't uptodate, mark that in the buffer */
+		if (page_count != bp->pb_page_count)
+			bp->pb_flags |= PBF_PARTIAL;
+	}
+
+	PB_TRACE(bp, "lookup_pages", (long)page_count);
+	return error;
+}
+
+/*
+ *	Map buffer into kernel address-space if nessecary.
+ */
+STATIC int
+_pagebuf_map_pages(
+	xfs_buf_t		*bp,
+	uint			flags)
+{
+	/* A single page buffer is always mappable */
+	if (bp->pb_page_count == 1) {
+		bp->pb_addr = page_address(bp->pb_pages[0]) + bp->pb_offset;
+		bp->pb_flags |= PBF_MAPPED;
+	} else if (flags & PBF_MAPPED) {
+		if (as_list_len > 64)
+			purge_addresses();
+		bp->pb_addr = vmap(bp->pb_pages, bp->pb_page_count,
+				VM_MAP, PAGE_KERNEL);
+		if (unlikely(bp->pb_addr == NULL))
+			return -ENOMEM;
+		bp->pb_addr += bp->pb_offset;
+		bp->pb_flags |= PBF_MAPPED;
+	}
+
+	return 0;
+}
+
+/*
+ *	Finding and Reading Buffers
+ */
+
+/*
+ *	_pagebuf_find
+ *
+ *	Looks up, and creates if absent, a lockable buffer for
+ *	a given range of an inode.  The buffer is returned
+ *	locked.	 If other overlapping buffers exist, they are
+ *	released before the new buffer is created and locked,
+ *	which may imply that this call will block until those buffers
+ *	are unlocked.  No I/O is implied by this call.
+ */
+STATIC xfs_buf_t *
+_pagebuf_find(				/* find buffer for block	*/
+	xfs_buftarg_t		*target,/* target for block		*/
+	loff_t			ioff,	/* starting offset of range	*/
+	size_t			isize,	/* length of range		*/
+	page_buf_flags_t	flags,	/* PBF_TRYLOCK			*/
+	xfs_buf_t		*new_pb)/* newly allocated buffer	*/
+{
+	loff_t			range_base;
+	size_t			range_length;
+	int			hval;
+	pb_hash_t		*h;
+	xfs_buf_t		*pb, *n;
+	int			not_locked;
+
+	range_base = (ioff << BBSHIFT);
+	range_length = (isize << BBSHIFT);
+
+	/* Ensure we never do IOs smaller than the sector size */
+	BUG_ON(range_length < (1 << target->pbr_sshift));
+
+	/* Ensure we never do IOs that are not sector aligned */
+	BUG_ON(range_base & (loff_t)target->pbr_smask);
+
+	hval = _bhash(target->pbr_bdev, range_base);
+	h = &pbhash[hval];
+
+	spin_lock(&h->pb_hash_lock);
+	list_for_each_entry_safe(pb, n, &h->pb_hash, pb_hash_list) {
+		if (pb->pb_target == target &&
+		    pb->pb_file_offset == range_base &&
+		    pb->pb_buffer_length == range_length) {
+			/* If we look at something bring it to the
+			 * front of the list for next time
+			 */
+			atomic_inc(&pb->pb_hold);
+			list_move(&pb->pb_hash_list, &h->pb_hash);
+			goto found;
+		}
+	}
+
+	/* No match found */
+	if (new_pb) {
+		_pagebuf_initialize(new_pb, target, range_base,
+				range_length, flags);
+		new_pb->pb_hash_index = hval;
+		list_add(&new_pb->pb_hash_list, &h->pb_hash);
+	} else {
+		XFS_STATS_INC(pb_miss_locked);
+	}
+
+	spin_unlock(&h->pb_hash_lock);
+	return (new_pb);
+
+found:
+	spin_unlock(&h->pb_hash_lock);
+
+	/* Attempt to get the semaphore without sleeping,
+	 * if this does not work then we need to drop the
+	 * spinlock and do a hard attempt on the semaphore.
+	 */
+	not_locked = down_trylock(&pb->pb_sema);
+	if (not_locked) {
+		if (!(flags & PBF_TRYLOCK)) {
+			/* wait for buffer ownership */
+			PB_TRACE(pb, "get_lock", 0);
+			pagebuf_lock(pb);
+			XFS_STATS_INC(pb_get_locked_waited);
+		} else {
+			/* We asked for a trylock and failed, no need
+			 * to look at file offset and length here, we
+			 * know that this pagebuf at least overlaps our
+			 * pagebuf and is locked, therefore our buffer
+			 * either does not exist, or is this buffer
+			 */
+
+			pagebuf_rele(pb);
+			XFS_STATS_INC(pb_busy_locked);
+			return (NULL);
+		}
+	} else {
+		/* trylock worked */
+		PB_SET_OWNER(pb);
+	}
+
+	if (pb->pb_flags & PBF_STALE)
+		pb->pb_flags &= PBF_MAPPED;
+	PB_TRACE(pb, "got_lock", 0);
+	XFS_STATS_INC(pb_get_locked);
+	return (pb);
+}
+
+
+/*
+ *	pagebuf_find
+ *
+ *	pagebuf_find returns a buffer matching the specified range of
+ *	data for the specified target, if any of the relevant blocks
+ *	are in memory.  The buffer may have unallocated holes, if
+ *	some, but not all, of the blocks are in memory.  Even where
+ *	pages are present in the buffer, not all of every page may be
+ *	valid.
+ */
+xfs_buf_t *
+pagebuf_find(				/* find buffer for block	*/
+					/* if the block is in memory	*/
+	xfs_buftarg_t		*target,/* target for block		*/
+	loff_t			ioff,	/* starting offset of range	*/
+	size_t			isize,	/* length of range		*/
+	page_buf_flags_t	flags)	/* PBF_TRYLOCK			*/
+{
+	return _pagebuf_find(target, ioff, isize, flags, NULL);
+}
+
+/*
+ *	pagebuf_get
+ *
+ *	pagebuf_get assembles a buffer covering the specified range.
+ *	Some or all of the blocks in the range may be valid.  Storage
+ *	in memory for all portions of the buffer will be allocated,
+ *	although backing storage may not be.  If PBF_READ is set in
+ *	flags, pagebuf_iostart is called also.
+ */
+xfs_buf_t *
+pagebuf_get(				/* allocate a buffer		*/
+	xfs_buftarg_t		*target,/* target for buffer		*/
+	loff_t			ioff,	/* starting offset of range	*/
+	size_t			isize,	/* length of range		*/
+	page_buf_flags_t	flags)	/* PBF_TRYLOCK			*/
+{
+	xfs_buf_t		*pb, *new_pb;
+	int			error = 0, i;
+
+	new_pb = pagebuf_allocate(flags);
+	if (unlikely(!new_pb))
+		return NULL;
+
+	pb = _pagebuf_find(target, ioff, isize, flags, new_pb);
+	if (pb == new_pb) {
+		error = _pagebuf_lookup_pages(pb, flags);
+		if (unlikely(error)) {
+			printk(KERN_WARNING
+			       "pagebuf_get: failed to lookup pages\n");
+			goto no_buffer;
+		}
+	} else {
+		pagebuf_deallocate(new_pb);
+		if (unlikely(pb == NULL))
+			return NULL;
+	}
+
+	for (i = 0; i < pb->pb_page_count; i++)
+		mark_page_accessed(pb->pb_pages[i]);
+
+	if (!(pb->pb_flags & PBF_MAPPED)) {
+		error = _pagebuf_map_pages(pb, flags);
+		if (unlikely(error)) {
+			printk(KERN_WARNING
+			       "pagebuf_get: failed to map pages\n");
+			goto no_buffer;
+		}
+	}
+
+	XFS_STATS_INC(pb_get);
+
+	/*
+	 * Always fill in the block number now, the mapped cases can do
+	 * their own overlay of this later.
+	 */
+	pb->pb_bn = ioff;
+	pb->pb_count_desired = pb->pb_buffer_length;
+
+	if (flags & PBF_READ) {
+		if (PBF_NOT_DONE(pb)) {
+			PB_TRACE(pb, "get_read", (unsigned long)flags);
+			XFS_STATS_INC(pb_get_read);
+			pagebuf_iostart(pb, flags);
+		} else if (flags & PBF_ASYNC) {
+			PB_TRACE(pb, "get_read_async", (unsigned long)flags);
+			/*
+			 * Read ahead call which is already satisfied,
+			 * drop the buffer
+			 */
+			goto no_buffer;
+		} else {
+			PB_TRACE(pb, "get_read_done", (unsigned long)flags);
+			/* We do not want read in the flags */
+			pb->pb_flags &= ~PBF_READ;
+		}
+	} else {
+		PB_TRACE(pb, "get_write", (unsigned long)flags);
+	}
+
+	return pb;
+
+no_buffer:
+	if (flags & (PBF_LOCK | PBF_TRYLOCK))
+		pagebuf_unlock(pb);
+	pagebuf_rele(pb);
+	return NULL;
+}
+
+/*
+ * Create a skeletal pagebuf (no pages associated with it).
+ */
+xfs_buf_t *
+pagebuf_lookup(
+	xfs_buftarg_t		*target,
+	loff_t			ioff,
+	size_t			isize,
+	page_buf_flags_t	flags)
+{
+	xfs_buf_t		*pb;
+
+	pb = pagebuf_allocate(flags);
+	if (pb) {
+		_pagebuf_initialize(pb, target, ioff, isize, flags);
+	}
+	return pb;
+}
+
+/*
+ * If we are not low on memory then do the readahead in a deadlock
+ * safe manner.
+ */
+void
+pagebuf_readahead(
+	xfs_buftarg_t		*target,
+	loff_t			ioff,
+	size_t			isize,
+	page_buf_flags_t	flags)
+{
+	struct backing_dev_info *bdi;
+
+	bdi = target->pbr_mapping->backing_dev_info;
+	if (bdi_read_congested(bdi))
+		return;
+	if (bdi_write_congested(bdi))
+		return;
+
+	flags |= (PBF_TRYLOCK|PBF_READ|PBF_ASYNC|PBF_READ_AHEAD);
+	pagebuf_get(target, ioff, isize, flags);
+}
+
+xfs_buf_t *
+pagebuf_get_empty(
+	size_t			len,
+	xfs_buftarg_t		*target)
+{
+	xfs_buf_t		*pb;
+
+	pb = pagebuf_allocate(0);
+	if (pb)
+		_pagebuf_initialize(pb, target, 0, len, 0);
+	return pb;
+}
+
+static inline struct page *
+mem_to_page(
+	void			*addr)
+{
+	if (((unsigned long)addr < VMALLOC_START) ||
+	    ((unsigned long)addr >= VMALLOC_END)) {
+		return virt_to_page(addr);
+	} else {
+		return vmalloc_to_page(addr);
+	}
+}
+
+int
+pagebuf_associate_memory(
+	xfs_buf_t		*pb,
+	void			*mem,
+	size_t			len)
+{
+	int			rval;
+	int			i = 0;
+	size_t			ptr;
+	size_t			end, end_cur;
+	off_t			offset;
+	int			page_count;
+
+	page_count = PAGE_CACHE_ALIGN(len) >> PAGE_CACHE_SHIFT;
+	offset = (off_t) mem - ((off_t)mem & PAGE_CACHE_MASK);
+	if (offset && (len > PAGE_CACHE_SIZE))
+		page_count++;
+
+	/* Free any previous set of page pointers */
+	if (pb->pb_pages)
+		_pagebuf_free_pages(pb);
+
+	pb->pb_pages = NULL;
+	pb->pb_addr = mem;
+
+	rval = _pagebuf_get_pages(pb, page_count, 0);
+	if (rval)
+		return rval;
+
+	pb->pb_offset = offset;
+	ptr = (size_t) mem & PAGE_CACHE_MASK;
+	end = PAGE_CACHE_ALIGN((size_t) mem + len);
+	end_cur = end;
+	/* set up first page */
+	pb->pb_pages[0] = mem_to_page(mem);
+
+	ptr += PAGE_CACHE_SIZE;
+	pb->pb_page_count = ++i;
+	while (ptr < end) {
+		pb->pb_pages[i] = mem_to_page((void *)ptr);
+		pb->pb_page_count = ++i;
+		ptr += PAGE_CACHE_SIZE;
+	}
+	pb->pb_locked = 0;
+
+	pb->pb_count_desired = pb->pb_buffer_length = len;
+	pb->pb_flags |= PBF_MAPPED;
+
+	return 0;
+}
+
+xfs_buf_t *
+pagebuf_get_no_daddr(
+	size_t			len,
+	xfs_buftarg_t		*target)
+{
+	size_t			malloc_len = len;
+	xfs_buf_t		*bp;
+	void			*data;
+	int			error;
+
+	bp = pagebuf_allocate(0);
+	if (unlikely(bp == NULL))
+		goto fail;
+	_pagebuf_initialize(bp, target, 0, len, PBF_FORCEIO);
+
+ try_again:
+	data = kmem_alloc(malloc_len, KM_SLEEP | KM_MAYFAIL);
+	if (unlikely(data == NULL))
+		goto fail_free_buf;
+
+	/* check whether alignment matches.. */
+	if ((__psunsigned_t)data !=
+	    ((__psunsigned_t)data & ~target->pbr_smask)) {
+		/* .. else double the size and try again */
+		kmem_free(data, malloc_len);
+		malloc_len <<= 1;
+		goto try_again;
+	}
+
+	error = pagebuf_associate_memory(bp, data, len);
+	if (error)
+		goto fail_free_mem;
+	bp->pb_flags |= _PBF_KMEM_ALLOC;
+
+	pagebuf_unlock(bp);
+
+	PB_TRACE(bp, "no_daddr", data);
+	return bp;
+ fail_free_mem:
+	kmem_free(data, malloc_len);
+ fail_free_buf:
+	pagebuf_free(bp);
+ fail:
+	return NULL;
+}
+
+/*
+ *	pagebuf_hold
+ *
+ *	Increment reference count on buffer, to hold the buffer concurrently
+ *	with another thread which may release (free) the buffer asynchronously.
+ *
+ *	Must hold the buffer already to call this function.
+ */
+void
+pagebuf_hold(
+	xfs_buf_t		*pb)
+{
+	atomic_inc(&pb->pb_hold);
+	PB_TRACE(pb, "hold", 0);
+}
+
+/*
+ *	pagebuf_rele
+ *
+ *	pagebuf_rele releases a hold on the specified buffer.  If the
+ *	the hold count is 1, pagebuf_rele calls pagebuf_free.
+ */
+void
+pagebuf_rele(
+	xfs_buf_t		*pb)
+{
+	pb_hash_t		*hash = pb_hash(pb);
+
+	PB_TRACE(pb, "rele", pb->pb_relse);
+
+	if (atomic_dec_and_lock(&pb->pb_hold, &hash->pb_hash_lock)) {
+		int		do_free = 1;
+
+		if (pb->pb_relse) {
+			atomic_inc(&pb->pb_hold);
+			spin_unlock(&hash->pb_hash_lock);
+			(*(pb->pb_relse)) (pb);
+			spin_lock(&hash->pb_hash_lock);
+			do_free = 0;
+		}
+
+		if (pb->pb_flags & PBF_DELWRI) {
+			pb->pb_flags |= PBF_ASYNC;
+			atomic_inc(&pb->pb_hold);
+			pagebuf_delwri_queue(pb, 0);
+			do_free = 0;
+		} else if (pb->pb_flags & PBF_FS_MANAGED) {
+			do_free = 0;
+		}
+
+		if (do_free) {
+			list_del_init(&pb->pb_hash_list);
+			spin_unlock(&hash->pb_hash_lock);
+			pagebuf_free(pb);
+		} else {
+			spin_unlock(&hash->pb_hash_lock);
+		}
+	}
+}
+
+
+/*
+ *	Mutual exclusion on buffers.  Locking model:
+ *
+ *	Buffers associated with inodes for which buffer locking
+ *	is not enabled are not protected by semaphores, and are
+ *	assumed to be exclusively owned by the caller.  There is a
+ *	spinlock in the buffer, used by the caller when concurrent
+ *	access is possible.
+ */
+
+/*
+ *	pagebuf_cond_lock
+ *
+ *	pagebuf_cond_lock locks a buffer object, if it is not already locked.
+ *	Note that this in no way
+ *	locks the underlying pages, so it is only useful for synchronizing
+ *	concurrent use of page buffer objects, not for synchronizing independent
+ *	access to the underlying pages.
+ */
+int
+pagebuf_cond_lock(			/* lock buffer, if not locked	*/
+					/* returns -EBUSY if locked)	*/
+	xfs_buf_t		*pb)
+{
+	int			locked;
+
+	locked = down_trylock(&pb->pb_sema) == 0;
+	if (locked) {
+		PB_SET_OWNER(pb);
+	}
+	PB_TRACE(pb, "cond_lock", (long)locked);
+	return(locked ? 0 : -EBUSY);
+}
+
+/*
+ *	pagebuf_lock_value
+ *
+ *	Return lock value for a pagebuf
+ */
+int
+pagebuf_lock_value(
+	xfs_buf_t		*pb)
+{
+	return(atomic_read(&pb->pb_sema.count));
+}
+
+/*
+ *	pagebuf_lock
+ *
+ *	pagebuf_lock locks a buffer object.  Note that this in no way
+ *	locks the underlying pages, so it is only useful for synchronizing
+ *	concurrent use of page buffer objects, not for synchronizing independent
+ *	access to the underlying pages.
+ */
+int
+pagebuf_lock(
+	xfs_buf_t		*pb)
+{
+	PB_TRACE(pb, "lock", 0);
+	if (atomic_read(&pb->pb_io_remaining))
+		blk_run_address_space(pb->pb_target->pbr_mapping);
+	down(&pb->pb_sema);
+	PB_SET_OWNER(pb);
+	PB_TRACE(pb, "locked", 0);
+	return 0;
+}
+
+/*
+ *	pagebuf_unlock
+ *
+ *	pagebuf_unlock releases the lock on the buffer object created by
+ *	pagebuf_lock or pagebuf_cond_lock (not any
+ *	pinning of underlying pages created by pagebuf_pin).
+ */
+void
+pagebuf_unlock(				/* unlock buffer		*/
+	xfs_buf_t		*pb)	/* buffer to unlock		*/
+{
+	PB_CLEAR_OWNER(pb);
+	up(&pb->pb_sema);
+	PB_TRACE(pb, "unlock", 0);
+}
+
+
+/*
+ *	Pinning Buffer Storage in Memory
+ */
+
+/*
+ *	pagebuf_pin
+ *
+ *	pagebuf_pin locks all of the memory represented by a buffer in
+ *	memory.  Multiple calls to pagebuf_pin and pagebuf_unpin, for
+ *	the same or different buffers affecting a given page, will
+ *	properly count the number of outstanding "pin" requests.  The
+ *	buffer may be released after the pagebuf_pin and a different
+ *	buffer used when calling pagebuf_unpin, if desired.
+ *	pagebuf_pin should be used by the file system when it wants be
+ *	assured that no attempt will be made to force the affected
+ *	memory to disk.	 It does not assure that a given logical page
+ *	will not be moved to a different physical page.
+ */
+void
+pagebuf_pin(
+	xfs_buf_t		*pb)
+{
+	atomic_inc(&pb->pb_pin_count);
+	PB_TRACE(pb, "pin", (long)pb->pb_pin_count.counter);
+}
+
+/*
+ *	pagebuf_unpin
+ *
+ *	pagebuf_unpin reverses the locking of memory performed by
+ *	pagebuf_pin.  Note that both functions affected the logical
+ *	pages associated with the buffer, not the buffer itself.
+ */
+void
+pagebuf_unpin(
+	xfs_buf_t		*pb)
+{
+	if (atomic_dec_and_test(&pb->pb_pin_count)) {
+		wake_up_all(&pb->pb_waiters);
+	}
+	PB_TRACE(pb, "unpin", (long)pb->pb_pin_count.counter);
+}
+
+int
+pagebuf_ispin(
+	xfs_buf_t		*pb)
+{
+	return atomic_read(&pb->pb_pin_count);
+}
+
+/*
+ *	pagebuf_wait_unpin
+ *
+ *	pagebuf_wait_unpin waits until all of the memory associated
+ *	with the buffer is not longer locked in memory.  It returns
+ *	immediately if none of the affected pages are locked.
+ */
+static inline void
+_pagebuf_wait_unpin(
+	xfs_buf_t		*pb)
+{
+	DECLARE_WAITQUEUE	(wait, current);
+
+	if (atomic_read(&pb->pb_pin_count) == 0)
+		return;
+
+	add_wait_queue(&pb->pb_waiters, &wait);
+	for (;;) {
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		if (atomic_read(&pb->pb_pin_count) == 0)
+			break;
+		if (atomic_read(&pb->pb_io_remaining))
+			blk_run_address_space(pb->pb_target->pbr_mapping);
+		schedule();
+	}
+	remove_wait_queue(&pb->pb_waiters, &wait);
+	set_current_state(TASK_RUNNING);
+}
+
+/*
+ *	Buffer Utility Routines
+ */
+
+/*
+ *	pagebuf_iodone
+ *
+ *	pagebuf_iodone marks a buffer for which I/O is in progress
+ *	done with respect to that I/O.	The pb_iodone routine, if
+ *	present, will be called as a side-effect.
+ */
+void
+pagebuf_iodone_work(
+	void			*v)
+{
+	xfs_buf_t		*bp = (xfs_buf_t *)v;
+
+	if (bp->pb_iodone)
+		(*(bp->pb_iodone))(bp);
+	else if (bp->pb_flags & PBF_ASYNC)
+		xfs_buf_relse(bp);
+}
+
+void
+pagebuf_iodone(
+	xfs_buf_t		*pb,
+	int			dataio,
+	int			schedule)
+{
+	pb->pb_flags &= ~(PBF_READ | PBF_WRITE);
+	if (pb->pb_error == 0) {
+		pb->pb_flags &= ~(PBF_PARTIAL | PBF_NONE);
+	}
+
+	PB_TRACE(pb, "iodone", pb->pb_iodone);
+
+	if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) {
+		if (schedule) {
+			INIT_WORK(&pb->pb_iodone_work, pagebuf_iodone_work, pb);
+			queue_work(dataio ? pagebuf_dataio_workqueue :
+				pagebuf_logio_workqueue, &pb->pb_iodone_work);
+		} else {
+			pagebuf_iodone_work(pb);
+		}
+	} else {
+		up(&pb->pb_iodonesema);
+	}
+}
+
+/*
+ *	pagebuf_ioerror
+ *
+ *	pagebuf_ioerror sets the error code for a buffer.
+ */
+void
+pagebuf_ioerror(			/* mark/clear buffer error flag */
+	xfs_buf_t		*pb,	/* buffer to mark		*/
+	int			error)	/* error to store (0 if none)	*/
+{
+	ASSERT(error >= 0 && error <= 0xffff);
+	pb->pb_error = (unsigned short)error;
+	PB_TRACE(pb, "ioerror", (unsigned long)error);
+}
+
+/*
+ *	pagebuf_iostart
+ *
+ *	pagebuf_iostart initiates I/O on a buffer, based on the flags supplied.
+ *	If necessary, it will arrange for any disk space allocation required,
+ *	and it will break up the request if the block mappings require it.
+ *	The pb_iodone routine in the buffer supplied will only be called
+ *	when all of the subsidiary I/O requests, if any, have been completed.
+ *	pagebuf_iostart calls the pagebuf_ioinitiate routine or
+ *	pagebuf_iorequest, if the former routine is not defined, to start
+ *	the I/O on a given low-level request.
+ */
+int
+pagebuf_iostart(			/* start I/O on a buffer	  */
+	xfs_buf_t		*pb,	/* buffer to start		  */
+	page_buf_flags_t	flags)	/* PBF_LOCK, PBF_ASYNC, PBF_READ, */
+					/* PBF_WRITE, PBF_DELWRI,	  */
+					/* PBF_DONT_BLOCK		  */
+{
+	int			status = 0;
+
+	PB_TRACE(pb, "iostart", (unsigned long)flags);
+
+	if (flags & PBF_DELWRI) {
+		pb->pb_flags &= ~(PBF_READ | PBF_WRITE | PBF_ASYNC);
+		pb->pb_flags |= flags & (PBF_DELWRI | PBF_ASYNC);
+		pagebuf_delwri_queue(pb, 1);
+		return status;
+	}
+
+	pb->pb_flags &= ~(PBF_READ | PBF_WRITE | PBF_ASYNC | PBF_DELWRI | \
+			PBF_READ_AHEAD | _PBF_RUN_QUEUES);
+	pb->pb_flags |= flags & (PBF_READ | PBF_WRITE | PBF_ASYNC | \
+			PBF_READ_AHEAD | _PBF_RUN_QUEUES);
+
+	BUG_ON(pb->pb_bn == XFS_BUF_DADDR_NULL);
+
+	/* For writes allow an alternate strategy routine to precede
+	 * the actual I/O request (which may not be issued at all in
+	 * a shutdown situation, for example).
+	 */
+	status = (flags & PBF_WRITE) ?
+		pagebuf_iostrategy(pb) : pagebuf_iorequest(pb);
+
+	/* Wait for I/O if we are not an async request.
+	 * Note: async I/O request completion will release the buffer,
+	 * and that can already be done by this point.  So using the
+	 * buffer pointer from here on, after async I/O, is invalid.
+	 */
+	if (!status && !(flags & PBF_ASYNC))
+		status = pagebuf_iowait(pb);
+
+	return status;
+}
+
+/*
+ * Helper routine for pagebuf_iorequest
+ */
+
+STATIC __inline__ int
+_pagebuf_iolocked(
+	xfs_buf_t		*pb)
+{
+	ASSERT(pb->pb_flags & (PBF_READ|PBF_WRITE));
+	if (pb->pb_flags & PBF_READ)
+		return pb->pb_locked;
+	return 0;
+}
+
+STATIC __inline__ void
+_pagebuf_iodone(
+	xfs_buf_t		*pb,
+	int			schedule)
+{
+	if (atomic_dec_and_test(&pb->pb_io_remaining) == 1) {
+		pb->pb_locked = 0;
+		pagebuf_iodone(pb, (pb->pb_flags & PBF_FS_DATAIOD), schedule);
+	}
+}
+
+STATIC int
+bio_end_io_pagebuf(
+	struct bio		*bio,
+	unsigned int		bytes_done,
+	int			error)
+{
+	xfs_buf_t		*pb = (xfs_buf_t *)bio->bi_private;
+	unsigned int		i, blocksize = pb->pb_target->pbr_bsize;
+	unsigned int		sectorshift = pb->pb_target->pbr_sshift;
+	struct bio_vec		*bvec = bio->bi_io_vec;
+
+	if (bio->bi_size)
+		return 1;
+
+	if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
+		pb->pb_error = EIO;
+
+	for (i = 0; i < bio->bi_vcnt; i++, bvec++) {
+		struct page	*page = bvec->bv_page;
+
+		if (pb->pb_error) {
+			SetPageError(page);
+		} else if (blocksize == PAGE_CACHE_SIZE) {
+			SetPageUptodate(page);
+		} else if (!PagePrivate(page) &&
+				(pb->pb_flags & _PBF_PAGE_CACHE)) {
+			unsigned long	j, range;
+
+			ASSERT(blocksize < PAGE_CACHE_SIZE);
+			range = (bvec->bv_offset + bvec->bv_len) >> sectorshift;
+			for (j = bvec->bv_offset >> sectorshift; j < range; j++)
+				set_bit(j, &page->private);
+			if (page->private == (unsigned long)(PAGE_CACHE_SIZE-1))
+				SetPageUptodate(page);
+		}
+
+		if (_pagebuf_iolocked(pb)) {
+			unlock_page(page);
+		}
+	}
+
+	_pagebuf_iodone(pb, 1);
+	bio_put(bio);
+	return 0;
+}
+
+void
+_pagebuf_ioapply(
+	xfs_buf_t		*pb)
+{
+	int			i, map_i, total_nr_pages, nr_pages;
+	struct bio		*bio;
+	int			offset = pb->pb_offset;
+	int			size = pb->pb_count_desired;
+	sector_t		sector = pb->pb_bn;
+	unsigned int		blocksize = pb->pb_target->pbr_bsize;
+	int			locking = _pagebuf_iolocked(pb);
+
+	total_nr_pages = pb->pb_page_count;
+	map_i = 0;
+
+	/* Special code path for reading a sub page size pagebuf in --
+	 * we populate up the whole page, and hence the other metadata
+	 * in the same page.  This optimization is only valid when the
+	 * filesystem block size and the page size are equal.
+	 */
+	if ((pb->pb_buffer_length < PAGE_CACHE_SIZE) &&
+	    (pb->pb_flags & PBF_READ) && locking &&
+	    (blocksize == PAGE_CACHE_SIZE)) {
+		bio = bio_alloc(GFP_NOIO, 1);
+
+		bio->bi_bdev = pb->pb_target->pbr_bdev;
+		bio->bi_sector = sector - (offset >> BBSHIFT);
+		bio->bi_end_io = bio_end_io_pagebuf;
+		bio->bi_private = pb;
+
+		bio_add_page(bio, pb->pb_pages[0], PAGE_CACHE_SIZE, 0);
+		size = 0;
+
+		atomic_inc(&pb->pb_io_remaining);
+
+		goto submit_io;
+	}
+
+	/* Lock down the pages which we need to for the request */
+	if (locking && (pb->pb_flags & PBF_WRITE) && (pb->pb_locked == 0)) {
+		for (i = 0; size; i++) {
+			int		nbytes = PAGE_CACHE_SIZE - offset;
+			struct page	*page = pb->pb_pages[i];
+
+			if (nbytes > size)
+				nbytes = size;
+
+			lock_page(page);
+
+			size -= nbytes;
+			offset = 0;
+		}
+		offset = pb->pb_offset;
+		size = pb->pb_count_desired;
+	}
+
+next_chunk:
+	atomic_inc(&pb->pb_io_remaining);
+	nr_pages = BIO_MAX_SECTORS >> (PAGE_SHIFT - BBSHIFT);
+	if (nr_pages > total_nr_pages)
+		nr_pages = total_nr_pages;
+
+	bio = bio_alloc(GFP_NOIO, nr_pages);
+	bio->bi_bdev = pb->pb_target->pbr_bdev;
+	bio->bi_sector = sector;
+	bio->bi_end_io = bio_end_io_pagebuf;
+	bio->bi_private = pb;
+
+	for (; size && nr_pages; nr_pages--, map_i++) {
+		int	nbytes = PAGE_CACHE_SIZE - offset;
+
+		if (nbytes > size)
+			nbytes = size;
+
+		if (bio_add_page(bio, pb->pb_pages[map_i],
+					nbytes, offset) < nbytes)
+			break;
+
+		offset = 0;
+		sector += nbytes >> BBSHIFT;
+		size -= nbytes;
+		total_nr_pages--;
+	}
+
+submit_io:
+	if (likely(bio->bi_size)) {
+		submit_bio((pb->pb_flags & PBF_READ) ? READ : WRITE, bio);
+		if (size)
+			goto next_chunk;
+	} else {
+		bio_put(bio);
+		pagebuf_ioerror(pb, EIO);
+	}
+
+	if (pb->pb_flags & _PBF_RUN_QUEUES) {
+		pb->pb_flags &= ~_PBF_RUN_QUEUES;
+		if (atomic_read(&pb->pb_io_remaining) > 1)
+			blk_run_address_space(pb->pb_target->pbr_mapping);
+	}
+}
+
+/*
+ *	pagebuf_iorequest -- the core I/O request routine.
+ */
+int
+pagebuf_iorequest(			/* start real I/O		*/
+	xfs_buf_t		*pb)	/* buffer to convey to device	*/
+{
+	PB_TRACE(pb, "iorequest", 0);
+
+	if (pb->pb_flags & PBF_DELWRI) {
+		pagebuf_delwri_queue(pb, 1);
+		return 0;
+	}
+
+	if (pb->pb_flags & PBF_WRITE) {
+		_pagebuf_wait_unpin(pb);
+	}
+
+	pagebuf_hold(pb);
+
+	/* Set the count to 1 initially, this will stop an I/O
+	 * completion callout which happens before we have started
+	 * all the I/O from calling pagebuf_iodone too early.
+	 */
+	atomic_set(&pb->pb_io_remaining, 1);
+	_pagebuf_ioapply(pb);
+	_pagebuf_iodone(pb, 0);
+
+	pagebuf_rele(pb);
+	return 0;
+}
+
+/*
+ *	pagebuf_iowait
+ *
+ *	pagebuf_iowait waits for I/O to complete on the buffer supplied.
+ *	It returns immediately if no I/O is pending.  In any case, it returns
+ *	the error code, if any, or 0 if there is no error.
+ */
+int
+pagebuf_iowait(
+	xfs_buf_t		*pb)
+{
+	PB_TRACE(pb, "iowait", 0);
+	if (atomic_read(&pb->pb_io_remaining))
+		blk_run_address_space(pb->pb_target->pbr_mapping);
+	down(&pb->pb_iodonesema);
+	PB_TRACE(pb, "iowaited", (long)pb->pb_error);
+	return pb->pb_error;
+}
+
+caddr_t
+pagebuf_offset(
+	xfs_buf_t		*pb,
+	size_t			offset)
+{
+	struct page		*page;
+
+	offset += pb->pb_offset;
+
+	page = pb->pb_pages[offset >> PAGE_CACHE_SHIFT];
+	return (caddr_t) page_address(page) + (offset & (PAGE_CACHE_SIZE - 1));
+}
+
+/*
+ *	pagebuf_iomove
+ *
+ *	Move data into or out of a buffer.
+ */
+void
+pagebuf_iomove(
+	xfs_buf_t		*pb,	/* buffer to process		*/
+	size_t			boff,	/* starting buffer offset	*/
+	size_t			bsize,	/* length to copy		*/
+	caddr_t			data,	/* data address			*/
+	page_buf_rw_t		mode)	/* read/write flag		*/
+{
+	size_t			bend, cpoff, csize;
+	struct page		*page;
+
+	bend = boff + bsize;
+	while (boff < bend) {
+		page = pb->pb_pages[page_buf_btoct(boff + pb->pb_offset)];
+		cpoff = page_buf_poff(boff + pb->pb_offset);
+		csize = min_t(size_t,
+			      PAGE_CACHE_SIZE-cpoff, pb->pb_count_desired-boff);
+
+		ASSERT(((csize + cpoff) <= PAGE_CACHE_SIZE));
+
+		switch (mode) {
+		case PBRW_ZERO:
+			memset(page_address(page) + cpoff, 0, csize);
+			break;
+		case PBRW_READ:
+			memcpy(data, page_address(page) + cpoff, csize);
+			break;
+		case PBRW_WRITE:
+			memcpy(page_address(page) + cpoff, data, csize);
+		}
+
+		boff += csize;
+		data += csize;
+	}
+}
+
+/*
+ *	Handling of buftargs.
+ */
+
+void
+xfs_free_buftarg(
+	xfs_buftarg_t		*btp,
+	int			external)
+{
+	xfs_flush_buftarg(btp, 1);
+	if (external)
+		xfs_blkdev_put(btp->pbr_bdev);
+	kmem_free(btp, sizeof(*btp));
+}
+
+void
+xfs_incore_relse(
+	xfs_buftarg_t		*btp,
+	int			delwri_only,
+	int			wait)
+{
+	invalidate_bdev(btp->pbr_bdev, 1);
+	truncate_inode_pages(btp->pbr_mapping, 0LL);
+}
+
+void
+xfs_setsize_buftarg(
+	xfs_buftarg_t		*btp,
+	unsigned int		blocksize,
+	unsigned int		sectorsize)
+{
+	btp->pbr_bsize = blocksize;
+	btp->pbr_sshift = ffs(sectorsize) - 1;
+	btp->pbr_smask = sectorsize - 1;
+
+	if (set_blocksize(btp->pbr_bdev, sectorsize)) {
+		printk(KERN_WARNING
+			"XFS: Cannot set_blocksize to %u on device %s\n",
+			sectorsize, XFS_BUFTARG_NAME(btp));
+	}
+}
+
+xfs_buftarg_t *
+xfs_alloc_buftarg(
+	struct block_device	*bdev)
+{
+	xfs_buftarg_t		*btp;
+
+	btp = kmem_zalloc(sizeof(*btp), KM_SLEEP);
+
+	btp->pbr_dev =  bdev->bd_dev;
+	btp->pbr_bdev = bdev;
+	btp->pbr_mapping = bdev->bd_inode->i_mapping;
+	xfs_setsize_buftarg(btp, PAGE_CACHE_SIZE, bdev_hardsect_size(bdev));
+
+	return btp;
+}
+
+
+/*
+ * Pagebuf delayed write buffer handling
+ */
+
+STATIC LIST_HEAD(pbd_delwrite_queue);
+STATIC spinlock_t pbd_delwrite_lock = SPIN_LOCK_UNLOCKED;
+
+STATIC void
+pagebuf_delwri_queue(
+	xfs_buf_t		*pb,
+	int			unlock)
+{
+	PB_TRACE(pb, "delwri_q", (long)unlock);
+	ASSERT(pb->pb_flags & PBF_DELWRI);
+
+	spin_lock(&pbd_delwrite_lock);
+	/* If already in the queue, dequeue and place at tail */
+	if (!list_empty(&pb->pb_list)) {
+		if (unlock) {
+			atomic_dec(&pb->pb_hold);
+		}
+		list_del(&pb->pb_list);
+	}
+
+	list_add_tail(&pb->pb_list, &pbd_delwrite_queue);
+	pb->pb_queuetime = jiffies;
+	spin_unlock(&pbd_delwrite_lock);
+
+	if (unlock)
+		pagebuf_unlock(pb);
+}
+
+void
+pagebuf_delwri_dequeue(
+	xfs_buf_t		*pb)
+{
+	PB_TRACE(pb, "delwri_uq", 0);
+	spin_lock(&pbd_delwrite_lock);
+	list_del_init(&pb->pb_list);
+	pb->pb_flags &= ~PBF_DELWRI;
+	spin_unlock(&pbd_delwrite_lock);
+}
+
+STATIC void
+pagebuf_runall_queues(
+	struct workqueue_struct	*queue)
+{
+	flush_workqueue(queue);
+}
+
+/* Defines for pagebuf daemon */
+STATIC DECLARE_COMPLETION(pagebuf_daemon_done);
+STATIC struct task_struct *pagebuf_daemon_task;
+STATIC int pagebuf_daemon_active;
+STATIC int force_flush;
+
+STATIC void
+pagebuf_daemon_wakeup(void)
+{
+	force_flush = 1;
+	barrier();
+	wake_up_process(pagebuf_daemon_task);
+}
+
+STATIC int
+pagebuf_daemon(
+	void			*data)
+{
+	struct list_head	tmp;
+	unsigned long		age;
+	xfs_buf_t		*pb, *n;
+
+	/*  Set up the thread  */
+	daemonize("xfsbufd");
+	current->flags |= PF_MEMALLOC;
+
+	pagebuf_daemon_task = current;
+	pagebuf_daemon_active = 1;
+	barrier();
+
+	INIT_LIST_HEAD(&tmp);
+	do {
+		/* swsusp */
+		if (current->flags & PF_FREEZE)
+			refrigerator(PF_FREEZE);
+
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule_timeout((xfs_buf_timer_centisecs * HZ) / 100);
+
+		age = (xfs_buf_age_centisecs * HZ) / 100;
+		spin_lock(&pbd_delwrite_lock);
+		list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) {
+			PB_TRACE(pb, "walkq1", (long)pagebuf_ispin(pb));
+			ASSERT(pb->pb_flags & PBF_DELWRI);
+
+			if (!pagebuf_ispin(pb) && !pagebuf_cond_lock(pb)) {
+				if (!force_flush &&
+				    time_before(jiffies,
+						pb->pb_queuetime + age)) {
+					pagebuf_unlock(pb);
+					break;
+				}
+
+				pb->pb_flags &= ~PBF_DELWRI;
+				pb->pb_flags |= PBF_WRITE;
+				list_move(&pb->pb_list, &tmp);
+			}
+		}
+		spin_unlock(&pbd_delwrite_lock);
+
+		while (!list_empty(&tmp)) {
+			pb = list_entry(tmp.next, xfs_buf_t, pb_list);
+			list_del_init(&pb->pb_list);
+			pagebuf_iostrategy(pb);
+			blk_run_address_space(pb->pb_target->pbr_mapping);
+		}
+
+		if (as_list_len > 0)
+			purge_addresses();
+
+		force_flush = 0;
+	} while (pagebuf_daemon_active);
+
+	complete_and_exit(&pagebuf_daemon_done, 0);
+}
+
+/*
+ * Go through all incore buffers, and release buffers if they belong to
+ * the given device. This is used in filesystem error handling to
+ * preserve the consistency of its metadata.
+ */
+int
+xfs_flush_buftarg(
+	xfs_buftarg_t		*target,
+	int			wait)
+{
+	struct list_head	tmp;
+	xfs_buf_t		*pb, *n;
+	int			pincount = 0;
+
+	pagebuf_runall_queues(pagebuf_dataio_workqueue);
+	pagebuf_runall_queues(pagebuf_logio_workqueue);
+
+	INIT_LIST_HEAD(&tmp);
+	spin_lock(&pbd_delwrite_lock);
+	list_for_each_entry_safe(pb, n, &pbd_delwrite_queue, pb_list) {
+
+		if (pb->pb_target != target)
+			continue;
+
+		ASSERT(pb->pb_flags & PBF_DELWRI);
+		PB_TRACE(pb, "walkq2", (long)pagebuf_ispin(pb));
+		if (pagebuf_ispin(pb)) {
+			pincount++;
+			continue;
+		}
+
+		pb->pb_flags &= ~PBF_DELWRI;
+		pb->pb_flags |= PBF_WRITE;
+		list_move(&pb->pb_list, &tmp);
+	}
+	spin_unlock(&pbd_delwrite_lock);
+
+	/*
+	 * Dropped the delayed write list lock, now walk the temporary list
+	 */
+	list_for_each_entry_safe(pb, n, &tmp, pb_list) {
+		if (wait)
+			pb->pb_flags &= ~PBF_ASYNC;
+		else
+			list_del_init(&pb->pb_list);
+
+		pagebuf_lock(pb);
+		pagebuf_iostrategy(pb);
+	}
+
+	/*
+	 * Remaining list items must be flushed before returning
+	 */
+	while (!list_empty(&tmp)) {
+		pb = list_entry(tmp.next, xfs_buf_t, pb_list);
+
+		list_del_init(&pb->pb_list);
+		xfs_iowait(pb);
+		xfs_buf_relse(pb);
+	}
+
+	if (wait)
+		blk_run_address_space(target->pbr_mapping);
+
+	return pincount;
+}
+
+STATIC int
+pagebuf_daemon_start(void)
+{
+	int		rval;
+
+	pagebuf_logio_workqueue = create_workqueue("xfslogd");
+	if (!pagebuf_logio_workqueue)
+		return -ENOMEM;
+
+	pagebuf_dataio_workqueue = create_workqueue("xfsdatad");
+	if (!pagebuf_dataio_workqueue) {
+		destroy_workqueue(pagebuf_logio_workqueue);
+		return -ENOMEM;
+	}
+
+	rval = kernel_thread(pagebuf_daemon, NULL, CLONE_FS|CLONE_FILES);
+	if (rval < 0) {
+		destroy_workqueue(pagebuf_logio_workqueue);
+		destroy_workqueue(pagebuf_dataio_workqueue);
+	}
+
+	return rval;
+}
+
+/*
+ * pagebuf_daemon_stop
+ *
+ * Note: do not mark as __exit, it is called from pagebuf_terminate.
+ */
+STATIC void
+pagebuf_daemon_stop(void)
+{
+	pagebuf_daemon_active = 0;
+	barrier();
+	wait_for_completion(&pagebuf_daemon_done);
+
+	destroy_workqueue(pagebuf_logio_workqueue);
+	destroy_workqueue(pagebuf_dataio_workqueue);
+}
+
+/*
+ *	Initialization and Termination
+ */
+
+int __init
+pagebuf_init(void)
+{
+	int			i;
+
+	pagebuf_cache = kmem_cache_create("xfs_buf_t", sizeof(xfs_buf_t), 0,
+			SLAB_HWCACHE_ALIGN, NULL, NULL);
+	if (pagebuf_cache == NULL) {
+		printk("pagebuf: couldn't init pagebuf cache\n");
+		pagebuf_terminate();
+		return -ENOMEM;
+	}
+
+	for (i = 0; i < NHASH; i++) {
+		spin_lock_init(&pbhash[i].pb_hash_lock);
+		INIT_LIST_HEAD(&pbhash[i].pb_hash);
+	}
+
+#ifdef PAGEBUF_TRACE
+	pagebuf_trace_buf = ktrace_alloc(PAGEBUF_TRACE_SIZE, KM_SLEEP);
+#endif
+
+	pagebuf_daemon_start();
+	return 0;
+}
+
+
+/*
+ *	pagebuf_terminate.
+ *
+ *	Note: do not mark as __exit, this is also called from the __init code.
+ */
+void
+pagebuf_terminate(void)
+{
+	pagebuf_daemon_stop();
+
+#ifdef PAGEBUF_TRACE
+	ktrace_free(pagebuf_trace_buf);
+#endif
+
+	kmem_cache_destroy(pagebuf_cache);
+}
diff -Nru a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_buf.h	Tue Jun 15 22:20:41 2004
@@ -0,0 +1,594 @@
+/*
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+/*
+ * Written by Steve Lord, Jim Mostek, Russell Cattelan at SGI
+ */
+
+#ifndef __XFS_BUF_H__
+#define __XFS_BUF_H__
+
+#include <linux/config.h>
+#include <linux/list.h>
+#include <linux/types.h>
+#include <linux/spinlock.h>
+#include <asm/system.h>
+#include <linux/mm.h>
+#include <linux/fs.h>
+#include <linux/buffer_head.h>
+#include <linux/uio.h>
+
+/*
+ *	Base types
+ */
+
+#define XFS_BUF_DADDR_NULL ((xfs_daddr_t) (-1LL))
+
+#define page_buf_ctob(pp)	((pp) * PAGE_CACHE_SIZE)
+#define page_buf_btoc(dd)	(((dd) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT)
+#define page_buf_btoct(dd)	((dd) >> PAGE_CACHE_SHIFT)
+#define page_buf_poff(aa)	((aa) & ~PAGE_CACHE_MASK)
+
+typedef enum page_buf_rw_e {
+	PBRW_READ = 1,			/* transfer into target memory */
+	PBRW_WRITE = 2,			/* transfer from target memory */
+	PBRW_ZERO = 3			/* Zero target memory */
+} page_buf_rw_t;
+
+
+typedef enum page_buf_flags_e {		/* pb_flags values */
+	PBF_READ = (1 << 0),	/* buffer intended for reading from device */
+	PBF_WRITE = (1 << 1),	/* buffer intended for writing to device   */
+	PBF_MAPPED = (1 << 2),  /* buffer mapped (pb_addr valid)           */
+	PBF_PARTIAL = (1 << 3), /* buffer partially read                   */
+	PBF_ASYNC = (1 << 4),   /* initiator will not wait for completion  */
+	PBF_NONE = (1 << 5),    /* buffer not read at all                  */
+	PBF_DELWRI = (1 << 6),  /* buffer has dirty pages                  */
+	PBF_STALE = (1 << 7),	/* buffer has been staled, do not find it  */
+	PBF_FS_MANAGED = (1 << 8),  /* filesystem controls freeing memory  */
+	PBF_FS_DATAIOD = (1 << 9),  /* schedule IO completion on fs datad  */
+	PBF_FORCEIO = (1 << 10),    /* ignore any cache state		   */
+	PBF_FLUSH = (1 << 11),	    /* flush disk write cache		   */
+	PBF_READ_AHEAD = (1 << 12), /* asynchronous read-ahead		   */
+
+	/* flags used only as arguments to access routines */
+	PBF_LOCK = (1 << 14),       /* lock requested			   */
+	PBF_TRYLOCK = (1 << 15),    /* lock requested, but do not wait	   */
+	PBF_DONT_BLOCK = (1 << 16), /* do not block in current thread	   */
+
+	/* flags used only internally */
+	_PBF_PAGE_CACHE = (1 << 17),/* backed by pagecache		   */
+	_PBF_KMEM_ALLOC = (1 << 18),/* backed by kmem_alloc()		   */
+	_PBF_RUN_QUEUES = (1 << 19),/* run block device task queue	   */
+} page_buf_flags_t;
+
+#define PBF_UPDATE (PBF_READ | PBF_WRITE)
+#define PBF_NOT_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) != 0)
+#define PBF_DONE(pb) (((pb)->pb_flags & (PBF_PARTIAL|PBF_NONE)) == 0)
+
+typedef struct xfs_buftarg {
+	dev_t			pbr_dev;
+	struct block_device	*pbr_bdev;
+	struct address_space	*pbr_mapping;
+	unsigned int		pbr_bsize;
+	unsigned int		pbr_sshift;
+	size_t			pbr_smask;
+} xfs_buftarg_t;
+
+/*
+ *	xfs_buf_t:  Buffer structure for page cache-based buffers
+ *
+ * This buffer structure is used by the page cache buffer management routines
+ * to refer to an assembly of pages forming a logical buffer.  The actual
+ * I/O is performed with buffer_head or bio structures, as required by drivers,
+ * for drivers which do not understand this structure.  The buffer structure is
+ * used on temporary basis only, and discarded when released.
+ *
+ * The real data storage is recorded in the page cache.  Metadata is
+ * hashed to the inode for the block device on which the file system resides.
+ * File data is hashed to the inode for the file.  Pages which are only
+ * partially filled with data have bits set in their block_map entry
+ * to indicate which disk blocks in the page are not valid.
+ */
+
+struct xfs_buf;
+typedef void (*page_buf_iodone_t)(struct xfs_buf *);
+			/* call-back function on I/O completion */
+typedef void (*page_buf_relse_t)(struct xfs_buf *);
+			/* call-back function on I/O completion */
+typedef int (*page_buf_bdstrat_t)(struct xfs_buf *);
+
+#define PB_PAGES	4
+
+typedef struct xfs_buf {
+	struct semaphore	pb_sema;	/* semaphore for lockables  */
+	unsigned long		pb_queuetime;	/* time buffer was queued   */
+	atomic_t		pb_pin_count;	/* pin count		    */
+	wait_queue_head_t	pb_waiters;	/* unpin waiters	    */
+	struct list_head	pb_list;
+	page_buf_flags_t	pb_flags;	/* status flags */
+	struct list_head	pb_hash_list;
+	xfs_buftarg_t		*pb_target;	/* logical object */
+	atomic_t		pb_hold;	/* reference count */
+	xfs_daddr_t		pb_bn;		/* block number for I/O */
+	loff_t			pb_file_offset;	/* offset in file */
+	size_t			pb_buffer_length; /* size of buffer in bytes */
+	size_t			pb_count_desired; /* desired transfer size */
+	void			*pb_addr;	/* virtual address of buffer */
+	struct work_struct	pb_iodone_work;
+	atomic_t		pb_io_remaining;/* #outstanding I/O requests */
+	page_buf_iodone_t	pb_iodone;	/* I/O completion function */
+	page_buf_relse_t	pb_relse;	/* releasing function */
+	page_buf_bdstrat_t	pb_strat;	/* pre-write function */
+	struct semaphore	pb_iodonesema;	/* Semaphore for I/O waiters */
+	void			*pb_fspriv;
+	void			*pb_fspriv2;
+	void			*pb_fspriv3;
+	unsigned short		pb_error;	/* error code on I/O */
+	unsigned short		pb_page_count;	/* size of page array */
+	unsigned short		pb_offset;	/* page offset in first page */
+	unsigned char		pb_locked;	/* page array is locked */
+	unsigned char		pb_hash_index;	/* hash table index	*/
+	struct page		**pb_pages;	/* array of page pointers */
+	struct page		*pb_page_array[PB_PAGES]; /* inline pages */
+#ifdef PAGEBUF_LOCK_TRACKING
+	int			pb_last_holder;
+#endif
+} xfs_buf_t;
+
+
+/* Finding and Reading Buffers */
+
+extern xfs_buf_t *pagebuf_find(	/* find buffer for block if	*/
+					/* the block is in memory	*/
+		xfs_buftarg_t *,	/* inode for block		*/
+		loff_t,			/* starting offset of range	*/
+		size_t,			/* length of range		*/
+		page_buf_flags_t);	/* PBF_LOCK			*/
+
+extern xfs_buf_t *pagebuf_get(		/* allocate a buffer		*/
+		xfs_buftarg_t *,	/* inode for buffer		*/
+		loff_t,			/* starting offset of range     */
+		size_t,			/* length of range              */
+		page_buf_flags_t);	/* PBF_LOCK, PBF_READ,		*/
+					/* PBF_ASYNC			*/
+
+extern xfs_buf_t *pagebuf_lookup(
+		xfs_buftarg_t *,
+		loff_t,			/* starting offset of range	*/
+		size_t,			/* length of range		*/
+		page_buf_flags_t);	/* PBF_READ, PBF_WRITE,		*/
+					/* PBF_FORCEIO, 		*/
+
+extern xfs_buf_t *pagebuf_get_empty(	/* allocate pagebuf struct with	*/
+					/*  no memory or disk address	*/
+		size_t len,
+		xfs_buftarg_t *);	/* mount point "fake" inode	*/
+
+extern xfs_buf_t *pagebuf_get_no_daddr(/* allocate pagebuf struct	*/
+					/* without disk address		*/
+		size_t len,
+		xfs_buftarg_t *);	/* mount point "fake" inode	*/
+
+extern int pagebuf_associate_memory(
+		xfs_buf_t *,
+		void *,
+		size_t);
+
+extern void pagebuf_hold(		/* increment reference count	*/
+		xfs_buf_t *);		/* buffer to hold		*/
+
+extern void pagebuf_readahead(		/* read ahead into cache	*/
+		xfs_buftarg_t  *,	/* target for buffer (or NULL)	*/
+		loff_t,			/* starting offset of range     */
+		size_t,			/* length of range              */
+		page_buf_flags_t);	/* additional read flags	*/
+
+/* Releasing Buffers */
+
+extern void pagebuf_free(		/* deallocate a buffer		*/
+		xfs_buf_t *);		/* buffer to deallocate		*/
+
+extern void pagebuf_rele(		/* release hold on a buffer	*/
+		xfs_buf_t *);		/* buffer to release		*/
+
+/* Locking and Unlocking Buffers */
+
+extern int pagebuf_cond_lock(		/* lock buffer, if not locked	*/
+					/* (returns -EBUSY if locked)	*/
+		xfs_buf_t *);		/* buffer to lock		*/
+
+extern int pagebuf_lock_value(		/* return count on lock		*/
+		xfs_buf_t *);          /* buffer to check              */
+
+extern int pagebuf_lock(		/* lock buffer                  */
+		xfs_buf_t *);          /* buffer to lock               */
+
+extern void pagebuf_unlock(		/* unlock buffer		*/
+		xfs_buf_t *);		/* buffer to unlock		*/
+
+/* Buffer Read and Write Routines */
+
+extern void pagebuf_iodone(		/* mark buffer I/O complete	*/
+		xfs_buf_t *,		/* buffer to mark		*/
+		int,			/* use data/log helper thread.	*/
+		int);			/* run completion locally, or in
+					 * a helper thread.		*/
+
+extern void pagebuf_ioerror(		/* mark buffer in error	(or not) */
+		xfs_buf_t *,		/* buffer to mark		*/
+		int);			/* error to store (0 if none)	*/
+
+extern int pagebuf_iostart(		/* start I/O on a buffer	*/
+		xfs_buf_t *,		/* buffer to start		*/
+		page_buf_flags_t);	/* PBF_LOCK, PBF_ASYNC,		*/
+					/* PBF_READ, PBF_WRITE,		*/
+					/* PBF_DELWRI			*/
+
+extern int pagebuf_iorequest(		/* start real I/O		*/
+		xfs_buf_t *);		/* buffer to convey to device	*/
+
+extern int pagebuf_iowait(		/* wait for buffer I/O done	*/
+		xfs_buf_t *);		/* buffer to wait on		*/
+
+extern void pagebuf_iomove(		/* move data in/out of pagebuf	*/
+		xfs_buf_t *,		/* buffer to manipulate		*/
+		size_t,			/* starting buffer offset	*/
+		size_t,			/* length in buffer		*/
+		caddr_t,		/* data pointer			*/
+		page_buf_rw_t);		/* direction			*/
+
+static inline int pagebuf_iostrategy(xfs_buf_t *pb)
+{
+	return pb->pb_strat ? pb->pb_strat(pb) : pagebuf_iorequest(pb);
+}
+
+static inline int pagebuf_geterror(xfs_buf_t *pb)
+{
+	return pb ? pb->pb_error : ENOMEM;
+}
+
+/* Buffer Utility Routines */
+
+extern caddr_t pagebuf_offset(		/* pointer at offset in buffer	*/
+		xfs_buf_t *,		/* buffer to offset into	*/
+		size_t);		/* offset			*/
+
+/* Pinning Buffer Storage in Memory */
+
+extern void pagebuf_pin(		/* pin buffer in memory		*/
+		xfs_buf_t *);		/* buffer to pin		*/
+
+extern void pagebuf_unpin(		/* unpin buffered data		*/
+		xfs_buf_t *);		/* buffer to unpin		*/
+
+extern int pagebuf_ispin(		/* check if buffer is pinned	*/
+		xfs_buf_t *);		/* buffer to check		*/
+
+/* Delayed Write Buffer Routines */
+
+extern void pagebuf_delwri_dequeue(xfs_buf_t *);
+
+/* Buffer Daemon Setup Routines */
+
+extern int pagebuf_init(void);
+extern void pagebuf_terminate(void);
+
+
+#ifdef PAGEBUF_TRACE
+extern ktrace_t *pagebuf_trace_buf;
+extern void pagebuf_trace(
+		xfs_buf_t *,		/* buffer being traced		*/
+		char *,			/* description of operation	*/
+		void *,			/* arbitrary diagnostic value	*/
+		void *);		/* return address		*/
+#else
+# define pagebuf_trace(pb, id, ptr, ra)	do { } while (0)
+#endif
+
+#define pagebuf_target_name(target)	\
+	({ char __b[BDEVNAME_SIZE]; bdevname((target)->pbr_bdev, __b); __b; })
+
+
+
+
+
+/* These are just for xfs_syncsub... it sets an internal variable
+ * then passes it to VOP_FLUSH_PAGES or adds the flags to a newly gotten buf_t
+ */
+#define XFS_B_ASYNC		PBF_ASYNC
+#define XFS_B_DELWRI		PBF_DELWRI
+#define XFS_B_READ		PBF_READ
+#define XFS_B_WRITE		PBF_WRITE
+#define XFS_B_STALE		PBF_STALE
+
+#define XFS_BUF_TRYLOCK		PBF_TRYLOCK
+#define XFS_INCORE_TRYLOCK	PBF_TRYLOCK
+#define XFS_BUF_LOCK		PBF_LOCK
+#define XFS_BUF_MAPPED		PBF_MAPPED
+
+#define BUF_BUSY		PBF_DONT_BLOCK
+
+#define XFS_BUF_BFLAGS(x)	((x)->pb_flags)
+#define XFS_BUF_ZEROFLAGS(x)	\
+	((x)->pb_flags &= ~(PBF_READ|PBF_WRITE|PBF_ASYNC|PBF_DELWRI))
+
+#define XFS_BUF_STALE(x)	((x)->pb_flags |= XFS_B_STALE)
+#define XFS_BUF_UNSTALE(x)	((x)->pb_flags &= ~XFS_B_STALE)
+#define XFS_BUF_ISSTALE(x)	((x)->pb_flags & XFS_B_STALE)
+#define XFS_BUF_SUPER_STALE(x)	do {				\
+					XFS_BUF_STALE(x);	\
+					xfs_buf_undelay(x);	\
+					XFS_BUF_DONE(x);	\
+				} while (0)
+
+#define XFS_BUF_MANAGE		PBF_FS_MANAGED
+#define XFS_BUF_UNMANAGE(x)	((x)->pb_flags &= ~PBF_FS_MANAGED)
+
+static inline void xfs_buf_undelay(xfs_buf_t *pb)
+{
+	if (pb->pb_flags & PBF_DELWRI) {
+		if (pb->pb_list.next != &pb->pb_list) {
+			pagebuf_delwri_dequeue(pb);
+			pagebuf_rele(pb);
+		} else {
+			pb->pb_flags &= ~PBF_DELWRI;
+		}
+	}
+}
+
+#define XFS_BUF_DELAYWRITE(x)	 ((x)->pb_flags |= PBF_DELWRI)
+#define XFS_BUF_UNDELAYWRITE(x)	 xfs_buf_undelay(x)
+#define XFS_BUF_ISDELAYWRITE(x)	 ((x)->pb_flags & PBF_DELWRI)
+
+#define XFS_BUF_ERROR(x,no)	 pagebuf_ioerror(x,no)
+#define XFS_BUF_GETERROR(x)	 pagebuf_geterror(x)
+#define XFS_BUF_ISERROR(x)	 (pagebuf_geterror(x)?1:0)
+
+#define XFS_BUF_DONE(x)		 ((x)->pb_flags &= ~(PBF_PARTIAL|PBF_NONE))
+#define XFS_BUF_UNDONE(x)	 ((x)->pb_flags |= PBF_PARTIAL|PBF_NONE)
+#define XFS_BUF_ISDONE(x)	 (!(PBF_NOT_DONE(x)))
+
+#define XFS_BUF_BUSY(x)		 ((x)->pb_flags |= PBF_FORCEIO)
+#define XFS_BUF_UNBUSY(x)	 ((x)->pb_flags &= ~PBF_FORCEIO)
+#define XFS_BUF_ISBUSY(x)	 (1)
+
+#define XFS_BUF_ASYNC(x)	 ((x)->pb_flags |= PBF_ASYNC)
+#define XFS_BUF_UNASYNC(x)	 ((x)->pb_flags &= ~PBF_ASYNC)
+#define XFS_BUF_ISASYNC(x)	 ((x)->pb_flags & PBF_ASYNC)
+
+#define XFS_BUF_FLUSH(x)	 ((x)->pb_flags |= PBF_FLUSH)
+#define XFS_BUF_UNFLUSH(x)	 ((x)->pb_flags &= ~PBF_FLUSH)
+#define XFS_BUF_ISFLUSH(x)	 ((x)->pb_flags & PBF_FLUSH)
+
+#define XFS_BUF_SHUT(x)		 printk("XFS_BUF_SHUT not implemented yet\n")
+#define XFS_BUF_UNSHUT(x)	 printk("XFS_BUF_UNSHUT not implemented yet\n")
+#define XFS_BUF_ISSHUT(x)	 (0)
+
+#define XFS_BUF_HOLD(x)		pagebuf_hold(x)
+#define XFS_BUF_READ(x)		((x)->pb_flags |= PBF_READ)
+#define XFS_BUF_UNREAD(x)	((x)->pb_flags &= ~PBF_READ)
+#define XFS_BUF_ISREAD(x)	((x)->pb_flags & PBF_READ)
+
+#define XFS_BUF_WRITE(x)	((x)->pb_flags |= PBF_WRITE)
+#define XFS_BUF_UNWRITE(x)	((x)->pb_flags &= ~PBF_WRITE)
+#define XFS_BUF_ISWRITE(x)	((x)->pb_flags & PBF_WRITE)
+
+#define XFS_BUF_ISUNINITIAL(x)	 (0)
+#define XFS_BUF_UNUNINITIAL(x)	 (0)
+
+#define XFS_BUF_BP_ISMAPPED(bp)	 1
+
+#define XFS_BUF_DATAIO(x)	((x)->pb_flags |= PBF_FS_DATAIOD)
+#define XFS_BUF_UNDATAIO(x)	((x)->pb_flags &= ~PBF_FS_DATAIOD)
+
+#define XFS_BUF_IODONE_FUNC(buf)	(buf)->pb_iodone
+#define XFS_BUF_SET_IODONE_FUNC(buf, func)	\
+			(buf)->pb_iodone = (func)
+#define XFS_BUF_CLR_IODONE_FUNC(buf)		\
+			(buf)->pb_iodone = NULL
+#define XFS_BUF_SET_BDSTRAT_FUNC(buf, func)	\
+			(buf)->pb_strat = (func)
+#define XFS_BUF_CLR_BDSTRAT_FUNC(buf)		\
+			(buf)->pb_strat = NULL
+
+#define XFS_BUF_FSPRIVATE(buf, type)		\
+			((type)(buf)->pb_fspriv)
+#define XFS_BUF_SET_FSPRIVATE(buf, value)	\
+			(buf)->pb_fspriv = (void *)(value)
+#define XFS_BUF_FSPRIVATE2(buf, type)		\
+			((type)(buf)->pb_fspriv2)
+#define XFS_BUF_SET_FSPRIVATE2(buf, value)	\
+			(buf)->pb_fspriv2 = (void *)(value)
+#define XFS_BUF_FSPRIVATE3(buf, type)		\
+			((type)(buf)->pb_fspriv3)
+#define XFS_BUF_SET_FSPRIVATE3(buf, value)	\
+			(buf)->pb_fspriv3  = (void *)(value)
+#define XFS_BUF_SET_START(buf)
+
+#define XFS_BUF_SET_BRELSE_FUNC(buf, value) \
+			(buf)->pb_relse = (value)
+
+#define XFS_BUF_PTR(bp)		(xfs_caddr_t)((bp)->pb_addr)
+
+extern inline xfs_caddr_t xfs_buf_offset(xfs_buf_t *bp, size_t offset)
+{
+	if (bp->pb_flags & PBF_MAPPED)
+		return XFS_BUF_PTR(bp) + offset;
+	return (xfs_caddr_t) pagebuf_offset(bp, offset);
+}
+
+#define XFS_BUF_SET_PTR(bp, val, count)		\
+				pagebuf_associate_memory(bp, val, count)
+#define XFS_BUF_ADDR(bp)	((bp)->pb_bn)
+#define XFS_BUF_SET_ADDR(bp, blk)		\
+			((bp)->pb_bn = (blk))
+#define XFS_BUF_OFFSET(bp)	((bp)->pb_file_offset)
+#define XFS_BUF_SET_OFFSET(bp, off)		\
+			((bp)->pb_file_offset = (off))
+#define XFS_BUF_COUNT(bp)	((bp)->pb_count_desired)
+#define XFS_BUF_SET_COUNT(bp, cnt)		\
+			((bp)->pb_count_desired = (cnt))
+#define XFS_BUF_SIZE(bp)	((bp)->pb_buffer_length)
+#define XFS_BUF_SET_SIZE(bp, cnt)		\
+			((bp)->pb_buffer_length = (cnt))
+#define XFS_BUF_SET_VTYPE_REF(bp, type, ref)
+#define XFS_BUF_SET_VTYPE(bp, type)
+#define XFS_BUF_SET_REF(bp, ref)
+
+#define XFS_BUF_ISPINNED(bp)	pagebuf_ispin(bp)
+
+#define XFS_BUF_VALUSEMA(bp)	pagebuf_lock_value(bp)
+#define XFS_BUF_CPSEMA(bp)	(pagebuf_cond_lock(bp) == 0)
+#define XFS_BUF_VSEMA(bp)	pagebuf_unlock(bp)
+#define XFS_BUF_PSEMA(bp,x)	pagebuf_lock(bp)
+#define XFS_BUF_V_IODONESEMA(bp) up(&bp->pb_iodonesema);
+
+/* setup the buffer target from a buftarg structure */
+#define XFS_BUF_SET_TARGET(bp, target)	\
+		(bp)->pb_target = (target)
+#define XFS_BUF_TARGET(bp)	((bp)->pb_target)
+#define XFS_BUFTARG_NAME(target)	\
+		pagebuf_target_name(target)
+
+#define XFS_BUF_SET_VTYPE_REF(bp, type, ref)
+#define XFS_BUF_SET_VTYPE(bp, type)
+#define XFS_BUF_SET_REF(bp, ref)
+
+#define xfs_buf_read(target, blkno, len, flags) \
+		pagebuf_get((target), (blkno), (len), \
+			PBF_LOCK | PBF_READ | PBF_MAPPED)
+#define xfs_buf_get(target, blkno, len, flags) \
+		pagebuf_get((target), (blkno), (len), \
+			PBF_LOCK | PBF_MAPPED)
+
+#define xfs_buf_read_flags(target, blkno, len, flags) \
+		pagebuf_get((target), (blkno), (len), PBF_READ | (flags))
+#define xfs_buf_get_flags(target, blkno, len, flags) \
+		pagebuf_get((target), (blkno), (len), (flags))
+
+static inline int	xfs_bawrite(void *mp, xfs_buf_t *bp)
+{
+	bp->pb_fspriv3 = mp;
+	bp->pb_strat = xfs_bdstrat_cb;
+	xfs_buf_undelay(bp);
+	return pagebuf_iostart(bp, PBF_WRITE | PBF_ASYNC | _PBF_RUN_QUEUES);
+}
+
+static inline void	xfs_buf_relse(xfs_buf_t *bp)
+{
+	if (!bp->pb_relse)
+		pagebuf_unlock(bp);
+	pagebuf_rele(bp);
+}
+
+#define xfs_bpin(bp)		pagebuf_pin(bp)
+#define xfs_bunpin(bp)		pagebuf_unpin(bp)
+
+#define xfs_buftrace(id, bp)	\
+	    pagebuf_trace(bp, id, NULL, (void *)__builtin_return_address(0))
+
+#define xfs_biodone(pb)		    \
+	    pagebuf_iodone(pb, (pb->pb_flags & PBF_FS_DATAIOD), 0)
+
+#define xfs_incore(buftarg,blkno,len,lockit) \
+	    pagebuf_find(buftarg, blkno ,len, lockit)
+
+
+#define xfs_biomove(pb, off, len, data, rw) \
+	    pagebuf_iomove((pb), (off), (len), (data), \
+		((rw) == XFS_B_WRITE) ? PBRW_WRITE : PBRW_READ)
+
+#define xfs_biozero(pb, off, len) \
+	    pagebuf_iomove((pb), (off), (len), NULL, PBRW_ZERO)
+
+
+static inline int	XFS_bwrite(xfs_buf_t *pb)
+{
+	int	iowait = (pb->pb_flags & PBF_ASYNC) == 0;
+	int	error = 0;
+
+	if (!iowait)
+		pb->pb_flags |= _PBF_RUN_QUEUES;
+
+	xfs_buf_undelay(pb);
+	pagebuf_iostrategy(pb);
+	if (iowait) {
+		error = pagebuf_iowait(pb);
+		xfs_buf_relse(pb);
+	}
+	return error;
+}
+
+#define XFS_bdwrite(pb)		     \
+	    pagebuf_iostart(pb, PBF_DELWRI | PBF_ASYNC)
+
+static inline int xfs_bdwrite(void *mp, xfs_buf_t *bp)
+{
+	bp->pb_strat = xfs_bdstrat_cb;
+	bp->pb_fspriv3 = mp;
+
+	return pagebuf_iostart(bp, PBF_DELWRI | PBF_ASYNC);
+}
+
+#define XFS_bdstrat(bp) pagebuf_iorequest(bp)
+
+#define xfs_iowait(pb)	pagebuf_iowait(pb)
+
+#define xfs_baread(target, rablkno, ralen)  \
+	pagebuf_readahead((target), (rablkno), (ralen), PBF_DONT_BLOCK)
+
+#define xfs_buf_get_empty(len, target)	pagebuf_get_empty((len), (target))
+#define xfs_buf_get_noaddr(len, target)	pagebuf_get_no_daddr((len), (target))
+#define xfs_buf_free(bp)		pagebuf_free(bp)
+
+
+/*
+ *	Handling of buftargs.
+ */
+
+extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *);
+extern void xfs_free_buftarg(xfs_buftarg_t *, int);
+extern void xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int);
+extern void xfs_incore_relse(xfs_buftarg_t *, int, int);
+extern int xfs_flush_buftarg(xfs_buftarg_t *, int);
+
+#define xfs_getsize_buftarg(buftarg) \
+	block_size((buftarg)->pbr_bdev)
+#define xfs_readonly_buftarg(buftarg) \
+	bdev_read_only((buftarg)->pbr_bdev)
+#define xfs_binval(buftarg) \
+	xfs_flush_buftarg(buftarg, 1)
+#define XFS_bflush(buftarg) \
+	xfs_flush_buftarg(buftarg, 1)
+
+#endif	/* __XFS_BUF_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_cred.h b/fs/xfs/linux-2.6/xfs_cred.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_cred.h	Tue Jun 15 22:20:39 2004
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_CRED_H__
+#define __XFS_CRED_H__
+
+/*
+ * Credentials
+ */
+typedef struct cred {
+	/* EMPTY */
+} cred_t;
+
+extern struct cred *sys_cred;
+
+/* this is a hack.. (assums sys_cred is the only cred_t in the system) */
+static __inline int capable_cred(cred_t *cr, int cid)
+{
+	return (cr == sys_cred) ? 1 : capable(cid);
+}
+
+#endif  /* __XFS_CRED_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_file.c	Tue Jun 15 22:20:41 2004
@@ -0,0 +1,546 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+#include "xfs_inum.h"
+#include "xfs_log.h"
+#include "xfs_sb.h"
+#include "xfs_dir.h"
+#include "xfs_dir2.h"
+#include "xfs_trans.h"
+#include "xfs_dmapi.h"
+#include "xfs_mount.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_alloc.h"
+#include "xfs_btree.h"
+#include "xfs_attr_sf.h"
+#include "xfs_dir_sf.h"
+#include "xfs_dir2_sf.h"
+#include "xfs_dinode.h"
+#include "xfs_inode.h"
+#include "xfs_error.h"
+#include "xfs_rw.h"
+
+#include <linux/dcache.h>
+
+static struct vm_operations_struct linvfs_file_vm_ops;
+
+
+STATIC inline ssize_t
+__linvfs_read(
+	struct kiocb		*iocb,
+	char __user		*buf,
+	int			ioflags,
+	size_t			count,
+	loff_t			pos)
+{
+	struct iovec		iov = {buf, count};
+	struct file		*file = iocb->ki_filp;
+	vnode_t			*vp = LINVFS_GET_VP(file->f_dentry->d_inode);
+	ssize_t			rval;
+
+	BUG_ON(iocb->ki_pos != pos);
+
+	if (unlikely(file->f_flags & O_DIRECT))
+		ioflags |= IO_ISDIRECT;
+	VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
+	return rval;
+}
+
+
+STATIC ssize_t
+linvfs_read(
+	struct kiocb		*iocb,
+	char __user		*buf,
+	size_t			count,
+	loff_t			pos)
+{
+	return __linvfs_read(iocb, buf, 0, count, pos);
+}
+
+STATIC ssize_t
+linvfs_read_invis(
+	struct kiocb		*iocb,
+	char __user		*buf,
+	size_t			count,
+	loff_t			pos)
+{
+	return __linvfs_read(iocb, buf, IO_INVIS, count, pos);
+}
+
+
+STATIC inline ssize_t
+__linvfs_write(
+	struct kiocb	*iocb,
+	const char 	*buf,
+	int		ioflags,
+	size_t		count,
+	loff_t		pos)
+{
+	struct iovec	iov = {(void *)buf, count};
+	struct file	*file = iocb->ki_filp;
+	struct inode	*inode = file->f_mapping->host;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	ssize_t		rval;
+
+	BUG_ON(iocb->ki_pos != pos);
+	if (unlikely(file->f_flags & O_DIRECT)) {
+		ioflags |= IO_ISDIRECT;
+		VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos,
+				ioflags, NULL, rval);
+	} else {
+		down(&inode->i_sem);
+		VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos,
+				ioflags, NULL, rval);
+		up(&inode->i_sem);
+	}
+
+	return rval;
+}
+
+
+STATIC ssize_t
+linvfs_write(
+	struct kiocb		*iocb,
+	const char __user	*buf,
+	size_t			count,
+	loff_t			pos)
+{
+	return __linvfs_write(iocb, buf, 0, count, pos);
+}
+
+STATIC ssize_t
+linvfs_write_invis(
+	struct kiocb		*iocb,
+	const char __user	*buf,
+	size_t			count,
+	loff_t			pos)
+{
+	return __linvfs_write(iocb, buf, IO_INVIS, count, pos);
+}
+
+
+STATIC inline ssize_t
+__linvfs_readv(
+	struct file		*file,
+	const struct iovec 	*iov,
+	int			ioflags,
+	unsigned long		nr_segs,
+	loff_t			*ppos)
+{
+	struct inode	*inode = file->f_mapping->host;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	struct		kiocb kiocb;
+	ssize_t		rval;
+
+	init_sync_kiocb(&kiocb, file);
+	kiocb.ki_pos = *ppos;
+
+	if (unlikely(file->f_flags & O_DIRECT))
+		ioflags |= IO_ISDIRECT;
+	VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
+	if (rval == -EIOCBQUEUED)
+		rval = wait_on_sync_kiocb(&kiocb);
+
+	*ppos = kiocb.ki_pos;
+	return rval;
+}
+
+STATIC ssize_t
+linvfs_readv(
+	struct file		*file,
+	const struct iovec 	*iov,
+	unsigned long		nr_segs,
+	loff_t			*ppos)
+{
+	return __linvfs_readv(file, iov, 0, nr_segs, ppos);
+}
+
+STATIC ssize_t
+linvfs_readv_invis(
+	struct file		*file,
+	const struct iovec 	*iov,
+	unsigned long		nr_segs,
+	loff_t			*ppos)
+{
+	return __linvfs_readv(file, iov, IO_INVIS, nr_segs, ppos);
+}
+
+
+STATIC inline ssize_t
+__linvfs_writev(
+	struct file		*file,
+	const struct iovec 	*iov,
+	int			ioflags,
+	unsigned long		nr_segs,
+	loff_t			*ppos)
+{
+	struct inode	*inode = file->f_mapping->host;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	struct		kiocb kiocb;
+	ssize_t		rval;
+
+	init_sync_kiocb(&kiocb, file);
+	kiocb.ki_pos = *ppos;
+	if (unlikely(file->f_flags & O_DIRECT)) {
+		ioflags |= IO_ISDIRECT;
+		VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos,
+				ioflags, NULL, rval);
+	} else {
+		down(&inode->i_sem);
+		VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos,
+				ioflags, NULL, rval);
+		up(&inode->i_sem);
+	}
+
+	if (rval == -EIOCBQUEUED)
+		rval = wait_on_sync_kiocb(&kiocb);
+
+	*ppos = kiocb.ki_pos;
+	return rval;
+}
+
+
+STATIC ssize_t
+linvfs_writev(
+	struct file		*file,
+	const struct iovec 	*iov,
+	unsigned long		nr_segs,
+	loff_t			*ppos)
+{
+	return __linvfs_writev(file, iov, 0, nr_segs, ppos);
+}
+
+STATIC ssize_t
+linvfs_writev_invis(
+	struct file		*file,
+	const struct iovec 	*iov,
+	unsigned long		nr_segs,
+	loff_t			*ppos)
+{
+	return __linvfs_writev(file, iov, IO_INVIS, nr_segs, ppos);
+}
+
+STATIC ssize_t
+linvfs_sendfile(
+	struct file		*filp,
+	loff_t			*ppos,
+	size_t			count,
+	read_actor_t		actor,
+	void			*target)
+{
+	vnode_t			*vp = LINVFS_GET_VP(filp->f_dentry->d_inode);
+	ssize_t			rval;
+
+	VOP_SENDFILE(vp, filp, ppos, 0, count, actor, target, NULL, rval);
+	return rval;
+}
+
+
+STATIC int
+linvfs_open(
+	struct inode	*inode,
+	struct file	*filp)
+{
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	int		error;
+
+	if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
+		return -EFBIG;
+
+	ASSERT(vp);
+	VOP_OPEN(vp, NULL, error);
+	return -error;
+}
+
+
+STATIC int
+linvfs_release(
+	struct inode	*inode,
+	struct file	*filp)
+{
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	int		error = 0;
+
+	if (vp)
+		VOP_RELEASE(vp, error);
+	return -error;
+}
+
+
+STATIC int
+linvfs_fsync(
+	struct file	*filp,
+	struct dentry	*dentry,
+	int		datasync)
+{
+	struct inode	*inode = dentry->d_inode;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	int		error;
+	int		flags = FSYNC_WAIT;
+
+	if (datasync)
+		flags |= FSYNC_DATA;
+
+	ASSERT(vp);
+	VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error);
+	return -error;
+}
+
+/*
+ * linvfs_readdir maps to VOP_READDIR().
+ * We need to build a uio, cred, ...
+ */
+
+#define nextdp(dp)      ((struct xfs_dirent *)((char *)(dp) + (dp)->d_reclen))
+
+STATIC int
+linvfs_readdir(
+	struct file	*filp,
+	void		*dirent,
+	filldir_t	filldir)
+{
+	int		error = 0;
+	vnode_t		*vp;
+	uio_t		uio;
+	iovec_t		iov;
+	int		eof = 0;
+	caddr_t		read_buf;
+	int		namelen, size = 0;
+	size_t		rlen = PAGE_CACHE_SIZE;
+	xfs_off_t	start_offset, curr_offset;
+	xfs_dirent_t	*dbp = NULL;
+
+	vp = LINVFS_GET_VP(filp->f_dentry->d_inode);
+	ASSERT(vp);
+
+	/* Try fairly hard to get memory */
+	do {
+		if ((read_buf = (caddr_t)kmalloc(rlen, GFP_KERNEL)))
+			break;
+		rlen >>= 1;
+	} while (rlen >= 1024);
+
+	if (read_buf == NULL)
+		return -ENOMEM;
+
+	uio.uio_iov = &iov;
+	uio.uio_segflg = UIO_SYSSPACE;
+	curr_offset = filp->f_pos;
+	if (filp->f_pos != 0x7fffffff)
+		uio.uio_offset = filp->f_pos;
+	else
+		uio.uio_offset = 0xffffffff;
+
+	while (!eof) {
+		uio.uio_resid = iov.iov_len = rlen;
+		iov.iov_base = read_buf;
+		uio.uio_iovcnt = 1;
+
+		start_offset = uio.uio_offset;
+
+		VOP_READDIR(vp, &uio, NULL, &eof, error);
+		if ((uio.uio_offset == start_offset) || error) {
+			size = 0;
+			break;
+		}
+
+		size = rlen - uio.uio_resid;
+		dbp = (xfs_dirent_t *)read_buf;
+		while (size > 0) {
+			namelen = strlen(dbp->d_name);
+
+			if (filldir(dirent, dbp->d_name, namelen,
+					(loff_t) curr_offset & 0x7fffffff,
+					(ino_t) dbp->d_ino,
+					DT_UNKNOWN)) {
+				goto done;
+			}
+			size -= dbp->d_reclen;
+			curr_offset = (loff_t)dbp->d_off /* & 0x7fffffff */;
+			dbp = nextdp(dbp);
+		}
+	}
+done:
+	if (!error) {
+		if (size == 0)
+			filp->f_pos = uio.uio_offset & 0x7fffffff;
+		else if (dbp)
+			filp->f_pos = curr_offset;
+	}
+
+	kfree(read_buf);
+	return -error;
+}
+
+
+STATIC int
+linvfs_file_mmap(
+	struct file	*filp,
+	struct vm_area_struct *vma)
+{
+	struct inode	*ip = filp->f_dentry->d_inode;
+	vnode_t		*vp = LINVFS_GET_VP(ip);
+	vattr_t		va = { .va_mask = XFS_AT_UPDATIME };
+	int		error;
+
+	if ((vp->v_type == VREG) && (vp->v_vfsp->vfs_flag & VFS_DMI)) {
+		xfs_mount_t	*mp = XFS_VFSTOM(vp->v_vfsp);
+
+		error = -XFS_SEND_MMAP(mp, vma, 0);
+		if (error)
+			return error;
+	}
+
+	vma->vm_ops = &linvfs_file_vm_ops;
+
+	VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error);
+	return 0;
+}
+
+
+STATIC int
+linvfs_ioctl(
+	struct inode	*inode,
+	struct file	*filp,
+	unsigned int	cmd,
+	unsigned long	arg)
+{
+	int		error;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+
+	ASSERT(vp);
+	VOP_IOCTL(vp, inode, filp, 0, cmd, arg, error);
+	VMODIFY(vp);
+
+	/* NOTE:  some of the ioctl's return positive #'s as a
+	 *	  byte count indicating success, such as
+	 *	  readlink_by_handle.  So we don't "sign flip"
+	 *	  like most other routines.  This means true
+	 *	  errors need to be returned as a negative value.
+	 */
+	return error;
+}
+
+STATIC int
+linvfs_ioctl_invis(
+	struct inode	*inode,
+	struct file	*filp,
+	unsigned int	cmd,
+	unsigned long	arg)
+{
+	int		error;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+
+	ASSERT(vp);
+	VOP_IOCTL(vp, inode, filp, IO_INVIS, cmd, arg, error);
+	VMODIFY(vp);
+
+	/* NOTE:  some of the ioctl's return positive #'s as a
+	 *	  byte count indicating success, such as
+	 *	  readlink_by_handle.  So we don't "sign flip"
+	 *	  like most other routines.  This means true
+	 *	  errors need to be returned as a negative value.
+	 */
+	return error;
+}
+
+#ifdef HAVE_VMOP_MPROTECT
+STATIC int
+linvfs_mprotect(
+	struct vm_area_struct *vma,
+	unsigned int	newflags)
+{
+	vnode_t		*vp = LINVFS_GET_VP(vma->vm_file->f_dentry->d_inode);
+	int		error = 0;
+
+	if ((vp->v_type == VREG) && (vp->v_vfsp->vfs_flag & VFS_DMI)) {
+		if ((vma->vm_flags & VM_MAYSHARE) &&
+		    (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE)) {
+			xfs_mount_t	*mp = XFS_VFSTOM(vp->v_vfsp);
+
+			error = XFS_SEND_MMAP(mp, vma, VM_WRITE);
+		    }
+	}
+	return error;
+}
+#endif /* HAVE_VMOP_MPROTECT */
+
+
+struct file_operations linvfs_file_operations = {
+	.llseek		= generic_file_llseek,
+	.read		= do_sync_read,
+	.write		= do_sync_write,
+	.readv		= linvfs_readv,
+	.writev		= linvfs_writev,
+	.aio_read	= linvfs_read,
+	.aio_write	= linvfs_write,
+	.sendfile	= linvfs_sendfile,
+	.ioctl		= linvfs_ioctl,
+	.mmap		= linvfs_file_mmap,
+	.open		= linvfs_open,
+	.release	= linvfs_release,
+	.fsync		= linvfs_fsync,
+};
+
+struct file_operations linvfs_invis_file_operations = {
+	.llseek		= generic_file_llseek,
+	.read		= do_sync_read,
+	.write		= do_sync_write,
+	.readv		= linvfs_readv_invis,
+	.writev		= linvfs_writev_invis,
+	.aio_read	= linvfs_read_invis,
+	.aio_write	= linvfs_write_invis,
+	.sendfile	= linvfs_sendfile,
+	.ioctl		= linvfs_ioctl_invis,
+	.mmap		= linvfs_file_mmap,
+	.open		= linvfs_open,
+	.release	= linvfs_release,
+	.fsync		= linvfs_fsync,
+};
+
+
+struct file_operations linvfs_dir_operations = {
+	.read		= generic_read_dir,
+	.readdir	= linvfs_readdir,
+	.ioctl		= linvfs_ioctl,
+	.fsync		= linvfs_fsync,
+};
+
+static struct vm_operations_struct linvfs_file_vm_ops = {
+	.nopage		= filemap_nopage,
+#ifdef HAVE_VMOP_MPROTECT
+	.mprotect	= linvfs_mprotect,
+#endif
+};
diff -Nru a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.c	Tue Jun 15 22:20:36 2004
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+
+/*
+ * Stub for no-op vnode operations that return error status.
+ */
+int
+fs_noerr()
+{
+	return 0;
+}
+
+/*
+ * Operation unsupported under this file system.
+ */
+int
+fs_nosys()
+{
+	return ENOSYS;
+}
+
+/*
+ * Stub for inactive, strategy, and read/write lock/unlock.  Does nothing.
+ */
+/* ARGSUSED */
+void
+fs_noval()
+{
+}
+
+/*
+ * vnode pcache layer for vnode_tosspages.
+ * 'last' parameter unused but left in for IRIX compatibility
+ */
+void
+fs_tosspages(
+	bhv_desc_t	*bdp,
+	xfs_off_t	first,
+	xfs_off_t	last,
+	int		fiopt)
+{
+	vnode_t		*vp = BHV_TO_VNODE(bdp);
+	struct inode	*ip = LINVFS_GET_IP(vp);
+
+	if (VN_CACHED(vp))
+		truncate_inode_pages(ip->i_mapping, first);
+}
+
+
+/*
+ * vnode pcache layer for vnode_flushinval_pages.
+ * 'last' parameter unused but left in for IRIX compatibility
+ */
+void
+fs_flushinval_pages(
+	bhv_desc_t	*bdp,
+	xfs_off_t	first,
+	xfs_off_t	last,
+	int		fiopt)
+{
+	vnode_t		*vp = BHV_TO_VNODE(bdp);
+	struct inode	*ip = LINVFS_GET_IP(vp);
+
+	if (VN_CACHED(vp)) {
+		filemap_fdatawrite(ip->i_mapping);
+		filemap_fdatawait(ip->i_mapping);
+
+		truncate_inode_pages(ip->i_mapping, first);
+	}
+}
+
+/*
+ * vnode pcache layer for vnode_flush_pages.
+ * 'last' parameter unused but left in for IRIX compatibility
+ */
+int
+fs_flush_pages(
+	bhv_desc_t	*bdp,
+	xfs_off_t	first,
+	xfs_off_t	last,
+	uint64_t	flags,
+	int		fiopt)
+{
+	vnode_t		*vp = BHV_TO_VNODE(bdp);
+	struct inode	*ip = LINVFS_GET_IP(vp);
+
+	if (VN_CACHED(vp)) {
+		filemap_fdatawrite(ip->i_mapping);
+		filemap_fdatawait(ip->i_mapping);
+	}
+
+	return 0;
+}
diff -Nru a/fs/xfs/linux-2.6/xfs_fs_subr.h b/fs/xfs/linux-2.6/xfs_fs_subr.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.h	Tue Jun 15 22:20:42 2004
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2000, 2002 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef	__XFS_SUBR_H__
+#define __XFS_SUBR_H__
+
+/*
+ * Utilities shared among file system implementations.
+ */
+
+struct cred;
+
+extern int	fs_noerr(void);
+extern int	fs_nosys(void);
+extern int	fs_nodev(void);
+extern void	fs_noval(void);
+extern void	fs_tosspages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
+extern void	fs_flushinval_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
+extern int	fs_flush_pages(bhv_desc_t *, xfs_off_t, xfs_off_t, uint64_t, int);
+
+#endif	/* __XFS_FS_SUBR_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_globals.c b/fs/xfs/linux-2.6/xfs_globals.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_globals.c	Tue Jun 15 22:20:42 2004
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+/*
+ * This file contains globals needed by XFS that were normally defined
+ * somewhere else in IRIX.
+ */
+
+#include "xfs.h"
+#include "xfs_cred.h"
+#include "xfs_sysctl.h"
+
+/*
+ * System memory size - used to scale certain data structures in XFS.
+ */
+unsigned long xfs_physmem;
+
+/*
+ * Tunable XFS parameters.  xfs_params is required even when CONFIG_SYSCTL=n,
+ * other XFS code uses these values.  Times are measured in centisecs (i.e.
+ * 100ths of a second).
+ */
+xfs_param_t xfs_params = {
+			  /*	MIN		DFLT		MAX	*/
+	.restrict_chown	= {	0,		1,		1	},
+	.sgid_inherit	= {	0,		0,		1	},
+	.symlink_mode	= {	0,		0,		1	},
+	.panic_mask	= {	0,		0,		127	},
+	.error_level	= {	0,		3,		11	},
+	.syncd_timer	= {	1*100,		30*100,		7200*100},
+	.stats_clear	= {	0,		0,		1	},
+	.inherit_sync	= {	0,		1,		1	},
+	.inherit_nodump	= {	0,		1,		1	},
+	.inherit_noatim = {	0,		1,		1	},
+	.xfs_buf_timer	= {	100/2,		1*100,		30*100	},
+	.xfs_buf_age	= {	1*100,		15*100,		7200*100},
+};
+
+/*
+ * Global system credential structure.
+ */
+cred_t sys_cred_val, *sys_cred = &sys_cred_val;
+
diff -Nru a/fs/xfs/linux-2.6/xfs_globals.h b/fs/xfs/linux-2.6/xfs_globals.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_globals.h	Tue Jun 15 22:20:39 2004
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_GLOBALS_H__
+#define __XFS_GLOBALS_H__
+
+/*
+ * This file declares globals needed by XFS that were normally defined
+ * somewhere else in IRIX.
+ */
+
+extern uint64_t	xfs_panic_mask;		/* set to cause more panics */
+extern unsigned long xfs_physmem;
+extern struct cred *sys_cred;
+
+#endif	/* __XFS_GLOBALS_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c	Tue Jun 15 22:20:43 2004
@@ -0,0 +1,1246 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+
+#include "xfs_fs.h"
+#include "xfs_inum.h"
+#include "xfs_log.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
+#include "xfs_dir.h"
+#include "xfs_dir2.h"
+#include "xfs_alloc.h"
+#include "xfs_dmapi.h"
+#include "xfs_mount.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_btree.h"
+#include "xfs_ialloc.h"
+#include "xfs_attr_sf.h"
+#include "xfs_dir_sf.h"
+#include "xfs_dir2_sf.h"
+#include "xfs_dinode.h"
+#include "xfs_inode.h"
+#include "xfs_bmap.h"
+#include "xfs_bit.h"
+#include "xfs_rtalloc.h"
+#include "xfs_error.h"
+#include "xfs_itable.h"
+#include "xfs_rw.h"
+#include "xfs_acl.h"
+#include "xfs_cap.h"
+#include "xfs_mac.h"
+#include "xfs_attr.h"
+#include "xfs_buf_item.h"
+#include "xfs_utils.h"
+#include "xfs_dfrag.h"
+#include "xfs_fsops.h"
+
+#include <linux/dcache.h>
+#include <linux/mount.h>
+#include <linux/namei.h>
+#include <linux/pagemap.h>
+
+/*
+ * ioctl commands that are used by Linux filesystems
+ */
+#define XFS_IOC_GETXFLAGS	_IOR('f', 1, long)
+#define XFS_IOC_SETXFLAGS	_IOW('f', 2, long)
+#define XFS_IOC_GETVERSION	_IOR('v', 1, long)
+
+
+/*
+ * xfs_find_handle maps from userspace xfs_fsop_handlereq structure to
+ * a file or fs handle.
+ *
+ * XFS_IOC_PATH_TO_FSHANDLE
+ *    returns fs handle for a mount point or path within that mount point
+ * XFS_IOC_FD_TO_HANDLE
+ *    returns full handle for a FD opened in user space
+ * XFS_IOC_PATH_TO_HANDLE
+ *    returns full handle for a path
+ */
+STATIC int
+xfs_find_handle(
+	unsigned int		cmd,
+	unsigned long		arg)
+{
+	int			hsize;
+	xfs_handle_t		handle;
+	xfs_fsop_handlereq_t	hreq;
+	struct inode		*inode;
+	struct vnode		*vp;
+
+	if (copy_from_user(&hreq, (xfs_fsop_handlereq_t *)arg, sizeof(hreq)))
+		return -XFS_ERROR(EFAULT);
+
+	memset((char *)&handle, 0, sizeof(handle));
+
+	switch (cmd) {
+	case XFS_IOC_PATH_TO_FSHANDLE:
+	case XFS_IOC_PATH_TO_HANDLE: {
+		struct nameidata	nd;
+		int			error;
+
+		error = user_path_walk_link(hreq.path, &nd);
+		if (error)
+			return error;
+
+		ASSERT(nd.dentry);
+		ASSERT(nd.dentry->d_inode);
+		inode = igrab(nd.dentry->d_inode);
+		path_release(&nd);
+		break;
+	}
+
+	case XFS_IOC_FD_TO_HANDLE: {
+		struct file	*file;
+
+		file = fget(hreq.fd);
+		if (!file)
+		    return -EBADF;
+
+		ASSERT(file->f_dentry);
+		ASSERT(file->f_dentry->d_inode);
+		inode = igrab(file->f_dentry->d_inode);
+		fput(file);
+		break;
+	}
+
+	default:
+		ASSERT(0);
+		return -XFS_ERROR(EINVAL);
+	}
+
+	if (inode->i_sb->s_magic != XFS_SB_MAGIC) {
+		/* we're not in XFS anymore, Toto */
+		iput(inode);
+		return -XFS_ERROR(EINVAL);
+	}
+
+	/* we need the vnode */
+	vp = LINVFS_GET_VP(inode);
+	if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) {
+		iput(inode);
+		return -XFS_ERROR(EBADF);
+	}
+
+	/* now we can grab the fsid */
+	memcpy(&handle.ha_fsid, vp->v_vfsp->vfs_altfsid, sizeof(xfs_fsid_t));
+	hsize = sizeof(xfs_fsid_t);
+
+	if (cmd != XFS_IOC_PATH_TO_FSHANDLE) {
+		xfs_inode_t	*ip;
+		bhv_desc_t	*bhv;
+		int		lock_mode;
+
+		/* need to get access to the xfs_inode to read the generation */
+		bhv = vn_bhv_lookup_unlocked(VN_BHV_HEAD(vp), &xfs_vnodeops);
+		ASSERT(bhv);
+		ip = XFS_BHVTOI(bhv);
+		ASSERT(ip);
+		lock_mode = xfs_ilock_map_shared(ip);
+
+		/* fill in fid section of handle from inode */
+		handle.ha_fid.xfs_fid_len = sizeof(xfs_fid_t) -
+					    sizeof(handle.ha_fid.xfs_fid_len);
+		handle.ha_fid.xfs_fid_pad = 0;
+		handle.ha_fid.xfs_fid_gen = ip->i_d.di_gen;
+		handle.ha_fid.xfs_fid_ino = ip->i_ino;
+
+		xfs_iunlock_map_shared(ip, lock_mode);
+
+		hsize = XFS_HSIZE(handle);
+	}
+
+	/* now copy our handle into the user buffer & write out the size */
+	if (copy_to_user((xfs_handle_t *)hreq.ohandle, &handle, hsize) ||
+	    copy_to_user(hreq.ohandlen, &hsize, sizeof(__s32))) {
+		iput(inode);
+		return -XFS_ERROR(EFAULT);
+	}
+
+	iput(inode);
+	return 0;
+}
+
+
+/*
+ * Convert userspace handle data into vnode (and inode).
+ * We [ab]use the fact that all the fsop_handlereq ioctl calls
+ * have a data structure argument whose first component is always
+ * a xfs_fsop_handlereq_t, so we can cast to and from this type.
+ * This allows us to optimise the copy_from_user calls and gives
+ * a handy, shared routine.
+ *
+ * If no error, caller must always VN_RELE the returned vp.
+ */
+STATIC int
+xfs_vget_fsop_handlereq(
+	xfs_mount_t		*mp,
+	struct inode		*parinode,	/* parent inode pointer    */
+	int			cap,		/* capability level for op */
+	unsigned long		arg,		/* userspace data pointer  */
+	unsigned long		size,		/* size of expected struct */
+	/* output arguments */
+	xfs_fsop_handlereq_t	*hreq,
+	vnode_t			**vp,
+	struct inode		**inode)
+{
+	void			*hanp;
+	size_t			hlen;
+	xfs_fid_t		*xfid;
+	xfs_handle_t		*handlep;
+	xfs_handle_t		handle;
+	xfs_inode_t		*ip;
+	struct inode		*inodep;
+	vnode_t			*vpp;
+	xfs_ino_t		ino;
+	__u32			igen;
+	int			error;
+
+	if (!capable(cap))
+		return XFS_ERROR(EPERM);
+
+	/*
+	 * Only allow handle opens under a directory.
+	 */
+	if (!S_ISDIR(parinode->i_mode))
+		return XFS_ERROR(ENOTDIR);
+
+	/*
+	 * Copy the handle down from the user and validate
+	 * that it looks to be in the correct format.
+	 */
+	if (copy_from_user(hreq, (struct xfs_fsop_handlereq *)arg, size))
+		return XFS_ERROR(EFAULT);
+
+	hanp = hreq->ihandle;
+	hlen = hreq->ihandlen;
+	handlep = &handle;
+
+	if (hlen < sizeof(handlep->ha_fsid) || hlen > sizeof(*handlep))
+		return XFS_ERROR(EINVAL);
+	if (copy_from_user(handlep, hanp, hlen))
+		return XFS_ERROR(EFAULT);
+	if (hlen < sizeof(*handlep))
+		memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen);
+	if (hlen > sizeof(handlep->ha_fsid)) {
+		if (handlep->ha_fid.xfs_fid_len !=
+				(hlen - sizeof(handlep->ha_fsid)
+					- sizeof(handlep->ha_fid.xfs_fid_len))
+		    || handlep->ha_fid.xfs_fid_pad)
+			return XFS_ERROR(EINVAL);
+	}
+
+	/*
+	 * Crack the handle, obtain the inode # & generation #
+	 */
+	xfid = (struct xfs_fid *)&handlep->ha_fid;
+	if (xfid->xfs_fid_len == sizeof(*xfid) - sizeof(xfid->xfs_fid_len)) {
+		ino  = xfid->xfs_fid_ino;
+		igen = xfid->xfs_fid_gen;
+	} else {
+		return XFS_ERROR(EINVAL);
+	}
+
+	/*
+	 * Get the XFS inode, building a vnode to go with it.
+	 */
+	error = xfs_iget(mp, NULL, ino, XFS_ILOCK_SHARED, &ip, 0);
+	if (error)
+		return error;
+	if (ip == NULL)
+		return XFS_ERROR(EIO);
+	if (ip->i_d.di_mode == 0 || ip->i_d.di_gen != igen) {
+		xfs_iput_new(ip, XFS_ILOCK_SHARED);
+		return XFS_ERROR(ENOENT);
+	}
+
+	vpp = XFS_ITOV(ip);
+	inodep = LINVFS_GET_IP(vpp);
+	xfs_iunlock(ip, XFS_ILOCK_SHARED);
+
+	*vp = vpp;
+	*inode = inodep;
+	return 0;
+}
+
+STATIC int
+xfs_open_by_handle(
+	xfs_mount_t		*mp,
+	unsigned long		arg,
+	struct file		*parfilp,
+	struct inode		*parinode)
+{
+	int			error;
+	int			new_fd;
+	int			permflag;
+	struct file		*filp;
+	struct inode		*inode;
+	struct dentry		*dentry;
+	vnode_t			*vp;
+	xfs_fsop_handlereq_t	hreq;
+
+	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
+					sizeof(xfs_fsop_handlereq_t),
+					&hreq, &vp, &inode);
+	if (error)
+		return -error;
+
+	/* Restrict xfs_open_by_handle to directories & regular files. */
+	if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) {
+		iput(inode);
+		return -XFS_ERROR(EINVAL);
+	}
+
+#if BITS_PER_LONG != 32
+	hreq.oflags |= O_LARGEFILE;
+#endif
+	/* Put open permission in namei format. */
+	permflag = hreq.oflags;
+	if ((permflag+1) & O_ACCMODE)
+		permflag++;
+	if (permflag & O_TRUNC)
+		permflag |= 2;
+
+	if ((!(permflag & O_APPEND) || (permflag & O_TRUNC)) &&
+	    (permflag & FMODE_WRITE) && IS_APPEND(inode)) {
+		iput(inode);
+		return -XFS_ERROR(EPERM);
+	}
+
+	if ((permflag & FMODE_WRITE) && IS_IMMUTABLE(inode)) {
+		iput(inode);
+		return -XFS_ERROR(EACCES);
+	}
+
+	/* Can't write directories. */
+	if ( S_ISDIR(inode->i_mode) && (permflag & FMODE_WRITE)) {
+		iput(inode);
+		return -XFS_ERROR(EISDIR);
+	}
+
+	if ((new_fd = get_unused_fd()) < 0) {
+		iput(inode);
+		return new_fd;
+	}
+
+	dentry = d_alloc_anon(inode);
+	if (dentry == NULL) {
+		iput(inode);
+		put_unused_fd(new_fd);
+		return -XFS_ERROR(ENOMEM);
+	}
+
+	/* Ensure umount returns EBUSY on umounts while this file is open. */
+	mntget(parfilp->f_vfsmnt);
+
+	/* Create file pointer. */
+	filp = dentry_open(dentry, parfilp->f_vfsmnt, hreq.oflags);
+	if (IS_ERR(filp)) {
+		put_unused_fd(new_fd);
+		return -XFS_ERROR(-PTR_ERR(filp));
+	}
+	if (inode->i_mode & S_IFREG)
+		filp->f_op = &linvfs_invis_file_operations;
+
+	fd_install(new_fd, filp);
+	return new_fd;
+}
+
+STATIC int
+xfs_readlink_by_handle(
+	xfs_mount_t		*mp,
+	unsigned long		arg,
+	struct file		*parfilp,
+	struct inode		*parinode)
+{
+	int			error;
+	struct iovec		aiov;
+	struct uio		auio;
+	struct inode		*inode;
+	xfs_fsop_handlereq_t	hreq;
+	vnode_t			*vp;
+	__u32			olen;
+
+	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
+					sizeof(xfs_fsop_handlereq_t),
+					&hreq, &vp, &inode);
+	if (error)
+		return -error;
+
+	/* Restrict this handle operation to symlinks only. */
+	if (vp->v_type != VLNK) {
+		VN_RELE(vp);
+		return -XFS_ERROR(EINVAL);
+	}
+
+	if (copy_from_user(&olen, hreq.ohandlen, sizeof(__u32))) {
+		VN_RELE(vp);
+		return -XFS_ERROR(EFAULT);
+	}
+	aiov.iov_len	= olen;
+	aiov.iov_base	= hreq.ohandle;
+
+	auio.uio_iov	= &aiov;
+	auio.uio_iovcnt	= 1;
+	auio.uio_offset	= 0;
+	auio.uio_segflg	= UIO_USERSPACE;
+	auio.uio_resid	= olen;
+
+	VOP_READLINK(vp, &auio, IO_INVIS, NULL, error);
+
+	VN_RELE(vp);
+	return (olen - auio.uio_resid);
+}
+
+STATIC int
+xfs_fssetdm_by_handle(
+	xfs_mount_t		*mp,
+	unsigned long		arg,
+	struct file		*parfilp,
+	struct inode		*parinode)
+{
+	int			error;
+	struct fsdmidata	fsd;
+	xfs_fsop_setdm_handlereq_t dmhreq;
+	struct inode		*inode;
+	bhv_desc_t		*bdp;
+	vnode_t			*vp;
+
+	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_MKNOD, arg,
+					sizeof(xfs_fsop_setdm_handlereq_t),
+					(xfs_fsop_handlereq_t *)&dmhreq,
+					&vp, &inode);
+	if (error)
+		return -error;
+
+	if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
+		VN_RELE(vp);
+		return -XFS_ERROR(EPERM);
+	}
+
+	if (copy_from_user(&fsd, dmhreq.data, sizeof(fsd))) {
+		VN_RELE(vp);
+		return -XFS_ERROR(EFAULT);
+	}
+
+	bdp = bhv_base_unlocked(VN_BHV_HEAD(vp));
+	error = xfs_set_dmattrs(bdp, fsd.fsd_dmevmask, fsd.fsd_dmstate, NULL);
+
+	VN_RELE(vp);
+	if (error)
+		return -error;
+	return 0;
+}
+
+STATIC int
+xfs_attrlist_by_handle(
+	xfs_mount_t		*mp,
+	unsigned long		arg,
+	struct file		*parfilp,
+	struct inode		*parinode)
+{
+	int			error;
+	attrlist_cursor_kern_t	*cursor;
+	xfs_fsop_attrlist_handlereq_t al_hreq;
+	struct inode		*inode;
+	vnode_t			*vp;
+
+	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
+					sizeof(xfs_fsop_attrlist_handlereq_t),
+					(xfs_fsop_handlereq_t *)&al_hreq,
+					&vp, &inode);
+	if (error)
+		return -error;
+
+	cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
+	VOP_ATTR_LIST(vp, al_hreq.buffer, al_hreq.buflen, al_hreq.flags,
+			cursor, NULL, error);
+	VN_RELE(vp);
+	if (error)
+		return -error;
+	return 0;
+}
+
+STATIC int
+xfs_attrmulti_by_handle(
+	xfs_mount_t		*mp,
+	unsigned long		arg,
+	struct file		*parfilp,
+	struct inode		*parinode)
+{
+	int			error;
+	xfs_attr_multiop_t	*ops;
+	xfs_fsop_attrmulti_handlereq_t am_hreq;
+	struct inode		*inode;
+	vnode_t			*vp;
+	int			i, size;
+
+	error = xfs_vget_fsop_handlereq(mp, parinode, CAP_SYS_ADMIN, arg,
+					sizeof(xfs_fsop_attrmulti_handlereq_t),
+					(xfs_fsop_handlereq_t *)&am_hreq,
+					&vp, &inode);
+	if (error)
+		return -error;
+
+	size = am_hreq.opcount * sizeof(attr_multiop_t);
+	ops = (xfs_attr_multiop_t *)kmalloc(size, GFP_KERNEL);
+	if (!ops) {
+		VN_RELE(vp);
+		return -XFS_ERROR(ENOMEM);
+	}
+
+	if (copy_from_user(ops, am_hreq.ops, size)) {
+		kfree(ops);
+		VN_RELE(vp);
+		return -XFS_ERROR(EFAULT);
+	}
+
+	for (i = 0; i < am_hreq.opcount; i++) {
+		switch(ops[i].am_opcode) {
+		case ATTR_OP_GET:
+			VOP_ATTR_GET(vp,ops[i].am_attrname, ops[i].am_attrvalue,
+					&ops[i].am_length, ops[i].am_flags,
+					NULL, ops[i].am_error);
+			break;
+		case ATTR_OP_SET:
+			if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
+				ops[i].am_error = EPERM;
+				break;
+			}
+			VOP_ATTR_SET(vp,ops[i].am_attrname, ops[i].am_attrvalue,
+					ops[i].am_length, ops[i].am_flags,
+					NULL, ops[i].am_error);
+			break;
+		case ATTR_OP_REMOVE:
+			if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) {
+				ops[i].am_error = EPERM;
+				break;
+			}
+			VOP_ATTR_REMOVE(vp, ops[i].am_attrname, ops[i].am_flags,
+					NULL, ops[i].am_error);
+			break;
+		default:
+			ops[i].am_error = EINVAL;
+		}
+	}
+
+	if (copy_to_user(am_hreq.ops, ops, size))
+		error = -XFS_ERROR(EFAULT);
+
+	kfree(ops);
+	VN_RELE(vp);
+	return error;
+}
+
+/* prototypes for a few of the stack-hungry cases that have
+ * their own functions.  Functions are defined after their use
+ * so gcc doesn't get fancy and inline them with -03 */
+
+STATIC int
+xfs_ioc_space(
+	bhv_desc_t		*bdp,
+	vnode_t			*vp,
+	struct file		*filp,
+	int			flags,
+	unsigned int		cmd,
+	unsigned long		arg);
+
+STATIC int
+xfs_ioc_bulkstat(
+	xfs_mount_t		*mp,
+	unsigned int		cmd,
+	unsigned long		arg);
+
+STATIC int
+xfs_ioc_fsgeometry_v1(
+	xfs_mount_t		*mp,
+	unsigned long		arg);
+
+STATIC int
+xfs_ioc_fsgeometry(
+	xfs_mount_t		*mp,
+	unsigned long		arg);
+
+STATIC int
+xfs_ioc_xattr(
+	vnode_t			*vp,
+	xfs_inode_t		*ip,
+	struct file		*filp,
+	unsigned int		cmd,
+	unsigned long		arg);
+
+STATIC int
+xfs_ioc_getbmap(
+	bhv_desc_t		*bdp,
+	struct file		*filp,
+	int			flags,
+	unsigned int		cmd,
+	unsigned long		arg);
+
+STATIC int
+xfs_ioc_getbmapx(
+	bhv_desc_t		*bdp,
+	unsigned long		arg);
+
+int
+xfs_ioctl(
+	bhv_desc_t		*bdp,
+	struct inode		*inode,
+	struct file		*filp,
+	int			ioflags,
+	unsigned int		cmd,
+	unsigned long		arg)
+{
+	int			error;
+	vnode_t			*vp;
+	xfs_inode_t		*ip;
+	xfs_mount_t		*mp;
+
+	vp = LINVFS_GET_VP(inode);
+
+	vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address);
+
+	ip = XFS_BHVTOI(bdp);
+	mp = ip->i_mount;
+
+	switch (cmd) {
+
+	case XFS_IOC_ALLOCSP:
+	case XFS_IOC_FREESP:
+	case XFS_IOC_RESVSP:
+	case XFS_IOC_UNRESVSP:
+	case XFS_IOC_ALLOCSP64:
+	case XFS_IOC_FREESP64:
+	case XFS_IOC_RESVSP64:
+	case XFS_IOC_UNRESVSP64:
+		/*
+		 * Only allow the sys admin to reserve space unless
+		 * unwritten extents are enabled.
+		 */
+		if (!XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb) &&
+		    !capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		return xfs_ioc_space(bdp, vp, filp, ioflags, cmd, arg);
+
+	case XFS_IOC_DIOINFO: {
+		struct dioattr	da;
+		xfs_buftarg_t	*target =
+			(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
+			mp->m_rtdev_targp : mp->m_ddev_targp;
+
+		da.d_mem = da.d_miniosz = 1 << target->pbr_sshift;
+		/* The size dio will do in one go */
+		da.d_maxiosz = 64 * PAGE_CACHE_SIZE;
+
+		if (copy_to_user((struct dioattr *)arg, &da, sizeof(da)))
+			return -XFS_ERROR(EFAULT);
+		return 0;
+	}
+
+	case XFS_IOC_FSBULKSTAT_SINGLE:
+	case XFS_IOC_FSBULKSTAT:
+	case XFS_IOC_FSINUMBERS:
+		return xfs_ioc_bulkstat(mp, cmd, arg);
+
+	case XFS_IOC_FSGEOMETRY_V1:
+		return xfs_ioc_fsgeometry_v1(mp, arg);
+
+	case XFS_IOC_FSGEOMETRY:
+		return xfs_ioc_fsgeometry(mp, arg);
+
+	case XFS_IOC_GETVERSION:
+	case XFS_IOC_GETXFLAGS:
+	case XFS_IOC_SETXFLAGS:
+	case XFS_IOC_FSGETXATTR:
+	case XFS_IOC_FSSETXATTR:
+	case XFS_IOC_FSGETXATTRA:
+		return xfs_ioc_xattr(vp, ip, filp, cmd, arg);
+
+	case XFS_IOC_FSSETDM: {
+		struct fsdmidata	dmi;
+
+		if (copy_from_user(&dmi, (struct fsdmidata *)arg, sizeof(dmi)))
+			return -XFS_ERROR(EFAULT);
+
+		error = xfs_set_dmattrs(bdp, dmi.fsd_dmevmask, dmi.fsd_dmstate,
+							NULL);
+		return -error;
+	}
+
+	case XFS_IOC_GETBMAP:
+	case XFS_IOC_GETBMAPA:
+		return xfs_ioc_getbmap(bdp, filp, ioflags, cmd, arg);
+
+	case XFS_IOC_GETBMAPX:
+		return xfs_ioc_getbmapx(bdp, arg);
+
+	case XFS_IOC_FD_TO_HANDLE:
+	case XFS_IOC_PATH_TO_HANDLE:
+	case XFS_IOC_PATH_TO_FSHANDLE:
+		return xfs_find_handle(cmd, arg);
+
+	case XFS_IOC_OPEN_BY_HANDLE:
+		return xfs_open_by_handle(mp, arg, filp, inode);
+
+	case XFS_IOC_FSSETDM_BY_HANDLE:
+		return xfs_fssetdm_by_handle(mp, arg, filp, inode);
+
+	case XFS_IOC_READLINK_BY_HANDLE:
+		return xfs_readlink_by_handle(mp, arg, filp, inode);
+
+	case XFS_IOC_ATTRLIST_BY_HANDLE:
+		return xfs_attrlist_by_handle(mp, arg, filp, inode);
+
+	case XFS_IOC_ATTRMULTI_BY_HANDLE:
+		return xfs_attrmulti_by_handle(mp, arg, filp, inode);
+
+	case XFS_IOC_SWAPEXT: {
+		error = xfs_swapext((struct xfs_swapext *)arg);
+		return -error;
+	}
+
+	case XFS_IOC_FSCOUNTS: {
+		xfs_fsop_counts_t out;
+
+		error = xfs_fs_counts(mp, &out);
+		if (error)
+			return -error;
+
+		if (copy_to_user((char *)arg, &out, sizeof(out)))
+			return -XFS_ERROR(EFAULT);
+		return 0;
+	}
+
+	case XFS_IOC_SET_RESBLKS: {
+		xfs_fsop_resblks_t inout;
+		__uint64_t	   in;
+
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		if (copy_from_user(&inout, (char *)arg, sizeof(inout)))
+			return -XFS_ERROR(EFAULT);
+
+		/* input parameter is passed in resblks field of structure */
+		in = inout.resblks;
+		error = xfs_reserve_blocks(mp, &in, &inout);
+		if (error)
+			return -error;
+
+		if (copy_to_user((char *)arg, &inout, sizeof(inout)))
+			return -XFS_ERROR(EFAULT);
+		return 0;
+	}
+
+	case XFS_IOC_GET_RESBLKS: {
+		xfs_fsop_resblks_t out;
+
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		error = xfs_reserve_blocks(mp, NULL, &out);
+		if (error)
+			return -error;
+
+		if (copy_to_user((char *)arg, &out, sizeof(out)))
+			return -XFS_ERROR(EFAULT);
+
+		return 0;
+	}
+
+	case XFS_IOC_FSGROWFSDATA: {
+		xfs_growfs_data_t in;
+
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		if (copy_from_user(&in, (char *)arg, sizeof(in)))
+			return -XFS_ERROR(EFAULT);
+
+		error = xfs_growfs_data(mp, &in);
+		return -error;
+	}
+
+	case XFS_IOC_FSGROWFSLOG: {
+		xfs_growfs_log_t in;
+
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		if (copy_from_user(&in, (char *)arg, sizeof(in)))
+			return -XFS_ERROR(EFAULT);
+
+		error = xfs_growfs_log(mp, &in);
+		return -error;
+	}
+
+	case XFS_IOC_FSGROWFSRT: {
+		xfs_growfs_rt_t in;
+
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		if (copy_from_user(&in, (char *)arg, sizeof(in)))
+			return -XFS_ERROR(EFAULT);
+
+		error = xfs_growfs_rt(mp, &in);
+		return -error;
+	}
+
+	case XFS_IOC_FREEZE:
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		freeze_bdev(inode->i_sb->s_bdev);
+		return 0;
+
+	case XFS_IOC_THAW:
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+		thaw_bdev(inode->i_sb->s_bdev, inode->i_sb);
+		return 0;
+
+	case XFS_IOC_GOINGDOWN: {
+		__uint32_t in;
+
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		if (get_user(in, (__uint32_t *)arg))
+			return -XFS_ERROR(EFAULT);
+
+		error = xfs_fs_goingdown(mp, in);
+		return -error;
+	}
+
+	case XFS_IOC_ERROR_INJECTION: {
+		xfs_error_injection_t in;
+
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		if (copy_from_user(&in, (char *)arg, sizeof(in)))
+			return -XFS_ERROR(EFAULT);
+
+		error = xfs_errortag_add(in.errtag, mp);
+		return -error;
+	}
+
+	case XFS_IOC_ERROR_CLEARALL:
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+		error = xfs_errortag_clearall(mp);
+		return -error;
+
+	default:
+		return -ENOTTY;
+	}
+}
+
+STATIC int
+xfs_ioc_space(
+	bhv_desc_t		*bdp,
+	vnode_t			*vp,
+	struct file		*filp,
+	int			ioflags,
+	unsigned int		cmd,
+	unsigned long		arg)
+{
+	xfs_flock64_t		bf;
+	int			attr_flags = 0;
+	int			error;
+
+	if (vp->v_inode.i_flags & (S_IMMUTABLE|S_APPEND))
+		return -XFS_ERROR(EPERM);
+
+	if (!(filp->f_flags & FMODE_WRITE))
+		return -XFS_ERROR(EBADF);
+
+	if (vp->v_type != VREG)
+		return -XFS_ERROR(EINVAL);
+
+	if (copy_from_user(&bf, (xfs_flock64_t *)arg, sizeof(bf)))
+		return -XFS_ERROR(EFAULT);
+
+	if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
+		attr_flags |= ATTR_NONBLOCK;
+	if (ioflags & IO_INVIS)
+		attr_flags |= ATTR_DMI;
+
+	error = xfs_change_file_space(bdp, cmd, &bf, filp->f_pos,
+					      NULL, attr_flags);
+	return -error;
+}
+
+STATIC int
+xfs_ioc_bulkstat(
+	xfs_mount_t		*mp,
+	unsigned int		cmd,
+	unsigned long		arg)
+{
+	xfs_fsop_bulkreq_t	bulkreq;
+	int			count;	/* # of records returned */
+	xfs_ino_t		inlast;	/* last inode number */
+	int			done;
+	int			error;
+
+	/* done = 1 if there are more stats to get and if bulkstat */
+	/* should be called again (unused here, but used in dmapi) */
+
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
+
+	if (XFS_FORCED_SHUTDOWN(mp))
+		return -XFS_ERROR(EIO);
+
+	if (copy_from_user(&bulkreq, (xfs_fsop_bulkreq_t *)arg,
+					sizeof(xfs_fsop_bulkreq_t)))
+		return -XFS_ERROR(EFAULT);
+
+	if (copy_from_user(&inlast, (__s64 *)bulkreq.lastip,
+						sizeof(__s64)))
+		return -XFS_ERROR(EFAULT);
+
+	if ((count = bulkreq.icount) <= 0)
+		return -XFS_ERROR(EINVAL);
+
+	if (cmd == XFS_IOC_FSINUMBERS)
+		error = xfs_inumbers(mp, &inlast, &count,
+						bulkreq.ubuffer);
+	else if (cmd == XFS_IOC_FSBULKSTAT_SINGLE)
+		error = xfs_bulkstat_single(mp, &inlast,
+						bulkreq.ubuffer, &done);
+	else {	/* XFS_IOC_FSBULKSTAT */
+		if (count == 1 && inlast != 0) {
+			inlast++;
+			error = xfs_bulkstat_single(mp, &inlast,
+					bulkreq.ubuffer, &done);
+		} else {
+			error = xfs_bulkstat(mp, &inlast, &count,
+				(bulkstat_one_pf)xfs_bulkstat_one, NULL,
+				sizeof(xfs_bstat_t), bulkreq.ubuffer,
+				BULKSTAT_FG_QUICK, &done);
+		}
+	}
+
+	if (error)
+		return -error;
+
+	if (bulkreq.ocount != NULL) {
+		if (copy_to_user((xfs_ino_t *)bulkreq.lastip, &inlast,
+						sizeof(xfs_ino_t)))
+			return -XFS_ERROR(EFAULT);
+
+		if (copy_to_user((__s32 *)bulkreq.ocount, &count,
+						sizeof(count)))
+			return -XFS_ERROR(EFAULT);
+	}
+
+	return 0;
+}
+
+STATIC int
+xfs_ioc_fsgeometry_v1(
+	xfs_mount_t		*mp,
+	unsigned long		arg)
+{
+	xfs_fsop_geom_v1_t	fsgeo;
+	int			error;
+
+	error = xfs_fs_geometry(mp, (xfs_fsop_geom_t *)&fsgeo, 3);
+	if (error)
+		return -error;
+
+	if (copy_to_user((xfs_fsop_geom_t *)arg, &fsgeo, sizeof(fsgeo)))
+		return -XFS_ERROR(EFAULT);
+	return 0;
+}
+
+STATIC int
+xfs_ioc_fsgeometry(
+	xfs_mount_t		*mp,
+	unsigned long		arg)
+{
+	xfs_fsop_geom_t		fsgeo;
+	int			error;
+
+	error = xfs_fs_geometry(mp, &fsgeo, 4);
+	if (error)
+		return -error;
+
+	if (copy_to_user((xfs_fsop_geom_t *)arg, &fsgeo, sizeof(fsgeo)))
+		return -XFS_ERROR(EFAULT);
+	return 0;
+}
+
+/*
+ * Linux extended inode flags interface.
+ */
+#define LINUX_XFLAG_SYNC	0x00000008 /* Synchronous updates */
+#define LINUX_XFLAG_IMMUTABLE	0x00000010 /* Immutable file */
+#define LINUX_XFLAG_APPEND	0x00000020 /* writes to file may only append */
+#define LINUX_XFLAG_NODUMP	0x00000040 /* do not dump file */
+#define LINUX_XFLAG_NOATIME	0x00000080 /* do not update atime */
+
+STATIC unsigned int
+xfs_merge_ioc_xflags(
+	unsigned int	flags,
+	unsigned int	start)
+{
+	unsigned int	xflags = start;
+
+	if (flags & LINUX_XFLAG_IMMUTABLE)
+		xflags |= XFS_XFLAG_IMMUTABLE;
+	else
+		xflags &= ~XFS_XFLAG_IMMUTABLE;
+	if (flags & LINUX_XFLAG_APPEND)
+		xflags |= XFS_XFLAG_APPEND;
+	else
+		xflags &= ~XFS_XFLAG_APPEND;
+	if (flags & LINUX_XFLAG_SYNC)
+		xflags |= XFS_XFLAG_SYNC;
+	else
+		xflags &= ~XFS_XFLAG_SYNC;
+	if (flags & LINUX_XFLAG_NOATIME)
+		xflags |= XFS_XFLAG_NOATIME;
+	else
+		xflags &= ~XFS_XFLAG_NOATIME;
+	if (flags & LINUX_XFLAG_NODUMP)
+		xflags |= XFS_XFLAG_NODUMP;
+	else
+		xflags &= ~XFS_XFLAG_NODUMP;
+
+	return xflags;
+}
+
+STATIC unsigned int
+xfs_di2lxflags(
+	__uint16_t	di_flags)
+{
+	unsigned int	flags = 0;
+
+	if (di_flags & XFS_DIFLAG_IMMUTABLE)
+		flags |= LINUX_XFLAG_IMMUTABLE;
+	if (di_flags & XFS_DIFLAG_APPEND)
+		flags |= LINUX_XFLAG_APPEND;
+	if (di_flags & XFS_DIFLAG_SYNC)
+		flags |= LINUX_XFLAG_SYNC;
+	if (di_flags & XFS_DIFLAG_NOATIME)
+		flags |= LINUX_XFLAG_NOATIME;
+	if (di_flags & XFS_DIFLAG_NODUMP)
+		flags |= LINUX_XFLAG_NODUMP;
+	return flags;
+}
+
+STATIC int
+xfs_ioc_xattr(
+	vnode_t			*vp,
+	xfs_inode_t		*ip,
+	struct file		*filp,
+	unsigned int		cmd,
+	unsigned long		arg)
+{
+	struct fsxattr		fa;
+	vattr_t			va;
+	int			error;
+	int			attr_flags;
+	unsigned int		flags;
+
+	switch (cmd) {
+	case XFS_IOC_FSGETXATTR: {
+		va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_NEXTENTS;
+		VOP_GETATTR(vp, &va, 0, NULL, error);
+		if (error)
+			return -error;
+
+		fa.fsx_xflags	= va.va_xflags;
+		fa.fsx_extsize	= va.va_extsize;
+		fa.fsx_nextents = va.va_nextents;
+
+		if (copy_to_user((struct fsxattr *)arg, &fa, sizeof(fa)))
+			return -XFS_ERROR(EFAULT);
+		return 0;
+	}
+
+	case XFS_IOC_FSSETXATTR: {
+		if (copy_from_user(&fa, (struct fsxattr *)arg, sizeof(fa)))
+			return -XFS_ERROR(EFAULT);
+
+		attr_flags = 0;
+		if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
+			attr_flags |= ATTR_NONBLOCK;
+
+		va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE;
+		va.va_xflags  = fa.fsx_xflags;
+		va.va_extsize = fa.fsx_extsize;
+
+		VOP_SETATTR(vp, &va, attr_flags, NULL, error);
+		if (!error)
+			vn_revalidate(vp);	/* update Linux inode flags */
+		return -error;
+	}
+
+	case XFS_IOC_FSGETXATTRA: {
+		va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_ANEXTENTS;
+		VOP_GETATTR(vp, &va, 0, NULL, error);
+		if (error)
+			return -error;
+
+		fa.fsx_xflags	= va.va_xflags;
+		fa.fsx_extsize	= va.va_extsize;
+		fa.fsx_nextents = va.va_anextents;
+
+		if (copy_to_user((struct fsxattr *)arg, &fa, sizeof(fa)))
+			return -XFS_ERROR(EFAULT);
+		return 0;
+	}
+
+	case XFS_IOC_GETXFLAGS: {
+		flags = xfs_di2lxflags(ip->i_d.di_flags);
+		if (copy_to_user((unsigned int *)arg, &flags, sizeof(flags)))
+			return -XFS_ERROR(EFAULT);
+		return 0;
+	}
+
+	case XFS_IOC_SETXFLAGS: {
+		if (copy_from_user(&flags, (unsigned int *)arg, sizeof(flags)))
+			return -XFS_ERROR(EFAULT);
+
+		if (flags & ~(LINUX_XFLAG_IMMUTABLE | LINUX_XFLAG_APPEND | \
+			      LINUX_XFLAG_NOATIME | LINUX_XFLAG_NODUMP | \
+			      LINUX_XFLAG_SYNC))
+			return -XFS_ERROR(EOPNOTSUPP);
+
+		attr_flags = 0;
+		if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
+			attr_flags |= ATTR_NONBLOCK;
+
+		va.va_mask = XFS_AT_XFLAGS;
+		va.va_xflags = xfs_merge_ioc_xflags(flags,
+				xfs_dic2xflags(&ip->i_d, ARCH_NOCONVERT));
+
+		VOP_SETATTR(vp, &va, attr_flags, NULL, error);
+		if (!error)
+			vn_revalidate(vp);	/* update Linux inode flags */
+		return -error;
+	}
+
+	case XFS_IOC_GETVERSION: {
+		flags = LINVFS_GET_IP(vp)->i_generation;
+		if (copy_to_user((unsigned int *)arg, &flags, sizeof(flags)))
+			return -XFS_ERROR(EFAULT);
+		return 0;
+	}
+
+	default:
+		return -ENOTTY;
+	}
+}
+
+STATIC int
+xfs_ioc_getbmap(
+	bhv_desc_t		*bdp,
+	struct file		*filp,
+	int			ioflags,
+	unsigned int		cmd,
+	unsigned long		arg)
+{
+	struct getbmap		bm;
+	int			iflags;
+	int			error;
+
+	if (copy_from_user(&bm, (struct getbmap *)arg, sizeof(bm)))
+		return -XFS_ERROR(EFAULT);
+
+	if (bm.bmv_count < 2)
+		return -XFS_ERROR(EINVAL);
+
+	iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0);
+	if (ioflags & IO_INVIS)
+		iflags |= BMV_IF_NO_DMAPI_READ;
+
+	error = xfs_getbmap(bdp, &bm, (struct getbmap *)arg+1, iflags);
+	if (error)
+		return -error;
+
+	if (copy_to_user((struct getbmap *)arg, &bm, sizeof(bm)))
+		return -XFS_ERROR(EFAULT);
+	return 0;
+}
+
+STATIC int
+xfs_ioc_getbmapx(
+	bhv_desc_t		*bdp,
+	unsigned long		arg)
+{
+	struct getbmapx		bmx;
+	struct getbmap		bm;
+	int			iflags;
+	int			error;
+
+	if (copy_from_user(&bmx, (struct getbmapx *)arg, sizeof(bmx)))
+		return -XFS_ERROR(EFAULT);
+
+	if (bmx.bmv_count < 2)
+		return -XFS_ERROR(EINVAL);
+
+	/*
+	 * Map input getbmapx structure to a getbmap
+	 * structure for xfs_getbmap.
+	 */
+	GETBMAP_CONVERT(bmx, bm);
+
+	iflags = bmx.bmv_iflags;
+
+	if (iflags & (~BMV_IF_VALID))
+		return -XFS_ERROR(EINVAL);
+
+	iflags |= BMV_IF_EXTENDED;
+
+	error = xfs_getbmap(bdp, &bm, (struct getbmapx *)arg+1, iflags);
+	if (error)
+		return -error;
+
+	GETBMAP_CONVERT(bm, bmx);
+
+	if (copy_to_user((struct getbmapx *)arg, &bmx, sizeof(bmx)))
+		return -XFS_ERROR(EFAULT);
+
+	return 0;
+}
diff -Nru a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_iops.c	Tue Jun 15 22:20:38 2004
@@ -0,0 +1,702 @@
+/*
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_inum.h"
+#include "xfs_log.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
+#include "xfs_ag.h"
+#include "xfs_dir.h"
+#include "xfs_dir2.h"
+#include "xfs_alloc.h"
+#include "xfs_dmapi.h"
+#include "xfs_quota.h"
+#include "xfs_mount.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_btree.h"
+#include "xfs_ialloc.h"
+#include "xfs_attr_sf.h"
+#include "xfs_dir_sf.h"
+#include "xfs_dir2_sf.h"
+#include "xfs_dinode.h"
+#include "xfs_inode.h"
+#include "xfs_bmap.h"
+#include "xfs_bit.h"
+#include "xfs_rtalloc.h"
+#include "xfs_error.h"
+#include "xfs_itable.h"
+#include "xfs_rw.h"
+#include "xfs_acl.h"
+#include "xfs_cap.h"
+#include "xfs_mac.h"
+#include "xfs_attr.h"
+#include "xfs_buf_item.h"
+#include "xfs_utils.h"
+
+#include <linux/xattr.h>
+
+
+/*
+ * Pull the link count and size up from the xfs inode to the linux inode
+ */
+STATIC void
+validate_fields(
+	struct inode	*ip)
+{
+	vnode_t		*vp = LINVFS_GET_VP(ip);
+	vattr_t		va;
+	int		error;
+
+	va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
+	VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error);
+	if (likely(!error)) {
+		ip->i_nlink = va.va_nlink;
+		ip->i_blocks = va.va_nblocks;
+
+		/* we're under i_sem so i_size can't change under us */
+		if (i_size_read(ip) != va.va_size)
+			i_size_write(ip, va.va_size);
+	}
+}
+
+/*
+ * Determine whether a process has a valid fs_struct (kernel daemons
+ * like knfsd don't have an fs_struct).
+ *
+ * XXX(hch):  nfsd is broken, better fix it instead.
+ */
+STATIC inline int
+has_fs_struct(struct task_struct *task)
+{
+	return (task->fs != init_task.fs);
+}
+
+STATIC int
+linvfs_mknod(
+	struct inode	*dir,
+	struct dentry	*dentry,
+	int		mode,
+	dev_t		rdev)
+{
+	struct inode	*ip;
+	vattr_t		va;
+	vnode_t		*vp = NULL, *dvp = LINVFS_GET_VP(dir);
+	xfs_acl_t	*default_acl = NULL;
+	attrexists_t	test_default_acl = _ACL_DEFAULT_EXISTS;
+	int		error;
+
+	/*
+	 * Irix uses Missed'em'V split, but doesn't want to see
+	 * the upper 5 bits of (14bit) major.
+	 */
+	if (!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff)
+		return -EINVAL;
+
+	if (test_default_acl && test_default_acl(dvp)) {
+		if (!_ACL_ALLOC(default_acl))
+			return -ENOMEM;
+		if (!_ACL_GET_DEFAULT(dvp, default_acl)) {
+			_ACL_FREE(default_acl);
+			default_acl = NULL;
+		}
+	}
+
+	if (IS_POSIXACL(dir) && !default_acl && has_fs_struct(current))
+		mode &= ~current->fs->umask;
+
+	memset(&va, 0, sizeof(va));
+	va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
+	va.va_type = IFTOVT(mode);
+	va.va_mode = mode;
+
+	switch (mode & S_IFMT) {
+	case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
+		va.va_rdev = sysv_encode_dev(rdev);
+		va.va_mask |= XFS_AT_RDEV;
+		/*FALLTHROUGH*/
+	case S_IFREG:
+		VOP_CREATE(dvp, dentry, &va, &vp, NULL, error);
+		break;
+	case S_IFDIR:
+		VOP_MKDIR(dvp, dentry, &va, &vp, NULL, error);
+		break;
+	default:
+		error = EINVAL;
+		break;
+	}
+
+	if (default_acl) {
+		if (!error) {
+			error = _ACL_INHERIT(vp, &va, default_acl);
+			if (!error) {
+				VMODIFY(vp);
+			} else {
+				struct dentry	teardown = {};
+				int		err2;
+
+				/* Oh, the horror.
+				 * If we can't add the ACL we must back out.
+				 * ENOSPC can hit here, among other things.
+				 */
+				teardown.d_inode = ip = LINVFS_GET_IP(vp);
+				teardown.d_name = dentry->d_name;
+				remove_inode_hash(ip);
+				make_bad_inode(ip);
+				if (S_ISDIR(mode))
+					VOP_RMDIR(dvp, &teardown, NULL, err2);
+				else
+					VOP_REMOVE(dvp, &teardown, NULL, err2);
+				VN_RELE(vp);
+			}
+		}
+		_ACL_FREE(default_acl);
+	}
+
+	if (!error) {
+		ASSERT(vp);
+		ip = LINVFS_GET_IP(vp);
+
+		if (S_ISCHR(mode) || S_ISBLK(mode))
+			ip->i_rdev = rdev;
+		else if (S_ISDIR(mode))
+			validate_fields(ip);
+		d_instantiate(dentry, ip);
+		validate_fields(dir);
+	}
+	return -error;
+}
+
+STATIC int
+linvfs_create(
+	struct inode	*dir,
+	struct dentry	*dentry,
+	int		mode,
+	struct nameidata *nd)
+{
+	return linvfs_mknod(dir, dentry, mode, 0);
+}
+
+STATIC int
+linvfs_mkdir(
+	struct inode	*dir,
+	struct dentry	*dentry,
+	int		mode)
+{
+	return linvfs_mknod(dir, dentry, mode|S_IFDIR, 0);
+}
+
+STATIC struct dentry *
+linvfs_lookup(
+	struct inode	*dir,
+	struct dentry	*dentry,
+	struct nameidata *nd)
+{
+	struct inode	*ip = NULL;
+	vnode_t		*vp, *cvp = NULL;
+	int		error;
+
+	if (dentry->d_name.len >= MAXNAMELEN)
+		return ERR_PTR(-ENAMETOOLONG);
+
+	vp = LINVFS_GET_VP(dir);
+	VOP_LOOKUP(vp, dentry, &cvp, 0, NULL, NULL, error);
+	if (!error) {
+		ASSERT(cvp);
+		ip = LINVFS_GET_IP(cvp);
+		if (!ip) {
+			VN_RELE(cvp);
+			return ERR_PTR(-EACCES);
+		}
+	}
+	if (error && (error != ENOENT))
+		return ERR_PTR(-error);
+	return d_splice_alias(ip, dentry);
+}
+
+STATIC int
+linvfs_link(
+	struct dentry	*old_dentry,
+	struct inode	*dir,
+	struct dentry	*dentry)
+{
+	struct inode	*ip;	/* inode of guy being linked to */
+	vnode_t		*tdvp;	/* target directory for new name/link */
+	vnode_t		*vp;	/* vp of name being linked */
+	int		error;
+
+	ip = old_dentry->d_inode;	/* inode being linked to */
+	if (S_ISDIR(ip->i_mode))
+		return -EPERM;
+
+	tdvp = LINVFS_GET_VP(dir);
+	vp = LINVFS_GET_VP(ip);
+
+	VOP_LINK(tdvp, vp, dentry, NULL, error);
+	if (!error) {
+		VMODIFY(tdvp);
+		VN_HOLD(vp);
+		validate_fields(ip);
+		d_instantiate(dentry, ip);
+	}
+	return -error;
+}
+
+STATIC int
+linvfs_unlink(
+	struct inode	*dir,
+	struct dentry	*dentry)
+{
+	struct inode	*inode;
+	vnode_t		*dvp;	/* directory containing name to remove */
+	int		error;
+
+	inode = dentry->d_inode;
+	dvp = LINVFS_GET_VP(dir);
+
+	VOP_REMOVE(dvp, dentry, NULL, error);
+	if (!error) {
+		validate_fields(dir);	/* For size only */
+		validate_fields(inode);
+	}
+
+	return -error;
+}
+
+STATIC int
+linvfs_symlink(
+	struct inode	*dir,
+	struct dentry	*dentry,
+	const char	*symname)
+{
+	struct inode	*ip;
+	vattr_t		va;
+	vnode_t		*dvp;	/* directory containing name to remove */
+	vnode_t		*cvp;	/* used to lookup symlink to put in dentry */
+	int		error;
+
+	dvp = LINVFS_GET_VP(dir);
+	cvp = NULL;
+
+	memset(&va, 0, sizeof(va));
+	va.va_type = VLNK;
+	va.va_mode = irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO;
+	va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
+
+	error = 0;
+	VOP_SYMLINK(dvp, dentry, &va, (char *)symname, &cvp, NULL, error);
+	if (!error && cvp) {
+		ASSERT(cvp->v_type == VLNK);
+		ip = LINVFS_GET_IP(cvp);
+		d_instantiate(dentry, ip);
+		validate_fields(dir);
+		validate_fields(ip); /* size needs update */
+	}
+	return -error;
+}
+
+STATIC int
+linvfs_rmdir(
+	struct inode	*dir,
+	struct dentry	*dentry)
+{
+	struct inode	*inode = dentry->d_inode;
+	vnode_t		*dvp = LINVFS_GET_VP(dir);
+	int		error;
+
+	VOP_RMDIR(dvp, dentry, NULL, error);
+	if (!error) {
+		validate_fields(inode);
+		validate_fields(dir);
+	}
+	return -error;
+}
+
+STATIC int
+linvfs_rename(
+	struct inode	*odir,
+	struct dentry	*odentry,
+	struct inode	*ndir,
+	struct dentry	*ndentry)
+{
+	struct inode	*new_inode = ndentry->d_inode;
+	vnode_t		*fvp;	/* from directory */
+	vnode_t		*tvp;	/* target directory */
+	int		error;
+
+	fvp = LINVFS_GET_VP(odir);
+	tvp = LINVFS_GET_VP(ndir);
+
+	VOP_RENAME(fvp, odentry, tvp, ndentry, NULL, error);
+	if (error)
+		return -error;
+
+	if (new_inode)
+		validate_fields(new_inode);
+
+	validate_fields(odir);
+	if (ndir != odir)
+		validate_fields(ndir);
+	return 0;
+}
+
+STATIC int
+linvfs_readlink(
+	struct dentry	*dentry,
+	char		*buf,
+	int		size)
+{
+	vnode_t		*vp = LINVFS_GET_VP(dentry->d_inode);
+	uio_t		uio;
+	iovec_t		iov;
+	int		error;
+
+	iov.iov_base = buf;
+	iov.iov_len = size;
+
+	uio.uio_iov = &iov;
+	uio.uio_offset = 0;
+	uio.uio_segflg = UIO_USERSPACE;
+	uio.uio_resid = size;
+	uio.uio_iovcnt = 1;
+
+	VOP_READLINK(vp, &uio, 0, NULL, error);
+	if (error)
+		return -error;
+
+	return (size - uio.uio_resid);
+}
+
+/*
+ * careful here - this function can get called recursively, so
+ * we need to be very careful about how much stack we use.
+ * uio is kmalloced for this reason...
+ */
+STATIC int
+linvfs_follow_link(
+	struct dentry		*dentry,
+	struct nameidata	*nd)
+{
+	vnode_t			*vp;
+	uio_t			*uio;
+	iovec_t			iov;
+	int			error;
+	char			*link;
+
+	ASSERT(dentry);
+	ASSERT(nd);
+
+	link = (char *)kmalloc(MAXNAMELEN+1, GFP_KERNEL);
+	if (!link)
+		return -ENOMEM;
+
+	uio = (uio_t *)kmalloc(sizeof(uio_t), GFP_KERNEL);
+	if (!uio) {
+		kfree(link);
+		return -ENOMEM;
+	}
+
+	vp = LINVFS_GET_VP(dentry->d_inode);
+
+	iov.iov_base = link;
+	iov.iov_len = MAXNAMELEN;
+
+	uio->uio_iov = &iov;
+	uio->uio_offset = 0;
+	uio->uio_segflg = UIO_SYSSPACE;
+	uio->uio_resid = MAXNAMELEN;
+	uio->uio_iovcnt = 1;
+
+	VOP_READLINK(vp, uio, 0, NULL, error);
+	if (error) {
+		kfree(uio);
+		kfree(link);
+		return -error;
+	}
+
+	link[MAXNAMELEN - uio->uio_resid] = '\0';
+	kfree(uio);
+
+	/* vfs_follow_link returns (-) errors */
+	error = vfs_follow_link(nd, link);
+	kfree(link);
+	return error;
+}
+
+#ifdef CONFIG_XFS_POSIX_ACL
+STATIC int
+linvfs_permission(
+	struct inode	*inode,
+	int		mode,
+	struct nameidata *nd)
+{
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	int		error;
+
+	mode <<= 6;		/* convert from linux to vnode access bits */
+	VOP_ACCESS(vp, mode, NULL, error);
+	return -error;
+}
+#else
+#define linvfs_permission NULL
+#endif
+
+STATIC int
+linvfs_getattr(
+	struct vfsmount	*mnt,
+	struct dentry	*dentry,
+	struct kstat	*stat)
+{
+	struct inode	*inode = dentry->d_inode;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	int		error = 0;
+
+	if (unlikely(vp->v_flag & VMODIFIED))
+		error = vn_revalidate(vp);
+	if (!error)
+		generic_fillattr(inode, stat);
+	return 0;
+}
+
+STATIC int
+linvfs_setattr(
+	struct dentry	*dentry,
+	struct iattr	*attr)
+{
+	struct inode	*inode = dentry->d_inode;
+	unsigned int	ia_valid = attr->ia_valid;
+	vnode_t		*vp = LINVFS_GET_VP(inode);
+	vattr_t		vattr;
+	int		flags = 0;
+	int		error;
+
+	memset(&vattr, 0, sizeof(vattr_t));
+	if (ia_valid & ATTR_UID) {
+		vattr.va_mask |= XFS_AT_UID;
+		vattr.va_uid = attr->ia_uid;
+	}
+	if (ia_valid & ATTR_GID) {
+		vattr.va_mask |= XFS_AT_GID;
+		vattr.va_gid = attr->ia_gid;
+	}
+	if (ia_valid & ATTR_SIZE) {
+		vattr.va_mask |= XFS_AT_SIZE;
+		vattr.va_size = attr->ia_size;
+	}
+	if (ia_valid & ATTR_ATIME) {
+		vattr.va_mask |= XFS_AT_ATIME;
+		vattr.va_atime = attr->ia_atime;
+	}
+	if (ia_valid & ATTR_MTIME) {
+		vattr.va_mask |= XFS_AT_MTIME;
+		vattr.va_mtime = attr->ia_mtime;
+	}
+	if (ia_valid & ATTR_CTIME) {
+		vattr.va_mask |= XFS_AT_CTIME;
+		vattr.va_ctime = attr->ia_ctime;
+	}
+	if (ia_valid & ATTR_MODE) {
+		vattr.va_mask |= XFS_AT_MODE;
+		vattr.va_mode = attr->ia_mode;
+		if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
+			inode->i_mode &= ~S_ISGID;
+	}
+
+	if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET))
+		flags |= ATTR_UTIME;
+#ifdef ATTR_NO_BLOCK
+	if ((ia_valid & ATTR_NO_BLOCK))
+		flags |= ATTR_NONBLOCK;
+#endif
+
+	VOP_SETATTR(vp, &vattr, flags, NULL, error);
+	if (error)
+		return -error;
+	vn_revalidate(vp);
+	return error;
+}
+
+STATIC void
+linvfs_truncate(
+	struct inode	*inode)
+{
+	block_truncate_page(inode->i_mapping, inode->i_size, linvfs_get_block);
+}
+
+STATIC int
+linvfs_setxattr(
+	struct dentry	*dentry,
+	const char	*name,
+	const void	*data,
+	size_t		size,
+	int		flags)
+{
+	vnode_t		*vp = LINVFS_GET_VP(dentry->d_inode);
+	char		*attr = (char *)name;
+	attrnames_t	*namesp;
+	int		xflags = 0;
+	int		error;
+
+	namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
+	if (!namesp)
+		return -EOPNOTSUPP;
+	attr += namesp->attr_namelen;
+	error = namesp->attr_capable(vp, NULL);
+	if (error)
+		return error;
+
+	/* Convert Linux syscall to XFS internal ATTR flags */
+	if (flags & XATTR_CREATE)
+		xflags |= ATTR_CREATE;
+	if (flags & XATTR_REPLACE)
+		xflags |= ATTR_REPLACE;
+	xflags |= namesp->attr_flag;
+	return namesp->attr_set(vp, attr, (void *)data, size, xflags);
+}
+
+STATIC ssize_t
+linvfs_getxattr(
+	struct dentry	*dentry,
+	const char	*name,
+	void		*data,
+	size_t		size)
+{
+	vnode_t		*vp = LINVFS_GET_VP(dentry->d_inode);
+	char		*attr = (char *)name;
+	attrnames_t	*namesp;
+	int		xflags = 0;
+	ssize_t		error;
+
+	namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
+	if (!namesp)
+		return -EOPNOTSUPP;
+	attr += namesp->attr_namelen;
+	error = namesp->attr_capable(vp, NULL);
+	if (error)
+		return error;
+
+	/* Convert Linux syscall to XFS internal ATTR flags */
+	if (!size) {
+		xflags |= ATTR_KERNOVAL;
+		data = NULL;
+	}
+	xflags |= namesp->attr_flag;
+	return namesp->attr_get(vp, attr, (void *)data, size, xflags);
+}
+
+STATIC ssize_t
+linvfs_listxattr(
+	struct dentry		*dentry,
+	char			*data,
+	size_t			size)
+{
+	vnode_t			*vp = LINVFS_GET_VP(dentry->d_inode);
+	int			error, xflags = ATTR_KERNAMELS;
+	ssize_t			result;
+
+	if (!size)
+		xflags |= ATTR_KERNOVAL;
+	xflags |= capable(CAP_SYS_ADMIN) ? ATTR_KERNFULLS : ATTR_KERNORMALS;
+
+	error = attr_generic_list(vp, data, size, xflags, &result);
+	if (error < 0)
+		return error;
+	return result;
+}
+
+STATIC int
+linvfs_removexattr(
+	struct dentry	*dentry,
+	const char	*name)
+{
+	vnode_t		*vp = LINVFS_GET_VP(dentry->d_inode);
+	char		*attr = (char *)name;
+	attrnames_t	*namesp;
+	int		xflags = 0;
+	int		error;
+
+	namesp = attr_lookup_namespace(attr, attr_namespaces, ATTR_NAMECOUNT);
+	if (!namesp)
+		return -EOPNOTSUPP;
+	attr += namesp->attr_namelen;
+	error = namesp->attr_capable(vp, NULL);
+	if (error)
+		return error;
+	xflags |= namesp->attr_flag;
+	return namesp->attr_remove(vp, attr, xflags);
+}
+
+
+struct inode_operations linvfs_file_inode_operations = {
+	.permission		= linvfs_permission,
+	.truncate		= linvfs_truncate,
+	.getattr		= linvfs_getattr,
+	.setattr		= linvfs_setattr,
+	.setxattr		= linvfs_setxattr,
+	.getxattr		= linvfs_getxattr,
+	.listxattr		= linvfs_listxattr,
+	.removexattr		= linvfs_removexattr,
+};
+
+struct inode_operations linvfs_dir_inode_operations = {
+	.create			= linvfs_create,
+	.lookup			= linvfs_lookup,
+	.link			= linvfs_link,
+	.unlink			= linvfs_unlink,
+	.symlink		= linvfs_symlink,
+	.mkdir			= linvfs_mkdir,
+	.rmdir			= linvfs_rmdir,
+	.mknod			= linvfs_mknod,
+	.rename			= linvfs_rename,
+	.permission		= linvfs_permission,
+	.getattr		= linvfs_getattr,
+	.setattr		= linvfs_setattr,
+	.setxattr		= linvfs_setxattr,
+	.getxattr		= linvfs_getxattr,
+	.listxattr		= linvfs_listxattr,
+	.removexattr		= linvfs_removexattr,
+};
+
+struct inode_operations linvfs_symlink_inode_operations = {
+	.readlink		= linvfs_readlink,
+	.follow_link		= linvfs_follow_link,
+	.permission		= linvfs_permission,
+	.getattr		= linvfs_getattr,
+	.setattr		= linvfs_setattr,
+	.setxattr		= linvfs_setxattr,
+	.getxattr		= linvfs_getxattr,
+	.listxattr		= linvfs_listxattr,
+	.removexattr		= linvfs_removexattr,
+};
diff -Nru a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/linux-2.6/xfs_iops.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_iops.h	Tue Jun 15 22:20:41 2004
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_IOPS_H__
+#define __XFS_IOPS_H__
+
+extern struct inode_operations linvfs_file_inode_operations;
+extern struct inode_operations linvfs_dir_inode_operations;
+extern struct inode_operations linvfs_symlink_inode_operations;
+
+extern struct file_operations linvfs_file_operations;
+extern struct file_operations linvfs_invis_file_operations;
+extern struct file_operations linvfs_dir_operations;
+
+extern struct address_space_operations linvfs_aops;
+
+extern int linvfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
+extern void linvfs_unwritten_done(struct buffer_head *, int);
+
+extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *,
+                        int, unsigned int, unsigned long);
+
+#endif /* __XFS_IOPS_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_linux.h	Tue Jun 15 22:20:36 2004
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_LINUX__
+#define __XFS_LINUX__
+
+#include <linux/types.h>
+#include <linux/config.h>
+
+/*
+ * Some types are conditional depending on the target system.
+ * XFS_BIG_BLKNOS needs block layer disk addresses to be 64 bits.
+ * XFS_BIG_INUMS needs the VFS inode number to be 64 bits, as well
+ * as requiring XFS_BIG_BLKNOS to be set.
+ */
+#if defined(CONFIG_LBD) || (BITS_PER_LONG == 64)
+# define XFS_BIG_BLKNOS	1
+# if BITS_PER_LONG == 64
+#  define XFS_BIG_INUMS	1
+# else
+#  define XFS_BIG_INUMS	0
+# endif
+#else
+# define XFS_BIG_BLKNOS	0
+# define XFS_BIG_INUMS	0
+#endif
+
+#include <xfs_types.h>
+#include <xfs_arch.h>
+
+#include <kmem.h>
+#include <mrlock.h>
+#include <spin.h>
+#include <sv.h>
+#include <mutex.h>
+#include <sema.h>
+#include <time.h>
+
+#include <support/qsort.h>
+#include <support/ktrace.h>
+#include <support/debug.h>
+#include <support/move.h>
+#include <support/uuid.h>
+
+#include <linux/mm.h>
+#include <linux/kernel.h>
+#include <linux/blkdev.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/file.h>
+#include <linux/swap.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/bitops.h>
+#include <linux/major.h>
+#include <linux/pagemap.h>
+#include <linux/vfs.h>
+#include <linux/seq_file.h>
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/version.h>
+
+#include <asm/page.h>
+#include <asm/div64.h>
+#include <asm/param.h>
+#include <asm/uaccess.h>
+#include <asm/byteorder.h>
+#include <asm/unaligned.h>
+
+#include <xfs_behavior.h>
+#include <xfs_vfs.h>
+#include <xfs_cred.h>
+#include <xfs_vnode.h>
+#include <xfs_stats.h>
+#include <xfs_sysctl.h>
+#include <xfs_iops.h>
+#include <xfs_super.h>
+#include <xfs_globals.h>
+#include <xfs_fs_subr.h>
+#include <xfs_lrw.h>
+#include <xfs_buf.h>
+
+/*
+ * Feature macros (disable/enable)
+ */
+#undef  HAVE_REFCACHE	/* reference cache not needed for NFS in 2.6 */
+#define HAVE_SENDFILE	/* sendfile(2) exists in 2.6, but not in 2.4 */
+
+/*
+ * State flag for unwritten extent buffers.
+ *
+ * We need to be able to distinguish between these and delayed
+ * allocate buffers within XFS.  The generic IO path code does
+ * not need to distinguish - we use the BH_Delay flag for both
+ * delalloc and these ondisk-uninitialised buffers.
+ */
+BUFFER_FNS(PrivateStart, unwritten);
+static inline void set_buffer_unwritten_io(struct buffer_head *bh)
+{
+	bh->b_end_io = linvfs_unwritten_done;
+}
+
+#define restricted_chown	xfs_params.restrict_chown.val
+#define irix_sgid_inherit	xfs_params.sgid_inherit.val
+#define irix_symlink_mode	xfs_params.symlink_mode.val
+#define xfs_panic_mask		xfs_params.panic_mask.val
+#define xfs_error_level		xfs_params.error_level.val
+#define xfs_syncd_centisecs	xfs_params.syncd_timer.val
+#define xfs_stats_clear		xfs_params.stats_clear.val
+#define xfs_inherit_sync	xfs_params.inherit_sync.val
+#define xfs_inherit_nodump	xfs_params.inherit_nodump.val
+#define xfs_inherit_noatime	xfs_params.inherit_noatim.val
+#define xfs_buf_timer_centisecs	xfs_params.xfs_buf_timer.val
+#define xfs_buf_age_centisecs	xfs_params.xfs_buf_age.val
+
+#define current_cpu()		smp_processor_id()
+#define current_pid()		(current->pid)
+#define current_fsuid(cred)	(current->fsuid)
+#define current_fsgid(cred)	(current->fsgid)
+
+#define NBPP		PAGE_SIZE
+#define DPPSHFT		(PAGE_SHIFT - 9)
+#define NDPP		(1 << (PAGE_SHIFT - 9))
+#define dtop(DD)	(((DD) + NDPP - 1) >> DPPSHFT)
+#define dtopt(DD)	((DD) >> DPPSHFT)
+#define dpoff(DD)	((DD) & (NDPP-1))
+
+#define NBBY		8		/* number of bits per byte */
+#define	NBPC		PAGE_SIZE	/* Number of bytes per click */
+#define	BPCSHIFT	PAGE_SHIFT	/* LOG2(NBPC) if exact */
+
+/*
+ * Size of block device i/o is parameterized here.
+ * Currently the system supports page-sized i/o.
+ */
+#define	BLKDEV_IOSHIFT		BPCSHIFT
+#define	BLKDEV_IOSIZE		(1<<BLKDEV_IOSHIFT)
+/* number of BB's per block device block */
+#define	BLKDEV_BB		BTOBB(BLKDEV_IOSIZE)
+
+/* bytes to clicks */
+#define	btoc(x)		(((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
+#define	btoct(x)	((__psunsigned_t)(x)>>BPCSHIFT)
+#define	btoc64(x)	(((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT)
+#define	btoct64(x)	((__uint64_t)(x)>>BPCSHIFT)
+#define	io_btoc(x)	(((__psunsigned_t)(x)+(IO_NBPC-1))>>IO_BPCSHIFT)
+#define	io_btoct(x)	((__psunsigned_t)(x)>>IO_BPCSHIFT)
+
+/* off_t bytes to clicks */
+#define offtoc(x)       (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT)
+#define offtoct(x)      ((xfs_off_t)(x)>>BPCSHIFT)
+
+/* clicks to off_t bytes */
+#define	ctooff(x)	((xfs_off_t)(x)<<BPCSHIFT)
+
+/* clicks to bytes */
+#define	ctob(x)		((__psunsigned_t)(x)<<BPCSHIFT)
+#define btoct(x)        ((__psunsigned_t)(x)>>BPCSHIFT)
+#define	ctob64(x)	((__uint64_t)(x)<<BPCSHIFT)
+#define	io_ctob(x)	((__psunsigned_t)(x)<<IO_BPCSHIFT)
+
+/* bytes to clicks */
+#define btoc(x)         (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
+
+#ifndef CELL_CAPABLE
+#define FSC_NOTIFY_NAME_CHANGED(vp)
+#endif
+
+#ifndef ENOATTR
+#define ENOATTR		ENODATA		/* Attribute not found */
+#endif
+
+/* Note: EWRONGFS never visible outside the kernel */
+#define	EWRONGFS	EINVAL		/* Mount with wrong filesystem type */
+
+/*
+ * XXX EFSCORRUPTED needs a real value in errno.h. asm-i386/errno.h won't
+ *     return codes out of its known range in errno.
+ * XXX Also note: needs to be < 1000 and fairly unique on Linux (mustn't
+ *     conflict with any code we use already or any code a driver may use)
+ * XXX Some options (currently we do #2):
+ *	1/ New error code ["Filesystem is corrupted", _after_ glibc updated]
+ *	2/ 990 ["Unknown error 990"]
+ *	3/ EUCLEAN ["Structure needs cleaning"]
+ *	4/ Convert EFSCORRUPTED to EIO [just prior to return into userspace]
+ */
+#define EFSCORRUPTED    990		/* Filesystem is corrupted */
+
+#define SYNCHRONIZE()	barrier()
+#define __return_address __builtin_return_address(0)
+
+/*
+ * IRIX (BSD) quotactl makes use of separate commands for user/group,
+ * whereas on Linux the syscall encodes this information into the cmd
+ * field (see the QCMD macro in quota.h).  These macros help keep the
+ * code portable - they are not visible from the syscall interface.
+ */
+#define Q_XSETGQLIM	XQM_CMD(0x8)	/* set groups disk limits */
+#define Q_XGETGQUOTA	XQM_CMD(0x9)	/* get groups disk limits */
+
+/* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */
+/* we may well need to fine-tune this if it ever becomes an issue.  */
+#define DQUOT_MAX_HEURISTIC	1024	/* NR_DQUOTS */
+#define ndquot			DQUOT_MAX_HEURISTIC
+
+/* IRIX uses the current size of the name cache to guess a good value */
+/* - this isn't the same but is a good enough starting point for now. */
+#define DQUOT_HASH_HEURISTIC	files_stat.nr_files
+
+/* IRIX inodes maintain the project ID also, zero this field on Linux */
+#define DEFAULT_PROJID	0
+#define dfltprid	DEFAULT_PROJID
+
+#define MAXPATHLEN	1024
+
+#define MIN(a,b)	(min(a,b))
+#define MAX(a,b)	(max(a,b))
+#define howmany(x, y)	(((x)+((y)-1))/(y))
+#define roundup(x, y)	((((x)+((y)-1))/(y))*(y))
+
+#define xfs_stack_trace()	dump_stack()
+
+#define xfs_itruncate_data(ip, off)	\
+	(-vmtruncate(LINVFS_GET_IP(XFS_ITOV(ip)), (off)))
+
+
+/* Move the kernel do_div definition off to one side */
+
+#if defined __i386__
+/* For ia32 we need to pull some tricks to get past various versions
+ * of the compiler which do not like us using do_div in the middle
+ * of large functions.
+ */
+static inline __u32 xfs_do_div(void *a, __u32 b, int n)
+{
+	__u32	mod;
+
+	switch (n) {
+		case 4:
+			mod = *(__u32 *)a % b;
+			*(__u32 *)a = *(__u32 *)a / b;
+			return mod;
+		case 8:
+			{
+			unsigned long __upper, __low, __high, __mod;
+			__u64	c = *(__u64 *)a;
+			__upper = __high = c >> 32;
+			__low = c;
+			if (__high) {
+				__upper = __high % (b);
+				__high = __high / (b);
+			}
+			asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (b), "0" (__low), "1" (__upper));
+			asm("":"=A" (c):"a" (__low),"d" (__high));
+			*(__u64 *)a = c;
+			return __mod;
+			}
+	}
+
+	/* NOTREACHED */
+	return 0;
+}
+
+/* Side effect free 64 bit mod operation */
+static inline __u32 xfs_do_mod(void *a, __u32 b, int n)
+{
+	switch (n) {
+		case 4:
+			return *(__u32 *)a % b;
+		case 8:
+			{
+			unsigned long __upper, __low, __high, __mod;
+			__u64	c = *(__u64 *)a;
+			__upper = __high = c >> 32;
+			__low = c;
+			if (__high) {
+				__upper = __high % (b);
+				__high = __high / (b);
+			}
+			asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (b), "0" (__low), "1" (__upper));
+			asm("":"=A" (c):"a" (__low),"d" (__high));
+			return __mod;
+			}
+	}
+
+	/* NOTREACHED */
+	return 0;
+}
+#else
+static inline __u32 xfs_do_div(void *a, __u32 b, int n)
+{
+	__u32	mod;
+
+	switch (n) {
+		case 4:
+			mod = *(__u32 *)a % b;
+			*(__u32 *)a = *(__u32 *)a / b;
+			return mod;
+		case 8:
+			mod = do_div(*(__u64 *)a, b);
+			return mod;
+	}
+
+	/* NOTREACHED */
+	return 0;
+}
+
+/* Side effect free 64 bit mod operation */
+static inline __u32 xfs_do_mod(void *a, __u32 b, int n)
+{
+	switch (n) {
+		case 4:
+			return *(__u32 *)a % b;
+		case 8:
+			{
+			__u64	c = *(__u64 *)a;
+			return do_div(c, b);
+			}
+	}
+
+	/* NOTREACHED */
+	return 0;
+}
+#endif
+
+#undef do_div
+#define do_div(a, b)	xfs_do_div(&(a), (b), sizeof(a))
+#define do_mod(a, b)	xfs_do_mod(&(a), (b), sizeof(a))
+
+static inline __uint64_t roundup_64(__uint64_t x, __uint32_t y)
+{
+	x += y - 1;
+	do_div(x, y);
+	return(x * y);
+}
+
+#endif /* __XFS_LINUX__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_lrw.c	Tue Jun 15 22:20:35 2004
@@ -0,0 +1,1028 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+/*
+ *  fs/xfs/linux/xfs_lrw.c (Linux Read Write stuff)
+ *
+ */
+
+#include "xfs.h"
+
+#include "xfs_fs.h"
+#include "xfs_inum.h"
+#include "xfs_log.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
+#include "xfs_ag.h"
+#include "xfs_dir.h"
+#include "xfs_dir2.h"
+#include "xfs_alloc.h"
+#include "xfs_dmapi.h"
+#include "xfs_quota.h"
+#include "xfs_mount.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_btree.h"
+#include "xfs_ialloc.h"
+#include "xfs_attr_sf.h"
+#include "xfs_dir_sf.h"
+#include "xfs_dir2_sf.h"
+#include "xfs_dinode.h"
+#include "xfs_inode.h"
+#include "xfs_bmap.h"
+#include "xfs_bit.h"
+#include "xfs_rtalloc.h"
+#include "xfs_error.h"
+#include "xfs_itable.h"
+#include "xfs_rw.h"
+#include "xfs_acl.h"
+#include "xfs_cap.h"
+#include "xfs_mac.h"
+#include "xfs_attr.h"
+#include "xfs_inode_item.h"
+#include "xfs_buf_item.h"
+#include "xfs_utils.h"
+#include "xfs_iomap.h"
+
+#include <linux/capability.h>
+
+
+#if defined(XFS_RW_TRACE)
+void
+xfs_rw_enter_trace(
+	int			tag,
+	xfs_iocore_t		*io,
+	const struct iovec	*iovp,
+	size_t			segs,
+	loff_t			offset,
+	int			ioflags)
+{
+	xfs_inode_t	*ip = XFS_IO_INODE(io);
+
+	if (ip->i_rwtrace == NULL)
+		return;
+	ktrace_enter(ip->i_rwtrace,
+		(void *)(unsigned long)tag,
+		(void *)ip,
+		(void *)((unsigned long)((ip->i_d.di_size >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(ip->i_d.di_size & 0xffffffff)),
+		(void *)(__psint_t)iovp,
+		(void *)((unsigned long)segs),
+		(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(offset & 0xffffffff)),
+		(void *)((unsigned long)ioflags),
+		(void *)((unsigned long)((io->io_new_size >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(io->io_new_size & 0xffffffff)),
+		(void *)NULL,
+		(void *)NULL,
+		(void *)NULL,
+		(void *)NULL,
+		(void *)NULL);
+}
+
+void
+xfs_inval_cached_trace(
+	xfs_iocore_t	*io,
+	xfs_off_t	offset,
+	xfs_off_t	len,
+	xfs_off_t	first,
+	xfs_off_t	last)
+{
+	xfs_inode_t	*ip = XFS_IO_INODE(io);
+
+	if (ip->i_rwtrace == NULL)
+		return;
+	ktrace_enter(ip->i_rwtrace,
+		(void *)(__psint_t)XFS_INVAL_CACHED,
+		(void *)ip,
+		(void *)((unsigned long)((offset >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(offset & 0xffffffff)),
+		(void *)((unsigned long)((len >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(len & 0xffffffff)),
+		(void *)((unsigned long)((first >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(first & 0xffffffff)),
+		(void *)((unsigned long)((last >> 32) & 0xffffffff)),
+		(void *)((unsigned long)(last & 0xffffffff)),
+		(void *)NULL,
+		(void *)NULL,
+		(void *)NULL,
+		(void *)NULL,
+		(void *)NULL,
+		(void *)NULL);
+}
+#endif
+
+/*
+ *	xfs_iozero
+ *
+ *	xfs_iozero clears the specified range of buffer supplied,
+ *	and marks all the affected blocks as valid and modified.  If
+ *	an affected block is not allocated, it will be allocated.  If
+ *	an affected block is not completely overwritten, and is not
+ *	valid before the operation, it will be read from disk before
+ *	being partially zeroed.
+ */
+STATIC int
+xfs_iozero(
+	struct inode		*ip,	/* inode			*/
+	loff_t			pos,	/* offset in file		*/
+	size_t			count,	/* size of data to zero		*/
+	loff_t			end_size)	/* max file size to set */
+{
+	unsigned		bytes;
+	struct page		*page;
+	struct address_space	*mapping;
+	char			*kaddr;
+	int			status;
+
+	mapping = ip->i_mapping;
+	do {
+		unsigned long index, offset;
+
+		offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
+		index = pos >> PAGE_CACHE_SHIFT;
+		bytes = PAGE_CACHE_SIZE - offset;
+		if (bytes > count)
+			bytes = count;
+
+		status = -ENOMEM;
+		page = grab_cache_page(mapping, index);
+		if (!page)
+			break;
+
+		kaddr = kmap(page);
+		status = mapping->a_ops->prepare_write(NULL, page, offset,
+							offset + bytes);
+		if (status) {
+			goto unlock;
+		}
+
+		memset((void *) (kaddr + offset), 0, bytes);
+		flush_dcache_page(page);
+		status = mapping->a_ops->commit_write(NULL, page, offset,
+							offset + bytes);
+		if (!status) {
+			pos += bytes;
+			count -= bytes;
+			if (pos > i_size_read(ip))
+				i_size_write(ip, pos < end_size ? pos : end_size);
+		}
+
+unlock:
+		kunmap(page);
+		unlock_page(page);
+		page_cache_release(page);
+		if (status)
+			break;
+	} while (count);
+
+	return (-status);
+}
+
+/*
+ * xfs_inval_cached_pages
+ * 
+ * This routine is responsible for keeping direct I/O and buffered I/O
+ * somewhat coherent.  From here we make sure that we're at least
+ * temporarily holding the inode I/O lock exclusively and then call
+ * the page cache to flush and invalidate any cached pages.  If there
+ * are no cached pages this routine will be very quick.
+ */
+void
+xfs_inval_cached_pages(
+	vnode_t		*vp,
+	xfs_iocore_t	*io,
+	xfs_off_t	offset,
+	int		write,
+	int		relock)
+{
+	xfs_mount_t	*mp;
+
+	if (!VN_CACHED(vp)) {
+		return;
+	}
+
+	mp = io->io_mount;
+
+	/*
+	 * We need to get the I/O lock exclusively in order
+	 * to safely invalidate pages and mappings.
+	 */
+	if (relock) {
+		XFS_IUNLOCK(mp, io, XFS_IOLOCK_SHARED);
+		XFS_ILOCK(mp, io, XFS_IOLOCK_EXCL);
+	}
+
+	/* Writing beyond EOF creates a hole that must be zeroed */
+	if (write && (offset > XFS_SIZE(mp, io))) {
+		xfs_fsize_t	isize;
+
+		XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
+		isize = XFS_SIZE(mp, io);
+		if (offset > isize) {
+			xfs_zero_eof(vp, io, offset, isize, offset);
+		}
+		XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
+	}
+
+	xfs_inval_cached_trace(io, offset, -1, ctooff(offtoct(offset)), -1);
+	VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED);
+	if (relock) {
+		XFS_ILOCK_DEMOTE(mp, io, XFS_IOLOCK_EXCL);
+	}
+}
+
+ssize_t			/* bytes read, or (-)  error */
+xfs_read(
+	bhv_desc_t		*bdp,
+	struct kiocb		*iocb,
+	const struct iovec	*iovp,
+	unsigned int		segs,
+	loff_t			*offset,
+	int			ioflags,
+	cred_t			*credp)
+{
+	struct file		*file = iocb->ki_filp;
+	size_t			size = 0;
+	ssize_t			ret;
+	xfs_fsize_t		n;
+	xfs_inode_t		*ip;
+	xfs_mount_t		*mp;
+	vnode_t			*vp;
+	unsigned long		seg;
+
+	ip = XFS_BHVTOI(bdp);
+	vp = BHV_TO_VNODE(bdp);
+	mp = ip->i_mount;
+
+	XFS_STATS_INC(xs_read_calls);
+
+	/* START copy & waste from filemap.c */
+	for (seg = 0; seg < segs; seg++) {
+		const struct iovec *iv = &iovp[seg];
+
+		/*
+		 * If any segment has a negative length, or the cumulative
+		 * length ever wraps negative then return -EINVAL.
+		 */
+		size += iv->iov_len;
+		if (unlikely((ssize_t)(size|iv->iov_len) < 0))
+			return XFS_ERROR(-EINVAL);
+	}
+	/* END copy & waste from filemap.c */
+
+	if (ioflags & IO_ISDIRECT) {
+		xfs_buftarg_t	*target =
+			(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
+				mp->m_rtdev_targp : mp->m_ddev_targp;
+		if ((*offset & target->pbr_smask) ||
+		    (size & target->pbr_smask)) {
+			if (*offset == ip->i_d.di_size) {
+				return (0);
+			}
+			return -XFS_ERROR(EINVAL);
+		}
+	}
+
+	n = XFS_MAXIOFFSET(mp) - *offset;
+	if ((n <= 0) || (size == 0))
+		return 0;
+
+	if (n < size)
+		size = n;
+
+	if (XFS_FORCED_SHUTDOWN(mp)) {
+		return -EIO;
+	}
+
+	/* OK so we are holding the I/O lock for the duration
+	 * of the submission, then what happens if the I/O
+	 * does not really happen here, but is scheduled 
+	 * later?
+	 */
+	xfs_ilock(ip, XFS_IOLOCK_SHARED);
+
+	if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
+	    !(ioflags & IO_INVIS)) {
+		vrwlock_t locktype = VRWLOCK_READ;
+
+		ret = XFS_SEND_DATA(mp, DM_EVENT_READ,
+					BHV_TO_VNODE(bdp), *offset, size,
+					FILP_DELAY_FLAG(file), &locktype);
+		if (ret) {
+			xfs_iunlock(ip, XFS_IOLOCK_SHARED);
+			return -ret;
+		}
+	}
+
+	xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore,
+				iovp, segs, *offset, ioflags);
+	ret = __generic_file_aio_read(iocb, iovp, segs, offset);
+	xfs_iunlock(ip, XFS_IOLOCK_SHARED);
+
+	if (ret > 0)
+		XFS_STATS_ADD(xs_read_bytes, ret);
+
+	if (likely(!(ioflags & IO_INVIS)))
+		xfs_ichgtime(ip, XFS_ICHGTIME_ACC);
+
+	return ret;
+}
+
+ssize_t
+xfs_sendfile(
+	bhv_desc_t		*bdp,
+	struct file		*filp,
+	loff_t			*offset,
+	int			ioflags,
+	size_t			count,
+	read_actor_t		actor,
+	void			*target,
+	cred_t			*credp)
+{
+	ssize_t			ret;
+	xfs_fsize_t		n;
+	xfs_inode_t		*ip;
+	xfs_mount_t		*mp;
+	vnode_t			*vp;
+
+	ip = XFS_BHVTOI(bdp);
+	vp = BHV_TO_VNODE(bdp);
+	mp = ip->i_mount;
+
+	XFS_STATS_INC(xs_read_calls);
+
+	n = XFS_MAXIOFFSET(mp) - *offset;
+	if ((n <= 0) || (count == 0))
+		return 0;
+
+	if (n < count)
+		count = n;
+
+	if (XFS_FORCED_SHUTDOWN(ip->i_mount))
+		return -EIO;
+
+	xfs_ilock(ip, XFS_IOLOCK_SHARED);
+
+	if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
+	    (!(ioflags & IO_INVIS))) {
+		vrwlock_t locktype = VRWLOCK_READ;
+		int error;
+
+		error = XFS_SEND_DATA(mp, DM_EVENT_READ, BHV_TO_VNODE(bdp), *offset, count,
+				      FILP_DELAY_FLAG(filp), &locktype);
+		if (error) {
+			xfs_iunlock(ip, XFS_IOLOCK_SHARED);
+			return -error;
+		}
+	}
+	xfs_rw_enter_trace(XFS_SENDFILE_ENTER, &ip->i_iocore,
+				target, count, *offset, ioflags);
+	ret = generic_file_sendfile(filp, offset, count, actor, target);
+	xfs_iunlock(ip, XFS_IOLOCK_SHARED);
+
+	XFS_STATS_ADD(xs_read_bytes, ret);
+	xfs_ichgtime(ip, XFS_ICHGTIME_ACC);
+	return ret;
+}
+
+/*
+ * This routine is called to handle zeroing any space in the last
+ * block of the file that is beyond the EOF.  We do this since the
+ * size is being increased without writing anything to that block
+ * and we don't want anyone to read the garbage on the disk.
+ */
+STATIC int				/* error (positive) */
+xfs_zero_last_block(
+	struct inode	*ip,
+	xfs_iocore_t	*io,
+	xfs_off_t	offset,
+	xfs_fsize_t	isize,
+	xfs_fsize_t	end_size)
+{
+	xfs_fileoff_t	last_fsb;
+	xfs_mount_t	*mp;
+	int		nimaps;
+	int		zero_offset;
+	int		zero_len;
+	int		isize_fsb_offset;
+	int		error = 0;
+	xfs_bmbt_irec_t	imap;
+	loff_t		loff;
+	size_t		lsize;
+
+	ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0);
+	ASSERT(offset > isize);
+
+	mp = io->io_mount;
+
+	isize_fsb_offset = XFS_B_FSB_OFFSET(mp, isize);
+	if (isize_fsb_offset == 0) {
+		/*
+		 * There are no extra bytes in the last block on disk to
+		 * zero, so return.
+		 */
+		return 0;
+	}
+
+	last_fsb = XFS_B_TO_FSBT(mp, isize);
+	nimaps = 1;
+	error = XFS_BMAPI(mp, NULL, io, last_fsb, 1, 0, NULL, 0, &imap,
+			  &nimaps, NULL);
+	if (error) {
+		return error;
+	}
+	ASSERT(nimaps > 0);
+	/*
+	 * If the block underlying isize is just a hole, then there
+	 * is nothing to zero.
+	 */
+	if (imap.br_startblock == HOLESTARTBLOCK) {
+		return 0;
+	}
+	/*
+	 * Zero the part of the last block beyond the EOF, and write it
+	 * out sync.  We need to drop the ilock while we do this so we
+	 * don't deadlock when the buffer cache calls back to us.
+	 */
+	XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD);
+	loff = XFS_FSB_TO_B(mp, last_fsb);
+	lsize = XFS_FSB_TO_B(mp, 1);
+
+	zero_offset = isize_fsb_offset;
+	zero_len = mp->m_sb.sb_blocksize - isize_fsb_offset;
+
+	error = xfs_iozero(ip, loff + zero_offset, zero_len, end_size);
+
+	XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
+	ASSERT(error >= 0);
+	return error;
+}
+
+/*
+ * Zero any on disk space between the current EOF and the new,
+ * larger EOF.  This handles the normal case of zeroing the remainder
+ * of the last block in the file and the unusual case of zeroing blocks
+ * out beyond the size of the file.  This second case only happens
+ * with fixed size extents and when the system crashes before the inode
+ * size was updated but after blocks were allocated.  If fill is set,
+ * then any holes in the range are filled and zeroed.  If not, the holes
+ * are left alone as holes.
+ */
+
+int					/* error (positive) */
+xfs_zero_eof(
+	vnode_t		*vp,
+	xfs_iocore_t	*io,
+	xfs_off_t	offset,		/* starting I/O offset */
+	xfs_fsize_t	isize,		/* current inode size */
+	xfs_fsize_t	end_size)	/* terminal inode size */
+{
+	struct inode	*ip = LINVFS_GET_IP(vp);
+	xfs_fileoff_t	start_zero_fsb;
+	xfs_fileoff_t	end_zero_fsb;
+	xfs_fileoff_t	prev_zero_fsb;
+	xfs_fileoff_t	zero_count_fsb;
+	xfs_fileoff_t	last_fsb;
+	xfs_extlen_t	buf_len_fsb;
+	xfs_extlen_t	prev_zero_count;
+	xfs_mount_t	*mp;
+	int		nimaps;
+	int		error = 0;
+	xfs_bmbt_irec_t	imap;
+	loff_t		loff;
+	size_t		lsize;
+
+	ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
+	ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
+
+	mp = io->io_mount;
+
+	/*
+	 * First handle zeroing the block on which isize resides.
+	 * We only zero a part of that block so it is handled specially.
+	 */
+	error = xfs_zero_last_block(ip, io, offset, isize, end_size);
+	if (error) {
+		ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
+		ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
+		return error;
+	}
+
+	/*
+	 * Calculate the range between the new size and the old
+	 * where blocks needing to be zeroed may exist.  To get the
+	 * block where the last byte in the file currently resides,
+	 * we need to subtract one from the size and truncate back
+	 * to a block boundary.  We subtract 1 in case the size is
+	 * exactly on a block boundary.
+	 */
+	last_fsb = isize ? XFS_B_TO_FSBT(mp, isize - 1) : (xfs_fileoff_t)-1;
+	start_zero_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)isize);
+	end_zero_fsb = XFS_B_TO_FSBT(mp, offset - 1);
+	ASSERT((xfs_sfiloff_t)last_fsb < (xfs_sfiloff_t)start_zero_fsb);
+	if (last_fsb == end_zero_fsb) {
+		/*
+		 * The size was only incremented on its last block.
+		 * We took care of that above, so just return.
+		 */
+		return 0;
+	}
+
+	ASSERT(start_zero_fsb <= end_zero_fsb);
+	prev_zero_fsb = NULLFILEOFF;
+	prev_zero_count = 0;
+	while (start_zero_fsb <= end_zero_fsb) {
+		nimaps = 1;
+		zero_count_fsb = end_zero_fsb - start_zero_fsb + 1;
+		error = XFS_BMAPI(mp, NULL, io, start_zero_fsb, zero_count_fsb,
+				  0, NULL, 0, &imap, &nimaps, NULL);
+		if (error) {
+			ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
+			ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
+			return error;
+		}
+		ASSERT(nimaps > 0);
+
+		if (imap.br_state == XFS_EXT_UNWRITTEN ||
+		    imap.br_startblock == HOLESTARTBLOCK) {
+			/*
+			 * This loop handles initializing pages that were
+			 * partially initialized by the code below this
+			 * loop. It basically zeroes the part of the page
+			 * that sits on a hole and sets the page as P_HOLE
+			 * and calls remapf if it is a mapped file.
+			 */
+			prev_zero_fsb = NULLFILEOFF;
+			prev_zero_count = 0;
+			start_zero_fsb = imap.br_startoff +
+					 imap.br_blockcount;
+			ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
+			continue;
+		}
+
+		/*
+		 * There are blocks in the range requested.
+		 * Zero them a single write at a time.  We actually
+		 * don't zero the entire range returned if it is
+		 * too big and simply loop around to get the rest.
+		 * That is not the most efficient thing to do, but it
+		 * is simple and this path should not be exercised often.
+		 */
+		buf_len_fsb = XFS_FILBLKS_MIN(imap.br_blockcount,
+					      mp->m_writeio_blocks << 8);
+		/*
+		 * Drop the inode lock while we're doing the I/O.
+		 * We'll still have the iolock to protect us.
+		 */
+		XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
+
+		loff = XFS_FSB_TO_B(mp, start_zero_fsb);
+		lsize = XFS_FSB_TO_B(mp, buf_len_fsb);
+
+		error = xfs_iozero(ip, loff, lsize, end_size);
+
+		if (error) {
+			goto out_lock;
+		}
+
+		prev_zero_fsb = start_zero_fsb;
+		prev_zero_count = buf_len_fsb;
+		start_zero_fsb = imap.br_startoff + buf_len_fsb;
+		ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
+
+		XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
+	}
+
+	return 0;
+
+out_lock:
+
+	XFS_ILOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
+	ASSERT(error >= 0);
+	return error;
+}
+
+ssize_t				/* bytes written, or (-) error */
+xfs_write(
+	bhv_desc_t		*bdp,
+	struct kiocb		*iocb,
+	const struct iovec	*iovp,
+	unsigned int		segs,
+	loff_t			*offset,
+	int			ioflags,
+	cred_t			*credp)
+{
+	struct file		*file = iocb->ki_filp;
+	size_t			size = 0;
+	xfs_inode_t		*xip;
+	xfs_mount_t		*mp;
+	ssize_t			ret;
+	int			error = 0;
+	xfs_fsize_t		isize, new_size;
+	xfs_fsize_t		n, limit;
+	xfs_iocore_t		*io;
+	vnode_t			*vp;
+	unsigned long		seg;
+	int			iolock;
+	int			eventsent = 0;
+	vrwlock_t		locktype;
+
+	XFS_STATS_INC(xs_write_calls);
+
+	vp = BHV_TO_VNODE(bdp);
+	xip = XFS_BHVTOI(bdp);
+
+	/* START copy & waste from filemap.c */
+	for (seg = 0; seg < segs; seg++) {
+		const struct iovec *iv = &iovp[seg];
+
+		/*
+		 * If any segment has a negative length, or the cumulative
+		 * length ever wraps negative then return -EINVAL.
+		 */
+		size += iv->iov_len;
+		if (unlikely((ssize_t)(size|iv->iov_len) < 0))
+			return XFS_ERROR(-EINVAL);
+	}
+	/* END copy & waste from filemap.c */
+
+	if (size == 0)
+		return 0;
+
+	io = &xip->i_iocore;
+	mp = io->io_mount;
+
+	if (XFS_FORCED_SHUTDOWN(mp)) {
+		return -EIO;
+	}
+
+	if (ioflags & IO_ISDIRECT) {
+		xfs_buftarg_t	*target =
+			(xip->i_d.di_flags & XFS_DIFLAG_REALTIME) ?
+				mp->m_rtdev_targp : mp->m_ddev_targp;
+
+		if ((*offset & target->pbr_smask) ||
+		    (size & target->pbr_smask)) {
+			return XFS_ERROR(-EINVAL);
+		}
+		iolock = XFS_IOLOCK_SHARED;
+		locktype = VRWLOCK_WRITE_DIRECT;
+	} else {
+		iolock = XFS_IOLOCK_EXCL;
+		locktype = VRWLOCK_WRITE;
+	}
+
+	xfs_ilock(xip, XFS_ILOCK_EXCL|iolock);
+
+	isize = xip->i_d.di_size;
+	limit = XFS_MAXIOFFSET(mp);
+
+	if (file->f_flags & O_APPEND)
+		*offset = isize;
+
+start:
+	n = limit - *offset;
+	if (n <= 0) {
+		xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
+		return -EFBIG;
+	}
+
+	if (n < size)
+		size = n;
+
+	new_size = *offset + size;
+	if (new_size > isize) {
+		io->io_new_size = new_size;
+	}
+
+	if ((DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_WRITE) &&
+	    !(ioflags & IO_INVIS) && !eventsent)) {
+		loff_t		savedsize = *offset;
+		int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags);
+
+		xfs_iunlock(xip, XFS_ILOCK_EXCL);
+		error = XFS_SEND_DATA(xip->i_mount, DM_EVENT_WRITE, vp,
+				      *offset, size,
+				      dmflags, &locktype);
+		if (error) {
+			xfs_iunlock(xip, iolock);
+			return -error;
+		}
+		xfs_ilock(xip, XFS_ILOCK_EXCL);
+		eventsent = 1;
+
+		/*
+		 * The iolock was dropped and reaquired in XFS_SEND_DATA
+		 * so we have to recheck the size when appending.
+		 * We will only "goto start;" once, since having sent the
+		 * event prevents another call to XFS_SEND_DATA, which is
+		 * what allows the size to change in the first place.
+		 */
+		if ((file->f_flags & O_APPEND) &&
+		    savedsize != xip->i_d.di_size) {
+			*offset = isize = xip->i_d.di_size;
+			goto start;
+		}
+	}
+
+	/*
+	 * On Linux, generic_file_write updates the times even if
+	 * no data is copied in so long as the write had a size.
+	 *
+	 * We must update xfs' times since revalidate will overcopy xfs.
+	 */
+	if (size && !(ioflags & IO_INVIS))
+		xfs_ichgtime(xip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
+
+	/*
+	 * If the offset is beyond the size of the file, we have a couple
+	 * of things to do. First, if there is already space allocated
+	 * we need to either create holes or zero the disk or ...
+	 *
+	 * If there is a page where the previous size lands, we need
+	 * to zero it out up to the new size.
+	 */
+
+	if (!(ioflags & IO_ISDIRECT) && (*offset > isize && isize)) {
+		error = xfs_zero_eof(BHV_TO_VNODE(bdp), io, *offset,
+			isize, *offset + size);
+		if (error) {
+			xfs_iunlock(xip, XFS_ILOCK_EXCL|iolock);
+			return(-error);
+		}
+	}
+	xfs_iunlock(xip, XFS_ILOCK_EXCL);
+
+	/*
+	 * If we're writing the file then make sure to clear the
+	 * setuid and setgid bits if the process is not being run
+	 * by root.  This keeps people from modifying setuid and
+	 * setgid binaries.
+	 */
+
+	if (((xip->i_d.di_mode & S_ISUID) ||
+	    ((xip->i_d.di_mode & (S_ISGID | S_IXGRP)) ==
+		(S_ISGID | S_IXGRP))) &&
+	     !capable(CAP_FSETID)) {
+		error = xfs_write_clear_setuid(xip);
+		if (error) {
+			xfs_iunlock(xip, iolock);
+			return -error;
+		}
+	}
+
+retry:
+	if (ioflags & IO_ISDIRECT) {
+		xfs_inval_cached_pages(vp, io, *offset, 1, 1);
+		xfs_rw_enter_trace(XFS_DIOWR_ENTER,
+				io, iovp, segs, *offset, ioflags);
+	} else {
+		xfs_rw_enter_trace(XFS_WRITE_ENTER,
+				io, iovp, segs, *offset, ioflags);
+	}
+	ret = generic_file_aio_write_nolock(iocb, iovp, segs, offset);
+
+	if ((ret == -ENOSPC) &&
+	    DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_NOSPACE) &&
+	    !(ioflags & IO_INVIS)) {
+
+		xfs_rwunlock(bdp, locktype);
+		error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
+				DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL,
+				0, 0, 0); /* Delay flag intentionally  unused */
+		if (error)
+			return -error;
+		xfs_rwlock(bdp, locktype);
+		*offset = xip->i_d.di_size;
+		goto retry;
+	}
+
+	if (*offset > xip->i_d.di_size) {
+		xfs_ilock(xip, XFS_ILOCK_EXCL);
+		if (*offset > xip->i_d.di_size) {
+			struct inode	*inode = LINVFS_GET_IP(vp);
+
+			xip->i_d.di_size = *offset;
+			i_size_write(inode, *offset);
+			xip->i_update_core = 1;
+			xip->i_update_size = 1;
+		}
+		xfs_iunlock(xip, XFS_ILOCK_EXCL);
+	}
+
+	if (ret <= 0) {
+		xfs_rwunlock(bdp, locktype);
+		return ret;
+	}
+
+	XFS_STATS_ADD(xs_write_bytes, ret);
+
+	/* Handle various SYNC-type writes */
+	if ((file->f_flags & O_SYNC) || IS_SYNC(file->f_dentry->d_inode)) {
+
+		/*
+		 * If we're treating this as O_DSYNC and we have not updated the
+		 * size, force the log.
+		 */
+
+		if (!(mp->m_flags & XFS_MOUNT_OSYNCISOSYNC)
+			&& !(xip->i_update_size)) {
+			/*
+			 * If an allocation transaction occurred
+			 * without extending the size, then we have to force
+			 * the log up the proper point to ensure that the
+			 * allocation is permanent.  We can't count on
+			 * the fact that buffered writes lock out direct I/O
+			 * writes - the direct I/O write could have extended
+			 * the size nontransactionally, then finished before
+			 * we started.  xfs_write_file will think that the file
+			 * didn't grow but the update isn't safe unless the
+			 * size change is logged.
+			 *
+			 * Force the log if we've committed a transaction
+			 * against the inode or if someone else has and
+			 * the commit record hasn't gone to disk (e.g.
+			 * the inode is pinned).  This guarantees that
+			 * all changes affecting the inode are permanent
+			 * when we return.
+			 */
+
+			xfs_inode_log_item_t *iip;
+			xfs_lsn_t lsn;
+
+			iip = xip->i_itemp;
+			if (iip && iip->ili_last_lsn) {
+				lsn = iip->ili_last_lsn;
+				xfs_log_force(mp, lsn,
+						XFS_LOG_FORCE | XFS_LOG_SYNC);
+			} else if (xfs_ipincount(xip) > 0) {
+				xfs_log_force(mp, (xfs_lsn_t)0,
+						XFS_LOG_FORCE | XFS_LOG_SYNC);
+			}
+
+		} else {
+			xfs_trans_t	*tp;
+
+			/*
+			 * O_SYNC or O_DSYNC _with_ a size update are handled
+			 * the same way.
+			 *
+			 * If the write was synchronous then we need to make
+			 * sure that the inode modification time is permanent.
+			 * We'll have updated the timestamp above, so here
+			 * we use a synchronous transaction to log the inode.
+			 * It's not fast, but it's necessary.
+			 *
+			 * If this a dsync write and the size got changed
+			 * non-transactionally, then we need to ensure that
+			 * the size change gets logged in a synchronous
+			 * transaction.
+			 */
+
+			tp = xfs_trans_alloc(mp, XFS_TRANS_WRITE_SYNC);
+			if ((error = xfs_trans_reserve(tp, 0,
+						      XFS_SWRITE_LOG_RES(mp),
+						      0, 0, 0))) {
+				/* Transaction reserve failed */
+				xfs_trans_cancel(tp, 0);
+			} else {
+				/* Transaction reserve successful */
+				xfs_ilock(xip, XFS_ILOCK_EXCL);
+				xfs_trans_ijoin(tp, xip, XFS_ILOCK_EXCL);
+				xfs_trans_ihold(tp, xip);
+				xfs_trans_log_inode(tp, xip, XFS_ILOG_CORE);
+				xfs_trans_set_sync(tp);
+				error = xfs_trans_commit(tp, 0, NULL);
+				xfs_iunlock(xip, XFS_ILOCK_EXCL);
+			}
+		}
+	} /* (ioflags & O_SYNC) */
+
+	xfs_rwunlock(bdp, locktype);
+	return(ret);
+}
+
+/*
+ * All xfs metadata buffers except log state machine buffers
+ * get this attached as their b_bdstrat callback function.
+ * This is so that we can catch a buffer
+ * after prematurely unpinning it to forcibly shutdown the filesystem.
+ */
+int
+xfs_bdstrat_cb(struct xfs_buf *bp)
+{
+	xfs_mount_t	*mp;
+
+	mp = XFS_BUF_FSPRIVATE3(bp, xfs_mount_t *);
+	if (!XFS_FORCED_SHUTDOWN(mp)) {
+		pagebuf_iorequest(bp);
+		return 0;
+	} else {
+		xfs_buftrace("XFS__BDSTRAT IOERROR", bp);
+		/*
+		 * Metadata write that didn't get logged but
+		 * written delayed anyway. These aren't associated
+		 * with a transaction, and can be ignored.
+		 */
+		if (XFS_BUF_IODONE_FUNC(bp) == NULL &&
+		    (XFS_BUF_ISREAD(bp)) == 0)
+			return (xfs_bioerror_relse(bp));
+		else
+			return (xfs_bioerror(bp));
+	}
+}
+
+
+int
+xfs_bmap(bhv_desc_t	*bdp,
+	xfs_off_t	offset,
+	ssize_t		count,
+	int		flags,
+	xfs_iomap_t	*iomapp,
+	int		*niomaps)
+{
+	xfs_inode_t	*ip = XFS_BHVTOI(bdp);
+	xfs_iocore_t	*io = &ip->i_iocore;
+
+	ASSERT((ip->i_d.di_mode & S_IFMT) == S_IFREG);
+	ASSERT(((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != 0) ==
+	       ((ip->i_iocore.io_flags & XFS_IOCORE_RT) != 0));
+
+	return xfs_iomap(io, offset, count, flags, iomapp, niomaps);
+}
+
+/*
+ * Wrapper around bdstrat so that we can stop data
+ * from going to disk in case we are shutting down the filesystem.
+ * Typically user data goes thru this path; one of the exceptions
+ * is the superblock.
+ */
+int
+xfsbdstrat(
+	struct xfs_mount	*mp,
+	struct xfs_buf		*bp)
+{
+	ASSERT(mp);
+	if (!XFS_FORCED_SHUTDOWN(mp)) {
+		/* Grio redirection would go here
+		 * if (XFS_BUF_IS_GRIO(bp)) {
+		 */
+
+		pagebuf_iorequest(bp);
+		return 0;
+	}
+
+	xfs_buftrace("XFSBDSTRAT IOERROR", bp);
+	return (xfs_bioerror_relse(bp));
+}
+
+/*
+ * If the underlying (data/log/rt) device is readonly, there are some
+ * operations that cannot proceed.
+ */
+int
+xfs_dev_is_read_only(
+	xfs_mount_t		*mp,
+	char			*message)
+{
+	if (xfs_readonly_buftarg(mp->m_ddev_targp) ||
+	    xfs_readonly_buftarg(mp->m_logdev_targp) ||
+	    (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) {
+		cmn_err(CE_NOTE,
+			"XFS: %s required on read-only device.", message);
+		cmn_err(CE_NOTE,
+			"XFS: write access unavailable, cannot proceed.");
+		return EROFS;
+	}
+	return 0;
+}
diff -Nru a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_lrw.h	Tue Jun 15 22:20:36 2004
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_LRW_H__
+#define __XFS_LRW_H__
+
+struct vnode;
+struct bhv_desc;
+struct xfs_mount;
+struct xfs_iocore;
+struct xfs_inode;
+struct xfs_bmbt_irec;
+struct xfs_buf;
+struct xfs_iomap;
+
+#if defined(XFS_RW_TRACE)
+/*
+ * Defines for the trace mechanisms in xfs_lrw.c.
+ */
+#define	XFS_RW_KTRACE_SIZE	128
+
+#define	XFS_READ_ENTER		1
+#define	XFS_WRITE_ENTER		2
+#define XFS_IOMAP_READ_ENTER	3
+#define	XFS_IOMAP_WRITE_ENTER	4
+#define	XFS_IOMAP_READ_MAP	5
+#define	XFS_IOMAP_WRITE_MAP	6
+#define	XFS_IOMAP_WRITE_NOSPACE	7
+#define	XFS_ITRUNC_START	8
+#define	XFS_ITRUNC_FINISH1	9
+#define	XFS_ITRUNC_FINISH2	10
+#define	XFS_CTRUNC1		11
+#define	XFS_CTRUNC2		12
+#define	XFS_CTRUNC3		13
+#define	XFS_CTRUNC4		14
+#define	XFS_CTRUNC5		15
+#define	XFS_CTRUNC6		16
+#define	XFS_BUNMAPI		17
+#define	XFS_INVAL_CACHED	18
+#define	XFS_DIORD_ENTER		19
+#define	XFS_DIOWR_ENTER		20
+#define	XFS_SENDFILE_ENTER	21
+#define	XFS_WRITEPAGE_ENTER	22
+#define	XFS_RELEASEPAGE_ENTER	23
+#define	XFS_IOMAP_ALLOC_ENTER	24
+#define	XFS_IOMAP_ALLOC_MAP	25
+#define	XFS_IOMAP_UNWRITTEN	26
+extern void xfs_rw_enter_trace(int, struct xfs_iocore *,
+			const struct iovec *, size_t, loff_t, int);
+extern void xfs_inval_cached_trace(struct xfs_iocore *,
+			xfs_off_t, xfs_off_t, xfs_off_t, xfs_off_t);
+#else
+#define xfs_rw_enter_trace(tag, io, iovec, segs, offset, ioflags)
+#define xfs_inval_cached_trace(io, offset, len, first, last)
+#endif
+
+/*
+ * Maximum count of bmaps used by read and write paths.
+ */
+#define	XFS_MAX_RW_NBMAPS	4
+
+extern int xfs_bmap(struct bhv_desc *, xfs_off_t, ssize_t, int,
+			struct xfs_iomap *, int *);
+extern int xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
+extern int xfs_bdstrat_cb(struct xfs_buf *);
+
+extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t,
+				xfs_fsize_t, xfs_fsize_t);
+extern void xfs_inval_cached_pages(struct vnode	*, struct xfs_iocore *,
+				xfs_off_t, int, int);
+extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *,
+				const struct iovec *, unsigned int,
+				loff_t *, int, struct cred *);
+extern ssize_t xfs_write(struct bhv_desc *, struct kiocb *,
+				const struct iovec *, unsigned int,
+				loff_t *, int, struct cred *);
+extern ssize_t xfs_sendfile(struct bhv_desc *, struct file *,
+				loff_t *, int, size_t, read_actor_t,
+				void *, struct cred *);
+
+extern int xfs_dev_is_read_only(struct xfs_mount *, char *);
+
+#define XFS_FSB_TO_DB_IO(io,fsb) \
+		(((io)->io_flags & XFS_IOCORE_RT) ? \
+		 XFS_FSB_TO_BB((io)->io_mount, (fsb)) : \
+		 XFS_FSB_TO_DADDR((io)->io_mount, (fsb)))
+
+#endif	/* __XFS_LRW_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_stats.c b/fs/xfs/linux-2.6/xfs_stats.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_stats.c	Tue Jun 15 22:21:02 2004
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+#include <linux/proc_fs.h>
+
+DEFINE_PER_CPU(struct xfsstats, xfsstats);
+
+STATIC int
+xfs_read_xfsstats(
+	char		*buffer,
+	char		**start,
+	off_t		offset,
+	int		count,
+	int		*eof,
+	void		*data)
+{
+	int		c, i, j, len, val;
+	__uint64_t	xs_xstrat_bytes = 0;
+	__uint64_t	xs_write_bytes = 0;
+	__uint64_t	xs_read_bytes = 0;
+
+	static struct xstats_entry {
+		char	*desc;
+		int	endpoint;
+	} xstats[] = {
+		{ "extent_alloc",	XFSSTAT_END_EXTENT_ALLOC	},
+		{ "abt",		XFSSTAT_END_ALLOC_BTREE		},
+		{ "blk_map",		XFSSTAT_END_BLOCK_MAPPING	},
+		{ "bmbt",		XFSSTAT_END_BLOCK_MAP_BTREE	},
+		{ "dir",		XFSSTAT_END_DIRECTORY_OPS	},
+		{ "trans",		XFSSTAT_END_TRANSACTIONS	},
+		{ "ig",			XFSSTAT_END_INODE_OPS		},
+		{ "log",		XFSSTAT_END_LOG_OPS		},
+		{ "push_ail",		XFSSTAT_END_TAIL_PUSHING	},
+		{ "xstrat",		XFSSTAT_END_WRITE_CONVERT	},
+		{ "rw",			XFSSTAT_END_READ_WRITE_OPS	},
+		{ "attr",		XFSSTAT_END_ATTRIBUTE_OPS	},
+		{ "icluster",		XFSSTAT_END_INODE_CLUSTER	},
+		{ "vnodes",		XFSSTAT_END_VNODE_OPS		},
+		{ "buf",		XFSSTAT_END_BUF			},
+	};
+
+	/* Loop over all stats groups */
+	for (i=j=len = 0; i < sizeof(xstats)/sizeof(struct xstats_entry); i++) {
+		len += sprintf(buffer + len, xstats[i].desc);
+		/* inner loop does each group */
+		while (j < xstats[i].endpoint) {
+			val = 0;
+			/* sum over all cpus */
+			for (c = 0; c < NR_CPUS; c++) {
+				if (!cpu_possible(c)) continue;
+				val += *(((__u32*)&per_cpu(xfsstats, c) + j));
+			}
+			len += sprintf(buffer + len, " %u", val);
+			j++;
+		}
+		buffer[len++] = '\n';
+	}
+	/* extra precision counters */
+	for (i = 0; i < NR_CPUS; i++) {
+		if (!cpu_possible(i)) continue;
+		xs_xstrat_bytes += per_cpu(xfsstats, i).xs_xstrat_bytes;
+		xs_write_bytes += per_cpu(xfsstats, i).xs_write_bytes;
+		xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes;
+	}
+
+	len += sprintf(buffer + len, "xpc %Lu %Lu %Lu\n",
+			xs_xstrat_bytes, xs_write_bytes, xs_read_bytes);
+	len += sprintf(buffer + len, "debug %u\n",
+#if defined(DEBUG)
+		1);
+#else
+		0);
+#endif
+
+	if (offset >= len) {
+		*start = buffer;
+		*eof = 1;
+		return 0;
+	}
+	*start = buffer + offset;
+	if ((len -= offset) > count)
+		return count;
+	*eof = 1;
+
+	return len;
+}
+
+void
+xfs_init_procfs(void)
+{
+	if (!proc_mkdir("fs/xfs", 0))
+		return;
+	create_proc_read_entry("fs/xfs/stat", 0, 0, xfs_read_xfsstats, NULL);
+}
+
+void
+xfs_cleanup_procfs(void)
+{
+	remove_proc_entry("fs/xfs/stat", NULL);
+	remove_proc_entry("fs/xfs", NULL);
+}
diff -Nru a/fs/xfs/linux-2.6/xfs_stats.h b/fs/xfs/linux-2.6/xfs_stats.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_stats.h	Tue Jun 15 22:20:38 2004
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_STATS_H__
+#define __XFS_STATS_H__
+
+
+#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
+
+#include <linux/percpu.h>
+
+/*
+ * XFS global statistics
+ */
+struct xfsstats {
+# define XFSSTAT_END_EXTENT_ALLOC	4
+	__uint32_t		xs_allocx;
+	__uint32_t		xs_allocb;
+	__uint32_t		xs_freex;
+	__uint32_t		xs_freeb;
+# define XFSSTAT_END_ALLOC_BTREE	(XFSSTAT_END_EXTENT_ALLOC+4)
+	__uint32_t		xs_abt_lookup;
+	__uint32_t		xs_abt_compare;
+	__uint32_t		xs_abt_insrec;
+	__uint32_t		xs_abt_delrec;
+# define XFSSTAT_END_BLOCK_MAPPING	(XFSSTAT_END_ALLOC_BTREE+7)
+	__uint32_t		xs_blk_mapr;
+	__uint32_t		xs_blk_mapw;
+	__uint32_t		xs_blk_unmap;
+	__uint32_t		xs_add_exlist;
+	__uint32_t		xs_del_exlist;
+	__uint32_t		xs_look_exlist;
+	__uint32_t		xs_cmp_exlist;
+# define XFSSTAT_END_BLOCK_MAP_BTREE	(XFSSTAT_END_BLOCK_MAPPING+4)
+	__uint32_t		xs_bmbt_lookup;
+	__uint32_t		xs_bmbt_compare;
+	__uint32_t		xs_bmbt_insrec;
+	__uint32_t		xs_bmbt_delrec;
+# define XFSSTAT_END_DIRECTORY_OPS	(XFSSTAT_END_BLOCK_MAP_BTREE+4)
+	__uint32_t		xs_dir_lookup;
+	__uint32_t		xs_dir_create;
+	__uint32_t		xs_dir_remove;
+	__uint32_t		xs_dir_getdents;
+# define XFSSTAT_END_TRANSACTIONS	(XFSSTAT_END_DIRECTORY_OPS+3)
+	__uint32_t		xs_trans_sync;
+	__uint32_t		xs_trans_async;
+	__uint32_t		xs_trans_empty;
+# define XFSSTAT_END_INODE_OPS		(XFSSTAT_END_TRANSACTIONS+7)
+	__uint32_t		xs_ig_attempts;
+	__uint32_t		xs_ig_found;
+	__uint32_t		xs_ig_frecycle;
+	__uint32_t		xs_ig_missed;
+	__uint32_t		xs_ig_dup;
+	__uint32_t		xs_ig_reclaims;
+	__uint32_t		xs_ig_attrchg;
+# define XFSSTAT_END_LOG_OPS		(XFSSTAT_END_INODE_OPS+5)
+	__uint32_t		xs_log_writes;
+	__uint32_t		xs_log_blocks;
+	__uint32_t		xs_log_noiclogs;
+	__uint32_t		xs_log_force;
+	__uint32_t		xs_log_force_sleep;
+# define XFSSTAT_END_TAIL_PUSHING	(XFSSTAT_END_LOG_OPS+10)
+	__uint32_t		xs_try_logspace;
+	__uint32_t		xs_sleep_logspace;
+	__uint32_t		xs_push_ail;
+	__uint32_t		xs_push_ail_success;
+	__uint32_t		xs_push_ail_pushbuf;
+	__uint32_t		xs_push_ail_pinned;
+	__uint32_t		xs_push_ail_locked;
+	__uint32_t		xs_push_ail_flushing;
+	__uint32_t		xs_push_ail_restarts;
+	__uint32_t		xs_push_ail_flush;
+# define XFSSTAT_END_WRITE_CONVERT	(XFSSTAT_END_TAIL_PUSHING+2)
+	__uint32_t		xs_xstrat_quick;
+	__uint32_t		xs_xstrat_split;
+# define XFSSTAT_END_READ_WRITE_OPS	(XFSSTAT_END_WRITE_CONVERT+2)
+	__uint32_t		xs_write_calls;
+	__uint32_t		xs_read_calls;
+# define XFSSTAT_END_ATTRIBUTE_OPS	(XFSSTAT_END_READ_WRITE_OPS+4)
+	__uint32_t		xs_attr_get;
+	__uint32_t		xs_attr_set;
+	__uint32_t		xs_attr_remove;
+	__uint32_t		xs_attr_list;
+# define XFSSTAT_END_INODE_CLUSTER	(XFSSTAT_END_ATTRIBUTE_OPS+3)
+	__uint32_t		xs_iflush_count;
+	__uint32_t		xs_icluster_flushcnt;
+	__uint32_t		xs_icluster_flushinode;
+# define XFSSTAT_END_VNODE_OPS		(XFSSTAT_END_INODE_CLUSTER+8)
+	__uint32_t		vn_active;	/* # vnodes not on free lists */
+	__uint32_t		vn_alloc;	/* # times vn_alloc called */
+	__uint32_t		vn_get;		/* # times vn_get called */
+	__uint32_t		vn_hold;	/* # times vn_hold called */
+	__uint32_t		vn_rele;	/* # times vn_rele called */
+	__uint32_t		vn_reclaim;	/* # times vn_reclaim called */
+	__uint32_t		vn_remove;	/* # times vn_remove called */
+	__uint32_t		vn_free;	/* # times vn_free called */
+#define XFSSTAT_END_BUF			(XFSSTAT_END_VNODE_OPS+9)
+	__uint32_t		pb_get;
+	__uint32_t		pb_create;
+	__uint32_t		pb_get_locked;
+	__uint32_t		pb_get_locked_waited;
+	__uint32_t		pb_busy_locked;
+	__uint32_t		pb_miss_locked;
+	__uint32_t		pb_page_retries;
+	__uint32_t		pb_page_found;
+	__uint32_t		pb_get_read;
+/* Extra precision counters */
+	__uint64_t		xs_xstrat_bytes;
+	__uint64_t		xs_write_bytes;
+	__uint64_t		xs_read_bytes;
+};
+
+DECLARE_PER_CPU(struct xfsstats, xfsstats);
+
+/* We don't disable preempt, not too worried about poking the
+ * wrong cpu's stat for now */
+#define XFS_STATS_INC(count)		(__get_cpu_var(xfsstats).count++)
+#define XFS_STATS_DEC(count)		(__get_cpu_var(xfsstats).count--)
+#define XFS_STATS_ADD(count, inc)	(__get_cpu_var(xfsstats).count += (inc))
+
+extern void xfs_init_procfs(void);
+extern void xfs_cleanup_procfs(void);
+
+
+#else	/* !CONFIG_PROC_FS */
+
+# define XFS_STATS_INC(count)
+# define XFS_STATS_DEC(count)
+# define XFS_STATS_ADD(count, inc)
+
+static __inline void xfs_init_procfs(void) { };
+static __inline void xfs_cleanup_procfs(void) { };
+
+#endif	/* !CONFIG_PROC_FS */
+
+#endif /* __XFS_STATS_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_super.c	Tue Jun 15 22:21:02 2004
@@ -0,0 +1,873 @@
+/*
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+
+#include "xfs_inum.h"
+#include "xfs_log.h"
+#include "xfs_clnt.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
+#include "xfs_dir.h"
+#include "xfs_dir2.h"
+#include "xfs_alloc.h"
+#include "xfs_dmapi.h"
+#include "xfs_quota.h"
+#include "xfs_mount.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_btree.h"
+#include "xfs_ialloc.h"
+#include "xfs_attr_sf.h"
+#include "xfs_dir_sf.h"
+#include "xfs_dir2_sf.h"
+#include "xfs_dinode.h"
+#include "xfs_inode.h"
+#include "xfs_bmap.h"
+#include "xfs_bit.h"
+#include "xfs_rtalloc.h"
+#include "xfs_error.h"
+#include "xfs_itable.h"
+#include "xfs_rw.h"
+#include "xfs_acl.h"
+#include "xfs_cap.h"
+#include "xfs_mac.h"
+#include "xfs_attr.h"
+#include "xfs_buf_item.h"
+#include "xfs_utils.h"
+#include "xfs_version.h"
+
+#include <linux/namei.h>
+#include <linux/init.h>
+#include <linux/mount.h>
+#include <linux/suspend.h>
+#include <linux/writeback.h>
+
+STATIC struct quotactl_ops linvfs_qops;
+STATIC struct super_operations linvfs_sops;
+STATIC struct export_operations linvfs_export_ops;
+STATIC kmem_cache_t * linvfs_inode_cachep;
+
+STATIC struct xfs_mount_args *
+xfs_args_allocate(
+	struct super_block	*sb)
+{
+	struct xfs_mount_args	*args;
+
+	args = kmem_zalloc(sizeof(struct xfs_mount_args), KM_SLEEP);
+	args->logbufs = args->logbufsize = -1;
+	strncpy(args->fsname, sb->s_id, MAXNAMELEN);
+
+	/* Copy the already-parsed mount(2) flags we're interested in */
+	if (sb->s_flags & MS_NOATIME)
+		args->flags |= XFSMNT_NOATIME;
+
+	/* Default to 32 bit inodes on Linux all the time */
+	args->flags |= XFSMNT_32BITINODES;
+
+	return args;
+}
+
+__uint64_t
+xfs_max_file_offset(
+	unsigned int		blockshift)
+{
+	unsigned int		pagefactor = 1;
+	unsigned int		bitshift = BITS_PER_LONG - 1;
+
+	/* Figure out maximum filesize, on Linux this can depend on
+	 * the filesystem blocksize (on 32 bit platforms).
+	 * __block_prepare_write does this in an [unsigned] long...
+	 *      page->index << (PAGE_CACHE_SHIFT - bbits)
+	 * So, for page sized blocks (4K on 32 bit platforms),
+	 * this wraps at around 8Tb (hence MAX_LFS_FILESIZE which is
+	 *      (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
+	 * but for smaller blocksizes it is less (bbits = log2 bsize).
+	 * Note1: get_block_t takes a long (implicit cast from above)
+	 * Note2: The Large Block Device (LBD and HAVE_SECTOR_T) patch
+	 * can optionally convert the [unsigned] long from above into
+	 * an [unsigned] long long.
+	 */
+
+#if BITS_PER_LONG == 32
+# if defined(CONFIG_LBD)
+	ASSERT(sizeof(sector_t) == 8);
+	pagefactor = PAGE_CACHE_SIZE;
+	bitshift = BITS_PER_LONG;
+# else
+	pagefactor = PAGE_CACHE_SIZE >> (PAGE_CACHE_SHIFT - blockshift);
+# endif
+#endif
+
+	return (((__uint64_t)pagefactor) << bitshift) - 1;
+}
+
+STATIC __inline__ void
+xfs_set_inodeops(
+	struct inode		*inode)
+{
+	vnode_t			*vp = LINVFS_GET_VP(inode);
+
+	if (vp->v_type == VNON) {
+		make_bad_inode(inode);
+	} else if (S_ISREG(inode->i_mode)) {
+		inode->i_op = &linvfs_file_inode_operations;
+		inode->i_fop = &linvfs_file_operations;
+		inode->i_mapping->a_ops = &linvfs_aops;
+	} else if (S_ISDIR(inode->i_mode)) {
+		inode->i_op = &linvfs_dir_inode_operations;
+		inode->i_fop = &linvfs_dir_operations;
+	} else if (S_ISLNK(inode->i_mode)) {
+		inode->i_op = &linvfs_symlink_inode_operations;
+		if (inode->i_blocks)
+			inode->i_mapping->a_ops = &linvfs_aops;
+	} else {
+		inode->i_op = &linvfs_file_inode_operations;
+		init_special_inode(inode, inode->i_mode, inode->i_rdev);
+	}
+}
+
+STATIC __inline__ void
+xfs_revalidate_inode(
+	xfs_mount_t		*mp,
+	vnode_t			*vp,
+	xfs_inode_t		*ip)
+{
+	struct inode		*inode = LINVFS_GET_IP(vp);
+
+	inode->i_mode	= (ip->i_d.di_mode & MODEMASK) | VTTOIF(vp->v_type);
+	inode->i_nlink	= ip->i_d.di_nlink;
+	inode->i_uid	= ip->i_d.di_uid;
+	inode->i_gid	= ip->i_d.di_gid;
+	if (((1 << vp->v_type) & ((1<<VBLK) | (1<<VCHR))) == 0) {
+		inode->i_rdev = 0;
+	} else {
+		xfs_dev_t dev = ip->i_df.if_u2.if_rdev;
+		inode->i_rdev = MKDEV(sysv_major(dev) & 0x1ff, sysv_minor(dev));
+	}
+	inode->i_blksize = PAGE_CACHE_SIZE;
+	inode->i_generation = ip->i_d.di_gen;
+	i_size_write(inode, ip->i_d.di_size);
+	inode->i_blocks =
+		XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
+	inode->i_atime.tv_sec	= ip->i_d.di_atime.t_sec;
+	inode->i_atime.tv_nsec	= ip->i_d.di_atime.t_nsec;
+	inode->i_mtime.tv_sec	= ip->i_d.di_mtime.t_sec;
+	inode->i_mtime.tv_nsec	= ip->i_d.di_mtime.t_nsec;
+	inode->i_ctime.tv_sec	= ip->i_d.di_ctime.t_sec;
+	inode->i_ctime.tv_nsec	= ip->i_d.di_ctime.t_nsec;
+	if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
+		inode->i_flags |= S_IMMUTABLE;
+	else
+		inode->i_flags &= ~S_IMMUTABLE;
+	if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
+		inode->i_flags |= S_APPEND;
+	else
+		inode->i_flags &= ~S_APPEND;
+	if (ip->i_d.di_flags & XFS_DIFLAG_SYNC)
+		inode->i_flags |= S_SYNC;
+	else
+		inode->i_flags &= ~S_SYNC;
+	if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME)
+		inode->i_flags |= S_NOATIME;
+	else
+		inode->i_flags &= ~S_NOATIME;
+	vp->v_flag &= ~VMODIFIED;
+}
+
+void
+xfs_initialize_vnode(
+	bhv_desc_t		*bdp,
+	vnode_t			*vp,
+	bhv_desc_t		*inode_bhv,
+	int			unlock)
+{
+	xfs_inode_t		*ip = XFS_BHVTOI(inode_bhv);
+	struct inode		*inode = LINVFS_GET_IP(vp);
+
+	if (!inode_bhv->bd_vobj) {
+		vp->v_vfsp = bhvtovfs(bdp);
+		bhv_desc_init(inode_bhv, ip, vp, &xfs_vnodeops);
+		bhv_insert(VN_BHV_HEAD(vp), inode_bhv);
+	}
+
+	vp->v_type = IFTOVT(ip->i_d.di_mode);
+
+	/* Have we been called during the new inode create process,
+	 * in which case we are too early to fill in the Linux inode.
+	 */
+	if (vp->v_type == VNON)
+		return;
+
+	xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip);
+
+	/* For new inodes we need to set the ops vectors,
+	 * and unlock the inode.
+	 */
+	if (unlock && (inode->i_state & I_NEW)) {
+		xfs_set_inodeops(inode);
+		unlock_new_inode(inode);
+	}
+}
+
+void
+xfs_flush_inode(
+	xfs_inode_t	*ip)
+{
+	struct inode	*inode = LINVFS_GET_IP(XFS_ITOV(ip));
+
+	filemap_flush(inode->i_mapping);
+}
+
+void
+xfs_flush_device(
+	xfs_inode_t	*ip)
+{
+	sync_blockdev(XFS_ITOV(ip)->v_vfsp->vfs_super->s_bdev);
+	xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
+}
+
+int
+xfs_blkdev_get(
+	xfs_mount_t		*mp,
+	const char		*name,
+	struct block_device	**bdevp)
+{
+	int			error = 0;
+
+	*bdevp = open_bdev_excl(name, 0, mp);
+	if (IS_ERR(*bdevp)) {
+		error = PTR_ERR(*bdevp);
+		printk("XFS: Invalid device [%s], error=%d\n", name, error);
+	}
+
+	return -error;
+}
+
+void
+xfs_blkdev_put(
+	struct block_device	*bdev)
+{
+	if (bdev)
+		close_bdev_excl(bdev);
+}
+
+
+STATIC struct inode *
+linvfs_alloc_inode(
+	struct super_block	*sb)
+{
+	vnode_t			*vp;
+
+	vp = (vnode_t *)kmem_cache_alloc(linvfs_inode_cachep, 
+                kmem_flags_convert(KM_SLEEP));
+	if (!vp)
+		return NULL;
+	return LINVFS_GET_IP(vp);
+}
+
+STATIC void
+linvfs_destroy_inode(
+	struct inode		*inode)
+{
+	kmem_cache_free(linvfs_inode_cachep, LINVFS_GET_VP(inode));
+}
+
+STATIC void
+init_once(
+	void			*data,
+	kmem_cache_t		*cachep,
+	unsigned long		flags)
+{
+	vnode_t			*vp = (vnode_t *)data;
+
+	if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
+	    SLAB_CTOR_CONSTRUCTOR)
+		inode_init_once(LINVFS_GET_IP(vp));
+}
+
+STATIC int
+init_inodecache( void )
+{
+	linvfs_inode_cachep = kmem_cache_create("linvfs_icache",
+				sizeof(vnode_t), 0,
+				SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+				init_once, NULL);
+
+	if (linvfs_inode_cachep == NULL)
+		return -ENOMEM;
+	return 0;
+}
+
+STATIC void
+destroy_inodecache( void )
+{
+	if (kmem_cache_destroy(linvfs_inode_cachep))
+		printk(KERN_WARNING "%s: cache still in use!\n", __FUNCTION__);
+}
+
+/*
+ * Attempt to flush the inode, this will actually fail
+ * if the inode is pinned, but we dirty the inode again
+ * at the point when it is unpinned after a log write,
+ * since this is when the inode itself becomes flushable. 
+ */
+STATIC void
+linvfs_write_inode(
+	struct inode		*inode,
+	int			sync)
+{
+	vnode_t			*vp = LINVFS_GET_VP(inode);
+	int			error, flags = FLUSH_INODE;
+
+	if (vp) {
+		vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+		if (sync)
+			flags |= FLUSH_SYNC;
+		VOP_IFLUSH(vp, flags, error);
+	}
+}
+
+STATIC void
+linvfs_clear_inode(
+	struct inode		*inode)
+{
+	vnode_t			*vp = LINVFS_GET_VP(inode);
+
+	if (vp) {
+		vn_rele(vp);
+		vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
+		/*
+		 * Do all our cleanup, and remove this vnode.
+		 */
+		vn_remove(vp);
+	}
+}
+
+
+#define SYNCD_FLAGS	(SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR)
+
+STATIC int
+xfssyncd(
+	void			*arg)
+{
+	vfs_t			*vfsp = (vfs_t *) arg;
+	int			error;
+
+	daemonize("xfssyncd");
+
+	vfsp->vfs_sync_task = current;
+	wmb();
+	wake_up(&vfsp->vfs_wait_sync_task);
+
+	for (;;) {
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule_timeout((xfs_syncd_centisecs * HZ) / 100);
+		/* swsusp */
+		if (current->flags & PF_FREEZE)
+			refrigerator(PF_FREEZE);
+		if (vfsp->vfs_flag & VFS_UMOUNT)
+			break;
+		if (vfsp->vfs_flag & VFS_RDONLY)
+			continue;
+		VFS_SYNC(vfsp, SYNCD_FLAGS, NULL, error);
+
+		vfsp->vfs_sync_seq++;
+		wmb();
+		wake_up(&vfsp->vfs_wait_single_sync_task);
+	}
+
+	vfsp->vfs_sync_task = NULL;
+	wmb();
+	wake_up(&vfsp->vfs_wait_sync_task);
+
+	return 0;
+}
+
+STATIC int
+linvfs_start_syncd(
+	vfs_t			*vfsp)
+{
+	int			pid;
+
+	pid = kernel_thread(xfssyncd, (void *) vfsp,
+			CLONE_VM | CLONE_FS | CLONE_FILES);
+	if (pid < 0)
+		return -pid;
+	wait_event(vfsp->vfs_wait_sync_task, vfsp->vfs_sync_task);
+	return 0;
+}
+
+STATIC void
+linvfs_stop_syncd(
+	vfs_t			*vfsp)
+{
+	vfsp->vfs_flag |= VFS_UMOUNT;
+	wmb();
+
+	wake_up_process(vfsp->vfs_sync_task);
+	wait_event(vfsp->vfs_wait_sync_task, !vfsp->vfs_sync_task);
+}
+
+STATIC void
+linvfs_put_super(
+	struct super_block	*sb)
+{
+	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
+	int			error;
+
+	linvfs_stop_syncd(vfsp);
+	VFS_SYNC(vfsp, SYNC_ATTR|SYNC_DELWRI, NULL, error);
+	if (!error)
+		VFS_UNMOUNT(vfsp, 0, NULL, error);
+	if (error) {
+		printk("XFS unmount got error %d\n", error);
+		printk("%s: vfsp/0x%p left dangling!\n", __FUNCTION__, vfsp);
+		return;
+	}
+
+	vfs_deallocate(vfsp);
+}
+
+STATIC void
+linvfs_write_super(
+	struct super_block	*sb)
+{
+	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
+	int			error;
+
+	if (sb->s_flags & MS_RDONLY) {
+		sb->s_dirt = 0; /* paranoia */
+		return;
+	}
+	/* Push the log and superblock a little */
+	VFS_SYNC(vfsp, SYNC_FSDATA, NULL, error);
+	sb->s_dirt = 0;
+}
+
+STATIC int
+linvfs_sync_super(
+	struct super_block	*sb,
+	int			wait)
+{
+	vfs_t		*vfsp = LINVFS_GET_VFS(sb);
+	int		error;
+	int		flags = SYNC_FSDATA;
+
+	if (wait)
+		flags |= SYNC_WAIT;
+
+	VFS_SYNC(vfsp, flags, NULL, error);
+	sb->s_dirt = 0;
+
+	if (unlikely(laptop_mode)) {
+		int	prev_sync_seq = vfsp->vfs_sync_seq;
+		/*
+		 * The disk must be active because we're syncing.
+		 * We schedule syncd now (now that the disk is
+		 * active) instead of later (when it might not be).
+		 */
+		wake_up_process(vfsp->vfs_sync_task);
+		/*
+		 * We have to wait for the sync iteration to complete.
+		 * If we don't, the disk activity caused by the sync
+		 * will come after the sync is completed, and that
+		 * triggers another sync from laptop mode.
+		 */
+		wait_event(vfsp->vfs_wait_single_sync_task,
+				vfsp->vfs_sync_seq != prev_sync_seq);
+	}
+
+	return -error;
+}
+
+STATIC int
+linvfs_statfs(
+	struct super_block	*sb,
+	struct kstatfs		*statp)
+{
+	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
+	int			error;
+
+	VFS_STATVFS(vfsp, statp, NULL, error);
+	return -error;
+}
+
+STATIC int
+linvfs_remount(
+	struct super_block	*sb,
+	int			*flags,
+	char			*options)
+{
+	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
+	struct xfs_mount_args	*args = xfs_args_allocate(sb);
+	int			error;
+
+	VFS_PARSEARGS(vfsp, options, args, 1, error);
+	if (!error)
+		VFS_MNTUPDATE(vfsp, flags, args, error);
+	kmem_free(args, sizeof(*args));
+	return -error;
+}
+
+STATIC void
+linvfs_freeze_fs(
+	struct super_block	*sb)
+{
+	VFS_FREEZE(LINVFS_GET_VFS(sb));
+}
+
+STATIC struct dentry *
+linvfs_get_parent(
+	struct dentry		*child)
+{
+	int			error;
+	vnode_t			*vp, *cvp;
+	struct dentry		*parent;
+	struct inode		*ip = NULL;
+	struct dentry		dotdot;
+
+	dotdot.d_name.name = "..";
+	dotdot.d_name.len = 2;
+	dotdot.d_inode = 0;
+
+	cvp = NULL;
+	vp = LINVFS_GET_VP(child->d_inode);
+	VOP_LOOKUP(vp, &dotdot, &cvp, 0, NULL, NULL, error);
+
+	if (!error) {
+		ASSERT(cvp);
+		ip = LINVFS_GET_IP(cvp);
+		if (!ip) {
+			VN_RELE(cvp);
+			return ERR_PTR(-EACCES);
+		}
+	}
+	if (error)
+		return ERR_PTR(-error);
+	parent = d_alloc_anon(ip);
+	if (!parent) {
+		VN_RELE(cvp);
+		parent = ERR_PTR(-ENOMEM);
+	}
+	return parent;
+}
+
+STATIC struct dentry *
+linvfs_get_dentry(
+	struct super_block	*sb,
+	void			*data)
+{
+	vnode_t			*vp;
+	struct inode		*inode;
+	struct dentry		*result;
+	xfs_fid2_t		xfid;
+	vfs_t			*vfsp = LINVFS_GET_VFS(sb);
+	int			error;
+
+	xfid.fid_len = sizeof(xfs_fid2_t) - sizeof(xfid.fid_len);
+	xfid.fid_pad = 0;
+	xfid.fid_gen = ((__u32 *)data)[1];
+	xfid.fid_ino = ((__u32 *)data)[0];
+
+	VFS_VGET(vfsp, &vp, (fid_t *)&xfid, error);
+	if (error || vp == NULL)
+		return ERR_PTR(-ESTALE) ;
+
+	inode = LINVFS_GET_IP(vp);
+	result = d_alloc_anon(inode);
+        if (!result) {
+		iput(inode);
+		return ERR_PTR(-ENOMEM);
+	}
+	return result;
+}
+
+STATIC int
+linvfs_show_options(
+	struct seq_file		*m,
+	struct vfsmount		*mnt)
+{
+	struct vfs		*vfsp = LINVFS_GET_VFS(mnt->mnt_sb);
+	int			error;
+
+	VFS_SHOWARGS(vfsp, m, error);
+	return error;
+}
+
+STATIC int
+linvfs_getxstate(
+	struct super_block	*sb,
+	struct fs_quota_stat	*fqs)
+{
+	struct vfs		*vfsp = LINVFS_GET_VFS(sb);
+	int			error;
+
+	VFS_QUOTACTL(vfsp, Q_XGETQSTAT, 0, (caddr_t)fqs, error);
+	return -error;
+}
+
+STATIC int
+linvfs_setxstate(
+	struct super_block	*sb,
+	unsigned int		flags,
+	int			op)
+{
+	struct vfs		*vfsp = LINVFS_GET_VFS(sb);
+	int			error;
+
+	VFS_QUOTACTL(vfsp, op, 0, (caddr_t)&flags, error);
+	return -error;
+}
+
+STATIC int
+linvfs_getxquota(
+	struct super_block	*sb,
+	int			type,
+	qid_t			id,
+	struct fs_disk_quota	*fdq)
+{
+	struct vfs		*vfsp = LINVFS_GET_VFS(sb);
+	int			error, getmode;
+
+	getmode = (type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETQUOTA;
+	VFS_QUOTACTL(vfsp, getmode, id, (caddr_t)fdq, error);
+	return -error;
+}
+
+STATIC int
+linvfs_setxquota(
+	struct super_block	*sb,
+	int			type,
+	qid_t			id,
+	struct fs_disk_quota	*fdq)
+{
+	struct vfs		*vfsp = LINVFS_GET_VFS(sb);
+	int			error, setmode;
+
+	setmode = (type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETQLIM;
+	VFS_QUOTACTL(vfsp, setmode, id, (caddr_t)fdq, error);
+	return -error;
+}
+
+STATIC int
+linvfs_fill_super(
+	struct super_block	*sb,
+	void			*data,
+	int			silent)
+{
+	vnode_t			*rootvp;
+	struct vfs		*vfsp = vfs_allocate();
+	struct xfs_mount_args	*args = xfs_args_allocate(sb);
+	struct kstatfs		statvfs;
+	int			error, error2;
+
+	vfsp->vfs_super = sb;
+	LINVFS_SET_VFS(sb, vfsp);
+	if (sb->s_flags & MS_RDONLY)
+		vfsp->vfs_flag |= VFS_RDONLY;
+	bhv_insert_all_vfsops(vfsp);
+
+	VFS_PARSEARGS(vfsp, (char *)data, args, 0, error);
+	if (error) {
+		bhv_remove_all_vfsops(vfsp, 1);
+		goto fail_vfsop;
+	}
+
+	sb_min_blocksize(sb, BBSIZE);
+	sb->s_export_op = &linvfs_export_ops;
+	sb->s_qcop = &linvfs_qops;
+	sb->s_op = &linvfs_sops;
+
+	VFS_MOUNT(vfsp, args, NULL, error);
+	if (error) {
+		bhv_remove_all_vfsops(vfsp, 1);
+		goto fail_vfsop;
+	}
+
+	VFS_STATVFS(vfsp, &statvfs, NULL, error);
+	if (error)
+		goto fail_unmount;
+
+	sb->s_dirt = 1;
+	sb->s_magic = statvfs.f_type;
+	sb->s_blocksize = statvfs.f_bsize;
+	sb->s_blocksize_bits = ffs(statvfs.f_bsize) - 1;
+	sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits);
+	set_posix_acl_flag(sb);
+
+	VFS_ROOT(vfsp, &rootvp, error);
+	if (error)
+		goto fail_unmount;
+
+	sb->s_root = d_alloc_root(LINVFS_GET_IP(rootvp));
+	if (!sb->s_root) {
+		error = ENOMEM;
+		goto fail_vnrele;
+	}
+	if (is_bad_inode(sb->s_root->d_inode)) {
+		error = EINVAL;
+		goto fail_vnrele;
+	}
+	if ((error = linvfs_start_syncd(vfsp)))
+		goto fail_vnrele;
+	vn_trace_exit(rootvp, __FUNCTION__, (inst_t *)__return_address);
+
+	kmem_free(args, sizeof(*args));
+	return 0;
+
+fail_vnrele:
+	if (sb->s_root) {
+		dput(sb->s_root);
+		sb->s_root = NULL;
+	} else {
+		VN_RELE(rootvp);
+	}
+
+fail_unmount:
+	VFS_UNMOUNT(vfsp, 0, NULL, error2);
+
+fail_vfsop:
+	vfs_deallocate(vfsp);
+	kmem_free(args, sizeof(*args));
+	return -error;
+}
+
+STATIC struct super_block *
+linvfs_get_sb(
+	struct file_system_type	*fs_type,
+	int			flags,
+	const char		*dev_name,
+	void			*data)
+{
+	return get_sb_bdev(fs_type, flags, dev_name, data, linvfs_fill_super);
+}
+
+
+STATIC struct export_operations linvfs_export_ops = {
+	.get_parent		= linvfs_get_parent,
+	.get_dentry		= linvfs_get_dentry,
+};
+
+STATIC struct super_operations linvfs_sops = {
+	.alloc_inode		= linvfs_alloc_inode,
+	.destroy_inode		= linvfs_destroy_inode,
+	.write_inode		= linvfs_write_inode,
+	.clear_inode		= linvfs_clear_inode,
+	.put_super		= linvfs_put_super,
+	.write_super		= linvfs_write_super,
+	.sync_fs		= linvfs_sync_super,
+	.write_super_lockfs	= linvfs_freeze_fs,
+	.statfs			= linvfs_statfs,
+	.remount_fs		= linvfs_remount,
+	.show_options		= linvfs_show_options,
+};
+
+STATIC struct quotactl_ops linvfs_qops = {
+	.get_xstate		= linvfs_getxstate,
+	.set_xstate		= linvfs_setxstate,
+	.get_xquota		= linvfs_getxquota,
+	.set_xquota		= linvfs_setxquota,
+};
+
+STATIC struct file_system_type xfs_fs_type = {
+	.owner			= THIS_MODULE,
+	.name			= "xfs",
+	.get_sb			= linvfs_get_sb,
+	.kill_sb		= kill_block_super,
+	.fs_flags		= FS_REQUIRES_DEV,
+};
+
+
+STATIC int __init
+init_xfs_fs( void )
+{
+	int			error;
+	struct sysinfo		si;
+	static char		message[] __initdata = KERN_INFO \
+		XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
+
+	printk(message);
+
+	si_meminfo(&si);
+	xfs_physmem = si.totalram;
+
+	ktrace_init(64);
+
+	error = init_inodecache();
+	if (error < 0)
+		goto undo_inodecache;
+
+	error = pagebuf_init();
+	if (error < 0)
+		goto undo_pagebuf;
+
+	vn_init();
+	xfs_init();
+	uuid_init();
+	vfs_initdmapi();
+	vfs_initquota();
+
+	error = register_filesystem(&xfs_fs_type);
+	if (error)
+		goto undo_register;
+	return 0;
+
+undo_register:
+	pagebuf_terminate();
+
+undo_pagebuf:
+	destroy_inodecache();
+
+undo_inodecache:
+	return error;
+}
+
+STATIC void __exit
+exit_xfs_fs( void )
+{
+	vfs_exitquota();
+	vfs_exitdmapi();
+	unregister_filesystem(&xfs_fs_type);
+	xfs_cleanup();
+	pagebuf_terminate();
+	destroy_inodecache();
+	ktrace_uninit();
+}
+
+module_init(init_xfs_fs);
+module_exit(exit_xfs_fs);
+
+MODULE_AUTHOR("Silicon Graphics, Inc.");
+MODULE_DESCRIPTION(XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled");
+MODULE_LICENSE("GPL");
diff -Nru a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/linux-2.6/xfs_super.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_super.h	Tue Jun 15 22:20:38 2004
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_SUPER_H__
+#define __XFS_SUPER_H__
+
+#ifdef CONFIG_XFS_DMAPI
+# define vfs_insertdmapi(vfs)	vfs_insertops(vfsp, &xfs_dmops)
+# define vfs_initdmapi()	dmapi_init()
+# define vfs_exitdmapi()	dmapi_uninit()
+#else
+# define vfs_insertdmapi(vfs)	do { } while (0)
+# define vfs_initdmapi()	do { } while (0)
+# define vfs_exitdmapi()	do { } while (0)
+#endif
+
+#ifdef CONFIG_XFS_QUOTA
+# define vfs_insertquota(vfs)	vfs_insertops(vfsp, &xfs_qmops)
+extern void xfs_qm_init(void);
+extern void xfs_qm_exit(void);
+# define vfs_initquota()	xfs_qm_init()
+# define vfs_exitquota()	xfs_qm_exit()
+#else
+# define vfs_insertquota(vfs)	do { } while (0)
+# define vfs_initquota()	do { } while (0)
+# define vfs_exitquota()	do { } while (0)
+#endif
+
+#ifdef CONFIG_XFS_POSIX_ACL
+# define XFS_ACL_STRING		"ACLs, "
+# define set_posix_acl_flag(sb)	((sb)->s_flags |= MS_POSIXACL)
+#else
+# define XFS_ACL_STRING
+# define set_posix_acl_flag(sb)	do { } while (0)
+#endif
+
+#ifdef CONFIG_XFS_SECURITY
+# define XFS_SECURITY_STRING	"security attributes, "
+# define ENOSECURITY		0
+#else
+# define XFS_SECURITY_STRING
+# define ENOSECURITY		EOPNOTSUPP
+#endif
+
+#ifdef CONFIG_XFS_RT
+# define XFS_REALTIME_STRING	"realtime, "
+#else
+# define XFS_REALTIME_STRING
+#endif
+
+#if XFS_BIG_BLKNOS
+# if XFS_BIG_INUMS
+#  define XFS_BIGFS_STRING	"large block/inode numbers, "
+# else
+#  define XFS_BIGFS_STRING	"large block numbers, "
+# endif
+#else
+# define XFS_BIGFS_STRING
+#endif
+
+#ifdef CONFIG_XFS_TRACE
+# define XFS_TRACE_STRING	"tracing, "
+#else
+# define XFS_TRACE_STRING
+#endif
+
+#ifdef DEBUG
+# define XFS_DBG_STRING		"debug"
+#else
+# define XFS_DBG_STRING		"no debug"
+#endif
+
+#define XFS_BUILD_OPTIONS	XFS_ACL_STRING \
+				XFS_SECURITY_STRING \
+				XFS_REALTIME_STRING \
+				XFS_BIGFS_STRING \
+				XFS_TRACE_STRING \
+				XFS_DBG_STRING /* DBG must be last */
+
+#define LINVFS_GET_VFS(s) \
+	(vfs_t *)((s)->s_fs_info)
+#define LINVFS_SET_VFS(s, vfsp) \
+	((s)->s_fs_info = vfsp)
+
+struct xfs_inode;
+struct xfs_mount;
+struct xfs_buftarg;
+struct block_device;
+
+extern __uint64_t xfs_max_file_offset(unsigned int);
+
+extern void xfs_initialize_vnode(bhv_desc_t *, vnode_t *, bhv_desc_t *, int);
+
+extern void xfs_flush_inode(struct xfs_inode *);
+extern void xfs_flush_device(struct xfs_inode *);
+
+extern int  xfs_blkdev_get(struct xfs_mount *, const char *,
+				struct block_device **);
+extern void xfs_blkdev_put(struct block_device *);
+
+#endif	/* __XFS_SUPER_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_sysctl.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2001-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+#include "xfs_rw.h"
+#include <linux/sysctl.h>
+#include <linux/proc_fs.h>
+
+
+static struct ctl_table_header *xfs_table_header;
+
+
+#ifdef CONFIG_PROC_FS
+STATIC int
+xfs_stats_clear_proc_handler(
+	ctl_table	*ctl,
+	int		write,
+	struct file	*filp,
+	void		*buffer,
+	size_t		*lenp)
+{
+	int		c, ret, *valp = ctl->data;
+	__uint32_t	vn_active;
+
+	ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp);
+
+	if (!ret && write && *valp) {
+		printk("XFS Clearing xfsstats\n");
+		for (c = 0; c < NR_CPUS; c++) {
+			if (!cpu_possible(c)) continue;
+			preempt_disable();
+			/* save vn_active, it's a universal truth! */
+			vn_active = per_cpu(xfsstats, c).vn_active;
+			memset(&per_cpu(xfsstats, c), 0,
+			       sizeof(struct xfsstats));
+			per_cpu(xfsstats, c).vn_active = vn_active;
+			preempt_enable();
+		}
+		xfs_stats_clear = 0;
+	}
+
+	return ret;
+}
+#endif /* CONFIG_PROC_FS */
+
+STATIC ctl_table xfs_table[] = {
+	{XFS_RESTRICT_CHOWN, "restrict_chown", &xfs_params.restrict_chown.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL, 
+	&xfs_params.restrict_chown.min, &xfs_params.restrict_chown.max},
+
+	{XFS_SGID_INHERIT, "irix_sgid_inherit", &xfs_params.sgid_inherit.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL,
+	&xfs_params.sgid_inherit.min, &xfs_params.sgid_inherit.max},
+
+	{XFS_SYMLINK_MODE, "irix_symlink_mode", &xfs_params.symlink_mode.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL, 
+	&xfs_params.symlink_mode.min, &xfs_params.symlink_mode.max},
+
+	{XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL, 
+	&xfs_params.panic_mask.min, &xfs_params.panic_mask.max},
+
+	{XFS_ERRLEVEL, "error_level", &xfs_params.error_level.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL, 
+	&xfs_params.error_level.min, &xfs_params.error_level.max},
+
+	{XFS_SYNCD_TIMER, "xfssyncd_centisecs", &xfs_params.syncd_timer.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL, 
+	&xfs_params.syncd_timer.min, &xfs_params.syncd_timer.max},
+
+	{XFS_INHERIT_SYNC, "inherit_sync", &xfs_params.inherit_sync.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL,
+	&xfs_params.inherit_sync.min, &xfs_params.inherit_sync.max},
+
+	{XFS_INHERIT_NODUMP, "inherit_nodump", &xfs_params.inherit_nodump.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL,
+	&xfs_params.inherit_nodump.min, &xfs_params.inherit_nodump.max},
+
+	{XFS_INHERIT_NOATIME, "inherit_noatime", &xfs_params.inherit_noatim.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL,
+	&xfs_params.inherit_noatim.min, &xfs_params.inherit_noatim.max},
+	
+	{XFS_BUF_TIMER, "xfsbufd_centisecs", &xfs_params.xfs_buf_timer.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL,
+	&xfs_params.xfs_buf_timer.min, &xfs_params.xfs_buf_timer.max},
+
+	{XFS_BUF_AGE, "age_buffer_centisecs", &xfs_params.xfs_buf_age.val,
+	sizeof(int), 0644, NULL, &proc_dointvec_minmax,
+	&sysctl_intvec, NULL,
+	&xfs_params.xfs_buf_age.min, &xfs_params.xfs_buf_age.max},
+
+	/* please keep this the last entry */
+#ifdef CONFIG_PROC_FS
+	{XFS_STATS_CLEAR, "stats_clear", &xfs_params.stats_clear.val,
+	sizeof(int), 0644, NULL, &xfs_stats_clear_proc_handler,
+	&sysctl_intvec, NULL, 
+	&xfs_params.stats_clear.min, &xfs_params.stats_clear.max},
+#endif /* CONFIG_PROC_FS */
+
+	{0}
+};
+
+STATIC ctl_table xfs_dir_table[] = {
+	{FS_XFS, "xfs", NULL, 0, 0555, xfs_table},
+	{0}
+};
+
+STATIC ctl_table xfs_root_table[] = {
+	{CTL_FS, "fs",  NULL, 0, 0555, xfs_dir_table},
+	{0}
+};
+
+void
+xfs_sysctl_register(void)
+{
+	xfs_table_header = register_sysctl_table(xfs_root_table, 1);
+}
+
+void
+xfs_sysctl_unregister(void)
+{
+	if (xfs_table_header)
+		unregister_sysctl_table(xfs_table_header);
+}
diff -Nru a/fs/xfs/linux-2.6/xfs_sysctl.h b/fs/xfs/linux-2.6/xfs_sysctl.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_sysctl.h	Tue Jun 15 22:20:36 2004
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2001-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#ifndef __XFS_SYSCTL_H__
+#define __XFS_SYSCTL_H__
+
+#include <linux/sysctl.h>
+
+/*
+ * Tunable xfs parameters
+ */
+
+typedef struct xfs_sysctl_val {
+	int min;
+	int val;
+	int max;
+} xfs_sysctl_val_t;
+
+typedef struct xfs_param {
+	xfs_sysctl_val_t restrict_chown;/* Root/non-root can give away files.*/
+	xfs_sysctl_val_t sgid_inherit;	/* Inherit S_ISGID if process' GID is
+					 * not a member of parent dir GID. */
+	xfs_sysctl_val_t symlink_mode;	/* Link creat mode affected by umask */
+	xfs_sysctl_val_t panic_mask;	/* bitmask to cause panic on errors. */
+	xfs_sysctl_val_t error_level;	/* Degree of reporting for problems  */
+	xfs_sysctl_val_t syncd_timer;	/* Interval between xfssyncd wakeups */
+	xfs_sysctl_val_t stats_clear;	/* Reset all XFS statistics to zero. */
+	xfs_sysctl_val_t inherit_sync;	/* Inherit the "sync" inode flag. */
+	xfs_sysctl_val_t inherit_nodump;/* Inherit the "nodump" inode flag. */
+	xfs_sysctl_val_t inherit_noatim;/* Inherit the "noatime" inode flag. */
+	xfs_sysctl_val_t xfs_buf_timer;	/* Interval between xfsbufd wakeups. */
+	xfs_sysctl_val_t xfs_buf_age;	/* Metadata buffer age before flush. */
+} xfs_param_t;
+
+/*
+ * xfs_error_level:
+ *
+ * How much error reporting will be done when internal problems are
+ * encountered.  These problems normally return an EFSCORRUPTED to their
+ * caller, with no other information reported.
+ *
+ * 0	No error reports
+ * 1	Report EFSCORRUPTED errors that will cause a filesystem shutdown
+ * 5	Report all EFSCORRUPTED errors (all of the above errors, plus any
+ *	additional errors that are known to not cause shutdowns)
+ *
+ * xfs_panic_mask bit 0x8 turns the error reports into panics
+ */
+
+enum {
+	/* XFS_REFCACHE_SIZE = 1 */
+	/* XFS_REFCACHE_PURGE = 2 */
+	XFS_RESTRICT_CHOWN = 3,
+	XFS_SGID_INHERIT = 4,
+	XFS_SYMLINK_MODE = 5,
+	XFS_PANIC_MASK = 6,
+	XFS_ERRLEVEL = 7,
+	XFS_SYNCD_TIMER = 8,
+	/* XFS_PROBE_DMAPI = 9 */
+	/* XFS_PROBE_IOOPS = 10 */
+	/* XFS_PROBE_QUOTA = 11 */
+	XFS_STATS_CLEAR = 12,
+	XFS_INHERIT_SYNC = 13,
+	XFS_INHERIT_NODUMP = 14,
+	XFS_INHERIT_NOATIME = 15,
+	XFS_BUF_TIMER = 16,
+	XFS_BUF_AGE = 17,
+	/* XFS_IO_BYPASS = 18 */
+};
+
+extern xfs_param_t	xfs_params;
+
+#ifdef CONFIG_SYSCTL
+extern void xfs_sysctl_register(void);
+extern void xfs_sysctl_unregister(void);
+#else
+# define xfs_sysctl_register()		do { } while (0)
+# define xfs_sysctl_unregister()	do { } while (0)
+#endif /* CONFIG_SYSCTL */
+
+#endif /* __XFS_SYSCTL_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_version.h b/fs/xfs/linux-2.6/xfs_version.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_version.h	Tue Jun 15 22:21:03 2004
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2001-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.	 Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+/*
+ * Dummy file that can contain a timestamp to put into the
+ * XFS init string, to help users keep track of what they're
+ * running
+ */
+
+#ifndef __XFS_VERSION_H__
+#define __XFS_VERSION_H__
+
+#define XFS_VERSION_STRING "SGI XFS"
+
+#endif /* __XFS_VERSION_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_vfs.c b/fs/xfs/linux-2.6/xfs_vfs.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_vfs.c	Tue Jun 15 22:20:36 2004
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_macros.h"
+#include "xfs_inum.h"
+#include "xfs_log.h"
+#include "xfs_clnt.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
+#include "xfs_ag.h"
+#include "xfs_dir.h"
+#include "xfs_dir2.h"
+#include "xfs_imap.h"
+#include "xfs_alloc.h"
+#include "xfs_dmapi.h"
+#include "xfs_mount.h"
+#include "xfs_quota.h"
+
+int
+vfs_mount(
+	struct bhv_desc		*bdp,
+	struct xfs_mount_args	*args,
+	struct cred		*cr)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_mount)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_mount)(next, args, cr));
+}
+
+int
+vfs_parseargs(
+	struct bhv_desc		*bdp,
+	char			*s,
+	struct xfs_mount_args	*args,
+	int			f)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_parseargs)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_parseargs)(next, s, args, f));
+}
+
+int
+vfs_showargs(
+	struct bhv_desc		*bdp,
+	struct seq_file		*m)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_showargs)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_showargs)(next, m));
+}
+
+int
+vfs_unmount(
+	struct bhv_desc		*bdp,
+	int			fl,
+	struct cred		*cr)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_unmount)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_unmount)(next, fl, cr));
+}
+
+int
+vfs_mntupdate(
+	struct bhv_desc		*bdp,
+	int			*fl,
+	struct xfs_mount_args	*args)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_mntupdate)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_mntupdate)(next, fl, args));
+}
+
+int
+vfs_root(
+	struct bhv_desc		*bdp,
+	struct vnode		**vpp)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_root)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_root)(next, vpp));
+}
+
+int
+vfs_statvfs(
+	struct bhv_desc		*bdp,
+	xfs_statfs_t		*sp,
+	struct vnode		*vp)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_statvfs)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_statvfs)(next, sp, vp));
+}
+
+int
+vfs_sync(
+	struct bhv_desc		*bdp,
+	int			fl,
+	struct cred		*cr)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_sync)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_sync)(next, fl, cr));
+}
+
+int
+vfs_vget(
+	struct bhv_desc		*bdp,
+	struct vnode		**vpp,
+	struct fid		*fidp)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_vget)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_vget)(next, vpp, fidp));
+}
+
+int
+vfs_dmapiops(
+	struct bhv_desc		*bdp,
+	caddr_t			addr)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_dmapiops)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_dmapiops)(next, addr));
+}
+
+int
+vfs_quotactl(
+	struct bhv_desc		*bdp,
+	int			cmd,
+	int			id,
+	caddr_t			addr)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_quotactl)
+		next = BHV_NEXT(next);
+	return ((*bhvtovfsops(next)->vfs_quotactl)(next, cmd, id, addr));
+}
+
+void
+vfs_init_vnode(
+	struct bhv_desc		*bdp,
+	struct vnode		*vp,
+	struct bhv_desc		*bp,
+	int			unlock)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_init_vnode)
+		next = BHV_NEXT(next);
+	((*bhvtovfsops(next)->vfs_init_vnode)(next, vp, bp, unlock));
+}
+
+void
+vfs_force_shutdown(
+	struct bhv_desc		*bdp,
+	int			fl,
+	char			*file,
+	int			line)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_force_shutdown)
+		next = BHV_NEXT(next);
+	((*bhvtovfsops(next)->vfs_force_shutdown)(next, fl, file, line));
+}
+
+void
+vfs_freeze(
+	struct bhv_desc		*bdp)
+{
+	struct bhv_desc		*next = bdp;
+
+	ASSERT(next);
+	while (! (bhvtovfsops(next))->vfs_freeze)
+		next = BHV_NEXT(next);
+	((*bhvtovfsops(next)->vfs_freeze)(next));
+}
+
+vfs_t *
+vfs_allocate( void )
+{
+	struct vfs		*vfsp;
+
+	vfsp = kmem_zalloc(sizeof(vfs_t), KM_SLEEP);
+	bhv_head_init(VFS_BHVHEAD(vfsp), "vfs");
+	init_waitqueue_head(&vfsp->vfs_wait_sync_task);
+	init_waitqueue_head(&vfsp->vfs_wait_single_sync_task);
+	return vfsp;
+}
+
+void
+vfs_deallocate(
+	struct vfs		*vfsp)
+{
+	bhv_head_destroy(VFS_BHVHEAD(vfsp));
+	kmem_free(vfsp, sizeof(vfs_t));
+}
+
+void
+vfs_insertops(
+	struct vfs		*vfsp,
+	struct bhv_vfsops	*vfsops)
+{
+	struct bhv_desc		*bdp;
+
+	bdp = kmem_alloc(sizeof(struct bhv_desc), KM_SLEEP);
+	bhv_desc_init(bdp, NULL, vfsp, vfsops);
+	bhv_insert(&vfsp->vfs_bh, bdp);
+}
+
+void
+vfs_insertbhv(
+	struct vfs		*vfsp,
+	struct bhv_desc		*bdp,
+	struct vfsops		*vfsops,
+	void			*mount)
+{
+	bhv_desc_init(bdp, mount, vfsp, vfsops);
+	bhv_insert_initial(&vfsp->vfs_bh, bdp);
+}
+
+void
+bhv_remove_vfsops(
+	struct vfs		*vfsp,
+	int			pos)
+{
+	struct bhv_desc		*bhv;
+
+	bhv = bhv_lookup_range(&vfsp->vfs_bh, pos, pos);
+	if (!bhv)
+		return;
+	bhv_remove(&vfsp->vfs_bh, bhv);
+	kmem_free(bhv, sizeof(*bhv));
+}
+
+void
+bhv_remove_all_vfsops(
+	struct vfs		*vfsp,
+	int			freebase)
+{
+	struct xfs_mount	*mp;
+
+	bhv_remove_vfsops(vfsp, VFS_POSITION_QM);
+	bhv_remove_vfsops(vfsp, VFS_POSITION_DM);
+	if (!freebase)
+		return;
+	mp = XFS_BHVTOM(bhv_lookup(VFS_BHVHEAD(vfsp), &xfs_vfsops));
+	VFS_REMOVEBHV(vfsp, &mp->m_bhv);
+	xfs_mount_free(mp, 0);
+}
+
+void
+bhv_insert_all_vfsops(
+	struct vfs		*vfsp)
+{
+	struct xfs_mount	*mp;
+
+	mp = xfs_mount_init();
+	vfs_insertbhv(vfsp, &mp->m_bhv, &xfs_vfsops, mp);
+	vfs_insertdmapi(vfsp);
+	vfs_insertquota(vfsp);
+}
diff -Nru a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_vfs.h	Tue Jun 15 22:20:36 2004
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+#ifndef __XFS_VFS_H__
+#define __XFS_VFS_H__
+
+#include <linux/vfs.h>
+#include "xfs_fs.h"
+
+struct fid;
+struct cred;
+struct vnode;
+struct kstatfs;
+struct seq_file;
+struct super_block;
+struct xfs_mount_args;
+
+typedef struct kstatfs xfs_statfs_t;
+
+typedef struct vfs {
+	u_int			vfs_flag;	/* flags */
+	xfs_fsid_t		vfs_fsid;	/* file system ID */
+	xfs_fsid_t		*vfs_altfsid;	/* An ID fixed for life of FS */
+	bhv_head_t		vfs_bh;		/* head of vfs behavior chain */
+	struct super_block	*vfs_super;	/* Linux superblock structure */
+	struct task_struct	*vfs_sync_task;	/* xfssyncd process */
+	int 			vfs_sync_seq;	/* xfssyncd generation number */
+	wait_queue_head_t	vfs_wait_single_sync_task;
+	wait_queue_head_t	vfs_wait_sync_task;
+} vfs_t;
+
+#define vfs_fbhv		vfs_bh.bh_first	/* 1st on vfs behavior chain */
+
+#define bhvtovfs(bdp)		( (struct vfs *)BHV_VOBJ(bdp) )
+#define bhvtovfsops(bdp)	( (struct vfsops *)BHV_OPS(bdp) )
+#define VFS_BHVHEAD(vfs)	( &(vfs)->vfs_bh )
+#define VFS_REMOVEBHV(vfs, bdp)	( bhv_remove(VFS_BHVHEAD(vfs), bdp) )
+
+#define VFS_POSITION_BASE	BHV_POSITION_BASE	/* chain bottom */
+#define VFS_POSITION_TOP	BHV_POSITION_TOP	/* chain top */
+#define VFS_POSITION_INVALID	BHV_POSITION_INVALID	/* invalid pos. num */
+
+typedef enum {
+	VFS_BHV_UNKNOWN,	/* not specified */
+	VFS_BHV_XFS,		/* xfs */
+	VFS_BHV_DM,		/* data migration */
+	VFS_BHV_QM,		/* quota manager */
+	VFS_BHV_IO,		/* IO path */
+	VFS_BHV_END		/* housekeeping end-of-range */
+} vfs_bhv_t;
+
+#define VFS_POSITION_XFS	(BHV_POSITION_BASE)
+#define VFS_POSITION_DM		(VFS_POSITION_BASE+10)
+#define VFS_POSITION_QM		(VFS_POSITION_BASE+20)
+#define VFS_POSITION_IO		(VFS_POSITION_BASE+30)
+
+#define VFS_RDONLY		0x0001	/* read-only vfs */
+#define VFS_GRPID		0x0002	/* group-ID assigned from directory */
+#define VFS_DMI			0x0004	/* filesystem has the DMI enabled */
+#define VFS_UMOUNT		0x0008	/* unmount in progress */
+#define VFS_END			0x0008	/* max flag */
+
+#define SYNC_ATTR		0x0001	/* sync attributes */
+#define SYNC_CLOSE		0x0002	/* close file system down */
+#define SYNC_DELWRI		0x0004	/* look at delayed writes */
+#define SYNC_WAIT		0x0008	/* wait for i/o to complete */
+#define SYNC_BDFLUSH		0x0010	/* BDFLUSH is calling -- don't block */
+#define SYNC_FSDATA		0x0020	/* flush fs data (e.g. superblocks) */
+#define SYNC_REFCACHE		0x0040  /* prune some of the nfs ref cache */
+#define SYNC_REMOUNT		0x0080  /* remount readonly, no dummy LRs */
+
+typedef int	(*vfs_mount_t)(bhv_desc_t *,
+				struct xfs_mount_args *, struct cred *);
+typedef int	(*vfs_parseargs_t)(bhv_desc_t *, char *,
+				struct xfs_mount_args *, int);
+typedef	int	(*vfs_showargs_t)(bhv_desc_t *, struct seq_file *);
+typedef int	(*vfs_unmount_t)(bhv_desc_t *, int, struct cred *);
+typedef int	(*vfs_mntupdate_t)(bhv_desc_t *, int *,
+				struct xfs_mount_args *);
+typedef int	(*vfs_root_t)(bhv_desc_t *, struct vnode **);
+typedef int	(*vfs_statvfs_t)(bhv_desc_t *, xfs_statfs_t *, struct vnode *);
+typedef int	(*vfs_sync_t)(bhv_desc_t *, int, struct cred *);
+typedef int	(*vfs_vget_t)(bhv_desc_t *, struct vnode **, struct fid *);
+typedef int	(*vfs_dmapiops_t)(bhv_desc_t *, caddr_t);
+typedef int	(*vfs_quotactl_t)(bhv_desc_t *, int, int, caddr_t);
+typedef void	(*vfs_init_vnode_t)(bhv_desc_t *,
+				struct vnode *, bhv_desc_t *, int);
+typedef void	(*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int);
+typedef void	(*vfs_freeze_t)(bhv_desc_t *);
+
+typedef struct vfsops {
+	bhv_position_t		vf_position;	/* behavior chain position */
+	vfs_mount_t		vfs_mount;	/* mount file system */
+	vfs_parseargs_t		vfs_parseargs;	/* parse mount options */
+	vfs_showargs_t		vfs_showargs;	/* unparse mount options */
+	vfs_unmount_t		vfs_unmount;	/* unmount file system */
+	vfs_mntupdate_t		vfs_mntupdate;	/* update file system options */
+	vfs_root_t		vfs_root;	/* get root vnode */
+	vfs_statvfs_t		vfs_statvfs;	/* file system statistics */
+	vfs_sync_t		vfs_sync;	/* flush files */
+	vfs_vget_t		vfs_vget;	/* get vnode from fid */
+	vfs_dmapiops_t		vfs_dmapiops;	/* data migration */
+	vfs_quotactl_t		vfs_quotactl;	/* disk quota */
+	vfs_init_vnode_t	vfs_init_vnode;	/* initialize a new vnode */
+	vfs_force_shutdown_t	vfs_force_shutdown;	/* crash and burn */
+	vfs_freeze_t		vfs_freeze;	/* freeze fs for snapshot */
+} vfsops_t;
+
+/*
+ * VFS's.  Operates on vfs structure pointers (starts at bhv head).
+ */
+#define VHEAD(v)			((v)->vfs_fbhv)
+#define VFS_MOUNT(v, ma,cr, rv)		((rv) = vfs_mount(VHEAD(v), ma,cr))
+#define VFS_PARSEARGS(v, o,ma,f, rv)	((rv) = vfs_parseargs(VHEAD(v), o,ma,f))
+#define VFS_SHOWARGS(v, m, rv)		((rv) = vfs_showargs(VHEAD(v), m))
+#define VFS_UNMOUNT(v, f, cr, rv)	((rv) = vfs_unmount(VHEAD(v), f,cr))
+#define VFS_MNTUPDATE(v, fl, args, rv)	((rv) = vfs_mntupdate(VHEAD(v), fl, args))
+#define VFS_ROOT(v, vpp, rv)		((rv) = vfs_root(VHEAD(v), vpp))
+#define VFS_STATVFS(v, sp,vp, rv)	((rv) = vfs_statvfs(VHEAD(v), sp,vp))
+#define VFS_SYNC(v, flag,cr, rv)	((rv) = vfs_sync(VHEAD(v), flag,cr))
+#define VFS_VGET(v, vpp,fidp, rv)	((rv) = vfs_vget(VHEAD(v), vpp,fidp))
+#define VFS_DMAPIOPS(v, p, rv)		((rv) = vfs_dmapiops(VHEAD(v), p))
+#define VFS_QUOTACTL(v, c,id,p, rv)	((rv) = vfs_quotactl(VHEAD(v), c,id,p))
+#define VFS_INIT_VNODE(v, vp,b,ul)	( vfs_init_vnode(VHEAD(v), vp,b,ul) )
+#define VFS_FORCE_SHUTDOWN(v, fl,f,l)	( vfs_force_shutdown(VHEAD(v), fl,f,l) )
+#define VFS_FREEZE(v)			( vfs_freeze(VHEAD(v)) )
+
+/*
+ * PVFS's.  Operates on behavior descriptor pointers.
+ */
+#define PVFS_MOUNT(b, ma,cr, rv)	((rv) = vfs_mount(b, ma,cr))
+#define PVFS_PARSEARGS(b, o,ma,f, rv)	((rv) = vfs_parseargs(b, o,ma,f))
+#define PVFS_SHOWARGS(b, m, rv)		((rv) = vfs_showargs(b, m))
+#define PVFS_UNMOUNT(b, f,cr, rv)	((rv) = vfs_unmount(b, f,cr))
+#define PVFS_MNTUPDATE(b, fl, args, rv)	((rv) = vfs_mntupdate(b, fl, args))
+#define PVFS_ROOT(b, vpp, rv)		((rv) = vfs_root(b, vpp))
+#define PVFS_STATVFS(b, sp,vp, rv)	((rv) = vfs_statvfs(b, sp,vp))
+#define PVFS_SYNC(b, flag,cr, rv)	((rv) = vfs_sync(b, flag,cr))
+#define PVFS_VGET(b, vpp,fidp, rv)	((rv) = vfs_vget(b, vpp,fidp))
+#define PVFS_DMAPIOPS(b, p, rv)		((rv) = vfs_dmapiops(b, p))
+#define PVFS_QUOTACTL(b, c,id,p, rv)	((rv) = vfs_quotactl(b, c,id,p))
+#define PVFS_INIT_VNODE(b, vp,b2,ul)	( vfs_init_vnode(b, vp,b2,ul) )
+#define PVFS_FORCE_SHUTDOWN(b, fl,f,l)	( vfs_force_shutdown(b, fl,f,l) )
+#define PVFS_FREEZE(b)			( vfs_freeze(b) )
+
+extern int vfs_mount(bhv_desc_t *, struct xfs_mount_args *, struct cred *);
+extern int vfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int);
+extern int vfs_showargs(bhv_desc_t *, struct seq_file *);
+extern int vfs_unmount(bhv_desc_t *, int, struct cred *);
+extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *);
+extern int vfs_root(bhv_desc_t *, struct vnode **);
+extern int vfs_statvfs(bhv_desc_t *, xfs_statfs_t *, struct vnode *);
+extern int vfs_sync(bhv_desc_t *, int, struct cred *);
+extern int vfs_vget(bhv_desc_t *, struct vnode **, struct fid *);
+extern int vfs_dmapiops(bhv_desc_t *, caddr_t);
+extern int vfs_quotactl(bhv_desc_t *, int, int, caddr_t);
+extern void vfs_init_vnode(bhv_desc_t *, struct vnode *, bhv_desc_t *, int);
+extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int);
+extern void vfs_freeze(bhv_desc_t *);
+
+typedef struct bhv_vfsops {
+	struct vfsops		bhv_common;
+	void *			bhv_custom;
+} bhv_vfsops_t;
+
+#define vfs_bhv_lookup(v, id)	( bhv_lookup_range(&(v)->vfs_bh, (id), (id)) )
+#define vfs_bhv_custom(b)	( ((bhv_vfsops_t *)BHV_OPS(b))->bhv_custom )
+#define vfs_bhv_set_custom(b,o)	( (b)->bhv_custom = (void *)(o))
+#define vfs_bhv_clr_custom(b)	( (b)->bhv_custom = NULL )
+
+extern vfs_t *vfs_allocate(void);
+extern void vfs_deallocate(vfs_t *);
+extern void vfs_insertops(vfs_t *, bhv_vfsops_t *);
+extern void vfs_insertbhv(vfs_t *, bhv_desc_t *, vfsops_t *, void *);
+
+extern void bhv_insert_all_vfsops(struct vfs *);
+extern void bhv_remove_all_vfsops(struct vfs *, int);
+extern void bhv_remove_vfsops(struct vfs *, int);
+
+#endif	/* __XFS_VFS_H__ */
diff -Nru a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_vnode.c	Tue Jun 15 22:20:39 2004
@@ -0,0 +1,442 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ */
+
+#include "xfs.h"
+
+
+uint64_t vn_generation;		/* vnode generation number */
+spinlock_t vnumber_lock = SPIN_LOCK_UNLOCKED;
+
+/*
+ * Dedicated vnode inactive/reclaim sync semaphores.
+ * Prime number of hash buckets since address is used as the key.
+ */
+#define NVSYNC                  37
+#define vptosync(v)             (&vsync[((unsigned long)v) % NVSYNC])
+sv_t vsync[NVSYNC];
+
+/*
+ * Translate stat(2) file types to vnode types and vice versa.
+ * Aware of numeric order of S_IFMT and vnode type values.
+ */
+enum vtype iftovt_tab[] = {
+	VNON, VFIFO, VCHR, VNON, VDIR, VNON, VBLK, VNON,
+	VREG, VNON, VLNK, VNON, VSOCK, VNON, VNON, VNON
+};
+
+u_short vttoif_tab[] = {
+	0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, 0, S_IFSOCK
+};
+
+
+void
+vn_init(void)
+{
+	register sv_t *svp;
+	register int i;
+
+	for (svp = vsync, i = 0; i < NVSYNC; i++, svp++)
+		init_sv(svp, SV_DEFAULT, "vsy", i);
+}
+
+/*
+ * Clean a vnode of filesystem-specific data and prepare it for reuse.
+ */
+STATIC int
+vn_reclaim(
+	struct vnode	*vp)
+{
+	int		error;
+
+	XFS_STATS_INC(vn_reclaim);
+	vn_trace_entry(vp, "vn_reclaim", (inst_t *)__return_address);
+
+	/*
+	 * Only make the VOP_RECLAIM call if there are behaviors
+	 * to call.
+	 */
+	if (vp->v_fbhv) {
+		VOP_RECLAIM(vp, error);
+		if (error)
+			return -error;
+	}
+	ASSERT(vp->v_fbhv == NULL);
+
+	VN_LOCK(vp);
+	vp->v_flag &= (VRECLM|VWAIT);
+	VN_UNLOCK(vp, 0);
+
+	vp->v_type = VNON;
+	vp->v_fbhv = NULL;
+
+#ifdef XFS_VNODE_TRACE
+	ktrace_free(vp->v_trace);
+	vp->v_trace = NULL;
+#endif
+
+	return 0;
+}
+
+STATIC void
+vn_wakeup(
+	struct vnode	*vp)
+{
+	VN_LOCK(vp);
+	if (vp->v_flag & VWAIT)
+		sv_broadcast(vptosync(vp));
+	vp->v_flag &= ~(VRECLM|VWAIT|VMODIFIED);
+	VN_UNLOCK(vp, 0);
+}
+
+int
+vn_wait(
+	struct vnode	*vp)
+{
+	VN_LOCK(vp);
+	if (vp->v_flag & (VINACT | VRECLM)) {
+		vp->v_flag |= VWAIT;
+		sv_wait(vptosync(vp), PINOD, &vp->v_lock, 0);
+		return 1;
+	}
+	VN_UNLOCK(vp, 0);
+	return 0;
+}
+
+struct vnode *
+vn_initialize(
+	struct inode	*inode)
+{
+	struct vnode	*vp = LINVFS_GET_VP(inode);
+
+	XFS_STATS_INC(vn_active);
+	XFS_STATS_INC(vn_alloc);
+
+	vp->v_flag = VMODIFIED;
+	spinlock_init(&vp->v_lock, "v_lock");
+
+	spin_lock(&vnumber_lock);
+	if (!++vn_generation)	/* v_number shouldn't be zero */
+		vn_generation++;
+	vp->v_number = vn_generation;
+	spin_unlock(&vnumber_lock);
+
+	ASSERT(VN_CACHED(vp) == 0);
+
+	/* Initialize the first behavior and the behavior chain head. */
+	vn_bhv_head_init(VN_BHV_HEAD(vp), "vnode");
+
+#ifdef	XFS_VNODE_TRACE
+	vp->v_trace = ktrace_alloc(VNODE_TRACE_SIZE, KM_SLEEP);
+	printk("Allocated VNODE_TRACE at 0x%p\n", vp->v_trace);
+#endif	/* XFS_VNODE_TRACE */
+
+	vn_trace_exit(vp, "vn_initialize", (inst_t *)__return_address);
+	return vp;
+}
+
+/*
+ * Get a reference on a vnode.
+ */
+vnode_t *
+vn_get(
+	struct vnode	*vp,
+	vmap_t		*vmap)
+{
+	struct inode	*inode;
+
+	XFS_STATS_INC(vn_get);
+	inode = LINVFS_GET_IP(vp);
+	if (inode->i_state & I_FREEING)
+		return NULL;
+
+	inode = ilookup(vmap->v_vfsp->vfs_super, vmap->v_ino);
+	if (!inode)	/* Inode not present */
+		return NULL;
+
+	vn_trace_exit(vp, "vn_get", (inst_t *)__return_address);
+
+	return vp;
+}
+
+/*
+ * Revalidate the Linux inode from the vnode.
+ */
+int
+vn_revalidate(
+	struct vnode	*vp)
+{
+	struct inode	*inode;
+	vattr_t		va;
+	int		error;
+
+	vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address);
+	ASSERT(vp->v_fbhv != NULL);
+
+	va.va_mask = XFS_AT_STAT|XFS_AT_XFLAGS;
+	VOP_GETATTR(vp, &va, 0, NULL, error);
+	if (!error) {
+		inode = LINVFS_GET_IP(vp);
+		inode->i_mode	    = VTTOIF(va.va_type) | va.va_mode;
+		inode->i_nlink	    = va.va_nlink;
+		inode->i_uid	    = va.va_uid;
+		inode->i_gid	    = va.va_gid;
+		inode->i_blocks	    = va.va_nblocks;
+		inode->i_mtime	    = va.va_mtime;
+		inode->i_ctime	    = va.va_ctime;
+		inode->i_atime	    = va.va_atime;
+		if (va.va_xflags & XFS_XFLAG_IMMUTABLE)
+			inode->i_flags |= S_IMMUTABLE;
+		else
+			inode->i_flags &= ~S_IMMUTABLE;
+		if (va.va_xflags & XFS_XFLAG_APPEND)
+			inode->i_flags |= S_APPEND;
+		else
+			inode->i_flags &= ~S_APPEND;
+		if (va.va_xflags & XFS_XFLAG_SYNC)
+			inode->i_flags |= S_SYNC;
+		else
+			inode->i_flags &= ~S_SYNC;
+		if (va.va_xflags & XFS_XFLAG_NOATIME)
+			inode->i_flags |= S_NOATIME;
+		else
+			inode->i_flags &= ~S_NOATIME;
+		VUNMODIFY(vp);
+	}
+	return -error;
+}
+
+/*
+ * purge a vnode from the cache
+ * At this point the vnode is guaranteed to have no references (vn_count == 0)
+ * The caller has to make sure that there are no ways someone could
+ * get a handle (via vn_get) on the vnode (usually done via a mount/vfs lock).
+ */
+void
+vn_purge(
+	struct vnode	*vp,
+	vmap_t		*vmap)
+{
+	vn_trace_entry(vp, "vn_purge", (inst_t *)__return_address);
+
+again:
+	/*
+	 * Check whether vp has already been reclaimed since our caller
+	 * sampled its version while holding a filesystem cache lock that
+	 * its VOP_RECLAIM function acquires.
+	 */
+	VN_LOCK(vp);
+	if (vp->v_number != vmap->v_number) {
+		VN_UNLOCK(vp, 0);
+		return;
+	}
+
+	/*
+	 * If vp is being reclaimed or inactivated, wait until it is inert,
+	 * then proceed.  Can't assume that vnode is actually reclaimed
+	 * just because the reclaimed flag is asserted -- a vn_alloc
+	 * reclaim can fail.
+	 */
+	if (vp->v_flag & (VINACT | VRECLM)) {
+		ASSERT(vn_count(vp) == 0);
+		vp->v_flag |= VWAIT;
+		sv_wait(vptosync(vp), PINOD, &vp->v_lock, 0);
+		goto again;
+	}
+
+	/*
+	 * Another process could have raced in and gotten this vnode...
+	 */
+	if (vn_count(vp) > 0) {
+		VN_UNLOCK(vp, 0);
+		return;
+	}
+
+	XFS_STATS_DEC(vn_active);
+	vp->v_flag |= VRECLM;
+	VN_UNLOCK(vp, 0);
+
+	/*
+	 * Call VOP_RECLAIM and clean vp. The FSYNC_INVAL flag tells
+	 * vp's filesystem to flush and invalidate all cached resources.
+	 * When vn_reclaim returns, vp should have no private data,
+	 * either in a system cache or attached to v_data.
+	 */
+	if (vn_reclaim(vp) != 0)
+		panic("vn_purge: cannot reclaim");
+
+	/*
+	 * Wakeup anyone waiting for vp to be reclaimed.
+	 */
+	vn_wakeup(vp);
+}
+
+/*
+ * Add a reference to a referenced vnode.
+ */
+struct vnode *
+vn_hold(
+	struct vnode	*vp)
+{
+	struct inode	*inode;
+
+	XFS_STATS_INC(vn_hold);
+
+	VN_LOCK(vp);
+	inode = igrab(LINVFS_GET_IP(vp));
+	ASSERT(inode);
+	VN_UNLOCK(vp, 0);
+
+	return vp;
+}
+
+/*
+ *  Call VOP_INACTIVE on last reference.
+ */
+void
+vn_rele(
+	struct vnode	*vp)
+{
+	int		vcnt;
+	int		cache;
+
+	XFS_STATS_INC(vn_rele);
+
+	VN_LOCK(vp);
+
+	vn_trace_entry(vp, "vn_rele", (inst_t *)__return_address);
+	vcnt = vn_count(vp);
+
+	/*
+	 * Since we always get called from put_inode we know
+	 * that i_count won't be decremented after we
+	 * return.
+	 */
+	if (!vcnt) {
+		/*
+		 * As soon as we turn this on, noone can find us in vn_get
+		 * until we turn off VINACT or VRECLM
+		 */
+		vp->v_flag |= VINACT;
+		VN_UNLOCK(vp, 0);
+
+		/*
+		 * Do not make the VOP_INACTIVE call if there
+		 * are no behaviors attached to the vnode to call.
+		 */
+		if (vp->v_fbhv)
+			VOP_INACTIVE(vp, NULL, cache);
+
+		VN_LOCK(vp);
+		if (vp->v_flag & VWAIT)
+			sv_broadcast(vptosync(vp));
+
+		vp->v_flag &= ~(VINACT|VWAIT|VRECLM|VMODIFIED);
+	}
+
+	VN_UNLOCK(vp, 0);
+
+	vn_trace_exit(vp, "vn_rele", (inst_t *)__return_address);
+}
+
+/*
+ * Finish the removal of a vnode.
+ */
+void
+vn_remove(
+	struct vnode	*vp)
+{
+	vmap_t		vmap;
+
+	/* Make sure we don't do this to the same vnode twice */
+	if (!(vp->v_fbhv))
+		return;
+
+	XFS_STATS_INC(vn_remove);
+	vn_trace_exit(vp, "vn_remove", (inst_t *)__return_address);
+
+	/*
+	 * After the following purge the vnode
+	 * will no longer exist.
+	 */
+	VMAP(vp, vmap);
+	vn_purge(vp, &vmap);
+}
+
+
+#ifdef	XFS_VNODE_TRACE
+
+#define KTRACE_ENTER(vp, vk, s, line, ra)			\
+	ktrace_enter(	(vp)->v_trace,				\
+/*  0 */		(void *)(__psint_t)(vk),		\
+/*  1 */		(void *)(s),				\
+/*  2 */		(void *)(__psint_t) line,		\
+/*  3 */		(void *)(vn_count(vp)), \
+/*  4 */		(void *)(ra),				\
+/*  5 */		(void *)(__psunsigned_t)(vp)->v_flag,	\
+/*  6 */		(void *)(__psint_t)smp_processor_id(),	\
+/*  7 */		(void *)(__psint_t)(current->pid),	\
+/*  8 */		(void *)__return_address,		\
+/*  9 */		0, 0, 0, 0, 0, 0, 0)
+
+/*
+ * Vnode tracing code.
+ */
+void
+vn_trace_entry(vnode_t *vp, char *func, inst_t *ra)
+{
+	KTRACE_ENTER(vp, VNODE_KTRACE_ENTRY, func, 0, ra);
+}
+
+void
+vn_trace_exit(vnode_t *vp, char *func, inst_t *ra)
+{
+	KTRACE_ENTER(vp, VNODE_KTRACE_EXIT, func, 0, ra);
+}
+
+void
+vn_trace_hold(vnode_t *vp, char *file, int line, inst_t *ra)
+{
+	KTRACE_ENTER(vp, VNODE_KTRACE_HOLD, file, line, ra);
+}
+
+void
+vn_trace_ref(vnode_t *vp, char *file, int line, inst_t *ra)
+{
+	KTRACE_ENTER(vp, VNODE_KTRACE_REF, file, line, ra);
+}
+
+void
+vn_trace_rele(vnode_t *vp, char *file, int line, inst_t *ra)
+{
+	KTRACE_ENTER(vp, VNODE_KTRACE_RELE, file, line, ra);
+}
+#endif	/* XFS_VNODE_TRACE */
diff -Nru a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/fs/xfs/linux-2.6/xfs_vnode.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,651 @@
+/*
+ * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it is
+ * free of the rightful claim of any third person regarding infringement
+ * or the like.  Any license provided herein, whether implied or
+ * otherwise, applies only to this software file.  Patent licenses, if
+ * any, provided herein do not apply to combinations of this program with
+ * other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
+ * Mountain View, CA  94043, or:
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
+ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ *
+ * Portions Copyright (c) 1989, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS 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 REGENTS OR CONTRIBUTORS 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 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef __XFS_VNODE_H__
+#define __XFS_VNODE_H__
+
+struct uio;
+struct file;
+struct vattr;
+struct xfs_iomap;
+struct attrlist_cursor_kern;
+
+/*
+ * Vnode types.  VNON means no type.
+ */
+enum vtype	{ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VFIFO, VBAD, VSOCK };
+
+typedef xfs_ino_t vnumber_t;
+typedef struct dentry vname_t;
+typedef bhv_head_t vn_bhv_head_t;
+
+/*
+ * MP locking protocols:
+ *	v_flag, v_vfsp				VN_LOCK/VN_UNLOCK
+ *	v_type					read-only or fs-dependent
+ */
+typedef struct vnode {
+	__u32		v_flag;			/* vnode flags (see below) */
+	enum vtype	v_type;			/* vnode type */
+	struct vfs	*v_vfsp;		/* ptr to containing VFS */
+	vnumber_t	v_number;		/* in-core vnode number */
+	vn_bhv_head_t	v_bh;			/* behavior head */
+	spinlock_t	v_lock;			/* VN_LOCK/VN_UNLOCK */
+	struct inode	v_inode;		/* Linux inode */
+#ifdef XFS_VNODE_TRACE
+	struct ktrace	*v_trace;		/* trace header structure    */
+#endif
+} vnode_t;
+
+#define v_fbhv			v_bh.bh_first	       /* first behavior */
+#define v_fops			v_bh.bh_first->bd_ops  /* first behavior ops */
+
+#define VNODE_POSITION_BASE	BHV_POSITION_BASE	/* chain bottom */
+#define VNODE_POSITION_TOP	BHV_POSITION_TOP	/* chain top */
+#define VNODE_POSITION_INVALID	BHV_POSITION_INVALID	/* invalid pos. num */
+
+typedef enum {
+	VN_BHV_UNKNOWN,		/* not specified */
+	VN_BHV_XFS,		/* xfs */
+	VN_BHV_DM,		/* data migration */
+	VN_BHV_QM,		/* quota manager */
+	VN_BHV_IO,		/* IO path */
+	VN_BHV_END		/* housekeeping end-of-range */
+} vn_bhv_t;
+
+#define VNODE_POSITION_XFS	(VNODE_POSITION_BASE)
+#define VNODE_POSITION_DM	(VNODE_POSITION_BASE+10)
+#define VNODE_POSITION_QM	(VNODE_POSITION_BASE+20)
+#define VNODE_POSITION_IO	(VNODE_POSITION_BASE+30)
+
+/*
+ * Macros for dealing with the behavior descriptor inside of the vnode.
+ */
+#define BHV_TO_VNODE(bdp)	((vnode_t *)BHV_VOBJ(bdp))
+#define BHV_TO_VNODE_NULL(bdp)	((vnode_t *)BHV_VOBJNULL(bdp))
+
+#define VN_BHV_HEAD(vp)			((bhv_head_t *)(&((vp)->v_bh)))
+#define vn_bhv_head_init(bhp,name)	bhv_head_init(bhp,name)
+#define vn_bhv_remove(bhp,bdp)		bhv_remove(bhp,bdp)
+#define vn_bhv_lookup(bhp,ops)		bhv_lookup(bhp,ops)
+#define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops)
+
+/*
+ * Vnode to Linux inode mapping.
+ */
+#define LINVFS_GET_VP(inode)	((vnode_t *)list_entry(inode, vnode_t, v_inode))
+#define LINVFS_GET_IP(vp)	(&(vp)->v_inode)
+
+/*
+ * Convert between vnode types and inode formats (since POSIX.1
+ * defines mode word of stat structure in terms of inode formats).
+ */
+extern enum vtype	iftovt_tab[];
+extern u_short		vttoif_tab[];
+#define IFTOVT(mode)	(iftovt_tab[((mode) & S_IFMT) >> 12])
+#define VTTOIF(indx)	(vttoif_tab[(int)(indx)])
+#define MAKEIMODE(indx, mode)	(int)(VTTOIF(indx) | (mode))
+
+
+/*
+ * Vnode flags.
+ */
+#define VINACT		       0x1	/* vnode is being inactivated	*/
+#define VRECLM		       0x2	/* vnode is being reclaimed	*/
+#define VWAIT		       0x4	/* waiting for VINACT/VRECLM to end */
+#define VMODIFIED	       0x8	/* XFS inode state possibly differs */
+					/* to the Linux inode state.	*/
+
+/*
+ * Values for the VOP_RWLOCK and VOP_RWUNLOCK flags parameter.
+ */
+typedef enum vrwlock {
+	VRWLOCK_NONE,
+	VRWLOCK_READ,
+	VRWLOCK_WRITE,
+	VRWLOCK_WRITE_DIRECT,
+	VRWLOCK_TRY_READ,
+	VRWLOCK_TRY_WRITE
+} vrwlock_t;
+
+/*
+ * Return values for VOP_INACTIVE.  A return value of
+ * VN_INACTIVE_NOCACHE implies that the file system behavior
+ * has disassociated its state and bhv_desc_t from the vnode.
+ */
+#define	VN_INACTIVE_CACHE	0
+#define	VN_INACTIVE_NOCACHE	1
+
+/*
+ * Values for the cmd code given to VOP_VNODE_CHANGE.
+ */
+typedef enum vchange {
+	VCHANGE_FLAGS_FRLOCKS		= 0,
+	VCHANGE_FLAGS_ENF_LOCKING	= 1,
+	VCHANGE_FLAGS_TRUNCATED		= 2,
+	VCHANGE_FLAGS_PAGE_DIRTY	= 3,
+	VCHANGE_FLAGS_IOEXCL_COUNT	= 4
+} vchange_t;
+
+
+typedef int	(*vop_open_t)(bhv_desc_t *, struct cred *);
+typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct kiocb *,
+				const struct iovec *, unsigned int,
+				loff_t *, int, struct cred *);
+typedef ssize_t (*vop_write_t)(bhv_desc_t *, struct kiocb *,
+				const struct iovec *, unsigned int,
+				loff_t *, int, struct cred *);
+typedef ssize_t (*vop_sendfile_t)(bhv_desc_t *, struct file *,
+				loff_t *, int, size_t, read_actor_t,
+				void *, struct cred *);
+typedef int	(*vop_ioctl_t)(bhv_desc_t *, struct inode *, struct file *,
+				int, unsigned int, unsigned long);
+typedef int	(*vop_getattr_t)(bhv_desc_t *, struct vattr *, int,
+				struct cred *);
+typedef int	(*vop_setattr_t)(bhv_desc_t *, struct vattr *, int,
+				struct cred *);
+typedef int	(*vop_access_t)(bhv_desc_t *, int, struct cred *);
+typedef int	(*vop_lookup_t)(bhv_desc_t *, vname_t *, vnode_t **,
+				int, vnode_t *, struct cred *);
+typedef int	(*vop_create_t)(bhv_desc_t *, vname_t *, struct vattr *,
+				vnode_t **, struct cred *);
+typedef int	(*vop_remove_t)(bhv_desc_t *, vname_t *, struct cred *);
+typedef int	(*vop_link_t)(bhv_desc_t *, vnode_t *, vname_t *,
+				struct cred *);
+typedef int	(*vop_rename_t)(bhv_desc_t *, vname_t *, vnode_t *, vname_t *,
+				struct cred *);
+typedef int	(*vop_mkdir_t)(bhv_desc_t *, vname_t *, struct vattr *,
+				vnode_t **, struct cred *);
+typedef int	(*vop_rmdir_t)(bhv_desc_t *, vname_t *, struct cred *);
+typedef int	(*vop_readdir_t)(bhv_desc_t *, struct uio *, struct cred *,
+				int *);
+typedef int	(*vop_symlink_t)(bhv_desc_t *, vname_t *, struct vattr *,
+				char *, vnode_t **, struct cred *);
+typedef int	(*vop_readlink_t)(bhv_desc_t *, struct uio *, int,
+				struct cred *);
+typedef int	(*vop_fsync_t)(bhv_desc_t *, int, struct cred *,
+				xfs_off_t, xfs_off_t);
+typedef int	(*vop_inactive_t)(bhv_desc_t *, struct cred *);
+typedef int	(*vop_fid2_t)(bhv_desc_t *, struct fid *);
+typedef int	(*vop_release_t)(bhv_desc_t *);
+typedef int	(*vop_rwlock_t)(bhv_desc_t *, vrwlock_t);
+typedef void	(*vop_rwunlock_t)(bhv_desc_t *, vrwlock_t);
+typedef int	(*vop_bmap_t)(bhv_desc_t *, xfs_off_t, ssize_t, int,
+				struct xfs_iomap *, int *);
+typedef int	(*vop_reclaim_t)(bhv_desc_t *);
+typedef int	(*vop_attr_get_t)(bhv_desc_t *, char *, char *, int *, int,
+				struct cred *);
+typedef	int	(*vop_attr_set_t)(bhv_desc_t *, char *, char *, int, int,
+				struct cred *);
+typedef	int	(*vop_attr_remove_t)(bhv_desc_t *, char *, int, struct cred *);
+typedef	int	(*vop_attr_list_t)(bhv_desc_t *, char *, int, int,
+				struct attrlist_cursor_kern *, struct cred *);
+typedef void	(*vop_link_removed_t)(bhv_desc_t *, vnode_t *, int);
+typedef void	(*vop_vnode_change_t)(bhv_desc_t *, vchange_t, __psint_t);
+typedef void	(*vop_ptossvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
+typedef void	(*vop_pflushinvalvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int);
+typedef int	(*vop_pflushvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t,
+				uint64_t, int);
+typedef int	(*vop_iflush_t)(bhv_desc_t *, int);
+
+
+typedef struct vnodeops {
+	bhv_position_t  vn_position;    /* position within behavior chain */
+	vop_open_t		vop_open;
+	vop_read_t		vop_read;
+	vop_write_t		vop_write;
+	vop_sendfile_t		vop_sendfile;
+	vop_ioctl_t		vop_ioctl;
+	vop_getattr_t		vop_getattr;
+	vop_setattr_t		vop_setattr;
+	vop_access_t		vop_access;
+	vop_lookup_t		vop_lookup;
+	vop_create_t		vop_create;
+	vop_remove_t		vop_remove;
+	vop_link_t		vop_link;
+	vop_rename_t		vop_rename;
+	vop_mkdir_t		vop_mkdir;
+	vop_rmdir_t		vop_rmdir;
+	vop_readdir_t		vop_readdir;
+	vop_symlink_t		vop_symlink;
+	vop_readlink_t		vop_readlink;
+	vop_fsync_t		vop_fsync;
+	vop_inactive_t		vop_inactive;
+	vop_fid2_t		vop_fid2;
+	vop_rwlock_t		vop_rwlock;
+	vop_rwunlock_t		vop_rwunlock;
+	vop_bmap_t		vop_bmap;
+	vop_reclaim_t		vop_reclaim;
+	vop_attr_get_t		vop_attr_get;
+	vop_attr_set_t		vop_attr_set;
+	vop_attr_remove_t	vop_attr_remove;
+	vop_attr_list_t		vop_attr_list;
+	vop_link_removed_t	vop_link_removed;
+	vop_vnode_change_t	vop_vnode_change;
+	vop_ptossvp_t		vop_tosspages;
+	vop_pflushinvalvp_t	vop_flushinval_pages;
+	vop_pflushvp_t		vop_flush_pages;
+	vop_release_t		vop_release;
+	vop_iflush_t		vop_iflush;
+} vnodeops_t;
+
+/*
+ * VOP's.
+ */
+#define _VOP_(op, vp)	(*((vnodeops_t *)(vp)->v_fops)->op)
+
+#define VOP_READ(vp,file,iov,segs,offset,ioflags,cr,rv)			\
+	rv = _VOP_(vop_read, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr)
+#define VOP_WRITE(vp,file,iov,segs,offset,ioflags,cr,rv)		\
+	rv = _VOP_(vop_write, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr)
+#define VOP_SENDFILE(vp,f,off,ioflags,cnt,act,targ,cr,rv)		\
+	rv = _VOP_(vop_sendfile, vp)((vp)->v_fbhv,f,off,ioflags,cnt,act,targ,cr)
+#define VOP_BMAP(vp,of,sz,rw,b,n,rv)					\
+	rv = _VOP_(vop_bmap, vp)((vp)->v_fbhv,of,sz,rw,b,n)
+#define VOP_OPEN(vp, cr, rv)						\
+	rv = _VOP_(vop_open, vp)((vp)->v_fbhv, cr)
+#define VOP_GETATTR(vp, vap, f, cr, rv)					\
+	rv = _VOP_(vop_getattr, vp)((vp)->v_fbhv, vap, f, cr)
+#define	VOP_SETATTR(vp, vap, f, cr, rv)					\
+	rv = _VOP_(vop_setattr, vp)((vp)->v_fbhv, vap, f, cr)
+#define	VOP_ACCESS(vp, mode, cr, rv)					\
+	rv = _VOP_(vop_access, vp)((vp)->v_fbhv, mode, cr)
+#define	VOP_LOOKUP(vp,d,vpp,f,rdir,cr,rv)				\
+	rv = _VOP_(vop_lookup, vp)((vp)->v_fbhv,d,vpp,f,rdir,cr)
+#define VOP_CREATE(dvp,d,vap,vpp,cr,rv)					\
+	rv = _VOP_(vop_create, dvp)((dvp)->v_fbhv,d,vap,vpp,cr)
+#define VOP_REMOVE(dvp,d,cr,rv)						\
+	rv = _VOP_(vop_remove, dvp)((dvp)->v_fbhv,d,cr)
+#define	VOP_LINK(tdvp,fvp,d,cr,rv)					\
+	rv = _VOP_(vop_link, tdvp)((tdvp)->v_fbhv,fvp,d,cr)
+#define	VOP_RENAME(fvp,fnm,tdvp,tnm,cr,rv)				\
+	rv = _VOP_(vop_rename, fvp)((fvp)->v_fbhv,fnm,tdvp,tnm,cr)
+#define	VOP_MKDIR(dp,d,vap,vpp,cr,rv)					\
+	rv = _VOP_(vop_mkdir, dp)((dp)->v_fbhv,d,vap,vpp,cr)
+#define	VOP_RMDIR(dp,d,cr,rv)	 					\
+	rv = _VOP_(vop_rmdir, dp)((dp)->v_fbhv,d,cr)
+#define	VOP_READDIR(vp,uiop,cr,eofp,rv)					\
+	rv = _VOP_(vop_readdir, vp)((vp)->v_fbhv,uiop,cr,eofp)
+#define	VOP_SYMLINK(dvp,d,vap,tnm,vpp,cr,rv)				\
+	rv = _VOP_(vop_symlink, dvp) ((dvp)->v_fbhv,d,vap,tnm,vpp,cr)
+#define	VOP_READLINK(vp,uiop,fl,cr,rv)					\
+	rv = _VOP_(vop_readlink, vp)((vp)->v_fbhv,uiop,fl,cr)
+#define	VOP_FSYNC(vp,f,cr,b,e,rv)					\
+	rv = _VOP_(vop_fsync, vp)((vp)->v_fbhv,f,cr,b,e)
+#define VOP_INACTIVE(vp, cr, rv)					\
+	rv = _VOP_(vop_inactive, vp)((vp)->v_fbhv, cr)
+#define VOP_RELEASE(vp, rv)						\
+	rv = _VOP_(vop_release, vp)((vp)->v_fbhv)
+#define VOP_FID2(vp, fidp, rv)						\
+	rv = _VOP_(vop_fid2, vp)((vp)->v_fbhv, fidp)
+#define VOP_RWLOCK(vp,i)						\
+	(void)_VOP_(vop_rwlock, vp)((vp)->v_fbhv, i)
+#define VOP_RWLOCK_TRY(vp,i)						\
+	_VOP_(vop_rwlock, vp)((vp)->v_fbhv, i)
+#define VOP_RWUNLOCK(vp,i)						\
+	(void)_VOP_(vop_rwunlock, vp)((vp)->v_fbhv, i)
+#define VOP_FRLOCK(vp,c,fl,flags,offset,fr,rv)				\
+	rv = _VOP_(vop_frlock, vp)((vp)->v_fbhv,c,fl,flags,offset,fr)
+#define VOP_RECLAIM(vp, rv)						\
+	rv = _VOP_(vop_reclaim, vp)((vp)->v_fbhv)
+#define VOP_ATTR_GET(vp, name, val, vallenp, fl, cred, rv)		\
+	rv = _VOP_(vop_attr_get, vp)((vp)->v_fbhv,name,val,vallenp,fl,cred)
+#define	VOP_ATTR_SET(vp, name, val, vallen, fl, cred, rv)		\
+	rv = _VOP_(vop_attr_set, vp)((vp)->v_fbhv,name,val,vallen,fl,cred)
+#define	VOP_ATTR_REMOVE(vp, name, flags, cred, rv)			\
+	rv = _VOP_(vop_attr_remove, vp)((vp)->v_fbhv,name,flags,cred)
+#define	VOP_ATTR_LIST(vp, buf, buflen, fl, cursor, cred, rv)		\
+	rv = _VOP_(vop_attr_list, vp)((vp)->v_fbhv,buf,buflen,fl,cursor,cred)
+#define VOP_LINK_REMOVED(vp, dvp, linkzero)				\
+	(void)_VOP_(vop_link_removed, vp)((vp)->v_fbhv, dvp, linkzero)
+#define VOP_VNODE_CHANGE(vp, cmd, val)					\
+	(void)_VOP_(vop_vnode_change, vp)((vp)->v_fbhv,cmd,val)
+/*
+ * These are page cache functions that now go thru VOPs.
+ * 'last' parameter is unused and left in for IRIX compatibility
+ */
+#define VOP_TOSS_PAGES(vp, first, last, fiopt)				\
+	_VOP_(vop_tosspages, vp)((vp)->v_fbhv,first, last, fiopt)
+/*
+ * 'last' parameter is unused and left in for IRIX compatibility
+ */
+#define VOP_FLUSHINVAL_PAGES(vp, first, last, fiopt)			\
+	_VOP_(vop_flushinval_pages, vp)((vp)->v_fbhv,first,last,fiopt)
+/*
+ * 'last' parameter is unused and left in for IRIX compatibility
+ */
+#define VOP_FLUSH_PAGES(vp, first, last, flags, fiopt, rv)		\
+	rv = _VOP_(vop_flush_pages, vp)((vp)->v_fbhv,first,last,flags,fiopt)
+#define VOP_IOCTL(vp, inode, filp, fl, cmd, arg, rv)			\
+	rv = _VOP_(vop_ioctl, vp)((vp)->v_fbhv,inode,filp,fl,cmd,arg)
+#define VOP_IFLUSH(vp, flags, rv)					\
+	rv = _VOP_(vop_iflush, vp)((vp)->v_fbhv, flags)
+
+/*
+ * Flags for read/write calls - same values as IRIX
+ */
+#define IO_ISDIRECT	0x00004		/* bypass page cache */
+#define IO_INVIS	0x00020		/* don't update inode timestamps */
+
+/*
+ * Flags for VOP_IFLUSH call
+ */
+#define FLUSH_SYNC		1	/* wait for flush to complete	*/
+#define FLUSH_INODE		2	/* flush the inode itself	*/
+#define FLUSH_LOG		4	/* force the last log entry for
+					 * this inode out to disk	*/
+
+/*
+ * Flush/Invalidate options for VOP_TOSS_PAGES, VOP_FLUSHINVAL_PAGES and
+ *	VOP_FLUSH_PAGES.
+ */
+#define FI_NONE			0	/* none */
+#define FI_REMAPF		1	/* Do a remapf prior to the operation */
+#define FI_REMAPF_LOCKED	2	/* Do a remapf prior to the operation.
+					   Prevent VM access to the pages until
+					   the operation completes. */
+
+/*
+ * Vnode attributes.  va_mask indicates those attributes the caller
+ * wants to set or extract.
+ */
+typedef struct vattr {
+	int		va_mask;	/* bit-mask of attributes present */
+	enum vtype	va_type;	/* vnode type (for create) */
+	mode_t		va_mode;	/* file access mode and type */
+	nlink_t		va_nlink;	/* number of references to file */
+	uid_t		va_uid;		/* owner user id */
+	gid_t		va_gid;		/* owner group id */
+	xfs_ino_t	va_nodeid;	/* file id */
+	xfs_off_t	va_size;	/* file size in bytes */
+	u_long		va_blocksize;	/* blocksize preferred for i/o */
+	struct timespec	va_atime;	/* time of last access */
+	struct timespec	va_mtime;	/* time of last modification */
+	struct timespec	va_ctime;	/* time file changed */
+	u_int		va_gen;		/* generation number of file */
+	xfs_dev_t	va_rdev;	/* device the special file represents */
+	__int64_t	va_nblocks;	/* number of blocks allocated */
+	u_long		va_xflags;	/* random extended file flags */
+	u_long		va_extsize;	/* file extent size */
+	u_long		va_nextents;	/* number of extents in file */
+	u_long		va_anextents;	/* number of attr extents in file */
+	int		va_projid;	/* project id */
+} vattr_t;
+
+/*
+ * setattr or getattr attributes
+ */
+#define XFS_AT_TYPE		0x00000001
+#define XFS_AT_MODE		0x00000002
+#define XFS_AT_UID		0x00000004
+#define XFS_AT_GID		0x00000008
+#define XFS_AT_FSID		0x00000010
+#define XFS_AT_NODEID		0x00000020
+#define XFS_AT_NLINK		0x00000040
+#define XFS_AT_SIZE		0x00000080
+#define XFS_AT_ATIME		0x00000100
+#define XFS_AT_MTIME		0x00000200
+#define XFS_AT_CTIME		0x00000400
+#define XFS_AT_RDEV		0x00000800
+#define XFS_AT_BLKSIZE		0x00001000
+#define XFS_AT_NBLOCKS		0x00002000
+#define XFS_AT_VCODE		0x00004000
+#define XFS_AT_MAC		0x00008000
+#define XFS_AT_UPDATIME		0x00010000
+#define XFS_AT_UPDMTIME		0x00020000
+#define XFS_AT_UPDCTIME		0x00040000
+#define XFS_AT_ACL		0x00080000
+#define XFS_AT_CAP		0x00100000
+#define XFS_AT_INF		0x00200000
+#define XFS_AT_XFLAGS		0x00400000
+#define XFS_AT_EXTSIZE		0x00800000
+#define XFS_AT_NEXTENTS		0x01000000
+#define XFS_AT_ANEXTENTS	0x02000000
+#define XFS_AT_PROJID		0x04000000
+#define XFS_AT_SIZE_NOPERM	0x08000000
+#define XFS_AT_GENCOUNT		0x10000000
+
+#define XFS_AT_ALL	(XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
+		XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
+		XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
+		XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|XFS_AT_MAC|\
+		XFS_AT_ACL|XFS_AT_CAP|XFS_AT_INF|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|\
+		XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_PROJID|XFS_AT_GENCOUNT)
+
+#define XFS_AT_STAT	(XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
+		XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
+		XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
+		XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_PROJID)
+
+#define XFS_AT_TIMES	(XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME)
+
+#define XFS_AT_UPDTIMES	(XFS_AT_UPDATIME|XFS_AT_UPDMTIME|XFS_AT_UPDCTIME)
+
+#define XFS_AT_NOSET	(XFS_AT_NLINK|XFS_AT_RDEV|XFS_AT_FSID|XFS_AT_NODEID|\
+		XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\
+		XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT)
+
+/*
+ *  Modes.
+ */
+#define VSUID	S_ISUID		/* set user id on execution */
+#define VSGID	S_ISGID		/* set group id on execution */
+#define VSVTX	S_ISVTX		/* save swapped text even after use */
+#define VREAD	S_IRUSR		/* read, write, execute permissions */
+#define VWRITE	S_IWUSR
+#define VEXEC	S_IXUSR
+
+#define MODEMASK S_IALLUGO	/* mode bits plus permission bits */
+
+/*
+ * Check whether mandatory file locking is enabled.
+ */
+#define MANDLOCK(vp, mode)	\
+	((vp)->v_type == VREG && ((mode) & (VSGID|(VEXEC>>3))) == VSGID)
+
+extern void	vn_init(void);
+extern int	vn_wait(struct vnode *);
+extern vnode_t	*vn_initialize(struct inode *);
+
+/*
+ * Acquiring and invalidating vnodes:
+ *
+ *	if (vn_get(vp, version, 0))
+ *		...;
+ *	vn_purge(vp, version);
+ *
+ * vn_get and vn_purge must be called with vmap_t arguments, sampled
+ * while a lock that the vnode's VOP_RECLAIM function acquires is
+ * held, to ensure that the vnode sampled with the lock held isn't
+ * recycled (VOP_RECLAIMed) or deallocated between the release of the lock
+ * and the subsequent vn_get or vn_purge.
+ */
+
+/*
+ * vnode_map structures _must_ match vn_epoch and vnode structure sizes.
+ */
+typedef struct vnode_map {
+	vfs_t		*v_vfsp;
+	vnumber_t	v_number;		/* in-core vnode number */
+	xfs_ino_t	v_ino;			/* inode #	*/
+} vmap_t;
+
+#define VMAP(vp, vmap)	{(vmap).v_vfsp	 = (vp)->v_vfsp,	\
+			 (vmap).v_number = (vp)->v_number,	\
+			 (vmap).v_ino	 = (vp)->v_inode.i_ino; }
+
+extern void	vn_purge(struct vnode *, vmap_t *);
+extern vnode_t	*vn_get(struct vnode *, vmap_t *);
+extern int	vn_revalidate(struct vnode *);
+extern void	vn_remove(struct vnode *);
+
+static inline int vn_count(struct vnode *vp)
+{
+	return atomic_read(&LINVFS_GET_IP(vp)->i_count);
+}
+
+/*
+ * Vnode reference counting functions (and macros for compatibility).
+ */
+extern vnode_t	*vn_hold(struct vnode *);
+extern void	vn_rele(struct vnode *);
+
+#if defined(XFS_VNODE_TRACE)
+#define VN_HOLD(vp)		\
+	((void)vn_hold(vp),	\
+	  vn_trace_hold(vp, __FILE__, __LINE__, (inst_t *)__return_address))
+#define VN_RELE(vp)		\
+	  (vn_trace_rele(vp, __FILE__, __LINE__, (inst_t *)__return_address), \
+	   iput(LINVFS_GET_IP(vp)))
+#else
+#define VN_HOLD(vp)		((void)vn_hold(vp))
+#define VN_RELE(vp)		(iput(LINVFS_GET_IP(vp)))
+#endif
+
+/*
+ * Vname handling macros.
+ */
+#define VNAME(dentry)		((char *) (dentry)->d_name.name)
+#define VNAMELEN(dentry)	((dentry)->d_name.len)
+#define VNAME_TO_VNODE(dentry)	(LINVFS_GET_VP((dentry)->d_inode))
+
+/*
+ * Vnode spinlock manipulation.
+ */
+#define VN_LOCK(vp)		mutex_spinlock(&(vp)->v_lock)
+#define VN_UNLOCK(vp, s)	mutex_spinunlock(&(vp)->v_lock, s)
+#define VN_FLAGSET(vp,b)	vn_flagset(vp,b)
+#define VN_FLAGCLR(vp,b)	vn_flagclr(vp,b)
+
+static __inline__ void vn_flagset(struct vnode *vp, uint flag)
+{
+	spin_lock(&vp->v_lock);
+	vp->v_flag |= flag;
+	spin_unlock(&vp->v_lock);
+}
+
+static __inline__ void vn_flagclr(struct vnode *vp, uint flag)
+{
+	spin_lock(&vp->v_lock);
+	vp->v_flag &= ~flag;
+	spin_unlock(&vp->v_lock);
+}
+
+/*
+ * Update modify/access/change times on the vnode
+ */
+#define VN_MTIMESET(vp, tvp)	(LINVFS_GET_IP(vp)->i_mtime = *(tvp))
+#define VN_ATIMESET(vp, tvp)	(LINVFS_GET_IP(vp)->i_atime = *(tvp))
+#define VN_CTIMESET(vp, tvp)	(LINVFS_GET_IP(vp)->i_ctime = *(tvp))
+
+/*
+ * Some useful predicates.
+ */
+#define VN_MAPPED(vp)	mapping_mapped(LINVFS_GET_IP(vp)->i_mapping)
+#define VN_CACHED(vp)	(LINVFS_GET_IP(vp)->i_mapping->nrpages)
+#define VN_DIRTY(vp)	mapping_tagged(LINVFS_GET_IP(vp)->i_mapping, \
+					PAGECACHE_TAG_DIRTY)
+#define VMODIFY(vp)	VN_FLAGSET(vp, VMODIFIED)
+#define VUNMODIFY(vp)	VN_FLAGCLR(vp, VMODIFIED)
+
+/*
+ * Flags to VOP_SETATTR/VOP_GETATTR.
+ */
+#define	ATTR_UTIME	0x01	/* non-default utime(2) request */
+#define	ATTR_DMI	0x08	/* invocation from a DMI function */
+#define	ATTR_LAZY	0x80	/* set/get attributes lazily */
+#define	ATTR_NONBLOCK	0x100	/* return EAGAIN if operation would block */
+
+/*
+ * Flags to VOP_FSYNC and VOP_RECLAIM.
+ */
+#define FSYNC_NOWAIT	0	/* asynchronous flush */
+#define FSYNC_WAIT	0x1	/* synchronous fsync or forced reclaim */
+#define FSYNC_INVAL	0x2	/* flush and invalidate cached data */
+#define FSYNC_DATA	0x4	/* synchronous fsync of data only */
+
+/*
+ * Tracking vnode activity.
+ */
+#if defined(XFS_VNODE_TRACE)
+
+#define	VNODE_TRACE_SIZE	16		/* number of trace entries */
+#define	VNODE_KTRACE_ENTRY	1
+#define	VNODE_KTRACE_EXIT	2
+#define	VNODE_KTRACE_HOLD	3
+#define	VNODE_KTRACE_REF	4
+#define	VNODE_KTRACE_RELE	5
+
+extern void vn_trace_entry(struct vnode *, char *, inst_t *);
+extern void vn_trace_exit(struct vnode *, char *, inst_t *);
+extern void vn_trace_hold(struct vnode *, char *, int, inst_t *);
+extern void vn_trace_ref(struct vnode *, char *, int, inst_t *);
+extern void vn_trace_rele(struct vnode *, char *, int, inst_t *);
+
+#define	VN_TRACE(vp)		\
+	vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address)
+#else
+#define	vn_trace_entry(a,b,c)
+#define	vn_trace_exit(a,b,c)
+#define	vn_trace_hold(a,b,c,d)
+#define	vn_trace_ref(a,b,c,d)
+#define	vn_trace_rele(a,b,c,d)
+#define	VN_TRACE(vp)
+#endif
+
+#endif	/* __XFS_VNODE_H__ */
diff -Nru a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
--- a/fs/xfs/quota/xfs_qm.c	Tue Jun 15 22:20:36 2004
+++ b/fs/xfs/quota/xfs_qm.c	Tue Jun 15 22:20:36 2004
@@ -1734,7 +1734,6 @@
 STATIC int
 xfs_qm_dqusage_adjust(
 	xfs_mount_t	*mp,		/* mount point for filesystem */
-	xfs_trans_t	*tp,		/* transaction pointer - NULL */
 	xfs_ino_t	ino,		/* inode number to get data for */
 	void		*buffer,	/* not used */
 	int		ubsize,		/* not used */
@@ -1766,7 +1765,7 @@
 	 * the case in all other instances. It's OK that we do this because
 	 * quotacheck is done only at mount time.
 	 */
-	if ((error = xfs_iget(mp, tp, ino, XFS_ILOCK_EXCL, &ip, bno))) {
+	if ((error = xfs_iget(mp, NULL, ino, XFS_ILOCK_EXCL, &ip, bno))) {
 		*res = BULKSTAT_RV_NOTHING;
 		return (error);
 	}
@@ -1903,7 +1902,7 @@
 		 * Iterate thru all the inodes in the file system,
 		 * adjusting the corresponding dquot counters in core.
 		 */
-		if ((error = xfs_bulkstat(mp, NULL, &lastino, &count,
+		if ((error = xfs_bulkstat(mp, &lastino, &count,
 				     xfs_qm_dqusage_adjust, NULL,
 				     structsz, NULL,
 				     BULKSTAT_FG_IGET|BULKSTAT_FG_VFSLOCKED,
diff -Nru a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
--- a/fs/xfs/quota/xfs_qm_syscalls.c	Tue Jun 15 22:20:42 2004
+++ b/fs/xfs/quota/xfs_qm_syscalls.c	Tue Jun 15 22:20:42 2004
@@ -1298,7 +1298,6 @@
 STATIC int
 xfs_qm_internalqcheck_adjust(
 	xfs_mount_t	*mp,		/* mount point for filesystem */
-	xfs_trans_t	*tp,		/* transaction pointer */
 	xfs_ino_t	ino,		/* inode number to get data for */
 	void		*buffer,	/* not used */
 	int		ubsize,		/* not used */
@@ -1327,7 +1326,7 @@
 	ipreleased = B_FALSE;
  again:
 	lock_flags = XFS_ILOCK_SHARED;
-	if ((error = xfs_iget(mp, tp, ino, lock_flags, &ip, bno))) {
+	if ((error = xfs_iget(mp, NULL, ino, lock_flags, &ip, bno))) {
 		*res = BULKSTAT_RV_NOTHING;
 		return (error);
 	}
@@ -1405,7 +1404,7 @@
 		 * Iterate thru all the inodes in the file system,
 		 * adjusting the corresponding dquot counters
 		 */
-		if ((error = xfs_bulkstat(mp, NULL, &lastino, &count,
+		if ((error = xfs_bulkstat(mp, &lastino, &count,
 				 xfs_qm_internalqcheck_adjust, NULL,
 				 0, NULL, BULKSTAT_FG_IGET, &done))) {
 			break;
diff -Nru a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h
--- a/fs/xfs/support/debug.h	Tue Jun 15 22:21:05 2004
+++ b/fs/xfs/support/debug.h	Tue Jun 15 22:21:05 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -42,6 +42,7 @@
 #define CE_PANIC        0               /* panic        */
 
 extern void icmn_err(int, char *, va_list);
+/* PRINTFLIKE2 */
 extern void cmn_err(int, char *, ...);
 
 #ifndef STATIC
diff -Nru a/fs/xfs/xfs.h b/fs/xfs/xfs.h
--- a/fs/xfs/xfs.h	Tue Jun 15 22:20:37 2004
+++ b/fs/xfs/xfs.h	Tue Jun 15 22:20:37 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -32,7 +32,7 @@
 #ifndef __XFS_H__
 #define __XFS_H__
 
-#include <linux/xfs_linux.h>
+#include <linux-2.6/xfs_linux.h>
 
 #include <xfs_fs.h> 
 
diff -Nru a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
--- a/fs/xfs/xfs_acl.c	Tue Jun 15 22:20:39 2004
+++ b/fs/xfs/xfs_acl.c	Tue Jun 15 22:20:39 2004
@@ -340,7 +340,6 @@
 		xfs_acl_vremove(vp, _ACL_TYPE_ACCESS);
 	}
 
-
 out:
 	VN_RELE(vp);
 	_ACL_FREE(xfs_acl);
@@ -354,13 +353,15 @@
 	cred_t		*cr)
 {
 	xfs_acl_t	*acl;
-	int		error;
+	int		rval;
 
 	if (!(_ACL_ALLOC(acl)))
 		return -1;
 
 	/* If the file has no ACL return -1. */
-	if (xfs_attr_fetch(ip, SGI_ACL_FILE, (char *)acl, sizeof(xfs_acl_t))) {
+	rval = sizeof(xfs_acl_t);
+	if (xfs_attr_fetch(ip, SGI_ACL_FILE, SGI_ACL_FILE_SIZE,
+			(char *)acl, &rval, ATTR_ROOT | ATTR_KERNACCESS, cr)) {
 		_ACL_FREE(acl);
 		return -1;
 	}
@@ -375,9 +376,9 @@
 	/* Synchronize ACL with mode bits */
 	xfs_acl_sync_mode(ip->i_d.di_mode, acl);
 
-	error = xfs_acl_access(ip->i_d.di_uid, ip->i_d.di_gid, acl, mode, cr);
+	rval = xfs_acl_access(ip->i_d.di_uid, ip->i_d.di_gid, acl, mode, cr);
 	_ACL_FREE(acl);
-	return error;
+	return rval;
 }
 
 STATIC int
diff -Nru a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
--- a/fs/xfs/xfs_attr.c	Tue Jun 15 22:20:41 2004
+++ b/fs/xfs/xfs_attr.c	Tue Jun 15 22:20:41 2004
@@ -115,20 +115,12 @@
  * Overall external interface routines.
  *========================================================================*/
 
-/*ARGSUSED*/
-STATIC int
-xfs_attr_get_int(xfs_inode_t *ip, char *name, char *value, int *valuelenp,
-	     int flags, int lock, struct cred *cred)
+int
+xfs_attr_fetch(xfs_inode_t *ip, char *name, int namelen,
+	       char *value, int *valuelenp, int flags, struct cred *cred)
 {
 	xfs_da_args_t   args;
 	int             error;
-	int             namelen;
-
-	ASSERT(MAXNAMELEN-1 <= 0xff);	/* length is stored in uint8 */
-	namelen = strlen(name);
-	if (namelen >= MAXNAMELEN)
-		return(EFAULT);		/* match IRIX behaviour */
-	XFS_STATS_INC(xs_attr_get);
 
 	if (XFS_FORCED_SHUTDOWN(ip->i_mount))
 		return(EIO);
@@ -138,12 +130,11 @@
 	     ip->i_d.di_anextents == 0))
 		return(ENOATTR);
 
-	if (lock) {
+	if (!(flags & ATTR_KERNACCESS)) {
 		xfs_ilock(ip, XFS_ILOCK_SHARED);
-		/*
-		 * Do we answer them, or ignore them?
-		 */
-		if ((error = xfs_iaccess(ip, S_IRUSR, cred))) {
+
+		if (!(flags & ATTR_SECURE) &&
+		    ((error = xfs_iaccess(ip, S_IRUSR, cred)))) {
 			xfs_iunlock(ip, XFS_ILOCK_SHARED);
 			return(XFS_ERROR(error));
 		}
@@ -161,7 +152,6 @@
 	args.hashval = xfs_da_hashname(args.name, args.namelen);
 	args.dp = ip;
 	args.whichfork = XFS_ATTR_FORK;
-	args.trans = NULL;
 
 	/*
 	 * Decide on what work routines to call based on the inode size.
@@ -178,7 +168,7 @@
 		error = xfs_attr_node_get(&args);
 	}
 
-	if (lock)
+	if (!(flags & ATTR_KERNACCESS))
 		xfs_iunlock(ip, XFS_ILOCK_SHARED);
 
 	/*
@@ -192,20 +182,21 @@
 }
 
 int
-xfs_attr_fetch(xfs_inode_t *ip, char *name, char *value, int valuelen)
-{
-	return xfs_attr_get_int(ip, name, value, &valuelen, ATTR_ROOT, 0, NULL);
-}
-
-int
 xfs_attr_get(bhv_desc_t *bdp, char *name, char *value, int *valuelenp,
 	     int flags, struct cred *cred)
 {
 	xfs_inode_t	*ip = XFS_BHVTOI(bdp);
+	int		namelen;
+
+	XFS_STATS_INC(xs_attr_get);
 
 	if (!name)
 		return(EINVAL);
-	return xfs_attr_get_int(ip, name, value, valuelenp, flags, 1, cred);
+	namelen = strlen(name);
+	if (namelen >= MAXNAMELEN)
+		return(EFAULT);		/* match IRIX behaviour */
+
+	return xfs_attr_fetch(ip, name, namelen, value, valuelenp, flags, cred);
 }
 
 /*ARGSUSED*/
@@ -224,22 +215,20 @@
 	int             rsvd = (flags & ATTR_ROOT) != 0;
 	int             namelen;
 
-	ASSERT(MAXNAMELEN-1 <= 0xff); /* length is stored in uint8 */
 	namelen = strlen(name);
 	if (namelen >= MAXNAMELEN)
-		return EFAULT; /* match irix behaviour */
+		return EFAULT;		/* match IRIX behaviour */
 
 	XFS_STATS_INC(xs_attr_set);
-	/*
-	 * Do we answer them, or ignore them?
-	 */
+
 	dp = XFS_BHVTOI(bdp);
 	mp = dp->i_mount;
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return (EIO);
 
 	xfs_ilock(dp, XFS_ILOCK_SHARED);
-	if ((error = xfs_iaccess(dp, S_IWUSR, cred))) {
+	if (!(flags & ATTR_SECURE) &&
+	     (error = xfs_iaccess(dp, S_IWUSR, cred))) {
 		xfs_iunlock(dp, XFS_ILOCK_SHARED);
 		return(XFS_ERROR(error));
 	}
@@ -489,16 +478,14 @@
 
 	XFS_STATS_INC(xs_attr_remove);
 
-	/*
-	 * Do we answer them, or ignore them?
-	 */
 	dp = XFS_BHVTOI(bdp);
 	mp = dp->i_mount;
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return (EIO);
 
 	xfs_ilock(dp, XFS_ILOCK_SHARED);
-	if ((error = xfs_iaccess(dp, S_IWUSR, cred))) {
+	if (!(flags & ATTR_SECURE) &&
+	     (error = xfs_iaccess(dp, S_IWUSR, cred))) {
 		xfs_iunlock(dp, XFS_ILOCK_SHARED);
 		return(XFS_ERROR(error));
 	} else if (XFS_IFORK_Q(dp) == 0 ||
@@ -683,11 +670,10 @@
 
 	if (XFS_FORCED_SHUTDOWN(dp->i_mount))
 		return (EIO);
-	/*
-	 * Do they have permission?
-	 */
+
 	xfs_ilock(dp, XFS_ILOCK_SHARED);
-	if ((error = xfs_iaccess(dp, S_IRUSR, cred))) {
+	if (!(flags & ATTR_SECURE) &&
+	     (error = xfs_iaccess(dp, S_IRUSR, cred))) {
 		xfs_iunlock(dp, XFS_ILOCK_SHARED);
 		return(XFS_ERROR(error));
 	}
diff -Nru a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h
--- a/fs/xfs/xfs_attr.h	Tue Jun 15 22:20:37 2004
+++ b/fs/xfs/xfs_attr.h	Tue Jun 15 22:20:37 2004
@@ -92,6 +92,7 @@
 #define ATTR_REPLACE	0x0020	/* pure set: fail if attr does not exist */
 #define ATTR_SYSTEM	0x0100	/* use attrs in system (pseudo) namespace */
 
+#define ATTR_KERNACCESS	0x0400	/* [kernel] iaccess, inode held io-locked */
 #define ATTR_KERNOTIME	0x1000	/* [kernel] don't update inode timestamps */
 #define ATTR_KERNOVAL	0x2000	/* [kernel] get attr size only, not value */
 #define ATTR_KERNAMELS	0x4000	/* [kernel] list attr names (simple list) */
@@ -186,6 +187,7 @@
 int xfs_attr_node_get(struct xfs_da_args *);
 int xfs_attr_leaf_get(struct xfs_da_args *);
 int xfs_attr_shortform_getvalue(struct xfs_da_args *);
-int xfs_attr_fetch(struct xfs_inode *, char *, char *, int);
+int xfs_attr_fetch(struct xfs_inode *, char *, int,
+			char *, int *, int, struct cred *);
 
 #endif	/* __XFS_ATTR_H__ */
diff -Nru a/fs/xfs/xfs_bit.c b/fs/xfs/xfs_bit.c
--- a/fs/xfs/xfs_bit.c	Tue Jun 15 22:20:41 2004
+++ b/fs/xfs/xfs_bit.c	Tue Jun 15 22:20:41 2004
@@ -238,32 +238,33 @@
 int
 xfs_contig_bits(uint *map, uint	size, uint start_bit)
 {
-#if BITS_PER_LONG == 32
-	return find_next_zero_bit((unsigned long *)map,
-			size * sizeof(uint) * 8, start_bit) - start_bit;
-#else
-	/*
-	 * The first argument to find_next_zero_bit needs to be aligned,
-	 * but this is coming from the xfs_buf_log_format_t on-disk
-	 * struct, which can't be padded or otherwise modified w/o breaking
-	 * on-disk compatibility... so create a temporary, aligned
-	 * variable, copy over the bitmap, and send that to find_next_zero_bit
-	 * This only happens in recovery, so it's ugly but not too bad.
-	 */
-	void * addr;
-	int bit;
-	size_t bitmap_size = size * sizeof(uint);
-
-	addr = (void *)kmem_alloc(bitmap_size, KM_SLEEP);
-	memcpy(addr, map, size * sizeof(uint));
-
-	bit = find_next_zero_bit((unsigned long *)addr,
-			size * sizeof(uint) * 8, start_bit) - start_bit;
+	uint * p = ((unsigned int *) map) + (start_bit >> BIT_TO_WORD_SHIFT);
+	uint result = 0;
+	uint tmp;
 
-	kmem_free(addr, bitmap_size);
+	size <<= BIT_TO_WORD_SHIFT;
 
-	return bit;
-#endif
+	ASSERT(start_bit < size);
+	size -= start_bit & ~(NBWORD - 1);
+	start_bit &= (NBWORD - 1);
+	if (start_bit) {
+		tmp = *p++;
+		/* set to one first offset bits prior to start */
+		tmp |= (~0U >> (NBWORD-start_bit));
+		if (tmp != ~0U)
+			goto found;
+		result += NBWORD;
+		size -= NBWORD;
+	}
+	while (size) {
+		if ((tmp = *p++) != ~0U)
+			goto found;
+		result += NBWORD;
+		size -= NBWORD;
+	}
+	return result - start_bit;
+found:
+	return result + ffz(tmp) - start_bit;
 }
 
 /*
@@ -288,25 +289,20 @@
 	start_bit &= (NBWORD - 1);
 	if (start_bit) {
 		tmp = *p++;
-		/* set to zero first offset bits */
+		/* set to zero first offset bits prior to start */
 		tmp &= (~0U << start_bit);
-		if (size < NBWORD)
-			goto found_first;
 		if (tmp != 0U)
-			goto found_middle;
-		size -= NBWORD;
+			goto found;
 		result += NBWORD;
+		size -= NBWORD;
 	}
-	while (size >= NBWORD) {
+	while (size) {
 		if ((tmp = *p++) != 0U)
-			goto found_middle;
+			goto found;
 		result += NBWORD;
 		size -= NBWORD;
 	}
-	if (!size)
-		return -1;
-	tmp = *p;
-found_first:
-found_middle:
+	return -1;
+found:
 	return result + ffs(tmp) - 1;
 }
diff -Nru a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
--- a/fs/xfs/xfs_bmap.c	Tue Jun 15 22:21:02 2004
+++ b/fs/xfs/xfs_bmap.c	Tue Jun 15 22:21:02 2004
@@ -69,7 +69,7 @@
 #include "xfs_buf_item.h"
 
 
-#ifdef XFSDEBUG
+#ifdef DEBUG
 STATIC void
 xfs_bmap_check_leaf_extents(xfs_btree_cur_t *cur, xfs_inode_t *ip, int whichfork);
 #endif
@@ -195,7 +195,7 @@
 	int			*logflagsp, /* inode logging flags */
 	int			whichfork); /* data or attr fork */
 
-#ifdef XFSDEBUG
+#ifdef DEBUG
 /*
  * Check that the extents list for the inode ip is in the right order.
  */
@@ -695,7 +695,7 @@
 		*curp = cur;
 	}
 done:
-#ifdef XFSDEBUG
+#ifdef DEBUG
 	if (!error)
 		xfs_bmap_check_leaf_extents(*curp, ip, whichfork);
 #endif
@@ -4077,64 +4077,6 @@
 }
 
 /*
- * Returns EINVAL if the specified file is not swappable.
- */
-int						/* error */
-xfs_bmap_check_swappable(
-	xfs_inode_t	*ip)			/* incore inode */
-{
-	xfs_bmbt_rec_t	*base;			/* base of extent array */
-	xfs_bmbt_rec_t	*ep;			/* pointer to an extent entry */
-	xfs_fileoff_t	end_fsb;		/* last block of file within size */
-	xfs_bmbt_irec_t	ext;			/* extent list entry, decoded */
-	xfs_ifork_t	*ifp;			/* inode fork pointer */
-	xfs_fileoff_t	lastaddr;		/* last block number seen */
-	xfs_extnum_t	nextents;		/* number of extent entries */
-	int		retval = 0;		/* return value */
-
-	xfs_ilock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);
-
-	/*
-	 * Check for a zero length file.
-	 */
-	if (ip->i_d.di_size == 0)
-		goto check_done;
-
-	ASSERT(XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) == XFS_DINODE_FMT_BTREE ||
-	       XFS_IFORK_FORMAT(ip, XFS_DATA_FORK) == XFS_DINODE_FMT_EXTENTS);
-
-	ifp = &ip->i_df;
-	if (!(ifp->if_flags & XFS_IFEXTENTS) &&
-	    (retval = xfs_iread_extents(NULL, ip, XFS_DATA_FORK)))
-		goto check_done;
-	/*
-	 * Scan extents until the file size is reached. Look for
-	 * holes or unwritten extents, since I/O to these would cause
-	 * a transaction.
-	 */
-	end_fsb = XFS_B_TO_FSB(ip->i_mount, ip->i_d.di_size);
-	nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
-	base = &ifp->if_u1.if_extents[0];
-	for (lastaddr = 0, ep = base; ep < &base[nextents]; ep++) {
-		xfs_bmbt_get_all(ep, &ext);
-		if (lastaddr < ext.br_startoff ||
-		    ext.br_state != XFS_EXT_NORM) {
-			goto error_done;
-		}
-		if (end_fsb <= (lastaddr = ext.br_startoff +
-						ext.br_blockcount))
-			goto check_done;
-	}
-error_done:
-	retval = XFS_ERROR(EINVAL);
-
-
-check_done:
-	xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL);
-	return retval;
-}
-
-/*
  * Returns the file-relative block number of the first unused block(s)
  * in the file with at least "len" logically contiguous blocks free.
  * This is the lowest-address hole if the file has holes, else the first block
@@ -5790,7 +5732,7 @@
 	return 0;
 }
 
-#ifdef XFSDEBUG
+#ifdef DEBUG
 /*
  * Check that the extents list for the inode ip is in the right order.
  */
diff -Nru a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
--- a/fs/xfs/xfs_bmap.h	Tue Jun 15 22:20:38 2004
+++ b/fs/xfs/xfs_bmap.h	Tue Jun 15 22:20:38 2004
@@ -178,13 +178,6 @@
 	xfs_bmap_free_t		*flist);	/* free list to clean up */
 
 /*
- * Routine to check if a specified inode is swap capable.
- */
-int
-xfs_bmap_check_swappable(
-	struct xfs_inode	*ip);		/* incore inode */
-
-/*
  * Compute and fill in the value of the maximum depth of a bmap btree
  * in this filesystem.  Done once, during mount.
  */
diff -Nru a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
--- a/fs/xfs/xfs_bmap_btree.c	Tue Jun 15 22:20:41 2004
+++ b/fs/xfs/xfs_bmap_btree.c	Tue Jun 15 22:20:41 2004
@@ -700,7 +700,7 @@
 	return error;
 }
 
-#ifdef XFSDEBUG
+#ifdef DEBUG
 /*
  * Get the data from the pointed-to record.
  */
diff -Nru a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
--- a/fs/xfs/xfs_bmap_btree.h	Tue Jun 15 22:20:40 2004
+++ b/fs/xfs/xfs_bmap_btree.h	Tue Jun 15 22:20:40 2004
@@ -673,7 +673,7 @@
 	xfs_filblks_t,
 	xfs_exntst_t);
 
-#ifdef XFSDEBUG
+#ifdef DEBUG
 /*
  * Get the data from the pointed-to record.
  */
diff -Nru a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
--- a/fs/xfs/xfs_buf_item.c	Tue Jun 15 22:20:36 2004
+++ b/fs/xfs/xfs_buf_item.c	Tue Jun 15 22:20:36 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -1053,9 +1053,9 @@
 		    (time_after(jiffies, (lasttime + 5*HZ)))) {
 			lasttime = jiffies;
 			prdev("XFS write error in file system meta-data "
-			      "block 0x%Lx in %s",
+			      "block 0x%llx in %s",
 			      XFS_BUF_TARGET(bp),
-			      XFS_BUF_ADDR(bp), mp->m_fsname);
+			      (__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname);
 		}
 		lasttarg = XFS_BUF_TARGET(bp);
 
diff -Nru a/fs/xfs/xfs_clnt.h b/fs/xfs/xfs_clnt.h
--- a/fs/xfs/xfs_clnt.h	Tue Jun 15 22:20:42 2004
+++ b/fs/xfs/xfs_clnt.h	Tue Jun 15 22:20:42 2004
@@ -100,5 +100,7 @@
 #define XFSMNT_DMAPI		0x02000000	/* enable dmapi/xdsm */
 #define XFSMNT_NOLOGFLUSH	0x04000000	/* Don't flush for log blocks */
 #define XFSMNT_IDELETE		0x08000000	/* inode cluster delete */
+#define XFSMNT_SWALLOC		0x10000000	/* turn on stripe width
+						 * allocation */
 
 #endif	/* __XFS_CLNT_H__ */
diff -Nru a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
--- a/fs/xfs/xfs_da_btree.c	Tue Jun 15 22:20:43 2004
+++ b/fs/xfs/xfs_da_btree.c	Tue Jun 15 22:20:43 2004
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -2166,9 +2166,9 @@
 					cmn_err(CE_ALERT,
 						"[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d\n",
 						i,
-						mapp[i].br_startoff,
-						mapp[i].br_startblock,
-						mapp[i].br_blockcount,
+						(long long)mapp[i].br_startoff,
+						(long long)mapp[i].br_startblock,
+						(long long)mapp[i].br_blockcount,
 						mapp[i].br_state);
 				}
 			}
diff -Nru a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
--- a/fs/xfs/xfs_fsops.c	Tue Jun 15 22:20:44 2004
+++ b/fs/xfs/xfs_fsops.c	Tue Jun 15 22:20:44 2004
@@ -576,7 +576,8 @@
 	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
 	xfs_trans_ihold(tp, ip);
 	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
-	xfs_trans_commit(tp, XFS_TRANS_SYNC, NULL);
+	xfs_trans_set_sync(tp);
+	xfs_trans_commit(tp, 0, NULL);
 
 	xfs_iunlock(ip, XFS_ILOCK_EXCL);
 }
diff -Nru a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
--- a/fs/xfs/xfs_inode.c	Tue Jun 15 22:21:04 2004
+++ b/fs/xfs/xfs_inode.c	Tue Jun 15 22:21:04 2004
@@ -854,6 +854,34 @@
 	INT_XLATE(buf_core->di_gen, mem_core->di_gen, dir, arch);
 }
 
+uint
+xfs_dic2xflags(
+	xfs_dinode_core_t	*dic,
+	xfs_arch_t		arch)
+{
+	__uint16_t		di_flags;
+	uint			flags = 0;
+
+	di_flags = INT_GET(dic->di_flags, arch);
+	if (di_flags & XFS_DIFLAG_REALTIME)
+		flags |= XFS_XFLAG_REALTIME;
+	if (di_flags & XFS_DIFLAG_PREALLOC)
+		flags |= XFS_XFLAG_PREALLOC;
+	if (di_flags & XFS_DIFLAG_IMMUTABLE)
+		flags |= XFS_XFLAG_IMMUTABLE;
+	if (di_flags & XFS_DIFLAG_APPEND)
+		flags |= XFS_XFLAG_APPEND;
+	if (di_flags & XFS_DIFLAG_SYNC)
+		flags |= XFS_XFLAG_SYNC;
+	if (di_flags & XFS_DIFLAG_NOATIME)
+		flags |= XFS_XFLAG_NOATIME;
+	if (di_flags & XFS_DIFLAG_NODUMP)
+		flags |= XFS_XFLAG_NODUMP;
+	if (XFS_CFORK_Q_ARCH(dic, arch))
+		flags |= XFS_XFLAG_HASATTR;
+	return flags;
+}
+
 /*
  * Given a mount structure and an inode number, return a pointer
  * to a newly allocated in-core inode coresponding to the given
@@ -3722,32 +3750,6 @@
 		return XFS_ERROR(EACCES);
 	}
 	return XFS_ERROR(EACCES);
-}
-
-/*
- * Return whether or not it is OK to swap to the given file in the
- * given range.  Return 0 for OK and otherwise return the error.
- *
- * It is only OK to swap to a file if it has no holes, and all
- * extents have been initialized.
- *
- * We use the vnode behavior chain prevent and allow primitives
- * to ensure that the vnode chain stays coherent while we do this.
- * This allows us to walk the chain down to the bottom where XFS
- * lives without worrying about it changing out from under us.
- */
-int
-xfs_swappable(
-	bhv_desc_t	*bdp)
-{
-	xfs_inode_t	*ip;
-
-	ip = XFS_BHVTOI(bdp);
-	/*
-	 * Verify that the file does not have any
-	 * holes or unwritten exents.
-	 */
-	return xfs_bmap_check_swappable(ip);
 }
 
 /*
diff -Nru a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
--- a/fs/xfs/xfs_inode.h	Tue Jun 15 22:20:43 2004
+++ b/fs/xfs/xfs_inode.h	Tue Jun 15 22:20:43 2004
@@ -503,8 +503,9 @@
 int		xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, nlink_t,
 			   xfs_dev_t, struct cred *, xfs_prid_t, int,
 			   struct xfs_buf **, boolean_t *, xfs_inode_t **);
-void		xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, int,
-			   xfs_arch_t);
+void		xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *,
+					int, xfs_arch_t);
+uint		xfs_dic2xflags(struct xfs_dinode_core *, xfs_arch_t);
 int		xfs_ifree(struct xfs_trans *, xfs_inode_t *,
 			   struct xfs_bmap_free *);
 int		xfs_atruncate_start(xfs_inode_t *);
diff -Nru a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
--- a/fs/xfs/xfs_iomap.c	Tue Jun 15 22:20:40 2004
+++ b/fs/xfs/xfs_iomap.c	Tue Jun 15 22:20:40 2004
@@ -577,25 +577,70 @@
 	 */
 	if (!(ioflag & BMAPI_SYNC) && ((offset + count) > ip->i_d.di_size)) {
 		xfs_off_t	aligned_offset;
+		xfs_filblks_t   count_fsb;
 		unsigned int	iosize;
 		xfs_fileoff_t	ioalign;
+		int		n;
+		xfs_fileoff_t   start_fsb;
 
+		/*
+		 * If there are any real blocks past eof, then don't
+		 * do any speculative allocation.
+		 */
+		start_fsb = XFS_B_TO_FSBT(mp,
+					((xfs_ufsize_t)(offset + count - 1)));
+		count_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp));
+		while (count_fsb > 0) {
+			nimaps = XFS_WRITE_IMAPS;
+			error = XFS_BMAPI(mp, NULL, io, start_fsb, count_fsb,
+					0, &firstblock, 0, imap, &nimaps, NULL);
+			if (error) {
+				return error;
+			}
+			for (n = 0; n < nimaps; n++) {
+				if ((imap[n].br_startblock != HOLESTARTBLOCK) &&
+				    (imap[n].br_startblock != DELAYSTARTBLOCK)) {
+					goto write_map;
+				}
+				start_fsb += imap[n].br_blockcount;
+				count_fsb -= imap[n].br_blockcount;
+			}
+		}
 		iosize = mp->m_writeio_blocks;
 		aligned_offset = XFS_WRITEIO_ALIGN(mp, (offset + count - 1));
 		ioalign = XFS_B_TO_FSBT(mp, aligned_offset);
 		last_fsb = ioalign + iosize;
 		aeof = 1;
 	}
-
+write_map:
 	nimaps = XFS_WRITE_IMAPS;
 	firstblock = NULLFSBLOCK;
 
 	/*
+	 * If mounted with the "-o swalloc" option, roundup the allocation
+	 * request to a stripe width boundary if the file size is >=
+	 * stripe width and we are allocating past the allocation eof.
+	 */
+	if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC)
+	    && (isize >= XFS_FSB_TO_B(mp, mp->m_swidth)) && aeof) {
+		int eof;
+		xfs_fileoff_t new_last_fsb;
+
+		new_last_fsb = roundup_64(last_fsb, mp->m_swidth);
+		error = xfs_bmap_eof(ip, new_last_fsb, XFS_DATA_FORK, &eof);
+		if (error) {
+			return error;
+		}
+		if (eof) {
+			last_fsb = new_last_fsb;
+		}
+	/*
 	 * Roundup the allocation request to a stripe unit (m_dalign) boundary
 	 * if the file size is >= stripe unit size, and we are allocating past
 	 * the allocation eof.
 	 */
-	if (mp->m_dalign && (isize >= XFS_FSB_TO_B(mp, mp->m_dalign)) && aeof) {
+	} else if (mp->m_dalign && (isize >= XFS_FSB_TO_B(mp, mp->m_dalign))
+		   && aeof) {
 		int eof;
 		xfs_fileoff_t new_last_fsb;
 		new_last_fsb = roundup_64(last_fsb, mp->m_dalign);
diff -Nru a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
--- a/fs/xfs/xfs_itable.c	Tue Jun 15 22:20:36 2004
+++ b/fs/xfs/xfs_itable.c	Tue Jun 15 22:20:36 2004
@@ -55,14 +55,18 @@
 #include "xfs_itable.h"
 #include "xfs_error.h"
 
+#ifndef HAVE_USERACC
+#define useracc(ubuffer, size, flags, foo) (0)
+#define unuseracc(ubuffer, size, flags)
+#endif
+
 /*
  * Return stat information for one inode.
  * Return 0 if ok, else errno.
  */
-int					/* error status */
+int		       		/* error status */
 xfs_bulkstat_one(
 	xfs_mount_t	*mp,		/* mount point for filesystem */
-	xfs_trans_t	*tp,		/* transaction pointer */
 	xfs_ino_t	ino,		/* inode number to get data for */
 	void		*buffer,	/* buffer to place output in */
 	int		ubsize,		/* size of buffer */
@@ -78,12 +82,10 @@
 	xfs_dinode_core_t *dic;		/* dinode core info pointer */
 	xfs_inode_t	*ip = NULL;	/* incore inode pointer */
 	xfs_arch_t      arch;           /* these are set according to      */
-	__uint16_t      di_flags;       /* temp */
 
-	buf = (xfs_bstat_t *)buffer;
 	dip = (xfs_dinode_t *)dibuff;
 
-	if (! buf || ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino ||
+	if (!buffer || ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino ||
 	    (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) &&
 	     (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))) {
 		*stat = BULKSTAT_RV_NOTHING;
@@ -94,11 +96,13 @@
 		return XFS_ERROR(ENOMEM);
 	}
 
+	buf = kmem_alloc(sizeof(*buf), KM_SLEEP);
+
 	if (dip == NULL) {
 		/* We're not being passed a pointer to a dinode.  This happens
 		 * if BULKSTAT_FG_IGET is selected.  Do the iget.
 		 */
-		error = xfs_iget(mp, tp, ino, XFS_ILOCK_SHARED, &ip, bno);
+		error = xfs_iget(mp, NULL, ino, XFS_ILOCK_SHARED, &ip, bno);
 		if (error) {
 			*stat = BULKSTAT_RV_NOTHING;
 			return error;
@@ -108,6 +112,7 @@
 		if (ip->i_d.di_mode == 0) {
 			xfs_iput_new(ip, XFS_ILOCK_SHARED);
 			*stat = BULKSTAT_RV_NOTHING;
+			kmem_free(buf, sizeof(*buf));
 			return XFS_ERROR(ENOENT);
 		}
 		dic = &ip->i_d;
@@ -160,29 +165,7 @@
 	buf->bs_mtime.tv_nsec = INT_GET(dic->di_mtime.t_nsec, arch);
 	buf->bs_ctime.tv_sec = INT_GET(dic->di_ctime.t_sec, arch);
 	buf->bs_ctime.tv_nsec = INT_GET(dic->di_ctime.t_nsec, arch);
-	/*
-	 * convert di_flags to bs_xflags.
-	 */
-	di_flags = INT_GET(dic->di_flags, arch);
-
-	buf->bs_xflags =
-		((di_flags & XFS_DIFLAG_REALTIME) ?
-			XFS_XFLAG_REALTIME : 0) |
-		((di_flags & XFS_DIFLAG_PREALLOC) ?
-			XFS_XFLAG_PREALLOC : 0) |
-	        ((di_flags & XFS_DIFLAG_IMMUTABLE) ?
-		        XFS_XFLAG_IMMUTABLE : 0) |
-		((di_flags & XFS_DIFLAG_APPEND) ?
-		        XFS_XFLAG_APPEND : 0) |
-		((di_flags & XFS_DIFLAG_SYNC) ?
-		        XFS_XFLAG_SYNC : 0) |
-		((di_flags & XFS_DIFLAG_NOATIME) ?
-		        XFS_XFLAG_NOATIME : 0) |
-		((di_flags & XFS_DIFLAG_NODUMP) ?
-		        XFS_XFLAG_NODUMP : 0) |
-		(XFS_CFORK_Q_ARCH(dic, arch) ?
-			XFS_XFLAG_HASATTR : 0);
-
+	buf->bs_xflags = xfs_dic2xflags(dic, arch);
 	buf->bs_extsize = INT_GET(dic->di_extsize, arch) << mp->m_sb.sb_blocklog;
 	buf->bs_extents = INT_GET(dic->di_nextents, arch);
 	buf->bs_gen = INT_GET(dic->di_gen, arch);
@@ -224,6 +207,13 @@
 		xfs_iput(ip, XFS_ILOCK_SHARED);
 	}
 
+	if (copy_to_user(buffer, buf, sizeof(*buf)))  {
+		kmem_free(buf, sizeof(*buf));
+		*stat = BULKSTAT_RV_NOTHING;
+		return EFAULT;
+	}
+
+	kmem_free(buf, sizeof(*buf));
 	*stat = BULKSTAT_RV_DIDONE;
 	if (ubused)
 		*ubused = sizeof(*buf);
@@ -236,7 +226,6 @@
 int					/* error status */
 xfs_bulkstat(
 	xfs_mount_t		*mp,	/* mount point for filesystem */
-	xfs_trans_t		*tp,	/* transaction pointer */
 	xfs_ino_t		*lastinop, /* last inode returned */
 	int			*ubcountp, /* size of buffer/count returned */
 	bulkstat_one_pf		formatter, /* func that'd fill a single buf */
@@ -311,13 +300,11 @@
 	 * Lock down the user's buffer. If a buffer was not sent, as in the case
 	 * disk quota code calls here, we skip this.
 	 */
-#if defined(HAVE_USERACC)
 	if (ubuffer &&
 	    (error = useracc(ubuffer, ubcount * statstruct_size,
 			(B_READ|B_PHYS), NULL))) {
 		return error;
 	}
-#endif
 	/*
 	 * Allocate a page-sized buffer for inode btree records.
 	 * We could try allocating something smaller, but for normal
@@ -333,7 +320,7 @@
 	while (ubleft >= statstruct_size && agno < mp->m_sb.sb_agcount) {
 		bp = NULL;
 		down_read(&mp->m_peraglock);
-		error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
+		error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp);
 		up_read(&mp->m_peraglock);
 		if (error) {
 			/*
@@ -347,7 +334,7 @@
 		/*
 		 * Allocate and initialize a btree cursor for ialloc btree.
 		 */
-		cur = xfs_btree_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_INO,
+		cur = xfs_btree_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_INO,
 			(xfs_inode_t *)0, 0);
 		irbp = irbuf;
 		irbufend = irbuf + nirbuf;
@@ -461,7 +448,7 @@
 		 * when calling iget.
 		 */
 		xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
-		xfs_trans_brelse(tp, agbp);
+		xfs_buf_relse(agbp);
 		/*
 		 * Now format all the good inodes into the user's buffer.
 		 */
@@ -534,8 +521,8 @@
 						ip->i_ino = ino;
 						ip->i_mount = mp;
 						if (bp)
-							xfs_trans_brelse(tp, bp);
-						error = xfs_itobp(mp, tp, ip,
+							xfs_buf_relse(bp);
+						error = xfs_itobp(mp, NULL, ip,
 								  &dip, &bp, bno);
 						if (!error)
 							clustidx = ip->i_boffset / mp->m_sb.sb_inodesize;
@@ -580,7 +567,7 @@
 				 * in xfs_qm_quotacheck.
 				 */
 				ubused = statstruct_size;
-				error = formatter(mp, tp, ino, ubufp,
+				error = formatter(mp, ino, ubufp,
 						ubleft, private_data,
 						bno, &ubused, dip, &fmterror);
 				if (fmterror == BULKSTAT_RV_NOTHING) {
@@ -603,7 +590,7 @@
 		}
 
 		if (bp)
-			xfs_trans_brelse(tp, bp);
+			xfs_buf_relse(bp);
 
 		/*
 		 * Set up for the next loop iteration.
@@ -621,10 +608,8 @@
 	 * Done, we're either out of filesystem or space to put the data.
 	 */
 	kmem_free(irbuf, NBPC);
-#if defined(HAVE_USERACC)
 	if (ubuffer)
 		unuseracc(ubuffer, ubcount * statstruct_size, (B_READ|B_PHYS));
-#endif
 	*ubcountp = ubelem;
 	if (agno >= mp->m_sb.sb_agcount) {
 		/*
@@ -651,7 +636,6 @@
 	xfs_caddr_t		buffer,	/* buffer with inode stats */
 	int			*done)	/* 1 if there're more stats to get */
 {
-	xfs_bstat_t		bstat;	/* one bulkstat result structure */
 	int			count;	/* count value for bulkstat call */
 	int			error;	/* return value */
 	xfs_ino_t		ino;	/* filesystem inode number */
@@ -667,7 +651,7 @@
 	 */
 
 	ino = (xfs_ino_t)*lastinop;
-	error = xfs_bulkstat_one(mp, NULL, ino, &bstat, sizeof(bstat),
+	error = xfs_bulkstat_one(mp, ino, buffer, sizeof(xfs_bstat_t),
 				 NULL, 0, NULL, NULL, &res);
 	if (error) {
 		/*
@@ -676,9 +660,9 @@
 		 */
 		(*lastinop)--;
 		count = 1;
-		if (xfs_bulkstat(mp, NULL, lastinop, &count, xfs_bulkstat_one,
-				NULL,
-				sizeof(bstat), buffer, BULKSTAT_FG_IGET, done))
+		if (xfs_bulkstat(mp, lastinop, &count, xfs_bulkstat_one,
+				NULL, sizeof(xfs_bstat_t), buffer,
+				BULKSTAT_FG_IGET, done))
 			return error;
 		if (count == 0 || (xfs_ino_t)*lastinop != ino)
 			return error == EFSCORRUPTED ?
@@ -687,8 +671,6 @@
 			return 0;
 	}
 	*done = 0;
-	if (copy_to_user(buffer, &bstat, sizeof(bstat)))
-		return XFS_ERROR(EFAULT);
 	return 0;
 }
 
@@ -698,7 +680,6 @@
 int					/* error status */
 xfs_inumbers(
 	xfs_mount_t	*mp,		/* mount point for filesystem */
-	xfs_trans_t	*tp,		/* transaction pointer */
 	xfs_ino_t	*lastino,	/* last inode returned */
 	int		*count,		/* size of buffer/count returned */
 	xfs_caddr_t	ubuffer)	/* buffer with inode descriptions */
@@ -732,7 +713,7 @@
 	while (left > 0 && agno < mp->m_sb.sb_agcount) {
 		if (agbp == NULL) {
 			down_read(&mp->m_peraglock);
-			error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
+			error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp);
 			up_read(&mp->m_peraglock);
 			if (error) {
 				/*
@@ -745,13 +726,13 @@
 				agino = 0;
 				continue;
 			}
-			cur = xfs_btree_init_cursor(mp, tp, agbp, agno,
+			cur = xfs_btree_init_cursor(mp, NULL, agbp, agno,
 				XFS_BTNUM_INO, (xfs_inode_t *)0, 0);
 			error = xfs_inobt_lookup_ge(cur, agino, 0, 0, &tmp);
 			if (error) {
 				xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
 				cur = NULL;
-				xfs_trans_brelse(tp, agbp);
+				xfs_buf_relse(agbp);
 				agbp = NULL;
 				/*
 				 * Move up the the last inode in the current
@@ -765,7 +746,7 @@
 		if ((error = xfs_inobt_get_rec(cur, &gino, &gcnt, &gfree,
 			&i, ARCH_NOCONVERT)) ||
 		    i == 0) {
-			xfs_trans_brelse(tp, agbp);
+			xfs_buf_relse(agbp);
 			agbp = NULL;
 			xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
 			cur = NULL;
@@ -794,7 +775,7 @@
 			if (error) {
 				xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
 				cur = NULL;
-				xfs_trans_brelse(tp, agbp);
+				xfs_buf_relse(agbp);
 				agbp = NULL;
 				/*
 				 * The agino value has already been bumped.
@@ -820,6 +801,6 @@
 		xfs_btree_del_cursor(cur, (error ? XFS_BTREE_ERROR :
 					   XFS_BTREE_NOERROR));
 	if (agbp)
-		xfs_trans_brelse(tp, agbp);
+		xfs_buf_relse(agbp);
 	return error;
 }
diff -Nru a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h
--- a/fs/xfs/xfs_itable.h	Tue Jun 15 22:21:03 2004
+++ b/fs/xfs/xfs_itable.h	Tue Jun 15 22:21:03 2004
@@ -39,7 +39,6 @@
  * see xfs_bulkstat_one() and xfs_dm_bulkstat_one() in dmapi_xfs.c
  */
 typedef int (*bulkstat_one_pf)(struct xfs_mount	*mp,
-			       struct xfs_trans	*tp,
 			       xfs_ino_t	ino,
 			       void		*buffer,
 			       int		ubsize,
@@ -69,7 +68,6 @@
 int					/* error status */
 xfs_bulkstat(
 	xfs_mount_t	*mp,		/* mount point for filesystem */
-	xfs_trans_t	*tp,		/* transaction pointer */
 	xfs_ino_t	*lastino,	/* last inode returned */
 	int		*count,		/* size of buffer/count returned */
 	bulkstat_one_pf formatter,	/* func that'd fill a single buf */
@@ -89,7 +87,6 @@
 int
 xfs_bulkstat_one(
 	xfs_mount_t		*mp,
-	xfs_trans_t		*tp,
 	xfs_ino_t		ino,
 	void			*buffer,
 	int			ubsize,
@@ -102,7 +99,6 @@
 int					/* error status */
 xfs_inumbers(
 	xfs_mount_t		*mp,	/* mount point for filesystem */
-	xfs_trans_t		*tp,	/* transaction pointer */
 	xfs_ino_t		*last,	/* last inode returned */
 	int			*count,	/* size of buffer/count returned */
 	xfs_caddr_t		buffer);/* buffer with inode descriptions */
diff -Nru a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
--- a/fs/xfs/xfs_log.c	Tue Jun 15 22:21:05 2004
+++ b/fs/xfs/xfs_log.c	Tue Jun 15 22:21:05 2004
@@ -122,9 +122,7 @@
 /* local debug functions */
 #if defined(DEBUG) && !defined(XLOG_NOLOG)
 STATIC void	xlog_verify_dest_ptr(xlog_t *log, __psint_t ptr);
-#ifdef XFSDEBUG
 STATIC void	xlog_verify_disk_cycle_no(xlog_t *log, xlog_in_core_t *iclog);
-#endif
 STATIC void	xlog_verify_grant_head(xlog_t *log, int equals);
 STATIC void	xlog_verify_iclog(xlog_t *log, xlog_in_core_t *iclog,
 				  int count, boolean_t syncing);
@@ -339,13 +337,11 @@
 
 }	/* xfs_log_force */
 
-
 /*
- * This function will take a log sequence number and check to see if that
- * lsn has been flushed to disk.  If it has, then the callback function is
- * called with the callback argument.  If the relevant in-core log has not
- * been synced to disk, we add the callback to the callback list of the
- * in-core log.
+ * Attaches a new iclog I/O completion callback routine during
+ * transaction commit.  If the log is in error state, a non-zero
+ * return code is handed back and the caller is responsible for
+ * executing the callback at an appropriate time.
  */
 int
 xfs_log_notify(xfs_mount_t	  *mp,		/* mount of partition */
@@ -371,10 +367,7 @@
 		iclog->ic_callback_tail = &(cb->cb_next);
 	}
 	LOG_UNLOCK(log, spl);
-	if (abortflg) {
-		cb->cb_func(cb->cb_arg, abortflg);
-	}
-	return 0;
+	return abortflg;
 }	/* xfs_log_notify */
 
 int
@@ -497,7 +490,7 @@
 		if (readonly)
 			vfsp->vfs_flag |= VFS_RDONLY;
 		if (error) {
-			cmn_err(CE_WARN, "XFS: log mount/recovery failed");
+			cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
 			xlog_unalloc_log(mp->m_log);
 			return error;
 		}
@@ -1664,7 +1657,6 @@
     int		     copy_len;	     /* # bytes actually memcpy'ing */
     int		     copy_off;	     /* # bytes from entry start */
     int		     contwr;	     /* continued write of in-core log? */
-    int		     firstwr = 0;    /* first write of transaction */
     int		     error;
     int		     record_cnt = 0, data_cnt = 0;
 
@@ -1729,7 +1721,6 @@
 		logop_head->oh_flags    = XLOG_START_TRANS;
 		INT_ZERO(logop_head->oh_res2, ARCH_CONVERT);
 		ticket->t_flags		&= ~XLOG_TIC_INITED;	/* clear bit */
-		firstwr = 1;			  /* increment log ops below */
 		record_cnt++;
 
 		start_rec_copy = sizeof(xlog_op_header_t);
@@ -1800,7 +1791,6 @@
 	    copy_len += start_rec_copy + sizeof(xlog_op_header_t);
 	    record_cnt++;
 	    data_cnt += contwr ? copy_len : 0;
-	    firstwr = 0;
 	    if (partial_copy) {			/* copied partial region */
 		    /* already marked WANT_SYNC by xlog_state_get_iclog_space */
 		    xlog_state_finish_copy(log, iclog, record_cnt, data_cnt);
@@ -3253,7 +3243,7 @@
 }	/* xlog_verify_dest_ptr */
 
 
-#ifdef XFSDEBUG
+#ifdef DEBUG
 /* check split LR write */
 STATIC void
 xlog_verify_disk_cycle_no(xlog_t	 *log,
diff -Nru a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
--- a/fs/xfs/xfs_log_recover.c	Tue Jun 15 22:20:41 2004
+++ b/fs/xfs/xfs_log_recover.c	Tue Jun 15 22:20:41 2004
@@ -1867,6 +1867,7 @@
 
 			nbits = xfs_contig_bits(data_map, map_size,
 							 bit);
+			ASSERT(nbits > 0);
 			reg_buf_offset = bit << XFS_BLI_SHIFT;
 			reg_buf_bytes = nbits << XFS_BLI_SHIFT;
 			item_index++;
@@ -1951,6 +1952,7 @@
 		if (bit == -1)
 			break;
 		nbits = xfs_contig_bits(data_map, map_size, bit);
+		ASSERT(nbits > 0);
 		ASSERT(item->ri_buf[i].i_addr != 0);
 		ASSERT(item->ri_buf[i].i_len % XFS_BLI_CHUNK == 0);
 		ASSERT(XFS_BUF_COUNT(bp) >=
diff -Nru a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
--- a/fs/xfs/xfs_mount.c	Tue Jun 15 22:20:39 2004
+++ b/fs/xfs/xfs_mount.c	Tue Jun 15 22:20:39 2004
@@ -682,14 +682,21 @@
 					error = XFS_ERROR(EINVAL);
 					goto error1;
 				}
+				xfs_fs_cmn_err(CE_WARN, mp,
+"stripe alignment turned off: sunit(%d)/swidth(%d) incompatible with agsize(%d)",
+					mp->m_dalign, mp->m_swidth,
+					sbp->sb_agblocks);
+
 				mp->m_dalign = 0;
 				mp->m_swidth = 0;
 			} else if (mp->m_dalign) {
 				mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
 			} else {
 				if (mp->m_flags & XFS_MOUNT_RETERR) {
-					cmn_err(CE_WARN,
-					"XFS: alignment check 3 failed");
+					xfs_fs_cmn_err(CE_WARN, mp,
+"stripe alignment turned off: sunit(%d) less than bsize(%d)",
+                                        	mp->m_dalign,
+						mp->m_blockmask +1);
 					error = XFS_ERROR(EINVAL);
 					goto error1;
 				}
diff -Nru a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
--- a/fs/xfs/xfs_mount.h	Tue Jun 15 22:20:35 2004
+++ b/fs/xfs/xfs_mount.h	Tue Jun 15 22:20:35 2004
@@ -95,7 +95,8 @@
 			xfs_off_t, size_t, int, vrwlock_t *);
 typedef int	(*xfs_send_mmap_t)(struct vm_area_struct *, uint);
 typedef int	(*xfs_send_destroy_t)(struct vnode *, dm_right_t);
-typedef int	(*xfs_send_namesp_t)(dm_eventtype_t, struct vnode *,
+typedef int	(*xfs_send_namesp_t)(dm_eventtype_t, struct vfs *,
+			struct vnode *,
 			dm_right_t, struct vnode *, dm_right_t,
 			char *, char *, mode_t, int, int);
 typedef void	(*xfs_send_unmount_t)(struct vfs *, struct vnode *,
@@ -116,7 +117,9 @@
 #define XFS_SEND_DESTROY(mp, vp,right) \
 	(*(mp)->m_dm_ops.xfs_send_destroy)(vp,right)
 #define XFS_SEND_NAMESP(mp, ev,b1,r1,b2,r2,n1,n2,mode,rval,fl) \
-	(*(mp)->m_dm_ops.xfs_send_namesp)(ev,b1,r1,b2,r2,n1,n2,mode,rval,fl)
+	(*(mp)->m_dm_ops.xfs_send_namesp)(ev,NULL,b1,r1,b2,r2,n1,n2,mode,rval,fl)
+#define XFS_SEND_PREUNMOUNT(mp, vfs,b1,r1,b2,r2,n1,n2,mode,rval,fl) \
+	(*(mp)->m_dm_ops.xfs_send_namesp)(DM_EVENT_PREUNMOUNT,vfs,b1,r1,b2,r2,n1,n2,mode,rval,fl)
 #define XFS_SEND_UNMOUNT(mp, vfsp,vp,right,mode,rval,fl) \
 	(*(mp)->m_dm_ops.xfs_send_unmount)(vfsp,vp,right,mode,rval,fl)
 
@@ -413,6 +416,8 @@
 #define XFS_MOUNT_NOUUID	0x00010000	/* ignore uuid during mount */
 #define XFS_MOUNT_NOLOGFLUSH	0x00020000
 #define XFS_MOUNT_IDELETE	0x00040000	/* delete empty inode clusters*/
+#define XFS_MOUNT_SWALLOC	0x00080000	/* turn on stripe width
+						 * allocation */
 
 /*
  * Default minimum read and write sizes.
diff -Nru a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
--- a/fs/xfs/xfs_trans.c	Tue Jun 15 22:20:40 2004
+++ b/fs/xfs/xfs_trans.c	Tue Jun 15 22:20:40 2004
@@ -855,16 +855,19 @@
 	tp->t_logcb.cb_func = (void(*)(void*, int))xfs_trans_committed;
 	tp->t_logcb.cb_arg = tp;
 
-	/* We need to pass the iclog buffer which was used for the
+	/*
+	 * We need to pass the iclog buffer which was used for the
 	 * transaction commit record into this function, and attach
 	 * the callback to it. The callback must be attached before
 	 * the items are unlocked to avoid racing with other threads
 	 * waiting for an item to unlock.
 	 */
-	error = xfs_log_notify(mp, commit_iclog, &(tp->t_logcb));
+	shutdown = xfs_log_notify(mp, commit_iclog, &(tp->t_logcb));
 
-	/* mark this thread as no longer being in a transaction */
-        PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
+	/*
+	 * Mark this thread as no longer being in a transaction
+	 */
+	PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
 
 	/*
 	 * Once all the items of the transaction have been copied
@@ -882,6 +885,19 @@
 	xfs_trans_unlock_items(tp, commit_lsn);
 
 	/*
+	 * If we detected a log error earlier, finish committing
+	 * the transaction now (unpin log items, etc).
+	 *
+	 * Order is critical here, to avoid using the transaction
+	 * pointer after its been freed (by xfs_trans_committed
+	 * either here now, or as a callback).  We cannot do this
+	 * step inside xfs_log_notify as was done earlier because
+	 * of this issue.
+	 */
+	if (shutdown)
+		xfs_trans_committed(tp, XFS_LI_ABORTED);
+
+	/*
 	 * Now that the xfs_trans_committed callback has been attached,
 	 * and the items are released we can finally allow the iclog to
 	 * go to disk.
@@ -1240,10 +1256,6 @@
 		lip = lidp->lid_item;
 		if (aborted)
 			lip->li_flags |= XFS_LI_ABORTED;
-
-		if (lidp->lid_flags & XFS_LID_SYNC_UNLOCK) {
-			IOP_UNLOCK(lip);
-		}
 
 		/*
 		 * Send in the ABORTED flag to the COMMITTED routine
diff -Nru a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
--- a/fs/xfs/xfs_trans.h	Tue Jun 15 22:20:43 2004
+++ b/fs/xfs/xfs_trans.h	Tue Jun 15 22:20:43 2004
@@ -220,7 +220,6 @@
 
 #define XFS_LID_DIRTY		0x1
 #define XFS_LID_PINNED		0x2
-#define XFS_LID_SYNC_UNLOCK	0x4
 #define XFS_LID_BUF_STALE	0x8
 
 /*
@@ -1001,7 +1000,6 @@
 void		xfs_trans_brelse(xfs_trans_t *, struct xfs_buf *);
 void		xfs_trans_bjoin(xfs_trans_t *, struct xfs_buf *);
 void		xfs_trans_bhold(xfs_trans_t *, struct xfs_buf *);
-void		xfs_trans_bhold_until_committed(xfs_trans_t *, struct xfs_buf *);
 void		xfs_trans_binval(xfs_trans_t *, struct xfs_buf *);
 void		xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *);
 void		xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *);
diff -Nru a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
--- a/fs/xfs/xfs_trans_ail.c	Tue Jun 15 22:21:04 2004
+++ b/fs/xfs/xfs_trans_ail.c	Tue Jun 15 22:21:04 2004
@@ -48,11 +48,11 @@
 STATIC xfs_log_item_t * xfs_ail_min(xfs_ail_entry_t *);
 STATIC xfs_log_item_t * xfs_ail_next(xfs_ail_entry_t *, xfs_log_item_t *);
 
-#ifdef XFSDEBUG
+#ifdef DEBUG
 STATIC void xfs_ail_check(xfs_ail_entry_t *);
 #else
 #define	xfs_ail_check(a)
-#endif /* XFSDEBUG */
+#endif /* DEBUG */
 
 
 /*
@@ -553,7 +553,7 @@
 
 }
 
-#ifdef XFSDEBUG
+#ifdef DEBUG
 /*
  * Check that the list is sorted as it should be.
  */
@@ -593,4 +593,4 @@
 	ASSERT(lip == (xfs_log_item_t*)base);
 	ASSERT(base->ail_back == prev_lip);
 }
-#endif /* XFSDEBUG */
+#endif /* DEBUG */
diff -Nru a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
--- a/fs/xfs/xfs_trans_buf.c	Tue Jun 15 22:20:36 2004
+++ b/fs/xfs/xfs_trans_buf.c	Tue Jun 15 22:20:36 2004
@@ -714,40 +714,6 @@
 }
 
 /*
- * This function is used to indicate that the buffer should not be
- * unlocked until the transaction is committed to disk.  Since we
- * are going to keep the lock held, make the transaction synchronous
- * so that the lock is not held too long.
- *
- * It uses the log item descriptor flag XFS_LID_SYNC_UNLOCK to
- * delay the buf items's unlock call until the transaction is
- * committed to disk or aborted.
- */
-void
-xfs_trans_bhold_until_committed(xfs_trans_t	*tp,
-				xfs_buf_t	*bp)
-{
-	xfs_log_item_desc_t	*lidp;
-	xfs_buf_log_item_t	*bip;
-
-	ASSERT(XFS_BUF_ISBUSY(bp));
-	ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp);
-	ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
-
-	bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
-	ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
-	ASSERT(!(bip->bli_format.blf_flags & XFS_BLI_CANCEL));
-	ASSERT(atomic_read(&bip->bli_refcount) > 0);
-	lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)bip);
-	ASSERT(lidp != NULL);
-
-	lidp->lid_flags |= XFS_LID_SYNC_UNLOCK;
-	xfs_buf_item_trace("BHOLD UNTIL COMMIT", bip);
-
-	xfs_trans_set_sync(tp);
-}
-
-/*
  * This is called to mark bytes first through last inclusive of the given
  * buffer as needing to be logged when the transaction is committed.
  * The buffer must already be associated with the given transaction.
@@ -799,7 +765,6 @@
 	if (bip->bli_flags & XFS_BLI_STALE) {
 		xfs_buf_item_trace("BLOG UNSTALE", bip);
 		bip->bli_flags &= ~XFS_BLI_STALE;
-		/* note this will have to change for page_buf interface... unstale isn't really an option RMC */
 		ASSERT(XFS_BUF_ISSTALE(bp));
 		XFS_BUF_UNSTALE(bp);
 		bip->bli_format.blf_flags &= ~XFS_BLI_CANCEL;
diff -Nru a/fs/xfs/xfs_trans_item.c b/fs/xfs/xfs_trans_item.c
--- a/fs/xfs/xfs_trans_item.c	Tue Jun 15 22:20:37 2004
+++ b/fs/xfs/xfs_trans_item.c	Tue Jun 15 22:20:37 2004
@@ -397,7 +397,8 @@
  * Stamp the commit lsn into each item if necessary.
  * Free descriptors pointing to items which are not dirty if freeing_chunk
  * is zero. If freeing_chunk is non-zero, then we need to unlock all
- * items in the chunk including those with XFS_LID_SYNC_UNLOCK set.
+ * items in the chunk.
+ * 
  * Return the number of descriptors freed.
  */
 STATIC int
@@ -423,18 +424,9 @@
 
 		if (commit_lsn != NULLCOMMITLSN)
 			IOP_COMMITTING(lip, commit_lsn);
-
-		/* XXXsup */
 		if (abort)
 			lip->li_flags |= XFS_LI_ABORTED;
-
-		/* if (abort) {
-			IOP_ABORT(lip);
-		} else */
-		if (!(lidp->lid_flags & XFS_LID_SYNC_UNLOCK) ||
-			   freeing_chunk || abort) {
-			IOP_UNLOCK(lip);
-		}
+		IOP_UNLOCK(lip);
 
 		/*
 		 * Free the descriptor if the item is not dirty
diff -Nru a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
--- a/fs/xfs/xfs_vfsops.c	Tue Jun 15 22:20:37 2004
+++ b/fs/xfs/xfs_vfsops.c	Tue Jun 15 22:20:37 2004
@@ -279,6 +279,9 @@
 	if (ap->flags & XFSMNT_NOALIGN)
 		mp->m_flags |= XFS_MOUNT_NOALIGN;
 
+	if (ap->flags & XFSMNT_SWALLOC)
+		mp->m_flags |= XFS_MOUNT_SWALLOC;
+
 	if (ap->flags & XFSMNT_OSYNCISOSYNC)
 		mp->m_flags |= XFS_MOUNT_OSYNCISOSYNC;
 
@@ -536,7 +539,7 @@
 	rvp = XFS_ITOV(rip);
 
 	if (vfsp->vfs_flag & VFS_DMI) {
-		error = XFS_SEND_NAMESP(mp, DM_EVENT_PREUNMOUNT,
+		error = XFS_SEND_PREUNMOUNT(mp, vfsp,
 				rvp, DM_RIGHT_NULL, rvp, DM_RIGHT_NULL,
 				NULL, NULL, 0, 0,
 				(mp->m_dmevmask & (1<<DM_EVENT_PREUNMOUNT))?
@@ -1614,6 +1617,7 @@
 #define MNTOPT_WSYNC	"wsync"		/* safe-mode nfs compatible mount */
 #define MNTOPT_INO64	"ino64"		/* force inodes into 64-bit range */
 #define MNTOPT_NOALIGN	"noalign"	/* turn off stripe alignment */
+#define MNTOPT_SWALLOC	"swalloc"	/* turn on stripe width allocation */
 #define MNTOPT_SUNIT	"sunit"		/* data volume stripe unit */
 #define MNTOPT_SWIDTH	"swidth"	/* data volume stripe width */
 #define MNTOPT_NOUUID	"nouuid"	/* ignore filesystem UUID */
@@ -1721,6 +1725,8 @@
 #endif
 		} else if (!strcmp(this_char, MNTOPT_NOALIGN)) {
 			args->flags |= XFSMNT_NOALIGN;
+		} else if (!strcmp(this_char, MNTOPT_SWALLOC)) {
+			args->flags |= XFSMNT_SWALLOC;
 		} else if (!strcmp(this_char, MNTOPT_SUNIT)) {
 			if (!value || !*value) {
 				printk("XFS: %s option requires an argument\n",
@@ -1815,6 +1821,7 @@
 		{ XFS_MOUNT_WSYNC,		"," MNTOPT_WSYNC },
 		{ XFS_MOUNT_INO64,		"," MNTOPT_INO64 },
 		{ XFS_MOUNT_NOALIGN,		"," MNTOPT_NOALIGN },
+		{ XFS_MOUNT_SWALLOC,		"," MNTOPT_SWALLOC },
 		{ XFS_MOUNT_NOUUID,		"," MNTOPT_NOUUID },
 		{ XFS_MOUNT_NORECOVERY,		"," MNTOPT_NORECOVERY },
 		{ XFS_MOUNT_OSYNCISOSYNC,	"," MNTOPT_OSYNCISOSYNC },
diff -Nru a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
--- a/fs/xfs/xfs_vnodeops.c	Tue Jun 15 22:21:05 2004
+++ b/fs/xfs/xfs_vnodeops.c	Tue Jun 15 22:21:05 2004
@@ -246,25 +246,10 @@
 		goto all_done;
 
 	/*
-	 * convert di_flags to xflags
+	 * Convert di_flags to xflags.
 	 */
-	vap->va_xflags = 0;
-	if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME)
-		vap->va_xflags |= XFS_XFLAG_REALTIME;
-	if (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC)
-		vap->va_xflags |= XFS_XFLAG_PREALLOC;
-	if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
-		vap->va_xflags |= XFS_XFLAG_IMMUTABLE;
-	if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
-		vap->va_xflags |= XFS_XFLAG_APPEND;
-	if (ip->i_d.di_flags & XFS_DIFLAG_SYNC)
-		vap->va_xflags |= XFS_XFLAG_SYNC;
-	if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME)
-		vap->va_xflags |= XFS_XFLAG_NOATIME;
-	if (ip->i_d.di_flags & XFS_DIFLAG_NODUMP)
-		vap->va_xflags |= XFS_XFLAG_NODUMP;
-	if (XFS_IFORK_Q(ip))
-		vap->va_xflags |= XFS_XFLAG_HASATTR;
+	vap->va_xflags = xfs_dic2xflags(&ip->i_d, ARCH_NOCONVERT);
+
 	/*
 	 * Exit for inode revalidate.  See if any of the rest of
 	 * the fields to be filled in are needed.
diff -Nru a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
--- a/include/acpi/acpiosxf.h	Tue Jun 15 22:20:36 2004
+++ b/include/acpi/acpiosxf.h	Tue Jun 15 22:20:36 2004
@@ -213,6 +213,10 @@
 	void                            *context);
 
 void
+acpi_os_wait_events_complete(
+	void * context);
+
+void
 acpi_os_sleep (
 	u32                             seconds,
 	u32                             milliseconds);
diff -Nru a/include/asm-alpha/8253pit.h b/include/asm-alpha/8253pit.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-alpha/8253pit.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,10 @@
+/*
+ * 8253/8254 Programmable Interval Timer
+ */
+
+#ifndef _8253PIT_H
+#define _8253PIT_H
+
+#define PIT_TICK_RATE 	1193180UL
+
+#endif
diff -Nru a/include/asm-alpha/atomic.h b/include/asm-alpha/atomic.h
--- a/include/asm-alpha/atomic.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-alpha/atomic.h	Tue Jun 15 22:20:42 2004
@@ -115,6 +115,8 @@
 	return result;
 }
 
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
+
 static __inline__ long atomic64_add_return(long i, atomic64_t * v)
 {
 	long temp, result;
@@ -178,6 +180,7 @@
 #define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
 #define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0)
 
+#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
 #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
 #define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0)
 
diff -Nru a/include/asm-alpha/cacheflush.h b/include/asm-alpha/cacheflush.h
--- a/include/asm-alpha/cacheflush.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-alpha/cacheflush.h	Tue Jun 15 22:20:42 2004
@@ -10,6 +10,8 @@
 #define flush_cache_range(vma, start, end)	do { } while (0)
 #define flush_cache_page(vma, vmaddr)		do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_cache_vmap(start, end)		do { } while (0)
 #define flush_cache_vunmap(start, end)		do { } while (0)
 
diff -Nru a/include/asm-alpha/checksum.h b/include/asm-alpha/checksum.h
--- a/include/asm-alpha/checksum.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-alpha/checksum.h	Tue Jun 15 22:20:35 2004
@@ -43,7 +43,7 @@
  * here even more important to align src and dst on a 32-bit (or even
  * better 64-bit) boundary
  */
-unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int sum, int *errp);
+unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp);
 
 unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum);
 
diff -Nru a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h
--- a/include/asm-alpha/core_mcpcia.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-alpha/core_mcpcia.h	Tue Jun 15 22:21:05 2004
@@ -167,7 +167,7 @@
 
 /* Hack!  Only words for bus 0.  */
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 #define MCPCIA_HAE_ADDRESS	MCPCIA_HAE_MEM(4)
 #endif
 #define MCPCIA_IACK_SC		_MCPCIA_IACK_SC(4)
@@ -351,7 +351,7 @@
 	unsigned long hose = in_addr & ~0xffffffffUL;
 	unsigned long result, work;
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 	unsigned long msb;
 	msb = addr & ~MCPCIA_MEM_MASK;
 	set_hae(msb);
@@ -370,7 +370,7 @@
 	unsigned long hose = in_addr & ~0xffffffffUL;
 	unsigned long result, work;
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 	unsigned long msb;
 	msb = addr & ~MCPCIA_MEM_MASK;
 	set_hae(msb);
@@ -389,7 +389,7 @@
 	unsigned long hose = in_addr & ~0xffffffffUL;
 	unsigned long w;
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 	unsigned long msb;
 	msb = addr & ~MCPCIA_MEM_MASK;
 	set_hae(msb);
@@ -407,7 +407,7 @@
 	unsigned long hose = in_addr & ~0xffffffffUL;
 	unsigned long w;
 
-#if !MCPCIA_ONE_HAE_WINDOW
+#ifndef MCPCIA_ONE_HAE_WINDOW
 	unsigned long msb;
 	msb = addr & ~MCPCIA_MEM_MASK;
 	set_hae(msb);
diff -Nru a/include/asm-alpha/core_polaris.h b/include/asm-alpha/core_polaris.h
--- a/include/asm-alpha/core_polaris.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-alpha/core_polaris.h	Tue Jun 15 22:20:38 2004
@@ -18,13 +18,13 @@
  */
 
 /* Polaris memory regions */
-#define POLARIS_SPARSE_MEM_BASE		(IDENT_ADDR + 0xf800000000)
-#define POLARIS_DENSE_MEM_BASE		(IDENT_ADDR + 0xf900000000)
-#define POLARIS_SPARSE_IO_BASE		(IDENT_ADDR + 0xf980000000)
-#define POLARIS_SPARSE_CONFIG_BASE	(IDENT_ADDR + 0xf9c0000000)
-#define POLARIS_IACK_BASE		(IDENT_ADDR + 0xf9f8000000)
-#define POLARIS_DENSE_IO_BASE		(IDENT_ADDR + 0xf9fc000000)
-#define POLARIS_DENSE_CONFIG_BASE	(IDENT_ADDR + 0xf9fe000000)
+#define POLARIS_SPARSE_MEM_BASE		(IDENT_ADDR + 0xf800000000UL)
+#define POLARIS_DENSE_MEM_BASE		(IDENT_ADDR + 0xf900000000UL)
+#define POLARIS_SPARSE_IO_BASE		(IDENT_ADDR + 0xf980000000UL)
+#define POLARIS_SPARSE_CONFIG_BASE	(IDENT_ADDR + 0xf9c0000000UL)
+#define POLARIS_IACK_BASE		(IDENT_ADDR + 0xf9f8000000UL)
+#define POLARIS_DENSE_IO_BASE		(IDENT_ADDR + 0xf9fc000000UL)
+#define POLARIS_DENSE_CONFIG_BASE	(IDENT_ADDR + 0xf9fe000000UL)
 
 #define POLARIS_IACK_SC			POLARIS_IACK_BASE
 
diff -Nru a/include/asm-alpha/elf.h b/include/asm-alpha/elf.h
--- a/include/asm-alpha/elf.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-alpha/elf.h	Tue Jun 15 22:20:40 2004
@@ -1,6 +1,11 @@
 #ifndef __ASM_ALPHA_ELF_H
 #define __ASM_ALPHA_ELF_H
 
+/* Special values for the st_other field in the symbol table.  */
+
+#define STO_ALPHA_NOPV		0x80
+#define STO_ALPHA_STD_GPLOAD	0x88
+
 /*
  * Alpha ELF relocation types
  */
diff -Nru a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h
--- a/include/asm-alpha/floppy.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-alpha/floppy.h	Tue Jun 15 22:21:02 2004
@@ -108,10 +108,11 @@
  * on that platform... ;-}
  */
 
-#define CROSS_64KB(a,s)						\
-({ unsigned long __s64 = (unsigned long)(a);			\
-   unsigned long __e64 = __s64 + (unsigned long)(s) - 1;	\
-   (__s64 ^ __e64) & ~0xfffful; })
+static inline unsigned long CROSS_64KB(void *a, unsigned long s)
+{
+	unsigned long p = (unsigned long)a;
+	return ((p + s - 1) ^ p) & ~0xffffUL;
+}
 
 #define EXTRA_FLOPPY_PARAMS
 
diff -Nru a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h
--- a/include/asm-alpha/ide.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-alpha/ide.h	Tue Jun 15 22:20:44 2004
@@ -19,6 +19,8 @@
 #define MAX_HWIFS	CONFIG_IDE_MAX_HWIFS
 #endif
 
+#define IDE_ARCH_OBSOLETE_DEFAULTS
+
 static inline int ide_default_irq(unsigned long base)
 {
 	switch (base) {
@@ -42,6 +44,9 @@
 			return 0;
 	}
 }
+
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #ifdef CONFIG_PCI
 #define ide_init_default_irq(base)	(0)
diff -Nru a/include/asm-alpha/io.h b/include/asm-alpha/io.h
--- a/include/asm-alpha/io.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-alpha/io.h	Tue Jun 15 22:21:02 2004
@@ -9,9 +9,9 @@
  * Virtual -> physical identity mapping starts at this offset
  */
 #ifdef USE_48_BIT_KSEG
-#define IDENT_ADDR     0xffff800000000000
+#define IDENT_ADDR     0xffff800000000000UL
 #else
-#define IDENT_ADDR     0xfffffc0000000000
+#define IDENT_ADDR     0xfffffc0000000000UL
 #endif
 
 #ifdef __KERNEL__
diff -Nru a/include/asm-alpha/page.h b/include/asm-alpha/page.h
--- a/include/asm-alpha/page.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-alpha/page.h	Tue Jun 15 22:20:43 2004
@@ -73,16 +73,24 @@
 	return order;
 }
 
-#endif /* !__ASSEMBLY__ */
+#ifdef USE_48_BIT_KSEG
+#define PAGE_OFFSET		0xffff800000000000UL
+#else
+#define PAGE_OFFSET		0xfffffc0000000000UL
+#endif
 
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
+#else
 
 #ifdef USE_48_BIT_KSEG
 #define PAGE_OFFSET		0xffff800000000000
 #else
 #define PAGE_OFFSET		0xfffffc0000000000
 #endif
+
+#endif /* !__ASSEMBLY__ */
+
+/* to align the pointer to the (next) page boundary */
+#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
 
 #define __pa(x)			((unsigned long) (x) - PAGE_OFFSET)
 #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
diff -Nru a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
--- a/include/asm-alpha/pgtable.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-alpha/pgtable.h	Tue Jun 15 22:20:38 2004
@@ -83,7 +83,7 @@
 #define __DIRTY_BITS	(_PAGE_DIRTY | _PAGE_KWE | _PAGE_UWE)
 #define __ACCESS_BITS	(_PAGE_ACCESSED | _PAGE_KRE | _PAGE_URE)
 
-#define _PFN_MASK	0xFFFFFFFF00000000
+#define _PFN_MASK	0xFFFFFFFF00000000UL
 
 #define _PAGE_TABLE	(_PAGE_VALID | __DIRTY_BITS | __ACCESS_BITS)
 #define _PAGE_CHG_MASK	(_PFN_MASK | __DIRTY_BITS | __ACCESS_BITS)
@@ -348,7 +348,5 @@
 
 /* We have our own get_unmapped_area to cope with ADDR_LIMIT_32BIT.  */
 #define HAVE_ARCH_UNMAPPED_AREA
-
-typedef pte_t *pte_addr_t;
 
 #endif /* _ALPHA_PGTABLE_H */
diff -Nru a/include/asm-alpha/rmap.h b/include/asm-alpha/rmap.h
--- a/include/asm-alpha/rmap.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _ALPHA_RMAP_H
-#define _ALPHA_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-alpha/semaphore.h b/include/asm-alpha/semaphore.h
--- a/include/asm-alpha/semaphore.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-alpha/semaphore.h	Tue Jun 15 22:20:43 2004
@@ -18,12 +18,12 @@
 struct semaphore {
 	atomic_t count;
 	wait_queue_head_t wait;
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	long __magic;
 #endif
 };
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 # define __SEM_DEBUG_INIT(name)		, (long)&(name).__magic
 #else
 # define __SEM_DEBUG_INIT(name)
@@ -53,7 +53,7 @@
 
 	atomic_set(&sem->count, val);
 	init_waitqueue_head(&sem->wait);
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	sem->__magic = (long)&sem->__magic;
 #endif
 }
@@ -142,7 +142,7 @@
 		__up_wakeup(sem);
 }
 
-#if !WAITQUEUE_DEBUG && !defined(CONFIG_DEBUG_SEMAPHORE)
+#if !defined(WAITQUEUE_DEBUG) && !defined(CONFIG_DEBUG_SEMAPHORE)
 extern inline void down(struct semaphore *sem)
 {
 	__down(sem);
diff -Nru a/include/asm-alpha/signal.h b/include/asm-alpha/signal.h
--- a/include/asm-alpha/signal.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-alpha/signal.h	Tue Jun 15 22:20:40 2004
@@ -187,7 +187,6 @@
 #include <asm/sigcontext.h>
 
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif
 
diff -Nru a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h
--- a/include/asm-alpha/spinlock.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-alpha/spinlock.h	Tue Jun 15 22:20:42 2004
@@ -36,6 +36,7 @@
 
 #define spin_is_locked(x)	((x)->lock != 0)
 #define spin_unlock_wait(x)	({ do { barrier(); } while ((x)->lock); })
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 #ifdef CONFIG_DEBUG_SPINLOCK
 extern void _raw_spin_unlock(spinlock_t * lock);
diff -Nru a/include/asm-alpha/types.h b/include/asm-alpha/types.h
--- a/include/asm-alpha/types.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-alpha/types.h	Tue Jun 15 22:20:43 2004
@@ -56,6 +56,8 @@
 typedef u64 dma_addr_t;
 typedef u64 dma64_addr_t;
 
+typedef unsigned short kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ALPHA_TYPES_H */
diff -Nru a/include/asm-alpha/uaccess.h b/include/asm-alpha/uaccess.h
--- a/include/asm-alpha/uaccess.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-alpha/uaccess.h	Tue Jun 15 22:20:43 2004
@@ -29,6 +29,14 @@
 
 #define segment_eq(a,b)	((a).seg == (b).seg)
 
+#ifdef __CHECKER__
+#define CHECK_UPTR(ptr) do {                            \
+        __typeof__(*(ptr)) *__dummy_check_uptr =        \
+		(void __user *)&__dummy_check_uptr;     \
+} while(0)
+#else
+#define CHECK_UPTR(ptr)
+#endif
 
 /*
  * Is a address valid? This does a straightforward calculation rather
@@ -43,10 +51,13 @@
 #define __access_ok(addr,size,segment) \
 	(((segment).seg & (addr | size | (addr+size))) == 0)
 
-#define access_ok(type,addr,size) \
-	__access_ok(((unsigned long)(addr)),(size),get_fs())
+#define access_ok(type,addr,size)				\
+({								\
+	CHECK_UPTR(addr);					\
+	__access_ok(((unsigned long)(addr)),(size),get_fs());	\
+})
 
-extern inline int verify_area(int type, const void * addr, unsigned long size)
+extern inline int verify_area(int type, const void __user * addr, unsigned long size)
 {
 	return access_ok(type,addr,size) ? 0 : -EFAULT;
 }
@@ -90,6 +101,7 @@
 #define __get_user_nocheck(x,ptr,size)				\
 ({								\
 	long __gu_err = 0, __gu_val;				\
+	CHECK_UPTR(ptr);					\
 	switch (size) {						\
 	  case 1: __get_user_8(ptr); break;			\
 	  case 2: __get_user_16(ptr); break;			\
@@ -105,6 +117,7 @@
 ({								\
 	long __gu_err = -EFAULT, __gu_val = 0;			\
 	const __typeof__(*(ptr)) *__gu_addr = (ptr);		\
+	CHECK_UPTR(ptr);					\
 	if (__access_ok((long)__gu_addr,size,segment)) {	\
 		__gu_err = 0;					\
 		switch (size) {					\
@@ -204,6 +217,7 @@
 #define __put_user_nocheck(x,ptr,size)				\
 ({								\
 	long __pu_err = 0;					\
+	CHECK_UPTR(ptr);					\
 	switch (size) {						\
 	  case 1: __put_user_8(x,ptr); break;			\
 	  case 2: __put_user_16(x,ptr); break;			\
@@ -218,6 +232,7 @@
 ({								\
 	long __pu_err = -EFAULT;				\
 	__typeof__(*(ptr)) *__pu_addr = (ptr);			\
+	CHECK_UPTR(ptr);					\
 	if (__access_ok((long)__pu_addr,size,segment)) {	\
 		__pu_err = 0;					\
 		switch (size) {					\
@@ -371,34 +386,42 @@
 }
 
 extern inline long
-__copy_tofrom_user(void *to, const void *from, long len, const void *validate)
+__copy_tofrom_user(void *to, const void *from, long len, const void __user *validate)
 {
 	if (__access_ok((long)validate, len, get_fs()))
 		len = __copy_tofrom_user_nocheck(to, from, len);
 	return len;
 }
 
-#define __copy_to_user(to,from,n)   __copy_tofrom_user_nocheck((to),(from),(n))
-#define __copy_from_user(to,from,n) __copy_tofrom_user_nocheck((to),(from),(n))
+#define __copy_to_user(to,from,n)				\
+({								\
+	CHECK_UPTR(to);						\
+	__copy_tofrom_user_nocheck((void *)(to),(from),(n));	\
+})
+#define __copy_from_user(to,from,n)				\
+({								\
+	CHECK_UPTR(from);					\
+	__copy_tofrom_user_nocheck((to),(void *)(from),(n));	\
+})
 
 extern inline long
-copy_to_user(void *to, const void *from, long n)
+copy_to_user(void __user *to, const void *from, long n)
 {
-	return __copy_tofrom_user(to, from, n, to);
+	return __copy_tofrom_user((void *)to, from, n, to);
 }
 
 extern inline long
-copy_from_user(void *to, const void *from, long n)
+copy_from_user(void *to, const void __user *from, long n)
 {
-	return __copy_tofrom_user(to, from, n, from);
+	return __copy_tofrom_user(to, (void *)from, n, from);
 }
 
 extern void __do_clear_user(void);
 
 extern inline long
-__clear_user(void *to, long len)
+__clear_user(void __user *to, long len)
 {
-	register void * __cl_to __asm__("$6") = to;
+	register void __user * __cl_to __asm__("$6") = to;
 	register long __cl_len __asm__("$0") = len;
 	__asm__ __volatile__(
 		__module_call(28, 2, __do_clear_user)
@@ -410,7 +433,7 @@
 }
 
 extern inline long
-clear_user(void *to, long len)
+clear_user(void __user *to, long len)
 {
 	if (__access_ok((long)to, len, get_fs()))
 		len = __clear_user(to, len);
@@ -423,10 +446,10 @@
 /* Returns: -EFAULT if exception before terminator, N if the entire
    buffer filled, else strlen.  */
 
-extern long __strncpy_from_user(char *__to, const char *__from, long __to_len);
+extern long __strncpy_from_user(char *__to, const char __user *__from, long __to_len);
 
 extern inline long
-strncpy_from_user(char *to, const char *from, long n)
+strncpy_from_user(char *to, const char __user *from, long n)
 {
 	long ret = -EFAULT;
 	if (__access_ok((long)from, 0, get_fs()))
@@ -435,18 +458,18 @@
 }
 
 /* Returns: 0 if bad, string length+1 (memory size) of string if ok */
-extern long __strlen_user(const char *);
+extern long __strlen_user(const char __user *);
 
-extern inline long strlen_user(const char *str)
+extern inline long strlen_user(const char __user *str)
 {
 	return access_ok(VERIFY_READ,str,0) ? __strlen_user(str) : 0;
 }
 
 /* Returns: 0 if exception before NUL or reaching the supplied limit (N),
  * a value greater than N if the limit would be exceeded, else strlen.  */
-extern long __strnlen_user(const char *, long);
+extern long __strnlen_user(const char __user *, long);
 
-extern inline long strnlen_user(const char *str, long n)
+extern inline long strnlen_user(const char __user *str, long n)
 {
 	return access_ok(VERIFY_READ,str,0) ? __strnlen_user(str, n) : 0;
 }
diff -Nru a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
--- a/include/asm-alpha/unistd.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-alpha/unistd.h	Tue Jun 15 22:20:39 2004
@@ -558,6 +558,19 @@
 
 #endif /* __LIBRARY__ && __GNUC__ */
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
diff -Nru a/include/asm-arm/arch-adifcc/memory.h b/include/asm-arm/arch-adifcc/memory.h
--- a/include/asm-arm/arch-adifcc/memory.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-arm/arch-adifcc/memory.h	Tue Jun 15 22:20:41 2004
@@ -7,38 +7,12 @@
 #ifndef __ASM_ARCH_MEMORY_H
 #define __ASM_ARCH_MEMORY_H
 
-
-/*
- * Task size: 3GB
- */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
-
 /*
  * Physical DRAM offset.
  */
 #define PHYS_OFFSET	(0xC0000000UL)
 
 /*
- * physical vs virtual ram conversion
- */
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-#define __virt_to_phys(x)	((x) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(x)	((x) - PHYS_OFFSET + PAGE_OFFSET)
-
-/*
  * Virtual view <-> DMA view memory address translations
  * virt_to_bus: Used to translate the virtual address to an
  *		address suitable to be passed to set_dma_addr
@@ -47,8 +21,6 @@
  *
  * These are dummies for now.
  */
-#define __virt_to_bus__is_a_macro
-#define __bus_to_virt__is_a_macro
 #define __virt_to_bus(x)	 __virt_to_phys(x)
 #define __bus_to_virt(x)	 __phys_to_virt(x)
 
diff -Nru a/include/asm-arm/arch-cl7500/ide.h b/include/asm-arm/arch-cl7500/ide.h
--- a/include/asm-arm/arch-cl7500/ide.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,50 +0,0 @@
-/*
- * linux/include/asm-arm/arch-cl7500/ide.h
- *
- * Copyright (c) 1997 Russell King
- *
- * Modifications:
- *  29-07-1998	RMK	Major re-work of IDE architecture specific code
- */
-#include <asm/irq.h>
-#include <asm/arch/hardware.h>
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-
-	memset(hw, 0, sizeof(*hw));
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += 1;
-	}
-	if (ctrl_port) {
-		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-	} else {
-		hw->io_ports[IDE_CONTROL_OFFSET] = data_port + 0x206;
-	}
-	if (irq != NULL)
-		*irq = 0;
-	hw->io_ports[IDE_IRQ_OFFSET] = 0;
-}
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void
-ide_init_default_hwifs(void)
-{
-	hw_regs_t hw;
-
-	ide_init_hwif_ports(&hw, ISASLOT_IO + 0x1f0, ISASLOT_IO + 0x3f6, NULL);
-	hw.irq = IRQ_ISA_14;
-	ide_register_hw(&hw);
-}
diff -Nru a/include/asm-arm/arch-cl7500/keyboard.h b/include/asm-arm/arch-cl7500/keyboard.h
--- a/include/asm-arm/arch-cl7500/keyboard.h	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,16 +0,0 @@
-/*
- * linux/include/asm-arm/arch-cl7500/keyboard.h
- *  from linux/include/asm-arm/arch-rpc/keyboard.h
- *
- * Keyboard driver definitions for CL7500 architecture
- *
- * Copyright (C) 1998-2001 Russell King
- */
-#include <asm/irq.h>
-#define NR_SCANCODES 128
-
-extern int ps2kbd_init_hw(void);
-
-#define kbd_disable_irq()	disable_irq(IRQ_KEYBOARDRX)
-#define kbd_enable_irq()	enable_irq(IRQ_KEYBOARDRX)
-#define kbd_init_hw()		ps2kbd_init_hw()
diff -Nru a/include/asm-arm/arch-cl7500/memory.h b/include/asm-arm/arch-cl7500/memory.h
--- a/include/asm-arm/arch-cl7500/memory.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-arm/arch-cl7500/memory.h	Tue Jun 15 22:20:40 2004
@@ -11,39 +11,19 @@
  *  21-Mar-1999	RMK	Renamed to memory.h
  *		RMK	Added TASK_SIZE and PAGE_OFFSET
  */
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0x10000000UL)
 
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
-
 /*
  * These are exactly the same on the RiscPC as the
  * physical memory view.
  */
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x) __virt_to_phys(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x) __phys_to_virt(x)
 
 #endif
diff -Nru a/include/asm-arm/arch-clps711x/keyboard.h b/include/asm-arm/arch-clps711x/keyboard.h
--- a/include/asm-arm/arch-clps711x/keyboard.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,26 +0,0 @@
-/*
- * linux/include/asm-arm/arch-clps711x/keyboard.h
- *
- * Copyright (C) 1998-2001 Russell King
- */
-#include <asm/mach-types.h>
-
-#define NR_SCANCODES 128
-
-#define kbd_disable_irq()	do { } while (0)
-#define kbd_enable_irq()	do { } while (0)
-
-/*
- * EDB7211 keyboard driver
- */
-extern void edb7211_kbd_init_hw(void);
-extern void clps711x_kbd_init_hw(void);
-
-static inline void kbd_init_hw(void)
-{
-	if (machine_is_edb7211())
-		edb7211_kbd_init_hw();
-
-	if (machine_is_autcpu12())
-		clps711x_kbd_init_hw();
-}
diff -Nru a/include/asm-arm/arch-clps711x/memory.h b/include/asm-arm/arch-clps711x/memory.h
--- a/include/asm-arm/arch-clps711x/memory.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-arm/arch-clps711x/memory.h	Tue Jun 15 22:20:36 2004
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/arch-clps711x/mmu.h
+ *  linux/include/asm-arm/arch-clps711x/memory.h
  *
  *  Copyright (C) 1999 ARM Limited
  *
@@ -17,38 +17,17 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 #include <linux/config.h>
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0xc0000000UL)
 
 /*
- * On integrator, the dram is contiguous
- */
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
-
-/*
  * Virtual view <-> DMA view memory address translations
  * virt_to_bus: Used to translate the virtual address to an
  *              address suitable to be passed to set_dma_addr
@@ -58,23 +37,17 @@
 
 #if defined(CONFIG_ARCH_CDB89712)
 
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	(x)
 
 #elif defined (CONFIG_ARCH_AUTCPU12)
 
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	(x)
 
 #else
 
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	((x) - PAGE_OFFSET)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	((x) + PAGE_OFFSET)
 
 #endif
diff -Nru a/include/asm-arm/arch-ebsa110/ide.h b/include/asm-arm/arch-ebsa110/ide.h
--- a/include/asm-arm/arch-ebsa110/ide.h	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1 +0,0 @@
-/* no ide */
diff -Nru a/include/asm-arm/arch-ebsa110/io.h b/include/asm-arm/arch-ebsa110/io.h
--- a/include/asm-arm/arch-ebsa110/io.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-arm/arch-ebsa110/io.h	Tue Jun 15 22:20:42 2004
@@ -50,7 +50,7 @@
 #define writew(v,b)		__writew(v,b)
 #define writel(v,b)		__writel(v,b)
 
-#define __arch_ioremap(cookie,sz,c)	((void *)(cookie))
+#define __arch_ioremap(cookie,sz,c,a)	((void *)(cookie))
 #define __arch_iounmap(cookie)		do { } while (0)
 
 #endif
diff -Nru a/include/asm-arm/arch-ebsa110/memory.h b/include/asm-arm/arch-ebsa110/memory.h
--- a/include/asm-arm/arch-ebsa110/memory.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-arm/arch-ebsa110/memory.h	Tue Jun 15 22:20:38 2004
@@ -17,35 +17,15 @@
 #define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0x00000000UL)
 
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage)	((vpage) - PAGE_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage)	((ppage) + PAGE_OFFSET)
-
 /*
  * We keep this 1:1 so that we don't interfere
  * with the PCMCIA memory regions
  */
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	(x)
 
 #endif
diff -Nru a/include/asm-arm/arch-ebsa110/system.h b/include/asm-arm/arch-ebsa110/system.h
--- a/include/asm-arm/arch-ebsa110/system.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-arm/arch-ebsa110/system.h	Tue Jun 15 22:20:41 2004
@@ -25,13 +25,13 @@
 	const char *irq_stat = (char *)0xff000000;
 
 	/* disable clock switching */
-	asm volatile ("mcr%? p15, 0, ip, c15, c2, 2");
+	asm volatile ("mcr p15, 0, ip, c15, c2, 2" : : : "cc");
 
 	/* wait for an interrupt to occur */
 	while (!*irq_stat);
 
 	/* enable clock switching */
-	asm volatile ("mcr%? p15, 0, ip, c15, c1, 2");
+	asm volatile ("mcr p15, 0, ip, c15, c1, 2" : : : "cc");
 }
 
 #define arch_reset(mode)	cpu_reset(0x80000000)
diff -Nru a/include/asm-arm/arch-ebsa110/timex.h b/include/asm-arm/arch-ebsa110/timex.h
--- a/include/asm-arm/arch-ebsa110/timex.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-arm/arch-ebsa110/timex.h	Tue Jun 15 22:20:43 2004
@@ -15,5 +15,5 @@
  * This is therefore not used to calculate the
  * divisor.
  */
-//#define CLOCK_TICK_RATE		2000000
+#define CLOCK_TICK_RATE		47894000
 
diff -Nru a/include/asm-arm/arch-ebsa110/uncompress.h b/include/asm-arm/arch-ebsa110/uncompress.h
--- a/include/asm-arm/arch-ebsa110/uncompress.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-arm/arch-ebsa110/uncompress.h	Tue Jun 15 22:21:05 2004
@@ -13,26 +13,26 @@
  */
 static void puts(const char *s)
 {
-	__asm__ __volatile__("
-	ldrb	%0, [%2], #1
-	teq	%0, #0
-	beq	3f
-1:	strb	%0, [%3]
-2:	ldrb	%1, [%3, #0x14]
-	and	%1, %1, #0x60
-	teq	%1, #0x60
-	bne	2b
-	teq	%0, #'\n'
-	moveq	%0, #'\r'
-	beq	1b
-	ldrb	%0, [%2], #1
-	teq	%0, #0
-	bne	1b
-3:	ldrb	%1, [%3, #0x14]
-	and	%1, %1, #0x60
-	teq	%1, #0x60
-	bne	3b
-	" : : "r" (0), "r" (0), "r" (s), "r" (0xf0000be0) : "cc");
+	__asm__ __volatile__(
+	"ldrb	%0, [%2], #1\n"
+"	teq	%0, #0\n"
+"	beq	3f\n"
+"1:	strb	%0, [%3]\n"
+"2:	ldrb	%1, [%3, #0x14]\n"
+"	and	%1, %1, #0x60\n"
+"	teq	%1, #0x60\n"
+"	bne	2b\n"
+"	teq	%0, #'\n'\n"
+"	moveq	%0, #'\r'\n"
+"	beq	1b\n"
+"	ldrb	%0, [%2], #1\n"
+"	teq	%0, #0\n"
+"	bne	1b\n"
+"3:	ldrb	%1, [%3, #0x14]\n"
+"	and	%1, %1, #0x60\n"
+"	teq	%1, #0x60\n"
+"	bne	3b"
+	: : "r" (0), "r" (0), "r" (s), "r" (0xf0000be0) : "cc");
 }
 
 /*
diff -Nru a/include/asm-arm/arch-ebsa285/ide.h b/include/asm-arm/arch-ebsa285/ide.h
--- a/include/asm-arm/arch-ebsa285/ide.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,49 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-ebsa285/ide.h
- *
- *  Copyright (C) 1998 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
- * published by the Free Software Foundation.
- *
- *  Modifications:
- *   29-07-1998	RMK	Major re-work of IDE architecture specific code
- */
-#include <asm/irq.h>
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += 1;
-	}
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-	if (irq)
-		*irq = 0;
-}
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void ide_init_default_hwifs(void)
-{
-#if 0
-	hw_regs_t hw;
-
-	memset(hw, 0, sizeof(*hw));
-
-	ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
-	hw.irq = IRQ_HARDDISK;
-	ide_register_hw(&hw);
-#endif
-}
diff -Nru a/include/asm-arm/arch-ebsa285/memory.h b/include/asm-arm/arch-ebsa285/memory.h
--- a/include/asm-arm/arch-ebsa285/memory.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-arm/arch-ebsa285/memory.h	Tue Jun 15 22:20:43 2004
@@ -16,8 +16,8 @@
  *			Renamed to memory.h
  *			Moved PAGE_OFFSET and TASK_SIZE here
  */
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 #include <linux/config.h>
 
@@ -34,9 +34,7 @@
 
 #elif defined(CONFIG_FOOTBRIDGE_HOST)
 
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	((x) - 0xe0000000)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	((x) + 0xe0000000)
 
 #else
@@ -63,7 +61,9 @@
 
 #endif
 
-#define TASK_SIZE_26		(0x04000000UL)
+/*
+ * Physical DRAM offset.
+ */
 #define PHYS_OFFSET		(0x00000000UL)
 
 /*
@@ -71,13 +71,5 @@
  * space during mmap's.
  */
 #define TASK_UNMAPPED_BASE ((TASK_SIZE + 0x01000000) / 3)
-
-/*
- * The DRAM is always contiguous.
- */
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((unsigned long)(vpage) - PAGE_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((unsigned long)(ppage) + PAGE_OFFSET)
 
 #endif
diff -Nru a/include/asm-arm/arch-epxa10db/memory.h b/include/asm-arm/arch-epxa10db/memory.h
--- a/include/asm-arm/arch-epxa10db/memory.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-arm/arch-epxa10db/memory.h	Tue Jun 15 22:20:43 2004
@@ -17,45 +17,22 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0x00000000UL)
 
 /*
- * On epxa10, the dram is contiguous
- */
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET)
-
-/*
  * Virtual view <-> DMA view memory address translations
  * virt_to_bus: Used to translate the virtual address to an
  *              address suitable to be passed to set_dma_addr
  * bus_to_virt: Used to convert an address for DMA operations
  *              to an address that the kernel can use.
  */
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	(x - PAGE_OFFSET + /*SDRAM_BASE*/0)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	(x - /*SDRAM_BASE*/0 + PAGE_OFFSET)
 
 #endif
diff -Nru a/include/asm-arm/arch-integrator/memory.h b/include/asm-arm/arch-integrator/memory.h
--- a/include/asm-arm/arch-integrator/memory.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-arm/arch-integrator/memory.h	Tue Jun 15 22:20:39 2004
@@ -1,5 +1,5 @@
 /*
- *  linux/include/asm-arm/arch-integrator/mmu.h
+ *  linux/include/asm-arm/arch-integrator/memory.h
  *
  *  Copyright (C) 1999 ARM Limited
  *
@@ -17,35 +17,13 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0x00000000UL)
-
-/*
- * On integrator, the dram is contiguous
- */
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET)
-
 #define BUS_OFFSET	(0x80000000UL)
 
 /*
@@ -55,9 +33,7 @@
  * bus_to_virt: Used to convert an address for DMA operations
  *              to an address that the kernel can use.
  */
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	(x - PAGE_OFFSET + BUS_OFFSET)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	(x - BUS_OFFSET + PAGE_OFFSET)
 
 #endif
diff -Nru a/include/asm-arm/arch-iop3xx/ide.h b/include/asm-arm/arch-iop3xx/ide.h
--- a/include/asm-arm/arch-iop3xx/ide.h	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,49 +0,0 @@
-/*
- * include/asm-arm/arch-iop3xx/ide.h
- *
- * Generic IDE functions for IOP310 systems
- *
- * Author: Deepak Saxena <dsaxena@mvista.com>
- *
- * Copyright 2001 MontaVista Software Inc.
- *
- * 09/26/2001 - Sharon Baartmans
- * 	Fixed so it actually works.
- */
-
-#ifndef _ASM_ARCH_IDE_H_
-#define _ASM_ARCH_IDE_H_
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-	int regincr = 1;
-
-	memset(hw, 0, sizeof(*hw));
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += regincr;
-	}
-
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-
-	if (irq) *irq = 0;
-}
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void ide_init_default_hwifs(void)
-{
-	/* There are no standard ports */
-}
-
-#endif
diff -Nru a/include/asm-arm/arch-iop3xx/memory.h b/include/asm-arm/arch-iop3xx/memory.h
--- a/include/asm-arm/arch-iop3xx/memory.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-arm/arch-iop3xx/memory.h	Tue Jun 15 22:20:44 2004
@@ -10,45 +10,17 @@
 #include <asm/arch/iop321.h>
 
 /*
- * Task size: 3GB
- */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
-
-/*
  * Physical DRAM offset.
  */
 #define PHYS_OFFSET	(0xa0000000UL)
 
 /*
- * physical vs virtual ram conversion
- */
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-#define __virt_to_phys(x)	((x) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(x)	((x) - PHYS_OFFSET + PAGE_OFFSET)
-
-/*
  * Virtual view <-> DMA view memory address translations
  * virt_to_bus: Used to translate the virtual address to an
  *		address suitable to be passed to set_dma_addr
  * bus_to_virt: Used to convert an address for DMA operations
  *		to an address that the kernel can use.
  */
-#define __virt_to_bus__is_a_macro
-#define __bus_to_virt__is_a_macro
-
 #ifdef CONFIG_ARCH_IOP310
 
 #define __virt_to_bus(x)	(((__virt_to_phys(x)) & ~(*IOP310_SIATVR)) | ((*IOP310_SIABAR) & 0xfffffff0))
diff -Nru a/include/asm-arm/arch-ixp4xx/coyote.h b/include/asm-arm/arch-ixp4xx/coyote.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/coyote.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,36 @@
+/*
+ * include/asm-arm/arch-ixp4xx/coyote.h
+ *
+ * ADI Engineering platform specific definitions
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright 2004 (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.
+ */
+
+#ifndef __ASM_ARCH_HARDWARE_H__
+#error "Do not include this directly, instead #include <asm/hardware.h>"
+#endif
+
+#define	COYOTE_FLASH_BASE	IXP4XX_EXP_BUS_CS0_BASE_PHYS
+#define	COYOTE_FLASH_SIZE	IXP4XX_EXP_BUS_CSX_REGION_SIZE * 2
+
+/* PCI controller GPIO to IRQ pin mappings */
+#define	COYOTE_PCI_SLOT0_PIN	6
+#define	COYOTE_PCI_SLOT1_PIN	11
+
+#define	COYOTE_PCI_SLOT0_DEVID	14
+#define	COYOTE_PCI_SLOT1_DEVID	15
+
+#define	COYOTE_IDE_BASE_PHYS	IXP4XX_EXP_BUS_CS3_BASE_PHYS
+#define	COYOTE_IDE_BASE_VIRT	0xFFFE1000
+#define	COYOTE_IDE_REGION_SIZE	0x1000
+
+#define	COYOTE_IDE_DATA_PORT	0xFFFE10E0
+#define	COYOTE_IDE_CTRL_PORT	0xFFFE10FC
+#define	COYOTE_IDE_ERROR_PORT	0xFFFE10E2
+
diff -Nru a/include/asm-arm/arch-ixp4xx/dma.h b/include/asm-arm/arch-ixp4xx/dma.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/dma.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,52 @@
+/*
+ * include/asm-arm/arch-ixp4xx/dma.h
+ *
+ * Copyright (C) 2001-2004 MontaVista Software, Inc.
+ *
+ * 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.
+ *
+ */
+#ifndef __ASM_ARCH_DMA_H
+#define __ASM_ARCH_DMA_H
+
+#include <linux/config.h>
+#include <linux/device.h>
+#include <linux/pci.h>
+#include <asm/page.h>
+#include <asm/sizes.h>
+#include <asm/hardware.h>
+
+#define MAX_DMA_ADDRESS		(PAGE_OFFSET + SZ_64M)
+
+/* No DMA */
+#define MAX_DMA_CHANNELS	0
+
+/*
+ * Only first 64MB of memory can be accessed via PCI.
+ * We use GFP_DMA to allocate safe buffers to do map/unmap.
+ * This is really ugly and we need a better way of specifying
+ * DMA-capable regions of memory.
+ */
+static inline void __arch_adjust_zones(int node, unsigned long *zone_size, 
+	unsigned long *zhole_size) 
+{
+	unsigned int sz = SZ_64M >> PAGE_SHIFT;
+
+	/*
+	 * Only adjust if > 64M on current system
+	 */
+	if (node || (zone_size[0] <= sz))
+		return;
+
+	zone_size[1] = zone_size[0] - sz;
+	zone_size[0] = sz;
+	zhole_size[1] = zhole_size[0];
+	zhole_size[0] = 0;
+}
+
+#define arch_adjust_zones(node, size, holes) \
+	__arch_adjust_zones(node, size, holes)
+
+#endif /* _ASM_ARCH_DMA_H */
diff -Nru a/include/asm-arm/arch-ixp4xx/hardware.h b/include/asm-arm/arch-ixp4xx/hardware.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/hardware.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,41 @@
+/*
+ * include/asm-arm/arch-ixp4xx/hardware.h 
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * Hardware definitions for IXP4xx based systems
+ */
+
+#ifndef __ASM_ARCH_HARDWARE_H__
+#define __ASM_ARCH_HARDWARE_H__
+
+#define PCIBIOS_MIN_IO			0x00001000
+#define PCIBIOS_MIN_MEM			0x48000000
+
+/*
+ * We override the standard dma-mask routines for bouncing.
+ */
+#define	HAVE_ARCH_PCI_SET_DMA_MASK
+
+#define pcibios_assign_all_busses()	1
+
+/* Register locations and bits */
+#include "ixp4xx-regs.h"
+
+/* Platform helper functions and definitions */
+#include "platform.h"
+
+/* Platform specific details */
+#include "ixdp425.h"
+#include "coyote.h"
+#include "prpmc1100.h"
+
+#endif  /* _ASM_ARCH_HARDWARE_H */
diff -Nru a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/io.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,388 @@
+/*
+ * linux/include/asm-arm/arch-ixp4xx/io.h
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright (C) 2002-2004  MontaVista Software, Inc.
+ *
+ * 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.
+ */
+
+#ifndef __ASM_ARM_ARCH_IO_H
+#define __ASM_ARM_ARCH_IO_H
+
+#include <asm/hardware.h>
+
+#define IO_SPACE_LIMIT 0xffff0000
+
+#define	BIT(x)	((1)<<(x))
+
+
+extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);
+extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
+
+
+/*
+ * IXP4xx provides two methods of accessing PCI memory space:
+ *
+ * 1) A direct mapped window from 0x48000000 to 0x4bffffff (64MB).
+ *    To access PCI via this space, we simply ioremap() the BAR
+ *    into the kernel and we can use the standard read[bwl]/write[bwl]
+ *    macros. This is the preffered method due to speed but it
+ *    limits the system to just 64MB of PCI memory. This can be 
+ *    problamatic if using video cards and other memory-heavy
+ *    targets.
+ *
+ * 2) If > 64MB of memory space is required, the IXP4xx can be configured
+ *    to use indirect registers to access PCI (as we do below for I/O
+ *    transactions). This allows for up to 128MB (0x48000000 to 0x4fffffff)
+ *    of memory on the bus. The disadvantadge of this is that every 
+ *    PCI access requires three local register accesses plus a spinlock,
+ *    but in some cases the performance hit is acceptable. In addition,
+ *    you cannot mmap() PCI devices in this case.
+ *
+ */
+#ifndef	CONFIG_IXP4XX_INDIRECT_PCI
+
+#define __mem_pci(a)		((unsigned long)(a))
+
+#else
+
+#include <linux/mm.h>
+
+/*
+ * In the case of using indirect PCI, we simply return the actual PCI
+ * address and our read/write implementation use that to drive the 
+ * access registers. If something outside of PCI is ioremap'd, we
+ * fallback to the default.
+ */
+static inline void *
+__ixp4xx_ioremap(unsigned long addr, size_t size, unsigned long flags, unsigned long align)
+{
+	extern void * __ioremap(unsigned long, size_t, unsigned long, unsigned long);
+	if((addr < 0x48000000) || (addr > 0x4fffffff))
+		return __ioremap(addr, size, flags, align);
+
+	return (void *)addr;
+}
+
+static inline void
+__ixp4xx_iounmap(void *addr)
+{
+	extern void __iounmap(void *addr);
+
+	if ((u32)addr > VMALLOC_START)
+		__iounmap(addr);
+}
+
+#define __arch_ioremap(a, s, f, x)	__ixp4xx_ioremap(a, s, f, x)
+#define	__arch_iounmap(a)		__ixp4xx_iounmap(a)
+
+#define	writeb(p, v)			__ixp4xx_writeb(p, v)
+#define	writew(p, v)			__ixp4xx_writew(p, v)
+#define	writel(p, v)			__ixp4xx_writel(p, v)
+
+#define	writesb(p, v, l)		__ixp4xx_writesb(p, v, l)
+#define	writesw(p, v, l)		__ixp4xx_writesw(p, v, l)
+#define	writesl(p, v, l)		__ixp4xx_writesl(p, v, l)
+	
+#define	readb(p)			__ixp4xx_readb(p)
+#define	readw(p)			__ixp4xx_readw(p)
+#define	readl(p)			__ixp4xx_readl(p)
+	
+#define	readsb(p, v, l)			__ixp4xx_readsb(p, v, l)
+#define	readsw(p, v, l)			__ixp4xx_readsw(p, v, l)
+#define	readsl(p, v, l)			__ixp4xx_readsl(p, v, l)
+
+static inline void 
+__ixp4xx_writeb(u8 value, u32 addr)
+{
+	u32 n, byte_enables, data;
+
+	if (addr > VMALLOC_START) {
+		__raw_writeb(value, addr);
+		return;
+	}
+
+	n = addr % 4;
+	byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
+	data = value << (8*n);
+	ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data);
+}
+
+static inline void
+__ixp4xx_writesb(u32 bus_addr, u8 *vaddr, int count)
+{
+	while (count--)
+		writeb(*vaddr++, bus_addr);
+}
+
+static inline void 
+__ixp4xx_writew(u16 value, u32 addr)
+{
+	u32 n, byte_enables, data;
+
+	if (addr > VMALLOC_START) {
+		__raw_writew(value, addr);
+		return;
+	}
+
+	n = addr % 4;
+	byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
+	data = value << (8*n);
+	ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data);
+}
+
+static inline void
+__ixp4xx_writesw(u32 bus_addr, u16 *vaddr, int count)
+{
+	while (count--)
+		writew(*vaddr++, bus_addr);
+}
+
+static inline void 
+__ixp4xx_writel(u32 value, u32 addr)
+{
+	if (addr > VMALLOC_START) {
+		__raw_writel(value, addr);
+		return;
+	}
+
+	ixp4xx_pci_write(addr, NP_CMD_MEMWRITE, value);
+}
+
+static inline void
+__ixp4xx_writesl(u32 bus_addr, u32 *vaddr, int count)
+{
+	while (count--)
+		writel(*vaddr++, bus_addr);
+}
+
+static inline unsigned char 
+__ixp4xx_readb(u32 addr)
+{
+	u32 n, byte_enables, data;
+
+	if (addr > VMALLOC_START)
+		return __raw_readb(addr);
+
+	n = addr % 4;
+	byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
+	if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data))
+		return 0xff;
+
+	return data >> (8*n);
+}
+
+static inline void
+__ixp4xx_readsb(u32 bus_addr, u8 *vaddr, u32 count)
+{
+	while (count--)
+		*vaddr++ = readb(bus_addr);
+}
+
+static inline unsigned short 
+__ixp4xx_readw(u32 addr)
+{
+	u32 n, byte_enables, data;
+
+	if (addr > VMALLOC_START)
+		return __raw_readw(addr);
+
+	n = addr % 4;
+	byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
+	if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data))
+		return 0xffff;
+
+	return data>>(8*n);
+}
+
+static inline void 
+__ixp4xx_readsw(u32 bus_addr, u16 *vaddr, u32 count)
+{
+	while (count--)
+		*vaddr++ = readw(bus_addr);
+}
+
+static inline unsigned long 
+__ixp4xx_readl(u32 addr)
+{
+	u32 data;
+
+	if (addr > VMALLOC_START)
+		return __raw_readl(addr);
+
+	if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data))
+		return 0xffffffff;
+
+	return data;
+}
+
+static inline void 
+__ixp4xx_readsl(u32 bus_addr, u32 *vaddr, u32 count)
+{
+	while (count--)
+		*vaddr++ = readl(bus_addr);
+}
+
+
+/*
+ * We can use the built-in functions b/c they end up calling writeb/readb
+ */
+#define memset_io(c,v,l)		_memset_io((c),(v),(l))
+#define memcpy_fromio(a,c,l)		_memcpy_fromio((a),(c),(l))
+#define memcpy_toio(c,a,l)		_memcpy_toio((c),(a),(l))
+
+#define eth_io_copy_and_sum(s,c,l,b) \
+				eth_copy_and_sum((s),__mem_pci(c),(l),(b))
+
+static inline int
+check_signature(unsigned long bus_addr, const unsigned char *signature,
+		int length)
+{
+	int retval = 0;
+	do {
+		if (readb(bus_addr) != *signature)
+			goto out;
+		bus_addr++;
+		signature++;
+		length--;
+	} while (length);
+	retval = 1;
+out:
+	return retval;
+}
+
+#endif
+
+/*
+ * IXP4xx does not have a transparent cpu -> PCI I/O translation
+ * window.  Instead, it has a set of registers that must be tweaked
+ * with the proper byte lanes, command types, and address for the
+ * transaction.  This means that we need to override the default
+ * I/O functions.
+ */
+#define	outb(p, v)			__ixp4xx_outb(p, v)
+#define	outw(p, v)			__ixp4xx_outw(p, v)
+#define	outl(p, v)			__ixp4xx_outl(p, v)
+	
+#define	outsb(p, v, l)			__ixp4xx_outsb(p, v, l)
+#define	outsw(p, v, l)			__ixp4xx_outsw(p, v, l)
+#define	outsl(p, v, l)			__ixp4xx_outsl(p, v, l)
+
+#define	inb(p)				__ixp4xx_inb(p)
+#define	inw(p)				__ixp4xx_inw(p)
+#define	inl(p)				__ixp4xx_inl(p)
+
+#define	insb(p, v, l)			__ixp4xx_insb(p, v, l)
+#define	insw(p, v, l)			__ixp4xx_insw(p, v, l)
+#define	insl(p, v, l)			__ixp4xx_insl(p, v, l)
+
+
+static inline void 
+__ixp4xx_outb(u8 value, u32 addr)
+{
+	u32 n, byte_enables, data;
+	n = addr % 4;
+	byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
+	data = value << (8*n);
+	ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
+}
+
+static inline void 
+__ixp4xx_outsb(u32 io_addr, u8 *vaddr, u32 count)
+{
+	while (count--)
+		outb(*vaddr++, io_addr);
+}
+
+static inline void 
+__ixp4xx_outw(u16 value, u32 addr)
+{
+	u32 n, byte_enables, data;
+	n = addr % 4;
+	byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
+	data = value << (8*n);
+	ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
+}
+
+static inline void 
+__ixp4xx_outsw(u32 io_addr, u16 *vaddr, u32 count)
+{
+	while (count--)
+		outw(cpu_to_le16(*vaddr++), io_addr);
+}
+
+static inline void 
+__ixp4xx_outl(u32 value, u32 addr)
+{
+	ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value);
+}
+
+static inline void 
+__ixp4xx_outsl(u32 io_addr, u32 *vaddr, u32 count)
+{
+	while (count--)
+		outl(*vaddr++, io_addr);
+}
+
+static inline u8 
+__ixp4xx_inb(u32 addr)
+{
+	u32 n, byte_enables, data;
+	n = addr % 4;
+	byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
+	if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_IOREAD, &data))
+		return 0xff;
+
+	return data >> (8*n);
+}
+
+static inline void 
+__ixp4xx_insb(u32 io_addr, u8 *vaddr, u32 count)
+{
+	while (count--)
+		*vaddr++ = inb(io_addr);
+}
+
+static inline u16 
+__ixp4xx_inw(u32 addr)
+{
+	u32 n, byte_enables, data;
+	n = addr % 4;
+	byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
+	if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_IOREAD, &data))
+		return 0xffff;
+
+	return data>>(8*n);
+}
+
+static inline void 
+__ixp4xx_insw(u32 io_addr, u16 *vaddr, u32 count)
+{
+	while (count--)
+		*vaddr++ = le16_to_cpu(inw(io_addr));
+}
+
+static inline u32 
+__ixp4xx_inl(u32 addr)
+{
+	u32 data;
+	if (ixp4xx_pci_read(addr, NP_CMD_IOREAD, &data))
+		return 0xffffffff;
+
+	return data;
+}
+
+static inline void 
+__ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count)
+{
+	while (count--)
+		*vaddr++ = inl(io_addr);
+}
+
+
+#endif	//  __ASM_ARM_ARCH_IO_H
+
diff -Nru a/include/asm-arm/arch-ixp4xx/irq.h b/include/asm-arm/arch-ixp4xx/irq.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/irq.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,13 @@
+/*
+ * irq.h 
+ *
+ *  Copyright (C) 2002 Intel Corporation.
+ *
+ * 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.
+ *
+ */
+
+#define fixup_irq(irq)  (irq)
+
diff -Nru a/include/asm-arm/arch-ixp4xx/irqs.h b/include/asm-arm/arch-ixp4xx/irqs.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/irqs.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,78 @@
+/*
+ * include/asm-arm/arch-ixp4xx/irqs.h 
+ *
+ * IRQ definitions for IXP4XX based systems
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ * Copyright (C) 2003 MontaVista Software, Inc.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _ARCH_IXP4XX_IRQS_H_
+#define _ARCH_IXP4XX_IRQS_H_
+
+#define NR_IRQS			32
+
+#define IRQ_IXP4XX_NPEA		0
+#define IRQ_IXP4XX_NPEB		1
+#define IRQ_IXP4XX_NPEC		2
+#define IRQ_IXP4XX_QM1		3
+#define IRQ_IXP4XX_QM2		4
+#define IRQ_IXP4XX_TIMER1	5
+#define IRQ_IXP4XX_GPIO0	6
+#define IRQ_IXP4XX_GPIO1	7
+#define IRQ_IXP4XX_PCI_INT	8
+#define IRQ_IXP4XX_PCI_DMA1	9
+#define IRQ_IXP4XX_PCI_DMA2	10
+#define IRQ_IXP4XX_TIMER2	11
+#define IRQ_IXP4XX_USB		12
+#define IRQ_IXP4XX_UART2	13
+#define IRQ_IXP4XX_TIMESTAMP	14
+#define IRQ_IXP4XX_UART1	15
+#define IRQ_IXP4XX_WDOG		16
+#define IRQ_IXP4XX_AHB_PMU	17
+#define IRQ_IXP4XX_XSCALE_PMU	18
+#define IRQ_IXP4XX_GPIO2	19
+#define IRQ_IXP4XX_GPIO3	20
+#define IRQ_IXP4XX_GPIO4	21
+#define IRQ_IXP4XX_GPIO5	22
+#define IRQ_IXP4XX_GPIO6	23
+#define IRQ_IXP4XX_GPIO7	24
+#define IRQ_IXP4XX_GPIO8	25
+#define IRQ_IXP4XX_GPIO9	26
+#define IRQ_IXP4XX_GPIO10	27
+#define IRQ_IXP4XX_GPIO11	28
+#define IRQ_IXP4XX_GPIO12	29
+#define IRQ_IXP4XX_SW_INT1	30
+#define IRQ_IXP4XX_SW_INT2	31
+
+#define	XSCALE_PMU_IRQ		(IRQ_IXP4XX_XSCALE_PMU)
+
+/*
+ * IXDP425 board IRQs
+ */
+#define	IRQ_IXDP425_PCI_INTA	IRQ_IXP4XX_GPIO11
+#define	IRQ_IXDP425_PCI_INTB	IRQ_IXP4XX_GPIO10
+#define	IRQ_IXDP425_PCI_INTC	IRQ_IXP4XX_GPIO9
+#define	IRQ_IXDP425_PCI_INTD	IRQ_IXP4XX_GPIO8
+
+/*
+ * PrPMC1100 Board IRQs
+ */
+#define	IRQ_PRPMC1100_PCI_INTA	IRQ_IXP4XX_GPIO11
+#define	IRQ_PRPMC1100_PCI_INTB	IRQ_IXP4XX_GPIO10
+#define	IRQ_PRPMC1100_PCI_INTC	IRQ_IXP4XX_GPIO9
+#define	IRQ_PRPMC1100_PCI_INTD	IRQ_IXP4XX_GPIO8
+
+/*
+ * ADI Coyote Board IRQs
+ */
+#define	IRQ_COYOTE_PCI_SLOT0	IRQ_IXP4XX_GPIO6
+#define	IRQ_COYOTE_PCI_SLOT1	IRQ_IXP4XX_GPIO11
+#define	IRQ_COYOTE_IDE		IRQ_IXP4XX_GPIO5
+
+#endif
diff -Nru a/include/asm-arm/arch-ixp4xx/ixdp425.h b/include/asm-arm/arch-ixp4xx/ixdp425.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/ixdp425.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,38 @@
+/*
+ * include/asm-arm/arch-ixp4xx/ixdp425.h
+ *
+ * IXDP425 platform specific definitions
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright 2004 (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.
+ */
+
+#ifndef __ASM_ARCH_HARDWARE_H__
+#error "Do not include this directly, instead #include <asm/hardware.h>"
+#endif
+
+#define	IXDP425_FLASH_BASE	IXP4XX_EXP_BUS_CS0_BASE_PHYS
+#define	IXDP425_FLASH_SIZE	IXP4XX_EXP_BUS_CSX_REGION_SIZE
+
+#define	IXDP425_SDA_PIN		7
+#define	IXDP425_SCL_PIN		6
+
+/*
+ * IXDP425 PCI IRQs
+ */
+#define IXDP425_PCI_MAX_DEV	4
+#define IXDP425_PCI_IRQ_LINES	4
+
+
+/* PCI controller GPIO to IRQ pin mappings */
+#define IXDP425_PCI_INTA_PIN	11
+#define IXDP425_PCI_INTB_PIN	10
+#define	IXDP425_PCI_INTC_PIN	9
+#define	IXDP425_PCI_INTD_PIN	8
+
+
diff -Nru a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,551 @@
+/*
+ * include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
+ *
+ * Register definitions for IXP4xx chipset. This file contains 
+ * register location and bit definitions only. Platform specific 
+ * definitions and helper function declarations are in platform.h 
+ * and machine-name.h.
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __ASM_ARCH_HARDWARE_H__
+#error "Do not include this directly, instead #include <asm/hardware.h>"
+#endif
+
+#ifndef _ASM_ARM_IXP4XX_H_
+#define _ASM_ARM_IXP4XX_H_
+
+/*
+ * IXP4xx Linux Memory Map:
+ *
+ * Phy		Size		Virt		Description
+ * =========================================================================
+ *
+ * 0x00000000	0x10000000(max)	PAGE_OFFSET	System RAM
+ *
+ * 0x48000000	0x04000000	ioremap'd	PCI Memory Space
+ *
+ * 0x50000000	0x10000000	ioremap'd	EXP BUS
+ *
+ * 0x6000000	0x00004000	ioremap'd	QMgr
+ *
+ * 0xC0000000	0x00001000	0xffbfe000	PCI CFG 
+ *
+ * 0xC4000000	0x00001000	0xffbfd000	EXP CFG 
+ *
+ * 0xC8000000	0x0000C000	0xffbf2000	On-Chip Peripherals
+ */
+
+
+/*
+ * Expansion BUS Configuration registers
+ */
+#define IXP4XX_EXP_CFG_BASE_PHYS	(0xC4000000)
+#define IXP4XX_EXP_CFG_BASE_VIRT	(0xFFBFD000)
+#define IXP4XX_EXP_CFG_REGION_SIZE	(0x00001000)
+
+/*
+ * PCI Config registers
+ */
+#define IXP4XX_PCI_CFG_BASE_PHYS	(0xC0000000)
+#define	IXP4XX_PCI_CFG_BASE_VIRT	(0xFFBFD000)
+#define IXP4XX_PCI_CFG_REGION_SIZE	(0x00001000)
+
+/*
+ * Peripheral space
+ */
+#define IXP4XX_PERIPHERAL_BASE_PHYS	(0xC8000000)
+#define IXP4XX_PERIPHERAL_BASE_VIRT	(0xFFBF2000)
+#define IXP4XX_PERIPHERAL_REGION_SIZE	(0x0000C000)
+
+#define IXP4XX_EXP_CS0_OFFSET	0x00
+#define IXP4XX_EXP_CS1_OFFSET   0x04
+#define IXP4XX_EXP_CS2_OFFSET   0x08
+#define IXP4XX_EXP_CS3_OFFSET   0x0C
+#define IXP4XX_EXP_CS4_OFFSET   0x10
+#define IXP4XX_EXP_CS5_OFFSET   0x14
+#define IXP4XX_EXP_CS6_OFFSET   0x18
+#define IXP4XX_EXP_CS7_OFFSET   0x1C
+#define IXP4XX_EXP_CFG0_OFFSET	0x20
+#define IXP4XX_EXP_CFG1_OFFSET	0x24
+#define IXP4XX_EXP_CFG2_OFFSET	0x28
+#define IXP4XX_EXP_CFG3_OFFSET	0x2C
+
+/*
+ * Expansion Bus Controller registers.
+ */
+#define IXP4XX_EXP_REG(x) ((volatile u32 *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
+
+#define IXP4XX_EXP_CS0      IXP4XX_EXP_REG(IXP4XX_EXP_CS0_OFFSET)
+#define IXP4XX_EXP_CS1      IXP4XX_EXP_REG(IXP4XX_EXP_CS1_OFFSET)
+#define IXP4XX_EXP_CS2      IXP4XX_EXP_REG(IXP4XX_EXP_CS2_OFFSET) 
+#define IXP4XX_EXP_CS3      IXP4XX_EXP_REG(IXP4XX_EXP_CS3_OFFSET)
+#define IXP4XX_EXP_CS4      IXP4XX_EXP_REG(IXP4XX_EXP_CS4_OFFSET)
+#define IXP4XX_EXP_CS5      IXP4XX_EXP_REG(IXP4XX_EXP_CS5_OFFSET)
+#define IXP4XX_EXP_CS6      IXP4XX_EXP_REG(IXP4XX_EXP_CS6_OFFSET)     
+#define IXP4XX_EXP_CS7      IXP4XX_EXP_REG(IXP4XX_EXP_CS7_OFFSET)
+
+#define IXP4XX_EXP_CFG0     IXP4XX_EXP_REG(IXP4XX_EXP_CFG0_OFFSET) 
+#define IXP4XX_EXP_CFG1     IXP4XX_EXP_REG(IXP4XX_EXP_CFG1_OFFSET) 
+#define IXP4XX_EXP_CFG2     IXP4XX_EXP_REG(IXP4XX_EXP_CFG2_OFFSET) 
+#define IXP4XX_EXP_CFG3     IXP4XX_EXP_REG(IXP4XX_EXP_CFG3_OFFSET)
+
+
+/*
+ * Peripheral Space Register Region Base Addresses
+ */
+#define IXP4XX_UART1_BASE_PHYS	(IXP4XX_PERIPHERAL_BASE_PHYS + 0x0000)
+#define IXP4XX_UART2_BASE_PHYS	(IXP4XX_PERIPHERAL_BASE_PHYS + 0x1000)
+#define IXP4XX_PMU_BASE_PHYS	(IXP4XX_PERIPHERAL_BASE_PHYS + 0x2000)
+#define IXP4XX_INTC_BASE_PHYS	(IXP4XX_PERIPHERAL_BASE_PHYS + 0x3000)
+#define IXP4XX_GPIO_BASE_PHYS	(IXP4XX_PERIPHERAL_BASE_PHYS + 0x4000)
+#define IXP4XX_TIMER_BASE_PHYS	(IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000)
+#define IXP4XX_USB_BASE_PHYS	(IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000)
+
+#define IXP4XX_UART1_BASE_VIRT	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x0000)
+#define IXP4XX_UART2_BASE_VIRT	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x1000)
+#define IXP4XX_PMU_BASE_VIRT	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x2000)
+#define IXP4XX_INTC_BASE_VIRT	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
+#define IXP4XX_GPIO_BASE_VIRT	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
+#define IXP4XX_TIMER_BASE_VIRT	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
+#define IXP4XX_USB_BASE_VIRT	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
+
+/*
+ * Constants to make it easy to access  Interrupt Controller registers
+ */
+#define IXP4XX_ICPR_OFFSET	0x00 /* Interrupt Status */
+#define IXP4XX_ICMR_OFFSET	0x04 /* Interrupt Enable */
+#define IXP4XX_ICLR_OFFSET	0x08 /* Interrupt IRQ/FIQ Select */
+#define IXP4XX_ICIP_OFFSET      0x0C /* IRQ Status */
+#define IXP4XX_ICFP_OFFSET	0x10 /* FIQ Status */
+#define IXP4XX_ICHR_OFFSET	0x14 /* Interrupt Priority */
+#define IXP4XX_ICIH_OFFSET	0x18 /* IRQ Highest Pri Int */
+#define IXP4XX_ICFH_OFFSET	0x1C /* FIQ Highest Pri Int */
+
+/*
+ * Interrupt Controller Register Definitions.
+ */
+
+#define IXP4XX_INTC_REG(x) ((volatile u32 *)(IXP4XX_INTC_BASE_VIRT+(x)))
+
+#define IXP4XX_ICPR	IXP4XX_INTC_REG(IXP4XX_ICPR_OFFSET)
+#define IXP4XX_ICMR     IXP4XX_INTC_REG(IXP4XX_ICMR_OFFSET)
+#define IXP4XX_ICLR     IXP4XX_INTC_REG(IXP4XX_ICLR_OFFSET)
+#define IXP4XX_ICIP     IXP4XX_INTC_REG(IXP4XX_ICIP_OFFSET)
+#define IXP4XX_ICFP     IXP4XX_INTC_REG(IXP4XX_ICFP_OFFSET)
+#define IXP4XX_ICHR     IXP4XX_INTC_REG(IXP4XX_ICHR_OFFSET)
+#define IXP4XX_ICIH     IXP4XX_INTC_REG(IXP4XX_ICIH_OFFSET) 
+#define IXP4XX_ICFH     IXP4XX_INTC_REG(IXP4XX_ICFH_OFFSET)
+                                                                                
+/*
+ * Constants to make it easy to access GPIO registers
+ */
+#define IXP4XX_GPIO_GPOUTR_OFFSET       0x00
+#define IXP4XX_GPIO_GPOER_OFFSET        0x04
+#define IXP4XX_GPIO_GPINR_OFFSET        0x08
+#define IXP4XX_GPIO_GPISR_OFFSET        0x0C
+#define IXP4XX_GPIO_GPIT1R_OFFSET	0x10
+#define IXP4XX_GPIO_GPIT2R_OFFSET	0x14
+#define IXP4XX_GPIO_GPCLKR_OFFSET	0x18
+#define IXP4XX_GPIO_GPDBSELR_OFFSET	0x1C
+
+/* 
+ * GPIO Register Definitions.
+ * [Only perform 32bit reads/writes]
+ */
+#define IXP4XX_GPIO_REG(x) ((volatile u32 *)(IXP4XX_GPIO_BASE_VIRT+(x)))
+
+#define IXP4XX_GPIO_GPOUTR	IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOUTR_OFFSET)
+#define IXP4XX_GPIO_GPOER       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOER_OFFSET)
+#define IXP4XX_GPIO_GPINR       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPINR_OFFSET)
+#define IXP4XX_GPIO_GPISR       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPISR_OFFSET)
+#define IXP4XX_GPIO_GPIT1R      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT1R_OFFSET)
+#define IXP4XX_GPIO_GPIT2R      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT2R_OFFSET)
+#define IXP4XX_GPIO_GPCLKR      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPCLKR_OFFSET)
+#define IXP4XX_GPIO_GPDBSELR    IXP4XX_GPIO_REG(IXP4XX_GPIO_GPDBSELR_OFFSET)
+
+/*
+ * GPIO register bit definitions
+ */
+
+/* Interrupt styles
+ */
+#define IXP4XX_GPIO_STYLE_ACTIVE_HIGH	0x0
+#define IXP4XX_GPIO_STYLE_ACTIVE_LOW	0x1
+#define IXP4XX_GPIO_STYLE_RISING_EDGE	0x2
+#define IXP4XX_GPIO_STYLE_FALLING_EDGE	0x3
+#define IXP4XX_GPIO_STYLE_TRANSITIONAL	0x4
+
+/* 
+ * Mask used to clear interrupt styles 
+ */
+#define IXP4XX_GPIO_STYLE_CLEAR		0x7
+#define IXP4XX_GPIO_STYLE_SIZE		3
+
+/*
+ * Constants to make it easy to access Timer Control/Status registers
+ */
+#define IXP4XX_OSTS_OFFSET	0x00  /* Continious TimeStamp */
+#define IXP4XX_OST1_OFFSET	0x04  /* Timer 1 Timestamp */
+#define IXP4XX_OSRT1_OFFSET	0x08  /* Timer 1 Reload */
+#define IXP4XX_OST2_OFFSET	0x0C  /* Timer 2 Timestamp */
+#define IXP4XX_OSRT2_OFFSET	0x10  /* Timer 2 Reload */
+#define IXP4XX_OSWT_OFFSET	0x14  /* Watchdog Timer */
+#define IXP4XX_OSWE_OFFSET	0x18  /* Watchdog Enable */
+#define IXP4XX_OSWK_OFFSET	0x1C  /* Watchdog Key */
+#define IXP4XX_OSST_OFFSET	0x20  /* Timer Status */
+
+/*
+ * Operating System Timer Register Definitions.
+ */
+
+#define IXP4XX_TIMER_REG(x) ((volatile u32 *)(IXP4XX_TIMER_BASE_VIRT+(x)))
+
+#define IXP4XX_OSTS	IXP4XX_TIMER_REG(IXP4XX_OSTS_OFFSET)
+#define IXP4XX_OST1	IXP4XX_TIMER_REG(IXP4XX_OST1_OFFSET)
+#define IXP4XX_OSRT1	IXP4XX_TIMER_REG(IXP4XX_OSRT1_OFFSET)
+#define IXP4XX_OST2	IXP4XX_TIMER_REG(IXP4XX_OST2_OFFSET)
+#define IXP4XX_OSRT2	IXP4XX_TIMER_REG(IXP4XX_OSRT2_OFFSET)
+#define IXP4XX_OSWT	IXP4XX_TIMER_REG(IXP4XX_OSWT_OFFSET)
+#define IXP4XX_OSWE	IXP4XX_TIMER_REG(IXP4XX_OSWE_OFFSET)
+#define IXP4XX_OSWK	IXP4XX_TIMER_REG(IXP4XX_OSWK_OFFSET)
+#define IXP4XX_OSST	IXP4XX_TIMER_REG(IXP4XX_OSST_OFFSET)
+
+/*
+ * Timer register values and bit definitions 
+ */
+#define IXP4XX_OST_ENABLE		0x00000001
+#define IXP4XX_OST_ONE_SHOT		0x00000002
+/* Low order bits of reload value ignored */
+#define IXP4XX_OST_RELOAD_MASK		0x00000003
+#define IXP4XX_OST_DISABLED		0x00000000
+#define IXP4XX_OSST_TIMER_1_PEND	0x00000001
+#define IXP4XX_OSST_TIMER_2_PEND	0x00000002
+#define IXP4XX_OSST_TIMER_TS_PEND	0x00000004
+#define IXP4XX_OSST_TIMER_WDOG_PEND	0x00000008
+#define IXP4XX_OSST_TIMER_WARM_RESET	0x00000010
+
+#define	IXP4XX_WDT_KEY			0x0000482E
+
+#define	IXP4XX_WDT_RESET_ENABLE		0x00000001
+#define	IXP4XX_WDT_IRQ_ENABLE		0x00000002
+#define	IXP4XX_WDT_COUNT_ENABLE		0x00000004
+
+
+/*
+ * Constants to make it easy to access PCI Control/Status registers
+ */
+#define PCI_NP_AD_OFFSET            0x00
+#define PCI_NP_CBE_OFFSET           0x04
+#define PCI_NP_WDATA_OFFSET         0x08
+#define PCI_NP_RDATA_OFFSET         0x0c
+#define PCI_CRP_AD_CBE_OFFSET       0x10
+#define PCI_CRP_WDATA_OFFSET        0x14
+#define PCI_CRP_RDATA_OFFSET        0x18
+#define PCI_CSR_OFFSET              0x1c
+#define PCI_ISR_OFFSET              0x20
+#define PCI_INTEN_OFFSET            0x24
+#define PCI_DMACTRL_OFFSET          0x28
+#define PCI_AHBMEMBASE_OFFSET       0x2c
+#define PCI_AHBIOBASE_OFFSET        0x30
+#define PCI_PCIMEMBASE_OFFSET       0x34
+#define PCI_AHBDOORBELL_OFFSET      0x38
+#define PCI_PCIDOORBELL_OFFSET      0x3C
+#define PCI_ATPDMA0_AHBADDR_OFFSET  0x40
+#define PCI_ATPDMA0_PCIADDR_OFFSET  0x44
+#define PCI_ATPDMA0_LENADDR_OFFSET  0x48
+#define PCI_ATPDMA1_AHBADDR_OFFSET  0x4C
+#define PCI_ATPDMA1_PCIADDR_OFFSET  0x50
+#define PCI_ATPDMA1_LENADDR_OFFSET	0x54
+
+/*
+ * PCI Control/Status Registers
+ */
+#define IXP4XX_PCI_CSR(x) ((volatile u32 *)(IXP4XX_PCI_CFG_BASE_VIRT+(x)))
+
+#define PCI_NP_AD               IXP4XX_PCI_CSR(PCI_NP_AD_OFFSET)
+#define PCI_NP_CBE              IXP4XX_PCI_CSR(PCI_NP_CBE_OFFSET)
+#define PCI_NP_WDATA            IXP4XX_PCI_CSR(PCI_NP_WDATA_OFFSET)
+#define PCI_NP_RDATA            IXP4XX_PCI_CSR(PCI_NP_RDATA_OFFSET)
+#define PCI_CRP_AD_CBE          IXP4XX_PCI_CSR(PCI_CRP_AD_CBE_OFFSET)
+#define PCI_CRP_WDATA           IXP4XX_PCI_CSR(PCI_CRP_WDATA_OFFSET)
+#define PCI_CRP_RDATA           IXP4XX_PCI_CSR(PCI_CRP_RDATA_OFFSET)
+#define PCI_CSR                 IXP4XX_PCI_CSR(PCI_CSR_OFFSET) 
+#define PCI_ISR                 IXP4XX_PCI_CSR(PCI_ISR_OFFSET)
+#define PCI_INTEN               IXP4XX_PCI_CSR(PCI_INTEN_OFFSET)
+#define PCI_DMACTRL             IXP4XX_PCI_CSR(PCI_DMACTRL_OFFSET)
+#define PCI_AHBMEMBASE          IXP4XX_PCI_CSR(PCI_AHBMEMBASE_OFFSET)
+#define PCI_AHBIOBASE           IXP4XX_PCI_CSR(PCI_AHBIOBASE_OFFSET)
+#define PCI_PCIMEMBASE          IXP4XX_PCI_CSR(PCI_PCIMEMBASE_OFFSET)
+#define PCI_AHBDOORBELL         IXP4XX_PCI_CSR(PCI_AHBDOORBELL_OFFSET)
+#define PCI_PCIDOORBELL         IXP4XX_PCI_CSR(PCI_PCIDOORBELL_OFFSET)
+#define PCI_ATPDMA0_AHBADDR     IXP4XX_PCI_CSR(PCI_ATPDMA0_AHBADDR_OFFSET)
+#define PCI_ATPDMA0_PCIADDR     IXP4XX_PCI_CSR(PCI_ATPDMA0_PCIADDR_OFFSET)
+#define PCI_ATPDMA0_LENADDR     IXP4XX_PCI_CSR(PCI_ATPDMA0_LENADDR_OFFSET)
+#define PCI_ATPDMA1_AHBADDR     IXP4XX_PCI_CSR(PCI_ATPDMA1_AHBADDR_OFFSET)
+#define PCI_ATPDMA1_PCIADDR     IXP4XX_PCI_CSR(PCI_ATPDMA1_PCIADDR_OFFSET)
+#define PCI_ATPDMA1_LENADDR     IXP4XX_PCI_CSR(PCI_ATPDMA1_LENADDR_OFFSET)
+
+/*
+ * PCI register values and bit definitions 
+ */
+
+/* CSR bit definitions */
+#define PCI_CSR_HOST    	0x00000001
+#define PCI_CSR_ARBEN   	0x00000002
+#define PCI_CSR_ADS     	0x00000004
+#define PCI_CSR_PDS     	0x00000008
+#define PCI_CSR_ABE     	0x00000010
+#define PCI_CSR_DBT     	0x00000020
+#define PCI_CSR_ASE     	0x00000100
+#define PCI_CSR_IC      	0x00008000
+
+/* ISR (Interrupt status) Register bit definitions */
+#define PCI_ISR_PSE     	0x00000001
+#define PCI_ISR_PFE     	0x00000002
+#define PCI_ISR_PPE     	0x00000004
+#define PCI_ISR_AHBE    	0x00000008
+#define PCI_ISR_APDC    	0x00000010
+#define PCI_ISR_PADC    	0x00000020
+#define PCI_ISR_ADB     	0x00000040
+#define PCI_ISR_PDB     	0x00000080
+
+/* INTEN (Interrupt Enable) Register bit definitions */
+#define PCI_INTEN_PSE   	0x00000001
+#define PCI_INTEN_PFE   	0x00000002
+#define PCI_INTEN_PPE   	0x00000004
+#define PCI_INTEN_AHBE  	0x00000008
+#define PCI_INTEN_APDC  	0x00000010
+#define PCI_INTEN_PADC  	0x00000020
+#define PCI_INTEN_ADB   	0x00000040
+#define PCI_INTEN_PDB   	0x00000080
+
+/*
+ * Shift value for byte enable on NP cmd/byte enable register
+ */
+#define IXP4XX_PCI_NP_CBE_BESL		4
+
+/*
+ * PCI commands supported by NP access unit
+ */
+#define NP_CMD_IOREAD			0x2
+#define NP_CMD_IOWRITE			0x3
+#define NP_CMD_CONFIGREAD		0xa
+#define NP_CMD_CONFIGWRITE		0xb
+#define NP_CMD_MEMREAD			0x6
+#define	NP_CMD_MEMWRITE			0x7
+
+/*
+ * Constants for CRP access into local config space
+ */
+#define CRP_AD_CBE_BESL         20
+#define CRP_AD_CBE_WRITE	0x00010000
+
+
+/*
+ * USB Device Controller
+ *
+ * These are used by the USB gadget driver, so they don't follow the
+ * IXP4XX_ naming convetions.
+ *
+ */
+# define IXP4XX_USB_REG(x)       (*((volatile u32 *)(x)))
+
+/* UDC Undocumented - Reserved1 */
+#define UDC_RES1	IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0004)  
+/* UDC Undocumented - Reserved2 */
+#define UDC_RES2	IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0008)  
+/* UDC Undocumented - Reserved3 */
+#define UDC_RES3	IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x000C)  
+/* UDC Control Register */
+#define UDCCR		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0000)  
+/* UDC Endpoint 0 Control/Status Register */
+#define UDCCS0		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0010)  
+/* UDC Endpoint 1 (IN) Control/Status Register */
+#define UDCCS1		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0014)  
+/* UDC Endpoint 2 (OUT) Control/Status Register */
+#define UDCCS2		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0018)  
+/* UDC Endpoint 3 (IN) Control/Status Register */
+#define UDCCS3		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x001C)  
+/* UDC Endpoint 4 (OUT) Control/Status Register */
+#define UDCCS4		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0020)  
+/* UDC Endpoint 5 (Interrupt) Control/Status Register */
+#define UDCCS5		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0024)  
+/* UDC Endpoint 6 (IN) Control/Status Register */
+#define UDCCS6		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0028)  
+/* UDC Endpoint 7 (OUT) Control/Status Register */
+#define UDCCS7		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x002C)  
+/* UDC Endpoint 8 (IN) Control/Status Register */
+#define UDCCS8		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0030)  
+/* UDC Endpoint 9 (OUT) Control/Status Register */
+#define UDCCS9		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0034)  
+/* UDC Endpoint 10 (Interrupt) Control/Status Register */
+#define UDCCS10		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0038)  
+/* UDC Endpoint 11 (IN) Control/Status Register */
+#define UDCCS11		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x003C)  
+/* UDC Endpoint 12 (OUT) Control/Status Register */
+#define UDCCS12		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0040)  
+/* UDC Endpoint 13 (IN) Control/Status Register */
+#define UDCCS13		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0044)  
+/* UDC Endpoint 14 (OUT) Control/Status Register */
+#define UDCCS14		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0048)  
+/* UDC Endpoint 15 (Interrupt) Control/Status Register */
+#define UDCCS15		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x004C)  
+/* UDC Frame Number Register High */
+#define UFNRH		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0060)  
+/* UDC Frame Number Register Low */
+#define UFNRL		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0064)  
+/* UDC Byte Count Reg 2 */
+#define UBCR2		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0068)  
+/* UDC Byte Count Reg 4 */
+#define UBCR4		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x006c)  
+/* UDC Byte Count Reg 7 */
+#define UBCR7		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0070)  
+/* UDC Byte Count Reg 9 */
+#define UBCR9		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0074)  
+/* UDC Byte Count Reg 12 */
+#define UBCR12		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0078)  
+/* UDC Byte Count Reg 14 */
+#define UBCR14		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x007c)  
+/* UDC Endpoint 0 Data Register */
+#define UDDR0		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0080)  
+/* UDC Endpoint 1 Data Register */
+#define UDDR1		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0100)  
+/* UDC Endpoint 2 Data Register */
+#define UDDR2		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0180)  
+/* UDC Endpoint 3 Data Register */
+#define UDDR3		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0200)  
+/* UDC Endpoint 4 Data Register */
+#define UDDR4		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0400)  
+/* UDC Endpoint 5 Data Register */
+#define UDDR5		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00A0)  
+/* UDC Endpoint 6 Data Register */
+#define UDDR6		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0600)  
+/* UDC Endpoint 7 Data Register */
+#define UDDR7		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0680)  
+/* UDC Endpoint 8 Data Register */
+#define UDDR8		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0700)  
+/* UDC Endpoint 9 Data Register */
+#define UDDR9		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0900)  
+/* UDC Endpoint 10 Data Register */
+#define UDDR10		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00C0)  
+/* UDC Endpoint 11 Data Register */
+#define UDDR11		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0B00)  
+/* UDC Endpoint 12 Data Register */
+#define UDDR12		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0B80)  
+/* UDC Endpoint 13 Data Register */
+#define UDDR13		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0C00)  
+/* UDC Endpoint 14 Data Register */
+#define UDDR14		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0E00)  
+/* UDC Endpoint 15 Data Register */
+#define UDDR15		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00E0)  
+/* UDC Interrupt Control Register 0 */
+#define UICR0		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0050)  
+/* UDC Interrupt Control Register 1 */
+#define UICR1		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0054)  
+/* UDC Status Interrupt Register 0 */
+#define USIR0		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0058)  
+/* UDC Status Interrupt Register 1 */
+#define USIR1		IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x005C)  
+
+#define UDCCR_UDE	(1 << 0)	/* UDC enable */
+#define UDCCR_UDA	(1 << 1)	/* UDC active */
+#define UDCCR_RSM	(1 << 2)	/* Device resume */
+#define UDCCR_RESIR	(1 << 3)	/* Resume interrupt request */
+#define UDCCR_SUSIR	(1 << 4)	/* Suspend interrupt request */
+#define UDCCR_SRM	(1 << 5)	/* Suspend/resume interrupt mask */
+#define UDCCR_RSTIR	(1 << 6)	/* Reset interrupt request */
+#define UDCCR_REM	(1 << 7)	/* Reset interrupt mask */
+
+#define UDCCS0_OPR	(1 << 0)	/* OUT packet ready */
+#define UDCCS0_IPR	(1 << 1)	/* IN packet ready */
+#define UDCCS0_FTF	(1 << 2)	/* Flush Tx FIFO */
+#define UDCCS0_DRWF	(1 << 3)	/* Device remote wakeup feature */
+#define UDCCS0_SST	(1 << 4)	/* Sent stall */
+#define UDCCS0_FST	(1 << 5)	/* Force stall */
+#define UDCCS0_RNE	(1 << 6)	/* Receive FIFO no empty */
+#define UDCCS0_SA	(1 << 7)	/* Setup active */
+
+#define UDCCS_BI_TFS	(1 << 0)	/* Transmit FIFO service */
+#define UDCCS_BI_TPC	(1 << 1)	/* Transmit packet complete */
+#define UDCCS_BI_FTF	(1 << 2)	/* Flush Tx FIFO */
+#define UDCCS_BI_TUR	(1 << 3)	/* Transmit FIFO underrun */
+#define UDCCS_BI_SST	(1 << 4)	/* Sent stall */
+#define UDCCS_BI_FST	(1 << 5)	/* Force stall */
+#define UDCCS_BI_TSP	(1 << 7)	/* Transmit short packet */
+
+#define UDCCS_BO_RFS	(1 << 0)	/* Receive FIFO service */
+#define UDCCS_BO_RPC	(1 << 1)	/* Receive packet complete */
+#define UDCCS_BO_DME	(1 << 3)	/* DMA enable */
+#define UDCCS_BO_SST	(1 << 4)	/* Sent stall */
+#define UDCCS_BO_FST	(1 << 5)	/* Force stall */
+#define UDCCS_BO_RNE	(1 << 6)	/* Receive FIFO not empty */
+#define UDCCS_BO_RSP	(1 << 7)	/* Receive short packet */
+
+#define UDCCS_II_TFS	(1 << 0)	/* Transmit FIFO service */
+#define UDCCS_II_TPC	(1 << 1)	/* Transmit packet complete */
+#define UDCCS_II_FTF	(1 << 2)	/* Flush Tx FIFO */
+#define UDCCS_II_TUR	(1 << 3)	/* Transmit FIFO underrun */
+#define UDCCS_II_TSP	(1 << 7)	/* Transmit short packet */
+
+#define UDCCS_IO_RFS	(1 << 0)	/* Receive FIFO service */
+#define UDCCS_IO_RPC	(1 << 1)	/* Receive packet complete */
+#define UDCCS_IO_ROF	(1 << 3)	/* Receive overflow */
+#define UDCCS_IO_DME	(1 << 3)	/* DMA enable */
+#define UDCCS_IO_RNE	(1 << 6)	/* Receive FIFO not empty */
+#define UDCCS_IO_RSP	(1 << 7)	/* Receive short packet */
+
+#define UDCCS_INT_TFS	(1 << 0)	/* Transmit FIFO service */
+#define UDCCS_INT_TPC	(1 << 1)	/* Transmit packet complete */
+#define UDCCS_INT_FTF	(1 << 2)	/* Flush Tx FIFO */
+#define UDCCS_INT_TUR	(1 << 3)	/* Transmit FIFO underrun */
+#define UDCCS_INT_SST	(1 << 4)	/* Sent stall */
+#define UDCCS_INT_FST	(1 << 5)	/* Force stall */
+#define UDCCS_INT_TSP	(1 << 7)	/* Transmit short packet */
+
+#define UICR0_IM0	(1 << 0)	/* Interrupt mask ep 0 */
+#define UICR0_IM1	(1 << 1)	/* Interrupt mask ep 1 */
+#define UICR0_IM2	(1 << 2)	/* Interrupt mask ep 2 */
+#define UICR0_IM3	(1 << 3)	/* Interrupt mask ep 3 */
+#define UICR0_IM4	(1 << 4)	/* Interrupt mask ep 4 */
+#define UICR0_IM5	(1 << 5)	/* Interrupt mask ep 5 */
+#define UICR0_IM6	(1 << 6)	/* Interrupt mask ep 6 */
+#define UICR0_IM7	(1 << 7)	/* Interrupt mask ep 7 */
+
+#define UICR1_IM8	(1 << 0)	/* Interrupt mask ep 8 */
+#define UICR1_IM9	(1 << 1)	/* Interrupt mask ep 9 */
+#define UICR1_IM10	(1 << 2)	/* Interrupt mask ep 10 */
+#define UICR1_IM11	(1 << 3)	/* Interrupt mask ep 11 */
+#define UICR1_IM12	(1 << 4)	/* Interrupt mask ep 12 */
+#define UICR1_IM13	(1 << 5)	/* Interrupt mask ep 13 */
+#define UICR1_IM14	(1 << 6)	/* Interrupt mask ep 14 */
+#define UICR1_IM15	(1 << 7)	/* Interrupt mask ep 15 */
+
+#define USIR0_IR0	(1 << 0)	/* Interrup request ep 0 */
+#define USIR0_IR1	(1 << 1)	/* Interrup request ep 1 */
+#define USIR0_IR2	(1 << 2)	/* Interrup request ep 2 */
+#define USIR0_IR3	(1 << 3)	/* Interrup request ep 3 */
+#define USIR0_IR4	(1 << 4)	/* Interrup request ep 4 */
+#define USIR0_IR5	(1 << 5)	/* Interrup request ep 5 */
+#define USIR0_IR6	(1 << 6)	/* Interrup request ep 6 */
+#define USIR0_IR7	(1 << 7)	/* Interrup request ep 7 */
+
+#define USIR1_IR8	(1 << 0)	/* Interrup request ep 8 */
+#define USIR1_IR9	(1 << 1)	/* Interrup request ep 9 */
+#define USIR1_IR10	(1 << 2)	/* Interrup request ep 10 */
+#define USIR1_IR11	(1 << 3)	/* Interrup request ep 11 */
+#define USIR1_IR12	(1 << 4)	/* Interrup request ep 12 */
+#define USIR1_IR13	(1 << 5)	/* Interrup request ep 13 */
+#define USIR1_IR14	(1 << 6)	/* Interrup request ep 14 */
+#define USIR1_IR15	(1 << 7)	/* Interrup request ep 15 */
+
+#define DCMD_LENGTH	0x01fff		/* length mask (max = 8K - 1) */
+
+#endif
diff -Nru a/include/asm-arm/arch-ixp4xx/memory.h b/include/asm-arm/arch-ixp4xx/memory.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/memory.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,27 @@
+/*
+ * linux/include/asm-arm/arch-ixp4xx/memory.h
+ *
+ * Copyright (c) 2001-2004 MontaVista Software, Inc.
+ */
+
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
+
+/*
+ * Physical DRAM offset.
+ */
+#define PHYS_OFFSET	(0x00000000UL)
+
+/*
+ * Virtual view <-> DMA view memory address translations
+ * virt_to_bus: Used to translate the virtual address to an
+ *		address suitable to be passed to set_dma_addr
+ * bus_to_virt: Used to convert an address for DMA operations
+ *		to an address that the kernel can use.
+ *
+ * These are dummies for now.
+ */
+#define __virt_to_bus(x)	 __virt_to_phys(x)
+#define __bus_to_virt(x)	 __phys_to_virt(x)
+
+#endif
diff -Nru a/include/asm-arm/arch-ixp4xx/param.h b/include/asm-arm/arch-ixp4xx/param.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/param.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,3 @@
+/*
+ * linux/include/asm-arm/arch-ixp4xx/param.h
+ */
diff -Nru a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/platform.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,116 @@
+/*
+ * include/asm-arm/arch-ixp4xx/platform.h
+ *
+ * Constants and functions that are useful to IXP4xx platform-specific code
+ * and device drivers.
+ *
+ * Copyright (C) 2004 MontaVista Software, Inc.
+ */
+
+#ifndef __ASM_ARCH_HARDWARE_H__
+#error "Do not include this directly, instead #include <asm/hardware.h>"
+#endif
+
+#ifndef __ASSEMBLY__
+
+#include <asm/types.h>
+
+/*
+ * Expansion bus memory regions
+ */
+#define IXP4XX_EXP_BUS_BASE_PHYS	(0x50000000)
+
+#define	IXP4XX_EXP_BUS_CSX_REGION_SIZE	(0x01000000)
+
+#define IXP4XX_EXP_BUS_CS0_BASE_PHYS	(IXP4XX_EXP_BUS_BASE_PHYS + 0x00000000)
+#define IXP4XX_EXP_BUS_CS1_BASE_PHYS	(IXP4XX_EXP_BUS_BASE_PHYS + 0x01000000)
+#define IXP4XX_EXP_BUS_CS2_BASE_PHYS	(IXP4XX_EXP_BUS_BASE_PHYS + 0x02000000)
+#define IXP4XX_EXP_BUS_CS3_BASE_PHYS	(IXP4XX_EXP_BUS_BASE_PHYS + 0x03000000)
+#define IXP4XX_EXP_BUS_CS4_BASE_PHYS	(IXP4XX_EXP_BUS_BASE_PHYS + 0x04000000)
+#define IXP4XX_EXP_BUS_CS5_BASE_PHYS	(IXP4XX_EXP_BUS_BASE_PHYS + 0x05000000)
+#define IXP4XX_EXP_BUS_CS6_BASE_PHYS	(IXP4XX_EXP_BUS_BASE_PHYS + 0x06000000)
+#define IXP4XX_EXP_BUS_CS7_BASE_PHYS	(IXP4XX_EXP_BUS_BASE_PHYS + 0x07000000)
+
+#define IXP4XX_FLASH_WRITABLE	(0x2)
+#define IXP4XX_FLASH_DEFAULT	(0xbcd23c40)
+#define IXP4XX_FLASH_WRITE	(0xbcd23c42)
+
+/*
+ * Clock Speed Definitions.
+ */
+#define IXP4XX_PERIPHERAL_BUS_CLOCK 	(66) /* 66Mhzi APB BUS   */ 
+#define IXP4XX_UART_XTAL        	14745600
+
+/*
+ * The IXP4xx chips do not have an I2C unit, so GPIO lines are just
+ * used to 
+ * Used as platform_data to provide GPIO pin information to the ixp42x
+ * I2C driver.
+ */
+struct ixp4xx_i2c_pins {
+	unsigned long sda_pin;
+	unsigned long scl_pin;
+};
+
+
+/*
+ * Functions used by platform-level setup code
+ */
+extern void ixp4xx_map_io(void);
+extern void ixp4xx_init_irq(void);
+extern void ixp4xx_pci_preinit(void);
+struct pci_sys_data;
+extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
+extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
+
+/*
+ * GPIO-functions
+ */
+/*
+ * The following converted to the real HW bits the gpio_line_config
+ */
+/* GPIO pin types */
+#define IXP4XX_GPIO_OUT 		0x1
+#define IXP4XX_GPIO_IN  		0x2
+
+#define IXP4XX_GPIO_INTSTYLE_MASK	0x7C  /* Bits [6:2] define interrupt style */
+
+/* 
+ * GPIO interrupt types.
+ */
+#define IXP4XX_GPIO_ACTIVE_HIGH		0x4 /* Default */
+#define IXP4XX_GPIO_ACTIVE_LOW		0x8
+#define IXP4XX_GPIO_RISING_EDGE		0x10
+#define IXP4XX_GPIO_FALLING_EDGE 	0x20
+#define IXP4XX_GPIO_TRANSITIONAL 	0x40
+
+/* GPIO signal types */
+#define IXP4XX_GPIO_LOW			0
+#define IXP4XX_GPIO_HIGH		1
+
+/* GPIO Clocks */
+#define IXP4XX_GPIO_CLK_0		14
+#define IXP4XX_GPIO_CLK_1		15
+
+extern void gpio_line_config(u8 line, u32 style);
+
+static inline void gpio_line_get(u8 line, int *value)
+{
+	*value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
+}
+
+static inline void gpio_line_set(u8 line, int value)
+{
+	if (value == IXP4XX_GPIO_HIGH)
+	    *IXP4XX_GPIO_GPOUTR |= (1 << line);
+	else if (value == IXP4XX_GPIO_LOW)
+	    *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
+}
+
+static inline void gpio_line_isr_clear(u8 line)
+{
+	*IXP4XX_GPIO_GPISR = (1 << line);
+}
+
+#endif // __ASSEMBLY__
+
diff -Nru a/include/asm-arm/arch-ixp4xx/prpmc1100.h b/include/asm-arm/arch-ixp4xx/prpmc1100.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/prpmc1100.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,33 @@
+/*
+ * include/asm-arm/arch-ixp4xx/prpmc1100.h
+ *
+ * Motorolla PrPMC1100 platform specific definitions
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright 2004 (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.
+ */
+
+#ifndef __ASM_ARCH_HARDWARE_H__
+#error "Do not include this directly, instead #include <asm/hardware.h>"
+#endif
+
+#define	PRPMC1100_FLASH_BASE	IXP4XX_EXP_BUS_CS0_BASE_PHYS
+#define	PRPMC1100_FLASH_SIZE	IXP4XX_EXP_BUS_CSX_REGION_SIZE
+
+#define	PRPMC1100_PCI_MIN_DEVID	10
+#define	PRPMC1100_PCI_MAX_DEVID	16
+#define	PRPMC1100_PCI_IRQ_LINES	4
+
+
+/* PCI controller GPIO to IRQ pin mappings */
+#define PRPMC1100_PCI_INTA_PIN	11
+#define PRPMC1100_PCI_INTB_PIN	10
+#define	PRPMC1100_PCI_INTC_PIN	9
+#define	PRPMC1100_PCI_INTD_PIN	8
+
+
diff -Nru a/include/asm-arm/arch-ixp4xx/serial.h b/include/asm-arm/arch-ixp4xx/serial.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/serial.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,27 @@
+/*
+ * include/asm-arm/arch-ixp4xx/serial.h
+ *
+ * Author: Deepak Saxena <dsaxena@plexity.net>
+ *
+ * Copyright (C) 2002-2004 MontaVista Software, Inc.
+ * 
+ */
+
+#ifndef _ARCH_SERIAL_H_
+#define _ARCH_SERIAL_H_
+
+/*
+ * We don't hardcode our serial port information but instead
+ * fill it in dynamically based on our platform in arch->map_io.
+ * This allows for per-board serial ports w/o a bunch of
+ * #ifdefs in this file.
+ */
+#define	STD_SERIAL_PORT_DEFNS
+#define	EXTRA_SERIAL_PORT_DEFNS
+
+/*
+ * IXP4XX uses 15.6MHz clock for uart
+ */
+#define BASE_BAUD ( IXP4XX_UART_XTAL / 16 )
+
+#endif // _ARCH_SERIAL_H_
diff -Nru a/include/asm-arm/arch-ixp4xx/system.h b/include/asm-arm/arch-ixp4xx/system.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/system.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,43 @@
+/*
+ * include/asm-arm/arch-ixp4x//system.h 
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ *
+ * 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 <asm/hardware.h>
+
+static inline void arch_idle(void)
+{
+#if 0
+	if (!hlt_counter)
+		cpu_do_idle(0);
+#endif
+}
+
+
+static inline void arch_reset(char mode)
+{
+	if ( 1 && mode == 's') {
+		/* Jump into ROM at address 0 */
+		cpu_reset(0);
+	} else {
+		/* Use on-chip reset capability */
+
+		/* set the "key" register to enable access to
+		 * "timer" and "enable" registers
+		 */
+		*IXP4XX_OSWK = 0x482e; 	    
+
+		/* write 0 to the timer register for an immidiate reset */
+		*IXP4XX_OSWT = 0;
+
+		/* disable watchdog interrupt, enable reset, enable count */
+		*IXP4XX_OSWE = 0x3;
+	}
+}
+
diff -Nru a/include/asm-arm/arch-ixp4xx/time.h b/include/asm-arm/arch-ixp4xx/time.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/time.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,7 @@
+/*
+ * linux/include/asm-arm/arch-ixp4xx/time.h
+ *
+ * We implement timer code in arch/arm/mach-ixp4xx/time.c
+ *
+ */
+
diff -Nru a/include/asm-arm/arch-ixp4xx/timex.h b/include/asm-arm/arch-ixp4xx/timex.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/timex.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,13 @@
+/*
+ * linux/include/asm-arm/arch-ixp4xx/timex.h
+ * 
+ */
+
+#include <asm/hardware.h>
+
+/*
+ * We use IXP425 General purpose timer for our timer needs, it runs at 
+ * 66.66... MHz
+ */
+#define CLOCK_TICK_RATE (66666666)
+
diff -Nru a/include/asm-arm/arch-ixp4xx/uncompress.h b/include/asm-arm/arch-ixp4xx/uncompress.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/uncompress.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,64 @@
+/*
+ * include/asm-arm/arch-ixp4xx/uncompress.h 
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _ARCH_UNCOMPRESS_H_
+#define _ARCH_UNCOMPRESS_H_
+
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+#include <linux/serial_reg.h>
+
+#define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE)
+
+static volatile u32* uart_base;
+
+static __inline__ void putc(char c)
+{
+	/* Check THRE and TEMT bits before we transmit the character.
+	 */
+	while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE); 
+	*uart_base = c;
+}
+
+/*
+ * This does not append a newline
+ */
+static void puts(const char *s)
+{
+	while (*s)
+	{
+		putc(*s);
+		if (*s == '\n')
+			putc('\r');
+		s++;
+	}
+}
+
+static __inline__ void __arch_decomp_setup(unsigned long arch_id)
+{
+	/*
+	 * Coyote only has UART2 connected
+	 */
+	if (machine_is_adi_coyote())
+		uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;
+	else
+		uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
+}
+
+/*
+ * arch_id is a variable in decompress_kernel()
+ */
+#define arch_decomp_setup()	__arch_decomp_setup(arch_id)
+
+#define arch_decomp_wdog()
+
+#endif
diff -Nru a/include/asm-arm/arch-ixp4xx/vmalloc.h b/include/asm-arm/arch-ixp4xx/vmalloc.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-ixp4xx/vmalloc.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,17 @@
+/*
+ * linux/include/asm-arm/arch-ixp4xx/vmalloc.h
+ */
+
+/*
+ * Just any arbitrary offset to the start of the vmalloc VM area: the
+ * current 8MB value just means that there will be a 8MB "hole" after the
+ * physical memory until the kernel virtual memory starts.  That means that
+ * any out-of-bounds memory accesses will hopefully be caught.
+ * The vmalloc() routines leaves a hole of 4kB between each vmalloced
+ * area for the same reason. ;)
+ */
+#define VMALLOC_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       (0xFF000000)
+
diff -Nru a/include/asm-arm/arch-l7200/ide.h b/include/asm-arm/arch-l7200/ide.h
--- a/include/asm-arm/arch-l7200/ide.h	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,27 +0,0 @@
-/*
- * linux/include/asm-arm/arch-l7200/ide.h
- *
- * Copyright (c) 2000 Steve Hill (sjhill@cotw.com)
- *
- * Changelog:
- *  03-29-2000	SJH	Created file placeholder
- */
-#include <asm/irq.h>
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-}
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void
-ide_init_default_hwifs(void)
-{
-}
diff -Nru a/include/asm-arm/arch-l7200/keyboard.h b/include/asm-arm/arch-l7200/keyboard.h
--- a/include/asm-arm/arch-l7200/keyboard.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,51 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-l7200/keyboard.h
- *
- *  Keyboard driver definitions for LinkUp Systems L7200 architecture
- *
- *  Copyright (C) 2000 Scott A McConnell (samcconn@cotw.com)
- *                     Steve Hill (sjhill@cotw.com)
- *
- *  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.
- *
- * Changelog:
- *   07-18-2000	SAM	Created file
- *   07-28-2000	SJH	Complete rewrite
- */
-
-#include <asm/irq.h>
-
-#error This needs fixing --rmk
-
-/*
- * Layout of L7200 keyboard registers
- */
-struct KBD_Port {       
-	unsigned int KBDR;
-	unsigned int KBDMR;
-	unsigned int KBSBSR;
-	unsigned int Reserved;
-	unsigned int KBKSR;
-};
-
-#define KBD_BASE        IO_BASE_2 + 0x4000
-#define l7200kbd_hwregs ((volatile struct KBD_Port *) (KBD_BASE))
-
-extern void l7200kbd_init_hw(void);
-extern int l7200kbd_translate(unsigned char scancode, unsigned char *keycode,
-			      char raw_mode);
-
-#define kbd_setkeycode(sc,kc)		(-EINVAL)
-#define kbd_getkeycode(sc)		(-EINVAL)
-
-#define kbd_translate(sc, kcp, rm)      ({ *(kcp) = (sc); 1; })
-#define kbd_unexpected_up(kc)           (0200)
-#define kbd_leds(leds)                  do {} while (0)
-#define kbd_init_hw()                   l7200kbd_init_hw()
-#define kbd_sysrq_xlate                 ((unsigned char *)NULL)
-#define kbd_disable_irq()               disable_irq(IRQ_GCTC2)
-#define kbd_enable_irq()                enable_irq(IRQ_GCTC2)
-
-#define SYSRQ_KEY	13
diff -Nru a/include/asm-arm/arch-l7200/memory.h b/include/asm-arm/arch-l7200/memory.h
--- a/include/asm-arm/arch-l7200/memory.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-arm/arch-l7200/memory.h	Tue Jun 15 22:20:43 2004
@@ -13,38 +13,11 @@
 #define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
- */
-#define TASK_SIZE       (0xbf000000UL)
-#define TASK_SIZE_26    (0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET     (0xc0000000UL)
-
-/*
  * Physical DRAM offset on the L7200 SDB.
  */
 #define PHYS_OFFSET     (0xf0000000UL)
 
-/*
- * The DRAM is contiguous.
- */
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
-
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x) __virt_to_phys(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x) __phys_to_virt(x)
 
 #endif
diff -Nru a/include/asm-arm/arch-lh7a40x/hardware.h b/include/asm-arm/arch-lh7a40x/hardware.h
--- a/include/asm-arm/arch-lh7a40x/hardware.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-arm/arch-lh7a40x/hardware.h	Tue Jun 15 22:20:36 2004
@@ -13,8 +13,6 @@
 #ifndef __ASM_ARCH_HARDWARE_H
 #define __ASM_ARCH_HARDWARE_H
 
-#include <asm/mach-types.h>
-
 #define io_p2v(x) (0xf0000000 | (((x) & 0xfff00000) >> 4) | ((x) & 0x0000ffff))
 #define io_v2p(x) (             (((x) & 0x0fff0000) << 4) | ((x) & 0x0000ffff))
 
@@ -39,10 +37,10 @@
 # define __REGP(x)	((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
 # define __REG(x)	__REGP(io_p2v(x))
 typedef struct { volatile u16 offset[4096]; } __regbase16;
-# define __REGP16(x)	((__regbase16 *)((x)&~4095))->offset[((x)&4095)>>2]
+# define __REGP16(x)	((__regbase16 *)((x)&~4095))->offset[((x)&4095)>>1]
 # define __REG16(x)	__REGP16(io_p2v(x))
 typedef struct { volatile u8 offset[4096]; } __regbase8;
-# define __REGP8(x)	((__regbase8 *)((x)&~4095))->offset[((x)&4095)>>2]
+# define __REGP8(x)	((__regbase8 *)((x)&~4095))->offset[(x)&4095]
 # define __REG8(x)	__REGP8(io_p2v(x))
 #endif
 
diff -Nru a/include/asm-arm/arch-lh7a40x/ide.h b/include/asm-arm/arch-lh7a40x/ide.h
--- a/include/asm-arm/arch-lh7a40x/ide.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-arm/arch-lh7a40x/ide.h	Tue Jun 15 22:20:42 2004
@@ -64,13 +64,6 @@
 	ide_register_hw (&hw, &hwif);
 	lpd7a40x_hwif_ioops (hwif); /* Override IO routines */
 }
-
-#else
-
-static __inline__ void ide_init_hwif_ports (hw_regs_t *hw, int data_port,
-					    int ctrl_port, int *irq) {}
-static __inline__ void ide_init_default_hwifs (void) {}
-
 #endif
 
 #endif
diff -Nru a/include/asm-arm/arch-lh7a40x/memory.h b/include/asm-arm/arch-lh7a40x/memory.h
--- a/include/asm-arm/arch-lh7a40x/memory.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-arm/arch-lh7a40x/memory.h	Tue Jun 15 22:20:38 2004
@@ -15,44 +15,17 @@
 #define BANKS_PER_NODE 1	/* Define as either 1 or 2 */
 
 /*
- * Task size: 3GB
- */
-#define TASK_SIZE	(0xbf000000UL) /* 0xc0000000? */
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
-
-/*
  * Physical DRAM offset.
  */
 #define PHYS_OFFSET	(0xc0000000UL)
 
 /*
- * physical vs virtual ram conversion
- */
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-#define __virt_to_phys(x)	((x) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(x)	((x) - PHYS_OFFSET + PAGE_OFFSET)
-
-/*
  * Virtual view <-> DMA view memory address translations
  * virt_to_bus: Used to translate the virtual address to an
  *		address suitable to be passed to set_dma_addr
  * bus_to_virt: Used to convert an address for DMA operations
  *		to an address that the kernel can use.
  */
-#define __virt_to_bus__is_a_macro
-#define __bus_to_virt__is_a_macro
 #define __virt_to_bus(x)	 __virt_to_phys(x)
 #define __bus_to_virt(x)	 __phys_to_virt(x)
 
diff -Nru a/include/asm-arm/arch-nexuspci/ide.h b/include/asm-arm/arch-nexuspci/ide.h
--- a/include/asm-arm/arch-nexuspci/ide.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,37 +0,0 @@
-/*
- * linux/include/asm-arm/arch-nexuspci/ide.h
- *
- * Copyright (c) 1998 Russell King
- *
- * Modifications:
- *  29-07-1998	RMK	Major re-work of IDE architecture specific code
- */
-#include <asm/irq.h>
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += 1;
-	}
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-	if (irq)
-		*irq = 0;
-}
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void ide_init_default_hwifs(void)
-{
-	/* There are no standard ports */
-}
diff -Nru a/include/asm-arm/arch-nexuspci/memory.h b/include/asm-arm/arch-nexuspci/memory.h
--- a/include/asm-arm/arch-nexuspci/memory.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-arm/arch-nexuspci/memory.h	Tue Jun 15 22:21:05 2004
@@ -5,42 +5,19 @@
  * Copyright (c) 1999 Russell King
  *
  */
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0x40000000UL)
 #define BUS_OFFSET	(0xe0000000UL)
 
 /*
- * DRAM is contiguous
- */
-#define __virt_to_phys(vpage) ((unsigned long)(vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(ppage) ((unsigned long)(ppage) + PAGE_OFFSET - PHYS_OFFSET)
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-
-/*
  * On the PCI bus the DRAM appears at address 0xe0000000
  */
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x) ((unsigned long)(x) - PAGE_OFFSET + BUS_OFFSET)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x) ((unsigned long)(x) + PAGE_OFFSET - BUS_OFFSET)
 
 #endif
diff -Nru a/include/asm-arm/arch-omap/board-innovator.h b/include/asm-arm/arch-omap/board-innovator.h
--- a/include/asm-arm/arch-omap/board-innovator.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-arm/arch-omap/board-innovator.h	Tue Jun 15 22:21:05 2004
@@ -33,74 +33,74 @@
  *  OMAP-1510 FPGA
  * ---------------------------------------------------------------------------
  */
-#define OMAP1510P1_FPGA_BASE			0xE8000000	/* Virtual */
-#define OMAP1510P1_FPGA_SIZE			SZ_4K
-#define OMAP1510P1_FPGA_START			0x08000000	/* Physical */
+#define OMAP1510_FPGA_BASE			0xE8000000	/* Virtual */
+#define OMAP1510_FPGA_SIZE			SZ_4K
+#define OMAP1510_FPGA_START			0x08000000	/* Physical */
 
 /* Revision */
-#define OMAP1510P1_FPGA_REV_LOW			(OMAP1510P1_FPGA_BASE + 0x0)
-#define OMAP1510P1_FPGA_REV_HIGH		(OMAP1510P1_FPGA_BASE + 0x1)
+#define OMAP1510_FPGA_REV_LOW			(OMAP1510_FPGA_BASE + 0x0)
+#define OMAP1510_FPGA_REV_HIGH			(OMAP1510_FPGA_BASE + 0x1)
 
-#define OMAP1510P1_FPGA_LCD_PANEL_CONTROL	(OMAP1510P1_FPGA_BASE + 0x2)
-#define OMAP1510P1_FPGA_LED_DIGIT		(OMAP1510P1_FPGA_BASE + 0x3)
-#define INNOVATOR_FPGA_HID_SPI			(OMAP1510P1_FPGA_BASE + 0x4)
-#define OMAP1510P1_FPGA_POWER			(OMAP1510P1_FPGA_BASE + 0x5)
+#define OMAP1510_FPGA_LCD_PANEL_CONTROL		(OMAP1510_FPGA_BASE + 0x2)
+#define OMAP1510_FPGA_LED_DIGIT			(OMAP1510_FPGA_BASE + 0x3)
+#define INNOVATOR_FPGA_HID_SPI			(OMAP1510_FPGA_BASE + 0x4)
+#define OMAP1510_FPGA_POWER			(OMAP1510_FPGA_BASE + 0x5)
 
 /* Interrupt status */
-#define OMAP1510P1_FPGA_ISR_LO			(OMAP1510P1_FPGA_BASE + 0x6)
-#define OMAP1510P1_FPGA_ISR_HI			(OMAP1510P1_FPGA_BASE + 0x7)
+#define OMAP1510_FPGA_ISR_LO			(OMAP1510_FPGA_BASE + 0x6)
+#define OMAP1510_FPGA_ISR_HI			(OMAP1510_FPGA_BASE + 0x7)
 
 /* Interrupt mask */
-#define OMAP1510P1_FPGA_IMR_LO			(OMAP1510P1_FPGA_BASE + 0x8)
-#define OMAP1510P1_FPGA_IMR_HI			(OMAP1510P1_FPGA_BASE + 0x9)
+#define OMAP1510_FPGA_IMR_LO			(OMAP1510_FPGA_BASE + 0x8)
+#define OMAP1510_FPGA_IMR_HI			(OMAP1510_FPGA_BASE + 0x9)
 
 /* Reset registers */
-#define OMAP1510P1_FPGA_HOST_RESET		(OMAP1510P1_FPGA_BASE + 0xa)
-#define OMAP1510P1_FPGA_RST			(OMAP1510P1_FPGA_BASE + 0xb)
+#define OMAP1510_FPGA_HOST_RESET		(OMAP1510_FPGA_BASE + 0xa)
+#define OMAP1510_FPGA_RST			(OMAP1510_FPGA_BASE + 0xb)
 
-#define OMAP1510P1_FPGA_AUDIO			(OMAP1510P1_FPGA_BASE + 0xc)
-#define OMAP1510P1_FPGA_DIP			(OMAP1510P1_FPGA_BASE + 0xe)
-#define OMAP1510P1_FPGA_FPGA_IO			(OMAP1510P1_FPGA_BASE + 0xf)
-#define OMAP1510P1_FPGA_UART1			(OMAP1510P1_FPGA_BASE + 0x14)
-#define OMAP1510P1_FPGA_UART2			(OMAP1510P1_FPGA_BASE + 0x15)
-#define OMAP1510P1_FPGA_OMAP1510_STATUS		(OMAP1510P1_FPGA_BASE + 0x16)
-#define OMAP1510P1_FPGA_BOARD_REV		(OMAP1510P1_FPGA_BASE + 0x18)
-#define OMAP1510P1_PPT_DATA			(OMAP1510P1_FPGA_BASE + 0x100)
-#define OMAP1510P1_PPT_STATUS			(OMAP1510P1_FPGA_BASE + 0x101)
-#define OMAP1510P1_PPT_CONTROL			(OMAP1510P1_FPGA_BASE + 0x102)
-
-#define OMAP1510P1_FPGA_TOUCHSCREEN		(OMAP1510P1_FPGA_BASE + 0x204)
-
-#define INNOVATOR_FPGA_INFO			(OMAP1510P1_FPGA_BASE + 0x205)
-#define INNOVATOR_FPGA_LCD_BRIGHT_LO		(OMAP1510P1_FPGA_BASE + 0x206)
-#define INNOVATOR_FPGA_LCD_BRIGHT_HI		(OMAP1510P1_FPGA_BASE + 0x207)
-#define INNOVATOR_FPGA_LED_GRN_LO		(OMAP1510P1_FPGA_BASE + 0x208)
-#define INNOVATOR_FPGA_LED_GRN_HI		(OMAP1510P1_FPGA_BASE + 0x209)
-#define INNOVATOR_FPGA_LED_RED_LO		(OMAP1510P1_FPGA_BASE + 0x20a)
-#define INNOVATOR_FPGA_LED_RED_HI		(OMAP1510P1_FPGA_BASE + 0x20b)
-#define INNOVATOR_FPGA_CAM_USB_CONTROL		(OMAP1510P1_FPGA_BASE + 0x20c)
-#define INNOVATOR_FPGA_EXP_CONTROL		(OMAP1510P1_FPGA_BASE + 0x20d)
-#define INNOVATOR_FPGA_ISR2			(OMAP1510P1_FPGA_BASE + 0x20e)
-#define INNOVATOR_FPGA_IMR2			(OMAP1510P1_FPGA_BASE + 0x210)
+#define OMAP1510_FPGA_AUDIO			(OMAP1510_FPGA_BASE + 0xc)
+#define OMAP1510_FPGA_DIP			(OMAP1510_FPGA_BASE + 0xe)
+#define OMAP1510_FPGA_FPGA_IO			(OMAP1510_FPGA_BASE + 0xf)
+#define OMAP1510_FPGA_UART1			(OMAP1510_FPGA_BASE + 0x14)
+#define OMAP1510_FPGA_UART2			(OMAP1510_FPGA_BASE + 0x15)
+#define OMAP1510_FPGA_OMAP1510_STATUS		(OMAP1510_FPGA_BASE + 0x16)
+#define OMAP1510_FPGA_BOARD_REV			(OMAP1510_FPGA_BASE + 0x18)
+#define OMAP1510P1_PPT_DATA			(OMAP1510_FPGA_BASE + 0x100)
+#define OMAP1510P1_PPT_STATUS			(OMAP1510_FPGA_BASE + 0x101)
+#define OMAP1510P1_PPT_CONTROL			(OMAP1510_FPGA_BASE + 0x102)
+
+#define OMAP1510_FPGA_TOUCHSCREEN		(OMAP1510_FPGA_BASE + 0x204)
+
+#define INNOVATOR_FPGA_INFO			(OMAP1510_FPGA_BASE + 0x205)
+#define INNOVATOR_FPGA_LCD_BRIGHT_LO		(OMAP1510_FPGA_BASE + 0x206)
+#define INNOVATOR_FPGA_LCD_BRIGHT_HI		(OMAP1510_FPGA_BASE + 0x207)
+#define INNOVATOR_FPGA_LED_GRN_LO		(OMAP1510_FPGA_BASE + 0x208)
+#define INNOVATOR_FPGA_LED_GRN_HI		(OMAP1510_FPGA_BASE + 0x209)
+#define INNOVATOR_FPGA_LED_RED_LO		(OMAP1510_FPGA_BASE + 0x20a)
+#define INNOVATOR_FPGA_LED_RED_HI		(OMAP1510_FPGA_BASE + 0x20b)
+#define INNOVATOR_FPGA_CAM_USB_CONTROL		(OMAP1510_FPGA_BASE + 0x20c)
+#define INNOVATOR_FPGA_EXP_CONTROL		(OMAP1510_FPGA_BASE + 0x20d)
+#define INNOVATOR_FPGA_ISR2			(OMAP1510_FPGA_BASE + 0x20e)
+#define INNOVATOR_FPGA_IMR2			(OMAP1510_FPGA_BASE + 0x210)
 
-#define OMAP1510P1_FPGA_ETHR_START		(OMAP1510P1_FPGA_START + 0x300)
-#define OMAP1510P1_FPGA_ETHR_BASE		(OMAP1510P1_FPGA_BASE + 0x300)
+#define OMAP1510_FPGA_ETHR_START		(OMAP1510_FPGA_START + 0x300)
+#define OMAP1510_FPGA_ETHR_BASE			(OMAP1510_FPGA_BASE + 0x300)
 
 /*
  * Power up Giga UART driver, turn on HID clock.
  * Turn off BT power, since we're not using it and it
  * draws power.
  */
-#define OMAP1510P1_FPGA_RESET_VALUE		0x42
+#define OMAP1510_FPGA_RESET_VALUE		0x42
 
-#define OMAP1510P1_FPGA_PCR_IF_PD0		(1 << 7)
-#define OMAP1510P1_FPGA_PCR_COM2_EN		(1 << 6)
-#define OMAP1510P1_FPGA_PCR_COM1_EN		(1 << 5)
-#define OMAP1510P1_FPGA_PCR_EXP_PD0		(1 << 4)
-#define OMAP1510P1_FPGA_PCR_EXP_PD1		(1 << 3)
-#define OMAP1510P1_FPGA_PCR_48MHZ_CLK		(1 << 2)
-#define OMAP1510P1_FPGA_PCR_4MHZ_CLK		(1 << 1)
-#define OMAP1510P1_FPGA_PCR_RSRVD_BIT0		(1 << 0)
+#define OMAP1510_FPGA_PCR_IF_PD0		(1 << 7)
+#define OMAP1510_FPGA_PCR_COM2_EN		(1 << 6)
+#define OMAP1510_FPGA_PCR_COM1_EN		(1 << 5)
+#define OMAP1510_FPGA_PCR_EXP_PD0		(1 << 4)
+#define OMAP1510_FPGA_PCR_EXP_PD1		(1 << 3)
+#define OMAP1510_FPGA_PCR_48MHZ_CLK		(1 << 2)
+#define OMAP1510_FPGA_PCR_4MHZ_CLK		(1 << 1)
+#define OMAP1510_FPGA_PCR_RSRVD_BIT0		(1 << 0)
 
 /*
  * Innovator/OMAP1510 FPGA HID register bit definitions
diff -Nru a/include/asm-arm/arch-omap/bus.h b/include/asm-arm/arch-omap/bus.h
--- a/include/asm-arm/arch-omap/bus.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-arm/arch-omap/bus.h	Tue Jun 15 22:20:43 2004
@@ -72,8 +72,12 @@
  * Device ID numbers for bus types
  */
 #define OMAP_OCP_DEVID_USB	0
+
+#define OMAP_TIPB_DEVID_OHCI	0
 #define OMAP_TIPB_DEVID_LCD	1
 #define OMAP_TIPB_DEVID_MMC	2
+#define OMAP_TIPB_DEVID_OTG	3
+#define OMAP_TIPB_DEVID_UDC	4
 
 /*
  * Virtual bus definitions for OMAP
diff -Nru a/include/asm-arm/arch-omap/dma.h b/include/asm-arm/arch-omap/dma.h
--- a/include/asm-arm/arch-omap/dma.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/arch-omap/dma.h	Tue Jun 15 22:20:37 2004
@@ -33,10 +33,10 @@
 #define OMAP_DMA_EXT_NDMA_REQ		5
 #define OMAP_DMA_EXT_NDMA_REQ2		6
 #define OMAP_DMA_UWIRE_TX		7
-#define OMAP_DMA_MCBSP1_DMA_TX		8
-#define OMAP_DMA_MCBSP1_DMA_RX		9
-#define OMAP_DMA_MCBSP3_DMA_TX		10
-#define OMAP_DMA_MCBSP3_DMA_RX		11
+#define OMAP_DMA_MCBSP1_TX		8
+#define OMAP_DMA_MCBSP1_RX		9
+#define OMAP_DMA_MCBSP3_TX		10
+#define OMAP_DMA_MCBSP3_RX		11
 #define OMAP_DMA_UART1_TX		12
 #define OMAP_DMA_UART1_RX		13
 #define OMAP_DMA_UART2_TX		14
@@ -86,75 +86,77 @@
 #define OMAP_DMA_CRYPTO_DES_OUT		56
 
 
-#define OMAP_DMA_BASE			0xfffed800
-#define OMAP_DMA_GCR_REG		(OMAP_DMA_BASE + 0x400)
-#define OMAP_DMA_GSCR_REG		(OMAP_DMA_BASE + 0x404)
-#define OMAP_DMA_GRST_REG		(OMAP_DMA_BASE + 0x408)
-#define OMAP_DMA_HW_ID_REG		(OMAP_DMA_BASE + 0x442)
-#define OMAP_DMA_PCH2_ID_REG		(OMAP_DMA_BASE + 0x444)
+#define OMAP_DMA_BASE			(0xfffed800)
+#define OMAP_DMA_GCR			(OMAP_DMA_BASE + 0x400)
+#define OMAP_DMA_GSCR			(OMAP_DMA_BASE + 0x404)
+#define OMAP_DMA_GRST			(OMAP_DMA_BASE + 0x408)
+#define OMAP_DMA_HW_ID			(OMAP_DMA_BASE + 0x442)
+#define OMAP_DMA_PCH2_ID		(OMAP_DMA_BASE + 0x444)
 #define OMAP_DMA_PCH0_ID		(OMAP_DMA_BASE + 0x446)
 #define OMAP_DMA_PCH1_ID		(OMAP_DMA_BASE + 0x448)
 #define OMAP_DMA_PCHG_ID		(OMAP_DMA_BASE + 0x44a)
 #define OMAP_DMA_PCHD_ID		(OMAP_DMA_BASE + 0x44c)
-#define OMAP_DMA_CAPS_0_U_REG		(OMAP_DMA_BASE + 0x44e)
-#define OMAP_DMA_CAPS_0_L_REG		(OMAP_DMA_BASE + 0x450)
-#define OMAP_DMA_CAPS_1_U_REG		(OMAP_DMA_BASE + 0x452)
-#define OMAP_DMA_CAPS_1_L_REG		(OMAP_DMA_BASE + 0x454)
-#define OMAP_DMA_CAPS_2_REG		(OMAP_DMA_BASE + 0x456)
-#define OMAP_DMA_CAPS_3_REG		(OMAP_DMA_BASE + 0x458)
-#define OMAP_DMA_CAPS_4_REG		(OMAP_DMA_BASE + 0x45a)
-#define OMAP_DMA_PCH2_SR_REG		(OMAP_DMA_BASE + 0x460)
-#define OMAP_DMA_PCH0_SR_REG		(OMAP_DMA_BASE + 0x480)
-#define OMAP_DMA_PCH1_SR_REG		(OMAP_DMA_BASE + 0x482)
-#define OMAP_DMA_PCHD_SR_REG		(OMAP_DMA_BASE + 0x4c0)
-
-#define OMAP1510_DMA_LCD_CTRL		0xfffedb00
-#define OMAP1510_DMA_LCD_TOP_F1_L	0xfffedb02
-#define OMAP1510_DMA_LCD_TOP_F1_U	0xfffedb04
-#define OMAP1510_DMA_LCD_BOT_F1_L	0xfffedb06
-#define OMAP1510_DMA_LCD_BOT_F1_U	0xfffedb08
-
-#define OMAP1610_DMA_LCD_CSDP		0xfffee3c0
-#define OMAP1610_DMA_LCD_CCR		0xfffee3c2
-#define OMAP1610_DMA_LCD_CTRL		0xfffee3c4
-#define OMAP1610_DMA_LCD_TOP_B1_L	0xfffee3c8
-#define OMAP1610_DMA_LCD_TOP_B1_U	0xfffee3ca
-#define OMAP1610_DMA_LCD_BOT_B1_L	0xfffee3cc
-#define OMAP1610_DMA_LCD_BOT_B1_U	0xfffee3ce
-#define OMAP1610_DMA_LCD_TOP_B2_L	0xfffee3d0
-#define OMAP1610_DMA_LCD_TOP_B2_U	0xfffee3d2
-#define OMAP1610_DMA_LCD_BOT_B2_L	0xfffee3d4
-#define OMAP1610_DMA_LCD_BOT_B2_U	0xfffee3d6
-#define OMAP1610_DMA_LCD_SRC_EI_B1	0xfffee3d8
-#define OMAP1610_DMA_LCD_SRC_FI_B1_L	0xfffee3da
-#define OMAP1610_DMA_LCD_SRC_EN_B1	0xfffee3e0
-#define OMAP1610_DMA_LCD_SRC_FN_B1	0xfffee3e4
-#define OMAP1610_DMA_LCD_LCH_CTRL	0xfffee3ea
-#define OMAP1610_DMA_LCD_SRC_FI_B1_U	0xfffee3f4
+#define OMAP_DMA_CAPS_0_U		(OMAP_DMA_BASE + 0x44e)
+#define OMAP_DMA_CAPS_0_L		(OMAP_DMA_BASE + 0x450)
+#define OMAP_DMA_CAPS_1_U		(OMAP_DMA_BASE + 0x452)
+#define OMAP_DMA_CAPS_1_L		(OMAP_DMA_BASE + 0x454)
+#define OMAP_DMA_CAPS_2			(OMAP_DMA_BASE + 0x456)
+#define OMAP_DMA_CAPS_3			(OMAP_DMA_BASE + 0x458)
+#define OMAP_DMA_CAPS_4			(OMAP_DMA_BASE + 0x45a)
+#define OMAP_DMA_PCH2_SR		(OMAP_DMA_BASE + 0x460)
+#define OMAP_DMA_PCH0_SR		(OMAP_DMA_BASE + 0x480)
+#define OMAP_DMA_PCH1_SR		(OMAP_DMA_BASE + 0x482)
+#define OMAP_DMA_PCHD_SR		(OMAP_DMA_BASE + 0x4c0)
+
+#define OMAP1510_DMA_LCD_BASE		(0xfffedb00)
+#define OMAP1510_DMA_LCD_CTRL		(OMAP1510_DMA_LCD_BASE + 0x00)
+#define OMAP1510_DMA_LCD_TOP_F1_L	(OMAP1510_DMA_LCD_BASE + 0x02)
+#define OMAP1510_DMA_LCD_TOP_F1_U	(OMAP1510_DMA_LCD_BASE + 0x04)
+#define OMAP1510_DMA_LCD_BOT_F1_L	(OMAP1510_DMA_LCD_BASE + 0x06)
+#define OMAP1510_DMA_LCD_BOT_F1_U	(OMAP1510_DMA_LCD_BASE + 0x08)
+
+#define OMAP1610_DMA_LCD_BASE		(0xfffee300)
+#define OMAP1610_DMA_LCD_CSDP      	(OMAP1610_DMA_LCD_BASE + 0xc0)
+#define OMAP1610_DMA_LCD_CCR		(OMAP1610_DMA_LCD_BASE + 0xc2)
+#define OMAP1610_DMA_LCD_CTRL		(OMAP1610_DMA_LCD_BASE + 0xc4)
+#define OMAP1610_DMA_LCD_TOP_B1_L	(OMAP1610_DMA_LCD_BASE + 0xc8)
+#define OMAP1610_DMA_LCD_TOP_B1_U	(OMAP1610_DMA_LCD_BASE + 0xca)
+#define OMAP1610_DMA_LCD_BOT_B1_L	(OMAP1610_DMA_LCD_BASE + 0xcc)
+#define OMAP1610_DMA_LCD_BOT_B1_U	(OMAP1610_DMA_LCD_BASE + 0xce)
+#define OMAP1610_DMA_LCD_TOP_B2_L	(OMAP1610_DMA_LCD_BASE + 0xd0)
+#define OMAP1610_DMA_LCD_TOP_B2_U	(OMAP1610_DMA_LCD_BASE + 0xd2)
+#define OMAP1610_DMA_LCD_BOT_B2_L	(OMAP1610_DMA_LCD_BASE + 0xd4)
+#define OMAP1610_DMA_LCD_BOT_B2_U	(OMAP1610_DMA_LCD_BASE + 0xd6)
+#define OMAP1610_DMA_LCD_SRC_EI_B1	(OMAP1610_DMA_LCD_BASE + 0xd8)
+#define OMAP1610_DMA_LCD_SRC_FI_B1_L	(OMAP1610_DMA_LCD_BASE + 0xda)
+#define OMAP1610_DMA_LCD_SRC_EN_B1	(OMAP1610_DMA_LCD_BASE + 0xe0)
+#define OMAP1610_DMA_LCD_SRC_FN_B1	(OMAP1610_DMA_LCD_BASE + 0xe4)
+#define OMAP1610_DMA_LCD_LCH_CTRL	(OMAP1610_DMA_LCD_BASE + 0xea)
+#define OMAP1610_DMA_LCD_SRC_FI_B1_U	(OMAP1610_DMA_LCD_BASE + 0xf4)
 
 
 /* Every LCh has its own set of the registers below */
-#define OMAP_DMA_CSDP_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x00)
-#define OMAP_DMA_CCR_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x02)
-#define OMAP_DMA_CICR_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x04)
-#define OMAP_DMA_CSR_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x06)
-#define OMAP_DMA_CSSA_L_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x08)
-#define OMAP_DMA_CSSA_U_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x0a)
-#define OMAP_DMA_CDSA_L_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x0c)
-#define OMAP_DMA_CDSA_U_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x0e)
-#define OMAP_DMA_CEN_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x10)
-#define OMAP_DMA_CFN_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x12)
-#define OMAP_DMA_CSFI_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x14)
-#define OMAP_DMA_CSEI_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x16)
-#define OMAP_DMA_CSAC_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x18)
-#define OMAP_DMA_CDAC_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x1a)
-#define OMAP_DMA_CDEI_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x1c)
-#define OMAP_DMA_CDFI_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x1e)
-#define OMAP_DMA_COLOR_L_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x20)
-#define OMAP_DMA_COLOR_U_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x22)
-#define OMAP_DMA_CCR2_REG(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x24)
-#define OMAP_DMA_CLNK_CTRL_REG(n)	(OMAP_DMA_BASE + 0x40 * (n) + 0x28)
-#define OMAP_DMA_LCH_CTRL_REG(n)	(OMAP_DMA_BASE + 0x40 * (n) + 0x2a)
+#define OMAP_DMA_CSDP(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x00)
+#define OMAP_DMA_CCR(n)			(OMAP_DMA_BASE + 0x40 * (n) + 0x02)
+#define OMAP_DMA_CICR(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x04)
+#define OMAP_DMA_CSR(n)			(OMAP_DMA_BASE + 0x40 * (n) + 0x06)
+#define OMAP_DMA_CSSA_L(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x08)
+#define OMAP_DMA_CSSA_U(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x0a)
+#define OMAP_DMA_CDSA_L(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x0c)
+#define OMAP_DMA_CDSA_U(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x0e)
+#define OMAP_DMA_CEN(n)			(OMAP_DMA_BASE + 0x40 * (n) + 0x10)
+#define OMAP_DMA_CFN(n)			(OMAP_DMA_BASE + 0x40 * (n) + 0x12)
+#define OMAP_DMA_CSFI(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x14)
+#define OMAP_DMA_CSEI(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x16)
+#define OMAP_DMA_CSAC(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x18)
+#define OMAP_DMA_CDAC(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x1a)
+#define OMAP_DMA_CDEI(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x1c)
+#define OMAP_DMA_CDFI(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x1e)
+#define OMAP_DMA_COLOR_L(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x20)
+#define OMAP_DMA_COLOR_U(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x22)
+#define OMAP_DMA_CCR2(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x24)
+#define OMAP_DMA_CLNK_CTRL(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x28)
+#define OMAP_DMA_LCH_CTRL(n)		(OMAP_DMA_BASE + 0x40 * (n) + 0x2a)
 
 #define OMAP_DMA_TOUT_IRQ		(1 << 0)
 #define OMAP_DMA_DROP_IRQ		(1 << 1)
@@ -192,6 +194,11 @@
 	OMAP_LCD_DMA_B2_BOTTOM
 };
 
+enum {
+	OMAP_DMA_DATA_BURST_4,
+	OMAP_DMA_DATA_BURST_8
+};
+
 extern int omap_request_dma(int dev_id, const char *dev_name,
 			    void (* callback)(int lch, u16 ch_status, void *data),
 			    void *data, int *dma_ch);
@@ -203,10 +210,23 @@
 extern void omap_set_dma_transfer_params(int lch, int data_type,
 					 int elem_count, int frame_count,
 					 int sync_mode);
+extern void omap_set_dma_constant_fill(int lch, u32 color);
+extern void omap_set_dma_transparent_copy(int lch, u32 color);
+
 extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
 				    unsigned long src_start);
+extern void omap_set_dma_src_index(int lch, int eidx, int fidx);
+extern void omap_set_dma_src_data_pack(int lch, int enable);
+extern void omap_set_dma_src_burst_mode(int lch, int burst_mode);
+
 extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
 				     unsigned long dest_start);
+extern void omap_set_dma_dest_index(int lch, int eidx, int fidx);
+extern void omap_set_dma_dest_data_pack(int lch, int enable);
+extern void omap_set_dma_dest_burst_mode(int lch, int burst_mode);
+
+extern void omap_dma_link_lch (int lch_head, int lch_queue);
+extern void omap_dma_unlink_lch (int lch_head, int lch_queue);
 
 /* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */
 extern int omap_dma_in_1510_mode(void);
diff -Nru a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h
--- a/include/asm-arm/arch-omap/gpio.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-arm/arch-omap/gpio.h	Tue Jun 15 22:20:38 2004
@@ -32,18 +32,18 @@
 
 #define OMAP_MPUIO_BASE			0xfffb5000
 #define OMAP_MPUIO_INPUT_LATCH		0x00
-#define OMAP_MPUIO_OUTPUT_REG		0x04
+#define OMAP_MPUIO_OUTPUT		0x04
 #define OMAP_MPUIO_IO_CNTL		0x08
 #define OMAP_MPUIO_KBR_LATCH		0x10
-#define OMAP_MPUIO_KBC_REG		0x14
-#define OMAP_MPUIO_GPIO_EVENT_MODE_REG	0x18
-#define OMAP_MPUIO_GPIO_INT_EDGE_REG	0x1c
+#define OMAP_MPUIO_KBC			0x14
+#define OMAP_MPUIO_GPIO_EVENT_MODE	0x18
+#define OMAP_MPUIO_GPIO_INT_EDGE	0x1c
 #define OMAP_MPUIO_KBD_INT		0x20
 #define OMAP_MPUIO_GPIO_INT		0x24
 #define OMAP_MPUIO_KBD_MASKIT		0x28
 #define OMAP_MPUIO_GPIO_MASKIT		0x2c
-#define OMAP_MPUIO_GPIO_DEBOUNCING_REG	0x30
-#define OMAP_MPUIO_LATCH_REG		0x34
+#define OMAP_MPUIO_GPIO_DEBOUNCING	0x30
+#define OMAP_MPUIO_LATCH		0x34
 
 #define OMAP_MPUIO(nr)		(OMAP_MAX_GPIO_LINES + (nr))
 #define OMAP_GPIO_IS_MPUIO(nr)	((nr) >= OMAP_MAX_GPIO_LINES)
diff -Nru a/include/asm-arm/arch-omap/hardware.h b/include/asm-arm/arch-omap/hardware.h
--- a/include/asm-arm/arch-omap/hardware.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/arch-omap/hardware.h	Tue Jun 15 22:20:37 2004
@@ -10,6 +10,7 @@
  * Author: RidgeRun, Inc. Greg Lonnon <glonnon@ridgerun.com>
  *
  * Reorganized for Linux-2.6 by Tony Lindgren <tony@atomide.com>
+ *                          and Dirk Behme <dirk.behme@de.bosch.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
@@ -40,50 +41,7 @@
 #ifndef __ASSEMBLER__
 #include <asm/types.h>
 #endif
-#include <asm/mach-types.h>
-
-/*
- * ----------------------------------------------------------------------------
- * I/O mapping
- * ----------------------------------------------------------------------------
- */
-#define IO_PHYS			0xFFFB0000
-#define IO_OFFSET		0x01000000	/* Virtual IO = 0xfefb0000 */
-#define IO_VIRT			(IO_PHYS - IO_OFFSET)
-#define IO_SIZE			0x40000
-#define IO_ADDRESS(x)		((x) - IO_OFFSET)
-
-#define PCIO_BASE		0
-
-#define io_p2v(x)               ((x) - IO_OFFSET)
-#define io_v2p(x)               ((x) + IO_OFFSET)
-
-#ifndef __ASSEMBLER__
-
-/* 16 bit uses LDRH/STRH, base +/- offset_8 */
-typedef struct { volatile u16 offset[256]; } __regbase16;
-#define __REGV16(vaddr)		((__regbase16 *)((vaddr)&~0xff)) \
-					->offset[((vaddr)&0xff)>>1]
-#define __REG16(paddr)          __REGV16(io_p2v(paddr))
-
-/* 8/32 bit uses LDR/STR, base +/- offset_12 */
-typedef struct { volatile u8 offset[4096]; } __regbase8;
-#define __REGV8(vaddr)		((__regbase8  *)((paddr)&~4095)) \
-					->offset[((paddr)&4095)>>0]
-#define __REG8(paddr)		__REGV8(io_p2v(paddr))
-
-typedef struct { volatile u32 offset[4096]; } __regbase32;
-#define __REGV32(vaddr)		((__regbase32 *)((vaddr)&~4095)) \
-					->offset[((vaddr)&4095)>>2]
-#define __REG32(paddr)		__REGV32(io_p2v(paddr))
-
-#else
-
-#define __REG8(paddr)		io_p2v(paddr)
-#define __REG16(paddr)		io_p2v(paddr)
-#define __REG32(paddr)		io_p2v(paddr)
-
-#endif
+#include <asm/arch/io.h>
 
 /*
  * ---------------------------------------------------------------------------
@@ -98,14 +56,14 @@
  * Clocks
  * ----------------------------------------------------------------------------
  */
-#define CLKGEN_RESET_BASE	(0xfffece00)
-#define ARM_CKCTL		(CLKGEN_RESET_BASE + 0x0)
-#define ARM_IDLECT1		(CLKGEN_RESET_BASE + 0x4)
-#define ARM_IDLECT2		(CLKGEN_RESET_BASE + 0x8)
-#define ARM_EWUPCT		(CLKGEN_RESET_BASE + 0xC)
-#define ARM_RSTCT1		(CLKGEN_RESET_BASE + 0x10)
-#define ARM_RSTCT2		(CLKGEN_RESET_BASE + 0x14)
-#define ARM_SYSST		(CLKGEN_RESET_BASE + 0x18)
+#define CLKGEN_REG_BASE		(0xfffece00)
+#define ARM_CKCTL		(CLKGEN_REG_BASE + 0x0)
+#define ARM_IDLECT1		(CLKGEN_REG_BASE + 0x4)
+#define ARM_IDLECT2		(CLKGEN_REG_BASE + 0x8)
+#define ARM_EWUPCT		(CLKGEN_REG_BASE + 0xC)
+#define ARM_RSTCT1		(CLKGEN_REG_BASE + 0x10)
+#define ARM_RSTCT2		(CLKGEN_REG_BASE + 0x14)
+#define ARM_SYSST		(CLKGEN_REG_BASE + 0x18)
 
 #define CK_RATEF		1
 #define CK_IDLEF		2
@@ -114,19 +72,27 @@
 #define SETARM_IDLE_SHIFT
 
 /* DPLL control registers */
-#define DPLL_CTL_REG		(0xfffecf00)
-#define CK_DPLL1		(0xfffecf00)
+#define DPLL_CTL		(0xfffecf00)
 
-/* ULPD */
+/* DSP clock control */
+#define DSP_CONFIG_REG_BASE     (0xe1008000)
+#define DSP_IDLECT1		(DSP_CONFIG_REG_BASE + 0x4)
+#define DSP_IDLECT2		(DSP_CONFIG_REG_BASE + 0x8)
+
+/*
+ * ---------------------------------------------------------------------------
+ * UPLD
+ * ---------------------------------------------------------------------------
+ */
 #define ULPD_REG_BASE		(0xfffe0800)
-#define ULPD_IT_STATUS_REG	(ULPD_REG_BASE + 0x14)
-#define ULPD_CLOCK_CTRL_REG	(ULPD_REG_BASE + 0x30)
-#define ULPD_SOFT_REQ_REG	(ULPD_REG_BASE + 0x34)
-#define ULPD_DPLL_CTRL_REG	(ULPD_REG_BASE + 0x3c)
-#define ULPD_STATUS_REQ_REG	(ULPD_REG_BASE + 0x40)
-#define ULPD_APLL_CTRL_REG	(ULPD_REG_BASE + 0x4c)
-#define ULPD_POWER_CTRL_REG	(ULPD_REG_BASE + 0x50)
-#define ULPD_CAM_CLK_CTRL_REG	(ULPD_REG_BASE + 0x7c)
+#define ULPD_IT_STATUS		(ULPD_REG_BASE + 0x14)
+#define ULPD_CLOCK_CTRL		(ULPD_REG_BASE + 0x30)
+#define ULPD_SOFT_REQ		(ULPD_REG_BASE + 0x34)
+#define ULPD_DPLL_CTRL		(ULPD_REG_BASE + 0x3c)
+#define ULPD_STATUS_REQ		(ULPD_REG_BASE + 0x40)
+#define ULPD_APLL_CTRL		(ULPD_REG_BASE + 0x4c)
+#define ULPD_POWER_CTRL		(ULPD_REG_BASE + 0x50)
+#define ULPD_CAM_CLK_CTRL	(ULPD_REG_BASE + 0x7c)
 
 /*
  * ---------------------------------------------------------------------------
@@ -147,18 +113,24 @@
 #define TIMER32k_ARL		(1<<3)
 
 /* MPU Timer base addresses */
-#define OMAP_MPUTIMER_BASE	0xfffec500
-#define OMAP_MPUTIMER_OFF	0x00000100
-
-#define OMAP_TIMER1_BASE	0xfffec500
-#define OMAP_TIMER2_BASE	0xfffec600
-#define OMAP_TIMER3_BASE	0xfffec700
-#define OMAP_WATCHDOG_BASE	0xfffec800
+#define OMAP_TIMER1_BASE	(0xfffec500)
+#define OMAP_TIMER2_BASE	(0xfffec600)
+#define OMAP_TIMER3_BASE	(0xfffec700)
+#define OMAP_MPUTIMER_BASE	OMAP_TIMER1_BASE
+#define OMAP_MPUTIMER_OFFSET	0x100
 
 /* MPU Timer Registers */
-#define CNTL_TIMER		0
-#define LOAD_TIM		4
-#define READ_TIM		8
+#define OMAP_TIMER1_CNTL	(OMAP_TIMER_BASE1 + 0x0)
+#define OMAP_TIMER1_LOAD_TIM	(OMAP_TIMER_BASE1 + 0x4)
+#define OMAP_TIMER1_READ_TIM	(OMAP_TIMER_BASE1 + 0x8)
+
+#define OMAP_TIMER2_CNTL	(OMAP_TIMER_BASE2 + 0x0)
+#define OMAP_TIMER2_LOAD_TIM	(OMAP_TIMER_BASE2 + 0x4)
+#define OMAP_TIMER2_READ_TIM	(OMAP_TIMER_BASE2 + 0x8)
+
+#define OMAP_TIMER3_CNTL	(OMAP_TIMER_BASE3 + 0x0)
+#define OMAP_TIMER3_LOAD_TIM	(OMAP_TIMER_BASE3 + 0x4)
+#define OMAP_TIMER3_READ_TIM	(OMAP_TIMER_BASE3 + 0x8)
 
 /* CNTL_TIMER register bits */
 #define MPUTIM_FREE		(1<<6)
@@ -168,6 +140,13 @@
 #define MPUTIM_AR		(1<<1)
 #define MPUTIM_ST		(1<<0)
 
+/* Watchdog */
+#define OMAP_WATCHDOG_BASE	(0xfffec800)
+#define OMAP_WDT_TIMER		(OMAP_WATCHDOG_BASE + 0x0)
+#define OMAP_WDT_LOAD_TIM	(OMAP_WATCHDOG_BASE + 0x4)
+#define OMAP_WDT_READ_TIM	(OMAP_WATCHDOG_BASE + 0x4)
+#define OMAP_WDT_TIMER_MODE	(OMAP_WATCHDOG_BASE + 0x8)
+
 /*
  * ---------------------------------------------------------------------------
  * Interrupts
@@ -175,22 +154,30 @@
  */
 #define OMAP_IH1_BASE		0xfffecb00
 #define OMAP_IH2_BASE		0xfffe0000
-#define OMAP_ITR		0x0
-#define OMAP_MASK		0x4
 
-#define IRQ_ITR			0x00
-#define IRQ_MIR			0x04
-#define IRQ_SIR_IRQ		0x10
-#define IRQ_SIR_FIQ		0x14
-#define IRQ_CONTROL_REG		0x18
-#define IRQ_ISR			0x9c
-#define IRQ_ILR0		0x1c
-
-/* OMAP-1610 specific interrupt handler registers */
-#define OMAP_IH2_SECT1		(OMAP_IH2_BASE)
-#define OMAP_IH2_SECT2		(OMAP_IH2_BASE + 0x100)
-#define OMAP_IH2_SECT3		(OMAP_IH2_BASE + 0x200)
-#define OMAP_IH2_SECT4		(OMAP_IH2_BASE + 0x300)
+#define OMAP_IH1_ITR		(OMAP_IH1_BASE + 0x00)
+#define OMAP_IH1_MIR		(OMAP_IH1_BASE + 0x04)
+#define OMAP_IH1_SIR_IRQ	(OMAP_IH1_BASE + 0x10)
+#define OMAP_IH1_SIR_FIQ	(OMAP_IH1_BASE + 0x14)
+#define OMAP_IH1_CONTROL	(OMAP_IH1_BASE + 0x18)
+#define OMAP_IH1_ILR0		(OMAP_IH1_BASE + 0x1c)
+#define OMAP_IH1_ISR		(OMAP_IH1_BASE + 0x9c)
+
+#define OMAP_IH2_ITR		(OMAP_IH2_BASE + 0x00)
+#define OMAP_IH2_MIR		(OMAP_IH2_BASE + 0x04)
+#define OMAP_IH2_SIR_IRQ	(OMAP_IH2_BASE + 0x10)
+#define OMAP_IH2_SIR_FIQ	(OMAP_IH2_BASE + 0x14)
+#define OMAP_IH2_CONTROL	(OMAP_IH2_BASE + 0x18)
+#define OMAP_IH2_ILR0		(OMAP_IH2_BASE + 0x1c)
+#define OMAP_IH2_ISR		(OMAP_IH2_BASE + 0x9c)
+
+#define IRQ_ITR_REG_OFFSET	0x00
+#define IRQ_MIR_REG_OFFSET	0x04
+#define IRQ_SIR_IRQ_REG_OFFSET	0x10
+#define IRQ_SIR_FIQ_REG_OFFSET	0x14
+#define IRQ_CONTROL_REG_OFFSET	0x18
+#define IRQ_ISR_REG_OFFSET	0x9c
+#define IRQ_ILR0_REG_OFFSET	0x1c
 
 /*
  * ---------------------------------------------------------------------------
@@ -199,9 +186,9 @@
  */
 #define TCMIF_BASE		0xfffecc00
 #define IMIF_PRIO		(TCMIF_BASE + 0x00)
-#define EMIFS_PRIO_REG		(TCMIF_BASE + 0x04)
-#define EMIFF_PRIO_REG		(TCMIF_BASE + 0x08)
-#define EMIFS_CONFIG_REG	(TCMIF_BASE + 0x0c)
+#define EMIFS_PRIO		(TCMIF_BASE + 0x04)
+#define EMIFF_PRIO		(TCMIF_BASE + 0x08)
+#define EMIFS_CONFIG		(TCMIF_BASE + 0x0c)
 #define EMIFS_CS0_CONFIG	(TCMIF_BASE + 0x10)
 #define EMIFS_CS1_CONFIG	(TCMIF_BASE + 0x14)
 #define EMIFS_CS2_CONFIG	(TCMIF_BASE + 0x18)
@@ -214,7 +201,6 @@
 #define TC_ENDIANISM		(TCMIF_BASE + 0x34)
 #define EMIFF_SDRAM_CONFIG_2	(TCMIF_BASE + 0x3c)
 #define EMIF_CFG_DYNAMIC_WS	(TCMIF_BASE + 0x40)
-
 /*
  * ----------------------------------------------------------------------------
  * System control registers
@@ -266,25 +252,24 @@
  * ---------------------------------------------------------------------------
  */
 #define TIPB_PUBLIC_CNTL_BASE		0xfffed300
-#define MPU_PUBLIC_TIPB_CNTL_REG	(TIPB_PUBLIC_CNTL_BASE + 0x8)
+#define MPU_PUBLIC_TIPB_CNTL		(TIPB_PUBLIC_CNTL_BASE + 0x8)
 #define TIPB_PRIVATE_CNTL_BASE		0xfffeca00
-#define MPU_PRIVATE_TIPB_CNTL_REG	(TIPB_PRIVATE_CNTL_BASE + 0x8)
+#define MPU_PRIVATE_TIPB_CNTL		(TIPB_PRIVATE_CNTL_BASE + 0x8)
 
 /*
  * ----------------------------------------------------------------------------
- * DSP control registers
+ * MPUI interface
  * ----------------------------------------------------------------------------
  */
-/*  MPUI Interface Registers */
-#define MPUI_CTRL_REG		(0xfffec900)
-#define MPUI_DEBUG_ADDR		(0xfffec904)
-#define MPUI_DEBUG_DATA		(0xfffec908)
-#define MPUI_DEBUG_FLAG		(0xfffec90c)
-#define MPUI_STATUS_REG		(0xfffec910)
-#define MPUI_DSP_STATUS_REG	(0xfffec914)
-#define MPUI_DSP_BOOT_CONFIG	(0xfffec918)
-#define MPUI_DSP_API_CONFIG	(0xfffec91c)
-
+#define MPUI_BASE			(0xfffec900)
+#define MPUI_CTRL			(MPUI_BASE + 0x0)
+#define MPUI_DEBUG_ADDR			(MPUI_BASE + 0x4)
+#define MPUI_DEBUG_DATA			(MPUI_BASE + 0x8)
+#define MPUI_DEBUG_FLAG			(MPUI_BASE + 0xc)
+#define MPUI_STATUS_REG			(MPUI_BASE + 0x10)
+#define MPUI_DSP_STATUS			(MPUI_BASE + 0x14)
+#define MPUI_DSP_BOOT_CONFIG		(MPUI_BASE + 0x18)
+#define MPUI_DSP_API_CONFIG		(MPUI_BASE + 0x1c)
 
 #ifndef __ASSEMBLER__
 
@@ -293,28 +278,39 @@
  * Processor differentiation
  * ---------------------------------------------------------------------------
  */
-#define OMAP_ID_REG		__REG32(0xfffed404)
+#define OMAP_ID_BASE		(0xfffed400)
+#define OMAP_ID_REG		__REG32(OMAP_ID_BASE +  0x04)
+
+#define ID_SHIFT		12
+#define ID_MASK			0x7fff
+
+/* See also uncompress.h */
+#define OMAP_ID_730		0x355F
+#define OMAP_ID_1510		0x3470
+#define OMAP_ID_1610		0x3576
+#define OMAP_ID_1710		0x35F7
+#define OMAP_ID_5912		0x358C
 
 #ifdef CONFIG_ARCH_OMAP730
 #include "omap730.h"
-#define cpu_is_omap730()	(((OMAP_ID_REG >> 12) & 0xffff) == 0xB55F)
+#define cpu_is_omap730()	(((OMAP_ID_REG >> ID_SHIFT) & ID_MASK) == OMAP_ID_730)
 #else
 #define cpu_is_omap730()	0
 #endif
 
 #ifdef CONFIG_ARCH_OMAP1510
 #include "omap1510.h"
-#define cpu_is_omap1510()	(((OMAP_ID_REG >> 12) & 0xffff) == 0xB470)
+#define cpu_is_omap1510()	(((OMAP_ID_REG >> ID_SHIFT) & ID_MASK) == OMAP_ID_1510)
 #else
 #define cpu_is_omap1510()	0
 #endif
 
 #ifdef CONFIG_ARCH_OMAP1610
 #include "omap1610.h"
-#define cpu_is_omap1710()       (((OMAP_ID_REG >> 12) & 0xffff) == 0xB5F7)
+#define cpu_is_omap1710()       (((OMAP_ID_REG >> ID_SHIFT) & ID_MASK) == OMAP_ID_1710)
 /* Detect 1710 as 1610 for now */
-#define cpu_is_omap1610()	(((OMAP_ID_REG >> 12) & 0xffff) == 0xB576 || \
-				 cpu_is_omap1710())
+#define cpu_is_omap1610()	(((OMAP_ID_REG >> ID_SHIFT) & ID_MASK) == OMAP_ID_1610 \
+				|| cpu_is_omap1710())
 #else
 #define cpu_is_omap1610()	0
 #define cpu_is_omap1710()	0
@@ -322,7 +318,7 @@
 
 #ifdef CONFIG_ARCH_OMAP5912
 #include "omap5912.h"
-#define cpu_is_omap5912()	(((OMAP_ID_REG >> 12) & 0xffff) == 0xB58C)
+#define cpu_is_omap5912()	(((OMAP_ID_REG >> ID_SHIFT) & ID_MASK) == OMAP_ID_5912)
 #else
 #define cpu_is_omap5912()	0
 #endif
diff -Nru a/include/asm-arm/arch-omap/io.h b/include/asm-arm/arch-omap/io.h
--- a/include/asm-arm/arch-omap/io.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/arch-omap/io.h	Tue Jun 15 22:20:37 2004
@@ -1,13 +1,36 @@
 /*
  * linux/include/asm-arm/arch-omap/io.h
  *
+ * IO definitions for TI OMAP processors and boards
+ *
  * Copied from linux/include/asm-arm/arch-sa1100/io.h
  * Copyright (C) 1997-1999 Russell King
  *
+ * 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * 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.
+ *
  * Modifications:
  *  06-12-1997	RMK	Created.
  *  07-04-1999	RMK	Major cleanup
  */
+
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
@@ -22,6 +45,24 @@
 #define __mem_isa(a)		((unsigned long)(a))
 
 /*
+ * ----------------------------------------------------------------------------
+ * I/O mapping
+ * ----------------------------------------------------------------------------
+ */
+#define IO_PHYS			0xFFFB0000
+#define IO_OFFSET		0x01000000	/* Virtual IO = 0xfefb0000 */
+#define IO_VIRT			(IO_PHYS - IO_OFFSET)
+#define IO_SIZE			0x40000
+#define IO_ADDRESS(x)		((x) - IO_OFFSET)
+
+#define PCIO_BASE		0
+
+#define io_p2v(x)               ((x) - IO_OFFSET)
+#define io_v2p(x)               ((x) + IO_OFFSET)
+
+#ifndef __ASSEMBLER__
+
+/*
  * Functions to access the OMAP IO region
  *
  * NOTE: - Use omap_read/write[bwl] for physical register addresses
@@ -37,5 +78,30 @@
 #define omap_writeb(v,a)	(*(volatile unsigned char  *)IO_ADDRESS(a) = (v))
 #define omap_writew(v,a)	(*(volatile unsigned short *)IO_ADDRESS(a) = (v))
 #define omap_writel(v,a)	(*(volatile unsigned int   *)IO_ADDRESS(a) = (v))
+
+/* 16 bit uses LDRH/STRH, base +/- offset_8 */
+typedef struct { volatile u16 offset[256]; } __regbase16;
+#define __REGV16(vaddr)		((__regbase16 *)((vaddr)&~0xff)) \
+					->offset[((vaddr)&0xff)>>1]
+#define __REG16(paddr)          __REGV16(io_p2v(paddr))
+
+/* 8/32 bit uses LDR/STR, base +/- offset_12 */
+typedef struct { volatile u8 offset[4096]; } __regbase8;
+#define __REGV8(vaddr)		((__regbase8  *)((vaddr)&~4095)) \
+					->offset[((vaddr)&4095)>>0]
+#define __REG8(paddr)		__REGV8(io_p2v(paddr))
+
+typedef struct { volatile u32 offset[4096]; } __regbase32;
+#define __REGV32(vaddr)		((__regbase32 *)((vaddr)&~4095)) \
+					->offset[((vaddr)&4095)>>2]
+#define __REG32(paddr)		__REGV32(io_p2v(paddr))
+
+#else
+
+#define __REG8(paddr)		io_p2v(paddr)
+#define __REG16(paddr)		io_p2v(paddr)
+#define __REG32(paddr)		io_p2v(paddr)
+
+#endif
 
 #endif
diff -Nru a/include/asm-arm/arch-omap/memory.h b/include/asm-arm/arch-omap/memory.h
--- a/include/asm-arm/arch-omap/memory.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-arm/arch-omap/memory.h	Tue Jun 15 22:20:39 2004
@@ -30,25 +30,12 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE		(0xbf000000UL)
-#define TASK_SIZE_26		(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE	(0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET		(0xC0000000UL)
 #define PHYS_OFFSET		(0x10000000UL)
 
 /*
@@ -57,20 +44,10 @@
 #define OMAP1510_LB_OFFSET	(0x30000000UL)
 
 /*
- * The DRAM is contiguous.
- */
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
-
-/*
  * Conversion between SDRAM and fake PCI bus, used by USB
  * NOTE: Physical address must be converted to Local Bus address
  *	 on OMAP-1510 only
  */
-#define __virt_to_bus__is_a_macro
-#define __bus_to_virt__is_a_macro
 
 /*
  * Bus address is physical address, except for OMAP-1510 Local Bus.
diff -Nru a/include/asm-arm/arch-omap/mux.h b/include/asm-arm/arch-omap/mux.h
--- a/include/asm-arm/arch-omap/mux.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-arm/arch-omap/mux.h	Tue Jun 15 22:20:39 2004
@@ -140,16 +140,20 @@
 	R18_1510_USB_GPIO0,
 	W4_USB_PUEN,
 	W4_USB_CLKO,
+	W4_USB_HIGHZ,
+	W4_GPIO58,
 
 	/* USB1 master */
 	USB1_SUSP,
 	USB1_SEO,
+	W13_1610_USB1_SE0,
 	USB1_TXEN,
 	USB1_TXD,
 	USB1_VP,
 	USB1_VM,
 	USB1_RCV,
 	USB1_SPEED,
+	R13_1610_USB1_SPEED,
 
 	/* USB2 master */
 	USB2_SUSP,
@@ -216,6 +220,7 @@
 	/* OMAP-1610 GPIO */
 	P20_1610_GPIO4,
 	V9_1610_GPIO7,
+	W8_1610_GPIO9,
 	N19_1610_GPIO13,
 	P10_1610_GPIO22,
 	V5_1610_GPIO24,
@@ -317,16 +322,20 @@
 MUX_CFG("R18_1510_USB_GPIO0",	 7,    9,    0,	  1,  11,   1,	 NA,	 0,  1)
 MUX_CFG("W4_USB_PUEN",		 D,    3,    0,	  3,   5,   1,	 NA,	 0,  1)
 MUX_CFG("W4_USB_CLKO",		 D,    3,    1,	  3,   5,   0,	 NA,	 0,  1)
+MUX_CFG("W4_USB_HIGHZ",		 D,    3,    4,	  3,   5,   0,	  3,	 0,  1)
+MUX_CFG("W4_GPIO58",		 D,    3,    7,	  3,   5,   0,	  3,	 0,  1)
 
 /* USB1 master */
 MUX_CFG("USB1_SUSP",		 8,   27,    2,	  1,  27,   0,	 NA,	 0,  1)
 MUX_CFG("USB1_SE0",		 9,    0,    2,	  1,  28,   0,	 NA,	 0,  1)
+MUX_CFG("W13_1610_USB1_SE0",	 9,    0,    4,	  1,  28,   0,	 NA,	 0,  1)
 MUX_CFG("USB1_TXEN",		 9,    3,    2,	  1,  29,   0,	 NA,	 0,  1)
 MUX_CFG("USB1_TXD",		 9,   24,    1,	  2,   4,   0,	 NA,	 0,  1)
 MUX_CFG("USB1_VP",		 A,    3,    1,	  2,   7,   0,	 NA,	 0,  1)
 MUX_CFG("USB1_VM",		 A,    6,    1,	  2,   8,   0,	 NA,	 0,  1)
 MUX_CFG("USB1_RCV",		 A,    9,    1,	  2,   9,   0,	 NA,	 0,  1)
 MUX_CFG("USB1_SPEED",		 A,   12,    2,	  2,  10,   0,	 NA,	 0,  1)
+MUX_CFG("R13_1610_USB1_SPEED",	 A,   12,    5,	  2,  10,   0,	 NA,	 0,  1)
 
 /* USB2 master */
 MUX_CFG("USB2_SUSP",		 B,    3,    1,	  2,  17,   0,	 NA,	 0,  1)
@@ -394,6 +403,7 @@
 /* OMAP-1610 GPIO */
 MUX_CFG("P20_1610_GPIO4",	 6,   27,    0,	  1,   7,   0,	  1,	 1,  1)
 MUX_CFG("V9_1610_GPIO7",	 B,   12,    1,	  2,  20,   0,	  2,	 1,  1)
+MUX_CFG("W8_1610_GPIO9",	 B,   21,    0,	  2,  23,   0,	  2,	 1,  1)
 MUX_CFG("N19_1610_GPIO13",	 6,   12,    0,	  1,   2,   0,	  1,	 1,  1)
 MUX_CFG("P10_1610_GPIO22",	 C,    0,    7,	  2,  26,   0,	  2,	 1,  1)
 MUX_CFG("V5_1610_GPIO24",	 B,   15,    7,	  2,  21,   0,	  2,	 1,  1)
@@ -405,7 +415,7 @@
 MUX_CFG("W21_1610_UWIRE_SDO",	 8,    3,    0,	  1,  19,   0,	  1,	 1,  1)
 MUX_CFG("N14_1610_UWIRE_CS0",	 8,    9,    1,	  1,  21,   0,	  1,	 1,  1)
 MUX_CFG("P15_1610_UWIRE_CS3",	 8,   12,    1,	  1,  22,   0,	  1,	 1,  1)
-MUX_CFG("N15_1610_UWIRE_CS1",	 7,   18,    2,	 NA,   0,   0,	 NA,	 0,  0)
+MUX_CFG("N15_1610_UWIRE_CS1",	 7,   18,    2,	  1,  14,   0,	 NA,	 0,  1)
 
 /* First MMC interface, same on 1510 and 1610 */
 MUX_CFG("MMC_CMD",		 A,   27,    0,	  2,  15,   1,	  2,	 1,  1)
@@ -458,7 +468,7 @@
 MUX_CFG("N19_1610_KBR5",	 6,  12,     1,	  1,   2,   1,	  1,	 1,  0)
 
 /* Power management */
-MUX_CFG("T20_1610_LOW_PWR",	 7,   12,    1,	  0,   0,   0,   NA,	 0,  0)
+MUX_CFG("T20_1610_LOW_PWR",	 7,   12,    1,	  NA,   0,   0,   NA,	 0,  0)
 };
 
 #endif	/* __MUX_C__ */
diff -Nru a/include/asm-arm/arch-omap/omap-h2.h b/include/asm-arm/arch-omap/omap-h2.h
--- a/include/asm-arm/arch-omap/omap-h2.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,35 +0,0 @@
-/*
- * linux/include/asm-arm/arch-omap/omap-h2.h
- *
- * Hardware definitions for TI OMAP1610 H2 board.
- *
- * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.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.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * 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.
- */
-
-#ifndef __ASM_ARCH_OMAP_H2_H
-#define __ASM_ARCH_OMAP_H2_H
-
-/* Placeholder for H2 specific defines */
-
-#endif /*  __ASM_ARCH_OMAP_H2_H */
-
diff -Nru a/include/asm-arm/arch-omap/omap-innovator.h b/include/asm-arm/arch-omap/omap-innovator.h
--- a/include/asm-arm/arch-omap/omap-innovator.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,214 +0,0 @@
-/*
- * linux/include/asm-arm/arch-omap/omap-innovator.h
- *
- * Copyright (C) 2001 RidgeRun, 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.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * 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.
- */
-#ifndef __ASM_ARCH_OMAP_INNOVATOR_H
-#define __ASM_ARCH_OMAP_INNOVATOR_H
-
-#if defined (CONFIG_ARCH_OMAP1510)
-
-/*
- * ---------------------------------------------------------------------------
- *  OMAP-1510 FPGA
- * ---------------------------------------------------------------------------
- */
-#define OMAP1510P1_FPGA_BASE			0xE8000000	/* Virtual */
-#define OMAP1510P1_FPGA_SIZE			SZ_4K
-#define OMAP1510P1_FPGA_START			0x08000000	/* Physical */
-
-/* Revision */
-#define OMAP1510P1_FPGA_REV_LOW			(OMAP1510P1_FPGA_BASE + 0x0)
-#define OMAP1510P1_FPGA_REV_HIGH		(OMAP1510P1_FPGA_BASE + 0x1)
-
-#define OMAP1510P1_FPGA_LCD_PANEL_CONTROL	(OMAP1510P1_FPGA_BASE + 0x2)
-#define OMAP1510P1_FPGA_LED_DIGIT		(OMAP1510P1_FPGA_BASE + 0x3)
-#define INNOVATOR_FPGA_HID_SPI			(OMAP1510P1_FPGA_BASE + 0x4)
-#define OMAP1510P1_FPGA_POWER			(OMAP1510P1_FPGA_BASE + 0x5)
-
-/* Interrupt status */
-#define OMAP1510P1_FPGA_ISR_LO			(OMAP1510P1_FPGA_BASE + 0x6)
-#define OMAP1510P1_FPGA_ISR_HI			(OMAP1510P1_FPGA_BASE + 0x7)
-
-/* Interrupt mask */
-#define OMAP1510P1_FPGA_IMR_LO			(OMAP1510P1_FPGA_BASE + 0x8)
-#define OMAP1510P1_FPGA_IMR_HI			(OMAP1510P1_FPGA_BASE + 0x9)
-
-/* Reset registers */
-#define OMAP1510P1_FPGA_HOST_RESET		(OMAP1510P1_FPGA_BASE + 0xa)
-#define OMAP1510P1_FPGA_RST			(OMAP1510P1_FPGA_BASE + 0xb)
-
-#define OMAP1510P1_FPGA_AUDIO			(OMAP1510P1_FPGA_BASE + 0xc)
-#define OMAP1510P1_FPGA_DIP			(OMAP1510P1_FPGA_BASE + 0xe)
-#define OMAP1510P1_FPGA_FPGA_IO			(OMAP1510P1_FPGA_BASE + 0xf)
-#define OMAP1510P1_FPGA_UART1			(OMAP1510P1_FPGA_BASE + 0x14)
-#define OMAP1510P1_FPGA_UART2			(OMAP1510P1_FPGA_BASE + 0x15)
-#define OMAP1510P1_FPGA_OMAP1510_STATUS		(OMAP1510P1_FPGA_BASE + 0x16)
-#define OMAP1510P1_FPGA_BOARD_REV		(OMAP1510P1_FPGA_BASE + 0x18)
-#define OMAP1510P1_PPT_DATA			(OMAP1510P1_FPGA_BASE + 0x100)
-#define OMAP1510P1_PPT_STATUS			(OMAP1510P1_FPGA_BASE + 0x101)
-#define OMAP1510P1_PPT_CONTROL			(OMAP1510P1_FPGA_BASE + 0x102)
-
-#define OMAP1510P1_FPGA_TOUCHSCREEN		(OMAP1510P1_FPGA_BASE + 0x204)
-
-#define INNOVATOR_FPGA_INFO			(OMAP1510P1_FPGA_BASE + 0x205)
-#define INNOVATOR_FPGA_LCD_BRIGHT_LO		(OMAP1510P1_FPGA_BASE + 0x206)
-#define INNOVATOR_FPGA_LCD_BRIGHT_HI		(OMAP1510P1_FPGA_BASE + 0x207)
-#define INNOVATOR_FPGA_LED_GRN_LO		(OMAP1510P1_FPGA_BASE + 0x208)
-#define INNOVATOR_FPGA_LED_GRN_HI		(OMAP1510P1_FPGA_BASE + 0x209)
-#define INNOVATOR_FPGA_LED_RED_LO		(OMAP1510P1_FPGA_BASE + 0x20a)
-#define INNOVATOR_FPGA_LED_RED_HI		(OMAP1510P1_FPGA_BASE + 0x20b)
-#define INNOVATOR_FPGA_CAM_USB_CONTROL		(OMAP1510P1_FPGA_BASE + 0x20c)
-#define INNOVATOR_FPGA_EXP_CONTROL		(OMAP1510P1_FPGA_BASE + 0x20d)
-#define INNOVATOR_FPGA_ISR2			(OMAP1510P1_FPGA_BASE + 0x20e)
-#define INNOVATOR_FPGA_IMR2			(OMAP1510P1_FPGA_BASE + 0x210)
-
-#define OMAP1510P1_FPGA_ETHR_START		(OMAP1510P1_FPGA_START + 0x300)
-#define OMAP1510P1_FPGA_ETHR_BASE		(OMAP1510P1_FPGA_BASE + 0x300)
-
-/*
- * Power up Giga UART driver, turn on HID clock.
- * Turn off BT power, since we're not using it and it
- * draws power.
- */
-#define OMAP1510P1_FPGA_RESET_VALUE		0x42
-
-#define OMAP1510P1_FPGA_PCR_IF_PD0		(1 << 7)
-#define OMAP1510P1_FPGA_PCR_COM2_EN		(1 << 6)
-#define OMAP1510P1_FPGA_PCR_COM1_EN		(1 << 5)
-#define OMAP1510P1_FPGA_PCR_EXP_PD0		(1 << 4)
-#define OMAP1510P1_FPGA_PCR_EXP_PD1		(1 << 3)
-#define OMAP1510P1_FPGA_PCR_48MHZ_CLK		(1 << 2)
-#define OMAP1510P1_FPGA_PCR_4MHZ_CLK		(1 << 1)
-#define OMAP1510P1_FPGA_PCR_RSRVD_BIT0		(1 << 0)
-
-/*
- * Innovator/OMAP1510 FPGA HID register bit definitions
- */
-#define FPGA_HID_SCLK	(1<<0)	/* output */
-#define FPGA_HID_MOSI	(1<<1)	/* output */
-#define FPGA_HID_nSS	(1<<2)	/* output 0/1 chip idle/select */
-#define FPGA_HID_nHSUS	(1<<3)	/* output 0/1 host active/suspended */
-#define FPGA_HID_MISO	(1<<4)	/* input */
-#define FPGA_HID_ATN	(1<<5)	/* input  0/1 chip idle/ATN */
-#define FPGA_HID_rsrvd	(1<<6)
-#define FPGA_HID_RESETn (1<<7)	/* output - 0/1 USAR reset/run */
-
-#ifndef OMAP_SDRAM_DEVICE
-#define OMAP_SDRAM_DEVICE			D256M_1X16_4B
-#endif
-
-#define OMAP1510P1_IMIF_PRI_VALUE		0x00
-#define OMAP1510P1_EMIFS_PRI_VALUE		0x00
-#define OMAP1510P1_EMIFF_PRI_VALUE		0x00
-
-/*
- * These definitions define an area of FLASH set aside
- * for the use of MTD/JFFS2. This is the area of flash
- * that a JFFS2 filesystem will reside which is mounted
- * at boot with the "root=/dev/mtdblock/0 rw"
- * command line option. The flash address used here must
- * fall within the legal range defined by rrload for storing
- * the filesystem component. This address will be sufficiently
- * deep into the overall flash range to avoid the other
- * components also stored in flash such as the bootloader,
- * the bootloader params, and the kernel.
- * The SW2 settings for the map below are:
- * 1 off, 2 off, 3 on, 4 off.
- */
-
-/* Intel flash_0, partitioned as expected by rrload */
-#define OMAP_FLASH_0_BASE	0xD8000000
-#define OMAP_FLASH_0_START	0x00000000
-#define OMAP_FLASH_0_SIZE	SZ_16M
-
-/* Intel flash_1, used for cramfs or other flash file systems */
-#define OMAP_FLASH_1_BASE	0xD9000000
-#define OMAP_FLASH_1_START	0x01000000
-#define OMAP_FLASH_1_SIZE	SZ_16M
-
-/* The FPGA IRQ is cascaded through GPIO_13 */
-#define INT_FPGA		(IH_GPIO_BASE + 13)
-
-/* IRQ Numbers for interrupts muxed through the FPGA */
-#define IH_FPGA_BASE		IH_BOARD_BASE
-#define INT_FPGA_ATN		(IH_FPGA_BASE + 0)
-#define INT_FPGA_ACK		(IH_FPGA_BASE + 1)
-#define INT_FPGA2		(IH_FPGA_BASE + 2)
-#define INT_FPGA3		(IH_FPGA_BASE + 3)
-#define INT_FPGA4		(IH_FPGA_BASE + 4)
-#define INT_FPGA5		(IH_FPGA_BASE + 5)
-#define INT_FPGA6		(IH_FPGA_BASE + 6)
-#define INT_FPGA7		(IH_FPGA_BASE + 7)
-#define INT_FPGA8		(IH_FPGA_BASE + 8)
-#define INT_FPGA9		(IH_FPGA_BASE + 9)
-#define INT_FPGA10		(IH_FPGA_BASE + 10)
-#define INT_FPGA11		(IH_FPGA_BASE + 11)
-#define INT_FPGA12		(IH_FPGA_BASE + 12)
-#define INT_ETHER		(IH_FPGA_BASE + 13)
-#define INT_FPGAUART1		(IH_FPGA_BASE + 14)
-#define INT_FPGAUART2		(IH_FPGA_BASE + 15)
-#define INT_FPGA_TS		(IH_FPGA_BASE + 16)
-#define INT_FPGA17		(IH_FPGA_BASE + 17)
-#define INT_FPGA_CAM		(IH_FPGA_BASE + 18)
-#define INT_FPGA_RTC_A		(IH_FPGA_BASE + 19)
-#define INT_FPGA_RTC_B		(IH_FPGA_BASE + 20)
-#define INT_FPGA_CD		(IH_FPGA_BASE + 21)
-#define INT_FPGA22		(IH_FPGA_BASE + 22)
-#define INT_FPGA23		(IH_FPGA_BASE + 23)
-
-#define NR_FPGA_IRQS		 24
-
-#define MAXIRQNUM		(IH_FPGA_BASE + NR_FPGA_IRQS - 1)
-#define MAXFIQNUM		MAXIRQNUM
-#define MAXSWINUM		MAXIRQNUM
-
-#define NR_IRQS			256
-
-#ifndef __ASSEMBLY__
-void fpga_write(unsigned char val, int reg);
-unsigned char fpga_read(int reg);
-#endif
-
-#elif defined (CONFIG_ARCH_OMAP1610)
-
-/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
-#define OMAP1610_ETHR_BASE		0xE8000000
-#define OMAP1610_ETHR_SIZE		SZ_4K
-#define OMAP1610_ETHR_START		0x04000000
-
-/* Intel STRATA NOR flash at CS3 */
-#define OMAP1610_NOR_FLASH_BASE		0xD8000000
-#define OMAP1610_NOR_FLASH_SIZE		SZ_32M
-#define OMAP1610_NOR_FLASH_START	0x0C000000
-
-#define MAXIRQNUM			(IH_BOARD_BASE)
-#define MAXFIQNUM			MAXIRQNUM
-#define MAXSWINUM			MAXIRQNUM
-
-#define NR_IRQS				(MAXIRQNUM + 1)
-
-#else
-#error "Only OMAP1510 and OMAP1610 Innovator supported!"
-#endif
-#endif
diff -Nru a/include/asm-arm/arch-omap/omap-perseus2.h b/include/asm-arm/arch-omap/omap-perseus2.h
--- a/include/asm-arm/arch-omap/omap-perseus2.h	Tue Jun 15 22:20:37 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,152 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-omap/omap-perseus2.h
- *
- *  Copyright 2003 by Texas Instruments Incorporated
- *    OMAP730 / P2-sample additions
- *    Author: Jean Pihet
- *
- * Copyright (C) 2001 RidgeRun, Inc. (http://www.ridgerun.com)
- * Author: RidgeRun, 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.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * 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.
- */
-#ifndef __ASM_ARCH_OMAP_P2SAMPLE_H
-#define __ASM_ARCH_OMAP_P2SAMPLE_H
-
-#if defined(CONFIG_ARCH_OMAP730) && defined (CONFIG_MACH_OMAP_PERSEUS2)
-
-/*
- * NOTE:  ALL DEFINITIONS IN THIS FILE NEED TO BE PREFIXED BY IDENTIFIER
- *	  P2SAMPLE_ since they are specific to the EVM and not the chip.
- */
-
-/* ---------------------------------------------------------------------------
- *  OMAP730 Debug Board FPGA
- * ---------------------------------------------------------------------------
- *
- */
-
-/* maps in the FPGA registers and the ETHR registers */
-#define OMAP730_FPGA_BASE		0xE8000000	/* VA */
-#define OMAP730_FPGA_SIZE		SZ_4K		/* SIZE */
-#define OMAP730_FPGA_START		0x04000000	/* PA */
-
-#define OMAP730_FPGA_ETHR_START		OMAP730_FPGA_START
-#define OMAP730_FPGA_ETHR_BASE		OMAP730_FPGA_BASE
-#define OMAP730_FPGA_FPGA_REV		(OMAP730_FPGA_BASE + 0x10)	/* FPGA Revision */
-#define OMAP730_FPGA_BOARD_REV		(OMAP730_FPGA_BASE + 0x12)	/* Board Revision */
-#define OMAP730_FPGA_GPIO		(OMAP730_FPGA_BASE + 0x14)	/* GPIO outputs */
-#define OMAP730_FPGA_LEDS		(OMAP730_FPGA_BASE + 0x16)	/* LEDs outputs */
-#define OMAP730_FPGA_MISC_INPUTS	(OMAP730_FPGA_BASE + 0x18)	/* Misc inputs */
-#define OMAP730_FPGA_LAN_STATUS		(OMAP730_FPGA_BASE + 0x1A)	/* LAN Status line */
-#define OMAP730_FPGA_LAN_RESET		(OMAP730_FPGA_BASE + 0x1C)	/* LAN Reset line */
-
-// LEDs definition on debug board (16 LEDs)
-#define OMAP730_FPGA_LED_CLAIMRELEASE	(1 << 15)
-#define OMAP730_FPGA_LED_STARTSTOP	(1 << 14)
-#define OMAP730_FPGA_LED_HALTED		(1 << 13)
-#define OMAP730_FPGA_LED_IDLE		(1 << 12)
-#define OMAP730_FPGA_LED_TIMER		(1 << 11)
-// cpu0 load-meter LEDs
-#define OMAP730_FPGA_LOAD_METER		(1 << 0)	// A bit of fun on our board ...
-#define OMAP730_FPGA_LOAD_METER_SIZE	11
-#define OMAP730_FPGA_LOAD_METER_MASK	((1 << OMAP730_FPGA_LOAD_METER_SIZE) - 1)
-
-#ifndef OMAP_SDRAM_DEVICE
-#define OMAP_SDRAM_DEVICE		D256M_1X16_4B
-#endif
-
-
-/*
- * These definitions define an area of FLASH set aside
- * for the use of MTD/JFFS2. This is the area of flash
- * that a JFFS2 filesystem will reside which is mounted
- * at boot with the "root=/dev/mtdblock/0 rw"
- * command line option.
- */
-
-/* Intel flash_0, partitioned as expected by rrload */
-#define OMAP_FLASH_0_BASE	0xD8000000	/* VA */
-#define OMAP_FLASH_0_START	0x00000000	/* PA */
-#define OMAP_FLASH_0_SIZE	SZ_32M
-
-/* 2.9.6 Traffic Controller Memory Interface Registers */
-#define OMAP_FLASH_CFG_0		0xfffecc10
-#define OMAP_FLASH_ACFG_0		0xfffecc50
-
-#define OMAP_FLASH_CFG_1		0xfffecc14
-#define OMAP_FLASH_ACFG_1		0xfffecc54
-
-/*
- * Configuration Registers
- */
-#define PERSEUS2_CONFIG_BASE	   0xfffe1000
-#define PERSEUS2_IO_CONF_0	   0xfffe1070
-#define PERSEUS2_IO_CONF_1	   0xfffe1074
-#define PERSEUS2_IO_CONF_2	   0xfffe1078
-#define PERSEUS2_IO_CONF_3	   0xfffe107c
-#define PERSEUS2_IO_CONF_4	   0xfffe1080
-#define PERSEUS2_IO_CONF_5	   0xfffe1084
-#define PERSEUS2_IO_CONF_6	   0xfffe1088
-#define PERSEUS2_IO_CONF_7	   0xfffe108c
-#define PERSEUS2_IO_CONF_8	   0xfffe1090
-#define PERSEUS2_IO_CONF_9	   0xfffe1094
-#define PERSEUS2_IO_CONF_10	   0xfffe1098
-#define PERSEUS2_IO_CONF_11	   0xfffe109c
-#define PERSEUS2_IO_CONF_12	   0xfffe10a0
-#define PERSEUS2_IO_CONF_13	   0xfffe10a4
-
-#define PERSEUS2_MODE_1		   0xfffe1010
-#define PERSEUS2_MODE_2		   0xfffe1014
-
-/* CSMI specials: in terms of base + offset */
-#define PERSEUS2_MODE2_OFFSET	   0x14
-
-/* DSP control: ICR registers */
-#define ICR_BASE		0xfffbb800
-/* M_CTL */
-#define DSP_M_CTL		((volatile __u16 *)0xfffbb804)
-/* DSP control: MMU registers */
-#define DSP_MMU_BASE		((volatile __u16 *)0xfffed200)
-
-/* The Ethernet Controller IRQ is cascaded to MPU_EXT_nIRQ througb the FPGA */
-#define INT_ETHER		INT_730_MPU_EXT_NIRQ
-
-#define MAXIRQNUM		IH_BOARD_BASE
-#define MAXFIQNUM		MAXIRQNUM
-#define MAXSWINUM		MAXIRQNUM
-
-#define NR_IRQS			(MAXIRQNUM + 1)
-
-#ifndef __ASSEMBLY__
-void fpga_write(unsigned char val, int reg);
-unsigned char fpga_read(int reg);
-#endif
-
-/* PCC_UPLD control register: OMAP730 */
-#define PCC_UPLD_CTRL_REG_BASE	(0xfffe0900)
-#define PCC_UPLD_CTRL_REG	(volatile __u16 *)(PCC_UPLD_CTRL_REG_BASE + 0x00)
-
-#else
-#error "Only OMAP730 Perseus2 supported!"
-#endif
-
-#endif
diff -Nru a/include/asm-arm/arch-omap/omap1610.h b/include/asm-arm/arch-omap/omap1610.h
--- a/include/asm-arm/arch-omap/omap1610.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-arm/arch-omap/omap1610.h	Tue Jun 15 22:20:36 2004
@@ -48,20 +48,60 @@
 #define OMAP1610_DSPREG_SIZE	SZ_128K
 #define OMAP1610_DSPREG_START	0xE1000000
 
-#define OMAP_IH2_0_BASE          0xfffe0000
-#define OMAP_IH2_1_BASE          0xfffe0100
-#define OMAP_IH2_2_BASE          0xfffe0200
-#define OMAP_IH2_3_BASE          0xfffe0300
+/*
+ * ---------------------------------------------------------------------------
+ * Interrupts
+ * ---------------------------------------------------------------------------
+ */
+#define OMAP_IH2_0_BASE		(0xfffe0000)
+#define OMAP_IH2_1_BASE		(0xfffe0100)
+#define OMAP_IH2_2_BASE		(0xfffe0200)
+#define OMAP_IH2_3_BASE		(0xfffe0300)
+
+#define OMAP_IH2_0_ITR		(OMAP_IH2_0_BASE + 0x00)
+#define OMAP_IH2_0_MIR		(OMAP_IH2_0_BASE + 0x04)
+#define OMAP_IH2_0_SIR_IRQ	(OMAP_IH2_0_BASE + 0x10)
+#define OMAP_IH2_0_SIR_FIQ	(OMAP_IH2_0_BASE + 0x14)
+#define OMAP_IH2_0_CONTROL	(OMAP_IH2_0_BASE + 0x18)
+#define OMAP_IH2_0_ILR0		(OMAP_IH2_0_BASE + 0x1c)
+#define OMAP_IH2_0_ISR		(OMAP_IH2_0_BASE + 0x9c)
+
+#define OMAP_IH2_1_ITR		(OMAP_IH2_1_BASE + 0x00)
+#define OMAP_IH2_1_MIR		(OMAP_IH2_1_BASE + 0x04)
+#define OMAP_IH2_1_SIR_IRQ	(OMAP_IH2_1_BASE + 0x10)
+#define OMAP_IH2_1_SIR_FIQ	(OMAP_IH2_1_BASE + 0x14)
+#define OMAP_IH2_1_CONTROL	(OMAP_IH2_1_BASE + 0x18)
+#define OMAP_IH2_1_ILR1		(OMAP_IH2_1_BASE + 0x1c)
+#define OMAP_IH2_1_ISR		(OMAP_IH2_1_BASE + 0x9c)
+
+#define OMAP_IH2_2_ITR		(OMAP_IH2_2_BASE + 0x00)
+#define OMAP_IH2_2_MIR		(OMAP_IH2_2_BASE + 0x04)
+#define OMAP_IH2_2_SIR_IRQ	(OMAP_IH2_2_BASE + 0x10)
+#define OMAP_IH2_2_SIR_FIQ	(OMAP_IH2_2_BASE + 0x14)
+#define OMAP_IH2_2_CONTROL	(OMAP_IH2_2_BASE + 0x18)
+#define OMAP_IH2_2_ILR2		(OMAP_IH2_2_BASE + 0x1c)
+#define OMAP_IH2_2_ISR		(OMAP_IH2_2_BASE + 0x9c)
+
+#define OMAP_IH2_3_ITR		(OMAP_IH2_3_BASE + 0x00)
+#define OMAP_IH2_3_MIR		(OMAP_IH2_3_BASE + 0x04)
+#define OMAP_IH2_3_SIR_IRQ	(OMAP_IH2_3_BASE + 0x10)
+#define OMAP_IH2_3_SIR_FIQ	(OMAP_IH2_3_BASE + 0x14)
+#define OMAP_IH2_3_CONTROL	(OMAP_IH2_3_BASE + 0x18)
+#define OMAP_IH2_3_ILR3		(OMAP_IH2_3_BASE + 0x1c)
+#define OMAP_IH2_3_ISR		(OMAP_IH2_3_BASE + 0x9c)
 
 /*
  * ----------------------------------------------------------------------------
- * System control registers
+ * Clocks
  * ----------------------------------------------------------------------------
  */
+#define OMAP1610_ARM_IDLECT3	(CLKGEN_REG_BASE + 0x24)
 
-#define OMAP1610_RESET_CONTROL		0xfffe1140
-#define OMAP1610_ARM_IDLECT3		(CLKGEN_RESET_BASE + 0x24)
-#define OMAP1610_CONF_VOLTAGE_CTRL_0	0xfffe1060
+/*
+ * ----------------------------------------------------------------------------
+ * Pin configuration registers
+ * ----------------------------------------------------------------------------
+ */
 #define OMAP1610_CONF_VOLTAGE_VDDSHV6	(1 << 8)
 #define OMAP1610_CONF_VOLTAGE_VDDSHV7	(1 << 9)
 #define OMAP1610_CONF_VOLTAGE_VDDSHV8	(1 << 10)
@@ -73,14 +113,8 @@
  * TIPB bus interface
  * ---------------------------------------------------------------------------
  */
-
-#define OMAP1610_TIPB_SWITCH		0xfffbc800
-#define OMAP1610_TIPB_BRIDGE_INT	0xfffeca00	/* Private TIPB_CNTL */
-#define OMAP1610_PRIVATE_MPU_TIPB_CNTL	0xfffeca08
-#define OMAP1610_TIPB_BRIDGE_EXT	0xfffed300	/* Public (Shared) TIPB_CNTL */
-#define OMAP1610_PUBLIC_MPU_TIPB_CNTL	0xfffed308
-#define OMAP1610_TIPB_SWITCH_CFG	OMAP_TIPB_SWITCH
-#define OMAP1610_MMCSD2_SSW_MPU_CONF	(TIPB_SWITCH_CFG + 0x160)
+#define TIPB_SWITCH_BASE		 (0xfffbc800)
+#define OMAP1610_MMCSD2_SSW_MPU_CONF	(TIPB_SWITCH_BASE + 0x160)
 
 #endif /*  __ASM_ARCH_OMAP1610_H */
 
diff -Nru a/include/asm-arm/arch-omap/omap5912.h b/include/asm-arm/arch-omap/omap5912.h
--- a/include/asm-arm/arch-omap/omap5912.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/arch-omap/omap5912.h	Tue Jun 15 22:20:37 2004
@@ -50,12 +50,54 @@
 #define OMAP5912_DSPREG_START	0xE1000000
 
 /*
+ * ---------------------------------------------------------------------------
+ * Interrupts
+ * ---------------------------------------------------------------------------
+ */
+#define OMAP_IH2_0_BASE		(0xfffe0000)
+#define OMAP_IH2_1_BASE		(0xfffe0100)
+#define OMAP_IH2_2_BASE		(0xfffe0200)
+#define OMAP_IH2_3_BASE		(0xfffe0300)
+
+#define OMAP_IH2_0_ITR		(OMAP_IH2_0_BASE + 0x00)
+#define OMAP_IH2_0_MIR		(OMAP_IH2_0_BASE + 0x04)
+#define OMAP_IH2_0_SIR_IRQ	(OMAP_IH2_0_BASE + 0x10)
+#define OMAP_IH2_0_SIR_FIQ	(OMAP_IH2_0_BASE + 0x14)
+#define OMAP_IH2_0_CONTROL	(OMAP_IH2_0_BASE + 0x18)
+#define OMAP_IH2_0_ILR0		(OMAP_IH2_0_BASE + 0x1c)
+#define OMAP_IH2_0_ISR		(OMAP_IH2_0_BASE + 0x9c)
+
+#define OMAP_IH2_1_ITR		(OMAP_IH2_1_BASE + 0x00)
+#define OMAP_IH2_1_MIR		(OMAP_IH2_1_BASE + 0x04)
+#define OMAP_IH2_1_SIR_IRQ	(OMAP_IH2_1_BASE + 0x10)
+#define OMAP_IH2_1_SIR_FIQ	(OMAP_IH2_1_BASE + 0x14)
+#define OMAP_IH2_1_CONTROL	(OMAP_IH2_1_BASE + 0x18)
+#define OMAP_IH2_1_ILR1		(OMAP_IH2_1_BASE + 0x1c)
+#define OMAP_IH2_1_ISR		(OMAP_IH2_1_BASE + 0x9c)
+
+#define OMAP_IH2_2_ITR		(OMAP_IH2_2_BASE + 0x00)
+#define OMAP_IH2_2_MIR		(OMAP_IH2_2_BASE + 0x04)
+#define OMAP_IH2_2_SIR_IRQ	(OMAP_IH2_2_BASE + 0x10)
+#define OMAP_IH2_2_SIR_FIQ	(OMAP_IH2_2_BASE + 0x14)
+#define OMAP_IH2_2_CONTROL	(OMAP_IH2_2_BASE + 0x18)
+#define OMAP_IH2_2_ILR2		(OMAP_IH2_2_BASE + 0x1c)
+#define OMAP_IH2_2_ISR		(OMAP_IH2_2_BASE + 0x9c)
+
+#define OMAP_IH2_3_ITR		(OMAP_IH2_3_BASE + 0x00)
+#define OMAP_IH2_3_MIR		(OMAP_IH2_3_BASE + 0x04)
+#define OMAP_IH2_3_SIR_IRQ	(OMAP_IH2_3_BASE + 0x10)
+#define OMAP_IH2_3_SIR_FIQ	(OMAP_IH2_3_BASE + 0x14)
+#define OMAP_IH2_3_CONTROL	(OMAP_IH2_3_BASE + 0x18)
+#define OMAP_IH2_3_ILR3		(OMAP_IH2_3_BASE + 0x1c)
+#define OMAP_IH2_3_ISR		(OMAP_IH2_3_BASE + 0x9c)
+
+/*
  * ----------------------------------------------------------------------------
  * System control registers
  * ----------------------------------------------------------------------------
  */
 
-#define OMAP5912_ARM_IDLECT3		(CLKGEN_RESET_BASE + 0x24)
+#define OMAP5912_ARM_IDLECT3	(CLKGEN_REG_BASE + 0x24)
 
 #endif /*  __ASM_ARCH_OMAP5912_H */
 
diff -Nru a/include/asm-arm/arch-omap/omap730.h b/include/asm-arm/arch-omap/omap730.h
--- a/include/asm-arm/arch-omap/omap730.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-arm/arch-omap/omap730.h	Tue Jun 15 22:21:05 2004
@@ -105,8 +105,8 @@
  * OMAP730 PCC_UPLD configuration registers
  * ----------------------------------------------------------------------------
  */
-#define OMAP730_PCC_UPLD_CTRL_REG_BASE	(0xfffe0900)
-#define OMAP730_PCC_UPLD_CTRL_REG	(OMAP730_PCC_UPLD_CTRL_REG_BASE + 0x00)
+#define OMAP730_PCC_UPLD_CTRL_BASE	(0xfffe0900)
+#define OMAP730_PCC_UPLD_CTRL		(OMAP730_PCC_UPLD_CTRL_BASE + 0x00)
 
 #endif /*  __ASM_ARCH_OMAP730_H */
 
diff -Nru a/include/asm-arm/arch-omap/time.h b/include/asm-arm/arch-omap/time.h
--- a/include/asm-arm/arch-omap/time.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-arm/arch-omap/time.h	Tue Jun 15 22:20:41 2004
@@ -52,7 +52,7 @@
 
 #define mputimer_base(n) \
     ((volatile mputimer_regs_t*)IO_ADDRESS(OMAP_MPUTIMER_BASE + \
-				 (n)*OMAP_MPUTIMER_OFF))
+				 (n)*OMAP_MPUTIMER_OFFSET))
 
 static inline unsigned long timer32k_read(int reg) {
 	unsigned long val;
diff -Nru a/include/asm-arm/arch-omap/uncompress.h b/include/asm-arm/arch-omap/uncompress.h
--- a/include/asm-arm/arch-omap/uncompress.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-arm/arch-omap/uncompress.h	Tue Jun 15 22:20:44 2004
@@ -20,13 +20,12 @@
 #include <linux/config.h>
 #include <linux/types.h>
 #include <linux/serial_reg.h>
-#include <asm/mach-types.h>
 #include <asm/hardware.h>
 #include <asm/arch/serial.h>
 
 #define UART_OMAP_MDR1		0x08	/* mode definition register */
-
 #define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0)
+#define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK
 
 static void
 puts(const char *s)
@@ -34,17 +33,27 @@
 	volatile u8 * uart = 0;
 	int shift = 0;
 
+#ifdef	CONFIG_OMAP_LL_DEBUG_UART3
+	uart = (volatile u8 *)(OMAP_UART3_BASE);
+#elif	CONFIG_OMAP_LL_DEBUG_UART2
+	uart = (volatile u8 *)(OMAP_UART2_BASE);
+#else
+	uart = (volatile u8 *)(OMAP_UART1_BASE);
+#endif
+
 	/* Determine which serial port to use */
 	do {
-		if (machine_is_omap_innovator() || machine_is_omap_osk()) {
+		/* MMU is not on, so cpu_is_omapXXXX() won't work here */
+		unsigned int omap_id = omap_get_id();
+
+		if (omap_id == OMAP_ID_1510 || omap_id == OMAP_ID_1610 ||
+		    omap_id == OMAP_ID_1710 || omap_id == OMAP_ID_5912) {
 			shift = 2;
-			uart = (volatile u8 *)(OMAP_UART1_BASE);
-		} else if (machine_is_omap_perseus2()) {
+		} else if (omap_id == OMAP_ID_730) {
 			shift = 0;
-			uart = (volatile u8 *)(OMAP_UART1_BASE);
 		} else {
-			/* Assume nothing for unknown machines.
-			 * Add an entry for your machine to select
+			/* Assume nothing for unknown OMAP processors.
+			 * Add an entry for your OMAP type to select
 			 * the default serial console here. If the
 			 * serial port is enabled, we'll use it to
 			 * display status messages. Else we'll be
diff -Nru a/include/asm-arm/arch-pxa/dma.h b/include/asm-arm/arch-pxa/dma.h
--- a/include/asm-arm/arch-pxa/dma.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-arm/arch-pxa/dma.h	Tue Jun 15 22:21:03 2004
@@ -29,15 +29,33 @@
 	volatile u32 dcmd;	/* DCMD value for the current transfer */
 } pxa_dma_desc;
 
-/*
- * DMA registration
- */
+#if defined(CONFIG_PXA27x)
+
+#define PXA_DMA_CHANNELS	32
+#define PXA_DMA_NBCH(prio)	((prio == DMA_PRIO_LOW) ? 16 : 8)
+
+typedef enum {
+	DMA_PRIO_HIGH = 0,
+	DMA_PRIO_MEDIUM = 8,
+	DMA_PRIO_LOW = 16
+} pxa_dma_prio;
+
+#elif defined(CONFIG_PXA25x)
+
+#define PXA_DMA_CHANNELS	16
+#define PXA_DMA_NBCH(prio)	((prio == DMA_PRIO_LOW) ? 8 : 4)
 
 typedef enum {
 	DMA_PRIO_HIGH = 0,
 	DMA_PRIO_MEDIUM = 4,
 	DMA_PRIO_LOW = 8
 } pxa_dma_prio;
+
+#endif
+
+/*
+ * DMA registration
+ */
 
 int pxa_request_dma (char *name,
 			 pxa_dma_prio prio,
diff -Nru a/include/asm-arm/arch-pxa/hardware.h b/include/asm-arm/arch-pxa/hardware.h
--- a/include/asm-arm/arch-pxa/hardware.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-arm/arch-pxa/hardware.h	Tue Jun 15 22:20:36 2004
@@ -13,18 +13,6 @@
 #ifndef __ASM_ARCH_HARDWARE_H
 #define __ASM_ARCH_HARDWARE_H
 
-#include <asm/mach-types.h>
-
-
-/*
- * These are statically mapped PCMCIA IO space for designs using it as a
- * generic IO bus, typically with ISA parts, hardwired IDE interfaces, etc.
- * The actual PCMCIA code is mapping required IO region at run time.
- */
-#define PCMCIA_IO_0_BASE	0xf6000000
-#define PCMCIA_IO_1_BASE	0xf7000000
-
-
 /*
  * We requires absolute addresses.
  */
@@ -38,15 +26,21 @@
 #define UNCACHED_ADDR		UNCACHED_PHYS_0
 
 /*
- * Intel PXA internal I/O mappings:
+ * Intel PXA2xx internal register mapping:
+ *
+ * 0x40000000 - 0x41ffffff <--> 0xf2000000 - 0xf3ffffff
+ * 0x44000000 - 0x45ffffff <--> 0xf4000000 - 0xf5ffffff
+ * 0x48000000 - 0x49ffffff <--> 0xf6000000 - 0xf7ffffff
+ * 0x4c000000 - 0x4dffffff <--> 0xf8000000 - 0xf9ffffff
+ * 0x50000000 - 0x51ffffff <--> 0xfa000000 - 0xfbffffff
+ * 0x54000000 - 0x55ffffff <--> 0xfc000000 - 0xfdffffff
+ * 0x58000000 - 0x59ffffff <--> 0xfe000000 - 0xffffffff
  *
- * 0x40000000 - 0x41ffffff <--> 0xf8000000 - 0xf9ffffff
- * 0x44000000 - 0x45ffffff <--> 0xfa000000 - 0xfbffffff
- * 0x48000000 - 0x49ffffff <--> 0xfc000000 - 0xfdffffff
+ * Note that not all PXA2xx chips implement all those addresses, and the
+ * kernel only maps the minimum needed range of this mapping.
  */
-
-#define io_p2v(x)	( ((x) | 0xbe000000) ^ (~((x) >> 1) & 0x06000000) )
-#define io_v2p( x )	( ((x) & 0x41ffffff) ^ ( ((x) & 0x06000000) << 1) )
+#define io_p2v(x) (0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1))
+#define io_v2p(x) (0x3c000000 + ((x) & 0x01ffffff) + (((x) & 0x0e000000) << 1))
 
 #ifndef __ASSEMBLY__
 
@@ -89,18 +83,11 @@
 extern void pxa_gpio_mode( int gpio_mode );
 
 /*
- * return current lclk frequency in units of 10kHz
+ * return current memory and LCD clock frequency in units of 10kHz
  */
-extern unsigned int get_lclk_frequency_10khz(void);
+extern unsigned int get_memclk_frequency_10khz(void);
+extern unsigned int get_lcdclk_frequency_10khz(void);
 
 #endif
-
-
-/*
- * Implementation specifics
- */
-
-#include "lubbock.h"
-#include "idp.h"
 
 #endif  /* _ASM_ARCH_HARDWARE_H */
diff -Nru a/include/asm-arm/arch-pxa/ide.h b/include/asm-arm/arch-pxa/ide.h
--- a/include/asm-arm/arch-pxa/ide.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,54 +0,0 @@
-/*
- * linux/include/asm-arm/arch-pxa/ide.h
- *
- * Author:	George Davis
- * Created:	Jan 10, 2002
- * Copyright:	MontaVista Software Inc.
- *
- * 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.
- *
- *
- * Originally based upon linux/include/asm-arm/arch-sa1100/ide.h
- *
- */
-
-#include <asm/irq.h>
-#include <asm/hardware.h>
-#include <asm/mach-types.h>
-
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-	int regincr = 1;
-
-	memset(hw, 0, sizeof(*hw));
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += regincr;
-	}
-
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-
-	if (irq)
-		*irq = 0;
-}
-
-
-/*
- * Register the standard ports for this architecture with the IDE driver.
- */
-static __inline__ void
-ide_init_default_hwifs(void)
-{
-	/* Nothing to declare... */
-}
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	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/arch-pxa/irqs.h	Tue Jun 15 22:20:37 2004
@@ -118,7 +118,8 @@
  */
 #ifdef CONFIG_SA1111
 #define NR_IRQS			(IRQ_S1_BVD1_STSCHG + 1)
-#elif defined(CONFIG_ARCH_LUBBOCK)
+#elif defined(CONFIG_ARCH_LUBBOCK) || \
+      defined(CONFIG_MACH_MAINSTONE)
 #define NR_IRQS			(IRQ_BOARD_END)
 #else
 #define NR_IRQS			(IRQ_BOARD_START)
@@ -137,4 +138,20 @@
 #define LUBBOCK_BB_IRQ		LUBBOCK_IRQ(5)
 #define LUBBOCK_USB_DISC_IRQ	LUBBOCK_IRQ(6)  /* usb disconnect */
 #define LUBBOCK_LAST_IRQ	LUBBOCK_IRQ(6)
+
+#define MAINSTONE_IRQ(x)	(IRQ_BOARD_START + (x))
+#define MAINSTONE_MMC_IRQ	MAINSTONE_IRQ(0)
+#define MAINSTONE_USIM_IRQ	MAINSTONE_IRQ(1)
+#define MAINSTONE_USBC_IRQ	MAINSTONE_IRQ(2)
+#define MAINSTONE_ETHERNET_IRQ	MAINSTONE_IRQ(3)
+#define MAINSTONE_AC97_IRQ	MAINSTONE_IRQ(4)
+#define MAINSTONE_PEN_IRQ	MAINSTONE_IRQ(5)
+#define MAINSTONE_MSINS_IRQ	MAINSTONE_IRQ(6)
+#define MAINSTONE_EXBRD_IRQ	MAINSTONE_IRQ(7)
+#define MAINSTONE_S0_CD_IRQ	MAINSTONE_IRQ(9)
+#define MAINSTONE_S0_STSCHG_IRQ	MAINSTONE_IRQ(10)
+#define MAINSTONE_S0_IRQ	MAINSTONE_IRQ(11)
+#define MAINSTONE_S1_CD_IRQ	MAINSTONE_IRQ(13)
+#define MAINSTONE_S1_STSCHG_IRQ	MAINSTONE_IRQ(14)
+#define MAINSTONE_S1_IRQ	MAINSTONE_IRQ(15)
 
diff -Nru a/include/asm-arm/arch-pxa/keyboard.h b/include/asm-arm/arch-pxa/keyboard.h
--- a/include/asm-arm/arch-pxa/keyboard.h	Tue Jun 15 22:21:03 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,28 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-pxa/keyboard.h
- *
- *  This file contains the architecture specific keyboard definitions
- */
-
-#ifndef _PXA_KEYBOARD_H
-#define _PXA_KEYBOARD_H
-
-#include <asm/mach-types.h>
-#include <asm/hardware.h>
-
-extern struct kbd_ops_struct *kbd_ops;
-
-#define kbd_disable_irq()	do { } while(0);
-#define kbd_enable_irq()	do { } while(0);
-
-extern int sa1111_kbd_init_hw(void);
-
-static inline void kbd_init_hw(void)
-{
-	if (machine_is_lubbock())
-		sa1111_kbd_init_hw();
-}
-
-
-#endif  /* _PXA_KEYBOARD_H */
-
diff -Nru a/include/asm-arm/arch-pxa/lubbock.h b/include/asm-arm/arch-pxa/lubbock.h
--- a/include/asm-arm/arch-pxa/lubbock.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/arch-pxa/lubbock.h	Tue Jun 15 22:20:37 2004
@@ -35,3 +35,6 @@
 #define LUB_IRQ_SET_CLR		__LUB_REG(LUBBOCK_FPGA_PHYS + 0x0d0)
 #define LUB_GP			__LUB_REG(LUBBOCK_FPGA_PHYS + 0x100)
 
+#ifndef __ASSEMBLY__
+extern void lubbock_set_misc_wr(unsigned int mask, unsigned int set);
+#endif
diff -Nru a/include/asm-arm/arch-pxa/mainstone.h b/include/asm-arm/arch-pxa/mainstone.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-pxa/mainstone.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,120 @@
+/*
+ *  linux/include/asm-arm/arch-pxa/mainstone.h
+ *
+ *  Author:	Nicolas Pitre
+ *  Created:	Nov 14, 2002
+ *  Copyright:	MontaVista Software Inc.
+ *
+ * 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.
+ */
+
+#ifndef ASM_ARCH_MAINSTONE_H
+#define ASM_ARCH_MAINSTONE_H
+
+#define MST_ETH_PHYS		PXA_CS4_PHYS
+
+#define MST_FPGA_PHYS		PXA_CS2_PHYS
+#define MST_FPGA_VIRT		(0xf0000000)
+#define MST_P2V(x)		((x) - MST_FPGA_PHYS + MST_FPGA_VIRT)
+#define MST_V2P(x)		((x) - MST_FPGA_VIRT + MST_FPGA_PHYS)
+
+#ifndef __ASSEMBLY__
+# define __MST_REG(x)		(*((volatile unsigned long *)MST_P2V(x)))
+#else
+# define __MST_REG(x)		MST_P2V(x)
+#endif
+
+/* board level registers in the FPGA */
+
+#define MST_LEDDAT1		__MST_REG(0x08000010)
+#define MST_LEDDAT2		__MST_REG(0x08000014)
+#define MST_LEDCTRL		__MST_REG(0x08000040)
+#define MST_GPSWR		__MST_REG(0x08000060)
+#define MST_MSCWR1		__MST_REG(0x08000080)
+#define MST_MSCWR2		__MST_REG(0x08000084)
+#define MST_MSCWR3		__MST_REG(0x08000088)
+#define MST_MSCRD		__MST_REG(0x08000090)
+#define MST_INTMSKENA		__MST_REG(0x080000c0)
+#define MST_INTSETCLR		__MST_REG(0x080000d0)
+#define MST_PCMCIA0		__MST_REG(0x080000e0)
+#define MST_PCMCIA1		__MST_REG(0x080000e4)
+
+#define MST_MSCWR1_CAMERA_ON	(1 << 15)  /* Camera interface power control */
+#define MST_MSCWR1_CAMERA_SEL	(1 << 14)  /* Camera interface mux control */
+#define MST_MSCWR1_LCD_CTL	(1 << 13)  /* General-purpose LCD control */
+#define MST_MSCWR1_MS_ON	(1 << 12)  /* Memory Stick power control */
+#define MST_MSCWR1_MMC_ON	(1 << 11)  /* MultiMediaCard* power control */
+#define MST_MSCWR1_MS_SEL	(1 << 10)  /* SD/MS multiplexer control */
+#define MST_MSCWR1_BB_SEL	(1 << 9)   /* PCMCIA/Baseband multiplexer */
+#define MST_MSCWR1_BT_ON	(1 << 8)   /* Bluetooth UART transceiver */
+#define MST_MSCWR1_BTDTR	(1 << 7)   /* Bluetooth UART DTR */
+
+#define MST_MSCWR1_IRDA_MASK	(3 << 5)   /* IrDA transceiver mode */
+#define MST_MSCWR1_IRDA_FULL	(0 << 5)   /* full distance power */
+#define MST_MSCWR1_IRDA_OFF	(1 << 5)   /* shutdown */
+#define MST_MSCWR1_IRDA_MED	(2 << 5)   /* 2/3 distance power */
+#define MST_MSCWR1_IRDA_LOW	(3 << 5)   /* 1/3 distance power */
+
+#define MST_MSCWR1_IRDA_FIR	(1 << 4)   /* IrDA transceiver SIR/FIR */
+#define MST_MSCWR1_GREENLED	(1 << 3)   /* LED D1 control */
+#define MST_MSCWR1_PDC_CTL	(1 << 2)   /* reserved */
+#define MST_MSCWR1_MTR_ON	(1 << 1)   /* Silent alert motor */
+#define MST_MSCWR1_SYSRESET	(1 << 0)   /* System reset */
+
+#define MST_MSCWR2_USB_OTG_RST	(1 << 6)   /* USB On The Go reset */
+#define MST_MSCWR2_USB_OTG_SEL	(1 << 5)   /* USB On The Go control */
+#define MST_MSCWR2_nUSBC_SC	(1 << 4)   /* USB client soft connect control */
+#define MST_MSCWR2_I2S_SPKROFF	(1 << 3)   /* I2S CODEC amplifier control */
+#define MST_MSCWR2_AC97_SPKROFF	(1 << 2)   /* AC97 CODEC amplifier control */
+#define MST_MSCWR2_RADIO_PWR	(1 << 1)   /* Radio module power control */
+#define MST_MSCWR2_RADIO_WAKE	(1 << 0)   /* Radio module wake-up signal */
+
+#define MST_MSCWR3_GPIO_RESET_EN	(1 << 2) /* Enable GPIO Reset */
+#define MST_MSCWR3_GPIO_RESET		(1 << 1) /* Initiate a GPIO Reset */
+#define MST_MSCWR3_COMMS_SW_RESET	(1 << 0) /* Communications Processor Reset Control */
+
+#define MST_MSCRD_nPENIRQ	(1 << 9)   /* ADI7873* nPENIRQ signal */
+#define MST_MSCRD_nMEMSTK_CD	(1 << 8)   /* Memory Stick detection signal */
+#define MST_MSCRD_nMMC_CD	(1 << 7)   /* SD/MMC card detection signal */
+#define MST_MSCRD_nUSIM_CD	(1 << 6)   /* USIM card detection signal */
+#define MST_MSCRD_USB_CBL	(1 << 5)   /* USB client cable status */
+#define MST_MSCRD_TS_BUSY	(1 << 4)   /* ADI7873 busy */
+#define MST_MSCRD_BTDSR		(1 << 3)   /* Bluetooth UART DSR */
+#define MST_MSCRD_BTRI		(1 << 2)   /* Bluetooth UART Ring Indicator */
+#define MST_MSCRD_BTDCD		(1 << 1)   /* Bluetooth UART DCD */
+#define MST_MSCRD_nMMC_WP	(1 << 0)   /* SD/MMC write-protect status */
+
+#define MST_INT_S1_IRQ		(1 << 15)  /* PCMCIA socket 1 IRQ */
+#define MST_INT_S1_STSCHG	(1 << 14)  /* PCMCIA socket 1 status changed */
+#define MST_INT_S1_CD		(1 << 13)  /* PCMCIA socket 1 card detection */
+#define MST_INT_S0_IRQ		(1 << 11)  /* PCMCIA socket 0 IRQ */
+#define MST_INT_S0_STSCHG	(1 << 10)  /* PCMCIA socket 0 status changed */
+#define MST_INT_S0_CD		(1 << 9)   /* PCMCIA socket 0 card detection */
+#define MST_INT_nEXBRD_INT	(1 << 7)   /* Expansion board IRQ */
+#define MST_INT_MSINS		(1 << 6)   /* Memory Stick* detection */
+#define MST_INT_PENIRQ		(1 << 5)   /* ADI7873* touch-screen IRQ */
+#define MST_INT_AC97		(1 << 4)   /* AC'97 CODEC IRQ */
+#define MST_INT_ETHERNET	(1 << 3)   /* Ethernet controller IRQ */
+#define MST_INT_USBC		(1 << 2)   /* USB client cable detection IRQ */
+#define MST_INT_USIM		(1 << 1)   /* USIM card detection IRQ */
+#define MST_INT_MMC		(1 << 0)   /* MMC/SD card detection IRQ */
+
+#define MST_PCMCIA_nIRQ		(1 << 10)  /* IRQ / ready signal */
+#define MST_PCMCIA_nSPKR_BVD2	(1 << 9)   /* VDD sense / digital speaker */
+#define MST_PCMCIA_nSTSCHG_BVD1	(1 << 8)   /* VDD sense / card status changed */
+#define MST_PCMCIA_nVS2		(1 << 7)   /* VSS voltage sense */
+#define MST_PCMCIA_nVS1		(1 << 6)   /* VSS voltage sense */
+#define MST_PCMCIA_nCD		(1 << 5)   /* Card detection signal */
+#define MST_PCMCIA_RESET	(1 << 4)   /* Card reset signal */
+#define MST_PCMCIA_PWR_MASK	(0x000f)   /* MAX1602 power-supply controls */
+
+#define MST_PCMCIA_PWR_VPP_0    0x0	   /* voltage VPP = 0V */
+#define MST_PCMCIA_PWR_VPP_120  0x2 	   /* voltage VPP = 12V*/
+#define MST_PCMCIA_PWR_VPP_VCC  0x1	   /* voltage VPP = VCC */
+#define MST_PCMCIA_PWR_VCC_0    0x0	   /* voltage VCC = 0V */
+#define MST_PCMCIA_PWR_VCC_33   0x8	   /* voltage VCC = 3.3V */
+#define MST_PCMCIA_PWR_VCC_50   0x4	   /* voltage VCC = 5.0V */
+
+#endif
diff -Nru a/include/asm-arm/arch-pxa/memory.h b/include/asm-arm/arch-pxa/memory.h
--- a/include/asm-arm/arch-pxa/memory.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-arm/arch-pxa/memory.h	Tue Jun 15 22:20:40 2004
@@ -12,46 +12,18 @@
 #ifndef __ASM_ARCH_MEMORY_H
 #define __ASM_ARCH_MEMORY_H
 
-
-/*
- * Task size: 3GB
- */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
-
 /*
  * Physical DRAM offset.
  */
 #define PHYS_OFFSET	(0xa0000000UL)
 
 /*
- * physical vs virtual ram conversion
- */
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-#define __virt_to_phys(x)	((x) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(x)	((x) - PHYS_OFFSET + PAGE_OFFSET)
-
-/*
  * Virtual view <-> DMA view memory address translations
  * virt_to_bus: Used to translate the virtual address to an
  *		address suitable to be passed to set_dma_addr
  * bus_to_virt: Used to convert an address for DMA operations
  *		to an address that the kernel can use.
  */
-#define __virt_to_bus__is_a_macro
-#define __bus_to_virt__is_a_macro
 #define __virt_to_bus(x)	 __virt_to_phys(x)
 #define __bus_to_virt(x)	 __phys_to_virt(x)
 
diff -Nru a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
--- a/include/asm-arm/arch-pxa/pxa-regs.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-arm/arch-pxa/pxa-regs.h	Tue Jun 15 22:20:42 2004
@@ -10,6 +10,9 @@
  * published by the Free Software Foundation.
  */
 
+#ifndef __PXA_REGS_H
+#define __PXA_REGS_H
+
 #include <linux/config.h>
 
 // FIXME hack so that SA-1111.h will work [cb]
@@ -101,6 +104,15 @@
 #define DCSR_RUN	(1 << 31)	/* Run Bit (read / write) */
 #define DCSR_NODESC	(1 << 30)	/* No-Descriptor Fetch (read / write) */
 #define DCSR_STOPIRQEN	(1 << 29)	/* Stop Interrupt Enable (read / write) */
+#ifdef CONFIG_PXA27x
+#define DCSR_EORIRQEN	(1 << 28)       /* End of Receive Interrupt Enable (R/W) */
+#define DCSR_EORJMPEN	(1 << 27)       /* Jump to next descriptor on EOR */
+#define DCSR_EORSTOPEN	(1 << 26)       /* STOP on an EOR */
+#define DCSR_SETCMPST	(1 << 25)       /* Set Descriptor Compare Status */
+#define DCSR_CLRCMPST	(1 << 24)       /* Clear Descriptor Compare Status */
+#define DCSR_CMPST	(1 << 10)       /* The Descriptor Compare Status */
+#define DCSR_ENRINTR	(1 << 9)        /* The end of Receive */
+#endif
 #define DCSR_REQPEND	(1 << 8)	/* Request Pending (read-only) */
 #define DCSR_STOPSTATE	(1 << 3)	/* Stop State (read-only) */
 #define DCSR_ENDINTR	(1 << 2)	/* End Interrupt (read / write) */
@@ -109,6 +121,7 @@
 
 #define DINT		__REG(0x400000f0)  /* DMA Interrupt Register */
 
+#define DRCMR(n)	__REG2(0x40000100, (n)<<2)
 #define DRCMR0		__REG(0x40000100)  /* Request to Channel Map Register for DREQ 0 */
 #define DRCMR1		__REG(0x40000104)  /* Request to Channel Map Register for DREQ 1 */
 #define DRCMR2		__REG(0x40000108)  /* Request to Channel Map Register for I2S receive Request */
@@ -150,6 +163,10 @@
 #define DRCMR38		__REG(0x40000198)  /* Request to Channel Map Register for USB endpoint 14 Request */
 #define DRCMR39		__REG(0x4000019C)  /* Reserved */
 
+#define DRCMR68		__REG(0x40001110)  /* Request to Channel Map Register for Camera FIFO 0 Request */
+#define DRCMR69		__REG(0x40001114)  /* Request to Channel Map Register for Camera FIFO 1 Request */
+#define DRCMR70		__REG(0x40001118)  /* Request to Channel Map Register for Camera FIFO 2 Request */
+
 #define DRCMRRXSADR	DRCMR2
 #define DRCMRTXSADR	DRCMR3
 #define DRCMRRXBTRBR	DRCMR4
@@ -169,9 +186,10 @@
 #define DRCMRTXSTTHR	DRCMR20
 #define DRCMRRXMMC	DRCMR21
 #define DRCMRTXMMC	DRCMR22
+#define DRCMRUDC(x)	DRCMR((x) + 24)
 
 #define DRCMR_MAPVLD	(1 << 7)	/* Map Valid (read / write) */
-#define DRCMR_CHLNUM	0x0f		/* mask for Channel Number (read / write) */
+#define DRCMR_CHLNUM	0x1f		/* mask for Channel Number (read / write) */
 
 #define DDADR0		__REG(0x40000200)  /* DMA Descriptor Address Register Channel 0 */
 #define DSADR0		__REG(0x40000204)  /* DMA Source Address Register Channel 0 */
@@ -398,6 +416,12 @@
 #define ISR		__REG(0x40301698)  /* I2C Status Register - ISR */
 #define ISAR		__REG(0x403016A0)  /* I2C Slave Address Register - ISAR */
 
+#define PWRIBMR    __REG(0x40f00180)  /* Power I2C Bus Monitor Register-IBMR */
+#define PWRIDBR    __REG(0x40f00188)  /* Power I2C Data Buffer Register-IDBR */
+#define PWRICR __REG(0x40f00190)  /* Power I2C Control Register - ICR */
+#define PWRISR __REG(0x40f00198)  /* Power I2C Status Register - ISR */
+#define PWRISAR    __REG(0x40f001A0)  /*Power I2C Slave Address Register-ISAR */
+
 #define ICR_START	(1 << 0)	   /* start bit */
 #define ICR_STOP	(1 << 1)	   /* stop bit */
 #define ICR_ACKNAK	(1 << 2)	   /* send ACK(0) or NAK(1) */
@@ -523,7 +547,10 @@
 
 /*
  * USB Device Controller
+ * PXA25x and PXA27x USB device controller registers are different.
  */
+#if defined(CONFIG_PXA25x)
+
 #define UDC_RES1	__REG(0x40600004)  /* UDC Undocumented - Reserved1 */
 #define UDC_RES2	__REG(0x40600008)  /* UDC Undocumented - Reserved2 */
 #define UDC_RES3	__REG(0x4060000C)  /* UDC Undocumented - Reserved3 */
@@ -679,11 +706,246 @@
 #define USIR1_IR14	(1 << 6)	/* Interrup request ep 14 */
 #define USIR1_IR15	(1 << 7)	/* Interrup request ep 15 */
 
+#elif defined(CONFIG_PXA27x)
+
+#define UDCCR           __REG(0x40600000) /* UDC Control Register */
+#define UDCCR_OEN	(1 << 31)	/* On-the-Go Enable */
+#define UDCCR_AALTHNP	(1 << 30)	/* A-device Alternate Host Negotiation
+					   Protocol Port Support */
+#define UDCCR_AHNP	(1 << 29)	/* A-device Host Negotiation Protocol
+					   Support */
+#define UDCCR_BHNP	(1 << 28)	/* B-device Host Negotiation Protocol
+					   Enable */
+#define UDCCR_DWRE	(1 << 16)	/* Device Remote Wake-up Enable */
+#define UDCCR_ACN	(0x03 << 11)	/* Active UDC configuration Number */
+#define UDCCR_ACN_S	11
+#define UDCCR_AIN	(0x07 << 8)	/* Active UDC interface Number */
+#define UDCCR_AIN_S	8
+#define UDCCR_AAISN	(0x07 << 5)	/* Active UDC Alternate Interface
+					   Setting Number */
+#define UDCCR_AAISN_S	5
+#define UDCCR_SMAC	(1 << 4)	/* Switch Endpoint Memory to Active
+					   Configuration */
+#define UDCCR_EMCE	(1 << 3)	/* Endpoint Memory Configuration
+					   Error */
+#define UDCCR_UDR	(1 << 2)	/* UDC Resume */
+#define UDCCR_UDA	(1 << 1)	/* UDC Active */
+#define UDCCR_UDE	(1 << 0)	/* UDC Enable */
+
+#define UDCICR0         __REG(0x40600004) /* UDC Interrupt Control Register0 */
+#define UDCICR1         __REG(0x40600008) /* UDC Interrupt Control Register1 */
+#define UDCICR_FIFOERR	(1 << 1)	/* FIFO Error interrupt for EP */
+#define UDCICR_PKTCOMPL (1 << 0)	/* Packet Complete interrupt for EP */
+
+#define UDC_INT_FIFOERROR  (0x2)
+#define UDC_INT_PACKETCMP  (0x1)
+
+#define UDCICR_INT(n,intr) (((intr) & 0x03) << (((n) & 0x0F) * 2))
+#define UDCICR1_IECC	(1 << 31)	/* IntEn - Configuration Change */
+#define UDCICR1_IESOF	(1 << 30)	/* IntEn - Start of Frame */
+#define UDCICR1_IERU	(1 << 29)	/* IntEn - Resume */
+#define UDCICR1_IESU	(1 << 28)	/* IntEn - Suspend */
+#define UDCICR1_IERS	(1 << 27)	/* IntEn - Reset */
+
+#define UDCISR0         __REG(0x4060000C) /* UDC Interrupt Status Register 0 */
+#define UDCISR1         __REG(0x40600010) /* UDC Interrupt Status Register 1 */
+#define UDCISR_INT(n,intr) (((intr) & 0x03) << (((n) & 0x0F) * 2))
+#define UDCISR1_IECC	(1 << 31)	/* IntEn - Configuration Change */
+#define UDCISR1_IESOF	(1 << 30)	/* IntEn - Start of Frame */
+#define UDCISR1_IERU	(1 << 29)	/* IntEn - Resume */
+#define UDCISR1_IESU	(1 << 28)	/* IntEn - Suspend */
+#define UDCISR1_IERS	(1 << 27)	/* IntEn - Reset */
+
+
+#define UDCFNR          __REG(0x40600014) /* UDC Frame Number Register */
+#define UDCOTGICR	__REG(0x40600018) /* UDC On-The-Go interrupt control */
+#define UDCOTGICR_IESF	(1 << 24)	/* OTG SET_FEATURE command recvd */
+#define UDCOTGICR_IEXR	(1 << 17)	/* Extra Transciever Interrupt
+					   Rising Edge Interrupt Enable */
+#define UDCOTGICR_IEXF	(1 << 16)	/* Extra Transciever Interrupt
+					   Falling Edge Interrupt Enable */
+#define UDCOTGICR_IEVV40R (1 << 9)	/* OTG Vbus Valid 4.0V Rising Edge
+					   Interrupt Enable */
+#define UDCOTGICR_IEVV40F (1 << 8)	/* OTG Vbus Valid 4.0V Falling Edge
+					   Interrupt Enable */
+#define UDCOTGICR_IEVV44R (1 << 7)	/* OTG Vbus Valid 4.4V Rising Edge
+					   Interrupt Enable */
+#define UDCOTGICR_IEVV44F (1 << 6)	/* OTG Vbus Valid 4.4V Falling Edge
+					   Interrupt Enable */
+#define UDCOTGICR_IESVR	(1 << 5)	/* OTG Session Valid Rising Edge
+					   Interrupt Enable */
+#define UDCOTGICR_IESVF	(1 << 4)	/* OTG Session Valid Falling Edge
+					   Interrupt Enable */
+#define UDCOTGICR_IESDR	(1 << 3)	/* OTG A-Device SRP Detect Rising
+					   Edge Interrupt Enable */
+#define UDCOTGICR_IESDF	(1 << 2)	/* OTG A-Device SRP Detect Falling
+					   Edge Interrupt Enable */
+#define UDCOTGICR_IEIDR	(1 << 1)	/* OTG ID Change Rising Edge
+					   Interrupt Enable */
+#define UDCOTGICR_IEIDF	(1 << 0)	/* OTG ID Change Falling Edge
+					   Interrupt Enable */
+
+#define UDCCSN(x)	__REG2(0x40600100, (x) << 2)
+#define UDCCSR0         __REG(0x40600100) /* UDC Control/Status register - Endpoint 0 */
+#define UDCCSR0_SA	(1 << 7)	/* Setup Active */
+#define UDCCSR0_RNE	(1 << 6)	/* Receive FIFO Not Empty */
+#define UDCCSR0_FST	(1 << 5)	/* Force Stall */
+#define UDCCSR0_SST	(1 << 4)	/* Sent Stall */
+#define UDCCSR0_DME	(1 << 3)	/* DMA Enable */
+#define UDCCSR0_FTF	(1 << 2)	/* Flush Transmit FIFO */
+#define UDCCSR0_IPR	(1 << 1)	/* IN Packet Ready */
+#define UDCCSR0_OPC	(1 << 0)	/* OUT Packet Complete */
+
+#define UDCCSRA         __REG(0x40600104) /* UDC Control/Status register - Endpoint A */
+#define UDCCSRB         __REG(0x40600108) /* UDC Control/Status register - Endpoint B */
+#define UDCCSRC         __REG(0x4060010C) /* UDC Control/Status register - Endpoint C */
+#define UDCCSRD         __REG(0x40600110) /* UDC Control/Status register - Endpoint D */
+#define UDCCSRE         __REG(0x40600114) /* UDC Control/Status register - Endpoint E */
+#define UDCCSRF         __REG(0x40600118) /* UDC Control/Status register - Endpoint F */
+#define UDCCSRG         __REG(0x4060011C) /* UDC Control/Status register - Endpoint G */
+#define UDCCSRH         __REG(0x40600120) /* UDC Control/Status register - Endpoint H */
+#define UDCCSRI         __REG(0x40600124) /* UDC Control/Status register - Endpoint I */
+#define UDCCSRJ         __REG(0x40600128) /* UDC Control/Status register - Endpoint J */
+#define UDCCSRK         __REG(0x4060012C) /* UDC Control/Status register - Endpoint K */
+#define UDCCSRL         __REG(0x40600130) /* UDC Control/Status register - Endpoint L */
+#define UDCCSRM         __REG(0x40600134) /* UDC Control/Status register - Endpoint M */
+#define UDCCSRN         __REG(0x40600138) /* UDC Control/Status register - Endpoint N */
+#define UDCCSRP         __REG(0x4060013C) /* UDC Control/Status register - Endpoint P */
+#define UDCCSRQ         __REG(0x40600140) /* UDC Control/Status register - Endpoint Q */
+#define UDCCSRR         __REG(0x40600144) /* UDC Control/Status register - Endpoint R */
+#define UDCCSRS         __REG(0x40600148) /* UDC Control/Status register - Endpoint S */
+#define UDCCSRT         __REG(0x4060014C) /* UDC Control/Status register - Endpoint T */
+#define UDCCSRU         __REG(0x40600150) /* UDC Control/Status register - Endpoint U */
+#define UDCCSRV         __REG(0x40600154) /* UDC Control/Status register - Endpoint V */
+#define UDCCSRW         __REG(0x40600158) /* UDC Control/Status register - Endpoint W */
+#define UDCCSRX         __REG(0x4060015C) /* UDC Control/Status register - Endpoint X */
+
+#define UDCCSR_DPE	(1 << 9)	/* Data Packet Error */
+#define UDCCSR_FEF	(1 << 8)	/* Flush Endpoint FIFO */
+#define UDCCSR_SP	(1 << 7)	/* Short Packet Control/Status */
+#define UDCCSR_BNE	(1 << 6)	/* Buffer Not Empty (IN endpoints) */
+#define UDCCSR_BNF	(1 << 6)	/* Buffer Not Full (OUT endpoints) */
+#define UDCCSR_FST	(1 << 5)	/* Force STALL */
+#define UDCCSR_SST	(1 << 4)	/* Sent STALL */
+#define UDCCSR_DME	(1 << 3)	/* DMA Enable */
+#define UDCCSR_TRN	(1 << 2)	/* Tx/Rx NAK */
+#define UDCCSR_PC	(1 << 1)	/* Packet Complete */
+#define UDCCSR_FS	(1 << 0)	/* FIFO needs service */
+
+#define UDCBCN(x)	__REG2(0x40600200, (x)<<2)
+#define UDCBCR0         __REG(0x40600200) /* Byte Count Register - EP0 */
+#define UDCBCRA         __REG(0x40600204) /* Byte Count Register - EPA */
+#define UDCBCRB         __REG(0x40600208) /* Byte Count Register - EPB */
+#define UDCBCRC         __REG(0x4060020C) /* Byte Count Register - EPC */
+#define UDCBCRD         __REG(0x40600210) /* Byte Count Register - EPD */
+#define UDCBCRE         __REG(0x40600214) /* Byte Count Register - EPE */
+#define UDCBCRF         __REG(0x40600218) /* Byte Count Register - EPF */
+#define UDCBCRG         __REG(0x4060021C) /* Byte Count Register - EPG */
+#define UDCBCRH         __REG(0x40600220) /* Byte Count Register - EPH */
+#define UDCBCRI         __REG(0x40600224) /* Byte Count Register - EPI */
+#define UDCBCRJ         __REG(0x40600228) /* Byte Count Register - EPJ */
+#define UDCBCRK         __REG(0x4060022C) /* Byte Count Register - EPK */
+#define UDCBCRL         __REG(0x40600230) /* Byte Count Register - EPL */
+#define UDCBCRM         __REG(0x40600234) /* Byte Count Register - EPM */
+#define UDCBCRN         __REG(0x40600238) /* Byte Count Register - EPN */
+#define UDCBCRP         __REG(0x4060023C) /* Byte Count Register - EPP */
+#define UDCBCRQ         __REG(0x40600240) /* Byte Count Register - EPQ */
+#define UDCBCRR         __REG(0x40600244) /* Byte Count Register - EPR */
+#define UDCBCRS         __REG(0x40600248) /* Byte Count Register - EPS */
+#define UDCBCRT         __REG(0x4060024C) /* Byte Count Register - EPT */
+#define UDCBCRU         __REG(0x40600250) /* Byte Count Register - EPU */
+#define UDCBCRV         __REG(0x40600254) /* Byte Count Register - EPV */
+#define UDCBCRW         __REG(0x40600258) /* Byte Count Register - EPW */
+#define UDCBCRX         __REG(0x4060025C) /* Byte Count Register - EPX */
+
+#define UDCDN(x)	__REG2(0x40600300, (x)<<2)
+#define PHYS_UDCDN(x)	(0x40600300 + ((x)<<2))
+#define PUDCDN(x)	(volatile u32 *)(io_p2v(PHYS_UDCDN((x))))
+#define UDCDR0          __REG(0x40600300) /* Data Register - EP0 */
+#define UDCDRA          __REG(0x40600304) /* Data Register - EPA */
+#define UDCDRB          __REG(0x40600308) /* Data Register - EPB */
+#define UDCDRC          __REG(0x4060030C) /* Data Register - EPC */
+#define UDCDRD          __REG(0x40600310) /* Data Register - EPD */
+#define UDCDRE          __REG(0x40600314) /* Data Register - EPE */
+#define UDCDRF          __REG(0x40600318) /* Data Register - EPF */
+#define UDCDRG          __REG(0x4060031C) /* Data Register - EPG */
+#define UDCDRH          __REG(0x40600320) /* Data Register - EPH */
+#define UDCDRI          __REG(0x40600324) /* Data Register - EPI */
+#define UDCDRJ          __REG(0x40600328) /* Data Register - EPJ */
+#define UDCDRK          __REG(0x4060032C) /* Data Register - EPK */
+#define UDCDRL          __REG(0x40600330) /* Data Register - EPL */
+#define UDCDRM          __REG(0x40600334) /* Data Register - EPM */
+#define UDCDRN          __REG(0x40600338) /* Data Register - EPN */
+#define UDCDRP          __REG(0x4060033C) /* Data Register - EPP */
+#define UDCDRQ          __REG(0x40600340) /* Data Register - EPQ */
+#define UDCDRR          __REG(0x40600344) /* Data Register - EPR */
+#define UDCDRS          __REG(0x40600348) /* Data Register - EPS */
+#define UDCDRT          __REG(0x4060034C) /* Data Register - EPT */
+#define UDCDRU          __REG(0x40600350) /* Data Register - EPU */
+#define UDCDRV          __REG(0x40600354) /* Data Register - EPV */
+#define UDCDRW          __REG(0x40600358) /* Data Register - EPW */
+#define UDCDRX          __REG(0x4060035C) /* Data Register - EPX */
+
+#define UDCCN(x)       __REG2(0x40600400, (x)<<2)
+#define UDCCRA          __REG(0x40600404) /* Configuration register EPA */
+#define UDCCRB          __REG(0x40600408) /* Configuration register EPB */
+#define UDCCRC          __REG(0x4060040C) /* Configuration register EPC */
+#define UDCCRD          __REG(0x40600410) /* Configuration register EPD */
+#define UDCCRE          __REG(0x40600414) /* Configuration register EPE */
+#define UDCCRF          __REG(0x40600418) /* Configuration register EPF */
+#define UDCCRG          __REG(0x4060041C) /* Configuration register EPG */
+#define UDCCRH          __REG(0x40600420) /* Configuration register EPH */
+#define UDCCRI          __REG(0x40600424) /* Configuration register EPI */
+#define UDCCRJ          __REG(0x40600428) /* Configuration register EPJ */
+#define UDCCRK          __REG(0x4060042C) /* Configuration register EPK */
+#define UDCCRL          __REG(0x40600430) /* Configuration register EPL */
+#define UDCCRM          __REG(0x40600434) /* Configuration register EPM */
+#define UDCCRN          __REG(0x40600438) /* Configuration register EPN */
+#define UDCCRP          __REG(0x4060043C) /* Configuration register EPP */
+#define UDCCRQ          __REG(0x40600440) /* Configuration register EPQ */
+#define UDCCRR          __REG(0x40600444) /* Configuration register EPR */
+#define UDCCRS          __REG(0x40600448) /* Configuration register EPS */
+#define UDCCRT          __REG(0x4060044C) /* Configuration register EPT */
+#define UDCCRU          __REG(0x40600450) /* Configuration register EPU */
+#define UDCCRV          __REG(0x40600454) /* Configuration register EPV */
+#define UDCCRW          __REG(0x40600458) /* Configuration register EPW */
+#define UDCCRX          __REG(0x4060045C) /* Configuration register EPX */
+
+#define UDCCONR_CN	(0x03 << 25)	/* Configuration Number */
+#define UDCCONR_CN_S	(25)
+#define UDCCONR_IN	(0x07 << 22)	/* Interface Number */
+#define UDCCONR_IN_S	(22)
+#define UDCCONR_AISN	(0x07 << 19)	/* Alternate Interface Number */
+#define UDCCONR_AISN_S	(19)
+#define UDCCONR_EN	(0x0f << 15)	/* Endpoint Number */
+#define UDCCONR_EN_S	(15)
+#define UDCCONR_ET	(0x03 << 13)	/* Endpoint Type: */
+#define UDCCONR_ET_S	(13)
+#define UDCCONR_ET_INT	(0x03 << 13)	/*   Interrupt */
+#define UDCCONR_ET_BULK	(0x02 << 13)	/*   Bulk */
+#define UDCCONR_ET_ISO	(0x01 << 13)	/*   Isochronous */
+#define UDCCONR_ET_NU	(0x00 << 13)	/*   Not used */
+#define UDCCONR_ED	(1 << 12)	/* Endpoint Direction */
+#define UDCCONR_MPS	(0x3ff << 2)	/* Maximum Packet Size */
+#define UDCCONR_MPS_S	(2)
+#define UDCCONR_DE	(1 << 1)	/* Double Buffering Enable */
+#define UDCCONR_EE	(1 << 0)	/* Endpoint Enable */
+
+
+#define UDC_INT_FIFOERROR  (0x2)
+#define UDC_INT_PACKETCMP  (0x1)
+
+#define UDC_FNR_MASK     (0x7ff)
+
+#define UDCCSR_WR_MASK   (UDCCSR_DME|UDCCSR_FST)
+#define UDC_BCR_MASK    (0x3ff)
+#endif
 
 /*
  * Fast Infrared Communication Port
  */
 
+#define FICP		__REG(0x40800000)  /* Start of FICP area */
 #define ICCR0		__REG(0x40800000)  /* ICP Control Register 0 */
 #define ICCR1		__REG(0x40800004)  /* ICP Control Register 1 */
 #define ICCR2		__REG(0x40800008)  /* ICP Control Register 2 */
@@ -691,29 +953,41 @@
 #define ICSR0		__REG(0x40800014)  /* ICP Status Register 0 */
 #define ICSR1		__REG(0x40800018)  /* ICP Status Register 1 */
 
-#define ICCR0_AME       (1 << 7)           /* Address match enable */
-#define ICCR0_TIE       (1 << 6)           /* Transmit FIFO interrupt enable */
-#define ICCR0_RIE       (1 << 5)           /* Receive FIFO interrupt enable */
-#define ICCR0_RXE       (1 << 4)           /* Receive enable */
-#define ICCR0_TXE       (1 << 3)           /* Transmit enable */
-#define ICCR0_TUS       (1 << 2)           /* Transmit FIFO underrun select */
-#define ICCR0_LBM       (1 << 1)           /* Loopback mode */
-#define ICCR0_ITR       (1 << 0)           /* IrDA transmission */
-
-#define ICSR0_FRE       (1 << 5)           /* Framing error */
-#define ICSR0_RFS       (1 << 4)           /* Receive FIFO service request */
-#define ICSR0_TFS       (1 << 3)           /* Transnit FIFO service request */
-#define ICSR0_RAB       (1 << 2)           /* Receiver abort */
-#define ICSR0_TUR       (1 << 1)           /* Trunsmit FIFO underun */
-#define ICSR0_EIF       (1 << 0)           /* End/Error in FIFO */
-
-#define ICSR1_ROR       (1 << 6)           /* Receiver FIFO underrun  */
-#define ICSR1_CRE       (1 << 5)           /* CRC error */
-#define ICSR1_EOF       (1 << 4)           /* End of frame */
-#define ICSR1_TNF       (1 << 3)           /* Transmit FIFO not full */
-#define ICSR1_RNE       (1 << 2)           /* Receive FIFO not empty */
-#define ICSR1_TBY       (1 << 1)           /* Tramsmiter busy flag */
-#define ICSR1_RSY       (1 << 0)           /* Recevier synchronized flag */
+#define ICCR0_AME	(1 << 7)	/* Adress match enable */
+#define ICCR0_TIE	(1 << 6)	/* Transmit FIFO interrupt enable */
+#define ICCR0_RIE	(1 << 5)	/* Recieve FIFO interrupt enable */
+#define ICCR0_RXE	(1 << 4)	/* Receive enable */
+#define ICCR0_TXE	(1 << 3)	/* Transmit enable */
+#define ICCR0_TUS	(1 << 2)	/* Transmit FIFO underrun select */
+#define ICCR0_LBM	(1 << 1)	/* Loopback mode */
+#define ICCR0_ITR	(1 << 0)	/* IrDA transmission */
+
+#ifdef CONFIG_CPU_BULVERDE
+#define ICCR2_RXP       (1 << 3)	/* Receive Pin Polarity select */
+#define ICCR2_TXP       (1 << 2)	/* Transmit Pin Polarity select */
+#define ICCR2_TRIG	(3 << 0)	/* Receive FIFO Trigger threshold */
+#define ICCR2_TRIG_8    (0 << 0)	/* 	>= 8 bytes */
+#define ICCR2_TRIG_16   (1 << 0)	/*	>= 16 bytes */
+#define ICCR2_TRIG_32   (2 << 0)	/*	>= 32 bytes */
+#endif
+
+#ifdef CONFIG_CPU_BULVERDE
+#define ICSR0_EOC	(1 << 6)	/* DMA End of Descriptor Chain */
+#endif
+#define ICSR0_FRE	(1 << 5)	/* Framing error */
+#define ICSR0_RFS	(1 << 4)	/* Receive FIFO service request */
+#define ICSR0_TFS	(1 << 3)	/* Transnit FIFO service request */
+#define ICSR0_RAB	(1 << 2)	/* Receiver abort */
+#define ICSR0_TUR	(1 << 1)	/* Trunsmit FIFO underun */
+#define ICSR0_EIF	(1 << 0)	/* End/Error in FIFO */
+
+#define ICSR1_ROR	(1 << 6)	/* Receiver FIFO underrun  */
+#define ICSR1_CRE	(1 << 5)	/* CRC error */
+#define ICSR1_EOF	(1 << 4)	/* End of frame */
+#define ICSR1_TNF	(1 << 3)	/* Transmit FIFO not full */
+#define ICSR1_RNE	(1 << 2)	/* Receive FIFO not empty */
+#define ICSR1_TBY	(1 << 1)	/* Tramsmiter busy flag */
+#define ICSR1_RSY	(1 << 0)	/* Recevier synchronized flag */
 
 
 /*
@@ -724,7 +998,10 @@
 #define RTAR		__REG(0x40900004)  /* RTC Alarm Register */
 #define RTSR		__REG(0x40900008)  /* RTC Status Register */
 #define RTTR		__REG(0x4090000C)  /* RTC Timer Trim Register */
+#define PIAR		__REG(0x40900038)  /* Periodic Interrupt Alarm Register */
 
+#define RTSR_PICE	(1 << 15)	/* Periodic interrupt count enable */
+#define RTSR_PIALE	(1 << 14)	/* Periodic interrupt Alarm enable */
 #define RTSR_HZE	(1 << 3)	/* HZ interrupt enable */
 #define RTSR_ALE	(1 << 2)	/* RTC alarm interrupt enable */
 #define RTSR_HZ		(1 << 1)	/* HZ rising-edge detected */
@@ -739,7 +1016,10 @@
 #define OSMR1		__REG(0x40A00004)  /* */
 #define OSMR2		__REG(0x40A00008)  /* */
 #define OSMR3		__REG(0x40A0000C)  /* */
+#define OSMR4		__REG(0x40A00080)  /* */
 #define OSCR		__REG(0x40A00010)  /* OS Timer Counter Register */
+#define OSCR4		__REG(0x40A00040)  /* OS Timer Counter Register */
+#define OMCR4		__REG(0x40A000C0)  /* */
 #define OSSR		__REG(0x40A00014)  /* OS Timer Status Register */
 #define OWER		__REG(0x40A00018)  /* OS Timer Watchdog Enable Register */
 #define OIER		__REG(0x40A0001C)  /* OS Timer Interrupt Enable Register */
@@ -819,11 +1099,52 @@
 #define GAFR1_L		__REG(0x40E0005C)  /* GPIO Alternate Function Select Register GPIO<47:32> */
 #define GAFR1_U		__REG(0x40E00060)  /* GPIO Alternate Function Select Register GPIO<63:48> */
 #define GAFR2_L		__REG(0x40E00064)  /* GPIO Alternate Function Select Register GPIO<79:64> */
-#define GAFR2_U		__REG(0x40E00068)  /* GPIO Alternate Function Select Register GPIO 80 */
+#define GAFR2_U		__REG(0x40E00068)  /* GPIO Alternate Function Select Register GPIO<95-80> */
+#define GAFR3_L		__REG(0x40E0006C)  /* GPIO Alternate Function Select Register GPIO<111:96> */
+#define GAFR3_U		__REG(0x40E00070)  /* GPIO Alternate Function Select Register GPIO<127:112> */
+
+#define GPLR3		__REG(0x40E00100)  /* GPIO Pin-Level Register GPIO<127:96> */
+#define GPDR3		__REG(0x40E0010C)  /* GPIO Pin Direction Register GPIO<127:96> */
+#define GPSR3		__REG(0x40E00118)  /* GPIO Pin Output Set Register GPIO<127:96> */
+#define GPCR3		__REG(0x40E00124)  /* GPIO Pin Output Clear Register GPIO<127:96> */
+#define GRER3		__REG(0x40E00130)  /* GPIO Rising-Edge Detect Register GPIO<127:96> */
+#define GFER3		__REG(0x40E0013C)  /* GPIO Falling-Edge Detect Register GPIO<127:96> */
+#define GEDR3		__REG(0x40E00148)  /* GPIO Edge Detect Status Register GPIO<127:96> */
 
 /* More handy macros.  The argument is a literal GPIO number. */
 
 #define GPIO_bit(x)	(1 << ((x) & 0x1f))
+
+#ifdef CONFIG_PXA27x
+
+/* Interrupt Controller */
+
+#define ICIP2		__REG(0x40D0009C)  /* Interrupt Controller IRQ Pending Register 2 */
+#define ICMR2		__REG(0x40D000A0)  /* Interrupt Controller Mask Register 2 */
+#define ICLR2		__REG(0x40D000A4)  /* Interrupt Controller Level Register 2 */
+#define ICFP2		__REG(0x40D000A8)  /* Interrupt Controller FIQ Pending Register 2 */
+#define ICPR2		__REG(0x40D000AC)  /* Interrupt Controller Pending Register 2 */
+
+#define _GPLR(x)	__REG2(0x40E00000, ((x) & 0x60) >> 3)
+#define _GPDR(x)	__REG2(0x40E0000C, ((x) & 0x60) >> 3)
+#define _GPSR(x)	__REG2(0x40E00018, ((x) & 0x60) >> 3)
+#define _GPCR(x)	__REG2(0x40E00024, ((x) & 0x60) >> 3)
+#define _GRER(x)	__REG2(0x40E00030, ((x) & 0x60) >> 3)
+#define _GFER(x)	__REG2(0x40E0003C, ((x) & 0x60) >> 3)
+#define _GEDR(x)	__REG2(0x40E00048, ((x) & 0x60) >> 3)
+#define _GAFR(x)	__REG2(0x40E00054, ((x) & 0x70) >> 2)
+
+#define GPLR(x) 	((((x) & 0x7f) < 96) ? _GPLR(x) : GPLR3)
+#define GPDR(x)		((((x) & 0x7f) < 96) ? _GPDR(x) : GPDR3)
+#define GPSR(x)		((((x) & 0x7f) < 96) ? _GPSR(x) : GPSR3)
+#define GPCR(x)		((((x) & 0x7f) < 96) ? _GPCR(x) : GPCR3)
+#define GRER(x)		((((x) & 0x7f) < 96) ? _GRER(x) : GRER3)
+#define GFER(x)		((((x) & 0x7f) < 96) ? _GFER(x) : GFER3)
+#define GEDR(x)		((((x) & 0x7f) < 96) ? _GEDR(x) : GEDR3)
+#define GAFR(x)		((((x) & 0x7f) < 96) ? _GAFR(x) : \
+			 ((((x) & 0x7f) < 112) ? GAFR3_L : GAFR3_U))
+#else
+
 #define GPLR(x)		__REG2(0x40E00000, ((x) & 0x60) >> 3)
 #define GPDR(x)		__REG2(0x40E0000C, ((x) & 0x60) >> 3)
 #define GPSR(x)		__REG2(0x40E00018, ((x) & 0x60) >> 3)
@@ -833,6 +1154,9 @@
 #define GEDR(x)		__REG2(0x40E00048, ((x) & 0x60) >> 3)
 #define GAFR(x)		__REG2(0x40E00054, ((x) & 0x70) >> 2)
 
+#endif
+
+
 /* GPIO alternate function assignments */
 
 #define GPIO1_RST		1	/* reset */
@@ -1047,14 +1371,73 @@
 #define PGSR0		__REG(0x40F00020)  /* Power Manager GPIO Sleep State Register for GP[31-0] */
 #define PGSR1		__REG(0x40F00024)  /* Power Manager GPIO Sleep State Register for GP[63-32] */
 #define PGSR2		__REG(0x40F00028)  /* Power Manager GPIO Sleep State Register for GP[84-64] */
+#define PGSR3		__REG(0x40F0002C)  /* Power Manager GPIO Sleep State Register for GP[118-96] */
 #define RCSR		__REG(0x40F00030)  /* Reset Controller Status Register */
 
+#define PSLR		__REG(0x40F00034)	/* Power Manager Sleep Config Register */
+#define PSTR		__REG(0x40F00038)	/*Power Manager Standby Config Register */
+#define PSNR		__REG(0x40F0003C)	/*Power Manager Sense Config Register */
+#define PVCR		__REG(0x40F00040)	/*Power Manager VoltageControl Register */
+#define PKWR		__REG(0x40F00050)	/* Power Manager KB Wake-up Enable Reg */
+#define PKSR		__REG(0x40F00054)	/* Power Manager KB Level-Detect Register */
+#define PCMD(x)	__REG2(0x40F00080, (x)<<2)
+#define PCMD0	__REG(0x40F00080 + 0 * 4)
+#define PCMD1	__REG(0x40F00080 + 1 * 4)
+#define PCMD2	__REG(0x40F00080 + 2 * 4)
+#define PCMD3	__REG(0x40F00080 + 3 * 4)
+#define PCMD4	__REG(0x40F00080 + 4 * 4)
+#define PCMD5	__REG(0x40F00080 + 5 * 4)
+#define PCMD6	__REG(0x40F00080 + 6 * 4)
+#define PCMD7	__REG(0x40F00080 + 7 * 4)
+#define PCMD8	__REG(0x40F00080 + 8 * 4)
+#define PCMD9	__REG(0x40F00080 + 9 * 4)
+#define PCMD10	__REG(0x40F00080 + 10 * 4)
+#define PCMD11	__REG(0x40F00080 + 11 * 4)
+#define PCMD12	__REG(0x40F00080 + 12 * 4)
+#define PCMD13	__REG(0x40F00080 + 13 * 4)
+#define PCMD14	__REG(0x40F00080 + 14 * 4)
+#define PCMD15	__REG(0x40F00080 + 15 * 4)
+#define PCMD16	__REG(0x40F00080 + 16 * 4)
+#define PCMD17	__REG(0x40F00080 + 17 * 4)
+#define PCMD18	__REG(0x40F00080 + 18 * 4)
+#define PCMD19	__REG(0x40F00080 + 19 * 4)
+#define PCMD20	__REG(0x40F00080 + 20 * 4)
+#define PCMD21	__REG(0x40F00080 + 21 * 4)
+#define PCMD22	__REG(0x40F00080 + 22 * 4)
+#define PCMD23	__REG(0x40F00080 + 23 * 4)
+#define PCMD24	__REG(0x40F00080 + 24 * 4)
+#define PCMD25	__REG(0x40F00080 + 25 * 4)
+#define PCMD26	__REG(0x40F00080 + 26 * 4)
+#define PCMD27	__REG(0x40F00080 + 27 * 4)
+#define PCMD28	__REG(0x40F00080 + 28 * 4)
+#define PCMD29	__REG(0x40F00080 + 29 * 4)
+#define PCMD30	__REG(0x40F00080 + 30 * 4)
+#define PCMD31	__REG(0x40F00080 + 31 * 4)
+
+#define PCMD_MBC	(1<<12)
+#define PCMD_DCE	(1<<11)
+#define PCMD_LC	(1<<10)
+/* FIXME:  PCMD_SQC need be checked.   */
+#define PCMD_SQC	(3<<8)	/* currently only bit 8 is changeable,
+				   bit 9 should be 0 all day. */
+#define PVCR_VCSA	(0x1<<14)
+#define PVCR_CommandDelay (0xf80)
+#define PCFR_PI2C_EN	(0x1 << 6)
+
+#define PSSR_OTGPH	(1 << 7)	/* OTG Peripheral control Hold */
 #define PSSR_RDH	(1 << 5)	/* Read Disable Hold */
 #define PSSR_PH		(1 << 4)	/* Peripheral Control Hold */
 #define PSSR_VFS	(1 << 2)	/* VDD Fault Status */
 #define PSSR_BFS	(1 << 1)	/* Battery Fault Status */
 #define PSSR_SSS	(1 << 0)	/* Software Sleep Status */
 
+#define PCFR_RO		(1 << 15)	/* RDH Override */
+#define PCFR_PO		(1 << 14)	/* PH Override */
+#define PCFR_GPROD	(1 << 12)	/* GPIO nRESET_OUT Disable */
+#define PCFR_L1_EN	(1 << 11)	/* Sleep Mode L1 converter Enable */
+#define PCFR_FVC	(1 << 10)	/* Frequency/Voltage Change */
+#define PCFR_DC_EN	(1 << 7)	/* Sleep/deep-sleep DC-DC Converter Enable */
+#define PCFR_PI2CEN	(1 << 6)	/* Enable PI2C controller */
 #define PCFR_DS		(1 << 3)	/* Deep Sleep Mode */
 #define PCFR_FS		(1 << 2)	/* Float Static Chip Selects */
 #define PCFR_FP		(1 << 1)	/* Float PCMCIA controls */
@@ -1137,21 +1520,35 @@
 #define CCCR		__REG(0x41300000)  /* Core Clock Configuration Register */
 #define CKEN		__REG(0x41300004)  /* Clock Enable Register */
 #define OSCC		__REG(0x41300008)  /* Oscillator Configuration Register */
+#define CCSR		__REG(0x4130000C)  /* Core Clock Status Register */
 
 #define CCCR_N_MASK	0x0380		/* Run Mode Frequency to Turbo Mode Frequency Multiplier */
 #define CCCR_M_MASK	0x0060		/* Memory Frequency to Run Mode Frequency Multiplier */
 #define CCCR_L_MASK	0x001f		/* Crystal Frequency to Memory Frequency Multiplier */
 
+#define CKEN24_CAMERA	(1 << 24)	/* Camera Interface Clock Enable */
+#define CKEN23_SSP1	(1 << 23)	/* SSP1 Unit Clock Enable */
+#define CKEN22_MEMC	(1 << 22)	/* Memory Controller Clock Enable */
+#define CKEN21_MEMSTK	(1 << 21)	/* Memory Stick Host Controller */
+#define CKEN20_IM	(1 << 20)	/* Internal Memory Clock Enable */
+#define CKEN19_KEYPAD	(1 << 19)	/* Keypad Interface Clock Enable */
+#define CKEN18_USIM	(1 << 18)	/* USIM Unit Clock Enable */
+#define CKEN17_MSL	(1 << 17)	/* MSL Unit Clock Enable */
 #define CKEN16_LCD	(1 << 16)	/* LCD Unit Clock Enable */
+#define CKEN15_PWRI2C	(1 << 15)	/* PWR I2C Unit Clock Enable */
 #define CKEN14_I2C	(1 << 14)	/* I2C Unit Clock Enable */
 #define CKEN13_FICP	(1 << 13)	/* FICP Unit Clock Enable */
 #define CKEN12_MMC	(1 << 12)	/* MMC Unit Clock Enable */
 #define CKEN11_USB	(1 << 11)	/* USB Unit Clock Enable */
+#define CKEN10_USBHOST	(1 << 10)	/* USB Host Unit Clock Enable */
+#define CKEN9_OSTIMER	(1 << 9)	/* OS Timer Unit Clock Enable */
 #define CKEN8_I2S	(1 << 8)	/* I2S Unit Clock Enable */
 #define CKEN7_BTUART	(1 << 7)	/* BTUART Unit Clock Enable */
 #define CKEN6_FFUART	(1 << 6)	/* FFUART Unit Clock Enable */
 #define CKEN5_STUART	(1 << 5)	/* STUART Unit Clock Enable */
+#define CKEN4_SSP3	(1 << 4)	/* SSP3 Unit Clock Enable */
 #define CKEN3_SSP	(1 << 3)	/* SSP Unit Clock Enable */
+#define CKEN3_SSP2	(1 << 3)	/* SSP2 Unit Clock Enable */
 #define CKEN2_AC97	(1 << 2)	/* AC97 Unit Clock Enable */
 #define CKEN1_PWM1	(1 << 1)	/* PWM1 Clock Enable */
 #define CKEN0_PWM0	(1 << 0)	/* PWM0 Clock Enable */
@@ -1175,6 +1572,12 @@
 #define TMEDRGBR	__REG(0x44000040)  /* TMED RGB Seed Register */
 #define TMEDCR		__REG(0x44000044)  /* TMED Control Register */
 
+#define LCCR3_1BPP (0 << 24)
+#define LCCR3_2BPP (1 << 24)
+#define LCCR3_4BPP (2 << 24)
+#define LCCR3_8BPP (3 << 24)
+#define LCCR3_16BPP (4 << 24)
+
 #define FDADR0		__REG(0x44000200)  /* DMA Channel 0 Frame Descriptor Address Register */
 #define FSADR0		__REG(0x44000204)  /* DMA Channel 0 Frame Source Address Register */
 #define FIDR0		__REG(0x44000208)  /* DMA Channel 0 Frame ID Register */
@@ -1185,15 +1588,27 @@
 #define LDCMD1		__REG(0x4400021C)  /* DMA Channel 1 Command Register */
 
 #define LCCR0_ENB	(1 << 0)	/* LCD Controller enable */
-#define LCCR0_CMS	(1 << 1)	/* Color = 0, Monochrome = 1 */
-#define LCCR0_SDS	(1 << 2)	/* Single Panel = 0, Dual Panel = 1 */
+#define LCCR0_CMS	(1 << 1)	/* Color/Monochrome Display Select */
+#define LCCR0_Color     (LCCR0_CMS*0)   /*  Color display                  */
+#define LCCR0_Mono      (LCCR0_CMS*1)   /*  Monochrome display             */
+#define LCCR0_SDS	(1 << 2)	/* Single/Dual Panel Display       */
+                                        /* Select                          */
+#define LCCR0_Sngl      (LCCR0_SDS*0)   /*  Single panel display           */
+#define LCCR0_Dual      (LCCR0_SDS*1)   /*  Dual panel display             */
+
 #define LCCR0_LDM	(1 << 3)	/* LCD Disable Done Mask */
 #define LCCR0_SFM	(1 << 4)	/* Start of frame mask */
 #define LCCR0_IUM	(1 << 5)	/* Input FIFO underrun mask */
 #define LCCR0_EFM	(1 << 6)	/* End of Frame mask */
-#define LCCR0_PAS	(1 << 7)	/* Passive = 0, Active = 1 */
-#define LCCR0_BLE	(1 << 8)	/* Little Endian = 0, Big Endian = 1 */
-#define LCCR0_DPD	(1 << 9)	/* Double Pixel mode, 4 pixel value = 0, 8 pixle values = 1 */
+#define LCCR0_PAS	(1 << 7)	/* Passive/Active display Select   */
+#define LCCR0_Pas       (LCCR0_PAS*0)   /*  Passive display (STN)          */
+#define LCCR0_Act       (LCCR0_PAS*1)   /*  Active display (TFT)           */
+#define LCCR0_DPD	(1 << 9)	/* Double Pixel Data (monochrome   */
+                                        /* display mode)                   */
+#define LCCR0_4PixMono  (LCCR0_DPD*0)   /*  4-Pixel/clock Monochrome       */
+                                        /*  display                        */
+#define LCCR0_8PixMono  (LCCR0_DPD*1)   /*  8-Pixel/clock Monochrome       */
+                                        /*  display                        */
 #define LCCR0_DIS	(1 << 10)	/* LCD Disable */
 #define LCCR0_QDM	(1 << 11)	/* LCD Quick Disable mask */
 #define LCCR0_PDD	(0xff << 12)	/* Palette DMA request delay */
@@ -1255,8 +1670,15 @@
 #define LCCR3_API_S	16
 #define LCCR3_VSP	(1 << 20)	/* vertical sync polarity */
 #define LCCR3_HSP	(1 << 21)	/* horizontal sync polarity */
-#define LCCR3_PCP	(1 << 22)	/* pixel clock polarity */
-#define LCCR3_OEP	(1 << 23)	/* output enable polarity */
+#define LCCR3_PCP	(1 << 22)	/* Pixel Clock Polarity (L_PCLK)   */
+#define LCCR3_PixRsEdg  (LCCR3_PCP*0)   /*  Pixel clock Rising-Edge        */
+#define LCCR3_PixFlEdg  (LCCR3_PCP*1)   /*  Pixel clock Falling-Edge       */
+
+#define LCCR3_OEP       (1 << 23)       /* Output Enable Polarity (L_BIAS, */
+                                        /* active display mode)            */
+#define LCCR3_OutEnH    (LCCR3_OEP*0)   /*  Output Enable active High      */
+#define LCCR3_OutEnL    (LCCR3_OEP*1)   /*  Output Enable active Low       */
+
 #if 0
 #define LCCR3_BPP	(7 << 24)	/* bits per pixel */
 #define LCCR3_BPP_S	24
@@ -1336,6 +1758,19 @@
 #define MDMRS		__REG(0x48000040)  /* MRS value to be written to SDRAM */
 #define BOOT_DEF	__REG(0x48000044)  /* Read-Only Boot-Time Register. Contains BOOT_SEL and PKG_SEL */
 
+/*
+ * More handy macros for PCMCIA
+ *
+ * Arg is socket number
+ */
+#define MCMEM(s)	__REG2(0x48000028, (s)<<2 )  /* Card interface Common Memory Space Socket s Timing */
+#define MCATT(s)	__REG2(0x48000030, (s)<<2 )  /* Card interface Attribute Space Socket s Timing Configuration */
+#define MCIO(s)		__REG2(0x48000038, (s)<<2 )  /* Card interface I/O Space Socket s Timing Configuration */
+
+/* MECR register defines */
+#define MECR_NOS	(1 << 0)	/* Number Of Sockets: 0 -> 1 sock, 1 -> 2 sock */
+#define MECR_CIT	(1 << 1)	/* Card Is There: 0 -> no card, 1 -> card inserted */
+
 #define MDREFR_K2FREE	(1 << 25)	/* SDRAM Free-Running Control */
 #define MDREFR_K1FREE	(1 << 24)	/* SDRAM Free-Running Control */
 #define MDREFR_K0FREE	(1 << 23)	/* SDRAM Free-Running Control */
@@ -1351,4 +1786,274 @@
 #define MDREFR_E0PIN	(1 << 12)	/* SDCKE0 Level Control/Status */
 
 
+#ifdef CONFIG_PXA27x
+
+/*
+ * Keypad
+ */
+#define KPC             __REG(0x41500000) /* Keypad Interface Control register */
+#define KPDK            __REG(0x41500008) /* Keypad Interface Direct Key register */
+#define KPREC           __REG(0x41500010) /* Keypad Interface Rotary Encoder register */
+#define KPMK            __REG(0x41500018) /* Keypad Interface Matrix Key register */
+#define KPAS            __REG(0x41500020) /* Keypad Interface Automatic Scan register */
+#define KPASMKP0        __REG(0x41500028) /* Keypad Interface Automatic Scan Multiple Key Presser register 0 */
+#define KPASMKP1        __REG(0x41500030) /* Keypad Interface Automatic Scan Multiple Key Presser register 1 */
+#define KPASMKP2        __REG(0x41500038) /* Keypad Interface Automatic Scan Multiple Key Presser register 2 */
+#define KPASMKP3        __REG(0x41500040) /* Keypad Interface Automatic Scan Multiple Key Presser register 3 */
+#define KPKDI           __REG(0x41500048) /* Keypad Interface Key Debounce Interval register */
+
+#define KPC_AS          (0x1 << 30)  /* Automatic Scan bit */
+#define KPC_ASACT       (0x1 << 29)  /* Automatic Scan on Activity */
+#define KPC_MI          (0x1 << 22)  /* Matrix interrupt bit */
+#define KPC_IMKP        (0x1 << 21)  /* Ignore Multiple Key Press */
+#define KPC_MS7         (0x1 << 20)  /* Matrix scan line 7 */
+#define KPC_MS6         (0x1 << 19)  /* Matrix scan line 6 */
+#define KPC_MS5         (0x1 << 18)  /* Matrix scan line 5 */
+#define KPC_MS4         (0x1 << 17)  /* Matrix scan line 4 */
+#define KPC_MS3         (0x1 << 16)  /* Matrix scan line 3 */
+#define KPC_MS2         (0x1 << 15)  /* Matrix scan line 2 */
+#define KPC_MS1         (0x1 << 14)  /* Matrix scan line 1 */
+#define KPC_MS0         (0x1 << 13)  /* Matrix scan line 0 */
+#define KPC_MS_ALL      (KPC_MS0 | KPC_MS1 | KPC_MS2 | KPC_MS3 | KPC_MS4 | KPC_MS5 | KPC_MS6 | KPC_MS7)
+#define KPC_ME          (0x1 << 12)  /* Matrix Keypad Enable */
+#define KPC_MIE         (0x1 << 11)  /* Matrix Interrupt Enable */
+#define KPC_DK_DEB_SEL	(0x1 <<  9)  /* Direct Keypad Debounce Select */
+#define KPC_DI          (0x1 <<  5)  /* Direct key interrupt bit */
+#define KPC_RE_ZERO_DEB (0x1 <<  4)  /* Rotary Encoder Zero Debounce */
+#define KPC_REE1        (0x1 <<  3)  /* Rotary Encoder1 Enable */
+#define KPC_REE0        (0x1 <<  2)  /* Rotary Encoder0 Enable */
+#define KPC_DE          (0x1 <<  1)  /* Direct Keypad Enable */
+#define KPC_DIE         (0x1 <<  0)  /* Direct Keypad interrupt Enable */
+
+#define KPDK_DKP        (0x1 << 31)
+#define KPDK_DK7        (0x1 <<  7)
+#define KPDK_DK6        (0x1 <<  6)
+#define KPDK_DK5        (0x1 <<  5)
+#define KPDK_DK4        (0x1 <<  4)
+#define KPDK_DK3        (0x1 <<  3)
+#define KPDK_DK2        (0x1 <<  2)
+#define KPDK_DK1        (0x1 <<  1)
+#define KPDK_DK0        (0x1 <<  0)
+
+#define KPREC_OF1       (0x1 << 31)
+#define kPREC_UF1       (0x1 << 30)
+#define KPREC_OF0       (0x1 << 15)
+#define KPREC_UF0       (0x1 << 14)
+
+#define KPMK_MKP        (0x1 << 31)
+#define KPAS_SO         (0x1 << 31)
+#define KPASMKPx_SO     (0x1 << 31)
+
+/*
+ * UHC: USB Host Controller (OHCI-like) register definitions
+ */
+#define UHC_BASE_PHYS	(0x4C000000)
+#define UHCREV		__REG(0x4C000000) /* UHC HCI Spec Revision */
+#define UHCHCON		__REG(0x4C000004) /* UHC Host Control Register */
+#define UHCCOMS		__REG(0x4C000008) /* UHC Command Status Register */
+#define UHCINTS		__REG(0x4C00000C) /* UHC Interrupt Status Register */
+#define UHCINTE		__REG(0x4C000010) /* UHC Interrupt Enable */
+#define UHCINTD		__REG(0x4C000014) /* UHC Interrupt Disable */
+#define UHCHCCA		__REG(0x4C000018) /* UHC Host Controller Comm. Area */
+#define UHCPCED		__REG(0x4C00001C) /* UHC Period Current Endpt Descr */
+#define UHCCHED		__REG(0x4C000020) /* UHC Control Head Endpt Descr */
+#define UHCCCED		__REG(0x4C000024) /* UHC Control Current Endpt Descr */
+#define UHCBHED		__REG(0x4C000028) /* UHC Bulk Head Endpt Descr */
+#define UHCBCED		__REG(0x4C00002C) /* UHC Bulk Current Endpt Descr */
+#define UHCDHEAD	__REG(0x4C000030) /* UHC Done Head */
+#define UHCFMI		__REG(0x4C000034) /* UHC Frame Interval */
+#define UHCFMR		__REG(0x4C000038) /* UHC Frame Remaining */
+#define UHCFMN		__REG(0x4C00003C) /* UHC Frame Number */
+#define UHCPERS		__REG(0x4C000040) /* UHC Periodic Start */
+#define UHCLS		__REG(0x4C000044) /* UHC Low Speed Threshold */
+#define UHCRHDA		__REG(0x4C000048) /* UHC Root Hub Descriptor A */
+#define UHCRHDB		__REG(0x4C00004C) /* UHC Root Hub Descriptor B */
+#define UHCRHS		__REG(0x4C000050) /* UHC Root Hub Status */
+#define UHCRHPS1	__REG(0x4C000054) /* UHC Root Hub Port 1 Status */
+#define UHCRHPS2	__REG(0x4C000058) /* UHC Root Hub Port 2 Status */
+#define UHCRHPS3	__REG(0x4C00005C) /* UHC Root Hub Port 3 Status */
+
+#define UHCSTAT		__REG(0x4C000060) /* UHC Status Register */
+#define UHCSTAT_UPS3	(1 << 16)	/* USB Power Sense Port3 */
+#define UHCSTAT_SBMAI	(1 << 15)	/* System Bus Master Abort Interrupt*/
+#define UHCSTAT_SBTAI	(1 << 14)	/* System Bus Target Abort Interrupt*/
+#define UHCSTAT_UPRI	(1 << 13)	/* USB Port Resume Interrupt */
+#define UHCSTAT_UPS2	(1 << 12)	/* USB Power Sense Port 2 */
+#define UHCSTAT_UPS1	(1 << 11)	/* USB Power Sense Port 1 */
+#define UHCSTAT_HTA	(1 << 10)	/* HCI Target Abort */
+#define UHCSTAT_HBA	(1 << 8)	/* HCI Buffer Active */
+#define UHCSTAT_RWUE	(1 << 7)	/* HCI Remote Wake Up Event */
+
+#define UHCHR           __REG(0x4C000064) /* UHC Reset Register */
+#define UHCHR_SSEP3	(1 << 11)	/* Sleep Standby Enable for Port3 */
+#define UHCHR_SSEP2	(1 << 10)	/* Sleep Standby Enable for Port2 */
+#define UHCHR_SSEP1	(1 << 9)	/* Sleep Standby Enable for Port1 */
+#define UHCHR_PCPL	(1 << 7)	/* Power control polarity low */
+#define UHCHR_PSPL	(1 << 6)	/* Power sense polarity low */
+#define UHCHR_SSE	(1 << 5)	/* Sleep Standby Enable */
+#define UHCHR_UIT	(1 << 4)	/* USB Interrupt Test */
+#define UHCHR_SSDC	(1 << 3)	/* Simulation Scale Down Clock */
+#define UHCHR_CGR	(1 << 2)	/* Clock Generation Reset */
+#define UHCHR_FHR	(1 << 1)	/* Force Host Controller Reset */
+#define UHCHR_FSBIR	(1 << 0)	/* Force System Bus Iface Reset */
+
+#define UHCHIE          __REG(0x4C000068) /* UHC Interrupt Enable Register*/
+#define UHCHIE_UPS3IE	(1 << 14)	/* Power Sense Port3 IntEn */
+#define UHCHIE_UPRIE	(1 << 13)	/* Port Resume IntEn */
+#define UHCHIE_UPS2IE	(1 << 12)	/* Power Sense Port2 IntEn */
+#define UHCHIE_UPS1IE	(1 << 11)	/* Power Sense Port1 IntEn */
+#define UHCHIE_TAIE	(1 << 10)	/* HCI Interface Transfer Abort
+					   Interrupt Enable*/
+#define UHCHIE_HBAIE	(1 << 8)	/* HCI Buffer Active IntEn */
+#define UHCHIE_RWIE	(1 << 7)	/* Remote Wake-up IntEn */
+
+#define UHCHIT          __REG(0x4C00006C) /* UHC Interrupt Test register */
+
+/* Camera Interface */
+#define CICR0		__REG(0x50000000)
+#define CICR1		__REG(0x50000004)
+#define CICR2		__REG(0x50000008)
+#define CICR3		__REG(0x5000000C)
+#define CICR4		__REG(0x50000010)
+#define CISR		__REG(0x50000014)
+#define CIFR		__REG(0x50000018)
+#define CITOR		__REG(0x5000001C)
+#define CIBR0		__REG(0x50000028)
+#define CIBR1		__REG(0x50000030)
+#define CIBR2		__REG(0x50000038)
+
+#define CICR0_DMAEN	(1 << 31)	/* DMA request enable */
+#define CICR0_PAR_EN	(1 << 30)	/* Parity enable */
+#define CICR0_SL_CAP_EN	(1 << 29)	/* Capture enable for slave mode */
+#define CICR0_ENB	(1 << 28)	/* Camera interface enable */
+#define CICR0_DIS	(1 << 27)	/* Camera interface disable */
+#define CICR0_SIM	(0x7 << 24)	/* Sensor interface mode mask */
+#define CICR0_TOM	(1 << 9)	/* Time-out mask */
+#define CICR0_RDAVM	(1 << 8)	/* Receive-data-available mask */
+#define CICR0_FEM	(1 << 7)	/* FIFO-empty mask */
+#define CICR0_EOLM	(1 << 6)	/* End-of-line mask */
+#define CICR0_PERRM	(1 << 5)	/* Parity-error mask */
+#define CICR0_QDM	(1 << 4)	/* Quick-disable mask */
+#define CICR0_CDM	(1 << 3)	/* Disable-done mask */
+#define CICR0_SOFM	(1 << 2)	/* Start-of-frame mask */
+#define CICR0_EOFM	(1 << 1)	/* End-of-frame mask */
+#define CICR0_FOM	(1 << 0)	/* FIFO-overrun mask */
+
+#define CICR1_TBIT	(1 << 31)	/* Transparency bit */
+#define CICR1_RGBT_CONV	(0x3 << 30)	/* RGBT conversion mask */
+#define CICR1_PPL	(0x3f << 15)	/* Pixels per line mask */
+#define CICR1_RGB_CONV	(0x7 << 12)	/* RGB conversion mask */
+#define CICR1_RGB_F	(1 << 11)	/* RGB format */
+#define CICR1_YCBCR_F	(1 << 10)	/* YCbCr format */
+#define CICR1_RGB_BPP	(0x7 << 7)	/* RGB bis per pixel mask */
+#define CICR1_RAW_BPP	(0x3 << 5)	/* Raw bis per pixel mask */
+#define CICR1_COLOR_SP	(0x3 << 3)	/* Color space mask */
+#define CICR1_DW	(0x7 << 0)	/* Data width mask */
+
+#define CICR2_BLW	(0xff << 24)	/* Beginning-of-line pixel clock
+					   wait count mask */
+#define CICR2_ELW	(0xff << 16)	/* End-of-line pixel clock
+					   wait count mask */
+#define CICR2_HSW	(0x3f << 10)	/* Horizontal sync pulse width mask */
+#define CICR2_BFPW	(0x3f << 3)	/* Beginning-of-frame pixel clock
+					   wait count mask */
+#define CICR2_FSW	(0x7 << 0)	/* Frame stabilization
+					   wait count mask */
+
+#define CICR3_BFW	(0xff << 24)	/* Beginning-of-frame line clock
+					   wait count mask */
+#define CICR3_EFW	(0xff << 16)	/* End-of-frame line clock
+					   wait count mask */
+#define CICR3_VSW	(0x3f << 10)	/* Vertical sync pulse width mask */
+#define CICR3_BFPW	(0x3f << 3)	/* Beginning-of-frame pixel clock
+					   wait count mask */
+#define CICR3_LPF	(0x3ff << 0)	/* Lines per frame mask */
+
+#define CICR4_MCLK_DLY	(0x3 << 24)	/* MCLK Data Capture Delay mask */
+#define CICR4_PCLK_EN	(1 << 23)	/* Pixel clock enable */
+#define CICR4_PCP	(1 << 22)	/* Pixel clock polarity */
+#define CICR4_HSP	(1 << 21)	/* Horizontal sync polarity */
+#define CICR4_VSP	(1 << 20)	/* Vertical sync polarity */
+#define CICR4_MCLK_EN	(1 << 19)	/* MCLK enable */
+#define CICR4_FR_RATE	(0x7 << 8)	/* Frame rate mask */
+#define CICR4_DIV	(0xff << 0)	/* Clock divisor mask */
+
+#define CISR_FTO	(1 << 15)	/* FIFO time-out */
+#define CISR_RDAV_2	(1 << 14)	/* Channel 2 receive data available */
+#define CISR_RDAV_1	(1 << 13)	/* Channel 1 receive data available */
+#define CISR_RDAV_0	(1 << 12)	/* Channel 0 receive data available */
+#define CISR_FEMPTY_2	(1 << 11)	/* Channel 2 FIFO empty */
+#define CISR_FEMPTY_1	(1 << 10)	/* Channel 1 FIFO empty */
+#define CISR_FEMPTY_0	(1 << 9)	/* Channel 0 FIFO empty */
+#define CISR_EOL	(1 << 8)	/* End of line */
+#define CISR_PAR_ERR	(1 << 7)	/* Parity error */
+#define CISR_CQD	(1 << 6)	/* Camera interface quick disable */
+#define CISR_SOF	(1 << 5)	/* Start of frame */
+#define CISR_CDD	(1 << 4)	/* Camera interface disable done */
+#define CISR_EOF	(1 << 3)	/* End of frame */
+#define CISR_IFO_2	(1 << 2)	/* FIFO overrun for Channel 2 */
+#define CISR_IFO_1	(1 << 1)	/* FIFO overrun for Channel 1 */
+#define CISR_IFO_0	(1 << 0)	/* FIFO overrun for Channel 0 */
+
+#define CIFR_FLVL2	(0x7f << 23)	/* FIFO 2 level mask */
+#define CIFR_FLVL1	(0x7f << 16)	/* FIFO 1 level mask */
+#define CIFR_FLVL0	(0xff << 8)	/* FIFO 0 level mask */
+#define CIFR_THL_0	(0x3 << 4)	/* Threshold Level for Channel 0 FIFO */
+#define CIFR_RESET_F	(1 << 3)	/* Reset input FIFOs */
+#define CIFR_FEN2	(1 << 2)	/* FIFO enable for channel 2 */
+#define CIFR_FEN1	(1 << 1)	/* FIFO enable for channel 1 */
+#define CIFR_FEN0	(1 << 0)	/* FIFO enable for channel 0 */
+
+#define SRAM_SIZE		0x40000 /* 4x64K  */
+
+#define SRAM_MEM_PHYS		0x5C000000
+
+#define IMPMCR		__REG(0x58000000) /* IM Power Management Control Reg */
+#define IMPMSR		__REG(0x58000008) /* IM Power Management Status Reg */
+
+#define IMPMCR_PC3		(0x3 << 22) /* Bank 3 Power Control */
+#define IMPMCR_PC3_RUN_MODE	(0x0 << 22) /*   Run mode */
+#define IMPMCR_PC3_STANDBY_MODE	(0x1 << 22) /*   Standby mode */
+#define IMPMCR_PC3_AUTO_MODE	(0x3 << 22) /*   Automatically controlled */
+
+#define IMPMCR_PC2		(0x3 << 20) /* Bank 2 Power Control */
+#define IMPMCR_PC2_RUN_MODE	(0x0 << 20) /*   Run mode */
+#define IMPMCR_PC2_STANDBY_MODE	(0x1 << 20) /*   Standby mode */
+#define IMPMCR_PC2_AUTO_MODE	(0x3 << 20) /*   Automatically controlled */
+
+#define IMPMCR_PC1		(0x3 << 18) /* Bank 1 Power Control */
+#define IMPMCR_PC1_RUN_MODE	(0x0 << 18) /*   Run mode */
+#define IMPMCR_PC1_STANDBY_MODE	(0x1 << 18) /*   Standby mode */
+#define IMPMCR_PC1_AUTO_MODE	(0x3 << 18) /*   Automatically controlled */
+
+#define IMPMCR_PC0		(0x3 << 16) /* Bank 0 Power Control */
+#define IMPMCR_PC0_RUN_MODE	(0x0 << 16) /*   Run mode */
+#define IMPMCR_PC0_STANDBY_MODE	(0x1 << 16) /*   Standby mode */
+#define IMPMCR_PC0_AUTO_MODE	(0x3 << 16) /*   Automatically controlled */
+
+#define IMPMCR_AW3		(1 << 11) /* Bank 3 Automatic Wake-up enable */
+#define IMPMCR_AW2		(1 << 10) /* Bank 2 Automatic Wake-up enable */
+#define IMPMCR_AW1		(1 << 9)  /* Bank 1 Automatic Wake-up enable */
+#define IMPMCR_AW0		(1 << 8)  /* Bank 0 Automatic Wake-up enable */
+
+#define IMPMCR_DST		(0xFF << 0) /* Delay Standby Time, ms */
+
+#define IMPMSR_PS3		(0x3 << 6) /* Bank 3 Power Status: */
+#define IMPMSR_PS3_RUN_MODE	(0x0 << 6) /*    Run mode */
+#define IMPMSR_PS3_STANDBY_MODE	(0x1 << 6) /*    Standby mode */
+
+#define IMPMSR_PS2		(0x3 << 4) /* Bank 2 Power Status: */
+#define IMPMSR_PS2_RUN_MODE	(0x0 << 4) /*    Run mode */
+#define IMPMSR_PS2_STANDBY_MODE	(0x1 << 4) /*    Standby mode */
+
+#define IMPMSR_PS1		(0x3 << 2) /* Bank 1 Power Status: */
+#define IMPMSR_PS1_RUN_MODE	(0x0 << 2) /*    Run mode */
+#define IMPMSR_PS1_STANDBY_MODE	(0x1 << 2) /*    Standby mode */
+
+#define IMPMSR_PS0		(0x3 << 0) /* Bank 0 Power Status: */
+#define IMPMSR_PS0_RUN_MODE	(0x0 << 0) /*    Run mode */
+#define IMPMSR_PS0_STANDBY_MODE	(0x1 << 0) /*    Standby mode */
+
+#endif
 
+#endif
diff -Nru a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-arm/arch-pxa/pxafb.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,68 @@
+/*
+ *  linux/include/asm-arm/arch-pxa/pxafb.h
+ *
+ *  Support for the xscale frame buffer.
+ *
+ *  Author:     Jean-Frederic Clere
+ *  Created:    Sep 22, 2003
+ *  Copyright:  jfclere@sinix.net
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+/*
+ * This structure describes the machine which we are running on.
+ * It is set in linux/arch/arm/mach-pxa/machine_name.c and used in the probe routine
+ * of linux/drivers/video/pxafb.c
+ */
+struct pxafb_mach_info {
+	u_long		pixclock;
+
+	u_short		xres;
+	u_short		yres;
+
+	u_char		bpp;
+	u_char		hsync_len;
+	u_char		left_margin;
+	u_char		right_margin;
+
+	u_char		vsync_len;
+	u_char		upper_margin;
+	u_char		lower_margin;
+	u_char		sync;
+
+	u_int		cmap_greyscale:1,
+			cmap_inverse:1,
+			cmap_static:1,
+			unused:29;
+
+	/* The following should be defined in LCCR0
+	 *      LCCR0_Act or LCCR0_Pas          Active or Passive
+	 *      LCCR0_Sngl or LCCR0_Dual        Single/Dual panel
+	 *      LCCR0_Mono or LCCR0_Color       Mono/Color
+	 *      LCCR0_4PixMono or LCCR0_8PixMono (in mono single mode)
+	 *      LCCR0_DMADel(Tcpu) (optional)   DMA request delay
+	 *
+	 * The following should not be defined in LCCR0:
+	 *      LCCR0_OUM, LCCR0_BM, LCCR0_QDM, LCCR0_DIS, LCCR0_EFM
+	 *      LCCR0_IUM, LCCR0_SFM, LCCR0_LDM, LCCR0_ENB
+	 */
+	u_int		lccr0;
+	/* The following should be defined in LCCR3
+	 *      LCCR3_OutEnH or LCCR3_OutEnL    Output enable polarity
+	 *      LCCR3_PixRsEdg or LCCR3_PixFlEdg Pixel clock edge type
+	 *      LCCR3_Acb(X)                    AB Bias pin frequency
+	 *      LCCR3_DPC (optional)            Double Pixel Clock mode (untested)
+	 *
+	 * The following should not be defined in LCCR3
+	 *      LCCR3_HSP, LCCR3_VSP, LCCR0_Pcd(x), LCCR3_Bpp
+	 */
+	u_int		lccr3;
+
+	void (*pxafb_backlight_power)(int);
+	void (*pxafb_lcd_power)(int);
+
+};
+void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
diff -Nru a/include/asm-arm/arch-pxa/timex.h b/include/asm-arm/arch-pxa/timex.h
--- a/include/asm-arm/arch-pxa/timex.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/arch-pxa/timex.h	Tue Jun 15 22:20:37 2004
@@ -10,8 +10,16 @@
  * published by the Free Software Foundation.
  */
 
-/*
- * PXA250/210 timer
- */
-#define CLOCK_TICK_RATE		3686400
-#define CLOCK_TICK_FACTOR	80
+#include <linux/config.h>
+
+#if defined(CONFIG_PXA25x)
+/* PXA250/210 timer base */
+#define CLOCK_TICK_RATE 3686400
+#elif defined(CONFIG_PXA27x)
+/* PXA27x timer base */
+#ifdef CONFIG_MACH_MAINSTONE
+#define CLOCK_TICK_RATE 3249600
+#else
+#define CLOCK_TICK_RATE 3250000
+#endif
+#endif
diff -Nru a/include/asm-arm/arch-rpc/ide.h b/include/asm-arm/arch-rpc/ide.h
--- a/include/asm-arm/arch-rpc/ide.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,48 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-rpc/ide.h
- *
- *  Copyright (C) 1997 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
- * published by the Free Software Foundation.
- *
- *  Modifications:
- *   29-07-1998	RMK	Major re-work of IDE architecture specific code
- */
-#include <asm/irq.h>
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-
-	memset(hw, 0, sizeof(*hw));
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += 1;
-	}
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-	if (irq)
-		*irq = 0;
-}
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void
-ide_init_default_hwifs(void)
-{
-	hw_regs_t hw;
-
-	ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
-	hw.irq = IRQ_HARDDISK;
-	ide_register_hw(&hw, NULL);
-}
diff -Nru a/include/asm-arm/arch-rpc/memory.h b/include/asm-arm/arch-rpc/memory.h
--- a/include/asm-arm/arch-rpc/memory.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-arm/arch-rpc/memory.h	Tue Jun 15 22:20:42 2004
@@ -15,39 +15,19 @@
  *   21-Mar-1999 RMK	Renamed to memory.h
  *		 RMK	Added TASK_SIZE and PAGE_OFFSET
  */
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0x10000000UL)
 
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
-
 /*
  * These are exactly the same on the RiscPC as the
  * physical memory view.
  */
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x) __virt_to_phys(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x) __phys_to_virt(x)
 
 #endif
diff -Nru a/include/asm-arm/arch-s3c2410/ide.h b/include/asm-arm/arch-s3c2410/ide.h
--- a/include/asm-arm/arch-s3c2410/ide.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,49 +0,0 @@
-/* linux/include/asm-arm/arch-s3c2410/ide.h
- *
- *  Copyright (C) 1997 Russell King
- *  Copyright (C) 2003 Simtec Electronics
- *
- * 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:
- *   29-07-1998	RMK	Major re-work of IDE architecture specific code
- *   16-05-2003 BJD	Changed to work with BAST IDE ports
- *   04-09-2003 BJD	Modifications for V2.6
- */
-
-#ifndef __ASM_ARCH_IDE_H
-#define __ASM_ARCH_IDE_H
-
-#include <asm/irq.h>
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-
-	memset(hw, 0, sizeof(*hw));
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += 1;
-	}
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-	if (irq)
-		*irq = 0;
-}
-
-/* we initialise our ide devices from the main ide core, due to problems
- * with doing it in this function
-*/
-
-#define ide_init_default_hwifs() do { } while(0)
-
-#endif /* __ASM_ARCH_IDE_H */
diff -Nru a/include/asm-arm/arch-s3c2410/memory.h b/include/asm-arm/arch-s3c2410/memory.h
--- a/include/asm-arm/arch-s3c2410/memory.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-arm/arch-s3c2410/memory.h	Tue Jun 15 22:20:43 2004
@@ -23,39 +23,16 @@
 #define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
- */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- *
  * DRAM starts at 0x30000000
-*/
-
-#define PAGE_OFFSET	(0xc0000000UL)
+ */
 #define PHYS_OFFSET	(0x30000000UL)
 
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
-
 /*
  * These are exactly the same on the S3C2410 as the
  * physical memory view.
 */
 
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x) __virt_to_phys(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x) __phys_to_virt(x)
 
 #endif
diff -Nru a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h	Tue Jun 15 22:20:42 2004
@@ -574,12 +574,7 @@
 #define S3C2410_EINFLT2	   S3C2410_GPIOREG(0x9C)
 #define S3C2410_EINFLT3	   S3C2410_GPIOREG(0xA0)
 
-/* mask: 0=enable, 1=disable
- * 1 bit EINT, 4=EINT4, 23=EINT23
- * EINT0,1,2,3 are not handled here.
-*/
-#define S3C2410_EINTMASK   S3C2410_GPIOREG(0xA4)
-#define S3C2410_EINTPEND   S3C2410_GPIOREG(0xA8)
+/* removed EINTxxxx defs from here, not meant for this */
 
 /* GSTATUS have miscellaneous information in them
  *
diff -Nru a/include/asm-arm/arch-s3c2410/regs-irq.h b/include/asm-arm/arch-s3c2410/regs-irq.h
--- a/include/asm-arm/arch-s3c2410/regs-irq.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-arm/arch-s3c2410/regs-irq.h	Tue Jun 15 22:20:40 2004
@@ -32,6 +32,11 @@
 #define S3C2410_SUBSRCPND      S3C2410_IRQREG(0x018)
 #define S3C2410_INTSUBMSK      S3C2410_IRQREG(0x01C)
 
+/* mask: 0=enable, 1=disable
+ * 1 bit EINT, 4=EINT4, 23=EINT23
+ * EINT0,1,2,3 are not handled here.
+*/
+
 #define S3C2410_EINTMASK       S3C2410_EINTREG(0x0A4)
 #define S3C2410_EINTPEND       S3C2410_EINTREG(0X0A8)
 
diff -Nru a/include/asm-arm/arch-s3c2410/time.h b/include/asm-arm/arch-s3c2410/time.h
--- a/include/asm-arm/arch-s3c2410/time.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-arm/arch-s3c2410/time.h	Tue Jun 15 22:20:39 2004
@@ -122,7 +122,7 @@
 	 *   of 11.25MHz, and a tcnt of 56250.
 	 */
 
-	if (machine_is_h1940()) {
+	if (machine_is_h1940() || machine_is_smdk2410() ) {
 		timer_ticks_usec = s3c2410_pclk / (1000*1000);
 		timer_ticks_usec /= 6;
 
diff -Nru a/include/asm-arm/arch-sa1100/keyboard.h b/include/asm-arm/arch-sa1100/keyboard.h
--- a/include/asm-arm/arch-sa1100/keyboard.h	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,23 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-sa1100/keyboard.h
- *  Created 16 Dec 1999 by Nicolas Pitre <nico@cam.org>
- *  This file contains the SA1100 architecture specific keyboard definitions
- */
-#ifndef _SA1100_KEYBOARD_H
-#define _SA1100_KEYBOARD_H
-
-#include <linux/config.h>
-#include <asm/mach-types.h>
-
-extern void gc_kbd_init_hw(void);
-extern void smartio_kbd_init_hw(void);
-
-static inline void kbd_init_hw(void)
-{
-	if (machine_is_graphicsclient())
-		gc_kbd_init_hw();
-	if (machine_is_adsbitsy())
-		smartio_kbd_init_hw();
-}
-
-#endif  /* _SA1100_KEYBOARD_H */
diff -Nru a/include/asm-arm/arch-sa1100/memory.h b/include/asm-arm/arch-sa1100/memory.h
--- a/include/asm-arm/arch-sa1100/memory.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-arm/arch-sa1100/memory.h	Tue Jun 15 22:20:36 2004
@@ -10,38 +10,11 @@
 #include <linux/config.h>
 
 /*
- * Task size: 3GB
- */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
-
-/*
  * Physical DRAM offset is 0xc0000000 on the SA1100
  */
 #define PHYS_OFFSET	(0xc0000000UL)
 
 /*
- * We take advantage of the fact that physical and virtual address can be the
- * same.  The NUMA code is handling the large holes that might exist between
- * all memory banks.
- */
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-#define __virt_to_phys(x)	(x)
-#define __phys_to_virt(x)	(x)
-
-/*
  * Virtual view <-> DMA view memory address translations
  * virt_to_bus: Used to translate the virtual address to an
  *		address suitable to be passed to set_dma_addr
@@ -50,8 +23,6 @@
  *
  * On the SA1100, bus addresses are equivalent to physical addresses.
  */
-#define __virt_to_bus__is_a_macro
-#define __bus_to_virt__is_a_macro
 #define __virt_to_bus(x)	 __virt_to_phys(x)
 #define __bus_to_virt(x)	 __phys_to_virt(x)
 
diff -Nru a/include/asm-arm/arch-shark/ide.h b/include/asm-arm/arch-shark/ide.h
--- a/include/asm-arm/arch-shark/ide.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,47 +0,0 @@
-/*
- * linux/include/asm-arm/arch-shark/ide.h
- *
- * by Alexander Schulz
- *
- * derived from:
- * linux/include/asm-arm/arch-ebsa285/ide.h
- * Copyright (c) 1998 Russell King
- */
-
-#include <asm/irq.h>
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-	int i;
-
-	memset(hw, 0, sizeof(*hw));
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += 1;
-	}
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-	if (irq)
-		*irq = 0;
-}
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void
-ide_init_default_hwifs(void)
-{
-	hw_regs_t hw;
-
-	ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
-	hw.irq = 14;
-	ide_register_hw(&hw,NULL);
-}
-
diff -Nru a/include/asm-arm/arch-shark/keyboard.h b/include/asm-arm/arch-shark/keyboard.h
--- a/include/asm-arm/arch-shark/keyboard.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,68 +0,0 @@
-/*
- * linux/include/asm-arm/arch-shark/keyboard.h
- * by Alexander Schulz
- * 
- * Derived from linux/include/asm-arm/arch-ebsa285/keyboard.h
- * (C) 1998 Russell King
- * (C) 1998 Phil Blundell
- */
-#include <linux/config.h>
-#include <linux/ioport.h>
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/system.h>
-
-#define KEYBOARD_IRQ			IRQ_ISA_KEYBOARD
-#define NR_SCANCODES			128
-
-#define kbd_disable_irq()		do { } while (0)
-#define kbd_enable_irq()		do { } while (0)
-
-extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
-extern int pckbd_getkeycode(unsigned int scancode);
-extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
-			   char raw_mode);
-extern char pckbd_unexpected_up(unsigned char keycode);
-extern void pckbd_leds(unsigned char leds);
-extern void pckbd_init_hw(void);
-extern unsigned char pckbd_sysrq_xlate[128];
-
-static inline void kbd_init_hw(void)
-{
-		k_setkeycode    = pckbd_setkeycode;
-		k_getkeycode    = pckbd_getkeycode;
-		k_translate     = pckbd_translate;
-		k_unexpected_up = pckbd_unexpected_up;
-		k_leds          = pckbd_leds;
-#ifdef CONFIG_MAGIC_SYSRQ
-		k_sysrq_key     = 0x54;
-		k_sysrq_xlate   = pckbd_sysrq_xlate;
-#endif
-		pckbd_init_hw();
-}
-
-/*
- * PC Keyboard specifics
- */
-
-/* resource allocation */
-#define kbd_request_region() request_region(0x60, 16, "keyboard")
-#define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \
-                                             "keyboard", NULL)
-
-/* How to access the keyboard macros on this platform.  */
-#define kbd_read_input() inb(KBD_DATA_REG)
-#define kbd_read_status() inb(KBD_STATUS_REG)
-#define kbd_write_output(val) outb(val, KBD_DATA_REG)
-#define kbd_write_command(val) outb(val, KBD_CNTL_REG)
-
-/* Some stoneage hardware needs delays after some operations.  */
-#define kbd_pause() do { } while(0)
-
-/*
- * Machine specific bits for the PS/2 driver
- */
-#define aux_request_irq(hand, dev_id)					\
-	request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id)
-
-#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id)
diff -Nru a/include/asm-arm/arch-shark/memory.h b/include/asm-arm/arch-shark/memory.h
--- a/include/asm-arm/arch-shark/memory.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-arm/arch-shark/memory.h	Tue Jun 15 22:21:05 2004
@@ -11,31 +11,11 @@
 #define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: = 3GB
- */
-#define PAGE_OFFSET	(0xC0000000UL)
 #define PHYS_OFFSET     (0x08000000UL)
 
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-#define __virt_to_phys(vpage) (vpage - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(ppage) (ppage - PHYS_OFFSET + PAGE_OFFSET)
-
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	__virt_to_phys(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	__phys_to_virt(x)
 
 #endif
diff -Nru a/include/asm-arm/arch-tbox/ide.h b/include/asm-arm/arch-tbox/ide.h
--- a/include/asm-arm/arch-tbox/ide.h	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,3 +0,0 @@
-/*
- * linux/include/asm-arm/arch-tbox/ide.h
- */
diff -Nru a/include/asm-arm/arch-tbox/memory.h b/include/asm-arm/arch-tbox/memory.h
--- a/include/asm-arm/arch-tbox/memory.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/arch-tbox/memory.h	Tue Jun 15 22:20:37 2004
@@ -8,37 +8,14 @@
 #define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET		(0xc0000000UL)
 #define PHYS_OFFSET		(0x80000000UL)
 
 /*
- * DRAM is contiguous
- */
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET)
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET - PHYS_OFFSET)
-#define __virt_to_phys__is_a_macro
-#define __phys_to_virt__is_a_macro
-
-/*
  * Bus view is the same as physical view
  */
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	__virt_to_phys(x)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	__phys_to_virt(x)
 
 #endif
diff -Nru a/include/asm-arm/arch-versatile/memory.h b/include/asm-arm/arch-versatile/memory.h
--- a/include/asm-arm/arch-versatile/memory.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-arm/arch-versatile/memory.h	Tue Jun 15 22:20:41 2004
@@ -17,45 +17,22 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifndef __ASM_ARCH_MMU_H
-#define __ASM_ARCH_MMU_H
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
 
 /*
- * Task size: 3GB
+ * Physical DRAM offset.
  */
-#define TASK_SIZE	(0xbf000000UL)
-#define TASK_SIZE_26	(0x04000000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (0x40000000)
-
-/*
- * Page offset: 3GB
- */
-#define PAGE_OFFSET	(0xc0000000UL)
 #define PHYS_OFFSET	(0x00000000UL)
 
 /*
- * On Versatile PB, the dram is contiguous
- */
-#define __virt_to_phys__is_a_macro
-#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET)
-#define __phys_to_virt__is_a_macro
-#define __phys_to_virt(ppage) ((ppage) + PAGE_OFFSET)
-
-/*
  * Virtual view <-> DMA view memory address translations
  * virt_to_bus: Used to translate the virtual address to an
  *              address suitable to be passed to set_dma_addr
  * bus_to_virt: Used to convert an address for DMA operations
  *              to an address that the kernel can use.
  */
-#define __virt_to_bus__is_a_macro
 #define __virt_to_bus(x)	((x) - PAGE_OFFSET)
-#define __bus_to_virt__is_a_macro
 #define __bus_to_virt(x)	((x) + PAGE_OFFSET)
 
 #endif
diff -Nru a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
--- a/include/asm-arm/atomic.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/atomic.h	Tue Jun 15 22:20:37 2004
@@ -59,50 +59,47 @@
 	: "cc");
 }
 
-static inline void atomic_sub(int i, atomic_t *v)
+static inline int atomic_add_return(int i, atomic_t *v)
 {
-	unsigned long tmp, tmp2;
+	unsigned long tmp;
+	int result;
 
-	__asm__ __volatile__("@ atomic_sub\n"
+	__asm__ __volatile__("@ atomic_add_return\n"
 "1:	ldrex	%0, [%2]\n"
-"	sub	%0, %0, %3\n"
+"	add	%0, %0, %3\n"
 "	strex	%1, %0, [%2]\n"
 "	teq	%1, #0\n"
 "	bne	1b"
-	: "=&r" (tmp), "=&r" (tmp2)
+	: "=&r" (result), "=&r" (tmp)
 	: "r" (&v->counter), "Ir" (i)
 	: "cc");
-}
 
-#define atomic_inc(v)	atomic_add(1, v)
-#define atomic_dec(v)	atomic_sub(1, v)
+	return result;
+}
 
-static inline int atomic_dec_and_test(atomic_t *v)
+static inline void atomic_sub(int i, atomic_t *v)
 {
-	unsigned long tmp;
-	int result;
+	unsigned long tmp, tmp2;
 
-	__asm__ __volatile__("@ atomic_dec_and_test\n"
+	__asm__ __volatile__("@ atomic_sub\n"
 "1:	ldrex	%0, [%2]\n"
-"	sub	%0, %0, #1\n"
+"	sub	%0, %0, %3\n"
 "	strex	%1, %0, [%2]\n"
 "	teq	%1, #0\n"
 "	bne	1b"
-	: "=&r" (result), "=&r" (tmp)
-	: "r" (&v->counter)
+	: "=&r" (tmp), "=&r" (tmp2)
+	: "r" (&v->counter), "Ir" (i)
 	: "cc");
-
-	return result == 0;
 }
 
-static inline int atomic_add_negative(int i, atomic_t *v)
+static inline int atomic_sub_return(int i, atomic_t *v)
 {
 	unsigned long tmp;
 	int result;
 
-	__asm__ __volatile__("@ atomic_add_negative\n"
+	__asm__ __volatile__("@ atomic_sub_return\n"
 "1:	ldrex	%0, [%2]\n"
-"	add	%0, %0, %3\n"
+"	sub	%0, %0, %3\n"
 "	strex	%1, %0, [%2]\n"
 "	teq	%1, #0\n"
 "	bne	1b"
@@ -110,7 +107,7 @@
 	: "r" (&v->counter), "Ir" (i)
 	: "cc");
 
-	return result < 0;
+	return result;
 }
 
 static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
@@ -147,57 +144,39 @@
 	local_irq_restore(flags);
 }
 
-static inline void atomic_sub(int i, atomic_t *v)
-{
-	unsigned long flags;
-
-	local_irq_save(flags);
-	v->counter -= i;
-	local_irq_restore(flags);
-}
-
-static inline void atomic_inc(atomic_t *v)
+static inline int atomic_add_return(int i, atomic_t *v)
 {
 	unsigned long flags;
+	int val;
 
 	local_irq_save(flags);
-	v->counter += 1;
+	val = v->counter;
+	v->counter = val += i;
 	local_irq_restore(flags);
-}
 
-static inline void atomic_dec(atomic_t *v)
-{
-	unsigned long flags;
-
-	local_irq_save(flags);
-	v->counter -= 1;
-	local_irq_restore(flags);
+	return val;
 }
 
-static inline int atomic_dec_and_test(atomic_t *v)
+static inline void atomic_sub(int i, atomic_t *v)
 {
 	unsigned long flags;
-	int val;
 
 	local_irq_save(flags);
-	val = v->counter;
-	v->counter = val -= 1;
+	v->counter -= i;
 	local_irq_restore(flags);
-
-	return val == 0;
 }
 
-static inline int atomic_add_negative(int i, atomic_t *v)
+static inline int atomic_sub_return(int i, atomic_t *v)
 {
 	unsigned long flags;
 	int val;
 
 	local_irq_save(flags);
 	val = v->counter;
-	v->counter = val += i;
+	v->counter = val -= i;
 	local_irq_restore(flags);
 
-	return val < 0;
+	return val;
 }
 
 static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
@@ -210,6 +189,14 @@
 }
 
 #endif /* __LINUX_ARM_ARCH__ */
+
+#define atomic_inc(v)		atomic_add(1, v)
+#define atomic_dec(v)		atomic_sub(1, v)
+
+#define atomic_inc_and_test(v)	(atomic_add_return(1, v) == 0)
+#define atomic_dec_and_test(v)	(atomic_sub_return(1, v) == 0)
+
+#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
 
 /* Atomic operations are already serializing on ARM */
 #define smp_mb__before_atomic_dec()	barrier()
diff -Nru a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
--- a/include/asm-arm/cacheflush.h	Tue Jun 15 22:21:00 2004
+++ b/include/asm-arm/cacheflush.h	Tue Jun 15 22:21:00 2004
@@ -291,17 +291,12 @@
  * about to change to user space.  This is the same method as used on SPARC64.
  * See update_mmu_cache for the user space part.
  */
-extern void __flush_dcache_page(struct page *);
+extern void flush_dcache_page(struct page *);
 
-static inline void flush_dcache_page(struct page *page)
-{
-	struct address_space *mapping = page_mapping(page);
-
-	if (mapping && !mapping_mapped(mapping))
-		set_bit(PG_dcache_dirty, &page->flags);
-	else
-		__flush_dcache_page(page);
-}
+#define flush_dcache_mmap_lock(mapping) \
+	spin_lock_irq(&(mapping)->tree_lock)
+#define flush_dcache_mmap_unlock(mapping) \
+	spin_unlock_irq(&(mapping)->tree_lock)
 
 #define flush_icache_user_range(vma,page,addr,len) \
 	flush_dcache_page(page)
diff -Nru a/include/asm-arm/hardware/sa1111.h b/include/asm-arm/hardware/sa1111.h
--- a/include/asm-arm/hardware/sa1111.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-arm/hardware/sa1111.h	Tue Jun 15 22:21:04 2004
@@ -405,22 +405,6 @@
 #define GPIO_C6		(1 << 22)
 #define GPIO_C7		(1 << 23)
 
-#define PA_DDR		__CCREG(0x1000)
-#define PA_DRR		__CCREG(0x1004)
-#define PA_DWR		__CCREG(0x1004)
-#define PA_SDR		__CCREG(0x1008)
-#define PA_SSR		__CCREG(0x100c)
-#define PB_DDR		__CCREG(0x1010)
-#define PB_DRR		__CCREG(0x1014)
-#define PB_DWR		__CCREG(0x1014)
-#define PB_SDR		__CCREG(0x1018)
-#define PB_SSR		__CCREG(0x101c)
-#define PC_DDR		__CCREG(0x1020)
-#define PC_DRR		__CCREG(0x1024)
-#define PC_DWR		__CCREG(0x1024)
-#define PC_SDR		__CCREG(0x1028)
-#define PC_SSR		__CCREG(0x102c)
-
 /*
  * Interrupt Controller
  *
diff -Nru a/include/asm-arm/ide.h b/include/asm-arm/ide.h
--- a/include/asm-arm/ide.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-arm/ide.h	Tue Jun 15 22:20:39 2004
@@ -17,16 +17,18 @@
 #define MAX_HWIFS	4
 #endif
 
-#include <asm/arch/ide.h>
+#if defined(CONFIG_ARCH_LH7A40X) || defined(CONFIG_ARCH_SA1100)
+# include <asm/arch/ide.h>	/* obsolete + broken */
+#endif
 
-/*
- * We always use the new IDE port registering,
- * so these are fixed here.
- */
-#define ide_default_io_base(i)		(0)
-#define ide_default_irq(b)		(0)
-
-#define ide_init_default_irq(base)	(0)
+#if !defined(CONFIG_ARCH_L7200) && !defined(CONFIG_ARCH_LH7A40X)
+# define IDE_ARCH_OBSOLETE_INIT
+# ifdef CONFIG_ARCH_CLPS7500
+#  define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
+# else
+#  define ide_default_io_ctl(base)	(0)
+# endif
+#endif /* !ARCH_L7200 && !ARCH_LH7A40X */
 
 #define __ide_mm_insw(port,addr,len)	readsw(port,addr,len)
 #define __ide_mm_insl(port,addr,len)	readsl(port,addr,len)
diff -Nru a/include/asm-arm/kmap_types.h b/include/asm-arm/kmap_types.h
--- a/include/asm-arm/kmap_types.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-arm/kmap_types.h	Tue Jun 15 22:21:02 2004
@@ -14,7 +14,6 @@
 	KM_BIO_DST_IRQ,
 	KM_PTE0,
 	KM_PTE1,
-	KM_PTE2,
 	KM_IRQ0,
 	KM_IRQ1,
 	KM_SOFTIRQ0,
diff -Nru a/include/asm-arm/memory.h b/include/asm-arm/memory.h
--- a/include/asm-arm/memory.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-arm/memory.h	Tue Jun 15 22:21:02 2004
@@ -15,6 +15,37 @@
 #include <linux/config.h>
 #include <asm/arch/memory.h>
 
+#ifndef TASK_SIZE
+/*
+ * TASK_SIZE - the maximum size of a user space task.
+ * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
+ */
+#define TASK_SIZE		(0xbf000000UL)
+#define TASK_UNMAPPED_BASE	(0x40000000UL)
+#endif
+
+/*
+ * The maximum size of a 26-bit user space task.
+ */
+#define TASK_SIZE_26		(0x04000000UL)
+
+/*
+ * Page offset: 3GB
+ */
+#ifndef PAGE_OFFSET
+#define PAGE_OFFSET		(0xc0000000UL)
+#endif
+
+/*
+ * Physical vs virtual RAM address space conversion.  These are
+ * private definitions which should NOT be used outside memory.h
+ * files.  Use virt_to_phys/phys_to_virt/__pa/__va instead.
+ */
+#ifndef __virt_to_phys
+#define __virt_to_phys(x)	((x) - PAGE_OFFSET + PHYS_OFFSET)
+#define __phys_to_virt(x)	((x) - PHYS_OFFSET + PAGE_OFFSET)
+#endif
+
 /*
  * The module space lives between the addresses given by TASK_SIZE
  * and PAGE_OFFSET - it must be within 32MB of the kernel text.
diff -Nru a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
--- a/include/asm-arm/pgtable.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-arm/pgtable.h	Tue Jun 15 22:20:38 2004
@@ -312,6 +312,13 @@
 		flush_pmd_entry(pmdp);	\
 	} while (0)
 
+#define copy_pmd(pmdpd,pmdps)		\
+	do {				\
+		pmdpd[0] = pmdps[0];	\
+		pmdpd[1] = pmdps[1];	\
+		flush_pmd_entry(pmdpd);	\
+	} while (0)
+
 #define pmd_clear(pmdp)			\
 	do {				\
 		pmdp[0] = __pmd(0);	\
@@ -406,8 +413,6 @@
  */
 #define io_remap_page_range(vma,from,phys,size,prot) \
 		remap_page_range(vma,from,phys,size,prot)
-
-typedef pte_t *pte_addr_t;
 
 #define pgtable_cache_init() do { } while (0)
 
diff -Nru a/include/asm-arm/rmap.h b/include/asm-arm/rmap.h
--- a/include/asm-arm/rmap.h	Tue Jun 15 22:20:36 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,6 +0,0 @@
-#ifndef _ARM_RMAP_H
-#define _ARM_RMAP_H
-
-#include <asm-generic/rmap.h>
-
-#endif /* _ARM_RMAP_H */
diff -Nru a/include/asm-arm/setup.h b/include/asm-arm/setup.h
--- a/include/asm-arm/setup.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-arm/setup.h	Tue Jun 15 22:20:40 2004
@@ -196,7 +196,6 @@
 
 struct meminfo {
 	int nr_banks;
-	unsigned long end;
 	struct {
 		unsigned long start;
 		unsigned long size;
diff -Nru a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
--- a/include/asm-arm/spinlock.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/spinlock.h	Tue Jun 15 22:20:37 2004
@@ -24,6 +24,7 @@
 #define spin_lock_init(x)	do { *(x) = SPIN_LOCK_UNLOCKED; } while (0)
 #define spin_is_locked(x)	((x)->lock != 0)
 #define spin_unlock_wait(x)	do { barrier(); } while (spin_is_locked(x))
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 static inline void _raw_spin_lock(spinlock_t *lock)
 {
@@ -88,7 +89,7 @@
 "	strexeq	%0, %2, [%1]\n"
 "	teq	%0, #0\n"
 "	bne	1b"
-	: "=r" (tmp)
+	: "=&r" (tmp)
 	: "r" (&rw->lock), "r" (0x80000000)
 	: "cc", "memory");
 }
@@ -150,7 +151,7 @@
 "1:	ldrex	%0, [%1]\n"
 "	teq	%0, #0\n"
 "	strexeq	%0, %2, [%1]"
-	: "=r" (tmp)
+	: "=&r" (tmp)
 	: "r" (&rw->lock), "r" (0x80000000)
 	: "cc", "memory");
 
diff -Nru a/include/asm-arm/system.h b/include/asm-arm/system.h
--- a/include/asm-arm/system.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm/system.h	Tue Jun 15 22:20:37 2004
@@ -137,22 +137,48 @@
 #define set_wmb(var, value) do { var = value; wmb(); } while (0)
 #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
 
-#define prepare_to_switch()    do { } while(0)
+#ifdef CONFIG_SMP
+/*
+ * Define our own context switch locking.  This allows us to enable
+ * interrupts over the context switch, otherwise we end up with high
+ * interrupt latency.  The real problem area is switch_mm() which may
+ * do a full cache flush.
+ */
+#define prepare_arch_switch(rq,next)					\
+do {									\
+	spin_lock(&(next)->switch_lock);				\
+	spin_unlock_irq(&(rq)->lock);					\
+} while (0)
+
+#define finish_arch_switch(rq,prev)					\
+	spin_unlock(&(prev)->switch_lock)
+
+#define task_running(rq,p)						\
+	((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
+#else
+/*
+ * Our UP-case is more simple, but we assume knowledge of how
+ * spin_unlock_irq() and friends are implemented.  This avoids
+ * us needlessly decrementing and incrementing the preempt count.
+ */
+#define prepare_arch_switch(rq,next)	local_irq_enable()
+#define finish_arch_switch(rq,prev)	spin_unlock(&(rq)->lock)
+#define task_running(rq,p)		((rq)->curr == (p))
+#endif
 
 /*
  * switch_to(prev, next) should switch from task `prev' to `next'
- * `prev' will never be the same as `next'.
- * The `mb' is to tell GCC not to cache `current' across this call.
+ * `prev' will never be the same as `next'.  schedule() itself
+ * contains the memory barrier to tell GCC not to cache `current'.
  */
 struct thread_info;
 struct task_struct;
 extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *);
 
-#define switch_to(prev,next,last)						\
-	do {									\
-		last = __switch_to(prev,prev->thread_info,next->thread_info);	\
-		mb();								\
-	} while (0)
+#define switch_to(prev,next,last)					\
+do {									\
+	last = __switch_to(prev,prev->thread_info,next->thread_info);	\
+} while (0)
 
 /*
  * CPU interrupt mask handling.
diff -Nru a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h
--- a/include/asm-arm/thread_info.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-arm/thread_info.h	Tue Jun 15 22:20:40 2004
@@ -40,7 +40,7 @@
 
 /*
  * low level task data that entry.S needs immediate access to.
- * We assume cpu_context follows immedately after cpu_domain.
+ * __switch_to() assumes cpu_context follows immediately after cpu_domain.
  */
 struct thread_info {
 	unsigned long		flags;		/* low level flags */
diff -Nru a/include/asm-arm/types.h b/include/asm-arm/types.h
--- a/include/asm-arm/types.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-arm/types.h	Tue Jun 15 22:20:36 2004
@@ -52,6 +52,8 @@
 typedef u32 dma_addr_t;
 typedef u32 dma64_addr_t;
 
+typedef unsigned int kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h
--- a/include/asm-arm/uaccess.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-arm/uaccess.h	Tue Jun 15 22:20:42 2004
@@ -13,7 +13,7 @@
  */
 #include <linux/sched.h>
 #include <asm/errno.h>
-#include <asm/arch/memory.h>
+#include <asm/memory.h>
 #include <asm/domain.h>
 #include <asm/system.h>
 
diff -Nru a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
--- a/include/asm-arm/unistd.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-arm/unistd.h	Tue Jun 15 22:21:03 2004
@@ -448,6 +448,27 @@
   __syscall_return(type,__res);						\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
@@ -499,6 +520,8 @@
 	return sys_wait4((int)pid, wait_stat, options, NULL);
 }
 
+extern long execve(const char *file, char **argv, char **envp);
+
 struct pt_regs;
 asmlinkage int sys_execve(char *filenamei, char **argv, char **envp,
 			struct pt_regs *regs);
@@ -513,12 +536,6 @@
 				const struct sigaction __user *act,
 				struct sigaction __user *oact,
 				size_t sigsetsize);
-
-/*
- * The following two can't be eliminated yet - they rely on
- * specific conditions.
- */
-static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp);
 
 #endif
 
diff -Nru a/include/asm-arm26/cacheflush.h b/include/asm-arm26/cacheflush.h
--- a/include/asm-arm26/cacheflush.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-arm26/cacheflush.h	Tue Jun 15 22:20:43 2004
@@ -24,7 +24,6 @@
 #define flush_cache_mm(mm)                      do { } while (0)
 #define flush_cache_range(vma,start,end)        do { } while (0)
 #define flush_cache_page(vma,vmaddr)            do { } while (0)
-#define flush_page_to_ram(page)                 do { } while (0)
 #define flush_cache_vmap(start, end)		do { } while (0)
 #define flush_cache_vunmap(start, end)		do { } while (0)
 
@@ -32,6 +31,8 @@
 #define clean_dcache_range(start,end)           do { } while (0)
 #define flush_dcache_range(start,end)           do { } while (0)
 #define flush_dcache_page(page)                 do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define clean_dcache_entry(_s)                  do { } while (0)
 #define clean_cache_entry(_start)               do { } while (0)
 
diff -Nru a/include/asm-arm26/ide.h b/include/asm-arm26/ide.h
--- a/include/asm-arm26/ide.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-arm26/ide.h	Tue Jun 15 22:21:05 2004
@@ -26,51 +26,8 @@
 #define __ide_mm_outsw(port,addr,len)   writesw(port,addr,len)
 #define __ide_mm_outsl(port,addr,len)   writesl(port,addr,len)
 
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-				       unsigned long ctrl_port, int *irq)
-{
-	unsigned long reg = data_port;
-        int i;
-
-        for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-                hw->io_ports[i] = reg;
-                reg += 1;
-        }
-	hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-        if (irq)
-                *irq = 0;
-}
-
-#define ide_init_default_irq(base)	(0)
-
-/*
- * This registers the standard ports for this architecture with the IDE
- * driver.
- */
-static __inline__ void ide_init_default_hwifs(void)
-{
-        if (machine_is_a5k()) {
-                hw_regs_t hw;
-
-                memset(&hw, 0, sizeof(hw));
-
-                ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
-                hw.irq = IRQ_HARDDISK;
-                ide_register_hw(&hw,NULL);
-        }
-}
-
-
-/*
- * We always use the new IDE port registering,
- * so these are fixed here.
- */
-#define ide_default_io_base(i)		(0)
-#define ide_default_irq(b)		(0)
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	(0)
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-arm26/pgtable.h b/include/asm-arm26/pgtable.h
--- a/include/asm-arm26/pgtable.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-arm26/pgtable.h	Tue Jun 15 22:20:37 2004
@@ -290,8 +290,6 @@
 #define io_remap_page_range(vma,from,phys,size,prot) \
 		remap_page_range(vma,from,phys,size,prot)
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASMARM_PGTABLE_H */
diff -Nru a/include/asm-arm26/rmap.h b/include/asm-arm26/rmap.h
--- a/include/asm-arm26/rmap.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,66 +0,0 @@
-#ifndef _ARM_RMAP_H
-#define _ARM_RMAP_H
-
-/*
- * linux/include/asm-arm26/proc-armv/rmap.h
- *
- * Architecture dependant parts of the reverse mapping code,
- *
- * ARM is different since hardware page tables are smaller than
- * the page size and Linux uses a "duplicate" one with extra info.
- * For rmap this means that the first 2 kB of a page are the hardware
- * page tables and the last 2 kB are the software page tables.
- */
-
-static inline void pgtable_add_rmap(struct page *page, struct mm_struct * mm, unsigned long address)
-{
-        page->mapping = (void *)mm;
-        page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1);
-        inc_page_state(nr_page_table_pages);
-}
-
-static inline void pgtable_remove_rmap(struct page *page)
-{
-        page->mapping = NULL;
-        page->index = 0;
-        dec_page_state(nr_page_table_pages);
-}
-
-static inline struct mm_struct * ptep_to_mm(pte_t * ptep)
-{
-	struct page * page = virt_to_page(ptep);
-        return (struct mm_struct *)page->mapping;
-}
-
-/* The page table takes half of the page */
-#define PTE_MASK  ((PAGE_SIZE / 2) - 1)
-
-static inline unsigned long ptep_to_address(pte_t * ptep)
-{
-        struct page * page = virt_to_page(ptep);
-        unsigned long low_bits;
-
-        low_bits = ((unsigned long)ptep & PTE_MASK) * PTRS_PER_PTE;
-        return page->index + low_bits;
-}
- 
-//FIXME!!! IS these correct?
-static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
-{
-        return (pte_addr_t)ptep;
-}
-
-static inline pte_t *rmap_ptep_map(pte_addr_t pte_paddr)
-{
-        return (pte_t *)pte_paddr;
-}
-
-static inline void rmap_ptep_unmap(pte_t *pte)
-{
-        return;
-}
-
-
-//#include <asm-generic/rmap.h>
-
-#endif /* _ARM_RMAP_H */
diff -Nru a/include/asm-arm26/types.h b/include/asm-arm26/types.h
--- a/include/asm-arm26/types.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-arm26/types.h	Tue Jun 15 22:20:36 2004
@@ -52,6 +52,8 @@
 typedef u32 dma_addr_t;
 typedef u32 dma64_addr_t;
 
+typedef unsigned int kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-arm26/unistd.h b/include/asm-arm26/unistd.h
--- a/include/asm-arm26/unistd.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-arm26/unistd.h	Tue Jun 15 22:21:05 2004
@@ -375,6 +375,31 @@
   __syscall_return(type,__res);								\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
diff -Nru a/include/asm-cris/arch-v10/cache.h b/include/asm-cris/arch-v10/cache.h
--- a/include/asm-cris/arch-v10/cache.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-cris/arch-v10/cache.h	Tue Jun 15 22:20:43 2004
@@ -3,6 +3,7 @@
 
 /* Etrax 100LX have 32-byte cache-lines. */
 #define L1_CACHE_BYTES 32
+#define L1_CACHE_SHIFT 5
 #define L1_CACHE_SHIFT_MAX 5
 
 #endif /* _ASM_ARCH_CACHE_H */
diff -Nru a/include/asm-cris/arch-v10/irq.h b/include/asm-cris/arch-v10/irq.h
--- a/include/asm-cris/arch-v10/irq.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-cris/arch-v10/irq.h	Tue Jun 15 22:20:36 2004
@@ -8,6 +8,11 @@
 #include <asm/arch/sv_addr_ag.h>
 
 #define NR_IRQS 32
+
+/* The first vector number used for IRQs in v10 is really 0x20 */
+/* but all the code and constants are offseted to make 0 the first */
+#define FIRST_IRQ 0
+
 #define SOME_IRQ_NBR        IO_BITNR(R_VECT_MASK_RD, some)   /* 0 ? */
 #define NMI_IRQ_NBR         IO_BITNR(R_VECT_MASK_RD, nmi)    /* 1 */
 #define TIMER0_IRQ_NBR      IO_BITNR(R_VECT_MASK_RD, timer0) /* 2 */
diff -Nru a/include/asm-cris/arch-v10/offset.h b/include/asm-cris/arch-v10/offset.h
--- a/include/asm-cris/arch-v10/offset.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-cris/arch-v10/offset.h	Tue Jun 15 22:20:37 2004
@@ -25,7 +25,7 @@
 #define THREAD_usp 4 /* offsetof(struct thread_struct, usp) */
 #define THREAD_dccr 8 /* offsetof(struct thread_struct, dccr) */
 
-#define TASK_pid 121 /* offsetof(struct task_struct, pid) */
+#define TASK_pid 133 /* offsetof(struct task_struct, pid) */
 
 #define LCLONE_VM 256 /* CLONE_VM */
 #define LCLONE_UNTRACED 8388608 /* CLONE_UNTRACED */
diff -Nru a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h
--- a/include/asm-cris/atomic.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-cris/atomic.h	Tue Jun 15 22:20:41 2004
@@ -56,6 +56,8 @@
 	return retval;
 }
 
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
+
 extern __inline__ int atomic_sub_return(int i, volatile atomic_t *v)
 {
 	unsigned long flags;
diff -Nru a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
--- a/include/asm-cris/bitops.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-cris/bitops.h	Tue Jun 15 22:21:02 2004
@@ -296,6 +296,50 @@
 }
 
 /**
+ * find_next_bit - find the first set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+static __inline__ int find_next_bit(void *addr, int size, int offset)
+{
+	unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
+        unsigned long result = offset & ~31UL;
+        unsigned long tmp;
+
+        if (offset >= size)
+                return size;
+        size -= result;
+        offset &= 31UL;
+        if (offset) {
+                tmp = *(p++);
+                tmp &= (~0UL << offset);
+                if (size < 32)
+                        goto found_first;
+                if (tmp)
+                        goto found_middle;
+                size -= 32;
+                result += 32;
+        }
+        while (size & ~31UL) {
+                if ((tmp = *(p++)))
+                        goto found_middle;
+                result += 32;
+                size -= 32;
+        }
+        if (!size)
+                return result;
+        tmp = *p;
+
+found_first:
+        tmp &= (~0UL >> (32 - size));
+        if (tmp == 0UL)        /* Are any bits set? */
+                return result + size; /* Nope. */
+found_middle:
+        return result + __ffs(tmp);
+}
+
+/**
  * find_first_zero_bit - find the first zero bit in a memory region
  * @addr: The address to start the search at
  * @size: The maximum size to search
@@ -306,6 +350,8 @@
 
 #define find_first_zero_bit(addr, size) \
         find_next_zero_bit((addr), (size), 0)
+#define find_first_bit(addr, size) \
+        find_next_bit((addr), (size), 0)
 
 #define ext2_set_bit                 test_and_set_bit
 #define ext2_set_bit_atomic(l,n,a)   test_and_set_bit(n,a)
diff -Nru a/include/asm-cris/cacheflush.h b/include/asm-cris/cacheflush.h
--- a/include/asm-cris/cacheflush.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-cris/cacheflush.h	Tue Jun 15 22:20:35 2004
@@ -11,8 +11,9 @@
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
 #define flush_cache_page(vma, vmaddr)		do { } while (0)
-#define flush_page_to_ram(page)			do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_range(start, end)		do { } while (0)
 #define flush_icache_page(vma,pg)		do { } while (0)
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
diff -Nru a/include/asm-cris/dma-mapping.h b/include/asm-cris/dma-mapping.h
--- a/include/asm-cris/dma-mapping.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-cris/dma-mapping.h	Tue Jun 15 22:21:03 2004
@@ -1 +1,125 @@
-#include <asm-generic/dma-mapping.h>
+#ifndef _ASM_CRIS_DMA_MAPPING_H
+#define _ASM_CRIS_DMA_MAPPING_H
+
+#include "scatterlist.h"
+
+static inline int
+dma_supported(struct device *dev, u64 mask)
+{
+	BUG();
+	return 0;
+}
+
+static inline int
+dma_set_mask(struct device *dev, u64 dma_mask)
+{
+	BUG();
+	return 1;
+}
+
+static inline void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		   int flag)
+{
+	BUG();
+	return NULL;
+}
+
+static inline void
+dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
+		    dma_addr_t dma_handle)
+{
+	BUG();
+}
+
+static inline dma_addr_t
+dma_map_single(struct device *dev, void *cpu_addr, size_t size,
+	       enum dma_data_direction direction)
+{
+	BUG();
+	return 0;
+}
+
+static inline void
+dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
+		 enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline dma_addr_t
+dma_map_page(struct device *dev, struct page *page,
+	     unsigned long offset, size_t size,
+	     enum dma_data_direction direction)
+{
+	BUG();
+	return 0;
+}
+
+static inline void
+dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
+	       enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline int
+dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+	   enum dma_data_direction direction)
+{
+	BUG();
+	return 1;
+}
+
+static inline void
+dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
+	     enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size,
+		enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
+	    enum dma_data_direction direction)
+{
+	BUG();
+}
+
+/* Now for the API extensions over the pci_ one */
+
+#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
+#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
+#define dma_is_consistent(d)	(1)
+
+static inline int
+dma_get_cache_alignment(void)
+{
+	/* no easy way to get cache size on all processors, so return
+	 * the maximum possible, to be safe */
+	return (1 << L1_CACHE_SHIFT_MAX);
+}
+
+static inline void
+dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
+		      unsigned long offset, size_t size,
+		      enum dma_data_direction direction)
+{
+	BUG();
+}
+
+static inline void
+dma_cache_sync(void *vaddr, size_t size,
+	       enum dma_data_direction direction)
+{
+	BUG();
+}
+
+#endif
+
diff -Nru a/include/asm-cris/fasttimer.h b/include/asm-cris/fasttimer.h
--- a/include/asm-cris/fasttimer.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-cris/fasttimer.h	Tue Jun 15 22:20:42 2004
@@ -1,4 +1,4 @@
-/* $Id: fasttimer.h,v 1.2 2002/12/11 13:03:43 starvik Exp $
+/* $Id: fasttimer.h,v 1.3 2004/05/14 10:19:19 starvik Exp $
  * linux/include/asm-cris/fasttimer.h
  *
  * Fast timers for ETRAX100LX
@@ -23,6 +23,8 @@
   unsigned long data;
   const char *name;
 };
+
+extern struct fast_timer *fast_timer_list;
 
 void start_one_shot_timer(struct fast_timer *t,
                           fast_timer_function_type *function,
diff -Nru a/include/asm-cris/io.h b/include/asm-cris/io.h
--- a/include/asm-cris/io.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-cris/io.h	Tue Jun 15 22:20:43 2004
@@ -72,6 +72,8 @@
 
 #define IO_SPACE_LIMIT 0xffff
 #define inb(x) (0)
+#define inw(x) (0)
+#define inl(x) (0)
 #define outb(x,y)
 #define outw(x,y)
 #define outl(x,y)
diff -Nru a/include/asm-cris/ioctl.h b/include/asm-cris/ioctl.h
--- a/include/asm-cris/ioctl.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-cris/ioctl.h	Tue Jun 15 22:20:39 2004
@@ -53,11 +53,18 @@
 	 ((nr)   << _IOC_NRSHIFT) | \
 	 ((size) << _IOC_SIZESHIFT))
 
+/* provoke compile error for invalid uses of size argument */
+extern int __invalid_size_argument_for_IOC;
+#define _IOC_TYPECHECK(t) \
+	((sizeof(t) == sizeof(t[1]) && \
+	  sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
+	  sizeof(t) : __invalid_size_argument_for_IOC)
+
 /* used to create numbers */
 #define _IO(type,nr)		_IOC(_IOC_NONE,(type),(nr),0)
-#define _IOR(type,nr,size)	_IOC(_IOC_READ,(type),(nr),sizeof(size))
-#define _IOW(type,nr,size)	_IOC(_IOC_WRITE,(type),(nr),sizeof(size))
-#define _IOWR(type,nr,size)	_IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOR(type,nr,size)	_IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
+#define _IOW(type,nr,size)	_IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
+#define _IOWR(type,nr,size)	_IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
 
 /* used to decode ioctl numbers.. */
 #define _IOC_DIR(nr)		(((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
diff -Nru a/include/asm-cris/local.h b/include/asm-cris/local.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-cris/local.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1 @@
+#include <asm-generic/local.h>
diff -Nru a/include/asm-cris/page.h b/include/asm-cris/page.h
--- a/include/asm-cris/page.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-cris/page.h	Tue Jun 15 22:20:38 2004
@@ -6,7 +6,11 @@
 
 /* PAGE_SHIFT determines the page size */
 #define PAGE_SHIFT	13
+#ifndef __ASSEMBLY__
 #define PAGE_SIZE	(1UL << PAGE_SHIFT)
+#else
+#define PAGE_SIZE	(1 << PAGE_SHIFT)
+#endif
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 
 #ifdef __KERNEL__
@@ -20,10 +24,12 @@
 /*
  * These are used to make use of C type-checking..
  */
+#ifndef __ASSEMBLY__
 typedef struct { unsigned long pte; } pte_t;
 typedef struct { unsigned long pmd; } pmd_t;
 typedef struct { unsigned long pgd; } pgd_t;
 typedef struct { unsigned long pgprot; } pgprot_t;
+#endif
 
 #define pte_val(x)	((x).pte)
 #define pmd_val(x)	((x).pmd)
@@ -51,7 +57,7 @@
 
 #define virt_to_page(kaddr)    (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT))
 #define VALID_PAGE(page)       (((page) - mem_map) < max_mapnr)
-#define virt_addr_valid(kaddr)	pfn_valid((kaddr) >> PAGE_SHIFT)
+#define virt_addr_valid(kaddr)	pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT)
 
 /* convert a page (based on mem_map and forward) to a physical address
  * do this by figuring out the virtual address and then use __pa
@@ -72,8 +78,6 @@
          BUG(); \
 } while (0)
 
-#endif /* __ASSEMBLY__ */
-
 /* Pure 2^n version of get_order */
 static inline int get_order(unsigned long size)
 {
@@ -87,6 +91,7 @@
 	} while (size);
 	return order;
 }
+#endif /* __ASSEMBLY__ */
 
 #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
diff -Nru a/include/asm-cris/pci.h b/include/asm-cris/pci.h
--- a/include/asm-cris/pci.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-cris/pci.h	Tue Jun 15 22:20:35 2004
@@ -1,9 +1,13 @@
 #ifndef __ASM_CRIS_PCI_H
 #define __ASM_CRIS_PCI_H
 
+#include <asm/scatterlist.h>
+#include <asm-generic/pci-dma-compat.h>
+
 /* ETRAX chips don't have a PCI bus. This file is just here because some stupid .c code
  * includes it even if CONFIG_PCI is not set.
  */
+#define PCI_DMA_BUS_IS_PHYS       (1)
 
 #endif /* __ASM_CRIS_PCI_H */
 
diff -Nru a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
--- a/include/asm-cris/pgtable.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-cris/pgtable.h	Tue Jun 15 22:20:36 2004
@@ -5,9 +5,11 @@
 #ifndef _CRIS_PGTABLE_H
 #define _CRIS_PGTABLE_H
 
+#ifndef __ASSEMBLY__
 #include <linux/config.h>
 #include <linux/sched.h>
 #include <asm/mmu.h>
+#endif
 #include <asm/arch/pgtable.h>
 
 /*
@@ -21,8 +23,9 @@
  * This file contains the functions and defines necessary to modify and use
  * the CRIS page table tree.
  */
-
+#ifndef __ASSEMBLY__
 extern void paging_init(void);
+#endif
 
 /* Certain architectures need to do special things when pte's
  * within a page table are directly modified.  Thus, the following
@@ -72,8 +75,10 @@
 #define FIRST_USER_PGD_NR       0
 
 /* zero page used for uninitialized stuff */
+#ifndef __ASSEMBLY__
 extern unsigned long empty_zero_page;
 #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
+#endif
 
 /* number of bits that fit into a memory pointer */
 #define BITS_PER_PTR			(8*sizeof(unsigned long))
@@ -104,6 +109,8 @@
 #define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)
 #define pmd_clear(xp)	do { pmd_val(*(xp)) = 0; } while (0)
 
+#ifndef __ASSEMBLY__
+
 /*
  * The "pgd_xxx()" functions here are trivial for a folded two-level
  * setup: the pgd is never bad, and a pmd always exists (as it's folded
@@ -337,6 +344,5 @@
 #define pte_to_pgoff(x)	(pte_val(x) >> 6)
 #define pgoff_to_pte(x)	__pte(((x) << 6) | _PAGE_FILE)
 
-typedef pte_t *pte_addr_t;
-
+#endif /* __ASSEMBLY__ */
 #endif /* _CRIS_PGTABLE_H */
diff -Nru a/include/asm-cris/ptrace.h b/include/asm-cris/ptrace.h
--- a/include/asm-cris/ptrace.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-cris/ptrace.h	Tue Jun 15 22:20:41 2004
@@ -3,8 +3,10 @@
 
 #include <asm/arch/ptrace.h>
 
+#ifdef __KERNEL__
 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
 #define PTRACE_GETREGS            12
 #define PTRACE_SETREGS            13
+#endif
 
 #endif /* _CRIS_PTRACE_H */
diff -Nru a/include/asm-cris/rmap.h b/include/asm-cris/rmap.h
--- a/include/asm-cris/rmap.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _CRIS_RMAP_H
-#define _CRIS_RMAP_H
-
-/* nothing to see, move along :) */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-cris/rtc.h b/include/asm-cris/rtc.h
--- a/include/asm-cris/rtc.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-cris/rtc.h	Tue Jun 15 22:20:36 2004
@@ -100,6 +100,8 @@
 #define RTC_RD_TIME		_IOR(RTC_MAGIC, 0x09, struct rtc_time)	/* Read RTC time. */
 #define RTC_SET_TIME		_IOW(RTC_MAGIC, 0x0a, struct rtc_time)	/* Set RTC time. */
 #define RTC_SET_CHARGE  	_IOW(RTC_MAGIC, 0x0b, int) 		
-#define RTC_MAX_IOCTL 0x0b
+#define RTC_VLOW_RD     _IOR(RTC_MAGIC, 0x11, int)  /* Voltage Low detector */
+#define RTC_VLOW_SET    _IO(RTC_MAGIC, 0x12)        /* Clear voltage low information */
+#define RTC_MAX_IOCTL 0x12
 
 #endif /* __RTC_H__ */
diff -Nru a/include/asm-cris/sections.h b/include/asm-cris/sections.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-cris/sections.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,7 @@
+#ifndef _CRIS_SECTIONS_H
+#define _CRIS_SECTIONS_H
+
+/* nothing to see, move along */
+#include <asm-generic/sections.h>
+
+#endif
diff -Nru a/include/asm-cris/semaphore-helper.h b/include/asm-cris/semaphore-helper.h
--- a/include/asm-cris/semaphore-helper.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-cris/semaphore-helper.h	Tue Jun 15 22:21:04 2004
@@ -52,7 +52,7 @@
 		dec(&sem->waking);
 		ret = 1;
 	} else if (signal_pending(tsk)) {
-		count_inc(&sem->count);
+		inc(&sem->count);
 		ret = -EINTR;
 	}
 	local_irq_restore(flags);
@@ -67,7 +67,7 @@
 	local_save_flags(flags);
 	local_irq_disable();
 	if (read(&sem->waking) <= 0)
-		count_inc(&sem->count);
+		inc(&sem->count);
 	else {
 		dec(&sem->waking);
 		ret = 0;
diff -Nru a/include/asm-cris/semaphore.h b/include/asm-cris/semaphore.h
--- a/include/asm-cris/semaphore.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-cris/semaphore.h	Tue Jun 15 22:20:39 2004
@@ -21,7 +21,7 @@
 int printk(const char *fmt, ...);
 
 struct semaphore {
-	int count; /* not atomic_t since we do the atomicity here already */
+	atomic_t count;
 	atomic_t waking;
 	wait_queue_head_t wait;
 #if WAITQUEUE_DEBUG
@@ -36,7 +36,7 @@
 #endif
 
 #define __SEMAPHORE_INITIALIZER(name,count)             \
-        { count, ATOMIC_INIT(0),          \
+        { ATOMIC_INIT(count), ATOMIC_INIT(0),           \
           __WAIT_QUEUE_HEAD_INITIALIZER((name).wait)    \
           __SEM_DEBUG_INIT(name) }
 
@@ -84,7 +84,7 @@
 	/* atomically decrement the semaphores count, and if its negative, we wait */
 	local_save_flags(flags);
 	local_irq_disable();
-	failed = --(sem->count) < 0;
+	failed = --(sem->count.counter) < 0;
 	local_irq_restore(flags);
 	if(failed) {
 		__down(sem);
@@ -110,7 +110,7 @@
 	/* atomically decrement the semaphores count, and if its negative, we wait */
 	local_save_flags(flags);
 	local_irq_disable();
-	failed = --(sem->count) < 0;
+	failed = --(sem->count.counter) < 0;
 	local_irq_restore(flags);
 	if(failed)
 		failed = __down_interruptible(sem);
@@ -128,7 +128,7 @@
 
 	local_save_flags(flags);
 	local_irq_disable();
-	failed = --(sem->count) < 0;
+	failed = --(sem->count.counter) < 0;
 	local_irq_restore(flags);
 	if(failed)
 		failed = __down_trylock(sem);
@@ -153,7 +153,7 @@
 	/* atomically increment the semaphores count, and if it was negative, we wake people */
 	local_save_flags(flags);
 	local_irq_disable();
-	wakeup = ++(sem->count) <= 0;
+	wakeup = ++(sem->count.counter) <= 0;
 	local_irq_restore(flags);
 	if(wakeup) {
 		__up(sem);
diff -Nru a/include/asm-cris/termbits.h b/include/asm-cris/termbits.h
--- a/include/asm-cris/termbits.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-cris/termbits.h	Tue Jun 15 22:20:37 2004
@@ -154,7 +154,7 @@
 #define  B6250000  0010007
 /* etrax 200 supports this as well */
 #define  B12500000 0010010
-#define CIBAUD	  002003600000	/* input baud rate */
+#define CIBAUD	  002003600000	/* input baud rate (used in v32) */
 /* The values for CIBAUD bits are the same as the values for CBAUD and CBAUDEX
  * shifted left IBSHIFT bits.
  */
diff -Nru a/include/asm-cris/types.h b/include/asm-cris/types.h
--- a/include/asm-cris/types.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-cris/types.h	Tue Jun 15 22:20:41 2004
@@ -50,6 +50,9 @@
 /* Dma addresses are 32-bits wide, just like our other addresses.  */
  
 typedef u32 dma_addr_t;
+typedef u32 dma64_addr_t;
+
+typedef unsigned int kmem_bufctl_t;
 
 #endif /* __ASSEMBLY__ */
 
diff -Nru a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
--- a/include/asm-cris/unistd.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-cris/unistd.h	Tue Jun 15 22:21:02 2004
@@ -275,16 +275,53 @@
 #define __NR_clock_nanosleep	(__NR_timer_create+8)
 #define __NR_statfs64		268
 #define __NR_fstatfs64		269
+#define __NR_tgkill		270
+#define __NR_utimes		271
+#define __NR_fadvise64_64	272
+#define __NR_vserver		273
+#define __NR_mbind		274
+#define __NR_get_mempolicy	275
+#define __NR_set_mempolicy	276
+#define __NR_mq_open 		277
+#define __NR_mq_unlink		(__NR_mq_open+1)
+#define __NR_mq_timedsend	(__NR_mq_open+2)
+#define __NR_mq_timedreceive	(__NR_mq_open+3)
+#define __NR_mq_notify		(__NR_mq_open+4)
+#define __NR_mq_getsetattr	(__NR_mq_open+5)
  
-#define NR_syscalls 270
-
+#define NR_syscalls 283
 
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
 #include <linux/types.h>
+#include <linux/linkage.h>
 
 /*
  * we need this inline - forking from kernel space will result
diff -Nru a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
--- a/include/asm-generic/pgtable.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-generic/pgtable.h	Tue Jun 15 22:20:38 2004
@@ -8,12 +8,29 @@
  *  - update the page tables
  *  - inform the TLB about the new one
  *
- * We hold the mm semaphore for reading and vma->vm_mm->page_table_lock
+ * We hold the mm semaphore for reading and vma->vm_mm->page_table_lock.
+ *
+ * Note: the old pte is known to not be writable, so we don't need to
+ * worry about dirty bits etc getting lost.
  */
 #define ptep_establish(__vma, __address, __ptep, __entry)		\
-do {									\
+do {				  					\
 	set_pte(__ptep, __entry);					\
 	flush_tlb_page(__vma, __address);				\
+} while (0)
+#endif
+
+#ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
+/*
+ * Largely same as above, but only sets the access flags (dirty,
+ * accessed, and writable). Furthermore, we know it always gets set
+ * to a "more permissive" setting, which allows most architectures
+ * to optimize this.
+ */
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
+do {				  					  \
+	set_pte(__ptep, __entry);					  \
+	flush_tlb_page(__vma, __address);				  \
 } while (0)
 #endif
 
diff -Nru a/include/asm-generic/rmap.h b/include/asm-generic/rmap.h
--- a/include/asm-generic/rmap.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,91 +0,0 @@
-#ifndef _GENERIC_RMAP_H
-#define _GENERIC_RMAP_H
-/*
- * linux/include/asm-generic/rmap.h
- *
- * Architecture dependent parts of the reverse mapping code,
- * this version should work for most architectures with a
- * 'normal' page table layout.
- *
- * We use the struct page of the page table page to find out
- * the process and full address of a page table entry:
- * - page->mapping points to the process' mm_struct
- * - page->index has the high bits of the address
- * - the lower bits of the address are calculated from the
- *   offset of the page table entry within the page table page
- *
- * For CONFIG_HIGHPTE, we need to represent the address of a pte in a
- * scalar pte_addr_t.  The pfn of the pte's page is shifted left by PAGE_SIZE
- * bits and is then ORed with the byte offset of the pte within its page.
- *
- * For CONFIG_HIGHMEM4G, the pte_addr_t is 32 bits.  20 for the pfn, 12 for
- * the offset.
- *
- * For CONFIG_HIGHMEM64G, the pte_addr_t is 64 bits.  52 for the pfn, 12 for
- * the offset.
- */
-#include <linux/mm.h>
-
-static inline void pgtable_add_rmap(struct page * page, struct mm_struct * mm, unsigned long address)
-{
-#ifdef BROKEN_PPC_PTE_ALLOC_ONE
-	/* OK, so PPC calls pte_alloc() before mem_map[] is setup ... ;( */
-	extern int mem_init_done;
-
-	if (!mem_init_done)
-		return;
-#endif
-	page->mapping = (void *)mm;
-	page->index = address & ~((PTRS_PER_PTE * PAGE_SIZE) - 1);
-	inc_page_state(nr_page_table_pages);
-}
-
-static inline void pgtable_remove_rmap(struct page * page)
-{
-	page->mapping = NULL;
-	page->index = 0;
-	dec_page_state(nr_page_table_pages);
-}
-
-static inline struct mm_struct * ptep_to_mm(pte_t * ptep)
-{
-	struct page * page = kmap_atomic_to_page(ptep);
-	return (struct mm_struct *) page->mapping;
-}
-
-static inline unsigned long ptep_to_address(pte_t * ptep)
-{
-	struct page * page = kmap_atomic_to_page(ptep);
-	unsigned long low_bits;
-	low_bits = ((unsigned long)ptep & (PTRS_PER_PTE*sizeof(pte_t) - 1))
-			* (PAGE_SIZE/sizeof(pte_t));
-	return page->index + low_bits;
-}
-
-#ifdef CONFIG_HIGHPTE
-static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
-{
-	pte_addr_t paddr;
-	paddr = ((pte_addr_t)page_to_pfn(kmap_atomic_to_page(ptep))) << PAGE_SHIFT;
-	return paddr + (pte_addr_t)((unsigned long)ptep & ~PAGE_MASK);
-}
-#else
-static inline pte_addr_t ptep_to_paddr(pte_t *ptep)
-{
-	return (pte_addr_t)ptep;
-}
-#endif
-
-#ifndef CONFIG_HIGHPTE
-static inline pte_t *rmap_ptep_map(pte_addr_t pte_paddr)
-{
-	return (pte_t *)pte_paddr;
-}
-
-static inline void rmap_ptep_unmap(pte_t *pte)
-{
-	return;
-}
-#endif
-
-#endif /* _GENERIC_RMAP_H */
diff -Nru a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
--- a/include/asm-generic/vmlinux.lds.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-generic/vmlinux.lds.h	Tue Jun 15 22:20:36 2004
@@ -2,6 +2,10 @@
 #define LOAD_OFFSET 0
 #endif
 
+#ifndef VMLINUX_SYMBOL
+#define VMLINUX_SYMBOL(_sym_) _sym_
+#endif
+
 #define RODATA								\
 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
 		*(.rodata) *(.rodata.*)					\
@@ -14,30 +18,30 @@
 									\
 	/* Kernel symbol table: Normal symbols */			\
 	__ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {		\
-		__start___ksymtab = .;					\
+		VMLINUX_SYMBOL(__start___ksymtab) = .;			\
 		*(__ksymtab)						\
-		__stop___ksymtab = .;					\
+		VMLINUX_SYMBOL(__stop___ksymtab) = .;			\
 	}								\
 									\
 	/* Kernel symbol table: GPL-only symbols */			\
 	__ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {	\
-		__start___ksymtab_gpl = .;				\
+		VMLINUX_SYMBOL(__start___ksymtab_gpl) = .;		\
 		*(__ksymtab_gpl)					\
-		__stop___ksymtab_gpl = .;				\
+		VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .;		\
 	}								\
 									\
 	/* Kernel symbol table: Normal symbols */			\
 	__kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {		\
-		__start___kcrctab = .;					\
+		VMLINUX_SYMBOL(__start___kcrctab) = .;			\
 		*(__kcrctab)						\
-		__stop___kcrctab = .;					\
+		VMLINUX_SYMBOL(__stop___kcrctab) = .;			\
 	}								\
 									\
 	/* Kernel symbol table: GPL-only symbols */			\
 	__kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {	\
-		__start___kcrctab_gpl = .;				\
+		VMLINUX_SYMBOL(__start___kcrctab_gpl) = .;		\
 		*(__kcrctab_gpl)					\
-		__stop___kcrctab_gpl = .;				\
+		VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .;		\
 	}								\
 									\
 	/* Kernel symbol table: strings */				\
@@ -47,12 +51,12 @@
 
 #define SECURITY_INIT							\
 	.security_initcall.init : {					\
-		__security_initcall_start = .;				\
+		VMLINUX_SYMBOL(__security_initcall_start) = .;		\
 		*(.security_initcall.init) 				\
-		__security_initcall_end = .;				\
+		VMLINUX_SYMBOL(__security_initcall_end) = .;		\
 	}
 
 #define SCHED_TEXT							\
-		__scheduling_functions_start_here = .;			\
+		VMLINUX_SYMBOL(__sched_text_start) = .;			\
 		*(.sched.text)						\
-		__scheduling_functions_end_here = .;
+		VMLINUX_SYMBOL(__sched_text_end) = .;
diff -Nru a/include/asm-h8300/aki3068net/machine-depend.h b/include/asm-h8300/aki3068net/machine-depend.h
--- a/include/asm-h8300/aki3068net/machine-depend.h	Tue Jun 15 22:20:44 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,29 +0,0 @@
-/* AE-3068 board depend header */
-
-/* TIMER rate define */
-#ifdef H8300_TIMER_DEFINE
-#define H8300_TIMER_COUNT_DATA 20000*10/8192
-#define H8300_TIMER_FREQ 20000*1000/8192
-#endif
-
-/* AE-3068 RTL8019AS Config */
-#ifdef H8300_NE_DEFINE
-
-#define NE2000_ADDR		0x200000
-#define NE2000_IRQ              5
-#define	NE2000_BYTE		volatile unsigned short
-
-#define WCRL                    0xfee023
-#define MAR0A                   0xffff20
-#define ETCR0A                  0xffff24
-#define DTCR0A                  0xffff27
-#define MAR0B                   0xffff28
-#define DTCR0B                  0xffff2f
-
-#define H8300_INIT_NE()                  \
-do {                                     \
-	wordlength = 1;                  \
-        outb_p(0x48, ioaddr + EN0_DCFG); \
-} while(0)
-
-#endif
diff -Nru a/include/asm-h8300/atomic.h b/include/asm-h8300/atomic.h
--- a/include/asm-h8300/atomic.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-h8300/atomic.h	Tue Jun 15 22:20:39 2004
@@ -25,6 +25,7 @@
 }
 
 #define atomic_add(i, v) atomic_add_return(i, v)
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
 
 static __inline__ int atomic_sub_return(int i, atomic_t *v)
 {
@@ -48,6 +49,16 @@
 }
 
 #define atomic_inc(v) atomic_inc_return(v)
+
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
 
 static __inline__ int atomic_dec_return(atomic_t *v)
 {
diff -Nru a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h
--- a/include/asm-h8300/bitops.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-h8300/bitops.h	Tue Jun 15 22:20:39 2004
@@ -181,6 +181,23 @@
 #define find_first_zero_bit(addr, size) \
 	find_next_zero_bit((addr), (size), 0)
 
+static __inline__ unsigned long __ffs(unsigned long word)
+{
+	unsigned long result;
+
+	result = -1;
+	__asm__("1:\n\t"
+		"shlr.l %2\n\t"
+		"adds #1,%0\n\t"
+		"bcc 1b"
+		: "=r" (result)
+		: "0"(result),"r"(word));
+	return result;
+}
+
+#define ffs(x) generic_ffs(x)
+#define fls(x) generic_fls(x)
+
 static __inline__ int find_next_zero_bit (void * addr, int size, int offset)
 {
 	unsigned long *p = (unsigned long *)(((unsigned long)addr + (offset >> 3)) & ~3);
@@ -217,22 +234,44 @@
 	return result + ffz(tmp);
 }
 
-static __inline__ unsigned long __ffs(unsigned long word)
+static __inline__ unsigned long find_next_bit(const unsigned long *addr,
+	unsigned long size, unsigned long offset)
 {
-	unsigned long result;
+	unsigned long *p = (unsigned long *)(((unsigned long)addr + (offset >> 3)) & ~3);
+	unsigned int result = offset & ~31UL;
+	unsigned int tmp;
 
-	result = -1;
-	__asm__("1:\n\t"
-		"shlr.l %2\n\t"
-		"adds #1,%0\n\t"
-		"bcc 1b"
-		: "=r" (result)
-		: "0"(result),"r"(word));
-	return result;
-}
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= 31UL;
+	if (offset) {
+		tmp = *(p++);
+		tmp &= ~0UL << offset;
+		if (size < 32)
+			goto found_first;
+		if (tmp)
+			goto found_middle;
+		size -= 32;
+		result += 32;
+	}
+	while (size >= 32) {
+		if ((tmp = *p++) != 0)
+			goto found_middle;
+		result += 32;
+		size -= 32;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
 
-#define ffs(x) generic_ffs(x)
-#define fls(x) generic_fls(x)
+found_first:
+	tmp &= ~0UL >> (32 - size);
+	if (tmp == 0UL)
+		return result + size;
+found_middle:
+	return result + __ffs(tmp);
+}
 
 /*
  * Every architecture must define this function. It's the fastest
diff -Nru a/include/asm-h8300/cacheflush.h b/include/asm-h8300/cacheflush.h
--- a/include/asm-h8300/cacheflush.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-h8300/cacheflush.h	Tue Jun 15 22:20:39 2004
@@ -14,8 +14,9 @@
 #define	flush_cache_mm(mm)
 #define	flush_cache_range(vma,a,b)
 #define	flush_cache_page(vma,p)
-#define	flush_page_to_ram(page)
 #define	flush_dcache_page(page)
+#define	flush_dcache_mmap_lock(mapping)
+#define	flush_dcache_mmap_unlock(mapping)
 #define	flush_icache()
 #define	flush_icache_page(vma,page)
 #define	flush_icache_range(start,len)
diff -Nru a/include/asm-h8300/edosk2674/machine-depend.h b/include/asm-h8300/edosk2674/machine-depend.h
--- a/include/asm-h8300/edosk2674/machine-depend.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,70 +0,0 @@
-/* EDOSK2674 board depend header */
-
-/* TIMER rate define */
-#ifdef H8300_TIMER_DEFINE
-#define H8300_TIMER_COUNT_DATA 33000*10/8192
-#define H8300_TIMER_FREQ 33000*1000/8192
-#endif
-
-/* EDOSK-2674R SMSC Network Controler Target Depend impliments */
-#ifdef H8300_SMSC_DEFINE
-
-#define SMSC_BASE 0xf80000
-#define SMSC_IRQ 16
-
-/* sorry quick hack */
-#if defined(outw)
-# undef outw
-#endif
-#define outw(d,a) edosk2674_smsc_outw(d,(volatile unsigned short *)(a))
-#if defined(inw)
-# undef inw
-#endif
-#define inw(a) edosk2674_smsc_inw((volatile unsigned short *)(a))
-#if defined(outsw)
-# undef outsw
-#endif
-#define outsw(a,p,l) edosk2674_smsc_outsw((volatile unsigned short *)(a),p,l)
-#if defined(insw)
-# undef insw
-#endif
-#define insw(a,p,l) edosk2674_smsc_insw((volatile unsigned short *)(a),p,l)
-
-static inline void edosk2674_smsc_outw(
-	unsigned short d,
-	volatile unsigned short *a
-	)
-{
-	*a = (d >> 8) | (d << 8);
-}
-
-static inline unsigned short edosk2674_smsc_inw(
-	volatile unsigned short *a
-	)
-{
-	unsigned short d;
-	d = *a;
-	return (d >> 8) | (d << 8);
-}
-
-static inline void edosk2674_smsc_outsw(
-	volatile unsigned short *a,
-	unsigned short *p,
-	unsigned long l
-	)
-{
-	for (; l != 0; --l, p++)
-		*a = *p;
-}
-
-static inline void edosk2674_smsc_insw(
-	volatile unsigned short *a,
-	unsigned short *p,
-	unsigned long l
-	)
-{
-	for (; l != 0; --l, p++)
-		*p = *a;
-}
-
-#endif
diff -Nru a/include/asm-h8300/elf.h b/include/asm-h8300/elf.h
--- a/include/asm-h8300/elf.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-h8300/elf.h	Tue Jun 15 22:20:41 2004
@@ -13,26 +13,30 @@
 
 #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef struct user_m68kfp_struct elf_fpregset_t;
+typedef unsigned long elf_fpregset_t;
 
 /*
  * This is used to ensure we don't load something for the wrong architecture.
  */
-#define elf_check_arch(x) ((x)->e_machine == EM_68K)
+#define elf_check_arch(x) ((x)->e_machine == EM_H8_300)
 
 /*
  * These are used to set parameters in the core dumps.
  */
 #define ELF_CLASS	ELFCLASS32
 #define ELF_DATA	ELFDATA2MSB
-#define ELF_ARCH	EM_H8_300H
+#define ELF_ARCH	EM_H8_300
+#if defined(__H8300H__)
+#define ELF_FLAGS       0x810000
+#endif
+#if defined(__H8300S__)
+#define ELF_FLAGS       0x820000
+#endif
 
 #define ELF_PLAT_INIT(_r)	_r->er1 = 0
 
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE	4096
-#endif
 
 /* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
    use of this is to invoke "./ld.so someprog" to test out a new version of
@@ -54,4 +58,50 @@
 
 #ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX)
+#endif
+
+#define R_H8_NONE       0
+#define R_H8_DIR32      1
+#define R_H8_DIR32_28   2
+#define R_H8_DIR32_24   3
+#define R_H8_DIR32_16   4
+#define R_H8_DIR32U     6
+#define R_H8_DIR32U_28  7
+#define R_H8_DIR32U_24  8
+#define R_H8_DIR32U_20  9
+#define R_H8_DIR32U_16 10
+#define R_H8_DIR24     11
+#define R_H8_DIR24_20  12
+#define R_H8_DIR24_16  13
+#define R_H8_DIR24U    14
+#define R_H8_DIR24U_20 15
+#define R_H8_DIR24U_16 16
+#define R_H8_DIR16     17
+#define R_H8_DIR16U    18
+#define R_H8_DIR16S_32 19
+#define R_H8_DIR16S_28 20
+#define R_H8_DIR16S_24 21
+#define R_H8_DIR16S_20 22
+#define R_H8_DIR16S    23
+#define R_H8_DIR8      24
+#define R_H8_DIR8U     25
+#define R_H8_DIR8Z_32  26
+#define R_H8_DIR8Z_28  27
+#define R_H8_DIR8Z_24  28
+#define R_H8_DIR8Z_20  29
+#define R_H8_DIR8Z_16  30
+#define R_H8_PCREL16   31
+#define R_H8_PCREL8    32
+#define R_H8_BPOS      33
+#define R_H8_PCREL32   34
+#define R_H8_GOT32O    35
+#define R_H8_GOT16O    36
+#define R_H8_DIR16A8   59
+#define R_H8_DIR16R8   60
+#define R_H8_DIR24A8   61
+#define R_H8_DIR24R8   62
+#define R_H8_DIR32A16  63
+#define R_H8_ABS32     65
+#define R_H8_ABS32A16 127
+
 #endif
diff -Nru a/include/asm-h8300/flat.h b/include/asm-h8300/flat.h
--- a/include/asm-h8300/flat.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-h8300/flat.h	Tue Jun 15 22:20:35 2004
@@ -18,7 +18,8 @@
  */
 
 #define	flat_get_relocate_addr(rel)		(rel)
-#define flat_get_addr_from_rp(rp, relval)       (get_unaligned(rp) & 0x0ffffff)
+#define flat_get_addr_from_rp(rp, relval, flags) \
+        (get_unaligned(rp) & ((flags & FLAT_FLAG_GOTPIC) ? 0xffffffff: 0x00ffffff))
 #define flat_put_addr_at_rp(rp, addr, rel) \
 	put_unaligned (((*(char *)(rp)) << 24) | ((addr) & 0x00ffffff), rp)
 
diff -Nru a/include/asm-h8300/generic/machine-depend.h b/include/asm-h8300/generic/machine-depend.h
--- a/include/asm-h8300/generic/machine-depend.h	Tue Jun 15 22:20:38 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,17 +0,0 @@
-/* machine depend header */
-
-/* TIMER rate define */
-#ifdef H8300_TIMER_DEFINE
-#include <linux/config.h>
-#if defined(CONFIG_H83007) || defined(CONFIG_H83068) || defined(CONFIG_H8S2678)
-#define H8300_TIMER_COUNT_DATA CONFIG_CPU_CLOCK*10/8192
-#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192
-#endif
-
-#if defined(CONFIG_H8_3002) || defined(CONFIG_H83048)
-#define H8300_TIMER_COUNT_DATA  CONFIG_CPU_CLOCK*10/8
-#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8
-#endif
-
-#endif
-
diff -Nru a/include/asm-h8300/generic/timer_rate.h b/include/asm-h8300/generic/timer_rate.h
--- a/include/asm-h8300/generic/timer_rate.h	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,15 +0,0 @@
-#include <linux/config.h>
-
-#if defined(CONFIG_H83007) || defined(CONFIG_H83068) || defined(CONFIG_H8S2678)
-#define H8300_TIMER_COUNT_DATA CONFIG_CPU_CLOCK*10/8192
-#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8192
-#endif
-
-#if defined(H8_3002) || defined(CONFIG_H83048)
-#define H8300_TIMER_COUNT_DATA  CONFIG_CPU_CLOCK*10/8
-#define H8300_TIMER_FREQ CONFIG_CPU_CLOCK*1000/8
-#endif
-
-#if !defined(H8300_TIMER_COUNT_DATA)
-#error illigal configuration
-#endif
diff -Nru a/include/asm-h8300/h8300_smsc.h b/include/asm-h8300/h8300_smsc.h
--- a/include/asm-h8300/h8300_smsc.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,20 +0,0 @@
-/****************************************************************************/
-
-/*
- *	h8300_smsc.h -- SMSC in H8/300H and H8S Evalution Board.
- *      
- *	(C) Copyright 2003, Yoshinori Sato <ysato@users.sourceforge.jp>
- */
-
-/****************************************************************************/
-#ifndef	h8300smsc_h
-#define	h8300smsc_h
-/****************************************************************************/
-
-/* Such a description is OK ? */
-#define H8300_SMSC_DEFINE
-#include <asm/machine-depend.h>
-#undef  H8300_SMSC_DEFINE
-
-/****************************************************************************/
-#endif	/* h8300smsc_h */
diff -Nru a/include/asm-h8300/h8max/machine-depend.h b/include/asm-h8300/h8max/machine-depend.h
--- a/include/asm-h8300/h8max/machine-depend.h	Tue Jun 15 22:20:43 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,100 +0,0 @@
-/* H8MAX board depend header */
-
-/* TIMER rate define */
-#ifdef H8300_TIMER_DEFINE
-#define H8300_TIMER_COUNT_DATA 25000*10/8192
-#define H8300_TIMER_FREQ 25000*1000/8192
-#endif
-
-/* H8MAX RTL8019AS Config */
-#ifdef H8300_NE_DEFINE
-
-#define NE2000_ADDR		0x800600
-#define NE2000_IRQ              4
-#define NE2000_IRQ_VECTOR	(12 + NE2000_IRQ)
-#define	NE2000_BYTE		volatile unsigned short
-
-/* sorry quick hack */
-#if defined(outb)
-# undef outb
-#endif
-#define outb(d,a)               h8max_outb((d),(a) - NE2000_ADDR)
-#if defined(inb)
-# undef inb
-#endif
-#define inb(a)                  h8max_inb((a) - NE2000_ADDR)
-#if defined(outb_p)
-# undef outb_p
-#endif
-#define outb_p(d,a)             h8max_outb((d),(a) - NE2000_ADDR)
-#if defined(inb_p)
-# undef inb_p
-#endif
-#define inb_p(a)                h8max_inb((a) - NE2000_ADDR)
-#if defined(outsw)
-# undef outsw
-#endif
-#define outsw(a,p,l)            h8max_outsw((a) - NE2000_ADDR,(unsigned short *)p,l)
-#if defined(insw)
-# undef insw
-#endif
-#define insw(a,p,l)             h8max_insw((a) - NE2000_ADDR,(unsigned short *)p,l)
-#if defined(outsb)
-# undef outsb
-#endif
-#define outsb(a,p,l)            h8max_outsb((a) - NE2000_ADDR,(unsigned char *)p,l)
-#if defined(insb)
-# undef insb
-#endif
-#define insb(a,p,l)             h8max_insb((a) - NE2000_ADDR,(unsigned char *)p,l)
-
-#define H8300_INIT_NE()                  \
-do {                                     \
-	wordlength = 2;                  \
-	h8max_outb(0x49, ioaddr + EN0_DCFG); \
-	SA_prom[14] = SA_prom[15] = 0x57;\
-} while(0)
-
-static inline void h8max_outb(unsigned char d,unsigned char a)
-{
-	*(unsigned short *)(NE2000_ADDR + (a << 1)) = d;
-}
-
-static inline unsigned char h8max_inb(unsigned char a)
-{
-	return *(unsigned char *)(NE2000_ADDR + (a << 1) +1);
-}
-
-static inline void h8max_outsw(unsigned char a,unsigned short *p,unsigned long l)
-{
-	unsigned short d;
-	for (; l != 0; --l, p++) {
-		d = (((*p) >> 8) & 0xff) | ((*p) << 8);
-		*(unsigned short *)(NE2000_ADDR + (a << 1)) = d;
-	}
-}
-
-static inline void h8max_insw(unsigned char a,unsigned short *p,unsigned long l)
-{
-	unsigned short d;
-	for (; l != 0; --l, p++) {
-		d = *(unsigned short *)(NE2000_ADDR + (a << 1));
-		*p = (d << 8)|((d >> 8) & 0xff);
-	}
-}
-
-static inline void h8max_outsb(unsigned char a,unsigned char *p,unsigned long l)
-{
-	for (; l != 0; --l, p++) {
-		*(unsigned short *)(NE2000_ADDR + (a << 1)) = *p;
-	}
-}
-
-static inline void h8max_insb(unsigned char a,unsigned char *p,unsigned long l)
-{
-	for (; l != 0; --l, p++) {
-		*p = *((unsigned char *)(NE2000_ADDR + (a << 1))+1);
-	}
-}
-
-#endif
diff -Nru a/include/asm-h8300/hardirq.h b/include/asm-h8300/hardirq.h
--- a/include/asm-h8300/hardirq.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-h8300/hardirq.h	Tue Jun 15 22:20:41 2004
@@ -75,7 +75,7 @@
 #define irq_enter()		(preempt_count() += HARDIRQ_OFFSET)
 
 #ifdef CONFIG_PREEMPT
-# define in_atomic()	(preempt_count() != kernel_locked())
+# define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
 # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
 #else
 # define in_atomic()	(preempt_count() != 0)
diff -Nru a/include/asm-h8300/ide.h b/include/asm-h8300/ide.h
--- a/include/asm-h8300/ide.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-h8300/ide.h	Tue Jun 15 22:20:37 2004
@@ -16,23 +16,9 @@
 #ifdef __KERNEL__
 /****************************************************************************/
 
-void h8300_ide_print_resource(char *name, hw_regs_t *hw);
-static __inline__ int ide_default_irq(unsigned long base) { return 0; };
-static __inline__ unsigned long ide_default_io_base(int index) { return 0; };
-
-static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
-	 unsigned long ctrl_port, int *irq)
-{
-}
-
-#define ide_init_default_irq(base)	(0)
-
 #define MAX_HWIFS	1
 
-#define __ide_mm_insw(port,addr,count)  do { } while(0)
-#define __ide_mm_insl(port,addr,count)  do { } while(0)
-#define __ide_mm_outsw(port,addr,count) do { } while(0)
-#define __ide_mm_outsl(port,addr,count) do { } while(0)
+#include <asm-generic/ide_iops.h>
 
 /****************************************************************************/
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-h8300/io.h b/include/asm-h8300/io.h
--- a/include/asm-h8300/io.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-h8300/io.h	Tue Jun 15 22:20:41 2004
@@ -33,21 +33,29 @@
  * swap functions are sometimes needed to interface little-endian hardware
  */
 
-/*
- * CHANGES
- * 
- * 020325   Added some #define's for the COBRA5272 board
- *          (hede)
- */
-
 static inline unsigned short _swapw(volatile unsigned short v)
 {
-    return ((v << 8) | (v >> 8));
+	unsigned short r,t;
+	__asm__("mov.b %w2,%x1\n\t"
+		"mov.b %x2,%w1\n\t"
+		"mov.w %1,%0"
+		:"=r"(r),"=r"(t)
+		:"r"(v));
+	return r;
 }
 
 static inline unsigned int _swapl(volatile unsigned long v)
 {
-    return ((v << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | (v >> 24));
+	unsigned int r,t;
+	__asm__("mov.b %w2,%x1\n\t"
+		"mov.b %x2,%w1\n\t"
+		"mov.w %f1,%e0\n\t"
+		"mov.w %e2,%f1\n\t"
+		"mov.b %w1,%x0\n\t"
+		"mov.b %x1,%w0"
+		:"=r"(r),"=r"(t)
+		:"r"(v));
+	return r;
 }
 
 #define readb(addr) \
@@ -76,7 +84,7 @@
 	return (*(volatile unsigned char *)ABWCR & (1 << ((addr >> 21) & 7))) == 0;
 }
 
-static inline void io_outsb(unsigned int addr, void *buf, int len)
+static inline void io_outsb(unsigned int addr, const void *buf, int len)
 {
 	volatile unsigned char  *ap_b = (volatile unsigned char *) addr;
 	volatile unsigned short *ap_w = (volatile unsigned short *) addr;
@@ -91,33 +99,37 @@
 	}
 }
 
-static inline void io_outsw(unsigned int addr, void *buf, int len)
+static inline void io_outsw(unsigned int addr, const void *buf, int len)
 {
 	volatile unsigned short *ap = (volatile unsigned short *) addr;
 	unsigned short *bp = (unsigned short *) buf;
 	while (len--)
-		*ap = *bp++;
+		*ap = _swapw(*bp++);
 }
 
-static inline void io_outsl(unsigned int addr, void *buf, int len)
+static inline void io_outsl(unsigned int addr, const void *buf, int len)
 {
 	volatile unsigned int *ap = (volatile unsigned int *) addr;
-	unsigned int *bp = (unsigned int *) buf;
+	unsigned long *bp = (unsigned long *) buf;
 	while (len--)
-		*ap = *bp++;
+		*ap = _swapl(*bp++);
 }
 
 static inline void io_insb(unsigned int addr, void *buf, int len)
 {
-	volatile unsigned char  *ap;
+	volatile unsigned char  *ap_b;
+	volatile unsigned short *ap_w;
 	unsigned char *bp = (unsigned char *) buf;
 
-	if(h8300_buswidth(addr))
-		ap = (volatile unsigned char *)(addr ^ 1);
-	else
-		ap = (volatile unsigned char *)addr;
-	while (len--)
-		*bp++ = *ap;
+	if(h8300_buswidth(addr)) {
+		ap_w = (volatile unsigned short *)(addr & ~1);
+		while (len--)
+			*bp++ = *ap_w & 0xff;
+	} else {
+		ap_b = (volatile unsigned char *)addr;
+		while (len--)
+			*bp++ = *ap_b;
+	}
 }
 
 static inline void io_insw(unsigned int addr, void *buf, int len)
@@ -125,15 +137,15 @@
 	volatile unsigned short *ap = (volatile unsigned short *) addr;
 	unsigned short *bp = (unsigned short *) buf;
 	while (len--)
-		*bp++ = *ap;
+		*bp++ = _swapw(*ap);
 }
 
 static inline void io_insl(unsigned int addr, void *buf, int len)
 {
 	volatile unsigned int *ap = (volatile unsigned int *) addr;
-	unsigned int *bp = (unsigned int *) buf;
+	unsigned long *bp = (unsigned long *) buf;
 	while (len--)
-		*bp++ = *ap;
+		*bp++ = _swapl(*ap);
 }
 
 /*
@@ -145,10 +157,10 @@
 #define memcpy_fromio(a,b,c)	memcpy((a),(void *)(b),(c))
 #define memcpy_toio(a,b,c)	memcpy((void *)(a),(b),(c))
 
-#define inb(addr)    ((h8300_buswidth(addr))?readb((addr) ^ 1) & 0xff:readb(addr))
+#define inb(addr)    ((h8300_buswidth(addr))?readw((addr) & ~1) & 0xff:readb(addr))
 #define inw(addr)    _swapw(readw(addr))
 #define inl(addr)    _swapl(readl(addr))
-#define outb(x,addr) ((void)((h8300_buswidth(addr) && ((addr) & 1))?writew(x,addr):writeb(x,addr)))
+#define outb(x,addr) ((void)((h8300_buswidth(addr) && ((addr) & 1))?writew(x,(addr) & ~1):writeb(x,addr)))
 #define outw(x,addr) ((void) writew(_swapw(x),addr))
 #define outl(x,addr) ((void) writel(_swapl(x),addr))
 
diff -Nru a/include/asm-h8300/module.h b/include/asm-h8300/module.h
--- a/include/asm-h8300/module.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-h8300/module.h	Tue Jun 15 22:20:37 2004
@@ -3,5 +3,11 @@
 /*
  * This file contains the H8/300 architecture specific module code.
  */
+struct mod_arch_specific { };
+#define Elf_Shdr Elf32_Shdr
+#define Elf_Sym Elf32_Sym
+#define Elf_Ehdr Elf32_Ehdr
+
+#define MODULE_SYMBOL_PREFIX "_"
 
 #endif /* _ASM_H8/300_MODULE_H */
diff -Nru a/include/asm-h8300/pgtable.h b/include/asm-h8300/pgtable.h
--- a/include/asm-h8300/pgtable.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-h8300/pgtable.h	Tue Jun 15 22:20:39 2004
@@ -7,8 +7,6 @@
 #include <asm/page.h>
 #include <asm/io.h>
 
-typedef pte_t *pte_addr_t;
-
 #define pgd_present(pgd)     (1)       /* pages are always present on NO_MM */
 #define pgd_none(pgd)		(0)
 #define pgd_bad(pgd)		(0)
diff -Nru a/include/asm-h8300/processor.h b/include/asm-h8300/processor.h
--- a/include/asm-h8300/processor.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-h8300/processor.h	Tue Jun 15 22:20:37 2004
@@ -23,12 +23,12 @@
 #include <asm/ptrace.h>
 #include <asm/current.h>
 
-extern inline unsigned long rdusp(void) {
+static inline unsigned long rdusp(void) {
 	extern unsigned int	sw_usp;
 	return(sw_usp);
 }
 
-extern inline void wrusp(unsigned long usp) {
+static inline void wrusp(unsigned long usp) {
 	extern unsigned int	sw_usp;
 	sw_usp = usp;
 }
@@ -61,9 +61,15 @@
 	} breakinfo;
 };
 
-#define INIT_THREAD  { \
-	sizeof(init_stack) + (unsigned long) init_stack, 0, \
-	PS_S,  0, {(unsigned short *)-1, 0}, \
+#define INIT_THREAD  {						\
+	.ksp  = sizeof(init_stack) + (unsigned long)init_stack, \
+	.usp  = 0,						\
+	.ccr  = PS_S,						\
+	.esp0 = 0,						\
+	.breakinfo = {						\
+		.addr = (unsigned short *)-1,			\
+		.inst = 0					\
+	}							\
 }
 
 /*
@@ -78,6 +84,7 @@
 	set_fs(USER_DS);           /* reads from user space */  \
   	(_regs)->pc = (_pc);				        \
 	(_regs)->ccr &= 0x00;	   /* clear kernel flag */      \
+	(_regs)->er5 = current->mm->start_data;	/* GOT base */  \
 	wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3);	\
 } while(0)
 #endif
@@ -88,6 +95,7 @@
 	(_regs)->pc = (_pc);				        \
 	(_regs)->ccr = 0x00;	   /* clear kernel flag */      \
 	(_regs)->exr = 0x78;       /* enable all interrupts */  \
+	(_regs)->er5 = current->mm->start_data;	/* GOT base */  \
 	/* 14 = space for retaddr(4), vector(4), er0(4) and ext(2) on stack */ \
 	wrusp(((unsigned long)(_usp)) - 14);                    \
 } while(0)
diff -Nru a/include/asm-h8300/semaphore.h b/include/asm-h8300/semaphore.h
--- a/include/asm-h8300/semaphore.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-h8300/semaphore.h	Tue Jun 15 22:20:40 2004
@@ -96,7 +96,7 @@
 	__asm__ __volatile__(
 		"stc ccr,r3l\n\t"
 		"orc #0x80,ccr\n\t"
-		"mov.l %0, er1\n\t"
+		"mov.l %2, er1\n\t"
 		"dec.l #1,er1\n\t"
 		"mov.l er1,%0\n\t"
 		"bpl 1f\n\t"
@@ -107,8 +107,8 @@
 		"1:\n\t"
 		"ldc r3l,ccr\n"
 		"2:"
-		: "+m"(*count)
-		: "g"(sem)
+		: "=m"(*count)
+		: "g"(sem),"m"(*count)
 		: "cc",  "er1", "er2", "er3");
 }
 
@@ -125,7 +125,7 @@
 	__asm__ __volatile__(
 		"stc ccr,r1l\n\t"
 		"orc #0x80,ccr\n\t"
-		"mov.l %1, er2\n\t"
+		"mov.l %3, er2\n\t"
 		"dec.l #1,er2\n\t"
 		"mov.l er2,%1\n\t"
 		"bpl 1f\n\t"
@@ -137,8 +137,8 @@
 		"ldc r1l,ccr\n\t"
 		"sub.l %0,%0\n\t"
 		"2:\n\t"
-		: "=r" (count),"+m" (*count)
-		: "g"(sem)
+		: "=r" (count),"=m" (*count)
+		: "g"(sem),"m"(*count)
 		: "cc", "er1", "er2", "er3");
 	return (int)count;
 }
@@ -155,7 +155,7 @@
 	__asm__ __volatile__(
 		"stc ccr,r3l\n\t"
 		"orc #0x80,ccr\n\t"
-		"mov.l %0,er2\n\t"
+		"mov.l %3,er2\n\t"
 		"dec.l #1,er2\n\t"
 		"mov.l er2,%0\n\t"
 		"bpl 1f\n\t"
@@ -171,8 +171,8 @@
 		"ldc r3l,ccr\n\t"
 		"sub.l %1,%1\n"
 		"2:"
-		: "+m" (*count),"=r"(count)
-		: "g"(sem)
+		: "=m" (*count),"=r"(count)
+		: "g"(sem),"m"(*count)
 		: "cc", "er1","er2", "er3");
 	return (int)count;
 }
@@ -195,7 +195,7 @@
 	__asm__ __volatile__(
 		"stc ccr,r3l\n\t"
 		"orc #0x80,ccr\n\t"
-		"mov.l %0,er1\n\t"
+		"mov.l %2,er1\n\t"
 		"inc.l #1,er1\n\t"
 		"mov.l er1,%0\n\t"
 		"ldc r3l,ccr\n\t"
@@ -205,8 +205,8 @@
 		"mov.l %1,er0\n\t"
 		"jsr @___up\n"
 		"1:"
-		: "+m"(*count)
-		: "g"(sem)
+		: "=m"(*count)
+		: "g"(sem),"m"(*count)
 		: "cc", "er1", "er2", "er3");
 }
 
diff -Nru a/include/asm-h8300/sigcontext.h b/include/asm-h8300/sigcontext.h
--- a/include/asm-h8300/sigcontext.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-h8300/sigcontext.h	Tue Jun 15 22:20:38 2004
@@ -8,6 +8,7 @@
 	unsigned long  sc_er1;
 	unsigned long  sc_er2;
 	unsigned long  sc_er3;
+	unsigned long  sc_er5;
 	unsigned short sc_ccr;
 	unsigned long  sc_pc;
 };
diff -Nru a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h
--- a/include/asm-h8300/thread_info.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-h8300/thread_info.h	Tue Jun 15 22:20:39 2004
@@ -32,10 +32,11 @@
  */
 #define INIT_THREAD_INFO(tsk)			\
 {						\
-	task:		&tsk,			\
-	exec_domain:	&default_exec_domain,	\
-	flags:		0,			\
-	cpu:		0,			\
+	.task =		&tsk,			\
+	.exec_domain =	&default_exec_domain,	\
+	.flags =	0,			\
+	.cpu =		0,			\
+	.preempt_count = 1,			\
 	.restart_block	= {			\
 		.fn = do_no_restart_syscall,	\
 	},					\
@@ -59,7 +60,7 @@
 		"mov.l	sp, %0 \n\t"
 		"and.l	%1, %0"
 		: "=&r"(ti)
-		: "g" (~(THREAD_SIZE-1))
+		: "i" (~(THREAD_SIZE-1))
 		);
 	return ti;
 }
@@ -79,6 +80,7 @@
 #define TI_EXECDOMAIN	4
 #define TI_FLAGS	8
 #define TI_CPU		12
+#define TI_PRE_COUNT	16
 
 #define	PREEMPT_ACTIVE	0x4000000
 
diff -Nru a/include/asm-h8300/timex.h b/include/asm-h8300/timex.h
--- a/include/asm-h8300/timex.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-h8300/timex.h	Tue Jun 15 22:20:40 2004
@@ -6,11 +6,7 @@
 #ifndef _ASM_H8300_TIMEX_H
 #define _ASM_H8300_TIMEX_H
 
-#define H8300_TIMER_DEFINE
-#include <asm/machine-depend.h>
-#undef  H8300_TIMER_DEFINE
-
-#define CLOCK_TICK_RATE H8300_TIMER_FREQ
+#define CLOCK_TICK_RATE CONFIG_CPU_CLOCK*1000/8192 /* Timer input freq. */
 #define CLOCK_TICK_FACTOR	20	/* Factor of both 1000000 and CLOCK_TICK_RATE */
 #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
 	(1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
diff -Nru a/include/asm-h8300/types.h b/include/asm-h8300/types.h
--- a/include/asm-h8300/types.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-h8300/types.h	Tue Jun 15 22:20:42 2004
@@ -58,6 +58,8 @@
 #define HAVE_SECTOR_T
 typedef u64 sector_t;
 
+typedef unsigned int kmem_bufctl_t;
+
 #endif /* __KERNEL__ */
 
 #endif /* __ASSEMBLY__ */
diff -Nru a/include/asm-h8300/unistd.h b/include/asm-h8300/unistd.h
--- a/include/asm-h8300/unistd.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-h8300/unistd.h	Tue Jun 15 22:20:40 2004
@@ -446,6 +446,31 @@
 }
 		
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
diff -Nru a/include/asm-i386/8253pit.h b/include/asm-i386/8253pit.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-i386/8253pit.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,12 @@
+/*
+ * 8253/8254 Programmable Interval Timer
+ */
+
+#ifndef _8253PIT_H
+#define _8253PIT_H
+
+#include <asm/timex.h>
+
+#define PIT_TICK_RATE 	CLOCK_TICK_RATE
+
+#endif
diff -Nru a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
--- a/include/asm-i386/acpi.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-i386/acpi.h	Tue Jun 15 22:20:58 2004
@@ -122,9 +122,10 @@
 #define FIX_ACPI_PAGES 4
 
 extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
+extern int (*platform_rename_gsi)(int ioapic, int gsi);
+
 #ifdef CONFIG_X86_IO_APIC
 extern int skip_ioapic_setup;
-extern int acpi_irq_to_vector(u32 irq);	/* deprecated in favor of acpi_gsi_to_irq */
 extern int acpi_skip_timer_override;
 
 static inline void disable_ioapic_setup(void)
diff -Nru a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
--- a/include/asm-i386/bitops.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-i386/bitops.h	Tue Jun 15 22:20:42 2004
@@ -290,7 +290,7 @@
 		"shll $3,%%edi\n\t"
 		"addl %%edi,%%edx"
 		:"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2)
-		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
+		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
 	return res;
 }
 
@@ -318,7 +318,7 @@
 		"shll $3,%%edi\n\t"
 		"addl %%edi,%%eax"
 		:"=a" (res), "=&c" (d0), "=&D" (d1)
-		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
+		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
 	return res;
 }
 
diff -Nru a/include/asm-i386/cacheflush.h b/include/asm-i386/cacheflush.h
--- a/include/asm-i386/cacheflush.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-i386/cacheflush.h	Tue Jun 15 22:20:40 2004
@@ -10,6 +10,8 @@
 #define flush_cache_range(vma, start, end)	do { } while (0)
 #define flush_cache_page(vma, vmaddr)		do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_range(start, end)		do { } while (0)
 #define flush_icache_page(vma,pg)		do { } while (0)
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
diff -Nru a/include/asm-i386/cpu.h b/include/asm-i386/cpu.h
--- a/include/asm-i386/cpu.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-i386/cpu.h	Tue Jun 15 22:20:42 2004
@@ -17,7 +17,9 @@
 	struct node *parent = NULL;
 	
 #ifdef CONFIG_NUMA
-	parent = &node_devices[cpu_to_node(num)].node;
+	int node = cpu_to_node(num);
+	if (node_online(node))
+		parent = &node_devices[node].node;
 #endif /* CONFIG_NUMA */
 
 	return register_cpu(&cpu_devices[num].cpu, num, parent);
diff -Nru a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
--- a/include/asm-i386/dma-mapping.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-i386/dma-mapping.h	Tue Jun 15 22:21:05 2004
@@ -2,6 +2,8 @@
 #define _ASM_I386_DMA_MAPPING_H
 
 #include <asm/cache.h>
+#include <asm/io.h>
+#include <asm/scatterlist.h>
 
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
@@ -51,7 +53,7 @@
 	     size_t size, enum dma_data_direction direction)
 {
 	BUG_ON(direction == DMA_NONE);
-	return (dma_addr_t)(page_to_pfn(page)) * PAGE_SIZE + offset;
+	return page_to_phys(page) + offset;
 }
 
 static inline void
diff -Nru a/include/asm-i386/floppy.h b/include/asm-i386/floppy.h
--- a/include/asm-i386/floppy.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-i386/floppy.h	Tue Jun 15 22:20:38 2004
@@ -204,7 +204,7 @@
 static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
 {
 	if((unsigned int) addr >= (unsigned int) high_memory)
-		return vfree((void *)addr);
+		vfree((void *)addr);
 	else
 		free_pages(addr, get_order(size));		
 }
diff -Nru a/include/asm-i386/genapic.h b/include/asm-i386/genapic.h
--- a/include/asm-i386/genapic.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-i386/genapic.h	Tue Jun 15 22:20:41 2004
@@ -26,7 +26,8 @@
 	int int_delivery_mode;
 	int int_dest_mode; 
 	int apic_broadcast_id; 
-	int esr_disable;
+	int ESR_DISABLE;
+	int apic_destination_logical;
 	unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
 	unsigned long (*check_apicid_present)(int apicid); 
 	int no_balance_irq;
@@ -80,6 +81,8 @@
 	.apic_broadcast_id = APIC_BROADCAST_ID, \
 	.no_balance_irq = NO_BALANCE_IRQ, \
 	.no_ioapic_check = NO_IOAPIC_CHECK, \
+	.ESR_DISABLE = esr_disable, \
+	.apic_destination_logical = APIC_DEST_LOGICAL, \
 	APICFUNC(apic_id_registered), \
 	APICFUNC(target_cpus), \
 	APICFUNC(check_apicid_used), \
diff -Nru a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
--- a/include/asm-i386/hw_irq.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-i386/hw_irq.h	Tue Jun 15 22:21:04 2004
@@ -59,7 +59,7 @@
 void print_IO_APIC(void);
 int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
 void send_IPI(int dest, int vector);
-void setup_ioapic_dest(cpumask_t mask);
+void setup_ioapic_dest(void);
 
 extern unsigned long io_apic_irqs;
 
diff -Nru a/include/asm-i386/i387.h b/include/asm-i386/i387.h
--- a/include/asm-i386/i387.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-i386/i387.h	Tue Jun 15 22:20:43 2004
@@ -51,7 +51,7 @@
 #define __clear_fpu( tsk )					\
 do {								\
 	if ((tsk)->thread_info->status & TS_USEDFPU) {		\
-		asm volatile("fwait");				\
+		asm volatile("fnclex ; fwait");				\
 		(tsk)->thread_info->status &= ~TS_USEDFPU;	\
 		stts();						\
 	}							\
diff -Nru a/include/asm-i386/ide.h b/include/asm-i386/ide.h
--- a/include/asm-i386/ide.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-i386/ide.h	Tue Jun 15 22:20:36 2004
@@ -23,6 +23,8 @@
 # endif
 #endif
 
+#define IDE_ARCH_OBSOLETE_DEFAULTS
+
 static __inline__ int ide_default_irq(unsigned long base)
 {
 	switch (base) {
@@ -84,6 +86,9 @@
 	hw->io_ports[IDE_IRQ_OFFSET] = 0;
 }
 #endif
+
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #ifdef CONFIG_BLK_DEV_IDEPCI
 #define ide_init_default_irq(base)	(0)
diff -Nru a/include/asm-i386/kmap_types.h b/include/asm-i386/kmap_types.h
--- a/include/asm-i386/kmap_types.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-i386/kmap_types.h	Tue Jun 15 22:20:43 2004
@@ -19,12 +19,11 @@
 D(6)	KM_BIO_DST_IRQ,
 D(7)	KM_PTE0,
 D(8)	KM_PTE1,
-D(9)	KM_PTE2,
-D(10)	KM_IRQ0,
-D(11)	KM_IRQ1,
-D(12)	KM_SOFTIRQ0,
-D(13)	KM_SOFTIRQ1,
-D(14)	KM_TYPE_NR
+D(9)	KM_IRQ0,
+D(10)	KM_IRQ1,
+D(11)	KM_SOFTIRQ0,
+D(12)	KM_SOFTIRQ1,
+D(13)	KM_TYPE_NR
 };
 
 #undef D
diff -Nru a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h
--- a/include/asm-i386/mach-bigsmp/mach_apic.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-i386/mach-bigsmp/mach_apic.h	Tue Jun 15 22:21:03 2004
@@ -22,13 +22,21 @@
 }
 
 #define APIC_DFR_VALUE	(APIC_DFR_CLUSTER)
+/* Round robin the irqs amoung the online cpus */
 static inline cpumask_t target_cpus(void)
 { 
-	return cpu_online_map;
+	static unsigned long cpu = NR_CPUS;
+	do {
+		if (cpu >= NR_CPUS)
+			cpu = first_cpu_const(cpu_online_map);
+		else
+			cpu = next_cpu_const(cpu, cpu_online_map);
+	} while (cpu >= NR_CPUS);
+	return mk_cpumask_const(cpumask_of_cpu(cpu));
 }
 #define TARGET_CPUS	(target_cpus())
 
-#define INT_DELIVERY_MODE dest_LowestPrio
+#define INT_DELIVERY_MODE dest_Fixed
 #define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
 
 #define APIC_BROADCAST_ID     (0xff)
@@ -141,36 +149,14 @@
 	return (1);
 }
 
+/* As we are using single CPU as destination, pick only one CPU here */
 static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
 {
-	int num_bits_set;
-	int cpus_found = 0;
 	int cpu;
 	int apicid;	
 
-	num_bits_set = cpus_weight_const(cpumask);
-	/* Return id to all */
-	if (num_bits_set == NR_CPUS)
-		return (int) 0xFF;
-	/* 
-	 * The cpus in the mask must all be on the apic cluster.  If are not 
-	 * on the same apicid cluster return default value of TARGET_CPUS. 
-	 */
 	cpu = first_cpu_const(cpumask);
 	apicid = cpu_to_logical_apicid(cpu);
-	while (cpus_found < num_bits_set) {
-		if (cpu_isset_const(cpu, cpumask)) {
-			int new_apicid = cpu_to_logical_apicid(cpu);
-			if (apicid_cluster(apicid) != 
-					apicid_cluster(new_apicid)){
-				printk ("%s: Not a valid mask!\n",__FUNCTION__);
-				return 0xFF;
-			}
-			apicid = apicid | new_apicid;
-			cpus_found++;
-		}
-		cpu++;
-	}
 	return apicid;
 }
 
diff -Nru a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h
--- a/include/asm-i386/mach-es7000/mach_apic.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-i386/mach-es7000/mach_apic.h	Tue Jun 15 22:20:36 2004
@@ -39,7 +39,7 @@
 #endif
 
 #define APIC_BROADCAST_ID	(0xff)
-#define NO_IOAPIC_CHECK (0)
+#define NO_IOAPIC_CHECK (1)
 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 { 
@@ -169,7 +169,11 @@
 	num_bits_set = cpus_weight_const(cpumask);
 	/* Return id to all */
 	if (num_bits_set == NR_CPUS)
+#if defined CONFIG_ES7000_CLUSTERED_APIC
 		return 0xFF;
+#else
+		return cpu_to_logical_apicid(0);
+#endif
 	/* 
 	 * The cpus in the mask must all be on the apic cluster.  If are not 
 	 * on the same apicid cluster return default value of TARGET_CPUS. 
@@ -182,7 +186,11 @@
 			if (apicid_cluster(apicid) != 
 					apicid_cluster(new_apicid)){
 				printk ("%s: Not a valid mask!\n",__FUNCTION__);
+#if defined CONFIG_ES7000_CLUSTERED_APIC
 				return 0xFF;
+#else
+				return cpu_to_logical_apicid(0);
+#endif
 			}
 			apicid = new_apicid;
 			cpus_found++;
diff -Nru a/include/asm-i386/mach-es7000/mach_ipi.h b/include/asm-i386/mach-es7000/mach_ipi.h
--- a/include/asm-i386/mach-es7000/mach_ipi.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-i386/mach-es7000/mach_ipi.h	Tue Jun 15 22:20:38 2004
@@ -1,7 +1,7 @@
 #ifndef __ASM_MACH_IPI_H
 #define __ASM_MACH_IPI_H
 
-static inline void send_IPI_mask_sequence(cpumask_t mask, int vector);
+inline void send_IPI_mask_sequence(cpumask_t mask, int vector);
 
 static inline void send_IPI_mask(cpumask_t mask, int vector)
 {
diff -Nru a/include/asm-i386/mach-es7000/mach_mpparse.h b/include/asm-i386/mach-es7000/mach_mpparse.h
--- a/include/asm-i386/mach-es7000/mach_mpparse.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-i386/mach-es7000/mach_mpparse.h	Tue Jun 15 22:20:35 2004
@@ -12,26 +12,28 @@
 {
 }
 
-extern void parse_unisys_oem (char *oemptr, int oem_entries);
+extern int parse_unisys_oem (char *oemptr, int oem_entries);
 extern int find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length);
 
-static inline void mps_oem_check(struct mp_config_table *mpc, char *oem, 
+static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
 		char *productid)
 {
 	if (mpc->mpc_oemptr) {
 		struct mp_config_oemtable *oem_table = 
 			(struct mp_config_oemtable *)mpc->mpc_oemptr;
-		parse_unisys_oem((char *)oem_table, oem_table->oem_length);
+		return parse_unisys_oem((char *)oem_table, oem_table->oem_length);
 	}
+	return 0;
 }
 
 /* Hook from generic ACPI tables.c */
-static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
 	unsigned long oem_addr; 
 	int oem_entries;
 	if (!find_unisys_acpi_oem_table(&oem_addr, &oem_entries))
-		parse_unisys_oem((char *)oem_addr, oem_entries);
+		return parse_unisys_oem((char *)oem_addr, oem_entries);
+	return 0;
 }
 
 
diff -Nru a/include/asm-i386/mach-generic/mach_apic.h b/include/asm-i386/mach-generic/mach_apic.h
--- a/include/asm-i386/mach-generic/mach_apic.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-i386/mach-generic/mach_apic.h	Tue Jun 15 22:20:39 2004
@@ -3,14 +3,15 @@
 
 #include <asm/genapic.h>
 
-#define esr_disable (genapic->esr_disable)
+#define esr_disable (genapic->ESR_DISABLE)
 #define NO_BALANCE_IRQ (genapic->no_balance_irq)
 #define NO_IOAPIC_CHECK	(genapic->no_ioapic_check)
 #define APIC_BROADCAST_ID (genapic->apic_broadcast_id)
 #define INT_DELIVERY_MODE (genapic->int_delivery_mode)
 #define INT_DEST_MODE (genapic->int_dest_mode)
+#undef APIC_DEST_LOGICAL
+#define APIC_DEST_LOGICAL (genapic->apic_destination_logical)
 #define TARGET_CPUS	  (genapic->target_cpus())
-#define apic_id_registered (genapic->apic_id_registered)
 #define apic_id_registered (genapic->apic_id_registered)
 #define init_apic_ldr (genapic->init_apic_ldr)
 #define ioapic_phys_id_map (genapic->ioapic_phys_id_map)
diff -Nru a/include/asm-i386/param.h b/include/asm-i386/param.h
--- a/include/asm-i386/param.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-i386/param.h	Tue Jun 15 22:20:37 2004
@@ -4,7 +4,7 @@
 #ifdef __KERNEL__
 # define HZ		1000		/* Internal kernel timer frequency */
 # define USER_HZ	100		/* .. some user interfaces are in "ticks" */
-# define CLOCKS_PER_SEC	(USER_HZ)	/* like times() */
+# define CLOCKS_PER_SEC		(USER_HZ)	/* like times() */
 #endif
 
 #ifndef HZ
diff -Nru a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
--- a/include/asm-i386/pgtable.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-i386/pgtable.h	Tue Jun 15 22:20:43 2004
@@ -314,23 +314,25 @@
 #define pte_unmap_nested(pte) do { } while (0)
 #endif
 
-#if defined(CONFIG_HIGHPTE) && defined(CONFIG_HIGHMEM4G)
-typedef u32 pte_addr_t;
-#endif
-
-#if defined(CONFIG_HIGHPTE) && defined(CONFIG_HIGHMEM64G)
-typedef u64 pte_addr_t;
-#endif
-
-#if !defined(CONFIG_HIGHPTE)
-typedef pte_t *pte_addr_t;
-#endif
-
 /*
  * The i386 doesn't have any external MMU info: the kernel page
  * tables contain all the necessary information.
+ *
+ * Also, we only update the dirty/accessed state if we set
+ * the dirty bit by hand in the kernel, since the hardware
+ * will do the accessed bit for us, and we don't want to
+ * race with other CPU's that might be updating the dirty
+ * bit at the same time.
  */
 #define update_mmu_cache(vma,address,pte) do { } while (0)
+#define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
+	do {								  \
+		if (__dirty) {						  \
+			(__ptep)->pte_low = (__entry).pte_low;	  	  \
+			flush_tlb_page(__vma, __address);		  \
+		}							  \
+	} while (0)
 
 /* Encode and de-code a swap entry */
 #define __swp_type(x)			(((x).val >> 1) & 0x1f)
diff -Nru a/include/asm-i386/processor.h b/include/asm-i386/processor.h
--- a/include/asm-i386/processor.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-i386/processor.h	Tue Jun 15 22:20:36 2004
@@ -59,6 +59,7 @@
 	char	x86_model_id[64];
 	int 	x86_cache_size;  /* in KB - valid for CPUS which support this
 				    call  */
+	int 	x86_cache_alignment;	/* In bytes */
 	int	fdiv_bug;
 	int	f00f_bug;
 	int	coma_bug;
@@ -647,5 +648,12 @@
 #define spin_lock_prefetch(x)	prefetchw(x)
 
 extern void select_idle_routine(const struct cpuinfo_x86 *c);
+
+#define cache_line_size() (boot_cpu_data.x86_cache_alignment)
+
+#ifdef CONFIG_SCHED_SMT
+#define ARCH_HAS_SCHED_DOMAIN
+#define ARCH_HAS_SCHED_WAKE_IDLE
+#endif
 
 #endif /* __ASM_I386_PROCESSOR_H */
diff -Nru a/include/asm-i386/rmap.h b/include/asm-i386/rmap.h
--- a/include/asm-i386/rmap.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,21 +0,0 @@
-#ifndef _I386_RMAP_H
-#define _I386_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#ifdef CONFIG_HIGHPTE
-static inline pte_t *rmap_ptep_map(pte_addr_t pte_paddr)
-{
-	unsigned long pfn = (unsigned long)(pte_paddr >> PAGE_SHIFT);
-	unsigned long off = ((unsigned long)pte_paddr) & ~PAGE_MASK;
-	return (pte_t *)((char *)kmap_atomic(pfn_to_page(pfn), KM_PTE2) + off);
-}
-
-static inline void rmap_ptep_unmap(pte_t *pte)
-{
-	kunmap_atomic(pte, KM_PTE2);
-}
-#endif
-
-#endif
diff -Nru a/include/asm-i386/smp.h b/include/asm-i386/smp.h
--- a/include/asm-i386/smp.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-i386/smp.h	Tue Jun 15 22:20:41 2004
@@ -34,7 +34,7 @@
 extern void smp_alloc_memory(void);
 extern int pic_mode;
 extern int smp_num_siblings;
-extern int cpu_sibling_map[];
+extern cpumask_t cpu_sibling_map[];
 
 extern void smp_flush_tlb(void);
 extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs);
diff -Nru a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
--- a/include/asm-i386/spinlock.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-i386/spinlock.h	Tue Jun 15 22:20:38 2004
@@ -42,6 +42,7 @@
 
 #define spin_is_locked(x)	(*(volatile signed char *)(&(x)->lock) <= 0)
 #define spin_unlock_wait(x)	do { barrier(); } while(spin_is_locked(x))
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 #define spin_lock_string \
 	"\n1:\t" \
diff -Nru a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
--- a/include/asm-i386/thread_info.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-i386/thread_info.h	Tue Jun 15 22:20:37 2004
@@ -47,15 +47,7 @@
 
 #else /* !__ASSEMBLY__ */
 
-/* offsets into the thread_info struct for assembly code access */
-#define TI_TASK		0x00000000
-#define TI_EXEC_DOMAIN	0x00000004
-#define TI_FLAGS	0x00000008
-#define TI_STATUS	0x0000000C
-#define TI_CPU		0x00000010
-#define TI_PRE_COUNT	0x00000014
-#define TI_ADDR_LIMIT	0x00000018
-#define TI_RESTART_BLOCK 0x000001C
+#include <asm/asm_offsets.h>
 
 #endif
 
diff -Nru a/include/asm-i386/timer.h b/include/asm-i386/timer.h
--- a/include/asm-i386/timer.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-i386/timer.h	Tue Jun 15 22:20:38 2004
@@ -4,11 +4,16 @@
 /**
  * struct timer_ops - used to define a timer source
  *
+ * @name: name of the timer.
  * @init: Probes and initializes the timer. Takes clock= override 
- *  string as an argument. Returns 0 on success, anything else on failure.
- * @mark_offset: called by the timer interrupt
- * @get_offset: called by gettimeofday().  Returns the number of ms since the
- *	last timer intruupt.
+ *        string as an argument. Returns 0 on success, anything else
+ *        on failure.
+ * @mark_offset: called by the timer interrupt.
+ * @get_offset:  called by gettimeofday(). Returns the number of microseconds
+ *               since the last timer interupt.
+ * @monotonic_clock: returns the number of nanoseconds since the init of the
+ *                   timer.
+ * @delay: delays this many clock cycles.
  */
 struct timer_opts{
 	char* name;
diff -Nru a/include/asm-i386/types.h b/include/asm-i386/types.h
--- a/include/asm-i386/types.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-i386/types.h	Tue Jun 15 22:20:41 2004
@@ -63,6 +63,8 @@
 #define HAVE_SECTOR_T
 #endif
 
+typedef unsigned short kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
--- a/include/asm-i386/uaccess.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-i386/uaccess.h	Tue Jun 15 22:20:37 2004
@@ -43,7 +43,7 @@
 } ____cacheline_aligned_in_smp movsl_mask;
 #endif
 
-#define __addr_ok(addr) ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
+#define __addr_ok(addr) ((unsigned long __force)(addr) < (current_thread_info()->addr_limit.seg))
 
 /*
  * Test whether a block of memory is a valid user space address.
@@ -56,6 +56,7 @@
  */
 #define __range_ok(addr,size) ({ \
 	unsigned long flag,sum; \
+	__chk_user_ptr(addr); \
 	asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \
 		:"=&r" (flag), "=r" (sum) \
 		:"1" (addr),"g" ((int)(size)),"g" (current_thread_info()->addr_limit.seg)); \
@@ -170,6 +171,7 @@
  */
 #define get_user(x,ptr)							\
 ({	int __ret_gu,__val_gu;						\
+	__chk_user_ptr(ptr);						\
 	switch(sizeof (*(ptr))) {					\
 	case 1:  __get_user_x(1,__ret_gu,__val_gu,ptr); break;		\
 	case 2:  __get_user_x(2,__ret_gu,__val_gu,ptr); break;		\
@@ -288,6 +290,7 @@
 #define __put_user_size(x,ptr,size,retval,errret)			\
 do {									\
 	retval = 0;							\
+	__chk_user_ptr(ptr);						\
 	switch (size) {							\
 	case 1: __put_user_asm(x,ptr,retval,"b","b","iq",errret);break;	\
 	case 2: __put_user_asm(x,ptr,retval,"w","w","ir",errret);break; \
@@ -346,6 +349,7 @@
 #define __get_user_size(x,ptr,size,retval,errret)			\
 do {									\
 	retval = 0;							\
+	__chk_user_ptr(ptr);						\
 	switch (size) {							\
 	case 1: __get_user_asm(x,ptr,retval,"b","b","=q",errret);break;	\
 	case 2: __get_user_asm(x,ptr,retval,"w","w","=r",errret);break;	\
@@ -403,13 +407,13 @@
 
 		switch (n) {
 		case 1:
-			__put_user_size(*(u8 *)from, (u8 *)to, 1, ret, 1);
+			__put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret, 1);
 			return ret;
 		case 2:
-			__put_user_size(*(u16 *)from, (u16 *)to, 2, ret, 2);
+			__put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret, 2);
 			return ret;
 		case 4:
-			__put_user_size(*(u32 *)from, (u32 *)to, 4, ret, 4);
+			__put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret, 4);
 			return ret;
 		}
 	}
diff -Nru a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
--- a/include/asm-i386/unistd.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-i386/unistd.h	Tue Jun 15 22:20:42 2004
@@ -288,8 +288,9 @@
 #define __NR_mq_timedreceive	(__NR_mq_open+3)
 #define __NR_mq_notify		(__NR_mq_open+4)
 #define __NR_mq_getsetattr	(__NR_mq_open+5)
+#define __NR_sys_kexec_load	283
 
-#define NR_syscalls 283
+#define NR_syscalls 284
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 
@@ -379,6 +380,31 @@
 	  "0" ((long)(arg6))); \
 __syscall_return(type,__res); \
 }
+
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
diff -Nru a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
--- a/include/asm-ia64/acpi.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-ia64/acpi.h	Tue Jun 15 22:20:44 2004
@@ -96,7 +96,6 @@
 const char *acpi_get_sysname (void);
 int acpi_request_vector (u32 int_type);
 int acpi_register_irq (u32 gsi, u32 polarity, u32 trigger);
-int acpi_irq_to_vector (u32 irq); /* deprecated in favor of acpi_gsi_to_irq */
 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 
 #ifdef CONFIG_ACPI_NUMA
diff -Nru a/include/asm-ia64/asmmacro.h b/include/asm-ia64/asmmacro.h
--- a/include/asm-ia64/asmmacro.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-ia64/asmmacro.h	Tue Jun 15 22:20:38 2004
@@ -100,4 +100,12 @@
 # define TEXT_ALIGN(n)
 #endif
 
+#ifdef HAVE_SERIALIZE_DIRECTIVE
+# define dv_serialize_data		.serialize.data
+# define dv_serialize_instruction	.serialize.instruction
+#else
+# define dv_serialize_data
+# define dv_serialize_instruction
+#endif
+
 #endif /* _ASM_IA64_ASMMACRO_H */
diff -Nru a/include/asm-ia64/atomic.h b/include/asm-ia64/atomic.h
--- a/include/asm-ia64/atomic.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ia64/atomic.h	Tue Jun 15 22:20:37 2004
@@ -159,10 +159,10 @@
 
 #define atomic_sub_and_test(i,v)	(atomic_sub_return((i), (v)) == 0)
 #define atomic_dec_and_test(v)		(atomic_sub_return(1, (v)) == 0)
-#define atomic_inc_and_test(v)		(atomic_add_return(1, (v)) != 0)
+#define atomic_inc_and_test(v)		(atomic_add_return(1, (v)) == 0)
 #define atomic64_sub_and_test(i,v)	(atomic64_sub_return((i), (v)) == 0)
 #define atomic64_dec_and_test(v)	(atomic64_sub_return(1, (v)) == 0)
-#define atomic64_inc_and_test(v)	(atomic64_add_return(1, (v)) != 0)
+#define atomic64_inc_and_test(v)	(atomic64_add_return(1, (v)) == 0)
 
 #define atomic_add(i,v)			atomic_add_return((i), (v))
 #define atomic_sub(i,v)			atomic_sub_return((i), (v))
diff -Nru a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
--- a/include/asm-ia64/bitops.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-ia64/bitops.h	Tue Jun 15 22:20:58 2004
@@ -11,7 +11,7 @@
 
 #include <linux/compiler.h>
 #include <linux/types.h>
-
+#include <asm/bitops.h>
 #include <asm/intrinsics.h>
 
 /**
@@ -359,92 +359,20 @@
 
 #endif /* __KERNEL__ */
 
-/*
- * Find next zero bit in a bitmap reasonably efficiently..
- */
-static inline int
-find_next_zero_bit (void *addr, unsigned long size, unsigned long offset)
-{
-	unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
-	unsigned long result = offset & ~63UL;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 63UL;
-	if (offset) {
-		tmp = *(p++);
-		tmp |= ~0UL >> (64-offset);
-		if (size < 64)
-			goto found_first;
-		if (~tmp)
-			goto found_middle;
-		size -= 64;
-		result += 64;
-	}
-	while (size & ~63UL) {
-		if (~(tmp = *(p++)))
-			goto found_middle;
-		result += 64;
-		size -= 64;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)		/* any bits zero? */
-		return result + size;	/* nope */
-found_middle:
-	return result + ffz(tmp);
-}
+extern int __find_next_zero_bit (void *addr, unsigned long size,
+			unsigned long offset);
+extern int __find_next_bit(const void *addr, unsigned long size,
+			unsigned long offset);
+
+#define find_next_zero_bit(addr, size, offset) \
+			__find_next_zero_bit((addr), (size), (offset))
+#define find_next_bit(addr, size, offset) \
+			__find_next_bit((addr), (size), (offset))
 
 /*
  * The optimizer actually does good code for this case..
  */
 #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
-
-/*
- * Find next bit in a bitmap reasonably efficiently..
- */
-static inline int
-find_next_bit(const void *addr, unsigned long size, unsigned long offset)
-{
-	unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
-	unsigned long result = offset & ~63UL;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 63UL;
-	if (offset) {
-		tmp = *(p++);
-		tmp &= ~0UL << offset;
-		if (size < 64)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= 64;
-		result += 64;
-	}
-	while (size & ~63UL) {
-		if ((tmp = *(p++)))
-			goto found_middle;
-		result += 64;
-		size -= 64;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-  found_first:
-	tmp &= ~0UL >> (64-size);
-	if (tmp == 0UL)		/* Are any bits set? */
-		return result + size; /* Nope. */
-  found_middle:
-	return result + __ffs(tmp);
-}
 
 #define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
 
diff -Nru a/include/asm-ia64/cacheflush.h b/include/asm-ia64/cacheflush.h
--- a/include/asm-ia64/cacheflush.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ia64/cacheflush.h	Tue Jun 15 22:20:37 2004
@@ -29,6 +29,9 @@
 	clear_bit(PG_arch_1, &(page)->flags);	\
 } while (0)
 
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
+
 extern void flush_icache_range (unsigned long start, unsigned long end);
 
 #define flush_icache_user_range(vma, page, user_addr, len)					\
diff -Nru a/include/asm-ia64/cpu.h b/include/asm-ia64/cpu.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-ia64/cpu.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,17 @@
+#ifndef _ASM_IA64_CPU_H_
+#define _ASM_IA64_CPU_H_
+
+#include <linux/device.h>
+#include <linux/cpu.h>
+#include <linux/topology.h>
+#include <linux/percpu.h>
+
+struct ia64_cpu {
+	struct cpu cpu;
+};
+
+DECLARE_PER_CPU(struct ia64_cpu, cpu_devices);
+
+DECLARE_PER_CPU(int, cpu_state);
+
+#endif /* _ASM_IA64_CPU_H_ */
diff -Nru a/include/asm-ia64/delay.h b/include/asm-ia64/delay.h
--- a/include/asm-ia64/delay.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ia64/delay.h	Tue Jun 15 22:20:36 2004
@@ -44,6 +44,12 @@
 	ia64_srlz_d();
 }
 
+static __inline__ unsigned long
+ia64_get_itv (void)
+{
+	return ia64_getreg(_IA64_REG_CR_ITV);
+}
+
 static __inline__ void
 ia64_set_itc (unsigned long val)
 {
diff -Nru a/include/asm-ia64/gcc_intrin.h b/include/asm-ia64/gcc_intrin.h
--- a/include/asm-ia64/gcc_intrin.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-ia64/gcc_intrin.h	Tue Jun 15 22:20:40 2004
@@ -4,9 +4,10 @@
  *
  * Copyright (C) 2002,2003 Jun Nakajima <jun.nakajima@intel.com>
  * Copyright (C) 2002,2003 Suresh Siddha <suresh.b.siddha@intel.com>
- *
  */
 
+#include <linux/compiler.h>
+
 /* define this macro to get some asm stmts included in 'c' files */
 #define ASM_SUPPORTED
 
@@ -23,7 +24,7 @@
 extern void ia64_bad_param_for_setreg (void);
 extern void ia64_bad_param_for_getreg (void);
 
-register unsigned long ia64_r13 asm ("r13");
+register unsigned long ia64_r13 asm ("r13") __attribute_used__;
 
 #define ia64_setreg(regnum, val)						\
 ({										\
@@ -377,8 +378,15 @@
 })
 
 #define ia64_srlz_i()	asm volatile (";; srlz.i ;;" ::: "memory")
-
 #define ia64_srlz_d()	asm volatile (";; srlz.d" ::: "memory");
+
+#ifdef HAVE_SERIALIZE_DIRECTIVE
+# define ia64_dv_serialize_data()		asm volatile (".serialize.data");
+# define ia64_dv_serialize_instruction()	asm volatile (".serialize.instruction");
+#else
+# define ia64_dv_serialize_data()
+# define ia64_dv_serialize_instruction()
+#endif
 
 #define ia64_nop(x)	asm volatile ("nop %0"::"i"(x));
 
diff -Nru a/include/asm-ia64/ide.h b/include/asm-ia64/ide.h
--- a/include/asm-ia64/ide.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-ia64/ide.h	Tue Jun 15 22:20:41 2004
@@ -25,6 +25,8 @@
 # endif
 #endif
 
+#define IDE_ARCH_OBSOLETE_DEFAULTS
+
 static inline int ide_default_irq(unsigned long base)
 {
 	switch (base) {
@@ -52,6 +54,9 @@
 		return 0;
 	}
 }
+
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #ifdef CONFIG_PCI
 #define ide_init_default_irq(base)	(0)
diff -Nru a/include/asm-ia64/intel_intrin.h b/include/asm-ia64/intel_intrin.h
--- a/include/asm-ia64/intel_intrin.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-ia64/intel_intrin.h	Tue Jun 15 22:21:04 2004
@@ -204,6 +204,9 @@
 #define ia64_srlz_d		__dsrlz
 #define ia64_srlz_i		__isrlz
 
+#define ia64_dv_serialize_data()
+#define ia64_dv_serialize_instruction()
+
 #define ia64_st1_rel		__st1_rel
 #define ia64_st2_rel		__st2_rel
 #define ia64_st4_rel		__st4_rel
diff -Nru a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
--- a/include/asm-ia64/pgtable.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-ia64/pgtable.h	Tue Jun 15 22:20:38 2004
@@ -8,7 +8,7 @@
  * This hopefully works with any (fixed) IA-64 page-size, as defined
  * in <asm/page.h> (currently 8192).
  *
- * Copyright (C) 1998-2003 Hewlett-Packard Co
+ * Copyright (C) 1998-2004 Hewlett-Packard Co
  *	David Mosberger-Tang <davidm@hpl.hp.com>
  */
 
@@ -102,7 +102,7 @@
  * can map.
  */
 #define PMD_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3))
-#define PMD_SIZE	(__IA64_UL(1) << PMD_SHIFT)
+#define PMD_SIZE	(1UL << PMD_SHIFT)
 #define PMD_MASK	(~(PMD_SIZE-1))
 #define PTRS_PER_PMD	(__IA64_UL(1) << (PAGE_SHIFT-3))
 
@@ -469,14 +469,48 @@
 	struct vm_area_struct * prev, unsigned long start, unsigned long end);
 #endif
 
-typedef pte_t *pte_addr_t;
-
 /*
  * IA-64 doesn't have any external MMU info: the page tables contain all the necessary
  * information.  However, we use this routine to take care of any (delayed) i-cache
  * flushing that may be necessary.
  */
 extern void update_mmu_cache (struct vm_area_struct *vma, unsigned long vaddr, pte_t pte);
+
+#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
+/*
+ * Update PTEP with ENTRY, which is guaranteed to be a less
+ * restrictive PTE.  That is, ENTRY may have the ACCESSED, DIRTY, and
+ * WRITABLE bits turned on, when the value at PTEP did not.  The
+ * WRITABLE bit may only be turned if SAFELY_WRITABLE is TRUE.
+ *
+ * SAFELY_WRITABLE is TRUE if we can update the value at PTEP without
+ * having to worry about races.  On SMP machines, there are only two
+ * cases where this is true:
+ *
+ *	(1) *PTEP has the PRESENT bit turned OFF
+ *	(2) ENTRY has the DIRTY bit turned ON
+ *
+ * On ia64, we could implement this routine with a cmpxchg()-loop
+ * which ORs in the _PAGE_A/_PAGE_D bit if they're set in ENTRY.
+ * However, like on x86, we can get a more streamlined version by
+ * observing that it is OK to drop ACCESSED bit updates when
+ * SAFELY_WRITABLE is FALSE.  Besides being rare, all that would do is
+ * result in an extra Access-bit fault, which would then turn on the
+ * ACCESSED bit in the low-level fault handler (iaccess_bit or
+ * daccess_bit in ivt.S).
+ */
+#ifdef CONFIG_SMP
+# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable)	\
+do {											\
+	if (__safely_writable) {							\
+		set_pte(__ptep, __entry);						\
+		flush_tlb_page(__vma, __addr);						\
+	}										\
+} while (0)
+#else
+# define ptep_set_access_flags(__vma, __addr, __ptep, __entry, __safely_writable)	\
+	ptep_establish(__vma, __addr, __ptep, __entry)
+#endif
 
 #  ifdef CONFIG_VIRTUAL_MEM_MAP
   /* arch mem_map init routine is needed due to holes in a virtual mem_map */
diff -Nru a/include/asm-ia64/rmap.h b/include/asm-ia64/rmap.h
--- a/include/asm-ia64/rmap.h	Tue Jun 15 22:20:40 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _ASM_IA64_RMAP_H
-#define _ASM_IA64_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif /* _ASM_IA64_RMAP_H */
diff -Nru a/include/asm-ia64/signal.h b/include/asm-ia64/signal.h
--- a/include/asm-ia64/signal.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ia64/signal.h	Tue Jun 15 22:20:37 2004
@@ -176,7 +176,6 @@
 #  include <asm/sigcontext.h>
 
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
--- a/include/asm-ia64/smp.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-ia64/smp.h	Tue Jun 15 22:20:40 2004
@@ -36,9 +36,8 @@
 	int cpu_phys_id[NR_CPUS];
 } smp_boot_data __initdata;
 
-extern char no_int_routing __initdata;
+extern char no_int_routing __devinitdata;
 
-extern cpumask_t phys_cpu_present_map;
 extern cpumask_t cpu_online_map;
 extern unsigned long ipi_base_addr;
 extern unsigned char smp_int_redirect;
@@ -48,8 +47,6 @@
 
 extern unsigned long ap_wakeup_vector;
 
-#define cpu_possible_map phys_cpu_present_map
-
 /*
  * Function to map hard smp processor id to logical id.  Slow, so don't use this in
  * performance-critical code.
@@ -113,6 +110,7 @@
 /* Upping and downing of CPUs */
 extern int __cpu_disable (void);
 extern void __cpu_die (unsigned int cpu);
+extern void cpu_die (void) __attribute__ ((noreturn));
 extern int __cpu_up (unsigned int cpu);
 extern void __init smp_build_cpu_map(void);
 
@@ -122,6 +120,8 @@
 extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info,
 				     int retry, int wait);
 extern void smp_send_reschedule (int cpu);
+extern void lock_ipi_calllock(void);
+extern void unlock_ipi_calllock(void);
 
 #endif /* CONFIG_SMP */
 #endif /* _ASM_IA64_SMP_H */
diff -Nru a/include/asm-ia64/sn/arch.h b/include/asm-ia64/sn/arch.h
--- a/include/asm-ia64/sn/arch.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-ia64/sn/arch.h	Tue Jun 15 22:20:39 2004
@@ -20,12 +20,6 @@
 typedef u64	mmr_t;
 typedef u64	nic_t;
 
-#define CNODE_TO_CPU_BASE(_cnode)	(NODEPDA(_cnode)->node_first_cpu)
-
-#define NASID_TO_COMPACT_NODEID(nasid)  (nasid_to_cnodeid(nasid))
-#define COMPACT_TO_NASID_NODEID(cnode)  (cnodeid_to_nasid(cnode))
-
-
 #define INVALID_NASID		((nasid_t)-1)
 #define INVALID_CNODEID		((cnodeid_t)-1)
 #define INVALID_PNODEID		((pnodeid_t)-1)
@@ -34,9 +28,7 @@
 #define	INVALID_PARTID		((partid_t)-1)
 
 extern cpuid_t cnodetocpu(cnodeid_t);
-void   sn_flush_all_caches(long addr, long bytes);
-
-extern int     is_fine_dirmode(void);
-
+extern void sn_flush_all_caches(long addr, long bytes);
+extern int is_fine_dirmode(void);
 
 #endif /* _ASM_IA64_SN_ARCH_H */
diff -Nru a/include/asm-ia64/sn/intr.h b/include/asm-ia64/sn/intr.h
--- a/include/asm-ia64/sn/intr.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-ia64/sn/intr.h	Tue Jun 15 22:20:38 2004
@@ -8,9 +8,11 @@
 #ifndef _ASM_IA64_SN_INTR_H
 #define _ASM_IA64_SN_INTR_H
 
+#include <asm/sn/types.h>
 #include <asm/sn/sn2/intr.h>
 
 extern void sn_send_IPI_phys(long, int, int);
+extern void intr_init_vecblk(cnodeid_t node);
 
 #define CPU_VECTOR_TO_IRQ(cpuid,vector) (vector)
 #define SN_CPU_FROM_IRQ(irq)	(0)
diff -Nru a/include/asm-ia64/sn/module.h b/include/asm-ia64/sn/module.h
--- a/include/asm-ia64/sn/module.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-ia64/sn/module.h	Tue Jun 15 22:20:38 2004
@@ -184,10 +184,6 @@
 extern int		nummodules;
 
 extern module_t	       *module_lookup(moduleid_t id);
-
-extern int		get_kmod_sys_snum(cmoduleid_t cmod,
-					  char *snum);
-
 extern void		format_module_id(char *buffer, moduleid_t m, int fmt);
 extern int		parse_module_id(char *buffer);
 
diff -Nru a/include/asm-ia64/sn/nodepda.h b/include/asm-ia64/sn/nodepda.h
--- a/include/asm-ia64/sn/nodepda.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ia64/sn/nodepda.h	Tue Jun 15 22:20:37 2004
@@ -36,13 +36,6 @@
 
 
 struct nodepda_s {
-
-
-	cpuid_t         node_first_cpu; /* Starting cpu number for node */
-					/* WARNING: no guarantee that   */
-					/*  the second cpu on a node is */
-					/*  node_first_cpu+1.           */
-
 	vertex_hdl_t 	xbow_vhdl;
 	nasid_t		xbow_peer;	/* NASID of our peer hub on xbow */
 	struct semaphore xbow_sema;	/* Sema for xbow synchronization */
diff -Nru a/include/asm-ia64/sn/sn2/sn_private.h b/include/asm-ia64/sn/sn2/sn_private.h
--- a/include/asm-ia64/sn/sn2/sn_private.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ia64/sn/sn2/sn_private.h	Tue Jun 15 22:20:37 2004
@@ -233,7 +233,7 @@
  * address.
  */
 #define paddr_dimm(_pa)		((_pa & MD_BANK_MASK) >> MD_BANK_SHFT)
-#define paddr_cnode(_pa)	(NASID_TO_COMPACT_NODEID(NASID_GET(_pa)))
+#define paddr_cnode(_pa)	(nasid_to_cnodeid(NASID_GET(_pa)))
 extern void membank_pathname_get(paddr_t, char *);
 
 extern void crbx(nasid_t nasid, void (*pf) (char *, ...));
diff -Nru a/include/asm-ia64/sn/types.h b/include/asm-ia64/sn/types.h
--- a/include/asm-ia64/sn/types.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-ia64/sn/types.h	Tue Jun 15 22:21:02 2004
@@ -15,11 +15,9 @@
 typedef unsigned int    moduleid_t;     /* user-visible module number type */
 typedef unsigned int    cmoduleid_t;    /* kernel compact module id type */
 typedef signed char     slabid_t;
-typedef unsigned char	clusterid_t;	/* Clusterid of the cell */
 
 typedef unsigned long iopaddr_t;
 typedef unsigned long paddr_t;
-typedef unsigned long pfn_t;
 typedef short cnodeid_t;
 
 #endif /* _ASM_IA64_SN_TYPES_H */
diff -Nru a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
--- a/include/asm-ia64/spinlock.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ia64/spinlock.h	Tue Jun 15 22:20:36 2004
@@ -32,10 +32,10 @@
  * carefully coded to touch only those registers that spin_lock() marks "clobbered".
  */
 
-#define IA64_SPINLOCK_CLOBBERS "ar.ccv", "ar.pfs", "p14", "r28", "r29", "r30", "b6", "memory"
+#define IA64_SPINLOCK_CLOBBERS "ar.ccv", "ar.pfs", "p14", "p15", "r27", "r28", "r29", "r30", "b6", "memory"
 
 static inline void
-_raw_spin_lock (spinlock_t *lock)
+_raw_spin_lock_flags (spinlock_t *lock, unsigned long flags)
 {
 	register volatile unsigned int *ptr asm ("r31") = &lock->lock;
 
@@ -50,9 +50,10 @@
 		      "cmpxchg4.acq r30 = [%1], r30, ar.ccv\n\t"
 		      "movl r29 = ia64_spinlock_contention_pre3_4;;\n\t"
 		      "cmp4.ne p14, p0 = r30, r0\n\t"
-		      "mov b6 = r29;;\n"
+		      "mov b6 = r29;;\n\t"
+		      "mov r27=%2\n\t"
 		      "(p14) br.cond.spnt.many b6"
-		      : "=r"(ptr) : "r"(ptr) : IA64_SPINLOCK_CLOBBERS);
+		      : "=r"(ptr) : "r"(ptr), "r" (flags) : IA64_SPINLOCK_CLOBBERS);
 # else
 	asm volatile ("{\n\t"
 		      "  mov ar.ccv = r0\n\t"
@@ -60,33 +61,38 @@
 		      "  mov r30 = 1;;\n\t"
 		      "}\n\t"
 		      "cmpxchg4.acq r30 = [%1], r30, ar.ccv;;\n\t"
-		      "cmp4.ne p14, p0 = r30, r0\n"
+		      "cmp4.ne p14, p0 = r30, r0\n\t"
+		      "mov r27=%2\n\t"
 		      "(p14) brl.cond.spnt.many ia64_spinlock_contention_pre3_4;;"
-		      : "=r"(ptr) : "r"(ptr) : IA64_SPINLOCK_CLOBBERS);
+		      : "=r"(ptr) : "r"(ptr), "r" (flags) : IA64_SPINLOCK_CLOBBERS);
 # endif /* CONFIG_MCKINLEY */
 #else
 # ifdef CONFIG_ITANIUM
 	/* don't use brl on Itanium... */
 	/* mis-declare, so we get the entry-point, not it's function descriptor: */
 	asm volatile ("mov r30 = 1\n\t"
+		      "mov r27=%2\n\t"
 		      "mov ar.ccv = r0;;\n\t"
 		      "cmpxchg4.acq r30 = [%0], r30, ar.ccv\n\t"
 		      "movl r29 = ia64_spinlock_contention;;\n\t"
 		      "cmp4.ne p14, p0 = r30, r0\n\t"
-		      "mov b6 = r29;;\n"
+		      "mov b6 = r29;;\n\t"
 		      "(p14) br.call.spnt.many b6 = b6"
-		      : "=r"(ptr) : "r"(ptr) : IA64_SPINLOCK_CLOBBERS);
+		      : "=r"(ptr) : "r"(ptr), "r" (flags) : IA64_SPINLOCK_CLOBBERS);
 # else
 	asm volatile ("mov r30 = 1\n\t"
+		      "mov r27=%2\n\t"
 		      "mov ar.ccv = r0;;\n\t"
 		      "cmpxchg4.acq r30 = [%0], r30, ar.ccv;;\n\t"
 		      "cmp4.ne p14, p0 = r30, r0\n\t"
 		      "(p14) brl.call.spnt.many b6=ia64_spinlock_contention;;"
-		      : "=r"(ptr) : "r"(ptr) : IA64_SPINLOCK_CLOBBERS);
+		      : "=r"(ptr) : "r"(ptr), "r" (flags) : IA64_SPINLOCK_CLOBBERS);
 # endif /* CONFIG_MCKINLEY */
 #endif
 }
+#define _raw_spin_lock(lock) _raw_spin_lock_flags(lock, 0)
 #else /* !ASM_SUPPORTED */
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 # define _raw_spin_lock(x)								\
 do {											\
 	__u32 *ia64_spinlock_ptr = (__u32 *) (x);					\
diff -Nru a/include/asm-ia64/system.h b/include/asm-ia64/system.h
--- a/include/asm-ia64/system.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-ia64/system.h	Tue Jun 15 22:20:39 2004
@@ -114,10 +114,16 @@
  */
 /* For spinlocks etc */
 
-/* clearing psr.i is implicitly serialized (visible by next insn) */
-/* setting psr.i requires data serialization */
+/*
+ * - clearing psr.i is implicitly serialized (visible by next insn)
+ * - setting psr.i requires data serialization
+ * - we need a stop-bit before reading PSR because we sometimes
+ *   write a floating-point register right before reading the PSR
+ *   and that writes to PSR.mfl
+ */
 #define __local_irq_save(x)			\
 do {						\
+	ia64_stop();				\
 	(x) = ia64_getreg(_IA64_REG_PSR);	\
 	ia64_stop();				\
 	ia64_rsm(IA64_PSR_I);			\
@@ -166,7 +172,7 @@
 #endif /* !CONFIG_IA64_DEBUG_IRQ */
 
 #define local_irq_enable()	({ ia64_ssm(IA64_PSR_I); ia64_srlz_d(); })
-#define local_save_flags(flags)	((flags) = ia64_getreg(_IA64_REG_PSR))
+#define local_save_flags(flags)	({ ia64_stop(); (flags) = ia64_getreg(_IA64_REG_PSR); })
 
 #define irqs_disabled()				\
 ({						\
@@ -233,7 +239,7 @@
  * the latest fph state from another CPU.  In other words: eager save, lazy restore.
  */
 # define switch_to(prev,next,last) do {						\
-	if (ia64_psr(ia64_task_regs(prev))->mfh) {				\
+	if (ia64_psr(ia64_task_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) {				\
 		ia64_psr(ia64_task_regs(prev))->mfh = 0;			\
 		(prev)->thread.flags |= IA64_THREAD_FPH_VALID;			\
 		__ia64_save_fpu((prev)->thread.fph);				\
diff -Nru a/include/asm-ia64/types.h b/include/asm-ia64/types.h
--- a/include/asm-ia64/types.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ia64/types.h	Tue Jun 15 22:20:37 2004
@@ -67,6 +67,8 @@
 
 typedef u64 dma_addr_t;
 
+typedef unsigned short kmem_bufctl_t;
+
 # endif /* __KERNEL__ */
 #endif /* !__ASSEMBLY__ */
 
diff -Nru a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
--- a/include/asm-ia64/unistd.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ia64/unistd.h	Tue Jun 15 22:20:37 2004
@@ -4,7 +4,7 @@
 /*
  * IA-64 Linux syscall numbers and inline-functions.
  *
- * Copyright (C) 1998-2003 Hewlett-Packard Co
+ * Copyright (C) 1998-2004 Hewlett-Packard Co
  *	David Mosberger-Tang <davidm@hpl.hp.com>
  */
 
@@ -248,20 +248,36 @@
 #define __NR_clock_nanosleep		1256
 #define __NR_fstatfs64			1257
 #define __NR_statfs64			1258
-#define __NR_reserved1			1259	/* reserved for NUMA interface */
-#define __NR_reserved2			1260	/* reserved for NUMA interface */
-#define __NR_reserved3			1261	/* reserved for NUMA interface */
+#define __NR_mbind			1259
+#define __NR_get_mempolicy		1260
+#define __NR_set_mempolicy		1261
 #define __NR_mq_open			1262
 #define __NR_mq_unlink			1263
 #define __NR_mq_timedsend		1264
 #define __NR_mq_timedreceive		1265
 #define __NR_mq_notify			1266
 #define __NR_mq_getsetattr		1267
+#define __NR_kexec_load			1268
+#define __NR_vserver			1269
 
 #ifdef __KERNEL__
 
+#include <linux/config.h>
+
 #define NR_syscalls			256 /* length of syscall table */
 
+#ifdef CONFIG_IA32_SUPPORT
+# define __ARCH_WANT_SYS_FADVISE64
+# define __ARCH_WANT_SYS_GETPGRP
+# define __ARCH_WANT_SYS_LLSEEK
+# define __ARCH_WANT_SYS_NICE
+# define __ARCH_WANT_SYS_OLD_GETRLIMIT
+# define __ARCH_WANT_SYS_OLDUMOUNT
+# define __ARCH_WANT_SYS_SIGPENDING
+# define __ARCH_WANT_SYS_SIGPROCMASK
+# define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
 
 #include <linux/types.h>
@@ -303,10 +319,10 @@
 	return sys_lseek(fd, off, whence);
 }
 
-static inline long
+static inline void
 _exit (int value)
 {
-	return sys_exit(value);
+	sys_exit(value);
 }
 
 #define exit(x) _exit(x)
@@ -372,7 +388,7 @@
  * proper prototype, but we can't use __typeof__ either, because not all cond_syscall()
  * declarations have prototypes at the moment.
  */
-#define cond_syscall(x) asmlinkage long x() __attribute__((weak,alias("sys_ni_syscall")));
+#define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")));
 
 #endif /* !__ASSEMBLY__ */
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-m68k/amigahw.h b/include/asm-m68k/amigahw.h
--- a/include/asm-m68k/amigahw.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-m68k/amigahw.h	Tue Jun 15 22:20:43 2004
@@ -252,8 +252,8 @@
 #define DMAF_ALL		(0x01FF)
 
 struct CIA {
-    unsigned char pra; 		char pad0[0xff];
-    unsigned char prb; 		char pad1[0xff];
+    unsigned char pra;		char pad0[0xff];
+    unsigned char prb;		char pad1[0xff];
     unsigned char ddra;		char pad2[0xff];
     unsigned char ddrb;		char pad3[0xff];
     unsigned char talo;		char pad4[0xff];
@@ -263,10 +263,10 @@
     unsigned char todlo;	char pad8[0xff];
     unsigned char todmid;	char pad9[0xff];
     unsigned char todhi;	char pada[0x1ff];
-    unsigned char sdr; 		char padb[0xff];
-    unsigned char icr; 		char padc[0xff];
-    unsigned char cra; 		char padd[0xff];
-    unsigned char crb; 		char pade[0xff];
+    unsigned char sdr;		char padb[0xff];
+    unsigned char icr;		char padc[0xff];
+    unsigned char cra;		char padd[0xff];
+    unsigned char crb;		char pade[0xff];
 };
 
 #define zTwoBase (0x80000000)
@@ -319,7 +319,7 @@
   unsigned int  :28, year2:4;	/* lower digit */
   unsigned int  :28, year1:4;	/* upper digit */
   unsigned int  :28, cntrl1:4;	/* control-byte 1 */
-  unsigned int  :28, cntrl2:4;	/* control-byte 2 */  
+  unsigned int  :28, cntrl2:4;	/* control-byte 2 */
   unsigned int  :28, cntrl3:4;	/* control-byte 3 */
 };
 #define TOD3000_CNTRL1_HOLD	0
@@ -341,7 +341,7 @@
   unsigned int  :28, year1:4;	/* upper digit */
   unsigned int  :28, weekday:4;
   unsigned int  :28, cntrl1:4;	/* control-byte 1 */
-  unsigned int  :28, cntrl2:4;	/* control-byte 2 */  
+  unsigned int  :28, cntrl2:4;	/* control-byte 2 */
   unsigned int  :28, cntrl3:4;	/* control-byte 3 */
 };
 
diff -Nru a/include/asm-m68k/apollodma.h b/include/asm-m68k/apollodma.h
--- a/include/asm-m68k/apollodma.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-m68k/apollodma.h	Tue Jun 15 22:21:05 2004
@@ -32,7 +32,7 @@
  *  - page registers for 5-7 don't use data bit 0, represent 128K pages
  *  - page registers for 0-3 use bit 0, represent 64K pages
  *
- * DMA transfers are limited to the lower 16MB of _physical_ memory.  
+ * DMA transfers are limited to the lower 16MB of _physical_ memory.
  * Note that addresses loaded into registers must be _physical_ addresses,
  * not logical addresses (which may differ if paging is active).
  *
@@ -42,7 +42,7 @@
  *    |  ...  |   |  ... |   |  ... |
  *    |  ...  |   |  ... |   |  ... |
  *    |  ...  |   |  ... |   |  ... |
- *   P7  ...  P0  A7 ... A0  A7 ... A0   
+ *   P7  ...  P0  A7 ... A0  A7 ... A0
  * |    Page    | Addr MSB | Addr LSB |   (DMA registers)
  *
  *  Address mapping for channels 5-7:
@@ -51,7 +51,7 @@
  *    |  ...  |   \   \   ... \  \  \  ... \  \
  *    |  ...  |    \   \   ... \  \  \  ... \  (not used)
  *    |  ...  |     \   \   ... \  \  \  ... \
- *   P7  ...  P1 (0) A7 A6  ... A0 A7 A6 ... A0   
+ *   P7  ...  P1 (0) A7 A6  ... A0 A7 A6 ... A0
  * |      Page      |  Addr MSB   |  Addr LSB  |   (DMA registers)
  *
  * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
@@ -60,7 +60,7 @@
  *
  * Transfer count (_not # bytes_) is limited to 64K, represented as actual
  * count - 1 : 64K => 0xFFFF, 1 => 0x0000.  Thus, count is always 1 or more,
- * and up to 128K bytes may be transferred on channels 5-7 in one operation. 
+ * and up to 128K bytes may be transferred on channels 5-7 in one operation.
  *
  */
 
@@ -232,7 +232,7 @@
 
 	count = 1 + dma_inb(io_port);
 	count += dma_inb(io_port) << 8;
-	
+
 	return (dmanr<=3)? count : (count<<1);
 }
 
diff -Nru a/include/asm-m68k/apollohw.h b/include/asm-m68k/apollohw.h
--- a/include/asm-m68k/apollohw.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/apollohw.h	Tue Jun 15 22:20:42 2004
@@ -4,7 +4,7 @@
 #define _ASMm68k_APOLLOHW_H_
 
 /*
-   apollo models 
+   apollo models
 */
 
 extern u_long apollo_model;
@@ -16,8 +16,8 @@
 #define APOLLO_DN4000 (4)
 #define APOLLO_DN4500 (5)
 
-/* 
-   see scn2681 data sheet for more info. 
+/*
+   see scn2681 data sheet for more info.
    member names are read_write.
 */
 
@@ -96,7 +96,7 @@
 #define cpuctrl (*(volatile unsigned int *)(IO_BASE + cpuctrl_physaddr))
 #define pica (IO_BASE + pica_physaddr)
 #define picb (IO_BASE + picb_physaddr)
-#define timer (IO_BASE + timer_physaddr)	
+#define timer (IO_BASE + timer_physaddr)
 #define addr_xlat_map ((unsigned short *)(IO_BASE + 0x17000))
 
 #define isaIO2mem(x) (((((x) & 0x3f8)  << 7) | (((x) & 0xfc00) >> 6) | ((x) & 0x7)) + 0x40000 + IO_BASE)
diff -Nru a/include/asm-m68k/atafdreg.h b/include/asm-m68k/atafdreg.h
--- a/include/asm-m68k/atafdreg.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-m68k/atafdreg.h	Tue Jun 15 22:21:03 2004
@@ -65,7 +65,7 @@
 
 /* PSG Port A Bit Nr 0 .. Side Sel .. 0 -> Side 1  1 -> Side 2 */
 #define DSKSIDE     (0x01)
-        
+
 #define DSKDRVNONE  (0x06)
 #define DSKDRV0     (0x02)
 #define DSKDRV1     (0x04)
diff -Nru a/include/asm-m68k/atari_SCCserial.h b/include/asm-m68k/atari_SCCserial.h
--- a/include/asm-m68k/atari_SCCserial.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-m68k/atari_SCCserial.h	Tue Jun 15 22:20:35 2004
@@ -20,7 +20,7 @@
 /* baud_bases for the common clocks in the Atari. These are the real
  * frequencies divided by 16.
  */
-   
+
 #define SCC_BAUD_BASE_TIMC	19200	/* 0.3072 MHz from TT-MFP, Timer C */
 #define SCC_BAUD_BASE_BCLK	153600	/* 2.4576 MHz */
 #define SCC_BAUD_BASE_PCLK4	229500	/* 3.6720 MHz */
diff -Nru a/include/asm-m68k/atari_acsi.h b/include/asm-m68k/atari_acsi.h
--- a/include/asm-m68k/atari_acsi.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/atari_acsi.h	Tue Jun 15 22:20:42 2004
@@ -27,7 +27,7 @@
 
 #define DMA_LONG_WRITE(data,mode)							\
     do {													\
-		*((unsigned long *)&dma_wd.fdc_acces_seccount) = 	\
+		*((unsigned long *)&dma_wd.fdc_acces_seccount) =	\
 			((data)<<16) | (mode);							\
 	} while(0)
 
diff -Nru a/include/asm-m68k/atarihw.h b/include/asm-m68k/atarihw.h
--- a/include/asm-m68k/atarihw.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-m68k/atarihw.h	Tue Jun 15 22:20:35 2004
@@ -53,7 +53,7 @@
 #define ATARI_SWITCH_OVSC_SND6	(ATARI_SWITCH_SND6 << ATARI_SWITCH_OVSC_SHIFT)
 #define ATARI_SWITCH_OVSC_SND7	(ATARI_SWITCH_SND7 << ATARI_SWITCH_OVSC_SHIFT)
 #define ATARI_SWITCH_OVSC_MASK	0xffff0000
-	
+
 /*
  * Define several Hardware-Chips for indication so that for the ATARI we do
  * no longer decide whether it is a Falcon or other machine . It's just
@@ -151,8 +151,8 @@
 }
 
 
-/* 
-** Shifter  
+/*
+** Shifter
  */
 #define ST_LOW  0
 #define ST_MID  1
@@ -161,22 +161,22 @@
 #define TT_MID  4
 #define TT_HIGH 6
 
-#define SHF_BAS (0xffff8200)    
-struct SHIFTER 
+#define SHF_BAS (0xffff8200)
+struct SHIFTER
  {
- 	u_char pad1;
+	u_char pad1;
 	u_char bas_hi;
 	u_char pad2;
 	u_char bas_md;
 	u_char pad3;
 	u_char volatile vcounthi;
- 	u_char pad4;
- 	u_char volatile vcountmid;
- 	u_char pad5;
- 	u_char volatile vcountlow;
- 	u_char volatile syncmode;
- 	u_char pad6;
- 	u_char pad7; 
+	u_char pad4;
+	u_char volatile vcountmid;
+	u_char pad5;
+	u_char volatile vcountlow;
+	u_char volatile syncmode;
+	u_char pad6;
+	u_char pad7;
 	u_char bas_lo;
  };
 # define shifter ((*(volatile struct SHIFTER *)SHF_BAS))
@@ -186,7 +186,7 @@
  {
   u_short off_next;
   u_short scn_width;
- };                             
+ };
 # define shifter_f030 ((*(volatile struct SHIFTER_F030 *)SHF_FBAS))
 
 
@@ -278,9 +278,9 @@
 
 /*
 ** DMA/WD1772 Disk Controller
- */                          
- 
-#define FWD_BAS (0xffff8604)  
+ */
+
+#define FWD_BAS (0xffff8604)
 struct DMA_WD
  {
   u_short fdc_acces_seccount;
@@ -364,9 +364,9 @@
 #define	tt_scsi_regp	((volatile char *)TT_5380_BAS)
 
 
-/* 
+/*
 ** Falcon DMA Sound Subsystem
- */     
+ */
 
 #define MATRIX_BASE (0xffff8930)
 struct MATRIX
@@ -419,8 +419,8 @@
   u_short src_x_inc;
   u_short src_y_inc;
   u_long src_address;
-  u_short endmask1;  
-  u_short endmask2;  
+  u_short endmask1;
+  u_short endmask2;
   u_short endmask3;
   u_short dst_x_inc;
   u_short dst_y_inc;
@@ -430,7 +430,7 @@
   u_short hlf_op_reg;
   u_short log_op_reg;
   u_short lin_nm_reg;
-  u_short skew_reg;  
+  u_short skew_reg;
  };
 # define blitter ((*(volatile struct BLITTER *)BLT_BAS))
 
@@ -438,7 +438,7 @@
 /*
 ** SCC Z8530
  */
- 
+
 #define SCC_BAS (0xffff8c81)
 struct SCC
  {
@@ -462,7 +462,7 @@
 #define	tt_scc_dma	((*(volatile struct TT_DMA *)TT_SCC_DMA_BAS))
 
 /*
-** VIDEL Palette Register 
+** VIDEL Palette Register
  */
 
 #define FPL_BAS (0xffff9800)
@@ -487,7 +487,7 @@
 #define DSP56K_ICR_HM0	0x20
 #define DSP56K_ICR_HM1	0x40
 #define DSP56K_ICR_INIT	0x80
-  
+
   u_char cvr;
 #define DSP56K_CVR_HV_MASK 0x1f
 #define DSP56K_CVR_HC	0x80
@@ -500,7 +500,7 @@
 #define DSP56K_ISR_HF3	0x10
 #define DSP56K_ISR_DMA	0x40
 #define DSP56K_ISR_HREQ	0x80
-  
+
   u_char ivr;
 
   union {
@@ -510,11 +510,11 @@
   } data;
 };
 #define dsp56k_host_interface ((*(volatile struct DSP56K_HOST_INTERFACE *)DSP56K_HOST_INTERFACE_BASE))
- 
+
 /*
 ** MFP 68901
  */
- 
+
 #define MFP_BAS (0xfffffa01)
 struct MFP
  {
@@ -649,7 +649,7 @@
 #define ACIA_IRQ  (1<<7)	/* Interrupt Request */
 
 #define ACIA_BAS (0xfffffc00)
-struct ACIA 
+struct ACIA
  {
   u_char key_ctrl;
   u_char char_dummy1;
@@ -686,17 +686,17 @@
 	u_char	pad11[12];
 	u_char	track_select;	/* Falcon */
 	u_char	mode;
- 	u_char	pad12[14];
- 	/* Falcon only: */
- 	u_short	cbar_src;
- 	u_short cbar_dst;
- 	u_char	ext_div;
- 	u_char	int_div;
- 	u_char	rec_track_select;
- 	u_char	dac_src;
- 	u_char	adc_src;
- 	u_char	input_gain;
- 	u_short	output_atten;
+	u_char	pad12[14];
+	/* Falcon only: */
+	u_short	cbar_src;
+	u_short cbar_dst;
+	u_char	ext_div;
+	u_char	int_div;
+	u_char	rec_track_select;
+	u_char	dac_src;
+	u_char	adc_src;
+	u_char	input_gain;
+	u_short	output_atten;
 };
 # define tt_dmasnd ((*(volatile struct TT_DMASND *)TT_DMASND_BAS))
 
@@ -721,7 +721,7 @@
 #define	DMASND_MODE_12KHZ	  0x01
 #define	DMASND_MODE_25KHZ	  0x02
 #define	DMASND_MODE_50KHZ	  0x03
- 
+
 
 #define DMASNDSetBase(bufstart)						\
     do {								\
diff -Nru a/include/asm-m68k/atariints.h b/include/asm-m68k/atariints.h
--- a/include/asm-m68k/atariints.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-m68k/atariints.h	Tue Jun 15 22:21:02 2004
@@ -59,8 +59,8 @@
 /* ST-MFP interrupts */
 #define IRQ_MFP_BUSY      (8)
 #define IRQ_MFP_DCD       (9)
-#define IRQ_MFP_CTS  	  (10)
-#define IRQ_MFP_GPU 	  (11)
+#define IRQ_MFP_CTS	  (10)
+#define IRQ_MFP_GPU	  (11)
 #define IRQ_MFP_TIMD      (12)
 #define IRQ_MFP_TIMC	  (13)
 #define IRQ_MFP_ACIA	  (14)
@@ -81,7 +81,7 @@
 #define IRQ_TT_MFP_IO0       (24)
 #define IRQ_TT_MFP_IO1       (25)
 #define IRQ_TT_MFP_SCC	     (26)
-#define IRQ_TT_MFP_RI 	     (27)
+#define IRQ_TT_MFP_RI	     (27)
 #define IRQ_TT_MFP_TIMD      (28)
 #define IRQ_TT_MFP_TIMC	     (29)
 #define IRQ_TT_MFP_DRVRDY    (30)
@@ -122,7 +122,7 @@
 static inline int get_mfp_bit( unsigned irq, int type )
 
 {	unsigned char	mask, *reg;
-	
+
 	mask = 1 << (irq & 7);
 	reg = (unsigned char *)&mfp.int_en_a + type*4 +
 		  ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
@@ -132,7 +132,7 @@
 static inline void set_mfp_bit( unsigned irq, int type )
 
 {	unsigned char	mask, *reg;
-	
+
 	mask = 1 << (irq & 7);
 	reg = (unsigned char *)&mfp.int_en_a + type*4 +
 		  ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
@@ -143,7 +143,7 @@
 static inline void clear_mfp_bit( unsigned irq, int type )
 
 {	unsigned char	mask, *reg;
-	
+
 	mask = ~(1 << (irq & 7));
 	reg = (unsigned char *)&mfp.int_en_a + type*4 +
 		  ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
diff -Nru a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
--- a/include/asm-m68k/bitops.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-m68k/bitops.h	Tue Jun 15 22:21:05 2004
@@ -51,7 +51,7 @@
    __constant_set_bit(nr, vaddr) : \
    __generic_set_bit(nr, vaddr))
 
-#define __set_bit(nr,vaddr) set_bit(nr,vaddr) 
+#define __set_bit(nr,vaddr) set_bit(nr,vaddr)
 
 static inline void __constant_set_bit(int nr, volatile unsigned long *vaddr)
 {
diff -Nru a/include/asm-m68k/bootinfo.h b/include/asm-m68k/bootinfo.h
--- a/include/asm-m68k/bootinfo.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/bootinfo.h	Tue Jun 15 22:20:42 2004
@@ -141,11 +141,11 @@
 #define BI_MAC_GMTBIAS		0x8008	/* Mac GMT timezone offset */
 #define BI_MAC_MEMSIZE		0x8009	/* Mac RAM size (sanity check) */
 #define BI_MAC_CPUID		0x800a	/* Mac CPU type (sanity check) */
-#define BI_MAC_ROMBASE		0x800b	/* Mac system ROM base address */ 
+#define BI_MAC_ROMBASE		0x800b	/* Mac system ROM base address */
 
     /*
-     *  Macintosh hardware profile data - unused, see macintosh.h for 
-     *  resonable type values 
+     *  Macintosh hardware profile data - unused, see macintosh.h for
+     *  resonable type values
      */
 
 #define BI_MAC_VIA1BASE		0x8010	/* Mac VIA1 base address (always present) */
@@ -176,7 +176,7 @@
 
 #ifndef __ASSEMBLY__
 
-struct mac_booter_data 
+struct mac_booter_data
 {
 	unsigned long videoaddr;
 	unsigned long videorow;
@@ -202,7 +202,7 @@
 	unsigned long timedbra;
 };
 
-extern struct mac_booter_data 
+extern struct mac_booter_data
 	mac_bi_data;
 
 #endif
diff -Nru a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h
--- a/include/asm-m68k/cacheflush.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/cacheflush.h	Tue Jun 15 22:20:42 2004
@@ -45,7 +45,7 @@
 
 /* cache code */
 #define FLUSH_I_AND_D	(0x00000808)
-#define FLUSH_I 	(0x00000008)
+#define FLUSH_I		(0x00000008)
 
 /* This is needed whenever the virtual mapping of the current
    process changes.  */
@@ -95,14 +95,14 @@
 				     unsigned long start,
 				     unsigned long end)
 {
-	if (vma->vm_mm == current->mm) 
+	if (vma->vm_mm == current->mm)
 	        __flush_cache_030();
 }
 
 static inline void flush_cache_page(struct vm_area_struct *vma,
 				    unsigned long vmaddr)
 {
- 	if (vma->vm_mm == current->mm)
+	if (vma->vm_mm == current->mm)
 	        __flush_cache_030();
 }
 
@@ -128,6 +128,8 @@
 }
 
 #define flush_dcache_page(page)		__flush_page_to_ram(page_address(page))
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_page(vma, page)	__flush_page_to_ram(page_address(page))
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
diff -Nru a/include/asm-m68k/checksum.h b/include/asm-m68k/checksum.h
--- a/include/asm-m68k/checksum.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-m68k/checksum.h	Tue Jun 15 22:20:41 2004
@@ -115,7 +115,7 @@
 #define _HAVE_ARCH_IPV6_CSUM
 static __inline__ unsigned short int
 csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr,
-		__u32 len, unsigned short proto, unsigned int sum) 
+		__u32 len, unsigned short proto, unsigned int sum)
 {
 	register unsigned long tmp;
 	__asm__("addl %2@,%0\n\t"
diff -Nru a/include/asm-m68k/delay.h b/include/asm-m68k/delay.h
--- a/include/asm-m68k/delay.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-m68k/delay.h	Tue Jun 15 22:21:03 2004
@@ -22,7 +22,7 @@
  * lookup table, really, as the multiplications take much too long with
  * short delays.  This is a "reasonable" implementation, though (and the
  * first constant multiplications gets optimized away if the delay is
- * a constant)  
+ * a constant)
  */
 static inline void __const_udelay(unsigned long xloops)
 {
diff -Nru a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h
--- a/include/asm-m68k/dvma.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-m68k/dvma.h	Tue Jun 15 22:20:41 2004
@@ -2,7 +2,7 @@
  * include/asm-m68k/dma.h
  *
  * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu)
- * 
+ *
  * Hacked to fit Sun3x needs by Thomas Bogendoerfer
  */
 
@@ -16,15 +16,15 @@
 #define DVMA_PAGE_MASK	(~(DVMA_PAGE_SIZE-1))
 #define DVMA_PAGE_ALIGN(addr)	(((addr)+DVMA_PAGE_SIZE-1)&DVMA_PAGE_MASK)
 
-extern void dvma_init(void);	
-extern int dvma_map_iommu(unsigned long kaddr, unsigned long baddr, 
+extern void dvma_init(void);
+extern int dvma_map_iommu(unsigned long kaddr, unsigned long baddr,
 			  int len);
 
 #define dvma_malloc(x) dvma_malloc_align(x, 0)
 #define dvma_map(x, y) dvma_map_align(x, y, 0)
 #define dvma_map_vme(x, y) (dvma_map(x, y) & 0xfffff)
 #define dvma_map_align_vme(x, y, z) (dvma_map_align (x, y, z) & 0xfffff)
-extern unsigned long dvma_map_align(unsigned long kaddr, int len, 
+extern unsigned long dvma_map_align(unsigned long kaddr, int len,
 			    int align);
 extern void *dvma_malloc_align(unsigned long len, unsigned long align);
 
@@ -44,7 +44,7 @@
 #define IOMMU_TOTAL_ENTRIES 128
 #define IOMMU_ENTRIES 120
 
-/* empirical kludge -- dvma regions only seem to work right on 0x10000 
+/* empirical kludge -- dvma regions only seem to work right on 0x10000
    byte boundaries */
 #define DVMA_REGION_SIZE 0x10000
 #define DVMA_ALIGN(addr) (((addr)+DVMA_REGION_SIZE-1) & \
@@ -84,7 +84,7 @@
 
 
 
-/* everything below this line is specific to dma used for the onboard 
+/* everything below this line is specific to dma used for the onboard
    ESP scsi on sun3x */
 
 /* Structure to describe the current status of DMA registers on the Sparc */
diff -Nru a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h
--- a/include/asm-m68k/entry.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-m68k/entry.h	Tue Jun 15 22:21:03 2004
@@ -40,7 +40,7 @@
 	/* portable version */
 #define ALLOWINT	(~0x700)
 #define	MAX_NOINT_IPL	0
-#endif /* machine compilation types */ 
+#endif /* machine compilation types */
 
 #ifdef __ASSEMBLY__
 
diff -Nru a/include/asm-m68k/floppy.h b/include/asm-m68k/floppy.h
--- a/include/asm-m68k/floppy.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/floppy.h	Tue Jun 15 22:20:42 2004
@@ -122,9 +122,9 @@
 {
   use_virtual_dma =1;
   can_use_virtual_dma = 1;
- 
-  
-  if (MACH_IS_Q40)  
+
+
+  if (MACH_IS_Q40)
 	  return 0x3f0;
   else if(MACH_IS_SUN3X)
 	  return sun3xflop_init();
@@ -192,7 +192,7 @@
 #undef TRACE_FLPY_INT
 #define NO_FLOPPY_ASSEMBLER
 
-#ifdef TRACE_FLPY_INT 
+#ifdef TRACE_FLPY_INT
 	static int calls=0;
 	static int bytes=0;
 	static int dma_wait=0;
@@ -214,10 +214,10 @@
 		/* serve 1st byte fast: */
 
 		st=1;
-		for(lcount=virtual_dma_count, lptr=virtual_dma_addr; 
+		for(lcount=virtual_dma_count, lptr=virtual_dma_addr;
 		    lcount; lcount--, lptr++) {
 			st=inb(virtual_dma_port+4) & 0xa0 ;
-			if(st != 0xa0) 
+			if(st != 0xa0)
 				break;
 			if(virtual_dma_mode)
 				outb_p(*lptr, virtual_dma_port+5);
@@ -239,7 +239,7 @@
 		virtual_dma_residue += virtual_dma_count;
 		virtual_dma_count=0;
 #ifdef TRACE_FLPY_INT
-		printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n", 
+		printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n",
 		       virtual_dma_count, virtual_dma_residue, calls, bytes,
 		       dma_wait);
 		calls = 0;
diff -Nru a/include/asm-m68k/hwtest.h b/include/asm-m68k/hwtest.h
--- a/include/asm-m68k/hwtest.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-m68k/hwtest.h	Tue Jun 15 22:20:43 2004
@@ -2,12 +2,12 @@
  * see arch/m68k/mm/hwtest.c.
  *  -- PMM <pmaydell@chiark.greenend.org.uk> 05/1998
  *
- * Removed __init from decls.  We might want them in modules, and 
+ * Removed __init from decls.  We might want them in modules, and
  * the code is tiny anyway.  16/5/98 pb
  */
 
 #ifndef __ASM_HWTEST_H
-#define __ASM_HWTEST_H 
+#define __ASM_HWTEST_H
 
 extern int hwreg_present(volatile void *regp);
 extern int hwreg_write(volatile void *regp, unsigned short val);
diff -Nru a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h
--- a/include/asm-m68k/ide.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-m68k/ide.h	Tue Jun 15 22:20:36 2004
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 1994-1996  Linus Torvalds & authors
  */
- 
+
 /* Copyright(c) 1996 Kars de Jong */
 /* Based on the ide driver from 1.2.13pl8 */
 
@@ -49,32 +49,6 @@
 #ifndef MAX_HWIFS
 #define MAX_HWIFS	4	/* same as the other archs */
 #endif
-
-
-static __inline__ int ide_default_irq(unsigned long base)
-{
-	  return 0;
-}
-
-static __inline__ unsigned long ide_default_io_base(int index)
-{
-          return 0;
-}
-
-
-/*
- * Set up a hw structure for a specified data port, control port and IRQ.
- * This should follow whatever the default interface uses.
- */
-static __inline__ void ide_init_hwif_ports(hw_regs_t *hw,
-					   unsigned long data_port,
-					   unsigned long ctrl_port, int *irq)
-{
-	if (data_port || ctrl_port)
-		printk("ide_init_hwif_ports: must not be called\n");
-}
-
-#define ide_init_default_irq(base)	(0)
 
 /*
  * Get rid of defs from io.h - ide has its private and conflicting versions
diff -Nru a/include/asm-m68k/intersil.h b/include/asm-m68k/intersil.h
--- a/include/asm-m68k/intersil.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-m68k/intersil.h	Tue Jun 15 22:20:41 2004
@@ -17,7 +17,7 @@
 /* bit 4 */
 #define INTERSIL_INT_ENABLE     0x10
 #define INTERSIL_INT_DISABLE    0x00
-                
+
 /* bit 5 */
 #define INTERSIL_MODE_NORMAL     0x00
 #define INTERSIL_MODE_TEST       0x20
diff -Nru a/include/asm-m68k/io.h b/include/asm-m68k/io.h
--- a/include/asm-m68k/io.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/io.h	Tue Jun 15 22:20:42 2004
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-m68k/io.h 
+ * linux/include/asm-m68k/io.h
  *
  * 4/1/00 RZ: - rewritten to avoid clashes between ISA/PCI and other
  *              IO access
@@ -62,7 +62,7 @@
 
 #ifndef MULTI_ISA
 #define MULTI_ISA 0
-#else 
+#else
 #undef MULTI_ISA
 #define MULTI_ISA 1
 #endif
@@ -76,7 +76,7 @@
 
 #ifndef MULTI_ISA
 #define MULTI_ISA 0
-#else 
+#else
 #undef MULTI_ISA
 #define MULTI_ISA 1
 #endif
@@ -101,7 +101,7 @@
 #if defined(CONFIG_AMIGA_PCMCIA) && !defined(MULTI_ISA)
 #define ISA_TYPE AG_ISA
 #define ISA_SEX  1
-#endif 
+#endif
 #if defined(CONFIG_GG2) && !defined(MULTI_ISA)
 #define ISA_TYPE GG2_ISA
 #define ISA_SEX  0
@@ -229,7 +229,7 @@
 #endif  /* CONFIG_ISA */
 
 
-#if defined(CONFIG_ISA) && !defined(CONFIG_PCI) 
+#if defined(CONFIG_ISA) && !defined(CONFIG_PCI)
 #define inb     isa_inb
 #define inb_p   isa_inb_p
 #define outb    isa_outb
@@ -273,8 +273,8 @@
 
 #else
 /*
- * kernel with both ISA and PCI compiled in, those have 
- * conflicting defs for in/out. Simply consider port < 1024 
+ * kernel with both ISA and PCI compiled in, those have
+ * conflicting defs for in/out. Simply consider port < 1024
  * ISA and everything else PCI. read,write not defined
  * in this case
  */
diff -Nru a/include/asm-m68k/ipc.h b/include/asm-m68k/ipc.h
--- a/include/asm-m68k/ipc.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-m68k/ipc.h	Tue Jun 15 22:20:41 2004
@@ -1,7 +1,7 @@
 #ifndef __m68k_IPC_H__
 #define __m68k_IPC_H__
 
-/* 
+/*
  * These are used to wrap system calls on m68k.
  *
  * See arch/m68k/kernel/sys_m68k.c for ugly details..
diff -Nru a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
--- a/include/asm-m68k/irq.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/irq.h	Tue Jun 15 22:20:42 2004
@@ -64,7 +64,7 @@
  * All interrupt handling is actually machine specific so it is better
  * to use function pointers, as used by the Sparc port, and select the
  * interrupt handling functions when initializing the kernel. This way
- * we save some unnecessary overhead at run-time. 
+ * we save some unnecessary overhead at run-time.
  *                                                      01/11/97 - Jes
  */
 
diff -Nru a/include/asm-m68k/mac_asc.h b/include/asm-m68k/mac_asc.h
--- a/include/asm-m68k/mac_asc.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-m68k/mac_asc.h	Tue Jun 15 22:20:39 2004
@@ -1,14 +1,14 @@
 /*
- *	Apple Sound Chip 
+ *	Apple Sound Chip
  */
- 
+
 #ifndef __ASM_MAC_ASC_H
 #define __ASM_MAC_ASC_H
 
 /*
  *	ASC offsets and controls
  */
- 
+
 #define ASC_BUF_BASE	0x00	/* RAM buffer offset */
 #define ASC_BUF_SIZE	0x800
 
@@ -23,5 +23,5 @@
 #define ASC_VOLUME	0x806
 #define ASC_CHAN	0x807	/* ??? */
 
- 
+
 #endif
diff -Nru a/include/asm-m68k/mac_oss.h b/include/asm-m68k/mac_oss.h
--- a/include/asm-m68k/mac_oss.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/mac_oss.h	Tue Jun 15 22:20:42 2004
@@ -3,7 +3,7 @@
  *
  *	This is used in place of VIA2 on the IIfx.
  */
- 
+
 #define OSS_BASE	(0x50f1a000)
 
 /*
diff -Nru a/include/asm-m68k/mac_psc.h b/include/asm-m68k/mac_psc.h
--- a/include/asm-m68k/mac_psc.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-m68k/mac_psc.h	Tue Jun 15 22:20:38 2004
@@ -23,7 +23,7 @@
  * continuously, although how you keep the buffer filled in this scenario is
  * not understood as there seems to be only one input and one output buffer
  * pointer.
- * 
+ *
  * Much of this was extrapolated from what was known about the Ethernet
  * registers and subsequently confirmed using MacsBug (ie by pinging the
  * machine with easy-to-find patterns and looking for them in the DMA
@@ -43,7 +43,7 @@
  * To access a particular set of registers, add 0xn0 to the base
  * where n = 3,4,5 or 6.
  */
- 
+
 #define pIFRbase	0x100
 #define pIERbase	0x104
 
@@ -76,9 +76,9 @@
 #define PSC_SET0	0x00
 #define PSC_SET1	0x10
 
-#define PSC_SCSI_ADDR	0x1000 	/* confirmed */
-#define PSC_SCSI_LEN	0x1004 	/* confirmed */
-#define PSC_SCSI_CMD	0x1008 	/* confirmed */
+#define PSC_SCSI_ADDR	0x1000	/* confirmed */
+#define PSC_SCSI_LEN	0x1004	/* confirmed */
+#define PSC_SCSI_CMD	0x1008	/* confirmed */
 #define PSC_ENETRD_ADDR 0x1020	/* confirmed */
 #define PSC_ENETRD_LEN  0x1024	/* confirmed */
 #define PSC_ENETRD_CMD  0x1028	/* confirmed */
@@ -214,7 +214,7 @@
 /*
  *	Access functions
  */
- 
+
 static inline void psc_write_byte(int offset, __u8 data)
 {
 	*((volatile __u8 *)(psc + offset)) = data;
diff -Nru a/include/asm-m68k/mac_via.h b/include/asm-m68k/mac_via.h
--- a/include/asm-m68k/mac_via.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-m68k/mac_via.h	Tue Jun 15 22:20:41 2004
@@ -5,7 +5,7 @@
  *	via them as are assorted bits and bobs - eg rtc, adb. The picture
  *	is a bit incomplete as the Mac documentation doesn't cover this well
  */
- 
+
 #ifndef _ASM_MAC_VIA_H_
 #define _ASM_MAC_VIA_H_
 
@@ -21,7 +21,7 @@
 #define VIA1_BASE	(0x50F00000)
 #define VIA2_BASE	(0x50F02000)
 #define  RBV_BASE	(0x50F26000)
- 
+
 /*
  *	Not all of these are true post MacII I think.
  *      CSA: probably the ones CHRP marks as 'unused' change purposes
@@ -34,9 +34,9 @@
  * VIA1A_vSccWrReq not available and that VIA1A_vSync has moved to an IOP.
  * Also, "All of the functionality of VIA2 has been moved to other chips".
  */
- 
+
 #define VIA1A_vSccWrReq	0x80	/* SCC write. (input)
-				 * [CHRP] SCC WREQ: Reflects the state of the 
+				 * [CHRP] SCC WREQ: Reflects the state of the
 				 * Wait/Request pins from the SCC.
 				 * [Macintosh Family Hardware]
 				 * as CHRP on SE/30,II,IIx,IIcx,IIci.
@@ -93,7 +93,7 @@
 #define VIA1A_CPUID1	0x04	/* CPU id bit 0 on RBV, others */
 #define VIA1A_CPUID2	0x10	/* CPU id bit 0 on RBV, others */
 #define VIA1A_CPUID3	0x40	/* CPU id bit 0 on RBV, others */
- 	
+
 /* Info on VIA1B is from Macintosh Family Hardware & MkLinux.
  * CHRP offers no info. */
 #define VIA1B_vSound	0x80	/* Sound enable (for compatibility with
@@ -123,7 +123,7 @@
 #define	EVRB_SFTWRID	0x80	/* Software Interrupt ReQuest */
 
 /*
- *	VIA2 A register is the interrupt lines raised off the nubus 
+ *	VIA2 A register is the interrupt lines raised off the nubus
  *	slots.
  *      The below info is from 'Macintosh Family Hardware.'
  *      MkLinux calls the 'IIci internal video IRQ' below the 'RBV slot 0 irq.'
@@ -131,7 +131,7 @@
  *      defines the 'Video IRQ' as 0x40 for the 'EVR' VIA work-alike.
  *      Perhaps OSS uses vRAM1 and vRAM2 for ADB.
  */
- 
+
 #define VIA2A_vRAM1	0x80	/* RAM size bit 1 (IIci: reserved) */
 #define VIA2A_vRAM0	0x40	/* RAM size bit 0 (IIci: internal video IRQ) */
 #define VIA2A_vIRQE	0x20	/* IRQ from slot $E */
@@ -148,11 +148,11 @@
  *  1    0    4 Mbit
  *  1    1   16 Mbit
  */
- 
+
 /*
  *	Register B has the fun stuff in it
  */
- 
+
 #define VIA2B_vVBL	0x80	/* VBL output to VIA1 (60.15Hz) driven by
 				 * timer T1.
 				 * on IIci, parity test: 0=test mode.
@@ -184,11 +184,11 @@
  * right bit in the VIA chip (6522 Versatile Interface Adapter).
  * [CSA: don't know which one this is, but it's one of 'em!]
  */
- 
+
 /*
  *	6522 registers - see databook.
  * CSA: Assignments for VIA1 confirmed from CHRP spec.
- */ 
+ */
 
 /* partial address decode.  0xYYXX : XX part for RBV, YY part for VIA */
 /* Note: 15 VIA regs, 8 RBV regs */
@@ -217,7 +217,7 @@
  * decode the bottom eight -- so vBufB | rBufB will always get you BufB */
 /* CSA: in fact, only bits 0,1, and 4 seem to be decoded.
  * BUT note the values for rIER and rIFR, where the top 8 bits *do* seem
- * to matter.  In fact *all* of the top 8 bits seem to matter; 
+ * to matter.  In fact *all* of the top 8 bits seem to matter;
  * setting rIER=0x1813 and rIFR=0x1803 doesn't work, either.
  * Perhaps some sort of 'compatibility mode' is built-in? [21-May-1999]
  */
diff -Nru a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h
--- a/include/asm-m68k/machw.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-m68k/machw.h	Tue Jun 15 22:20:43 2004
@@ -51,7 +51,7 @@
 /*
 ** SCC Z8530
 */
- 
+
 #define MAC_SCC_BAS (0x50F04000)
 struct MAC_SCC
  {
diff -Nru a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h
--- a/include/asm-m68k/macintosh.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-m68k/macintosh.h	Tue Jun 15 22:20:35 2004
@@ -7,11 +7,11 @@
 /*
  *	Apple Macintoshisms
  */
- 
+
 extern void mac_reset(void);
 extern void mac_poweroff(void);
 extern void mac_init_IRQ(void);
-extern int mac_request_irq (unsigned int, irqreturn_t (*)(int, void *, 
+extern int mac_request_irq (unsigned int, irqreturn_t (*)(int, void *,
 				struct pt_regs *),
 				unsigned long, const char *, void *);
 extern void mac_free_irq(unsigned int, void *);
@@ -30,7 +30,7 @@
 /*
  *	Floppy driver magic hook - probably shouldnt be here
  */
- 
+
 extern void via1_set_head(int);
 
 extern void parse_booter(char *ptr);
@@ -39,7 +39,7 @@
 /*
  *	Macintosh Table
  */
- 
+
 struct mac_model
 {
 	short ident;
@@ -81,7 +81,7 @@
 #define MAC_SCC_QUADRA		3
 #define MAC_SCC_PSC		4
 
-#define MAC_ETHER_NONE		0	
+#define MAC_ETHER_NONE		0
 #define MAC_ETHER_SONIC		1
 #define MAC_ETHER_MACE		2
 
@@ -91,7 +91,7 @@
 /*
  *	Gestalt numbers
  */
- 
+
 #define MAC_MODEL_II		6
 #define MAC_MODEL_IIX		7
 #define MAC_MODEL_IICX		8
@@ -113,7 +113,7 @@
 #define MAC_MODEL_PB180		33
 #define MAC_MODEL_PB160		34
 #define MAC_MODEL_Q800		35	/* aka: WGS80 */
-#define MAC_MODEL_Q650		36 
+#define MAC_MODEL_Q650		36
 #define MAC_MODEL_LCII		37	/* aka: P400/405/410/430 */
 #define MAC_MODEL_PB250		38
 #define MAC_MODEL_IIVI		44
@@ -148,5 +148,5 @@
 #define MAC_MODEL_PB150		115
 
 extern struct mac_model *macintosh_config;
- 
+
 #endif
diff -Nru a/include/asm-m68k/macints.h b/include/asm-m68k/macints.h
--- a/include/asm-m68k/macints.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-m68k/macints.h	Tue Jun 15 22:20:38 2004
@@ -52,7 +52,7 @@
 
 #define NUM_MAC_SOURCES		72
 
-/* 
+/*
  * clean way to separate IRQ into its source and index
  */
 
@@ -74,7 +74,7 @@
 #define IRQ_VIA1_0	  (8)		/* one second int. */
 #define IRQ_VIA1_1        (9)		/* VBlank int. */
 #define IRQ_MAC_VBL	  IRQ_VIA1_1
-#define IRQ_VIA1_2 	  (10)		/* ADB SR shifts complete */
+#define IRQ_VIA1_2	  (10)		/* ADB SR shifts complete */
 #define IRQ_MAC_ADB	  IRQ_VIA1_2
 #define IRQ_MAC_ADB_SR	  IRQ_VIA1_2
 #define IRQ_VIA1_3	  (11)		/* ADB SR CB2 ?? */
@@ -92,7 +92,7 @@
 #define IRQ_MAC_SCSIDRQ	  IRQ_VIA2_0
 #define IRQ_VIA2_1        (17)
 #define IRQ_MAC_NUBUS	  IRQ_VIA2_1
-#define IRQ_VIA2_2 	  (18)
+#define IRQ_VIA2_2	  (18)
 #define IRQ_VIA2_3	  (19)
 #define IRQ_MAC_SCSI	  IRQ_VIA2_3
 #define IRQ_VIA2_4        (20)
@@ -108,7 +108,7 @@
 #define IRQ_PSC3_3	  (27)
 
 /* Level 4 (SCC) interrupts */
-#define IRQ_SCC 	     (32)
+#define IRQ_SCC		     (32)
 #define IRQ_SCCA	     (33)
 #define IRQ_SCCB	     (34)
 #if 0 /* FIXME: are there multiple interrupt conditions on the SCC ?? */
diff -Nru a/include/asm-m68k/md.h b/include/asm-m68k/md.h
--- a/include/asm-m68k/md.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-m68k/md.h	Tue Jun 15 22:20:37 2004
@@ -1,8 +1,8 @@
 /* $Id: md.h,v 1.1 1997/12/15 15:12:04 jj Exp $
- * md.h: High speed xor_block operation for RAID4/5 
+ * md.h: High speed xor_block operation for RAID4/5
  *
  */
- 
+
 #ifndef __ASM_MD_H
 #define __ASM_MD_H
 
diff -Nru a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h
--- a/include/asm-m68k/mmu_context.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/mmu_context.h	Tue Jun 15 22:20:42 2004
@@ -124,7 +124,7 @@
 		mm->context = get_free_context(mm);
 }
 
-/* flush context if allocated... */	
+/* flush context if allocated... */
 static inline void destroy_context(struct mm_struct *mm)
 {
 	if(mm->context != SUN3_INVALID_CONTEXT)
@@ -150,5 +150,5 @@
 	activate_context(next_mm);
 }
 
-#endif 
+#endif
 #endif
diff -Nru a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h
--- a/include/asm-m68k/motorola_pgtable.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/motorola_pgtable.h	Tue Jun 15 22:20:42 2004
@@ -217,7 +217,7 @@
 	return (pmd_t *)__pgd_page(*dir) + ((address >> PMD_SHIFT) & (PTRS_PER_PMD-1));
 }
 
-/* Find an entry in the third-level page table.. */ 
+/* Find an entry in the third-level page table.. */
 static inline pte_t *pte_offset_kernel(pmd_t *pmdp, unsigned long address)
 {
 	return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
diff -Nru a/include/asm-m68k/msgbuf.h b/include/asm-m68k/msgbuf.h
--- a/include/asm-m68k/msgbuf.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-m68k/msgbuf.h	Tue Jun 15 22:20:43 2004
@@ -1,7 +1,7 @@
 #ifndef _M68K_MSGBUF_H
 #define _M68K_MSGBUF_H
 
-/* 
+/*
  * The msqid64_ds structure for m68k architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
diff -Nru a/include/asm-m68k/mvme147hw.h b/include/asm-m68k/mvme147hw.h
--- a/include/asm-m68k/mvme147hw.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-m68k/mvme147hw.h	Tue Jun 15 22:20:58 2004
@@ -21,7 +21,7 @@
 
 
 struct pcc_regs {
-   volatile u_long 	dma_tadr;
+   volatile u_long	dma_tadr;
    volatile u_long	dma_dadr;
    volatile u_long	dma_bcr;
    volatile u_long	dma_hr;
diff -Nru a/include/asm-m68k/mvme16xhw.h b/include/asm-m68k/mvme16xhw.h
--- a/include/asm-m68k/mvme16xhw.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-m68k/mvme16xhw.h	Tue Jun 15 22:20:36 2004
@@ -65,7 +65,7 @@
 #define MVME_SCC_PCLK	10000000
 
 #define MVME162_IRQ_TYPE_PRIO	0
-                
+
 #define MVME167_IRQ_PRN		0x54
 #define MVME16x_IRQ_I596	0x57
 #define MVME16x_IRQ_SCSI	0x55
diff -Nru a/include/asm-m68k/openprom.h b/include/asm-m68k/openprom.h
--- a/include/asm-m68k/openprom.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/openprom.h	Tue Jun 15 22:20:42 2004
@@ -91,92 +91,92 @@
 
 #if defined(CONFIG_SUN3) || defined(CONFIG_SUN3X)
 struct linux_romvec {
-	char		*pv_initsp;		
+	char		*pv_initsp;
 	int		(*pv_startmon)(void);
 
-	int		*diagberr;		
+	int		*diagberr;
 
 	struct linux_arguments_v0 **pv_v0bootargs;
- 	unsigned	*pv_sun3mem;		
+	unsigned	*pv_sun3mem;
 
 	unsigned char	(*pv_getchar)(void);
 	int		(*pv_putchar)(int ch);
-	int		(*pv_nbgetchar)(void);	
+	int		(*pv_nbgetchar)(void);
 	int		(*pv_nbputchar)(int ch);
-	unsigned char	*pv_echo;	
+	unsigned char	*pv_echo;
 	unsigned char	*pv_insource;
 	unsigned char	*pv_outsink;
 
-	int		(*pv_getkey)(void);		
+	int		(*pv_getkey)(void);
 	int		(*pv_initgetkey)(void);
 	unsigned int	*pv_translation;
-	unsigned char	*pv_keybid;		
-	int		*pv_screen_x;		
-	int		*pv_screen_y;		
-	struct keybuf	*pv_keybuf;		
+	unsigned char	*pv_keybid;
+	int		*pv_screen_x;
+	int		*pv_screen_y;
+	struct keybuf	*pv_keybuf;
 
 	char		*pv_monid;
 
-	/* 
-	 * Frame buffer output and terminal emulation 
+	/*
+	 * Frame buffer output and terminal emulation
 	 */
 
-	int		(*pv_fbwritechar)(char);	
-	int		*pv_fbaddr;		
-	char		**pv_font;		
-	int		(*pv_fbwritestr)(char);	
+	int		(*pv_fbwritechar)(char);
+	int		*pv_fbaddr;
+	char		**pv_font;
+	int		(*pv_fbwritestr)(char);
 
 	void		(*pv_reboot)(char *bootstr);
 
-	/* 
-	 * Line input and parsing 
+	/*
+	 * Line input and parsing
 	 */
 
-	unsigned char	*pv_linebuf;		
-	unsigned char	**pv_lineptr;		
-	int		*pv_linesize;		
-	int		(*pv_getline)(void);	
-	unsigned char	(*pv_getnextchar)(void);	
-	unsigned char	(*pv_peeknextchar)(void);	
-	int		*pv_fbthere;		
-	int		(*pv_getnum)(void);		
+	unsigned char	*pv_linebuf;
+	unsigned char	**pv_lineptr;
+	int		*pv_linesize;
+	int		(*pv_getline)(void);
+	unsigned char	(*pv_getnextchar)(void);
+	unsigned char	(*pv_peeknextchar)(void);
+	int		*pv_fbthere;
+	int		(*pv_getnum)(void);
 
 	void		(*pv_printf)(const char *fmt, ...);
 	int		(*pv_printhex)(void);
 
-	unsigned char	*pv_leds;		
-	int		(*pv_setleds)(void);	
+	unsigned char	*pv_leds;
+	int		(*pv_setleds)(void);
 
-	/* 
+	/*
 	 * Non-maskable interrupt  (nmi) information
-	 */ 
+	 */
 
 	int		(*pv_nmiaddr)(void);
 	int		(*pv_abortentry)(void);
-	int		*pv_nmiclock;		
+	int		*pv_nmiclock;
 
 	int		*pv_fbtype;
 
-	/* 
-	 * Assorted other things 
+	/*
+	 * Assorted other things
 	 */
 
 	unsigned	pv_romvers;
-	struct globram  *pv_globram;		
-	char		*pv_kbdzscc;		
+	struct globram  *pv_globram;
+	char		*pv_kbdzscc;
+
+	int		*pv_keyrinit;
+	unsigned char	*pv_keyrtick;
+	unsigned	*pv_memoryavail;
+	long		*pv_resetaddr;
+	long		*pv_resetmap;
 
-	int		*pv_keyrinit;		
-	unsigned char	*pv_keyrtick; 		
-	unsigned	*pv_memoryavail;	
-	long		*pv_resetaddr;		
-	long		*pv_resetmap;		
-						
-	void		(*pv_halt)(void);	
-	unsigned char	*pv_memorybitmap;	
+	void		(*pv_halt)(void);
+	unsigned char	*pv_memorybitmap;
 
 #ifdef CONFIG_SUN3
 	void		(*pv_setctxt)(int ctxt, char *va, int pmeg);
-	void		(*pv_vector_cmd)(void);	
+	void		(*pv_vector_cmd)(void);
 	int		dummy1z;
 	int		dummy2z;
 	int		dummy3z;
diff -Nru a/include/asm-m68k/oplib.h b/include/asm-m68k/oplib.h
--- a/include/asm-m68k/oplib.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-m68k/oplib.h	Tue Jun 15 22:21:03 2004
@@ -244,7 +244,7 @@
 /* Does the passed node have the given "name"? YES=1 NO=0 */
 extern int prom_nodematch(int thisnode, char *name);
 
-/* Puts in buffer a prom name in the form name@x,y or name (x for which_io 
+/* Puts in buffer a prom name in the form name@x,y or name (x for which_io
  * and y for first regs phys address
  */
 extern int prom_getname(int node, char *buf, int buflen);
@@ -272,7 +272,7 @@
  */
 extern int prom_setprop(int node, char *prop_name, char *prop_value,
 			int value_size);
-			
+
 extern int prom_pathtoinode(char *path);
 extern int prom_inst2pkg(int);
 
@@ -290,8 +290,8 @@
 extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);
 
 /* Apply ranges of any prom node (and optionally parent node as well) to registers. */
-extern void prom_apply_generic_ranges(int node, int parent, 
+extern void prom_apply_generic_ranges(int node, int parent,
 				      struct linux_prom_registers *sbusregs, int nregs);
-				   
+
 
 #endif /* !(__SPARC_OPLIB_H) */
diff -Nru a/include/asm-m68k/page.h b/include/asm-m68k/page.h
--- a/include/asm-m68k/page.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-m68k/page.h	Tue Jun 15 22:21:05 2004
@@ -25,9 +25,9 @@
 #else
 #define THREAD_SIZE PAGE_SIZE
 #endif
- 
+
 #ifndef __ASSEMBLY__
- 
+
 #define get_user_page(vaddr)		__get_free_page(GFP_KERNEL)
 #define free_user_page(page, addr)	free_page(addr)
 
@@ -80,7 +80,7 @@
 #endif
 
 #define clear_user_page(addr, vaddr, page)	\
-	do { 	clear_page(addr);		\
+	do {	clear_page(addr);		\
 		flush_dcache_page(page);	\
 	} while (0)
 #define copy_user_page(to, from, vaddr, page)	\
diff -Nru a/include/asm-m68k/page_offset.h b/include/asm-m68k/page_offset.h
--- a/include/asm-m68k/page_offset.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-m68k/page_offset.h	Tue Jun 15 22:20:43 2004
@@ -4,6 +4,6 @@
 #ifndef CONFIG_SUN3
 #define PAGE_OFFSET_RAW		0x00000000
 #else
-#define PAGE_OFFSET_RAW		0x0E000000 
+#define PAGE_OFFSET_RAW		0x0E000000
 #endif
 
diff -Nru a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h
--- a/include/asm-m68k/pgtable.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-m68k/pgtable.h	Tue Jun 15 22:20:44 2004
@@ -168,8 +168,6 @@
 	    ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S))	\
 	    : (prot)))
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 /*
diff -Nru a/include/asm-m68k/q40_master.h b/include/asm-m68k/q40_master.h
--- a/include/asm-m68k/q40_master.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-m68k/q40_master.h	Tue Jun 15 22:20:43 2004
@@ -1,5 +1,5 @@
-/* 
- * Q40 master Chip Control 
+/*
+ * Q40 master Chip Control
  * RTC stuff merged for compactnes..
 */
 
diff -Nru a/include/asm-m68k/raw_io.h b/include/asm-m68k/raw_io.h
--- a/include/asm-m68k/raw_io.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-m68k/raw_io.h	Tue Jun 15 22:21:05 2004
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-m68k/raw_io.h 
+ * linux/include/asm-m68k/raw_io.h
  *
  * 10/20/00 RZ: - created from bits of io.h and ide.h to cleanup namespace
  *
diff -Nru a/include/asm-m68k/rmap.h b/include/asm-m68k/rmap.h
--- a/include/asm-m68k/rmap.h	Tue Jun 15 22:21:03 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _M68K_RMAP_H
-#define _M68K_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-m68k/rtc.h b/include/asm-m68k/rtc.h
--- a/include/asm-m68k/rtc.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-m68k/rtc.h	Tue Jun 15 22:20:39 2004
@@ -51,7 +51,7 @@
 		return mach_get_ss();
 	else{
 		struct rtc_time h;
-		
+
 		get_rtc_time(&h);
 		return h.tm_sec;
 	}
diff -Nru a/include/asm-m68k/sembuf.h b/include/asm-m68k/sembuf.h
--- a/include/asm-m68k/sembuf.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-m68k/sembuf.h	Tue Jun 15 22:20:39 2004
@@ -1,7 +1,7 @@
 #ifndef _M68K_SEMBUF_H
 #define _M68K_SEMBUF_H
 
-/* 
+/*
  * The semid64_ds structure for m68k architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
diff -Nru a/include/asm-m68k/serial.h b/include/asm-m68k/serial.h
--- a/include/asm-m68k/serial.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-m68k/serial.h	Tue Jun 15 22:20:44 2004
@@ -2,7 +2,7 @@
  * include/asm-m68k/serial.h
  *
  * currently this seems useful only for a Q40,
- * it's an almost exact copy of ../asm-alpha/serial.h 
+ * it's an almost exact copy of ../asm-alpha/serial.h
  *
  */
 
@@ -31,7 +31,7 @@
 #define ACCENT_FLAGS 0
 #define BOCA_FLAGS 0
 #endif
-	
+
 #define STD_SERIAL_PORT_DEFNS			\
 	/* UART CLK   PORT IRQ     FLAGS        */			\
 	{ 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },	/* ttyS0 */	\
@@ -42,7 +42,7 @@
 
 #ifdef CONFIG_SERIAL_MANY_PORTS
 #define EXTRA_SERIAL_PORT_DEFNS			\
-	{ 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, 	/* ttyS4 */	\
+	{ 0, BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS },	/* ttyS4 */	\
 	{ 0, BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS },	/* ttyS5 */	\
 	{ 0, BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS },	/* ttyS6 */	\
 	{ 0, BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS },	/* ttyS7 */	\
diff -Nru a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h
--- a/include/asm-m68k/setup.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/setup.h	Tue Jun 15 22:20:42 2004
@@ -248,7 +248,7 @@
 extern unsigned long m68k_mmutype;		/* Not really used yet */
 #ifdef CONFIG_VME
 extern unsigned long vme_brdtype;
-#endif 
+#endif
 
     /*
      *  m68k_is040or060 is != 0 for a '040 or higher;
diff -Nru a/include/asm-m68k/shmbuf.h b/include/asm-m68k/shmbuf.h
--- a/include/asm-m68k/shmbuf.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-m68k/shmbuf.h	Tue Jun 15 22:20:44 2004
@@ -1,7 +1,7 @@
 #ifndef _M68K_SHMBUF_H
 #define _M68K_SHMBUF_H
 
-/* 
+/*
  * The shmid64_ds structure for m68k architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
diff -Nru a/include/asm-m68k/sigcontext.h b/include/asm-m68k/sigcontext.h
--- a/include/asm-m68k/sigcontext.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-m68k/sigcontext.h	Tue Jun 15 22:20:41 2004
@@ -2,7 +2,7 @@
 #define _ASM_M68k_SIGCONTEXT_H
 
 struct sigcontext {
-	unsigned long  sc_mask; 	/* old sigmask */
+	unsigned long  sc_mask;		/* old sigmask */
 	unsigned long  sc_usp;		/* old user stack pointer */
 	unsigned long  sc_d0;
 	unsigned long  sc_d1;
diff -Nru a/include/asm-m68k/signal.h b/include/asm-m68k/signal.h
--- a/include/asm-m68k/signal.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-m68k/signal.h	Tue Jun 15 22:20:37 2004
@@ -96,7 +96,7 @@
 #define SA_ONESHOT	SA_RESETHAND
 #define SA_INTERRUPT	0x20000000 /* dummy -- ignored */
 
-/* 
+/*
  * sigaltstack controls
  */
 #define SS_ONSTACK	1
diff -Nru a/include/asm-m68k/sockios.h b/include/asm-m68k/sockios.h
--- a/include/asm-m68k/sockios.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-m68k/sockios.h	Tue Jun 15 22:20:37 2004
@@ -2,7 +2,7 @@
 #define __ARCH_M68K_SOCKIOS__
 
 /* Socket-level I/O control calls. */
-#define FIOSETOWN 	0x8901
+#define FIOSETOWN	0x8901
 #define SIOCSPGRP	0x8902
 #define FIOGETOWN	0x8903
 #define SIOCGPGRP	0x8904
diff -Nru a/include/asm-m68k/string.h b/include/asm-m68k/string.h
--- a/include/asm-m68k/string.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/string.h	Tue Jun 15 22:20:42 2004
@@ -73,7 +73,7 @@
 static inline char * strchr(const char * s, int c)
 {
   const char ch = c;
-  
+
   for(; *s != ch; ++s)
     if (*s == '\0')
       return( NULL );
@@ -85,7 +85,7 @@
 static inline char *strpbrk(const char *cs,const char *ct)
 {
   const char *sc1,*sc2;
-  
+
   for( sc1 = cs; *sc1 != '\0'; ++sc1)
     for( sc2 = ct; *sc2 != '\0'; ++sc2)
       if (*sc1 == *sc2)
diff -Nru a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h
--- a/include/asm-m68k/sun3_pgalloc.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-m68k/sun3_pgalloc.h	Tue Jun 15 22:20:39 2004
@@ -1,5 +1,5 @@
 /* sun3_pgalloc.h --
- * reorganization around 2.3.39, routines moved from sun3_pgtable.h 
+ * reorganization around 2.3.39, routines moved from sun3_pgtable.h
  *
  *
  * 02/27/2002 -- Modified to support "highpte" implementation in 2.5.5 (Sam)
@@ -36,26 +36,26 @@
 	tlb_remove_page(tlb, page);
 }
 
-static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 
+static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 					  unsigned long address)
 {
 	unsigned long page = __get_free_page(GFP_KERNEL|__GFP_REPEAT);
 
 	if (!page)
 		return NULL;
-		
+
 	memset((void *)page, 0, PAGE_SIZE);
 	return (pte_t *) (page);
 }
 
-static inline struct page *pte_alloc_one(struct mm_struct *mm, 
+static inline struct page *pte_alloc_one(struct mm_struct *mm,
 					 unsigned long address)
 {
         struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
 
 	if (page == NULL)
 		return NULL;
-		
+
 	clear_highpage(page);
 	return page;
 
diff -Nru a/include/asm-m68k/sun3mmu.h b/include/asm-m68k/sun3mmu.h
--- a/include/asm-m68k/sun3mmu.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-m68k/sun3mmu.h	Tue Jun 15 22:20:40 2004
@@ -144,7 +144,7 @@
 	SET_SFC(FC_CONTROL);
 	GET_CONTROL_BYTE(AC_CONTEXT, c);
 	SET_SFC(sfc);
-	
+
 	return c;
 }
 
@@ -156,7 +156,7 @@
 	SET_DFC(FC_CONTROL);
 	SET_CONTROL_BYTE(AC_CONTEXT, c);
 	SET_DFC(dfc);
-	
+
 	return;
 }
 
diff -Nru a/include/asm-m68k/sun3x.h b/include/asm-m68k/sun3x.h
--- a/include/asm-m68k/sun3x.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-m68k/sun3x.h	Tue Jun 15 22:21:03 2004
@@ -20,7 +20,7 @@
 #define SUN3X_FDC_FVR     0x6e000800
 
 /* some NVRAM addresses */
-#define SUN3X_EEPROM_CONS 	(SUN3X_EEPROM + 0x1f)
+#define SUN3X_EEPROM_CONS	(SUN3X_EEPROM + 0x1f)
 #define SUN3X_EEPROM_PORTA	(SUN3X_EEPROM + 0x58)
 #define SUN3X_EEPROM_PORTB	(SUN3X_EEPROM + 0x60)
 
diff -Nru a/include/asm-m68k/sun3xflop.h b/include/asm-m68k/sun3xflop.h
--- a/include/asm-m68k/sun3xflop.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-m68k/sun3xflop.h	Tue Jun 15 22:20:58 2004
@@ -89,11 +89,11 @@
 
 		if(value & 0x10) {
 			fcr |= (FCR_DSEL0 | FCR_MTRON);
-		} else 
+		} else
 			fcr &= ~(FCR_DSEL0 | FCR_MTRON);
-		
-		
-		if(fcr != sun3x_fdc.fcr) { 
+
+
+		if(fcr != sun3x_fdc.fcr) {
 			*(sun3x_fdc.fcr_r) = fcr;
 			sun3x_fdc.fcr = fcr;
 		}
@@ -121,7 +121,7 @@
 #undef TRACE_FLPY_INT
 #define NO_FLOPPY_ASSEMBLER
 
-#ifdef TRACE_FLPY_INT 
+#ifdef TRACE_FLPY_INT
 	static int calls=0;
 	static int bytes=0;
 	static int dma_wait=0;
@@ -142,13 +142,13 @@
 		register int lcount;
 		register char *lptr;
 
-		for(lcount=virtual_dma_count, lptr=virtual_dma_addr; 
+		for(lcount=virtual_dma_count, lptr=virtual_dma_addr;
 		    lcount; lcount--, lptr++) {
 /*			st=fd_inb(virtual_dma_port+4) & 0x80 ;  */
 			st = *(sun3x_fdc.status_r);
 /*			if(st != 0xa0)                  */
 /*				break;                  */
-	
+
 			if((st & 0x80) == 0) {
 				virtual_dma_count = lcount;
 				virtual_dma_addr = lptr;
@@ -157,7 +157,7 @@
 
 			if((st & 0x20) == 0)
 				break;
-		
+
 			if(virtual_dma_mode)
 /*				fd_outb(*lptr, virtual_dma_port+5); */
 				*(sun3x_fdc.data_r) = *lptr;
@@ -165,7 +165,7 @@
 /*				*lptr = fd_inb(virtual_dma_port+5); */
 				*lptr = *(sun3x_fdc.data_r);
 		}
-		
+
 		virtual_dma_count = lcount;
 		virtual_dma_addr = lptr;
 /*		st = fd_inb(virtual_dma_port+4);   */
@@ -184,7 +184,7 @@
 		doing_pdma = 0;
 
 #ifdef TRACE_FLPY_INT
-		printk("count=%x, residue=%x calls=%d bytes=%x dma_wait=%d\n", 
+		printk("count=%x, residue=%x calls=%d bytes=%x dma_wait=%d\n",
 		       virtual_dma_count, virtual_dma_residue, calls, bytes,
 		       dma_wait);
 		calls = 0;
@@ -195,7 +195,7 @@
 		return IRQ_HANDLED;
 	}
 
-	
+
 #ifdef TRACE_FLPY_INT
 	if(!virtual_dma_count)
 		dma_wait++;
@@ -232,9 +232,9 @@
 	if(*sun3x_fdc.status_r == 0xff) {
 		return -1;
 	}
-	
+
 	*sun3x_fdc.fvr_r = FLOPPY_IRQ;
-	
+
 	*sun3x_fdc.fcr_r = FCR_TC;
 	udelay(10);
 	*sun3x_fdc.fcr_r = 0;
@@ -249,7 +249,7 @@
 static int sun3x_eject(void)
 {
 	if(MACH_IS_SUN3X) {
-	
+
 		sun3x_fdc.fcr |= (FCR_DSEL0 | FCR_EJECT);
 		*(sun3x_fdc.fcr_r) = sun3x_fdc.fcr;
 		udelay(10);
diff -Nru a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h
--- a/include/asm-m68k/termios.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/termios.h	Tue Jun 15 22:20:42 2004
@@ -3,7 +3,7 @@
 
 #include <asm/termbits.h>
 #include <asm/ioctls.h>
- 
+
 struct winsize {
 	unsigned short ws_row;
 	unsigned short ws_col;
diff -Nru a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h
--- a/include/asm-m68k/thread_info.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/thread_info.h	Tue Jun 15 22:20:42 2004
@@ -56,7 +56,7 @@
  * - pass TIF_xxxx constants to these functions
  */
 
-#define __set_tsk_thread_flag(tsk, flag, val) ({ 	\
+#define __set_tsk_thread_flag(tsk, flag, val) ({	\
 	switch (flag) {					\
 	case TIF_SIGPENDING:				\
 		tsk->thread.work.sigpending = val;	\
diff -Nru a/include/asm-m68k/tlbflush.h b/include/asm-m68k/tlbflush.h
--- a/include/asm-m68k/tlbflush.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-m68k/tlbflush.h	Tue Jun 15 22:20:43 2004
@@ -147,7 +147,7 @@
 	     seg = sun3_get_segmap(i);
 	     if(seg == SUN3_INVALID_PMEG)
 		     continue;
-	     
+
 	     sun3_put_segmap(i, SUN3_INVALID_PMEG);
 	     pmeg_alloc[seg] = 0;
 	     pmeg_ctx[seg] = 0;
@@ -155,7 +155,7 @@
      }
 
      sun3_put_context(oldctx);
-     		     
+
 }
 
 /* Flush a single TLB page. In this case, we're limited to flushing a
@@ -174,7 +174,7 @@
 		pmeg_alloc[i] = 0;
 		pmeg_ctx[i] = 0;
 		pmeg_vaddr[i] = 0;
-		sun3_put_segmap (addr,  SUN3_INVALID_PMEG);     
+		sun3_put_segmap (addr,  SUN3_INVALID_PMEG);
 	}
 	sun3_put_context(oldctx);
 
@@ -186,7 +186,7 @@
 {
 	struct mm_struct *mm = vma->vm_mm;
 	unsigned char seg, oldctx;
-	
+
 	start &= ~SUN3_PMEG_MASK;
 
 	oldctx = sun3_get_context();
@@ -194,7 +194,7 @@
 
 	while(start < end)
 	{
-		if((seg = sun3_get_segmap(start)) == SUN3_INVALID_PMEG) 
+		if((seg = sun3_get_segmap(start)) == SUN3_INVALID_PMEG)
 		     goto next;
 		if(pmeg_ctx[seg] == mm->context) {
 			pmeg_alloc[seg] = 0;
diff -Nru a/include/asm-m68k/types.h b/include/asm-m68k/types.h
--- a/include/asm-m68k/types.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-m68k/types.h	Tue Jun 15 22:20:35 2004
@@ -60,6 +60,8 @@
 typedef u32 dma_addr_t;
 typedef u32 dma64_addr_t;
 
+typedef unsigned short kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-m68k/unaligned.h b/include/asm-m68k/unaligned.h
--- a/include/asm-m68k/unaligned.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-m68k/unaligned.h	Tue Jun 15 22:21:05 2004
@@ -2,7 +2,7 @@
 #define __M68K_UNALIGNED_H
 
 /*
- * The m68k can do unaligned accesses itself. 
+ * The m68k can do unaligned accesses itself.
  *
  * The strange macros are there to make sure these can't
  * be misused in a way that makes them not work on other
diff -Nru a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
--- a/include/asm-m68k/unistd.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-m68k/unistd.h	Tue Jun 15 22:20:40 2004
@@ -337,6 +337,31 @@
 __syscall_return(type,__res); \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
diff -Nru a/include/asm-m68k/user.h b/include/asm-m68k/user.h
--- a/include/asm-m68k/user.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-m68k/user.h	Tue Jun 15 22:20:42 2004
@@ -51,7 +51,7 @@
 	short __fill;
 };
 
-	
+
 /* When the kernel dumps core, it starts by dumping the user struct -
    this will be used by gdb to figure out where the data and stack segments
    are within the file, and what virtual addresses to use. */
@@ -72,7 +72,7 @@
 				   This is actually the bottom of the stack,
 				   the top of the stack is always found in the
 				   esp register.  */
-  long int signal;     		/* Signal that caused the core dump. */
+  long int signal;		/* Signal that caused the core dump. */
   int reserved;			/* No longer used */
   struct user_regs_struct *u_ar0;
 				/* Used by gdb to help find the values for */
diff -Nru a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
--- a/include/asm-m68k/virtconvert.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-m68k/virtconvert.h	Tue Jun 15 22:20:43 2004
@@ -8,6 +8,7 @@
 #ifdef __KERNEL__
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 #include <asm/setup.h>
 #include <asm/page.h>
 
@@ -31,7 +32,7 @@
 {
 	return (unsigned long)__va(paddr);
 }
-#endif 
+#endif
 
 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
 static inline unsigned long virt_to_phys(void *vaddr)
diff -Nru a/include/asm-m68knommu/atomic.h b/include/asm-m68knommu/atomic.h
--- a/include/asm-m68knommu/atomic.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-m68knommu/atomic.h	Tue Jun 15 22:20:40 2004
@@ -18,30 +18,6 @@
 #define atomic_read(v)		((v)->counter)
 #define atomic_set(v, i)	(((v)->counter) = i)
 
-#ifdef CONFIG_COLDFIRE
-
-static __inline__ void atomic_add(int i, atomic_t *v)
-{
-	__asm__ __volatile__(
-		"movel %1,%%d0\t\n"
-		"addl %%d0,%0"
-		:
-		: "m" (*v), "id" (i)
-		: "d0");
-}
-
-static __inline__ void atomic_sub(int i, atomic_t *v)
-{
-	__asm__ __volatile__(
-		"movel %1,%%d0\t\n"
-		"subl %%d0,%0"
-		:
-		: "m" (*v), "id" (i)
-		: "d0");
-}
-
-#else
-
 static __inline__ void atomic_add(int i, atomic_t *v)
 {
 	__asm__ __volatile__("addl %1,%0" : "=m" (*v) : "d" (i), "0" (*v));
@@ -52,8 +28,6 @@
 	__asm__ __volatile__("subl %1,%0" : "=m" (*v) : "d" (i), "0" (*v));
 }
 
-#endif /* COLDFIRE */
-
 static __inline__ void atomic_inc(volatile atomic_t *v)
 {
 	__asm__ __volatile__("addql #1,%0" : "=m" (*v): "0" (*v));
@@ -96,6 +70,8 @@
 	return temp;
 }
 
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
+
 extern __inline__ int atomic_sub_return(int i, atomic_t * v)
 {
 	unsigned long temp, flags;
@@ -111,6 +87,16 @@
 
 #define atomic_dec_return(v) atomic_sub_return(1,(v))
 #define atomic_inc_return(v) atomic_add_return(1,(v))
+
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
 
 #define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
 #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
diff -Nru a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
--- a/include/asm-m68knommu/bitops.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-m68knommu/bitops.h	Tue Jun 15 22:20:37 2004
@@ -77,12 +77,6 @@
 }
 
 /*
- * fls: find last bit set.
- */
-#define fls(x) generic_fls(x)
-
-
-/*
  * Every architecture must define this function. It's the fastest
  * way of searching a 140-bit bitmap where the first 100 bits are
  * unlikely to be set. It's guaranteed that at least one of the 140
@@ -283,7 +277,7 @@
 	return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0;
 }
 
-static __inline__ int __test_bit(int nr, const unsigned long * addr)
+static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
 {
 	int 	* a = (int *) addr;
 	int	mask;
@@ -338,6 +332,48 @@
 }
 
 /*
+ * Find next one bit in a bitmap reasonably efficiently.
+ */
+static __inline__ unsigned long find_next_bit(const unsigned long *addr,
+	unsigned long size, unsigned long offset)
+{
+	unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
+	unsigned int result = offset & ~31UL;
+	unsigned int tmp;
+
+	if (offset >= size)
+		return size;
+	size -= result;
+	offset &= 31UL;
+	if (offset) {
+		tmp = *p++;
+		tmp &= ~0UL << offset;
+		if (size < 32)
+			goto found_first;
+		if (tmp)
+			goto found_middle;
+		size -= 32;
+		result += 32;
+	}
+	while (size >= 32) {
+		if ((tmp = *p++) != 0)
+			goto found_middle;
+		result += 32;
+		size -= 32;
+	}
+	if (!size)
+		return result;
+	tmp = *p;
+
+found_first:
+	tmp &= ~0UL >> (32 - size);
+	if (tmp == 0UL)        /* Are any bits set? */
+		return result + size; /* Nope. */
+found_middle:
+	return result + __ffs(tmp);
+}
+
+/*
  * hweightN: returns the hamming weight (i.e. the number
  * of bits set) of a N-bit word
  */
@@ -477,5 +513,10 @@
 #define hweight8(x) generic_hweight8(x)
 
 #endif /* __KERNEL__ */
+
+/*
+ * fls: find last bit set.
+ */
+#define fls(x) generic_fls(x)
 
 #endif /* _M68KNOMMU_BITOPS_H */
diff -Nru a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
--- a/include/asm-m68knommu/cacheflush.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-m68knommu/cacheflush.h	Tue Jun 15 22:21:02 2004
@@ -12,6 +12,8 @@
 #define flush_cache_page(vma, vmaddr)		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)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_range(start,len)		__flush_cache_all()
 #define flush_icache_page(vma,pg)		do { } while (0)
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
@@ -37,13 +39,15 @@
 		"1:\n\t"
 		"movel	%%d0,%%a0\n\t"
 		"2:\n\t"
-		".word	0xf4e8\n\t"
+		".word	0xf468\n\t"
 		"addl	#0x10,%%a0\n\t"
 		"cmpl	#0x00000800,%%a0\n\t"
 		"blt	2b\n\t"
 		"addql	#1,%%d0\n\t"
 		"cmpil	#4,%%d0\n\t"
 		"bne	1b\n\t"
+		"movel	#0xb6088500,%%d0\n\t"
+		"movec	%%d0,%%CACR\n\t"
 		: : : "d0", "a0" );
 #endif /* CONFIG_M5407 */
 #ifdef CONFIG_M5272
diff -Nru a/include/asm-m68knommu/flat.h b/include/asm-m68knommu/flat.h
--- a/include/asm-m68knommu/flat.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-m68knommu/flat.h	Tue Jun 15 22:21:02 2004
@@ -9,7 +9,7 @@
 #define	flat_argvp_envp_on_stack()		1
 #define	flat_old_ram_flag(flags)		(flags)
 #define	flat_reloc_valid(reloc, size)		((reloc) <= (size))
-#define	flat_get_addr_from_rp(rp, relval)	get_unaligned(rp)
+#define	flat_get_addr_from_rp(rp, relval, flags)	get_unaligned(rp)
 #define	flat_put_addr_at_rp(rp, val, relval)	put_unaligned(val,rp)
 #define	flat_get_relocate_addr(rel)		(rel)
 
diff -Nru a/include/asm-m68knommu/mcfsmc.h b/include/asm-m68knommu/mcfsmc.h
--- a/include/asm-m68knommu/mcfsmc.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-m68knommu/mcfsmc.h	Tue Jun 15 22:20:39 2004
@@ -21,6 +21,18 @@
 
 #undef	outb
 #undef	inb
+#undef	outw
+#undef	outwd
+#undef	inw	
+#undef	outl
+#undef	inl
+
+#undef	outsb
+#undef	outsw
+#undef	outsl
+#undef	insb
+#undef	insw
+#undef	insl
 
 /*
  *	Re-defines for ColdFire environment... The SMC part is
diff -Nru a/include/asm-m68knommu/pgtable.h b/include/asm-m68knommu/pgtable.h
--- a/include/asm-m68knommu/pgtable.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-m68knommu/pgtable.h	Tue Jun 15 22:20:41 2004
@@ -11,8 +11,6 @@
 #include <asm/page.h>
 #include <asm/io.h>
 
-typedef pte_t *pte_addr_t;
-
 /*
  * Trivial page table functions.
  */
diff -Nru a/include/asm-m68knommu/rmap.h b/include/asm-m68knommu/rmap.h
--- a/include/asm-m68knommu/rmap.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,2 +0,0 @@
-/* Do not need anything here */
-
diff -Nru a/include/asm-m68knommu/unistd.h b/include/asm-m68knommu/unistd.h
--- a/include/asm-m68knommu/unistd.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-m68knommu/unistd.h	Tue Jun 15 22:20:40 2004
@@ -372,6 +372,30 @@
   return (type)__res;								\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
diff -Nru a/include/asm-mips/8253pit.h b/include/asm-mips/8253pit.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-mips/8253pit.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,10 @@
+/*
+ * 8253/8254 Programmable Interval Timer
+ */
+
+#ifndef _8253PIT_H
+#define _8253PIT_H
+
+#define PIT_TICK_RATE 	1193182UL
+
+#endif
diff -Nru a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
--- a/include/asm-mips/cacheflush.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-mips/cacheflush.h	Tue Jun 15 22:20:43 2004
@@ -45,6 +45,9 @@
 
 }
 
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
+
 extern void (*flush_icache_page)(struct vm_area_struct *vma,
 	struct page *page);
 extern void (*flush_icache_range)(unsigned long start, unsigned long end);
diff -Nru a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
--- a/include/asm-mips/checksum.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-mips/checksum.h	Tue Jun 15 22:20:36 2004
@@ -120,10 +120,6 @@
 	return csum_fold(csum);
 }
 
-/*
- * computes the checksum of the TCP/UDP pseudo-header
- * returns a 16-bit checksum, already complemented
- */
 static inline unsigned int csum_tcpudp_nofold(unsigned long saddr,
 	unsigned long daddr, unsigned short len, unsigned short proto,
 	unsigned int sum)
diff -Nru a/include/asm-mips/hdreg.h b/include/asm-mips/hdreg.h
--- a/include/asm-mips/hdreg.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-mips/hdreg.h	Tue Jun 15 22:21:03 2004
@@ -1 +1 @@
-#include <asm-generic/hdreg.h>
+#warning this file is obsolete, please do not use it
diff -Nru a/include/asm-mips/kmap_types.h b/include/asm-mips/kmap_types.h
--- a/include/asm-mips/kmap_types.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-mips/kmap_types.h	Tue Jun 15 22:20:44 2004
@@ -19,12 +19,11 @@
 D(6)	KM_BIO_DST_IRQ,
 D(7)	KM_PTE0,
 D(8)	KM_PTE1,
-D(9)	KM_PTE2,
-D(10)	KM_IRQ0,
-D(11)	KM_IRQ1,
-D(12)	KM_SOFTIRQ0,
-D(13)	KM_SOFTIRQ1,
-D(14)	KM_TYPE_NR
+D(9)	KM_IRQ0,
+D(10)	KM_IRQ1,
+D(11)	KM_SOFTIRQ0,
+D(12)	KM_SOFTIRQ1,
+D(13)	KM_TYPE_NR
 };
 
 #undef D
diff -Nru a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
--- a/include/asm-mips/mach-au1x00/au1000.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-mips/mach-au1x00/au1000.h	Tue Jun 15 22:20:37 2004
@@ -1141,14 +1141,14 @@
 #define Au1500_PCI_MEM_START      0x440000000
 #define Au1500_PCI_MEM_END        0x44FFFFFFF
 
-#define PCI_IO_START    (Au1500_PCI_IO_START + 0x300)
+#define PCI_IO_START    (Au1500_PCI_IO_START + 0x1000)
 #define PCI_IO_END      (Au1500_PCI_IO_END)
 #define PCI_MEM_START   (Au1500_PCI_MEM_START)
 #define PCI_MEM_END     (Au1500_PCI_MEM_END)
 #define PCI_FIRST_DEVFN (0<<3)
 #define PCI_LAST_DEVFN  (19<<3)
 
-#define IOPORT_RESOURCE_START 0x00000000
+#define IOPORT_RESOURCE_START 0x00001000 /* skip the legacy ide probing */
 #define IOPORT_RESOURCE_END   0xffffffff
 #define IOMEM_RESOURCE_START  0x10000000
 #define IOMEM_RESOURCE_END    0xffffffff
@@ -1199,5 +1199,20 @@
 #elif defined(CONFIG_SOC_AU1100)
 #define NUM_ETH_INTERFACES 1
 #endif
+/* Processor information base on prid.
+ * Copied from PowerPC.
+ */
+struct cpu_spec {
+	/* CPU is matched via (PRID & prid_mask) == prid_value */
+	unsigned int	prid_mask;
+	unsigned int	prid_value;
+
+	char		*cpu_name;
+	unsigned int	cpu_od;		/* Set Config[OD] */
+	unsigned int	cpu_bclk;	/* Enable BCLK switching */
+};
+
+extern struct cpu_spec		cpu_specs[];
+extern struct cpu_spec		*cur_cpu_spec[];
 
 #endif
diff -Nru a/include/asm-mips/mach-db1x00/db1x00.h b/include/asm-mips/mach-db1x00/db1x00.h
--- a/include/asm-mips/mach-db1x00/db1x00.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-mips/mach-db1x00/db1x00.h	Tue Jun 15 22:20:41 2004
@@ -27,21 +27,34 @@
 #ifndef __ASM_DB1X00_H
 #define __ASM_DB1X00_H
 
+#ifdef CONFIG_MIPS_DB1550
+#define BCSR_KSEG1_ADDR 0xAF000000
+#else
+#define BCSR_KSEG1_ADDR 0xAE000000
+#endif
 
 /*
  * Overlay data structure of the Db1x00 board registers.
- * Registers located at physical 1E0000xx, KSEG1 0xAE0000xx
+ * Registers located at physical 0E0000xx, KSEG1 0xAE0000xx
  */
 typedef volatile struct
 {
-	/*00*/	unsigned long whoami;
-	/*04*/	unsigned long status;
-	/*08*/	unsigned long switches;
-	/*0C*/	unsigned long resets;
-	/*10*/	unsigned long pcmcia;
-	/*14*/	unsigned long specific;
-	/*18*/	unsigned long leds;
-	/*1C*/	unsigned long swreset;
+	/*00*/	unsigned short whoami;
+	unsigned short reserved0;
+	/*04*/	unsigned short status;
+	unsigned short reserved1;
+	/*08*/	unsigned short switches;
+	unsigned short reserved2;
+	/*0C*/	unsigned short resets;
+	unsigned short reserved3;
+	/*10*/	unsigned short pcmcia;
+	unsigned short reserved4;
+	/*14*/	unsigned short specific;
+	unsigned short reserved5;
+	/*18*/	unsigned short leds;
+	unsigned short reserved6;
+	/*1C*/	unsigned short swreset;
+	unsigned short reserved7;
 
 } BCSR;
 
diff -Nru a/include/asm-mips/mach-dec/mc146818rtc.h b/include/asm-mips/mach-dec/mc146818rtc.h
--- a/include/asm-mips/mach-dec/mc146818rtc.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-mips/mach-dec/mc146818rtc.h	Tue Jun 15 22:20:41 2004
@@ -23,7 +23,7 @@
 #define RTC_PORT(x)	CPHYSADDR(dec_rtc_base)
 #define RTC_IO_EXTENT	dec_kn_slot_size
 #define RTC_IOMAPPED	0
-#define RTC_IRQ		0
+#undef RTC_IRQ
 
 #define RTC_DEC_YEAR	0x3f	/* Where we store the real year on DECs.  */
 
diff -Nru a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
--- a/include/asm-mips/mach-generic/ide.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-mips/mach-generic/ide.h	Tue Jun 15 22:20:41 2004
@@ -20,6 +20,8 @@
 # endif
 #endif
 
+#define IDE_ARCH_OBSOLETE_DEFAULTS
+
 static inline int ide_default_irq(unsigned long base)
 {
 	switch (base) {
@@ -47,6 +49,9 @@
 			return 0;
 	}
 }
+
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #ifdef CONFIG_BLK_DEV_IDEPCI
 #define ide_init_default_irq(base)	(0)
diff -Nru a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
--- a/include/asm-mips/pgtable-32.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-mips/pgtable-32.h	Tue Jun 15 22:20:41 2004
@@ -216,10 +216,4 @@
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)	((pte_t) { (x).val })
 
-#ifdef CONFIG_64BIT_PHYS_ADDR
-typedef u64 pte_addr_t;
-#else
-typedef pte_t *pte_addr_t;
-#endif
-
 #endif /* _ASM_PGTABLE_32_H */
diff -Nru a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
--- a/include/asm-mips/pgtable-64.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-mips/pgtable-64.h	Tue Jun 15 22:20:36 2004
@@ -214,8 +214,6 @@
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)	((pte_t) { (x).val })
 
-typedef pte_t *pte_addr_t;
-
 /*
  * Used for the b0rked handling of kernel pagetables on the 64-bit kernel.
  */
diff -Nru a/include/asm-mips/pmon.h b/include/asm-mips/pmon.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-mips/pmon.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,22 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2004 by Ralf Baechle
+ */
+#ifndef _ASM_PMON_H
+#define _ASM_PMON_H
+
+struct callvectors {
+	int	(*open) (char*, int, int);		/*	 0 */
+	int	(*close) (int);				/*	 4 */
+	int	(*read) (int, void*, int);		/*	 8 */
+	int	(*write) (int, void*, int);		/*	12 */
+	off_t	(*lseek) (int, off_t, int);		/*	16 */
+	int	(*printf) (const char*, ...);		/*	20 */
+	void	(*cacheflush) (void);			/*	24 */
+	char*	(*gets) (char*);			/*	28 */
+};
+
+#endif /* _ASM_PMON_H */
diff -Nru a/include/asm-mips/processor.h b/include/asm-mips/processor.h
--- a/include/asm-mips/processor.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-mips/processor.h	Tue Jun 15 22:20:36 2004
@@ -175,6 +175,8 @@
 	unsigned long seg;
 } mm_segment_t;
 
+#define ARCH_MIN_TASKALIGN	8
+
 /*
  * If you change thread_struct remember to change the #defines below too!
  */
diff -Nru a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
--- a/include/asm-mips/ptrace.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-mips/ptrace.h	Tue Jun 15 22:20:41 2004
@@ -69,6 +69,8 @@
 
 extern void show_regs(struct pt_regs *);
 
+extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
+
 #endif
 
 #endif /* _ASM_PTRACE_H */
diff -Nru a/include/asm-mips/rmap.h b/include/asm-mips/rmap.h
--- a/include/asm-mips/rmap.h	Tue Jun 15 22:20:42 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef __ASM_RMAP_H
-#define __ASM_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif /* __ASM_RMAP_H */
diff -Nru a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
--- a/include/asm-mips/spinlock.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-mips/spinlock.h	Tue Jun 15 22:21:03 2004
@@ -23,6 +23,7 @@
 
 #define spin_is_locked(x)	((x)->lock != 0)
 #define spin_unlock_wait(x)	do { barrier(); } while ((x)->lock)
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 /*
  * Simple spin lock operations.  There are two variants, one clears IRQ's
diff -Nru a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
--- a/include/asm-mips/thread_info.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-mips/thread_info.h	Tue Jun 15 22:20:35 2004
@@ -110,6 +110,7 @@
 #define TIF_NOTIFY_RESUME	1	/* resumption notification requested */
 #define TIF_SIGPENDING		2	/* signal pending */
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
+#define TIF_SYSCALL_AUDIT	4	/* syscall auditing active */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_SYSCALL_TRACE	31	/* syscall trace active */
@@ -118,12 +119,13 @@
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
+#define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
 #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 
-#define _TIF_WORK_MASK		0x0000fffe	/* work to do on
+#define _TIF_WORK_MASK		0x0000ffef	/* work to do on
                                                    interrupt/exception return */
-#define _TIF_ALLWORK_MASK	0x8000fffe	/* work to do on any return to
+#define _TIF_ALLWORK_MASK	0x8000ffff	/* work to do on any return to
                                                    u-space */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-mips/types.h b/include/asm-mips/types.h
--- a/include/asm-mips/types.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-mips/types.h	Tue Jun 15 22:20:36 2004
@@ -99,6 +99,8 @@
 #define HAVE_SECTOR_T
 #endif
 
+typedef unsigned short kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
--- a/include/asm-mips/unistd.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-mips/unistd.h	Tue Jun 15 22:20:36 2004
@@ -288,16 +288,25 @@
 #define __NR_clock_nanosleep		(__NR_Linux + 265)
 #define __NR_tgkill			(__NR_Linux + 266)
 #define __NR_utimes			(__NR_Linux + 267)
+#define __NR_mbind			(__NR_Linux + 268)
+#define __NR_get_mempolicy		(__NR_Linux + 269)
+#define __NR_set_mempolicy		(__NR_Linux + 270)
+#define __NR_mq_open			(__NR_Linux + 271)
+#define __NR_mq_unlink			(__NR_Linux + 272)
+#define __NR_mq_timedsend		(__NR_Linux + 273)
+#define __NR_mq_timedreceive		(__NR_Linux + 274)
+#define __NR_mq_notify			(__NR_Linux + 275)
+#define __NR_mq_getsetattr		(__NR_Linux + 276)
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls		267
+#define __NR_Linux_syscalls		276
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_O32_Linux			4000
-#define __NR_O32_Linux_syscalls		267
+#define __NR_O32_Linux_syscalls		276
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
@@ -532,16 +541,25 @@
 #define __NR_clock_nanosleep		(__NR_Linux + 224)
 #define __NR_tgkill			(__NR_Linux + 225)
 #define __NR_utimes			(__NR_Linux + 226)
+#define __NR_mbind			(__NR_Linux + 227)
+#define __NR_get_mempolicy		(__NR_Linux + 228)
+#define __NR_set_mempolicy		(__NR_Linux + 229)
+#define __NR_mq_open			(__NR_Linux + 230)
+#define __NR_mq_unlink			(__NR_Linux + 231)
+#define __NR_mq_timedsend		(__NR_Linux + 232)
+#define __NR_mq_timedreceive		(__NR_Linux + 233)
+#define __NR_mq_notify			(__NR_Linux + 234)
+#define __NR_mq_getsetattr		(__NR_Linux + 235)
 
 /*
  * Offset of the last Linux flavoured syscall
  */
-#define __NR_Linux_syscalls		226
+#define __NR_Linux_syscalls		235
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 #define __NR_64_Linux			5000
-#define __NR_64_Linux_syscalls		226
+#define __NR_64_Linux_syscalls		235
 
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 
@@ -780,16 +798,25 @@
 #define __NR_clock_nanosleep		(__NR_Linux + 228)
 #define __NR_tgkill			(__NR_Linux + 229)
 #define __NR_utimes			(__NR_Linux + 230)
+#define __NR_mbind			(__NR_Linux + 231)
+#define __NR_get_mempolicy		(__NR_Linux + 232)
+#define __NR_set_mempolicy		(__NR_Linux + 233)
+#define __NR_mq_open			(__NR_Linux + 234)
+#define __NR_mq_unlink			(__NR_Linux + 235)
+#define __NR_mq_timedsend		(__NR_Linux + 236)
+#define __NR_mq_timedreceive		(__NR_Linux + 237)
+#define __NR_mq_notify			(__NR_Linux + 238)
+#define __NR_mq_getsetattr		(__NR_Linux + 239)
 
 /*
  * Offset of the last N32 flavoured syscall
  */
-#define __NR_Linux_syscalls		230
+#define __NR_Linux_syscalls		239
 
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #define __NR_N32_Linux			6000
-#define __NR_N32_Linux_syscalls		230
+#define __NR_N32_Linux_syscalls		239
 
 #ifndef __ASSEMBLY__
 
@@ -1044,6 +1071,31 @@
 }
 
 #endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
+
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+# ifndef __mips64
+#  define __ARCH_WANT_STAT64
+# endif
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
diff -Nru a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
--- a/include/asm-mips/vr41xx/vr41xx.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-mips/vr41xx/vr41xx.h	Tue Jun 15 22:20:38 2004
@@ -136,6 +136,9 @@
 extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
 extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq));
 
+extern void vr41xx_enable_dsiuint(void);
+extern void vr41xx_disable_dsiuint(void);
+
 /*
  * Power Management Unit
  */
@@ -189,22 +192,25 @@
 /*
  * Serial Interface Unit
  */
-extern void vr41xx_siu_init(int interface, int module);
-extern void vr41xx_siu_ifselect(int interface, int module);
+extern void vr41xx_siu_init(void);
 extern int vr41xx_serial_ports;
 
 /* SIU interfaces */
-enum {
+typedef enum {
 	SIU_RS232C,
 	SIU_IRDA
-};
+} siu_interface_t;
 
 /* IrDA interfaces */
-enum {
-	IRDA_SHARP = 1,
+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);
 
 /*
  * Debug Serial Interface Unit
diff -Nru a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
--- a/include/asm-parisc/atomic.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-parisc/atomic.h	Tue Jun 15 22:20:39 2004
@@ -3,7 +3,6 @@
 
 #include <linux/config.h>
 #include <asm/system.h>
-
 /* Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>.  */
 
 /*
@@ -15,33 +14,47 @@
  */
 
 #ifdef CONFIG_SMP
+#include <asm/cache.h>		/* we use L1_CACHE_BYTES */
+
+typedef spinlock_t atomic_lock_t;
+
 /* Use an array of spinlocks for our atomic_ts.
-** Hash function to index into a different SPINLOCK.
-** Since "a" is usually an address, ">>8" makes one spinlock per 64-bytes.
-*/
+ * Hash function to index into a different SPINLOCK.
+ * Since "a" is usually an address, use one spinlock per cacheline.
+ */
 #  define ATOMIC_HASH_SIZE 4
-#  define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long) a)>>8)&(ATOMIC_HASH_SIZE-1)])
+#  define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ]))
+
+extern atomic_lock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
+
+static inline void atomic_spin_lock(atomic_lock_t *a)
+{
+	while (__ldcw(a) == 0)
+		while (a->lock[0] == 0);
+}
+
+static inline void atomic_spin_unlock(atomic_lock_t *a)
+{
+	a->lock[0] = 1;
+}
 
-extern spinlock_t __atomic_hash[ATOMIC_HASH_SIZE];
-/* copied from <asm/spinlock.h> and modified */
-#  define SPIN_LOCK(x) \
-	do { while(__ldcw(&(x)->lock) == 0); } while(0)
-	
-#  define SPIN_UNLOCK(x) \
-	do { (x)->lock = 1; } while(0)
 #else
 #  define ATOMIC_HASH_SIZE 1
 #  define ATOMIC_HASH(a)	(0)
-
-/* copied from <linux/spinlock.h> and modified */
-#  define SPIN_LOCK(x) (void)(x)
-	
-#  define SPIN_UNLOCK(x) do { } while(0)
+#  define atomic_spin_lock(x) (void)(x)
+#  define atomic_spin_unlock(x) do { } while(0)
 #endif
 
 /* copied from <linux/spinlock.h> and modified */
-#define SPIN_LOCK_IRQSAVE(lock, flags)		do { local_irq_save(flags);       SPIN_LOCK(lock); } while (0)
-#define SPIN_UNLOCK_IRQRESTORE(lock, flags)	do { SPIN_UNLOCK(lock);  local_irq_restore(flags); } while (0)
+#define atomic_spin_lock_irqsave(lock, flags)	do { 	\
+	local_irq_save(flags);				\
+	atomic_spin_lock(lock); 			\
+} while (0)
+
+#define atomic_spin_unlock_irqrestore(lock, flags) do {	\
+	atomic_spin_unlock(lock);			\
+	local_irq_restore(flags);			\
+} while (0)
 
 /* Note that we need not lock read accesses - aligned word writes/reads
  * are atomic, so a reader never sees unconsistent values.
@@ -137,22 +150,22 @@
 {
 	int ret;
 	unsigned long flags;
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(v), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(v), flags);
 
 	ret = (v->counter += i);
 
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(v), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
 	return ret;
 }
 
 static __inline__ void atomic_set(atomic_t *v, int i) 
 {
 	unsigned long flags;
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(v), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(v), flags);
 
 	v->counter = i;
 
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(v), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
 }
 
 static __inline__ int atomic_read(const atomic_t *v)
@@ -171,6 +184,18 @@
 #define atomic_sub_return(i,v)	(__atomic_add_return(-((int)i),(v)))
 #define atomic_inc_return(v)	(__atomic_add_return(   1,(v)))
 #define atomic_dec_return(v)	(__atomic_add_return(  -1,(v)))
+
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
+
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
 
 #define atomic_dec_and_test(v)	(atomic_dec_return(v) == 0)
 
diff -Nru a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
--- a/include/asm-parisc/bitops.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-parisc/bitops.h	Tue Jun 15 22:20:36 2004
@@ -38,9 +38,9 @@
 
 	addr += (nr >> SHIFT_PER_LONG);
 	mask = 1L << CHOP_SHIFTCOUNT(nr);
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
 	*addr |= mask;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 }
 
 static __inline__ void __set_bit(int nr, void * address)
@@ -61,9 +61,9 @@
 
 	addr += (nr >> SHIFT_PER_LONG);
 	mask = 1L << CHOP_SHIFTCOUNT(nr);
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
 	*addr &= ~mask;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 }
 
 static __inline__ void __clear_bit(unsigned long nr, volatile void * address)
@@ -84,9 +84,9 @@
 
 	addr += (nr >> SHIFT_PER_LONG);
 	mask = 1L << CHOP_SHIFTCOUNT(nr);
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
 	*addr ^= mask;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 }
 
 static __inline__ void __change_bit(int nr, void * address)
@@ -108,10 +108,10 @@
 
 	addr += (nr >> SHIFT_PER_LONG);
 	mask = 1L << CHOP_SHIFTCOUNT(nr);
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
 	oldbit = (*addr & mask) ? 1 : 0;
 	*addr |= mask;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 
 	return oldbit;
 }
@@ -139,10 +139,10 @@
 
 	addr += (nr >> SHIFT_PER_LONG);
 	mask = 1L << CHOP_SHIFTCOUNT(nr);
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
 	oldbit = (*addr & mask) ? 1 : 0;
 	*addr &= ~mask;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 
 	return oldbit;
 }
@@ -170,10 +170,10 @@
 
 	addr += (nr >> SHIFT_PER_LONG);
 	mask = 1L << CHOP_SHIFTCOUNT(nr);
-	SPIN_LOCK_IRQSAVE(ATOMIC_HASH(addr), flags);
+	atomic_spin_lock_irqsave(ATOMIC_HASH(addr), flags);
 	oldbit = (*addr & mask) ? 1 : 0;
 	*addr ^= mask;
-	SPIN_UNLOCK_IRQRESTORE(ATOMIC_HASH(addr), flags);
+	atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 
 	return oldbit;
 }
@@ -426,6 +426,17 @@
 found_middle:
 	return result + __ffs(tmp);
 }
+
+/**
+ * find_first_bit - find the first set bit in a memory region
+ * @addr: The address to start the search at
+ * @size: The maximum size to search
+ *
+ * Returns the bit-number of the first set bit, not the number of the byte
+ * containing a bit.
+ */
+#define find_first_bit(addr, size) \
+        find_next_bit((addr), (size), 0)
 
 #define _EXT2_HAVE_ASM_BITOPS_
 
diff -Nru a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h
--- a/include/asm-parisc/cache.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-parisc/cache.h	Tue Jun 15 22:20:37 2004
@@ -52,6 +52,8 @@
 extern void disable_sr_hashing_asm(int); /* low level support for above */
 extern void free_sid(unsigned long);
 unsigned long alloc_sid(void);
+extern void flush_user_dcache_page(unsigned long);
+extern void flush_user_icache_page(unsigned long);
 
 struct seq_file;
 extern void show_cache_info(struct seq_file *m);
diff -Nru a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
--- a/include/asm-parisc/cacheflush.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-parisc/cacheflush.h	Tue Jun 15 22:21:03 2004
@@ -78,17 +78,18 @@
 	}
 }
 
+#define flush_dcache_mmap_lock(mapping) \
+	spin_lock_irq(&(mapping)->tree_lock)
+#define flush_dcache_mmap_unlock(mapping) \
+	spin_unlock_irq(&(mapping)->tree_lock)
+
 #define flush_icache_page(vma,page)	do { flush_kernel_dcache_page(page_address(page)); flush_kernel_icache_page(page_address(page)); } while (0)
 
 #define flush_icache_range(s,e)		do { flush_kernel_dcache_range_asm(s,e); flush_kernel_icache_range_asm(s,e); } while (0)
 
-#define flush_icache_user_range(vma, page, addr, len) do { \
-        flush_user_dcache_range(addr, addr + len); \
-	flush_user_icache_range(addr, addr + len); } while (0)
-
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
 do { memcpy(dst, src, len); \
-     flush_icache_user_range(vma, page, vaddr, len); \
+     flush_kernel_dcache_range_asm((unsigned long)dst, (unsigned long)dst + len); \
 } while (0)
 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
 	memcpy(dst, src, len)
@@ -112,27 +113,85 @@
 	}
 }
 
+/* Simple function to work out if we have an existing address translation
+ * for a user space vma. */
+static inline int translation_exists(struct vm_area_struct *vma,
+				     unsigned long addr)
+{
+	pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
+	pmd_t *pmd;
+	pte_t *pte;
+
+	if(pgd_none(*pgd))
+		return 0;
+
+	pmd = pmd_offset(pgd, addr);
+	if(pmd_none(*pmd) || pmd_bad(*pmd))
+		return 0;
+
+	pte = pte_offset_map(pmd, addr);
+
+	/* The PA flush mappings show up as pte_none, but they're
+	 * valid none the less */
+	if(pte_none(*pte) && ((pte_val(*pte) & _PAGE_FLUSH) == 0))
+		return 0;
+	return 1;
+}
+
+
+/* Private function to flush a page from the cache of a non-current
+ * process.  cr25 contains the Page Directory of the current user
+ * process; we're going to hijack both it and the user space %sr3 to
+ * temporarily make the non-current process current.  We have to do
+ * this because cache flushing may cause a non-access tlb miss which
+ * the handlers have to fill in from the pgd of the non-current
+ * process. */
 static inline void
-flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
+flush_user_cache_page_non_current(struct vm_area_struct *vma,
+				  unsigned long vmaddr)
 {
-	int sr3;
+	/* save the current process space and pgd */
+	unsigned long space = mfsp(3), pgd = mfctl(25);
 
-	if (!vma->vm_mm->context) {
-		BUG();
-		return;
-	}
+	/* we don't mind taking interrups since they may not
+	 * do anything with user space, but we can't
+	 * be preempted here */
+	preempt_disable();
+
+	/* make us current */
+	mtctl(__pa(vma->vm_mm->pgd), 25);
+	mtsp(vma->vm_mm->context, 3);
+
+	flush_user_dcache_page(vmaddr);
+	if(vma->vm_flags & VM_EXEC)
+		flush_user_icache_page(vmaddr);
+
+	/* put the old current process back */
+	mtsp(space, 3);
+	mtctl(pgd, 25);
+	preempt_enable();
+}
 
-	sr3 = mfsp(3);
-	if (vma->vm_mm->context == sr3) {
-		flush_user_dcache_range(vmaddr,vmaddr + PAGE_SIZE);
+static inline void
+__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
+{
+	if (likely(vma->vm_mm->context == mfsp(3))) {
+		flush_user_dcache_page(vmaddr);
 		if (vma->vm_flags & VM_EXEC)
-			flush_user_icache_range(vmaddr,vmaddr + PAGE_SIZE);
+			flush_user_icache_page(vmaddr);
 	} else {
-		if (vma->vm_flags & VM_EXEC)
-			flush_cache_all();
-		else
-			flush_data_cache();
+		flush_user_cache_page_non_current(vma, vmaddr);
 	}
+}
+
+static inline void
+flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
+{
+	BUG_ON(!vma->vm_mm->context);
+
+	if(likely(translation_exists(vma, vmaddr)))
+		__flush_cache_page(vma, vmaddr);
+
 }
 #endif
 
diff -Nru a/include/asm-parisc/dma-mapping.h b/include/asm-parisc/dma-mapping.h
--- a/include/asm-parisc/dma-mapping.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-parisc/dma-mapping.h	Tue Jun 15 22:20:39 2004
@@ -247,4 +247,7 @@
 void * sba_get_iommu(struct parisc_device *dev);
 #endif
 
+/* At the moment, we panic on error for IOMMU resource exaustion */
+#define dma_mapping_error(x)	0
+
 #endif
diff -Nru a/include/asm-parisc/fixmap.h b/include/asm-parisc/fixmap.h
--- a/include/asm-parisc/fixmap.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-parisc/fixmap.h	Tue Jun 15 22:20:41 2004
@@ -2,18 +2,22 @@
 #define _ASM_FIXMAP_H
 
 /*
- * Allocate a 8 Mb temporary mapping area for copy_user_page/clear_user_page.
- * This area needs to be aligned on a 8 Mb boundary.
+ * This file defines the locations of the fixed mappings on parisc.
  *
- * FIXME:
+ * All of the values in this file are machine virtual addresses.
  *
- * For PA-RISC, this has no meaning.  It is starting to be used on x86
- * for vsyscalls.  PA will probably do this using space registers.
- */
+ * All of the values in this file must be <4GB (because of assembly
+ * loading restrictions).  If you place this region anywhere above
+ * __PAGE_OFFSET, you must adjust the memory map accordingly */
 
-/* This TMPALIAS_MAP_START reserves some of the memory where the
- * FIXMAP region is on x86.  It's only real use is to constrain
- * VMALLOC_END (see pktable.h) */
-#define TMPALIAS_MAP_START (__PAGE_OFFSET - 0x01000000)
+/* The alias region is used in kernel space to do copy/clear to or
+ * from areas congruently mapped with user space.  It is 8MB large
+ * and must be 16MB aligned */
+#define TMPALIAS_MAP_START	((__PAGE_OFFSET) - 16*1024*1024)
+/* This is the kernel area for all maps (vmalloc, dma etc.)  most
+ * usually, it extends up to TMPALIAS_MAP_START.  Virtual addresses
+ * 0..GATEWAY_PAGE_SIZE are reserved for the gateway page */
+#define KERNEL_MAP_START	(GATEWAY_PAGE_SIZE)
+#define KERNEL_MAP_END		(TMPALIAS_MAP_START)
 
 #endif
diff -Nru a/include/asm-parisc/hardware.h b/include/asm-parisc/hardware.h
--- a/include/asm-parisc/hardware.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-parisc/hardware.h	Tue Jun 15 22:20:43 2004
@@ -36,7 +36,8 @@
 	pcxu_	= 7, /* pa8200	(u+)	pa 2.0  */
 	pcxw	= 8, /* pa8500		pa 2.0  */
 	pcxw_	= 9, /* pa8600	(w+)	pa 2.0  */
-	pcxw2	= 10 /* pa8700		pa 2.0  */
+	pcxw2	= 10, /* pa8700		pa 2.0  */
+	mako	= 11  /* pa8800		pa 2.0  */
 };
 
 extern char *cpu_name_version[][2]; /* mapping from enum cpu_type to strings */
diff -Nru a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h
--- a/include/asm-parisc/ide.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-parisc/ide.h	Tue Jun 15 22:20:39 2004
@@ -19,10 +19,8 @@
 #define MAX_HWIFS	2
 #endif
 
-#define ide_default_irq(base) (0)
-#define ide_default_io_base(index) (0)
-
-#define ide_init_default_irq(base)	(0)
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #define ide_request_irq(irq,hand,flg,dev,id)	request_irq((irq),(hand),(flg),(dev),(id))
 #define ide_free_irq(irq,dev_id)		free_irq((irq), (dev_id))
diff -Nru a/include/asm-parisc/page.h b/include/asm-parisc/page.h
--- a/include/asm-parisc/page.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-parisc/page.h	Tue Jun 15 22:20:37 2004
@@ -10,6 +10,7 @@
 #include <linux/config.h>
 #ifndef __ASSEMBLY__
 
+#include <asm/types.h>
 #include <asm/cache.h>
 
 #define clear_page(page)	memset((void *)(page), 0, PAGE_SIZE)
@@ -39,12 +40,26 @@
 /*
  * These are used to make use of C type-checking..
  */
+#ifdef __LP64__
 typedef struct { unsigned long pte; } pte_t;
-typedef struct { unsigned long pmd; } pmd_t;
-typedef struct { unsigned long pgd; } pgd_t;
+#else
+typedef struct {
+	unsigned long pte;
+	unsigned long flags;
+} pte_t;
+#endif
+/* NOTE: even on 64 bits, these entries are __u32 because we allocate
+ * the pmd and pgd in ZONE_DMA (i.e. under 4GB) */
+typedef struct { __u32 pmd; } pmd_t;
+typedef struct { __u32 pgd; } pgd_t;
 typedef struct { unsigned long pgprot; } pgprot_t;
 
 #define pte_val(x)	((x).pte)
+#ifdef __LP64__
+#define pte_flags(x)	(*(__u32 *)&((x).pte))
+#else
+#define pte_flags(x)	((x).flags)
+#endif
 #define pmd_val(x)	((x).pmd)
 #define pgd_val(x)	((x).pgd)
 #define pgprot_val(x)	((x).pgprot)
@@ -84,14 +99,43 @@
 
 #endif /* !__ASSEMBLY__ */
 
+/* WARNING: The definitions below must match exactly to sizeof(pte_t)
+ * etc
+ */
+#ifdef __LP64__
+#define BITS_PER_PTE_ENTRY	3
+#define BITS_PER_PMD_ENTRY	2
+#define BITS_PER_PGD_ENTRY	2
+#else
+#define BITS_PER_PTE_ENTRY	3
+#define BITS_PER_PMD_ENTRY	2
+#define BITS_PER_PGD_ENTRY	BITS_PER_PMD_ENTRY
+#endif
+#define PGD_ENTRY_SIZE	(1UL << BITS_PER_PGD_ENTRY)
+#define PMD_ENTRY_SIZE	(1UL << BITS_PER_PMD_ENTRY)
+#define PTE_ENTRY_SIZE	(1UL << BITS_PER_PTE_ENTRY)
+
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
 
 
 #define LINUX_GATEWAY_SPACE     0
+
+/* This governs the relationship between virtual and physical addresses.
+ * If you alter it, make sure to take care of our various fixed mapping
+ * segments in fixmap.h */
 #define __PAGE_OFFSET           (0x10000000)
 
 #define PAGE_OFFSET		((unsigned long)__PAGE_OFFSET)
+
+/* The size of the gateway page (we leave lots of room for expansion) */
+#define GATEWAY_PAGE_SIZE	0x4000
+
+/* The start of the actual kernel binary---used in vmlinux.lds.S
+ * Leave some space after __PAGE_OFFSET for detecting kernel null
+ * ptr derefs */
+#define KERNEL_BINARY_TEXT_START	(__PAGE_OFFSET + 0x100000)
+
 /* These macros don't work for 64-bit C code -- don't allow in C at all */
 #ifdef __ASSEMBLY__
 #   define PA(x)	((x)-__PAGE_OFFSET)
diff -Nru a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h
--- a/include/asm-parisc/pdc.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-parisc/pdc.h	Tue Jun 15 22:20:35 2004
@@ -953,6 +953,7 @@
 		struct pdc_memory_table *tbl, unsigned long entries);
 #endif
 
+void set_firmware_width(void);
 int pdc_do_firm_test_reset(unsigned long ftc_bitmap);
 int pdc_do_reset(void);
 int pdc_soft_power_info(unsigned long *power_reg);
diff -Nru a/include/asm-parisc/pgalloc.h b/include/asm-parisc/pgalloc.h
--- a/include/asm-parisc/pgalloc.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-parisc/pgalloc.h	Tue Jun 15 22:21:03 2004
@@ -10,39 +10,75 @@
 #include <asm/pgtable.h>
 #include <asm/cache.h>
 
+/* Allocate the top level pgd (page directory)
+ *
+ * Here (for 64 bit kernels) we implement a Hybrid L2/L3 scheme: we
+ * allocate the first pmd adjacent to the pgd.  This means that we can
+ * subtract a constant offset to get to it.  The pmd and pgd sizes are
+ * arranged so that a single pmd covers 4GB (giving a full LP64
+ * process access to 8TB) so our lookups are effectively L2 for the
+ * first 4GB of the kernel (i.e. for all ILP32 processes and all the
+ * kernel for machines with under 4GB of memory) */
 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 {
-	pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL);
-	if (likely(pgd != NULL))
-		clear_page(pgd);
-	return pgd;
+	pgd_t *pgd = (pgd_t *)__get_free_pages(GFP_KERNEL|GFP_DMA,
+					       PGD_ALLOC_ORDER);
+	pgd_t *actual_pgd = pgd;
+
+	if (likely(pgd != NULL)) {
+		memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER);
+#ifdef __LP64__
+		actual_pgd += PTRS_PER_PGD;
+		/* Populate first pmd with allocated memory.  We mark it
+		 * with _PAGE_GATEWAY as a signal to the system that this
+		 * pmd entry may not be cleared. */
+		pgd_val(*actual_pgd) = (_PAGE_TABLE | _PAGE_GATEWAY) + 
+			(__u32)__pa((unsigned long)pgd);
+		/* The first pmd entry also is marked with _PAGE_GATEWAY as
+		 * a signal that this pmd may not be freed */
+		pgd_val(*pgd) = _PAGE_GATEWAY;
+#endif
+	}
+	return actual_pgd;
 }
 
 static inline void pgd_free(pgd_t *pgd)
 {
-	free_page((unsigned long)pgd);
+#ifdef __LP64__
+	pgd -= PTRS_PER_PGD;
+#endif
+	free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
 }
 
-#ifdef __LP64__
+#if PT_NLEVELS == 3
 
 /* Three Level Page Table Support for pmd's */
 
 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
 {
-	pgd_val(*pgd) = _PAGE_TABLE + __pa((unsigned long)pmd);
+	pgd_val(*pgd) = _PAGE_TABLE + (__u32)__pa((unsigned long)pmd);
 }
 
+/* NOTE: pmd must be in ZONE_DMA (<4GB) so the pgd pointer can be
+ * housed in 32 bits */
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
+	pmd_t *pmd = (pmd_t *)__get_free_pages(GFP_KERNEL|__GFP_REPEAT|GFP_DMA,
+					       PMD_ORDER);
 	if (pmd)
-		clear_page(pmd);
+		memset(pmd, 0, PAGE_SIZE<<PMD_ORDER);
 	return pmd;
 }
 
 static inline void pmd_free(pmd_t *pmd)
 {
-	free_page((unsigned long)pmd);
+#ifdef __LP64__
+	if(pmd_val(*pmd) & _PAGE_GATEWAY)
+		/* This is the permanent pmd attached to the pgd;
+		 * cannot free it */
+		return;
+#endif
+	free_pages((unsigned long)pmd, PMD_ORDER);
 }
 
 #else
@@ -63,16 +99,26 @@
 static inline void
 pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
 {
-	pmd_val(*pmd) = _PAGE_TABLE + __pa((unsigned long)pte);
+#ifdef __LP64__
+	/* preserve the gateway marker if this is the beginning of
+	 * the permanent pmd */
+	if(pmd_val(*pmd) & _PAGE_GATEWAY)
+		pmd_val(*pmd) = (_PAGE_TABLE | _PAGE_GATEWAY)
+			+ (__u32)__pa((unsigned long)pte);
+	else
+#endif
+		pmd_val(*pmd) = _PAGE_TABLE + (__u32)__pa((unsigned long)pte);
 }
 
 #define pmd_populate(mm, pmd, pte_page) \
 	pmd_populate_kernel(mm, pmd, page_address(pte_page))
 
+/* NOTE: pte must be in ZONE_DMA (<4GB) so that the pmd pointer
+ * can be housed in 32 bits */
 static inline struct page *
 pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	struct page *page = alloc_page(GFP_KERNEL|__GFP_REPEAT);
+	struct page *page = alloc_page(GFP_KERNEL|__GFP_REPEAT|GFP_DMA);
 	if (likely(page != NULL))
 		clear_page(page_address(page));
 	return page;
@@ -81,7 +127,7 @@
 static inline pte_t *
 pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
 {
-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
+	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|GFP_DMA);
 	if (likely(pte != NULL))
 		clear_page(pte);
 	return pte;
diff -Nru a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
--- a/include/asm-parisc/pgtable.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-parisc/pgtable.h	Tue Jun 15 22:20:44 2004
@@ -43,9 +43,9 @@
 #define pte_ERROR(e) \
 	printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
 #define pmd_ERROR(e) \
-	printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
+	printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, (unsigned long)pmd_val(e))
 #define pgd_ERROR(e) \
-	printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
+	printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))
 
  /* Note: If you change ISTACK_SIZE, you need to change the corresponding
   * values in vmlinux.lds and vmlinux64.lds (init_istack section). Also,
@@ -55,49 +55,59 @@
 #define  ISTACK_SIZE  32768 /* Interrupt Stack Size */
 #define  ISTACK_ORDER 3
 
-/*
- * NOTE: Many of the below macros use PT_NLEVELS because
- *       it is convenient that PT_NLEVELS == LOG2(pte size in bytes),
- *       i.e. we use 3 level page tables when we use 8 byte pte's
- *       (for 64 bit) and 2 level page tables when we use 4 byte pte's
- */
+/* This is the size of the initially mapped kernel memory (i.e. currently
+ * 0 to 1<<23 == 8MB */
+#define KERNEL_INITIAL_ORDER	23
+#define KERNEL_INITIAL_SIZE	(1 << KERNEL_INITIAL_ORDER)
 
 #ifdef __LP64__
-#define PT_NLEVELS 3
-#define PT_INITIAL 4 /* Number of initial page tables */
+#define PT_NLEVELS	3
+#define PGD_ORDER	1 /* Number of pages per pgd */
+#define PMD_ORDER	1 /* Number of pages per pmd */
+#define PGD_ALLOC_ORDER	2 /* first pgd contains pmd */
 #else
-#define PT_NLEVELS 2
-#define PT_INITIAL 2 /* Number of initial page tables */
+#define PT_NLEVELS	2
+#define PGD_ORDER	1 /* Number of pages per pgd */
+#define PGD_ALLOC_ORDER	PGD_ORDER
 #endif
 
-#define MAX_ADDRBITS (PAGE_SHIFT + (PT_NLEVELS)*(PAGE_SHIFT - PT_NLEVELS))
-#define MAX_ADDRESS (1UL << MAX_ADDRBITS)
-
-#define SPACEID_SHIFT (MAX_ADDRBITS - 32)
-
-/* Definitions for 1st level */
-
-#define PGDIR_SHIFT  (PAGE_SHIFT + (PT_NLEVELS - 1)*(PAGE_SHIFT - PT_NLEVELS))
-#define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
-#define PGDIR_MASK	(~(PGDIR_SIZE-1))
-#define PTRS_PER_PGD    (1UL << (PAGE_SHIFT - PT_NLEVELS))
-#define USER_PTRS_PER_PGD       PTRS_PER_PGD
+/* Definitions for 3rd level (we use PLD here for Page Lower directory
+ * because PTE_SHIFT is used lower down to mean shift that has to be
+ * done to get usable bits out of the PTE) */
+#define PLD_SHIFT	PAGE_SHIFT
+#define PLD_SIZE	PAGE_SIZE
+#define BITS_PER_PTE	(PAGE_SHIFT - BITS_PER_PTE_ENTRY)
+#define PTRS_PER_PTE    (1UL << BITS_PER_PTE)
 
 /* Definitions for 2nd level */
 #define pgtable_cache_init()	do { } while (0)
 
-#define PMD_SHIFT       (PAGE_SHIFT + (PAGE_SHIFT - PT_NLEVELS))
+#define PMD_SHIFT       (PLD_SHIFT + BITS_PER_PTE)
 #define PMD_SIZE	(1UL << PMD_SHIFT)
 #define PMD_MASK	(~(PMD_SIZE-1))
 #if PT_NLEVELS == 3
-#define PTRS_PER_PMD    (1UL << (PAGE_SHIFT - PT_NLEVELS))
+#define BITS_PER_PMD	(PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY)
 #else
-#define PTRS_PER_PMD    1
+#define BITS_PER_PMD	0
 #endif
+#define PTRS_PER_PMD    (1UL << BITS_PER_PMD)
+
+/* Definitions for 1st level */
+#define PGDIR_SHIFT	(PMD_SHIFT + BITS_PER_PMD)
+#define BITS_PER_PGD	(PAGE_SHIFT + PGD_ORDER - BITS_PER_PGD_ENTRY)
+#define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
+#define PGDIR_MASK	(~(PGDIR_SIZE-1))
+#define PTRS_PER_PGD    (1UL << BITS_PER_PGD)
+#define USER_PTRS_PER_PGD       PTRS_PER_PGD
 
-/* Definitions for 3rd level */
+#define MAX_ADDRBITS	(PGDIR_SHIFT + BITS_PER_PGD)
+#define MAX_ADDRESS	(1UL << MAX_ADDRBITS)
+
+#define SPACEID_SHIFT (MAX_ADDRBITS - 32)
 
-#define PTRS_PER_PTE    (1UL << (PAGE_SHIFT - PT_NLEVELS))
+/* This calculates the number of initial pages we need for the initial
+ * page tables */
+#define PT_INITIAL	(1 << (KERNEL_INITIAL_ORDER - PMD_SHIFT))
 
 /*
  * pgd entries used up by user/kernel:
@@ -110,7 +120,7 @@
 #define PCXL_DMA_MAP_SIZE   (8*1024*1024)
 #define VMALLOC_START   ((unsigned long)vmalloc_start)
 /* this is a fixmap remnant, see fixmap.h */
-#define VMALLOC_END	(TMPALIAS_MAP_START)
+#define VMALLOC_END	(KERNEL_MAP_END)
 #endif
 
 /* NB: The tlb miss handlers make certain assumptions about the order */
@@ -217,7 +227,7 @@
 
 /* initial page tables for 0-8MB for kernel */
 
-extern unsigned long pg0[];
+extern pte_t pg0[];
 
 /* zero page used for uninitialized stuff */
 
@@ -234,22 +244,50 @@
 #define pte_present(x)	(pte_val(x) & _PAGE_PRESENT)
 #define pte_clear(xp)	do { pte_val(*(xp)) = 0; } while (0)
 
+#ifdef __LP64__
+/* The first entry of the permanent pmd is not there if it contains
+ * the gateway marker */
+#define pmd_none(x)	(!pmd_val(x) || pmd_val(x) == _PAGE_GATEWAY)
+#define pmd_bad(x)	((pmd_val(x) & ~PAGE_MASK) != _PAGE_TABLE && (pmd_val(x) & ~PAGE_MASK) != (_PAGE_TABLE | _PAGE_GATEWAY))
+#else
 #define pmd_none(x)	(!pmd_val(x))
 #define pmd_bad(x)	((pmd_val(x) & ~PAGE_MASK) != _PAGE_TABLE)
+#endif
 #define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)
-#define pmd_clear(xp)	do { pmd_val(*(xp)) = 0; } while (0)
+static inline void pmd_clear(pmd_t *pmd) {
+#ifdef __LP64__
+	if(pmd_val(*pmd) & _PAGE_GATEWAY)
+		/* This is the entry pointing to the permanent pmd
+		 * attached to the pgd; cannot clear it */
+		pmd_val(*pmd) = _PAGE_GATEWAY;
+	else
+#endif
+		pmd_val(*pmd) = 0;
+}
 
 
 
-#ifdef __LP64__
+#if PT_NLEVELS == 3
 #define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
 
 /* For 64 bit we have three level tables */
 
 #define pgd_none(x)     (!pgd_val(x))
+#ifdef __LP64__
+#define pgd_bad(x)      ((pgd_val(x) & ~PAGE_MASK) != _PAGE_TABLE && (pgd_val(x) & ~PAGE_MASK) != (_PAGE_TABLE | _PAGE_GATEWAY))
+#else
 #define pgd_bad(x)      ((pgd_val(x) & ~PAGE_MASK) != _PAGE_TABLE)
+#endif
 #define pgd_present(x)  (pgd_val(x) & _PAGE_PRESENT)
-#define pgd_clear(xp)   do { pgd_val(*(xp)) = 0; } while (0)
+static inline void pgd_clear(pgd_t *pgd) {
+#ifdef __LP64__
+	if(pgd_val(*pgd) & _PAGE_GATEWAY)
+		/* This is the permanent pmd attached to the pgd; cannot
+		 * free it */
+		return;
+#endif
+	pgd_val(*pgd) = 0;
+}
 #else
 /*
  * The "pgd_xxx()" functions here are trivial for a folded two-level
@@ -337,7 +375,7 @@
 
 /* Find an entry in the second-level page table.. */
 
-#ifdef __LP64__
+#if PT_NLEVELS == 3
 #define pmd_offset(dir,address) \
 ((pmd_t *) pgd_page(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1)))
 #else
@@ -449,8 +487,6 @@
 }
 
 #define pte_same(A,B)	(pte_val(A) == pte_val(B))
-
-typedef pte_t *pte_addr_t;
 
 #endif /* !__ASSEMBLY__ */
 
diff -Nru a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
--- a/include/asm-parisc/processor.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-parisc/processor.h	Tue Jun 15 22:21:05 2004
@@ -52,11 +52,11 @@
 #ifndef __ASSEMBLY__
 
 /*
-** Data detected about CPUs at boot time which is the same for all CPU's.
-** HP boxes are SMP - ie identical processors.
-**
-** FIXME: some CPU rev info may be processor specific...
-*/
+ * Data detected about CPUs at boot time which is the same for all CPU's.
+ * HP boxes are SMP - ie identical processors.
+ *
+ * FIXME: some CPU rev info may be processor specific...
+ */
 struct system_cpuinfo_parisc {
 	unsigned int	cpu_count;
 	unsigned int	cpu_hz;
@@ -77,9 +77,7 @@
 };
 
 
-/*
-** Per CPU data structure - ie varies per CPU.
-*/
+/* Per CPU data structure - ie varies per CPU.  */
 struct cpuinfo_parisc {
 	unsigned long it_value;     /* Interval Timer at last timer Intr */
 	unsigned long it_delta;     /* Interval delta (tic_10ms / HZ * 100) */
@@ -116,6 +114,8 @@
 	int seg;  
 } mm_segment_t;
 
+#define ARCH_MIN_TASKALIGN	8
+
 struct thread_struct {
 	struct pt_regs regs;
 	unsigned long  task_size;
@@ -309,22 +309,31 @@
 
 extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm);
 
-static inline unsigned long get_wchan(struct task_struct *p)
-{
-	return 0xdeadbeef; /* XXX */
-}
+extern unsigned long get_wchan(struct task_struct *p);
 
 #define KSTK_EIP(tsk)	((tsk)->thread.regs.iaoq[0])
 #define KSTK_ESP(tsk)	((tsk)->thread.regs.gr[30])
 
-#ifdef  CONFIG_PA20
+
+/*
+ * PA 2.0 defines data prefetch instructions on page 6-11 of the Kane book.
+ * In addition, many implementations do hardware prefetching of both
+ * instructions and data.
+ *
+ * PA7300LC (page 14-4 of the ERS) also implements prefetching by a load
+ * to gr0 but not in a way that Linux can use.  If the load would cause an
+ * interruption (eg due to prefetching 0), it is suppressed on PA2.0
+ * processors, but not on 7300LC.
+ */
+#ifdef  CONFIG_PREFETCH
 #define ARCH_HAS_PREFETCH
+#define ARCH_HAS_PREFETCHW
+
 extern inline void prefetch(const void *addr)
 {
 	__asm__("ldw 0(%0), %%r0" : : "r" (addr));
 }
 
-#define ARCH_HAS_PREFETCHW
 extern inline void prefetchw(const void *addr)
 {
 	__asm__("ldd 0(%0), %%r0" : : "r" (addr));
diff -Nru a/include/asm-parisc/rmap.h b/include/asm-parisc/rmap.h
--- a/include/asm-parisc/rmap.h	Tue Jun 15 22:21:03 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _PARISC_RMAP_H
-#define _PARISC_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-parisc/smp.h b/include/asm-parisc/smp.h
--- a/include/asm-parisc/smp.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-parisc/smp.h	Tue Jun 15 22:20:43 2004
@@ -52,9 +52,7 @@
 extern unsigned long cpu_present_mask;
 
 #define smp_processor_id()	(current_thread_info()->cpu)
-#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
-
-#define cpu_possible_map	cpu_present_map
+#define cpu_online(cpu)		cpu_isset(cpu, cpu_online_map)
 
 #endif /* CONFIG_SMP */
 
diff -Nru a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h
--- a/include/asm-parisc/spinlock.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-parisc/spinlock.h	Tue Jun 15 22:20:39 2004
@@ -4,35 +4,43 @@
 #include <asm/system.h>
 
 /* Note that PA-RISC has to use `1' to mean unlocked and `0' to mean locked
- * since it only has load-and-zero.
+ * since it only has load-and-zero. Moreover, at least on some PA processors,
+ * the semaphore address has to be 16-byte aligned.
  */
 
 #undef SPIN_LOCK_UNLOCKED
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 }
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { { 1, 1, 1, 1 } }
 
-#define spin_lock_init(x)	do { (x)->lock = 1; } while(0)
+#define spin_lock_init(x)	do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
 
-#define spin_is_locked(x) ((x)->lock == 0)
-
-#define spin_unlock_wait(x)	do { barrier(); } while(((volatile spinlock_t *)(x))->lock == 0)
-
-#if 1
-#define _raw_spin_lock(x) do { \
-	while (__ldcw (&(x)->lock) == 0) \
-		while (((x)->lock) == 0) ; } while (0)
-
-#else
-#define _raw_spin_lock(x) \
-	do { while(__ldcw(&(x)->lock) == 0); } while(0)
-#endif
+static inline int spin_is_locked(spinlock_t *x)
+{
+	volatile unsigned int *a = __ldcw_align(x);
+	return *a == 0;
+}
+
+#define spin_unlock_wait(x)	do { barrier(); } while(spin_is_locked(x))
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
+
+static inline void _raw_spin_lock(spinlock_t *x)
+{
+	volatile unsigned int *a = __ldcw_align(x);
+	while (__ldcw(a) == 0)
+		while (*a == 0);
+}
+
+static inline void _raw_spin_unlock(spinlock_t *x)
+{
+	volatile unsigned int *a = __ldcw_align(x);
+	*a = 1;
+}
+
+static inline int _raw_spin_trylock(spinlock_t *x)
+{
+	volatile unsigned int *a = __ldcw_align(x);
+	return __ldcw(a) != 0;
+}
 	
-#define _raw_spin_unlock(x) \
-	do { (x)->lock = 1; } while(0)
-
-#define _raw_spin_trylock(x) (__ldcw(&(x)->lock) != 0)
-
-
-
 /*
  * Read-write spinlocks, allowing multiple readers
  * but only one writer.
@@ -42,7 +50,7 @@
 	volatile int counter;
 } rwlock_t;
 
-#define RW_LOCK_UNLOCKED (rwlock_t) { {1}, 0 }
+#define RW_LOCK_UNLOCKED (rwlock_t) { { { 1, 1, 1, 1 } }, 0 }
 
 #define rwlock_init(lp)	do { *(lp) = RW_LOCK_UNLOCKED; } while (0)
 
diff -Nru a/include/asm-parisc/system.h b/include/asm-parisc/system.h
--- a/include/asm-parisc/system.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-parisc/system.h	Tue Jun 15 22:20:41 2004
@@ -145,6 +145,19 @@
 	__ret; \
 })
 
+/* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data,
+   and GCC only guarantees 8-byte alignment for stack locals, we can't
+   be assured of 16-byte alignment for atomic lock data even if we
+   specify "__attribute ((aligned(16)))" in the type declaration.  So,
+   we use a struct containing an array of four ints for the atomic lock
+   type and dynamically select the 16-byte aligned int from the array
+   for the semaphore.  */
+#define __PA_LDCW_ALIGNMENT 16
+#define __ldcw_align(a) ({ \
+  unsigned long __ret = (unsigned long) a;                     		\
+  __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) & ~(__PA_LDCW_ALIGNMENT - 1); \
+  (volatile unsigned int *) __ret;                                      \
+})
 
 #ifdef CONFIG_SMP
 /*
@@ -152,8 +165,13 @@
  */
 
 typedef struct {
-	volatile unsigned int __attribute__((aligned(16))) lock;
+	volatile unsigned int lock[4];
 } spinlock_t;
+
+#define __lock_aligned __attribute__((__section__(".data.lock_aligned")))
+
 #endif
+
+#define KERNEL_START (0x10100000 - 0x1000)
 
 #endif
diff -Nru a/include/asm-parisc/types.h b/include/asm-parisc/types.h
--- a/include/asm-parisc/types.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-parisc/types.h	Tue Jun 15 22:20:37 2004
@@ -56,6 +56,8 @@
 typedef u32 dma_addr_t;
 typedef u64 dma64_addr_t;
 
+typedef unsigned int kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h
--- a/include/asm-parisc/unistd.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-parisc/unistd.h	Tue Jun 15 22:20:36 2004
@@ -700,124 +700,176 @@
 #define __NR_acl_set            (__NR_Linux + 205)
 #define __NR_gettid             (__NR_Linux + 206)
 #define __NR_readahead          (__NR_Linux + 207)
-#define __NR_tkill		(__NR_Linux + 208)
-#define __NR_sendfile64		(__NR_Linux + 209)
-#define __NR_futex		(__NR_Linux + 210)
-#define __NR_sched_setaffinity	(__NR_Linux + 211)
-#define __NR_sched_getaffinity	(__NR_Linux + 212)
-#define __NR_set_thread_area	(__NR_Linux + 213)
-#define __NR_get_thread_area	(__NR_Linux + 214)
-#define __NR_io_setup		(__NR_Linux + 215)
-#define __NR_io_destroy		(__NR_Linux + 216)
-#define __NR_io_getevents	(__NR_Linux + 217)
-#define __NR_io_submit		(__NR_Linux + 218)
-#define __NR_io_cancel		(__NR_Linux + 219)
-#define __NR_alloc_hugepages	(__NR_Linux + 220)
-#define __NR_free_hugepages	(__NR_Linux + 221)
-#define __NR_exit_group		(__NR_Linux + 222)
-#define __NR_lookup_dcookie	(__NR_Linux + 223)
-#define __NR_epoll_create	(__NR_Linux + 224)
-#define __NR_epoll_ctl		(__NR_Linux + 225)
-#define __NR_epoll_wait		(__NR_Linux + 226)
-#define __NR_remap_file_pages	(__NR_Linux + 227)
-#define __NR_semtimedop		(__NR_Linux + 228)
+#define __NR_tkill              (__NR_Linux + 208)
+#define __NR_sendfile64         (__NR_Linux + 209)
+#define __NR_futex              (__NR_Linux + 210)
+#define __NR_sched_setaffinity  (__NR_Linux + 211)
+#define __NR_sched_getaffinity  (__NR_Linux + 212)
+#define __NR_set_thread_area    (__NR_Linux + 213)
+#define __NR_get_thread_area    (__NR_Linux + 214)
+#define __NR_io_setup           (__NR_Linux + 215)
+#define __NR_io_destroy         (__NR_Linux + 216)
+#define __NR_io_getevents       (__NR_Linux + 217)
+#define __NR_io_submit          (__NR_Linux + 218)
+#define __NR_io_cancel          (__NR_Linux + 219)
+#define __NR_alloc_hugepages    (__NR_Linux + 220)
+#define __NR_free_hugepages     (__NR_Linux + 221)
+#define __NR_exit_group         (__NR_Linux + 222)
+#define __NR_lookup_dcookie     (__NR_Linux + 223)
+#define __NR_epoll_create       (__NR_Linux + 224)
+#define __NR_epoll_ctl          (__NR_Linux + 225)
+#define __NR_epoll_wait         (__NR_Linux + 226)
+#define __NR_remap_file_pages   (__NR_Linux + 227)
+#define __NR_semtimedop         (__NR_Linux + 228)
+#define __NR_mq_open            (__NR_Linux + 229) /* Keep the mq_* syscalls together */
+#define __NR_mq_unlink          (__NR_Linux + 230)
+#define __NR_mq_timedsend       (__NR_Linux + 231)
+#define __NR_mq_timedreceive    (__NR_Linux + 232)
+#define __NR_mq_notify          (__NR_Linux + 233)
+#define __NR_mq_getsetattr      (__NR_Linux + 234)
 
-
-#define __NR_Linux_syscalls     228
+#define __NR_Linux_syscalls     235
 
 #define HPUX_GATEWAY_ADDR       0xC0000004
 #define LINUX_GATEWAY_ADDR      0x100
 
 #ifndef __ASSEMBLY__
 
-/* The old syscall code here didn't work, and it looks like it's only used
- * by applications such as fdisk which for some reason need to produce
- * their own syscall instead of using same from libc.  The code below
- * is leveraged from glibc/sysdeps/unix/sysv/linux/hppa/sysdep.h where
- * it is essentially duplicated -- which sucks.  -PB
- */
-
 #define SYS_ify(syscall_name)   __NR_##syscall_name
 
-/* The system call number MUST ALWAYS be loaded in the delay slot of
-   the ble instruction, or restarting system calls WILL NOT WORK.  See
-   arch/parisc/kernel/signal.c - dhd, 2000-07-26 */
-#define K_INLINE_SYSCALL(name, nr, args...)       ({              \
-        unsigned long __sys_res;                                \
-        {                                                       \
-                register unsigned long __res asm("r28");        \
-                K_LOAD_ARGS_##nr(args)                            \
-                asm volatile(                                   \
-			"ble  0x100(%%sr2, %%r0)\n\t"           \
-                        " ldi %1, %%r20"                        \
-                        : "=r" (__res)                          \
-                        : "i" (SYS_ify(name)) K_ASM_ARGS_##nr   \
-			  );                                    \
-                __sys_res = __res;                              \
-        }                                                       \
-        if (__sys_res >= (unsigned long)-4095) {                \
-		errno = -__sys_res;				\
-                __sys_res = (unsigned long)-1;                 \
-        }                                                       \
-        __sys_res;                                              \
+/* Assume all syscalls are done from PIC code just to be
+ * safe. The worst case scenario is that you lose a register
+ * and save/restore r19 across the syscall. */
+#define PIC
+
+#ifndef ASM_LINE_SEP
+# define ASM_LINE_SEP ;
+#endif
+
+/* Definition taken from glibc 2.3.3
+ * sysdeps/unix/sysv/linux/hppa/sysdep.h
+ */
+
+#ifdef PIC
+/* WARNING: CANNOT BE USED IN A NOP! */
+# define K_STW_PIC stw %r19, -32(%sr0, %sp) ASM_LINE_SEP
+# define K_LDW_PIC ldw -32(%sr0, %sp), %r19 ASM_LINE_SEP
+# define K_STW_ASM_PIC	"       copy %%r19, %%r4\n"
+# define K_LDW_ASM_PIC	"       copy %%r4, %%r19\n"
+# define K_USING_GR4	"%r4",
+#else
+# define K_STW_PIC ASM_LINE_SEP
+# define K_LDW_PIC ASM_LINE_SEP
+# define K_STW_ASM_PIC	" \n"
+# define K_LDW_ASM_PIC	" \n"
+# define K_USING_GR4
+#endif
+
+/* GCC has to be warned that a syscall may clobber all the ABI
+   registers listed as "caller-saves", see page 8, Table 2
+   in section 2.2.6 of the PA-RISC RUN-TIME architecture
+   document. However! r28 is the result and will conflict with
+   the clobber list so it is left out. Also the input arguments
+   registers r20 -> r26 will conflict with the list so they
+   are treated specially. Although r19 is clobbered by the syscall
+   we cannot say this because it would violate ABI, thus we say
+   r4 is clobbered and use that register to save/restore r19
+   across the syscall. */
+
+#define K_CALL_CLOB_REGS "%r1", "%r2", K_USING_GR4 \
+	        	 "%r20", "%r29", "%r31"
+
+#undef K_INLINE_SYSCALL
+#define K_INLINE_SYSCALL(name, nr, args...)	({			\
+	long __sys_res;							\
+	{								\
+		register unsigned long __res asm("r28");		\
+		K_LOAD_ARGS_##nr(args)					\
+		/* FIXME: HACK stw/ldw r19 around syscall */		\
+		asm volatile(						\
+			K_STW_ASM_PIC					\
+			"	ble  0x100(%%sr2, %%r0)\n"		\
+			"	ldi %1, %%r20\n"			\
+			K_LDW_ASM_PIC					\
+			: "=r" (__res)					\
+			: "i" (SYS_ify(name)) K_ASM_ARGS_##nr   	\
+			: K_CALL_CLOB_REGS K_CLOB_ARGS_##nr		\
+		);							\
+		__sys_res = (long)__res;				\
+	}								\
+	if ( (unsigned long)__sys_res >= (unsigned long)-4095 ){	\
+		errno = -__sys_res);		        		\
+		__sys_res = -1;						\
+	}								\
+	__sys_res;							\
 })
 
 #define K_LOAD_ARGS_0()
-#define K_LOAD_ARGS_1(r26)                                        \
-        register unsigned long __r26 __asm__("r26") = (unsigned long)r26;       \
-        K_LOAD_ARGS_0()
-#define K_LOAD_ARGS_2(r26,r25)                                    \
-        register unsigned long __r25 __asm__("r25") = (unsigned long)r25;       \
-        K_LOAD_ARGS_1(r26)
-#define K_LOAD_ARGS_3(r26,r25,r24)                                \
-        register unsigned long __r24 __asm__("r24") = (unsigned long)r24;       \
-        K_LOAD_ARGS_2(r26,r25)
-#define K_LOAD_ARGS_4(r26,r25,r24,r23)                            \
-        register unsigned long __r23 __asm__("r23") = (unsigned long)r23;       \
-        K_LOAD_ARGS_3(r26,r25,r24)
-#define K_LOAD_ARGS_5(r26,r25,r24,r23,r22)                        \
-        register unsigned long __r22 __asm__("r22") = (unsigned long)r22;       \
-        K_LOAD_ARGS_4(r26,r25,r24,r23)
-#define K_LOAD_ARGS_6(r26,r25,r24,r23,r22,r21)                    \
-        register unsigned long __r21 __asm__("r21") = (unsigned long)r21;       \
-        K_LOAD_ARGS_5(r26,r25,r24,r23,r22)
+#define K_LOAD_ARGS_1(r26)					\
+	register unsigned long __r26 __asm__("r26") = (unsigned long)(r26);   \
+	K_LOAD_ARGS_0()
+#define K_LOAD_ARGS_2(r26,r25)					\
+	register unsigned long __r25 __asm__("r25") = (unsigned long)(r25);   \
+	K_LOAD_ARGS_1(r26)
+#define K_LOAD_ARGS_3(r26,r25,r24)				\
+	register unsigned long __r24 __asm__("r24") = (unsigned long)(r24);   \
+	K_LOAD_ARGS_2(r26,r25)
+#define K_LOAD_ARGS_4(r26,r25,r24,r23)				\
+	register unsigned long __r23 __asm__("r23") = (unsigned long)(r23);   \
+	K_LOAD_ARGS_3(r26,r25,r24)
+#define K_LOAD_ARGS_5(r26,r25,r24,r23,r22)			\
+	register unsigned long __r22 __asm__("r22") = (unsigned long)(r22);   \
+	K_LOAD_ARGS_4(r26,r25,r24,r23)
+#define K_LOAD_ARGS_6(r26,r25,r24,r23,r22,r21)			\
+	register unsigned long __r21 __asm__("r21") = (unsigned long)(r21);   \
+	K_LOAD_ARGS_5(r26,r25,r24,r23,r22)
 
+/* Even with zero args we use r20 for the syscall number */
 #define K_ASM_ARGS_0
-#define K_ASM_ARGS_1 , "r" (__r26)
-#define K_ASM_ARGS_2 , "r" (__r26), "r" (__r25)
-#define K_ASM_ARGS_3 , "r" (__r26), "r" (__r25), "r" (__r24)
-#define K_ASM_ARGS_4 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23)
-#define K_ASM_ARGS_5 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23), "r" (__r22)
-#define K_ASM_ARGS_6 , "r" (__r26), "r" (__r25), "r" (__r24), "r" (__r23), "r" (__r22), "r" (__r21)
+#define K_ASM_ARGS_1 K_ASM_ARGS_0, "r" (__r26)
+#define K_ASM_ARGS_2 K_ASM_ARGS_1, "r" (__r25)
+#define K_ASM_ARGS_3 K_ASM_ARGS_2, "r" (__r24)
+#define K_ASM_ARGS_4 K_ASM_ARGS_3, "r" (__r23)
+#define K_ASM_ARGS_5 K_ASM_ARGS_4, "r" (__r22)
+#define K_ASM_ARGS_6 K_ASM_ARGS_5, "r" (__r21)
+
+/* The registers not listed as inputs but clobbered */
+#define K_CLOB_ARGS_6
+#define K_CLOB_ARGS_5 K_CLOB_ARGS_6, "%r21"
+#define K_CLOB_ARGS_4 K_CLOB_ARGS_5, "%r22"
+#define K_CLOB_ARGS_3 K_CLOB_ARGS_4, "%r23"
+#define K_CLOB_ARGS_2 K_CLOB_ARGS_3, "%r24"
+#define K_CLOB_ARGS_1 K_CLOB_ARGS_2, "%r25"
+#define K_CLOB_ARGS_0 K_CLOB_ARGS_1, "%r26"
 
-#define _syscall0(type,name)						      \
-type name(void)								      \
-{									      \
-    return K_INLINE_SYSCALL(name, 0);	\
+#define _syscall0(type,name)						\
+type name(void)								\
+{									\
+    return K_INLINE_SYSCALL(name, 0);	                                \
 }
 
-#define _syscall1(type,name,type1,arg1)					      \
-type name(type1 arg1)							      \
-{									      \
-    return K_INLINE_SYSCALL(name, 1, arg1);	\
+#define _syscall1(type,name,type1,arg1)					\
+type name(type1 arg1)							\
+{									\
+    return K_INLINE_SYSCALL(name, 1, arg1);	                        \
 }
 
-#define _syscall2(type,name,type1,arg1,type2,arg2)			      \
-type name(type1 arg1, type2 arg2)					      \
-{									      \
-    return K_INLINE_SYSCALL(name, 2, arg1, arg2);	\
+#define _syscall2(type,name,type1,arg1,type2,arg2)			\
+type name(type1 arg1, type2 arg2)					\
+{									\
+    return K_INLINE_SYSCALL(name, 2, arg1, arg2);	                \
 }
 
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)		      \
-type name(type1 arg1, type2 arg2, type3 arg3)				      \
-{									      \
-    return K_INLINE_SYSCALL(name, 3, arg1, arg2, arg3);	\
+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)		\
+type name(type1 arg1, type2 arg2, type3 arg3)				\
+{									\
+    return K_INLINE_SYSCALL(name, 3, arg1, arg2, arg3);	                \
 }
 
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)      \
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4)		      \
-{									      \
-    return K_INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4);	\
+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
+type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4)		\
+{									\
+    return K_INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4);	        \
 }
 
 /* select takes 5 arguments */
@@ -827,15 +879,35 @@
     return K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5);	\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
 
 /* mmap & mmap2 take 6 arguments */
-
 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
-{									\
+{									        \
     return K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6);	\
 }
-
 
 #ifdef __KERNEL_SYSCALLS__
 
diff -Nru a/include/asm-parisc/unwind.h b/include/asm-parisc/unwind.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-parisc/unwind.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,72 @@
+#ifndef _UNWIND_H_
+#define _UNWIND_H_
+
+/* From ABI specifications */
+struct unwind_table_entry {
+	unsigned int region_start;
+	unsigned int region_end;
+	unsigned int Cannot_unwind:1; /* 0 */
+	unsigned int Millicode:1;	/* 1 */
+	unsigned int Millicode_save_sr0:1;	/* 2 */
+	unsigned int Region_description:2;	/* 3..4 */
+	unsigned int reserved1:1;	/* 5 */
+	unsigned int Entry_SR:1;	/* 6 */
+	unsigned int Entry_FR:4;	/* number saved *//* 7..10 */
+	unsigned int Entry_GR:5;	/* number saved *//* 11..15 */
+	unsigned int Args_stored:1;	/* 16 */
+	unsigned int Variable_Frame:1;	/* 17 */
+	unsigned int Separate_Package_Body:1;	/* 18 */
+	unsigned int Frame_Extension_Millicode:1;	/* 19 */
+	unsigned int Stack_Overflow_Check:1;	/* 20 */
+	unsigned int Two_Instruction_SP_Increment:1;	/* 21 */
+	unsigned int Ada_Region:1;	/* 22 */
+	unsigned int cxx_info:1;	/* 23 */
+	unsigned int cxx_try_catch:1;	/* 24 */
+	unsigned int sched_entry_seq:1;	/* 25 */
+	unsigned int reserved2:1;	/* 26 */
+	unsigned int Save_SP:1;	/* 27 */
+	unsigned int Save_RP:1;	/* 28 */
+	unsigned int Save_MRP_in_frame:1;	/* 29 */
+	unsigned int extn_ptr_defined:1;	/* 30 */
+	unsigned int Cleanup_defined:1;	/* 31 */
+	
+	unsigned int MPE_XL_interrupt_marker:1;	/* 0 */
+	unsigned int HP_UX_interrupt_marker:1;	/* 1 */
+	unsigned int Large_frame:1;	/* 2 */
+	unsigned int Pseudo_SP_Set:1;	/* 3 */
+	unsigned int reserved4:1;	/* 4 */
+	unsigned int Total_frame_size:27;	/* 5..31 */
+};
+
+struct unwind_table {
+	struct unwind_table *next;
+	const char *name;
+	unsigned long gp;
+	unsigned long base_addr;
+	unsigned long start;
+	unsigned long end;
+	const struct unwind_table_entry *table;
+	unsigned long length;
+};
+
+struct unwind_frame_info {
+	unsigned long sp;
+	unsigned long ip;
+	struct task_struct *t;
+	/* Eventually we would like to be able to get at any of the registers
+	   available; but for now we only try to get the sp and ip for each
+	   frame */
+	/* struct pt_regs regs; */
+	unsigned long prev_sp, prev_ip;
+};
+
+void * unwind_table_add(const char *name, unsigned long base_addr, 
+		 unsigned long gp,
+                 const void *start, const void *end);
+void unwind_frame_init(struct unwind_frame_info *info, struct task_struct *t, 
+		       struct pt_regs *regs);
+void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct task_struct *t);
+int unwind_once(struct unwind_frame_info *info);
+int unwind_to_user(struct unwind_frame_info *info);
+
+#endif
diff -Nru a/include/asm-ppc/atomic.h b/include/asm-ppc/atomic.h
--- a/include/asm-ppc/atomic.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-ppc/atomic.h	Tue Jun 15 22:20:38 2004
@@ -134,6 +134,16 @@
 	return t;
 }
 
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
+
 static __inline__ void atomic_dec(atomic_t *v)
 {
 	int t;
diff -Nru a/include/asm-ppc/bug.h b/include/asm-ppc/bug.h
--- a/include/asm-ppc/bug.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc/bug.h	Tue Jun 15 22:20:43 2004
@@ -23,26 +23,30 @@
 		: : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
 } while (0)
 
-#define BUG_ON(x) do {						\
-	__asm__ __volatile__(					\
-		"1:	twnei %0,0\n"				\
-		".section __bug_table,\"a\"\n\t"		\
-		"	.long 1b,%1,%2,%3\n"			\
-		".previous"					\
-		: : "r" (x), "i" (__LINE__), "i" (__FILE__),	\
-		    "i" (__FUNCTION__));			\
+#define BUG_ON(x) do {							\
+	if (!__builtin_constant_p(x) || (x)) {				\
+		__asm__ __volatile__(					\
+			"1:	twnei %0,0\n"				\
+			".section __bug_table,\"a\"\n\t"		\
+			"	.long 1b,%1,%2,%3\n"			\
+			".previous"					\
+			: : "r" (x), "i" (__LINE__), "i" (__FILE__),	\
+			    "i" (__FUNCTION__));			\
+	}								\
 } while (0)
 
-#define PAGE_BUG(page) do { BUG(); } while (0)
+#define PAGE_BUG(page)	BUG()
 
-#define WARN_ON(x) do {						\
-	__asm__ __volatile__(					\
-		"1:	twnei %0,0\n"				\
-		".section __bug_table,\"a\"\n\t"		\
-		"	.long 1b,%1,%2,%3\n"			\
-		".previous"					\
-		: : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP),	\
-		    "i" (__FILE__), "i" (__FUNCTION__));	\
+#define WARN_ON(x) do {							\
+	if (!__builtin_constant_p(x) || (x)) {				\
+		__asm__ __volatile__(					\
+			"1:	twnei %0,0\n"				\
+			".section __bug_table,\"a\"\n\t"		\
+			"	.long 1b,%1,%2,%3\n"			\
+			".previous"					\
+			: : "r" (x), "i" (__LINE__ + BUG_WARNING_TRAP),	\
+			    "i" (__FILE__), "i" (__FUNCTION__));	\
+	}								\
 } while (0)
 
 #endif
diff -Nru a/include/asm-ppc/cacheflush.h b/include/asm-ppc/cacheflush.h
--- a/include/asm-ppc/cacheflush.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc/cacheflush.h	Tue Jun 15 22:20:43 2004
@@ -28,6 +28,9 @@
 #define flush_cache_vunmap(start, end)	do { } while (0)
 
 extern void flush_dcache_page(struct page *page);
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
+
 extern void flush_icache_range(unsigned long, unsigned long);
 extern void flush_icache_user_range(struct vm_area_struct *vma,
 		struct page *page, unsigned long addr, int len);
@@ -41,6 +44,6 @@
 
 extern void __flush_dcache_icache(void *page_va);
 extern void __flush_dcache_icache_phys(unsigned long physaddr);
-
+extern void flush_dcache_icache_page(struct page *page);
 #endif /* _PPC_CACHEFLUSH_H */
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-ppc/dma-mapping.h b/include/asm-ppc/dma-mapping.h
--- a/include/asm-ppc/dma-mapping.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc/dma-mapping.h	Tue Jun 15 22:20:43 2004
@@ -6,15 +6,48 @@
 #define __ASM_PPC_DMA_MAPPING_H
 
 #include <linux/config.h>
-/* we implement the API below in terms of the existing PCI one,
- * so include it */
-#include <linux/pci.h>
 /* need struct page definitions */
 #include <linux/mm.h>
 #include <linux/device.h>
 #include <asm/scatterlist.h>
 #include <asm/io.h>
 
+#ifdef CONFIG_NOT_COHERENT_CACHE
+/*
+ * DMA-consistent mapping functions for PowerPCs that don't support
+ * cache snooping.  These allocate/free a region of uncached mapped
+ * memory space for use with DMA devices.  Alternatively, you could
+ * allocate the space "normally" and use the cache management functions
+ * to ensure it is consistent.
+ */
+extern void *__dma_alloc_coherent(size_t size, dma_addr_t *handle, int gfp);
+extern void __dma_free_coherent(size_t size, void *vaddr);
+extern void __dma_sync(void *vaddr, size_t size, int direction);
+extern void __dma_sync_page(struct page *page, unsigned long offset,
+				 size_t size, int direction);
+#define dma_cache_inv(_start,_size) \
+	invalidate_dcache_range(_start, (_start + _size))
+#define dma_cache_wback(_start,_size) \
+	clean_dcache_range(_start, (_start + _size))
+#define dma_cache_wback_inv(_start,_size) \
+	flush_dcache_range(_start, (_start + _size))
+
+#else /* ! CONFIG_NOT_COHERENT_CACHE */
+/*
+ * Cache coherent cores.
+ */
+
+#define dma_cache_inv(_start,_size)		do { } while (0)
+#define dma_cache_wback(_start,_size)		do { } while (0)
+#define dma_cache_wback_inv(_start,_size)	do { } while (0)
+
+#define __dma_alloc_coherent(gfp, size, handle)	NULL
+#define __dma_free_coherent(size, addr)		do { } while (0)
+#define __dma_sync(addr, size, rw)		do { } while (0)
+#define __dma_sync_page(pg, off, sz, rw)	do { } while (0)
+
+#endif /* ! CONFIG_NOT_COHERENT_CACHE */
+
 #define dma_supported(dev, mask)	(1)
 
 static inline int dma_set_mask(struct device *dev, u64 dma_mask)
@@ -28,28 +61,38 @@
 }
 
 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t * dma_handle, int flag)
+				       dma_addr_t * dma_handle, int gfp)
 {
-#ifdef CONFIG_PCI
-	if (dev && dev->bus == &pci_bus_type)
-		return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
-#endif
+#ifdef CONFIG_NOT_COHERENT_CACHE
+	return __dma_alloc_coherent(size, dma_handle, gfp);
+#else
+	void *ret;
+	/* ignore region specifiers */
+	gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
+
+	if (dev == NULL || dev->coherent_dma_mask < 0xffffffff)
+		gfp |= GFP_DMA;
+
+	ret = (void *)__get_free_pages(gfp, get_order(size));
+
+	if (ret != NULL) {
+		memset(ret, 0, size);
+		*dma_handle = virt_to_bus(ret);
+	}
 
-	return consistent_alloc(flag, size, dma_handle);
+	return ret;
+#endif
 }
 
 static inline void
 dma_free_coherent(struct device *dev, size_t size, void *vaddr,
 		  dma_addr_t dma_handle)
 {
-#ifdef CONFIG_PCI
-	if (dev && dev->bus == &pci_bus_type) {
-		pci_free_consistent(to_pci_dev(dev), size, vaddr, dma_handle);
-		return;
-	}
+#ifdef CONFIG_NOT_COHERENT_CACHE
+	__dma_free_coherent(size, vaddr);
+#else
+	free_pages((unsigned long)vaddr, get_order(size));
 #endif
-
-	consistent_free(vaddr);
 }
 
 static inline dma_addr_t
@@ -58,7 +101,7 @@
 {
 	BUG_ON(direction == DMA_NONE);
 
-	consistent_sync(ptr, size, direction);
+	__dma_sync(ptr, size, direction);
 
 	return virt_to_bus(ptr);
 }
@@ -72,12 +115,14 @@
 	     enum dma_data_direction direction)
 {
 	BUG_ON(direction == DMA_NONE);
-	consistent_sync_page(page, offset, size, direction);
+
+	__dma_sync_page(page, offset, size, direction);
+
 	return (page - mem_map) * PAGE_SIZE + PCI_DRAM_OFFSET + offset;
 }
 
 /* We do nothing. */
-#define dma_unmap_page(dev, addr, size, dir)	do { } while (0)
+#define dma_unmap_page(dev, handle, size, dir)	do { } while (0)
 
 static inline int
 dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
@@ -89,8 +134,7 @@
 
 	for (i = 0; i < nents; i++, sg++) {
 		BUG_ON(!sg->page);
-		consistent_sync_page(sg->page, sg->offset,
-				     sg->length, direction);
+		__dma_sync_page(sg->page, sg->offset, sg->length, direction);
 		sg->dma_address = page_to_bus(sg->page) + sg->offset;
 	}
 
@@ -107,50 +151,50 @@
 {
 	BUG_ON(direction == DMA_NONE);
 
-	consistent_sync(bus_to_virt(dma_handle), size, direction);
+	__dma_sync(bus_to_virt(dma_handle), size, direction);
 }
 
 static inline void
 dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
-			   size_t size,
-			   enum dma_data_direction direction)
+			size_t size,
+			enum dma_data_direction direction)
 {
 	BUG_ON(direction == DMA_NONE);
 
-	consistent_sync(bus_to_virt(dma_handle), size, direction);
+	__dma_sync(bus_to_virt(dma_handle), size, direction);
 }
 
 static inline void
-dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
-		    int nelems, enum dma_data_direction direction)
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
+		    enum dma_data_direction direction)
 {
 	int i;
 
 	BUG_ON(direction == DMA_NONE);
 
-	for (i = 0; i < nelems; i++, sg++)
-		consistent_sync_page(sg->page, sg->offset,
-				     sg->length, direction);
+	for (i = 0; i < nents; i++, sg++)
+		__dma_sync_page(sg->page, sg->offset, sg->length, direction);
 }
 
 static inline void
-dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-		       int nelems, enum dma_data_direction direction)
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
+		    enum dma_data_direction direction)
 {
 	int i;
 
 	BUG_ON(direction == DMA_NONE);
 
-	for (i = 0; i < nelems; i++, sg++)
-		consistent_sync_page(sg->page, sg->offset,
-				     sg->length, direction);
+	for (i = 0; i < nents; i++, sg++)
+		__dma_sync_page(sg->page, sg->offset, sg->length, direction);
 }
 
-/* Now for the API extensions over the pci_ one */
-
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
+#ifdef CONFIG_NOT_COHERENT_CACHE
+#define dma_is_consistent(d)	(0)
+#else
 #define dma_is_consistent(d)	(1)
+#endif
 
 static inline int dma_get_cache_alignment(void)
 {
@@ -163,26 +207,26 @@
 
 static inline void
 dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
-			      unsigned long offset, size_t size,
-			      enum dma_data_direction direction)
+		      	      unsigned long offset, size_t size,
+		      	      enum dma_data_direction direction)
 {
-	/* just sync everything, that's all the pci API can do */
+	/* just sync everything for now */
 	dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
 }
 
 static inline void
 dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
-				 unsigned long offset, size_t size,
+		    		 unsigned long offset, size_t size,
 				 enum dma_data_direction direction)
 {
-	/* just sync everything, that's all the pci API can do */
+	/* just sync everything for now */
 	dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
 }
 
 static inline void dma_cache_sync(void *vaddr, size_t size,
 				  enum dma_data_direction direction)
 {
-	consistent_sync(vaddr, size, (int)direction);
+	__dma_sync(vaddr, size, (int)direction);
 }
 
 static inline int dma_mapping_error(dma_addr_t dma_addr)
diff -Nru a/include/asm-ppc/hardirq.h b/include/asm-ppc/hardirq.h
--- a/include/asm-ppc/hardirq.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-ppc/hardirq.h	Tue Jun 15 22:20:35 2004
@@ -83,11 +83,15 @@
 
 #ifdef CONFIG_PREEMPT
 # define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
+# define preemptible()	(preempt_count() == 0 && !irqs_disabled())
 # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
+
 #else
 # define in_atomic()	(preempt_count() != 0)
+# define preemptible()	0
 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
 #endif
+
 #define irq_exit()							\
 do {									\
 	preempt_count() -= IRQ_EXIT_OFFSET;				\
diff -Nru a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h
--- a/include/asm-ppc/ibm44x.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-ppc/ibm44x.h	Tue Jun 15 22:20:44 2004
@@ -19,25 +19,6 @@
 
 #include <linux/config.h>
 
-#ifndef __ASSEMBLY__
-/*
- * Data structure defining board information maintained by the boot
- * ROM on IBM's "Ebony" evaluation board. An effort has been made to
- * keep the field names consistent with the 8xx 'bd_t' board info
- * structures.
- *
- * Ebony firmware stores MAC addresses in the F/W VPD area. The
- * firmware must store the other dynamic values in NVRAM like on
- * the previous 40x systems so they  should be accessible if we
- * really want them.
- */
-typedef struct board_info {
-	unsigned char	bi_enetaddr[2][6];	/* EMAC addresses */
-	unsigned int	bi_opb_busfreq;		/* OPB clock in Hz */
-	int		bi_iic_fast[2];		/* Use fast i2c mode */
-} bd_t;
-#endif /* __ASSEMBLY__ */
-
 #ifndef NR_BOARD_IRQS
 #define NR_BOARD_IRQS 0
 #endif
@@ -87,11 +68,35 @@
  */
 
 #ifdef CONFIG_440GX
+/* CPRs */
+#define DCRN_CPR_CONFIG_ADDR	0xc
+#define DCRN_CPR_CONFIG_DATA	0xd
+
+#define DCRN_CPR_CLKUPD		0x0020
+#define DCRN_CPR_PLLC		0x0040
+#define DCRN_CPR_PLLD		0x0060
+#define DCRN_CPR_PRIMAD		0x0080
+#define DCRN_CPR_PRIMBD		0x00a0
+#define DCRN_CPR_OPBD		0x00c0
+#define DCRN_CPR_PERD		0x00e0
+#define DCRN_CPR_MALD		0x0100
+
+/* CPRs read/write helper macros */
+#define CPR_READ(offset) ({\
+	mtdcr(DCRN_CPR_CONFIG_ADDR, offset); \
+	mfdcr(DCRN_CPR_CONFIG_DATA);})
+#define CPR_WRITE(offset, data) ({\
+	mtdcr(DCRN_CPR_CONFIG_ADDR, offset); \
+	mtdcr(DCRN_CPR_CONFIG_DATA, data);})
+
 /* SDRs */
 #define DCRN_SDR_CONFIG_ADDR 	0xe
 #define DCRN_SDR_CONFIG_DATA	0xf
 #define DCRN_SDR_PFC0		0x4100
 #define DCRN_SDR_PFC1		0x4101
+#define DCRN_SDR_PFC1_EPS	0x1c000000
+#define DCRN_SDR_PFC1_EPS_SHIFT	26
+#define DCRN_SDR_PFC1_RMII	0x02000000
 #define DCRN_SDR_MFR		0x4300
 #define DCRN_SDR_MFR_TAH0 	0x80000000  	/* TAHOE0 Enable */
 #define DCRN_SDR_MFR_TAH1 	0x40000000  	/* TAHOE1 Enable */
@@ -117,6 +122,8 @@
 #define DCRN_SDR_MFR_E3TXFH	0x00000004
 #define DCRN_SDR_MFR_E3RXFL	0x00000002
 #define DCRN_SDR_MFR_E3RXFH	0x00000001
+#define DCRN_SDR_UART0		0x0120
+#define DCRN_SDR_UART1		0x0121
 
 /* SDR read/write helper macros */
 #define SDR_READ(offset) ({\
@@ -139,8 +146,12 @@
 /* UIC */
 #define DCRN_UIC0_BASE	0xc0
 #define DCRN_UIC1_BASE	0xd0
+#define DCRN_UIC2_BASE	0x210
+#define DCRN_UICB_BASE	0x200
 #define UIC0		DCRN_UIC0_BASE
 #define UIC1		DCRN_UIC1_BASE
+#define UIC2		DCRN_UIC2_BASE
+#define UICB		DCRN_UICB_BASE
 
 #define DCRN_UIC_SR(base)       (base + 0x0)
 #define DCRN_UIC_ER(base)       (base + 0x2)
@@ -151,8 +162,12 @@
 #define DCRN_UIC_VR(base)       (base + 0x7)
 #define DCRN_UIC_VCR(base)      (base + 0x8)
 
-#define UIC0_UIC1NC      30	/* UIC1 non-critical interrupt */
-#define UIC0_UIC1CR      31	/* UIC1 critical interrupt */
+#define UIC0_UIC1NC		30	/* UIC1 non-critical interrupt */
+#define UIC0_UIC1CR      	31	/* UIC1 critical interrupt */
+
+#define UICB_UIC0NC		0x40000000
+#define UICB_UIC1NC		0x10000000
+#define UICB_UIC2NC		0x04000000
 
 /* 440GP MAL DCRs */
 #define DCRN_MALCR(base)		(base + 0x0)	/* Configuration */
@@ -327,6 +342,81 @@
 #define PPC44x_MEM_SIZE_256M		0x10000000
 #define PPC44x_MEM_SIZE_512M		0x20000000
 
+#ifdef CONFIG_440GX
+/* Internal SRAM Controller */
+#define DCRN_SRAM0_SB0CR	0x020
+#define DCRN_SRAM0_SB1CR	0x021
+#define DCRN_SRAM0_SB2CR	0x022
+#define DCRN_SRAM0_SB3CR	0x023
+#define  SRAM_SBCR_BAS0		0x80000000
+#define  SRAM_SBCR_BAS1		0x80010000
+#define  SRAM_SBCR_BAS2		0x80020000
+#define  SRAM_SBCR_BAS3		0x80030000
+#define  SRAM_SBCR_BU_MASK	0x00000180
+#define  SRAM_SBCR_BS_64KB	0x00000800
+#define  SRAM_SBCR_BU_RO	0x00000080
+#define  SRAM_SBCR_BU_RW	0x00000180
+#define DCRN_SRAM0_BEAR		0x024
+#define DCRN_SRAM0_BESR0	0x025
+#define DCRN_SRAM0_BESR1	0x026
+#define DCRN_SRAM0_PMEG		0x027
+#define DCRN_SRAM0_CID		0x028
+#define DCRN_SRAM0_REVID	0x029
+#define DCRN_SRAM0_DPC		0x02a
+#define  SRAM_DPC_ENABLE	0x80000000
+
+/* L2 Cache Controller */
+#define DCRN_L2C0_CFG		0x030
+#define  L2C_CFG_L2M		0x80000000
+#define  L2C_CFG_ICU		0x40000000
+#define  L2C_CFG_DCU		0x20000000
+#define  L2C_CFG_DCW_MASK	0x1e000000
+#define  L2C_CFG_TPC		0x01000000
+#define  L2C_CFG_CPC		0x00800000
+#define  L2C_CFG_FRAN		0x00200000
+#define  L2C_CFG_SS_MASK	0x00180000
+#define  L2C_CFG_SS_256		0x00000000
+#define  L2C_CFG_CPIM		0x00040000
+#define  L2C_CFG_TPIM		0x00020000
+#define  L2C_CFG_LIM		0x00010000
+#define  L2C_CFG_PMUX_MASK	0x00007000
+#define  L2C_CFG_PMUX_SNP	0x00000000
+#define  L2C_CFG_PMUX_IF	0x00001000
+#define  L2C_CFG_PMUX_DF	0x00002000
+#define  L2C_CFG_PMUX_DS	0x00003000
+#define  L2C_CFG_PMIM		0x00000800
+#define  L2C_CFG_TPEI		0x00000400
+#define  L2C_CFG_CPEI		0x00000200
+#define  L2C_CFG_NAM		0x00000100
+#define  L2C_CFG_SMCM		0x00000080
+#define  L2C_CFG_NBRM		0x00000040
+#define DCRN_L2C0_CMD		0x031
+#define  L2C_CMD_CLR		0x80000000
+#define  L2C_CMD_DIAG		0x40000000
+#define  L2C_CMD_INV		0x20000000
+#define  L2C_CMD_CCP		0x10000000
+#define  L2C_CMD_CTE		0x08000000
+#define  L2C_CMD_STRC		0x04000000
+#define  L2C_CMD_STPC		0x02000000
+#define  L2C_CMD_RPMC		0x01000000
+#define  L2C_CMD_HCC		0x00800000
+#define DCRN_L2C0_ADDR		0x032
+#define DCRN_L2C0_DATA		0x033
+#define DCRN_L2C0_SR		0x034
+#define  L2C_SR_CC		0x80000000
+#define  L2C_SR_CPE		0x40000000
+#define  L2C_SR_TPE		0x20000000
+#define  L2C_SR_LRU		0x10000000
+#define  L2C_SR_PCS		0x08000000
+#define DCRN_L2C0_REVID		0x035
+#define DCRN_L2C0_SNP0		0x036
+#define DCRN_L2C0_SNP1		0x037
+#define  L2C_SNP_BA_MASK	0xffff0000
+#define  L2C_SNP_SSR_MASK	0x0000f000
+#define  L2C_SNP_SSR_32G	0x0000f000
+#define  L2C_SNP_ESR		0x00000800
+#endif /* CONFIG_440GX */
+
 /*
  * PCI-X definitions
  */
@@ -423,7 +513,11 @@
 #define IIC_CLOCK		50
 
 #undef NR_UICS
+#ifdef CONFIG_440GX
+#define NR_UICS 3
+#else
 #define NR_UICS 2
+#endif
 #define UIC_CASCADE_MASK	0x0003		/* bits 30 & 31 */
 
 #define BD_EMAC_ADDR(e,i) bi_enetaddr[e][i]
diff -Nru a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
--- a/include/asm-ppc/ibm4xx.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-ppc/ibm4xx.h	Tue Jun 15 22:20:40 2004
@@ -15,6 +15,7 @@
 #define __ASM_IBM4XX_H__
 
 #include <linux/config.h>
+#include <asm/types.h>
 
 #ifdef CONFIG_40x
 
@@ -22,8 +23,8 @@
 #include <platforms/4xx/ash.h>
 #endif
 
-#if defined (CONFIG_CEDAR)
-#include <platforms/4xx/cedar.h>
+#if defined(CONFIG_BUBINGA)
+#include <platforms/4xx/bubinga.h>
 #endif
 
 #if defined(CONFIG_CPCI405)
@@ -46,17 +47,27 @@
 #include <platforms/4xx/redwood5.h>
 #endif
 
+#if defined(CONFIG_REDWOOD_6)
+#include <platforms/4xx/redwood6.h>
+#endif
+
+#if defined(CONFIG_SYCAMORE)
+#include <platforms/4xx/sycamore.h>
+#endif
+
 #if defined(CONFIG_WALNUT)
 #include <platforms/4xx/walnut.h>
 #endif
 
 #ifndef __ASSEMBLY__
 
+#ifdef CONFIG_40x
 /*
  * The "residual" board information structure the boot loader passes
  * into the kernel.
  */
 extern bd_t __res;
+#endif
 
 void ppc4xx_setup_arch(void);
 void ppc4xx_map_io(void);
@@ -91,11 +102,13 @@
 #endif
 
 #ifndef __ASSEMBLY__
+#ifdef CONFIG_40x
 /*
  * The "residual" board information structure the boot loader passes
  * into the kernel.
  */
 extern bd_t __res;
+#endif
 #endif
 #endif /* CONFIG_40x */
 
diff -Nru a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-ppc/ibm_ocp.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,163 @@
+/*
+ * ibm_ocp.h
+ *
+ *      (c) Benjamin Herrenschmidt (benh@kernel.crashing.org)
+ *          Mipsys - France
+ *
+ *          Derived from work (c) Armin Kuster akuster@pacbell.net
+ *
+ *          Additional support and port to 2.6 LDM/sysfs by
+ *          Matt Porter <mporter@kernel.crashing.org>
+ *          Copyright 2003-2004 MontaVista Software, 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__
+#ifndef __IBM_OCP_H__
+#define __IBM_OCP_H__
+
+#include <asm/types.h>
+
+/*
+ * IBM 4xx OCP system information
+ */
+struct ocp_sys_info_data {
+	int	opb_bus_freq;	/* OPB Bus Frequency (Hz) */
+	int	ebc_bus_freq;	/* EBC Bus Frequency (Hz) */
+};
+
+extern struct ocp_sys_info_data ocp_sys_info;
+
+/*
+ * EMAC additional data and sysfs support
+ *
+ * Note about mdio_idx: When you have a zmii, it's usually
+ * not necessary, it covers the case of the 405EP which has
+ * the MDIO lines on EMAC0 only
+ *
+ * Note about phy_map: Per EMAC map of PHY ids which should
+ * be probed by emac_probe. Different EMACs can have
+ * overlapping maps.
+ *
+ * Note, this map uses inverse logic for bits:
+ *  0 - id should be probed
+ *  1 - id should be ignored
+ *
+ * Default value of 0x00000000 - will result in usual
+ * auto-detection logic.
+ *
+ */
+
+struct ocp_func_emac_data {
+	int	rgmii_idx;	/* RGMII device index or -1 */
+	int	rgmii_mux;	/* RGMII input of this EMAC */
+	int	zmii_idx;	/* ZMII device index or -1 */
+	int	zmii_mux;	/* ZMII input of this EMAC */
+	int	mal_idx;	/* MAL device index */
+	int	mal_rx_chan;	/* MAL rx channel number */
+	int	mal_tx_chan;	/* MAL tx channel number */
+	int	wol_irq;	/* WOL interrupt */
+	int	mdio_idx;	/* EMAC idx of MDIO master or -1 */
+	int	tah_idx;	/* TAH device index or -1 */
+	int	jumbo;		/* Jumbo frames capable flag */
+	int	phy_mode;	/* PHY type or configurable mode */
+	u8	mac_addr[6];	/* EMAC mac address */
+	u32	phy_map;	/* EMAC phy map */
+};
+
+/* Sysfs support */
+#define OCP_SYSFS_EMAC_DATA()						\
+OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, zmii_idx)	\
+OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, zmii_mux)	\
+OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mal_idx)	\
+OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mal_rx_chan)	\
+OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mal_tx_chan)	\
+OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, wol_irq)	\
+OCP_SYSFS_ADDTL(struct ocp_func_emac_data, "%d\n", emac, mdio_idx)	\
+									\
+void ocp_show_emac_data(struct device *dev)				\
+{									\
+	device_create_file(dev, &dev_attr_emac_zmii_idx);		\
+	device_create_file(dev, &dev_attr_emac_zmii_mux);		\
+	device_create_file(dev, &dev_attr_emac_mal_idx);		\
+	device_create_file(dev, &dev_attr_emac_mal_rx_chan);		\
+	device_create_file(dev, &dev_attr_emac_mal_tx_chan);		\
+	device_create_file(dev, &dev_attr_emac_wol_irq);		\
+	device_create_file(dev, &dev_attr_emac_mdio_idx);		\
+}
+
+#ifdef CONFIG_40x
+/*
+ * Helper function to copy MAC addresses from the bd_t to OCP EMAC
+ * additions.
+ *
+ * The range of EMAC indices (inclusive) to be copied are the arguments.
+ */
+static inline void ibm_ocp_set_emac(int start, int end)
+{
+	int i;
+	struct ocp_def *def;
+
+	/* Copy MAC addresses to EMAC additions */
+	for (i=start; i<=end; i++) {
+		def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i);
+		memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
+				&__res.bi_enetaddr[i],
+				6);
+	}
+}
+#endif
+
+/*
+ * MAL additional data and sysfs support
+ */
+struct ocp_func_mal_data {
+	int	num_tx_chans;	/* Number of TX channels */
+	int	num_rx_chans;	/* Number of RX channels */
+	int 	txeob_irq;	/* TX End Of Buffer IRQ  */
+	int 	rxeob_irq;	/* RX End Of Buffer IRQ  */
+	int	txde_irq;	/* TX Descriptor Error IRQ */
+	int	rxde_irq;	/* RX Descriptor Error IRQ */
+	int	serr_irq;	/* MAL System Error IRQ    */
+};
+
+#define OCP_SYSFS_MAL_DATA()						\
+OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, num_tx_chans)	\
+OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, num_rx_chans)	\
+OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, txeob_irq)	\
+OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, rxeob_irq)	\
+OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, txde_irq)	\
+OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, rxde_irq)	\
+OCP_SYSFS_ADDTL(struct ocp_func_mal_data, "%d\n", mal, serr_irq)	\
+									\
+void ocp_show_mal_data(struct device *dev)				\
+{									\
+	device_create_file(dev, &dev_attr_mal_num_tx_chans);		\
+	device_create_file(dev, &dev_attr_mal_num_rx_chans);		\
+	device_create_file(dev, &dev_attr_mal_txeob_irq);		\
+	device_create_file(dev, &dev_attr_mal_rxeob_irq);		\
+	device_create_file(dev, &dev_attr_mal_txde_irq);		\
+	device_create_file(dev, &dev_attr_mal_rxde_irq);		\
+	device_create_file(dev, &dev_attr_mal_serr_irq);		\
+}
+
+/*
+ * IIC additional data and sysfs support
+ */
+struct ocp_func_iic_data {
+	int	fast_mode;	/* IIC fast mode enabled */
+};
+
+#define OCP_SYSFS_IIC_DATA()						\
+OCP_SYSFS_ADDTL(struct ocp_func_iic_data, "%d\n", iic, fast_mode)	\
+									\
+void ocp_show_iic_data(struct device *dev)				\
+{									\
+	device_create_file(dev, &dev_attr_iic_fast_mode);			\
+}
+#endif /* __IBM_OCP_H__ */
+#endif /* __KERNEL__ */
diff -Nru a/include/asm-ppc/ide.h b/include/asm-ppc/ide.h
--- a/include/asm-ppc/ide.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-ppc/ide.h	Tue Jun 15 22:20:58 2004
@@ -43,6 +43,8 @@
 #undef	SUPPORT_SLOW_DATA_PORTS
 #define	SUPPORT_SLOW_DATA_PORTS	0
 
+#define IDE_ARCH_OBSOLETE_DEFAULTS
+
 static __inline__ int ide_default_irq(unsigned long base)
 {
 	if (ppc_ide_md.default_irq)
@@ -56,6 +58,9 @@
 		return ppc_ide_md.default_io_base(index);
 	return 0;
 }
+
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #ifdef CONFIG_PCI
 #define ide_init_default_irq(base)	(0)
diff -Nru a/include/asm-ppc/io.h b/include/asm-ppc/io.h
--- a/include/asm-ppc/io.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-ppc/io.h	Tue Jun 15 22:20:44 2004
@@ -388,43 +388,5 @@
 	return 0;
 }
 
-#ifdef CONFIG_NOT_COHERENT_CACHE
-
-/*
- * DMA-consistent mapping functions for PowerPCs that don't support
- * cache snooping.  These allocate/free a region of uncached mapped
- * memory space for use with DMA devices.  Alternatively, you could
- * allocate the space "normally" and use the cache management functions
- * to ensure it is consistent.
- */
-extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle);
-extern void consistent_free(void *vaddr);
-extern void consistent_sync(void *vaddr, size_t size, int rw);
-extern void consistent_sync_page(struct page *page, unsigned long offset,
-				 size_t size, int rw);
-
-#define dma_cache_inv(_start,_size) \
-	invalidate_dcache_range(_start, (_start + _size))
-#define dma_cache_wback(_start,_size) \
-	clean_dcache_range(_start, (_start + _size))
-#define dma_cache_wback_inv(_start,_size) \
-	flush_dcache_range(_start, (_start + _size))
-
-#else /* ! CONFIG_NOT_COHERENT_CACHE */
-
-/*
- * Cache coherent cores.
- */
-
-#define dma_cache_inv(_start,_size)		do { } while (0)
-#define dma_cache_wback(_start,_size)		do { } while (0)
-#define dma_cache_wback_inv(_start,_size)	do { } while (0)
-
-#define consistent_alloc(gfp, size, handle)	NULL
-#define consistent_free(addr)			do { } while (0)
-#define consistent_sync(addr, size, rw)		do { } while (0)
-#define consistent_sync_page(pg, off, sz, rw)	do { } while (0)
-
-#endif /* ! CONFIG_NOT_COHERENT_CACHE */
 #endif /* _PPC_IO_H */
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-ppc/kmap_types.h b/include/asm-ppc/kmap_types.h
--- a/include/asm-ppc/kmap_types.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc/kmap_types.h	Tue Jun 15 22:20:43 2004
@@ -16,6 +16,7 @@
 	KM_IRQ1,
 	KM_SOFTIRQ0,
 	KM_SOFTIRQ1,
+	KM_PPC_SYNC_PAGE,
 	KM_TYPE_NR
 };
 
diff -Nru a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h
--- a/include/asm-ppc/mpc8260.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-ppc/mpc8260.h	Tue Jun 15 22:20:35 2004
@@ -16,6 +16,10 @@
 #include <platforms/est8260.h>
 #endif
 
+#ifdef CONFIG_SBC82xx
+#include <platforms/sbc82xx.h>
+#endif
+
 #ifdef CONFIG_SBS8260
 #include <platforms/sbs8260.h>
 #endif
diff -Nru a/include/asm-ppc/ocp.h b/include/asm-ppc/ocp.h
--- a/include/asm-ppc/ocp.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-ppc/ocp.h	Tue Jun 15 22:20:38 2004
@@ -1,103 +1,116 @@
 /*
  * ocp.h
  *
+ *      (c) Benjamin Herrenschmidt (benh@kernel.crashing.org)
+ *          Mipsys - France
  *
- * 	Current Maintainer
- *      Armin Kuster akuster@pacbell.net
- *      Jan, 2002
- *
+ *          Derived from work (c) Armin Kuster akuster@pacbell.net
  *
+ *          Additional support and port to 2.6 LDM/sysfs by
+ *          Matt Porter <mporter@kernel.crashing.org>
+ *          Copyright 2003-2004 MontaVista Software, 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.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS 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
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.
+ * 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.
+ *
+ *  TODO: - Add get/put interface & fixup locking to provide same API for
+ *          2.4 and 2.5
+ *	  - Rework PM callbacks
  */
 
 #ifdef __KERNEL__
 #ifndef __OCP_H__
 #define __OCP_H__
 
+#include <linux/init.h>
 #include <linux/list.h>
 #include <linux/config.h>
+#include <linux/devfs_fs_kernel.h>
 #include <linux/device.h>
-#include <linux/errno.h>
 
+#include <asm/mmu.h>
 #include <asm/ocp_ids.h>
-#include <asm/mmu.h>		/* For phys_addr_t */
-#undef DEBUG
-/* #define DEBUG*/
+#include <asm/rwsem.h>
+#include <asm/semaphore.h>
 
-#ifdef DEBUG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
+#ifdef CONFIG_PPC_OCP
 
+#define OCP_MAX_IRQS	7
+#define MAX_EMACS	4
 #define OCP_IRQ_NA	-1	/* used when ocp device does not have an irq */
-#define OCP_IRQ_MUL	-2	/* used for ocp devices with multiple irqs */
-#define OCP_NULL_TYPE	0	/* used to mark end of list */
-#define OCP_DEV_NA	-1
+#define OCP_IRQ_MUL	-2	/* used for ocp devices with multiply irqs */
+#define OCP_NULL_TYPE	-1	/* used to mark end of list */
 #define OCP_CPM_NA	0	/* No Clock or Power Management avaliable */
+#define OCP_PADDR_NA	0	/* No MMIO registers */
 
 #define OCP_ANY_ID	(~0)
+#define OCP_ANY_INDEX	-1
 
-
-extern struct list_head ocp_root_buses;
-extern struct list_head ocp_devices;
+extern struct list_head 	ocp_devices;
+extern struct rw_semaphore	ocp_devices_sem;
 
 struct ocp_device_id {
-	unsigned int vendor, device;		/* Vendor and device ID or PCI_ANY_ID */
-	char name[16];
-	char desc[50];
-	unsigned long driver_data;		/* Data private to the driver */
+	unsigned int	vendor, function;	/* Vendor and function ID or OCP_ANY_ID */
+	unsigned long	driver_data;		/* Data private to the driver */
 };
 
-struct func_info {
-	char name[16];
-	char desc[50];
-};
 
+/*
+ * Static definition of an OCP device.
+ *
+ * @vendor:    Vendor code. It is _STRONGLY_ discouraged to use
+ *             the vendor code as a way to match a unique device,
+ *             though I kept that possibility open, you should
+ *             really define different function codes for different
+ *             device types
+ * @function:  This is the function code for this device.
+ * @index:     This index is used for mapping the Nth function of a
+ *             given core. This is typically used for cross-driver
+ *             matching, like looking for a given MAL or ZMII from
+ *             an EMAC or for getting to the proper set of DCRs.
+ *             Indices are no longer magically calculated based on
+ *             structure ordering, they have to be actually coded
+ *             into the ocp_def to avoid any possible confusion
+ *             I _STRONGLY_ (again ? wow !) encourage anybody relying
+ *             on index mapping to encode the "target" index in an
+ *             associated structure pointed to by "additions", see
+ *             how it's done for the EMAC driver.
+ * @paddr:     Device physical address (may not mean anything...)
+ * @irq:       Interrupt line for this device (TODO: think about making
+ *             an array with this)
+ * @pm:        Currently, contains the bitmask in CPMFR DCR for the device
+ * @additions: Optionally points to a function specific structure
+ *             providing additional informations for a given device
+ *             instance. It's currently used by the EMAC driver for MAL
+ *             channel & ZMII port mapping among others.
+ * @show:      Optionally points to a function specific structure
+ *             providing a sysfs show routine for additions fields.
+ */
 struct ocp_def {
-	unsigned int vendor;
-	unsigned int device;
-	phys_addr_t paddr;
-	int irq;
-	unsigned long pm;
+	unsigned int	vendor;
+	unsigned int	function;
+	int		index;
+	phys_addr_t	paddr;
+	int	  	irq;
+	unsigned long	pm;
+	void		*additions;
+	void		(*show)(struct device *);
 };
 
 
-/* Struct for single ocp device managment */
+/* Struct for a given device instance */
 struct ocp_device {
-	struct list_head global_list;
-	unsigned int	num;		/* instance of device */
-	char		name[80];	/* device name */
-	unsigned int vendor;
-	unsigned int device;
-	phys_addr_t paddr;
-	int irq;
-	unsigned long pm;
-	void *ocpdev;		/* driver data for this device */
-	struct ocp_driver *driver;
-	u32 current_state;	/* Current operating state. In ACPI-speak,
-				   this is D0-D3, D0 being fully functional,
-				   and D3 being off. */
-	struct device dev;
+	struct list_head	link;
+	char			name[80];	/* device name */
+	struct ocp_def		*def;		/* device definition */
+	void			*drvdata;	/* driver data for this device */
+	struct ocp_driver	*driver;
+	u32			current_state;	/* Current operating state. In ACPI-speak,
+						   this is D0-D3, D0 being fully functional,
+						   and D3 being off. */
+	struct			device dev;
 };
 
 struct ocp_driver {
@@ -106,23 +119,13 @@
 	const struct ocp_device_id *id_table;	/* NULL if wants all devices */
 	int  (*probe)  (struct ocp_device *dev);	/* New device inserted */
 	void (*remove) (struct ocp_device *dev);	/* Device removed (NULL if not a hot-plug capable driver) */
-	int  (*save_state) (struct ocp_device *dev, u32 state);    /* Save Device Context */
 	int  (*suspend) (struct ocp_device *dev, u32 state);	/* Device suspended */
 	int  (*resume) (struct ocp_device *dev);	                /* Device woken up */
-	int  (*enable_wake) (struct ocp_device *dev, u32 state, int enable);   /* Enable wake event */
 	struct device_driver driver;
 };
 
-#define	to_ocp_dev(n) container_of(n, struct ocp_device, dev)
-#define	to_ocp_driver(n) container_of(n, struct ocp_driver, driver)
-
-extern int ocp_register_driver(struct ocp_driver *drv);
-extern void ocp_unregister_driver(struct ocp_driver *drv);
-
-#define ocp_dev_g(n) list_entry(n, struct ocp_device, global_list)
-
-#define ocp_for_each_dev(dev) \
-	for(dev = ocp_dev_g(ocp_devices.next); dev != ocp_dev_g(&ocp_devices); dev = ocp_dev_g(dev->global_list.next))
+#define to_ocp_dev(n) container_of(n, struct ocp_device, dev)
+#define to_ocp_drv(n) container_of(n, struct ocp_driver, driver)
 
 /* Similar to the helpers above, these manipulate per-ocp_dev
  * driver-specific data.  Currently stored as ocp_dev::ocpdev,
@@ -131,45 +134,13 @@
 static inline void *
 ocp_get_drvdata(struct ocp_device *pdev)
 {
-	return pdev->ocpdev;
+	return pdev->drvdata;
 }
 
 static inline void
 ocp_set_drvdata(struct ocp_device *pdev, void *data)
 {
-	pdev->ocpdev = data;
-}
-
-/*
- * a helper function which helps ensure correct pci_driver
- * setup and cleanup for commonly-encountered hotplug/modular cases
- *
- * This MUST stay in a header, as it checks for -DMODULE
- */
-static inline int ocp_module_init(struct ocp_driver *drv)
-{
-	int rc = ocp_register_driver(drv);
-
-	if (rc > 0)
-		return 0;
-
-	/* iff CONFIG_HOTPLUG and built into kernel, we should
-	 * leave the driver around for future hotplug events.
-	 * For the module case, a hotplug daemon of some sort
-	 * should load a module in response to an insert event. */
-#if defined(CONFIG_HOTPLUG) && !defined(MODULE)
-	if (rc == 0)
-		return 0;
-#else
-	if (rc == 0)
-		rc = -ENODEV;		
-#endif
-
-	/* if we get here, we need to clean up pci driver instance
-	 * and return some sort of error */
-	ocp_unregister_driver (drv);
-	
-	return rc;
+	pdev->drvdata = data;
 }
 
 #if defined (CONFIG_PM)
@@ -180,26 +151,57 @@
 static inline void
 ocp_force_power_off(struct ocp_device *odev)
 {
-	mtdcr(DCRN_CPMFR, mfdcr(DCRN_CPMFR) | odev->pm);
+	mtdcr(DCRN_CPMFR, mfdcr(DCRN_CPMFR) | odev->def->pm);
 }
 
 static inline void
 ocp_force_power_on(struct ocp_device *odev)
 {
-	mtdcr(DCRN_CPMFR, mfdcr(DCRN_CPMFR) & ~odev->pm);
+	mtdcr(DCRN_CPMFR, mfdcr(DCRN_CPMFR) & ~odev->def->pm);
 }
 #else
 #define ocp_force_power_off(x)	(void)(x)
 #define ocp_force_power_on(x)	(void)(x)
 #endif
 
-extern void ocp_init(void);
-extern struct bus_type ocp_bus_type;
-extern struct ocp_device *ocp_get_dev(unsigned int device, int index);
-extern unsigned int ocp_get_num(unsigned int device);
+/* Register/Unregister an OCP driver */
+extern int ocp_register_driver(struct ocp_driver *drv);
+extern void ocp_unregister_driver(struct ocp_driver *drv);
+
+/* Build list of devices */
+extern int ocp_early_init(void) __init;
 
-extern int ocp_generic_suspend(struct ocp_device *pdev, u32 state);
-extern int ocp_generic_resume(struct ocp_device *pdev);
+/* Find a device by index */
+extern struct ocp_device *ocp_find_device(unsigned int vendor, unsigned int function, int index);
+
+/* Get a def by index */
+extern struct ocp_def *ocp_get_one_device(unsigned int vendor, unsigned int function, int index);
+
+/* Add a device by index */
+extern int ocp_add_one_device(struct ocp_def *def);
+
+/* Remove a device by index */
+extern int ocp_remove_one_device(unsigned int vendor, unsigned int function, int index);
+
+/* Iterate over devices and execute a routine */
+extern void ocp_for_each_device(void(*callback)(struct ocp_device *, void *arg), void *arg);
+
+/* Sysfs support */
+#define OCP_SYSFS_ADDTL(type, format, name, field)			\
+static ssize_t								\
+show_##name##_##field(struct device *dev, char *buf)			\
+{									\
+	struct ocp_device *odev = to_ocp_dev(dev);			\
+	type *add = odev->def->additions;				\
+									\
+	return sprintf(buf, format, add->field);			\
+}									\
+static DEVICE_ATTR(name##_##field, S_IRUGO, show_##name##_##field, NULL);
+
+#ifdef CONFIG_IBM_OCP
+#include <asm/ibm_ocp.h>
+#endif
 
+#endif				/* CONFIG_PPC_OCP */
 #endif				/* __OCP_H__ */
 #endif				/* __KERNEL__ */
diff -Nru a/include/asm-ppc/ocp_ids.h b/include/asm-ppc/ocp_ids.h
--- a/include/asm-ppc/ocp_ids.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-ppc/ocp_ids.h	Tue Jun 15 22:20:58 2004
@@ -1,34 +1,15 @@
 /*
- * FILE NAME: ocp_ids.h
+ * ocp_ids.h
  *
- * BRIEF MODULE DESCRIPTION:
  * OCP device ids based on the ideas from PCI
  *
- * Maintained by: Armin <akuster@mvista.com>
+ * The numbers below are almost completely arbitrary, and in fact
+ * strings might work better.  -- paulus
  *
- *
- *  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  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS 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
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.
- *
- *  Version 1.0 08/22/02 -Armin
- *  	initial release
+ * 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.
  */
 
 /*
@@ -42,8 +23,9 @@
 
 #define	OCP_VENDOR_INVALID	0x0000
 #define	OCP_VENDOR_ARM		0x0004
+#define OCP_VENDOR_FREESCALE	0x1057
 #define OCP_VENDOR_IBM		0x1014
-#define OCP_VENDOR_MOTOROLA	0x1057
+#define OCP_VENDOR_MOTOROLA	OCP_VENDOR_FREESCALE
 #define	OCP_VENDOR_XILINX	0x10ee
 #define	OCP_VENDOR_UNKNOWN	0xFFFF
 
@@ -53,33 +35,20 @@
 #define OCP_FUNC_INVALID	0x0000
 
 /* system 0x0001 - 0x001F */
-#define	OCP_FUNC_UIC		0x0001
 
 /* Timers 0x0020 - 0x002F */
-#define OCP_FUNC_GPT		0x0020 	/* General purpose timers */
-#define OCP_FUNC_RTC		0x0021
 
 /* Serial 0x0030 - 0x006F*/
 #define OCP_FUNC_16550		0x0031
-#define OCP_FUNC_SSP		0x0032 /* sync serial port */
-#define OCP_FUNC_SCP		0x0033 	/* serial controller port */
-#define OCP_FUNC_SCC		0x0034 	/* serial contoller */
-#define OCP_FUNC_SCI		0x0035 	/* Smart card */
-#define OCP_FUNC_IIC		0x0040
-#define OCP_FUNC_USB		0x0050
-#define OCP_FUNC_IR		0x0060	
+#define OCP_FUNC_IIC		0x0032
+#define OCP_FUNC_USB		0x0033
 
 /* Memory devices 0x0090 - 0x009F */
-#define	OCP_FUNC_SDRAM		0x0091
-#define OCP_FUNC_DMA		0x0092
+#define OCP_FUNC_MAL		0x0090
 
 /* Display 0x00A0 - 0x00AF */
-#define OCP_FUNC_VIDEO		0x00A0
-#define OCP_FUNC_LED		0x00A1
-#define	OCP_FUNC_LCD		0x00A2
 
 /* Sound 0x00B0 - 0x00BF */
-#define OCP_FUNC_AUDIO		0x00B0
 
 /* Mass Storage 0x00C0 - 0xxCF */
 #define OCP_FUNC_IDE		0x00C0
@@ -87,17 +56,15 @@
 /* Misc 0x00D0 - 0x00DF*/
 #define OCP_FUNC_GPIO		0x00D0
 #define OCP_FUNC_ZMII		0x00D1
+#define OCP_FUNC_PERFMON	0x00D2	/* Performance Monitor */
+#define OCP_FUNC_RGMII		0x00D3
+#define OCP_FUNC_TAH		0x00D4
 
 /* Network 0x0200 - 0x02FF */
 #define OCP_FUNC_EMAC		0x0200
+#define OCP_FUNC_ENET		0x0201	/* TSEC & FEC */
 
 /* Bridge devices 0xE00 - 0xEFF */
-#define OCP_FUNC_HOST		0x0E00
-#define OCP_FUNC_DCR		0x0E01
-#define OCP_FUNC_OPB		0x0E02
-#define OCP_FUNC_PHY		0x0E03
-#define OCP_FUNC_EXT		0x0E04
-#define	OCP_FUNC_PCI		0x0E05
-#define	OCP_FUNC_PLB		0x0E06
+#define OCP_FUNC_OPB		0x0E00
 
 #define OCP_FUNC_UNKNOWN	0xFFFF
diff -Nru a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
--- a/include/asm-ppc/pci.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc/pci.h	Tue Jun 15 22:20:43 2004
@@ -9,6 +9,7 @@
 #include <asm/scatterlist.h>
 #include <asm/io.h>
 #include <asm/pci-bridge.h>
+#include <asm-generic/pci-dma-compat.h>
 
 struct pci_dev;
 
@@ -54,61 +55,11 @@
 extern unsigned long pci_phys_to_bus(unsigned long pa, int busnr);
 extern unsigned long pci_bus_to_phys(unsigned int ba, int busnr);
 
-/*
- * Dynamic DMA Mapping stuff
- * Originally stolen from i386 by ajoshi and updated by paulus
- * Non-consistent cache support by Dan Malek
- */
-
 /* The PCI address space does equal the physical memory
  * address space.  The networking and block device layers use
  * this boolean for bounce buffer decisions.
  */
-#define PCI_DMA_BUS_IS_PHYS	(1)
-
-/* Allocate and map kernel buffer using consistent mode DMA for a device.
- * hwdev should be valid struct pci_dev pointer for PCI devices,
- * NULL for PCI-like buses (ISA, EISA).
- * Returns non-NULL cpu-view pointer to the buffer if successful and
- * sets *dma_addrp to the pci side dma address as well, else *dma_addrp
- * is undefined.
- */
-extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
-				  dma_addr_t *dma_handle);
-
-/* Free and unmap a consistent DMA buffer.
- * cpu_addr is what was returned from pci_alloc_consistent,
- * size must be the same as what as passed into pci_alloc_consistent,
- * and likewise dma_addr must be the same as what *dma_addrp was set to.
- *
- * References to the memory and mappings associated with cpu_addr/dma_addr
- * past this call are illegal.
- */
-extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
-				void *vaddr, dma_addr_t dma_handle);
-
-/* Map a single buffer of the indicated size for DMA in streaming mode.
- * The 32-bit bus address to use is returned.
- *
- * Once the device is given the dma address, the device owns this memory
- * until either pci_unmap_single or pci_dma_sync_single_for_cpu is performed.
- */
-static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
-					size_t size, int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-
-	consistent_sync(ptr, size, direction);
-
-	return virt_to_bus(ptr);
-}
-
-static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
-				    size_t size, int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-	/* nothing to do */
-}
+#define PCI_DMA_BUS_IS_PHYS     (1)
 
 /* pci_unmap_{page,single} is a nop so... */
 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
@@ -119,181 +70,10 @@
 #define pci_unmap_len_set(PTR, LEN_NAME, VAL)	do { } while (0)
 
 /*
- * pci_{map,unmap}_single_page maps a kernel page to a dma_addr_t. identical
- * to pci_map_single, but takes a struct page instead of a virtual address
- */
-static inline dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page,
-				      unsigned long offset, size_t size,
-				      int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-	consistent_sync_page(page, offset, size, direction);
-	return (page - mem_map) * PAGE_SIZE + PCI_DRAM_OFFSET + offset;
-}
-
-static inline void pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
-				  size_t size, int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-	/* Nothing to do */
-}
-
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scather-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
-			     int nents, int direction)
-{
-	int i;
-
-	BUG_ON(direction == PCI_DMA_NONE);
-
-	/*
-	 * temporary 2.4 hack
-	 */
-	for (i = 0; i < nents; i++, sg++) {
-		BUG_ON(!sg->page);
-		consistent_sync_page(sg->page, sg->offset,
-				     sg->length, direction);
-		sg->dma_address = page_to_bus(sg->page) + sg->offset;
-	}
-
-	return nents;
-}
-
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
-				int nents, int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-	/* nothing to do */
-}
-
-/* Make physical memory consistent for a single
- * streaming mode DMA translation after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the device
- * again owns the buffer.
- */
-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);
-
-	consistent_sync(bus_to_virt(dma_handle), size, direction);
-}
-
-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);
-
-	consistent_sync(bus_to_virt(dma_handle), size, direction);
-}
-
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_for_* but for a scatter-gather list,
- * same rules and usage.
- */
-static inline void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev,
-					   struct scatterlist *sg,
-					   int nelems, int direction)
-{
-	int i;
-
-	BUG_ON(direction == PCI_DMA_NONE);
-
-	for (i = 0; i < nelems; i++, sg++)
-		consistent_sync_page(sg->page, sg->offset,
-				     sg->length, direction);
-}
-
-static inline void pci_dma_sync_sg_for_device(struct pci_dev *hwdev,
-					      struct scatterlist *sg,
-					      int nelems, int direction)
-{
-	int i;
-
-	BUG_ON(direction == PCI_DMA_NONE);
-
-	for (i = 0; i < nelems; i++, sg++)
-		consistent_sync_page(sg->page, sg->offset,
-				     sg->length, direction);
-}
-
-/* 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.
- */
-static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
-{
-	return 1;
-}
-
-/*
  * At present there are very few 32-bit PPC machines that can have
  * memory above the 4GB point, and we don't support that.
  */
 #define pci_dac_dma_supported(pci_dev, mask)	(0)
-
-static inline dma64_addr_t
-pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
-{
-	return (dma64_addr_t) page_to_bus(page) + offset;
-}
-
-static inline struct page *
-pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
-{
-	return mem_map + (unsigned long)(dma_addr >> PAGE_SHIFT);
-}
-
-static inline unsigned long
-pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
-{
-	return (dma_addr & ~PAGE_MASK);
-}
-
-static inline void
-pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
-{
-	/* Nothing to do. */
-}
-
-static inline void
-pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
-{
-	/* Nothing to do. */
-}
-
-static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
-{
-	return 0;
-}
 
 /* Return the index of the PCI controller for device PDEV. */
 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
diff -Nru a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
--- a/include/asm-ppc/pgtable.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ppc/pgtable.h	Tue Jun 15 22:20:37 2004
@@ -548,6 +548,20 @@
 	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)
+{
+	unsigned long bits = pte_val(entry) &
+		(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW);
+	pte_update(ptep, 0, bits);
+}
+
+#define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
+	do {								   \
+		__ptep_set_access_flags(__ptep, __entry, __dirty);	   \
+		flush_tlb_page_nohash(__vma, __address);	       	   \
+	} while(0)
+
 /*
  * Macro to mark a page protection value as "uncacheable".
  */
@@ -670,7 +684,7 @@
  */
 #define pgtable_cache_init()	do { } while (0)
 
-typedef pte_t *pte_addr_t;
+extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep);
 
 #endif /* !__ASSEMBLY__ */
 
diff -Nru a/include/asm-ppc/ppc_asm.h b/include/asm-ppc/ppc_asm.h
--- a/include/asm-ppc/ppc_asm.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ppc/ppc_asm.h	Tue Jun 15 22:20:36 2004
@@ -161,6 +161,8 @@
 #define CLR_TOP32(r)
 #endif /* CONFIG_PPC64BRIDGE */
 
+#define RFMCI		.long 0x4c00004c	/* rfmci instruction */
+
 #ifdef CONFIG_IBM405_ERR77
 #define PPC405_ERR77(ra,rb)	dcbt	ra, rb;
 #define	PPC405_ERR77_SYNC	sync;
diff -Nru a/include/asm-ppc/reg.h b/include/asm-ppc/reg.h
--- a/include/asm-ppc/reg.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc/reg.h	Tue Jun 15 22:20:43 2004
@@ -444,7 +444,7 @@
 #define PVR_440GP_RC2	0x40200481
 #define PVR_440GX_RA	0x51b21850
 #define PVR_440GX_RB	0x51b21851
-#define PVR_440GX_RB1	0x51b21852
+#define PVR_440GX_RC	0x51b21892
 #define PVR_601		0x00010000
 #define PVR_602		0x00050000
 #define PVR_603		0x00030000
diff -Nru a/include/asm-ppc/reg_booke.h b/include/asm-ppc/reg_booke.h
--- a/include/asm-ppc/reg_booke.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc/reg_booke.h	Tue Jun 15 22:20:43 2004
@@ -11,19 +11,24 @@
 
 #ifndef __ASSEMBLY__
 /* Device Control Registers */
-#define mfdcr(rn) mfdcr_or_dflt(rn, 0)
-#define mfdcr_or_dflt(rn,default_rval)					\
-	({unsigned int rval;						\
-	if (rn == 0)							\
-		rval = default_rval;					\
-	else								\
-		asm volatile("mfdcr %0," __stringify(rn) : "=r" (rval)); \
+void __mtdcr(int reg, unsigned int val);
+unsigned int __mfdcr(int reg);
+#define mfdcr(rn)						\
+	({unsigned int rval;					\
+	if (__builtin_constant_p(rn))				\
+		asm volatile("mfdcr %0," __stringify(rn)	\
+		              : "=r" (rval));			\
+	else							\
+		rval = __mfdcr(rn);				\
 	rval;})
 
-#define mtdcr(rn, v)							\
-do {									\
-	if (rn != 0)							\
-		asm volatile("mtdcr " __stringify(rn) ",%0" : : "r" (v)); \
+#define mtdcr(rn, v)						\
+do {								\
+	if (__builtin_constant_p(rn))				\
+		asm volatile("mtdcr " __stringify(rn) ",%0"	\
+			      : : "r" (v)); 			\
+	else							\
+		__mtdcr(rn, v);					\
 } while (0)
 
 /* R/W of indirect DCRs make use of standard naming conventions for DCRs */
@@ -86,6 +91,20 @@
 #define SPRN_IVOR13	0x19D	/* Interrupt Vector Offset Register 13 */
 #define SPRN_IVOR14	0x19E	/* Interrupt Vector Offset Register 14 */
 #define SPRN_IVOR15	0x19F	/* Interrupt Vector Offset Register 15 */
+#define SPRN_MCSRR0	0x23A	/* Machine Check Save and Restore Register 0 */
+#define SPRN_MCSRR1	0x23B	/* Machine Check Save and Restore Register 1 */
+#define SPRN_MCSR	0x23C	/* Machine Check Status Register */
+#ifdef CONFIG_440A
+#define  MCSR_MCS	0x80000000 /* Machine Check Summary */
+#define  MCSR_IB	0x40000000 /* Instruction PLB Error */
+#define  MCSR_DRB	0x20000000 /* Data Read PLB Error */
+#define  MCSR_DWB	0x10000000 /* Data Write PLB Error */
+#define  MCSR_TLBP	0x08000000 /* TLB Parity Error */
+#define  MCSR_ICP	0x04000000 /* I-Cache Parity Error */
+#define  MCSR_DCSP	0x02000000 /* D-Cache Search Parity Error */
+#define  MCSR_DCFP	0x01000000 /* D-Cache Flush Parity Error */
+#define  MCSR_IMPE	0x00800000 /* Imprecise Machine Check Exception */
+#endif
 #define SPRN_ZPR	0x3B0	/* Zone Protection Register (40x) */
 #define SPRN_MMUCR	0x3B2	/* MMU Control Register */
 #define SPRN_CCR0	0x3B3	/* Core Configuration Register */
@@ -144,6 +163,7 @@
  */
 #ifdef CONFIG_BOOKE
 #define DBSR_IC		0x08000000	/* Instruction Completion */
+#define DBSR_BT		0x04000000	/* Branch Taken */
 #define DBSR_TIE	0x01000000	/* Trap Instruction Event */
 #endif
 #ifdef CONFIG_40x
@@ -250,6 +270,8 @@
 #define CSRR0	SPRN_SRR2	/* Logically and functionally equivalent. */
 #define CSRR1	SPRN_SRR3	/* Logically and functionally equivalent. */
 #endif
+#define MCSRR0	SPRN_MCSRR0	/* Machine Check Save and Restore Register 0 */
+#define MCSRR1	SPRN_MCSRR1	/* Machine Check Save and Restore Register 1 */
 #define DCMP	SPRN_DCMP	/* Data TLB Compare Register */
 #define SPRG4R	SPRN_SPRG4R	/* Supervisor Private Registers */
 #define SPRG5R	SPRN_SPRG5R
diff -Nru a/include/asm-ppc/rmap.h b/include/asm-ppc/rmap.h
--- a/include/asm-ppc/rmap.h	Tue Jun 15 22:20:58 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,9 +0,0 @@
-#ifndef _PPC_RMAP_H
-#define _PPC_RMAP_H
-
-/* PPC calls pte_alloc() before mem_map[] is setup ... */
-#define BROKEN_PPC_PTE_ALLOC_ONE
-
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h
--- a/include/asm-ppc/spinlock.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-ppc/spinlock.h	Tue Jun 15 22:20:39 2004
@@ -27,6 +27,7 @@
 #define spin_lock_init(x) 	do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
 #define spin_is_locked(x)	((x)->lock != 0)
 #define spin_unlock_wait(x)	do { barrier(); } while(spin_is_locked(x))
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 #ifndef CONFIG_DEBUG_SPINLOCK
 
@@ -64,7 +65,6 @@
 extern void _raw_spin_lock(spinlock_t *lock);
 extern void _raw_spin_unlock(spinlock_t *lock);
 extern int _raw_spin_trylock(spinlock_t *lock);
-extern unsigned long __spin_trylock(volatile unsigned long *lock);
 
 #endif
 
@@ -135,6 +135,26 @@
 	: "cr0", "memory");
 }
 
+static __inline__ int _raw_write_trylock(rwlock_t *rw)
+{
+	unsigned int tmp;
+
+	__asm__ __volatile__(
+"2:	lwarx	%0,0,%1		# write_trylock\n\
+	cmpwi	0,%0,0\n\
+	bne-	1f\n"
+	PPC405_ERR77(0,%1)
+"	stwcx.	%2,0,%1\n\
+	bne-	2b\n\
+	isync\n\
+1:"
+	: "=&r"(tmp)
+	: "r"(&rw->lock), "r"(-1)
+	: "cr0", "memory");
+
+	return tmp == 0;
+}
+
 static __inline__ void _raw_write_lock(rwlock_t *rw)
 {
 	unsigned int tmp;
@@ -168,6 +188,7 @@
 extern void _raw_read_unlock(rwlock_t *rw);
 extern void _raw_write_lock(rwlock_t *rw);
 extern void _raw_write_unlock(rwlock_t *rw);
+extern int _raw_write_trylock(rwlock_t *rw);
 
 #endif
 
diff -Nru a/include/asm-ppc/system.h b/include/asm-ppc/system.h
--- a/include/asm-ppc/system.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-ppc/system.h	Tue Jun 15 22:20:39 2004
@@ -76,11 +76,15 @@
 extern void enable_kernel_fp(void);
 extern void giveup_altivec(struct task_struct *);
 extern void load_up_altivec(struct task_struct *);
+extern int fix_alignment(struct pt_regs *);
 extern void cvt_fd(float *from, double *to, unsigned long *fpscr);
 extern void cvt_df(double *from, float *to, unsigned long *fpscr);
 extern int call_rtas(const char *, int, int, unsigned long *, ...);
 extern int abs(int);
 extern void cacheable_memzero(void *p, unsigned int nb);
+extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long);
+extern void bad_page_fault(struct pt_regs *, unsigned long, int);
+extern void die(const char *, struct pt_regs *, long);
 
 struct device_node;
 extern void note_scsi_host(struct device_node *, void *);
diff -Nru a/include/asm-ppc/termbits.h b/include/asm-ppc/termbits.h
--- a/include/asm-ppc/termbits.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-ppc/termbits.h	Tue Jun 15 22:20:41 2004
@@ -81,6 +81,7 @@
 #define   TAB1	00002000
 #define   TAB2	00004000
 #define   TAB3	00006000
+#define   XTABS	00006000	/* required by POSIX to == TAB3 */
 #define CRDLY	00030000
 #define   CR0	00000000
 #define   CR1	00010000
@@ -95,7 +96,6 @@
 #define VTDLY	00200000
 #define   VT0	00000000
 #define   VT1	00200000
-#define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
 
 /* c_cflag bit meaning */
 #define CBAUD	0000377
diff -Nru a/include/asm-ppc/tlbflush.h b/include/asm-ppc/tlbflush.h
--- a/include/asm-ppc/tlbflush.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ppc/tlbflush.h	Tue Jun 15 22:20:37 2004
@@ -29,6 +29,9 @@
 static inline void flush_tlb_page(struct vm_area_struct *vma,
 				unsigned long vmaddr)
 	{ _tlbie(vmaddr); }
+static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
+					 unsigned long vmaddr)
+	{ _tlbie(vmaddr); }
 static inline void flush_tlb_range(struct vm_area_struct *vma,
 				unsigned long start, unsigned long end)
 	{ __tlbia(); }
@@ -44,6 +47,9 @@
 static inline void flush_tlb_page(struct vm_area_struct *vma,
 				unsigned long vmaddr)
 	{ _tlbie(vmaddr); }
+static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
+					 unsigned long vmaddr)
+	{ _tlbie(vmaddr); }
 static inline void flush_tlb_range(struct mm_struct *mm,
 				unsigned long start, unsigned long end)
 	{ __tlbia(); }
@@ -56,6 +62,7 @@
 struct vm_area_struct;
 extern void flush_tlb_mm(struct mm_struct *mm);
 extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
+extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
 extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
 			    unsigned long end);
 extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
diff -Nru a/include/asm-ppc/types.h b/include/asm-ppc/types.h
--- a/include/asm-ppc/types.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-ppc/types.h	Tue Jun 15 22:20:58 2004
@@ -62,6 +62,8 @@
 #define HAVE_SECTOR_T
 #endif
 
+typedef unsigned int kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
--- a/include/asm-ppc/unistd.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ppc/unistd.h	Tue Jun 15 22:20:37 2004
@@ -272,8 +272,9 @@
 #define __NR_mq_timedreceive	265
 #define __NR_mq_notify		266
 #define __NR_mq_getsetattr	267
+#define __NR_kexec_load		268
 
-#define __NR_syscalls		268
+#define __NR_syscalls		269
 
 #define __NR(n)	#n
 
@@ -379,6 +380,29 @@
 
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
+
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
 
 /*
  * Forking from kernel space will result in the child getting a new,
diff -Nru a/include/asm-ppc64/atomic.h b/include/asm-ppc64/atomic.h
--- a/include/asm-ppc64/atomic.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-ppc64/atomic.h	Tue Jun 15 22:21:04 2004
@@ -54,6 +54,8 @@
 	return t;
 }
 
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
+
 static __inline__ void atomic_sub(int a, atomic_t *v)
 {
 	int t;
@@ -117,6 +119,16 @@
 
 	return t;
 }
+
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
 
 static __inline__ void atomic_dec(atomic_t *v)
 {
diff -Nru a/include/asm-ppc64/bitops.h b/include/asm-ppc64/bitops.h
--- a/include/asm-ppc64/bitops.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc64/bitops.h	Tue Jun 15 22:20:43 2004
@@ -154,6 +154,20 @@
 	return (old & mask) != 0;
 }
 
+static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
+{
+	unsigned long old;
+
+	__asm__ __volatile__(
+"1:	ldarx	%0,0,%3		# set_bit\n\
+	or	%0,%0,%2\n\
+	stdcx.	%0,0,%3\n\
+	bne-	1b"
+	: "=&r" (old), "=m" (*addr)
+	: "r" (mask), "r" (addr), "m" (*addr)
+	: "cc");
+}
+
 /*
  * non-atomic versions
  */
diff -Nru a/include/asm-ppc64/cacheflush.h b/include/asm-ppc64/cacheflush.h
--- a/include/asm-ppc64/cacheflush.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ppc64/cacheflush.h	Tue Jun 15 22:20:36 2004
@@ -18,6 +18,9 @@
 #define flush_cache_vunmap(start, end)		do { } while (0)
 
 extern void flush_dcache_page(struct page *page);
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
+
 extern void __flush_icache_range(unsigned long, unsigned long);
 extern void flush_icache_user_range(struct vm_area_struct *vma,
 				    struct page *page, unsigned long addr,
@@ -37,7 +40,7 @@
 
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
 {
-	if (!(cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE))
+	if (!(cur_cpu_spec->cpu_features & ASM_CONST(CPU_FTR_COHERENT_ICACHE)))
 		__flush_icache_range(start, stop);
 }
 
diff -Nru a/include/asm-ppc64/compat.h b/include/asm-ppc64/compat.h
--- a/include/asm-ppc64/compat.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-ppc64/compat.h	Tue Jun 15 22:20:38 2004
@@ -25,6 +25,7 @@
 typedef s32		compat_daddr_t;
 typedef u32		compat_caddr_t;
 typedef __kernel_fsid_t	compat_fsid_t;
+typedef s32		compat_key_t;
 
 typedef s32		compat_int_t;
 typedef s32		compat_long_t;
@@ -116,12 +117,12 @@
  */
 typedef	u32		compat_uptr_t;
 
-static inline void *compat_ptr(compat_uptr_t uptr)
+static inline void __user *compat_ptr(compat_uptr_t uptr)
 {
-	return (void *)(unsigned long)uptr;
+	return (void __user *)(unsigned long)uptr;
 }
 
-static inline void *compat_alloc_user_space(long len)
+static inline void __user *compat_alloc_user_space(long len)
 {
 	struct pt_regs *regs = current->thread.regs;
 	unsigned long usp = regs->gpr[1];
@@ -133,7 +134,69 @@
 	if (!(test_thread_flag(TIF_32BIT)))
 		usp -= 288;
 
-	return (void *) (usp - len);
+	return (void __user *) (usp - len);
 }
+
+/*
+ * ipc64_perm is actually 32/64bit clean but since the compat layer refers to
+ * it we may as well define it.
+ */
+struct compat_ipc64_perm {
+	compat_key_t key;
+	compat_uid_t uid;
+	compat_gid_t gid;
+	compat_uid_t cuid;
+	compat_gid_t cgid;
+	compat_mode_t mode;
+	unsigned int seq;
+	unsigned int __pad2;
+	unsigned long __unused1;	/* yes they really are 64bit pads */
+	unsigned long __unused2;
+};
+
+struct compat_semid64_ds {
+	struct compat_ipc64_perm sem_perm;
+	unsigned int __unused1;
+	compat_time_t sem_otime;
+	unsigned int __unused2;
+	compat_time_t sem_ctime;
+	compat_ulong_t sem_nsems;
+	compat_ulong_t __unused3;
+	compat_ulong_t __unused4;
+};
+
+struct compat_msqid64_ds {
+	struct compat_ipc64_perm msg_perm;
+	unsigned int __unused1;
+	compat_time_t msg_stime;
+	unsigned int __unused2;
+	compat_time_t msg_rtime;
+	unsigned int __unused3;
+	compat_time_t msg_ctime;
+	compat_ulong_t msg_cbytes;
+	compat_ulong_t msg_qnum;
+	compat_ulong_t msg_qbytes;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
+	compat_ulong_t __unused4;
+	compat_ulong_t __unused5;
+};
+
+struct compat_shmid64_ds {
+	struct compat_ipc64_perm shm_perm;
+	unsigned int __unused1;
+	compat_time_t shm_atime;
+	unsigned int __unused2;
+	compat_time_t shm_dtime;
+	unsigned int __unused3;
+	compat_time_t shm_ctime;
+	unsigned int __unused4;
+	compat_size_t shm_segsz;
+	compat_pid_t shm_cpid;
+	compat_pid_t shm_lpid;
+	compat_ulong_t shm_nattch;
+	compat_ulong_t __unused5;
+	compat_ulong_t __unused6;
+};
 
 #endif /* _ASM_PPC64_COMPAT_H */
diff -Nru a/include/asm-ppc64/current.h b/include/asm-ppc64/current.h
--- a/include/asm-ppc64/current.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-ppc64/current.h	Tue Jun 15 22:20:42 2004
@@ -8,13 +8,11 @@
  * 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.
- *
- * Use r13 for current since the ppc64 ABI reserves it - Anton
  */
 
 #include <asm/thread_info.h>
 
-#define get_current()   ((struct task_struct *)(get_paca()->xCurrent))
+#define get_current()   (get_paca()->xCurrent)
 #define current         get_current()
 
 #endif /* !(_PPC64_CURRENT_H) */
diff -Nru a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h
--- a/include/asm-ppc64/eeh.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-ppc64/eeh.h	Tue Jun 15 22:20:58 2004
@@ -47,16 +47,16 @@
 void __init pci_addr_cache_build(void);
 
 /**
- * eeh_add_device - perform EEH initialization for the indicated pci device
- * @dev: pci device for which to set up EEH
+ * eeh_add_device_early
+ * eeh_add_device_late
  *
- * This routine can be used to perform EEH initialization for PCI
- * devices that were added after system boot (e.g. hotplug, dlpar).
- * Whether this actually enables EEH or not for this device depends
- * on the type of the device, on earlier boot command-line
- * arguments & etc.
+ * Perform eeh initialization for devices added after boot.
+ * Call eeh_add_device_early before doing any i/o to the
+ * device (including config space i/o).  Call eeh_add_device_late
+ * to finish the eeh setup for this device.
  */
-void eeh_add_device(struct pci_dev *);
+void eeh_add_device_early(struct device_node *);
+void eeh_add_device_late(struct pci_dev *);
 
 /**
  * eeh_remove_device - undo EEH setup for the indicated pci device
@@ -215,7 +215,7 @@
 
 static inline void eeh_outb(u8 val, unsigned long port) {
 	if (_IO_IS_VALID(port))
-		return out_8((u8 *)(port+pci_io_base), val);
+		out_8((u8 *)(port+pci_io_base), val);
 }
 
 static inline u16 eeh_inw(unsigned long port) {
@@ -230,7 +230,7 @@
 
 static inline void eeh_outw(u16 val, unsigned long port) {
 	if (_IO_IS_VALID(port))
-		return out_le16((u16 *)(port+pci_io_base), val);
+		out_le16((u16 *)(port+pci_io_base), val);
 }
 
 static inline u32 eeh_inl(unsigned long port) {
@@ -245,7 +245,7 @@
 
 static inline void eeh_outl(u32 val, unsigned long port) {
 	if (_IO_IS_VALID(port))
-		return out_le32((u32 *)(port+pci_io_base), val);
+		out_le32((u32 *)(port+pci_io_base), val);
 }
 
 /* in-string eeh macros */
diff -Nru a/include/asm-ppc64/iSeries/HvCallSc.h b/include/asm-ppc64/iSeries/HvCallSc.h
--- a/include/asm-ppc64/iSeries/HvCallSc.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ppc64/iSeries/HvCallSc.h	Tue Jun 15 22:20:37 2004
@@ -21,14 +21,14 @@
 
 #include <asm/iSeries/HvTypes.h>
 
-#define HvCallBase		0x8000000000000000
-#define HvCallCc		0x8001000000000000
-#define HvCallCfg		0x8002000000000000
-#define HvCallEvent		0x8003000000000000
-#define HvCallHpt		0x8004000000000000
-#define HvCallPci		0x8005000000000000
-#define HvCallSm		0x8007000000000000
-#define HvCallXm		0x8009000000000000
+#define HvCallBase		0x8000000000000000ul
+#define HvCallCc		0x8001000000000000ul
+#define HvCallCfg		0x8002000000000000ul
+#define HvCallEvent		0x8003000000000000ul
+#define HvCallHpt		0x8004000000000000ul
+#define HvCallPci		0x8005000000000000ul
+#define HvCallSm		0x8007000000000000ul
+#define HvCallXm		0x8009000000000000ul
 
 u64 HvCall0( u64 );
 u64 HvCall1( u64, u64 );
diff -Nru a/include/asm-ppc64/ide.h b/include/asm-ppc64/ide.h
--- a/include/asm-ppc64/ide.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-ppc64/ide.h	Tue Jun 15 22:20:40 2004
@@ -22,10 +22,8 @@
 # define MAX_HWIFS	4
 #endif
 
-static inline int ide_default_irq(unsigned long base) { return 0; }
-static inline unsigned long ide_default_io_base(int index) { return 0; }
-
-#define ide_init_default_irq(base)	(0)
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h
--- a/include/asm-ppc64/io.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-ppc64/io.h	Tue Jun 15 22:21:03 2004
@@ -240,22 +240,23 @@
 {
 	int ret;
 
-	__asm__ __volatile__("lbz%U1%X1 %0,%1; twi 0,%0,0; isync" :
-			     "=r" (ret) : "m" (*addr));
+	__asm__ __volatile__("lbz%U1%X1 %0,%1; twi 0,%0,0; isync"
+			     : "=r" (ret) : "m" (*addr));
 	return ret;
 }
 
 static inline void out_8(volatile unsigned char *addr, int val)
 {
-	__asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
+	__asm__ __volatile__("stb%U0%X0 %1,%0; sync"
+			     : "=m" (*addr) : "r" (val));
 }
 
 static inline int in_le16(volatile unsigned short *addr)
 {
 	int ret;
 
-	__asm__ __volatile__("lhbrx %0,0,%1; twi 0,%0,0; isync" :
-			     "=r" (ret) : "r" (addr), "m" (*addr));
+	__asm__ __volatile__("lhbrx %0,0,%1; twi 0,%0,0; isync"
+			     : "=r" (ret) : "r" (addr), "m" (*addr));
 	return ret;
 }
 
@@ -263,28 +264,29 @@
 {
 	int ret;
 
-	__asm__ __volatile__("lhz%U1%X1 %0,%1; twi 0,%0,0; isync" :
-			     "=r" (ret) : "m" (*addr));
+	__asm__ __volatile__("lhz%U1%X1 %0,%1; twi 0,%0,0; isync"
+			     : "=r" (ret) : "m" (*addr));
 	return ret;
 }
 
 static inline void out_le16(volatile unsigned short *addr, int val)
 {
-	__asm__ __volatile__("sthbrx %1,0,%2; eieio" : "=m" (*addr) :
-			      "r" (val), "r" (addr));
+	__asm__ __volatile__("sthbrx %1,0,%2; sync"
+			     : "=m" (*addr) : "r" (val), "r" (addr));
 }
 
 static inline void out_be16(volatile unsigned short *addr, int val)
 {
-	__asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
+	__asm__ __volatile__("sth%U0%X0 %1,%0; sync"
+			     : "=m" (*addr) : "r" (val));
 }
 
 static inline unsigned in_le32(volatile unsigned *addr)
 {
 	unsigned ret;
 
-	__asm__ __volatile__("lwbrx %0,0,%1; twi 0,%0,0; isync" :
-			     "=r" (ret) : "r" (addr), "m" (*addr));
+	__asm__ __volatile__("lwbrx %0,0,%1; twi 0,%0,0; isync"
+			     : "=r" (ret) : "r" (addr), "m" (*addr));
 	return ret;
 }
 
@@ -292,20 +294,21 @@
 {
 	unsigned ret;
 
-	__asm__ __volatile__("lwz%U1%X1 %0,%1; twi 0,%0,0; isync" :
-			     "=r" (ret) : "m" (*addr));
+	__asm__ __volatile__("lwz%U1%X1 %0,%1; twi 0,%0,0; isync"
+			     : "=r" (ret) : "m" (*addr));
 	return ret;
 }
 
 static inline void out_le32(volatile unsigned *addr, int val)
 {
-	__asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) :
-			     "r" (val), "r" (addr));
+	__asm__ __volatile__("stwbrx %1,0,%2; sync" : "=m" (*addr)
+			     : "r" (val), "r" (addr));
 }
 
 static inline void out_be32(volatile unsigned *addr, int val)
 {
-	__asm__ __volatile__("stw%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
+	__asm__ __volatile__("stw%U0%X0 %1,%0; sync"
+			     : "=m" (*addr) : "r" (val));
 }
 
 static inline unsigned long in_le64(volatile unsigned long *addr)
@@ -323,7 +326,7 @@
 			     "rldicl %1,%1,32,0\n"
 			     "rlwimi %0,%1,8,8,31\n"
 			     "rlwimi %0,%1,24,16,23\n"
-			     : "=r" (ret), "=r" (tmp) : "b" (addr) , "m" (*addr));
+			     : "=r" (ret) , "=r" (tmp) : "b" (addr) , "m" (*addr));
 	return ret;
 }
 
@@ -331,12 +334,12 @@
 {
 	unsigned long ret;
 
-	__asm__ __volatile__("ld %0,0(%1); twi 0,%0,0; isync" :
-			     "=r" (ret) : "m" (*addr));
+	__asm__ __volatile__("ld %0,0(%1); twi 0,%0,0; isync"
+			     : "=r" (ret) : "m" (*addr));
 	return ret;
 }
 
-static inline void out_le64(volatile unsigned long *addr, int val)
+static inline void out_le64(volatile unsigned long *addr, unsigned long val)
 {
 	unsigned long tmp;
 
@@ -348,14 +351,14 @@
 			     "rldicl %1,%1,32,0\n"
 			     "rlwimi %0,%1,8,8,31\n"
 			     "rlwimi %0,%1,24,16,23\n"
-			     "std %0,0(%2)\n"
-			     "eieio\n"
-			     : "=r" (tmp) : "r" (val), "b" (addr) , "m" (*addr));
+			     "std %0,0(%3)\n"
+			     "sync"
+			     : "=&r" (tmp) , "=&r" (val) : "1" (val) , "b" (addr) , "m" (*addr));
 }
 
-static inline void out_be64(volatile unsigned long *addr, int val)
+static inline void out_be64(volatile unsigned long *addr, unsigned long val)
 {
-	__asm__ __volatile__("std %1,0(%0); eieio" : "=m" (*addr) : "r" (val));
+	__asm__ __volatile__("std%U0%X0 %1,%0; sync" : "=m" (*addr) : "r" (val));
 }
 
 #ifndef CONFIG_PPC_ISERIES 
diff -Nru a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h
--- a/include/asm-ppc64/iommu.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-ppc64/iommu.h	Tue Jun 15 22:20:43 2004
@@ -29,10 +29,10 @@
 
 /*
  * IOMAP_MAX_ORDER defines the largest contiguous block
- * of dma (tce) space we can get.  IOMAP_MAX_ORDER = 10 
- * allows up to 2**9 pages (512 * 4096) = 2 MB
+ * of dma (tce) space we can get.  IOMAP_MAX_ORDER = 13
+ * allows up to 2**12 pages (4096 * 4096) = 16 MB
  */
-#define IOMAP_MAX_ORDER 10
+#define IOMAP_MAX_ORDER 13
 
 /*
  * Tces come in two formats, one for the virtual bus and a different
diff -Nru a/include/asm-ppc64/ipc.h b/include/asm-ppc64/ipc.h
--- a/include/asm-ppc64/ipc.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-ppc64/ipc.h	Tue Jun 15 22:20:44 2004
@@ -12,7 +12,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 struct ipc_kludge {
-	struct msgbuf *msgp;
+	struct msgbuf __user *msgp;
 	long msgtyp;
 };
 
diff -Nru a/include/asm-ppc64/irq.h b/include/asm-ppc64/irq.h
--- a/include/asm-ppc64/irq.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-ppc64/irq.h	Tue Jun 15 22:21:05 2004
@@ -9,6 +9,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#include <linux/threads.h>
 #include <asm/atomic.h>
 
 /*
@@ -77,7 +78,26 @@
 
 struct irqaction;
 struct pt_regs;
-int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
+int handle_irq_event(int, struct pt_regs *, struct irqaction *);
+
+#ifdef CONFIG_IRQSTACKS
+/*
+ * Per-cpu stacks for handling hard and soft interrupts.
+ */
+extern struct thread_info *hardirq_ctx[NR_CPUS];
+extern struct thread_info *softirq_ctx[NR_CPUS];
+
+extern void irq_ctx_init(void);
+extern void call_do_softirq(struct thread_info *tp);
+extern int call_handle_irq_event(int irq, struct pt_regs *regs,
+			struct irqaction *action, struct thread_info *tp);
+
+#define __ARCH_HAS_DO_SOFTIRQ
+
+#else
+#define irq_ctx_init()
+
+#endif /* CONFIG_IRQSTACKS */
 
 #endif /* _ASM_IRQ_H */
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h
--- a/include/asm-ppc64/mmu.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-ppc64/mmu.h	Tue Jun 15 22:20:42 2004
@@ -204,7 +204,7 @@
 		page = vpn & 0xffff;
 	}
 
-	return (vsid & 0x7fffffffff) ^ page;
+	return (vsid & 0x7fffffffffUL) ^ page;
 }
 
 static inline void __tlbie(unsigned long va, int large)
diff -Nru a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h
--- a/include/asm-ppc64/mmu_context.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-ppc64/mmu_context.h	Tue Jun 15 22:20:39 2004
@@ -172,11 +172,17 @@
  * After we have set current->mm to a new value, this activates
  * the context for the new mm so we see the new mappings.
  */
-#define activate_mm(active_mm, mm) \
-	switch_mm(active_mm, mm, current);
+static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+	switch_mm(prev, next, current);
+	local_irq_restore(flags);
+}
 
-#define VSID_RANDOMIZER 42470972311
-#define VSID_MASK	0xfffffffff
+#define VSID_RANDOMIZER 42470972311UL
+#define VSID_MASK	0xfffffffffUL
 
 
 /* This is only valid for kernel (including vmalloc, imalloc and bolted) EA's
@@ -189,15 +195,15 @@
 	ordinal = (((ea >> 28) & 0x1fff) * LAST_USER_CONTEXT) | (ea >> 60);
 	vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK;
 
-	ifppcdebug(PPCDBG_HTABSTRESS) {
-		/* For debug, this path creates a very poor vsid distribuition.
-		 * A user program can access virtual addresses in the form
-		 * 0x0yyyyxxxx000 where yyyy = xxxx to cause multiple mappings
-		 * to hash to the same page table group.
-		 */ 
-		ordinal = ((ea >> 28) & 0x1fff) | (ea >> 44);
-		vsid = ordinal & VSID_MASK;
-	}
+#ifdef HTABSTRESS
+	/* For debug, this path creates a very poor vsid distribuition.
+	 * A user program can access virtual addresses in the form
+	 * 0x0yyyyxxxx000 where yyyy = xxxx to cause multiple mappings
+	 * to hash to the same page table group.
+	 */
+	ordinal = ((ea >> 28) & 0x1fff) | (ea >> 44);
+	vsid = ordinal & VSID_MASK;
+#endif /* HTABSTRESS */
 
 	return vsid;
 } 
@@ -212,11 +218,11 @@
 	ordinal = (((ea >> 28) & 0x1fff) * LAST_USER_CONTEXT) | context;
 	vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK;
 
-	ifppcdebug(PPCDBG_HTABSTRESS) {
-		/* See comment above. */
-		ordinal = ((ea >> 28) & 0x1fff) | (context << 16);
-		vsid = ordinal & VSID_MASK;
-	}
+#ifdef HTABSTRESS
+	/* See comment above. */
+	ordinal = ((ea >> 28) & 0x1fff) | (context << 16);
+	vsid = ordinal & VSID_MASK;
+#endif /* HTABSTRESS */
 
 	return vsid;
 }
diff -Nru a/include/asm-ppc64/mmzone.h b/include/asm-ppc64/mmzone.h
--- a/include/asm-ppc64/mmzone.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-ppc64/mmzone.h	Tue Jun 15 22:21:03 2004
@@ -23,7 +23,6 @@
 extern cpumask_t numa_cpumask_lookup_table[];
 extern int nr_cpus_in_node[];
 
-#define MAX_MEMORY (1UL << 41)
 /* 16MB regions */
 #define MEMORY_INCREMENT_SHIFT 24
 #define MEMORY_INCREMENT (1UL << MEMORY_INCREMENT_SHIFT)
diff -Nru a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h
--- a/include/asm-ppc64/naca.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-ppc64/naca.h	Tue Jun 15 22:20:40 2004
@@ -30,7 +30,7 @@
 	u64 log;                        /* Ptr to log buffer         0x30 */
 	u64 serialPortAddr;		/* Phy addr of serial port   0x38 */
 	u64 interrupt_controller;	/* Type of int controller    0x40 */ 
-	u64 slb_size;			/* SLB size in entries       0x48 */
+	u64 unused1;			/* was SLB size in entries   0x48 */
 	u64 pftSize;			/* Log 2 of page table size  0x50 */
 	void *systemcfg;		/* Pointer to systemcfg data 0x58 */
 	u32 dCacheL1LogLineSize;	/* L1 d-cache line size Log2 0x60 */
diff -Nru a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h
--- a/include/asm-ppc64/paca.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-ppc64/paca.h	Tue Jun 15 22:20:39 2004
@@ -37,6 +37,8 @@
 register struct paca_struct *local_paca asm("r13");
 #define get_paca()	local_paca
 
+struct task_struct;
+
 /*============================================================================
  * Name_______:	paca
  *
@@ -59,9 +61,12 @@
  */
 	struct ItLpPaca *xLpPacaPtr;	/* Pointer to LpPaca for PLIC		0x00 */
 	struct ItLpRegSave *xLpRegSavePtr; /* Pointer to LpRegSave for PLIC	0x08 */
-	u64 xCurrent;  		        /* Pointer to current			0x10 */
-	u16 xPacaIndex;			/* Logical processor number		0x18 */
-        u16 xHwProcNum;                 /* Physical processor number            0x1A */
+	struct task_struct *xCurrent;	/* Pointer to current			0x10 */
+	/* Note: the spinlock functions in arch/ppc64/lib/locks.c load lock_token and
+	   xPacaIndex with a single lwz instruction, using the constant offset 24.
+	   If you move either field, fix the spinlocks and rwlocks. */
+	u16 lock_token;			/* Constant 0x8000, used in spinlocks	0x18 */
+	u16 xPacaIndex;			/* Logical processor number		0x1A */
 	u32 default_decr;		/* Default decrementer value		0x1c */	
 	u64 xKsave;			/* Saved Kernel stack addr or zero	0x20 */
 	struct ItLpQueue *lpQueuePtr;	/* LpQueue handled by this processor    0x28 */
@@ -70,7 +75,8 @@
 	u8 *exception_sp;		/*                                      0x50 */
 	u8 xProcEnabled;		/*                                      0x58 */
 	u8 prof_enabled;		/* 1=iSeries profiling enabled          0x59 */
-	u8 resv1[38];			/*					0x5a-0x7f*/
+	u16 xHwProcNum;			/* Physical processor number		0x5a */
+	u8 resv1[36];			/*					0x5c */
 
 /*=====================================================================================
  * CACHE_LINE_2 0x0080 - 0x00FF
diff -Nru a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
--- a/include/asm-ppc64/page.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ppc64/page.h	Tue Jun 15 22:20:36 2004
@@ -12,18 +12,21 @@
 
 #include <linux/config.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	12
-#ifndef __ASSEMBLY__
-# define PAGE_SIZE	(1UL << PAGE_SHIFT)
+#ifdef __ASSEMBLY__
+  #define ASM_CONST(x) x
 #else
-# define PAGE_SIZE	(1 << PAGE_SHIFT)
+  #define __ASM_CONST(x) x##UL
+  #define ASM_CONST(x) __ASM_CONST(x)
 #endif
+
+/* PAGE_SHIFT determines the page size */
+#define PAGE_SHIFT	12
+#define PAGE_SIZE	(ASM_CONST(1) << PAGE_SHIFT)
 #define PAGE_MASK	(~(PAGE_SIZE-1))
 #define PAGE_OFFSET_MASK (PAGE_SIZE-1)
 
 #define SID_SHIFT       28
-#define SID_MASK        0xfffffffff
+#define SID_MASK        0xfffffffffUL
 #define GET_ESID(x)     (((x) >> SID_SHIFT) & SID_MASK)
 
 #ifdef CONFIG_HUGETLB_PAGE
@@ -196,11 +199,11 @@
 /*       KERNELBASE is defined for performance reasons. */
 /*       When KERNELBASE moves, those macros may have   */
 /*             to change!                               */
-#define PAGE_OFFSET     0xC000000000000000
+#define PAGE_OFFSET     ASM_CONST(0xC000000000000000)
 #define KERNELBASE      PAGE_OFFSET
-#define VMALLOCBASE     0xD000000000000000
-#define IOREGIONBASE    0xE000000000000000
-#define EEHREGIONBASE   0xA000000000000000
+#define VMALLOCBASE     0xD000000000000000UL
+#define IOREGIONBASE    0xE000000000000000UL
+#define EEHREGIONBASE   0xA000000000000000UL
 
 #define IO_REGION_ID       (IOREGIONBASE>>REGION_SHIFT)
 #define EEH_REGION_ID      (EEHREGIONBASE>>REGION_SHIFT)
diff -Nru a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h
--- a/include/asm-ppc64/pgalloc.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ppc64/pgalloc.h	Tue Jun 15 22:20:36 2004
@@ -48,28 +48,43 @@
 	pmd_populate_kernel(mm, pmd, page_address(pte_page))
 
 static inline pte_t *
-pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
+pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
+	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;
 }
 
 static inline struct page *
 pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte = pte_alloc_one_kernel(mm, address);
-
-	if (pte)
-		return virt_to_page(pte);
-
+	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;
+	}
 	return NULL;
 }
 		
 static inline void pte_free_kernel(pte_t *pte)
 {
+	virt_to_page(pte)->mapping = NULL;
 	kmem_cache_free(zero_cache, pte);
 }
 
-#define pte_free(pte_page)	pte_free_kernel(page_address(pte_page))
+static inline void pte_free(struct page *ptepage)
+{
+	ptepage->mapping = NULL;
+	kmem_cache_free(zero_cache, page_address(ptepage));
+}
 
 struct pte_freelist_batch
 {
diff -Nru a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h
--- a/include/asm-ppc64/pgtable.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-ppc64/pgtable.h	Tue Jun 15 22:21:03 2004
@@ -47,7 +47,7 @@
 /*
  * Define the address range of the vmalloc VM area.
  */
-#define VMALLOC_START (0xD000000000000000)
+#define VMALLOC_START (0xD000000000000000ul)
 #define VMALLOC_END   (VMALLOC_START + VALID_EA_BITS)
 
 /*
@@ -56,8 +56,8 @@
  */
 #define IMALLOC_START     (ioremap_bot)
 #define IMALLOC_VMADDR(x) ((unsigned long)(x))
-#define PHBS_IO_BASE  	  (0xE000000000000000)	/* Reserve 2 gigs for PHBs */
-#define IMALLOC_BASE      (0xE000000080000000)  
+#define PHBS_IO_BASE  	  (0xE000000000000000ul)	/* Reserve 2 gigs for PHBs */
+#define IMALLOC_BASE      (0xE000000080000000ul)  
 #define IMALLOC_END       (IMALLOC_BASE + VALID_EA_BITS)
 
 /*
@@ -306,7 +306,10 @@
 	return old;
 }
 
-/* PTE updating functions */
+/* PTE updating functions, this function puts the PTE in the
+ * batch, doesn't actually triggers the hash flush immediately,
+ * you need to call flush_tlb_pending() to do that.
+ */
 extern void hpte_update(pte_t *ptep, unsigned long pte, int wrprot);
 
 static inline int ptep_test_and_clear_young(pte_t *ptep)
@@ -318,7 +321,7 @@
 	old = pte_update(ptep, _PAGE_ACCESSED);
 	if (old & _PAGE_HASHPTE) {
 		hpte_update(ptep, old, 0);
-		flush_tlb_pending();	/* XXX generic code doesn't flush */
+		flush_tlb_pending();
 	}
 	return (old & _PAGE_ACCESSED) != 0;
 }
@@ -396,11 +399,40 @@
  */
 static inline void set_pte(pte_t *ptep, pte_t pte)
 {
-	if (pte_present(*ptep))
+	if (pte_present(*ptep)) {
 		pte_clear(ptep);
+		flush_tlb_pending();
+	}
 	*ptep = __pte(pte_val(pte)) & ~_PAGE_HPTEFLAGS;
 }
 
+/* Set the dirty and/or accessed bits atomically in a linux PTE, this
+ * function doesn't need to flush the hash entry
+ */
+#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
+static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
+{
+	unsigned long bits = pte_val(entry) &
+		(_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW);
+	unsigned long old, tmp;
+
+	__asm__ __volatile__(
+	"1:	ldarx	%0,0,%4\n\
+		andi.	%1,%0,%6\n\
+		bne-	1b \n\
+		or	%0,%3,%0\n\
+		stdcx.	%0,0,%4\n\
+		bne-	1b"
+	:"=&r" (old), "=&r" (tmp), "=m" (*ptep)
+	:"r" (bits), "r" (ptep), "m" (ptep), "i" (_PAGE_BUSY)
+	:"cc");
+}
+#define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
+	do {								   \
+		__ptep_set_access_flags(__ptep, __entry, __dirty);	   \
+		flush_tlb_page_nohash(__vma, __address);	       	   \
+	} while(0)
+
 /*
  * Macro to mark a page protection value as "uncacheable".
  */
@@ -470,8 +502,6 @@
 extern struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size,
 			int region_type);
 unsigned long im_free(void *addr);
-
-typedef pte_t *pte_addr_t;
 
 long pSeries_lpar_hpte_insert(unsigned long hpte_group,
 			      unsigned long va, unsigned long prpn,
diff -Nru a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h
--- a/include/asm-ppc64/ppc32.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-ppc64/ppc32.h	Tue Jun 15 22:20:40 2004
@@ -141,9 +141,4 @@
 	struct mcontext32	uc_mcontext;
 };
 
-struct ipc_kludge_32 {
-	unsigned int msgp;
-	int msgtyp;
-};
-
 #endif  /* _PPC64_PPC32_H */
diff -Nru a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
--- a/include/asm-ppc64/processor.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ppc64/processor.h	Tue Jun 15 22:20:36 2004
@@ -384,6 +384,8 @@
 #define	PV_POWER4p	0x0038
 #define PV_GPUL		0x0039
 #define	PV_POWER5	0x003A
+#define PV_POWER5p	0x003B
+#define PV_GPULp	0x003C
 #define	PV_630        	0x0040
 #define	PV_630p	        0x0041
 
@@ -625,6 +627,17 @@
 
 #define spin_lock_prefetch(x)	prefetchw(x)
 
+#ifdef CONFIG_SCHED_SMT
+#define ARCH_HAS_SCHED_DOMAIN
+#define ARCH_HAS_SCHED_WAKE_IDLE
+#endif
+
 #endif /* ASSEMBLY */
+
+/*
+ * Number of entries in the SLB. If this ever changes we should handle
+ * it with a use a cpu feature fixup.
+ */
+#define SLB_NUM_ENTRIES 64
 
 #endif /* __ASM_PPC64_PROCESSOR_H */
diff -Nru a/include/asm-ppc64/ptrace.h b/include/asm-ppc64/ptrace.h
--- a/include/asm-ppc64/ptrace.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-ppc64/ptrace.h	Tue Jun 15 22:20:42 2004
@@ -124,7 +124,7 @@
 /* Kernel and userspace will both use this PT_FPSCR value.  32-bit apps will have
  * visibility to the asm-ppc/ptrace.h header instead of this one.
  */
-#define PT_FPSCR (PT_FPR0 + 32 + 1)	  /* each FP reg occupies 1 slot in 64-bit space */
+#define PT_FPSCR (PT_FPR0 + 32)	  /* each FP reg occupies 1 slot in 64-bit space */
 
 #ifdef __KERNEL__
 #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1)	  /* each FP reg occupies 2 32-bit userspace slots */
diff -Nru a/include/asm-ppc64/rmap.h b/include/asm-ppc64/rmap.h
--- a/include/asm-ppc64/rmap.h	Tue Jun 15 22:21:05 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,9 +0,0 @@
-#ifndef _PPC64_RMAP_H
-#define _PPC64_RMAP_H
-
-/* PPC64 calls pte_alloc() before mem_map[] is setup ... */
-#define BROKEN_PPC_PTE_ALLOC_ONE
-
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h
--- a/include/asm-ppc64/rtas.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-ppc64/rtas.h	Tue Jun 15 22:21:04 2004
@@ -166,7 +166,7 @@
 
 extern struct rtas_t rtas;
 
-extern void enter_rtas(struct rtas_args *);
+extern void enter_rtas(unsigned long);
 extern int rtas_token(const char *service);
 extern long rtas_call(int token, int, int, unsigned long *, ...);
 extern void call_rtas_display_status(char);
diff -Nru a/include/asm-ppc64/sigcontext.h b/include/asm-ppc64/sigcontext.h
--- a/include/asm-ppc64/sigcontext.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ppc64/sigcontext.h	Tue Jun 15 22:20:37 2004
@@ -7,7 +7,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#include <linux/compiler.h>
 #include <asm/ptrace.h>
 #include <asm/elf.h>
 
@@ -18,7 +18,7 @@
 	int		_pad0;
 	unsigned long	handler;
 	unsigned long	oldmask;
-	struct pt_regs	*regs;
+	struct pt_regs	__user *regs;
 	elf_gregset_t	gp_regs;
 	elf_fpregset_t	fp_regs;
 /*
@@ -40,7 +40,7 @@
  * The entry with index 33 contains the vrsave as the first word (offset 0) 
  * within the quadword.
  */
-	elf_vrreg_t	*v_regs;
+	elf_vrreg_t	__user *v_regs;
 	long		vmx_reserve[ELF_NVRREG+ELF_NVRREG+1];
 };
 
diff -Nru a/include/asm-ppc64/spinlock.h b/include/asm-ppc64/spinlock.h
--- a/include/asm-ppc64/spinlock.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ppc64/spinlock.h	Tue Jun 15 22:20:36 2004
@@ -4,7 +4,7 @@
 /*
  * Simple spin lock operations.  
  *
- * Copyright (C) 2001 Paul Mackerras <paulus@au.ibm.com>, IBM
+ * Copyright (C) 2001-2004 Paul Mackerras <paulus@au.ibm.com>, IBM
  * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM
  *
  * Type of int is used as a full 64b word is not necessary.
@@ -14,6 +14,8 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#include <linux/config.h>
+
 typedef struct {
 	volatile unsigned int lock;
 } spinlock_t;
@@ -22,25 +24,48 @@
 #define SPIN_LOCK_UNLOCKED	(spinlock_t) { 0 }
 
 #define spin_is_locked(x)	((x)->lock != 0)
+#define spin_lock_init(x)	do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
+
+static __inline__ void _raw_spin_unlock(spinlock_t *lock)
+{
+	__asm__ __volatile__("lwsync	# spin_unlock": : :"memory");
+	lock->lock = 0;
+}
+
+/*
+ * Normally we use the spinlock functions in arch/ppc64/lib/locks.c.
+ * For special applications such as profiling, we can have the
+ * spinlock functions inline by defining CONFIG_SPINLINE.
+ * This is not recommended on partitioned systems with shared
+ * processors, since the inline spinlock functions don't include
+ * the code for yielding the CPU to the lock holder.
+ */
+
+#ifndef CONFIG_SPINLINE
+extern int _raw_spin_trylock(spinlock_t *lock);
+extern void _raw_spin_lock(spinlock_t *lock);
+extern void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags);
+extern void spin_unlock_wait(spinlock_t *lock);
+
+#else
 
 static __inline__ int _raw_spin_trylock(spinlock_t *lock)
 {
-	unsigned int tmp;
+	unsigned int tmp, tmp2;
 
 	__asm__ __volatile__(
-"1:	lwarx		%0,0,%1		# spin_trylock\n\
+"1:	lwarx		%0,0,%2		# spin_trylock\n\
 	cmpwi		0,%0,0\n\
-	li		%0,0\n\
 	bne-		2f\n\
-	li		%0,1\n\
-	stwcx.		%0,0,%1\n\
+	lwz		%1,24(13)\n\
+	stwcx.		%1,0,%2\n\
 	bne-		1b\n\
 	isync\n\
-2:"	: "=&r"(tmp)
+2:"	: "=&r"(tmp), "=&r"(tmp2)
 	: "r"(&lock->lock)
 	: "cr0", "memory");
 
-	return tmp;
+	return tmp == 0;
 }
 
 static __inline__ void _raw_spin_lock(spinlock_t *lock)
@@ -58,20 +83,51 @@
 "2:	lwarx		%0,0,%1\n\
 	cmpwi		0,%0,0\n\
 	bne-		1b\n\
-	stwcx.		%2,0,%1\n\
+	lwz		%0,24(13)\n\
+	stwcx.		%0,0,%1\n\
 	bne-		2b\n\
 	isync"
 	: "=&r"(tmp)
-	: "r"(&lock->lock), "r"(1)
+	: "r"(&lock->lock)
 	: "cr0", "memory");
 }
 
-static __inline__ void _raw_spin_unlock(spinlock_t *lock)
+/*
+ * Note: if we ever want to inline the spinlocks on iSeries,
+ * we will have to change the irq enable/disable stuff in here.
+ */
+static __inline__ void _raw_spin_lock_flags(spinlock_t *lock,
+					    unsigned long flags)
 {
-	__asm__ __volatile__("eieio	# spin_unlock": : :"memory");
-	lock->lock = 0;
+	unsigned int tmp;
+	unsigned long tmp2;
+
+	__asm__ __volatile__(
+	"b		3f		# spin_lock\n\
+1:	mfmsr		%1\n\
+	mtmsrd		%3,1\n\
+2:"	HMT_LOW
+"	lwzx		%0,0,%2\n\
+	cmpwi		0,%0,0\n\
+	bne+		2b\n"
+	HMT_MEDIUM
+"	mtmsrd		%1,1\n\
+3:	lwarx		%0,0,%2\n\
+	cmpwi		0,%0,0\n\
+	bne-		1b\n\
+	lwz		%1,24(13)\n\
+	stwcx.		%1,0,%2\n\
+	bne-		3b\n\
+	isync"
+	: "=&r"(tmp), "=&r"(tmp2)
+	: "r"(&lock->lock), "r"(flags)
+	: "cr0", "memory");
 }
 
+#define spin_unlock_wait(x)	do { cpu_relax(); } while (spin_is_locked(x))
+
+#endif /* CONFIG_SPINLINE */
+
 /*
  * Read-write spinlocks, allowing multiple readers
  * but only one writer.
@@ -88,6 +144,34 @@
 
 #define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
 
+#define rwlock_init(x)		do { *(x) = RW_LOCK_UNLOCKED; } while(0)
+#define rwlock_is_locked(x)	((x)->lock)
+
+static __inline__ int is_read_locked(rwlock_t *rw)
+{
+	return rw->lock > 0;
+}
+
+static __inline__ int is_write_locked(rwlock_t *rw)
+{
+	return rw->lock < 0;
+}
+
+static __inline__ void _raw_write_unlock(rwlock_t *rw)
+{
+	__asm__ __volatile__("lwsync		# write_unlock": : :"memory");
+	rw->lock = 0;
+}
+
+#ifndef CONFIG_SPINLINE
+extern int _raw_read_trylock(rwlock_t *rw);
+extern void _raw_read_lock(rwlock_t *rw);
+extern void _raw_read_unlock(rwlock_t *rw);
+extern int _raw_write_trylock(rwlock_t *rw);
+extern void _raw_write_lock(rwlock_t *rw);
+extern void _raw_write_unlock(rwlock_t *rw);
+
+#else
 static __inline__ int _raw_read_trylock(rwlock_t *rw)
 {
 	unsigned int tmp;
@@ -139,7 +223,7 @@
 	unsigned int tmp;
 
 	__asm__ __volatile__(
-	"eieio				# read_unlock\n\
+	"lwsync				# read_unlock\n\
 1:	lwarx		%0,0,%1\n\
 	addic		%0,%0,-1\n\
 	stwcx.		%0,0,%1\n\
@@ -192,29 +276,7 @@
 	: "r"(&rw->lock), "r"(-1)
 	: "cr0", "memory");
 }
-
-static __inline__ void _raw_write_unlock(rwlock_t *rw)
-{
-	__asm__ __volatile__("eieio		# write_unlock": : :"memory");
-	rw->lock = 0;
-}
-
-static __inline__ int is_read_locked(rwlock_t *rw)
-{
-	return rw->lock > 0;
-}
-
-static __inline__ int is_write_locked(rwlock_t *rw)
-{
-	return rw->lock < 0;
-}
-
-#define spin_lock_init(x)      do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
-#define spin_unlock_wait(x)    do { cpu_relax(); } while(spin_is_locked(x))
-
-#define rwlock_init(x)         do { *(x) = RW_LOCK_UNLOCKED; } while(0)
-
-#define rwlock_is_locked(x)	((x)->lock)
+#endif /* CONFIG_SPINLINE */
 
 #endif /* __KERNEL__ */
 #endif /* __ASM_SPINLOCK_H */
diff -Nru a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
--- a/include/asm-ppc64/system.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-ppc64/system.h	Tue Jun 15 22:21:05 2004
@@ -29,22 +29,26 @@
  * read_barrier_depends() prevents data-dependent loads being reordered
  *	across this point (nop on PPC).
  *
- * We can use the eieio instruction for wmb, but since it doesn't
- * give any ordering guarantees about loads, we have to use the
- * stronger but slower sync instruction for mb and rmb.
+ * We have to use the sync instructions for mb(), since lwsync doesn't
+ * order loads with respect to previous stores.  Lwsync is fine for
+ * rmb(), though.
+ * For wmb(), we use sync since wmb is used in drivers to order
+ * stores to system memory with respect to writes to the device.
+ * However, smp_wmb() can be a lighter-weight eieio barrier on
+ * SMP since it is only used to order updates to system memory.
  */
 #define mb()   __asm__ __volatile__ ("sync" : : : "memory")
 #define rmb()  __asm__ __volatile__ ("lwsync" : : : "memory")
-#define wmb()  __asm__ __volatile__ ("eieio" : : : "memory")
+#define wmb()  __asm__ __volatile__ ("sync" : : : "memory")
 #define read_barrier_depends()  do { } while(0)
 
-#define set_mb(var, value)	do { var = value; mb(); } while (0)
-#define set_wmb(var, value)	do { var = value; wmb(); } while (0)
+#define set_mb(var, value)	do { var = value; smp_mb(); } while (0)
+#define set_wmb(var, value)	do { var = value; smp_wmb(); } while (0)
 
 #ifdef CONFIG_SMP
 #define smp_mb()	mb()
 #define smp_rmb()	rmb()
-#define smp_wmb()	wmb()
+#define smp_wmb()	__asm__ __volatile__ ("eieio" : : : "memory")
 #define smp_read_barrier_depends()  read_barrier_depends()
 #else
 #define smp_mb()	__asm__ __volatile__("": : :"memory")
@@ -60,6 +64,7 @@
 #ifdef CONFIG_DEBUGGER
 
 extern int (*__debugger)(struct pt_regs *regs);
+extern int (*__debugger_ipi)(struct pt_regs *regs);
 extern int (*__debugger_bpt)(struct pt_regs *regs);
 extern int (*__debugger_sstep)(struct pt_regs *regs);
 extern int (*__debugger_iabr_match)(struct pt_regs *regs);
@@ -75,6 +80,7 @@
 }
 
 DEBUGGER_BOILERPLATE(debugger)
+DEBUGGER_BOILERPLATE(debugger_ipi)
 DEBUGGER_BOILERPLATE(debugger_bpt)
 DEBUGGER_BOILERPLATE(debugger_sstep)
 DEBUGGER_BOILERPLATE(debugger_iabr_match)
@@ -87,6 +93,7 @@
 
 #else
 static inline int debugger(struct pt_regs *regs) { return 0; }
+static inline int debugger_ipi(struct pt_regs *regs) { return 0; }
 static inline int debugger_bpt(struct pt_regs *regs) { return 0; }
 static inline int debugger_sstep(struct pt_regs *regs) { return 0; }
 static inline int debugger_iabr_match(struct pt_regs *regs) { return 0; }
diff -Nru a/include/asm-ppc64/termbits.h b/include/asm-ppc64/termbits.h
--- a/include/asm-ppc64/termbits.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-ppc64/termbits.h	Tue Jun 15 22:20:42 2004
@@ -89,6 +89,7 @@
 #define   TAB1	00002000
 #define   TAB2	00004000
 #define   TAB3	00006000
+#define   XTABS	00006000	/* required by POSIX to == TAB3 */
 #define CRDLY	00030000
 #define   CR0	00000000
 #define   CR1	00010000
@@ -103,7 +104,6 @@
 #define VTDLY	00200000
 #define   VT0	00000000
 #define   VT1	00200000
-#define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
 
 /* c_cflag bit meaning */
 #define CBAUD	0000377
diff -Nru a/include/asm-ppc64/thread_info.h b/include/asm-ppc64/thread_info.h
--- a/include/asm-ppc64/thread_info.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-ppc64/thread_info.h	Tue Jun 15 22:20:37 2004
@@ -69,10 +69,6 @@
 #define get_thread_info(ti)	get_task_struct((ti)->task)
 #define put_thread_info(ti)	put_task_struct((ti)->task)
 
-#if THREAD_SIZE != (4*PAGE_SIZE)
-#error update vmlinux.lds and current_thread_info to match
-#endif
-
 /* how to get the thread information struct from C */
 static inline struct thread_info *current_thread_info(void)
 {
diff -Nru a/include/asm-ppc64/tlbflush.h b/include/asm-ppc64/tlbflush.h
--- a/include/asm-ppc64/tlbflush.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-ppc64/tlbflush.h	Tue Jun 15 22:20:35 2004
@@ -6,6 +6,7 @@
  *
  *  - flush_tlb_mm(mm) flushes the specified mm context TLB's
  *  - flush_tlb_page(vma, vmaddr) flushes one page
+ *  - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB
  *  - flush_tlb_range(vma, start, end) flushes a range of pages
  *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
  *  - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
@@ -39,6 +40,7 @@
 
 #define flush_tlb_mm(mm)			flush_tlb_pending()
 #define flush_tlb_page(vma, addr)		flush_tlb_pending()
+#define flush_tlb_page_nohash(vma, addr)       	do { } while (0)
 #define flush_tlb_range(vma, start, end) \
 		do { (void)(start); flush_tlb_pending(); } while (0)
 #define flush_tlb_kernel_range(start, end)	flush_tlb_pending()
diff -Nru a/include/asm-ppc64/types.h b/include/asm-ppc64/types.h
--- a/include/asm-ppc64/types.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-ppc64/types.h	Tue Jun 15 22:20:38 2004
@@ -71,6 +71,8 @@
 	unsigned long toc;
 	unsigned long env;
 } func_descr_t;
+
+typedef unsigned int kmem_bufctl_t;
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-ppc64/uaccess.h b/include/asm-ppc64/uaccess.h
--- a/include/asm-ppc64/uaccess.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-ppc64/uaccess.h	Tue Jun 15 22:20:40 2004
@@ -54,7 +54,7 @@
 	(((segment).seg & (addr | size )) == 0)
 
 #define access_ok(type,addr,size) \
-	__access_ok(((unsigned long)(addr)),(size),get_fs())
+	__access_ok(((__force unsigned long)(addr)),(size),get_fs())
 
 static inline int verify_area(int type, const void __user *addr, unsigned long size)
 {
@@ -116,6 +116,7 @@
 #define __put_user_nocheck(x,ptr,size)				\
 ({								\
 	long __pu_err;						\
+	__chk_user_ptr(ptr);					\
 	__put_user_size((x),(ptr),(size),__pu_err,-EFAULT);	\
 	__pu_err;						\
 })
@@ -123,7 +124,7 @@
 #define __put_user_check(x,ptr,size)					\
 ({									\
 	long __pu_err = -EFAULT;					\
-	__typeof__(*(ptr)) *__pu_addr = (ptr);				\
+	void __user *__pu_addr = (ptr);					\
 	if (access_ok(VERIFY_WRITE,__pu_addr,size))			\
 		__put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT);	\
 	__pu_err;							\
@@ -187,6 +188,7 @@
 do {									\
 	might_sleep();							\
 	retval = 0;							\
+	__chk_user_ptr(ptr);						\
 	switch (size) {							\
 	  case 1: __get_user_asm(x,ptr,retval,"lbz",errret); break;	\
 	  case 2: __get_user_asm(x,ptr,retval,"lhz",errret); break;	\
diff -Nru a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h
--- a/include/asm-ppc64/unistd.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-ppc64/unistd.h	Tue Jun 15 22:20:36 2004
@@ -278,8 +278,9 @@
 #define __NR_mq_timedreceive	265
 #define __NR_mq_notify		266
 #define __NR_mq_getsetattr	267
+#define __NR_kexec_load		268
 
-#define __NR_syscalls		268
+#define __NR_syscalls		269
 #ifdef __KERNEL__
 #define NR_syscalls	__NR_syscalls
 #endif
@@ -418,6 +419,28 @@
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+
 unsigned long sys_mmap(unsigned long addr, size_t len, unsigned long prot,
 		       unsigned long flags, unsigned long fd, off_t offset);
 struct pt_regs;
@@ -433,7 +456,7 @@
 int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3,
 		unsigned long p4, unsigned long p5, unsigned long p6,
 		struct pt_regs *regs);
-int sys_pipe(int *fildes);
+int sys_pipe(int __user *fildes);
 int sys_ptrace(long request, long pid, long addr, long data);
 struct sigaction;
 long sys_rt_sigaction(int sig, const struct sigaction __user *act,
diff -Nru a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h
--- a/include/asm-ppc64/vio.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-ppc64/vio.h	Tue Jun 15 22:20:42 2004
@@ -43,8 +43,6 @@
 
 int vio_register_driver(struct vio_driver *drv);
 void vio_unregister_driver(struct vio_driver *drv);
-const struct vio_device_id * vio_match_device(const struct vio_device_id *ids, 
-						const struct vio_dev *dev);
 
 struct vio_dev * __devinit vio_register_device(struct device_node *node_vdev);
 void __devinit vio_unregister_device(struct vio_dev *dev);
@@ -52,7 +50,6 @@
 
 const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length);
 int vio_get_irq(struct vio_dev *dev);
-struct iommu_table * vio_build_iommu_table(struct vio_dev *dev);
 int vio_enable_interrupts(struct vio_dev *dev);
 int vio_disable_interrupts(struct vio_dev *dev);
 
@@ -110,8 +107,6 @@
  * The vio_dev structure is used to describe virtual I/O devices.
  */
 struct vio_dev {
-	struct device_node *archdata;   /* Open Firmware node */
-	void *driver_data;              /* data private to the driver */
 	struct iommu_table *iommu_table;     /* vio_map_* uses this */
 	uint32_t unit_address;	
 	unsigned int irq;
diff -Nru a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
--- a/include/asm-s390/atomic.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-s390/atomic.h	Tue Jun 15 22:20:36 2004
@@ -69,9 +69,10 @@
 {
 	return __CS_LOOP(v, 1, "ar");
 }
+
 static __inline__ int atomic_inc_and_test(volatile atomic_t * v)
 {
-	return __CS_LOOP(v, 1, "ar") != 0;
+	return __CS_LOOP(v, 1, "ar") == 0;
 }
 static __inline__ void atomic_dec(volatile atomic_t * v)
 {
@@ -144,7 +145,7 @@
 }
 static __inline__ long long atomic64_inc_and_test(volatile atomic64_t * v)
 {
-	return __CSG_LOOP(v, 1, "agr") != 0;
+	return __CSG_LOOP(v, 1, "agr") == 0;
 }
 static __inline__ void atomic64_dec(volatile atomic64_t * v)
 {
diff -Nru a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
--- a/include/asm-s390/bitops.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-s390/bitops.h	Tue Jun 15 22:20:36 2004
@@ -110,6 +110,7 @@
 
 #endif /* __s390x__ */
 
+#define __BITOPS_WORDS(bits) (((bits)+__BITOPS_WORDSIZE-1)/__BITOPS_WORDSIZE)
 #define __BITOPS_BARRIER() __asm__ __volatile__ ( "" : : : "memory" )
 
 #ifdef CONFIG_SMP
@@ -534,6 +535,7 @@
 static inline int
 find_first_zero_bit(const unsigned long * addr, unsigned int size)
 {
+	typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
 	unsigned long cmp, count;
         unsigned int res;
 
@@ -566,13 +568,15 @@
                 "   alr  %0,%2\n"
                 "4:"
                 : "=&a" (res), "=&d" (cmp), "=&a" (count)
-                : "a" (size), "a" (addr), "a" (&_zb_findmap) : "cc" );
+                : "a" (size), "a" (addr), "a" (&_zb_findmap),
+		  "m" (*(addrtype *) addr) : "cc" );
         return (res < size) ? res : size;
 }
 
 static inline int
 find_first_bit(const unsigned long * addr, unsigned int size)
 {
+	typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
 	unsigned long cmp, count;
         unsigned int res;
 
@@ -605,7 +609,8 @@
                 "   alr  %0,%2\n"
                 "4:"
                 : "=&a" (res), "=&d" (cmp), "=&a" (count)
-                : "a" (size), "a" (addr), "a" (&_sb_findmap) : "cc" );
+                : "a" (size), "a" (addr), "a" (&_sb_findmap),
+		  "m" (*(addrtype *) addr) : "cc" );
         return (res < size) ? res : size;
 }
 
@@ -695,6 +700,7 @@
 static inline unsigned long
 find_first_zero_bit(const unsigned long * addr, unsigned long size)
 {
+	typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
         unsigned long res, cmp, count;
 
         if (!size)
@@ -730,13 +736,15 @@
                 "   algr  %0,%2\n"
                 "5:"
                 : "=&a" (res), "=&d" (cmp), "=&a" (count)
-		: "a" (size), "a" (addr), "a" (&_zb_findmap) : "cc" );
+		: "a" (size), "a" (addr), "a" (&_zb_findmap),
+		  "m" (*(addrtype *) addr) : "cc" );
         return (res < size) ? res : size;
 }
 
 static inline unsigned long
 find_first_bit(const unsigned long * addr, unsigned long size)
 {
+	typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
         unsigned long res, cmp, count;
 
         if (!size)
@@ -772,7 +780,8 @@
                 "   algr  %0,%2\n"
                 "5:"
                 : "=&a" (res), "=&d" (cmp), "=&a" (count)
-		: "a" (size), "a" (addr), "a" (&_sb_findmap) : "cc" );
+		: "a" (size), "a" (addr), "a" (&_sb_findmap),
+		  "m" (*(addrtype *) addr) : "cc" );
         return (res < size) ? res : size;
 }
 
@@ -983,6 +992,7 @@
 static inline int 
 ext2_find_first_zero_bit(void *vaddr, unsigned int size)
 {
+	typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
 	unsigned long cmp, count;
         unsigned int res;
 
@@ -1016,7 +1026,8 @@
                 "   alr  %0,%2\n"
                 "4:"
                 : "=&a" (res), "=&d" (cmp), "=&a" (count)
-                : "a" (size), "a" (vaddr), "a" (&_zb_findmap) : "cc" );
+                : "a" (size), "a" (vaddr), "a" (&_zb_findmap),
+		  "m" (*(addrtype *) vaddr) : "cc" );
         return (res < size) ? res : size;
 }
 
@@ -1068,6 +1079,7 @@
 static inline unsigned long
 ext2_find_first_zero_bit(void *vaddr, unsigned long size)
 {
+	typedef struct { long _[__BITOPS_WORDS(size)]; } addrtype;
         unsigned long res, cmp, count;
 
         if (!size)
@@ -1103,7 +1115,8 @@
                 "   algr  %0,%2\n"
                 "5:"
                 : "=&a" (res), "=&d" (cmp), "=&a" (count)
-		: "a" (size), "a" (vaddr), "a" (&_zb_findmap) : "cc" );
+		: "a" (size), "a" (vaddr), "a" (&_zb_findmap),
+		  "m" (*(addrtype *) vaddr) : "cc" );
         return (res < size) ? res : size;
 }
 
diff -Nru a/include/asm-s390/cacheflush.h b/include/asm-s390/cacheflush.h
--- a/include/asm-s390/cacheflush.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-s390/cacheflush.h	Tue Jun 15 22:21:05 2004
@@ -10,6 +10,8 @@
 #define flush_cache_range(vma, start, end)	do { } while (0)
 #define flush_cache_page(vma, vmaddr)		do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_range(start, end)		do { } while (0)
 #define flush_icache_page(vma,pg)		do { } while (0)
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
diff -Nru a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
--- a/include/asm-s390/checksum.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-s390/checksum.h	Tue Jun 15 22:20:36 2004
@@ -93,8 +93,8 @@
  * Copy from userspace and compute checksum.  If we catch an exception
  * then zero the rest of the buffer.
  */
-static inline unsigned int 
-csum_partial_copy_from_user (const char *src, char *dst,
+static inline unsigned int
+csum_partial_copy_from_user(const char __user *src, char *dst,
                                           int len, unsigned int sum,
                                           int *err_ptr)
 {
diff -Nru a/include/asm-s390/compat.h b/include/asm-s390/compat.h
--- a/include/asm-s390/compat.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-s390/compat.h	Tue Jun 15 22:20:37 2004
@@ -123,19 +123,19 @@
  */
 typedef	u32		compat_uptr_t;
 
-static inline void *compat_ptr(compat_uptr_t uptr)
+static inline void __user *compat_ptr(compat_uptr_t uptr)
 {
-	return (void *)(unsigned long)(uptr & 0x7fffffffUL);
+	return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
 }
 
-static inline void *compat_alloc_user_space(long len)
+static inline void __user *compat_alloc_user_space(long len)
 {
 	unsigned long stack;
 
 	stack = KSTK_ESP(current);
 	if (test_thread_flag(TIF_31BIT))
 		stack &= 0x7fffffffUL;
-	return (void *) (stack - len);
+	return (void __user *) (stack - len);
 }
 
 struct compat_ipc64_perm {
diff -Nru a/include/asm-s390/debug.h b/include/asm-s390/debug.h
--- a/include/asm-s390/debug.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-s390/debug.h	Tue Jun 15 22:20:40 2004
@@ -91,7 +91,8 @@
 				   char* out_buf);
 typedef int (debug_input_proc_t) (debug_info_t* id,
 				  struct debug_view* view,
-				  struct file* file, const char* user_buf,
+				  struct file* file,
+				  const char __user *user_buf,
 				  size_t in_buf_size, loff_t* offset);
 
 int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view,
@@ -232,26 +233,6 @@
 #define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
 #define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
 #define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
-#endif				/* DASD_DEBUG */
-
-#if DASD_DEBUG > 4
-#define INTERNAL_ERROR(x...) PRINT_FATAL ( INTERNAL_ERRMSG ( x ) )
-#elif DASD_DEBUG > 2
-#define INTERNAL_ERROR(x...) PRINT_ERR ( INTERNAL_ERRMSG ( x ) )
-#elif DASD_DEBUG > 0
-#define INTERNAL_ERROR(x...) PRINT_WARN ( INTERNAL_ERRMSG ( x ) )
-#else
-#define INTERNAL_ERROR(x...)
-#endif				/* DASD_DEBUG */
-
-#if DASD_DEBUG > 5
-#define INTERNAL_CHECK(x...) PRINT_FATAL ( INTERNAL_CHKMSG ( x ) )
-#elif DASD_DEBUG > 3
-#define INTERNAL_CHECK(x...) PRINT_ERR ( INTERNAL_CHKMSG ( x ) )
-#elif DASD_DEBUG > 1
-#define INTERNAL_CHECK(x...) PRINT_WARN ( INTERNAL_CHKMSG ( x ) )
-#else
-#define INTERNAL_CHECK(x...)
 #endif				/* DASD_DEBUG */
 
 #undef DEBUG_MALLOC
diff -Nru a/include/asm-s390/idals.h b/include/asm-s390/idals.h
--- a/include/asm-s390/idals.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-s390/idals.h	Tue Jun 15 22:20:36 2004
@@ -218,7 +218,7 @@
  * Copy count bytes from an idal buffer to user memory
  */
 static inline size_t
-idal_buffer_to_user(struct idal_buffer *ib, void *to, size_t count)
+idal_buffer_to_user(struct idal_buffer *ib, void __user *to, size_t count)
 {
 	size_t left;
 	int i;
@@ -228,7 +228,7 @@
 		left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE);
 		if (left)
 			return left + count - IDA_BLOCK_SIZE;
-		to = (void *) to + IDA_BLOCK_SIZE;
+		to = (void __user *) to + IDA_BLOCK_SIZE;
 		count -= IDA_BLOCK_SIZE;
 	}
 	return copy_to_user(to, ib->data[i], count);
@@ -238,7 +238,7 @@
  * Copy count bytes from user memory to an idal buffer
  */
 static inline size_t
-idal_buffer_from_user(struct idal_buffer *ib, const void *from, size_t count)
+idal_buffer_from_user(struct idal_buffer *ib, const void __user *from, size_t count)
 {
 	size_t left;
 	int i;
@@ -248,7 +248,7 @@
 		left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE);
 		if (left)
 			return left + count - IDA_BLOCK_SIZE;
-		from = (void *) from + IDA_BLOCK_SIZE;
+		from = (void __user *) from + IDA_BLOCK_SIZE;
 		count -= IDA_BLOCK_SIZE;
 	}
 	return copy_from_user(ib->data[i], from, count);
diff -Nru a/include/asm-s390/ipc.h b/include/asm-s390/ipc.h
--- a/include/asm-s390/ipc.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-s390/ipc.h	Tue Jun 15 22:21:04 2004
@@ -15,7 +15,7 @@
  * See arch/s390/kernel/sys_s390.c for ugly details..
  */
 struct ipc_kludge {
-	struct msgbuf *msgp;
+	struct msgbuf __user *msgp;
 	long msgtyp;
 };
 
diff -Nru a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
--- a/include/asm-s390/percpu.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-s390/percpu.h	Tue Jun 15 22:21:03 2004
@@ -5,10 +5,26 @@
 #include <asm/lowcore.h>
 
 /*
- * s390 uses the generic implementation for per cpu data, with the exception that
- * the offset of the cpu local data area is cached in the cpu's lowcore memory
+ * For builtin kernel code s390 uses the generic implementation for
+ * per cpu data, with the exception that the offset of the cpu local
+ * data area is cached in the cpu's lowcore memory
+ * For 64 bit module code s390 forces the use of a GOT slot for the
+ * address of the per cpu variable. This is needed because the module
+ * may be more than 4G above the per cpu area.
  */
+#if defined(__s390x__) && defined(MODULE)
+#define __get_got_cpu_var(var,offset) \
+  (*({ unsigned long *__ptr; \
+       asm ( "larl %0,per_cpu__"#var"@GOTENT" : "=a" (__ptr) ); \
+       ((typeof(&per_cpu__##var))((*__ptr) + offset)); \
+    }))
+#undef __get_cpu_var
+#define __get_cpu_var(var) __get_got_cpu_var(var,S390_lowcore.percpu_offset)
+#undef per_cpu
+#define per_cpu(var,cpu) __get_got_cpu_var(var,__per_cpu_offset[cpu])
+#else
 #undef __get_cpu_var
 #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, S390_lowcore.percpu_offset))
+#endif
 
 #endif /* __ARCH_S390_PERCPU__ */
diff -Nru a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
--- a/include/asm-s390/pgtable.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-s390/pgtable.h	Tue Jun 15 22:20:43 2004
@@ -580,12 +580,16 @@
 
 static inline void
 ptep_establish(struct vm_area_struct *vma, 
-	       unsigned long address, pte_t *ptep, pte_t entry)
+	       unsigned long address, pte_t *ptep,
+	       pte_t entry)
 {
 	ptep_clear_flush(vma, address, ptep);
 	set_pte(ptep, entry);
 }
 
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
+	ptep_establish(__vma, __address, __ptep, __entry)
+
 /*
  * Test and clear dirty bit in storage key.
  * We can't clear the changed bit atomically. This is a potential
@@ -760,8 +764,6 @@
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)	((pte_t) { (x).val })
 
-typedef pte_t *pte_addr_t;
-
 #ifndef __s390x__
 # define PTE_FILE_MAX_BITS	26
 #else /* __s390x__ */
@@ -784,11 +786,8 @@
  */
 #define pgtable_cache_init()	do { } while (0)
 
-#ifdef __s390x__
-# define HAVE_ARCH_UNMAPPED_AREA
-#endif /* __s390x__ */
-
 #define __HAVE_ARCH_PTEP_ESTABLISH
+#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
diff -Nru a/include/asm-s390/processor.h b/include/asm-s390/processor.h
--- a/include/asm-s390/processor.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-s390/processor.h	Tue Jun 15 22:20:40 2004
@@ -63,15 +63,18 @@
 
 # define TASK_SIZE		(0x80000000UL)
 # define TASK_UNMAPPED_BASE	(TASK_SIZE / 2)
+# define DEFAULT_TASK_SIZE	(0x80000000UL)
 
 #else /* __s390x__ */
 
-# define TASK_SIZE		(0x40000000000UL)
-# define TASK31_SIZE		(0x80000000UL)
-# define TASK_UNMAPPED_BASE	(test_thread_flag(TIF_31BIT) ? \
-					(TASK31_SIZE / 2) : (TASK_SIZE / 2))
+# define TASK_SIZE		(test_thread_flag(TIF_31BIT) ? \
+					(0x80000000UL) : (0x40000000000UL))
+# define TASK_UNMAPPED_BASE	(TASK_SIZE / 2)
+# define DEFAULT_TASK_SIZE	(0x40000000000UL)
 
 #endif /* __s390x__ */
+
+#define MM_VM_SIZE(mm)		DEFAULT_TASK_SIZE
 
 typedef struct {
         __u32 ar4;
diff -Nru a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h
--- a/include/asm-s390/ptrace.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-s390/ptrace.h	Tue Jun 15 22:20:42 2004
@@ -303,6 +303,7 @@
  */
 struct pt_regs 
 {
+	unsigned long args[1];
 	psw_t psw;
 	unsigned long gprs[NUM_GPRS];
 	unsigned long orig_gpr2;
diff -Nru a/include/asm-s390/qeth.h b/include/asm-s390/qeth.h
--- a/include/asm-s390/qeth.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-s390/qeth.h	Tue Jun 15 22:20:42 2004
@@ -8,19 +8,17 @@
  * Author(s):	Thomas Spatzier <tspat@de.ibm.com>
  *
  */
-#ifndef __ASM_S390_IOCTL_H__
-#define __ASM_S390_IOCTL_H__
+#ifndef __ASM_S390_QETH_IOCTL_H__
+#define __ASM_S390_QETH_IOCTL_H__
 #include <linux/ioctl.h>
 
-#define QETH_IOCTL_LETTER 'Q'
-
-#define SIOC_QETH_ARP_SET_NO_ENTRIES	_IOWR(QETH_IOCTL_LETTER, 1, int)
-#define SIOC_QETH_ARP_QUERY_INFO	_IOWR(QETH_IOCTL_LETTER, 2, int)
-#define SIOC_QETH_ARP_ADD_ENTRY		_IOWR(QETH_IOCTL_LETTER, 3, int)
-#define SIOC_QETH_ARP_REMOVE_ENTRY	_IOWR(QETH_IOCTL_LETTER, 4, int)
-#define SIOC_QETH_ARP_FLUSH_CACHE	_IOWR(QETH_IOCTL_LETTER, 5, int)
-#define SIOC_QETH_ADP_SET_SNMP_CONTROL	_IOWR(QETH_IOCTL_LETTER, 6, int)
-#define SIOC_QETH_GET_CARD_TYPE		_IOWR(QETH_IOCTL_LETTER, 7, int)
+#define SIOC_QETH_ARP_SET_NO_ENTRIES    (SIOCDEVPRIVATE)
+#define SIOC_QETH_ARP_QUERY_INFO        (SIOCDEVPRIVATE + 1)
+#define SIOC_QETH_ARP_ADD_ENTRY         (SIOCDEVPRIVATE + 2)
+#define SIOC_QETH_ARP_REMOVE_ENTRY      (SIOCDEVPRIVATE + 3)
+#define SIOC_QETH_ARP_FLUSH_CACHE       (SIOCDEVPRIVATE + 4)
+#define SIOC_QETH_ADP_SET_SNMP_CONTROL  (SIOCDEVPRIVATE + 5)
+#define SIOC_QETH_GET_CARD_TYPE         (SIOCDEVPRIVATE + 6)
 
 struct qeth_arp_cache_entry {
 	__u8  macaddr[6];
@@ -37,6 +35,13 @@
 	__u8 ipaddr[4];
 } __attribute__((packed));
 
+struct qeth_arp_qi_entry7_short {
+	__u8 macaddr_type;
+	__u8 ipaddr_type;
+	__u8 macaddr[6];
+	__u8 ipaddr[4];
+} __attribute__((packed));
+
 struct qeth_arp_qi_entry5 {
 	__u8 media_specific[32];
 	__u8 macaddr_type;
@@ -44,6 +49,19 @@
 	__u8 ipaddr[4];
 } __attribute__((packed));
 
+struct qeth_arp_qi_entry5_short {
+	__u8 macaddr_type;
+	__u8 ipaddr_type;
+	__u8 ipaddr[4];
+} __attribute__((packed));
+
+/*
+ * can be set by user if no "media specific information" is wanted
+ * -> saves a lot of space in user space buffer
+ */
+#define QETH_QARP_STRIP_ENTRIES  0x8000
+#define QETH_QARP_REQUEST_MASK   0x00ff
+
 /* data sent to user space as result of query arp ioctl */
 #define QETH_QARP_USER_DATA_SIZE 20000
 #define QETH_QARP_MASK_OFFSET    4
@@ -57,4 +75,4 @@
 	char *entries;
 } __attribute__((packed));
 
-#endif /* __ASM_S390_IOCTL_H__ */
+#endif /* __ASM_S390_QETH_IOCTL_H__ */
diff -Nru a/include/asm-s390/rmap.h b/include/asm-s390/rmap.h
--- a/include/asm-s390/rmap.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _S390_RMAP_H
-#define _S390_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-s390/setup.h b/include/asm-s390/setup.h
--- a/include/asm-s390/setup.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-s390/setup.h	Tue Jun 15 22:20:58 2004
@@ -12,6 +12,7 @@
 #define COMMAND_LINE_SIZE 	896
 #define RAMDISK_ORIGIN		0x800000
 #define RAMDISK_SIZE		0x800000
+#define MEMORY_CHUNKS		16	/* max 0x7fff */
 
 #ifndef __ASSEMBLY__
 
diff -Nru a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
--- a/include/asm-s390/spinlock.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-s390/spinlock.h	Tue Jun 15 22:21:05 2004
@@ -42,12 +42,13 @@
 #define spin_lock_init(lp) do { (lp)->lock = 0; } while(0)
 #define spin_unlock_wait(lp)	do { barrier(); } while(((volatile spinlock_t *)(lp))->lock)
 #define spin_is_locked(x) ((x)->lock != 0)
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 extern inline void _raw_spin_lock(spinlock_t *lp)
 {
 #ifndef __s390x__
 	unsigned int reg1, reg2;
-        __asm__ __volatile("    bras  %0,1f\n"
+        __asm__ __volatile__("    bras  %0,1f\n"
                            "0:  diag  0,0,68\n"
                            "1:  slr   %1,%1\n"
                            "    cs    %1,%0,0(%3)\n"
@@ -57,7 +58,7 @@
 			   : "cc", "memory" );
 #else /* __s390x__ */
 	unsigned long reg1, reg2;
-        __asm__ __volatile("    bras  %1,1f\n"
+        __asm__ __volatile__("    bras  %1,1f\n"
                            "0:  " __DIAG44_INSN " 0,%4\n"
                            "1:  slr   %0,%0\n"
                            "    cs    %0,%1,0(%3)\n"
@@ -73,7 +74,7 @@
 	unsigned long reg;
 	unsigned int result;
 
-	__asm__ __volatile("    basr  %1,0\n"
+	__asm__ __volatile__("    basr  %1,0\n"
 			   "0:  cs    %0,%1,0(%3)"
 			   : "=d" (result), "=&d" (reg), "=m" (lp->lock)
 			   : "a" (&lp->lock), "m" (lp->lock), "0" (0)
@@ -85,7 +86,7 @@
 {
 	unsigned int old;
 
-	__asm__ __volatile("cs %0,%3,0(%4)"
+	__asm__ __volatile__("cs %0,%3,0(%4)"
 			   : "=d" (old), "=m" (lp->lock)
 			   : "0" (lp->lock), "d" (0), "a" (lp)
 			   : "cc", "memory" );
diff -Nru a/include/asm-s390/string.h b/include/asm-s390/string.h
--- a/include/asm-s390/string.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-s390/string.h	Tue Jun 15 22:21:05 2004
@@ -15,136 +15,124 @@
 #include <linux/types.h>
 #endif
 
-#define __HAVE_ARCH_MEMCHR
-#define __HAVE_ARCH_MEMCPY
-#define __HAVE_ARCH_MEMSET
-#define __HAVE_ARCH_STRCAT
-#define __HAVE_ARCH_STRCMP
-#define __HAVE_ARCH_STRCPY
-#define __HAVE_ARCH_STRLEN
-#define __HAVE_ARCH_STRNCPY
+#define __HAVE_ARCH_BCOPY	/* arch function */
+#define __HAVE_ARCH_MEMCHR	/* inline & arch function */
+#define __HAVE_ARCH_MEMCMP	/* arch function */
+#define __HAVE_ARCH_MEMCPY	/* gcc builtin & arch function */
+#define __HAVE_ARCH_MEMSCAN	/* inline & arch function */
+#define __HAVE_ARCH_MEMSET	/* gcc builtin & arch function */
+#define __HAVE_ARCH_STRCAT	/* inline & arch function */
+#define __HAVE_ARCH_STRCMP	/* arch function */
+#define __HAVE_ARCH_STRCPY	/* inline & arch function */
+#define __HAVE_ARCH_STRLCAT	/* arch function */
+#define __HAVE_ARCH_STRLCPY	/* arch function */
+#define __HAVE_ARCH_STRLEN	/* inline & arch function */
+#define __HAVE_ARCH_STRNCAT	/* arch function */
+#define __HAVE_ARCH_STRNCPY	/* arch function */
+#define __HAVE_ARCH_STRNLEN	/* inline & arch function */
+#define __HAVE_ARCH_STRRCHR	/* arch function */
+#define __HAVE_ARCH_STRSTR	/* arch function */
+
+/* Prototypes for non-inlined arch strings functions. */
+extern int memcmp(const void *, const void *, size_t);
+extern void *memcpy(void *, const void *, size_t);
+extern void *memset(void *, int, size_t);
+extern int strcmp(const char *,const char *);
+extern size_t strlcat(char *, const char *, size_t);
+extern size_t strlcpy(char *, const char *, size_t);
+extern char *strncat(char *, const char *, size_t);
+extern char *strncpy(char *, const char *, size_t);
+extern char *strrchr(const char *, int);
+extern char *strstr(const char *, const char *);
 
 #undef __HAVE_ARCH_MEMMOVE
-#undef __HAVE_ARCH_STRNICMP
-#undef __HAVE_ARCH_STRNCAT
-#undef __HAVE_ARCH_STRNCMP
 #undef __HAVE_ARCH_STRCHR
-#undef __HAVE_ARCH_STRRCHR
-#undef __HAVE_ARCH_STRNLEN
-#undef __HAVE_ARCH_STRSPN
+#undef __HAVE_ARCH_STRNCHR
+#undef __HAVE_ARCH_STRNCMP
+#undef __HAVE_ARCH_STRNICMP
 #undef __HAVE_ARCH_STRPBRK
-#undef __HAVE_ARCH_STRTOK
-#undef __HAVE_ARCH_BCOPY
-#undef __HAVE_ARCH_MEMCMP
-#undef __HAVE_ARCH_MEMSCAN
-#undef __HAVE_ARCH_STRSTR
+#undef __HAVE_ARCH_STRSEP
+#undef __HAVE_ARCH_STRSPN
 
-extern void *memset(void *, int, size_t);
-extern void *memcpy(void *, const void *, size_t);
-extern void *memmove(void *, const void *, size_t);
-extern char *strncpy(char *, const char *, size_t);
-extern int strcmp(const char *,const char *);
+#if !defined(IN_ARCH_STRING_C)
+
+static inline void *memchr(const void * s, int c, size_t n)
+{
+	register int r0 asm("0") = (char) c;
+	const void *ret = s + n;
 
-static inline void * memchr(const void * cs,int c,size_t count)
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b\n"
+		      "   jl	1f\n"
+		      "   la    %0,0\n"
+		      "1:"
+		      : "+a" (ret), "+&a" (s) : "d" (r0) : "cc" );
+	return (void *) ret;
+}
+
+static inline void *memscan(void *s, int c, size_t n)
+{
+	register int r0 asm("0") = (char) c;
+	const void *ret = s + n;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b\n"
+		      : "+a" (ret), "+&a" (s) : "d" (r0) : "cc" );
+	return (void *) ret;
+}
+
+static inline char *strcat(char *dst, const char *src)
+{
+	register int r0 asm("0") = 0;
+	unsigned long dummy;
+	char *ret = dst;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b\n"
+		      "1: mvst  %0,%2\n"
+		      "   jo    1b"
+		      : "=&a" (dummy), "+a" (dst), "+a" (src)
+		      : "d" (r0), "0" (0) : "cc", "memory" );
+	return ret;
+}
+
+static inline char *strcpy(char *dst, const char *src)
 {
-    void *ptr;
+	register int r0 asm("0") = 0;
+	char *ret = dst;
 
-    __asm__ __volatile__ (
-#ifndef __s390x__
-                          "   lr    0,%2\n"
-                          "   lr    1,%1\n"
-                          "   la    %0,0(%3,%1)\n"
-                          "0: srst  %0,1\n"
-                          "   jo    0b\n"
-                          "   brc   13,1f\n"
-                          "   slr   %0,%0\n"
-#else /* __s390x__ */
-                          "   lgr   0,%2\n"
-                          "   lgr   1,%1\n"
-                          "   la    %0,0(%3,%1)\n"
-                          "0: srst  %0,1\n"
-                          "   jo    0b\n"
-                          "   brc   13,1f\n"
-                          "   slgr  %0,%0\n"
-#endif /* __s390x__ */
-                          "1:"
-                          : "=&a" (ptr) : "a" (cs), "d" (c), "d" (count)
-                          : "cc", "0", "1" );
-    return ptr;
-}
-
-static __inline__ char *strcpy(char *dest, const char *src)
-{
-    char *tmp = dest;
-
-    __asm__ __volatile__ (
-#ifndef __s390x__
-                          "   sr    0,0\n"
-                          "0: mvst  %0,%1\n"
-                          "   jo    0b"
-#else /* __s390x__ */
-                          "   slgr  0,0\n"
-                          "0: mvst  %0,%1\n"
-                          "   jo    0b"
-#endif /* __s390x__ */
-                          : "+&a" (dest), "+&a" (src) :
-                          : "cc", "memory", "0" );
-    return tmp;
-}
-
-static __inline__ size_t strlen(const char *s)
-{
-    size_t len;
-
-    __asm__ __volatile__ (
-#ifndef __s390x__
-                          "   sr    0,0\n"
-                          "   lr    %0,%1\n"
-                          "0: srst  0,%0\n"
-                          "   jo    0b\n"
-                          "   lr    %0,0\n"
-                          "   sr    %0,%1"
-#else /* __s390x__ */
-                          "   slgr  0,0\n"
-                          "   lgr   %0,%1\n"
-                          "0: srst  0,%0\n"
-                          "   jo    0b\n"
-                          "   lgr   %0,0\n"
-                          "   sgr   %0,%1"
-#endif /* __s390x__ */
-                          : "=&a" (len) : "a" (s) 
-                          : "cc", "0" );
-    return len;
-}
-
-static __inline__ char *strcat(char *dest, const char *src)
-{
-    char *tmp = dest;
-
-    __asm__ __volatile__ (
-#ifndef __s390x__
-                          "   sr    0,0\n"
-                          "0: srst  0,%0\n"
-                          "   jo    0b\n"
-                          "   lr    %0,0\n"
-                          "   sr    0,0\n"
-                          "1: mvst  %0,%1\n"
-                          "   jo    1b"
-#else /* __s390x__ */
-                          "   slgr  0,0\n"
-                          "0: srst  0,%0\n"
-                          "   jo    0b\n"
-                          "   lgr   %0,0\n"
-                          "   slgr  0,0\n"
-                          "1: mvst  %0,%1\n"
-                          "   jo    1b"
-#endif /* __s390x__ */
-                          : "+&a" (dest), "+&a" (src) :
-                          : "cc", "memory", "0" );
-    return tmp;
+	asm volatile ("0: mvst  %0,%1\n"
+		      "   jo    0b"
+		      : "+&a" (dst), "+&a" (src) : "d" (r0)
+		      : "cc", "memory" );
+	return ret;
 }
 
-extern void *alloca(size_t);
+static inline size_t strlen(const char *s)
+{
+	register unsigned long r0 asm("0") = 0;
+	const char *tmp = s;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b"
+		      : "+d" (r0), "+a" (tmp) :  : "cc" );
+	return r0 - (unsigned long) s;
+}
+
+static inline size_t strnlen(const char * s, size_t n)
+{
+	register int r0 asm("0") = 0;
+	const char *tmp = s;
+	const char *end = s + n;
+
+	asm volatile ("0: srst  %0,%1\n"
+		      "   jo    0b"
+		      : "+a" (end), "+a" (tmp) : "d" (r0)  : "cc" );
+	return end - s;
+}
+
+#endif /* !IN_ARCH_STRING_C */
+
 #endif /* __KERNEL__ */
 
 #endif /* __S390_STRING_H_ */
diff -Nru a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h
--- a/include/asm-s390/thread_info.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-s390/thread_info.h	Tue Jun 15 22:20:42 2004
@@ -85,6 +85,7 @@
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_RESTART_SVC		4	/* restart svc with new svc number */
 #define TIF_SYSCALL_AUDIT	5	/* syscall auditing active */
+#define TIF_SINGLE_STEP		6	/* single stepped svc */
 #define TIF_USEDFPU		16	/* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG	17	/* true if poll_idle() is polling 
 					   TIF_NEED_RESCHED */
@@ -96,6 +97,7 @@
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_RESTART_SVC	(1<<TIF_RESTART_SVC)
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
+#define _TIF_SINGLE_STEP	(1<<TIF_SINGLE_STEP)
 #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_31BIT		(1<<TIF_31BIT)
diff -Nru a/include/asm-s390/types.h b/include/asm-s390/types.h
--- a/include/asm-s390/types.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-s390/types.h	Tue Jun 15 22:20:40 2004
@@ -79,6 +79,8 @@
 
 typedef u32 dma_addr_t;
 
+typedef unsigned int kmem_bufctl_t;
+
 #ifndef __s390x__
 typedef union {
 	unsigned long long pair;
diff -Nru a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
--- a/include/asm-s390/uaccess.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-s390/uaccess.h	Tue Jun 15 22:20:37 2004
@@ -65,9 +65,10 @@
 
 #define access_ok(type,addr,size) __access_ok(addr,size)
 
-extern inline int verify_area(int type, const void * addr, unsigned long size)
+extern inline int verify_area(int type, const void __user *addr,
+						unsigned long size)
 {
-        return access_ok(type,addr,size)?0:-EFAULT;
+	return access_ok(type, addr, size) ? 0 : -EFAULT;
 }
 
 /*
@@ -119,7 +120,7 @@
  * These are the main single-value transfer routines.  They automatically
  * use the right size if we just have the right pointer type.
  */
-#if __GNUC__ > 2
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
 #define __put_user_asm(x, ptr, err) \
 ({								\
 	err = 0;						\
@@ -147,6 +148,7 @@
 })
 #endif
 
+#ifndef __CHECKER__
 #define __put_user(x, ptr) \
 ({								\
 	__typeof__(*(ptr)) __x = (x);				\
@@ -164,6 +166,14 @@
 	 }							\
 	__pu_err;						\
 })
+#else
+#define __put_user(x, ptr)			\
+({						\
+	void __user *p;				\
+	p = (ptr);				\
+	0;					\
+})
+#endif
 
 #define put_user(x, ptr)					\
 ({								\
@@ -174,7 +184,7 @@
 
 extern int __put_user_bad(void);
 
-#if __GNUC__ > 2
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
 #define __get_user_asm(x, ptr, err) \
 ({								\
 	err = 0;						\
@@ -202,6 +212,7 @@
 })
 #endif
 
+#ifndef __CHECKER__
 #define __get_user(x, ptr)					\
 ({								\
 	__typeof__(*(ptr)) __x;					\
@@ -221,6 +232,15 @@
 	(x) = __x;						\
 	__gu_err;						\
 })
+#else
+#define __get_user(x, ptr)			\
+({						\
+	void __user *p;				\
+	p = (ptr);				\
+	0;					\
+})
+#endif
+
 
 #define get_user(x, ptr)					\
 ({								\
@@ -230,7 +250,7 @@
 
 extern int __get_user_bad(void);
 
-extern long __copy_to_user_asm(const void *from, long n, void *to);
+extern long __copy_to_user_asm(const void *from, long n, void __user *to);
 
 /**
  * __copy_to_user: - Copy a block of data into user space, with less checking.
@@ -274,7 +294,7 @@
 	return n;
 }
 
-extern long __copy_from_user_asm(void *to, long n, const void *from);
+extern long __copy_from_user_asm(void *to, long n, const void __user *from);
 
 /**
  * __copy_from_user: - Copy a block of data from user space, with less checking.
@@ -326,12 +346,13 @@
 	return n;
 }
 
-extern long __copy_in_user_asm(const void *from, long n, void *to);
+extern unsigned long __copy_in_user_asm(const void __user *from, long n,
+							void __user *to);
 
 static inline unsigned long
 __copy_in_user(void __user *to, const void __user *from, unsigned long n)
 {
-	__copy_in_user_asm(from, n, to);
+	return __copy_in_user_asm(from, n, to);
 }
 
 static inline unsigned long
@@ -346,26 +367,27 @@
 /*
  * Copy a null terminated string from userspace.
  */
-extern long __strncpy_from_user_asm(char *dst, const char *src, long count);
+extern long __strncpy_from_user_asm(long count, char *dst,
+					const char __user *src);
 
 static inline long
-strncpy_from_user(char *dst, const char *src, long count)
+strncpy_from_user(char *dst, const char __user *src, long count)
 {
         long res = -EFAULT;
         might_sleep();
         if (access_ok(VERIFY_READ, src, 1))
-                res = __strncpy_from_user_asm(dst, src, count);
+                res = __strncpy_from_user_asm(count, dst, src);
         return res;
 }
 
 
-extern long __strnlen_user_asm(const char *src, long count);
+extern long __strnlen_user_asm(long count, const char __user *src);
 
 static inline unsigned long
-strnlen_user(const char * src, unsigned long n)
+strnlen_user(const char __user * src, unsigned long n)
 {
 	might_sleep();
-	return __strnlen_user_asm(src, n);
+	return __strnlen_user_asm(n, src);
 }
 
 /**
@@ -388,16 +410,16 @@
  * Zero Userspace
  */
 
-extern long __clear_user_asm(void *to, long n);
+extern long __clear_user_asm(void __user *to, long n);
 
 static inline unsigned long
-__clear_user(void *to, unsigned long n)
+__clear_user(void __user *to, unsigned long n)
 {
 	return __clear_user_asm(to, n);
 }
 
 static inline unsigned long
-clear_user(void *to, unsigned long n)
+clear_user(void __user *to, unsigned long n)
 {
 	might_sleep();
 	if (access_ok(VERIFY_WRITE, to, n))
diff -Nru a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
--- a/include/asm-s390/unistd.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-s390/unistd.h	Tue Jun 15 22:21:05 2004
@@ -512,6 +512,30 @@
 	__syscall_return(type,__res);			     \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+# ifndef CONFIG_ARCH_S390X
+#   define __ARCH_WANT_STAT64
+# endif
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/config.h>
diff -Nru a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h
--- a/include/asm-sh/atomic.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-sh/atomic.h	Tue Jun 15 22:20:43 2004
@@ -53,6 +53,8 @@
 	return temp;
 }
 
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
+
 static __inline__ int atomic_sub_return(int i, atomic_t * v)
 {
 	unsigned long temp, flags;
@@ -68,6 +70,16 @@
 
 #define atomic_dec_return(v) atomic_sub_return(1,(v))
 #define atomic_inc_return(v) atomic_add_return(1,(v))
+
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
 
 #define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
 #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
diff -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	Tue Jun 15 22:20:58 2004
+++ b/include/asm-sh/cpu-sh2/cacheflush.h	Tue Jun 15 22:20:58 2004
@@ -30,6 +30,8 @@
 #define flush_cache_range(vma, start, end)	do { } while (0)
 #define flush_cache_page(vma, vmaddr)		do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_range(start, end)		do { } while (0)
 #define flush_icache_page(vma,pg)		do { } while (0)
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
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	Tue Jun 15 22:20:39 2004
+++ b/include/asm-sh/cpu-sh3/cacheflush.h	Tue Jun 15 22:20:39 2004
@@ -30,6 +30,8 @@
 #define flush_cache_range(vma, start, end)	do { } while (0)
 #define flush_cache_page(vma, vmaddr)		do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_range(start, end)		do { } while (0)
 #define flush_icache_page(vma,pg)		do { } while (0)
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
diff -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	Tue Jun 15 22:20:39 2004
+++ b/include/asm-sh/cpu-sh4/cacheflush.h	Tue Jun 15 22:20:39 2004
@@ -30,6 +30,10 @@
 			      unsigned long end);
 extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr);
 extern void flush_dcache_page(struct page *pg);
+
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
+
 extern void flush_icache_range(unsigned long start, unsigned long end);
 extern void flush_cache_sigtramp(unsigned long addr);
 extern void flush_icache_user_range(struct vm_area_struct *vma,
diff -Nru a/include/asm-sh/flat.h b/include/asm-sh/flat.h
--- a/include/asm-sh/flat.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sh/flat.h	Tue Jun 15 22:20:37 2004
@@ -16,7 +16,7 @@
 #define	flat_argvp_envp_on_stack()		1
 #define	flat_old_ram_flag(flags)		(flags)
 #define	flat_reloc_valid(reloc, size)		((reloc) <= (size))
-#define	flat_get_addr_from_rp(rp, relval)	get_unaligned(rp)
+#define	flat_get_addr_from_rp(rp, relval, flags)	get_unaligned(rp)
 #define	flat_put_addr_at_rp(rp, val, relval)	put_unaligned(val,rp)
 #define	flat_get_relocate_addr(rel)		(rel)
 
diff -Nru a/include/asm-sh/ide.h b/include/asm-sh/ide.h
--- a/include/asm-sh/ide.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-sh/ide.h	Tue Jun 15 22:20:38 2004
@@ -22,6 +22,8 @@
 #define MAX_HWIFS	2
 #endif
 
+#define IDE_ARCH_OBSOLETE_DEFAULTS
+
 static inline int ide_default_irq_hp600(unsigned long base)
 {
 	switch (base) {
@@ -71,6 +73,9 @@
 			return 0;
 	}
 }
+
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #ifdef CONFIG_PCI
 #define ide_init_default_irq(base)	(0)
diff -Nru a/include/asm-sh/mc146818rtc.h b/include/asm-sh/mc146818rtc.h
--- a/include/asm-sh/mc146818rtc.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-sh/mc146818rtc.h	Tue Jun 15 22:21:03 2004
@@ -16,7 +16,6 @@
 
 /* FIXME:RTC Interrupt feature is not implemented yet. */
 #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.h b/include/asm-sh/pgtable.h
--- a/include/asm-sh/pgtable.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-sh/pgtable.h	Tue Jun 15 22:21:05 2004
@@ -274,8 +274,6 @@
 
 #define pte_same(A,B)	(pte_val(A) == pte_val(B))
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #define kern_addr_valid(addr)	(1)
diff -Nru a/include/asm-sh/rmap.h b/include/asm-sh/rmap.h
--- a/include/asm-sh/rmap.h	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _SH_RMAP_H
-#define _SH_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
--- a/include/asm-sh/spinlock.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-sh/spinlock.h	Tue Jun 15 22:20:38 2004
@@ -25,6 +25,7 @@
 
 #define spin_is_locked(x)	((x)->lock != 0)
 #define spin_unlock_wait(x)	do { barrier(); } while (spin_is_locked(x))
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 /*
  * Simple spin lock operations.  There are two variants, one clears IRQ's
diff -Nru a/include/asm-sh/types.h b/include/asm-sh/types.h
--- a/include/asm-sh/types.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-sh/types.h	Tue Jun 15 22:21:02 2004
@@ -58,6 +58,8 @@
 #define HAVE_SECTOR_T
 #endif
 
+typedef unsigned int kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
--- a/include/asm-sh/unistd.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-sh/unistd.h	Tue Jun 15 22:20:44 2004
@@ -400,6 +400,31 @@
 __syscall_return(type,__sc0); \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
diff -Nru a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h
--- a/include/asm-sparc/atomic.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-sparc/atomic.h	Tue Jun 15 22:20:42 2004
@@ -33,6 +33,18 @@
 #define atomic_inc_return(v)	(__atomic_add_return(        1, (v)))
 #define atomic_dec_return(v)	(__atomic_add_return(       -1, (v)))
 
+#define atomic_add_negative(a, v)	(atomic_add_return((a), (v)) < 0)
+
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
+
 #define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
 
 /* This is the old 24-bit implementation.  It's still used internally
diff -Nru a/include/asm-sparc/cacheflush.h b/include/asm-sparc/cacheflush.h
--- a/include/asm-sparc/cacheflush.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-sparc/cacheflush.h	Tue Jun 15 22:20:38 2004
@@ -70,6 +70,8 @@
 extern void sparc_flush_page_to_ram(struct page *page);
 
 #define flush_dcache_page(page)			sparc_flush_page_to_ram(page)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 
 #define flush_cache_vmap(start, end)		flush_cache_all()
 #define flush_cache_vunmap(start, end)		flush_cache_all()
diff -Nru a/include/asm-sparc/dma-mapping.h b/include/asm-sparc/dma-mapping.h
--- a/include/asm-sparc/dma-mapping.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-sparc/dma-mapping.h	Tue Jun 15 22:21:04 2004
@@ -2,6 +2,7 @@
 #define _ASM_SPARC_DMA_MAPPING_H
 
 #include <linux/config.h>
+#include <linux/device.h>
 
 #ifdef CONFIG_PCI
 #include <asm-generic/dma-mapping.h>
diff -Nru a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h
--- a/include/asm-sparc/hardirq.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-sparc/hardirq.h	Tue Jun 15 22:21:05 2004
@@ -57,15 +57,6 @@
 #define HARDIRQ_OFFSET  (1UL << HARDIRQ_SHIFT)
 
 /*
- * The hardirq mask has to be large enough to have
- * space for potentially all IRQ sources in the system
- * nesting on a single CPU:
- */
-#if (1 << HARDIRQ_BITS) < NR_IRQS
-# error HARDIRQ_BITS is too low!
-#endif
-
-/*
  * Are we doing bottom half or hardware interrupt processing?
  * Are we in a softirq context? Interrupt context?
  */
diff -Nru a/include/asm-sparc/highmem.h b/include/asm-sparc/highmem.h
--- a/include/asm-sparc/highmem.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-sparc/highmem.h	Tue Jun 15 22:21:05 2004
@@ -24,7 +24,7 @@
 #include <asm/fixmap.h>
 #include <asm/vaddrs.h>
 #include <asm/kmap_types.h>
-#include <asm/pgtsrmmu.h>
+#include <asm/pgtable.h>
 
 /* declarations for highmem.c */
 extern unsigned long highstart_pfn, highend_pfn;
@@ -43,7 +43,7 @@
  */
 #define LAST_PKMAP 1024
 #define PKMAP_SIZE (LAST_PKMAP << PAGE_SHIFT)
-#define PKMAP_BASE SRMMU_PMD_ALIGN_SOFT(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT))
+#define PKMAP_BASE PMD_ALIGN(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT))
 
 #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
 #define PKMAP_NR(virt)  ((virt - PKMAP_BASE) >> PAGE_SHIFT)
diff -Nru a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
--- a/include/asm-sparc/ide.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-sparc/ide.h	Tue Jun 15 22:20:40 2004
@@ -19,17 +19,8 @@
 #undef  MAX_HWIFS
 #define MAX_HWIFS	2
 
-static __inline__ int ide_default_irq(unsigned long base)
-{
-	return 0;
-}
-
-static __inline__ unsigned long ide_default_io_base(int index)
-{
-	return 0;
-}
-
-#define ide_init_default_irq(base)	(0)
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #define __ide_insl(data_reg, buffer, wcount) \
 	__ide_insw(data_reg, buffer, (wcount)<<1)
diff -Nru a/include/asm-sparc/ipc.h b/include/asm-sparc/ipc.h
--- a/include/asm-sparc/ipc.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-sparc/ipc.h	Tue Jun 15 22:20:36 2004
@@ -7,7 +7,7 @@
  * See arch/sparc/kernel/sys_sparc.c for ugly details..
  */
 struct ipc_kludge {
-	struct msgbuf *msgp;
+	struct msgbuf __user *msgp;
 	long msgtyp;
 };
 
diff -Nru a/include/asm-sparc/kmap_types.h b/include/asm-sparc/kmap_types.h
--- a/include/asm-sparc/kmap_types.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc/kmap_types.h	Tue Jun 15 22:20:37 2004
@@ -11,7 +11,6 @@
 	KM_BIO_DST_IRQ,
 	KM_PTE0,
 	KM_PTE1,
-	KM_PTE2,
 	KM_IRQ0,
 	KM_IRQ1,
 	KM_SOFTIRQ0,
diff -Nru a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
--- a/include/asm-sparc/pgtable.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-sparc/pgtable.h	Tue Jun 15 22:20:41 2004
@@ -75,29 +75,10 @@
 #define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len)
 #define mmu_translate_dvma(ba)     BTFIXUP_CALL(mmu_translate_dvma)(ba)
 
-/*
- */
-BTFIXUPDEF_SIMM13(pmd_shift)
-BTFIXUPDEF_SETHI(pmd_size)
-BTFIXUPDEF_SETHI(pmd_mask)
-
-extern unsigned int pmd_align(unsigned int addr) __attribute_const__;
-extern __inline__ unsigned int pmd_align(unsigned int addr)
-{
-	return ((addr + ~BTFIXUP_SETHI(pmd_mask)) & BTFIXUP_SETHI(pmd_mask));
-}
-
 BTFIXUPDEF_SIMM13(pgdir_shift)
 BTFIXUPDEF_SETHI(pgdir_size)
 BTFIXUPDEF_SETHI(pgdir_mask)
 
-extern unsigned int pgdir_align(unsigned int addr) __attribute_const__;
-extern __inline__ unsigned int pgdir_align(unsigned int addr)
-{
-	return ((addr + ~BTFIXUP_SETHI(pgdir_mask)) & BTFIXUP_SETHI(pgdir_mask));
-}
-
-BTFIXUPDEF_SIMM13(ptrs_per_pte)
 BTFIXUPDEF_SIMM13(ptrs_per_pmd)
 BTFIXUPDEF_SIMM13(ptrs_per_pgd)
 BTFIXUPDEF_SIMM13(user_ptrs_per_pgd)
@@ -112,19 +93,19 @@
 BTFIXUPDEF_INT(page_readonly)
 BTFIXUPDEF_INT(page_kernel)
 
-#define PMD_SHIFT       	BTFIXUP_SIMM13(pmd_shift)
-#define PMD_SIZE        	BTFIXUP_SETHI(pmd_size)
-#define PMD_MASK        	BTFIXUP_SETHI(pmd_mask)
-#define PMD_ALIGN(addr) 	pmd_align(addr)
+#define PMD_SHIFT		SUN4C_PMD_SHIFT
+#define PMD_SIZE        	(1UL << PMD_SHIFT)
+#define PMD_MASK        	(~(PMD_SIZE-1))
+#define PMD_ALIGN(__addr) 	(((__addr) + ~PMD_MASK) & PMD_MASK)
 #define PGDIR_SHIFT     	BTFIXUP_SIMM13(pgdir_shift)
 #define PGDIR_SIZE      	BTFIXUP_SETHI(pgdir_size)
 #define PGDIR_MASK      	BTFIXUP_SETHI(pgdir_mask)
-#define PGDIR_ALIGN     	pgdir_align(addr)
-#define PTRS_PER_PTE    	BTFIXUP_SIMM13(ptrs_per_pte)
+#define PTRS_PER_PTE    	1024
 #define PTRS_PER_PMD    	BTFIXUP_SIMM13(ptrs_per_pmd)
 #define PTRS_PER_PGD    	BTFIXUP_SIMM13(ptrs_per_pgd)
 #define USER_PTRS_PER_PGD	BTFIXUP_SIMM13(user_ptrs_per_pgd)
 #define FIRST_USER_PGD_NR	0
+#define PTE_SIZE		(PTRS_PER_PTE*4)
 
 #define PAGE_NONE      __pgprot(BTFIXUP_INT(page_none))
 #define PAGE_SHARED    __pgprot(BTFIXUP_INT(page_shared))
@@ -496,8 +477,6 @@
 			       unsigned long size, pgprot_t prot, int space);
 
 #include <asm-generic/pgtable.h>
-
-typedef pte_t *pte_addr_t;
 
 #endif /* !(__ASSEMBLY__) */
 
diff -Nru a/include/asm-sparc/pgtsrmmu.h b/include/asm-sparc/pgtsrmmu.h
--- a/include/asm-sparc/pgtsrmmu.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-sparc/pgtsrmmu.h	Tue Jun 15 22:20:38 2004
@@ -17,10 +17,10 @@
 #define SRMMU_MAX_CONTEXTS	65536
 
 /* PMD_SHIFT determines the size of the area a second-level page table entry can map */
-#define SRMMU_PMD_SHIFT         18
-#define SRMMU_PMD_SIZE          (1UL << SRMMU_PMD_SHIFT)
-#define SRMMU_PMD_MASK          (~(SRMMU_PMD_SIZE-1))
-/* #define SRMMU_PMD_ALIGN(addr)   (((addr)+SRMMU_PMD_SIZE-1)&SRMMU_PMD_MASK) */
+#define SRMMU_REAL_PMD_SHIFT		18
+#define SRMMU_REAL_PMD_SIZE		(1UL << SRMMU_REAL_PMD_SHIFT)
+#define SRMMU_REAL_PMD_MASK		(~(SRMMU_REAL_PMD_SIZE-1))
+#define SRMMU_REAL_PMD_ALIGN(__addr)	(((__addr)+SRMMU_REAL_PMD_SIZE-1)&SRMMU_REAL_PMD_MASK)
 
 /* PGDIR_SHIFT determines what a third-level page table entry can map */
 #define SRMMU_PGDIR_SHIFT       24
@@ -28,13 +28,13 @@
 #define SRMMU_PGDIR_MASK        (~(SRMMU_PGDIR_SIZE-1))
 #define SRMMU_PGDIR_ALIGN(addr) (((addr)+SRMMU_PGDIR_SIZE-1)&SRMMU_PGDIR_MASK)
 
-#define SRMMU_PTRS_PER_PTE      64
-#define SRMMU_PTRS_PER_PMD      64
-#define SRMMU_PTRS_PER_PGD      256
-
-#define SRMMU_PTE_TABLE_SIZE    0x100 /* 64 entries, 4 bytes a piece */
-#define SRMMU_PMD_TABLE_SIZE    0x100 /* 64 entries, 4 bytes a piece */
-#define SRMMU_PGD_TABLE_SIZE    0x400 /* 256 entries, 4 bytes a piece */
+#define SRMMU_REAL_PTRS_PER_PTE	64
+#define SRMMU_REAL_PTRS_PER_PMD	64
+#define SRMMU_PTRS_PER_PGD	256
+
+#define SRMMU_REAL_PTE_TABLE_SIZE	(SRMMU_REAL_PTRS_PER_PTE*4)
+#define SRMMU_PMD_TABLE_SIZE		(SRMMU_REAL_PTRS_PER_PMD*4)
+#define SRMMU_PGD_TABLE_SIZE		(SRMMU_PTRS_PER_PGD*4)
 
 /*
  * To support pagetables in highmem, Linux introduces APIs which
@@ -44,16 +44,11 @@
  * software tables.
  *
  * PMD_SHIFT determines the size of the area a second-level page table entry
- * can map, and our pmd_t is 16 times larger than normal.
+ * can map, and our pmd_t is 16 times larger than normal.  The values which
+ * were once defined here are now generic for 4c and srmmu, so they're
+ * found in pgtable.h.
  */
-#define SRMMU_PTRS_PER_PTE_SOFT	(PAGE_SIZE/4)	/* 16 hard tables per 4K page */
-#define SRMMU_PTRS_PER_PMD_SOFT	4	/* Each pmd_t contains 16 hard PTPs */
-#define SRMMU_PTE_SZ_SOFT       PAGE_SIZE	/* same as above, in bytes */
-
-#define SRMMU_PMD_SHIFT_SOFT	22
-#define SRMMU_PMD_SIZE_SOFT	(1UL << SRMMU_PMD_SHIFT_SOFT)
-#define SRMMU_PMD_MASK_SOFT	(~(SRMMU_PMD_SIZE_SOFT-1))
-#define SRMMU_PMD_ALIGN_SOFT(addr)  (((addr)+SRMMU_PMD_SIZE_SOFT-1)&SRMMU_PMD_MASK_SOFT)
+#define SRMMU_PTRS_PER_PMD	4
 
 /* Definition of the values in the ET field of PTD's and PTE's */
 #define SRMMU_ET_MASK         0x3
@@ -255,7 +250,7 @@
 
 extern __inline__ void srmmu_flush_tlb_segment(unsigned long addr)
 {
-	addr &= SRMMU_PMD_MASK;
+	addr &= SRMMU_REAL_PMD_MASK;
 	__asm__ __volatile__("sta %%g0, [%0] %1\n\t": :
 			     "r" (addr | 0x100), /* Flush TLB segment.. */
 			     "i" (ASI_M_FLUSH_PROBE) : "memory");
diff -Nru a/include/asm-sparc/pgtsun4.h b/include/asm-sparc/pgtsun4.h
--- a/include/asm-sparc/pgtsun4.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc/pgtsun4.h	Tue Jun 15 22:20:37 2004
@@ -11,9 +11,6 @@
 
 /* PMD_SHIFT determines the size of the area a second-level page table can map */
 #define SUN4C_PMD_SHIFT       23
-#define SUN4C_PMD_SIZE        (1UL << SUN4C_PMD_SHIFT)
-#define SUN4C_PMD_MASK        (~(SUN4C_PMD_SIZE-1))
-#define SUN4C_PMD_ALIGN(addr) (((addr)+SUN4C_PMD_SIZE-1)&SUN4C_PMD_MASK)
 
 /* PGDIR_SHIFT determines what a third-level page table entry can map */
 #define SUN4C_PGDIR_SHIFT       23
diff -Nru a/include/asm-sparc/pgtsun4c.h b/include/asm-sparc/pgtsun4c.h
--- a/include/asm-sparc/pgtsun4c.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc/pgtsun4c.h	Tue Jun 15 22:20:37 2004
@@ -10,9 +10,6 @@
 
 /* PMD_SHIFT determines the size of the area a second-level page table can map */
 #define SUN4C_PMD_SHIFT       22
-#define SUN4C_PMD_SIZE        (1UL << SUN4C_PMD_SHIFT)
-#define SUN4C_PMD_MASK        (~(SUN4C_PMD_SIZE-1))
-#define SUN4C_PMD_ALIGN(addr) (((addr)+SUN4C_PMD_SIZE-1)&SUN4C_PMD_MASK)
 
 /* PGDIR_SHIFT determines what a third-level page table entry can map */
 #define SUN4C_PGDIR_SHIFT       22
diff -Nru a/include/asm-sparc/rmap.h b/include/asm-sparc/rmap.h
--- a/include/asm-sparc/rmap.h	Tue Jun 15 22:21:03 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _SPARC_RMAP_H
-#define _SPARC_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
--- a/include/asm-sparc/sbus.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc/sbus.h	Tue Jun 15 22:20:37 2004
@@ -7,6 +7,7 @@
 #ifndef _SPARC_SBUS_H
 #define _SPARC_SBUS_H
 
+#include <linux/dma-mapping.h>
 #include <linux/ioport.h>
 
 #include <asm/oplib.h>
@@ -106,10 +107,10 @@
 extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp);
 extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32);
 
-#define SBUS_DMA_BIDIRECTIONAL	0
-#define SBUS_DMA_TODEVICE	1
-#define SBUS_DMA_FROMDEVICE	2
-#define	SBUS_DMA_NONE		3
+#define SBUS_DMA_BIDIRECTIONAL	DMA_BIDIRECTIONAL
+#define SBUS_DMA_TODEVICE	DMA_TO_DEVICE
+#define SBUS_DMA_FROMDEVICE	DMA_FROM_DEVICE
+#define	SBUS_DMA_NONE		DMA_NONE
 
 /* All the rest use streaming mode mappings. */
 extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int);
diff -Nru a/include/asm-sparc/semaphore.h b/include/asm-sparc/semaphore.h
--- a/include/asm-sparc/semaphore.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-sparc/semaphore.h	Tue Jun 15 22:21:05 2004
@@ -13,12 +13,12 @@
 	atomic24_t count;
 	int sleepers;
 	wait_queue_head_t wait;
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	long __magic;
 #endif
 };
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 # define __SEM_DEBUG_INIT(name) \
 		, (long)&(name).__magic
 #else
@@ -43,7 +43,7 @@
 	atomic24_set(&sem->count, val);
 	sem->sleepers = 0;
 	init_waitqueue_head(&sem->wait);
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	sem->__magic = (long)&sem->__magic;
 #endif
 }
@@ -68,7 +68,7 @@
 	register volatile int *ptr asm("g1");
 	register int increment asm("g2");
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -105,7 +105,7 @@
 	register volatile int *ptr asm("g1");
 	register int increment asm("g2");
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -145,7 +145,7 @@
 	register volatile int *ptr asm("g1");
 	register int increment asm("g2");
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
@@ -184,7 +184,7 @@
 	register volatile int *ptr asm("g1");
 	register int increment asm("g2");
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
diff -Nru a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
--- a/include/asm-sparc/signal.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-sparc/signal.h	Tue Jun 15 22:20:41 2004
@@ -199,7 +199,7 @@
 #ifdef __KERNEL__
 struct k_sigaction {
 	struct __new_sigaction	sa;
-	void			*ka_restorer;
+	void			__user *ka_restorer;
 };
 #endif
 
@@ -211,7 +211,7 @@
 };
 
 typedef struct sigaltstack {
-	void		*ss_sp;
+	void		__user *ss_sp;
 	int		ss_flags;
 	size_t		ss_size;
 } stack_t;
diff -Nru a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
--- a/include/asm-sparc/spinlock.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-sparc/spinlock.h	Tue Jun 15 22:20:43 2004
@@ -216,6 +216,8 @@
 
 #endif /* CONFIG_DEBUG_SPINLOCK */
 
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
+
 #endif /* !(__ASSEMBLY__) */
 
 #endif /* __SPARC_SPINLOCK_H */
diff -Nru a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h
--- a/include/asm-sparc/thread_info.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-sparc/thread_info.h	Tue Jun 15 22:21:03 2004
@@ -17,6 +17,7 @@
 
 #include <asm/btfixup.h>
 #include <asm/ptrace.h>
+#include <asm/page.h>
 
 /*
  * Low level task data.
diff -Nru a/include/asm-sparc/types.h b/include/asm-sparc/types.h
--- a/include/asm-sparc/types.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-sparc/types.h	Tue Jun 15 22:20:40 2004
@@ -54,6 +54,8 @@
 typedef u32 dma_addr_t;
 typedef u32 dma64_addr_t;
 
+typedef unsigned short kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h
--- a/include/asm-sparc/uaccess.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-sparc/uaccess.h	Tue Jun 15 22:20:58 2004
@@ -94,10 +94,12 @@
  */
 #define put_user(x,ptr) ({ \
 unsigned long __pu_addr = (unsigned long)(ptr); \
+__chk_user_ptr(ptr); \
 __put_user_check((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); })
 
 #define get_user(x,ptr) ({ \
 unsigned long __gu_addr = (unsigned long)(ptr); \
+__chk_user_ptr(ptr); \
 __get_user_check((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); })
 
 /*
@@ -292,32 +294,32 @@
 
 extern int __get_user_bad(void);
 
-extern unsigned long __copy_user(void *to, const void *from, unsigned long size);
+extern unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);
 
 static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
 {
 	if (n && __access_ok((unsigned long) to, n))
-		return __copy_user((void *) to, from, n);
+		return __copy_user(to, (void __user *) from, n);
 	else
 		return n;
 }
 
 static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
 {
-	return __copy_user((void *)to, from, n);
+	return __copy_user(to, (void __user *) from, n);
 }
 
 static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
 {
 	if (n && __access_ok((unsigned long) from, n))
-		return __copy_user(to, (void *) from, n);
+		return __copy_user((void __user *) to, from, n);
 	else
 		return n;
 }
 
 static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
 {
-	return __copy_user(to, (void *)from, n);
+	return __copy_user((void __user *) to, from, n);
 }
 
 static inline unsigned long __clear_user(void __user *addr, unsigned long size)
diff -Nru a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
--- a/include/asm-sparc/unistd.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-sparc/unistd.h	Tue Jun 15 22:20:36 2004
@@ -431,6 +431,30 @@
 errno = -__res; \
 return -1; \
 }
+
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
diff -Nru a/include/asm-sparc/viking.h b/include/asm-sparc/viking.h
--- a/include/asm-sparc/viking.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-sparc/viking.h	Tue Jun 15 22:20:43 2004
@@ -236,7 +236,7 @@
 			     : "=r" (val)
 			     : "r" (vaddr | 0x100), "i" (ASI_M_FLUSH_PROBE));
 	if ((val & SRMMU_ET_MASK) == SRMMU_ET_PTE) {
-		vaddr &= ~SRMMU_PMD_MASK;
+		vaddr &= ~SRMMU_REAL_PMD_MASK;
 		vaddr >>= PAGE_SHIFT;
 		return val | (vaddr << 8);
 	}
diff -Nru a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
--- a/include/asm-sparc64/atomic.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-sparc64/atomic.h	Tue Jun 15 22:21:02 2004
@@ -40,6 +40,16 @@
 #define atomic_inc_return(v) __atomic_add(1, v)
 #define atomic64_inc_return(v) __atomic64_add(1, v)
 
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
+
 #define atomic_sub_and_test(i, v) (__atomic_sub(i, v) == 0)
 #define atomic64_sub_and_test(i, v) (__atomic64_sub(i, v) == 0)
 
@@ -51,6 +61,9 @@
 
 #define atomic_dec(v) ((void)__atomic_sub(1, v))
 #define atomic64_dec(v) ((void)__atomic64_sub(1, v))
+
+#define atomic_add_negative(i, v) (__atomic_add(i, v) < 0)
+#define atomic64_add_negative(i, v) (__atomic64_add(i, v) < 0)
 
 /* Atomic operations are already serializing */
 #define smp_mb__before_atomic_dec()	barrier()
diff -Nru a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
--- a/include/asm-sparc64/bitops.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc64/bitops.h	Tue Jun 15 22:20:37 2004
@@ -204,43 +204,7 @@
  * @offset: The bitnumber to start searching at
  * @size: The maximum size to search
  */
-static __inline__ unsigned long find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset)
-{
-	unsigned long *p = addr + (offset >> 6);
-	unsigned long result = offset & ~63UL;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 63UL;
-	if (offset) {
-		tmp = *(p++);
-		tmp &= (~0UL << offset);
-		if (size < 64)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= 64;
-		result += 64;
-	}
-	while (size & ~63UL) {
-		if ((tmp = *(p++)))
-			goto found_middle;
-		result += 64;
-		size -= 64;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp &= (~0UL >> (64 - size));
-	if (tmp == 0UL)        /* Are any bits set? */
-		return result + size; /* Nope. */
-found_middle:
-	return result + __ffs(tmp);
-}
+extern unsigned long find_next_bit(unsigned long *, unsigned long, unsigned long);
 
 /**
  * find_first_bit - find the first set bit in a memory region
@@ -258,43 +222,7 @@
  * on Linus's ALPHA routines, which are pretty portable BTW.
  */
 
-static __inline__ unsigned long find_next_zero_bit(unsigned long *addr, unsigned long size, unsigned long offset)
-{
-	unsigned long *p = addr + (offset >> 6);
-	unsigned long result = offset & ~63UL;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 63UL;
-	if (offset) {
-		tmp = *(p++);
-		tmp |= ~0UL >> (64-offset);
-		if (size < 64)
-			goto found_first;
-		if (~tmp)
-			goto found_middle;
-		size -= 64;
-		result += 64;
-	}
-	while (size & ~63UL) {
-		if (~(tmp = *(p++)))
-			goto found_middle;
-		result += 64;
-		size -= 64;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)        /* Are any bits zero? */
-		return result + size; /* Nope. */
-found_middle:
-	return result + ffz(tmp);
-}
+extern unsigned long find_next_zero_bit(unsigned long *, unsigned long, unsigned long);
 
 #define find_first_zero_bit(addr, size) \
         find_next_zero_bit((addr), (size), 0)
@@ -320,42 +248,7 @@
 #define find_first_zero_le_bit(addr, size) \
         find_next_zero_le_bit((addr), (size), 0)
 
-static __inline__ unsigned long find_next_zero_le_bit(unsigned long *addr, unsigned long size, unsigned long offset)
-{
-	unsigned long *p = addr + (offset >> 6);
-	unsigned long result = offset & ~63UL;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 63UL;
-	if(offset) {
-		tmp = __swab64p(p++);
-		tmp |= (~0UL >> (64-offset));
-		if(size < 64)
-			goto found_first;
-		if(~tmp)
-			goto found_middle;
-		size -= 64;
-		result += 64;
-	}
-	while(size & ~63) {
-		if(~(tmp = __swab64p(p++)))
-			goto found_middle;
-		result += 64;
-		size -= 64;
-	}
-	if(!size)
-		return result;
-	tmp = __swab64p(p);
-found_first:
-	tmp |= (~0UL << size);
-	if (tmp == ~0UL)        /* Are any bits zero? */
-		return result + size; /* Nope. */
-found_middle:
-	return result + ffz(tmp);
-}
+extern unsigned long find_next_zero_le_bit(unsigned long *, unsigned long, unsigned long);
 
 #ifdef __KERNEL__
 
diff -Nru a/include/asm-sparc64/cacheflush.h b/include/asm-sparc64/cacheflush.h
--- a/include/asm-sparc64/cacheflush.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-sparc64/cacheflush.h	Tue Jun 15 22:21:04 2004
@@ -42,6 +42,8 @@
 	memcpy(dst, src, len)
 
 extern void flush_dcache_page(struct page *page);
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	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-sparc64/chmctrl.h b/include/asm-sparc64/chmctrl.h
--- a/include/asm-sparc64/chmctrl.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-sparc64/chmctrl.h	Tue Jun 15 22:20:38 2004
@@ -14,171 +14,171 @@
 #define CHMCTRL_MACTRL		0x30 /* Memory Address Control		*/
 
 /* Memory Timing Control I */
-#define TCTRL1_SDRAMCTL_DLY	0xf000000000000000
+#define TCTRL1_SDRAMCTL_DLY	0xf000000000000000UL
 #define TCTRL1_SDRAMCTL_DLY_SHIFT     60
-#define TCTRL1_SDRAMCLK_DLY	0x0e00000000000000
+#define TCTRL1_SDRAMCLK_DLY	0x0e00000000000000UL
 #define TCTRL1_SDRAMCLK_DLY_SHIFT     57
-#define TCTRL1_R		0x0100000000000000
+#define TCTRL1_R		0x0100000000000000UL
 #define TCTRL1_R_SHIFT 		      56
-#define TCTRL1_AUTORFR_CYCLE	0x00fe000000000000
+#define TCTRL1_AUTORFR_CYCLE	0x00fe000000000000UL
 #define TCTRL1_AUTORFR_CYCLE_SHIFT    49
-#define TCTRL1_RD_WAIT		0x0001f00000000000
+#define TCTRL1_RD_WAIT		0x0001f00000000000UL
 #define TCTRL1_RD_WAIT_SHIFT	      44
-#define TCTRL1_PC_CYCLE		0x00000fc000000000
+#define TCTRL1_PC_CYCLE		0x00000fc000000000UL
 #define TCTRL1_PC_CYCLE_SHIFT	      38
-#define TCTRL1_WR_MORE_RAS_PW	0x0000003f00000000
+#define TCTRL1_WR_MORE_RAS_PW	0x0000003f00000000UL
 #define TCTRL1_WR_MORE_RAS_PW_SHIFT   32
-#define TCTRL1_RD_MORE_RAW_PW	0x00000000fc000000
+#define TCTRL1_RD_MORE_RAW_PW	0x00000000fc000000UL
 #define TCTRL1_RD_MORE_RAS_PW_SHIFT   26
-#define TCTRL1_ACT_WR_DLY	0x0000000003f00000
+#define TCTRL1_ACT_WR_DLY	0x0000000003f00000UL
 #define TCTRL1_ACT_WR_DLY_SHIFT	      20
-#define TCTRL1_ACT_RD_DLY	0x00000000000fc000
+#define TCTRL1_ACT_RD_DLY	0x00000000000fc000UL
 #define TCTRL1_ACT_RD_DLY_SHIFT	      14
-#define TCTRL1_BANK_PRESENT	0x0000000000003000
+#define TCTRL1_BANK_PRESENT	0x0000000000003000UL
 #define TCTRL1_BANK_PRESENT_SHIFT     12
-#define TCTRL1_RFR_INT		0x0000000000000ff8
+#define TCTRL1_RFR_INT		0x0000000000000ff8UL
 #define TCTRL1_RFR_INT_SHIFT	      3
-#define TCTRL1_SET_MODE_REG	0x0000000000000004
+#define TCTRL1_SET_MODE_REG	0x0000000000000004UL
 #define TCTRL1_SET_MODE_REG_SHIFT     2
-#define TCTRL1_RFR_ENABLE	0x0000000000000002
+#define TCTRL1_RFR_ENABLE	0x0000000000000002UL
 #define TCTRL1_RFR_ENABLE_SHIFT	      1
-#define TCTRL1_PRECHG_ALL	0x0000000000000001
+#define TCTRL1_PRECHG_ALL	0x0000000000000001UL
 #define TCTRL1_PRECHG_ALL_SHIFT	      0
 
 /* Memory Timing Control II */
-#define TCTRL2_WR_MSEL_DLY	0xfc00000000000000
+#define TCTRL2_WR_MSEL_DLY	0xfc00000000000000UL
 #define TCTRL2_WR_MSEL_DLY_SHIFT      58
-#define TCTRL2_RD_MSEL_DLY	0x03f0000000000000
+#define TCTRL2_RD_MSEL_DLY	0x03f0000000000000UL
 #define TCTRL2_RD_MSEL_DLY_SHIFT      52
-#define TCTRL2_WRDATA_THLD	0x000c000000000000
+#define TCTRL2_WRDATA_THLD	0x000c000000000000UL
 #define TCTRL2_WRDATA_THLD_SHIFT      50
-#define TCTRL2_RDWR_RD_TI_DLY	0x0003f00000000000
+#define TCTRL2_RDWR_RD_TI_DLY	0x0003f00000000000UL
 #define TCTRL2_RDWR_RD_TI_DLY_SHIFT   44
-#define TCTRL2_AUTOPRECHG_ENBL	0x0000080000000000
+#define TCTRL2_AUTOPRECHG_ENBL	0x0000080000000000UL
 #define TCTRL2_AUTOPRECHG_ENBL_SHIFT  43
-#define TCTRL2_RDWR_PI_MORE_DLY	0x000007c000000000
+#define TCTRL2_RDWR_PI_MORE_DLY	0x000007c000000000UL
 #define TCTRL2_RDWR_PI_MORE_DLY_SHIFT 38
-#define TCTRL2_RDWR_1_DLY	0x0000003f00000000
+#define TCTRL2_RDWR_1_DLY	0x0000003f00000000UL
 #define TCTRL2_RDWR_1_DLY_SHIFT       32
-#define TCTRL2_WRWR_PI_MORE_DLY	0x00000000f8000000
+#define TCTRL2_WRWR_PI_MORE_DLY	0x00000000f8000000UL
 #define TCTRL2_WRWR_PI_MORE_DLY_SHIFT 27
-#define TCTRL2_WRWR_1_DLY	0x0000000007e00000
+#define TCTRL2_WRWR_1_DLY	0x0000000007e00000UL
 #define TCTRL2_WRWR_1_DLY_SHIFT       21
-#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000
+#define TCTRL2_RDWR_RD_PI_MORE_DLY 0x00000000001f0000UL
 #define TCTRL2_RDWR_RD_PI_MORE_DLY_SHIFT 16
-#define TCTRL2_R		0x0000000000008000
+#define TCTRL2_R		0x0000000000008000UL
 #define TCTRL2_R_SHIFT		      15
-#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fff
+#define TCTRL2_SDRAM_MODE_REG_DATA 0x0000000000007fffUL
 #define TCTRL2_SDRAM_MODE_REG_DATA_SHIFT 0
 
 /* Memory Timing Control III */
-#define TCTRL3_SDRAM_CTL_DLY	0xf000000000000000
+#define TCTRL3_SDRAM_CTL_DLY	0xf000000000000000UL
 #define TCTRL3_SDRAM_CTL_DLY_SHIFT    60
-#define TCTRL3_SDRAM_CLK_DLY	0x0e00000000000000
+#define TCTRL3_SDRAM_CLK_DLY	0x0e00000000000000UL
 #define TCTRL3_SDRAM_CLK_DLY_SHIFT    57
-#define TCTRL3_R		0x0100000000000000
+#define TCTRL3_R		0x0100000000000000UL
 #define TCTRL3_R_SHIFT		      56
-#define TCTRL3_AUTO_RFR_CYCLE	0x00fe000000000000
+#define TCTRL3_AUTO_RFR_CYCLE	0x00fe000000000000UL
 #define TCTRL3_AUTO_RFR_CYCLE_SHIFT   49
-#define TCTRL3_RD_WAIT		0x0001f00000000000
+#define TCTRL3_RD_WAIT		0x0001f00000000000UL
 #define TCTRL3_RD_WAIT_SHIFT	      44
-#define TCTRL3_PC_CYCLE		0x00000fc000000000
+#define TCTRL3_PC_CYCLE		0x00000fc000000000UL
 #define TCTRL3_PC_CYCLE_SHIFT	      38
-#define TCTRL3_WR_MORE_RAW_PW	0x0000003f00000000
+#define TCTRL3_WR_MORE_RAW_PW	0x0000003f00000000UL
 #define TCTRL3_WR_MORE_RAW_PW_SHIFT   32
-#define TCTRL3_RD_MORE_RAW_PW	0x00000000fc000000
+#define TCTRL3_RD_MORE_RAW_PW	0x00000000fc000000UL
 #define TCTRL3_RD_MORE_RAW_PW_SHIFT   26
-#define TCTRL3_ACT_WR_DLY	0x0000000003f00000
+#define TCTRL3_ACT_WR_DLY	0x0000000003f00000UL
 #define TCTRL3_ACT_WR_DLY_SHIFT       20
-#define TCTRL3_ACT_RD_DLY	0x00000000000fc000
+#define TCTRL3_ACT_RD_DLY	0x00000000000fc000UL
 #define TCTRL3_ACT_RD_DLY_SHIFT       14
-#define TCTRL3_BANK_PRESENT	0x0000000000003000
+#define TCTRL3_BANK_PRESENT	0x0000000000003000UL
 #define TCTRL3_BANK_PRESENT_SHIFT     12
-#define TCTRL3_RFR_INT		0x0000000000000ff8
+#define TCTRL3_RFR_INT		0x0000000000000ff8UL
 #define TCTRL3_RFR_INT_SHIFT	      3
-#define TCTRL3_SET_MODE_REG	0x0000000000000004
+#define TCTRL3_SET_MODE_REG	0x0000000000000004UL
 #define TCTRL3_SET_MODE_REG_SHIFT     2
-#define TCTRL3_RFR_ENABLE	0x0000000000000002
+#define TCTRL3_RFR_ENABLE	0x0000000000000002UL
 #define TCTRL3_RFR_ENABLE_SHIFT       1
-#define TCTRL3_PRECHG_ALL	0x0000000000000001
+#define TCTRL3_PRECHG_ALL	0x0000000000000001UL
 #define TCTRL3_PRECHG_ALL_SHIFT	      0
 
 /* Memory Timing Control IV */
-#define TCTRL4_WR_MSEL_DLY	0xfc00000000000000
+#define TCTRL4_WR_MSEL_DLY	0xfc00000000000000UL
 #define TCTRL4_WR_MSEL_DLY_SHIFT      58
-#define TCTRL4_RD_MSEL_DLY	0x03f0000000000000
+#define TCTRL4_RD_MSEL_DLY	0x03f0000000000000UL
 #define TCTRL4_RD_MSEL_DLY_SHIFT      52
-#define TCTRL4_WRDATA_THLD	0x000c000000000000
+#define TCTRL4_WRDATA_THLD	0x000c000000000000UL
 #define TCTRL4_WRDATA_THLD_SHIFT      50
-#define TCTRL4_RDWR_RD_RI_DLY	0x0003f00000000000
+#define TCTRL4_RDWR_RD_RI_DLY	0x0003f00000000000UL
 #define TCTRL4_RDWR_RD_RI_DLY_SHIFT   44
-#define TCTRL4_AUTO_PRECHG_ENBL	0x0000080000000000
+#define TCTRL4_AUTO_PRECHG_ENBL	0x0000080000000000UL
 #define TCTRL4_AUTO_PRECHG_ENBL_SHIFT 43
-#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000
+#define TCTRL4_RD_WR_PI_MORE_DLY 0x000007c000000000UL
 #define TCTRL4_RD_WR_PI_MORE_DLY_SHIFT 38
-#define TCTRL4_RD_WR_TI_DLY	0x0000003f00000000
+#define TCTRL4_RD_WR_TI_DLY	0x0000003f00000000UL
 #define TCTRL4_RD_WR_TI_DLY_SHIFT     32
-#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000
+#define TCTRL4_WR_WR_PI_MORE_DLY 0x00000000f8000000UL
 #define TCTRL4_WR_WR_PI_MORE_DLY_SHIFT 27
-#define TCTRL4_WR_WR_TI_DLY	0x0000000007e00000
+#define TCTRL4_WR_WR_TI_DLY	0x0000000007e00000UL
 #define TCTRL4_WR_WR_TI_DLY_SHIFT     21
-#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f0000
+#define TCTRL4_RDWR_RD_PI_MORE_DLY 0x00000000001f000UL0
 #define TCTRL4_RDWR_RD_PI_MORE_DLY_SHIFT 16
-#define TCTRL4_R		0x0000000000008000
+#define TCTRL4_R		0x0000000000008000UL
 #define TCTRL4_R_SHIFT		      15
-#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fff
+#define TCTRL4_SDRAM_MODE_REG_DATA 0x0000000000007fffUL
 #define TCTRL4_SDRAM_MODE_REG_DATA_SHIFT 0
 
 /* All 4 memory address decoding registers have the
  * same layout.
  */
-#define MEM_DECODE_VALID	0x8000000000000000 /* Valid */
+#define MEM_DECODE_VALID	0x8000000000000000UL /* Valid */
 #define MEM_DECODE_VALID_SHIFT	      63
-#define MEM_DECODE_UK		0x001ffe0000000000 /* Upper mask */
+#define MEM_DECODE_UK		0x001ffe0000000000UL /* Upper mask */
 #define MEM_DECODE_UK_SHIFT	      41
-#define MEM_DECODE_UM		0x0000001ffff00000 /* Upper match */
+#define MEM_DECODE_UM		0x0000001ffff00000UL /* Upper match */
 #define MEM_DECODE_UM_SHIFT	      20
-#define MEM_DECODE_LK		0x000000000003c000 /* Lower mask */
+#define MEM_DECODE_LK		0x000000000003c000UL /* Lower mask */
 #define MEM_DECODE_LK_SHIFT	      14
-#define MEM_DECODE_LM		0x0000000000000f00 /* Lower match */
+#define MEM_DECODE_LM		0x0000000000000f00UL /* Lower match */
 #define MEM_DECODE_LM_SHIFT           8
 
-#define PA_UPPER_BITS		0x000007fffc000000
+#define PA_UPPER_BITS		0x000007fffc000000UL
 #define PA_UPPER_BITS_SHIFT	26
-#define PA_LOWER_BITS		0x00000000000003c0
+#define PA_LOWER_BITS		0x00000000000003c0UL
 #define PA_LOWER_BITS_SHIFT	6
 
-#define MACTRL_R0		         0x8000000000000000
+#define MACTRL_R0		         0x8000000000000000UL
 #define MACTRL_R0_SHIFT		         63
-#define MACTRL_ADDR_LE_PW                0x7000000000000000
+#define MACTRL_ADDR_LE_PW                0x7000000000000000UL
 #define MACTRL_ADDR_LE_PW_SHIFT		 60
-#define MACTRL_CMD_PW                    0x0f00000000000000
+#define MACTRL_CMD_PW                    0x0f00000000000000UL
 #define MACTRL_CMD_PW_SHIFT		 56
-#define MACTRL_HALF_MODE_WR_MSEL_DLY     0x00fc000000000000
+#define MACTRL_HALF_MODE_WR_MSEL_DLY     0x00fc000000000000UL
 #define MACTRL_HALF_MODE_WR_MSEL_DLY_SHIFT 50
-#define MACTRL_HALF_MODE_RD_MSEL_DLY     0x0003f00000000000
+#define MACTRL_HALF_MODE_RD_MSEL_DLY     0x0003f00000000000UL
 #define MACTRL_HALF_MODE_RD_MSEL_DLY_SHIFT 44
-#define MACTRL_HALF_MODE_SDRAM_CTL_DLY   0x00000f0000000000
+#define MACTRL_HALF_MODE_SDRAM_CTL_DLY   0x00000f0000000000UL
 #define MACTRL_HALF_MODE_SDRAM_CTL_DLY_SHIFT 40
-#define MACTRL_HALF_MODE_SDRAM_CLK_DLY   0x000000e000000000
+#define MACTRL_HALF_MODE_SDRAM_CLK_DLY   0x000000e000000000UL
 #define MACTRL_HALF_MODE_SDRAM_CLK_DLY_SHIFT 37
-#define MACTRL_R1                        0x0000001000000000
+#define MACTRL_R1                        0x0000001000000000UL
 #define MACTRL_R1_SHIFT                      36
-#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000
+#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3 0x0000000f00000000UL
 #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B3_SHIFT 32
-#define MACTRL_ENC_INTLV_B3              0x00000000f8000000
+#define MACTRL_ENC_INTLV_B3              0x00000000f8000000UL
 #define MACTRL_ENC_INTLV_B3_SHIFT              27
-#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000
+#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2 0x0000000007800000UL
 #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B2_SHIFT 23
-#define MACTRL_ENC_INTLV_B2              0x00000000007c0000
+#define MACTRL_ENC_INTLV_B2              0x00000000007c0000UL
 #define MACTRL_ENC_INTLV_B2_SHIFT              18
-#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000
+#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1 0x000000000003c000UL
 #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B1_SHIFT 14
-#define MACTRL_ENC_INTLV_B1              0x0000000000003e00
+#define MACTRL_ENC_INTLV_B1              0x0000000000003e00UL
 #define MACTRL_ENC_INTLV_B1_SHIFT               9
-#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0
+#define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0 0x00000000000001e0UL
 #define MACTRL_BANKSEL_N_ROWADDR_SIZE_B0_SHIFT  5
-#define MACTRL_ENC_INTLV_B0              0x000000000000001f
+#define MACTRL_ENC_INTLV_B0              0x000000000000001fUL
 #define MACTRL_ENC_INTLV_B0_SHIFT               0
 
 #endif /* _SPARC64_CHMCTRL_H */
diff -Nru a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
--- a/include/asm-sparc64/compat.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-sparc64/compat.h	Tue Jun 15 22:20:42 2004
@@ -116,12 +116,12 @@
  */
 typedef	u32		compat_uptr_t;
 
-static inline void *compat_ptr(compat_uptr_t uptr)
+static inline void __user *compat_ptr(compat_uptr_t uptr)
 {
-	return (void *)(unsigned long)uptr;
+	return (void __user *)(unsigned long)uptr;
 }
 
-static __inline__ void *compat_alloc_user_space(long len)
+static __inline__ void __user *compat_alloc_user_space(long len)
 {
 	struct pt_regs *regs = current_thread_info()->kregs;
 	unsigned long usp = regs->u_regs[UREG_I6];
@@ -129,7 +129,7 @@
 	if (!(test_thread_flag(TIF_32BIT)))
 		usp += STACK_BIAS;
 
-	return (void *) (usp - len);
+	return (void __user *) (usp - len);
 }
 
 #endif /* _ASM_SPARC64_COMPAT_H */
diff -Nru a/include/asm-sparc64/const.h b/include/asm-sparc64/const.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-sparc64/const.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,19 @@
+/* const.h: Macros for dealing with constants.  */
+
+#ifndef _SPARC64_CONST_H
+#define _SPARC64_CONST_H
+
+/* Some constant macros are used in both assembler and
+ * C code.  Therefore we cannot annotate them always with
+ * 'UL' and other type specificers unilaterally.  We
+ * use the following macros to deal with this.
+ */
+
+#ifdef __ASSEMBLY__
+#define _AC(X,Y)	X
+#else
+#define _AC(X,Y)	(X##Y)
+#endif
+
+
+#endif /* !(_SPARC64_CONST_H) */
diff -Nru a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h
--- a/include/asm-sparc64/hardirq.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-sparc64/hardirq.h	Tue Jun 15 22:20:43 2004
@@ -56,15 +56,6 @@
 #define HARDIRQ_OFFSET	(1UL << HARDIRQ_SHIFT)
 
 /*
- * The hardirq mask has to be large enough to have
- * space for potentially all IRQ sources in the system
- * nesting on a single CPU:
- */
-#if (1 << HARDIRQ_BITS) < NR_IRQS
-# error HARDIRQ_BITS is too low!
-#endif
-
-/*
  * Are we doing bottom half or hardware interrupt processing?
  * Are we in a softirq context? Interrupt context?
  */
diff -Nru a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h
--- a/include/asm-sparc64/ide.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-sparc64/ide.h	Tue Jun 15 22:20:39 2004
@@ -24,17 +24,8 @@
 # endif
 #endif
 
-static __inline__ int ide_default_irq(unsigned long base)
-{
-	return 0;
-}
-
-static __inline__ unsigned long ide_default_io_base(int index)
-{
-	return 0;
-}
-
-#define ide_init_default_irq(base)	(0)
+#define IDE_ARCH_OBSOLETE_INIT
+#define ide_default_io_ctl(base)	((base) + 0x206) /* obsolete */
 
 #define __ide_insl(data_reg, buffer, wcount) \
 	__ide_insw(data_reg, buffer, (wcount)<<1)
diff -Nru a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
--- a/include/asm-sparc64/iommu.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-sparc64/iommu.h	Tue Jun 15 22:20:38 2004
@@ -7,13 +7,13 @@
 #define _SPARC64_IOMMU_H
 
 /* The format of an iopte in the page tables. */
-#define IOPTE_VALID         0x8000000000000000 /* IOPTE is valid                   */
-#define IOPTE_64K           0x2000000000000000 /* IOPTE is for 64k page            */
-#define IOPTE_STBUF         0x1000000000000000 /* DVMA can use streaming buffer    */
-#define IOPTE_INTRA         0x0800000000000000 /* SBUS slot-->slot direct transfer */
-#define IOPTE_CONTEXT	    0x07ff800000000000 /* Context number		   */
-#define IOPTE_PAGE          0x00007fffffffe000 /* Physical page number (PA[42:13]) */
-#define IOPTE_CACHE         0x0000000000000010 /* Cached (in UPA E-cache)          */
-#define IOPTE_WRITE         0x0000000000000002 /* Writeable                        */
+#define IOPTE_VALID   0x8000000000000000UL /* IOPTE is valid                  */
+#define IOPTE_64K     0x2000000000000000UL /* IOPTE is for 64k page           */
+#define IOPTE_STBUF   0x1000000000000000UL /* DVMA can use streaming buffer   */
+#define IOPTE_INTRA   0x0800000000000000UL /* SBUS slot-->slot direct transfer*/
+#define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number		      */
+#define IOPTE_PAGE    0x00007fffffffe000UL /* Physical page number (PA[42:13])*/
+#define IOPTE_CACHE   0x0000000000000010UL /* Cached (in UPA E-cache)         */
+#define IOPTE_WRITE   0x0000000000000002UL /* Writeable                       */
 
 #endif /* !(_SPARC_IOMMU_H) */
diff -Nru a/include/asm-sparc64/lsu.h b/include/asm-sparc64/lsu.h
--- a/include/asm-sparc64/lsu.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc64/lsu.h	Tue Jun 15 22:20:37 2004
@@ -2,17 +2,19 @@
 #ifndef _SPARC64_LSU_H
 #define _SPARC64_LSU_H
 
+#include <asm/const.h>
+
 /* LSU Control Register */
-#define LSU_CONTROL_PM		0x000001fe00000000 /* Phys-watchpoint byte mask     */
-#define LSU_CONTROL_VM		0x00000001fe000000 /* Virt-watchpoint byte mask     */
-#define LSU_CONTROL_PR		0x0000000001000000 /* Phys-read watchpoint enable   */
-#define LSU_CONTROL_PW		0x0000000000800000 /* Phys-write watchpoint enable  */
-#define LSU_CONTROL_VR		0x0000000000400000 /* Virt-read watchpoint enable   */
-#define LSU_CONTROL_VW		0x0000000000200000 /* Virt-write watchpoint enable  */
-#define LSU_CONTROL_FM		0x00000000000ffff0 /* Parity mask enables.          */
-#define LSU_CONTROL_DM		0x0000000000000008 /* Data MMU enable.              */
-#define LSU_CONTROL_IM		0x0000000000000004 /* Instruction MMU enable.       */
-#define LSU_CONTROL_DC		0x0000000000000002 /* Data cache enable.            */
-#define LSU_CONTROL_IC		0x0000000000000001 /* Instruction cache enable.     */
+#define LSU_CONTROL_PM _AC(0x000001fe00000000,UL) /* Phys-watchpoint byte mask*/
+#define LSU_CONTROL_VM _AC(0x00000001fe000000,UL) /* Virt-watchpoint byte mask*/
+#define LSU_CONTROL_PR _AC(0x0000000001000000,UL) /* Phys-rd watchpoint enable*/
+#define LSU_CONTROL_PW _AC(0x0000000000800000,UL) /* Phys-wr watchpoint enable*/
+#define LSU_CONTROL_VR _AC(0x0000000000400000,UL) /* Virt-rd watchpoint enable*/
+#define LSU_CONTROL_VW _AC(0x0000000000200000,UL) /* Virt-wr watchpoint enable*/
+#define LSU_CONTROL_FM _AC(0x00000000000ffff0,UL) /* Parity mask enables.     */
+#define LSU_CONTROL_DM _AC(0x0000000000000008,UL) /* Data MMU enable.         */
+#define LSU_CONTROL_IM _AC(0x0000000000000004,UL) /* Instruction MMU enable.  */
+#define LSU_CONTROL_DC _AC(0x0000000000000002,UL) /* Data cache enable.       */
+#define LSU_CONTROL_IC _AC(0x0000000000000001,UL) /* Instruction cache enable.*/
 
 #endif /* !(_SPARC64_LSU_H) */
diff -Nru a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
--- a/include/asm-sparc64/page.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-sparc64/page.h	Tue Jun 15 22:20:39 2004
@@ -4,18 +4,12 @@
 #define _SPARC64_PAGE_H
 
 #include <linux/config.h>
+#include <asm/const.h>
 
 #define PAGE_SHIFT   13
-#ifndef __ASSEMBLY__
-/* I have my suspicions... -DaveM */
-#define PAGE_SIZE    (1UL << PAGE_SHIFT)
-#else
-#define PAGE_SIZE    (1 << PAGE_SHIFT)
-#endif
-
+#define PAGE_SIZE    (_AC(1,UL) << PAGE_SHIFT)
 #define PAGE_MASK    (~(PAGE_SIZE-1))
 
-
 #ifdef __KERNEL__
 
 #ifndef __ASSEMBLY__
@@ -99,13 +93,13 @@
 #endif
 
 #ifdef CONFIG_HUGETLB_PAGE
-#define HPAGE_SIZE		((1UL) << HPAGE_SHIFT)
+#define HPAGE_SIZE		(_AC(1,UL) << HPAGE_SHIFT)
 #define HPAGE_MASK		(~(HPAGE_SIZE - 1UL))
 #define HUGETLB_PAGE_ORDER	(HPAGE_SHIFT - PAGE_SHIFT)
 #endif
 
 #define TASK_UNMAPPED_BASE	(test_thread_flag(TIF_32BIT) ? \
-				 (0x0000000070000000UL) : (PAGE_OFFSET))
+				 (_AC(0x0000000070000000,UL)) : (PAGE_OFFSET))
 
 #endif /* !(__ASSEMBLY__) */
 
@@ -115,7 +109,7 @@
 /* We used to stick this into a hard-coded global register (%g4)
  * but that does not make sense anymore.
  */
-#define PAGE_OFFSET		0xFFFFF80000000000
+#define PAGE_OFFSET		_AC(0xFFFFF80000000000,UL)
 
 #define __pa(x)			((unsigned long)(x) - PAGE_OFFSET)
 #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
diff -Nru a/include/asm-sparc64/param.h b/include/asm-sparc64/param.h
--- a/include/asm-sparc64/param.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-sparc64/param.h	Tue Jun 15 22:20:36 2004
@@ -3,7 +3,7 @@
 #define _ASMSPARC64_PARAM_H
 
 #ifdef __KERNEL__
-# define HZ		100	/* Internal kernel timer frequency */
+# define HZ		1000	/* Internal kernel timer frequency */
 # define USER_HZ	100	/* .. some user interfaces are in "ticks" */
 # define CLOCKS_PER_SEC (USER_HZ)
 #endif
diff -Nru a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
--- a/include/asm-sparc64/pci.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc64/pci.h	Tue Jun 15 22:20:37 2004
@@ -168,7 +168,7 @@
  * can drive enough of the 64 bits.
  */
 #define PCI64_REQUIRED_MASK	(~(dma64_addr_t)0)
-#define PCI64_ADDR_BASE		0xfffc000000000000
+#define PCI64_ADDR_BASE		0xfffc000000000000UL
 
 /* Usage of the pci_dac_foo interfaces is only valid if this
  * test passes.
diff -Nru a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
--- a/include/asm-sparc64/pgtable.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-sparc64/pgtable.h	Tue Jun 15 22:20:36 2004
@@ -18,6 +18,7 @@
 #include <asm/system.h>
 #include <asm/page.h>
 #include <asm/processor.h>
+#include <asm/const.h>
 
 /* The kernel image occupies 0x4000000 to 0x1000000 (4MB --> 16MB).
  * The page copy blockops use 0x1000000 to 0x18000000 (16MB --> 24MB).
@@ -26,14 +27,14 @@
  * There is a single static kernel PMD which maps from 0x0 to address
  * 0x400000000.
  */
-#define	TLBTEMP_BASE		0x0000000001000000
-#define MODULES_VADDR		0x0000000002000000
-#define MODULES_LEN		0x000000007e000000
-#define MODULES_END		0x0000000080000000
-#define VMALLOC_START		0x0000000140000000
-#define VMALLOC_END		0x0000000200000000
-#define LOW_OBP_ADDRESS		0x00000000f0000000
-#define HI_OBP_ADDRESS		0x0000000100000000
+#define	TLBTEMP_BASE		_AC(0x0000000001000000,UL)
+#define MODULES_VADDR		_AC(0x0000000002000000,UL)
+#define MODULES_LEN		_AC(0x000000007e000000,UL)
+#define MODULES_END		_AC(0x0000000080000000,UL)
+#define VMALLOC_START		_AC(0x0000000140000000,UL)
+#define VMALLOC_END		_AC(0x0000000200000000,UL)
+#define LOW_OBP_ADDRESS		_AC(0x00000000f0000000,UL)
+#define HI_OBP_ADDRESS		_AC(0x0000000100000000,UL)
 
 /* XXX All of this needs to be rethought so we can take advantage
  * XXX cheetah's full 64-bit virtual address space, ie. no more hole
@@ -49,7 +50,9 @@
  * long). Finally, the higher few bits determine pgde#.
  */
 
-/* PMD_SHIFT determines the size of the area a second-level page table can map */
+/* PMD_SHIFT determines the size of the area a second-level page
+ * table can map
+ */
 #define PMD_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3))
 #define PMD_SIZE	(1UL << PMD_SHIFT)
 #define PMD_MASK	(~(PMD_SIZE-1))
@@ -78,7 +81,8 @@
  */
 #define REAL_PTRS_PER_PMD	(1UL << PMD_BITS)
 #define PTRS_PER_PMD		((const int)(test_thread_flag(TIF_32BIT) ? \
-				 (1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : (REAL_PTRS_PER_PMD)))
+				 (1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : \
+				 (REAL_PTRS_PER_PMD)))
 
 /*
  * We cannot use the top address range because VPTE table lives there. This
@@ -86,9 +90,9 @@
  * vpte size, then aligns it to the number of bytes mapped by one pgde, and
  * thus calculates the number of pgdes needed.
  */
-#define PTRS_PER_PGD	(((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \
-			(PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \
-			(PAGE_SHIFT-3) + PMD_BITS)))
+#define PTRS_PER_PGD (((1UL << VA_BITS) - VPTE_SIZE + (1UL << (PAGE_SHIFT + \
+		      (PAGE_SHIFT-3) + PMD_BITS)) - 1) / (1UL << (PAGE_SHIFT + \
+		      (PAGE_SHIFT-3) + PMD_BITS)))
 
 /* Kernel has a separate 44bit address space. */
 #define USER_PTRS_PER_PGD	((const int)(test_thread_flag(TIF_32BIT)) ? \
@@ -102,33 +106,33 @@
 #endif /* !(__ASSEMBLY__) */
 
 /* Spitfire/Cheetah TTE bits. */
-#define _PAGE_VALID	0x8000000000000000	/* Valid TTE                          */
-#define _PAGE_R		0x8000000000000000	/* Used to keep ref bit up to date    */
-#define _PAGE_SZ4MB	0x6000000000000000	/* 4MB Page                           */
-#define _PAGE_SZ512K	0x4000000000000000	/* 512K Page                          */
-#define _PAGE_SZ64K	0x2000000000000000	/* 64K Page                           */
-#define _PAGE_SZ8K	0x0000000000000000	/* 8K Page                            */
-#define _PAGE_NFO	0x1000000000000000	/* No Fault Only                      */
-#define _PAGE_IE	0x0800000000000000	/* Invert Endianness                  */
-#define _PAGE_SN	0x0000800000000000	/* (Cheetah) Snoop                    */
-#define _PAGE_PADDR_SF	0x000001FFFFFFE000	/* (Spitfire) Phys Address [40:13]    */
-#define _PAGE_PADDR	0x000007FFFFFFE000	/* (Cheetah) Phys Address [42:13]     */
-#define _PAGE_SOFT	0x0000000000001F80	/* Software bits                      */
-#define _PAGE_L		0x0000000000000040	/* Locked TTE                         */
-#define _PAGE_CP	0x0000000000000020	/* Cacheable in Physical Cache        */
-#define _PAGE_CV	0x0000000000000010	/* Cacheable in Virtual Cache         */
-#define _PAGE_E		0x0000000000000008	/* side-Effect                        */
-#define _PAGE_P		0x0000000000000004	/* Privileged Page                    */
-#define _PAGE_W		0x0000000000000002	/* Writable                           */
-#define _PAGE_G		0x0000000000000001	/* Global                             */
+#define _PAGE_VALID	_AC(0x8000000000000000,UL) /* Valid TTE               */
+#define _PAGE_R		_AC(0x8000000000000000,UL) /* Keep ref bit up to date */
+#define _PAGE_SZ4MB	_AC(0x6000000000000000,UL) /* 4MB Page                */
+#define _PAGE_SZ512K	_AC(0x4000000000000000,UL) /* 512K Page               */
+#define _PAGE_SZ64K	_AC(0x2000000000000000,UL) /* 64K Page                */
+#define _PAGE_SZ8K	_AC(0x0000000000000000,UL) /* 8K Page                 */
+#define _PAGE_NFO	_AC(0x1000000000000000,UL) /* No Fault Only           */
+#define _PAGE_IE	_AC(0x0800000000000000,UL) /* Invert Endianness       */
+#define _PAGE_SN	_AC(0x0000800000000000,UL) /* (Cheetah) Snoop         */
+#define _PAGE_PADDR_SF	_AC(0x000001FFFFFFE000,UL) /* (Spitfire) paddr [40:13]*/
+#define _PAGE_PADDR	_AC(0x000007FFFFFFE000,UL) /* (Cheetah) paddr [42:13] */
+#define _PAGE_SOFT	_AC(0x0000000000001F80,UL) /* Software bits           */
+#define _PAGE_L		_AC(0x0000000000000040,UL) /* Locked TTE              */
+#define _PAGE_CP	_AC(0x0000000000000020,UL) /* Cacheable in P-Cache    */
+#define _PAGE_CV	_AC(0x0000000000000010,UL) /* Cacheable in V-Cache    */
+#define _PAGE_E		_AC(0x0000000000000008,UL) /* side-Effect             */
+#define _PAGE_P		_AC(0x0000000000000004,UL) /* Privileged Page         */
+#define _PAGE_W		_AC(0x0000000000000002,UL) /* Writable                */
+#define _PAGE_G		_AC(0x0000000000000001,UL) /* Global                  */
 
 /* Here are the SpitFire software bits we use in the TTE's. */
-#define _PAGE_FILE	0x0000000000001000	/* Pagecache page                     */
-#define _PAGE_MODIFIED	0x0000000000000800	/* Modified Page (ie. dirty)          */
-#define _PAGE_ACCESSED	0x0000000000000400	/* Accessed Page (ie. referenced)     */
-#define _PAGE_READ	0x0000000000000200	/* Readable SW Bit                    */
-#define _PAGE_WRITE	0x0000000000000100	/* Writable SW Bit                    */
-#define _PAGE_PRESENT	0x0000000000000080	/* Present Page (ie. not swapped out) */
+#define _PAGE_FILE	_AC(0x0000000000001000,UL)	/* Pagecache page     */
+#define _PAGE_MODIFIED	_AC(0x0000000000000800,UL)	/* Modified (dirty)   */
+#define _PAGE_ACCESSED	_AC(0x0000000000000400,UL)	/* Accessed (ref'd)   */
+#define _PAGE_READ	_AC(0x0000000000000200,UL)	/* Readable SW Bit    */
+#define _PAGE_WRITE	_AC(0x0000000000000100,UL)	/* Writable SW Bit    */
+#define _PAGE_PRESENT	_AC(0x0000000000000080,UL)	/* Present            */
 
 #if PAGE_SHIFT == 13
 #define _PAGE_SZBITS	_PAGE_SZ8K
@@ -173,7 +177,8 @@
 
 #define _PFN_MASK	_PAGE_PADDR
 
-#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | __ACCESS_BITS | _PAGE_E)
+#define pg_iobits (_PAGE_VALID | _PAGE_PRESENT | __DIRTY_BITS | \
+		   __ACCESS_BITS | _PAGE_E)
 
 #define __P000	PAGE_NONE
 #define __P001	PAGE_READONLY
@@ -260,9 +265,12 @@
 #define pte_dirty(pte)		(pte_val(pte) & _PAGE_MODIFIED)
 #define pte_young(pte)		(pte_val(pte) & _PAGE_ACCESSED)
 #define pte_wrprotect(pte)	(__pte(pte_val(pte) & ~(_PAGE_WRITE|_PAGE_W)))
-#define pte_rdprotect(pte)	(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ))
-#define pte_mkclean(pte)	(__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W)))
-#define pte_mkold(pte)		(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED))
+#define pte_rdprotect(pte)	\
+	(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_READ))
+#define pte_mkclean(pte)	\
+	(__pte(pte_val(pte) & ~(_PAGE_MODIFIED|_PAGE_W)))
+#define pte_mkold(pte)		\
+	(__pte(((pte_val(pte)<<1UL)>>1UL) & ~_PAGE_ACCESSED))
 
 /* Permanent address of a page. */
 #define __page_address(page)	page_address(page)
@@ -280,12 +288,14 @@
 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
 
 /* Find an entry in the second-level page table.. */
-#define pmd_offset(dir, address)	((pmd_t *) pgd_page(*(dir)) + \
-					((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1)))
+#define pmd_offset(dir, address)	\
+	((pmd_t *) pgd_page(*(dir)) + \
+	 ((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1)))
 
 /* Find an entry in the third-level page table.. */
-#define pte_index(dir, address)	((pte_t *) __pmd_page(*(dir)) + \
-					((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
+#define pte_index(dir, address)	\
+	((pte_t *) __pmd_page(*(dir)) + \
+	 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
 #define pte_offset_kernel		pte_index
 #define pte_offset_map			pte_index
 #define pte_offset_map_nested		pte_index
@@ -305,7 +315,8 @@
 static inline pte_t mk_pte_io(unsigned long page, pgprot_t prot, int space)
 {
 	pte_t pte;
-	pte_val(pte) = ((page) | pgprot_val(prot) | _PAGE_E) & ~(unsigned long)_PAGE_CACHE;
+	pte_val(pte) = (((page) | pgprot_val(prot) | _PAGE_E) &
+			~(unsigned long)_PAGE_CACHE);
 	pte_val(pte) |= (((unsigned long)space) << 32);
 	return pte;
 }
@@ -365,7 +376,8 @@
 #define kern_addr_valid(addr)	\
 	(test_bit(__pa((unsigned long)(addr))>>22, sparc64_valid_addr_bitmap))
 
-extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from, unsigned long offset,
+extern int io_remap_page_range(struct vm_area_struct *vma, unsigned long from,
+			       unsigned long offset,
 			       unsigned long size, pgprot_t prot, int space);
 
 #include <asm-generic/pgtable.h>
@@ -376,7 +388,9 @@
 /* We provide a special get_unmapped_area for framebuffer mmaps to try and use
  * the largest alignment possible such that larget PTEs can be used.
  */
-extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long, unsigned long, unsigned long, unsigned long);
+extern unsigned long get_fb_unmapped_area(struct file *filp, unsigned long,
+					  unsigned long, unsigned long,
+					  unsigned long);
 #define HAVE_ARCH_FB_UNMAPPED_AREA
 
 /*
@@ -385,8 +399,6 @@
 #define pgtable_cache_init()	do { } while (0)
 
 extern void check_pgt_cache(void);
-
-typedef pte_t *pte_addr_t;
 
 #endif /* !(__ASSEMBLY__) */
 
diff -Nru a/include/asm-sparc64/pstate.h b/include/asm-sparc64/pstate.h
--- a/include/asm-sparc64/pstate.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-sparc64/pstate.h	Tue Jun 15 22:21:04 2004
@@ -2,6 +2,8 @@
 #ifndef _SPARC64_PSTATE_H
 #define _SPARC64_PSTATE_H
 
+#include <asm/const.h>
+
 /* The V9 PSTATE Register (with SpitFire extensions).
  *
  * -----------------------------------------------------------------------
@@ -9,20 +11,20 @@
  * -----------------------------------------------------------------------
  *  63  12  11   10    9     8    7   6   5     4     3     2     1    0
  */
-#define PSTATE_IG	0x0000000000000800	/* Interrupt Globals.		*/
-#define PSTATE_MG	0x0000000000000400	/* MMU Globals.			*/
-#define PSTATE_CLE	0x0000000000000200	/* Current Little Endian.	*/
-#define PSTATE_TLE	0x0000000000000100	/* Trap Little Endian.		*/
-#define PSTATE_MM	0x00000000000000c0	/* Memory Model.		*/
-#define PSTATE_TSO	0x0000000000000000	/* MM: Total Store Order	*/
-#define PSTATE_PSO	0x0000000000000040	/* MM: Partial Store Order	*/
-#define PSTATE_RMO	0x0000000000000080	/* MM: Relaxed Memory Order	*/
-#define PSTATE_RED	0x0000000000000020	/* Reset Error Debug State.	*/
-#define PSTATE_PEF	0x0000000000000010	/* Floating Point Enable.	*/
-#define PSTATE_AM	0x0000000000000008	/* Address Mask.		*/
-#define PSTATE_PRIV	0x0000000000000004	/* Privilege.			*/
-#define PSTATE_IE	0x0000000000000002	/* Interrupt Enable.		*/
-#define PSTATE_AG	0x0000000000000001	/* Alternate Globals.		*/
+#define PSTATE_IG   _AC(0x0000000000000800,UL) /* Interrupt Globals.	*/
+#define PSTATE_MG   _AC(0x0000000000000400,UL) /* MMU Globals.		*/
+#define PSTATE_CLE  _AC(0x0000000000000200,UL) /* Current Little Endian.*/
+#define PSTATE_TLE  _AC(0x0000000000000100,UL) /* Trap Little Endian.	*/
+#define PSTATE_MM   _AC(0x00000000000000c0,UL) /* Memory Model.		*/
+#define PSTATE_TSO  _AC(0x0000000000000000,UL) /* MM: TotalStoreOrder	*/
+#define PSTATE_PSO  _AC(0x0000000000000040,UL) /* MM: PartialStoreOrder	*/
+#define PSTATE_RMO  _AC(0x0000000000000080,UL) /* MM: RelaxedMemoryOrder*/
+#define PSTATE_RED  _AC(0x0000000000000020,UL) /* Reset Error Debug.	*/
+#define PSTATE_PEF  _AC(0x0000000000000010,UL) /* Floating Point Enable.*/
+#define PSTATE_AM   _AC(0x0000000000000008,UL) /* Address Mask.		*/
+#define PSTATE_PRIV _AC(0x0000000000000004,UL) /* Privilege.		*/
+#define PSTATE_IE   _AC(0x0000000000000002,UL) /* Interrupt Enable.	*/
+#define PSTATE_AG   _AC(0x0000000000000001,UL) /* Alternate Globals.	*/
 
 /* The V9 TSTATE Register (with SpitFire and Linux extensions).
  *
@@ -31,35 +33,35 @@
  * ---------------------------------------------------------------
  *  63    40 39   32 31   24 23    20 19       8 7      5 4     0
  */
-#define TSTATE_CCR	0x000000ff00000000	/* Condition Codes.		*/
-#define TSTATE_XCC	0x000000f000000000	/* Condition Codes.		*/
-#define TSTATE_XNEG	0x0000008000000000	/* %xcc Negative.		*/
-#define TSTATE_XZERO	0x0000004000000000	/* %xcc Zero.			*/
-#define TSTATE_XOVFL	0x0000002000000000	/* %xcc Overflow.		*/
-#define TSTATE_XCARRY	0x0000001000000000	/* %xcc Carry.			*/
-#define TSTATE_ICC	0x0000000f00000000	/* Condition Codes.		*/
-#define TSTATE_INEG	0x0000000800000000	/* %icc Negative.		*/
-#define TSTATE_IZERO	0x0000000400000000	/* %icc Zero.			*/
-#define TSTATE_IOVFL	0x0000000200000000	/* %icc Overflow.		*/
-#define TSTATE_ICARRY	0x0000000100000000	/* %icc Carry.			*/
-#define TSTATE_ASI	0x00000000ff000000	/* Address Space Identifier.	*/
-#define TSTATE_PIL	0x0000000000f00000	/* %pil (Linux traps set this)  */
-#define TSTATE_PSTATE	0x00000000000fff00	/* PSTATE.			*/
-#define TSTATE_IG	0x0000000000080000	/* Interrupt Globals.		*/
-#define TSTATE_MG	0x0000000000040000	/* MMU Globals.			*/
-#define TSTATE_CLE	0x0000000000020000	/* Current Little Endian.	*/
-#define TSTATE_TLE	0x0000000000010000	/* Trap Little Endian.		*/
-#define TSTATE_MM	0x000000000000c000	/* Memory Model.		*/
-#define TSTATE_TSO	0x0000000000000000	/* MM: Total Store Order	*/
-#define TSTATE_PSO	0x0000000000004000	/* MM: Partial Store Order	*/
-#define TSTATE_RMO	0x0000000000008000	/* MM: Relaxed Memory Order	*/
-#define TSTATE_RED	0x0000000000002000	/* Reset Error Debug State.	*/
-#define TSTATE_PEF	0x0000000000001000	/* Floating Point Enable.	*/
-#define TSTATE_AM	0x0000000000000800	/* Address Mask.		*/
-#define TSTATE_PRIV	0x0000000000000400	/* Privilege.			*/
-#define TSTATE_IE	0x0000000000000200	/* Interrupt Enable.		*/
-#define TSTATE_AG	0x0000000000000100	/* Alternate Globals.		*/
-#define TSTATE_CWP	0x000000000000001f	/* Current Window Pointer.	*/
+#define TSTATE_CCR	_AC(0x000000ff00000000,UL) /* Condition Codes.	*/
+#define TSTATE_XCC	_AC(0x000000f000000000,UL) /* Condition Codes.	*/
+#define TSTATE_XNEG	_AC(0x0000008000000000,UL) /* %xcc Negative.	*/
+#define TSTATE_XZERO	_AC(0x0000004000000000,UL) /* %xcc Zero.	*/
+#define TSTATE_XOVFL	_AC(0x0000002000000000,UL) /* %xcc Overflow.	*/
+#define TSTATE_XCARRY	_AC(0x0000001000000000,UL) /* %xcc Carry.	*/
+#define TSTATE_ICC	_AC(0x0000000f00000000,UL) /* Condition Codes.	*/
+#define TSTATE_INEG	_AC(0x0000000800000000,UL) /* %icc Negative.	*/
+#define TSTATE_IZERO	_AC(0x0000000400000000,UL) /* %icc Zero.	*/
+#define TSTATE_IOVFL	_AC(0x0000000200000000,UL) /* %icc Overflow.	*/
+#define TSTATE_ICARRY	_AC(0x0000000100000000,UL) /* %icc Carry.	*/
+#define TSTATE_ASI	_AC(0x00000000ff000000,UL) /* AddrSpace ID.	*/
+#define TSTATE_PIL	_AC(0x0000000000f00000,UL) /* %pil (Linux traps)*/
+#define TSTATE_PSTATE	_AC(0x00000000000fff00,UL) /* PSTATE.		*/
+#define TSTATE_IG	_AC(0x0000000000080000,UL) /* Interrupt Globals.*/
+#define TSTATE_MG	_AC(0x0000000000040000,UL) /* MMU Globals.	*/
+#define TSTATE_CLE	_AC(0x0000000000020000,UL) /* CurrLittleEndian.	*/
+#define TSTATE_TLE	_AC(0x0000000000010000,UL) /* TrapLittleEndian.	*/
+#define TSTATE_MM	_AC(0x000000000000c000,UL) /* Memory Model.	*/
+#define TSTATE_TSO	_AC(0x0000000000000000,UL) /* MM: TSO		*/
+#define TSTATE_PSO	_AC(0x0000000000004000,UL) /* MM: PSO		*/
+#define TSTATE_RMO	_AC(0x0000000000008000,UL) /* MM: RMO		*/
+#define TSTATE_RED	_AC(0x0000000000002000,UL) /* Reset Error Debug.*/
+#define TSTATE_PEF	_AC(0x0000000000001000,UL) /* FPU Enable.	*/
+#define TSTATE_AM	_AC(0x0000000000000800,UL) /* Address Mask.	*/
+#define TSTATE_PRIV	_AC(0x0000000000000400,UL) /* Privilege.	*/
+#define TSTATE_IE	_AC(0x0000000000000200,UL) /* Interrupt Enable.	*/
+#define TSTATE_AG	_AC(0x0000000000000100,UL) /* Alternate Globals.*/
+#define TSTATE_CWP	_AC(0x000000000000001f,UL) /* Curr Win-Pointer.	*/
 
 /* Floating-Point Registers State Register.
  *
@@ -68,9 +70,9 @@
  * --------------------------------
  *  63     3    2       1      0
  */
-#define FPRS_FEF	0x0000000000000004	/* Enable Floating Point.	*/
-#define FPRS_DU		0x0000000000000002	/* Dirty Upper.			*/
-#define FPRS_DL		0x0000000000000001	/* Dirty Lower.			*/
+#define FPRS_FEF	_AC(0x0000000000000004,UL) /* FPU Enable.	*/
+#define FPRS_DU		_AC(0x0000000000000002,UL) /* Dirty Upper.	*/
+#define FPRS_DL		_AC(0x0000000000000001,UL) /* Dirty Lower.	*/
 
 /* Version Register.
  *
@@ -79,10 +81,10 @@
  * ------------------------------------------------------
  *  63   48 47  32 31  24 23  16 15    8 7    5 4      0
  */
-#define VERS_MANUF	0xffff000000000000	/* Manufacturer.		*/
-#define VERS_IMPL	0x0000ffff00000000	/* Implementation.		*/
-#define VERS_MASK	0x00000000ff000000	/* Mask Set Revision.		*/
-#define VERS_MAXTL	0x000000000000ff00	/* Maximum Trap Level.		*/
-#define VERS_MAXWIN	0x000000000000001f	/* Maximum Reg Window Index.	*/
+#define VERS_MANUF	_AC(0xffff000000000000,UL) /* Manufacturer.	*/
+#define VERS_IMPL	_AC(0x0000ffff00000000,UL) /* Implementation.	*/
+#define VERS_MASK	_AC(0x00000000ff000000,UL) /* Mask Set Revision.*/
+#define VERS_MAXTL	_AC(0x000000000000ff00,UL) /* Max Trap Level.	*/
+#define VERS_MAXWIN	_AC(0x000000000000001f,UL) /* Max RegWindow Idx.*/
 
 #endif /* !(_SPARC64_PSTATE_H) */
diff -Nru a/include/asm-sparc64/rmap.h b/include/asm-sparc64/rmap.h
--- a/include/asm-sparc64/rmap.h	Tue Jun 15 22:20:39 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _SPARC64_RMAP_H
-#define _SPARC64_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h
--- a/include/asm-sparc64/sbus.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc64/sbus.h	Tue Jun 15 22:20:37 2004
@@ -7,6 +7,7 @@
 #ifndef _SPARC64_SBUS_H
 #define _SPARC64_SBUS_H
 
+#include <linux/dma-mapping.h>
 #include <linux/ioport.h>
 
 #include <asm/oplib.h>
@@ -99,10 +100,10 @@
 extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp);
 extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t);
 
-#define SBUS_DMA_BIDIRECTIONAL	0
-#define SBUS_DMA_TODEVICE	1
-#define SBUS_DMA_FROMDEVICE	2
-#define	SBUS_DMA_NONE		3
+#define SBUS_DMA_BIDIRECTIONAL	DMA_BIDIRECTIONAL
+#define SBUS_DMA_TODEVICE	DMA_TO_DEVICE
+#define SBUS_DMA_FROMDEVICE	DMA_FROM_DEVICE
+#define	SBUS_DMA_NONE		DMA_NONE
 
 /* All the rest use streaming mode mappings. */
 extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int);
diff -Nru a/include/asm-sparc64/siginfo.h b/include/asm-sparc64/siginfo.h
--- a/include/asm-sparc64/siginfo.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-sparc64/siginfo.h	Tue Jun 15 22:20:43 2004
@@ -99,7 +99,7 @@
 	} _sigev_un;
 } sigevent_t32;
 
-extern int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from);
+extern int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from);
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
--- a/include/asm-sparc64/signal.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-sparc64/signal.h	Tue Jun 15 22:20:38 2004
@@ -212,7 +212,7 @@
 
 struct k_sigaction {
 	struct __new_sigaction 	sa;
-	void			*ka_restorer;
+	void __user		*ka_restorer;
 };
 #endif
 
@@ -252,8 +252,6 @@
 
 struct pt_regs;
 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
-
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif /* !(__KERNEL__) */
 
diff -Nru a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
--- a/include/asm-sparc64/spinlock.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc64/spinlock.h	Tue Jun 15 22:20:37 2004
@@ -78,6 +78,8 @@
 			     : "memory");
 }
 
+extern void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags);
+
 #else /* !(CONFIG_DEBUG_SPINLOCK) */
 
 typedef struct {
@@ -103,6 +105,7 @@
 #define _raw_spin_trylock(lp)	_spin_trylock(lp)
 #define _raw_spin_lock(lock)	_do_spin_lock(lock, "spin_lock")
 #define _raw_spin_unlock(lock)	_do_spin_unlock(lock)
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 #endif /* CONFIG_DEBUG_SPINLOCK */
 
@@ -142,6 +145,7 @@
 extern void _do_read_unlock(rwlock_t *rw, char *str);
 extern void _do_write_lock(rwlock_t *rw, char *str);
 extern void _do_write_unlock(rwlock_t *rw);
+extern int _do_write_trylock(rwlock_t *rw, char *str);
 
 #define _raw_read_lock(lock) \
 do {	unsigned long flags; \
@@ -170,6 +174,15 @@
 	_do_write_unlock(lock); \
 	local_irq_restore(flags); \
 } while(0)
+
+#define _raw_write_trylock(lock) \
+({	unsigned long flags; \
+	int val; \
+	local_irq_save(flags); \
+	val = _do_write_trylock(lock, "write_trylock"); \
+	local_irq_restore(flags); \
+	val; \
+})
 
 #endif /* CONFIG_DEBUG_SPINLOCK */
 
diff -Nru a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
--- a/include/asm-sparc64/thread_info.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-sparc64/thread_info.h	Tue Jun 15 22:20:43 2004
@@ -56,7 +56,8 @@
 	unsigned long		gsr[7];
 	unsigned long		xfsr[7];
 
-	__u64			*user_cntd0, *user_cntd1;
+	__u64			__user *user_cntd0;
+	__u64			__user *user_cntd1;
 	__u64			kernel_cntd0, kernel_cntd1;
 	__u64			pcr_reg;
 
diff -Nru a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h
--- a/include/asm-sparc64/types.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-sparc64/types.h	Tue Jun 15 22:21:05 2004
@@ -56,6 +56,8 @@
 typedef u32 dma_addr_t;
 typedef u64 dma64_addr_t;
 
+typedef unsigned short kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
--- a/include/asm-sparc64/uaccess.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-sparc64/uaccess.h	Tue Jun 15 22:20:39 2004
@@ -101,10 +101,12 @@
  */
 #define put_user(x,ptr) ({ \
 unsigned long __pu_addr = (unsigned long)(ptr); \
+__chk_user_ptr(ptr); \
 __put_user_nocheck((__typeof__(*(ptr)))(x),__pu_addr,sizeof(*(ptr))); })
 
 #define get_user(x,ptr) ({ \
 unsigned long __gu_addr = (unsigned long)(ptr); \
+__chk_user_ptr(ptr); \
 __get_user_nocheck((x),__gu_addr,sizeof(*(ptr)),__typeof__(*(ptr))); })
 
 #define __put_user(x,ptr) put_user(x,ptr)
@@ -163,7 +165,7 @@
 	".previous\n\n\t"						\
        : "=r" (foo) : "r" (x), "r" (__m(addr)));			\
 else									\
-__asm__ __volatile(							\
+__asm__ __volatile__(							\
 	"/* Put user asm ret, inline. */\n"				\
 "1:\t"	"st"#size "a %1, [%2] %%asi\n\n\t"				\
 	".section .fixup,#alloc,#execinstr\n\t"				\
@@ -263,12 +265,12 @@
 #define copy_to_user __copy_to_user
 #define copy_in_user __copy_in_user
 
-extern unsigned long __bzero_noasi(void *, unsigned long);
+extern unsigned long __bzero_noasi(void __user *, unsigned long);
 
 static inline unsigned long __clear_user(void __user *addr, unsigned long size)
 {
 	
-	return __bzero_noasi((void *) addr, size);
+	return __bzero_noasi(addr, size);
 }
 
 #define clear_user __clear_user
diff -Nru a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
--- a/include/asm-sparc64/unistd.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-sparc64/unistd.h	Tue Jun 15 22:20:37 2004
@@ -446,7 +446,6 @@
 static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp)
 static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode)
 static __inline__ _syscall1(int,close,int,fd)
-static __inline__ _syscall1(int,_exit,int,exitcode)
 static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
 
 #include <linux/linkage.h>
@@ -474,6 +473,27 @@
 #define   _SC_JOB_CONTROL         6
 #define   _SC_SAVED_IDS           7
 #define   _SC_VERSION             8
+
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
 #endif
 
 /*
diff -Nru a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
--- a/include/asm-um/pgtable.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-um/pgtable.h	Tue Jun 15 22:21:05 2004
@@ -384,18 +384,6 @@
 #define pte_unmap(pte) kunmap_atomic((pte), KM_PTE0)
 #define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)
 
-#if defined(CONFIG_HIGHPTE) && defined(CONFIG_HIGHMEM4G)
-typedef u32 pte_addr_t;
-#endif
-
-#if defined(CONFIG_HIGHPTE) && defined(CONFIG_HIGHMEM64G)
-typedef u64 pte_addr_t;
-#endif
-
-#if !defined(CONFIG_HIGHPTE)
-typedef pte_t *pte_addr_t;
-#endif
-
 #define update_mmu_cache(vma,address,pte) do ; while (0)
 
 /* Encode and de-code a swap entry */
diff -Nru a/include/asm-um/rmap.h b/include/asm-um/rmap.h
--- a/include/asm-um/rmap.h	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,6 +0,0 @@
-#ifndef __UM_RMAP_H
-#define __UM_RMAP_H
-
-#include "asm/arch/rmap.h"
-
-#endif
diff -Nru a/include/asm-um/unistd.h b/include/asm-um/unistd.h
--- a/include/asm-um/unistd.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-um/unistd.h	Tue Jun 15 22:20:44 2004
@@ -12,6 +12,31 @@
 
 extern int um_execve(const char *file, char *const argv[], char *const env[]);
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
diff -Nru a/include/asm-v850/atomic.h b/include/asm-v850/atomic.h
--- a/include/asm-v850/atomic.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-v850/atomic.h	Tue Jun 15 22:20:41 2004
@@ -76,6 +76,16 @@
 #define atomic_inc(v) 		atomic_inc_return (v)
 #define atomic_dec(v) 		atomic_dec_return (v)
 
+/*
+ * atomic_inc_and_test - increment and test
+ * @v: pointer of type atomic_t
+ *
+ * Atomically increments @v by 1
+ * and returns true if the result is zero, or false for all
+ * other cases.
+ */
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
+
 #define atomic_sub_and_test(i,v)	(atomic_sub_return ((i), (v)) == 0)
 #define atomic_dec_and_test(v)		(atomic_sub_return (1, (v)) == 0)
 #define atomic_add_negative(i,v)	(atomic_add_return ((i), (v)) < 0)
diff -Nru a/include/asm-v850/cacheflush.h b/include/asm-v850/cacheflush.h
--- a/include/asm-v850/cacheflush.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-v850/cacheflush.h	Tue Jun 15 22:20:39 2004
@@ -27,6 +27,8 @@
 #define flush_cache_range(vma, start, end)	((void)0)
 #define flush_cache_page(vma, vmaddr)		((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)
 #define flush_cache_vmap(start, end)		((void)0)
 #define flush_cache_vunmap(start, end)		((void)0)
 
diff -Nru a/include/asm-v850/flat.h b/include/asm-v850/flat.h
--- a/include/asm-v850/flat.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-v850/flat.h	Tue Jun 15 22:20:38 2004
@@ -45,7 +45,8 @@
    RELVAL is the raw relocation-table entry from which RP is derived.
    For the v850, RP should always be half-word aligned.  */
 static inline unsigned long flat_get_addr_from_rp (unsigned long *rp,
-						   unsigned long relval)
+						   unsigned long relval,
+						   unsigned long flags)
 {
 	short *srp = (short *)rp;
 
diff -Nru a/include/asm-v850/pgtable.h b/include/asm-v850/pgtable.h
--- a/include/asm-v850/pgtable.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-v850/pgtable.h	Tue Jun 15 22:20:42 2004
@@ -5,8 +5,6 @@
 #include <asm/page.h>
 
 
-typedef pte_t *pte_addr_t;
-
 #define pgd_present(pgd)	(1) /* pages are always present on NO_MM */
 #define pgd_none(pgd)		(0)
 #define pgd_bad(pgd)		(0)
diff -Nru a/include/asm-v850/rmap.h b/include/asm-v850/rmap.h
--- a/include/asm-v850/rmap.h	Tue Jun 15 22:20:44 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1 +0,0 @@
-/* Do not need anything here */
diff -Nru a/include/asm-v850/types.h b/include/asm-v850/types.h
--- a/include/asm-v850/types.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-v850/types.h	Tue Jun 15 22:20:44 2004
@@ -59,6 +59,8 @@
 
 typedef u32 dma_addr_t;
 
+typedef unsigned int kmem_bufctl_t;
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-v850/unistd.h b/include/asm-v850/unistd.h
--- a/include/asm-v850/unistd.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-v850/unistd.h	Tue Jun 15 22:21:04 2004
@@ -386,6 +386,31 @@
 }
 		
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
diff -Nru a/include/asm-x86_64/8253pit.h b/include/asm-x86_64/8253pit.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/asm-x86_64/8253pit.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,10 @@
+/*
+ * 8253/8254 Programmable Interval Timer
+ */
+
+#ifndef _8253PIT_H
+#define _8253PIT_H
+
+#define PIT_TICK_RATE 	1193182UL
+
+#endif
diff -Nru a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
--- a/include/asm-x86_64/bitops.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-x86_64/bitops.h	Tue Jun 15 22:20:39 2004
@@ -337,16 +337,15 @@
 		"repe; scasl\n\t"
 		"jz 1f\n\t"
 		"leaq -4(%%rdi),%%rdi\n\t"
-		"bsfq (%%rdi),%%rax\n"
-		"1:\tsubl %%ebx,%%edi\n\t"
+		"bsfl (%%rdi),%%eax\n"
+		"1:\tsubq %%rbx,%%rdi\n\t"
 		"shll $3,%%edi\n\t"
 		"addl %%edi,%%eax"
 		:"=a" (res), "=&c" (d0), "=&D" (d1)
-		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr));
+		:"1" ((size + 31) >> 5), "2" (addr), "b" (addr) : "memory");
 	return res;
 }
 
-
 /**
  * find_next_bit - find the first set bit in a memory region
  * @addr: The address to base the search on
@@ -458,7 +457,7 @@
 
 	__asm__("bsfl %1,%0\n\t"
 		"cmovzl %2,%0" 
-		: "=r" (r) : "g" (x), "r" (-1));
+		: "=r" (r) : "rm" (x), "r" (-1));
 	return r+1;
 }
 
diff -Nru a/include/asm-x86_64/cacheflush.h b/include/asm-x86_64/cacheflush.h
--- a/include/asm-x86_64/cacheflush.h	Tue Jun 15 22:20:37 2004
+++ b/include/asm-x86_64/cacheflush.h	Tue Jun 15 22:20:37 2004
@@ -10,6 +10,8 @@
 #define flush_cache_range(vma, start, end)	do { } while (0)
 #define flush_cache_page(vma, vmaddr)		do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
+#define flush_dcache_mmap_lock(mapping)		do { } while (0)
+#define flush_dcache_mmap_unlock(mapping)	do { } while (0)
 #define flush_icache_range(start, end)		do { } while (0)
 #define flush_icache_page(vma,pg)		do { } while (0)
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
diff -Nru a/include/asm-x86_64/checksum.h b/include/asm-x86_64/checksum.h
--- a/include/asm-x86_64/checksum.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-x86_64/checksum.h	Tue Jun 15 22:20:43 2004
@@ -139,9 +139,9 @@
 					       int *src_err_ptr, int *dst_err_ptr);
 
 
-extern unsigned int csum_partial_copy_from_user(const char *src, char *dst, 
+extern unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, 
 				       int len, unsigned int isum, int *errp);
-extern unsigned int csum_partial_copy_to_user(const char *src, char *dst, 
+extern unsigned int csum_partial_copy_to_user(const char *src, char __user *dst, 
 				      int len, unsigned int isum, int *errp);
 extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, 
 					      unsigned int sum);
diff -Nru a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h
--- a/include/asm-x86_64/compat.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-x86_64/compat.h	Tue Jun 15 22:20:43 2004
@@ -186,15 +186,15 @@
  */
 typedef	u32		compat_uptr_t;
 
-static inline void *compat_ptr(compat_uptr_t uptr)
+static inline void __user *compat_ptr(compat_uptr_t uptr)
 {
-	return (void *)(unsigned long)uptr;
+	return (void __user *)(unsigned long)uptr;
 }
 
-static __inline__ void *compat_alloc_user_space(long len)
+static __inline__ void __user *compat_alloc_user_space(long len)
 {
 	struct pt_regs *regs = (void *)current->thread.rsp0 - sizeof(struct pt_regs); 
-	return (void *)regs->rsp - len; 
+	return (void __user *)regs->rsp - len; 
 }
 
 #endif /* _ASM_X86_64_COMPAT_H */
diff -Nru a/include/asm-x86_64/desc.h b/include/asm-x86_64/desc.h
--- a/include/asm-x86_64/desc.h	Tue Jun 15 22:21:05 2004
+++ b/include/asm-x86_64/desc.h	Tue Jun 15 22:21:05 2004
@@ -118,7 +118,6 @@
 	d.base1 = PTR_MIDDLE(tss) & 0xFF; 
 	d.type = type;
 	d.p = 1; 
-	d.g = 1;
 	d.limit1 = (size >> 16) & 0xF;
 	d.base2 = (PTR_MIDDLE(tss) >> 8) & 0xFF; 
 	d.base3 = PTR_HIGH(tss); 
@@ -135,7 +134,7 @@
 static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
 { 
 	set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_LDT], (unsigned long)addr, 
-			      DESC_LDT, size); 
+			      DESC_LDT, size * 8);
 }
 
 static inline void set_seg_base(unsigned cpu, int entry, void *base)
diff -Nru a/include/asm-x86_64/floppy.h b/include/asm-x86_64/floppy.h
--- a/include/asm-x86_64/floppy.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-x86_64/floppy.h	Tue Jun 15 22:20:38 2004
@@ -170,7 +170,7 @@
 static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
 {
 	if((unsigned long) addr >= (unsigned long) high_memory)
-		return vfree((void *)addr);
+		vfree((void *)addr);
 	else
 		free_pages(addr, get_order(size));		
 }
diff -Nru a/include/asm-x86_64/fpu32.h b/include/asm-x86_64/fpu32.h
--- a/include/asm-x86_64/fpu32.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-x86_64/fpu32.h	Tue Jun 15 22:20:41 2004
@@ -3,8 +3,8 @@
 
 struct _fpstate_ia32;
 
-int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, int fsave);
-int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 *buf, 
+int restore_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, int fsave);
+int save_i387_ia32(struct task_struct *tsk, struct _fpstate_ia32 __user *buf, 
 		   struct pt_regs *regs, int fsave);
 
 #endif
diff -Nru a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h
--- a/include/asm-x86_64/i387.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-x86_64/i387.h	Tue Jun 15 22:20:40 2004
@@ -23,7 +23,7 @@
 extern unsigned int mxcsr_feature_mask;
 extern void mxcsr_feature_mask_init(void);
 extern void init_fpu(struct task_struct *child);
-extern int save_i387(struct _fpstate *buf);
+extern int save_i387(struct _fpstate __user *buf);
 
 static inline int need_signal_i387(struct task_struct *me) 
 { 
@@ -48,7 +48,7 @@
 
 #define clear_fpu(tsk) do { \
 	if ((tsk)->thread_info->status & TS_USEDFPU) {		\
-		asm volatile("fwait");				\
+		asm volatile("fnclex ; fwait");			\
 		(tsk)->thread_info->status &= ~TS_USEDFPU;	\
 		stts();						\
 	}							\
@@ -57,10 +57,10 @@
 /*
  * ptrace request handers...
  */
-extern int get_fpregs(struct user_i387_struct *buf,
+extern int get_fpregs(struct user_i387_struct __user *buf,
 		      struct task_struct *tsk);
 extern int set_fpregs(struct task_struct *tsk,
-		      struct user_i387_struct *buf);
+		      struct user_i387_struct __user *buf);
 
 /*
  * i387 state interaction
@@ -93,7 +93,7 @@
 	return err;
 } 
 
-static inline int save_i387_checking(struct i387_fxsave_struct *fx) 
+static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) 
 { 
 	int err;
 	asm volatile("1:  rex64 ; fxsave (%[fx])\n\t"
@@ -136,7 +136,7 @@
 /* 
  * This restores directly out of user space. Exceptions are handled.
  */
-static inline int restore_i387(struct _fpstate *buf)
+static inline int restore_i387(struct _fpstate __user *buf)
 {
 	return restore_fpu_checking((struct i387_fxsave_struct *)buf);
 }
diff -Nru a/include/asm-x86_64/ia32.h b/include/asm-x86_64/ia32.h
--- a/include/asm-x86_64/ia32.h	Tue Jun 15 22:20:58 2004
+++ b/include/asm-x86_64/ia32.h	Tue Jun 15 22:20:58 2004
@@ -168,8 +168,8 @@
 #ifdef __KERNEL__
 struct user_desc;
 struct siginfo_t;
-int do_get_thread_area(struct thread_struct *t, struct user_desc *u_info);
-int do_set_thread_area(struct thread_struct *t, struct user_desc *u_info);
+int do_get_thread_area(struct thread_struct *t, struct user_desc __user *info);
+int do_set_thread_area(struct thread_struct *t, struct user_desc __user *info);
 int ia32_child_tls(struct task_struct *p, struct pt_regs *childregs);
 int ia32_copy_siginfo_from_user(siginfo_t *to, siginfo_t32 __user *from);
 int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from);
diff -Nru a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
--- a/include/asm-x86_64/ia32_unistd.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-x86_64/ia32_unistd.h	Tue Jun 15 22:20:42 2004
@@ -288,7 +288,8 @@
 #define __NR_ia32_mq_timedreceive	(__NR_ia32_mq_open+3)
 #define __NR_ia32_mq_notify		(__NR_ia32_mq_open+4)
 #define __NR_ia32_mq_getsetattr	(__NR_ia32_mq_open+5)
+#define __NR_ia32_kexec		283
 
-#define IA32_NR_syscalls 285	/* must be > than biggest syscall! */
+#define IA32_NR_syscalls 287	/* must be > than biggest syscall! */
 
 #endif /* _ASM_X86_64_IA32_UNISTD_H_ */
diff -Nru a/include/asm-x86_64/ide.h b/include/asm-x86_64/ide.h
--- a/include/asm-x86_64/ide.h	Tue Jun 15 22:20:40 2004
+++ b/include/asm-x86_64/ide.h	Tue Jun 15 22:20:40 2004
@@ -1,64 +1 @@
-/*
- *  linux/include/asm-x86_64/ide.h
- *
- *  Copyright (C) 1994-1996  Linus Torvalds & authors
- */
-
-/*
- *  This file contains the x86_64 architecture specific IDE code.
- */
-
-#ifndef __ASMx86_64_IDE_H
-#define __ASMx86_64_IDE_H
-
-#ifdef __KERNEL__
-
-#include <linux/config.h>
-
-#ifndef MAX_HWIFS
-# ifdef CONFIG_BLK_DEV_IDEPCI
-#define MAX_HWIFS	10
-# else
-#define MAX_HWIFS	6
-# endif
-#endif
-
-static __inline__ int ide_default_irq(unsigned long base)
-{
-	switch (base) {
-		case 0x1f0: return 14;
-		case 0x170: return 15;
-		case 0x1e8: return 11;
-		case 0x168: return 10;
-		case 0x1e0: return 8;
-		case 0x160: return 12;
-		default:
-			return 0;
-	}
-}
-
-static __inline__ unsigned long ide_default_io_base(int index)
-{
-	switch (index) {
-		case 0:	return 0x1f0;
-		case 1:	return 0x170;
-		case 2: return 0x1e8;
-		case 3: return 0x168;
-		case 4: return 0x1e0;
-		case 5: return 0x160;
-		default:
-			return 0;
-	}
-}
-
-#ifdef CONFIG_BLK_DEV_IDEPCI
-#define ide_init_default_irq(base)	(0)
-#else
-#define ide_init_default_irq(base)	ide_default_irq(base)
-#endif
-
-#include <asm-generic/ide_iops.h>
-
-#endif /* __KERNEL__ */
-
-#endif /* __ASMx86_64_IDE_H */
+#include <asm-i386/ide.h>
diff -Nru a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
--- a/include/asm-x86_64/io.h	Tue Jun 15 22:20:39 2004
+++ b/include/asm-x86_64/io.h	Tue Jun 15 22:20:39 2004
@@ -195,8 +195,13 @@
 #define __raw_writel writel
 #define __raw_writeq writeq
 
-void *memcpy_fromio(void*,const void*,unsigned); 
-void *memcpy_toio(void*,const void*,unsigned); 
+void *__memcpy_fromio(void*,unsigned long,unsigned);
+void *__memcpy_toio(unsigned long,const void*,unsigned);
+
+#define memcpy_fromio(to,from,len) \
+  __memcpy_fromio((to),(unsigned long)(from),(len))
+#define memcpy_toio(to,from,len) \
+  __memcpy_toio((unsigned long)(to),(from),(len))
 #define memset_io(a,b,c)	memset((void *)(a),(b),(c))
 
 /*
diff -Nru a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
--- a/include/asm-x86_64/msr.h	Tue Jun 15 22:21:02 2004
+++ b/include/asm-x86_64/msr.h	Tue Jun 15 22:21:02 2004
@@ -143,8 +143,8 @@
 #define _EFER_NX 11  /* No execute enable */
 
 #define EFER_SCE (1<<_EFER_SCE)
-#define EFER_LME (1<<EFER_LME)
-#define EFER_LMA (1<<EFER_LMA)
+#define EFER_LME (1<<_EFER_LME)
+#define EFER_LMA (1<<_EFER_LMA)
 #define EFER_NX (1<<_EFER_NX)
 
 /* Intel MSRs. Some also available on other CPUs */
diff -Nru a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
--- a/include/asm-x86_64/page.h	Tue Jun 15 22:20:36 2004
+++ b/include/asm-x86_64/page.h	Tue Jun 15 22:20:36 2004
@@ -65,15 +65,20 @@
 extern unsigned long vm_data_default_flags, vm_data_default_flags32;
 extern unsigned long vm_force_exec32;
 
+#define __START_KERNEL		0xffffffff80100000UL
+#define __START_KERNEL_map	0xffffffff80000000UL
+#define __PAGE_OFFSET           0x0000010000000000UL	/* 1 << 40 */
+
+#else
+#define __START_KERNEL		0xffffffff80100000
+#define __START_KERNEL_map	0xffffffff80000000
+#define __PAGE_OFFSET           0x0000010000000000	/* 1 << 40 */
 #endif /* !__ASSEMBLY__ */
 
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
 
 /* See Documentation/x86_64/mm.txt for a description of the memory map. */
-#define __START_KERNEL		0xffffffff80100000
-#define __START_KERNEL_map	0xffffffff80000000
-#define __PAGE_OFFSET           0x0000010000000000	/* 1 << 40 */
 #define __PHYSICAL_MASK_SHIFT	40
 #define __PHYSICAL_MASK		((1UL << __PHYSICAL_MASK_SHIFT) - 1)
 #define __VIRTUAL_MASK_SHIFT	48
diff -Nru a/include/asm-x86_64/percpu.h b/include/asm-x86_64/percpu.h
--- a/include/asm-x86_64/percpu.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-x86_64/percpu.h	Tue Jun 15 22:20:42 2004
@@ -39,7 +39,7 @@
 #define DEFINE_PER_CPU(type, name) \
     __typeof__(type) per_cpu__##name
 
-#define per_cpu(var, cpu)			((void)cpu, per_cpu__##var)
+#define per_cpu(var, cpu)			(*((void)cpu, &per_cpu__##var))
 #define __get_cpu_var(var)			per_cpu__##var
 
 #endif	/* SMP */
diff -Nru a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
--- a/include/asm-x86_64/pgtable.h	Tue Jun 15 22:20:43 2004
+++ b/include/asm-x86_64/pgtable.h	Tue Jun 15 22:20:43 2004
@@ -124,13 +124,13 @@
 
 
 #ifndef __ASSEMBLY__
-#define VMALLOC_START    0xffffff0000000000
-#define VMALLOC_END      0xffffff7fffffffff
-#define MODULES_VADDR    0xffffffffa0000000
-#define MODULES_END      0xffffffffafffffff
+#define VMALLOC_START    0xffffff0000000000UL
+#define VMALLOC_END      0xffffff7fffffffffUL
+#define MODULES_VADDR    0xffffffffa0000000UL
+#define MODULES_END      0xffffffffafffffffUL
 #define MODULES_LEN   (MODULES_END - MODULES_VADDR)
 
-#define IOMAP_START      0xfffffe8000000000
+#define IOMAP_START      0xfffffe8000000000UL
 
 #define _PAGE_BIT_PRESENT	0
 #define _PAGE_BIT_RW		1
@@ -383,14 +383,26 @@
 
 #define update_mmu_cache(vma,address,pte) do { } while (0)
 
+/* We only update the dirty/accessed state if we set
+ * the dirty bit by hand in the kernel, since the hardware
+ * will do the accessed bit for us, and we don't want to
+ * race with other CPU's that might be updating the dirty
+ * bit at the same time. */
+#define  __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
+#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
+	do {								  \
+		if (__dirty) {						  \
+			set_pte(__ptep, __entry);			  \
+			flush_tlb_page(__vma, __address);		  \
+		}							  \
+	} while (0)
+
 /* Encode and de-code a swap entry */
 #define __swp_type(x)			(((x).val >> 1) & 0x3f)
 #define __swp_offset(x)			((x).val >> 8)
 #define __swp_entry(type, offset)	((swp_entry_t) { ((type) << 1) | ((offset) << 8) })
 #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)		((pte_t) { (x).val })
-
-typedef pte_t *pte_addr_t;
 
 #endif /* !__ASSEMBLY__ */
 
diff -Nru a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
--- a/include/asm-x86_64/processor.h	Tue Jun 15 22:21:04 2004
+++ b/include/asm-x86_64/processor.h	Tue Jun 15 22:21:04 2004
@@ -44,8 +44,6 @@
 
 /*
  *  CPU type and hardware bug flags. Kept separately for each CPU.
- *  Members of this structure are referenced in head.S, so think twice
- *  before touching them. [mj]
  */
 
 struct cpuinfo_x86 {
@@ -168,7 +166,7 @@
 /*
  * User space process size: 512GB - 1GB (default).
  */
-#define TASK_SIZE	(0x0000007fc0000000)
+#define TASK_SIZE	(0x0000007fc0000000UL)
 
 /* This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
@@ -229,6 +227,8 @@
 	unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
 } __attribute__((packed)) ____cacheline_aligned;
 
+#define ARCH_MIN_TASKALIGN	16
+
 struct thread_struct {
 	unsigned long	rsp0;
 	unsigned long	rsp;
@@ -246,14 +246,14 @@
 /* fault info */
 	unsigned long	cr2, trap_no, error_code;
 /* floating point info */
-	union i387_union	i387;
+	union i387_union	i387  __attribute__((aligned(16)));
 /* IO permissions. the bitmap could be moved into the GDT, that would make
    switch faster for a limited number of ioperm using tasks. -AK */
 	int		ioperm;
 	unsigned long	*io_bitmap_ptr;
 /* cached TLS descriptors. */
 	u64 tls_array[GDT_ENTRY_TLS_ENTRIES];
-};
+} __attribute__((aligned(16)));
 
 #define INIT_THREAD  {}
 
@@ -455,5 +455,10 @@
 })
 
 #define cache_line_size() (boot_cpu_data.x86_cache_alignment)
+
+#ifdef CONFIG_SCHED_SMT
+#define ARCH_HAS_SCHED_DOMAIN
+#define ARCH_HAS_SCHED_WAKE_IDLE
+#endif
 
 #endif /* __ASM_X86_64_PROCESSOR_H */
diff -Nru a/include/asm-x86_64/ptrace.h b/include/asm-x86_64/ptrace.h
--- a/include/asm-x86_64/ptrace.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-x86_64/ptrace.h	Tue Jun 15 22:20:38 2004
@@ -83,7 +83,7 @@
 #if defined(__KERNEL__) && !defined(__ASSEMBLY__) 
 #define user_mode(regs) (!!((regs)->cs & 3))
 #define instruction_pointer(regs) ((regs)->rip)
-void signal_fault(struct pt_regs *regs, void *frame, char *where);
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
 
 enum {
         EF_CF   = 0x00000001,
diff -Nru a/include/asm-x86_64/rmap.h b/include/asm-x86_64/rmap.h
--- a/include/asm-x86_64/rmap.h	Tue Jun 15 22:20:44 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,7 +0,0 @@
-#ifndef _X8664_RMAP_H
-#define _X8664_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -Nru a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h
--- a/include/asm-x86_64/semaphore.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-x86_64/semaphore.h	Tue Jun 15 22:20:35 2004
@@ -47,12 +47,12 @@
 	atomic_t count;
 	int sleepers;
 	wait_queue_head_t wait;
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	long __magic;
 #endif
 };
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 # define __SEM_DEBUG_INIT(name) \
 		, (int)&(name).__magic
 #else
@@ -83,7 +83,7 @@
 	atomic_set(&sem->count, val);
 	sem->sleepers = 0;
 	init_waitqueue_head(&sem->wait);
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	sem->__magic = (int)&sem->__magic;
 #endif
 }
@@ -115,7 +115,7 @@
  */
 static inline void down(struct semaphore * sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -142,7 +142,7 @@
 {
 	int result;
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	might_sleep();
@@ -171,7 +171,7 @@
 {
 	int result;
 
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 
@@ -199,7 +199,7 @@
  */
 static inline void up(struct semaphore * sem)
 {
-#if WAITQUEUE_DEBUG
+#ifdef WAITQUEUE_DEBUG
 	CHECK_MAGIC(sem->__magic);
 #endif
 	__asm__ __volatile__(
diff -Nru a/include/asm-x86_64/sigcontext.h b/include/asm-x86_64/sigcontext.h
--- a/include/asm-x86_64/sigcontext.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-x86_64/sigcontext.h	Tue Jun 15 22:20:38 2004
@@ -2,6 +2,7 @@
 #define _ASM_X86_64_SIGCONTEXT_H
 
 #include <asm/types.h>
+#include <linux/compiler.h>
 
 /* FXSAVE frame */
 /* Note: reserved1/2 may someday contain valuable data. Always save/restore
@@ -47,7 +48,7 @@
 	unsigned long trapno;
 	unsigned long oldmask;
 	unsigned long cr2;
-	struct _fpstate *fpstate;	/* zero when no FPU context */
+	struct _fpstate __user *fpstate;	/* zero when no FPU context */
 	unsigned long reserved1[8];
 };
 
diff -Nru a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
--- a/include/asm-x86_64/smp.h	Tue Jun 15 22:20:35 2004
+++ b/include/asm-x86_64/smp.h	Tue Jun 15 22:20:35 2004
@@ -47,7 +47,7 @@
 extern void (*mtrr_hook) (void);
 extern void zap_low_mappings(void);
 void smp_stop_cpu(void);
-extern char cpu_sibling_map[];
+extern cpumask_t cpu_sibling_map[NR_CPUS];
 extern char phys_proc_id[NR_CPUS];
 
 #define SMP_TRAMPOLINE_BASE 0x6000
diff -Nru a/include/asm-x86_64/spinlock.h b/include/asm-x86_64/spinlock.h
--- a/include/asm-x86_64/spinlock.h	Tue Jun 15 22:21:03 2004
+++ b/include/asm-x86_64/spinlock.h	Tue Jun 15 22:21:03 2004
@@ -41,6 +41,7 @@
 
 #define spin_is_locked(x)	(*(volatile signed char *)(&(x)->lock) <= 0)
 #define spin_unlock_wait(x)	do { barrier(); } while(spin_is_locked(x))
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
 
 #define spin_lock_string \
 	"\n1:\t" \
diff -Nru a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h
--- a/include/asm-x86_64/timex.h	Tue Jun 15 22:20:41 2004
+++ b/include/asm-x86_64/timex.h	Tue Jun 15 22:20:41 2004
@@ -7,11 +7,12 @@
 #define _ASMx8664_TIMEX_H
 
 #include <linux/config.h>
+#include <asm/8253pit.h>
 #include <asm/msr.h>
 #include <asm/vsyscall.h>
 #include <asm/hpet.h>
 
-#define CLOCK_TICK_RATE	1193182 /* Underlying HZ */
+#define CLOCK_TICK_RATE	PIT_TICK_RATE	/* Underlying HZ */
 #define CLOCK_TICK_FACTOR	20	/* Factor of both 1000000 and CLOCK_TICK_RATE */
 #define FINETUNE ((((((int)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
 	(1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
diff -Nru a/include/asm-x86_64/types.h b/include/asm-x86_64/types.h
--- a/include/asm-x86_64/types.h	Tue Jun 15 22:20:44 2004
+++ b/include/asm-x86_64/types.h	Tue Jun 15 22:20:44 2004
@@ -51,6 +51,8 @@
 typedef u64 sector_t;
 #define HAVE_SECTOR_T
 
+typedef unsigned short kmem_bufctl_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
diff -Nru a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
--- a/include/asm-x86_64/uaccess.h	Tue Jun 15 22:20:38 2004
+++ b/include/asm-x86_64/uaccess.h	Tue Jun 15 22:20:38 2004
@@ -24,7 +24,7 @@
 
 #define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
 
-#define KERNEL_DS	MAKE_MM_SEG(0xFFFFFFFFFFFFFFFF)
+#define KERNEL_DS	MAKE_MM_SEG(0xFFFFFFFFFFFFFFFFUL)
 #define USER_DS		MAKE_MM_SEG(PAGE_OFFSET)
 
 #define get_ds()	(KERNEL_DS)
@@ -33,6 +33,16 @@
 
 #define segment_eq(a,b)	((a).seg == (b).seg)
 
+#ifdef __CHECKER__
+#define CHECK_UPTR(ptr) do {				\
+	__typeof__(*(ptr)) *__dummy_check_uptr =	\
+		(void __user *)&__dummy_check_uptr;	\
+} while(0)
+#else
+#define CHECK_UPTR(ptr)
+#endif
+
+
 #define __addr_ok(addr) (!((unsigned long)(addr) & (current_thread_info()->addr_limit.seg)))
 
 /*
@@ -40,15 +50,16 @@
  */
 #define __range_not_ok(addr,size) ({ \
 	unsigned long flag,sum; \
+	CHECK_UPTR(addr);	\
 	asm("# range_ok\n\r" \
 		"addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0"  \
 		:"=&r" (flag), "=r" (sum) \
 		:"1" (addr),"g" ((long)(size)),"g" (current_thread_info()->addr_limit.seg)); \
 	flag; })
 
-#define access_ok(type,addr,size) (__range_not_ok(addr,size) == 0)
+#define access_ok(type, addr, size) (__range_not_ok(addr,size) == 0)
 
-extern inline int verify_area(int type, const void * addr, unsigned long size)
+extern inline int verify_area(int type, const void __user * addr, unsigned long size)
 {
 	return access_ok(type,addr,size) ? 0 : -EFAULT;
 }
@@ -103,6 +114,7 @@
 #define get_user(x,ptr)							\
 ({	long __val_gu;							\
 	int __ret_gu; 							\
+	CHECK_UPTR(ptr);						\
 	switch(sizeof (*(ptr))) {					\
 	case 1:  __get_user_x(1,__ret_gu,__val_gu,ptr); break;		\
 	case 2:  __get_user_x(2,__ret_gu,__val_gu,ptr); break;		\
@@ -138,6 +150,7 @@
 #define __put_user_nocheck(x,ptr,size)			\
 ({							\
 	int __pu_err;					\
+	CHECK_UPTR(ptr);				\
 	__put_user_size((x),(ptr),(size),__pu_err);	\
 	__pu_err;					\
 })
@@ -193,6 +206,7 @@
 ({								\
 	int __gu_err;						\
 	long __gu_val;						\
+	CHECK_UPTR(ptr);					\
 	__get_user_size(__gu_val,(ptr),(size),__gu_err);	\
 	(x) = (__typeof__(*(ptr)))__gu_val;			\
 	__gu_err;						\
@@ -235,15 +249,15 @@
 /* Handles exceptions in both to and from, but doesn't do access_ok */
 extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); 
 
-extern unsigned long copy_to_user(void *to, const void *from, unsigned len); 
-extern unsigned long copy_from_user(void *to, const void *from, unsigned len); 
-extern unsigned long copy_in_user(void *to, const void *from, unsigned len); 
+extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); 
+extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); 
+extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); 
 
-static inline int __copy_from_user(void *dst, const void *src, unsigned size) 
+static inline int __copy_from_user(void *dst, const void __user *src, unsigned size) 
 { 
        int ret = 0;
 	if (!__builtin_constant_p(size))
-		return copy_user_generic(dst,src,size);
+		return copy_user_generic(dst,(void *)src,size);
 	switch (size) { 
 	case 1:__get_user_asm(*(u8*)dst,(u8 *)src,ret,"b","b","=q",1); 
 		return ret;
@@ -264,15 +278,15 @@
 		__get_user_asm(*(u64*)(8+(char*)dst),(u64*)(8+(char*)src),ret,"q","","=r",8);
 		return ret; 
 	default:
-		return copy_user_generic(dst,src,size); 
+		return copy_user_generic(dst,(void *)src,size); 
 	}
 }	
 
-static inline int __copy_to_user(void *dst, const void *src, unsigned size) 
+static inline int __copy_to_user(void __user *dst, const void *src, unsigned size) 
 { 
        int ret = 0;
 	if (!__builtin_constant_p(size))
-		return copy_user_generic(dst,src,size);
+		return copy_user_generic((void *)dst,src,size);
 	switch (size) { 
 	case 1:__put_user_asm(*(u8*)src,(u8 *)dst,ret,"b","b","iq",1); 
 		return ret;
@@ -295,16 +309,16 @@
 		__put_user_asm(1[(u64*)src],1+(u64*)dst,ret,"q","","ir",8);
 		return ret; 
 	default:
-		return copy_user_generic(dst,src,size); 
+		return copy_user_generic((void *)dst,src,size); 
 	}
 }	
 
 
-static inline int __copy_in_user(void *dst, const void *src, unsigned size) 
+static inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 
 { 
        int ret = 0;
 	if (!__builtin_constant_p(size))
-		return copy_user_generic(dst,src,size);
+		return copy_user_generic((void *)dst,(void *)src,size);
 	switch (size) { 
 	case 1: { 
 		u8 tmp;
@@ -336,15 +350,15 @@
 		return ret;
 	}
 	default:
-		return copy_user_generic(dst,src,size); 
+		return copy_user_generic((void *)dst,(void *)src,size); 
 	}
 }	
 
-long strncpy_from_user(char *dst, const char *src, long count);
-long __strncpy_from_user(char *dst, const char *src, long count);
-long strnlen_user(const char *str, long n);
-long strlen_user(const char *str);
-unsigned long clear_user(void *mem, unsigned long len);
-unsigned long __clear_user(void *mem, unsigned long len);
+long strncpy_from_user(char *dst, const char __user *src, long count);
+long __strncpy_from_user(char *dst, const char __user *src, long count);
+long strnlen_user(const char __user *str, long n);
+long strlen_user(const char __user *str);
+unsigned long clear_user(void __user *mem, unsigned long len);
+unsigned long __clear_user(void __user *mem, unsigned long len);
 
 #endif /* __X86_64_UACCESS_H */
diff -Nru a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
--- a/include/asm-x86_64/unistd.h	Tue Jun 15 22:20:42 2004
+++ b/include/asm-x86_64/unistd.h	Tue Jun 15 22:20:42 2004
@@ -98,7 +98,7 @@
 __SYSCALL(__NR_getpid, sys_getpid)
 
 #define __NR_sendfile                           40
-__SYSCALL(__NR_sendfile, sys_sendfile)
+__SYSCALL(__NR_sendfile, sys_sendfile64)
 #define __NR_socket                             41
 __SYSCALL(__NR_socket, sys_socket)
 #define __NR_connect                            42
@@ -534,26 +534,28 @@
 __SYSCALL(__NR_vserver, sys_ni_syscall)
 #define __NR_vserver		236
 __SYSCALL(__NR_vserver, sys_ni_syscall)
-#define __NR_mbind 			237
-__SYSCALL(__NR_mbind, sys_ni_syscall)
+#define __NR_mbind 		237
+__SYSCALL(__NR_mbind, sys_mbind)
 #define __NR_set_mempolicy 	238
-__SYSCALL(__NR_set_mempolicy, sys_ni_syscall)
+__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy)
 #define __NR_get_mempolicy 	239
-__SYSCALL(__NR_get_mempolicy, sys_ni_syscall)
+__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy)
 #define __NR_mq_open 		240
 __SYSCALL(__NR_mq_open, sys_mq_open)
 #define __NR_mq_unlink 		241
 __SYSCALL(__NR_mq_unlink, sys_mq_unlink)
 #define __NR_mq_timedsend 	242
 __SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
-#define __NR_mq_timedreceive 243
+#define __NR_mq_timedreceive	243
 __SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
 #define __NR_mq_notify 		244
 __SYSCALL(__NR_mq_notify, sys_mq_notify)
 #define __NR_mq_getsetattr 	245
 __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)
+#define __NR_kexec_load 	246
+__SYSCALL(__NR_kexec_load, sys_ni_syscall)
 
-#define __NR_syscall_max __NR_mq_getsetattr
+#define __NR_syscall_max __NR_kexec_load
 #ifndef __NO_STUBS
 
 /* user-visible error numbers are in the range -1 - -4095 */
@@ -569,6 +571,29 @@
 	return (type) (res); \
 } while (0)
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#define __ARCH_WANT_SYS_RT_SIGACTION
+#endif
+
 #ifndef __KERNEL_SYSCALLS__
 
 #define __syscall "syscall"
@@ -731,7 +756,7 @@
 
 #endif /* __KERNEL_SYSCALLS__ */
 
-#ifndef __ASSEMBLY__
+#if !defined(__ASSEMBLY__) && defined(__KERNEL__)
 
 #include <linux/linkage.h>
 #include <linux/compiler.h>
diff -Nru a/include/linux/acpi.h b/include/linux/acpi.h
--- a/include/linux/acpi.h	Tue Jun 15 22:20:35 2004
+++ b/include/linux/acpi.h	Tue Jun 15 22:20:35 2004
@@ -374,7 +374,7 @@
 
 extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT];
 
-typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header);
+typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header, const unsigned long end);
 
 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
 unsigned long acpi_find_rsdp (void);
diff -Nru a/include/linux/aio.h b/include/linux/aio.h
--- a/include/linux/aio.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/aio.h	Tue Jun 15 22:20:36 2004
@@ -59,7 +59,10 @@
 	struct list_head	ki_list;	/* the aio core uses this
 						 * for cancellation */
 
-	void __user		*ki_user_obj;	/* pointer to userland's iocb */
+	union {
+		void __user		*user;
+		struct task_struct	*tsk;
+	} ki_obj;
 	__u64			ki_user_data;	/* user's data for completion */
 	loff_t			ki_pos;
 
@@ -76,7 +79,7 @@
 		(x)->ki_filp = (filp);			\
 		(x)->ki_ctx = &tsk->active_mm->default_kioctx;	\
 		(x)->ki_cancel = NULL;			\
-		(x)->ki_user_obj = tsk;			\
+		(x)->ki_obj.tsk = tsk;			\
 	} while (0)
 
 #define AIO_RING_MAGIC			0xa10a10a1
@@ -149,11 +152,11 @@
 extern void FASTCALL(exit_aio(struct mm_struct *mm));
 extern struct kioctx *lookup_ioctx(unsigned long ctx_id);
 extern int FASTCALL(io_submit_one(struct kioctx *ctx,
-			struct iocb *user_iocb, struct iocb *iocb));
+			struct iocb __user *user_iocb, struct iocb *iocb));
 
 /* semi private, but used by the 32bit emulations: */
 struct kioctx *lookup_ioctx(unsigned long ctx_id);
-int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb *user_iocb,
+int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
 				  struct iocb *iocb));
 
 #define get_ioctx(kioctx)	do { if (unlikely(atomic_read(&(kioctx)->users) <= 0)) BUG(); atomic_inc(&(kioctx)->users); } while (0)
diff -Nru a/include/linux/ata.h b/include/linux/ata.h
--- a/include/linux/ata.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/ata.h	Tue Jun 15 22:20:41 2004
@@ -38,6 +38,7 @@
 
 	ATA_ID_WORDS		= 256,
 	ATA_ID_PROD_OFS		= 27,
+	ATA_ID_FW_REV_OFS	= 23,
 	ATA_ID_SERNO_OFS	= 10,
 	ATA_ID_MAJOR_VER	= 80,
 	ATA_ID_PIO_MODES	= 64,
@@ -103,7 +104,10 @@
 	ATA_REG_IRQ		= ATA_REG_NSECT,
 
 	/* ATA device commands */
+	ATA_CMD_CHK_POWER	= 0xE5, /* check power mode */
 	ATA_CMD_EDD		= 0x90,	/* execute device diagnostic */
+	ATA_CMD_FLUSH		= 0xE7,
+	ATA_CMD_FLUSH_EXT	= 0xEA,
 	ATA_CMD_ID_ATA		= 0xEC,
 	ATA_CMD_ID_ATAPI	= 0xA1,
 	ATA_CMD_READ		= 0xC8,
@@ -132,6 +136,8 @@
 
 	/* ATAPI stuff */
 	ATAPI_PKT_DMA		= (1 << 0),
+	ATAPI_DMADIR		= (1 << 2),	/* ATAPI data dir:
+						   0=to device, 1=to host */
 
 	/* cable types */
 	ATA_CBL_NONE		= 0,
@@ -196,9 +202,14 @@
 };
 
 #define ata_id_is_ata(dev)	(((dev)->id[0] & (1 << 15)) == 0)
+#define ata_id_rahead_enabled(dev) ((dev)->id[85] & (1 << 6))
+#define ata_id_wcache_enabled(dev) ((dev)->id[85] & (1 << 5))
 #define ata_id_has_lba48(dev)	((dev)->id[83] & (1 << 10))
+#define ata_id_has_wcache(dev)	((dev)->id[82] & (1 << 5))
+#define ata_id_has_pm(dev)	((dev)->id[82] & (1 << 3))
 #define ata_id_has_lba(dev)	((dev)->id[49] & (1 << 8))
 #define ata_id_has_dma(dev)	((dev)->id[49] & (1 << 9))
+#define ata_id_removeable(dev)	((dev)->id[0] & (1 << 7))
 #define ata_id_u32(dev,n)	\
 	(((u32) (dev)->id[(n) + 1] << 16) | ((u32) (dev)->id[(n)]))
 #define ata_id_u64(dev,n)	\
@@ -206,5 +217,11 @@
 	  ((u64) dev->id[(n) + 2] << 32) |	\
 	  ((u64) dev->id[(n) + 1] << 16) |	\
 	  ((u64) dev->id[(n) + 0]) )
+
+static inline int is_atapi_taskfile(struct ata_taskfile *tf)
+{
+	return (tf->protocol == ATA_PROT_ATAPI) ||
+	       (tf->protocol == ATA_PROT_ATAPI_DMA);
+}
 
 #endif /* __LINUX_ATA_H__ */
diff -Nru a/include/linux/atm.h b/include/linux/atm.h
--- a/include/linux/atm.h	Tue Jun 15 22:20:44 2004
+++ b/include/linux/atm.h	Tue Jun 15 22:20:44 2004
@@ -232,7 +232,7 @@
 struct atmif_sioc {
     int number;
     int length;
-    void *arg;
+    void __user *arg;
 };
 
 typedef unsigned short atm_backend_t;
diff -Nru a/include/linux/atmdev.h b/include/linux/atmdev.h
--- a/include/linux/atmdev.h	Tue Jun 15 22:20:44 2004
+++ b/include/linux/atmdev.h	Tue Jun 15 22:20:44 2004
@@ -351,11 +351,11 @@
 	void (*dev_close)(struct atm_dev *dev);
 	int (*open)(struct atm_vcc *vcc);
 	void (*close)(struct atm_vcc *vcc);
-	int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg);
+	int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
 	int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
-	    void *optval,int optlen);
+	    void __user *optval,int optlen);
 	int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
-	    void *optval,int optlen);
+	    void __user *optval,int optlen);
 	int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
 	int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
 	void (*phy_put)(struct atm_dev *dev,unsigned char value,
@@ -368,7 +368,7 @@
 
 struct atmphy_ops {
 	int (*start)(struct atm_dev *dev);
-	int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg);
+	int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
 	void (*interrupt)(struct atm_dev *dev);
 	int (*stop)(struct atm_dev *dev);
 };
diff -Nru a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
--- a/include/linux/auto_fs4.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/auto_fs4.h	Tue Jun 15 22:20:36 2004
@@ -23,6 +23,12 @@
 #define AUTOFS_MIN_PROTO_VERSION	3
 #define AUTOFS_MAX_PROTO_VERSION	4
 
+#define AUTOFS_PROTO_SUBVERSION         5
+
+/* Mask for expire behaviour */
+#define AUTOFS_EXP_IMMEDIATE		1
+#define AUTOFS_EXP_LEAVES		2
+
 /* New message type */
 #define autofs_ptype_expire_multi	2	/* Expire entry (umount request) */
 
@@ -41,7 +47,11 @@
 	struct autofs_packet_expire_multi expire_multi;
 };
 
-#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
+#define AUTOFS_IOC_EXPIRE_MULTI		_IOW(0x93,0x66,int)
+#define AUTOFS_IOC_PROTOSUBVER		_IOR(0x93,0x67,int)
+#define AUTOFS_IOC_ASKREGHOST           _IOR(0x93,0x68,int)
+#define AUTOFS_IOC_TOGGLEREGHOST        _IOR(0x93,0x69,int)
+#define AUTOFS_IOC_ASKUMOUNT		_IOR(0x93,0x70,int)
 
 
 #endif /* _LINUX_AUTO_FS4_H */
diff -Nru a/include/linux/backing-dev.h b/include/linux/backing-dev.h
--- a/include/linux/backing-dev.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/backing-dev.h	Tue Jun 15 22:20:38 2004
@@ -28,12 +28,12 @@
 	int memory_backed;	/* Cannot clean pages with writepage */
 	congested_fn *congested_fn; /* Function pointer if device is md/dm */
 	void *congested_data;	/* Pointer to aux data for congested func */
-	void (*unplug_io_fn)(struct backing_dev_info *);
+	void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
 	void *unplug_io_data;
 };
 
 extern struct backing_dev_info default_backing_dev_info;
-void default_unplug_io_fn(struct backing_dev_info *bdi);
+void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
 
 int writeback_acquire(struct backing_dev_info *bdi);
 int writeback_in_progress(struct backing_dev_info *bdi);
diff -Nru a/include/linux/bitmap.h b/include/linux/bitmap.h
--- a/include/linux/bitmap.h	Tue Jun 15 22:21:05 2004
+++ b/include/linux/bitmap.h	Tue Jun 15 22:21:05 2004
@@ -29,7 +29,8 @@
 static inline void bitmap_copy(unsigned long *dst,
 			const unsigned long *src, int bits)
 {
-	memcpy(dst, src, BITS_TO_LONGS(bits)*sizeof(unsigned long));
+	int len = BITS_TO_LONGS(bits)*sizeof(unsigned long);
+	memcpy(dst, src, len);
 }
 
 void bitmap_shift_right(unsigned long *dst,
diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h
--- a/include/linux/blkdev.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/blkdev.h	Tue Jun 15 22:20:38 2004
@@ -334,6 +334,8 @@
 	 * queue settings
 	 */
 	unsigned long		nr_requests;	/* Max # of requests */
+	unsigned int		nr_congestion_on;
+	unsigned int		nr_congestion_off;
 
 	unsigned short		max_sectors;
 	unsigned short		max_phys_segments;
@@ -515,7 +517,7 @@
 extern void blk_recount_segments(request_queue_t *, struct bio *);
 extern int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *);
 extern int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *);
-extern int scsi_cmd_ioctl(struct gendisk *, unsigned int, unsigned long);
+extern int scsi_cmd_ioctl(struct gendisk *, unsigned int, void __user *);
 extern void blk_start_queue(request_queue_t *q);
 extern void blk_stop_queue(request_queue_t *q);
 extern void __blk_stop_queue(request_queue_t *q);
@@ -530,16 +532,17 @@
 	return bdev->bd_disk->queue;
 }
 
-static inline void blk_run_backing_dev(struct backing_dev_info *bdi)
+static inline void blk_run_backing_dev(struct backing_dev_info *bdi,
+				       struct page *page)
 {
 	if (bdi && bdi->unplug_io_fn)
-		bdi->unplug_io_fn(bdi);
+		bdi->unplug_io_fn(bdi, page);
 }
 
 static inline void blk_run_address_space(struct address_space *mapping)
 {
 	if (mapping)
-		blk_run_backing_dev(mapping->backing_dev_info);
+		blk_run_backing_dev(mapping->backing_dev_info, NULL);
 }
 
 /*
diff -Nru a/include/linux/blkpg.h b/include/linux/blkpg.h
--- a/include/linux/blkpg.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/blkpg.h	Tue Jun 15 22:20:40 2004
@@ -33,7 +33,7 @@
         int op;
         int flags;
         int datalen;
-        void *data;
+        void __user *data;
 };
 
 /* The subfunctions (for the op field) */
diff -Nru a/include/linux/buffer_head.h b/include/linux/buffer_head.h
--- a/include/linux/buffer_head.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/buffer_head.h	Tue Jun 15 22:20:36 2004
@@ -170,6 +170,7 @@
 struct buffer_head *alloc_buffer_head(int gfp_flags);
 void free_buffer_head(struct buffer_head * bh);
 void FASTCALL(unlock_buffer(struct buffer_head *bh));
+void FASTCALL(__lock_buffer(struct buffer_head *bh));
 void ll_rw_block(int, int, struct buffer_head * bh[]);
 void sync_dirty_buffer(struct buffer_head *bh);
 void submit_bh(int, struct buffer_head *);
@@ -279,8 +280,8 @@
 
 static inline void lock_buffer(struct buffer_head *bh)
 {
-	while (test_set_buffer_locked(bh))
-		__wait_on_buffer(bh);
+	if (test_set_buffer_locked(bh))
+		__lock_buffer(bh);
 }
 
 #endif /* _LINUX_BUFFER_HEAD_H */
diff -Nru a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h
--- a/include/linux/cciss_ioctl.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/cciss_ioctl.h	Tue Jun 15 22:20:39 2004
@@ -167,7 +167,7 @@
   RequestBlock_struct      Request;
   ErrorInfo_struct  	   error_info; 
   WORD			   buf_size;  /* size in bytes of the buf */
-  BYTE			   *buf;
+  BYTE			   __user *buf;
 } IOCTL_Command_struct;
 
 typedef struct _BIG_IOCTL_Command_struct {
@@ -177,7 +177,7 @@
   DWORD			   malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
   DWORD			   buf_size;    /* size in bytes of the buf */
   				        /* < malloc_size * MAXSGENTRIES */
-  BYTE			   *buf;
+  BYTE			   __user *buf;
 } BIG_IOCTL_Command_struct;
 
 typedef struct _LogvolInfo_struct{
diff -Nru a/include/linux/cdrom.h b/include/linux/cdrom.h
--- a/include/linux/cdrom.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/cdrom.h	Tue Jun 15 22:20:36 2004
@@ -237,9 +237,9 @@
 struct cdrom_read_audio
 {
 	union cdrom_addr addr; /* frame address */
-	__u8 addr_format;    /* CDROM_LBA or CDROM_MSF */
+	__u8 addr_format;      /* CDROM_LBA or CDROM_MSF */
 	int nframes;           /* number of 2352-byte-frames to read at once */
-	__u8 *buf;           /* frame buffer (size: nframes*2352 bytes) */
+	__u8 __user *buf;      /* frame buffer (size: nframes*2352 bytes) */
 };
 
 /* This struct is used with the CDROMMULTISESSION ioctl */
@@ -280,17 +280,16 @@
 struct cdrom_generic_command
 {
 	unsigned char 		cmd[CDROM_PACKET_SIZE];
-	unsigned char 		*buffer;
+	unsigned char		__user *buffer;
 	unsigned int 		buflen;
 	int			stat;
-	struct request_sense	*sense;
+	struct request_sense	__user *sense;
 	unsigned char		data_direction;
 	int			quiet;
 	int			timeout;
-	void			*reserved[1];
+	void			__user *reserved[1];	/* unused, actually */
 };
 
-
 /*
  * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, 
  * 2340, or 2352 bytes long.  
@@ -907,6 +906,19 @@
 #include <linux/fs.h>		/* not really needed, later.. */
 #include <linux/device.h>
 
+struct packet_command
+{
+	unsigned char 		cmd[CDROM_PACKET_SIZE];
+	unsigned char 		*buffer;
+	unsigned int 		buflen;
+	int			stat;
+	struct request_sense	*sense;
+	unsigned char		data_direction;
+	int			quiet;
+	int			timeout;
+	void			*reserved[1];
+};
+
 /*
  * _OLD will use PIO transfer on atapi devices, _BPC_* will use DMA
  */
@@ -965,7 +977,7 @@
 	int n_minors;           /* number of active minor devices */
 	/* handle uniform packets for scsi type devices (scsi,atapi) */
 	int (*generic_packet) (struct cdrom_device_info *,
-			       struct cdrom_generic_command *);
+			       struct packet_command *);
 };
 
 /* the general block_device operations structure: */
@@ -990,11 +1002,11 @@
 extern int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written);
 extern int cdrom_number_of_slots(struct cdrom_device_info *cdi);
 extern int cdrom_mode_select(struct cdrom_device_info *cdi,
-			     struct cdrom_generic_command *cgc);
+			     struct packet_command *cgc);
 extern int cdrom_mode_sense(struct cdrom_device_info *cdi,
-			    struct cdrom_generic_command *cgc,
+			    struct packet_command *cgc,
 			    int page_code, int page_control);
-extern void init_cdrom_command(struct cdrom_generic_command *cgc,
+extern void init_cdrom_command(struct packet_command *cgc,
 			       void *buffer, int len, int type);
 
 /* The SCSI spec says there could be 256 slots. */
diff -Nru a/include/linux/coda.h b/include/linux/coda.h
--- a/include/linux/coda.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/coda.h	Tue Jun 15 22:20:40 2004
@@ -759,13 +759,14 @@
 
 #define PIOCPARM_MASK 0x0000ffff
 struct ViceIoctl {
-        caddr_t in, out;        /* Data to be transferred in, or out */
+        void __user *in;        /* Data to be transferred in */
+        void __user *out;       /* Data to be transferred out */
         short in_size;          /* Size of input buffer <= 2K */
         short out_size;         /* Maximum size of output buffer, <= 2K */
 };
 
 struct PioctlData {
-        const char *path;
+        const char __user *path;
         int follow;
         struct ViceIoctl vi;
 };
diff -Nru a/include/linux/coda_proc.h b/include/linux/coda_proc.h
--- a/include/linux/coda_proc.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/coda_proc.h	Tue Jun 15 22:20:36 2004
@@ -82,9 +82,9 @@
  * data structure for /proc/sys/... files 
  */
 int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp,
-			     void * buffer, size_t * lenp );
+			     void __user * buffer, size_t * lenp );
 int do_reset_coda_cache_inv_stats( ctl_table * table, int write, 
-				   struct file * filp, void * buffer, 
+				   struct file * filp, void __user * buffer, 
 				   size_t * lenp );
 
 /* these functions are called to form the content of /proc/fs/coda/... files */
diff -Nru a/include/linux/compat.h b/include/linux/compat.h
--- a/include/linux/compat.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/compat.h	Tue Jun 15 22:20:40 2004
@@ -46,9 +46,9 @@
 	compat_sigset_word	sig[_COMPAT_NSIG_WORDS];
 } compat_sigset_t;
 
-extern int cp_compat_stat(struct kstat *, struct compat_stat *);
-extern int get_compat_timespec(struct timespec *, const struct compat_timespec *);
-extern int put_compat_timespec(const struct timespec *, struct compat_timespec *);
+extern int cp_compat_stat(struct kstat *, struct compat_stat __user *);
+extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *);
+extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *);
 
 struct compat_iovec {
 	compat_uptr_t	iov_base;
@@ -117,5 +117,18 @@
 long compat_sys_shmctl(int first, int second, void __user *uptr);
 long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
 		unsigned nsems, const struct compat_timespec __user *timeout);
+
+asmlinkage ssize_t compat_sys_readv(unsigned long fd,
+		const struct compat_iovec __user *vec, unsigned long vlen);
+asmlinkage ssize_t compat_sys_writev(unsigned long fd,
+		const struct compat_iovec __user *vec, unsigned long vlen);
+
+int compat_do_execve(char * filename, compat_uptr_t __user *argv,
+	        compat_uptr_t __user *envp, struct pt_regs * regs);
+
+asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
+		compat_ulong_t __user *outp, compat_ulong_t __user *exp,
+		struct compat_timeval __user *tvp);
+
 #endif /* CONFIG_COMPAT */
 #endif /* _LINUX_COMPAT_H */
diff -Nru a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
--- a/include/linux/compat_ioctl.h	Tue Jun 15 22:21:03 2004
+++ b/include/linux/compat_ioctl.h	Tue Jun 15 22:21:03 2004
@@ -125,6 +125,7 @@
 COMPATIBLE_IOCTL(RESTART_ARRAY_RW)
 /* DM */
 COMPATIBLE_IOCTL(DM_VERSION_32)
+COMPATIBLE_IOCTL(DM_REMOVE_ALL_32)
 COMPATIBLE_IOCTL(DM_LIST_DEVICES_32)
 COMPATIBLE_IOCTL(DM_DEV_CREATE_32)
 COMPATIBLE_IOCTL(DM_DEV_REMOVE_32)
@@ -138,6 +139,7 @@
 COMPATIBLE_IOCTL(DM_TABLE_STATUS_32)
 COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32)
 COMPATIBLE_IOCTL(DM_VERSION)
+COMPATIBLE_IOCTL(DM_REMOVE_ALL)
 COMPATIBLE_IOCTL(DM_LIST_DEVICES)
 COMPATIBLE_IOCTL(DM_DEV_CREATE)
 COMPATIBLE_IOCTL(DM_DEV_REMOVE)
@@ -275,6 +277,8 @@
 COMPATIBLE_IOCTL(SIOCSMIIREG)
 COMPATIBLE_IOCTL(SIOCGIFVLAN)
 COMPATIBLE_IOCTL(SIOCSIFVLAN)
+COMPATIBLE_IOCTL(SIOCBRADDBR)
+COMPATIBLE_IOCTL(SIOCBRDELBR)
 /* SG stuff */
 COMPATIBLE_IOCTL(SG_SET_TIMEOUT)
 COMPATIBLE_IOCTL(SG_GET_TIMEOUT)
@@ -546,6 +550,10 @@
 COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER)
 COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE)
 COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE_MULTI)
+COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOSUBVER)
+COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST)
+COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST)
+COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT)
 /* DEVFS */
 COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV)
 COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK)
diff -Nru a/include/linux/compiler.h b/include/linux/compiler.h
--- a/include/linux/compiler.h	Tue Jun 15 22:20:42 2004
+++ b/include/linux/compiler.h	Tue Jun 15 22:20:42 2004
@@ -5,10 +5,14 @@
 # define __user		__attribute__((noderef, address_space(1)))
 # define __kernel	/* default address space */
 # define __safe		__attribute__((safe))
+# define __force	__attribute__((force))
+extern void __chk_user_ptr(void __user *);
 #else
 # define __user
 # define __kernel
 # define __safe
+# define __force
+# define __chk_user_ptr(x) (void)0
 #endif
 
 #ifdef __KERNEL__
diff -Nru a/include/linux/console.h b/include/linux/console.h
--- a/include/linux/console.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/console.h	Tue Jun 15 22:20:39 2004
@@ -19,6 +19,7 @@
 
 struct vc_data;
 struct console_font_op;
+struct module;
 
 /*
  * this is what the terminal answers to a ESC-Z or csi0c query.
@@ -27,6 +28,7 @@
 #define VT102ID "\033[?6c"
 
 struct consw {
+	struct module *owner;
 	const char *(*con_startup)(void);
 	void	(*con_init)(struct vc_data *, int);
 	void	(*con_deinit)(struct vc_data *);
@@ -58,7 +60,7 @@
 extern const struct consw newport_con;	/* SGI Newport console  */
 extern const struct consw prom_con;	/* SPARC PROM console */
 
-void take_over_console(const struct consw *sw, int first, int last, int deflt);
+int take_over_console(const struct consw *sw, int first, int last, int deflt);
 void give_up_console(const struct consw *sw);
 
 /* scroll */
diff -Nru a/include/linux/cpu.h b/include/linux/cpu.h
--- a/include/linux/cpu.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/cpu.h	Tue Jun 15 22:20:37 2004
@@ -60,7 +60,8 @@
 #define unlock_cpu_hotplug()	up(&cpucontrol)
 #define lock_cpu_hotplug_interruptible() down_interruptible(&cpucontrol)
 #define hotcpu_notifier(fn, pri) {				\
-	static struct notifier_block fn##_nb = { fn, pri };	\
+	static struct notifier_block fn##_nb =			\
+		{ .notifier_call = fn, .priority = pri };	\
 	register_cpu_notifier(&fn##_nb);			\
 }
 int cpu_down(unsigned int cpu);
diff -Nru a/include/linux/cpufreq.h b/include/linux/cpufreq.h
--- a/include/linux/cpufreq.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/cpufreq.h	Tue Jun 15 22:20:41 2004
@@ -21,6 +21,7 @@
 #include <linux/kobject.h>
 #include <linux/sysfs.h>
 #include <linux/completion.h>
+#include <linux/workqueue.h>
 
 #define CPUFREQ_NAME_LEN 16
 
@@ -81,6 +82,9 @@
  	struct semaphore	lock;   /* CPU ->setpolicy or ->target may
 					   only be called once a time */
 
+	struct work_struct	update; /* if update_policy() needs to be
+					 * called, but you're in IRQ context */
+
 	struct cpufreq_real_policy	user_policy;
 
 	struct kobject		kobj;
@@ -96,11 +100,13 @@
 
 #define CPUFREQ_PRECHANGE	(0)
 #define CPUFREQ_POSTCHANGE	(1)
+#define CPUFREQ_RESUMECHANGE	(8)
 
 struct cpufreq_freqs {
 	unsigned int cpu;	/* cpu nr */
 	unsigned int old;
 	unsigned int new;
+	u8 flags;		/* flags of cpufreq_driver, see below. */
 };
 
 
@@ -187,6 +193,9 @@
 				 unsigned int target_freq,
 				 unsigned int relation);
 
+	/* should be defined, if possible */
+	unsigned int	(*get)	(unsigned int cpu);
+
 	/* optional */
 	int	(*exit)		(struct cpufreq_policy *policy);
 	int	(*resume)	(struct cpufreq_policy *policy);
@@ -195,8 +204,19 @@
 
 /* flags */
 
-#define CPUFREQ_STICKY	0x01	/* the driver isn't removed even if 
-				   all ->init() calls failed */
+#define CPUFREQ_STICKY		0x01	/* the driver isn't removed even if 
+					 * all ->init() calls failed */
+#define CPUFREQ_CONST_LOOPS 	0x02	/* loops_per_jiffy or other kernel
+					 * "constants" aren't affected by
+					 * frequency transitions */
+#define CPUFREQ_PANIC_OUTOFSYNC	0x04	/* panic if cpufreq's opinion of
+					 * current frequency differs from
+					 * actual frequency */
+#define CPUFREQ_PANIC_RESUME_OUTOFSYNC 0x08 /* panic if cpufreq's opinion of
+					 * current frequency differs from
+					 * actual frequency on resume
+					 * from sleep. */
+
 
 int cpufreq_register_driver(struct cpufreq_driver *driver_data);
 int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
@@ -234,6 +254,9 @@
 int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
 int cpufreq_update_policy(unsigned int cpu);
 
+/* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */
+unsigned int cpufreq_get(unsigned int cpu);
+
 /* the proc_intf.c needs this */
 int cpufreq_parse_governor (char *str_governor, unsigned int *policy, struct cpufreq_governor **governor);
 
@@ -241,13 +264,10 @@
 /*********************************************************************
  *                      CPUFREQ USERSPACE GOVERNOR                   *
  *********************************************************************/
-int cpufreq_gov_userspace_init(void);
-
 #ifdef CONFIG_CPU_FREQ_24_API
 
 int cpufreq_setmax(unsigned int cpu);
 int cpufreq_set(unsigned int kHz, unsigned int cpu);
-unsigned int cpufreq_get(unsigned int cpu);
 
 
 /* /proc/sys/cpu */
diff -Nru a/include/linux/cpumask.h b/include/linux/cpumask.h
--- a/include/linux/cpumask.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/cpumask.h	Tue Jun 15 22:20:39 2004
@@ -10,11 +10,15 @@
 
 extern cpumask_t cpu_online_map;
 extern cpumask_t cpu_possible_map;
+extern cpumask_t cpu_present_map;
 
 #define num_online_cpus()		cpus_weight(cpu_online_map)
 #define num_possible_cpus()		cpus_weight(cpu_possible_map)
+#define num_present_cpus()		cpus_weight(cpu_present_map)
+
 #define cpu_online(cpu)			cpu_isset(cpu, cpu_online_map)
 #define cpu_possible(cpu)		cpu_isset(cpu, cpu_possible_map)
+#define cpu_present(cpu)		cpu_isset(cpu, cpu_present_map)
 
 #define for_each_cpu_mask(cpu, mask)					\
 	for (cpu = first_cpu_const(mk_cpumask_const(mask));		\
@@ -23,16 +27,24 @@
 
 #define for_each_cpu(cpu) for_each_cpu_mask(cpu, cpu_possible_map)
 #define for_each_online_cpu(cpu) for_each_cpu_mask(cpu, cpu_online_map)
+#define for_each_present_cpu(cpu) for_each_cpu_mask(cpu, cpu_present_map)
 #else
 #define	cpu_online_map			cpumask_of_cpu(0)
 #define	cpu_possible_map		cpumask_of_cpu(0)
+#define	cpu_present_map			cpumask_of_cpu(0)
+
 #define num_online_cpus()		1
 #define num_possible_cpus()		1
+#define num_present_cpus()		1
+
 #define cpu_online(cpu)			({ BUG_ON((cpu) != 0); 1; })
 #define cpu_possible(cpu)		({ BUG_ON((cpu) != 0); 1; })
+#define cpu_present(cpu)		({ BUG_ON((cpu) != 0); 1; })
 
+#define for_each_cpu_mask(cpu, mask) for (cpu = 0; cpu < 1; cpu++)
 #define for_each_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
 #define for_each_online_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
+#define for_each_present_cpu(cpu) for (cpu = 0; cpu < 1; cpu++)
 #endif
 
 #define cpumask_scnprintf(buf, buflen, map)				\
diff -Nru a/include/linux/dcache.h b/include/linux/dcache.h
--- a/include/linux/dcache.h	Tue Jun 15 22:21:05 2004
+++ b/include/linux/dcache.h	Tue Jun 15 22:21:05 2004
@@ -27,12 +27,14 @@
 /*
  * "quick string" -- eases parameter passing, but more importantly
  * saves "metadata" about the string (ie length and the hash).
+ *
+ * hash comes first so it snuggles against d_parent and d_bucket in the
+ * dentry.
  */
 struct qstr {
-	const unsigned char * name;
-	unsigned int len;
 	unsigned int hash;
-	char name_str[0];
+	const unsigned char *name;
+	unsigned int len;
 };
 
 struct dentry_stat_t {
@@ -74,38 +76,39 @@
 	return end_name_hash(hash);
 }
 
-#define DNAME_INLINE_LEN_MIN 24
-
 struct dcookie_struct;
- 
+
+#define DNAME_INLINE_LEN_MIN 36
+
 struct dentry {
 	atomic_t d_count;
+	unsigned int d_flags;		/* protected by d_lock */
 	spinlock_t d_lock;		/* per dentry lock */
-	unsigned long d_vfs_flags;	/* moved here to be on same cacheline */
-	struct inode  * d_inode;	/* Where the name belongs to - NULL is negative */
+	struct inode *d_inode;		/* Where the name belongs to - NULL is
+					 * negative */
+	/*
+	 * The next three fields are touched by __d_lookup.  Place them here
+	 * so they all fit in a 16-byte range, with 16-byte alignment.
+	 */
+	struct dentry *d_parent;	/* parent directory */
+	struct hlist_head *d_bucket;	/* lookup hash bucket */
+	struct qstr d_name;
+
 	struct list_head d_lru;		/* LRU list */
 	struct list_head d_child;	/* child of parent list */
 	struct list_head d_subdirs;	/* our children */
 	struct list_head d_alias;	/* inode alias list */
 	unsigned long d_time;		/* used by d_revalidate */
-	struct dentry_operations  *d_op;
-	struct super_block * d_sb;	/* The root of the dentry tree */
-	unsigned int d_flags;
+	struct dentry_operations *d_op;
+	struct super_block *d_sb;	/* The root of the dentry tree */
 	int d_mounted;
-	void * d_fsdata;		/* fs-specific data */
+	void *d_fsdata;			/* fs-specific data */
  	struct rcu_head d_rcu;
-	struct dcookie_struct * d_cookie; /* cookie, if any */
-	unsigned long d_move_count;	/* to indicated moved dentry while lockless lookup */
-	struct qstr * d_qstr;		/* quick str ptr used in lockless lookup and concurrent d_move */
-	struct dentry * d_parent;	/* parent directory */
-	struct qstr d_name;
+	struct dcookie_struct *d_cookie; /* cookie, if any */
 	struct hlist_node d_hash;	/* lookup hash list */	
-	struct hlist_head * d_bucket;	/* lookup hash bucket */
-	unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
+	unsigned char d_iname[DNAME_INLINE_LEN_MIN];	/* small names */
 };
 
-#define DNAME_INLINE_LEN	(sizeof(struct dentry)-offsetof(struct dentry,d_iname))
- 
 struct dentry_operations {
 	int (*d_revalidate)(struct dentry *, struct nameidata *);
 	int (*d_hash) (struct dentry *, struct qstr *);
@@ -124,13 +127,13 @@
 
 /*
 locking rules:
-		big lock	dcache_lock	may block
-d_revalidate:	no		no		yes
-d_hash		no		no		yes
-d_compare:	no		yes		no
-d_delete:	no		yes		no
-d_release:	no		no		yes
-d_iput:		no		no		yes
+		big lock	dcache_lock	d_lock   may block
+d_revalidate:	no		no		no       yes
+d_hash		no		no		no       yes
+d_compare:	no		yes		yes      no
+d_delete:	no		yes		no       no
+d_release:	no		no		no       yes
+d_iput:		no		no		no       yes
  */
 
 /* d_flags entries */
@@ -175,8 +178,8 @@
 
 static inline void __d_drop(struct dentry *dentry)
 {
-	if (!(dentry->d_vfs_flags & DCACHE_UNHASHED)) {
-		dentry->d_vfs_flags |= DCACHE_UNHASHED;
+	if (!(dentry->d_flags & DCACHE_UNHASHED)) {
+		dentry->d_flags |= DCACHE_UNHASHED;
 		hlist_del_rcu(&dentry->d_hash);
 	}
 }
@@ -188,9 +191,9 @@
 	spin_unlock(&dcache_lock);
 }
 
-static inline int dname_external(struct dentry *d)
+static inline int dname_external(struct dentry *dentry)
 {
-	return d->d_name.name != d->d_iname; 
+	return dentry->d_name.name != dentry->d_iname;
 }
 
 /*
@@ -287,7 +290,7 @@
  
 static inline int d_unhashed(struct dentry *dentry)
 {
-	return (dentry->d_vfs_flags & DCACHE_UNHASHED);
+	return (dentry->d_flags & DCACHE_UNHASHED);
 }
 
 static inline struct dentry *dget_parent(struct dentry *dentry)
diff -Nru a/include/linux/delay.h b/include/linux/delay.h
--- a/include/linux/delay.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/delay.h	Tue Jun 15 22:20:38 2004
@@ -38,4 +38,6 @@
 #define ndelay(x)	udelay(((x)+999)/1000)
 #endif
 
+void msleep(unsigned int msecs);
+
 #endif /* defined(_LINUX_DELAY_H) */
diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h	Tue Jun 15 22:20:59 2004
+++ b/include/linux/device.h	Tue Jun 15 22:20:59 2004
@@ -400,13 +400,13 @@
 
 /* debugging and troubleshooting/diagnostic helpers. */
 #define dev_printk(level, dev, format, arg...)	\
-	printk(level "%s %s: " format , (dev)->driver->name , (dev)->bus_id , ## arg)
+	printk(level "%s %s: " format , (dev)->driver ? (dev)->driver->name : "" , (dev)->bus_id , ## arg)
 
 #ifdef DEBUG
 #define dev_dbg(dev, format, arg...)		\
 	dev_printk(KERN_DEBUG , dev , format , ## arg)
 #else
-#define dev_dbg(dev, format, arg...) do {} while (0)
+#define dev_dbg(dev, format, arg...) do { (void)(dev); } while (0)
 #endif
 
 #define dev_err(dev, format, arg...)		\
diff -Nru a/include/linux/edd.h b/include/linux/edd.h
--- a/include/linux/edd.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/edd.h	Tue Jun 15 22:20:36 2004
@@ -166,9 +166,9 @@
 	u8 device;
 	u8 version;
 	u16 interface_support;
-	u16 legacy_cylinders;
-	u8 legacy_heads;
-	u8 legacy_sectors;
+	u16 legacy_max_cylinder;
+	u8 legacy_max_head;
+	u8 legacy_sectors_per_track;
 	struct edd_device_params params;
 } __attribute__ ((packed));
 
diff -Nru a/include/linux/efi.h b/include/linux/efi.h
--- a/include/linux/efi.h	Tue Jun 15 22:21:03 2004
+++ b/include/linux/efi.h	Tue Jun 15 22:21:03 2004
@@ -370,11 +370,4 @@
 	u16 length;
 } __attribute ((packed));
 
-/*
- * efi_dir is allocated in arch/ia64/kernel/efi.c.
- */
-#ifdef CONFIG_PROC_FS
-extern struct proc_dir_entry *efi_dir;
-#endif
-
 #endif /* _LINUX_EFI_H */
diff -Nru a/include/linux/elf.h b/include/linux/elf.h
--- a/include/linux/elf.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/elf.h	Tue Jun 15 22:20:37 2004
@@ -81,8 +81,7 @@
 
 #define EM_V850		87	/* NEC v850 */
 
-#define EM_H8_300H      47      /* Hitachi H8/300H */
-#define EM_H8S          48      /* Hitachi H8S     */
+#define EM_H8_300       46      /* Hitachi H8/300,300H,H8S */
 
 /*
  * This is an interim value that we will use until the committee comes
diff -Nru a/include/linux/ethtool.h b/include/linux/ethtool.h
--- a/include/linux/ethtool.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/ethtool.h	Tue Jun 15 22:20:38 2004
@@ -351,6 +351,8 @@
 	int	(*phys_id)(struct net_device *, u32);
 	int	(*get_stats_count)(struct net_device *);
 	void	(*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
+	int	(*begin)(struct net_device *);
+	void	(*complete)(struct net_device *);
 };
 
 /* CMDs currently supported */
diff -Nru a/include/linux/fb.h b/include/linux/fb.h
--- a/include/linux/fb.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/fb.h	Tue Jun 15 22:20:38 2004
@@ -516,7 +516,6 @@
 	struct fb_cmap cmap;		/* Current cmap */
 	struct fb_ops *fbops;
 	char *screen_base;		/* Virtual address */
-	struct vc_data *display_fg;	/* Console visible on this display */
 	int currcon;			/* Current VC. */
 	void *pseudo_palette;		/* Fake palette of 16 colors */ 
 #define FBINFO_STATE_RUNNING	0
diff -Nru a/include/linux/fd.h b/include/linux/fd.h
--- a/include/linux/fd.h	Tue Jun 15 22:20:44 2004
+++ b/include/linux/fd.h	Tue Jun 15 22:20:44 2004
@@ -339,7 +339,7 @@
 #define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */
 #define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */
 
-	void *data;
+	void __user *data;
 	char *kernel_data; /* location of data buffer in the kernel */
 	struct floppy_raw_cmd *next; /* used for chaining of raw cmd's 
 				      * within the kernel */
diff -Nru a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/fs.h	Tue Jun 15 22:20:38 2004
@@ -13,14 +13,12 @@
 #include <linux/types.h>
 #include <linux/kdev_t.h>
 #include <linux/ioctl.h>
-#include <linux/list.h>
 #include <linux/dcache.h>
 #include <linux/stat.h>
 #include <linux/cache.h>
-#include <linux/radix-tree.h>
+#include <linux/prio_tree.h>
 #include <linux/kobject.h>
 #include <asm/atomic.h>
-#include <linux/audit.h>
 
 struct iovec;
 struct nameidata;
@@ -213,6 +211,9 @@
 
 #ifdef __KERNEL__
 
+#include <linux/list.h>
+#include <linux/radix-tree.h>
+#include <linux/audit.h>
 #include <asm/semaphore.h>
 #include <asm/byteorder.h>
 
@@ -329,9 +330,10 @@
 	unsigned long		nrpages;	/* number of total pages */
 	pgoff_t			writeback_index;/* writeback starts here */
 	struct address_space_operations *a_ops;	/* methods */
-	struct list_head	i_mmap;		/* list of private mappings */
-	struct list_head	i_mmap_shared;	/* list of shared mappings */
-	struct semaphore	i_shared_sem;	/* protect both above lists */
+	struct prio_tree_root	i_mmap;		/* tree of private mappings */
+	unsigned int		i_mmap_writable;/* count VM_SHARED mappings */
+	struct list_head	i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
+	spinlock_t		i_mmap_lock;	/* protect tree, count, list */
 	atomic_t		truncate_count;	/* Cover race condition with truncate */
 	unsigned long		flags;		/* error bits/gfp mask */
 	struct backing_dev_info *backing_dev_info; /* device readahead, etc */
@@ -356,6 +358,7 @@
 	int			bd_invalidated;
 	struct gendisk *	bd_disk;
 	struct list_head	bd_list;
+	struct backing_dev_info *bd_inode_backing_dev_info;
 	/*
 	 * Private data.  You must have bd_claim'ed the block_device
 	 * to use this.  NOTE:  bd_claim allows an owner to claim
@@ -379,19 +382,19 @@
  */
 static inline int mapping_mapped(struct address_space *mapping)
 {
-	return	!list_empty(&mapping->i_mmap) ||
-		!list_empty(&mapping->i_mmap_shared);
+	return	!prio_tree_empty(&mapping->i_mmap) ||
+		!list_empty(&mapping->i_mmap_nonlinear);
 }
 
 /*
  * Might pages of this file have been modified in userspace?
- * Note that i_mmap_shared holds all the VM_SHARED vmas: do_mmap_pgoff
+ * Note that i_mmap_writable counts all VM_SHARED vmas: do_mmap_pgoff
  * marks vma as VM_SHARED if it is shared, and the file was opened for
  * writing i.e. vma may be mprotected writable even if now readonly.
  */
 static inline int mapping_writably_mapped(struct address_space *mapping)
 {
-	return	!list_empty(&mapping->i_mmap_shared);
+	return mapping->i_mmap_writable != 0;
 }
 
 /*
@@ -529,8 +532,8 @@
 	rwlock_t lock;          /* protects pid, uid, euid fields */
 	int pid;		/* pid or -pgrp where SIGIO should be sent */
 	uid_t uid, euid;	/* uid/euid of process setting the owner */
-	int signum;		/* posix.1b rt signal to be delivered on IO */
 	void *security;
+	int signum;		/* posix.1b rt signal to be delivered on IO */
 };
 
 /*
@@ -558,10 +561,10 @@
 	atomic_t		f_count;
 	unsigned int 		f_flags;
 	mode_t			f_mode;
+	int			f_error;
 	loff_t			f_pos;
 	struct fown_struct	f_owner;
 	unsigned int		f_uid, f_gid;
-	int			f_error;
 	struct file_ra_state	f_ra;
 
 	unsigned long		f_version;
@@ -596,7 +599,7 @@
 #if BITS_PER_LONG==32
 #define MAX_LFS_FILESIZE	(((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
 #elif BITS_PER_LONG==64
-#define MAX_LFS_FILESIZE 	0x7fffffffffffffff
+#define MAX_LFS_FILESIZE 	0x7fffffffffffffffUL
 #endif
 
 #define FL_POSIX	1
@@ -795,7 +798,7 @@
 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
 extern int vfs_mkdir(struct inode *, struct dentry *, int);
 extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
-extern int vfs_symlink(struct inode *, struct dentry *, const char *);
+extern int vfs_symlink(struct inode *, struct dentry *, const char *, int);
 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
 extern int vfs_rmdir(struct inode *, struct dentry *);
 extern int vfs_unlink(struct inode *, struct dentry *);
@@ -1114,6 +1117,7 @@
 			void *data);
 struct super_block *get_sb_pseudo(struct file_system_type *, char *,
 			struct super_operations *ops, unsigned long);
+int __put_super(struct super_block *sb);
 void unnamed_dev_init(void);
 
 /* Alas, no aliases. Too much hassle with bringing module.h everywhere */
@@ -1125,6 +1129,7 @@
 extern int register_filesystem(struct file_system_type *);
 extern int unregister_filesystem(struct file_system_type *);
 extern struct vfsmount *kern_mount(struct file_system_type *);
+extern int may_umount_tree(struct vfsmount *);
 extern int may_umount(struct vfsmount *);
 extern long do_mount(char *, char *, char *, unsigned long, void *);
 
@@ -1229,7 +1234,6 @@
 extern int blkdev_put(struct block_device *);
 extern int bd_claim(struct block_device *, void *);
 extern void bd_release(struct block_device *);
-extern void blk_run_queues(void);
 
 /* fs/char_dev.c */
 extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, char *);
diff -Nru a/include/linux/futex.h b/include/linux/futex.h
--- a/include/linux/futex.h	Tue Jun 15 22:20:42 2004
+++ b/include/linux/futex.h	Tue Jun 15 22:20:42 2004
@@ -8,9 +8,10 @@
 #define FUTEX_WAKE (1)
 #define FUTEX_FD (2)
 #define FUTEX_REQUEUE (3)
-
+#define FUTEX_CMP_REQUEUE (4)
 
 long do_futex(unsigned long uaddr, int op, int val,
-		unsigned long timeout, unsigned long uaddr2, int val2);
+		unsigned long timeout, unsigned long uaddr2, int val2,
+		int val3);
 
 #endif
diff -Nru a/include/linux/gameport.h b/include/linux/gameport.h
--- a/include/linux/gameport.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/gameport.h	Tue Jun 15 22:20:39 2004
@@ -118,10 +118,4 @@
 	return (time * gameport->speed) / 1000;
 }
 
-static __inline__ void wait_ms(unsigned int ms)
-{
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(1 + ms * HZ / 1000);
-}
-
 #endif
diff -Nru a/include/linux/gfp.h b/include/linux/gfp.h
--- a/include/linux/gfp.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/gfp.h	Tue Jun 15 22:20:38 2004
@@ -4,6 +4,10 @@
 #include <linux/mmzone.h>
 #include <linux/stddef.h>
 #include <linux/linkage.h>
+#include <linux/config.h>
+
+struct vm_area_struct;
+
 /*
  * GFP bitmasks..
  */
@@ -69,19 +73,38 @@
  * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets
  * optimized to &contig_page_data at compile-time.
  */
-extern struct page * FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *));
-static inline struct page * alloc_pages_node(int nid, unsigned int gfp_mask, unsigned int order)
+extern struct page *
+FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *));
+
+static inline struct page *alloc_pages_node(int nid, unsigned int gfp_mask,
+						unsigned int order)
 {
 	if (unlikely(order >= MAX_ORDER))
 		return NULL;
 
-	return __alloc_pages(gfp_mask, order, NODE_DATA(nid)->node_zonelists + (gfp_mask & GFP_ZONEMASK));
+	return __alloc_pages(gfp_mask, order,
+		NODE_DATA(nid)->node_zonelists + (gfp_mask & GFP_ZONEMASK));
 }
 
+#ifdef CONFIG_NUMA
+extern struct page *alloc_pages_current(unsigned gfp_mask, unsigned order);
+
+static inline struct page *
+alloc_pages(unsigned int gfp_mask, unsigned int order)
+{
+	if (unlikely(order >= MAX_ORDER))
+		return NULL;
+
+	return alloc_pages_current(gfp_mask, order);
+}
+extern struct page *alloc_page_vma(unsigned gfp_mask,
+			struct vm_area_struct *vma, unsigned long addr);
+#else
 #define alloc_pages(gfp_mask, order) \
 		alloc_pages_node(numa_node_id(), gfp_mask, order)
-#define alloc_page(gfp_mask) \
-		alloc_pages_node(numa_node_id(), gfp_mask, 0)
+#define alloc_page_vma(gfp_mask, vma, addr) alloc_pages(gfp_mask, 0)
+#endif
+#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
 
 extern unsigned long FASTCALL(__get_free_pages(unsigned int gfp_mask, unsigned int order));
 extern unsigned long FASTCALL(get_zeroed_page(unsigned int gfp_mask));
diff -Nru a/include/linux/hdlc.h b/include/linux/hdlc.h
--- a/include/linux/hdlc.h	Tue Jun 15 22:21:05 2004
+++ b/include/linux/hdlc.h	Tue Jun 15 22:21:05 2004
@@ -134,7 +134,7 @@
 			int dce_pvc_count;
 
 			struct timer_list timer;
-			int last_poll;
+			unsigned long last_poll;
 			int reliable;
 			int dce_changed;
 			int request;
@@ -149,8 +149,9 @@
 			cisco_proto settings;
 
 			struct timer_list timer;
-			int last_poll;
+			unsigned long last_poll;
 			int up;
+			int request_sent;
 			u32 txseq; /* TX sequence number */
 			u32 rxseq; /* RX sequence number */
 		}cisco;
diff -Nru a/include/linux/hugetlb.h b/include/linux/hugetlb.h
--- a/include/linux/hugetlb.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/hugetlb.h	Tue Jun 15 22:20:40 2004
@@ -3,6 +3,8 @@
 
 #ifdef CONFIG_HUGETLB_PAGE
 
+#include <linux/mempolicy.h>
+
 struct ctl_table;
 
 static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
@@ -10,7 +12,7 @@
 	return vma->vm_flags & VM_HUGETLB;
 }
 
-int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void *, size_t *);
+int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *);
 int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
 int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int);
 void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
@@ -30,6 +32,7 @@
 
 extern unsigned long max_huge_pages;
 extern const unsigned long hugetlb_zero, hugetlb_infinity;
+extern int sysctl_hugetlb_shm_group;
 
 static inline void
 mark_mm_hugetlb(struct mm_struct *mm, struct vm_area_struct *vma)
@@ -102,6 +105,17 @@
 	long	free_inodes;  /* inodes free */
 	spinlock_t	stat_lock;
 };
+
+
+struct hugetlbfs_inode_info {
+	struct shared_policy policy;
+	struct inode vfs_inode;
+};
+
+static inline struct hugetlbfs_inode_info *HUGETLBFS_I(struct inode *inode)
+{
+	return container_of(inode, struct hugetlbfs_inode_info, vfs_inode);
+}
 
 static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
 {
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
--- a/include/linux/i2c-id.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/i2c-id.h	Tue Jun 15 22:20:36 2004
@@ -222,7 +222,7 @@
 #define I2C_HW_B_OMAHA  0x14    /* Omaha I2C interface (ARM)		*/
 #define I2C_HW_B_GUIDE  0x15    /* Guide bit-basher			*/
 #define I2C_HW_B_IXP2000 0x16	/* GPIO on IXP2000 systems              */
-#define I2C_HW_B_IXP425 0x17	/* GPIO on IXP425 systems		*/
+#define I2C_HW_B_IXP4XX 0x17	/* GPIO on IXP4XX systems		*/
 #define I2C_HW_B_S3VIA	0x18	/* S3Via ProSavage adapter		*/
 #define I2C_HW_B_ZR36067 0x19	/* Zoran-36057/36067 based boards	*/
 
diff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/i2c.h	Tue Jun 15 22:20:37 2004
@@ -113,6 +113,7 @@
 	struct module *owner;
 	char name[32];
 	int id;
+	unsigned int class;
 	unsigned int flags;		/* div., see below		*/
 
 	/* Notifies the driver that a new bus has appeared. This routine
@@ -237,7 +238,6 @@
 	/* data fields that are valid for all devices	*/
 	struct semaphore bus_lock;
 	struct semaphore clist_lock;
-	unsigned int flags;/* flags specifying div. data		*/
 
 	int timeout;
 	int retries;
@@ -286,12 +286,14 @@
 						/* Must equal I2C_M_TEN below */
 
 /* i2c adapter classes (bitmask) */
-#define I2C_ADAP_CLASS_SMBUS		(1<<0)	/* lm_sensors, ... */
-#define I2C_ADAP_CLASS_TV_ANALOG	(1<<1)	/* bttv + friends */
-#define I2C_ADAP_CLASS_TV_DIGITAL	(1<<2)	/* dbv cards */
-#define I2C_ADAP_CLASS_DDC		(1<<3)	/* i2c-matroxfb ? */
-#define I2C_ADAP_CLASS_CAM_ANALOG	(1<<4)	/* camera with analog CCD */
-#define I2C_ADAP_CLASS_CAM_DIGITAL	(1<<5)	/* most webcams */
+#define I2C_CLASS_HWMON		(1<<0)	/* lm_sensors, ... */
+#define I2C_CLASS_TV_ANALOG	(1<<1)	/* bttv + friends */
+#define I2C_CLASS_TV_DIGITAL	(1<<2)	/* dvb cards */
+#define I2C_CLASS_DDC		(1<<3)	/* i2c-matroxfb ? */
+#define I2C_CLASS_CAM_ANALOG	(1<<4)	/* camera with analog CCD */
+#define I2C_CLASS_CAM_DIGITAL	(1<<5)	/* most webcams */
+#define I2C_CLASS_SOUND		(1<<6)	/* sound devices */
+#define I2C_CLASS_ALL		(UINT_MAX) /* all of the above */
 
 /* i2c_client_address_data is the struct for holding default client
  * addresses for a driver and for the parameters supplied on the
@@ -598,12 +600,5 @@
         ((clientptr)->adapter->algo->id == I2C_ALGO_ISA)
 #define i2c_is_isa_adapter(adapptr) \
         ((adapptr)->algo->id == I2C_ALGO_ISA)
-
-/* Tiny delay function used by the i2c bus drivers */
-static inline void i2c_delay(signed long timeout)
-{
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(timeout);
-}
 
 #endif /* _LINUX_I2C_H */
diff -Nru a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h
--- a/include/linux/i2o-dev.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/i2o-dev.h	Tue Jun 15 22:20:37 2004
@@ -41,6 +41,13 @@
 #define I2OHTML 		_IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html)
 #define I2OEVTREG		_IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id)
 #define I2OEVTGET		_IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info)
+#define I2OPASSTHRU		_IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru)
+
+struct i2o_cmd_passthru
+{
+	unsigned int iop;	/* IOP unit number */
+	void *msg;		/* message */
+};
 
 struct i2o_cmd_hrtlct
 {
diff -Nru a/include/linux/i2o.h b/include/linux/i2o.h
--- a/include/linux/i2o.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/i2o.h	Tue Jun 15 22:20:38 2004
@@ -76,6 +76,16 @@
 };
 
 /*
+ * context queue entry, used for 32-bit context on 64-bit systems
+ */
+struct i2o_context_list_element {
+	struct i2o_context_list_element *next;
+	u32 context;
+	void *ptr;
+	unsigned int flags;
+};
+
+/*
  * Each I2O controller has one of these objects
  */
 struct i2o_controller
@@ -133,6 +143,11 @@
 
 	void *page_frame;			/* Message buffers */
 	dma_addr_t page_frame_map;		/* Cache map */
+#if BITS_PER_LONG == 64
+	spinlock_t context_list_lock;		/* lock for context_list */
+	struct i2o_context_list_element *context_list; /* list of context id's
+						    and pointers */
+#endif
 };
 
 /*
@@ -322,6 +337,27 @@
 extern void i2o_run_queue(struct i2o_controller *);
 extern int i2o_delete_controller(struct i2o_controller *);
 
+#if BITS_PER_LONG == 64
+extern u32 i2o_context_list_add(void *, struct i2o_controller *);
+extern void *i2o_context_list_get(u32, struct i2o_controller *);
+extern u32 i2o_context_list_remove(void *, struct i2o_controller *);
+#else
+static inline u32 i2o_context_list_add(void *ptr, struct i2o_controller *c)
+{
+	return (u32)ptr;
+}
+
+static inline void *i2o_context_list_get(u32 context, struct i2o_controller *c)
+{
+	return (void *)context;
+}
+
+static inline u32 i2o_context_list_remove(void *ptr, struct i2o_controller *c)
+{
+	return (u32)ptr;
+}
+#endif
+
 /*
  *	Cache strategies
  */
@@ -640,12 +676,18 @@
 #define HOST_TID		1
 
 #define MSG_FRAME_SIZE		64	/* i2o_scsi assumes >= 32 */
+#define REPLY_FRAME_SIZE	17
+#define SG_TABLESIZE		30
 #define NMBR_MSG_FRAMES		128
 
 #define MSG_POOL_SIZE		(MSG_FRAME_SIZE*NMBR_MSG_FRAMES*sizeof(u32))
 
 #define I2O_POST_WAIT_OK	0
 #define I2O_POST_WAIT_TIMEOUT	-ETIMEDOUT
+
+#define I2O_CONTEXT_LIST_MIN_LENGTH	15
+#define I2O_CONTEXT_LIST_USED		0x01
+#define I2O_CONTEXT_LIST_DELETED	0x02
 
 #endif /* __KERNEL__ */
 #endif /* _I2O_H */
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/ide.h	Tue Jun 15 22:20:39 2004
@@ -305,20 +305,25 @@
 
 #include <asm/ide.h>
 
+/* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */
+#ifndef IDE_ARCH_OBSOLETE_DEFAULTS
+# define ide_default_io_base(index)	(0)
+# define ide_default_irq(base)		(0)
+# define ide_init_default_irq(base)	(0)
+#endif
+
 /*
  * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series.
- *
- * arm26, arm, h8300, m68k, m68knommu (broken) and i386-pc9800 (broken)
- * still have their own versions.
+ * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in <asm/ide.h>.
  */
-#if !defined(CONFIG_ARM) && !defined(CONFIG_H8300) && !defined(CONFIG_M68K)
+#ifdef IDE_ARCH_OBSOLETE_INIT
 static inline void ide_init_hwif_ports(hw_regs_t *hw,
 				       unsigned long io_addr,
 				       unsigned long ctl_addr,
 				       int *irq)
 {
 	if (!ctl_addr)
-		ide_std_init_ports(hw, io_addr, io_addr + 0x206);
+		ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr));
 	else
 		ide_std_init_ports(hw, io_addr, ctl_addr);
 
@@ -332,7 +337,16 @@
 		ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq);
 #endif
 }
-#endif /* !ARM && !H8300 && !M68K */
+#else
+static inline void ide_init_hwif_ports(hw_regs_t *hw,
+				       unsigned long io_addr,
+				       unsigned long ctl_addr,
+				       int *irq)
+{
+	if (io_addr || ctl_addr)
+		printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__);
+}
+#endif /* IDE_ARCH_OBSOLETE_INIT */
 
 /* Currently only m68k, apus and m8xx need it */
 #ifndef IDE_ARCH_ACK_INTR
@@ -676,7 +690,6 @@
 typedef enum {
 	ide_stopped,	/* no drive operation was started */
 	ide_started,	/* a drive operation was started, handler was set */
-	ide_released,	/* as ide_started, but bus also released */
 } ide_startstop_t;
 
 struct ide_driver_s;
@@ -710,7 +723,6 @@
 	u8	keep_settings;		/* restore settings after drive reset */
 	u8	autodma;		/* device can safely use dma on host */
 	u8	using_dma;		/* disk is using dma for read/write */
-	u8	using_tcq;		/* disk is using queueing */
 	u8	retry_pio;		/* retrying dma capable host in pio */
 	u8	state;			/* retry state */
 	u8	waiting_for_dma;	/* dma currently in progress */
@@ -737,6 +749,7 @@
 	unsigned remap_0_to_1	: 1;	/* 0=noremap, 1=remap 0->1 (for EZDrive) */
 	unsigned blocked        : 1;	/* 1=powermanagment told us not to do anything, so sleep nicely */
 	unsigned vdma		: 1;	/* 1=doing PIO over DMA 0=doing normal DMA */
+	unsigned stroke		: 1;	/* from:  hdx=stroke */
 	unsigned addressing;		/*      : 3;
 					 *  0=28-bit
 					 *  1=48-bit
@@ -767,7 +780,6 @@
 	u8	sect;		/* "real" sectors per track */
 	u8	bios_head;	/* BIOS/fdisk/LILO number of heads */
 	u8	bios_sect;	/* BIOS/fdisk/LILO sectors per track */
-	u8	queue_depth;	/* max queue depth */
 
 	unsigned int	bios_cyl;	/* BIOS/fdisk/LILO number of cyls */
 	unsigned int	cyl;		/* "real" number of cyls */
@@ -1081,7 +1093,6 @@
 
 extern struct semaphore ide_setting_sem;
 extern int ide_add_setting(ide_drive_t *drive, const char *name, int rw, int read_ioctl, int write_ioctl, int data_type, int min, int max, int mul_factor, int div_factor, void *data, ide_procset_t *set);
-extern void ide_remove_setting(ide_drive_t *drive, char *name);
 extern ide_settings_t *ide_find_setting_by_name(ide_drive_t *drive, char *name);
 extern int ide_read_setting(ide_drive_t *t, ide_settings_t *setting);
 extern int ide_write_setting(ide_drive_t *drive, ide_settings_t *setting, int val);
@@ -1102,7 +1113,6 @@
 
 extern void proc_ide_create(void);
 extern void proc_ide_destroy(void);
-extern void destroy_proc_ide_device(ide_hwif_t *, ide_drive_t *);
 extern void destroy_proc_ide_drives(ide_hwif_t *);
 extern void create_proc_ide_interfaces(void);
 extern void ide_add_proc_entries(struct proc_dir_entry *, ide_proc_entry_t *, void *);
@@ -1345,6 +1355,8 @@
  */
 extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
 
+extern void try_to_flush_leftover_data(ide_drive_t *);
+
 /*
  * Issue ATA command and wait for completion.
  * Use for implementing commands in kernel
@@ -1472,7 +1484,6 @@
 int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
 int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
 
-extern void ide_delay_50ms(void);
 extern int system_bus_clock(void);
 
 extern u8 ide_auto_reduce_xfer(ide_drive_t *);
@@ -1541,7 +1552,6 @@
 #define NODMA 0
 #define NOAUTODMA 1
 #define AUTODMA 2
-#define EOL 255
 
 typedef struct ide_pci_enablebit_s {
 	u8	reg;	/* byte pci reg holding the enable-bit */
@@ -1549,9 +1559,15 @@
 	u8	val;	/* value of masked reg when "enabled" */
 } ide_pci_enablebit_t;
 
+enum {
+	/* Uses ISA control ports not PCI ones. */
+	IDEPCI_FLAG_ISA_PORTS		= (1 << 0),
+
+	IDEPCI_FLAG_FORCE_MASTER	= (1 << 1),
+	IDEPCI_FLAG_FORCE_PDC		= (1 << 2),
+};
+
 typedef struct ide_pci_device_s {
-	u16			vendor;
-	u16			device;
 	char			*name;
 	void			(*init_setup)(struct pci_dev *, struct ide_pci_device_s *);
 	void			(*init_setup_dma)(struct pci_dev *, struct ide_pci_device_s *, ide_hwif_t *);
@@ -1565,7 +1581,7 @@
 	u8			bootable;
 	unsigned int		extra;
 	struct ide_pci_device_s	*next;
-	u8			isa_ports; 	/* Uses ISA control ports not PCI ones */
+	u8			flags;
 } ide_pci_device_t;
 
 extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
@@ -1604,14 +1620,6 @@
 extern int __ide_dma_timeout(ide_drive_t *);
 #endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
 
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
-extern int __ide_dma_queued_on(ide_drive_t *drive);
-extern int __ide_dma_queued_off(ide_drive_t *drive);
-extern ide_startstop_t __ide_dma_queued_read(ide_drive_t *drive);
-extern ide_startstop_t __ide_dma_queued_write(ide_drive_t *drive);
-extern ide_startstop_t __ide_dma_queued_start(ide_drive_t *drive);
-#endif
-
 #else
 static inline int __ide_dma_off(ide_drive_t *drive) { return 0; }
 #endif /* CONFIG_BLK_DEV_IDEDMA */
@@ -1679,28 +1687,6 @@
  */
 
 #define local_irq_set(flags)	do { local_save_flags((flags)); local_irq_enable(); } while (0)
-
-#define IDE_MAX_TAG	32
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
-static inline int ata_pending_commands(ide_drive_t *drive)
-{
-	if (drive->using_tcq)
-		return blk_queue_tag_depth(drive->queue);
-
-	return 0;
-}
-
-static inline int ata_can_queue(ide_drive_t *drive)
-{
-	if (drive->using_tcq)
-		return blk_queue_tag_queue(drive->queue);
-
-	return 1;
-}
-#else
-#define ata_pending_commands(drive)	(0)
-#define ata_can_queue(drive)		(1)
-#endif
 
 extern struct bus_type ide_bus_type;
 
diff -Nru a/include/linux/idr.h b/include/linux/idr.h
--- a/include/linux/idr.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/idr.h	Tue Jun 15 22:20:36 2004
@@ -15,10 +15,10 @@
 
 #if BITS_PER_LONG == 32
 # define IDR_BITS 5
-# define IDR_FULL 0xffffffff
+# define IDR_FULL 0xfffffffful
 #elif BITS_PER_LONG == 64
 # define IDR_BITS 6
-# define IDR_FULL 0xffffffffffffffff
+# define IDR_FULL 0xfffffffffffffffful
 #else
 # error "BITS_PER_LONG is not 32 or 64"
 #endif
diff -Nru a/include/linux/if.h b/include/linux/if.h
--- a/include/linux/if.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/if.h	Tue Jun 15 22:20:40 2004
@@ -63,6 +63,7 @@
 #define IF_IFACE_T1	0x1003		/* T1 telco serial interface	*/
 #define IF_IFACE_E1	0x1004		/* E1 telco serial interface	*/
 #define IF_IFACE_SYNC_SERIAL 0x1005	/* can't be set by software	*/
+#define IF_IFACE_X21D   0x1006          /* X.21 Dual Clocking (FarSite) */
 
 /* For definitions see hdlc.h */
 #define IF_PROTO_HDLC	0x2000		/* raw HDLC protocol		*/
@@ -77,6 +78,7 @@
 #define IF_PROTO_FR_DEL_ETH_PVC 0x2009	/*  Delete FR Ethernet-bridged PVC */
 #define IF_PROTO_FR_PVC	0x200A		/* for reading PVC status	*/
 #define IF_PROTO_FR_ETH_PVC 0x200B
+#define IF_PROTO_RAW    0x200C          /* RAW Socket                   */
 
 
 /*
@@ -145,7 +147,7 @@
 		struct  ifmap ifru_map;
 		char	ifru_slave[IFNAMSIZ];	/* Just fits the size */
 		char	ifru_newname[IFNAMSIZ];
-		char __user *	ifru_data;
+		void __user *	ifru_data;
 		struct	if_settings ifru_settings;
 	} ifr_ifru;
 };
@@ -180,8 +182,8 @@
 	int	ifc_len;			/* size of buffer	*/
 	union 
 	{
-		char *			ifcu_buf;
-		struct	ifreq 		*ifcu_req;
+		char __user *ifcu_buf;
+		struct ifreq __user *ifcu_req;
 	} ifc_ifcu;
 };
 #define	ifc_buf	ifc_ifcu.ifcu_buf		/* buffer address	*/
diff -Nru a/include/linux/if_arp.h b/include/linux/if_arp.h
--- a/include/linux/if_arp.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/if_arp.h	Tue Jun 15 22:20:43 2004
@@ -86,6 +86,7 @@
 #define ARPHRD_IEEE80211_PRISM 802	/* IEEE 802.11 + Prism2 header  */
 
 #define ARPHRD_VOID	  0xFFFF	/* Void type, nothing is known */
+#define ARPHRD_NONE	  0xFFFE	/* zero header length */
 
 /* ARP protocol opcodes. */
 #define	ARPOP_REQUEST	1		/* ARP request			*/
diff -Nru a/include/linux/if_bridge.h b/include/linux/if_bridge.h
--- a/include/linux/if_bridge.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/if_bridge.h	Tue Jun 15 22:20:40 2004
@@ -17,6 +17,12 @@
 
 #include <linux/types.h>
 
+#define SYSFS_BRIDGE_ATTR	"bridge"
+#define SYSFS_BRIDGE_FDB	"brforward"
+#define SYSFS_BRIDGE_PORT_SUBDIR "brif"
+#define SYSFS_BRIDGE_PORT_ATTR	"brport"
+#define SYSFS_BRIDGE_PORT_LINK	"bridge"
+
 #define BRCTL_VERSION 1
 
 #define BRCTL_GET_VERSION 0
@@ -98,7 +104,7 @@
 
 #include <linux/netdevice.h>
 
-extern void brioctl_set(int (*ioctl_hook)(unsigned long));
+extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *));
 extern int (*br_handle_frame_hook)(struct sk_buff *skb);
 extern int (*br_should_route_hook)(struct sk_buff **pskb);
 
diff -Nru a/include/linux/if_frad.h b/include/linux/if_frad.h
--- a/include/linux/if_frad.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/if_frad.h	Tue Jun 15 22:20:36 2004
@@ -191,7 +191,7 @@
    int               buffer;		/* current buffer for S508 firmware */
 };
 
-extern void dlci_ioctl_set(int (*hook)(unsigned int, void *));
+extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
 
 #endif /* __KERNEL__ */
 
diff -Nru a/include/linux/if_vlan.h b/include/linux/if_vlan.h
--- a/include/linux/if_vlan.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/if_vlan.h	Tue Jun 15 22:20:37 2004
@@ -55,7 +55,7 @@
 #define VLAN_VID_MASK	0xfff
 
 /* found in socket.c */
-extern void vlan_ioctl_set(int (*hook)(unsigned long));
+extern void vlan_ioctl_set(int (*hook)(void __user *));
 
 #define VLAN_NAME "vlan"
 
diff -Nru a/include/linux/igmp.h b/include/linux/igmp.h
--- a/include/linux/igmp.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/igmp.h	Tue Jun 15 22:20:40 2004
@@ -204,9 +204,9 @@
 		struct ip_mreq_source *mreqs, int ifindex);
 extern int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf,int ifindex);
 extern int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
-		struct ip_msfilter *optval, int *optlen);
+		struct ip_msfilter __user *optval, int __user *optlen);
 extern int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
-		struct group_filter *optval, int *optlen);
+		struct group_filter __user *optval, int __user *optlen);
 extern int ip_mc_sf_allow(struct sock *sk, u32 local, u32 rmt, int dif);
 extern void ip_mr_init(void);
 extern void ip_mc_init_dev(struct in_device *);
diff -Nru a/include/linux/inetdevice.h b/include/linux/inetdevice.h
--- a/include/linux/inetdevice.h	Tue Jun 15 22:20:42 2004
+++ b/include/linux/inetdevice.h	Tue Jun 15 22:20:42 2004
@@ -96,7 +96,7 @@
 
 extern struct net_device 	*ip_dev_find(u32 addr);
 extern int		inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b);
-extern int		devinet_ioctl(unsigned int cmd, void *);
+extern int		devinet_ioctl(unsigned int cmd, void __user *);
 extern void		devinet_init(void);
 extern struct in_device *inetdev_init(struct net_device *dev);
 extern struct in_device	*inetdev_by_index(int);
diff -Nru a/include/linux/init.h b/include/linux/init.h
--- a/include/linux/init.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/init.h	Tue Jun 15 22:20:36 2004
@@ -46,8 +46,6 @@
 #define __exitdata	__attribute__ ((__section__(".exit.data")))
 #define __exit_call	__attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
 
-#define __sched		__attribute__((__section__(".sched.text")))
-
 #ifdef MODULE
 #define __exit		__attribute__ ((__section__(".exit.text")))
 #else
diff -Nru a/include/linux/input.h b/include/linux/input.h
--- a/include/linux/input.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/input.h	Tue Jun 15 22:20:40 2004
@@ -655,7 +655,7 @@
 	struct ff_envelope envelope;
 
 /* Only used if waveform == FF_CUSTOM */
-	__u32 custom_len;	/* Number of samples  */	
+	__u32 custom_len;	/* Number of samples */
 	__s16 *custom_data;	/* Buffer of samples */
 /* Note: the data pointed by custom_data is copied by the driver. You can
  * therefore dispose of the memory after the upload/update */
@@ -749,8 +749,6 @@
 #define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
 	((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
 
-#define init_input_dev(dev)	do { INIT_LIST_HEAD(&((dev)->h_list)); INIT_LIST_HEAD(&((dev)->node)); } while (0)
-
 #define SET_INPUT_KEYCODE(dev, scancode, val)			\
 		({	unsigned __old;				\
 		switch (dev->keycodesize) {			\
@@ -915,6 +913,12 @@
 #define to_handle(n) container_of(n,struct input_handle,d_node)
 #define to_handle_h(n) container_of(n,struct input_handle,h_node)
 
+static inline void init_input_dev(struct input_dev *dev)
+{
+	INIT_LIST_HEAD(&dev->h_list);
+	INIT_LIST_HEAD(&dev->node);
+}
+
 void input_register_device(struct input_dev *);
 void input_unregister_device(struct input_dev *);
 
@@ -932,14 +936,51 @@
 
 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
 
-#define input_report_key(a,b,c) input_event(a, EV_KEY, b, !!(c))
-#define input_report_rel(a,b,c) input_event(a, EV_REL, b, c)
-#define input_report_abs(a,b,c) input_event(a, EV_ABS, b, c)
-#define input_report_ff(a,b,c)	input_event(a, EV_FF, b, c)
-#define input_report_ff_status(a,b,c)	input_event(a, EV_FF_STATUS, b, c)
+static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
+{
+	input_event(dev, EV_KEY, code, !!value);
+}
+
+static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value)
+{
+	input_event(dev, EV_REL, code, value);
+}
+
+static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value)
+{
+	input_event(dev, EV_ABS, code, value);
+}
+
+static inline void input_report_ff(struct input_dev *dev, unsigned int code, int value)
+{
+	input_event(dev, EV_FF, code, value);
+}
+
+static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value)
+{
+	input_event(dev, EV_FF_STATUS, code, value);
+}
+
+static inline void input_regs(struct input_dev *dev, struct pt_regs *regs)
+{
+	dev->regs = regs;
+}
+
+static inline void input_sync(struct input_dev *dev)
+{
+	input_event(dev, EV_SYN, SYN_REPORT, 0);
+	dev->regs = NULL;
+}
+
+static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
+{
+	dev->absmin[axis] = min;
+	dev->absmax[axis] = max;
+	dev->absfuzz[axis] = fuzz;
+	dev->absflat[axis] = flat;
 
-#define input_regs(a,b)		do { (a)->regs = (b); } while (0)
-#define input_sync(a)		do { input_event(a, EV_SYN, SYN_REPORT, 0); (a)->regs = NULL; } while (0)
+	dev->absbit[LONG(axis)] |= BIT(axis);
+}
 
 extern struct class_simple *input_class;
 
diff -Nru a/include/linux/ipv6.h b/include/linux/ipv6.h
--- a/include/linux/ipv6.h	Tue Jun 15 22:20:42 2004
+++ b/include/linux/ipv6.h	Tue Jun 15 22:20:42 2004
@@ -192,6 +192,8 @@
 	__u16			dst1;
 };
 
+#define IP6CB(skb)	((struct inet6_skb_parm*)((skb)->cb))
+
 struct ipv6_pinfo {
 	struct in6_addr 	saddr;
 	struct in6_addr 	rcv_saddr;
diff -Nru a/include/linux/kd.h b/include/linux/kd.h
--- a/include/linux/kd.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/kd.h	Tue Jun 15 22:20:43 2004
@@ -1,6 +1,7 @@
 #ifndef _LINUX_KD_H
 #define _LINUX_KD_H
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /* 0x4B is 'K', to avoid collision with termios and vt */
 
@@ -12,7 +13,7 @@
 struct consolefontdesc {
 	unsigned short charcount;	/* characters in font (256 or 512) */
 	unsigned short charheight;	/* scan lines per character (1-32) */
-	char *chardata;			/* font data in expanded form */
+	char __user *chardata;		/* font data in expanded form */
 };
 
 #define PIO_FONTRESET   0x4B6D	/* reset to default font */
@@ -63,7 +64,7 @@
 };
 struct unimapdesc {
 	unsigned short entry_ct;
-	struct unipair *entries;
+	struct unipair __user *entries;
 };
 #define PIO_UNIMAP	0x4B67	/* put unicode-to-font mapping in kernel */
 #define PIO_UNIMAPCLR	0x4B68	/* clear table, possibly advise hash algorithm */
diff -Nru a/include/linux/kernel.h b/include/linux/kernel.h
--- a/include/linux/kernel.h	Tue Jun 15 22:20:35 2004
+++ b/include/linux/kernel.h	Tue Jun 15 22:20:35 2004
@@ -109,14 +109,17 @@
 extern void bust_spinlocks(int yes);
 extern int oops_in_progress;		/* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_on_oops;
-extern int system_state;		/* See values below */
 extern int tainted;
 extern const char *print_tainted(void);
 
 /* Values used for system_state */
-#define SYSTEM_BOOTING 0
-#define SYSTEM_RUNNING 1
-#define SYSTEM_SHUTDOWN 2
+extern enum system_states {
+	SYSTEM_BOOTING,
+	SYSTEM_RUNNING,
+	SYSTEM_HALT,
+	SYSTEM_POWER_OFF,
+	SYSTEM_RESTART,
+} system_state;
 
 #define TAINT_PROPRIETARY_MODULE	(1<<0)
 #define TAINT_FORCED_MODULE		(1<<1)
diff -Nru a/include/linux/kmod.h b/include/linux/kmod.h
--- a/include/linux/kmod.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/kmod.h	Tue Jun 15 22:20:37 2004
@@ -23,6 +23,8 @@
 #include <linux/errno.h>
 #include <linux/compiler.h>
 
+#define KMOD_PATH_LEN 256
+
 #ifdef CONFIG_KMOD
 /* modprobe exit status on success, -ve on error.  Return value
  * usually useless though. */
diff -Nru a/include/linux/kobject.h b/include/linux/kobject.h
--- a/include/linux/kobject.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/kobject.h	Tue Jun 15 22:20:36 2004
@@ -48,7 +48,7 @@
 extern int kobject_add(struct kobject *);
 extern void kobject_del(struct kobject *);
 
-extern void kobject_rename(struct kobject *, char *new_name);
+extern int kobject_rename(struct kobject *, char *new_name);
 
 extern int kobject_register(struct kobject *);
 extern void kobject_unregister(struct kobject *);
diff -Nru a/include/linux/libata.h b/include/linux/libata.h
--- a/include/linux/libata.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/libata.h	Tue Jun 15 22:20:36 2004
@@ -27,6 +27,7 @@
 #include <linux/interrupt.h>
 #include <asm/io.h>
 #include <linux/ata.h>
+#include <linux/workqueue.h>
 
 /*
  * compile-time options
@@ -39,6 +40,7 @@
 #undef ATA_ENABLE_ATAPI		/* define to enable ATAPI support */
 #undef ATA_ENABLE_PATA		/* define to enable PATA support in some
 				 * low-level drivers */
+#undef ATAPI_ENABLE_DMADIR	/* enables ATAPI DMADIR bridge support */
 
 
 /* note: prints function name for you */
@@ -109,12 +111,7 @@
 
 	ATA_QCFLAG_ACTIVE	= (1 << 1), /* cmd not yet ack'd to scsi lyer */
 	ATA_QCFLAG_DMA		= (1 << 2), /* data delivered via DMA */
-	ATA_QCFLAG_ATAPI	= (1 << 3), /* is ATAPI packet command? */
 	ATA_QCFLAG_SG		= (1 << 4), /* have s/g table? */
-	ATA_QCFLAG_POLL		= (1 << 5), /* polling, no interrupts */
-
-	/* struct ata_engine atomic flags (use test_bit, etc.) */
-	ATA_EFLG_ACTIVE		= 0,	/* engine is active */
 
 	/* various lengths of time */
 	ATA_TMOUT_EDD		= 5 * HZ,	/* hueristic */
@@ -144,13 +141,6 @@
 	THR_IDLE		= (THR_PROBE_FAILED + 1),
 	THR_PROBE_SUCCESS	= (THR_IDLE + 1),
 	THR_PROBE_START		= (THR_PROBE_SUCCESS + 1),
-	THR_PIO_POLL		= (THR_PROBE_START + 1),
-	THR_PIO_TMOUT		= (THR_PIO_POLL + 1),
-	THR_PIO			= (THR_PIO_TMOUT + 1),
-	THR_PIO_LAST		= (THR_PIO + 1),
-	THR_PIO_LAST_POLL	= (THR_PIO_LAST + 1),
-	THR_PIO_ERR		= (THR_PIO_LAST_POLL + 1),
-	THR_PACKET		= (THR_PIO_ERR + 1),
 
 	/* SATA port states */
 	PORT_UNKNOWN		= 0,
@@ -163,6 +153,17 @@
 	ATA_QCFLAG_TIMEOUT	= (1 << 0),
 };
 
+enum pio_task_states {
+	PIO_ST_UNKNOWN,
+	PIO_ST_IDLE,
+	PIO_ST_POLL,
+	PIO_ST_TMOUT,
+	PIO_ST,
+	PIO_ST_LAST,
+	PIO_ST_LAST_POLL,
+	PIO_ST_ERR,
+};
+
 /* forward declarations */
 struct scsi_device;
 struct ata_port_operations;
@@ -224,7 +225,6 @@
 	struct scsi_cmnd	*scsicmd;
 	void			(*scsidone)(struct scsi_cmnd *);
 
-	struct list_head	node;
 	unsigned long		flags;		/* ATA_QCFLAG_xxx */
 	unsigned int		tag;
 	unsigned int		n_elem;
@@ -239,7 +239,7 @@
 
 	ata_qc_cb_t		callback;
 
-	struct semaphore	sem;
+	struct completion	*waiting;
 
 	void			*private_data;
 };
@@ -259,23 +259,12 @@
 	unsigned int		pio_mode;
 	unsigned int		udma_mode;
 
-	unsigned char		vendor[8];	/* space-padded, not ASCIIZ */
-	unsigned char		product[32];	/* WARNING: shorter than
-						 * ATAPI7 spec size, 40 ASCII
-						 * characters
-						 */
-
 	/* cache info about current transfer mode */
 	u8			xfer_protocol;	/* taskfile xfer protocol */
 	u8			read_cmd;	/* opcode to use on read */
 	u8			write_cmd;	/* opcode to use on write */
 };
 
-struct ata_engine {
-	unsigned long		flags;
-	struct list_head	q;
-};
-
 struct ata_port {
 	struct Scsi_Host	*host;	/* our co-allocated scsi host */
 	struct ata_port_operations	*ops;
@@ -296,8 +285,6 @@
 	unsigned int		udma_mask;
 	unsigned int		cbl;	/* cable type; ATA_CBL_xxx */
 
-	struct ata_engine	eng;
-
 	struct ata_device	device[ATA_MAX_DEVICES];
 
 	struct ata_queued_cmd	qcmd[ATA_MAX_QUEUE];
@@ -307,16 +294,17 @@
 	struct ata_host_stats	stats;
 	struct ata_host_set	*host_set;
 
-	struct semaphore	sem;
 	struct semaphore	probe_sem;
 
 	unsigned int		thr_state;
-	int			time_to_die;
-	pid_t			thr_pid;
-	struct completion	thr_exited;
-	struct semaphore	thr_sem;
-	struct timer_list	thr_timer;
-	unsigned long		thr_timeout;
+
+	struct work_struct	packet_task;
+
+	struct work_struct	pio_task;
+	unsigned int		pio_task_state;
+	unsigned long		pio_task_timeout;
+
+	struct work_struct	probe_task;
 
 	void			*private_data;
 };
@@ -340,6 +328,7 @@
 	void (*phy_reset) (struct ata_port *ap);
 	void (*post_set_mode) (struct ata_port *ap);
 
+	void (*bmdma_setup) (struct ata_queued_cmd *qc);
 	void (*bmdma_start) (struct ata_queued_cmd *qc);
 	void (*fill_sg) (struct ata_queued_cmd *qc);
 	void (*eng_timeout) (struct ata_port *ap);
@@ -392,6 +381,8 @@
 extern void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf);
 extern void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf);
 extern void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf);
+extern void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp);
+extern void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf);
 extern u8 ata_check_status_pio(struct ata_port *ap);
 extern u8 ata_check_status_mmio(struct ata_port *ap);
 extern void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf);
@@ -400,10 +391,14 @@
 extern void ata_port_stop (struct ata_port *ap);
 extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
 extern void ata_fill_sg(struct ata_queued_cmd *qc);
+extern void ata_dev_id_string(struct ata_device *dev, unsigned char *s,
+			      unsigned int ofs, unsigned int len);
+extern void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc);
 extern void ata_bmdma_start_mmio (struct ata_queued_cmd *qc);
+extern void ata_bmdma_setup_pio (struct ata_queued_cmd *qc);
 extern void ata_bmdma_start_pio (struct ata_queued_cmd *qc);
 extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits);
-extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat, unsigned int done_late);
+extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat);
 extern void ata_eng_timeout(struct ata_port *ap);
 extern int ata_std_bios_param(struct scsi_device *sdev,
 			      struct block_device *bdev,
@@ -411,11 +406,6 @@
 extern int ata_scsi_slave_config(struct scsi_device *sdev);
 
 
-static inline unsigned long msecs_to_jiffies(unsigned long msecs)
-{
-	return ((HZ * msecs + 999) / 1000);
-}
-
 static inline unsigned int ata_tag_valid(unsigned int tag)
 {
 	return (tag < ATA_MAX_QUEUE) ? 1 : 0;
@@ -479,6 +469,12 @@
 	}
 
 	return status;
+}
+
+static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
+{
+	qc->flags &= ~ATA_QCFLAG_DMA;
+	qc->tf.ctl |= ATA_NIEN;
 }
 
 static inline struct ata_queued_cmd *ata_qc_from_tag (struct ata_port *ap,
diff -Nru a/include/linux/mca.h b/include/linux/mca.h
--- a/include/linux/mca.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/mca.h	Tue Jun 15 22:20:38 2004
@@ -144,7 +144,7 @@
 {
 }
 
-static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn *fn, void* dev)
+static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev)
 {
 }
 #endif
diff -Nru a/include/linux/mempolicy.h b/include/linux/mempolicy.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/linux/mempolicy.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,221 @@
+#ifndef _LINUX_MEMPOLICY_H
+#define _LINUX_MEMPOLICY_H 1
+
+#include <linux/errno.h>
+
+/*
+ * NUMA memory policies for Linux.
+ * Copyright 2003,2004 Andi Kleen SuSE Labs
+ */
+
+/* Policies */
+#define MPOL_DEFAULT	0
+#define MPOL_PREFERRED	1
+#define MPOL_BIND	2
+#define MPOL_INTERLEAVE	3
+
+#define MPOL_MAX MPOL_INTERLEAVE
+
+/* Flags for get_mem_policy */
+#define MPOL_F_NODE	(1<<0)	/* return next IL mode instead of node mask */
+#define MPOL_F_ADDR	(1<<1)	/* look up vma using address */
+
+/* Flags for mbind */
+#define MPOL_MF_STRICT	(1<<0)	/* Verify existing pages in the mapping */
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#include <linux/mmzone.h>
+#include <linux/bitmap.h>
+#include <linux/slab.h>
+#include <linux/rbtree.h>
+#include <asm/semaphore.h>
+
+struct vm_area_struct;
+
+#ifdef CONFIG_NUMA
+
+/*
+ * Describe a memory policy.
+ *
+ * A mempolicy can be either associated with a process or with a VMA.
+ * For VMA related allocations the VMA policy is preferred, otherwise
+ * the process policy is used. Interrupts ignore the memory policy
+ * of the current process.
+ *
+ * Locking policy for interlave:
+ * In process context there is no locking because only the process accesses
+ * its own state. All vma manipulation is somewhat protected by a down_read on
+ * mmap_sem. For allocating in the interleave policy the page_table_lock
+ * must be also aquired to protect il_next.
+ *
+ * Freeing policy:
+ * When policy is MPOL_BIND v.zonelist is kmalloc'ed and must be kfree'd.
+ * All other policies don't have any external state. mpol_free() handles this.
+ *
+ * Copying policy objects:
+ * For MPOL_BIND the zonelist must be always duplicated. mpol_clone() does this.
+ */
+struct mempolicy {
+	atomic_t refcnt;
+	short policy; 	/* See MPOL_* above */
+	union {
+		struct zonelist  *zonelist;	/* bind */
+		short 		 preferred_node; /* preferred */
+		DECLARE_BITMAP(nodes, MAX_NUMNODES); /* interleave */
+		/* undefined for default */
+	} v;
+};
+
+/* An NULL mempolicy pointer is a synonym of &default_policy. */
+extern struct mempolicy default_policy;
+
+/*
+ * Support for managing mempolicy data objects (clone, copy, destroy)
+ * The default fast path of a NULL MPOL_DEFAULT policy is always inlined.
+ */
+
+extern void __mpol_free(struct mempolicy *pol);
+static inline void mpol_free(struct mempolicy *pol)
+{
+	if (pol)
+		__mpol_free(pol);
+}
+
+extern struct mempolicy *__mpol_copy(struct mempolicy *pol);
+static inline struct mempolicy *mpol_copy(struct mempolicy *pol)
+{
+	if (pol)
+		pol = __mpol_copy(pol);
+	return pol;
+}
+
+#define vma_policy(vma) ((vma)->vm_policy)
+#define vma_set_policy(vma, pol) ((vma)->vm_policy = (pol))
+
+static inline void mpol_get(struct mempolicy *pol)
+{
+	if (pol)
+		atomic_inc(&pol->refcnt);
+}
+
+extern int __mpol_equal(struct mempolicy *a, struct mempolicy *b);
+static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
+{
+	if (a == b)
+		return 1;
+	return __mpol_equal(a, b);
+}
+#define vma_mpol_equal(a,b) mpol_equal(vma_policy(a), vma_policy(b))
+
+/* Could later add inheritance of the process policy here. */
+
+#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL)
+
+/*
+ * Hugetlb policy. i386 hugetlb so far works with node numbers
+ * instead of zone lists, so give it special interfaces for now.
+ */
+extern int mpol_first_node(struct vm_area_struct *vma, unsigned long addr);
+extern int mpol_node_valid(int nid, struct vm_area_struct *vma,
+			unsigned long addr);
+
+/*
+ * Tree of shared policies for a shared memory region.
+ * Maintain the policies in a pseudo mm that contains vmas. The vmas
+ * carry the policy. As a special twist the pseudo mm is indexed in pages, not
+ * bytes, so that we can work with shared memory segments bigger than
+ * unsigned long.
+ */
+
+struct sp_node {
+	struct rb_node nd;
+	unsigned long start, end;
+	struct mempolicy *policy;
+};
+
+struct shared_policy {
+	struct rb_root root;
+	struct semaphore sem;
+};
+
+static inline void mpol_shared_policy_init(struct shared_policy *info)
+{
+	info->root = RB_ROOT;
+	init_MUTEX(&info->sem);
+}
+
+int mpol_set_shared_policy(struct shared_policy *info,
+				struct vm_area_struct *vma,
+				struct mempolicy *new);
+void mpol_free_shared_policy(struct shared_policy *p);
+struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
+					    unsigned long idx);
+
+#else
+
+struct mempolicy {};
+
+static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
+{
+	return 1;
+}
+#define vma_mpol_equal(a,b) 1
+
+#define mpol_set_vma_default(vma) do {} while(0)
+
+static inline void mpol_free(struct mempolicy *p)
+{
+}
+
+static inline void mpol_get(struct mempolicy *pol)
+{
+}
+
+static inline struct mempolicy *mpol_copy(struct mempolicy *old)
+{
+	return NULL;
+}
+
+static inline int mpol_first_node(struct vm_area_struct *vma, unsigned long a)
+{
+	return numa_node_id();
+}
+
+static inline int
+mpol_node_valid(int nid, struct vm_area_struct *vma, unsigned long a)
+{
+	return 1;
+}
+
+struct shared_policy {};
+
+static inline int mpol_set_shared_policy(struct shared_policy *info,
+					struct vm_area_struct *vma,
+					struct mempolicy *new)
+{
+	return -EINVAL;
+}
+
+static inline void mpol_shared_policy_init(struct shared_policy *info)
+{
+}
+
+static inline void mpol_free_shared_policy(struct shared_policy *p)
+{
+}
+
+static inline struct mempolicy *
+mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
+{
+	return NULL;
+}
+
+#define vma_policy(vma) NULL
+#define vma_set_policy(vma, pol) do {} while(0)
+
+#endif /* CONFIG_NUMA */
+#endif /* __KERNEL__ */
+
+#endif
diff -Nru a/include/linux/mii.h b/include/linux/mii.h
--- a/include/linux/mii.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/mii.h	Tue Jun 15 22:20:36 2004
@@ -9,6 +9,7 @@
 #define __LINUX_MII_H__
 
 #include <linux/types.h>
+#include <linux/if.h>
 
 /* Generic MII registers. */
 
@@ -142,6 +143,12 @@
 	u16		val_in;
 	u16		val_out;
 };
+
+
+static inline struct mii_ioctl_data *if_mii(struct ifreq *rq)
+{
+	return (struct mii_ioctl_data *) &rq->ifr_ifru;
+}
 
 
 /**
diff -Nru a/include/linux/mm.h b/include/linux/mm.h
--- a/include/linux/mm.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/mm.h	Tue Jun 15 22:20:36 2004
@@ -11,8 +11,12 @@
 #include <linux/list.h>
 #include <linux/mmzone.h>
 #include <linux/rbtree.h>
+#include <linux/prio_tree.h>
 #include <linux/fs.h>
 
+struct mempolicy;
+struct anon_vma;
+
 #ifndef CONFIG_DISCONTIGMEM          /* Don't use mapnrs, do it properly */
 extern unsigned long max_mapnr;
 #endif
@@ -44,9 +48,6 @@
  * per VM-area/task.  A VM area is any part of the process virtual memory
  * space that has a special rule for the page-fault handlers (ie a shared
  * library, the executable area etc).
- *
- * This structure is exactly 64 bytes on ia32.  Please think very, very hard
- * before adding anything to it.
  */
 struct vm_area_struct {
 	struct mm_struct * vm_mm;	/* The address space we belong to. */
@@ -64,10 +65,28 @@
 
 	/*
 	 * For areas with an address space and backing store,
-	 * one of the address_space->i_mmap{,shared} lists,
-	 * for shm areas, the list of attaches, otherwise unused.
+	 * linkage into the address_space->i_mmap prio tree, or
+	 * linkage to the list of like vmas hanging off its node, or
+	 * linkage of vma in the address_space->i_mmap_nonlinear list.
+	 */
+	union {
+		struct {
+			struct list_head list;
+			void *parent;	/* aligns with prio_tree_node parent */
+			struct vm_area_struct *head;
+		} vm_set;
+
+		struct prio_tree_node prio_tree_node;
+	} shared;
+
+	/*
+	 * A file's MAP_PRIVATE vma can be in both i_mmap tree and anon_vma
+	 * list, after a COW of one of the file pages.  A MAP_SHARED vma
+	 * can only be in the i_mmap tree.  An anonymous MAP_PRIVATE, stack
+	 * or brk vma (with NULL file) can only be in an anon_vma list.
 	 */
-	struct list_head shared;
+	struct list_head anon_vma_node;	/* Serialized by anon_vma->lock */
+	struct anon_vma *anon_vma;	/* Serialized by page_table_lock */
 
 	/* Function pointers to deal with this struct. */
 	struct vm_operations_struct * vm_ops;
@@ -77,6 +96,10 @@
 					   units, *not* PAGE_CACHE_SIZE */
 	struct file * vm_file;		/* File we map to (can be NULL). */
 	void * vm_private_data;		/* was vm_pte (shared mem) */
+
+#ifdef CONFIG_NUMA
+	struct mempolicy *vm_policy;	/* NUMA policy for the VMA */
+#endif
 };
 
 /*
@@ -112,9 +135,6 @@
 #define VM_HUGETLB	0x00400000	/* Huge TLB Page VM */
 #define VM_NONLINEAR	0x00800000	/* Is non-linear (remap_file_pages) */
 
-/* It makes sense to apply VM_ACCOUNT to this vma. */
-#define VM_MAYACCT(vma) (!!((vma)->vm_flags & VM_HUGETLB))
-
 #ifndef VM_STACK_DEFAULT_FLAGS		/* arch can override this */
 #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
 #endif
@@ -148,10 +168,13 @@
 	void (*close)(struct vm_area_struct * area);
 	struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int *type);
 	int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
+#ifdef CONFIG_NUMA
+	int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
+	struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
+					unsigned long addr);
+#endif
 };
 
-/* forward declaration; pte_chain is meant to be internal to rmap.c */
-struct pte_chain;
 struct mmu_gather;
 struct inode;
 
@@ -166,34 +189,31 @@
  * it to keep track of whatever it is we are using the page for at the
  * moment. Note that we have no way to track which tasks are using
  * a page.
- *
- * Try to keep the most commonly accessed fields in single cache lines
- * here (16 bytes or greater).  This ordering should be particularly
- * beneficial on 32-bit processors.
- *
- * The first line is data used in page cache lookup, the second line
- * is used for linear searches (eg. clock algorithm scans). 
- *
- * TODO: make this structure smaller, it could be as small as 32 bytes.
  */
 struct page {
-	page_flags_t flags;		/* atomic flags, some possibly
-					   updated asynchronously */
-	atomic_t count;			/* Usage count, see below. */
-	struct address_space *mapping;	/* The inode (or ...) we belong to. */
-	pgoff_t index;			/* Our offset within mapping. */
-	struct list_head lru;		/* Pageout list, eg. active_list;
-					   protected by zone->lru_lock !! */
-	union {
-		struct pte_chain *chain;/* Reverse pte mapping pointer.
-					 * protected by PG_chainlock */
-		pte_addr_t direct;
-	} pte;
+	page_flags_t flags;		/* Atomic flags, some possibly
+					 * updated asynchronously */
+	atomic_t _count;		/* Usage count, see below. */
+	unsigned int mapcount;		/* Count of ptes mapped in mms,
+					 * to show when page is mapped
+					 * & limit reverse map searches,
+					 * protected by PG_maplock.
+					 */
 	unsigned long private;		/* Mapping-private opaque data:
 					 * usually used for buffer_heads
 					 * if PagePrivate set; used for
 					 * swp_entry_t if PageSwapCache
 					 */
+	struct address_space *mapping;	/* If PG_anon clear, points to
+					 * inode address_space, or NULL.
+					 * If page mapped as anonymous
+					 * memory, PG_anon is set, and
+					 * it points to anon_vma object.
+					 */
+	pgoff_t index;			/* Our offset within mapping. */
+	struct list_head lru;		/* Pageout list, eg. active_list
+					 * protected by zone->lru_lock !
+					 */
 	/*
 	 * On machines where all RAM is mapped into kernel address space,
 	 * we can simply calculate the virtual address. On machines with
@@ -227,15 +247,35 @@
  *
  * Also, many kernel routines increase the page count before a critical
  * routine so they can be sure the page doesn't go away from under them.
+ *
+ * Since 2.6.6 (approx), a free page has ->_count = -1.  This is so that we
+ * can use atomic_add_negative(-1, page->_count) to detect when the page
+ * becomes free and so that we can also use atomic_inc_and_test to atomically
+ * detect when we just tried to grab a ref on a page which some other CPU has
+ * already deemed to be freeable.
+ *
+ * NO code should make assumptions about this internal detail!  Use the provided
+ * macros which retain the old rules: page_count(page) == 0 is a free page.
+ */
+
+/*
+ * Drop a ref, return true if the logical refcount fell to zero (the page has
+ * no users)
  */
 #define put_page_testzero(p)				\
 	({						\
 		BUG_ON(page_count(p) == 0);		\
-		atomic_dec_and_test(&(p)->count);	\
+		atomic_add_negative(-1, &(p)->_count);	\
 	})
 
-#define set_page_count(p,v) 	atomic_set(&(p)->count, v)
-#define __put_page(p)		atomic_dec(&(p)->count)
+/*
+ * Grab a ref, return true if the page previously had a logical refcount of
+ * zero.  ie: returns true if we just grabbed an already-deemed-to-be-free page
+ */
+#define get_page_testone(p)	atomic_inc_and_test(&(p)->_count)
+
+#define set_page_count(p,v) 	atomic_set(&(p)->_count, v - 1)
+#define __put_page(p)		atomic_dec(&(p)->_count)
 
 extern void FASTCALL(__page_cache_release(struct page *));
 
@@ -245,25 +285,25 @@
 {
 	if (PageCompound(p))
 		p = (struct page *)p->private;
-	return atomic_read(&(p)->count);
+	return atomic_read(&(p)->_count) + 1;
 }
 
 static inline void get_page(struct page *page)
 {
 	if (unlikely(PageCompound(page)))
 		page = (struct page *)page->private;
-	atomic_inc(&page->count);
+	atomic_inc(&page->_count);
 }
 
 void put_page(struct page *page);
 
 #else		/* CONFIG_HUGETLB_PAGE */
 
-#define page_count(p)		atomic_read(&(p)->count)
+#define page_count(p)		(atomic_read(&(p)->_count) + 1)
 
 static inline void get_page(struct page *page)
 {
-	atomic_inc(&page->count);
+	atomic_inc(&page->_count);
 }
 
 static inline void put_page(struct page *page)
@@ -280,13 +320,13 @@
  * zeroes, and text pages of executables and shared libraries have
  * only one copy in memory, at most, normally.
  *
- * For the non-reserved pages, page->count denotes a reference count.
- *   page->count == 0 means the page is free.
- *   page->count == 1 means the page is used for exactly one purpose
+ * For the non-reserved pages, page_count(page) denotes a reference count.
+ *   page_count() == 0 means the page is free.
+ *   page_count() == 1 means the page is used for exactly one purpose
  *   (e.g. a private data page of one process).
  *
  * A page may be used for kmalloc() or anyone else who does a
- * __get_free_page(). In this case the page->count is at least 1, and
+ * __get_free_page(). In this case the page_count() is at least 1, and
  * all other fields are unused but should be 0 or NULL. The
  * management of this page is the responsibility of the one who uses
  * it.
@@ -303,14 +343,14 @@
  * page's address_space.  Usually, this is the address of a circular
  * list of the page's disk buffers.
  *
- * For pages belonging to inodes, the page->count is the number of
+ * For pages belonging to inodes, the page_count() is the number of
  * attaches, plus 1 if `private' contains something, plus one for
  * the page cache itself.
  *
  * All pages belonging to an inode are in these doubly linked lists:
  * mapping->clean_pages, mapping->dirty_pages and mapping->locked_pages;
  * using the page->list list_head. These fields are also used for
- * freelist managemet (when page->count==0).
+ * freelist managemet (when page_count()==0).
  *
  * There is also a per-mapping radix tree mapping index to the page
  * in memory if present. The tree is rooted at mapping->root.  
@@ -398,19 +438,35 @@
  * address_space which maps the page from disk; whereas "page_mapped"
  * refers to user virtual address space into which the page is mapped.
  */
+extern struct address_space swapper_space;
 static inline struct address_space *page_mapping(struct page *page)
 {
-	return PageAnon(page)? NULL: page->mapping;
+	struct address_space *mapping = NULL;
+
+	if (unlikely(PageSwapCache(page)))
+		mapping = &swapper_space;
+	else if (likely(!PageAnon(page)))
+		mapping = page->mapping;
+	return mapping;
+}
+
+/*
+ * Return the pagecache index of the passed page.  Regular pagecache pages
+ * use ->index whereas swapcache pages use ->private
+ */
+static inline pgoff_t page_index(struct page *page)
+{
+	if (unlikely(PageSwapCache(page)))
+		return page->private;
+	return page->index;
 }
 
 /*
- * Return true if this page is mapped into pagetables.  Subtle: test pte.direct
- * rather than pte.chain.  Because sometimes pte.direct is 64-bit, and .chain
- * is only 32-bit.
+ * Return true if this page is mapped into pagetables.
  */
 static inline int page_mapped(struct page *page)
 {
-	return page->pte.direct != 0;
+	return page->mapcount != 0;
 }
 
 /*
@@ -435,6 +491,9 @@
 
 struct page *shmem_nopage(struct vm_area_struct * vma,
 			unsigned long address, int *type);
+int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new);
+struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
+					unsigned long addr);
 struct file *shmem_file_setup(char * name, loff_t size, unsigned long flags);
 void shmem_lock(struct file * file, int lock);
 int shmem_zero_setup(struct vm_area_struct *);
@@ -447,6 +506,7 @@
 	struct address_space *check_mapping;	/* Check page->mapping if set */
 	pgoff_t	first_index;			/* Lowest page->index to unmap */
 	pgoff_t last_index;			/* Highest page->index to unmap */
+	int atomic;				/* May not schedule() */
 };
 
 void zap_page_range(struct vm_area_struct *vma, unsigned long address,
@@ -478,8 +538,7 @@
 extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
 extern int make_pages_present(unsigned long addr, unsigned long end);
 extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
-void put_dirty_page(struct task_struct *tsk, struct page *page,
-			unsigned long address, pgprot_t prot);
+void install_arg_page(struct vm_area_struct *, struct page *, unsigned long);
 
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
 		int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
@@ -538,12 +597,37 @@
 extern void si_meminfo(struct sysinfo * val);
 extern void si_meminfo_node(struct sysinfo *val, int nid);
 
+static inline void vma_prio_tree_init(struct vm_area_struct *vma)
+{
+	vma->shared.vm_set.list.next = NULL;
+	vma->shared.vm_set.list.prev = NULL;
+	vma->shared.vm_set.parent = NULL;
+	vma->shared.vm_set.head = NULL;
+}
+
+/* prio_tree.c */
+void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
+void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *);
+void vma_prio_tree_remove(struct vm_area_struct *, struct prio_tree_root *);
+struct vm_area_struct *vma_prio_tree_next(
+	struct vm_area_struct *, struct prio_tree_root *,
+	struct prio_tree_iter *, pgoff_t begin, pgoff_t end);
+
 /* mmap.c */
+extern void vma_adjust(struct vm_area_struct *vma, unsigned long start,
+	unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert);
+extern struct vm_area_struct *vma_merge(struct mm_struct *,
+	struct vm_area_struct *prev, unsigned long addr, unsigned long end,
+	unsigned long vm_flags, struct anon_vma *, struct file *, pgoff_t,
+	struct mempolicy *);
+extern struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *);
+extern int split_vma(struct mm_struct *,
+	struct vm_area_struct *, unsigned long addr, int new_below);
 extern void insert_vm_struct(struct mm_struct *, struct vm_area_struct *);
 extern void __vma_link_rb(struct mm_struct *, struct vm_area_struct *,
 	struct rb_node **, struct rb_node *);
 extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
-	unsigned long addr, unsigned long len, unsigned long pgoff);
+	unsigned long addr, unsigned long len, pgoff_t pgoff);
 extern void exit_mmap(struct mm_struct *);
 
 extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
@@ -569,26 +653,6 @@
 
 extern unsigned long do_brk(unsigned long, unsigned long);
 
-static inline void
-__vma_unlink(struct mm_struct *mm, struct vm_area_struct *vma,
-		struct vm_area_struct *prev)
-{
-	prev->vm_next = vma->vm_next;
-	rb_erase(&vma->vm_rb, &mm->mm_rb);
-	if (mm->mmap_cache == vma)
-		mm->mmap_cache = prev;
-}
-
-static inline int
-can_vma_merge(struct vm_area_struct *vma, unsigned long vm_flags)
-{
-#ifdef CONFIG_MMU
-	if (!vma->vm_file && vma->vm_flags == vm_flags)
-		return 1;
-#endif
-	return 0;
-}
-
 /* filemap.c */
 extern unsigned long page_unuse(struct page *);
 extern void truncate_inode_pages(struct address_space *, loff_t);
@@ -622,8 +686,6 @@
 extern struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr);
 extern struct vm_area_struct * find_vma_prev(struct mm_struct * mm, unsigned long addr,
 					     struct vm_area_struct **pprev);
-extern int split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
-		     unsigned long addr, int new_below);
 
 /* Look up the first VMA which intersects the interval start_addr..end_addr-1,
    NULL if none.  Assume start_addr < end_addr. */
@@ -634,6 +696,11 @@
 	if (vma && end_addr <= vma->vm_start)
 		vma = NULL;
 	return vma;
+}
+
+static inline unsigned long vma_pages(struct vm_area_struct *vma)
+{
+	return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
 }
 
 extern struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr);
diff -Nru a/include/linux/mmzone.h b/include/linux/mmzone.h
--- a/include/linux/mmzone.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/mmzone.h	Tue Jun 15 22:20:41 2004
@@ -52,6 +52,14 @@
 
 struct per_cpu_pageset {
 	struct per_cpu_pages pcp[2];	/* 0: hot.  1: cold */
+#ifdef CONFIG_NUMA
+	unsigned long numa_hit;		/* allocated in intended node */
+	unsigned long numa_miss;	/* allocated in non intended node */
+	unsigned long numa_foreign;	/* was intended here, hit elsewhere */
+	unsigned long interleave_hit; 	/* interleaver prefered this zone */
+	unsigned long local_node;	/* allocation from local node */
+	unsigned long other_node;	/* allocation from other node */
+#endif
 } ____cacheline_aligned_in_smp;
 
 #define ZONE_DMA		0
diff -Nru a/include/linux/module.h b/include/linux/module.h
--- a/include/linux/module.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/module.h	Tue Jun 15 22:20:43 2004
@@ -16,13 +16,14 @@
 #include <linux/kmod.h>
 #include <linux/elf.h>
 #include <linux/stringify.h>
+#include <linux/kobject.h>
+#include <linux/moduleparam.h>
 #include <asm/local.h>
 
 #include <asm/module.h>
 
 /* Not Yet Implemented */
 #define MODULE_SUPPORTED_DEVICE(name)
-#define print_modules()
 
 /* v850 toolchain uses a `_' prefix for all user symbols */
 #ifndef MODULE_SYMBOL_PREFIX
@@ -207,6 +208,23 @@
 	MODULE_STATE_GOING,
 };
 
+/* sysfs stuff */
+struct module_attribute
+{
+	struct attribute attr;
+	struct kernel_param *param;
+};
+
+struct module_kobject
+{
+	/* Everyone should have one of these. */
+	struct kobject kobj;
+
+	/* We always have refcnt, we may have others from module_param(). */
+	unsigned int num_attributes;
+	struct module_attribute attr[0];
+};
+
 struct module
 {
 	enum module_state state;
@@ -217,6 +235,9 @@
 	/* Unique handle for this module */
 	char name[MODULE_NAME_LEN];
 
+	/* Sysfs stuff. */
+	struct module_kobject *mkobj;
+
 	/* Exported symbols */
 	const struct kernel_symbol *syms;
 	unsigned int num_syms;
@@ -267,6 +288,9 @@
 
 	/* Destruction function. */
 	void (*exit)(void);
+
+	/* Fake kernel param for refcnt. */
+	struct kernel_param refcnt_param;
 #endif
 
 #ifdef CONFIG_KALLSYMS
@@ -400,6 +424,7 @@
 int register_module_notifier(struct notifier_block * nb);
 int unregister_module_notifier(struct notifier_block * nb);
 
+extern void print_modules(void);
 #else /* !CONFIG_MODULES... */
 #define EXPORT_SYMBOL(sym)
 #define EXPORT_SYMBOL_GPL(sym)
@@ -480,6 +505,9 @@
 
 #define module_put_and_exit(code) do_exit(code)
 
+static inline void print_modules(void)
+{
+}
 #endif /* CONFIG_MODULES */
 
 #define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
diff -Nru a/include/linux/moduleparam.h b/include/linux/moduleparam.h
--- a/include/linux/moduleparam.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/moduleparam.h	Tue Jun 15 22:20:40 2004
@@ -50,7 +50,7 @@
    not there, read bits mean it's readable, write bits mean it's
    writable. */
 #define __module_param_call(prefix, name, set, get, arg, perm)		\
-	static char __param_str_##name[] __initdata = prefix #name;	\
+	static char __param_str_##name[] = prefix #name;		\
 	static struct kernel_param const __param_##name			\
 	__attribute_used__						\
     __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
@@ -71,7 +71,7 @@
 
 /* Actually copy string: maxlen param is usually sizeof(string). */
 #define module_param_string(name, string, len, perm)			\
-	static struct kparam_string __param_string_##name __initdata	\
+	static struct kparam_string __param_string_##name		\
 		= { len, string };					\
 	module_param_call(name, param_set_copystring, param_get_charp,	\
 		   &__param_string_##name, perm)
@@ -147,4 +147,4 @@
 		void *elem, int elemsize,
 		int (*set)(const char *, struct kernel_param *kp),
 		int *num);
-#endif /* _LINUX_MODULE_PARAM_TYPES_H */
+#endif /* _LINUX_MODULE_PARAMS_H */
diff -Nru a/include/linux/mroute.h b/include/linux/mroute.h
--- a/include/linux/mroute.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/mroute.h	Tue Jun 15 22:20:40 2004
@@ -128,9 +128,9 @@
 #ifdef __KERNEL__
 #include <net/sock.h>
 
-extern int ip_mroute_setsockopt(struct sock *, int, char *, int);
-extern int ip_mroute_getsockopt(struct sock *, int, char *, int *);
-extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg);
+extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int);
+extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
+extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
 extern void ip_mr_init(void);
 
 
diff -Nru a/include/linux/net.h b/include/linux/net.h
--- a/include/linux/net.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/net.h	Tue Jun 15 22:20:39 2004
@@ -217,9 +217,9 @@
 SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
 SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
 SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
-			 char *optval, int optlen), (sock, level, optname, optval, optlen)) \
+			 char __user *optval, int optlen), (sock, level, optname, optval, optlen)) \
 SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \
-			 char *optval, int *optlen), (sock, level, optname, optval, optlen)) \
+			 char __user *optval, int __user *optlen), (sock, level, optname, optval, optlen)) \
 SOCKCALL_WRAP(name, sendmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len), \
 	      (iocb, sock, m, len)) \
 SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t len, int flags), \
diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
--- a/include/linux/netdevice.h	Tue Jun 15 22:21:03 2004
+++ b/include/linux/netdevice.h	Tue Jun 15 22:21:03 2004
@@ -215,6 +215,8 @@
  */
 #define LL_RESERVED_SPACE(dev) \
 	(((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
+#define LL_RESERVED_SPACE_EXTRA(dev,extra) \
+	((((dev)->hard_header_len+extra)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
 
 /* These flag bits are private to the generic network queueing
  * layer, they may not be explicitly referenced by any other
@@ -556,7 +558,7 @@
 extern int		netpoll_trap(void);
 #endif
 
-typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len);
+typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
 extern int		register_gifconf(unsigned int family, gifconf_func_t * gifconf);
 static inline int unregister_gifconf(unsigned int family)
 {
@@ -674,7 +676,7 @@
 extern int		netif_rx(struct sk_buff *skb);
 #define HAVE_NETIF_RECEIVE_SKB 1
 extern int		netif_receive_skb(struct sk_buff *skb);
-extern int		dev_ioctl(unsigned int cmd, void *);
+extern int		dev_ioctl(unsigned int cmd, void __user *);
 extern int		dev_ethtool(struct ifreq *);
 extern unsigned		dev_get_flags(const struct net_device *);
 extern int		dev_change_flags(struct net_device *, unsigned);
@@ -941,7 +943,7 @@
 extern unsigned long	netdev_fc_xoff;
 extern atomic_t netdev_dropping;
 extern int		netdev_set_master(struct net_device *dev, struct net_device *master);
-extern struct sk_buff * skb_checksum_help(struct sk_buff *skb);
+extern int skb_checksum_help(struct sk_buff **pskb, int inward);
 #ifdef CONFIG_NET_FASTROUTE
 extern int		netdev_fastroute;
 extern int		netdev_fastroute_obstacles;
diff -Nru a/include/linux/netfilter.h b/include/linux/netfilter.h
--- a/include/linux/netfilter.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/netfilter.h	Tue Jun 15 22:20:40 2004
@@ -64,11 +64,11 @@
 	/* Non-inclusive ranges: use 0/0/NULL to never get called. */
 	int set_optmin;
 	int set_optmax;
-	int (*set)(struct sock *sk, int optval, void *user, unsigned int len);
+	int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len);
 
 	int get_optmin;
 	int get_optmax;
-	int (*get)(struct sock *sk, int optval, void *user, int *len);
+	int (*get)(struct sock *sk, int optval, void __user *user, int *len);
 
 	/* Number of users inside set() or get(). */
 	unsigned int use;
@@ -156,9 +156,9 @@
 		 int (*okfn)(struct sk_buff *), int thresh);
 
 /* Call setsockopt() */
-int nf_setsockopt(struct sock *sk, int pf, int optval, char *opt, 
+int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, 
 		  int len);
-int nf_getsockopt(struct sock *sk, int pf, int optval, char *opt,
+int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt,
 		  int *len);
 
 /* Packet queuing */
@@ -171,6 +171,12 @@
 			struct nf_info *info,
 			unsigned int verdict);
 
+extern inline struct ipt_target *
+ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex);
+extern inline struct ip6t_target *
+ip6t_find_target_lock(const char *name, int *error, struct semaphore *mutex);
+extern inline struct arpt_target *
+arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex);
 extern void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *);
 
 #ifdef CONFIG_NETFILTER_DEBUG
diff -Nru a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
--- a/include/linux/netfilter_arp/arp_tables.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/netfilter_arp/arp_tables.h	Tue Jun 15 22:20:38 2004
@@ -205,7 +205,7 @@
 	/* Number of counters (must be equal to current number of entries). */
 	unsigned int num_counters;
 	/* The old entries' counters. */
-	struct arpt_counters *counters;
+	struct arpt_counters __user *counters;
 
 	/* The entries (hang off end: not really an array). */
 	struct arpt_entry entries[0];
diff -Nru a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
--- a/include/linux/netfilter_ipv4/ip_tables.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/netfilter_ipv4/ip_tables.h	Tue Jun 15 22:20:41 2004
@@ -252,7 +252,7 @@
 	/* Number of counters (must be equal to current number of entries). */
 	unsigned int num_counters;
 	/* The old entries' counters. */
-	struct ipt_counters *counters;
+	struct ipt_counters __user *counters;
 
 	/* The entries (hang off end: not really an array). */
 	struct ipt_entry entries[0];
@@ -283,6 +283,8 @@
 	struct ipt_entry entrytable[0];
 };
 
+extern struct semaphore ipt_mutex;
+
 /* Standard return verdict, or do jump. */
 #define IPT_STANDARD_TARGET ""
 /* Error verdict. */
@@ -334,6 +336,7 @@
 /*
  *	Main firewall chains definitions and global var's definitions.
  */
+static DECLARE_MUTEX(ipt_mutex);
 #ifdef __KERNEL__
 
 #include <linux/init.h>
@@ -405,6 +408,11 @@
 	/* Set this to THIS_MODULE. */
 	struct module *me;
 };
+
+extern struct ipt_target *
+ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex);
+extern struct arpt_target *
+arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex);
 
 extern int ipt_register_target(struct ipt_target *target);
 extern void ipt_unregister_target(struct ipt_target *target);
diff -Nru a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
--- a/include/linux/netfilter_ipv6/ip6_tables.h	Tue Jun 15 22:21:03 2004
+++ b/include/linux/netfilter_ipv6/ip6_tables.h	Tue Jun 15 22:21:03 2004
@@ -106,6 +106,8 @@
 	u_int64_t pcnt, bcnt;			/* Packet and byte counters */
 };
 
+static DECLARE_MUTEX(ip6t_mutex);
+
 /* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
 #define IP6T_F_PROTO		0x01	/* Set if rule cares about upper 
 					   protocols */
@@ -258,7 +260,7 @@
 	/* Number of counters (must be equal to current number of entries). */
 	unsigned int num_counters;
 	/* The old entries' counters. */
-	struct ip6t_counters *counters;
+	struct ip6t_counters __user *counters;
 
 	/* The entries (hang off end: not really an array). */
 	struct ip6t_entry entries[0];
diff -Nru a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
--- a/include/linux/nfs_fs.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/nfs_fs.h	Tue Jun 15 22:20:39 2004
@@ -306,6 +306,10 @@
  */
 extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t,
 			unsigned long);
+extern ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf,
+			size_t count, loff_t pos);
+extern ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf,
+			size_t count, loff_t pos);
 
 /*
  * linux/fs/nfs/dir.c
diff -Nru a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
--- a/include/linux/nfsd/export.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/nfsd/export.h	Tue Jun 15 22:20:41 2004
@@ -110,6 +110,10 @@
 	svc_export_put(&exp->h, &svc_export_cache);
 }
 
+static inline void exp_get(struct svc_export *exp)
+{
+	cache_get(&exp->h);
+}
 static inline struct svc_export *
 exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv,
 	 struct cache_req *reqp)
@@ -118,10 +122,9 @@
 	if (ek && !IS_ERR(ek)) {
 		struct svc_export *exp = ek->ek_export;
 		int err;
-		cache_get(&exp->h);
+		exp_get(exp);
 		expkey_put(&ek->h, &svc_expkey_cache);
-		if (exp &&
-		    (err = cache_check(&svc_export_cache, &exp->h, reqp)))
+		if ((err = cache_check(&svc_export_cache, &exp->h, reqp)))
 			exp = ERR_PTR(err);
 		return exp;
 	} else
diff -Nru a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
--- a/include/linux/nfsd/nfsd.h	Tue Jun 15 22:21:04 2004
+++ b/include/linux/nfsd/nfsd.h	Tue Jun 15 22:21:04 2004
@@ -199,6 +199,7 @@
 #define	nfserr_grace		__constant_htonl(NFSERR_GRACE)
 #define	nfserr_no_grace		__constant_htonl(NFSERR_NO_GRACE)
 #define	nfserr_reclaim_bad	__constant_htonl(NFSERR_RECLAIM_BAD)
+#define	nfserr_badname		__constant_htonl(NFSERR_BADNAME)
 
 /* error codes for internal use */
 /* if a request fails due to kmalloc failure, it gets dropped.
@@ -280,7 +281,7 @@
  | FATTR4_WORD1_OWNER	        | FATTR4_WORD1_OWNER_GROUP  | FATTR4_WORD1_RAWDEV           \
  | FATTR4_WORD1_SPACE_AVAIL     | FATTR4_WORD1_SPACE_FREE   | FATTR4_WORD1_SPACE_TOTAL      \
  | FATTR4_WORD1_SPACE_USED      | FATTR4_WORD1_TIME_ACCESS  | FATTR4_WORD1_TIME_ACCESS_SET  \
- | FATTR4_WORD1_TIME_CREATE     | FATTR4_WORD1_TIME_DELTA   | FATTR4_WORD1_TIME_METADATA    \
+ | FATTR4_WORD1_TIME_DELTA   | FATTR4_WORD1_TIME_METADATA    \
  | FATTR4_WORD1_TIME_MODIFY     | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID)
 
 /* These will return ERR_INVAL if specified in GETATTR or READDIR. */
diff -Nru a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
--- a/include/linux/nfsd/xdr3.h	Tue Jun 15 22:20:38 2004
+++ b/include/linux/nfsd/xdr3.h	Tue Jun 15 22:20:38 2004
@@ -170,6 +170,7 @@
 	u32 *			buffer;
 	int			buflen;
 	u32 *			offset;
+	u32 *			offset1;
 	struct svc_rqst *	rqstp;
 
 };
diff -Nru a/include/linux/oprofile.h b/include/linux/oprofile.h
--- a/include/linux/oprofile.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/oprofile.h	Tue Jun 15 22:20:41 2004
@@ -86,19 +86,19 @@
  * Write the given asciz string to the given user buffer @buf, updating *offset
  * appropriately. Returns bytes written or -EFAULT.
  */
-ssize_t oprofilefs_str_to_user(char const * str, char * buf, size_t count, loff_t * offset);
+ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count, loff_t * offset);
 
 /**
  * Convert an unsigned long value into ASCII and copy it to the user buffer @buf,
  * updating *offset appropriately. Returns bytes written or -EFAULT.
  */
-ssize_t oprofilefs_ulong_to_user(unsigned long val, char * buf, size_t count, loff_t * offset);
+ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t count, loff_t * offset);
 
 /**
  * Read an ASCII string for a number from a userspace buffer and fill *val on success.
  * Returns 0 on success, < 0 on error.
  */
-int oprofilefs_ulong_from_user(unsigned long * val, char const * buf, size_t count);
+int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count);
 
 /** lock for read/write safety */
 extern spinlock_t oprofilefs_lock;
diff -Nru a/include/linux/page-flags.h b/include/linux/page-flags.h
--- a/include/linux/page-flags.h	Tue Jun 15 22:20:42 2004
+++ b/include/linux/page-flags.h	Tue Jun 15 22:20:42 2004
@@ -71,12 +71,12 @@
 #define PG_nosave		14	/* Used for system suspend/resume */
 #define PG_maplock		15	/* Lock bit for rmap to ptes */
 
-#define PG_direct		16	/* ->pte_chain points directly at pte */
+#define PG_swapcache		16	/* Swap page: swp_entry_t in private */
 #define PG_mappedtodisk		17	/* Has blocks allocated on-disk */
 #define PG_reclaim		18	/* To be reclaimed asap */
 #define PG_compound		19	/* Part of a compound page */
-#define PG_anon			20	/* Anonymous page: anon_vma in mapping*/
-#define PG_swapcache		21	/* Swap page: swp_entry_t in private */
+
+#define PG_anon			20	/* Anonymous: anon_vma in mapping */
 
 
 /*
@@ -133,12 +133,16 @@
 	unsigned long allocstall;	/* direct reclaim calls */
 
 	unsigned long pgrotated;	/* pages rotated to tail of the LRU */
-} ____cacheline_aligned;
+};
 
 DECLARE_PER_CPU(struct page_state, page_states);
 
 extern void get_page_state(struct page_state *ret);
 extern void get_full_page_state(struct page_state *ret);
+extern unsigned long __read_page_state(unsigned offset);
+
+#define read_page_state(member) \
+	__read_page_state(offsetof(struct page_state, member))
 
 #define mod_page_state(member, delta)					\
 	do {								\
@@ -280,12 +284,6 @@
 #define TestSetPageNosave(page)	test_and_set_bit(PG_nosave, &(page)->flags)
 #define ClearPageNosave(page)		clear_bit(PG_nosave, &(page)->flags)
 #define TestClearPageNosave(page)	test_and_clear_bit(PG_nosave, &(page)->flags)
-
-#define PageDirect(page)	test_bit(PG_direct, &(page)->flags)
-#define SetPageDirect(page)	set_bit(PG_direct, &(page)->flags)
-#define TestSetPageDirect(page)	test_and_set_bit(PG_direct, &(page)->flags)
-#define ClearPageDirect(page)		clear_bit(PG_direct, &(page)->flags)
-#define TestClearPageDirect(page)	test_and_clear_bit(PG_direct, &(page)->flags)
 
 #define PageMappedToDisk(page)	test_bit(PG_mappedtodisk, &(page)->flags)
 #define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
diff -Nru a/include/linux/pagemap.h b/include/linux/pagemap.h
--- a/include/linux/pagemap.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/pagemap.h	Tue Jun 15 22:20:36 2004
@@ -220,13 +220,13 @@
 	volatile char c;
 	int ret;
 
-	ret = __get_user(c, (char *)uaddr);
+	ret = __get_user(c, uaddr);
 	if (ret == 0) {
 		const char __user *end = uaddr + size - 1;
 
 		if (((unsigned long)uaddr & PAGE_MASK) !=
 				((unsigned long)end & PAGE_MASK))
-		 	__get_user(c, (char *)end);
+		 	__get_user(c, end);
 	}
 }
 
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/pci.h	Tue Jun 15 22:20:40 2004
@@ -488,6 +488,11 @@
 	/* These fields are used by common fixups */
 	unsigned int	transparent:1;	/* Transparent PCI bridge */
 	unsigned int	multifunction:1;/* Part of multi-function device */
+	/* keep track of device state */
+	unsigned int	is_enabled:1;	/* pci_enable_device has been called */
+	unsigned int	is_busmaster:1; /* device is busmaster */
+	
+	unsigned int 	saved_config_space[16]; /* config space saved at suspend time */
 #ifdef CONFIG_PCI_NAMES
 #define PCI_NAME_SIZE	96
 #define PCI_NAME_HALF	__stringify(43)	/* less than half to handle slop */
diff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
--- a/include/linux/pci_ids.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/pci_ids.h	Tue Jun 15 22:20:39 2004
@@ -373,6 +373,7 @@
 #define PCI_DEVICE_ID_NS_SCx200_AUDIO	0x0503
 #define PCI_DEVICE_ID_NS_SCx200_VIDEO	0x0504
 #define PCI_DEVICE_ID_NS_SCx200_XBUS	0x0505
+#define PCI_DEVICE_ID_NS_SC1100_BRIDGE	0x0510
 #define PCI_DEVICE_ID_NS_87410		0xd001
 
 #define PCI_VENDOR_ID_TSENG		0x100c
@@ -435,7 +436,9 @@
 #define PCI_DEVICE_ID_IBM_CPC710_PCI64	0x00fc
 #define PCI_DEVICE_ID_IBM_CPC710_PCI32	0x0105
 #define	PCI_DEVICE_ID_IBM_405GP		0x0156
+#define PCI_DEVICE_ID_IBM_SNIPE		0x0180
 #define PCI_DEVICE_ID_IBM_SERVERAIDI960	0x01bd
+#define PCI_DEVICE_ID_IBM_GEMSTONE		0xB166
 #define PCI_DEVICE_ID_IBM_MPIC_2	0xffff
 
 #define PCI_VENDOR_ID_COMPEX2		0x101a // pci.ids says "AT&T GIS (NCR)"
@@ -479,6 +482,7 @@
 #	define PCI_DEVICE_ID_AMD_VIPER_7441	PCI_DEVICE_ID_AMD_OPUS_7441
 #define PCI_DEVICE_ID_AMD_OPUS_7443	0x7443
 #	define PCI_DEVICE_ID_AMD_VIPER_7443	PCI_DEVICE_ID_AMD_OPUS_7443
+#define PCI_DEVICE_ID_AMD_OPUS_7445	0x7445
 #define PCI_DEVICE_ID_AMD_OPUS_7448	0x7448
 # define	PCI_DEVICE_ID_AMD_VIPER_7448	PCI_DEVICE_ID_AMD_OPUS_7448
 #define PCI_DEVICE_ID_AMD_OPUS_7449	0x7449
@@ -572,7 +576,6 @@
 #define PCI_DEVICE_ID_SI_503		0x0008
 #define PCI_DEVICE_ID_SI_ACPI		0x0009
 #define PCI_DEVICE_ID_SI_LPC		0x0018
-#define PCI_DEVICE_ID_SI_180		0x0180
 #define PCI_DEVICE_ID_SI_5597_VGA	0x0200
 #define PCI_DEVICE_ID_SI_6205		0x0205
 #define PCI_DEVICE_ID_SI_501		0x0406
@@ -636,6 +639,7 @@
 #define PCI_DEVICE_ID_SI_6306		0x6306
 #define PCI_DEVICE_ID_SI_6326		0x6326
 #define PCI_DEVICE_ID_SI_7001		0x7001
+#define PCI_DEVICE_ID_SI_7012		0x7012
 #define PCI_DEVICE_ID_SI_7016		0x7016
 
 #define PCI_VENDOR_ID_HP		0x103c
@@ -726,6 +730,7 @@
 #define PCI_DEVICE_ID_TI_1410		0xac50
 #define PCI_DEVICE_ID_TI_1420		0xac51
 #define PCI_DEVICE_ID_TI_1451A		0xac52
+#define PCI_DEVICE_ID_TI_1620		0xac54
 #define PCI_DEVICE_ID_TI_1520		0xac55
 #define PCI_DEVICE_ID_TI_1510		0xac56
 
@@ -1054,11 +1059,19 @@
 #define PCI_DEVICE_ID_NVIDIA_UTNT2		0x0029
 #define PCI_DEVICE_ID_NVIDIA_VTNT2		0x002C
 #define PCI_DEVICE_ID_NVIDIA_UVTNT2		0x002D
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE	0x0035
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA	0x0036
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2	0x003e
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE	0x0053
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA	0x0054
+#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2	0x0055
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE	0x0065
+#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO		0x006a
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE	0x0085
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA	0x008e
 #define PCI_DEVICE_ID_NVIDIA_ITNT2		0x00A0
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3		0x00d1
+#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO		0x00da
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S  		0x00e1
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE	0x00d5
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA	0x00e3
@@ -1088,6 +1101,7 @@
 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL	0x017C
 #define PCI_DEVICE_ID_NVIDIA_IGEFORCE2		0x01a0
 #define PCI_DEVICE_ID_NVIDIA_NFORCE		0x01a4
+#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO		0x01b1
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE		0x01bc
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2		0x01e0
 #define PCI_DEVICE_ID_NVIDIA_GEFORCE3		0x0200
@@ -1642,8 +1656,8 @@
 #define PCI_SUBDEVICE_ID_CHASE_PCIRAS8		0xF010
 
 #define PCI_VENDOR_ID_AUREAL		0x12eb
-#define PCI_DEVICE_ID_AUREAL_VORTEX	0x0001
-#define PCI_DEVICE_ID_AUREAL_VORTEX2	0x0002
+#define PCI_DEVICE_ID_AUREAL_VORTEX_1	0x0001
+#define PCI_DEVICE_ID_AUREAL_VORTEX_2	0x0002
 #define PCI_DEVICE_ID_AUREAL_ADVANTAGE	0x0003
 
 #define PCI_VENDOR_ID_ELECTRONICDESIGNGMBH 0x12f8
@@ -1832,11 +1846,19 @@
 #define PCI_DEVICE_ID_TIGON3_5702FE	0x164d
 #define PCI_DEVICE_ID_TIGON3_5705	0x1653
 #define PCI_DEVICE_ID_TIGON3_5705_2	0x1654
+#define PCI_DEVICE_ID_TIGON3_5720	0x1658
+#define PCI_DEVICE_ID_TIGON3_5721	0x1659
 #define PCI_DEVICE_ID_TIGON3_5705M	0x165d
 #define PCI_DEVICE_ID_TIGON3_5705M_2	0x165e
 #define PCI_DEVICE_ID_TIGON3_5705F	0x166e
+#define PCI_DEVICE_ID_TIGON3_5750	0x1676
+#define PCI_DEVICE_ID_TIGON3_5751	0x1677
+#define PCI_DEVICE_ID_TIGON3_5750M	0x167c
+#define PCI_DEVICE_ID_TIGON3_5751M	0x167d
+#define PCI_DEVICE_ID_TIGON3_5751F	0x167e
 #define PCI_DEVICE_ID_TIGON3_5782	0x1696
 #define PCI_DEVICE_ID_TIGON3_5788	0x169c
+#define PCI_DEVICE_ID_TIGON3_5789	0x169d
 #define PCI_DEVICE_ID_TIGON3_5702X	0x16a6
 #define PCI_DEVICE_ID_TIGON3_5703X	0x16a7
 #define PCI_DEVICE_ID_TIGON3_5704S	0x16a8
@@ -1864,6 +1886,11 @@
 #define PCI_VENDOR_ID_ZOLTRIX		0x15b0
 #define PCI_DEVICE_ID_ZOLTRIX_2BD0	0x2bd0 
 
+#define PCI_VENDOR_ID_MELLANOX		0x15b3
+#define PCI_DEVICE_ID_MELLANOX_TAVOR	0x5a44
+#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278
+#define PCI_DEVICE_ID_MELLANOX_ARBEL	0x6282
+
 #define PCI_VENDOR_ID_PDC		0x15e9
 #define PCI_DEVICE_ID_PDC_1841		0x1841
 
@@ -1875,6 +1902,15 @@
 #define PCI_DEVICE_ID_MACROLINK_MCCR8	0x2000
 #define PCI_DEVICE_ID_MACROLINK_MCCR	0x2001
 
+#define PCI_VENDOR_ID_FARSITE           0x1619
+#define PCI_DEVICE_ID_FARSITE_T2P       0x0400
+#define PCI_DEVICE_ID_FARSITE_T4P       0x0440
+#define PCI_DEVICE_ID_FARSITE_T1U       0x0610
+#define PCI_DEVICE_ID_FARSITE_T2U       0x0620
+#define PCI_DEVICE_ID_FARSITE_T4U       0x0640
+#define PCI_DEVICE_ID_FARSITE_TE1       0x1610
+#define PCI_DEVICE_ID_FARSITE_TE1C      0x1612
+
 #define PCI_VENDOR_ID_ALTIMA		0x173b
 #define PCI_DEVICE_ID_ALTIMA_AC1000	0x03e8
 #define PCI_DEVICE_ID_ALTIMA_AC1001	0x03e9
@@ -1885,6 +1921,10 @@
 #define	PCI_DEVICE_ID_S2IO_WIN		0x5731
 #define	PCI_DEVICE_ID_S2IO_UNI		0x5831
 
+#define PCI_VENDOR_ID_INFINICON		0x1820
+
+#define PCI_VENDOR_ID_TOPSPIN		0x1867
+
 #define PCI_VENDOR_ID_ARC               0x192E
 #define PCI_DEVICE_ID_ARC_EHCI          0x0101
 
@@ -2058,7 +2098,6 @@
 #define PCI_DEVICE_ID_INTEL_82801EB_7	0x24d7
 #define PCI_DEVICE_ID_INTEL_82801EB_11	0x24db
 #define PCI_DEVICE_ID_INTEL_82801EB_13	0x24dd
-#define PCI_DEVICE_ID_INTEL_ESB_0	0x25a0
 #define PCI_DEVICE_ID_INTEL_ESB_1	0x25a1
 #define PCI_DEVICE_ID_INTEL_ESB_2	0x25a2
 #define PCI_DEVICE_ID_INTEL_ESB_3	0x25a3
@@ -2084,8 +2123,24 @@
 #define PCI_DEVICE_ID_INTEL_82875_IG	0x257b
 #define PCI_DEVICE_ID_INTEL_ICH6_0	0x2640
 #define PCI_DEVICE_ID_INTEL_ICH6_1	0x2641
-#define PCI_DEVICE_ID_INTEL_ICH6_2	0x266f
-#define PCI_DEVICE_ID_INTEL_ICH6_3	0x266e
+#define PCI_DEVICE_ID_INTEL_ICH6_2	0x2642
+#define PCI_DEVICE_ID_INTEL_ICH6_3	0x2651
+#define PCI_DEVICE_ID_INTEL_ICH6_4	0x2652
+#define PCI_DEVICE_ID_INTEL_ICH6_5	0x2653
+#define PCI_DEVICE_ID_INTEL_ICH6_6	0x2658
+#define PCI_DEVICE_ID_INTEL_ICH6_7	0x2659
+#define PCI_DEVICE_ID_INTEL_ICH6_8	0x265a
+#define PCI_DEVICE_ID_INTEL_ICH6_9	0x265b
+#define PCI_DEVICE_ID_INTEL_ICH6_10	0x265c
+#define PCI_DEVICE_ID_INTEL_ICH6_11	0x2660
+#define PCI_DEVICE_ID_INTEL_ICH6_12	0x2662
+#define PCI_DEVICE_ID_INTEL_ICH6_13	0x2664
+#define PCI_DEVICE_ID_INTEL_ICH6_14	0x2666
+#define PCI_DEVICE_ID_INTEL_ICH6_15	0x2668
+#define PCI_DEVICE_ID_INTEL_ICH6_16	0x266a
+#define PCI_DEVICE_ID_INTEL_ICH6_17	0x266d
+#define PCI_DEVICE_ID_INTEL_ICH6_18	0x266e
+#define PCI_DEVICE_ID_INTEL_ICH6_19	0x266f
 #define PCI_DEVICE_ID_INTEL_82855PM_HB	0x3340
 #define PCI_DEVICE_ID_INTEL_82830_HB	0x3575
 #define PCI_DEVICE_ID_INTEL_82830_CGC	0x3577
@@ -2113,6 +2168,7 @@
 #define PCI_DEVICE_ID_INTEL_82443BX_0	0x7190
 #define PCI_DEVICE_ID_INTEL_82443BX_1	0x7191
 #define PCI_DEVICE_ID_INTEL_82443BX_2	0x7192
+#define PCI_DEVICE_ID_INTEL_440MX	0x7195
 #define PCI_DEVICE_ID_INTEL_82443MX_0	0x7198
 #define PCI_DEVICE_ID_INTEL_82443MX_1	0x7199
 #define PCI_DEVICE_ID_INTEL_82443MX_2	0x719a
@@ -2129,6 +2185,7 @@
 #define PCI_DEVICE_ID_INTEL_82451NX	0x84ca
 #define PCI_DEVICE_ID_INTEL_82454NX     0x84cb
 #define PCI_DEVICE_ID_INTEL_84460GX	0x84ea
+#define	PCI_DEVICE_ID_INTEL_IXP4XX	0x8500
 
 #define PCI_VENDOR_ID_COMPUTONE		0x8e0e
 #define PCI_DEVICE_ID_COMPUTONE_IP2EX	0x0291
diff -Nru a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
--- a/include/linux/pkt_cls.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/pkt_cls.h	Tue Jun 15 22:20:36 2004
@@ -24,11 +24,12 @@
 	TCA_POLICE_RATE,
 	TCA_POLICE_PEAKRATE,
 	TCA_POLICE_AVRATE,
-	TCA_POLICE_RESULT
+	TCA_POLICE_RESULT,
 #define TCA_POLICE_RESULT TCA_POLICE_RESULT
+	__TCA_POLICE_MAX
 };
 
-#define TCA_POLICE_MAX TCA_POLICE_RESULT
+#define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1)
 
 /* U32 filters */
 
@@ -49,9 +50,10 @@
 	TCA_U32_DIVISOR,
 	TCA_U32_SEL,
 	TCA_U32_POLICE,
+	__TCA_U32_MAX
 };
 
-#define TCA_U32_MAX TCA_U32_POLICE
+#define TCA_U32_MAX (__TCA_U32_MAX - 1)
 
 struct tc_u32_key
 {
@@ -97,9 +99,10 @@
 	TCA_RSVP_SRC,
 	TCA_RSVP_PINFO,
 	TCA_RSVP_POLICE,
+	__TCA_RSVP_MAX
 };
 
-#define TCA_RSVP_MAX TCA_RSVP_POLICE
+#define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1)
 
 struct tc_rsvp_gpi
 {
@@ -127,9 +130,10 @@
 	TCA_ROUTE4_FROM,
 	TCA_ROUTE4_IIF,
 	TCA_ROUTE4_POLICE,
+	__TCA_ROUTE4_MAX
 };
 
-#define TCA_ROUTE4_MAX TCA_ROUTE4_POLICE
+#define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1)
 
 
 /* FW filter */
@@ -139,9 +143,10 @@
 	TCA_FW_UNSPEC,
 	TCA_FW_CLASSID,
 	TCA_FW_POLICE,
+	__TCA_FW_MAX
 };
 
-#define TCA_FW_MAX TCA_FW_POLICE
+#define TCA_FW_MAX (__TCA_FW_MAX - 1)
 
 /* TC index filter */
 
@@ -154,8 +159,9 @@
 	TCA_TCINDEX_FALL_THROUGH,
 	TCA_TCINDEX_CLASSID,
 	TCA_TCINDEX_POLICE,
+	__TCA_TCINDEX_MAX
 };
 
-#define TCA_TCINDEX_MAX        TCA_TCINDEX_POLICE
+#define TCA_TCINDEX_MAX        (__TCA_TCINDEX_MAX - 1)
 
 #endif
diff -Nru a/include/linux/pm.h b/include/linux/pm.h
--- a/include/linux/pm.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/pm.h	Tue Jun 15 22:20:41 2004
@@ -229,8 +229,9 @@
 struct device;
 
 struct dev_pm_info {
-#ifdef	CONFIG_PM
 	u32			power_state;
+#ifdef	CONFIG_PM
+	u32			prev_state;
 	u8			* saved_state;
 	atomic_t		pm_users;
 	struct device		* pm_parent;
diff -Nru a/include/linux/prio_tree.h b/include/linux/prio_tree.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/linux/prio_tree.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,64 @@
+#ifndef _LINUX_PRIO_TREE_H
+#define _LINUX_PRIO_TREE_H
+
+struct prio_tree_node {
+	struct prio_tree_node	*left;
+	struct prio_tree_node	*right;
+	struct prio_tree_node	*parent;
+};
+
+struct prio_tree_root {
+	struct prio_tree_node	*prio_tree_node;
+	unsigned int 		index_bits;
+};
+
+struct prio_tree_iter {
+	struct prio_tree_node	*cur;
+	unsigned long		mask;
+	unsigned long		value;
+	int			size_level;
+};
+
+#define INIT_PRIO_TREE_ROOT(ptr)	\
+do {					\
+	(ptr)->prio_tree_node = NULL;	\
+	(ptr)->index_bits = 1;		\
+} while (0)
+
+#define INIT_PRIO_TREE_NODE(ptr)				\
+do {								\
+	(ptr)->left = (ptr)->right = (ptr)->parent = (ptr);	\
+} while (0)
+
+#define INIT_PRIO_TREE_ITER(ptr)	\
+do {					\
+	(ptr)->cur = NULL;		\
+	(ptr)->mask = 0UL;		\
+	(ptr)->value = 0UL;		\
+	(ptr)->size_level = 0;		\
+} while (0)
+
+#define prio_tree_entry(ptr, type, member) \
+       ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+static inline int prio_tree_empty(const struct prio_tree_root *root)
+{
+	return root->prio_tree_node == NULL;
+}
+
+static inline int prio_tree_root(const struct prio_tree_node *node)
+{
+	return node->parent == node;
+}
+
+static inline int prio_tree_left_empty(const struct prio_tree_node *node)
+{
+	return node->left == node;
+}
+
+static inline int prio_tree_right_empty(const struct prio_tree_node *node)
+{
+	return node->right == node;
+}
+
+#endif /* _LINUX_PRIO_TREE_H */
diff -Nru a/include/linux/quota.h b/include/linux/quota.h
--- a/include/linux/quota.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/quota.h	Tue Jun 15 22:20:43 2004
@@ -250,6 +250,8 @@
 	int (*free_inode) (const struct inode *, unsigned long);
 	int (*transfer) (struct inode *, struct iattr *);
 	int (*write_dquot) (struct dquot *);		/* Ordinary dquot write */
+	int (*acquire_dquot) (struct dquot *);		/* Quota is going to be created on disk */
+	int (*release_dquot) (struct dquot *);		/* Quota is going to be deleted from disk */
 	int (*mark_dirty) (struct dquot *);		/* Dquot is marked dirty */
 	int (*write_info) (struct super_block *, int);	/* Write of quota "superblock" */
 };
diff -Nru a/include/linux/quotaio_v2.h b/include/linux/quotaio_v2.h
--- a/include/linux/quotaio_v2.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/quotaio_v2.h	Tue Jun 15 22:20:41 2004
@@ -59,7 +59,7 @@
 
 /*
  *  Structure of header of block with quota structures. It is padded to 16 bytes so
- *  there will be space for exactly 18 quota-entries in a block
+ *  there will be space for exactly 21 quota-entries in a block
  */
 struct v2_disk_dqdbheader {
 	__u32 dqdh_next_free;	/* Number of next block with free entry */
diff -Nru a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
--- a/include/linux/raid/md_k.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/raid/md_k.h	Tue Jun 15 22:20:36 2004
@@ -255,6 +255,14 @@
 	struct list_head		all_mddevs;
 };
 
+
+static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev)
+{
+	int faulty = rdev->faulty;
+	if (atomic_dec_and_test(&rdev->nr_pending) && faulty)
+		set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+}
+
 struct mdk_personality_s
 {
 	char *name;
@@ -271,6 +279,8 @@
 	int (*hot_remove_disk) (mddev_t *mddev, int number);
 	int (*spare_active) (mddev_t *mddev);
 	int (*sync_request)(mddev_t *mddev, sector_t sector_nr, int go_faster);
+	int (*resize) (mddev_t *mddev, sector_t sectors);
+	int (*reshape) (mddev_t *mddev, int raid_disks);
 };
 
 
diff -Nru a/include/linux/raid/raid1.h b/include/linux/raid/raid1.h
--- a/include/linux/raid/raid1.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/raid/raid1.h	Tue Jun 15 22:20:41 2004
@@ -10,6 +10,20 @@
 	sector_t	head_position;
 };
 
+/*
+ * memory pools need a pointer to the mddev, so they can force an unplug
+ * when memory is tight, and a count of the number of drives that the
+ * pool was allocated for, so they know how much to allocate and free.
+ * mddev->raid_disks cannot be used, as it can change while a pool is active
+ * These two datums are stored in a kmalloced struct.
+ */
+
+struct pool_info {
+	mddev_t *mddev;
+	int	raid_disks;
+};
+
+
 typedef struct r1bio_s r1bio_t;
 
 struct r1_private_data_s {
@@ -30,6 +44,8 @@
 
 	wait_queue_head_t	wait_idle;
 	wait_queue_head_t	wait_resume;
+
+	struct pool_info	*poolinfo;
 
 	mempool_t *r1bio_pool;
 	mempool_t *r1buf_pool;
diff -Nru a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
--- a/include/linux/raid/raid5.h	Tue Jun 15 22:20:44 2004
+++ b/include/linux/raid/raid5.h	Tue Jun 15 22:20:44 2004
@@ -181,7 +181,7 @@
  * is put on a "delayed" queue until there are no stripes currently
  * in a pre-read phase.  Further, if the "delayed" queue is empty when
  * a stripe is put on it then we "plug" the queue and do not process it
- * until an unplug call is made. (blk_run_queues is run).
+ * until an unplug call is made. (the unplug_io_fn() is called).
  *
  * When preread is initiated on a stripe, we set PREREAD_ACTIVE and add
  * it to the count of prereading stripes.
diff -Nru a/include/linux/reboot.h b/include/linux/reboot.h
--- a/include/linux/reboot.h	Tue Jun 15 22:21:05 2004
+++ b/include/linux/reboot.h	Tue Jun 15 22:21:05 2004
@@ -22,6 +22,7 @@
  * POWER_OFF   Stop OS and remove all power from system, if possible.
  * RESTART2    Restart system using given command string.
  * SW_SUSPEND  Suspend system using software suspend if compiled in.
+ * KEXEC       Restart system using a previously loaded Linux kernel
  */
 
 #define	LINUX_REBOOT_CMD_RESTART	0x01234567
@@ -31,6 +32,7 @@
 #define	LINUX_REBOOT_CMD_POWER_OFF	0x4321FEDC
 #define	LINUX_REBOOT_CMD_RESTART2	0xA1B2C3D4
 #define	LINUX_REBOOT_CMD_SW_SUSPEND	0xD000FCE2
+#define	LINUX_REBOOT_CMD_KEXEC		0x45584543
 
 
 #ifdef __KERNEL__
diff -Nru a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/linux/reiserfs_acl.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,91 @@
+#include <linux/init.h>
+#include <linux/posix_acl.h>
+#include <linux/xattr_acl.h>
+
+#define REISERFS_ACL_VERSION	0x0001
+
+typedef struct {
+	__u16		e_tag;
+	__u16		e_perm;
+	__u32		e_id;
+} reiserfs_acl_entry;
+
+typedef struct {
+	__u16		e_tag;
+	__u16		e_perm;
+} reiserfs_acl_entry_short;
+
+typedef struct {
+	__u32		a_version;
+} reiserfs_acl_header;
+
+static inline size_t reiserfs_acl_size(int count)
+{
+	if (count <= 4) {
+		return sizeof(reiserfs_acl_header) +
+		       count * sizeof(reiserfs_acl_entry_short);
+	} else {
+		return sizeof(reiserfs_acl_header) +
+		       4 * sizeof(reiserfs_acl_entry_short) +
+		       (count - 4) * sizeof(reiserfs_acl_entry);
+	}
+}
+
+static inline int reiserfs_acl_count(size_t size)
+{
+	ssize_t s;
+	size -= sizeof(reiserfs_acl_header);
+	s = size - 4 * sizeof(reiserfs_acl_entry_short);
+	if (s < 0) {
+		if (size % sizeof(reiserfs_acl_entry_short))
+			return -1;
+		return size / sizeof(reiserfs_acl_entry_short);
+	} else {
+		if (s % sizeof(reiserfs_acl_entry))
+			return -1;
+		return s / sizeof(reiserfs_acl_entry) + 4;
+	}
+}
+
+
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
+struct posix_acl * reiserfs_get_acl(struct inode *inode, int type);
+int reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl);
+int reiserfs_acl_chmod (struct inode *inode);
+int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode);
+int reiserfs_cache_default_acl (struct inode *dir);
+extern int reiserfs_xattr_posix_acl_init (void) __init;
+extern int reiserfs_xattr_posix_acl_exit (void);
+extern struct reiserfs_xattr_handler posix_acl_default_handler;
+extern struct reiserfs_xattr_handler posix_acl_access_handler;
+#else
+
+#define reiserfs_set_acl NULL
+#define reiserfs_get_acl NULL
+#define reiserfs_cache_default_acl(inode) 0
+
+static inline int
+reiserfs_xattr_posix_acl_init (void)
+{
+    return 0;
+}
+
+static inline int
+reiserfs_xattr_posix_acl_exit (void)
+{
+    return 0;
+}
+
+static inline int
+reiserfs_acl_chmod (struct inode *inode)
+{
+    return 0;
+}
+
+static inline int
+reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode)
+{
+    return 0;
+}
+
+#endif
diff -Nru a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
--- a/include/linux/reiserfs_fs.h	Tue Jun 15 22:20:58 2004
+++ b/include/linux/reiserfs_fs.h	Tue Jun 15 22:20:58 2004
@@ -75,6 +75,7 @@
 */
 #define REISERFS_DEBUG_CODE 5 /* extra messages to help find/debug errors */ 
 
+void reiserfs_warning (struct super_block *s, const char * fmt, ...);
 /* assertions handling */
 
 /** always check a condition and panic if it's false. */
@@ -268,6 +269,7 @@
 #define NO_DISK_SPACE -3
 #define NO_BALANCING_NEEDED  (-4)
 #define NO_MORE_UNUSED_CONTIGUOUS_BLOCKS (-5)
+#define QUOTA_EXCEEDED -6
 
 typedef __u32 b_blocknr_t;
 typedef __u32 unp_t;
@@ -287,7 +289,7 @@
 #define STAT_DATA_V2 1
 
 
-static inline struct reiserfs_inode_info *REISERFS_I(struct inode *inode)
+static inline struct reiserfs_inode_info *REISERFS_I(const struct inode *inode)
 {
 	return container_of(inode, struct reiserfs_inode_info, vfs_inode);
 }
@@ -561,9 +563,6 @@
 #define V1_DIRENTRY_UNIQUENESS 500
 #define V1_ANY_UNIQUENESS 555 // FIXME: comment is required
 
-extern void reiserfs_warning (const char * fmt, ...);
-/* __attribute__( ( format ( printf, 1, 2 ) ) ); */
-
 //
 // here are conversion routines
 //
@@ -576,7 +575,8 @@
     case V1_DIRECT_UNIQUENESS: return TYPE_DIRECT;
     case V1_DIRENTRY_UNIQUENESS: return TYPE_DIRENTRY;
     default:
-	    reiserfs_warning( "vs-500: unknown uniqueness %d\n", uniqueness);
+	    reiserfs_warning (NULL, "vs-500: unknown uniqueness %d",
+			      uniqueness);
 	case V1_ANY_UNIQUENESS:
 	    return TYPE_ANY;
     }
@@ -591,7 +591,7 @@
     case TYPE_DIRECT: return V1_DIRECT_UNIQUENESS;
     case TYPE_DIRENTRY: return V1_DIRENTRY_UNIQUENESS;
     default:
-	    reiserfs_warning( "vs-501: unknown type %d\n", type);
+	    reiserfs_warning (NULL, "vs-501: unknown type %d", type);
 	case TYPE_ANY:
 	    return V1_ANY_UNIQUENESS;
     }
@@ -1238,7 +1238,6 @@
 gods only know how we are going to SMP the code that uses them.
 znodes are the way! */
 
-
 struct  path {
   int                   path_length;                      	/* Length of the array above.   */
   struct  path_element  path_elements[EXTENDED_MAX_HEIGHT];	/* Array of the path elements.  */
@@ -1771,7 +1770,7 @@
 void reiserfs_wait_on_write_block(struct super_block *s) ;
 void reiserfs_block_writes(struct reiserfs_transaction_handle *th) ;
 void reiserfs_allow_writes(struct super_block *s) ;
-void reiserfs_check_lock_depth(char *caller) ;
+void reiserfs_check_lock_depth(struct super_block *s, char *caller) ;
 int reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ;
 void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ;
 int journal_init(struct super_block *, const char * j_dev_name, int old_format, unsigned int) ;
@@ -1889,11 +1888,13 @@
 int reiserfs_insert_item (struct reiserfs_transaction_handle *th, 
 			  struct path * path, 
 			  const struct cpu_key * key,
-			  struct item_head * ih, const char * body);
+			  struct item_head * ih,
+			  struct inode *inode, const char * body);
 
 int reiserfs_paste_into_item (struct reiserfs_transaction_handle *th,
 			      struct path * path,
 			      const struct cpu_key * key,
+			      struct inode *inode,
 			      const char * body, int paste_size);
 
 int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th,
@@ -1910,7 +1911,7 @@
 			  struct buffer_head  * p_s_un_bh);
 
 void reiserfs_delete_solid_item (struct reiserfs_transaction_handle *th,
-                                                                struct key * key);
+				 struct inode *inode, struct key * key);
 void reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode * p_s_inode);
 void reiserfs_do_truncate (struct reiserfs_transaction_handle *th, 
 			   struct  inode * p_s_inode, struct page *, 
@@ -1955,11 +1956,22 @@
 				   struct inode * dir, int mode, 
 				   const char * symname, loff_t i_size,
 				   struct dentry *dentry, struct inode *inode);
-int reiserfs_sync_inode (struct reiserfs_transaction_handle *th, struct inode * inode);
-void reiserfs_update_sd (struct reiserfs_transaction_handle *th, struct inode * inode);
+
+int reiserfs_sync_inode (struct reiserfs_transaction_handle *th,
+                         struct inode * inode);
+
+void reiserfs_update_sd_size (struct reiserfs_transaction_handle *th,
+                              struct inode * inode, loff_t size);
+
+static inline void reiserfs_update_sd(struct reiserfs_transaction_handle *th,
+                                      struct inode *inode)
+{
+    reiserfs_update_sd_size(th, inode, inode->i_size) ;
+}
 
 void sd_attrs_to_i_attrs( __u16 sd_attrs, struct inode *inode );
 void i_attrs_to_sd_attrs( struct inode *inode, __u16 *sd_attrs );
+int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
 
 /* namei.c */
 void set_de_name_and_namelen (struct reiserfs_dir_entry * de);
@@ -2010,6 +2022,8 @@
 
 /* dir.c */
 extern struct inode_operations reiserfs_dir_inode_operations;
+extern struct inode_operations reiserfs_symlink_inode_operations;
+extern struct inode_operations reiserfs_special_inode_operations;
 extern struct file_operations reiserfs_dir_operations;
 
 /* tail_conversion.c */
@@ -2048,10 +2062,10 @@
 
 
 /* prints.c */
-void reiserfs_panic (struct super_block * s, const char * fmt, ...)
-__attribute__ ( ( noreturn ) );/* __attribute__( ( format ( printf, 2, 3 ) ) ) */
+void reiserfs_panic (struct super_block * s, const char * fmt, ...) __attribute__ ( ( noreturn ) );
+void reiserfs_info (struct super_block *s, const char * fmt, ...);
+void reiserfs_printk (const char * fmt, ...);
 void reiserfs_debug (struct super_block *s, int level, const char * fmt, ...);
-/* __attribute__( ( format ( printf, 3, 4 ) ) ); */
 void print_virtual_node (struct virtual_node * vn);
 void print_indirect_item (struct buffer_head * bh, int item_num);
 void store_print_tb (struct tree_balance * tb);
@@ -2136,7 +2150,7 @@
 
 int reiserfs_parse_alloc_options (struct super_block *, char *);
 int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value);
-void reiserfs_free_block (struct reiserfs_transaction_handle *th, b_blocknr_t);
+void reiserfs_free_block (struct reiserfs_transaction_handle *th, struct inode *, b_blocknr_t, int for_unformatted);
 int reiserfs_allocate_blocknrs(reiserfs_blocknr_hint_t *, b_blocknr_t * , int, int);
 extern inline int reiserfs_new_form_blocknrs (struct tree_balance * tb,
 					      b_blocknr_t *new_blocknrs, int amount_needed)
@@ -2237,6 +2251,9 @@
 #define reiserfs_write_lock( sb ) lock_kernel()
 #define reiserfs_write_unlock( sb ) unlock_kernel()
  			         
+/* xattr stuff */
+#define REISERFS_XATTR_DIR_SEM(s) (REISERFS_SB(s)->xattr_dir_sem)
+
 #endif /* _LINUX_REISER_FS_H */
 
 
diff -Nru a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
--- a/include/linux/reiserfs_fs_i.h	Tue Jun 15 22:20:44 2004
+++ b/include/linux/reiserfs_fs_i.h	Tue Jun 15 22:20:44 2004
@@ -22,7 +22,9 @@
       truncate or unlink. Safe link is used to avoid leakage of disk
       space on crash with some files open, but unlinked. */
     i_link_saved_unlink_mask   =  0x0010,
-    i_link_saved_truncate_mask =  0x0020
+    i_link_saved_truncate_mask =  0x0020,
+    i_priv_object              =  0x0080,
+    i_has_xattr_dir            =  0x0100,
 } reiserfs_inode_flags;
 
 
@@ -51,6 +53,10 @@
     ** flushed */
     unsigned long i_trans_id ;
     struct reiserfs_journal_list *i_jl;
+
+    struct posix_acl *i_acl_access;
+    struct posix_acl *i_acl_default;
+    struct rw_semaphore xattr_sem;
     struct inode vfs_inode;
 };
 
diff -Nru a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
--- a/include/linux/reiserfs_fs_sb.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/reiserfs_fs_sb.h	Tue Jun 15 22:20:40 2004
@@ -6,6 +6,7 @@
 
 #ifdef __KERNEL__
 #include <linux/workqueue.h>
+#include <linux/rwsem.h>
 #endif
 
 typedef enum {
@@ -251,7 +252,6 @@
 
 #define JOURNAL_DESC_MAGIC "ReIsErLB" /* ick.  magic string to find desc blocks in the journal */
 
-
 typedef __u32 (*hashf_t) (const signed char *, int);
 
 struct reiserfs_bitmap_info
@@ -395,6 +395,10 @@
     struct proc_dir_entry *procdir;
     int reserved_blocks; /* amount of blocks reserved for further allocations */
     spinlock_t bitmap_lock; /* this lock on now only used to protect reserved_blocks variable */
+    struct dentry *priv_root; /* root of /.reiserfs_priv */
+    struct dentry *xattr_root; /* root of /.reiserfs_priv/.xa */
+    struct rw_semaphore xattr_dir_sem;
+
 };
 
 /* Definitions of reiserfs on-disk properties: */
@@ -437,6 +441,9 @@
     REISERFS_NO_UNHASHED_RELOCATION,
     REISERFS_HASHED_RELOCATION,
     REISERFS_ATTRS,
+    REISERFS_XATTRS,
+    REISERFS_XATTRS_USER,
+    REISERFS_POSIXACL,
 
     REISERFS_TEST1,
     REISERFS_TEST2,
@@ -462,6 +469,10 @@
 #define reiserfs_data_log(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_LOG))
 #define reiserfs_data_ordered(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_ORDERED))
 #define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
+#define reiserfs_xattrs(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS))
+#define reiserfs_xattrs_user(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_XATTRS_USER))
+#define reiserfs_posixacl(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_POSIXACL))
+#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))
 
 void reiserfs_file_buffer (struct buffer_head * bh, int list);
 extern struct file_system_type reiserfs_fs_type;
diff -Nru a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/linux/reiserfs_xattr.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,132 @@
+/*
+  File: linux/reiserfs_xattr.h
+*/
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/xattr.h>
+
+/* Magic value in header */
+#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
+
+struct reiserfs_xattr_header {
+    __u32 h_magic;              /* magic number for identification */
+    __u32 h_hash;               /* hash of the value */
+};
+
+#ifdef __KERNEL__
+
+struct reiserfs_xattr_handler {
+	char *prefix;
+        int (*init)(void);
+        void (*exit)(void);
+	int (*get)(struct inode *inode, const char *name, void *buffer,
+		   size_t size);
+	int (*set)(struct inode *inode, const char *name, const void *buffer,
+		   size_t size, int flags);
+	int (*del)(struct inode *inode, const char *name);
+        int (*list)(struct inode *inode, const char *name, int namelen, char *out);
+        struct list_head handlers;
+};
+
+
+#ifdef CONFIG_REISERFS_FS_XATTR
+#define is_reiserfs_priv_object(inode) (REISERFS_I(inode)->i_flags & i_priv_object)
+#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);
+int reiserfs_setxattr (struct dentry *dentry, const char *name,
+                       const void *value, size_t size, int flags);
+ssize_t reiserfs_listxattr (struct dentry *dentry, char *buffer, size_t size);
+int reiserfs_removexattr (struct dentry *dentry, const char *name);
+int reiserfs_delete_xattrs (struct inode *inode);
+int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs);
+int reiserfs_xattr_init (struct super_block *sb, int mount_flags);
+int reiserfs_permission (struct inode *inode, int mask, struct nameidata *nd);
+int reiserfs_permission_locked (struct inode *inode, int mask, struct nameidata *nd);
+
+int reiserfs_xattr_del (struct inode *, const char *);
+int reiserfs_xattr_get (const struct inode *, const char *, void *, size_t);
+int reiserfs_xattr_set (struct inode *, const char *, const void *,
+                               size_t, int);
+
+extern struct reiserfs_xattr_handler user_handler;
+extern struct reiserfs_xattr_handler trusted_handler;
+#ifdef CONFIG_REISERFS_FS_SECURITY
+extern struct reiserfs_xattr_handler security_handler;
+#endif
+
+int reiserfs_xattr_register_handlers (void) __init;
+void reiserfs_xattr_unregister_handlers (void);
+
+static inline void
+reiserfs_write_lock_xattrs(struct super_block *sb)
+{
+    down_write (&REISERFS_XATTR_DIR_SEM(sb));
+}
+static inline void
+reiserfs_write_unlock_xattrs(struct super_block *sb)
+{
+    up_write (&REISERFS_XATTR_DIR_SEM(sb));
+}
+static inline void
+reiserfs_read_lock_xattrs(struct super_block *sb)
+{
+    down_read (&REISERFS_XATTR_DIR_SEM(sb));
+}
+
+static inline void
+reiserfs_read_unlock_xattrs(struct super_block *sb)
+{
+    up_read (&REISERFS_XATTR_DIR_SEM(sb));
+}
+
+static inline void
+reiserfs_write_lock_xattr_i(struct inode *inode)
+{
+    down_write (&REISERFS_I(inode)->xattr_sem);
+}
+static inline void
+reiserfs_write_unlock_xattr_i(struct inode *inode)
+{
+    up_write (&REISERFS_I(inode)->xattr_sem);
+}
+static inline void
+reiserfs_read_lock_xattr_i(struct inode *inode)
+{
+    down_read (&REISERFS_I(inode)->xattr_sem);
+}
+
+static inline void
+reiserfs_read_unlock_xattr_i(struct inode *inode)
+{
+    up_read (&REISERFS_I(inode)->xattr_sem);
+}
+
+#else
+
+#define is_reiserfs_priv_object(inode) 0
+#define reiserfs_getxattr NULL
+#define reiserfs_setxattr NULL
+#define reiserfs_listxattr NULL
+#define reiserfs_removexattr NULL
+#define reiserfs_write_lock_xattrs(sb)
+#define reiserfs_write_unlock_xattrs(sb)
+#define reiserfs_read_lock_xattrs(sb)
+#define reiserfs_read_unlock_xattrs(sb)
+
+#define reiserfs_permission NULL
+
+#define reiserfs_xattr_register_handlers() 0
+#define reiserfs_xattr_unregister_handlers()
+
+static inline int reiserfs_delete_xattrs (struct inode *inode) { return 0; };
+static inline int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs) { return 0; };
+static inline int reiserfs_xattr_init (struct super_block *sb, int mount_flags)
+{
+    sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
+    return 0;
+};
+#endif
+
+#endif  /* __KERNEL__ */
diff -Nru a/include/linux/rmap.h b/include/linux/rmap.h
--- a/include/linux/rmap.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/rmap.h	Tue Jun 15 22:20:36 2004
@@ -2,40 +2,107 @@
 #define _LINUX_RMAP_H
 /*
  * Declarations for Reverse Mapping functions in mm/rmap.c
- * Its structures are declared within that file.
  */
 
 #include <linux/config.h>
-#include <linux/linkage.h>
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
 
-#define rmap_lock(page) \
+#define page_map_lock(page) \
 	bit_spin_lock(PG_maplock, (unsigned long *)&(page)->flags)
-#define rmap_unlock(page) \
+#define page_map_unlock(page) \
 	bit_spin_unlock(PG_maplock, (unsigned long *)&(page)->flags)
 
+/*
+ * The anon_vma heads a list of private "related" vmas, to scan if
+ * an anonymous page pointing to this anon_vma needs to be unmapped:
+ * the vmas on the list will be related by forking, or by splitting.
+ *
+ * Since vmas come and go as they are split and merged (particularly
+ * in mprotect), the mapping field of an anonymous page cannot point
+ * directly to a vma: instead it points to an anon_vma, on whose list
+ * the related vmas can be easily linked or unlinked.
+ *
+ * After unlinking the last vma on the list, we must garbage collect
+ * the anon_vma object itself: we're guaranteed no page can be
+ * pointing to this anon_vma once its vma list is empty.
+ */
+struct anon_vma {
+	spinlock_t lock;	/* Serialize access to vma list */
+	struct list_head head;	/* List of private "related" vmas */
+};
+
 #ifdef CONFIG_MMU
 
-struct pte_chain;
-struct pte_chain *pte_chain_alloc(int gfp_flags);
-void __pte_chain_free(struct pte_chain *pte_chain);
+extern kmem_cache_t *anon_vma_cachep;
+
+static inline struct anon_vma *anon_vma_alloc(void)
+{
+	return kmem_cache_alloc(anon_vma_cachep, SLAB_KERNEL);
+}
 
-static inline void pte_chain_free(struct pte_chain *pte_chain)
+static inline void anon_vma_free(struct anon_vma *anon_vma)
 {
-	if (pte_chain)
-		__pte_chain_free(pte_chain);
+	kmem_cache_free(anon_vma_cachep, anon_vma);
 }
 
-struct pte_chain * fastcall
-	page_add_rmap(struct page *, pte_t *, struct pte_chain *);
-void fastcall page_remove_rmap(struct page *, pte_t *);
+static inline void anon_vma_lock(struct vm_area_struct *vma)
+{
+	struct anon_vma *anon_vma = vma->anon_vma;
+	if (anon_vma)
+		spin_lock(&anon_vma->lock);
+}
+
+static inline void anon_vma_unlock(struct vm_area_struct *vma)
+{
+	struct anon_vma *anon_vma = vma->anon_vma;
+	if (anon_vma)
+		spin_unlock(&anon_vma->lock);
+}
+
+/*
+ * anon_vma helper functions.
+ */
+void anon_vma_init(void);	/* create anon_vma_cachep */
+int  anon_vma_prepare(struct vm_area_struct *);
+void __anon_vma_merge(struct vm_area_struct *, struct vm_area_struct *);
+void anon_vma_unlink(struct vm_area_struct *);
+void anon_vma_link(struct vm_area_struct *);
+void __anon_vma_link(struct vm_area_struct *);
+
+/*
+ * rmap interfaces called when adding or removing pte of page
+ */
+void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
+void page_add_file_rmap(struct page *);
+void page_remove_rmap(struct page *);
+
+/**
+ * page_dup_rmap - duplicate pte mapping to a page
+ * @page:	the page to add the mapping to
+ *
+ * For copy_page_range only: minimal extract from page_add_rmap,
+ * avoiding unnecessary tests (already checked) so it's quicker.
+ */
+static inline void page_dup_rmap(struct page *page)
+{
+	page_map_lock(page);
+	page->mapcount++;
+	page_map_unlock(page);
+}
 
 /*
  * Called from mm/vmscan.c to handle paging out
  */
-int fastcall page_referenced(struct page *);
-int fastcall try_to_unmap(struct page *);
+int page_referenced(struct page *);
+int try_to_unmap(struct page *);
 
 #else	/* !CONFIG_MMU */
+
+#define anon_vma_init()		do {} while (0)
+#define anon_vma_prepare(vma)	(0)
+#define anon_vma_link(vma)	do {} while (0)
 
 #define page_referenced(page)	TestClearPageReferenced(page)
 #define try_to_unmap(page)	SWAP_FAIL
diff -Nru a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
--- a/include/linux/rtnetlink.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/rtnetlink.h	Tue Jun 15 22:20:43 2004
@@ -118,9 +118,10 @@
 	RTN_THROW,		/* Not in this table		*/
 	RTN_NAT,		/* Translate this address	*/
 	RTN_XRESOLVE,		/* Use external resolver	*/
+	__RTN_MAX
 };
 
-#define RTN_MAX RTN_XRESOLVE
+#define RTN_MAX (__RTN_MAX - 1)
 
 
 /* rtm_protocol */
@@ -183,9 +184,10 @@
 /* User defined values */
 	RT_TABLE_DEFAULT=253,
 	RT_TABLE_MAIN=254,
-	RT_TABLE_LOCAL=255
+	RT_TABLE_LOCAL=255,
+	__RT_TABLE_MAX
 };
-#define RT_TABLE_MAX RT_TABLE_LOCAL
+#define RT_TABLE_MAX (__RT_TABLE_MAX - 1)
 
 
 
@@ -207,9 +209,10 @@
 	RTA_FLOW,
 	RTA_CACHEINFO,
 	RTA_SESSION,
+	__RTA_MAX
 };
 
-#define RTA_MAX RTA_SESSION
+#define RTA_MAX (__RTA_MAX - 1)
 
 #define RTM_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
 #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
@@ -294,9 +297,10 @@
 #define RTAX_INITCWND RTAX_INITCWND
 	RTAX_FEATURES,
 #define RTAX_FEATURES RTAX_FEATURES
+	__RTAX_MAX
 };
 
-#define RTAX_MAX RTAX_FEATURES
+#define RTAX_MAX (__RTAX_MAX - 1)
 
 #define RTAX_FEATURE_ECN	0x00000001
 #define RTAX_FEATURE_SACK	0x00000002
@@ -345,10 +349,11 @@
 	IFA_BROADCAST,
 	IFA_ANYCAST,
 	IFA_CACHEINFO,
-	IFA_MULTICAST
+	IFA_MULTICAST,
+	__IFA_MAX
 };
 
-#define IFA_MAX IFA_CACHEINFO
+#define IFA_MAX (__IFA_MAX - 1)
 
 /* ifa_flags */
 
@@ -399,10 +404,11 @@
 	NDA_UNSPEC,
 	NDA_DST,
 	NDA_LLADDR,
-	NDA_CACHEINFO
+	NDA_CACHEINFO,
+	__NDA_MAX
 };
 
-#define NDA_MAX NDA_CACHEINFO
+#define NDA_MAX (__NDA_MAX - 1)
 
 #define NDA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg))))
 #define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg))
@@ -485,9 +491,10 @@
 	PREFIX_UNSPEC,
 	PREFIX_ADDRESS,
 	PREFIX_CACHEINFO,
+	__PREFIX_MAX
 };
 
-#define PREFIX_MAX	PREFIX_CACHEINFO
+#define PREFIX_MAX	(__PREFIX_MAX - 1)
 
 struct prefix_cacheinfo
 {
@@ -549,10 +556,11 @@
 #define IFLA_WIRELESS IFLA_WIRELESS
 	IFLA_PROTINFO,		/* Protocol specific information for a link */
 #define IFLA_PROTINFO IFLA_PROTINFO
+	__IFLA_MAX
 };
 
 
-#define IFLA_MAX IFLA_PROTINFO
+#define IFLA_MAX (__IFLA_MAX - 1)
 
 #define IFLA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
 #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
@@ -595,8 +603,11 @@
 	IFLA_INET6_STATS,	/* statistics			*/
 	IFLA_INET6_MCAST,	/* MC things. What of them?	*/
 	IFLA_INET6_CACHEINFO,	/* time values and max reasm size */
+	__IFLA_INET6_MAX
 };
 
+#define IFLA_INET6_MAX	(__IFLA_INET6_MAX - 1)
+
 struct ifla_cacheinfo
 {
 	__u32	max_reasm_len;
@@ -605,8 +616,6 @@
 	__u32	retrans_time;
 };
 
-#define IFLA_INET6_MAX	IFLA_INET6_CACHEINFO
-
 /*****************************************************************
  *		Traffic control messages.
  ****/
@@ -630,9 +639,10 @@
 	TCA_STATS,
 	TCA_XSTATS,
 	TCA_RATE,
+	__TCA_MAX
 };
 
-#define TCA_MAX TCA_RATE
+#define TCA_MAX (__TCA_MAX - 1)
 
 #define TCA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
 #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
diff -Nru a/include/linux/sched.h b/include/linux/sched.h
--- a/include/linux/sched.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/sched.h	Tue Jun 15 22:20:37 2004
@@ -147,9 +147,10 @@
 typedef struct task_struct task_t;
 
 extern void sched_init(void);
+extern void sched_init_smp(void);
 extern void init_idle(task_t *idle, int cpu);
 
-extern cpumask_t idle_cpu_mask;
+extern cpumask_t nohz_cpu_mask;
 
 extern void show_state(void);
 extern void show_regs(struct pt_regs *);
@@ -171,9 +172,11 @@
 			       unsigned long system, int cpu);
 extern void scheduler_tick(int user_tick, int system);
 extern unsigned long cache_decay_ticks;
-extern const unsigned long scheduling_functions_start_here;
-extern const unsigned long scheduling_functions_end_here;
 
+/* Attach to any functions which should be ignored in wchan output. */
+#define __sched		__attribute__((__section__(".sched.text")))
+/* Is this address in the __sched functions? */
+extern int in_sched_functions(unsigned long addr);
 
 #define	MAX_SCHEDULE_TIMEOUT	LONG_MAX
 extern signed long FASTCALL(schedule_timeout(signed long timeout));
@@ -290,7 +293,7 @@
  * in the range MAX_RT_PRIO..MAX_PRIO-1. Priority values
  * are inverted: lower p->prio value means higher priority.
  *
- * The MAX_RT_USER_PRIO value allows the actual maximum
+ * The MAX_USER_RT_PRIO value allows the actual maximum
  * RT priority to be separate from the value exported to
  * user-space.  This allows kernel threads to set their
  * priority to a value higher than any user task. Note:
@@ -349,7 +352,7 @@
 void exit_io_context(void);
 
 #define NGROUPS_SMALL		32
-#define NGROUPS_PER_BLOCK	((int)(EXEC_PAGESIZE / sizeof(gid_t)))
+#define NGROUPS_PER_BLOCK	((int)(PAGE_SIZE / sizeof(gid_t)))
 struct group_info {
 	int ngroups;
 	atomic_t usage;
@@ -376,6 +379,7 @@
 
 
 struct audit_context;		/* See audit.c */
+struct mempolicy;
 
 struct task_struct {
 	volatile long state;	/* -1 unrunnable, 0 runnable, >0 stopped */
@@ -504,6 +508,11 @@
 
 	unsigned long ptrace_message;
 	siginfo_t *last_siginfo; /* For ptrace use.  */
+
+#ifdef CONFIG_NUMA
+  	struct mempolicy *mempolicy;
+  	short il_next;		/* could be shared with used_math */
+#endif
 };
 
 static inline pid_t process_group(struct task_struct *tsk)
@@ -542,6 +551,118 @@
 #define PF_SYNCWRITE	0x00200000	/* I am doing a sync write */
 
 #ifdef CONFIG_SMP
+#define SCHED_LOAD_SCALE	128UL	/* increase resolution of load */
+
+#define SD_BALANCE_NEWIDLE	1	/* Balance when about to become idle */
+#define SD_BALANCE_EXEC		2	/* Balance on exec */
+#define SD_BALANCE_CLONE	4	/* Balance on clone */
+#define SD_WAKE_IDLE		8	/* Wake to idle CPU on task wakeup */
+#define SD_WAKE_AFFINE		16	/* Wake task to waking CPU */
+#define SD_WAKE_BALANCE		32	/* Perform balancing at task wakeup */
+#define SD_SHARE_CPUPOWER	64	/* Domain members share cpu power */
+
+struct sched_group {
+	struct sched_group *next;	/* Must be a circular list */
+	cpumask_t cpumask;
+
+	/*
+	 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
+	 * single CPU. This should be read only (except for setup). Although
+	 * it will need to be written to at cpu hot(un)plug time, perhaps the
+	 * cpucontrol semaphore will provide enough exclusion?
+	 */
+	unsigned long cpu_power;
+};
+
+struct sched_domain {
+	/* These fields must be setup */
+	struct sched_domain *parent;	/* top domain must be null terminated */
+	struct sched_group *groups;	/* the balancing groups of the domain */
+	cpumask_t span;			/* span of all CPUs in this domain */
+	unsigned long min_interval;	/* Minimum balance interval ms */
+	unsigned long max_interval;	/* Maximum balance interval ms */
+	unsigned int busy_factor;	/* less balancing by factor if busy */
+	unsigned int imbalance_pct;	/* No balance until over watermark */
+	unsigned long long cache_hot_time; /* Task considered cache hot (ns) */
+	unsigned int cache_nice_tries;	/* Leave cache hot tasks for # tries */
+	unsigned int per_cpu_gain;	/* CPU % gained by adding domain cpus */
+	int flags;			/* See SD_* */
+
+	/* Runtime fields. */
+	unsigned long last_balance;	/* init to jiffies. units in jiffies */
+	unsigned int balance_interval;	/* initialise to 1. units in ms. */
+	unsigned int nr_balance_failed; /* initialise to 0 */
+};
+
+/* Common values for SMT siblings */
+#define SD_SIBLING_INIT (struct sched_domain) {		\
+	.span			= CPU_MASK_NONE,	\
+	.parent			= NULL,			\
+	.groups			= NULL,			\
+	.min_interval		= 1,			\
+	.max_interval		= 2,			\
+	.busy_factor		= 8,			\
+	.imbalance_pct		= 110,			\
+	.cache_hot_time		= 0,			\
+	.cache_nice_tries	= 0,			\
+	.per_cpu_gain		= 15,			\
+	.flags			= SD_BALANCE_NEWIDLE	\
+				| SD_BALANCE_EXEC	\
+				| SD_BALANCE_CLONE	\
+				| SD_WAKE_AFFINE	\
+				| SD_WAKE_IDLE		\
+				| SD_SHARE_CPUPOWER,	\
+	.last_balance		= jiffies,		\
+	.balance_interval	= 1,			\
+	.nr_balance_failed	= 0,			\
+}
+
+/* Common values for CPUs */
+#define SD_CPU_INIT (struct sched_domain) {		\
+	.span			= CPU_MASK_NONE,	\
+	.parent			= NULL,			\
+	.groups			= NULL,			\
+	.min_interval		= 1,			\
+	.max_interval		= 4,			\
+	.busy_factor		= 64,			\
+	.imbalance_pct		= 125,			\
+	.cache_hot_time		= (5*1000000/2),	\
+	.cache_nice_tries	= 1,			\
+	.per_cpu_gain		= 100,			\
+	.flags			= SD_BALANCE_NEWIDLE	\
+				| SD_BALANCE_EXEC	\
+				| SD_BALANCE_CLONE	\
+				| SD_WAKE_AFFINE	\
+				| SD_WAKE_BALANCE,	\
+	.last_balance		= jiffies,		\
+	.balance_interval	= 1,			\
+	.nr_balance_failed	= 0,			\
+}
+
+#ifdef CONFIG_NUMA
+/* Common values for NUMA nodes */
+#define SD_NODE_INIT (struct sched_domain) {		\
+	.span			= CPU_MASK_NONE,	\
+	.parent			= NULL,			\
+	.groups			= NULL,			\
+	.min_interval		= 8,			\
+	.max_interval		= 32,			\
+	.busy_factor		= 32,			\
+	.imbalance_pct		= 125,			\
+	.cache_hot_time		= (10*1000000),		\
+	.cache_nice_tries	= 1,			\
+	.per_cpu_gain		= 100,			\
+	.flags			= SD_BALANCE_EXEC	\
+				| SD_BALANCE_CLONE	\
+				| SD_WAKE_BALANCE,	\
+	.last_balance		= jiffies,		\
+	.balance_interval	= 1,			\
+	.nr_balance_failed	= 0,			\
+}
+#endif
+
+extern void cpu_attach_domain(struct sched_domain *sd, int cpu);
+
 extern int set_cpus_allowed(task_t *p, cpumask_t new_mask);
 #else
 static inline int set_cpus_allowed(task_t *p, cpumask_t new_mask)
@@ -552,16 +673,13 @@
 
 extern unsigned long long sched_clock(void);
 
-#ifdef CONFIG_NUMA
+#ifdef CONFIG_SMP
 extern void sched_balance_exec(void);
-extern void node_nr_running_init(void);
 #else
 #define sched_balance_exec()   {}
-#define node_nr_running_init() {}
 #endif
 
-/* Move tasks off this (offline) CPU onto another. */
-extern void migrate_all_tasks(void);
+extern void sched_idle_next(void);
 extern void set_user_nice(task_t *p, long nice);
 extern int task_prio(task_t *p);
 extern int task_nice(task_t *p);
@@ -612,12 +730,17 @@
 
 extern int FASTCALL(wake_up_state(struct task_struct * tsk, unsigned int state));
 extern int FASTCALL(wake_up_process(struct task_struct * tsk));
+extern void FASTCALL(wake_up_forked_process(struct task_struct * tsk));
 #ifdef CONFIG_SMP
  extern void kick_process(struct task_struct *tsk);
+ extern void FASTCALL(wake_up_forked_thread(struct task_struct * tsk));
 #else
  static inline void kick_process(struct task_struct *tsk) { }
+ static inline void wake_up_forked_thread(struct task_struct * tsk)
+ {
+	wake_up_forked_process(tsk);
+ }
 #endif
-extern void FASTCALL(wake_up_forked_process(struct task_struct * tsk));
 extern void FASTCALL(sched_fork(task_t * p));
 extern void FASTCALL(sched_exit(task_t * p));
 
diff -Nru a/include/linux/sdla.h b/include/linux/sdla.h
--- a/include/linux/sdla.h	Tue Jun 15 22:21:05 2004
+++ b/include/linux/sdla.h	Tue Jun 15 22:21:05 2004
@@ -58,7 +58,7 @@
 struct sdla_mem {
    int  addr;
    int  len;
-   void *data;
+   void __user *data;
 };
 
 #define SDLA_START			(FRAD_LAST_IOCTL + 7)
diff -Nru a/include/linux/security.h b/include/linux/security.h
--- a/include/linux/security.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/security.h	Tue Jun 15 22:20:43 2004
@@ -1172,7 +1172,7 @@
 	int (*shm_associate) (struct shmid_kernel * shp, int shmflg);
 	int (*shm_shmctl) (struct shmid_kernel * shp, int cmd);
 	int (*shm_shmat) (struct shmid_kernel * shp, 
-			  char *shmaddr, int shmflg);
+			  char __user *shmaddr, int shmflg);
 
 	int (*sem_alloc_security) (struct sem_array * sma);
 	void (*sem_free_security) (struct sem_array * sma);
diff -Nru a/include/linux/selection.h b/include/linux/selection.h
--- a/include/linux/selection.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/selection.h	Tue Jun 15 22:20:41 2004
@@ -13,9 +13,9 @@
 extern int sel_cons;
 
 extern void clear_selection(void);
-extern int set_selection(const struct tiocl_selection *sel, struct tty_struct *tty, int user);
+extern int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty);
 extern int paste_selection(struct tty_struct *tty);
-extern int sel_loadlut(const unsigned long arg);
+extern int sel_loadlut(char __user *p);
 extern int mouse_reporting(void);
 extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry);
 
diff -Nru a/include/linux/sem.h b/include/linux/sem.h
--- a/include/linux/sem.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/sem.h	Tue Jun 15 22:20:39 2004
@@ -45,10 +45,10 @@
 /* arg for semctl system calls. */
 union semun {
 	int val;			/* value for SETVAL */
-	struct semid_ds *buf;		/* buffer for IPC_STAT & IPC_SET */
-	unsigned short *array;		/* array for GETALL & SETALL */
-	struct seminfo *__buf;		/* buffer for IPC_INFO */
-	void *__pad;
+	struct semid_ds __user *buf;	/* buffer for IPC_STAT & IPC_SET */
+	unsigned short __user *array;	/* array for GETALL & SETALL */
+	struct seminfo __user *__buf;	/* buffer for IPC_INFO */
+	void __user *__pad;
 };
 
 struct  seminfo {
diff -Nru a/include/linux/serial_core.h b/include/linux/serial_core.h
--- a/include/linux/serial_core.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/serial_core.h	Tue Jun 15 22:20:37 2004
@@ -85,6 +85,9 @@
 /* Samsung S3C2410 SoC and derivatives thereof */
 #define PORT_S3C2410    55
 
+/* SGI IP22 aka Indy / Challenge S / Indigo 2 */
+#define PORT_IP22ZILOG	56
+
 #ifdef __KERNEL__
 
 #include <linux/config.h>
diff -Nru a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
--- a/include/linux/shmem_fs.h	Tue Jun 15 22:20:44 2004
+++ b/include/linux/shmem_fs.h	Tue Jun 15 22:20:44 2004
@@ -2,6 +2,7 @@
 #define __SHMEM_FS_H
 
 #include <linux/swap.h>
+#include <linux/mempolicy.h>
 
 /* inode in-kernel data */
 
@@ -15,6 +16,7 @@
 	unsigned long		alloced;    /* data pages allocated to file */
 	unsigned long		swapped;    /* subtotal assigned to swap */
 	unsigned long		flags;
+	struct shared_policy     policy;
 	struct list_head	list;
 	struct inode		vfs_inode;
 };
diff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/skbuff.h	Tue Jun 15 22:20:41 2004
@@ -1014,13 +1014,13 @@
 extern unsigned int    datagram_poll(struct file *file, struct socket *sock,
 				     struct poll_table_struct *wait);
 extern int	       skb_copy_datagram(const struct sk_buff *from,
-					 int offset, char *to, int size);
+					 int offset, char __user *to, int size);
 extern int	       skb_copy_datagram_iovec(const struct sk_buff *from,
 					       int offset, struct iovec *to,
 					       int size);
 extern int	       skb_copy_and_csum_datagram(const struct sk_buff *skb,
-						  int offset, u8 *to, int len,
-						  unsigned int *csump);
+						  int offset, u8 __user *to,
+						  int len, unsigned int *csump);
 extern int	       skb_copy_and_csum_datagram_iovec(const
 							struct sk_buff *skb,
 							int hlen,
diff -Nru a/include/linux/slab.h b/include/linux/slab.h
--- a/include/linux/slab.h	Tue Jun 15 22:21:05 2004
+++ b/include/linux/slab.h	Tue Jun 15 22:21:05 2004
@@ -44,6 +44,7 @@
 #define SLAB_STORE_USER		0x00010000UL	/* store the last owner for bug hunting */
 #define SLAB_RECLAIM_ACCOUNT	0x00020000UL	/* track pages allocated to indicate
 						   what is reclaimable later*/
+#define SLAB_PANIC		0x00040000UL	/* panic if kmem_cache_create() fails */
 
 /* flags passed to a constructor func */
 #define	SLAB_CTOR_CONSTRUCTOR	0x001UL		/* if not set, then deconstructor */
@@ -60,6 +61,7 @@
 extern int kmem_cache_destroy(kmem_cache_t *);
 extern int kmem_cache_shrink(kmem_cache_t *);
 extern void *kmem_cache_alloc(kmem_cache_t *, int);
+extern void *kmem_cache_alloc_node(kmem_cache_t *, int);
 extern void kmem_cache_free(kmem_cache_t *, void *);
 extern unsigned int kmem_cache_size(kmem_cache_t *);
 
diff -Nru a/include/linux/sockios.h b/include/linux/sockios.h
--- a/include/linux/sockios.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/sockios.h	Tue Jun 15 22:20:36 2004
@@ -116,6 +116,12 @@
 #define SIOCBONDINFOQUERY      0x8994	/* rtn info about bond state    */
 #define SIOCBONDCHANGEACTIVE   0x8995   /* update to a new active slave */
 			
+/* bridge calls */
+#define SIOCBRADDBR     0x89a0		/* create new bridge device     */
+#define SIOCBRDELBR     0x89a1		/* remove bridge device         */
+#define SIOCBRADDIF	0x89a2		/* add interface to bridge      */
+#define SIOCBRDELIF	0x89a3		/* remove interface from bridge */
+
 /* Device private ioctl calls */
 
 /*
diff -Nru a/include/linux/spinlock.h b/include/linux/spinlock.h
--- a/include/linux/spinlock.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/spinlock.h	Tue Jun 15 22:20:40 2004
@@ -40,6 +40,8 @@
 
 #else
 
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
+
 #if !defined(CONFIG_PREEMPT) && !defined(CONFIG_DEBUG_SPINLOCK)
 # define atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic)
 # define ATOMIC_DEC_AND_LOCK
@@ -257,7 +259,7 @@
 do { \
 	local_irq_save(flags); \
 	preempt_disable(); \
-	_raw_spin_lock(lock); \
+	_raw_spin_lock_flags(lock, flags); \
 } while (0)
 
 #define spin_lock_irq(lock) \
diff -Nru a/include/linux/stat.h b/include/linux/stat.h
--- a/include/linux/stat.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/stat.h	Tue Jun 15 22:20:39 2004
@@ -60,7 +60,7 @@
 	unsigned long	ino;
 	dev_t		dev;
 	umode_t		mode;
-	nlink_t		nlink;
+	unsigned int	nlink;
 	uid_t		uid;
 	gid_t		gid;
 	dev_t		rdev;
diff -Nru a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
--- a/include/linux/sunrpc/cache.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/sunrpc/cache.h	Tue Jun 15 22:20:41 2004
@@ -97,7 +97,9 @@
 	struct proc_dir_entry   *flush_ent, *channel_ent, *content_ent;
 
 	atomic_t		readers;		/* how many time is /chennel open */
-	time_t			last_close;		/* it no readers, when did last close */
+	time_t			last_close;		/* if no readers, when did last close */
+	time_t			last_warn;		/* when we last warned about no readers */
+	void			(*warn_no_listener)(struct cache_detail *cd);
 };
 
 
@@ -193,8 +195,11 @@
 					t2 = tmp; tmp = new; new = t2;			\
 				}							\
 				if (test_bit(CACHE_NEGATIVE,  &item->MEMBER.flags))	\
-					 set_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags);	\
-				else {UPDATE;}						\
+					set_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags);	\
+				else {							\
+					UPDATE;						\
+					clear_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags);	\
+				}							\
 			}								\
 			if (set||new) write_unlock(&(DETAIL)->hash_lock);		\
 			else read_unlock(&(DETAIL)->hash_lock);				\
diff -Nru a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
--- a/include/linux/sunrpc/gss_api.h	Tue Jun 15 22:21:02 2004
+++ b/include/linux/sunrpc/gss_api.h	Tue Jun 15 22:21:02 2004
@@ -50,46 +50,36 @@
 u32 gss_delete_sec_context(
 		struct gss_ctx		**ctx_id);
 
-/* We maintain a list of the pseudoflavors (equivalently, mechanism-qop-service
- * triples) that we currently support: */
-
-struct sup_sec_triple {
-	struct list_head	triples;
-	u32			pseudoflavor;
-	struct gss_api_mech	*mech;
-	u32			qop;
-	u32			service;
+struct gss_api_mech * gss_mech_get_by_name(char *name);
+struct gss_api_mech * gss_mech_get_by_pseudoflavor(u32 pseudoflavor);
+u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
+char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
+
+struct pf_desc {
+	u32	pseudoflavor;
+	u32	qop;
+	u32	service;
+	char	*name;
+	char	*auth_domain_name;
 };
 
-int gss_register_triple(u32 pseudoflavor, struct gss_api_mech *mech, u32 qop,
-			u32 service);
-int gss_unregister_triple(u32 pseudoflavor);
-int gss_pseudoflavor_supported(u32 pseudoflavor);
-u32 gss_cmp_triples(u32 oid_len, char *oid_data, u32 qop, u32 service);
-u32 gss_get_pseudoflavor(struct gss_ctx *ctx_id, u32 qop, u32 service);
-u32 gss_pseudoflavor_to_service(u32 pseudoflavor);
-/* Both return NULL on failure: */
-struct gss_api_mech * gss_pseudoflavor_to_mech(u32 pseudoflavor);
-int gss_pseudoflavor_to_mechOID(u32 pseudoflavor, struct xdr_netobj *mech);
-
 /* Different mechanisms (e.g., krb5 or spkm3) may implement gss-api, and
- * mechanisms may be dynamically registered or unregistered by modules.
- * Our only built-in mechanism is a trivial debugging mechanism that provides
- * no actual security; the following function registers that mechanism: */
-
-void gss_mech_register_debug(void);
+ * mechanisms may be dynamically registered or unregistered by modules. */
 
 /* Each mechanism is described by the following struct: */
 struct gss_api_mech {
-	struct xdr_netobj	gm_oid;
 	struct list_head	gm_list;
-	atomic_t		gm_count;
+	struct module		*gm_owner;
+	struct xdr_netobj	gm_oid;
+	char			*gm_name;
 	struct gss_api_ops	*gm_ops;
+	/* pseudoflavors supported by this mechanism: */
+	int			gm_pf_num;
+	struct pf_desc *	gm_pfs;
 };
 
 /* and must provide the following operations: */
 struct gss_api_ops {
-	char *name;
 	u32 (*gss_import_sec_context)(
 			struct xdr_netobj	*input_token,
 			struct gss_ctx		*ctx_id);
@@ -107,29 +97,25 @@
 			void			*internal_ctx_id);
 };
 
-/* Returns nonzero on failure. */
-int gss_mech_register(struct xdr_netobj *, struct gss_api_ops *);
-
-/* Returns nonzero iff someone still has a reference to this mech. */
-int gss_mech_unregister(struct gss_api_mech *);
+int gss_mech_register(struct gss_api_mech *);
+void gss_mech_unregister(struct gss_api_mech *);
 
-/* Returns nonzer iff someone still has a reference to some mech. */
-int gss_mech_unregister_all(void);
-
-/* returns a mechanism descriptor given an OID, an increments the mechanism's
+/* returns a mechanism descriptor given an OID, and increments the mechanism's
  * reference count. */
 struct gss_api_mech * gss_mech_get_by_OID(struct xdr_netobj *);
 
-/* Similar, but get by name like "krb5", "spkm", etc., instead of OID. */
+/* Returns a reference to a mechanism, given a name like "krb5" etc. */
 struct gss_api_mech *gss_mech_get_by_name(char *);
 
+/* Similar, but get by pseudoflavor. */
+struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
+
 /* Just increments the mechanism's reference count and returns its input: */
 struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
 
-/* Returns nonzero iff you've released the last reference to this mech.
- * Note that for every succesful gss_get_mech call there must be exactly
- * one corresponding call to gss_mech_put.*/
-int gss_mech_put(struct gss_api_mech *);
+/* For every succesful gss_mech_get or gss_mech_get_by_* call there must be a
+ * corresponding call to gss_mech_put. */
+void gss_mech_put(struct gss_api_mech *);
 
 #endif /* __KERNEL__ */
 #endif /* _LINUX_SUNRPC_GSS_API_H */
diff -Nru a/include/linux/sunrpc/gss_asn1.h b/include/linux/sunrpc/gss_asn1.h
--- a/include/linux/sunrpc/gss_asn1.h	Tue Jun 15 22:21:03 2004
+++ b/include/linux/sunrpc/gss_asn1.h	Tue Jun 15 22:21:03 2004
@@ -81,5 +81,4 @@
 void g_make_token_header(
      struct xdr_netobj *mech,
      int body_size,
-     unsigned char **buf,
-     int tok_type);
+     unsigned char **buf);
diff -Nru a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
--- a/include/linux/sunrpc/gss_krb5.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/sunrpc/gss_krb5.h	Tue Jun 15 22:20:41 2004
@@ -115,7 +115,7 @@
 #define ENCTYPE_UNKNOWN         0x01ff
 
 s32
-krb5_make_checksum(s32 cksumtype, char *header, struct xdr_buf *body,
+make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
 		   struct xdr_netobj *cksum);
 
 u32
diff -Nru a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
--- a/include/linux/sunrpc/svcauth.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/sunrpc/svcauth.h	Tue Jun 15 22:20:39 2004
@@ -87,6 +87,7 @@
  */
 struct auth_ops {
 	char *	name;
+	struct module *owner;
 	int	flavour;
 	int	(*accept)(struct svc_rqst *rq, u32 *authp);
 	int	(*release)(struct svc_rqst *rq);
diff -Nru a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
--- a/include/linux/sunrpc/xprt.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/sunrpc/xprt.h	Tue Jun 15 22:20:43 2004
@@ -69,8 +69,7 @@
  * This describes a timeout strategy
  */
 struct rpc_timeout {
-	unsigned long		to_current,		/* current timeout */
-				to_initval,		/* initial timeout */
+	unsigned long		to_initval,		/* initial timeout */
 				to_maxval,		/* max timeout */
 				to_increment;		/* if !exponential */
 	unsigned int		to_retries;		/* max # of retries */
@@ -85,7 +84,6 @@
 	 * This is the user-visible part
 	 */
 	struct rpc_xprt *	rq_xprt;		/* RPC client */
-	struct rpc_timeout	rq_timeout;		/* timeout parms */
 	struct xdr_buf		rq_snd_buf;		/* send buffer */
 	struct xdr_buf		rq_rcv_buf;		/* recv buffer */
 
@@ -103,6 +101,9 @@
 	struct xdr_buf		rq_private_buf;		/* The receive buffer
 							 * used in the softirq.
 							 */
+	unsigned long		rq_majortimeo;	/* major timeout alarm */
+	unsigned long		rq_timeout;	/* Current timeout value */
+	unsigned int		rq_retries;	/* # of retries */
 	/*
 	 * For authentication (e.g. auth_des)
 	 */
@@ -115,7 +116,6 @@
 	u32			rq_bytes_sent;	/* Bytes we have sent */
 
 	unsigned long		rq_xtime;	/* when transmitted */
-	int			rq_ntimeo;
 	int			rq_ntrans;
 };
 #define rq_svec			rq_snd_buf.head
@@ -210,7 +210,7 @@
 int			xprt_prepare_transmit(struct rpc_task *);
 void			xprt_transmit(struct rpc_task *);
 void			xprt_receive(struct rpc_task *);
-int			xprt_adjust_timeout(struct rpc_timeout *);
+int			xprt_adjust_timeout(struct rpc_rqst *req);
 void			xprt_release(struct rpc_task *);
 void			xprt_connect(struct rpc_task *);
 int			xprt_clear_backlog(struct rpc_xprt *);
diff -Nru a/include/linux/swap.h b/include/linux/swap.h
--- a/include/linux/swap.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/swap.h	Tue Jun 15 22:20:36 2004
@@ -151,7 +151,7 @@
 extern void out_of_memory(void);
 
 /* linux/mm/memory.c */
-extern void swapin_readahead(swp_entry_t);
+extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
 
 /* linux/mm/page_alloc.c */
 extern unsigned long totalram_pages;
@@ -181,6 +181,8 @@
 extern int shmem_unuse(swp_entry_t entry, struct page *page);
 #endif /* CONFIG_MMU */
 
+extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
+
 #ifdef CONFIG_SWAP
 /* linux/mm/page_io.c */
 extern int swap_readpage(struct file *, struct page *);
@@ -200,7 +202,8 @@
 extern void free_page_and_swap_cache(struct page *);
 extern void free_pages_and_swap_cache(struct page **, int);
 extern struct page * lookup_swap_cache(swp_entry_t);
-extern struct page * read_swap_cache_async(swp_entry_t);
+extern struct page * read_swap_cache_async(swp_entry_t, struct vm_area_struct *vma,
+					   unsigned long addr);
 
 /* linux/mm/swapfile.c */
 extern int total_swap_pages;
@@ -216,7 +219,7 @@
 extern struct swap_info_struct *get_swap_info_struct(unsigned);
 extern int can_share_swap_page(struct page *);
 extern int remove_exclusive_swap_page(struct page *);
-extern void swap_unplug_io_fn(struct page *);
+struct backing_dev_info;
 
 extern struct swap_list_t swap_list;
 extern spinlock_t swaplock;
@@ -242,7 +245,7 @@
 #define free_swap_and_cache(swp)		/*NOTHING*/
 #define swap_duplicate(swp)			/*NOTHING*/
 #define swap_free(swp)				/*NOTHING*/
-#define read_swap_cache_async(swp)		NULL
+#define read_swap_cache_async(swp,vma,addr)	NULL
 #define lookup_swap_cache(swp)			NULL
 #define valid_swaphandles(swp, off)		0
 #define can_share_swap_page(p)			0
@@ -250,7 +253,6 @@
 #define move_from_swap_cache(p, i, m)		1
 #define __delete_from_swap_cache(p)		/*NOTHING*/
 #define delete_from_swap_cache(p)		/*NOTHING*/
-#define swap_unplug_io_fn(p)			/*NOTHING*/
 
 static inline int remove_exclusive_swap_page(struct page *p)
 {
diff -Nru a/include/linux/syscalls.h b/include/linux/syscalls.h
--- a/include/linux/syscalls.h	Tue Jun 15 22:21:05 2004
+++ b/include/linux/syscalls.h	Tue Jun 15 22:21:05 2004
@@ -19,6 +19,7 @@
 struct iovec;
 struct itimerspec;
 struct itimerval;
+struct kexec_segment;
 struct linux_dirent;
 struct linux_dirent64;
 struct list_head;
@@ -154,15 +155,18 @@
 asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd,
 				void __user *arg);
 asmlinkage long sys_restart_syscall(void);
+asmlinkage long sys_kexec_load(void *entry, unsigned long nr_segments,
+			struct kexec_segment *segments, unsigned long flags);
 
 asmlinkage long sys_exit(int error_code);
 asmlinkage void sys_exit_group(int error_code);
-asmlinkage long sys_wait4(pid_t pid, unsigned int *stat_addr,
+asmlinkage long sys_wait4(pid_t pid, unsigned int __user *stat_addr,
 				int options, struct rusage __user *ru);
 asmlinkage long sys_waitpid(pid_t pid, unsigned int __user *stat_addr, int options);
 asmlinkage long sys_set_tid_address(int __user *tidptr);
 asmlinkage long sys_futex(u32 __user *uaddr, int op, int val,
-			struct timespec __user *utime, u32 __user *uaddr2);
+			struct timespec __user *utime, u32 __user *uaddr2,
+			int val3);
 
 asmlinkage long sys_init_module(void __user *umod, unsigned long len,
 				const char __user *uargs);
@@ -253,7 +257,7 @@
 asmlinkage unsigned long sys_mremap(unsigned long addr,
 				unsigned long old_len, unsigned long new_len,
 				unsigned long flags, unsigned long new_addr);
-long sys_remap_file_pages(unsigned long start, unsigned long size,
+asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
 			unsigned long prot, unsigned long pgoff,
 			unsigned long flags);
 asmlinkage long sys_msync(unsigned long start, size_t len, int flags);
diff -Nru a/include/linux/sysctl.h b/include/linux/sysctl.h
--- a/include/linux/sysctl.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/sysctl.h	Tue Jun 15 22:20:41 2004
@@ -163,6 +163,7 @@
 	VM_MAX_MAP_COUNT=22,	/* int: Maximum number of mmaps/address-space */
 	VM_LAPTOP_MODE=23,	/* vm laptop mode */
 	VM_BLOCK_DUMP=24,	/* block dump mode */
+	VM_HUGETLB_GROUP=25,	/* permitted hugetlb group */
 };
 
 
@@ -335,6 +336,8 @@
  	NET_TCP_BIC=102,
  	NET_TCP_BIC_FAST_CONVERGENCE=103,
 	NET_TCP_BIC_LOW_WINDOW=104,
+	NET_TCP_DEFAULT_WIN_SCALE=105,
+	NET_TCP_MODERATE_RCVBUF=106,
 };
 
 enum {
diff -Nru a/include/linux/sysfs.h b/include/linux/sysfs.h
--- a/include/linux/sysfs.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/sysfs.h	Tue Jun 15 22:20:39 2004
@@ -44,7 +44,7 @@
 extern void
 sysfs_remove_dir(struct kobject *);
 
-extern void
+extern int
 sysfs_rename_dir(struct kobject *, const char *new_name);
 
 extern int
@@ -80,9 +80,9 @@
 	;
 }
 
-static inline void sysfs_rename_dir(struct kobject * k, const char *new_name)
+static inline int sysfs_rename_dir(struct kobject * k, const char *new_name)
 {
-	;
+	return 0;
 }
 
 static inline int sysfs_create_file(struct kobject * k, const struct attribute * a)
diff -Nru a/include/linux/sysrq.h b/include/linux/sysrq.h
--- a/include/linux/sysrq.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/sysrq.h	Tue Jun 15 22:20:36 2004
@@ -30,13 +30,7 @@
  */
 
 void handle_sysrq(int, struct pt_regs *, struct tty_struct *);
-
-/* 
- * Nonlocking version of handle sysrq, used by sysrq handlers that need to
- * call sysrq handlers
- */
-
-void __handle_sysrq_nolock(int, struct pt_regs *, struct tty_struct *);
+void __handle_sysrq(int, struct pt_regs *, struct tty_struct *);
 
 /*
  * Sysrq registration manipulation functions
diff -Nru a/include/linux/tcp.h b/include/linux/tcp.h
--- a/include/linux/tcp.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/tcp.h	Tue Jun 15 22:20:40 2004
@@ -183,6 +183,9 @@
 	__u32	tcpi_snd_cwnd;
 	__u32	tcpi_advmss;
 	__u32	tcpi_reordering;
+
+	__u32	tcpi_rcv_rtt;
+	__u32	tcpi_rcv_space;
 };
 
 #ifdef __KERNEL__
@@ -351,11 +354,11 @@
 	__u8	urg_mode;	/* In urgent mode		*/
 	__u32	snd_up;		/* Urgent pointer		*/
 
-	/* The syn_wait_lock is necessary only to avoid tcp_get_info having
+	/* The syn_wait_lock is necessary only to avoid proc interface having
 	 * to grab the main lock sock while browsing the listening hash
 	 * (otherwise it's deadlock prone).
-	 * This lock is acquired in read mode only from tcp_get_info() and
-	 * it's acquired in write mode _only_ from code that is actively
+	 * This lock is acquired in read mode only from listening_get_next()
+	 * and it's acquired in write mode _only_ from code that is actively
 	 * changing the syn_wait_queue. All readers that are holding
 	 * the master sock lock don't need to grab this lock in read mode
 	 * too as the syn_wait_queue writes are always protected from
@@ -375,6 +378,20 @@
 	int			linger2;
 
 	unsigned long last_synq_overflow; 
+
+/* Receiver side RTT estimation */
+	struct {
+		__u32	rtt;
+		__u32	seq;
+		__u32	time;
+	} rcv_rtt_est;
+
+/* Receiver queue space */
+	struct {
+		int	space;
+		__u32	seq;
+		__u32	time;
+	} rcvq_space;
 
 /* TCP Westwood structure */
         struct {
diff -Nru a/include/linux/time.h b/include/linux/time.h
--- a/include/linux/time.h	Tue Jun 15 22:20:42 2004
+++ b/include/linux/time.h	Tue Jun 15 22:20:42 2004
@@ -177,6 +177,34 @@
 	(SH_DIV((MAX_JIFFY_OFFSET >> SEC_JIFFIE_SC) * TICK_NSEC, NSEC_PER_SEC, 1) - 1)
 
 #endif
+
+/*
+ * Convert jiffies to milliseconds and back.
+ *
+ * Avoid unnecessary multiplications/divisions in the
+ * two most common HZ cases:
+ */
+static inline unsigned int jiffies_to_msecs(const unsigned long j)
+{
+#if HZ <= 1000 && !(1000 % HZ)
+	return (1000 / HZ) * j;
+#elif HZ > 1000 && !(HZ % 1000)
+	return (j + (HZ / 1000) - 1)/(HZ / 1000);
+#else
+	return (j * 1000) / HZ;
+#endif
+}
+static inline unsigned long msecs_to_jiffies(const unsigned int m)
+{
+#if HZ <= 1000 && !(1000 % HZ)
+	return (m + (1000 / HZ) - 1) / (1000 / HZ);
+#elif HZ > 1000 && !(HZ % 1000)
+	return m * (HZ / 1000);
+#else
+	return (m * HZ + 999) / 1000;
+#endif
+}
+
 /*
  * The TICK_NSEC - 1 rounds up the value to the next resolution.  Note
  * that a remainder subtract here would not do the right thing as the
@@ -189,7 +217,7 @@
  * value to a scaled second value.
  */
 static __inline__ unsigned long
-timespec_to_jiffies(struct timespec *value)
+timespec_to_jiffies(const struct timespec *value)
 {
 	unsigned long sec = value->tv_sec;
 	long nsec = value->tv_nsec + TICK_NSEC - 1;
@@ -205,7 +233,7 @@
 }
 
 static __inline__ void
-jiffies_to_timespec(unsigned long jiffies, struct timespec *value)
+jiffies_to_timespec(const unsigned long jiffies, struct timespec *value)
 {
 	/*
 	 * Convert jiffies to nanoseconds and separate with
@@ -228,7 +256,7 @@
  * instruction above the way it was done above.
  */
 static __inline__ unsigned long
-timeval_to_jiffies(struct timeval *value)
+timeval_to_jiffies(const struct timeval *value)
 {
 	unsigned long sec = value->tv_sec;
 	long usec = value->tv_usec;
@@ -243,7 +271,7 @@
 }
 
 static __inline__ void
-jiffies_to_timeval(unsigned long jiffies, struct timeval *value)
+jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
 {
 	/*
 	 * Convert jiffies to nanoseconds and separate with
diff -Nru a/include/linux/timer.h b/include/linux/timer.h
--- a/include/linux/timer.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/timer.h	Tue Jun 15 22:20:43 2004
@@ -4,6 +4,7 @@
 #include <linux/config.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
+#include <linux/stddef.h>
 
 struct tvec_t_base_s;
 
@@ -87,9 +88,11 @@
 }
 
 #ifdef CONFIG_SMP
-  extern int del_timer_sync(struct timer_list * timer);
+  extern int del_timer_sync(struct timer_list *timer);
+  extern int del_singleshot_timer_sync(struct timer_list *timer);
 #else
 # define del_timer_sync(t) del_timer(t)
+# define del_singleshot_timer_sync(t) del_timer(t)
 #endif
 
 extern void init_timers(void);
diff -Nru a/include/linux/times.h b/include/linux/times.h
--- a/include/linux/times.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/times.h	Tue Jun 15 22:20:36 2004
@@ -2,15 +2,21 @@
 #define _LINUX_TIMES_H
 
 #ifdef __KERNEL__
+#include <linux/timex.h>
 #include <asm/div64.h>
 #include <asm/types.h>
 #include <asm/param.h>
 
-#if (HZ % USER_HZ)==0
-# define jiffies_to_clock_t(x) ((x) / (HZ / USER_HZ))
+static inline clock_t jiffies_to_clock_t(long x)
+{
+#if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0
+	return x / (HZ / USER_HZ);
 #else
-# define jiffies_to_clock_t(x) ((clock_t) jiffies_64_to_clock_t((u64) x))
+	u64 tmp = (u64)x * TICK_NSEC;
+	do_div(tmp, (NSEC_PER_SEC / USER_HZ));
+	return (long)tmp;
 #endif
+}
 
 static inline unsigned long clock_t_to_jiffies(unsigned long x)
 {
@@ -34,7 +40,7 @@
 
 static inline u64 jiffies_64_to_clock_t(u64 x)
 {
-#if (HZ % USER_HZ)==0
+#if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0
 	do_div(x, HZ / USER_HZ);
 #else
 	/*
@@ -42,8 +48,8 @@
 	 * but even this doesn't overflow in hundreds of years
 	 * in 64 bits, so..
 	 */
-	x *= USER_HZ;
-	do_div(x, HZ);
+	x *= TICK_NSEC;
+	do_div(x, (NSEC_PER_SEC / USER_HZ));
 #endif
 	return x;
 }
diff -Nru a/include/linux/tty.h b/include/linux/tty.h
--- a/include/linux/tty.h	Tue Jun 15 22:20:40 2004
+++ b/include/linux/tty.h	Tue Jun 15 22:20:40 2004
@@ -97,7 +97,6 @@
 
 #define VIDEO_TYPE_PICA_S3	0x30	/* ACER PICA-61 local S3 video	*/
 #define VIDEO_TYPE_MIPS_G364	0x31    /* MIPS Magnum 4000 G364 video  */
-#define VIDEO_TYPE_SNI_RM	0x32    /* SNI RM200 PCI video          */
 #define VIDEO_TYPE_SGI          0x33    /* Various SGI graphics hardware */
 
 #define VIDEO_TYPE_TGAC		0x40	/* DEC TGA */
diff -Nru a/include/linux/tty_driver.h b/include/linux/tty_driver.h
--- a/include/linux/tty_driver.h	Tue Jun 15 22:20:42 2004
+++ b/include/linux/tty_driver.h	Tue Jun 15 22:20:42 2004
@@ -145,7 +145,7 @@
 	void (*send_xchar)(struct tty_struct *tty, char ch);
 	int (*read_proc)(char *page, char **start, off_t off,
 			  int count, int *eof, void *data);
-	int (*write_proc)(struct file *file, const char *buffer,
+	int (*write_proc)(struct file *file, const char __user *buffer,
 			  unsigned long count, void *data);
 	int (*tiocmget)(struct tty_struct *tty, struct file *file);
 	int (*tiocmset)(struct tty_struct *tty, struct file *file,
@@ -207,7 +207,7 @@
 	void (*send_xchar)(struct tty_struct *tty, char ch);
 	int (*read_proc)(char *page, char **start, off_t off,
 			  int count, int *eof, void *data);
-	int (*write_proc)(struct file *file, const char *buffer,
+	int (*write_proc)(struct file *file, const char __user *buffer,
 			  unsigned long count, void *data);
 	int (*tiocmget)(struct tty_struct *tty, struct file *file);
 	int (*tiocmset)(struct tty_struct *tty, struct file *file,
diff -Nru a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
--- a/include/linux/tty_ldisc.h	Tue Jun 15 22:21:05 2004
+++ b/include/linux/tty_ldisc.h	Tue Jun 15 22:21:05 2004
@@ -114,9 +114,9 @@
 	void	(*flush_buffer)(struct tty_struct *tty);
 	ssize_t	(*chars_in_buffer)(struct tty_struct *tty);
 	ssize_t	(*read)(struct tty_struct * tty, struct file * file,
-			unsigned char * buf, size_t nr);
+			unsigned char __user * buf, size_t nr);
 	ssize_t	(*write)(struct tty_struct * tty, struct file * file,
-			 const unsigned char * buf, size_t nr);	
+			 const unsigned char __user * buf, size_t nr);	
 	int	(*ioctl)(struct tty_struct * tty, struct file * file,
 			 unsigned int cmd, unsigned long arg);
 	void	(*set_termios)(struct tty_struct *tty, struct termios * old);
diff -Nru a/include/linux/udf_fs.h b/include/linux/udf_fs.h
--- a/include/linux/udf_fs.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/udf_fs.h	Tue Jun 15 22:20:37 2004
@@ -40,7 +40,7 @@
 #define UDFFS_DATE			"2004/29/09"
 #define UDFFS_VERSION			"0.9.8.1"
 
-#define UDFFS_DEBUG
+#undef UDFFS_DEBUG
 
 #ifdef UDFFS_DEBUG
 #define udf_debug(f, a...) \
diff -Nru a/include/linux/usb.h b/include/linux/usb.h
--- a/include/linux/usb.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/usb.h	Tue Jun 15 22:20:39 2004
@@ -14,22 +14,12 @@
 #include <linux/delay.h>	/* for mdelay() */
 #include <linux/interrupt.h>	/* for in_interrupt() */
 #include <linux/list.h>		/* for struct list_head */
+#include <linux/kref.h>		/* for struct kref */
 #include <linux/device.h>	/* for struct device */
 #include <linux/fs.h>		/* for struct file_operations */
 #include <linux/completion.h>	/* for struct completion */
 #include <linux/sched.h>	/* for current && schedule_timeout */
 
-
-static __inline__ void wait_ms(unsigned int ms)
-{
-	if(!in_interrupt()) {
-		current->state = TASK_UNINTERRUPTIBLE;
-		schedule_timeout(1 + ms * HZ / 1000);
-	}
-	else
-		mdelay(ms);
-}
-
 struct usb_device;
 struct usb_driver;
 
@@ -147,11 +137,42 @@
 #define USB_MAXINTERFACES	32
 
 /**
+ * struct usb_interface_cache - long-term representation of a device interface
+ * @num_altsetting: number of altsettings defined.
+ * @ref: reference counter.
+ * @altsetting: variable-length array of interface structures, one for
+ *	each alternate setting that may be selected.  Each one includes a
+ *	set of endpoint configurations.  They will be in no particular order.
+ *
+ * These structures persist for the lifetime of a usb_device, unlike
+ * struct usb_interface (which persists only as long as its configuration
+ * is installed).  The altsetting arrays can be accessed through these
+ * structures at any time, permitting comparison of configurations and
+ * providing support for the /proc/bus/usb/devices pseudo-file.
+ */
+struct usb_interface_cache {
+	unsigned num_altsetting;	/* number of alternate settings */
+	struct kref ref;		/* reference counter */
+
+	/* variable-length array of alternate settings for this interface,
+	 * stored in no particular order */
+	struct usb_host_interface altsetting[0];
+};
+#define	ref_to_usb_interface_cache(r) \
+		container_of(r, struct usb_interface_cache, ref)
+#define	altsetting_to_usb_interface_cache(a) \
+		container_of(a, struct usb_interface_cache, altsetting[0])
+
+/**
  * struct usb_host_config - representation of a device's configuration
  * @desc: the device's configuration descriptor.
- * @interface: array of usb_interface structures, one for each interface
- *	in the configuration.  The number of interfaces is stored in
- *	desc.bNumInterfaces.
+ * @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
+ *	the configuration is active.
+ * @intf_cache: array of pointers to usb_interface_cache structures, one
+ *	for each interface in the configuration.  These structures exist
+ *	for the entire life of the device.
  * @extra: pointer to buffer containing all extra descriptors associated
  *	with this configuration (those preceding the first interface
  *	descriptor).
@@ -185,6 +206,10 @@
 	 * stored in no particular order */
 	struct usb_interface *interface[USB_MAXINTERFACES];
 
+	/* Interface information available even when this is not the
+	 * active configuration */
+	struct usb_interface_cache *intf_cache[USB_MAXINTERFACES];
+
 	unsigned char *extra;   /* Extra descriptors */
 	int extralen;
 };
@@ -309,6 +334,7 @@
 
 /* mostly for devices emulating SCSI over USB */
 extern int usb_reset_device(struct usb_device *dev);
+extern int __usb_reset_device(struct usb_device *dev);
 
 extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
 
@@ -676,7 +702,7 @@
  * URB_NO_SETUP_DMA_MAP indicate which buffers have already been mapped.
  * URB_NO_SETUP_DMA_MAP is ignored for non-control URBs.
  *
- * Interrupt UBS must provide an interval, saying how often (in milliseconds
+ * Interrupt URBs must provide an interval, saying how often (in milliseconds
  * or, for highspeed devices, 125 microsecond units)
  * to poll for transfers.  After the URB has been submitted, the interval
  * field reflects how the transfer was actually scheduled.
@@ -731,8 +757,8 @@
 struct urb
 {
 	/* private, usb core and host controller only fields in the urb */
+	struct kref kref;		/* reference count of the URB */
 	spinlock_t lock;		/* lock for the URB */
-	atomic_t count;			/* reference count of the URB */
 	void *hcpriv;			/* private data for host controller */
 	struct list_head urb_list;	/* list pointer to all active urbs */
 	int bandwidth;			/* bandwidth for INT/ISO request */
diff -Nru a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
--- a/include/linux/usbdevice_fs.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/usbdevice_fs.h	Tue Jun 15 22:20:37 2004
@@ -154,7 +154,6 @@
 
 struct dev_state {
 	struct list_head list;      /* state list */
-	struct rw_semaphore devsem; /* protects modifications to dev (dev == NULL indicating disconnect) */ 
 	struct usb_device *dev;
 	struct file *file;
 	spinlock_t lock;            /* protects the async urb lists */
diff -Nru a/include/linux/video_decoder.h b/include/linux/video_decoder.h
--- a/include/linux/video_decoder.h	Tue Jun 15 22:20:36 2004
+++ b/include/linux/video_decoder.h	Tue Jun 15 22:20:36 2004
@@ -22,6 +22,10 @@
 #define	DECODER_STATUS_NTSC	8	/* auto detected */
 #define	DECODER_STATUS_SECAM	16	/* auto detected */
 
+struct video_decoder_init {
+	unsigned char len;
+	const unsigned char *data;
+};
 
 #define	DECODER_GET_CAPABILITIES _IOR('d', 1, struct video_decoder_capability)
 #define	DECODER_GET_STATUS    	_IOR('d', 2, int)
@@ -30,6 +34,9 @@
 #define	DECODER_SET_OUTPUT	_IOW('d', 5, int)	/* 0 <= output < #outputs */
 #define	DECODER_ENABLE_OUTPUT	_IOW('d', 6, int)	/* boolean output enable control */
 #define	DECODER_SET_PICTURE   	_IOW('d', 7, struct video_picture)
+#define	DECODER_SET_GPIO	_IOW('d', 8, int)	/* switch general purpose pin */
+#define	DECODER_INIT		_IOW('d', 9, struct video_decoder_init)	/* init internal registers at once */
+#define	DECODER_SET_VBI_BYPASS	_IOW('d', 10, int)	/* switch vbi bypass */
 
 #define	DECODER_DUMP		_IO('d', 192)		/* debug hook */
 
diff -Nru a/include/linux/vt_kern.h b/include/linux/vt_kern.h
--- a/include/linux/vt_kern.h	Tue Jun 15 22:20:44 2004
+++ b/include/linux/vt_kern.h	Tue Jun 15 22:20:44 2004
@@ -49,8 +49,8 @@
 void unblank_screen(void);
 void poke_blanked_console(void);
 int con_font_op(int currcons, struct console_font_op *op);
-int con_set_cmap(unsigned char *cmap);
-int con_get_cmap(unsigned char *cmap);
+int con_set_cmap(unsigned char __user *cmap);
+int con_get_cmap(unsigned char __user *cmap);
 void scrollback(int);
 void scrollfront(int);
 void update_region(int currcons, unsigned long start, int count);
@@ -66,13 +66,13 @@
 struct unimapinit;
 struct unipair;
 
-int con_set_trans_old(unsigned char * table);
-int con_get_trans_old(unsigned char * table);
-int con_set_trans_new(unsigned short * table);
-int con_get_trans_new(unsigned short * table);
+int con_set_trans_old(unsigned char __user * table);
+int con_get_trans_old(unsigned char __user * table);
+int con_set_trans_new(unsigned short __user * table);
+int con_get_trans_new(unsigned short __user * table);
 int con_clear_unimap(int currcons, struct unimapinit *ui);
-int con_set_unimap(int currcons, ushort ct, struct unipair *list);
-int con_get_unimap(int currcons, ushort ct, ushort *uct, struct unipair *list);
+int con_set_unimap(int currcons, ushort ct, struct unipair __user *list);
+int con_get_unimap(int currcons, ushort ct, ushort __user *uct, struct unipair __user *list);
 int con_set_default_unimap(int currcons);
 void con_free_unimap(int currcons);
 void con_protect_unimap(int currcons, int rdonly);
diff -Nru a/include/linux/wait.h b/include/linux/wait.h
--- a/include/linux/wait.h	Tue Jun 15 22:20:41 2004
+++ b/include/linux/wait.h	Tue Jun 15 22:20:41 2004
@@ -17,8 +17,8 @@
 #include <asm/system.h>
 
 typedef struct __wait_queue wait_queue_t;
-typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int sync);
-extern int default_wake_function(wait_queue_t *wait, unsigned mode, int sync);
+typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int sync, void *key);
+int default_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
 
 struct __wait_queue {
 	unsigned int flags;
@@ -104,17 +104,17 @@
 	list_del(&old->task_list);
 }
 
-extern void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr));
+void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key));
 extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode));
 extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr));
 
-#define wake_up(x)			__wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1)
-#define wake_up_nr(x, nr)		__wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr)
-#define wake_up_all(x)			__wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0)
+#define wake_up(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL)
+#define wake_up_nr(x, nr)		__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL)
+#define wake_up_all(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL)
 #define wake_up_all_sync(x)			__wake_up_sync((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0)
-#define wake_up_interruptible(x)	__wake_up((x),TASK_INTERRUPTIBLE, 1)
-#define wake_up_interruptible_nr(x, nr)	__wake_up((x),TASK_INTERRUPTIBLE, nr)
-#define wake_up_interruptible_all(x)	__wake_up((x),TASK_INTERRUPTIBLE, 0)
+#define wake_up_interruptible(x)	__wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
+#define wake_up_interruptible_nr(x, nr)	__wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)
+#define wake_up_interruptible_all(x)	__wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
 #define	wake_up_locked(x)		__wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE)
 #define wake_up_interruptible_sync(x)   __wake_up_sync((x),TASK_INTERRUPTIBLE, 1)
 
@@ -240,7 +240,7 @@
 void FASTCALL(prepare_to_wait_exclusive(wait_queue_head_t *q,
 				wait_queue_t *wait, int state));
 void FASTCALL(finish_wait(wait_queue_head_t *q, wait_queue_t *wait));
-int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync);
+int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
 
 #define DEFINE_WAIT(name)						\
 	wait_queue_t name = {						\
diff -Nru a/include/linux/watchdog.h b/include/linux/watchdog.h
--- a/include/linux/watchdog.h	Tue Jun 15 22:20:43 2004
+++ b/include/linux/watchdog.h	Tue Jun 15 22:20:43 2004
@@ -10,6 +10,7 @@
 #define _LINUX_WATCHDOG_H
 
 #include <linux/ioctl.h>
+#include <linux/types.h>
 
 #define	WATCHDOG_IOCTL_BASE	'W'
 
diff -Nru a/include/linux/wavefront.h b/include/linux/wavefront.h
--- a/include/linux/wavefront.h	Tue Jun 15 22:20:39 2004
+++ b/include/linux/wavefront.h	Tue Jun 15 22:20:39 2004
@@ -534,8 +534,8 @@
 				  WF_{GET,SET}_CHANNEL above.
 
 			       */
-    wavefront_any *hdrptr;      /* user-space ptr to hdr bytes */
-    UINT16 *dataptr;            /* actual sample data */
+    wavefront_any __user *hdrptr;      /* user-space ptr to hdr bytes */
+    UINT16 __user *dataptr;            /* actual sample data */
 
     wavefront_any hdr;          /* kernel-space copy of hdr bytes */         
 } wavefront_patch_info;
diff -Nru a/include/linux/xfrm.h b/include/linux/xfrm.h
--- a/include/linux/xfrm.h	Tue Jun 15 22:20:37 2004
+++ b/include/linux/xfrm.h	Tue Jun 15 22:20:37 2004
@@ -152,8 +152,9 @@
 	XFRMA_ALG_COMP,		/* struct xfrm_algo */
 	XFRMA_ENCAP,		/* struct xfrm_algo + struct xfrm_encap_tmpl */
 	XFRMA_TMPL,		/* 1 or more struct xfrm_user_tmpl */
+	__XFRMA_MAX
 
-#define XFRMA_MAX XFRMA_TMPL
+#define XFRMA_MAX (__XFRMA_MAX - 1)
 };
 
 struct xfrm_usersa_info {
diff -Nru a/include/net/addrconf.h b/include/net/addrconf.h
--- a/include/net/addrconf.h	Tue Jun 15 22:20:43 2004
+++ b/include/net/addrconf.h	Tue Jun 15 22:20:43 2004
@@ -52,9 +52,9 @@
 extern void			addrconf_init(void);
 extern void			addrconf_cleanup(void);
 
-extern int			addrconf_add_ifaddr(void *arg);
-extern int			addrconf_del_ifaddr(void *arg);
-extern int			addrconf_set_dstaddr(void *arg);
+extern int			addrconf_add_ifaddr(void __user *arg);
+extern int			addrconf_del_ifaddr(void __user *arg);
+extern int			addrconf_set_dstaddr(void __user *arg);
 
 extern int			ipv6_chk_addr(struct in6_addr *addr,
 					      struct net_device *dev,
diff -Nru a/include/net/arp.h b/include/net/arp.h
--- a/include/net/arp.h	Tue Jun 15 22:20:37 2004
+++ b/include/net/arp.h	Tue Jun 15 22:20:37 2004
@@ -13,7 +13,7 @@
 extern int	arp_rcv(struct sk_buff *skb, struct net_device *dev,
 			struct packet_type *pt);
 extern int	arp_find(unsigned char *haddr, struct sk_buff *skb);
-extern int	arp_ioctl(unsigned int cmd, void *arg);
+extern int	arp_ioctl(unsigned int cmd, void __user *arg);
 extern void     arp_send(int type, int ptype, u32 dest_ip, 
 			 struct net_device *dev, u32 src_ip, 
 			 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
diff -Nru a/include/net/ax25.h b/include/net/ax25.h
--- a/include/net/ax25.h	Tue Jun 15 22:20:42 2004
+++ b/include/net/ax25.h	Tue Jun 15 22:20:42 2004
@@ -312,7 +312,7 @@
 
 /* ax25_route.c */
 extern void ax25_rt_device_down(struct net_device *);
-extern int  ax25_rt_ioctl(unsigned int, void *);
+extern int  ax25_rt_ioctl(unsigned int, void __user *);
 extern struct file_operations ax25_route_fops;
 extern int  ax25_rt_autobind(ax25_cb *, ax25_address *);
 extern ax25_route *ax25_rt_find_route(ax25_route *, ax25_address *,
diff -Nru a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
--- a/include/net/bluetooth/bluetooth.h	Tue Jun 15 22:20:39 2004
+++ b/include/net/bluetooth/bluetooth.h	Tue Jun 15 22:20:39 2004
@@ -22,10 +22,6 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  $Id: bluetooth.h,v 1.8 2002/04/17 17:37:20 maxk Exp $
- */
-
 #ifndef __BLUETOOTH_H
 #define __BLUETOOTH_H
 
@@ -41,26 +37,27 @@
 #endif
 
 /* Reserv for core and drivers use */
-#define BT_SKB_RESERVE       8
+#define BT_SKB_RESERVE	8
 
-#define BTPROTO_L2CAP   0
-#define BTPROTO_HCI     1
-#define BTPROTO_SCO   	2
+#define BTPROTO_L2CAP	0
+#define BTPROTO_HCI	1
+#define BTPROTO_SCO	2
 #define BTPROTO_RFCOMM	3
 #define BTPROTO_BNEP	4
 #define BTPROTO_CMTP	5
+#define BTPROTO_HIDP	6
 
-#define SOL_HCI     0
-#define SOL_L2CAP   6
-#define SOL_SCO     17
-#define SOL_RFCOMM  18
+#define SOL_HCI		0
+#define SOL_L2CAP	6
+#define SOL_SCO		17
+#define SOL_RFCOMM	18
 
 #define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
 #define BT_DBG(fmt, arg...)  printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg)
 #define BT_ERR(fmt, arg...)  printk(KERN_ERR  "%s: " fmt "\n" , __FUNCTION__ , ## arg)
 
 #ifdef HCI_DATA_DUMP
-#define BT_DMP(buf, len)    bt_dump(__FUNCTION__, buf, len)
+#define BT_DMP(buf, len) bt_dump(__FUNCTION__, buf, len)
 #else
 #define BT_DMP(D...)
 #endif
@@ -122,7 +119,7 @@
 
 struct bt_sock_list {
 	struct hlist_head head;
-	rwlock_t	  lock;
+	rwlock_t          lock;
 };
 
 int  bt_sock_register(int proto, struct net_proto_family *ops);
@@ -139,7 +136,7 @@
 
 /* Skb helpers */
 struct bt_skb_cb {
-	int    incoming;
+	int incoming;
 };
 #define bt_cb(skb) ((struct bt_skb_cb *)(skb->cb)) 
 
@@ -155,7 +152,7 @@
 }
 
 static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long len, 
-						       int nb, int *err)
+							int nb, int *err)
 {
 	struct sk_buff *skb;
 
@@ -178,6 +175,6 @@
 
 void bt_dump(char *pref, __u8 *buf, int count);
 
-int  bt_err(__u16 code);
+int bt_err(__u16 code);
 
 #endif /* __BLUETOOTH_H */
diff -Nru a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
--- a/include/net/bluetooth/hci.h	Tue Jun 15 22:20:59 2004
+++ b/include/net/bluetooth/hci.h	Tue Jun 15 22:20:59 2004
@@ -22,10 +22,6 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  $Id: hci.h,v 1.4 2002/04/18 22:26:15 maxk Exp $
- */
-
 #ifndef __HCI_H
 #define __HCI_H
 
diff -Nru a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
--- a/include/net/bluetooth/hci_core.h	Tue Jun 15 22:20:41 2004
+++ b/include/net/bluetooth/hci_core.h	Tue Jun 15 22:20:41 2004
@@ -22,10 +22,6 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/* 
- * $Id: hci_core.h,v 1.3 2002/04/17 18:55:21 maxk Exp $ 
- */
-
 #ifndef __HCI_CORE_H
 #define __HCI_CORE_H
 
@@ -63,12 +59,12 @@
 struct hci_dev {
 	struct list_head list;
 	spinlock_t	lock;
-	atomic_t 	refcnt;
+	atomic_t	refcnt;
 
 	char		name[8];
 	unsigned long	flags;
 	__u16		id;
-	__u8	 	type;
+	__u8		type;
 	bdaddr_t	bdaddr;
 	__u8		features[8];
 	__u16		voice_setting;
@@ -79,38 +75,38 @@
 
 	unsigned long	quirks;
 
-	atomic_t 	cmd_cnt;
-	unsigned int 	acl_cnt;
-	unsigned int 	sco_cnt;
+	atomic_t	cmd_cnt;
+	unsigned int	acl_cnt;
+	unsigned int	sco_cnt;
 
 	unsigned int	acl_mtu;
-	unsigned int 	sco_mtu;
+	unsigned int	sco_mtu;
 	unsigned int	acl_pkts;
 	unsigned int	sco_pkts;
 
-	unsigned long   cmd_last_tx;
-	unsigned long   acl_last_tx;
-	unsigned long   sco_last_tx;
+	unsigned long	cmd_last_tx;
+	unsigned long	acl_last_tx;
+	unsigned long	sco_last_tx;
 
-	struct tasklet_struct 	cmd_task;
+	struct tasklet_struct	cmd_task;
 	struct tasklet_struct	rx_task;
-	struct tasklet_struct 	tx_task;
+	struct tasklet_struct	tx_task;
 
 	struct sk_buff_head	rx_q;
-	struct sk_buff_head 	raw_q;
-	struct sk_buff_head 	cmd_q;
+	struct sk_buff_head	raw_q;
+	struct sk_buff_head	cmd_q;
 
-	struct sk_buff     	*sent_cmd;
+	struct sk_buff		*sent_cmd;
 
 	struct semaphore	req_lock;
 	wait_queue_head_t	req_wait_q;
 	__u32			req_status;
 	__u32			req_result;
 
-	struct inquiry_cache 	inq_cache;
-	struct hci_conn_hash 	conn_hash;
+	struct inquiry_cache	inq_cache;
+	struct hci_conn_hash	conn_hash;
 
-	struct hci_dev_stats 	stat;
+	struct hci_dev_stats	stat;
 
 	void			*driver_data;
 	void			*core_data;
@@ -118,12 +114,12 @@
 	atomic_t 		promisc;
 
 #ifdef CONFIG_PROC_FS
-	struct proc_dir_entry   *proc;
+	struct proc_dir_entry	*proc;
 #endif
 
 	struct class_device	class_dev;
 
-	struct module           *owner;
+	struct module 		*owner;
 
 	int (*open)(struct hci_dev *hdev);
 	int (*close)(struct hci_dev *hdev);
@@ -140,9 +136,9 @@
 	atomic_t	 refcnt;
 	spinlock_t	 lock;
 
-	bdaddr_t         dst;
-	__u16            handle;
-	__u16            state;
+	bdaddr_t	 dst;
+	__u16		 handle;
+	__u16		 state;
 	__u8		 type;
 	__u8		 out;
 	__u32		 link_mode;
@@ -154,12 +150,12 @@
 
 	struct timer_list timer;
 	
-	struct hci_dev 	*hdev;
+	struct hci_dev	*hdev;
 	void		*l2cap_data;
 	void		*sco_data;
 	void		*priv;
 
-	struct hci_conn *link;
+	struct hci_conn	*link;
 };
 
 extern struct hci_proto *hci_proto[];
@@ -215,7 +211,7 @@
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	INIT_LIST_HEAD(&h->list);
 	spin_lock_init(&h->lock);
-	h->num = 0;	
+	h->num = 0;
 }
 
 static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
@@ -233,7 +229,7 @@
 }
 
 static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
-	       				__u16 handle)
+					__u16 handle)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	struct list_head *p;
@@ -244,7 +240,7 @@
 		if (c->handle == handle)
 			return c;
 	}
-        return NULL;
+	return NULL;
 }
 
 static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
@@ -259,7 +255,7 @@
 		if (c->type == type && !bacmp(&c->dst, ba))
 			return c;
 	}
-        return NULL;
+	return NULL;
 }
 
 void hci_acl_connect(struct hci_conn *conn);
@@ -362,12 +358,12 @@
 int hci_dev_close(__u16 dev);
 int hci_dev_reset(__u16 dev);
 int hci_dev_reset_stat(__u16 dev);
-int hci_dev_cmd(unsigned int cmd, unsigned long arg);
-int hci_get_dev_list(unsigned long arg);
-int hci_get_dev_info(unsigned long arg);
-int hci_get_conn_list(unsigned long arg);
-int hci_get_conn_info(struct hci_dev *hdev, unsigned long arg);
-int hci_inquiry(unsigned long arg);
+int hci_dev_cmd(unsigned int cmd, void __user *arg);
+int hci_get_dev_list(void __user *arg);
+int hci_get_dev_info(void __user *arg);
+int hci_get_conn_list(void __user *arg);
+int hci_get_conn_info(struct hci_dev *hdev, void __user *arg);
+int hci_inquiry(void __user *arg);
 
 void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
 
@@ -506,7 +502,7 @@
 /* HCI info for socket */
 #define hci_pi(sk)	((struct hci_pinfo *)sk->sk_protinfo)
 struct hci_pinfo {
-	struct hci_dev 	  *hdev;
+	struct hci_dev    *hdev;
 	struct hci_filter filter;
 	__u32             cmsg_mask;
 };
diff -Nru a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
--- a/include/net/bluetooth/l2cap.h	Tue Jun 15 22:20:37 2004
+++ b/include/net/bluetooth/l2cap.h	Tue Jun 15 22:20:37 2004
@@ -22,18 +22,14 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  $Id: l2cap.h,v 1.1.1.1 2002/03/08 21:03:15 maxk Exp $
- */
-
 #ifndef __L2CAP_H
 #define __L2CAP_H
 
 /* L2CAP defaults */
-#define L2CAP_DEFAULT_MTU 	672
+#define L2CAP_DEFAULT_MTU	672
 #define L2CAP_DEFAULT_FLUSH_TO	0xFFFF
 
-#define L2CAP_CONN_TIMEOUT 	(HZ * 40)
+#define L2CAP_CONN_TIMEOUT	(HZ * 40)
 
 /* L2CAP socket address */
 struct sockaddr_l2 {
@@ -190,10 +186,10 @@
 struct l2cap_conn {
 	struct hci_conn	*hcon;
 
-	bdaddr_t 	*dst;
-	bdaddr_t 	*src;
+	bdaddr_t	*dst;
+	bdaddr_t	*src;
 	
-	unsigned int    mtu;
+	unsigned int	mtu;
 
 	spinlock_t	lock;
 	
@@ -227,9 +223,9 @@
 
 	__u16		sport;
 
-	struct l2cap_conn 	*conn;
-	struct sock 		*next_c;
-	struct sock 		*prev_c;
+	struct l2cap_conn	*conn;
+	struct sock		*next_c;
+	struct sock		*prev_c;
 };
 
 #define L2CAP_CONF_REQ_SENT    0x01
diff -Nru a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
--- a/include/net/bluetooth/rfcomm.h	Tue Jun 15 22:20:43 2004
+++ b/include/net/bluetooth/rfcomm.h	Tue Jun 15 22:20:43 2004
@@ -21,14 +21,6 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/* 
-   RPN support    -    Dirk Husemann <hud@zurich.ibm.com>
-*/
-
-/*
- * $Id: rfcomm.h,v 1.29 2002/10/02 20:26:17 maxk Exp $
- */
-
 #ifndef __RFCOMM_H
 #define __RFCOMM_H
 
@@ -356,7 +348,7 @@
 	struct   rfcomm_dev_info dev_info[0];
 };
 
-int  rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg);
+int  rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
 int  rfcomm_init_ttys(void);
 void rfcomm_cleanup_ttys(void);
 
diff -Nru a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
--- a/include/net/bluetooth/sco.h	Tue Jun 15 22:20:37 2004
+++ b/include/net/bluetooth/sco.h	Tue Jun 15 22:20:37 2004
@@ -22,19 +22,15 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  $Id: sco.h,v 1.1.1.1 2002/03/08 21:03:15 maxk Exp $
- */
-
 #ifndef __SCO_H
 #define __SCO_H
 
 /* SCO defaults */
-#define SCO_DEFAULT_MTU 	500
+#define SCO_DEFAULT_MTU		500
 #define SCO_DEFAULT_FLUSH_TO	0xFFFF
 
-#define SCO_CONN_TIMEOUT 	(HZ * 40)
-#define SCO_DISCONN_TIMEOUT 	(HZ * 2)
+#define SCO_CONN_TIMEOUT	(HZ * 40)
+#define SCO_DISCONN_TIMEOUT	(HZ * 2)
 #define SCO_CONN_IDLE_TIMEOUT	(HZ * 60)
 
 /* SCO socket address */
diff -Nru a/include/net/checksum.h b/include/net/checksum.h
--- a/include/net/checksum.h	Tue Jun 15 22:20:38 2004
+++ b/include/net/checksum.h	Tue Jun 15 22:20:38 2004
@@ -95,7 +95,7 @@
 
 #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
 static inline
-unsigned int csum_and_copy_from_user (const char *src, char *dst,
+unsigned int csum_and_copy_from_user (const char __user *src, char *dst,
 				      int len, int sum, int *err_ptr)
 {
 	if (verify_area(VERIFY_READ, src, len) == 0)
@@ -110,7 +110,7 @@
 
 #ifndef HAVE_CSUM_COPY_USER
 static __inline__ unsigned int csum_and_copy_to_user
-(const char *src, char *dst, int len, unsigned int sum, int *err_ptr)
+(const char *src, char __user *dst, int len, unsigned int sum, int *err_ptr)
 {
 	sum = csum_partial(src, len, sum);
 
diff -Nru a/include/net/compat.h b/include/net/compat.h
--- a/include/net/compat.h	Tue Jun 15 22:20:38 2004
+++ b/include/net/compat.h	Tue Jun 15 22:20:38 2004
@@ -29,9 +29,9 @@
 
 extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
 extern int verify_compat_iovec(struct msghdr *, struct iovec *, char *, int);
-extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr *,unsigned);
-extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr *,unsigned);
-extern asmlinkage long compat_sys_getsockopt(int, int, int, char *, int *);
+extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned);
+extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
+extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
 extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
 extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *,
 		int);
diff -Nru a/include/net/dn_dev.h b/include/net/dn_dev.h
--- a/include/net/dn_dev.h	Tue Jun 15 22:20:36 2004
+++ b/include/net/dn_dev.h	Tue Jun 15 22:20:36 2004
@@ -155,7 +155,7 @@
 extern void dn_dev_init(void);
 extern void dn_dev_cleanup(void);
 
-extern int dn_dev_ioctl(unsigned int cmd, void *arg);
+extern int dn_dev_ioctl(unsigned int cmd, void __user *arg);
 
 extern void dn_dev_devices_off(void);
 extern void dn_dev_devices_on(void);
diff -Nru a/include/net/dst.h b/include/net/dst.h
--- a/include/net/dst.h	Tue Jun 15 22:21:02 2004
+++ b/include/net/dst.h	Tue Jun 15 22:21:02 2004
@@ -67,7 +67,7 @@
 	struct xfrm_state	*xfrm;
 
 	int			(*input)(struct sk_buff*);
-	int			(*output)(struct sk_buff*);
+	int			(*output)(struct sk_buff**);
 
 #ifdef CONFIG_NET_CLS_ROUTE
 	__u32			tclassid;
@@ -89,6 +89,7 @@
 	int			(*gc)(void);
 	struct dst_entry *	(*check)(struct dst_entry *, __u32 cookie);
 	void			(*destroy)(struct dst_entry *);
+	void			(*ifdown)(struct dst_entry *, int how);
 	struct dst_entry *	(*negative_advice)(struct dst_entry *);
 	void			(*link_failure)(struct sk_buff *);
 	void			(*update_pmtu)(struct dst_entry *dst, u32 mtu);
@@ -219,7 +220,7 @@
 	int err;
 
 	for (;;) {
-		err = skb->dst->output(skb);
+		err = skb->dst->output(&skb);
 
 		if (likely(err == 0))
 			return err;
diff -Nru a/include/net/inet_common.h b/include/net/inet_common.h
--- a/include/net/inet_common.h	Tue Jun 15 22:20:43 2004
+++ b/include/net/inet_common.h	Tue Jun 15 22:20:43 2004
@@ -31,11 +31,13 @@
 extern int			inet_shutdown(struct socket *sock, int how);
 extern unsigned int		inet_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait);
 extern int			inet_setsockopt(struct socket *sock, int level,
-						int optname, char *optval, 
+						int optname,
+						char __user *optval, 
 						int optlen);
 extern int			inet_getsockopt(struct socket *sock, int level,
-						int optname, char *optval, 
-						int *optlen);
+						int optname,
+						char __user *optval, 
+						int __user *optlen);
 extern int			inet_listen(struct socket *sock, int backlog);
 
 extern void			inet_sock_release(struct sock *sk);
diff -Nru a/include/net/ip.h b/include/net/ip.h
--- a/include/net/ip.h	Tue Jun 15 22:20:42 2004
+++ b/include/net/ip.h	Tue Jun 15 22:20:42 2004
@@ -92,8 +92,8 @@
 			       struct packet_type *pt);
 extern int		ip_local_deliver(struct sk_buff *skb);
 extern int		ip_mr_input(struct sk_buff *skb);
-extern int		ip_output(struct sk_buff *skb);
-extern int		ip_mc_output(struct sk_buff *skb);
+extern int		ip_output(struct sk_buff **pskb);
+extern int		ip_mc_output(struct sk_buff **pskb);
 extern int		ip_fragment(struct sk_buff *skb, int (*out)(struct sk_buff*));
 extern int		ip_do_nat(struct sk_buff *skb);
 extern void		ip_send_check(struct iphdr *ip);
@@ -150,7 +150,7 @@
 };
 
 extern struct ipv4_config ipv4_config;
-DECLARE_SNMP_STAT(struct ip_mib, ip_statistics);
+DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics);
 #define IP_INC_STATS(field)		SNMP_INC_STATS(ip_statistics, field)
 #define IP_INC_STATS_BH(field)		SNMP_INC_STATS_BH(ip_statistics, field)
 #define IP_INC_STATS_USER(field) 	SNMP_INC_STATS_USER(ip_statistics, field)
@@ -284,8 +284,8 @@
 
 extern void	ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
 extern int	ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc);
-extern int	ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen);
-extern int	ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
+extern int	ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen);
+extern int	ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen);
 extern int	ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *));
 
 extern int 	ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
@@ -300,11 +300,11 @@
  * fed into the routing cache should use these handlers.
  */
 int ipv4_doint_and_flush(ctl_table *ctl, int write,
-			 struct file* filp, void *buffer,
+			 struct file* filp, void __user *buffer,
 			 size_t *lenp);
-int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen,
-				  void *oldval, size_t *oldlenp,
-				  void *newval, size_t newlen, 
+int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
+				  void __user *oldval, size_t __user *oldlenp,
+				  void __user *newval, size_t newlen, 
 				  void **context);
 
 #endif	/* _IP_H */
diff -Nru a/include/net/ip6_fib.h b/include/net/ip6_fib.h
--- a/include/net/ip6_fib.h	Tue Jun 15 22:20:43 2004
+++ b/include/net/ip6_fib.h	Tue Jun 15 22:20:43 2004
@@ -57,6 +57,8 @@
 		struct rt6_info		*next;
 	} u;
 
+	struct inet6_dev		*rt6i_idev;
+
 #define rt6i_dev			u.dst.dev
 #define rt6i_nexthop			u.dst.neighbour
 #define rt6i_expires			u.dst.expires
diff -Nru a/include/net/ip6_route.h b/include/net/ip6_route.h
--- a/include/net/ip6_route.h	Tue Jun 15 22:20:38 2004
+++ b/include/net/ip6_route.h	Tue Jun 15 22:20:38 2004
@@ -35,7 +35,7 @@
 extern void			ip6_route_init(void);
 extern void			ip6_route_cleanup(void);
 
-extern int			ipv6_route_ioctl(unsigned int cmd, void *arg);
+extern int			ipv6_route_ioctl(unsigned int cmd, void __user *arg);
 
 extern int			ip6_route_add(struct in6_rtmsg *rtmsg,
 					      struct nlmsghdr *,
@@ -65,7 +65,7 @@
 extern struct dst_entry *ndisc_dst_alloc(struct net_device *dev,
 					 struct neighbour *neigh,
 					 struct in6_addr *addr,
-					 int (*output)(struct sk_buff *));
+					 int (*output)(struct sk_buff **));
 extern int ndisc_dst_gc(int *more);
 extern void fib6_force_start_gc(void);
 
diff -Nru a/include/net/ipv6.h b/include/net/ipv6.h
--- a/include/net/ipv6.h	Tue Jun 15 22:20:43 2004
+++ b/include/net/ipv6.h	Tue Jun 15 22:20:43 2004
@@ -111,7 +111,7 @@
 extern int sysctl_mld_max_msf;
 
 /* MIBs */
-DECLARE_SNMP_STAT(struct ipv6_mib, ipv6_statistics);
+DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
 #define IP6_INC_STATS(field)		SNMP_INC_STATS(ipv6_statistics, field)
 #define IP6_INC_STATS_BH(field)		SNMP_INC_STATS_BH(ipv6_statistics, field)
 #define IP6_INC_STATS_USER(field) 	SNMP_INC_STATS_USER(ipv6_statistics, field)
@@ -215,7 +215,7 @@
 						   struct ip6_flowlabel * fl,
 						   struct ipv6_txoptions * fopt);
 extern void			fl6_free_socklist(struct sock *sk);
-extern int			ipv6_flowlabel_opt(struct sock *sk, char *optval, int optlen);
+extern int			ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen);
 extern void			ip6_flowlabel_init(void);
 extern void			ip6_flowlabel_cleanup(void);
 
@@ -355,8 +355,7 @@
  *	skb processing functions
  */
 
-extern int			ip6_output(struct sk_buff *skb);
-extern int			ip6_output2(struct sk_buff *skb);
+extern int			ip6_output(struct sk_buff **pskb);
 extern int			ip6_forward(struct sk_buff *skb);
 extern int			ip6_input(struct sk_buff *skb);
 extern int			ip6_mc_input(struct sk_buff *skb);
@@ -395,11 +394,13 @@
  */
 
 extern int			ipv6_setsockopt(struct sock *sk, int level, 
-						int optname, char *optval, 
+						int optname,
+						char __user *optval, 
 						int optlen);
 extern int			ipv6_getsockopt(struct sock *sk, int level, 
-						int optname, char *optval, 
-						int *optlen);
+						int optname,
+						char __user *optval, 
+						int __user *optlen);
 
 extern void			ipv6_packet_init(void);
 
diff -Nru a/include/net/irda/irda.h b/include/net/irda/irda.h
--- a/include/net/irda/irda.h	Tue Jun 15 22:20:38 2004
+++ b/include/net/irda/irda.h	Tue Jun 15 22:20:38 2004
@@ -83,8 +83,6 @@
 #define MESSAGE(args...) printk(KERN_INFO args)
 #define ERROR(args...)   printk(KERN_ERR args)
 
-#define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000)
-
 /*
  *  Magic numbers used by Linux-IrDA. Random numbers which must be unique to 
  *  give the best protection
diff -Nru a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
--- a/include/net/irda/irlmp.h	Tue Jun 15 22:20:36 2004
+++ b/include/net/irda/irlmp.h	Tue Jun 15 22:20:36 2004
@@ -251,7 +251,7 @@
 
 static inline __u32 irlmp_get_saddr(const struct lsap_cb *self)
 {
-	return (self && !self->lap) ? self->lap->saddr : 0;
+	return (self && self->lap) ? self->lap->saddr : 0;
 }
 
 static inline __u32 irlmp_get_daddr(const struct lsap_cb *self)
diff -Nru a/include/net/netrom.h b/include/net/netrom.h
--- a/include/net/netrom.h	Tue Jun 15 22:20:41 2004
+++ b/include/net/netrom.h	Tue Jun 15 22:20:41 2004
@@ -206,7 +206,7 @@
 extern void nr_rt_device_down(struct net_device *);
 extern struct net_device *nr_dev_first(void);
 extern struct net_device *nr_dev_get(ax25_address *);
-extern int  nr_rt_ioctl(unsigned int, void *);
+extern int  nr_rt_ioctl(unsigned int, void __user *);
 extern void nr_link_failed(ax25_cb *, int);
 extern int  nr_route_frame(struct sk_buff *, ax25_cb *);
 extern struct file_operations nr_nodes_fops;
diff -Nru a/include/net/rose.h b/include/net/rose.h
--- a/include/net/rose.h	Tue Jun 15 22:20:37 2004
+++ b/include/net/rose.h	Tue Jun 15 22:20:37 2004
@@ -207,7 +207,7 @@
 extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *);
 extern struct net_device *rose_ax25_dev_get(char *);
 extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *);
-extern int  rose_rt_ioctl(unsigned int, void *);
+extern int  rose_rt_ioctl(unsigned int, void __user *);
 extern void rose_link_failed(ax25_cb *, int);
 extern int  rose_route_frame(struct sk_buff *, ax25_cb *);
 extern void rose_rt_free(void);
diff -Nru a/include/net/route.h b/include/net/route.h
--- a/include/net/route.h	Tue Jun 15 22:20:35 2004
+++ b/include/net/route.h	Tue Jun 15 22:20:35 2004
@@ -55,6 +55,8 @@
 		struct rtable		*rt_next;
 	} u;
 
+	struct in_device	*idev;
+	
 	unsigned		rt_flags;
 	unsigned		rt_type;
 
diff -Nru a/include/net/sctp/command.h b/include/net/sctp/command.h
--- a/include/net/sctp/command.h	Tue Jun 15 22:21:04 2004
+++ b/include/net/sctp/command.h	Tue Jun 15 22:21:04 2004
@@ -93,6 +93,7 @@
 	SCTP_CMD_PROCESS_OPERR,  /* Process an ERROR chunk. */
 	SCTP_CMD_REPORT_FWDTSN,	 /* Report new cumulative TSN Ack. */
 	SCTP_CMD_PROCESS_FWDTSN, /* Skips were reported, so process further. */
+	SCTP_CMD_CLEAR_INIT_TAG, /* Clears association peer's inittag. */
 	SCTP_CMD_LAST
 } sctp_verb_t;
 
diff -Nru a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
--- a/include/net/sctp/sctp.h	Tue Jun 15 22:20:38 2004
+++ b/include/net/sctp/sctp.h	Tue Jun 15 22:20:38 2004
@@ -116,11 +116,6 @@
 #define SCTP_STATIC static
 #endif
 
-#define MSECS_TO_JIFFIES(msec) \
-	(((msec / 1000) * HZ) + ((msec % 1000) * HZ) / 1000)
-#define JIFFIES_TO_MSECS(jiff) \
-	(((jiff / HZ) * 1000) + ((jiff % HZ) * 1000) / HZ)
-
 /*
  * Function declarations.
  */
diff -Nru a/include/net/sctp/sm.h b/include/net/sctp/sm.h
--- a/include/net/sctp/sm.h	Tue Jun 15 22:20:40 2004
+++ b/include/net/sctp/sm.h	Tue Jun 15 22:20:40 2004
@@ -440,6 +440,23 @@
 		BUG();
 }
 
+/* Check VTAG of the packet matches the sender's own tag. */
+static inline int
+sctp_vtag_verify(const struct sctp_chunk *chunk,
+		 const struct sctp_association *asoc)
+{
+	/* RFC 2960 Sec 8.5 When receiving an SCTP packet, the endpoint
+	 * MUST ensure that the value in the Verification Tag field of
+	 * the received SCTP packet matches its own Tag. If the received
+	 * Verification Tag value does not match the receiver's own
+	 * tag value, the receiver shall silently discard the packet...
+	 */
+        if (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)
+                return 1;
+
+	return 0;
+}
+
 /* Check VTAG of the packet matches the sender's own tag OR its peer's
  * tag and the T bit is set in the Chunk Flags.
  */
diff -Nru a/include/net/sctp/structs.h b/include/net/sctp/structs.h
--- a/include/net/sctp/structs.h	Tue Jun 15 22:21:05 2004
+++ b/include/net/sctp/structs.h	Tue Jun 15 22:21:05 2004
@@ -437,13 +437,13 @@
 	int		(*setsockopt)	(struct sock *sk,
 					 int level,
 					 int optname,
-					 char *optval,
+					 char __user *optval,
 					 int optlen);
 	int		(*getsockopt)	(struct sock *sk,
 					 int level,
 					 int optname,
-					 char *optval,
-					 int *optlen);
+					 char __user *optval,
+					 int __user *optlen);
 	struct dst_entry *(*get_dst)	(struct sctp_association *asoc,
 					 union sctp_addr *daddr,
 					 union sctp_addr *saddr);
diff -Nru a/include/net/sctp/user.h b/include/net/sctp/user.h
--- a/include/net/sctp/user.h	Tue Jun 15 22:20:36 2004
+++ b/include/net/sctp/user.h	Tue Jun 15 22:20:36 2004
@@ -559,7 +559,7 @@
 struct sctp_getaddrs {
 	sctp_assoc_t            assoc_id;
 	int			addr_num;
-	struct sockaddr		*addrs;
+	struct sockaddr		__user *addrs;
 };
 
 /* These are bit fields for msghdr->msg_flags.  See section 5.1.  */
diff -Nru a/include/net/snmp.h b/include/net/snmp.h
--- a/include/net/snmp.h	Tue Jun 15 22:20:39 2004
+++ b/include/net/snmp.h	Tue Jun 15 22:20:39 2004
@@ -41,61 +41,52 @@
  * cacheline machine it makes a *lot* of sense -AK
  */ 
 
- 
+struct snmp_item {
+	char *name;
+	int offset;
+};
+
+#define SNMP_ITEM(mib,entry,procname)	{	\
+	.name = procname,			\
+	.offset = offsetof(mib, entry),		\
+}
+
+#define SNMP_ITEM_SENTINEL {			\
+	.name = NULL,				\
+	.offset = 0,				\
+}
+
 /*
  * RFC 1213:  MIB-II
  * RFC 2011 (updates 1213):  SNMPv2-MIB-IP
  * RFC 2863:  Interfaces Group MIB
- */
-struct ip_mib
-{
- 	unsigned long	IpInReceives;
- 	unsigned long	IpInHdrErrors;
- 	unsigned long	IpInAddrErrors;
- 	unsigned long	IpForwDatagrams;
- 	unsigned long	IpInUnknownProtos;
- 	unsigned long	IpInDiscards;
- 	unsigned long	IpInDelivers;
- 	unsigned long	IpOutRequests;
- 	unsigned long	IpOutDiscards;
- 	unsigned long	IpOutNoRoutes;
- 	unsigned long	IpReasmTimeout;
- 	unsigned long	IpReasmReqds;
- 	unsigned long	IpReasmOKs;
- 	unsigned long	IpReasmFails;
- 	unsigned long	IpFragOKs;
- 	unsigned long	IpFragFails;
- 	unsigned long	IpFragCreates;
-	unsigned long   __pad[0]; 
-};
- 
-/*
  * RFC 2465:  IPv6 MIB: General Group
+ * draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables
  */
-struct ipv6_mib
+struct ipstats_mib
 {
-	unsigned long	Ip6InReceives;
- 	unsigned long	Ip6InHdrErrors;
- 	unsigned long	Ip6InTooBigErrors;
- 	unsigned long	Ip6InNoRoutes;
- 	unsigned long	Ip6InAddrErrors;
- 	unsigned long	Ip6InUnknownProtos;
- 	unsigned long	Ip6InTruncatedPkts;
- 	unsigned long	Ip6InDiscards;
- 	unsigned long	Ip6InDelivers;
- 	unsigned long	Ip6OutForwDatagrams;
- 	unsigned long	Ip6OutRequests;
- 	unsigned long	Ip6OutDiscards;
- 	unsigned long	Ip6OutNoRoutes;
- 	unsigned long	Ip6ReasmTimeout;
- 	unsigned long	Ip6ReasmReqds;
- 	unsigned long	Ip6ReasmOKs;
- 	unsigned long	Ip6ReasmFails;
- 	unsigned long	Ip6FragOKs;
- 	unsigned long	Ip6FragFails;
- 	unsigned long	Ip6FragCreates;
- 	unsigned long	Ip6InMcastPkts;
- 	unsigned long	Ip6OutMcastPkts;
+	unsigned long	InReceives;
+ 	unsigned long	InHdrErrors;
+ 	unsigned long	InTooBigErrors;
+ 	unsigned long	InNoRoutes;
+ 	unsigned long	InAddrErrors;
+ 	unsigned long	InUnknownProtos;
+ 	unsigned long	InTruncatedPkts;
+ 	unsigned long	InDiscards;
+ 	unsigned long	InDelivers;
+ 	unsigned long	OutForwDatagrams;
+ 	unsigned long	OutRequests;
+ 	unsigned long	OutDiscards;
+ 	unsigned long	OutNoRoutes;
+ 	unsigned long	ReasmTimeout;
+ 	unsigned long	ReasmReqds;
+ 	unsigned long	ReasmOKs;
+ 	unsigned long	ReasmFails;
+ 	unsigned long	FragOKs;
+ 	unsigned long	FragFails;
+ 	unsigned long	FragCreates;
+ 	unsigned long	InMcastPkts;
+ 	unsigned long	OutMcastPkts;
 	unsigned long   __pad[0]; 
 };
  
diff -Nru a/include/net/sock.h b/include/net/sock.h
--- a/include/net/sock.h	Tue Jun 15 22:20:43 2004
+++ b/include/net/sock.h	Tue Jun 15 22:20:43 2004
@@ -398,6 +398,21 @@
 	return test_bit(flag, &sk->sk_flags);
 }
 
+static inline void sk_acceptq_removed(struct sock *sk)
+{
+	sk->sk_ack_backlog--;
+}
+
+static inline void sk_acceptq_added(struct sock *sk)
+{
+	sk->sk_ack_backlog++;
+}
+
+static inline int sk_acceptq_is_full(struct sock *sk)
+{
+	return sk->sk_ack_backlog > sk->sk_max_ack_backlog;
+}
+
 /* The per-socket spinlock must be held here. */
 #define sk_add_backlog(__sk, __skb)				\
 do {	if (!(__sk)->sk_backlog.tail) {				\
@@ -410,6 +425,20 @@
 	(__skb)->next = NULL;					\
 } while(0)
 
+#define sk_wait_event(__sk, __timeo, __condition)		\
+({	int rc;							\
+	release_sock(__sk);					\
+	rc = __condition;					\
+	if (!rc) {						\
+		*(__timeo) = schedule_timeout(*(__timeo));	\
+		rc = __condition;				\
+	}							\
+	lock_sock(__sk);					\
+	rc;							\
+})
+
+extern int sk_wait_data(struct sock *sk, long *timeo);
+
 /* IP protocol blocks we attach to sockets.
  * socket layer -> transport layer interface
  * transport -> network interface is defined by struct inet_proto
@@ -430,10 +459,11 @@
 	int			(*destroy)(struct sock *sk);
 	void			(*shutdown)(struct sock *sk, int how);
 	int			(*setsockopt)(struct sock *sk, int level, 
-					int optname, char *optval, int optlen);
+					int optname, char __user *optval,
+					int optlen);
 	int			(*getsockopt)(struct sock *sk, int level, 
-					int optname, char *optval, 
-					int *option);  	 
+					int optname, char __user *optval, 
+					int __user *option);  	 
 	int			(*sendmsg)(struct kiocb *iocb, struct sock *sk,
 					   struct msghdr *msg, size_t len);
 	int			(*recvmsg)(struct kiocb *iocb, struct sock *sk,
@@ -897,6 +927,11 @@
 	atomic_add(skb->truesize, &sk->sk_rmem_alloc);
 }
 
+extern void sk_reset_timer(struct sock *sk, struct timer_list* timer,
+			   unsigned long expires);
+
+extern void sk_stop_timer(struct sock *sk, struct timer_list* timer);
+
 static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 {
 	int err = 0;
@@ -1034,6 +1069,20 @@
 		sk->sk_stamp = *stamp;
 }
 
+/**
+ * sk_eat_skb - Release a skb if it is no longer needed
+ * @sk - socket to eat this skb from
+ * @skb - socket buffer to eat
+ *
+ * This routine must be called with interrupts disabled or with the socket
+ * locked so that the sk_buff queue operation is ok.
+*/
+static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
+{
+	__skb_unlink(skb, &sk->sk_receive_queue);
+	__kfree_skb(skb);
+}
+
 extern atomic_t netstamp_needed;
 extern void sock_enable_timestamp(struct sock *sk);
 extern void sock_disable_timestamp(struct sock *sk);
@@ -1048,7 +1097,7 @@
 	}		
 } 
 
-extern int sock_get_timestamp(struct sock *, struct timeval *);
+extern int sock_get_timestamp(struct sock *, struct timeval __user *);
 
 /* 
  *	Enable debug/info messages 
diff -Nru a/include/net/tcp.h b/include/net/tcp.h
--- a/include/net/tcp.h	Tue Jun 15 22:20:37 2004
+++ b/include/net/tcp.h	Tue Jun 15 22:20:37 2004
@@ -610,6 +610,8 @@
 extern int sysctl_tcp_bic;
 extern int sysctl_tcp_bic_fast_convergence;
 extern int sysctl_tcp_bic_low_window;
+extern int sysctl_tcp_default_win_scale;
+extern int sysctl_tcp_moderate_rcvbuf;
 
 extern atomic_t tcp_memory_allocated;
 extern atomic_t tcp_sockets_allocated;
@@ -720,14 +722,14 @@
 	int			(*setsockopt)		(struct sock *sk, 
 							 int level, 
 							 int optname, 
-							 char *optval, 
+							 char __user *optval, 
 							 int optlen);
 
 	int			(*getsockopt)		(struct sock *sk, 
 							 int level, 
 							 int optname, 
-							 char *optval, 
-							 int *optlen);
+							 char __user *optval, 
+							 int __user *optlen);
 
 
 	void			(*addr2sockaddr)	(struct sock *sk,
@@ -800,6 +802,8 @@
 						    struct tcphdr *th, 
 						    unsigned len);
 
+extern void			tcp_rcv_space_adjust(struct sock *sk);
+
 enum tcp_ack_state_t
 {
 	TCP_ACK_SCHED = 1,
@@ -869,10 +873,11 @@
 extern void			tcp_write_space(struct sock *sk); 
 
 extern int			tcp_getsockopt(struct sock *sk, int level, 
-					       int optname, char *optval, 
-					       int *optlen);
+					       int optname,
+					       char __user *optval, 
+					       int __user *optlen);
 extern int			tcp_setsockopt(struct sock *sk, int level, 
-					       int optname, char *optval, 
+					       int optname, char __user *optval, 
 					       int optlen);
 extern void			tcp_set_keepalive(struct sock *sk, int val);
 extern int			tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
@@ -965,6 +970,9 @@
 
 extern const char timer_bug_msg[];
 
+/* tcp_diag.c */
+extern void tcp_get_info(struct sock *, struct tcp_info *);
+
 /* Read 'sendfile()'-style from a TCP socket */
 typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
 				unsigned int, size_t);
@@ -981,9 +989,7 @@
 		tp->pending = 0;
 
 #ifdef TCP_CLEAR_TIMERS
-		if (timer_pending(&tp->retransmit_timer) &&
-		    del_timer(&tp->retransmit_timer))
-			__sock_put(sk);
+		sk_stop_timer(sk, &tp->retransmit_timer);
 #endif
 		break;
 	case TCP_TIME_DACK:
@@ -991,9 +997,7 @@
 		tp->ack.pending = 0;
 
 #ifdef TCP_CLEAR_TIMERS
-		if (timer_pending(&tp->delack_timer) &&
-		    del_timer(&tp->delack_timer))
-			__sock_put(sk);
+		sk_stop_timer(sk, &tp->delack_timer);
 #endif
 		break;
 	default:
@@ -1022,15 +1026,13 @@
 	case TCP_TIME_PROBE0:
 		tp->pending = what;
 		tp->timeout = jiffies+when;
-		if (!mod_timer(&tp->retransmit_timer, tp->timeout))
-			sock_hold(sk);
+		sk_reset_timer(sk, &tp->retransmit_timer, tp->timeout);
 		break;
 
 	case TCP_TIME_DACK:
 		tp->ack.pending |= TCP_ACK_TIMER;
 		tp->ack.timeout = jiffies+when;
-		if (!mod_timer(&tp->delack_timer, tp->ack.timeout))
-			sock_hold(sk);
+		sk_reset_timer(sk, &tp->delack_timer, tp->ack.timeout);
 		break;
 
 	default:
@@ -1751,6 +1753,9 @@
 		if (*rcv_wscale && sysctl_tcp_app_win && space>=mss &&
 		    space - max((space>>sysctl_tcp_app_win), mss>>*rcv_wscale) < 65536/2)
 			(*rcv_wscale)--;
+
+		*rcv_wscale = max((__u8)sysctl_tcp_default_win_scale,
+				  *rcv_wscale);
 	}
 
 	/* Set initial window to value enough for senders,
@@ -1789,28 +1794,13 @@
 	return tcp_win_from_space(sk->sk_rcvbuf); 
 }
 
-static inline void tcp_acceptq_removed(struct sock *sk)
-{
-	sk->sk_ack_backlog--;
-}
-
-static inline void tcp_acceptq_added(struct sock *sk)
-{
-	sk->sk_ack_backlog++;
-}
-
-static inline int tcp_acceptq_is_full(struct sock *sk)
-{
-	return sk->sk_ack_backlog > sk->sk_max_ack_backlog;
-}
-
 static inline void tcp_acceptq_queue(struct sock *sk, struct open_request *req,
 					 struct sock *child)
 {
 	struct tcp_opt *tp = tcp_sk(sk);
 
 	req->sk = child;
-	tcp_acceptq_added(sk);
+	sk_acceptq_added(sk);
 
 	if (!tp->accept_queue_tail) {
 		tp->accept_queue = req;
diff -Nru a/include/net/x25.h b/include/net/x25.h
--- a/include/net/x25.h	Tue Jun 15 22:20:42 2004
+++ b/include/net/x25.h	Tue Jun 15 22:20:42 2004
@@ -196,7 +196,7 @@
 extern void x25_transmit_diagnostic(struct x25_neigh *, unsigned char);
 extern void x25_transmit_clear_request(struct x25_neigh *, unsigned int, unsigned char);
 extern void x25_transmit_link(struct sk_buff *, struct x25_neigh *);
-extern int  x25_subscr_ioctl(unsigned int, void *);
+extern int  x25_subscr_ioctl(unsigned int, void __user *);
 extern struct x25_neigh *x25_get_neigh(struct net_device *);
 extern void x25_link_free(void);
 
@@ -221,7 +221,7 @@
 extern struct x25_route *x25_get_route(struct x25_address *addr);
 extern struct net_device *x25_dev_get(char *);
 extern void x25_route_device_down(struct net_device *dev);
-extern int  x25_route_ioctl(unsigned int, void *);
+extern int  x25_route_ioctl(unsigned int, void __user *);
 extern void x25_route_free(void);
 
 static __inline__ void x25_route_hold(struct x25_route *rt)
diff -Nru a/include/net/xfrm.h b/include/net/xfrm.h
--- a/include/net/xfrm.h	Tue Jun 15 22:20:44 2004
+++ b/include/net/xfrm.h	Tue Jun 15 22:20:44 2004
@@ -216,7 +216,7 @@
 	void			(*destructor)(struct xfrm_state *);
 	int			(*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);
 	int			(*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);
-	int			(*output)(struct sk_buff *skb);
+	int			(*output)(struct sk_buff **pskb);
 	/* Estimate maximal size of result of transformation of a dgram */
 	u32			(*get_max_size)(struct xfrm_state *, int size);
 };
@@ -821,10 +821,10 @@
 
 #ifdef CONFIG_XFRM
 extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type);
-extern int xfrm_user_policy(struct sock *sk, int optname, u8 *optval, int optlen);
+extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen);
 extern int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsigned short family);
 #else
-static inline int xfrm_user_policy(struct sock *sk, int optname, u8 *optval, int optlen)
+static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen)
 {
  	return -ENOPROTOOPT;
 } 
diff -Nru a/include/pcmcia/ss.h b/include/pcmcia/ss.h
--- a/include/pcmcia/ss.h	Tue Jun 15 22:21:03 2004
+++ b/include/pcmcia/ss.h	Tue Jun 15 22:21:03 2004
@@ -145,6 +145,7 @@
 	u_int			Attributes;
 	ioaddr_t		BasePort, NumPorts;
 	ioaddr_t		InUse, Config;
+	struct resource		*res;
 } io_window_t;
 
 #define WINDOW_MAGIC	0xB35C
diff -Nru a/include/scsi/scsi.h b/include/scsi/scsi.h
--- a/include/scsi/scsi.h	Tue Jun 15 22:21:04 2004
+++ b/include/scsi/scsi.h	Tue Jun 15 22:21:04 2004
@@ -362,6 +362,13 @@
 #define SCSI_2          3
 #define SCSI_3          4
 
+/*
+ * INQ PERIPHERAL QUALIFIERS
+ */
+#define SCSI_INQ_PQ_CON         0x00
+#define SCSI_INQ_PQ_NOT_CON     0x01
+#define SCSI_INQ_PQ_NOT_CAP     0x03
+
 
 /*
  * Here are some scsi specific ioctl commands which are sometimes useful.
diff -Nru a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
--- a/include/scsi/scsi_device.h	Tue Jun 15 22:20:36 2004
+++ b/include/scsi/scsi_device.h	Tue Jun 15 22:20:36 2004
@@ -63,6 +63,7 @@
 	char devfs_name[256];	/* devfs junk */
 	char type;
 	char scsi_level;
+	char inq_periph_qual;	/* PQ from INQUIRY data */	
 	unsigned char inquiry_len;	/* valid bytes in 'inquiry' */
 	unsigned char * inquiry;	/* INQUIRY response data */
 	char * vendor;		/* [back_compat] point into 'inquiry' ... */
@@ -110,6 +111,8 @@
 
 	unsigned int max_device_blocked; /* what device_blocked counts down from  */
 #define SCSI_DEFAULT_DEVICE_BLOCKED	3
+
+	int timeout;
 
 	struct device		sdev_gendev;
 	struct class_device	sdev_classdev;
diff -Nru a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
--- a/include/scsi/scsi_devinfo.h	Tue Jun 15 22:20:36 2004
+++ b/include/scsi/scsi_devinfo.h	Tue Jun 15 22:20:36 2004
@@ -4,7 +4,8 @@
  * Flags for SCSI devices that need special treatment
  */
 #define BLIST_NOLUN     	0x001	/* Only scan LUN 0 */
-#define BLIST_FORCELUN  	0x002	/* Known to have LUNs, force scanning */
+#define BLIST_FORCELUN  	0x002	/* Known to have LUNs, force scanning,
+					   deprecated: Use max_luns=N */
 #define BLIST_BORKEN    	0x004	/* Flag for broken handshaking */
 #define BLIST_KEY       	0x008	/* unlock by special command */
 #define BLIST_SINGLELUN 	0x010	/* Do not use LUNs in parallel */
@@ -20,4 +21,7 @@
 #define BLIST_MS_SKIP_PAGE_3F	0x4000	/* do not send ms page 0x3f */
 #define BLIST_USE_10_BYTE_MS	0x8000	/* use 10 byte ms before 6 byte ms */
 #define BLIST_MS_192_BYTES_FOR_3F	0x10000	/*  192 byte ms page 0x3f request */
+#define BLIST_REPORTLUN2	0x20000	/* try REPORT_LUNS even for SCSI-2 devs
+ 					   (if HBA supports more than 8 LUNs) */
+#define BLIST_NOREPORTLUN	0x40000	/* don't try REPORT_LUNS scan (SCSI-3 devs) */
 #endif
diff -Nru a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h
--- a/include/scsi/scsi_ioctl.h	Tue Jun 15 22:20:36 2004
+++ b/include/scsi/scsi_ioctl.h	Tue Jun 15 22:20:36 2004
@@ -40,10 +40,10 @@
 	unsigned char host_wwn[8]; // include NULL term.
 } Scsi_FCTargAddress;
 
-extern int scsi_ioctl(struct scsi_device *, int, void *);
+extern int scsi_ioctl(struct scsi_device *, int, void __user *);
 extern int kernel_scsi_ioctl(struct scsi_device *, int , void *);
 extern int scsi_ioctl_send_command(struct scsi_device *,
-				   struct scsi_ioctl_command *);
+				   struct scsi_ioctl_command __user *);
 
 #endif /* __KERNEL__ */
 #endif /* _SCSI_IOCTL_H */
diff -Nru a/include/scsi/sg.h b/include/scsi/sg.h
--- a/include/scsi/sg.h	Tue Jun 15 22:20:39 2004
+++ b/include/scsi/sg.h	Tue Jun 15 22:20:39 2004
@@ -91,7 +91,7 @@
 
 typedef struct sg_iovec /* same structure as used by readv() Linux system */
 {                       /* call. It defines one scatter-gather element. */
-    void * iov_base;            /* Starting address  */
+    void __user *iov_base;      /* Starting address  */
     size_t iov_len;             /* Length in bytes  */
 } sg_iovec_t;
 
@@ -104,14 +104,14 @@
     unsigned char mx_sb_len;    /* [i] max length to write to sbp */
     unsigned short iovec_count; /* [i] 0 implies no scatter gather */
     unsigned int dxfer_len;     /* [i] byte count of data transfer */
-    void * dxferp;              /* [i], [*io] points to data transfer memory
+    void __user *dxferp;	/* [i], [*io] points to data transfer memory
 					      or scatter gather list */
-    unsigned char * cmdp;       /* [i], [*i] points to command to perform */
-    unsigned char * sbp;        /* [i], [*o] points to sense_buffer memory */
+    unsigned char __user *cmdp; /* [i], [*i] points to command to perform */
+    void __user *sbp;		/* [i], [*o] points to sense_buffer memory */
     unsigned int timeout;       /* [i] MAX_UINT->no timeout (unit: millisec) */
     unsigned int flags;         /* [i] 0 -> default, see SG_FLAG... */
     int pack_id;                /* [i->o] unused internally (normally) */
-    void * usr_ptr;             /* [i->o] unused internally */
+    void __user * usr_ptr;      /* [i->o] unused internally */
     unsigned char status;       /* [o] scsi status */
     unsigned char masked_status;/* [o] shifted, masked scsi status */
     unsigned char msg_status;   /* [o] messaging level data (optional) */
@@ -171,7 +171,7 @@
     char sg_io_owned;   /* 0 -> complete with read(), 1 -> owned by SG_IO */
     char problem;       /* 0 -> no problem detected, 1 -> error to report */
     int pack_id;        /* pack_id associated with request */
-    void * usr_ptr;     /* user provided pointer (in new interface) */
+    void __user *usr_ptr;     /* user provided pointer (in new interface) */
     unsigned int duration; /* millisecs elapsed since written (req_state==1)
 			      or request duration (req_state==2) */
     int unused;
diff -Nru a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
--- a/include/sound/ac97_codec.h	Tue Jun 15 22:20:41 2004
+++ b/include/sound/ac97_codec.h	Tue Jun 15 22:20:41 2004
@@ -51,7 +51,7 @@
 #define AC97_REC_GAIN_MIC	0x1e	/* Record Gain MIC (optional) */
 #define AC97_GENERAL_PURPOSE	0x20	/* General Purpose (optional) */
 #define AC97_3D_CONTROL		0x22	/* 3D Control (optional) */
-#define AC97_RESERVED		0x24	/* Reserved */
+#define AC97_INT_PAGING		0x24	/* Audio Interrupt & Paging (AC'97 2.3) */
 #define AC97_POWERDOWN		0x26	/* Powerdown control / status */
 /* range 0x28-0x3a - AUDIO AC'97 2.0 extensions */
 #define AC97_EXTENDED_ID	0x28	/* Extended Audio ID */
@@ -82,6 +82,13 @@
 /* range 0x5a-0x7b - Vendor Specific */
 #define AC97_VENDOR_ID1		0x7c	/* Vendor ID1 */
 #define AC97_VENDOR_ID2		0x7e	/* Vendor ID2 / revision */
+/* range 0x60-0x6f (page 1) - extended codec registers */
+#define AC97_CODEC_CLASS_REV	0x60	/* Codec Class/Revision */
+#define AC97_PCI_SVID		0x62	/* PCI Subsystem Vendor ID */
+#define AC97_PCI_SID		0x64	/* PCI Subsystem ID */
+#define AC97_FUNC_SELECT	0x66	/* Function Select */
+#define AC97_FUNC_INFO		0x68	/* Function Information */
+#define AC97_SENSE_INFO		0x6a	/* Sense Details */
 
 /* slot allocation */
 #define AC97_SLOT_TAG		0
@@ -139,6 +146,7 @@
 #define AC97_EI_AMAP		0x0200	/* indicates optional slot/DAC mapping based on codec ID */
 #define AC97_EI_REV_MASK	0x0c00	/* AC'97 revision mask */
 #define AC97_EI_REV_22		0x0400	/* AC'97 revision 2.2 */
+#define AC97_EI_REV_23		0x0800	/* AC'97 revision 2.3 */
 #define AC97_EI_REV_SHIFT	10
 #define AC97_EI_ADDR_MASK	0xc000	/* physical codec ID (address) */
 #define AC97_EI_ADDR_SHIFT	14
@@ -179,6 +187,16 @@
 #define AC97_SC_SPSR_32K	0x3000	/* Use 32kHz Sample rate */
 #define AC97_SC_DRS		0x4000	/* Double Rate S/PDIF */
 #define AC97_SC_V		0x8000	/* Validity status */
+
+/* Interrupt and Paging bit defines (AC'97 2.3) */
+#define AC97_PAGE_MASK		0x000f	/* Page Selector */
+#define AC97_PAGE_VENDOR	0	/* Vendor-specific registers */
+#define AC97_PAGE_1		1	/* Extended Codec Registers page 1 */
+#define AC97_INT_ENABLE		0x0800	/* Interrupt Enable */
+#define AC97_INT_SENSE		0x1000	/* Sense Cycle */
+#define AC97_INT_CAUSE_SENSE	0x2000	/* Sense Cycle Completed (RO) */
+#define AC97_INT_CAUSE_GPIO	0x4000	/* GPIO bits changed (RO) */
+#define AC97_INT_STATUS		0x8000	/* Interrupt Status */
 
 /* extended modem ID bit defines */
 #define AC97_MEI_LINE1		0x0001	/* Line1 present */
diff -Nru a/include/sound/ad1848.h b/include/sound/ad1848.h
--- a/include/sound/ad1848.h	Tue Jun 15 22:20:38 2004
+++ b/include/sound/ad1848.h	Tue Jun 15 22:20:38 2004
@@ -147,9 +147,6 @@
 	int calibrate_mute;
 	int dma_size;
 	int thinkpad_flag;		/* Thinkpad CS4248 needs some extra help */
-#ifdef CONFIG_PM
-	struct pm_dev *thinkpad_pmstate;
-#endif
 
 	spinlock_t reg_lock;
 	struct semaphore open_mutex;
diff -Nru a/include/sound/ainstr_gf1.h b/include/sound/ainstr_gf1.h
--- a/include/sound/ainstr_gf1.h	Tue Jun 15 22:20:43 2004
+++ b/include/sound/ainstr_gf1.h	Tue Jun 15 22:20:43 2004
@@ -209,9 +209,9 @@
 	void *private_data;
 	int (*info)(void *private_data, gf1_info_t *info);
 	int (*put_sample)(void *private_data, gf1_wave_t *wave,
-	                  char *data, long len, int atomic);
+	                  char __user *data, long len, int atomic);
 	int (*get_sample)(void *private_data, gf1_wave_t *wave,
-			  char *data, long len, int atomic);
+			  char __user *data, long len, int atomic);
 	int (*remove_sample)(void *private_data, gf1_wave_t *wave,
 			     int atomic);
 	void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
diff -Nru a/include/sound/ainstr_iw.h b/include/sound/ainstr_iw.h
--- a/include/sound/ainstr_iw.h	Tue Jun 15 22:20:36 2004
+++ b/include/sound/ainstr_iw.h	Tue Jun 15 22:20:36 2004
@@ -357,9 +357,9 @@
 	void *private_data;
 	int (*info)(void *private_data, iwffff_info_t *info);
 	int (*put_sample)(void *private_data, iwffff_wave_t *wave,
-	                  char *data, long len, int atomic);
+	                  char __user *data, long len, int atomic);
 	int (*get_sample)(void *private_data, iwffff_wave_t *wave,
-			  char *data, long len, int atomic);
+			  char __user *data, long len, int atomic);
 	int (*remove_sample)(void *private_data, iwffff_wave_t *wave,
 			     int atomic);
 	void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
diff -Nru a/include/sound/ainstr_simple.h b/include/sound/ainstr_simple.h
--- a/include/sound/ainstr_simple.h	Tue Jun 15 22:20:43 2004
+++ b/include/sound/ainstr_simple.h	Tue Jun 15 22:20:43 2004
@@ -140,9 +140,9 @@
 	void *private_data;
 	int (*info)(void *private_data, simple_instrument_info_t *info);
 	int (*put_sample)(void *private_data, simple_instrument_t *instr,
-	                  char *data, long len, int atomic);
+	                  char __user *data, long len, int atomic);
 	int (*get_sample)(void *private_data, simple_instrument_t *instr,
-			  char *data, long len, int atomic);
+			  char __user *data, long len, int atomic);
 	int (*remove_sample)(void *private_data, simple_instrument_t *instr,
 			     int atomic);
 	void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
diff -Nru a/include/sound/asound.h b/include/sound/asound.h
--- a/include/sound/asound.h	Tue Jun 15 22:20:42 2004
+++ b/include/sound/asound.h	Tue Jun 15 22:20:42 2004
@@ -135,7 +135,7 @@
 struct sndrv_hwdep_dsp_image {
 	unsigned int index;		/* W: DSP index */
 	unsigned char name[64];		/* W: ID (e.g. file name) */
-	unsigned char *image;		/* W: binary image */
+	unsigned char __user *image;	/* W: binary image */
 	size_t length;			/* W: size of image in bytes */
 	unsigned long driver_data;	/* W: driver-specific data */
 };
@@ -153,7 +153,7 @@
  *                                                                           *
  *****************************************************************************/
 
-#define SNDRV_PCM_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 6)
+#define SNDRV_PCM_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 7)
 
 typedef unsigned long sndrv_pcm_uframes_t;
 typedef long sndrv_pcm_sframes_t;
@@ -428,15 +428,31 @@
 	sndrv_pcm_uframes_t avail_min;	/* RW: min available frames for wakeup */
 };
 
+#define SNDRV_PCM_SYNC_PTR_HWSYNC	(1<<0)	/* execute hwsync */
+#define SNDRV_PCM_SYNC_PTR_APPL		(1<<1)	/* get appl_ptr from driver (r/w op) */
+#define SNDRV_PCM_SYNC_PTR_AVAIL_MIN	(1<<2)	/* get avail_min from driver */
+
+struct sndrv_pcm_sync_ptr {
+	unsigned int flags;
+	union {
+		struct sndrv_pcm_mmap_status status;
+		unsigned char reserved[64];
+	} s;
+	union {
+		struct sndrv_pcm_mmap_control control;
+		unsigned char reserved[64];
+	} c;
+};
+
 struct sndrv_xferi {
 	sndrv_pcm_sframes_t result;
-	void *buf;
+	void __user *buf;
 	sndrv_pcm_uframes_t frames;
 };
 
 struct sndrv_xfern {
 	sndrv_pcm_sframes_t result;
-	void **bufs;
+	void __user * __user *bufs;
 	sndrv_pcm_uframes_t frames;
 };
 
@@ -451,6 +467,7 @@
 	SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct sndrv_pcm_status),
 	SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, sndrv_pcm_sframes_t),
 	SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22),
+	SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct sndrv_pcm_sync_ptr),
 	SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct sndrv_pcm_channel_info),
 	SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40),
 	SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41),
@@ -538,7 +555,7 @@
  *  Timer section - /dev/snd/timer
  */
 
-#define SNDRV_TIMER_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 1)
+#define SNDRV_TIMER_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 2)
 
 enum sndrv_timer_class {
 	SNDRV_TIMER_CLASS_NONE = -1,
@@ -619,6 +636,7 @@
 
 #define SNDRV_TIMER_PSFLG_AUTO		(1<<0)	/* auto start, otherwise one-shot */
 #define SNDRV_TIMER_PSFLG_EXCLUSIVE	(1<<1)	/* exclusive use, precise start/stop/pause/continue */
+#define SNDRV_TIMER_PSFLG_EARLY_EVENT	(1<<2)	/* write early event to the poll queue */
 
 struct sndrv_timer_params {
 	unsigned int flags;		/* flags - SNDRV_MIXER_PSFLG_* */
@@ -667,6 +685,7 @@
 	SNDRV_TIMER_EVENT_STOP,			/* val = 0 */
 	SNDRV_TIMER_EVENT_CONTINUE,		/* val = resolution in ns */
 	SNDRV_TIMER_EVENT_PAUSE,		/* val = 0 */
+	SNDRV_TIMER_EVENT_EARLY,		/* val = 0, early event */
 	/* master timer events for slave timer instances */
 	SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,
 	SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10,
@@ -757,7 +776,7 @@
 	unsigned int space;		/* W: count of element IDs to get */
 	unsigned int used;		/* R: count of element IDs set */
 	unsigned int count;		/* R: count of all elements */
-	struct sndrv_ctl_elem_id *pids; /* R: IDs */
+	struct sndrv_ctl_elem_id __user *pids; /* R: IDs */
 	unsigned char reserved[50];
 };
 
diff -Nru a/include/sound/core.h b/include/sound/core.h
--- a/include/sound/core.h	Tue Jun 15 22:21:05 2004
+++ b/include/sound/core.h	Tue Jun 15 22:21:05 2004
@@ -163,8 +163,10 @@
 	struct device *dev;
 
 #ifdef CONFIG_PM
-	int (*set_power_state) (snd_card_t *card, unsigned int state);
-	void *power_state_private_data;
+	int (*pm_suspend)(snd_card_t *card, unsigned int state);
+	int (*pm_resume)(snd_card_t *card, unsigned int state);
+	struct pm_dev *pm_dev;		/* for ISA */
+	void *pm_private_data;
 	unsigned int power_state;	/* power state */
 	struct semaphore power_lock;	/* power lock */
 	wait_queue_head_t power_sleep;
@@ -199,12 +201,32 @@
 	card->power_state = state;
 	wake_up(&card->power_sleep);
 }
+int snd_card_set_pm_callback(snd_card_t *card,
+			     int (*suspend)(snd_card_t *, unsigned int),
+			     int (*resume)(snd_card_t *, unsigned int),
+			     void *private_data);
+int snd_card_set_dev_pm_callback(snd_card_t *card, int type,
+				 int (*suspend)(snd_card_t *, unsigned int),
+				 int (*resume)(snd_card_t *, unsigned int),
+				 void *private_data);
+#define snd_card_set_isa_pm_callback(card,suspend,resume,data) \
+	snd_card_set_dev_pm_callback(card, PM_ISA_DEV, suspend, resume, data)
+#ifndef SND_PCI_PM_CALLBACKS
+int snd_card_pci_suspend(struct pci_dev *dev, u32 state);
+int snd_card_pci_resume(struct pci_dev *dev);
+#define SND_PCI_PM_CALLBACKS \
+	.suspend = snd_card_pci_suspend,  .resume = snd_card_pci_resume
+#endif
 #else
 #define snd_power_lock(card)		do { (void)(card); } while (0)
 #define snd_power_unlock(card)		do { (void)(card); } while (0)
 static inline int snd_power_wait(snd_card_t *card, unsigned int state, struct file *file) { return 0; }
 #define snd_power_get_state(card)	SNDRV_CTL_POWER_D0
 #define snd_power_change_state(card, state)	do { (void)(card); } while (0)
+#define snd_card_set_pm_callback(card,suspend,resume,data) -EINVAL
+#define snd_card_set_dev_pm_callback(card,suspend,resume,data) -EINVAL
+#define snd_card_set_isa_pm_callback(card,suspend,resume,data) -EINVAL
+#define SND_PCI_PM_CALLBACKS
 #endif
 
 /* device.c */
@@ -280,8 +302,8 @@
 #endif
 void *snd_kcalloc(size_t size, int flags);
 char *snd_kmalloc_strdup(const char *string, int flags);
-int copy_to_user_fromio(void *dst, unsigned long src, size_t count);
-int copy_from_user_toio(unsigned long dst, const void *src, size_t count);
+int copy_to_user_fromio(void __user *dst, unsigned long src, size_t count);
+int copy_from_user_toio(unsigned long dst, const void __user *src, size_t count);
 
 /* init.c */
 
diff -Nru a/include/sound/cs4231.h b/include/sound/cs4231.h
--- a/include/sound/cs4231.h	Tue Jun 15 22:20:40 2004
+++ b/include/sound/cs4231.h	Tue Jun 15 22:20:40 2004
@@ -295,7 +295,6 @@
 	void (*set_capture_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char cdfr);
 	void (*trigger) (cs4231_t *chip, unsigned int what, int start);
 #ifdef CONFIG_PM
-	struct pm_dev *pm_dev;
 	void (*suspend) (cs4231_t *chip);
 	void (*resume) (cs4231_t *chip);
 #endif
diff -Nru a/include/sound/cs46xx.h b/include/sound/cs46xx.h
--- a/include/sound/cs46xx.h	Tue Jun 15 22:20:38 2004
+++ b/include/sound/cs46xx.h	Tue Jun 15 22:20:38 2004
@@ -1737,9 +1737,6 @@
 
 	struct snd_cs46xx_gameport *gameport;
 
-#ifdef CONFIG_PM
-	struct pm_dev *pm_dev;
-#endif
 #ifdef CONFIG_SND_CS46XX_DEBUG_GPIO
 	int current_gpio;
 #endif
@@ -1770,10 +1767,5 @@
 int snd_cs46xx_midi(cs46xx_t *chip, int device, snd_rawmidi_t **rmidi);
 int snd_cs46xx_start_dsp(cs46xx_t *chip);
 void snd_cs46xx_gameport(cs46xx_t *chip);
-
-#ifdef CONFIG_PM
-void snd_cs46xx_suspend(cs46xx_t *chip);
-void snd_cs46xx_resume(cs46xx_t *chip);
-#endif
 
 #endif /* __SOUND_CS46XX_H */
diff -Nru a/include/sound/emu10k1.h b/include/sound/emu10k1.h
--- a/include/sound/emu10k1.h	Tue Jun 15 22:20:38 2004
+++ b/include/sound/emu10k1.h	Tue Jun 15 22:20:38 2004
@@ -650,7 +650,8 @@
 #define SPBYPASS_FORMAT		0x00000f00      /* If 1, SPDIF XX uses 24 bit, if 0 - 20 bit	*/
 
 #define AC97SLOT		0x5f            /* additional AC97 slots enable bits		*/
-#define AC97SLOT_10K2		0x03
+#define AC97SLOT_REAR_RIGHT	0x01		/* Rear left */
+#define AC97SLOT_REAR_LEFT	0x02		/* Rear right */
 #define AC97SLOT_CNTR		0x10            /* Center enable */
 #define AC97SLOT_LFE		0x20            /* LFE enable */
 
@@ -937,7 +938,8 @@
 	struct resource *res_port;
 	int APS: 1,				/* APS flag */
 	    no_ac97: 1,				/* no AC'97 */
-	    tos_link: 1;			/* tos link detected */
+	    tos_link: 1,			/* tos link detected */
+	    rear_ac97: 1;			/* rear channels are on AC'97 */
 	unsigned int audigy;			/* is Audigy? */
 	unsigned int revision;			/* chip revision */
 	unsigned int serial;			/* serial number */
@@ -1184,8 +1186,8 @@
 #define EXTOUT_AC97_R	   0x01	/* AC'97 playback channel - right */
 #define EXTOUT_TOSLINK_L   0x02	/* LiveDrive - TOSLink Optical - left */
 #define EXTOUT_TOSLINK_R   0x03	/* LiveDrive - TOSLink Optical - right */
-#define EXTOUT_CENTER      0x04	/* SB Live 5.1 - center */
-#define EXTOUT_LFE         0x05 /* SB Live 5.1 - LFE */
+#define EXTOUT_AC97_CENTER 0x04	/* SB Live 5.1 - center */
+#define EXTOUT_AC97_LFE	   0x05 /* SB Live 5.1 - LFE */
 #define EXTOUT_HEADPHONE_L 0x06	/* LiveDrive - Headphone - left */
 #define EXTOUT_HEADPHONE_R 0x07	/* LiveDrive - Headphone - right */
 #define EXTOUT_REAR_L	   0x08	/* Rear channel - left */
@@ -1193,6 +1195,8 @@
 #define EXTOUT_ADC_CAP_L   0x0a	/* ADC Capture buffer - left */
 #define EXTOUT_ADC_CAP_R   0x0b	/* ADC Capture buffer - right */
 #define EXTOUT_MIC_CAP	   0x0c	/* MIC Capture buffer */
+#define EXTOUT_AC97_REAR_L 0x0d	/* SB Live 5.1 (c) 2003 - Rear Left */
+#define EXTOUT_AC97_REAR_R 0x0e	/* SB Live 5.1 (c) 2003 - Rear Right */
 #define EXTOUT_ACENTER	   0x11 /* Analog Center */
 #define EXTOUT_ALFE	   0x12 /* Analog LFE */
 
@@ -1313,14 +1317,14 @@
 	unsigned int gpr_map[0x100];	  /* initializers */
 
 	unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
-	emu10k1_fx8010_control_gpr_t *gpr_add_controls; /* GPR controls to add/replace */
+	emu10k1_fx8010_control_gpr_t __user *gpr_add_controls; /* GPR controls to add/replace */
 
 	unsigned int gpr_del_control_count; /* count of GPR controls to remove */
-	snd_ctl_elem_id_t *gpr_del_controls; /* IDs of GPR controls to remove */
+	snd_ctl_elem_id_t __user *gpr_del_controls; /* IDs of GPR controls to remove */
 
 	unsigned int gpr_list_control_count; /* count of GPR controls to list */
 	unsigned int gpr_list_control_total; /* total count of GPR controls */
-	emu10k1_fx8010_control_gpr_t *gpr_list_controls; /* listed GPR controls */
+	emu10k1_fx8010_control_gpr_t __user *gpr_list_controls; /* listed GPR controls */
 
 	unsigned long tram_valid[0xa0/(sizeof(unsigned long)*8)]; /* bitmask of valid initializers */
 	unsigned int tram_data_map[0xa0]; /* data initializers */
diff -Nru a/include/sound/emux_synth.h b/include/sound/emux_synth.h
--- a/include/sound/emux_synth.h	Tue Jun 15 22:20:43 2004
+++ b/include/sound/emux_synth.h	Tue Jun 15 22:20:43 2004
@@ -60,7 +60,7 @@
 	void (*free_voice)(snd_emux_voice_t *vp);
 	void (*reset)(snd_emux_t *emu, int ch);
 	/* the first parameters are snd_emux_t */
-	int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void *data, long count);
+	int (*sample_new)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr, const void __user *data, long count);
 	int (*sample_free)(snd_emux_t *emu, snd_sf_sample_t *sp, snd_util_memhdr_t *hdr);
 	void (*sample_reset)(snd_emux_t *emu);
 	int (*load_fx)(snd_emux_t *emu, int type, int arg, const void __user *data, long count);
diff -Nru a/include/sound/gus.h b/include/sound/gus.h
--- a/include/sound/gus.h	Tue Jun 15 22:20:36 2004
+++ b/include/sound/gus.h	Tue Jun 15 22:20:36 2004
@@ -684,9 +684,9 @@
 #endif
 
 /* gus_dram.c */
-int snd_gus_dram_write(snd_gus_card_t *gus, char *ptr,
+int snd_gus_dram_write(snd_gus_card_t *gus, char __user *ptr,
 		       unsigned int addr, unsigned int size);
-int snd_gus_dram_read(snd_gus_card_t *gus, char *ptr,
+int snd_gus_dram_read(snd_gus_card_t *gus, char __user *ptr,
 		      unsigned int addr, unsigned int size, int rom);
 
 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
@@ -699,21 +699,21 @@
 
 /* gus_instr.c */
 int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave,
-			      char *data, long len, int atomic);
+			      char __user *data, long len, int atomic);
 int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave,
-			      char *data, long len, int atomic);
+			      char __user *data, long len, int atomic);
 int snd_gus_iwffff_remove_sample(void *private_data, iwffff_wave_t *wave,
 				 int atomic);
 int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave,
-			   char *data, long len, int atomic);
+			   char __user *data, long len, int atomic);
 int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave,
-			   char *data, long len, int atomic);
+			   char __user *data, long len, int atomic);
 int snd_gus_gf1_remove_sample(void *private_data, gf1_wave_t *wave,
 			      int atomic);
 int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr,
-			      char *data, long len, int atomic);
+			      char __user *data, long len, int atomic);
 int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr,
-			      char *data, long len, int atomic);
+			      char __user *data, long len, int atomic);
 int snd_gus_simple_remove_sample(void *private_data, simple_instrument_t *instr,
 				 int atomic);
 
diff -Nru a/include/sound/hdsp.h b/include/sound/hdsp.h
--- a/include/sound/hdsp.h	Tue Jun 15 22:20:58 2004
+++ b/include/sound/hdsp.h	Tue Jun 15 22:20:58 2004
@@ -76,7 +76,7 @@
 typedef struct _snd_hdsp_firmware hdsp_firmware_t;
 
 struct _snd_hdsp_firmware {
-	unsigned long *firmware_data;	/* 24413 long words */
+	unsigned long __user *firmware_data;	/* 24413 long words */
 };
 
 #define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t)
diff -Nru a/include/sound/hwdep.h b/include/sound/hwdep.h
--- a/include/sound/hwdep.h	Tue Jun 15 22:20:39 2004
+++ b/include/sound/hwdep.h	Tue Jun 15 22:20:39 2004
@@ -32,8 +32,8 @@
 
 typedef struct _snd_hwdep_ops {
 	long long (*llseek) (snd_hwdep_t *hw, struct file * file, long long offset, int orig);
-	long (*read) (snd_hwdep_t * hw, char *buf, long count, loff_t *offset);
-	long (*write) (snd_hwdep_t * hw, const char *buf, long count, loff_t *offset);
+	long (*read) (snd_hwdep_t * hw, char __user *buf, long count, loff_t *offset);
+	long (*write) (snd_hwdep_t * hw, const char __user *buf, long count, loff_t *offset);
 	int (*open) (snd_hwdep_t * hw, struct file * file);
 	int (*release) (snd_hwdep_t * hw, struct file * file);
 	unsigned int (*poll) (snd_hwdep_t * hw, struct file * file, poll_table * wait);
diff -Nru a/include/sound/info.h b/include/sound/info.h
--- a/include/sound/info.h	Tue Jun 15 22:20:43 2004
+++ b/include/sound/info.h	Tue Jun 15 22:20:43 2004
@@ -54,9 +54,9 @@
 	int (*release) (snd_info_entry_t * entry,
 			unsigned short mode, void *file_private_data);
 	long (*read) (snd_info_entry_t *entry, void *file_private_data,
-		      struct file * file, char *buf, long count);
+		      struct file * file, char __user *buf, long count);
 	long (*write) (snd_info_entry_t *entry, void *file_private_data,
-		       struct file * file, const char *buf, long count);
+		       struct file * file, const char __user *buf, long count);
 	long long (*llseek) (snd_info_entry_t *entry, void *file_private_data,
 			    struct file * file, long long offset, int orig);
 	unsigned int (*poll) (snd_info_entry_t *entry, void *file_private_data,
diff -Nru a/include/sound/initval.h b/include/sound/initval.h
--- a/include/sound/initval.h	Tue Jun 15 22:20:36 2004
+++ b/include/sound/initval.h	Tue Jun 15 22:20:36 2004
@@ -133,44 +133,4 @@
 }
 #endif
 
-#if defined(SNDRV_GET_ID) && !defined(MODULE)
-#include <linux/ctype.h>
-#include <linux/init.h>
-#include <linux/bootmem.h>
-static int __init get_id(char **str, char **dst)
-{
-	char *s;
-
-	if (!(*str) || !(**str))
-		return 0;
-	for (s = *str; isalpha(*s) || isdigit(*s) || *s == '_'; s++);
-	if (s != *str) {
-		int len = s - *str;
-		char *d = (char *)alloc_bootmem(len + 1);
-		if (d != NULL) {
-			memcpy(*dst = d, *str, len);
-			d[len] = '\0';
-		}
-	}
-	if (*s == ',') {
-		*str = s + 1;
-		return 2;
-	}
-	*str = s;
-	return 1;
-}
-#endif
-
-/* simple wrapper for long variable.
- * the value more than 32bit won't work!
- */
-inline static int get_option_long(char **str, long *valp)
-{
-	int val, ret;
-	ret = get_option(str, &val);
-	if (ret)
-		*valp = val;
-	return ret;
-}
-
 #endif /* __SOUND_INITVAL_H */
diff -Nru a/include/sound/pcm.h b/include/sound/pcm.h
--- a/include/sound/pcm.h	Tue Jun 15 22:20:40 2004
+++ b/include/sound/pcm.h	Tue Jun 15 22:20:40 2004
@@ -95,7 +95,7 @@
 	int (*trigger)(snd_pcm_substream_t * substream, int cmd);
 	snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream);
 	int (*copy)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos,
-		    void *buf, snd_pcm_uframes_t count);
+		    void __user *buf, snd_pcm_uframes_t count);
 	int (*silence)(snd_pcm_substream_t *substream, int channel, 
 		       snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
 	struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset);
@@ -479,7 +479,7 @@
 extern rwlock_t snd_pcm_link_rwlock;
 
 int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info);
-int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t *info);
+int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info);
 int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status);
 int snd_pcm_prepare(snd_pcm_substream_t *substream);
 int snd_pcm_start(snd_pcm_substream_t *substream);
@@ -881,13 +881,14 @@
 void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream);
 void snd_pcm_period_elapsed(snd_pcm_substream_t *substream);
 snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream,
-				    const void *buf, snd_pcm_uframes_t frames);
+				    const void __user *buf,
+				    snd_pcm_uframes_t frames);
 snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream,
-				   void *buf, snd_pcm_uframes_t frames);
+				   void __user *buf, snd_pcm_uframes_t frames);
 snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream,
-				     void **bufs, snd_pcm_uframes_t frames);
+				     void __user **bufs, snd_pcm_uframes_t frames);
 snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream,
-				    void **bufs, snd_pcm_uframes_t frames);
+				    void __user **bufs, snd_pcm_uframes_t frames);
 
 int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime);
 
diff -Nru a/include/sound/seq_instr.h b/include/sound/seq_instr.h
--- a/include/sound/seq_instr.h	Tue Jun 15 22:20:42 2004
+++ b/include/sound/seq_instr.h	Tue Jun 15 22:20:42 2004
@@ -79,9 +79,9 @@
 	char *instr_type;
 	int (*info)(void *private_data, char *info_data, long len);
 	int (*put)(void *private_data, snd_seq_kinstr_t *kinstr,
-		   char *instr_data, long len, int atomic, int cmd);
+		   char __user *instr_data, long len, int atomic, int cmd);
 	int (*get)(void *private_data, snd_seq_kinstr_t *kinstr,
-		   char *instr_data, long len, int atomic, int cmd);
+		   char __user *instr_data, long len, int atomic, int cmd);
 	int (*get_size)(void *private_data, snd_seq_kinstr_t *kinstr, long *size);
 	int (*remove)(void *private_data, snd_seq_kinstr_t *kinstr, int atomic);
 	void (*notify)(void *private_data, snd_seq_kinstr_t *kinstr, int what);
diff -Nru a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
--- a/include/sound/seq_kernel.h	Tue Jun 15 22:21:03 2004
+++ b/include/sound/seq_kernel.h	Tue Jun 15 22:21:03 2004
@@ -158,7 +158,7 @@
 extern int snd_seq_delete_kernel_client(int client);
 extern int snd_seq_kernel_client_enqueue(int client, snd_seq_event_t *ev, int atomic, int hop);
 extern int snd_seq_kernel_client_dispatch(int client, snd_seq_event_t *ev, int atomic, int hop);
-extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void __user *arg);
+extern int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
 
 #define SNDRV_SEQ_EXT_MASK	0xc0000000
 #define SNDRV_SEQ_EXT_USRPTR	0x80000000
diff -Nru a/include/sound/seq_oss.h b/include/sound/seq_oss.h
--- a/include/sound/seq_oss.h	Tue Jun 15 22:20:35 2004
+++ b/include/sound/seq_oss.h	Tue Jun 15 22:20:35 2004
@@ -58,7 +58,7 @@
 	int (*open)(snd_seq_oss_arg_t *p, void *closure);
 	int (*close)(snd_seq_oss_arg_t *p);
 	int (*ioctl)(snd_seq_oss_arg_t *p, unsigned int cmd, unsigned long arg);
-	int (*load_patch)(snd_seq_oss_arg_t *p, int format, const char *buf, int offs, int count);
+	int (*load_patch)(snd_seq_oss_arg_t *p, int format, const char __user *buf, int offs, int count);
 	int (*reset)(snd_seq_oss_arg_t *p);
 	int (*raw_event)(snd_seq_oss_arg_t *p, unsigned char *data);
 };
diff -Nru a/include/sound/sscape_ioctl.h b/include/sound/sscape_ioctl.h
--- a/include/sound/sscape_ioctl.h	Tue Jun 15 22:20:36 2004
+++ b/include/sound/sscape_ioctl.h	Tue Jun 15 22:20:36 2004
@@ -12,7 +12,7 @@
 
 struct sscape_microcode
 {
-  unsigned char *code;
+  unsigned char __user *code;
 };
 
 #define SND_SSCAPE_LOAD_BOOTB  _IOWR('P', 100, struct sscape_bootblock)
diff -Nru a/include/sound/timer.h b/include/sound/timer.h
--- a/include/sound/timer.h	Tue Jun 15 22:20:41 2004
+++ b/include/sound/timer.h	Tue Jun 15 22:20:41 2004
@@ -60,6 +60,7 @@
 #define SNDRV_TIMER_IFLG_FAST	  0x00000010	/* fast callback (do not use tasklet) */
 #define SNDRV_TIMER_IFLG_CALLBACK 0x00000020	/* timer callback is active */
 #define SNDRV_TIMER_IFLG_EXCLUSIVE 0x00000040	/* exclusive owner - no more instances */
+#define SNDRV_TIMER_IFLG_EARLY_EVENT 0x00000080	/* write early event to the poll queue */
 
 #define SNDRV_TIMER_FLG_CHANGE	0x00000001
 #define SNDRV_TIMER_FLG_RESCHED	0x00000002	/* need reschedule */
diff -Nru a/include/sound/trident.h b/include/sound/trident.h
--- a/include/sound/trident.h	Tue Jun 15 22:20:41 2004
+++ b/include/sound/trident.h	Tue Jun 15 22:20:41 2004
@@ -54,13 +54,6 @@
 #define TRIDENT_DEVICE_ID_NX		((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX)
 #define TRIDENT_DEVICE_ID_SI7018	((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018)
 
-/* Trident chipsets have 1GB memory limit */
-#ifdef __alpha__
-#define TRIDENT_DMA_TYPE        SNDRV_DMA_TYPE_PCI_16MB
-#else
-#define TRIDENT_DMA_TYPE        SNDRV_DMA_TYPE_PCI
-#endif
-
 #define SNDRV_SEQ_DEV_ID_TRIDENT			"trident-synth"
 
 #define SNDRV_TRIDENT_VOICE_TYPE_PCM		0
@@ -486,12 +479,6 @@
 snd_util_memblk_t *snd_trident_synth_alloc(trident_t *trident, unsigned int size);
 int snd_trident_synth_free(trident_t *trident, snd_util_memblk_t *blk);
 int snd_trident_synth_bzero(trident_t *trident, snd_util_memblk_t *blk, int offset, int size);
-int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char *data, int size);
-
-/* Power Management */
-#ifdef CONFIG_PM
-void snd_trident_suspend(trident_t *trident);
-void snd_trident_resume(trident_t *trident);
-#endif
+int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size);
 
 #endif /* __SOUND_TRIDENT_H */
diff -Nru a/include/sound/uda1341.h b/include/sound/uda1341.h
--- a/include/sound/uda1341.h	Tue Jun 15 22:20:42 2004
+++ b/include/sound/uda1341.h	Tue Jun 15 22:20:42 2004
@@ -15,7 +15,7 @@
  *                           features support
  */
 
-/* $Id: uda1341.h,v 1.5 2003/04/19 13:34:32 perex Exp $ */
+/* $Id: uda1341.h,v 1.6 2004/05/03 17:36:50 tiwai Exp $ */
 
 #define UDA1341_ALSA_NAME "snd-uda1341"
 
diff -Nru a/include/sound/version.h b/include/sound/version.h
--- a/include/sound/version.h	Tue Jun 15 22:20:39 2004
+++ b/include/sound/version.h	Tue Jun 15 22:20:39 2004
@@ -1,3 +1,3 @@
 /* include/version.h.  Generated by configure.  */
-#define CONFIG_SND_VERSION "1.0.4rc2"
-#define CONFIG_SND_DATE " (Tue Mar 30 08:19:30 2004 UTC)"
+#define CONFIG_SND_VERSION "1.0.4"
+#define CONFIG_SND_DATE " (Mon May 17 14:31:44 2004 UTC)"
diff -Nru a/include/sound/vx_core.h b/include/sound/vx_core.h
--- a/include/sound/vx_core.h	Tue Jun 15 22:20:36 2004
+++ b/include/sound/vx_core.h	Tue Jun 15 22:20:36 2004
@@ -254,13 +254,13 @@
 inline static void snd_vx_outb(vx_core_t *chip, int reg, unsigned char val)
 {
 	snd_assert(chip->ops->out8, return);
-	return chip->ops->out8(chip, reg, val);
+	chip->ops->out8(chip, reg, val);
 }
 
 inline static void snd_vx_outl(vx_core_t *chip, int reg, unsigned int val)
 {
 	snd_assert(chip->ops->out32, return);
-	return chip->ops->out32(chip, reg, val);
+	chip->ops->out32(chip, reg, val);
 }
 
 #define vx_inb(chip,reg)	snd_vx_inb(chip, VX_##reg)
diff -Nru a/include/sound/wavefront.h b/include/sound/wavefront.h
--- a/include/sound/wavefront.h	Tue Jun 15 22:20:38 2004
+++ b/include/sound/wavefront.h	Tue Jun 15 22:20:38 2004
@@ -554,8 +554,8 @@
 				  WF_{GET,SET}_CHANNEL above.
 
 			       */
-    wavefront_any *hdrptr;      /* user-space ptr to hdr bytes */
-    u16 *dataptr;            /* actual sample data */
+    wavefront_any __user *hdrptr;      /* user-space ptr to hdr bytes */
+    u16 __user *dataptr;            /* actual sample data */
 
     wavefront_any hdr;          /* kernel-space copy of hdr bytes */         
 } wavefront_patch_info;
diff -Nru a/include/sound/ymfpci.h b/include/sound/ymfpci.h
--- a/include/sound/ymfpci.h	Tue Jun 15 22:20:39 2004
+++ b/include/sound/ymfpci.h	Tue Jun 15 22:20:39 2004
@@ -393,11 +393,6 @@
 int snd_ymfpci_voice_alloc(ymfpci_t *chip, ymfpci_voice_type_t type, int pair, ymfpci_voice_t **rvoice);
 int snd_ymfpci_voice_free(ymfpci_t *chip, ymfpci_voice_t *pvoice);
 
-#ifdef CONFIG_PM
-void snd_ymfpci_suspend(ymfpci_t *chip);
-void snd_ymfpci_resume(ymfpci_t *chip);
-#endif
-
 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
 #define SUPPORT_JOYSTICK
 #endif
diff -Nru a/include/video/gbe.h b/include/video/gbe.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/video/gbe.h	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,317 @@
+/*
+ * include/video/gbe.h -- SGI GBE (Graphics Back End)
+ *
+ * Copyright (C) 1999 Silicon Graphics, Inc. (Jeffrey Newquist)
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License version 2 as published by the Free Software Foundation.
+ */
+
+#ifndef __GBE_H__
+#define __GBE_H__
+
+struct sgi_gbe {
+	volatile uint32_t ctrlstat;	/* general control */
+	volatile uint32_t dotclock;	/* dot clock PLL control */
+	volatile uint32_t i2c;		/* crt I2C control */
+	volatile uint32_t sysclk;	/* system clock PLL control */
+	volatile uint32_t i2cfp;	/* flat panel I2C control */
+	volatile uint32_t id;		/* device id/chip revision */
+	volatile uint32_t config;       /* power on configuration [1] */
+	volatile uint32_t bist;         /* internal bist status [1] */
+	uint32_t _pad0[0x010000/4 - 8];
+	volatile uint32_t vt_xy;	/* current dot coords */
+	volatile uint32_t vt_xymax;	/* maximum dot coords */
+	volatile uint32_t vt_vsync;	/* vsync on/off */
+	volatile uint32_t vt_hsync;	/* hsync on/off */
+	volatile uint32_t vt_vblank;	/* vblank on/off */
+	volatile uint32_t vt_hblank;	/* hblank on/off */
+	volatile uint32_t vt_flags;	/* polarity of vt signals */
+	volatile uint32_t vt_f2rf_lock;	/* f2rf & framelck y coord */
+	volatile uint32_t vt_intr01;	/* intr 0,1 y coords */
+	volatile uint32_t vt_intr23;	/* intr 2,3 y coords */
+	volatile uint32_t fp_hdrv;	/* flat panel hdrv on/off */
+	volatile uint32_t fp_vdrv;	/* flat panel vdrv on/off */
+	volatile uint32_t fp_de;	/* flat panel de on/off */
+	volatile uint32_t vt_hpixen;	/* intrnl horiz pixel on/off */
+	volatile uint32_t vt_vpixen;	/* intrnl vert pixel on/off */
+	volatile uint32_t vt_hcmap;	/* cmap write (horiz) */
+	volatile uint32_t vt_vcmap;	/* cmap write (vert) */
+	volatile uint32_t did_start_xy;	/* eol/f did/xy reset val */
+	volatile uint32_t crs_start_xy;	/* eol/f crs/xy reset val */
+	volatile uint32_t vc_start_xy;	/* eol/f vc/xy reset val */
+	uint32_t _pad1[0xffb0/4];
+	volatile uint32_t ovr_width_tile;/*overlay plane ctrl 0 */
+	volatile uint32_t ovr_inhwctrl;	/* overlay plane ctrl 1 */
+	volatile uint32_t ovr_control;	/* overlay plane ctrl 1 */
+	uint32_t _pad2[0xfff4/4];
+	volatile uint32_t frm_size_tile;/* normal plane ctrl 0 */
+	volatile uint32_t frm_size_pixel;/*normal plane ctrl 1 */
+	volatile uint32_t frm_inhwctrl;	/* normal plane ctrl 2 */
+	volatile uint32_t frm_control;	/* normal plane ctrl 3 */
+	uint32_t _pad3[0xfff0/4];
+	volatile uint32_t did_inhwctrl;	/* DID control */
+	volatile uint32_t did_control;	/* DID shadow */
+	uint32_t _pad4[0x7ff8/4];
+	volatile uint32_t mode_regs[32];/* WID table */
+	uint32_t _pad5[0x7f80/4];
+	volatile uint32_t cmap[6144];	/* color map */
+	uint32_t _pad6[0x2000/4];
+	volatile uint32_t cm_fifo;	/* color map fifo status */
+	uint32_t _pad7[0x7ffc/4];
+	volatile uint32_t gmap[256];	/* gamma map */
+	uint32_t _pad8[0x7c00/4];
+	volatile uint32_t gmap10[1024];	/* gamma map */
+	uint32_t _pad9[0x7000/4];
+	volatile uint32_t crs_pos;	/* cusror control 0 */
+	volatile uint32_t crs_ctl;	/* cusror control 1 */
+	volatile uint32_t crs_cmap[3];	/* crs cmap */
+	uint32_t _pad10[0x7fec/4];
+	volatile uint32_t crs_glyph[64];/* crs glyph */
+	uint32_t _pad11[0x7f00/4];
+	volatile uint32_t vc_0;	/* video capture crtl 0 */
+	volatile uint32_t vc_1;	/* video capture crtl 1 */
+	volatile uint32_t vc_2;	/* video capture crtl 2 */
+	volatile uint32_t vc_3;	/* video capture crtl 3 */
+	volatile uint32_t vc_4;	/* video capture crtl 4 */
+	volatile uint32_t vc_5;	/* video capture crtl 5 */
+	volatile uint32_t vc_6;	/* video capture crtl 6 */
+	volatile uint32_t vc_7;	/* video capture crtl 7 */
+	volatile uint32_t vc_8;	/* video capture crtl 8 */
+};
+
+#define MASK(msb, lsb)		\
+	( (((u32)1<<((msb)-(lsb)+1))-1) << (lsb) )
+#define GET(v, msb, lsb)	\
+	( ((u32)(v) & MASK(msb,lsb)) >> (lsb) )
+#define SET(v, f, msb, lsb)	\
+	( (v) = ((v)&~MASK(msb,lsb)) | (( (u32)(f)<<(lsb) ) & MASK(msb,lsb)) )
+
+#define GET_GBE_FIELD(reg, field, v)		\
+	GET((v), GBE_##reg##_##field##_MSB, GBE_##reg##_##field##_LSB)
+#define SET_GBE_FIELD(reg, field, v, f)		\
+	SET((v), (f), GBE_##reg##_##field##_MSB, GBE_##reg##_##field##_LSB)
+
+/*
+ * Bit mask information
+ */
+#define GBE_CTRLSTAT_CHIPID_MSB		 3
+#define GBE_CTRLSTAT_CHIPID_LSB		 0
+#define GBE_CTRLSTAT_SENSE_N_MSB	 4
+#define GBE_CTRLSTAT_SENSE_N_LSB	 4
+#define GBE_CTRLSTAT_PCLKSEL_MSB	29
+#define GBE_CTRLSTAT_PCLKSEL_LSB	28
+
+#define GBE_DOTCLK_M_MSB		 7
+#define GBE_DOTCLK_M_LSB		 0
+#define GBE_DOTCLK_N_MSB		13
+#define GBE_DOTCLK_N_LSB		 8
+#define GBE_DOTCLK_P_MSB		15
+#define GBE_DOTCLK_P_LSB		14
+#define GBE_DOTCLK_RUN_MSB		20
+#define GBE_DOTCLK_RUN_LSB		20
+
+#define GBE_VT_XY_Y_MSB		23
+#define GBE_VT_XY_Y_LSB		12
+#define GBE_VT_XY_X_MSB		11
+#define GBE_VT_XY_X_LSB		 0
+#define GBE_VT_XY_FREEZE_MSB		31
+#define GBE_VT_XY_FREEZE_LSB		31
+
+#define GBE_FP_VDRV_ON_MSB	23
+#define GBE_FP_VDRV_ON_LSB	12
+#define GBE_FP_VDRV_OFF_MSB	11
+#define GBE_FP_VDRV_OFF_LSB	0
+
+#define GBE_FP_HDRV_ON_MSB	23
+#define GBE_FP_HDRV_ON_LSB	12
+#define GBE_FP_HDRV_OFF_MSB	11
+#define GBE_FP_HDRV_OFF_LSB	0
+
+#define GBE_FP_DE_ON_MSB		23
+#define GBE_FP_DE_ON_LSB		12
+#define GBE_FP_DE_OFF_MSB		11
+#define GBE_FP_DE_OFF_LSB		0
+
+#define GBE_VT_VSYNC_VSYNC_ON_MSB	23
+#define GBE_VT_VSYNC_VSYNC_ON_LSB	12
+#define GBE_VT_VSYNC_VSYNC_OFF_MSB	11
+#define GBE_VT_VSYNC_VSYNC_OFF_LSB	 0
+
+#define GBE_VT_HSYNC_HSYNC_ON_MSB	23
+#define GBE_VT_HSYNC_HSYNC_ON_LSB	12
+#define GBE_VT_HSYNC_HSYNC_OFF_MSB	11
+#define GBE_VT_HSYNC_HSYNC_OFF_LSB	 0
+
+#define GBE_VT_VBLANK_VBLANK_ON_MSB	23
+#define GBE_VT_VBLANK_VBLANK_ON_LSB	12
+#define GBE_VT_VBLANK_VBLANK_OFF_MSB	11
+#define GBE_VT_VBLANK_VBLANK_OFF_LSB	 0
+
+#define GBE_VT_HBLANK_HBLANK_ON_MSB	23
+#define GBE_VT_HBLANK_HBLANK_ON_LSB	12
+#define GBE_VT_HBLANK_HBLANK_OFF_MSB	11
+#define GBE_VT_HBLANK_HBLANK_OFF_LSB	 0
+
+#define GBE_VT_FLAGS_F2RF_HIGH_MSB	 6
+#define GBE_VT_FLAGS_F2RF_HIGH_LSB	 6
+#define GBE_VT_FLAGS_SYNC_LOW_MSB	 5
+#define GBE_VT_FLAGS_SYNC_LOW_LSB	 5
+#define GBE_VT_FLAGS_SYNC_HIGH_MSB	 4
+#define GBE_VT_FLAGS_SYNC_HIGH_LSB	 4
+#define GBE_VT_FLAGS_HDRV_LOW_MSB	 3
+#define GBE_VT_FLAGS_HDRV_LOW_LSB	 3
+#define GBE_VT_FLAGS_HDRV_INVERT_MSB	 2
+#define GBE_VT_FLAGS_HDRV_INVERT_LSB	 2
+#define GBE_VT_FLAGS_VDRV_LOW_MSB	 1
+#define GBE_VT_FLAGS_VDRV_LOW_LSB	 1
+#define GBE_VT_FLAGS_VDRV_INVERT_MSB	 0
+#define GBE_VT_FLAGS_VDRV_INVERT_LSB	 0
+
+#define GBE_VT_VCMAP_VCMAP_ON_MSB	23
+#define GBE_VT_VCMAP_VCMAP_ON_LSB	12
+#define GBE_VT_VCMAP_VCMAP_OFF_MSB	11
+#define GBE_VT_VCMAP_VCMAP_OFF_LSB	 0
+
+#define GBE_VT_HCMAP_HCMAP_ON_MSB	23
+#define GBE_VT_HCMAP_HCMAP_ON_LSB	12
+#define GBE_VT_HCMAP_HCMAP_OFF_MSB	11
+#define GBE_VT_HCMAP_HCMAP_OFF_LSB	 0
+
+#define GBE_VT_XYMAX_MAXX_MSB	11
+#define GBE_VT_XYMAX_MAXX_LSB	 0
+#define GBE_VT_XYMAX_MAXY_MSB	23
+#define GBE_VT_XYMAX_MAXY_LSB	12
+
+#define GBE_VT_HPIXEN_HPIXEN_ON_MSB	23
+#define GBE_VT_HPIXEN_HPIXEN_ON_LSB	12
+#define GBE_VT_HPIXEN_HPIXEN_OFF_MSB	11
+#define GBE_VT_HPIXEN_HPIXEN_OFF_LSB	 0
+
+#define GBE_VT_VPIXEN_VPIXEN_ON_MSB	23
+#define GBE_VT_VPIXEN_VPIXEN_ON_LSB	12
+#define GBE_VT_VPIXEN_VPIXEN_OFF_MSB	11
+#define GBE_VT_VPIXEN_VPIXEN_OFF_LSB	 0
+
+#define GBE_OVR_CONTROL_OVR_DMA_ENABLE_MSB	 0
+#define GBE_OVR_CONTROL_OVR_DMA_ENABLE_LSB	 0
+
+#define GBE_OVR_INHWCTRL_OVR_DMA_ENABLE_MSB	 0
+#define GBE_OVR_INHWCTRL_OVR_DMA_ENABLE_LSB	 0
+
+#define GBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_MSB	13
+#define GBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_LSB	13
+
+#define GBE_FRM_CONTROL_FRM_DMA_ENABLE_MSB	 0
+#define GBE_FRM_CONTROL_FRM_DMA_ENABLE_LSB	 0
+#define GBE_FRM_CONTROL_FRM_TILE_PTR_MSB	31
+#define GBE_FRM_CONTROL_FRM_TILE_PTR_LSB	 9
+#define GBE_FRM_CONTROL_FRM_LINEAR_MSB		 1
+#define GBE_FRM_CONTROL_FRM_LINEAR_LSB		 1
+
+#define GBE_FRM_INHWCTRL_FRM_DMA_ENABLE_MSB	 0
+#define GBE_FRM_INHWCTRL_FRM_DMA_ENABLE_LSB	 0
+
+#define GBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_MSB	12
+#define GBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_LSB	 5
+#define GBE_FRM_SIZE_TILE_FRM_RHS_MSB		 4
+#define GBE_FRM_SIZE_TILE_FRM_RHS_LSB		 0
+#define GBE_FRM_SIZE_TILE_FRM_DEPTH_MSB		14
+#define GBE_FRM_SIZE_TILE_FRM_DEPTH_LSB		13
+#define GBE_FRM_SIZE_TILE_FRM_FIFO_RESET_MSB	15
+#define GBE_FRM_SIZE_TILE_FRM_FIFO_RESET_LSB	15
+
+#define GBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_MSB	31
+#define GBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_LSB	16
+
+#define GBE_DID_CONTROL_DID_DMA_ENABLE_MSB	 0
+#define GBE_DID_CONTROL_DID_DMA_ENABLE_LSB	 0
+#define GBE_DID_INHWCTRL_DID_DMA_ENABLE_MSB	 0
+#define GBE_DID_INHWCTRL_DID_DMA_ENABLE_LSB	 0
+
+#define GBE_DID_START_XY_DID_STARTY_MSB		23
+#define GBE_DID_START_XY_DID_STARTY_LSB		12
+#define GBE_DID_START_XY_DID_STARTX_MSB		11
+#define GBE_DID_START_XY_DID_STARTX_LSB		 0
+
+#define GBE_CRS_START_XY_CRS_STARTY_MSB		23
+#define GBE_CRS_START_XY_CRS_STARTY_LSB		12
+#define GBE_CRS_START_XY_CRS_STARTX_MSB		11
+#define GBE_CRS_START_XY_CRS_STARTX_LSB		 0
+
+#define GBE_WID_AUX_MSB		12
+#define GBE_WID_AUX_LSB		11
+#define GBE_WID_GAMMA_MSB	10
+#define GBE_WID_GAMMA_LSB	10
+#define GBE_WID_CM_MSB		 9
+#define GBE_WID_CM_LSB		 5
+#define GBE_WID_TYP_MSB		 4
+#define GBE_WID_TYP_LSB		 2
+#define GBE_WID_BUF_MSB		 1
+#define GBE_WID_BUF_LSB		 0
+
+#define GBE_VC_START_XY_VC_STARTY_MSB	23
+#define GBE_VC_START_XY_VC_STARTY_LSB	12
+#define GBE_VC_START_XY_VC_STARTX_MSB	11
+#define GBE_VC_START_XY_VC_STARTX_LSB	 0
+
+/* Constants */
+
+#define GBE_FRM_DEPTH_8		0
+#define GBE_FRM_DEPTH_16	1
+#define GBE_FRM_DEPTH_32	2
+
+#define GBE_CMODE_I8		0
+#define GBE_CMODE_I12		1
+#define GBE_CMODE_RG3B2		2
+#define GBE_CMODE_RGB4		3
+#define GBE_CMODE_ARGB5		4
+#define GBE_CMODE_RGB8		5
+#define GBE_CMODE_RGBA5		6
+#define GBE_CMODE_RGB10		7
+
+#define GBE_BMODE_BOTH		3
+
+#define GBE_CRS_MAGIC		54
+#define GBE_PIXEN_MAGIC_ON	19
+#define GBE_PIXEN_MAGIC_OFF	 2
+
+#define GBE_TLB_SIZE		128
+
+/* [1] - only GBE revision 2 and later */
+
+/*
+ * Video Timing Data Structure
+ */
+
+struct gbe_timing_info {
+	int flags;
+	short width;		/* Monitor resolution */
+	short height;
+	int fields_sec;		/* fields/sec  (Hz -3 dec. places */
+	int cfreq;		/* pixel clock frequency (MHz -3 dec. places) */
+	short htotal;		/* Horizontal total pixels */
+	short hblank_start;	/* Horizontal blank start */
+	short hblank_end;	/* Horizontal blank end */
+	short hsync_start;	/* Horizontal sync start */
+	short hsync_end;	/* Horizontal sync end */
+	short vtotal;		/* Vertical total lines */
+	short vblank_start;	/* Vertical blank start */
+	short vblank_end;	/* Vertical blank end */
+	short vsync_start;	/* Vertical sync start */
+	short vsync_end;	/* Vertical sync end */
+	short pll_m;		/* PLL M parameter */
+	short pll_n;		/* PLL P parameter */
+	short pll_p;		/* PLL N parameter */
+};
+
+/* Defines for gbe_vof_info_t flags */
+
+#define GBE_VOF_UNKNOWNMON	1
+#define GBE_VOF_STEREO		2
+#define GBE_VOF_DO_GENSYNC	4	/* enable incoming sync */
+#define GBE_VOF_SYNC_ON_GREEN	8	/* sync on green */
+#define GBE_VOF_FLATPANEL	0x1000	/* FLATPANEL Timing */
+#define GBE_VOF_MAGICKEY	0x2000	/* Backdoor key */
+
+#endif		/* ! __GBE_H__ */
diff -Nru a/include/video/neomagic.h b/include/video/neomagic.h
--- a/include/video/neomagic.h	Tue Jun 15 22:20:39 2004
+++ b/include/video/neomagic.h	Tue Jun 15 22:20:39 2004
@@ -55,6 +55,20 @@
 #define NEO_MODE1_X_1600        0x1c00
 #define NEO_MODE1_BLT_ON_ADDR   0x2000
 
+/* These are offseted in MMIO space by par->CursorOff */
+#define NEOREG_CURSCNTL		0x00
+#define NEOREG_CURSX		0x04
+#define NEOREG_CURSY		0x08
+#define NEOREG_CURSBGCOLOR	0x0C
+#define NEOREG_CURSFGCOLOR	0x10
+#define NEOREG_CURSMEMPOS	0x14
+
+#define NEO_CURS_DISABLE	0x00000000
+#define NEO_CURS_ENABLE		0x00000001
+#define NEO_ICON64_ENABLE	0x00000008
+#define NEO_ICON128_ENABLE	0x0000000C
+#define NEO_ICON_BLANK		0x00000010
+
 #ifdef __KERNEL__
 
 #ifdef NEOFB_DEBUG
@@ -75,191 +89,116 @@
 
 
 struct xtimings {
-  unsigned int pixclock;
-  unsigned int HDisplay;
-  unsigned int HSyncStart;
-  unsigned int HSyncEnd;
-  unsigned int HTotal;
-  unsigned int VDisplay;
-  unsigned int VSyncStart;
-  unsigned int VSyncEnd;
-  unsigned int VTotal;
-  unsigned int sync;
-  int	       dblscan;
-  int	       interlaced;
+	unsigned int pixclock;
+	unsigned int HDisplay;
+	unsigned int HSyncStart;
+	unsigned int HSyncEnd;
+	unsigned int HTotal;
+	unsigned int VDisplay;
+	unsigned int VSyncStart;
+	unsigned int VSyncEnd;
+	unsigned int VTotal;
+	unsigned int sync;
+	int dblscan;
+	int interlaced;
 };
 
 
 /* --------------------------------------------------------------------- */
 
 typedef volatile struct {
-  __u32 bltStat;
-  __u32 bltCntl;
-  __u32 xpColor;
-  __u32 fgColor;
-  __u32 bgColor;
-  __u32 pitch;
-  __u32 clipLT;
-  __u32 clipRB;
-  __u32 srcBitOffset;
-  __u32 srcStart;
-  __u32 reserved0;
-  __u32 dstStart;
-  __u32 xyExt;
-
-  __u32 reserved1[19];
-
-  __u32 pageCntl;
-  __u32 pageBase;
-  __u32 postBase;
-  __u32 postPtr;
-  __u32 dataPtr;
+	__u32 bltStat;
+	__u32 bltCntl;
+	__u32 xpColor;
+	__u32 fgColor;
+	__u32 bgColor;
+	__u32 pitch;
+	__u32 clipLT;
+	__u32 clipRB;
+	__u32 srcBitOffset;
+	__u32 srcStart;
+	__u32 reserved0;
+	__u32 dstStart;
+	__u32 xyExt;
+
+	__u32 reserved1[19];
+
+	__u32 pageCntl;
+	__u32 pageBase;
+	__u32 postBase;
+	__u32 postPtr;
+	__u32 dataPtr;
 } Neo2200;
 
-#define NR_PALETTE	256
-
 #define MMIO_SIZE 0x200000
 
 #define NEO_EXT_CR_MAX 0x85
 #define NEO_EXT_GR_MAX 0xC7
 
 struct neofb_par {
-  
-  unsigned char MiscOutReg;     /* Misc */
-  unsigned char CRTC[25];       /* Crtc Controller */
-  unsigned char Sequencer[5];   /* Video Sequencer */
-  unsigned char Graphics[9];    /* Video Graphics */
-  unsigned char Attribute[21];  /* Video Atribute */
-
-  unsigned char GeneralLockReg;
-  unsigned char ExtCRTDispAddr;
-  unsigned char ExtCRTOffset;
-  unsigned char SysIfaceCntl1;
-  unsigned char SysIfaceCntl2;
-  unsigned char ExtColorModeSelect;
-  unsigned char biosMode;
-
-  unsigned char PanelDispCntlReg1;
-  unsigned char PanelDispCntlReg2;
-  unsigned char PanelDispCntlReg3;
-  unsigned char PanelVertCenterReg1;
-  unsigned char PanelVertCenterReg2;
-  unsigned char PanelVertCenterReg3;
-  unsigned char PanelVertCenterReg4;
-  unsigned char PanelVertCenterReg5;
-  unsigned char PanelHorizCenterReg1;
-  unsigned char PanelHorizCenterReg2;
-  unsigned char PanelHorizCenterReg3;
-  unsigned char PanelHorizCenterReg4;
-  unsigned char PanelHorizCenterReg5;
-
-  int           ProgramVCLK;
-  unsigned char VCLK3NumeratorLow;
-  unsigned char VCLK3NumeratorHigh;
-  unsigned char VCLK3Denominator;
-  unsigned char VerticalExt;
+	struct vgastate state;
+	atomic_t ref_count;
+
+	unsigned char MiscOutReg;	/* Misc */
+	unsigned char CRTC[25];		/* Crtc Controller */
+	unsigned char Sequencer[5];	/* Video Sequencer */
+	unsigned char Graphics[9];	/* Video Graphics */
+	unsigned char Attribute[21];	/* Video Atribute */
+
+	unsigned char GeneralLockReg;
+	unsigned char ExtCRTDispAddr;
+	unsigned char ExtCRTOffset;
+	unsigned char SysIfaceCntl1;
+	unsigned char SysIfaceCntl2;
+	unsigned char ExtColorModeSelect;
+	unsigned char biosMode;
+
+	unsigned char PanelDispCntlReg1;
+	unsigned char PanelDispCntlReg2;
+	unsigned char PanelDispCntlReg3;
+	unsigned char PanelVertCenterReg1;
+	unsigned char PanelVertCenterReg2;
+	unsigned char PanelVertCenterReg3;
+	unsigned char PanelVertCenterReg4;
+	unsigned char PanelVertCenterReg5;
+	unsigned char PanelHorizCenterReg1;
+	unsigned char PanelHorizCenterReg2;
+	unsigned char PanelHorizCenterReg3;
+	unsigned char PanelHorizCenterReg4;
+	unsigned char PanelHorizCenterReg5;
+
+	int ProgramVCLK;
+	unsigned char VCLK3NumeratorLow;
+	unsigned char VCLK3NumeratorHigh;
+	unsigned char VCLK3Denominator;
+	unsigned char VerticalExt;
 
 #ifdef CONFIG_MTRR
-  int    mtrr;
+	int mtrr;
 #endif
-  u8    *mmio_vbase;
-
-  Neo2200 *neo2200;
-
-  /* Panels size */
-  int NeoPanelWidth;
-  int NeoPanelHeight;
-
-  int maxClock;
-
-  int pci_burst;
-  int lcd_stretch;
-  int internal_display;
-  int external_display;
-  int libretto;
+	u8 *mmio_vbase;
+	u8 cursorOff;
+	u8 *cursorPad;		/* Must die !! */
+
+	Neo2200 *neo2200;
+
+	/* Panels size */
+	int NeoPanelWidth;
+	int NeoPanelHeight;
+
+	int maxClock;
+
+	int pci_burst;
+	int lcd_stretch;
+	int internal_display;
+	int external_display;
+	int libretto;
 };
 
 typedef struct {
-    int x_res;
-    int y_res;
-    int mode;
+	int x_res;
+	int y_res;
+	int mode;
 } biosMode;
 
-/* vga IO functions */
-static inline u8 VGArCR (u8 index)
-{
-  outb (index, 0x3d4);
-  return inb (0x3d5);
-}
-
-static inline void VGAwCR (u8 index, u8 val)
-{
-  outb (index, 0x3d4);
-  outb (val, 0x3d5);
-}
-
-static inline u8 VGArGR (u8 index)
-{
-  outb (index, 0x3ce);
-  return inb (0x3cf);
-}
-
-static inline void VGAwGR (u8 index, u8 val)
-{
-  outb (index, 0x3ce);
-  outb (val, 0x3cf);
-}
-
-static inline u8 VGArSEQ (u8 index)
-{
-  outb (index, 0x3c4);
-  return inb (0x3c5);
-}
-
-static inline void VGAwSEQ (u8 index, u8 val)
-{
-  outb (index, 0x3c4);
-  outb (val, 0x3c5);
-}
-
-
-static int paletteEnabled = 0;
-
-static inline void VGAenablePalette (void)
-{
-  u8 tmp;
-
-  tmp = inb (0x3da);
-  outb (0x00, 0x3c0);
-  paletteEnabled = 1;
-}
-
-static inline void VGAdisablePalette (void)
-{
-  u8 tmp;
-
-  tmp = inb (0x3da);
-  outb (0x20, 0x3c0);
-  paletteEnabled = 0;
-}
-
-static inline void VGAwATTR (u8 index, u8 value)
-{
-  u8 tmp;
-
-  if (paletteEnabled)
-    index &= ~0x20;
-  else
-    index |= 0x20;
-
-  tmp = inb (0x3da);
-  outb (index, 0x3c0);
-  outb (value, 0x3c0);
-}
-
-static inline void VGAwMISC (u8 value)
-{
-  outb (value, 0x3c2);
-}
 #endif
-
diff -Nru a/include/video/radeon.h b/include/video/radeon.h
--- a/include/video/radeon.h	Tue Jun 15 22:21:05 2004
+++ b/include/video/radeon.h	Tue Jun 15 22:21:05 2004
@@ -173,6 +173,8 @@
 #define CUR_CLR1                               0x0270  
 #define FP_HORZ_VERT_ACTIVE                    0x0278  
 #define CRTC_MORE_CNTL                         0x027C  
+#define CRTC_H_CUTOFF_ACTIVE_EN                (1<<4)
+#define CRTC_V_CUTOFF_ACTIVE_EN                (1<<5)
 #define DAC_EXT_CNTL                           0x0280  
 #define FP_GEN_CNTL                            0x0284  
 #define FP_HORZ_STRETCH                        0x028C  
@@ -185,6 +187,7 @@
 //#define DDA_ON_OFF			       0x02e4
 #define DVI_I2C_CNTL_1			       0x02e4
 #define GRPH_BUFFER_CNTL                       0x02F0
+#define GRPH2_BUFFER_CNTL                      0x03F0
 #define VGA_BUFFER_CNTL                        0x02F4
 #define OV0_Y_X_START                          0x0400
 #define OV0_Y_X_END                            0x0404  
@@ -1944,7 +1947,7 @@
 #define ixREG_COLLAR_WRITE                         0x0013
 #define ixREG_COLLAR_READ                          0x0014
 
-
+#define NB_TOM                                     0x15C
 
 
 #endif	/* _RADEON_H */
diff -Nru a/init/Kconfig b/init/Kconfig
--- a/init/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/init/Kconfig	Tue Jun 15 22:20:43 2004
@@ -92,7 +92,7 @@
 
 config POSIX_MQUEUE
 	bool "POSIX Message Queues"
-	depends on EXPERIMENTAL
+	depends on NET && EXPERIMENTAL
 	---help---
 	  POSIX variant of message queues is a part of IPC. In POSIX message
 	  queues every message has a priority which decides about succession
@@ -234,6 +234,17 @@
 	   Say Y here to let the kernel print out symbolic crash information and
 	   symbolic stack backtraces. This increases the size of the kernel
 	   somewhat, as all symbols have to be loaded into the kernel image.
+
+config KALLSYMS_ALL
+	bool "Include all symbols in kallsyms"
+	depends on DEBUG_KERNEL && KALLSYMS
+	help
+	   Normally kallsyms only contains the symbols of functions, for nicer
+	   OOPS messages.  Some debuggers can use kallsyms for other
+	   symbols too: say Y here to include all symbols, and you
+	   don't care about adding 300k to the size of your kernel.
+
+	   Say N.
 
 config FUTEX
 	bool "Enable futex support" if EMBEDDED
diff -Nru a/init/do_mounts_rd.c b/init/do_mounts_rd.c
--- a/init/do_mounts_rd.c	Tue Jun 15 22:20:42 2004
+++ b/init/do_mounts_rd.c	Tue Jun 15 22:20:42 2004
@@ -306,7 +306,7 @@
 
 static int  fill_inbuf(void);
 static void flush_window(void);
-static void *malloc(int size);
+static void *malloc(size_t size);
 static void free(void *where);
 static void error(char *m);
 static void gzip_mark(void **);
@@ -314,7 +314,7 @@
 
 #include "../lib/inflate.c"
 
-static void __init *malloc(int size)
+static void __init *malloc(size_t size)
 {
 	return kmalloc(size, GFP_KERNEL);
 }
diff -Nru a/init/initramfs.c b/init/initramfs.c
--- a/init/initramfs.c	Tue Jun 15 22:20:36 2004
+++ b/init/initramfs.c	Tue Jun 15 22:20:36 2004
@@ -207,7 +207,7 @@
 
 static int __init do_skip(void)
 {
-	if (this_header + count <= next_header) {
+	if (this_header + count < next_header) {
 		eat(count);
 		return 1;
 	} else {
diff -Nru a/init/main.c b/init/main.c
--- a/init/main.c	Tue Jun 15 22:20:37 2004
+++ b/init/main.c	Tue Jun 15 22:20:37 2004
@@ -42,6 +42,7 @@
 #include <linux/cpu.h>
 #include <linux/efi.h>
 #include <linux/unistd.h>
+#include <linux/rmap.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -84,7 +85,7 @@
 extern void buffer_init(void);
 extern void pidhash_init(void);
 extern void pidmap_init(void);
-extern void pte_chain_init(void);
+extern void prio_tree_init(void);
 extern void radix_tree_init(void);
 extern void free_initmem(void);
 extern void populate_rootfs(void);
@@ -95,7 +96,8 @@
 extern void tc_init(void);
 #endif
 
-int system_state;	/* SYSTEM_BOOTING/RUNNING/SHUTDOWN */
+enum system_states system_state;
+EXPORT_SYMBOL(system_state);
 
 /*
  * Boot command-line arguments
@@ -169,16 +171,14 @@
    still work even if initially too large, it will just take slightly longer */
 unsigned long loops_per_jiffy = (1<<12);
 
-#ifndef __ia64__
 EXPORT_SYMBOL(loops_per_jiffy);
-#endif
 
 /* This is the number of bits of precision for the loops_per_jiffy.  Each
    bit takes on average 1.5/HZ seconds.  This (like the original) is a little
    better than 1% */
 #define LPS_PREC 8
 
-void __init calibrate_delay(void)
+void __devinit calibrate_delay(void)
 {
 	unsigned long ticks, loopbit;
 	int lps_precision = LPS_PREC;
@@ -186,7 +186,7 @@
 	loops_per_jiffy = (1<<12);
 
 	printk("Calibrating delay loop... ");
-	while (loops_per_jiffy <<= 1) {
+	while ((loops_per_jiffy <<= 1) != 0) {
 		/* wait for "start of" clock tick */
 		ticks = jiffies;
 		while (ticks == jiffies)
@@ -351,20 +351,17 @@
 static void __init smp_init(void)
 {
 	unsigned int i;
-	unsigned j = 1;
 
 	/* FIXME: This should be done in userspace --RR */
-	for (i = 0; i < NR_CPUS; i++) {
+	for_each_present_cpu(i) {
 		if (num_online_cpus() >= max_cpus)
 			break;
-		if (cpu_possible(i) && !cpu_online(i)) {
+		if (!cpu_online(i))
 			cpu_up(i);
-			j++;
-		}
 	}
 
 	/* Any cleanup work */
-	printk("Brought up %u CPUs\n", j);
+	printk("Brought up %ld CPUs\n", (long)num_online_cpus());
 	smp_cpus_done(max_cpus);
 #if 0
 	/* Get other processors into their bootup holding patterns. */
@@ -417,6 +414,13 @@
 	 */
 	smp_prepare_boot_cpu();
 
+	/*
+	 * Set up the scheduler prior starting any interrupts (such as the
+	 * timer interrupt). Full topology setup happens at smp_init()
+	 * time - but meanwhile we still have a functioning scheduler.
+	 */
+	sched_init();
+
 	build_all_zonelists();
 	page_alloc_init();
 	printk("Kernel command line: %s\n", saved_command_line);
@@ -428,7 +432,7 @@
 	rcu_init();
 	init_IRQ();
 	pidhash_init();
-	sched_init();
+	init_timers();
 	softirq_init();
 	time_init();
 
@@ -457,7 +461,8 @@
 	calibrate_delay();
 	pidmap_init();
 	pgtable_cache_init();
-	pte_chain_init();
+	prio_tree_init();
+	anon_vma_init();
 #ifdef CONFIG_X86
 	if (efi_enabled)
 		efi_enter_virtual_mode();
@@ -476,7 +481,6 @@
 	proc_root_init();
 #endif
 	check_bugs();
-	printk("POSIX conformance testing by UNIFIX\n");
 
 	/* 
 	 *	We count on the initial thread going ok 
@@ -567,7 +571,6 @@
 
 	migration_init();
 #endif
-	node_nr_running_init();
 	spawn_ksoftirqd();
 }
 
@@ -577,6 +580,24 @@
 	execve(init_filename, argv_init, envp_init);
 }
 
+static inline void fixup_cpu_present_map(void)
+{
+#ifdef CONFIG_SMP
+	int i;
+
+	/*
+	 * If arch is not hotplug ready and did not populate
+	 * cpu_present_map, just make cpu_present_map same as cpu_possible_map
+	 * for other cpu bringup code to function as normal. e.g smp_init() etc.
+	 */
+	if (cpus_empty(cpu_present_map)) {
+		for_each_cpu(i) {
+			cpu_set(i, cpu_present_map);
+		}
+	}
+#endif
+}
+
 static int init(void * unused)
 {
 	lock_kernel();
@@ -595,7 +616,9 @@
 
 	do_pre_smp_initcalls();
 
+	fixup_cpu_present_map();
 	smp_init();
+	sched_init_smp();
 
 	/*
 	 * Do this before initcalls, because some drivers want to access
@@ -609,7 +632,7 @@
 	 * check if there is an early userspace init.  If yes, let it do all
 	 * the work
 	 */
-	if (sys_access("/init", 0) == 0)
+	if (sys_access((const char __user *) "/init", 0) == 0)
 		execute_command = "/init";
 	else
 		prepare_namespace();
@@ -623,7 +646,7 @@
 	unlock_kernel();
 	system_state = SYSTEM_RUNNING;
 
-	if (sys_open("/dev/console", O_RDWR, 0) < 0)
+	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
 		printk("Warning: unable to open an initial console.\n");
 
 	(void) sys_dup(0);
diff -Nru a/ipc/compat.c b/ipc/compat.c
--- a/ipc/compat.c	Tue Jun 15 22:20:41 2004
+++ b/ipc/compat.c	Tue Jun 15 22:20:41 2004
@@ -134,7 +134,7 @@
 }
 
 static inline int __get_compat_ipc64_perm(struct ipc64_perm *p64,
-					  struct compat_ipc64_perm *up64)
+					  struct compat_ipc64_perm __user *up64)
 {
 	int err;
 
@@ -145,7 +145,7 @@
 }
 
 static inline int __get_compat_ipc_perm(struct ipc64_perm *p,
-					struct compat_ipc_perm *up)
+					struct compat_ipc_perm __user *up)
 {
 	int err;
 
@@ -156,7 +156,7 @@
 }
 
 static inline int __put_compat_ipc64_perm(struct ipc64_perm *p64,
-					  struct compat_ipc64_perm *up64)
+					  struct compat_ipc64_perm __user *up64)
 {
 	int err;
 
@@ -171,7 +171,7 @@
 }
 
 static inline int __put_compat_ipc_perm(struct ipc64_perm *p,
-					struct compat_ipc_perm *up)
+					struct compat_ipc_perm __user *up)
 {
 	int err;
 	compat_uid_t u;
@@ -192,7 +192,7 @@
 }
 
 static inline int get_compat_semid64_ds(struct semid64_ds *s64,
-					struct compat_semid64_ds *up64)
+					struct compat_semid64_ds __user *up64)
 {
 	if (!access_ok (VERIFY_READ, up64, sizeof(*up64)))
 		return -EFAULT;
@@ -200,7 +200,7 @@
 }
 
 static inline int get_compat_semid_ds(struct semid64_ds *s,
-				      struct compat_semid_ds *up)
+				      struct compat_semid_ds __user *up)
 {
 	if (!access_ok (VERIFY_READ, up, sizeof(*up)))
 		return -EFAULT;
@@ -208,7 +208,7 @@
 }
 
 static inline int put_compat_semid64_ds(struct semid64_ds *s64,
-					struct compat_semid64_ds *up64)
+					struct compat_semid64_ds __user *up64)
 {
 	int err;
 
@@ -222,7 +222,7 @@
 }
 
 static inline int put_compat_semid_ds(struct semid64_ds *s,
-				      struct compat_semid_ds *up)
+				      struct compat_semid_ds __user *up)
 {
 	int err;
 
@@ -413,7 +413,7 @@
 }
 
 static inline int put_compat_msqid64_ds(struct msqid64_ds *m64,
-				 struct compat_msqid64_ds __user __user *up64)
+				 struct compat_msqid64_ds __user *up64)
 {
 	int err;
 
@@ -450,7 +450,7 @@
 	return err;
 }
 
-static inline int do_msgctl(int first, int second, void __user *buf)
+static inline int do_msgctl(int first, int second, void *buf)
 {
 	mm_segment_t old_fs;
 	int err;
@@ -712,7 +712,8 @@
 long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
 		unsigned nsops, const struct compat_timespec __user *timeout)
 {
-	struct timespec ts, __user *ts64;
+	struct timespec ts;
+	struct timespec __user *ts64;
 
 	/* parameter checking precedence should mirror sys_semtimedop() */
 	if (nsops < 1 || semid < 0)
diff -Nru a/ipc/compat_mq.c b/ipc/compat_mq.c
--- a/ipc/compat_mq.c	Tue Jun 15 22:20:39 2004
+++ b/ipc/compat_mq.c	Tue Jun 15 22:20:39 2004
@@ -77,7 +77,8 @@
 static struct timespec __user *compat_prepare_timeout(
 			const struct compat_timespec __user *u_abs_timeout)
 {
-	struct timespec ts, __user *u_ts;
+	struct timespec ts;
+	struct timespec __user *u_ts;
 
 	if (!u_abs_timeout)
 		return 0;
@@ -110,7 +111,7 @@
 			size_t msg_len, unsigned int __user *u_msg_prio,
 			const struct compat_timespec __user *u_abs_timeout)
 {
-	struct timespec *u_ts;
+	struct timespec __user *u_ts;
 
 	u_ts = compat_prepare_timeout(u_abs_timeout);
 	if (IS_ERR(u_ts))
diff -Nru a/ipc/mqueue.c b/ipc/mqueue.c
--- a/ipc/mqueue.c	Tue Jun 15 22:20:41 2004
+++ b/ipc/mqueue.c	Tue Jun 15 22:20:41 2004
@@ -97,7 +97,8 @@
 	return container_of(inode, struct mqueue_inode_info, vfs_inode);
 }
 
-static struct inode *mqueue_get_inode(struct super_block *sb, int mode)
+static struct inode *mqueue_get_inode(struct super_block *sb, int mode,
+							struct mq_attr *attr)
 {
 	struct inode *inode;
 
@@ -127,7 +128,11 @@
 			memset(&info->attr, 0, sizeof(info->attr));
 			info->attr.mq_maxmsg = DFLT_MSGMAX;
 			info->attr.mq_msgsize = DFLT_MSGSIZEMAX;
-			info->messages = kmalloc(DFLT_MSGMAX * sizeof(struct msg_msg *), GFP_KERNEL);
+			if (attr) {
+				info->attr.mq_maxmsg = attr->mq_maxmsg;
+				info->attr.mq_msgsize = attr->mq_msgsize;
+			}
+			info->messages = kmalloc(info->attr.mq_maxmsg * sizeof(struct msg_msg *), GFP_KERNEL);
 			if (!info->messages) {
 				make_bad_inode(inode);
 				iput(inode);
@@ -153,7 +158,7 @@
 	sb->s_magic = MQUEUE_MAGIC;
 	sb->s_op = &mqueue_super_ops;
 
-	inode = mqueue_get_inode(sb, S_IFDIR | S_ISVTX | S_IRWXUGO);
+	inode = mqueue_get_inode(sb, S_IFDIR | S_ISVTX | S_IRWXUGO, NULL);
 	if (!inode)
 		return -ENOMEM;
 
@@ -226,6 +231,7 @@
 				int mode, struct nameidata *nd)
 {
 	struct inode *inode;
+	struct mq_attr *attr = dentry->d_fsdata;
 	int error;
 
 	spin_lock(&mq_lock);
@@ -236,7 +242,7 @@
 	queues_count++;
 	spin_unlock(&mq_lock);
 
-	inode = mqueue_get_inode(dir->i_sb, mode);
+	inode = mqueue_get_inode(dir->i_sb, mode, attr);
 	if (!inode) {
 		error = -ENOMEM;
 		spin_lock(&mq_lock);
@@ -535,9 +541,6 @@
 			int oflag, mode_t mode, struct mq_attr __user *u_attr)
 {
 	struct file *filp;
-	struct inode *inode;
-	struct mqueue_inode_info *info;
-	struct msg_msg **msgs = NULL;
 	struct mq_attr attr;
 	int ret;
 
@@ -555,28 +558,14 @@
 					attr.mq_msgsize > msgsize_max)
 				return ERR_PTR(-EINVAL);
 		}
-		msgs = kmalloc(attr.mq_maxmsg * sizeof(*msgs), GFP_KERNEL);
-		if (!msgs)
-			return ERR_PTR(-ENOMEM);
-	} else {
-		msgs = NULL;
+		/* store for use during create */
+		dentry->d_fsdata = &attr;
 	}
 
 	ret = vfs_create(dir->d_inode, dentry, mode, NULL);
-	if (ret) {
-		kfree(msgs);
+	dentry->d_fsdata = NULL;
+	if (ret)
 		return ERR_PTR(ret);
-	}
-
-	inode = dentry->d_inode;
-	info = MQUEUE_I(inode);
-
-	if (msgs) {
-		info->attr.mq_maxmsg = attr.mq_maxmsg;
-		info->attr.mq_msgsize = attr.mq_msgsize;
-		kfree(info->messages);
-		info->messages = msgs;
-	}
 
 	filp = dentry_open(dentry, mqueue_mnt, oflag);
 	if (!IS_ERR(filp))
@@ -791,7 +780,7 @@
 
 	/* First try to allocate memory, before doing anything with
 	 * existing queues. */
-	msg_ptr = load_msg((void *)u_msg_ptr, msg_len);
+	msg_ptr = load_msg(u_msg_ptr, msg_len);
 	if (unlikely(IS_ERR(msg_ptr))) {
 		ret = PTR_ERR(msg_ptr);
 		goto out_fput;
diff -Nru a/ipc/msg.c b/ipc/msg.c
--- a/ipc/msg.c	Tue Jun 15 22:20:35 2004
+++ b/ipc/msg.c	Tue Jun 15 22:20:35 2004
@@ -229,7 +229,7 @@
 	return ret;
 }
 
-static inline unsigned long copy_msqid_to_user(void *buf, struct msqid64_ds *in, int version)
+static inline unsigned long copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version)
 {
 	switch(version) {
 	case IPC_64:
@@ -280,7 +280,7 @@
 	mode_t		mode;
 };
 
-static inline unsigned long copy_msqid_from_user(struct msq_setbuf *out, void *buf, int version)
+static inline unsigned long copy_msqid_from_user(struct msq_setbuf *out, void __user *buf, int version)
 {
 	switch(version) {
 	case IPC_64:
@@ -320,7 +320,7 @@
 	}
 }
 
-asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds *buf)
+asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf)
 {
 	int err, version;
 	struct msg_queue *msq;
@@ -539,7 +539,7 @@
 	return 0;
 }
 
-asmlinkage long sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg)
+asmlinkage long sys_msgsnd (int msqid, struct msgbuf __user *msgp, size_t msgsz, int msgflg)
 {
 	struct msg_queue *msq;
 	struct msg_msg *msg;
@@ -645,7 +645,7 @@
 	return SEARCH_EQUAL;
 }
 
-asmlinkage long sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz,
+asmlinkage long sys_msgrcv (int msqid, struct msgbuf __user *msgp, size_t msgsz,
 			    long msgtyp, int msgflg)
 {
 	struct msg_queue *msq;
diff -Nru a/ipc/msgutil.c b/ipc/msgutil.c
--- a/ipc/msgutil.c	Tue Jun 15 22:20:40 2004
+++ b/ipc/msgutil.c	Tue Jun 15 22:20:40 2004
@@ -25,7 +25,7 @@
 #define DATALEN_MSG	(PAGE_SIZE-sizeof(struct msg_msg))
 #define DATALEN_SEG	(PAGE_SIZE-sizeof(struct msg_msgseg))
 
-struct msg_msg *load_msg(void __user *src, int len)
+struct msg_msg *load_msg(const void __user *src, int len)
 {
 	struct msg_msg *msg;
 	struct msg_msgseg **pseg;
@@ -49,7 +49,7 @@
 	}
 
 	len -= alen;
-	src = ((char *)src) + alen;
+	src = ((char __user *)src) + alen;
 	pseg = &msg->next;
 	while (len > 0) {
 		struct msg_msgseg *seg;
@@ -70,7 +70,7 @@
 		}
 		pseg = &seg->next;
 		len -= alen;
-		src = ((char *)src) + alen;
+		src = ((char __user *)src) + alen;
 	}
 
 	err = security_msg_msg_alloc(msg);
@@ -96,7 +96,7 @@
 		return -1;
 
 	len -= alen;
-	dest = ((char *)dest) + alen;
+	dest = ((char __user *)dest) + alen;
 	seg = msg->next;
 	while (len > 0) {
 		alen = len;
@@ -105,7 +105,7 @@
 		if (copy_to_user(dest, seg + 1, alen))
 			return -1;
 		len -= alen;
-		dest = ((char *)dest) + alen;
+		dest = ((char __user *)dest) + alen;
 		seg = seg->next;
 	}
 	return 0;
diff -Nru a/ipc/sem.c b/ipc/sem.c
--- a/ipc/sem.c	Tue Jun 15 22:20:39 2004
+++ b/ipc/sem.c	Tue Jun 15 22:20:39 2004
@@ -610,7 +610,7 @@
 	switch (cmd) {
 	case GETALL:
 	{
-		ushort *array = arg.array;
+		ushort __user *array = arg.array;
 		int i;
 
 		if(nsems > SEMMSL_FAST) {
diff -Nru a/ipc/shm.c b/ipc/shm.c
--- a/ipc/shm.c	Tue Jun 15 22:20:40 2004
+++ b/ipc/shm.c	Tue Jun 15 22:20:40 2004
@@ -163,6 +163,10 @@
 	.open	= shm_open,	/* callback for a new vm-area open */
 	.close	= shm_close,	/* callback for when the vm-area is released */
 	.nopage	= shmem_nopage,
+#ifdef CONFIG_NUMA
+	.set_policy = shmem_set_policy,
+	.get_policy = shmem_get_policy,
+#endif
 };
 
 static int newseg (key_t key, int shmflg, size_t size)
diff -Nru a/ipc/util.c b/ipc/util.c
--- a/ipc/util.c	Tue Jun 15 22:21:05 2004
+++ b/ipc/util.c	Tue Jun 15 22:21:05 2004
@@ -25,6 +25,8 @@
 #include <linux/rcupdate.h>
 #include <linux/workqueue.h>
 
+#include <asm/unistd.h>
+
 #include "util.h"
 
 /**
@@ -507,7 +509,8 @@
 	return 0;
 }
 
-#if !defined(__ia64__) && !defined(__x86_64__) && !defined(__hppa__)
+#ifdef __ARCH_WANT_IPC_PARSE_VERSION
+
 
 /**
  *	ipc_parse_version	-	IPC call version
@@ -528,4 +531,4 @@
 	}
 }
 
-#endif /* __ia64__ */
+#endif /* __ARCH_WANT_IPC_PARSE_VERSION */
diff -Nru a/ipc/util.h b/ipc/util.h
--- a/ipc/util.h	Tue Jun 15 22:20:41 2004
+++ b/ipc/util.h	Tue Jun 15 22:20:41 2004
@@ -68,7 +68,7 @@
 #endif
 
 extern void free_msg(struct msg_msg *msg);
-extern struct msg_msg *load_msg(void __user *src, int len);
+extern struct msg_msg *load_msg(const void __user *src, int len);
 extern int store_msg(void __user *dest, struct msg_msg *msg, int len);
 
 #endif
diff -Nru a/kernel/acct.c b/kernel/acct.c
--- a/kernel/acct.c	Tue Jun 15 22:20:41 2004
+++ b/kernel/acct.c	Tue Jun 15 22:20:41 2004
@@ -204,7 +204,7 @@
  *  should be written. If the filename is NULL, accounting will be
  *  shutdown.
  */
-asmlinkage long sys_acct(const char *name)
+asmlinkage long sys_acct(const char __user *name)
 {
 	struct file *file = NULL;
 	char *tmp;
diff -Nru a/kernel/compat.c b/kernel/compat.c
--- a/kernel/compat.c	Tue Jun 15 22:20:40 2004
+++ b/kernel/compat.c	Tue Jun 15 22:20:40 2004
@@ -23,14 +23,14 @@
 
 #include <asm/uaccess.h>
 
-int get_compat_timespec(struct timespec *ts, const struct compat_timespec *cts)
+int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
 {
 	return (verify_area(VERIFY_READ, cts, sizeof(*cts)) ||
 			__get_user(ts->tv_sec, &cts->tv_sec) ||
 			__get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
 }
 
-int put_compat_timespec(const struct timespec *ts, struct compat_timespec *cts)
+int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user *cts)
 {
 	return (verify_area(VERIFY_WRITE, cts, sizeof(*cts)) ||
 			__put_user(ts->tv_sec, &cts->tv_sec) ||
@@ -40,7 +40,7 @@
 static long compat_nanosleep_restart(struct restart_block *restart)
 {
 	unsigned long expire = restart->arg0, now = jiffies;
-	struct compat_timespec *rmtp;
+	struct compat_timespec __user *rmtp;
 
 	/* Did it expire while we handled signals? */
 	if (!time_after(expire, now))
@@ -51,7 +51,7 @@
 	if (expire == 0)
 		return 0;
 
-	rmtp = (struct compat_timespec *)restart->arg1;
+	rmtp = (struct compat_timespec __user *)restart->arg1;
 	if (rmtp) {
 		struct compat_timespec ct;
 		struct timespec t;
@@ -66,8 +66,8 @@
 	return -ERESTART_RESTARTBLOCK;
 }
 
-asmlinkage long compat_sys_nanosleep(struct compat_timespec *rqtp,
-		struct compat_timespec *rmtp)
+asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
+		struct compat_timespec __user *rmtp)
 {
 	struct timespec t;
 	struct restart_block *restart;
@@ -98,7 +98,7 @@
 }
 
 static inline long get_compat_itimerval(struct itimerval *o,
-		struct compat_itimerval *i)
+		struct compat_itimerval __user *i)
 {
 	return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
 		(__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) |
@@ -107,7 +107,7 @@
 		 __get_user(o->it_value.tv_usec, &i->it_value.tv_usec)));
 }
 
-static inline long put_compat_itimerval(struct compat_itimerval *o,
+static inline long put_compat_itimerval(struct compat_itimerval __user *o,
 		struct itimerval *i)
 {
 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
@@ -117,7 +117,8 @@
 		 __put_user(i->it_value.tv_usec, &o->it_value.tv_usec)));
 }
 
-asmlinkage long compat_sys_getitimer(int which, struct compat_itimerval *it)
+asmlinkage long compat_sys_getitimer(int which,
+		struct compat_itimerval __user *it)
 {
 	struct itimerval kit;
 	int error;
@@ -128,8 +129,9 @@
 	return error;
 }
 
-asmlinkage long compat_sys_setitimer(int which, struct compat_itimerval *in,
-		struct compat_itimerval *out)
+asmlinkage long compat_sys_setitimer(int which,
+		struct compat_itimerval __user *in,
+		struct compat_itimerval __user *out)
 {
 	struct itimerval kin, kout;
 	int error;
@@ -148,7 +150,7 @@
 	return 0;
 }
 
-asmlinkage long compat_sys_times(struct compat_tms *tbuf)
+asmlinkage long compat_sys_times(struct compat_tms __user *tbuf)
 {
 	/*
 	 *	In the SMP world we might just be unlucky and have one of
@@ -173,22 +175,22 @@
  * types that can be passed to put_user()/get_user().
  */
 
-asmlinkage long compat_sys_sigpending(compat_old_sigset_t *set)
+asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set)
 {
 	old_sigset_t s;
 	long ret;
 	mm_segment_t old_fs = get_fs();
 
 	set_fs(KERNEL_DS);
-	ret = sys_sigpending(&s);
+	ret = sys_sigpending((old_sigset_t __user *) &s);
 	set_fs(old_fs);
 	if (ret == 0)
 		ret = put_user(s, set);
 	return ret;
 }
 
-asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t *set,
-		compat_old_sigset_t *oset)
+asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set,
+		compat_old_sigset_t __user *oset)
 {
 	old_sigset_t s;
 	long ret;
@@ -198,7 +200,9 @@
 		return -EFAULT;
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	ret = sys_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL);
+	ret = sys_sigprocmask(how,
+			      set ? (old_sigset_t __user *) &s : NULL,
+			      oset ? (old_sigset_t __user *) &s : NULL);
 	set_fs(old_fs);
 	if (ret == 0)
 		if (oset)
@@ -207,8 +211,9 @@
 }
 
 #ifdef CONFIG_FUTEX
-asmlinkage long compat_sys_futex(u32 *uaddr, int op, int val,
-		struct compat_timespec *utime, u32 *uaddr2)
+asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val,
+		struct compat_timespec __user *utime, u32 __user *uaddr2,
+		int val3)
 {
 	struct timespec t;
 	unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
@@ -219,15 +224,16 @@
 			return -EFAULT;
 		timeout = timespec_to_jiffies(&t) + 1;
 	}
-	if (op == FUTEX_REQUEUE)
-		val2 = (int) (long) utime;
+	if (op >= FUTEX_REQUEUE)
+		val2 = (int) (unsigned long) utime;
 
 	return do_futex((unsigned long)uaddr, op, val, timeout,
-			(unsigned long)uaddr2, val2);
+			(unsigned long)uaddr2, val2, val3);
 }
 #endif
 
-asmlinkage long compat_sys_setrlimit(unsigned int resource, struct compat_rlimit *rlim)
+asmlinkage long compat_sys_setrlimit(unsigned int resource,
+		struct compat_rlimit __user *rlim)
 {
 	struct rlimit r;
 	int ret;
@@ -246,14 +252,15 @@
 	if (r.rlim_max == COMPAT_RLIM_INFINITY)
 		r.rlim_max = RLIM_INFINITY;
 	set_fs(KERNEL_DS);
-	ret = sys_setrlimit(resource, &r);
+	ret = sys_setrlimit(resource, (struct rlimit __user *) &r);
 	set_fs(old_fs);
 	return ret;
 }
 
 #ifdef COMPAT_RLIM_OLD_INFINITY
 
-asmlinkage long compat_sys_old_getrlimit(unsigned int resource, struct compat_rlimit *rlim)
+asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
+		struct compat_rlimit __user *rlim)
 {
 	struct rlimit r;
 	int ret;
@@ -279,14 +286,15 @@
 
 #endif
 
-asmlinkage long compat_sys_getrlimit (unsigned int resource, struct compat_rlimit *rlim)
+asmlinkage long compat_sys_getrlimit (unsigned int resource,
+		struct compat_rlimit __user *rlim)
 {
 	struct rlimit r;
 	int ret;
 	mm_segment_t old_fs = get_fs();
 
 	set_fs(KERNEL_DS);
-	ret = sys_getrlimit(resource, &r);
+	ret = sys_getrlimit(resource, (struct rlimit __user *) &r);
 	set_fs(old_fs);
 	if (!ret) {
 		if (r.rlim_cur > COMPAT_RLIM_INFINITY)
@@ -302,7 +310,7 @@
 	return ret;
 }
 
-static long put_compat_rusage (struct compat_rusage *ru, struct rusage *r)
+static long put_compat_rusage(struct compat_rusage __user *ru, struct rusage *r)
 {
 	if (!access_ok(VERIFY_WRITE, ru, sizeof(*ru)) ||
 	    __put_user(r->ru_utime.tv_sec, &ru->ru_utime.tv_sec) ||
@@ -327,14 +335,14 @@
 	return 0;
 }
 
-asmlinkage long compat_sys_getrusage(int who, struct compat_rusage *ru)
+asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
 {
 	struct rusage r;
 	int ret;
 	mm_segment_t old_fs = get_fs();
 
 	set_fs(KERNEL_DS);
-	ret = sys_getrusage(who, &r);
+	ret = sys_getrusage(who, (struct rusage __user *) &r);
 	set_fs(old_fs);
 
 	if (ret)
@@ -347,8 +355,8 @@
 }
 
 asmlinkage long
-compat_sys_wait4(compat_pid_t pid, compat_uint_t * stat_addr, int options,
-	struct compat_rusage *ru)
+compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options,
+	struct compat_rusage __user *ru)
 {
 	if (!ru) {
 		return sys_wait4(pid, stat_addr, options, NULL);
@@ -359,7 +367,10 @@
 		mm_segment_t old_fs = get_fs();
 
 		set_fs (KERNEL_DS);
-		ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r);
+		ret = sys_wait4(pid,
+				(stat_addr ?
+				 (unsigned int __user *) &status : NULL),
+				options, (struct rusage __user *) &r);
 		set_fs (old_fs);
 
 		if (ret > 0) {
@@ -374,42 +385,42 @@
 
 asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, 
 					     unsigned int len,
-					     compat_ulong_t *user_mask_ptr)
+					     compat_ulong_t __user *user_mask_ptr)
 {
-	unsigned long kernel_mask;
+	unsigned long kern_mask;
 	mm_segment_t old_fs;
 	int ret;
 
-	if (get_user(kernel_mask, user_mask_ptr))
+	if (get_user(kern_mask, user_mask_ptr))
 		return -EFAULT;
 
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
 	ret = sys_sched_setaffinity(pid,
-				    sizeof(kernel_mask),
-				    &kernel_mask);
+				    sizeof(kern_mask),
+				    (unsigned long __user *) &kern_mask);
 	set_fs(old_fs);
 
 	return ret;
 }
 
-asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
-					    compat_ulong_t *user_mask_ptr)
+asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
+					     compat_ulong_t __user *user_mask_ptr)
 {
-	unsigned long kernel_mask;
+	unsigned long kern_mask;
 	mm_segment_t old_fs;
 	int ret;
 
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
 	ret = sys_sched_getaffinity(pid,
-				    sizeof(kernel_mask),
-				    &kernel_mask);
+				    sizeof(kern_mask),
+				    (unsigned long __user *) &kern_mask);
 	set_fs(old_fs);
 
 	if (ret > 0) {
 		ret = sizeof(compat_ulong_t);
-		if (put_user(kernel_mask, user_mask_ptr))
+		if (put_user(kern_mask, user_mask_ptr))
 			return -EFAULT;
 	}
 
@@ -417,7 +428,7 @@
 }
 
 static int get_compat_itimerspec(struct itimerspec *dst, 
-				 struct compat_itimerspec *src)
+				 struct compat_itimerspec __user *src)
 { 
 	if (get_compat_timespec(&dst->it_interval, &src->it_interval) ||
 	    get_compat_timespec(&dst->it_value, &src->it_value))
@@ -425,7 +436,7 @@
 	return 0;
 } 
 
-static int put_compat_itimerspec(struct compat_itimerspec *dst, 
+static int put_compat_itimerspec(struct compat_itimerspec __user *dst, 
 				 struct itimerspec *src)
 { 
 	if (put_compat_timespec(&src->it_interval, &dst->it_interval) ||
@@ -435,8 +446,8 @@
 } 
 
 long compat_timer_settime(timer_t timer_id, int flags, 
-			  struct compat_itimerspec *new, 
-			  struct compat_itimerspec *old)
+			  struct compat_itimerspec __user *new, 
+			  struct compat_itimerspec __user *old)
 { 
 	long err;
 	mm_segment_t oldfs;
@@ -448,63 +459,77 @@
 		return -EFAULT;	
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-	err = sys_timer_settime(timer_id, flags, &newts, &oldts);
+	err = sys_timer_settime(timer_id, flags,
+				(struct itimerspec __user *) &newts,
+				(struct itimerspec __user *) &oldts);
 	set_fs(oldfs); 
 	if (!err && old && put_compat_itimerspec(old, &oldts))
 		return -EFAULT;
 	return err;
 } 
 
-long compat_timer_gettime(timer_t timer_id, struct compat_itimerspec *setting)
+long compat_timer_gettime(timer_t timer_id,
+		struct compat_itimerspec __user *setting)
 { 
 	long err;
 	mm_segment_t oldfs;
 	struct itimerspec ts; 
+
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-	err = sys_timer_gettime(timer_id, &ts); 
+	err = sys_timer_gettime(timer_id,
+				(struct itimerspec __user *) &ts); 
 	set_fs(oldfs); 
 	if (!err && put_compat_itimerspec(setting, &ts))
 		return -EFAULT;
 	return err;
 } 
 
-long compat_clock_settime(clockid_t which_clock,  struct compat_timespec *tp)
+long compat_clock_settime(clockid_t which_clock,
+		struct compat_timespec __user *tp)
 {
 	long err;
 	mm_segment_t oldfs;
 	struct timespec ts; 
+
 	if (get_compat_timespec(&ts, tp))
 		return -EFAULT; 
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);	
-	err = sys_clock_settime(which_clock, &ts); 
+	err = sys_clock_settime(which_clock,
+				(struct timespec __user *) &ts);
 	set_fs(oldfs);
 	return err;
 } 
 
-long compat_clock_gettime(clockid_t which_clock,  struct compat_timespec *tp)
+long compat_clock_gettime(clockid_t which_clock,
+		struct compat_timespec __user *tp)
 {
 	long err;
 	mm_segment_t oldfs;
 	struct timespec ts; 
+
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-	err = sys_clock_gettime(which_clock, &ts); 
+	err = sys_clock_gettime(which_clock,
+				(struct timespec __user *) &ts);
 	set_fs(oldfs);
 	if (!err && put_compat_timespec(&ts, tp))
 		return -EFAULT; 
 	return err;
 } 
 
-long compat_clock_getres(clockid_t which_clock,  struct compat_timespec *tp)
+long compat_clock_getres(clockid_t which_clock,
+		struct compat_timespec __user *tp)
 {
 	long err;
 	mm_segment_t oldfs;
 	struct timespec ts; 
+
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
-	err = sys_clock_getres(which_clock, &ts); 
+	err = sys_clock_getres(which_clock,
+			       (struct timespec __user *) &ts);
 	set_fs(oldfs);
 	if (!err && put_compat_timespec(&ts, tp))
 		return -EFAULT; 
@@ -518,11 +543,15 @@
 	long err;
 	mm_segment_t oldfs;
 	struct timespec in, out; 
+
 	if (get_compat_timespec(&in, rqtp)) 
 		return -EFAULT;
+
 	oldfs = get_fs();
-	set_fs(KERNEL_DS);	
-	err = sys_clock_nanosleep(which_clock, flags, &in, &out);  
+	set_fs(KERNEL_DS);
+	err = sys_clock_nanosleep(which_clock, flags,
+				  (struct timespec __user *) &in,
+				  (struct timespec __user *) &out);
 	set_fs(oldfs);
 	if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
 	    put_compat_timespec(&out, rmtp))
diff -Nru a/kernel/cpu.c b/kernel/cpu.c
--- a/kernel/cpu.c	Tue Jun 15 22:20:58 2004
+++ b/kernel/cpu.c	Tue Jun 15 22:20:58 2004
@@ -20,6 +20,14 @@
 DECLARE_MUTEX(cpucontrol);
 
 static struct notifier_block *cpu_chain;
+/*
+ * Represents all cpu's present in the system
+ * In systems capable of hotplug, this map could dynamically grow
+ * as new cpu's are detected in the system via any platform specific
+ * method, such as ACPI for e.g.
+ */
+cpumask_t	cpu_present_map;
+EXPORT_SYMBOL(cpu_present_map);
 
 /* Need to know about CPUs going up/down? */
 int register_cpu_notifier(struct notifier_block *nb)
@@ -43,15 +51,16 @@
 EXPORT_SYMBOL(unregister_cpu_notifier);
 
 #ifdef CONFIG_HOTPLUG_CPU
-static inline void check_for_tasks(int cpu, struct task_struct *k)
+static inline void check_for_tasks(int cpu)
 {
 	struct task_struct *p;
 
 	write_lock_irq(&tasklist_lock);
 	for_each_process(p) {
-		if (task_cpu(p) == cpu && p != k)
-			printk(KERN_WARNING "Task %s is on cpu %d\n",
-				p->comm, cpu);
+		if (task_cpu(p) == cpu && (p->utime != 0 || p->stime != 0))
+			printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\
+				(state = %ld, flags = %lx) \n",
+				 p->comm, p->pid, cpu, p->state, p->flags);
 	}
 	write_unlock_irq(&tasklist_lock);
 }
@@ -96,8 +105,9 @@
 	if (err < 0)
 		cpu_set(smp_processor_id(), cpu_online_map);
 	else
-		/* Everyone else gets kicked off. */
-		migrate_all_tasks();
+		/* Force idle task to run as soon as we yield: it should
+		   immediately notice cpu is offline and die quickly. */
+		sched_idle_next();
 
 	return err;
 }
@@ -106,6 +116,7 @@
 {
 	int err;
 	struct task_struct *p;
+	cpumask_t old_allowed, tmp;
 
 	if ((err = lock_cpu_hotplug_interruptible()) != 0)
 		return err;
@@ -120,17 +131,21 @@
 		goto out;
 	}
 
+	/* Ensure that we are not runnable on dying cpu */
+	old_allowed = current->cpus_allowed;
+	tmp = CPU_MASK_ALL;
+	cpu_clear(cpu, tmp);
+	set_cpus_allowed(current, tmp);
+
 	p = __stop_machine_run(take_cpu_down, NULL, cpu);
 	if (IS_ERR(p)) {
 		err = PTR_ERR(p);
-		goto out;
+		goto out_allowed;
 	}
 
 	if (cpu_online(cpu))
 		goto out_thread;
 
-	check_for_tasks(cpu, p);
-
 	/* Wait for it to sleep (leaving idle task). */
 	while (!idle_cpu(cpu))
 		yield();
@@ -146,10 +161,14 @@
 	    == NOTIFY_BAD)
 		BUG();
 
+	check_for_tasks(cpu);
+
 	cpu_run_sbin_hotplug(cpu, "offline");
 
 out_thread:
 	err = kthread_stop(p);
+out_allowed:
+	set_cpus_allowed(current, old_allowed);
 out:
 	unlock_cpu_hotplug();
 	return err;
@@ -169,7 +188,7 @@
 	if ((ret = down_interruptible(&cpucontrol)) != 0)
 		return ret;
 
-	if (cpu_online(cpu)) {
+	if (cpu_online(cpu) || !cpu_present(cpu)) {
 		ret = -EINVAL;
 		goto out;
 	}
diff -Nru a/kernel/exit.c b/kernel/exit.c
--- a/kernel/exit.c	Tue Jun 15 22:20:44 2004
+++ b/kernel/exit.c	Tue Jun 15 22:20:44 2004
@@ -22,15 +22,17 @@
 #include <linux/profile.h>
 #include <linux/mount.h>
 #include <linux/proc_fs.h>
+#include <linux/mempolicy.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
 
 extern void sem_exit (void);
 extern struct task_struct *child_reaper;
 
-int getrusage(struct task_struct *, int, struct rusage *);
+int getrusage(struct task_struct *, int, struct rusage __user *);
 
 static void __unhash_process(struct task_struct *p)
 {
@@ -735,6 +737,14 @@
 	tsk->flags |= PF_DEAD;
 
 	/*
+	 * Clear these here so that update_process_times() won't try to deliver
+	 * itimer, profile or rlimit signals to this task while it is in late exit.
+	 */
+	tsk->it_virt_value = 0;
+	tsk->it_prof_value = 0;
+	tsk->rlim[RLIMIT_CPU].rlim_cur = RLIM_INFINITY;
+
+	/*
 	 * In the preemption case it must be impossible for the task
 	 * to get runnable again, so use "_raw_" unlock to keep
 	 * preempt_count elevated until we schedule().
@@ -790,6 +800,9 @@
 	__exit_fs(tsk);
 	exit_namespace(tsk);
 	exit_thread();
+#ifdef CONFIG_NUMA
+	mpol_free(tsk->mempolicy);
+#endif
 
 	if (tsk->signal->leader)
 		disassociate_ctty(1);
@@ -931,7 +944,7 @@
  * the lock and this task is uninteresting.  If we return nonzero, we have
  * released the lock and the system call should return.
  */
-static int wait_task_zombie(task_t *p, unsigned int *stat_addr, struct rusage *ru)
+static int wait_task_zombie(task_t *p, unsigned int __user *stat_addr, struct rusage __user *ru)
 {
 	unsigned long state;
 	int retval;
@@ -1004,7 +1017,8 @@
  * released the lock and the system call should return.
  */
 static int wait_task_stopped(task_t *p, int delayed_group_leader,
-			     unsigned int *stat_addr, struct rusage *ru)
+			     unsigned int __user *stat_addr,
+			     struct rusage __user *ru)
 {
 	int retval, exit_code;
 
@@ -1074,7 +1088,7 @@
 	return retval;
 }
 
-asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru)
+asmlinkage long sys_wait4(pid_t pid,unsigned int __user *stat_addr, int options, struct rusage __user *ru)
 {
 	DECLARE_WAITQUEUE(wait, current);
 	struct task_struct *tsk;
@@ -1157,14 +1171,13 @@
 	return retval;
 }
 
-#if !defined(__alpha__) && !defined(__ia64__) && \
-    !defined(__arm__) && !defined(__s390__)
+#ifdef __ARCH_WANT_SYS_WAITPID
 
 /*
  * sys_waitpid() remains for compatibility. waitpid() should be
  * implemented by calling sys_wait4() from libc.a.
  */
-asmlinkage long sys_waitpid(pid_t pid,unsigned int * stat_addr, int options)
+asmlinkage long sys_waitpid(pid_t pid, unsigned __user *stat_addr, int options)
 {
 	return sys_wait4(pid, stat_addr, options, NULL);
 }
diff -Nru a/kernel/fork.c b/kernel/fork.c
--- a/kernel/fork.c	Tue Jun 15 22:20:37 2004
+++ b/kernel/fork.c	Tue Jun 15 22:20:37 2004
@@ -21,11 +21,13 @@
 #include <linux/completion.h>
 #include <linux/namespace.h>
 #include <linux/personality.h>
+#include <linux/mempolicy.h>
 #include <linux/sem.h>
 #include <linux/file.h>
 #include <linux/binfmts.h>
 #include <linux/mman.h>
 #include <linux/fs.h>
+#include <linux/cpu.h>
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/jiffies.h>
@@ -33,6 +35,7 @@
 #include <linux/ptrace.h>
 #include <linux/mount.h>
 #include <linux/audit.h>
+#include <linux/rmap.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -60,7 +63,7 @@
 	int cpu;
 	int total = 0;
 
-	for_each_cpu(cpu)
+	for_each_online_cpu(cpu)
 		total += per_cpu(process_counts, cpu);
 
 	return total;
@@ -196,9 +199,9 @@
 
 EXPORT_SYMBOL(finish_wait);
 
-int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync)
+int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
 {
-	int ret = default_wake_function(wait, mode, sync);
+	int ret = default_wake_function(wait, mode, sync, key);
 
 	if (ret)
 		list_del_init(&wait->task_list);
@@ -215,11 +218,8 @@
 #endif
 	/* create a slab on which task_structs can be allocated */
 	task_struct_cachep =
-		kmem_cache_create("task_struct",
-				  sizeof(struct task_struct),ARCH_MIN_TASKALIGN,
-				  0, NULL, NULL);
-	if (!task_struct_cachep)
-		panic("fork_init(): cannot create task_struct SLAB cache");
+		kmem_cache_create("task_struct", sizeof(struct task_struct),
+			ARCH_MIN_TASKALIGN, SLAB_PANIC, NULL, NULL);
 #endif
 
 	/*
@@ -271,7 +271,8 @@
 	struct vm_area_struct * mpnt, *tmp, **pprev;
 	struct rb_node **rb_link, *rb_parent;
 	int retval;
-	unsigned long charge = 0;
+	unsigned long charge;
+	struct mempolicy *pol;
 
 	down_write(&oldmm->mmap_sem);
 	flush_cache_mm(current->mm);
@@ -303,21 +304,28 @@
 
 		if(mpnt->vm_flags & VM_DONTCOPY)
 			continue;
+		charge = 0;
 		if (mpnt->vm_flags & VM_ACCOUNT) {
 			unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
 			if (security_vm_enough_memory(len))
 				goto fail_nomem;
-			charge += len;
+			charge = len;
 		}
 		tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 		if (!tmp)
 			goto fail_nomem;
 		*tmp = *mpnt;
+		pol = mpol_copy(vma_policy(mpnt));
+		retval = PTR_ERR(pol);
+		if (IS_ERR(pol))
+			goto fail_nomem_policy;
+		vma_set_policy(tmp, pol);
 		tmp->vm_flags &= ~VM_LOCKED;
 		tmp->vm_mm = mm;
 		tmp->vm_next = NULL;
+		anon_vma_link(tmp);
+		vma_prio_tree_init(tmp);
 		file = tmp->vm_file;
-		INIT_LIST_HEAD(&tmp->shared);
 		if (file) {
 			struct inode *inode = file->f_dentry->d_inode;
 			get_file(file);
@@ -325,9 +333,11 @@
 				atomic_dec(&inode->i_writecount);
       
 			/* insert tmp into the share list, just after mpnt */
-			down(&file->f_mapping->i_shared_sem);
-			list_add(&tmp->shared, &mpnt->shared);
-			up(&file->f_mapping->i_shared_sem);
+			spin_lock(&file->f_mapping->i_mmap_lock);
+			flush_dcache_mmap_lock(file->f_mapping);
+			vma_prio_tree_add(tmp, mpnt);
+			flush_dcache_mmap_unlock(file->f_mapping);
+			spin_unlock(&file->f_mapping->i_mmap_lock);
 		}
 
 		/*
@@ -351,7 +361,7 @@
 			tmp->vm_ops->open(tmp);
 
 		if (retval)
-			goto fail;
+			goto out;
 	}
 	retval = 0;
 
@@ -359,12 +369,14 @@
 	flush_tlb_mm(current->mm);
 	up_write(&oldmm->mmap_sem);
 	return retval;
+fail_nomem_policy:
+	kmem_cache_free(vm_area_cachep, tmp);
 fail_nomem:
 	retval = -ENOMEM;
-fail:
 	vm_unacct_memory(charge);
 	goto out;
 }
+
 static inline int mm_alloc_pgd(struct mm_struct * mm)
 {
 	mm->pgd = pgd_alloc(mm);
@@ -421,9 +433,9 @@
 	mm = allocate_mm();
 	if (mm) {
 		memset(mm, 0, sizeof(*mm));
-		return mm_init(mm);
+		mm = mm_init(mm);
 	}
-	return NULL;
+	return mm;
 }
 
 /*
@@ -505,7 +517,7 @@
 		 * not set up a proper pointer then tough luck.
 		 */
 		put_user(0, tidptr);
-		sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL);
+		sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);
 	}
 }
 
@@ -953,10 +965,18 @@
 	p->security = NULL;
 	p->io_context = NULL;
 	p->audit_context = NULL;
+#ifdef CONFIG_NUMA
+ 	p->mempolicy = mpol_copy(p->mempolicy);
+ 	if (IS_ERR(p->mempolicy)) {
+ 		retval = PTR_ERR(p->mempolicy);
+ 		p->mempolicy = NULL;
+ 		goto bad_fork_cleanup;
+ 	}
+#endif
 
 	retval = -ENOMEM;
 	if ((retval = security_task_alloc(p)))
-		goto bad_fork_cleanup;
+		goto bad_fork_cleanup_policy;
 	if ((retval = audit_alloc(p)))
 		goto bad_fork_cleanup_security;
 	/* copy all the process information */
@@ -1102,6 +1122,10 @@
 	audit_free(p);
 bad_fork_cleanup_security:
 	security_task_free(p);
+bad_fork_cleanup_policy:
+#ifdef CONFIG_NUMA
+	mpol_free(p->mempolicy);
+#endif
 bad_fork_cleanup:
 	if (p->pid > 0)
 		free_pidmap(p->pid);
@@ -1180,10 +1204,31 @@
 			set_tsk_thread_flag(p, TIF_SIGPENDING);
 		}
 
-		if (!(clone_flags & CLONE_STOPPED))
-			wake_up_forked_process(p);	/* do this last */
-		else
+		if (!(clone_flags & CLONE_STOPPED)) {
+			/*
+			 * Do the wakeup last. On SMP we treat fork() and
+			 * CLONE_VM separately, because fork() has already
+			 * created cache footprint on this CPU (due to
+			 * copying the pagetables), hence migration would
+			 * probably be costy. Threads on the other hand
+			 * have less traction to the current CPU, and if
+			 * there's an imbalance then the scheduler can
+			 * migrate this fresh thread now, before it
+			 * accumulates a larger cache footprint:
+			 */
+			if (clone_flags & CLONE_VM)
+				wake_up_forked_thread(p);
+			else
+				wake_up_forked_process(p);
+		} else {
+			int cpu = get_cpu();
+
 			p->state = TASK_STOPPED;
+			if (cpu_is_offline(task_cpu(p)))
+				set_task_cpu(p, cpu);
+
+			put_cpu();
+		}
 		++total_forks;
 
 		if (unlikely (trace)) {
@@ -1227,37 +1272,20 @@
 {
 	sighand_cachep = kmem_cache_create("sighand_cache",
 			sizeof(struct sighand_struct), 0,
-			SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!sighand_cachep)
-		panic("Cannot create sighand SLAB cache");
-
+			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 	signal_cachep = kmem_cache_create("signal_cache",
 			sizeof(struct signal_struct), 0,
-			SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!signal_cachep)
-		panic("Cannot create signal SLAB cache");
-
+			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 	files_cachep = kmem_cache_create("files_cache", 
-			 sizeof(struct files_struct), 0, 
-			 SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!files_cachep) 
-		panic("Cannot create files SLAB cache");
-
+			sizeof(struct files_struct), 0,
+			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 	fs_cachep = kmem_cache_create("fs_cache", 
-			 sizeof(struct fs_struct), 0, 
-			 SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if (!fs_cachep) 
-		panic("Cannot create fs_struct SLAB cache");
- 
+			sizeof(struct fs_struct), 0,
+			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 	vm_area_cachep = kmem_cache_create("vm_area_struct",
 			sizeof(struct vm_area_struct), 0,
-			0, NULL, NULL);
-	if(!vm_area_cachep)
-		panic("vma_init: Cannot alloc vm_area_struct SLAB cache");
-
+			SLAB_PANIC, NULL, NULL);
 	mm_cachep = kmem_cache_create("mm_struct",
 			sizeof(struct mm_struct), 0,
-			SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if(!mm_cachep)
-		panic("vma_init: Cannot alloc mm_struct SLAB cache");
+			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 }
diff -Nru a/kernel/futex.c b/kernel/futex.c
--- a/kernel/futex.c	Tue Jun 15 22:20:38 2004
+++ b/kernel/futex.c	Tue Jun 15 22:20:38 2004
@@ -38,6 +38,7 @@
 #include <linux/futex.h>
 #include <linux/mount.h>
 #include <linux/pagemap.h>
+#include <linux/syscalls.h>
 
 #define FUTEX_HASHBITS 8
 
@@ -96,6 +97,7 @@
  */
 struct futex_hash_bucket {
        spinlock_t              lock;
+       unsigned int	    nqueued;
        struct list_head       chain;
 };
 
@@ -318,13 +320,14 @@
  * physical page.
  */
 static int futex_requeue(unsigned long uaddr1, unsigned long uaddr2,
-				int nr_wake, int nr_requeue)
+			 int nr_wake, int nr_requeue, int *valp)
 {
 	union futex_key key1, key2;
 	struct futex_hash_bucket *bh1, *bh2;
 	struct list_head *head1;
 	struct futex_q *this, *next;
 	int ret, drop_count = 0;
+	unsigned int nqueued;
 
 	down_read(&current->mm->mmap_sem);
 
@@ -338,12 +341,41 @@
 	bh1 = hash_futex(&key1);
 	bh2 = hash_futex(&key2);
 
+	nqueued = bh1->nqueued;
+	if (likely(valp != NULL)) {
+		int curval;
+
+		/* In order to avoid doing get_user while
+		   holding bh1->lock and bh2->lock, nqueued
+		   (monotonically increasing field) must be first
+		   read, then *uaddr1 fetched from userland and
+		   after acquiring lock nqueued field compared with
+		   the stored value.  The smp_mb () below
+		   makes sure that bh1->nqueued is read from memory
+		   before *uaddr1.  */
+		smp_mb();
+
+		if (get_user(curval, (int __user *)uaddr1) != 0) {
+			ret = -EFAULT;
+			goto out;
+		}
+		if (curval != *valp) {
+			ret = -EAGAIN;
+			goto out;
+		}
+	}
+
 	if (bh1 < bh2)
 		spin_lock(&bh1->lock);
 	spin_lock(&bh2->lock);
 	if (bh1 > bh2)
 		spin_lock(&bh1->lock);
 
+	if (unlikely(nqueued != bh1->nqueued && valp != NULL)) {
+		ret = -EAGAIN;
+		goto out_unlock;
+	}
+
 	head1 = &bh1->chain;
 	list_for_each_entry_safe(this, next, head1, list) {
 		if (!match_futex (&this->key, &key1))
@@ -365,6 +397,7 @@
 		}
 	}
 
+out_unlock:
 	spin_unlock(&bh1->lock);
 	if (bh1 != bh2)
 		spin_unlock(&bh2->lock);
@@ -398,6 +431,7 @@
 	q->lock_ptr = &bh->lock;
 
 	spin_lock(&bh->lock);
+	bh->nqueued++;
 	list_add_tail(&q->list, &bh->chain);
 	spin_unlock(&bh->lock);
 }
@@ -459,7 +493,7 @@
 	 * We hold the mmap semaphore, so the mapping cannot have changed
 	 * since we looked it up.
 	 */
-	if (get_user(curval, (int *)uaddr) != 0) {
+	if (get_user(curval, (int __user *)uaddr) != 0) {
 		ret = -EFAULT;
 		goto out_unqueue;
 	}
@@ -625,7 +659,7 @@
 }
 
 long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout,
-		unsigned long uaddr2, int val2)
+		unsigned long uaddr2, int val2, int val3)
 {
 	int ret;
 
@@ -641,7 +675,10 @@
 		ret = futex_fd(uaddr, val);
 		break;
 	case FUTEX_REQUEUE:
-		ret = futex_requeue(uaddr, uaddr2, val, val2);
+		ret = futex_requeue(uaddr, uaddr2, val, val2, NULL);
+		break;
+	case FUTEX_CMP_REQUEUE:
+		ret = futex_requeue(uaddr, uaddr2, val, val2, &val3);
 		break;
 	default:
 		ret = -ENOSYS;
@@ -651,7 +688,8 @@
 
 
 asmlinkage long sys_futex(u32 __user *uaddr, int op, int val,
-			  struct timespec __user *utime, u32 __user *uaddr2)
+			  struct timespec __user *utime, u32 __user *uaddr2,
+			  int val3)
 {
 	struct timespec t;
 	unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
@@ -665,11 +703,11 @@
 	/*
 	 * requeue parameter in 'utime' if op == FUTEX_REQUEUE.
 	 */
-	if (op == FUTEX_REQUEUE)
+	if (op >= FUTEX_REQUEUE)
 		val2 = (int) (long) utime;
 
 	return do_futex((unsigned long)uaddr, op, val, timeout,
-			(unsigned long)uaddr2, val2);
+			(unsigned long)uaddr2, val2, val3);
 }
 
 static struct super_block *
diff -Nru a/kernel/kallsyms.c b/kernel/kallsyms.c
--- a/kernel/kallsyms.c	Tue Jun 15 22:21:04 2004
+++ b/kernel/kallsyms.c	Tue Jun 15 22:21:04 2004
@@ -88,14 +88,20 @@
 			name += strlen(name) + 1;
 		}
 
-		/* Base symbol size on next symbol. */
-		if (best + 1 < kallsyms_num_syms)
-			symbol_end = kallsyms_addresses[best + 1];
-		else if (is_kernel_inittext(addr))
+		/* At worst, symbol ends at end of section. */
+		if (is_kernel_inittext(addr))
 			symbol_end = (unsigned long)_einittext;
 		else
 			symbol_end = (unsigned long)_etext;
 
+		/* Search for next non-aliased symbol */
+		for (i = best+1; i < kallsyms_num_syms; i++) {
+			if (kallsyms_addresses[i] > kallsyms_addresses[best]) {
+				symbol_end = kallsyms_addresses[i];
+				break;
+			}
+		}
+
 		*symbolsize = symbol_end - kallsyms_addresses[best];
 		*modname = NULL;
 		*offset = addr - kallsyms_addresses[best];
@@ -171,21 +177,26 @@
 	return 1;
 }
 
-static void get_ksymbol_core(struct kallsym_iter *iter)
+/* Returns space to next name. */
+static unsigned long get_ksymbol_core(struct kallsym_iter *iter)
 {
-	unsigned stemlen;
+	unsigned stemlen, off = iter->nameoff;
 
 	/* First char of each symbol name indicates prefix length
 	   shared with previous name (stem compression). */
-	stemlen = kallsyms_names[iter->nameoff++];
+	stemlen = kallsyms_names[off++];
 
-	strlcpy(iter->name+stemlen, kallsyms_names+iter->nameoff, 128-stemlen);
-	iter->nameoff += strlen(kallsyms_names + iter->nameoff) + 1;
+	strlcpy(iter->name+stemlen, kallsyms_names + off, 128-stemlen);
+	off += strlen(kallsyms_names + off) + 1;
 	iter->owner = NULL;
 	iter->value = kallsyms_addresses[iter->pos];
-	iter->type = 't';
+	if (is_kernel_text(iter->value) || is_kernel_inittext(iter->value))
+		iter->type = 't';
+	else
+		iter->type = 'd';
 
 	upcase_if_global(iter);
+	return off - iter->nameoff;
 }
 
 static void reset_iter(struct kallsym_iter *iter)
@@ -210,9 +221,10 @@
 
 	/* We need to iterate through the previous symbols: can be slow */
 	for (; iter->pos != pos; iter->pos++) {
-		get_ksymbol_core(iter);
+		iter->nameoff += get_ksymbol_core(iter);
 		cond_resched();
 	}
+	get_ksymbol_core(iter);
 	return 1;
 }
 
diff -Nru a/kernel/kmod.c b/kernel/kmod.c
--- a/kernel/kmod.c	Tue Jun 15 22:20:38 2004
+++ b/kernel/kmod.c	Tue Jun 15 22:20:38 2004
@@ -47,7 +47,7 @@
 /*
 	modprobe_path is set via /proc/sys.
 */
-char modprobe_path[256] = "/sbin/modprobe";
+char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe";
 
 /**
  * request_module - try to load a kernel module
@@ -132,7 +132,7 @@
 	events.  the command is expected to load drivers when
 	necessary, and may perform additional system setup.
 */
-char hotplug_path[256] = "/sbin/hotplug";
+char hotplug_path[KMOD_PATH_LEN] = "/sbin/hotplug";
 
 EXPORT_SYMBOL(hotplug_path);
 
@@ -192,10 +192,20 @@
 	allow_signal(SIGCHLD);
 
 	pid = kernel_thread(____call_usermodehelper, sub_info, SIGCHLD);
-	if (pid < 0)
+	if (pid < 0) {
 		sub_info->retval = pid;
-	else
-		sys_wait4(pid, &sub_info->retval, 0, NULL);
+	} else {
+		/*
+		 * Normally it is bogus to call wait4() from in-kernel because
+		 * wait4() wants to write the exit code to a userspace address.
+		 * But wait_for_helper() always runs as keventd, and put_user()
+		 * to a kernel address works OK for kernel threads, due to their
+		 * having an mm_segment_t which spans the entire address space.
+		 *
+		 * Thus the __user pointer cast is valid here.
+		 */
+		sys_wait4(pid, (int __user *) &sub_info->retval, 0, NULL);
+	}
 
 	complete(sub_info->complete);
 	return 0;
@@ -269,4 +279,4 @@
 	BUG_ON(!khelper_wq);
 	return 0;
 }
-__initcall(usermodehelper_init);
+core_initcall(usermodehelper_init);
diff -Nru a/kernel/kthread.c b/kernel/kthread.c
--- a/kernel/kthread.c	Tue Jun 15 22:21:03 2004
+++ b/kernel/kthread.c	Tue Jun 15 22:21:03 2004
@@ -11,6 +11,7 @@
 #include <linux/err.h>
 #include <linux/unistd.h>
 #include <linux/file.h>
+#include <linux/module.h>
 #include <asm/semaphore.h>
 
 struct kthread_create_info
@@ -41,7 +42,7 @@
 {
 	return (kthread_stop_info.k == current);
 }
-
+EXPORT_SYMBOL(kthread_should_stop);
 
 static void kthread_exit_files(void)
 {
@@ -144,6 +145,7 @@
 
 	return create.result;
 }
+EXPORT_SYMBOL(kthread_create);
 
 void kthread_bind(struct task_struct *k, unsigned int cpu)
 {
@@ -153,6 +155,7 @@
 	set_task_cpu(k, cpu);
 	k->cpus_allowed = cpumask_of_cpu(cpu);
 }
+EXPORT_SYMBOL(kthread_bind);
 
 int kthread_stop(struct task_struct *k)
 {
@@ -180,3 +183,4 @@
 
 	return ret;
 }
+EXPORT_SYMBOL(kthread_stop);
diff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c	Tue Jun 15 22:20:43 2004
+++ b/kernel/module.c	Tue Jun 15 22:20:43 2004
@@ -379,6 +379,22 @@
 }
 #endif /* CONFIG_SMP */
 
+static int add_attribute(struct module *mod, struct kernel_param *kp)
+{
+	struct module_attribute *a;
+	int retval;
+
+	a = &mod->mkobj->attr[mod->mkobj->num_attributes];
+	a->attr.name = (char *)kp->name;
+	a->attr.owner = mod;
+	a->attr.mode = kp->perm;
+	a->param = kp;
+	retval = sysfs_create_file(&mod->mkobj->kobj, &a->attr);
+	if (!retval)
+		mod->mkobj->num_attributes++;
+	return retval;
+}
+
 #ifdef CONFIG_MODULE_UNLOAD
 /* Init the unload section of the module. */
 static void module_unload_init(struct module *mod)
@@ -663,6 +679,23 @@
 }
 EXPORT_SYMBOL_GPL(symbol_put_addr);
 
+static int refcnt_get_fn(char *buffer, struct kernel_param *kp)
+{
+	struct module *mod = container_of(kp, struct module, refcnt_param);
+
+	/* sysfs holds one reference. */
+	return sprintf(buffer, "%u", module_refcount(mod)-1);
+}
+
+static inline int sysfs_unload_setup(struct module *mod)
+{
+	mod->refcnt_param.name = "refcnt";
+	mod->refcnt_param.perm = 0444;
+	mod->refcnt_param.get = refcnt_get_fn;
+
+	return add_attribute(mod, &mod->refcnt_param);
+}
+
 #else /* !CONFIG_MODULE_UNLOAD */
 static void print_unload_info(struct seq_file *m, struct module *mod)
 {
@@ -689,6 +722,10 @@
 	return -ENOSYS;
 }
 
+static inline int sysfs_unload_setup(struct module *mod)
+{
+	return 0;
+}
 #endif /* CONFIG_MODULE_UNLOAD */
 
 #ifdef CONFIG_OBSOLETE_MODPARM
@@ -944,6 +981,116 @@
 	return ret;
 }
 
+#define to_module_attr(n) container_of(n, struct module_attribute, attr);
+
+static ssize_t module_attr_show(struct kobject *kobj,
+				struct attribute *attr,
+				char *buf)
+{
+	int count;
+	struct module_attribute *attribute = to_module_attr(attr);
+
+	if (!attribute->param->get)
+		return -EPERM;
+
+	count = attribute->param->get(buf, attribute->param);
+	if (count > 0) {
+		strcat(buf, "\n");
+		++count;
+	}
+	return count;
+}
+
+/* sysfs always hands a nul-terminated string in buf.  We rely on that. */
+static ssize_t module_attr_store(struct kobject *kobj,
+				 struct attribute *attr,
+				 const char *buf, size_t len)
+{
+	int err;
+	struct module_attribute *attribute = to_module_attr(attr);
+
+	if (!attribute->param->set)
+		return -EPERM;
+
+	err = attribute->param->set(buf, attribute->param);
+	if (!err)
+		return len;
+	return err;
+}
+
+static struct sysfs_ops module_sysfs_ops = {
+	.show = module_attr_show,
+	.store = module_attr_store,
+};
+
+static void module_kobj_release(struct kobject *kobj)
+{
+	kfree(container_of(kobj, struct module_kobject, kobj));
+}
+
+static struct kobj_type module_ktype = {
+	.sysfs_ops =	&module_sysfs_ops,
+	.release =	&module_kobj_release,
+};
+static decl_subsys(module, &module_ktype, NULL);
+
+static int mod_sysfs_setup(struct module *mod,
+			   struct kernel_param *kparam,
+			   unsigned int num_params)
+{
+	unsigned int i;
+	int err;
+
+	/* We overallocate: not every param is in sysfs, and maybe no refcnt */
+	mod->mkobj = kmalloc(sizeof(*mod->mkobj)
+			     + sizeof(mod->mkobj->attr[0]) * (num_params+1),
+			     GFP_KERNEL);
+	if (!mod->mkobj)
+		return -ENOMEM;
+
+	memset(&mod->mkobj->kobj, 0, sizeof(mod->mkobj->kobj));
+	err = kobject_set_name(&mod->mkobj->kobj, mod->name);
+	if (err)
+		goto out;
+	kobj_set_kset_s(mod->mkobj, module_subsys);
+	err = kobject_register(&mod->mkobj->kobj);
+	if (err)
+		goto out;
+
+	mod->mkobj->num_attributes = 0;
+
+	for (i = 0; i < num_params; i++) {
+		if (kparam[i].perm) {
+			err = add_attribute(mod, &kparam[i]);
+			if (err)
+				goto out_unreg;
+		}
+	}
+	err = sysfs_unload_setup(mod);
+	if (err)
+		goto out_unreg;
+	return 0;
+
+out_unreg:
+	for (i = 0; i < mod->mkobj->num_attributes; i++)
+		sysfs_remove_file(&mod->mkobj->kobj,&mod->mkobj->attr[i].attr);
+	/* Calls module_kobj_release */
+	kobject_unregister(&mod->mkobj->kobj);
+	return err;
+out:
+	kfree(mod->mkobj);
+	return err;
+}
+
+static void mod_kobject_remove(struct module *mod)
+{
+	unsigned int i;
+	for (i = 0; i < mod->mkobj->num_attributes; i++)
+		sysfs_remove_file(&mod->mkobj->kobj,&mod->mkobj->attr[i].attr);
+	/* Calls module_kobj_release */
+	kobject_unregister(&mod->mkobj->kobj);
+}
+
 /* Free a module, remove from lists, etc (must hold module mutex). */
 static void free_module(struct module *mod)
 {
@@ -952,6 +1099,8 @@
 	list_del(&mod->list);
 	spin_unlock_irq(&modlist_lock);
 
+	mod_kobject_remove(mod);
+
 	/* Arch-specific cleanup. */
 	module_arch_cleanup(mod);
 
@@ -1131,7 +1280,7 @@
 		license = "unspecified";
 
 	mod->license_gplok = license_is_gpl_compatible(license);
-	if (!mod->license_gplok) {
+	if (!mod->license_gplok && !(tainted & TAINT_PROPRIETARY_MODULE)) {
 		printk(KERN_WARNING "%s: module license '%s' taints kernel.\n",
 		       mod->name, license);
 		tainted |= TAINT_PROPRIETARY_MODULE;
@@ -1556,6 +1705,11 @@
 				 / sizeof(struct kernel_param),
 				 NULL);
 	}
+	err = mod_sysfs_setup(mod, 
+			      (struct kernel_param *)
+			      sechdrs[setupindex].sh_addr,
+			      sechdrs[setupindex].sh_size
+			      / sizeof(struct kernel_param));
 	if (err < 0)
 		goto arch_cleanup;
 
@@ -1886,8 +2040,25 @@
 	return NULL;
 }
 
+/* Don't grab lock, we're oopsing. */
+void print_modules(void)
+{
+	struct module *mod;
+
+	printk("Modules linked in:");
+	list_for_each_entry(mod, &modules, list)
+		printk(" %s", mod->name);
+	printk("\n");
+}
+
 #ifdef CONFIG_MODVERSIONS
 /* Generate the signature for struct module here, too, for modversions. */
 void struct_module(struct module *mod) { return; }
 EXPORT_SYMBOL(struct_module);
 #endif
+
+static int __init modules_init(void)
+{
+	return subsystem_register(&module_subsys);
+}
+__initcall(modules_init);
diff -Nru a/kernel/params.c b/kernel/params.c
--- a/kernel/params.c	Tue Jun 15 22:20:44 2004
+++ b/kernel/params.c	Tue Jun 15 22:20:44 2004
@@ -161,7 +161,7 @@
 									\
 		if (!val) return -EINVAL;				\
 		l = strtolfn(val, &endp, 0);				\
-		if (endp == val || *endp || ((type)l != l))		\
+		if (endp == val || ((type)l != l))			\
 			return -EINVAL;					\
 		*((type *)kp->arg) = l;					\
 		return 0;						\
diff -Nru a/kernel/power/process.c b/kernel/power/process.c
--- a/kernel/power/process.c	Tue Jun 15 22:20:36 2004
+++ b/kernel/power/process.c	Tue Jun 15 22:20:36 2004
@@ -13,12 +13,6 @@
 #include <linux/suspend.h>
 #include <linux/module.h>
 
-#ifdef DEBUG_SLOW
-#define MDELAY(a) mdelay(a)
-#else
-#define MDELAY(a)
-#endif
-
 /* 
  * Timeout for stopping processes
  */
@@ -121,7 +115,6 @@
 	read_unlock(&tasklist_lock);
 	schedule();
 	printk( " done\n" );
-	MDELAY(500);
 }
 
 EXPORT_SYMBOL(refrigerator);
diff -Nru a/kernel/power/swsusp.c b/kernel/power/swsusp.c
--- a/kernel/power/swsusp.c	Tue Jun 15 22:20:38 2004
+++ b/kernel/power/swsusp.c	Tue Jun 15 22:20:38 2004
@@ -222,10 +222,30 @@
 	__free_page(page);
 }
 
+
+/*
+ * Check whether the swap device is the specified resume
+ * device, irrespective of whether they are specified by
+ * identical names.
+ *
+ * (Thus, device inode aliasing is allowed.  You can say /dev/hda4
+ * instead of /dev/ide/host0/bus0/target0/lun0/part4 [if using devfs]
+ * and they'll be considered the same device.  This is *necessary* for
+ * devfs, since the resume code can only recognize the form /dev/hda4,
+ * but the suspend code would see the long name.)
+ */
+static int is_resume_device(const struct swap_info_struct *swap_info)
+{
+	struct file *file = swap_info->swap_file;
+	struct inode *inode = file->f_dentry->d_inode;
+
+	return S_ISBLK(inode->i_mode) &&
+		resume_device == MKDEV(imajor(inode), iminor(inode));
+}
+
 static void read_swapfiles(void) /* This is called before saving image */
 {
 	int i, len;
-	static char buff[sizeof(resume_file)], *sname;
 	
 	len=strlen(resume_file);
 	root_swap = 0xFFFF;
@@ -244,17 +264,10 @@
 					swapfile_used[i] = SWAPFILE_IGNORED;				  
 			} else {
 	  			/* we ignore all swap devices that are not the resume_file */
-				sname = d_path(swap_info[i].swap_file->f_dentry,
-					       swap_info[i].swap_file->f_vfsmnt,
-					       buff,
-					       sizeof(buff));
-				if (!strcmp(sname, resume_file)) {
+				if (is_resume_device(&swap_info[i])) {
 					swapfile_used[i] = SWAPFILE_SUSPEND;
 					root_swap = i;
 				} else {
-#if 0
-					printk( "Resume: device %s (%x != %x) ignored\n", swap_info[i].swap_file->d_name.name, swap_info[i].swap_device, resume_device );				  
-#endif
 				  	swapfile_used[i] = SWAPFILE_IGNORED;
 				}
 			}
@@ -1098,7 +1111,7 @@
 	return 0;
 }
 
-static int read_suspend_image(const char * specialfile, int noresume)
+static int __init read_suspend_image(const char * specialfile, int noresume)
 {
 	union diskpage *cur;
 	unsigned long scratch_page = 0;
diff -Nru a/kernel/printk.c b/kernel/printk.c
--- a/kernel/printk.c	Tue Jun 15 22:21:05 2004
+++ b/kernel/printk.c	Tue Jun 15 22:21:05 2004
@@ -472,6 +472,27 @@
 }
 
 /*
+ * Zap console related locks when oopsing. Only zap at most once
+ * every 10 seconds, to leave time for slow consoles to print a
+ * full oops.
+ */
+static void zap_locks(void)
+{
+	static unsigned long oops_timestamp;
+
+	if (time_after_eq(jiffies, oops_timestamp) &&
+			!time_after(jiffies, oops_timestamp + 30*HZ))
+		return;
+
+	oops_timestamp = jiffies;
+
+	/* If a crash is occurring, make sure we can't deadlock */
+	spin_lock_init(&logbuf_lock);
+	/* And make sure that we print immediately */
+	init_MUTEX(&console_sem);
+}
+
+/*
  * This is printk.  It can be called from any context.  We want it to work.
  * 
  * We try to grab the console_sem.  If we succeed, it's easy - we log the output and
@@ -493,12 +514,8 @@
 	static char printk_buf[1024];
 	static int log_level_unknown = 1;
 
-	if (oops_in_progress) {
-		/* If a crash is occurring, make sure we can't deadlock */
-		spin_lock_init(&logbuf_lock);
-		/* And make sure that we print immediately */
-		init_MUTEX(&console_sem);
-	}
+	if (unlikely(oops_in_progress))
+		zap_locks();
 
 	/* This stops the holder of console_sem just where we want him */
 	spin_lock_irqsave(&logbuf_lock, flags);
diff -Nru a/kernel/rcupdate.c b/kernel/rcupdate.c
--- a/kernel/rcupdate.c	Tue Jun 15 22:20:36 2004
+++ b/kernel/rcupdate.c	Tue Jun 15 22:20:36 2004
@@ -113,7 +113,7 @@
 		return;
 	}
 	/* Can't change, since spin lock held. */
-	active = idle_cpu_mask;
+	active = nohz_cpu_mask;
 	cpus_complement(active);
 	cpus_and(rcu_ctrlblk.rcu_cpu_mask, cpu_online_map, active);
 }
@@ -223,13 +223,13 @@
 
 	if (!list_empty(&RCU_curlist(cpu)) &&
 	    rcu_batch_after(rcu_ctrlblk.curbatch, RCU_batch(cpu))) {
-		list_splice(&RCU_curlist(cpu), &list);
+		__list_splice(&RCU_curlist(cpu), &list);
 		INIT_LIST_HEAD(&RCU_curlist(cpu));
 	}
 
 	local_irq_disable();
 	if (!list_empty(&RCU_nxtlist(cpu)) && list_empty(&RCU_curlist(cpu))) {
-		list_splice(&RCU_nxtlist(cpu), &RCU_curlist(cpu));
+		__list_splice(&RCU_nxtlist(cpu), &RCU_curlist(cpu));
 		INIT_LIST_HEAD(&RCU_nxtlist(cpu));
 		local_irq_enable();
 
diff -Nru a/kernel/resource.c b/kernel/resource.c
--- a/kernel/resource.c	Tue Jun 15 22:20:42 2004
+++ b/kernel/resource.c	Tue Jun 15 22:20:42 2004
@@ -332,8 +332,8 @@
 		if (next->sibling->start > new->end)
 			break;
 
-	/* existing resource overlaps end of new resource */
-	if (next->end > new->end) {
+	/* existing resource includes new resource */
+	if (next->end >= new->end) {
 		parent = next;
 		result = 0;
 		goto begin;
diff -Nru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c	Tue Jun 15 22:20:43 2004
+++ b/kernel/sched.c	Tue Jun 15 22:20:43 2004
@@ -15,6 +15,7 @@
  *		and per-CPU runqueues.  Cleanups and useful suggestions
  *		by Davide Libenzi, preemptible kernel bits by Robert Love.
  *  2003-09-03	Interactivity tuning by Con Kolivas.
+ *  2004-04-02	Scheduler domains code by Nick Piggin
  */
 
 #include <linux/mm.h>
@@ -40,6 +41,8 @@
 #include <linux/percpu.h>
 #include <linux/kthread.h>
 
+#include <asm/unistd.h>
+
 #ifdef CONFIG_NUMA
 #define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
 #else
@@ -91,7 +94,6 @@
 #define MAX_SLEEP_AVG		(AVG_TIMESLICE * MAX_BONUS)
 #define STARVATION_LIMIT	(MAX_SLEEP_AVG)
 #define NS_MAX_SLEEP_AVG	(JIFFIES_TO_NS(MAX_SLEEP_AVG))
-#define NODE_THRESHOLD		125
 #define CREDIT_LIMIT		100
 
 /*
@@ -139,8 +141,7 @@
 	(v1) * (v2_max) / (v1_max)
 
 #define DELTA(p) \
-	(SCALE(TASK_NICE(p), 40, MAX_USER_PRIO*PRIO_BONUS_RATIO/100) + \
-		INTERACTIVE_DELTA)
+	(SCALE(TASK_NICE(p), 40, MAX_BONUS) + INTERACTIVE_DELTA)
 
 #define TASK_INTERACTIVE(p) \
 	((p)->prio <= (p)->static_prio - DELTA(p))
@@ -173,11 +174,13 @@
 		((MAX_TIMESLICE - MIN_TIMESLICE) * \
 			(MAX_PRIO-1 - (p)->static_prio) / (MAX_USER_PRIO-1)))
 
-static inline unsigned int task_timeslice(task_t *p)
+static unsigned int task_timeslice(task_t *p)
 {
 	return BASE_TIMESLICE(p);
 }
 
+#define task_hot(p, now, sd) ((now) - (p)->timestamp < (sd)->cache_hot_time)
+
 /*
  * These are the runqueue data structures:
  */
@@ -187,7 +190,7 @@
 typedef struct runqueue runqueue_t;
 
 struct prio_array {
-	int nr_active;
+	unsigned int nr_active;
 	unsigned long bitmap[BITMAP_SIZE];
 	struct list_head queue[MAX_PRIO];
 };
@@ -201,37 +204,46 @@
  */
 struct runqueue {
 	spinlock_t lock;
+
+	/*
+	 * nr_running and cpu_load should be in the same cacheline because
+	 * remote CPUs use both these fields when doing load calculation.
+	 */
+	unsigned long nr_running;
+#ifdef CONFIG_SMP
+	unsigned long cpu_load;
+#endif
 	unsigned long long nr_switches;
-	unsigned long nr_running, expired_timestamp, nr_uninterruptible,
-		timestamp_last_tick;
+	unsigned long expired_timestamp, nr_uninterruptible;
+	unsigned long long timestamp_last_tick;
 	task_t *curr, *idle;
 	struct mm_struct *prev_mm;
 	prio_array_t *active, *expired, arrays[2];
-	int best_expired_prio, prev_cpu_load[NR_CPUS];
-#ifdef CONFIG_NUMA
-	atomic_t *node_nr_running;
-	int prev_node_load[MAX_NUMNODES];
-#endif
+	int best_expired_prio;
+	atomic_t nr_iowait;
+
+#ifdef CONFIG_SMP
+	struct sched_domain *sd;
+
+	/* For active balancing */
+	int active_balance;
+	int push_cpu;
+
 	task_t *migration_thread;
 	struct list_head migration_queue;
-
-	atomic_t nr_iowait;
+#endif
 };
 
 static DEFINE_PER_CPU(struct runqueue, runqueues);
 
+#define for_each_domain(cpu, domain) \
+	for (domain = cpu_rq(cpu)->sd; domain; domain = domain->parent)
+
 #define cpu_rq(cpu)		(&per_cpu(runqueues, (cpu)))
 #define this_rq()		(&__get_cpu_var(runqueues))
 #define task_rq(p)		cpu_rq(task_cpu(p))
 #define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
 
-extern unsigned long __scheduling_functions_start_here;
-extern unsigned long __scheduling_functions_end_here;
-const unsigned long scheduling_functions_start_here =
-			(unsigned long)&__scheduling_functions_start_here;
-const unsigned long scheduling_functions_end_here =
-			(unsigned long)&__scheduling_functions_end_here;
-
 /*
  * Default context-switch locking:
  */
@@ -241,57 +253,12 @@
 # define task_running(rq, p)		((rq)->curr == (p))
 #endif
 
-#ifdef CONFIG_NUMA
-
-/*
- * Keep track of running tasks.
- */
-
-static atomic_t node_nr_running[MAX_NUMNODES] ____cacheline_maxaligned_in_smp =
-	{[0 ...MAX_NUMNODES-1] = ATOMIC_INIT(0)};
-
-static inline void nr_running_init(struct runqueue *rq)
-{
-	rq->node_nr_running = &node_nr_running[0];
-}
-
-static inline void nr_running_inc(runqueue_t *rq)
-{
-	atomic_inc(rq->node_nr_running);
-	rq->nr_running++;
-}
-
-static inline void nr_running_dec(runqueue_t *rq)
-{
-	atomic_dec(rq->node_nr_running);
-	rq->nr_running--;
-}
-
-__init void node_nr_running_init(void)
-{
-	int i;
-
-	for (i = 0; i < NR_CPUS; i++) {
-		if (cpu_possible(i))
-			cpu_rq(i)->node_nr_running =
-				&node_nr_running[cpu_to_node(i)];
-	}
-}
-
-#else /* !CONFIG_NUMA */
-
-# define nr_running_init(rq)	do { } while (0)
-# define nr_running_inc(rq)	do { (rq)->nr_running++; } while (0)
-# define nr_running_dec(rq)	do { (rq)->nr_running--; } while (0)
-
-#endif /* CONFIG_NUMA */
-
 /*
  * task_rq_lock - lock the runqueue a given task resides on and disable
  * interrupts.  Note the ordering: we can safely lookup the task_rq without
  * explicitly disabling preemption.
  */
-static inline runqueue_t *task_rq_lock(task_t *p, unsigned long *flags)
+static runqueue_t *task_rq_lock(task_t *p, unsigned long *flags)
 {
 	struct runqueue *rq;
 
@@ -314,7 +281,7 @@
 /*
  * rq_lock - lock a given runqueue and disable interrupts.
  */
-static inline runqueue_t *this_rq_lock(void)
+static runqueue_t *this_rq_lock(void)
 {
 	runqueue_t *rq;
 
@@ -333,7 +300,7 @@
 /*
  * Adding/removing a task to/from a priority array:
  */
-static inline void dequeue_task(struct task_struct *p, prio_array_t *array)
+static void dequeue_task(struct task_struct *p, prio_array_t *array)
 {
 	array->nr_active--;
 	list_del(&p->run_list);
@@ -341,7 +308,7 @@
 		__clear_bit(p->prio, array->bitmap);
 }
 
-static inline void enqueue_task(struct task_struct *p, prio_array_t *array)
+static void enqueue_task(struct task_struct *p, prio_array_t *array)
 {
 	list_add_tail(&p->run_list, array->queue + p->prio);
 	__set_bit(p->prio, array->bitmap);
@@ -350,6 +317,19 @@
 }
 
 /*
+ * Used by the migration code - we pull tasks from the head of the
+ * remote queue so we want these tasks to show up at the head of the
+ * local queue:
+ */
+static inline void enqueue_task_head(struct task_struct *p, prio_array_t *array)
+{
+	list_add(&p->run_list, array->queue + p->prio);
+	__set_bit(p->prio, array->bitmap);
+	array->nr_active++;
+	p->array = array;
+}
+
+/*
  * effective_prio - return the priority that is based on the static
  * priority but is modified by bonuses/penalties.
  *
@@ -386,7 +366,16 @@
 static inline void __activate_task(task_t *p, runqueue_t *rq)
 {
 	enqueue_task(p, rq->active);
-	nr_running_inc(rq);
+	rq->nr_running++;
+}
+
+/*
+ * __activate_idle_task - move idle task to the _front_ of runqueue.
+ */
+static inline void __activate_idle_task(task_t *p, runqueue_t *rq)
+{
+	enqueue_task_head(p, rq->active);
+	rq->nr_running++;
 }
 
 static void recalc_task_prio(task_t *p, unsigned long long now)
@@ -469,9 +458,19 @@
  * Update all the scheduling statistics stuff. (sleep average
  * calculation, priority modifiers, etc.)
  */
-static inline void activate_task(task_t *p, runqueue_t *rq)
+static void activate_task(task_t *p, runqueue_t *rq, int local)
 {
-	unsigned long long now = sched_clock();
+	unsigned long long now;
+
+	now = sched_clock();
+#ifdef CONFIG_SMP
+	if (!local) {
+		/* Compensate for drifting sched_clock */
+		runqueue_t *this_rq = this_rq();
+		now = (now - this_rq->timestamp_last_tick)
+			+ rq->timestamp_last_tick;
+	}
+#endif
 
 	recalc_task_prio(p, now);
 
@@ -505,9 +504,9 @@
 /*
  * deactivate_task - remove a task from the runqueue.
  */
-static inline void deactivate_task(struct task_struct *p, runqueue_t *rq)
+static void deactivate_task(struct task_struct *p, runqueue_t *rq)
 {
-	nr_running_dec(rq);
+	rq->nr_running--;
 	if (p->state == TASK_UNINTERRUPTIBLE)
 		rq->nr_uninterruptible++;
 	dequeue_task(p, p->array);
@@ -521,9 +520,9 @@
  * might also involve a cross-CPU call to trigger the scheduler on
  * the target CPU.
  */
-static inline void resched_task(task_t *p)
-{
 #ifdef CONFIG_SMP
+static void resched_task(task_t *p)
+{
 	int need_resched, nrpolling;
 
 	preempt_disable();
@@ -535,10 +534,13 @@
 	if (!need_resched && !nrpolling && (task_cpu(p) != smp_processor_id()))
 		smp_send_reschedule(task_cpu(p));
 	preempt_enable();
+}
 #else
+static inline void resched_task(task_t *p)
+{
 	set_tsk_need_resched(p);
-#endif
 }
+#endif
 
 /**
  * task_curr - is this task currently executing on a CPU?
@@ -550,40 +552,46 @@
 }
 
 #ifdef CONFIG_SMP
+enum request_type {
+	REQ_MOVE_TASK,
+	REQ_SET_DOMAIN,
+};
+
 typedef struct {
 	struct list_head list;
+	enum request_type type;
+
+	/* For REQ_MOVE_TASK */
 	task_t *task;
+	int dest_cpu;
+
+	/* For REQ_SET_DOMAIN */
+	struct sched_domain *sd;
+
 	struct completion done;
 } migration_req_t;
 
 /*
- * The task's runqueue lock must be held, and the new mask must be valid.
+ * The task's runqueue lock must be held.
  * Returns true if you have to wait for migration thread.
  */
-static int __set_cpus_allowed(task_t *p, cpumask_t new_mask,
-				migration_req_t *req)
+static int migrate_task(task_t *p, int dest_cpu, migration_req_t *req)
 {
 	runqueue_t *rq = task_rq(p);
 
-	p->cpus_allowed = new_mask;
-	/*
-	 * Can the task run on the task's current CPU? If not then
-	 * migrate the thread off to a proper CPU.
-	 */
-	if (cpu_isset(task_cpu(p), new_mask))
-		return 0;
-
 	/*
 	 * If the task is not on a runqueue (and not running), then
 	 * it is sufficient to simply update the task's cpu field.
 	 */
 	if (!p->array && !task_running(rq, p)) {
-		set_task_cpu(p, any_online_cpu(p->cpus_allowed));
+		set_task_cpu(p, dest_cpu);
 		return 0;
 	}
 
 	init_completion(&req->done);
+	req->type = REQ_MOVE_TASK;
 	req->task = p;
+	req->dest_cpu = dest_cpu;
 	list_add(&req->list, &rq->migration_queue);
 	return 1;
 }
@@ -638,6 +646,71 @@
 
 EXPORT_SYMBOL_GPL(kick_process);
 
+/*
+ * Return a low guess at the load of a migration-source cpu.
+ *
+ * We want to under-estimate the load of migration sources, to
+ * balance conservatively.
+ */
+static inline unsigned long source_load(int cpu)
+{
+	runqueue_t *rq = cpu_rq(cpu);
+	unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE;
+
+	return min(rq->cpu_load, load_now);
+}
+
+/*
+ * Return a high guess at the load of a migration-target cpu
+ */
+static inline unsigned long target_load(int cpu)
+{
+	runqueue_t *rq = cpu_rq(cpu);
+	unsigned long load_now = rq->nr_running * SCHED_LOAD_SCALE;
+
+	return max(rq->cpu_load, load_now);
+}
+
+#endif
+
+/*
+ * wake_idle() is useful especially on SMT architectures to wake a
+ * task onto an idle sibling if we would otherwise wake it onto a
+ * busy sibling.
+ *
+ * Returns the CPU we should wake onto.
+ */
+#if defined(ARCH_HAS_SCHED_WAKE_IDLE)
+static int wake_idle(int cpu, task_t *p)
+{
+	cpumask_t tmp;
+	runqueue_t *rq = cpu_rq(cpu);
+	struct sched_domain *sd;
+	int i;
+
+	if (idle_cpu(cpu))
+		return cpu;
+
+	sd = rq->sd;
+	if (!(sd->flags & SD_WAKE_IDLE))
+		return cpu;
+
+	cpus_and(tmp, sd->span, cpu_online_map);
+	for_each_cpu_mask(i, tmp) {
+		if (!cpu_isset(i, p->cpus_allowed))
+			continue;
+
+		if (idle_cpu(i))
+			return i;
+	}
+
+	return cpu;
+}
+#else
+static inline int wake_idle(int cpu, task_t *p)
+{
+	return cpu;
+}
 #endif
 
 /***
@@ -656,52 +729,129 @@
  */
 static int try_to_wake_up(task_t * p, unsigned int state, int sync)
 {
+	int cpu, this_cpu, success = 0;
 	unsigned long flags;
-	int success = 0;
 	long old_state;
 	runqueue_t *rq;
+#ifdef CONFIG_SMP
+	unsigned long load, this_load;
+	struct sched_domain *sd;
+	int new_cpu;
+#endif
 
-repeat_lock_task:
 	rq = task_rq_lock(p, &flags);
 	old_state = p->state;
-	if (old_state & state) {
-		if (!p->array) {
+	if (!(old_state & state))
+		goto out;
+
+	if (p->array)
+		goto out_running;
+
+	cpu = task_cpu(p);
+	this_cpu = smp_processor_id();
+
+#ifdef CONFIG_SMP
+	if (unlikely(task_running(rq, p)))
+		goto out_activate;
+
+	new_cpu = cpu;
+
+	if (cpu == this_cpu || unlikely(!cpu_isset(this_cpu, p->cpus_allowed)))
+		goto out_set_cpu;
+
+	load = source_load(cpu);
+	this_load = target_load(this_cpu);
+
+	/*
+	 * If sync wakeup then subtract the (maximum possible) effect of
+	 * the currently running task from the load of the current CPU:
+	 */
+	if (sync)
+		this_load -= SCHED_LOAD_SCALE;
+
+	/* Don't pull the task off an idle CPU to a busy one */
+	if (load < SCHED_LOAD_SCALE/2 && this_load > SCHED_LOAD_SCALE/2)
+		goto out_set_cpu;
+
+	new_cpu = this_cpu; /* Wake to this CPU if we can */
+
+	/*
+	 * Scan domains for affine wakeup and passive balancing
+	 * possibilities.
+	 */
+	for_each_domain(this_cpu, sd) {
+		unsigned int imbalance;
+		/*
+		 * Start passive balancing when half the imbalance_pct
+		 * limit is reached.
+		 */
+		imbalance = sd->imbalance_pct + (sd->imbalance_pct - 100) / 2;
+
+		if ( ((sd->flags & SD_WAKE_AFFINE) &&
+				!task_hot(p, rq->timestamp_last_tick, sd))
+			|| ((sd->flags & SD_WAKE_BALANCE) &&
+				imbalance*this_load <= 100*load) ) {
 			/*
-			 * Fast-migrate the task if it's not running or runnable
-			 * currently. Do not violate hard affinity.
+			 * Now sd has SD_WAKE_AFFINE and p is cache cold in sd
+			 * or sd has SD_WAKE_BALANCE and there is an imbalance
 			 */
-			if (unlikely(sync && !task_running(rq, p) &&
-				(task_cpu(p) != smp_processor_id()) &&
-					cpu_isset(smp_processor_id(),
-							p->cpus_allowed) &&
-					!cpu_is_offline(smp_processor_id()))) {
-				set_task_cpu(p, smp_processor_id());
-				task_rq_unlock(rq, &flags);
-				goto repeat_lock_task;
-			}
-			if (old_state == TASK_UNINTERRUPTIBLE) {
-				rq->nr_uninterruptible--;
-				/*
-				 * Tasks on involuntary sleep don't earn
-				 * sleep_avg beyond just interactive state.
-				 */
-				p->activated = -1;
-			}
-			if (sync && (task_cpu(p) == smp_processor_id()))
-				__activate_task(p, rq);
-			else {
-				activate_task(p, rq);
-				if (TASK_PREEMPTS_CURR(p, rq))
-					resched_task(rq->curr);
-			}
-			success = 1;
+			if (cpu_isset(cpu, sd->span))
+				goto out_set_cpu;
 		}
-		p->state = TASK_RUNNING;
 	}
+
+	new_cpu = cpu; /* Could not wake to this_cpu. Wake to cpu instead */
+out_set_cpu:
+	new_cpu = wake_idle(new_cpu, p);
+	if (new_cpu != cpu && cpu_isset(new_cpu, p->cpus_allowed)) {
+		set_task_cpu(p, new_cpu);
+		task_rq_unlock(rq, &flags);
+		/* might preempt at this point */
+		rq = task_rq_lock(p, &flags);
+		old_state = p->state;
+		if (!(old_state & state))
+			goto out;
+		if (p->array)
+			goto out_running;
+
+		this_cpu = smp_processor_id();
+		cpu = task_cpu(p);
+	}
+
+out_activate:
+#endif /* CONFIG_SMP */
+	if (old_state == TASK_UNINTERRUPTIBLE) {
+		rq->nr_uninterruptible--;
+		/*
+		 * Tasks on involuntary sleep don't earn
+		 * sleep_avg beyond just interactive state.
+		 */
+		p->activated = -1;
+	}
+
+	/*
+	 * Sync wakeups (i.e. those types of wakeups where the waker
+	 * has indicated that it will leave the CPU in short order)
+	 * don't trigger a preemption, if the woken up task will run on
+	 * this cpu. (in this case the 'I will reschedule' promise of
+	 * the waker guarantees that the freshly woken up task is going
+	 * to be considered on this CPU.)
+	 */
+	activate_task(p, rq, cpu == this_cpu);
+	if (!sync || cpu != this_cpu) {
+		if (TASK_PREEMPTS_CURR(p, rq))
+			resched_task(rq->curr);
+	}
+	success = 1;
+
+out_running:
+	p->state = TASK_RUNNING;
+out:
 	task_rq_unlock(rq, &flags);
 
 	return success;
 }
+
 int fastcall wake_up_process(task_t * p)
 {
 	return try_to_wake_up(p, TASK_STOPPED |
@@ -756,8 +906,8 @@
 	p->timestamp = sched_clock();
 	if (!current->time_slice) {
 		/*
-	 	 * This case is rare, it happens when the parent has only
-	 	 * a single jiffy left from its timeslice. Taking the
+		 * This case is rare, it happens when the parent has only
+		 * a single jiffy left from its timeslice. Taking the
 		 * runqueue lock is not a problem.
 		 */
 		current->time_slice = 1;
@@ -805,7 +955,7 @@
 		list_add_tail(&p->run_list, &current->run_list);
 		p->array = current->array;
 		p->array->nr_active++;
-		nr_running_inc(rq);
+		rq->nr_running++;
 	}
 	task_rq_unlock(rq, &flags);
 }
@@ -856,7 +1006,7 @@
  * with the lock held can cause deadlocks; see schedule() for
  * details.)
  */
-static inline void finish_task_switch(task_t *prev)
+static void finish_task_switch(task_t *prev)
 {
 	runqueue_t *rq = this_rq();
 	struct mm_struct *mm = rq->prev_mm;
@@ -873,7 +1023,7 @@
 	 * still held, otherwise prev could be scheduled on another cpu, die
 	 * there before we look at prev->state, and then the reference would
 	 * be dropped twice.
-	 * 		Manfred Spraul <manfred@colorfullife.com>
+	 *		Manfred Spraul <manfred@colorfullife.com>
 	 */
 	prev_task_flags = prev->flags;
 	finish_arch_switch(rq, prev);
@@ -935,7 +1085,7 @@
 {
 	unsigned long i, sum = 0;
 
-	for (i = 0; i < NR_CPUS; i++)
+	for_each_cpu(i)
 		sum += cpu_rq(i)->nr_running;
 
 	return sum;
@@ -945,7 +1095,7 @@
 {
 	unsigned long i, sum = 0;
 
-	for_each_cpu(i)
+	for_each_online_cpu(i)
 		sum += cpu_rq(i)->nr_uninterruptible;
 
 	return sum;
@@ -955,7 +1105,7 @@
 {
 	unsigned long long i, sum = 0;
 
-	for_each_cpu(i)
+	for_each_online_cpu(i)
 		sum += cpu_rq(i)->nr_switches;
 
 	return sum;
@@ -965,7 +1115,7 @@
 {
 	unsigned long i, sum = 0;
 
-	for_each_cpu(i)
+	for_each_online_cpu(i)
 		sum += atomic_read(&cpu_rq(i)->nr_iowait);
 
 	return sum;
@@ -977,7 +1127,7 @@
  * Note this does not disable interrupts like task_rq_lock,
  * you need to do so manually before calling.
  */
-static inline void double_rq_lock(runqueue_t *rq1, runqueue_t *rq2)
+static void double_rq_lock(runqueue_t *rq1, runqueue_t *rq2)
 {
 	if (rq1 == rq2)
 		spin_lock(&rq1->lock);
@@ -998,14 +1148,151 @@
  * Note this does not restore interrupts like task_rq_unlock,
  * you need to do so manually after calling.
  */
-static inline void double_rq_unlock(runqueue_t *rq1, runqueue_t *rq2)
+static void double_rq_unlock(runqueue_t *rq1, runqueue_t *rq2)
 {
 	spin_unlock(&rq1->lock);
 	if (rq1 != rq2)
 		spin_unlock(&rq2->lock);
 }
 
-#ifdef CONFIG_NUMA
+enum idle_type
+{
+	IDLE,
+	NOT_IDLE,
+	NEWLY_IDLE,
+};
+
+#ifdef CONFIG_SMP
+
+/*
+ * find_idlest_cpu - find the least busy runqueue.
+ */
+static int find_idlest_cpu(struct task_struct *p, int this_cpu,
+			   struct sched_domain *sd)
+{
+	unsigned long load, min_load, this_load;
+	int i, min_cpu;
+	cpumask_t mask;
+
+	min_cpu = UINT_MAX;
+	min_load = ULONG_MAX;
+
+	cpus_and(mask, sd->span, cpu_online_map);
+	cpus_and(mask, mask, p->cpus_allowed);
+
+	for_each_cpu_mask(i, mask) {
+		load = target_load(i);
+
+		if (load < min_load) {
+			min_cpu = i;
+			min_load = load;
+
+			/* break out early on an idle CPU: */
+			if (!min_load)
+				break;
+		}
+	}
+
+	/* add +1 to account for the new task */
+	this_load = source_load(this_cpu) + SCHED_LOAD_SCALE;
+
+	/*
+	 * Would with the addition of the new task to the
+	 * current CPU there be an imbalance between this
+	 * CPU and the idlest CPU?
+	 *
+	 * Use half of the balancing threshold - new-context is
+	 * a good opportunity to balance.
+	 */
+	if (min_load*(100 + (sd->imbalance_pct-100)/2) < this_load*100)
+		return min_cpu;
+
+	return this_cpu;
+}
+
+/*
+ * wake_up_forked_thread - wake up a freshly forked thread.
+ *
+ * This function will do some initial scheduler statistics housekeeping
+ * that must be done for every newly created context, and it also does
+ * runqueue balancing.
+ */
+void fastcall wake_up_forked_thread(task_t * p)
+{
+	unsigned long flags;
+	int this_cpu = get_cpu(), cpu;
+	struct sched_domain *tmp, *sd = NULL;
+	runqueue_t *this_rq = cpu_rq(this_cpu), *rq;
+
+	/*
+	 * Find the largest domain that this CPU is part of that
+	 * is willing to balance on clone:
+	 */
+	for_each_domain(this_cpu, tmp)
+		if (tmp->flags & SD_BALANCE_CLONE)
+			sd = tmp;
+	if (sd)
+		cpu = find_idlest_cpu(p, this_cpu, sd);
+	else
+		cpu = this_cpu;
+
+	local_irq_save(flags);
+lock_again:
+	rq = cpu_rq(cpu);
+	double_rq_lock(this_rq, rq);
+
+	BUG_ON(p->state != TASK_RUNNING);
+
+	/*
+	 * We did find_idlest_cpu() unlocked, so in theory
+	 * the mask could have changed - just dont migrate
+	 * in this case:
+	 */
+	if (unlikely(!cpu_isset(cpu, p->cpus_allowed))) {
+		cpu = this_cpu;
+		double_rq_unlock(this_rq, rq);
+		goto lock_again;
+	}
+	/*
+	 * We decrease the sleep average of forking parents
+	 * and children as well, to keep max-interactive tasks
+	 * from forking tasks that are max-interactive.
+	 */
+	current->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(current) *
+		PARENT_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);
+
+	p->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(p) *
+		CHILD_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);
+
+	p->interactive_credit = 0;
+
+	p->prio = effective_prio(p);
+	set_task_cpu(p, cpu);
+
+	if (cpu == this_cpu) {
+		if (unlikely(!current->array))
+			__activate_task(p, rq);
+		else {
+			p->prio = current->prio;
+			list_add_tail(&p->run_list, &current->run_list);
+			p->array = current->array;
+			p->array->nr_active++;
+			rq->nr_running++;
+		}
+	} else {
+		/* Not the local CPU - must adjust timestamp */
+		p->timestamp = (p->timestamp - this_rq->timestamp_last_tick)
+					+ rq->timestamp_last_tick;
+		__activate_task(p, rq);
+		if (TASK_PREEMPTS_CURR(p, rq))
+			resched_task(rq->curr);
+	}
+
+	double_rq_unlock(this_rq, rq);
+	local_irq_restore(flags);
+	put_cpu();
+}
+
 /*
  * If dest_cpu is allowed for this process, migrate the task to it.
  * This is accomplished by forcing the cpu_allowed mask to only
@@ -1014,236 +1301,75 @@
  */
 static void sched_migrate_task(task_t *p, int dest_cpu)
 {
-	runqueue_t *rq;
 	migration_req_t req;
+	runqueue_t *rq;
 	unsigned long flags;
-	cpumask_t old_mask, new_mask = cpumask_of_cpu(dest_cpu);
 
-	lock_cpu_hotplug();
 	rq = task_rq_lock(p, &flags);
-	old_mask = p->cpus_allowed;
-	if (!cpu_isset(dest_cpu, old_mask) || !cpu_online(dest_cpu))
+	if (!cpu_isset(dest_cpu, p->cpus_allowed)
+	    || unlikely(cpu_is_offline(dest_cpu)))
 		goto out;
 
 	/* force the process onto the specified CPU */
-	if (__set_cpus_allowed(p, new_mask, &req)) {
-		/* Need to wait for migration thread. */
+	if (migrate_task(p, dest_cpu, &req)) {
+		/* Need to wait for migration thread (might exit: take ref). */
+		struct task_struct *mt = rq->migration_thread;
+		get_task_struct(mt);
 		task_rq_unlock(rq, &flags);
-		wake_up_process(rq->migration_thread);
+		wake_up_process(mt);
+		put_task_struct(mt);
 		wait_for_completion(&req.done);
-
-		/* If we raced with sys_sched_setaffinity, don't
-		 * restore mask. */
-		rq = task_rq_lock(p, &flags);
-		if (likely(cpus_equal(p->cpus_allowed, new_mask))) {
-			/* Restore old mask: won't need migration
-			 * thread, since current cpu is allowed. */
-			BUG_ON(__set_cpus_allowed(p, old_mask, NULL));
-		}
+		return;
 	}
 out:
 	task_rq_unlock(rq, &flags);
-	unlock_cpu_hotplug();
 }
 
 /*
- * Find the least loaded CPU.  Slightly favor the current CPU by
- * setting its runqueue length as the minimum to start.
+ * sched_balance_exec(): find the highest-level, exec-balance-capable
+ * domain and try to migrate the task to the least loaded CPU.
+ *
+ * execve() is a valuable balancing opportunity, because at this point
+ * the task has the smallest effective memory and cache footprint.
  */
-static int sched_best_cpu(struct task_struct *p)
-{
-	int i, minload, load, best_cpu, node = 0;
-	cpumask_t cpumask;
-
-	best_cpu = task_cpu(p);
-	if (cpu_rq(best_cpu)->nr_running <= 2)
-		return best_cpu;
-
-	minload = 10000000;
-	for_each_node_with_cpus(i) {
-		/*
-		 * Node load is always divided by nr_cpus_node to normalise
-		 * load values in case cpu count differs from node to node.
-		 * We first multiply node_nr_running by 10 to get a little
-		 * better resolution.
-		 */
-		load = 10 * atomic_read(&node_nr_running[i]) / nr_cpus_node(i);
-		if (load < minload) {
-			minload = load;
-			node = i;
-		}
-	}
-
-	minload = 10000000;
-	cpumask = node_to_cpumask(node);
-	for (i = 0; i < NR_CPUS; ++i) {
-		if (!cpu_isset(i, cpumask))
-			continue;
-		if (cpu_rq(i)->nr_running < minload) {
-			best_cpu = i;
-			minload = cpu_rq(i)->nr_running;
-		}
-	}
-	return best_cpu;
-}
-
 void sched_balance_exec(void)
 {
-	int new_cpu;
+	struct sched_domain *tmp, *sd = NULL;
+	int new_cpu, this_cpu = get_cpu();
 
-	if (numnodes > 1) {
-		new_cpu = sched_best_cpu(current);
-		if (new_cpu != smp_processor_id())
-			sched_migrate_task(current, new_cpu);
-	}
-}
+	/* Prefer the current CPU if there's only this task running */
+	if (this_rq()->nr_running <= 1)
+		goto out;
 
-/*
- * Find the busiest node. All previous node loads contribute with a
- * geometrically deccaying weight to the load measure:
- *      load_{t} = load_{t-1}/2 + nr_node_running_{t}
- * This way sudden load peaks are flattened out a bit.
- * Node load is divided by nr_cpus_node() in order to compare nodes
- * of different cpu count but also [first] multiplied by 10 to
- * provide better resolution.
- */
-static int find_busiest_node(int this_node)
-{
-	int i, node = -1, load, this_load, maxload;
-
-	if (!nr_cpus_node(this_node))
-		return node;
-	this_load = maxload = (this_rq()->prev_node_load[this_node] >> 1)
-		+ (10 * atomic_read(&node_nr_running[this_node])
-		/ nr_cpus_node(this_node));
-	this_rq()->prev_node_load[this_node] = this_load;
-	for_each_node_with_cpus(i) {
-		if (i == this_node)
-			continue;
-		load = (this_rq()->prev_node_load[i] >> 1)
-			+ (10 * atomic_read(&node_nr_running[i])
-			/ nr_cpus_node(i));
-		this_rq()->prev_node_load[i] = load;
-		if (load > maxload && (100*load > NODE_THRESHOLD*this_load)) {
-			maxload = load;
-			node = i;
+	for_each_domain(this_cpu, tmp)
+		if (tmp->flags & SD_BALANCE_EXEC)
+			sd = tmp;
+
+	if (sd) {
+		new_cpu = find_idlest_cpu(current, this_cpu, sd);
+		if (new_cpu != this_cpu) {
+			put_cpu();
+			sched_migrate_task(current, new_cpu);
+			return;
 		}
 	}
-	return node;
+out:
+	put_cpu();
 }
 
-#endif /* CONFIG_NUMA */
-
-#ifdef CONFIG_SMP
-
 /*
- * double_lock_balance - lock the busiest runqueue
- *
- * this_rq is locked already. Recalculate nr_running if we have to
- * drop the runqueue lock.
+ * double_lock_balance - lock the busiest runqueue, this_rq is locked already.
  */
-static inline
-unsigned int double_lock_balance(runqueue_t *this_rq, runqueue_t *busiest,
-				 int this_cpu, int idle,
-				 unsigned int nr_running)
+static void double_lock_balance(runqueue_t *this_rq, runqueue_t *busiest)
 {
 	if (unlikely(!spin_trylock(&busiest->lock))) {
 		if (busiest < this_rq) {
 			spin_unlock(&this_rq->lock);
 			spin_lock(&busiest->lock);
 			spin_lock(&this_rq->lock);
-			/* Need to recalculate nr_running */
-			if (idle || (this_rq->nr_running >
-					this_rq->prev_cpu_load[this_cpu]))
-				nr_running = this_rq->nr_running;
-			else
-				nr_running = this_rq->prev_cpu_load[this_cpu];
 		} else
 			spin_lock(&busiest->lock);
 	}
-	return nr_running;
-}
-
-/*
- * find_busiest_queue - find the busiest runqueue among the cpus in cpumask.
- */
-static inline
-runqueue_t *find_busiest_queue(runqueue_t *this_rq, int this_cpu, int idle,
-			       int *imbalance, cpumask_t cpumask)
-{
-	int nr_running, load, max_load, i;
-	runqueue_t *busiest, *rq_src;
-
-	/*
-	 * We search all runqueues to find the most busy one.
-	 * We do this lockless to reduce cache-bouncing overhead,
-	 * we re-check the 'best' source CPU later on again, with
-	 * the lock held.
-	 *
-	 * We fend off statistical fluctuations in runqueue lengths by
-	 * saving the runqueue length (as seen by the balancing CPU) during
-	 * the previous load-balancing operation and using the smaller one
-	 * of the current and saved lengths. If a runqueue is long enough
-	 * for a longer amount of time then we recognize it and pull tasks
-	 * from it.
-	 *
-	 * The 'current runqueue length' is a statistical maximum variable,
-	 * for that one we take the longer one - to avoid fluctuations in
-	 * the other direction. So for a load-balance to happen it needs
-	 * stable long runqueue on the target CPU and stable short runqueue
-	 * on the local runqueue.
-	 *
-	 * We make an exception if this CPU is about to become idle - in
-	 * that case we are less picky about moving a task across CPUs and
-	 * take what can be taken.
-	 */
-	if (idle || (this_rq->nr_running > this_rq->prev_cpu_load[this_cpu]))
-		nr_running = this_rq->nr_running;
-	else
-		nr_running = this_rq->prev_cpu_load[this_cpu];
-
-	busiest = NULL;
-	max_load = 1;
-	for (i = 0; i < NR_CPUS; i++) {
-		if (!cpu_isset(i, cpumask))
-			continue;
-
-		rq_src = cpu_rq(i);
-		if (idle || (rq_src->nr_running < this_rq->prev_cpu_load[i]))
-			load = rq_src->nr_running;
-		else
-			load = this_rq->prev_cpu_load[i];
-		this_rq->prev_cpu_load[i] = rq_src->nr_running;
-
-		if ((load > max_load) && (rq_src != this_rq)) {
-			busiest = rq_src;
-			max_load = load;
-		}
-	}
-
-	if (likely(!busiest))
-		goto out;
-
-	*imbalance = max_load - nr_running;
-
-	/* It needs an at least ~25% imbalance to trigger balancing. */
-	if (!idle && ((*imbalance)*4 < max_load)) {
-		busiest = NULL;
-		goto out;
-	}
-
-	nr_running = double_lock_balance(this_rq, busiest, this_cpu,
-					 idle, nr_running);
-	/*
-	 * Make sure nothing changed since we checked the
-	 * runqueue length.
-	 */
-	if (busiest->nr_running <= nr_running) {
-		spin_unlock(&busiest->lock);
-		busiest = NULL;
-	}
-out:
-	return busiest;
 }
 
 /*
@@ -1252,86 +1378,83 @@
  */
 static inline
 void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p,
-	       runqueue_t *this_rq, int this_cpu)
+	       runqueue_t *this_rq, prio_array_t *this_array, int this_cpu)
 {
 	dequeue_task(p, src_array);
-	nr_running_dec(src_rq);
+	src_rq->nr_running--;
 	set_task_cpu(p, this_cpu);
-	nr_running_inc(this_rq);
-	enqueue_task(p, this_rq->active);
-	p->timestamp = sched_clock() -
-				(src_rq->timestamp_last_tick - p->timestamp);
+	this_rq->nr_running++;
+	enqueue_task(p, this_array);
+	p->timestamp = (p->timestamp - src_rq->timestamp_last_tick)
+				+ this_rq->timestamp_last_tick;
 	/*
 	 * Note that idle threads have a prio of MAX_PRIO, for this test
 	 * to be always true for them.
 	 */
 	if (TASK_PREEMPTS_CURR(p, this_rq))
-		set_need_resched();
+		resched_task(this_rq->curr);
 }
 
 /*
  * can_migrate_task - may task p from runqueue rq be migrated to this_cpu?
  */
 static inline
-int can_migrate_task(task_t *tsk, runqueue_t *rq, int this_cpu, int idle)
+int can_migrate_task(task_t *p, runqueue_t *rq, int this_cpu,
+		     struct sched_domain *sd, enum idle_type idle)
 {
-	unsigned long delta = rq->timestamp_last_tick - tsk->timestamp;
-
 	/*
 	 * We do not migrate tasks that are:
 	 * 1) running (obviously), or
 	 * 2) cannot be migrated to this CPU due to cpus_allowed, or
 	 * 3) are cache-hot on their current CPU.
 	 */
-	if (task_running(rq, tsk))
-		return 0;
-	if (!cpu_isset(this_cpu, tsk->cpus_allowed))
+	if (task_running(rq, p))
 		return 0;
-	if (!idle && (delta <= JIFFIES_TO_NS(cache_decay_ticks)))
+	if (!cpu_isset(this_cpu, p->cpus_allowed))
 		return 0;
+
+	/* Aggressive migration if we've failed balancing */
+	if (idle == NEWLY_IDLE ||
+			sd->nr_balance_failed < sd->cache_nice_tries) {
+		if (task_hot(p, rq->timestamp_last_tick, sd))
+			return 0;
+	}
+
 	return 1;
 }
 
 /*
- * Current runqueue is empty, or rebalance tick: if there is an
- * inbalance (current runqueue is too short) then pull from
- * busiest runqueue(s).
+ * move_tasks tries to move up to max_nr_move tasks from busiest to this_rq,
+ * as part of a balancing operation within "domain". Returns the number of
+ * tasks moved.
  *
- * We call this with the current runqueue locked,
- * irqs disabled.
+ * Called with both runqueues locked.
  */
-static void load_balance(runqueue_t *this_rq, int idle, cpumask_t cpumask)
+static int move_tasks(runqueue_t *this_rq, int this_cpu, runqueue_t *busiest,
+		      unsigned long max_nr_move, struct sched_domain *sd,
+		      enum idle_type idle)
 {
-	int imbalance, idx, this_cpu = smp_processor_id();
-	runqueue_t *busiest;
-	prio_array_t *array;
+	prio_array_t *array, *dst_array;
 	struct list_head *head, *curr;
+	int idx, pulled = 0;
 	task_t *tmp;
 
-	if (cpu_is_offline(this_cpu))
-		goto out;
-
-	busiest = find_busiest_queue(this_rq, this_cpu, idle,
-				     &imbalance, cpumask);
-	if (!busiest)
+	if (max_nr_move <= 0 || busiest->nr_running <= 1)
 		goto out;
 
 	/*
-	 * We only want to steal a number of tasks equal to 1/2 the imbalance,
-	 * otherwise we'll just shift the imbalance to the new queue:
-	 */
-	imbalance /= 2;
-
-	/*
 	 * We first consider expired tasks. Those will likely not be
 	 * executed in the near future, and they are most likely to
 	 * be cache-cold, thus switching CPUs has the least effect
 	 * on them.
 	 */
-	if (busiest->expired->nr_active)
+	if (busiest->expired->nr_active) {
 		array = busiest->expired;
-	else
+		dst_array = this_rq->expired;
+	} else {
 		array = busiest->active;
+		dst_array = this_rq->active;
+	}
 
 new_array:
 	/* Start searching at priority 0: */
@@ -1342,11 +1465,12 @@
 	else
 		idx = find_next_bit(array->bitmap, MAX_PRIO, idx);
 	if (idx >= MAX_PRIO) {
-		if (array == busiest->expired) {
+		if (array == busiest->expired && busiest->active->nr_active) {
 			array = busiest->active;
+			dst_array = this_rq->active;
 			goto new_array;
 		}
-		goto out_unlock;
+		goto out;
 	}
 
 	head = array->queue + idx;
@@ -1356,104 +1480,477 @@
 
 	curr = curr->prev;
 
-	if (!can_migrate_task(tmp, busiest, this_cpu, idle)) {
+	if (!can_migrate_task(tmp, busiest, this_cpu, sd, idle)) {
 		if (curr != head)
 			goto skip_queue;
 		idx++;
 		goto skip_bitmap;
 	}
-	pull_task(busiest, array, tmp, this_rq, this_cpu);
+	pull_task(busiest, array, tmp, this_rq, dst_array, this_cpu);
+	pulled++;
 
-	/* Only migrate one task if we are idle */
-	if (!idle && --imbalance) {
+	/* We only want to steal up to the prescribed number of tasks. */
+	if (pulled < max_nr_move) {
 		if (curr != head)
 			goto skip_queue;
 		idx++;
 		goto skip_bitmap;
 	}
-out_unlock:
-	spin_unlock(&busiest->lock);
 out:
-	;
+	return pulled;
 }
 
 /*
- * One of the idle_cpu_tick() and busy_cpu_tick() functions will
- * get called every timer tick, on every CPU. Our balancing action
- * frequency and balancing agressivity depends on whether the CPU is
- * idle or not.
- *
- * busy-rebalance every 200 msecs. idle-rebalance every 1 msec. (or on
- * systems with HZ=100, every 10 msecs.)
- *
- * On NUMA, do a node-rebalance every 400 msecs.
+ * find_busiest_group finds and returns the busiest CPU group within the
+ * domain. It calculates and returns the number of tasks which should be
+ * moved to restore balance via the imbalance parameter.
  */
-#define IDLE_REBALANCE_TICK (HZ/1000 ?: 1)
-#define BUSY_REBALANCE_TICK (HZ/5 ?: 1)
-#define IDLE_NODE_REBALANCE_TICK (IDLE_REBALANCE_TICK * 5)
-#define BUSY_NODE_REBALANCE_TICK (BUSY_REBALANCE_TICK * 2)
+static struct sched_group *
+find_busiest_group(struct sched_domain *sd, int this_cpu,
+		   unsigned long *imbalance, enum idle_type idle)
+{
+	struct sched_group *busiest = NULL, *this = NULL, *group = sd->groups;
+	unsigned long max_load, avg_load, total_load, this_load, total_pwr;
 
-#ifdef CONFIG_NUMA
-static void balance_node(runqueue_t *this_rq, int idle, int this_cpu)
+	max_load = this_load = total_load = total_pwr = 0;
+
+	do {
+		cpumask_t tmp;
+		unsigned long load;
+		int local_group;
+		int i, nr_cpus = 0;
+
+		local_group = cpu_isset(this_cpu, group->cpumask);
+
+		/* Tally up the load of all CPUs in the group */
+		avg_load = 0;
+		cpus_and(tmp, group->cpumask, cpu_online_map);
+		if (unlikely(cpus_empty(tmp)))
+			goto nextgroup;
+
+		for_each_cpu_mask(i, tmp) {
+			/* Bias balancing toward cpus of our domain */
+			if (local_group)
+				load = target_load(i);
+			else
+				load = source_load(i);
+
+			nr_cpus++;
+			avg_load += load;
+		}
+
+		if (!nr_cpus)
+			goto nextgroup;
+
+		total_load += avg_load;
+		total_pwr += group->cpu_power;
+
+		/* Adjust by relative CPU power of the group */
+		avg_load = (avg_load * SCHED_LOAD_SCALE) / group->cpu_power;
+
+		if (local_group) {
+			this_load = avg_load;
+			this = group;
+			goto nextgroup;
+		} else if (avg_load > max_load) {
+			max_load = avg_load;
+			busiest = group;
+		}
+nextgroup:
+		group = group->next;
+	} while (group != sd->groups);
+
+	if (!busiest || this_load >= max_load)
+		goto out_balanced;
+
+	avg_load = (SCHED_LOAD_SCALE * total_load) / total_pwr;
+
+	if (this_load >= avg_load ||
+			100*max_load <= sd->imbalance_pct*this_load)
+		goto out_balanced;
+
+	/*
+	 * We're trying to get all the cpus to the average_load, so we don't
+	 * want to push ourselves above the average load, nor do we wish to
+	 * reduce the max loaded cpu below the average load, as either of these
+	 * actions would just result in more rebalancing later, and ping-pong
+	 * tasks around. Thus we look for the minimum possible imbalance.
+	 * Negative imbalances (*we* are more loaded than anyone else) will
+	 * be counted as no imbalance for these purposes -- we can't fix that
+	 * by pulling tasks to us.  Be careful of negative numbers as they'll
+	 * appear as very large values with unsigned longs.
+	 */
+	*imbalance = min(max_load - avg_load, avg_load - this_load);
+
+	/* How much load to actually move to equalise the imbalance */
+	*imbalance = (*imbalance * min(busiest->cpu_power, this->cpu_power))
+				/ SCHED_LOAD_SCALE;
+
+	if (*imbalance < SCHED_LOAD_SCALE - 1) {
+		unsigned long pwr_now = 0, pwr_move = 0;
+		unsigned long tmp;
+
+		if (max_load - this_load >= SCHED_LOAD_SCALE*2) {
+			*imbalance = 1;
+			return busiest;
+		}
+
+		/*
+		 * OK, we don't have enough imbalance to justify moving tasks,
+		 * however we may be able to increase total CPU power used by
+		 * moving them.
+		 */
+
+		pwr_now += busiest->cpu_power*min(SCHED_LOAD_SCALE, max_load);
+		pwr_now += this->cpu_power*min(SCHED_LOAD_SCALE, this_load);
+		pwr_now /= SCHED_LOAD_SCALE;
+
+		/* Amount of load we'd subtract */
+		tmp = SCHED_LOAD_SCALE*SCHED_LOAD_SCALE/busiest->cpu_power;
+		if (max_load > tmp)
+			pwr_move += busiest->cpu_power*min(SCHED_LOAD_SCALE,
+							max_load - tmp);
+
+		/* Amount of load we'd add */
+		tmp = SCHED_LOAD_SCALE*SCHED_LOAD_SCALE/this->cpu_power;
+		if (max_load < tmp)
+			tmp = max_load;
+		pwr_move += this->cpu_power*min(SCHED_LOAD_SCALE, this_load + tmp);
+		pwr_move /= SCHED_LOAD_SCALE;
+
+		/* Move if we gain another 8th of a CPU worth of throughput */
+		if (pwr_move < pwr_now + SCHED_LOAD_SCALE / 8)
+			goto out_balanced;
+
+		*imbalance = 1;
+		return busiest;
+	}
+
+	/* Get rid of the scaling factor, rounding down as we divide */
+	*imbalance = (*imbalance + 1) / SCHED_LOAD_SCALE;
+
+	return busiest;
+
+out_balanced:
+	if (busiest && (idle == NEWLY_IDLE ||
+			(idle == IDLE && max_load > SCHED_LOAD_SCALE)) ) {
+		*imbalance = 1;
+		return busiest;
+	}
+
+	*imbalance = 0;
+	return NULL;
+}
+
+/*
+ * find_busiest_queue - find the busiest runqueue among the cpus in group.
+ */
+static runqueue_t *find_busiest_queue(struct sched_group *group)
 {
-	int node = find_busiest_node(cpu_to_node(this_cpu));
+	cpumask_t tmp;
+	unsigned long load, max_load = 0;
+	runqueue_t *busiest = NULL;
+	int i;
+
+	cpus_and(tmp, group->cpumask, cpu_online_map);
+	for_each_cpu_mask(i, tmp) {
+		load = source_load(i);
 
-	if (node >= 0) {
-		cpumask_t cpumask = node_to_cpumask(node);
-		cpu_set(this_cpu, cpumask);
-		spin_lock(&this_rq->lock);
-		load_balance(this_rq, idle, cpumask);
-		spin_unlock(&this_rq->lock);
+		if (load > max_load) {
+			max_load = load;
+			busiest = cpu_rq(i);
+		}
 	}
+
+	return busiest;
 }
-#endif
 
-static void rebalance_tick(runqueue_t *this_rq, int idle)
+/*
+ * Check this_cpu to ensure it is balanced within domain. Attempt to move
+ * tasks if there is an imbalance.
+ *
+ * Called with this_rq unlocked.
+ */
+static int load_balance(int this_cpu, runqueue_t *this_rq,
+			struct sched_domain *sd, enum idle_type idle)
 {
-#ifdef CONFIG_NUMA
-	int this_cpu = smp_processor_id();
-#endif
-	unsigned long j = jiffies;
+	struct sched_group *group;
+	runqueue_t *busiest;
+	unsigned long imbalance;
+	int nr_moved;
 
+	spin_lock(&this_rq->lock);
+
+	group = find_busiest_group(sd, this_cpu, &imbalance, idle);
+	if (!group)
+		goto out_balanced;
+
+	busiest = find_busiest_queue(group);
+	if (!busiest)
+		goto out_balanced;
 	/*
-	 * First do inter-node rebalancing, then intra-node rebalancing,
-	 * if both events happen in the same tick. The inter-node
-	 * rebalancing does not necessarily have to create a perfect
-	 * balance within the node, since we load-balance the most loaded
-	 * node with the current CPU. (ie. other CPUs in the local node
-	 * are not balanced.)
+	 * This should be "impossible", but since load
+	 * balancing is inherently racy and statistical,
+	 * it could happen in theory.
 	 */
-	if (idle) {
-#ifdef CONFIG_NUMA
-		if (!(j % IDLE_NODE_REBALANCE_TICK))
-			balance_node(this_rq, idle, this_cpu);
-#endif
-		if (!(j % IDLE_REBALANCE_TICK)) {
-			spin_lock(&this_rq->lock);
-			load_balance(this_rq, idle, cpu_to_node_mask(this_cpu));
-			spin_unlock(&this_rq->lock);
+	if (unlikely(busiest == this_rq)) {
+		WARN_ON(1);
+		goto out_balanced;
+	}
+
+	nr_moved = 0;
+	if (busiest->nr_running > 1) {
+		/*
+		 * Attempt to move tasks. If find_busiest_group has found
+		 * an imbalance but busiest->nr_running <= 1, the group is
+		 * still unbalanced. nr_moved simply stays zero, so it is
+		 * correctly treated as an imbalance.
+		 */
+		double_lock_balance(this_rq, busiest);
+		nr_moved = move_tasks(this_rq, this_cpu, busiest,
+						imbalance, sd, idle);
+		spin_unlock(&busiest->lock);
+	}
+	spin_unlock(&this_rq->lock);
+
+	if (!nr_moved) {
+		sd->nr_balance_failed++;
+
+		if (unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2)) {
+			int wake = 0;
+
+			spin_lock(&busiest->lock);
+			if (!busiest->active_balance) {
+				busiest->active_balance = 1;
+				busiest->push_cpu = this_cpu;
+				wake = 1;
+			}
+			spin_unlock(&busiest->lock);
+			if (wake)
+				wake_up_process(busiest->migration_thread);
+
+			/*
+			 * We've kicked active balancing, reset the failure
+			 * counter.
+			 */
+			sd->nr_balance_failed = sd->cache_nice_tries;
+		}
+	} else
+		sd->nr_balance_failed = 0;
+
+	/* We were unbalanced, so reset the balancing interval */
+	sd->balance_interval = sd->min_interval;
+
+	return nr_moved;
+
+out_balanced:
+	spin_unlock(&this_rq->lock);
+
+	/* tune up the balancing interval */
+	if (sd->balance_interval < sd->max_interval)
+		sd->balance_interval *= 2;
+
+	return 0;
+}
+
+/*
+ * Check this_cpu to ensure it is balanced within domain. Attempt to move
+ * tasks if there is an imbalance.
+ *
+ * Called from schedule when this_rq is about to become idle (NEWLY_IDLE).
+ * this_rq is locked.
+ */
+static int load_balance_newidle(int this_cpu, runqueue_t *this_rq,
+				struct sched_domain *sd)
+{
+	struct sched_group *group;
+	runqueue_t *busiest = NULL;
+	unsigned long imbalance;
+	int nr_moved = 0;
+
+	group = find_busiest_group(sd, this_cpu, &imbalance, NEWLY_IDLE);
+	if (!group)
+		goto out;
+
+	busiest = find_busiest_queue(group);
+	if (!busiest || busiest == this_rq)
+		goto out;
+
+	/* Attempt to move tasks */
+	double_lock_balance(this_rq, busiest);
+
+	nr_moved = move_tasks(this_rq, this_cpu, busiest,
+					imbalance, sd, NEWLY_IDLE);
+
+	spin_unlock(&busiest->lock);
+
+out:
+	return nr_moved;
+}
+
+/*
+ * idle_balance is called by schedule() if this_cpu is about to become
+ * idle. Attempts to pull tasks from other CPUs.
+ */
+static inline void idle_balance(int this_cpu, runqueue_t *this_rq)
+{
+	struct sched_domain *sd;
+
+	for_each_domain(this_cpu, sd) {
+		if (sd->flags & SD_BALANCE_NEWIDLE) {
+			if (load_balance_newidle(this_cpu, this_rq, sd)) {
+				/* We've pulled tasks over so stop searching */
+				break;
+			}
 		}
+	}
+}
+
+/*
+ * active_load_balance is run by migration threads. It pushes a running
+ * task off the cpu. It can be required to correctly have at least 1 task
+ * running on each physical CPU where possible, and not have a physical /
+ * logical imbalance.
+ *
+ * Called with busiest locked.
+ */
+static void active_load_balance(runqueue_t *busiest, int busiest_cpu)
+{
+	struct sched_domain *sd;
+	struct sched_group *group, *busy_group;
+	int i;
+
+	if (busiest->nr_running <= 1)
+		return;
+
+	for_each_domain(busiest_cpu, sd)
+		if (cpu_isset(busiest->push_cpu, sd->span))
+			break;
+	if (!sd) {
+		WARN_ON(1);
 		return;
 	}
-#ifdef CONFIG_NUMA
-	if (!(j % BUSY_NODE_REBALANCE_TICK))
-		balance_node(this_rq, idle, this_cpu);
-#endif
-	if (!(j % BUSY_REBALANCE_TICK)) {
-		spin_lock(&this_rq->lock);
-		load_balance(this_rq, idle, cpu_to_node_mask(this_cpu));
-		spin_unlock(&this_rq->lock);
+
+ 	group = sd->groups;
+	while (!cpu_isset(busiest_cpu, group->cpumask))
+ 		group = group->next;
+ 	busy_group = group;
+
+ 	group = sd->groups;
+ 	do {
+		cpumask_t tmp;
+		runqueue_t *rq;
+		int push_cpu = 0;
+
+ 		if (group == busy_group)
+ 			goto next_group;
+
+		cpus_and(tmp, group->cpumask, cpu_online_map);
+		if (!cpus_weight(tmp))
+			goto next_group;
+
+ 		for_each_cpu_mask(i, tmp) {
+			if (!idle_cpu(i))
+				goto next_group;
+ 			push_cpu = i;
+ 		}
+
+		rq = cpu_rq(push_cpu);
+
+		/*
+		 * This condition is "impossible", but since load
+		 * balancing is inherently a bit racy and statistical,
+		 * it can trigger.. Reported by Bjorn Helgaas on a
+		 * 128-cpu setup.
+		 */
+		if (unlikely(busiest == rq))
+			goto next_group;
+		double_lock_balance(busiest, rq);
+		move_tasks(rq, push_cpu, busiest, 1, sd, IDLE);
+		spin_unlock(&rq->lock);
+next_group:
+		group = group->next;
+	} while (group != sd->groups);
+}
+
+/*
+ * rebalance_tick will get called every timer tick, on every CPU.
+ *
+ * It checks each scheduling domain to see if it is due to be balanced,
+ * and initiates a balancing operation if so.
+ *
+ * Balancing parameters are set up in arch_init_sched_domains.
+ */
+
+/* Don't have all balancing operations going off at once */
+#define CPU_OFFSET(cpu) (HZ * cpu / NR_CPUS)
+
+static void rebalance_tick(int this_cpu, runqueue_t *this_rq,
+			   enum idle_type idle)
+{
+	unsigned long old_load, this_load;
+	unsigned long j = jiffies + CPU_OFFSET(this_cpu);
+	struct sched_domain *sd;
+
+	/* Update our load */
+	old_load = this_rq->cpu_load;
+	this_load = this_rq->nr_running * SCHED_LOAD_SCALE;
+	/*
+	 * Round up the averaging division if load is increasing. This
+	 * prevents us from getting stuck on 9 if the load is 10, for
+	 * example.
+	 */
+	if (this_load > old_load)
+		old_load++;
+	this_rq->cpu_load = (old_load + this_load) / 2;
+
+	for_each_domain(this_cpu, sd) {
+		unsigned long interval = sd->balance_interval;
+
+		if (idle != IDLE)
+			interval *= sd->busy_factor;
+
+		/* scale ms to jiffies */
+		interval = msecs_to_jiffies(interval);
+		if (unlikely(!interval))
+			interval = 1;
+
+		if (j - sd->last_balance >= interval) {
+			if (load_balance(this_cpu, this_rq, sd, idle)) {
+				/* We've pulled tasks over so no longer idle */
+				idle = NOT_IDLE;
+			}
+			sd->last_balance += interval;
+		}
 	}
 }
 #else
 /*
  * on UP we do not need to balance between CPUs:
  */
-static inline void rebalance_tick(runqueue_t *this_rq, int idle)
+static inline void rebalance_tick(int cpu, runqueue_t *rq, enum idle_type idle)
+{
+}
+static inline void idle_balance(int cpu, runqueue_t *rq)
 {
 }
 #endif
 
+static inline int wake_priority_sleeper(runqueue_t *rq)
+{
+#ifdef CONFIG_SCHED_SMT
+	/*
+	 * If an SMT sibling task has been put to sleep for priority
+	 * reasons reschedule the idle task to see if it can now run.
+	 */
+	if (rq->nr_running) {
+		resched_task(rq->idle);
+		return 1;
+	}
+#endif
+	return 0;
+}
+
 DEFINE_PER_CPU(struct kernel_stat, kstat);
 
 EXPORT_PER_CPU_SYMBOL(kstat);
@@ -1507,7 +2004,9 @@
 			cpustat->iowait += sys_ticks;
 		else
 			cpustat->idle += sys_ticks;
-		rebalance_tick(rq, 1);
+		if (wake_priority_sleeper(rq))
+			goto out;
+		rebalance_tick(cpu, rq, IDLE);
 		return;
 	}
 	if (TASK_NICE(p) > 0)
@@ -1591,9 +2090,94 @@
 out_unlock:
 	spin_unlock(&rq->lock);
 out:
-	rebalance_tick(rq, 0);
+	rebalance_tick(cpu, rq, NOT_IDLE);
+}
+
+#ifdef CONFIG_SCHED_SMT
+static inline void wake_sleeping_dependent(int cpu, runqueue_t *rq)
+{
+	int i;
+	struct sched_domain *sd = rq->sd;
+	cpumask_t sibling_map;
+
+	if (!(sd->flags & SD_SHARE_CPUPOWER))
+		return;
+
+	cpus_and(sibling_map, sd->span, cpu_online_map);
+	for_each_cpu_mask(i, sibling_map) {
+		runqueue_t *smt_rq;
+
+		if (i == cpu)
+			continue;
+
+		smt_rq = cpu_rq(i);
+
+		/*
+		 * If an SMT sibling task is sleeping due to priority
+		 * reasons wake it up now.
+		 */
+		if (smt_rq->curr == smt_rq->idle && smt_rq->nr_running)
+			resched_task(smt_rq->idle);
+	}
+}
+
+static inline int dependent_sleeper(int cpu, runqueue_t *rq, task_t *p)
+{
+	struct sched_domain *sd = rq->sd;
+	cpumask_t sibling_map;
+	int ret = 0, i;
+
+	if (!(sd->flags & SD_SHARE_CPUPOWER))
+		return 0;
+
+	cpus_and(sibling_map, sd->span, cpu_online_map);
+	for_each_cpu_mask(i, sibling_map) {
+		runqueue_t *smt_rq;
+		task_t *smt_curr;
+
+		if (i == cpu)
+			continue;
+
+		smt_rq = cpu_rq(i);
+		smt_curr = smt_rq->curr;
+
+		/*
+		 * If a user task with lower static priority than the
+		 * running task on the SMT sibling is trying to schedule,
+		 * delay it till there is proportionately less timeslice
+		 * left of the sibling task to prevent a lower priority
+		 * task from using an unfair proportion of the
+		 * physical cpu's resources. -ck
+		 */
+		if (((smt_curr->time_slice * (100 - sd->per_cpu_gain) / 100) >
+			task_timeslice(p) || rt_task(smt_curr)) &&
+			p->mm && smt_curr->mm && !rt_task(p))
+				ret = 1;
+
+		/*
+		 * Reschedule a lower priority task on the SMT sibling,
+		 * or wake it up if it has been put to sleep for priority
+		 * reasons.
+		 */
+		if ((((p->time_slice * (100 - sd->per_cpu_gain) / 100) >
+			task_timeslice(smt_curr) || rt_task(p)) &&
+			smt_curr->mm && p->mm && !rt_task(smt_curr)) ||
+			(smt_curr == smt_rq->idle && smt_rq->nr_running))
+				resched_task(smt_curr);
+	}
+	return ret;
+}
+#else
+static inline void wake_sleeping_dependent(int cpu, runqueue_t *rq)
+{
 }
 
+static inline int dependent_sleeper(int cpu, runqueue_t *rq, task_t *p)
+{
+	return 0;
+}
+#endif
+
 /*
  * schedule() is the main scheduler function.
  */
@@ -1606,7 +2190,7 @@
 	struct list_head *queue;
 	unsigned long long now;
 	unsigned long run_time;
-	int idx;
+	int cpu, idx;
 
 	/*
 	 * Test if we are atomic.  Since do_exit() needs to call into
@@ -1656,13 +2240,13 @@
 			deactivate_task(prev, rq);
 	}
 
+	cpu = smp_processor_id();
 	if (unlikely(!rq->nr_running)) {
-#ifdef CONFIG_SMP
-		load_balance(rq, 1, cpu_to_node_mask(smp_processor_id()));
-#endif
+		idle_balance(cpu, rq);
 		if (!rq->nr_running) {
 			next = rq->idle;
 			rq->expired_timestamp = 0;
+			wake_sleeping_dependent(cpu, rq);
 			goto switch_tasks;
 		}
 	}
@@ -1683,6 +2267,11 @@
 	queue = array->queue + idx;
 	next = list_entry(queue->next, task_t, run_list);
 
+	if (dependent_sleeper(cpu, rq, next)) {
+		next = rq->idle;
+		goto switch_tasks;
+	}
+
 	if (!rt_task(next) && next->activated > 0) {
 		unsigned long long delta = now - next->timestamp;
 
@@ -1761,7 +2350,7 @@
 EXPORT_SYMBOL(preempt_schedule);
 #endif /* CONFIG_PREEMPT */
 
-int default_wake_function(wait_queue_t *curr, unsigned mode, int sync)
+int default_wake_function(wait_queue_t *curr, unsigned mode, int sync, void *key)
 {
 	task_t *p = curr->task;
 	return try_to_wake_up(p, mode, sync);
@@ -1779,7 +2368,7 @@
  * zero in this (rare) case, and we handle it by continuing to scan the queue.
  */
 static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
-			     int nr_exclusive, int sync)
+			     int nr_exclusive, int sync, void *key)
 {
 	struct list_head *tmp, *next;
 
@@ -1788,7 +2377,7 @@
 		unsigned flags;
 		curr = list_entry(tmp, wait_queue_t, task_list);
 		flags = curr->flags;
-		if (curr->func(curr, mode, sync) &&
+		if (curr->func(curr, mode, sync, key) &&
 		    (flags & WQ_FLAG_EXCLUSIVE) &&
 		    !--nr_exclusive)
 			break;
@@ -1801,12 +2390,13 @@
  * @mode: which threads
  * @nr_exclusive: how many wake-one or wake-many threads to wake up
  */
-void fastcall __wake_up(wait_queue_head_t *q, unsigned int mode, int nr_exclusive)
+void fastcall __wake_up(wait_queue_head_t *q, unsigned int mode,
+				int nr_exclusive, void *key)
 {
 	unsigned long flags;
 
 	spin_lock_irqsave(&q->lock, flags);
-	__wake_up_common(q, mode, nr_exclusive, 0);
+	__wake_up_common(q, mode, nr_exclusive, 0, key);
 	spin_unlock_irqrestore(&q->lock, flags);
 }
 
@@ -1817,7 +2407,7 @@
  */
 void fastcall __wake_up_locked(wait_queue_head_t *q, unsigned int mode)
 {
-	__wake_up_common(q, mode, 1, 0);
+	__wake_up_common(q, mode, 1, 0, NULL);
 }
 
 /**
@@ -1836,15 +2426,16 @@
 void fastcall __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr_exclusive)
 {
 	unsigned long flags;
+	int sync = 1;
 
 	if (unlikely(!q))
 		return;
 
+	if (unlikely(!nr_exclusive))
+		sync = 0;
+
 	spin_lock_irqsave(&q->lock, flags);
-	if (likely(nr_exclusive))
-		__wake_up_common(q, mode, nr_exclusive, 1);
-	else
-		__wake_up_common(q, mode, nr_exclusive, 0);
+	__wake_up_common(q, mode, nr_exclusive, sync, NULL);
 	spin_unlock_irqrestore(&q->lock, flags);
 }
 EXPORT_SYMBOL_GPL(__wake_up_sync);	/* For internal use only */
@@ -1856,7 +2447,7 @@
 	spin_lock_irqsave(&x->wait.lock, flags);
 	x->done++;
 	__wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,
-			 1, 0);
+			 1, 0, NULL);
 	spin_unlock_irqrestore(&x->wait.lock, flags);
 }
 EXPORT_SYMBOL(complete);
@@ -1868,7 +2459,7 @@
 	spin_lock_irqsave(&x->wait.lock, flags);
 	x->done += UINT_MAX/2;
 	__wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,
-			 0, 0);
+			 0, 0, NULL);
 	spin_unlock_irqrestore(&x->wait.lock, flags);
 }
 EXPORT_SYMBOL(complete_all);
@@ -2015,7 +2606,7 @@
 
 EXPORT_SYMBOL(set_user_nice);
 
-#ifndef __alpha__
+#ifdef __ARCH_WANT_SYS_NICE
 
 /*
  * sys_nice - change the priority of the current process.
@@ -2199,7 +2790,7 @@
 		if (task_running(rq, p)) {
 			if (p->prio > oldprio)
 				resched_task(rq->curr);
-		} else if (p->prio < rq->curr->prio)
+		} else if (TASK_PREEMPTS_CURR(p, rq))
 			resched_task(rq->curr);
 	}
 
@@ -2368,6 +2959,7 @@
 	if (len < real_len)
 		return -EINVAL;
 
+	lock_cpu_hotplug();
 	read_lock(&tasklist_lock);
 
 	retval = -ESRCH;
@@ -2380,6 +2972,7 @@
 
 out_unlock:
 	read_unlock(&tasklist_lock);
+	unlock_cpu_hotplug();
 	if (retval)
 		return retval;
 	if (copy_to_user(user_mask_ptr, &mask, real_len))
@@ -2398,6 +2991,7 @@
 {
 	runqueue_t *rq = this_rq_lock();
 	prio_array_t *array = current->array;
+	prio_array_t *target = rq->expired;
 
 	/*
 	 * We implement yielding by moving the task into the expired
@@ -2406,16 +3000,15 @@
 	 * (special rule: RT tasks will just roundrobin in the active
 	 *  array.)
 	 */
-	if (likely(!rt_task(current))) {
-		dequeue_task(current, array);
-		enqueue_task(current, rq->expired);
-	} else {
-		list_del(&current->run_list);
-		list_add_tail(&current->run_list, array->queue + current->prio);
-	}
+	if (unlikely(rt_task(current)))
+		target = rq->active;
+
+	dequeue_task(current, array);
+	enqueue_task(current, target);
+
 	/*
 	 * Since we are going to call schedule() anyway, there's
-	 * no need to preempt:
+	 * no need to preempt or enable interrupts:
 	 */
 	_raw_spin_unlock(&rq->lock);
 	preempt_enable_no_resched();
@@ -2658,7 +3251,7 @@
 	read_unlock(&tasklist_lock);
 }
 
-void __init init_idle(task_t *idle, int cpu)
+void __devinit init_idle(task_t *idle, int cpu)
 {
 	runqueue_t *idle_rq = cpu_rq(cpu), *rq = cpu_rq(task_cpu(idle));
 	unsigned long flags;
@@ -2685,13 +3278,13 @@
 }
 
 /*
- * In a system that switches off the HZ timer idle_cpu_mask
+ * In a system that switches off the HZ timer nohz_cpu_mask
  * indicates which cpus entered this state. This is used
  * in the rcu update to wait only for active cpus. For system
- * which do not switch off the HZ timer idle_cpu_mask should
+ * which do not switch off the HZ timer nohz_cpu_mask should
  * always be CPU_MASK_NONE.
  */
-cpumask_t idle_cpu_mask = CPU_MASK_NONE;
+cpumask_t nohz_cpu_mask = CPU_MASK_NONE;
 
 #ifdef CONFIG_SMP
 /*
@@ -2732,7 +3325,12 @@
 		goto out;
 	}
 
-	if (__set_cpus_allowed(p, new_mask, &req)) {
+	p->cpus_allowed = new_mask;
+	/* Can the task run on the task's current CPU? If so, we're done */
+	if (cpu_isset(task_cpu(p), new_mask))
+		goto out;
+
+	if (migrate_task(p, any_online_cpu(new_mask), &req)) {
 		/* Need help from migration thread: drop lock and wait. */
 		task_rq_unlock(rq, &flags);
 		wake_up_process(rq->migration_thread);
@@ -2746,28 +3344,51 @@
 
 EXPORT_SYMBOL_GPL(set_cpus_allowed);
 
-/* Move (not current) task off this cpu, onto dest cpu. */
-static void move_task_away(struct task_struct *p, int dest_cpu)
+/*
+ * Move (not current) task off this cpu, onto dest cpu.  We're doing
+ * this because either it can't run here any more (set_cpus_allowed()
+ * away from this CPU, or CPU going down), or because we're
+ * attempting to rebalance this task on exec (sched_balance_exec).
+ *
+ * So we race with normal scheduler movements, but that's OK, as long
+ * as the task is no longer on this CPU.
+ */
+static void __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
 {
-	runqueue_t *rq_dest;
+	runqueue_t *rq_dest, *rq_src;
 
+	if (unlikely(cpu_is_offline(dest_cpu)))
+		return;
+
+	rq_src  = cpu_rq(src_cpu);
 	rq_dest = cpu_rq(dest_cpu);
 
-	double_rq_lock(this_rq(), rq_dest);
-	if (task_cpu(p) != smp_processor_id())
-		goto out; /* Already moved */
+	double_rq_lock(rq_src, rq_dest);
+	/* Already moved. */
+	if (task_cpu(p) != src_cpu)
+		goto out;
+	/* Affinity changed (again). */
+	if (!cpu_isset(dest_cpu, p->cpus_allowed))
+		goto out;
 
 	set_task_cpu(p, dest_cpu);
 	if (p->array) {
-		deactivate_task(p, this_rq());
-		activate_task(p, rq_dest);
-		if (p->prio < rq_dest->curr->prio)
+		/*
+		 * Sync timestamp with rq_dest's before activating.
+		 * The same thing could be achieved by doing this step
+		 * afterwards, and pretending it was a local activate.
+		 * This way is cleaner and logically correct.
+		 */
+		p->timestamp = p->timestamp - rq_src->timestamp_last_tick
+				+ rq_dest->timestamp_last_tick;
+		deactivate_task(p, rq_src);
+		activate_task(p, rq_dest, 0);
+		if (TASK_PREEMPTS_CURR(p, rq_dest))
 			resched_task(rq_dest->curr);
 	}
-	p->timestamp = rq_dest->timestamp_last_tick;
 
 out:
-	double_rq_unlock(this_rq(), rq_dest);
+	double_rq_unlock(rq_src, rq_dest);
 }
 
 /*
@@ -2783,6 +3404,7 @@
 	rq = cpu_rq(cpu);
 	BUG_ON(rq->migration_thread != current);
 
+	set_current_state(TASK_INTERRUPTIBLE);
 	while (!kthread_should_stop()) {
 		struct list_head *head;
 		migration_req_t *req;
@@ -2791,40 +3413,66 @@
 			refrigerator(PF_FREEZE);
 
 		spin_lock_irq(&rq->lock);
+
+		if (cpu_is_offline(cpu)) {
+			spin_unlock_irq(&rq->lock);
+			goto wait_to_die;
+		}
+
+		if (rq->active_balance) {
+			active_load_balance(rq, cpu);
+			rq->active_balance = 0;
+		}
+
 		head = &rq->migration_queue;
-		current->state = TASK_INTERRUPTIBLE;
+
 		if (list_empty(head)) {
 			spin_unlock_irq(&rq->lock);
 			schedule();
+			set_current_state(TASK_INTERRUPTIBLE);
 			continue;
 		}
 		req = list_entry(head->next, migration_req_t, list);
 		list_del_init(head->next);
-		spin_unlock(&rq->lock);
 
-		move_task_away(req->task,
-			       any_online_cpu(req->task->cpus_allowed));
-		local_irq_enable();
+		if (req->type == REQ_MOVE_TASK) {
+			spin_unlock(&rq->lock);
+			__migrate_task(req->task, smp_processor_id(),
+					req->dest_cpu);
+			local_irq_enable();
+		} else if (req->type == REQ_SET_DOMAIN) {
+			rq->sd = req->sd;
+			spin_unlock_irq(&rq->lock);
+		} else {
+			spin_unlock_irq(&rq->lock);
+			WARN_ON(1);
+		}
+
 		complete(&req->done);
 	}
+	__set_current_state(TASK_RUNNING);
+	return 0;
+
+wait_to_die:
+	/* Wait for kthread_stop */
+	set_current_state(TASK_INTERRUPTIBLE);
+	while (!kthread_should_stop()) {
+		schedule();
+		set_current_state(TASK_INTERRUPTIBLE);
+	}
+	__set_current_state(TASK_RUNNING);
 	return 0;
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-/* migrate_all_tasks - function to migrate all the tasks from the
- * current cpu caller must have already scheduled this to the target
- * cpu via set_cpus_allowed.  Machine is stopped.  */
-void migrate_all_tasks(void)
+/* migrate_all_tasks - function to migrate all tasks from the dead cpu.  */
+static void migrate_all_tasks(int src_cpu)
 {
 	struct task_struct *tsk, *t;
-	int dest_cpu, src_cpu;
+	int dest_cpu;
 	unsigned int node;
 
-	/* We're nailed to this CPU. */
-	src_cpu = smp_processor_id();
-
-	/* Not required, but here for neatness. */
-	write_lock(&tasklist_lock);
+	write_lock_irq(&tasklist_lock);
 
 	/* watch out for per node tasks, let's stay on this node */
 	node = cpu_to_node(src_cpu);
@@ -2860,10 +3508,36 @@
 				       tsk->pid, tsk->comm, src_cpu);
 		}
 
-		move_task_away(tsk, dest_cpu);
+		__migrate_task(tsk, src_cpu, dest_cpu);
 	} while_each_thread(t, tsk);
 
-	write_unlock(&tasklist_lock);
+	write_unlock_irq(&tasklist_lock);
+}
+
+/* Schedules idle task to be the next runnable task on current CPU.
+ * It does so by boosting its priority to highest possible and adding it to
+ * the _front_ of runqueue. Used by CPU offline code.
+ */
+void sched_idle_next(void)
+{
+	int cpu = smp_processor_id();
+	runqueue_t *rq = this_rq();
+	struct task_struct *p = rq->idle;
+	unsigned long flags;
+
+	/* cpu has to be offline */
+	BUG_ON(cpu_online(cpu));
+
+	/* Strictly not necessary since rest of the CPUs are stopped by now
+	 * and interrupts disabled on current cpu.
+	 */
+	spin_lock_irqsave(&rq->lock, flags);
+
+	__setscheduler(p, SCHED_FIFO, MAX_RT_PRIO-1);
+	/* Add idle task to _front_ of it's priority queue */
+	__activate_idle_task(p, rq);
+
+	spin_unlock_irqrestore(&rq->lock, flags);
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
@@ -2899,18 +3573,47 @@
 	case CPU_UP_CANCELED:
 		/* Unbind it from offline cpu so it can run.  Fall thru. */
 		kthread_bind(cpu_rq(cpu)->migration_thread,smp_processor_id());
-	case CPU_DEAD:
 		kthread_stop(cpu_rq(cpu)->migration_thread);
 		cpu_rq(cpu)->migration_thread = NULL;
- 		BUG_ON(cpu_rq(cpu)->nr_running != 0);
+		break;
+	case CPU_DEAD:
+		migrate_all_tasks(cpu);
+		rq = cpu_rq(cpu);
+		kthread_stop(rq->migration_thread);
+		rq->migration_thread = NULL;
+		/* Idle task back to normal (off runqueue, low prio) */
+		rq = task_rq_lock(rq->idle, &flags);
+		deactivate_task(rq->idle, rq);
+		rq->idle->static_prio = MAX_PRIO;
+		__setscheduler(rq->idle, SCHED_NORMAL, 0);
+		task_rq_unlock(rq, &flags);
+ 		BUG_ON(rq->nr_running != 0);
+
+		/* No need to migrate the tasks: it was best-effort if
+		 * they didn't do lock_cpu_hotplug().  Just wake up
+		 * the requestors. */
+		spin_lock_irq(&rq->lock);
+		while (!list_empty(&rq->migration_queue)) {
+			migration_req_t *req;
+			req = list_entry(rq->migration_queue.next,
+					 migration_req_t, list);
+			BUG_ON(req->type != REQ_MOVE_TASK);
+			list_del_init(&req->list);
+			complete(&req->done);
+		}
+		spin_unlock_irq(&rq->lock);
  		break;
 #endif
 	}
 	return NOTIFY_OK;
 }
 
+/* Register at highest priority so that task migration (migrate_all_tasks)
+ * happens before everything else.
+ */
 static struct notifier_block __devinitdata migration_notifier = {
 	.notifier_call = migration_call,
+	.priority = 10
 };
 
 int __init migration_init(void)
@@ -2939,23 +3642,298 @@
 spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
 EXPORT_SYMBOL(kernel_flag);
 
+#ifdef CONFIG_SMP
+/* Attach the domain 'sd' to 'cpu' as its base domain */
+void cpu_attach_domain(struct sched_domain *sd, int cpu)
+{
+	migration_req_t req;
+	unsigned long flags;
+	runqueue_t *rq = cpu_rq(cpu);
+	int local = 1;
+
+	lock_cpu_hotplug();
+
+	spin_lock_irqsave(&rq->lock, flags);
+
+	if (cpu == smp_processor_id() || !cpu_online(cpu)) {
+		rq->sd = sd;
+	} else {
+		init_completion(&req.done);
+		req.type = REQ_SET_DOMAIN;
+		req.sd = sd;
+		list_add(&req.list, &rq->migration_queue);
+		local = 0;
+	}
+
+	spin_unlock_irqrestore(&rq->lock, flags);
+
+	if (!local) {
+		wake_up_process(rq->migration_thread);
+		wait_for_completion(&req.done);
+	}
+
+	unlock_cpu_hotplug();
+}
+
+#ifdef ARCH_HAS_SCHED_DOMAIN
+extern void __init arch_init_sched_domains(void);
+#else
+static struct sched_group sched_group_cpus[NR_CPUS];
+static DEFINE_PER_CPU(struct sched_domain, cpu_domains);
+#ifdef CONFIG_NUMA
+static struct sched_group sched_group_nodes[MAX_NUMNODES];
+static DEFINE_PER_CPU(struct sched_domain, node_domains);
+static void __init arch_init_sched_domains(void)
+{
+	int i;
+	struct sched_group *first_node = NULL, *last_node = NULL;
+
+	/* Set up domains */
+	for_each_cpu(i) {
+		int node = cpu_to_node(i);
+		cpumask_t nodemask = node_to_cpumask(node);
+		struct sched_domain *node_sd = &per_cpu(node_domains, i);
+		struct sched_domain *cpu_sd = &per_cpu(cpu_domains, i);
+
+		*node_sd = SD_NODE_INIT;
+		node_sd->span = cpu_possible_map;
+		node_sd->groups = &sched_group_nodes[cpu_to_node(i)];
+
+		*cpu_sd = SD_CPU_INIT;
+		cpus_and(cpu_sd->span, nodemask, cpu_possible_map);
+		cpu_sd->groups = &sched_group_cpus[i];
+		cpu_sd->parent = node_sd;
+	}
+
+	/* Set up groups */
+	for (i = 0; i < MAX_NUMNODES; i++) {
+		cpumask_t tmp = node_to_cpumask(i);
+		cpumask_t nodemask;
+		struct sched_group *first_cpu = NULL, *last_cpu = NULL;
+		struct sched_group *node = &sched_group_nodes[i];
+		int j;
+
+		cpus_and(nodemask, tmp, cpu_possible_map);
+
+		if (cpus_empty(nodemask))
+			continue;
+
+		node->cpumask = nodemask;
+		node->cpu_power = SCHED_LOAD_SCALE * cpus_weight(node->cpumask);
+
+		for_each_cpu_mask(j, node->cpumask) {
+			struct sched_group *cpu = &sched_group_cpus[j];
+
+			cpus_clear(cpu->cpumask);
+			cpu_set(j, cpu->cpumask);
+			cpu->cpu_power = SCHED_LOAD_SCALE;
+
+			if (!first_cpu)
+				first_cpu = cpu;
+			if (last_cpu)
+				last_cpu->next = cpu;
+			last_cpu = cpu;
+		}
+		last_cpu->next = first_cpu;
+
+		if (!first_node)
+			first_node = node;
+		if (last_node)
+			last_node->next = node;
+		last_node = node;
+	}
+	last_node->next = first_node;
+
+	mb();
+	for_each_cpu(i) {
+		struct sched_domain *cpu_sd = &per_cpu(cpu_domains, i);
+		cpu_attach_domain(cpu_sd, i);
+	}
+}
+
+#else /* !CONFIG_NUMA */
+static void __init arch_init_sched_domains(void)
+{
+	int i;
+	struct sched_group *first_cpu = NULL, *last_cpu = NULL;
+
+	/* Set up domains */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_sd = &per_cpu(cpu_domains, i);
+
+		*cpu_sd = SD_CPU_INIT;
+		cpu_sd->span = cpu_possible_map;
+		cpu_sd->groups = &sched_group_cpus[i];
+	}
+
+	/* Set up CPU groups */
+	for_each_cpu_mask(i, cpu_possible_map) {
+		struct sched_group *cpu = &sched_group_cpus[i];
+
+		cpus_clear(cpu->cpumask);
+		cpu_set(i, cpu->cpumask);
+		cpu->cpu_power = SCHED_LOAD_SCALE;
+
+		if (!first_cpu)
+			first_cpu = cpu;
+		if (last_cpu)
+			last_cpu->next = cpu;
+		last_cpu = cpu;
+	}
+	last_cpu->next = first_cpu;
+
+	mb(); /* domains were modified outside the lock */
+	for_each_cpu(i) {
+		struct sched_domain *cpu_sd = &per_cpu(cpu_domains, i);
+		cpu_attach_domain(cpu_sd, i);
+	}
+}
+
+#endif /* CONFIG_NUMA */
+#endif /* ARCH_HAS_SCHED_DOMAIN */
+
+#define SCHED_DOMAIN_DEBUG
+#ifdef SCHED_DOMAIN_DEBUG
+void sched_domain_debug(void)
+{
+	int i;
+
+	for_each_cpu(i) {
+		runqueue_t *rq = cpu_rq(i);
+		struct sched_domain *sd;
+		int level = 0;
+
+		sd = rq->sd;
+
+		printk(KERN_DEBUG "CPU%d: %s\n",
+				i, (cpu_online(i) ? " online" : "offline"));
+
+		do {
+			int j;
+			char str[NR_CPUS];
+			struct sched_group *group = sd->groups;
+			cpumask_t groupmask, tmp;
+
+			cpumask_scnprintf(str, NR_CPUS, sd->span);
+			cpus_clear(groupmask);
+
+			printk(KERN_DEBUG);
+			for (j = 0; j < level + 1; j++)
+				printk(" ");
+			printk("domain %d: span %s\n", level, str);
+
+			if (!cpu_isset(i, sd->span))
+				printk(KERN_DEBUG "ERROR domain->span does not contain CPU%d\n", i);
+			if (!cpu_isset(i, group->cpumask))
+				printk(KERN_DEBUG "ERROR domain->groups does not contain CPU%d\n", i);
+			if (!group->cpu_power)
+				printk(KERN_DEBUG "ERROR domain->cpu_power not set\n");
+
+			printk(KERN_DEBUG);
+			for (j = 0; j < level + 2; j++)
+				printk(" ");
+			printk("groups:");
+			do {
+				if (!group) {
+					printk(" ERROR: NULL");
+					break;
+				}
+
+				if (!cpus_weight(group->cpumask))
+					printk(" ERROR empty group:");
+
+				cpus_and(tmp, groupmask, group->cpumask);
+				if (cpus_weight(tmp) > 0)
+					printk(" ERROR repeated CPUs:");
+
+				cpus_or(groupmask, groupmask, group->cpumask);
+
+				cpumask_scnprintf(str, NR_CPUS, group->cpumask);
+				printk(" %s", str);
+
+				group = group->next;
+			} while (group != sd->groups);
+			printk("\n");
+
+			if (!cpus_equal(sd->span, groupmask))
+				printk(KERN_DEBUG "ERROR groups don't span domain->span\n");
+
+			level++;
+			sd = sd->parent;
+
+			if (sd) {
+				cpus_and(tmp, groupmask, sd->span);
+				if (!cpus_equal(tmp, groupmask))
+					printk(KERN_DEBUG "ERROR parent span is not a superset of domain->span\n");
+			}
+
+		} while (sd);
+	}
+}
+#else
+#define sched_domain_debug() {}
+#endif
+
+void __init sched_init_smp(void)
+{
+	arch_init_sched_domains();
+	sched_domain_debug();
+}
+#else
+void __init sched_init_smp(void)
+{
+}
+#endif /* CONFIG_SMP */
+
+int in_sched_functions(unsigned long addr)
+{
+	/* Linker adds these: start and end of __sched functions */
+	extern char __sched_text_start[], __sched_text_end[];
+	return addr >= (unsigned long)__sched_text_start
+		&& addr < (unsigned long)__sched_text_end;
+}
+
 void __init sched_init(void)
 {
 	runqueue_t *rq;
 	int i, j, k;
 
+#ifdef CONFIG_SMP
+	/* Set up an initial dummy domain for early boot */
+	static struct sched_domain sched_domain_init;
+	static struct sched_group sched_group_init;
+	cpumask_t cpu_mask_all = CPU_MASK_ALL;
+
+	memset(&sched_domain_init, 0, sizeof(struct sched_domain));
+	sched_domain_init.span = cpu_mask_all;
+	sched_domain_init.groups = &sched_group_init;
+	sched_domain_init.last_balance = jiffies;
+	sched_domain_init.balance_interval = INT_MAX; /* Don't balance */
+
+	memset(&sched_group_init, 0, sizeof(struct sched_group));
+	sched_group_init.cpumask = cpu_mask_all;
+	sched_group_init.next = &sched_group_init;
+	sched_group_init.cpu_power = SCHED_LOAD_SCALE;
+#endif
+
 	for (i = 0; i < NR_CPUS; i++) {
 		prio_array_t *array;
 
 		rq = cpu_rq(i);
+		spin_lock_init(&rq->lock);
 		rq->active = rq->arrays;
 		rq->expired = rq->arrays + 1;
 		rq->best_expired_prio = MAX_PRIO;
 
-		spin_lock_init(&rq->lock);
+#ifdef CONFIG_SMP
+		rq->sd = &sched_domain_init;
+		rq->cpu_load = 0;
+		rq->active_balance = 0;
+		rq->push_cpu = 0;
+		rq->migration_thread = NULL;
 		INIT_LIST_HEAD(&rq->migration_queue);
+#endif
 		atomic_set(&rq->nr_iowait, 0);
-		nr_running_init(rq);
 
 		for (j = 0; j < 2; j++) {
 			array = rq->arrays + j;
@@ -2976,8 +3954,6 @@
 	rq->idle = current;
 	set_task_cpu(current, smp_processor_id());
 	wake_up_forked_process(current);
-
-	init_timers();
 
 	/*
 	 * The boot idle thread does lazy MMU switching as well:
diff -Nru a/kernel/signal.c b/kernel/signal.c
--- a/kernel/signal.c	Tue Jun 15 22:20:39 2004
+++ b/kernel/signal.c	Tue Jun 15 22:20:39 2004
@@ -23,6 +23,7 @@
 #include <linux/ptrace.h>
 #include <asm/param.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/siginfo.h>
 
 /*
@@ -1403,12 +1404,12 @@
 	 * Fortunately this is not necessary for thread groups:
 	 */
 	if (p->tgid == tsk->tgid) {
-		wake_up_interruptible(&tsk->wait_chldexit);
+		wake_up_interruptible_sync(&tsk->wait_chldexit);
 		return;
 	}
 
 	do {
-		wake_up_interruptible(&tsk->wait_chldexit);
+		wake_up_interruptible_sync(&tsk->wait_chldexit);
 		tsk = next_thread(tsk);
 		if (tsk->signal != parent->signal)
 			BUG();
@@ -2174,7 +2175,7 @@
 }
 
 /**
- *  sys_tkill - send signal to one specific thread
+ *  sys_tgkill - send signal to one specific thread
  *  @tgid: the thread group ID of the thread
  *  @pid: the PID of the thread
  *  @sig: signal to be sent
@@ -2412,14 +2413,19 @@
 	return error;
 }
 
+#ifdef __ARCH_WANT_SYS_SIGPENDING
+
 asmlinkage long
 sys_sigpending(old_sigset_t __user *set)
 {
 	return do_sigpending(set, sizeof(*set));
 }
 
-#if !defined(__alpha__)
-/* Alpha has its own versions with special arguments.  */
+#endif
+
+#ifdef __ARCH_WANT_SYS_SIGPROCMASK
+/* Some platforms have their own version with special arguments others
+   support only sys_rt_sigprocmask.  */
 
 asmlinkage long
 sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset)
@@ -2469,8 +2475,9 @@
 out:
 	return error;
 }
+#endif /* __ARCH_WANT_SYS_SIGPROCMASK */
 
-#ifndef __sparc__
+#ifdef __ARCH_WANT_SYS_RT_SIGACTION
 asmlinkage long
 sys_rt_sigaction(int sig,
 		 const struct sigaction __user *act,
@@ -2498,11 +2505,10 @@
 out:
 	return ret;
 }
-#endif /* __sparc__ */
-#endif
+#endif /* __ARCH_WANT_SYS_RT_SIGACTION */
+
+#ifdef __ARCH_WANT_SYS_SGETMASK
 
-#if !defined(__alpha__) && !defined(__ia64__) && \
-    !defined(__arm__) && !defined(__s390__)
 /*
  * For backwards compatibility.  Functionality superseded by sigprocmask.
  */
@@ -2528,10 +2534,9 @@
 
 	return old;
 }
-#endif /* !defined(__alpha__) */
+#endif /* __ARCH_WANT_SGETMASK */
 
-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && \
-    !defined(__arm__)
+#ifdef __ARCH_WANT_SYS_SIGNAL
 /*
  * For backwards compatibility.  Functionality superseded by sigaction.
  */
@@ -2548,9 +2553,9 @@
 
 	return ret ? ret : (unsigned long)old_sa.sa.sa_handler;
 }
-#endif /* !alpha && !__ia64__ && !defined(__mips__) && !defined(__arm__) */
+#endif /* __ARCH_WANT_SYS_SIGNAL */
 
-#ifndef HAVE_ARCH_SYS_PAUSE
+#ifdef __ARCH_WANT_SYS_PAUSE
 
 asmlinkage long
 sys_pause(void)
@@ -2560,7 +2565,7 @@
 	return -ERESTARTNOHAND;
 }
 
-#endif /* HAVE_ARCH_SYS_PAUSE */
+#endif
 
 void __init signals_init(void)
 {
@@ -2568,7 +2573,5 @@
 		kmem_cache_create("sigqueue",
 				  sizeof(struct sigqueue),
 				  __alignof__(struct sigqueue),
-				  0, NULL, NULL);
-	if (!sigqueue_cachep)
-		panic("signals_init(): cannot create sigqueue SLAB cache");
+				  SLAB_PANIC, NULL, NULL);
 }
diff -Nru a/kernel/sys.c b/kernel/sys.c
--- a/kernel/sys.c	Tue Jun 15 22:20:37 2004
+++ b/kernel/sys.c	Tue Jun 15 22:20:37 2004
@@ -271,6 +271,10 @@
 cond_syscall(compat_sys_mq_timedreceive)
 cond_syscall(compat_sys_mq_notify)
 cond_syscall(compat_sys_mq_getsetattr)
+cond_syscall(sys_mbind)
+cond_syscall(sys_get_mempolicy)
+cond_syscall(sys_set_mempolicy)
+cond_syscall(compat_get_mempolicy)
 
 /* arch-specific weak syscall entries */
 cond_syscall(sys_pciconfig_read)
@@ -348,6 +352,8 @@
 				if (p->uid == who)
 					error = set_one_prio(p, niceval, error);
 			while_each_thread(g, p);
+			if (who)
+				free_uid(user);		/* For find_user() */
 			break;
 	}
 out_unlock:
@@ -410,6 +416,8 @@
 						retval = niceval;
 				}
 			while_each_thread(g, p);
+			if (who)
+				free_uid(user);		/* for find_user() */
 			break;
 	}
 out_unlock:
@@ -447,7 +455,7 @@
 	switch (cmd) {
 	case LINUX_REBOOT_CMD_RESTART:
 		notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
-		system_state = SYSTEM_SHUTDOWN;
+		system_state = SYSTEM_RESTART;
 		device_shutdown();
 		printk(KERN_EMERG "Restarting system.\n");
 		machine_restart(NULL);
@@ -463,7 +471,7 @@
 
 	case LINUX_REBOOT_CMD_HALT:
 		notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
-		system_state = SYSTEM_SHUTDOWN;
+		system_state = SYSTEM_HALT;
 		device_shutdown();
 		printk(KERN_EMERG "System halted.\n");
 		machine_halt();
@@ -473,7 +481,7 @@
 
 	case LINUX_REBOOT_CMD_POWER_OFF:
 		notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
-		system_state = SYSTEM_SHUTDOWN;
+		system_state = SYSTEM_POWER_OFF;
 		device_shutdown();
 		printk(KERN_EMERG "Power down.\n");
 		machine_power_off();
@@ -489,7 +497,7 @@
 		buffer[sizeof(buffer) - 1] = '\0';
 
 		notifier_call_chain(&reboot_notifier_list, SYS_RESTART, buffer);
-		system_state = SYSTEM_SHUTDOWN;
+		system_state = SYSTEM_RESTART;
 		device_shutdown();
 		printk(KERN_EMERG "Restarting system with command '%s'.\n", buffer);
 		machine_restart(buffer);
@@ -812,7 +820,7 @@
 	return security_task_post_setuid(old_ruid, old_euid, old_suid, LSM_SETID_RES);
 }
 
-asmlinkage long sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid)
+asmlinkage long sys_getresuid(uid_t __user *ruid, uid_t __user *euid, uid_t __user *suid)
 {
 	int retval;
 
@@ -861,7 +869,7 @@
 	return 0;
 }
 
-asmlinkage long sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
+asmlinkage long sys_getresgid(gid_t __user *rgid, gid_t __user *egid, gid_t __user *sgid)
 {
 	int retval;
 
@@ -1056,12 +1064,16 @@
 	}
 }
 
+#ifdef __ARCH_WANT_SYS_GETPGRP
+
 asmlinkage long sys_getpgrp(void)
 {
 	/* SMP - assuming writes are word atomic this is fine */
 	return process_group(current);
 }
 
+#endif
+
 asmlinkage long sys_getsid(pid_t pid)
 {
 	if (!pid) {
@@ -1121,10 +1133,10 @@
 	int nblocks;
 	int i;
 
-	nblocks = (gidsetsize/NGROUPS_PER_BLOCK) +
-	    (gidsetsize%NGROUPS_PER_BLOCK?1:0);
-	group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *),
-	    GFP_USER);
+	nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;
+	/* Make sure we always allocate at least one indirect block pointer */
+	nblocks = nblocks ? : 1;
+	group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);
 	if (!group_info)
 		return NULL;
 	group_info->ngroups = gidsetsize;
@@ -1270,8 +1282,12 @@
 
 	groups_sort(group_info);
 	get_group_info(group_info);
+
+	task_lock(current);
 	old_info = current->group_info;
 	current->group_info = group_info;
+	task_unlock(current);
+
 	put_group_info(old_info);
 
 	return 0;
@@ -1291,6 +1307,7 @@
 	if (gidsetsize < 0)
 		return -EINVAL;
 
+	/* no need to grab task_lock here; it cannot change */
 	get_group_info(current->group_info);
 	i = current->group_info->ngroups;
 	if (gidsetsize) {
@@ -1402,6 +1419,8 @@
 	return errno;
 }
 
+#ifdef __ARCH_WANT_SYS_GETHOSTNAME
+
 asmlinkage long sys_gethostname(char __user *name, int len)
 {
 	int i, errno;
@@ -1419,6 +1438,8 @@
 	return errno;
 }
 
+#endif
+
 /*
  * Only setdomainname; getdomainname can be implemented by calling
  * uname()
@@ -1453,7 +1474,7 @@
 			? -EFAULT : 0;
 }
 
-#if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64) || defined(CONFIG_V850))
+#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
 
 /*
  *	Back compatibility for getrlimit. Needed for some apps.
diff -Nru a/kernel/sysctl.c b/kernel/sysctl.c
--- a/kernel/sysctl.c	Tue Jun 15 22:20:37 2004
+++ b/kernel/sysctl.c	Tue Jun 15 22:20:37 2004
@@ -218,7 +218,7 @@
 		.ctl_name	= KERN_OSTYPE,
 		.procname	= "ostype",
 		.data		= system_utsname.sysname,
-		.maxlen		= 64,
+		.maxlen		= sizeof(system_utsname.sysname),
 		.mode		= 0444,
 		.proc_handler	= &proc_doutsstring,
 		.strategy	= &sysctl_string,
@@ -227,7 +227,7 @@
 		.ctl_name	= KERN_OSRELEASE,
 		.procname	= "osrelease",
 		.data		= system_utsname.release,
-		.maxlen		= 64,
+		.maxlen		= sizeof(system_utsname.release),
 		.mode		= 0444,
 		.proc_handler	= &proc_doutsstring,
 		.strategy	= &sysctl_string,
@@ -236,7 +236,7 @@
 		.ctl_name	= KERN_VERSION,
 		.procname	= "version",
 		.data		= system_utsname.version,
-		.maxlen		= 64,
+		.maxlen		= sizeof(system_utsname.version),
 		.mode		= 0444,
 		.proc_handler	= &proc_doutsstring,
 		.strategy	= &sysctl_string,
@@ -245,7 +245,7 @@
 		.ctl_name	= KERN_NODENAME,
 		.procname	= "hostname",
 		.data		= system_utsname.nodename,
-		.maxlen		= 64,
+		.maxlen		= sizeof(system_utsname.nodename),
 		.mode		= 0644,
 		.proc_handler	= &proc_doutsstring,
 		.strategy	= &sysctl_string,
@@ -254,7 +254,7 @@
 		.ctl_name	= KERN_DOMAINNAME,
 		.procname	= "domainname",
 		.data		= system_utsname.domainname,
-		.maxlen		= 64,
+		.maxlen		= sizeof(system_utsname.domainname),
 		.mode		= 0644,
 		.proc_handler	= &proc_doutsstring,
 		.strategy	= &sysctl_string,
@@ -392,7 +392,7 @@
 		.ctl_name	= KERN_MODPROBE,
 		.procname	= "modprobe",
 		.data		= &modprobe_path,
-		.maxlen		= 256,
+		.maxlen		= KMOD_PATH_LEN,
 		.mode		= 0644,
 		.proc_handler	= &proc_dostring,
 		.strategy	= &sysctl_string,
@@ -403,7 +403,7 @@
 		.ctl_name	= KERN_HOTPLUG,
 		.procname	= "hotplug",
 		.data		= &hotplug_path,
-		.maxlen		= 256,
+		.maxlen		= KMOD_PATH_LEN,
 		.mode		= 0644,
 		.proc_handler	= &proc_dostring,
 		.strategy	= &sysctl_string,
@@ -738,6 +738,14 @@
 		.extra1		= (void *)&hugetlb_zero,
 		.extra2		= (void *)&hugetlb_infinity,
 	 },
+	 {
+		.ctl_name	= VM_HUGETLB_GROUP,
+		.procname	= "hugetlb_shm_group",
+		.data		= &sysctl_hugetlb_shm_group,
+		.maxlen		= sizeof(gid_t),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	 },
 #endif
 	{
 		.ctl_name	= VM_LOWER_ZONE_PROTECTION,
@@ -1377,7 +1385,7 @@
 			if(copy_to_user(buffer, table->data, len))
 				return -EFAULT;
 		if (len < *lenp) {
-			if(put_user('\n', ((char *) buffer) + len))
+			if(put_user('\n', ((char __user *) buffer) + len))
 				return -EFAULT;
 			len++;
 		}
@@ -1440,6 +1448,7 @@
 	size_t left, len;
 	
 	char buf[TMPBUFLEN], *p;
+	char __user *s = buffer;
 	
 	if (!table->data || !table->maxlen || !*lenp ||
 	    (filp->f_pos && !write)) {
@@ -1458,12 +1467,12 @@
 		if (write) {
 			while (left) {
 				char c;
-				if (get_user(c,(char __user *) buffer))
+				if (get_user(c, s))
 					return -EFAULT;
 				if (!isspace(c))
 					break;
 				left--;
-				buffer++;
+				s++;
 			}
 			if (!left)
 				break;
@@ -1471,7 +1480,7 @@
 			len = left;
 			if (len > sizeof(buf) - 1)
 				len = sizeof(buf) - 1;
-			if(copy_from_user(buf, buffer, len))
+			if (copy_from_user(buf, s, len))
 				return -EFAULT;
 			buf[len] = 0;
 			p = buf;
@@ -1489,7 +1498,7 @@
 				break;
 			if (neg)
 				val = -val;
-			buffer += len;
+			s += len;
 			left -= len;
 
 			if (conv(&neg, &lval, i, 1, data))
@@ -1506,23 +1515,22 @@
 			len = strlen(buf);
 			if (len > left)
 				len = left;
-			if(copy_to_user(buffer, buf, len))
+			if(copy_to_user(s, buf, len))
 				return -EFAULT;
 			left -= len;
-			buffer += len;
+			s += len;
 		}
 	}
 
 	if (!write && !first && left) {
-		if(put_user('\n', (char *) buffer))
+		if(put_user('\n', s))
 			return -EFAULT;
-		left--, buffer++;
+		left--, s++;
 	}
 	if (write) {
-		p = (char *) buffer;
 		while (left) {
 			char c;
-			if (get_user(c, p++))
+			if (get_user(c, s++))
 				return -EFAULT;
 			if (!isspace(c))
 				break;
@@ -1679,6 +1687,7 @@
 	int vleft, first=1, neg;
 	size_t len, left;
 	char buf[TMPBUFLEN], *p;
+	char __user *s = buffer;
 	
 	if (!table->data || !table->maxlen || !*lenp ||
 	    (filp->f_pos && !write)) {
@@ -1696,12 +1705,12 @@
 		if (write) {
 			while (left) {
 				char c;
-				if (get_user(c, (char __user *) buffer))
+				if (get_user(c, s))
 					return -EFAULT;
 				if (!isspace(c))
 					break;
 				left--;
-				buffer++;
+				s++;
 			}
 			if (!left)
 				break;
@@ -1709,7 +1718,7 @@
 			len = left;
 			if (len > TMPBUFLEN-1)
 				len = TMPBUFLEN-1;
-			if (copy_from_user(buf, buffer, len))
+			if (copy_from_user(buf, s, len))
 				return -EFAULT;
 			buf[len] = 0;
 			p = buf;
@@ -1725,7 +1734,7 @@
 				break;
 			if (neg)
 				val = -val;
-			buffer += len;
+			s += len;
 			left -= len;
 
 			if(neg)
@@ -1741,23 +1750,22 @@
 			len = strlen(buf);
 			if (len > left)
 				len = left;
-			if(copy_to_user(buffer, buf, len))
+			if(copy_to_user(s, buf, len))
 				return -EFAULT;
 			left -= len;
-			buffer += len;
+			s += len;
 		}
 	}
 
 	if (!write && !first && left) {
-		if(put_user('\n', (char *) buffer))
+		if(put_user('\n', s))
 			return -EFAULT;
-		left--, buffer++;
+		left--, s++;
 	}
 	if (write) {
-		p = (char *) buffer;
 		while (left) {
 			char c;
-			if (get_user(c, p++))
+			if (get_user(c, s++))
 				return -EFAULT;
 			if (!isspace(c))
 				break;
@@ -1909,56 +1917,56 @@
 #else /* CONFIG_PROC_FS */
 
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-		  void *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-			    void *buffer, size_t *lenp)
+			    void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-		  void *buffer, size_t *lenp)
+		  void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-			void *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-		    void *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-		    void *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-		    void *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-		    void *buffer, size_t *lenp)
+		    void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
 				      struct file *filp,
-				      void *buffer, size_t *lenp)
+				      void __user *buffer, size_t *lenp)
 {
     return -ENOSYS;
 }
@@ -1991,7 +1999,7 @@
 				len = table->maxlen;
 			if(copy_to_user(oldval, table->data, len))
 				return -EFAULT;
-			if(put_user(0, ((char *) oldval) + len))
+			if(put_user(0, ((char __user *) oldval) + len))
 				return -EFAULT;
 			if(put_user(len, oldlenp))
 				return -EFAULT;
@@ -2019,10 +2027,14 @@
 		void __user *oldval, size_t __user *oldlenp,
 		void __user *newval, size_t newlen, void **context)
 {
-	int i, *vec, *min, *max;
-	size_t length;
 
 	if (newval && newlen) {
+		int __user *vec = (int __user *) newval;
+		int *min = (int *) table->extra1;
+		int *max = (int *) table->extra2;
+		size_t length;
+		int i;
+
 		if (newlen % sizeof(int) != 0)
 			return -EINVAL;
 
@@ -2033,10 +2045,6 @@
 			newlen = table->maxlen;
 		length = newlen / sizeof(int);
 
-		vec = (int *) newval;
-		min = (int *) table->extra1;
-		max = (int *) table->extra2;
-
 		for (i = 0; i < length; i++) {
 			int value;
 			if (get_user(value, vec + i))
@@ -2063,7 +2071,7 @@
 			if (olen!=sizeof(int))
 				return -EINVAL; 
 		}
-		if (put_user(*(int *)(table->data) / HZ, (int *)oldval) || 
+		if (put_user(*(int *)(table->data)/HZ, (int __user *)oldval) ||
 		    (oldlenp && put_user(sizeof(int),oldlenp)))
 			return -EFAULT;
 	}
@@ -2071,7 +2079,7 @@
 		int new;
 		if (newlen != sizeof(int))
 			return -EINVAL; 
-		if (get_user(new, (int *)newval))
+		if (get_user(new, (int __user *)newval))
 			return -EFAULT;
 		*(int *)(table->data) = new*HZ; 
 	}
@@ -2133,13 +2141,13 @@
 }
 
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-			  void *buffer, size_t *lenp)
+			  void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
 
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-			  void *buffer, size_t *lenp)
+			  void __user *buffer, size_t *lenp)
 {
 	return -ENOSYS;
 }
diff -Nru a/kernel/time.c b/kernel/time.c
--- a/kernel/time.c	Tue Jun 15 22:20:38 2004
+++ b/kernel/time.c	Tue Jun 15 22:20:38 2004
@@ -29,6 +29,7 @@
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 /* 
  * The timezone where the local system is located.  Used as a default by some
@@ -38,7 +39,7 @@
 
 EXPORT_SYMBOL(sys_tz);
 
-#if !defined(__alpha__) && !defined(__ia64__)
+#ifdef __ARCH_WANT_SYS_TIME
 
 /*
  * sys_time() can be implemented in user-level using
@@ -48,7 +49,7 @@
  *
  * XXX This function is NOT 64-bit clean!
  */
-asmlinkage long sys_time(int * tloc)
+asmlinkage long sys_time(int __user * tloc)
 {
 	int i;
 	struct timeval tv;
@@ -70,7 +71,7 @@
  * architectures that need it).
  */
  
-asmlinkage long sys_stime(time_t *tptr)
+asmlinkage long sys_stime(time_t __user *tptr)
 {
 	struct timespec tv;
 
@@ -84,7 +85,7 @@
 	return 0;
 }
 
-#endif
+#endif /* __ARCH_WANT_SYS_TIME */
 
 asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __user *tz)
 {
diff -Nru a/kernel/timer.c b/kernel/timer.c
--- a/kernel/timer.c	Tue Jun 15 22:20:44 2004
+++ b/kernel/timer.c	Tue Jun 15 22:20:44 2004
@@ -33,6 +33,7 @@
 #include <linux/cpu.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/div64.h>
 #include <asm/timex.h>
 
@@ -317,10 +318,16 @@
  *
  * Synchronization rules: callers must prevent restarting of the timer,
  * otherwise this function is meaningless. It must not be called from
- * interrupt contexts. Upon exit the timer is not queued and the handler
- * is not running on any CPU.
+ * interrupt contexts. The caller must not hold locks which would prevent
+ * completion of the timer's handler.  Upon exit the timer is not queued and
+ * the handler is not running on any CPU.
  *
  * The function returns whether it has deactivated a pending timer or not.
+ *
+ * del_timer_sync() is slow and complicated because it copes with timer
+ * handlers which re-arm the timer (periodic timers).  If the timer handler
+ * is known to not do this (a single shot timer) then use
+ * del_singleshot_timer_sync() instead.
  */
 int del_timer_sync(struct timer_list *timer)
 {
@@ -332,7 +339,7 @@
 del_again:
 	ret += del_timer(timer);
 
-	for_each_cpu(i) {
+	for_each_online_cpu(i) {
 		base = &per_cpu(tvec_bases, i);
 		if (base->running_timer == timer) {
 			while (base->running_timer == timer) {
@@ -348,8 +355,36 @@
 
 	return ret;
 }
-
 EXPORT_SYMBOL(del_timer_sync);
+
+/***
+ * del_singleshot_timer_sync - deactivate a non-recursive timer
+ * @timer: the timer to be deactivated
+ *
+ * This function is an optimization of del_timer_sync for the case where the
+ * caller can guarantee the timer does not reschedule itself in its timer
+ * function.
+ *
+ * Synchronization rules: callers must prevent restarting of the timer,
+ * otherwise this function is meaningless. It must not be called from
+ * interrupt contexts. The caller must not hold locks which wold prevent
+ * completion of the timer's handler.  Upon exit the timer is not queued and
+ * the handler is not running on any CPU.
+ *
+ * The function returns whether it has deactivated a pending timer or not.
+ */
+int del_singleshot_timer_sync(struct timer_list *timer)
+{
+	int ret = del_timer(timer);
+
+	if (!ret) {
+		ret = del_timer_sync(timer);
+		BUG_ON(ret);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(del_singleshot_timer_sync);
 #endif
 
 static int cascade(tvec_base_t *base, tvec_t *tv, int index)
@@ -918,7 +953,7 @@
 	update_times();
 }
 
-#if !defined(__alpha__) && !defined(__ia64__)
+#ifdef __ARCH_WANT_SYS_ALARM
 
 /*
  * For backwards compatibility?  This can be done in libc so Alpha
@@ -1109,7 +1144,7 @@
 
 	add_timer(&timer);
 	schedule();
-	del_timer_sync(&timer);
+	del_singleshot_timer_sync(&timer);
 
 	timeout = expire - jiffies;
 
@@ -1451,3 +1486,20 @@
 	spin_unlock(&time_interpolator_lock);
 }
 #endif /* CONFIG_TIME_INTERPOLATION */
+
+/**
+ * msleep - sleep safely even with waitqueue interruptions
+ * @msecs: Time in milliseconds to sleep for
+ */
+void msleep(unsigned int msecs)
+{
+	unsigned long timeout = msecs_to_jiffies(msecs);
+
+	while (timeout) {
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		timeout = schedule_timeout(timeout);
+	}
+}
+
+EXPORT_SYMBOL(msleep);
+
diff -Nru a/kernel/user.c b/kernel/user.c
--- a/kernel/user.c	Tue Jun 15 22:20:39 2004
+++ b/kernel/user.c	Tue Jun 15 22:20:39 2004
@@ -64,9 +64,20 @@
 	return NULL;
 }
 
+/*
+ * Locate the user_struct for the passed UID.  If found, take a ref on it.  The
+ * caller must undo that ref with free_uid().
+ *
+ * If the user_struct could not be found, return NULL.
+ */
 struct user_struct *find_user(uid_t uid)
 {
-	return uid_hash_find(uid, uidhashentry(uid));
+	struct user_struct *ret;
+
+	spin_lock(&uidhash_lock);
+	ret = uid_hash_find(uid, uidhashentry(uid));
+	spin_unlock(&uidhash_lock);
+	return ret;
 }
 
 void free_uid(struct user_struct *up)
@@ -138,10 +149,7 @@
 	int n;
 
 	uid_cachep = kmem_cache_create("uid_cache", sizeof(struct user_struct),
-				       0,
-				       SLAB_HWCACHE_ALIGN, NULL, NULL);
-	if(!uid_cachep)
-		panic("Cannot create uid taskcount SLAB cache\n");
+			0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 
 	for(n = 0; n < UIDHASH_SZ; ++n)
 		INIT_LIST_HEAD(uidhash_table + n);
diff -Nru a/kernel/workqueue.c b/kernel/workqueue.c
--- a/kernel/workqueue.c	Tue Jun 15 22:21:04 2004
+++ b/kernel/workqueue.c	Tue Jun 15 22:21:04 2004
@@ -201,22 +201,50 @@
 	siginitset(&sa.sa.sa_mask, sigmask(SIGCHLD));
 	do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
 
+	set_current_state(TASK_INTERRUPTIBLE);
 	while (!kthread_should_stop()) {
-		set_task_state(current, TASK_INTERRUPTIBLE);
-
 		add_wait_queue(&cwq->more_work, &wait);
 		if (list_empty(&cwq->worklist))
 			schedule();
 		else
-			set_task_state(current, TASK_RUNNING);
+			__set_current_state(TASK_RUNNING);
 		remove_wait_queue(&cwq->more_work, &wait);
 
 		if (!list_empty(&cwq->worklist))
 			run_workqueue(cwq);
+		set_current_state(TASK_INTERRUPTIBLE);
 	}
+	__set_current_state(TASK_RUNNING);
 	return 0;
 }
 
+static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
+{
+	if (cwq->thread == current) {
+		/*
+		 * Probably keventd trying to flush its own queue. So simply run
+		 * it by hand rather than deadlocking.
+		 */
+		run_workqueue(cwq);
+	} else {
+		DEFINE_WAIT(wait);
+		long sequence_needed;
+
+		spin_lock_irq(&cwq->lock);
+		sequence_needed = cwq->insert_sequence;
+
+		while (sequence_needed - cwq->remove_sequence > 0) {
+			prepare_to_wait(&cwq->work_done, &wait,
+					TASK_UNINTERRUPTIBLE);
+			spin_unlock_irq(&cwq->lock);
+			schedule();
+			spin_lock_irq(&cwq->lock);
+		}
+		finish_wait(&cwq->work_done, &wait);
+		spin_unlock_irq(&cwq->lock);
+	}
+}
+
 /*
  * flush_workqueue - ensure that any scheduled work has run to completion.
  *
@@ -233,43 +261,19 @@
  */
 void fastcall flush_workqueue(struct workqueue_struct *wq)
 {
-	struct cpu_workqueue_struct *cwq;
-	int cpu;
-
 	might_sleep();
 
-	lock_cpu_hotplug();
-	for_each_online_cpu(cpu) {
-		DEFINE_WAIT(wait);
-		long sequence_needed;
-
-		if (is_single_threaded(wq))
-			cwq = wq->cpu_wq + 0; /* Always use cpu 0's area. */
-		else
-			cwq = wq->cpu_wq + cpu;
-
-		if (cwq->thread == current) {
-			/*
-			 * Probably keventd trying to flush its own queue.
-			 * So simply run it by hand rather than deadlocking.
-			 */
-			run_workqueue(cwq);
-			continue;
-		}
-		spin_lock_irq(&cwq->lock);
-		sequence_needed = cwq->insert_sequence;
+	if (is_single_threaded(wq)) {
+		/* Always use cpu 0's area. */
+		flush_cpu_workqueue(wq->cpu_wq + 0);
+	} else {
+		int cpu;
 
-		while (sequence_needed - cwq->remove_sequence > 0) {
-			prepare_to_wait(&cwq->work_done, &wait,
-					TASK_UNINTERRUPTIBLE);
-			spin_unlock_irq(&cwq->lock);
-			schedule();
-			spin_lock_irq(&cwq->lock);
-		}
-		finish_wait(&cwq->work_done, &wait);
-		spin_unlock_irq(&cwq->lock);
+		lock_cpu_hotplug();
+		for_each_online_cpu(cpu)
+			flush_cpu_workqueue(wq->cpu_wq + cpu);
+		unlock_cpu_hotplug();
 	}
-	unlock_cpu_hotplug();
 }
 
 static struct task_struct *create_workqueue_thread(struct workqueue_struct *wq,
@@ -324,7 +328,7 @@
 	} else {
 		spin_lock(&workqueue_lock);
 		list_add(&wq->list, &workqueues);
-		spin_unlock_irq(&workqueue_lock);
+		spin_unlock(&workqueue_lock);
 		for_each_online_cpu(cpu) {
 			p = create_workqueue_thread(wq, cpu);
 			if (p) {
@@ -334,6 +338,7 @@
 				destroy = 1;
 		}
 	}
+	unlock_cpu_hotplug();
 
 	/*
 	 * Was there any error during startup? If yes then clean up:
@@ -342,7 +347,6 @@
 		destroy_workqueue(wq);
 		wq = NULL;
 	}
-	unlock_cpu_hotplug();
 	return wq;
 }
 
@@ -376,7 +380,7 @@
 			cleanup_workqueue_thread(wq, cpu);
 		spin_lock(&workqueue_lock);
 		list_del(&wq->list);
-		spin_unlock_irq(&workqueue_lock);
+		spin_unlock(&workqueue_lock);
 	}
 	unlock_cpu_hotplug();
 	kfree(wq);
diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c	Tue Jun 15 22:21:00 2004
+++ b/lib/kobject.c	Tue Jun 15 22:21:00 2004
@@ -385,13 +385,17 @@
  *	@new_name: object's new name
  */
 
-void kobject_rename(struct kobject * kobj, char *new_name)
+int kobject_rename(struct kobject * kobj, char *new_name)
 {
+	int error = 0;
+
 	kobj = kobject_get(kobj);
 	if (!kobj)
-		return;
-	sysfs_rename_dir(kobj, new_name);
+		return -EINVAL;
+	error = sysfs_rename_dir(kobj, new_name);
 	kobject_put(kobj);
+
+	return error;
 }
 
 /**
diff -Nru a/lib/radix-tree.c b/lib/radix-tree.c
--- a/lib/radix-tree.c	Tue Jun 15 22:20:38 2004
+++ b/lib/radix-tree.c	Tue Jun 15 22:20:38 2004
@@ -799,9 +799,7 @@
 {
 	radix_tree_node_cachep = kmem_cache_create("radix_tree_node",
 			sizeof(struct radix_tree_node), 0,
-			0, radix_tree_node_ctor, NULL);
-	if (!radix_tree_node_cachep)
-		panic ("Failed to create radix_tree_node cache\n");
+			SLAB_PANIC, radix_tree_node_ctor, NULL);
 	radix_tree_init_maxindex();
 	hotcpu_notifier(radix_tree_callback, 0);
 }
diff -Nru a/lib/rwsem.c b/lib/rwsem.c
--- a/lib/rwsem.c	Tue Jun 15 22:20:36 2004
+++ b/lib/rwsem.c	Tue Jun 15 22:20:36 2004
@@ -29,15 +29,15 @@
 
 /*
  * handle the lock being released whilst there are processes blocked on it that can now run
- * - if we come here, then:
- *   - the 'active part' of the count (&0x0000ffff) reached zero but has been re-incremented
+ * - if we come here from up_xxxx(), then:
+ *   - the 'active part' of the count (&0x0000ffff) had reached zero (but may have changed)
  *   - the 'waiting part' of the count (&0xffff0000) is negative (and will still be so)
  *   - there must be someone on the queue
  * - the spinlock must be held by the caller
  * - woken process blocks are discarded from the list after having task zeroed
- * - writers are only woken if wakewrite is non-zero
+ * - writers are only woken if downgrading is false
  */
-static inline struct rw_semaphore *__rwsem_do_wake(struct rw_semaphore *sem, int wakewrite)
+static inline struct rw_semaphore *__rwsem_do_wake(struct rw_semaphore *sem, int downgrading)
 {
 	struct rwsem_waiter *waiter;
 	struct task_struct *tsk;
@@ -46,10 +46,12 @@
 
 	rwsemtrace(sem,"Entering __rwsem_do_wake");
 
-	if (!wakewrite)
+	if (downgrading)
 		goto dont_wake_writers;
 
-	/* only wake someone up if we can transition the active part of the count from 0 -> 1 */
+	/* if we came through an up_xxxx() call, we only only wake someone up
+	 * if we can transition the active part of the count from 0 -> 1
+	 */
  try_again:
 	oldcount = rwsem_atomic_update(RWSEM_ACTIVE_BIAS,sem) - RWSEM_ACTIVE_BIAS;
 	if (oldcount & RWSEM_ACTIVE_MASK)
@@ -78,9 +80,10 @@
 	if (waiter->flags & RWSEM_WAITING_FOR_WRITE)
 		goto out;
 
-	/* grant an infinite number of read locks to the readers at the front of the queue
-	 * - note we increment the 'active part' of the count by the number of readers (less one
-	 *   for the activity decrement we've already done) before waking any processes up
+	/* grant an infinite number of read locks to the readers at the front
+	 * of the queue
+	 * - note we increment the 'active part' of the count by the number of
+	 *   readers before waking any processes up
 	 */
  readers_only:
 	woken = 0;
@@ -95,8 +98,10 @@
 	} while (waiter->flags & RWSEM_WAITING_FOR_READ);
 
 	loop = woken;
-	woken *= RWSEM_ACTIVE_BIAS-RWSEM_WAITING_BIAS;
-	woken -= RWSEM_ACTIVE_BIAS;
+	woken *= RWSEM_ACTIVE_BIAS - RWSEM_WAITING_BIAS;
+	if (!downgrading)
+		woken -= RWSEM_ACTIVE_BIAS; /* we'd already done one increment
+					     * earlier */
 	rwsem_atomic_add(woken,sem);
 
 	next = sem->wait_list.next;
@@ -150,7 +155,7 @@
 	 * - it might even be this process, since the waker takes a more active part
 	 */
 	if (!(count & RWSEM_ACTIVE_MASK))
-		sem = __rwsem_do_wake(sem,1);
+		sem = __rwsem_do_wake(sem, 0);
 
 	spin_unlock(&sem->wait_lock);
 
@@ -201,7 +206,7 @@
 
 /*
  * handle waking up a waiter on the semaphore
- * - up_read has decremented the active part of the count if we come here
+ * - up_read/up_write has decremented the active part of the count if we come here
  */
 struct rw_semaphore fastcall *rwsem_wake(struct rw_semaphore *sem)
 {
@@ -211,7 +216,7 @@
 
 	/* do nothing if list empty */
 	if (!list_empty(&sem->wait_list))
-		sem = __rwsem_do_wake(sem,1);
+		sem = __rwsem_do_wake(sem, 0);
 
 	spin_unlock(&sem->wait_lock);
 
@@ -233,7 +238,7 @@
 
 	/* do nothing if list empty */
 	if (!list_empty(&sem->wait_list))
-		sem = __rwsem_do_wake(sem,0);
+		sem = __rwsem_do_wake(sem, 1);
 
 	spin_unlock(&sem->wait_lock);
 
diff -Nru a/lib/string.c b/lib/string.c
--- a/lib/string.c	Tue Jun 15 22:20:44 2004
+++ b/lib/string.c	Tue Jun 15 22:20:44 2004
@@ -445,8 +445,8 @@
 #ifndef __HAVE_ARCH_BCOPY
 /**
  * bcopy - Copy one area of memory to another
- * @src: Where to copy from
- * @dest: Where to copy to
+ * @srcp: Where to copy from
+ * @destp: Where to copy to
  * @count: The size of the area.
  *
  * Note that this is the same as memcpy(), with the arguments reversed.
diff -Nru a/mm/Makefile b/mm/Makefile
--- a/mm/Makefile	Tue Jun 15 22:20:42 2004
+++ b/mm/Makefile	Tue Jun 15 22:20:42 2004
@@ -8,8 +8,10 @@
 			   shmem.o vmalloc.o
 
 obj-y			:= bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
-			   page_alloc.o page-writeback.o pdflush.o readahead.o \
-			   slab.o swap.o truncate.o vmscan.o $(mmu-y)
+			   page_alloc.o page-writeback.o pdflush.o prio_tree.o \
+			   readahead.o slab.o swap.o truncate.o vmscan.o \
+			   $(mmu-y)
 
 obj-$(CONFIG_SWAP)	+= page_io.o swap_state.o swapfile.o
 obj-$(CONFIG_HUGETLBFS)	+= hugetlb.o
+obj-$(CONFIG_NUMA) 	+= mempolicy.o
diff -Nru a/mm/bootmem.c b/mm/bootmem.c
--- a/mm/bootmem.c	Tue Jun 15 22:20:38 2004
+++ b/mm/bootmem.c	Tue Jun 15 22:20:38 2004
@@ -82,14 +82,11 @@
 							PAGE_SIZE-1)/PAGE_SIZE;
 	unsigned long end = (addr + size + PAGE_SIZE-1)/PAGE_SIZE;
 
-	if (!size) BUG();
+	BUG_ON(!size);
+	BUG_ON(sidx >= eidx);
+	BUG_ON((addr >> PAGE_SHIFT) >= bdata->node_low_pfn);
+	BUG_ON(end > bdata->node_low_pfn);
 
-	if (sidx >= eidx)
-		BUG();
-	if ((addr >> PAGE_SHIFT) >= bdata->node_low_pfn)
-		BUG();
-	if (end > bdata->node_low_pfn)
-		BUG();
 	for (i = sidx; i < eidx; i++)
 		if (test_and_set_bit(i, bdata->node_bootmem_map)) {
 #ifdef CONFIG_DEBUG_BOOTMEM
@@ -110,9 +107,8 @@
 	unsigned long eidx = (addr + size - bdata->node_boot_start)/PAGE_SIZE;
 	unsigned long end = (addr + size)/PAGE_SIZE;
 
-	if (!size) BUG();
-	if (end > bdata->node_low_pfn)
-		BUG();
+	BUG_ON(!size);
+	BUG_ON(end > bdata->node_low_pfn);
 
 	if (addr < bdata->last_success)
 		bdata->last_success = addr;
@@ -124,7 +120,7 @@
 	sidx = start - (bdata->node_boot_start/PAGE_SIZE);
 
 	for (i = sidx; i < eidx; i++) {
-		if (!test_and_clear_bit(i, bdata->node_bootmem_map))
+		if (unlikely(!test_and_clear_bit(i, bdata->node_bootmem_map)))
 			BUG();
 	}
 }
@@ -140,7 +136,7 @@
  *
  * alignment has to be a power of 2 value.
  *
- * NOTE:  This function is _not_ reenetrant.
+ * NOTE:  This function is _not_ reentrant.
  */
 static void * __init
 __alloc_bootmem_core(struct bootmem_data *bdata, unsigned long size,
@@ -152,7 +148,6 @@
 
 	if(!size) {
 		printk("__alloc_bootmem_core(): zero-sized request\n");
-		dump_stack();
 		BUG();
 	}
 	BUG_ON(align & (align-1));
@@ -260,7 +255,7 @@
 	unsigned long idx;
 	unsigned long *map; 
 
-	if (!bdata->node_bootmem_map) BUG();
+	BUG_ON(!bdata->node_bootmem_map);
 
 	count = 0;
 	/* first extant page of the node */
diff -Nru a/mm/fadvise.c b/mm/fadvise.c
--- a/mm/fadvise.c	Tue Jun 15 22:20:39 2004
+++ b/mm/fadvise.c	Tue Jun 15 22:20:39 2004
@@ -16,6 +16,8 @@
 #include <linux/pagevec.h>
 #include <linux/fadvise.h>
 
+#include <asm/unistd.h>
+
 /*
  * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
  * deactivate the pages and clear PG_Referenced.
@@ -98,8 +100,11 @@
 	return ret;
 }
 
+#ifdef __ARCH_WANT_SYS_FADVISE64
+
 asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice)
 {
 	return sys_fadvise64_64(fd, offset, len, advice);
 }
 
+#endif
diff -Nru a/mm/filemap.c b/mm/filemap.c
--- a/mm/filemap.c	Tue Jun 15 22:20:39 2004
+++ b/mm/filemap.c	Tue Jun 15 22:20:39 2004
@@ -55,17 +55,19 @@
 /*
  * Lock ordering:
  *
- *  ->i_shared_sem		(vmtruncate)
+ *  ->i_mmap_lock		(vmtruncate)
  *    ->private_lock		(__free_pte->__set_page_dirty_buffers)
  *      ->swap_list_lock
  *        ->swap_device_lock	(exclusive_swap_page, others)
  *          ->mapping->tree_lock
  *
  *  ->i_sem
- *    ->i_shared_sem		(truncate->unmap_mapping_range)
+ *    ->i_mmap_lock		(truncate->unmap_mapping_range)
  *
  *  ->mmap_sem
- *    ->i_shared_sem		(various places)
+ *    ->i_mmap_lock
+ *      ->page_table_lock	(various places, mainly in mmap.c)
+ *        ->mapping->tree_lock	(arch-dependent flush_dcache_mmap_lock)
  *
  *  ->mmap_sem
  *    ->lock_page		(access_process_vm)
@@ -121,14 +123,13 @@
 {
 	struct address_space *mapping;
 
+	/*
+	 * FIXME, fercrissake.  What is this barrier here for?
+	 */
 	smp_mb();
 	mapping = page_mapping(page);
-	if (mapping) {
-		if (mapping->a_ops && mapping->a_ops->sync_page)
-			return mapping->a_ops->sync_page(page);
-	} else if (PageSwapCache(page)) {
-		swap_unplug_io_fn(page);
-	}
+	if (mapping && mapping->a_ops && mapping->a_ops->sync_page)
+		return mapping->a_ops->sync_page(page);
 	return 0;
 }
 
@@ -252,17 +253,15 @@
 	int error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
 
 	if (error == 0) {
-		page_cache_get(page);
 		spin_lock_irq(&mapping->tree_lock);
 		error = radix_tree_insert(&mapping->page_tree, offset, page);
 		if (!error) {
+			page_cache_get(page);
 			SetPageLocked(page);
 			page->mapping = mapping;
 			page->index = offset;
 			mapping->nrpages++;
 			pagecache_acct(1);
-		} else {
-			page_cache_release(page);
 		}
 		spin_unlock_irq(&mapping->tree_lock);
 		radix_tree_preload_end();
@@ -291,6 +290,40 @@
  * at a cost of "thundering herd" phenomena during rare hash
  * collisions.
  */
+struct page_wait_queue {
+	struct page *page;
+	int bit;
+	wait_queue_t wait;
+};
+
+static int page_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
+{
+	struct page *page = key;
+	struct page_wait_queue *wq;
+
+	wq = container_of(wait, struct page_wait_queue, wait);
+	if (wq->page != page || test_bit(wq->bit, &page->flags))
+		return 0;
+	else
+		return autoremove_wake_function(wait, mode, sync, NULL);
+}
+
+#define __DEFINE_PAGE_WAIT(name, p, b, f)				\
+	struct page_wait_queue name = {					\
+		.page	= p,						\
+		.bit	= b,						\
+		.wait	= {						\
+			.task	= current,				\
+			.func	= page_wake_function,			\
+			.flags	= f,					\
+			.task_list = LIST_HEAD_INIT(name.wait.task_list),\
+		},							\
+	}
+
+#define DEFINE_PAGE_WAIT(name, p, b)	__DEFINE_PAGE_WAIT(name, p, b, 0)
+#define DEFINE_PAGE_WAIT_EXCLUSIVE(name, p, b)				\
+		__DEFINE_PAGE_WAIT(name, p, b, WQ_FLAG_EXCLUSIVE)
+
 static wait_queue_head_t *page_waitqueue(struct page *page)
 {
 	const struct zone *zone = page_zone(page);
@@ -298,19 +331,28 @@
 	return &zone->wait_table[hash_ptr(page, zone->wait_table_bits)];
 }
 
+static void wake_up_page(struct page *page)
+{
+	const unsigned int mode = TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE;
+	wait_queue_head_t *waitqueue = page_waitqueue(page);
+
+	if (waitqueue_active(waitqueue))
+		__wake_up(waitqueue, mode, 1, page);
+}
+
 void fastcall wait_on_page_bit(struct page *page, int bit_nr)
 {
 	wait_queue_head_t *waitqueue = page_waitqueue(page);
-	DEFINE_WAIT(wait);
+	DEFINE_PAGE_WAIT(wait, page, bit_nr);
 
 	do {
-		prepare_to_wait(waitqueue, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(waitqueue, &wait.wait, TASK_UNINTERRUPTIBLE);
 		if (test_bit(bit_nr, &page->flags)) {
 			sync_page(page);
 			io_schedule();
 		}
 	} while (test_bit(bit_nr, &page->flags));
-	finish_wait(waitqueue, &wait);
+	finish_wait(waitqueue, &wait.wait);
 }
 
 EXPORT_SYMBOL(wait_on_page_bit);
@@ -332,13 +374,11 @@
  */
 void fastcall unlock_page(struct page *page)
 {
-	wait_queue_head_t *waitqueue = page_waitqueue(page);
 	smp_mb__before_clear_bit();
 	if (!TestClearPageLocked(page))
 		BUG();
 	smp_mb__after_clear_bit(); 
-	if (waitqueue_active(waitqueue))
-		wake_up_all(waitqueue);
+	wake_up_page(page);
 }
 
 EXPORT_SYMBOL(unlock_page);
@@ -349,15 +389,12 @@
  */
 void end_page_writeback(struct page *page)
 {
-	wait_queue_head_t *waitqueue = page_waitqueue(page);
-
 	if (!TestClearPageReclaim(page) || rotate_reclaimable_page(page)) {
 		if (!test_clear_page_writeback(page))
 			BUG();
 		smp_mb__after_clear_bit();
 	}
-	if (waitqueue_active(waitqueue))
-		wake_up_all(waitqueue);
+	wake_up_page(page);
 }
 
 EXPORT_SYMBOL(end_page_writeback);
@@ -373,16 +410,16 @@
 void fastcall __lock_page(struct page *page)
 {
 	wait_queue_head_t *wqh = page_waitqueue(page);
-	DEFINE_WAIT(wait);
+	DEFINE_PAGE_WAIT_EXCLUSIVE(wait, page, PG_locked);
 
 	while (TestSetPageLocked(page)) {
-		prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait_exclusive(wqh, &wait.wait, TASK_UNINTERRUPTIBLE);
 		if (PageLocked(page)) {
 			sync_page(page);
 			io_schedule();
 		}
 	}
-	finish_wait(wqh, &wait);
+	finish_wait(wqh, &wait.wait);
 }
 
 EXPORT_SYMBOL(__lock_page);
@@ -606,7 +643,7 @@
  * - note the struct file * is only passed for the use of readpage
  */
 void do_generic_mapping_read(struct address_space *mapping,
-			     struct file_ra_state *ra,
+			     struct file_ra_state *_ra,
 			     struct file * filp,
 			     loff_t *ppos,
 			     read_descriptor_t * desc,
@@ -616,6 +653,7 @@
 	unsigned long index, offset;
 	struct page *cached_page;
 	int error;
+	struct file_ra_state ra = *_ra;
 
 	cached_page = NULL;
 	index = *ppos >> PAGE_CACHE_SHIFT;
@@ -638,13 +676,13 @@
 		}
 
 		cond_resched();
-		page_cache_readahead(mapping, ra, filp, index);
+		page_cache_readahead(mapping, &ra, filp, index);
 
 		nr = nr - offset;
 find_page:
 		page = find_get_page(mapping, index);
 		if (unlikely(page == NULL)) {
-			handle_ra_miss(mapping, ra, index);
+			handle_ra_miss(mapping, &ra, index);
 			goto no_cached_page;
 		}
 		if (!PageUptodate(page))
@@ -684,9 +722,6 @@
 		break;
 
 page_not_up_to_date:
-		if (PageUptodate(page))
-			goto page_ok;
-
 		/* Get exclusive access to the page ... */
 		lock_page(page);
 
@@ -745,6 +780,8 @@
 		cached_page = NULL;
 		goto readpage;
 	}
+
+	*_ra = ra;
 
 	*ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset;
 	if (cached_page)
diff -Nru a/mm/fremap.c b/mm/fremap.c
--- a/mm/fremap.c	Tue Jun 15 22:20:36 2004
+++ b/mm/fremap.c	Tue Jun 15 22:20:36 2004
@@ -36,7 +36,7 @@
 			if (!PageReserved(page)) {
 				if (pte_dirty(pte))
 					set_page_dirty(page);
-				page_remove_rmap(page, ptep);
+				page_remove_rmap(page);
 				page_cache_release(page);
 				mm->rss--;
 			}
@@ -49,7 +49,7 @@
 }
 
 /*
- * Install a page to a given virtual memory address, release any
+ * Install a file page to a given virtual memory address, release any
  * previously existing mapping.
  */
 int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
@@ -60,11 +60,13 @@
 	pgd_t *pgd;
 	pmd_t *pmd;
 	pte_t pte_val;
-	struct pte_chain *pte_chain;
 
-	pte_chain = pte_chain_alloc(GFP_KERNEL);
-	if (!pte_chain)
-		goto err;
+	/*
+	 * We use page_add_file_rmap below: if install_page is
+	 * ever extended to anonymous pages, this will warn us.
+	 */
+	BUG_ON(!page_mapping(page));
+
 	pgd = pgd_offset(mm, addr);
 	spin_lock(&mm->page_table_lock);
 
@@ -81,18 +83,14 @@
 	mm->rss++;
 	flush_icache_page(vma, page);
 	set_pte(pte, mk_pte(page, prot));
-	pte_chain = page_add_rmap(page, pte, pte_chain);
+	page_add_file_rmap(page);
 	pte_val = *pte;
 	pte_unmap(pte);
 	update_mmu_cache(vma, addr, pte_val);
-	spin_unlock(&mm->page_table_lock);
-	pte_chain_free(pte_chain);
-	return 0;
 
+	err = 0;
 err_unlock:
 	spin_unlock(&mm->page_table_lock);
-	pte_chain_free(pte_chain);
-err:
 	return err;
 }
 EXPORT_SYMBOL(install_page);
@@ -159,6 +157,7 @@
 	unsigned long __prot, unsigned long pgoff, unsigned long flags)
 {
 	struct mm_struct *mm = current->mm;
+	struct address_space *mapping;
 	unsigned long end = start + size;
 	struct vm_area_struct *vma;
 	int err = -EINVAL;
@@ -188,16 +187,30 @@
 	/*
 	 * Make sure the vma is shared, that it supports prefaulting,
 	 * and that the remapped range is valid and fully within
-	 * the single existing vma:
+	 * the single existing vma.  vm_private_data is used as a
+	 * swapout cursor in a VM_NONLINEAR vma (unless VM_RESERVED
+	 * or VM_LOCKED, but VM_LOCKED could be revoked later on).
 	 */
 	if (vma && (vma->vm_flags & VM_SHARED) &&
+		(!vma->vm_private_data || (vma->vm_flags & VM_RESERVED)) &&
 		vma->vm_ops && vma->vm_ops->populate &&
 			end > start && start >= vma->vm_start &&
 				end <= vma->vm_end) {
 
 		/* Must set VM_NONLINEAR before any pages are populated. */
-		if (pgoff != ((start - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff)
+		if (pgoff != linear_page_index(vma, start) &&
+		    !(vma->vm_flags & VM_NONLINEAR)) {
+			mapping = vma->vm_file->f_mapping;
+			spin_lock(&mapping->i_mmap_lock);
+			flush_dcache_mmap_lock(mapping);
 			vma->vm_flags |= VM_NONLINEAR;
+			vma_prio_tree_remove(vma, &mapping->i_mmap);
+			vma_prio_tree_init(vma);
+			list_add_tail(&vma->shared.vm_set.list,
+					&mapping->i_mmap_nonlinear);
+			flush_dcache_mmap_unlock(mapping);
+			spin_unlock(&mapping->i_mmap_lock);
+		}
 
 		/* ->populate can take a long time, so downgrade the lock. */
 		downgrade_write(&mm->mmap_sem);
diff -Nru a/mm/hugetlb.c b/mm/hugetlb.c
--- a/mm/hugetlb.c	Tue Jun 15 22:20:42 2004
+++ b/mm/hugetlb.c	Tue Jun 15 22:20:42 2004
@@ -57,6 +57,7 @@
 	BUG_ON(page_count(page));
 
 	INIT_LIST_HEAD(&page->lru);
+	page[1].mapping = NULL;
 
 	spin_lock(&hugetlb_lock);
 	enqueue_huge_page(page);
@@ -181,7 +182,8 @@
 
 #ifdef CONFIG_SYSCTL
 int hugetlb_sysctl_handler(struct ctl_table *table, int write,
-			   struct file *file, void *buffer, size_t *length)
+			   struct file *file, void __user *buffer,
+			   size_t *length)
 {
 	proc_doulongvec_minmax(table, write, file, buffer, length);
 	max_huge_pages = set_max_huge_pages(max_huge_pages);
diff -Nru a/mm/madvise.c b/mm/madvise.c
--- a/mm/madvise.c	Tue Jun 15 22:20:38 2004
+++ b/mm/madvise.c	Tue Jun 15 22:20:38 2004
@@ -31,7 +31,9 @@
 			return -EAGAIN;
 	}
 
-	spin_lock(&mm->page_table_lock);
+	/*
+	 * vm_flags is protected by the mmap_sem held in write mode.
+	 */
 	VM_ClearReadHint(vma);
 
 	switch (behavior) {
@@ -44,7 +46,6 @@
 	default:
 		break;
 	}
-	spin_unlock(&mm->page_table_lock);
 
 	return 0;
 }
@@ -92,16 +93,14 @@
 static long madvise_dontneed(struct vm_area_struct * vma,
 			     unsigned long start, unsigned long end)
 {
-	struct zap_details details;
-
 	if (vma->vm_flags & VM_LOCKED)
 		return -EINVAL;
 
 	if (unlikely(vma->vm_flags & VM_NONLINEAR)) {
-		details.check_mapping = NULL;
-		details.nonlinear_vma = vma;
-		details.first_index = 0;
-		details.last_index = ULONG_MAX;
+		struct zap_details details = {
+			.nonlinear_vma = vma,
+			.last_index = ULONG_MAX,
+		};
 		zap_page_range(vma, start, end - start, &details);
 	} else
 		zap_page_range(vma, start, end - start, NULL);
@@ -170,18 +169,24 @@
  *  -EBADF  - map exists, but area maps something that isn't a file.
  *  -EAGAIN - a kernel resource was temporarily unavailable.
  */
-asmlinkage long sys_madvise(unsigned long start, size_t len, int behavior)
+asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
 {
 	unsigned long end;
 	struct vm_area_struct * vma;
 	int unmapped_error = 0;
 	int error = -EINVAL;
+	size_t len;
 
 	down_write(&current->mm->mmap_sem);
 
 	if (start & ~PAGE_MASK)
 		goto out;
-	len = (len + ~PAGE_MASK) & PAGE_MASK;
+	len = (len_in + ~PAGE_MASK) & PAGE_MASK;
+
+	/* Check to see whether len was rounded up from small -ve to zero */
+	if (len_in && !len)
+		goto out;
+
 	end = start + len;
 	if (end < start)
 		goto out;
diff -Nru a/mm/memory.c b/mm/memory.c
--- a/mm/memory.c	Tue Jun 15 22:20:40 2004
+++ b/mm/memory.c	Tue Jun 15 22:20:40 2004
@@ -48,7 +48,6 @@
 #include <linux/init.h>
 
 #include <asm/pgalloc.h>
-#include <asm/rmap.h>
 #include <asm/uaccess.h>
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
@@ -98,14 +97,14 @@
 
 	if (pmd_none(*dir))
 		return;
-	if (pmd_bad(*dir)) {
+	if (unlikely(pmd_bad(*dir))) {
 		pmd_ERROR(*dir);
 		pmd_clear(dir);
 		return;
 	}
 	page = pmd_page(*dir);
 	pmd_clear(dir);
-	pgtable_remove_rmap(page);
+	dec_page_state(nr_page_table_pages);
 	pte_free_tlb(tlb, page);
 }
 
@@ -116,7 +115,7 @@
 
 	if (pgd_none(*dir))
 		return;
-	if (pgd_bad(*dir)) {
+	if (unlikely(pgd_bad(*dir))) {
 		pgd_ERROR(*dir);
 		pgd_clear(dir);
 		return;
@@ -164,7 +163,7 @@
 			pte_free(new);
 			goto out;
 		}
-		pgtable_add_rmap(new, mm, address);
+		inc_page_state(nr_page_table_pages);
 		pmd_populate(mm, pmd, new);
 	}
 out:
@@ -190,7 +189,6 @@
 			pte_free_kernel(new);
 			goto out;
 		}
-		pgtable_add_rmap(virt_to_page(new), mm, address);
 		pmd_populate_kernel(mm, pmd, new);
 	}
 out:
@@ -217,20 +215,10 @@
 	unsigned long address = vma->vm_start;
 	unsigned long end = vma->vm_end;
 	unsigned long cow;
-	struct pte_chain *pte_chain = NULL;
 
 	if (is_vm_hugetlb_page(vma))
 		return copy_hugetlb_page_range(dst, src, vma);
 
-	pte_chain = pte_chain_alloc(GFP_ATOMIC | __GFP_NOWARN);
-	if (!pte_chain) {
-		spin_unlock(&dst->page_table_lock);
-		pte_chain = pte_chain_alloc(GFP_KERNEL);
-		spin_lock(&dst->page_table_lock);
-		if (!pte_chain)
-			goto nomem;
-	}
-	
 	cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
 	src_pgd = pgd_offset(src, address)-1;
 	dst_pgd = pgd_offset(dst, address)-1;
@@ -244,7 +232,7 @@
 		
 		if (pgd_none(*src_pgd))
 			goto skip_copy_pmd_range;
-		if (pgd_bad(*src_pgd)) {
+		if (unlikely(pgd_bad(*src_pgd))) {
 			pgd_ERROR(*src_pgd);
 			pgd_clear(src_pgd);
 skip_copy_pmd_range:	address = (address + PGDIR_SIZE) & PGDIR_MASK;
@@ -265,7 +253,7 @@
 		
 			if (pmd_none(*src_pmd))
 				goto skip_copy_pte_range;
-			if (pmd_bad(*src_pmd)) {
+			if (unlikely(pmd_bad(*src_pmd))) {
 				pmd_ERROR(*src_pmd);
 				pmd_clear(src_pmd);
 skip_copy_pte_range:
@@ -329,32 +317,8 @@
 				pte = pte_mkold(pte);
 				get_page(page);
 				dst->rss++;
-
 				set_pte(dst_pte, pte);
-				pte_chain = page_add_rmap(page, dst_pte,
-							pte_chain);
-				if (pte_chain)
-					goto cont_copy_pte_range_noset;
-				pte_chain = pte_chain_alloc(GFP_ATOMIC | __GFP_NOWARN);
-				if (pte_chain)
-					goto cont_copy_pte_range_noset;
-
-				/*
-				 * pte_chain allocation failed, and we need to
-				 * run page reclaim.
-				 */
-				pte_unmap_nested(src_pte);
-				pte_unmap(dst_pte);
-				spin_unlock(&src->page_table_lock);	
-				spin_unlock(&dst->page_table_lock);	
-				pte_chain = pte_chain_alloc(GFP_KERNEL);
-				spin_lock(&dst->page_table_lock);	
-				if (!pte_chain)
-					goto nomem;
-				spin_lock(&src->page_table_lock);
-				dst_pte = pte_offset_map(dst_pmd, address);
-				src_pte = pte_offset_map_nested(src_pmd,
-								address);
+				page_dup_rmap(page);
 cont_copy_pte_range_noset:
 				address += PAGE_SIZE;
 				if (address >= end) {
@@ -368,7 +332,7 @@
 			pte_unmap_nested(src_pte-1);
 			pte_unmap(dst_pte-1);
 			spin_unlock(&src->page_table_lock);
-		
+			cond_resched_lock(&dst->page_table_lock);
 cont_copy_pmd_range:
 			src_pmd++;
 			dst_pmd++;
@@ -377,10 +341,8 @@
 out_unlock:
 	spin_unlock(&src->page_table_lock);
 out:
-	pte_chain_free(pte_chain);
 	return 0;
 nomem:
-	pte_chain_free(pte_chain);
 	return -ENOMEM;
 }
 
@@ -393,7 +355,7 @@
 
 	if (pmd_none(*pmd))
 		return;
-	if (pmd_bad(*pmd)) {
+	if (unlikely(pmd_bad(*pmd))) {
 		pmd_ERROR(*pmd);
 		pmd_clear(pmd);
 		return;
@@ -403,6 +365,8 @@
 	if (offset + size > PMD_SIZE)
 		size = PMD_SIZE - offset;
 	size &= PAGE_MASK;
+	if (details && !details->check_mapping && !details->nonlinear_vma)
+		details = NULL;
 	for (offset=0; offset < size; ptep++, offset += PAGE_SIZE) {
 		pte_t pte = *ptep;
 		if (pte_none(pte))
@@ -446,7 +410,7 @@
 			if (pte_young(pte) && page_mapping(page))
 				mark_page_accessed(page);
 			tlb->freed++;
-			page_remove_rmap(page, ptep);
+			page_remove_rmap(page);
 			tlb_remove_page(tlb, page);
 			continue;
 		}
@@ -472,7 +436,7 @@
 
 	if (pgd_none(*dir))
 		return;
-	if (pgd_bad(*dir)) {
+	if (unlikely(pgd_bad(*dir))) {
 		pgd_ERROR(*dir);
 		pgd_clear(dir);
 		return;
@@ -485,7 +449,7 @@
 		zap_pte_range(tlb, pmd, address, end - address, details);
 		address = (address + PMD_SIZE) & PMD_MASK; 
 		pmd++;
-	} while (address < end);
+	} while (address && (address < end));
 }
 
 static void unmap_page_range(struct mmu_gather *tlb,
@@ -556,6 +520,7 @@
 	unsigned long tlb_start = 0;	/* For tlb_finish_mmu */
 	int tlb_start_valid = 0;
 	int ret = 0;
+	int atomic = details && details->atomic;
 
 	for ( ; vma && vma->vm_start < end_addr; vma = vma->vm_next) {
 		unsigned long start;
@@ -593,7 +558,7 @@
 			zap_bytes -= block;
 			if ((long)zap_bytes > 0)
 				continue;
-			if (need_resched()) {
+			if (!atomic && need_resched()) {
 				int fullmm = tlb_is_full_mm(*tlbp);
 				tlb_finish_mmu(*tlbp, tlb_start, start);
 				cond_resched_lock(&mm->page_table_lock);
@@ -621,8 +586,6 @@
 	unsigned long end = address + size;
 	unsigned long nr_accounted = 0;
 
-	might_sleep();
-
 	if (is_vm_hugetlb_page(vma)) {
 		zap_hugepage_range(vma, address, size);
 		return;
@@ -654,7 +617,7 @@
 		return page;
 
 	pgd = pgd_offset(mm, address);
-	if (pgd_none(*pgd) || pgd_bad(*pgd))
+	if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
 		goto out;
 
 	pmd = pmd_offset(pgd, address);
@@ -662,7 +625,7 @@
 		goto out;
 	if (pmd_huge(*pmd))
 		return follow_huge_pmd(mm, address, pmd, write);
-	if (pmd_bad(*pmd))
+	if (unlikely(pmd_bad(*pmd)))
 		goto out;
 
 	ptep = pte_offset_map(pmd, address);
@@ -674,15 +637,11 @@
 	if (pte_present(pte)) {
 		if (write && !pte_write(pte))
 			goto out;
-		if (write && !pte_dirty(pte)) {
-			struct page *page = pte_page(pte);
-			if (!PageDirty(page))
-				set_page_dirty(page);
-		}
 		pfn = pte_pfn(pte);
 		if (pfn_valid(pfn)) {
-			struct page *page = pfn_to_page(pfn);
-			
+			page = pfn_to_page(pfn);
+			if (write && !pte_dirty(pte) && !PageDirty(page))
+				set_page_dirty(page);
 			mark_page_accessed(page);
 			return page;
 		}
@@ -719,12 +678,12 @@
 
 	/* Check if page directory entry exists. */
 	pgd = pgd_offset(mm, address);
-	if (pgd_none(*pgd) || pgd_bad(*pgd))
+	if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
 		return 1;
 
 	/* Check if page middle directory entry exists. */
 	pmd = pmd_offset(pgd, address);
-	if (pmd_none(*pmd) || pmd_bad(*pmd))
+	if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
 		return 1;
 
 	/* There is a pte slot for 'address' in 'mm'. */
@@ -1070,7 +1029,6 @@
 {
 	struct page *old_page, *new_page;
 	unsigned long pfn = pte_pfn(pte);
-	struct pte_chain *pte_chain;
 	pte_t entry;
 
 	if (unlikely(!pfn_valid(pfn))) {
@@ -1094,7 +1052,7 @@
 			flush_cache_page(vma, address);
 			entry = maybe_mkwrite(pte_mkyoung(pte_mkdirty(pte)),
 					      vma);
-			ptep_establish(vma, address, page_table, entry);
+			ptep_set_access_flags(vma, address, page_table, entry, 1);
 			update_mmu_cache(vma, address, entry);
 			pte_unmap(page_table);
 			spin_unlock(&mm->page_table_lock);
@@ -1109,10 +1067,9 @@
 	page_cache_get(old_page);
 	spin_unlock(&mm->page_table_lock);
 
-	pte_chain = pte_chain_alloc(GFP_KERNEL);
-	if (!pte_chain)
-		goto no_pte_chain;
-	new_page = alloc_page(GFP_HIGHUSER);
+	if (unlikely(anon_vma_prepare(vma)))
+		goto no_new_page;
+	new_page = alloc_page_vma(GFP_HIGHUSER, vma, address);
 	if (!new_page)
 		goto no_new_page;
 	copy_cow_page(old_page,new_page,address);
@@ -1122,13 +1079,14 @@
 	 */
 	spin_lock(&mm->page_table_lock);
 	page_table = pte_offset_map(pmd, address);
-	if (pte_same(*page_table, pte)) {
+	if (likely(pte_same(*page_table, pte))) {
 		if (PageReserved(old_page))
 			++mm->rss;
-		page_remove_rmap(old_page, page_table);
+		else
+			page_remove_rmap(old_page);
 		break_cow(vma, new_page, address, page_table);
-		pte_chain = page_add_rmap(new_page, page_table, pte_chain);
 		lru_cache_add_active(new_page);
+		page_add_anon_rmap(new_page, vma, address);
 
 		/* Free the old page.. */
 		new_page = old_page;
@@ -1137,12 +1095,9 @@
 	page_cache_release(new_page);
 	page_cache_release(old_page);
 	spin_unlock(&mm->page_table_lock);
-	pte_chain_free(pte_chain);
 	return VM_FAULT_MINOR;
 
 no_new_page:
-	pte_chain_free(pte_chain);
-no_pte_chain:
 	page_cache_release(old_page);
 	return VM_FAULT_OOM;
 }
@@ -1150,25 +1105,18 @@
 /*
  * Helper function for unmap_mapping_range().
  */
-static void unmap_mapping_range_list(struct list_head *head,
-				     struct zap_details *details)
+static inline void unmap_mapping_range_list(struct prio_tree_root *root,
+					    struct zap_details *details)
 {
-	struct vm_area_struct *vma;
+	struct vm_area_struct *vma = NULL;
+	struct prio_tree_iter iter;
 	pgoff_t vba, vea, zba, zea;
 
-	list_for_each_entry(vma, head, shared) {
-		if (unlikely(vma->vm_flags & VM_NONLINEAR)) {
-			details->nonlinear_vma = vma;
-			zap_page_range(vma, vma->vm_start,
-				vma->vm_end - vma->vm_start, details);
-			details->nonlinear_vma = NULL;
-			continue;
-		}
+	while ((vma = vma_prio_tree_next(vma, root, &iter,
+			details->first_index, details->last_index)) != NULL) {
 		vba = vma->vm_pgoff;
 		vea = vba + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) - 1;
 		/* Assume for now that PAGE_CACHE_SHIFT == PAGE_SHIFT */
-		if (vba > details->last_index || vea < details->first_index)
-			continue;	/* Mapping disjoint from hole. */
 		zba = details->first_index;
 		if (zba < vba)
 			zba = vba;
@@ -1177,8 +1125,7 @@
 			zea = vea;
 		zap_page_range(vma,
 			((zba - vba) << PAGE_SHIFT) + vma->vm_start,
-			(zea - zba + 1) << PAGE_SHIFT,
-			details->check_mapping? details: NULL);
+			(zea - zba + 1) << PAGE_SHIFT, details);
 	}
 }
 
@@ -1199,7 +1146,7 @@
  * but 0 when invalidating pagecache, don't throw away private data.
  */
 void unmap_mapping_range(struct address_space *mapping,
-	loff_t const holebegin, loff_t const holelen, int even_cows)
+		loff_t const holebegin, loff_t const holelen, int even_cows)
 {
 	struct zap_details details;
 	pgoff_t hba = holebegin >> PAGE_SHIFT;
@@ -1217,21 +1164,33 @@
 	details.nonlinear_vma = NULL;
 	details.first_index = hba;
 	details.last_index = hba + hlen - 1;
+	details.atomic = 1;	/* A spinlock is held */
 	if (details.last_index < details.first_index)
 		details.last_index = ULONG_MAX;
 
-	down(&mapping->i_shared_sem);
+	spin_lock(&mapping->i_mmap_lock);
 	/* Protect against page fault */
 	atomic_inc(&mapping->truncate_count);
-	if (unlikely(!list_empty(&mapping->i_mmap)))
-		unmap_mapping_range_list(&mapping->i_mmap, &details);
 
-	/* Don't waste time to check mapping on fully shared vmas */
-	details.check_mapping = NULL;
+	if (unlikely(!prio_tree_empty(&mapping->i_mmap)))
+		unmap_mapping_range_list(&mapping->i_mmap, &details);
 
-	if (unlikely(!list_empty(&mapping->i_mmap_shared)))
-		unmap_mapping_range_list(&mapping->i_mmap_shared, &details);
-	up(&mapping->i_shared_sem);
+	/*
+	 * In nonlinear VMAs there is no correspondence between virtual address
+	 * offset and file offset.  So we must perform an exhaustive search
+	 * across *all* the pages in each nonlinear VMA, not just the pages
+	 * whose virtual address lies outside the file truncation point.
+	 */
+	if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) {
+		struct vm_area_struct *vma;
+		list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
+						shared.vm_set.list) {
+			details.nonlinear_vma = vma;
+			zap_page_range(vma, vma->vm_start,
+				vma->vm_end - vma->vm_start, &details);
+		}
+	}
+	spin_unlock(&mapping->i_mmap_lock);
 }
 EXPORT_SYMBOL(unmap_mapping_range);
 
@@ -1280,9 +1239,17 @@
  * (1 << page_cluster) entries in the swap area. This method is chosen
  * because it doesn't cost us any seek time.  We also make sure to queue
  * the 'original' request together with the readahead ones...  
+ *
+ * This has been extended to use the NUMA policies from the mm triggering
+ * the readahead.
+ *
+ * Caller must hold down_read on the vma->vm_mm if vma is not NULL.
  */
-void swapin_readahead(swp_entry_t entry)
+void swapin_readahead(swp_entry_t entry, unsigned long addr,struct vm_area_struct *vma)
 {
+#ifdef CONFIG_NUMA
+	struct vm_area_struct *next_vma = vma ? vma->vm_next : NULL;
+#endif
 	int i, num;
 	struct page *new_page;
 	unsigned long offset;
@@ -1294,10 +1261,31 @@
 	for (i = 0; i < num; offset++, i++) {
 		/* Ok, do the async read-ahead now */
 		new_page = read_swap_cache_async(swp_entry(swp_type(entry),
-						offset));
+							   offset), vma, addr);
 		if (!new_page)
 			break;
 		page_cache_release(new_page);
+#ifdef CONFIG_NUMA
+		/*
+		 * Find the next applicable VMA for the NUMA policy.
+		 */
+		addr += PAGE_SIZE;
+		if (addr == 0)
+			vma = NULL;
+		if (vma) {
+			if (addr >= vma->vm_end) {
+				vma = next_vma;
+				next_vma = vma ? vma->vm_next : NULL;
+			}
+			if (vma && addr < vma->vm_start)
+				vma = NULL;
+		} else {
+			if (next_vma && addr >= next_vma->vm_start) {
+				vma = next_vma;
+				next_vma = vma->vm_next;
+			}
+		}
+#endif
 	}
 	lru_add_drain();	/* Push any new pages onto the LRU now */
 }
@@ -1314,14 +1302,13 @@
 	swp_entry_t entry = pte_to_swp_entry(orig_pte);
 	pte_t pte;
 	int ret = VM_FAULT_MINOR;
-	struct pte_chain *pte_chain = NULL;
 
 	pte_unmap(page_table);
 	spin_unlock(&mm->page_table_lock);
 	page = lookup_swap_cache(entry);
 	if (!page) {
-		swapin_readahead(entry);
-		page = read_swap_cache_async(entry);
+ 		swapin_readahead(entry, address, vma);
+ 		page = read_swap_cache_async(entry, vma, address);
 		if (!page) {
 			/*
 			 * Back out if somebody else faulted in this pte while
@@ -1329,7 +1316,7 @@
 			 */
 			spin_lock(&mm->page_table_lock);
 			page_table = pte_offset_map(pmd, address);
-			if (pte_same(*page_table, orig_pte))
+			if (likely(pte_same(*page_table, orig_pte)))
 				ret = VM_FAULT_OOM;
 			else
 				ret = VM_FAULT_MINOR;
@@ -1344,11 +1331,6 @@
 	}
 
 	mark_page_accessed(page);
-	pte_chain = pte_chain_alloc(GFP_KERNEL);
-	if (!pte_chain) {
-		ret = VM_FAULT_OOM;
-		goto out;
-	}
 	lock_page(page);
 
 	/*
@@ -1357,7 +1339,7 @@
 	 */
 	spin_lock(&mm->page_table_lock);
 	page_table = pte_offset_map(pmd, address);
-	if (!pte_same(*page_table, orig_pte)) {
+	if (unlikely(!pte_same(*page_table, orig_pte))) {
 		pte_unmap(page_table);
 		spin_unlock(&mm->page_table_lock);
 		unlock_page(page);
@@ -1374,20 +1356,28 @@
 
 	mm->rss++;
 	pte = mk_pte(page, vma->vm_page_prot);
-	if (write_access && can_share_swap_page(page))
+	if (write_access && can_share_swap_page(page)) {
 		pte = maybe_mkwrite(pte_mkdirty(pte), vma);
+		write_access = 0;
+	}
 	unlock_page(page);
 
 	flush_icache_page(vma, page);
 	set_pte(page_table, pte);
-	pte_chain = page_add_rmap(page, page_table, pte_chain);
+	page_add_anon_rmap(page, vma, address);
+
+	if (write_access) {
+		if (do_wp_page(mm, vma, address,
+				page_table, pmd, pte) == VM_FAULT_OOM)
+			ret = VM_FAULT_OOM;
+		goto out;
+	}
 
 	/* No need to invalidate - it was non-present before */
 	update_mmu_cache(vma, address, pte);
 	pte_unmap(page_table);
 	spin_unlock(&mm->page_table_lock);
 out:
-	pte_chain_free(pte_chain);
 	return ret;
 }
 
@@ -1403,20 +1393,7 @@
 {
 	pte_t entry;
 	struct page * page = ZERO_PAGE(addr);
-	struct pte_chain *pte_chain;
-	int ret;
 
-	pte_chain = pte_chain_alloc(GFP_ATOMIC | __GFP_NOWARN);
-	if (!pte_chain) {
-		pte_unmap(page_table);
-		spin_unlock(&mm->page_table_lock);
-		pte_chain = pte_chain_alloc(GFP_KERNEL);
-		if (!pte_chain)
-			goto no_mem;
-		spin_lock(&mm->page_table_lock);
-		page_table = pte_offset_map(pmd, addr);
-	}
-		
 	/* Read-only mapping of ZERO_PAGE. */
 	entry = pte_wrprotect(mk_pte(ZERO_PAGE(addr), vma->vm_page_prot));
 
@@ -1426,7 +1403,9 @@
 		pte_unmap(page_table);
 		spin_unlock(&mm->page_table_lock);
 
-		page = alloc_page(GFP_HIGHUSER);
+		if (unlikely(anon_vma_prepare(vma)))
+			goto no_mem;
+		page = alloc_page_vma(GFP_HIGHUSER, vma, addr);
 		if (!page)
 			goto no_mem;
 		clear_user_highpage(page, addr);
@@ -1438,7 +1417,6 @@
 			pte_unmap(page_table);
 			page_cache_release(page);
 			spin_unlock(&mm->page_table_lock);
-			ret = VM_FAULT_MINOR;
 			goto out;
 		}
 		mm->rss++;
@@ -1447,24 +1425,19 @@
 				      vma);
 		lru_cache_add_active(page);
 		mark_page_accessed(page);
+		page_add_anon_rmap(page, vma, addr);
 	}
 
 	set_pte(page_table, entry);
-	/* ignores ZERO_PAGE */
-	pte_chain = page_add_rmap(page, page_table, pte_chain);
 	pte_unmap(page_table);
 
 	/* No need to invalidate - it was non-present before */
 	update_mmu_cache(vma, addr, entry);
 	spin_unlock(&mm->page_table_lock);
-	ret = VM_FAULT_MINOR;
-	goto out;
-
-no_mem:
-	ret = VM_FAULT_OOM;
 out:
-	pte_chain_free(pte_chain);
-	return ret;
+	return VM_FAULT_MINOR;
+no_mem:
+	return VM_FAULT_OOM;
 }
 
 /*
@@ -1486,9 +1459,9 @@
 	struct page * new_page;
 	struct address_space *mapping = NULL;
 	pte_t entry;
-	struct pte_chain *pte_chain;
 	int sequence = 0;
 	int ret = VM_FAULT_MINOR;
+	int anon = 0;
 
 	if (!vma->vm_ops || !vma->vm_ops->nopage)
 		return do_anonymous_page(mm, vma, page_table,
@@ -1510,21 +1483,21 @@
 	if (new_page == NOPAGE_OOM)
 		return VM_FAULT_OOM;
 
-	pte_chain = pte_chain_alloc(GFP_KERNEL);
-	if (!pte_chain)
-		goto oom;
-
 	/*
 	 * Should we do an early C-O-W break?
 	 */
 	if (write_access && !(vma->vm_flags & VM_SHARED)) {
-		struct page * page = alloc_page(GFP_HIGHUSER);
+		struct page *page;
+
+		if (unlikely(anon_vma_prepare(vma)))
+			goto oom;
+		page = alloc_page_vma(GFP_HIGHUSER, vma, address);
 		if (!page)
 			goto oom;
 		copy_user_highpage(page, new_page, address);
 		page_cache_release(new_page);
-		lru_cache_add_active(page);
 		new_page = page;
+		anon = 1;
 	}
 
 	spin_lock(&mm->page_table_lock);
@@ -1538,7 +1511,6 @@
 		sequence = atomic_read(&mapping->truncate_count);
 		spin_unlock(&mm->page_table_lock);
 		page_cache_release(new_page);
-		pte_chain_free(pte_chain);
 		goto retry;
 	}
 	page_table = pte_offset_map(pmd, address);
@@ -1562,7 +1534,11 @@
 		if (write_access)
 			entry = maybe_mkwrite(pte_mkdirty(entry), vma);
 		set_pte(page_table, entry);
-		pte_chain = page_add_rmap(new_page, page_table, pte_chain);
+		if (anon) {
+			lru_cache_add_active(new_page);
+			page_add_anon_rmap(new_page, vma, address);
+		} else
+			page_add_file_rmap(new_page);
 		pte_unmap(page_table);
 	} else {
 		/* One of our sibling threads was faster, back out. */
@@ -1575,13 +1551,12 @@
 	/* no need to invalidate: a not-present page shouldn't be cached */
 	update_mmu_cache(vma, address, entry);
 	spin_unlock(&mm->page_table_lock);
-	goto out;
+out:
+	return ret;
 oom:
 	page_cache_release(new_page);
 	ret = VM_FAULT_OOM;
-out:
-	pte_chain_free(pte_chain);
-	return ret;
+	goto out;
 }
 
 /*
@@ -1667,7 +1642,7 @@
 		entry = pte_mkdirty(entry);
 	}
 	entry = pte_mkyoung(entry);
-	ptep_establish(vma, address, pte, entry);
+	ptep_set_access_flags(vma, address, pte, entry, write_access);
 	update_mmu_cache(vma, address, entry);
 	pte_unmap(pte);
 	spin_unlock(&mm->page_table_lock);
diff -Nru a/mm/mempolicy.c b/mm/mempolicy.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/mm/mempolicy.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,1016 @@
+/*
+ * Simple NUMA memory policy for the Linux kernel.
+ *
+ * Copyright 2003,2004 Andi Kleen, SuSE Labs.
+ * Subject to the GNU Public License, version 2.
+ *
+ * NUMA policy allows the user to give hints in which node(s) memory should
+ * be allocated.
+ *
+ * Support four policies per VMA and per process:
+ *
+ * The VMA policy has priority over the process policy for a page fault.
+ *
+ * interleave     Allocate memory interleaved over a set of nodes,
+ *                with normal fallback if it fails.
+ *                For VMA based allocations this interleaves based on the
+ *                offset into the backing object or offset into the mapping
+ *                for anonymous memory. For process policy an process counter
+ *                is used.
+ * bind           Only allocate memory on a specific set of nodes,
+ *                no fallback.
+ * preferred       Try a specific node first before normal fallback.
+ *                As a special case node -1 here means do the allocation
+ *                on the local CPU. This is normally identical to default,
+ *                but useful to set in a VMA when you have a non default
+ *                process policy.
+ * default        Allocate on the local node first, or when on a VMA
+ *                use the process policy. This is what Linux always did
+ *				   in a NUMA aware kernel and still does by, ahem, default.
+ *
+ * The process policy is applied for most non interrupt memory allocations
+ * in that process' context. Interrupts ignore the policies and always
+ * try to allocate on the local CPU. The VMA policy is only applied for memory
+ * allocations for a VMA in the VM.
+ *
+ * Currently there are a few corner cases in swapping where the policy
+ * is not applied, but the majority should be handled. When process policy
+ * is used it is not remembered over swap outs/swap ins.
+ *
+ * Only the highest zone in the zone hierarchy gets policied. Allocations
+ * requesting a lower zone just use default policy. This implies that
+ * on systems with highmem kernel lowmem allocation don't get policied.
+ * Same with GFP_DMA allocations.
+ *
+ * For shmfs/tmpfs/hugetlbfs shared memory the policy is shared between
+ * all users and remembered even when nobody has memory mapped.
+ */
+
+/* Notebook:
+   fix mmap readahead to honour policy and enable policy for any page cache
+   object
+   statistics for bigpages
+   global policy for page cache? currently it uses process policy. Requires
+   first item above.
+   handle mremap for shared memory (currently ignored for the policy)
+   grows down?
+   make bind policy root only? It can trigger oom much faster and the
+   kernel is not always grateful with that.
+   could replace all the switch()es with a mempolicy_ops structure.
+*/
+
+#include <linux/mempolicy.h>
+#include <linux/mm.h>
+#include <linux/highmem.h>
+#include <linux/hugetlb.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/gfp.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+#include <linux/compat.h>
+#include <linux/mempolicy.h>
+#include <asm/uaccess.h>
+
+static kmem_cache_t *policy_cache;
+static kmem_cache_t *sn_cache;
+
+#define PDprintk(fmt...)
+
+/* Highest zone. An specific allocation for a zone below that is not
+   policied. */
+static int policy_zone;
+
+static struct mempolicy default_policy = {
+	.refcnt = ATOMIC_INIT(1), /* never free it */
+	.policy = MPOL_DEFAULT,
+};
+
+/* Check if all specified nodes are online */
+static int nodes_online(unsigned long *nodes)
+{
+	DECLARE_BITMAP(offline, MAX_NUMNODES);
+
+	bitmap_copy(offline, node_online_map, MAX_NUMNODES);
+	if (bitmap_empty(offline, MAX_NUMNODES))
+		set_bit(0, offline);
+	bitmap_complement(offline, MAX_NUMNODES);
+	bitmap_and(offline, offline, nodes, MAX_NUMNODES);
+	if (!bitmap_empty(offline, MAX_NUMNODES))
+		return -EINVAL;
+	return 0;
+}
+
+/* Do sanity checking on a policy */
+static int mpol_check_policy(int mode, unsigned long *nodes)
+{
+	int empty = bitmap_empty(nodes, MAX_NUMNODES);
+
+	switch (mode) {
+	case MPOL_DEFAULT:
+		if (!empty)
+			return -EINVAL;
+		break;
+	case MPOL_BIND:
+	case MPOL_INTERLEAVE:
+		/* Preferred will only use the first bit, but allow
+		   more for now. */
+		if (empty)
+			return -EINVAL;
+		break;
+	}
+	return nodes_online(nodes);
+}
+
+/* Copy a node mask from user space. */
+static int get_nodes(unsigned long *nodes, unsigned long __user *nmask,
+		     unsigned long maxnode, int mode)
+{
+	unsigned long k;
+	unsigned long nlongs;
+	unsigned long endmask;
+
+	--maxnode;
+	nlongs = BITS_TO_LONGS(maxnode);
+	if ((maxnode % BITS_PER_LONG) == 0)
+		endmask = ~0UL;
+	else
+		endmask = (1UL << (maxnode % BITS_PER_LONG)) - 1;
+
+	/* When the user specified more nodes than supported just check
+	   if the non supported part is all zero. */
+	if (nmask && nlongs > BITS_TO_LONGS(MAX_NUMNODES)) {
+		for (k = BITS_TO_LONGS(MAX_NUMNODES); k < nlongs; k++) {
+			unsigned long t;
+			if (get_user(t,  nmask + k))
+				return -EFAULT;
+			if (k == nlongs - 1) {
+				if (t & endmask)
+					return -EINVAL;
+			} else if (t)
+				return -EINVAL;
+		}
+		nlongs = BITS_TO_LONGS(MAX_NUMNODES);
+		endmask = ~0UL;
+	}
+
+	bitmap_zero(nodes, MAX_NUMNODES);
+	if (nmask && copy_from_user(nodes, nmask, nlongs*sizeof(unsigned long)))
+		return -EFAULT;
+	nodes[nlongs-1] &= endmask;
+	return mpol_check_policy(mode, nodes);
+}
+
+/* Generate a custom zonelist for the BIND policy. */
+static struct zonelist *bind_zonelist(unsigned long *nodes)
+{
+	struct zonelist *zl;
+	int num, max, nd;
+
+	max = 1 + MAX_NR_ZONES * bitmap_weight(nodes, MAX_NUMNODES);
+	zl = kmalloc(sizeof(void *) * max, GFP_KERNEL);
+	if (!zl)
+		return NULL;
+	num = 0;
+	for (nd = find_first_bit(nodes, MAX_NUMNODES);
+	     nd < MAX_NUMNODES;
+	     nd = find_next_bit(nodes, MAX_NUMNODES, 1+nd)) {
+		int k;
+		for (k = MAX_NR_ZONES-1; k >= 0; k--) {
+			struct zone *z = &NODE_DATA(nd)->node_zones[k];
+			if (!z->present_pages)
+				continue;
+			zl->zones[num++] = z;
+			if (k > policy_zone)
+				policy_zone = k;
+		}
+	}
+	BUG_ON(num >= max);
+	zl->zones[num] = NULL;
+	return zl;
+}
+
+/* Create a new policy */
+static struct mempolicy *mpol_new(int mode, unsigned long *nodes)
+{
+	struct mempolicy *policy;
+
+	PDprintk("setting mode %d nodes[0] %lx\n", mode, nodes[0]);
+	if (mode == MPOL_DEFAULT)
+		return NULL;
+	policy = kmem_cache_alloc(policy_cache, GFP_KERNEL);
+	if (!policy)
+		return ERR_PTR(-ENOMEM);
+	atomic_set(&policy->refcnt, 1);
+	switch (mode) {
+	case MPOL_INTERLEAVE:
+		bitmap_copy(policy->v.nodes, nodes, MAX_NUMNODES);
+		break;
+	case MPOL_PREFERRED:
+		policy->v.preferred_node = find_first_bit(nodes, MAX_NUMNODES);
+		if (policy->v.preferred_node >= MAX_NUMNODES)
+			policy->v.preferred_node = -1;
+		break;
+	case MPOL_BIND:
+		policy->v.zonelist = bind_zonelist(nodes);
+		if (policy->v.zonelist == NULL) {
+			kmem_cache_free(policy_cache, policy);
+			return ERR_PTR(-ENOMEM);
+		}
+		break;
+	}
+	policy->policy = mode;
+	return policy;
+}
+
+/* Ensure all existing pages follow the policy. */
+static int
+verify_pages(unsigned long addr, unsigned long end, unsigned long *nodes)
+{
+	while (addr < end) {
+		struct page *p;
+		pte_t *pte;
+		pmd_t *pmd;
+		pgd_t *pgd = pgd_offset_k(addr);
+		if (pgd_none(*pgd)) {
+			addr = (addr + PGDIR_SIZE) & PGDIR_MASK;
+			continue;
+		}
+		pmd = pmd_offset(pgd, addr);
+		if (pmd_none(*pmd)) {
+			addr = (addr + PMD_SIZE) & PMD_MASK;
+			continue;
+		}
+		p = NULL;
+		pte = pte_offset_map(pmd, addr);
+		if (pte_present(*pte))
+			p = pte_page(*pte);
+		pte_unmap(pte);
+		if (p) {
+			unsigned nid = page_to_nid(p);
+			if (!test_bit(nid, nodes))
+				return -EIO;
+		}
+		addr += PAGE_SIZE;
+	}
+	return 0;
+}
+
+/* Step 1: check the range */
+static struct vm_area_struct *
+check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
+	    unsigned long *nodes, unsigned long flags)
+{
+	int err;
+	struct vm_area_struct *first, *vma, *prev;
+
+	first = find_vma(mm, start);
+	if (!first)
+		return ERR_PTR(-EFAULT);
+	prev = NULL;
+	for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) {
+		if (!vma->vm_next && vma->vm_end < end)
+			return ERR_PTR(-EFAULT);
+		if (prev && prev->vm_end < vma->vm_start)
+			return ERR_PTR(-EFAULT);
+		if ((flags & MPOL_MF_STRICT) && !is_vm_hugetlb_page(vma)) {
+			err = verify_pages(vma->vm_start, vma->vm_end, nodes);
+			if (err) {
+				first = ERR_PTR(err);
+				break;
+			}
+		}
+		prev = vma;
+	}
+	return first;
+}
+
+/* Apply policy to a single VMA */
+static int policy_vma(struct vm_area_struct *vma, struct mempolicy *new)
+{
+	int err = 0;
+	struct mempolicy *old = vma->vm_policy;
+
+	PDprintk("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
+		 vma->vm_start, vma->vm_end, vma->vm_pgoff,
+		 vma->vm_ops, vma->vm_file,
+		 vma->vm_ops ? vma->vm_ops->set_policy : NULL);
+
+	if (vma->vm_ops && vma->vm_ops->set_policy)
+		err = vma->vm_ops->set_policy(vma, new);
+	if (!err) {
+		mpol_get(new);
+		vma->vm_policy = new;
+		mpol_free(old);
+	}
+	return err;
+}
+
+/* Step 2: apply policy to a range and do splits. */
+static int mbind_range(struct vm_area_struct *vma, unsigned long start,
+		       unsigned long end, struct mempolicy *new)
+{
+	struct vm_area_struct *next;
+	int err;
+
+	err = 0;
+	for (; vma && vma->vm_start < end; vma = next) {
+		next = vma->vm_next;
+		if (vma->vm_start < start)
+			err = split_vma(vma->vm_mm, vma, start, 1);
+		if (!err && vma->vm_end > end)
+			err = split_vma(vma->vm_mm, vma, end, 0);
+		if (!err)
+			err = policy_vma(vma, new);
+		if (err)
+			break;
+	}
+	return err;
+}
+
+/* Change policy for a memory range */
+asmlinkage long sys_mbind(unsigned long start, unsigned long len,
+			  unsigned long mode,
+			  unsigned long __user *nmask, unsigned long maxnode,
+			  unsigned flags)
+{
+	struct vm_area_struct *vma;
+	struct mm_struct *mm = current->mm;
+	struct mempolicy *new;
+	unsigned long end;
+	DECLARE_BITMAP(nodes, MAX_NUMNODES);
+	int err;
+
+	if ((flags & ~(unsigned long)(MPOL_MF_STRICT)) || mode > MPOL_MAX)
+		return -EINVAL;
+	if (start & ~PAGE_MASK)
+		return -EINVAL;
+	if (mode == MPOL_DEFAULT)
+		flags &= ~MPOL_MF_STRICT;
+	len = (len + PAGE_SIZE - 1) & PAGE_MASK;
+	end = start + len;
+	if (end < start)
+		return -EINVAL;
+	if (end == start)
+		return 0;
+
+	err = get_nodes(nodes, nmask, maxnode, mode);
+	if (err)
+		return err;
+
+	new = mpol_new(mode, nodes);
+	if (IS_ERR(new))
+		return PTR_ERR(new);
+
+	PDprintk("mbind %lx-%lx mode:%ld nodes:%lx\n",start,start+len,
+			mode,nodes[0]);
+
+	down_write(&mm->mmap_sem);
+	vma = check_range(mm, start, end, nodes, flags);
+	err = PTR_ERR(vma);
+	if (!IS_ERR(vma))
+		err = mbind_range(vma, start, end, new);
+	up_write(&mm->mmap_sem);
+	mpol_free(new);
+	return err;
+}
+
+/* Set the process memory policy */
+asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask,
+				   unsigned long maxnode)
+{
+	int err;
+	struct mempolicy *new;
+	DECLARE_BITMAP(nodes, MAX_NUMNODES);
+
+	if (mode > MPOL_MAX)
+		return -EINVAL;
+	err = get_nodes(nodes, nmask, maxnode, mode);
+	if (err)
+		return err;
+	new = mpol_new(mode, nodes);
+	if (IS_ERR(new))
+		return PTR_ERR(new);
+	mpol_free(current->mempolicy);
+	current->mempolicy = new;
+	if (new && new->policy == MPOL_INTERLEAVE)
+		current->il_next = find_first_bit(new->v.nodes, MAX_NUMNODES);
+	return 0;
+}
+
+/* Fill a zone bitmap for a policy */
+static void get_zonemask(struct mempolicy *p, unsigned long *nodes)
+{
+	int i;
+
+	bitmap_zero(nodes, MAX_NUMNODES);
+	switch (p->policy) {
+	case MPOL_BIND:
+		for (i = 0; p->v.zonelist->zones[i]; i++)
+			__set_bit(p->v.zonelist->zones[i]->zone_pgdat->node_id, nodes);
+		break;
+	case MPOL_DEFAULT:
+		break;
+	case MPOL_INTERLEAVE:
+		bitmap_copy(nodes, p->v.nodes, MAX_NUMNODES);
+		break;
+	case MPOL_PREFERRED:
+		/* or use current node instead of online map? */
+		if (p->v.preferred_node < 0)
+			bitmap_copy(nodes, node_online_map, MAX_NUMNODES);
+		else
+			__set_bit(p->v.preferred_node, nodes);
+		break;
+	default:
+		BUG();
+	}
+}
+
+static int lookup_node(struct mm_struct *mm, unsigned long addr)
+{
+	struct page *p;
+	int err;
+
+	err = get_user_pages(current, mm, addr & PAGE_MASK, 1, 0, 0, &p, NULL);
+	if (err >= 0) {
+		err = page_zone(p)->zone_pgdat->node_id;
+		put_page(p);
+	}
+	return err;
+}
+
+/* Copy a kernel node mask to user space */
+static int copy_nodes_to_user(unsigned long __user *mask, unsigned long maxnode,
+			      void *nodes, unsigned nbytes)
+{
+	unsigned long copy = ALIGN(maxnode-1, 64) / 8;
+
+	if (copy > nbytes) {
+		if (copy > PAGE_SIZE)
+			return -EINVAL;
+		if (clear_user((char __user *)mask + nbytes, copy - nbytes))
+			return -EFAULT;
+		copy = nbytes;
+	}
+	return copy_to_user(mask, nodes, copy) ? -EFAULT : 0;
+}
+
+/* Retrieve NUMA policy */
+asmlinkage long sys_get_mempolicy(int __user *policy,
+				  unsigned long __user *nmask,
+				  unsigned long maxnode,
+				  unsigned long addr, unsigned long flags)
+{
+	int err, pval;
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma = NULL;
+	struct mempolicy *pol = current->mempolicy;
+
+	if (flags & ~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR))
+		return -EINVAL;
+	if (nmask != NULL && maxnode < numnodes)
+		return -EINVAL;
+	if (flags & MPOL_F_ADDR) {
+		down_read(&mm->mmap_sem);
+		vma = find_vma_intersection(mm, addr, addr+1);
+		if (!vma) {
+			up_read(&mm->mmap_sem);
+			return -EFAULT;
+		}
+		if (vma->vm_ops && vma->vm_ops->get_policy)
+			pol = vma->vm_ops->get_policy(vma, addr);
+		else
+			pol = vma->vm_policy;
+	} else if (addr)
+		return -EINVAL;
+
+	if (!pol)
+		pol = &default_policy;
+
+	if (flags & MPOL_F_NODE) {
+		if (flags & MPOL_F_ADDR) {
+			err = lookup_node(mm, addr);
+			if (err < 0)
+				goto out;
+			pval = err;
+		} else if (pol == current->mempolicy &&
+				pol->policy == MPOL_INTERLEAVE) {
+			pval = current->il_next;
+		} else {
+			err = -EINVAL;
+			goto out;
+		}
+	} else
+		pval = pol->policy;
+
+	err = -EFAULT;
+	if (policy && put_user(pval, policy))
+		goto out;
+
+	err = 0;
+	if (nmask) {
+		DECLARE_BITMAP(nodes, MAX_NUMNODES);
+		get_zonemask(pol, nodes);
+		err = copy_nodes_to_user(nmask, maxnode, nodes, sizeof(nodes));
+	}
+
+ out:
+	if (vma)
+		up_read(&current->mm->mmap_sem);
+	return err;
+}
+
+#ifdef CONFIG_COMPAT
+/* The other functions are compatible */
+asmlinkage long compat_get_mempolicy(int __user *policy,
+				  unsigned __user *nmask, unsigned  maxnode,
+				  unsigned addr, unsigned  flags)
+{
+	long err;
+	unsigned long __user *nm = NULL;
+	if (nmask)
+		nm = compat_alloc_user_space(ALIGN(maxnode-1, 64) / 8);
+	err = sys_get_mempolicy(policy, nm, maxnode, addr, flags);
+	if (!err && copy_in_user(nmask, nm, ALIGN(maxnode-1, 32)/8))
+		err = -EFAULT;
+	return err;
+}
+#endif
+
+/* Return effective policy for a VMA */
+static struct mempolicy *
+get_vma_policy(struct vm_area_struct *vma, unsigned long addr)
+{
+	struct mempolicy *pol = current->mempolicy;
+
+	if (vma) {
+		if (vma->vm_ops && vma->vm_ops->get_policy)
+		        pol = vma->vm_ops->get_policy(vma, addr);
+		else if (vma->vm_policy &&
+				vma->vm_policy->policy != MPOL_DEFAULT)
+			pol = vma->vm_policy;
+	}
+	if (!pol)
+		pol = &default_policy;
+	return pol;
+}
+
+/* Return a zonelist representing a mempolicy */
+static struct zonelist *zonelist_policy(unsigned gfp, struct mempolicy *policy)
+{
+	int nd;
+
+	switch (policy->policy) {
+	case MPOL_PREFERRED:
+		nd = policy->v.preferred_node;
+		if (nd < 0)
+			nd = numa_node_id();
+		break;
+	case MPOL_BIND:
+		/* Lower zones don't get a policy applied */
+		if (gfp >= policy_zone)
+			return policy->v.zonelist;
+		/*FALL THROUGH*/
+	case MPOL_INTERLEAVE: /* should not happen */
+	case MPOL_DEFAULT:
+		nd = numa_node_id();
+		break;
+	default:
+		nd = 0;
+		BUG();
+	}
+	return NODE_DATA(nd)->node_zonelists + (gfp & GFP_ZONEMASK);
+}
+
+/* Do dynamic interleaving for a process */
+static unsigned interleave_nodes(struct mempolicy *policy)
+{
+	unsigned nid, next;
+	struct task_struct *me = current;
+
+	nid = me->il_next;
+	BUG_ON(nid >= MAX_NUMNODES);
+	next = find_next_bit(policy->v.nodes, MAX_NUMNODES, 1+nid);
+	if (next >= MAX_NUMNODES)
+		next = find_first_bit(policy->v.nodes, MAX_NUMNODES);
+	me->il_next = next;
+	return nid;
+}
+
+/* Do static interleaving for a VMA with known offset. */
+static unsigned offset_il_node(struct mempolicy *pol,
+		struct vm_area_struct *vma, unsigned long off)
+{
+	unsigned nnodes = bitmap_weight(pol->v.nodes, MAX_NUMNODES);
+	unsigned target = (unsigned)off % nnodes;
+	int c;
+	int nid = -1;
+
+	c = 0;
+	do {
+		nid = find_next_bit(pol->v.nodes, MAX_NUMNODES, nid+1);
+		c++;
+	} while (c <= target);
+	BUG_ON(nid >= MAX_NUMNODES);
+	BUG_ON(!test_bit(nid, pol->v.nodes));
+	return nid;
+}
+
+/* Allocate a page in interleaved policy.
+   Own path because it needs to do special accounting. */
+static struct page *alloc_page_interleave(unsigned gfp, unsigned nid)
+{
+	struct zonelist *zl;
+	struct page *page;
+
+	BUG_ON(!test_bit(nid, node_online_map));
+	zl = NODE_DATA(nid)->node_zonelists + (gfp & GFP_ZONEMASK);
+	page = __alloc_pages(gfp, 0, zl);
+	if (page && page_zone(page) == zl->zones[0]) {
+		zl->zones[0]->pageset[get_cpu()].interleave_hit++;
+		put_cpu();
+	}
+	return page;
+}
+
+/**
+ * 	alloc_page_vma	- Allocate a page for a VMA.
+ *
+ * 	@gfp:
+ *      %GFP_USER    user allocation.
+ *      %GFP_KERNEL  kernel allocations,
+ *      %GFP_HIGHMEM highmem/user allocations,
+ *      %GFP_FS      allocation should not call back into a file system.
+ *      %GFP_ATOMIC  don't sleep.
+ *
+ * 	@vma:  Pointer to VMA or NULL if not available.
+ *	@addr: Virtual Address of the allocation. Must be inside the VMA.
+ *
+ * 	This function allocates a page from the kernel page pool and applies
+ *	a NUMA policy associated with the VMA or the current process.
+ *	When VMA is not NULL caller must hold down_read on the mmap_sem of the
+ *	mm_struct of the VMA to prevent it from going away. Should be used for
+ *	all allocations for pages that will be mapped into
+ * 	user space. Returns NULL when no page can be allocated.
+ *
+ *	Should be called with the mm_sem of the vma hold.
+ */
+struct page *
+alloc_page_vma(unsigned gfp, struct vm_area_struct *vma, unsigned long addr)
+{
+	struct mempolicy *pol = get_vma_policy(vma, addr);
+
+	if (unlikely(pol->policy == MPOL_INTERLEAVE)) {
+		unsigned nid;
+		if (vma) {
+			unsigned long off;
+			BUG_ON(addr >= vma->vm_end);
+			BUG_ON(addr < vma->vm_start);
+			off = vma->vm_pgoff;
+			off += (addr - vma->vm_start) >> PAGE_SHIFT;
+			nid = offset_il_node(pol, vma, off);
+		} else {
+			/* fall back to process interleaving */
+			nid = interleave_nodes(pol);
+		}
+		return alloc_page_interleave(gfp, nid);
+	}
+	return __alloc_pages(gfp, 0, zonelist_policy(gfp, pol));
+}
+
+/**
+ * 	alloc_pages_current - Allocate pages.
+ *
+ *	@gfp:
+ *			%GFP_USER   user allocation,
+ *      	%GFP_KERNEL kernel allocation,
+ *      	%GFP_HIGHMEM highmem allocation,
+ *      	%GFP_FS     don't call back into a file system.
+ *      	%GFP_ATOMIC don't sleep.
+ *	@order: Power of two of allocation size in pages. 0 is a single page.
+ *
+ *	Allocate a page from the kernel page pool.  When not in
+ *	interrupt context and apply the current process NUMA policy.
+ *	Returns NULL when no page can be allocated.
+ */
+struct page *alloc_pages_current(unsigned gfp, unsigned order)
+{
+	struct mempolicy *pol = current->mempolicy;
+
+	if (!pol || in_interrupt())
+		pol = &default_policy;
+	if (pol->policy == MPOL_INTERLEAVE && order == 0)
+		return alloc_page_interleave(gfp, interleave_nodes(pol));
+	return __alloc_pages(gfp, order, zonelist_policy(gfp, pol));
+}
+EXPORT_SYMBOL(alloc_pages_current);
+
+/* Slow path of a mempolicy copy */
+struct mempolicy *__mpol_copy(struct mempolicy *old)
+{
+	struct mempolicy *new = kmem_cache_alloc(policy_cache, GFP_KERNEL);
+
+	if (!new)
+		return ERR_PTR(-ENOMEM);
+	*new = *old;
+	atomic_set(&new->refcnt, 1);
+	if (new->policy == MPOL_BIND) {
+		int sz = ksize(old->v.zonelist);
+		new->v.zonelist = kmalloc(sz, SLAB_KERNEL);
+		if (!new->v.zonelist) {
+			kmem_cache_free(policy_cache, new);
+			return ERR_PTR(-ENOMEM);
+		}
+		memcpy(new->v.zonelist, old->v.zonelist, sz);
+	}
+	return new;
+}
+
+/* Slow path of a mempolicy comparison */
+int __mpol_equal(struct mempolicy *a, struct mempolicy *b)
+{
+	if (!a || !b)
+		return 0;
+	if (a->policy != b->policy)
+		return 0;
+	switch (a->policy) {
+	case MPOL_DEFAULT:
+		return 1;
+	case MPOL_INTERLEAVE:
+		return bitmap_equal(a->v.nodes, b->v.nodes, MAX_NUMNODES);
+	case MPOL_PREFERRED:
+		return a->v.preferred_node == b->v.preferred_node;
+	case MPOL_BIND: {
+		int i;
+		for (i = 0; a->v.zonelist->zones[i]; i++)
+			if (a->v.zonelist->zones[i] != b->v.zonelist->zones[i])
+				return 0;
+		return b->v.zonelist->zones[i] == NULL;
+	}
+	default:
+		BUG();
+		return 0;
+	}
+}
+
+/* Slow path of a mpol destructor. */
+void __mpol_free(struct mempolicy *p)
+{
+	if (!atomic_dec_and_test(&p->refcnt))
+		return;
+	if (p->policy == MPOL_BIND)
+		kfree(p->v.zonelist);
+	p->policy = MPOL_DEFAULT;
+	kmem_cache_free(policy_cache, p);
+}
+
+/*
+ * Hugetlb policy. Same as above, just works with node numbers instead of
+ * zonelists.
+ */
+
+/* Find first node suitable for an allocation */
+int mpol_first_node(struct vm_area_struct *vma, unsigned long addr)
+{
+	struct mempolicy *pol = get_vma_policy(vma, addr);
+
+	switch (pol->policy) {
+	case MPOL_DEFAULT:
+		return numa_node_id();
+	case MPOL_BIND:
+		return pol->v.zonelist->zones[0]->zone_pgdat->node_id;
+	case MPOL_INTERLEAVE:
+		return interleave_nodes(pol);
+	case MPOL_PREFERRED:
+		return pol->v.preferred_node >= 0 ?
+				pol->v.preferred_node : numa_node_id();
+	}
+	BUG();
+	return 0;
+}
+
+/* Find secondary valid nodes for an allocation */
+int mpol_node_valid(int nid, struct vm_area_struct *vma, unsigned long addr)
+{
+	struct mempolicy *pol = get_vma_policy(vma, addr);
+
+	switch (pol->policy) {
+	case MPOL_PREFERRED:
+	case MPOL_DEFAULT:
+	case MPOL_INTERLEAVE:
+		return 1;
+	case MPOL_BIND: {
+		struct zone **z;
+		for (z = pol->v.zonelist->zones; *z; z++)
+			if ((*z)->zone_pgdat->node_id == nid)
+				return 1;
+		return 0;
+	}
+	default:
+		BUG();
+		return 0;
+	}
+}
+
+/*
+ * Shared memory backing store policy support.
+ *
+ * Remember policies even when nobody has shared memory mapped.
+ * The policies are kept in Red-Black tree linked from the inode.
+ * They are protected by the sp->sem semaphore, which should be held
+ * for any accesses to the tree.
+ */
+
+/* lookup first element intersecting start-end */
+/* Caller holds sp->sem */
+static struct sp_node *
+sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end)
+{
+	struct rb_node *n = sp->root.rb_node;
+
+	while (n) {
+		struct sp_node *p = rb_entry(n, struct sp_node, nd);
+		if (start >= p->end) {
+			n = n->rb_right;
+		} else if (end < p->start) {
+			n = n->rb_left;
+		} else {
+			break;
+		}
+	}
+	if (!n)
+		return NULL;
+	for (;;) {
+		struct sp_node *w = NULL;
+		struct rb_node *prev = rb_prev(n);
+		if (!prev)
+			break;
+		w = rb_entry(prev, struct sp_node, nd);
+		if (w->end <= start)
+			break;
+		n = prev;
+	}
+	return rb_entry(n, struct sp_node, nd);
+}
+
+/* Insert a new shared policy into the list. */
+/* Caller holds sp->sem */
+static void sp_insert(struct shared_policy *sp, struct sp_node *new)
+{
+	struct rb_node **p = &sp->root.rb_node;
+	struct rb_node *parent = NULL;
+	struct sp_node *nd;
+
+	while (*p) {
+		parent = *p;
+		nd = rb_entry(parent, struct sp_node, nd);
+		if (new->start < nd->start)
+			p = &(*p)->rb_left;
+		else if (new->end > nd->end)
+			p = &(*p)->rb_right;
+		else
+			BUG();
+	}
+	rb_link_node(&new->nd, parent, p);
+	rb_insert_color(&new->nd, &sp->root);
+	PDprintk("inserting %lx-%lx: %d\n", new->start, new->end,
+		 new->policy ? new->policy->policy : 0);
+}
+
+/* Find shared policy intersecting idx */
+struct mempolicy *
+mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
+{
+	struct mempolicy *pol = NULL;
+	struct sp_node *sn;
+
+	down(&sp->sem);
+	sn = sp_lookup(sp, idx, idx+1);
+	if (sn) {
+		mpol_get(sn->policy);
+		pol = sn->policy;
+	}
+	up(&sp->sem);
+	return pol;
+}
+
+static void sp_delete(struct shared_policy *sp, struct sp_node *n)
+{
+	PDprintk("deleting %lx-l%x\n", n->start, n->end);
+	rb_erase(&n->nd, &sp->root);
+	mpol_free(n->policy);
+	kmem_cache_free(sn_cache, n);
+}
+
+struct sp_node *
+sp_alloc(unsigned long start, unsigned long end, struct mempolicy *pol)
+{
+	struct sp_node *n = kmem_cache_alloc(sn_cache, GFP_KERNEL);
+
+	if (!n)
+		return NULL;
+	n->start = start;
+	n->end = end;
+	mpol_get(pol);
+	n->policy = pol;
+	return n;
+}
+
+/* Replace a policy range. */
+static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
+				 unsigned long end, struct sp_node *new)
+{
+	struct sp_node *n, *new2;
+
+	down(&sp->sem);
+	n = sp_lookup(sp, start, end);
+	/* Take care of old policies in the same range. */
+	while (n && n->start < end) {
+		struct rb_node *next = rb_next(&n->nd);
+		if (n->start >= start) {
+			if (n->end <= end)
+				sp_delete(sp, n);
+			else
+				n->start = end;
+		} else {
+			/* Old policy spanning whole new range. */
+			if (n->end > end) {
+				new2 = sp_alloc(end, n->end, n->policy);
+				if (!new2) {
+					up(&sp->sem);
+					return -ENOMEM;
+				}
+				n->end = end;
+				sp_insert(sp, new2);
+			}
+			/* Old crossing beginning, but not end (easy) */
+			if (n->start < start && n->end > start)
+				n->end = start;
+		}
+		if (!next)
+			break;
+		n = rb_entry(next, struct sp_node, nd);
+	}
+	if (new)
+		sp_insert(sp, new);
+	up(&sp->sem);
+	return 0;
+}
+
+int mpol_set_shared_policy(struct shared_policy *info,
+			struct vm_area_struct *vma, struct mempolicy *npol)
+{
+	int err;
+	struct sp_node *new = NULL;
+	unsigned long sz = vma_pages(vma);
+
+	PDprintk("set_shared_policy %lx sz %lu %d %lx\n",
+		 vma->vm_pgoff,
+		 sz, npol? npol->policy : -1,
+		npol ? npol->v.nodes[0] : -1);
+
+	if (npol) {
+		new = sp_alloc(vma->vm_pgoff, vma->vm_pgoff + sz, npol);
+		if (!new)
+			return -ENOMEM;
+	}
+	err = shared_policy_replace(info, vma->vm_pgoff, vma->vm_pgoff+sz, new);
+	if (err && new)
+		kmem_cache_free(sn_cache, new);
+	return err;
+}
+
+/* Free a backing policy store on inode delete. */
+void mpol_free_shared_policy(struct shared_policy *p)
+{
+	struct sp_node *n;
+	struct rb_node *next;
+
+	down(&p->sem);
+	next = rb_first(&p->root);
+	while (next) {
+		n = rb_entry(next, struct sp_node, nd);
+		next = rb_next(&n->nd);
+		rb_erase(&n->nd, &p->root);
+		mpol_free(n->policy);
+		kmem_cache_free(sn_cache, n);
+	}
+	up(&p->sem);
+}
+
+static __init int numa_policy_init(void)
+{
+	policy_cache = kmem_cache_create("numa_policy",
+					 sizeof(struct mempolicy),
+					 0, SLAB_PANIC, NULL, NULL);
+
+	sn_cache = kmem_cache_create("shared_policy_node",
+				     sizeof(struct sp_node),
+				     0, SLAB_PANIC, NULL, NULL);
+	return 0;
+}
+module_init(numa_policy_init);
diff -Nru a/mm/mincore.c b/mm/mincore.c
--- a/mm/mincore.c	Tue Jun 15 22:21:04 2004
+++ b/mm/mincore.c	Tue Jun 15 22:21:04 2004
@@ -124,7 +124,7 @@
 		goto out;
 
 	error = -EFAULT;
-	if (!access_ok(VERIFY_WRITE, (unsigned long) vec, len >> PAGE_SHIFT))
+	if (!access_ok(VERIFY_WRITE, vec, len >> PAGE_SHIFT))
 		goto out;
 
 	error = 0;
diff -Nru a/mm/mlock.c b/mm/mlock.c
--- a/mm/mlock.c	Tue Jun 15 22:20:36 2004
+++ b/mm/mlock.c	Tue Jun 15 22:20:36 2004
@@ -32,10 +32,13 @@
 			goto out;
 		}
 	}
-	
-	spin_lock(&mm->page_table_lock);
+
+	/*
+	 * vm_flags is protected by the mmap_sem held in write mode.
+	 * It's okay if try_to_unmap_one unmaps a page just after we
+	 * set VM_LOCKED, make_pages_present below will bring it back.
+	 */
 	vma->vm_flags = newflags;
-	spin_unlock(&mm->page_table_lock);
 
 	/*
 	 * Keep track of amount of locked VM.
diff -Nru a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c	Tue Jun 15 22:20:42 2004
+++ b/mm/mmap.c	Tue Jun 15 22:20:42 2004
@@ -21,9 +21,12 @@
 #include <linux/profile.h>
 #include <linux/module.h>
 #include <linux/mount.h>
+#include <linux/mempolicy.h>
+#include <linux/rmap.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
+#include <asm/cacheflush.h>
 #include <asm/tlb.h>
 
 /*
@@ -63,31 +66,44 @@
 EXPORT_SYMBOL(vm_committed_space);
 
 /*
- * Requires inode->i_mapping->i_shared_sem
+ * Requires inode->i_mapping->i_mmap_lock
  */
-static inline void
-__remove_shared_vm_struct(struct vm_area_struct *vma, struct inode *inode)
+static void __remove_shared_vm_struct(struct vm_area_struct *vma,
+		struct file *file, struct address_space *mapping)
 {
-	if (inode) {
-		if (vma->vm_flags & VM_DENYWRITE)
-			atomic_inc(&inode->i_writecount);
-		list_del_init(&vma->shared);
-	}
+	if (vma->vm_flags & VM_DENYWRITE)
+		atomic_inc(&file->f_dentry->d_inode->i_writecount);
+	if (vma->vm_flags & VM_SHARED)
+		mapping->i_mmap_writable--;
+
+	flush_dcache_mmap_lock(mapping);
+	if (unlikely(vma->vm_flags & VM_NONLINEAR))
+		list_del_init(&vma->shared.vm_set.list);
+	else
+		vma_prio_tree_remove(vma, &mapping->i_mmap);
+	flush_dcache_mmap_unlock(mapping);
 }
 
 /*
- * Remove one vm structure from the inode's i_mapping address space.
+ * Remove one vm structure and free it.
  */
-static void remove_shared_vm_struct(struct vm_area_struct *vma)
+static void remove_vm_struct(struct vm_area_struct *vma)
 {
 	struct file *file = vma->vm_file;
 
 	if (file) {
 		struct address_space *mapping = file->f_mapping;
-		down(&mapping->i_shared_sem);
-		__remove_shared_vm_struct(vma, file->f_dentry->d_inode);
-		up(&mapping->i_shared_sem);
+		spin_lock(&mapping->i_mmap_lock);
+		__remove_shared_vm_struct(vma, file, mapping);
+		spin_unlock(&mapping->i_mmap_lock);
 	}
+	if (vma->vm_ops && vma->vm_ops->close)
+		vma->vm_ops->close(vma);
+	if (file)
+		fput(file);
+	anon_vma_unlink(vma);
+	mpol_free(vma_policy(vma));
+	kmem_cache_free(vm_area_cachep, vma);
 }
 
 /*
@@ -140,10 +156,10 @@
 }
 
 #ifdef DEBUG_MM_RB
-static int browse_rb(struct rb_root *root) {
-	int i, j;
+static int browse_rb(struct rb_root *root)
+{
+	int i = 0, j;
 	struct rb_node *nd, *pn = NULL;
-	i = 0;
 	unsigned long prev = 0, pend = 0;
 
 	for (nd = rb_first(root); nd; nd = rb_next(nd)) {
@@ -167,10 +183,11 @@
 	return i;
 }
 
-void validate_mm(struct mm_struct * mm) {
+void validate_mm(struct mm_struct *mm)
+{
 	int bug = 0;
 	int i = 0;
-	struct vm_area_struct * tmp = mm->mmap;
+	struct vm_area_struct *tmp = mm->mmap;
 	while (tmp) {
 		tmp = tmp->vm_next;
 		i++;
@@ -258,11 +275,16 @@
 
 		if (vma->vm_flags & VM_DENYWRITE)
 			atomic_dec(&file->f_dentry->d_inode->i_writecount);
-
 		if (vma->vm_flags & VM_SHARED)
-			list_add_tail(&vma->shared, &mapping->i_mmap_shared);
+			mapping->i_mmap_writable++;
+
+		flush_dcache_mmap_lock(mapping);
+		if (unlikely(vma->vm_flags & VM_NONLINEAR))
+			list_add_tail(&vma->shared.vm_set.list,
+					&mapping->i_mmap_nonlinear);
 		else
-			list_add_tail(&vma->shared, &mapping->i_mmap);
+			vma_prio_tree_insert(vma, &mapping->i_mmap);
+		flush_dcache_mmap_unlock(mapping);
 	}
 }
 
@@ -273,7 +295,7 @@
 {
 	__vma_link_list(mm, vma, prev, rb_parent);
 	__vma_link_rb(mm, vma, rb_link, rb_parent);
-	__vma_link_file(vma);
+	__anon_vma_link(vma);
 }
 
 static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma,
@@ -286,12 +308,15 @@
 		mapping = vma->vm_file->f_mapping;
 
 	if (mapping)
-		down(&mapping->i_shared_sem);
-	spin_lock(&mm->page_table_lock);
+		spin_lock(&mapping->i_mmap_lock);
+	anon_vma_lock(vma);
+
 	__vma_link(mm, vma, prev, rb_link, rb_parent);
-	spin_unlock(&mm->page_table_lock);
+	__vma_link_file(vma);
+
+	anon_vma_unlock(vma);
 	if (mapping)
-		up(&mapping->i_shared_sem);
+		spin_unlock(&mapping->i_mmap_lock);
 
 	mark_mm_hugetlb(mm, vma);
 	mm->map_count++;
@@ -299,9 +324,9 @@
 }
 
 /*
- * Insert vm structure into process list sorted by address and into the inode's
- * i_mmap ring. The caller should hold mm->page_table_lock and
- * ->f_mappping->i_shared_sem if vm_file is non-NULL.
+ * Helper for vma_adjust in the split_vma insert case:
+ * insert vm structure into list and rbtree and anon_vma,
+ * but it has already been inserted into prio_tree earlier.
  */
 static void
 __insert_vm_struct(struct mm_struct * mm, struct vm_area_struct * vma)
@@ -313,8 +338,156 @@
 	if (__vma && __vma->vm_start < vma->vm_end)
 		BUG();
 	__vma_link(mm, vma, prev, rb_link, rb_parent);
-	mark_mm_hugetlb(mm, vma);
 	mm->map_count++;
+}
+
+static inline void
+__vma_unlink(struct mm_struct *mm, struct vm_area_struct *vma,
+		struct vm_area_struct *prev)
+{
+	prev->vm_next = vma->vm_next;
+	rb_erase(&vma->vm_rb, &mm->mm_rb);
+	if (mm->mmap_cache == vma)
+		mm->mmap_cache = prev;
+}
+
+/*
+ * We cannot adjust vm_start, vm_end, vm_pgoff fields of a vma that
+ * is already present in an i_mmap tree without adjusting the tree.
+ * The following helper function should be used when such adjustments
+ * are necessary.  The "insert" vma (if any) is to be inserted
+ * before we drop the necessary locks.
+ */
+void vma_adjust(struct vm_area_struct *vma, unsigned long start,
+	unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert)
+{
+	struct mm_struct *mm = vma->vm_mm;
+	struct vm_area_struct *next = vma->vm_next;
+	struct address_space *mapping = NULL;
+	struct prio_tree_root *root = NULL;
+	struct file *file = vma->vm_file;
+	struct anon_vma *anon_vma = NULL;
+	long adjust_next = 0;
+	int remove_next = 0;
+
+	if (next && !insert) {
+		if (end >= next->vm_end) {
+			/*
+			 * vma expands, overlapping all the next, and
+			 * perhaps the one after too (mprotect case 6).
+			 */
+again:			remove_next = 1 + (end > next->vm_end);
+			end = next->vm_end;
+			anon_vma = next->anon_vma;
+		} else if (end > next->vm_start) {
+			/*
+			 * vma expands, overlapping part of the next:
+			 * mprotect case 5 shifting the boundary up.
+			 */
+			adjust_next = (end - next->vm_start) >> PAGE_SHIFT;
+			anon_vma = next->anon_vma;
+		} else if (end < vma->vm_end) {
+			/*
+			 * vma shrinks, and !insert tells it's not
+			 * split_vma inserting another: so it must be
+			 * mprotect case 4 shifting the boundary down.
+			 */
+			adjust_next = - ((vma->vm_end - end) >> PAGE_SHIFT);
+			anon_vma = next->anon_vma;
+		}
+	}
+
+	if (file) {
+		mapping = file->f_mapping;
+		if (!(vma->vm_flags & VM_NONLINEAR))
+			root = &mapping->i_mmap;
+		spin_lock(&mapping->i_mmap_lock);
+		if (insert) {
+			/*
+			 * Put into prio_tree now, so instantiated pages
+			 * are visible to arm/parisc __flush_dcache_page
+			 * throughout; but we cannot insert into address
+			 * space until vma start or end is updated.
+			 */
+			__vma_link_file(insert);
+		}
+	}
+
+	/*
+	 * When changing only vma->vm_end, we don't really need
+	 * anon_vma lock: but is that case worth optimizing out?
+	 */
+	if (vma->anon_vma)
+		anon_vma = vma->anon_vma;
+	if (anon_vma)
+		spin_lock(&anon_vma->lock);
+
+	if (root) {
+		flush_dcache_mmap_lock(mapping);
+		vma_prio_tree_remove(vma, root);
+		if (adjust_next)
+			vma_prio_tree_remove(next, root);
+	}
+
+	vma->vm_start = start;
+	vma->vm_end = end;
+	vma->vm_pgoff = pgoff;
+	if (adjust_next) {
+		next->vm_start += adjust_next << PAGE_SHIFT;
+		next->vm_pgoff += adjust_next;
+	}
+
+	if (root) {
+		if (adjust_next) {
+			vma_prio_tree_init(next);
+			vma_prio_tree_insert(next, root);
+		}
+		vma_prio_tree_init(vma);
+		vma_prio_tree_insert(vma, root);
+		flush_dcache_mmap_unlock(mapping);
+	}
+
+	if (remove_next) {
+		/*
+		 * vma_merge has merged next into vma, and needs
+		 * us to remove next before dropping the locks.
+		 */
+		__vma_unlink(mm, next, vma);
+		if (file)
+			__remove_shared_vm_struct(next, file, mapping);
+		if (next->anon_vma)
+			__anon_vma_merge(vma, next);
+	} else if (insert) {
+		/*
+		 * split_vma has split insert from vma, and needs
+		 * us to insert it before dropping the locks
+		 * (it may either follow vma or precede it).
+		 */
+		__insert_vm_struct(mm, insert);
+	}
+
+	if (anon_vma)
+		spin_unlock(&anon_vma->lock);
+	if (mapping)
+		spin_unlock(&mapping->i_mmap_lock);
+
+	if (remove_next) {
+		if (file)
+			fput(file);
+		mm->map_count--;
+		mpol_free(vma_policy(next));
+		kmem_cache_free(vm_area_cachep, next);
+		/*
+		 * In mprotect's case 6 (see comments on vma_merge),
+		 * we must remove another next too. It would clutter
+		 * up the code too much to do both in one go.
+		 */
+		if (remove_next == 2) {
+			next = vma->vm_next;
+			goto again;
+		}
+	}
+
 	validate_mm(mm);
 }
 
@@ -327,156 +500,228 @@
 static inline int is_mergeable_vma(struct vm_area_struct *vma,
 			struct file *file, unsigned long vm_flags)
 {
-	if (vma->vm_ops && vma->vm_ops->close)
+	if (vma->vm_flags != vm_flags)
 		return 0;
 	if (vma->vm_file != file)
 		return 0;
-	if (vma->vm_flags != vm_flags)
-		return 0;
-	if (vma->vm_private_data)
+	if (vma->vm_ops && vma->vm_ops->close)
 		return 0;
 	return 1;
 }
 
+static inline int is_mergeable_anon_vma(struct anon_vma *anon_vma1,
+					struct anon_vma *anon_vma2)
+{
+	return !anon_vma1 || !anon_vma2 || (anon_vma1 == anon_vma2);
+}
+
 /*
- * Return true if we can merge this (vm_flags,file,vm_pgoff,size)
+ * Return true if we can merge this (vm_flags,anon_vma,file,vm_pgoff)
  * in front of (at a lower virtual address and file offset than) the vma.
  *
+ * We cannot merge two vmas if they have differently assigned (non-NULL)
+ * anon_vmas, nor if same anon_vma is assigned but offsets incompatible.
+ *
  * We don't check here for the merged mmap wrapping around the end of pagecache
  * indices (16TB on ia32) because do_mmap_pgoff() does not permit mmap's which
  * wrap, nor mmaps which cover the final page at index -1UL.
  */
 static int
 can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags,
-	struct file *file, unsigned long vm_pgoff, unsigned long size)
+	struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff)
 {
-	if (is_mergeable_vma(vma, file, vm_flags)) {
-		if (!file)
-			return 1;	/* anon mapping */
-		if (vma->vm_pgoff == vm_pgoff + size)
+	if (is_mergeable_vma(vma, file, vm_flags) &&
+	    is_mergeable_anon_vma(anon_vma, vma->anon_vma)) {
+		if (vma->vm_pgoff == vm_pgoff)
 			return 1;
 	}
 	return 0;
 }
 
 /*
- * Return true if we can merge this (vm_flags,file,vm_pgoff)
+ * Return true if we can merge this (vm_flags,anon_vma,file,vm_pgoff)
  * beyond (at a higher virtual address and file offset than) the vma.
+ *
+ * We cannot merge two vmas if they have differently assigned (non-NULL)
+ * anon_vmas, nor if same anon_vma is assigned but offsets incompatible.
  */
 static int
 can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags,
-	struct file *file, unsigned long vm_pgoff)
+	struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff)
 {
-	if (is_mergeable_vma(vma, file, vm_flags)) {
-		unsigned long vma_size;
-
-		if (!file)
-			return 1;	/* anon mapping */
-
-		vma_size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
-		if (vma->vm_pgoff + vma_size == vm_pgoff)
+	if (is_mergeable_vma(vma, file, vm_flags) &&
+	    is_mergeable_anon_vma(anon_vma, vma->anon_vma)) {
+		pgoff_t vm_pglen;
+		vm_pglen = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+		if (vma->vm_pgoff + vm_pglen == vm_pgoff)
 			return 1;
 	}
 	return 0;
 }
 
 /*
- * Given a new mapping request (addr,end,vm_flags,file,pgoff), figure out
- * whether that can be merged with its predecessor or its successor.  Or
- * both (it neatly fills a hole).
- */
-static struct vm_area_struct *vma_merge(struct mm_struct *mm,
-			struct vm_area_struct *prev,
-			struct rb_node *rb_parent, unsigned long addr, 
+ * Given a mapping request (addr,end,vm_flags,file,pgoff), figure out
+ * whether that can be merged with its predecessor or its successor.
+ * Or both (it neatly fills a hole).
+ *
+ * In most cases - when called for mmap, brk or mremap - [addr,end) is
+ * certain not to be mapped by the time vma_merge is called; but when
+ * called for mprotect, it is certain to be already mapped (either at
+ * an offset within prev, or at the start of next), and the flags of
+ * this area are about to be changed to vm_flags - and the no-change
+ * case has already been eliminated.
+ *
+ * The following mprotect cases have to be considered, where AAAA is
+ * the area passed down from mprotect_fixup, never extending beyond one
+ * vma, PPPPPP is the prev vma specified, and NNNNNN the next vma after:
+ *
+ *     AAAA             AAAA                AAAA          AAAA
+ *    PPPPPPNNNNNN    PPPPPPNNNNNN    PPPPPPNNNNNN    PPPPNNNNXXXX
+ *    cannot merge    might become    might become    might become
+ *                    PPNNNNNNNNNN    PPPPPPPPPPNN    PPPPPPPPPPPP 6 or
+ *    mmap, brk or    case 4 below    case 5 below    PPPPPPPPXXXX 7 or
+ *    mremap move:                                    PPPPNNNNNNNN 8
+ *        AAAA
+ *    PPPP    NNNN    PPPPPPPPPPPP    PPPPPPPPNNNN    PPPPNNNNNNNN
+ *    might become    case 1 below    case 2 below    case 3 below
+ *
+ * Odd one out? Case 8, because it extends NNNN but needs flags of XXXX:
+ * mprotect_fixup updates vm_flags & vm_page_prot on successful return.
+ */
+struct vm_area_struct *vma_merge(struct mm_struct *mm,
+			struct vm_area_struct *prev, unsigned long addr,
 			unsigned long end, unsigned long vm_flags,
-			struct file *file, unsigned long pgoff)
+		     	struct anon_vma *anon_vma, struct file *file,
+			pgoff_t pgoff, struct mempolicy *policy)
 {
-	spinlock_t *lock = &mm->page_table_lock;
-	struct inode *inode = file ? file->f_dentry->d_inode : NULL;
-	struct semaphore *i_shared_sem;
+	pgoff_t pglen = (end - addr) >> PAGE_SHIFT;
+	struct vm_area_struct *area, *next;
 
 	/*
-	 * We later require that vma->vm_flags == vm_flags, so this tests
-	 * vma->vm_flags & VM_SPECIAL, too.
+	 * We later require that vma->vm_flags == vm_flags,
+	 * so this tests vma->vm_flags & VM_SPECIAL, too.
 	 */
 	if (vm_flags & VM_SPECIAL)
 		return NULL;
 
-	i_shared_sem = file ? &file->f_mapping->i_shared_sem : NULL;
-
-	if (!prev) {
-		prev = rb_entry(rb_parent, struct vm_area_struct, vm_rb);
-		goto merge_next;
-	}
+	if (prev)
+		next = prev->vm_next;
+	else
+		next = mm->mmap;
+	area = next;
+	if (next && next->vm_end == end)		/* cases 6, 7, 8 */
+		next = next->vm_next;
 
 	/*
 	 * Can it merge with the predecessor?
 	 */
-	if (prev->vm_end == addr &&
-			can_vma_merge_after(prev, vm_flags, file, pgoff)) {
-		struct vm_area_struct *next;
-		int need_up = 0;
-
-		if (unlikely(file && prev->vm_next &&
-				prev->vm_next->vm_file == file)) {
-			down(i_shared_sem);
-			need_up = 1;
-		}
-		spin_lock(lock);
-		prev->vm_end = end;
-
+	if (prev && prev->vm_end == addr &&
+  			mpol_equal(vma_policy(prev), policy) &&
+			can_vma_merge_after(prev, vm_flags,
+						anon_vma, file, pgoff)) {
 		/*
-		 * OK, it did.  Can we now merge in the successor as well?
+		 * OK, it can.  Can we now merge in the successor as well?
 		 */
-		next = prev->vm_next;
-		if (next && prev->vm_end == next->vm_start &&
-				can_vma_merge_before(next, vm_flags, file,
-					pgoff, (end - addr) >> PAGE_SHIFT)) {
-			prev->vm_end = next->vm_end;
-			__vma_unlink(mm, next, prev);
-			__remove_shared_vm_struct(next, inode);
-			spin_unlock(lock);
-			if (need_up)
-				up(i_shared_sem);
-			if (file)
-				fput(file);
-
-			mm->map_count--;
-			kmem_cache_free(vm_area_cachep, next);
-			return prev;
-		}
-		spin_unlock(lock);
-		if (need_up)
-			up(i_shared_sem);
+		if (next && end == next->vm_start &&
+				mpol_equal(policy, vma_policy(next)) &&
+				can_vma_merge_before(next, vm_flags,
+					anon_vma, file, pgoff+pglen) &&
+				is_mergeable_anon_vma(prev->anon_vma,
+						      next->anon_vma)) {
+							/* cases 1, 6 */
+			vma_adjust(prev, prev->vm_start,
+				next->vm_end, prev->vm_pgoff, NULL);
+		} else					/* cases 2, 5, 7 */
+			vma_adjust(prev, prev->vm_start,
+				end, prev->vm_pgoff, NULL);
 		return prev;
 	}
 
 	/*
-	 * Can this new request be merged in front of prev->vm_next?
+	 * Can this new request be merged in front of next?
 	 */
-	prev = prev->vm_next;
-	if (prev) {
- merge_next:
-		if (!can_vma_merge_before(prev, vm_flags, file,
-				pgoff, (end - addr) >> PAGE_SHIFT))
-			return NULL;
-		if (end == prev->vm_start) {
-			if (file)
-				down(i_shared_sem);
-			spin_lock(lock);
-			prev->vm_start = addr;
-			prev->vm_pgoff -= (end - addr) >> PAGE_SHIFT;
-			spin_unlock(lock);
-			if (file)
-				up(i_shared_sem);
-			return prev;
-		}
+	if (next && end == next->vm_start &&
+ 			mpol_equal(policy, vma_policy(next)) &&
+			can_vma_merge_before(next, vm_flags,
+					anon_vma, file, pgoff+pglen)) {
+		if (prev && addr < prev->vm_end)	/* case 4 */
+			vma_adjust(prev, prev->vm_start,
+				addr, prev->vm_pgoff, NULL);
+		else					/* cases 3, 8 */
+			vma_adjust(area, addr, next->vm_end,
+				next->vm_pgoff - pglen, NULL);
+		return area;
 	}
 
 	return NULL;
 }
 
 /*
+ * find_mergeable_anon_vma is used by anon_vma_prepare, to check
+ * neighbouring vmas for a suitable anon_vma, before it goes off
+ * to allocate a new anon_vma.  It checks because a repetitive
+ * sequence of mprotects and faults may otherwise lead to distinct
+ * anon_vmas being allocated, preventing vma merge in subsequent
+ * mprotect.
+ */
+struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *vma)
+{
+	struct vm_area_struct *near;
+	unsigned long vm_flags;
+
+	near = vma->vm_next;
+	if (!near)
+		goto try_prev;
+
+	/*
+	 * Since only mprotect tries to remerge vmas, match flags
+	 * which might be mprotected into each other later on.
+	 * Neither mlock nor madvise tries to remerge at present,
+	 * so leave their flags as obstructing a merge.
+	 */
+	vm_flags = vma->vm_flags & ~(VM_READ|VM_WRITE|VM_EXEC);
+	vm_flags |= near->vm_flags & (VM_READ|VM_WRITE|VM_EXEC);
+
+	if (near->anon_vma && vma->vm_end == near->vm_start &&
+ 			mpol_equal(vma_policy(vma), vma_policy(near)) &&
+			can_vma_merge_before(near, vm_flags,
+				NULL, vma->vm_file, vma->vm_pgoff +
+				((vma->vm_end - vma->vm_start) >> PAGE_SHIFT)))
+		return near->anon_vma;
+try_prev:
+	/*
+	 * It is potentially slow to have to call find_vma_prev here.
+	 * But it's only on the first write fault on the vma, not
+	 * every time, and we could devise a way to avoid it later
+	 * (e.g. stash info in next's anon_vma_node when assigning
+	 * an anon_vma, or when trying vma_merge).  Another time.
+	 */
+	if (find_vma_prev(vma->vm_mm, vma->vm_start, &near) != vma)
+		BUG();
+	if (!near)
+		goto none;
+
+	vm_flags = vma->vm_flags & ~(VM_READ|VM_WRITE|VM_EXEC);
+	vm_flags |= near->vm_flags & (VM_READ|VM_WRITE|VM_EXEC);
+
+	if (near->anon_vma && near->vm_end == vma->vm_start &&
+  			mpol_equal(vma_policy(near), vma_policy(vma)) &&
+			can_vma_merge_after(near, vm_flags,
+				NULL, vma->vm_file, vma->vm_pgoff))
+		return near->anon_vma;
+none:
+	/*
+	 * There's no absolute need to look only at touching neighbours:
+	 * we could search further afield for "compatible" anon_vmas.
+	 * But it would probably just be a waste of time searching,
+	 * or lead to too many vmas hanging off the same anon_vma.
+	 * We're trying to allow mprotect remerging later on,
+	 * not trying to minimize memory used for anon_vmas.
+	 */
+	return NULL;
+}
+
+/*
  * The caller must hold down_write(current->mm->mmap_sem).
  */
 
@@ -501,7 +746,8 @@
 		if (!file->f_op || !file->f_op->mmap)
 			return -ENODEV;
 
-		if ((prot & PROT_EXEC) && (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
+		if ((prot & PROT_EXEC) &&
+		    (file->f_vfsmnt->mnt_flags & MNT_NOEXEC))
 			return -EPERM;
 	}
 
@@ -583,15 +829,18 @@
 			return -EINVAL;
 		}
 	} else {
-		vm_flags |= VM_SHARED | VM_MAYSHARE;
 		switch (flags & MAP_TYPE) {
-		default:
-			return -EINVAL;
-		case MAP_PRIVATE:
-			vm_flags &= ~(VM_SHARED | VM_MAYSHARE);
-			/* fall through */
 		case MAP_SHARED:
+			vm_flags |= VM_SHARED | VM_MAYSHARE;
+			break;
+		case MAP_PRIVATE:
+			/*
+			 * Set pgoff according to addr for anon_vma.
+			 */
+			pgoff = addr >> PAGE_SHIFT;
 			break;
+		default:
+			return -EINVAL;
 		}
 	}
 
@@ -630,11 +879,15 @@
 		}
 	}
 
-	/* Can we just expand an old anonymous mapping? */
-	if (!file && !(vm_flags & VM_SHARED) && rb_parent)
-		if (vma_merge(mm, prev, rb_parent, addr, addr + len,
-					vm_flags, NULL, 0))
-			goto out;
+	/*
+	 * Can we just expand an old private anonymous mapping?
+	 * The VM_SHARED test is necessary because shmem_zero_setup
+	 * will create the file object for a shared anonymous map below.
+	 */
+	if (!file && !(vm_flags & VM_SHARED) &&
+	    vma_merge(mm, prev, addr, addr + len, vm_flags,
+					NULL, NULL, pgoff, NULL))
+		goto out;
 
 	/*
 	 * Determine the object being mapped and call the appropriate
@@ -642,21 +895,18 @@
 	 * not unmapped, but the maps are removed from the list.
 	 */
 	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
-	error = -ENOMEM;
-	if (!vma)
+	if (!vma) {
+		error = -ENOMEM;
 		goto unacct_error;
+	}
+	memset(vma, 0, sizeof(*vma));
 
 	vma->vm_mm = mm;
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
 	vma->vm_flags = vm_flags;
 	vma->vm_page_prot = protection_map[vm_flags & 0x0f];
-	vma->vm_ops = NULL;
 	vma->vm_pgoff = pgoff;
-	vma->vm_file = NULL;
-	vma->vm_private_data = NULL;
-	vma->vm_next = NULL;
-	INIT_LIST_HEAD(&vma->shared);
 
 	if (file) {
 		error = -EINVAL;
@@ -694,8 +944,8 @@
 	 */
 	addr = vma->vm_start;
 
-	if (!file || !rb_parent || !vma_merge(mm, prev, rb_parent, addr,
-				addr + len, vma->vm_flags, file, pgoff)) {
+	if (!file || !vma_merge(mm, prev, addr, vma->vm_end,
+			vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) {
 		vma_link(mm, vma, prev, rb_link, rb_parent);
 		if (correct_wcount)
 			atomic_inc(&inode->i_writecount);
@@ -705,6 +955,7 @@
 				atomic_inc(&inode->i_writecount);
 			fput(file);
 		}
+		mpol_free(vma_policy(vma));
 		kmem_cache_free(vm_area_cachep, vma);
 	}
 out:	
@@ -715,7 +966,7 @@
 	}
 	if (flags & MAP_POPULATE) {
 		up_write(&mm->mmap_sem);
-		sys_remap_file_pages(addr, len, prot,
+		sys_remap_file_pages(addr, len, 0,
 					pgoff, flags & MAP_NONBLOCK);
 		down_write(&mm->mmap_sem);
 	}
@@ -925,25 +1176,32 @@
 		return -EFAULT;
 
 	/*
+	 * We must make sure the anon_vma is allocated
+	 * so that the anon_vma locking is not a noop.
+	 */
+	if (unlikely(anon_vma_prepare(vma)))
+		return -ENOMEM;
+	anon_vma_lock(vma);
+
+	/*
 	 * vma->vm_start/vm_end cannot change under us because the caller
-	 * is required to hold the mmap_sem in read mode. We need to get
-	 * the spinlock only before relocating the vma range ourself.
+	 * is required to hold the mmap_sem in read mode.  We need the
+	 * anon_vma lock to serialize against concurrent expand_stacks.
 	 */
 	address += 4 + PAGE_SIZE - 1;
 	address &= PAGE_MASK;
- 	spin_lock(&vma->vm_mm->page_table_lock);
 	grow = (address - vma->vm_end) >> PAGE_SHIFT;
 
 	/* Overcommit.. */
 	if (security_vm_enough_memory(grow)) {
-		spin_unlock(&vma->vm_mm->page_table_lock);
+		anon_vma_unlock(vma);
 		return -ENOMEM;
 	}
 	
 	if (address - vma->vm_start > current->rlim[RLIMIT_STACK].rlim_cur ||
 			((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) >
 			current->rlim[RLIMIT_AS].rlim_cur) {
-		spin_unlock(&vma->vm_mm->page_table_lock);
+		anon_vma_unlock(vma);
 		vm_unacct_memory(grow);
 		return -ENOMEM;
 	}
@@ -951,7 +1209,7 @@
 	vma->vm_mm->total_vm += grow;
 	if (vma->vm_flags & VM_LOCKED)
 		vma->vm_mm->locked_vm += grow;
-	spin_unlock(&vma->vm_mm->page_table_lock);
+	anon_vma_unlock(vma);
 	return 0;
 }
 
@@ -980,24 +1238,31 @@
 	unsigned long grow;
 
 	/*
+	 * We must make sure the anon_vma is allocated
+	 * so that the anon_vma locking is not a noop.
+	 */
+	if (unlikely(anon_vma_prepare(vma)))
+		return -ENOMEM;
+	anon_vma_lock(vma);
+
+	/*
 	 * vma->vm_start/vm_end cannot change under us because the caller
-	 * is required to hold the mmap_sem in read mode. We need to get
-	 * the spinlock only before relocating the vma range ourself.
+	 * is required to hold the mmap_sem in read mode.  We need the
+	 * anon_vma lock to serialize against concurrent expand_stacks.
 	 */
 	address &= PAGE_MASK;
- 	spin_lock(&vma->vm_mm->page_table_lock);
 	grow = (vma->vm_start - address) >> PAGE_SHIFT;
 
 	/* Overcommit.. */
 	if (security_vm_enough_memory(grow)) {
-		spin_unlock(&vma->vm_mm->page_table_lock);
+		anon_vma_unlock(vma);
 		return -ENOMEM;
 	}
 	
 	if (vma->vm_end - address > current->rlim[RLIMIT_STACK].rlim_cur ||
 			((vma->vm_mm->total_vm + grow) << PAGE_SHIFT) >
 			current->rlim[RLIMIT_AS].rlim_cur) {
-		spin_unlock(&vma->vm_mm->page_table_lock);
+		anon_vma_unlock(vma);
 		vm_unacct_memory(grow);
 		return -ENOMEM;
 	}
@@ -1006,7 +1271,7 @@
 	vma->vm_mm->total_vm += grow;
 	if (vma->vm_flags & VM_LOCKED)
 		vma->vm_mm->locked_vm += grow;
-	spin_unlock(&vma->vm_mm->page_table_lock);
+	anon_vma_unlock(vma);
 	return 0;
 }
 
@@ -1118,13 +1383,7 @@
 				area->vm_start < area->vm_mm->free_area_cache)
 	      area->vm_mm->free_area_cache = area->vm_start;
 
-	remove_shared_vm_struct(area);
-
-	if (area->vm_ops && area->vm_ops->close)
-		area->vm_ops->close(area);
-	if (area->vm_file)
-		fput(area->vm_file);
-	kmem_cache_free(vm_area_cachep, area);
+	remove_vm_struct(area);
 }
 
 /*
@@ -1173,8 +1432,6 @@
 /*
  * Create a list of vma's touched by the unmap, removing them from the mm's
  * vma list as we go..
- *
- * Called with the page_table_lock held.
  */
 static void
 detach_vmas_to_be_unmapped(struct mm_struct *mm, struct vm_area_struct *vma,
@@ -1202,8 +1459,8 @@
 int split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
 	      unsigned long addr, int new_below)
 {
+	struct mempolicy *pol;
 	struct vm_area_struct *new;
-	struct address_space *mapping = NULL;
 
 	if (mm->map_count >= sysctl_max_map_count)
 		return -ENOMEM;
@@ -1214,8 +1471,7 @@
 
 	/* most fields are the same, copy all, and then fixup */
 	*new = *vma;
-
-	INIT_LIST_HEAD(&new->shared);
+	vma_prio_tree_init(new);
 
 	if (new_below)
 		new->vm_end = addr;
@@ -1224,30 +1480,24 @@
 		new->vm_pgoff += ((addr - vma->vm_start) >> PAGE_SHIFT);
 	}
 
+	pol = mpol_copy(vma_policy(vma));
+	if (IS_ERR(pol)) {
+		kmem_cache_free(vm_area_cachep, new);
+		return PTR_ERR(pol);
+	}
+	vma_set_policy(new, pol);
+
 	if (new->vm_file)
 		get_file(new->vm_file);
 
 	if (new->vm_ops && new->vm_ops->open)
 		new->vm_ops->open(new);
 
-	if (vma->vm_file)
-		 mapping = vma->vm_file->f_mapping;
-
-	if (mapping)
-		down(&mapping->i_shared_sem);
-	spin_lock(&mm->page_table_lock);
-
-	if (new_below) {
-		vma->vm_start = addr;
-		vma->vm_pgoff += ((addr - new->vm_start) >> PAGE_SHIFT);
-	} else
-		vma->vm_end = addr;
-
-	__insert_vm_struct(mm, new);
-
-	spin_unlock(&mm->page_table_lock);
-	if (mapping)
-		up(&mapping->i_shared_sem);
+	if (new_below)
+		vma_adjust(vma, addr, vma->vm_end, vma->vm_pgoff +
+			((addr - new->vm_start) >> PAGE_SHIFT), new);
+	else
+		vma_adjust(vma, vma->vm_start, addr, vma->vm_pgoff, new);
 
 	return 0;
 }
@@ -1314,8 +1564,8 @@
 	/*
 	 * Remove the vma's, and unmap the actual pages
 	 */
-	spin_lock(&mm->page_table_lock);
 	detach_vmas_to_be_unmapped(mm, mpnt, prev, end);
+	spin_lock(&mm->page_table_lock);
 	unmap_region(mm, mpnt, prev, start, end);
 	spin_unlock(&mm->page_table_lock);
 
@@ -1349,6 +1599,7 @@
 	struct vm_area_struct * vma, * prev;
 	unsigned long flags;
 	struct rb_node ** rb_link, * rb_parent;
+	pgoff_t pgoff = addr >> PAGE_SHIFT;
 
 	len = PAGE_ALIGN(len);
 	if (!len)
@@ -1391,9 +1642,9 @@
 
 	flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
 
-	/* Can we just expand an old anonymous mapping? */
-	if (rb_parent && vma_merge(mm, prev, rb_parent, addr, addr + len,
-					flags, NULL, 0))
+	/* Can we just expand an old private anonymous mapping? */
+	if (vma_merge(mm, prev, addr, addr + len, flags,
+					NULL, NULL, pgoff, NULL))
 		goto out;
 
 	/*
@@ -1404,20 +1655,15 @@
 		vm_unacct_memory(len >> PAGE_SHIFT);
 		return -ENOMEM;
 	}
+	memset(vma, 0, sizeof(*vma));
 
 	vma->vm_mm = mm;
 	vma->vm_start = addr;
 	vma->vm_end = addr + len;
+	vma->vm_pgoff = pgoff;
 	vma->vm_flags = flags;
 	vma->vm_page_prot = protection_map[flags & 0x0f];
-	vma->vm_ops = NULL;
-	vma->vm_pgoff = 0;
-	vma->vm_file = NULL;
-	vma->vm_private_data = NULL;
-	INIT_LIST_HEAD(&vma->shared);
-
 	vma_link(mm, vma, prev, rb_link, rb_parent);
-
 out:
 	mm->total_vm += len >> PAGE_SHIFT;
 	if (flags & VM_LOCKED) {
@@ -1467,27 +1713,36 @@
 	 */
 	while (vma) {
 		struct vm_area_struct *next = vma->vm_next;
-		remove_shared_vm_struct(vma);
-		if (vma->vm_ops) {
-			if (vma->vm_ops->close)
-				vma->vm_ops->close(vma);
-		}
-		if (vma->vm_file)
-			fput(vma->vm_file);
-		kmem_cache_free(vm_area_cachep, vma);
+		remove_vm_struct(vma);
 		vma = next;
 	}
 }
 
 /* Insert vm structure into process list sorted by address
- * and into the inode's i_mmap ring.  If vm_file is non-NULL
- * then i_shared_sem is taken here.
+ * and into the inode's i_mmap tree.  If vm_file is non-NULL
+ * then i_mmap_lock is taken here.
  */
 void insert_vm_struct(struct mm_struct * mm, struct vm_area_struct * vma)
 {
 	struct vm_area_struct * __vma, * prev;
 	struct rb_node ** rb_link, * rb_parent;
 
+	/*
+	 * The vm_pgoff of a purely anonymous vma should be irrelevant
+	 * until its first write fault, when page's anon_vma and index
+	 * are set.  But now set the vm_pgoff it will almost certainly
+	 * end up with (unless mremap moves it elsewhere before that
+	 * first wfault), so /proc/pid/maps tells a consistent story.
+	 *
+	 * By setting it to reflect the virtual start address of the
+	 * vma, merges and splits can happen in a seamless way, just
+	 * using the existing file pgoff checks and manipulations.
+	 * Similarly in do_mmap_pgoff and in do_brk.
+	 */
+	if (!vma->vm_file) {
+		BUG_ON(vma->anon_vma);
+		vma->vm_pgoff = vma->vm_start >> PAGE_SHIFT;
+	}
 	__vma = find_vma_prepare(mm,vma->vm_start,&prev,&rb_link,&rb_parent);
 	if (__vma && __vma->vm_start < vma->vm_end)
 		BUG();
@@ -1499,17 +1754,25 @@
  * prior to moving page table entries, to effect an mremap move.
  */
 struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
-	unsigned long addr, unsigned long len, unsigned long pgoff)
+	unsigned long addr, unsigned long len, pgoff_t pgoff)
 {
 	struct vm_area_struct *vma = *vmap;
 	unsigned long vma_start = vma->vm_start;
 	struct mm_struct *mm = vma->vm_mm;
 	struct vm_area_struct *new_vma, *prev;
 	struct rb_node **rb_link, *rb_parent;
+	struct mempolicy *pol;
+
+	/*
+	 * If anonymous vma has not yet been faulted, update new pgoff
+	 * to match new location, to increase its chance of merging.
+	 */
+	if (!vma->vm_file && !vma->anon_vma)
+		pgoff = addr >> PAGE_SHIFT;
 
 	find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);
-	new_vma = vma_merge(mm, prev, rb_parent, addr, addr + len,
-			vma->vm_flags, vma->vm_file, pgoff);
+	new_vma = vma_merge(mm, prev, addr, addr + len, vma->vm_flags,
+			vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma));
 	if (new_vma) {
 		/*
 		 * Source vma may have been merged into new_vma
@@ -1521,7 +1784,13 @@
 		new_vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 		if (new_vma) {
 			*new_vma = *vma;
-			INIT_LIST_HEAD(&new_vma->shared);
+			vma_prio_tree_init(new_vma);
+			pol = mpol_copy(vma_policy(vma));
+			if (IS_ERR(pol)) {
+				kmem_cache_free(vm_area_cachep, new_vma);
+				return NULL;
+			}
+			vma_set_policy(new_vma, pol);
 			new_vma->vm_start = addr;
 			new_vma->vm_end = addr + len;
 			new_vma->vm_pgoff = pgoff;
diff -Nru a/mm/mprotect.c b/mm/mprotect.c
--- a/mm/mprotect.c	Tue Jun 15 22:21:05 2004
+++ b/mm/mprotect.c	Tue Jun 15 22:21:05 2004
@@ -16,6 +16,7 @@
 #include <linux/fs.h>
 #include <linux/highmem.h>
 #include <linux/security.h>
+#include <linux/mempolicy.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgalloc.h>
@@ -106,50 +107,6 @@
 	spin_unlock(&current->mm->page_table_lock);
 	return;
 }
-/*
- * Try to merge a vma with the previous flag, return 1 if successful or 0 if it
- * was impossible.
- */
-static int
-mprotect_attempt_merge(struct vm_area_struct *vma, struct vm_area_struct *prev,
-		unsigned long end, int newflags)
-{
-	struct mm_struct * mm;
-
-	if (!prev || !vma)
-		return 0;
-	mm = vma->vm_mm;
-	if (prev->vm_end != vma->vm_start)
-		return 0;
-	if (!can_vma_merge(prev, newflags))
-		return 0;
-	if (vma->vm_file || (vma->vm_flags & VM_SHARED))
-		return 0;
-
-	/*
-	 * If the whole area changes to the protection of the previous one
-	 * we can just get rid of it.
-	 */
-	if (end == vma->vm_end) {
-		spin_lock(&mm->page_table_lock);
-		prev->vm_end = end;
-		__vma_unlink(mm, vma, prev);
-		spin_unlock(&mm->page_table_lock);
-
-		kmem_cache_free(vm_area_cachep, vma);
-		mm->map_count--;
-		return 1;
-	} 
-
-	/*
-	 * Otherwise extend it.
-	 */
-	spin_lock(&mm->page_table_lock);
-	prev->vm_end = end;
-	vma->vm_start = end;
-	spin_unlock(&mm->page_table_lock);
-	return 1;
-}
 
 static int
 mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
@@ -158,6 +115,7 @@
 	struct mm_struct * mm = vma->vm_mm;
 	unsigned long charged = 0;
 	pgprot_t newprot;
+	pgoff_t pgoff;
 	int error;
 
 	if (newflags == vma->vm_flags) {
@@ -174,8 +132,7 @@
 	 * a MAP_NORESERVE private mapping to writable will now reserve.
 	 */
 	if (newflags & VM_WRITE) {
-		if (!(vma->vm_flags & (VM_ACCOUNT|VM_WRITE|VM_SHARED))
-				&& VM_MAYACCT(vma)) {
+		if (!(vma->vm_flags & (VM_ACCOUNT|VM_WRITE|VM_SHARED|VM_HUGETLB))) {
 			charged = (end - start) >> PAGE_SHIFT;
 			if (security_vm_enough_memory(charged))
 				return -ENOMEM;
@@ -185,15 +142,18 @@
 
 	newprot = protection_map[newflags & 0xf];
 
-	if (start == vma->vm_start) {
-		/*
-		 * Try to merge with the previous vma.
-		 */
-		if (mprotect_attempt_merge(vma, *pprev, end, newflags)) {
-			vma = *pprev;
-			goto success;
-		}
-	} else {
+	/*
+	 * First try to merge with previous and/or next vma.
+	 */
+	pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
+	*pprev = vma_merge(mm, *pprev, start, end, newflags,
+			vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma));
+	if (*pprev) {
+		vma = *pprev;
+		goto success;
+	}
+
+	if (start != vma->vm_start) {
 		error = split_vma(mm, vma, start, 1);
 		if (error)
 			goto fail;
@@ -210,11 +170,13 @@
 			goto fail;
 	}
 
-	spin_lock(&mm->page_table_lock);
+success:
+	/*
+	 * vm_flags and vm_page_prot are protected by the mmap_sem
+	 * held in write mode.
+	 */
 	vma->vm_flags = newflags;
 	vma->vm_page_prot = newprot;
-	spin_unlock(&mm->page_table_lock);
-success:
 	change_protection(vma, start, end, newprot);
 	return 0;
 
@@ -227,7 +189,7 @@
 sys_mprotect(unsigned long start, size_t len, unsigned long prot)
 {
 	unsigned long vm_flags, nstart, end, tmp;
-	struct vm_area_struct * vma, * next, * prev;
+	struct vm_area_struct *vma, *prev;
 	int error = -EINVAL;
 	const int grows = prot & (PROT_GROWSDOWN|PROT_GROWSUP);
 	prot &= ~(PROT_GROWSDOWN|PROT_GROWSUP);
@@ -271,10 +233,11 @@
 				goto out;
 		}
 	}
+	if (start > vma->vm_start)
+		prev = vma;
 
 	for (nstart = start ; ; ) {
 		unsigned int newflags;
-		int last = 0;
 
 		/* Here we know that  vma->vm_start <= nstart < vma->vm_end. */
 
@@ -294,38 +257,24 @@
 		if (error)
 			goto out;
 
-		if (vma->vm_end > end) {
-			error = mprotect_fixup(vma, &prev, nstart, end, newflags);
-			goto out;
-		}
-		if (vma->vm_end == end)
-			last = 1;
-
 		tmp = vma->vm_end;
-		next = vma->vm_next;
+		if (tmp > end)
+			tmp = end;
 		error = mprotect_fixup(vma, &prev, nstart, tmp, newflags);
 		if (error)
 			goto out;
-		if (last)
-			break;
 		nstart = tmp;
-		vma = next;
+
+		if (nstart < prev->vm_end)
+			nstart = prev->vm_end;
+		if (nstart >= end)
+			goto out;
+
+		vma = prev->vm_next;
 		if (!vma || vma->vm_start != nstart) {
 			error = -ENOMEM;
 			goto out;
 		}
-	}
-
-	if (next && prev->vm_end == next->vm_start &&
-			can_vma_merge(next, prev->vm_flags) &&
-			!prev->vm_file && !(prev->vm_flags & VM_SHARED)) {
-		spin_lock(&prev->vm_mm->page_table_lock);
-		prev->vm_end = next->vm_end;
-		__vma_unlink(prev->vm_mm, next, prev);
-		spin_unlock(&prev->vm_mm->page_table_lock);
-
-		kmem_cache_free(vm_area_cachep, next);
-		prev->vm_mm->map_count--;
 	}
 out:
 	up_write(&current->mm->mmap_sem);
diff -Nru a/mm/mremap.c b/mm/mremap.c
--- a/mm/mremap.c	Tue Jun 15 22:20:41 2004
+++ b/mm/mremap.c	Tue Jun 15 22:20:41 2004
@@ -15,7 +15,6 @@
 #include <linux/swap.h>
 #include <linux/fs.h>
 #include <linux/highmem.h>
-#include <linux/rmap.h>
 #include <linux/security.h>
 
 #include <asm/uaccess.h>
@@ -56,16 +55,18 @@
 	return pte;
 }
 
-static inline int page_table_present(struct mm_struct *mm, unsigned long addr)
+static pte_t *get_one_pte_map(struct mm_struct *mm, unsigned long addr)
 {
 	pgd_t *pgd;
 	pmd_t *pmd;
 
 	pgd = pgd_offset(mm, addr);
 	if (pgd_none(*pgd))
-		return 0;
+		return NULL;
 	pmd = pmd_offset(pgd, addr);
-	return pmd_present(*pmd);
+	if (!pmd_present(*pmd))
+		return NULL;
+	return pte_offset_map(pmd, addr);
 }
 
 static inline pte_t *alloc_one_pte_map(struct mm_struct *mm, unsigned long addr)
@@ -79,38 +80,27 @@
 	return pte;
 }
 
-static void
-copy_one_pte(struct vm_area_struct *vma, unsigned long old_addr,
-	     pte_t *src, pte_t *dst, struct pte_chain **pte_chainp)
-{
-	pte_t pte = ptep_clear_flush(vma, old_addr, src);
-	set_pte(dst, pte);
-
-	if (pte_present(pte)) {
-		unsigned long pfn = pte_pfn(pte);
-		if (pfn_valid(pfn)) {
-			struct page *page = pfn_to_page(pfn);
-			page_remove_rmap(page, src);
-			*pte_chainp = page_add_rmap(page, dst, *pte_chainp);
-		}
-	}
-}
-
 static int
 move_one_page(struct vm_area_struct *vma, unsigned long old_addr,
 		unsigned long new_addr)
 {
+	struct address_space *mapping = NULL;
 	struct mm_struct *mm = vma->vm_mm;
 	int error = 0;
 	pte_t *src, *dst;
-	struct pte_chain *pte_chain;
 
-	pte_chain = pte_chain_alloc(GFP_KERNEL);
-	if (!pte_chain) {
-		error = -ENOMEM;
-		goto out;
+	if (vma->vm_file) {
+		/*
+		 * Subtle point from Rajesh Venkatasubramanian: before
+		 * moving file-based ptes, we must lock vmtruncate out,
+		 * since it might clean the dst vma before the src vma,
+		 * and we propagate stale pages into the dst afterward.
+		 */
+		mapping = vma->vm_file->f_mapping;
+		spin_lock(&mapping->i_mmap_lock);
 	}
 	spin_lock(&mm->page_table_lock);
+
 	src = get_one_pte_map_nested(mm, old_addr);
 	if (src) {
 		/*
@@ -118,22 +108,29 @@
 		 * memory allocation.  If it does then we need to drop the
 		 * atomic kmap
 		 */
-		if (!page_table_present(mm, new_addr)) {
+		dst = get_one_pte_map(mm, new_addr);
+		if (unlikely(!dst)) {
 			pte_unmap_nested(src);
-			src = NULL;
-		}
-		dst = alloc_one_pte_map(mm, new_addr);
-		if (src == NULL)
+			if (mapping)
+				spin_unlock(&mapping->i_mmap_lock);
+			dst = alloc_one_pte_map(mm, new_addr);
+			if (mapping && !spin_trylock(&mapping->i_mmap_lock)) {
+				spin_unlock(&mm->page_table_lock);
+				spin_lock(&mapping->i_mmap_lock);
+				spin_lock(&mm->page_table_lock);
+			}
 			src = get_one_pte_map_nested(mm, old_addr);
+		}
 		/*
 		 * Since alloc_one_pte_map can drop and re-acquire
 		 * page_table_lock, we should re-check the src entry...
 		 */
 		if (src) {
-			if (dst)
-				copy_one_pte(vma, old_addr, src,
-						dst, &pte_chain);
-			else
+			if (dst) {
+				pte_t pte;
+				pte = ptep_clear_flush(vma, old_addr, src);
+				set_pte(dst, pte);
+			} else
 				error = -ENOMEM;
 			pte_unmap_nested(src);
 		}
@@ -141,13 +138,14 @@
 			pte_unmap(dst);
 	}
 	spin_unlock(&mm->page_table_lock);
-	pte_chain_free(pte_chain);
-out:
+	if (mapping)
+		spin_unlock(&mapping->i_mmap_lock);
 	return error;
 }
 
 static unsigned long move_page_tables(struct vm_area_struct *vma,
-	unsigned long new_addr, unsigned long old_addr, unsigned long len)
+		unsigned long new_addr, unsigned long old_addr,
+		unsigned long len)
 {
 	unsigned long offset;
 
@@ -161,6 +159,7 @@
 	for (offset = 0; offset < len; offset += PAGE_SIZE) {
 		if (move_one_page(vma, old_addr+offset, new_addr+offset) < 0)
 			break;
+		cond_resched();
 	}
 	return offset;
 }
@@ -170,7 +169,6 @@
 		unsigned long new_len, unsigned long new_addr)
 {
 	struct mm_struct *mm = vma->vm_mm;
-	struct address_space *mapping = NULL;
 	struct vm_area_struct *new_vma;
 	unsigned long vm_flags = vma->vm_flags;
 	unsigned long new_pgoff;
@@ -190,16 +188,6 @@
 	if (!new_vma)
 		return -ENOMEM;
 
-	if (vma->vm_file) {
-		/*
-		 * Subtle point from Rajesh Venkatasubramanian: before
-		 * moving file-based ptes, we must lock vmtruncate out,
-		 * since it might clean the dst vma before the src vma,
-		 * and we propagate stale pages into the dst afterward.
-		 */
-		mapping = vma->vm_file->f_mapping;
-		down(&mapping->i_shared_sem);
-	}
 	moved_len = move_page_tables(vma, new_addr, old_addr, old_len);
 	if (moved_len < old_len) {
 		/*
@@ -213,8 +201,6 @@
 		old_addr = new_addr;
 		new_addr = -ENOMEM;
 	}
-	if (mapping)
-		up(&mapping->i_shared_sem);
 
 	/* Conceal VM_ACCOUNT so old reservation is not undone */
 	if (vm_flags & VM_ACCOUNT) {
@@ -368,9 +354,10 @@
 		/* can we just expand the current mapping? */
 		if (max_addr - addr >= new_len) {
 			int pages = (new_len - old_len) >> PAGE_SHIFT;
-			spin_lock(&vma->vm_mm->page_table_lock);
-			vma->vm_end = addr + new_len;
-			spin_unlock(&vma->vm_mm->page_table_lock);
+
+			vma_adjust(vma, vma->vm_start,
+				addr + new_len, vma->vm_pgoff, NULL);
+
 			current->mm->total_vm += pages;
 			if (vma->vm_flags & VM_LOCKED) {
 				current->mm->locked_vm += pages;
diff -Nru a/mm/msync.c b/mm/msync.c
--- a/mm/msync.c	Tue Jun 15 22:20:39 2004
+++ b/mm/msync.c	Tue Jun 15 22:20:39 2004
@@ -11,6 +11,7 @@
 #include <linux/pagemap.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
+#include <linux/hugetlb.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -106,6 +107,13 @@
 
 	dir = pgd_offset(vma->vm_mm, address);
 	flush_cache_range(vma, address, end);
+
+	/* For hugepages we can't go walking the page table normally,
+	 * but that's ok, hugetlbfs is memory based, so we don't need
+	 * to do anything more on an msync() */
+	if (is_vm_hugetlb_page(vma))
+		goto out;
+
 	if (address >= end)
 		BUG();
 	do {
@@ -118,7 +126,7 @@
 	 * dirty bits.
 	 */
 	flush_tlb_range(vma, end - size, end);
-
+ out:
 	spin_unlock(&vma->vm_mm->page_table_lock);
 
 	return error;
diff -Nru a/mm/nommu.c b/mm/nommu.c
--- a/mm/nommu.c	Tue Jun 15 22:20:44 2004
+++ b/mm/nommu.c	Tue Jun 15 22:20:44 2004
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/blkdev.h>
+#include <linux/backing-dev.h>
 
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
@@ -33,6 +34,9 @@
 int sysctl_overcommit_memory; /* default is heuristic overcommit */
 int sysctl_overcommit_ratio = 50; /* default is 50% */
 
+int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
+EXPORT_SYMBOL(sysctl_max_map_count);
+
 /*
  * Handle all mappings that got truncated by a "truncate()"
  * system call.
@@ -485,7 +489,7 @@
 	show_process_blocks();
 #endif	  
 
-	return -EINVAL;
+	return 0;
 }
 
 /* Release all mmaps. */
@@ -568,6 +572,6 @@
 	return -ENOMEM;
 }
 
-void pte_chain_init(void)
+void swap_unplug_io_fn(struct backing_dev_info *)
 {
 }
diff -Nru a/mm/oom_kill.c b/mm/oom_kill.c
--- a/mm/oom_kill.c	Tue Jun 15 22:20:41 2004
+++ b/mm/oom_kill.c	Tue Jun 15 22:20:41 2004
@@ -245,7 +245,6 @@
 	 * If it's been a long time since last failure,
 	 * we're not oom.
 	 */
-	last = now;
 	if (since > 5*HZ)
 		goto reset;
 
diff -Nru a/mm/page-writeback.c b/mm/page-writeback.c
--- a/mm/page-writeback.c	Tue Jun 15 22:20:42 2004
+++ b/mm/page-writeback.c	Tue Jun 15 22:20:42 2004
@@ -92,11 +92,29 @@
  */
 int laptop_mode;
 
+EXPORT_SYMBOL(laptop_mode);
+
 /* End of sysctl-exported parameters */
 
 
 static void background_writeout(unsigned long _min_pages);
 
+struct writeback_state
+{
+	unsigned long nr_dirty;
+	unsigned long nr_unstable;
+	unsigned long nr_mapped;
+	unsigned long nr_writeback;
+};
+
+static void get_writeback_state(struct writeback_state *wbs)
+{
+	wbs->nr_dirty = read_page_state(nr_dirty);
+	wbs->nr_unstable = read_page_state(nr_unstable);
+	wbs->nr_mapped = read_page_state(nr_mapped);
+	wbs->nr_writeback = read_page_state(nr_writeback);
+}
+
 /*
  * Work out the current dirty-memory clamping and background writeout
  * thresholds.
@@ -115,7 +133,7 @@
  * clamping level.
  */
 static void
-get_dirty_limits(struct page_state *ps, long *pbackground, long *pdirty)
+get_dirty_limits(struct writeback_state *wbs, long *pbackground, long *pdirty)
 {
 	int background_ratio;		/* Percentages */
 	int dirty_ratio;
@@ -124,9 +142,9 @@
 	long dirty;
 	struct task_struct *tsk;
 
-	get_page_state(ps);
+	get_writeback_state(wbs);
 
-	unmapped_ratio = 100 - (ps->nr_mapped * 100) / total_pages;
+	unmapped_ratio = 100 - (wbs->nr_mapped * 100) / total_pages;
 
 	dirty_ratio = vm_dirty_ratio;
 	if (dirty_ratio > unmapped_ratio / 2)
@@ -159,7 +177,7 @@
  */
 static void balance_dirty_pages(struct address_space *mapping)
 {
-	struct page_state ps;
+	struct writeback_state wbs;
 	long nr_reclaimable;
 	long background_thresh;
 	long dirty_thresh;
@@ -176,9 +194,9 @@
 			.nr_to_write	= write_chunk,
 		};
 
-		get_dirty_limits(&ps, &background_thresh, &dirty_thresh);
-		nr_reclaimable = ps.nr_dirty + ps.nr_unstable;
-		if (nr_reclaimable + ps.nr_writeback <= dirty_thresh)
+		get_dirty_limits(&wbs, &background_thresh, &dirty_thresh);
+		nr_reclaimable = wbs.nr_dirty + wbs.nr_unstable;
+		if (nr_reclaimable + wbs.nr_writeback <= dirty_thresh)
 			break;
 
 		dirty_exceeded = 1;
@@ -191,10 +209,10 @@
 		 */
 		if (nr_reclaimable) {
 			writeback_inodes(&wbc);
-			get_dirty_limits(&ps, &background_thresh,
+			get_dirty_limits(&wbs, &background_thresh,
 					&dirty_thresh);
-			nr_reclaimable = ps.nr_dirty + ps.nr_unstable;
-			if (nr_reclaimable + ps.nr_writeback <= dirty_thresh)
+			nr_reclaimable = wbs.nr_dirty + wbs.nr_unstable;
+			if (nr_reclaimable + wbs.nr_writeback <= dirty_thresh)
 				break;
 			pages_written += write_chunk - wbc.nr_to_write;
 			if (pages_written >= write_chunk)
@@ -203,7 +221,7 @@
 		blk_congestion_wait(WRITE, HZ/10);
 	}
 
-	if (nr_reclaimable + ps.nr_writeback <= dirty_thresh)
+	if (nr_reclaimable + wbs.nr_writeback <= dirty_thresh)
 		dirty_exceeded = 0;
 
 	if (writeback_in_progress(bdi))
@@ -230,10 +248,10 @@
  * which was newly dirtied.  The function will periodically check the system's
  * dirty state and will initiate writeback if needed.
  *
- * On really big machines, get_page_state is expensive, so try to avoid calling
- * it too often (ratelimiting).  But once we're over the dirty memory limit we
- * decrease the ratelimiting by a lot, to prevent individual processes from
- * overshooting the limit by (ratelimit_pages) each.
+ * On really big machines, get_writeback_state is expensive, so try to avoid
+ * calling it too often (ratelimiting).  But once we're over the dirty memory
+ * limit we decrease the ratelimiting by a lot, to prevent individual processes
+ * from overshooting the limit by (ratelimit_pages) each.
  */
 void balance_dirty_pages_ratelimited(struct address_space *mapping)
 {
@@ -274,12 +292,12 @@
 	};
 
 	for ( ; ; ) {
-		struct page_state ps;
+		struct writeback_state wbs;
 		long background_thresh;
 		long dirty_thresh;
 
-		get_dirty_limits(&ps, &background_thresh, &dirty_thresh);
-		if (ps.nr_dirty + ps.nr_unstable < background_thresh
+		get_dirty_limits(&wbs, &background_thresh, &dirty_thresh);
+		if (wbs.nr_dirty + wbs.nr_unstable < background_thresh
 				&& min_pages <= 0)
 			break;
 		wbc.encountered_congestion = 0;
@@ -304,10 +322,10 @@
 int wakeup_bdflush(long nr_pages)
 {
 	if (nr_pages == 0) {
-		struct page_state ps;
+		struct writeback_state wbs;
 
-		get_page_state(&ps);
-		nr_pages = ps.nr_dirty + ps.nr_unstable;
+		get_writeback_state(&wbs);
+		nr_pages = wbs.nr_dirty + wbs.nr_unstable;
 	}
 	return pdflush_operation(background_writeout, nr_pages);
 }
@@ -341,7 +359,7 @@
 	unsigned long start_jif;
 	unsigned long next_jif;
 	long nr_to_write;
-	struct page_state ps;
+	struct writeback_state wbs;
 	struct writeback_control wbc = {
 		.bdi		= NULL,
 		.sync_mode	= WB_SYNC_NONE,
@@ -353,11 +371,11 @@
 
 	sync_supers();
 
-	get_page_state(&ps);
+	get_writeback_state(&wbs);
 	oldest_jif = jiffies - (dirty_expire_centisecs * HZ) / 100;
 	start_jif = jiffies;
 	next_jif = start_jif + (dirty_writeback_centisecs * HZ) / 100;
-	nr_to_write = ps.nr_dirty + ps.nr_unstable +
+	nr_to_write = wbs.nr_dirty + wbs.nr_unstable +
 			(inodes_stat.nr_inodes - inodes_stat.nr_unused);
 	while (nr_to_write > 0) {
 		wbc.encountered_congestion = 0;
@@ -432,8 +450,8 @@
 /*
  * If ratelimit_pages is too high then we can get into dirty-data overload
  * if a large number of processes all perform writes at the same time.
- * If it is too low then SMP machines will call the (expensive) get_page_state
- * too often.
+ * If it is too low then SMP machines will call the (expensive)
+ * get_writeback_state too often.
  *
  * Here we set ratelimit_pages to a level which ensures that when all CPUs are
  * dirtying in parallel, we cannot go more than 3% (1/32) over the dirty memory
@@ -545,34 +563,40 @@
  * For address_spaces which do not use buffers.  Just tag the page as dirty in
  * its radix tree.
  *
- * __set_page_dirty_nobuffers() may return -ENOSPC.  But if it does, the page
- * is still safe, as long as it actually manages to find some blocks at
- * writeback time.
- *
  * This is also used when a single buffer is being dirtied: we want to set the
  * page dirty in that case, but not all the buffers.  This is a "bottom-up"
  * dirtying, whereas __set_page_dirty_buffers() is a "top-down" dirtying.
+ *
+ * Most callers have locked the page, which pins the address_space in memory.
+ * But zap_pte_range() does not lock the page, however in that case the
+ * mapping is pinned by the vma's ->vm_file reference.
+ *
+ * We take care to handle the case where the page was truncated from the
+ * mapping by re-checking page_mapping() insode tree_lock.
  */
 int __set_page_dirty_nobuffers(struct page *page)
 {
 	int ret = 0;
 
 	if (!TestSetPageDirty(page)) {
-		struct address_space *mapping = page->mapping;
+		struct address_space *mapping = page_mapping(page);
 
 		if (mapping) {
 			spin_lock_irq(&mapping->tree_lock);
-			if (page->mapping) {	/* Race with truncate? */
-				BUG_ON(page->mapping != mapping);
+			mapping = page_mapping(page);
+			if (page_mapping(page)) { /* Race with truncate? */
+				BUG_ON(page_mapping(page) != mapping);
 				if (!mapping->backing_dev_info->memory_backed)
 					inc_page_state(nr_dirty);
 				radix_tree_tag_set(&mapping->page_tree,
-					page->index, PAGECACHE_TAG_DIRTY);
+					page_index(page), PAGECACHE_TAG_DIRTY);
 			}
 			spin_unlock_irq(&mapping->tree_lock);
-			if (!PageSwapCache(page))
+			if (mapping->host) {
+				/* !PageAnon && !swapper_space */
 				__mark_inode_dirty(mapping->host,
 							I_DIRTY_PAGES);
+			}
 		}
 	}
 	return ret;
@@ -598,14 +622,16 @@
 int fastcall set_page_dirty(struct page *page)
 {
 	struct address_space *mapping = page_mapping(page);
-	int (*spd)(struct page *);
 
-	if (!mapping) {
-		SetPageDirty(page);
-		return 0;
+	if (likely(mapping)) {
+		int (*spd)(struct page *) = mapping->a_ops->set_page_dirty;
+		if (spd)
+			return (*spd)(page);
+		return __set_page_dirty_buffers(page);
 	}
-	spd = mapping->a_ops->set_page_dirty;
-	return spd? (*spd)(page): __set_page_dirty_buffers(page);
+	if (!PageDirty(page))
+		SetPageDirty(page);
+	return 0;
 }
 EXPORT_SYMBOL(set_page_dirty);
 
@@ -642,7 +668,8 @@
 	if (mapping) {
 		spin_lock_irqsave(&mapping->tree_lock, flags);
 		if (TestClearPageDirty(page)) {
-			radix_tree_tag_clear(&mapping->page_tree, page->index,
+			radix_tree_tag_clear(&mapping->page_tree,
+						page_index(page),
 						PAGECACHE_TAG_DIRTY);
 			spin_unlock_irqrestore(&mapping->tree_lock, flags);
 			if (!mapping->backing_dev_info->memory_backed)
@@ -698,7 +725,8 @@
 
 		spin_lock_irqsave(&mapping->tree_lock, flags);
 		if (TestClearPageDirty(page)) {
-			radix_tree_tag_clear(&mapping->page_tree, page->index,
+			radix_tree_tag_clear(&mapping->page_tree,
+						page_index(page),
 						PAGECACHE_TAG_DIRTY);
 			spin_unlock_irqrestore(&mapping->tree_lock, flags);
 			return 1;
@@ -720,7 +748,8 @@
 		spin_lock_irqsave(&mapping->tree_lock, flags);
 		ret = TestClearPageWriteback(page);
 		if (ret)
-			radix_tree_tag_clear(&mapping->page_tree, page->index,
+			radix_tree_tag_clear(&mapping->page_tree,
+						page_index(page),
 						PAGECACHE_TAG_WRITEBACK);
 		spin_unlock_irqrestore(&mapping->tree_lock, flags);
 	} else {
@@ -740,10 +769,12 @@
 		spin_lock_irqsave(&mapping->tree_lock, flags);
 		ret = TestSetPageWriteback(page);
 		if (!ret)
-			radix_tree_tag_set(&mapping->page_tree, page->index,
+			radix_tree_tag_set(&mapping->page_tree,
+						page_index(page),
 						PAGECACHE_TAG_WRITEBACK);
 		if (!PageDirty(page))
-			radix_tree_tag_clear(&mapping->page_tree, page->index,
+			radix_tree_tag_clear(&mapping->page_tree,
+						page_index(page),
 						PAGECACHE_TAG_DIRTY);
 		spin_unlock_irqrestore(&mapping->tree_lock, flags);
 	} else {
diff -Nru a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c	Tue Jun 15 22:20:36 2004
+++ b/mm/page_alloc.c	Tue Jun 15 22:20:36 2004
@@ -73,9 +73,9 @@
 {
 	printk(KERN_EMERG "Bad page state at %s (in process '%s', page %p)\n",
 		function, current->comm, page);
-	printk(KERN_EMERG "flags:0x%08lx mapping:%p mapped:%d count:%d\n",
+	printk(KERN_EMERG "flags:0x%08lx mapping:%p mapcount:%d count:%d\n",
 		(unsigned long)page->flags, page->mapping,
-		page_mapped(page), page_count(page));
+		(int)page->mapcount, page_count(page));
 	printk(KERN_EMERG "Backtrace:\n");
 	dump_stack();
 	printk(KERN_EMERG "Trying to fix it up, but a reboot is needed\n");
@@ -90,6 +90,7 @@
 			1 << PG_writeback);
 	set_page_count(page, 0);
 	page->mapping = NULL;
+	page->mapcount = 0;
 }
 
 #ifndef CONFIG_HUGETLB_PAGE
@@ -460,6 +461,32 @@
 }
 #endif /* CONFIG_PM */
 
+static void zone_statistics(struct zonelist *zonelist, struct zone *z)
+{
+#ifdef CONFIG_NUMA
+	unsigned long flags;
+	int cpu;
+	pg_data_t *pg = z->zone_pgdat;
+	pg_data_t *orig = zonelist->zones[0]->zone_pgdat;
+	struct per_cpu_pageset *p;
+
+	local_irq_save(flags);
+	cpu = smp_processor_id();
+	p = &z->pageset[cpu];
+	if (pg == orig) {
+		z->pageset[cpu].numa_hit++;
+	} else {
+		p->numa_miss++;
+		zonelist->zones[0]->pageset[cpu].numa_foreign++;
+	}
+	if (pg == NODE_DATA(numa_node_id()))
+		p->local_node++;
+	else
+		p->other_node++;
+	local_irq_restore(flags);
+#endif
+}
+
 /*
  * Free a 0-order page
  */
@@ -593,8 +620,10 @@
 		if (z->free_pages >= min ||
 				(!wait && z->free_pages >= z->pages_high)) {
 			page = buffered_rmqueue(z, order, gfp_mask);
-			if (page)
+			if (page) {
+				zone_statistics(zonelist, z);
 				goto got_pg;
+			}
 		}
 	}
 
@@ -616,8 +645,10 @@
 		if (z->free_pages >= min ||
 				(!wait && z->free_pages >= z->pages_high)) {
 			page = buffered_rmqueue(z, order, gfp_mask);
-			if (page)
+			if (page) {
+				zone_statistics(zonelist, z);
 				goto got_pg;
+			}
 		}
 	}
 
@@ -630,8 +661,10 @@
 			struct zone *z = zones[i];
 
 			page = buffered_rmqueue(z, order, gfp_mask);
-			if (page)
+			if (page) {
+				zone_statistics(zonelist, z);
 				goto got_pg;
+			}
 		}
 		goto nopage;
 	}
@@ -658,8 +691,10 @@
 		if (z->free_pages >= min ||
 				(!wait && z->free_pages >= z->pages_high)) {
 			page = buffered_rmqueue(z, order, gfp_mask);
-			if (page)
+			if (page) {
+ 				zone_statistics(zonelist, z);
 				goto got_pg;
+			}
 		}
 	}
 
@@ -953,6 +988,23 @@
 	__get_page_state(ret, sizeof(*ret) / sizeof(unsigned long));
 }
 
+unsigned long __read_page_state(unsigned offset)
+{
+	unsigned long ret = 0;
+	int cpu;
+
+	for (cpu = 0; cpu < NR_CPUS; cpu++) {
+		unsigned long in;
+
+		if (!cpu_possible(cpu))
+			continue;
+
+		in = (unsigned long)&per_cpu(page_states, cpu) + offset;
+		ret += *((unsigned long *)in);
+	}
+	return ret;
+}
+
 void get_zone_counts(unsigned long *active,
 		unsigned long *inactive, unsigned long *free)
 {
@@ -1284,7 +1336,7 @@
  		for (node = 0; node < local_node; node++)
  			j = build_zonelists_node(NODE_DATA(node), zonelist, j, k);
  
-		zonelist->zones[j++] = NULL;
+		zonelist->zones[j] = NULL;
 	}
 }
 
diff -Nru a/mm/prio_tree.c b/mm/prio_tree.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/mm/prio_tree.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,663 @@
+/*
+ * mm/prio_tree.c - priority search tree for mapping->i_mmap
+ *
+ * Copyright (C) 2004, Rajesh Venkatasubramanian <vrajesh@umich.edu>
+ *
+ * This file is released under the GPL v2.
+ *
+ * Based on the radix priority search tree proposed by Edward M. McCreight
+ * SIAM Journal of Computing, vol. 14, no.2, pages 257-276, May 1985
+ *
+ * 02Feb2004	Initial version
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/prio_tree.h>
+
+/*
+ * A clever mix of heap and radix trees forms a radix priority search tree (PST)
+ * which is useful for storing intervals, e.g, we can consider a vma as a closed
+ * interval of file pages [offset_begin, offset_end], and store all vmas that
+ * map a file in a PST. Then, using the PST, we can answer a stabbing query,
+ * i.e., selecting a set of stored intervals (vmas) that overlap with (map) a
+ * given input interval X (a set of consecutive file pages), in "O(log n + m)"
+ * time where 'log n' is the height of the PST, and 'm' is the number of stored
+ * intervals (vmas) that overlap (map) with the input interval X (the set of
+ * consecutive file pages).
+ *
+ * In our implementation, we store closed intervals of the form [radix_index,
+ * heap_index]. We assume that always radix_index <= heap_index. McCreight's PST
+ * is designed for storing intervals with unique radix indices, i.e., each
+ * interval have different radix_index. However, this limitation can be easily
+ * overcome by using the size, i.e., heap_index - radix_index, as part of the
+ * index, so we index the tree using [(radix_index,size), heap_index].
+ *
+ * When the above-mentioned indexing scheme is used, theoretically, in a 32 bit
+ * machine, the maximum height of a PST can be 64. We can use a balanced version
+ * of the priority search tree to optimize the tree height, but the balanced
+ * tree proposed by McCreight is too complex and memory-hungry for our purpose.
+ */
+
+/*
+ * The following macros are used for implementing prio_tree for i_mmap
+ */
+
+#define RADIX_INDEX(vma)  ((vma)->vm_pgoff)
+#define VMA_SIZE(vma)	  (((vma)->vm_end - (vma)->vm_start) >> PAGE_SHIFT)
+/* avoid overflow */
+#define HEAP_INDEX(vma)	  ((vma)->vm_pgoff + (VMA_SIZE(vma) - 1))
+
+#define GET_INDEX_VMA(vma, radix, heap)		\
+do {						\
+	radix = RADIX_INDEX(vma);		\
+	heap = HEAP_INDEX(vma);			\
+} while (0)
+
+#define GET_INDEX(node, radix, heap)		\
+do { 						\
+	struct vm_area_struct *__tmp = 		\
+	  prio_tree_entry(node, struct vm_area_struct, shared.prio_tree_node);\
+	GET_INDEX_VMA(__tmp, radix, heap); 	\
+} while (0)
+
+static unsigned long index_bits_to_maxindex[BITS_PER_LONG];
+
+void __init prio_tree_init(void)
+{
+	unsigned int i;
+
+	for (i = 0; i < ARRAY_SIZE(index_bits_to_maxindex) - 1; i++)
+		index_bits_to_maxindex[i] = (1UL << (i + 1)) - 1;
+	index_bits_to_maxindex[ARRAY_SIZE(index_bits_to_maxindex) - 1] = ~0UL;
+}
+
+/*
+ * Maximum heap_index that can be stored in a PST with index_bits bits
+ */
+static inline unsigned long prio_tree_maxindex(unsigned int bits)
+{
+	return index_bits_to_maxindex[bits - 1];
+}
+
+/*
+ * Extend a priority search tree so that it can store a node with heap_index
+ * max_heap_index. In the worst case, this algorithm takes O((log n)^2).
+ * However, this function is used rarely and the common case performance is
+ * not bad.
+ */
+static struct prio_tree_node *prio_tree_expand(struct prio_tree_root *root,
+		struct prio_tree_node *node, unsigned long max_heap_index)
+{
+	static void prio_tree_remove(struct prio_tree_root *,
+					struct prio_tree_node *);
+	struct prio_tree_node *first = NULL, *prev, *last = NULL;
+
+	if (max_heap_index > prio_tree_maxindex(root->index_bits))
+		root->index_bits++;
+
+	while (max_heap_index > prio_tree_maxindex(root->index_bits)) {
+		root->index_bits++;
+
+		if (prio_tree_empty(root))
+			continue;
+
+		if (first == NULL) {
+			first = root->prio_tree_node;
+			prio_tree_remove(root, root->prio_tree_node);
+			INIT_PRIO_TREE_NODE(first);
+			last = first;
+		} else {
+			prev = last;
+			last = root->prio_tree_node;
+			prio_tree_remove(root, root->prio_tree_node);
+			INIT_PRIO_TREE_NODE(last);
+			prev->left = last;
+			last->parent = prev;
+		}
+	}
+
+	INIT_PRIO_TREE_NODE(node);
+
+	if (first) {
+		node->left = first;
+		first->parent = node;
+	} else
+		last = node;
+
+	if (!prio_tree_empty(root)) {
+		last->left = root->prio_tree_node;
+		last->left->parent = last;
+	}
+
+	root->prio_tree_node = node;
+	return node;
+}
+
+/*
+ * Replace a prio_tree_node with a new node and return the old node
+ */
+static struct prio_tree_node *prio_tree_replace(struct prio_tree_root *root,
+		struct prio_tree_node *old, struct prio_tree_node *node)
+{
+	INIT_PRIO_TREE_NODE(node);
+
+	if (prio_tree_root(old)) {
+		BUG_ON(root->prio_tree_node != old);
+		/*
+		 * We can reduce root->index_bits here. However, it is complex
+		 * and does not help much to improve performance (IMO).
+		 */
+		node->parent = node;
+		root->prio_tree_node = node;
+	} else {
+		node->parent = old->parent;
+		if (old->parent->left == old)
+			old->parent->left = node;
+		else
+			old->parent->right = node;
+	}
+
+	if (!prio_tree_left_empty(old)) {
+		node->left = old->left;
+		old->left->parent = node;
+	}
+
+	if (!prio_tree_right_empty(old)) {
+		node->right = old->right;
+		old->right->parent = node;
+	}
+
+	return old;
+}
+
+/*
+ * Insert a prio_tree_node @node into a radix priority search tree @root. The
+ * algorithm typically takes O(log n) time where 'log n' is the number of bits
+ * required to represent the maximum heap_index. In the worst case, the algo
+ * can take O((log n)^2) - check prio_tree_expand.
+ *
+ * If a prior node with same radix_index and heap_index is already found in
+ * the tree, then returns the address of the prior node. Otherwise, inserts
+ * @node into the tree and returns @node.
+ */
+static struct prio_tree_node *prio_tree_insert(struct prio_tree_root *root,
+		struct prio_tree_node *node)
+{
+	struct prio_tree_node *cur, *res = node;
+	unsigned long radix_index, heap_index;
+	unsigned long r_index, h_index, index, mask;
+	int size_flag = 0;
+
+	GET_INDEX(node, radix_index, heap_index);
+
+	if (prio_tree_empty(root) ||
+			heap_index > prio_tree_maxindex(root->index_bits))
+		return prio_tree_expand(root, node, heap_index);
+
+	cur = root->prio_tree_node;
+	mask = 1UL << (root->index_bits - 1);
+
+	while (mask) {
+		GET_INDEX(cur, r_index, h_index);
+
+		if (r_index == radix_index && h_index == heap_index)
+			return cur;
+
+                if (h_index < heap_index ||
+		    (h_index == heap_index && r_index > radix_index)) {
+			struct prio_tree_node *tmp = node;
+			node = prio_tree_replace(root, cur, node);
+			cur = tmp;
+			/* swap indices */
+			index = r_index;
+			r_index = radix_index;
+			radix_index = index;
+			index = h_index;
+			h_index = heap_index;
+			heap_index = index;
+		}
+
+		if (size_flag)
+			index = heap_index - radix_index;
+		else
+			index = radix_index;
+
+		if (index & mask) {
+			if (prio_tree_right_empty(cur)) {
+				INIT_PRIO_TREE_NODE(node);
+				cur->right = node;
+				node->parent = cur;
+				return res;
+			} else
+				cur = cur->right;
+		} else {
+			if (prio_tree_left_empty(cur)) {
+				INIT_PRIO_TREE_NODE(node);
+				cur->left = node;
+				node->parent = cur;
+				return res;
+			} else
+				cur = cur->left;
+		}
+
+		mask >>= 1;
+
+		if (!mask) {
+			mask = 1UL << (root->index_bits - 1);
+			size_flag = 1;
+		}
+	}
+	/* Should not reach here */
+	BUG();
+	return NULL;
+}
+
+/*
+ * Remove a prio_tree_node @node from a radix priority search tree @root. The
+ * algorithm takes O(log n) time where 'log n' is the number of bits required
+ * to represent the maximum heap_index.
+ */
+static void prio_tree_remove(struct prio_tree_root *root,
+		struct prio_tree_node *node)
+{
+	struct prio_tree_node *cur;
+	unsigned long r_index, h_index_right, h_index_left;
+
+	cur = node;
+
+	while (!prio_tree_left_empty(cur) || !prio_tree_right_empty(cur)) {
+		if (!prio_tree_left_empty(cur))
+			GET_INDEX(cur->left, r_index, h_index_left);
+		else {
+			cur = cur->right;
+			continue;
+		}
+
+		if (!prio_tree_right_empty(cur))
+			GET_INDEX(cur->right, r_index, h_index_right);
+		else {
+			cur = cur->left;
+			continue;
+		}
+
+		/* both h_index_left and h_index_right cannot be 0 */
+		if (h_index_left >= h_index_right)
+			cur = cur->left;
+		else
+			cur = cur->right;
+	}
+
+	if (prio_tree_root(cur)) {
+		BUG_ON(root->prio_tree_node != cur);
+		INIT_PRIO_TREE_ROOT(root);
+		return;
+	}
+
+	if (cur->parent->right == cur)
+		cur->parent->right = cur->parent;
+	else
+		cur->parent->left = cur->parent;
+
+	while (cur != node)
+		cur = prio_tree_replace(root, cur->parent, cur);
+}
+
+/*
+ * Following functions help to enumerate all prio_tree_nodes in the tree that
+ * overlap with the input interval X [radix_index, heap_index]. The enumeration
+ * takes O(log n + m) time where 'log n' is the height of the tree (which is
+ * proportional to # of bits required to represent the maximum heap_index) and
+ * 'm' is the number of prio_tree_nodes that overlap the interval X.
+ */
+
+static struct prio_tree_node *prio_tree_left(
+		struct prio_tree_root *root, struct prio_tree_iter *iter,
+		unsigned long radix_index, unsigned long heap_index,
+		unsigned long *r_index, unsigned long *h_index)
+{
+	if (prio_tree_left_empty(iter->cur))
+		return NULL;
+
+	GET_INDEX(iter->cur->left, *r_index, *h_index);
+
+	if (radix_index <= *h_index) {
+		iter->cur = iter->cur->left;
+		iter->mask >>= 1;
+		if (iter->mask) {
+			if (iter->size_level)
+				iter->size_level++;
+		} else {
+			if (iter->size_level) {
+				BUG_ON(!prio_tree_left_empty(iter->cur));
+				BUG_ON(!prio_tree_right_empty(iter->cur));
+				iter->size_level++;
+				iter->mask = ULONG_MAX;
+			} else {
+				iter->size_level = 1;
+				iter->mask = 1UL << (root->index_bits - 1);
+			}
+		}
+		return iter->cur;
+	}
+
+	return NULL;
+}
+
+static struct prio_tree_node *prio_tree_right(
+		struct prio_tree_root *root, struct prio_tree_iter *iter,
+		unsigned long radix_index, unsigned long heap_index,
+		unsigned long *r_index, unsigned long *h_index)
+{
+	unsigned long value;
+
+	if (prio_tree_right_empty(iter->cur))
+		return NULL;
+
+	if (iter->size_level)
+		value = iter->value;
+	else
+		value = iter->value | iter->mask;
+
+	if (heap_index < value)
+		return NULL;
+
+	GET_INDEX(iter->cur->right, *r_index, *h_index);
+
+	if (radix_index <= *h_index) {
+		iter->cur = iter->cur->right;
+		iter->mask >>= 1;
+		iter->value = value;
+		if (iter->mask) {
+			if (iter->size_level)
+				iter->size_level++;
+		} else {
+			if (iter->size_level) {
+				BUG_ON(!prio_tree_left_empty(iter->cur));
+				BUG_ON(!prio_tree_right_empty(iter->cur));
+				iter->size_level++;
+				iter->mask = ULONG_MAX;
+			} else {
+				iter->size_level = 1;
+				iter->mask = 1UL << (root->index_bits - 1);
+			}
+		}
+		return iter->cur;
+	}
+
+	return NULL;
+}
+
+static struct prio_tree_node *prio_tree_parent(struct prio_tree_iter *iter)
+{
+	iter->cur = iter->cur->parent;
+	if (iter->mask == ULONG_MAX)
+		iter->mask = 1UL;
+	else if (iter->size_level == 1)
+		iter->mask = 1UL;
+	else
+		iter->mask <<= 1;
+	if (iter->size_level)
+		iter->size_level--;
+	if (!iter->size_level && (iter->value & iter->mask))
+		iter->value ^= iter->mask;
+	return iter->cur;
+}
+
+static inline int overlap(unsigned long radix_index, unsigned long heap_index,
+		unsigned long r_index, unsigned long h_index)
+{
+	return heap_index >= r_index && radix_index <= h_index;
+}
+
+/*
+ * prio_tree_first:
+ *
+ * Get the first prio_tree_node that overlaps with the interval [radix_index,
+ * heap_index]. Note that always radix_index <= heap_index. We do a pre-order
+ * traversal of the tree.
+ */
+static struct prio_tree_node *prio_tree_first(struct prio_tree_root *root,
+		struct prio_tree_iter *iter, unsigned long radix_index,
+		unsigned long heap_index)
+{
+	unsigned long r_index, h_index;
+
+	INIT_PRIO_TREE_ITER(iter);
+
+	if (prio_tree_empty(root))
+		return NULL;
+
+	GET_INDEX(root->prio_tree_node, r_index, h_index);
+
+	if (radix_index > h_index)
+		return NULL;
+
+	iter->mask = 1UL << (root->index_bits - 1);
+	iter->cur = root->prio_tree_node;
+
+	while (1) {
+		if (overlap(radix_index, heap_index, r_index, h_index))
+			return iter->cur;
+
+		if (prio_tree_left(root, iter, radix_index, heap_index,
+					&r_index, &h_index))
+			continue;
+
+		if (prio_tree_right(root, iter, radix_index, heap_index,
+					&r_index, &h_index))
+			continue;
+
+		break;
+	}
+	return NULL;
+}
+
+/*
+ * prio_tree_next:
+ *
+ * Get the next prio_tree_node that overlaps with the input interval in iter
+ */
+static struct prio_tree_node *prio_tree_next(struct prio_tree_root *root,
+		struct prio_tree_iter *iter, unsigned long radix_index,
+		unsigned long heap_index)
+{
+	unsigned long r_index, h_index;
+
+repeat:
+	while (prio_tree_left(root, iter, radix_index,
+				heap_index, &r_index, &h_index)) {
+		if (overlap(radix_index, heap_index, r_index, h_index))
+			return iter->cur;
+	}
+
+	while (!prio_tree_right(root, iter, radix_index,
+				heap_index, &r_index, &h_index)) {
+	    	while (!prio_tree_root(iter->cur) &&
+				iter->cur->parent->right == iter->cur)
+			prio_tree_parent(iter);
+
+		if (prio_tree_root(iter->cur))
+			return NULL;
+
+		prio_tree_parent(iter);
+	}
+
+	if (overlap(radix_index, heap_index, r_index, h_index))
+		return iter->cur;
+
+	goto repeat;
+}
+
+/*
+ * Radix priority search tree for address_space->i_mmap
+ *
+ * For each vma that map a unique set of file pages i.e., unique [radix_index,
+ * heap_index] value, we have a corresponing priority search tree node. If
+ * multiple vmas have identical [radix_index, heap_index] value, then one of
+ * them is used as a tree node and others are stored in a vm_set list. The tree
+ * node points to the first vma (head) of the list using vm_set.head.
+ *
+ * prio_tree_root
+ *      |
+ *      A       vm_set.head
+ *     / \      /
+ *    L   R -> H-I-J-K-M-N-O-P-Q-S
+ *    ^   ^    <-- vm_set.list -->
+ *  tree nodes
+ *
+ * We need some way to identify whether a vma is a tree node, head of a vm_set
+ * list, or just a member of a vm_set list. We cannot use vm_flags to store
+ * such information. The reason is, in the above figure, it is possible that
+ * vm_flags' of R and H are covered by the different mmap_sems. When R is
+ * removed under R->mmap_sem, H replaces R as a tree node. Since we do not hold
+ * H->mmap_sem, we cannot use H->vm_flags for marking that H is a tree node now.
+ * That's why some trick involving shared.vm_set.parent is used for identifying
+ * tree nodes and list head nodes.
+ *
+ * vma radix priority search tree node rules:
+ *
+ * vma->shared.vm_set.parent != NULL    ==> a tree node
+ *      vma->shared.vm_set.head != NULL ==> list of others mapping same range
+ *      vma->shared.vm_set.head == NULL ==> no others map the same range
+ *
+ * vma->shared.vm_set.parent == NULL
+ * 	vma->shared.vm_set.head != NULL ==> list head of vmas mapping same range
+ * 	vma->shared.vm_set.head == NULL ==> a list node
+ */
+
+/*
+ * Add a new vma known to map the same set of pages as the old vma:
+ * useful for fork's dup_mmap as well as vma_prio_tree_insert below.
+ * Note that it just happens to work correctly on i_mmap_nonlinear too.
+ */
+void vma_prio_tree_add(struct vm_area_struct *vma, struct vm_area_struct *old)
+{
+	/* Leave these BUG_ONs till prio_tree patch stabilizes */
+	BUG_ON(RADIX_INDEX(vma) != RADIX_INDEX(old));
+	BUG_ON(HEAP_INDEX(vma) != HEAP_INDEX(old));
+
+	if (!old->shared.vm_set.parent)
+		list_add(&vma->shared.vm_set.list,
+				&old->shared.vm_set.list);
+	else if (old->shared.vm_set.head)
+		list_add_tail(&vma->shared.vm_set.list,
+				&old->shared.vm_set.head->shared.vm_set.list);
+	else {
+		INIT_LIST_HEAD(&vma->shared.vm_set.list);
+		vma->shared.vm_set.head = old;
+		old->shared.vm_set.head = vma;
+	}
+}
+
+void vma_prio_tree_insert(struct vm_area_struct *vma,
+			  struct prio_tree_root *root)
+{
+	struct prio_tree_node *ptr;
+	struct vm_area_struct *old;
+
+	ptr = prio_tree_insert(root, &vma->shared.prio_tree_node);
+	if (ptr != &vma->shared.prio_tree_node) {
+		old = prio_tree_entry(ptr, struct vm_area_struct,
+					shared.prio_tree_node);
+		vma_prio_tree_add(vma, old);
+	}
+}
+
+void vma_prio_tree_remove(struct vm_area_struct *vma,
+			  struct prio_tree_root *root)
+{
+	struct vm_area_struct *node, *head, *new_head;
+
+	if (!vma->shared.vm_set.head) {
+		if (!vma->shared.vm_set.parent)
+			list_del_init(&vma->shared.vm_set.list);
+		else
+			prio_tree_remove(root, &vma->shared.prio_tree_node);
+	} else {
+		/* Leave this BUG_ON till prio_tree patch stabilizes */
+		BUG_ON(vma->shared.vm_set.head->shared.vm_set.head != vma);
+		if (vma->shared.vm_set.parent) {
+			head = vma->shared.vm_set.head;
+			if (!list_empty(&head->shared.vm_set.list)) {
+				new_head = list_entry(
+					head->shared.vm_set.list.next,
+					struct vm_area_struct,
+					shared.vm_set.list);
+				list_del_init(&head->shared.vm_set.list);
+			} else
+				new_head = NULL;
+
+			prio_tree_replace(root, &vma->shared.prio_tree_node,
+					&head->shared.prio_tree_node);
+			head->shared.vm_set.head = new_head;
+			if (new_head)
+				new_head->shared.vm_set.head = head;
+
+		} else {
+			node = vma->shared.vm_set.head;
+			if (!list_empty(&vma->shared.vm_set.list)) {
+				new_head = list_entry(
+					vma->shared.vm_set.list.next,
+					struct vm_area_struct,
+					shared.vm_set.list);
+				list_del_init(&vma->shared.vm_set.list);
+				node->shared.vm_set.head = new_head;
+				new_head->shared.vm_set.head = node;
+			} else
+				node->shared.vm_set.head = NULL;
+		}
+	}
+}
+
+/*
+ * Helper function to enumerate vmas that map a given file page or a set of
+ * contiguous file pages. The function returns vmas that at least map a single
+ * page in the given range of contiguous file pages.
+ */
+struct vm_area_struct *vma_prio_tree_next(struct vm_area_struct *vma,
+		struct prio_tree_root *root, struct prio_tree_iter *iter,
+		pgoff_t begin, pgoff_t end)
+{
+	struct prio_tree_node *ptr;
+	struct vm_area_struct *next;
+
+	if (!vma) {
+		/*
+		 * First call is with NULL vma
+		 */
+		ptr = prio_tree_first(root, iter, begin, end);
+		if (ptr) {
+			next = prio_tree_entry(ptr, struct vm_area_struct,
+						shared.prio_tree_node);
+			prefetch(next->shared.vm_set.head);
+			return next;
+		} else
+			return NULL;
+	}
+
+	if (vma->shared.vm_set.parent) {
+		if (vma->shared.vm_set.head) {
+			next = vma->shared.vm_set.head;
+			prefetch(next->shared.vm_set.list.next);
+			return next;
+		}
+	} else {
+		next = list_entry(vma->shared.vm_set.list.next,
+				struct vm_area_struct, shared.vm_set.list);
+		if (!next->shared.vm_set.head) {
+			prefetch(next->shared.vm_set.list.next);
+			return next;
+		}
+	}
+
+	ptr = prio_tree_next(root, iter, begin, end);
+	if (ptr) {
+		next = prio_tree_entry(ptr, struct vm_area_struct,
+					shared.prio_tree_node);
+		prefetch(next->shared.vm_set.head);
+		return next;
+	} else
+		return NULL;
+}
diff -Nru a/mm/readahead.c b/mm/readahead.c
--- a/mm/readahead.c	Tue Jun 15 22:20:36 2004
+++ b/mm/readahead.c	Tue Jun 15 22:20:36 2004
@@ -15,7 +15,7 @@
 #include <linux/backing-dev.h>
 #include <linux/pagevec.h>
 
-void default_unplug_io_fn(struct backing_dev_info *bdi)
+void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
 {
 }
 EXPORT_SYMBOL(default_unplug_io_fn);
@@ -353,7 +353,7 @@
 	unsigned orig_next_size;
 	unsigned actual;
 	int first_access=0;
-	unsigned long preoffset=0;
+	unsigned long average;
 
 	/*
 	 * Here we detect the case where the application is performing
@@ -394,10 +394,17 @@
 		if (ra->serial_cnt <= (max * 2))
 			ra->serial_cnt++;
 	} else {
-		ra->average = (ra->average + ra->serial_cnt) / 2;
+		/*
+		 * to avoid rounding errors, ensure that 'average'
+		 * tends towards the value of ra->serial_cnt.
+		 */
+		average = ra->average;
+		if (average < ra->serial_cnt) {
+			average++;
+		}
+		ra->average = (average + ra->serial_cnt) / 2;
 		ra->serial_cnt = 1;
 	}
-	preoffset = ra->prev_page;
 	ra->prev_page = offset;
 
 	if (offset >= ra->start && offset <= (ra->start + ra->size)) {
@@ -457,18 +464,13 @@
 		 * ahead window and get some I/O underway for the new
 		 * current window.
 		 */
-		if (!first_access && preoffset >= ra->start &&
-				preoffset < (ra->start + ra->size)) {
-			 /* Heuristic:  If 'n' pages were
-			  * accessed in the current window, there
-			  * is a high probability that around 'n' pages
-			  * shall be used in the next current window.
-			  *
-			  * To minimize lazy-readahead triggered
-			  * in the next current window, read in
-			  * an extra page.
+		if (!first_access) {
+			 /* Heuristic: there is a high probability
+			  * that around  ra->average number of
+			  * pages shall be accessed in the next
+			  * current window.
 			  */
-			ra->next_size = preoffset - ra->start + 2;
+			ra->next_size = min(ra->average , (unsigned long)max);
 		}
 		ra->start = offset;
 		ra->size = ra->next_size;
@@ -492,21 +494,19 @@
 		 */
 		if (ra->ahead_start == 0) {
 			/*
-			 * if the average io-size is less than maximum
+			 * If the average io-size is more than maximum
 			 * readahead size of the file the io pattern is
 			 * sequential. Hence  bring in the readahead window
 			 * immediately.
-			 * Else the i/o pattern is random. Bring
-			 * in the readahead window only if the last page of
-			 * the current window is accessed (lazy readahead).
+			 * If the average io-size is less than maximum
+			 * readahead size of the file the io pattern is
+			 * random. Hence don't bother to readahead.
 			 */
-			unsigned long average = ra->average;
-
+			average = ra->average;
 			if (ra->serial_cnt > average)
-				average = (ra->serial_cnt + ra->average) / 2;
+				average = (ra->serial_cnt + ra->average + 1) / 2;
 
-			if ((average >= max) || (offset == (ra->start +
-							ra->size - 1))) {
+			if (average > max) {
 				ra->ahead_start = ra->start + ra->size;
 				ra->ahead_size = ra->next_size;
 				actual = do_page_cache_readahead(mapping, filp,
diff -Nru a/mm/rmap.c b/mm/rmap.c
--- a/mm/rmap.c	Tue Jun 15 22:21:02 2004
+++ b/mm/rmap.c	Tue Jun 15 22:21:02 2004
@@ -4,17 +4,23 @@
  * Copyright 2001, Rik van Riel <riel@conectiva.com.br>
  * Released under the General Public License (GPL).
  *
+ * Simple, low overhead reverse mapping scheme.
+ * Please try to keep this thing as modular as possible.
  *
- * Simple, low overhead pte-based reverse mapping scheme.
- * This is kept modular because we may want to experiment
- * with object-based reverse mapping schemes. Please try
- * to keep this thing as modular as possible.
+ * Provides methods for unmapping each kind of mapped page:
+ * the anon methods track anonymous pages, and
+ * the file methods track pages belonging to an inode.
+ *
+ * Original design by Rik van Riel <riel@conectiva.com.br> 2001
+ * File methods by Dave McCracken <dmccr@us.ibm.com> 2003, 2004
+ * Anonymous methods by Andrea Arcangeli <andrea@suse.de> 2004
+ * Contributions by Hugh Dickins <hugh@veritas.com> 2003, 2004
  */
 
 /*
  * Locking:
- * - the page->pte.chain is protected by the PG_maplock bit,
- *   which nests within the the mm->page_table_lock,
+ * - the page->mapcount field is protected by the PG_maplock bit,
+ *   which nests within the mm->page_table_lock,
  *   which nests within the page lock.
  * - because swapout locking is opposite to the locking order
  *   in the page fault path, the swapout path uses trylocks
@@ -27,106 +33,282 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/rmap.h>
-#include <linux/cache.h>
-#include <linux/percpu.h>
 
-#include <asm/pgalloc.h>
-#include <asm/rmap.h>
-#include <asm/tlb.h>
 #include <asm/tlbflush.h>
 
-/*
- * Something oopsable to put for now in the page->mapping
- * of an anonymous page, to test that it is ignored.
- */
-#define ANON_MAPPING_DEBUG	((struct address_space *) 0)
+//#define RMAP_DEBUG /* can be enabled only for debugging */
 
-static inline void clear_page_anon(struct page *page)
+kmem_cache_t *anon_vma_cachep;
+
+static inline void validate_anon_vma(struct vm_area_struct *find_vma)
 {
-	BUG_ON(page->mapping != ANON_MAPPING_DEBUG);
-	page->mapping = NULL;
-	ClearPageAnon(page);
+#ifdef RMAP_DEBUG
+	struct anon_vma *anon_vma = find_vma->anon_vma;
+	struct vm_area_struct *vma;
+	unsigned int mapcount = 0;
+	int found = 0;
+
+	list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
+		mapcount++;
+		BUG_ON(mapcount > 100000);
+		if (vma == find_vma)
+			found = 1;
+	}
+	BUG_ON(!found);
+#endif
 }
 
-/*
- * Shared pages have a chain of pte_chain structures, used to locate
- * all the mappings to this page. We only need a pointer to the pte
- * here, the page struct for the page table page contains the process
- * it belongs to and the offset within that process.
- *
- * We use an array of pte pointers in this structure to minimise cache misses
- * while traversing reverse maps.
- */
-#define NRPTE ((L1_CACHE_BYTES - sizeof(unsigned long))/sizeof(pte_addr_t))
+/* This must be called under the mmap_sem. */
+int anon_vma_prepare(struct vm_area_struct *vma)
+{
+	struct anon_vma *anon_vma = vma->anon_vma;
 
-/*
- * next_and_idx encodes both the address of the next pte_chain and the
- * offset of the lowest-index used pte in ptes[] (which is equal also
- * to the offset of the highest-index unused pte in ptes[], plus one).
- */
-struct pte_chain {
-	unsigned long next_and_idx;
-	pte_addr_t ptes[NRPTE];
-} ____cacheline_aligned;
+	might_sleep();
+	if (unlikely(!anon_vma)) {
+		struct mm_struct *mm = vma->vm_mm;
+		struct anon_vma *allocated = NULL;
+
+		anon_vma = find_mergeable_anon_vma(vma);
+		if (!anon_vma) {
+			anon_vma = anon_vma_alloc();
+			if (unlikely(!anon_vma))
+				return -ENOMEM;
+			allocated = anon_vma;
+		}
+
+		/* page_table_lock to protect against threads */
+		spin_lock(&mm->page_table_lock);
+		if (likely(!vma->anon_vma)) {
+			vma->anon_vma = anon_vma;
+			list_add(&vma->anon_vma_node, &anon_vma->head);
+			allocated = NULL;
+		}
+		spin_unlock(&mm->page_table_lock);
+		if (unlikely(allocated))
+			anon_vma_free(allocated);
+	}
+	return 0;
+}
+
+void __anon_vma_merge(struct vm_area_struct *vma, struct vm_area_struct *next)
+{
+	if (!vma->anon_vma) {
+		BUG_ON(!next->anon_vma);
+		vma->anon_vma = next->anon_vma;
+		list_add(&vma->anon_vma_node, &next->anon_vma_node);
+	} else {
+		/* if they're both non-null they must be the same */
+		BUG_ON(vma->anon_vma != next->anon_vma);
+	}
+	list_del(&next->anon_vma_node);
+}
+
+void __anon_vma_link(struct vm_area_struct *vma)
+{
+	struct anon_vma *anon_vma = vma->anon_vma;
+
+	if (anon_vma) {
+		list_add(&vma->anon_vma_node, &anon_vma->head);
+		validate_anon_vma(vma);
+	}
+}
+
+void anon_vma_link(struct vm_area_struct *vma)
+{
+	struct anon_vma *anon_vma = vma->anon_vma;
+
+	if (anon_vma) {
+		spin_lock(&anon_vma->lock);
+		list_add(&vma->anon_vma_node, &anon_vma->head);
+		validate_anon_vma(vma);
+		spin_unlock(&anon_vma->lock);
+	}
+}
 
-kmem_cache_t	*pte_chain_cache;
+void anon_vma_unlink(struct vm_area_struct *vma)
+{
+	struct anon_vma *anon_vma = vma->anon_vma;
+	int empty;
+
+	if (!anon_vma)
+		return;
+
+	spin_lock(&anon_vma->lock);
+	validate_anon_vma(vma);
+	list_del(&vma->anon_vma_node);
+
+	/* We must garbage collect the anon_vma if it's empty */
+	empty = list_empty(&anon_vma->head);
+	spin_unlock(&anon_vma->lock);
+
+	if (empty)
+		anon_vma_free(anon_vma);
+}
 
-static inline struct pte_chain *pte_chain_next(struct pte_chain *pte_chain)
+static void anon_vma_ctor(void *data, kmem_cache_t *cachep, unsigned long flags)
 {
-	return (struct pte_chain *)(pte_chain->next_and_idx & ~NRPTE);
+	if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
+						SLAB_CTOR_CONSTRUCTOR) {
+		struct anon_vma *anon_vma = data;
+
+		spin_lock_init(&anon_vma->lock);
+		INIT_LIST_HEAD(&anon_vma->head);
+	}
 }
 
-static inline struct pte_chain *pte_chain_ptr(unsigned long pte_chain_addr)
+void __init anon_vma_init(void)
 {
-	return (struct pte_chain *)(pte_chain_addr & ~NRPTE);
+	anon_vma_cachep = kmem_cache_create("anon_vma",
+		sizeof(struct anon_vma), 0, SLAB_PANIC, anon_vma_ctor, NULL);
 }
 
-static inline int pte_chain_idx(struct pte_chain *pte_chain)
+/* this needs the page->flags PG_maplock held */
+static inline void clear_page_anon(struct page *page)
 {
-	return pte_chain->next_and_idx & NRPTE;
+	BUG_ON(!page->mapping);
+	page->mapping = NULL;
+	ClearPageAnon(page);
 }
 
+/*
+ * At what user virtual address is page expected in vma?
+ */
 static inline unsigned long
-pte_chain_encode(struct pte_chain *pte_chain, int idx)
+vma_address(struct page *page, struct vm_area_struct *vma)
 {
-	return (unsigned long)pte_chain | idx;
+	pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+	unsigned long address;
+
+	address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
+	if (unlikely(address < vma->vm_start || address >= vma->vm_end)) {
+		/* page should be within any vma from prio_tree_next */
+		BUG_ON(!PageAnon(page));
+		return -EFAULT;
+	}
+	return address;
 }
 
 /*
- * pte_chain list management policy:
- *
- * - If a page has a pte_chain list then it is shared by at least two processes,
- *   because a single sharing uses PageDirect. (Well, this isn't true yet,
- *   coz this code doesn't collapse singletons back to PageDirect on the remove
- *   path).
- * - A pte_chain list has free space only in the head member - all succeeding
- *   members are 100% full.
- * - If the head element has free space, it occurs in its leading slots.
- * - All free space in the pte_chain is at the start of the head member.
- * - Insertion into the pte_chain puts a pte pointer in the last free slot of
- *   the head member.
- * - Removal from a pte chain moves the head pte of the head member onto the
- *   victim pte and frees the head member if it became empty.
+ * Subfunctions of page_referenced: page_referenced_one called
+ * repeatedly from either page_referenced_anon or page_referenced_file.
  */
+static int page_referenced_one(struct page *page,
+	struct vm_area_struct *vma, unsigned int *mapcount)
+{
+	struct mm_struct *mm = vma->vm_mm;
+	unsigned long address;
+	pgd_t *pgd;
+	pmd_t *pmd;
+	pte_t *pte;
+	int referenced = 0;
+
+	if (!mm->rss)
+		goto out;
+	address = vma_address(page, vma);
+	if (address == -EFAULT)
+		goto out;
+
+	if (!spin_trylock(&mm->page_table_lock))
+		goto out;
+
+	pgd = pgd_offset(mm, address);
+	if (!pgd_present(*pgd))
+		goto out_unlock;
+
+	pmd = pmd_offset(pgd, address);
+	if (!pmd_present(*pmd))
+		goto out_unlock;
+
+	pte = pte_offset_map(pmd, address);
+	if (!pte_present(*pte))
+		goto out_unmap;
+
+	if (page_to_pfn(page) != pte_pfn(*pte))
+		goto out_unmap;
+
+	if (ptep_test_and_clear_young(pte))
+		referenced++;
+
+	(*mapcount)--;
+
+out_unmap:
+	pte_unmap(pte);
+out_unlock:
+	spin_unlock(&mm->page_table_lock);
+out:
+	return referenced;
+}
+
+static inline int page_referenced_anon(struct page *page)
+{
+	unsigned int mapcount = page->mapcount;
+	struct anon_vma *anon_vma = (struct anon_vma *) page->mapping;
+	struct vm_area_struct *vma;
+	int referenced = 0;
+
+	spin_lock(&anon_vma->lock);
+	BUG_ON(list_empty(&anon_vma->head));
+	list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
+		referenced += page_referenced_one(page, vma, &mapcount);
+		if (!mapcount)
+			break;
+	}
+	spin_unlock(&anon_vma->lock);
+	return referenced;
+}
 
 /**
- ** VM stuff below this comment
- **/
+ * page_referenced_file - referenced check for object-based rmap
+ * @page: the page we're checking references on.
+ *
+ * For an object-based mapped page, find all the places it is mapped and
+ * check/clear the referenced flag.  This is done by following the page->mapping
+ * pointer, then walking the chain of vmas it holds.  It returns the number
+ * of references it found.
+ *
+ * This function is only called from page_referenced for object-based pages.
+ *
+ * The spinlock address_space->i_mmap_lock is tried.  If it can't be gotten,
+ * assume a reference count of 0, so try_to_unmap will then have a go.
+ */
+static inline int page_referenced_file(struct page *page)
+{
+	unsigned int mapcount = page->mapcount;
+	struct address_space *mapping = page->mapping;
+	pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+	struct vm_area_struct *vma = NULL;
+	struct prio_tree_iter iter;
+	int referenced = 0;
+
+	if (!spin_trylock(&mapping->i_mmap_lock))
+		return 0;
+
+	while ((vma = vma_prio_tree_next(vma, &mapping->i_mmap,
+					&iter, pgoff, pgoff)) != NULL) {
+		if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE))
+				  == (VM_LOCKED|VM_MAYSHARE)) {
+			referenced++;
+			break;
+		}
+		referenced += page_referenced_one(page, vma, &mapcount);
+		if (!mapcount)
+			break;
+	}
+
+	spin_unlock(&mapping->i_mmap_lock);
+	return referenced;
+}
 
 /**
  * page_referenced - test if the page was referenced
  * @page: the page to test
  *
  * Quick test_and_clear_referenced for all mappings to a page,
- * returns the number of processes which referenced the page.
+ * returns the number of ptes which referenced the page.
  * Caller needs to hold the rmap lock.
- *
- * If the page has a single-entry pte_chain, collapse that back to a PageDirect
- * representation.  This way, it's only done under memory pressure.
  */
-int fastcall page_referenced(struct page * page)
+int page_referenced(struct page *page)
 {
-	struct pte_chain *pc;
 	int referenced = 0;
 
 	if (page_test_and_clear_young(page))
@@ -135,218 +317,183 @@
 	if (TestClearPageReferenced(page))
 		referenced++;
 
-	if (PageDirect(page)) {
-		pte_t *pte = rmap_ptep_map(page->pte.direct);
-		if (ptep_test_and_clear_young(pte))
-			referenced++;
-		rmap_ptep_unmap(pte);
-	} else {
-		int nr_chains = 0;
-
-		/* Check all the page tables mapping this page. */
-		for (pc = page->pte.chain; pc; pc = pte_chain_next(pc)) {
-			int i;
-
-			for (i = pte_chain_idx(pc); i < NRPTE; i++) {
-				pte_addr_t pte_paddr = pc->ptes[i];
-				pte_t *p;
-
-				p = rmap_ptep_map(pte_paddr);
-				if (ptep_test_and_clear_young(p))
-					referenced++;
-				rmap_ptep_unmap(p);
-				nr_chains++;
-			}
-		}
-		if (nr_chains == 1) {
-			pc = page->pte.chain;
-			page->pte.direct = pc->ptes[NRPTE-1];
-			SetPageDirect(page);
-			pc->ptes[NRPTE-1] = 0;
-			__pte_chain_free(pc);
-		}
+	if (page->mapcount && page->mapping) {
+		if (PageAnon(page))
+			referenced += page_referenced_anon(page);
+		else
+			referenced += page_referenced_file(page);
 	}
 	return referenced;
 }
 
 /**
- * page_add_rmap - add reverse mapping entry to a page
- * @page: the page to add the mapping to
- * @ptep: the page table entry mapping this page
+ * page_add_anon_rmap - add pte mapping to an anonymous page
+ * @page:	the page to add the mapping to
+ * @vma:	the vm area in which the mapping is added
+ * @address:	the user virtual address mapped
  *
- * Add a new pte reverse mapping to a page.
  * The caller needs to hold the mm->page_table_lock.
  */
-struct pte_chain * fastcall
-page_add_rmap(struct page *page, pte_t *ptep, struct pte_chain *pte_chain)
+void page_add_anon_rmap(struct page *page,
+	struct vm_area_struct *vma, unsigned long address)
 {
-	pte_addr_t pte_paddr = ptep_to_paddr(ptep);
-	struct pte_chain *cur_pte_chain;
+	struct anon_vma *anon_vma = vma->anon_vma;
+	pgoff_t index;
 
-	if (PageReserved(page))
-		return pte_chain;
-
-	rmap_lock(page);
-
-	if (page->pte.direct == 0) {
-		page->pte.direct = pte_paddr;
-		SetPageDirect(page);
-		if (!page->mapping) {
-			SetPageAnon(page);
-			page->mapping = ANON_MAPPING_DEBUG;
-		}
-		inc_page_state(nr_mapped);
-		goto out;
-	}
+	BUG_ON(PageReserved(page));
+	BUG_ON(!anon_vma);
 
-	if (PageDirect(page)) {
-		/* Convert a direct pointer into a pte_chain */
-		ClearPageDirect(page);
-		pte_chain->ptes[NRPTE-1] = page->pte.direct;
-		pte_chain->ptes[NRPTE-2] = pte_paddr;
-		pte_chain->next_and_idx = pte_chain_encode(NULL, NRPTE-2);
-		page->pte.direct = 0;
-		page->pte.chain = pte_chain;
-		pte_chain = NULL;	/* We consumed it */
-		goto out;
-	}
+	index = (address - vma->vm_start) >> PAGE_SHIFT;
+	index += vma->vm_pgoff;
+	index >>= PAGE_CACHE_SHIFT - PAGE_SHIFT;
 
-	cur_pte_chain = page->pte.chain;
-	if (cur_pte_chain->ptes[0]) {	/* It's full */
-		pte_chain->next_and_idx = pte_chain_encode(cur_pte_chain,
-								NRPTE - 1);
-		page->pte.chain = pte_chain;
-		pte_chain->ptes[NRPTE-1] = pte_paddr;
-		pte_chain = NULL;	/* We consumed it */
-		goto out;
+	/*
+	 * Setting and clearing PG_anon must always happen inside
+	 * page_map_lock to avoid races between mapping and
+	 * unmapping on different processes of the same
+	 * shared cow swapcache page. And while we take the
+	 * page_map_lock PG_anon cannot change from under us.
+	 * Actually PG_anon cannot change under fork either
+	 * since fork holds a reference on the page so it cannot
+	 * be unmapped under fork and in turn copy_page_range is
+	 * allowed to read PG_anon outside the page_map_lock.
+	 */
+	page_map_lock(page);
+	if (!page->mapcount) {
+		BUG_ON(PageAnon(page));
+		BUG_ON(page->mapping);
+		SetPageAnon(page);
+		page->index = index;
+		page->mapping = (struct address_space *) anon_vma;
+		inc_page_state(nr_mapped);
+	} else {
+		BUG_ON(!PageAnon(page));
+		BUG_ON(page->index != index);
+		BUG_ON(page->mapping != (struct address_space *) anon_vma);
 	}
-	cur_pte_chain->ptes[pte_chain_idx(cur_pte_chain) - 1] = pte_paddr;
-	cur_pte_chain->next_and_idx--;
-out:
-	rmap_unlock(page);
-	return pte_chain;
+	page->mapcount++;
+	page_map_unlock(page);
 }
 
 /**
- * page_remove_rmap - take down reverse mapping to a page
- * @page: page to remove mapping from
- * @ptep: page table entry to remove
+ * page_add_file_rmap - add pte mapping to a file page
+ * @page: the page to add the mapping to
  *
- * Removes the reverse mapping from the pte_chain of the page,
- * after that the caller can clear the page table entry and free
- * the page.
- * Caller needs to hold the mm->page_table_lock.
+ * The caller needs to hold the mm->page_table_lock.
  */
-void fastcall page_remove_rmap(struct page *page, pte_t *ptep)
+void page_add_file_rmap(struct page *page)
 {
-	pte_addr_t pte_paddr = ptep_to_paddr(ptep);
-	struct pte_chain *pc;
-
+	BUG_ON(PageAnon(page));
 	if (!pfn_valid(page_to_pfn(page)) || PageReserved(page))
 		return;
 
-	rmap_lock(page);
+	page_map_lock(page);
+	if (!page->mapcount)
+		inc_page_state(nr_mapped);
+	page->mapcount++;
+	page_map_unlock(page);
+}
 
-	if (!page_mapped(page))
-		goto out_unlock;	/* remap_page_range() from a driver? */
+/**
+ * page_remove_rmap - take down pte mapping from a page
+ * @page: page to remove mapping from
+ *
+ * Caller needs to hold the mm->page_table_lock.
+ */
+void page_remove_rmap(struct page *page)
+{
+	BUG_ON(PageReserved(page));
+	BUG_ON(!page->mapcount);
 
-	if (PageDirect(page)) {
-		if (page->pte.direct == pte_paddr) {
-			page->pte.direct = 0;
-			ClearPageDirect(page);
-			goto out;
-		}
-	} else {
-		struct pte_chain *start = page->pte.chain;
-		struct pte_chain *next;
-		int victim_i = pte_chain_idx(start);
-
-		for (pc = start; pc; pc = next) {
-			int i;
-
-			next = pte_chain_next(pc);
-			if (next)
-				prefetch(next);
-			for (i = pte_chain_idx(pc); i < NRPTE; i++) {
-				pte_addr_t pa = pc->ptes[i];
-
-				if (pa != pte_paddr)
-					continue;
-				pc->ptes[i] = start->ptes[victim_i];
-				start->ptes[victim_i] = 0;
-				if (victim_i == NRPTE-1) {
-					/* Emptied a pte_chain */
-					page->pte.chain = pte_chain_next(start);
-					__pte_chain_free(start);
-				} else {
-					start->next_and_idx++;
-				}
-				goto out;
-			}
-		}
-	}
-out:
-	if (!page_mapped(page)) {
+	page_map_lock(page);
+	page->mapcount--;
+	if (!page->mapcount) {
 		if (page_test_and_clear_dirty(page))
 			set_page_dirty(page);
 		if (PageAnon(page))
 			clear_page_anon(page);
 		dec_page_state(nr_mapped);
 	}
-out_unlock:
-	rmap_unlock(page);
+	page_map_unlock(page);
 }
 
-/**
- * try_to_unmap_one - worker function for try_to_unmap
- * @page: page to unmap
- * @ptep: page table entry to unmap from page
- *
- * Internal helper function for try_to_unmap, called for each page
- * table entry mapping a page. Because locking order here is opposite
- * to the locking order used by the page fault path, we use trylocks.
- * Locking:
- *	    page lock			shrink_list(), trylock
- *		rmap lock		shrink_list()
- *		    mm->page_table_lock	try_to_unmap_one(), trylock
- */
-static int fastcall try_to_unmap_one(struct page * page, pte_addr_t paddr)
-{
-	pte_t *ptep = rmap_ptep_map(paddr);
-	unsigned long address = ptep_to_address(ptep);
-	struct mm_struct * mm = ptep_to_mm(ptep);
-	struct vm_area_struct * vma;
-	pte_t pte;
-	int ret;
+/*
+ * Subfunctions of try_to_unmap: try_to_unmap_one called
+ * repeatedly from either try_to_unmap_anon or try_to_unmap_file.
+ */
+static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma)
+{
+	struct mm_struct *mm = vma->vm_mm;
+	unsigned long address;
+	pgd_t *pgd;
+	pmd_t *pmd;
+	pte_t *pte;
+	pte_t pteval;
+	int ret = SWAP_AGAIN;
 
-	if (!mm)
-		BUG();
+	if (!mm->rss)
+		goto out;
+	address = vma_address(page, vma);
+	if (address == -EFAULT)
+		goto out;
 
 	/*
 	 * We need the page_table_lock to protect us from page faults,
 	 * munmap, fork, etc...
 	 */
-	if (!spin_trylock(&mm->page_table_lock)) {
-		rmap_ptep_unmap(ptep);
-		return SWAP_AGAIN;
-	}
+	if (!spin_trylock(&mm->page_table_lock))
+		goto out;
 
-	/* unmap_vmas drops page_table_lock with vma unlinked */
-	vma = find_vma(mm, address);
-	if (!vma) {
-		ret = SWAP_FAIL;
+	pgd = pgd_offset(mm, address);
+	if (!pgd_present(*pgd))
+		goto out_unlock;
+
+	pmd = pmd_offset(pgd, address);
+	if (!pmd_present(*pmd))
 		goto out_unlock;
+
+	pte = pte_offset_map(pmd, address);
+	if (!pte_present(*pte))
+		goto out_unmap;
+
+	if (page_to_pfn(page) != pte_pfn(*pte))
+		goto out_unmap;
+
+	/*
+	 * If the page is mlock()d, we cannot swap it out.
+	 * If it's recently referenced (perhaps page_referenced
+	 * skipped over this mm) then we should reactivate it.
+	 */
+	if ((vma->vm_flags & (VM_LOCKED|VM_RESERVED)) ||
+			ptep_test_and_clear_young(pte)) {
+		ret = SWAP_FAIL;
+		goto out_unmap;
 	}
 
-	/* The page is mlock()d, we cannot swap it out. */
-	if (vma->vm_flags & VM_LOCKED) {
+	/*
+	 * Don't pull an anonymous page out from under get_user_pages.
+	 * GUP carefully breaks COW and raises page count (while holding
+	 * page_table_lock, as we have here) to make sure that the page
+	 * cannot be freed.  If we unmap that page here, a user write
+	 * access to the virtual address will bring back the page, but
+	 * its raised count will (ironically) be taken to mean it's not
+	 * an exclusive swap page, do_wp_page will replace it by a copy
+	 * page, and the user never get to see the data GUP was holding
+	 * the original page for.
+	 */
+	if (PageSwapCache(page) &&
+	    page_count(page) != page->mapcount + 2) {
 		ret = SWAP_FAIL;
-		goto out_unlock;
+		goto out_unmap;
 	}
 
 	/* Nuke the page table entry. */
 	flush_cache_page(vma, address);
-	pte = ptep_clear_flush(vma, address, ptep);
+	pteval = ptep_clear_flush(vma, address, pte);
+
+	/* Move the dirty bit to the physical page now the pte is gone. */
+	if (pte_dirty(pteval))
+		set_page_dirty(page);
 
 	if (PageAnon(page)) {
 		swp_entry_t entry = { .val = page->private };
@@ -356,31 +503,248 @@
 		 */
 		BUG_ON(!PageSwapCache(page));
 		swap_duplicate(entry);
-		set_pte(ptep, swp_entry_to_pte(entry));
-		BUG_ON(pte_file(*ptep));
-	} else {
-		/*
-		 * If a nonlinear mapping then store the file page offset
-		 * in the pte.
-		 */
-		BUG_ON(!page->mapping);
-		if (page->index != linear_page_index(vma, address)) {
-			set_pte(ptep, pgoff_to_pte(page->index));
-			BUG_ON(!pte_file(*ptep));
-		}
+		set_pte(pte, swp_entry_to_pte(entry));
+		BUG_ON(pte_file(*pte));
 	}
 
-	/* Move the dirty bit to the physical page now the pte is gone. */
-	if (pte_dirty(pte))
-		set_page_dirty(page);
-
 	mm->rss--;
+	BUG_ON(!page->mapcount);
+	page->mapcount--;
 	page_cache_release(page);
-	ret = SWAP_SUCCESS;
+
+out_unmap:
+	pte_unmap(pte);
+out_unlock:
+	spin_unlock(&mm->page_table_lock);
+out:
+	return ret;
+}
+
+/*
+ * objrmap doesn't work for nonlinear VMAs because the assumption that
+ * offset-into-file correlates with offset-into-virtual-addresses does not hold.
+ * Consequently, given a particular page and its ->index, we cannot locate the
+ * ptes which are mapping that page without an exhaustive linear search.
+ *
+ * So what this code does is a mini "virtual scan" of each nonlinear VMA which
+ * maps the file to which the target page belongs.  The ->vm_private_data field
+ * holds the current cursor into that scan.  Successive searches will circulate
+ * around the vma's virtual address space.
+ *
+ * So as more replacement pressure is applied to the pages in a nonlinear VMA,
+ * more scanning pressure is placed against them as well.   Eventually pages
+ * will become fully unmapped and are eligible for eviction.
+ *
+ * For very sparsely populated VMAs this is a little inefficient - chances are
+ * there there won't be many ptes located within the scan cluster.  In this case
+ * maybe we could scan further - to the end of the pte page, perhaps.
+ */
+#define CLUSTER_SIZE	min(32*PAGE_SIZE, PMD_SIZE)
+#define CLUSTER_MASK	(~(CLUSTER_SIZE - 1))
+
+static int try_to_unmap_cluster(unsigned long cursor,
+	unsigned int *mapcount, struct vm_area_struct *vma)
+{
+	struct mm_struct *mm = vma->vm_mm;
+	pgd_t *pgd;
+	pmd_t *pmd;
+	pte_t *pte;
+	pte_t pteval;
+	struct page *page;
+	unsigned long address;
+	unsigned long end;
+	unsigned long pfn;
+
+	/*
+	 * We need the page_table_lock to protect us from page faults,
+	 * munmap, fork, etc...
+	 */
+	if (!spin_trylock(&mm->page_table_lock))
+		return SWAP_FAIL;
+
+	address = (vma->vm_start + cursor) & CLUSTER_MASK;
+	end = address + CLUSTER_SIZE;
+	if (address < vma->vm_start)
+		address = vma->vm_start;
+	if (end > vma->vm_end)
+		end = vma->vm_end;
+
+	pgd = pgd_offset(mm, address);
+	if (!pgd_present(*pgd))
+		goto out_unlock;
+
+	pmd = pmd_offset(pgd, address);
+	if (!pmd_present(*pmd))
+		goto out_unlock;
+
+	for (pte = pte_offset_map(pmd, address);
+			address < end; pte++, address += PAGE_SIZE) {
+
+		if (!pte_present(*pte))
+			continue;
+
+		pfn = pte_pfn(*pte);
+		if (!pfn_valid(pfn))
+			continue;
+
+		page = pfn_to_page(pfn);
+		BUG_ON(PageAnon(page));
+		if (PageReserved(page))
+			continue;
+
+		if (ptep_test_and_clear_young(pte))
+			continue;
+
+		/* Nuke the page table entry. */
+		flush_cache_page(vma, address);
+		pteval = ptep_clear_flush(vma, address, pte);
+
+		/* If nonlinear, store the file page offset in the pte. */
+		if (page->index != linear_page_index(vma, address))
+			set_pte(pte, pgoff_to_pte(page->index));
+
+		/* Move the dirty bit to the physical page now the pte is gone. */
+		if (pte_dirty(pteval))
+			set_page_dirty(page);
+
+		page_remove_rmap(page);
+		page_cache_release(page);
+		mm->rss--;
+		(*mapcount)--;
+	}
+
+	pte_unmap(pte);
 
 out_unlock:
-	rmap_ptep_unmap(ptep);
 	spin_unlock(&mm->page_table_lock);
+	return SWAP_AGAIN;
+}
+
+static inline int try_to_unmap_anon(struct page *page)
+{
+	struct anon_vma *anon_vma = (struct anon_vma *) page->mapping;
+	struct vm_area_struct *vma;
+	int ret = SWAP_AGAIN;
+
+	spin_lock(&anon_vma->lock);
+	BUG_ON(list_empty(&anon_vma->head));
+	list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
+		ret = try_to_unmap_one(page, vma);
+		if (ret == SWAP_FAIL || !page->mapcount)
+			break;
+	}
+	spin_unlock(&anon_vma->lock);
+	return ret;
+}
+
+/**
+ * try_to_unmap_file - unmap file page using the object-based rmap method
+ * @page: the page to unmap
+ *
+ * Find all the mappings of a page using the mapping pointer and the vma chains
+ * contained in the address_space struct it points to.
+ *
+ * This function is only called from try_to_unmap for object-based pages.
+ *
+ * The spinlock address_space->i_mmap_lock is tried.  If it can't be gotten,
+ * return a temporary error.
+ */
+static inline int try_to_unmap_file(struct page *page)
+{
+	struct address_space *mapping = page->mapping;
+	pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+	struct vm_area_struct *vma = NULL;
+	struct prio_tree_iter iter;
+	int ret = SWAP_AGAIN;
+	unsigned long cursor;
+	unsigned long max_nl_cursor = 0;
+	unsigned long max_nl_size = 0;
+	unsigned int mapcount;
+
+	if (!spin_trylock(&mapping->i_mmap_lock))
+		return ret;
+
+	while ((vma = vma_prio_tree_next(vma, &mapping->i_mmap,
+					&iter, pgoff, pgoff)) != NULL) {
+		ret = try_to_unmap_one(page, vma);
+		if (ret == SWAP_FAIL || !page->mapcount)
+			goto out;
+	}
+
+	if (list_empty(&mapping->i_mmap_nonlinear))
+		goto out;
+
+	list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
+						shared.vm_set.list) {
+		if (vma->vm_flags & (VM_LOCKED|VM_RESERVED))
+			continue;
+		cursor = (unsigned long) vma->vm_private_data;
+		if (cursor > max_nl_cursor)
+			max_nl_cursor = cursor;
+		cursor = vma->vm_end - vma->vm_start;
+		if (cursor > max_nl_size)
+			max_nl_size = cursor;
+	}
+
+	if (max_nl_size == 0)	/* any nonlinears locked or reserved */
+		goto out;
+
+	/*
+	 * We don't try to search for this page in the nonlinear vmas,
+	 * and page_referenced wouldn't have found it anyway.  Instead
+	 * just walk the nonlinear vmas trying to age and unmap some.
+	 * The mapcount of the page we came in with is irrelevant,
+	 * but even so use it as a guide to how hard we should try?
+	 */
+	mapcount = page->mapcount;
+	page_map_unlock(page);
+	cond_resched_lock(&mapping->i_mmap_lock);
+
+	max_nl_size = (max_nl_size + CLUSTER_SIZE - 1) & CLUSTER_MASK;
+	if (max_nl_cursor == 0)
+		max_nl_cursor = CLUSTER_SIZE;
+
+	do {
+		list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
+						shared.vm_set.list) {
+			if (vma->vm_flags & (VM_LOCKED|VM_RESERVED))
+				continue;
+			cursor = (unsigned long) vma->vm_private_data;
+			while (vma->vm_mm->rss &&
+				cursor < max_nl_cursor &&
+				cursor < vma->vm_end - vma->vm_start) {
+				ret = try_to_unmap_cluster(
+						cursor, &mapcount, vma);
+				if (ret == SWAP_FAIL)
+					break;
+				cursor += CLUSTER_SIZE;
+				vma->vm_private_data = (void *) cursor;
+				if ((int)mapcount <= 0)
+					goto relock;
+			}
+			if (ret != SWAP_FAIL)
+				vma->vm_private_data =
+					(void *) max_nl_cursor;
+			ret = SWAP_AGAIN;
+		}
+		cond_resched_lock(&mapping->i_mmap_lock);
+		max_nl_cursor += CLUSTER_SIZE;
+	} while (max_nl_cursor <= max_nl_size);
+
+	/*
+	 * Don't loop forever (perhaps all the remaining pages are
+	 * in locked vmas).  Reset cursor on all unreserved nonlinear
+	 * vmas, now forgetting on which ones it had fallen behind.
+	 */
+	list_for_each_entry(vma, &mapping->i_mmap_nonlinear,
+						shared.vm_set.list) {
+		if (!(vma->vm_flags & VM_RESERVED))
+			vma->vm_private_data = 0;
+	}
+relock:
+	page_map_lock(page);
+out:
+	spin_unlock(&mapping->i_mmap_lock);
 	return ret;
 }
 
@@ -396,70 +760,20 @@
  * SWAP_AGAIN	- we missed a trylock, try again later
  * SWAP_FAIL	- the page is unswappable
  */
-int fastcall try_to_unmap(struct page * page)
+int try_to_unmap(struct page *page)
 {
-	struct pte_chain *pc, *next_pc, *start;
-	int ret = SWAP_SUCCESS;
-	int victim_i;
-
-	/* This page should not be on the pageout lists. */
-	if (PageReserved(page))
-		BUG();
-	if (!PageLocked(page))
-		BUG();
-
-	if (PageDirect(page)) {
-		ret = try_to_unmap_one(page, page->pte.direct);
-		if (ret == SWAP_SUCCESS) {
-			page->pte.direct = 0;
-			ClearPageDirect(page);
-		}
-		goto out;
-	}
+	int ret;
 
-	start = page->pte.chain;
-	victim_i = pte_chain_idx(start);
-	for (pc = start; pc; pc = next_pc) {
-		int i;
-
-		next_pc = pte_chain_next(pc);
-		if (next_pc)
-			prefetch(next_pc);
-		for (i = pte_chain_idx(pc); i < NRPTE; i++) {
-			pte_addr_t pte_paddr = pc->ptes[i];
-
-			switch (try_to_unmap_one(page, pte_paddr)) {
-			case SWAP_SUCCESS:
-				/*
-				 * Release a slot.  If we're releasing the
-				 * first pte in the first pte_chain then
-				 * pc->ptes[i] and start->ptes[victim_i] both
-				 * refer to the same thing.  It works out.
-				 */
-				pc->ptes[i] = start->ptes[victim_i];
-				start->ptes[victim_i] = 0;
-				victim_i++;
-				if (victim_i == NRPTE) {
-					page->pte.chain = pte_chain_next(start);
-					__pte_chain_free(start);
-					start = page->pte.chain;
-					victim_i = 0;
-				} else {
-					start->next_and_idx++;
-				}
-				break;
-			case SWAP_AGAIN:
-				/* Skip this pte, remembering status. */
-				ret = SWAP_AGAIN;
-				continue;
-			case SWAP_FAIL:
-				ret = SWAP_FAIL;
-				goto out;
-			}
-		}
-	}
-out:
-	if (!page_mapped(page)) {
+	BUG_ON(PageReserved(page));
+	BUG_ON(!PageLocked(page));
+	BUG_ON(!page->mapcount);
+
+	if (PageAnon(page))
+		ret = try_to_unmap_anon(page);
+	else
+		ret = try_to_unmap_file(page);
+
+	if (!page->mapcount) {
 		if (page_test_and_clear_dirty(page))
 			set_page_dirty(page);
 		if (PageAnon(page))
@@ -468,77 +782,4 @@
 		ret = SWAP_SUCCESS;
 	}
 	return ret;
-}
-
-/**
- ** No more VM stuff below this comment, only pte_chain helper
- ** functions.
- **/
-
-static void pte_chain_ctor(void *p, kmem_cache_t *cachep, unsigned long flags)
-{
-	struct pte_chain *pc = p;
-
-	memset(pc, 0, sizeof(*pc));
-}
-
-DEFINE_PER_CPU(struct pte_chain *, local_pte_chain) = 0;
-
-/**
- * __pte_chain_free - free pte_chain structure
- * @pte_chain: pte_chain struct to free
- */
-void __pte_chain_free(struct pte_chain *pte_chain)
-{
-	struct pte_chain **pte_chainp;
-
-	pte_chainp = &get_cpu_var(local_pte_chain);
-	if (pte_chain->next_and_idx)
-		pte_chain->next_and_idx = 0;
-	if (*pte_chainp)
-		kmem_cache_free(pte_chain_cache, *pte_chainp);
-	*pte_chainp = pte_chain;
-	put_cpu_var(local_pte_chain);
-}
-
-/*
- * pte_chain_alloc(): allocate a pte_chain structure for use by page_add_rmap().
- *
- * The caller of page_add_rmap() must perform the allocation because
- * page_add_rmap() is invariably called under spinlock.  Often, page_add_rmap()
- * will not actually use the pte_chain, because there is space available in one
- * of the existing pte_chains which are attached to the page.  So the case of
- * allocating and then freeing a single pte_chain is specially optimised here,
- * with a one-deep per-cpu cache.
- */
-struct pte_chain *pte_chain_alloc(int gfp_flags)
-{
-	struct pte_chain *ret;
-	struct pte_chain **pte_chainp;
-
-	might_sleep_if(gfp_flags & __GFP_WAIT);
-
-	pte_chainp = &get_cpu_var(local_pte_chain);
-	if (*pte_chainp) {
-		ret = *pte_chainp;
-		*pte_chainp = NULL;
-		put_cpu_var(local_pte_chain);
-	} else {
-		put_cpu_var(local_pte_chain);
-		ret = kmem_cache_alloc(pte_chain_cache, gfp_flags);
-	}
-	return ret;
-}
-
-void __init pte_chain_init(void)
-{
-	pte_chain_cache = kmem_cache_create(	"pte_chain",
-						sizeof(struct pte_chain),
-						sizeof(struct pte_chain),
-						0,
-						pte_chain_ctor,
-						NULL);
-
-	if (!pte_chain_cache)
-		panic("failed to create pte_chain cache!\n");
 }
diff -Nru a/mm/shmem.c b/mm/shmem.c
--- a/mm/shmem.c	Tue Jun 15 22:20:39 2004
+++ b/mm/shmem.c	Tue Jun 15 22:20:39 2004
@@ -8,6 +8,7 @@
  *		 2002 Red Hat Inc.
  * Copyright (C) 2002-2003 Hugh Dickins.
  * Copyright (C) 2002-2003 VERITAS Software Corporation.
+ * Copyright (C) 2004 Andi Kleen, SuSE Labs
  *
  * This file is released under the GPL.
  */
@@ -37,8 +38,11 @@
 #include <linux/vfs.h>
 #include <linux/blkdev.h>
 #include <linux/security.h>
+#include <linux/swapops.h>
+#include <linux/mempolicy.h>
 #include <asm/uaccess.h>
 #include <asm/div64.h>
+#include <asm/pgtable.h>
 
 /* This magic number is used in glibc for posix shared memory */
 #define TMPFS_MAGIC	0x01021994
@@ -783,6 +787,74 @@
 	return WRITEPAGE_ACTIVATE;	/* Return with the page locked */
 }
 
+#ifdef CONFIG_NUMA
+static struct page *shmem_swapin_async(struct shared_policy *p,
+				       swp_entry_t entry, unsigned long idx)
+{
+	struct page *page;
+	struct vm_area_struct pvma;
+
+	/* Create a pseudo vma that just contains the policy */
+	memset(&pvma, 0, sizeof(struct vm_area_struct));
+	pvma.vm_end = PAGE_SIZE;
+	pvma.vm_pgoff = idx;
+	pvma.vm_policy = mpol_shared_policy_lookup(p, idx);
+	page = read_swap_cache_async(entry, &pvma, 0);
+	mpol_free(pvma.vm_policy);
+	return page;
+}
+
+struct page *shmem_swapin(struct shmem_inode_info *info, swp_entry_t entry,
+			  unsigned long idx)
+{
+	struct shared_policy *p = &info->policy;
+	int i, num;
+	struct page *page;
+	unsigned long offset;
+
+	num = valid_swaphandles(entry, &offset);
+	for (i = 0; i < num; offset++, i++) {
+		page = shmem_swapin_async(p,
+				swp_entry(swp_type(entry), offset), idx);
+		if (!page)
+			break;
+		page_cache_release(page);
+	}
+	lru_add_drain();	/* Push any new pages onto the LRU now */
+	return shmem_swapin_async(p, entry, idx);
+}
+
+static struct page *
+shmem_alloc_page(unsigned long gfp, struct shmem_inode_info *info,
+		 unsigned long idx)
+{
+	struct vm_area_struct pvma;
+	struct page *page;
+
+	memset(&pvma, 0, sizeof(struct vm_area_struct));
+	pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);
+	pvma.vm_pgoff = idx;
+	pvma.vm_end = PAGE_SIZE;
+	page = alloc_page_vma(gfp, &pvma, 0);
+	mpol_free(pvma.vm_policy);
+	return page;
+}
+#else
+static inline struct page *
+shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx)
+{
+	swapin_readahead(entry, 0, NULL);
+	return read_swap_cache_async(entry, NULL, 0);
+}
+
+static inline struct page *
+shmem_alloc_page(unsigned long gfp,struct shmem_inode_info *info,
+				 unsigned long idx)
+{
+	return alloc_page(gfp);
+}
+#endif
+
 /*
  * shmem_getpage - either get the page from swap or allocate a new one
  *
@@ -790,7 +862,8 @@
  * vm. If we swap it in we mark it dirty since we also free the swap
  * entry since a page cannot live in both the swap and page cache
  */
-static int shmem_getpage(struct inode *inode, unsigned long idx, struct page **pagep, enum sgp_type sgp, int *type)
+static int shmem_getpage(struct inode *inode, unsigned long idx,
+			struct page **pagep, enum sgp_type sgp, int *type)
 {
 	struct address_space *mapping = inode->i_mapping;
 	struct shmem_inode_info *info = SHMEM_I(inode);
@@ -840,8 +913,7 @@
 			if (majmin == VM_FAULT_MINOR && type)
 				inc_page_state(pgmajfault);
 			majmin = VM_FAULT_MAJOR;
-			swapin_readahead(swap);
-			swappage = read_swap_cache_async(swap);
+			swappage = shmem_swapin(info, swap, idx);
 			if (!swappage) {
 				spin_lock(&info->lock);
 				entry = shmem_swp_alloc(info, idx, sgp);
@@ -946,7 +1018,9 @@
 
 		if (!filepage) {
 			spin_unlock(&info->lock);
-			filepage = page_cache_alloc(mapping);
+			filepage = shmem_alloc_page(mapping_gfp_mask(mapping),
+						    info,
+						    idx);
 			if (!filepage) {
 				shmem_unacct_blocks(info->flags, 1);
 				shmem_free_block(inode);
@@ -1069,6 +1143,24 @@
 	return 0;
 }
 
+#ifdef CONFIG_NUMA
+int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
+{
+	struct inode *i = vma->vm_file->f_dentry->d_inode;
+	return mpol_set_shared_policy(&SHMEM_I(i)->policy, vma, new);
+}
+
+struct mempolicy *
+shmem_get_policy(struct vm_area_struct *vma, unsigned long addr)
+{
+	struct inode *i = vma->vm_file->f_dentry->d_inode;
+	unsigned long idx;
+
+	idx = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
+	return mpol_shared_policy_lookup(&SHMEM_I(i)->policy, idx);
+}
+#endif
+
 void shmem_lock(struct file *file, int lock)
 {
 	struct inode *inode = file->f_dentry->d_inode;
@@ -1117,6 +1209,7 @@
 		info = SHMEM_I(inode);
 		memset(info, 0, (char *)inode - (char *)info);
 		spin_lock_init(&info->lock);
+ 		mpol_shared_policy_init(&info->policy);
 		switch (mode & S_IFMT) {
 		default:
 			init_special_inode(inode, mode, dev);
@@ -1792,6 +1885,7 @@
 
 static void shmem_destroy_inode(struct inode *inode)
 {
+	mpol_free_shared_policy(&SHMEM_I(inode)->policy);
 	kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));
 }
 
@@ -1808,9 +1902,9 @@
 static int init_inodecache(void)
 {
 	shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
-					     sizeof(struct shmem_inode_info),
-					     0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
-					     init_once, NULL);
+				sizeof(struct shmem_inode_info),
+				0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+				init_once, NULL);
 	if (shmem_inode_cachep == NULL)
 		return -ENOMEM;
 	return 0;
@@ -1876,6 +1970,10 @@
 static struct vm_operations_struct shmem_vm_ops = {
 	.nopage		= shmem_nopage,
 	.populate	= shmem_populate,
+#ifdef CONFIG_NUMA
+	.set_policy     = shmem_set_policy,
+	.get_policy     = shmem_get_policy,
+#endif
 };
 
 static struct super_block *shmem_get_sb(struct file_system_type *fs_type,
diff -Nru a/mm/slab.c b/mm/slab.c
--- a/mm/slab.c	Tue Jun 15 22:20:43 2004
+++ b/mm/slab.c	Tue Jun 15 22:20:43 2004
@@ -135,11 +135,11 @@
 			 SLAB_POISON | SLAB_HWCACHE_ALIGN | \
 			 SLAB_NO_REAP | SLAB_CACHE_DMA | \
 			 SLAB_MUST_HWCACHE_ALIGN | SLAB_STORE_USER | \
-			 SLAB_RECLAIM_ACCOUNT )
+			 SLAB_RECLAIM_ACCOUNT | SLAB_PANIC)
 #else
 # define CREATE_MASK	(SLAB_HWCACHE_ALIGN | SLAB_NO_REAP | \
 			 SLAB_CACHE_DMA | SLAB_MUST_HWCACHE_ALIGN | \
-			 SLAB_RECLAIM_ACCOUNT)
+			 SLAB_RECLAIM_ACCOUNT | SLAB_PANIC)
 #endif
 
 /*
@@ -161,10 +161,9 @@
  * is less than 512 (PAGE_SIZE<<3), but greater than 256.
  */
 
-#define BUFCTL_END	0xffffFFFF
-#define BUFCTL_FREE	0xffffFFFE
-#define	SLAB_LIMIT	0xffffFFFD
-typedef unsigned int kmem_bufctl_t;
+#define BUFCTL_END	(((kmem_bufctl_t)(~0U))-0)
+#define BUFCTL_FREE	(((kmem_bufctl_t)(~0U))-1)
+#define	SLAB_LIMIT	(((kmem_bufctl_t)(~0U))-2)
 
 /* Max number of objs-per-slab for caches which use off-slab slabs.
  * Needed to avoid a possible looping condition in cache_grow().
@@ -478,10 +477,12 @@
 EXPORT_SYMBOL(malloc_sizes);
 
 /* Must match cache_sizes above. Out of line to keep cache footprint low. */
-static struct cache_names {
+struct cache_names {
 	char *name;
 	char *name_dma;
-} cache_names[] = {
+};
+
+static struct cache_names __initdata cache_names[] = {
 #define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
 #include <linux/kmalloc_sizes.h>
 	{ 0, }
@@ -613,6 +614,26 @@
 }
 #endif
 
+static struct array_cache *alloc_arraycache(int cpu, int entries, int batchcount)
+{
+	int memsize = sizeof(void*)*entries+sizeof(struct array_cache);
+	struct array_cache *nc = NULL;
+
+	if (cpu != -1) {
+		nc = kmem_cache_alloc_node(kmem_find_general_cachep(memsize,
+					GFP_KERNEL), cpu_to_node(cpu));
+	}
+	if (!nc)
+		nc = kmalloc(memsize, GFP_KERNEL);
+	if (nc) {
+		nc->avail = 0;
+		nc->limit = entries;
+		nc->batchcount = batchcount;
+		nc->touched = 0;
+	}
+	return nc;
+}
+
 static int __devinit cpuup_callback(struct notifier_block *nfb,
 				  unsigned long action,
 				  void *hcpu)
@@ -624,17 +645,11 @@
 	case CPU_UP_PREPARE:
 		down(&cache_chain_sem);
 		list_for_each_entry(cachep, &cache_chain, next) {
-			int memsize;
 			struct array_cache *nc;
 
-			memsize = sizeof(void*)*cachep->limit+sizeof(struct array_cache);
-			nc = kmalloc(memsize, GFP_KERNEL);
+			nc = alloc_arraycache(cpu, cachep->limit, cachep->batchcount);
 			if (!nc)
 				goto bad;
-			nc->avail = 0;
-			nc->limit = cachep->limit;
-			nc->batchcount = cachep->batchcount;
-			nc->touched = 0;
 
 			spin_lock_irq(&cachep->spinlock);
 			cachep->array[cpu] = nc;
@@ -741,11 +756,9 @@
 		 * eliminates "false sharing".
 		 * Note for systems short on memory removing the alignment will
 		 * allow tighter packing of the smaller caches. */
-		sizes->cs_cachep = kmem_cache_create(
-			names->name, sizes->cs_size,
-			ARCH_KMALLOC_MINALIGN, 0, NULL, NULL);
-		if (!sizes->cs_cachep)
-			BUG();
+		sizes->cs_cachep = kmem_cache_create(names->name,
+			sizes->cs_size, ARCH_KMALLOC_MINALIGN,
+			SLAB_PANIC, NULL, NULL);
 
 		/* Inc off-slab bufctl limit until the ceiling is hit. */
 		if (!(OFF_SLAB(sizes->cs_cachep))) {
@@ -753,11 +766,9 @@
 			offslab_limit /= sizeof(kmem_bufctl_t);
 		}
 
-		sizes->cs_dmacachep = kmem_cache_create(
-			names->name_dma, sizes->cs_size,
-			ARCH_KMALLOC_MINALIGN, SLAB_CACHE_DMA, NULL, NULL);
-		if (!sizes->cs_dmacachep)
-			BUG();
+		sizes->cs_dmacachep = kmem_cache_create(names->name_dma,
+			sizes->cs_size, ARCH_KMALLOC_MINALIGN,
+			(SLAB_CACHE_DMA | SLAB_PANIC), NULL, NULL);
 
 		sizes++;
 		names++;
@@ -830,23 +841,32 @@
  * did not request dmaable memory, we might get it, but that
  * would be relatively rare and ignorable.
  */
-static inline void *kmem_getpages(kmem_cache_t *cachep, unsigned long flags)
+static void *kmem_getpages(kmem_cache_t *cachep, int flags, int nodeid)
 {
+	struct page *page;
 	void *addr;
+	int i;
 
 	flags |= cachep->gfpflags;
-	addr = (void*)__get_free_pages(flags, cachep->gfporder);
-	if (addr) {
-		int i = (1 << cachep->gfporder);
-		struct page *page = virt_to_page(addr);
-
-		if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
-			atomic_add(i, &slab_reclaim_pages);
-		add_page_state(nr_slab, i);
-		while (i--) {
-			SetPageSlab(page);
-			page++;
-		}
+	if (likely(nodeid == -1)) {
+		addr = (void*)__get_free_pages(flags, cachep->gfporder);
+		if (!addr)
+			return NULL;
+		page = virt_to_page(addr);
+	} else {
+		page = alloc_pages_node(nodeid, flags, cachep->gfporder);
+		if (!page)
+			return NULL;
+		addr = page_address(page);
+	}
+
+	i = (1 << cachep->gfporder);
+	if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
+		atomic_add(i, &slab_reclaim_pages);
+	add_page_state(nr_slab, i);
+	while (i--) {
+		SetPageSlab(page);
+		page++;
 	}
 	return addr;
 }
@@ -1380,9 +1400,11 @@
 	up(&cache_chain_sem);
 	unlock_cpu_hotplug();
 opps:
+	if (!cachep && (flags & SLAB_PANIC))
+		panic("kmem_cache_create(): failed to create slab `%s'\n",
+			name);
 	return cachep;
 }
-
 EXPORT_SYMBOL(kmem_cache_create);
 
 static inline void check_irq_off(void)
@@ -1651,6 +1673,21 @@
 	}
 }
 
+static void set_slab_attr(kmem_cache_t *cachep, struct slab *slabp, void *objp)
+{
+	int i;
+	struct page *page;
+
+	/* Nasty!!!!!! I hope this is OK. */
+	i = 1 << cachep->gfporder;
+	page = virt_to_page(objp);
+	do {
+		SET_PAGE_CACHE(page, cachep);
+		SET_PAGE_SLAB(page, slabp);
+		page++;
+	} while (--i);
+}
+
 /*
  * Grow (by 1) the number of slabs within a cache.  This is called by
  * kmem_cache_alloc() when there are no active objs left in a cache.
@@ -1658,10 +1695,9 @@
 static int cache_grow (kmem_cache_t * cachep, int flags)
 {
 	struct slab	*slabp;
-	struct page	*page;
 	void		*objp;
 	size_t		 offset;
-	unsigned int	 i, local_flags;
+	int		 local_flags;
 	unsigned long	 ctor_flags;
 
 	/* Be lazy and only check for valid flags here,
@@ -1707,21 +1743,14 @@
 
 
 	/* Get mem for the objs. */
-	if (!(objp = kmem_getpages(cachep, flags)))
+	if (!(objp = kmem_getpages(cachep, flags, -1)))
 		goto failed;
 
 	/* Get slab management. */
 	if (!(slabp = alloc_slabmgmt(cachep, objp, offset, local_flags)))
 		goto opps1;
 
-	/* Nasty!!!!!! I hope this is OK. */
-	i = 1 << cachep->gfporder;
-	page = virt_to_page(objp);
-	do {
-		SET_PAGE_CACHE(page, cachep);
-		SET_PAGE_SLAB(page, slabp);
-		page++;
-	} while (--i);
+	set_slab_attr(cachep, slabp, objp);
 
 	cache_init_objs(cachep, slabp, ctor_flags);
 
@@ -2227,6 +2256,81 @@
 }
 
 /**
+ * kmem_cache_alloc_node - Allocate an object on the specified node
+ * @cachep: The cache to allocate from.
+ * @flags: See kmalloc().
+ * @nodeid: node number of the target node.
+ *
+ * Identical to kmem_cache_alloc, except that this function is slow
+ * and can sleep. And it will allocate memory on the given node, which
+ * can improve the performance for cpu bound structures.
+ */
+void *kmem_cache_alloc_node(kmem_cache_t *cachep, int nodeid)
+{
+	size_t offset;
+	void *objp;
+	struct slab *slabp;
+	kmem_bufctl_t next;
+
+	/* The main algorithms are not node aware, thus we have to cheat:
+	 * We bypass all caches and allocate a new slab.
+	 * The following code is a streamlined copy of cache_grow().
+	 */
+
+	/* Get colour for the slab, and update the next value. */
+	spin_lock_irq(&cachep->spinlock);
+	offset = cachep->colour_next;
+	cachep->colour_next++;
+	if (cachep->colour_next >= cachep->colour)
+		cachep->colour_next = 0;
+	offset *= cachep->colour_off;
+	spin_unlock_irq(&cachep->spinlock);
+
+	/* Get mem for the objs. */
+	if (!(objp = kmem_getpages(cachep, GFP_KERNEL, nodeid)))
+		goto failed;
+
+	/* Get slab management. */
+	if (!(slabp = alloc_slabmgmt(cachep, objp, offset, GFP_KERNEL)))
+		goto opps1;
+
+	set_slab_attr(cachep, slabp, objp);
+	cache_init_objs(cachep, slabp, SLAB_CTOR_CONSTRUCTOR);
+
+	/* The first object is ours: */
+	objp = slabp->s_mem + slabp->free*cachep->objsize;
+	slabp->inuse++;
+	next = slab_bufctl(slabp)[slabp->free];
+#if DEBUG
+	slab_bufctl(slabp)[slabp->free] = BUFCTL_FREE;
+#endif
+	slabp->free = next;
+
+	/* add the remaining objects into the cache */
+	spin_lock_irq(&cachep->spinlock);
+	check_slabp(cachep, slabp);
+	STATS_INC_GROWN(cachep);
+	/* Make slab active. */
+	if (slabp->free == BUFCTL_END) {
+		list_add_tail(&slabp->list, &(list3_data(cachep)->slabs_full));
+	} else {
+		list_add_tail(&slabp->list,
+				&(list3_data(cachep)->slabs_partial));
+		list3_data(cachep)->free_objects += cachep->num-1;
+	}
+	spin_unlock_irq(&cachep->spinlock);
+	objp = cache_alloc_debugcheck_after(cachep, GFP_KERNEL, objp,
+					__builtin_return_address(0));
+	return objp;
+opps1:
+	kmem_freepages(cachep, objp);
+failed:
+	return NULL;
+
+}
+EXPORT_SYMBOL(kmem_cache_alloc_node);
+
+/**
  * kmalloc - allocate memory
  * @size: how many bytes of memory are required.
  * @flags: the type of memory to allocate.
@@ -2290,7 +2394,10 @@
 	for (i = 0; i < NR_CPUS; i++) {
 		if (!cpu_possible(i))
 			continue;
-		pdata->ptrs[i] = kmalloc(size, GFP_KERNEL);
+		pdata->ptrs[i] = kmem_cache_alloc_node(
+				kmem_find_general_cachep(size, GFP_KERNEL),
+				cpu_to_node(i));
+
 		if (!pdata->ptrs[i])
 			goto unwind_oom;
 		memset(pdata->ptrs[i], 0, size);
@@ -2429,19 +2536,15 @@
 
 	memset(&new.new,0,sizeof(new.new));
 	for (i = 0; i < NR_CPUS; i++) {
-		struct array_cache *ccnew;
-
-		ccnew = kmalloc(sizeof(void*)*limit+
-				sizeof(struct array_cache), GFP_KERNEL);
-		if (!ccnew) {
-			for (i--; i >= 0; i--) kfree(new.new[i]);
-			return -ENOMEM;
-		}
-		ccnew->avail = 0;
-		ccnew->limit = limit;
-		ccnew->batchcount = batchcount;
-		ccnew->touched = 0;
-		new.new[i] = ccnew;
+		if (cpu_online(i)) {
+			new.new[i] = alloc_arraycache(i, limit, batchcount);
+			if (!new.new[i]) {
+				for (i--; i >= 0; i--) kfree(new.new[i]);
+				return -ENOMEM;
+			}
+		} else {
+			new.new[i] = NULL;
+		}
 	}
 	new.cachep = cachep;
 
@@ -2463,14 +2566,9 @@
 		spin_unlock_irq(&cachep->spinlock);
 		kfree(ccold);
 	}
-	new_shared = kmalloc(sizeof(void*)*batchcount*shared+
-				sizeof(struct array_cache), GFP_KERNEL);
+	new_shared = alloc_arraycache(-1, batchcount*shared, 0xbaadf00d);
 	if (new_shared) {
 		struct array_cache *old;
-		new_shared->avail = 0;
-		new_shared->limit = batchcount*shared;
-		new_shared->batchcount = 0xbaadf00d;
-		new_shared->touched = 0;
 
 		spin_lock_irq(&cachep->spinlock);
 		old = cachep->lists.shared;
diff -Nru a/mm/swap_state.c b/mm/swap_state.c
--- a/mm/swap_state.c	Tue Jun 15 22:20:39 2004
+++ b/mm/swap_state.c	Tue Jun 15 22:20:39 2004
@@ -6,35 +6,41 @@
  *
  *  Rewritten to use page cache, (C) 1998 Stephen Tweedie
  */
-
+#include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/kernel_stat.h>
 #include <linux/swap.h>
 #include <linux/init.h>
 #include <linux/pagemap.h>
+#include <linux/buffer_head.h>
 #include <linux/backing-dev.h>
 
 #include <asm/pgtable.h>
 
 /*
  * swapper_space is a fiction, retained to simplify the path through
- * vmscan's shrink_list.  Only those fields initialized below are used.
+ * vmscan's shrink_list, to make sync_page look nicer, and to allow
+ * future use of radix_tree tags in the swap cache.
  */
 static struct address_space_operations swap_aops = {
 	.writepage	= swap_writepage,
+	.sync_page	= block_sync_page,
+	.set_page_dirty	= __set_page_dirty_nobuffers,
 };
 
 static struct backing_dev_info swap_backing_dev_info = {
-	.state		= 0,	/* uncongested */
+	.memory_backed	= 1,	/* Does not contribute to dirty memory */
+	.unplug_io_fn	= swap_unplug_io_fn,
 };
 
 struct address_space swapper_space = {
 	.page_tree	= RADIX_TREE_INIT(GFP_ATOMIC),
 	.tree_lock	= SPIN_LOCK_UNLOCKED,
-	.nrpages	= 0,	/* total_swapcache_pages */
 	.a_ops		= &swap_aops,
+	.i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear),
 	.backing_dev_info = &swap_backing_dev_info,
 };
+EXPORT_SYMBOL(swapper_space);
 
 #define INC_CACHE_INFO(x)	do { swap_cache_info.x++; } while (0)
 
@@ -68,19 +74,18 @@
 	BUG_ON(PagePrivate(page));
 	error = radix_tree_preload(gfp_mask);
 	if (!error) {
-		page_cache_get(page);
-		spin_lock(&swapper_space.tree_lock);
+		spin_lock_irq(&swapper_space.tree_lock);
 		error = radix_tree_insert(&swapper_space.page_tree,
 						entry.val, page);
 		if (!error) {
+			page_cache_get(page);
 			SetPageLocked(page);
 			SetPageSwapCache(page);
 			page->private = entry.val;
 			total_swapcache_pages++;
 			pagecache_acct(1);
-		} else
-			page_cache_release(page);
-		spin_unlock(&swapper_space.tree_lock);
+		}
+		spin_unlock_irq(&swapper_space.tree_lock);
 		radix_tree_preload_end();
 	}
 	return error;
@@ -207,9 +212,9 @@
   
 	entry.val = page->private;
 
-	spin_lock(&swapper_space.tree_lock);
+	spin_lock_irq(&swapper_space.tree_lock);
 	__delete_from_swap_cache(page);
-	spin_unlock(&swapper_space.tree_lock);
+	spin_unlock_irq(&swapper_space.tree_lock);
 
 	swap_free(entry);
 	page_cache_release(page);
@@ -308,13 +313,13 @@
 {
 	struct page *page;
 
-	spin_lock(&swapper_space.tree_lock);
+	spin_lock_irq(&swapper_space.tree_lock);
 	page = radix_tree_lookup(&swapper_space.page_tree, entry.val);
 	if (page) {
 		page_cache_get(page);
 		INC_CACHE_INFO(find_success);
 	}
-	spin_unlock(&swapper_space.tree_lock);
+	spin_unlock_irq(&swapper_space.tree_lock);
 	INC_CACHE_INFO(find_total);
 	return page;
 }
@@ -325,7 +330,8 @@
  * A failure return means that either the page allocation failed or that
  * the swap entry is no longer in use.
  */
-struct page * read_swap_cache_async(swp_entry_t entry)
+struct page *read_swap_cache_async(swp_entry_t entry,
+			struct vm_area_struct *vma, unsigned long addr)
 {
 	struct page *found_page, *new_page = NULL;
 	int err;
@@ -336,12 +342,12 @@
 		 * called after lookup_swap_cache() failed, re-calling
 		 * that would confuse statistics.
 		 */
-		spin_lock(&swapper_space.tree_lock);
+		spin_lock_irq(&swapper_space.tree_lock);
 		found_page = radix_tree_lookup(&swapper_space.page_tree,
 						entry.val);
 		if (found_page)
 			page_cache_get(found_page);
-		spin_unlock(&swapper_space.tree_lock);
+		spin_unlock_irq(&swapper_space.tree_lock);
 		if (found_page)
 			break;
 
@@ -349,7 +355,7 @@
 		 * Get a new page to read into from swap.
 		 */
 		if (!new_page) {
-			new_page = alloc_page(GFP_HIGHUSER);
+			new_page = alloc_page_vma(GFP_HIGHUSER, vma, addr);
 			if (!new_page)
 				break;		/* Out of memory */
 		}
diff -Nru a/mm/swapfile.c b/mm/swapfile.c
--- a/mm/swapfile.c	Tue Jun 15 22:20:37 2004
+++ b/mm/swapfile.c	Tue Jun 15 22:20:37 2004
@@ -7,6 +7,7 @@
 
 #include <linux/config.h>
 #include <linux/mm.h>
+#include <linux/hugetlb.h>
 #include <linux/mman.h>
 #include <linux/slab.h>
 #include <linux/kernel_stat.h>
@@ -48,68 +49,38 @@
 static DECLARE_MUTEX(swapon_sem);
 
 /*
- * Array of backing blockdevs, for swap_unplug_fn.  We need this because the
- * bdev->unplug_fn can sleep and we cannot hold swap_list_lock while calling
- * the unplug_fn.  And swap_list_lock cannot be turned into a semaphore.
+ * We need this because the bdev->unplug_fn can sleep and we cannot
+ * hold swap_list_lock while calling the unplug_fn. And swap_list_lock
+ * cannot be turned into a semaphore.
  */
-static DECLARE_MUTEX(swap_bdevs_sem);
-static struct block_device *swap_bdevs[MAX_SWAPFILES];
+static DECLARE_RWSEM(swap_unplug_sem);
 
 #define SWAPFILE_CLUSTER 256
 
-/*
- * Caller holds swap_bdevs_sem
- */
-static void install_swap_bdev(struct block_device *bdev)
-{
-	int i;
-
-	for (i = 0; i < MAX_SWAPFILES; i++) {
-		if (swap_bdevs[i] == NULL) {
-			swap_bdevs[i] = bdev;
-			return;
-		}
-	}
-	BUG();
-}
-
-static void remove_swap_bdev(struct block_device *bdev)
-{
-	int i;
-
-	for (i = 0; i < MAX_SWAPFILES; i++) {
-		if (swap_bdevs[i] == bdev) {
-			memcpy(&swap_bdevs[i], &swap_bdevs[i + 1],
-				(MAX_SWAPFILES - i - 1) * sizeof(*swap_bdevs));
-			swap_bdevs[MAX_SWAPFILES - 1] = NULL;
-			return;
-		}
-	}
-	BUG();
-}
-
-/*
- * Unlike a standard unplug_io_fn, swap_unplug_io_fn is never called
- * through swap's backing_dev_info (which is only used by shrink_list),
- * but directly from sync_page when PageSwapCache: and takes the page
- * as argument, so that it can find the right device from swp_entry_t.
- */
-void swap_unplug_io_fn(struct page *page)
+void swap_unplug_io_fn(struct backing_dev_info *unused_bdi, struct page *page)
 {
 	swp_entry_t entry;
 
-	down(&swap_bdevs_sem);
+	down_read(&swap_unplug_sem);
 	entry.val = page->private;
 	if (PageSwapCache(page)) {
-		struct block_device *bdev = swap_bdevs[swp_type(entry)];
+		struct block_device *bdev = swap_info[swp_type(entry)].bdev;
 		struct backing_dev_info *bdi;
 
-		if (bdev) {
-			bdi = bdev->bd_inode->i_mapping->backing_dev_info;
-			(*bdi->unplug_io_fn)(bdi);
-		}
+		/*
+		 * If the page is removed from swapcache from under us (with a
+		 * racy try_to_unuse/swapoff) we need an additional reference
+		 * count to avoid reading garbage from page->private above. If
+		 * the WARN_ON triggers during a swapoff it maybe the race
+		 * condition and it's harmless. However if it triggers without
+		 * swapoff it signals a problem.
+		 */
+		WARN_ON(page_count(page) <= 1);
+
+		bdi = bdev->bd_inode->i_mapping->backing_dev_info;
+		bdi->unplug_io_fn(bdi, page);
 	}
-	up(&swap_bdevs_sem);
+	up_read(&swap_unplug_sem);
 }
 
 static inline int scan_swap_map(struct swap_info_struct *si)
@@ -319,10 +290,10 @@
 		/* Is the only swap cache user the cache itself? */
 		if (p->swap_map[swp_offset(entry)] == 1) {
 			/* Recheck the page count with the swapcache lock held.. */
-			spin_lock(&swapper_space.tree_lock);
+			spin_lock_irq(&swapper_space.tree_lock);
 			if (page_count(page) == 2)
 				retval = 1;
-			spin_unlock(&swapper_space.tree_lock);
+			spin_unlock_irq(&swapper_space.tree_lock);
 		}
 		swap_info_put(p);
 	}
@@ -390,13 +361,13 @@
 	retval = 0;
 	if (p->swap_map[swp_offset(entry)] == 1) {
 		/* Recheck the page count with the swapcache lock held.. */
-		spin_lock(&swapper_space.tree_lock);
+		spin_lock_irq(&swapper_space.tree_lock);
 		if ((page_count(page) == 2) && !PageWriteback(page)) {
 			__delete_from_swap_cache(page);
 			SetPageDirty(page);
 			retval = 1;
 		}
-		spin_unlock(&swapper_space.tree_lock);
+		spin_unlock_irq(&swapper_space.tree_lock);
 	}
 	swap_info_put(p);
 
@@ -420,12 +391,12 @@
 	p = swap_info_get(entry);
 	if (p) {
 		if (swap_entry_free(p, swp_offset(entry)) == 1) {
-			spin_lock(&swapper_space.tree_lock);
+			spin_lock_irq(&swapper_space.tree_lock);
 			page = radix_tree_lookup(&swapper_space.page_tree,
 				entry.val);
 			if (page && TestSetPageLocked(page))
 				page = NULL;
-			spin_unlock(&swapper_space.tree_lock);
+			spin_unlock_irq(&swapper_space.tree_lock);
 		}
 		swap_info_put(p);
 	}
@@ -457,19 +428,19 @@
 /* vma->vm_mm->page_table_lock is held */
 static void
 unuse_pte(struct vm_area_struct *vma, unsigned long address, pte_t *dir,
-	swp_entry_t entry, struct page *page, struct pte_chain **pte_chainp)
+	swp_entry_t entry, struct page *page)
 {
 	vma->vm_mm->rss++;
 	get_page(page);
 	set_pte(dir, pte_mkold(mk_pte(page, vma->vm_page_prot)));
-	*pte_chainp = page_add_rmap(page, dir, *pte_chainp);
+	page_add_anon_rmap(page, vma, address);
 	swap_free(entry);
 }
 
 /* vma->vm_mm->page_table_lock is held */
-static int unuse_pmd(struct vm_area_struct * vma, pmd_t *dir,
+static unsigned long unuse_pmd(struct vm_area_struct * vma, pmd_t *dir,
 	unsigned long address, unsigned long size, unsigned long offset,
-	swp_entry_t entry, struct page *page, struct pte_chain **pte_chainp)
+	swp_entry_t entry, struct page *page)
 {
 	pte_t * pte;
 	unsigned long end;
@@ -494,10 +465,10 @@
 		 * Test inline before going to call unuse_pte.
 		 */
 		if (unlikely(pte_same(*pte, swp_pte))) {
-			unuse_pte(vma, offset + address, pte,
-					entry, page, pte_chainp);
+			unuse_pte(vma, offset + address, pte, entry, page);
 			pte_unmap(pte);
-			return 1;
+			/* add 1 since address may be 0 */
+			return 1 + offset + address;
 		}
 		address += PAGE_SIZE;
 		pte++;
@@ -507,12 +478,13 @@
 }
 
 /* vma->vm_mm->page_table_lock is held */
-static int unuse_pgd(struct vm_area_struct * vma, pgd_t *dir,
+static unsigned long unuse_pgd(struct vm_area_struct * vma, pgd_t *dir,
 	unsigned long address, unsigned long size,
-	swp_entry_t entry, struct page *page, struct pte_chain **pte_chainp)
+	swp_entry_t entry, struct page *page)
 {
 	pmd_t * pmd;
 	unsigned long offset, end;
+	unsigned long foundaddr;
 
 	if (pgd_none(*dir))
 		return 0;
@@ -530,9 +502,10 @@
 	if (address >= end)
 		BUG();
 	do {
-		if (unuse_pmd(vma, pmd, address, end - address,
-				offset, entry, page, pte_chainp))
-			return 1;
+		foundaddr = unuse_pmd(vma, pmd, address, end - address,
+						offset, entry, page);
+		if (foundaddr)
+			return foundaddr;
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;
 	} while (address && (address < end));
@@ -540,17 +513,19 @@
 }
 
 /* vma->vm_mm->page_table_lock is held */
-static int unuse_vma(struct vm_area_struct * vma, pgd_t *pgdir,
-	swp_entry_t entry, struct page *page, struct pte_chain **pte_chainp)
+static unsigned long unuse_vma(struct vm_area_struct * vma, pgd_t *pgdir,
+	swp_entry_t entry, struct page *page)
 {
 	unsigned long start = vma->vm_start, end = vma->vm_end;
+	unsigned long foundaddr;
 
 	if (start >= end)
 		BUG();
 	do {
-		if (unuse_pgd(vma, pgdir, start, end - start,
-				entry, page, pte_chainp))
-			return 1;
+		foundaddr = unuse_pgd(vma, pgdir, start, end - start,
+						entry, page);
+		if (foundaddr)
+			return foundaddr;
 		start = (start + PGDIR_SIZE) & PGDIR_MASK;
 		pgdir++;
 	} while (start && (start < end));
@@ -561,23 +536,27 @@
 			swp_entry_t entry, struct page* page)
 {
 	struct vm_area_struct* vma;
-	struct pte_chain *pte_chain;
-
-	pte_chain = pte_chain_alloc(GFP_KERNEL);
-	if (!pte_chain)
-		return -ENOMEM;
+	unsigned long foundaddr = 0;
 
 	/*
 	 * Go through process' page directory.
 	 */
+	down_read(&mm->mmap_sem);
 	spin_lock(&mm->page_table_lock);
 	for (vma = mm->mmap; vma; vma = vma->vm_next) {
-		pgd_t * pgd = pgd_offset(mm, vma->vm_start);
-		if (unuse_vma(vma, pgd, entry, page, &pte_chain))
-			break;
+		if (!is_vm_hugetlb_page(vma)) {
+			pgd_t * pgd = pgd_offset(mm, vma->vm_start);
+			foundaddr = unuse_vma(vma, pgd, entry, page);
+			if (foundaddr)
+				break;
+		}
 	}
 	spin_unlock(&mm->page_table_lock);
-	pte_chain_free(pte_chain);
+	up_read(&mm->mmap_sem);
+	/*
+	 * Currently unuse_process cannot fail, but leave error handling
+	 * at call sites for now, since we change it from time to time.
+	 */
 	return 0;
 }
 
@@ -679,7 +658,7 @@
 		 */
 		swap_map = &si->swap_map[i];
 		entry = swp_entry(type, i);
-		page = read_swap_cache_async(entry);
+		page = read_swap_cache_async(entry, NULL, 0);
 		if (!page) {
 			/*
 			 * Either swap_duplicate() failed because entry
@@ -1143,6 +1122,11 @@
 	current->flags |= PF_SWAPOFF;
 	err = try_to_unuse(type);
 	current->flags &= ~PF_SWAPOFF;
+
+	/* wait for any unplug function to finish */
+	down_write(&swap_unplug_sem);
+	up_write(&swap_unplug_sem);
+
 	if (err) {
 		/* re-insert swap space back into swap_list */
 		swap_list_lock();
@@ -1161,7 +1145,6 @@
 		goto out_dput;
 	}
 	down(&swapon_sem);
-	down(&swap_bdevs_sem);
 	swap_list_lock();
 	swap_device_lock(p);
 	swap_file = p->swap_file;
@@ -1173,8 +1156,6 @@
 	destroy_swap_extents(p);
 	swap_device_unlock(p);
 	swap_list_unlock();
-	remove_swap_bdev(p->bdev);
-	up(&swap_bdevs_sem);
 	up(&swapon_sem);
 	vfree(swap_map);
 	if (S_ISBLK(mapping->host->i_mode)) {
@@ -1518,7 +1499,6 @@
 		goto bad_swap;
 
 	down(&swapon_sem);
-	down(&swap_bdevs_sem);
 	swap_list_lock();
 	swap_device_lock(p);
 	p->flags = SWP_ACTIVE;
@@ -1544,8 +1524,6 @@
 	}
 	swap_device_unlock(p);
 	swap_list_unlock();
-	install_swap_bdev(p->bdev);
-	up(&swap_bdevs_sem);
 	up(&swapon_sem);
 	error = 0;
 	goto out;
diff -Nru a/mm/vmalloc.c b/mm/vmalloc.c
--- a/mm/vmalloc.c	Tue Jun 15 22:20:41 2004
+++ b/mm/vmalloc.c	Tue Jun 15 22:20:41 2004
@@ -284,6 +284,7 @@
 
 	if ((PAGE_SIZE-1) & (unsigned long)addr) {
 		printk(KERN_ERR "Trying to vfree() bad address (%p)\n", addr);
+		WARN_ON(1);
 		return;
 	}
 
@@ -291,6 +292,7 @@
 	if (unlikely(!area)) {
 		printk(KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n",
 				addr);
+		WARN_ON(1);
 		return;
 	}
 	
diff -Nru a/mm/vmscan.c b/mm/vmscan.c
--- a/mm/vmscan.c	Tue Jun 15 22:20:37 2004
+++ b/mm/vmscan.c	Tue Jun 15 22:20:37 2004
@@ -153,20 +153,23 @@
 		delta *= (*shrinker->shrinker)(0, gfp_mask);
 		do_div(delta, pages + 1);
 		shrinker->nr += delta;
-		if (shrinker->nr > SHRINK_BATCH) {
-			long nr_to_scan = shrinker->nr;
+		if (shrinker->nr < 0)
+			shrinker->nr = LONG_MAX;	/* It wrapped! */
 
-			shrinker->nr = 0;
-			mod_page_state(slabs_scanned, nr_to_scan);
-			while (nr_to_scan) {
-				long this_scan = nr_to_scan;
-
-				if (this_scan > 128)
-					this_scan = 128;
-				(*shrinker->shrinker)(this_scan, gfp_mask);
-				nr_to_scan -= this_scan;
-				cond_resched();
-			}
+		if (shrinker->nr <= SHRINK_BATCH)
+			continue;
+		while (shrinker->nr) {
+			long this_scan = shrinker->nr;
+			int shrink_ret;
+
+			if (this_scan > 128)
+				this_scan = 128;
+			shrink_ret = (*shrinker->shrinker)(this_scan, gfp_mask);
+			mod_page_state(slabs_scanned, this_scan);
+			shrinker->nr -= this_scan;
+			if (shrink_ret == -1)
+				break;
+			cond_resched();
 		}
 	}
 	up(&shrinker_sem);
@@ -237,23 +240,113 @@
 	unlock_page(page);
 }
 
+/* possible outcome of pageout() */
+typedef enum {
+	/* failed to write page out, page is locked */
+	PAGE_KEEP,
+	/* move page to the active list, page is locked */
+	PAGE_ACTIVATE,
+	/* page has been sent to the disk successfully, page is unlocked */
+	PAGE_SUCCESS,
+	/* page is clean and locked */
+	PAGE_CLEAN,
+} pageout_t;
+
 /*
- * shrink_list returns the number of reclaimed pages
+ * pageout is called by shrink_list() for each dirty page. Calls ->writepage().
  */
-static int
-shrink_list(struct list_head *page_list, unsigned int gfp_mask,
-		int *nr_scanned, int do_writepage)
+static pageout_t pageout(struct page *page, struct address_space *mapping)
+{
+	/*
+	 * If the page is dirty, only perform writeback if that write
+	 * will be non-blocking.  To prevent this allocation from being
+	 * stalled by pagecache activity.  But note that there may be
+	 * stalls if we need to run get_block().  We could test
+	 * PagePrivate for that.
+	 *
+	 * If this process is currently in generic_file_write() against
+	 * this page's queue, we can perform writeback even if that
+	 * will block.
+	 *
+	 * If the page is swapcache, write it back even if that would
+	 * block, for some throttling. This happens by accident, because
+	 * swap_backing_dev_info is bust: it doesn't reflect the
+	 * congestion state of the swapdevs.  Easy to fix, if needed.
+	 * See swapfile.c:page_queue_congested().
+	 */
+	if (!is_page_cache_freeable(page))
+		return PAGE_KEEP;
+	if (!mapping)
+		return PAGE_KEEP;
+	if (mapping->a_ops->writepage == NULL)
+		return PAGE_ACTIVATE;
+	if (!may_write_to_queue(mapping->backing_dev_info))
+		return PAGE_KEEP;
+
+	if (clear_page_dirty_for_io(page)) {
+		int res;
+		struct writeback_control wbc = {
+			.sync_mode = WB_SYNC_NONE,
+			.nr_to_write = SWAP_CLUSTER_MAX,
+			.nonblocking = 1,
+			.for_reclaim = 1,
+		};
+
+		SetPageReclaim(page);
+		res = mapping->a_ops->writepage(page, &wbc);
+		if (res < 0)
+			handle_write_error(mapping, page, res);
+		if (res == WRITEPAGE_ACTIVATE) {
+			ClearPageReclaim(page);
+			return PAGE_ACTIVATE;
+		}
+		if (!PageWriteback(page)) {
+			/* synchronous write or broken a_ops? */
+			ClearPageReclaim(page);
+		}
+
+		return PAGE_SUCCESS;
+	}
+
+	return PAGE_CLEAN;
+}
+
+struct scan_control {
+	/* Ask refill_inactive_zone, or shrink_cache to scan this many pages */
+	unsigned long nr_to_scan;
+
+	/* Incremented by the number of inactive pages that were scanned */
+	unsigned long nr_scanned;
+
+	/* Incremented by the number of pages reclaimed */
+	unsigned long nr_reclaimed;
+
+	unsigned long nr_mapped;	/* From page_state */
+
+	/* Ask shrink_caches, or shrink_zone to scan at this priority */
+	unsigned int priority;
+
+	/* This context's GFP mask */
+	unsigned int gfp_mask;
+
+	int may_writepage;
+};
+
+/*
+ * shrink_list adds the number of reclaimed pages to sc->nr_reclaimed
+ */
+static int shrink_list(struct list_head *page_list, struct scan_control *sc)
 {
-	struct address_space *mapping;
 	LIST_HEAD(ret_pages);
 	struct pagevec freed_pvec;
 	int pgactivate = 0;
-	int ret = 0;
+	int reclaimed = 0;
 
 	cond_resched();
 
 	pagevec_init(&freed_pvec, 1);
 	while (!list_empty(page_list)) {
+		struct address_space *mapping;
 		struct page *page;
 		int may_enter_fs;
 		int referenced;
@@ -264,26 +357,24 @@
 		if (TestSetPageLocked(page))
 			goto keep;
 
-		/* Double the slab pressure for mapped and swapcache pages */
-		if (page_mapped(page) || PageSwapCache(page))
-			(*nr_scanned)++;
-
 		BUG_ON(PageActive(page));
 
 		if (PageWriteback(page))
 			goto keep_locked;
 
-		rmap_lock(page);
+		sc->nr_scanned++;
+		/* Double the slab pressure for mapped and swapcache pages */
+		if (page_mapped(page) || PageSwapCache(page))
+			sc->nr_scanned++;
+
+		page_map_lock(page);
 		referenced = page_referenced(page);
 		if (referenced && page_mapping_inuse(page)) {
 			/* In active use or really unfreeable.  Activate it. */
-			rmap_unlock(page);
+			page_map_unlock(page);
 			goto activate_locked;
 		}
 
-		mapping = page_mapping(page);
-		may_enter_fs = (gfp_mask & __GFP_FS);
-
 #ifdef CONFIG_SWAP
 		/*
 		 * Anonymous process memory has backing store?
@@ -292,17 +383,17 @@
 		 * XXX: implement swap clustering ?
 		 */
 		if (PageAnon(page) && !PageSwapCache(page)) {
-			rmap_unlock(page);
+			page_map_unlock(page);
 			if (!add_to_swap(page))
 				goto activate_locked;
-			rmap_lock(page);
-		}
-		if (PageSwapCache(page)) {
-			mapping = &swapper_space;
-			may_enter_fs = (gfp_mask & __GFP_IO);
+			page_map_lock(page);
 		}
 #endif /* CONFIG_SWAP */
 
+		mapping = page_mapping(page);
+		may_enter_fs = (sc->gfp_mask & __GFP_FS) ||
+			(PageSwapCache(page) && (sc->gfp_mask & __GFP_IO));
+
 		/*
 		 * The page is mapped into the page tables of one or more
 		 * processes. Try to unmap it here.
@@ -310,71 +401,45 @@
 		if (page_mapped(page) && mapping) {
 			switch (try_to_unmap(page)) {
 			case SWAP_FAIL:
-				rmap_unlock(page);
+				page_map_unlock(page);
 				goto activate_locked;
 			case SWAP_AGAIN:
-				rmap_unlock(page);
+				page_map_unlock(page);
 				goto keep_locked;
 			case SWAP_SUCCESS:
 				; /* try to free the page below */
 			}
 		}
-		rmap_unlock(page);
+		page_map_unlock(page);
 
-		/*
-		 * If the page is dirty, only perform writeback if that write
-		 * will be non-blocking.  To prevent this allocation from being
-		 * stalled by pagecache activity.  But note that there may be
-		 * stalls if we need to run get_block().  We could test
-		 * PagePrivate for that.
-		 *
-		 * If this process is currently in generic_file_write() against
-		 * this page's queue, we can perform writeback even if that
-		 * will block.
-		 *
-		 * If the page is swapcache, write it back even if that would
-		 * block, for some throttling. This happens by accident, because
-		 * swap_backing_dev_info is bust: it doesn't reflect the
-		 * congestion state of the swapdevs.  Easy to fix, if needed.
-		 * See swapfile.c:page_queue_congested().
-		 */
 		if (PageDirty(page)) {
 			if (referenced)
 				goto keep_locked;
-			if (!is_page_cache_freeable(page))
-				goto keep_locked;
-			if (!mapping)
-				goto keep_locked;
-			if (mapping->a_ops->writepage == NULL)
-				goto activate_locked;
 			if (!may_enter_fs)
 				goto keep_locked;
-			if (!may_write_to_queue(mapping->backing_dev_info))
+			if (laptop_mode && !sc->may_writepage)
 				goto keep_locked;
-			if (laptop_mode && !do_writepage)
+
+			/* Page is dirty, try to write it out here */
+			switch(pageout(page, mapping)) {
+			case PAGE_KEEP:
 				goto keep_locked;
-			if (clear_page_dirty_for_io(page)) {
-				int res;
-				struct writeback_control wbc = {
-					.sync_mode = WB_SYNC_NONE,
-					.nr_to_write = SWAP_CLUSTER_MAX,
-					.nonblocking = 1,
-					.for_reclaim = 1,
-				};
-
-				SetPageReclaim(page);
-				res = mapping->a_ops->writepage(page, &wbc);
-				if (res < 0)
-					handle_write_error(mapping, page, res);
-				if (res == WRITEPAGE_ACTIVATE) {
-					ClearPageReclaim(page);
-					goto activate_locked;
-				}
-				if (!PageWriteback(page)) {
-					/* synchronous write or broken a_ops? */
-					ClearPageReclaim(page);
-				}
-				goto keep;
+			case PAGE_ACTIVATE:
+				goto activate_locked;
+			case PAGE_SUCCESS:
+				if (PageWriteback(page) || PageDirty(page))
+					goto keep;
+				/*
+				 * A synchronous write - probably a ramdisk.  Go
+				 * ahead and try to reclaim the page.
+				 */
+				if (TestSetPageLocked(page))
+					goto keep;
+				if (PageDirty(page) || PageWriteback(page))
+					goto keep_locked;
+				mapping = page_mapping(page);
+			case PAGE_CLEAN:
+				; /* try to free the page below */
 			}
 		}
 
@@ -396,11 +461,11 @@
 		 * the pages which were not successfully invalidated in
 		 * truncate_complete_page().  We try to drop those buffers here
 		 * and if that worked, and the page is no longer mapped into
-		 * process address space (page_count == 0) it can be freed.
+		 * process address space (page_count == 1) it can be freed.
 		 * Otherwise, leave the page on the LRU so it is swappable.
 		 */
 		if (PagePrivate(page)) {
-			if (!try_to_release_page(page, gfp_mask))
+			if (!try_to_release_page(page, sc->gfp_mask))
 				goto activate_locked;
 			if (!mapping && page_count(page) == 1)
 				goto free_it;
@@ -438,7 +503,7 @@
 
 free_it:
 		unlock_page(page);
-		ret++;
+		reclaimed++;
 		if (!pagevec_add(&freed_pvec, page))
 			__pagevec_release_nonlru(&freed_pvec);
 		continue;
@@ -456,7 +521,8 @@
 	if (pagevec_count(&freed_pvec))
 		__pagevec_release_nonlru(&freed_pvec);
 	mod_page_state(pgactivate, pgactivate);
-	return ret;
+	sc->nr_reclaimed += reclaimed;
+	return reclaimed;
 }
 
 /*
@@ -464,19 +530,16 @@
  * a batch of pages and working on them outside the lock.  Any pages which were
  * not freed will be added back to the LRU.
  *
- * shrink_cache() is passed the number of pages to scan and returns the number
- * of pages which were reclaimed.
+ * shrink_cache() adds the number of pages reclaimed to sc->nr_reclaimed
  *
  * For pagecache intensive workloads, the first loop here is the hottest spot
  * in the kernel (apart from the copy_*_user functions).
  */
-static int
-shrink_cache(struct zone *zone, unsigned int gfp_mask,
-		int max_scan, int *total_scanned, int do_writepage)
+static void shrink_cache(struct zone *zone, struct scan_control *sc)
 {
 	LIST_HEAD(page_list);
 	struct pagevec pvec;
-	int ret = 0;
+	int max_scan = sc->nr_to_scan;
 
 	pagevec_init(&pvec, 1);
 
@@ -498,14 +561,16 @@
 			if (!TestClearPageLRU(page))
 				BUG();
 			list_del(&page->lru);
-			if (page_count(page) == 0) {
-				/* It is currently in pagevec_release() */
+			if (get_page_testone(page)) {
+				/*
+				 * It is being freed elsewhere
+				 */
+				__put_page(page);
 				SetPageLRU(page);
 				list_add(&page->lru, &zone->inactive_list);
 				continue;
 			}
 			list_add(&page->lru, &page_list);
-			page_cache_get(page);
 			nr_taken++;
 		}
 		zone->nr_inactive -= nr_taken;
@@ -520,17 +585,11 @@
 			mod_page_state_zone(zone, pgscan_kswapd, nr_scan);
 		else
 			mod_page_state_zone(zone, pgscan_direct, nr_scan);
-		nr_freed = shrink_list(&page_list, gfp_mask,
-					total_scanned, do_writepage);
-		*total_scanned += nr_taken;
+		nr_freed = shrink_list(&page_list, sc);
 		if (current_is_kswapd())
 			mod_page_state(kswapd_steal, nr_freed);
 		mod_page_state_zone(zone, pgsteal, nr_freed);
 
-		ret += nr_freed;
-		if (nr_freed <= 0 && list_empty(&page_list))
-			goto done;
-
 		spin_lock_irq(&zone->lru_lock);
 		/*
 		 * Put back any unfreeable pages.
@@ -554,7 +613,6 @@
 	spin_unlock_irq(&zone->lru_lock);
 done:
 	pagevec_release(&pvec);
-	return ret;
 }
 
 /*
@@ -571,16 +629,16 @@
  * It is safe to rely on PG_active against the non-LRU pages in here because
  * nobody will play with that bit on a non-LRU page.
  *
- * The downside is that we have to touch page->count against each page.
+ * The downside is that we have to touch page->_count against each page.
  * But we had to alter page->flags anyway.
  */
 static void
-refill_inactive_zone(struct zone *zone, const int nr_pages_in,
-			struct page_state *ps)
+refill_inactive_zone(struct zone *zone, struct scan_control *sc)
 {
 	int pgmoved;
 	int pgdeactivate = 0;
-	int nr_pages = nr_pages_in;
+	int pgscanned = 0;
+	int nr_pages = sc->nr_to_scan;
 	LIST_HEAD(l_hold);	/* The pages which were snipped off */
 	LIST_HEAD(l_inactive);	/* Pages to go onto the inactive_list */
 	LIST_HEAD(l_active);	/* Pages to go onto the active_list */
@@ -594,22 +652,27 @@
 	lru_add_drain();
 	pgmoved = 0;
 	spin_lock_irq(&zone->lru_lock);
-	while (nr_pages && !list_empty(&zone->active_list)) {
+	while (pgscanned < nr_pages && !list_empty(&zone->active_list)) {
 		page = lru_to_page(&zone->active_list);
 		prefetchw_prev_lru_page(page, &zone->active_list, flags);
 		if (!TestClearPageLRU(page))
 			BUG();
 		list_del(&page->lru);
-		if (page_count(page) == 0) {
-			/* It is currently in pagevec_release() */
+		if (get_page_testone(page)) {
+			/*
+			 * It was already free!  release_pages() or put_page()
+			 * are about to remove it from the LRU and free it. So
+			 * put the refcount back and put the page back on the
+			 * LRU
+			 */
+			__put_page(page);
 			SetPageLRU(page);
 			list_add(&page->lru, &zone->active_list);
 		} else {
-			page_cache_get(page);
 			list_add(&page->lru, &l_hold);
 			pgmoved++;
 		}
-		nr_pages--;
+		pgscanned++;
 	}
 	zone->nr_active -= pgmoved;
 	spin_unlock_irq(&zone->lru_lock);
@@ -625,7 +688,7 @@
 	 * mapped memory instead of just pagecache.  Work out how much memory
 	 * is mapped.
 	 */
-	mapped_ratio = (ps->nr_mapped * 100) / total_memory;
+	mapped_ratio = (sc->nr_mapped * 100) / total_memory;
 
 	/*
 	 * Now decide how much we really want to unmap some pages.  The mapped
@@ -653,13 +716,13 @@
 				list_add(&page->lru, &l_active);
 				continue;
 			}
-			rmap_lock(page);
+			page_map_lock(page);
 			if (page_referenced(page)) {
-				rmap_unlock(page);
+				page_map_unlock(page);
 				list_add(&page->lru, &l_active);
 				continue;
 			}
-			rmap_unlock(page);
+			page_map_unlock(page);
 		}
 		/*
 		 * FIXME: need to consider page_count(page) here if/when we
@@ -724,7 +787,7 @@
 	spin_unlock_irq(&zone->lru_lock);
 	pagevec_release(&pvec);
 
-	mod_page_state_zone(zone, pgrefill, nr_pages_in - nr_pages);
+	mod_page_state_zone(zone, pgrefill, pgscanned);
 	mod_page_state(pgdeactivate, pgdeactivate);
 }
 
@@ -732,41 +795,52 @@
  * Scan `nr_pages' from this zone.  Returns the number of reclaimed pages.
  * This is a basic per-zone page freer.  Used by both kswapd and direct reclaim.
  */
-static int
-shrink_zone(struct zone *zone, int max_scan, unsigned int gfp_mask,
-		int *total_scanned, struct page_state *ps, int do_writepage)
+static void
+shrink_zone(struct zone *zone, struct scan_control *sc)
 {
-	unsigned long ratio;
+	unsigned long scan_active, scan_inactive;
 	int count;
 
+	scan_inactive = (zone->nr_active + zone->nr_inactive) >> sc->priority;
+
 	/*
 	 * Try to keep the active list 2/3 of the size of the cache.  And
 	 * make sure that refill_inactive is given a decent number of pages.
 	 *
-	 * The "ratio+1" here is important.  With pagecache-intensive workloads
-	 * the inactive list is huge, and `ratio' evaluates to zero all the
-	 * time.  Which pins the active list memory.  So we add one to `ratio'
-	 * just to make sure that the kernel will slowly sift through the
-	 * active list.
+	 * The "scan_active + 1" here is important.  With pagecache-intensive
+	 * workloads the inactive list is huge, and `ratio' evaluates to zero
+	 * all the time.  Which pins the active list memory.  So we add one to
+	 * `scan_active' just to make sure that the kernel will slowly sift
+	 * through the active list.
 	 */
-	ratio = (unsigned long)SWAP_CLUSTER_MAX * zone->nr_active /
-				((zone->nr_inactive | 1) * 2);
+	if (zone->nr_active >= 4*(zone->nr_inactive*2 + 1)) {
+		/* Don't scan more than 4 times the inactive list scan size */
+		scan_active = 4*scan_inactive;
+	} else {
+		unsigned long long tmp;
+
+		/* Cast to long long so the multiply doesn't overflow */
+
+		tmp = (unsigned long long)scan_inactive * zone->nr_active;
+		do_div(tmp, zone->nr_inactive*2 + 1);
+		scan_active = (unsigned long)tmp;
+	}
 
-	atomic_add(ratio+1, &zone->nr_scan_active);
+	atomic_add(scan_active + 1, &zone->nr_scan_active);
 	count = atomic_read(&zone->nr_scan_active);
 	if (count >= SWAP_CLUSTER_MAX) {
 		atomic_set(&zone->nr_scan_active, 0);
-		refill_inactive_zone(zone, count, ps);
+		sc->nr_to_scan = count;
+		refill_inactive_zone(zone, sc);
 	}
 
-	atomic_add(max_scan, &zone->nr_scan_inactive);
+	atomic_add(scan_inactive, &zone->nr_scan_inactive);
 	count = atomic_read(&zone->nr_scan_inactive);
 	if (count >= SWAP_CLUSTER_MAX) {
 		atomic_set(&zone->nr_scan_inactive, 0);
-		return shrink_cache(zone, gfp_mask, count,
-					total_scanned, do_writepage);
+		sc->nr_to_scan = count;
+		shrink_cache(zone, sc);
 	}
-	return 0;
 }
 
 /*
@@ -785,28 +859,23 @@
  * If a zone is deemed to be full of pinned pages then just give it a light
  * scan then give up on it.
  */
-static int
-shrink_caches(struct zone **zones, int priority, int *total_scanned,
-		int gfp_mask, struct page_state *ps, int do_writepage)
+static void
+shrink_caches(struct zone **zones, struct scan_control *sc)
 {
-	int ret = 0;
 	int i;
 
 	for (i = 0; zones[i] != NULL; i++) {
 		struct zone *zone = zones[i];
-		int max_scan;
 
-		if (zone->free_pages < zone->pages_high)
-			zone->temp_priority = priority;
+		zone->temp_priority = sc->priority;
+		if (zone->prev_priority > sc->priority)
+			zone->prev_priority = sc->priority;
 
-		if (zone->all_unreclaimable && priority != DEF_PRIORITY)
+		if (zone->all_unreclaimable && sc->priority != DEF_PRIORITY)
 			continue;	/* Let kswapd poll it */
 
-		max_scan = zone->nr_inactive >> priority;
-		ret += shrink_zone(zone, max_scan, gfp_mask,
-					total_scanned, ps, do_writepage);
+		shrink_zone(zone, sc);
 	}
-	return ret;
 }
  
 /*
@@ -817,25 +886,23 @@
  *
  * If the caller is !__GFP_FS then the probability of a failure is reasonably
  * high - the zone may be full of dirty or under-writeback pages, which this
- * caller can't do much about.  So for !__GFP_FS callers, we just perform a
- * small LRU walk and if that didn't work out, fail the allocation back to the
- * caller.  GFP_NOFS allocators need to know how to deal with it.  Kicking
- * bdflush, waiting and retrying will work.
- *
- * This is a fairly lame algorithm - it can result in excessive CPU burning and
- * excessive rotation of the inactive list, which is _supposed_ to be an LRU,
- * yes?
+ * caller can't do much about.  We kick pdflush and take explicit naps in the
+ * hope that some of these pages can be written.  But if the allocating task
+ * holds filesystem locks which prevent writeout this might not work, and the
+ * allocation attempt will fail.
  */
 int try_to_free_pages(struct zone **zones,
 		unsigned int gfp_mask, unsigned int order)
 {
 	int priority;
 	int ret = 0;
-	int nr_reclaimed = 0;
+	int total_scanned = 0, total_reclaimed = 0;
 	struct reclaim_state *reclaim_state = current->reclaim_state;
+	struct scan_control sc;
 	int i;
-	unsigned long total_scanned = 0;
-	int do_writepage = 0;
+
+	sc.gfp_mask = gfp_mask;
+	sc.may_writepage = 0;
 
 	inc_page_state(allocstall);
 
@@ -843,23 +910,23 @@
 		zones[i]->temp_priority = DEF_PRIORITY;
 
 	for (priority = DEF_PRIORITY; priority >= 0; priority--) {
-		int scanned = 0;
-		struct page_state ps;
-
-		get_page_state(&ps);
-		nr_reclaimed += shrink_caches(zones, priority, &scanned,
-						gfp_mask, &ps, do_writepage);
-		shrink_slab(scanned, gfp_mask);
+		sc.nr_mapped = read_page_state(nr_mapped);
+		sc.nr_scanned = 0;
+		sc.nr_reclaimed = 0;
+		sc.priority = priority;
+		shrink_caches(zones, &sc);
+		shrink_slab(sc.nr_scanned, gfp_mask);
 		if (reclaim_state) {
-			nr_reclaimed += reclaim_state->reclaimed_slab;
+			sc.nr_reclaimed += reclaim_state->reclaimed_slab;
 			reclaim_state->reclaimed_slab = 0;
 		}
-		if (nr_reclaimed >= SWAP_CLUSTER_MAX) {
+		if (sc.nr_reclaimed >= SWAP_CLUSTER_MAX) {
 			ret = 1;
 			goto out;
 		}
-		if (!(gfp_mask & __GFP_FS))
-			break;		/* Let the caller handle it */
+		total_scanned += sc.nr_scanned;
+		total_reclaimed += sc.nr_reclaimed;
+
 		/*
 		 * Try to write back as many pages as we just scanned.  This
 		 * tends to cause slow streaming writers to write data to the
@@ -867,14 +934,13 @@
 		 * that's undesirable in laptop mode, where we *want* lumpy
 		 * writeout.  So in laptop mode, write out the whole world.
 		 */
-		total_scanned += scanned;
 		if (total_scanned > SWAP_CLUSTER_MAX + SWAP_CLUSTER_MAX/2) {
 			wakeup_bdflush(laptop_mode ? 0 : total_scanned);
-			do_writepage = 1;
+			sc.may_writepage = 1;
 		}
 
 		/* Take a nap, wait for some writeback to complete */
-		if (scanned && priority < DEF_PRIORITY - 2)
+		if (sc.nr_scanned && priority < DEF_PRIORITY - 2)
 			blk_congestion_wait(WRITE, HZ/10);
 	}
 	if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY))
@@ -910,15 +976,18 @@
  * the page allocator fallback scheme to ensure that aging of pages is balanced
  * across the zones.
  */
-static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
+static int balance_pgdat(pg_data_t *pgdat, int nr_pages)
 {
 	int to_free = nr_pages;
 	int priority;
 	int i;
+	int total_scanned = 0, total_reclaimed = 0;
 	struct reclaim_state *reclaim_state = current->reclaim_state;
-	unsigned long total_scanned = 0;
-	unsigned long total_reclaimed = 0;
-	int do_writepage = 0;
+	struct scan_control sc;
+
+	sc.gfp_mask = GFP_KERNEL;
+	sc.may_writepage = 0;
+	sc.nr_mapped = read_page_state(nr_mapped);
 
 	inc_page_state(pageoutrun);
 
@@ -928,7 +997,7 @@
 		zone->temp_priority = DEF_PRIORITY;
 	}
 
-	for (priority = DEF_PRIORITY; priority; priority--) {
+	for (priority = DEF_PRIORITY; priority >= 0; priority--) {
 		int all_zones_ok = 1;
 		int end_zone = 0;	/* Inclusive.  0 = ZONE_DMA */
 
@@ -966,9 +1035,6 @@
 		 */
 		for (i = 0; i <= end_zone; i++) {
 			struct zone *zone = pgdat->node_zones + i;
-			int max_scan;
-			int reclaimed;
-			int scanned = 0;
 
 			if (zone->all_unreclaimable && priority != DEF_PRIORITY)
 				continue;
@@ -978,15 +1044,16 @@
 					all_zones_ok = 0;
 			}
 			zone->temp_priority = priority;
-			max_scan = zone->nr_inactive >> priority;
-			reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL,
-					&scanned, ps, do_writepage);
-			total_scanned += scanned;
+			if (zone->prev_priority > priority)
+				zone->prev_priority = priority;
+			sc.nr_scanned = 0;
+			sc.nr_reclaimed = 0;
+			sc.priority = priority;
+			shrink_zone(zone, &sc);
 			reclaim_state->reclaimed_slab = 0;
-			shrink_slab(scanned, GFP_KERNEL);
-			reclaimed += reclaim_state->reclaimed_slab;
-			total_reclaimed += reclaimed;
-			to_free -= reclaimed;
+			shrink_slab(sc.nr_scanned, GFP_KERNEL);
+			sc.nr_reclaimed += reclaim_state->reclaimed_slab;
+			total_reclaimed += sc.nr_reclaimed;
 			if (zone->all_unreclaimable)
 				continue;
 			if (zone->pages_scanned > zone->present_pages * 2)
@@ -998,9 +1065,9 @@
 			 */
 			if (total_scanned > SWAP_CLUSTER_MAX * 2 &&
 			    total_scanned > total_reclaimed+total_reclaimed/2)
-				do_writepage = 1;
+				sc.may_writepage = 1;
 		}
-		if (nr_pages && to_free > 0)
+		if (nr_pages && to_free > total_reclaimed)
 			continue;	/* swsusp: need to do more work */
 		if (all_zones_ok)
 			break;		/* kswapd: all done */
@@ -1064,15 +1131,13 @@
 	tsk->flags |= PF_MEMALLOC|PF_KSWAPD;
 
 	for ( ; ; ) {
-		struct page_state ps;
-
 		if (current->flags & PF_FREEZE)
 			refrigerator(PF_FREEZE);
 		prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE);
 		schedule();
 		finish_wait(&pgdat->kswapd_wait, &wait);
-		get_page_state(&ps);
-		balance_pgdat(pgdat, 0, &ps);
+
+		balance_pgdat(pgdat, 0);
 	}
 }
 
@@ -1105,10 +1170,7 @@
 	current->reclaim_state = &reclaim_state;
 	for_each_pgdat(pgdat) {
 		int freed;
-		struct page_state ps;
-
-		get_page_state(&ps);
-		freed = balance_pgdat(pgdat, nr_to_free, &ps);
+		freed = balance_pgdat(pgdat, nr_to_free);
 		ret += freed;
 		nr_to_free -= freed;
 		if (nr_to_free <= 0)
diff -Nru a/net/8021q/vlan.c b/net/8021q/vlan.c
--- a/net/8021q/vlan.c	Tue Jun 15 22:20:43 2004
+++ b/net/8021q/vlan.c	Tue Jun 15 22:20:43 2004
@@ -49,7 +49,7 @@
 static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
 
 static int vlan_device_event(struct notifier_block *, unsigned long, void *);
-static int vlan_ioctl_handler(unsigned long);
+static int vlan_ioctl_handler(void __user *);
 static int unregister_vlan_dev(struct net_device *, unsigned short );
 
 struct notifier_block vlan_notifier_block = {
@@ -661,9 +661,9 @@
 /*
  *	VLAN IOCTL handler.
  *	o execute requested action or pass command to the device driver
- *   arg is really a void* to a vlan_ioctl_args structure.
+ *   arg is really a struct vlan_ioctl_args __user *.
  */
-static int vlan_ioctl_handler(unsigned long arg)
+static int vlan_ioctl_handler(void __user *arg)
 {
 	int err = 0;
 	struct vlan_ioctl_args args;
@@ -675,8 +675,7 @@
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
 
-	if (copy_from_user(&args, (void*)arg,
-                           sizeof(struct vlan_ioctl_args)))
+	if (copy_from_user(&args, arg, sizeof(struct vlan_ioctl_args)))
 		return -EFAULT;
 
 	/* Null terminate this sucker, just in case. */
diff -Nru a/net/8021q/vlan.h b/net/8021q/vlan.h
--- a/net/8021q/vlan.h	Tue Jun 15 22:20:42 2004
+++ b/net/8021q/vlan.h	Tue Jun 15 22:20:42 2004
@@ -7,7 +7,7 @@
 /* #define VLAN_DEBUG */
 
 #define VLAN_ERR KERN_ERR
-#define VLAN_INF KERN_ALERT
+#define VLAN_INF KERN_INFO
 #define VLAN_DBG KERN_ALERT /* change these... to debug, having a hard time
                              * changing the log level at run-time..for some reason.
                              */
diff -Nru a/net/appletalk/ddp.c b/net/appletalk/ddp.c
--- a/net/appletalk/ddp.c	Tue Jun 15 22:21:05 2004
+++ b/net/appletalk/ddp.c	Tue Jun 15 22:21:05 2004
@@ -673,7 +673,7 @@
 
 /* ioctl calls. Shouldn't even need touching */
 /* Device configuration ioctl calls */
-static int atif_ioctl(int cmd, void *arg)
+static int atif_ioctl(int cmd, void __user *arg)
 {
 	static char aarp_mcast[6] = { 0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF };
 	struct ifreq atreq;
@@ -892,7 +892,7 @@
 }
 
 /* Routing ioctl() calls */
-static int atrtr_ioctl(unsigned int cmd, void *arg)
+static int atrtr_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct rtentry rt;
 
@@ -1567,7 +1567,7 @@
 	struct atalk_route *rt;
 	int err;
 
-	if (flags & ~MSG_DONTWAIT)
+	if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
 		return -EINVAL;
 
 	if (len > DDP_MAXSZ)
@@ -1769,6 +1769,7 @@
 {
 	int rc = -EINVAL;
 	struct sock *sk = sock->sk;
+	void __user *argp = (void __user *)arg;
 
 	switch (cmd) {
 		/* Protocol layer */
@@ -1778,7 +1779,7 @@
 
 			if (amount < 0)
 				amount = 0;
-			rc = put_user(amount, (int *)arg);
+			rc = put_user(amount, (int __user *)argp);
 			break;
 		}
 		case TIOCINQ: {
@@ -1791,18 +1792,18 @@
 
 			if (skb)
 				amount = skb->len - sizeof(struct ddpehdr);
-			rc = put_user(amount, (int *)arg);
+			rc = put_user(amount, (int __user *)argp);
 			break;
 		}
 		case SIOCGSTAMP:
-			rc = sock_get_timestamp(sk, (struct timeval *)arg);
+			rc = sock_get_timestamp(sk, argp);
 			break;
 		/* Routing */
 		case SIOCADDRT:
 		case SIOCDELRT:
 			rc = -EPERM;
 			if (capable(CAP_NET_ADMIN))
-				rc = atrtr_ioctl(cmd, (void *)arg);
+				rc = atrtr_ioctl(cmd, argp);
 			break;
 		/* Interface */
 		case SIOCGIFADDR:
@@ -1813,7 +1814,7 @@
 		case SIOCSARP:		/* proxy AARP */
 		case SIOCDARP:		/* proxy AARP */
 			rtnl_lock();
-			rc = atif_ioctl(cmd, (void *)arg);
+			rc = atif_ioctl(cmd, argp);
 			rtnl_unlock();
 			break;
 		/* Physical layer ioctl calls */
@@ -1829,7 +1830,7 @@
 		case SIOCGIFCOUNT:
 		case SIOCGIFINDEX:
 		case SIOCGIFNAME:
-			rc = dev_ioctl(cmd, (void *)arg);
+			rc = dev_ioctl(cmd, argp);
 			break;
 	}
 
diff -Nru a/net/atm/addr.c b/net/atm/addr.c
--- a/net/atm/addr.c	Tue Jun 15 22:20:36 2004
+++ b/net/atm/addr.c	Tue Jun 15 22:20:36 2004
@@ -114,7 +114,7 @@
 }
 
 
-int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size)
+int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,int size)
 {
 	unsigned long flags;
 	struct atm_dev_addr *walk;
@@ -134,7 +134,7 @@
 		memcpy(tmp_bufp++, &walk->addr, sizeof(struct sockaddr_atmsvc));
 	spin_unlock_irqrestore(&dev->lock, flags);
 	error = total > size ? -E2BIG : total;
-	if (copy_to_user(u_buf, tmp_buf, total < size ? total : size))
+	if (copy_to_user(buf, tmp_buf, total < size ? total : size))
 		error = -EFAULT;
 	kfree(tmp_buf);
 	return error;
diff -Nru a/net/atm/addr.h b/net/atm/addr.h
--- a/net/atm/addr.h	Tue Jun 15 22:20:39 2004
+++ b/net/atm/addr.h	Tue Jun 15 22:20:39 2004
@@ -13,6 +13,6 @@
 void atm_reset_addr(struct atm_dev *dev);
 int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr);
 int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr);
-int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size);
+int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,int size);
 
 #endif
diff -Nru a/net/atm/br2684.c b/net/atm/br2684.c
--- a/net/atm/br2684.c	Tue Jun 15 22:21:05 2004
+++ b/net/atm/br2684.c	Tue Jun 15 22:21:05 2004
@@ -342,12 +342,12 @@
 
 #ifdef CONFIG_ATM_BR2684_IPFILTER
 /* this IOCTL is experimental. */
-static int br2684_setfilt(struct atm_vcc *atmvcc, unsigned long arg)
+static int br2684_setfilt(struct atm_vcc *atmvcc, void __user *arg)
 {
 	struct br2684_vcc *brvcc;
 	struct br2684_filter_set fs;
 
-	if (copy_from_user(&fs, (void *) arg, sizeof fs))
+	if (copy_from_user(&fs, arg, sizeof fs))
 		return -EFAULT;
 	if (fs.ifspec.method != BR2684_FIND_BYNOTHING) {
 		/*
@@ -494,7 +494,7 @@
 	netif_rx(skb);
 }
 
-static int br2684_regvcc(struct atm_vcc *atmvcc, unsigned long arg)
+static int br2684_regvcc(struct atm_vcc *atmvcc, void __user *arg)
 {
 /* assign a vcc to a dev
 Note: we do not have explicit unassign, but look at _push()
@@ -507,7 +507,7 @@
 	struct net_device *net_dev;
 	struct atm_backend_br2684 be;
 
-	if (copy_from_user(&be, (void *) arg, sizeof be))
+	if (copy_from_user(&be, arg, sizeof be))
 		return -EFAULT;
 	brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
 	if (!brvcc)
@@ -593,7 +593,7 @@
 	INIT_LIST_HEAD(&brdev->brvccs);
 }
 
-static int br2684_create(unsigned long arg)
+static int br2684_create(void __user *arg)
 {
 	int err;
 	struct net_device *netdev;
@@ -602,7 +602,7 @@
 
 	DPRINTK("br2684_create\n");
 
-	if (copy_from_user(&ni, (void *) arg, sizeof ni)) {
+	if (copy_from_user(&ni, arg, sizeof ni)) {
 		return -EFAULT;
 	}
 	if (ni.media != BR2684_MEDIA_ETHERNET || ni.mtu != 1500) {
@@ -642,13 +642,14 @@
 	unsigned long arg)
 {
 	struct atm_vcc *atmvcc = ATM_SD(sock);
+	void __user *argp = (void __user *)arg;
 
 	int err;
 	switch(cmd) {
 	case ATM_SETBACKEND:
 	case ATM_NEWBACKENDIF: {
 		atm_backend_t b;
-		err = get_user(b, (atm_backend_t *) arg);
+		err = get_user(b, (atm_backend_t __user *) argp);
 		if (err)
 			return -EFAULT;
 		if (b != ATM_BACKEND_BR2684)
@@ -656,9 +657,9 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
 		if (cmd == ATM_SETBACKEND)
-			return br2684_regvcc(atmvcc, arg);
+			return br2684_regvcc(atmvcc, argp);
 		else
-			return br2684_create(arg);
+			return br2684_create(argp);
 		}
 #ifdef CONFIG_ATM_BR2684_IPFILTER
 	case BR2684_SETFILT:
@@ -666,7 +667,7 @@
 			return -ENOIOCTLCMD;
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
-		err = br2684_setfilt(atmvcc, arg);
+		err = br2684_setfilt(atmvcc, argp);
 		return err;
 #endif /* CONFIG_ATM_BR2684_IPFILTER */
 	}
diff -Nru a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c	Tue Jun 15 22:21:05 2004
+++ b/net/atm/common.c	Tue Jun 15 22:21:05 2004
@@ -509,7 +509,7 @@
 	struct atm_vcc *vcc;
 	struct sk_buff *skb;
 	int eff,error;
-	const void *buff;
+	const void __user *buff;
 	int size;
 
 	lock_sock(sk);
@@ -676,7 +676,7 @@
 }
 
 int vcc_setsockopt(struct socket *sock, int level, int optname,
-		   char *optval, int optlen)
+		   char __user *optval, int optlen)
 {
 	struct atm_vcc *vcc;
 	unsigned long value;
@@ -704,7 +704,7 @@
 				return 0;
 			}
 		case SO_SETCLP:
-			if (get_user(value,(unsigned long *) optval))
+			if (get_user(value,(unsigned long __user *)optval))
 				return -EFAULT;
 			if (value) vcc->atm_options |= ATM_ATMOPT_CLP;
 			else vcc->atm_options &= ~ATM_ATMOPT_CLP;
@@ -719,7 +719,7 @@
 
 
 int vcc_getsockopt(struct socket *sock, int level, int optname,
-		   char *optval, int *optlen)
+		   char __user *optval, int __user *optlen)
 {
 	struct atm_vcc *vcc;
 	int len;
@@ -738,7 +738,7 @@
 			    -EFAULT : 0;
 		case SO_SETCLP:
 			return put_user(vcc->atm_options & ATM_ATMOPT_CLP ? 1 :
-			  0,(unsigned long *) optval) ? -EFAULT : 0;
+			  0,(unsigned long __user *)optval) ? -EFAULT : 0;
 		case SO_ATMPVC:
 			{
 				struct sockaddr_atmpvc pvc;
diff -Nru a/net/atm/common.h b/net/atm/common.h
--- a/net/atm/common.h	Tue Jun 15 22:20:43 2004
+++ b/net/atm/common.h	Tue Jun 15 22:20:43 2004
@@ -19,10 +19,10 @@
 		size_t total_len);
 unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait);
 int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
-int vcc_setsockopt(struct socket *sock, int level, int optname, char *optval,
-		   int optlen);
-int vcc_getsockopt(struct socket *sock, int level, int optname, char *optval,
-		   int *optlen);
+int vcc_setsockopt(struct socket *sock, int level, int optname,
+		   char __user *optval, int optlen);
+int vcc_getsockopt(struct socket *sock, int level, int optname,
+		   char __user *optval, int __user *optlen);
 
 void atm_shutdown_dev(struct atm_dev *dev);
 
diff -Nru a/net/atm/ioctl.c b/net/atm/ioctl.c
--- a/net/atm/ioctl.c	Tue Jun 15 22:20:43 2004
+++ b/net/atm/ioctl.c	Tue Jun 15 22:20:43 2004
@@ -49,6 +49,7 @@
 	struct atm_vcc *vcc;
 	int error;
 	struct list_head * pos;
+	void __user *argp = (void __user *)arg;
 
 	vcc = ATM_SD(sock);
 	switch (cmd) {
@@ -60,7 +61,7 @@
 			}
 			error = put_user(vcc->sk->sk_sndbuf -
 					 atomic_read(&vcc->sk->sk_wmem_alloc),
-					 (int *) arg) ? -EFAULT : 0;
+					 (int __user *) argp) ? -EFAULT : 0;
 			goto done;
 		case SIOCINQ:
 			{
@@ -72,12 +73,11 @@
 				}
 				skb = skb_peek(&vcc->sk->sk_receive_queue);
 				error = put_user(skb ? skb->len : 0,
-					 	 (int *) arg) ? -EFAULT : 0;
+					 	 (int __user *)argp) ? -EFAULT : 0;
 				goto done;
 			}
 		case SIOCGSTAMP: /* borrowed from IP */
-			error = sock_get_timestamp(vcc->sk, (struct timeval *)
-						   arg);
+			error = sock_get_timestamp(vcc->sk, argp);
 			goto done;
 		case ATM_SETSC:
 			printk(KERN_WARNING "ATM_SETSC is obsolete\n");
@@ -131,7 +131,7 @@
 	if (error != -ENOIOCTLCMD)
 		goto done;
 
-	error = atm_dev_ioctl(cmd, arg);
+	error = atm_dev_ioctl(cmd, argp);
 
 done:
 	return error;
diff -Nru a/net/atm/lec.c b/net/atm/lec.c
--- a/net/atm/lec.c	Tue Jun 15 22:20:41 2004
+++ b/net/atm/lec.c	Tue Jun 15 22:20:41 2004
@@ -774,7 +774,7 @@
 }
 
 int 
-lec_vcc_attach(struct atm_vcc *vcc, void *arg)
+lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
 {
 	struct lec_vcc_priv *vpriv;
         int bytes_left;
@@ -1161,7 +1161,7 @@
 			err = lec_mcast_attach(vcc, (int) arg);
 			break;
 		case ATMLEC_DATA:
-			err = lec_vcc_attach(vcc, (void *) arg);
+			err = lec_vcc_attach(vcc, (void __user *) arg);
 			break;
 	}
 
diff -Nru a/net/atm/lec.h b/net/atm/lec.h
--- a/net/atm/lec.h	Tue Jun 15 22:20:38 2004
+++ b/net/atm/lec.h	Tue Jun 15 22:20:38 2004
@@ -148,7 +148,7 @@
 #define LEC_VCC_PRIV(vcc)	((struct lec_vcc_priv *)((vcc)->user_back))
 
 int lecd_attach(struct atm_vcc *vcc, int arg);
-int lec_vcc_attach(struct atm_vcc *vcc, void *arg);
+int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg);
 int lec_mcast_attach(struct atm_vcc *vcc, int arg);
 struct net_device *get_dev_lec(int itf);
 int make_lec(struct atm_vcc *vcc);
diff -Nru a/net/atm/mpc.c b/net/atm/mpc.c
--- a/net/atm/mpc.c	Tue Jun 15 22:20:44 2004
+++ b/net/atm/mpc.c	Tue Jun 15 22:20:44 2004
@@ -565,7 +565,7 @@
 	return retval;
 }
 
-int atm_mpoa_vcc_attach(struct atm_vcc *vcc, long arg)
+int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
 {
 	int bytes_left;
 	struct mpoa_client *mpc;
@@ -574,7 +574,7 @@
 	uint32_t  ipaddr;
 	unsigned char *ip;
 
-	bytes_left = copy_from_user(&ioc_data, (void *)arg, sizeof(struct atmmpc_ioc));
+	bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc));
 	if (bytes_left != 0) {
 		printk("mpoa: mpc_vcc_attach: Short read (missed %d bytes) from userland\n", bytes_left);
 		return -EFAULT;
@@ -1366,7 +1366,7 @@
 	return;
 }
 
-static void mpc_timer_refresh()
+static void mpc_timer_refresh(void)
 {
 	mpc_timer.expires = jiffies + (MPC_P2 * HZ);
 	mpc_timer.data = mpc_timer.expires;
@@ -1418,7 +1418,7 @@
 				sock->state = SS_CONNECTED;
 			break;
 		case ATMMPC_DATA:
-			err = atm_mpoa_vcc_attach(vcc, arg);
+			err = atm_mpoa_vcc_attach(vcc, (void __user *)arg);
 			break;
 		default:
 			break;
diff -Nru a/net/atm/mpc.h b/net/atm/mpc.h
--- a/net/atm/mpc.h	Tue Jun 15 22:20:37 2004
+++ b/net/atm/mpc.h	Tue Jun 15 22:20:37 2004
@@ -13,7 +13,7 @@
 
 /* Functions for ioctl(ATMMPC_*) operations */
 int atm_mpoa_mpoad_attach(struct atm_vcc *vcc, int arg);
-int atm_mpoa_vcc_attach(struct atm_vcc *vcc, long arg);
+int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg);
 
 struct mpoa_client {
         struct mpoa_client *next;
diff -Nru a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c
--- a/net/atm/mpoa_proc.c	Tue Jun 15 22:20:43 2004
+++ b/net/atm/mpoa_proc.c	Tue Jun 15 22:20:43 2004
@@ -30,10 +30,10 @@
 extern struct mpoa_client *mpcs;
 extern struct proc_dir_entry *atm_proc_root;  /* from proc.c. */
 
-static ssize_t proc_mpc_read(struct file *file, char *buff,
+static ssize_t proc_mpc_read(struct file *file, char __user *buff,
 			     size_t count, loff_t *pos);
 
-static ssize_t proc_mpc_write(struct file *file, const char *buff,
+static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
                               size_t nbytes, loff_t *ppos);
 
 static int parse_qos(const char *buff, int len);
@@ -99,7 +99,7 @@
 /*
  * READING function - called when the /proc/atm/mpoa file is read from.
  */
-static ssize_t proc_mpc_read(struct file *file, char *buff,
+static ssize_t proc_mpc_read(struct file *file, char __user *buff,
 			     size_t count, loff_t *pos){
         unsigned long page = 0;
 	unsigned char *temp;
@@ -165,12 +165,12 @@
         return length;
 }
 
-static ssize_t proc_mpc_write(struct file *file, const char *buff,
+static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
                               size_t nbytes, loff_t *ppos)
 {
         int incoming, error, retval;
         char *page, c;
-        const char *tmp;
+        const char __user *tmp;
 
         if (nbytes == 0) return 0;
         if (nbytes >= PAGE_SIZE) nbytes = PAGE_SIZE-1;
diff -Nru a/net/atm/pppoatm.c b/net/atm/pppoatm.c
--- a/net/atm/pppoatm.c	Tue Jun 15 22:20:42 2004
+++ b/net/atm/pppoatm.c	Tue Jun 15 22:20:42 2004
@@ -257,10 +257,10 @@
 {
 	switch (cmd) {
 	case PPPIOCGFLAGS:
-		return put_user(chan_to_pvcc(chan)->flags, (int *) arg)
+		return put_user(chan_to_pvcc(chan)->flags, (int __user *) arg)
 		    ? -EFAULT : 0;
 	case PPPIOCSFLAGS:
-		return get_user(chan_to_pvcc(chan)->flags, (int *) arg)
+		return get_user(chan_to_pvcc(chan)->flags, (int __user *) arg)
 		    ? -EFAULT : 0;
 	}
 	return -ENOTTY;
@@ -271,7 +271,7 @@
 	.ioctl = pppoatm_devppp_ioctl,
 };
 
-static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, unsigned long arg)
+static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg)
 {
 	struct atm_backend_ppp be;
 	struct pppoatm_vcc *pvcc;
@@ -281,7 +281,7 @@
 	 * prototypical one used to initialize them
 	 */
 	static const DECLARE_TASKLET(tasklet_proto, pppoatm_wakeup_sender, 0);
-	if (copy_from_user(&be, (void *) arg, sizeof be))
+	if (copy_from_user(&be, arg, sizeof be))
 		return -EFAULT;
 	if (be.encaps != PPPOATM_ENCAPS_AUTODETECT &&
 	    be.encaps != PPPOATM_ENCAPS_VC && be.encaps != PPPOATM_ENCAPS_LLC)
@@ -319,26 +319,27 @@
 	unsigned long arg)
 {
 	struct atm_vcc *atmvcc = ATM_SD(sock);
+	void __user *argp = (void __user *)arg;
 
 	if (cmd != ATM_SETBACKEND && atmvcc->push != pppoatm_push)
 		return -ENOIOCTLCMD;
 	switch (cmd) {
 	case ATM_SETBACKEND: {
 		atm_backend_t b;
-		if (get_user(b, (atm_backend_t *) arg))
+		if (get_user(b, (atm_backend_t __user *) argp))
 			return -EFAULT;
 		if (b != ATM_BACKEND_PPP)
 			return -ENOIOCTLCMD;
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
-		return pppoatm_assign_vcc(atmvcc, arg);
+		return pppoatm_assign_vcc(atmvcc, argp);
 		}
 	case PPPIOCGCHAN:
 		return put_user(ppp_channel_index(&atmvcc_to_pvcc(atmvcc)->
-		    chan), (int *) arg) ? -EFAULT : 0;
+		    chan), (int __user *) argp) ? -EFAULT : 0;
 	case PPPIOCGUNIT:
 		return put_user(ppp_unit_number(&atmvcc_to_pvcc(atmvcc)->
-		    chan), (int *) arg) ? -EFAULT : 0;
+		    chan), (int __user *) argp) ? -EFAULT : 0;
 	}
 	return -ENOIOCTLCMD;
 }
diff -Nru a/net/atm/proc.c b/net/atm/proc.c
--- a/net/atm/proc.c	Tue Jun 15 22:20:38 2004
+++ b/net/atm/proc.c	Tue Jun 15 22:20:38 2004
@@ -31,7 +31,7 @@
 #include "common.h" /* atm_proc_init prototype */
 #include "signaling.h" /* to get sigd - ugly too */
 
-static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count,
+static ssize_t proc_dev_atm_read(struct file *file,char __user *buf,size_t count,
     loff_t *pos);
 
 static struct file_operations proc_atm_dev_ops = {
@@ -384,8 +384,8 @@
 	.release	= vcc_seq_release,
 };
 
-static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count,
-    loff_t *pos)
+static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,
+				 size_t count, loff_t *pos)
 {
 	struct atm_dev *dev;
 	unsigned long page;
diff -Nru a/net/atm/pvc.c b/net/atm/pvc.c
--- a/net/atm/pvc.c	Tue Jun 15 22:20:38 2004
+++ b/net/atm/pvc.c	Tue Jun 15 22:20:38 2004
@@ -60,7 +60,7 @@
 }
 
 static int pvc_setsockopt(struct socket *sock, int level, int optname,
-			  char *optval, int optlen)
+			  char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	int error;
@@ -73,7 +73,7 @@
 
 
 static int pvc_getsockopt(struct socket *sock, int level, int optname,
-		          char *optval, int *optlen)
+		          char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	int error;
diff -Nru a/net/atm/resources.c b/net/atm/resources.c
--- a/net/atm/resources.c	Tue Jun 15 22:21:03 2004
+++ b/net/atm/resources.c	Tue Jun 15 22:21:03 2004
@@ -180,7 +180,7 @@
 }
 
 
-static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats *arg, int zero)
+static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg, int zero)
 {
 	struct atm_dev_stats tmp;
 	int error = 0;
@@ -199,19 +199,20 @@
 }
 
 
-int atm_dev_ioctl(unsigned int cmd, unsigned long arg)
+int atm_dev_ioctl(unsigned int cmd, void __user *arg)
 {
-	void *buf;
+	void __user *buf;
 	int error, len, number, size = 0;
 	struct atm_dev *dev;
 	struct list_head *p;
 	int *tmp_buf, *tmp_p;
-
+	struct atm_iobuf __user *iobuf = arg;
+	struct atmif_sioc __user *sioc = arg;
 	switch (cmd) {
 		case ATM_GETNAMES:
-			if (get_user(buf, &((struct atm_iobuf *) arg)->buffer))
+			if (get_user(buf, &iobuf->buffer))
 				return -EFAULT;
-			if (get_user(len, &((struct atm_iobuf *) arg)->length))
+			if (get_user(len, &iobuf->length))
 				return -EFAULT;
 			spin_lock(&atm_dev_lock);
 			list_for_each(p, &atm_devs)
@@ -232,7 +233,7 @@
 			}
 			spin_unlock(&atm_dev_lock);
 		        error = ((copy_to_user(buf, tmp_buf, size)) ||
-					put_user(size, &((struct atm_iobuf *) arg)->length))
+					put_user(size, &iobuf->length))
 						? -EFAULT : 0;
 			kfree(tmp_buf);
 			return error;
@@ -240,11 +241,11 @@
 			break;
 	}
 
-	if (get_user(buf, &((struct atmif_sioc *) arg)->arg))
+	if (get_user(buf, &sioc->arg))
 		return -EFAULT;
-	if (get_user(len, &((struct atmif_sioc *) arg)->length))
+	if (get_user(len, &sioc->length))
 		return -EFAULT;
-	if (get_user(number, &((struct atmif_sioc *) arg)->number))
+	if (get_user(number, &sioc->number))
 		return -EFAULT;
 
 	if (!(dev = atm_dev_lookup(number)))
@@ -351,7 +352,7 @@
 			size = error;
 			/* may return 0, but later on size == 0 means "don't
 			   write the length" */
-			error = put_user(size, &((struct atmif_sioc *) arg)->length)
+			error = put_user(size, &sioc->length)
 				? -EFAULT : 0;
 			goto done;
 		case ATM_SETLOOP:
@@ -385,7 +386,7 @@
 	}
 	
 	if (size)
-		error = put_user(size, &((struct atmif_sioc *) arg)->length)
+		error = put_user(size, &sioc->length)
 			? -EFAULT : 0;
 	else
 		error = 0;
diff -Nru a/net/atm/resources.h b/net/atm/resources.h
--- a/net/atm/resources.h	Tue Jun 15 22:20:43 2004
+++ b/net/atm/resources.h	Tue Jun 15 22:20:43 2004
@@ -14,7 +14,7 @@
 extern spinlock_t atm_dev_lock;
 
 
-int atm_dev_ioctl(unsigned int cmd, unsigned long arg);
+int atm_dev_ioctl(unsigned int cmd, void __user *arg);
 
 
 #ifdef CONFIG_PROC_FS
diff -Nru a/net/atm/svc.c b/net/atm/svc.c
--- a/net/atm/svc.c	Tue Jun 15 22:20:42 2004
+++ b/net/atm/svc.c	Tue Jun 15 22:20:42 2004
@@ -459,7 +459,7 @@
 
 
 static int svc_setsockopt(struct socket *sock,int level,int optname,
-    char *optval,int optlen)
+    char __user *optval,int optlen)
 {
 	struct sock *sk = sock->sk;
 	struct atm_vcc *vcc;
@@ -483,7 +483,7 @@
 
 
 static int svc_getsockopt(struct socket *sock,int level,int optname,
-    char *optval,int *optlen)
+    char __user *optval,int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	int error = 0, len;
diff -Nru a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
--- a/net/ax25/af_ax25.c	Tue Jun 15 22:21:02 2004
+++ b/net/ax25/af_ax25.c	Tue Jun 15 22:21:02 2004
@@ -336,7 +336,7 @@
  *		  includes a KILL command to abort any connection.
  *		  VERY useful for debugging ;-)
  */
-static int ax25_ctl_ioctl(const unsigned int cmd, void *arg)
+static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
 {
 	struct ax25_ctl_struct ax25_ctl;
 	ax25_digi digi;
@@ -508,7 +508,7 @@
  */
 
 static int ax25_setsockopt(struct socket *sock, int level, int optname,
-	char *optval, int optlen)
+	char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	ax25_cb *ax25;
@@ -522,7 +522,7 @@
 	if (optlen < sizeof(int))
 		return -EINVAL;
 
-	if (get_user(opt, (int *)optval))
+	if (get_user(opt, (int __user *)optval))
 		return -EFAULT;
 
 	lock_sock(sk);
@@ -648,7 +648,7 @@
 }
 
 static int ax25_getsockopt(struct socket *sock, int level, int optname,
-	char *optval, int *optlen)
+	char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	ax25_cb *ax25;
@@ -1413,9 +1413,8 @@
 	size_t size;
 	int lv, err, addr_len = msg->msg_namelen;
 
-	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) {
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
 		return -EINVAL;
-	}
 
 	lock_sock(sk);
 	ax25 = ax25_sk(sk);
@@ -1669,6 +1668,7 @@
 static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
 	struct sock *sk = sock->sk;
+	void __user *argp = (void __user *)arg;
 	int res = 0;
 
 	lock_sock(sk);
@@ -1678,7 +1678,7 @@
 		amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
 		if (amount < 0)
 			amount = 0;
-		res = put_user(amount, (int *)arg);
+		res = put_user(amount, (int __user *)argp);
 		break;
 	}
 
@@ -1688,13 +1688,13 @@
 		/* These two are safe on a single CPU system as only user tasks fiddle here */
 		if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
 			amount = skb->len;
-		res = put_user(amount, (int *)arg);
+		res = put_user(amount, (int __user *)argp);
 		break;
 	}
 
 	case SIOCGSTAMP:
 		if (sk != NULL) {
-			res = sock_get_timestamp(sk, (struct timeval *)arg);
+			res = sock_get_timestamp(sk, argp);
 			break;
 	 	}
 		res = -EINVAL;
@@ -1704,7 +1704,7 @@
 	case SIOCAX25DELUID:	/* Delete a uid from the uid/call map table */
 	case SIOCAX25GETUID: {
 		struct sockaddr_ax25 sax25;
-		if (copy_from_user(&sax25, (void *)arg, sizeof(sax25))) {
+		if (copy_from_user(&sax25, argp, sizeof(sax25))) {
 			res = -EFAULT;
 			break;
 		}
@@ -1718,7 +1718,7 @@
 			res = -EPERM;
 			break;
 		}
-		if (get_user(amount, (long *)arg)) {
+		if (get_user(amount, (long __user *)argp)) {
 			res = -EFAULT;
 			break;
 		}
@@ -1738,7 +1738,7 @@
 			res = -EPERM;
 			break;
 		}
-		res = ax25_rt_ioctl(cmd, (void *)arg);
+		res = ax25_rt_ioctl(cmd, argp);
 		break;
 
 	case SIOCAX25CTLCON:
@@ -1746,7 +1746,7 @@
 			res = -EPERM;
 			break;
 		}
-		res = ax25_ctl_ioctl(cmd, (void *)arg);
+		res = ax25_ctl_ioctl(cmd, argp);
 		break;
 
 	case SIOCAX25GETINFO:
@@ -1783,12 +1783,12 @@
 				warned=1;
 			}
 
-			if (copy_to_user((void *)arg, &ax25_info, sizeof(struct ax25_info_struct_deprecated))) {
+			if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct_deprecated))) {
 				res = -EFAULT;
 				break;
 			}
 		} else {
-			if (copy_to_user((void *)arg, &ax25_info, sizeof(struct ax25_info_struct))) {
+			if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct))) {
 				res = -EINVAL;
 				break;
 			}
@@ -1804,7 +1804,7 @@
 			res = -EPERM;
 			break;
 		}
-		if (copy_from_user(&ax25_fwd, (void *)arg, sizeof(ax25_fwd))) {
+		if (copy_from_user(&ax25_fwd, argp, sizeof(ax25_fwd))) {
 			res = -EFAULT;
 			break;
 		}
@@ -1826,7 +1826,7 @@
 		break;
 
 	default:
-		res = dev_ioctl(cmd, (void *)arg);
+		res = dev_ioctl(cmd, argp);
 		break;
 	}
 	release_sock(sk);
diff -Nru a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
--- a/net/ax25/ax25_route.c	Tue Jun 15 22:20:42 2004
+++ b/net/ax25/ax25_route.c	Tue Jun 15 22:20:42 2004
@@ -253,7 +253,7 @@
 	return err;
 }
 
-int ax25_rt_ioctl(unsigned int cmd, void *arg)
+int ax25_rt_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct ax25_route_opt_struct rt_option;
 	struct ax25_routes_struct route;
diff -Nru a/net/bluetooth/Kconfig b/net/bluetooth/Kconfig
--- a/net/bluetooth/Kconfig	Tue Jun 15 22:20:44 2004
+++ b/net/bluetooth/Kconfig	Tue Jun 15 22:20:44 2004
@@ -14,22 +14,20 @@
 
 	  Linux Bluetooth subsystem consist of several layers:
 	     Bluetooth Core (HCI device and connection manager, scheduler)
-	     HCI Device drivers (interface to the hardware)
-	     L2CAP Module (L2CAP protocol)
-	     SCO Module (SCO links)
-	     RFCOMM Module (RFCOMM protocol)  
-	     BNEP Module (BNEP protocol)
-	     CMTP Module (CMTP protocol)
+	     HCI Device drivers (Interface to the hardware)
+	     SCO Module (SCO audio links)
+	     L2CAP Module (Logical Link Control and Adaptation Protocol)
+	     RFCOMM Module (RFCOMM Protocol)  
+	     BNEP Module (Bluetooth Network Encapsulation Protocol)
+	     CMTP Module (CAPI Message Transport Protocol)
 
-	  Say Y here to enable Linux Bluetooth support and to build Bluetooth Core
-	  layer.
+	  Say Y here to compile Bluetooth support into the kernel or say M to
+	  compile it as module (bluetooth).
 
 	  To use Linux Bluetooth subsystem, you will need several user-space
 	  utilities like hciconfig and hcid.  These utilities and updates to
 	  Bluetooth kernel modules are provided in the BlueZ packages.
-	  For more information, see <http://bluez.sourceforge.net/>.
-
-	  If you want to compile Bluetooth Core as module (bluetooth) say M here.
+	  For more information, see <http://www.bluez.org/>.
 
 config BT_L2CAP
 	tristate "L2CAP protocol support"
@@ -46,7 +44,7 @@
 	tristate "SCO links support"
 	depends on BT
 	help
-	  SCO link provides voice transport over Bluetooth. SCO support is
+	  SCO link provides voice transport over Bluetooth.  SCO support is
 	  required for voice applications like Headset and Audio.
 
 	  Say Y here to compile SCO support into the kernel or say M to
diff -Nru a/net/bluetooth/Makefile b/net/bluetooth/Makefile
--- a/net/bluetooth/Makefile	Tue Jun 15 22:20:37 2004
+++ b/net/bluetooth/Makefile	Tue Jun 15 22:20:37 2004
@@ -9,4 +9,4 @@
 obj-$(CONFIG_BT_BNEP)	+= bnep/
 obj-$(CONFIG_BT_CMTP)	+= cmtp/
 
-bluetooth-objs := af_bluetooth.o hci_core.o hci_conn.o hci_event.o hci_sock.o hci_sysfs.o lib.o syms.o
+bluetooth-objs := af_bluetooth.o hci_core.o hci_conn.o hci_event.o hci_sock.o hci_sysfs.o lib.o
diff -Nru a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
--- a/net/bluetooth/af_bluetooth.c	Tue Jun 15 22:20:37 2004
+++ b/net/bluetooth/af_bluetooth.c	Tue Jun 15 22:20:37 2004
@@ -22,12 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- *  Bluetooth address family and sockets.
- *
- * $Id: af_bluetooth.c,v 1.3 2002/04/17 17:37:15 maxk Exp $
- */
-#define VERSION "2.4"
+/* Bluetooth address family and sockets. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -53,13 +48,16 @@
 
 #ifndef CONFIG_BT_SOCK_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
+#define VERSION "2.5"
+
 struct proc_dir_entry *proc_bt;
+EXPORT_SYMBOL(proc_bt);
 
 /* Bluetooth sockets */
-#define BT_MAX_PROTO	6
+#define BT_MAX_PROTO	7
 static struct net_proto_family *bt_proto[BT_MAX_PROTO];
 
 static kmem_cache_t *bt_sock_cache;
@@ -75,6 +73,7 @@
 	bt_proto[proto] = ops;
 	return 0;
 }
+EXPORT_SYMBOL(bt_sock_register);
 
 int bt_sock_unregister(int proto)
 {
@@ -87,6 +86,7 @@
 	bt_proto[proto] = NULL;
 	return 0;
 }
+EXPORT_SYMBOL(bt_sock_unregister);
 
 static int bt_sock_create(struct socket *sock, int proto)
 {
@@ -116,7 +116,7 @@
 	sk = sk_alloc(PF_BLUETOOTH, prio, sizeof(struct bt_sock), bt_sock_cache);
 	if (!sk)
 		return NULL;
-	
+
 	if (pi_size) {
 		pi = kmalloc(pi_size, prio);
 		if (!pi) {
@@ -129,13 +129,14 @@
 
 	sock_init_data(sock, sk);
 	INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
-	
+
 	sk->sk_zapped   = 0;
 	sk->sk_protocol = proto;
 	sk->sk_state    = BT_OPEN;
 
 	return sk;
 }
+EXPORT_SYMBOL(bt_sock_alloc);
 
 void bt_sock_link(struct bt_sock_list *l, struct sock *sk)
 {
@@ -143,6 +144,7 @@
 	sk_add_node(sk, &l->head);
 	write_unlock_bh(&l->lock);
 }
+EXPORT_SYMBOL(bt_sock_link);
 
 void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
 {
@@ -150,6 +152,7 @@
 	sk_del_node_init(sk);
 	write_unlock_bh(&l->lock);
 }
+EXPORT_SYMBOL(bt_sock_unlink);
 
 void bt_accept_enqueue(struct sock *parent, struct sock *sk)
 {
@@ -160,6 +163,7 @@
 	bt_sk(sk)->parent = parent;
 	parent->sk_ack_backlog++;
 }
+EXPORT_SYMBOL(bt_accept_enqueue);
 
 static void bt_accept_unlink(struct sock *sk)
 {
@@ -175,19 +179,19 @@
 {
 	struct list_head *p, *n;
 	struct sock *sk;
-	
+
 	BT_DBG("parent %p", parent);
 
 	list_for_each_safe(p, n, &bt_sk(parent)->accept_q) {
 		sk = (struct sock *) list_entry(p, struct bt_sock, accept_q);
-		
+
 		lock_sock(sk);
 		if (sk->sk_state == BT_CLOSED) {
 			release_sock(sk);
 			bt_accept_unlink(sk);
 			continue;
 		}
-		
+
 		if (sk->sk_state == BT_CONNECTED || !newsock) {
 			bt_accept_unlink(sk);
 			if (newsock)
@@ -199,6 +203,7 @@
 	}
 	return NULL;
 }
+EXPORT_SYMBOL(bt_accept_dequeue);
 
 int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
 	struct msghdr *msg, size_t len, int flags)
@@ -235,6 +240,7 @@
 
 	return err ? : copied;
 }
+EXPORT_SYMBOL(bt_sock_recvmsg);
 
 static inline unsigned int bt_accept_poll(struct sock *parent)
 {
@@ -287,6 +293,7 @@
 
 	return mask;
 }
+EXPORT_SYMBOL(bt_sock_poll);
 
 int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo)
 {
@@ -322,9 +329,10 @@
 	remove_wait_queue(sk->sk_sleep, &wait);
 	return err;
 }
+EXPORT_SYMBOL(bt_sock_wait_state);
 
 static struct net_proto_family bt_sock_family_ops = {
-	.owner  = THIS_MODULE,
+	.owner	= THIS_MODULE,
 	.family	= PF_BLUETOOTH,
 	.create	= bt_sock_create,
 };
@@ -342,7 +350,7 @@
 	proc_bt = proc_mkdir("bluetooth", NULL);
 	if (proc_bt)
 		proc_bt->owner = THIS_MODULE;
-	
+
 	/* Init socket cache */
 	bt_sock_cache = kmem_cache_create("bt_sock",
 			sizeof(struct bt_sock), 0,
@@ -352,7 +360,7 @@
 		BT_ERR("Socket cache creation failed");
 		return -ENOMEM;
 	}
-	
+
 	sock_register(&bt_sock_family_ops);
 
 	BT_INFO("HCI device and connection manager initialized");
diff -Nru a/net/bluetooth/bnep/Kconfig b/net/bluetooth/bnep/Kconfig
--- a/net/bluetooth/bnep/Kconfig	Tue Jun 15 22:21:05 2004
+++ b/net/bluetooth/bnep/Kconfig	Tue Jun 15 22:21:05 2004
@@ -4,12 +4,8 @@
 	select CRC32
 	help
 	  BNEP (Bluetooth Network Encapsulation Protocol) is Ethernet
-	  emulation layer on top of Bluetooth. BNEP is required for Bluetooth
-	  PAN (Personal Area Network).
-
-	  To use BNEP, you will need user-space utilities provided in the 
-	  BlueZ-PAN package.
-	  For more information, see <http://bluez.sourceforge.net>.
+	  emulation layer on top of Bluetooth.  BNEP is required for
+	  Bluetooth PAN (Personal Area Network).
 
 	  Say Y here to compile BNEP support into the kernel or say M to
 	  compile it as module (bnep).
diff -Nru a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
--- a/net/bluetooth/bnep/sock.c	Tue Jun 15 22:21:05 2004
+++ b/net/bluetooth/bnep/sock.c	Tue Jun 15 22:21:05 2004
@@ -77,6 +77,7 @@
 	struct bnep_conndel_req  cd;
 	struct bnep_conninfo ci;
 	struct socket *nsock;
+	void __user *argp = (void __user *)arg;
 	int err;
 
 	BT_DBG("cmd %x arg %lx", cmd, arg);
@@ -86,7 +87,7 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EACCES;
 
-		if (copy_from_user(&ca, (void *) arg, sizeof(ca)))
+		if (copy_from_user(&ca, argp, sizeof(ca)))
 			return -EFAULT;
 	
 		nsock = sockfd_lookup(ca.sock, &err);
@@ -100,7 +101,7 @@
 
 		err = bnep_add_connection(&ca, nsock);
 		if (!err) {
-    			if (copy_to_user((void *) arg, &ca, sizeof(ca)))
+    			if (copy_to_user(argp, &ca, sizeof(ca)))
 				err = -EFAULT;
 		} else
 			fput(nsock->file);
@@ -111,30 +112,30 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EACCES;
 
-		if (copy_from_user(&cd, (void *) arg, sizeof(cd)))
+		if (copy_from_user(&cd, argp, sizeof(cd)))
 			return -EFAULT;
 	
 		return bnep_del_connection(&cd);
 
 	case BNEPGETCONNLIST:
-		if (copy_from_user(&cl, (void *) arg, sizeof(cl)))
+		if (copy_from_user(&cl, argp, sizeof(cl)))
 			return -EFAULT;
 
 		if (cl.cnum <= 0)
 			return -EINVAL;
 	
 		err = bnep_get_connlist(&cl);
-		if (!err && copy_to_user((void *) arg, &cl, sizeof(cl)))
+		if (!err && copy_to_user(argp, &cl, sizeof(cl)))
 			return -EFAULT;
 
 		return err;
 
 	case BNEPGETCONNINFO:
-		if (copy_from_user(&ci, (void *) arg, sizeof(ci)))
+		if (copy_from_user(&ci, argp, sizeof(ci)))
 			return -EFAULT;
 
 		err = bnep_get_conninfo(&ci);
-		if (!err && copy_to_user((void *) arg, &ci, sizeof(ci)))
+		if (!err && copy_to_user(argp, &ci, sizeof(ci)))
 			return -EFAULT;
 
 		return err;
diff -Nru a/net/bluetooth/cmtp/Kconfig b/net/bluetooth/cmtp/Kconfig
--- a/net/bluetooth/cmtp/Kconfig	Tue Jun 15 22:20:38 2004
+++ b/net/bluetooth/cmtp/Kconfig	Tue Jun 15 22:20:38 2004
@@ -3,7 +3,7 @@
 	depends on BT && BT_L2CAP && ISDN_CAPI
 	help
 	  CMTP (CAPI Message Transport Protocol) is a transport layer
-	  for CAPI messages. CMTP is required for the Bluetooth Common
+	  for CAPI messages.  CMTP is required for the Bluetooth Common
 	  ISDN Access Profile.
 
 	  Say Y here to compile CMTP support into the kernel or say M to
diff -Nru a/net/bluetooth/cmtp/cmtp.h b/net/bluetooth/cmtp/cmtp.h
--- a/net/bluetooth/cmtp/cmtp.h	Tue Jun 15 22:20:42 2004
+++ b/net/bluetooth/cmtp/cmtp.h	Tue Jun 15 22:20:42 2004
@@ -55,7 +55,7 @@
 
 struct cmtp_connlist_req {
 	__u32  cnum;
-	struct cmtp_conninfo *ci;
+	struct cmtp_conninfo __user *ci;
 };
 
 int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock);
diff -Nru a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
--- a/net/bluetooth/cmtp/sock.c	Tue Jun 15 22:20:43 2004
+++ b/net/bluetooth/cmtp/sock.c	Tue Jun 15 22:20:43 2004
@@ -71,6 +71,7 @@
 	struct cmtp_connlist_req cl;
 	struct cmtp_conninfo ci;
 	struct socket *nsock;
+	void __user *argp = (void __user *)arg;
 	int err;
 
 	BT_DBG("cmd %x arg %lx", cmd, arg);
@@ -80,7 +81,7 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EACCES;
 
-		if (copy_from_user(&ca, (void *) arg, sizeof(ca)))
+		if (copy_from_user(&ca, argp, sizeof(ca)))
 			return -EFAULT;
 
 		nsock = sockfd_lookup(ca.sock, &err);
@@ -94,7 +95,7 @@
 
 		err = cmtp_add_connection(&ca, nsock);
 		if (!err) {
-			if (copy_to_user((void *) arg, &ca, sizeof(ca)))
+			if (copy_to_user(argp, &ca, sizeof(ca)))
 				err = -EFAULT;
 		} else
 			fput(nsock->file);
@@ -105,30 +106,30 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EACCES;
 
-		if (copy_from_user(&cd, (void *) arg, sizeof(cd)))
+		if (copy_from_user(&cd, argp, sizeof(cd)))
 			return -EFAULT;
 
 		return cmtp_del_connection(&cd);
 
 	case CMTPGETCONNLIST:
-		if (copy_from_user(&cl, (void *) arg, sizeof(cl)))
+		if (copy_from_user(&cl, argp, sizeof(cl)))
 			return -EFAULT;
 
 		if (cl.cnum <= 0)
 			return -EINVAL;
 
 		err = cmtp_get_connlist(&cl);
-		if (!err && copy_to_user((void *) arg, &cl, sizeof(cl)))
+		if (!err && copy_to_user(argp, &cl, sizeof(cl)))
 			return -EFAULT;
 
 		return err;
 
 	case CMTPGETCONNINFO:
-		if (copy_from_user(&ci, (void *) arg, sizeof(ci)))
+		if (copy_from_user(&ci, argp, sizeof(ci)))
 			return -EFAULT;
 
 		err = cmtp_get_conninfo(&ci);
-		if (!err && copy_to_user((void *) arg, &ci, sizeof(ci)))
+		if (!err && copy_to_user(argp, &ci, sizeof(ci)))
 			return -EFAULT;
 
 		return err;
diff -Nru a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
--- a/net/bluetooth/hci_conn.c	Tue Jun 15 22:21:05 2004
+++ b/net/bluetooth/hci_conn.c	Tue Jun 15 22:21:05 2004
@@ -22,11 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * HCI Connection handling.
- *
- * $Id: hci_conn.c,v 1.2 2002/04/17 17:37:16 maxk Exp $
- */
+/* Bluetooth HCI connection handling. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -54,7 +50,7 @@
 
 #ifndef CONFIG_BT_HCI_CORE_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 void hci_acl_connect(struct hci_conn *conn)
@@ -178,10 +174,10 @@
 
 int hci_conn_del(struct hci_conn *conn)
 {
-	struct hci_dev  *hdev = conn->hdev;
+	struct hci_dev *hdev = conn->hdev;
 
 	BT_DBG("%s conn %p handle %d", hdev->name, conn, conn->handle);
-	
+
 	hci_conn_del_timer(conn);
 
 	if (conn->type == SCO_LINK) {
@@ -226,14 +222,14 @@
 
 	list_for_each(p, &hci_dev_list) {
 		struct hci_dev *d = list_entry(p, struct hci_dev, list);
-		
+
 		if (!test_bit(HCI_UP, &d->flags))
 			continue;
 
 		/* Simple routing: 
-	 	 * 	No source address - find interface with bdaddr != dst 
-	 	 *	Source address 	  - find interface with bdaddr == src 
-	 	 */
+		 *   No source address - find interface with bdaddr != dst
+		 *   Source address    - find interface with bdaddr == src
+		 */
 
 		if (use_src) {
 			if (!bacmp(&d->bdaddr, src)) {
@@ -252,6 +248,7 @@
 	read_unlock_bh(&hci_dev_list_lock);
 	return hdev;
 }
+EXPORT_SYMBOL(hci_get_route);
 
 /* Create SCO or ACL connection.
  * Device _must_ be locked */
@@ -294,15 +291,16 @@
 		return acl;
 	}
 }
+EXPORT_SYMBOL(hci_connect);
 
 /* Authenticate remote device */
 int hci_conn_auth(struct hci_conn *conn)
 {
 	BT_DBG("conn %p", conn);
-	
+
 	if (conn->link_mode & HCI_LM_AUTH)
 		return 1;
-	
+
 	if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
 		struct hci_cp_auth_requested cp;
 		cp.handle = __cpu_to_le16(conn->handle);
@@ -310,15 +308,16 @@
 	}
 	return 0;
 }
+EXPORT_SYMBOL(hci_conn_auth);
 
 /* Enable encryption */
 int hci_conn_encrypt(struct hci_conn *conn)
 {
 	BT_DBG("conn %p", conn);
-	
+
 	if (conn->link_mode & HCI_LM_ENCRYPT)
 		return 1;
-	
+
 	if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend))
 		return 0;
 
@@ -330,12 +329,13 @@
 	}
 	return 0;
 }
+EXPORT_SYMBOL(hci_conn_encrypt);
 
 /* Drop all connection on the device */
 void hci_conn_hash_flush(struct hci_dev *hdev)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
-        struct list_head *p;
+	struct list_head *p;
 
 	BT_DBG("hdev %s", hdev->name);
 
@@ -353,7 +353,7 @@
 	}
 }
 
-int hci_get_conn_list(unsigned long arg)
+int hci_get_conn_list(void __user *arg)
 {
 	struct hci_conn_list_req req, *cl;
 	struct hci_conn_info *ci;
@@ -361,7 +361,7 @@
 	struct list_head *p;
 	int n = 0, size, err;
 
-	if (copy_from_user(&req, (void *) arg, sizeof(req)))
+	if (copy_from_user(&req, arg, sizeof(req)))
 		return -EFAULT;
 
 	if (!req.conn_num || req.conn_num > (PAGE_SIZE * 2) / sizeof(*ci))
@@ -401,20 +401,20 @@
 
 	hci_dev_put(hdev);
 
-	err = copy_to_user((void *) arg, cl, size);
+	err = copy_to_user(arg, cl, size);
 	kfree(cl);
 
 	return err ? -EFAULT : 0;
 }
 
-int hci_get_conn_info(struct hci_dev *hdev, unsigned long arg)
+int hci_get_conn_info(struct hci_dev *hdev, void __user *arg)
 {
 	struct hci_conn_info_req req;
 	struct hci_conn_info ci;
 	struct hci_conn *conn;
-	char *ptr = (void *) arg + sizeof(req);
+	char __user *ptr = arg + sizeof(req);
 
-	if (copy_from_user(&req, (void *) arg, sizeof(req)))
+	if (copy_from_user(&req, arg, sizeof(req)))
 		return -EFAULT;
 
 	hci_dev_lock_bh(hdev);
diff -Nru a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
--- a/net/bluetooth/hci_core.c	Tue Jun 15 22:20:38 2004
+++ b/net/bluetooth/hci_core.c	Tue Jun 15 22:20:38 2004
@@ -22,11 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth HCI Core.
- *
- * $Id: hci_core.c,v 1.6 2002/04/17 17:37:16 maxk Exp $
- */
+/* Bluetooth HCI core. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -55,7 +51,7 @@
 
 #ifndef CONFIG_BT_HCI_CORE_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 static void hci_cmd_task(unsigned long arg);
@@ -288,6 +284,7 @@
 	read_unlock(&hci_dev_list_lock);
 	return hdev;
 }
+EXPORT_SYMBOL(hci_dev_get);
 
 /* ---- Inquiry support ---- */
 void inquiry_cache_flush(struct hci_dev *hdev)
@@ -369,15 +366,15 @@
 	hci_send_cmd(hdev, OGF_LINK_CTL, OCF_INQUIRY, sizeof(cp), &cp);
 }
 
-int hci_inquiry(unsigned long arg)
+int hci_inquiry(void __user *arg)
 {
+	__u8 __user *ptr = arg;
 	struct hci_inquiry_req ir;
 	struct hci_dev *hdev;
 	int err = 0, do_inquiry = 0, max_rsp;
 	long timeo;
-	__u8 *buf, *ptr;
+	__u8 *buf;
 
-	ptr = (void *) arg;
 	if (copy_from_user(&ir, ptr, sizeof(ir)))
 		return -EFAULT;
 
@@ -416,7 +413,7 @@
 
 	if (!copy_to_user(ptr, &ir, sizeof(ir))) {
 		ptr += sizeof(ir);
-	        if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) *
+		if (copy_to_user(ptr, buf, sizeof(struct inquiry_info) *
 					ir.num_rsp))
 			err = -EFAULT;
 	} else 
@@ -459,7 +456,7 @@
 
 		//__hci_request(hdev, hci_reset_req, 0, HZ);
 		ret = __hci_request(hdev, hci_init_req, 0, HCI_INIT_TIMEOUT);
-       
+
 		clear_bit(HCI_INIT, &hdev->flags);
 	}
 
@@ -514,7 +511,7 @@
 	inquiry_cache_flush(hdev);
 	hci_conn_hash_flush(hdev);
 	hci_dev_unlock_bh(hdev);
-	
+
 	hci_notify(hdev, HCI_DEV_DOWN);
 
 	if (hdev->flush)
@@ -558,7 +555,7 @@
 {
 	struct hci_dev *hdev;
 	int err;
-	
+
 	if (!(hdev = hci_dev_get(dev)))
 		return -ENODEV;
 	err = hci_dev_do_close(hdev);
@@ -619,13 +616,13 @@
 	return ret;
 }
 
-int hci_dev_cmd(unsigned int cmd, unsigned long arg)
+int hci_dev_cmd(unsigned int cmd, void __user *arg)
 {
 	struct hci_dev *hdev;
 	struct hci_dev_req dr;
 	int err = 0;
 
-	if (copy_from_user(&dr, (void *) arg, sizeof(dr)))
+	if (copy_from_user(&dr, arg, sizeof(dr)))
 		return -EFAULT;
 
 	if (!(hdev = hci_dev_get(dr.dev_id)))
@@ -649,19 +646,19 @@
 			if (err)
 				break;
 		}
-			
+
 		err = hci_request(hdev, hci_encrypt_req,
 					dr.dev_opt, HCI_INIT_TIMEOUT);
 		break;
-	
+
 	case HCISETSCAN:
 		err = hci_request(hdev, hci_scan_req, dr.dev_opt, HCI_INIT_TIMEOUT);
 		break;
-	
+
 	case HCISETPTYPE:
 		hdev->pkt_type = (__u16) dr.dev_opt;
 		break;
-		
+
 	case HCISETLINKPOL:
 		hdev->link_policy = (__u16) dr.dev_opt;
 		break;
@@ -683,12 +680,12 @@
 	default:
 		err = -EINVAL;
 		break;
-	}	
+	}
 	hci_dev_put(hdev);
 	return err;
 }
 
-int hci_get_dev_list(unsigned long arg)
+int hci_get_dev_list(void __user *arg)
 {
 	struct hci_dev_list_req *dl;
 	struct hci_dev_req *dr;
@@ -696,7 +693,7 @@
 	int n = 0, size, err;
 	__u16 dev_num;
 
-	if (get_user(dev_num, (__u16 *) arg))
+	if (get_user(dev_num, (__u16 __user *) arg))
 		return -EFAULT;
 
 	if (!dev_num || dev_num > (PAGE_SIZE * 2) / sizeof(*dr))
@@ -723,19 +720,19 @@
 	dl->dev_num = n;
 	size = sizeof(*dl) + n * sizeof(*dr);
 
-	err = copy_to_user((void *) arg, dl, size);
+	err = copy_to_user(arg, dl, size);
 	kfree(dl);
 
 	return err ? -EFAULT : 0;
 }
 
-int hci_get_dev_info(unsigned long arg)
+int hci_get_dev_info(void __user *arg)
 {
 	struct hci_dev *hdev;
 	struct hci_dev_info di;
 	int err = 0;
 
-	if (copy_from_user(&di, (void *) arg, sizeof(di)))
+	if (copy_from_user(&di, arg, sizeof(di)))
 		return -EFAULT;
 
 	if (!(hdev = hci_dev_get(di.dev_id)))
@@ -756,7 +753,7 @@
 	memcpy(&di.stat, &hdev->stat, sizeof(di.stat));
 	memcpy(&di.features, &hdev->features, sizeof(di.features));
 
-	if (copy_to_user((void *) arg, &di, sizeof(di)))
+	if (copy_to_user(arg, &di, sizeof(di)))
 		err = -EFAULT;
 
 	hci_dev_put(hdev);
@@ -779,6 +776,7 @@
 
 	return hdev;
 }
+EXPORT_SYMBOL(hci_alloc_dev);
 
 /* Free HCI device */
 void hci_free_dev(struct hci_dev *hdev)
@@ -786,6 +784,7 @@
 	/* will free via class release */
 	class_device_put(&hdev->class_dev);
 }
+EXPORT_SYMBOL(hci_free_dev);
 
 /* Register HCI device */
 int hci_register_dev(struct hci_dev *hdev)
@@ -802,7 +801,7 @@
 
 	/* Find first available device id */
 	list_for_each(p, &hci_dev_list) {
-	       	if (list_entry(p, struct hci_dev, list)->id != id)
+		if (list_entry(p, struct hci_dev, list)->id != id)
 			break;
 		head = p; id++;
 	}
@@ -813,7 +812,7 @@
 
 	atomic_set(&hdev->refcnt, 1);
 	spin_lock_init(&hdev->lock);
-			
+
 	hdev->flags = 0;
 	hdev->pkt_type  = (HCI_DM1 | HCI_DH1 | HCI_HV1);
 	hdev->link_mode = (HCI_LM_ACCEPT);
@@ -836,7 +835,7 @@
 	memset(&hdev->stat, 0, sizeof(struct hci_dev_stats));
 
 	atomic_set(&hdev->promisc, 0);
-		
+
 	write_unlock_bh(&hci_dev_list_lock);
 
 	hci_register_sysfs(hdev);
@@ -845,6 +844,7 @@
 
 	return id;
 }
+EXPORT_SYMBOL(hci_register_dev);
 
 /* Unregister HCI device */
 int hci_unregister_dev(struct hci_dev *hdev)
@@ -864,6 +864,7 @@
 	__hci_dev_put(hdev);
 	return 0;
 }
+EXPORT_SYMBOL(hci_unregister_dev);
 
 /* Suspend HCI device */
 int hci_suspend_dev(struct hci_dev *hdev)
@@ -871,13 +872,15 @@
 	hci_notify(hdev, HCI_DEV_SUSPEND);
 	return 0;
 }
+EXPORT_SYMBOL(hci_suspend_dev);
 
 /* Resume HCI device */
 int hci_resume_dev(struct hci_dev *hdev)
 {
 	hci_notify(hdev, HCI_DEV_RESUME);
 	return 0;
-}       
+}
+EXPORT_SYMBOL(hci_resume_dev);
 
 /* ---- Interface to upper protocols ---- */
 
@@ -903,6 +906,7 @@
 
 	return err;
 }
+EXPORT_SYMBOL(hci_register_proto);
 
 int hci_unregister_proto(struct hci_proto *hp)
 {
@@ -924,6 +928,7 @@
 
 	return err;
 }
+EXPORT_SYMBOL(hci_unregister_proto);
 
 static int hci_send_frame(struct sk_buff *skb)
 {
@@ -938,7 +943,7 @@
 
 	if (atomic_read(&hdev->promisc)) {
 		/* Time stamp */
-	        do_gettimeofday(&skb->stamp);
+		do_gettimeofday(&skb->stamp);
 
 		hci_send_to_sock(hdev, skb);
 	}
@@ -980,6 +985,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(hci_send_cmd);
 
 /* Get data from the previously sent command */
 void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 ogf, __u16 ocf)
@@ -1026,7 +1032,7 @@
 	if (!(list = skb_shinfo(skb)->frag_list)) {
 		/* Non fragmented */
 		BT_DBG("%s nonfrag skb %p len %d", hdev->name, skb, skb->len);
-		
+
 		skb_queue_tail(&conn->data_q, skb);
 	} else {
 		/* Fragmented */
@@ -1044,7 +1050,7 @@
 			skb->dev = (void *) hdev;
 			skb->pkt_type = HCI_ACLDATA_PKT;
 			hci_add_acl_hdr(skb, conn->handle, flags | ACL_CONT);
-		
+
 			BT_DBG("%s frag %p len %d", hdev->name, skb, skb->len);
 
 			__skb_queue_tail(&conn->data_q, skb);
@@ -1052,10 +1058,11 @@
 
 		spin_unlock_bh(&conn->data_q.lock);
 	}
-		
+
 	hci_sched_tx(hdev);
 	return 0;
 }
+EXPORT_SYMBOL(hci_send_acl);
 
 /* Send SCO data */
 int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb)
@@ -1082,6 +1089,7 @@
 	hci_sched_tx(hdev);
 	return 0;
 }
+EXPORT_SYMBOL(hci_send_sco);
 
 /* ---- HCI TX task (outgoing data) ---- */
 
@@ -1091,7 +1099,7 @@
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	struct hci_conn  *conn = NULL;
 	int num = 0, min = ~0;
-        struct list_head *p;
+	struct list_head *p;
 
 	/* We don't have to lock device here. Connections are always 
 	 * added and removed with TX task disabled. */
@@ -1124,7 +1132,7 @@
 static inline void hci_acl_tx_to(struct hci_dev *hdev)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
-        struct list_head *p;
+	struct list_head *p;
 	struct hci_conn  *c;
 
 	BT_ERR("%s ACL tx timeout", hdev->name);
@@ -1265,7 +1273,7 @@
 	hci_dev_lock(hdev);
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	hci_dev_unlock(hdev);
-	
+
 	if (conn) {
 		register struct hci_proto *hp;
 
@@ -1348,7 +1356,7 @@
 		BT_ERR("%s command tx timeout", hdev->name);
 		atomic_set(&hdev->cmd_cnt, 1);
 	}
-	
+
 	/* Send queued commands */
 	if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) {
 		if (hdev->sent_cmd)
diff -Nru a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
--- a/net/bluetooth/hci_event.c	Tue Jun 15 22:20:36 2004
+++ b/net/bluetooth/hci_event.c	Tue Jun 15 22:20:36 2004
@@ -22,11 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * HCI Events.
- *
- * $Id: hci_event.c,v 1.3 2002/04/17 17:37:16 maxk Exp $
- */
+/* Bluetooth HCI event handling. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -54,7 +50,7 @@
 
 #ifndef CONFIG_BT_HCI_CORE_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 /* Handle HCI Event packets */
@@ -98,9 +94,9 @@
 
 		if (rd->status)
 			break;
-		
+
 		hci_dev_lock(hdev);
-	
+
 		conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rd->handle));
 		if (conn) {
 			if (rd->role)
@@ -355,7 +351,7 @@
 		return;
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &cp->bdaddr);
 
 	BT_DBG("%s status 0x%x bdaddr %s conn %p", hdev->name,
@@ -572,7 +568,7 @@
 	BT_DBG("%s", hdev->name);
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
 	if (!conn) {
 		hci_dev_unlock(hdev);
@@ -585,7 +581,7 @@
 
 		if (test_bit(HCI_AUTH, &hdev->flags))
 			conn->link_mode |= HCI_LM_AUTH;
-		
+
 		if (test_bit(HCI_ENCRYPT, &hdev->flags))
 			conn->link_mode |= HCI_LM_ENCRYPT;
 
@@ -643,7 +639,7 @@
 		return;
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	if (conn) {
 		conn->state = BT_CLOSED;
@@ -709,7 +705,7 @@
 		return;
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
 	if (conn) {
 		if (ev->role)
@@ -731,7 +727,7 @@
 	BT_DBG("%s status %d", hdev->name, ev->status);
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	if (conn) {
 		if (!ev->status)
@@ -739,7 +735,7 @@
 		clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
 
 		hci_proto_auth_cfm(conn, ev->status);
-		
+
 		if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) {
 			if (!ev->status) {
 				struct hci_cp_set_conn_encrypt cp;
@@ -768,11 +764,11 @@
 	BT_DBG("%s status %d", hdev->name, ev->status);
 
 	hci_dev_lock(hdev);
-	
+
 	conn = hci_conn_hash_lookup_handle(hdev, handle);
 	if (conn) {
 		if (!ev->status) {
-		       	if (ev->encrypt)
+			if (ev->encrypt)
 				conn->link_mode |= HCI_LM_ENCRYPT;
 			else
 				conn->link_mode &= ~HCI_LM_ENCRYPT;
@@ -840,7 +836,7 @@
 	case HCI_EV_CMD_STATUS:
 		cs = (struct hci_ev_cmd_status *) skb->data;
 		skb_pull(skb, sizeof(cs));
-				
+
 		opcode = __le16_to_cpu(cs->opcode);
 		ogf = hci_opcode_ogf(opcode);
 		ocf = hci_opcode_ocf(opcode);
@@ -928,15 +924,16 @@
 		return;
 
 	hdr = (void *) skb_put(skb, HCI_EVENT_HDR_SIZE);
-       	hdr->evt  = HCI_EV_STACK_INTERNAL;
+	hdr->evt  = HCI_EV_STACK_INTERNAL;
 	hdr->plen = sizeof(*ev) + dlen;
 
 	ev  = (void *) skb_put(skb, sizeof(*ev) + dlen);
 	ev->type = type;
 	memcpy(ev->data, data, dlen);
-	
+
 	skb->pkt_type = HCI_EVENT_PKT;
 	skb->dev = (void *) hdev;
 	hci_send_to_sock(hdev, skb);
 	kfree_skb(skb);
 }
+EXPORT_SYMBOL(hci_si_event);
diff -Nru a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
--- a/net/bluetooth/hci_sock.c	Tue Jun 15 22:20:41 2004
+++ b/net/bluetooth/hci_sock.c	Tue Jun 15 22:20:41 2004
@@ -22,11 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth HCI socket layer.
- *
- * $Id: hci_sock.c,v 1.4 2002/04/18 22:26:14 maxk Exp $
- */
+/* Bluetooth HCI sockets. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -56,7 +52,7 @@
 
 #ifndef CONFIG_BT_HCI_SOCK_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 /* ----- HCI socket interface ----- */
@@ -139,7 +135,6 @@
 
 		if (sock_queue_rcv_skb(sk, nskb))
 			kfree_skb(nskb);
-		
 	}
 	read_unlock(&hci_sk_list.lock);
 }
@@ -191,7 +186,7 @@
 		return 0;
 
 	case HCIGETCONNINFO:
-		return hci_get_conn_info(hdev, arg);
+		return hci_get_conn_info(hdev, (void __user *)arg);
 
 	default:
 		if (hdev->ioctl)
@@ -203,19 +198,20 @@
 static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
 	struct sock *sk = sock->sk;
+	void __user *argp = (void __user *)arg;
 	int err;
 
 	BT_DBG("cmd %x arg %lx", cmd, arg);
 
 	switch (cmd) {
 	case HCIGETDEVLIST:
-		return hci_get_dev_list(arg);
+		return hci_get_dev_list(argp);
 
 	case HCIGETDEVINFO:
-		return hci_get_dev_info(arg);
+		return hci_get_dev_info(argp);
 
 	case HCIGETCONNLIST:
-		return hci_get_conn_list(arg);
+		return hci_get_conn_list(argp);
 
 	case HCIDEVUP:
 		if (!capable(CAP_NET_ADMIN))
@@ -247,10 +243,10 @@
 	case HCISETSCOMTU:
 		if (!capable(CAP_NET_ADMIN))
 			return -EACCES;
-		return hci_dev_cmd(cmd, arg);
+		return hci_dev_cmd(cmd, argp);
 
 	case HCIINQUIRY:
-		return hci_inquiry(arg);
+		return hci_inquiry(argp);
 
 	default:
 		lock_sock(sk);
@@ -318,14 +314,14 @@
 	__u32 mask = hci_pi(sk)->cmsg_mask;
 
 	if (mask & HCI_CMSG_DIR)
-        	put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming);
+		put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming);
 
 	if (mask & HCI_CMSG_TSTAMP)
-        	put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp);
+		put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp);
 }
  
 static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, 
-			    struct msghdr *msg, size_t len, int flags)
+				struct msghdr *msg, size_t len, int flags)
 {
 	int noblock = flags & MSG_DONTWAIT;
 	struct sock *sk = sock->sk;
@@ -355,7 +351,7 @@
 	err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
 
 	hci_sock_cmsg(sk, msg, skb);
-	
+
 	skb_free_datagram(sk, skb);
 
 	return err ? : copied;
@@ -406,7 +402,7 @@
 
 		if (((ogf > HCI_SFLT_MAX_OGF) ||
 				!hci_test_bit(ocf & HCI_FLT_OCF_BITS, &hci_sec_filter.ocf_mask[ogf])) &&
-		    			!capable(CAP_NET_RAW)) {
+					!capable(CAP_NET_RAW)) {
 			err = -EPERM;
 			goto drop;
 		}
@@ -439,7 +435,7 @@
 	goto done;
 }
 
-int hci_sock_setsockopt(struct socket *sock, int level, int optname, char *optval, int len)
+int hci_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int len)
 {
 	struct hci_ufilter uf = { .opcode = 0 };
 	struct sock *sk = sock->sk;
@@ -451,7 +447,7 @@
 
 	switch (optname) {
 	case HCI_DATA_DIR:
-		if (get_user(opt, (int *)optval)) {
+		if (get_user(opt, (int __user *)optval)) {
 			err = -EFAULT;
 			break;
 		}
@@ -463,7 +459,7 @@
 		break;
 
 	case HCI_TIME_STAMP:
-		if (get_user(opt, (int *)optval)) {
+		if (get_user(opt, (int __user *)optval)) {
 			err = -EFAULT;
 			break;
 		}
@@ -487,9 +483,9 @@
 			uf.event_mask[1] &= *((u32 *) hci_sec_filter.event_mask + 1);
 		}
 
-		{	
+		{
 			struct hci_filter *f = &hci_pi(sk)->filter;
-		
+
 			f->type_mask = uf.type_mask;
 			f->opcode    = uf.opcode;
 			*((u32 *) f->event_mask + 0) = uf.event_mask[0];
@@ -501,12 +497,12 @@
 		err = -ENOPROTOOPT;
 		break;
 	}
-	
+
 	release_sock(sk);
 	return err;
 }
 
-int hci_sock_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen)
+int hci_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
 {
 	struct hci_ufilter uf;
 	struct sock *sk = sock->sk;
@@ -539,7 +535,7 @@
 	case HCI_FILTER:
 		{
 			struct hci_filter *f = &hci_pi(sk)->filter;
-		
+
 			uf.type_mask = f->type_mask;
 			uf.opcode    = f->opcode;
 			uf.event_mask[0] = *((u32 *) f->event_mask + 0);
@@ -560,23 +556,23 @@
 }
 
 struct proto_ops hci_sock_ops = {
-	.family =	PF_BLUETOOTH,
-	.owner =	THIS_MODULE,
-	.release =	hci_sock_release,
-	.bind =		hci_sock_bind,
-	.getname =	hci_sock_getname,
-	.sendmsg =	hci_sock_sendmsg,
-	.recvmsg =	hci_sock_recvmsg,
-	.ioctl =	hci_sock_ioctl,
-	.poll =		datagram_poll,
-	.listen =	sock_no_listen,
-	.shutdown =	sock_no_shutdown,
-	.setsockopt =	hci_sock_setsockopt,
-	.getsockopt =	hci_sock_getsockopt,
-	.connect =	sock_no_connect,
-	.socketpair =	sock_no_socketpair,
-	.accept =	sock_no_accept,
-	.mmap =		sock_no_mmap
+	.family		= PF_BLUETOOTH,
+	.owner		= THIS_MODULE,
+	.release	= hci_sock_release,
+	.bind		= hci_sock_bind,
+	.getname	= hci_sock_getname,
+	.sendmsg	= hci_sock_sendmsg,
+	.recvmsg	= hci_sock_recvmsg,
+	.ioctl		= hci_sock_ioctl,
+	.poll		= datagram_poll,
+	.listen		= sock_no_listen,
+	.shutdown	= sock_no_shutdown,
+	.setsockopt	= hci_sock_setsockopt,
+	.getsockopt	= hci_sock_getsockopt,
+	.connect	= sock_no_connect,
+	.socketpair	= sock_no_socketpair,
+	.accept		= sock_no_accept,
+	.mmap		= sock_no_mmap
 };
 
 static int hci_sock_create(struct socket *sock, int protocol)
@@ -597,7 +593,7 @@
 	sk_set_owner(sk, THIS_MODULE);
 
 	sock->state = SS_UNCONNECTED;
-	sk->sk_state   = BT_OPEN;
+	sk->sk_state = BT_OPEN;
 
 	bt_sock_link(&hci_sk_list, sk);
 	return 0;
@@ -607,14 +603,14 @@
 {
 	struct hci_dev *hdev = (struct hci_dev *) ptr;
 	struct hci_ev_si_device ev;
-	
+
 	BT_DBG("hdev %s event %ld", hdev->name, event);
 
 	/* Send event to sockets */
 	ev.event  = event;
 	ev.dev_id = hdev->id;
 	hci_si_event(NULL, HCI_EV_SI_DEVICE, sizeof(ev), &ev);
-	
+
 	if (event == HCI_DEV_UNREG) {
 		struct sock *sk;
 		struct hlist_node *node;
@@ -640,9 +636,9 @@
 }
 
 struct net_proto_family hci_sock_family_ops = {
-	.family = PF_BLUETOOTH,
+	.family	= PF_BLUETOOTH,
 	.owner	= THIS_MODULE,
-	.create = hci_sock_create,
+	.create	= hci_sock_create,
 };
 
 struct notifier_block hci_sock_nblock = {
diff -Nru a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
--- a/net/bluetooth/hci_sysfs.c	Tue Jun 15 22:20:43 2004
+++ b/net/bluetooth/hci_sysfs.c	Tue Jun 15 22:20:43 2004
@@ -1,3 +1,5 @@
+/* Bluetooth HCI driver model support. */
+
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -7,7 +9,7 @@
 
 #ifndef CONFIG_BT_HCI_CORE_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
 static ssize_t show_name(struct class_device *cdev, char *buf)
diff -Nru a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
--- a/net/bluetooth/l2cap.c	Tue Jun 15 22:20:42 2004
+++ b/net/bluetooth/l2cap.c	Tue Jun 15 22:20:42 2004
@@ -22,12 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth L2CAP core and sockets.
- *
- * $Id: l2cap.c,v 1.15 2002/09/09 01:14:52 maxk Exp $
- */
-#define VERSION "2.1"
+/* Bluetooth L2CAP core and sockets. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -59,9 +54,11 @@
 
 #ifndef CONFIG_BT_L2CAP_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
+#define VERSION "2.2"
+
 static struct proto_ops l2cap_sock_ops;
 
 struct bt_sock_list l2cap_sk_list = {
@@ -98,17 +95,13 @@
 static void l2cap_sock_set_timer(struct sock *sk, long timeout)
 {
 	BT_DBG("sk %p state %d timeout %ld", sk, sk->sk_state, timeout);
-
-	if (!mod_timer(&sk->sk_timer, jiffies + timeout))
-		sock_hold(sk);
+	sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout);
 }
 
 static void l2cap_sock_clear_timer(struct sock *sk)
 {
 	BT_DBG("sock %p state %d", sk, sk->sk_state);
-
-	if (timer_pending(&sk->sk_timer) && del_timer(&sk->sk_timer))
-		__sock_put(sk);
+	sk_stop_timer(sk, &sk->sk_timer);
 }
 
 static void l2cap_sock_init_timer(struct sock *sk)
@@ -135,11 +128,11 @@
 
 	hcon->l2cap_data = conn;
 	conn->hcon = hcon;
-	
+
 	conn->mtu = hcon->hdev->acl_mtu;
 	conn->src = &hcon->hdev->bdaddr;
 	conn->dst = &hcon->dst;
-	
+
 	spin_lock_init(&conn->lock);
 	conn->chan_list.lock = RW_LOCK_UNLOCKED;
 
@@ -374,10 +367,10 @@
 
 	if (sock->type != SOCK_SEQPACKET && sock->type != SOCK_DGRAM && sock->type != SOCK_RAW)
 		return -ESOCKTNOSUPPORT;
-	
+
 	if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW))
 		return -EPERM;
-	
+
 	sock->ops = &l2cap_sock_ops;
 
 	sk = l2cap_sock_alloc(sock, protocol, GFP_KERNEL);
@@ -407,6 +400,7 @@
 	}
 
 	write_lock_bh(&l2cap_sk_list.lock);
+
 	if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) {
 		err = -EADDRINUSE;
 	} else {
@@ -416,6 +410,7 @@
 		l2cap_pi(sk)->sport = la->l2_psm;
 		sk->sk_state = BT_BOUND;
 	}
+
 	write_unlock_bh(&l2cap_sk_list.lock);
 
 done:
@@ -428,8 +423,8 @@
 	bdaddr_t *src = &bt_sk(sk)->src;
 	bdaddr_t *dst = &bt_sk(sk)->dst;
 	struct l2cap_conn *conn;
-	struct hci_conn   *hcon;
-	struct hci_dev    *hdev;
+	struct hci_conn *hcon;
+	struct hci_dev *hdev;
 	int err = 0;
 
 	BT_DBG("%s -> %s psm 0x%2.2x", batostr(src), batostr(dst), l2cap_pi(sk)->psm);
@@ -550,8 +545,25 @@
 	}
 
 	if (!l2cap_pi(sk)->psm) {
+		bdaddr_t *src = &bt_sk(sk)->src;
+		u16 psm;
+
 		err = -EINVAL;
-		goto done;
+
+		write_lock_bh(&l2cap_sk_list.lock);
+
+		for (psm = 0x1001; psm < 0x1100; psm += 2)
+			if (!__l2cap_get_sock_by_addr(psm, src)) {
+				l2cap_pi(sk)->psm   = htobs(psm);
+				l2cap_pi(sk)->sport = htobs(psm);
+				err = 0;
+				break;
+			}
+
+		write_unlock_bh(&l2cap_sk_list.lock);
+
+		if (err < 0)
+			goto done;
 	}
 
 	sk->sk_max_ack_backlog = backlog;
@@ -735,7 +747,7 @@
 	return err;
 }
 
-static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen)
+static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	struct l2cap_options opts;
@@ -758,7 +770,7 @@
 		break;
 
 	case L2CAP_LM:
-		if (get_user(opt, (u32 *)optval)) {
+		if (get_user(opt, (u32 __user *)optval)) {
 			err = -EFAULT;
 			break;
 		}
@@ -775,7 +787,7 @@
 	return err;
 }
 
-static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen)
+static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	struct l2cap_options opts;
@@ -800,7 +812,7 @@
 		break;
 
 	case L2CAP_LM:
-		if (put_user(l2cap_pi(sk)->link_mode, (u32 *)optval))
+		if (put_user(l2cap_pi(sk)->link_mode, (u32 __user *)optval))
 			err = -EFAULT;
 		break;
 
@@ -834,7 +846,8 @@
 
 	BT_DBG("sock %p, sk %p", sock, sk);
 
-	if (!sk) return 0;
+	if (!sk)
+		return 0;
 
 	lock_sock(sk);
 	if (!sk->sk_shutdown) {
@@ -856,7 +869,8 @@
 
 	BT_DBG("sock %p, sk %p", sock, sk);
 
-	if (!sk) return 0;
+	if (!sk)
+		return 0;
 
 	err = l2cap_sock_shutdown(sock, 2);
 
@@ -988,7 +1002,7 @@
 
 	sk->sk_state  = BT_CLOSED;
 	sk->sk_zapped = 1;
-	
+
 	if (err)
 		sk->sk_err = err;
 
@@ -1111,7 +1125,7 @@
 
 	len = L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE + dlen;
 	count = min_t(unsigned int, conn->mtu, len);
-	
+
 	skb = bt_skb_alloc(count, GFP_ATOMIC);
 	if (!skb)
 		return NULL;
@@ -1132,7 +1146,7 @@
 	}
 
 	len -= skb->len;
-	
+
 	/* Continuation fragments (no L2CAP header) */
 	frag = &skb_shinfo(skb)->frag_list;
 	while (len) {
@@ -1141,12 +1155,12 @@
 		*frag = bt_skb_alloc(count, GFP_ATOMIC);
 		if (!*frag)
 			goto fail;
-		
+
 		memcpy(skb_put(*frag, count), data, count);
 
 		len  -= count;
 		data += count;
-		
+
 		frag = &(*frag)->next;
 	}
 
@@ -1238,7 +1252,7 @@
 
 		case L2CAP_CONF_QOS:
 			break;
-		
+
 		default:
 			if (hint)
 				break;
@@ -1306,8 +1320,7 @@
 	int result = 0;
 
 	/* Configure output options and let the other side know
-	 * which ones we don't like.
-	 */
+	 * which ones we don't like. */
 	if (pi->conf_mtu < pi->omtu) {
 		l2cap_add_conf_opt(ptr, L2CAP_CONF_MTU, 2, pi->omtu);
 		result = L2CAP_CONF_UNACCEPT;
@@ -1533,13 +1546,11 @@
 	case L2CAP_CONF_UNACCEPT:
 		if (++l2cap_pi(sk)->conf_retry < L2CAP_CONF_MAX_RETRIES) {
 			char req[128];
-			/* 
-			   It does not make sense to adjust L2CAP parameters 
-			   that are currently defined in the spec. We simply 
-			   resend config request that we sent earlier. It is
-			   stupid :) but it helps qualification testing
-			   which expects at least some response from us.
-			*/
+			/* It does not make sense to adjust L2CAP parameters
+			 * that are currently defined in the spec. We simply
+			 * resend config request that we sent earlier. It is
+			 * stupid, but it helps qualification testing which
+			 * expects at least some response from us. */
 			l2cap_send_req(conn, L2CAP_CONF_REQ,
 				l2cap_build_conf_req(sk, req), req);
 			goto done;
@@ -1594,7 +1605,7 @@
 	l2cap_send_rsp(conn, cmd->ident, L2CAP_DISCONN_RSP, sizeof(rsp), &rsp);
 
 	sk->sk_shutdown = SHUTDOWN_MASK;
-	
+
 	l2cap_chan_del(sk, ECONNRESET);
 	bh_unlock_sock(sk);
 
@@ -1723,11 +1734,11 @@
 	if (l2cap_pi(sk)->imtu < skb->len)
 		goto drop;
 
-	/* If socket recv buffers overflows we drop data here 
-	 * which is *bad* because L2CAP has to be reliable. 
-	 * But we don't have any other choice. L2CAP doesn't 
-	 * provide flow control mechanism */ 
-	
+	/* If socket recv buffers overflows we drop data here
+	 * which is *bad* because L2CAP has to be reliable.
+	 * But we don't have any other choice. L2CAP doesn't
+	 * provide flow control mechanism */
+
 	if (!sock_queue_rcv_skb(sk, skb))
 		goto done;
 
@@ -1787,7 +1798,7 @@
 		skb_pull(skb, 2);
 		l2cap_conless_channel(conn, psm, skb);
 		break;
-		
+
 	default:
 		l2cap_data_channel(conn, cid, skb);
 		break;
@@ -1839,7 +1850,7 @@
 			l2cap_conn_ready(conn);
 	} else 
 		l2cap_conn_del(hcon, bt_err(status));
-	
+
 	return 0;
 }
 
@@ -1861,7 +1872,7 @@
 	struct l2cap_conn_rsp rsp;
 	struct sock *sk;
 	int result;
-	
+
 	if (!(conn = hcon->l2cap_data))
 		return 0;
 	l = &conn->chan_list;
@@ -1908,7 +1919,7 @@
 	struct l2cap_conn_rsp rsp;
 	struct sock *sk;
 	int result;
-	
+
 	if (!(conn = hcon->l2cap_data))
 		return 0;
 	l = &conn->chan_list;
@@ -2069,10 +2080,10 @@
 }
 
 static struct seq_operations l2cap_seq_ops = {
-	.start  = l2cap_seq_start,
-	.next   = l2cap_seq_next,
-	.stop   = l2cap_seq_stop,
-	.show   = l2cap_seq_show 
+	.start	= l2cap_seq_start,
+	.next	= l2cap_seq_next,
+	.stop	= l2cap_seq_stop,
+	.show	= l2cap_seq_show 
 };
 
 static int l2cap_seq_open(struct inode *inode, struct file *file)
@@ -2081,76 +2092,76 @@
 }
 
 static struct file_operations l2cap_seq_fops = {
-	.owner	 = THIS_MODULE,
-	.open    = l2cap_seq_open,
-	.read    = seq_read,
-	.llseek  = seq_lseek,
-	.release = seq_release,
+	.owner		= THIS_MODULE,
+	.open		= l2cap_seq_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
 };
 
-static int  __init l2cap_proc_init(void)
+static int __init l2cap_proc_init(void)
 {
-        struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt);
-        if (!p)
-                return -ENOMEM;
+	struct proc_dir_entry *p = create_proc_entry("l2cap", S_IRUGO, proc_bt);
+	if (!p)
+		return -ENOMEM;
 	p->owner     = THIS_MODULE;
-        p->proc_fops = &l2cap_seq_fops;
-        return 0;
+	p->proc_fops = &l2cap_seq_fops;
+	return 0;
 }
 
 static void __exit l2cap_proc_cleanup(void)
 {
-        remove_proc_entry("l2cap", proc_bt);
+	remove_proc_entry("l2cap", proc_bt);
 }
 
 #else /* CONFIG_PROC_FS */
 
-static int  __init l2cap_proc_init(void)
+static int __init l2cap_proc_init(void)
 {
-        return 0;
+	return 0;
 }
 
 static void __exit l2cap_proc_cleanup(void)
 {
-        return;
+	return;
 }
 #endif /* CONFIG_PROC_FS */
 
 static struct proto_ops l2cap_sock_ops = {
-	.family  =      PF_BLUETOOTH,
-	.owner   =	THIS_MODULE,
-	.release =      l2cap_sock_release,
-	.bind    =      l2cap_sock_bind,
-	.connect =      l2cap_sock_connect,
-	.listen  =      l2cap_sock_listen,
-	.accept  =      l2cap_sock_accept,
-	.getname =      l2cap_sock_getname,
-	.sendmsg =      l2cap_sock_sendmsg,
-	.recvmsg =      bt_sock_recvmsg,
-	.poll    =      bt_sock_poll,
-	.mmap    =      sock_no_mmap,
-	.socketpair =   sock_no_socketpair,
-	.ioctl      =   sock_no_ioctl,
-	.shutdown   =   l2cap_sock_shutdown,
-	.setsockopt =   l2cap_sock_setsockopt,
-	.getsockopt =   l2cap_sock_getsockopt
+	.family		= PF_BLUETOOTH,
+	.owner		= THIS_MODULE,
+	.release	= l2cap_sock_release,
+	.bind		= l2cap_sock_bind,
+	.connect	= l2cap_sock_connect,
+	.listen		= l2cap_sock_listen,
+	.accept		= l2cap_sock_accept,
+	.getname	= l2cap_sock_getname,
+	.sendmsg	= l2cap_sock_sendmsg,
+	.recvmsg	= bt_sock_recvmsg,
+	.poll		= bt_sock_poll,
+	.mmap		= sock_no_mmap,
+	.socketpair	= sock_no_socketpair,
+	.ioctl		= sock_no_ioctl,
+	.shutdown	= l2cap_sock_shutdown,
+	.setsockopt	= l2cap_sock_setsockopt,
+	.getsockopt	= l2cap_sock_getsockopt
 };
 
 static struct net_proto_family l2cap_sock_family_ops = {
-	.family =       PF_BLUETOOTH,
-	.create	=       l2cap_sock_create,
-	.owner	=	THIS_MODULE,
+	.family	= PF_BLUETOOTH,
+	.owner	= THIS_MODULE,
+	.create	= l2cap_sock_create,
 };
 
 static struct hci_proto l2cap_hci_proto = {
-	.name =         "L2CAP",
-	.id   =         HCI_PROTO_L2CAP,
-	.connect_ind =  l2cap_connect_ind,
-	.connect_cfm =  l2cap_connect_cfm,
-	.disconn_ind =  l2cap_disconn_ind,
-	.auth_cfm    =  l2cap_auth_cfm,
-	.encrypt_cfm =  l2cap_encrypt_cfm,
-	.recv_acldata =	l2cap_recv_acldata
+	.name		= "L2CAP",
+	.id		= HCI_PROTO_L2CAP,
+	.connect_ind	= l2cap_connect_ind,
+	.connect_cfm	= l2cap_connect_cfm,
+	.disconn_ind	= l2cap_disconn_ind,
+	.auth_cfm	= l2cap_auth_cfm,
+	.encrypt_cfm	= l2cap_encrypt_cfm,
+	.recv_acldata	= l2cap_recv_acldata
 };
 
 static int __init l2cap_init(void)
@@ -2168,7 +2179,7 @@
 	}
 
 	l2cap_proc_init();
-	
+
 	BT_INFO("L2CAP ver %s", VERSION);
 	BT_INFO("L2CAP socket layer initialized");
 
@@ -2189,9 +2200,9 @@
 
 void l2cap_load(void)
 {
-	/* Dummy function to trigger automatic L2CAP module loading by 
-	   other modules that use L2CAP sockets but don not use any other
-	   symbols from it. */
+	/* Dummy function to trigger automatic L2CAP module loading by
+	 * other modules that use L2CAP sockets but don not use any othe
+	 * symbols from it. */
 	return;
 }
 EXPORT_SYMBOL(l2cap_load);
diff -Nru a/net/bluetooth/lib.c b/net/bluetooth/lib.c
--- a/net/bluetooth/lib.c	Tue Jun 15 22:20:36 2004
+++ b/net/bluetooth/lib.c	Tue Jun 15 22:20:36 2004
@@ -22,11 +22,10 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth kernel library.
- *
- * $Id: lib.c,v 1.1 2002/03/08 21:06:59 maxk Exp $
- */
+/* Bluetooth kernel library. */
+
+#include <linux/config.h>
+#include <linux/module.h>
 
 #include <linux/kernel.h>
 #include <linux/stddef.h>
@@ -58,6 +57,7 @@
 	if (line[0])
 		printk(KERN_INFO "%s:%s\n", pref, line);
 }
+EXPORT_SYMBOL(bt_dump);
 
 void baswap(bdaddr_t *dst, bdaddr_t *src)
 {
@@ -68,6 +68,7 @@
 	for (i = 0; i < 6; i++)
 		d[i] = s[5 - i];
 }
+EXPORT_SYMBOL(baswap);
 
 char *batostr(bdaddr_t *ba)
 {
@@ -76,11 +77,12 @@
 
 	i ^= 1;
 	sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
-	        ba->b[0], ba->b[1], ba->b[2],
+		ba->b[0], ba->b[1], ba->b[2],
 		ba->b[3], ba->b[4], ba->b[5]);
 
 	return str[i];
 }
+EXPORT_SYMBOL(batostr);
 
 /* Bluetooth error codes to Unix errno mapping */
 int bt_err(__u16 code)
@@ -173,3 +175,4 @@
 		return ENOSYS;
 	}
 }
+EXPORT_SYMBOL(bt_err);
diff -Nru a/net/bluetooth/rfcomm/Kconfig b/net/bluetooth/rfcomm/Kconfig
--- a/net/bluetooth/rfcomm/Kconfig	Tue Jun 15 22:20:41 2004
+++ b/net/bluetooth/rfcomm/Kconfig	Tue Jun 15 22:20:41 2004
@@ -2,7 +2,7 @@
 	tristate "RFCOMM protocol support"
 	depends on BT && BT_L2CAP
 	help
-	  RFCOMM provides connection oriented stream transport. RFCOMM
+	  RFCOMM provides connection oriented stream transport.  RFCOMM
 	  support is required for Dialup Networking, OBEX and other Bluetooth
 	  applications.
 
diff -Nru a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
--- a/net/bluetooth/rfcomm/core.c	Tue Jun 15 22:20:36 2004
+++ b/net/bluetooth/rfcomm/core.c	Tue Jun 15 22:20:36 2004
@@ -50,7 +50,7 @@
 #include <net/bluetooth/l2cap.h>
 #include <net/bluetooth/rfcomm.h>
 
-#define VERSION "1.2"
+#define VERSION "1.3"
 
 #ifndef CONFIG_BT_RFCOMM_DEBUG
 #undef  BT_DBG
@@ -158,8 +158,7 @@
 
 	BT_DBG("");
 
-	err = sock_create_kern(PF_BLUETOOTH, SOCK_SEQPACKET,
-			       BTPROTO_L2CAP, sock);
+	err = sock_create_kern(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP, sock);
 	if (!err) {
 		struct sock *sk = (*sock)->sk;
 		sk->sk_data_ready   = rfcomm_l2data_ready;
@@ -471,32 +470,33 @@
 	if (!s)
 		return NULL;
 	memset(s, 0, sizeof(*s));
-	
+
 	BT_DBG("session %p sock %p", s, sock);
 
 	INIT_LIST_HEAD(&s->dlcs);
 	s->state = state;
 	s->sock  = sock;
 
-	s->mtu   = RFCOMM_DEFAULT_MTU;
-	s->cfc   = RFCOMM_CFC_UNKNOWN;
-	
-	list_add(&s->list, &session_list);
+	s->mtu = RFCOMM_DEFAULT_MTU;
+	s->cfc = RFCOMM_CFC_UNKNOWN;
 
-	/* Do not increment module usage count for listeting sessions.
-	 * Otherwise we won't be able to unload the module.
-	 * Non listening session are added either by a socket or a TTYs
-	 * which means that we already hold refcount to this module.
-	 */
+	/* Do not increment module usage count for listening sessions.
+	 * Otherwise we won't be able to unload the module. */
 	if (state != BT_LISTEN)
-		__module_get(THIS_MODULE);
+		if (!try_module_get(THIS_MODULE)) {
+			kfree(s);
+			return NULL;
+		}
+
+	list_add(&s->list, &session_list);
+
 	return s;
 }
 
 void rfcomm_session_del(struct rfcomm_session *s)
 {
 	int state = s->state;
-	
+
 	BT_DBG("session %p state %ld", s, s->state);
 
 	list_del(&s->list);
@@ -1642,9 +1642,9 @@
 
 	BT_DBG("session %p", s);
 
-	if (sock_create_lite(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP, &nsock))
+	if (sock_create_lite(PF_BLUETOOTH, sock->type, BTPROTO_L2CAP, &nsock))
 		return;
-	
+
 	nsock->ops  = sock->ops;
 
 	__module_get(nsock->ops->owner);
diff -Nru a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
--- a/net/bluetooth/rfcomm/sock.c	Tue Jun 15 22:20:42 2004
+++ b/net/bluetooth/rfcomm/sock.c	Tue Jun 15 22:20:42 2004
@@ -398,6 +398,27 @@
 		goto done;
 	}
 
+	if (!rfcomm_pi(sk)->channel) {
+		bdaddr_t *src = &bt_sk(sk)->src;
+		u8 channel;
+
+		err = -EINVAL;
+
+		write_lock_bh(&rfcomm_sk_list.lock);
+
+		for (channel = 1; channel < 31; channel++)
+			if (!__rfcomm_get_sock_by_addr(channel, src)) {
+				rfcomm_pi(sk)->channel = channel;
+				err = 0;
+				break;
+			}
+
+		write_unlock_bh(&rfcomm_sk_list.lock);
+
+		if (err < 0)
+			goto done;
+	}
+
 	sk->sk_max_ack_backlog = backlog;
 	sk->sk_ack_backlog = 0;
 	sk->sk_state = BT_LISTEN;
@@ -637,7 +658,7 @@
 	return copied ? : err;
 }
 
-static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen)
+static int rfcomm_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	int err = 0;
@@ -656,7 +677,7 @@
 	return err;
 }
 
-static int rfcomm_sock_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen)
+static int rfcomm_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	int len, err = 0; 
@@ -686,7 +707,7 @@
 	lock_sock(sk);
 
 #ifdef CONFIG_BT_RFCOMM_TTY
-	err = rfcomm_dev_ioctl(sk, cmd, arg);
+	err = rfcomm_dev_ioctl(sk, cmd, (void __user *)arg);
 #else
 	err = -EOPNOTSUPP;
 #endif
diff -Nru a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
--- a/net/bluetooth/rfcomm/tty.c	Tue Jun 15 22:20:41 2004
+++ b/net/bluetooth/rfcomm/tty.c	Tue Jun 15 22:20:41 2004
@@ -302,13 +302,13 @@
 
 #define NOCAP_FLAGS ((1 << RFCOMM_REUSE_DLC) | (1 << RFCOMM_RELEASE_ONHUP))
 
-static int rfcomm_create_dev(struct sock *sk, unsigned long arg)
+static int rfcomm_create_dev(struct sock *sk, void __user *arg)
 {
 	struct rfcomm_dev_req req;
 	struct rfcomm_dlc *dlc;
 	int id;
 
-	if (copy_from_user(&req, (void *) arg, sizeof(req)))
+	if (copy_from_user(&req, arg, sizeof(req)))
 		return -EFAULT;
 
 	BT_DBG("sk %p dev_id %id flags 0x%x", sk, req.dev_id, req.flags);
@@ -344,12 +344,12 @@
 	return id;
 }
 
-static int rfcomm_release_dev(unsigned long arg)
+static int rfcomm_release_dev(void __user *arg)
 {
 	struct rfcomm_dev_req req;
 	struct rfcomm_dev *dev;
 
-	if (copy_from_user(&req, (void *) arg, sizeof(req)))
+	if (copy_from_user(&req, arg, sizeof(req)))
 		return -EFAULT;
 
 	BT_DBG("dev_id %id flags 0x%x", req.dev_id, req.flags);
@@ -370,7 +370,7 @@
 	return 0;
 }
 
-static int rfcomm_get_dev_list(unsigned long arg)
+static int rfcomm_get_dev_list(void __user *arg)
 {
 	struct rfcomm_dev_list_req *dl;
 	struct rfcomm_dev_info *di;
@@ -380,7 +380,7 @@
 
 	BT_DBG("");
 
-	if (get_user(dev_num, (u16 *) arg))
+	if (get_user(dev_num, (u16 __user *) arg))
 		return -EFAULT;
 
 	if (!dev_num || dev_num > (PAGE_SIZE * 4) / sizeof(*di))
@@ -412,13 +412,13 @@
 	dl->dev_num = n;
 	size = sizeof(*dl) + n * sizeof(*di);
 
-	err = copy_to_user((void *) arg, dl, size);
+	err = copy_to_user(arg, dl, size);
 	kfree(dl);
 
 	return err ? -EFAULT : 0;
 }
 
-static int rfcomm_get_dev_info(unsigned long arg)
+static int rfcomm_get_dev_info(void __user *arg)
 {
 	struct rfcomm_dev *dev;
 	struct rfcomm_dev_info di;
@@ -426,7 +426,7 @@
 
 	BT_DBG("");
 
-	if (copy_from_user(&di, (void *)arg, sizeof(di)))
+	if (copy_from_user(&di, arg, sizeof(di)))
 		return -EFAULT;
 
 	if (!(dev = rfcomm_dev_get(di.id)))
@@ -438,16 +438,16 @@
 	bacpy(&di.src, &dev->src);
 	bacpy(&di.dst, &dev->dst);
 
-	if (copy_to_user((void *)arg, &di, sizeof(di)))
+	if (copy_to_user(arg, &di, sizeof(di)))
 		err = -EFAULT;
 
 	rfcomm_dev_put(dev);
 	return err;
 }
 
-int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg)
+int rfcomm_dev_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
 {
-	BT_DBG("cmd %d arg %ld", cmd, arg);
+	BT_DBG("cmd %d arg %p", cmd, arg);
 
 	switch (cmd) {
 	case RFCOMMCREATEDEV:
diff -Nru a/net/bluetooth/sco.c b/net/bluetooth/sco.c
--- a/net/bluetooth/sco.c	Tue Jun 15 22:20:38 2004
+++ b/net/bluetooth/sco.c	Tue Jun 15 22:20:38 2004
@@ -22,12 +22,7 @@
    SOFTWARE IS DISCLAIMED.
 */
 
-/*
- * Bluetooth SCO sockets.
- *
- * $Id: sco.c,v 1.3 2002/04/17 17:37:16 maxk Exp $
- */
-#define VERSION "0.3"
+/* Bluetooth SCO sockets. */
 
 #include <linux/config.h>
 #include <linux/module.h>
@@ -58,9 +53,11 @@
 
 #ifndef CONFIG_BT_SCO_DEBUG
 #undef  BT_DBG
-#define BT_DBG( A... )
+#define BT_DBG(D...)
 #endif
 
+#define VERSION "0.3"
+
 static struct proto_ops sco_sock_ops;
 
 static struct bt_sock_list sco_sk_list = {
@@ -94,17 +91,13 @@
 static void sco_sock_set_timer(struct sock *sk, long timeout)
 {
 	BT_DBG("sock %p state %d timeout %ld", sk, sk->sk_state, timeout);
-
-	if (!mod_timer(&sk->sk_timer, jiffies + timeout))
-		sock_hold(sk);
+	sk_reset_timer(sk, &sk->sk_timer, jiffies + timeout);
 }
 
 static void sco_sock_clear_timer(struct sock *sk)
 {
 	BT_DBG("sock %p state %d", sk, sk->sk_state);
-
-	if (timer_pending(&sk->sk_timer) && del_timer(&sk->sk_timer))
-		__sock_put(sk);
+	sk_stop_timer(sk, &sk->sk_timer);
 }
 
 static void sco_sock_init_timer(struct sock *sk)
@@ -137,7 +130,7 @@
 
 	conn->src = &hdev->bdaddr;
 	conn->dst = &hcon->dst;
-	
+
 	if (hdev->sco_mtu > 0)
 		conn->mtu = hdev->sco_mtu;
 	else
@@ -483,7 +476,7 @@
 	}
 
 	write_lock_bh(&sco_sk_list.lock);
-	
+
 	if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) {
 		err = -EADDRINUSE;
 	} else {
@@ -491,7 +484,7 @@
 		bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr);
 		sk->sk_state = BT_BOUND;
 	}
-	
+
 	write_unlock_bh(&sco_sk_list.lock);
 
 done:
@@ -655,7 +648,7 @@
 	return err;
 }
 
-static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen)
+static int sco_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	int err = 0;
@@ -674,7 +667,7 @@
 	return err;
 }
 
-static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen)
+static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	struct sco_options opts;
@@ -694,7 +687,7 @@
 			err = -ENOTCONN;
 			break;
 		}
-		
+
 		opts.mtu = sco_pi(sk)->conn->mtu;
 
 		BT_DBG("mtu %d", opts.mtu);
@@ -737,7 +730,7 @@
 
 	if (!sk)
 		return 0;
-	
+
 	sco_sock_close(sk);
 
 	if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime) {
@@ -811,7 +804,7 @@
 		sk = sco_sock_alloc(NULL, BTPROTO_SCO, GFP_ATOMIC);
 		if (!sk) {
 			bh_unlock_sock(parent);
-                	goto done;
+			goto done;
 		}
 
 		sco_sock_init(sk, parent);
@@ -820,14 +813,14 @@
 		bacpy(&bt_sk(sk)->dst, conn->dst);
 
 		hci_conn_hold(conn->hcon);
-        	__sco_chan_add(conn, sk, parent);
+		__sco_chan_add(conn, sk, parent);
 
-        	sk->sk_state = BT_CONNECTED;
+		sk->sk_state = BT_CONNECTED;
 
 		/* Wake up parent */
 		parent->sk_data_ready(parent, 1);
-	
-        	bh_unlock_sock(parent);
+
+		bh_unlock_sock(parent);
 	}
 
 done:
@@ -858,7 +851,7 @@
 			sco_conn_ready(conn);
 	} else 
 		sco_conn_del(hcon, bt_err(status));
-	
+
 	return 0;
 }
 
@@ -931,10 +924,10 @@
 }
 
 static struct seq_operations sco_seq_ops = {
-	.start  = sco_seq_start,
-	.next   = sco_seq_next,
-	.stop   = sco_seq_stop,
-	.show   = sco_seq_show 
+	.start	= sco_seq_start,
+	.next	= sco_seq_next,
+	.stop	= sco_seq_stop,
+	.show	= sco_seq_show 
 };
 
 static int sco_seq_open(struct inode *inode, struct file *file)
@@ -943,74 +936,74 @@
 }
 
 static struct file_operations sco_seq_fops = {
-	.owner	 = THIS_MODULE,
-	.open    = sco_seq_open,
-	.read    = seq_read,
-	.llseek  = seq_lseek,
-	.release = seq_release,
+	.owner		= THIS_MODULE,
+	.open		= sco_seq_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
 };
 
-static int  __init sco_proc_init(void)
+static int __init sco_proc_init(void)
 {
-        struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt);
-        if (!p)
-                return -ENOMEM;
+	struct proc_dir_entry *p = create_proc_entry("sco", S_IRUGO, proc_bt);
+	if (!p)
+		return -ENOMEM;
 	p->owner     = THIS_MODULE;
-        p->proc_fops = &sco_seq_fops;
-        return 0;
+	p->proc_fops = &sco_seq_fops;
+	return 0;
 }
 
 static void __exit sco_proc_cleanup(void)
 {
-        remove_proc_entry("sco", proc_bt);
+	remove_proc_entry("sco", proc_bt);
 }
 
 #else /* CONFIG_PROC_FS */
 
-static int  __init sco_proc_init(void)
+static int __init sco_proc_init(void)
 {
-        return 0;
+	return 0;
 }
 
 static void __exit sco_proc_cleanup(void)
 {
-        return;
+	return;
 }
 #endif /* CONFIG_PROC_FS */
 
 static struct proto_ops sco_sock_ops = {
-	.family  =      PF_BLUETOOTH,
-	.owner   =	THIS_MODULE,
-	.release =      sco_sock_release,
-	.bind    =     	sco_sock_bind,
-	.connect =      sco_sock_connect,
-	.listen  =      sco_sock_listen,
-	.accept  =      sco_sock_accept,
-	.getname =      sco_sock_getname,
-	.sendmsg =      sco_sock_sendmsg,
-	.recvmsg =      bt_sock_recvmsg,
-	.poll    =      bt_sock_poll,
-	.ioctl   =      sock_no_ioctl,
-	.mmap    =      sock_no_mmap,
-	.socketpair =   sock_no_socketpair,
-	.shutdown   =   sock_no_shutdown,
-	.setsockopt =   sco_sock_setsockopt,
-	.getsockopt =   sco_sock_getsockopt
+	.family		= PF_BLUETOOTH,
+	.owner		= THIS_MODULE,
+	.release	= sco_sock_release,
+	.bind		= sco_sock_bind,
+	.connect	= sco_sock_connect,
+	.listen		= sco_sock_listen,
+	.accept		= sco_sock_accept,
+	.getname	= sco_sock_getname,
+	.sendmsg	= sco_sock_sendmsg,
+	.recvmsg	= bt_sock_recvmsg,
+	.poll		= bt_sock_poll,
+	.ioctl		= sock_no_ioctl,
+	.mmap		= sock_no_mmap,
+	.socketpair	= sock_no_socketpair,
+	.shutdown	= sock_no_shutdown,
+	.setsockopt	= sco_sock_setsockopt,
+	.getsockopt	= sco_sock_getsockopt
 };
 
 static struct net_proto_family sco_sock_family_ops = {
-	.family =       PF_BLUETOOTH,
-	.create =       sco_sock_create,
-	.owner	=	THIS_MODULE,
+	.family	= PF_BLUETOOTH,
+	.owner	= THIS_MODULE,
+	.create	= sco_sock_create,
 };
 
 static struct hci_proto sco_hci_proto = {
-	.name =         "SCO",
-	.id   =         HCI_PROTO_SCO,
-	.connect_ind =  sco_connect_ind,
-	.connect_cfm =  sco_connect_cfm,
-	.disconn_ind =  sco_disconn_ind,
-	.recv_scodata =	sco_recv_scodata
+	.name		= "SCO",
+	.id		= HCI_PROTO_SCO,
+	.connect_ind	= sco_connect_ind,
+	.connect_cfm	= sco_connect_cfm,
+	.disconn_ind	= sco_disconn_ind,
+	.recv_scodata	= sco_recv_scodata
 };
 
 static int __init sco_init(void)
@@ -1028,7 +1021,7 @@
 	}
 
 	sco_proc_init();
-	
+
 	BT_INFO("SCO (Voice Link) ver %s", VERSION);
 	BT_INFO("SCO socket layer initialized");
 
diff -Nru a/net/bluetooth/syms.c b/net/bluetooth/syms.c
--- a/net/bluetooth/syms.c	Tue Jun 15 22:20:41 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,84 +0,0 @@
-/* 
-   BlueZ - Bluetooth protocol stack for Linux
-   Copyright (C) 2000-2001 Qualcomm Incorporated
-
-   Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License version 2 as
-   published by the Free Software Foundation;
-
-   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
-   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 
-   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
-   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
-   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
-   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
-   SOFTWARE IS DISCLAIMED.
-*/
-
-/*
- * Bluetooth symbols.
- *
- * $Id: syms.c,v 1.1 2002/03/08 21:06:59 maxk Exp $
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/skbuff.h>
-#include <linux/socket.h>
-
-#include <net/bluetooth/bluetooth.h>
-#include <net/bluetooth/hci_core.h>
-
-/* HCI Core */
-EXPORT_SYMBOL(hci_alloc_dev);
-EXPORT_SYMBOL(hci_free_dev);
-EXPORT_SYMBOL(hci_register_dev);
-EXPORT_SYMBOL(hci_unregister_dev);
-EXPORT_SYMBOL(hci_suspend_dev);
-EXPORT_SYMBOL(hci_resume_dev);
-
-EXPORT_SYMBOL(hci_register_proto);
-EXPORT_SYMBOL(hci_unregister_proto);
-
-EXPORT_SYMBOL(hci_get_route);
-EXPORT_SYMBOL(hci_connect);
-EXPORT_SYMBOL(hci_dev_get);
-EXPORT_SYMBOL(hci_conn_auth);
-EXPORT_SYMBOL(hci_conn_encrypt);
-
-EXPORT_SYMBOL(hci_send_acl);
-EXPORT_SYMBOL(hci_send_sco);
-EXPORT_SYMBOL(hci_send_cmd);
-EXPORT_SYMBOL(hci_si_event);
-
-/* Bluetooth lib */
-EXPORT_SYMBOL(bt_dump);
-EXPORT_SYMBOL(baswap);
-EXPORT_SYMBOL(batostr);
-EXPORT_SYMBOL(bt_err);
-
-/* Bluetooth sockets */
-EXPORT_SYMBOL(bt_sock_register);
-EXPORT_SYMBOL(bt_sock_unregister);
-EXPORT_SYMBOL(bt_sock_alloc);
-EXPORT_SYMBOL(bt_sock_link);
-EXPORT_SYMBOL(bt_sock_unlink);
-EXPORT_SYMBOL(bt_sock_recvmsg);
-EXPORT_SYMBOL(bt_sock_poll);
-EXPORT_SYMBOL(bt_accept_enqueue);
-EXPORT_SYMBOL(bt_accept_dequeue);
-EXPORT_SYMBOL(bt_sock_wait_state);
-
-EXPORT_SYMBOL(proc_bt);
diff -Nru a/net/bridge/Makefile b/net/bridge/Makefile
--- a/net/bridge/Makefile	Tue Jun 15 22:21:03 2004
+++ b/net/bridge/Makefile	Tue Jun 15 22:21:03 2004
@@ -8,6 +8,8 @@
 			br_ioctl.o br_notify.o br_stp.o br_stp_bpdu.o \
 			br_stp_if.o br_stp_timer.o
 
+bridge-$(CONFIG_SYSFS) += br_sysfs_if.o br_sysfs_br.o
+
 bridge-$(CONFIG_BRIDGE_NETFILTER) += br_netfilter.o
 
 obj-$(CONFIG_BRIDGE_NF_EBTABLES) += netfilter/
diff -Nru a/net/bridge/br.c b/net/bridge/br.c
--- a/net/bridge/br.c	Tue Jun 15 22:20:37 2004
+++ b/net/bridge/br.c	Tue Jun 15 22:20:37 2004
@@ -33,6 +33,8 @@
 {
 	br_fdb_init();
 
+	br_sysfs_init();
+
 #ifdef CONFIG_BRIDGE_NETFILTER
 	if (br_netfilter_init())
 		return 1;
@@ -67,6 +69,7 @@
 #endif
 
 	br_handle_frame_hook = NULL;
+	br_sysfs_fini();
 	br_fdb_fini();
 }
 
diff -Nru a/net/bridge/br_device.c b/net/bridge/br_device.c
--- a/net/bridge/br_device.c	Tue Jun 15 22:20:35 2004
+++ b/net/bridge/br_device.c	Tue Jun 15 22:20:35 2004
@@ -19,21 +19,6 @@
 #include <asm/uaccess.h>
 #include "br_private.h"
 
-static int br_dev_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-	unsigned long args[4];
-	unsigned long *data;
-
-	if (cmd != SIOCDEVPRIVATE)
-		return -EOPNOTSUPP;
-
-	data = (unsigned long *)rq->ifr_data;
-	if (copy_from_user(args, data, 4*sizeof(unsigned long)))
-		return -EFAULT;
-
-	return br_ioctl_device(dev->priv, args[0], args[1], args[2], args[3]);
-}
-
 static struct net_device_stats *br_dev_get_stats(struct net_device *dev)
 {
 	struct net_bridge *br;
@@ -115,7 +100,7 @@
 
 	ether_setup(dev);
 
-	dev->do_ioctl = br_dev_do_ioctl;
+	dev->do_ioctl = br_dev_ioctl;
 	dev->get_stats = br_dev_get_stats;
 	dev->hard_start_xmit = br_dev_xmit;
 	dev->open = br_dev_open;
diff -Nru a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
--- a/net/bridge/br_fdb.c	Tue Jun 15 22:20:36 2004
+++ b/net/bridge/br_fdb.c	Tue Jun 15 22:20:36 2004
@@ -16,14 +16,15 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
-#include <linux/if_bridge.h>
 #include <linux/times.h>
+#include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <asm/atomic.h>
-#include <asm/uaccess.h>
 #include "br_private.h"
 
 static kmem_cache_t *br_fdb_cache;
+static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
+		      const unsigned char *addr, int is_local);
 
 void __init br_fdb_init(void)
 {
@@ -54,17 +55,6 @@
 		&& time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
 }
 
-static inline void copy_fdb(struct __fdb_entry *ent, 
-				const struct net_bridge_fdb_entry *f)
-{
-	memset(ent, 0, sizeof(struct __fdb_entry));
-	memcpy(ent->mac_addr, f->addr.addr, ETH_ALEN);
-	ent->port_no = f->dst?f->dst->port_no:0;
-	ent->is_local = f->is_local;
-	ent->ageing_timer_value = f->is_static ? 0 
-		: jiffies_to_clock_t(jiffies - f->ageing_timer);
-}
-
 static __inline__ int br_mac_hash(const unsigned char *mac)
 {
 	unsigned long x;
@@ -84,37 +74,49 @@
 static __inline__ void fdb_delete(struct net_bridge_fdb_entry *f)
 {
 	hlist_del(&f->hlist);
-	list_del(&f->age_list);
+	if (!f->is_static)
+		list_del(&f->age_list);
+
 	br_fdb_put(f);
 }
 
 void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
 {
-	struct net_bridge *br;
+	struct net_bridge *br = p->br;
 	int i;
-	int newhash = br_mac_hash(newaddr);
-
-	br = p->br;
+	
 	write_lock_bh(&br->hash_lock);
-	for (i=0;i<BR_HASH_SIZE;i++) {
+
+	/* Search all chains since old address/hash is unknown */
+	for (i = 0; i < BR_HASH_SIZE; i++) {
 		struct hlist_node *h;
-		
 		hlist_for_each(h, &br->hash[i]) {
-			struct net_bridge_fdb_entry *f
-				= hlist_entry(h, struct net_bridge_fdb_entry, hlist);
+			struct net_bridge_fdb_entry *f;
 
+			f = hlist_entry(h, struct net_bridge_fdb_entry, hlist);
 			if (f->dst == p && f->is_local) {
-				memcpy(f->addr.addr, newaddr, ETH_ALEN);
-				if (newhash != i) {
-					hlist_del(&f->hlist);
-					hlist_add_head(&f->hlist,
-						       &br->hash[newhash]);
+				/* maybe another port has same hw addr? */
+				struct net_bridge_port *op;
+				list_for_each_entry(op, &br->port_list, list) {
+					if (op != p && 
+					    !memcmp(op->dev->dev_addr,
+						    f->addr.addr, ETH_ALEN)) {
+						f->dst = op;
+						goto insert;
+					}
 				}
-				goto out;
+
+				/* delete old one */
+				fdb_delete(f);
+				goto insert;
 			}
 		}
 	}
- out:
+ insert:
+	/* insert new address,  may fail if invalid address or dup. */
+	fdb_insert(br, p, newaddr, 1);
+
+
 	write_unlock_bh(&br->hash_lock);
 }
 
@@ -133,11 +135,10 @@
 		unsigned long expires = f->ageing_timer + delay;
 
 		if (time_before_eq(expires, jiffies)) {
-			if (!f->is_static) {
-				pr_debug("expire age %lu jiffies %lu\n",
-					 f->ageing_timer, jiffies);
-				fdb_delete(f);
-			}
+			WARN_ON(f->is_static);
+			pr_debug("expire age %lu jiffies %lu\n",
+				 f->ageing_timer, jiffies);
+			fdb_delete(f);
 		} else {
 			mod_timer(&br->gc_timer, expires);
 			break;
@@ -151,15 +152,34 @@
 	int i;
 
 	write_lock_bh(&br->hash_lock);
-	for (i=0;i<BR_HASH_SIZE;i++) {
+	for (i = 0; i < BR_HASH_SIZE; i++) {
 		struct hlist_node *h, *g;
 		
 		hlist_for_each_safe(h, g, &br->hash[i]) {
 			struct net_bridge_fdb_entry *f
 				= hlist_entry(h, struct net_bridge_fdb_entry, hlist);
-			if (f->dst == p) {
-				fdb_delete(f);
+			if (f->dst != p) 
+				continue;
+
+			/*
+			 * if multiple ports all have the same device address
+			 * then when one port is deleted, assign
+			 * the local entry to other port
+			 */
+			if (f->is_local) {
+				struct net_bridge_port *op;
+				list_for_each_entry(op, &br->port_list, list) {
+					if (op != p && 
+					    !memcmp(op->dev->dev_addr,
+						    f->addr.addr, ETH_ALEN)) {
+						f->dst = op;
+						goto skip_delete;
+					}
+				}
 			}
+
+			fdb_delete(f);
+		skip_delete: ;
 		}
 	}
 	write_unlock_bh(&br->hash_lock);
@@ -195,115 +215,97 @@
 		kmem_cache_free(br_fdb_cache, ent);
 }
 
-int br_fdb_get_entries(struct net_bridge *br,
-		       unsigned char *_buf,
-		       int maxnum,
-		       int offset)
+/*
+ * Fill buffer with forwarding table records in 
+ * the API format.
+ */
+int br_fdb_fillbuf(struct net_bridge *br, void *buf,
+		   unsigned long maxnum, unsigned long skip)
 {
-	int i;
-	int num;
-	struct __fdb_entry *walk;
+	struct __fdb_entry *fe = buf;
+	int i, num = 0;
+	struct hlist_node *h;
+	struct net_bridge_fdb_entry *f;
 
-	num = 0;
-	walk = (struct __fdb_entry *)_buf;
+	memset(buf, 0, maxnum*sizeof(struct __fdb_entry));
 
 	read_lock_bh(&br->hash_lock);
-	for (i=0;i<BR_HASH_SIZE;i++) {
-		struct hlist_node *h;
-		
-		hlist_for_each(h, &br->hash[i]) {
-			struct net_bridge_fdb_entry *f
-				= hlist_entry(h, struct net_bridge_fdb_entry, hlist);
-			struct __fdb_entry ent;
-
+	for (i = 0; i < BR_HASH_SIZE; i++) {
+		hlist_for_each_entry(f, h, &br->hash[i], hlist) {
 			if (num >= maxnum)
 				goto out;
 
 			if (has_expired(br, f)) 
 				continue;
 
-			if (offset) {
-				offset--;
+			if (skip) {
+				--skip;
 				continue;
 			}
 
-			copy_fdb(&ent, f);
-
-			atomic_inc(&f->use_count);
-			read_unlock_bh(&br->hash_lock);
-			
-			if (copy_to_user(walk, &ent, sizeof(struct __fdb_entry)))
-				return -EFAULT;
-
-			read_lock_bh(&br->hash_lock);
-			
-			/* entry was deleted during copy_to_user */
-			if (atomic_dec_and_test(&f->use_count)) {
-				kmem_cache_free(br_fdb_cache, f);
-				num = -EAGAIN;
-				goto out;
-			}
-
-			/* entry changed address hash while copying */
-			if (br_mac_hash(f->addr.addr) != i) {
-				num = -EAGAIN;
-				goto out;
-			}
-
-			num++;
-			walk++;
+			/* convert from internal format to API */
+			memcpy(fe->mac_addr, f->addr.addr, ETH_ALEN);
+			fe->port_no = f->dst->port_no;
+			fe->is_local = f->is_local;
+			if (!f->is_static)
+				fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->ageing_timer);
+			++fe;
+			++num;
 		}
 	}
 
  out:
 	read_unlock_bh(&br->hash_lock);
+
 	return num;
 }
 
-int br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
+static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
 		  const unsigned char *addr, int is_local)
 {
 	struct hlist_node *h;
 	struct net_bridge_fdb_entry *fdb;
 	int hash = br_mac_hash(addr);
-	int ret = 0;
 
 	if (!is_valid_ether_addr(addr))
 		return -EADDRNOTAVAIL;
 
-	write_lock_bh(&br->hash_lock);
-	hlist_for_each(h, &br->hash[hash]) {
-		fdb = hlist_entry(h, struct net_bridge_fdb_entry, hlist);
+	hlist_for_each_entry(fdb, h, &br->hash[hash], hlist) {
 		if (!memcmp(fdb->addr.addr, addr, ETH_ALEN)) {
 			/* attempt to update an entry for a local interface */
-			if (unlikely(fdb->is_local)) {
+			if (fdb->is_local) {
+				/* it is okay to have multiple ports with same 
+				 * address, just don't allow to be spoofed.
+				 */
 				if (is_local) 
-					printk(KERN_INFO "%s: attempt to add"
-					       " interface with same source address.\n",
-					       source->dev->name);
-				else if (net_ratelimit()) 
+					return 0;
+
+				if (net_ratelimit()) 
 					printk(KERN_WARNING "%s: received packet with "
 					       " own address as source address\n",
 					       source->dev->name);
-				ret = -EEXIST;
-				goto out;
+				return -EEXIST;
 			}
 
-
-			if (likely(!fdb->is_static || is_local)) {
-				/* move to end of age list */
-				list_del(&fdb->age_list);
+			if (is_local) {
+				printk(KERN_WARNING "%s adding interface with same address "
+				       "as a received packet\n",
+				       source->dev->name);
 				goto update;
 			}
-			goto out;
+
+			if (fdb->is_static)
+				return 0;
+
+			/* move to end of age list */
+			list_del(&fdb->age_list);
+			goto update;
 		}
 	}
 
 	fdb = kmem_cache_alloc(br_fdb_cache, GFP_ATOMIC);
-	if (unlikely(fdb == NULL)) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!fdb)
+		return ENOMEM;
 
 	memcpy(fdb->addr.addr, addr, ETH_ALEN);
 	atomic_set(&fdb->use_count, 1);
@@ -319,9 +321,19 @@
 	fdb->is_local = is_local;
 	fdb->is_static = is_local;
 	fdb->ageing_timer = jiffies;
-	list_add_tail(&fdb->age_list, &br->age_list);
- out:
-	write_unlock_bh(&br->hash_lock);
+	if (!is_local) 
+		list_add_tail(&fdb->age_list, &br->age_list);
+
+	return 0;
+}
 
+int br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
+		  const unsigned char *addr, int is_local)
+{
+	int ret;
+
+	write_lock_bh(&br->hash_lock);
+	ret = fdb_insert(br, source, addr, is_local);
+	write_unlock_bh(&br->hash_lock);
 	return ret;
 }
diff -Nru a/net/bridge/br_if.c b/net/bridge/br_if.c
--- a/net/bridge/br_if.c	Tue Jun 15 22:21:04 2004
+++ b/net/bridge/br_if.c	Tue Jun 15 22:21:04 2004
@@ -78,53 +78,56 @@
 static void destroy_nbp(void *arg)
 {
 	struct net_bridge_port *p = arg;
+	struct net_device *dev = p->dev;
 
-	p->dev->br_port = NULL;
-
-	BUG_ON(timer_pending(&p->message_age_timer));
-	BUG_ON(timer_pending(&p->forward_delay_timer));
-	BUG_ON(timer_pending(&p->hold_timer));
+	dev->br_port = NULL;
+	p->br = NULL;
+	p->dev = NULL;
+	dev_put(dev);
 
-	dev_put(p->dev);
-	kfree(p);
+	br_sysfs_freeif(p);
 }
 
-/* called under bridge lock */
+/* called with RTNL */
 static void del_nbp(struct net_bridge_port *p)
 {
+	struct net_bridge *br = p->br;
 	struct net_device *dev = p->dev;
 
+	dev_set_promiscuity(dev, -1);
+
+	spin_lock_bh(&br->lock);
 	br_stp_disable_port(p);
+	spin_unlock_bh(&br->lock);
 
-	dev_set_promiscuity(dev, -1);
+	br_fdb_delete_by_port(br, p);
 
 	list_del_rcu(&p->list);
 
-	br_fdb_delete_by_port(p->br, p);
-
-	del_timer(&p->message_age_timer);
-	del_timer(&p->forward_delay_timer);
-	del_timer(&p->hold_timer);
+	del_timer_sync(&p->message_age_timer);
+	del_timer_sync(&p->forward_delay_timer);
+	del_timer_sync(&p->hold_timer);
 	
 	call_rcu(&p->rcu, destroy_nbp, p);
 }
 
+/* called with RTNL */
 static void del_br(struct net_bridge *br)
 {
-	struct list_head *p, *n;
+	struct net_bridge_port *p, *n;
 
-	spin_lock_bh(&br->lock);
-	list_for_each_safe(p, n, &br->port_list) {
-		del_nbp(list_entry(p, struct net_bridge_port, list));
+	list_for_each_entry_safe(p, n, &br->port_list, list) {
+		br_sysfs_removeif(p);
+		del_nbp(p);
 	}
-	spin_unlock_bh(&br->lock);
 
 	del_timer_sync(&br->gc_timer);
 
+	br_sysfs_delbr(br->dev);
  	unregister_netdevice(br->dev);
 }
 
-static struct net_bridge *new_nb(const char *name)
+static struct net_device *new_bridge_dev(const char *name)
 {
 	struct net_bridge *br;
 	struct net_device *dev;
@@ -135,7 +138,7 @@
 	if (!dev)
 		return NULL;
 
-	br = dev->priv;
+	br = netdev_priv(dev);
 	br->dev = dev;
 
 	br->lock = SPIN_LOCK_UNLOCKED;
@@ -160,7 +163,7 @@
 
 	br_stp_timer_init(br);
 
-	return br;
+	return dev;
 }
 
 /* find an available port number */
@@ -171,7 +174,7 @@
 	unsigned long *inuse;
 
 	inuse = kmalloc(BITS_TO_LONGS(BR_MAX_PORTS)*sizeof(unsigned long),
-			GFP_ATOMIC);
+			GFP_KERNEL);
 	if (!inuse)
 		return -ENOMEM;
 
@@ -186,7 +189,7 @@
 	return (index >= BR_MAX_PORTS) ? -EXFULL : index;
 }
 
-/* called under bridge lock */
+/* called with RTNL */
 static struct net_bridge_port *new_nbp(struct net_bridge *br, 
 				       struct net_device *dev,
 				       unsigned long cost)
@@ -198,7 +201,7 @@
 	if (index < 0)
 		return ERR_PTR(index);
 
-	p = kmalloc(sizeof(*p), GFP_ATOMIC);
+	p = kmalloc(sizeof(*p), GFP_KERNEL);
 	if (p == NULL)
 		return ERR_PTR(-ENOMEM);
 
@@ -212,22 +215,51 @@
 	p->port_no = index;
 	br_init_port(p);
 	p->state = BR_STATE_DISABLED;
+	kobject_init(&p->kobj);
 
 	return p;
 }
 
 int br_add_bridge(const char *name)
 {
-	struct net_bridge *br;
+	struct net_device *dev;
 	int ret;
 
-	if ((br = new_nb(name)) == NULL) 
+	dev = new_bridge_dev(name);
+	if (!dev) 
 		return -ENOMEM;
 
-	ret = register_netdev(br->dev);
+	rtnl_lock();
+	if (strchr(dev->name, '%')) {
+		ret = dev_alloc_name(dev, dev->name);
+		if (ret < 0)
+			goto err1;
+	}
+
+	ret = register_netdevice(dev);
 	if (ret)
-		free_netdev(br->dev);
+		goto err2;
+
+	/* network device kobject is not setup until
+	 * after rtnl_unlock does it's hotplug magic.
+	 * so hold reference to avoid race.
+	 */
+	dev_hold(dev);
+	rtnl_unlock();
+
+	ret = br_sysfs_addbr(dev);
+	dev_put(dev);
+
+	if (ret) 
+		unregister_netdev(dev);
+ out:
 	return ret;
+
+ err2:
+	free_netdev(dev);
+ err1:
+	rtnl_unlock();
+	goto out;
 }
 
 int br_del_bridge(const char *name)
@@ -251,16 +283,16 @@
 	} 
 
 	else 
-		del_br(dev->priv);
+		del_br(netdev_priv(dev));
 
 	rtnl_unlock();
 	return ret;
 }
 
+/* called with RTNL */
 int br_add_if(struct net_bridge *br, struct net_device *dev)
 {
 	struct net_bridge_port *p;
-	unsigned long cost;
 	int err = 0;
 
 	if (dev->flags & IFF_LOOPBACK || dev->type != ARPHRD_ETHER)
@@ -269,77 +301,49 @@
 	if (dev->hard_start_xmit == br_dev_xmit)
 		return -ELOOP;
 
-	cost = br_initial_port_cost(dev);
-
-	spin_lock_bh(&br->lock);
 	if (dev->br_port != NULL)
-		err = -EBUSY;
+		return -EBUSY;
 
-	else if (IS_ERR(p = new_nbp(br, dev, cost)))
-		err = PTR_ERR(p);
+	if (IS_ERR(p = new_nbp(br, dev, br_initial_port_cost(dev))))
+		return PTR_ERR(p);
 
- 	else if ((err = br_fdb_insert(br, p, dev->dev_addr, 1)))
- 		 destroy_nbp(p);
+ 	if ((err = br_fdb_insert(br, p, dev->dev_addr, 1)))
+		destroy_nbp(p);
  
+	else if ((err = br_sysfs_addif(p)))
+		del_nbp(p);
 	else {
 		dev_set_promiscuity(dev, 1);
 
 		list_add_rcu(&p->list, &br->port_list);
 
+		spin_lock_bh(&br->lock);
 		br_stp_recalculate_bridge_id(br);
 		if ((br->dev->flags & IFF_UP) && (dev->flags & IFF_UP))
 			br_stp_enable_port(p);
-
+		spin_unlock_bh(&br->lock);
 	}
-	spin_unlock_bh(&br->lock);
+
 	return err;
 }
 
+/* called with RTNL */
 int br_del_if(struct net_bridge *br, struct net_device *dev)
 {
-	struct net_bridge_port *p;
-	int err = 0;
-
-	spin_lock_bh(&br->lock);
-	p = dev->br_port;
+	struct net_bridge_port *p = dev->br_port;
+	
 	if (!p || p->br != br) 
-		err = -EINVAL;
-	else {
-		del_nbp(p);
-		br_stp_recalculate_bridge_id(br);
-	}
-	spin_unlock_bh(&br->lock);
-
-	return err;
-}
-
-int br_get_bridge_ifindices(int *indices, int num)
-{
-	struct net_device *dev;
-	int i = 0;
-
-	read_lock(&dev_base_lock);
-	for (dev = dev_base; dev && i < num; dev = dev->next) {
-		if (dev->priv_flags & IFF_EBRIDGE) 
-			indices[i++] = dev->ifindex;
-	}
-	read_unlock(&dev_base_lock);
+		return -EINVAL;
 
-	return i;
-}
+	br_sysfs_removeif(p);
+	del_nbp(p);
 
-void br_get_port_ifindices(struct net_bridge *br, int *ifindices, int num)
-{
-	struct net_bridge_port *p;
+	spin_lock_bh(&br->lock);
+	br_stp_recalculate_bridge_id(br);
+	spin_unlock_bh(&br->lock);
 
-	rcu_read_lock();
-	list_for_each_entry_rcu(p, &br->port_list, list) {
-		if (p->port_no < num)
-			ifindices[p->port_no] = p->dev->ifindex;
-	}
-	rcu_read_unlock();
+	return 0;
 }
-
 
 void __exit br_cleanup_bridges(void)
 {
diff -Nru a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
--- a/net/bridge/br_ioctl.c	Tue Jun 15 22:20:37 2004
+++ b/net/bridge/br_ioctl.c	Tue Jun 15 22:20:37 2004
@@ -20,42 +20,102 @@
 #include <asm/uaccess.h>
 #include "br_private.h"
 
-/* Report time remaining in user HZ  */
-static unsigned long timer_residue(const struct timer_list *timer)
+/* called with RTNL */
+static int get_bridge_ifindices(int *indices, int num)
 {
-	return timer_pending(timer) 
-		? jiffies_to_clock_t(timer->expires - jiffies) : 0;
+	struct net_device *dev;
+	int i = 0;
+
+	for (dev = dev_base; dev && i < num; dev = dev->next) {
+		if (dev->priv_flags & IFF_EBRIDGE) 
+			indices[i++] = dev->ifindex;
+	}
+
+	return i;
 }
 
-int br_ioctl_device(struct net_bridge *br, unsigned int cmd,
-		   unsigned long arg0, unsigned long arg1, unsigned long arg2)
+/* called with RTNL */
+static void get_port_ifindices(struct net_bridge *br, int *ifindices, int num)
 {
-	if (br == NULL)
-		return -EINVAL;
+	struct net_bridge_port *p;
 
-	switch (cmd)
-	{
-	case BRCTL_ADD_IF:
-	case BRCTL_DEL_IF:
-	{
-		struct net_device *dev;
-		int ret;
+	list_for_each_entry(p, &br->port_list, list) {
+		if (p->port_no < num)
+			ifindices[p->port_no] = p->dev->ifindex;
+	}
+}
 
-		if (!capable(CAP_NET_ADMIN))
-			return -EPERM;
+/*
+ * Format up to a page worth of forwarding table entries
+ * userbuf -- where to copy result
+ * maxnum  -- maximum number of entries desired
+ *            (limited to a page for sanity)
+ * offset  -- number of records to skip
+ */
+static int get_fdb_entries(struct net_bridge *br, void __user *userbuf, 
+			   unsigned long maxnum, unsigned long offset)
+{
+	int num;
+	void *buf;
+	size_t size = maxnum * sizeof(struct __fdb_entry);
+
+	if (size > PAGE_SIZE) {
+		size = PAGE_SIZE;
+		maxnum = PAGE_SIZE/sizeof(struct __fdb_entry);
+	}
 
-		dev = dev_get_by_index(arg0);
-		if (dev == NULL)
-			return -EINVAL;
+	buf = kmalloc(size, GFP_USER);
+	if (!buf)
+		return -ENOMEM;
+	
+	num = br_fdb_fillbuf(br, buf, maxnum, offset);
+	if (num > 0) {
+		if (copy_to_user(userbuf, buf, num*sizeof(struct __fdb_entry)))
+			num = -EFAULT;
+	}
+	kfree(buf);
 
-		if (cmd == BRCTL_ADD_IF)
-			ret = br_add_if(br, dev);
-		else
-			ret = br_del_if(br, dev);
+	return num;
+}
 
-		dev_put(dev);
-		return ret;
-	}
+static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
+{
+	struct net_device *dev;
+	int ret;
+
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
+
+	dev = dev_get_by_index(ifindex);
+	if (dev == NULL)
+		return -EINVAL;
+	
+	if (isadd)
+		ret = br_add_if(br, dev);
+	else
+		ret = br_del_if(br, dev);
+
+	dev_put(dev);
+	return ret;
+}
+
+/*
+ * Legacy ioctl's through SIOCDEVPRIVATE
+ * This interface is deprecated because it was too difficult to
+ * to do the translation for 32/64bit ioctl compatability.
+ */
+static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+	struct net_bridge *br = netdev_priv(dev);
+	unsigned long args[4];
+	
+	if (copy_from_user(args, rq->ifr_data, sizeof(args)))
+		return -EFAULT;
+
+	switch (args[0]) {
+	case BRCTL_ADD_IF:
+	case BRCTL_DEL_IF:
+		return add_del_if(br, args[1], args[0] == BRCTL_ADD_IF);
 
 	case BRCTL_GET_BRIDGE_INFO:
 	{
@@ -77,13 +137,13 @@
 		b.root_port = br->root_port;
 		b.stp_enabled = br->stp_enabled;
 		b.ageing_time = jiffies_to_clock_t(br->ageing_time);
-		b.hello_timer_value = timer_residue(&br->hello_timer);
-		b.tcn_timer_value = timer_residue(&br->tcn_timer);
-		b.topology_change_timer_value = timer_residue(&br->topology_change_timer);
-		b.gc_timer_value = timer_residue(&br->gc_timer);
+		b.hello_timer_value = br_timer_value(&br->hello_timer);
+		b.tcn_timer_value = br_timer_value(&br->tcn_timer);
+		b.topology_change_timer_value = br_timer_value(&br->topology_change_timer);
+		b.gc_timer_value = br_timer_value(&br->gc_timer);
 	        rcu_read_unlock();
 
-		if (copy_to_user((void *)arg0, &b, sizeof(b)))
+		if (copy_to_user((void __user *)args[1], &b, sizeof(b)))
 			return -EFAULT;
 
 		return 0;
@@ -93,7 +153,7 @@
 	{
 		int num, *indices;
 
-		num = arg1;
+		num = args[2];
 		if (num < 0)
 			return -EINVAL;
 		if (num == 0)
@@ -107,8 +167,8 @@
 
 		memset(indices, 0, num*sizeof(int));
 
-		br_get_port_ifindices(br, indices, num);
-		if (copy_to_user((void *)arg0, indices, num*sizeof(int)))
+		get_port_ifindices(br, indices, num);
+		if (copy_to_user((void __user *)args[1], indices, num*sizeof(int)))
 			num =  -EFAULT;
 		kfree(indices);
 		return num;
@@ -119,7 +179,7 @@
 			return -EPERM;
 
 		spin_lock_bh(&br->lock);
-		br->bridge_forward_delay = clock_t_to_jiffies(arg0);
+		br->bridge_forward_delay = clock_t_to_jiffies(args[1]);
 		if (br_is_root_bridge(br))
 			br->forward_delay = br->bridge_forward_delay;
 		spin_unlock_bh(&br->lock);
@@ -130,7 +190,7 @@
 			return -EPERM;
 
 		spin_lock_bh(&br->lock);
-		br->bridge_hello_time = clock_t_to_jiffies(arg0);
+		br->bridge_hello_time = clock_t_to_jiffies(args[1]);
 		if (br_is_root_bridge(br))
 			br->hello_time = br->bridge_hello_time;
 		spin_unlock_bh(&br->lock);
@@ -141,7 +201,7 @@
 			return -EPERM;
 
 		spin_lock_bh(&br->lock);
-		br->bridge_max_age = clock_t_to_jiffies(arg0);
+		br->bridge_max_age = clock_t_to_jiffies(args[1]);
 		if (br_is_root_bridge(br))
 			br->max_age = br->bridge_max_age;
 		spin_unlock_bh(&br->lock);
@@ -151,7 +211,7 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
 
-		br->ageing_time = clock_t_to_jiffies(arg0);
+		br->ageing_time = clock_t_to_jiffies(args[1]);
 		return 0;
 
 	case BRCTL_GET_PORT_INFO:
@@ -160,7 +220,7 @@
 		struct net_bridge_port *pt;
 
 		rcu_read_lock();
-		if ((pt = br_get_port(br, arg1)) == NULL) {
+		if ((pt = br_get_port(br, args[2])) == NULL) {
 			rcu_read_unlock();
 			return -EINVAL;
 		}
@@ -175,13 +235,13 @@
 		p.state = pt->state;
 		p.top_change_ack = pt->topology_change_ack;
 		p.config_pending = pt->config_pending;
-		p.message_age_timer_value = timer_residue(&pt->message_age_timer);
-		p.forward_delay_timer_value = timer_residue(&pt->forward_delay_timer);
-		p.hold_timer_value = timer_residue(&pt->hold_timer);
+		p.message_age_timer_value = br_timer_value(&pt->message_age_timer);
+		p.forward_delay_timer_value = br_timer_value(&pt->forward_delay_timer);
+		p.hold_timer_value = br_timer_value(&pt->hold_timer);
 
 		rcu_read_unlock();
 
-		if (copy_to_user((void *)arg0, &p, sizeof(p)))
+		if (copy_to_user((void __user *)args[1], &p, sizeof(p)))
 			return -EFAULT;
 
 		return 0;
@@ -191,7 +251,7 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
 
-		br->stp_enabled = arg0?1:0;
+		br->stp_enabled = args[1]?1:0;
 		return 0;
 
 	case BRCTL_SET_BRIDGE_PRIORITY:
@@ -199,7 +259,7 @@
 			return -EPERM;
 
 		spin_lock_bh(&br->lock);
-		br_stp_set_bridge_priority(br, arg0);
+		br_stp_set_bridge_priority(br, args[1]);
 		spin_unlock_bh(&br->lock);
 		return 0;
 
@@ -211,14 +271,14 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
 
-		if (arg1 >= (1<<(16-BR_PORT_BITS)))
+		if (args[2] >= (1<<(16-BR_PORT_BITS)))
 			return -ERANGE;
 
 		spin_lock_bh(&br->lock);
-		if ((p = br_get_port(br, arg0)) == NULL) 
+		if ((p = br_get_port(br, args[1])) == NULL) 
 			ret = -EINVAL;
 		else
-			br_stp_set_port_priority(p, arg1);
+			br_stp_set_port_priority(p, args[2]);
 		spin_unlock_bh(&br->lock);
 		return ret;
 	}
@@ -232,27 +292,30 @@
 			return -EPERM;
 
 		spin_lock_bh(&br->lock);
-		if ((p = br_get_port(br, arg0)) == NULL)
+		if ((p = br_get_port(br, args[1])) == NULL)
 			ret = -EINVAL;
 		else
-			br_stp_set_path_cost(p, arg1);
+			br_stp_set_path_cost(p, args[2]);
 		spin_unlock_bh(&br->lock);
 		return ret;
 	}
 
 	case BRCTL_GET_FDB_ENTRIES:
-		return br_fdb_get_entries(br, (void *)arg0, arg1, arg2);
+		return get_fdb_entries(br, (void __user *)args[1], 
+				       args[2], args[3]);
 	}
 
 	return -EOPNOTSUPP;
 }
 
-static int br_ioctl_deviceless(unsigned int cmd,
-			       unsigned long arg0,
-			       unsigned long arg1)
+static int old_deviceless(void __user *uarg)
 {
-	switch (cmd)
-	{
+	unsigned long args[3];
+
+	if (copy_from_user(args, uarg, sizeof(args)))
+		return -EFAULT;
+
+	switch (args[0]) {
 	case BRCTL_GET_VERSION:
 		return BRCTL_VERSION;
 
@@ -261,15 +324,15 @@
 		int *indices;
 		int ret = 0;
 
-		indices = kmalloc(arg1*sizeof(int), GFP_KERNEL);
+		indices = kmalloc(args[2]*sizeof(int), GFP_KERNEL);
 		if (indices == NULL)
 			return -ENOMEM;
 
-		memset(indices, 0, arg1*sizeof(int));
-		arg1 = br_get_bridge_ifindices(indices, arg1);
+		memset(indices, 0, args[2]*sizeof(int));
+		args[2] = get_bridge_ifindices(indices, args[2]);
 
-		ret = copy_to_user((void *)arg0, indices, arg1*sizeof(int))
-			? -EFAULT : arg1;
+		ret = copy_to_user((void __user *)args[1], indices, args[2]*sizeof(int))
+			? -EFAULT : args[2];
 
 		kfree(indices);
 		return ret;
@@ -283,12 +346,12 @@
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
 
-		if (copy_from_user(buf, (void *)arg0, IFNAMSIZ))
+		if (copy_from_user(buf, (void __user *)args[1], IFNAMSIZ))
 			return -EFAULT;
 
 		buf[IFNAMSIZ-1] = 0;
 
-		if (cmd == BRCTL_ADD_BRIDGE)
+		if (args[0] == BRCTL_ADD_BRIDGE)
 			return br_add_bridge(buf);
 
 		return br_del_bridge(buf);
@@ -298,13 +361,48 @@
 	return -EOPNOTSUPP;
 }
 
+int br_ioctl_deviceless_stub(unsigned int cmd, void __user *uarg)
+{
+	switch (cmd) {
+	case SIOCGIFBR:
+	case SIOCSIFBR:
+		return old_deviceless(uarg);
+		
+	case SIOCBRADDBR:
+	case SIOCBRDELBR:
+	{
+		char buf[IFNAMSIZ];
+
+		if (!capable(CAP_NET_ADMIN))
+			return -EPERM;
+
+		if (copy_from_user(buf, uarg, IFNAMSIZ))
+			return -EFAULT;
+
+		buf[IFNAMSIZ-1] = 0;
+		if (cmd == SIOCBRADDBR)
+			return br_add_bridge(buf);
+
+		return br_del_bridge(buf);
+	}
+	}
+	return -EOPNOTSUPP;
+}
 
-int br_ioctl_deviceless_stub(unsigned long arg)
+int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
-	unsigned long i[3];
+	struct net_bridge *br = netdev_priv(dev);
 
-	if (copy_from_user(i, (void *)arg, 3*sizeof(unsigned long)))
-		return -EFAULT;
+	switch(cmd) {
+	case SIOCDEVPRIVATE:
+		return old_dev_ioctl(dev, rq, cmd);
+
+	case SIOCBRADDIF:
+	case SIOCBRDELIF:
+		return add_del_if(br, rq->ifr_ifindex, cmd == SIOCBRADDIF);
 
-	return br_ioctl_deviceless(i[0], i[1], i[2]);
+	}
+
+	printk(KERN_DEBUG "Bridge does not support ioctl 0x%x\n", cmd);
+	return -EOPNOTSUPP;
 }
diff -Nru a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
--- a/net/bridge/br_netfilter.c	Tue Jun 15 22:21:03 2004
+++ b/net/bridge/br_netfilter.c	Tue Jun 15 22:21:03 2004
@@ -165,7 +165,7 @@
 		skb_pull(skb, VLAN_HLEN);
 		skb->nh.raw += VLAN_HLEN;
 	}
-	skb->dst->output(skb);
+	skb->dst->output(&skb);
 	return 0;
 }
 
@@ -800,7 +800,7 @@
 #ifdef CONFIG_SYSCTL
 static
 int brnf_sysctl_call_tables(ctl_table *ctl, int write, struct file * filp,
-			void *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp)
 {
 	int ret;
 
diff -Nru a/net/bridge/br_notify.c b/net/bridge/br_notify.c
--- a/net/bridge/br_notify.c	Tue Jun 15 22:20:36 2004
+++ b/net/bridge/br_notify.c	Tue Jun 15 22:20:36 2004
@@ -38,30 +38,35 @@
 
 	br = p->br;
 
-	spin_lock_bh(&br->lock);
-	switch (event) 
-	{
+	switch (event) {
 	case NETDEV_CHANGEADDR:
+		spin_lock_bh(&br->lock);
 		br_fdb_changeaddr(p, dev->dev_addr);
 		if (br->dev->flags & IFF_UP)
 			br_stp_recalculate_bridge_id(br);
+		spin_unlock_bh(&br->lock);
 		break;
 
 	case NETDEV_DOWN:
-		if (br->dev->flags & IFF_UP)
+		if (br->dev->flags & IFF_UP) {
+			spin_lock_bh(&br->lock);
 			br_stp_disable_port(p);
+			spin_unlock_bh(&br->lock);
+		}
 		break;
 
 	case NETDEV_UP:
-		if (br->dev->flags & IFF_UP)
+		if (br->dev->flags & IFF_UP) {
+			spin_lock_bh(&br->lock);
 			br_stp_enable_port(p);
+			spin_unlock_bh(&br->lock);
+		}
 		break;
 
 	case NETDEV_UNREGISTER:
 		br_del_if(br, dev);
 		break;
 	}
-	spin_unlock_bh(&br->lock);
 
 	return NOTIFY_DONE;
 }
diff -Nru a/net/bridge/br_private.h b/net/bridge/br_private.h
--- a/net/bridge/br_private.h	Tue Jun 15 22:20:38 2004
+++ b/net/bridge/br_private.h	Tue Jun 15 22:20:38 2004
@@ -76,6 +76,7 @@
 	struct timer_list		forward_delay_timer;
 	struct timer_list		hold_timer;
 	struct timer_list		message_age_timer;
+	struct kobject			kobj;
 	struct rcu_head			rcu;
 };
 
@@ -110,6 +111,7 @@
 	struct timer_list		tcn_timer;
 	struct timer_list		topology_change_timer;
 	struct timer_list		gc_timer;
+	struct kobject			ifobj;
 };
 
 extern struct notifier_block br_device_notifier;
@@ -137,10 +139,8 @@
 extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
 					unsigned char *addr);
 extern void br_fdb_put(struct net_bridge_fdb_entry *ent);
-extern int  br_fdb_get_entries(struct net_bridge *br,
-			unsigned char *_buf,
-			int maxnum,
-			int offset);
+extern int br_fdb_fillbuf(struct net_bridge *br, void *buf, 
+			  unsigned long count, unsigned long off);
 extern int br_fdb_insert(struct net_bridge *br,
 			 struct net_bridge_port *source,
 			 const unsigned char *addr,
@@ -168,22 +168,14 @@
 	      struct net_device *dev);
 extern int br_del_if(struct net_bridge *br,
 	      struct net_device *dev);
-extern int br_get_bridge_ifindices(int *indices,
-			    int num);
-extern void br_get_port_ifindices(struct net_bridge *br,
-			   int *ifindices, int num);
 
 /* br_input.c */
 extern int br_handle_frame_finish(struct sk_buff *skb);
 extern int br_handle_frame(struct sk_buff *skb);
 
 /* br_ioctl.c */
-extern int br_ioctl_device(struct net_bridge *br,
-			   unsigned int cmd,
-			   unsigned long arg0,
-			   unsigned long arg1,
-			   unsigned long arg2);
-extern int br_ioctl_deviceless_stub(unsigned long arg);
+extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
+extern int br_ioctl_deviceless_stub(unsigned int cmd, void __user *arg);
 
 /* br_netfilter.c */
 extern int br_netfilter_init(void);
@@ -208,6 +200,7 @@
 				     u8 newprio);
 extern void br_stp_set_path_cost(struct net_bridge_port *p,
 				 u32 path_cost);
+extern ssize_t br_show_bridge_id(char *buf, const struct bridge_id *id);
 
 /* br_stp_bpdu.c */
 extern int br_stp_handle_bpdu(struct sk_buff *skb);
@@ -215,5 +208,30 @@
 /* br_stp_timer.c */
 extern void br_stp_timer_init(struct net_bridge *br);
 extern void br_stp_port_timer_init(struct net_bridge_port *p);
+extern unsigned long br_timer_value(const struct timer_list *timer);
+
+#ifdef CONFIG_SYSFS
+/* br_sysfs_if.c */
+extern int br_sysfs_addif(struct net_bridge_port *p);
+extern void br_sysfs_removeif(struct net_bridge_port *p);
+extern void br_sysfs_freeif(struct net_bridge_port *p);
+
+/* br_sysfs_br.c */
+extern struct subsystem bridge_subsys;
+extern void br_sysfs_init(void);
+extern void br_sysfs_fini(void);
+extern int br_sysfs_addbr(struct net_device *dev);
+extern void br_sysfs_delbr(struct net_device *dev);
+
+#else
+
+#define br_sysfs_addif(p)	(0)
+#define br_sysfs_removeif(p)	do { } while(0)
+#define br_sysfs_freeif(p)	kfree(p)
+#define br_sysfs_init()		do { } while(0)
+#define br_sysfs_fini()		do { } while(0)
+#define br_sysfs_addbr(dev)	(0)
+#define br_sysfs_delbr(dev)	do { } while(0)
+#endif /* CONFIG_SYSFS */
 
 #endif
diff -Nru a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
--- a/net/bridge/br_stp_if.c	Tue Jun 15 22:20:58 2004
+++ b/net/bridge/br_stp_if.c	Tue Jun 15 22:20:58 2004
@@ -212,3 +212,11 @@
 	br_configuration_update(p->br);
 	br_port_state_selection(p->br);
 }
+
+ssize_t br_show_bridge_id(char *buf, const struct bridge_id *id)
+{
+	return sprintf(buf, "%.2x%.2x.%.2x%.2x%.2x%.2x%.2x%.2x\n",
+	       id->prio[0], id->prio[1],
+	       id->addr[0], id->addr[1], id->addr[2],
+	       id->addr[3], id->addr[4], id->addr[5]);
+}
diff -Nru a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
--- a/net/bridge/br_stp_timer.c	Tue Jun 15 22:20:40 2004
+++ b/net/bridge/br_stp_timer.c	Tue Jun 15 22:20:40 2004
@@ -14,6 +14,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/times.h>
 #include <linux/smp_lock.h>
 
 #include "br_private.h"
@@ -178,3 +179,10 @@
 	br_timer_init(&p->hold_timer, br_hold_timer_expired,
 		      (unsigned long) p);
 }	
+
+/* Report ticks left (in USER_HZ) used for API */
+unsigned long br_timer_value(const struct timer_list *timer)
+{
+	return timer_pending(timer)
+		? jiffies_to_clock_t(timer->expires - jiffies) : 0;
+}
diff -Nru a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/net/bridge/br_sysfs_br.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,383 @@
+/*
+ *	Sysfs attributes of bridge ports
+ *	Linux ethernet bridge
+ *
+ *	Authors:
+ *	Stephen Hemminger		<shemminger@osdl.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/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/if_bridge.h>
+#include <linux/rtnetlink.h>
+#include <linux/spinlock.h>
+#include <linux/times.h>
+
+#include "br_private.h"
+
+#define to_class_dev(obj) container_of(obj,struct class_device,kobj)
+#define to_net_dev(class) container_of(class, struct net_device, class_dev)
+#define to_bridge(cd)	((struct net_bridge *)(to_net_dev(cd)->priv))
+
+/*
+ * Common code for storing bridge parameters.
+ */
+static ssize_t store_bridge_parm(struct class_device *cd,
+				 const char *buf, size_t len,
+				 void (*set)(struct net_bridge *, unsigned long))
+{
+	struct net_bridge *br = to_bridge(cd);
+	char *endp;
+	unsigned long val;
+
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
+
+	val = simple_strtoul(buf, &endp, 0);
+	if (endp == buf)
+		return -EINVAL;
+
+	spin_lock_bh(&br->lock);
+	(*set)(br, val);
+	spin_unlock_bh(&br->lock);
+	return len;
+}
+
+
+static ssize_t show_forward_delay(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->forward_delay));
+}
+
+static void set_forward_delay(struct net_bridge *br, unsigned long val)
+{
+	unsigned long delay = clock_t_to_jiffies(val);
+	br->forward_delay = delay;
+	if (br_is_root_bridge(br))
+		br->bridge_forward_delay = delay;
+}
+
+static ssize_t store_forward_delay(struct class_device *cd, const char *buf,
+				   size_t len)
+{
+	return store_bridge_parm(cd, buf, len, set_forward_delay);
+}
+static CLASS_DEVICE_ATTR(forward_delay, S_IRUGO | S_IWUSR,
+			 show_forward_delay, store_forward_delay);
+
+static ssize_t show_hello_time(struct class_device *cd, char *buf)
+{
+	return sprintf(buf, "%lu\n",
+		       jiffies_to_clock_t(to_bridge(cd)->hello_time));
+}
+
+static void set_hello_time(struct net_bridge *br, unsigned long val)
+{
+	unsigned long t = clock_t_to_jiffies(val);
+	br->hello_time = t;
+	if (br_is_root_bridge(br))
+		br->bridge_hello_time = t;
+}
+
+static ssize_t store_hello_time(struct class_device *cd, const char *buf,
+				size_t len)
+{
+	return store_bridge_parm(cd, buf, len, set_hello_time);
+}
+
+static CLASS_DEVICE_ATTR(hello_time, S_IRUGO | S_IWUSR, show_hello_time,
+			 store_hello_time);
+
+static ssize_t show_max_age(struct class_device *cd, char *buf)
+{
+	return sprintf(buf, "%lu\n",
+		       jiffies_to_clock_t(to_bridge(cd)->max_age));
+}
+
+static void set_max_age(struct net_bridge *br, unsigned long val)
+{
+	unsigned long t = clock_t_to_jiffies(val);
+	br->max_age = t;
+	if (br_is_root_bridge(br))
+		br->bridge_max_age = t;
+}
+
+static ssize_t store_max_age(struct class_device *cd, const char *buf,
+				size_t len)
+{
+	return store_bridge_parm(cd, buf, len, set_max_age);
+}
+
+static CLASS_DEVICE_ATTR(max_age, S_IRUGO | S_IWUSR, show_max_age,
+			 store_max_age);
+
+static ssize_t show_ageing_time(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->ageing_time));
+}
+
+static void set_ageing_time(struct net_bridge *br, unsigned long val)
+{
+	br->ageing_time = clock_t_to_jiffies(val);
+}
+
+static ssize_t store_ageing_time(struct class_device *cd, const char *buf,
+				 size_t len)
+{
+	return store_bridge_parm(cd, buf, len, set_ageing_time);
+}
+
+static CLASS_DEVICE_ATTR(ageing_time, S_IRUGO | S_IWUSR, show_ageing_time,
+			 store_ageing_time);
+static ssize_t show_stp_state(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%d\n", br->stp_enabled);
+}
+
+static void set_stp_state(struct net_bridge *br, unsigned long val)
+{
+	br->stp_enabled = val;
+}
+
+static ssize_t store_stp_state(struct class_device *cd,
+			       const char *buf, size_t len)
+{
+	return store_bridge_parm(cd, buf, len, set_stp_state);
+}
+
+static CLASS_DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
+			 store_stp_state);
+
+static ssize_t show_priority(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%d\n",
+		       (br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1]);
+}
+
+static void set_priority(struct net_bridge *br, unsigned long val)
+{
+	br_stp_set_bridge_priority(br, (u16) val);
+}
+
+static ssize_t store_priority(struct class_device *cd,
+			       const char *buf, size_t len)
+{
+	return store_bridge_parm(cd, buf, len, set_priority);
+}
+static CLASS_DEVICE_ATTR(priority, S_IRUGO | S_IWUSR, show_priority,
+			 store_priority);
+
+static ssize_t show_root_id(struct class_device *cd, char *buf)
+{
+	return br_show_bridge_id(buf, &to_bridge(cd)->designated_root);
+}
+static CLASS_DEVICE_ATTR(root_id, S_IRUGO, show_root_id, NULL);
+
+static ssize_t show_bridge_id(struct class_device *cd, char *buf)
+{
+	return br_show_bridge_id(buf, &to_bridge(cd)->bridge_id);
+}
+static CLASS_DEVICE_ATTR(bridge_id, S_IRUGO, show_bridge_id, NULL);
+
+static ssize_t show_root_port(struct class_device *cd, char *buf)
+{
+	return sprintf(buf, "%d\n", to_bridge(cd)->root_port);
+}
+static CLASS_DEVICE_ATTR(root_port, S_IRUGO, show_root_port, NULL);
+
+static ssize_t show_root_path_cost(struct class_device *cd, char *buf)
+{
+	return sprintf(buf, "%d\n", to_bridge(cd)->root_path_cost);
+}
+static CLASS_DEVICE_ATTR(root_path_cost, S_IRUGO, show_root_path_cost, NULL);
+
+static ssize_t show_topology_change(struct class_device *cd, char *buf)
+{
+	return sprintf(buf, "%d\n", to_bridge(cd)->topology_change);
+}
+static CLASS_DEVICE_ATTR(topology_change, S_IRUGO, show_topology_change, NULL);
+
+static ssize_t show_topology_change_detected(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%d\n", br->topology_change_detected);
+}
+static CLASS_DEVICE_ATTR(topology_change_detected, S_IRUGO, show_topology_change_detected, NULL);
+
+static ssize_t show_hello_timer(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%ld\n", br_timer_value(&br->hello_timer));
+}
+static CLASS_DEVICE_ATTR(hello_timer, S_IRUGO, show_hello_timer, NULL);
+
+static ssize_t show_tcn_timer(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%ld\n", br_timer_value(&br->tcn_timer));
+}
+static CLASS_DEVICE_ATTR(tcn_timer, S_IRUGO, show_tcn_timer, NULL);
+
+static ssize_t show_topology_change_timer(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%ld\n", br_timer_value(&br->topology_change_timer));
+}
+static CLASS_DEVICE_ATTR(topology_change_timer, S_IRUGO, show_topology_change_timer, NULL);
+
+static ssize_t show_gc_timer(struct class_device *cd, char *buf)
+{
+	struct net_bridge *br = to_bridge(cd);
+	return sprintf(buf, "%ld\n", br_timer_value(&br->gc_timer));
+}
+static CLASS_DEVICE_ATTR(gc_timer, S_IRUGO, show_gc_timer, NULL);
+
+static struct attribute *bridge_attrs[] = {
+	&class_device_attr_forward_delay.attr,
+	&class_device_attr_hello_time.attr,
+	&class_device_attr_max_age.attr,
+	&class_device_attr_ageing_time.attr,
+	&class_device_attr_stp_state.attr,
+	&class_device_attr_priority.attr,
+	&class_device_attr_bridge_id.attr,
+	&class_device_attr_root_id.attr,
+	&class_device_attr_root_path_cost.attr,
+	&class_device_attr_root_port.attr,
+	&class_device_attr_topology_change.attr,
+	&class_device_attr_topology_change_detected.attr,
+	&class_device_attr_hello_timer.attr,
+	&class_device_attr_tcn_timer.attr,
+	&class_device_attr_topology_change_timer.attr,
+	&class_device_attr_gc_timer.attr,
+	NULL
+};
+
+static struct attribute_group bridge_group = {
+	.name = SYSFS_BRIDGE_ATTR,
+	.attrs = bridge_attrs,
+};
+
+/*
+ * Export the forwarding information table as a binary file
+ * The records are struct __fdb_entry.
+ *
+ * Returns the number of bytes read.
+ */
+static ssize_t brforward_read(struct kobject *kobj, char *buf,
+			   loff_t off, size_t count)
+{
+	struct class_device *cdev = to_class_dev(kobj);
+	struct net_bridge *br = to_bridge(cdev);
+	int n;
+
+	/* must read whole records */
+	if (off % sizeof(struct __fdb_entry) != 0)
+		return -EINVAL;
+
+	n =  br_fdb_fillbuf(br, buf, 
+			    count / sizeof(struct __fdb_entry),
+			    off / sizeof(struct __fdb_entry));
+
+	if (n > 0)
+		n *= sizeof(struct __fdb_entry);
+	
+	return n;
+}
+
+static struct bin_attribute bridge_forward = {
+	.attr = { .name = SYSFS_BRIDGE_FDB,
+		  .mode = S_IRUGO, 
+		  .owner = THIS_MODULE, },
+	.read = brforward_read,
+};
+
+
+/*
+ * This is a dummy kset so bridge objects don't cause
+ * hotplug events 
+ */
+struct subsystem bridge_subsys = { 
+	.kset = { .hotplug_ops = NULL },
+};
+
+void br_sysfs_init(void)
+{
+	subsystem_register(&bridge_subsys);
+}
+
+void br_sysfs_fini(void)
+{
+	subsystem_unregister(&bridge_subsys);
+}
+
+/*
+ * Add entries in sysfs onto the existing network class device
+ * for the bridge.
+ *   Adds a attribute group "bridge" containing tuning parameters.
+ *   Binary attribute containing the forward table
+ *   Sub directory to hold links to interfaces.
+ *
+ * Note: the ifobj exists only to be a subdirectory
+ *   to hold links.  The ifobj exists in same data structure
+ *   as it's parent the bridge so reference counting works.
+ */
+int br_sysfs_addbr(struct net_device *dev)
+{
+	struct kobject *brobj = &dev->class_dev.kobj;
+	struct net_bridge *br = netdev_priv(dev);
+	int err;
+
+	err = sysfs_create_group(brobj, &bridge_group);
+	if (err) {
+		pr_info("%s: can't create group %s/%s\n",
+			__FUNCTION__, dev->name, bridge_group.name);
+		goto out1;
+	}
+
+	err = sysfs_create_bin_file(brobj, &bridge_forward);
+	if (err) {
+		pr_info("%s: can't create attribue file %s/%s\n",
+			__FUNCTION__, dev->name, bridge_forward.attr.name);
+		goto out2;
+	}
+
+	
+	kobject_set_name(&br->ifobj, SYSFS_BRIDGE_PORT_SUBDIR);
+	br->ifobj.ktype = NULL;
+	br->ifobj.kset = &bridge_subsys.kset;
+	br->ifobj.parent = brobj;
+
+	err = kobject_register(&br->ifobj);
+	if (err) {
+		pr_info("%s: can't add kobject (directory) %s/%s\n",
+			__FUNCTION__, dev->name, br->ifobj.name);
+		goto out3;
+	}
+	return 0;
+ out3:
+	sysfs_remove_bin_file(&dev->class_dev.kobj, &bridge_forward);
+ out2:
+	sysfs_remove_group(&dev->class_dev.kobj, &bridge_group);
+ out1:
+	return err;
+
+}
+
+void br_sysfs_delbr(struct net_device *dev)
+{
+	struct kobject *kobj = &dev->class_dev.kobj;
+	struct net_bridge *br = netdev_priv(dev);
+
+	kobject_unregister(&br->ifobj);
+	sysfs_remove_bin_file(kobj, &bridge_forward);
+	sysfs_remove_group(kobj, &bridge_group);
+}
diff -Nru a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/net/bridge/br_sysfs_if.c	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,269 @@
+/*
+ *	Sysfs attributes of bridge ports
+ *	Linux ethernet bridge
+ *
+ *	Authors:
+ *	Stephen Hemminger		<shemminger@osdl.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/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/if_bridge.h>
+#include <linux/rtnetlink.h>
+#include <linux/spinlock.h>
+
+#include "br_private.h"
+
+struct brport_attribute {
+	struct attribute	attr;
+	ssize_t (*show)(struct net_bridge_port *, char *);
+	ssize_t (*store)(struct net_bridge_port *, unsigned long);
+};
+
+#define BRPORT_ATTR(_name,_mode,_show,_store)		        \
+struct brport_attribute brport_attr_##_name = { 	        \
+	.attr = {.name = __stringify(_name), 			\
+		 .mode = _mode, 				\
+		 .owner = THIS_MODULE, },			\
+	.show	= _show,					\
+	.store	= _store,					\
+};
+
+static ssize_t show_path_cost(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "%d\n", p->path_cost);
+}
+static ssize_t store_path_cost(struct net_bridge_port *p, unsigned long v)
+{
+	br_stp_set_path_cost(p, v);
+	return 0;
+}
+static BRPORT_ATTR(path_cost, S_IRUGO | S_IWUSR,
+		   show_path_cost, store_path_cost);
+
+static ssize_t show_priority(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "%d\n", p->priority);
+}
+static ssize_t store_priority(struct net_bridge_port *p, unsigned long v)
+{
+	if (v >= (1<<(16-BR_PORT_BITS)))
+		return -ERANGE;
+	br_stp_set_port_priority(p, v);
+	return 0;
+}
+static BRPORT_ATTR(priority, S_IRUGO | S_IWUSR,
+			 show_priority, store_priority);
+
+static ssize_t show_designated_root(struct net_bridge_port *p, char *buf)
+{
+	return br_show_bridge_id(buf, &p->designated_root);
+}
+static BRPORT_ATTR(designated_root, S_IRUGO, show_designated_root, NULL);
+
+static ssize_t show_designated_bridge(struct net_bridge_port *p, char *buf)
+{
+	return br_show_bridge_id(buf, &p->designated_bridge);
+}
+static BRPORT_ATTR(designated_bridge, S_IRUGO, show_designated_bridge, NULL);
+
+static ssize_t show_designated_port(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "%d\n", p->designated_port);
+}
+static BRPORT_ATTR(designated_port, S_IRUGO, show_designated_port, NULL);
+
+static ssize_t show_designated_cost(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "%d\n", p->designated_cost);
+}
+static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
+
+static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "0x%x\n", p->port_id);
+}
+static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
+
+static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "0x%x\n", p->port_no);
+}
+
+static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
+
+static ssize_t show_change_ack(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "%d\n", p->topology_change_ack);
+}
+static BRPORT_ATTR(change_ack, S_IRUGO, show_change_ack, NULL);
+
+static ssize_t show_config_pending(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "%d\n", p->config_pending);
+}
+static BRPORT_ATTR(config_pending, S_IRUGO, show_config_pending, NULL);
+
+static ssize_t show_port_state(struct net_bridge_port *p, char *buf)
+{
+	return sprintf(buf, "%d\n", p->state);
+}
+static BRPORT_ATTR(state, S_IRUGO, show_port_state, NULL);
+
+static ssize_t show_message_age_timer(struct net_bridge_port *p,
+					    char *buf)
+{
+	return sprintf(buf, "%ld\n", br_timer_value(&p->message_age_timer));
+}
+static BRPORT_ATTR(message_age_timer, S_IRUGO, show_message_age_timer, NULL);
+
+static ssize_t show_forward_delay_timer(struct net_bridge_port *p,
+					    char *buf)
+{
+	return sprintf(buf, "%ld\n", br_timer_value(&p->forward_delay_timer));
+}
+static BRPORT_ATTR(forward_delay_timer, S_IRUGO, show_forward_delay_timer, NULL);
+
+static ssize_t show_hold_timer(struct net_bridge_port *p,
+					    char *buf)
+{
+	return sprintf(buf, "%ld\n", br_timer_value(&p->hold_timer));
+}
+static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);
+
+static struct brport_attribute *brport_attrs[] = {
+	&brport_attr_path_cost,
+	&brport_attr_priority,
+	&brport_attr_port_id,
+	&brport_attr_port_no,
+	&brport_attr_designated_root,
+	&brport_attr_designated_bridge,
+	&brport_attr_designated_port,
+	&brport_attr_designated_cost,
+	&brport_attr_state,
+	&brport_attr_change_ack,
+	&brport_attr_config_pending,
+	&brport_attr_message_age_timer,
+	&brport_attr_forward_delay_timer,
+	&brport_attr_hold_timer,
+	NULL
+};
+
+#define to_brport_attr(_at) container_of(_at, struct brport_attribute, attr)
+#define to_brport(obj)	container_of(obj, struct net_bridge_port, kobj)
+
+static ssize_t brport_show(struct kobject * kobj,
+			   struct attribute * attr, char * buf)
+{
+	struct brport_attribute * brport_attr = to_brport_attr(attr);
+	struct net_bridge_port * p = to_brport(kobj);
+
+	return brport_attr->show(p, buf);
+}
+
+static ssize_t brport_store(struct kobject * kobj,
+			    struct attribute * attr,
+			    const char * buf, size_t count)
+{
+	struct brport_attribute * brport_attr = to_brport_attr(attr);
+	struct net_bridge_port * p = to_brport(kobj);
+	ssize_t ret = -EINVAL;
+	char *endp;
+	unsigned long val;
+
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
+
+	val = simple_strtoul(buf, &endp, 0);
+	if (endp != buf) {
+		rtnl_lock();
+		if (p->dev && p->br && brport_attr->store) {
+			spin_lock_bh(&p->br->lock);
+			ret = brport_attr->store(p, val);
+			spin_unlock_bh(&p->br->lock);
+			if (ret == 0)
+				ret = count;
+		}
+		rtnl_unlock();
+	}
+	return ret;
+}
+
+/* called from kobject_put when port ref count goes to zero. */
+static void brport_release(struct kobject *kobj)
+{
+	kfree(container_of(kobj, struct net_bridge_port, kobj));
+}
+
+static struct sysfs_ops brport_sysfs_ops = {
+	.show = brport_show,
+	.store = brport_store,
+};
+
+static struct kobj_type brport_ktype = {
+	.sysfs_ops = &brport_sysfs_ops,
+	.release = brport_release,
+};
+
+
+/*
+ * Add sysfs entries to ethernet device added to a bridge.
+ * Creates a brport subdirectory with bridge attributes.
+ * Puts symlink in bridge's brport subdirectory
+ */
+int br_sysfs_addif(struct net_bridge_port *p)
+{
+	struct net_bridge *br = p->br;
+	struct brport_attribute **a;
+	int err;
+
+	ASSERT_RTNL();
+
+	kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
+	p->kobj.ktype = &brport_ktype;
+	p->kobj.parent = &(p->dev->class_dev.kobj);
+	p->kobj.kset = &bridge_subsys.kset;
+
+	err = kobject_add(&p->kobj);
+	if(err)
+		goto out1;
+
+	err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj, 
+				SYSFS_BRIDGE_PORT_LINK);
+	if (err)
+		goto out2;
+
+	for (a = brport_attrs; *a; ++a) {
+		err = sysfs_create_file(&p->kobj, &((*a)->attr));
+		if (err)
+			goto out2;
+	}
+
+	err = sysfs_create_link(&br->ifobj, &p->kobj, p->dev->name);
+	if (err)
+		goto out2;
+
+	return 0;
+ out2:
+	kobject_del(&p->kobj);
+ out1:
+	return err;
+}
+
+void br_sysfs_removeif(struct net_bridge_port *p)
+{
+	pr_debug("br_sysfs_removeif\n");
+	sysfs_remove_link(&p->br->ifobj, p->dev->name);
+	kobject_del(&p->kobj);
+}
+
+void br_sysfs_freeif(struct net_bridge_port *p)
+{
+	pr_debug("br_sysfs_freeif\n");
+	kobject_put(&p->kobj);
+}
diff -Nru a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
--- a/net/bridge/netfilter/ebtables.c	Tue Jun 15 22:20:39 2004
+++ b/net/bridge/netfilter/ebtables.c	Tue Jun 15 22:20:39 2004
@@ -902,7 +902,7 @@
 }
 
 /* replace the table */
-static int do_replace(void *user, unsigned int len)
+static int do_replace(void __user *user, unsigned int len)
 {
 	int ret, i, countersize;
 	struct ebt_table_info *newinfo;
@@ -1217,7 +1217,7 @@
 }
 
 /* userspace just supplied us with counters */
-static int update_counters(void *user, unsigned int len)
+static int update_counters(void __user *user, unsigned int len)
 {
 	int i, ret;
 	struct ebt_counter *tmp;
@@ -1315,7 +1315,7 @@
 }
 
 /* called with ebt_mutex down */
-static int copy_everything_to_user(struct ebt_table *t, void *user,
+static int copy_everything_to_user(struct ebt_table *t, void __user *user,
    int *len, int cmd)
 {
 	struct ebt_replace tmp;
@@ -1391,7 +1391,7 @@
 }
 
 static int do_ebt_set_ctl(struct sock *sk,
-	int cmd, void *user, unsigned int len)
+	int cmd, void __user *user, unsigned int len)
 {
 	int ret;
 
@@ -1408,7 +1408,7 @@
 	return ret;
 }
 
-static int do_ebt_get_ctl(struct sock *sk, int cmd, void *user, int *len)
+static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 {
 	int ret;
 	struct ebt_replace tmp;
diff -Nru a/net/compat.c b/net/compat.c
--- a/net/compat.c	Tue Jun 15 22:20:41 2004
+++ b/net/compat.c	Tue Jun 15 22:20:41 2004
@@ -29,7 +29,7 @@
 #include <net/compat.h>
 
 static inline int iov_from_user_compat_to_kern(struct iovec *kiov,
-					  struct compat_iovec *uiov32,
+					  struct compat_iovec __user *uiov32,
 					  int niov)
 {
 	int tot_len = 0;
@@ -53,7 +53,7 @@
 	return tot_len;
 }
 
-int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr *umsg)
+int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg)
 {
 	compat_uptr_t tmp1, tmp2, tmp3;
 
@@ -98,7 +98,7 @@
 	}
 
 	tot_len = iov_from_user_compat_to_kern(kern_iov,
-					  (struct compat_iovec *)kern_msg->msg_iov,
+					  (struct compat_iovec __user *)kern_msg->msg_iov,
 					  kern_msg->msg_iovlen);
 	if(tot_len >= 0)
 		kern_msg->msg_iov = kern_iov;
@@ -112,7 +112,7 @@
 #define CMSG_COMPAT_ALIGN(len)	ALIGN((len), sizeof(s32))
 
 #define CMSG_COMPAT_DATA(cmsg)				\
-	((void *)((char *)(cmsg) + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))))
+	((void __user *)((char __user *)(cmsg) + CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr))))
 #define CMSG_COMPAT_SPACE(len)				\
 	(CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)) + CMSG_COMPAT_ALIGN(len))
 #define CMSG_COMPAT_LEN(len)				\
@@ -120,20 +120,17 @@
 
 #define CMSG_COMPAT_FIRSTHDR(msg)			\
 	(((msg)->msg_controllen) >= sizeof(struct compat_cmsghdr) ?	\
-	 (struct compat_cmsghdr *)((msg)->msg_control) :		\
-	 (struct compat_cmsghdr *)NULL)
+	 (struct compat_cmsghdr __user *)((msg)->msg_control) :		\
+	 (struct compat_cmsghdr __user *)NULL)
 
-static inline struct compat_cmsghdr *cmsg_compat_nxthdr(struct msghdr *msg,
-		struct compat_cmsghdr *cmsg, int cmsg_len)
+static inline struct compat_cmsghdr __user *cmsg_compat_nxthdr(struct msghdr *msg,
+		struct compat_cmsghdr __user *cmsg, int cmsg_len)
 {
-	struct compat_cmsghdr *ptr;
-
-	ptr = (struct compat_cmsghdr *)(((unsigned char *)cmsg) +
-			CMSG_COMPAT_ALIGN(cmsg_len));
-	if ((unsigned long)((char *)(ptr + 1) - (char *)msg->msg_control) >
+	char __user *ptr = (char __user *)cmsg + CMSG_COMPAT_ALIGN(cmsg_len);
+	if ((unsigned long)(ptr + 1 - (char __user *)msg->msg_control) >
 			msg->msg_controllen)
 		return NULL;
-	return ptr;
+	return (struct compat_cmsghdr __user *)ptr;
 }
 
 /* There is a lot of hair here because the alignment rules (and
@@ -143,7 +140,7 @@
 int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
 			       unsigned char *stackbuf, int stackbuf_size)
 {
-	struct compat_cmsghdr *ucmsg;
+	struct compat_cmsghdr __user *ucmsg;
 	struct cmsghdr *kcmsg, *kcmsg_base;
 	compat_size_t ucmlen;
 	__kernel_size_t kcmlen, tmp;
@@ -159,7 +156,7 @@
 		if(CMSG_COMPAT_ALIGN(ucmlen) <
 		   CMSG_COMPAT_ALIGN(sizeof(struct compat_cmsghdr)))
 			return -EINVAL;
-		if((unsigned long)(((char *)ucmsg - (char *)kmsg->msg_control)
+		if((unsigned long)(((char __user *)ucmsg - (char __user *)kmsg->msg_control)
 				   + ucmlen) > kmsg->msg_controllen)
 			return -EINVAL;
 
@@ -217,7 +214,7 @@
 int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
 {
 	struct compat_timeval ctv;
-	struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control;
+	struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
 	struct compat_cmsghdr cmhdr;
 	int cmlen;
 
@@ -255,17 +252,17 @@
 
 void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm)
 {
-	struct compat_cmsghdr *cm = (struct compat_cmsghdr *) kmsg->msg_control;
+	struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
 	int fdmax = (kmsg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int);
 	int fdnum = scm->fp->count;
 	struct file **fp = scm->fp->fp;
-	int *cmfptr;
+	int __user *cmfptr;
 	int err = 0, i;
 
 	if (fdnum < fdmax)
 		fdmax = fdnum;
 
-	for (i = 0, cmfptr = (int *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) {
+	for (i = 0, cmfptr = (int __user *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) {
 		int new_fd;
 		err = get_unused_fd();
 		if (err < 0)
@@ -322,10 +319,10 @@
 };
 
 static int do_netfilter_replace(int fd, int level, int optname,
-				char *optval, int optlen)
+				char __user *optval, int optlen)
 {
-	struct compat_ipt_replace *urepl = (struct compat_ipt_replace *)optval;
-	struct ipt_replace *repl_nat;
+	struct compat_ipt_replace __user *urepl;
+	struct ipt_replace __user *repl_nat;
 	char name[IPT_TABLE_MAXNAMELEN];
 	u32 origsize, tmp32, num_counters;
 	unsigned int repl_nat_size;
@@ -333,6 +330,7 @@
 	int i;
 	compat_uptr_t ucntrs;
 
+	urepl = (struct compat_ipt_replace __user *)optval;
 	if (get_user(origsize, &urepl->size))
 		return -EFAULT;
 
@@ -399,7 +397,7 @@
 
 
 	ret = sys_setsockopt(fd, level, optname,
-			     (char *)repl_nat, repl_nat_size);
+			     (char __user *)repl_nat, repl_nat_size);
 
 out:
 	return ret;
@@ -414,10 +412,10 @@
 };
 
 static int do_set_attach_filter(int fd, int level, int optname,
-				char *optval, int optlen)
+				char __user *optval, int optlen)
 {
-	struct compat_sock_fprog *fprog32 = (struct compat_sock_fprog *)optval;
-	struct sock_fprog *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); 
+	struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
+	struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog)); 
 	compat_uptr_t ptr;
 	u16 len;
 
@@ -429,13 +427,13 @@
 	    __put_user(compat_ptr(ptr), &kfprog->filter))
 		return -EFAULT;
 
-	return sys_setsockopt(fd, level, optname, (char *)kfprog, 
+	return sys_setsockopt(fd, level, optname, (char __user *)kfprog, 
 			      sizeof(struct sock_fprog));
 }
 
-static int do_set_sock_timeout(int fd, int level, int optname, char *optval, int optlen)
+static int do_set_sock_timeout(int fd, int level, int optname, char __user *optval, int optlen)
 {
-	struct compat_timeval *up = (struct compat_timeval *) optval;
+	struct compat_timeval __user *up = (struct compat_timeval __user *) optval;
 	struct timeval ktime;
 	mm_segment_t old_fs;
 	int err;
@@ -455,7 +453,7 @@
 }
 
 asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
-				char *optval, int optlen)
+				char __user *optval, int optlen)
 {
 	if (optname == IPT_SO_SET_REPLACE)
 		return do_netfilter_replace(fd, level, optname,
@@ -469,14 +467,15 @@
 	return sys_setsockopt(fd, level, optname, optval, optlen);
 }
 
-static int do_get_sock_timeout(int fd, int level, int optname, char *optval,
-		int *optlen)
+static int do_get_sock_timeout(int fd, int level, int optname,
+		char __user *optval, int __user *optlen)
 {
-	struct compat_timeval *up = (struct compat_timeval *) optval;
+	struct compat_timeval __user *up;
 	struct timeval ktime;
 	mm_segment_t old_fs;
 	int len, err;
 
+	up = (struct compat_timeval __user *) optval;
 	if (get_user(len, optlen))
 		return -EFAULT;
 	if (len < sizeof(*up))
@@ -498,7 +497,7 @@
 }
 
 asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
-				char *optval, int *optlen)
+				char __user *optval, int __user *optlen)
 {
 	if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)
 		return do_get_sock_timeout(fd, level, optname, optval, optlen);
@@ -512,17 +511,17 @@
 				AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)};
 #undef AL
 
-asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr *msg, unsigned flags)
+asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags)
 {
-	return sys_sendmsg(fd, (struct msghdr *)msg, flags | MSG_CMSG_COMPAT);
+	return sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
 }
 
-asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr *msg, unsigned int flags)
+asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags)
 {
-	return sys_recvmsg(fd, (struct msghdr *)msg, flags | MSG_CMSG_COMPAT);
+	return sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
 }
 
-asmlinkage long compat_sys_socketcall(int call, u32 *args)
+asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
 {
 	int ret;
 	u32 a[6];
diff -Nru a/net/core/Makefile b/net/core/Makefile
--- a/net/core/Makefile	Tue Jun 15 22:21:03 2004
+++ b/net/core/Makefile	Tue Jun 15 22:21:03 2004
@@ -6,9 +6,10 @@
 
 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
 
-obj-y		     += flow.o dev.o ethtool.o net-sysfs.o dev_mcast.o dst.o \
+obj-y		     += flow.o dev.o ethtool.o dev_mcast.o dst.o \
 			neighbour.o rtnetlink.o utils.o link_watch.o filter.o
 
+obj-$(CONFIG_SYSFS) += net-sysfs.o
 obj-$(CONFIG_NETFILTER) += netfilter.o
 obj-$(CONFIG_NET_DIVERT) += dv.o
 obj-$(CONFIG_NET_PKTGEN) += pktgen.o
diff -Nru a/net/core/datagram.c b/net/core/datagram.c
--- a/net/core/datagram.c	Tue Jun 15 22:20:41 2004
+++ b/net/core/datagram.c	Tue Jun 15 22:20:41 2004
@@ -202,7 +202,7 @@
 /*
  *	Copy a datagram to a linear buffer.
  */
-int skb_copy_datagram(const struct sk_buff *skb, int offset, char *to, int size)
+int skb_copy_datagram(const struct sk_buff *skb, int offset, char __user *to, int size)
 {
 	struct iovec iov = {
 		.iov_base = to,
@@ -297,7 +297,7 @@
 }
 
 int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset,
-			       u8 *to, int len, unsigned int *csump)
+			       u8 __user *to, int len, unsigned int *csump)
 {
 	int start = skb_headlen(skb);
 	int pos = 0;
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c	Tue Jun 15 22:20:40 2004
+++ b/net/core/dev.c	Tue Jun 15 22:20:40 2004
@@ -220,9 +220,15 @@
 int netdev_fastroute_obstacles;
 #endif
 
+#ifdef CONFIG_SYSFS
 extern int netdev_sysfs_init(void);
 extern int netdev_register_sysfs(struct net_device *);
-extern int netdev_unregister_sysfs(struct net_device *);
+extern void netdev_unregister_sysfs(struct net_device *);
+#else
+#define netdev_sysfs_init()	 	(0)
+#define netdev_register_sysfs(dev)	(0)
+#define	netdev_unregister_sysfs(dev)	do { } while(0)
+#endif
 
 
 /*******************************************************************************
@@ -785,13 +791,15 @@
 /**
  *	dev_change_name - change name of a device
  *	@dev: device
- *	@name: name (or format string) must be at least IFNAMSIZ
+ *	@newname: name (or format string) must be at least IFNAMSIZ
  *
  *	Change name of a device, can pass format strings "eth%d".
  *	for wildcarding.
  */
 int dev_change_name(struct net_device *dev, char *newname)
 {
+	int err = 0;
+
 	ASSERT_RTNL();
 
 	if (dev->flags & IFF_UP)
@@ -801,7 +809,7 @@
 		return -EINVAL;
 
 	if (strchr(newname, '%')) {
-		int err = dev_alloc_name(dev, newname);
+		err = dev_alloc_name(dev, newname);
 		if (err < 0)
 			return err;
 		strcpy(newname, dev->name);
@@ -811,12 +819,14 @@
 	else
 		strlcpy(dev->name, newname, IFNAMSIZ);
 
-	hlist_del(&dev->name_hlist);
-	hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
+	err = class_device_rename(&dev->class_dev, dev->name);
+	if (!err) {
+		hlist_del(&dev->name_hlist);
+		hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
+		notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
+	}
 
-	class_device_rename(&dev->class_dev, dev->name);
-	notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
-	return 0;
+	return err;
 }
 
 /**
@@ -1170,28 +1180,46 @@
 	rcu_read_unlock();
 }
 
-/* Calculate csum in the case, when packet is misrouted.
- * If it failed by some reason, ignore and send skb with wrong
- * checksum.
+/*
+ * Invalidate hardware checksum when packet is to be mangled, and
+ * complete checksum manually on outgoing path.
  */
-struct sk_buff *skb_checksum_help(struct sk_buff *skb)
+int skb_checksum_help(struct sk_buff **pskb, int inward)
 {
 	unsigned int csum;
-	int offset = skb->h.raw - skb->data;
+	int ret = 0, offset = (*pskb)->h.raw - (*pskb)->data;
+
+	if (inward) {
+		(*pskb)->ip_summed = CHECKSUM_NONE;
+		goto out;
+	}
+
+	if (skb_shared(*pskb)  || skb_cloned(*pskb)) {
+		struct sk_buff *newskb = skb_copy(*pskb, GFP_ATOMIC);
+		if (!newskb) {
+			ret = -ENOMEM;
+			goto out;
+		}
+		if ((*pskb)->sk)
+			skb_set_owner_w(newskb, (*pskb)->sk);
+		kfree_skb(*pskb);
+		*pskb = newskb;
+	}
 
-	if (offset > (int)skb->len)
+	if (offset > (int)(*pskb)->len)
 		BUG();
-	csum = skb_checksum(skb, offset, skb->len-offset, 0);
+	csum = skb_checksum(*pskb, offset, (*pskb)->len-offset, 0);
 
-	offset = skb->tail - skb->h.raw;
+	offset = (*pskb)->tail - (*pskb)->h.raw;
 	if (offset <= 0)
 		BUG();
-	if (skb->csum + 2 > offset)
+	if ((*pskb)->csum + 2 > offset)
 		BUG();
 
-	*(u16*)(skb->h.raw + skb->csum) = csum_fold(csum);
-	skb->ip_summed = CHECKSUM_NONE;
-	return skb;
+	*(u16*)((*pskb)->h.raw + (*pskb)->csum) = csum_fold(csum);
+	(*pskb)->ip_summed = CHECKSUM_NONE;
+out:	
+	return ret;
 }
 
 #ifdef CONFIG_HIGHMEM
@@ -1316,10 +1344,9 @@
 	if (skb->ip_summed == CHECKSUM_HW &&
 	    (!(dev->features & (NETIF_F_HW_CSUM | NETIF_F_NO_CSUM)) &&
 	     (!(dev->features & NETIF_F_IP_CSUM) ||
-	      skb->protocol != htons(ETH_P_IP)))) {
-		if ((skb = skb_checksum_help(skb)) == NULL)
-			goto out;
-	}
+	      skb->protocol != htons(ETH_P_IP))))
+	      	if (skb_checksum_help(&skb, 0))
+	      		goto out_kfree_skb;
 
 	/* Grab device queue */
 	spin_lock_bh(&dev->queue_lock);
@@ -1948,7 +1975,7 @@
 {
 	struct ifconf ifc;
 	struct net_device *dev;
-	char *pos;
+	char __user *pos;
 	int len;
 	int total;
 	int i;
@@ -2515,6 +2542,8 @@
 			    cmd == SIOCGMIIPHY ||
 			    cmd == SIOCGMIIREG ||
 			    cmd == SIOCSMIIREG ||
+			    cmd == SIOCBRADDIF ||
+			    cmd == SIOCBRDELIF ||
 			    cmd == SIOCWANDEV) {
 				err = -EOPNOTSUPP;
 				if (dev->do_ioctl) {
@@ -2669,6 +2698,8 @@
 		case SIOCBONDSLAVEINFOQUERY:
 		case SIOCBONDINFOQUERY:
 		case SIOCBONDCHANGEACTIVE:
+		case SIOCBRADDIF:
+		case SIOCBRDELIF:
 			if (!capable(CAP_NET_ADMIN))
 				return -EPERM;
 			dev_load(ifr.ifr_name);
@@ -2963,16 +2994,20 @@
 void netdev_run_todo(void)
 {
 	struct list_head list = LIST_HEAD_INIT(list);
+	int err;
 
-	/* Safe outside mutex since we only care about entries that
-	 * this cpu put into queue while under RTNL.
-	 */
-	if (list_empty(&net_todo_list))
-		return;
 
 	/* Need to guard against multiple cpu's getting out of order. */
 	down(&net_todo_run_mutex);
 
+	/* Not safe to do outside the semaphore.  We must not return
+	 * until all unregister events invoked by the local processor
+	 * have been completed (either by this todo run, or one on
+	 * another cpu).
+	 */
+	if (list_empty(&net_todo_list))
+		goto out;
+
 	/* Snapshot list, allow later requests */
 	spin_lock(&net_todo_list_lock);
 	list_splice_init(&net_todo_list, &list);
@@ -2985,7 +3020,10 @@
 
 		switch(dev->reg_state) {
 		case NETREG_REGISTERING:
-			netdev_register_sysfs(dev);
+			err = netdev_register_sysfs(dev);
+			if (err)
+				printk(KERN_ERR "%s: failed sysfs registration (%d)\n",
+				       dev->name, err);
 			dev->reg_state = NETREG_REGISTERED;
 			break;
 
@@ -3016,6 +3054,7 @@
 		}
 	}
 
+out:
 	up(&net_todo_run_mutex);
 }
 
@@ -3029,6 +3068,7 @@
  */
 void free_netdev(struct net_device *dev)
 {
+#ifdef CONFIG_SYSFS
 	/*  Compatiablity with error handling in drivers */
 	if (dev->reg_state == NETREG_UNINITIALIZED) {
 		kfree((char *)dev - dev->padded);
@@ -3040,6 +3080,9 @@
 
 	/* will free via class release */
 	class_device_put(&dev->class_dev);
+#else
+	kfree((char *)dev - dev->padded);
+#endif
 }
  
 /* Synchronize with packet receive processing. */
diff -Nru a/net/core/dst.c b/net/core/dst.c
--- a/net/core/dst.c	Tue Jun 15 22:20:41 2004
+++ b/net/core/dst.c	Tue Jun 15 22:20:41 2004
@@ -100,15 +100,15 @@
 	spin_unlock(&dst_lock);
 }
 
-static int dst_discard(struct sk_buff *skb)
+static int dst_discard_in(struct sk_buff *skb)
 {
 	kfree_skb(skb);
 	return 0;
 }
 
-static int dst_blackhole(struct sk_buff *skb)
+static int dst_discard_out(struct sk_buff **pskb)
 {
-	kfree_skb(skb);
+	kfree_skb(*pskb);
 	return 0;
 }
 
@@ -128,8 +128,8 @@
 	dst->ops = ops;
 	dst->lastuse = jiffies;
 	dst->path = dst;
-	dst->input = dst_discard;
-	dst->output = dst_blackhole;
+	dst->input = dst_discard_in;
+	dst->output = dst_discard_out;
 #if RT_CACHE_DEBUG >= 2 
 	atomic_inc(&dst_total);
 #endif
@@ -143,8 +143,8 @@
 	   protocol module is unloaded.
 	 */
 	if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) {
-		dst->input = dst_discard;
-		dst->output = dst_blackhole;
+		dst->input = dst_discard_in;
+		dst->output = dst_discard_out;
 	}
 	dst->obsolete = 2;
 }
@@ -228,20 +228,22 @@
 				   _race_ _condition_.
 				 */
 				if (event!=NETDEV_DOWN &&
-				    dst->output == dst_blackhole) {
+				    dst->output == dst_discard_out) {
 					dst->dev = &loopback_dev;
-					dev_put(dev);
 					dev_hold(&loopback_dev);
-					dst->output = dst_discard;
+					dev_put(dev);
+					dst->output = dst_discard_out;
 					if (dst->neighbour && dst->neighbour->dev == dev) {
 						dst->neighbour->dev = &loopback_dev;
 						dev_put(dev);
 						dev_hold(&loopback_dev);
 					}
 				} else {
-					dst->input = dst_discard;
-					dst->output = dst_blackhole;
+					dst->input = dst_discard_in;
+					dst->output = dst_discard_out;
 				}
+				if (dst->ops->ifdown)
+					dst->ops->ifdown(dst, event != NETDEV_DOWN);
 			}
 		}
 		spin_unlock_bh(&dst_lock);
diff -Nru a/net/core/ethtool.c b/net/core/ethtool.c
--- a/net/core/ethtool.c	Tue Jun 15 22:20:38 2004
+++ b/net/core/ethtool.c	Tue Jun 15 22:20:38 2004
@@ -650,8 +650,9 @@
 int dev_ethtool(struct ifreq *ifr)
 {
 	struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
-	void __user *useraddr = (void __user *) ifr->ifr_data;
+	void __user *useraddr = ifr->ifr_data;
 	u32 ethcmd;
+	int rc;
 
 	/*
 	 * XXX: This can be pushed down into the ethtool_* handlers that
@@ -669,70 +670,109 @@
 	if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
 		return -EFAULT;
 
+	if(dev->ethtool_ops->begin)
+		if ((rc = dev->ethtool_ops->begin(dev)) < 0)
+			return rc;
+
 	switch (ethcmd) {
 	case ETHTOOL_GSET:
-		return ethtool_get_settings(dev, useraddr);
+		rc = ethtool_get_settings(dev, useraddr);
+		break;
 	case ETHTOOL_SSET:
-		return ethtool_set_settings(dev, useraddr);
+		rc = ethtool_set_settings(dev, useraddr);
+		break;
 	case ETHTOOL_GDRVINFO:
-		return ethtool_get_drvinfo(dev, useraddr);
+		rc = ethtool_get_drvinfo(dev, useraddr);
+
+		break;
 	case ETHTOOL_GREGS:
-		return ethtool_get_regs(dev, useraddr);
+		rc = ethtool_get_regs(dev, useraddr);
+		break;
 	case ETHTOOL_GWOL:
-		return ethtool_get_wol(dev, useraddr);
+		rc = ethtool_get_wol(dev, useraddr);
+		break;
 	case ETHTOOL_SWOL:
-		return ethtool_set_wol(dev, useraddr);
+		rc = ethtool_set_wol(dev, useraddr);
+		break;
 	case ETHTOOL_GMSGLVL:
-		return ethtool_get_msglevel(dev, useraddr);
+		rc = ethtool_get_msglevel(dev, useraddr);
+		break;
 	case ETHTOOL_SMSGLVL:
-		return ethtool_set_msglevel(dev, useraddr);
+		rc = ethtool_set_msglevel(dev, useraddr);
+		break;
 	case ETHTOOL_NWAY_RST:
-		return ethtool_nway_reset(dev);
+		rc = ethtool_nway_reset(dev);
+		break;
 	case ETHTOOL_GLINK:
-		return ethtool_get_link(dev, useraddr);
+		rc = ethtool_get_link(dev, useraddr);
+		break;
 	case ETHTOOL_GEEPROM:
-		return ethtool_get_eeprom(dev, useraddr);
+		rc = ethtool_get_eeprom(dev, useraddr);
+		break;
 	case ETHTOOL_SEEPROM:
-		return ethtool_set_eeprom(dev, useraddr);
+		rc = ethtool_set_eeprom(dev, useraddr);
+		break;
 	case ETHTOOL_GCOALESCE:
-		return ethtool_get_coalesce(dev, useraddr);
+		rc = ethtool_get_coalesce(dev, useraddr);
+		break;
 	case ETHTOOL_SCOALESCE:
-		return ethtool_set_coalesce(dev, useraddr);
+		rc = ethtool_set_coalesce(dev, useraddr);
+		break;
 	case ETHTOOL_GRINGPARAM:
-		return ethtool_get_ringparam(dev, useraddr);
+		rc = ethtool_get_ringparam(dev, useraddr);
+		break;
 	case ETHTOOL_SRINGPARAM:
-		return ethtool_set_ringparam(dev, useraddr);
+		rc = ethtool_set_ringparam(dev, useraddr);
+		break;
 	case ETHTOOL_GPAUSEPARAM:
-		return ethtool_get_pauseparam(dev, useraddr);
+		rc = ethtool_get_pauseparam(dev, useraddr);
+		break;
 	case ETHTOOL_SPAUSEPARAM:
-		return ethtool_set_pauseparam(dev, useraddr);
+		rc = ethtool_set_pauseparam(dev, useraddr);
+		break;
 	case ETHTOOL_GRXCSUM:
-		return ethtool_get_rx_csum(dev, useraddr);
+		rc = ethtool_get_rx_csum(dev, useraddr);
+		break;
 	case ETHTOOL_SRXCSUM:
-		return ethtool_set_rx_csum(dev, useraddr);
+		rc = ethtool_set_rx_csum(dev, useraddr);
+		break;
 	case ETHTOOL_GTXCSUM:
-		return ethtool_get_tx_csum(dev, useraddr);
+		rc = ethtool_get_tx_csum(dev, useraddr);
+		break;
 	case ETHTOOL_STXCSUM:
-		return ethtool_set_tx_csum(dev, useraddr);
+		rc = ethtool_set_tx_csum(dev, useraddr);
+		break;
 	case ETHTOOL_GSG:
-		return ethtool_get_sg(dev, useraddr);
+		rc = ethtool_get_sg(dev, useraddr);
+		break;
 	case ETHTOOL_SSG:
-		return ethtool_set_sg(dev, useraddr);
+		rc = ethtool_set_sg(dev, useraddr);
+		break;
 	case ETHTOOL_GTSO:
-		return ethtool_get_tso(dev, useraddr);
+		rc = ethtool_get_tso(dev, useraddr);
+		break;
 	case ETHTOOL_STSO:
-		return ethtool_set_tso(dev, useraddr);
+		rc = ethtool_set_tso(dev, useraddr);
+		break;
 	case ETHTOOL_TEST:
-		return ethtool_self_test(dev, useraddr);
+		rc = ethtool_self_test(dev, useraddr);
+		break;
 	case ETHTOOL_GSTRINGS:
-		return ethtool_get_strings(dev, useraddr);
+		rc = ethtool_get_strings(dev, useraddr);
+		break;
 	case ETHTOOL_PHYS_ID:
-		return ethtool_phys_id(dev, useraddr);
+		rc = ethtool_phys_id(dev, useraddr);
+		break;
 	case ETHTOOL_GSTATS:
-		return ethtool_get_stats(dev, useraddr);
+		rc = ethtool_get_stats(dev, useraddr);
+		break;
 	default:
-		return -EOPNOTSUPP;
+		rc =  -EOPNOTSUPP;
 	}
+	
+	if(dev->ethtool_ops->complete)
+		dev->ethtool_ops->complete(dev);
+	return rc;
 
  ioctl:
 	if (dev->do_ioctl)
diff -Nru a/net/core/iovec.c b/net/core/iovec.c
--- a/net/core/iovec.c	Tue Jun 15 22:21:05 2004
+++ b/net/core/iovec.c	Tue Jun 15 22:21:05 2004
@@ -157,7 +157,7 @@
 	}
 
 	while (len > 0) {
-		u8 *base = iov->iov_base + offset;
+		u8 __user *base = iov->iov_base + offset;
 		int copy = min_t(unsigned int, len, iov->iov_len - offset);
 
 		offset = 0;
@@ -192,7 +192,7 @@
 	}
 
 	while (len > 0) {
-		u8 *base = iov->iov_base + offset;
+		u8 __user *base = iov->iov_base + offset;
 		int copy = min_t(unsigned int, len, iov->iov_len - offset);
 
 		offset = 0;
diff -Nru a/net/core/net-sysfs.c b/net/core/net-sysfs.c
--- a/net/core/net-sysfs.c	Tue Jun 15 22:20:58 2004
+++ b/net/core/net-sysfs.c	Tue Jun 15 22:20:58 2004
@@ -20,9 +20,9 @@
 #define to_class_dev(obj) container_of(obj,struct class_device,kobj)
 #define to_net_dev(class) container_of(class, struct net_device, class_dev)
 
-static const char *fmt_hex = "%#x\n";
-static const char *fmt_dec = "%d\n";
-static const char *fmt_ulong = "%lu\n";
+static const char fmt_hex[] = "%#x\n";
+static const char fmt_dec[] = "%d\n";
+static const char fmt_ulong[] = "%lu\n";
 
 static inline int dev_isalive(const struct net_device *dev) 
 {
diff -Nru a/net/core/netfilter.c b/net/core/netfilter.c
--- a/net/core/netfilter.c	Tue Jun 15 22:20:40 2004
+++ b/net/core/netfilter.c	Tue Jun 15 22:20:40 2004
@@ -286,7 +286,7 @@
 
 /* Call get/setsockopt() */
 static int nf_sockopt(struct sock *sk, int pf, int val, 
-		      char *opt, int *len, int get)
+		      char __user *opt, int *len, int get)
 {
 	struct list_head *i;
 	struct nf_sockopt_ops *ops;
@@ -329,13 +329,13 @@
 	return ret;
 }
 
-int nf_setsockopt(struct sock *sk, int pf, int val, char *opt,
+int nf_setsockopt(struct sock *sk, int pf, int val, char __user *opt,
 		  int len)
 {
 	return nf_sockopt(sk, pf, val, opt, &len, 0);
 }
 
-int nf_getsockopt(struct sock *sk, int pf, int val, char *opt, int *len)
+int nf_getsockopt(struct sock *sk, int pf, int val, char __user *opt, int *len)
 {
 	return nf_sockopt(sk, pf, val, opt, len, 1);
 }
@@ -503,14 +503,6 @@
 	struct list_head *elem;
 	unsigned int verdict;
 	int ret = 0;
-
-	if (skb->ip_summed == CHECKSUM_HW) {
-		if (outdev == NULL) {
-			skb->ip_summed = CHECKSUM_NONE;
-		} else {
-			skb_checksum_help(skb);
-		}
-	}
 
 	/* We may already have this, but read-locks nest anyway */
 	rcu_read_lock();
diff -Nru a/net/core/netpoll.c b/net/core/netpoll.c
--- a/net/core/netpoll.c	Tue Jun 15 22:21:03 2004
+++ b/net/core/netpoll.c	Tue Jun 15 22:21:03 2004
@@ -623,7 +623,7 @@
 	np->dev = 0;
 }
 
-int netpoll_trap()
+int netpoll_trap(void)
 {
 	return trapped;
 }
diff -Nru a/net/core/pktgen.c b/net/core/pktgen.c
--- a/net/core/pktgen.c	Tue Jun 15 22:20:42 2004
+++ b/net/core/pktgen.c	Tue Jun 15 22:20:42 2004
@@ -870,7 +870,7 @@
 	return p - buf;
 }
 
-static int count_trail_chars(const char *user_buffer, unsigned int maxlen)
+static int count_trail_chars(const char __user *user_buffer, unsigned int maxlen)
 {
 	int i;
 
@@ -895,7 +895,7 @@
 	return i;
 }
 
-static unsigned long num_arg(const char *user_buffer, unsigned long maxlen,
+static unsigned long num_arg(const char __user *user_buffer, unsigned long maxlen,
 			     unsigned long *num)
 {
 	int i = 0;
@@ -916,7 +916,7 @@
 	return i;
 }
 
-static int strn_len(const char *user_buffer, unsigned int maxlen)
+static int strn_len(const char __user *user_buffer, unsigned int maxlen)
 {
 	int i = 0;
 
@@ -940,7 +940,7 @@
 	return i;
 }
 
-static int proc_write(struct file *file, const char *user_buffer,
+static int proc_write(struct file *file, const char __user *user_buffer,
 			 unsigned long count, void *data)
 {
 	int i = 0, max, len;
diff -Nru a/net/core/scm.c b/net/core/scm.c
--- a/net/core/scm.c	Tue Jun 15 22:20:39 2004
+++ b/net/core/scm.c	Tue Jun 15 22:20:39 2004
@@ -169,7 +169,7 @@
 
 int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
 {
-	struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control;
+	struct cmsghdr __user *cm = (struct cmsghdr __user *)msg->msg_control;
 	struct cmsghdr cmhdr;
 	int cmlen = CMSG_LEN(len);
 	int err;
@@ -204,16 +204,18 @@
 
 void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
 {
-	struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control;
+	struct cmsghdr __user *cm = (struct cmsghdr __user*)msg->msg_control;
 
 	int fdmax = 0;
 	int fdnum = scm->fp->count;
 	struct file **fp = scm->fp->fp;
-	int *cmfptr;
+	int __user *cmfptr;
 	int err = 0, i;
 
-	if (MSG_CMSG_COMPAT & msg->msg_flags)
-		return scm_detach_fds_compat(msg, scm);
+	if (MSG_CMSG_COMPAT & msg->msg_flags) {
+		scm_detach_fds_compat(msg, scm);
+		return;
+	}
 
 	if (msg->msg_controllen > sizeof(struct cmsghdr))
 		fdmax = ((msg->msg_controllen - sizeof(struct cmsghdr))
@@ -222,7 +224,7 @@
 	if (fdnum < fdmax)
 		fdmax = fdnum;
 
-	for (i=0, cmfptr=(int*)CMSG_DATA(cm); i<fdmax; i++, cmfptr++)
+	for (i=0, cmfptr=(int __user *)CMSG_DATA(cm); i<fdmax; i++, cmfptr++)
 	{
 		int new_fd;
 		err = security_file_receive(fp[i]);
diff -Nru a/net/core/sock.c b/net/core/sock.c
--- a/net/core/sock.c	Tue Jun 15 22:20:43 2004
+++ b/net/core/sock.c	Tue Jun 15 22:20:43 2004
@@ -917,6 +917,31 @@
 	} while((skb = sk->sk_backlog.head) != NULL);
 }
 
+/**
+ * sk_wait_data - wait for data to arrive at sk_receive_queue
+ * sk - sock to wait on
+ * timeo - for how long
+ *
+ * Now socket state including sk->sk_err is changed only under lock,
+ * hence we may omit checks after joining wait queue.
+ * We check receive queue before schedule() only as optimization;
+ * it is very likely that release_sock() added new data.
+ */
+int sk_wait_data(struct sock *sk, long *timeo)
+{
+	int rc;
+	DEFINE_WAIT(wait);
+
+	prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+	set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
+	rc = sk_wait_event(sk, timeo, !skb_queue_empty(&sk->sk_receive_queue));
+	clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
+	finish_wait(sk->sk_sleep, &wait);
+	return rc;
+}
+
+EXPORT_SYMBOL(sk_wait_data);
+
 /*
  * Set of default routines for initialising struct proto_ops when
  * the protocol does not support a particular function. In certain
@@ -1099,6 +1124,23 @@
 			sk_wake_async(sk, 3, POLL_PRI);
 }
 
+void sk_reset_timer(struct sock *sk, struct timer_list* timer,
+		    unsigned long expires)
+{
+	if (!mod_timer(timer, expires))
+		sock_hold(sk);
+}
+
+EXPORT_SYMBOL(sk_reset_timer);
+
+void sk_stop_timer(struct sock *sk, struct timer_list* timer)
+{
+	if (timer_pending(timer) && del_timer(timer))
+		__sock_put(sk);
+}
+
+EXPORT_SYMBOL(sk_stop_timer);
+
 void sock_init_data(struct socket *sock, struct sock *sk)
 {
 	skb_queue_head_init(&sk->sk_receive_queue);
@@ -1172,7 +1214,7 @@
 /* When > 0 there are consumers of rx skb time stamps */
 atomic_t netstamp_needed = ATOMIC_INIT(0); 
 
-int sock_get_timestamp(struct sock *sk, struct timeval *userstamp)
+int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
 { 
 	if (!sock_flag(sk, SOCK_TIMESTAMP))
 		sock_enable_timestamp(sk);
diff -Nru a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
--- a/net/decnet/af_decnet.c	Tue Jun 15 22:20:41 2004
+++ b/net/decnet/af_decnet.c	Tue Jun 15 22:20:41 2004
@@ -155,8 +155,8 @@
 static struct hlist_head dn_sk_hash[DN_SK_HASH_SIZE];
 static struct hlist_head dn_wild_sk;
 
-static int __dn_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen, int flags);
-static int __dn_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen, int flags);
+static int __dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen, int flags);
+static int __dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen, int flags);
 
 static struct hlist_head *dn_find_list(struct sock *sk)
 {
@@ -1212,7 +1212,7 @@
 	{
 	case SIOCGIFADDR:
 	case SIOCSIFADDR:
-		return dn_dev_ioctl(cmd, (void *)arg);
+		return dn_dev_ioctl(cmd, (void __user *)arg);
 
 	case SIOCATMARK:
 		lock_sock(sk);
@@ -1226,7 +1226,7 @@
 		amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
 		if (amount < 0)
 			amount = 0;
-		err = put_user(amount, (int *)arg);
+		err = put_user(amount, (int __user *)arg);
 		break;
 
 	case TIOCINQ:
@@ -1244,11 +1244,11 @@
 			}
 		}
 		release_sock(sk);
-		err = put_user(amount, (int *)arg);
+		err = put_user(amount, (int __user *)arg);
 		break;
 
 	default:
-		err = dev_ioctl(cmd, (void *)arg);
+		err = dev_ioctl(cmd, (void __user *)arg);
 		break;
 	}
 
@@ -1313,7 +1313,7 @@
 	return err;
 }
 
-static int dn_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen)
+static int dn_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	int err;
@@ -1325,7 +1325,7 @@
 	return err;
 }
 
-static int __dn_setsockopt(struct socket *sock, int level,int optname, char *optval, int optlen, int flags) 
+static int __dn_setsockopt(struct socket *sock, int level,int optname, char __user *optval, int optlen, int flags) 
 {
 	struct	sock *sk = sock->sk;
 	struct dn_scp *scp = DN_SK(sk);
@@ -1490,7 +1490,7 @@
 	return 0;
 }
 
-static int dn_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen)
+static int dn_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	int err;
@@ -1502,7 +1502,7 @@
 	return err;
 }
 
-static int __dn_getsockopt(struct socket *sock, int level,int optname, char *optval,int *optlen, int flags)
+static int __dn_getsockopt(struct socket *sock, int level,int optname, char __user *optval,int __user *optlen, int flags)
 {
 	struct	sock *sk = sock->sk;
 	struct dn_scp *scp = DN_SK(sk);
@@ -1905,7 +1905,7 @@
 	unsigned char fctype;
 	long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
 
-	if (flags & ~(MSG_TRYHARD|MSG_OOB|MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|MSG_MORE))
+	if (flags & ~(MSG_TRYHARD|MSG_OOB|MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|MSG_MORE|MSG_CMSG_COMPAT))
 		return -EOPNOTSUPP;
 
 	if (addr_len && (addr_len != sizeof(struct sockaddr_dn)))
diff -Nru a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
--- a/net/decnet/dn_dev.c	Tue Jun 15 22:20:39 2004
+++ b/net/decnet/dn_dev.c	Tue Jun 15 22:20:39 2004
@@ -161,10 +161,10 @@
 static int max_priority[] = { 127 }; /* From DECnet spec */
 
 static int dn_forwarding_proc(ctl_table *, int, struct file *,
-			void *, size_t *);
-static int dn_forwarding_sysctl(ctl_table *table, int *name, int nlen,
-			void *oldval, size_t *oldlenp,
-			void *newval, size_t newlen,
+			void __user *, size_t *);
+static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen,
+			void __user *oldval, size_t __user *oldlenp,
+			void __user *newval, size_t newlen,
 			void **context);
 
 static struct dn_dev_sysctl_table {
@@ -362,7 +362,7 @@
 
 static int dn_forwarding_proc(ctl_table *table, int write, 
 				struct file *filep,
-				void *buffer, size_t *lenp)
+				void __user *buffer, size_t *lenp)
 {
 #ifdef CONFIG_DECNET_ROUTER
 	struct net_device *dev = table->extra1;
@@ -404,9 +404,9 @@
 #endif
 }
 
-static int dn_forwarding_sysctl(ctl_table *table, int *name, int nlen,
-			void *oldval, size_t *oldlenp,
-			void *newval, size_t newlen,
+static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen,
+			void __user *oldval, size_t __user *oldlenp,
+			void __user *newval, size_t newlen,
 			void **context)
 {
 #ifdef CONFIG_DECNET_ROUTER
@@ -423,7 +423,7 @@
 		if (newlen != sizeof(int))
 			return -EINVAL;
 
-		if (get_user(value, (int *)newval))
+		if (get_user(value, (int __user *)newval))
 			return -EFAULT;
 		if (value < 0)
 			return -EINVAL;
@@ -553,7 +553,7 @@
 }
 
 
-int dn_dev_ioctl(unsigned int cmd, void *arg)
+int dn_dev_ioctl(unsigned int cmd, void __user *arg)
 {
 	char buffer[DN_IFREQ_SIZE];
 	struct ifreq *ifr = (struct ifreq *)buffer;
@@ -1294,35 +1294,43 @@
  * it as a compile time option. Probably you should use the
  * rtnetlink interface instead.
  */
-int dnet_gifconf(struct net_device *dev, char *buf, int len)
+int dnet_gifconf(struct net_device *dev, char __user *buf, int len)
 {
 	struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
 	struct dn_ifaddr *ifa;
-	struct ifreq *ifr = (struct ifreq *)buf;
+	char buffer[DN_IFREQ_SIZE];
+	struct ifreq *ifr = (struct ifreq *)buffer;
+	struct sockaddr_dn *addr = (struct sockaddr_dn *)&ifr->ifr_addr;
 	int done = 0;
 
 	if ((dn_db == NULL) || ((ifa = dn_db->ifa_list) == NULL))
 		return 0;
 
 	for(; ifa; ifa = ifa->ifa_next) {
-		if (!ifr) {
+		if (!buf) {
 			done += sizeof(DN_IFREQ_SIZE);
 			continue;
 		}
 		if (len < DN_IFREQ_SIZE)
 			return done;
-		memset(ifr, 0, DN_IFREQ_SIZE);
+		memset(buffer, 0, DN_IFREQ_SIZE);
 
 		if (ifa->ifa_label)
 			strcpy(ifr->ifr_name, ifa->ifa_label);
 		else
 			strcpy(ifr->ifr_name, dev->name);
 
-		(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_family = AF_DECnet;
-		(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_add.a_len = 2;
-		(*(dn_address *)(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_add.a_addr) = ifa->ifa_local;
+		addr->sdn_family = AF_DECnet;
+		addr->sdn_add.a_len = 2;
+		memcpy(addr->sdn_add.a_addr, &ifa->ifa_local,
+			sizeof(dn_address));
+
+		if (copy_to_user(buf, buffer, DN_IFREQ_SIZE)) {
+			done = -EFAULT;
+			break;
+		}
 
-		ifr = (struct ifreq *)((char *)ifr + DN_IFREQ_SIZE);
+		buf  += DN_IFREQ_SIZE;
 		len  -= DN_IFREQ_SIZE;
 		done += DN_IFREQ_SIZE;
 	}
diff -Nru a/net/decnet/dn_route.c b/net/decnet/dn_route.c
--- a/net/decnet/dn_route.c	Tue Jun 15 22:21:03 2004
+++ b/net/decnet/dn_route.c	Tue Jun 15 22:21:03 2004
@@ -684,8 +684,9 @@
 	return NET_RX_DROP;
 }
 
-static int dn_output(struct sk_buff *skb)
+static int dn_output(struct sk_buff **pskb)
 {
+	struct sk_buff *skb = *pskb;
 	struct dst_entry *dst = skb->dst;
 	struct dn_route *rt = (struct dn_route *)dst;
 	struct net_device *dev = dst->dev;
@@ -796,6 +797,11 @@
 	return NET_RX_BAD;
 }
 
+static int dn_rt_bug_out(struct sk_buff **pskb)
+{
+	return dn_rt_bug(*pskb);
+}
+
 static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
 {
 	struct dn_fib_info *fi = res->fi;
@@ -1387,7 +1393,7 @@
 	rt->u.dst.neighbour = neigh;
 	rt->u.dst.dev = out_dev;
 	rt->u.dst.lastuse = jiffies;
-	rt->u.dst.output = dn_rt_bug;
+	rt->u.dst.output = dn_rt_bug_out;
 	switch(res.type) {
 		case RTN_UNICAST:
 			rt->u.dst.input = dn_forward;
diff -Nru a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
--- a/net/decnet/sysctl_net_decnet.c	Tue Jun 15 22:20:38 2004
+++ b/net/decnet/sysctl_net_decnet.c	Tue Jun 15 22:20:38 2004
@@ -127,9 +127,9 @@
 }
 
 
-static int dn_node_address_strategy(ctl_table *table, int *name, int nlen,
-				void *oldval, size_t *oldlenp,
-				void *newval, size_t newlen,
+static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen,
+				void __user *oldval, size_t __user *oldlenp,
+				void __user *newval, size_t newlen,
 				void **context)
 {
 	size_t len;
@@ -141,14 +141,14 @@
 		if (len) {
 			if (len != sizeof(unsigned short))
 				return -EINVAL;
-			if (put_user(decnet_address, (unsigned short *)oldval))
+			if (put_user(decnet_address, (unsigned short __user *)oldval))
 				return -EFAULT;
 		}
 	}
 	if (newval && newlen) {
 		if (newlen != sizeof(unsigned short))
 			return -EINVAL;
-		if (get_user(addr, (unsigned short *)newval))
+		if (get_user(addr, (unsigned short __user *)newval))
 			return -EFAULT;
 
 		dn_dev_devices_off();
@@ -162,7 +162,7 @@
 
 static int dn_node_address_handler(ctl_table *table, int write, 
 				struct file *filp,
-				void *buffer, size_t *lenp)
+				void __user *buffer, size_t *lenp)
 {
 	char addr[DN_ASCBUF_LEN];
 	size_t len;
@@ -212,9 +212,9 @@
 }
 
 
-static int dn_def_dev_strategy(ctl_table *table, int *name, int nlen,
-				void *oldval, size_t *oldlenp,
-				void *newval, size_t newlen,
+static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen,
+				void __user *oldval, size_t __user *oldlenp,
+				void __user *newval, size_t newlen,
 				void **context)
 {
 	size_t len;
@@ -273,7 +273,7 @@
 
 static int dn_def_dev_handler(ctl_table *table, int write, 
 				struct file * filp,
-				void *buffer, size_t *lenp)
+				void __user *buffer, size_t *lenp)
 {
 	size_t len;
 	struct net_device *dev;
diff -Nru a/net/econet/af_econet.c b/net/econet/af_econet.c
--- a/net/econet/af_econet.c	Tue Jun 15 22:20:40 2004
+++ b/net/econet/af_econet.c	Tue Jun 15 22:20:40 2004
@@ -274,8 +274,8 @@
 	 *	Check the flags. 
 	 */
 
-	if (msg->msg_flags&~MSG_DONTWAIT) 
-		return(-EINVAL);
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) 
+		return -EINVAL;
 
 	/*
 	 *	Get and verify the address. 
@@ -418,10 +418,18 @@
 
 	/* tack our header on the front of the iovec */
 	size = sizeof(struct aunhdr);
+	/*
+	 * XXX: that is b0rken.  We can't mix userland and kernel pointers
+	 * in iovec, since on a lot of platforms copy_from_user() will
+	 * *not* work with the kernel and userland ones at the same time,
+	 * regardless of what we do with set_fs().  And we are talking about
+	 * econet-over-ethernet here, so "it's only ARM anyway" doesn't
+	 * apply.  Any suggestions on fixing that code?		-- AV
+	 */
 	iov[0].iov_base = (void *)&ah;
 	iov[0].iov_len = size;
 	for (i = 0; i < msg->msg_iovlen; i++) {
-		void *base = msg->msg_iov[i].iov_base;
+		void __user *base = msg->msg_iov[i].iov_base;
 		size_t len = msg->msg_iov[i].iov_len;
 		/* Check it now since we switch to KERNEL_DS later. */
 		if ((err = verify_area(VERIFY_READ, base, len)) < 0)
@@ -589,7 +597,7 @@
  *	Handle Econet specific ioctls
  */
 
-static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void *arg)
+static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg)
 {
 	struct ifreq ifr;
 	struct ec_device *edev;
@@ -662,18 +670,19 @@
 static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
 	struct sock *sk = sock->sk;
+	void __user *argp = (void __user *)arg;
 
 	switch(cmd) {
 		case SIOCGSTAMP:
-			return sock_get_timestamp(sk,(struct timeval *)arg);
+			return sock_get_timestamp(sk, argp);
 
 		case SIOCSIFADDR:
 		case SIOCGIFADDR:
-			return ec_dev_ioctl(sock, cmd, (void *)arg);
+			return ec_dev_ioctl(sock, cmd, argp);
 			break;
 
 		default:
-			return dev_ioctl(cmd,(void *) arg);
+			return dev_ioctl(cmd, argp);
 	}
 	/*NOTREACHED*/
 	return 0;
diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
--- a/net/ipv4/af_inet.c	Tue Jun 15 22:20:37 2004
+++ b/net/ipv4/af_inet.c	Tue Jun 15 22:20:37 2004
@@ -216,7 +216,7 @@
  *	Set socket options on an inet socket.
  */
 int inet_setsockopt(struct socket *sock, int level, int optname,
-		    char *optval, int optlen)
+		    char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 
@@ -232,7 +232,7 @@
  */
 
 int inet_getsockopt(struct socket *sock, int level, int optname,
-		    char *optval, int *optlen)
+		    char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 
@@ -843,7 +843,7 @@
 
 	switch (cmd) {
 		case SIOCGSTAMP:
-			err = sock_get_timestamp(sk, (struct timeval *)arg);
+			err = sock_get_timestamp(sk, (struct timeval __user *)arg);
 			break;
 		case SIOCADDRT:
 		case SIOCDELRT:
@@ -853,7 +853,7 @@
 		case SIOCDARP:
 		case SIOCGARP:
 		case SIOCSARP:
-			err = arp_ioctl(cmd, (void *)arg);
+			err = arp_ioctl(cmd, (void __user *)arg);
 			break;
 		case SIOCGIFADDR:
 		case SIOCSIFADDR:
@@ -866,13 +866,13 @@
 		case SIOCSIFPFLAGS:
 		case SIOCGIFPFLAGS:
 		case SIOCSIFFLAGS:
-			err = devinet_ioctl(cmd, (void *)arg);
+			err = devinet_ioctl(cmd, (void __user *)arg);
 			break;
 		default:
 			if (!sk->sk_prot->ioctl ||
 			    (err = sk->sk_prot->ioctl(sk, cmd, arg)) ==
 			    					-ENOIOCTLCMD)
-				err = dev_ioctl(cmd, (void *)arg);
+				err = dev_ioctl(cmd, (void __user *)arg);
 			break;
 	}
 	return err;
@@ -978,7 +978,7 @@
 
 	spin_lock_bh(&inetsw_lock);
 
-	if (p->type > SOCK_MAX)
+	if (p->type >= SOCK_MAX)
 		goto out_illegal;
 
 	/* If we are trying to override a permanent protocol, bail. */
@@ -1066,8 +1066,8 @@
 {
 	net_statistics[0] = alloc_percpu(struct linux_mib);
 	net_statistics[1] = alloc_percpu(struct linux_mib);
-	ip_statistics[0] = alloc_percpu(struct ip_mib);
-	ip_statistics[1] = alloc_percpu(struct ip_mib);
+	ip_statistics[0] = alloc_percpu(struct ipstats_mib);
+	ip_statistics[1] = alloc_percpu(struct ipstats_mib);
 	icmp_statistics[0] = alloc_percpu(struct icmp_mib);
 	icmp_statistics[1] = alloc_percpu(struct icmp_mib);
 	tcp_statistics[0] = alloc_percpu(struct tcp_mib);
diff -Nru a/net/ipv4/ah4.c b/net/ipv4/ah4.c
--- a/net/ipv4/ah4.c	Tue Jun 15 22:20:44 2004
+++ b/net/ipv4/ah4.c	Tue Jun 15 22:20:44 2004
@@ -54,10 +54,10 @@
 	return 0;
 }
 
-static int ah_output(struct sk_buff *skb)
+static int ah_output(struct sk_buff **pskb)
 {
 	int err;
-	struct dst_entry *dst = skb->dst;
+	struct dst_entry *dst = (*pskb)->dst;
 	struct xfrm_state *x  = dst->xfrm;
 	struct iphdr *iph, *top_iph;
 	struct ip_auth_hdr *ah;
@@ -67,23 +67,24 @@
 		char 		buf[60];
 	} tmp_iph;
 
-	if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) {
-		err = -EINVAL;
-		goto error_nolock;
+	if ((*pskb)->ip_summed == CHECKSUM_HW) {
+		err = skb_checksum_help(pskb, 0);
+		if (err)
+			goto error_nolock;
 	}
 
 	spin_lock_bh(&x->lock);
-	err = xfrm_check_output(x, skb, AF_INET);
+	err = xfrm_check_output(x, *pskb, AF_INET);
 	if (err)
 		goto error;
 
-	iph = skb->nh.iph;
+	iph = (*pskb)->nh.iph;
 	if (x->props.mode) {
-		top_iph = (struct iphdr*)skb_push(skb, x->props.header_len);
+		top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len);
 		top_iph->ihl = 5;
 		top_iph->version = 4;
 		top_iph->tos = 0;
-		top_iph->tot_len = htons(skb->len);
+		top_iph->tot_len = htons((*pskb)->len);
 		top_iph->frag_off = 0;
 		if (!(iph->frag_off&htons(IP_DF)))
 			__ip_select_ident(top_iph, dst, 0);
@@ -95,12 +96,12 @@
 		ah = (struct ip_auth_hdr*)(top_iph+1);
 		ah->nexthdr = IPPROTO_IPIP;
 	} else {
-		memcpy(&tmp_iph, skb->data, iph->ihl*4);
-		top_iph = (struct iphdr*)skb_push(skb, x->props.header_len);
+		memcpy(&tmp_iph, (*pskb)->data, iph->ihl*4);
+		top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len);
 		memcpy(top_iph, &tmp_iph, iph->ihl*4);
 		iph = &tmp_iph.iph;
 		top_iph->tos = 0;
-		top_iph->tot_len = htons(skb->len);
+		top_iph->tot_len = htons((*pskb)->len);
 		top_iph->frag_off = 0;
 		top_iph->ttl = 0;
 		top_iph->protocol = IPPROTO_AH;
@@ -120,14 +121,14 @@
 	ah->reserved = 0;
 	ah->spi = x->id.spi;
 	ah->seq_no = htonl(++x->replay.oseq);
-	ahp->icv(ahp, skb, ah->auth_data);
+	ahp->icv(ahp, *pskb, ah->auth_data);
 	top_iph->tos = iph->tos;
 	top_iph->ttl = iph->ttl;
 	if (x->props.mode) {
 		if (x->props.flags & XFRM_STATE_NOECN)
 			IP_ECN_clear(top_iph);
 		top_iph->frag_off = iph->frag_off&~htons(IP_MF|IP_OFFSET);
-		memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
+		memset(&(IPCB(*pskb)->opt), 0, sizeof(struct ip_options));
 	} else {
 		top_iph->frag_off = iph->frag_off;
 		top_iph->daddr = iph->daddr;
@@ -136,12 +137,12 @@
 	}
 	ip_send_check(top_iph);
 
-	skb->nh.raw = skb->data;
+	(*pskb)->nh.raw = (*pskb)->data;
 
-	x->curlft.bytes += skb->len;
+	x->curlft.bytes += (*pskb)->len;
 	x->curlft.packets++;
 	spin_unlock_bh(&x->lock);
-	if ((skb->dst = dst_pop(dst)) == NULL) {
+	if (((*pskb)->dst = dst_pop(dst)) == NULL) {
 		err = -EHOSTUNREACH;
 		goto error_nolock;
 	}
@@ -150,7 +151,7 @@
 error:
 	spin_unlock_bh(&x->lock);
 error_nolock:
-	kfree_skb(skb);
+	kfree_skb(*pskb);
 	return err;
 }
 
diff -Nru a/net/ipv4/arp.c b/net/ipv4/arp.c
--- a/net/ipv4/arp.c	Tue Jun 15 22:20:44 2004
+++ b/net/ipv4/arp.c	Tue Jun 15 22:20:44 2004
@@ -1103,7 +1103,7 @@
  *	Handle an ARP layer I/O control request.
  */
 
-int arp_ioctl(unsigned int cmd, void *arg)
+int arp_ioctl(unsigned int cmd, void __user *arg)
 {
 	int err;
 	struct arpreq r;
diff -Nru a/net/ipv4/devinet.c b/net/ipv4/devinet.c
--- a/net/ipv4/devinet.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv4/devinet.c	Tue Jun 15 22:20:38 2004
@@ -489,7 +489,7 @@
 }
 
 
-int devinet_ioctl(unsigned int cmd, void *arg)
+int devinet_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct ifreq ifr;
 	struct sockaddr_in sin_orig;
@@ -713,7 +713,7 @@
 	goto out;
 }
 
-static int inet_gifconf(struct net_device *dev, char *buf, int len)
+static int inet_gifconf(struct net_device *dev, char __user *buf, int len)
 {
 	struct in_device *in_dev = __in_dev_get(dev);
 	struct in_ifaddr *ifa;
@@ -1136,7 +1136,7 @@
 }
 
 static int devinet_sysctl_forward(ctl_table *ctl, int write,
-				  struct file* filp, void *buffer,
+				  struct file* filp, void __user *buffer,
 				  size_t *lenp)
 {
 	int *valp = ctl->data;
@@ -1154,7 +1154,7 @@
 }
 
 int ipv4_doint_and_flush(ctl_table *ctl, int write,
-			 struct file* filp, void *buffer,
+			 struct file* filp, void __user *buffer,
 			 size_t *lenp)
 {
 	int *valp = ctl->data;
@@ -1167,9 +1167,9 @@
 	return ret;
 }
 
-int ipv4_doint_and_flush_strategy(ctl_table *table, int *name, int nlen,
-				  void *oldval, size_t *oldlenp,
-				  void *newval, size_t newlen, 
+int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
+				  void __user *oldval, size_t __user *oldlenp,
+				  void __user *newval, size_t newlen, 
 				  void **context)
 {
 	int *valp = table->data;
@@ -1181,7 +1181,7 @@
 	if (newlen != sizeof(int))
 		return -EINVAL;
 
-	if (get_user(new, (int *)newval))
+	if (get_user(new, (int __user *)newval))
 		return -EFAULT;
 
 	if (new == *valp)
diff -Nru a/net/ipv4/esp4.c b/net/ipv4/esp4.c
--- a/net/ipv4/esp4.c	Tue Jun 15 22:20:41 2004
+++ b/net/ipv4/esp4.c	Tue Jun 15 22:20:41 2004
@@ -20,10 +20,10 @@
 	__u8		proto;
 };
 
-int esp_output(struct sk_buff *skb)
+int esp_output(struct sk_buff **pskb)
 {
 	int err;
-	struct dst_entry *dst = skb->dst;
+	struct dst_entry *dst = (*pskb)->dst;
 	struct xfrm_state *x  = dst->xfrm;
 	struct iphdr *iph, *top_iph;
 	struct ip_esp_hdr *esph;
@@ -42,28 +42,28 @@
 		char 		buf[60];
 	} tmp_iph;
 
-	/* First, if the skb is not checksummed, complete checksum. */
-	if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) {
-		err = -EINVAL;
-		goto error_nolock;
+	if ((*pskb)->ip_summed == CHECKSUM_HW) {
+		err = skb_checksum_help(pskb, 0);
+		if (err)
+			goto error_nolock;
 	}
 
 	spin_lock_bh(&x->lock);
-	err = xfrm_check_output(x, skb, AF_INET);
+	err = xfrm_check_output(x, *pskb, AF_INET);
 	if (err)
 		goto error;
 	err = -ENOMEM;
 
 	/* Strip IP header in transport mode. Save it. */
 	if (!x->props.mode) {
-		iph = skb->nh.iph;
+		iph = (*pskb)->nh.iph;
 		memcpy(&tmp_iph, iph, iph->ihl*4);
-		__skb_pull(skb, iph->ihl*4);
+		__skb_pull(*pskb, iph->ihl*4);
 	}
 	/* Now skb is pure payload to encrypt */
 
 	/* Round to block size */
-	clen = skb->len;
+	clen = (*pskb)->len;
 
 	esp = x->data;
 	alen = esp->auth.icv_trunc_len;
@@ -73,23 +73,23 @@
 	if (esp->conf.padlen)
 		clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1);
 
-	if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0)
+	if ((nfrags = skb_cow_data(*pskb, clen-(*pskb)->len+alen, &trailer)) < 0)
 		goto error;
 
 	/* Fill padding... */
 	do {
 		int i;
-		for (i=0; i<clen-skb->len - 2; i++)
+		for (i=0; i<clen-(*pskb)->len - 2; i++)
 			*(u8*)(trailer->tail + i) = i+1;
 	} while (0);
-	*(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2;
-	pskb_put(skb, trailer, clen - skb->len);
+	*(u8*)(trailer->tail + clen-(*pskb)->len - 2) = (clen - (*pskb)->len)-2;
+	pskb_put(*pskb, trailer, clen - (*pskb)->len);
 
 	encap = x->encap;
 
-	iph = skb->nh.iph;
+	iph = (*pskb)->nh.iph;
 	if (x->props.mode) {
-		top_iph = (struct iphdr*)skb_push(skb, x->props.header_len);
+		top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len);
 		esph = (struct ip_esp_hdr*)(top_iph+1);
 		if (encap && encap->encap_type) {
 			switch (encap->encap_type) {
@@ -121,7 +121,7 @@
 		top_iph->tos = iph->tos;	/* DS disclosed */
 		if (x->props.flags & XFRM_STATE_NOECN)
 			IP_ECN_clear(top_iph);
-		top_iph->tot_len = htons(skb->len + alen);
+		top_iph->tot_len = htons((*pskb)->len + alen);
 		top_iph->frag_off = iph->frag_off&htons(IP_DF);
 		if (!(top_iph->frag_off))
 			ip_select_ident(top_iph, dst, 0);
@@ -129,10 +129,10 @@
 		top_iph->check = 0;
 		top_iph->saddr = x->props.saddr.a4;
 		top_iph->daddr = x->id.daddr.a4;
-		memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
+		memset(&(IPCB(*pskb)->opt), 0, sizeof(struct ip_options));
 	} else {
-		esph = (struct ip_esp_hdr*)skb_push(skb, x->props.header_len);
-		top_iph = (struct iphdr*)skb_push(skb, iph->ihl*4);
+		esph = (struct ip_esp_hdr*)skb_push(*pskb, x->props.header_len);
+		top_iph = (struct iphdr*)skb_push(*pskb, iph->ihl*4);
 		memcpy(top_iph, &tmp_iph, iph->ihl*4);
 		if (encap && encap->encap_type) {
 			switch (encap->encap_type) {
@@ -159,7 +159,7 @@
 		} else
 			top_iph->protocol = IPPROTO_ESP;
 		iph = &tmp_iph.iph;
-		top_iph->tot_len = htons(skb->len + alen);
+		top_iph->tot_len = htons((*pskb)->len + alen);
 		top_iph->check = 0;
 		top_iph->frag_off = iph->frag_off;
 		*(u8*)(trailer->tail - 1) = iph->protocol;
@@ -169,7 +169,7 @@
 	if (encap && uh) {
 		uh->source = encap->encap_sport;
 		uh->dest = encap->encap_dport;
-		uh->len = htons(skb->len + alen - sizeof(struct iphdr));
+		uh->len = htons((*pskb)->len + alen - sizeof(struct iphdr));
 		uh->check = 0;
 	}
 
@@ -188,7 +188,7 @@
 			if (!sg)
 				goto error;
 		}
-		skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen);
+		skb_to_sgvec(*pskb, sg, esph->enc_data+esp->conf.ivlen-(*pskb)->data, clen);
 		crypto_cipher_encrypt(tfm, sg, sg, clen);
 		if (unlikely(sg != sgbuf))
 			kfree(sg);
@@ -200,19 +200,19 @@
 	}
 
 	if (esp->auth.icv_full_len) {
-		esp->auth.icv(esp, skb, (u8*)esph-skb->data,
+		esp->auth.icv(esp, *pskb, (u8*)esph-(*pskb)->data,
 		              sizeof(struct ip_esp_hdr) + esp->conf.ivlen+clen, trailer->tail);
-		pskb_put(skb, trailer, alen);
+		pskb_put(*pskb, trailer, alen);
 	}
 
 	ip_send_check(top_iph);
 
-	skb->nh.raw = skb->data;
+	(*pskb)->nh.raw = (*pskb)->data;
 
-	x->curlft.bytes += skb->len;
+	x->curlft.bytes += (*pskb)->len;
 	x->curlft.packets++;
 	spin_unlock_bh(&x->lock);
-	if ((skb->dst = dst_pop(dst)) == NULL) {
+	if (((*pskb)->dst = dst_pop(dst)) == NULL) {
 		err = -EHOSTUNREACH;
 		goto error_nolock;
 	}
@@ -221,7 +221,7 @@
 error:
 	spin_unlock_bh(&x->lock);
 error_nolock:
-	kfree_skb(skb);
+	kfree_skb(*pskb);
 	return err;
 }
 
diff -Nru a/net/ipv4/igmp.c b/net/ipv4/igmp.c
--- a/net/ipv4/igmp.c	Tue Jun 15 22:21:04 2004
+++ b/net/ipv4/igmp.c	Tue Jun 15 22:21:04 2004
@@ -292,6 +292,7 @@
 		}
 	}
 	if (rt->rt_src == 0) {
+		kfree_skb(skb);
 		ip_rt_put(rt);
 		return 0;
 	}
@@ -1912,7 +1913,7 @@
 }
 
 int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
-	struct ip_msfilter *optval, int *optlen)
+	struct ip_msfilter __user *optval, int __user *optlen)
 {
 	int err, len, count, copycount;
 	struct ip_mreqn	imr;
@@ -1958,11 +1959,11 @@
 	len = copycount * sizeof(psl->sl_addr[0]);
 	msf->imsf_numsrc = count;
 	if (put_user(IP_MSFILTER_SIZE(copycount), optlen) ||
-	    copy_to_user((void *)optval, msf, IP_MSFILTER_SIZE(0))) {
+	    copy_to_user(optval, msf, IP_MSFILTER_SIZE(0))) {
 		return -EFAULT;
 	}
 	if (len &&
-	    copy_to_user((void *)&optval->imsf_slist[0], psl->sl_addr, len))
+	    copy_to_user(&optval->imsf_slist[0], psl->sl_addr, len))
 		return -EFAULT;
 	return 0;
 done:
@@ -1971,7 +1972,7 @@
 }
 
 int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
-	struct group_filter *optval, int *optlen)
+	struct group_filter __user *optval, int __user *optlen)
 {
 	int err, i, count, copycount;
 	struct sockaddr_in *psin;
@@ -2005,7 +2006,7 @@
 	copycount = count < gsf->gf_numsrc ? count : gsf->gf_numsrc;
 	gsf->gf_numsrc = count;
 	if (put_user(GROUP_FILTER_SIZE(copycount), optlen) ||
-	    copy_to_user((void *)optval, gsf, GROUP_FILTER_SIZE(0))) {
+	    copy_to_user(optval, gsf, GROUP_FILTER_SIZE(0))) {
 		return -EFAULT;
 	}
 	for (i=0; i<copycount; i++) {
@@ -2016,7 +2017,7 @@
 		memset(&ss, 0, sizeof(ss));
 		psin->sin_family = AF_INET;
 		psin->sin_addr.s_addr = psl->sl_addr[i];
-		if (copy_to_user((void *)&optval->gf_slist[i], &ss, sizeof(ss)))
+		if (copy_to_user(&optval->gf_slist[i], &ss, sizeof(ss)))
 			return -EFAULT;
 	}
 	return 0;
diff -Nru a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
--- a/net/ipv4/ip_forward.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv4/ip_forward.c	Tue Jun 15 22:20:36 2004
@@ -46,7 +46,7 @@
 {
 	struct ip_options * opt	= &(IPCB(skb)->opt);
 
-	IP_INC_STATS_BH(IpForwDatagrams);
+	IP_INC_STATS_BH(OutForwDatagrams);
 
 	if (unlikely(opt->optlen))
 		ip_forward_options(skb);
diff -Nru a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
--- a/net/ipv4/ip_fragment.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv4/ip_fragment.c	Tue Jun 15 22:20:38 2004
@@ -263,7 +263,7 @@
 		spin_unlock(&qp->lock);
 
 		ipq_put(qp);
-		IP_INC_STATS_BH(IpReasmFails);
+		IP_INC_STATS_BH(ReasmFails);
 	}
 }
 
@@ -281,8 +281,8 @@
 
 	ipq_kill(qp);
 
-	IP_INC_STATS_BH(IpReasmTimeout);
-	IP_INC_STATS_BH(IpReasmFails);
+	IP_INC_STATS_BH(ReasmTimeout);
+	IP_INC_STATS_BH(ReasmFails);
 
 	if ((qp->last_in&FIRST_IN) && qp->fragments != NULL) {
 		struct sk_buff *head = qp->fragments;
@@ -609,7 +609,7 @@
 	iph = head->nh.iph;
 	iph->frag_off = 0;
 	iph->tot_len = htons(len);
-	IP_INC_STATS_BH(IpReasmOKs);
+	IP_INC_STATS_BH(ReasmOKs);
 	qp->fragments = NULL;
 	return head;
 
@@ -625,7 +625,7 @@
 			"Oversized IP packet from %d.%d.%d.%d.\n",
 			NIPQUAD(qp->saddr));
 out_fail:
-	IP_INC_STATS_BH(IpReasmFails);
+	IP_INC_STATS_BH(ReasmFails);
 	return NULL;
 }
 
@@ -636,7 +636,7 @@
 	struct ipq *qp;
 	struct net_device *dev;
 	
-	IP_INC_STATS_BH(IpReasmReqds);
+	IP_INC_STATS_BH(ReasmReqds);
 
 	/* Start by cleaning up the memory. */
 	if (atomic_read(&ip_frag_mem) > sysctl_ipfrag_high_thresh)
@@ -661,7 +661,7 @@
 		return ret;
 	}
 
-	IP_INC_STATS_BH(IpReasmFails);
+	IP_INC_STATS_BH(ReasmFails);
 	kfree_skb(skb);
 	return NULL;
 }
diff -Nru a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
--- a/net/ipv4/ip_input.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv4/ip_input.c	Tue Jun 15 22:20:36 2004
@@ -150,7 +150,7 @@
  *	SNMP management statistics
  */
 
-DEFINE_SNMP_STAT(struct ip_mib, ip_statistics);
+DEFINE_SNMP_STAT(struct ipstats_mib, ip_statistics);
 
 /*
  *	Process Router Attention IP option
@@ -249,16 +249,16 @@
 				protocol = -ret;
 				goto resubmit;
 			}
-			IP_INC_STATS_BH(IpInDelivers);
+			IP_INC_STATS_BH(InDelivers);
 		} else {
 			if (!raw_sk) {
 				if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
-					IP_INC_STATS_BH(IpInUnknownProtos);
+					IP_INC_STATS_BH(InUnknownProtos);
 					icmp_send(skb, ICMP_DEST_UNREACH,
 						  ICMP_PROT_UNREACH, 0);
 				}
 			} else
-				IP_INC_STATS_BH(IpInDelivers);
+				IP_INC_STATS_BH(InDelivers);
 			kfree_skb(skb);
 		}
 	}
@@ -324,7 +324,7 @@
 		*/
 
 		if (skb_cow(skb, skb_headroom(skb))) {
-			IP_INC_STATS_BH(IpInDiscards);
+			IP_INC_STATS_BH(InDiscards);
 			goto drop;
 		}
 		iph = skb->nh.iph;
@@ -353,7 +353,7 @@
 	return dst_input(skb);
 
 inhdr_error:
-	IP_INC_STATS_BH(IpInHdrErrors);
+	IP_INC_STATS_BH(InHdrErrors);
 drop:
         kfree_skb(skb);
         return NET_RX_DROP;
@@ -372,10 +372,10 @@
 	if (skb->pkt_type == PACKET_OTHERHOST)
 		goto drop;
 
-	IP_INC_STATS_BH(IpInReceives);
+	IP_INC_STATS_BH(InReceives);
 
 	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
-		IP_INC_STATS_BH(IpInDiscards);
+		IP_INC_STATS_BH(InDiscards);
 		goto out;
 	}
 
@@ -426,7 +426,7 @@
 		       ip_rcv_finish);
 
 inhdr_error:
-	IP_INC_STATS_BH(IpInHdrErrors);
+	IP_INC_STATS_BH(InHdrErrors);
 drop:
         kfree_skb(skb);
 out:
diff -Nru a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
--- a/net/ipv4/ip_output.c	Tue Jun 15 22:21:04 2004
+++ b/net/ipv4/ip_output.c	Tue Jun 15 22:21:04 2004
@@ -223,8 +223,9 @@
 		       ip_finish_output2);
 }
 
-int ip_mc_output(struct sk_buff *skb)
+int ip_mc_output(struct sk_buff **pskb)
 {
+	struct sk_buff *skb = *pskb;
 	struct sock *sk = skb->sk;
 	struct rtable *rt = (struct rtable*)skb->dst;
 	struct net_device *dev = rt->u.dst.dev;
@@ -232,7 +233,7 @@
 	/*
 	 *	If the indicated interface is up and running, send the packet.
 	 */
-	IP_INC_STATS(IpOutRequests);
+	IP_INC_STATS(OutRequests);
 
 	skb->dev = dev;
 	skb->protocol = htons(ETH_P_IP);
@@ -283,9 +284,11 @@
 		return ip_finish_output(skb);
 }
 
-int ip_output(struct sk_buff *skb)
+int ip_output(struct sk_buff **pskb)
 {
-	IP_INC_STATS(IpOutRequests);
+	struct sk_buff *skb = *pskb;
+
+	IP_INC_STATS(OutRequests);
 
 	if ((skb->len > dst_pmtu(skb->dst) || skb_shinfo(skb)->frag_list) &&
 	    !skb_shinfo(skb)->tso_size)
@@ -390,7 +393,7 @@
 		       dst_output);
 
 no_route:
-	IP_INC_STATS(IpOutNoRoutes);
+	IP_INC_STATS(OutNoRoutes);
 	kfree_skb(skb);
 	return -EHOSTUNREACH;
 }
@@ -547,7 +550,7 @@
 		}
 
 		if (err == 0) {
-			IP_INC_STATS(IpFragOKs);
+			IP_INC_STATS(FragOKs);
 			return 0;
 		}
 
@@ -556,7 +559,7 @@
 			kfree_skb(frag);
 			frag = skb;
 		}
-		IP_INC_STATS(IpFragFails);
+		IP_INC_STATS(FragFails);
 		return err;
 	}
 
@@ -567,7 +570,7 @@
 #ifdef CONFIG_BRIDGE_NETFILTER
 	/* for bridged IP traffic encapsulated inside f.e. a vlan header,
 	 * we need to make room for the encapsulating header */
-	ll_rs = LL_RESERVED_SPACE(rt->u.dst.dev + nf_bridge_pad(skb));
+	ll_rs = LL_RESERVED_SPACE_EXTRA(rt->u.dst.dev, nf_bridge_pad(skb));
 	mtu -= nf_bridge_pad(skb);
 #else
 	ll_rs = LL_RESERVED_SPACE(rt->u.dst.dev);
@@ -662,7 +665,7 @@
 		 *	Put this fragment into the sending queue.
 		 */
 
-		IP_INC_STATS(IpFragCreates);
+		IP_INC_STATS(FragCreates);
 
 		iph->tot_len = htons(len + hlen);
 
@@ -673,12 +676,12 @@
 			goto fail;
 	}
 	kfree_skb(skb);
-	IP_INC_STATS(IpFragOKs);
+	IP_INC_STATS(FragOKs);
 	return err;
 
 fail:
 	kfree_skb(skb); 
-	IP_INC_STATS(IpFragFails);
+	IP_INC_STATS(FragFails);
 	return err;
 }
 
@@ -975,7 +978,7 @@
 
 error:
 	inet->cork.length -= length;
-	IP_INC_STATS(IpOutDiscards);
+	IP_INC_STATS(OutDiscards);
 	return err; 
 }
 
@@ -1088,7 +1091,7 @@
 
 error:
 	inet->cork.length -= size;
-	IP_INC_STATS(IpOutDiscards);
+	IP_INC_STATS(OutDiscards);
 	return err;
 }
 
@@ -1198,7 +1201,7 @@
 	return err;
 
 error:
-	IP_INC_STATS(IpOutDiscards);
+	IP_INC_STATS(OutDiscards);
 	goto out;
 }
 
diff -Nru a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
--- a/net/ipv4/ip_sockglue.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv4/ip_sockglue.c	Tue Jun 15 22:20:38 2004
@@ -384,7 +384,7 @@
  *	an IP socket.
  */
 
-int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int optlen)
+int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen)
 {
 	struct inet_opt *inet = inet_sk(sk);
 	int val=0,err;
@@ -401,12 +401,12 @@
 				optname == IP_MULTICAST_TTL || 
 				optname == IP_MULTICAST_LOOP) { 
 		if (optlen >= sizeof(int)) {
-			if (get_user(val, (int *) optval))
+			if (get_user(val, (int __user *) optval))
 				return -EFAULT;
 		} else if (optlen >= sizeof(char)) {
 			unsigned char ucval;
 
-			if (get_user(ucval, (unsigned char *) optval))
+			if (get_user(ucval, (unsigned char __user *) optval))
 				return -EFAULT;
 			val = (int) ucval;
 		}
@@ -875,7 +875,7 @@
  *	_received_ ones. The set sets the _sent_ ones.
  */
 
-int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen)
+int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen)
 {
 	struct inet_opt *inet = inet_sk(sk);
 	int val;
@@ -984,7 +984,7 @@
 
   			if(put_user(len, optlen))
   				return -EFAULT;
-			if(copy_to_user((void *)optval, &addr, len))
+			if(copy_to_user(optval, &addr, len))
 				return -EFAULT;
 			return 0;
 		}
@@ -1002,7 +1002,7 @@
 				return -EFAULT;
 			}
 			err = ip_mc_msfget(sk, &msf,
-				(struct ip_msfilter *)optval, optlen);
+				(struct ip_msfilter __user *)optval, optlen);
 			release_sock(sk);
 			return err;
 		}
@@ -1020,7 +1020,7 @@
 				return -EFAULT;
 			}
 			err = ip_mc_gsfget(sk, &gsf,
-				(struct group_filter *)optval, optlen);
+				(struct group_filter __user *)optval, optlen);
 			release_sock(sk);
 			return err;
 		}
diff -Nru a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
--- a/net/ipv4/ipcomp.c	Tue Jun 15 22:20:44 2004
+++ b/net/ipv4/ipcomp.c	Tue Jun 15 22:20:44 2004
@@ -143,10 +143,10 @@
 	skb->nh.raw = skb->data;
 }
 
-static int ipcomp_output(struct sk_buff *skb)
+static int ipcomp_output(struct sk_buff **pskb)
 {
 	int err;
-	struct dst_entry *dst = skb->dst;
+	struct dst_entry *dst = (*pskb)->dst;
 	struct xfrm_state *x = dst->xfrm;
 	struct iphdr *iph, *top_iph;
 	struct ip_comp_hdr *ipch;
@@ -157,25 +157,26 @@
 	} tmp_iph;
 	int hdr_len = 0;
 
-	if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) {
-		err = -EINVAL;
-		goto error_nolock;
+	if ((*pskb)->ip_summed == CHECKSUM_HW) {
+		err = skb_checksum_help(pskb, 0);
+		if (err)
+			goto error_nolock;
 	}
 
 	spin_lock_bh(&x->lock);
-	err = xfrm_check_output(x, skb, AF_INET);
+	err = xfrm_check_output(x, *pskb, AF_INET);
 	if (err)
 		goto error;
 
 	/* Don't bother compressing */
 	if (!x->props.mode) {
-		iph = skb->nh.iph;
+		iph = (*pskb)->nh.iph;
 		hdr_len = iph->ihl * 4;
 	}
-	if ((skb->len - hdr_len) < ipcd->threshold) {
+	if (((*pskb)->len - hdr_len) < ipcd->threshold) {
 		if (x->props.mode) {
-			ipcomp_tunnel_encap(x, skb);
-			iph = skb->nh.iph;
+			ipcomp_tunnel_encap(x, *pskb);
+			iph = (*pskb)->nh.iph;
 			iph->protocol = IPPROTO_IPIP;
 			ip_send_check(iph);
 		}
@@ -183,19 +184,19 @@
 	}
 
 	if (x->props.mode) 
-		ipcomp_tunnel_encap(x, skb);
+		ipcomp_tunnel_encap(x, *pskb);
 
-	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
-	    skb_linearize(skb, GFP_ATOMIC) != 0) {
+	if ((skb_is_nonlinear(*pskb) || skb_cloned(*pskb)) &&
+	    skb_linearize(*pskb, GFP_ATOMIC) != 0) {
 	    	err = -ENOMEM;
 	    	goto error;
 	}
 	
-	err = ipcomp_compress(x, skb);
+	err = ipcomp_compress(x, *pskb);
 	if (err) {
 		if (err == -EMSGSIZE) {
 			if (x->props.mode) {
-				iph = skb->nh.iph;
+				iph = (*pskb)->nh.iph;
 				iph->protocol = IPPROTO_IPIP;
 				ip_send_check(iph);
 			}
@@ -205,14 +206,14 @@
 	}
 
 	/* Install ipcomp header, convert into ipcomp datagram. */
-	iph = skb->nh.iph;
+	iph = (*pskb)->nh.iph;
 	memcpy(&tmp_iph, iph, iph->ihl * 4);
-	top_iph = (struct iphdr *)skb_push(skb, sizeof(struct ip_comp_hdr));
+	top_iph = (struct iphdr *)skb_push(*pskb, sizeof(struct ip_comp_hdr));
 	memcpy(top_iph, &tmp_iph, iph->ihl * 4);
 	iph = top_iph;
 	if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN))
 		IP_ECN_clear(iph);
-	iph->tot_len = htons(skb->len);
+	iph->tot_len = htons((*pskb)->len);
 	iph->protocol = IPPROTO_COMP;
 	iph->check = 0;
 	ipch = (struct ip_comp_hdr *)((char *)iph + iph->ihl * 4);
@@ -220,14 +221,14 @@
 	ipch->flags = 0;
 	ipch->cpi = htons((u16 )ntohl(x->id.spi));
 	ip_send_check(iph);
-	skb->nh.raw = skb->data;
+	(*pskb)->nh.raw = (*pskb)->data;
 
 out_ok:
-	x->curlft.bytes += skb->len;
+	x->curlft.bytes += (*pskb)->len;
 	x->curlft.packets++;
 	spin_unlock_bh(&x->lock);
 	
-	if ((skb->dst = dst_pop(dst)) == NULL) {
+	if (((*pskb)->dst = dst_pop(dst)) == NULL) {
 		err = -EHOSTUNREACH;
 		goto error_nolock;
 	}
@@ -238,7 +239,7 @@
 error:
 	spin_unlock_bh(&x->lock);
 error_nolock:
-	kfree_skb(skb);
+	kfree_skb(*pskb);
 	goto out_exit;
 }
 
@@ -339,6 +340,7 @@
 	struct ipcomp_data *ipcd = x->data;
 	if (!ipcd)
 		return;
+	xfrm_state_delete_tunnel(x);
 	ipcomp_free_data(ipcd);
 	kfree(ipcd);
 }
diff -Nru a/net/ipv4/ipip.c b/net/ipv4/ipip.c
--- a/net/ipv4/ipip.c	Tue Jun 15 22:21:05 2004
+++ b/net/ipv4/ipip.c	Tue Jun 15 22:21:05 2004
@@ -479,6 +479,7 @@
 	read_lock(&ipip_lock);
 	if ((tunnel = ipip_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) {
 		if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
+			read_unlock(&ipip_lock);
 			kfree_skb(skb);
 			return 0;
 		}
diff -Nru a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
--- a/net/ipv4/ipmr.c	Tue Jun 15 22:20:40 2004
+++ b/net/ipv4/ipmr.c	Tue Jun 15 22:20:40 2004
@@ -844,7 +844,7 @@
  *	MOSPF/PIM router set up we can clean this up.
  */
  
-int ip_mroute_setsockopt(struct sock *sk,int optname,char *optval,int optlen)
+int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int optlen)
 {
 	int ret;
 	struct vifctl vif;
@@ -925,7 +925,7 @@
 		case MRT_ASSERT:
 		{
 			int v;
-			if(get_user(v,(int *)optval))
+			if(get_user(v,(int __user *)optval))
 				return -EFAULT;
 			mroute_do_assert=(v)?1:0;
 			return 0;
@@ -934,7 +934,7 @@
 		case MRT_PIM:
 		{
 			int v, ret;
-			if(get_user(v,(int *)optval))
+			if(get_user(v,(int __user *)optval))
 				return -EFAULT;
 			v = (v)?1:0;
 			rtnl_lock();
@@ -970,7 +970,7 @@
  *	Getsock opt support for the multicast routing system.
  */
  
-int ip_mroute_getsockopt(struct sock *sk,int optname,char *optval,int *optlen)
+int ip_mroute_getsockopt(struct sock *sk,int optname,char __user *optval,int __user *optlen)
 {
 	int olr;
 	int val;
@@ -1008,7 +1008,7 @@
  *	The IP multicast ioctl support routines.
  */
  
-int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg)
+int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
 {
 	struct sioc_sg_req sr;
 	struct sioc_vif_req vr;
@@ -1018,7 +1018,7 @@
 	switch(cmd)
 	{
 		case SIOCGETVIFCNT:
-			if (copy_from_user(&vr,(void *)arg,sizeof(vr)))
+			if (copy_from_user(&vr,arg,sizeof(vr)))
 				return -EFAULT; 
 			if(vr.vifi>=maxvif)
 				return -EINVAL;
@@ -1031,14 +1031,14 @@
 				vr.obytes=vif->bytes_out;
 				read_unlock(&mrt_lock);
 
-				if (copy_to_user((void *)arg,&vr,sizeof(vr)))
+				if (copy_to_user(arg,&vr,sizeof(vr)))
 					return -EFAULT;
 				return 0;
 			}
 			read_unlock(&mrt_lock);
 			return -EADDRNOTAVAIL;
 		case SIOCGETSGCNT:
-			if (copy_from_user(&sr,(void *)arg,sizeof(sr)))
+			if (copy_from_user(&sr,arg,sizeof(sr)))
 				return -EFAULT;
 
 			read_lock(&mrt_lock);
@@ -1049,7 +1049,7 @@
 				sr.wrong_if = c->mfc_un.res.wrong_if;
 				read_unlock(&mrt_lock);
 
-				if (copy_to_user((void *)arg,&sr,sizeof(sr)))
+				if (copy_to_user(arg,&sr,sizeof(sr)))
 					return -EFAULT;
 				return 0;
 			}
@@ -1115,7 +1115,7 @@
 {
 	struct ip_options * opt	= &(IPCB(skb)->opt);
 
-	IP_INC_STATS_BH(IpForwDatagrams);
+	IP_INC_STATS_BH(OutForwDatagrams);
 
 	if (unlikely(opt->optlen))
 		ip_forward_options(skb);
@@ -1178,7 +1178,7 @@
 		   to blackhole.
 		 */
 
-		IP_INC_STATS_BH(IpFragFails);
+		IP_INC_STATS_BH(FragFails);
 		ip_rt_put(rt);
 		goto out_free;
 	}
diff -Nru a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
--- a/net/ipv4/ipvs/ip_vs_core.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv4/ipvs/ip_vs_core.c	Tue Jun 15 22:20:36 2004
@@ -735,6 +735,13 @@
 	if (skb->nfcache & NFC_IPVS_PROPERTY)
 		return NF_ACCEPT;
 
+	if (skb->ip_summed == CHECKSUM_HW) {
+		if (skb_checksum_help(pskb, (out == NULL)))
+			return NF_DROP;
+		if (skb != *pskb)
+			skb = *pskb;
+	}
+
 	iph = skb->nh.iph;
 	if (unlikely(iph->protocol == IPPROTO_ICMP)) {
 		int related, verdict = ip_vs_out_icmp(pskb, &related);
@@ -972,6 +979,13 @@
 			  skb->nh.iph->protocol,
 			  NIPQUAD(skb->nh.iph->daddr));
 		return NF_ACCEPT;
+	}
+
+	if (skb->ip_summed == CHECKSUM_HW) {
+		if (skb_checksum_help(pskb, (out == NULL)))
+			return NF_DROP;
+		if (skb != *pskb)
+			skb = *pskb;
 	}
 
 	iph = skb->nh.iph;
diff -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	Tue Jun 15 22:20:59 2004
+++ b/net/ipv4/ipvs/ip_vs_ctl.c	Tue Jun 15 22:20:59 2004
@@ -1347,7 +1347,7 @@
 
 static int
 proc_do_defense_mode(ctl_table *table, int write, struct file * filp,
-		     void *buffer, size_t *lenp)
+		     void __user *buffer, size_t *lenp)
 {
 	int *valp = table->data;
 	int val = *valp;
@@ -1370,7 +1370,7 @@
 
 static int
 proc_do_sync_threshold(ctl_table *table, int write, struct file *filp,
-		       void *buffer, size_t *lenp)
+		       void __user *buffer, size_t *lenp)
 {
 	int *valp = table->data;
 	int val[2];
@@ -1912,7 +1912,7 @@
 };
 
 static int
-do_ip_vs_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len)
+do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
 {
 	int ret;
 	unsigned char arg[MAX_ARG_LEN];
diff -Nru a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
--- a/net/ipv4/netfilter/arp_tables.c	Tue Jun 15 22:20:43 2004
+++ b/net/ipv4/netfilter/arp_tables.c	Tue Jun 15 22:20:43 2004
@@ -179,11 +179,10 @@
 		return 0;
 	}
 
-	/* Look for ifname matches; this should unroll nicely. */
-	for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
-		ret |= (((const unsigned long *)indev)[i]
-			^ ((const unsigned long *)arpinfo->iniface)[i])
-			& ((const unsigned long *)arpinfo->iniface_mask)[i];
+	/* Look for ifname matches.  */
+	for (i = 0, ret = 0; i < IFNAMSIZ; i++) {
+		ret |= (indev[i] ^ arpinfo->iniface[i])
+			& arpinfo->iniface_mask[i];
 	}
 
 	if (FWINV(ret != 0, ARPT_INV_VIA_IN)) {
@@ -388,12 +387,12 @@
 }
 #endif
 
-static inline struct arpt_table *find_table_lock(const char *name, int *error, struct semaphore *mutex)
+static inline struct arpt_table *arpt_find_table_lock(const char *name, int *error, struct semaphore *mutex)
 {
 	return find_inlist_lock(&arpt_tables, name, "arptable_", error, mutex);
 }
 
-static inline struct arpt_target *find_target_lock(const char *name, int *error, struct semaphore *mutex)
+struct arpt_target *arpt_find_target_lock(const char *name, int *error, struct semaphore *mutex)
 {
 	return find_inlist_lock(&arpt_target, name, "arpt_", error, mutex);
 }
@@ -543,7 +542,7 @@
 	}
 
 	t = arpt_get_target(e);
-	target = find_target_lock(t->u.user.name, &ret, &arpt_mutex);
+	target = arpt_find_target_lock(t->u.user.name, &ret, &arpt_mutex);
 	if (!target) {
 		duprintf("check_entry: `%s' not found\n", t->u.user.name);
 		goto out;
@@ -778,7 +777,7 @@
 
 static int copy_entries_to_user(unsigned int total_size,
 				struct arpt_table *table,
-				void *userptr)
+				void __user *userptr)
 {
 	unsigned int off, num, countersize;
 	struct arpt_entry *e;
@@ -838,12 +837,12 @@
 }
 
 static int get_entries(const struct arpt_get_entries *entries,
-		       struct arpt_get_entries *uptr)
+		       struct arpt_get_entries __user *uptr)
 {
 	int ret;
 	struct arpt_table *t;
 
-	t = find_table_lock(entries->name, &ret, &arpt_mutex);
+	t = arpt_find_table_lock(entries->name, &ret, &arpt_mutex);
 	if (t) {
 		duprintf("t->private->number = %u\n",
 			 t->private->number);
@@ -864,7 +863,7 @@
 	return ret;
 }
 
-static int do_replace(void *user, unsigned int len)
+static int do_replace(void __user *user, unsigned int len)
 {
 	int ret;
 	struct arpt_replace tmp;
@@ -909,7 +908,7 @@
 
 	duprintf("arp_tables: Translated table\n");
 
-	t = find_table_lock(tmp.name, &ret, &arpt_mutex);
+	t = arpt_find_table_lock(tmp.name, &ret, &arpt_mutex);
 	if (!t)
 		goto free_newinfo_counters_untrans;
 
@@ -980,7 +979,7 @@
 	return 0;
 }
 
-static int do_add_counters(void *user, unsigned int len)
+static int do_add_counters(void __user *user, unsigned int len)
 {
 	unsigned int i;
 	struct arpt_counters_info tmp, *paddc;
@@ -1002,7 +1001,7 @@
 		goto free;
 	}
 
-	t = find_table_lock(tmp.name, &ret, &arpt_mutex);
+	t = arpt_find_table_lock(tmp.name, &ret, &arpt_mutex);
 	if (!t)
 		goto free;
 
@@ -1027,7 +1026,7 @@
 	return ret;
 }
 
-static int do_arpt_set_ctl(struct sock *sk, int cmd, void *user, unsigned int len)
+static int do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
 {
 	int ret;
 
@@ -1051,7 +1050,7 @@
 	return ret;
 }
 
-static int do_arpt_get_ctl(struct sock *sk, int cmd, void *user, int *len)
+static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 {
 	int ret;
 
@@ -1075,7 +1074,7 @@
 			break;
 		}
 		name[ARPT_TABLE_MAXNAMELEN-1] = '\0';
-		t = find_table_lock(name, &ret, &arpt_mutex);
+		t = arpt_find_table_lock(name, &ret, &arpt_mutex);
 		if (t) {
 			struct arpt_getinfo info;
 
@@ -1323,6 +1322,7 @@
 EXPORT_SYMBOL(arpt_register_table);
 EXPORT_SYMBOL(arpt_unregister_table);
 EXPORT_SYMBOL(arpt_do_table);
+EXPORT_SYMBOL(arpt_find_target_lock);
 EXPORT_SYMBOL(arpt_register_target);
 EXPORT_SYMBOL(arpt_unregister_target);
 
diff -Nru a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
--- a/net/ipv4/netfilter/ip_conntrack_core.c	Tue Jun 15 22:20:35 2004
+++ b/net/ipv4/netfilter/ip_conntrack_core.c	Tue Jun 15 22:20:35 2004
@@ -324,8 +324,9 @@
 		ip_conntrack_destroyed(ct);
 
 	WRITE_LOCK(&ip_conntrack_lock);
-	/* Delete us from our own list to prevent corruption later */
-	list_del(&ct->sibling_list);
+	/* Make sure don't leave any orphaned expectations lying around */
+	if (ct->expecting)
+		remove_expectations(ct, 1);
 
 	/* Delete our master expectation */
 	if (ct->master) {
@@ -920,7 +921,7 @@
 }
 
 struct ip_conntrack_expect *
-ip_conntrack_expect_alloc()
+ip_conntrack_expect_alloc(void)
 {
 	struct ip_conntrack_expect *new;
 	
@@ -1127,10 +1128,8 @@
 	DUMP_TUPLE(newreply);
 
 	conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
-	if (!conntrack->master)
-		conntrack->helper = LIST_FIND(&helpers, helper_cmp,
-					      struct ip_conntrack_helper *,
-					      newreply);
+	if (!conntrack->master && list_empty(&conntrack->sibling_list))
+		conntrack->helper = ip_ct_find_helper(newreply);
 	WRITE_UNLOCK(&ip_conntrack_lock);
 
 	return 1;
@@ -1300,7 +1299,7 @@
 /* Reversing the socket's dst/src point of view gives us the reply
    mapping. */
 static int
-getorigdst(struct sock *sk, int optval, void *user, int *len)
+getorigdst(struct sock *sk, int optval, void __user *user, int *len)
 {
 	struct inet_opt *inet = inet_sk(sk);
 	struct ip_conntrack_tuple_hash *h;
diff -Nru a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c	Tue Jun 15 22:21:05 2004
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c	Tue Jun 15 22:21:05 2004
@@ -177,6 +177,8 @@
 
 	if (skb_copy_bits(skb, skb->nh.iph->ihl * 4, &tcph, sizeof(tcph)) != 0)
 		return -1;
+	if (skb->len < skb->nh.iph->ihl * 4 + tcph.doff * 4)
+		return -1;
 
 	/* If only reply is a RST, we can consider ourselves not to
 	   have an established connection: this is a fairly common
diff -Nru a/net/ipv4/netfilter/ip_fw_compat.c b/net/ipv4/netfilter/ip_fw_compat.c
--- a/net/ipv4/netfilter/ip_fw_compat.c	Tue Jun 15 22:20:39 2004
+++ b/net/ipv4/netfilter/ip_fw_compat.c	Tue Jun 15 22:20:39 2004
@@ -69,7 +69,8 @@
 	/* Assume worse case: any hook could change packet */
 	(*pskb)->nfcache |= NFC_UNKNOWN | NFC_ALTERED;
 	if ((*pskb)->ip_summed == CHECKSUM_HW)
-		(*pskb)->ip_summed = CHECKSUM_NONE;
+		if (skb_checksum_help(pskb, (out == NULL)))
+			return NF_DROP;
 
 	switch (hooknum) {
 	case NF_IP_PRE_ROUTING:
@@ -181,7 +182,7 @@
 
 extern int ip_fw_ctl(int optval, void *m, unsigned int len);
 
-static int sock_fn(struct sock *sk, int optval, void *user, unsigned int len)
+static int sock_fn(struct sock *sk, int optval, void __user *user, unsigned int len)
 {
 	/* MAX of:
 	   2.2: sizeof(struct ip_fwtest) (~14x4 + 3x4 = 17x4)
diff -Nru a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
--- a/net/ipv4/netfilter/ip_nat_standalone.c	Tue Jun 15 22:20:43 2004
+++ b/net/ipv4/netfilter/ip_nat_standalone.c	Tue Jun 15 22:20:43 2004
@@ -85,7 +85,8 @@
 
 	/* If we had a hardware checksum before, it's now invalid */
 	if ((*pskb)->ip_summed == CHECKSUM_HW)
-		(*pskb)->ip_summed = CHECKSUM_NONE;
+		if (skb_checksum_help(pskb, (out == NULL)))
+			return NF_DROP;
 
 	ct = ip_conntrack_get(*pskb, &ctinfo);
 	/* Can't track?  It's not due to stress, or conntrack would
diff -Nru a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
--- a/net/ipv4/netfilter/ip_tables.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv4/netfilter/ip_tables.c	Tue Jun 15 22:20:38 2004
@@ -61,9 +61,6 @@
 #endif
 #define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1))
 
-/* Mutex protects lists (only traversed in user context). */
-static DECLARE_MUTEX(ipt_mutex);
-
 /* Must have mutex */
 #define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0)
 #define ASSERT_WRITE_LOCK(x) IP_NF_ASSERT(down_trylock(&ipt_mutex) != 0)
@@ -418,7 +415,7 @@
 {
 	void *ret;
 
-#if 0
+#if 0 
 	duprintf("find_inlist: searching for `%s' in %s.\n",
 		 name, head == &ipt_target ? "ipt_target"
 		 : head == &ipt_match ? "ipt_match"
@@ -461,7 +458,7 @@
 #endif
 
 static inline struct ipt_table *
-find_table_lock(const char *name, int *error, struct semaphore *mutex)
+ipt_find_table_lock(const char *name, int *error, struct semaphore *mutex)
 {
 	return find_inlist_lock(&ipt_tables, name, "iptable_", error, mutex);
 }
@@ -472,8 +469,8 @@
 	return find_inlist_lock(&ipt_match, name, "ipt_", error, mutex);
 }
 
-static inline struct ipt_target *
-find_target_lock(const char *name, int *error, struct semaphore *mutex)
+struct ipt_target *
+ipt_find_target_lock(const char *name, int *error, struct semaphore *mutex)
 {
 	return find_inlist_lock(&ipt_target, name, "ipt_", error, mutex);
 }
@@ -688,7 +685,7 @@
 		goto cleanup_matches;
 
 	t = ipt_get_target(e);
-	target = find_target_lock(t->u.user.name, &ret, &ipt_mutex);
+	target = ipt_find_target_lock(t->u.user.name, &ret, &ipt_mutex);
 	if (!target) {
 		duprintf("check_entry: `%s' not found\n", t->u.user.name);
 		goto cleanup_matches;
@@ -942,7 +939,7 @@
 static int
 copy_entries_to_user(unsigned int total_size,
 		     struct ipt_table *table,
-		     void *userptr)
+		     void __user *userptr)
 {
 	unsigned int off, num, countersize;
 	struct ipt_entry *e;
@@ -1020,12 +1017,12 @@
 
 static int
 get_entries(const struct ipt_get_entries *entries,
-	    struct ipt_get_entries *uptr)
+	    struct ipt_get_entries __user *uptr)
 {
 	int ret;
 	struct ipt_table *t;
 
-	t = find_table_lock(entries->name, &ret, &ipt_mutex);
+	t = ipt_find_table_lock(entries->name, &ret, &ipt_mutex);
 	if (t) {
 		duprintf("t->private->number = %u\n",
 			 t->private->number);
@@ -1047,7 +1044,7 @@
 }
 
 static int
-do_replace(void *user, unsigned int len)
+do_replace(void __user *user, unsigned int len)
 {
 	int ret;
 	struct ipt_replace tmp;
@@ -1092,7 +1089,7 @@
 
 	duprintf("ip_tables: Translated table\n");
 
-	t = find_table_lock(tmp.name, &ret, &ipt_mutex);
+	t = ipt_find_table_lock(tmp.name, &ret, &ipt_mutex);
 	if (!t)
 		goto free_newinfo_counters_untrans;
 
@@ -1173,7 +1170,7 @@
 }
 
 static int
-do_add_counters(void *user, unsigned int len)
+do_add_counters(void __user *user, unsigned int len)
 {
 	unsigned int i;
 	struct ipt_counters_info tmp, *paddc;
@@ -1195,7 +1192,7 @@
 		goto free;
 	}
 
-	t = find_table_lock(tmp.name, &ret, &ipt_mutex);
+	t = ipt_find_table_lock(tmp.name, &ret, &ipt_mutex);
 	if (!t)
 		goto free;
 
@@ -1221,7 +1218,7 @@
 }
 
 static int
-do_ipt_set_ctl(struct sock *sk,	int cmd, void *user, unsigned int len)
+do_ipt_set_ctl(struct sock *sk,	int cmd, void __user *user, unsigned int len)
 {
 	int ret;
 
@@ -1246,7 +1243,7 @@
 }
 
 static int
-do_ipt_get_ctl(struct sock *sk, int cmd, void *user, int *len)
+do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 {
 	int ret;
 
@@ -1270,7 +1267,7 @@
 			break;
 		}
 		name[IPT_TABLE_MAXNAMELEN-1] = '\0';
-		t = find_table_lock(name, &ret, &ipt_mutex);
+		t = ipt_find_table_lock(name, &ret, &ipt_mutex);
 		if (t) {
 			struct ipt_getinfo info;
 
@@ -1855,6 +1852,7 @@
 EXPORT_SYMBOL(ipt_do_table);
 EXPORT_SYMBOL(ipt_register_target);
 EXPORT_SYMBOL(ipt_unregister_target);
+EXPORT_SYMBOL(ipt_find_target_lock);
 
 module_init(init);
 module_exit(fini);
diff -Nru a/net/ipv4/netfilter/ipt_ECN.c b/net/ipv4/netfilter/ipt_ECN.c
--- a/net/ipv4/netfilter/ipt_ECN.c	Tue Jun 15 22:21:04 2004
+++ b/net/ipv4/netfilter/ipt_ECN.c	Tue Jun 15 22:21:04 2004
@@ -50,7 +50,7 @@
 
 /* Return 0 if there was an error. */
 static inline int
-set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo)
+set_ect_tcp(struct sk_buff **pskb, const struct ipt_ECN_info *einfo, int inward)
 {
 	struct tcphdr tcph;
 	u_int16_t diffs[2];
@@ -74,11 +74,15 @@
 		if (!skb_ip_make_writable(pskb,
 					  (*pskb)->nh.iph->ihl*4+sizeof(tcph)))
 			return 0;
-		tcph.check = csum_fold(csum_partial((char *)diffs,
-		                                    sizeof(diffs),
-		                                    tcph.check^0xFFFF));
+		if ((*pskb)->ip_summed != CHECKSUM_HW)
+			tcph.check = csum_fold(csum_partial((char *)diffs,
+					       sizeof(diffs),
+					       tcph.check^0xFFFF));
 		memcpy((*pskb)->data + (*pskb)->nh.iph->ihl*4,
 		       &tcph, sizeof(tcph));
+		if ((*pskb)->ip_summed == CHECKSUM_HW)
+			if (skb_checksum_help(pskb, inward))
+				return 0;
 		(*pskb)->nfcache |= NFC_ALTERED;
 	}
 	return 1;
@@ -100,7 +104,7 @@
 
 	if (einfo->operation & (IPT_ECN_OP_SET_ECE | IPT_ECN_OP_SET_CWR)
 	    && (*pskb)->nh.iph->protocol == IPPROTO_TCP)
-		if (!set_ect_tcp(pskb, einfo))
+		if (!set_ect_tcp(pskb, einfo, (out == NULL)))
 			return NF_DROP;
 
 	return IPT_CONTINUE;
diff -Nru a/net/ipv4/netfilter/ipt_TCPMSS.c b/net/ipv4/netfilter/ipt_TCPMSS.c
--- a/net/ipv4/netfilter/ipt_TCPMSS.c	Tue Jun 15 22:20:40 2004
+++ b/net/ipv4/netfilter/ipt_TCPMSS.c	Tue Jun 15 22:20:40 2004
@@ -186,8 +186,9 @@
 	       newmss);
 
  retmodified:
-	/* If we had a hardware checksum before, it's now invalid */
-	(*pskb)->ip_summed = CHECKSUM_NONE;
+	/* We never hw checksum SYN packets.  */
+	BUG_ON((*pskb)->ip_summed == CHECKSUM_HW);
+
 	(*pskb)->nfcache |= NFC_UNKNOWN | NFC_ALTERED;
 	return IPT_CONTINUE;
 }
diff -Nru a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
--- a/net/ipv4/netfilter/ipt_recent.c	Tue Jun 15 22:20:37 2004
+++ b/net/ipv4/netfilter/ipt_recent.c	Tue Jun 15 22:20:37 2004
@@ -175,7 +175,7 @@
  * clear         -- Flush table, remove all entries
  */
 
-static int ip_recent_ctrl(struct file *file, const char *input, unsigned long size, void *data)
+static int ip_recent_ctrl(struct file *file, const char __user *input, unsigned long size, void *data)
 {
 	static const u_int32_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff };
 	u_int32_t val;
diff -Nru a/net/ipv4/proc.c b/net/ipv4/proc.c
--- a/net/ipv4/proc.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv4/proc.c	Tue Jun 15 22:20:36 2004
@@ -88,7 +88,7 @@
 };
 
 static unsigned long
-fold_field(void *mib[], int nr)
+__fold_field(void *mib[], int offt)
 {
 	unsigned long res = 0;
 	int i;
@@ -98,14 +98,41 @@
 			continue;
 		res +=
 		    *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) +
-					 sizeof (unsigned long) * nr));
+					 offt));
 		res +=
 		    *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) +
-					 sizeof (unsigned long) * nr));
+					 offt));
 	}
 	return res;
 }
 
+#define fold_field(_mib, _nr)	__fold_field(_mib, (sizeof(unsigned long) * (_nr)))
+
+/* snmp items */
+static struct snmp_item snmp4_ipstats_list[] = {
+#define __SNMP_GEN(x,y)	SNMP_ITEM(struct ipstats_mib, x, y)
+#define SNMP_GEN(x)	__SNMP_GEN(x, #x)
+	SNMP_GEN(InReceives),
+	SNMP_GEN(InHdrErrors),
+	SNMP_GEN(InAddrErrors),
+	__SNMP_GEN(OutForwDatagrams,"ForwDatagrams"),	/* for backward compatibility */
+	SNMP_GEN(InUnknownProtos),
+	SNMP_GEN(InDiscards),
+	SNMP_GEN(InDelivers),
+	SNMP_GEN(OutRequests),
+	SNMP_GEN(OutDiscards),
+	SNMP_GEN(OutNoRoutes),
+	SNMP_GEN(ReasmTimeout),
+	SNMP_GEN(ReasmReqds),
+	SNMP_GEN(ReasmOKs),
+	SNMP_GEN(ReasmFails),
+	SNMP_GEN(FragOKs),
+	SNMP_GEN(FragFails),
+	SNMP_GEN(FragCreates),
+	SNMP_ITEM_SENTINEL
+#undef SNMP_GEN
+};
+
 /*
  *	Called from the PROCfs module. This outputs /proc/net/snmp.
  */
@@ -113,17 +140,18 @@
 {
 	int i;
 
-	seq_printf(seq, "Ip: Forwarding DefaultTTL InReceives InHdrErrors "
-			"InAddrErrors ForwDatagrams InUnknownProtos "
-			"InDiscards InDelivers OutRequests OutDiscards "
-			"OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs "
-			"ReasmFails FragOKs FragFails FragCreates\nIp: %d %d",
+	seq_printf(seq, "Ip: Forwarding DefaultTTL");
+
+	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
+		seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
+
+	seq_printf(seq, "\nIp: %d %d",
 			ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl);
 
-	for (i = 0;
-	     i < offsetof(struct ip_mib, __pad) / sizeof(unsigned long); i++)
+	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
 		seq_printf(seq, " %lu",
-			   fold_field((void **) ip_statistics, i));
+			   __fold_field((void **) ip_statistics, 
+					snmp4_ipstats_list[i].offset));
 
 	seq_printf(seq, "\nIcmp: InMsgs InErrors InDestUnreachs InTimeExcds "
 			"InParmProbs InSrcQuenchs InRedirects InEchos "
diff -Nru a/net/ipv4/raw.c b/net/ipv4/raw.c
--- a/net/ipv4/raw.c	Tue Jun 15 22:20:41 2004
+++ b/net/ipv4/raw.c	Tue Jun 15 22:20:41 2004
@@ -319,7 +319,7 @@
 	err = -EFAULT;
 	kfree_skb(skb);
 error:
-	IP_INC_STATS(IpOutDiscards);
+	IP_INC_STATS(OutDiscards);
 	return err; 
 }
 
@@ -568,7 +568,7 @@
 	return 0;
 }
 
-static int raw_seticmpfilter(struct sock *sk, char *optval, int optlen)
+static int raw_seticmpfilter(struct sock *sk, char __user *optval, int optlen)
 {
 	if (optlen > sizeof(struct icmp_filter))
 		optlen = sizeof(struct icmp_filter);
@@ -577,7 +577,7 @@
 	return 0;
 }
 
-static int raw_geticmpfilter(struct sock *sk, char *optval, int *optlen)
+static int raw_geticmpfilter(struct sock *sk, char __user *optval, int __user *optlen)
 {
 	int len, ret = -EFAULT;
 
@@ -597,7 +597,7 @@
 }
 
 static int raw_setsockopt(struct sock *sk, int level, int optname, 
-			  char *optval, int optlen)
+			  char __user *optval, int optlen)
 {
 	if (level != SOL_RAW)
 		return ip_setsockopt(sk, level, optname, optval, optlen);
@@ -612,7 +612,7 @@
 }
 
 static int raw_getsockopt(struct sock *sk, int level, int optname, 
-			  char *optval, int *optlen)
+			  char __user *optval, int __user *optlen)
 {
 	if (level != SOL_RAW)
 		return ip_getsockopt(sk, level, optname, optval, optlen);
@@ -631,7 +631,7 @@
 	switch (cmd) {
 		case SIOCOUTQ: {
 			int amount = atomic_read(&sk->sk_wmem_alloc);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 		case SIOCINQ: {
 			struct sk_buff *skb;
@@ -642,12 +642,12 @@
 			if (skb != NULL)
 				amount = skb->len;
 			spin_unlock_irq(&sk->sk_receive_queue.lock);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 
 		default:
 #ifdef CONFIG_IP_MROUTE
-			return ipmr_ioctl(sk, cmd, arg);
+			return ipmr_ioctl(sk, cmd, (void __user *)arg);
 #else
 			return -ENOIOCTLCMD;
 #endif
diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
--- a/net/ipv4/route.c	Tue Jun 15 22:21:05 2004
+++ b/net/ipv4/route.c	Tue Jun 15 22:21:05 2004
@@ -138,6 +138,7 @@
 
 static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie);
 static void		 ipv4_dst_destroy(struct dst_entry *dst);
+static void		 ipv4_dst_ifdown(struct dst_entry *dst, int how);
 static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
 static void		 ipv4_link_failure(struct sk_buff *skb);
 static void		 ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu);
@@ -150,6 +151,7 @@
 	.gc =			rt_garbage_collect,
 	.check =		ipv4_dst_check,
 	.destroy =		ipv4_dst_destroy,
+	.ifdown =		ipv4_dst_ifdown,
 	.negative_advice =	ipv4_negative_advice,
 	.link_failure =		ipv4_link_failure,
 	.update_pmtu =		ip_rt_update_pmtu,
@@ -1040,6 +1042,8 @@
 				rt->u.dst.child		= NULL;
 				if (rt->u.dst.dev)
 					dev_hold(rt->u.dst.dev);
+				if (rt->idev)
+					in_dev_hold(rt->idev);
 				rt->u.dst.obsolete	= 0;
 				rt->u.dst.lastuse	= jiffies;
 				rt->u.dst.path		= &rt->u.dst;
@@ -1321,11 +1325,27 @@
 {
 	struct rtable *rt = (struct rtable *) dst;
 	struct inet_peer *peer = rt->peer;
+	struct in_device *idev = rt->idev;
 
 	if (peer) {
 		rt->peer = NULL;
 		inet_putpeer(peer);
 	}
+
+	if (idev) {
+		rt->idev = NULL;
+		in_dev_put(idev);
+	}
+}
+
+static void ipv4_dst_ifdown(struct dst_entry *dst, int how)
+{
+	struct rtable *rt = (struct rtable *) dst;
+	struct in_device *idev = rt->idev;
+	if (idev) {
+		rt->idev = NULL;
+		in_dev_put(idev);
+	}
 }
 
 static void ipv4_link_failure(struct sk_buff *skb)
@@ -1339,8 +1359,10 @@
 		dst_set_expires(&rt->u.dst, 0);
 }
 
-static int ip_rt_bug(struct sk_buff *skb)
+static int ip_rt_bug(struct sk_buff **pskb)
 {
+	struct sk_buff *skb = *pskb;
+
 	printk(KERN_DEBUG "ip_rt_bug: %u.%u.%u.%u -> %u.%u.%u.%u, %s\n",
 		NIPQUAD(skb->nh.iph->saddr), NIPQUAD(skb->nh.iph->daddr),
 		skb->dev ? skb->dev->name : "?");
@@ -1486,6 +1508,7 @@
 	rth->fl.iif	= dev->ifindex;
 	rth->u.dst.dev	= &loopback_dev;
 	dev_hold(rth->u.dst.dev);
+	rth->idev	= in_dev_get(rth->u.dst.dev);
 	rth->fl.oif	= 0;
 	rth->rt_gateway	= daddr;
 	rth->rt_spec_dst= spec_dst;
@@ -1695,6 +1718,7 @@
 	rth->fl.iif	= dev->ifindex;
 	rth->u.dst.dev	= out_dev->dev;
 	dev_hold(rth->u.dst.dev);
+	rth->idev	= in_dev_get(rth->u.dst.dev);
 	rth->fl.oif 	= 0;
 	rth->rt_spec_dst= spec_dst;
 
@@ -1774,6 +1798,7 @@
 	rth->fl.iif	= dev->ifindex;
 	rth->u.dst.dev	= &loopback_dev;
 	dev_hold(rth->u.dst.dev);
+	rth->idev	= in_dev_get(rth->u.dst.dev);
 	rth->rt_gateway	= daddr;
 	rth->rt_spec_dst= spec_dst;
 	rth->u.dst.input= ip_local_deliver;
@@ -2157,6 +2182,7 @@
 	rth->rt_iif	= oldflp->oif ? : dev_out->ifindex;
 	rth->u.dst.dev	= dev_out;
 	dev_hold(dev_out);
+	rth->idev	= in_dev_get(dev_out);
 	rth->rt_gateway = fl.fl4_dst;
 	rth->rt_spec_dst= fl.fl4_src;
 
@@ -2482,7 +2508,7 @@
 static int flush_delay;
 
 static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
-					struct file *filp, void *buffer,
+					struct file *filp, void __user *buffer,
 					size_t *lenp)
 {
 	if (write) {
@@ -2494,15 +2520,19 @@
 	return -EINVAL;
 }
 
-static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, int *name,
-						int nlen, void *oldval,
-						size_t *oldlenp, void *newval,
-						size_t newlen, void **context)
+static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table,
+						int __user *name,
+						int nlen,
+						void __user *oldval,
+						size_t __user *oldlenp,
+						void __user *newval,
+						size_t newlen,
+						void **context)
 {
 	int delay;
 	if (newlen != sizeof(int))
 		return -EINVAL;
-	if (get_user(delay, (int *)newval))
+	if (get_user(delay, (int __user *)newval))
 		return -EFAULT; 
 	rt_cache_flush(delay); 
 	return 0;
diff -Nru a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
--- a/net/ipv4/sysctl_net_ipv4.c	Tue Jun 15 22:20:43 2004
+++ b/net/ipv4/sysctl_net_ipv4.c	Tue Jun 15 22:20:43 2004
@@ -62,7 +62,7 @@
 
 static
 int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-			void *buffer, size_t *lenp)
+			void __user *buffer, size_t *lenp)
 {
 	int val = ipv4_devconf.forwarding;
 	int ret;
@@ -75,9 +75,10 @@
 	return ret;
 }
 
-static int ipv4_sysctl_forward_strategy(ctl_table *table, int *name, int nlen,
-			 void *oldval, size_t *oldlenp,
-			 void *newval, size_t newlen, 
+static int ipv4_sysctl_forward_strategy(ctl_table *table,
+			 int __user *name, int nlen,
+			 void __user *oldval, size_t __user *oldlenp,
+			 void __user *newval, size_t newlen, 
 			 void **context)
 {
 	int *valp = table->data;
@@ -89,7 +90,7 @@
 	if (newlen != sizeof(int))
 		return -EINVAL;
 
-	if (get_user(new, (int *)newval))
+	if (get_user(new, (int __user *)newval))
 		return -EFAULT;
 
 	if (new == *valp)
@@ -661,6 +662,22 @@
 		.ctl_name	= NET_TCP_BIC_LOW_WINDOW,
 		.procname	= "tcp_bic_low_window",
 		.data		= &sysctl_tcp_bic_low_window,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_TCP_DEFAULT_WIN_SCALE,
+		.procname	= "tcp_default_win_scale",
+		.data		= &sysctl_tcp_default_win_scale,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
+		.ctl_name	= NET_TCP_MODERATE_RCVBUF,
+		.procname	= "tcp_moderate_rcvbuf",
+		.data		= &sysctl_tcp_moderate_rcvbuf,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
diff -Nru a/net/ipv4/tcp.c b/net/ipv4/tcp.c
--- a/net/ipv4/tcp.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv4/tcp.c	Tue Jun 15 22:20:38 2004
@@ -276,6 +276,8 @@
 
 atomic_t tcp_orphan_count = ATOMIC_INIT(0);
 
+int sysctl_tcp_default_win_scale;
+
 int sysctl_tcp_mem[3];
 int sysctl_tcp_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 };
 int sysctl_tcp_rmem[3] = { 4 * 1024, 87380, 87380 * 2 };
@@ -528,7 +530,7 @@
 		return -ENOIOCTLCMD;
 	};
 
-	return put_user(answ, (int *)arg);
+	return put_user(answ, (int __user *)arg);
 }
 
 
@@ -646,7 +648,7 @@
 		local_bh_enable();
 		sock_put(child);
 
-		tcp_acceptq_removed(sk);
+		sk_acceptq_removed(sk);
 		tcp_openreq_fastfree(req);
 	}
 	BUG_TRAP(!sk->sk_ack_backlog);
@@ -964,7 +966,7 @@
 #define TCP_PAGE(sk)	(inet_sk(sk)->sndmsg_page)
 #define TCP_OFF(sk)	(inet_sk(sk)->sndmsg_off)
 
-static inline int tcp_copy_to_page(struct sock *sk, char *from,
+static inline int tcp_copy_to_page(struct sock *sk, char __user *from,
 				   struct sk_buff *skb, struct page *page,
 				   int off, int copy)
 {
@@ -989,7 +991,7 @@
 	return 0;
 }
 
-static inline int skb_add_data(struct sk_buff *skb, char *from, int copy)
+static inline int skb_add_data(struct sk_buff *skb, char __user *from, int copy)
 {
 	int err = 0;
 	unsigned int csum;
@@ -1063,7 +1065,7 @@
 
 	while (--iovlen >= 0) {
 		int seglen = iov->iov_len;
-		unsigned char *from = iov->iov_base;
+		unsigned char __user *from = iov->iov_base;
 
 		iov++;
 
@@ -1294,18 +1296,6 @@
 	return -EAGAIN;
 }
 
-/*
- *	Release a skb if it is no longer needed. This routine
- *	must be called with interrupts disabled or with the
- *	socket locked so that the sk_buff queue operation is ok.
- */
-
-static inline void tcp_eat_skb(struct sock *sk, struct sk_buff *skb)
-{
-	__skb_unlink(skb, &sk->sk_receive_queue);
-	__kfree_skb(skb);
-}
-
 /* Clean up the receive buffer for full frames taken by the user,
  * then send an ACK if necessary.  COPIED is the number of bytes
  * tcp_recvmsg has given to the user so far, it speeds up the
@@ -1366,31 +1356,6 @@
 		tcp_send_ack(sk);
 }
 
-/* Now socket state including sk->sk_err is changed only under lock,
- * hence we may omit checks after joining wait queue.
- * We check receive queue before schedule() only as optimization;
- * it is very likely that release_sock() added new data.
- */
-
-static long tcp_data_wait(struct sock *sk, long timeo)
-{
-	DEFINE_WAIT(wait);
-
-	prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
-
-	set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
-	release_sock(sk);
-
-	if (skb_queue_empty(&sk->sk_receive_queue))
-		timeo = schedule_timeout(timeo);
-
-	lock_sock(sk);
-	clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
-
-	finish_wait(sk->sk_sleep, &wait);
-	return timeo;
-}
-
 static void tcp_prequeue_process(struct sock *sk)
 {
 	struct sk_buff *skb;
@@ -1471,15 +1436,18 @@
 				break;
 		}
 		if (skb->h.th->fin) {
-			tcp_eat_skb(sk, skb);
+			sk_eat_skb(sk, skb);
 			++seq;
 			break;
 		}
-		tcp_eat_skb(sk, skb);
+		sk_eat_skb(sk, skb);
 		if (!desc->count)
 			break;
 	}
 	tp->copied_seq = seq;
+
+	tcp_rcv_space_adjust(sk);
+
 	/* Clean up data we have read: This will do ACK frames. */
 	if (copied)
 		cleanup_rbuf(sk, copied);
@@ -1667,9 +1635,8 @@
 			/* Do not sleep, just process backlog. */
 			release_sock(sk);
 			lock_sock(sk);
-		} else {
-			timeo = tcp_data_wait(sk, timeo);
-		}
+		} else
+			sk_wait_data(sk, &timeo);
 
 		if (user_recv) {
 			int chunk;
@@ -1740,6 +1707,8 @@
 		copied += used;
 		len -= used;
 
+		tcp_rcv_space_adjust(sk);
+
 skip_copy:
 		if (tp->urg_data && after(tp->copied_seq, tp->urg_seq)) {
 			tp->urg_data = 0;
@@ -1751,14 +1720,14 @@
 		if (skb->h.th->fin)
 			goto found_fin_ok;
 		if (!(flags & MSG_PEEK))
-			tcp_eat_skb(sk, skb);
+			sk_eat_skb(sk, skb);
 		continue;
 
 	found_fin_ok:
 		/* Process the FIN. */
 		++*seq;
 		if (!(flags & MSG_PEEK))
-			tcp_eat_skb(sk, skb);
+			sk_eat_skb(sk, skb);
 		break;
 	} while (len > 0);
 
@@ -2256,7 +2225,7 @@
 		tp->accept_queue_tail = NULL;
 
  	newsk = req->sk;
-	tcp_acceptq_removed(sk);
+	sk_acceptq_removed(sk);
 	tcp_openreq_fastfree(req);
 	BUG_TRAP(newsk->sk_state != TCP_SYN_RECV);
 	release_sock(sk);
@@ -2271,7 +2240,7 @@
 /*
  *	Socket option code for TCP.
  */
-int tcp_setsockopt(struct sock *sk, int level, int optname, char *optval,
+int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
 		   int optlen)
 {
 	struct tcp_opt *tp = tcp_sk(sk);
@@ -2285,7 +2254,7 @@
 	if (optlen < sizeof(int))
 		return -EINVAL;
 
-	if (get_user(val, (int *)optval))
+	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 
 	lock_sock(sk);
@@ -2435,8 +2404,8 @@
 	return err;
 }
 
-int tcp_getsockopt(struct sock *sk, int level, int optname, char *optval,
-		   int *optlen)
+int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
+		   int __user *optlen)
 {
 	struct tcp_opt *tp = tcp_sk(sk);
 	int val, len;
@@ -2491,56 +2460,11 @@
 		break;
 	case TCP_INFO: {
 		struct tcp_info info;
-		u32 now = tcp_time_stamp;
 
 		if (get_user(len, optlen))
 			return -EFAULT;
-		info.tcpi_state = sk->sk_state;
-		info.tcpi_ca_state = tp->ca_state;
-		info.tcpi_retransmits = tp->retransmits;
-		info.tcpi_probes = tp->probes_out;
-		info.tcpi_backoff = tp->backoff;
-		info.tcpi_options = 0;
-		if (tp->tstamp_ok)
-			info.tcpi_options |= TCPI_OPT_TIMESTAMPS;
-		if (tp->sack_ok)
-			info.tcpi_options |= TCPI_OPT_SACK;
-		if (tp->wscale_ok) {
-			info.tcpi_options |= TCPI_OPT_WSCALE;
-			info.tcpi_snd_wscale = tp->snd_wscale;
-			info.tcpi_rcv_wscale = tp->rcv_wscale;
-		} else {
-			info.tcpi_snd_wscale = 0;
-			info.tcpi_rcv_wscale = 0;
-		}
-		if (tp->ecn_flags & TCP_ECN_OK)
-			info.tcpi_options |= TCPI_OPT_ECN;
 
-		info.tcpi_rto = (1000000 * tp->rto) / HZ;
-		info.tcpi_ato = (1000000 * tp->ack.ato) / HZ;
-		info.tcpi_snd_mss = tp->mss_cache_std;
-		info.tcpi_rcv_mss = tp->ack.rcv_mss;
-
-		info.tcpi_unacked = tp->packets_out;
-		info.tcpi_sacked = tp->sacked_out;
-		info.tcpi_lost = tp->lost_out;
-		info.tcpi_retrans = tp->retrans_out;
-		info.tcpi_fackets = tp->fackets_out;
-
-		info.tcpi_last_data_sent = ((now - tp->lsndtime) * 1000) / HZ;
-		info.tcpi_last_ack_sent = 0;
-		info.tcpi_last_data_recv = ((now -
-					     tp->ack.lrcvtime) * 1000) / HZ;
-		info.tcpi_last_ack_recv = ((now - tp->rcv_tstamp) * 1000) / HZ;
-
-		info.tcpi_pmtu = tp->pmtu_cookie;
-		info.tcpi_rcv_ssthresh = tp->rcv_ssthresh;
-		info.tcpi_rtt = ((1000000 * tp->srtt) / HZ) >> 3;
-		info.tcpi_rttvar = ((1000000 * tp->mdev) / HZ) >> 2;
-		info.tcpi_snd_ssthresh = tp->snd_ssthresh;
-		info.tcpi_snd_cwnd = tp->snd_cwnd;
-		info.tcpi_advmss = tp->advmss;
-		info.tcpi_reordering = tp->reordering;
+		tcp_get_info(sk, &info);
 
 		len = min_t(unsigned int, len, sizeof(info));
 		if (put_user(len, optlen))
@@ -2675,10 +2599,6 @@
 	sysctl_tcp_mem[0] =  768 << order;
 	sysctl_tcp_mem[1] = 1024 << order;
 	sysctl_tcp_mem[2] = 1536 << order;
-	if (sysctl_tcp_mem[2] - sysctl_tcp_mem[1] > 512)
-		sysctl_tcp_mem[1] = sysctl_tcp_mem[2] - 512;
-	if (sysctl_tcp_mem[1] - sysctl_tcp_mem[0] > 512)
-		sysctl_tcp_mem[0] = sysctl_tcp_mem[1] - 512;
 
 	if (order < 3) {
 		sysctl_tcp_wmem[2] = 64 * 1024;
diff -Nru a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
--- a/net/ipv4/tcp_diag.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv4/tcp_diag.c	Tue Jun 15 22:20:36 2004
@@ -41,6 +41,61 @@
    rta->rta_len = rtalen;                   \
    RTA_DATA(rta); })
 
+/* Return information about state of tcp endpoint in API format. */
+void tcp_get_info(struct sock *sk, struct tcp_info *info)
+{
+	struct tcp_opt *tp = tcp_sk(sk);
+	u32 now = tcp_time_stamp;
+
+	memset(info, 0, sizeof(*info));
+
+	info->tcpi_state = sk->sk_state;
+	info->tcpi_ca_state = tp->ca_state;
+	info->tcpi_retransmits = tp->retransmits;
+	info->tcpi_probes = tp->probes_out;
+	info->tcpi_backoff = tp->backoff;
+
+	if (tp->tstamp_ok)
+		info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
+	if (tp->sack_ok)
+		info->tcpi_options |= TCPI_OPT_SACK;
+	if (tp->wscale_ok) {
+		info->tcpi_options |= TCPI_OPT_WSCALE;
+		info->tcpi_snd_wscale = tp->snd_wscale;
+		info->tcpi_rcv_wscale = tp->rcv_wscale;
+	} 
+
+	if (tp->ecn_flags&TCP_ECN_OK)
+		info->tcpi_options |= TCPI_OPT_ECN;
+
+	info->tcpi_rto = (1000000*tp->rto)/HZ;
+	info->tcpi_ato = (1000000*tp->ack.ato)/HZ;
+	info->tcpi_snd_mss = tp->mss_cache;
+	info->tcpi_rcv_mss = tp->ack.rcv_mss;
+
+	info->tcpi_unacked = tp->packets_out;
+	info->tcpi_sacked = tp->sacked_out;
+	info->tcpi_lost = tp->lost_out;
+	info->tcpi_retrans = tp->retrans_out;
+	info->tcpi_fackets = tp->fackets_out;
+
+	info->tcpi_last_data_sent = ((now - tp->lsndtime)*1000)/HZ;
+	info->tcpi_last_data_recv = ((now - tp->ack.lrcvtime)*1000)/HZ;
+	info->tcpi_last_ack_recv = ((now - tp->rcv_tstamp)*1000)/HZ;
+
+	info->tcpi_pmtu = tp->pmtu_cookie;
+	info->tcpi_rcv_ssthresh = tp->rcv_ssthresh;
+	info->tcpi_rtt = ((1000000*tp->srtt)/HZ)>>3;
+	info->tcpi_rttvar = ((1000000*tp->mdev)/HZ)>>2;
+	info->tcpi_snd_ssthresh = tp->snd_ssthresh;
+	info->tcpi_snd_cwnd = tp->snd_cwnd;
+	info->tcpi_advmss = tp->advmss;
+	info->tcpi_reordering = tp->reordering;
+
+	info->tcpi_rcv_rtt = ((1000000*tp->rcv_rtt_est.rtt)/HZ)>>3;
+	info->tcpi_rcv_space = tp->rcvq_space.space;
+}
+
 static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
 			int ext, u32 pid, u32 seq)
 {
@@ -150,55 +205,8 @@
 		minfo->tcpdiag_tmem = atomic_read(&sk->sk_wmem_alloc);
 	}
 
-	if (info) {
-		u32 now = tcp_time_stamp;
-
-		info->tcpi_state = sk->sk_state;
-		info->tcpi_ca_state = tp->ca_state;
-		info->tcpi_retransmits = tp->retransmits;
-		info->tcpi_probes = tp->probes_out;
-		info->tcpi_backoff = tp->backoff;
-		info->tcpi_options = 0;
-		if (tp->tstamp_ok)
-			info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
-		if (tp->sack_ok)
-			info->tcpi_options |= TCPI_OPT_SACK;
-		if (tp->wscale_ok) {
-			info->tcpi_options |= TCPI_OPT_WSCALE;
-			info->tcpi_snd_wscale = tp->snd_wscale;
-			info->tcpi_rcv_wscale = tp->rcv_wscale;
-		} else {
-			info->tcpi_snd_wscale = 0;
-			info->tcpi_rcv_wscale = 0;
-		}
-		if (tp->ecn_flags&TCP_ECN_OK)
-			info->tcpi_options |= TCPI_OPT_ECN;
-
-		info->tcpi_rto = (1000000*tp->rto)/HZ;
-		info->tcpi_ato = (1000000*tp->ack.ato)/HZ;
-		info->tcpi_snd_mss = tp->mss_cache;
-		info->tcpi_rcv_mss = tp->ack.rcv_mss;
-
-		info->tcpi_unacked = tp->packets_out;
-		info->tcpi_sacked = tp->sacked_out;
-		info->tcpi_lost = tp->lost_out;
-		info->tcpi_retrans = tp->retrans_out;
-		info->tcpi_fackets = tp->fackets_out;
-
-		info->tcpi_last_data_sent = ((now - tp->lsndtime)*1000)/HZ;
-		info->tcpi_last_ack_sent = 0;
-		info->tcpi_last_data_recv = ((now - tp->ack.lrcvtime)*1000)/HZ;
-		info->tcpi_last_ack_recv = ((now - tp->rcv_tstamp)*1000)/HZ;
-
-		info->tcpi_pmtu = tp->pmtu_cookie;
-		info->tcpi_rcv_ssthresh = tp->rcv_ssthresh;
-		info->tcpi_rtt = ((1000000*tp->srtt)/HZ)>>3;
-		info->tcpi_rttvar = ((1000000*tp->mdev)/HZ)>>2;
-		info->tcpi_snd_ssthresh = tp->snd_ssthresh;
-		info->tcpi_snd_cwnd = tp->snd_cwnd;
-		info->tcpi_advmss = tp->advmss;
-		info->tcpi_reordering = tp->reordering;
-	}
+	if (info) 
+		tcp_get_info(sk, info);
 
 	if (vinfo) {
 		vinfo->tcpv_enabled = tp->vegas.doing_vegas_now;
diff -Nru a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
--- a/net/ipv4/tcp_input.c	Tue Jun 15 22:20:43 2004
+++ b/net/ipv4/tcp_input.c	Tue Jun 15 22:20:43 2004
@@ -90,6 +90,8 @@
 int sysctl_tcp_westwood;
 int sysctl_tcp_vegas_cong_avoid;
 
+int sysctl_tcp_moderate_rcvbuf;
+
 /* Default values of the Vegas variables, in fixed-point representation
  * with V_PARAM_SHIFT bits to the right of the binary point.
  */
@@ -305,6 +307,8 @@
 	if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK))
 		tcp_fixup_sndbuf(sk);
 
+	tp->rcvq_space.space = tp->rcv_wnd;
+
 	maxwin = tcp_full_space(sk);
 
 	if (tp->window_clamp >= maxwin) {
@@ -364,6 +368,130 @@
 	}
 }
 
+/* Receiver "autotuning" code.
+ *
+ * The algorithm for RTT estimation w/o timestamps is based on
+ * Dynamic Right-Sizing (DRS) by Wu Feng and Mike Fisk of LANL.
+ * <http://www.lanl.gov/radiant/website/pubs/drs/lacsi2001.ps>
+ *
+ * More detail on this code can be found at
+ * <http://www.psc.edu/~jheffner/senior_thesis.ps>,
+ * though this reference is out of date.  A new paper
+ * is pending.
+ */
+static void tcp_rcv_rtt_update(struct tcp_opt *tp, u32 sample, int win_dep)
+{
+	u32 new_sample = tp->rcv_rtt_est.rtt;
+	long m = sample;
+
+	if (m == 0)
+		m = 1;
+
+	if (new_sample != 0) {
+		/* If we sample in larger samples in the non-timestamp
+		 * case, we could grossly overestimate the RTT especially
+		 * with chatty applications or bulk transfer apps which
+		 * are stalled on filesystem I/O.
+		 *
+		 * Also, since we are only going for a minimum in the
+		 * non-timestamp case, we do not smoothe things out
+		 * else with timestamps disabled convergance takes too
+		 * long.
+		 */
+		if (!win_dep) {
+			m -= (new_sample >> 3);
+			new_sample += m;
+		} else if (m < new_sample)
+			new_sample = m << 3;
+	} else {
+		/* No previous mesaure. */
+		new_sample = m << 3;
+	}
+
+	if (tp->rcv_rtt_est.rtt != new_sample)
+		tp->rcv_rtt_est.rtt = new_sample;
+}
+
+static inline void tcp_rcv_rtt_measure(struct tcp_opt *tp)
+{
+	if (tp->rcv_rtt_est.time == 0)
+		goto new_measure;
+	if (before(tp->rcv_nxt, tp->rcv_rtt_est.seq))
+		return;
+	tcp_rcv_rtt_update(tp,
+			   jiffies - tp->rcv_rtt_est.time,
+			   1);
+
+new_measure:
+	tp->rcv_rtt_est.seq = tp->rcv_nxt + tp->rcv_wnd;
+	tp->rcv_rtt_est.time = tcp_time_stamp;
+}
+
+static inline void tcp_rcv_rtt_measure_ts(struct tcp_opt *tp, struct sk_buff *skb)
+{
+	if (tp->rcv_tsecr &&
+	    (TCP_SKB_CB(skb)->end_seq -
+	     TCP_SKB_CB(skb)->seq >= tp->ack.rcv_mss))
+		tcp_rcv_rtt_update(tp, tcp_time_stamp - tp->rcv_tsecr, 0);
+}
+
+/*
+ * This function should be called every time data is copied to user space.
+ * It calculates the appropriate TCP receive buffer space.
+ */
+void tcp_rcv_space_adjust(struct sock *sk)
+{
+	struct tcp_opt *tp = tcp_sk(sk);
+	int time;
+	int space;
+	
+	if (tp->rcvq_space.time == 0)
+		goto new_measure;
+	
+	time = tcp_time_stamp - tp->rcvq_space.time;
+	if (time < (tp->rcv_rtt_est.rtt >> 3) ||
+	    tp->rcv_rtt_est.rtt == 0)
+		return;
+	
+	space = 2 * (tp->copied_seq - tp->rcvq_space.seq);
+
+	space = max(tp->rcvq_space.space, space);
+
+	if (tp->rcvq_space.space != space) {
+		int rcvmem;
+
+		tp->rcvq_space.space = space;
+
+		if (sysctl_tcp_moderate_rcvbuf) {
+			int new_clamp = space;
+
+			/* Receive space grows, normalize in order to
+			 * take into account packet headers and sk_buff
+			 * structure overhead.
+			 */
+			space /= tp->advmss;
+			if (!space)
+				space = 1;
+			rcvmem = (tp->advmss + MAX_TCP_HEADER +
+				  16 + sizeof(struct sk_buff));
+			while (tcp_win_from_space(rcvmem) < tp->advmss)
+				rcvmem += 128;
+			space *= rcvmem;
+			space = min(space, sysctl_tcp_rmem[2]);
+			if (space > sk->sk_rcvbuf) {
+				sk->sk_rcvbuf = space;
+
+				/* Make the window clamp follow along.  */
+				tp->window_clamp = new_clamp;
+			}
+		}
+	}
+	
+new_measure:
+	tp->rcvq_space.seq = tp->copied_seq;
+	tp->rcvq_space.time = tcp_time_stamp;
+}
+
 /* There is something which you must keep in mind when you analyze the
  * behavior of the tp->ato delayed ack timeout interval.  When a
  * connection starts up, we want to ack as quickly as possible.  The
@@ -382,6 +510,8 @@
 
 	tcp_measure_rcv_mss(tp, skb);
 
+	tcp_rcv_rtt_measure(tp);
+	
 	now = tcp_time_stamp;
 
 	if (!tp->ack.ato) {
@@ -3318,6 +3448,7 @@
 				tp->ucopy.len -= chunk;
 				tp->copied_seq += chunk;
 				eaten = (chunk == skb->len && !th->fin);
+				tcp_rcv_space_adjust(sk);
 			}
 			local_bh_disable();
 		}
@@ -3918,6 +4049,7 @@
 	if (!err) {
 		tp->ucopy.len -= chunk;
 		tp->copied_seq += chunk;
+		tcp_rcv_space_adjust(sk);
 	}
 
 	local_bh_disable();
@@ -4045,6 +4177,9 @@
 				    (sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) &&
 				    tp->rcv_nxt == tp->rcv_wup)
 					tcp_store_ts_recent(tp);
+
+				tcp_rcv_rtt_measure_ts(tp, skb);
+
 				/* We know that such packets are checksummed
 				 * on entry.
 				 */
@@ -4076,6 +4211,8 @@
 					    tp->rcv_nxt == tp->rcv_wup)
 						tcp_store_ts_recent(tp);
 
+					tcp_rcv_rtt_measure_ts(tp, skb);
+
 					__skb_pull(skb, tcp_header_len);
 					tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
 					NET_INC_STATS_BH(TCPHPHitsToUser);
@@ -4095,6 +4232,8 @@
 				    tp->rcv_nxt == tp->rcv_wup)
 					tcp_store_ts_recent(tp);
 
+				tcp_rcv_rtt_measure_ts(tp, skb);
+
 				if ((int)skb->truesize > sk->sk_forward_alloc)
 					goto step5;
 
@@ -4190,6 +4329,8 @@
 step5:
 	if(th->ack)
 		tcp_ack(sk, skb, FLAG_SLOWPATH);
+
+	tcp_rcv_rtt_measure_ts(tp, skb);
 
 	/* Process urgent data. */
 	tcp_urg(sk, skb, th);
diff -Nru a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv4/tcp_ipv4.c	Tue Jun 15 22:20:38 2004
@@ -1290,12 +1290,12 @@
 					 .dport = req->rmt_port } } };
 
 	if (ip_route_output_flow(&rt, &fl, sk, 0)) {
-		IP_INC_STATS_BH(IpOutNoRoutes);
+		IP_INC_STATS_BH(OutNoRoutes);
 		return NULL;
 	}
 	if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) {
 		ip_rt_put(rt);
-		IP_INC_STATS_BH(IpOutNoRoutes);
+		IP_INC_STATS_BH(OutNoRoutes);
 		return NULL;
 	}
 	return &rt->u.dst;
@@ -1442,7 +1442,7 @@
 	 * clogging syn queue with openreqs with exponentially increasing
 	 * timeout.
 	 */
-	if (tcp_acceptq_is_full(sk) && tcp_synq_young(sk) > 1)
+	if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1)
 		goto drop;
 
 	req = tcp_openreq_alloc();
@@ -1567,7 +1567,7 @@
 	struct tcp_opt *newtp;
 	struct sock *newsk;
 
-	if (tcp_acceptq_is_full(sk))
+	if (sk_acceptq_is_full(sk))
 		goto exit_overflow;
 
 	if (!dst && (dst = tcp_v4_route_req(sk, req)) == NULL)
@@ -2452,7 +2452,7 @@
 	int ttd = req->expires - jiffies;
 
 	sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X"
-		" %02X %08X:%08X %02X:%08X %08X %5d %8d %u %d %p",
+		" %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %p",
 		i,
 		req->af.v4_req.loc_addr,
 		ntohs(inet_sk(sk)->sport),
@@ -2526,7 +2526,7 @@
 	srcp  = ntohs(tw->tw_sport);
 
 	sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X"
-		" %02X %08X:%08X %02X:%08X %08X %5d %8d %d %d %p",
+		" %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p",
 		i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
 		3, jiffies_to_clock_t(ttd), 0, 0, 0, 0,
 		atomic_read(&tw->tw_refcnt), tw);
diff -Nru a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
--- a/net/ipv4/tcp_output.c	Tue Jun 15 22:20:42 2004
+++ b/net/ipv4/tcp_output.c	Tue Jun 15 22:20:42 2004
@@ -1389,8 +1389,7 @@
 	}
 	tp->ack.pending |= TCP_ACK_SCHED|TCP_ACK_TIMER;
 	tp->ack.timeout = timeout;
-	if (!mod_timer(&tp->delack_timer, timeout))
-		sock_hold(sk);
+	sk_reset_timer(sk, &tp->delack_timer, timeout);
 }
 
 /* This routine sends an ack and also updates the window. */
diff -Nru a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
--- a/net/ipv4/tcp_timer.c	Tue Jun 15 22:21:02 2004
+++ b/net/ipv4/tcp_timer.c	Tue Jun 15 22:21:02 2004
@@ -68,18 +68,13 @@
 	struct tcp_opt *tp = tcp_sk(sk);
 
 	tp->pending = 0;
-	if (timer_pending(&tp->retransmit_timer) &&
-	    del_timer(&tp->retransmit_timer))
-		__sock_put(sk);
+	sk_stop_timer(sk, &tp->retransmit_timer);
 
 	tp->ack.pending = 0;
 	tp->ack.blocked = 0;
-	if (timer_pending(&tp->delack_timer) &&
-	    del_timer(&tp->delack_timer))
-		__sock_put(sk);
+	sk_stop_timer(sk, &tp->delack_timer);
 
-	if (timer_pending(&sk->sk_timer) && del_timer(&sk->sk_timer))
-		__sock_put(sk);
+	sk_stop_timer(sk, &sk->sk_timer);
 }
 
 static void tcp_write_err(struct sock *sk)
@@ -218,8 +213,7 @@
 		/* Try again later. */
 		tp->ack.blocked = 1;
 		NET_INC_STATS_BH(DelayedACKLocked);
-		if (!mod_timer(&tp->delack_timer, jiffies + TCP_DELACK_MIN))
-			sock_hold(sk);
+		sk_reset_timer(sk, &tp->delack_timer, jiffies + TCP_DELACK_MIN);
 		goto out_unlock;
 	}
 
@@ -229,8 +223,7 @@
 		goto out;
 
 	if (time_after(tp->ack.timeout, jiffies)) {
-		if (!mod_timer(&tp->delack_timer, tp->ack.timeout))
-			sock_hold(sk);
+		sk_reset_timer(sk, &tp->delack_timer, tp->ack.timeout);
 		goto out;
 	}
 	tp->ack.pending &= ~TCP_ACK_TIMER;
@@ -429,8 +422,7 @@
 	bh_lock_sock(sk);
 	if (sock_owned_by_user(sk)) {
 		/* Try again later */
-		if (!mod_timer(&tp->retransmit_timer, jiffies + (HZ/20)))
-			sock_hold(sk);
+		sk_reset_timer(sk, &tp->retransmit_timer, jiffies + (HZ / 20));
 		goto out_unlock;
 	}
 
@@ -438,8 +430,7 @@
 		goto out;
 
 	if (time_after(tp->timeout, jiffies)) {
-		if (!mod_timer(&tp->retransmit_timer, tp->timeout))
-			sock_hold(sk);
+		sk_reset_timer(sk, &tp->retransmit_timer, tp->timeout);
 		goto out;
 	}
 
@@ -557,14 +548,12 @@
 
 void tcp_delete_keepalive_timer (struct sock *sk)
 {
-	if (timer_pending(&sk->sk_timer) && del_timer (&sk->sk_timer))
-		__sock_put(sk);
+	sk_stop_timer(sk, &sk->sk_timer);
 }
 
 void tcp_reset_keepalive_timer (struct sock *sk, unsigned long len)
 {
-	if (!mod_timer(&sk->sk_timer, jiffies + len))
-		sock_hold(sk);
+	sk_reset_timer(sk, &sk->sk_timer, jiffies + len);
 }
 
 void tcp_set_keepalive(struct sock *sk, int val)
diff -Nru a/net/ipv4/udp.c b/net/ipv4/udp.c
--- a/net/ipv4/udp.c	Tue Jun 15 22:20:37 2004
+++ b/net/ipv4/udp.c	Tue Jun 15 22:20:37 2004
@@ -294,7 +294,7 @@
 		    ipv6_only_sock(s)					||
 		    (s->sk_bound_dev_if && s->sk_bound_dev_if != dif))
 			continue;
-		if (!ip_mc_sf_allow(sk, loc_addr, rmt_addr, dif))
+		if (!ip_mc_sf_allow(s, loc_addr, rmt_addr, dif))
 			continue;
 		goto found;
   	}
@@ -725,7 +725,7 @@
 		case SIOCOUTQ:
 		{
 			int amount = atomic_read(&sk->sk_wmem_alloc);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 
 		case SIOCINQ:
@@ -745,7 +745,7 @@
 				amount = skb->len - sizeof(struct udphdr);
 			}
 			spin_unlock_irq(&sk->sk_receive_queue.lock);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 
 		default:
@@ -1269,7 +1269,7 @@
  *	Socket option code for UDP
  */
 static int udp_setsockopt(struct sock *sk, int level, int optname, 
-			  char *optval, int optlen)
+			  char __user *optval, int optlen)
 {
 	struct udp_opt *up = udp_sk(sk);
 	int val;
@@ -1281,7 +1281,7 @@
 	if(optlen<sizeof(int))
 		return -EINVAL;
 
-	if (get_user(val, (int *)optval))
+	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 
 	switch(optname) {
@@ -1309,7 +1309,7 @@
 }
 
 static int udp_getsockopt(struct sock *sk, int level, int optname, 
-			  char *optval, int *optlen)
+			  char __user *optval, int __user *optlen)
 {
 	struct udp_opt *up = udp_sk(sk);
 	int val, len;
diff -Nru a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
--- a/net/ipv4/xfrm4_policy.c	Tue Jun 15 22:20:43 2004
+++ b/net/ipv4/xfrm4_policy.c	Tue Jun 15 22:20:43 2004
@@ -90,7 +90,6 @@
 			goto error;
 		}
 
-		dst1->xfrm = xfrm[i];
 		if (!dst)
 			dst = dst1;
 		else {
@@ -120,10 +119,12 @@
 		dst_hold(&rt->u.dst);
 	}
 	dst_prev->child = &rt->u.dst;
+	i = 0;
 	for (dst_prev = dst; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {
 		struct xfrm_dst *x = (struct xfrm_dst*)dst_prev;
 		x->u.rt.fl = *fl;
 
+		dst_prev->xfrm = xfrm[i++];
 		dst_prev->dev = rt->u.dst.dev;
 		if (rt->u.dst.dev)
 			dev_hold(rt->u.dst.dev);
diff -Nru a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c
--- a/net/ipv4/xfrm4_state.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv4/xfrm4_state.c	Tue Jun 15 22:20:36 2004
@@ -83,9 +83,7 @@
 			    break;
 		    }
 	}
-	if (x0) {
-		xfrm_state_hold(x0);
-	} else if (create && (x0 = xfrm_state_alloc()) != NULL) {
+	if (!x0 && create && (x0 = xfrm_state_alloc()) != NULL) {
 		x0->sel.daddr.a4 = daddr->a4;
 		x0->sel.saddr.a4 = saddr->a4;
 		x0->sel.prefixlen_d = 32;
@@ -100,11 +98,14 @@
 		x0->props.family = AF_INET;
 		x0->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES;
 		xfrm_state_hold(x0);
-		mod_timer(&x0->timer, jiffies + XFRM_ACQ_EXPIRES*HZ);
+		x0->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ;
+		add_timer(&x0->timer);
 		xfrm_state_hold(x0);
 		list_add_tail(&x0->bydst, xfrm4_state_afinfo.state_bydst+h);
 		wake_up(&km_waitq);
 	}
+	if (x0)
+		xfrm_state_hold(x0);
 	return x0;
 }
 
diff -Nru a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
--- a/net/ipv4/xfrm4_tunnel.c	Tue Jun 15 22:20:37 2004
+++ b/net/ipv4/xfrm4_tunnel.c	Tue Jun 15 22:20:37 2004
@@ -33,8 +33,9 @@
 	return ret;
 }
 
-static int ipip_output(struct sk_buff *skb)
+static int ipip_output(struct sk_buff **pskb)
 {
+	struct sk_buff *skb = *pskb;
 	struct dst_entry *dst = skb->dst;
 	struct xfrm_state *x = dst->xfrm;
 	struct iphdr *iph, *top_iph;
diff -Nru a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
--- a/net/ipv6/addrconf.c	Tue Jun 15 22:21:03 2004
+++ b/net/ipv6/addrconf.c	Tue Jun 15 22:21:03 2004
@@ -1510,7 +1510,7 @@
  *	Special case for SIT interfaces where we create a new "virtual"
  *	device.
  */
-int addrconf_set_dstaddr(void *arg)
+int addrconf_set_dstaddr(void __user *arg)
 {
 	struct in6_ifreq ireq;
 	struct net_device *dev;
@@ -1630,7 +1630,7 @@
 }
 
 
-int addrconf_add_ifaddr(void *arg)
+int addrconf_add_ifaddr(void __user *arg)
 {
 	struct in6_ifreq ireq;
 	int err;
@@ -1647,7 +1647,7 @@
 	return err;
 }
 
-int addrconf_del_ifaddr(void *arg)
+int addrconf_del_ifaddr(void __user *arg)
 {
 	struct in6_ifreq ireq;
 	int err;
@@ -3003,7 +3003,7 @@
 
 static
 int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-			   void *buffer, size_t *lenp)
+			   void __user *buffer, size_t *lenp)
 {
 	int *valp = ctl->data;
 	int val = *valp;
@@ -3031,9 +3031,10 @@
 }
 
 static int addrconf_sysctl_forward_strategy(ctl_table *table, 
-					    int *name, int nlen,
-					    void *oldval, size_t *oldlenp,
-					    void *newval, size_t newlen,
+					    int __user *name, int nlen,
+					    void __user *oldval,
+					    size_t __user *oldlenp,
+					    void __user *newval, size_t newlen,
 					    void **context)
 {
 	int *valp = table->data;
@@ -3043,7 +3044,7 @@
 		return 0;
 	if (newlen != sizeof(int))
 		return -EINVAL;
-	if (get_user(new, (int *)newval))
+	if (get_user(new, (int __user *)newval))
 		return -EFAULT;
 	if (new == *valp)
 		return 0;
diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
--- a/net/ipv6/af_inet6.c	Tue Jun 15 22:20:41 2004
+++ b/net/ipv6/af_inet6.c	Tue Jun 15 22:20:41 2004
@@ -474,23 +474,23 @@
 	switch(cmd) 
 	{
 	case SIOCGSTAMP:
-		return sock_get_timestamp(sk, (struct timeval *)arg);
+		return sock_get_timestamp(sk, (struct timeval __user *)arg);
 
 	case SIOCADDRT:
 	case SIOCDELRT:
 	  
-		return(ipv6_route_ioctl(cmd,(void *)arg));
+		return(ipv6_route_ioctl(cmd,(void __user *)arg));
 
 	case SIOCSIFADDR:
-		return addrconf_add_ifaddr((void *) arg);
+		return addrconf_add_ifaddr((void __user *) arg);
 	case SIOCDIFADDR:
-		return addrconf_del_ifaddr((void *) arg);
+		return addrconf_del_ifaddr((void __user *) arg);
 	case SIOCSIFDSTADDR:
-		return addrconf_set_dstaddr((void *) arg);
+		return addrconf_set_dstaddr((void __user *) arg);
 	default:
 		if (!sk->sk_prot->ioctl ||
 		    (err = sk->sk_prot->ioctl(sk, cmd, arg)) == -ENOIOCTLCMD)
-			return(dev_ioctl(cmd,(void *) arg));		
+			return(dev_ioctl(cmd,(void __user *) arg));		
 		return err;
 	}
 	/*NOTREACHED*/
@@ -572,7 +572,7 @@
 
 	spin_lock_bh(&inetsw6_lock);
 
-	if (p->type > SOCK_MAX)
+	if (p->type >= SOCK_MAX)
 		goto out_illegal;
 
 	/* If we are trying to override a permanent protocol, bail. */
@@ -667,14 +667,14 @@
 
 static int __init init_ipv6_mibs(void)
 {
-	if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipv6_mib),
-			   __alignof__(struct ipv6_mib)) < 0)
+	if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipstats_mib),
+			   __alignof__(struct ipstats_mib)) < 0)
 		goto err_ip_mib;
 	if (snmp6_mib_init((void **)icmpv6_statistics, sizeof (struct icmpv6_mib),
-			   __alignof__(struct ipv6_mib)) < 0)
+			   __alignof__(struct icmpv6_mib)) < 0)
 		goto err_icmp_mib;
 	if (snmp6_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib),
-			   __alignof__(struct ipv6_mib)) < 0)
+			   __alignof__(struct udp_mib)) < 0)
 		goto err_udp_mib;
 	return 0;
 
diff -Nru a/net/ipv6/ah6.c b/net/ipv6/ah6.c
--- a/net/ipv6/ah6.c	Tue Jun 15 22:20:42 2004
+++ b/net/ipv6/ah6.c	Tue Jun 15 22:20:42 2004
@@ -144,11 +144,11 @@
 	return nexthdr;
 }
 
-int ah6_output(struct sk_buff *skb)
+int ah6_output(struct sk_buff **pskb)
 {
 	int err;
 	int hdr_len = sizeof(struct ipv6hdr);
-	struct dst_entry *dst = skb->dst;
+	struct dst_entry *dst = (*pskb)->dst;
 	struct xfrm_state *x  = dst->xfrm;
 	struct ipv6hdr *iph = NULL;
 	struct ip_auth_hdr *ah;
@@ -156,54 +156,55 @@
 	u16 nh_offset = 0;
 	u8 nexthdr;
 
-	if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) {
-		err = -EINVAL;
-		goto error_nolock;
+	if ((*pskb)->ip_summed == CHECKSUM_HW) {
+		err = skb_checksum_help(pskb, 0);
+		if (err)
+			goto error_nolock;
 	}
 
 	spin_lock_bh(&x->lock);
-	err = xfrm_check_output(x, skb, AF_INET6);
+	err = xfrm_check_output(x, *pskb, AF_INET6);
 	if (err)
 		goto error;
 
 	if (x->props.mode) {
-		iph = skb->nh.ipv6h;
-		skb->nh.ipv6h = (struct ipv6hdr*)skb_push(skb, x->props.header_len);
-		skb->nh.ipv6h->version = 6;
-		skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
-		skb->nh.ipv6h->nexthdr = IPPROTO_AH;
-		ipv6_addr_copy(&skb->nh.ipv6h->saddr,
+		iph = (*pskb)->nh.ipv6h;
+		(*pskb)->nh.ipv6h = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len);
+		(*pskb)->nh.ipv6h->version = 6;
+		(*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
+		(*pskb)->nh.ipv6h->nexthdr = IPPROTO_AH;
+		ipv6_addr_copy(&(*pskb)->nh.ipv6h->saddr,
 			       (struct in6_addr *) &x->props.saddr);
-		ipv6_addr_copy(&skb->nh.ipv6h->daddr,
+		ipv6_addr_copy(&(*pskb)->nh.ipv6h->daddr,
 			       (struct in6_addr *) &x->id.daddr);
-		ah = (struct ip_auth_hdr*)(skb->nh.ipv6h+1);
+		ah = (struct ip_auth_hdr*)((*pskb)->nh.ipv6h+1);
 		ah->nexthdr = IPPROTO_IPV6;
 	} else {
-		hdr_len = skb->h.raw - skb->nh.raw;
+		hdr_len = (*pskb)->h.raw - (*pskb)->nh.raw;
 		iph = kmalloc(hdr_len, GFP_ATOMIC);
 		if (!iph) {
 			err = -ENOMEM;
 			goto error;
 		}
-		memcpy(iph, skb->data, hdr_len);
-		skb->nh.ipv6h = (struct ipv6hdr*)skb_push(skb, x->props.header_len);
-		memcpy(skb->nh.ipv6h, iph, hdr_len);
-		nexthdr = ipv6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_OUT);
+		memcpy(iph, (*pskb)->data, hdr_len);
+		(*pskb)->nh.ipv6h = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len);
+		memcpy((*pskb)->nh.ipv6h, iph, hdr_len);
+		nexthdr = ipv6_clear_mutable_options(*pskb, &nh_offset, XFRM_POLICY_OUT);
 		if (nexthdr == 0)
-			goto error;
+			goto error_free_iph;
 
-		skb->nh.raw[nh_offset] = IPPROTO_AH;
-		skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
-		ah = (struct ip_auth_hdr*)(skb->nh.raw+hdr_len);
-		skb->h.raw = (unsigned char*) ah;
+		(*pskb)->nh.raw[nh_offset] = IPPROTO_AH;
+		(*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
+		ah = (struct ip_auth_hdr*)((*pskb)->nh.raw+hdr_len);
+		(*pskb)->h.raw = (unsigned char*) ah;
 		ah->nexthdr = nexthdr;
 	}
 
-	skb->nh.ipv6h->priority    = 0;
-	skb->nh.ipv6h->flow_lbl[0] = 0;
-	skb->nh.ipv6h->flow_lbl[1] = 0;
-	skb->nh.ipv6h->flow_lbl[2] = 0;
-	skb->nh.ipv6h->hop_limit    = 0;
+	(*pskb)->nh.ipv6h->priority    = 0;
+	(*pskb)->nh.ipv6h->flow_lbl[0] = 0;
+	(*pskb)->nh.ipv6h->flow_lbl[1] = 0;
+	(*pskb)->nh.ipv6h->flow_lbl[2] = 0;
+	(*pskb)->nh.ipv6h->hop_limit    = 0;
 
 	ahp = x->data;
 	ah->hdrlen  = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + 
@@ -212,37 +213,39 @@
 	ah->reserved = 0;
 	ah->spi = x->id.spi;
 	ah->seq_no = htonl(++x->replay.oseq);
-	ahp->icv(ahp, skb, ah->auth_data);
+	ahp->icv(ahp, *pskb, ah->auth_data);
 
 	if (x->props.mode) {
-		skb->nh.ipv6h->hop_limit   = iph->hop_limit;
-		skb->nh.ipv6h->priority    = iph->priority; 	
-		skb->nh.ipv6h->flow_lbl[0] = iph->flow_lbl[0];
-		skb->nh.ipv6h->flow_lbl[1] = iph->flow_lbl[1];
-		skb->nh.ipv6h->flow_lbl[2] = iph->flow_lbl[2];
+		(*pskb)->nh.ipv6h->hop_limit   = iph->hop_limit;
+		(*pskb)->nh.ipv6h->priority    = iph->priority; 	
+		(*pskb)->nh.ipv6h->flow_lbl[0] = iph->flow_lbl[0];
+		(*pskb)->nh.ipv6h->flow_lbl[1] = iph->flow_lbl[1];
+		(*pskb)->nh.ipv6h->flow_lbl[2] = iph->flow_lbl[2];
 		if (x->props.flags & XFRM_STATE_NOECN)
-			IP6_ECN_clear(skb->nh.ipv6h);
+			IP6_ECN_clear((*pskb)->nh.ipv6h);
 	} else {
-		memcpy(skb->nh.ipv6h, iph, hdr_len);
-		skb->nh.raw[nh_offset] = IPPROTO_AH;
-		skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
+		memcpy((*pskb)->nh.ipv6h, iph, hdr_len);
+		(*pskb)->nh.raw[nh_offset] = IPPROTO_AH;
+		(*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
 		kfree (iph);
 	}
 
-	skb->nh.raw = skb->data;
+	(*pskb)->nh.raw = (*pskb)->data;
 
-	x->curlft.bytes += skb->len;
+	x->curlft.bytes += (*pskb)->len;
 	x->curlft.packets++;
 	spin_unlock_bh(&x->lock);
-	if ((skb->dst = dst_pop(dst)) == NULL) {
+	if (((*pskb)->dst = dst_pop(dst)) == NULL) {
 		err = -EHOSTUNREACH;
 		goto error_nolock;
 	}
 	return NET_XMIT_BYPASS;
+error_free_iph:
+	kfree(iph);
 error:
 	spin_unlock_bh(&x->lock);
 error_nolock:
-	kfree_skb(skb);
+	kfree_skb(*pskb);
 	return err;
 }
 
@@ -360,7 +363,7 @@
 	struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset);
 	struct xfrm_state *x;
 
-	if (type != ICMPV6_DEST_UNREACH ||
+	if (type != ICMPV6_DEST_UNREACH &&
 	    type != ICMPV6_PKT_TOOBIG)
 		return;
 
diff -Nru a/net/ipv6/datagram.c b/net/ipv6/datagram.c
--- a/net/ipv6/datagram.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv6/datagram.c	Tue Jun 15 22:20:36 2004
@@ -145,10 +145,8 @@
 			  (struct in6_addr *)(skb->nh.raw + serr->addr_offset));
 			if (np->sndflow)
 				sin->sin6_flowinfo = *(u32*)(skb->nh.raw + serr->addr_offset - 24) & IPV6_FLOWINFO_MASK;
-			if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
-				struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
-				sin->sin6_scope_id = opt->iif;
-			}
+			if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
+				sin->sin6_scope_id = IP6CB(skb)->iif;
 		} else {
 			ipv6_addr_set(&sin->sin6_addr, 0, 0,
 				      htonl(0xffff),
@@ -167,10 +165,8 @@
 			ipv6_addr_copy(&sin->sin6_addr, &skb->nh.ipv6h->saddr);
 			if (np->rxopt.all)
 				datagram_recv_ctl(sk, msg, skb);
-			if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
-				struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
-				sin->sin6_scope_id = opt->iif;
-			}
+			if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
+				sin->sin6_scope_id = IP6CB(skb)->iif;
 		} else {
 			struct inet_opt *inet = inet_sk(sk);
 
@@ -211,7 +207,7 @@
 int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
 {
 	struct ipv6_pinfo *np = inet6_sk(sk);
-	struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
+	struct inet6_skb_parm *opt = IP6CB(skb);
 
 	if (np->rxopt.bits.rxinfo) {
 		struct in6_pktinfo src_info;
diff -Nru a/net/ipv6/esp6.c b/net/ipv6/esp6.c
--- a/net/ipv6/esp6.c	Tue Jun 15 22:20:42 2004
+++ b/net/ipv6/esp6.c	Tue Jun 15 22:20:42 2004
@@ -40,11 +40,11 @@
 
 #define MAX_SG_ONSTACK 4
 
-int esp6_output(struct sk_buff *skb)
+int esp6_output(struct sk_buff **pskb)
 {
 	int err;
 	int hdr_len = 0;
-	struct dst_entry *dst = skb->dst;
+	struct dst_entry *dst = (*pskb)->dst;
 	struct xfrm_state *x  = dst->xfrm;
 	struct ipv6hdr *iph = NULL, *top_iph;
 	struct ipv6_esp_hdr *esph;
@@ -58,14 +58,14 @@
 	u8 *prevhdr;
 	u8 nexthdr = 0;
 
-	/* First, if the skb is not checksummed, complete checksum. */
-	if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) {
-		err = -EINVAL;
-		goto error_nolock;
+	if ((*pskb)->ip_summed == CHECKSUM_HW) {
+		err = skb_checksum_help(pskb, 0);
+		if (err)
+			goto error_nolock;
 	}
 
 	spin_lock_bh(&x->lock);
-	err = xfrm_check_output(x, skb, AF_INET6);
+	err = xfrm_check_output(x, *pskb, AF_INET6);
 	if (err)
 		goto error;
 	err = -ENOMEM;
@@ -73,7 +73,7 @@
 	/* Strip IP header in transport mode. Save it. */
 
 	if (!x->props.mode) {
-		hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
+		hdr_len = ip6_find_1stfragopt(*pskb, &prevhdr);
 		nexthdr = *prevhdr;
 		*prevhdr = IPPROTO_ESP;
 		iph = kmalloc(hdr_len, GFP_ATOMIC);
@@ -81,14 +81,14 @@
 			err = -ENOMEM;
 			goto error;
 		}
-		memcpy(iph, skb->nh.raw, hdr_len);
-		__skb_pull(skb, hdr_len);
+		memcpy(iph, (*pskb)->nh.raw, hdr_len);
+		__skb_pull(*pskb, hdr_len);
 	}
 
 	/* Now skb is pure payload to encrypt */
 
 	/* Round to block size */
-	clen = skb->len;
+	clen = (*pskb)->len;
 
 	esp = x->data;
 	alen = esp->auth.icv_trunc_len;
@@ -98,7 +98,7 @@
 	if (esp->conf.padlen)
 		clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1);
 
-	if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) {
+	if ((nfrags = skb_cow_data(*pskb, clen-(*pskb)->len+alen, &trailer)) < 0) {
 		if (!x->props.mode && iph) kfree(iph);
 		goto error;
 	}
@@ -106,15 +106,15 @@
 	/* Fill padding... */
 	do {
 		int i;
-		for (i=0; i<clen-skb->len - 2; i++)
+		for (i=0; i<clen-(*pskb)->len - 2; i++)
 			*(u8*)(trailer->tail + i) = i+1;
 	} while (0);
-	*(u8*)(trailer->tail + clen-skb->len - 2) = (clen - skb->len)-2;
-	pskb_put(skb, trailer, clen - skb->len);
+	*(u8*)(trailer->tail + clen-(*pskb)->len - 2) = (clen - (*pskb)->len)-2;
+	pskb_put(*pskb, trailer, clen - (*pskb)->len);
 
 	if (x->props.mode) {
-		iph = skb->nh.ipv6h;
-		top_iph = (struct ipv6hdr*)skb_push(skb, x->props.header_len);
+		iph = (*pskb)->nh.ipv6h;
+		top_iph = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len);
 		esph = (struct ipv6_esp_hdr*)(top_iph+1);
 		*(u8*)(trailer->tail - 1) = IPPROTO_IPV6;
 		top_iph->version = 6;
@@ -125,19 +125,19 @@
 		if (x->props.flags & XFRM_STATE_NOECN)
 			IP6_ECN_clear(top_iph);
 		top_iph->nexthdr = IPPROTO_ESP;
-		top_iph->payload_len = htons(skb->len + alen - sizeof(struct ipv6hdr));
+		top_iph->payload_len = htons((*pskb)->len + alen - sizeof(struct ipv6hdr));
 		top_iph->hop_limit = iph->hop_limit;
 		ipv6_addr_copy(&top_iph->saddr,
 			       (struct in6_addr *)&x->props.saddr);
 		ipv6_addr_copy(&top_iph->daddr,
 			       (struct in6_addr *)&x->id.daddr);
 	} else { 
-		esph = (struct ipv6_esp_hdr*)skb_push(skb, x->props.header_len);
-		skb->h.raw = (unsigned char*)esph;
-		top_iph = (struct ipv6hdr*)skb_push(skb, hdr_len);
+		esph = (struct ipv6_esp_hdr*)skb_push(*pskb, x->props.header_len);
+		(*pskb)->h.raw = (unsigned char*)esph;
+		top_iph = (struct ipv6hdr*)skb_push(*pskb, hdr_len);
 		memcpy(top_iph, iph, hdr_len);
 		kfree(iph);
-		top_iph->payload_len = htons(skb->len + alen - sizeof(struct ipv6hdr));
+		top_iph->payload_len = htons((*pskb)->len + alen - sizeof(struct ipv6hdr));
 		*(u8*)(trailer->tail - 1) = nexthdr;
 	}
 
@@ -156,7 +156,7 @@
 			if (!sg)
 				goto error;
 		}
-		skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen);
+		skb_to_sgvec(*pskb, sg, esph->enc_data+esp->conf.ivlen-(*pskb)->data, clen);
 		crypto_cipher_encrypt(tfm, sg, sg, clen);
 		if (unlikely(sg != sgbuf))
 			kfree(sg);
@@ -168,17 +168,17 @@
 	}
 
 	if (esp->auth.icv_full_len) {
-		esp->auth.icv(esp, skb, (u8*)esph-skb->data,
+		esp->auth.icv(esp, *pskb, (u8*)esph-(*pskb)->data,
 			sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen+clen, trailer->tail);
-		pskb_put(skb, trailer, alen);
+		pskb_put(*pskb, trailer, alen);
 	}
 
-	skb->nh.raw = skb->data;
+	(*pskb)->nh.raw = (*pskb)->data;
 
-	x->curlft.bytes += skb->len;
+	x->curlft.bytes += (*pskb)->len;
 	x->curlft.packets++;
 	spin_unlock_bh(&x->lock);
-	if ((skb->dst = dst_pop(dst)) == NULL) {
+	if (((*pskb)->dst = dst_pop(dst)) == NULL) {
 		err = -EHOSTUNREACH;
 		goto error_nolock;
 	}
@@ -187,7 +187,7 @@
 error:
 	spin_unlock_bh(&x->lock);
 error_nolock:
-	kfree_skb(skb);
+	kfree_skb(*pskb);
 	return err;
 }
 
@@ -324,7 +324,7 @@
 	struct ipv6_esp_hdr *esph = (struct ipv6_esp_hdr*)(skb->data+offset);
 	struct xfrm_state *x;
 
-	if (type != ICMPV6_DEST_UNREACH ||
+	if (type != ICMPV6_DEST_UNREACH && 
 	    type != ICMPV6_PKT_TOOBIG)
 		return;
 
diff -Nru a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
--- a/net/ipv6/exthdrs.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv6/exthdrs.c	Tue Jun 15 22:20:36 2004
@@ -155,11 +155,11 @@
 static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
 {
 	struct sk_buff *skb = *skbp;
-	struct inet6_skb_parm *opt = (struct inet6_skb_parm *)skb->cb;
+	struct inet6_skb_parm *opt = IP6CB(skb);
 
 	if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
 	    !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		kfree_skb(skb);
 		return -1;
 	}
@@ -172,7 +172,7 @@
 		return 1;
 	}
 
-	IP6_INC_STATS_BH(Ip6InHdrErrors);
+	IP6_INC_STATS_BH(InHdrErrors);
 	return -1;
 }
 
@@ -217,7 +217,7 @@
 static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
 {
 	struct sk_buff *skb = *skbp;
-	struct inet6_skb_parm *opt = (struct inet6_skb_parm *)skb->cb;
+	struct inet6_skb_parm *opt = IP6CB(skb);
 	struct in6_addr *addr;
 	struct in6_addr daddr;
 	int n, i;
@@ -227,7 +227,7 @@
 
 	if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
 	    !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		kfree_skb(skb);
 		return -1;
 	}
@@ -236,7 +236,7 @@
 
 	if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) ||
 	    skb->pkt_type != PACKET_HOST) {
-		IP6_INC_STATS_BH(Ip6InAddrErrors);
+		IP6_INC_STATS_BH(InAddrErrors);
 		kfree_skb(skb);
 		return -1;
 	}
@@ -252,13 +252,13 @@
 	}
 
 	if (hdr->type != IPV6_SRCRT_TYPE_0) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->type) - skb->nh.raw);
 		return -1;
 	}
 	
 	if (hdr->hdrlen & 0x01) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->hdrlen) - skb->nh.raw);
 		return -1;
 	}
@@ -271,7 +271,7 @@
 	n = hdr->hdrlen >> 1;
 
 	if (hdr->segments_left > n) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->segments_left) - skb->nh.raw);
 		return -1;
 	}
@@ -284,11 +284,11 @@
 		kfree_skb(skb);
 		/* the copy is a forwarded packet */
 		if (skb2 == NULL) {
-			IP6_INC_STATS_BH(Ip6OutDiscards);	
+			IP6_INC_STATS_BH(OutDiscards);	
 			return -1;
 		}
 		*skbp = skb = skb2;
-		opt = (struct inet6_skb_parm *)skb2->cb;
+		opt = IP6CB(skb2);
 		hdr = (struct ipv6_rt_hdr *) skb2->h.raw;
 	}
 
@@ -302,7 +302,7 @@
 	addr += i - 1;
 
 	if (ipv6_addr_is_multicast(addr)) {
-		IP6_INC_STATS_BH(Ip6InAddrErrors);
+		IP6_INC_STATS_BH(InAddrErrors);
 		kfree_skb(skb);
 		return -1;
 	}
@@ -319,7 +319,7 @@
 	}
 	if (skb->dst->dev->flags&IFF_LOOPBACK) {
 		if (skb->nh.ipv6h->hop_limit <= 1) {
-			IP6_INC_STATS_BH(Ip6InHdrErrors);
+			IP6_INC_STATS_BH(InHdrErrors);
 			icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
 				    0, skb->dev);
 			kfree_skb(skb);
@@ -418,7 +418,7 @@
 static int ipv6_hop_ra(struct sk_buff *skb, int optoff)
 {
 	if (skb->nh.raw[optoff+1] == 2) {
-		((struct inet6_skb_parm*)skb->cb)->ra = optoff;
+		IP6CB(skb)->ra = optoff;
 		return 1;
 	}
 	LIMIT_NETDEBUG(
@@ -436,24 +436,24 @@
 	if (skb->nh.raw[optoff+1] != 4 || (optoff&3) != 2) {
 		LIMIT_NETDEBUG(
 			 printk(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", skb->nh.raw[optoff+1]));
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		goto drop;
 	}
 
 	pkt_len = ntohl(*(u32*)(skb->nh.raw+optoff+2));
 	if (pkt_len <= IPV6_MAXPLEN) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
 		return 0;
 	}
 	if (skb->nh.ipv6h->payload_len) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
 		return 0;
 	}
 
 	if (pkt_len > skb->len - sizeof(struct ipv6hdr)) {
-		IP6_INC_STATS_BH(Ip6InTruncatedPkts);
+		IP6_INC_STATS_BH(InTruncatedPkts);
 		goto drop;
 	}
 	if (pkt_len + sizeof(struct ipv6hdr) < skb->len) {
@@ -482,7 +482,7 @@
 
 int ipv6_parse_hopopts(struct sk_buff *skb, int nhoff)
 {
-	((struct inet6_skb_parm*)skb->cb)->hop = sizeof(struct ipv6hdr);
+	IP6CB(skb)->hop = sizeof(struct ipv6hdr);
 	if (ip6_parse_tlv(tlvprochopopt_lst, skb))
 		return sizeof(struct ipv6hdr);
 	return -1;
diff -Nru a/net/ipv6/icmp.c b/net/ipv6/icmp.c
--- a/net/ipv6/icmp.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv6/icmp.c	Tue Jun 15 22:20:38 2004
@@ -174,7 +174,7 @@
 	 */
 	dst = ip6_route_output(sk, fl);
 	if (dst->error) {
-		IP6_INC_STATS(Ip6OutNoRoutes);
+		IP6_INC_STATS(OutNoRoutes);
 	} else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) {
 		res = 1;
 	} else {
diff -Nru a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
--- a/net/ipv6/ip6_flowlabel.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv6/ip6_flowlabel.c	Tue Jun 15 22:20:38 2004
@@ -277,7 +277,7 @@
 }
 
 static struct ip6_flowlabel *
-fl_create(struct in6_flowlabel_req *freq, char *optval, int optlen, int *err_p)
+fl_create(struct in6_flowlabel_req *freq, char __user *optval, int optlen, int *err_p)
 {
 	struct ip6_flowlabel *fl;
 	int olen;
@@ -407,7 +407,7 @@
 	return 0;
 }
 
-int ipv6_flowlabel_opt(struct sock *sk, char *optval, int optlen)
+int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
 {
 	int err;
 	struct ipv6_pinfo *np = inet6_sk(sk);
@@ -692,14 +692,14 @@
 #endif
 
 
-void ip6_flowlabel_init()
+void ip6_flowlabel_init(void)
 {
 #ifdef CONFIG_PROC_FS
 	proc_net_fops_create("ip6_flowlabel", S_IRUGO, &ip6fl_seq_fops);
 #endif
 }
 
-void ip6_flowlabel_cleanup()
+void ip6_flowlabel_cleanup(void)
 {
 	del_timer(&ip6_fl_gc_timer);
 #ifdef CONFIG_PROC_FS
diff -Nru a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
--- a/net/ipv6/ip6_input.c	Tue Jun 15 22:20:43 2004
+++ b/net/ipv6/ip6_input.c	Tue Jun 15 22:20:43 2004
@@ -64,23 +64,23 @@
 	if (skb->pkt_type == PACKET_OTHERHOST)
 		goto drop;
 
-	IP6_INC_STATS_BH(Ip6InReceives);
+	IP6_INC_STATS_BH(InReceives);
 
 	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
-		IP6_INC_STATS_BH(Ip6InDiscards);
+		IP6_INC_STATS_BH(InDiscards);
 		goto out;
 	}
 
 	/* Store incoming device index. When the packet will
 	   be queued, we cannot refer to skb->dev anymore.
 	 */
-	((struct inet6_skb_parm *)skb->cb)->iif = dev->ifindex;
+	IP6CB(skb)->iif = dev->ifindex;
 
 	if (skb->len < sizeof(struct ipv6hdr))
 		goto err;
 
 	if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
 		goto drop;
 	}
 
@@ -97,7 +97,7 @@
 			goto truncated;
 		if (pkt_len + sizeof(struct ipv6hdr) < skb->len) {
 			if (__pskb_trim(skb, pkt_len + sizeof(struct ipv6hdr))){
-				IP6_INC_STATS_BH(Ip6InHdrErrors);
+				IP6_INC_STATS_BH(InHdrErrors);
 				goto drop;
 			}
 			hdr = skb->nh.ipv6h;
@@ -109,7 +109,7 @@
 	if (hdr->nexthdr == NEXTHDR_HOP) {
 		skb->h.raw = (u8*)(hdr+1);
 		if (ipv6_parse_hopopts(skb, offsetof(struct ipv6hdr, nexthdr)) < 0) {
-			IP6_INC_STATS_BH(Ip6InHdrErrors);
+			IP6_INC_STATS_BH(InHdrErrors);
 			return 0;
 		}
 		hdr = skb->nh.ipv6h;
@@ -117,9 +117,9 @@
 
 	return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish);
 truncated:
-	IP6_INC_STATS_BH(Ip6InTruncatedPkts);
+	IP6_INC_STATS_BH(InTruncatedPkts);
 err:
-	IP6_INC_STATS_BH(Ip6InHdrErrors);
+	IP6_INC_STATS_BH(InHdrErrors);
 drop:
 	kfree_skb(skb);
 out:
@@ -194,15 +194,15 @@
 		if (ret > 0)
 			goto resubmit;
 		else if (ret == 0)
-			IP6_INC_STATS_BH(Ip6InDelivers);
+			IP6_INC_STATS_BH(InDelivers);
 	} else {
 		if (!raw_sk) {
 			if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
-				IP6_INC_STATS_BH(Ip6InUnknownProtos);
+				IP6_INC_STATS_BH(InUnknownProtos);
 				icmpv6_param_prob(skb, ICMPV6_UNK_NEXTHDR, nhoff);
 			}
 		} else {
-			IP6_INC_STATS_BH(Ip6InDelivers);
+			IP6_INC_STATS_BH(InDelivers);
 			kfree_skb(skb);
 		}
 	}
@@ -210,7 +210,7 @@
 	return 0;
 
 discard:
-	IP6_INC_STATS_BH(Ip6InDiscards);
+	IP6_INC_STATS_BH(InDiscards);
 	rcu_read_unlock();
 	kfree_skb(skb);
 	return 0;
@@ -227,7 +227,7 @@
 	struct ipv6hdr *hdr;
 	int deliver;
 
-	IP6_INC_STATS_BH(Ip6InMcastPkts);
+	IP6_INC_STATS_BH(InMcastPkts);
 
 	hdr = skb->nh.ipv6h;
 	deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) ||
diff -Nru a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
--- a/net/ipv6/ip6_output.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv6/ip6_output.c	Tue Jun 15 22:20:36 2004
@@ -55,7 +55,7 @@
 #include <net/icmp.h>
 #include <net/xfrm.h>
 
-static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*));
+static int ip6_fragment(struct sk_buff **pskb, int (*output)(struct sk_buff**));
 
 static __inline__ void ipv6_select_ident(struct sk_buff *skb, struct frag_hdr *fhdr)
 {
@@ -87,7 +87,7 @@
 	} else if (dst->neighbour)
 		return dst->neighbour->output(skb);
 
-	IP6_INC_STATS_BH(Ip6OutNoRoutes);
+	IP6_INC_STATS_BH(OutNoRoutes);
 	kfree_skb(skb);
 	return -EINVAL;
 
@@ -107,8 +107,9 @@
 }
 
 
-int ip6_output2(struct sk_buff *skb)
+static int ip6_output2(struct sk_buff **pskb)
 {
+	struct sk_buff *skb = *pskb;
 	struct dst_entry *dst = skb->dst;
 	struct net_device *dev = dst->dev;
 
@@ -132,24 +133,26 @@
 					ip6_dev_loopback_xmit);
 
 			if (skb->nh.ipv6h->hop_limit == 0) {
-				IP6_INC_STATS(Ip6OutDiscards);
+				IP6_INC_STATS(OutDiscards);
 				kfree_skb(skb);
 				return 0;
 			}
 		}
 
-		IP6_INC_STATS(Ip6OutMcastPkts);
+		IP6_INC_STATS(OutMcastPkts);
 	}
 
 	return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb,NULL, skb->dev,ip6_output_finish);
 }
 
-int ip6_output(struct sk_buff *skb)
+int ip6_output(struct sk_buff **pskb)
 {
+	struct sk_buff *skb = *pskb;
+
 	if ((skb->len > dst_pmtu(skb->dst) || skb_shinfo(skb)->frag_list))
-		return ip6_fragment(skb, ip6_output2);
+		return ip6_fragment(pskb, ip6_output2);
 	else
-		return ip6_output2(skb);
+		return ip6_output2(pskb);
 }
 
 #ifdef CONFIG_NETFILTER
@@ -169,7 +172,7 @@
 	dst = ip6_route_output(skb->sk, &fl);
 
 	if (dst->error) {
-		IP6_INC_STATS(Ip6OutNoRoutes);
+		IP6_INC_STATS(OutNoRoutes);
 		LIMIT_NETDEBUG(
 			printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n"));
 		dst_release(dst);
@@ -228,7 +231,7 @@
 			kfree_skb(skb);
 			skb = skb2;
 			if (skb == NULL) {	
-				IP6_INC_STATS(Ip6OutDiscards);
+				IP6_INC_STATS(OutDiscards);
 				return -ENOBUFS;
 			}
 			if (sk)
@@ -262,7 +265,7 @@
 
 	mtu = dst_pmtu(dst);
 	if ((skb->len <= mtu) || ipfragok) {
-		IP6_INC_STATS(Ip6OutRequests);
+		IP6_INC_STATS(OutRequests);
 		return NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, ip6_maybe_reroute);
 	}
 
@@ -270,7 +273,7 @@
 		printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n");
 	skb->dev = dst->dev;
 	icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
-	IP6_INC_STATS(Ip6FragFails);
+	IP6_INC_STATS(FragFails);
 	kfree_skb(skb);
 	return -EMSGSIZE;
 }
@@ -346,13 +349,13 @@
 {
 	struct dst_entry *dst = skb->dst;
 	struct ipv6hdr *hdr = skb->nh.ipv6h;
-	struct inet6_skb_parm *opt =(struct inet6_skb_parm*)skb->cb;
+	struct inet6_skb_parm *opt = IP6CB(skb);
 	
 	if (ipv6_devconf.forwarding == 0)
 		goto error;
 
 	if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
-		IP6_INC_STATS(Ip6InDiscards);
+		IP6_INC_STATS(InDiscards);
 		goto drop;
 	}
 
@@ -391,7 +394,7 @@
 	}
 
 	if (!xfrm6_route_forward(skb)) {
-		IP6_INC_STATS(Ip6InDiscards);
+		IP6_INC_STATS(InDiscards);
 		goto drop;
 	}
 
@@ -429,14 +432,14 @@
 		/* Again, force OUTPUT device used as source address */
 		skb->dev = dst->dev;
 		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_pmtu(dst), skb->dev);
-		IP6_INC_STATS_BH(Ip6InTooBigErrors);
-		IP6_INC_STATS_BH(Ip6FragFails);
+		IP6_INC_STATS_BH(InTooBigErrors);
+		IP6_INC_STATS_BH(FragFails);
 		kfree_skb(skb);
 		return -EMSGSIZE;
 	}
 
 	if (skb_cow(skb, dst->dev->hard_header_len)) {
-		IP6_INC_STATS(Ip6OutDiscards);
+		IP6_INC_STATS(OutDiscards);
 		goto drop;
 	}
 
@@ -446,11 +449,11 @@
  
 	hdr->hop_limit--;
 
-	IP6_INC_STATS_BH(Ip6OutForwDatagrams);
+	IP6_INC_STATS_BH(OutForwDatagrams);
 	return NF_HOOK(PF_INET6,NF_IP6_FORWARD, skb, skb->dev, dst->dev, ip6_forward_finish);
 
 error:
-	IP6_INC_STATS_BH(Ip6InAddrErrors);
+	IP6_INC_STATS_BH(InAddrErrors);
 drop:
 	kfree_skb(skb);
 	return -EINVAL;
@@ -513,11 +516,11 @@
 	return offset;
 }
 
-static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
+static int ip6_fragment(struct sk_buff **pskb, int (*output)(struct sk_buff**))
 {
 	struct net_device *dev;
+	struct sk_buff *frag, *skb = *pskb;
 	struct rt6_info *rt = (struct rt6_info*)skb->dst;
-	struct sk_buff *frag;
 	struct ipv6hdr *tmp_hdr;
 	struct frag_hdr *fh;
 	unsigned int mtu, hlen, left, len;
@@ -563,7 +566,7 @@
 
 		tmp_hdr = kmalloc(hlen, GFP_ATOMIC);
 		if (!tmp_hdr) {
-			IP6_INC_STATS(Ip6FragFails);
+			IP6_INC_STATS(FragFails);
 			return -ENOMEM;
 		}
 
@@ -604,11 +607,13 @@
 				frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr));
 				ip6_copy_metadata(frag, skb);
 			}
-			err = output(skb);
-
-			if (err || !frag)
+			err = output(pskb);
+			if (err || !frag) {
+				if (unlikely(skb != *pskb))
+					skb = *pskb;
 				break;
-
+			}
+			
 			skb = frag;
 			frag = skb->next;
 			skb->next = NULL;
@@ -618,7 +623,7 @@
 			kfree(tmp_hdr);
 
 		if (err == 0) {
-			IP6_INC_STATS(Ip6FragOKs);
+			IP6_INC_STATS(FragOKs);
 			return 0;
 		}
 
@@ -628,7 +633,7 @@
 			frag = skb;
 		}
 
-		IP6_INC_STATS(Ip6FragFails);
+		IP6_INC_STATS(FragFails);
 		return err;
 	}
 
@@ -661,7 +666,7 @@
 
 		if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_RESERVED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) {
 			NETDEBUG(printk(KERN_INFO "IPv6: frag: no memory for new fragment!\n"));
-			IP6_INC_STATS(Ip6FragFails);
+			IP6_INC_STATS(FragFails);
 			err = -ENOMEM;
 			goto fail;
 		}
@@ -719,19 +724,19 @@
 		 *	Put this fragment into the sending queue.
 		 */
 
-		IP6_INC_STATS(Ip6FragCreates);
+		IP6_INC_STATS(FragCreates);
 
-		err = output(frag);
+		err = output(&frag);
 		if (err)
 			goto fail;
 	}
 	kfree_skb(skb);
-	IP6_INC_STATS(Ip6FragOKs);
+	IP6_INC_STATS(FragOKs);
 	return err;
 
 fail:
 	kfree_skb(skb); 
-	IP6_INC_STATS(Ip6FragFails);
+	IP6_INC_STATS(FragFails);
 	return err;
 }
 
@@ -1016,7 +1021,7 @@
 	return 0;
 error:
 	inet->cork.length -= length;
-	IP6_INC_STATS(Ip6OutDiscards);
+	IP6_INC_STATS(OutDiscards);
 	return err;
 }
 
@@ -1076,7 +1081,7 @@
 	ipv6_addr_copy(&hdr->daddr, final_dst);
 
 	skb->dst = dst_clone(&rt->u.dst);
-	IP6_INC_STATS(Ip6OutRequests);	
+	IP6_INC_STATS(OutRequests);	
 	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output);
 	if (err) {
 		if (err > 0)
@@ -1108,7 +1113,7 @@
 	struct sk_buff *skb;
 
 	while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
-		IP6_INC_STATS(Ip6OutDiscards);
+		IP6_INC_STATS(OutDiscards);
 		kfree_skb(skb);
 	}
 
diff -Nru a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
--- a/net/ipv6/ipcomp6.c	Tue Jun 15 22:20:40 2004
+++ b/net/ipv6/ipcomp6.c	Tue Jun 15 22:20:40 2004
@@ -118,10 +118,10 @@
 	return err;
 }
 
-static int ipcomp6_output(struct sk_buff *skb)
+static int ipcomp6_output(struct sk_buff **pskb)
 {
 	int err;
-	struct dst_entry *dst = skb->dst;
+	struct dst_entry *dst = (*pskb)->dst;
 	struct xfrm_state *x = dst->xfrm;
 	struct ipv6hdr *tmp_iph = NULL, *iph, *top_iph;
 	int hdr_len = 0;
@@ -132,54 +132,55 @@
 	int plen, dlen;
 	u8 *start, *scratch = ipcd->scratch;
 
-	if (skb->ip_summed == CHECKSUM_HW && skb_checksum_help(skb) == NULL) {
-		err = -EINVAL;
-		goto error_nolock;
+	if ((*pskb)->ip_summed == CHECKSUM_HW) {
+		err = skb_checksum_help(pskb, 0);
+		if (err)
+			goto error_nolock;
 	}
 
 	spin_lock_bh(&x->lock);
 
-	err = xfrm_check_output(x, skb, AF_INET6);
+	err = xfrm_check_output(x, *pskb, AF_INET6);
 	if (err)
 		goto error;
 
 	if (x->props.mode) {
 		hdr_len = sizeof(struct ipv6hdr);
 		nexthdr = IPPROTO_IPV6;
-		iph = skb->nh.ipv6h;
-		top_iph = (struct ipv6hdr *)skb_push(skb, sizeof(struct ipv6hdr));
+		iph = (*pskb)->nh.ipv6h;
+		top_iph = (struct ipv6hdr *)skb_push(*pskb, sizeof(struct ipv6hdr));
 		top_iph->version = 6;
 		top_iph->priority = iph->priority;
 		top_iph->flow_lbl[0] = iph->flow_lbl[0];
 		top_iph->flow_lbl[1] = iph->flow_lbl[1];
 		top_iph->flow_lbl[2] = iph->flow_lbl[2];
 		top_iph->nexthdr = IPPROTO_IPV6; /* initial */
-		top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
+		top_iph->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
 		top_iph->hop_limit = iph->hop_limit;
 		memcpy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr, sizeof(struct in6_addr));
 		memcpy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr, sizeof(struct in6_addr));
-		skb->nh.raw = skb->data; /* == top_iph */
-		skb->h.raw = skb->nh.raw + hdr_len;
+		(*pskb)->nh.raw = (*pskb)->data; /* == top_iph */
+		(*pskb)->h.raw = (*pskb)->nh.raw + hdr_len;
 	} else {
-		hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
+		hdr_len = ip6_find_1stfragopt(*pskb, &prevhdr);
 		nexthdr = *prevhdr;
 	}
 
 	/* check whether datagram len is larger than threshold */
-	if ((skb->len - hdr_len) < ipcd->threshold) {
+	if (((*pskb)->len - hdr_len) < ipcd->threshold) {
 		goto out_ok;
 	}
 
-	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
-		skb_linearize(skb, GFP_ATOMIC) != 0) {
+	if ((skb_is_nonlinear(*pskb) || skb_cloned(*pskb)) &&
+		skb_linearize(*pskb, GFP_ATOMIC) != 0) {
 		err = -ENOMEM;
 		goto error;
 	}
 
 	/* compression */
-	plen = skb->len - hdr_len;
+	plen = (*pskb)->len - hdr_len;
 	dlen = IPCOMP_SCRATCH_SIZE;
-	start = skb->data + hdr_len;
+	start = (*pskb)->data + hdr_len;
 
 	err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen);
 	if (err) {
@@ -189,7 +190,7 @@
 		goto out_ok;
 	}
 	memcpy(start, scratch, dlen);
-	pskb_trim(skb, hdr_len+dlen);
+	pskb_trim(*pskb, hdr_len+dlen);
 
 	/* insert ipcomp header and replace datagram */
 	tmp_iph = kmalloc(hdr_len, GFP_ATOMIC);
@@ -197,16 +198,16 @@
 		err = -ENOMEM;
 		goto error;
 	}
-	memcpy(tmp_iph, skb->nh.raw, hdr_len);
-	top_iph = (struct ipv6hdr*)skb_push(skb, sizeof(struct ipv6_comp_hdr));
+	memcpy(tmp_iph, (*pskb)->nh.raw, hdr_len);
+	top_iph = (struct ipv6hdr*)skb_push(*pskb, sizeof(struct ipv6_comp_hdr));
 	memcpy(top_iph, tmp_iph, hdr_len);
 	kfree(tmp_iph);
 
 	if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN))
 		IP6_ECN_clear(top_iph);
-	top_iph->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
-	skb->nh.raw = skb->data; /* top_iph */
-	ip6_find_1stfragopt(skb, &prevhdr); 
+	top_iph->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
+	(*pskb)->nh.raw = (*pskb)->data; /* top_iph */
+	ip6_find_1stfragopt(*pskb, &prevhdr); 
 	*prevhdr = IPPROTO_COMP;
 
 	ipch = (struct ipv6_comp_hdr *)((unsigned char *)top_iph + hdr_len);
@@ -214,13 +215,13 @@
 	ipch->flags = 0;
 	ipch->cpi = htons((u16 )ntohl(x->id.spi));
 
-	skb->h.raw = (unsigned char*)ipch;
+	(*pskb)->h.raw = (unsigned char*)ipch;
 out_ok:
-	x->curlft.bytes += skb->len;
+	x->curlft.bytes += (*pskb)->len;
 	x->curlft.packets++;
 	spin_unlock_bh(&x->lock);
 
-	if ((skb->dst = dst_pop(dst)) == NULL) {
+	if (((*pskb)->dst = dst_pop(dst)) == NULL) {
 		err = -EHOSTUNREACH;
 		goto error_nolock;
 	}
@@ -231,7 +232,7 @@
 error:
 	spin_unlock_bh(&x->lock);
 error_nolock:
-	kfree_skb(skb);
+	kfree_skb(*pskb);
 	goto out_exit;
 }
 
diff -Nru a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
--- a/net/ipv6/ipv6_sockglue.c	Tue Jun 15 22:20:36 2004
+++ b/net/ipv6/ipv6_sockglue.c	Tue Jun 15 22:20:36 2004
@@ -55,7 +55,7 @@
 
 #include <asm/uaccess.h>
 
-DEFINE_SNMP_STAT(struct ipv6_mib, ipv6_statistics);
+DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
 
 static struct packet_type ipv6_packet_type = {
 	.type = __constant_htons(ETH_P_IPV6), 
@@ -113,11 +113,11 @@
 	struct group_source_req *pgsr);
 extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf);
 extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
-	struct group_filter *optval, int *optlen);
+	struct group_filter __user *optval, int __user *optlen);
 
 
-int ipv6_setsockopt(struct sock *sk, int level, int optname, char *optval, 
-		    int optlen)
+int ipv6_setsockopt(struct sock *sk, int level, int optname,
+		    char __user *optval, int optlen)
 {
 	struct ipv6_pinfo *np = inet6_sk(sk);
 	int val, valbool;
@@ -131,7 +131,7 @@
 
 	if (optval == NULL)
 		val=0;
-	else if (get_user(val, (int *) optval))
+	else if (get_user(val, (int __user *) optval))
 		return -EFAULT;
 
 	valbool = (val!=0);
@@ -524,8 +524,8 @@
 	return -EINVAL;
 }
 
-int ipv6_getsockopt(struct sock *sk, int level, int optname, char *optval, 
-		    int *optlen)
+int ipv6_getsockopt(struct sock *sk, int level, int optname,
+		    char __user *optval, int __user *optlen)
 {
 	struct ipv6_pinfo *np = inet6_sk(sk);
 	int len;
@@ -557,7 +557,7 @@
 			return -EFAULT;
 		lock_sock(sk);
 		err = ip6_mc_msfget(sk, &gsf,
-			(struct group_filter *)optval, optlen);
+			(struct group_filter __user *)optval, optlen);
 		release_sock(sk);
 		return err;
 	}
diff -Nru a/net/ipv6/mcast.c b/net/ipv6/mcast.c
--- a/net/ipv6/mcast.c	Tue Jun 15 22:20:44 2004
+++ b/net/ipv6/mcast.c	Tue Jun 15 22:20:44 2004
@@ -527,7 +527,7 @@
 }
 
 int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
-	struct group_filter *optval, int *optlen)
+	struct group_filter __user *optval, int __user *optlen)
 {
 	int err, i, count, copycount;
 	struct in6_addr *group;
@@ -569,7 +569,7 @@
 	copycount = count < gsf->gf_numsrc ? count : gsf->gf_numsrc;
 	gsf->gf_numsrc = count;
 	if (put_user(GROUP_FILTER_SIZE(copycount), optlen) ||
-	    copy_to_user((void *)optval, gsf, GROUP_FILTER_SIZE(0))) {
+	    copy_to_user(optval, gsf, GROUP_FILTER_SIZE(0))) {
 		return -EFAULT;
 	}
 	for (i=0; i<copycount; i++) {
@@ -580,7 +580,7 @@
 		memset(&ss, 0, sizeof(ss));
 		psin6->sin6_family = AF_INET6;
 		psin6->sin6_addr = psl->sl_addr[i];
-	    	if (copy_to_user((void *)&optval->gf_slist[i], &ss, sizeof(ss)))
+	    	if (copy_to_user(&optval->gf_slist[i], &ss, sizeof(ss)))
 			return -EFAULT;
 	}
 	return 0;
@@ -1317,7 +1317,7 @@
 	struct inet6_dev *idev = in6_dev_get(skb->dev);
 	int err;
 
-	IP6_INC_STATS(Ip6OutRequests);
+	IP6_INC_STATS(OutRequests);
 	payload_len = skb->tail - (unsigned char *)skb->nh.ipv6h -
 		sizeof(struct ipv6hdr);
 	mldlen = skb->tail - skb->h.raw;
@@ -1329,9 +1329,9 @@
 		dev_queue_xmit);
 	if (!err) {
 		ICMP6_INC_STATS(idev,Icmp6OutMsgs);
-		IP6_INC_STATS(Ip6OutMcastPkts);
+		IP6_INC_STATS(OutMcastPkts);
 	} else
-		IP6_INC_STATS(Ip6OutDiscards);
+		IP6_INC_STATS(OutDiscards);
 
 	if (likely(idev != NULL))
 		in6_dev_put(idev);
@@ -1613,7 +1613,7 @@
 		     IPV6_TLV_ROUTERALERT, 2, 0, 0,
 		     IPV6_TLV_PADN, 0 };
 
-	IP6_INC_STATS(Ip6OutRequests);
+	IP6_INC_STATS(OutRequests);
 	snd_addr = addr;
 	if (type == ICMPV6_MGM_REDUCTION) {
 		snd_addr = &all_routers;
@@ -1627,7 +1627,7 @@
 	skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err);
 
 	if (skb == NULL) {
-		IP6_INC_STATS(Ip6OutDiscards);
+		IP6_INC_STATS(OutDiscards);
 		return;
 	}
 
@@ -1672,16 +1672,16 @@
 		else
 			ICMP6_INC_STATS(idev, Icmp6OutGroupMembResponses);
 		ICMP6_INC_STATS(idev, Icmp6OutMsgs);
-		IP6_INC_STATS(Ip6OutMcastPkts);
+		IP6_INC_STATS(OutMcastPkts);
 	} else
-		IP6_INC_STATS(Ip6OutDiscards);
+		IP6_INC_STATS(OutDiscards);
 
 	if (likely(idev != NULL))
 		in6_dev_put(idev);
 	return;
 
 out:
-	IP6_INC_STATS(Ip6OutDiscards);
+	IP6_INC_STATS(OutDiscards);
 	kfree_skb(skb);
 }
 
diff -Nru a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
--- a/net/ipv6/ndisc.c	Tue Jun 15 22:20:41 2004
+++ b/net/ipv6/ndisc.c	Tue Jun 15 22:20:41 2004
@@ -395,7 +395,7 @@
 
 	ndisc_flow_init(&fl, NDISC_NEIGHBOUR_ADVERTISEMENT, src_addr, daddr);
 
-	dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output2);
+	dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output);
 	if (!dst)
 		return;
 
@@ -452,7 +452,7 @@
 
 	skb->dst = dst;
 	idev = in6_dev_get(dst->dev);
-	IP6_INC_STATS(Ip6OutRequests);
+	IP6_INC_STATS(OutRequests);
 	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
 	if (!err) {
 		ICMP6_INC_STATS(idev, Icmp6OutNeighborAdvertisements);
@@ -486,7 +486,7 @@
 
 	ndisc_flow_init(&fl, NDISC_NEIGHBOUR_SOLICITATION, saddr, daddr);
 
-	dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output2);
+	dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output);
 	if (!dst)
 		return;
 
@@ -536,7 +536,7 @@
 	/* send it! */
 	skb->dst = dst;
 	idev = in6_dev_get(dst->dev);
-	IP6_INC_STATS(Ip6OutRequests);
+	IP6_INC_STATS(OutRequests);
 	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
 	if (!err) {
 		ICMP6_INC_STATS(idev, Icmp6OutNeighborSolicits);
@@ -562,7 +562,7 @@
 
 	ndisc_flow_init(&fl, NDISC_ROUTER_SOLICITATION, saddr, daddr);
 
-	dst = ndisc_dst_alloc(dev, NULL, daddr, ip6_output2);
+	dst = ndisc_dst_alloc(dev, NULL, daddr, ip6_output);
 	if (!dst)
 		return;
 
@@ -609,7 +609,7 @@
 	/* send it! */
 	skb->dst = dst;
 	idev = in6_dev_get(dst->dev);
-	IP6_INC_STATS(Ip6OutRequests);	
+	IP6_INC_STATS(OutRequests);	
 	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
 	if (!err) {
 		ICMP6_INC_STATS(idev, Icmp6OutRouterSolicits);
@@ -1335,7 +1335,7 @@
 
 	buff->dst = dst;
 	idev = in6_dev_get(dst->dev);
-	IP6_INC_STATS(Ip6OutRequests);
+	IP6_INC_STATS(OutRequests);
 	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output);
 	if (!err) {
 		ICMP6_INC_STATS(idev, Icmp6OutRedirects);
diff -Nru a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
--- a/net/ipv6/netfilter/ip6_tables.c	Tue Jun 15 22:20:58 2004
+++ b/net/ipv6/netfilter/ip6_tables.c	Tue Jun 15 22:20:58 2004
@@ -66,8 +66,6 @@
 #endif
 #define SMP_ALIGN(x) (((x) + SMP_CACHE_BYTES-1) & ~(SMP_CACHE_BYTES-1))
 
-/* Mutex protects lists (only traversed in user context). */
-static DECLARE_MUTEX(ip6t_mutex);
 
 /* Must have mutex */
 #define ASSERT_READ_LOCK(x) IP_NF_ASSERT(down_trylock(&ip6t_mutex) != 0)
@@ -544,7 +542,7 @@
 #endif
 
 static inline struct ip6t_table *
-find_table_lock(const char *name, int *error, struct semaphore *mutex)
+ip6t_find_table_lock(const char *name, int *error, struct semaphore *mutex)
 {
 	return find_inlist_lock(&ip6t_tables, name, "ip6table_", error, mutex);
 }
@@ -555,8 +553,8 @@
 	return find_inlist_lock(&ip6t_match, name, "ip6t_", error, mutex);
 }
 
-static inline struct ip6t_target *
-find_target_lock(const char *name, int *error, struct semaphore *mutex)
+struct ip6t_target *
+ip6t_find_target_lock(const char *name, int *error, struct semaphore *mutex)
 {
 	return find_inlist_lock(&ip6t_target, name, "ip6t_", error, mutex);
 }
@@ -771,7 +769,7 @@
 		goto cleanup_matches;
 
 	t = ip6t_get_target(e);
-	target = find_target_lock(t->u.user.name, &ret, &ip6t_mutex);
+	target = ip6t_find_target_lock(t->u.user.name, &ret, &ip6t_mutex);
 	if (!target) {
 		duprintf("check_entry: `%s' not found\n", t->u.user.name);
 		goto cleanup_matches;
@@ -1028,7 +1026,7 @@
 static int
 copy_entries_to_user(unsigned int total_size,
 		     struct ip6t_table *table,
-		     void *userptr)
+		     void __user *userptr)
 {
 	unsigned int off, num, countersize;
 	struct ip6t_entry *e;
@@ -1106,12 +1104,12 @@
 
 static int
 get_entries(const struct ip6t_get_entries *entries,
-	    struct ip6t_get_entries *uptr)
+	    struct ip6t_get_entries __user *uptr)
 {
 	int ret;
 	struct ip6t_table *t;
 
-	t = find_table_lock(entries->name, &ret, &ip6t_mutex);
+	t = ip6t_find_table_lock(entries->name, &ret, &ip6t_mutex);
 	if (t) {
 		duprintf("t->private->number = %u\n",
 			 t->private->number);
@@ -1133,7 +1131,7 @@
 }
 
 static int
-do_replace(void *user, unsigned int len)
+do_replace(void __user *user, unsigned int len)
 {
 	int ret;
 	struct ip6t_replace tmp;
@@ -1174,7 +1172,7 @@
 
 	duprintf("ip_tables: Translated table\n");
 
-	t = find_table_lock(tmp.name, &ret, &ip6t_mutex);
+	t = ip6t_find_table_lock(tmp.name, &ret, &ip6t_mutex);
 	if (!t)
 		goto free_newinfo_counters_untrans;
 
@@ -1254,7 +1252,7 @@
 }
 
 static int
-do_add_counters(void *user, unsigned int len)
+do_add_counters(void __user *user, unsigned int len)
 {
 	unsigned int i;
 	struct ip6t_counters_info tmp, *paddc;
@@ -1276,7 +1274,7 @@
 		goto free;
 	}
 
-	t = find_table_lock(tmp.name, &ret, &ip6t_mutex);
+	t = ip6t_find_table_lock(tmp.name, &ret, &ip6t_mutex);
 	if (!t)
 		goto free;
 
@@ -1302,7 +1300,7 @@
 }
 
 static int
-do_ip6t_set_ctl(struct sock *sk,	int cmd, void *user, unsigned int len)
+do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
 {
 	int ret;
 
@@ -1327,7 +1325,7 @@
 }
 
 static int
-do_ip6t_get_ctl(struct sock *sk, int cmd, void *user, int *len)
+do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
 {
 	int ret;
 
@@ -1351,7 +1349,7 @@
 			break;
 		}
 		name[IP6T_TABLE_MAXNAMELEN-1] = '\0';
-		t = find_table_lock(name, &ret, &ip6t_mutex);
+		t = ip6t_find_table_lock(name, &ret, &ip6t_mutex);
 		if (t) {
 			struct ip6t_getinfo info;
 
@@ -1964,6 +1962,7 @@
 EXPORT_SYMBOL(ip6t_register_table);
 EXPORT_SYMBOL(ip6t_unregister_table);
 EXPORT_SYMBOL(ip6t_do_table);
+EXPORT_SYMBOL(ip6t_find_target_lock);
 EXPORT_SYMBOL(ip6t_register_match);
 EXPORT_SYMBOL(ip6t_unregister_match);
 EXPORT_SYMBOL(ip6t_register_target);
diff -Nru a/net/ipv6/proc.c b/net/ipv6/proc.c
--- a/net/ipv6/proc.c	Tue Jun 15 22:20:39 2004
+++ b/net/ipv6/proc.c	Tue Jun 15 22:20:39 2004
@@ -57,43 +57,36 @@
 	return 0;
 }
 
-struct snmp6_item
-{
-	char *name;
-	int   offset;
-};
-#define SNMP6_SENTINEL	{ .name = NULL, .offset = 0 }
-
-static struct snmp6_item snmp6_ipv6_list[] = {
+static struct snmp_item snmp6_ipstats_list[] = {
 /* ipv6 mib according to RFC 2465 */
-#define SNMP6_GEN(x) { .name = #x , .offset = offsetof(struct ipv6_mib, x) }
-	SNMP6_GEN(Ip6InReceives),
-	SNMP6_GEN(Ip6InHdrErrors),
-	SNMP6_GEN(Ip6InTooBigErrors),
-	SNMP6_GEN(Ip6InNoRoutes),
-	SNMP6_GEN(Ip6InAddrErrors),
-	SNMP6_GEN(Ip6InUnknownProtos),
-	SNMP6_GEN(Ip6InTruncatedPkts),
-	SNMP6_GEN(Ip6InDiscards),
-	SNMP6_GEN(Ip6InDelivers),
-	SNMP6_GEN(Ip6OutForwDatagrams),
-	SNMP6_GEN(Ip6OutRequests),
-	SNMP6_GEN(Ip6OutDiscards),
-	SNMP6_GEN(Ip6OutNoRoutes),
-	SNMP6_GEN(Ip6ReasmTimeout),
-	SNMP6_GEN(Ip6ReasmReqds),
-	SNMP6_GEN(Ip6ReasmOKs),
-	SNMP6_GEN(Ip6ReasmFails),
-	SNMP6_GEN(Ip6FragOKs),
-	SNMP6_GEN(Ip6FragFails),
-	SNMP6_GEN(Ip6FragCreates),
-	SNMP6_GEN(Ip6InMcastPkts),
-	SNMP6_GEN(Ip6OutMcastPkts),
+#define SNMP6_GEN(x)	SNMP_ITEM(struct ipstats_mib, x, "Ip6" #x)
+	SNMP6_GEN(InReceives),
+	SNMP6_GEN(InHdrErrors),
+	SNMP6_GEN(InTooBigErrors),
+	SNMP6_GEN(InNoRoutes),
+	SNMP6_GEN(InAddrErrors),
+	SNMP6_GEN(InUnknownProtos),
+	SNMP6_GEN(InTruncatedPkts),
+	SNMP6_GEN(InDiscards),
+	SNMP6_GEN(InDelivers),
+	SNMP6_GEN(OutForwDatagrams),
+	SNMP6_GEN(OutRequests),
+	SNMP6_GEN(OutDiscards),
+	SNMP6_GEN(OutNoRoutes),
+	SNMP6_GEN(ReasmTimeout),
+	SNMP6_GEN(ReasmReqds),
+	SNMP6_GEN(ReasmOKs),
+	SNMP6_GEN(ReasmFails),
+	SNMP6_GEN(FragOKs),
+	SNMP6_GEN(FragFails),
+	SNMP6_GEN(FragCreates),
+	SNMP6_GEN(InMcastPkts),
+	SNMP6_GEN(OutMcastPkts),
 #undef SNMP6_GEN
-	SNMP6_SENTINEL
+	SNMP_ITEM_SENTINEL
 };
 
-static struct snmp6_item snmp6_icmp6_list[] = {
+static struct snmp_item snmp6_icmp6_list[] = {
 /* icmpv6 mib according to RFC 2466
 
    Exceptions:  {In|Out}AdminProhibs are removed, because I see
@@ -104,7 +97,7 @@
 		OutRouterAdvertisements too.
 		OutGroupMembQueries too.
  */
-#define SNMP6_GEN(x) { .name = #x , .offset = offsetof(struct icmpv6_mib, x) }
+#define SNMP6_GEN(x)	SNMP_ITEM(struct icmpv6_mib, x, #x)
 	SNMP6_GEN(Icmp6InMsgs),
 	SNMP6_GEN(Icmp6InErrors),
 	SNMP6_GEN(Icmp6InDestUnreachs),
@@ -134,17 +127,17 @@
 	SNMP6_GEN(Icmp6OutGroupMembResponses),
 	SNMP6_GEN(Icmp6OutGroupMembReductions),
 #undef SNMP6_GEN
-	SNMP6_SENTINEL
+	SNMP_ITEM_SENTINEL
 };
 
-static struct snmp6_item snmp6_udp6_list[] = {
-#define SNMP6_GEN(x) { .name = "Udp6" #x , .offset = offsetof(struct udp_mib, Udp##x) }
+static struct snmp_item snmp6_udp6_list[] = {
+#define SNMP6_GEN(x)	SNMP_ITEM(struct udp_mib, Udp##x, "Udp6" #x)
 	SNMP6_GEN(InDatagrams),
 	SNMP6_GEN(NoPorts),
 	SNMP6_GEN(InErrors),
 	SNMP6_GEN(OutDatagrams),
 #undef SNMP6_GEN
-	SNMP6_SENTINEL
+	SNMP_ITEM_SENTINEL
 };
 
 static unsigned long
@@ -167,7 +160,7 @@
 }
 
 static inline void
-snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp6_item *itemlist)
+snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_item *itemlist)
 {
 	int i;
 	for (i=0; itemlist[i].name; i++)
@@ -183,7 +176,7 @@
 		seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex);
 		snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list);
 	} else {
-		snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipv6_list);
+		snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list);
 		snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list);
 		snmp6_seq_show_item(seq, (void **)udp_stats_in6, snmp6_udp6_list);
 	}
diff -Nru a/net/ipv6/raw.c b/net/ipv6/raw.c
--- a/net/ipv6/raw.c	Tue Jun 15 22:20:39 2004
+++ b/net/ipv6/raw.c	Tue Jun 15 22:20:39 2004
@@ -283,7 +283,8 @@
 
 static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb)
 {
-	if (sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
+	if ((raw6_sk(sk)->checksum || sk->sk_filter) && 
+	    skb->ip_summed != CHECKSUM_UNNECESSARY) {
 		if ((unsigned short)csum_fold(skb_checksum(skb, 0, skb->len, skb->csum))) {
 			/* FIXME: increment a raw6 drops counter here */
 			kfree_skb(skb);
@@ -408,10 +409,8 @@
 		ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
 		sin6->sin6_flowinfo = 0;
 		sin6->sin6_scope_id = 0;
-		if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
-			struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
-			sin6->sin6_scope_id = opt->iif;
-		}
+		if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
+			sin6->sin6_scope_id = IP6CB(skb)->iif;
 	}
 
 	sock_recv_timestamp(msg, sk, skb);
@@ -452,6 +451,10 @@
 	struct sk_buff *skb;
 	int err = 0;
 	u16 *csum;
+	u32 tmp_csum;
+
+	if (!opt->checksum)
+		goto send;
 
 	if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)
 		goto out;
@@ -463,29 +466,32 @@
 		goto out;
 	}
 
+	/* should be check HW csum miyazawa */
 	if (skb_queue_len(&sk->sk_write_queue) == 1) {
 		/*
 		 * Only one fragment on the socket.
 		 */
-		/* should be check HW csum miyazawa */
-		*csum = csum_ipv6_magic(&fl->fl6_src,
-					&fl->fl6_dst,
-					len, fl->proto, skb->csum);
+		tmp_csum = skb->csum;
 	} else {
-		u32 tmp_csum = 0;
+		tmp_csum = 0;
 
 		skb_queue_walk(&sk->sk_write_queue, skb) {
 			tmp_csum = csum_add(tmp_csum, skb->csum);
 		}
-
-		tmp_csum = csum_ipv6_magic(&fl->fl6_src,
-					   &fl->fl6_dst,
-					   len, fl->proto, tmp_csum);
-		*csum = tmp_csum;
 	}
+
+	/* in case cksum was not initialized */
+	if (unlikely(*csum))
+		tmp_csum = csum_sub(tmp_csum, *csum);
+
+	*csum = csum_ipv6_magic(&fl->fl6_src,
+				&fl->fl6_dst,
+				len, fl->proto, tmp_csum);
+
 	if (*csum == 0)
 		*csum = -1;
-	ip6_push_pending_frames(sk);
+send:
+	err = ip6_push_pending_frames(sk);
 out:
 	return err;
 }
@@ -527,7 +533,7 @@
 	if (err)
 		goto error_fault;
 
-	IP6_INC_STATS(Ip6OutRequests);		
+	IP6_INC_STATS(OutRequests);		
 	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
 		      dst_output);
 	if (err > 0)
@@ -541,7 +547,7 @@
 	err = -EFAULT;
 	kfree_skb(skb);
 error:
-	IP6_INC_STATS(Ip6OutDiscards);
+	IP6_INC_STATS(OutDiscards);
 	return err; 
 }
 static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
@@ -702,13 +708,8 @@
 
 		if (err)
 			ip6_flush_pending_frames(sk);
-		else if (!(msg->msg_flags & MSG_MORE)) {
-			if (raw_opt->checksum) {
-				err = rawv6_push_pending_frames(sk, &fl, raw_opt, len);
-			} else {
-				err = ip6_push_pending_frames(sk);
-			}
-		}
+		else if (!(msg->msg_flags & MSG_MORE))
+			err = rawv6_push_pending_frames(sk, &fl, raw_opt, len);
 	}
 done:
 	ip6_dst_store(sk, dst,
@@ -730,7 +731,7 @@
 }
 
 static int rawv6_seticmpfilter(struct sock *sk, int level, int optname, 
-			       char *optval, int optlen)
+			       char __user *optval, int optlen)
 {
 	switch (optname) {
 	case ICMPV6_FILTER:
@@ -747,7 +748,7 @@
 }
 
 static int rawv6_geticmpfilter(struct sock *sk, int level, int optname, 
-			       char *optval, int *optlen)
+			       char __user *optval, int __user *optlen)
 {
 	int len;
 
@@ -773,7 +774,7 @@
 
 
 static int rawv6_setsockopt(struct sock *sk, int level, int optname, 
-			    char *optval, int optlen)
+			    char __user *optval, int optlen)
 {
 	struct raw6_opt *opt = raw6_sk(sk);
 	int val;
@@ -795,7 +796,7 @@
 					       optlen);
 	};
 
-  	if (get_user(val, (int *)optval))
+  	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 
 	switch (optname) {
@@ -820,7 +821,7 @@
 }
 
 static int rawv6_getsockopt(struct sock *sk, int level, int optname, 
-			    char *optval, int *optlen)
+			    char __user *optval, int __user *optlen)
 {
 	struct raw6_opt *opt = raw6_sk(sk);
 	int val, len;
@@ -872,7 +873,7 @@
 		case SIOCOUTQ:
 		{
 			int amount = atomic_read(&sk->sk_wmem_alloc);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 		case SIOCINQ:
 		{
@@ -884,7 +885,7 @@
 			if (skb != NULL)
 				amount = skb->tail - skb->h.raw;
 			spin_unlock_irq(&sk->sk_receive_queue.lock);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 
 		default:
diff -Nru a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
--- a/net/ipv6/reassembly.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv6/reassembly.c	Tue Jun 15 22:20:38 2004
@@ -284,7 +284,7 @@
 		spin_unlock(&fq->lock);
 
 		fq_put(fq);
-		IP6_INC_STATS_BH(Ip6ReasmFails);
+		IP6_INC_STATS_BH(ReasmFails);
 	}
 }
 
@@ -299,8 +299,8 @@
 
 	fq_kill(fq);
 
-	IP6_INC_STATS_BH(Ip6ReasmTimeout);
-	IP6_INC_STATS_BH(Ip6ReasmFails);
+	IP6_INC_STATS_BH(ReasmTimeout);
+	IP6_INC_STATS_BH(ReasmFails);
 
 	/* Send error only if the first segment arrived. */
 	if (fq->last_in&FIRST_IN && fq->fragments) {
@@ -386,7 +386,7 @@
 	return ip6_frag_intern(hash, fq);
 
 oom:
-	IP6_INC_STATS_BH(Ip6ReasmFails);
+	IP6_INC_STATS_BH(ReasmFails);
 	return NULL;
 }
 
@@ -426,7 +426,7 @@
 			((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
 
 	if ((unsigned int)end > IPV6_MAXPLEN) {
-		IP6_INC_STATS_BH(Ip6InHdrErrors);
+		IP6_INC_STATS_BH(InHdrErrors);
  		icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw);
  		return;
 	}
@@ -453,7 +453,7 @@
 			/* RFC2460 says always send parameter problem in
 			 * this case. -DaveM
 			 */
-			IP6_INC_STATS_BH(Ip6InHdrErrors);
+			IP6_INC_STATS_BH(InHdrErrors);
 			icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, 
 					  offsetof(struct ipv6hdr, payload_len));
 			return;
@@ -572,7 +572,7 @@
 	return;
 
 err:
-	IP6_INC_STATS(Ip6ReasmFails);
+	IP6_INC_STATS(ReasmFails);
 	kfree_skb(skb);
 }
 
@@ -666,7 +666,7 @@
 	if (head->ip_summed == CHECKSUM_HW)
 		head->csum = csum_partial(head->nh.raw, head->h.raw-head->nh.raw, head->csum);
 
-	IP6_INC_STATS_BH(Ip6ReasmOKs);
+	IP6_INC_STATS_BH(ReasmOKs);
 	fq->fragments = NULL;
 	*nhoffp = nhoff;
 	return 1;
@@ -679,7 +679,7 @@
 	if (net_ratelimit())
 		printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n");
 out_fail:
-	IP6_INC_STATS_BH(Ip6ReasmFails);
+	IP6_INC_STATS_BH(ReasmFails);
 	return -1;
 }
 
@@ -693,16 +693,16 @@
 
 	hdr = skb->nh.ipv6h;
 
-	IP6_INC_STATS_BH(Ip6ReasmReqds);
+	IP6_INC_STATS_BH(ReasmReqds);
 
 	/* Jumbo payload inhibits frag. header */
 	if (hdr->payload_len==0) {
-		IP6_INC_STATS(Ip6InHdrErrors);
+		IP6_INC_STATS(InHdrErrors);
 		icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
 		return -1;
 	}
 	if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+sizeof(struct frag_hdr))) {
-		IP6_INC_STATS(Ip6InHdrErrors);
+		IP6_INC_STATS(InHdrErrors);
 		icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
 		return -1;
 	}
@@ -713,7 +713,7 @@
 	if (!(fhdr->frag_off & htons(0xFFF9))) {
 		/* It is not a fragmented frame */
 		skb->h.raw += sizeof(struct frag_hdr);
-		IP6_INC_STATS_BH(Ip6ReasmOKs);
+		IP6_INC_STATS_BH(ReasmOKs);
 
 		*nhoffp = (u8*)fhdr - skb->nh.raw;
 		return 1;
@@ -738,7 +738,7 @@
 		return ret;
 	}
 
-	IP6_INC_STATS_BH(Ip6ReasmFails);
+	IP6_INC_STATS_BH(ReasmFails);
 	kfree_skb(skb);
 	return -1;
 }
diff -Nru a/net/ipv6/route.c b/net/ipv6/route.c
--- a/net/ipv6/route.c	Tue Jun 15 22:20:43 2004
+++ b/net/ipv6/route.c	Tue Jun 15 22:20:43 2004
@@ -83,9 +83,12 @@
 static struct rt6_info * ip6_rt_copy(struct rt6_info *ort);
 static struct dst_entry	*ip6_dst_check(struct dst_entry *dst, u32 cookie);
 static struct dst_entry *ip6_negative_advice(struct dst_entry *);
+static void		ip6_dst_destroy(struct dst_entry *);
+static void		ip6_dst_ifdown(struct dst_entry *, int how);
 static int		 ip6_dst_gc(void);
 
 static int		ip6_pkt_discard(struct sk_buff *skb);
+static int		ip6_pkt_discard_out(struct sk_buff **pskb);
 static void		ip6_link_failure(struct sk_buff *skb);
 static void		ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu);
 
@@ -95,6 +98,8 @@
 	.gc			=	ip6_dst_gc,
 	.gc_thresh		=	1024,
 	.check			=	ip6_dst_check,
+	.destroy		=	ip6_dst_destroy,
+	.ifdown			=	ip6_dst_ifdown,
 	.negative_advice	=	ip6_negative_advice,
 	.link_failure		=	ip6_link_failure,
 	.update_pmtu		=	ip6_rt_update_pmtu,
@@ -111,7 +116,7 @@
 			.error		= -ENETUNREACH,
 			.metrics	= { [RTAX_HOPLIMIT - 1] = 255, },
 			.input		= ip6_pkt_discard,
-			.output		= ip6_pkt_discard,
+			.output		= ip6_pkt_discard_out,
 			.ops		= &ip6_dst_ops,
 			.path		= (struct dst_entry*)&ip6_null_entry,
 		}
@@ -134,7 +139,23 @@
 /* allocate dst with ip6_dst_ops */
 static __inline__ struct rt6_info *ip6_dst_alloc(void)
 {
-	return dst_alloc(&ip6_dst_ops);
+	return (struct rt6_info *)dst_alloc(&ip6_dst_ops);
+}
+
+static void ip6_dst_destroy(struct dst_entry *dst)
+{
+	struct rt6_info *rt = (struct rt6_info *)dst;
+	struct inet6_dev *idev = rt->rt6i_idev;
+
+	if (idev != NULL) {
+		rt->rt6i_idev = NULL;
+		in6_dev_put(idev);
+	}	
+}
+
+static void ip6_dst_ifdown(struct dst_entry *dst, int how)
+{
+	ip6_dst_destroy(dst);
 }
 
 /*
@@ -554,37 +575,43 @@
 
 	if (mtu < dst_pmtu(dst) && rt6->rt6i_dst.plen == 128) {
 		rt6->rt6i_flags |= RTF_MODIFIED;
+		if (mtu < IPV6_MIN_MTU)
+			mtu = IPV6_MIN_MTU;
 		dst->metrics[RTAX_MTU-1] = mtu;
 	}
 }
 
 /* Protected by rt6_lock.  */
 static struct dst_entry *ndisc_dst_gc_list;
+static int ipv6_get_mtu(struct net_device *dev);
+static inline unsigned int ipv6_advmss(unsigned int mtu);
 
 struct dst_entry *ndisc_dst_alloc(struct net_device *dev, 
 				  struct neighbour *neigh,
 				  struct in6_addr *addr,
-				  int (*output)(struct sk_buff *))
+				  int (*output)(struct sk_buff **))
 {
 	struct rt6_info *rt = ip6_dst_alloc();
 
 	if (unlikely(rt == NULL))
 		goto out;
 
-	if (dev)
-		dev_hold(dev);
+	dev_hold(dev);
 	if (neigh)
 		neigh_hold(neigh);
 	else
 		neigh = ndisc_get_neigh(dev, addr);
 
 	rt->rt6i_dev	  = dev;
+	rt->rt6i_idev     = in6_dev_get(dev);
 	rt->rt6i_nexthop  = neigh;
 	rt->rt6i_expires  = 0;
 	rt->rt6i_flags    = RTF_LOCAL;
 	rt->rt6i_metric   = 0;
 	atomic_set(&rt->u.dst.__refcnt, 1);
 	rt->u.dst.metrics[RTAX_HOPLIMIT-1] = 255;
+	rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev);
+	rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst));
 	rt->u.dst.output  = output;
 
 	write_lock_bh(&rt6_lock);
@@ -712,6 +739,12 @@
 	if (rtmsg->rtmsg_src_len)
 		return -EINVAL;
 #endif
+	if (rtmsg->rtmsg_ifindex) {
+		dev = dev_get_by_index(rtmsg->rtmsg_ifindex);
+		if (!dev)
+			return -ENODEV;
+	}
+
 	if (rtmsg->rtmsg_metric == 0)
 		rtmsg->rtmsg_metric = IP6_RT_PRIO_USER;
 
@@ -737,13 +770,6 @@
 
 	rt->u.dst.output = ip6_output;
 
-	if (rtmsg->rtmsg_ifindex) {
-		dev = dev_get_by_index(rtmsg->rtmsg_ifindex);
-		err = -ENODEV;
-		if (dev == NULL)
-			goto out;
-	}
-
 	ipv6_addr_prefix(&rt->rt6i_dst.addr, 
 			 &rtmsg->rtmsg_dst, rtmsg->rtmsg_dst_len);
 	rt->rt6i_dst.plen = rtmsg->rtmsg_dst_len;
@@ -767,7 +793,7 @@
 			dev_put(dev);
 		dev = &loopback_dev;
 		dev_hold(dev);
-		rt->u.dst.output = ip6_pkt_discard;
+		rt->u.dst.output = ip6_pkt_discard_out;
 		rt->u.dst.input = ip6_pkt_discard;
 		rt->u.dst.error = -ENETUNREACH;
 		rt->rt6i_flags = RTF_REJECT|RTF_NONEXTHOP;
@@ -870,6 +896,7 @@
 	if (!rt->u.dst.metrics[RTAX_ADVMSS-1])
 		rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst));
 	rt->u.dst.dev = dev;
+	rt->rt6i_idev = in6_dev_get(dev);
 	return rt6_ins(rt, nlh, _rtattr);
 
 out:
@@ -1136,6 +1163,9 @@
 		rt->u.dst.dev = ort->u.dst.dev;
 		if (rt->u.dst.dev)
 			dev_hold(rt->u.dst.dev);
+		rt->rt6i_idev = ort->rt6i_idev;
+		if (rt->rt6i_idev)
+			in6_dev_hold(rt->rt6i_idev);
 		rt->u.dst.lastuse = jiffies;
 		rt->rt6i_expires = 0;
 
@@ -1217,7 +1247,7 @@
 	read_unlock_bh(&rt6_lock);
 }
 
-int ipv6_route_ioctl(unsigned int cmd, void *arg)
+int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct in6_rtmsg rtmsg;
 	int err;
@@ -1257,12 +1287,17 @@
 
 int ip6_pkt_discard(struct sk_buff *skb)
 {
-	IP6_INC_STATS(Ip6OutNoRoutes);
+	IP6_INC_STATS(OutNoRoutes);
 	icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev);
 	kfree_skb(skb);
 	return 0;
 }
 
+int ip6_pkt_discard_out(struct sk_buff **pskb)
+{
+	return ip6_pkt_discard(*pskb);
+}
+
 /*
  *	Add address
  */
@@ -1280,6 +1315,7 @@
 	rt->u.dst.input = ip6_input;
 	rt->u.dst.output = ip6_output;
 	rt->rt6i_dev = &loopback_dev;
+	rt->rt6i_idev = in6_dev_get(&loopback_dev);
 	rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev);
 	rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_pmtu(&rt->u.dst));
 	rt->u.dst.metrics[RTAX_HOPLIMIT-1] = ipv6_get_hoplimit(rt->rt6i_dev);
@@ -1884,7 +1920,7 @@
 
 static
 int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
-			      void *buffer, size_t *lenp)
+			      void __user *buffer, size_t *lenp)
 {
 	if (write) {
 		proc_dointvec(ctl, write, filp, buffer, lenp);
diff -Nru a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
--- a/net/ipv6/tcp_ipv6.c	Tue Jun 15 22:20:41 2004
+++ b/net/ipv6/tcp_ipv6.c	Tue Jun 15 22:20:41 2004
@@ -479,7 +479,7 @@
 
 	/* And established part... */
 	sk_for_each(sk2, node, &head->chain) {
-		if(TCP_IPV6_MATCH(sk, saddr, daddr, ports, dif))
+		if(TCP_IPV6_MATCH(sk2, saddr, daddr, ports, dif))
 			goto not_unique;
 	}
 
@@ -536,8 +536,7 @@
 
 static __inline__ int tcp_v6_iif(struct sk_buff *skb)
 {
-	struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
-	return opt->iif;
+	return IP6CB(skb)->iif;
 }
 
 static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, 
@@ -879,7 +878,7 @@
 		    np->rxopt.bits.srcrt == 2 &&
 		    req->af.v6_req.pktopts) {
 			struct sk_buff *pktopts = req->af.v6_req.pktopts;
-			struct inet6_skb_parm *rxopt = (struct inet6_skb_parm *)pktopts->cb;
+			struct inet6_skb_parm *rxopt = IP6CB(pktopts);
 			if (rxopt->srcrt)
 				opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(pktopts->nh.raw + rxopt->srcrt));
 		}
@@ -932,7 +931,7 @@
 static int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb)
 {
 	struct ipv6_pinfo *np = inet6_sk(sk);
-	struct inet6_skb_parm *opt = (struct inet6_skb_parm *)skb->cb;
+	struct inet6_skb_parm *opt = IP6CB(skb);
 
 	if (np->rxopt.all) {
 		if ((opt->hop && np->rxopt.bits.hopopts) ||
@@ -1183,7 +1182,7 @@
 		goto drop;		
 	}
 
-	if (tcp_acceptq_is_full(sk) && tcp_synq_young(sk) > 1)
+	if (sk_acceptq_is_full(sk) && tcp_synq_young(sk) > 1)
 		goto drop;
 
 	req = tcp_openreq_alloc();
@@ -1300,12 +1299,12 @@
 
 	opt = np->opt;
 
-	if (tcp_acceptq_is_full(sk))
+	if (sk_acceptq_is_full(sk))
 		goto out_overflow;
 
 	if (np->rxopt.bits.srcrt == 2 &&
 	    opt == NULL && req->af.v6_req.pktopts) {
-		struct inet6_skb_parm *rxopt = (struct inet6_skb_parm *)req->af.v6_req.pktopts->cb;
+		struct inet6_skb_parm *rxopt = IP6CB(req->af.v6_req.pktopts);
 		if (rxopt->srcrt)
 			opt = ipv6_invert_rthdr(sk, (struct ipv6_rt_hdr*)(req->af.v6_req.pktopts->nh.raw+rxopt->srcrt));
 	}
@@ -1933,7 +1932,7 @@
 	dest = &req->af.v6_req.rmt_addr;
 	seq_printf(seq,
 		   "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
-		   "%02X %08X:%08X %02X:%08X %08X %5d %8d %d %d %p\n",
+		   "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p\n",
 		   i,
 		   src->s6_addr32[0], src->s6_addr32[1],
 		   src->s6_addr32[2], src->s6_addr32[3],
@@ -2019,7 +2018,7 @@
 
 	seq_printf(seq,
 		   "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
-		   "%02X %08X:%08X %02X:%08X %08X %5d %8d %d %d %p\n",
+		   "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p\n",
 		   i,
 		   src->s6_addr32[0], src->s6_addr32[1],
 		   src->s6_addr32[2], src->s6_addr32[3], srcp,
diff -Nru a/net/ipv6/udp.c b/net/ipv6/udp.c
--- a/net/ipv6/udp.c	Tue Jun 15 22:20:44 2004
+++ b/net/ipv6/udp.c	Tue Jun 15 22:20:44 2004
@@ -432,10 +432,8 @@
 
 			if (np->rxopt.all)
 				datagram_recv_ctl(sk, msg, skb);
-			if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
-				struct inet6_skb_parm *opt = (struct inet6_skb_parm *) skb->cb;
-				sin6->sin6_scope_id = opt->iif;
-			}
+			if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
+				sin6->sin6_scope_id = IP6CB(skb)->iif;
 		}
   	}
 	err = copied;
@@ -574,34 +572,26 @@
 				struct sk_buff *skb)
 {
 	struct sock *sk, *sk2;
-	struct sk_buff *buff;
 	int dif;
 
 	read_lock(&udp_hash_lock);
 	sk = sk_head(&udp_hash[ntohs(uh->dest) & (UDP_HTABLE_SIZE - 1)]);
 	dif = skb->dev->ifindex;
 	sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
-	if (!sk)
-		goto free_skb;
+	if (!sk) {
+		kfree_skb(skb);
+		goto out;
+	}
 
-	buff = NULL;
 	sk2 = sk;
 	while ((sk2 = udp_v6_mcast_next(sk_next(sk2), uh->dest, daddr,
 					uh->source, saddr, dif))) {
-		if (!buff) {
-			buff = skb_clone(skb, GFP_ATOMIC);
-			if (!buff)
-				continue;
-		}
-		if (udpv6_queue_rcv_skb(sk2, buff) >= 0)
-			buff = NULL;
-	}
-	if (buff)
-		kfree_skb(buff);
-	if (udpv6_queue_rcv_skb(sk, skb) < 0) {
-free_skb:
-		kfree_skb(skb);
+		struct sk_buff *buff = skb_clone(skb, GFP_ATOMIC);
+		if (buff)
+			udpv6_queue_rcv_skb(sk2, buff);
 	}
+	udpv6_queue_rcv_skb(sk, skb);
+out:
 	read_unlock(&udp_hash_lock);
 }
 
@@ -1026,7 +1016,7 @@
  *	Socket option code for UDP
  */
 static int udpv6_setsockopt(struct sock *sk, int level, int optname, 
-			  char *optval, int optlen)
+			  char __user *optval, int optlen)
 {
 	struct udp_opt *up = udp_sk(sk);
 	int val;
@@ -1038,7 +1028,7 @@
 	if(optlen<sizeof(int))
 		return -EINVAL;
 
-	if (get_user(val, (int *)optval))
+	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 
 	switch(optname) {
@@ -1066,7 +1056,7 @@
 }
 
 static int udpv6_getsockopt(struct sock *sk, int level, int optname, 
-			  char *optval, int *optlen)
+			  char __user *optval, int __user *optlen)
 {
 	struct udp_opt *up = udp_sk(sk);
 	int val, len;
diff -Nru a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
--- a/net/ipv6/xfrm6_policy.c	Tue Jun 15 22:20:38 2004
+++ b/net/ipv6/xfrm6_policy.c	Tue Jun 15 22:20:38 2004
@@ -107,7 +107,6 @@
 			goto error;
 		}
 
-		dst1->xfrm = xfrm[i];
 		if (!dst)
 			dst = dst1;
 		else {
@@ -139,9 +138,11 @@
 		dst_hold(&rt->u.dst);
 	}
 	dst_prev->child = &rt->u.dst;
+	i = 0;
 	for (dst_prev = dst; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {
 		struct xfrm_dst *x = (struct xfrm_dst*)dst_prev;
 
+		dst_prev->xfrm = xfrm[i++];
 		dst_prev->dev = rt->u.dst.dev;
 		if (rt->u.dst.dev)
 			dev_hold(rt->u.dst.dev);
@@ -236,10 +237,10 @@
 {
 	struct dst_entry *path = dst->path;
 
-	if (mtu >= 1280 && mtu < dst_pmtu(dst))
-		return;
-
-	path->ops->update_pmtu(path, mtu);
+	if (mtu >= IPV6_MIN_MTU && mtu < dst_pmtu(dst))
+		path->ops->update_pmtu(path, mtu);
+	
+	return;
 }
 
 struct dst_ops xfrm6_dst_ops = {
diff -Nru a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
--- a/net/ipv6/xfrm6_state.c	Tue Jun 15 22:20:39 2004
+++ b/net/ipv6/xfrm6_state.c	Tue Jun 15 22:20:39 2004
@@ -90,9 +90,7 @@
 			    break;
 		    }
 	}
-	if (x0) {
-		xfrm_state_hold(x0);
-	} else if (create && (x0 = xfrm_state_alloc()) != NULL) {
+	if (!x0 && create && (x0 = xfrm_state_alloc()) != NULL) {
 		ipv6_addr_copy((struct in6_addr *)x0->sel.daddr.a6,
 			       (struct in6_addr *)daddr);
 		ipv6_addr_copy((struct in6_addr *)x0->sel.saddr.a6,
@@ -110,11 +108,14 @@
 		x0->props.reqid = reqid;
 		x0->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES;
 		xfrm_state_hold(x0);
-		mod_timer(&x0->timer, jiffies + XFRM_ACQ_EXPIRES*HZ);
+		x0->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ;
+		add_timer(&x0->timer);
 		xfrm_state_hold(x0);
 		list_add_tail(&x0->bydst, xfrm6_state_afinfo.state_bydst+h);
 		wake_up(&km_waitq);
 	}
+	if (x0)
+		xfrm_state_hold(x0);
 	return x0;
 }
 
diff -Nru a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
--- a/net/ipx/af_ipx.c	Tue Jun 15 22:20:37 2004
+++ b/net/ipx/af_ipx.c	Tue Jun 15 22:20:37 2004
@@ -90,7 +90,7 @@
 			       struct iovec *iov, int len, int noblock);
 extern int ipxrtr_route_skb(struct sk_buff *skb);
 extern struct ipx_route *ipxrtr_lookup(__u32 net);
-extern int ipxrtr_ioctl(unsigned int cmd, void *arg);
+extern int ipxrtr_ioctl(unsigned int cmd, void __user *arg);
 
 #undef IPX_REFCNT_DEBUG
 #ifdef IPX_REFCNT_DEBUG
@@ -114,7 +114,7 @@
 		ipx_primary_net = ipx_interfaces_head();
 }
 
-static int ipxcfg_get_config_data(struct ipx_config_data *arg)
+static int ipxcfg_get_config_data(struct ipx_config_data __user *arg)
 {
 	struct ipx_config_data vals;
 
@@ -1141,7 +1141,7 @@
 	return intrfc;
 }
 
-static int ipxitf_ioctl(unsigned int cmd, void *arg)
+static int ipxitf_ioctl(unsigned int cmd, void __user *arg)
 {
 	int rc = -EINVAL;
 	struct ifreq ifr;
@@ -1204,14 +1204,14 @@
 	}
 	case SIOCAIPXITFCRT: 
 		rc = -EFAULT;
-		if (get_user(val, (unsigned char *) arg))
+		if (get_user(val, (unsigned char __user *) arg))
 			break;
 		rc = 0;
 		ipxcfg_auto_create_interfaces = val;
 		break;
 	case SIOCAIPXPRISLT: 
 		rc = -EFAULT;
-		if (get_user(val, (unsigned char *) arg))
+		if (get_user(val, (unsigned char __user *) arg))
 			break;
 		rc = 0;
 		ipxcfg_set_auto_select(val);
@@ -1285,7 +1285,7 @@
  * socket object. */
 
 static int ipx_setsockopt(struct socket *sock, int level, int optname,
-			  char *optval, int optlen)
+			  char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	int opt;
@@ -1295,7 +1295,7 @@
 		goto out;
 
 	rc = -EFAULT;
-	if (get_user(opt, (unsigned int *)optval))
+	if (get_user(opt, (unsigned int __user *)optval))
 		goto out;
 
 	rc = -ENOPROTOOPT;
@@ -1309,7 +1309,7 @@
 }
 
 static int ipx_getsockopt(struct socket *sock, int level, int optname,
-	char *optval, int *optlen)
+	char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	int val = 0;
@@ -1695,7 +1695,7 @@
 	/* Socket gets bound below anyway */
 /*	if (sk->sk_zapped)
 		return -EIO; */	/* Socket not bound */
-	if (flags & ~MSG_DONTWAIT)
+	if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
 		goto out;
 
 	/* Max possible packet size limited by 16 bit pktsize in header */
@@ -1823,13 +1823,14 @@
 	int rc = 0;
 	long amount = 0;
 	struct sock *sk = sock->sk;
+	void __user *argp = (void __user *)arg;
 
 	switch (cmd) {
 	case TIOCOUTQ:
 		amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
 		if (amount < 0)
 			amount = 0;
-		rc = put_user(amount, (int *)arg);
+		rc = put_user(amount, (int __user *)argp);
 		break;
 	case TIOCINQ: {
 		struct sk_buff *skb = skb_peek(&sk->sk_receive_queue);
@@ -1837,14 +1838,14 @@
 		 * user tasks fiddle here */
 		if (skb)
 			amount = skb->len - sizeof(struct ipxhdr);
-		rc = put_user(amount, (int *)arg);
+		rc = put_user(amount, (int __user *)argp);
 		break;
 	}
 	case SIOCADDRT:
 	case SIOCDELRT:
 		rc = -EPERM;
 		if (capable(CAP_NET_ADMIN))
-			rc = ipxrtr_ioctl(cmd, (void *)arg);
+			rc = ipxrtr_ioctl(cmd, argp);
 		break;
 	case SIOCSIFADDR:
 	case SIOCAIPXITFCRT:
@@ -1853,10 +1854,10 @@
 		if (!capable(CAP_NET_ADMIN))
 			break;
 	case SIOCGIFADDR:
-		rc = ipxitf_ioctl(cmd, (void *)arg);
+		rc = ipxitf_ioctl(cmd, argp);
 		break;
 	case SIOCIPXCFGDATA:
-		rc = ipxcfg_get_config_data((void *)arg);
+		rc = ipxcfg_get_config_data(argp);
 		break;
 	case SIOCIPXNCPCONN:
 		/*
@@ -1867,12 +1868,12 @@
         	if (!capable(CAP_NET_ADMIN))
 			break;
 		rc = get_user(ipx_sk(sk)->ipx_ncp_conn,
-			      (const unsigned short *)(arg));
+			      (const unsigned short __user *)argp);
 		break;
 	case SIOCGSTAMP:
 		rc = -EINVAL;
 		if (sk) 
-			rc = sock_get_timestamp(sk, (struct timeval *)arg);
+			rc = sock_get_timestamp(sk, argp);
 		break;
 	case SIOCGIFDSTADDR:
 	case SIOCSIFDSTADDR:
@@ -1883,7 +1884,7 @@
 		rc = -EINVAL;
 		break;
 	default:
-		rc = dev_ioctl(cmd,(void *) arg);
+		rc = dev_ioctl(cmd, argp);
 		break;
 	}
 
diff -Nru a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c
--- a/net/ipx/ipx_route.c	Tue Jun 15 22:20:40 2004
+++ b/net/ipx/ipx_route.c	Tue Jun 15 22:20:40 2004
@@ -256,7 +256,7 @@
 /*
  * We use a normal struct rtentry for route handling
  */
-int ipxrtr_ioctl(unsigned int cmd, void *arg)
+int ipxrtr_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct rtentry rt;	/* Use these to behave like 'other' stacks */
 	struct sockaddr_ipx *sg, *st;
diff -Nru a/net/irda/af_irda.c b/net/irda/af_irda.c
--- a/net/irda/af_irda.c	Tue Jun 15 22:20:38 2004
+++ b/net/irda/af_irda.c	Tue Jun 15 22:20:38 2004
@@ -1269,7 +1269,7 @@
 	IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
 
 	/* Note : socket.c set MSG_EOR on SEQPACKET sockets */
-	if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR))
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
 		return -EINVAL;
 
 	if (sk->sk_shutdown & SEND_SHUTDOWN) {
@@ -1521,7 +1521,7 @@
 
 	IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
 
-	if (msg->msg_flags & ~MSG_DONTWAIT)
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
 		return -EINVAL;
 
 	if (sk->sk_shutdown & SEND_SHUTDOWN) {
@@ -1593,7 +1593,7 @@
 
 	IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
 
-	if (msg->msg_flags & ~MSG_DONTWAIT)
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
 		return -EINVAL;
 
 	if (sk->sk_shutdown & SEND_SHUTDOWN) {
@@ -1779,7 +1779,7 @@
 		amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
 		if (amount < 0)
 			amount = 0;
-		if (put_user(amount, (unsigned int *)arg))
+		if (put_user(amount, (unsigned int __user *)arg))
 			return -EFAULT;
 		return 0;
 	}
@@ -1790,14 +1790,14 @@
 		/* These two are safe on a single CPU system as only user tasks fiddle here */
 		if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
 			amount = skb->len;
-		if (put_user(amount, (unsigned int *)arg))
+		if (put_user(amount, (unsigned int __user *)arg))
 			return -EFAULT;
 		return 0;
 	}
 
 	case SIOCGSTAMP:
 		if (sk != NULL)
-			return sock_get_timestamp(sk, (struct timeval *)arg);
+			return sock_get_timestamp(sk, (struct timeval __user *)arg);
 		return -EINVAL;
 
 	case SIOCGIFADDR:
@@ -1813,7 +1813,7 @@
 		return -EINVAL;
 	default:
 		IRDA_DEBUG(1, "%s(), doing device ioctl!\n", __FUNCTION__);
-		return dev_ioctl(cmd, (void *) arg);
+		return dev_ioctl(cmd, (void __user *) arg);
 	}
 
 	/*NOTREACHED*/
@@ -1827,7 +1827,7 @@
  *
  */
 static int irda_setsockopt(struct socket *sock, int level, int optname,
-			   char *optval, int optlen)
+			   char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	struct irda_sock *self = irda_sk(sk);
@@ -1860,7 +1860,7 @@
 			return -ENOMEM;
 
 		/* Copy query to the driver. */
-		if (copy_from_user(ias_opt, (char *)optval, optlen)) {
+		if (copy_from_user(ias_opt, optval, optlen)) {
 			kfree(ias_opt);
 			return -EFAULT;
 		}
@@ -1962,7 +1962,7 @@
 			return -ENOMEM;
 
 		/* Copy query to the driver. */
-		if (copy_from_user(ias_opt, (char *)optval, optlen)) {
+		if (copy_from_user(ias_opt, optval, optlen)) {
 			kfree(ias_opt);
 			return -EFAULT;
 		}
@@ -2012,7 +2012,7 @@
 		if (optlen < sizeof(int))
 			return -EINVAL;
 
-		if (get_user(opt, (int *)optval))
+		if (get_user(opt, (int __user *)optval))
 			return -EFAULT;
 
 		/* Only possible for a seqpacket service (TTP with SAR) */
@@ -2031,7 +2031,7 @@
 			return -EINVAL;
 
 		/* The input is really a (__u8 hints[2]), easier as an int */
-		if (get_user(opt, (int *)optval))
+		if (get_user(opt, (int __user *)optval))
 			return -EFAULT;
 
 		/* Unregister any old registration */
@@ -2050,7 +2050,7 @@
 			return -EINVAL;
 
 		/* The input is really a (__u8 hints[2]), easier as an int */
-		if (get_user(opt, (int *)optval))
+		if (get_user(opt, (int __user *)optval))
 			return -EFAULT;
 
 		/* Set the new hint mask */
@@ -2121,7 +2121,7 @@
  * Function irda_getsockopt (sock, level, optname, optval, optlen)
  */
 static int irda_getsockopt(struct socket *sock, int level, int optname,
-			   char *optval, int *optlen)
+			   char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	struct irda_sock *self = irda_sk(sk);
@@ -2211,7 +2211,7 @@
 			return -ENOMEM;
 
 		/* Copy query to the driver. */
-		if (copy_from_user((char *) ias_opt, (char *)optval, len)) {
+		if (copy_from_user(ias_opt, optval, len)) {
 			kfree(ias_opt);
 			return -EFAULT;
 		}
@@ -2245,7 +2245,7 @@
 		}
 
 		/* Copy reply to the user */
-		if (copy_to_user((char *)optval, (char *) ias_opt,
+		if (copy_to_user(optval, ias_opt,
 				 sizeof(struct irda_ias_set))) {
 			kfree(ias_opt);
 			return -EFAULT;
@@ -2267,7 +2267,7 @@
 			return -ENOMEM;
 
 		/* Copy query to the driver. */
-		if (copy_from_user((char *) ias_opt, (char *)optval, len)) {
+		if (copy_from_user(ias_opt, optval, len)) {
 			kfree(ias_opt);
 			return -EFAULT;
 		}
@@ -2351,7 +2351,7 @@
 		}
 
 		/* Copy reply to the user */
-		if (copy_to_user((char *)optval, (char *) ias_opt,
+		if (copy_to_user(optval, ias_opt,
 				 sizeof(struct irda_ias_set))) {
 			kfree(ias_opt);
 			return -EFAULT;
@@ -2378,7 +2378,7 @@
 		if (len != sizeof(int))
 			return -EINVAL;
 		/* Get timeout in ms (max time we block the caller) */
-		if (get_user(val, (int *)optval))
+		if (get_user(val, (int __user *)optval))
 			return -EFAULT;
 
 		/* Tell IrLMP we want to be notified */
@@ -2438,7 +2438,7 @@
 		 * If the user want more details, he should query
 		 * the whole discovery log and pick one device...
 		 */
-		if (put_user(daddr, (int *)optval))
+		if (put_user(daddr, (int __user *)optval))
 			return -EFAULT;
 
 		break;
diff -Nru a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
--- a/net/irda/ircomm/ircomm_tty.c	Tue Jun 15 22:20:38 2004
+++ b/net/irda/ircomm/ircomm_tty.c	Tue Jun 15 22:20:38 2004
@@ -721,8 +721,10 @@
 		kbuf = kmalloc(count, GFP_KERNEL);
 		if (kbuf == NULL)
 			return -ENOMEM;
-		if (copy_from_user(kbuf, ubuf, count))
+		if (copy_from_user(kbuf, ubuf, count)) {
+			kfree(kbuf);
 			return -EFAULT;
+		}
 	} else
 		/* The buffer is already in kernel space */
 		kbuf = (unsigned char *) ubuf;
@@ -779,6 +781,8 @@
 					    self->max_header_size);
 			if (!skb) {
 				spin_unlock_irqrestore(&self->spinlock, flags);
+	                        if (from_user)
+		                        kfree(kbuf);
 				return -ENOBUFS;
 			}
 			skb_reserve(skb, self->max_header_size);
@@ -873,7 +877,7 @@
 	orig_jiffies = jiffies;
 
 	/* Set poll time to 200 ms */
-	poll_time = IRDA_MIN(timeout, MSECS_TO_JIFFIES(200));
+	poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200));
 
 	spin_lock_irqsave(&self->spinlock, flags);
 	while (self->tx_skb && self->tx_skb->len) {
diff -Nru a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c
--- a/net/irda/ircomm/ircomm_tty_ioctl.c	Tue Jun 15 22:20:36 2004
+++ b/net/irda/ircomm/ircomm_tty_ioctl.c	Tue Jun 15 22:20:36 2004
@@ -260,7 +260,7 @@
  *
  */
 static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self,
-				      struct serial_struct *retinfo)
+				      struct serial_struct __user *retinfo)
 {
 	struct serial_struct info;
    
@@ -297,7 +297,7 @@
  *
  */
 static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self,
-				      struct serial_struct *new_info)
+				      struct serial_struct __user *new_info)
 {
 #if 0
 	struct serial_struct new_serial;
@@ -388,10 +388,10 @@
 
 	switch (cmd) {
 	case TIOCGSERIAL:
-		ret = ircomm_tty_get_serial_info(self, (struct serial_struct *) arg);
+		ret = ircomm_tty_get_serial_info(self, (struct serial_struct __user *) arg);
 		break;
 	case TIOCSSERIAL:
-		ret = ircomm_tty_set_serial_info(self, (struct serial_struct *) arg);
+		ret = ircomm_tty_set_serial_info(self, (struct serial_struct __user *) arg);
 		break;
 	case TIOCMIWAIT:
 		IRDA_DEBUG(0, "(), TIOCMIWAIT, not impl!\n");
@@ -403,7 +403,7 @@
 		save_flags(flags); cli();
 		cnow = driver->icount;
 		restore_flags(flags);
-		p_cuser = (struct serial_icounter_struct *) arg;
+		p_cuser = (struct serial_icounter_struct __user *) arg;
 		if (put_user(cnow.cts, &p_cuser->cts) ||
 		    put_user(cnow.dsr, &p_cuser->dsr) ||
 		    put_user(cnow.rng, &p_cuser->rng) ||
diff -Nru a/net/irda/irlap_event.c b/net/irda/irlap_event.c
--- a/net/irda/irlap_event.c	Tue Jun 15 22:20:41 2004
+++ b/net/irda/irlap_event.c	Tue Jun 15 22:20:41 2004
@@ -627,7 +627,7 @@
 		if (irda_device_is_receiving(self->netdev) && !self->add_wait) {
 			IRDA_DEBUG(2, "%s(), device is slow to answer, "
 				   "waiting some more!\n", __FUNCTION__);
-			irlap_start_slot_timer(self, MSECS_TO_JIFFIES(10));
+			irlap_start_slot_timer(self, msecs_to_jiffies(10));
 			self->add_wait = TRUE;
 			return ret;
 		}
@@ -849,7 +849,7 @@
  *  1.5 times the time taken to transmit a SNRM frame. So this time should
  *  between 15 msecs and 45 msecs.
  */
-			irlap_start_backoff_timer(self, MSECS_TO_JIFFIES(20 +
+			irlap_start_backoff_timer(self, msecs_to_jiffies(20 +
 						        (jiffies % 30)));
 		} else {
 			/* Always switch state before calling upper layers */
@@ -1506,7 +1506,7 @@
 		if (irda_device_is_receiving(self->netdev) && !self->add_wait) {
 			IRDA_DEBUG(1, "FINAL_TIMER_EXPIRED when receiving a "
 			      "frame! Waiting a little bit more!\n");
-			irlap_start_final_timer(self, MSECS_TO_JIFFIES(300));
+			irlap_start_final_timer(self, msecs_to_jiffies(300));
 
 			/*
 			 *  Don't allow this to happen one more time in a row,
diff -Nru a/net/irda/irlmp.c b/net/irda/irlmp.c
--- a/net/irda/irlmp.c	Tue Jun 15 22:21:01 2004
+++ b/net/irda/irlmp.c	Tue Jun 15 22:21:01 2004
@@ -804,7 +804,7 @@
  * Note : separate from irlmp_do_discovery() so that we can handle
  * passive discovery properly.
  */
-void irlmp_do_expiry()
+void irlmp_do_expiry(void)
 {
 	struct lap_cb *lap;
 
@@ -1078,7 +1078,7 @@
  *    Used by IrLAP to get the discovery info it needs when answering
  *    discovery requests by other devices.
  */
-discovery_t *irlmp_get_discovery_response()
+discovery_t *irlmp_get_discovery_response(void)
 {
 	IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
 
diff -Nru a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c
--- a/net/irda/irnet/irnet_ppp.c	Tue Jun 15 22:20:43 2004
+++ b/net/irda/irnet/irnet_ppp.c	Tue Jun 15 22:20:43 2004
@@ -35,7 +35,7 @@
  */
 static inline ssize_t
 irnet_ctrl_write(irnet_socket *	ap,
-		 const char *	buf,
+		 const char __user *buf,
 		 size_t		count)
 {
   char		command[IRNET_MAX_COMMAND];
@@ -254,7 +254,7 @@
 static inline ssize_t
 irnet_ctrl_read(irnet_socket *	ap,
 		struct file *	file,
-		char *		buf,
+		char __user *	buf,
 		size_t		count)
 {
   DECLARE_WAITQUEUE(wait, current);
@@ -529,7 +529,7 @@
  */
 static ssize_t
 dev_irnet_write(struct file *	file,
-		const char *	buf,
+		const char __user *buf,
 		size_t		count,
 		loff_t *	ppos)
 {
@@ -553,7 +553,7 @@
  */
 static ssize_t
 dev_irnet_read(struct file *	file,
-	       char *		buf,
+	       char __user *	buf,
 	       size_t		count,
 	       loff_t *		ppos)
 {
@@ -610,6 +610,7 @@
   irnet_socket *	ap = (struct irnet_socket *) file->private_data;
   int			err;
   int			val;
+  void __user *argp = (void __user *)arg;
 
   DENTER(FS_TRACE, "(file=0x%p, ap=0x%p, cmd=0x%X)\n",
 	 file, ap, cmd);
@@ -626,7 +627,7 @@
     {
       /* Set discipline (should be N_SYNC_PPP or N_TTY) */
     case TIOCSETD:
-      if(get_user(val, (int *) arg))
+      if(get_user(val, (int __user *)argp))
 	break;
       if((val == N_SYNC_PPP) || (val == N_PPP))
 	{
@@ -665,7 +666,7 @@
     case PPPIOCGCHAN:
       if(!ap->ppp_open)
 	break;
-      if(put_user(ppp_channel_index(&ap->chan), (int *) arg))
+      if(put_user(ppp_channel_index(&ap->chan), (int __user *)argp))
 	break;
       DEBUG(FS_INFO, "Query channel.\n");
       err = 0;
@@ -673,7 +674,7 @@
     case PPPIOCGUNIT:
       if(!ap->ppp_open)
 	break;
-      if(put_user(ppp_unit_number(&ap->chan), (int *) arg))
+      if(put_user(ppp_unit_number(&ap->chan), (int __user *)argp))
 	break;
       DEBUG(FS_INFO, "Query unit number.\n");
       err = 0;
@@ -703,14 +704,14 @@
       /* Get termios */
     case TCGETS:
       DEBUG(FS_INFO, "Get termios.\n");
-      if(kernel_termios_to_user_termios((struct termios *)arg, &ap->termios))
+      if(kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios))
 	break;
       err = 0;
       break;
       /* Set termios */
     case TCSETSF:
       DEBUG(FS_INFO, "Set termios.\n");
-      if(user_termios_to_kernel_termios(&ap->termios, (struct termios *) arg))
+      if(user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp))
 	break;
       err = 0;
       break;
@@ -743,7 +744,7 @@
     case FIONREAD:
       DEBUG(FS_INFO, "FIONREAD\n");
       val = 0;
-      if(put_user(val, (int *) arg))
+      if(put_user(val, (int __user *)argp))
 	break;
       err = 0;
       break;
@@ -950,6 +951,7 @@
   int			err;
   int			val;
   u32			accm[8];
+  void __user *argp = (void __user *)arg;
 
   DENTER(PPP_TRACE, "(channel=0x%p, ap=0x%p, cmd=0x%X)\n",
 	 chan, ap, cmd);
@@ -963,12 +965,12 @@
       /* PPP flags */
     case PPPIOCGFLAGS:
       val = ap->flags | ap->rbits;
-      if(put_user(val, (int *) arg))
+      if(put_user(val, (int __user *) argp))
 	break;
       err = 0;
       break;
     case PPPIOCSFLAGS:
-      if(get_user(val, (int *) arg))
+      if(get_user(val, (int __user *) argp))
 	break;
       ap->flags = val & ~SC_RCV_BITS;
       ap->rbits = val & SC_RCV_BITS;
@@ -977,32 +979,32 @@
 
       /* Async map stuff - all dummy to please pppd */
     case PPPIOCGASYNCMAP:
-      if(put_user(ap->xaccm[0], (u32 *) arg))
+      if(put_user(ap->xaccm[0], (u32 __user *) argp))
 	break;
       err = 0;
       break;
     case PPPIOCSASYNCMAP:
-      if(get_user(ap->xaccm[0], (u32 *) arg))
+      if(get_user(ap->xaccm[0], (u32 __user *) argp))
 	break;
       err = 0;
       break;
     case PPPIOCGRASYNCMAP:
-      if(put_user(ap->raccm, (u32 *) arg))
+      if(put_user(ap->raccm, (u32 __user *) argp))
 	break;
       err = 0;
       break;
     case PPPIOCSRASYNCMAP:
-      if(get_user(ap->raccm, (u32 *) arg))
+      if(get_user(ap->raccm, (u32 __user *) argp))
 	break;
       err = 0;
       break;
     case PPPIOCGXASYNCMAP:
-      if(copy_to_user((void *) arg, ap->xaccm, sizeof(ap->xaccm)))
+      if(copy_to_user(argp, ap->xaccm, sizeof(ap->xaccm)))
 	break;
       err = 0;
       break;
     case PPPIOCSXASYNCMAP:
-      if(copy_from_user(accm, (void *) arg, sizeof(accm)))
+      if(copy_from_user(accm, argp, sizeof(accm)))
 	break;
       accm[2] &= ~0x40000000U;		/* can't escape 0x5e */
       accm[3] |= 0x60000000U;		/* must escape 0x7d, 0x7e */
@@ -1012,12 +1014,12 @@
 
       /* Max PPP frame size */
     case PPPIOCGMRU:
-      if(put_user(ap->mru, (int *) arg))
+      if(put_user(ap->mru, (int __user *) argp))
 	break;
       err = 0;
       break;
     case PPPIOCSMRU:
-      if(get_user(val, (int *) arg))
+      if(get_user(val, (int __user *) argp))
 	break;
       if(val < PPP_MRU)
 	val = PPP_MRU;
@@ -1097,7 +1099,7 @@
 irnet_cleanup(void)
 {
   irda_irnet_cleanup();
-  return ppp_irnet_cleanup();
+  ppp_irnet_cleanup();
 }
 
 /*------------------------------------------------------------------*/
diff -Nru a/net/irda/irnet/irnet_ppp.h b/net/irda/irnet/irnet_ppp.h
--- a/net/irda/irnet/irnet_ppp.h	Tue Jun 15 22:20:43 2004
+++ b/net/irda/irnet/irnet_ppp.h	Tue Jun 15 22:20:43 2004
@@ -66,11 +66,11 @@
 			struct file *);
 static ssize_t
 	dev_irnet_write(struct file *,
-			const char *,
+			const char __user *,
 			size_t,
 			loff_t *),
 	dev_irnet_read(struct file *,
-		       char *,
+		       char __user *,
 		       size_t,
 		       loff_t *);
 static unsigned int
diff -Nru a/net/irda/irsysctl.c b/net/irda/irsysctl.c
--- a/net/irda/irsysctl.c	Tue Jun 15 22:20:39 2004
+++ b/net/irda/irsysctl.c	Tue Jun 15 22:20:39 2004
@@ -78,7 +78,7 @@
  * us on that - Jean II */
 
 static int do_devname(ctl_table *table, int write, struct file *filp,
-		      void *buffer, size_t *lenp)
+		      void __user *buffer, size_t *lenp)
 {
 	int ret;
 
diff -Nru a/net/key/af_key.c b/net/key/af_key.c
--- a/net/key/af_key.c	Tue Jun 15 22:20:38 2004
+++ b/net/key/af_key.c	Tue Jun 15 22:20:38 2004
@@ -1059,7 +1059,7 @@
 		struct sadb_address *addr = ext_hdrs[SADB_EXT_ADDRESS_PROXY-1];
 
 		/* Nobody uses this, but we try. */
-		pfkey_sadb_addr2xfrm_addr(addr, &x->sel.saddr);
+		x->sel.family = pfkey_sadb_addr2xfrm_addr(addr, &x->sel.saddr);
 		x->sel.prefixlen_s = addr->sadb_address_prefixlen;
 	}
 
@@ -1976,7 +1976,7 @@
 	memset(&sel, 0, sizeof(sel));
 
 	sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], 
-	pfkey_sadb_addr2xfrm_addr(sa, &sel.saddr);
+	sel.family = pfkey_sadb_addr2xfrm_addr(sa, &sel.saddr);
 	sel.prefixlen_s = sa->sadb_address_prefixlen;
 	sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
 	sel.sport = ((struct sockaddr_in *)(sa+1))->sin_port;
@@ -2726,7 +2726,7 @@
 	int copied, err;
 
 	err = -EINVAL;
-	if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC))
+	if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT))
 		goto out;
 
 	msg->msg_namelen = 0;
diff -Nru a/net/llc/af_llc.c b/net/llc/af_llc.c
--- a/net/llc/af_llc.c	Tue Jun 15 22:20:36 2004
+++ b/net/llc/af_llc.c	Tue Jun 15 22:20:36 2004
@@ -867,7 +867,7 @@
 static int llc_ui_ioctl(struct socket *sock, unsigned int cmd,
 			unsigned long arg)
 {
-	return dev_ioctl(cmd, (void *)arg);
+	return dev_ioctl(cmd, (void __user *)arg);
 }
 
 /**
@@ -881,7 +881,7 @@
  *	Set various connection specific parameters.
  */
 static int llc_ui_setsockopt(struct socket *sock, int level, int optname,
-			     char *optval, int optlen)
+			     char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	struct llc_opt *llc = llc_sk(sk);
@@ -890,7 +890,7 @@
 	lock_sock(sk);
 	if (level != SOL_LLC || optlen != sizeof(int))
 		goto out;
-	rc = get_user(opt, (int *)optval);
+	rc = get_user(opt, (int __user *)optval);
 	if (rc)
 		goto out;
 	rc = -EINVAL;
@@ -956,7 +956,7 @@
  *	Get connection specific socket information.
  */
 static int llc_ui_getsockopt(struct socket *sock, int level, int optname,
-			     char *optval, int *optlen)
+			     char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	struct llc_opt *llc = llc_sk(sk);
diff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
--- a/net/netlink/af_netlink.c	Tue Jun 15 22:20:40 2004
+++ b/net/netlink/af_netlink.c	Tue Jun 15 22:20:40 2004
@@ -543,7 +543,7 @@
 	sk = netlink_getsockbypid(ssk, pid);
 	if (IS_ERR(sk)) {
 		kfree_skb(skb);
-		return PTR_ERR(skb);
+		return PTR_ERR(sk);
 	}
 	err = netlink_attachskb(sk, skb, nonblock, timeo);
 	if (err == 1)
diff -Nru a/net/netlink/netlink_dev.c b/net/netlink/netlink_dev.c
--- a/net/netlink/netlink_dev.c	Tue Jun 15 22:20:39 2004
+++ b/net/netlink/netlink_dev.c	Tue Jun 15 22:20:39 2004
@@ -54,7 +54,7 @@
  *	Write a message to the kernel side of a communication link
  */
  
-static ssize_t netlink_write(struct file * file, const char * buf,
+static ssize_t netlink_write(struct file * file, const char __user * buf,
 			     size_t count, loff_t *pos)
 {
 	struct inode *inode = file->f_dentry->d_inode;
@@ -62,7 +62,7 @@
 	struct msghdr msg;
 	struct iovec iov;
 
-	iov.iov_base = (void*)buf;
+	iov.iov_base = (void __user*)buf;
 	iov.iov_len = count;
 	msg.msg_name=NULL;
 	msg.msg_namelen=0;
@@ -78,7 +78,7 @@
  *	Read a message from the kernel side of the communication link
  */
 
-static ssize_t netlink_read(struct file * file, char * buf,
+static ssize_t netlink_read(struct file * file, char __user * buf,
 			    size_t count, loff_t *pos)
 {
 	struct inode *inode = file->f_dentry->d_inode;
diff -Nru a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
--- a/net/netrom/af_netrom.c	Tue Jun 15 22:20:40 2004
+++ b/net/netrom/af_netrom.c	Tue Jun 15 22:20:40 2004
@@ -297,7 +297,7 @@
  */
 
 static int nr_setsockopt(struct socket *sock, int level, int optname,
-	char *optval, int optlen)
+	char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	nr_cb *nr = nr_sk(sk);
@@ -309,7 +309,7 @@
 	if (optlen < sizeof(int))
 		return -EINVAL;
 
-	if (get_user(opt, (int *)optval))
+	if (get_user(opt, (int __user *)optval))
 		return -EFAULT;
 
 	switch (optname) {
@@ -349,7 +349,7 @@
 }
 
 static int nr_getsockopt(struct socket *sock, int level, int optname,
-	char *optval, int *optlen)
+	char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	nr_cb *nr = nr_sk(sk);
@@ -1021,7 +1021,7 @@
 	unsigned char *asmptr;
 	int size;
 
-	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR))
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
 		return -EINVAL;
 
 	lock_sock(sk);
@@ -1176,6 +1176,7 @@
 static int nr_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
 	struct sock *sk = sock->sk;
+	void __user *argp = (void __user *)arg;
 	int ret;
 
 	lock_sock(sk);
@@ -1186,7 +1187,7 @@
 		if (amount < 0)
 			amount = 0;
 		release_sock(sk);
-		return put_user(amount, (int *)arg);
+		return put_user(amount, (int __user *)argp);
 	}
 
 	case TIOCINQ: {
@@ -1196,13 +1197,13 @@
 		if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
 			amount = skb->len;
 		release_sock(sk);
-		return put_user(amount, (int *)arg);
+		return put_user(amount, (int __user *)argp);
 	}
 
 	case SIOCGSTAMP:
 		ret = -EINVAL;
 		if (sk != NULL)
-			ret = sock_get_timestamp(sk, (struct timeval *)arg);
+			ret = sock_get_timestamp(sk, argp);
 		release_sock(sk);
 		return ret;
 
@@ -1224,11 +1225,11 @@
 	case SIOCNRDECOBS:
 		release_sock(sk);
 		if (!capable(CAP_NET_ADMIN)) return -EPERM;
-		return nr_rt_ioctl(cmd, (void *)arg);
+		return nr_rt_ioctl(cmd, argp);
 
 	default:
 		release_sock(sk);
-		return dev_ioctl(cmd, (void *)arg);
+		return dev_ioctl(cmd, argp);
 	}
 	release_sock(sk);
 
diff -Nru a/net/netrom/nr_route.c b/net/netrom/nr_route.c
--- a/net/netrom/nr_route.c	Tue Jun 15 22:21:04 2004
+++ b/net/netrom/nr_route.c	Tue Jun 15 22:21:04 2004
@@ -647,7 +647,7 @@
 /*
  *	Handle the ioctls that control the routing functions.
  */
-int nr_rt_ioctl(unsigned int cmd, void *arg)
+int nr_rt_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct nr_route_struct nr_route;
 	struct net_device *dev;
diff -Nru a/net/packet/af_packet.c b/net/packet/af_packet.c
--- a/net/packet/af_packet.c	Tue Jun 15 22:20:42 2004
+++ b/net/packet/af_packet.c	Tue Jun 15 22:20:42 2004
@@ -1037,7 +1037,7 @@
 	int copied, err;
 
 	err = -EINVAL;
-	if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC))
+	if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT))
 		goto out;
 
 #if 0
@@ -1292,7 +1292,7 @@
 #endif
 
 static int
-packet_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen)
+packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	int ret;
@@ -1347,7 +1347,7 @@
 }
 
 int packet_getsockopt(struct socket *sock, int level, int optname,
-		      char *optval, int *optlen)
+		      char __user *optval, int __user *optlen)
 {
 	int len;
 	struct sock *sk = sock->sk;
@@ -1450,7 +1450,7 @@
 		case SIOCOUTQ:
 		{
 			int amount = atomic_read(&sk->sk_wmem_alloc);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 		case SIOCINQ:
 		{
@@ -1462,10 +1462,10 @@
 			if (skb)
 				amount = skb->len;
 			spin_unlock_bh(&sk->sk_receive_queue.lock);
-			return put_user(amount, (int *)arg);
+			return put_user(amount, (int __user *)arg);
 		}
 		case SIOCGSTAMP:
-			return sock_get_timestamp(sk, (struct timeval *)arg);
+			return sock_get_timestamp(sk, (struct timeval __user *)arg);
 			
 #ifdef CONFIG_INET
 		case SIOCADDRT:
@@ -1486,7 +1486,7 @@
 #endif
 
 		default:
-			return dev_ioctl(cmd, (void *)arg);
+			return dev_ioctl(cmd, (void __user *)arg);
 	}
 	return 0;
 }
diff -Nru a/net/rose/af_rose.c b/net/rose/af_rose.c
--- a/net/rose/af_rose.c	Tue Jun 15 22:20:40 2004
+++ b/net/rose/af_rose.c	Tue Jun 15 22:20:40 2004
@@ -368,7 +368,7 @@
  */
 
 static int rose_setsockopt(struct socket *sock, int level, int optname,
-	char *optval, int optlen)
+	char __user *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
 	rose_cb *rose = rose_sk(sk);
@@ -380,7 +380,7 @@
 	if (optlen < sizeof(int))
 		return -EINVAL;
 
-	if (get_user(opt, (int *)optval))
+	if (get_user(opt, (int __user *)optval))
 		return -EFAULT;
 
 	switch (optname) {
@@ -428,7 +428,7 @@
 }
 
 static int rose_getsockopt(struct socket *sock, int level, int optname,
-	char *optval, int *optlen)
+	char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	rose_cb *rose = rose_sk(sk);
@@ -1021,7 +1021,7 @@
 	unsigned char *asmptr;
 	int n, size, qbit = 0;
 
-	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR))
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
 		return -EINVAL;
 
 	if (sk->sk_zapped)
@@ -1249,6 +1249,7 @@
 {
 	struct sock *sk = sock->sk;
 	rose_cb *rose = rose_sk(sk);
+	void __user *argp = (void __user *)arg;
 
 	switch (cmd) {
 	case TIOCOUTQ: {
@@ -1256,7 +1257,7 @@
 		amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
 		if (amount < 0)
 			amount = 0;
-		return put_user(amount, (unsigned int *)arg);
+		return put_user(amount, (unsigned int __user *)argp);
 	}
 
 	case TIOCINQ: {
@@ -1265,12 +1266,12 @@
 		/* These two are safe on a single CPU system as only user tasks fiddle here */
 		if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
 			amount = skb->len;
-		return put_user(amount, (unsigned int *)arg);
+		return put_user(amount, (unsigned int __user *)argp);
 	}
 
 	case SIOCGSTAMP:
 		if (sk != NULL) 
-			return sock_get_timestamp(sk, (struct timeval *)arg);
+			return sock_get_timestamp(sk, (struct timeval __user *)argp);
 		return -EINVAL;
 
 	case SIOCGIFADDR:
@@ -1290,18 +1291,18 @@
 	case SIOCRSCLRRT:
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
-		return rose_rt_ioctl(cmd, (void *)arg);
+		return rose_rt_ioctl(cmd, argp);
 
 	case SIOCRSGCAUSE: {
 		struct rose_cause_struct rose_cause;
 		rose_cause.cause      = rose->cause;
 		rose_cause.diagnostic = rose->diagnostic;
-		return copy_to_user((void *)arg, &rose_cause, sizeof(struct rose_cause_struct)) ? -EFAULT : 0;
+		return copy_to_user(argp, &rose_cause, sizeof(struct rose_cause_struct)) ? -EFAULT : 0;
 	}
 
 	case SIOCRSSCAUSE: {
 		struct rose_cause_struct rose_cause;
-		if (copy_from_user(&rose_cause, (void *)arg, sizeof(struct rose_cause_struct)))
+		if (copy_from_user(&rose_cause, argp, sizeof(struct rose_cause_struct)))
 			return -EFAULT;
 		rose->cause      = rose_cause.cause;
 		rose->diagnostic = rose_cause.diagnostic;
@@ -1312,14 +1313,14 @@
 		if (!capable(CAP_NET_ADMIN)) return -EPERM;
 		if (ax25cmp(&rose_callsign, &null_ax25_address) != 0)
 			ax25_listen_release(&rose_callsign, NULL);
-		if (copy_from_user(&rose_callsign, (void *)arg, sizeof(ax25_address)))
+		if (copy_from_user(&rose_callsign, argp, sizeof(ax25_address)))
 			return -EFAULT;
 		if (ax25cmp(&rose_callsign, &null_ax25_address) != 0)
 			ax25_listen_register(&rose_callsign, NULL);
 		return 0;
 
 	case SIOCRSGL2CALL:
-		return copy_to_user((void *)arg, &rose_callsign, sizeof(ax25_address)) ? -EFAULT : 0;
+		return copy_to_user(argp, &rose_callsign, sizeof(ax25_address)) ? -EFAULT : 0;
 
 	case SIOCRSACCEPT:
 		if (rose->state == ROSE_STATE_5) {
@@ -1335,7 +1336,7 @@
 		return 0;
 
 	default:
-		return dev_ioctl(cmd, (void *)arg);
+		return dev_ioctl(cmd, argp);
 	}
 
 	return 0;
diff -Nru a/net/rose/rose_route.c b/net/rose/rose_route.c
--- a/net/rose/rose_route.c	Tue Jun 15 22:21:04 2004
+++ b/net/rose/rose_route.c	Tue Jun 15 22:21:04 2004
@@ -710,7 +710,7 @@
 /*
  *	Handle the ioctls that control the routing functions.
  */
-int rose_rt_ioctl(unsigned int cmd, void *arg)
+int rose_rt_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct rose_route_struct rose_route;
 	struct net_device *dev;
diff -Nru a/net/sched/sch_delay.c b/net/sched/sch_delay.c
--- a/net/sched/sch_delay.c	Tue Jun 15 22:20:37 2004
+++ b/net/sched/sch_delay.c	Tue Jun 15 22:20:37 2004
@@ -165,6 +165,7 @@
 		return -ENOMEM;
 
 	rta->rta_type = RTM_NEWQDISC;
+	rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
 	((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
 	ret = q->ops->change(q, rta);
 	kfree(rta);
diff -Nru a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
--- a/net/sched/sch_tbf.c	Tue Jun 15 22:20:36 2004
+++ b/net/sched/sch_tbf.c	Tue Jun 15 22:20:36 2004
@@ -495,6 +495,11 @@
 	}
 }
 
+static struct tcf_proto **tbf_find_tcf(struct Qdisc *sch, unsigned long cl)
+{
+	return NULL;
+}
+
 static struct Qdisc_class_ops tbf_class_ops =
 {
 	.graft		=	tbf_graft,
@@ -504,6 +509,7 @@
 	.change		=	tbf_change_class,
 	.delete		=	tbf_delete,
 	.walk		=	tbf_walk,
+	.tcf_chain	=	tbf_find_tcf,
 	.dump		=	tbf_dump_class,
 };
 
diff -Nru a/net/sctp/associola.c b/net/sctp/associola.c
--- a/net/sctp/associola.c	Tue Jun 15 22:20:36 2004
+++ b/net/sctp/associola.c	Tue Jun 15 22:20:36 2004
@@ -142,9 +142,9 @@
 	 * socket values.
 	 */
 	asoc->max_retrans = sp->assocparams.sasoc_asocmaxrxt;
-	asoc->rto_initial = MSECS_TO_JIFFIES(sp->rtoinfo.srto_initial);
-	asoc->rto_max = MSECS_TO_JIFFIES(sp->rtoinfo.srto_max);
-	asoc->rto_min = MSECS_TO_JIFFIES(sp->rtoinfo.srto_min);
+	asoc->rto_initial = msecs_to_jiffies(sp->rtoinfo.srto_initial);
+	asoc->rto_max = msecs_to_jiffies(sp->rtoinfo.srto_max);
+	asoc->rto_min = msecs_to_jiffies(sp->rtoinfo.srto_min);
 
 	asoc->overall_error_count = 0;
 
@@ -170,7 +170,7 @@
 	asoc->max_init_attempts	= sp->initmsg.sinit_max_attempts;
 
 	asoc->max_init_timeo =
-		 MSECS_TO_JIFFIES(sp->initmsg.sinit_max_init_timeo);
+		 msecs_to_jiffies(sp->initmsg.sinit_max_init_timeo);
 
 	/* Allocate storage for the ssnmap after the inbound and outbound
 	 * streams have been negotiated during Init.
@@ -271,7 +271,7 @@
 
 	asoc->need_ecne = 0;
 
-	asoc->assoc_id = (sctp_assoc_t)-1;
+	asoc->assoc_id = (sctp_assoc_t)-1L;
 
 	/* Assume that peer would support both address types unless we are
 	 * told otherwise.
@@ -374,9 +374,9 @@
 	sctp_endpoint_put(asoc->ep);
 	sock_put(asoc->base.sk);
 
-	if ((int)asoc->assoc_id != -1) {
+	if ((long)asoc->assoc_id != -1L) {
 		spin_lock_bh(&sctp_assocs_id_lock);
-		idr_remove(&sctp_assocs_id, (int)asoc->assoc_id);
+		idr_remove(&sctp_assocs_id, (long)asoc->assoc_id);
 		spin_unlock_bh(&sctp_assocs_id_lock);
 	}
 
@@ -507,7 +507,7 @@
 	/* Initialize the peer's heartbeat interval based on the
 	 * sock configured value.
 	 */
-	peer->hb_interval = MSECS_TO_JIFFIES(sp->paddrparam.spp_hbinterval);
+	peer->hb_interval = msecs_to_jiffies(sp->paddrparam.spp_hbinterval);
 
 	/* Set the path max_retrans.  */
 	peer->max_retrans = asoc->max_retrans;
diff -Nru a/net/sctp/chunk.c b/net/sctp/chunk.c
--- a/net/sctp/chunk.c	Tue Jun 15 22:20:43 2004
+++ b/net/sctp/chunk.c	Tue Jun 15 22:20:43 2004
@@ -186,7 +186,7 @@
 	if (sinfo->sinfo_timetolive) {
 		/* sinfo_timetolive is in milliseconds */
 		msg->expires_at = jiffies +
-				    MSECS_TO_JIFFIES(sinfo->sinfo_timetolive);
+				    msecs_to_jiffies(sinfo->sinfo_timetolive);
 		msg->can_abandon = 1;
 		SCTP_DEBUG_PRINTK("%s: msg:%p expires_at: %ld jiffies:%ld\n",
 				  __FUNCTION__, msg, msg->expires_at, jiffies);
diff -Nru a/net/sctp/endpointola.c b/net/sctp/endpointola.c
--- a/net/sctp/endpointola.c	Tue Jun 15 22:20:37 2004
+++ b/net/sctp/endpointola.c	Tue Jun 15 22:20:37 2004
@@ -129,7 +129,7 @@
 	ep->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] =
 		SCTP_DEFAULT_TIMEOUT_T1_INIT;
 	ep->timeouts[SCTP_EVENT_TIMEOUT_T2_SHUTDOWN] =
-		MSECS_TO_JIFFIES(sp->rtoinfo.srto_initial);
+		msecs_to_jiffies(sp->rtoinfo.srto_initial);
 	ep->timeouts[SCTP_EVENT_TIMEOUT_T3_RTX] = 0;
 	ep->timeouts[SCTP_EVENT_TIMEOUT_T4_RTO] = 0;
 
@@ -138,7 +138,7 @@
 	 * recommended value of 5 times 'RTO.Max'.
 	 */
         ep->timeouts[SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD]
-		= 5 * MSECS_TO_JIFFIES(sp->rtoinfo.srto_max);
+		= 5 * msecs_to_jiffies(sp->rtoinfo.srto_max);
 
 	ep->timeouts[SCTP_EVENT_TIMEOUT_HEARTBEAT] =
 		SCTP_DEFAULT_TIMEOUT_HEARTBEAT;
diff -Nru a/net/sctp/output.c b/net/sctp/output.c
--- a/net/sctp/output.c	Tue Jun 15 22:20:37 2004
+++ b/net/sctp/output.c	Tue Jun 15 22:20:37 2004
@@ -496,7 +496,7 @@
 	return err;
 no_route:
 	kfree_skb(nskb);
-	IP_INC_STATS_BH(IpOutNoRoutes);
+	IP_INC_STATS_BH(OutNoRoutes);
 
 	/* FIXME: Returning the 'err' will effect all the associations
 	 * associated with a socket, although only one of the paths of the
diff -Nru a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
--- a/net/sctp/sm_sideeffect.c	Tue Jun 15 22:20:42 2004
+++ b/net/sctp/sm_sideeffect.c	Tue Jun 15 22:20:42 2004
@@ -429,6 +429,9 @@
 		sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP,
 				SCTP_ULPEVENT(event));
 
+	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
+			SCTP_STATE(SCTP_STATE_CLOSED));
+
 	/* SEND_FAILED sent later when cleaning up the association. */
 	asoc->outqueue.error = error;
 	sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
@@ -457,6 +460,10 @@
 	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
 			SCTP_STATE(SCTP_STATE_CLOSED));
 
+	/* Set sk_err to ECONNRESET on a 1-1 style socket. */
+	if (!sctp_style(asoc->base.sk, UDP))
+		asoc->base.sk->sk_err = ECONNRESET; 
+
 	/* SEND_FAILED sent later when cleaning up the association. */
 	asoc->outqueue.error = error;
 	sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
@@ -1271,6 +1278,9 @@
 
 		case SCTP_CMD_PROCESS_OPERR:
 			sctp_cmd_process_operr(commands, asoc, chunk);
+			break;
+		case SCTP_CMD_CLEAR_INIT_TAG:
+			asoc->peer.i.init_tag = 0;
 			break;
 		default:
 			printk(KERN_WARNING "Impossible command: %u, %p\n",
diff -Nru a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
--- a/net/sctp/sm_statefuns.c	Tue Jun 15 22:20:36 2004
+++ b/net/sctp/sm_statefuns.c	Tue Jun 15 22:20:36 2004
@@ -171,7 +171,7 @@
  *    Verification Tag field to Tag_A, and also provide its own
  *    Verification Tag (Tag_Z) in the Initiate Tag field.
  *
- * Verification Tag: No checking.
+ * Verification Tag: Must be 0. 
  *
  * Inputs
  * (endpoint, asoc, chunk)
@@ -219,6 +219,12 @@
 	     (sk->sk_ack_backlog >= sk->sk_max_ack_backlog)))
 		return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands);
 
+	/* 3.1 A packet containing an INIT chunk MUST have a zero Verification
+	 * Tag. 
+	 */
+	if (chunk->sctp_hdr->vtag != 0)
+		return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands);
+
 	/* Verify the INIT chunk before processing it. */
 	err_chunk = NULL;
 	if (!sctp_verify_init(asoc, chunk->chunk_hdr->type,
@@ -377,6 +383,9 @@
 	if (!chunk->singleton)
 		return SCTP_DISPOSITION_VIOLATION;
 
+	if (!sctp_vtag_verify(chunk, asoc))
+		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
+
 	/* Grab the INIT header.  */
 	chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data;
 
@@ -659,8 +668,12 @@
 				      const sctp_subtype_t type, void *arg,
 				      sctp_cmd_seq_t *commands)
 {
+	struct sctp_chunk *chunk = arg;
 	struct sctp_ulpevent *ev;
 
+	if (!sctp_vtag_verify(chunk, asoc))
+		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
+
 	/* RFC 2960 5.1 Normal Establishment of an Association
 	 *
 	 * E) Upon reception of the COOKIE ACK, endpoint "A" will move
@@ -807,13 +820,7 @@
 	struct sctp_chunk *reply;
 	size_t paylen = 0;
 
-	/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag. If the received
-	 * Verification Tag value does not match the receiver's own
-	 * tag value, the receiver shall silently discard the packet...
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag)
+	if (!sctp_vtag_verify(chunk, asoc))
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
 	/* 8.3 The receiver of the HEARTBEAT should immediately
@@ -876,11 +883,7 @@
 	sctp_sender_hb_info_t *hbinfo;
 	unsigned long max_interval;
 
-	/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag. ...
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag)
+	if (!sctp_vtag_verify(chunk, asoc))
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
 	hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;
@@ -1130,6 +1133,12 @@
 	if (!chunk->singleton)
 		return SCTP_DISPOSITION_VIOLATION;
 
+	/* 3.1 A packet containing an INIT chunk MUST have a zero Verification
+	 * Tag. 
+	 */
+	if (chunk->sctp_hdr->vtag != 0)
+		return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands);
+
 	/* Grab the INIT header.  */
 	chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data;
 
@@ -1386,6 +1395,8 @@
 	sctp_init_chunk_t *peer_init;
 	struct sctp_ulpevent *ev;
 	struct sctp_chunk *repl;
+	struct sctp_chunk *err;
+	sctp_disposition_t disposition;
 
 	/* new_asoc is a brand-new association, so these are not yet
 	 * side effects--it is safe to run them here.
@@ -1405,6 +1416,29 @@
 		return SCTP_DISPOSITION_CONSUME;
 	}
 
+	/* If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes
+	 * the peer has restarted (Action A), it MUST NOT setup a new
+	 * association but instead resend the SHUTDOWN ACK and send an ERROR
+	 * chunk with a "Cookie Received while Shutting Down" error cause to
+	 * its peer.
+	*/
+	if (sctp_state(asoc, SHUTDOWN_ACK_SENT)) {
+		disposition = sctp_sf_do_9_2_reshutack(ep, asoc,
+				SCTP_ST_CHUNK(chunk->chunk_hdr->type),
+				chunk, commands);
+		if (SCTP_DISPOSITION_NOMEM == disposition)
+			goto nomem;
+
+		err = sctp_make_op_error(asoc, chunk,
+					 SCTP_ERROR_COOKIE_IN_SHUTDOWN,
+					 NULL, 0);
+		if (err)
+			sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
+					SCTP_CHUNK(err));
+
+		return SCTP_DISPOSITION_CONSUME;
+	}
+
 	/* For now, fail any unsent/unacked data.  Consider the optional
 	 * choice of resending of this data.
 	 */
@@ -1883,6 +1917,9 @@
 
 	sctp_addto_chunk(reply, sizeof(bht), &bht);
 
+	/* Clear peer's init_tag cached in assoc as we are sending a new INIT */
+	sctp_add_cmd_sf(commands, SCTP_CMD_CLEAR_INIT_TAG, SCTP_NULL());
+
 	/* Cast away the const modifier, as we want to just
 	 * rerun it through as a sideffect.
 	 */
@@ -2071,13 +2108,7 @@
 	skb_pull(chunk->skb, sizeof(sctp_shutdownhdr_t));
 	chunk->subh.shutdown_hdr = sdh;
 
-	/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag. If the received
-	 * Verification Tag value does not match the receiver's own
-	 * tag value, the receiver shall silently discard the packet...
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag)
+	if (!sctp_vtag_verify(chunk, asoc))
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
 	/* Upon the reception of the SHUTDOWN, the peer endpoint shall
@@ -2190,13 +2221,7 @@
 	sctp_cwrhdr_t *cwr;
 	struct sctp_chunk *chunk = arg;
 
-	/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag. If the received
-	 * Verification Tag value does not match the receiver's own
-	 * tag value, the receiver shall silently discard the packet...
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag)
+	if (!sctp_vtag_verify(chunk, asoc))
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
 	cwr = (sctp_cwrhdr_t *) chunk->skb->data;
@@ -2246,13 +2271,7 @@
 	sctp_ecnehdr_t *ecne;
 	struct sctp_chunk *chunk = arg;
 
-	/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag. If the received
-	 * Verification Tag value does not match the receiver's own
-	 * tag value, the receiver shall silently discard the packet...
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag)
+	if (!sctp_vtag_verify(chunk, asoc))
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
 	ecne = (sctp_ecnehdr_t *) chunk->skb->data;
@@ -2309,13 +2328,7 @@
 	int tmp;
 	__u32 tsn;
 
-	/* RFC 2960 8.5 Verification Tag
-	 *
-	 * When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag.
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) {
+	if (!sctp_vtag_verify(chunk, asoc)) {
 		sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG,
 				SCTP_NULL());
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -2569,13 +2582,7 @@
 	int tmp;
 	__u32 tsn;
 
-	/* RFC 2960 8.5 Verification Tag
-	 *
-	 * When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag.
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) {
+	if (!sctp_vtag_verify(chunk, asoc)) {
 		sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG,
 				SCTP_NULL());
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -2745,11 +2752,7 @@
 	sctp_sackhdr_t *sackh;
 	__u32 ctsn;
 
-	/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag. ...
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag)
+	if (!sctp_vtag_verify(chunk, asoc))
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
 	/* Pull the SACK chunk from the data buffer */
@@ -2895,6 +2898,9 @@
 	struct sctp_chunk *reply;
 	struct sctp_ulpevent *ev;
 
+	if (!sctp_vtag_verify(chunk, asoc))
+		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
+
 	/* 10.2 H) SHUTDOWN COMPLETE notification
 	 *
 	 * When SCTP completes the shutdown procedures (section 9.2) this
@@ -3229,13 +3235,7 @@
 	__u16 len;
 	__u32 tsn;
 
-	/* RFC 2960 8.5 Verification Tag
-	 *
-	 * When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag.
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) {
+	if (!sctp_vtag_verify(chunk, asoc)) {
 		sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG,
 				SCTP_NULL());
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -3293,13 +3293,7 @@
 	__u16 len;
 	__u32 tsn;
 
-	/* RFC 2960 8.5 Verification Tag
-	 *
-	 * When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag.
-	 */
-	if (ntohl(chunk->sctp_hdr->vtag) != asoc->c.my_vtag) {
+	if (!sctp_vtag_verify(chunk, asoc)) {
 		sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG,
 				SCTP_NULL());
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -3376,13 +3370,7 @@
 
 	SCTP_DEBUG_PRINTK("Processing the unknown chunk id %d.\n", type.chunk);
 
-	/* 8.5 When receiving an SCTP packet, the endpoint MUST ensure
-	 * that the value in the Verification Tag field of the
-	 * received SCTP packet matches its own Tag.  If the received
-	 * Verification Tag value does not match the receiver's own
-	 * tag value, the receiver shall silently discard the packet.
-	 */
-	if (ntohl(unk_chunk->sctp_hdr->vtag) != asoc->c.my_vtag)
+	if (!sctp_vtag_verify(unk_chunk, asoc))
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
 	switch (type.chunk & SCTP_CID_ACTION_MASK) {
diff -Nru a/net/sctp/socket.c b/net/sctp/socket.c
--- a/net/sctp/socket.c	Tue Jun 15 22:21:05 2004
+++ b/net/sctp/socket.c	Tue Jun 15 22:21:05 2004
@@ -765,7 +765,8 @@
  *
  * Returns 0 if ok, <0 errno code on error.
  */
-SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, struct sockaddr *addrs,
+SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk,
+				      struct sockaddr __user *addrs,
 				      int addrs_size, int op)
 {
 	struct sockaddr *kaddrs;
@@ -1163,6 +1164,11 @@
 	if (!asoc) {
 		SCTP_DEBUG_PRINTK("There is no association yet.\n");
 
+		if (sinfo_flags & (MSG_EOF | MSG_ABORT)) {
+			err = -EINVAL;
+			goto out_unlock;
+		}
+
 		/* Check for invalid stream against the stream counts,
 		 * either the default or the user specified stream counts.
 		 */
@@ -1224,7 +1230,7 @@
 			}
 			if (sinit->sinit_max_init_timeo) {
 				asoc->max_init_timeo = 
-				 MSECS_TO_JIFFIES(sinit->sinit_max_init_timeo);
+				 msecs_to_jiffies(sinit->sinit_max_init_timeo);
 			}
 		}
 
@@ -1538,14 +1544,14 @@
  * instead a error will be indicated to the user.
  */
 static int sctp_setsockopt_disable_fragments(struct sock *sk,
-						    char *optval, int optlen)
+					    char __user *optval, int optlen)
 {
 	int val;
 
 	if (optlen < sizeof(int))
 		return -EINVAL;
 
-	if (get_user(val, (int *)optval))
+	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 
 	sctp_sk(sk)->disable_fragments = (val == 0) ? 0 : 1;
@@ -1553,7 +1559,7 @@
 	return 0;
 }
 
-static int sctp_setsockopt_events(struct sock *sk, char *optval,
+static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
 					int optlen)
 {
 	if (optlen != sizeof(struct sctp_event_subscribe))
@@ -1574,7 +1580,7 @@
  * integer defining the number of seconds of idle time before an
  * association is closed.
  */
-static int sctp_setsockopt_autoclose(struct sock *sk, char *optval,
+static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
 					    int optlen)
 {
 	struct sctp_opt *sp = sctp_sk(sk);
@@ -1623,7 +1629,7 @@
  *                     considered unreachable.
  */
 static int sctp_setsockopt_peer_addr_params(struct sock *sk,
-					    char *optval, int optlen)
+					    char __user *optval, int optlen)
 {
 	struct sctp_paddrparams params;
 	struct sctp_transport *trans;
@@ -1662,7 +1668,7 @@
 		if (params.spp_hbinterval) {
 			trans->hb_allowed = 1;
 			trans->hb_interval = 
-				MSECS_TO_JIFFIES(params.spp_hbinterval);
+				msecs_to_jiffies(params.spp_hbinterval);
 		} else
 			trans->hb_allowed = 0;
 	}
@@ -1686,7 +1692,7 @@
  * by the change).  With TCP-style sockets, this option is inherited by
  * sockets derived from a listener socket.
  */
-static int sctp_setsockopt_initmsg(struct sock *sk, char *optval, int optlen)
+static int sctp_setsockopt_initmsg(struct sock *sk, char __user *optval, int optlen)
 {
 	struct sctp_initmsg sinit;
 	struct sctp_opt *sp = sctp_sk(sk);
@@ -1723,7 +1729,7 @@
  *   to this call if the caller is using the UDP model.
  */
 static int sctp_setsockopt_default_send_param(struct sock *sk,
-						char *optval, int optlen)
+						char __user *optval, int optlen)
 {
 	struct sctp_sndrcvinfo info;
 	struct sctp_association *asoc;
@@ -1761,7 +1767,7 @@
  * the association primary.  The enclosed address must be one of the
  * association peer's addresses.
  */
-static int sctp_setsockopt_primary_addr(struct sock *sk, char *optval,
+static int sctp_setsockopt_primary_addr(struct sock *sk, char __user *optval,
 					int optlen)
 {
 	struct sctp_prim prim;
@@ -1790,14 +1796,14 @@
  * introduced, at the cost of more packets in the network.  Expects an
  *  integer boolean flag.
  */
-static int sctp_setsockopt_nodelay(struct sock *sk, char *optval,
+static int sctp_setsockopt_nodelay(struct sock *sk, char __user *optval,
 					int optlen)
 {
 	int val;
 
 	if (optlen < sizeof(int))
 		return -EINVAL;
-	if (get_user(val, (int *)optval))
+	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 
 	sctp_sk(sk)->nodelay = (val == 0) ? 0 : 1;
@@ -1816,7 +1822,7 @@
  * be changed.
  *
  */
-static int sctp_setsockopt_rtoinfo(struct sock *sk, char *optval, int optlen) {
+static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, int optlen) {
 	struct sctp_rtoinfo rtoinfo;
 	struct sctp_association *asoc;
 
@@ -1835,11 +1841,11 @@
 	if (asoc) {
 		if (rtoinfo.srto_initial != 0)
 			asoc->rto_initial = 
-				MSECS_TO_JIFFIES(rtoinfo.srto_initial);
+				msecs_to_jiffies(rtoinfo.srto_initial);
 		if (rtoinfo.srto_max != 0)
-			asoc->rto_max = MSECS_TO_JIFFIES(rtoinfo.srto_max);
+			asoc->rto_max = msecs_to_jiffies(rtoinfo.srto_max);
 		if (rtoinfo.srto_min != 0)
-			asoc->rto_min = MSECS_TO_JIFFIES(rtoinfo.srto_min);
+			asoc->rto_min = msecs_to_jiffies(rtoinfo.srto_min);
 	} else {
 		/* If there is no association or the association-id = 0
 		 * set the values to the endpoint.
@@ -1868,7 +1874,7 @@
  * See [SCTP] for more information.
  *
  */
-static int sctp_setsockopt_associnfo(struct sock *sk, char *optval, int optlen)
+static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, int optlen)
 {
 
 	struct sctp_assocparams assocparams;
@@ -1919,14 +1925,14 @@
  * addresses and a user will receive both PF_INET6 and PF_INET type
  * addresses on the socket.
  */
-static int sctp_setsockopt_mappedv4(struct sock *sk, char *optval, int optlen)
+static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, int optlen)
 {
 	int val;
 	struct sctp_opt *sp = sctp_sk(sk);
 
 	if (optlen < sizeof(int))
 		return -EINVAL;
-	if (get_user(val, (int *)optval))
+	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 	if (val)
 		sp->v4mapped = 1;
@@ -1946,7 +1952,7 @@
  * PMTU of the underlying association is smaller than the value set by
  * the user.
  */
-static int sctp_setsockopt_maxseg(struct sock *sk, char *optval, int optlen)
+static int sctp_setsockopt_maxseg(struct sock *sk, char __user *optval, int optlen)
 {
 	struct sctp_association *asoc;
 	struct list_head *pos;
@@ -1955,7 +1961,7 @@
 
 	if (optlen < sizeof(int))
 		return -EINVAL;
-	if (get_user(val, (int *)optval))
+	if (get_user(val, (int __user *)optval))
 		return -EFAULT;
 	if ((val < 8) || (val > SCTP_MAX_CHUNK_LEN))
 		return -EINVAL;
@@ -1981,7 +1987,7 @@
  *   locally bound addresses. The following structure is used to make a
  *   set primary request:
  */
-static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char *optval,
+static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optval,
 					     int optlen)
 {
 	struct sctp_opt		*sp;
@@ -2041,9 +2047,9 @@
  *
  * The syntax is:
  *
- *   ret = getsockopt(int sd, int level, int optname, void *optval,
- *                    int *optlen);
- *   ret = setsockopt(int sd, int level, int optname, const void *optval,
+ *   ret = getsockopt(int sd, int level, int optname, void __user *optval,
+ *                    int __user *optlen);
+ *   ret = setsockopt(int sd, int level, int optname, const void __user *optval,
  *                    int optlen);
  *
  *   sd      - the socket descript.
@@ -2053,7 +2059,7 @@
  *   optlen  - the size of the buffer.
  */
 SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname,
-				char *optval, int optlen)
+				char __user *optval, int optlen)
 {
 	int retval = 0;
 
@@ -2077,13 +2083,13 @@
 	switch (optname) {
 	case SCTP_SOCKOPT_BINDX_ADD:
 		/* 'optlen' is the size of the addresses buffer. */
-		retval = sctp_setsockopt_bindx(sk, (struct sockaddr *)optval,
+		retval = sctp_setsockopt_bindx(sk, (struct sockaddr __user *)optval,
 					       optlen, SCTP_BINDX_ADD_ADDR);
 		break;
 
 	case SCTP_SOCKOPT_BINDX_REM:
 		/* 'optlen' is the size of the addresses buffer. */
-		retval = sctp_setsockopt_bindx(sk, (struct sockaddr *)optval,
+		retval = sctp_setsockopt_bindx(sk, (struct sockaddr __user *)optval,
 					       optlen, SCTP_BINDX_REM_ADDR);
 		break;
 
@@ -2379,14 +2385,14 @@
 	sp->initmsg.sinit_num_ostreams   = sctp_max_outstreams;
 	sp->initmsg.sinit_max_instreams  = sctp_max_instreams;
 	sp->initmsg.sinit_max_attempts   = sctp_max_retrans_init;
-	sp->initmsg.sinit_max_init_timeo = JIFFIES_TO_MSECS(sctp_rto_max);
+	sp->initmsg.sinit_max_init_timeo = jiffies_to_msecs(sctp_rto_max);
 
 	/* Initialize default RTO related parameters.  These parameters can
 	 * be modified for with the SCTP_RTOINFO socket option.
 	 */
-	sp->rtoinfo.srto_initial = JIFFIES_TO_MSECS(sctp_rto_initial);
-	sp->rtoinfo.srto_max     = JIFFIES_TO_MSECS(sctp_rto_max);
-	sp->rtoinfo.srto_min     = JIFFIES_TO_MSECS(sctp_rto_min);
+	sp->rtoinfo.srto_initial = jiffies_to_msecs(sctp_rto_initial);
+	sp->rtoinfo.srto_max     = jiffies_to_msecs(sctp_rto_max);
+	sp->rtoinfo.srto_min     = jiffies_to_msecs(sctp_rto_min);
 
 	/* Initialize default association related parameters. These parameters
 	 * can be modified with the SCTP_ASSOCINFO socket option.
@@ -2396,7 +2402,7 @@
 	sp->assocparams.sasoc_peer_rwnd = 0;
 	sp->assocparams.sasoc_local_rwnd = 0;
 	sp->assocparams.sasoc_cookie_life = 
-		JIFFIES_TO_MSECS(sctp_valid_cookie_life);
+		jiffies_to_msecs(sctp_valid_cookie_life);
 
 	/* Initialize default event subscriptions. By default, all the
 	 * options are off. 
@@ -2406,7 +2412,7 @@
 	/* Default Peer Address Parameters.  These defaults can
 	 * be modified via SCTP_PEER_ADDR_PARAMS
 	 */
-	sp->paddrparam.spp_hbinterval = JIFFIES_TO_MSECS(sctp_hb_interval);
+	sp->paddrparam.spp_hbinterval = jiffies_to_msecs(sctp_hb_interval);
 	sp->paddrparam.spp_pathmaxrxt = sctp_max_retrans_path;
 
 	/* If enabled no SCTP message fragmentation will be performed.
@@ -2506,8 +2512,9 @@
  * number of unacked data chunks, and number of data chunks pending
  * receipt.  This information is read-only.
  */
-static int sctp_getsockopt_sctp_status(struct sock *sk, int len, char *optval,
-				       int *optlen)
+static int sctp_getsockopt_sctp_status(struct sock *sk, int len,
+				       char __user *optval,
+				       int __user *optlen)
 {
 	struct sctp_status status;
 	struct sctp_association *asoc = NULL;
@@ -2552,7 +2559,7 @@
 	status.sstat_primary.spinfo_state = transport->active;
 	status.sstat_primary.spinfo_cwnd = transport->cwnd;
 	status.sstat_primary.spinfo_srtt = transport->srtt;
-	status.sstat_primary.spinfo_rto = JIFFIES_TO_MSECS(transport->rto);
+	status.sstat_primary.spinfo_rto = jiffies_to_msecs(transport->rto);
 	status.sstat_primary.spinfo_mtu = transport->pmtu;
 
 	if (put_user(len, optlen)) {
@@ -2582,7 +2589,8 @@
  * read-only.
  */
 static int sctp_getsockopt_peer_addr_info(struct sock *sk, int len,
-					  char *optval, int *optlen)
+					  char __user *optval,
+					  int __user *optlen)
 {
 	struct sctp_paddrinfo pinfo;
 	struct sctp_transport *transport;
@@ -2607,7 +2615,7 @@
 	pinfo.spinfo_state = transport->active;
 	pinfo.spinfo_cwnd = transport->cwnd;
 	pinfo.spinfo_srtt = transport->srtt;
-	pinfo.spinfo_rto = JIFFIES_TO_MSECS(transport->rto);
+	pinfo.spinfo_rto = jiffies_to_msecs(transport->rto);
 	pinfo.spinfo_mtu = transport->pmtu;
 
 	if (put_user(len, optlen)) {
@@ -2632,7 +2640,7 @@
  * instead a error will be indicated to the user.
  */
 static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
-						    char *optval, int *optlen)
+					char __user *optval, int __user *optlen)
 {
 	int val;
 
@@ -2653,8 +2661,8 @@
  * This socket option is used to specify various notifications and
  * ancillary data the user wishes to receive.
  */
-static int sctp_getsockopt_events(struct sock *sk, int len, char *optval,
-				  int *optlen)
+static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
+				  int __user *optlen)
 {
 	if (len != sizeof(struct sctp_event_subscribe))
 		return -EINVAL;
@@ -2674,7 +2682,7 @@
  * integer defining the number of seconds of idle time before an
  * association is closed.
  */
-static int sctp_getsockopt_autoclose(struct sock *sk, int len, char *optval, int *optlen)
+static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen)
 {
 	/* Applicable to UDP-style socket only */
 	if (sctp_style(sk, TCP))
@@ -2714,7 +2722,7 @@
 	return err;
 }
 
-static int sctp_getsockopt_peeloff(struct sock *sk, int len, char *optval, int *optlen)
+static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval, int __user *optlen)
 {
 	sctp_peeloff_arg_t peeloff;
 	struct socket *newsock;
@@ -2789,14 +2797,14 @@
  *                     considered unreachable.
  */
 static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len,
-						char *optval, int *optlen)
+						char __user *optval, int __user *optlen)
 {
 	struct sctp_paddrparams params;
 	struct sctp_transport *trans;
 
 	if (len != sizeof(struct sctp_paddrparams))
 		return -EINVAL;
-	if (copy_from_user(&params, optval, *optlen))
+	if (copy_from_user(&params, optval, len))
 		return -EFAULT;
 
 	trans = sctp_addr_id2transport(sk, &params.spp_address,
@@ -2811,7 +2819,7 @@
 	if (!trans->hb_allowed)
 		params.spp_hbinterval = 0;
 	else
-		params.spp_hbinterval = JIFFIES_TO_MSECS(trans->hb_interval);
+		params.spp_hbinterval = jiffies_to_msecs(trans->hb_interval);
 
 	/* spp_pathmaxrxt contains the maximum number of retransmissions
 	 * before this address shall be considered unreachable.
@@ -2838,7 +2846,7 @@
  * by the change).  With TCP-style sockets, this option is inherited by
  * sockets derived from a listener socket.
  */
-static int sctp_getsockopt_initmsg(struct sock *sk, int len, char *optval, int *optlen)
+static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen)
 {
 	if (len != sizeof(struct sctp_initmsg))
 		return -EINVAL;
@@ -2848,7 +2856,7 @@
 }
 
 static int sctp_getsockopt_peer_addrs_num(struct sock *sk, int len,
-					  char *optval, int *optlen)
+					  char __user *optval, int __user *optlen)
 {
 	sctp_assoc_t id;
 	struct sctp_association *asoc;
@@ -2874,14 +2882,14 @@
 }
 
 static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
-				      char *optval, int *optlen)
+				      char __user *optval, int __user *optlen)
 {
 	struct sctp_association *asoc;
 	struct list_head *pos;
 	int cnt = 0;
 	struct sctp_getaddrs getaddrs;
 	struct sctp_transport *from;
-	void *to;
+	void __user *to;
 	union sctp_addr temp;
 	struct sctp_opt *sp = sctp_sk(sk);
 	int addrlen;
@@ -2899,7 +2907,7 @@
 	if (!asoc)
 		return -EINVAL;
 
-	to = (void *)getaddrs.addrs;
+	to = (void __user *)getaddrs.addrs;
 	list_for_each(pos, &asoc->peer.transport_addr_list) {
 		from = list_entry(pos, struct sctp_transport, transports);
 		memcpy(&temp, &from->ipaddr, sizeof(temp));
@@ -2920,7 +2928,8 @@
 }
 
 static int sctp_getsockopt_local_addrs_num(struct sock *sk, int len,
-						char *optval, int *optlen)
+						char __user *optval,
+						int __user *optlen)
 {
 	sctp_assoc_t id;
 	struct sctp_bind_addr *bp;
@@ -2957,7 +2966,7 @@
 }
 
 static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
-					char *optval, int *optlen)
+					char __user *optval, int __user *optlen)
 {
 	struct sctp_bind_addr *bp;
 	struct sctp_association *asoc;
@@ -2965,7 +2974,7 @@
 	int cnt = 0;
 	struct sctp_getaddrs getaddrs;
 	struct sctp_sockaddr_entry *from;
-	void *to;
+	void __user *to;
 	union sctp_addr temp;
 	struct sctp_opt *sp = sctp_sk(sk);
 	int addrlen;
@@ -2992,7 +3001,7 @@
 		bp = &asoc->base.bind_addr;
 	}
 
-	to = (void *)getaddrs.addrs;
+	to = getaddrs.addrs;
 	list_for_each(pos, &bp->address_list) {
 		from = list_entry(pos,
 				struct sctp_sockaddr_entry,
@@ -3021,7 +3030,7 @@
  * association peer's addresses.
  */
 static int sctp_getsockopt_primary_addr(struct sock *sk, int len,
-					char *optval, int *optlen)
+					char __user *optval, int __user *optlen)
 {
 	struct sctp_prim prim;
 	struct sctp_association *asoc;
@@ -3076,7 +3085,8 @@
  *   For getsockopt, it get the default sctp_sndrcvinfo structure.
  */
 static int sctp_getsockopt_default_send_param(struct sock *sk,
-					int len, char *optval, int *optlen)
+					int len, char __user *optval,
+					int __user *optlen)
 {
 	struct sctp_sndrcvinfo info;
 	struct sctp_association *asoc;
@@ -3122,7 +3132,7 @@
  */
 
 static int sctp_getsockopt_nodelay(struct sock *sk, int len,
-				   char *optval, int *optlen)
+				   char __user *optval, int __user *optlen)
 {
 	int val;
 
@@ -3150,8 +3160,9 @@
  * be changed.
  *
  */
-static int sctp_getsockopt_rtoinfo(struct sock *sk, int len, char *optval,
-				int *optlen) {
+static int sctp_getsockopt_rtoinfo(struct sock *sk, int len,
+				char __user *optval,
+				int __user *optlen) {
 	struct sctp_rtoinfo rtoinfo;
 	struct sctp_association *asoc;
 
@@ -3168,9 +3179,9 @@
 
 	/* Values corresponding to the specific association. */
 	if (asoc) {
-		rtoinfo.srto_initial = JIFFIES_TO_MSECS(asoc->rto_initial);
-		rtoinfo.srto_max = JIFFIES_TO_MSECS(asoc->rto_max);
-		rtoinfo.srto_min = JIFFIES_TO_MSECS(asoc->rto_min);
+		rtoinfo.srto_initial = jiffies_to_msecs(asoc->rto_initial);
+		rtoinfo.srto_max = jiffies_to_msecs(asoc->rto_max);
+		rtoinfo.srto_min = jiffies_to_msecs(asoc->rto_min);
 	} else {
 		/* Values corresponding to the endpoint. */
 		struct sctp_opt *sp = sctp_sk(sk);
@@ -3200,8 +3211,9 @@
  * See [SCTP] for more information.
  *
  */
-static int sctp_getsockopt_associnfo(struct sock *sk, int len, char *optval,
-				     int *optlen)
+static int sctp_getsockopt_associnfo(struct sock *sk, int len,
+				     char __user *optval,
+				     int __user *optlen)
 {
 
 	struct sctp_assocparams assocparams;
@@ -3270,7 +3282,7 @@
  * addresses on the socket.
  */
 static int sctp_getsockopt_mappedv4(struct sock *sk, int len,
-				    char *optval, int *optlen)
+				    char __user *optval, int __user *optlen)
 {
 	int val;
 	struct sctp_opt *sp = sctp_sk(sk);
@@ -3299,7 +3311,7 @@
  * the user.
  */
 static int sctp_getsockopt_maxseg(struct sock *sk, int len,
-				  char *optval, int *optlen)
+				  char __user *optval, int __user *optlen)
 {
 	int val;
 
@@ -3318,7 +3330,7 @@
 }
 
 SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
-				char *optval, int *optlen)
+				char __user *optval, int __user *optlen)
 {
 	int retval = 0;
 	int len;
@@ -4381,7 +4393,11 @@
 	return err;
 
 do_error:
-	err = -ECONNREFUSED;
+	if (asoc->counters[SCTP_COUNTER_INIT_ERROR] + 1 >=
+					 	asoc->max_init_attempts)
+		err = -ETIMEDOUT;
+	else
+		err = -ECONNREFUSED;
 	goto out;
 
 do_interrupted:
diff -Nru a/net/sctp/sysctl.c b/net/sctp/sysctl.c
--- a/net/sctp/sysctl.c	Tue Jun 15 22:20:39 2004
+++ b/net/sctp/sysctl.c	Tue Jun 15 22:20:39 2004
@@ -232,7 +232,7 @@
 				return -EINVAL;
 		}
 		if (put_user((*(int *)(table->data) * 1000) / HZ,
-			(int *)oldval) ||
+			(int __user *)oldval) ||
 		    (oldlenp && put_user(sizeof (int), oldlenp)))
 			return -EFAULT;
 	}
@@ -242,7 +242,7 @@
 		if (newlen != sizeof (int))
 			return -EINVAL;
 
-		if (get_user(new, (int *)newval))
+		if (get_user(new, (int __user *)newval))
 			return -EFAULT;
 
 		*(int *)(table->data) = (new * HZ) / 1000;
diff -Nru a/net/socket.c b/net/socket.c
--- a/net/socket.c	Tue Jun 15 22:20:39 2004
+++ b/net/socket.c	Tue Jun 15 22:20:39 2004
@@ -87,6 +87,8 @@
 #endif	/* CONFIG_NET_RADIO */
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
+
 #include <net/compat.h>
 
 #include <net/sock.h>
@@ -308,9 +310,9 @@
 static int init_inodecache(void)
 {
 	sock_inode_cachep = kmem_cache_create("sock_inode_cache",
-					     sizeof(struct socket_alloc),
-					     0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
-					     init_once, NULL);
+				sizeof(struct socket_alloc),
+				0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+				init_once, NULL);
 	if (sock_inode_cachep == NULL)
 		return -ENOMEM;
 	return 0;
@@ -727,9 +729,9 @@
  */
 
 static DECLARE_MUTEX(br_ioctl_mutex);
-static int (*br_ioctl_hook)(unsigned long arg) = NULL;
+static int (*br_ioctl_hook)(unsigned int cmd, void __user *arg) = NULL;
 
-void brioctl_set(int (*hook)(unsigned long))
+void brioctl_set(int (*hook)(unsigned int, void __user *))
 {
 	down(&br_ioctl_mutex);
 	br_ioctl_hook = hook;
@@ -738,9 +740,9 @@
 EXPORT_SYMBOL(brioctl_set);
 
 static DECLARE_MUTEX(vlan_ioctl_mutex);
-static int (*vlan_ioctl_hook)(unsigned long arg);
+static int (*vlan_ioctl_hook)(void __user *arg);
 
-void vlan_ioctl_set(int (*hook)(unsigned long))
+void vlan_ioctl_set(int (*hook)(void __user *))
 {
 	down(&vlan_ioctl_mutex);
 	vlan_ioctl_hook = hook;
@@ -749,9 +751,9 @@
 EXPORT_SYMBOL(vlan_ioctl_set);
 
 static DECLARE_MUTEX(dlci_ioctl_mutex);
-static int (*dlci_ioctl_hook)(unsigned int, void *);
+static int (*dlci_ioctl_hook)(unsigned int, void __user *);
 
-void dlci_ioctl_set(int (*hook)(unsigned int, void *))
+void dlci_ioctl_set(int (*hook)(unsigned int, void __user *))
 {
 	down(&dlci_ioctl_mutex);
 	dlci_ioctl_hook = hook;
@@ -768,39 +770,42 @@
 		      unsigned long arg)
 {
 	struct socket *sock;
+	void __user *argp = (void __user *)arg;
 	int pid, err;
 
 	unlock_kernel();
 	sock = SOCKET_I(inode);
 	if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
-		err = dev_ioctl(cmd, (void *)arg);
+		err = dev_ioctl(cmd, argp);
 	} else
 #ifdef WIRELESS_EXT
 	if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) {
-		err = dev_ioctl(cmd, (void *)arg);
+		err = dev_ioctl(cmd, argp);
 	} else
 #endif	/* WIRELESS_EXT */
 	switch (cmd) {
 		case FIOSETOWN:
 		case SIOCSPGRP:
 			err = -EFAULT;
-			if (get_user(pid, (int *)arg))
+			if (get_user(pid, (int __user *)argp))
 				break;
 			err = f_setown(sock->file, pid, 1);
 			break;
 		case FIOGETOWN:
 		case SIOCGPGRP:
-			err = put_user(sock->file->f_owner.pid, (int *)arg);
+			err = put_user(sock->file->f_owner.pid, (int __user *)argp);
 			break;
 		case SIOCGIFBR:
 		case SIOCSIFBR:
+		case SIOCBRADDBR:
+		case SIOCBRDELBR:
 			err = -ENOPKG;
 			if (!br_ioctl_hook)
 				request_module("bridge");
 
 			down(&br_ioctl_mutex);
 			if (br_ioctl_hook) 
-				err = br_ioctl_hook(arg);
+				err = br_ioctl_hook(cmd, argp);
 			up(&br_ioctl_mutex);
 			break;
 		case SIOCGIFVLAN:
@@ -811,13 +816,13 @@
 
 			down(&vlan_ioctl_mutex);
 			if (vlan_ioctl_hook)
-				err = vlan_ioctl_hook(arg);
+				err = vlan_ioctl_hook(argp);
 			up(&vlan_ioctl_mutex);
 			break;
 		case SIOCGIFDIVERT:
 		case SIOCSIFDIVERT:
 		/* Convert this to call through a hook */
-			err = divert_ioctl(cmd, (struct divert_cf *)arg);
+			err = divert_ioctl(cmd, argp);
 			break;
 		case SIOCADDDLCI:
 		case SIOCDELDLCI:
@@ -827,7 +832,7 @@
 
 			if (dlci_ioctl_hook) {
 				down(&dlci_ioctl_mutex);
-				err = dlci_ioctl_hook(cmd, (void *)arg);
+				err = dlci_ioctl_hook(cmd, argp);
 				up(&dlci_ioctl_mutex);
 			}
 			break;
@@ -1817,6 +1822,8 @@
 	return err;
 }
 
+#ifdef __ARCH_WANT_SYS_SOCKETCALL
+
 /* Argument list sizes for sys_socketcall */
 #define AL(x) ((x) * sizeof(unsigned long))
 static unsigned char nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
@@ -1909,6 +1916,8 @@
 	}
 	return err;
 }
+
+#endif /* __ARCH_WANT_SYS_SOCKETCALL */
 
 /*
  *	This function is called by a protocol handler that wants to
diff -Nru a/net/sunrpc/auth_gss/Makefile b/net/sunrpc/auth_gss/Makefile
--- a/net/sunrpc/auth_gss/Makefile	Tue Jun 15 22:20:40 2004
+++ b/net/sunrpc/auth_gss/Makefile	Tue Jun 15 22:20:40 2004
@@ -4,11 +4,11 @@
 
 obj-$(CONFIG_SUNRPC_GSS) += auth_rpcgss.o
 
-auth_rpcgss-objs := auth_gss.o gss_pseudoflavors.o gss_generic_token.o \
-	sunrpcgss_syms.o gss_mech_switch.o svcauth_gss.o
+auth_rpcgss-objs := auth_gss.o gss_generic_token.o \
+	gss_mech_switch.o svcauth_gss.o gss_krb5_crypto.o
 
 obj-$(CONFIG_RPCSEC_GSS_KRB5) += rpcsec_gss_krb5.o
 
 rpcsec_gss_krb5-objs := gss_krb5_mech.o gss_krb5_seal.o gss_krb5_unseal.o \
-	gss_krb5_crypto.o gss_krb5_seqnum.o
+	gss_krb5_seqnum.o
 
diff -Nru a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
--- a/net/sunrpc/auth_gss/auth_gss.c	Tue Jun 15 22:20:40 2004
+++ b/net/sunrpc/auth_gss/auth_gss.c	Tue Jun 15 22:20:40 2004
@@ -132,6 +132,8 @@
 	}
 }
 
+EXPORT_SYMBOL(print_hexl);
+
 static inline struct gss_cl_ctx *
 gss_get_ctx(struct gss_cl_ctx *ctx)
 {
@@ -280,7 +282,7 @@
 	kfree(ctx);
 err:
 	*gc = NULL;
-	dprintk("RPC: gss_parse_init_downcall returning %d\n", err);
+	dprintk("RPC:      gss_parse_init_downcall returning %d\n", err);
 	return err;
 }
 
@@ -311,8 +313,10 @@
 		if (pos->uid != uid)
 			continue;
 		atomic_inc(&pos->count);
+		dprintk("RPC:      gss_find_upcall found msg %p\n", pos);
 		return pos;
 	}
+	dprintk("RPC:      gss_find_upcall found nothing\n");
 	return NULL;
 }
 
@@ -350,6 +354,8 @@
 	uid_t uid = cred->cr_uid;
 	int res = 0;
 
+	dprintk("RPC: %4u gss_upcall for uid %u\n", task->tk_pid, uid);
+
 retry:
 	spin_lock(&gss_auth->lock);
 	gss_msg = __gss_find_upcall(gss_auth, uid);
@@ -358,8 +364,10 @@
 	if (gss_new == NULL) {
 		spin_unlock(&gss_auth->lock);
 		gss_new = kmalloc(sizeof(*gss_new), GFP_KERNEL);
-		if (!gss_new)
+		if (!gss_new) {
+			dprintk("RPC: %4u gss_upcall -ENOMEM\n", task->tk_pid);
 			return -ENOMEM;
+		}
 		goto retry;
 	}
 	gss_msg = gss_new;
@@ -389,12 +397,14 @@
 		spin_unlock(&gss_auth->lock);
 	}
 	gss_release_msg(gss_msg);
+	dprintk("RPC: %4u gss_upcall for uid %u result %d", task->tk_pid,
+			uid, res);
 	return res;
 out_sleep:
-	/* Sleep forever */
 	task->tk_timeout = 0;
 	rpc_sleep_on(&gss_msg->waitq, task, NULL, NULL);
 	spin_unlock(&gss_auth->lock);
+	dprintk("RPC: %4u gss_upcall  sleeping\n", task->tk_pid);
 	if (gss_new)
 		kfree(gss_new);
 	/* Note: we drop the reference here: we are automatically removed
@@ -426,13 +436,13 @@
 	return mlen;
 }
 
+#define MSG_BUF_MAXSIZE 1024
+
 static ssize_t
 gss_pipe_downcall(struct file *filp, const char *src, size_t mlen)
 {
-	char buf[1024];
 	struct xdr_netobj obj = {
 		.len	= mlen,
-		.data	= buf,
 	};
 	struct inode *inode = filp->f_dentry->d_inode;
 	struct rpc_inode *rpci = RPC_I(inode);
@@ -448,11 +458,16 @@
 	int err;
 	int gss_err;
 
-	if (mlen > sizeof(buf))
-		return -ENOSPC;
-	left = copy_from_user(buf, src, mlen);
-	if (left)
-		return -EFAULT;
+	if (mlen > MSG_BUF_MAXSIZE)
+		return -EFBIG;
+	obj.data = kmalloc(mlen, GFP_KERNEL);
+	if (!obj.data)
+		return -ENOMEM;
+	left = copy_from_user(obj.data, src, mlen);
+	if (left) {
+		err = -EFAULT;
+		goto out;
+	}
 	clnt = rpci->private;
 	atomic_inc(&clnt->cl_users);
 	auth = clnt->cl_auth;
@@ -477,12 +492,16 @@
 	} else
 		spin_unlock(&gss_auth->lock);
 	rpc_release_client(clnt);
+	kfree(obj.data);
+	dprintk("RPC:      gss_pipe_downcall returning length %Zu\n", mlen);
 	return mlen;
 err:
 	if (ctx)
 		gss_destroy_ctx(ctx);
 	rpc_release_client(clnt);
-	dprintk("RPC: gss_pipe_downcall returning %d\n", err);
+out:
+	kfree(obj.data);
+	dprintk("RPC:      gss_pipe_downcall returning %d\n", err);
 	return err;
 }
 
@@ -520,6 +539,8 @@
 	static unsigned long ratelimit;
 
 	if (msg->errno < 0) {
+		dprintk("RPC:      gss_pipe_destroy_msg releasing msg %p\n",
+				gss_msg);
 		atomic_inc(&gss_msg->count);
 		gss_unhash_msg(gss_msg);
 		if (msg->errno == -ETIMEDOUT || msg->errno == -EPIPE) {
@@ -544,10 +565,11 @@
 	struct gss_auth *gss_auth;
 	struct rpc_auth * auth;
 
-	dprintk("RPC: creating GSS authenticator for client %p\n",clnt);
+	dprintk("RPC:      creating GSS authenticator for client %p\n",clnt);
+
 	if (!(gss_auth = kmalloc(sizeof(*gss_auth), GFP_KERNEL)))
 		goto out_dec;
-	gss_auth->mech = gss_pseudoflavor_to_mech(flavor);
+	gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
 	if (!gss_auth->mech) {
 		printk(KERN_WARNING "%s: Pseudoflavor %d not found!",
 				__FUNCTION__, flavor);
@@ -566,7 +588,7 @@
 
 	snprintf(gss_auth->path, sizeof(gss_auth->path), "%s/%s",
 			clnt->cl_pathname,
-			gss_auth->mech->gm_ops->name);
+			gss_auth->mech->gm_name);
 	gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN);
 	if (IS_ERR(gss_auth->dentry))
 		goto err_free;
@@ -582,7 +604,8 @@
 gss_destroy(struct rpc_auth *auth)
 {
 	struct gss_auth *gss_auth;
-	dprintk("RPC: destroying GSS authenticator %p flavor %d\n",
+
+	dprintk("RPC:      destroying GSS authenticator %p flavor %d\n",
 		auth, auth->au_flavor);
 
 	gss_auth = container_of(auth, struct gss_auth, rpc_auth);
@@ -597,8 +620,7 @@
 static void
 gss_destroy_ctx(struct gss_cl_ctx *ctx)
 {
-
-	dprintk("RPC: gss_destroy_ctx\n");
+	dprintk("RPC:      gss_destroy_ctx\n");
 
 	if (ctx->gc_gss_ctx)
 		gss_delete_sec_context(&ctx->gc_gss_ctx);
@@ -617,7 +639,7 @@
 {
 	struct gss_cred *cred = (struct gss_cred *)rc;
 
-	dprintk("RPC: gss_destroy_cred \n");
+	dprintk("RPC:      gss_destroy_cred \n");
 
 	if (cred->gc_ctx)
 		gss_put_ctx(cred->gc_ctx);
@@ -629,7 +651,7 @@
 {
 	struct gss_cred	*cred = NULL;
 
-	dprintk("RPC: gss_create_cred for uid %d, flavor %d\n",
+	dprintk("RPC:      gss_create_cred for uid %d, flavor %d\n",
 		acred->uid, auth->au_flavor);
 
 	if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL)))
@@ -649,7 +671,7 @@
 	return (struct rpc_cred *) cred;
 
 out_err:
-	dprintk("RPC: gss_create_cred failed\n");
+	dprintk("RPC:      gss_create_cred failed\n");
 	if (cred) gss_destroy_cred((struct rpc_cred *)cred);
 	return NULL;
 }
@@ -679,15 +701,16 @@
 	struct xdr_buf	verf_buf;
 	u32		service;
 
-	dprintk("RPC: gss_marshal\n");
+	dprintk("RPC: %4u gss_marshal\n", task->tk_pid);
 
 	*p++ = htonl(RPC_AUTH_GSS);
 	cred_len = p++;
 
-	service = gss_pseudoflavor_to_service(gss_cred->gc_flavor);
+	service = gss_pseudoflavor_to_service(ctx->gc_gss_ctx->mech_type,
+						gss_cred->gc_flavor);
 	if (service == 0) {
-		dprintk("Bad pseudoflavor %d in gss_marshal\n",
-			gss_cred->gc_flavor);
+		dprintk("RPC: %4u Bad pseudoflavor %d in gss_marshal\n",
+			task->tk_pid, gss_cred->gc_flavor);
 		goto out_put_ctx;
 	}
 	spin_lock(&ctx->gc_seq_lock);
@@ -736,10 +759,8 @@
 gss_refresh(struct rpc_task *task)
 {
 	struct rpc_clnt *clnt = task->tk_client;
-	struct rpc_xprt *xprt = task->tk_xprt;
 	struct rpc_cred *cred = task->tk_msg.rpc_cred;
 
-	task->tk_timeout = xprt->timeout.to_current;
 	if (!gss_cred_is_uptodate_ctx(cred))
 		return gss_upcall(clnt, task, cred);
 	return 0;
@@ -759,7 +780,7 @@
 	u32		flav,len;
 	u32		service;
 
-	dprintk("RPC: gss_validate\n");
+	dprintk("RPC: %4u gss_validate\n", task->tk_pid);
 
 	flav = ntohl(*p++);
 	if ((len = ntohl(*p++)) > RPC_MAX_AUTH_SIZE)
@@ -775,7 +796,8 @@
 
 	if (gss_verify_mic(ctx->gc_gss_ctx, &verf_buf, &mic, &qop_state))
                goto out_bad;
-       service = gss_pseudoflavor_to_service(gss_cred->gc_flavor);
+       service = gss_pseudoflavor_to_service(ctx->gc_gss_ctx->mech_type,
+					gss_cred->gc_flavor);
        switch (service) {
        case RPC_GSS_SVC_NONE:
 	       /* verifier data, flavor, length: */
@@ -789,33 +811,75 @@
 	       goto out_bad;
        }
 	gss_put_ctx(ctx);
+	dprintk("RPC: %4u GSS gss_validate: gss_verify_mic succeeded.\n",
+			task->tk_pid);
 	return p + XDR_QUADLEN(len);
 out_bad:
 	gss_put_ctx(ctx);
+	dprintk("RPC: %4u gss_validate failed.\n", task->tk_pid);
 	return NULL;
 }
 
+static inline int
+gss_wrap_req_integ(struct gss_cl_ctx *ctx,
+			kxdrproc_t encode, void *rqstp, u32 *p, void *obj)
+{
+	struct rpc_rqst	*req = (struct rpc_rqst *)rqstp;
+	struct xdr_buf	*snd_buf = &req->rq_snd_buf;
+	struct xdr_buf	integ_buf;
+	u32             *integ_len = NULL;
+	struct xdr_netobj mic;
+	u32		offset, *q;
+	struct iovec	*iov;
+	u32             maj_stat = 0;
+	int		status = -EIO;
+
+	integ_len = p++;
+	offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
+	*p++ = htonl(req->rq_seqno);
+
+	status = encode(rqstp, p, obj);
+	if (status)
+		return status;
+
+	if (xdr_buf_subsegment(snd_buf, &integ_buf,
+				offset, snd_buf->len - offset))
+		return status;
+	*integ_len = htonl(integ_buf.len);
+
+	/* guess whether we're in the head or the tail: */
+	if (snd_buf->page_len || snd_buf->tail[0].iov_len) 
+		iov = snd_buf->tail;
+	else
+		iov = snd_buf->head;
+	p = iov->iov_base + iov->iov_len;
+	mic.data = (u8 *)(p + 1);
+
+	maj_stat = gss_get_mic(ctx->gc_gss_ctx,
+			GSS_C_QOP_DEFAULT, &integ_buf, &mic);
+	status = -EIO; /* XXX? */
+	if (maj_stat)
+		return status;
+	q = xdr_encode_opaque(p, NULL, mic.len);
+
+	offset = (u8 *)q - (u8 *)p;
+	iov->iov_len += offset;
+	snd_buf->len += offset;
+	return 0;
+}
+
 static int
 gss_wrap_req(struct rpc_task *task,
 	     kxdrproc_t encode, void *rqstp, u32 *p, void *obj)
 {
-	struct rpc_rqst	*req = (struct rpc_rqst *)rqstp;
-	struct xdr_buf	*snd_buf = &req->rq_snd_buf;
 	struct rpc_cred *cred = task->tk_msg.rpc_cred;
 	struct gss_cred	*gss_cred = container_of(cred, struct gss_cred,
 			gc_base);
 	struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
-	u32             *integ_len = NULL;
 	int             status = -EIO;
-	u32             maj_stat = 0;
-	struct xdr_buf	integ_buf;
-	struct xdr_netobj mic;
 	u32		service;
-	u32		offset, *q;
-	struct iovec	*iov;
 
-	dprintk("RPC: gss_wrap_body\n");
-	BUG_ON(!ctx);
+	dprintk("RPC: %4u gss_wrap_req\n", task->tk_pid);
 	if (ctx->gc_proc != RPC_GSS_PROC_DATA) {
 		/* The spec seems a little ambiguous here, but I think that not
 		 * wrapping context destruction requests makes the most sense.
@@ -823,103 +887,84 @@
 		status = encode(rqstp, p, obj);
 		goto out;
 	}
-	service = gss_pseudoflavor_to_service(gss_cred->gc_flavor);
+	service = gss_pseudoflavor_to_service(ctx->gc_gss_ctx->mech_type,
+						gss_cred->gc_flavor);
 	switch (service) {
 		case RPC_GSS_SVC_NONE:
 			status = encode(rqstp, p, obj);
 			goto out;
 		case RPC_GSS_SVC_INTEGRITY:
-
-			integ_len = p++;
-			offset = (u8 *)p - (u8 *)snd_buf->head[0].iov_base;
-			*p++ = htonl(req->rq_seqno);
-
-			status = encode(rqstp, p, obj);
-			if (status)
-				goto out;
-
-			if (xdr_buf_subsegment(snd_buf, &integ_buf,
-						offset, snd_buf->len - offset))
-				goto out;
-			*integ_len = htonl(integ_buf.len);
-
-			/* guess whether we're in the head or the tail: */
-			if (snd_buf->page_len || snd_buf->tail[0].iov_len) 
-				iov = snd_buf->tail;
-			else
-				iov = snd_buf->head;
-			p = iov->iov_base + iov->iov_len;
-			mic.data = (u8 *)(p + 1);
-
-			maj_stat = gss_get_mic(ctx->gc_gss_ctx,
-					GSS_C_QOP_DEFAULT, &integ_buf, &mic);
-			status = -EIO; /* XXX? */
-			if (maj_stat)
-				goto out;
-			q = xdr_encode_opaque(p, NULL, mic.len);
-
-			offset = (u8 *)q - (u8 *)p;
-			iov->iov_len += offset;
-			snd_buf->len += offset;
-			break;
+			status = gss_wrap_req_integ(ctx, encode, rqstp, p, obj);
+			goto out;
 		case RPC_GSS_SVC_PRIVACY:
 		default:
 			goto out;
 	}
-	status = 0;
 out:
 	gss_put_ctx(ctx);
-	dprintk("RPC: gss_wrap_req returning %d\n", status);
+	dprintk("RPC: %4u gss_wrap_req returning %d\n", task->tk_pid, status);
 	return status;
 }
 
+static inline int
+gss_unwrap_resp_integ(struct gss_cl_ctx *ctx,
+		kxdrproc_t decode, void *rqstp, u32 **p, void *obj)
+{
+	struct rpc_rqst *req = (struct rpc_rqst *)rqstp;
+	struct xdr_buf	*rcv_buf = &req->rq_rcv_buf;
+	struct xdr_buf integ_buf;
+	struct xdr_netobj mic;
+	u32 data_offset, mic_offset;
+	u32 integ_len;
+	u32 maj_stat;
+	int status = -EIO;
+
+	integ_len = ntohl(*(*p)++);
+	if (integ_len & 3)
+		return status;
+	data_offset = (u8 *)(*p) - (u8 *)rcv_buf->head[0].iov_base;
+	mic_offset = integ_len + data_offset;
+	if (mic_offset > rcv_buf->len)
+		return status;
+	if (ntohl(*(*p)++) != req->rq_seqno)
+		return status;
+
+	if (xdr_buf_subsegment(rcv_buf, &integ_buf, data_offset,
+				mic_offset - data_offset))
+		return status;
+
+	if (xdr_buf_read_netobj(rcv_buf, &mic, mic_offset))
+		return status;
+
+	maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &integ_buf,
+			&mic, NULL);
+	if (maj_stat != GSS_S_COMPLETE)
+		return status;
+	return 0;
+}
+
 static int
 gss_unwrap_resp(struct rpc_task *task,
 		kxdrproc_t decode, void *rqstp, u32 *p, void *obj)
 {
-	struct rpc_rqst *req = (struct rpc_rqst *)rqstp;
-	struct xdr_buf	*rcv_buf = &req->rq_rcv_buf;
 	struct rpc_cred *cred = task->tk_msg.rpc_cred;
 	struct gss_cred *gss_cred = container_of(cred, struct gss_cred,
 			gc_base);
 	struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
-	struct xdr_buf	integ_buf;
-	struct xdr_netobj mic;
 	int             status = -EIO;
-	u32		maj_stat = 0;
 	u32		service;
-	u32		data_offset, mic_offset;
-	u32		integ_len;
-
-	BUG_ON(!ctx);
 
 	if (ctx->gc_proc != RPC_GSS_PROC_DATA)
 		goto out_decode;
-	service = gss_pseudoflavor_to_service(gss_cred->gc_flavor);
+	service = gss_pseudoflavor_to_service(ctx->gc_gss_ctx->mech_type,
+						gss_cred->gc_flavor);
 	switch (service) {
 		case RPC_GSS_SVC_NONE:
 			goto out_decode;
 		case RPC_GSS_SVC_INTEGRITY:
-			integ_len = ntohl(*p++);
-			if (integ_len & 3)
-				goto out;
-			data_offset = (u8 *)p - (u8 *)rcv_buf->head[0].iov_base;
-			mic_offset = integ_len + data_offset;
-			if (mic_offset > rcv_buf->len)
-				goto out;
-			if (ntohl(*p++) != req->rq_seqno)
-				goto out;
-
-			if (xdr_buf_subsegment(rcv_buf, &integ_buf, data_offset,
-						mic_offset - data_offset))
-				goto out;
-
-			if (xdr_buf_read_netobj(rcv_buf, &mic, mic_offset))
-				goto out;
-
-			maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &integ_buf,
-					&mic, NULL);
-			if (maj_stat != GSS_S_COMPLETE)
+			status = gss_unwrap_resp_integ(ctx, decode, 
+							rqstp, &p, obj);
+			if (status)
 				goto out;
 			break;
 		case RPC_GSS_SVC_PRIVACY:
@@ -930,7 +975,8 @@
 	status = decode(rqstp, p, obj);
 out:
 	gss_put_ctx(ctx);
-	dprintk("RPC: gss_unwrap_resp returning %d\n", status);
+	dprintk("RPC: %4u gss_unwrap_resp returning %d\n", task->tk_pid,
+			status);
 	return status;
 }
   
@@ -985,7 +1031,6 @@
 static void __exit exit_rpcsec_gss(void)
 {
 	gss_svc_shutdown();
-	gss_mech_unregister_all();
 	rpcauth_unregister(&authgss_ops);
 }
 
diff -Nru a/net/sunrpc/auth_gss/gss_generic_token.c b/net/sunrpc/auth_gss/gss_generic_token.c
--- a/net/sunrpc/auth_gss/gss_generic_token.c	Tue Jun 15 22:20:38 2004
+++ b/net/sunrpc/auth_gss/gss_generic_token.c	Tue Jun 15 22:20:38 2004
@@ -32,6 +32,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/sunrpc/sched.h>
@@ -151,22 +152,23 @@
 	return(1 + der_length_size(body_size) + body_size);
 }
 
+EXPORT_SYMBOL(g_token_size);
+
 /* fills in a buffer with the token header.  The buffer is assumed to
    be the right size.  buf is advanced past the token header */
 
 void
-g_make_token_header(struct xdr_netobj *mech, int body_size, unsigned char **buf,
-		int tok_type)
+g_make_token_header(struct xdr_netobj *mech, int body_size, unsigned char **buf)
 {
 	*(*buf)++ = 0x60;
 	der_write_length(buf, 4 + mech->len + body_size);
 	*(*buf)++ = 0x06;
 	*(*buf)++ = (unsigned char) mech->len;
 	TWRITE_STR(*buf, mech->data, ((int) mech->len));
-	*(*buf)++ = (unsigned char) ((tok_type>>8)&0xff);
-	*(*buf)++ = (unsigned char) (tok_type&0xff);
 }
 
+EXPORT_SYMBOL(g_make_token_header);
+
 /*
  * Given a buffer containing a token, reads and verifies the token,
  * leaving buf advanced past the token header, and setting body_size
@@ -221,9 +223,6 @@
 	if (ret)
 		return(ret);
 
-	if ((*buf++ != ((tok_type>>8)&0xff)) || (*buf++ != (tok_type&0xff))) 
-		return(G_WRONG_TOKID);
-
 	if (!ret) {
 		*buf_in = buf;
 		*body_size = toksize;
@@ -231,6 +230,8 @@
 
 	return(ret);
 }
+
+EXPORT_SYMBOL(g_verify_token_header);
 
 /* Given a buffer containing a token, returns a copy of the mech oid in
  * the parameter mech. */
diff -Nru a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c	Tue Jun 15 22:20:36 2004
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c	Tue Jun 15 22:20:36 2004
@@ -59,14 +59,14 @@
         struct scatterlist sg[1];
 	u8 local_iv[16] = {0};
 
-	dprintk("RPC: krb5_encrypt: input data:\n");
+	dprintk("RPC:      krb5_encrypt: input data:\n");
 	print_hexl((u32 *)in, length, 0);
 
 	if (length % crypto_tfm_alg_blocksize(tfm) != 0)
 		goto out;
 
 	if (crypto_tfm_alg_ivsize(tfm) > 16) {
-		dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n",
+		dprintk("RPC:      gss_k5encrypt: tfm iv size to large %d\n",
 		         crypto_tfm_alg_ivsize(tfm));
 		goto out;
 	}
@@ -81,13 +81,15 @@
 
 	ret = crypto_cipher_encrypt_iv(tfm, sg, sg, length, local_iv);
 
-	dprintk("RPC: krb5_encrypt: output data:\n");
+	dprintk("RPC:      krb5_encrypt: output data:\n");
 	print_hexl((u32 *)out, length, 0);
 out:
-	dprintk("krb5_encrypt returns %d\n",ret);
+	dprintk("RPC:      krb5_encrypt returns %d\n",ret);
 	return(ret);
 }
 
+EXPORT_SYMBOL(krb5_encrypt);
+
 u32
 krb5_decrypt(
      struct crypto_tfm *tfm,
@@ -100,14 +102,14 @@
 	struct scatterlist sg[1];
 	u8 local_iv[16] = {0};
 
-	dprintk("RPC: krb5_decrypt: input data:\n");
+	dprintk("RPC:      krb5_decrypt: input data:\n");
 	print_hexl((u32 *)in, length, 0);
 
 	if (length % crypto_tfm_alg_blocksize(tfm) != 0)
 		goto out;
 
 	if (crypto_tfm_alg_ivsize(tfm) > 16) {
-		dprintk("RPC: gss_k5decrypt: tfm iv size to large %d\n",
+		dprintk("RPC:      gss_k5decrypt: tfm iv size to large %d\n",
 			crypto_tfm_alg_ivsize(tfm));
 		goto out;
 	}
@@ -121,13 +123,15 @@
 
 	ret = crypto_cipher_decrypt_iv(tfm, sg, sg, length, local_iv);
 
-	dprintk("RPC: krb5_decrypt: output_data:\n");
+	dprintk("RPC:      krb5_decrypt: output_data:\n");
 	print_hexl((u32 *)out, length, 0);
 out:
-	dprintk("gss_k5decrypt returns %d\n",ret);
+	dprintk("RPC:      gss_k5decrypt returns %d\n",ret);
 	return(ret);
 }
 
+EXPORT_SYMBOL(krb5_decrypt);
+
 void
 buf_to_sg(struct scatterlist *sg, char *ptr, int len) {
 	sg->page = virt_to_page(ptr);
@@ -135,10 +139,9 @@
 	sg->length = len;
 }
 
-/* checksum the plaintext data and the first 8 bytes of the krb5 token header,
- * as specified by the rfc: */
+/* checksum the plaintext data and hdrlen bytes of the token header */
 s32
-krb5_make_checksum(s32 cksumtype, char *header, struct xdr_buf *body,
+make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
 		   struct xdr_netobj *cksum)
 {
 	char                            *cksumname;
@@ -153,7 +156,7 @@
 			cksumname = "md5";
 			break;
 		default:
-			dprintk("RPC: krb5_make_checksum:"
+			dprintk("RPC:      krb5_make_checksum:"
 				" unsupported checksum %d", cksumtype);
 			goto out;
 	}
@@ -164,7 +167,7 @@
 		goto out;
 
 	crypto_digest_init(tfm);
-	buf_to_sg(sg, header, 8);
+	buf_to_sg(sg, header, hdrlen);
 	crypto_digest_update(tfm, sg, 1);
 	if (body->head[0].iov_len) {
 		buf_to_sg(sg, body->head[0].iov_base, body->head[0].iov_len);
@@ -202,3 +205,5 @@
 		crypto_free_tfm(tfm);
 	return code;
 }
+
+EXPORT_SYMBOL(make_checksum);
diff -Nru a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c	Tue Jun 15 22:20:42 2004
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c	Tue Jun 15 22:20:42 2004
@@ -40,7 +40,6 @@
 #include <linux/slab.h>
 #include <linux/sunrpc/auth.h>
 #include <linux/in.h>
-#include <linux/sunrpc/svcauth_gss.h>
 #include <linux/sunrpc/gss_krb5.h>
 #include <linux/sunrpc/xdr.h>
 #include <linux/crypto.h>
@@ -100,7 +99,7 @@
 			alg_mode = CRYPTO_TFM_MODE_CBC;
 			break;
 		default:
-			dprintk("RPC: get_key: unsupported algorithm %d\n", alg);
+			dprintk("RPC:      get_key: unsupported algorithm %d\n", alg);
 			goto out_err_free_key;
 	}
 	if (!(*res = crypto_alloc_tfm(alg_name, alg_mode)))
@@ -155,7 +154,7 @@
 		goto out_err_free_key2;
 
 	ctx_id->internal_ctx_id = ctx;
-	dprintk("Succesfully imported new context.\n");
+	dprintk("RPC:      Succesfully imported new context.\n");
 	return 0;
 
 out_err_free_key2:
@@ -197,7 +196,7 @@
 	if (!maj_stat && qop_state)
 	    *qstate = qop_state;
 
-	dprintk("RPC: gss_verify_mic_kerberos returning %d\n", maj_stat);
+	dprintk("RPC:      gss_verify_mic_kerberos returning %d\n", maj_stat);
 	return maj_stat;
 }
 
@@ -211,41 +210,52 @@
 
 	err = krb5_make_token(kctx, qop, message, mic_token, KG_TOK_MIC_MSG);
 
-	dprintk("RPC: gss_get_mic_kerberos returning %d\n",err);
+	dprintk("RPC:      gss_get_mic_kerberos returning %d\n",err);
 
 	return err;
 }
 
 static struct gss_api_ops gss_kerberos_ops = {
-	.name			= "krb5",
 	.gss_import_sec_context	= gss_import_sec_context_kerberos,
 	.gss_get_mic		= gss_get_mic_kerberos,
 	.gss_verify_mic		= gss_verify_mic_kerberos,
 	.gss_delete_sec_context	= gss_delete_sec_context_kerberos,
 };
 
-/* XXX error checking? reference counting? */
+static struct pf_desc gss_kerberos_pfs[] = {
+	[0] = {
+		.pseudoflavor = RPC_AUTH_GSS_KRB5,
+		.service = RPC_GSS_SVC_NONE,
+		.name = "krb5",
+	},
+	[1] = {
+		.pseudoflavor = RPC_AUTH_GSS_KRB5I,
+		.service = RPC_GSS_SVC_INTEGRITY,
+		.name = "krb5i",
+	},
+};
+
+static struct gss_api_mech gss_kerberos_mech = {
+	.gm_name	= "krb5",
+	.gm_owner	= THIS_MODULE,
+	.gm_ops		= &gss_kerberos_ops,
+	.gm_pf_num	= ARRAY_SIZE(gss_kerberos_pfs),
+	.gm_pfs		= gss_kerberos_pfs,
+};
+
 static int __init init_kerberos_module(void)
 {
-	struct gss_api_mech *gm;
+	int status;
 
-	if (gss_mech_register(&gss_mech_krb5_oid, &gss_kerberos_ops))
+	status = gss_mech_register(&gss_kerberos_mech);
+	if (status)
 		printk("Failed to register kerberos gss mechanism!\n");
-	gm = gss_mech_get_by_OID(&gss_mech_krb5_oid);
-	gss_register_triple(RPC_AUTH_GSS_KRB5 , gm, 0, RPC_GSS_SVC_NONE);
-	gss_register_triple(RPC_AUTH_GSS_KRB5I, gm, 0, RPC_GSS_SVC_INTEGRITY);
-	if (svcauth_gss_register_pseudoflavor(RPC_AUTH_GSS_KRB5, "krb5"))
-		printk("Failed to register %s with server!\n", "krb5");
-	if (svcauth_gss_register_pseudoflavor(RPC_AUTH_GSS_KRB5I, "krb5i"))
-		printk("Failed to register %s with server!\n", "krb5i");
-	gss_mech_put(gm);
-	return 0;
+	return status;
 }
 
 static void __exit cleanup_kerberos_module(void)
 {
-	gss_unregister_triple(RPC_AUTH_GSS_KRB5I);
-	gss_unregister_triple(RPC_AUTH_GSS_KRB5);
+	gss_mech_unregister(&gss_kerberos_mech);
 }
 
 MODULE_LICENSE("GPL");
diff -Nru a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
--- a/net/sunrpc/auth_gss/gss_krb5_seal.c	Tue Jun 15 22:20:35 2004
+++ b/net/sunrpc/auth_gss/gss_krb5_seal.c	Tue Jun 15 22:20:35 2004
@@ -91,7 +91,7 @@
 
 	dprintk("RPC:     gss_krb5_seal\n");
 
-	now = jiffies;
+	now = get_seconds();
 
 	if (qop_req != 0)
 		goto out_err;
@@ -101,12 +101,12 @@
 			checksum_type = CKSUMTYPE_RSA_MD5;
 			break;
 		default:
-			dprintk("RPC: gss_krb5_seal: ctx->signalg %d not"
+			dprintk("RPC:      gss_krb5_seal: ctx->signalg %d not"
 				" supported\n", ctx->signalg);
 			goto out_err;
 	}
 	if (ctx->sealalg != SEAL_ALG_NONE && ctx->sealalg != SEAL_ALG_DES) {
-		dprintk("RPC: gss_krb5_seal: ctx->sealalg %d not supported\n",
+		dprintk("RPC:      gss_krb5_seal: ctx->sealalg %d not supported\n",
 			ctx->sealalg);
 		goto out_err;
 	}
@@ -122,7 +122,10 @@
 	token->len = g_token_size(&ctx->mech_used, 22 + tmsglen);
 
 	ptr = token->data;
-	g_make_token_header(&ctx->mech_used, 22 + tmsglen, &ptr, toktype);
+	g_make_token_header(&ctx->mech_used, 22 + tmsglen, &ptr);
+
+	*ptr++ = (unsigned char) ((toktype>>8)&0xff);
+	*ptr++ = (unsigned char) (toktype&0xff);
 
 	/* ptr now at byte 2 of header described in rfc 1964, section 1.2.1: */
 	krb5_hdr = ptr - 2;
@@ -137,7 +140,7 @@
 		/* XXX removing support for now */
 		goto out_err;
 	} else { /* Sign only.  */
-		if (krb5_make_checksum(checksum_type, krb5_hdr, text,
+		if (make_checksum(checksum_type, krb5_hdr, 8, text,
 				       &md5cksum))
 			goto out_err;
 	}
@@ -151,7 +154,7 @@
 		       md5cksum.data + md5cksum.len - KRB5_CKSUM_LENGTH,
 		       KRB5_CKSUM_LENGTH);
 
-		dprintk("make_seal_token: cksum data: \n");
+		dprintk("RPC:      make_seal_token: cksum data: \n");
 		print_hexl((u32 *) (krb5_hdr + 16), KRB5_CKSUM_LENGTH, 0);
 		break;
 	default:
diff -Nru a/net/sunrpc/auth_gss/gss_krb5_seqnum.c b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
--- a/net/sunrpc/auth_gss/gss_krb5_seqnum.c	Tue Jun 15 22:20:38 2004
+++ b/net/sunrpc/auth_gss/gss_krb5_seqnum.c	Tue Jun 15 22:20:38 2004
@@ -70,7 +70,7 @@
 	s32 code;
 	unsigned char plain[8];
 
-	dprintk("krb5_get_seq_num: \n");
+	dprintk("RPC:      krb5_get_seq_num:\n");
 
 	if ((code = krb5_decrypt(key, cksum, buf, plain, 8)))
 		return code;
diff -Nru a/net/sunrpc/auth_gss/gss_krb5_unseal.c b/net/sunrpc/auth_gss/gss_krb5_unseal.c
--- a/net/sunrpc/auth_gss/gss_krb5_unseal.c	Tue Jun 15 22:20:43 2004
+++ b/net/sunrpc/auth_gss/gss_krb5_unseal.c	Tue Jun 15 22:20:43 2004
@@ -99,6 +99,10 @@
 	if (g_verify_token_header(&ctx->mech_used, &bodysize, &ptr, toktype,
 					read_token->len))
 		goto out;
+
+	if ((*ptr++ != ((toktype>>8)&0xff)) || (*ptr++ != (toktype&0xff)))
+		goto out;
+
 	/* XXX sanity-check bodysize?? */
 
 	if (toktype == KG_TOK_WRAP_MSG) {
@@ -149,7 +153,7 @@
 
 	switch (signalg) {
 	case SGN_ALG_DES_MAC_MD5:
-		ret = krb5_make_checksum(checksum_type, ptr - 2,
+		ret = make_checksum(checksum_type, ptr - 2, 8,
 					 message_buffer, &md5cksum);
 		if (ret)
 			goto out;
@@ -174,7 +178,7 @@
 	if (qop_state)
 		*qop_state = GSS_C_QOP_DEFAULT;
 
-	now = jiffies;
+	now = get_seconds();
 
 	ret = GSS_S_CONTEXT_EXPIRED;
 	if (now > ctx->endtime)
diff -Nru a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
--- a/net/sunrpc/auth_gss/gss_mech_switch.c	Tue Jun 15 22:20:42 2004
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c	Tue Jun 15 22:20:42 2004
@@ -36,9 +36,11 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/socket.h>
+#include <linux/module.h>
 #include <linux/sunrpc/msg_prot.h>
 #include <linux/sunrpc/gss_asn1.h>
 #include <linux/sunrpc/auth_gss.h>
+#include <linux/sunrpc/svcauth_gss.h>
 #include <linux/sunrpc/gss_err.h>
 #include <linux/sunrpc/sched.h>
 #include <linux/sunrpc/gss_api.h>
@@ -51,146 +53,186 @@
 static LIST_HEAD(registered_mechs);
 static spinlock_t registered_mechs_lock = SPIN_LOCK_UNLOCKED;
 
-/* Reference counting: The reference count includes the reference in the
- * global registered_mechs list.  That reference will never diseappear
- * (so the reference count will never go below 1) until after the mech
- * is removed from the list.  Nothing can be removed from the list without
- * first getting the registered_mechs_lock, so a gss_api_mech won't diseappear
- * from underneath us while we hold the registered_mech_lock.  */
-
-int
-gss_mech_register(struct xdr_netobj * mech_type, struct gss_api_ops * ops)
+static void
+gss_mech_free(struct gss_api_mech *gm)
 {
-	struct gss_api_mech *gm;
+	struct pf_desc *pf;
+	int i;
 
-	if (!(gm = kmalloc(sizeof(*gm), GFP_KERNEL))) {
-		printk("Failed to allocate memory in gss_mech_register");
-		return -1;
-	}
-	gm->gm_oid.len = mech_type->len;
-	if (!(gm->gm_oid.data = kmalloc(mech_type->len, GFP_KERNEL))) {
-		kfree(gm);
-		printk("Failed to allocate memory in gss_mech_register");
-		return -1;
-	}
-	memcpy(gm->gm_oid.data, mech_type->data, mech_type->len);
-	/* We're counting the reference in the registered_mechs list: */
-	atomic_set(&gm->gm_count, 1);
-	gm->gm_ops = ops;
-	
-	spin_lock(&registered_mechs_lock);
-	list_add(&gm->gm_list, &registered_mechs);
-	spin_unlock(&registered_mechs_lock);
-	dprintk("RPC: gss_mech_register: registered mechanism with oid:\n");
-	print_hexl((u32 *)mech_type->data, mech_type->len, 0);
-	return 0;
+	for (i = 0; i < gm->gm_pf_num; i++) {
+		pf = &gm->gm_pfs[i];
+		if (pf->auth_domain_name)
+			kfree(pf->auth_domain_name);
+		pf->auth_domain_name = NULL;
+	}
 }
 
-/* The following must be called with spinlock held: */
-int
-do_gss_mech_unregister(struct gss_api_mech *gm)
+static inline char *
+make_auth_domain_name(char *name)
 {
+	static char	*prefix = "gss/";
+	char		*new;
 
-	list_del(&gm->gm_list);
+	new = kmalloc(strlen(name) + strlen(prefix) + 1, GFP_KERNEL);
+	if (new) {
+		strcpy(new, prefix);
+		strcat(new, name);
+	}
+	return new;
+}
 
-	dprintk("RPC: unregistered mechanism with oid:\n");
-	print_hexl((u32 *)gm->gm_oid.data, gm->gm_oid.len, 0);
-	if (!gss_mech_put(gm)) {
-		dprintk("RPC: We just unregistered a gss_mechanism which"
-				" someone is still using.\n");
-		return -1;
-	} else {
-		return 0;
+static int
+gss_mech_svc_setup(struct gss_api_mech *gm)
+{
+	struct pf_desc *pf;
+	int i, status;
+
+	for (i = 0; i < gm->gm_pf_num; i++) {
+		pf = &gm->gm_pfs[i];
+		pf->auth_domain_name = make_auth_domain_name(pf->name);
+		status = -ENOMEM;
+		if (pf->auth_domain_name == NULL)
+			goto out;
+		status = svcauth_gss_register_pseudoflavor(pf->pseudoflavor,
+							pf->auth_domain_name);
+		if (status)
+			goto out;
 	}
+	return 0;
+out:
+	gss_mech_free(gm);
+	return status;
 }
 
 int
-gss_mech_unregister(struct gss_api_mech *gm)
+gss_mech_register(struct gss_api_mech *gm)
 {
 	int status;
 
+	status = gss_mech_svc_setup(gm);
+	if (status)
+		return status;
 	spin_lock(&registered_mechs_lock);
-	status = do_gss_mech_unregister(gm);
+	list_add(&gm->gm_list, &registered_mechs);
 	spin_unlock(&registered_mechs_lock);
-	return status;
+	dprintk("RPC:      registered gss mechanism %s\n", gm->gm_name);
+	return 0;
 }
 
-int
-gss_mech_unregister_all(void)
-{
-	struct list_head	*pos;
-	struct gss_api_mech	*gm;
-	int			status = 0;
+EXPORT_SYMBOL(gss_mech_register);
 
+void
+gss_mech_unregister(struct gss_api_mech *gm)
+{
 	spin_lock(&registered_mechs_lock);
-	while (!list_empty(&registered_mechs)) {
-		pos = registered_mechs.next;
-		gm = list_entry(pos, struct gss_api_mech, gm_list);
-		if (do_gss_mech_unregister(gm))
-			status = -1;
-	}
+	list_del(&gm->gm_list);
 	spin_unlock(&registered_mechs_lock);
-	return status;
+	dprintk("RPC:      unregistered gss mechanism %s\n", gm->gm_name);
+	gss_mech_free(gm);
 }
 
+EXPORT_SYMBOL(gss_mech_unregister);
+
 struct gss_api_mech *
 gss_mech_get(struct gss_api_mech *gm)
 {
-	atomic_inc(&gm->gm_count);
+	__module_get(gm->gm_owner);
 	return gm;
 }
 
+EXPORT_SYMBOL(gss_mech_get);
+
 struct gss_api_mech *
-gss_mech_get_by_OID(struct xdr_netobj *mech_type)
+gss_mech_get_by_name(char *name)
 {
-	struct gss_api_mech 	*pos, *gm = NULL;
+	struct gss_api_mech	*pos, *gm = NULL;
 
-	dprintk("RPC: gss_mech_get_by_OID searching for mechanism with OID:\n");
-	print_hexl((u32 *)mech_type->data, mech_type->len, 0);
 	spin_lock(&registered_mechs_lock);
 	list_for_each_entry(pos, &registered_mechs, gm_list) {
-		if ((pos->gm_oid.len == mech_type->len)
-			&& !memcmp(pos->gm_oid.data, mech_type->data,
-							mech_type->len)) {
-			gm = gss_mech_get(pos);
+		if (0 == strcmp(name, pos->gm_name)) {
+			if (!try_module_get(pos->gm_owner))
+				continue;
+			gm = pos;
 			break;
 		}
 	}
 	spin_unlock(&registered_mechs_lock);
-	dprintk("RPC: gss_mech_get_by_OID %s it\n", gm ? "found" : "didn't find");
 	return gm;
+
+}
+
+EXPORT_SYMBOL(gss_mech_get_by_name);
+
+static inline int
+mech_supports_pseudoflavor(struct gss_api_mech *gm, u32 pseudoflavor)
+{
+	int i;
+
+	for (i = 0; i < gm->gm_pf_num; i++) {
+		if (gm->gm_pfs[i].pseudoflavor == pseudoflavor)
+			return 1;
+	}
+	return 0;
 }
 
 struct gss_api_mech *
-gss_mech_get_by_name(char *name)
+gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
 {
-	struct gss_api_mech	*pos, *gm = NULL;
+	struct gss_api_mech *pos, *gm = NULL;
 
 	spin_lock(&registered_mechs_lock);
 	list_for_each_entry(pos, &registered_mechs, gm_list) {
-		if (0 == strcmp(name, pos->gm_ops->name)) {
-			gm = gss_mech_get(pos);
-			break;
+		if (!try_module_get(pos->gm_owner))
+			continue;
+		if (!mech_supports_pseudoflavor(pos, pseudoflavor)) {
+			module_put(pos->gm_owner);
+			continue;
 		}
+		gm = pos;
+		break;
 	}
 	spin_unlock(&registered_mechs_lock);
 	return gm;
+}
+
+EXPORT_SYMBOL(gss_mech_get_by_pseudoflavor);
 
+u32
+gss_pseudoflavor_to_service(struct gss_api_mech *gm, u32 pseudoflavor)
+{
+	int i;
+
+	for (i = 0; i < gm->gm_pf_num; i++) {
+		if (gm->gm_pfs[i].pseudoflavor == pseudoflavor)
+			return gm->gm_pfs[i].service;
+	}
+	return 0;
 }
 
-int
-gss_mech_put(struct gss_api_mech * gm)
+EXPORT_SYMBOL(gss_pseudoflavor_to_service);
+
+char *
+gss_service_to_auth_domain_name(struct gss_api_mech *gm, u32 service)
 {
-	if (atomic_dec_and_test(&gm->gm_count)) {
-		if (gm->gm_oid.len >0)
-			kfree(gm->gm_oid.data);
-		kfree(gm);
-		return 1;
-	} else {
-		return 0;
+	int i;
+
+	for (i = 0; i < gm->gm_pf_num; i++) {
+		if (gm->gm_pfs[i].service == service)
+			return gm->gm_pfs[i].auth_domain_name;
 	}
+	return NULL;
 }
 
+EXPORT_SYMBOL(gss_service_to_auth_domain_name);
+
+void
+gss_mech_put(struct gss_api_mech * gm)
+{
+	module_put(gm->gm_owner);
+}
+
+EXPORT_SYMBOL(gss_mech_put);
+
 /* The mech could probably be determined from the token instead, but it's just
  * as easy for now to pass it in. */
 u32
@@ -244,7 +286,8 @@
 u32
 gss_delete_sec_context(struct gss_ctx	**context_handle)
 {
-	dprintk("gss_delete_sec_context deleting %p\n",*context_handle);
+	dprintk("RPC:      gss_delete_sec_context deleting %p\n",
+			*context_handle);
 
 	if (!*context_handle)
 		return(GSS_S_NO_CONTEXT);
diff -Nru a/net/sunrpc/auth_gss/gss_pseudoflavors.c b/net/sunrpc/auth_gss/gss_pseudoflavors.c
--- a/net/sunrpc/auth_gss/gss_pseudoflavors.c	Tue Jun 15 22:20:40 2004
+++ b/net/sunrpc/auth_gss/gss_pseudoflavors.c	Tue Jun 15 22:20:40 2004
@@ -82,12 +82,13 @@
 
 	spin_lock(&registered_triples_lock);
 	if (do_lookup_triple_by_pseudoflavor(pseudoflavor)) {
-		printk("Registered pseudoflavor %d again\n", pseudoflavor);
+		printk(KERN_WARNING "RPC: Registered pseudoflavor %d again\n",
+				pseudoflavor);
 		goto err_unlock;
 	}
 	list_add(&triple->triples, &registered_triples);
 	spin_unlock(&registered_triples_lock);
-	dprintk("RPC: registered pseudoflavor %d\n", pseudoflavor);
+	dprintk("RPC:      registered pseudoflavor %d\n", pseudoflavor);
 
 	return 0;
 
@@ -145,7 +146,7 @@
 	oid.len = oid_len;
 	oid.data = oid_data;
 
-	dprintk("RPC: gss_cmp_triples \n");
+	dprintk("RPC:      gss_cmp_triples\n");
 	print_sec_triple(&oid,qop,service);
 
 	spin_lock(&registered_triples_lock);
@@ -158,7 +159,7 @@
 		}
 	}
 	spin_unlock(&registered_triples_lock);
-	dprintk("RPC: gss_cmp_triples return %d\n", pseudoflavor);
+	dprintk("RPC:      gss_cmp_triples return %d\n", pseudoflavor);
 	return pseudoflavor;
 }
 
@@ -193,8 +194,8 @@
 	triple = do_lookup_triple_by_pseudoflavor(pseudoflavor);
 	spin_unlock(&registered_triples_lock);
 	if (!triple) {
-		dprintk("RPC: gss_pseudoflavor_to_service called with"
-			" unsupported pseudoflavor %d\n", pseudoflavor);
+		dprintk("RPC:      gss_pseudoflavor_to_service called with unsupported pseudoflavor %d\n",
+				pseudoflavor);
 		return 0;
 	}
 	return triple->service;
@@ -211,8 +212,8 @@
 	if (triple)
 		mech = gss_mech_get(triple->mech);
 	else
-		dprintk("RPC: gss_pseudoflavor_to_mech called with"
-			" unsupported pseudoflavor %d\n", pseudoflavor);
+		dprintk("RPC:      gss_pseudoflavor_to_mech called with unsupported pseudoflavor %d\n",
+				pseudoflavor);
 	return mech;
 }
 
@@ -223,8 +224,8 @@
 
 	mech = gss_pseudoflavor_to_mech(pseudoflavor);
 	if (!mech)  {
-		dprintk("RPC: gss_pseudoflavor_to_mechOID called with"
-			" unsupported pseudoflavor %d\n", pseudoflavor);
+		dprintk("RPC:      gss_pseudoflavor_to_mechOID called with unsupported pseudoflavor %d\n",
+				pseudoflavor);
 		        return -1;
 	}
 	oid->len = mech->gm_oid.len;
diff -Nru a/net/sunrpc/auth_gss/sunrpcgss_syms.c b/net/sunrpc/auth_gss/sunrpcgss_syms.c
--- a/net/sunrpc/auth_gss/sunrpcgss_syms.c	Tue Jun 15 22:20:42 2004
+++ b/net/sunrpc/auth_gss/sunrpcgss_syms.c	Tue Jun 15 22:20:42 2004
@@ -10,26 +10,28 @@
 #include <linux/sunrpc/auth_gss.h>
 #include <linux/sunrpc/svcauth_gss.h>
 #include <linux/sunrpc/gss_asn1.h>
+#include <linux/sunrpc/gss_krb5.h>
 
-/* sec_triples: */
-EXPORT_SYMBOL(gss_register_triple);
-EXPORT_SYMBOL(gss_unregister_triple);
-EXPORT_SYMBOL(gss_cmp_triples);
-EXPORT_SYMBOL(gss_pseudoflavor_to_mechOID);
-EXPORT_SYMBOL(gss_pseudoflavor_supported);
-EXPORT_SYMBOL(gss_pseudoflavor_to_service);
+/* svcauth_gss.c: */
 EXPORT_SYMBOL(svcauth_gss_register_pseudoflavor);
 
 /* registering gss mechanisms to the mech switching code: */
 EXPORT_SYMBOL(gss_mech_register);
+EXPORT_SYMBOL(gss_mech_unregister);
 EXPORT_SYMBOL(gss_mech_get);
-EXPORT_SYMBOL(gss_mech_get_by_OID);
+EXPORT_SYMBOL(gss_mech_get_by_pseudoflavor);
+EXPORT_SYMBOL(gss_mech_get_by_name);
 EXPORT_SYMBOL(gss_mech_put);
+EXPORT_SYMBOL(gss_pseudoflavor_to_service);
+EXPORT_SYMBOL(gss_service_to_auth_domain_name);
 
 /* generic functionality in gss code: */
 EXPORT_SYMBOL(g_make_token_header);
 EXPORT_SYMBOL(g_verify_token_header);
 EXPORT_SYMBOL(g_token_size);
+EXPORT_SYMBOL(make_checksum);
+EXPORT_SYMBOL(krb5_encrypt);
+EXPORT_SYMBOL(krb5_decrypt);
 
 /* debug */
 EXPORT_SYMBOL(print_hexl);
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	Tue Jun 15 22:20:40 2004
+++ b/net/sunrpc/auth_gss/svcauth_gss.c	Tue Jun 15 22:20:40 2004
@@ -333,6 +333,7 @@
 	new->handle.data = tmp->handle.data;
 	tmp->handle.data = NULL;
 	new->mechctx = NULL;
+	new->cred.cr_group_info = NULL;
 }
 
 static inline void
@@ -453,8 +454,11 @@
 	struct rsc rsci;
 	struct rsc *found;
 
-	rsci.handle = *handle;
+	memset(&rsci, 0, sizeof(rsci));
+	if (dup_to_netobj(&rsci.handle, handle->data, handle->len))
+		return NULL;
 	found = rsc_lookup(&rsci, 0);
+	rsc_free(&rsci);
 	if (!found)
 		return NULL;
 	if (cache_check(&rsc_cache, &found->h, NULL))
@@ -570,14 +574,14 @@
 	}
 
 	if (gc->gc_seq > MAXSEQ) {
-		dprintk("svcauth_gss: discarding request with large"
-			" sequence number %d\n", gc->gc_seq);
+		dprintk("RPC:      svcauth_gss: discarding request with large sequence number %d\n",
+				gc->gc_seq);
 		*authp = rpcsec_gsserr_ctxproblem;
 		return SVC_DENIED;
 	}
 	if (!gss_check_seq_num(rsci, gc->gc_seq)) {
-		dprintk("svcauth_gss: discarding request with old"
-				" sequence number %d\n", gc->gc_seq);
+		dprintk("RPC:      svcauth_gss: discarding request with old sequence number %d\n",
+				gc->gc_seq);
 		return SVC_DROP;
 	}
 	return SVC_OK;
@@ -617,19 +621,15 @@
 	u32			pseudoflavor;
 };
 
-/* XXX this should be done in gss_pseudoflavors, and shouldn't be hardcoded: */
 static struct auth_domain *
 find_gss_auth_domain(struct gss_ctx *ctx, u32 svc)
 {
-	switch(gss_get_pseudoflavor(ctx, 0, svc)) {
-		case RPC_AUTH_GSS_KRB5:
-			return auth_domain_find("gss/krb5");
-		case RPC_AUTH_GSS_KRB5I:
-			return auth_domain_find("gss/krb5i");
-		case RPC_AUTH_GSS_KRB5P:
-			return auth_domain_find("gss/krb5p");
-	}
-	return NULL;
+	char *name;
+
+	name = gss_service_to_auth_domain_name(ctx->mech_type, svc);
+	if (!name)
+		return NULL;
+	return auth_domain_find(name);
 }
 
 int
@@ -637,19 +637,17 @@
 {
 	struct gss_domain	*new;
 	struct auth_domain	*test;
-	static char		*prefix = "gss/";
-	int			stat = -1;
+	int			stat = -ENOMEM;
 
 	new = kmalloc(sizeof(*new), GFP_KERNEL);
 	if (!new)
 		goto out;
 	cache_init(&new->h.h);
 	atomic_inc(&new->h.h.refcnt);
-	new->h.name = kmalloc(strlen(name) + strlen(prefix) + 1, GFP_KERNEL);
+	new->h.name = kmalloc(strlen(name) + 1, GFP_KERNEL);
 	if (!new->h.name)
 		goto out_free_dom;
-	strcpy(new->h.name, prefix);
-	strcat(new->h.name, name);
+	strcpy(new->h.name, name);
 	new->h.flavour = RPC_AUTH_GSS;
 	new->pseudoflavor = pseudoflavor;
 	new->h.h.expiry_time = NEVER;
@@ -670,6 +668,8 @@
 	return stat;
 }
 
+EXPORT_SYMBOL(svcauth_gss_register_pseudoflavor);
+
 static inline int
 read_u32_from_xdr_buf(struct xdr_buf *buf, int base, u32 *obj)
 {
@@ -755,7 +755,7 @@
 	u32		*reject_stat = resv->iov_base + resv->iov_len;
 	int		ret;
 
-	dprintk("RPC: svcauth_gss: argv->iov_len = %zd\n",argv->iov_len);
+	dprintk("RPC:      svcauth_gss: argv->iov_len = %zd\n",argv->iov_len);
 
 	*authp = rpc_autherr_badcred;
 	if (!svcdata)
@@ -1049,6 +1049,7 @@
 
 struct auth_ops svcauthops_gss = {
 	.name		= "rpcsec_gss",
+	.owner		= THIS_MODULE,
 	.flavour	= RPC_AUTH_GSS,
 	.accept		= svcauth_gss_accept,
 	.release	= svcauth_gss_release,
@@ -1058,10 +1059,12 @@
 int
 gss_svc_init(void)
 {
-	cache_register(&rsc_cache);
-	cache_register(&rsi_cache);
-	svc_auth_register(RPC_AUTH_GSS, &svcauthops_gss);
-	return 0;
+	int rv = svc_auth_register(RPC_AUTH_GSS, &svcauthops_gss);
+	if (rv == 0) {
+		cache_register(&rsc_cache);
+		cache_register(&rsi_cache);
+	}
+	return rv;
 }
 
 void
@@ -1069,4 +1072,5 @@
 {
 	cache_unregister(&rsc_cache);
 	cache_unregister(&rsi_cache);
+	svc_auth_unregister(RPC_AUTH_GSS);
 }
diff -Nru a/net/sunrpc/cache.c b/net/sunrpc/cache.c
--- a/net/sunrpc/cache.c	Tue Jun 15 22:20:41 2004
+++ b/net/sunrpc/cache.c	Tue Jun 15 22:20:41 2004
@@ -214,6 +214,7 @@
 	cd->entries = 0;
 	atomic_set(&cd->readers, 0);
 	cd->last_close = 0;
+	cd->last_warn = -1;
 	list_add(&cd->others, &cache_list);
 	spin_unlock(&cache_list_lock);
 
@@ -574,7 +575,7 @@
 };
 
 static ssize_t
-cache_read(struct file *filp, char *buf, size_t count, loff_t *ppos)
+cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
 {
 	struct cache_reader *rp = filp->private_data;
 	struct cache_request *rq;
@@ -652,12 +653,13 @@
 	return err ? err :  count;
 }
 
+static char write_buf[8192]; /* protected by queue_io_sem */
+
 static ssize_t
-cache_write(struct file *filp, const char *buf, size_t count,
+cache_write(struct file *filp, const char __user *buf, size_t count,
 	    loff_t *ppos)
 {
 	int err;
-	char *page;
 	struct cache_detail *cd = PDE(filp->f_dentry->d_inode)->data;
 
 	if (ppos != &filp->f_pos)
@@ -665,31 +667,22 @@
 
 	if (count == 0)
 		return 0;
-	if (count > PAGE_SIZE)
+	if (count >= sizeof(write_buf))
 		return -EINVAL;
 
 	down(&queue_io_sem);
 
-	page = kmalloc(PAGE_SIZE, GFP_KERNEL);
-	if (page == NULL) {
-		up(&queue_io_sem);
-		return -ENOMEM;
-	}
-
-	if (copy_from_user(page, buf, count)) {
+	if (copy_from_user(write_buf, buf, count)) {
 		up(&queue_io_sem);
-		kfree(page);
 		return -EFAULT;
 	}
-	if (count < PAGE_SIZE)
-		page[count] = '\0';
+	write_buf[count] = '\0';
 	if (cd->cache_parse)
-		err = cd->cache_parse(cd, page, count);
+		err = cd->cache_parse(cd, write_buf, count);
 	else
 		err = -EINVAL;
 
 	up(&queue_io_sem);
-	kfree(page);
 	return err ? err : count;
 }
 
@@ -750,7 +743,7 @@
 		}
 	spin_unlock(&queue_lock);
 
-	return put_user(len, (int *)arg);
+	return put_user(len, (int __user *)arg);
 }
 
 static int
@@ -913,7 +906,14 @@
 	*lp = len;
 }
 
-			
+void warn_no_listener(struct cache_detail *detail)
+{
+	if (detail->last_warn != detail->last_close) {
+		detail->last_warn = detail->last_close;
+		if (detail->warn_no_listener)
+			detail->warn_no_listener(detail);
+	}
+}
 
 /*
  * register an upcall request to user-space.
@@ -931,9 +931,10 @@
 		return -EINVAL;
 
 	if (atomic_read(&detail->readers) == 0 &&
-	    detail->last_close < get_seconds() - 60)
-		/* nobody is listening */
-		return -EINVAL;
+	    detail->last_close < get_seconds() - 30) {
+			warn_no_listener(detail);
+			return -EINVAL;
+	}
 
 	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
 	if (!buf)
@@ -1165,7 +1166,7 @@
 	.release	= content_release,
 };
 
-static ssize_t read_flush(struct file *file, char *buf,
+static ssize_t read_flush(struct file *file, char __user *buf,
 			    size_t count, loff_t *ppos)
 {
 	struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data;
@@ -1186,7 +1187,7 @@
 	return len;
 }
 
-static ssize_t write_flush(struct file * file, const char * buf,
+static ssize_t write_flush(struct file * file, const char __user * buf,
 			     size_t count, loff_t *ppos)
 {
 	struct cache_detail *cd = PDE(file->f_dentry->d_inode)->data;
diff -Nru a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
--- a/net/sunrpc/clnt.c	Tue Jun 15 22:20:39 2004
+++ b/net/sunrpc/clnt.c	Tue Jun 15 22:20:39 2004
@@ -788,13 +788,11 @@
 call_timeout(struct rpc_task *task)
 {
 	struct rpc_clnt	*clnt = task->tk_client;
-	struct rpc_timeout *to = &task->tk_rqstp->rq_timeout;
 
-	if (xprt_adjust_timeout(to)) {
+	if (xprt_adjust_timeout(task->tk_rqstp) == 0) {
 		dprintk("RPC: %4d call_timeout (minor)\n", task->tk_pid);
 		goto retry;
 	}
-	to->to_retries = clnt->cl_timeout.to_retries;
 
 	dprintk("RPC: %4d call_timeout (major)\n", task->tk_pid);
 	if (RPC_IS_SOFT(task)) {
diff -Nru a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
--- a/net/sunrpc/rpc_pipe.c	Tue Jun 15 22:20:38 2004
+++ b/net/sunrpc/rpc_pipe.c	Tue Jun 15 22:20:38 2004
@@ -270,7 +270,7 @@
 			msg = (struct rpc_pipe_msg *)filp->private_data;
 			len += msg->len - msg->copied;
 		}
-		return put_user(len, (int *)arg);
+		return put_user(len, (int __user *)arg);
 	default:
 		return -EINVAL;
 	}
diff -Nru a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c
--- a/net/sunrpc/svcauth.c	Tue Jun 15 22:20:43 2004
+++ b/net/sunrpc/svcauth.c	Tue Jun 15 22:20:43 2004
@@ -11,6 +11,7 @@
 
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/module.h>
 #include <linux/sunrpc/types.h>
 #include <linux/sunrpc/xdr.h>
 #include <linux/sunrpc/svcsock.h>
@@ -27,6 +28,7 @@
 extern struct auth_ops svcauth_null;
 extern struct auth_ops svcauth_unix;
 
+static spinlock_t authtab_lock = SPIN_LOCK_UNLOCKED;
 static struct auth_ops	*authtab[RPC_AUTH_MAXFLAVOR] = {
 	[0] = &svcauth_null,
 	[1] = &svcauth_unix,
@@ -43,10 +45,15 @@
 	flavor = ntohl(svc_getu32(&rqstp->rq_arg.head[0]));
 
 	dprintk("svc: svc_authenticate (%d)\n", flavor);
-	if (flavor >= RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor])) {
+
+	spin_lock(&authtab_lock);
+	if (flavor >= RPC_AUTH_MAXFLAVOR || !(aops = authtab[flavor])
+			|| !try_module_get(aops->owner)) {
+		spin_unlock(&authtab_lock);
 		*authp = rpc_autherr_badcred;
 		return SVC_DENIED;
 	}
+	spin_unlock(&authtab_lock);
 
 	rqstp->rq_authop = aops;
 	return aops->accept(rqstp, authp);
@@ -63,28 +70,35 @@
 
 	rqstp->rq_authop = NULL;
 	
-	if (aops) 
+	if (aops) {
 		rv = aops->release(rqstp);
-
-	/* FIXME should I count and release authops */
+		module_put(aops->owner);
+	}
 	return rv;
 }
 
 int
 svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops)
 {
-	if (flavor >= RPC_AUTH_MAXFLAVOR || authtab[flavor])
-		return -EINVAL;
-	authtab[flavor] = aops;
-	return 0;
+	int rv = -EINVAL;
+	spin_lock(&authtab_lock);
+	if (flavor < RPC_AUTH_MAXFLAVOR && authtab[flavor] == NULL) {
+		authtab[flavor] = aops;
+		rv = 0;
+	}
+	spin_unlock(&authtab_lock);
+	return rv;
 }
 
 void
 svc_auth_unregister(rpc_authflavor_t flavor)
 {
+	spin_lock(&authtab_lock);
 	if (flavor < RPC_AUTH_MAXFLAVOR)
 		authtab[flavor] = NULL;
+	spin_unlock(&authtab_lock);
 }
+EXPORT_SYMBOL(svc_auth_unregister);
 
 /**************************************************
  * cache for domain name to auth_domain
diff -Nru a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
--- a/net/sunrpc/svcauth_unix.c	Tue Jun 15 22:20:42 2004
+++ b/net/sunrpc/svcauth_unix.c	Tue Jun 15 22:20:42 2004
@@ -1,5 +1,6 @@
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/module.h>
 #include <linux/sunrpc/types.h>
 #include <linux/sunrpc/xdr.h>
 #include <linux/sunrpc/svcsock.h>
@@ -411,6 +412,7 @@
 
 struct auth_ops svcauth_null = {
 	.name		= "null",
+	.owner		= THIS_MODULE,
 	.flavour	= RPC_AUTH_NULL,
 	.accept 	= svcauth_null_accept,
 	.release	= svcauth_null_release,
@@ -515,6 +517,7 @@
 
 struct auth_ops svcauth_unix = {
 	.name		= "unix",
+	.owner		= THIS_MODULE,
 	.flavour	= RPC_AUTH_UNIX,
 	.accept 	= svcauth_unix_accept,
 	.release	= svcauth_unix_release,
diff -Nru a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
--- a/net/sunrpc/svcsock.c	Tue Jun 15 22:20:37 2004
+++ b/net/sunrpc/svcsock.c	Tue Jun 15 22:20:37 2004
@@ -1255,6 +1255,7 @@
 
 	/* No data, incomplete (TCP) read, or accept() */
 	if (len == 0 || len == -EAGAIN) {
+		rqstp->rq_res.len = 0;
 		svc_sock_release(rqstp);
 		return -EAGAIN;
 	}
@@ -1511,9 +1512,9 @@
 	dprintk("revisit queued\n");
 	svsk = dr->svsk;
 	dr->svsk = NULL;
-	spin_lock(&serv->sv_lock);
+	spin_lock_bh(&serv->sv_lock);
 	list_add(&dr->handle.recent, &svsk->sk_deferred);
-	spin_unlock(&serv->sv_lock);
+	spin_unlock_bh(&serv->sv_lock);
 	set_bit(SK_DEFERRED, &svsk->sk_flags);
 	svc_sock_enqueue(svsk);
 	svc_sock_put(svsk);
@@ -1544,10 +1545,10 @@
 		dr->argslen = rqstp->rq_arg.len >> 2;
 		memcpy(dr->args, rqstp->rq_arg.head[0].iov_base-skip, dr->argslen<<2);
 	}
-	spin_lock(&rqstp->rq_server->sv_lock);
+	spin_lock_bh(&rqstp->rq_server->sv_lock);
 	rqstp->rq_sock->sk_inuse++;
 	dr->svsk = rqstp->rq_sock;
-	spin_unlock(&rqstp->rq_server->sv_lock);
+	spin_unlock_bh(&rqstp->rq_server->sv_lock);
 
 	dr->handle.revisit = svc_revisit;
 	return &dr->handle;
@@ -1577,7 +1578,7 @@
 	
 	if (!test_bit(SK_DEFERRED, &svsk->sk_flags))
 		return NULL;
-	spin_lock(&serv->sv_lock);
+	spin_lock_bh(&serv->sv_lock);
 	clear_bit(SK_DEFERRED, &svsk->sk_flags);
 	if (!list_empty(&svsk->sk_deferred)) {
 		dr = list_entry(svsk->sk_deferred.next,
@@ -1586,6 +1587,6 @@
 		list_del_init(&dr->handle.recent);
 		set_bit(SK_DEFERRED, &svsk->sk_flags);
 	}
-	spin_unlock(&serv->sv_lock);
+	spin_unlock_bh(&serv->sv_lock);
 	return dr;
 }
diff -Nru a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
--- a/net/sunrpc/sysctl.c	Tue Jun 15 22:20:36 2004
+++ b/net/sunrpc/sysctl.c	Tue Jun 15 22:20:36 2004
@@ -58,9 +58,10 @@
 
 static int
 proc_dodebug(ctl_table *table, int write, struct file *file,
-				void *buffer, size_t *lenp)
+				void __user *buffer, size_t *lenp)
 {
-	char		tmpbuf[20], *p, c;
+	char		tmpbuf[20], c, *s;
+	char __user *p;
 	unsigned int	value;
 	size_t		left, len;
 
@@ -74,7 +75,7 @@
 	if (write) {
 		if (!access_ok(VERIFY_READ, buffer, left))
 			return -EFAULT;
-		p = (char *) buffer;
+		p = buffer;
 		while (left && __get_user(c, p) >= 0 && isspace(c))
 			left--, p++;
 		if (!left)
@@ -86,12 +87,12 @@
 			return -EFAULT;
 		tmpbuf[left] = '\0';
 
-		for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
-			value = 10 * value + (*p - '0');
-		if (*p && !isspace(*p))
+		for (s = tmpbuf, value = 0; '0' <= *s && *s <= '9'; s++, left--)
+			value = 10 * value + (*s - '0');
+		if (*s && !isspace(*s))
 			return -EINVAL;
-		while (left && isspace(*p))
-			left--, p++;
+		while (left && isspace(*s))
+			left--, s++;
 		*(unsigned int *) table->data = value;
 		/* Display the RPC tasks on writing to rpc_debug */
 		if (table->ctl_name == CTL_RPCDEBUG) {
@@ -106,7 +107,7 @@
 		if (__copy_to_user(buffer, tmpbuf, len))
 			return -EFAULT;
 		if ((left -= len) > 0) {
-			if (put_user('\n', (char *)buffer + len))
+			if (put_user('\n', (char __user *)buffer + len))
 				return -EFAULT;
 			left--;
 		}
diff -Nru a/net/sunrpc/timer.c b/net/sunrpc/timer.c
--- a/net/sunrpc/timer.c	Tue Jun 15 22:20:44 2004
+++ b/net/sunrpc/timer.c	Tue Jun 15 22:20:44 2004
@@ -39,6 +39,7 @@
 	for (i = 0; i < 5; i++) {
 		rt->srtt[i] = init;
 		rt->sdrtt[i] = RPC_RTO_INIT;
+		rt->ntimeouts[i] = 0;
 	}
 }
 
diff -Nru a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
--- a/net/sunrpc/xprt.c	Tue Jun 15 22:20:42 2004
+++ b/net/sunrpc/xprt.c	Tue Jun 15 22:20:42 2004
@@ -352,35 +352,57 @@
 }
 
 /*
+ * Reset the major timeout value
+ */
+static void xprt_reset_majortimeo(struct rpc_rqst *req)
+{
+	struct rpc_timeout *to = &req->rq_xprt->timeout;
+
+	req->rq_majortimeo = req->rq_timeout;
+	if (to->to_exponential)
+		req->rq_majortimeo <<= to->to_retries;
+	else
+		req->rq_majortimeo += to->to_increment * to->to_retries;
+	if (req->rq_majortimeo > to->to_maxval || req->rq_majortimeo == 0)
+		req->rq_majortimeo = to->to_maxval;
+	req->rq_majortimeo += jiffies;
+}
+
+/*
  * Adjust timeout values etc for next retransmit
  */
-int
-xprt_adjust_timeout(struct rpc_timeout *to)
+int xprt_adjust_timeout(struct rpc_rqst *req)
 {
-	if (to->to_retries > 0) {
+	struct rpc_xprt *xprt = req->rq_xprt;
+	struct rpc_timeout *to = &xprt->timeout;
+	int status = 0;
+
+	if (time_before(jiffies, req->rq_majortimeo)) {
 		if (to->to_exponential)
-			to->to_current <<= 1;
+			req->rq_timeout <<= 1;
 		else
-			to->to_current += to->to_increment;
-		if (to->to_maxval && to->to_current >= to->to_maxval)
-			to->to_current = to->to_maxval;
+			req->rq_timeout += to->to_increment;
+		if (to->to_maxval && req->rq_timeout >= to->to_maxval)
+			req->rq_timeout = to->to_maxval;
+		req->rq_retries++;
+		pprintk("RPC: %lu retrans\n", jiffies);
 	} else {
-		if (to->to_exponential)
-			to->to_initval <<= 1;
-		else
-			to->to_initval += to->to_increment;
-		if (to->to_maxval && to->to_initval >= to->to_maxval)
-			to->to_initval = to->to_maxval;
-		to->to_current = to->to_initval;
+		req->rq_timeout = to->to_initval;
+		req->rq_retries = 0;
+		xprt_reset_majortimeo(req);
+		/* Reset the RTT counters == "slow start" */
+		spin_lock_bh(&xprt->sock_lock);
+		rpc_init_rtt(req->rq_task->tk_client->cl_rtt, to->to_initval);
+		spin_unlock_bh(&xprt->sock_lock);
+		pprintk("RPC: %lu timeout\n", jiffies);
+		status = -ETIMEDOUT;
 	}
 
-	if (!to->to_current) {
-		printk(KERN_WARNING "xprt_adjust_timeout: to_current = 0!\n");
-		to->to_current = 5 * HZ;
-	}
-	pprintk("RPC: %lu %s\n", jiffies,
-			to->to_retries? "retrans" : "timeout");
-	return to->to_retries-- > 0;
+	if (req->rq_timeout == 0) {
+		printk(KERN_WARNING "xprt_adjust_timeout: rq_timeout = 0!\n");
+		req->rq_timeout = 5 * HZ;
+	}
+	return status;
 }
 
 /*
@@ -537,8 +559,17 @@
 
 	task->tk_timeout = RPC_CONNECT_TIMEOUT;
 	rpc_sleep_on(&xprt->pending, task, xprt_connect_status, NULL);
-	if (!test_and_set_bit(XPRT_CONNECTING, &xprt->sockstate))
-		schedule_work(&xprt->sock_connect);
+	if (!test_and_set_bit(XPRT_CONNECTING, &xprt->sockstate)) {
+		/* Note: if we are here due to a dropped connection
+		 * 	 we delay reconnecting by RPC_REESTABLISH_TIMEOUT/HZ
+		 * 	 seconds
+		 */
+		if (xprt->sock != NULL)
+			schedule_delayed_work(&xprt->sock_connect,
+					RPC_REESTABLISH_TIMEOUT);
+		else
+			schedule_work(&xprt->sock_connect);
+	}
 	return;
  out_write:
 	xprt_release_write(xprt, task);
@@ -566,7 +597,6 @@
 	case -ECONNREFUSED:
 	case -ECONNRESET:
 	case -ENOTCONN:
-		rpc_delay(task, RPC_REESTABLISH_TIMEOUT);
 		return;
 	case -ETIMEDOUT:
 		dprintk("RPC: %4d xprt_connect_status: timed out\n",
@@ -1166,6 +1196,7 @@
 			/* Add request to the receive list */
 			list_add_tail(&req->rq_list, &xprt->recv);
 			spin_unlock_bh(&xprt->sock_lock);
+			xprt_reset_majortimeo(req);
 		}
 	} else if (!req->rq_bytes_sent)
 		return;
@@ -1221,7 +1252,7 @@
 			if (!xprt_connected(xprt))
 				task->tk_status = -ENOTCONN;
 			else if (test_bit(SOCK_NOSPACE, &xprt->sock->flags)) {
-				task->tk_timeout = req->rq_timeout.to_current;
+				task->tk_timeout = req->rq_timeout;
 				rpc_sleep_on(&xprt->pending, task, NULL, NULL);
 			}
 			spin_unlock_bh(&xprt->sock_lock);
@@ -1248,13 +1279,11 @@
 	if (!xprt->nocong) {
 		int timer = task->tk_msg.rpc_proc->p_timer;
 		task->tk_timeout = rpc_calc_rto(clnt->cl_rtt, timer);
-		task->tk_timeout <<= rpc_ntimeo(clnt->cl_rtt, timer);
-		task->tk_timeout <<= clnt->cl_timeout.to_retries
-			- req->rq_timeout.to_retries;
-		if (task->tk_timeout > req->rq_timeout.to_maxval)
-			task->tk_timeout = req->rq_timeout.to_maxval;
+		task->tk_timeout <<= rpc_ntimeo(clnt->cl_rtt, timer) + req->rq_retries;
+		if (task->tk_timeout > xprt->timeout.to_maxval || task->tk_timeout == 0)
+			task->tk_timeout = xprt->timeout.to_maxval;
 	} else
-		task->tk_timeout = req->rq_timeout.to_current;
+		task->tk_timeout = req->rq_timeout;
 	/* Don't race with disconnect */
 	if (!xprt_connected(xprt))
 		task->tk_status = -ENOTCONN;
@@ -1324,7 +1353,7 @@
 {
 	struct rpc_rqst	*req = task->tk_rqstp;
 
-	req->rq_timeout = xprt->timeout;
+	req->rq_timeout = xprt->timeout.to_initval;
 	req->rq_task	= task;
 	req->rq_xprt    = xprt;
 	req->rq_xid     = xprt_alloc_xid(xprt);
@@ -1381,7 +1410,6 @@
 void
 xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr)
 {
-	to->to_current   = 
 	to->to_initval   = 
 	to->to_increment = incr;
 	to->to_maxval    = incr * retr;
@@ -1446,7 +1474,6 @@
 	/* Set timeout parameters */
 	if (to) {
 		xprt->timeout = *to;
-		xprt->timeout.to_current = to->to_initval;
 	} else
 		xprt_default_timeout(&xprt->timeout, xprt->prot);
 
diff -Nru a/net/unix/af_unix.c b/net/unix/af_unix.c
--- a/net/unix/af_unix.c	Tue Jun 15 22:20:42 2004
+++ b/net/unix/af_unix.c	Tue Jun 15 22:20:42 2004
@@ -1829,7 +1829,7 @@
 	{
 		case SIOCOUTQ:
 			amount = atomic_read(&sk->sk_wmem_alloc);
-			err = put_user(amount, (int *)arg);
+			err = put_user(amount, (int __user *)arg);
 			break;
 		case SIOCINQ:
 		{
@@ -1844,12 +1844,12 @@
 			if (skb)
 				amount=skb->len;
 			spin_unlock(&sk->sk_receive_queue.lock);
-			err = put_user(amount, (int *)arg);
+			err = put_user(amount, (int __user *)arg);
 			break;
 		}
 
 		default:
-			err = dev_ioctl(cmd, (void *)arg);
+			err = dev_ioctl(cmd, (void __user *)arg);
 			break;
 	}
 	return err;
diff -Nru a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c
--- a/net/wanrouter/af_wanpipe.c	Tue Jun 15 22:21:04 2004
+++ b/net/wanrouter/af_wanpipe.c	Tue Jun 15 22:21:04 2004
@@ -552,7 +552,7 @@
 	if (sk->sk_state != WANSOCK_CONNECTED)
 		return -ENOTCONN;	
 
-	if (msg->msg_flags&~MSG_DONTWAIT) 
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) 
 		return(-EINVAL);
 
 	/* it was <=, now one can send
@@ -1765,7 +1765,7 @@
 	switch(cmd) 
 	{
 		case SIOCGSTAMP:
-			return sock_get_timestamp(sk, (struct timeval *)arg);
+			return sock_get_timestamp(sk, (struct timeval __user *)arg);
 
 		case SIOC_WANPIPE_CHECK_TX:
 
@@ -1832,7 +1832,7 @@
 #endif
 
 		default:
-			return dev_ioctl(cmd,(void *) arg);
+			return dev_ioctl(cmd,(void __user *) arg);
 	}
 	/*NOTREACHED*/
 }
diff -Nru a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
--- a/net/wanrouter/wanmain.c	Tue Jun 15 22:20:42 2004
+++ b/net/wanrouter/wanmain.c	Tue Jun 15 22:20:42 2004
@@ -128,13 +128,14 @@
  */
 
 static int wanrouter_device_setup(struct wan_device *wandev,
-				  wandev_conf_t *u_conf);
+				  wandev_conf_t __user *u_conf);
 static int wanrouter_device_stat(struct wan_device *wandev,
-				 wandev_stat_t *u_stat);
+				 wandev_stat_t __user *u_stat);
 static int wanrouter_device_shutdown(struct wan_device *wandev);
 static int wanrouter_device_new_if(struct wan_device *wandev,
-				   wanif_conf_t *u_conf);
-static int wanrouter_device_del_if(struct wan_device *wandev, char *u_name);
+				   wanif_conf_t __user *u_conf);
+static int wanrouter_device_del_if(struct wan_device *wandev,
+				   char __user *u_name);
 
 /*
  *	Miscellaneous
@@ -410,6 +411,7 @@
 	int err = 0;
 	struct proc_dir_entry *dent;
 	struct wan_device *wandev;
+	void __user *data = (void __user *)arg;
 
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
@@ -427,7 +429,7 @@
 
 	switch (cmd) {
 	case ROUTER_SETUP:
-		err = wanrouter_device_setup(wandev, (void*)arg);
+		err = wanrouter_device_setup(wandev, data);
 		break;
 
 	case ROUTER_DOWN:
@@ -435,15 +437,15 @@
 		break;
 
 	case ROUTER_STAT:
-		err = wanrouter_device_stat(wandev, (void*)arg);
+		err = wanrouter_device_stat(wandev, data);
 		break;
 
 	case ROUTER_IFNEW:
-		err = wanrouter_device_new_if(wandev, (void*)arg);
+		err = wanrouter_device_new_if(wandev, data);
 		break;
 
 	case ROUTER_IFDEL:
-		err = wanrouter_device_del_if(wandev, (void*)arg);
+		err = wanrouter_device_del_if(wandev, data);
 		break;
 
 	case ROUTER_IFSTAT:
@@ -472,7 +474,7 @@
  */
 
 static int wanrouter_device_setup(struct wan_device *wandev,
-				  wandev_conf_t *u_conf)
+				  wandev_conf_t __user *u_conf)
 {
 	void *data = NULL;
 	wandev_conf_t *conf;
@@ -583,7 +585,7 @@
  */
 
 static int wanrouter_device_stat(struct wan_device *wandev,
-				 wandev_stat_t *u_stat)
+				 wandev_stat_t __user *u_stat)
 {
 	wandev_stat_t stat;
 
@@ -614,7 +616,7 @@
  */
 
 static int wanrouter_device_new_if(struct wan_device *wandev,
-				   wanif_conf_t *u_conf)
+				   wanif_conf_t __user *u_conf)
 {
 	wanif_conf_t *cnf;
 	struct net_device *dev = NULL;
@@ -740,7 +742,7 @@
  *	 o copy configuration data to kernel address space
  */
 
-static int wanrouter_device_del_if(struct wan_device *wandev, char *u_name)
+static int wanrouter_device_del_if(struct wan_device *wandev, char __user *u_name)
 {
 	char name[WAN_IFNAME_SZ + 1];
         int err = 0;
diff -Nru a/net/x25/af_x25.c b/net/x25/af_x25.c
--- a/net/x25/af_x25.c	Tue Jun 15 22:21:03 2004
+++ b/net/x25/af_x25.c	Tue Jun 15 22:21:03 2004
@@ -363,7 +363,7 @@
  */
 
 static int x25_setsockopt(struct socket *sock, int level, int optname,
-			  char *optval, int optlen)
+			  char __user *optval, int optlen)
 {
 	int opt;
 	struct sock *sk = sock->sk;
@@ -377,7 +377,7 @@
 		goto out;
 
 	rc = -EFAULT;
-	if (get_user(opt, (int *)optval))
+	if (get_user(opt, (int __user *)optval))
 		goto out;
 
 	x25_sk(sk)->qbitincl = !!opt;
@@ -387,7 +387,7 @@
 }
 
 static int x25_getsockopt(struct socket *sock, int level, int optname,
-			  char *optval, int *optlen)
+			  char __user *optval, int __user *optlen)
 {
 	struct sock *sk = sock->sk;
 	int val, len, rc = -ENOPROTOOPT;
@@ -922,7 +922,7 @@
 	size_t size;
 	int qbit = 0, rc = -EINVAL;
 
-	if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_OOB | MSG_EOR))
+	if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_OOB|MSG_EOR|MSG_CMSG_COMPAT))
 		goto out;
 
 	/* we currently don't support segmented records at the user interface */
@@ -1180,6 +1180,7 @@
 {
 	struct sock *sk = sock->sk;
 	struct x25_opt *x25 = x25_sk(sk);
+	void __user *argp = (void __user *)arg;
 	int rc;
 
 	switch (cmd) {
@@ -1188,7 +1189,7 @@
 				     atomic_read(&sk->sk_wmem_alloc);
 			if (amount < 0)
 				amount = 0;
-			rc = put_user(amount, (unsigned int *)arg);
+			rc = put_user(amount, (unsigned int __user *)argp);
 			break;
 		}
 
@@ -1201,7 +1202,7 @@
 			 */
 			if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
 				amount = skb->len;
-			rc = put_user(amount, (unsigned int *)arg);
+			rc = put_user(amount, (unsigned int __user *)argp);
 			break;
 		}
 
@@ -1209,7 +1210,7 @@
 			rc = -EINVAL;
 			if (sk)
 				rc = sock_get_timestamp(sk, 
-						(struct timeval *)arg); 
+						(struct timeval __user *)argp); 
 			break;
 		case SIOCGIFADDR:
 		case SIOCSIFADDR:
@@ -1228,20 +1229,20 @@
 			rc = -EPERM;
 			if (!capable(CAP_NET_ADMIN))
 				break;
-			rc = x25_route_ioctl(cmd, (void *)arg);
+			rc = x25_route_ioctl(cmd, argp);
 			break;
 		case SIOCX25GSUBSCRIP:
-			rc = x25_subscr_ioctl(cmd, (void *)arg);
+			rc = x25_subscr_ioctl(cmd, argp);
 			break;
 		case SIOCX25SSUBSCRIP:
 			rc = -EPERM;
 			if (!capable(CAP_NET_ADMIN))
 				break;
-			rc = x25_subscr_ioctl(cmd, (void *)arg);
+			rc = x25_subscr_ioctl(cmd, argp);
 			break;
 		case SIOCX25GFACILITIES: {
 			struct x25_facilities fac = x25->facilities;
-			rc = copy_to_user((void *)arg, &fac,
+			rc = copy_to_user(argp, &fac,
 					  sizeof(fac)) ? -EFAULT : 0;
 			break;
 		}
@@ -1249,7 +1250,7 @@
 		case SIOCX25SFACILITIES: {
 			struct x25_facilities facilities;
 			rc = -EFAULT;
-			if (copy_from_user(&facilities, (void *)arg,
+			if (copy_from_user(&facilities, argp,
 					   sizeof(facilities)))
 				break;
 			rc = -EINVAL;
@@ -1277,7 +1278,7 @@
 
 		case SIOCX25GCALLUSERDATA: {
 			struct x25_calluserdata cud = x25->calluserdata;
-			rc = copy_to_user((void *)arg, &cud,
+			rc = copy_to_user(argp, &cud,
 					  sizeof(cud)) ? -EFAULT : 0;
 			break;
 		}
@@ -1286,7 +1287,7 @@
 			struct x25_calluserdata calluserdata;
 
 			rc = -EFAULT;
-			if (copy_from_user(&calluserdata, (void *)arg,
+			if (copy_from_user(&calluserdata, argp,
 					   sizeof(calluserdata)))
 				break;
 			rc = -EINVAL;
@@ -1300,13 +1301,13 @@
 		case SIOCX25GCAUSEDIAG: {
 			struct x25_causediag causediag;
 			causediag = x25->causediag;
-			rc = copy_to_user((void *)arg, &causediag,
+			rc = copy_to_user(argp, &causediag,
 					  sizeof(causediag)) ? -EFAULT : 0;
 			break;
 		}
 
  		default:
-			rc = dev_ioctl(cmd, (void *)arg);
+			rc = dev_ioctl(cmd, argp);
 			break;
 	}
 
diff -Nru a/net/x25/x25_link.c b/net/x25/x25_link.c
--- a/net/x25/x25_link.c	Tue Jun 15 22:20:36 2004
+++ b/net/x25/x25_link.c	Tue Jun 15 22:20:36 2004
@@ -374,7 +374,7 @@
 /*
  *	Handle the ioctls that control the subscription functions.
  */
-int x25_subscr_ioctl(unsigned int cmd, void *arg)
+int x25_subscr_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct x25_subscrip_struct x25_subscr;
 	struct x25_neigh *nb;
diff -Nru a/net/x25/x25_route.c b/net/x25/x25_route.c
--- a/net/x25/x25_route.c	Tue Jun 15 22:20:42 2004
+++ b/net/x25/x25_route.c	Tue Jun 15 22:20:42 2004
@@ -174,7 +174,7 @@
 /*
  *	Handle the ioctls that control the routing functions.
  */
-int x25_route_ioctl(unsigned int cmd, void *arg)
+int x25_route_ioctl(unsigned int cmd, void __user *arg)
 {
 	struct x25_route_struct rt;
 	struct net_device *dev;
diff -Nru a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
--- a/net/xfrm/xfrm_policy.c	Tue Jun 15 22:20:40 2004
+++ b/net/xfrm/xfrm_policy.c	Tue Jun 15 22:20:40 2004
@@ -148,6 +148,8 @@
 	int warn = 0;
 	int dir;
 
+	read_lock(&xp->lock);
+
 	if (xp->dead)
 		goto out;
 
@@ -197,6 +199,7 @@
 		xfrm_pol_hold(xp);
 
 out:
+	read_unlock(&xp->lock);
 	xfrm_pol_put(xp);
 	return;
 
@@ -1014,6 +1017,8 @@
 
 static void xfrm_dst_destroy(struct dst_entry *dst)
 {
+	if (!dst->xfrm)
+		return;
 	xfrm_state_put(dst->xfrm);
 	dst->xfrm = NULL;
 }
diff -Nru a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
--- a/net/xfrm/xfrm_state.c	Tue Jun 15 22:20:43 2004
+++ b/net/xfrm/xfrm_state.c	Tue Jun 15 22:20:43 2004
@@ -221,13 +221,9 @@
 		if (atomic_read(&x->refcnt) > 2)
 			xfrm_flush_bundles();
 
-		/* All xfrm_state objects are created by one of two possible
-		 * paths:
-		 *
-		 * 2) xfrm_state_lookup --> xfrm_state_insert
-		 *
-		 * The xfrm_state_lookup or xfrm_state_alloc call gives a
-		 * reference, and that is what we are dropping here.
+		/* All xfrm_state objects are created by xfrm_state_alloc.
+		 * The xfrm_state_alloc call gives a reference, and that
+		 * is what we are dropping here.
 		 */
 		atomic_dec(&x->refcnt);
 	}
@@ -235,7 +231,6 @@
 
 void xfrm_state_delete(struct xfrm_state *x)
 {
-	xfrm_state_delete_tunnel(x);
 	spin_lock_bh(&x->lock);
 	__xfrm_state_delete(x);
 	spin_unlock_bh(&x->lock);
@@ -331,14 +326,8 @@
 		}
 	}
 
-	if (best) {
-		xfrm_state_hold(best);
-		spin_unlock_bh(&xfrm_state_lock);
-		return best;
-	}
-
-	x = NULL;
-	if (!error && !acquire_in_progress &&
+	x = best;
+	if (!x && !error && !acquire_in_progress &&
 	    ((x = xfrm_state_alloc()) != NULL)) {
 		/* Initialize temporary selector matching only
 		 * to current session. */
@@ -355,7 +344,8 @@
 			}
 			x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES;
 			xfrm_state_hold(x);
-			mod_timer(&x->timer, XFRM_ACQ_EXPIRES*HZ);
+			x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ;
+			add_timer(&x->timer);
 		} else {
 			x->km.state = XFRM_STATE_DEAD;
 			xfrm_state_put(x);
@@ -363,10 +353,12 @@
 			error = 1;
 		}
 	}
-	spin_unlock_bh(&xfrm_state_lock);
-	if (!x)
+	if (x)
+		xfrm_state_hold(x);
+	else
 		*err = acquire_in_progress ? -EAGAIN :
 			(error ? -ESRCH : -ENOMEM);
+	spin_unlock_bh(&xfrm_state_lock);
 	return x;
 }
 
@@ -489,15 +481,16 @@
 			memcpy(x1->encap, x->encap, sizeof(*x1->encap));
 		memcpy(&x1->lft, &x->lft, sizeof(x1->lft));
 		x1->km.dying = 0;
+
+		if (!mod_timer(&x1->timer, jiffies + HZ))
+			xfrm_state_hold(x1);
+		if (x1->curlft.use_time)
+			xfrm_state_check_expire(x1);
+
 		err = 0;
 	}
 	spin_unlock_bh(&x1->lock);
 
-	if (!mod_timer(&x1->timer, jiffies + HZ))
-		xfrm_state_hold(x1);
-	if (x1->curlft.use_time)
-		xfrm_state_check_expire(x1);
-
 	xfrm_state_put(x1);
 
 	return err;
@@ -801,7 +794,7 @@
 		wake_up(&km_waitq);
 }
 
-int xfrm_user_policy(struct sock *sk, int optname, u8 *optval, int optlen)
+int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen)
 {
 	int err;
 	u8 *data;
diff -Nru a/scripts/checkstack.pl b/scripts/checkstack.pl
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/scripts/checkstack.pl	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,108 @@
+#!/usr/bin/perl
+
+#	Check the stack usage of functions
+#
+#	Copyright Joern Engel <joern@wh.fh-wedel.de>
+#	Inspired by Linus Torvalds
+#	Original idea maybe from Keith Owens
+#	s390 port and big speedup by Arnd Bergmann <arnd@bergmann-dalldorf.de>
+#	Mips port by Juan Quintela <quintela@mandrakesoft.com>
+#	IA64 port via Andreas Dilger
+#	Arm port by Holger Schurig
+#	Random bits by Matt Mackall <mpm@selenic.com>
+#
+#	Usage:
+#	objdump -d vmlinux | stackcheck_ppc.pl [arch]
+#
+#	TODO :	Port to all architectures (one regex per arch)
+
+# check for arch
+#
+# $re is used for two matches:
+# $& (whole re) matches the complete objdump line with the stack growth
+# $1 (first bracket) matches the size of the stack growth
+#
+# use anything else and feel the pain ;)
+{
+	my $arch = shift;
+	if ($arch eq "") {
+		$arch = `uname -m`;
+	}
+
+	$x	= "[0-9a-f]";	# hex character
+	$xs	= "[0-9a-f ]";	# hex character or space
+	if ($arch =~ /^arm$/) {
+		#c0008ffc:	e24dd064	sub	sp, sp, #100	; 0x64
+		$re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o;
+	} elsif ($arch =~ /^i[3456]86$/) {
+		#c0105234:       81 ec ac 05 00 00       sub    $0x5ac,%esp
+		$re = qr/^.*[as][du][db]    \$(0x$x{1,8}),\%esp$/o;
+	} elsif ($arch =~ /^ia64$/) {
+		#e0000000044011fc:       01 0f fc 8c     adds r12=-384,r12
+		$re = qr/.*adds.*r12=-(([0-9]{2}|[3-9])[0-9]{2}),r12/o;
+	} elsif ($arch =~ /^mips64$/) {
+		#8800402c:       67bdfff0        daddiu  sp,sp,-16
+		$re = qr/.*daddiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
+	} elsif ($arch =~ /^mips$/) {
+		#88003254:       27bdffe0        addiu   sp,sp,-32
+		$re = qr/.*addiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o;
+	} elsif ($arch =~ /^ppc$/) {
+		#c00029f4:       94 21 ff 30     stwu    r1,-208(r1)
+		$re = qr/.*stwu.*r1,-($x{1,8})\(r1\)/o;
+	} elsif ($arch =~ /^ppc64$/) {
+		#XXX
+		$re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o;
+	} elsif ($arch =~ /^s390x?$/) {
+		#   11160:       a7 fb ff 60             aghi   %r15,-160
+		$re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o;
+	} else {
+		print("wrong or unknown architecture\n");
+		exit
+	}
+}
+
+sub bysize($) {
+	($asize = $a) =~ s/.*	+(.*)$/$1/;
+	($bsize = $b) =~ s/.*	+(.*)$/$1/;
+	$bsize <=> $asize
+}
+
+#
+# main()
+#
+$funcre = qr/^$x* \<(.*)\>:$/;
+while ($line = <STDIN>) {
+	if ($line =~ m/$funcre/) {
+		$func = $1;
+	}
+	if ($line =~ m/$re/) {
+		my $size = $1;
+		$size = hex($size) if ($size =~ /^0x/);
+
+		if ($size > 0x80000000) {
+			$size = - $size;
+			$size += 0x80000000;
+			$size += 0x80000000;
+		}
+
+		$line =~ m/^($xs*).*/;
+		my $addr = $1;
+		$addr =~ s/ /0/g;
+		$addr = "0x$addr";
+
+		my $intro = "$addr $func:";
+		my $padlen = 56 - length($intro);
+		while ($padlen > 0) {
+			$intro .= '	';
+			$padlen -= 8;
+		}
+		next if ($size < 100);
+		$stack[@stack] = "$intro$size\n";
+	}
+}
+
+@sortedstack = sort bysize @stack;
+
+foreach $i (@sortedstack) {
+	print("$i");
+}
diff -Nru a/scripts/kallsyms.c b/scripts/kallsyms.c
--- a/scripts/kallsyms.c	Tue Jun 15 22:21:05 2004
+++ b/scripts/kallsyms.c	Tue Jun 15 22:21:05 2004
@@ -5,12 +5,13 @@
  * This software may be used and distributed according to the terms
  * of the GNU General Public License, incorporated herein by reference.
  *
- * Usage: nm -n vmlinux | scripts/kallsyms > symbols.S
+ * Usage: nm -n vmlinux | scripts/kallsyms [--all-symbols] > symbols.S
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 
 struct sym_entry {
 	unsigned long long addr;
@@ -22,11 +23,12 @@
 static struct sym_entry *table;
 static int size, cnt;
 static unsigned long long _stext, _etext, _sinittext, _einittext;
+static int all_symbols = 0;
 
 static void
 usage(void)
 {
-	fprintf(stderr, "Usage: kallsyms < in.map > out.S\n");
+	fprintf(stderr, "Usage: kallsyms [--all-symbols] < in.map > out.S\n");
 	exit(1);
 }
 
@@ -44,6 +46,19 @@
 		}
 		return -1;
 	}
+
+	/* Ignore most absolute/undefined (?) symbols. */
+	if (strcmp(str, "_stext") == 0)
+		_stext = s->addr;
+	else if (strcmp(str, "_etext") == 0)
+		_etext = s->addr;
+	else if (strcmp(str, "_sinittext") == 0)
+		_sinittext = s->addr;
+	else if (strcmp(str, "_einittext") == 0)
+		_einittext = s->addr;
+	else if (toupper(s->type) == 'A' || toupper(s->type) == 'U')
+		return -1;
+
 	s->sym = strdup(str);
 	return 0;
 }
@@ -51,9 +66,11 @@
 static int
 symbol_valid(struct sym_entry *s)
 {
-	if ((s->addr < _stext || s->addr > _etext)
-	    && (s->addr < _sinittext || s->addr > _einittext))
-		return 0;
+	if (!all_symbols) {
+		if ((s->addr < _stext || s->addr > _etext)
+		    && (s->addr < _sinittext || s->addr > _einittext))
+			return 0;
+	}
 
 	if (strstr(s->sym, "_compiled."))
 		return 0;
@@ -64,8 +81,6 @@
 static void
 read_map(FILE *in)
 {
-	int i;
-
 	while (!feof(in)) {
 		if (cnt >= size) {
 			size += 10000;
@@ -78,22 +93,11 @@
 		if (read_symbol(in, &table[cnt]) == 0)
 			cnt++;
 	}
-	for (i = 0; i < cnt; i++) {
-		if (strcmp(table[i].sym, "_stext") == 0)
-			_stext = table[i].addr;
-		if (strcmp(table[i].sym, "_etext") == 0)
-			_etext = table[i].addr;
-		if (strcmp(table[i].sym, "_sinittext") == 0)
-			_sinittext = table[i].addr;
-		if (strcmp(table[i].sym, "_einittext") == 0)
-			_einittext = table[i].addr;
-	}
 }
 
 static void
 write_src(void)
 {
-	unsigned long long last_addr;
 	int i, valid = 0;
 	char *prev;
 
@@ -111,16 +115,12 @@
 	printf(".globl kallsyms_addresses\n");
 	printf("\tALGN\n");
 	printf("kallsyms_addresses:\n");
-	for (i = 0, last_addr = 0; i < cnt; i++) {
+	for (i = 0; i < cnt; i++) {
 		if (!symbol_valid(&table[i]))
 			continue;
-		
-		if (table[i].addr == last_addr)
-			continue;
 
 		printf("\tPTR\t%#llx\n", table[i].addr);
 		valid++;
-		last_addr = table[i].addr;
 	}
 	printf("\n");
 
@@ -134,20 +134,16 @@
 	printf("\tALGN\n");
 	printf("kallsyms_names:\n");
 	prev = ""; 
-	for (i = 0, last_addr = 0; i < cnt; i++) {
+	for (i = 0; i < cnt; i++) {
 		int k;
 
 		if (!symbol_valid(&table[i]))
 			continue;
-		
-		if (table[i].addr == last_addr)
-			continue;
 
 		for (k = 0; table[i].sym[k] && table[i].sym[k] == prev[k]; ++k)
 			; 
 
 		printf("\t.byte 0x%02x\n\t.asciz\t\"%s\"\n", k, table[i].sym + k);
-		last_addr = table[i].addr;
 		prev = table[i].sym;
 	}
 	printf("\n");
@@ -156,7 +152,9 @@
 int
 main(int argc, char **argv)
 {
-	if (argc != 1)
+	if (argc == 2 && strcmp(argv[1], "--all-symbols") == 0)
+		all_symbols = 1;
+	else if (argc != 1)
 		usage();
 
 	read_map(stdin);
diff -Nru a/scripts/kernel-doc b/scripts/kernel-doc
--- a/scripts/kernel-doc	Tue Jun 15 22:20:40 2004
+++ b/scripts/kernel-doc	Tue Jun 15 22:20:40 2004
@@ -1304,6 +1304,8 @@
     }
     
     foreach my $arg (split($splitter, $args)) {
+	# strip comments
+	$arg =~ s/\/\*.*\*\///;
         # strip leading/trailing spaces
         $arg =~ s/^\s*//;
 	$arg =~ s/\s*$//;
diff -Nru a/scripts/mk_elfconfig.c b/scripts/mk_elfconfig.c
--- a/scripts/mk_elfconfig.c	Tue Jun 15 22:21:04 2004
+++ b/scripts/mk_elfconfig.c	Tue Jun 15 22:21:04 2004
@@ -55,7 +55,7 @@
 	else
 		abort();
 
-	if (strcmp(argv[1], "v850") == 0)
+	if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0))
 		printf("#define MODULE_SYMBOL_PREFIX \"_\"\n");
 	else 
 		printf("#define MODULE_SYMBOL_PREFIX \"\"\n");
diff -Nru a/scripts/modpost.c b/scripts/modpost.c
--- a/scripts/modpost.c	Tue Jun 15 22:20:37 2004
+++ b/scripts/modpost.c	Tue Jun 15 22:20:37 2004
@@ -267,6 +267,7 @@
 	hdr->e_shoff    = TO_NATIVE(hdr->e_shoff);
 	hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx);
 	hdr->e_shnum    = TO_NATIVE(hdr->e_shnum);
+	hdr->e_machine  = TO_NATIVE(hdr->e_machine);
 	sechdrs = (void *)hdr + hdr->e_shoff;
 	info->sechdrs = sechdrs;
 
diff -Nru a/scripts/reference_discarded.pl b/scripts/reference_discarded.pl
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/scripts/reference_discarded.pl	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,109 @@
+#!/usr/bin/perl -w
+#
+# reference_discarded.pl (C) Keith Owens 2001 <kaos@ocs.com.au>
+#
+# Released under GPL V2.
+#
+# List dangling references to vmlinux discarded sections.
+
+use strict;
+die($0 . " takes no arguments\n") if($#ARGV >= 0);
+
+my %object;
+my $object;
+my $line;
+my $ignore;
+my $errorcount;
+
+$| = 1;
+
+# printf("Finding objects, ");
+open(OBJDUMP_LIST, "find . -name '*.o' | xargs objdump -h |") || die "getting objdump list failed";
+while (defined($line = <OBJDUMP_LIST>)) {
+	chomp($line);
+	if ($line =~ /:\s+file format/) {
+		($object = $line) =~ s/:.*//;
+		$object{$object}->{'module'} = 0;
+		$object{$object}->{'size'} = 0;
+		$object{$object}->{'off'} = 0;
+	}
+	if ($line =~ /^\s*\d+\s+\.modinfo\s+/) {
+		$object{$object}->{'module'} = 1;
+	}
+	if ($line =~ /^\s*\d+\s+\.comment\s+/) {
+		($object{$object}->{'size'}, $object{$object}->{'off'}) = (split(' ', $line))[2,5];
+	}
+}
+close(OBJDUMP_LIST);
+# printf("%d objects, ", scalar keys(%object));
+$ignore = 0;
+foreach $object (keys(%object)) {
+	if ($object{$object}->{'module'}) {
+		++$ignore;
+		delete($object{$object});
+	}
+}
+# printf("ignoring %d module(s)\n", $ignore);
+
+# Ignore conglomerate objects, they have been built from multiple objects and we
+# only care about the individual objects.  If an object has more than one GCC:
+# string in the comment section then it is conglomerate.  This does not filter
+# out conglomerates that consist of exactly one object, can't be helped.
+
+# printf("Finding conglomerates, ");
+$ignore = 0;
+foreach $object (keys(%object)) {
+	if (exists($object{$object}->{'off'})) {
+		my ($off, $size, $comment, $l);
+		$off = hex($object{$object}->{'off'});
+		$size = hex($object{$object}->{'size'});
+		open(OBJECT, "<$object") || die "cannot read $object";
+		seek(OBJECT, $off, 0) || die "seek to $off in $object failed";
+		$l = read(OBJECT, $comment, $size);
+		die "read $size bytes from $object .comment failed" if ($l != $size);
+		close(OBJECT);
+		if ($comment =~ /GCC\:.*GCC\:/m) {
+			++$ignore;
+			delete($object{$object});
+		}
+	}
+}
+# printf("ignoring %d conglomerate(s)\n", $ignore);
+
+# printf("Scanning objects\n");
+$errorcount = 0;
+foreach $object (keys(%object)) {
+	my $from;
+	open(OBJDUMP, "objdump -r $object|") || die "cannot objdump -r $object";
+	while (defined($line = <OBJDUMP>)) {
+		chomp($line);
+		if ($line =~ /RELOCATION RECORDS FOR /) {
+			($from = $line) =~ s/.*\[([^]]*).*/$1/;
+		}
+		if (($line =~ /\.text\.exit$/ ||
+		     $line =~ /\.exit\.text$/ ||
+		     $line =~ /\.data\.exit$/ ||
+		     $line =~ /\.exit\.data$/ ||
+		     $line =~ /\.exitcall\.exit$/) &&
+		    ($from !~ /\.text\.exit$/ &&
+		     $from !~ /\.exit\.text$/ &&
+		     $from !~ /\.data\.exit$/ &&
+		     $from !~ /\.exit\.data$/ &&
+		     $from !~ /\.altinstructions$/ &&
+		     $from !~ /\.debug_info$/ &&
+		     $from !~ /\.debug_aranges$/ &&
+		     $from !~ /\.debug_ranges$/ &&
+		     $from !~ /\.debug_line$/ &&
+		     $from !~ /\.debug_frame$/ &&
+		     $from !~ /\.exitcall\.exit$/ &&
+		     $from !~ /\.eh_frame$/ &&
+		     $from !~ /\.stab$/)) {
+			printf("Error: %s %s refers to %s\n", $object, $from, $line);
+			$errorcount = $errorcount + 1;
+		}
+	}
+	close(OBJDUMP);
+}
+# printf("Done\n");
+
+exit(0);
diff -Nru a/scripts/reference_init.pl b/scripts/reference_init.pl
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/scripts/reference_init.pl	Tue Jun 15 22:21:05 2004
@@ -0,0 +1,102 @@
+#!/usr/bin/perl -w
+#
+# reference_init.pl (C) Keith Owens 2002 <kaos@ocs.com.au>
+#
+# List references to vmlinux init sections from non-init sections.
+
+# Unfortunately I had to exclude references from read only data to .init
+# sections, almost all of these are false positives, they are created by
+# gcc.  The downside of excluding rodata is that there really are some
+# user references from rodata to init code, e.g. drivers/video/vgacon.c
+#
+# const struct consw vga_con = {
+#        con_startup:            vgacon_startup,
+#
+# where vgacon_startup is __init.  If you want to wade through the false
+# positives, take out the check for rodata.
+
+use strict;
+die($0 . " takes no arguments\n") if($#ARGV >= 0);
+
+my %object;
+my $object;
+my $line;
+my $ignore;
+
+$| = 1;
+
+printf("Finding objects, ");
+open(OBJDUMP_LIST, "find . -name '*.o' | xargs objdump -h |") || die "getting objdump list failed";
+while (defined($line = <OBJDUMP_LIST>)) {
+	chomp($line);
+	if ($line =~ /:\s+file format/) {
+		($object = $line) =~ s/:.*//;
+		$object{$object}->{'module'} = 0;
+		$object{$object}->{'size'} = 0;
+		$object{$object}->{'off'} = 0;
+	}
+	if ($line =~ /^\s*\d+\s+\.modinfo\s+/) {
+		$object{$object}->{'module'} = 1;
+	}
+	if ($line =~ /^\s*\d+\s+\.comment\s+/) {
+		($object{$object}->{'size'}, $object{$object}->{'off'}) = (split(' ', $line))[2,5];
+	}
+}
+close(OBJDUMP_LIST);
+printf("%d objects, ", scalar keys(%object));
+$ignore = 0;
+foreach $object (keys(%object)) {
+	if ($object{$object}->{'module'}) {
+		++$ignore;
+		delete($object{$object});
+	}
+}
+printf("ignoring %d module(s)\n", $ignore);
+
+# Ignore conglomerate objects, they have been built from multiple objects and we
+# only care about the individual objects.  If an object has more than one GCC:
+# string in the comment section then it is conglomerate.  This does not filter
+# out conglomerates that consist of exactly one object, can't be helped.
+
+printf("Finding conglomerates, ");
+$ignore = 0;
+foreach $object (keys(%object)) {
+	if (exists($object{$object}->{'off'})) {
+		my ($off, $size, $comment, $l);
+		$off = hex($object{$object}->{'off'});
+		$size = hex($object{$object}->{'size'});
+		open(OBJECT, "<$object") || die "cannot read $object";
+		seek(OBJECT, $off, 0) || die "seek to $off in $object failed";
+		$l = read(OBJECT, $comment, $size);
+		die "read $size bytes from $object .comment failed" if ($l != $size);
+		close(OBJECT);
+		if ($comment =~ /GCC\:.*GCC\:/m) {
+			++$ignore;
+			delete($object{$object});
+		}
+	}
+}
+printf("ignoring %d conglomerate(s)\n", $ignore);
+
+printf("Scanning objects\n");
+foreach $object (sort(keys(%object))) {
+	my $from;
+	open(OBJDUMP, "objdump -r $object|") || die "cannot objdump -r $object";
+	while (defined($line = <OBJDUMP>)) {
+		chomp($line);
+		if ($line =~ /RELOCATION RECORDS FOR /) {
+			($from = $line) =~ s/.*\[([^]]*).*/$1/;
+		}
+		if (($line =~ /\.init$/ || $line =~ /\.init\./) &&
+		    ($from !~ /\.init$/ &&
+		     $from !~ /\.init\./ &&
+		     $from !~ /\.stab$/ &&
+		     $from !~ /\.rodata$/ &&
+		     $from !~ /\.text\.lock$/ &&
+		     $from !~ /\.debug_/)) {
+			printf("Error: %s %s refers to %s\n", $object, $from, $line);
+		}
+	}
+	close(OBJDUMP);
+}
+printf("Done\n");
diff -Nru a/scripts/sumversion.c b/scripts/sumversion.c
--- a/scripts/sumversion.c	Tue Jun 15 22:20:43 2004
+++ b/scripts/sumversion.c	Tue Jun 15 22:20:43 2004
@@ -374,7 +374,7 @@
 			break;
 		/* Terminate line at first space, to get rid of final ' \' */
 		while (*p) {
-			if isspace(*p) {
+                       if (isspace(*p)) {
 				*p = '\0';
 				break;
 			}
diff -Nru a/security/Makefile b/security/Makefile
--- a/security/Makefile	Tue Jun 15 22:20:43 2004
+++ b/security/Makefile	Tue Jun 15 22:20:43 2004
@@ -6,7 +6,7 @@
 
 # if we don't select a security model, use the default capabilities
 ifneq ($(CONFIG_SECURITY),y)
-obj-y		+= commoncap.o capability.o
+obj-y		+= commoncap.o
 endif
 
 # Object file lists
diff -Nru a/security/capability.c b/security/capability.c
--- a/security/capability.c	Tue Jun 15 22:20:39 2004
+++ b/security/capability.c	Tue Jun 15 22:20:39 2004
@@ -22,9 +22,7 @@
 #include <linux/skbuff.h>
 #include <linux/netlink.h>
 #include <linux/ptrace.h>
-
-#ifdef CONFIG_SECURITY
-
+#include <linux/moduleparam.h>
 
 static struct security_operations capability_ops = {
 	.ptrace =			cap_ptrace,
@@ -50,22 +48,23 @@
 	.vm_enough_memory =             cap_vm_enough_memory,
 };
 
-#if defined(CONFIG_SECURITY_CAPABILITIES_MODULE)
-#define MY_NAME THIS_MODULE->name
-#else
-#define MY_NAME "capability"
-#endif
+#define MY_NAME __stringify(KBUILD_MODNAME)
 
 /* flag to keep track of how we were registered */
 static int secondary;
 
+static int capability_disable;
+module_param_named(disable, capability_disable, int, 0);
+MODULE_PARM_DESC(disable, "To disable capabilities module set disable = 1");
 
 static int __init capability_init (void)
 {
+	if (capability_disable) {
+		printk(KERN_INFO "Capabilities disabled at initialization\n");
+		return 0;
+	}
 	/* register ourselves with the security framework */
 	if (register_security (&capability_ops)) {
-		printk (KERN_INFO
-			"Failure registering capabilities with the kernel\n");
 		/* try registering with primary module */
 		if (mod_reg_security (MY_NAME, &capability_ops)) {
 			printk (KERN_INFO "Failure registering capabilities "
@@ -74,12 +73,15 @@
 		}
 		secondary = 1;
 	}
-	printk (KERN_INFO "Capability LSM initialized\n");
+	printk (KERN_INFO "Capability LSM initialized%s\n",
+		secondary ? " as secondary" : "");
 	return 0;
 }
 
 static void __exit capability_exit (void)
 {
+	if (capability_disable)
+		return;
 	/* remove ourselves from the security framework */
 	if (secondary) {
 		if (mod_unreg_security (MY_NAME, &capability_ops))
@@ -99,5 +101,3 @@
 
 MODULE_DESCRIPTION("Standard Linux Capabilities Security Module");
 MODULE_LICENSE("GPL");
-
-#endif	/* CONFIG_SECURITY */
diff -Nru a/security/commoncap.c b/security/commoncap.c
--- a/security/commoncap.c	Tue Jun 15 22:20:39 2004
+++ b/security/commoncap.c	Tue Jun 15 22:20:39 2004
@@ -289,7 +289,7 @@
 
 int cap_syslog (int type)
 {
-	if ((type != 3) && !capable(CAP_SYS_ADMIN))
+	if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
 		return -EPERM;
 	return 0;
 }
diff -Nru a/security/dummy.c b/security/dummy.c
--- a/security/dummy.c	Tue Jun 15 22:20:37 2004
+++ b/security/dummy.c	Tue Jun 15 22:20:37 2004
@@ -99,7 +99,7 @@
 
 static int dummy_syslog (int type)
 {
-	if ((type != 3) && current->euid)
+	if ((type != 3 && type != 10) && current->euid)
 		return -EPERM;
 	return 0;
 }
@@ -688,7 +688,7 @@
 	return 0;
 }
 
-static int dummy_shm_shmat (struct shmid_kernel *shp, char *shmaddr,
+static int dummy_shm_shmat (struct shmid_kernel *shp, char __user *shmaddr,
 			    int shmflg)
 {
 	return 0;
diff -Nru a/security/selinux/Kconfig b/security/selinux/Kconfig
--- a/security/selinux/Kconfig	Tue Jun 15 22:20:36 2004
+++ b/security/selinux/Kconfig	Tue Jun 15 22:20:36 2004
@@ -1,6 +1,6 @@
 config SECURITY_SELINUX
 	bool "NSA SELinux Support"
-	depends on SECURITY
+	depends on SECURITY && NET
 	default n
 	help
 	  This selects NSA Security-Enhanced Linux (SELinux).
diff -Nru a/security/selinux/hooks.c b/security/selinux/hooks.c
--- a/security/selinux/hooks.c	Tue Jun 15 22:21:03 2004
+++ b/security/selinux/hooks.c	Tue Jun 15 22:21:03 2004
@@ -62,6 +62,7 @@
 #include <linux/nfs_mount.h>
 #include <net/ipv6.h>
 #include <linux/hugetlb.h>
+#include <linux/major.h>
 
 #include "avc.h"
 #include "objsec.h"
@@ -1379,7 +1380,7 @@
 	if (error)
 		return;
 
-	return secondary_ops->capset_set(target, effective, inheritable, permitted);
+	secondary_ops->capset_set(target, effective, inheritable, permitted);
 }
 
 static int selinux_capable(struct task_struct *tsk, int cap)
@@ -1475,6 +1476,7 @@
 
 	switch (type) {
 		case 3:         /* Read last kernel messages */
+		case 10:        /* Return size of the log buffer */
 			rc = task_has_system(current, SYSTEM__SYSLOG_READ);
 			break;
 		case 6:         /* Disable logging to console */
@@ -1712,18 +1714,77 @@
 	kfree(bsec);
 }
 
+/* Create an open file that refers to the null device.
+   Derived from the OpenWall LSM. */
+struct file *open_devnull(void)
+{
+	struct inode *inode;
+	struct dentry *dentry;
+	struct file *file = NULL;
+	struct inode_security_struct *isec;
+	dev_t dev;
+
+	inode = new_inode(current->fs->rootmnt->mnt_sb);
+	if (!inode)
+		goto out;
+
+	dentry = dget(d_alloc_root(inode));
+	if (!dentry)
+		goto out_iput;
+
+	file = get_empty_filp();
+	if (!file)
+		goto out_dput;
+
+	dev = MKDEV(MEM_MAJOR, 3); /* null device */
+
+	inode->i_uid = current->fsuid;
+	inode->i_gid = current->fsgid;
+	inode->i_blksize = PAGE_SIZE;
+	inode->i_blocks = 0;
+	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+	inode->i_state = I_DIRTY; /* so that mark_inode_dirty won't touch us */
+
+	isec = inode->i_security;
+	isec->sid = SECINITSID_DEVNULL;
+	isec->sclass = SECCLASS_CHR_FILE;
+	isec->initialized = 1;
+
+	file->f_flags = O_RDWR;
+	file->f_mode = FMODE_READ | FMODE_WRITE;
+	file->f_dentry = dentry;
+	file->f_vfsmnt = mntget(current->fs->rootmnt);
+	file->f_pos = 0;
+
+	init_special_inode(inode, S_IFCHR | S_IRUGO | S_IWUGO, dev);
+	if (inode->i_fop->open(inode, file))
+		goto out_fput;
+
+out:
+	return file;
+out_fput:
+	mntput(file->f_vfsmnt);
+	put_filp(file);
+out_dput:
+	dput(dentry);
+out_iput:
+	iput(inode);
+	file = NULL;
+	goto out;
+}
+
 /* Derived from fs/exec.c:flush_old_files. */
 static inline void flush_unauthorized_files(struct files_struct * files)
 {
 	struct avc_audit_data ad;
-	struct file *file;
+	struct file *file, *devnull = NULL;
 	long j = -1;
 
 	AVC_AUDIT_DATA_INIT(&ad,FS);
 
 	spin_lock(&files->file_lock);
 	for (;;) {
-		unsigned long set, i;
+		unsigned long set, i, fd;
 
 		j++;
 		i = j * __NFDBITS;
@@ -1740,8 +1801,27 @@
 					continue;
 				if (file_has_perm(current,
 						  file,
-						  file_to_av(file)))
+						  file_to_av(file))) {
 					sys_close(i);
+					fd = get_unused_fd();
+					if (fd != i) {
+						if (fd >= 0)
+							put_unused_fd(fd);
+						fput(file);
+						continue;
+					}
+					if (devnull) {
+						atomic_inc(&devnull->f_count);
+					} else {
+						devnull = open_devnull();
+						if (!devnull) {
+							put_unused_fd(fd);
+							fput(file);
+							continue;
+						}
+					}
+					fd_install(fd, devnull);
+				}
 				fput(file);
 			}
 		}
@@ -3465,7 +3545,7 @@
 
 static void selinux_msg_msg_free_security(struct msg_msg *msg)
 {
-	return msg_msg_free_security(msg);
+	msg_msg_free_security(msg);
 }
 
 /* message queue security operations */
@@ -3701,7 +3781,7 @@
 }
 
 static int selinux_shm_shmat(struct shmid_kernel *shp,
-			     char *shmaddr, int shmflg)
+			     char __user *shmaddr, int shmflg)
 {
 	u32 perms;
 
diff -Nru a/security/selinux/include/flask.h b/security/selinux/include/flask.h
--- a/security/selinux/include/flask.h	Tue Jun 15 22:20:42 2004
+++ b/security/selinux/include/flask.h	Tue Jun 15 22:20:42 2004
@@ -65,7 +65,8 @@
 #define SECINITSID_KMOD                                 24
 #define SECINITSID_POLICY                               25
 #define SECINITSID_SCMP_PACKET                          26
+#define SECINITSID_DEVNULL                              27
 
-#define SECINITSID_NUM                                  26
+#define SECINITSID_NUM                                  27
 
 #endif
diff -Nru a/security/selinux/include/initial_sid_to_string.h b/security/selinux/include/initial_sid_to_string.h
--- a/security/selinux/include/initial_sid_to_string.h	Tue Jun 15 22:20:44 2004
+++ b/security/selinux/include/initial_sid_to_string.h	Tue Jun 15 22:20:44 2004
@@ -28,5 +28,6 @@
     "kmod",
     "policy",
     "scmp_packet",
+    "devnull",
 };
 
diff -Nru a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
--- a/security/selinux/selinuxfs.c	Tue Jun 15 22:21:05 2004
+++ b/security/selinux/selinuxfs.c	Tue Jun 15 22:21:05 2004
@@ -68,7 +68,7 @@
 	SEL_DISABLE	/* disable SELinux until next reboot */
 };
 
-static ssize_t sel_read_enforce(struct file *filp, char *buf,
+static ssize_t sel_read_enforce(struct file *filp, char __user *buf,
 				size_t count, loff_t *ppos)
 {
 	char *page;
@@ -105,7 +105,7 @@
 }
 
 #ifdef CONFIG_SECURITY_SELINUX_DEVELOP
-static ssize_t sel_write_enforce(struct file * file, const char * buf,
+static ssize_t sel_write_enforce(struct file * file, const char __user * buf,
 				 size_t count, loff_t *ppos)
 
 {
@@ -155,7 +155,7 @@
 };
 
 #ifdef CONFIG_SECURITY_SELINUX_DISABLE
-static ssize_t sel_write_disable(struct file * file, const char * buf,
+static ssize_t sel_write_disable(struct file * file, const char __user * buf,
 				 size_t count, loff_t *ppos)
 
 {
@@ -201,7 +201,7 @@
 	.write		= sel_write_disable,
 };
 
-static ssize_t sel_read_policyvers(struct file *filp, char *buf,
+static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
                                    size_t count, loff_t *ppos)
 {
 	char *page;
@@ -244,7 +244,7 @@
 /* declaration for sel_write_load */
 static int sel_make_bools(void);
 
-static ssize_t sel_read_mls(struct file *filp, char *buf,
+static ssize_t sel_read_mls(struct file *filp, char __user *buf,
 				size_t count, loff_t *ppos)
 {
 	char *page;
@@ -284,7 +284,7 @@
 	.read		= sel_read_mls,
 };
 
-static ssize_t sel_write_load(struct file * file, const char * buf,
+static ssize_t sel_write_load(struct file * file, const char __user * buf,
 			      size_t count, loff_t *ppos)
 
 {
@@ -334,7 +334,7 @@
 };
 
 
-static ssize_t sel_write_context(struct file * file, const char * buf,
+static ssize_t sel_write_context(struct file * file, const char __user * buf,
 				 size_t count, loff_t *ppos)
 
 {
@@ -406,7 +406,7 @@
  * possibly a read which collects the result - which is stored in a
  * file-local buffer.
  */
-static ssize_t TA_write(struct file *file, const char *buf, size_t size, loff_t *pos)
+static ssize_t TA_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
 {
 	ino_t ino =  file->f_dentry->d_inode->i_ino;
 	struct argresp *ar;
@@ -445,7 +445,7 @@
 	return rv;
 }
 
-static ssize_t TA_read(struct file *file, char *buf, size_t size, loff_t *pos)
+static ssize_t TA_read(struct file *file, char __user *buf, size_t size, loff_t *pos)
 {
 	struct argresp *ar;
 	ssize_t rv = 0;
@@ -744,7 +744,7 @@
 
 #define BOOL_INO_OFFSET 30
 
-static ssize_t sel_read_bool(struct file *filep, char *buf,
+static ssize_t sel_read_bool(struct file *filep, char __user *buf,
 			     size_t count, loff_t *ppos)
 {
 	char *page = NULL;
@@ -806,7 +806,7 @@
 	return ret;
 }
 
-static ssize_t sel_write_bool(struct file *filep, const char *buf,
+static ssize_t sel_write_bool(struct file *filep, const char __user *buf,
 			      size_t count, loff_t *ppos)
 {
 	char *page = NULL;
@@ -833,8 +833,10 @@
 		goto out;
 	}
 	page = (char*)__get_free_page(GFP_KERNEL);
-	if (!page)
-		return -ENOMEM;
+	if (!page) {
+		length = -ENOMEM;
+		goto out;
+	}
 	memset(page, 0, PAGE_SIZE);
 
 	if (copy_from_user(page, buf, count))
@@ -863,7 +865,8 @@
 	.write          = sel_write_bool,
 };
 
-static ssize_t sel_commit_bools_write(struct file *filep, const char *buf,
+static ssize_t sel_commit_bools_write(struct file *filep,
+				      const char __user *buf,
 				      size_t count, loff_t *ppos)
 {
 	char *page = NULL;
@@ -889,8 +892,10 @@
 		goto out;
 	}
 	page = (char*)__get_free_page(GFP_KERNEL);
-	if (!page)
-		return -ENOMEM;
+	if (!page) {
+		length = -ENOMEM;
+		goto out;
+	}
 
 	memset(page, 0, PAGE_SIZE);
 
diff -Nru a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
--- a/security/selinux/ss/mls.c	Tue Jun 15 22:20:39 2004
+++ b/security/selinux/ss/mls.c	Tue Jun 15 22:20:39 2004
@@ -290,7 +290,7 @@
 		if (rc)
 			goto out;
 	}
-	*scontext = p;
+	*scontext = ++p;
 	rc = 0;
 out:
 	return rc;
diff -Nru a/security/selinux/ss/services.c b/security/selinux/ss/services.c
--- a/security/selinux/ss/services.c	Tue Jun 15 22:20:59 2004
+++ b/security/selinux/ss/services.c	Tue Jun 15 22:20:59 2004
@@ -532,6 +532,11 @@
 	if (rc)
 		goto out_unlock;
 
+	if ((p - scontext2) < scontext_len) {
+		rc = -EINVAL;
+		goto out_unlock;
+	}
+
 	/* Check the validity of the new context. */
 	if (!policydb_context_isvalid(&policydb, &context)) {
 		rc = -EINVAL;
diff -Nru a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c
--- a/sound/arm/sa11xx-uda1341.c	Tue Jun 15 22:20:36 2004
+++ b/sound/arm/sa11xx-uda1341.c	Tue Jun 15 22:20:36 2004
@@ -21,7 +21,7 @@
  *                              merged HAL layer (patches from Brian)
  */
 
-/* $Id: sa11xx-uda1341.c,v 1.13 2004/03/02 15:32:35 perex Exp $ */
+/* $Id: sa11xx-uda1341.c,v 1.15 2004/05/03 17:36:50 tiwai Exp $ */
 
 /***************************************************************************************************
 *
@@ -62,6 +62,7 @@
 #include <linux/config.h>
 #include <sound/driver.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/ioctl.h>
@@ -112,7 +113,7 @@
 
 static char *id = NULL;	/* ID for this card */
 
-MODULE_PARM(id, "s");
+module_param(id, charp, 0444);
 MODULE_PARM_DESC(id, "ID string for SA1100/SA1111 + UDA1341TS soundcard.");
 
 #define chip_t sa11xx_uda1341_t
@@ -136,7 +137,6 @@
 }audio_stream_t;
 
 typedef struct snd_card_sa11xx_uda1341 {
-	struct pm_dev *pm_dev;        
 	snd_card_t *card;
 	struct l3_client *uda1341;
 	snd_pcm_t *pcm;
@@ -867,12 +867,10 @@
 
 #ifdef CONFIG_PM
 
-static void snd_sa11xx_uda1341_suspend(sa11xx_uda1341_t *chip)
+static int snd_sa11xx_uda1341_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	sa11xx_uda1341_t *chip = snd_magic_cast(sa11x_uda1341_t, card->pm_private_data, return -EINVAL);
 
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
 	snd_pcm_suspend_all(chip->pcm);
 #ifdef HH_VERSION	
 	sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_PLAYBACK].dmach);
@@ -883,14 +881,13 @@
 	l3_command(chip->uda1341, CMD_SUSPEND, NULL);
 	sa11xx_uda1341_audio_shutdown(chip);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void snd_sa11xx_uda1341_resume(sa11xx_uda1341_t *chip)
+static int snd_sa11xx_uda1341_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	sa11xx_uda1341_t *chip = snd_magic_cast(sa11x_uda1341_t, card->pm_private_data, return -EINVAL);
 
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
 	sa11xx_uda1341_audio_init(chip);
 	l3_command(chip->uda1341, CMD_RESUME, NULL);
 #ifdef HH_VERSION	
@@ -900,50 +897,14 @@
 	//FIXME
 #endif
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int sa11xx_uda1341_pm_callback(struct pm_dev *pm_dev, pm_request_t req, void *data)
-{
-	sa11xx_uda1341_t *chip = pm_dev->data;
-        
-	switch (req) {
-	case PM_SUSPEND: /* enter D1-D3 */
-		snd_sa11xx_uda1341_suspend(chip);
-		break;
-	case PM_RESUME:  /* enter D0 */
-		snd_sa11xx_uda1341_resume(chip);
-		break;
-	}
-	return 0;
-}
-
-static int sa11xx_uda1341_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	sa11xx_uda1341_t *chip = snd_magic_cast(sa11xx_uda1341_t, card->power_state_private_data, return);
-
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		snd_sa11xx_uda1341_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		snd_sa11xx_uda1341_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
-
 #endif /* COMFIG_PM */
 
 void snd_sa11xx_uda1341_free(snd_card_t *card)
 {
 	sa11xx_uda1341_t *chip = snd_magic_cast(sa11xx_uda1341_t, card->private_data, return);
 
-	pm_unregister(chip->pm_dev);
 	audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]);
 	audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]);
 	sa11xx_uda1341 = NULL;
@@ -984,15 +945,10 @@
 	if ((err = snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341, 0)) < 0)
 		goto nodev;
         
-       
-#ifdef CONFIG_PM
-	card->power_state_private_data = sa11xx_uda1341;
-	card->set_power_state = sa11xx_uda1341_set_power_state;
-	sa11xx_uda1341->pm_dev = pm_register(PM_SYS_DEV, 0, sa11xx_uda1341_pm_callback);
-	if (sa11xx_uda1341->pm_dev)
-		sa11xx_uda1341->pm_dev->data = sa11xx_uda1341;
-#endif
-        
+	snd_card_set_dev_pm_callback(card, PM_SYS_DEV,
+				     snd_sa11xx_uda1341_suspend, snd_sa11_uda1341_resume,
+				     sa11xx_uda1341);
+
 	strcpy(card->driver, "UDA1341");
 	strcpy(card->shortname, "H3600 UDA1341TS");
 	sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS");
diff -Nru a/sound/core/Kconfig b/sound/core/Kconfig
--- a/sound/core/Kconfig	Tue Jun 15 22:20:43 2004
+++ b/sound/core/Kconfig	Tue Jun 15 22:20:43 2004
@@ -1,8 +1,4 @@
 # ALSA soundcard-configuration
-config SND_BIT32_EMUL
-	tristate "Emulation for 32-bit applications"
-	depends on SND && SND_PCM && (SPARC64 || PPC64 || X86_64 && IA32_EMULATION)
-
 config SND_TIMER
 	tristate
 
@@ -58,6 +54,17 @@
 	help
 	  Say 'Y' to enable OSS sequencer emulation (both /dev/sequencer and
 	  /dev/music interfaces).
+
+config SND_BIT32_EMUL
+	tristate "Emulation for 32-bit applications"
+	depends on SND && (MIPS64 || SPARC64 || PPC64 || X86_64 && IA32_EMULATION)
+	select SND_PCM
+	select SND_RAWMIDI
+	select SND_TIMER
+	select SND_HWDEP
+	help
+	  Say 'Y' or 'M' to enable the emulation for 32-bit ALSA-native
+	  applications.
 
 config SND_RTCTIMER
 	tristate "RTC Timer support"
diff -Nru a/sound/core/control.c b/sound/core/control.c
--- a/sound/core/control.c	Tue Jun 15 22:20:37 2004
+++ b/sound/core/control.c	Tue Jun 15 22:20:37 2004
@@ -512,7 +512,7 @@
 }
 
 static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl,
-			     unsigned int cmd, unsigned long arg)
+			     unsigned int cmd, void __user *arg)
 {
 	snd_ctl_card_info_t info;
 
@@ -526,12 +526,12 @@
 	strlcpy(info.mixername, card->mixername, sizeof(info.mixername));
 	strlcpy(info.components, card->components, sizeof(info.components));
 	up_read(&snd_ioctl_rwsem);
-	if (copy_to_user((void *) arg, &info, sizeof(snd_ctl_card_info_t)))
+	if (copy_to_user(arg, &info, sizeof(snd_ctl_card_info_t)))
 		return -EFAULT;
 	return 0;
 }
 
-static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t *_list)
+static int snd_ctl_elem_list(snd_card_t *card, snd_ctl_elem_list_t __user *_list)
 {
 	struct list_head *plist;
 	snd_ctl_elem_list_t list;
@@ -593,7 +593,7 @@
 	return 0;
 }
 
-static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t *_info)
+static int snd_ctl_elem_info(snd_ctl_file_t *ctl, snd_ctl_elem_info_t __user *_info)
 {
 	snd_card_t *card = ctl->card;
 	snd_ctl_elem_info_t info;
@@ -636,7 +636,7 @@
 	return result;
 }
 
-static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t *_control)
+static int snd_ctl_elem_read(snd_card_t *card, snd_ctl_elem_value_t __user *_control)
 {
 	snd_ctl_elem_value_t *control;
 	snd_kcontrol_t *kctl;
@@ -676,7 +676,7 @@
 	return result;
 }
 
-static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t *_control)
+static int snd_ctl_elem_write(snd_ctl_file_t *file, snd_ctl_elem_value_t __user *_control)
 {
 	snd_card_t *card = file->card;
 	snd_ctl_elem_value_t *control;
@@ -726,7 +726,7 @@
 	return result;
 }
 
-static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id)
+static int snd_ctl_elem_lock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id)
 {
 	snd_card_t *card = file->card;
 	snd_ctl_elem_id_t id;
@@ -754,7 +754,7 @@
 	return result;
 }
 
-static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id)
+static int snd_ctl_elem_unlock(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id)
 {
 	snd_card_t *card = file->card;
 	snd_ctl_elem_id_t id;
@@ -840,7 +840,7 @@
 	kfree(kcontrol->private_data);
 }
 
-static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *_info, int replace)
+static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t __user *_info, int replace)
 {
 	snd_card_t *card = file->card;
 	snd_ctl_elem_info_t info;
@@ -965,7 +965,7 @@
 	return 0;
 }
 
-static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t *_id)
+static int snd_ctl_elem_remove(snd_ctl_file_t *file, snd_ctl_elem_id_t __user *_id)
 {
 	snd_ctl_elem_id_t id;
 
@@ -974,7 +974,7 @@
 	return snd_ctl_remove_unlocked_id(file, &id);
 }
 
-static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int *ptr)
+static int snd_ctl_subscribe_events(snd_ctl_file_t *file, int __user *ptr)
 {
 	int subscribe;
 	if (get_user(subscribe, ptr))
@@ -995,6 +995,33 @@
 	return 0;
 }
 
+#ifdef CONFIG_PM
+/*
+ * change the power state
+ */
+static int snd_ctl_set_power_state(snd_card_t *card, unsigned int power_state)
+{
+	switch (power_state) {
+	case SNDRV_CTL_POWER_D0:
+	case SNDRV_CTL_POWER_D1:
+	case SNDRV_CTL_POWER_D2:
+		if (card->power_state != power_state)
+			/* FIXME: pass the correct state value */
+			card->pm_resume(card, 0);
+		break;
+	case SNDRV_CTL_POWER_D3hot:
+	case SNDRV_CTL_POWER_D3cold:
+		if (card->power_state != power_state)
+			/* FIXME: pass the correct state value */
+			card->pm_suspend(card, 0);
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+#endif
+
 static int snd_ctl_ioctl(struct inode *inode, struct file *file,
 			 unsigned int cmd, unsigned long arg)
 {
@@ -1002,6 +1029,8 @@
 	snd_card_t *card;
 	struct list_head *list;
 	snd_kctl_ioctl_t *p;
+	void __user *argp = (void __user *)arg;
+	int __user *ip = argp;
 	int err;
 
 	ctl = snd_magic_cast(snd_ctl_file_t, file->private_data, return -ENXIO);
@@ -1009,38 +1038,38 @@
 	snd_assert(card != NULL, return -ENXIO);
 	switch (cmd) {
 	case SNDRV_CTL_IOCTL_PVERSION:
-		return put_user(SNDRV_CTL_VERSION, (int *)arg) ? -EFAULT : 0;
+		return put_user(SNDRV_CTL_VERSION, ip) ? -EFAULT : 0;
 	case SNDRV_CTL_IOCTL_CARD_INFO:
-		return snd_ctl_card_info(card, ctl, cmd, arg);
+		return snd_ctl_card_info(card, ctl, cmd, argp);
 	case SNDRV_CTL_IOCTL_ELEM_LIST:
-		return snd_ctl_elem_list(ctl->card, (snd_ctl_elem_list_t *) arg);
+		return snd_ctl_elem_list(ctl->card, argp);
 	case SNDRV_CTL_IOCTL_ELEM_INFO:
-		return snd_ctl_elem_info(ctl, (snd_ctl_elem_info_t *) arg);
+		return snd_ctl_elem_info(ctl, argp);
 	case SNDRV_CTL_IOCTL_ELEM_READ:
-		return snd_ctl_elem_read(ctl->card, (snd_ctl_elem_value_t *) arg);
+		return snd_ctl_elem_read(ctl->card, argp);
 	case SNDRV_CTL_IOCTL_ELEM_WRITE:
-		return snd_ctl_elem_write(ctl, (snd_ctl_elem_value_t *) arg);
+		return snd_ctl_elem_write(ctl, argp);
 	case SNDRV_CTL_IOCTL_ELEM_LOCK:
-		return snd_ctl_elem_lock(ctl, (snd_ctl_elem_id_t *) arg);
+		return snd_ctl_elem_lock(ctl, argp);
 	case SNDRV_CTL_IOCTL_ELEM_UNLOCK:
-		return snd_ctl_elem_unlock(ctl, (snd_ctl_elem_id_t *) arg);
+		return snd_ctl_elem_unlock(ctl, argp);
 	case SNDRV_CTL_IOCTL_ELEM_ADD:
-		return snd_ctl_elem_add(ctl, (snd_ctl_elem_info_t *) arg, 0);
+		return snd_ctl_elem_add(ctl, argp, 0);
 	case SNDRV_CTL_IOCTL_ELEM_REPLACE:
-		return snd_ctl_elem_add(ctl, (snd_ctl_elem_info_t *) arg, 1);
+		return snd_ctl_elem_add(ctl, argp, 1);
 	case SNDRV_CTL_IOCTL_ELEM_REMOVE:
-		return snd_ctl_elem_remove(ctl, (snd_ctl_elem_id_t *) arg);
+		return snd_ctl_elem_remove(ctl, argp);
 	case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS:
-		return snd_ctl_subscribe_events(ctl, (int *) arg);
+		return snd_ctl_subscribe_events(ctl, ip);
 	case SNDRV_CTL_IOCTL_POWER:
-		if (get_user(err, (int *)arg))
+		if (get_user(err, ip))
 			return -EFAULT;
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
 #ifdef CONFIG_PM
-		if (card->set_power_state) {
+		if (card->pm_suspend && card->pm_resume) {
 			snd_power_lock(card);
-			err = card->set_power_state(card, err);
+			err = snd_ctl_set_power_state(card, err);
 			snd_power_unlock(card);
 		} else
 #endif
@@ -1048,9 +1077,9 @@
 		return err;
 	case SNDRV_CTL_IOCTL_POWER_STATE:
 #ifdef CONFIG_PM
-		return put_user(card->power_state, (int *)arg) ? -EFAULT : 0;
+		return put_user(card->power_state, ip) ? -EFAULT : 0;
 #else
-		return put_user(SNDRV_CTL_POWER_D0, (int *)arg) ? -EFAULT : 0;
+		return put_user(SNDRV_CTL_POWER_D0, ip) ? -EFAULT : 0;
 #endif
 	}
 	down_read(&snd_ioctl_rwsem);
@@ -1067,7 +1096,7 @@
 	return -ENOTTY;
 }
 
-static ssize_t snd_ctl_read(struct file *file, char *buffer, size_t count, loff_t * offset)
+static ssize_t snd_ctl_read(struct file *file, char __user *buffer, size_t count, loff_t * offset)
 {
 	snd_ctl_file_t *ctl;
 	int err = 0;
diff -Nru a/sound/core/hwdep.c b/sound/core/hwdep.c
--- a/sound/core/hwdep.c	Tue Jun 15 22:20:36 2004
+++ b/sound/core/hwdep.c	Tue Jun 15 22:20:36 2004
@@ -55,7 +55,7 @@
 	return -ENXIO;
 }
 
-static ssize_t snd_hwdep_read(struct file * file, char *buf, size_t count, loff_t *offset)
+static ssize_t snd_hwdep_read(struct file * file, char __user *buf, size_t count, loff_t *offset)
 {
 	snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO);
 	if (hw->ops.read)
@@ -63,7 +63,7 @@
 	return -ENXIO;	
 }
 
-static ssize_t snd_hwdep_write(struct file * file, const char *buf, size_t count, loff_t *offset)
+static ssize_t snd_hwdep_write(struct file * file, const char __user *buf, size_t count, loff_t *offset)
 {
 	snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO);
 	if (hw->ops.write)
@@ -179,7 +179,7 @@
 	return 0;
 }
 
-static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t *_info)
+static int snd_hwdep_info(snd_hwdep_t *hw, snd_hwdep_info_t __user *_info)
 {
 	snd_hwdep_info_t info;
 	
@@ -193,7 +193,7 @@
 	return 0;
 }
 
-static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *_info)
+static int snd_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t __user *_info)
 {
 	snd_hwdep_dsp_status_t info;
 	int err;
@@ -209,7 +209,7 @@
 	return 0;
 }
 
-static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *_info)
+static int snd_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t __user *_info)
 {
 	snd_hwdep_dsp_image_t info;
 	int err;
@@ -235,15 +235,16 @@
 			   unsigned int cmd, unsigned long arg)
 {
 	snd_hwdep_t *hw = snd_magic_cast(snd_hwdep_t, file->private_data, return -ENXIO);
+	void __user *argp = (void __user *)arg;
 	switch (cmd) {
 	case SNDRV_HWDEP_IOCTL_PVERSION:
-		return put_user(SNDRV_HWDEP_VERSION, (int *)arg);
+		return put_user(SNDRV_HWDEP_VERSION, (int __user *)argp);
 	case SNDRV_HWDEP_IOCTL_INFO:
-		return snd_hwdep_info(hw, (snd_hwdep_info_t *)arg);
+		return snd_hwdep_info(hw, argp);
 	case SNDRV_HWDEP_IOCTL_DSP_STATUS:
-		return snd_hwdep_dsp_status(hw, (snd_hwdep_dsp_status_t *)arg);
+		return snd_hwdep_dsp_status(hw, argp);
 	case SNDRV_HWDEP_IOCTL_DSP_LOAD:
-		return snd_hwdep_dsp_load(hw, (snd_hwdep_dsp_image_t *)arg);
+		return snd_hwdep_dsp_load(hw, argp);
 	}
 	if (hw->ops.ioctl)
 		return hw->ops.ioctl(hw, file, cmd, arg);
@@ -269,7 +270,7 @@
 		{
 			int device;
 
-			if (get_user(device, (int *)arg))
+			if (get_user(device, (int __user *)arg))
 				return -EFAULT;
 			device = device < 0 ? 0 : device + 1;
 			while (device < SNDRV_MINOR_HWDEPS) {
@@ -279,13 +280,13 @@
 			}
 			if (device >= SNDRV_MINOR_HWDEPS)
 				device = -1;
-			if (put_user(device, (int *)arg))
+			if (put_user(device, (int __user *)arg))
 				return -EFAULT;
 			return 0;
 		}
 	case SNDRV_CTL_IOCTL_HWDEP_INFO:
 		{
-			snd_hwdep_info_t *info = (snd_hwdep_info_t *)arg;
+			snd_hwdep_info_t __user *info = (snd_hwdep_info_t __user *)arg;
 			int device;
 			snd_hwdep_t *hwdep;
 
diff -Nru a/sound/core/info.c b/sound/core/info.c
--- a/sound/core/info.c	Tue Jun 15 22:21:03 2004
+++ b/sound/core/info.c	Tue Jun 15 22:21:03 2004
@@ -174,7 +174,7 @@
 	return ret;
 }
 
-static ssize_t snd_info_entry_read(struct file *file, char *buffer,
+static ssize_t snd_info_entry_read(struct file *file, char __user *buffer,
 				   size_t count, loff_t * offset)
 {
 	snd_info_private_data_t *data;
@@ -208,7 +208,7 @@
 	return size;
 }
 
-static ssize_t snd_info_entry_write(struct file *file, const char *buffer,
+static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer,
 				    size_t count, loff_t * offset)
 {
 	snd_info_private_data_t *data;
diff -Nru a/sound/core/init.c b/sound/core/init.c
--- a/sound/core/init.c	Tue Jun 15 22:20:37 2004
+++ b/sound/core/init.c	Tue Jun 15 22:20:37 2004
@@ -26,6 +26,8 @@
 #include <linux/slab.h>
 #include <linux/time.h>
 #include <linux/ctype.h>
+#include <linux/pci.h>
+#include <linux/pm.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/info.h>
@@ -254,6 +256,12 @@
 
 #ifdef CONFIG_PM
 	wake_up(&card->power_sleep);
+#ifdef CONFIG_ISA
+	if (card->pm_dev) {
+		pm_unregister(card->pm_dev);
+		card->pm_dev = NULL;
+	}
+#endif
 #endif
 
 	/* wait, until all devices are ready for the free operation */
@@ -708,4 +716,93 @@
 	remove_wait_queue(&card->power_sleep, &wait);
 	return result;
 }
+
+/**
+ * snd_card_set_pm_callback - set the PCI power-management callbacks
+ * @card: soundcard structure
+ * @suspend: suspend callback function
+ * @resume: resume callback function
+ * @private_data: private data to pass to the callback functions
+ *
+ * Sets the power-management callback functions of the card.
+ * These callbacks are called from ALSA's common PCI suspend/resume
+ * handler and from the control API.
+ */
+int snd_card_set_pm_callback(snd_card_t *card,
+			     int (*suspend)(snd_card_t *, unsigned int),
+			     int (*resume)(snd_card_t *, unsigned int),
+			     void *private_data)
+{
+	card->pm_suspend = suspend;
+	card->pm_resume = resume;
+	card->pm_private_data = private_data;
+	return 0;
+}
+
+static int snd_generic_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
+{
+	snd_card_t *card = dev->data;
+
+	switch (rqst) {
+	case PM_SUSPEND:
+		/* FIXME: the correct state value? */
+		card->pm_suspend(card, 0);
+		break;
+	case PM_RESUME:
+		/* FIXME: the correct state value? */
+		card->pm_resume(card, 0);
+		break;
+	}
+	return 0;
+}
+
+/**
+ * snd_card_set_dev_pm_callback - set the generic power-management callbacks
+ * @card: soundcard structure
+ * @type: PM device type (PM_XXX)
+ * @suspend: suspend callback function
+ * @resume: resume callback function
+ * @private_data: private data to pass to the callback functions
+ *
+ * Registers the power-management and sets the lowlevel callbacks for
+ * the given card with the given PM type.  These callbacks are called
+ * from the ALSA's common PM handler and from the control API.
+ */
+int snd_card_set_dev_pm_callback(snd_card_t *card, int type,
+				 int (*suspend)(snd_card_t *, unsigned int),
+				 int (*resume)(snd_card_t *, unsigned int),
+				 void *private_data)
+{
+	card->pm_dev = pm_register(type, 0, snd_generic_pm_callback);
+	if (! card->pm_dev)
+		return -ENOMEM;
+	card->pm_dev->data = card;
+	snd_card_set_pm_callback(card, suspend, resume, private_data);
+	return 0;
+}
+
+#ifdef CONFIG_PCI
+int snd_card_pci_suspend(struct pci_dev *dev, u32 state)
+{
+	snd_card_t *card = pci_get_drvdata(dev);
+	if (! card || ! card->pm_suspend)
+		return 0;
+	if (card->power_state == SNDRV_CTL_POWER_D3hot)
+		return 0;
+	/* FIXME: correct state value? */
+	return card->pm_suspend(card, 0);
+}
+
+int snd_card_pci_resume(struct pci_dev *dev)
+{
+	snd_card_t *card = pci_get_drvdata(dev);
+	if (! card || ! card->pm_resume)
+		return 0;
+	if (card->power_state == SNDRV_CTL_POWER_D0)
+		return 0;
+	/* FIXME: correct state value? */
+	return card->pm_resume(card, 0);
+}
+#endif
+
 #endif /* CONFIG_PM */
diff -Nru a/sound/core/memalloc.c b/sound/core/memalloc.c
--- a/sound/core/memalloc.c	Tue Jun 15 22:21:04 2004
+++ b/sound/core/memalloc.c	Tue Jun 15 22:21:04 2004
@@ -29,6 +29,7 @@
 #include <linux/slab.h>
 #include <linux/mm.h>
 #include <linux/dma-mapping.h>
+#include <linux/moduleparam.h>
 #include <asm/semaphore.h>
 #include <sound/memalloc.h>
 #ifdef CONFIG_SBUS
@@ -45,7 +46,8 @@
 #define SNDRV_CARDS	8
 #endif
 static int enable[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1};
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+static int boot_devs;
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable cards to allocate buffers.");
 
 /*
@@ -89,32 +91,7 @@
  *  Hacks
  */
 
-static void *snd_dma_alloc_coherent1(struct device *dev, size_t size,
-				     dma_addr_t *dma_handle, int flags)
-{
-	if (dev)
-		return dma_alloc_coherent(dev, size, dma_handle, flags);
-	else /* FIXME: dma_alloc_coherent does't always accept dev=NULL */
-		return pci_alloc_consistent(NULL, size, dma_handle);
-}
-
-static void snd_dma_free_coherent1(struct device *dev, size_t size, void *dma_addr,
-				   dma_addr_t dma_handle)
-{
-	if (dev)
-		return dma_free_coherent(dev, size, dma_addr, dma_handle);
-	else
-		return pci_free_consistent(NULL, size, dma_addr, dma_handle);
-}
-
-#undef dma_alloc_coherent
-#define dma_alloc_coherent snd_dma_alloc_coherent1
-#undef dma_free_coherent
-#define dma_free_coherent snd_dma_free_coherent1
-
-
 #if defined(__i386__) || defined(__ppc__) || defined(__x86_64__)
-
 /*
  * A hack to allocate large buffers via dma_alloc_coherent()
  *
@@ -135,14 +112,17 @@
 					 dma_addr_t *dma_handle, int flags)
 {
 	void *ret;
-	u64 dma_mask;
+	u64 dma_mask, coherent_dma_mask;
 
 	if (dev == NULL || !dev->dma_mask)
 		return dma_alloc_coherent(dev, size, dma_handle, flags);
 	dma_mask = *dev->dma_mask;
+	coherent_dma_mask = dev->coherent_dma_mask;
 	*dev->dma_mask = 0xffffffff; 	/* do without masking */
+	dev->coherent_dma_mask = 0xffffffff; 	/* do without masking */
 	ret = dma_alloc_coherent(dev, size, dma_handle, flags);
 	*dev->dma_mask = dma_mask;	/* restore */
+	dev->coherent_dma_mask = coherent_dma_mask;	/* restore */
 	if (ret) {
 		/* obtained address is out of range? */
 		if (((unsigned long)*dma_handle + size - 1) & ~dma_mask) {
@@ -152,8 +132,12 @@
 		}
 	} else {
 		/* wish to success now with the proper mask... */
-		if (dma_mask != 0xffffffffUL)
+		if (dma_mask != 0xffffffffUL) {
+			/* allocation with GFP_ATOMIC to avoid the long stall */
+			flags &= ~GFP_KERNEL;
+			flags |= GFP_ATOMIC;
 			ret = dma_alloc_coherent(dev, size, dma_handle, flags);
+		}
 	}
 	return ret;
 }
@@ -841,25 +825,6 @@
 module_init(snd_mem_init)
 module_exit(snd_mem_exit)
 
-
-#ifndef MODULE
-
-/* format is: snd-page-alloc=enable */
-
-static int __init snd_mem_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-page-alloc=", snd_mem_setup);
-
-#endif
 
 /*
  * exports
diff -Nru a/sound/core/memory.c b/sound/core/memory.c
--- a/sound/core/memory.c	Tue Jun 15 22:20:36 2004
+++ b/sound/core/memory.c	Tue Jun 15 22:20:36 2004
@@ -307,7 +307,7 @@
  *
  * Returns zero if successful, or non-zero on failure.
  */
-int copy_to_user_fromio(void *dst, unsigned long src, size_t count)
+int copy_to_user_fromio(void __user *dst, unsigned long src, size_t count)
 {
 #if defined(__i386__) || defined(CONFIG_SPARC32)
 	return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0;
@@ -338,7 +338,7 @@
  *
  * Returns zero if successful, or non-zero on failure.
  */
-int copy_from_user_toio(unsigned long dst, const void *src, size_t count)
+int copy_from_user_toio(unsigned long dst, const void __user *src, size_t count)
 {
 #if defined(__i386__) || defined(CONFIG_SPARC32)
 	return copy_from_user((void*)dst, src, count) ? -EFAULT : 0;
diff -Nru a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
--- a/sound/core/oss/mixer_oss.c	Tue Jun 15 22:20:42 2004
+++ b/sound/core/oss/mixer_oss.c	Tue Jun 15 22:20:42 2004
@@ -81,7 +81,7 @@
 }
 
 static int snd_mixer_oss_info(snd_mixer_oss_file_t *fmixer,
-			      mixer_info *_info)
+			      mixer_info __user *_info)
 {
 	snd_card_t *card = fmixer->card;
 	snd_mixer_oss_t *mixer = fmixer->mixer;
@@ -97,7 +97,7 @@
 }
 
 static int snd_mixer_oss_info_obsolete(snd_mixer_oss_file_t *fmixer,
-				       _old_mixer_info *_info)
+				       _old_mixer_info __user *_info)
 {
 	snd_card_t *card = fmixer->card;
 	snd_mixer_oss_t *mixer = fmixer->mixer;
@@ -293,65 +293,67 @@
 
 static int snd_mixer_oss_ioctl1(snd_mixer_oss_file_t *fmixer, unsigned int cmd, unsigned long arg)
 {
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 	int tmp;
 
 	snd_assert(fmixer != NULL, return -ENXIO);
 	if (((cmd >> 8) & 0xff) == 'M') {
 		switch (cmd) {
 		case SOUND_MIXER_INFO:
-			return snd_mixer_oss_info(fmixer, (mixer_info *)arg);
+			return snd_mixer_oss_info(fmixer, argp);
 		case SOUND_OLD_MIXER_INFO:
- 			return snd_mixer_oss_info_obsolete(fmixer, (_old_mixer_info *)arg);
+ 			return snd_mixer_oss_info_obsolete(fmixer, argp);
 		case SOUND_MIXER_WRITE_RECSRC:
-			if (get_user(tmp, (int *)arg))
+			if (get_user(tmp, p))
 				return -EFAULT;
 			tmp = snd_mixer_oss_set_recsrc(fmixer, tmp);
 			if (tmp < 0)
 				return tmp;
-			return put_user(tmp, (int *)arg);
+			return put_user(tmp, p);
 		case OSS_GETVERSION:
-			return put_user(SNDRV_OSS_VERSION, (int *) arg);
+			return put_user(SNDRV_OSS_VERSION, p);
 		case OSS_ALSAEMULVER:
-			return put_user(1, (int *) arg);
+			return put_user(1, p);
 		case SOUND_MIXER_READ_DEVMASK:
 			tmp = snd_mixer_oss_devmask(fmixer);
 			if (tmp < 0)
 				return tmp;
-			return put_user(tmp, (int *)arg);
+			return put_user(tmp, p);
 		case SOUND_MIXER_READ_STEREODEVS:
 			tmp = snd_mixer_oss_stereodevs(fmixer);
 			if (tmp < 0)
 				return tmp;
-			return put_user(tmp, (int *)arg);
+			return put_user(tmp, p);
 		case SOUND_MIXER_READ_RECMASK:
 			tmp = snd_mixer_oss_recmask(fmixer);
 			if (tmp < 0)
 				return tmp;
-			return put_user(tmp, (int *)arg);
+			return put_user(tmp, p);
 		case SOUND_MIXER_READ_CAPS:
 			tmp = snd_mixer_oss_caps(fmixer);
 			if (tmp < 0)
 				return tmp;
-			return put_user(tmp, (int *)arg);
+			return put_user(tmp, p);
 		case SOUND_MIXER_READ_RECSRC:
 			tmp = snd_mixer_oss_get_recsrc(fmixer);
 			if (tmp < 0)
 				return tmp;
-			return put_user(tmp, (int *)arg);
+			return put_user(tmp, p);
 		}
 	}
 	if (cmd & SIOC_IN) {
-		if (get_user(tmp, (int *)arg))
+		if (get_user(tmp, p))
 			return -EFAULT;
 		tmp = snd_mixer_oss_set_volume(fmixer, cmd & 0xff, tmp);
 		if (tmp < 0)
 			return tmp;
-		return put_user(tmp, (int *)arg);
+		return put_user(tmp, p);
 	} else if (cmd & SIOC_OUT) {
 		tmp = snd_mixer_oss_get_volume(fmixer, cmd & 0xff);
 		if (tmp < 0)
 			return tmp;
-		return put_user(tmp, (int *)arg);
+		return put_user(tmp, p);
 	}
 	return -ENXIO;
 }
diff -Nru a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
--- a/sound/core/oss/pcm_oss.c	Tue Jun 15 22:20:44 2004
+++ b/sound/core/oss/pcm_oss.c	Tue Jun 15 22:20:44 2004
@@ -31,6 +31,7 @@
 #include <linux/slab.h>
 #include <linux/time.h>
 #include <linux/vmalloc.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/pcm.h>
@@ -45,17 +46,18 @@
 static int dsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0};
 static int adsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1};
 static int nonblock_open;
+static int boot_devs;
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Abramo Bagnara <abramo@alsa-project.org>");
 MODULE_DESCRIPTION("PCM OSS emulation for ALSA.");
 MODULE_LICENSE("GPL");
-MODULE_PARM(dsp_map, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dsp_map, int, boot_devs, 0444);
 MODULE_PARM_DESC(dsp_map, "PCM device number assigned to 1st OSS device.");
 MODULE_PARM_SYNTAX(dsp_map, "default:0,skill:advanced");
-MODULE_PARM(adsp_map, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(adsp_map, int, boot_devs, 0444);
 MODULE_PARM_DESC(adsp_map, "PCM device number assigned to 2nd OSS device.");
 MODULE_PARM_SYNTAX(adsp_map, "default:1,skill:advanced");
-MODULE_PARM(nonblock_open, "i");
+module_param(nonblock_open, bool, 0644);
 MODULE_PARM_DESC(nonblock_open, "Don't block opening busy PCM devices.");
 MODULE_PARM_SYNTAX(nonblock_open, "default:0,skill:advanced");
 MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_PCM);
@@ -804,7 +806,7 @@
 	return bytes;
 }
 
-static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char *buf, size_t bytes)
+static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __user *buf, size_t bytes)
 {
 	size_t xfer = 0;
 	ssize_t tmp;
@@ -881,7 +883,7 @@
 	return bytes;
 }
 
-static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char *buf, size_t bytes)
+static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *buf, size_t bytes)
 {
 	size_t xfer = 0;
 	ssize_t tmp;
@@ -1065,9 +1067,9 @@
 					snd_pcm_lib_write(substream, runtime->oss.buffer, size1);
 				}
 			} else if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) {
-				void *buffers[runtime->channels];
+				void __user *buffers[runtime->channels];
 				memset(buffers, 0, runtime->channels * sizeof(void *));
-				snd_pcm_lib_writev(substream, (void **)buffers, size);
+				snd_pcm_lib_writev(substream, buffers, size);
 			}
 		}
 		/*
@@ -1466,7 +1468,7 @@
 	return snd_pcm_oss_bytes(substream, delay);
 }
 
-static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info * _info)
+static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct count_info __user * _info)
 {	
 	snd_pcm_substream_t *substream;
 	snd_pcm_runtime_t *runtime;
@@ -1514,21 +1516,21 @@
 		runtime->oss.prev_hw_ptr_interrupt = delay;
 		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
 			snd_pcm_oss_simulate_fill(substream, delay);
-		info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr);
+		info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX;
 	} else {
 		delay = snd_pcm_oss_bytes(substream, delay) + fixup;
 		info.blocks = delay / runtime->oss.period_bytes;
 		if (stream == SNDRV_PCM_STREAM_PLAYBACK)
-			info.bytes = runtime->oss.bytes - delay;
+			info.bytes = (runtime->oss.bytes - delay) & INT_MAX;
 		else
-			info.bytes = runtime->oss.bytes + delay;
+			info.bytes = (runtime->oss.bytes + delay) & INT_MAX;
 	}
 	if (copy_to_user(_info, &info, sizeof(info)))
 		return -EFAULT;
 	return 0;
 }
 
-static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info *_info)
+static int snd_pcm_oss_get_space(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct audio_buf_info __user *_info)
 {
 	snd_pcm_substream_t *substream;
 	snd_pcm_runtime_t *runtime;
@@ -1587,7 +1589,7 @@
 	return 0;
 }
 
-static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc * _info)
+static int snd_pcm_oss_get_mapbuf(snd_pcm_oss_file_t *pcm_oss_file, int stream, struct buffmem_desc __user * _info)
 {
 	// it won't be probably implemented
 	// snd_printd("TODO: snd_pcm_oss_get_mapbuf\n");
@@ -1910,13 +1912,14 @@
                              unsigned int cmd, unsigned long arg)
 {
 	snd_pcm_oss_file_t *pcm_oss_file;
+	int __user *p = (int __user *)arg;
 	int res;
 
 	pcm_oss_file = snd_magic_cast(snd_pcm_oss_file_t, file->private_data, return -ENXIO);
 	if (cmd == OSS_GETVERSION)
-		return put_user(SNDRV_OSS_VERSION, (int *)arg);
+		return put_user(SNDRV_OSS_VERSION, p);
 	if (cmd == OSS_ALSAEMULVER)
-		return put_user(1, (int *)arg);
+		return put_user(1, p);
 #if defined(CONFIG_SND_MIXER_OSS) || (defined(MODULE) && defined(CONFIG_SND_MIXER_OSS_MODULE))
 	if (((cmd >> 8) & 0xff) == 'M')	{	/* mixer ioctl - for OSS compatibility */
 		snd_pcm_substream_t *substream;
@@ -1941,93 +1944,93 @@
 	case SNDCTL_DSP_SYNC:
 		return snd_pcm_oss_sync(pcm_oss_file);
 	case SNDCTL_DSP_SPEED:
-		if (get_user(res, (int *)arg))
+		if (get_user(res, p))
 			return -EFAULT;
 		if ((res = snd_pcm_oss_set_rate(pcm_oss_file, res))<0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SOUND_PCM_READ_RATE:
 		res = snd_pcm_oss_get_rate(pcm_oss_file);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SNDCTL_DSP_STEREO:
-		if (get_user(res, (int *)arg))
+		if (get_user(res, p))
 			return -EFAULT;
 		res = res > 0 ? 2 : 1;
 		if ((res = snd_pcm_oss_set_channels(pcm_oss_file, res)) < 0)
 			return res;
-		return put_user(--res, (int *)arg);
+		return put_user(--res, p);
 	case SNDCTL_DSP_GETBLKSIZE:
 		res = snd_pcm_oss_get_block_size(pcm_oss_file);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SNDCTL_DSP_SETFMT:
-		if (get_user(res, (int *)arg))
+		if (get_user(res, p))
 			return -EFAULT;
 		res = snd_pcm_oss_set_format(pcm_oss_file, res);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SOUND_PCM_READ_BITS:
 		res = snd_pcm_oss_get_format(pcm_oss_file);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SNDCTL_DSP_CHANNELS:
-		if (get_user(res, (int *)arg))
+		if (get_user(res, p))
 			return -EFAULT;
 		res = snd_pcm_oss_set_channels(pcm_oss_file, res);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SOUND_PCM_READ_CHANNELS:
 		res = snd_pcm_oss_get_channels(pcm_oss_file);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SOUND_PCM_WRITE_FILTER:
 	case SOUND_PCM_READ_FILTER:
 		return -EIO;
 	case SNDCTL_DSP_POST:
 		return snd_pcm_oss_post(pcm_oss_file);
 	case SNDCTL_DSP_SUBDIVIDE:
-		if (get_user(res, (int *)arg))
+		if (get_user(res, p))
 			return -EFAULT;
 		res = snd_pcm_oss_set_subdivide(pcm_oss_file, res);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(res, (int *)arg))
+		if (get_user(res, p))
 			return -EFAULT;
 		return snd_pcm_oss_set_fragment(pcm_oss_file, res);
 	case SNDCTL_DSP_GETFMTS:
 		res = snd_pcm_oss_get_formats(pcm_oss_file);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SNDCTL_DSP_GETOSPACE:
 	case SNDCTL_DSP_GETISPACE:
 		return snd_pcm_oss_get_space(pcm_oss_file,
 			cmd == SNDCTL_DSP_GETISPACE ?
 				SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK,
-			(struct audio_buf_info *) arg);
+			(struct audio_buf_info __user *) arg);
 	case SNDCTL_DSP_NONBLOCK:
 		return snd_pcm_oss_nonblock(file);
 	case SNDCTL_DSP_GETCAPS:
 		res = snd_pcm_oss_get_caps(pcm_oss_file);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SNDCTL_DSP_GETTRIGGER:
 		res = snd_pcm_oss_get_trigger(pcm_oss_file);
 		if (res < 0)
 			return res;
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(res, (int *)arg))
+		if (get_user(res, p))
 			return -EFAULT;
 		return snd_pcm_oss_set_trigger(pcm_oss_file, res);
 	case SNDCTL_DSP_GETIPTR:
@@ -2035,13 +2038,13 @@
 		return snd_pcm_oss_get_ptr(pcm_oss_file,
 			cmd == SNDCTL_DSP_GETIPTR ?
 				SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK,
-			(struct count_info *) arg);
+			(struct count_info __user *) arg);
 	case SNDCTL_DSP_MAPINBUF:
 	case SNDCTL_DSP_MAPOUTBUF:
 		return snd_pcm_oss_get_mapbuf(pcm_oss_file,
 			cmd == SNDCTL_DSP_MAPINBUF ?
 				SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK,
-			(struct buffmem_desc *) arg);
+			(struct buffmem_desc __user *) arg);
 	case SNDCTL_DSP_SETSYNCRO:
 		/* stop DMA now.. */
 		return 0;
@@ -2053,10 +2056,10 @@
 		res = snd_pcm_oss_get_odelay(pcm_oss_file);
 		if (res < 0) {
 			/* it's for sure, some broken apps don't check for error codes */
-			put_user(0, (int *)arg);
+			put_user(0, p);
 			return res;
 		}
-		return put_user(res, (int *)arg);
+		return put_user(res, p);
 	case SNDCTL_DSP_PROFILE:
 		return 0;	/* silently ignore */
 	default:
@@ -2065,7 +2068,7 @@
 	return -EINVAL;
 }
 
-static ssize_t snd_pcm_oss_read(struct file *file, char *buf, size_t count, loff_t *offset)
+static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
 {
 	snd_pcm_oss_file_t *pcm_oss_file;
 	snd_pcm_substream_t *substream;
@@ -2085,7 +2088,7 @@
 #endif
 }
 
-static ssize_t snd_pcm_oss_write(struct file *file, const char *buf, size_t count, loff_t *offset)
+static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size_t count, loff_t *offset)
 {
 	snd_pcm_oss_file_t *pcm_oss_file;
 	snd_pcm_substream_t *substream;
@@ -2510,24 +2513,3 @@
 
 module_init(alsa_pcm_oss_init)
 module_exit(alsa_pcm_oss_exit)
-
-#ifndef MODULE
-
-/* format is: snd-pcm-oss=dsp_map,adsp_map[,nonblock_open] */
-
-static int __init alsa_pcm_oss_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&dsp_map[nr_dev]) == 2 &&
-	       get_option(&str,&adsp_map[nr_dev]) == 2);
-	(void)(get_option(&str,&nonblock_open) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-pcm-oss=", alsa_pcm_oss_setup);
-
-#endif /* !MODULE */
diff -Nru a/sound/core/pcm.c b/sound/core/pcm.c
--- a/sound/core/pcm.c	Tue Jun 15 22:21:05 2004
+++ b/sound/core/pcm.c	Tue Jun 15 22:21:05 2004
@@ -55,7 +55,7 @@
 		{
 			int device;
 
-			if (get_user(device, (int *)arg))
+			if (get_user(device, (int __user *)arg))
 				return -EFAULT;
 			device = device < 0 ? 0 : device + 1;
 			while (device < SNDRV_PCM_DEVICES) {
@@ -65,18 +65,19 @@
 			}
 			if (device == SNDRV_PCM_DEVICES)
 				device = -1;
-			if (put_user(device, (int *)arg))
+			if (put_user(device, (int __user *)arg))
 				return -EFAULT;
 			return 0;
 		}
 	case SNDRV_CTL_IOCTL_PCM_INFO:
 		{
-			snd_pcm_info_t *info = (snd_pcm_info_t *)arg;
+			snd_pcm_info_t __user *info;
 			unsigned int device, subdevice;
 			snd_pcm_stream_t stream;
 			snd_pcm_t *pcm;
 			snd_pcm_str_t *pstr;
 			snd_pcm_substream_t *substream;
+			info = (snd_pcm_info_t __user *)arg;
 			if (get_user(device, &info->device))
 				return -EFAULT;
 			if (device >= SNDRV_PCM_DEVICES)
@@ -106,7 +107,7 @@
 		{
 			int val;
 			
-			if (get_user(val, (int *)arg))
+			if (get_user(val, (int __user *)arg))
 				return -EFAULT;
 			control->prefer_pcm_subdevice = val;
 			return 0;
diff -Nru a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
--- a/sound/core/pcm_lib.c	Tue Jun 15 22:20:39 2004
+++ b/sound/core/pcm_lib.c	Tue Jun 15 22:20:39 2004
@@ -2049,12 +2049,12 @@
 
 static int snd_pcm_lib_write_transfer(snd_pcm_substream_t *substream,
 				      unsigned int hwoff,
-				      void *data, unsigned int off,
+				      unsigned long data, unsigned int off,
 				      snd_pcm_uframes_t frames)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
-	char *buf = (char *) data + frames_to_bytes(runtime, off);
+	char __user *buf = (char __user *) data + frames_to_bytes(runtime, off);
 	if (substream->ops->copy) {
 		if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0)
 			return err;
@@ -2068,10 +2068,12 @@
 }
  
 typedef int (*transfer_f)(snd_pcm_substream_t *substream, unsigned int hwoff,
-			  void *data, unsigned int off, snd_pcm_uframes_t size);
+			  unsigned long data, unsigned int off,
+			  snd_pcm_uframes_t size);
 
 static snd_pcm_sframes_t snd_pcm_lib_write1(snd_pcm_substream_t *substream, 
-					    const void *data, snd_pcm_uframes_t size,
+					    unsigned long data,
+					    snd_pcm_uframes_t size,
 					    int nonblock,
 					    transfer_f transfer)
 {
@@ -2186,7 +2188,7 @@
 		appl_ptr = runtime->control->appl_ptr;
 		appl_ofs = appl_ptr % runtime->buffer_size;
 		snd_pcm_stream_unlock_irq(substream);
-		if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0)
+		if ((err = transfer(substream, appl_ofs, data, offset, frames)) < 0)
 			goto _end;
 		snd_pcm_stream_lock_irq(substream);
 		switch (runtime->status->state) {
@@ -2227,7 +2229,7 @@
 	return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
 }
 
-snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void *buf, snd_pcm_uframes_t size)
+snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream, const void __user *buf, snd_pcm_uframes_t size)
 {
 	snd_pcm_runtime_t *runtime;
 	int nonblock;
@@ -2256,18 +2258,18 @@
 	if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED &&
 	    runtime->channels > 1)
 		return -EINVAL;
-	return snd_pcm_lib_write1(substream, buf, size, nonblock,
+	return snd_pcm_lib_write1(substream, (unsigned long)buf, size, nonblock,
 				  snd_pcm_lib_write_transfer);
 }
 
 static int snd_pcm_lib_writev_transfer(snd_pcm_substream_t *substream,
 				       unsigned int hwoff,
-				       void *data, unsigned int off,
+				       unsigned long data, unsigned int off,
 				       snd_pcm_uframes_t frames)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
-	void **bufs = data;
+	void __user **bufs = (void __user **)data;
 	int channels = runtime->channels;
 	int c;
 	if (substream->ops->copy) {
@@ -2277,7 +2279,7 @@
 				if ((err = substream->ops->silence(substream, c, hwoff, frames)) < 0)
 					return err;
 			} else {
-				char *buf = *bufs + samples_to_bytes(runtime, off);
+				char __user *buf = *bufs + samples_to_bytes(runtime, off);
 				if ((err = substream->ops->copy(substream, c, hwoff, buf, frames)) < 0)
 					return err;
 			}
@@ -2291,7 +2293,7 @@
 			if (*bufs == NULL) {
 				snd_pcm_format_set_silence(runtime->format, hwbuf, frames);
 			} else {
-				char *buf = *bufs + samples_to_bytes(runtime, off);
+				char __user *buf = *bufs + samples_to_bytes(runtime, off);
 				if (copy_from_user(hwbuf, buf, samples_to_bytes(runtime, frames)))
 					return -EFAULT;
 			}
@@ -2300,7 +2302,8 @@
 	return 0;
 }
  
-snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream, void **bufs,
+snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream,
+				     void __user **bufs,
 				     snd_pcm_uframes_t frames)
 {
 	snd_pcm_runtime_t *runtime;
@@ -2329,18 +2332,18 @@
 
 	if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED)
 		return -EINVAL;
-	return snd_pcm_lib_write1(substream, bufs, frames, nonblock,
-				  snd_pcm_lib_writev_transfer);
+	return snd_pcm_lib_write1(substream, (unsigned long)bufs, frames,
+				  nonblock, snd_pcm_lib_writev_transfer);
 }
 
 static int snd_pcm_lib_read_transfer(snd_pcm_substream_t *substream, 
 				     unsigned int hwoff,
-				     void *data, unsigned int off,
+				     unsigned long data, unsigned int off,
 				     snd_pcm_uframes_t frames)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
-	char *buf = (char *) data + frames_to_bytes(runtime, off);
+	char __user *buf = (char __user *) data + frames_to_bytes(runtime, off);
 	if (substream->ops->copy) {
 		if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0)
 			return err;
@@ -2353,7 +2356,10 @@
 	return 0;
 }
 
-static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream, void *data, snd_pcm_uframes_t size, int nonblock,
+static snd_pcm_sframes_t snd_pcm_lib_read1(snd_pcm_substream_t *substream,
+					   unsigned long data,
+					   snd_pcm_uframes_t size,
+					   int nonblock,
 					   transfer_f transfer)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
@@ -2481,7 +2487,7 @@
 		appl_ptr = runtime->control->appl_ptr;
 		appl_ofs = appl_ptr % runtime->buffer_size;
 		snd_pcm_stream_unlock_irq(substream);
-		if ((err = transfer(substream, appl_ofs, (void *)data, offset, frames)) < 0)
+		if ((err = transfer(substream, appl_ofs, data, offset, frames)) < 0)
 			goto _end;
 		snd_pcm_stream_lock_irq(substream);
 		switch (runtime->status->state) {
@@ -2516,7 +2522,7 @@
 	return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
 }
 
-snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void *buf, snd_pcm_uframes_t size)
+snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream, void __user *buf, snd_pcm_uframes_t size)
 {
 	snd_pcm_runtime_t *runtime;
 	int nonblock;
@@ -2543,22 +2549,22 @@
 #endif
 	if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED)
 		return -EINVAL;
-	return snd_pcm_lib_read1(substream, buf, size, nonblock, snd_pcm_lib_read_transfer);
+	return snd_pcm_lib_read1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_read_transfer);
 }
 
 static int snd_pcm_lib_readv_transfer(snd_pcm_substream_t *substream,
 				      unsigned int hwoff,
-				      void *data, unsigned int off,
+				      unsigned long data, unsigned int off,
 				      snd_pcm_uframes_t frames)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
-	void **bufs = data;
+	void __user **bufs = (void __user **)data;
 	int channels = runtime->channels;
 	int c;
 	if (substream->ops->copy) {
 		for (c = 0; c < channels; ++c, ++bufs) {
-			char *buf;
+			char __user *buf;
 			if (*bufs == NULL)
 				continue;
 			buf = *bufs + samples_to_bytes(runtime, off);
@@ -2569,7 +2575,8 @@
 		snd_pcm_uframes_t dma_csize = runtime->dma_bytes / channels;
 		snd_assert(runtime->dma_area, return -EFAULT);
 		for (c = 0; c < channels; ++c, ++bufs) {
-			char *hwbuf, *buf;
+			char *hwbuf;
+			char __user *buf;
 			if (*bufs == NULL)
 				continue;
 
@@ -2582,7 +2589,8 @@
 	return 0;
 }
  
-snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream, void **bufs,
+snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream,
+				    void __user **bufs,
 				    snd_pcm_uframes_t frames)
 {
 	snd_pcm_runtime_t *runtime;
@@ -2611,7 +2619,7 @@
 
 	if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED)
 		return -EINVAL;
-	return snd_pcm_lib_read1(substream, bufs, frames, nonblock, snd_pcm_lib_readv_transfer);
+	return snd_pcm_lib_read1(substream, (unsigned long)bufs, frames, nonblock, snd_pcm_lib_readv_transfer);
 }
 
 /*
diff -Nru a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
--- a/sound/core/pcm_memory.c	Tue Jun 15 22:20:42 2004
+++ b/sound/core/pcm_memory.c	Tue Jun 15 22:20:42 2004
@@ -23,18 +23,19 @@
 #include <asm/io.h>
 #include <linux/time.h>
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
 #include <sound/initval.h>
 
 static int preallocate_dma = 1;
-MODULE_PARM(preallocate_dma, "i");
+module_param(preallocate_dma, int, 0444);
 MODULE_PARM_DESC(preallocate_dma, "Preallocate DMA memory when the PCM devices are initialized.");
 MODULE_PARM_SYNTAX(preallocate_dma, SNDRV_BOOLEAN_TRUE_DESC);
 
 static int maximum_substreams = 4;
-MODULE_PARM(maximum_substreams, "i");
+module_param(maximum_substreams, int, 0444);
 MODULE_PARM_DESC(maximum_substreams, "Maximum substreams with preallocated DMA memory.");
 MODULE_PARM_SYNTAX(maximum_substreams, SNDRV_BOOLEAN_TRUE_DESC);
 
@@ -223,9 +224,13 @@
  */
 static inline void setup_pcm_id(snd_pcm_substream_t *subs)
 {
-	if (! subs->dma_device.id)
+	if (! subs->dma_device.id) {
 		subs->dma_device.id = subs->pcm->device << 16 |
 			subs->stream << 8 | (subs->number + 1);
+		if (subs->dma_device.type == SNDRV_DMA_TYPE_CONTINUOUS ||
+		    subs->dma_device.dev == NULL)
+			subs->dma_device.id |= (subs->pcm->card->number + 1) << 24;
+	}
 }
 
 /**
diff -Nru a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
--- a/sound/core/pcm_misc.c	Tue Jun 15 22:20:43 2004
+++ b/sound/core/pcm_misc.c	Tue Jun 15 22:20:43 2004
@@ -230,7 +230,7 @@
 		return 64;
 	case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
 	case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
-		return 24;
+		return 32;
 	case SNDRV_PCM_FORMAT_MU_LAW:
 	case SNDRV_PCM_FORMAT_A_LAW:
 		return 8;
diff -Nru a/sound/core/pcm_native.c b/sound/core/pcm_native.c
--- a/sound/core/pcm_native.c	Tue Jun 15 22:20:39 2004
+++ b/sound/core/pcm_native.c	Tue Jun 15 22:20:39 2004
@@ -56,8 +56,8 @@
 #define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct sndrv_pcm_hw_params_old)
 #define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct sndrv_pcm_hw_params_old)
 
-static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams);
-static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams);
+static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams);
+static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams);
 
 /*
  *
@@ -108,7 +108,7 @@
 	return 0;
 }
 
-int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t * _info)
+int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user * _info)
 {
 	snd_pcm_info_t info;
 	int err = snd_pcm_info(substream, &info);
@@ -302,7 +302,7 @@
 	return 0;
 }
 
-static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * _params)
+static int snd_pcm_hw_refine_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params)
 {
 	snd_pcm_hw_params_t params;
 	int err;
@@ -406,7 +406,7 @@
 	return err;
 }
 
-static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * _params)
+static int snd_pcm_hw_params_user(snd_pcm_substream_t * substream, snd_pcm_hw_params_t __user * _params)
 {
 	snd_pcm_hw_params_t params;
 	int err;
@@ -494,7 +494,7 @@
 	return 0;
 }
 
-static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t * _params)
+static int snd_pcm_sw_params_user(snd_pcm_substream_t * substream, snd_pcm_sw_params_t __user * _params)
 {
 	snd_pcm_sw_params_t params;
 	int err;
@@ -550,7 +550,7 @@
 	return 0;
 }
 
-static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t * _status)
+static int snd_pcm_status_user(snd_pcm_substream_t * substream, snd_pcm_status_t __user * _status)
 {
 	snd_pcm_status_t status;
 	snd_pcm_runtime_t *runtime;
@@ -567,7 +567,7 @@
 	return 0;
 }
 
-static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t * _info)
+static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t __user * _info)
 {
 	snd_pcm_channel_info_t info;
 	snd_pcm_runtime_t *runtime;
@@ -1038,7 +1038,7 @@
 
 	snd_power_lock(card);
 	if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0, substream->ffile)) >= 0)
-		return snd_pcm_action_lock_irq(&snd_pcm_action_resume, substream, 0, 0);
+		res = snd_pcm_action_lock_irq(&snd_pcm_action_resume, substream, 0, 0);
 	snd_power_unlock(card);
 	return res;
 }
@@ -2297,7 +2297,7 @@
 	return err;
 }
 		
-static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t *res)
+static int snd_pcm_delay(snd_pcm_substream_t *substream, snd_pcm_sframes_t __user *res)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
@@ -2335,41 +2335,80 @@
 	return err;
 }
 		
+static int snd_pcm_sync_ptr(snd_pcm_substream_t *substream, struct sndrv_pcm_sync_ptr __user *_sync_ptr)
+{
+	snd_pcm_runtime_t *runtime = substream->runtime;
+	struct sndrv_pcm_sync_ptr sync_ptr;
+	volatile struct sndrv_pcm_mmap_status *status;
+	volatile struct sndrv_pcm_mmap_control *control;
+	int err;
+
+	memset(&sync_ptr, 0, sizeof(sync_ptr));
+	if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags)))
+		return -EFAULT;
+	if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct sndrv_pcm_mmap_control)))
+		return -EFAULT;	
+	status = runtime->status;
+	control = runtime->control;
+	if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) {
+		err = snd_pcm_hwsync(substream);
+		if (err < 0)
+			return err;
+	}
+	snd_pcm_stream_lock_irq(substream);
+	if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_APPL))
+		control->appl_ptr = sync_ptr.c.control.appl_ptr;
+	else
+		sync_ptr.c.control.appl_ptr = control->appl_ptr;
+	if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN))
+		control->avail_min = sync_ptr.c.control.avail_min;
+	else
+		sync_ptr.c.control.avail_min = control->avail_min;
+	sync_ptr.s.status.state = status->state;
+	sync_ptr.s.status.hw_ptr = status->hw_ptr;
+	sync_ptr.s.status.tstamp = status->tstamp;
+	sync_ptr.s.status.suspended_state = status->suspended_state;
+	snd_pcm_stream_unlock_irq(substream);
+	if (copy_to_user(_sync_ptr, &sync_ptr, sizeof(sync_ptr)))
+		return -EFAULT;
+	return 0;
+}
+		
 static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
-				   unsigned int cmd, void *arg);
+				   unsigned int cmd, void __user *arg);
 static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
-				  unsigned int cmd, void *arg);
+				  unsigned int cmd, void __user *arg);
 
 static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream,
-				 unsigned int cmd, void *arg)
+				 unsigned int cmd, void __user *arg)
 {
 	snd_assert(substream != NULL, return -ENXIO);
 
 	switch (cmd) {
 	case SNDRV_PCM_IOCTL_PVERSION:
-		return put_user(SNDRV_PCM_VERSION, (int *)arg) ? -EFAULT : 0;
+		return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0;
 	case SNDRV_PCM_IOCTL_INFO:
-		return snd_pcm_info_user(substream, (snd_pcm_info_t *) arg);
+		return snd_pcm_info_user(substream, arg);
 	case SNDRV_PCM_IOCTL_TSTAMP:
 	{
 		int xarg;
-		if (get_user(xarg, (int *) arg))
+		if (get_user(xarg, (int __user *)arg))
 			return -EFAULT;
 		substream->runtime->tstamp_timespec = xarg ? 1 : 0;
 		return 0;
 	}
 	case SNDRV_PCM_IOCTL_HW_REFINE:
-		return snd_pcm_hw_refine_user(substream, (snd_pcm_hw_params_t *) arg);
+		return snd_pcm_hw_refine_user(substream, arg);
 	case SNDRV_PCM_IOCTL_HW_PARAMS:
-		return snd_pcm_hw_params_user(substream, (snd_pcm_hw_params_t *) arg);
+		return snd_pcm_hw_params_user(substream, arg);
 	case SNDRV_PCM_IOCTL_HW_FREE:
 		return snd_pcm_hw_free(substream);
 	case SNDRV_PCM_IOCTL_SW_PARAMS:
-		return snd_pcm_sw_params_user(substream, (snd_pcm_sw_params_t *) arg);
+		return snd_pcm_sw_params_user(substream, arg);
 	case SNDRV_PCM_IOCTL_STATUS:
-		return snd_pcm_status_user(substream, (snd_pcm_status_t *) arg);
+		return snd_pcm_status_user(substream, arg);
 	case SNDRV_PCM_IOCTL_CHANNEL_INFO:
-		return snd_pcm_channel_info(substream, (snd_pcm_channel_info_t *) arg);
+		return snd_pcm_channel_info(substream, arg);
 	case SNDRV_PCM_IOCTL_PREPARE:
 		return snd_pcm_prepare(substream);
 	case SNDRV_PCM_IOCTL_RESET:
@@ -2377,7 +2416,7 @@
 	case SNDRV_PCM_IOCTL_START:
 		return snd_pcm_action_lock_irq(&snd_pcm_action_start, substream, 0, 0);
 	case SNDRV_PCM_IOCTL_LINK:
-		return snd_pcm_link(substream, (long) arg);
+		return snd_pcm_link(substream, (int)(unsigned long) arg);
 	case SNDRV_PCM_IOCTL_UNLINK:
 		return snd_pcm_unlink(substream);
 	case SNDRV_PCM_IOCTL_RESUME:
@@ -2387,25 +2426,28 @@
 	case SNDRV_PCM_IOCTL_HWSYNC:
 		return snd_pcm_hwsync(substream);
 	case SNDRV_PCM_IOCTL_DELAY:
-		return snd_pcm_delay(substream, (snd_pcm_sframes_t *) arg);
+		return snd_pcm_delay(substream, arg);
+	case SNDRV_PCM_IOCTL_SYNC_PTR:
+		return snd_pcm_sync_ptr(substream, arg);
 	case SNDRV_PCM_IOCTL_HW_REFINE_OLD:
-		return snd_pcm_hw_refine_old_user(substream, (struct sndrv_pcm_hw_params_old *) arg);
+		return snd_pcm_hw_refine_old_user(substream, arg);
 	case SNDRV_PCM_IOCTL_HW_PARAMS_OLD:
-		return snd_pcm_hw_params_old_user(substream, (struct sndrv_pcm_hw_params_old *) arg);
+		return snd_pcm_hw_params_old_user(substream, arg);
 	}
 	snd_printd("unknown ioctl = 0x%x\n", cmd);
 	return -ENOTTY;
 }
 
 static int snd_pcm_playback_ioctl1(snd_pcm_substream_t *substream,
-				   unsigned int cmd, void *arg)
+				   unsigned int cmd, void __user *arg)
 {
 	snd_assert(substream != NULL, return -ENXIO);
 	snd_assert(substream->stream == SNDRV_PCM_STREAM_PLAYBACK, return -EINVAL);
 	switch (cmd) {
 	case SNDRV_PCM_IOCTL_WRITEI_FRAMES:
 	{
-		snd_xferi_t xferi, *_xferi = arg;
+		snd_xferi_t xferi;
+		snd_xferi_t __user *_xferi = arg;
 		snd_pcm_runtime_t *runtime = substream->runtime;
 		snd_pcm_sframes_t result;
 		if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
@@ -2420,9 +2462,10 @@
 	}
 	case SNDRV_PCM_IOCTL_WRITEN_FRAMES:
 	{
-		snd_xfern_t xfern, *_xfern = arg;
+		snd_xfern_t xfern;
+		snd_xfern_t __user *_xfern = arg;
 		snd_pcm_runtime_t *runtime = substream->runtime;
-		void *bufs;
+		void __user **bufs;
 		snd_pcm_sframes_t result;
 		if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
 			return -EBADFD;
@@ -2446,7 +2489,8 @@
 	}
 	case SNDRV_PCM_IOCTL_REWIND:
 	{
-		snd_pcm_uframes_t frames, *_frames = arg;
+		snd_pcm_uframes_t frames;
+		snd_pcm_uframes_t __user *_frames = arg;
 		snd_pcm_sframes_t result;
 		if (get_user(frames, _frames))
 			return -EFAULT;
@@ -2458,7 +2502,8 @@
 	}
 	case SNDRV_PCM_IOCTL_FORWARD:
 	{
-		snd_pcm_uframes_t frames, *_frames = arg;
+		snd_pcm_uframes_t frames;
+		snd_pcm_uframes_t __user *_frames = arg;
 		snd_pcm_sframes_t result;
 		if (get_user(frames, _frames))
 			return -EFAULT;
@@ -2472,7 +2517,7 @@
 	{
 		int res;
 		snd_pcm_stream_lock_irq(substream);
-		res = snd_pcm_pause(substream, (long) arg);
+		res = snd_pcm_pause(substream, (int)(unsigned long)arg);
 		snd_pcm_stream_unlock_irq(substream);
 		return res;
 	}
@@ -2485,14 +2530,15 @@
 }
 
 static int snd_pcm_capture_ioctl1(snd_pcm_substream_t *substream,
-				  unsigned int cmd, void *arg)
+				  unsigned int cmd, void __user *arg)
 {
 	snd_assert(substream != NULL, return -ENXIO);
 	snd_assert(substream->stream == SNDRV_PCM_STREAM_CAPTURE, return -EINVAL);
 	switch (cmd) {
 	case SNDRV_PCM_IOCTL_READI_FRAMES:
 	{
-		snd_xferi_t xferi, *_xferi = arg;
+		snd_xferi_t xferi;
+		snd_xferi_t __user *_xferi = arg;
 		snd_pcm_runtime_t *runtime = substream->runtime;
 		snd_pcm_sframes_t result;
 		if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
@@ -2507,7 +2553,8 @@
 	}
 	case SNDRV_PCM_IOCTL_READN_FRAMES:
 	{
-		snd_xfern_t xfern, *_xfern = arg;
+		snd_xfern_t xfern;
+		snd_xfern_t __user *_xfern = arg;
 		snd_pcm_runtime_t *runtime = substream->runtime;
 		void *bufs;
 		snd_pcm_sframes_t result;
@@ -2533,7 +2580,8 @@
 	}
 	case SNDRV_PCM_IOCTL_REWIND:
 	{
-		snd_pcm_uframes_t frames, *_frames = arg;
+		snd_pcm_uframes_t frames;
+		snd_pcm_uframes_t __user *_frames = arg;
 		snd_pcm_sframes_t result;
 		if (get_user(frames, _frames))
 			return -EFAULT;
@@ -2545,7 +2593,8 @@
 	}
 	case SNDRV_PCM_IOCTL_FORWARD:
 	{
-		snd_pcm_uframes_t frames, *_frames = arg;
+		snd_pcm_uframes_t frames;
+		snd_pcm_uframes_t __user *_frames = arg;
 		snd_pcm_sframes_t result;
 		if (get_user(frames, _frames))
 			return -EFAULT;
@@ -2573,7 +2622,7 @@
 	if (((cmd >> 8) & 0xff) != 'A')
 		return -ENOTTY;
 
-	return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void *) arg);
+	return snd_pcm_playback_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
 }
 
 static int snd_pcm_capture_ioctl(struct inode *inode, struct file *file,
@@ -2586,7 +2635,7 @@
 	if (((cmd >> 8) & 0xff) != 'A')
 		return -ENOTTY;
 
-	return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void *) arg);
+	return snd_pcm_capture_ioctl1(pcm_file->substream, cmd, (void __user *)arg);
 }
 
 int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream,
@@ -2626,7 +2675,7 @@
 	}
 }
 
-static ssize_t snd_pcm_read(struct file *file, char *buf, size_t count, loff_t * offset)
+static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, loff_t * offset)
 {
 	snd_pcm_file_t *pcm_file;
 	snd_pcm_substream_t *substream;
@@ -2648,7 +2697,7 @@
 	return result;
 }
 
-static ssize_t snd_pcm_write(struct file *file, const char *buf, size_t count, loff_t * offset)
+static ssize_t snd_pcm_write(struct file *file, const char __user *buf, size_t count, loff_t * offset)
 {
 	snd_pcm_file_t *pcm_file;
 	snd_pcm_substream_t *substream;
@@ -2684,7 +2733,7 @@
 	snd_pcm_runtime_t *runtime;
 	snd_pcm_sframes_t result;
 	unsigned long i;
-	void **bufs;
+	void __user **bufs;
 	snd_pcm_uframes_t frames;
 
 	pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, return -ENXIO);
@@ -2718,7 +2767,7 @@
 	snd_pcm_runtime_t *runtime;
 	snd_pcm_sframes_t result;
 	unsigned long i;
-	void **bufs;
+	void __user **bufs;
 	snd_pcm_uframes_t frames;
 
 	pcm_file = snd_magic_cast(snd_pcm_file_t, file->private_data, result = -ENXIO; goto end);
@@ -3082,7 +3131,7 @@
 	oparams->fifo_size = params->fifo_size;
 }
 
-static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams)
+static int snd_pcm_hw_refine_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams)
 {
 	snd_pcm_hw_params_t params;
 	struct sndrv_pcm_hw_params_old oparams;
@@ -3097,7 +3146,7 @@
 	return err;
 }
 
-static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old * _oparams)
+static int snd_pcm_hw_params_old_user(snd_pcm_substream_t * substream, struct sndrv_pcm_hw_params_old __user * _oparams)
 {
 	snd_pcm_hw_params_t params;
 	struct sndrv_pcm_hw_params_old oparams;
diff -Nru a/sound/core/rawmidi.c b/sound/core/rawmidi.c
--- a/sound/core/rawmidi.c	Tue Jun 15 22:20:37 2004
+++ b/sound/core/rawmidi.c	Tue Jun 15 22:20:37 2004
@@ -27,6 +27,7 @@
 #include <linux/slab.h>
 #include <linux/time.h>
 #include <linux/wait.h>
+#include <linux/moduleparam.h>
 #include <sound/rawmidi.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -40,10 +41,11 @@
 #ifdef CONFIG_SND_OSSEMUL
 static int midi_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0};
 static int amidi_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1};
-MODULE_PARM(midi_map, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+static int boot_devs;
+module_param_array(midi_map, int, boot_devs, 0444);
 MODULE_PARM_DESC(midi_map, "Raw MIDI device number assigned to 1st OSS device.");
 MODULE_PARM_SYNTAX(midi_map, "default:0,skill:advanced");
-MODULE_PARM(amidi_map, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(amidi_map, int, boot_devs, 0444);
 MODULE_PARM_DESC(amidi_map, "Raw MIDI device number assigned to 2nd OSS device.");
 MODULE_PARM_SYNTAX(amidi_map, "default:1,skill:advanced");
 #endif /* CONFIG_SND_OSSEMUL */
@@ -541,7 +543,7 @@
 	return 0;
 }
 
-static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t * _info)
+static int snd_rawmidi_info_user(snd_rawmidi_substream_t *substream, snd_rawmidi_info_t __user * _info)
 {
 	snd_rawmidi_info_t info;
 	int err;
@@ -577,7 +579,7 @@
 }
 
 static int snd_rawmidi_info_select_user(snd_card_t *card,
-					snd_rawmidi_info_t *_info)
+					snd_rawmidi_info_t __user *_info)
 {
 	int err;
 	snd_rawmidi_info_t info;
@@ -677,17 +679,18 @@
 			     unsigned int cmd, unsigned long arg)
 {
 	snd_rawmidi_file_t *rfile;
+	void __user *argp = (void __user *)arg;
 
 	rfile = snd_magic_cast(snd_rawmidi_file_t, file->private_data, return -ENXIO);
 	if (((cmd >> 8) & 0xff) != 'W')
 		return -ENOTTY;
 	switch (cmd) {
 	case SNDRV_RAWMIDI_IOCTL_PVERSION:
-		return put_user(SNDRV_RAWMIDI_VERSION, (int *)arg) ? -EFAULT : 0;
+		return put_user(SNDRV_RAWMIDI_VERSION, (int __user *)argp) ? -EFAULT : 0;
 	case SNDRV_RAWMIDI_IOCTL_INFO:
 	{
 		snd_rawmidi_stream_t stream;
-		snd_rawmidi_info_t *info = (snd_rawmidi_info_t *) arg;
+		snd_rawmidi_info_t __user *info = argp;
 		if (get_user(stream, &info->stream))
 			return -EFAULT;
 		switch (stream) {
@@ -702,7 +705,7 @@
 	case SNDRV_RAWMIDI_IOCTL_PARAMS:
 	{
 		snd_rawmidi_params_t params;
-		if (copy_from_user(&params, (snd_rawmidi_params_t *) arg, sizeof(snd_rawmidi_params_t)))
+		if (copy_from_user(&params, argp, sizeof(snd_rawmidi_params_t)))
 			return -EFAULT;
 		switch (params.stream) {
 		case SNDRV_RAWMIDI_STREAM_OUTPUT:
@@ -721,7 +724,7 @@
 	{
 		int err = 0;
 		snd_rawmidi_status_t status;
-		if (copy_from_user(&status, (snd_rawmidi_status_t *) arg, sizeof(snd_rawmidi_status_t)))
+		if (copy_from_user(&status, argp, sizeof(snd_rawmidi_status_t)))
 			return -EFAULT;
 		switch (status.stream) {
 		case SNDRV_RAWMIDI_STREAM_OUTPUT:
@@ -739,14 +742,14 @@
 		}
 		if (err < 0)
 			return err;
-		if (copy_to_user((snd_rawmidi_status_t *) arg, &status, sizeof(snd_rawmidi_status_t)))
+		if (copy_to_user(argp, &status, sizeof(snd_rawmidi_status_t)))
 			return -EFAULT;
 		return 0;
 	}
 	case SNDRV_RAWMIDI_IOCTL_DROP:
 	{
 		int val;
-		if (get_user(val, (long *) arg))
+		if (get_user(val, (long __user *) argp))
 			return -EFAULT;
 		switch (val) {
 		case SNDRV_RAWMIDI_STREAM_OUTPUT:
@@ -760,7 +763,7 @@
 	case SNDRV_RAWMIDI_IOCTL_DRAIN:
 	{
 		int val;
-		if (get_user(val, (long *) arg))
+		if (get_user(val, (long __user *) argp))
 			return -EFAULT;
 		switch (val) {
 		case SNDRV_RAWMIDI_STREAM_OUTPUT:
@@ -786,6 +789,7 @@
 int snd_rawmidi_control_ioctl(snd_card_t * card, snd_ctl_file_t * control,
 			      unsigned int cmd, unsigned long arg)
 {
+	void __user *argp = (void __user *)arg;
 	unsigned int tmp;
 
 	tmp = card->number * SNDRV_RAWMIDI_DEVICES;
@@ -794,7 +798,7 @@
 	{
 		int device;
 		
-		if (get_user(device, (int *)arg))
+		if (get_user(device, (int __user *)argp))
 			return -EFAULT;
 		device = device < 0 ? 0 : device + 1;
 		while (device < SNDRV_RAWMIDI_DEVICES) {
@@ -804,7 +808,7 @@
 		}
 		if (device == SNDRV_RAWMIDI_DEVICES)
 			device = -1;
-		if (put_user(device, (int *)arg))
+		if (put_user(device, (int __user *)argp))
 			return -EFAULT;
 		return 0;
 	}
@@ -812,13 +816,13 @@
 	{
 		int val;
 		
-		if (get_user(val, (int *)arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		control->prefer_rawmidi_subdevice = val;
 		return 0;
 	}
 	case SNDRV_CTL_IOCTL_RAWMIDI_INFO:
-		return snd_rawmidi_info_select_user(card, (snd_rawmidi_info_t *)arg);
+		return snd_rawmidi_info_select_user(card, argp);
 	}
 	return -ENOIOCTLCMD;
 }
@@ -932,7 +936,7 @@
 	return snd_rawmidi_kernel_read1(substream, buf, count, 1);
 }
 
-static ssize_t snd_rawmidi_read(struct file *file, char *buf, size_t count, loff_t *offset)
+static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
 {
 	long result;
 	int count1;
@@ -1164,7 +1168,7 @@
 	return snd_rawmidi_kernel_write1(substream, buf, count, 1);
 }
 
-static ssize_t snd_rawmidi_write(struct file *file, const char *buf, size_t count, loff_t *offset)
+static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size_t count, loff_t *offset)
 {
 	long result, timeout;
 	int count1;
@@ -1636,26 +1640,6 @@
 
 module_init(alsa_rawmidi_init)
 module_exit(alsa_rawmidi_exit)
-
-#ifndef MODULE
-#ifdef CONFIG_SND_OSSEMUL
-/* format is: snd-rawmidi=midi_map,amidi_map */
-
-static int __init alsa_rawmidi_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&midi_map[nr_dev]) == 2 &&
-	       get_option(&str,&amidi_map[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-rawmidi=", alsa_rawmidi_setup);
-#endif /* CONFIG_SND_OSSEMUL */
-#endif /* ifndef MODULE */
 
 EXPORT_SYMBOL(snd_rawmidi_output_params);
 EXPORT_SYMBOL(snd_rawmidi_input_params);
diff -Nru a/sound/core/rtctimer.c b/sound/core/rtctimer.c
--- a/sound/core/rtctimer.c	Tue Jun 15 22:20:44 2004
+++ b/sound/core/rtctimer.c	Tue Jun 15 22:20:44 2004
@@ -25,6 +25,7 @@
 #include <linux/time.h>
 #include <linux/threads.h>
 #include <linux/interrupt.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/timer.h>
 #include <sound/info.h>
@@ -177,21 +178,9 @@
 module_init(rtctimer_init)
 module_exit(rtctimer_exit)
 
-MODULE_PARM(rtctimer_freq, "i");
+module_param(rtctimer_freq, int, 0444);
 MODULE_PARM_DESC(rtctimer_freq, "timer frequency in Hz");
 
 MODULE_LICENSE("GPL");
-
-#ifndef MODULE
-/* format is: snd-rtctimer=freq */
-
-static int __init rtctimer_setup(char *str)
-{
-	(void)(get_option(&str,&rtctimer_freq) == 2);
-	return 1;
-}
-
-__setup("snd-rtctimer=", rtctimer_setup);
-#endif /* ifndef MODULE */
 
 #endif /* CONFIG_RTC || CONFIG_RTC_MODULE */
diff -Nru a/sound/core/seq/instr/ainstr_fm.c b/sound/core/seq/instr/ainstr_fm.c
--- a/sound/core/seq/instr/ainstr_fm.c	Tue Jun 15 22:20:40 2004
+++ b/sound/core/seq/instr/ainstr_fm.c	Tue Jun 15 22:20:40 2004
@@ -35,7 +35,7 @@
 char *snd_seq_fm_id = SNDRV_SEQ_INSTR_ID_OPL2_3;
 
 static int snd_seq_fm_put(void *private_data, snd_seq_kinstr_t *instr,
-			  char *instr_data, long len, int atomic, int cmd)
+			  char __user *instr_data, long len, int atomic, int cmd)
 {
 	fm_instrument_t *ip;
 	fm_xinstrument_t ix;
@@ -77,7 +77,8 @@
 }
 
 static int snd_seq_fm_get(void *private_data, snd_seq_kinstr_t *instr,
-			  char *instr_data, long len, int atomic, int cmd)
+			  char __user *instr_data, long len, int atomic,
+			  int cmd)
 {
 	fm_instrument_t *ip;
 	fm_xinstrument_t ix;
diff -Nru a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c
--- a/sound/core/seq/instr/ainstr_gf1.c	Tue Jun 15 22:20:43 2004
+++ b/sound/core/seq/instr/ainstr_gf1.c	Tue Jun 15 22:20:43 2004
@@ -48,7 +48,7 @@
 
 static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
 					     gf1_instrument_t *ip,
-					     char **data,
+					     char __user **data,
 					     long *len,
 					     int atomic)
 {
@@ -141,7 +141,8 @@
 }
 
 static int snd_seq_gf1_put(void *private_data, snd_seq_kinstr_t *instr,
-			   char *instr_data, long len, int atomic, int cmd)
+			   char __user *instr_data, long len, int atomic,
+			   int cmd)
 {
 	snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data;
 	gf1_instrument_t *ip;
@@ -192,7 +193,7 @@
 
 static int snd_seq_gf1_copy_wave_to_stream(snd_gf1_ops_t *ops,
 					   gf1_instrument_t *ip,
-					   char **data,
+					   char __user **data,
 					   long *len,
 					   int atomic)
 {
@@ -253,7 +254,8 @@
 }
 
 static int snd_seq_gf1_get(void *private_data, snd_seq_kinstr_t *instr,
-			   char *instr_data, long len, int atomic, int cmd)
+			   char __user *instr_data, long len, int atomic,
+			   int cmd)
 {
 	snd_gf1_ops_t *ops = (snd_gf1_ops_t *)private_data;
 	gf1_instrument_t *ip;
diff -Nru a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c
--- a/sound/core/seq/instr/ainstr_iw.c	Tue Jun 15 22:20:40 2004
+++ b/sound/core/seq/instr/ainstr_iw.c	Tue Jun 15 22:20:40 2004
@@ -60,7 +60,7 @@
 					       iwffff_layer_t *lp,
 					       iwffff_env_t *ep,
 					       iwffff_xenv_t *ex,
-					       char **data,
+					       char __user **data,
 					       long *len,
 					       int gfp_mask)
 {
@@ -126,7 +126,7 @@
 
 static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops,
 						iwffff_layer_t *lp,
-					        char **data,
+					        char __user **data,
 					        long *len,
 					        int atomic)
 {
@@ -230,7 +230,8 @@
 }
 
 static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
-			      char *instr_data, long len, int atomic, int cmd)
+			      char __user *instr_data, long len, int atomic,
+			      int cmd)
 {
 	snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data;
 	iwffff_instrument_t *ip;
@@ -350,7 +351,7 @@
 					     iwffff_layer_t *lp,
 					     iwffff_xenv_t *ex,
 					     iwffff_env_t *ep,
-					     char **data,
+					     char __user **data,
 					     long *len)
 {
 	iwffff_env_record_t *rp;
@@ -395,7 +396,7 @@
 
 static int snd_seq_iwffff_copy_wave_to_stream(snd_iwffff_ops_t *ops,
 					      iwffff_layer_t *lp,
-					      char **data,
+					      char __user **data,
 					      long *len,
 					      int atomic)
 {
@@ -449,14 +450,14 @@
 }
 
 static int snd_seq_iwffff_get(void *private_data, snd_seq_kinstr_t *instr,
-			      char *instr_data, long len, int atomic, int cmd)
+			      char __user *instr_data, long len, int atomic, int cmd)
 {
 	snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data;
 	iwffff_instrument_t *ip;
 	iwffff_xinstrument_t ix;
 	iwffff_layer_t *lp;
 	iwffff_xlayer_t lx;
-	char *layer_instr_data;
+	char __user *layer_instr_data;
 	int err;
 	
 	if (cmd != SNDRV_SEQ_INSTR_GET_CMD_FULL)
diff -Nru a/sound/core/seq/instr/ainstr_simple.c b/sound/core/seq/instr/ainstr_simple.c
--- a/sound/core/seq/instr/ainstr_simple.c	Tue Jun 15 22:20:43 2004
+++ b/sound/core/seq/instr/ainstr_simple.c	Tue Jun 15 22:20:43 2004
@@ -55,7 +55,8 @@
 }
 
 static int snd_seq_simple_put(void *private_data, snd_seq_kinstr_t *instr,
-			      char *instr_data, long len, int atomic, int cmd)
+			      char __user *instr_data, long len,
+			      int atomic, int cmd)
 {
 	snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data;
 	simple_instrument_t *ip;
@@ -103,7 +104,8 @@
 }
 
 static int snd_seq_simple_get(void *private_data, snd_seq_kinstr_t *instr,
-			      char *instr_data, long len, int atomic, int cmd)
+			      char __user *instr_data, long len,
+			      int atomic, int cmd)
 {
 	snd_simple_ops_t *ops = (snd_simple_ops_t *)private_data;
 	simple_instrument_t *ip;
diff -Nru a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c
--- a/sound/core/seq/oss/seq_oss.c	Tue Jun 15 22:20:43 2004
+++ b/sound/core/seq/oss/seq_oss.c	Tue Jun 15 22:20:43 2004
@@ -22,6 +22,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/initval.h>
@@ -40,7 +41,7 @@
 MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MUSIC);
 
 #ifdef SNDRV_SEQ_OSS_DEBUG
-MODULE_PARM(seq_oss_debug, "i");
+module_param(seq_oss_debug, int, 0644);
 MODULE_PARM_DESC(seq_oss_debug, "debug option");
 int seq_oss_debug = 0;
 #endif
@@ -56,8 +57,8 @@
 
 static int odev_open(struct inode *inode, struct file *file);
 static int odev_release(struct inode *inode, struct file *file);
-static ssize_t odev_read(struct file *file, char *buf, size_t count, loff_t *offset);
-static ssize_t odev_write(struct file *file, const char *buf, size_t count, loff_t *offset);
+static ssize_t odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset);
+static ssize_t odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset);
 static int odev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
 static unsigned int odev_poll(struct file *file, poll_table * wait);
 #ifdef CONFIG_PROC_FS
@@ -154,7 +155,7 @@
 }
 
 static ssize_t
-odev_read(struct file *file, char *buf, size_t count, loff_t *offset)
+odev_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
 {
 	seq_oss_devinfo_t *dp;
 	dp = file->private_data;
@@ -164,7 +165,7 @@
 
 
 static ssize_t
-odev_write(struct file *file, const char *buf, size_t count, loff_t *offset)
+odev_write(struct file *file, const char __user *buf, size_t count, loff_t *offset)
 {
 	seq_oss_devinfo_t *dp;
 	dp = file->private_data;
diff -Nru a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
--- a/sound/core/seq/oss/seq_oss_init.c	Tue Jun 15 22:20:36 2004
+++ b/sound/core/seq/oss/seq_oss_init.c	Tue Jun 15 22:20:36 2004
@@ -28,17 +28,18 @@
 #include "seq_oss_timer.h"
 #include "seq_oss_event.h"
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 
 /*
  * common variables
  */
-MODULE_PARM(maxqlen, "i");
+static int maxqlen = SNDRV_SEQ_OSS_MAX_QLEN;
+module_param(maxqlen, int, 0444);
 MODULE_PARM_DESC(maxqlen, "maximum queue length");
 
 static int system_client = -1; /* ALSA sequencer client number */
 static int system_port = -1;
 
-int maxqlen = SNDRV_SEQ_OSS_MAX_QLEN;
 static int num_clients;
 static seq_oss_devinfo_t *client_table[SNDRV_SEQ_OSS_MAX_CLIENTS];
 
diff -Nru a/sound/core/seq/oss/seq_oss_ioctl.c b/sound/core/seq/oss/seq_oss_ioctl.c
--- a/sound/core/seq/oss/seq_oss_ioctl.c	Tue Jun 15 22:20:36 2004
+++ b/sound/core/seq/oss/seq_oss_ioctl.c	Tue Jun 15 22:20:36 2004
@@ -36,6 +36,7 @@
 	struct midi_info minf;
 	unsigned char ev[8];
 	void __user *arg = (void __user *)carg;
+	int __user *p = arg;
 	snd_seq_event_t tmpev;
 
 	switch (cmd) {
@@ -72,7 +73,7 @@
 
 	case SNDCTL_SEQ_TESTMIDI:
 		debug_printk(("test midi\n"));
-		if (get_user(dev, (int *)arg))
+		if (get_user(dev, p))
 			return -EFAULT;
 		return snd_seq_oss_midi_open(dp, dev, dp->file_mode);
 
@@ -80,42 +81,42 @@
 		debug_printk(("get in count\n"));
 		if (dp->readq == NULL || ! is_read_mode(dp->file_mode))
 			return 0;
-		return put_user(dp->readq->qlen, (int *)arg) ? -EFAULT : 0;
+		return put_user(dp->readq->qlen, p) ? -EFAULT : 0;
 
 	case SNDCTL_SEQ_GETOUTCOUNT:
 		debug_printk(("get out count\n"));
 		if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)
 			return 0;
-		return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), (int *)arg) ? -EFAULT : 0;
+		return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0;
 
 	case SNDCTL_SEQ_GETTIME:
 		debug_printk(("get time\n"));
-		return put_user(snd_seq_oss_timer_cur_tick(dp->timer), (int *)arg) ? -EFAULT : 0;
+		return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0;
 
 	case SNDCTL_SEQ_RESETSAMPLES:
 		debug_printk(("reset samples\n"));
-		if (get_user(dev, (int *)arg))
+		if (get_user(dev, p))
 			return -EFAULT;
 		return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
 
 	case SNDCTL_SEQ_NRSYNTHS:
 		debug_printk(("nr synths\n"));
-		return put_user(dp->max_synthdev, (int *)arg) ? -EFAULT : 0;
+		return put_user(dp->max_synthdev, p) ? -EFAULT : 0;
 
 	case SNDCTL_SEQ_NRMIDIS:
 		debug_printk(("nr midis\n"));
-		return put_user(dp->max_mididev, (int *)arg) ? -EFAULT : 0;
+		return put_user(dp->max_mididev, p) ? -EFAULT : 0;
 
 	case SNDCTL_SYNTH_MEMAVL:
 		debug_printk(("mem avail\n"));
-		if (get_user(dev, (int *)arg))
+		if (get_user(dev, p))
 			return -EFAULT;
 		val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
-		return put_user(val, (int *)arg) ? -EFAULT : 0;
+		return put_user(val, p) ? -EFAULT : 0;
 
 	case SNDCTL_FM_4OP_ENABLE:
 		debug_printk(("4op\n"));
-		if (get_user(dev, (int *)arg))
+		if (get_user(dev, p))
 			return -EFAULT;
 		snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
 		return 0;
@@ -157,7 +158,7 @@
 		debug_printk(("threshold\n"));
 		if (! is_write_mode(dp->file_mode))
 			return 0;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val < 1)
 			val = 1;
@@ -170,14 +171,14 @@
 		debug_printk(("pretime\n"));
 		if (dp->readq == NULL || !is_read_mode(dp->file_mode))
 			return 0;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val <= 0)
 			val = -1;
 		else
 			val = (HZ * val) / 10;
 		dp->readq->pre_event_timeout = val;
-		return put_user(val, (int *)arg) ? -EFAULT : 0;
+		return put_user(val, p) ? -EFAULT : 0;
 
 	default:
 		debug_printk(("others\n"));
diff -Nru a/sound/core/seq/seq.c b/sound/core/seq/seq.c
--- a/sound/core/seq/seq.c	Tue Jun 15 22:20:43 2004
+++ b/sound/core/seq/seq.c	Tue Jun 15 22:20:43 2004
@@ -21,6 +21,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/initval.h>
 
@@ -34,7 +35,11 @@
 #include "seq_info.h"
 #include <sound/seq_device.h>
 
+#if defined(CONFIG_SND_SEQ_DUMMY_MODULE)
+int seq_client_load[64] = {[0] = SNDRV_SEQ_CLIENT_DUMMY, [1 ... 63] = -1};
+#else
 int seq_client_load[64] = {[0 ... 63] = -1};
+#endif
 int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
 int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
 int seq_default_timer_card = -1;
@@ -48,19 +53,20 @@
 MODULE_CLASSES("{sound}");
 MODULE_SUPPORTED_DEVICE("sound");
 
-MODULE_PARM(seq_client_load, "1-64i");
+static int boot_devs;
+module_param_array(seq_client_load, int, boot_devs, 0444);
 MODULE_PARM_DESC(seq_client_load, "The numbers of global (system) clients to load through kmod.");
-MODULE_PARM(seq_default_timer_class, "i");
+module_param(seq_default_timer_class, int, 0644);
 MODULE_PARM_DESC(seq_default_timer_class, "The default timer class.");
-MODULE_PARM(seq_default_timer_sclass, "i");
+module_param(seq_default_timer_sclass, int, 0644);
 MODULE_PARM_DESC(seq_default_timer_sclass, "The default timer slave class.");
-MODULE_PARM(seq_default_timer_card, "i");
+module_param(seq_default_timer_card, int, 0644);
 MODULE_PARM_DESC(seq_default_timer_card, "The default timer card number.");
-MODULE_PARM(seq_default_timer_device, "i");
+module_param(seq_default_timer_device, int, 0644);
 MODULE_PARM_DESC(seq_default_timer_device, "The default timer device number.");
-MODULE_PARM(seq_default_timer_subdevice, "i");
+module_param(seq_default_timer_subdevice, int, 0644);
 MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice number.");
-MODULE_PARM(seq_default_timer_resolution, "i");
+module_param(seq_default_timer_resolution, int, 0644);
 MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz.");
 
 /*
diff -Nru a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
--- a/sound/core/seq/seq_clientmgr.c	Tue Jun 15 22:20:37 2004
+++ b/sound/core/seq/seq_clientmgr.c	Tue Jun 15 22:20:37 2004
@@ -2154,17 +2154,17 @@
 	switch (cmd) {
 	case SNDRV_SEQ_IOCTL_PVERSION:
 		/* return sequencer version number */
-		return put_user(SNDRV_SEQ_VERSION, (int *)arg) ? -EFAULT : 0;
+		return put_user(SNDRV_SEQ_VERSION, (int __user *)arg) ? -EFAULT : 0;
 	case SNDRV_SEQ_IOCTL_CLIENT_ID:
 		/* return the id of this client */
-		return put_user(client->number, (int *)arg) ? -EFAULT : 0;
+		return put_user(client->number, (int __user *)arg) ? -EFAULT : 0;
 	}
 
 	if (! arg)
 		return -EFAULT;
 	for (p = ioctl_tables; p->cmd; p++) {
 		if (p->cmd == cmd)
-			return p->func(client, (void __user *) arg);
+			return p->func(client, arg);
 	}
 	snd_printd("seq unknown ioctl() 0x%x (type='%c', number=0x%2x)\n",
 		   cmd, _IOC_TYPE(cmd), _IOC_NR(cmd));
@@ -2348,7 +2348,7 @@
  * exported, called by kernel clients to perform same functions as with
  * userland ioctl() 
  */
-int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void __user *arg)
+int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
 {
 	client_t *client;
 	mm_segment_t fs;
diff -Nru a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c
--- a/sound/core/seq/seq_dummy.c	Tue Jun 15 22:20:41 2004
+++ b/sound/core/seq/seq_dummy.c	Tue Jun 15 22:20:41 2004
@@ -21,6 +21,7 @@
 #include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include "seq_clientmgr.h"
 #include <sound/initval.h>
@@ -64,12 +65,14 @@
 MODULE_LICENSE("GPL");
 MODULE_CLASSES("{sound}");
 MODULE_SUPPORTED_DEVICE("sound");
-MODULE_PARM(ports, "i");
+
+static int ports = 1;
+static int duplex = 0;
+
+module_param(ports, int, 0444);
 MODULE_PARM_DESC(ports, "number of ports to be created");
-MODULE_PARM(duplex, "i");
+module_param(duplex, bool, 0444);
 MODULE_PARM_DESC(duplex, "create DUPLEX ports");
-int ports = 1;
-int duplex = 0;
 
 typedef struct snd_seq_dummy_port {
 	int client;
diff -Nru a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
--- a/sound/core/seq/seq_memory.c	Tue Jun 15 22:20:37 2004
+++ b/sound/core/seq/seq_memory.c	Tue Jun 15 22:20:37 2004
@@ -90,7 +90,7 @@
 
 	if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
 		char buf[32];
-		char *curptr = event->data.ext.ptr;
+		char __user *curptr = event->data.ext.ptr;
 		while (len > 0) {
 			int size = sizeof(buf);
 			if (len < size)
diff -Nru a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
--- a/sound/core/seq/seq_midi.c	Tue Jun 15 22:20:44 2004
+++ b/sound/core/seq/seq_midi.c	Tue Jun 15 22:20:44 2004
@@ -31,6 +31,7 @@
 #include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/string.h>
+#include <linux/moduleparam.h>
 #include <asm/semaphore.h>
 #include <sound/core.h>
 #include <sound/rawmidi.h>
@@ -45,10 +46,10 @@
 MODULE_CLASSES("{sound}");
 MODULE_SUPPORTED_DEVICE("sound");
 int output_buffer_size = PAGE_SIZE;
-MODULE_PARM(output_buffer_size, "i");
+module_param(output_buffer_size, int, 0644);
 MODULE_PARM_DESC(output_buffer_size, "Output buffer size in bytes.");
 int input_buffer_size = PAGE_SIZE;
-MODULE_PARM(input_buffer_size, "i");
+module_param(input_buffer_size, int, 0644);
 MODULE_PARM_DESC(input_buffer_size, "Input buffer size in bytes.");
 
 /* data for this midi synth driver */
diff -Nru a/sound/core/sound.c b/sound/core/sound.c
--- a/sound/core/sound.c	Tue Jun 15 22:20:42 2004
+++ b/sound/core/sound.c	Tue Jun 15 22:20:42 2004
@@ -23,6 +23,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/time.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/minors.h>
 #include <sound/info.h>
@@ -45,15 +46,15 @@
 MODULE_LICENSE("GPL");
 MODULE_CLASSES("{sound}");
 MODULE_SUPPORTED_DEVICE("sound");
-MODULE_PARM(major, "i");
+module_param(major, int, 0444);
 MODULE_PARM_DESC(major, "Major # for sound driver.");
 MODULE_PARM_SYNTAX(major, "default:116,skill:devel");
-MODULE_PARM(cards_limit, "i");
+module_param(cards_limit, int, 0444);
 MODULE_PARM_DESC(cards_limit, "Count of auto-loadable soundcards.");
 MODULE_PARM_SYNTAX(cards_limit, "default:8,skill:advanced");
 MODULE_ALIAS_CHARDEV_MAJOR(CONFIG_SND_MAJOR);
 #ifdef CONFIG_DEVFS_FS
-MODULE_PARM(device_mode, "i");
+module_param(device_mode, int, 0444);
 MODULE_PARM_DESC(device_mode, "Device file permission mask for devfs.");
 MODULE_PARM_SYNTAX(device_mode, "default:0666,base:8");
 #endif
@@ -465,6 +466,12 @@
 EXPORT_SYMBOL(snd_card_file_remove);
 #ifdef CONFIG_PM
 EXPORT_SYMBOL(snd_power_wait);
+EXPORT_SYMBOL(snd_card_set_pm_callback);
+EXPORT_SYMBOL(snd_card_set_dev_pm_callback);
+#ifdef CONFIG_PCI
+EXPORT_SYMBOL(snd_card_pci_suspend);
+EXPORT_SYMBOL(snd_card_pci_resume);
+#endif
 #endif
   /* device.c */
 EXPORT_SYMBOL(snd_device_new);
diff -Nru a/sound/core/timer.c b/sound/core/timer.c
--- a/sound/core/timer.c	Tue Jun 15 22:20:42 2004
+++ b/sound/core/timer.c	Tue Jun 15 22:20:42 2004
@@ -24,6 +24,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/time.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/timer.h>
 #include <sound/control.h>
@@ -46,7 +47,7 @@
 MODULE_DESCRIPTION("ALSA timer interface");
 MODULE_LICENSE("GPL");
 MODULE_CLASSES("{sound}");
-MODULE_PARM(timer_limit, "i");
+module_param(timer_limit, int, 0444);
 MODULE_PARM_DESC(timer_limit, "Maximum global timers in system.");
 
 typedef struct {
@@ -1252,7 +1253,7 @@
 	id->subdevice = timer->tmr_subdevice;
 }
 
-static int snd_timer_user_next_device(snd_timer_id_t *_tid)
+static int snd_timer_user_next_device(snd_timer_id_t __user *_tid)
 {
 	snd_timer_id_t id;
 	snd_timer_t *timer;
@@ -1343,7 +1344,7 @@
 	return 0;
 } 
 
-static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t *_ginfo)
+static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t __user *_ginfo)
 {
 	snd_timer_ginfo_t ginfo;
 	snd_timer_id_t tid;
@@ -1381,7 +1382,7 @@
 	return err;
 }
 
-static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t *_gparams)
+static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t __user *_gparams)
 {
 	snd_timer_gparams_t gparams;
 	snd_timer_t *t;
@@ -1407,7 +1408,7 @@
 	return err;
 }
 
-static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t *_gstatus)
+static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t __user *_gstatus)
 {
 	snd_timer_gstatus_t gstatus;
 	snd_timer_id_t tid;
@@ -1436,12 +1437,12 @@
 		err = -ENODEV;
 	}
 	up(&register_mutex);
-	if (err >= 0 && copy_from_user(_gstatus, &gstatus, sizeof(gstatus)))
+	if (err >= 0 && copy_to_user(_gstatus, &gstatus, sizeof(gstatus)))
 		err = -EFAULT;
 	return err;
 }
 
-static int snd_timer_user_tselect(struct file *file, snd_timer_select_t *_tselect)
+static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user *_tselect)
 {
 	snd_timer_user_t *tu;
 	snd_timer_select_t tselect;
@@ -1488,7 +1489,7 @@
 	return 0;
 }
 
-static int snd_timer_user_info(struct file *file, snd_timer_info_t *_info)
+static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info)
 {
 	snd_timer_user_t *tu;
 	snd_timer_info_t info;
@@ -1510,9 +1511,8 @@
 	return 0;
 }
 
-static int snd_timer_user_params(struct file *file, snd_timer_params_t *_params)
+static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_params)
 {
-	unsigned long flags;
 	snd_timer_user_t *tu;
 	snd_timer_params_t params;
 	snd_timer_t *t;
@@ -1548,18 +1548,17 @@
 		goto _end;
 	}
 	snd_timer_stop(tu->timeri);
-	spin_lock_irqsave(&t->lock, flags);
-	if (params.flags & SNDRV_TIMER_PSFLG_AUTO) {
+	spin_lock_irq(&t->lock);
+	tu->timeri->flags &= ~(SNDRV_TIMER_IFLG_AUTO|
+			       SNDRV_TIMER_IFLG_EXCLUSIVE|
+			       SNDRV_TIMER_IFLG_EARLY_EVENT);
+	if (params.flags & SNDRV_TIMER_PSFLG_AUTO)
 		tu->timeri->flags |= SNDRV_TIMER_IFLG_AUTO;
-	} else {
-		tu->timeri->flags &= ~SNDRV_TIMER_IFLG_AUTO;
-	}
-	if (params.flags & SNDRV_TIMER_PSFLG_EXCLUSIVE) {
+	if (params.flags & SNDRV_TIMER_PSFLG_EXCLUSIVE)
 		tu->timeri->flags |= SNDRV_TIMER_IFLG_EXCLUSIVE;
-	} else {
-		tu->timeri->flags &= ~SNDRV_TIMER_IFLG_EXCLUSIVE;
-	}
-	spin_unlock_irqrestore(&t->lock, flags);
+	if (params.flags & SNDRV_TIMER_PSFLG_EARLY_EVENT)
+		tu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT;
+	spin_unlock_irq(&t->lock);
 	if (params.queue_size > 0 && (unsigned int)tu->queue_size != params.queue_size) {
 		if (tu->tread) {
 			ttr = (snd_timer_tread_t *)kmalloc(params.queue_size * sizeof(snd_timer_tread_t), GFP_KERNEL);
@@ -1577,6 +1576,24 @@
 			}
 		}
 	}
+	tu->qhead = tu->qtail = tu->qused = 0;
+	if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) {
+		if (tu->tread) {
+			snd_timer_tread_t tread;
+			tread.event = SNDRV_TIMER_EVENT_EARLY;
+			tread.tstamp.tv_sec = 0;
+			tread.tstamp.tv_nsec = 0;
+			tread.val = 0;
+			snd_timer_user_append_to_tqueue(tu, &tread);
+		} else {
+			snd_timer_read_t *r = &tu->queue[0];
+			r->resolution = 0;
+			r->ticks = 0;
+			tu->qused++;
+			tu->qtail++;
+		}
+		
+	}
 	tu->filter = params.filter;
 	tu->ticks = params.ticks;
 	err = 0;
@@ -1586,9 +1603,8 @@
 	return err;
 }
 
-static int snd_timer_user_status(struct file *file, snd_timer_status_t *_status)
+static int snd_timer_user_status(struct file *file, snd_timer_status_t __user *_status)
 {
-	unsigned long flags;
 	snd_timer_user_t *tu;
 	snd_timer_status_t status;
 	
@@ -1599,9 +1615,9 @@
 	status.resolution = snd_timer_resolution(tu->timeri);
 	status.lost = tu->timeri->lost;
 	status.overrun = tu->overrun;
-	spin_lock_irqsave(&tu->qlock, flags);
+	spin_lock_irq(&tu->qlock);
 	status.queue = tu->qused;
-	spin_unlock_irqrestore(&tu->qlock, flags);
+	spin_unlock_irq(&tu->qlock);
 	if (copy_to_user(_status, &status, sizeof(status)))
 		return -EFAULT;
 	return 0;
@@ -1645,38 +1661,40 @@
 				unsigned int cmd, unsigned long arg)
 {
 	snd_timer_user_t *tu;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 	
 	tu = snd_magic_cast(snd_timer_user_t, file->private_data, return -ENXIO);
 	switch (cmd) {
 	case SNDRV_TIMER_IOCTL_PVERSION:
-		return put_user(SNDRV_TIMER_VERSION, (int *)arg) ? -EFAULT : 0;
+		return put_user(SNDRV_TIMER_VERSION, p) ? -EFAULT : 0;
 	case SNDRV_TIMER_IOCTL_NEXT_DEVICE:
-		return snd_timer_user_next_device((snd_timer_id_t *)arg);
+		return snd_timer_user_next_device(argp);
 	case SNDRV_TIMER_IOCTL_TREAD:
 	{
 		int xarg;
 		
 		if (tu->timeri)		/* too late */
 			return -EBUSY;
-		if (get_user(xarg, (int *) arg))
+		if (get_user(xarg, p))
 			return -EFAULT;
 		tu->tread = xarg ? 1 : 0;
 		return 0;
 	}
 	case SNDRV_TIMER_IOCTL_GINFO:
-		return snd_timer_user_ginfo(file, (snd_timer_ginfo_t *)arg);
+		return snd_timer_user_ginfo(file, argp);
 	case SNDRV_TIMER_IOCTL_GPARAMS:
-		return snd_timer_user_gparams(file, (snd_timer_gparams_t *)arg);
+		return snd_timer_user_gparams(file, argp);
 	case SNDRV_TIMER_IOCTL_GSTATUS:
-		return snd_timer_user_gstatus(file, (snd_timer_gstatus_t *)arg);
+		return snd_timer_user_gstatus(file, argp);
 	case SNDRV_TIMER_IOCTL_SELECT:
-		return snd_timer_user_tselect(file, (snd_timer_select_t *)arg);
+		return snd_timer_user_tselect(file, argp);
 	case SNDRV_TIMER_IOCTL_INFO:
-		return snd_timer_user_info(file, (snd_timer_info_t *)arg);
+		return snd_timer_user_info(file, argp);
 	case SNDRV_TIMER_IOCTL_PARAMS:
-		return snd_timer_user_params(file, (snd_timer_params_t *)arg);
+		return snd_timer_user_params(file, argp);
 	case SNDRV_TIMER_IOCTL_STATUS:
-		return snd_timer_user_status(file, (snd_timer_status_t *)arg);
+		return snd_timer_user_status(file, argp);
 	case SNDRV_TIMER_IOCTL_START:
 		return snd_timer_user_start(file);
 	case SNDRV_TIMER_IOCTL_STOP:
@@ -1699,7 +1717,7 @@
 	return 0;
 }
 
-static ssize_t snd_timer_user_read(struct file *file, char *buffer, size_t count, loff_t *offset)
+static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, size_t count, loff_t *offset)
 {
 	snd_timer_user_t *tu;
 	long result = 0, unit;
@@ -1847,18 +1865,6 @@
 
 module_init(alsa_timer_init)
 module_exit(alsa_timer_exit)
-
-#ifndef MODULE
-/* format is: snd-timer=timer_limit */
-
-static int __init alsa_timer_setup(char *str)
-{
-	(void)(get_option(&str,&timer_limit) == 2);
-	return 1;
-}
-
-__setup("snd-timer=", alsa_timer_setup);
-#endif /* ifndef MODULE */
 
 EXPORT_SYMBOL(snd_timer_open);
 EXPORT_SYMBOL(snd_timer_close);
diff -Nru a/sound/drivers/dummy.c b/sound/drivers/dummy.c
--- a/sound/drivers/dummy.c	Tue Jun 15 22:20:59 2004
+++ b/sound/drivers/dummy.c	Tue Jun 15 22:20:59 2004
@@ -24,11 +24,11 @@
 #include <linux/slab.h>
 #include <linux/time.h>
 #include <linux/wait.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/rawmidi.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -129,23 +129,24 @@
 static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
 static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8};
 //static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for dummy soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for dummy soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable this dummy soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(pcm_devs, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_devs, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_devs, "PCM devices # (0-4) for dummy driver.");
 MODULE_PARM_SYNTAX(pcm_devs, SNDRV_ENABLED ",allows:{{0,4}},default:1,dialog:list");
-MODULE_PARM(pcm_substreams, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_substreams, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-16) for dummy driver.");
 MODULE_PARM_SYNTAX(pcm_substreams, SNDRV_ENABLED ",allows:{{1,16}},default:8,dialog:list");
-//MODULE_PARM(midi_devs, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+//module_param_array(midi_devs, int, boot_devs, 0444);
 //MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver.");
 //MODULE_PARM_SYNTAX(midi_devs, SNDRV_ENABLED ",allows:{{0,2}},default:8,dialog:list");
 
@@ -661,27 +662,3 @@
 
 module_init(alsa_card_dummy_init)
 module_exit(alsa_card_dummy_exit)
-
-#ifndef MODULE
-
-/* format is: snd-dummy=enable,index,id,
-			pcm_devs,pcm_substreams */
-
-static int __init alsa_card_dummy_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_devs[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_substreams[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-dummy=", alsa_card_dummy_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
--- a/sound/drivers/mpu401/mpu401.c	Tue Jun 15 22:20:42 2004
+++ b/sound/drivers/mpu401/mpu401.c	Tue Jun 15 22:20:42 2004
@@ -30,9 +30,9 @@
 #ifdef CONFIG_ACPI_BUS
 #include <acpi/acpi_bus.h>
 #endif
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #ifdef CONFIG_ACPI_BUS
@@ -55,29 +55,30 @@
 #ifdef CONFIG_X86_PC9800
 static int pc98ii[SNDRV_CARDS];				/* PC98-II dauther board */
 #endif
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for MPU-401 device.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for MPU-401 device.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable MPU-401 device.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 #ifdef USE_ACPI_PNP
-MODULE_PARM(acpipnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(acpipnp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(acpipnp, "ACPI PnP detection for MPU-401 device.");
 MODULE_PARM_SYNTAX(acpipnp, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
 #endif
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for MPU-401 device.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
 #ifdef CONFIG_X86_PC9800
-MODULE_PARM(pc98ii, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pc98ii, bool, boot_devs, 0444);
 MODULE_PARM_DESC(pc98ii, "Roland MPU-PC98II support.");
 MODULE_PARM_SYNTAX(pc98ii, SNDRV_BOOLEAN_FALSE_DESC);
 #endif
@@ -303,35 +304,3 @@
 
 module_init(alsa_card_mpu401_init)
 module_exit(alsa_card_mpu401_exit)
-
-#ifndef MODULE
-
-/* format is: snd-mpu401=enable,index,id,acpipnp[,pc98ii],port,irq */
-
-static int __init alsa_card_mpu401_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-#ifdef CONFIG_X86_PC9800
-	       get_option(&str,&pc98ii[nr_dev]) == 2 &&
-#endif
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2);
-#ifdef USE_ACPI_PNP
-	if (pnp != INT_MAX)
-		acpipnp[nr_dev] = pnp;
-#endif
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-mpu401=", alsa_card_mpu401_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
--- a/sound/drivers/mtpav.c	Tue Jun 15 22:20:43 2004
+++ b/sound/drivers/mtpav.c	Tue Jun 15 22:20:43 2004
@@ -55,8 +55,8 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/rawmidi.h>
 #include <linux/delay.h>
@@ -83,19 +83,19 @@
 static int irq = MTPAV_IRQ;		/* 7, 5 */
 static int hwports = MTPAV_MAX_PORTS;	/* use hardware ports 1-8 */
 
-MODULE_PARM(index, "i");
+module_param(index, int, 0444);
 MODULE_PARM_DESC(index, "Index value for MotuMTPAV MIDI.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "s");
+module_param(id, charp, 0444);
 MODULE_PARM_DESC(id, "ID string for MotuMTPAV MIDI.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(port, "l");
+module_param(port, long, 0444);
 MODULE_PARM_DESC(port, "Parallel port # for MotuMTPAV MIDI.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x378},{0x278}},dialog:list");
-MODULE_PARM(irq, "i");
+module_param(irq, int, 0444);
 MODULE_PARM_DESC(irq, "Parallel IRQ # for MotuMTPAV MIDI.");
 MODULE_PARM_SYNTAX(irq,  SNDRV_ENABLED ",allows:{{7},{5}},dialog:list");
-MODULE_PARM(hwports, "i");
+module_param(hwports, int, 0444);
 MODULE_PARM_DESC(hwports, "Hardware ports # for MotuMTPAV MIDI.");
 MODULE_PARM_SYNTAX(hwports, SNDRV_ENABLED ",allows:{{1,8}},dialog:list");
 
@@ -800,25 +800,3 @@
 
 module_init(alsa_card_mtpav_init)
 module_exit(alsa_card_mtpav_exit)
-
-#ifndef MODULE
-
-/* format is: snd-mtpav=enable,index,id,
-			port,irq,hwports */
-
-static int __init alsa_card_mtpav_setup(char *str)
-{
-        int __attribute__ ((__unused__)) enable = 1;
-
-	(void)(get_option(&str,&enable) == 2 &&
-	       get_option(&str,&index) == 2 &&
-	       get_id(&str,&id) == 2 &&
-	       get_option_long(&str,&port) == 2 &&
-	       get_option(&str,&irq) == 2 &&
-	       get_option(&str,&hwports) == 2);
-	return 1;
-}
-
-__setup("snd-mtpav=", alsa_card_mtpav_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c
--- a/sound/drivers/opl3/opl3_oss.c	Tue Jun 15 22:20:36 2004
+++ b/sound/drivers/opl3/opl3_oss.c	Tue Jun 15 22:20:36 2004
@@ -24,7 +24,7 @@
 static int snd_opl3_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure);
 static int snd_opl3_close_seq_oss(snd_seq_oss_arg_t *arg);
 static int snd_opl3_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg);
-static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char *buf, int offs, int count);
+static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char __user *buf, int offs, int count);
 static int snd_opl3_reset_seq_oss(snd_seq_oss_arg_t *arg);
 
 /* */
@@ -207,7 +207,7 @@
 #define SBFM_MAXINSTR	256
 
 static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
-				       const char *buf, int offs, int count)
+				       const char __user *buf, int offs, int count)
 {
 	opl3_t *opl3;
 	int err = -EINVAL;
diff -Nru a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c
--- a/sound/drivers/opl3/opl3_seq.c	Tue Jun 15 22:20:42 2004
+++ b/sound/drivers/opl3/opl3_seq.c	Tue Jun 15 22:20:42 2004
@@ -24,6 +24,7 @@
 
 #include "opl3_voice.h"
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Uros Bizjak <uros@kss-loka.si>");
@@ -32,7 +33,7 @@
 MODULE_CLASSES("{sound}");
 
 int use_internal_drums = 0;
-MODULE_PARM(use_internal_drums, "i");
+module_param(use_internal_drums, bool, 0444);
 MODULE_PARM_DESC(use_internal_drums, "Enable internal OPL2/3 drums.");
 
 int snd_opl3_synth_use_inc(opl3_t * opl3)
diff -Nru a/sound/drivers/opl3/opl3_synth.c b/sound/drivers/opl3/opl3_synth.c
--- a/sound/drivers/opl3/opl3_synth.c	Tue Jun 15 22:20:37 2004
+++ b/sound/drivers/opl3/opl3_synth.c	Tue Jun 15 22:20:37 2004
@@ -94,6 +94,7 @@
 		   unsigned int cmd, unsigned long arg)
 {
 	opl3_t *opl3 = snd_magic_cast(opl3_t, hw->private_data, return -ENXIO);
+	void __user *argp = (void __user *)arg;
 
 	snd_assert(opl3 != NULL, return -EINVAL);
 
@@ -105,7 +106,7 @@
 
 			info.fm_mode = opl3->fm_mode;
 			info.rhythm = opl3->rhythm;
-			if (copy_to_user((snd_dm_fm_info_t *) arg, &info, sizeof(snd_dm_fm_info_t)))
+			if (copy_to_user(argp, &info, sizeof(snd_dm_fm_info_t)))
 				return -EFAULT;
 			return 0;
 		}
@@ -123,7 +124,7 @@
 #endif
 		{
 			snd_dm_fm_note_t note;
-			if (copy_from_user(&note, (snd_dm_fm_note_t *) arg, sizeof(snd_dm_fm_note_t)))
+			if (copy_from_user(&note, argp, sizeof(snd_dm_fm_note_t)))
 				return -EFAULT;
 			return snd_opl3_play_note(opl3, &note);
 		}
@@ -134,7 +135,7 @@
 #endif
 		{
 			snd_dm_fm_voice_t voice;
-			if (copy_from_user(&voice, (snd_dm_fm_voice_t *) arg, sizeof(snd_dm_fm_voice_t)))
+			if (copy_from_user(&voice, argp, sizeof(snd_dm_fm_voice_t)))
 				return -EFAULT;
 			return snd_opl3_set_voice(opl3, &voice);
 		}
@@ -145,7 +146,7 @@
 #endif
 		{
 			snd_dm_fm_params_t params;
-			if (copy_from_user(&params, (snd_dm_fm_params_t *) arg, sizeof(snd_dm_fm_params_t)))
+			if (copy_from_user(&params, argp, sizeof(snd_dm_fm_params_t)))
 				return -EFAULT;
 			return snd_opl3_set_params(opl3, &params);
 		}
diff -Nru a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c
--- a/sound/drivers/opl4/opl4_proc.c	Tue Jun 15 22:21:02 2004
+++ b/sound/drivers/opl4/opl4_proc.c	Tue Jun 15 22:21:02 2004
@@ -50,7 +50,7 @@
 }
 
 static long snd_opl4_mem_proc_read(snd_info_entry_t *entry, void *file_private_data,
-				   struct file *file, char *_buf, long count)
+				   struct file *file, char __user *_buf, long count)
 {
 	opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO);
 	long size;
@@ -76,7 +76,7 @@
 }
 
 static long snd_opl4_mem_proc_write(snd_info_entry_t *entry, void *file_private_data,
-				    struct file *file, const char *_buf, long count)
+				    struct file *file, const char __user *_buf, long count)
 {
 	opl4_t *opl4 = snd_magic_cast(opl4_t, entry->private_data, return -ENXIO);
 	long size;
diff -Nru a/sound/drivers/opl4/opl4_seq.c b/sound/drivers/opl4/opl4_seq.c
--- a/sound/drivers/opl4/opl4_seq.c	Tue Jun 15 22:20:40 2004
+++ b/sound/drivers/opl4/opl4_seq.c	Tue Jun 15 22:20:40 2004
@@ -33,6 +33,7 @@
 
 #include "opl4_local.h"
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
@@ -42,7 +43,7 @@
 
 int volume_boost = 8;
 
-MODULE_PARM(volume_boost, "i");
+module_param(volume_boost, int, 0644);
 MODULE_PARM_DESC(volume_boost, "Additional volume for OPL4 wavetable sounds.");
 MODULE_PARM_SYNTAX(volume_boost, "default:8");
 
diff -Nru a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
--- a/sound/drivers/serial-u16550.c	Tue Jun 15 22:20:37 2004
+++ b/sound/drivers/serial-u16550.c	Tue Jun 15 22:20:37 2004
@@ -35,9 +35,9 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/rawmidi.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <linux/serial_reg.h>
@@ -77,39 +77,40 @@
 static int ins[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};	/* 1 to 16 */
 static int adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS};
 static int droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF };
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Serial MIDI.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Serial MIDI.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable UART16550A chip.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for UART16550A chip.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for UART16550A chip.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(speed, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(speed, int, boot_devs, 0444);
 MODULE_PARM_DESC(speed, "Speed in bauds.");
 MODULE_PARM_SYNTAX(speed, SNDRV_ENABLED ",allows:{9600,19200,38400,57600,115200},dialog:list");
-MODULE_PARM(base, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(base, int, boot_devs, 0444);
 MODULE_PARM_DESC(base, "Base for divisor in bauds.");
 MODULE_PARM_SYNTAX(base, SNDRV_ENABLED ",allows:{57600,115200,230400,460800},dialog:list");
-MODULE_PARM(outs, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(outs, int, boot_devs, 0444);
 MODULE_PARM_DESC(outs, "Number of MIDI outputs.");
-MODULE_PARM(ins, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ins, int, boot_devs, 0444);
 MODULE_PARM_DESC(ins, "Number of MIDI inputs.");
-MODULE_PARM(droponfull, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(droponfull, bool, boot_devs, 0444);
 MODULE_PARM_DESC(droponfull, "Flag to enable drop-on-full buffer mode");
 MODULE_PARM_SYNTAX(droponfull, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 
 MODULE_PARM_SYNTAX(outs, SNDRV_ENABLED ",allows:{{1,16}},dialog:list");
 MODULE_PARM_SYNTAX(ins, SNDRV_ENABLED ",allows:{{1,16}},dialog:list");
-MODULE_PARM(adaptor, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(adaptor, int, boot_devs, 0444);
 MODULE_PARM_DESC(adaptor, "Type of adaptor.");
 MODULE_PARM_SYNTAX(adaptor, SNDRV_ENABLED ",allows:{{0=Soundcanvas,1=MS-124T,2=MS-124W S/A,3=MS-124W M/B,4=Generic}},dialog:list");
 
@@ -987,34 +988,3 @@
 
 module_init(alsa_card_serial_init)
 module_exit(alsa_card_serial_exit)
-
-#ifndef MODULE
-
-/* format is: snd-serial=enable,index,id,
-			 port,irq,speed,base,outs,
- 			 ins,adaptor,droponfull */
-
-static int __init alsa_card_serial_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&speed[nr_dev]) == 2 &&
-	       get_option(&str,&base[nr_dev]) == 2 &&
-	       get_option(&str,&outs[nr_dev]) == 2 &&
-	       get_option(&str,&ins[nr_dev]) == 2 &&
-	       get_option(&str,&adaptor[nr_dev]) == 2 &&
-	       get_option(&str,&droponfull[nr_dev]) == 2 );
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-serial=", alsa_card_serial_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
--- a/sound/drivers/virmidi.c	Tue Jun 15 22:20:38 2004
+++ b/sound/drivers/virmidi.c	Tue Jun 15 22:20:38 2004
@@ -45,10 +45,10 @@
 #include <linux/init.h>
 #include <linux/wait.h>
 #include <linux/sched.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/seq_kernel.h>
 #include <sound/seq_virmidi.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 /* hack: OSS defines midi_devs, so undefine it (versioned symbols) */
@@ -66,17 +66,18 @@
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
 static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for virmidi soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for virmidi soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable this soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(midi_devs, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(midi_devs, int, boot_devs, 0444);
 MODULE_PARM_DESC(midi_devs, "MIDI devices # (1-8)");
 MODULE_PARM_SYNTAX(midi_devs, SNDRV_ENABLED ",allows:{{1,8}}");
 
@@ -162,25 +163,3 @@
 
 module_init(alsa_card_virmidi_init)
 module_exit(alsa_card_virmidi_exit)
-
-#ifndef MODULE
-
-/* format is: snd-virmidi=enable,index,id,midi_devs */
-
-static int __init alsa_card_virmidi_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&midi_devs[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-virmidi=", alsa_card_virmidi_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
--- a/sound/isa/ad1816a/ad1816a.c	Tue Jun 15 22:20:38 2004
+++ b/sound/isa/ad1816a/ad1816a.c	Tue Jun 15 22:20:38 2004
@@ -23,8 +23,8 @@
 #include <linux/time.h>
 #include <linux/wait.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/ad1816a.h>
 #include <sound/mpu401.h>
@@ -56,35 +56,36 @@
 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* Pnp setup */
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* PnP setup */
 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* PnP setup */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ad1816a based soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ad1816a based soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for ad1816a driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ad1816a driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for ad1816a driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for ad1816a driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for ad1816a driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "1st DMA # for ad1816a driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "2nd DMA # for ad1816a driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
 
@@ -323,33 +324,3 @@
 
 module_init(alsa_card_ad1816a_init)
 module_exit(alsa_card_ad1816a_exit)
-
-#ifndef MODULE
-
-/* format is: snd-ad1816a=enable,index,id,port,
-			  mpu_port,fm_port,irq,mpu_irq,
-			  dma1,dma2 */
-
-static int __init alsa_card_ad1816a_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-ad1816a=", alsa_card_ad1816a_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
--- a/sound/isa/ad1848/ad1848.c	Tue Jun 15 22:20:41 2004
+++ b/sound/isa/ad1848/ad1848.c	Tue Jun 15 22:20:41 2004
@@ -25,9 +25,9 @@
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/wait.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/ad1848.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #define chip_t ad1848_t
@@ -47,26 +47,27 @@
 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* 5,7,9,11,12,15 */
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3,5,6,7 */
 static int thinkpad[SNDRV_CARDS];			/* Thinkpad special case */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for AD1848 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for AD1848 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable AD1848 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for AD1848 driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for AD1848 driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for AD1848 driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(thinkpad, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(thinkpad, bool, boot_devs, 0444);
 MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series.");
 MODULE_PARM_SYNTAX(thinkpad,  SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 
@@ -159,29 +160,3 @@
 
 module_init(alsa_card_ad1848_init)
 module_exit(alsa_card_ad1848_exit)
-
-#ifndef MODULE
-
-/* format is: snd-ad1848=enable,index,id,port,
-			 irq,dma1 */
-
-static int __init alsa_card_ad1848_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&thinkpad[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-ad1848=", alsa_card_ad1848_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
--- a/sound/isa/ad1848/ad1848_lib.c	Tue Jun 15 22:21:04 2004
+++ b/sound/isa/ad1848/ad1848_lib.c	Tue Jun 15 22:21:04 2004
@@ -647,12 +647,12 @@
 }
 
 #ifdef CONFIG_PM
-static void snd_ad1848_suspend(ad1848_t *chip) {
-
-	snd_card_t *card = chip->card;
+static int snd_ad1848_suspend(snd_card_t *card, unsigned int state)
+{
+	ad1848_t *chip = snd_magic_cast(ad1848_t, card->pm_private_data, return -EINVAL);
 
 	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
+		return 0;
 
 	snd_pcm_suspend_all(chip->pcm);
 	/* FIXME: save registers? */
@@ -661,14 +661,15 @@
 		snd_ad1848_thinkpad_twiddle(chip, 0);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void snd_ad1848_resume(ad1848_t *chip) {
-
-	snd_card_t *card = chip->card;
+static int snd_ad1848_resume(snd_card_t *card, unsigned int state)
+{
+	ad1848_t *chip = snd_magic_cast(ad1848_t, card->pm_private_data, return -EINVAL);
 
 	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
+		return 0;
 
 	if (chip->thinkpad_flag)
 		snd_ad1848_thinkpad_twiddle(chip, 1);
@@ -676,43 +677,8 @@
 	/* FIXME: restore registers? */
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-/* callback for control API */
-static int snd_ad1848_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	ad1848_t *chip = (ad1848_t *) card->power_state_private_data;
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		snd_ad1848_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		snd_ad1848_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
-
-static int snd_ad1848_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
-{
-	ad1848_t *chip = snd_magic_cast(ad1848_t, dev->data, return 0);
-
-	switch (rqst) {
-	case PM_SUSPEND:
-		snd_ad1848_suspend(chip);
-		break;
-	case PM_RESUME:
-		snd_ad1848_resume(chip);
-		break;
-	}
-	return 0;
-}
-
 #endif /* CONFIG_PM */
 
 static int snd_ad1848_probe(ad1848_t * chip)
@@ -891,10 +857,6 @@
 
 static int snd_ad1848_free(ad1848_t *chip)
 {
-#ifdef CONFIG_PM
-        if (chip->thinkpad_pmstate)
-                pm_unregister(chip->thinkpad_pmstate);
-#endif
 	if (chip->res_port) {
 		release_resource(chip->res_port);
 		kfree_nocheck(chip->res_port);
@@ -973,14 +935,7 @@
 		chip->thinkpad_flag = 1;
 		chip->hardware = AD1848_HW_DETECT; /* reset */
 		snd_ad1848_thinkpad_twiddle(chip, 1);
-#ifdef CONFIG_PM
-		chip->thinkpad_pmstate = pm_register(PM_ISA_DEV, 0, snd_ad1848_pm_callback);
-		if (chip->thinkpad_pmstate) {
-			chip->thinkpad_pmstate->data = chip;
-			card->set_power_state = snd_ad1848_set_power_state; /* callback */
-			card->power_state_private_data = chip;
-		}
-#endif
+		snd_card_set_isa_pm_callback(card, snd_ad1848_suspend, snd_ad1848_resume, chip);
 	}
 
 	if (snd_ad1848_probe(chip) < 0) {
diff -Nru a/sound/isa/als100.c b/sound/isa/als100.c
--- a/sound/isa/als100.c	Tue Jun 15 22:20:37 2004
+++ b/sound/isa/als100.c	Tue Jun 15 22:20:37 2004
@@ -25,8 +25,8 @@
 #include <linux/wait.h>
 #include <linux/time.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
@@ -59,35 +59,36 @@
 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* PnP setup */
 static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* PnP setup */
 static int dma16[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* PnP setup */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for als100 based soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for als100 based soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable als100 based soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for als100 driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for als100 driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for als100 driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for als100 driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for als100 driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma8, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma8, "8-bit DMA # for als100 driver.");
 MODULE_PARM_SYNTAX(dma8, SNDRV_DMA8_DESC);
-MODULE_PARM(dma16, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma16, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma16, "16-bit DMA # for als100 driver.");
 MODULE_PARM_SYNTAX(dma16, SNDRV_DMA16_DESC);
 
@@ -345,33 +346,3 @@
 
 module_init(alsa_card_als100_init)
 module_exit(alsa_card_als100_exit)
-
-#ifndef MODULE
-
-/* format is: snd-als100=enable,index,id,port,
-			 mpu_port,fm_port,irq,mpu_irq,
-			 dma8,dma16 */
-
-static int __init alsa_card_als100_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma8[nr_dev]) == 2 &&
-	       get_option(&str,&dma16[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-als100=", alsa_card_als100_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/azt2320.c b/sound/isa/azt2320.c
--- a/sound/isa/azt2320.c	Tue Jun 15 22:21:03 2004
+++ b/sound/isa/azt2320.c	Tue Jun 15 22:21:03 2004
@@ -36,8 +36,8 @@
 #include <linux/time.h>
 #include <linux/wait.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
@@ -68,38 +68,39 @@
 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* Pnp setup */
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* PnP setup */
 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* PnP setup */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for azt2320 based soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for azt2320 based soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable azt2320 based soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for azt2320 driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(wss_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(wss_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(wss_port, "WSS Port # for azt2320 driver.");
 MODULE_PARM_SYNTAX(wss_port, SNDRV_PORT12_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for azt2320 driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for azt2320 driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for azt2320 driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for azt2320 driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "1st DMA # for azt2320 driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "2nd DMA # for azt2320 driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
 
@@ -378,33 +379,3 @@
 
 module_init(alsa_card_azt2320_init)
 module_exit(alsa_card_azt2320_exit)
-
-#ifndef MODULE
-
-/* format is: snd-azt2320=enable,index,id,port,
-			  wss_port,mpu_port,fm_port,
-			  irq,mpu_irq,dma1,dma2 */
-
-static int __init alsa_card_azt2320_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&wss_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-azt2320=", alsa_card_azt2320_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
--- a/sound/isa/cmi8330.c	Tue Jun 15 22:20:37 2004
+++ b/sound/isa/cmi8330.c	Tue Jun 15 22:20:37 2004
@@ -47,10 +47,10 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/ad1848.h>
 #include <sound/sb.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 /*
@@ -79,42 +79,43 @@
 static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
 static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
 static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string  for CMI8330 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable CMI8330 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 #ifdef CONFIG_PNP
-MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(isapnp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard.");
 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
 #endif
 
-MODULE_PARM(sbport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(sbport, long, boot_devs, 0444);
 MODULE_PARM_DESC(sbport, "Port # for CMI8330 SB driver.");
 MODULE_PARM_SYNTAX(sbport, SNDRV_ENABLED ",allows:{{0x220,0x280,0x20}},prefers:{0x220},base:16,dialog:list");
-MODULE_PARM(sbirq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(sbirq, int, boot_devs, 0444);
 MODULE_PARM_DESC(sbirq, "IRQ # for CMI8330 SB driver.");
 MODULE_PARM_SYNTAX(sbirq, SNDRV_ENABLED ",allows:{{5},{7},{9},{10},{11},{12}},prefers:{5},dialog:list");
-MODULE_PARM(sbdma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(sbdma8, int, boot_devs, 0444);
 MODULE_PARM_DESC(sbdma8, "DMA8 for CMI8330 SB driver.");
 MODULE_PARM_SYNTAX(sbdma8, SNDRV_DMA8_DESC ",prefers:{1}");
-MODULE_PARM(sbdma16, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(sbdma16, int, boot_devs, 0444);
 MODULE_PARM_DESC(sbdma16, "DMA16 for CMI8330 SB driver.");
 MODULE_PARM_SYNTAX(sbdma16, SNDRV_ENABLED ",allows:{{5},{7}},prefers:{5},dialog:list");
 
-MODULE_PARM(wssport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(wssport, long, boot_devs, 0444);
 MODULE_PARM_DESC(wssport, "Port # for CMI8330 WSS driver.");
 MODULE_PARM_SYNTAX(wssport, SNDRV_ENABLED ",allows:{{0x530},{0xe80,0xf40,0xc0}},prefers:{0x530},base:16,dialog:list");
-MODULE_PARM(wssirq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(wssirq, int, boot_devs, 0444);
 MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330 WSS driver.");
 MODULE_PARM_SYNTAX(wssirq, SNDRV_ENABLED ",allows:{{5},{7},{9},{10},{11},{12}},prefers:{11},dialog:list");
-MODULE_PARM(wssdma, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(wssdma, int, boot_devs, 0444);
 MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver.");
 MODULE_PARM_SYNTAX(wssdma, SNDRV_DMA8_DESC ",prefers:{0}");
 
@@ -643,41 +644,3 @@
 
 module_init(alsa_card_cmi8330_init)
 module_exit(alsa_card_cmi8330_exit)
-
-#ifndef MODULE
-
-/* format is: snd-cmi8330=enable,index,id,isapnp,
-			  sbport,sbirq,
-			  sbdma8,sbdma16,
-			  wssport,wssirq,
-			  wssdma */
-
-static int __init alsa_card_cmi8330_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-	       get_option_long(&str,&sbport[nr_dev]) == 2 &&
-	       get_option(&str,&sbirq[nr_dev]) == 2 &&
-	       get_option(&str,&sbdma8[nr_dev]) == 2 &&
-	       get_option(&str,&sbdma16[nr_dev]) == 2 &&
-	       get_option_long(&str,&wssport[nr_dev]) == 2 &&
-	       get_option(&str,&wssirq[nr_dev]) == 2 &&
-	       get_option(&str,&wssdma[nr_dev]) == 2);
-#ifdef CONFIG_PNP
-	if (pnp != INT_MAX)
-		isapnp[nr_dev] = pnp;
-#endif
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-cmi8330=", alsa_card_cmi8330_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
--- a/sound/isa/cs423x/cs4231.c	Tue Jun 15 22:20:36 2004
+++ b/sound/isa/cs423x/cs4231.c	Tue Jun 15 22:20:36 2004
@@ -24,10 +24,10 @@
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/wait.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #define chip_t cs4231_t
@@ -47,32 +47,33 @@
 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* 9,11,12,15 */
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3,5,6,7 */
 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3,5,6,7 */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for CS4231 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for CS4231 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable CS4231 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for CS4231 driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for CS4231 driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for CS4231 driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for CS4231 driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for CS4231 driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for CS4231 driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
 
@@ -179,34 +180,3 @@
 
 module_init(alsa_card_cs4231_init)
 module_exit(alsa_card_cs4231_exit)
-
-#ifndef MODULE
-
-/* format is: snd-cs4231=enable,index,id,
-			 port,mpu_port,irq,mpu_irq,
-			 dma1,dma2 */
-
-static int __init alsa_card_cs4231_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-cs4231=", alsa_card_cs4231_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
--- a/sound/isa/cs423x/cs4231_lib.c	Tue Jun 15 22:20:37 2004
+++ b/sound/isa/cs423x/cs4231_lib.c	Tue Jun 15 22:20:37 2004
@@ -979,19 +979,27 @@
 	}		
 	if (chip->single_dma && chip->hardware != CS4231_HW_INTERWAVE) {
 		if (status & CS4231_PLAYBACK_IRQ) {
-			if (chip->mode & CS4231_MODE_PLAY)
-				snd_pcm_period_elapsed(chip->playback_substream);
+			if (chip->mode & CS4231_MODE_PLAY) {
+				if (chip->playback_substream)
+					snd_pcm_period_elapsed(chip->playback_substream);
+			}
 			if (chip->mode & CS4231_MODE_RECORD) {
-				snd_cs4231_overrange(chip);
-				snd_pcm_period_elapsed(chip->capture_substream);
+				if (chip->capture_substream) {
+					snd_cs4231_overrange(chip);
+					snd_pcm_period_elapsed(chip->capture_substream);
+				}
 			}
 		}
 	} else {
-		if (status & CS4231_PLAYBACK_IRQ)
-			snd_pcm_period_elapsed(chip->playback_substream);
+		if (status & CS4231_PLAYBACK_IRQ) {
+			if (chip->playback_substream)
+				snd_pcm_period_elapsed(chip->playback_substream);
+		}
 		if (status & CS4231_RECORD_IRQ) {
-			snd_cs4231_overrange(chip);
-			snd_pcm_period_elapsed(chip->capture_substream);
+			if (chip->capture_substream) {
+				snd_cs4231_overrange(chip);
+				snd_pcm_period_elapsed(chip->capture_substream);
+			}
 		}
 	}
 
@@ -1343,6 +1351,7 @@
 
 #ifdef CONFIG_PM
 
+/* lowlevel suspend callback for CS4231 */
 static void snd_cs4231_suspend(cs4231_t *chip)
 {
 	int reg;
@@ -1354,6 +1363,7 @@
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
 }
 
+/* lowlevel resume callback for CS4231 */
 static void snd_cs4231_resume(cs4231_t *chip)
 {
 	int reg;
@@ -1395,25 +1405,25 @@
 #endif
 }
 
-static int snd_cs4231_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
+static int snd_cs4231_pm_suspend(snd_card_t *card, unsigned int state)
 {
-	cs4231_t *chip = snd_magic_cast(cs4231_t, dev->data, return 0);
-
-	switch (rqst) {
-	case PM_SUSPEND:
-		if (chip->suspend) {
-			snd_pcm_suspend_all(chip->pcm);
-			(*chip->suspend)(chip);
-		}
-		break;
-	case PM_RESUME:
-		if (chip->resume)
-			(*chip->resume)(chip);
-		break;
+	cs4231_t *chip = snd_magic_cast(cs4231_t, card->pm_private_data, return -EINVAL);
+	if (chip->suspend) {
+		chip->suspend(chip);
+		snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
 	}
 	return 0;
 }
 
+static int snd_cs4231_pm_resume(snd_card_t *card, unsigned int state)
+{
+	cs4231_t *chip = snd_magic_cast(cs4231_t, card->pm_private_data, return -EINVAL);
+	if (chip->resume) {
+		chip->resume(chip);
+		snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+	}
+	return 0;
+}
 #endif /* CONFIG_PM */
 
 #ifdef LEGACY_SUPPORT
@@ -1441,10 +1451,6 @@
 		snd_dma_disable(chip->dma2);
 		free_dma(chip->dma2);
 	}
-#ifdef CONFIG_PM
-	if (chip->pm_dev)
-		pm_unregister(chip->pm_dev);
-#endif
 	if (chip->timer)
 		snd_device_free(chip->card, chip->timer);
 	snd_magic_kfree(chip);
@@ -1587,9 +1593,7 @@
 	/* Power Management */
 	chip->suspend = snd_cs4231_suspend;
 	chip->resume = snd_cs4231_resume;
-	chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_cs4231_pm_callback);
-	if (chip->pm_dev)
-		chip->pm_dev->data = chip;
+	snd_card_set_isa_pm_callback(card, snd_cs4231_pm_suspend, snd_cs4231_pm_resume, chip);
 #endif
 
 	*rchip = chip;
@@ -1659,7 +1663,7 @@
 #else
 #  ifdef EBUS_SUPPORT
         if (chip->ebus_flag) {
-                snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_PCI,
+                snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
                 				      chip->dev_u.pdev,
 						      64*1024, 128*1024);
         } else {
diff -Nru a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
--- a/sound/isa/cs423x/cs4236.c	Tue Jun 15 22:20:37 2004
+++ b/sound/isa/cs423x/cs4236.c	Tue Jun 15 22:20:37 2004
@@ -23,11 +23,11 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #define chip_t cs4231_t
@@ -95,46 +95,47 @@
 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* 9,11,12,15 */
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3,5,6,7 */
 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3,5,6,7 */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for " IDENT " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for " IDENT " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable " IDENT " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 #ifdef CONFIG_PNP
-MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(isapnp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard.");
 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
 #endif
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(cport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(cport, long, boot_devs, 0444);
 MODULE_PARM_DESC(cport, "Control port # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(cport, SNDRV_PORT12_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(sb_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(sb_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(sb_port, "SB port # for " IDENT " driver (optional).");
 MODULE_PARM_SYNTAX(sb_port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
 
@@ -198,6 +199,8 @@
 	{ .id = "CSC0225", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
 	/* Intel Marlin Spike Motherboard (#2) - CS4235 */
 	{ .id = "CSC0225", .devs = { { "CSC0100" }, { "CSC0110" }, { "CSC0103" } } },
+	/* Unknown Intel mainboard - CS4235 */
+	{ .id = "CSC0225", .devs = { { "CSC0100" }, { "CSC0110" } } },
 	/* Genius Sound Maker 3DJ - CS4237B */
 	{ .id = "CSC0437", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
 	/* Digital PC 5000 Onboard - CS4236B */
@@ -618,48 +621,3 @@
 
 module_init(alsa_card_cs423x_init)
 module_exit(alsa_card_cs423x_exit)
-
-#ifndef MODULE
-
-/* format is: snd-cs4232=enable,index,id,isapnp,port,
-			 cport,mpu_port,fm_port,sb_port,
-			 irq,mpu_irq,dma1,dma2 */
-/* format is: snd-cs4236=enable,index,id,isapnp,port,
-			 cport,mpu_port,fm_port,sb_port,
-			 irq,mpu_irq,dma1,dma2 */
-
-static int __init alsa_card_cs423x_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&cport[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&sb_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2);
-#ifdef CONFIG_PNP
-	if (pnp != INT_MAX)
-		isapnp[nr_dev] = pnp;
-#endif
-	nr_dev++;
-	return 1;
-}
-
-#ifdef CS4232
-__setup("snd-cs4232=", alsa_card_cs423x_setup);
-#else /* CS4236 */
-__setup("snd-cs4236=", alsa_card_cs423x_setup);
-#endif
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/cs423x/pc98.c b/sound/isa/cs423x/pc98.c
--- a/sound/isa/cs423x/pc98.c	Tue Jun 15 22:20:39 2004
+++ b/sound/isa/cs423x/pc98.c	Tue Jun 15 22:20:39 2004
@@ -25,11 +25,11 @@
 #include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include "sound_pc9800.h"
 
@@ -57,43 +57,44 @@
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3,5,6,7 */
 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3,5,6,7 */
 static int pc98ii[SNDRV_CARDS];				/* PC98II */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for " IDENT " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for " IDENT " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable " IDENT " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
 #if 0 /* NOT USED */
-MODULE_PARM(cport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(cport, long, boot_devs, 0444);
 MODULE_PARM_DESC(cport, "Control port # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(cport, SNDRV_PORT12_DESC);
 #endif
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
-MODULE_PARM(pc98ii, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pc98ii, bool, boot_devs, 0444);
 MODULE_PARM_DESC(pc98ii, "Roland MPU-PC98II support.");
 MODULE_PARM_SYNTAX(pc98ii, SNDRV_BOOLEAN_FALSE_DESC);
 
@@ -435,34 +436,3 @@
 
 module_init(alsa_card_pc98_init)
 module_exit(alsa_card_pc98_exit)
-
-#ifndef MODULE
-
-/* format is: snd-pc98-cs4232=enable,index,id,port,
-			 mpu_port,fm_port,
-			 irq,mpu_irq,dma1,dma2,pc98ii */
-
-static int __init alsa_card_pc98_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2 &&
-	       get_option(&str,&pc98ii[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-pc98-cs4232=", alsa_card_pc98_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/dt019x.c b/sound/isa/dt019x.c
--- a/sound/isa/dt019x.c	Tue Jun 15 22:20:39 2004
+++ b/sound/isa/dt019x.c	Tue Jun 15 22:20:39 2004
@@ -26,8 +26,8 @@
 #include <linux/sched.h>
 #include <linux/wait.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
@@ -53,32 +53,33 @@
 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* PnP setup */
 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* PnP setup */
 static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* PnP setup */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for DT-019X based soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for DT-019X based soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable DT-019X based soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for dt019x driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for dt019x driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for dt019x driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for dt019x driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for dt019x driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma8, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma8, "8-bit DMA # for dt019x driver.");
 MODULE_PARM_SYNTAX(dma8, SNDRV_DMA8_DESC);
 
@@ -337,32 +338,3 @@
 
 module_init(alsa_card_dt019x_init)
 module_exit(alsa_card_dt019x_exit)
-
-#ifndef MODULE
-
-/* format is: snd-dt019x=enable,index,id,
-			  port,mpu_port,fm_port,
-			  irq,mpu_irq,dma8,dma8_size */
-
-static int __init alsa_card_dt019x_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma8[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-dt019x=", alsa_card_dt019x_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
--- a/sound/isa/es1688/es1688.c	Tue Jun 15 22:20:38 2004
+++ b/sound/isa/es1688/es1688.c	Tue Jun 15 22:20:38 2004
@@ -24,6 +24,7 @@
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/wait.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/es1688.h>
 #include <sound/mpu401.h>
@@ -31,7 +32,6 @@
 #define SNDRV_LEGACY_AUTO_PROBE
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -51,29 +51,30 @@
 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* 5,7,9,10 */
 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* 5,7,9,10 */
 static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3 */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ESx688 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ESx688 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable ESx688 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for ESx688 driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ESx688 driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for ESx688 driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for ESx688 driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma8, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma8, "8-bit DMA # for ESx688 driver.");
 MODULE_PARM_SYNTAX(dma8, SNDRV_DMA8_DESC);
 
@@ -211,32 +212,3 @@
 
 module_init(alsa_card_es1688_init)
 module_exit(alsa_card_es1688_exit)
-
-#ifndef MODULE
-
-/* format is: snd-es1688=enable,index,id,
-			 port,mpu_port,
-			 irq,mpu_irq,
-			 dma8 */
-
-static int __init alsa_card_es1688_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma8[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-es1688=", alsa_card_es1688_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/es18xx.c b/sound/isa/es18xx.c
--- a/sound/isa/es18xx.c	Tue Jun 15 22:20:39 2004
+++ b/sound/isa/es18xx.c	Tue Jun 15 22:20:39 2004
@@ -72,6 +72,7 @@
 #include <linux/slab.h>
 #include <linux/pnp.h>
 #include <linux/isapnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -81,7 +82,6 @@
 #define SNDRV_LEGACY_AUTO_PROBE
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #define PFX "es18xx: "
@@ -124,7 +124,6 @@
 	spinlock_t mixer_lock;
 	spinlock_t ctrl_lock;
 #ifdef CONFIG_PM
-	struct pm_dev *pm_dev;
 	unsigned char pm_reg;
 #endif
 };
@@ -1610,12 +1609,9 @@
 
 /* Power Management support functions */
 #ifdef CONFIG_PM
-static void snd_es18xx_suspend(es18xx_t *chip)
+static int snd_es18xx_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
+	es18xx_t *chip = snd_magic_cast(es18xx_t, card->pm_private_data, return -EINVAL);
 
 	snd_pcm_suspend_all(chip->pcm);
 
@@ -1626,63 +1622,23 @@
 	snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_SUS);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void snd_es18xx_resume(es18xx_t *chip)
+static int snd_es18xx_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
+	es18xx_t *chip = snd_magic_cast(es18xx_t, card->pm_private_data, return -EINVAL);
 
 	/* restore PM register, we won't wake till (not 0x07) i/o activity though */
 	snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-/* callback for control API */
-static int snd_es18xx_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	es18xx_t *chip = (es18xx_t *) card->power_state_private_data;
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		snd_es18xx_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		snd_es18xx_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static int snd_es18xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
-{
-	es18xx_t *chip = snd_magic_cast(es18xx_t, dev->data, return 0);
-
-	switch (rqst) {
-	case PM_SUSPEND:
-		snd_es18xx_suspend(chip);
-		break;
-	case PM_RESUME:
-		snd_es18xx_resume(chip);
-		break;
-	}
 	return 0;
 }
 #endif /* CONFIG_PM */
 
 static int snd_es18xx_free(es18xx_t *chip)
 {
-#ifdef CONFIG_PM
-	if (chip->pm_dev)
-		pm_unregister(chip->pm_dev);
-#endif
 	if (chip->res_port) {
 		release_resource(chip->res_port);
 		kfree_nocheck(chip->res_port);
@@ -1900,37 +1856,38 @@
 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* 5,7,9,10 */
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3 */
 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3 */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ES18xx soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ES18xx soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable ES18xx soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 #ifdef CONFIG_PNP
-MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(isapnp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard.");
 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
 #endif
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for ES18xx driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x220,0x280,0x20}},prefers:{0x220},base:16,dialog:list");
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ES18xx driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_ENABLED ",allows:{{0x300,0x330,0x30},{0x800,0xffe,0x2}},prefers:{0x330,0x300},base:16,dialog:combo");
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for ES18xx driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_ENABLED ",allows:{{0x388},{0x800,0xffc,0x4}},prefers:{0x388},base:16,dialog:combo");
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for ES18xx driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC ",prefers:{5}");
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA 1 # for ES18xx driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA8_DESC ",prefers:{1}");
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_ENABLED ",allows:{{0},{1},{3},{5}},dialog:list,prefers:{0}");
 
@@ -2149,16 +2106,9 @@
 		chip->rmidi = rmidi;
 	}
 
-#ifdef CONFIG_PM
 	/* Power Management */
-	chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_es18xx_pm_callback);
-	if (chip->pm_dev) {
-		chip->pm_dev->data = chip;
-		/* set control api callback */
-		card->set_power_state = snd_es18xx_set_power_state;
-		card->power_state_private_data = chip;
-	}
-#endif
+	snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip);
+
 	if ((err = snd_card_register(card)) < 0) {
 		snd_card_free(card);
 		return err;
@@ -2283,39 +2233,3 @@
 
 module_init(alsa_card_es18xx_init)
 module_exit(alsa_card_es18xx_exit)
-
-
-#ifndef MODULE
-
-/* format is: snd-es18xx=enable,index,id,isapnp,
-			 port,mpu_port,fm_port,irq,
-			 dma1,dma2 */
-
-static int __init alsa_card_es18xx_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2);
-#ifdef CONFIG_PNP
-	if (pnp != INT_MAX)
-		isapnp[nr_dev] = pnp;
-#endif
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-es18xx=", alsa_card_es18xx_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/gus/gus_dram.c b/sound/isa/gus/gus_dram.c
--- a/sound/isa/gus/gus_dram.c	Tue Jun 15 22:21:05 2004
+++ b/sound/isa/gus/gus_dram.c	Tue Jun 15 22:21:05 2004
@@ -26,7 +26,7 @@
 #include <sound/info.h>
 
 
-static int snd_gus_dram_poke(snd_gus_card_t *gus, char *_buffer,
+static int snd_gus_dram_poke(snd_gus_card_t *gus, char __user *_buffer,
 			     unsigned int address, unsigned int size)
 {
 	unsigned long flags;
@@ -57,13 +57,13 @@
 }
 
 
-int snd_gus_dram_write(snd_gus_card_t *gus, char *buffer,
+int snd_gus_dram_write(snd_gus_card_t *gus, char __user *buffer,
 		       unsigned int address, unsigned int size)
 {
 	return snd_gus_dram_poke(gus, buffer, address, size);
 }
 
-static int snd_gus_dram_peek(snd_gus_card_t *gus, char *_buffer,
+static int snd_gus_dram_peek(snd_gus_card_t *gus, char __user *_buffer,
 			     unsigned int address, unsigned int size,
 			     int rom)
 {
@@ -95,7 +95,7 @@
 	return 0;
 }
 
-int snd_gus_dram_read(snd_gus_card_t *gus, char *buffer,
+int snd_gus_dram_read(snd_gus_card_t *gus, char __user *buffer,
 		      unsigned int address, unsigned int size,
 		      int rom)
 {
diff -Nru a/sound/isa/gus/gus_instr.c b/sound/isa/gus/gus_instr.c
--- a/sound/isa/gus/gus_instr.c	Tue Jun 15 22:21:05 2004
+++ b/sound/isa/gus/gus_instr.c	Tue Jun 15 22:21:05 2004
@@ -29,7 +29,7 @@
  */
 
 int snd_gus_iwffff_put_sample(void *private_data, iwffff_wave_t *wave,
-			      char *data, long len, int atomic)
+			      char __user *data, long len, int atomic)
 {
 	snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO);
 	snd_gf1_mem_block_t *block;
@@ -59,7 +59,7 @@
 }
 
 int snd_gus_iwffff_get_sample(void *private_data, iwffff_wave_t *wave,
-			      char *data, long len, int atomic)
+			      char __user *data, long len, int atomic)
 {
 	snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO);
 
@@ -82,7 +82,7 @@
  */
 
 int snd_gus_gf1_put_sample(void *private_data, gf1_wave_t *wave,
-			   char *data, long len, int atomic)
+			   char __user *data, long len, int atomic)
 {
 	snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO);
 	snd_gf1_mem_block_t *block;
@@ -110,7 +110,7 @@
 }
 
 int snd_gus_gf1_get_sample(void *private_data, gf1_wave_t *wave,
-			   char *data, long len, int atomic)
+			   char __user *data, long len, int atomic)
 {
 	snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO);
 
@@ -130,7 +130,7 @@
  */
 
 int snd_gus_simple_put_sample(void *private_data, simple_instrument_t *instr,
-			      char *data, long len, int atomic)
+			      char __user *data, long len, int atomic)
 {
 	snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO);
 	snd_gf1_mem_block_t *block;
@@ -157,7 +157,7 @@
 }
 
 int snd_gus_simple_get_sample(void *private_data, simple_instrument_t *instr,
-			      char *data, long len, int atomic)
+			      char __user *data, long len, int atomic)
 {
 	snd_gus_card_t *gus = snd_magic_cast(snd_gus_card_t, private_data, return -ENXIO);
 
diff -Nru a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
--- a/sound/isa/gus/gus_mem_proc.c	Tue Jun 15 22:20:42 2004
+++ b/sound/isa/gus/gus_mem_proc.c	Tue Jun 15 22:20:42 2004
@@ -33,7 +33,7 @@
 } gus_proc_private_t;
 
 static long snd_gf1_mem_proc_dump(snd_info_entry_t *entry, void *file_private_data,
-			          struct file *file, char *buf, long count)
+			          struct file *file, char __user *buf, long count)
 {
 	long size;
 	gus_proc_private_t *priv = snd_magic_cast(gus_proc_private_t, entry->private_data, return -ENXIO);
diff -Nru a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
--- a/sound/isa/gus/gus_pcm.c	Tue Jun 15 22:20:39 2004
+++ b/sound/isa/gus/gus_pcm.c	Tue Jun 15 22:20:39 2004
@@ -346,7 +346,7 @@
 static int snd_gf1_pcm_playback_copy(snd_pcm_substream_t *substream,
 				     int voice,
 				     snd_pcm_uframes_t pos,
-				     void *src,
+				     void __user *src,
 				     snd_pcm_uframes_t count)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
diff -Nru a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
--- a/sound/isa/gus/gusclassic.c	Tue Jun 15 22:21:05 2004
+++ b/sound/isa/gus/gusclassic.c	Tue Jun 15 22:21:05 2004
@@ -24,12 +24,12 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/time.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #define SNDRV_LEGACY_AUTO_PROBE
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -49,35 +49,36 @@
 				/* 0 to 31, (0.59V-4.52V or 0.389V-2.98V) */
 static int channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 24};
 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for GUS Classic soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for GUS Classic soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable GUS Classic soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for GUS Classic driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x220,0x260,0x10}},dialog:list");
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for GUS Classic driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_ENABLED ",allows:{{3},{5},{9},{11},{12},{15}},dialog:list");
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for GUS Classic driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_ENABLED ",allows:{{1},{3},{5},{6},{7}},dialog:list");
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for GUS Classic driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_ENABLED ",allows:{{1},{3},{5},{6},{7}},dialog:list");
-MODULE_PARM(joystick_dac, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick_dac, int, boot_devs, 0444);
 MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for GUS Classic driver.");
 MODULE_PARM_SYNTAX(joystick_dac, SNDRV_ENABLED ",allows:{{0,31}}");
-MODULE_PARM(channels, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(channels, "GF1 channels for GUS Classic driver.");
 MODULE_PARM_SYNTAX(channels,  SNDRV_ENABLED ",allows:{{14,32}}");
-MODULE_PARM(pcm_channels, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Classic driver.");
 MODULE_PARM_SYNTAX(pcm_channels, SNDRV_ENABLED ",allows:{{2,16}}");
 
@@ -269,35 +270,3 @@
 
 module_init(alsa_card_gusclassic_init)
 module_exit(alsa_card_gusclassic_exit)
-
-#ifndef MODULE
-
-/* format is: snd-gusclassic=enable,index,id,
-			     port,irq,
-			     dma1,dma2,
-			     joystick_dac,
-			     channels,pcm_channels */
-
-static int __init alsa_card_gusclassic_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2 &&
-	       get_option(&str,&joystick_dac[nr_dev]) == 2 &&
-	       get_option(&str,&channels[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_channels[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-gusclassic=", alsa_card_gusclassic_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
--- a/sound/isa/gus/gusextreme.c	Tue Jun 15 22:20:42 2004
+++ b/sound/isa/gus/gusextreme.c	Tue Jun 15 22:20:42 2004
@@ -24,6 +24,7 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/time.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/es1688.h>
@@ -32,7 +33,6 @@
 #define SNDRV_LEGACY_AUTO_PROBE
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -56,47 +56,48 @@
 				/* 0 to 31, (0.59V-4.52V or 0.389V-2.98V) */
 static int channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 24};
 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for GUS Extreme soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for GUS Extreme soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable GUS Extreme soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x220,0x260,0x20}},dialog:list");
-MODULE_PARM(gf1_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(gf1_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(gf1_port, "GF1 port # for GUS Extreme driver (optional).");
 MODULE_PARM_SYNTAX(gf1_port, SNDRV_ENABLED ",allows:{{0x210,0x270,0x10}},dialog:list");
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_ENABLED ",allows:{{0x300,0x320,0x10}},dialog:list");
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_ENABLED ",allows:{{5},{7},{9},{10}},dialog:list");
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_ENABLED ",allows:{{5},{7},{9},{10}},dialog:list");
-MODULE_PARM(gf1_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(gf1_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(gf1_irq, "GF1 IRQ # for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(gf1_irq, SNDRV_ENABLED ",allows:{{2},{3},{5},{9},{11},{12},{15}},dialog:list");
-MODULE_PARM(dma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma8, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma8, "8-bit DMA # for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(dma8, SNDRV_DMA8_DESC);
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "GF1 DMA # for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(joystick_dac, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick_dac, int, boot_devs, 0444);
 MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(joystick_dac, SNDRV_ENABLED ",allows:{{0,31}}");
-MODULE_PARM(channels, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(channels, "GF1 channels for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(channels, SNDRV_ENABLED ",allows:{{14,32}}");
-MODULE_PARM(pcm_channels, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Extreme driver.");
 MODULE_PARM_SYNTAX(pcm_channels, SNDRV_ENABLED ",allows:{{2,16}}");
 
@@ -387,37 +388,3 @@
 
 module_init(alsa_card_gusextreme_init)
 module_exit(alsa_card_gusextreme_exit)
-
-#ifndef MODULE
-
-/* format is: snd-gusextreme=enable,index,id,
-			     port,gf1_port,mpu_port,
-			     irq,gf1_irq,mpu_irq,
-			     dma8,dma1,
-			     joystick_dac,
-			     channels,pcm_channels */
-
-static int __init alsa_card_gusextreme_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&gf1_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&gf1_irq[nr_dev]) == 2 &&
-	       get_option(&str,&mpu_irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma8[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-gusextreme=", alsa_card_gusextreme_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
--- a/sound/isa/gus/gusmax.c	Tue Jun 15 22:20:41 2004
+++ b/sound/isa/gus/gusmax.c	Tue Jun 15 22:20:41 2004
@@ -24,13 +24,13 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/time.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/cs4231.h>
 #define SNDRV_LEGACY_AUTO_PROBE
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -50,35 +50,36 @@
 				/* 0 to 31, (0.59V-4.52V or 0.389V-2.98V) */
 static int channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 24};
 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for GUS MAX soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for GUS MAX soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable GUS MAX soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for GUS MAX driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x220},{0x230},{0x240},{0x250},{0x260}},dialog:list");
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for GUS MAX driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_ENABLED ",allows:{{3},{5},{9},{11},{12},{15}},dialog:list");
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for GUS MAX driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for GUS MAX driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
-MODULE_PARM(joystick_dac, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick_dac, int, boot_devs, 0444);
 MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for GUS MAX driver.");
 MODULE_PARM_SYNTAX(joystick_dac, SNDRV_ENABLED ",allows:{{0,31}}");
-MODULE_PARM(channels, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(channels, "Used GF1 channels for GUS MAX driver.");
 MODULE_PARM_SYNTAX(channels, SNDRV_ENABLED ",allows:{{14,32}}");
-MODULE_PARM(pcm_channels, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS MAX driver.");
 MODULE_PARM_SYNTAX(pcm_channels, SNDRV_ENABLED ",allows:{{2,16}}");
 
@@ -409,35 +410,3 @@
 
 module_init(alsa_card_gusmax_init)
 module_exit(alsa_card_gusmax_exit)
-
-#ifndef MODULE
-
-/* format is: snd-gusmax=enable,index,id,
-			 port,irq,
-			 dma1,dma2,
-			 joystick_dac,
-			 channels,pcm_channels */
-
-static int __init alsa_card_gusmax_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2 &&
-	       get_option(&str,&joystick_dac[nr_dev]) == 2 &&
-	       get_option(&str,&channels[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_channels[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-gusmax=", alsa_card_gusmax_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
--- a/sound/isa/gus/interwave.c	Tue Jun 15 22:20:41 2004
+++ b/sound/isa/gus/interwave.c	Tue Jun 15 22:20:41 2004
@@ -28,6 +28,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/cs4231.h>
@@ -37,7 +38,6 @@
 #define SNDRV_LEGACY_AUTO_PROBE
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -73,46 +73,47 @@
 static int midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
 static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for InterWave soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for InterWave soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable InterWave soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(isapnp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard.");
 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for InterWave driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x210,0x260,0x10}},dialog:list");
 #ifdef SNDRV_STB
-MODULE_PARM(port_tc, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port_tc, long, boot_devs, 0444);
 MODULE_PARM_DESC(port_tc, "Tone control (TEA6330T - i2c bus) port # for InterWave driver.");
 MODULE_PARM_SYNTAX(port_tc, SNDRV_ENABLED ",allows:{{0x350,0x380,0x10}},dialog:list");
 #endif
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for InterWave driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_ENABLED ",allows:{{3},{5},{9},{11},{12},{15}},dialog:list");
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for InterWave driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for InterWave driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
-MODULE_PARM(joystick_dac, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick_dac, int, boot_devs, 0444);
 MODULE_PARM_DESC(joystick_dac, "Joystick DAC level 0.59V-4.52V or 0.389V-2.98V for InterWave driver.");
 MODULE_PARM_SYNTAX(joystick_dac, SNDRV_ENABLED ",allows:{{0,31}}");
-MODULE_PARM(midi, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(midi, int, boot_devs, 0444);
 MODULE_PARM_DESC(midi, "MIDI UART enable for InterWave driver.");
 MODULE_PARM_SYNTAX(midi, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
-MODULE_PARM(pcm_channels, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for InterWave driver.");
 MODULE_PARM_SYNTAX(pcm_channels, SNDRV_ENABLED ",allows:{{2,16}}");
-MODULE_PARM(effect, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(effect, int, boot_devs, 0444);
 MODULE_PARM_DESC(effect, "Effects enable for InterWave driver.");
 MODULE_PARM_SYNTAX(effect, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
 
@@ -985,49 +986,3 @@
 
 module_init(alsa_card_interwave_init)
 module_exit(alsa_card_interwave_exit)
-
-#ifndef MODULE
-
-/* format is: snd-interwave=enable,index,id,isapnp,
-			    port[,port_tc],irq,
-			    dma1,dma2,
-			    joystick_dac,midi,
-			    pcm_channels,effect */
-
-static int __init alsa_card_interwave_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-#ifdef SNDRV_STB
-	       get_option_long(&str,&port_tc[nr_dev]) == 2 &&
-#endif
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2 &&
-	       get_option(&str,&joystick_dac[nr_dev]) == 2 &&
-	       get_option(&str,&midi[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_channels[nr_dev]) == 2 &&
-	       get_option(&str,&effect[nr_dev]) == 2);
-#ifdef CONFIG_PNP
-	if (pnp != INT_MAX)
-		isapnp[nr_dev] = pnp;
-#endif
-	nr_dev++;
-	return 1;
-}
-
-#ifndef SNDRV_STB
-__setup("snd-interwave=", alsa_card_interwave_setup);
-#else
-__setup("snd-interwave-stb=", alsa_card_interwave_setup);
-#endif
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
--- a/sound/isa/opl3sa2.c	Tue Jun 15 22:21:04 2004
+++ b/sound/isa/opl3sa2.c	Tue Jun 15 22:21:04 2004
@@ -25,11 +25,11 @@
 #include <linux/pm.h>
 #include <linux/slab.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/io.h>
@@ -59,46 +59,47 @@
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 1,3,5,6,7 */
 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 1,3,5,6,7 */
 static int opl3sa3_ymode[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 };   /* 0,1,2,3 */ /*SL Added*/
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for OPL3-SA soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for OPL3-SA soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable OPL3-SA soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 #ifdef CONFIG_PNP
-MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(isapnp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard.");
 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
 #endif
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for OPL3-SA driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0xf86},{0x370},{0x100}},dialog:list");
-MODULE_PARM(sb_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(sb_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(sb_port, "SB port # for OPL3-SA driver.");
 MODULE_PARM_SYNTAX(sb_port, SNDRV_ENABLED ",allows:{{0x220},{0x240},{0x260}},dialog:list");
-MODULE_PARM(wss_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(wss_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(wss_port, "WSS port # for OPL3-SA driver.");
 MODULE_PARM_SYNTAX(wss_port, SNDRV_ENABLED ",allows:{{0x530},{0xe80},{0xf40},{0x604}},dialog:list");
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for OPL3-SA driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_ENABLED ",allows:{{0x388}},dialog:list");
-MODULE_PARM(midi_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(midi_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(midi_port, "MIDI port # for OPL3-SA driver.");
 MODULE_PARM_SYNTAX(midi_port, SNDRV_ENABLED ",allows:{{0x330},{0x300}},dialog:list");
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for OPL3-SA driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_ENABLED ",allows:{{0},{1},{3},{5},{9},{11},{12},{15}},dialog:list");
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for OPL3-SA driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_ENABLED ",allows:{{1},{3},{5},{6},{7}},dialog:list");
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for OPL3-SA driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_ENABLED ",allows:{{1},{3},{5},{6},{7}},dialog:list");
-MODULE_PARM(opl3sa3_ymode, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); /* SL Added */
+module_param_array(opl3sa3_ymode, int, boot_devs, 0444);
 MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi.");
 MODULE_PARM_SYNTAX(opl3sa3_ymode, SNDRV_ENABLED ",allows:{{0,3}},dialog:list");  /* SL Added */
 
@@ -151,7 +152,6 @@
 	snd_kcontrol_t *master_switch;
 	snd_kcontrol_t *master_volume;
 #ifdef CONFIG_PM
-	struct pm_dev *pm_dev;
 	void (*cs4231_suspend)(cs4231_t *);
 	void (*cs4231_resume)(cs4231_t *);
 #endif
@@ -168,6 +168,8 @@
 	{ .id = "YMH0030", .devs = { { "YMH0021" } } },
 	/* Yamaha OPL3-SA2 */
 	{ .id = "YMH0800", .devs = { { "YMH0021" } } },
+	/* Yamaha OPL3-SA2 */
+	{ .id = "YMH0801", .devs = { { "YMH0021" } } },
 	/* NeoMagic MagicWave 3DX */
 	{ .id = "NMX2200", .devs = { { "YMH2210" } } },
 	/* --- */
@@ -547,12 +549,9 @@
 
 /* Power Management support functions */
 #ifdef CONFIG_PM
-static void snd_opl3sa2_suspend(opl3sa2_t *chip)
+static int snd_opl3sa2_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
+	opl3sa2_t *chip = snd_magic_cast(opl3sa2_t, card->pm_private_data, return -EINVAL);
 
 	snd_pcm_suspend_all(chip->cs4231->pcm); /* stop before saving regs */
 	chip->cs4231_suspend(chip->cs4231);
@@ -561,16 +560,14 @@
 	snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void snd_opl3sa2_resume(opl3sa2_t *chip)
+static int snd_opl3sa2_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	opl3sa2_t *chip = snd_magic_cast(opl3sa2_t, card->pm_private_data, return -EINVAL);
 	int i;
 
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
-
 	/* power up */
 	snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0);
 
@@ -587,43 +584,8 @@
 	chip->cs4231_resume(chip->cs4231);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-/* callback for control API */
-static int snd_opl3sa2_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	opl3sa2_t *chip = (opl3sa2_t *) card->power_state_private_data;
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		snd_opl3sa2_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		snd_opl3sa2_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
-
-static int snd_opl3sa2_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
-{
-	opl3sa2_t *chip = snd_magic_cast(opl3sa2_t, dev->data, return 0);
-
-	switch (rqst) {
-	case PM_SUSPEND:
-		snd_opl3sa2_suspend(chip);
-		break;
-	case PM_RESUME:
-		snd_opl3sa2_resume(chip);
-		break;
-	}
-	return 0;
-}
-
 #endif /* CONFIG_PM */
 
 #ifdef CONFIG_PNP
@@ -688,10 +650,6 @@
 
 static int snd_opl3sa2_free(opl3sa2_t *chip)
 {
-#ifdef CONFIG_PM
-	if (chip->pm_dev)
-		pm_unregister(chip->pm_dev);
-#endif
 	if (chip->irq >= 0)
 		free_irq(chip->irq, (void *)chip);
 	if (chip->res_port) {
@@ -816,22 +774,12 @@
 			goto __error;
 	}
 #ifdef CONFIG_PM
-	/* Power Management */
-	chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_opl3sa2_pm_callback);
-	if (chip->pm_dev) {
-		chip->pm_dev->data = chip;
-		/* remember callbacks for cs4231 - they are called inside
-		 * opl3sa2 pm callback
-		 */
-		chip->cs4231_suspend = chip->cs4231->suspend;
-		chip->cs4231_resume = chip->cs4231->resume;
-		/* now clear callbacks for cs4231 */
-		chip->cs4231->suspend = NULL;
-		chip->cs4231->resume = NULL;
-		/* set control api callback */
-		card->set_power_state = snd_opl3sa2_set_power_state;
-		card->power_state_private_data = chip;
-	}
+	chip->cs4231_suspend = chip->cs4231->suspend;
+	chip->cs4231_resume = chip->cs4231->resume;
+	/* now clear callbacks for cs4231 */
+	chip->cs4231->suspend = NULL;
+	chip->cs4231->resume = NULL;
+	snd_card_set_isa_pm_callback(card, snd_opl3sa2_suspend, snd_opl3sa2_resume, chip);
 #endif
 
 	sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
@@ -932,42 +880,3 @@
 
 module_init(alsa_card_opl3sa2_init)
 module_exit(alsa_card_opl3sa2_exit)
-
-#ifndef MODULE
-
-/* format is: snd-opl3sa2=enable,index,id,isapnp,
-			  port,sb_port,wss_port,fm_port,
-			  midi_port,irq,dma1,dma2,
-			  opl3sa3_ymode */
-
-static int __init alsa_card_opl3sa2_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&sb_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&wss_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&midi_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2 &&
-	       get_option(&str,&opl3sa3_ymode[nr_dev]) == 2);
-#ifdef CONFIG_PNP
-	if (pnp != INT_MAX)
-		isapnp[nr_dev] = pnp;
-#endif
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-opl3sa2=", alsa_card_opl3sa2_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
--- a/sound/isa/opti9xx/opti92x-ad1848.c	Tue Jun 15 22:20:37 2004
+++ b/sound/isa/opti9xx/opti92x-ad1848.c	Tue Jun 15 22:20:37 2004
@@ -30,6 +30,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #ifdef CS4231
 #include <sound/cs4231.h>
@@ -48,7 +49,6 @@
 #endif
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>");
@@ -84,38 +84,38 @@
 static int dma2 = SNDRV_DEFAULT_DMA1;		/* 0,1,3 */
 #endif	/* CS4231 || OPTi93X */
 
-MODULE_PARM(index, "i");
+module_param(index, int, 0444);
 MODULE_PARM_DESC(index, "Index value for opti9xx based soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "s");
+module_param(id, charp, 0444);
 MODULE_PARM_DESC(id, "ID string for opti9xx based soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-//MODULE_PARM(enable, "i");
+//module_param(enable, bool, 0444);
 //MODULE_PARM_DESC(enable, "Enable opti9xx soundcard.");
 //MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(isapnp, "i");
+module_param(isapnp, bool, 0444);
 MODULE_PARM_DESC(isapnp, "Enable ISA PnP detection for specified soundcard.");
 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
-MODULE_PARM(port, "l");
+module_param(port, long, 0444);
 MODULE_PARM_DESC(port, "WSS port # for opti9xx driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT_DESC);
-MODULE_PARM(mpu_port, "l");
+module_param(mpu_port, long, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for opti9xx driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT_DESC);
-MODULE_PARM(fm_port, "l");
+module_param(fm_port, long, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for opti9xx driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_PORT_DESC);
-MODULE_PARM(irq, "i");
+module_param(irq, int, 0444);
 MODULE_PARM_DESC(irq, "WSS irq # for opti9xx driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(mpu_irq, "i");
+module_param(mpu_irq, int, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU-401 irq # for opti9xx driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma1, "i");
+module_param(dma1, int, 0444);
 MODULE_PARM_DESC(dma1, "1st dma # for opti9xx driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
 #if defined(CS4231) || defined(OPTi93X)
-MODULE_PARM(dma2, "i");
+module_param(dma2, int, 0444);
 MODULE_PARM_DESC(dma2, "2nd dma # for opti9xx driver.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
 #endif	/* CS4231 || OPTi93X */
@@ -602,7 +602,11 @@
 #endif	/* CS4231 || OPTi93X */
 
 	spin_lock_irqsave(&chip->lock, flags);
+#ifndef OPTi93X
+	 outb(irq_bits << 3 | dma_bits, chip->wss_base);
+#else /* OPTi93X */
 	snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits));
+#endif /* OPTi93X */
 	spin_unlock_irqrestore(&chip->lock, flags);
 
 __skip_resources:
@@ -2253,47 +2257,3 @@
 
 module_init(alsa_card_opti9xx_init)
 module_exit(alsa_card_opti9xx_exit)
-
-#ifndef MODULE
-
-/* format is: snd-opti9xx=enable,index,id,isapnp,
-			  port,mpu_port,fm_port,
-			  irq,mpu_irq,
-			  dma1,[dma2] */
-
-static int __init alsa_card_opti9xx_setup(char *str)
-{
-	int __attribute__ ((__unused__)) enable = 1;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-
-	(void)(get_option(&str,&enable) == 2 &&
-	       get_option(&str,&index) == 2 &&
-	       get_id(&str,&id) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-	       get_option_long(&str,&port) == 2 &&
-	       get_option_long(&str,&mpu_port) == 2 &&
-	       get_option_long(&str,&fm_port) == 2 &&
-	       get_option(&str,&irq) == 2 &&
-	       get_option(&str,&mpu_irq) == 2 &&
-	       get_option(&str,&dma1) == 2
-#if defined(CS4231) || defined(OPTi93X)
-	       &&
-	       get_option(&str,&dma2) == 2
-#endif
-	       );
-#ifdef CONFIG_PNP
-	if (pnp != INT_MAX)
-		isapnp = pnp;
-#endif
-	return 1;
-}
-
-#if defined(OPTi93X)
-__setup("snd-opti93x=", alsa_card_opti9xx_setup);
-#elif defined(CS4231)
-__setup("snd-opti92x-cs4231=", alsa_card_opti9xx_setup);
-#else
-__setup("snd-opti92x-ad1848=", alsa_card_opti9xx_setup);
-#endif
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/sb/emu8000_patch.c b/sound/isa/sb/emu8000_patch.c
--- a/sound/isa/sb/emu8000_patch.c	Tue Jun 15 22:20:37 2004
+++ b/sound/isa/sb/emu8000_patch.c	Tue Jun 15 22:20:37 2004
@@ -21,12 +21,12 @@
 
 #include "emu8000_local.h"
 #include <asm/uaccess.h>
+#include <linux/moduleparam.h>
 
-MODULE_PARM(emu8000_reset_addr, "i");
+static int emu8000_reset_addr = 0;
+module_param(emu8000_reset_addr, int, 0444);
 MODULE_PARM_DESC(emu8000_reset_addr, "reset write address at each time (makes slowdown)");
 
-int emu8000_reset_addr = 0;
-
 
 /*
  * Open up channels.
@@ -87,14 +87,14 @@
 	unsigned short c;
 	if (mode & SNDRV_SFNT_SAMPLE_8BITS) {
 		unsigned char cc;
-		get_user(cc, (unsigned char*)buf + offset);
+		get_user(cc, (unsigned char __user *)buf + offset);
 		c = cc << 8; /* convert 8bit -> 16bit */
 	} else {
 #ifdef SNDRV_LITTLE_ENDIAN
-		get_user(c, (unsigned short*)buf + offset);
+		get_user(c, (unsigned short __user *)buf + offset);
 #else
 		unsigned short cc;
-		get_user(cc, (unsigned short*)buf + offset);
+		get_user(cc, (unsigned short __user *)buf + offset);
 		c = swab16(cc);
 #endif
 	}
diff -Nru a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
--- a/sound/isa/sb/emu8000_pcm.c	Tue Jun 15 22:21:04 2004
+++ b/sound/isa/sb/emu8000_pcm.c	Tue Jun 15 22:21:04 2004
@@ -515,12 +515,12 @@
 static int emu8k_pcm_copy(snd_pcm_substream_t *subs,
 			  int voice,
 			  snd_pcm_uframes_t pos,
-			  void *src,
+			  void __user *src,
 			  snd_pcm_uframes_t count)
 {
 	emu8k_pcm_t *rec = subs->runtime->private_data;
 	emu8000_t *emu = rec->emu;
-	unsigned short *buf = src;
+	unsigned short __user *buf = src;
 
 	snd_emu8000_write_wait(emu, 1);
 	EMU8000_SMALW_WRITE(emu, pos + rec->loop_start[0]);
diff -Nru a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c
--- a/sound/isa/sb/es968.c	Tue Jun 15 22:20:40 2004
+++ b/sound/isa/sb/es968.c	Tue Jun 15 22:20:40 2004
@@ -24,8 +24,8 @@
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/sb.h>
 
@@ -45,23 +45,24 @@
 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;	/* PnP setup */
 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* Pnp setup */
 static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* PnP setup */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for es968 based soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for es968 based soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable es968 based soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for es968 driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for es968 driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma8, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma8, "8-bit DMA # for es968 driver.");
 MODULE_PARM_SYNTAX(dma8, SNDRV_DMA8_DESC);
 
@@ -242,28 +243,3 @@
 
 module_init(alsa_card_es968_init)
 module_exit(alsa_card_es968_exit)
-
-#ifndef MODULE
-
-/* format is: snd-es968=enable,index,id,
-			port,irq,dma1 */
-
-static int __init alsa_card_es968_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma8[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-es968=", alsa_card_es968_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
--- a/sound/isa/sb/sb16.c	Tue Jun 15 22:20:43 2004
+++ b/sound/isa/sb/sb16.c	Tue Jun 15 22:20:43 2004
@@ -24,6 +24,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/sb16_csp.h>
@@ -34,7 +35,6 @@
 #define SNDRV_LEGACY_AUTO_PROBE
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #define chip_t sb_t
@@ -92,54 +92,55 @@
 #ifdef SNDRV_SBAWE_EMU8000
 static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
 #endif
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for SoundBlaster 16 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for SoundBlaster 16 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable SoundBlaster 16 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 #ifdef CONFIG_PNP
-MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(isapnp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard.");
 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
 #endif
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for SB16 driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED ",allows:{{0x220},{0x240},{0x260},{0x280}},dialog:list");
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for SB16 driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_ENABLED ",allows:{{0x330},{0x300}},dialog:list");
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port # for SB16 PnP driver.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_ENABLED ",allows:{{0x388},{0x38c},{0x390},{0x394}},dialog:list");
 #ifdef SNDRV_SBAWE_EMU8000
-MODULE_PARM(awe_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(awe_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(awe_port, "AWE port # for SB16 PnP driver.");
 MODULE_PARM_SYNTAX(awe_port, SNDRV_ENABLED ",allows:{{0x620},{0x640},{0x660},{0x680}},dialog:list");
 #endif
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for SB16 driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma8, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma8, "8-bit DMA # for SB16 driver.");
 MODULE_PARM_SYNTAX(dma8, SNDRV_DMA8_DESC);
-MODULE_PARM(dma16, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma16, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma16, "16-bit DMA # for SB16 driver.");
 MODULE_PARM_SYNTAX(dma16, SNDRV_DMA16_DESC);
-MODULE_PARM(mic_agc, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mic_agc, int, boot_devs, 0444);
 MODULE_PARM_DESC(mic_agc, "Mic Auto-Gain-Control switch.");
 MODULE_PARM_SYNTAX(mic_agc, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
 #ifdef CONFIG_SND_SB16_CSP
-MODULE_PARM(csp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(csp, int, boot_devs, 0444);
 MODULE_PARM_DESC(csp, "ASP/CSP chip support.");
 MODULE_PARM_SYNTAX(csp, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
 #endif
 #ifdef SNDRV_SBAWE_EMU8000
-MODULE_PARM(seq_ports, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(seq_ports, int, boot_devs, 0444);
 MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth.");
 MODULE_PARM_SYNTAX(seq_ports, SNDRV_ENABLED ",allows:{{0,8}},skill:advanced");
 #endif
@@ -247,6 +248,8 @@
 	{ .id = "CTLXXXX" , .devs = { { "CTL0044" }, { "CTL0023" } } },
 	{ .id = "CTLXXXX" , .devs = { { "CTL0045" }, { "CTL0022" } } },
 #endif /* SNDRV_SBAWE */
+	/* Sound Blaster 16 PnP (Virtual PC 2004)*/
+	{ .id = "tBA03b0", .devs = { { "PNPb003" } } },
 	{ .id = "", }
 };
 
@@ -691,60 +694,3 @@
 
 module_init(alsa_card_sb16_init)
 module_exit(alsa_card_sb16_exit)
-
-#ifndef MODULE
-
-/* format is: snd-sb16=enable,index,id,isapnp,
-		       port,mpu_port,fm_port,
-		       irq,dma8,dma16,
-		       mic_agc,csp,
-		       [awe_port,seq_ports] */
-
-static int __init alsa_card_sb16_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-	int __attribute__ ((__unused__)) pnp = INT_MAX;
-	int __attribute__ ((__unused__)) xcsp = INT_MAX;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pnp) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma8[nr_dev]) == 2 &&
-	       get_option(&str,&dma16[nr_dev]) == 2 &&
-	       get_option(&str,&mic_agc[nr_dev]) == 2
-#ifdef CONFIG_SND_SB16_CSP
-	       &&
-	       get_option(&str,&xcsp) == 2
-#endif
-#ifdef SNDRV_SBAWE_EMU8000
-	       &&
-	       get_option_long(&str,&awe_port[nr_dev]) == 2 &&
-	       get_option(&str,&seq_ports[nr_dev]) == 2
-#endif
-	       );
-#ifdef CONFIG_PNP
-	if (pnp != INT_MAX)
-		isapnp[nr_dev] = pnp;
-#endif
-#ifdef CONFIG_SND_SB16_CSP
-	if (xcsp != INT_MAX)
-		csp[nr_dev] = xcsp;
-#endif
-	nr_dev++;
-	return 1;
-}
-
-#ifndef SNDRV_SBAWE_EMU8000
-__setup("snd-sb16=", alsa_card_sb16_setup);
-#else
-__setup("snd-sbawe=", alsa_card_sb16_setup);
-#endif
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
--- a/sound/isa/sb/sb16_csp.c	Tue Jun 15 22:21:04 2004
+++ b/sound/isa/sb/sb16_csp.c	Tue Jun 15 22:21:04 2004
@@ -89,9 +89,9 @@
 static int set_mode_register(sb_t *chip, unsigned char mode);
 static int get_version(sb_t *chip);
 
-static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * code);
+static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user * code);
 static int snd_sb_csp_unload(snd_sb_csp_t * p);
-static int snd_sb_csp_load(snd_sb_csp_t * p, const unsigned char *buf, int size, int load_flags);
+static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char __user *buf, int size, int load_flags);
 static int snd_sb_csp_autoload(snd_sb_csp_t * p, int pcm_sfmt, int play_rec_mode);
 static int snd_sb_csp_check_version(snd_sb_csp_t * p);
 
@@ -213,7 +213,7 @@
 		info.run_width = p->run_width;
 		info.version = p->version;
 		info.state = p->running;
-		if (copy_to_user((void *) arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			err = -EFAULT;
 		else
 			err = 0;
@@ -222,7 +222,7 @@
 		/* load CSP microcode */
 	case SNDRV_SB_CSP_IOCTL_LOAD_CODE:
 		err = (p->running & SNDRV_SB_CSP_ST_RUNNING ?
-		       -EBUSY : snd_sb_csp_riff_load(p, (snd_sb_csp_microcode_t *) arg));
+		       -EBUSY : snd_sb_csp_riff_load(p, (snd_sb_csp_microcode_t __user *) arg));
 		break;
 	case SNDRV_SB_CSP_IOCTL_UNLOAD_CODE:
 		err = (p->running & SNDRV_SB_CSP_ST_RUNNING ?
@@ -231,7 +231,7 @@
 
 		/* change CSP running state */
 	case SNDRV_SB_CSP_IOCTL_START:
-		if (copy_from_user(&start_info, (void *) arg, sizeof(start_info)))
+		if (copy_from_user(&start_info, (void __user *) arg, sizeof(start_info)))
 			err = -EFAULT;
 		else
 			err = snd_sb_csp_start(p, start_info.sample_width, start_info.channels);
@@ -297,11 +297,12 @@
  * load microcode via ioctl: 
  * code is user-space pointer
  */
-static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t * mcode)
+static int snd_sb_csp_riff_load(snd_sb_csp_t * p, snd_sb_csp_microcode_t __user * mcode)
 {
 	snd_sb_csp_mc_header_t info;
 
-	unsigned char *data_ptr, *data_end;
+	unsigned char __user *data_ptr;
+	unsigned char __user *data_end;
 	unsigned short func_nr = 0;
 
 	riff_header_t file_h, item_h, code_h;
@@ -372,8 +373,8 @@
 				if (code_h.name != INIT_HEADER)
 					break;
 				data_ptr += sizeof(code_h);
-				err = snd_sb_csp_load(p, data_ptr, LE_INT(code_h.len),
-						      SNDRV_SB_CSP_LOAD_INITBLOCK | SNDRV_SB_CSP_LOAD_FROMUSER);
+				err = snd_sb_csp_load_user(p, data_ptr, LE_INT(code_h.len),
+						      SNDRV_SB_CSP_LOAD_INITBLOCK);
 				if (err)
 					return err;
 				data_ptr += LE_INT(code_h.len);
@@ -387,8 +388,8 @@
 				return -EINVAL;
 			}
 			data_ptr += sizeof(code_h);
-			err = snd_sb_csp_load(p, data_ptr, LE_INT(code_h.len),
-					      SNDRV_SB_CSP_LOAD_FROMUSER);
+			err = snd_sb_csp_load_user(p, data_ptr,
+						   LE_INT(code_h.len), 0);
 			if (err)
 				return err;
 
@@ -627,28 +628,10 @@
 	/* Send high byte */
 	snd_sbdsp_command(p->chip, (unsigned char)((size - 1) >> 8));
 	/* send microcode sequence */
-	if (load_flags & SNDRV_SB_CSP_LOAD_FROMUSER) {
-		/* copy microcode from user space */
-		unsigned char *kbuf, *_kbuf;
-		_kbuf = kbuf = kmalloc (size, GFP_KERNEL);
-		if (copy_from_user(kbuf, buf, size)) {
-			result = -EFAULT;
-			kfree (_kbuf);
+	/* load from kernel space */
+	while (size--) {
+		if (!snd_sbdsp_command(p->chip, *buf++))
 			goto __fail;
-		}
-		while (size--) {
-			if (!snd_sbdsp_command(p->chip, *kbuf++)) {
-				kfree (_kbuf);
-				goto __fail;
-			}
-		}
-		kfree (_kbuf);
-	} else {
-		/* load from kernel space */
-		while (size--) {
-			if (!snd_sbdsp_command(p->chip, *buf++))
-				goto __fail;
-		}
 	}
 	if (snd_sbdsp_get_byte(p->chip))
 		goto __fail;
@@ -691,6 +674,20 @@
       __fail:
 	spin_unlock_irqrestore(&p->chip->reg_lock, flags);
 	return result;
+}
+ 
+static int snd_sb_csp_load_user(snd_sb_csp_t * p, const unsigned char __user *buf, int size, int load_flags)
+{
+	int err = -ENOMEM;
+	unsigned char *kbuf = kmalloc(size, GFP_KERNEL);
+	if (kbuf) {
+		if (copy_from_user(kbuf, buf, size))
+			err = -EFAULT;
+		else
+			err = snd_sb_csp_load(p, kbuf, size, load_flags);
+		kfree(kbuf);
+	}
+	return err;
 }
 
 #include "sb16_csp_codecs.h"
diff -Nru a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
--- a/sound/isa/sb/sb8.c	Tue Jun 15 22:20:42 2004
+++ b/sound/isa/sb/sb8.c	Tue Jun 15 22:20:42 2004
@@ -23,11 +23,11 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/opl3.h>
 #define SNDRV_LEGACY_AUTO_PROBE
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #define chip_t sb_t
@@ -44,23 +44,24 @@
 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;	/* 0x220,0x240,0x260 */
 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* 5,7,9,10 */
 static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 1,3 */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Sound Blaster soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Sound Blaster soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Sound Blaster soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for SB8 driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_PORT12_DESC);
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for SB8 driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
-MODULE_PARM(dma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma8, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver.");
 MODULE_PARM_SYNTAX(dma8, SNDRV_DMA8_DESC);
 
@@ -230,28 +231,3 @@
 
 module_init(alsa_card_sb8_init)
 module_exit(alsa_card_sb8_exit)
-
-#ifndef MODULE
-
-/* format is: snd-sb8=enable,index,id,
-		      port,irq,dma8 */
-
-static int __init alsa_card_sb8_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&port[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma8[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-sb8=", alsa_card_sb8_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
--- a/sound/isa/sgalaxy.c	Tue Jun 15 22:21:05 2004
+++ b/sound/isa/sgalaxy.c	Tue Jun 15 22:21:05 2004
@@ -27,13 +27,13 @@
 #include <linux/delay.h>
 #include <linux/time.h>
 #include <linux/irq.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/ad1848.h>
 #include <sound/control.h>
 #define SNDRV_LEGACY_FIND_FREE_IRQ
 #define SNDRV_LEGACY_FIND_FREE_DMA
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Christopher Butler <chrisb@sandy.force9.co.uk>");
@@ -49,23 +49,24 @@
 static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;	/* 0x530,0xe80,0xf40,0x604 */
 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	/* 7,9,10,11 */
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	/* 0,1,3 */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Sound Galaxy soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Sound Galaxy soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(sbport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(sbport, long, boot_devs, 0444);
 MODULE_PARM_DESC(sbport, "Port # for Sound Galaxy SB driver.");
 MODULE_PARM_SYNTAX(sbport, SNDRV_ENABLED ",allows:{{0x220},{0x240}},dialog:list");
-MODULE_PARM(wssport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(wssport, long, boot_devs, 0444);
 MODULE_PARM_DESC(wssport, "Port # for Sound Galaxy WSS driver.");
 MODULE_PARM_SYNTAX(wssport, SNDRV_ENABLED ",allows:{{0x530},{0xe80},{0xf40},{0x604}},dialog:list");
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for Sound Galaxy driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_ENABLED ",allows:{{7},{9},{10},{11}},dialog:list");
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA8_DESC);
 
@@ -327,30 +328,3 @@
 
 module_init(alsa_card_sgalaxy_init)
 module_exit(alsa_card_sgalaxy_exit)
-
-#ifndef MODULE
-
-/* format is: snd-sgalaxy=enable,index,id,
-			  sbport,wssport,
-			  irq,dma1 */
-
-static int __init alsa_card_sgalaxy_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&sbport[nr_dev]) == 2 &&
-	       get_option_long(&str,&wssport[nr_dev]) == 2 &&
-	       get_option(&str,&irq[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-sgalaxy=", alsa_card_sgalaxy_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/sscape.c b/sound/isa/sscape.c
--- a/sound/isa/sscape.c	Tue Jun 15 22:20:37 2004
+++ b/sound/isa/sscape.c	Tue Jun 15 22:20:37 2004
@@ -26,12 +26,12 @@
 #include <linux/delay.h>
 #include <linux/pnp.h>
 #include <linux/spinlock.h>
+#include <linux/moduleparam.h>
 #include <asm/dma.h>
 #include <sound/core.h>
 #include <sound/hwdep.h>
 #include <sound/cs4231.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <sound/sscape_ioctl.h>
@@ -49,28 +49,29 @@
 static int irq[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IRQ;
 static int mpu_irq[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_IRQ;
 static int dma[SNDRV_CARDS] __devinitdata = SNDRV_DEFAULT_DMA;
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index number for SoundScape soundcard");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
 
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "Description for SoundScape card");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
 
-MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(port, long, boot_devs, 0444);
 MODULE_PARM_DESC(port, "Port # for SoundScape driver.");
 MODULE_PARM_SYNTAX(port, SNDRV_ENABLED);
 
-MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq, "IRQ # for SoundScape driver.");
 MODULE_PARM_SYNTAX(irq, SNDRV_IRQ_DESC);
 
-MODULE_PARM(mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_irq, "MPU401 IRQ # for SoundScape driver.");
 MODULE_PARM_SYNTAX(mpu_irq, SNDRV_IRQ_DESC);
 
-MODULE_PARM(dma, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma, "DMA # for SoundScape driver.");
 MODULE_PARM_SYNTAX(dma, SNDRV_DMA8_DESC);
   
@@ -454,7 +455,7 @@
  * Upload a byte-stream into the SoundScape using DMA channel A.
  */
 static int upload_dma_data(struct soundscape *s,
-                           const unsigned char *data,
+                           const unsigned char __user *data,
                            size_t size)
 {
 	unsigned long flags;
@@ -568,7 +569,7 @@
  *       However, we have already verified its memory
  *       addresses by the time we get here.
  */
-static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_bootblock *bb)
+static int sscape_upload_bootblock(struct soundscape *sscape, struct sscape_bootblock __user *bb)
 {
 	unsigned long flags;
 	int data = 0;
@@ -603,10 +604,10 @@
  * SPACE, and save ourselves from copying it at all.
  */
 static int sscape_upload_microcode(struct soundscape *sscape,
-                                   const struct sscape_microcode *mc)
+                                   const struct sscape_microcode __user *mc)
 {
 	unsigned long flags;
-	char *code;
+	char __user *code;
 	int err, ret;
 
 	/*
@@ -682,7 +683,7 @@
 	switch (cmd) {
 	case SND_SSCAPE_LOAD_BOOTB:
 		{
-			register struct sscape_bootblock *bb = (struct sscape_bootblock *) arg;
+			register struct sscape_bootblock __user *bb = (struct sscape_bootblock __user *) arg;
 
 			/*
 			 * We are going to have to copy this data into a special
@@ -704,7 +705,7 @@
 
 	case SND_SSCAPE_LOAD_MCODE:
 		{
-			register const struct sscape_microcode *mc = (const struct sscape_microcode *) arg;
+			register const struct sscape_microcode __user *mc = (const struct sscape_microcode __user *) arg;
 
 			err = sscape_upload_microcode(sscape, mc);
 		}
@@ -1531,30 +1532,3 @@
 
 module_init(sscape_init);
 module_exit(sscape_exit);
-
-#ifndef MODULE
-
-/* format is: snd-sscape=index,id,port,irq,mpu_irq,dma */
-
-static int __init builtin_sscape_setup(char *str)
-{
-	static unsigned __initdata nr_dev;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-
-	(void)((get_option(&str, &index[nr_dev]) == 2) &&
-	       (get_id(&str, &id[nr_dev]) == 2) &&
-	       (get_option_long(&str, &port[nr_dev]) == 2) &&
-	       (get_option(&str, &irq[nr_dev]) == 2) &&
-	       (get_option(&str, &mpu_irq[nr_dev]) == 2) &&
-	       (get_option(&str, &dma[nr_dev]) == 2)); 
- 
-	++nr_dev;
-	return 1;
-}
-
-__setup("snd-sscape=", builtin_sscape_setup);
-
-#endif
-
diff -Nru a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
--- a/sound/isa/wavefront/wavefront.c	Tue Jun 15 22:20:43 2004
+++ b/sound/isa/wavefront/wavefront.c	Tue Jun 15 22:20:43 2004
@@ -24,8 +24,8 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/pnp.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/opl3.h>
 #include <sound/snd_wavefront.h>
@@ -52,49 +52,50 @@
 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	    /* 0,1,3,5,6,7 */
 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	    /* 0,1,3,5,6,7 */
 static int use_cs4232_midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for WaveFront soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for WaveFront soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable WaveFront soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 #ifdef CONFIG_PNP
-MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(isapnp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(isapnp, "ISA PnP detection for WaveFront soundcards.");
 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
 #endif
-MODULE_PARM(cs4232_pcm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(cs4232_pcm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(cs4232_pcm_port, "Port # for CS4232 PCM interface.");
 MODULE_PARM_SYNTAX(cs4232_pcm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(cs4232_pcm_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(cs4232_pcm_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(cs4232_pcm_irq, "IRQ # for CS4232 PCM interface.");
 MODULE_PARM_SYNTAX(cs4232_pcm_irq, SNDRV_ENABLED ",allows:{{5},{7},{9},{11},{12},{15}},dialog:list");
-MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma1, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma1, "DMA1 # for CS4232 PCM interface.");
 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC);
-MODULE_PARM(dma2, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dma2, int, boot_devs, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for CS4232 PCM interface.");
 MODULE_PARM_SYNTAX(dma2, SNDRV_DMA_DESC);
-MODULE_PARM(cs4232_mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(cs4232_mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(cs4232_mpu_port, "port # for CS4232 MPU-401 interface.");
 MODULE_PARM_SYNTAX(cs4232_mpu_port, SNDRV_PORT12_DESC);
-MODULE_PARM(cs4232_mpu_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(cs4232_mpu_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(cs4232_mpu_irq, "IRQ # for CS4232 MPU-401 interface.");
 MODULE_PARM_SYNTAX(cs4232_mpu_irq, SNDRV_ENABLED ",allows:{{9},{11},{12},{15}},dialog:list");
-MODULE_PARM(ics2115_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ics2115_irq, int, boot_devs, 0444);
 MODULE_PARM_DESC(ics2115_irq, "IRQ # for ICS2115.");
 MODULE_PARM_SYNTAX(ics2115_irq, SNDRV_ENABLED ",allows:{{9},{11},{12},{15}},dialog:list");
-MODULE_PARM(ics2115_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(ics2115_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(ics2115_port, "Port # for ICS2115.");
 MODULE_PARM_SYNTAX(ics2115_port, SNDRV_PORT12_DESC);
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port #.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_PORT12_DESC);
-MODULE_PARM(use_cs4232_midi, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(use_cs4232_midi, bool, boot_devs, 0444);
 MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
 MODULE_PARM_SYNTAX(use_cs4232_midi, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 
@@ -731,41 +732,3 @@
 
 module_init(alsa_card_wavefront_init)
 module_exit(alsa_card_wavefront_exit)
-
-#ifndef MODULE
-
-/* format is: snd-wavefront=enable,index,id,isapnp,
-			    cs4232_pcm_port,cs4232_pcm_irq,
-			    cs4232_mpu_port,cs4232_mpu_irq,
-			    ics2115_port,ics2115_irq,
-			    fm_port,
-			    dma1,dma2,
-			    use_cs4232_midi */
-
-static int __init alsa_card_wavefront_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&isapnp[nr_dev]) == 2 &&
-	       get_option_long(&str,&cs4232_pcm_port[nr_dev]) == 2 &&
-	       get_option(&str,&cs4232_pcm_irq[nr_dev]) == 2 &&
-	       get_option_long(&str,&cs4232_mpu_port[nr_dev]) == 2 &&
-	       get_option(&str,&cs4232_mpu_irq[nr_dev]) == 2 &&
-	       get_option_long(&str,&ics2115_port[nr_dev]) == 2 &&
-	       get_option(&str,&ics2115_irq[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option(&str,&dma1[nr_dev]) == 2 &&
-	       get_option(&str,&dma2[nr_dev]) == 2 &&
-	       get_option(&str,&use_cs4232_midi[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-wavefront=", alsa_card_wavefront_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
--- a/sound/isa/wavefront/wavefront_fx.c	Tue Jun 15 22:20:42 2004
+++ b/sound/isa/wavefront/wavefront_fx.c	Tue Jun 15 22:20:42 2004
@@ -179,7 +179,7 @@
 	acard = card->private_data;
 	dev = &acard->wavefront;
 
-	if (copy_from_user (&r, (unsigned char *) arg, sizeof (wavefront_fx_info)))
+	if (copy_from_user (&r, (void __user *)arg, sizeof (wavefront_fx_info)))
 		return -EFAULT;
 
 	switch (r.request) {
@@ -201,7 +201,7 @@
 				return -EIO;
 			}
 			if (copy_from_user (page_data,
-					    (unsigned char *) r.data[3],
+					    (unsigned char __user *) r.data[3],
 					    r.data[2]))
 				return -EFAULT;
 			pd = page_data;
diff -Nru a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
--- a/sound/isa/wavefront/wavefront_synth.c	Tue Jun 15 22:20:39 2004
+++ b/sound/isa/wavefront/wavefront_synth.c	Tue Jun 15 22:20:39 2004
@@ -27,6 +27,7 @@
 #include <linux/delay.h>
 #include <linux/time.h>
 #include <linux/wait.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/snd_wavefront.h>
 #include <sound/initval.h>
@@ -83,25 +84,25 @@
 int osrun_time = 10;       /* time in seconds we wait for the OS to
 			      start running.
 			   */
-MODULE_PARM(wf_raw,"i");
+module_param(wf_raw, int, 0444);
 MODULE_PARM_DESC(wf_raw, "if non-zero, assume that we need to boot the OS");
-MODULE_PARM(fx_raw,"i");
+module_param(fx_raw, int, 0444);
 MODULE_PARM_DESC(fx_raw, "if non-zero, assume that the FX process needs help");
-MODULE_PARM(debug_default,"i");
+module_param(debug_default, int, 0444);
 MODULE_PARM_DESC(debug_default, "debug parameters for card initialization");
-MODULE_PARM(wait_usecs,"i");
+module_param(wait_usecs, int, 0444);
 MODULE_PARM_DESC(wait_usecs, "how long to wait without sleeping, usecs");
-MODULE_PARM(sleep_interval,"i");
+module_param(sleep_interval, int, 0444);
 MODULE_PARM_DESC(sleep_interval, "how long to sleep when waiting for reply");
-MODULE_PARM(sleep_tries,"i");
+module_param(sleep_tries, int, 0444);
 MODULE_PARM_DESC(sleep_tries, "how many times to try sleeping during a wait");
-MODULE_PARM(ospath,"s");
+module_param(ospath, charp, 0444);
 MODULE_PARM_DESC(ospath, "full pathname to processed ICS2115 OS firmware");
-MODULE_PARM(reset_time,"i");
+module_param(reset_time, int, 0444);
 MODULE_PARM_DESC(reset_time, "how long to wait for a reset to take effect");
-MODULE_PARM(ramcheck_time,"i");
+module_param(ramcheck_time, int, 0444);
 MODULE_PARM_DESC(ramcheck_time, "how many seconds to wait for the RAM test");
-MODULE_PARM(osrun_time,"i");
+module_param(osrun_time, int, 0444);
 MODULE_PARM_DESC(osrun_time, "how many seconds to wait for the ICS2115 OS");
 
 /* if WF_DEBUG not defined, no run-time debugging messages will
@@ -860,7 +861,7 @@
 static int
 wavefront_send_sample (snd_wavefront_t *dev, 
 		       wavefront_patch_info *header,
-		       u16 *dataptr,
+		       u16 __user *dataptr,
 		       int data_is_unsigned)
 
 {
@@ -875,7 +876,7 @@
 
 	u16 sample_short;
 	u32 length;
-	u16 *data_end = 0;
+	u16 __user *data_end = 0;
 	unsigned int i;
 	const unsigned int max_blksize = 4096/2;
 	unsigned int written;
@@ -1354,7 +1355,7 @@
 #endif
 
 static int
-wavefront_load_patch (snd_wavefront_t *dev, const char *addr)
+wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr)
 
 {
 	wavefront_patch_info header;
@@ -1376,8 +1377,7 @@
 	switch (header.subkey) {
 	case WF_ST_SAMPLE:  /* sample or sample_header, based on patch->size */
 
-		if (copy_from_user ((unsigned char *) &header.hdr.s,
-				    (unsigned char *) header.hdrptr,
+		if (copy_from_user (&header.hdr.s, header.hdrptr,
 				    sizeof (wavefront_sample)))
 			return -EFAULT;
 
@@ -1385,8 +1385,7 @@
 
 	case WF_ST_MULTISAMPLE:
 
-		if (copy_from_user ((unsigned char *) &header.hdr.s,
-				    (unsigned char *) header.hdrptr,
+		if (copy_from_user (&header.hdr.s, header.hdrptr,
 				    sizeof (wavefront_multisample)))
 			return -EFAULT;
 
@@ -1395,32 +1394,28 @@
 
 	case WF_ST_ALIAS:
 
-		if (copy_from_user ((unsigned char *) &header.hdr.a,
-				    (unsigned char *) header.hdrptr,
+		if (copy_from_user (&header.hdr.a, header.hdrptr,
 				    sizeof (wavefront_alias)))
 			return -EFAULT;
 
 		return wavefront_send_alias (dev, &header);
 
 	case WF_ST_DRUM:
-		if (copy_from_user ((unsigned char *) &header.hdr.d, 
-				    (unsigned char *) header.hdrptr,
+		if (copy_from_user (&header.hdr.d, header.hdrptr,
 				    sizeof (wavefront_drum)))
 			return -EFAULT;
 
 		return wavefront_send_drum (dev, &header);
 
 	case WF_ST_PATCH:
-		if (copy_from_user ((unsigned char *) &header.hdr.p, 
-				    (unsigned char *) header.hdrptr,
+		if (copy_from_user (&header.hdr.p, header.hdrptr,
 				    sizeof (wavefront_patch)))
 			return -EFAULT;
 
 		return wavefront_send_patch (dev, &header);
 
 	case WF_ST_PROGRAM:
-		if (copy_from_user ((unsigned char *) &header.hdr.pr, 
-				    (unsigned char *) header.hdrptr,
+		if (copy_from_user (&header.hdr.pr, header.hdrptr,
 				    sizeof (wavefront_program)))
 			return -EFAULT;
 
@@ -1626,6 +1621,7 @@
 	snd_wavefront_t *dev;
 	snd_wavefront_card_t *acard;
 	wavefront_control wc;
+	void __user *argp = (void __user *)arg;
 
 	card = (snd_card_t *) hw->card;
 
@@ -1638,18 +1634,18 @@
 	
 	switch (cmd) {
 	case WFCTL_LOAD_SPP:
-		if (wavefront_load_patch (dev, (char *) arg) != 0) {
+		if (wavefront_load_patch (dev, argp) != 0) {
 			return -EIO;
 		}
 		break;
 
 	case WFCTL_WFCMD:
-		if (copy_from_user (&wc, (void *) arg, sizeof (wc)))
+		if (copy_from_user (&wc, argp, sizeof (wc)))
 			return -EFAULT;
 		if (wavefront_synth_control (acard, &wc) < 0) {
 			return -EIO;
 		}
-		if (copy_to_user ((void *) arg, &wc, sizeof (wc)))
+		if (copy_to_user (argp, &wc, sizeof (wc)))
 			return -EFAULT;
 		break;
 
diff -Nru a/sound/oss/Kconfig b/sound/oss/Kconfig
--- a/sound/oss/Kconfig	Tue Jun 15 22:20:44 2004
+++ b/sound/oss/Kconfig	Tue Jun 15 22:20:44 2004
@@ -34,101 +34,30 @@
 
 config SOUND_CMPCI_FM
 	bool "Enable legacy FM"
-	depends on SOUND_CMPCI
+	depends on SOUND_CMPCI && X86
 	help
-	  Say Y here to enable the legacy FM (frequency-modulation) synthesis
-	  support on a card using the CMI8338 or CMI8378 chipset.
+	  Say Y here to enable the legacy FM (frequency-modulation) synthesizer
+	  support on a card using the CMI8338 or CMI8378 chipset. Even it is
+	  enabled, you need to set fmio as proper value to enable it.
 	  Say N here if you don't need this.
 
-config SOUND_CMPCI_FMIO
-	hex "FM I/O 388, 3C8, 3E0, 3E8"
-	depends on SOUND_CMPCI_FM
-	default "388"
-	help
-	  Set the base I/O address for FM synthesis control on a card using
-	  the CMI8338 or CMI8378 chipset.
-	  The default is 388; other choices are 3c8, 3e0, or 3e8.
-
 config SOUND_CMPCI_MIDI
 	bool "Enable legacy MPU-401"
-	depends on SOUND_CMPCI
+	depends on SOUND_CMPCI && X86
 	help
-	  Say Y here to enable the legacy MP401 MIDI synthesis support on a
-	  card using the CMI8338 or CMI8378 chipset.
+	  Say Y here to enable the legacy MPU401 MIDI synthesizer support on a
+	  card using the CMI8338 or CMI8378 chipset. Even it is enabled,
+	  you need to set mpuio as proper value to enable it.
 	  Say N here if you don't need this.
 
-config SOUND_CMPCI_MPUIO
-	hex "MPU-401 I/O 330, 320, 310, 300"
-	depends on SOUND_CMPCI_MIDI
-	default "330"
-	help
-	  Set the base I/O address for MP401 MIDI synthesis control on a card
-	  using the CMI8338 or CMI8378 chipset.
-	  The default is 330; other choices are 320, 310, or 300.
-
 config SOUND_CMPCI_JOYSTICK
 	bool "Enable joystick"
-	depends on SOUND_CMPCI
-	help
-	  Say here in order to enable the joystick port on a sound crd using
-	  the CMI8338 or the CMI8738 chipset.  Data on these chips are
-	  available at <http://www.cmedia.com.tw/>.
-
-config SOUND_CMPCI_CM8738
-	bool "Support CMI8738 based audio cards"
-	depends on SOUND_CMPCI
-	help
-	  Say Y or M if you have a PCI sound card using the CMI8338
-	  or the CMI8378 chipset.  Data on this chip is available at
-	  <http://www.cmedia.com.tw/doc8738.htm>.
-
-	  A userspace utility to control some internal registers of these
-	  chips is available at
-	  <http://member.nifty.ne.jp/Breeze/softwares/unix/cmictl-e.html>.
-
-config SOUND_CMPCI_SPDIFINVERSE
-	bool "Inverse S/PDIF in for CMI8738"
-	depends on SOUND_CMPCI_CM8738
+	depends on SOUND_CMPCI && X86
 	help
-	  Say Y here to have the driver invert the signal presented on SPDIF IN
-	  of a card using the CMI8338 or CMI8378 chipset.
+	  Say Y here in order to enable the joystick port on a sound card using
+	  the CMI8338 or the CMI8738 chipset.  You need to config the
+	  gameport support and set joystick parameter as 1 to use it.
 	  Say N here if you don't need this.
-
-config SOUND_CMPCI_SPDIFLOOP
-	bool "Enable S/PDIF loop for CMI8738"
-	depends on SOUND_CMPCI_CM8738
-	help
-	  Enable loopback from SPDIF in to SPDIF out.  For discussion, see
-	  "The 8738 Audio SPDIF In/Out Technical Data" on the technical
-	  support page at <http://www.cmedia.com.tw/>.
-
-	  A userspace utility to control even more internal registers of these
-	  chips is available at
-	  <http://member.nifty.ne.jp/Breeze/softwares/unix/cmictl-e.html>.
-	  This package will among other things help you enable SPDIF 
-	  out/in/loop/monitor.
-
-config SOUND_CMPCI_SPEAKERS
-	int "Number of speakers 2, 4, 5, 6"
-	depends on SOUND_CMPCI_CM8738
-	default "2"
-	help
-	  Specify the number of speaker channels you want the card to drive,
-	  as an integer.
-
-config SOUND_CMPCI_LINE_REAR
-	bool "Use Line-in as Read-out"
-	depends on SOUND_CMPCI_CM8738 && SOUND_CMPCI_SPEAKERS!=2
-	help
-	  Say Y here to enable using line-in jack as an output jack for a rear
-	  speaker.  Say N here if you don't need this.
-
-config SOUND_CMPCI_LINE_BASS
-	bool "Use Line-in as Bass"
-	depends on SOUND_CMPCI_CM8738 && SOUND_CMPCI_SPEAKERS!=2
-	help
-	  Say Y here to enable using line-in jack as an output jack for a bass
-	  speaker.  Say N here if you don't need this.
 
 config SOUND_EMU10K1
 	tristate "Creative SBLive! (EMU10K1)"
diff -Nru a/sound/oss/Makefile b/sound/oss/Makefile
--- a/sound/oss/Makefile	Tue Jun 15 22:20:38 2004
+++ b/sound/oss/Makefile	Tue Jun 15 22:20:38 2004
@@ -55,6 +55,12 @@
 obj-$(CONFIG_SOUND_ICH)		+= i810_audio.o ac97_codec.o
 obj-$(CONFIG_SOUND_SONICVIBES)	+= sonicvibes.o
 obj-$(CONFIG_SOUND_CMPCI)	+= cmpci.o
+ifeq ($(CONFIG_SOUND_CMPCI_FM),y)
+  obj-$(CONFIG_SOUND_CMPCI)     += sound.o opl3.o
+endif
+ifeq ($(CONFIG_SOUND_CMPCI_MIDI),y)
+  obj-$(CONFIG_SOUND_CMPCI)     += sound.o mpu401.o
+endif
 obj-$(CONFIG_SOUND_ES1370)	+= es1370.o
 obj-$(CONFIG_SOUND_ES1371)	+= es1371.o ac97_codec.o
 obj-$(CONFIG_SOUND_VRC5477)	+= nec_vrc5477.o ac97_codec.o
diff -Nru a/sound/oss/ac97.c b/sound/oss/ac97.c
--- a/sound/oss/ac97.c	Tue Jun 15 22:20:42 2004
+++ b/sound/oss/ac97.c	Tue Jun 15 22:20:42 2004
@@ -369,7 +369,7 @@
 }
 
 int
-ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, caddr_t arg)
+ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, void __user *arg)
 {
     int ret;
 
@@ -380,7 +380,7 @@
 
     case SOUND_MIXER_WRITE_RECSRC:
 	{
-	    if (get_user (ret, (int *) arg))
+	    if (get_user (ret, (int __user *) arg))
 		ret = -EFAULT;
 	    else
 		ret = ac97_set_recmask (dev, ret);
@@ -414,7 +414,7 @@
 		ret = 0;
 		if (dir & _SIOC_WRITE) {
 		    int val;
-		    if (get_user (val, (int *) arg) == 0)
+		    if (get_user (val, (int __user *) arg) == 0)
 			ret = ac97_set_mixer (dev, channel, val);
 		    else
 			ret = -EFAULT;
@@ -434,7 +434,7 @@
     if (ret < 0)
 	return ret;
     else
-	return put_user(ret, (int *) arg);
+	return put_user(ret, (int __user *) arg);
 }
 
 EXPORT_SYMBOL(ac97_init);
diff -Nru a/sound/oss/ac97.h b/sound/oss/ac97.h
--- a/sound/oss/ac97.h	Tue Jun 15 22:20:42 2004
+++ b/sound/oss/ac97.h	Tue Jun 15 22:20:42 2004
@@ -206,7 +206,7 @@
 
 /* Default ioctl. */
 extern int ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd,
-			     caddr_t arg);
+			     void __user * arg);
 
 /* Do a complete reset on the AC97 mixer, restoring all mixer registers to
    the current values.  Normally used after an APM resume event.  */
diff -Nru a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c
--- a/sound/oss/ac97_codec.c	Tue Jun 15 22:20:37 2004
+++ b/sound/oss/ac97_codec.c	Tue Jun 15 22:20:37 2004
@@ -516,7 +516,7 @@
 		strlcpy(info.id, codec->name, sizeof(info.id));
 		strlcpy(info.name, codec->name, sizeof(info.name));
 		info.modify_counter = codec->modcnt;
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
@@ -525,7 +525,7 @@
 		memset(&info, 0, sizeof(info));
 		strlcpy(info.id, codec->name, sizeof(info.id));
 		strlcpy(info.name, codec->name, sizeof(info.name));
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
@@ -534,7 +534,7 @@
 		return -EINVAL;
 
 	if (cmd == OSS_GETVERSION)
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, (int __user *)arg);
 
 	if (_SIOC_DIR(cmd) == _SIOC_READ) {
 		switch (_IOC_NR(cmd)) {
@@ -573,12 +573,12 @@
 			val = codec->mixer_state[i];
  			break;
 		}
-		return put_user(val, (int *)arg);
+		return put_user(val, (int __user *)arg);
 	}
 
 	if (_SIOC_DIR(cmd) == (_SIOC_WRITE|_SIOC_READ)) {
 		codec->modcnt++;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, (int __user *)arg))
 			return -EFAULT;
 
 		switch (_IOC_NR(cmd)) {
diff -Nru a/sound/oss/ac97_plugin_ad1980.c b/sound/oss/ac97_plugin_ad1980.c
--- a/sound/oss/ac97_plugin_ad1980.c	Tue Jun 15 22:20:35 2004
+++ b/sound/oss/ac97_plugin_ad1980.c	Tue Jun 15 22:20:35 2004
@@ -75,7 +75,7 @@
 
 	/* Switch the inputs/outputs over (from Dell code) */
 	control = codec->codec_read(codec, AC97_AD_MISC);
-	codec->codec_write(codec, AC97_AD_MISC, control | 0x0420);
+	codec->codec_write(codec, AC97_AD_MISC, control | 0x4420);
 	
 	/* We could refuse the device since we dont need to hang around,
 	   but we will claim it */
diff -Nru a/sound/oss/aci.c b/sound/oss/aci.c
--- a/sound/oss/aci.c	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/aci.c	Tue Jun 15 22:20:41 2004
@@ -234,12 +234,12 @@
 
 EXPORT_SYMBOL(aci_rw_cmd);
 
-static int setvolume(caddr_t arg, 
+static int setvolume(int __user *arg, 
 		     unsigned char left_index, unsigned char right_index)
 {
 	int vol, ret, uservol, buf;
 
-	__get_user(uservol, (int *)arg);
+	__get_user(uservol, arg);
 
 	/* left channel */
 	vol = uservol & 0xff;
@@ -260,12 +260,12 @@
 		return buf;
 	ret |= SCALE(0x20, 100, vol) << 8;
  
-	__put_user(ret, (int *)arg);
+	__put_user(ret, arg);
 
 	return 0;
 }
 
-static int getvolume(caddr_t arg,
+static int getvolume(int __user *arg,
 		     unsigned char left_index, unsigned char right_index)
 {
 	int vol;
@@ -281,7 +281,7 @@
 		return buf;
 	vol |= SCALE(0x20, 100, buf < 0x20 ? 0x20-buf : 0) << 8;
 
-	__put_user(vol, (int *)arg);
+	__put_user(vol, arg);
 
 	return 0;
 }
@@ -318,13 +318,13 @@
 }
 
 
-static int setequalizer(caddr_t arg, 
+static int setequalizer(int __user *arg, 
 			unsigned char left_index, unsigned char right_index)
 {
 	int buf;
 	unsigned int vol;
 
-	__get_user(vol, (int *)arg);
+	__get_user(vol, arg);
 
 	/* left channel */
 	if ((buf=aci_write_cmd(left_index, eq_oss2aci(vol & 0xff)))<0)
@@ -338,7 +338,7 @@
 	return 0;
 }
 
-static int getequalizer(caddr_t arg,
+static int getequalizer(int __user *arg,
 			unsigned char left_index, unsigned char right_index)
 {
 	int buf;
@@ -354,50 +354,51 @@
 		return buf;
 	vol |= eq_aci2oss(buf) << 8;
 
-	__put_user(vol, (int *)arg);
+	__put_user(vol, arg);
 
 	return 0;
 }
 
-static int aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg)
+static int aci_mixer_ioctl (int dev, unsigned int cmd, void __user * arg)
 {
 	int vol, buf;
+	int __user *p = arg;
 
 	switch (cmd) {
 	case SOUND_MIXER_WRITE_VOLUME:
-		return setvolume(arg, 0x01, 0x00);
+		return setvolume(p, 0x01, 0x00);
 	case SOUND_MIXER_WRITE_CD:
-		return setvolume(arg, 0x3c, 0x34);
+		return setvolume(p, 0x3c, 0x34);
 	case SOUND_MIXER_WRITE_MIC:
-		return setvolume(arg, 0x38, 0x30);
+		return setvolume(p, 0x38, 0x30);
 	case SOUND_MIXER_WRITE_LINE:
-		return setvolume(arg, 0x39, 0x31);
+		return setvolume(p, 0x39, 0x31);
 	case SOUND_MIXER_WRITE_SYNTH:
-		return setvolume(arg, 0x3b, 0x33);
+		return setvolume(p, 0x3b, 0x33);
 	case SOUND_MIXER_WRITE_PCM:
-		return setvolume(arg, 0x3a, 0x32);
+		return setvolume(p, 0x3a, 0x32);
 	case MIXER_WRITE(SOUND_MIXER_RADIO): /* fall through */
 	case SOUND_MIXER_WRITE_LINE1:  /* AUX1 or radio */
-		return setvolume(arg, 0x3d, 0x35);
+		return setvolume(p, 0x3d, 0x35);
 	case SOUND_MIXER_WRITE_LINE2:  /* AUX2 */
-		return setvolume(arg, 0x3e, 0x36);
+		return setvolume(p, 0x3e, 0x36);
 	case SOUND_MIXER_WRITE_BASS:   /* set band one and two */
 		if (aci_idcode[1]=='C') {
-			if ((buf=setequalizer(arg, 0x48, 0x40)) || 
-			    (buf=setequalizer(arg, 0x49, 0x41)));
+			if ((buf=setequalizer(p, 0x48, 0x40)) || 
+			    (buf=setequalizer(p, 0x49, 0x41)));
 			return buf;
 		}
 		break;
 	case SOUND_MIXER_WRITE_TREBLE: /* set band six and seven */
 		if (aci_idcode[1]=='C') {
-			if ((buf=setequalizer(arg, 0x4d, 0x45)) || 
-			    (buf=setequalizer(arg, 0x4e, 0x46)));
+			if ((buf=setequalizer(p, 0x4d, 0x45)) || 
+			    (buf=setequalizer(p, 0x4e, 0x46)));
 			return buf;
 		}
 		break;
 	case SOUND_MIXER_WRITE_IGAIN:  /* MIC pre-amp */
 		if (aci_idcode[1]=='B' || aci_idcode[1]=='C') {
-			__get_user(vol, (int *)arg);
+			__get_user(vol, p);
 			vol = vol & 0xff;
 			if (vol > 100)
 				vol = 100;
@@ -407,13 +408,13 @@
 			aci_micpreamp = vol;
 			vol = SCALE(3, 100, vol);
 			vol |= (vol << 8);
-			__put_user(vol, (int *)arg);
+			__put_user(vol, p);
 			return 0;
 		}
 		break;
 	case SOUND_MIXER_WRITE_OGAIN:  /* Power-amp/line-out level */
 		if (aci_idcode[1]=='A' || aci_idcode[1]=='B') {
-			__get_user(buf, (int *)arg);
+			__get_user(buf, p);
 			buf = buf & 0xff;
 			if (buf > 50)
 				vol = 1;
@@ -426,13 +427,13 @@
 				buf = (100 || 100<<8);
 			else
 				buf = 0;
-			__put_user(buf, (int *)arg);
+			__put_user(buf, p);
 			return 0;
 		}
 		break;
 	case SOUND_MIXER_WRITE_RECSRC:
 		/* handle solo mode control */
-		__get_user(buf, (int *)arg);
+		__get_user(buf, p);
 		/* unset solo when RECSRC for PCM is requested */
 		if (aci_idcode[1]=='B' || aci_idcode[1]=='C') {
 			vol = !(buf & SOUND_MASK_PCM);
@@ -448,7 +449,7 @@
 			buf |= SOUND_MASK_LINE1;
 		if (!aci_solo)
 			buf |= SOUND_MASK_PCM;
-		__put_user(buf, (int *)arg);
+		__put_user(buf, p);
 		return 0;
 	case SOUND_MIXER_READ_DEVMASK:
 		buf = (SOUND_MASK_VOLUME | SOUND_MASK_CD    |
@@ -470,7 +471,7 @@
 		default:
 			buf |= SOUND_MASK_LINE1;
 		}
-		__put_user(buf, (int *)arg);
+		__put_user(buf, p);
 		return 0;
 	case SOUND_MIXER_READ_STEREODEVS:
 		buf = (SOUND_MASK_VOLUME | SOUND_MASK_CD    |
@@ -485,7 +486,7 @@
 		default:
 			buf |= SOUND_MASK_LINE1;
 		}
-		__put_user(buf, (int *)arg);
+		__put_user(buf, p);
 		return 0;
 	case SOUND_MIXER_READ_RECMASK:
 		buf = (SOUND_MASK_CD| SOUND_MASK_MIC| SOUND_MASK_LINE|
@@ -495,7 +496,7 @@
 		else
 			buf |= SOUND_MASK_LINE1;
 
-		__put_user(buf, (int *)arg);
+		__put_user(buf, p);
 		return 0;
 	case SOUND_MIXER_READ_RECSRC:
 		buf = (SOUND_MASK_CD    | SOUND_MASK_MIC   | SOUND_MASK_LINE  |
@@ -523,36 +524,36 @@
 		else
 			buf |= SOUND_MASK_LINE1;
 
-		__put_user(buf, (int *)arg);
+		__put_user(buf, p);
 		return 0;
 	case SOUND_MIXER_READ_CAPS:
-		__put_user(0, (int *)arg);
+		__put_user(0, p);
 		return 0;
 	case SOUND_MIXER_READ_VOLUME:
-		return getvolume(arg, 0x04, 0x03);
+		return getvolume(p, 0x04, 0x03);
 	case SOUND_MIXER_READ_CD:
-		return getvolume(arg, 0x0a, 0x09);
+		return getvolume(p, 0x0a, 0x09);
 	case SOUND_MIXER_READ_MIC:
-		return getvolume(arg, 0x06, 0x05);
+		return getvolume(p, 0x06, 0x05);
 	case SOUND_MIXER_READ_LINE:
-		return getvolume(arg, 0x08, 0x07);
+		return getvolume(p, 0x08, 0x07);
 	case SOUND_MIXER_READ_SYNTH:
-		return getvolume(arg, 0x0c, 0x0b);
+		return getvolume(p, 0x0c, 0x0b);
 	case SOUND_MIXER_READ_PCM:
-		return getvolume(arg, 0x0e, 0x0d);
+		return getvolume(p, 0x0e, 0x0d);
 	case MIXER_READ(SOUND_MIXER_RADIO): /* fall through */
 	case SOUND_MIXER_READ_LINE1:  /* AUX1 */
-		return getvolume(arg, 0x11, 0x10);
+		return getvolume(p, 0x11, 0x10);
 	case SOUND_MIXER_READ_LINE2:  /* AUX2 */
-		return getvolume(arg, 0x13, 0x12);
+		return getvolume(p, 0x13, 0x12);
 	case SOUND_MIXER_READ_BASS:   /* get band one */
 		if (aci_idcode[1]=='C') {
-			return getequalizer(arg, 0x23, 0x22);
+			return getequalizer(p, 0x23, 0x22);
 		}
 		break;
 	case SOUND_MIXER_READ_TREBLE: /* get band seven */
 		if (aci_idcode[1]=='C') {
-			return getequalizer(arg, 0x2f, 0x2e);
+			return getequalizer(p, 0x2f, 0x2e);
 		}
 		break;
 	case SOUND_MIXER_READ_IGAIN:  /* MIC pre-amp */
@@ -567,7 +568,7 @@
 				buf=aci_micpreamp;
 			vol = SCALE(3, 100, buf <= 3 ? buf : 3);
 			vol |= vol << 8;
-			__put_user(vol, (int *)arg);
+			__put_user(vol, p);
 			return 0;
 		}
 		break;
@@ -576,7 +577,7 @@
 			buf = (100 || 100<<8);
 		else
 			buf = 0;
-		__put_user(buf, (int *)arg);
+		__put_user(buf, p);
 		return 0;
 	}
 	return -EINVAL;
diff -Nru a/sound/oss/ad1816.c b/sound/oss/ad1816.c
--- a/sound/oss/ad1816.c	Tue Jun 15 22:20:58 2004
+++ b/sound/oss/ad1816.c	Tue Jun 15 22:20:58 2004
@@ -874,10 +874,11 @@
 }
 
 static int
-ad1816_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg)
+ad1816_mixer_ioctl (int dev, unsigned int cmd, void __user * arg)
 {
 	ad1816_info    *devc = mixer_devs[dev]->devc;
 	int val;
+	int __user *p = arg;
   
 	DEBUGNOISE(printk(KERN_DEBUG "ad1816: mixer_ioctl called!\n"));
   
@@ -889,19 +890,19 @@
 			switch (cmd & 0xff){
 			case SOUND_MIXER_RECSRC:
 				
-				if (get_user(val, (int *)arg))
+				if (get_user(val, p))
 					return -EFAULT;
 				val=ad1816_set_recmask (devc, val);
-				return put_user(val, (int *)arg);
+				return put_user(val, p);
 				break;
 				
 			default:
-				if (get_user(val, (int *)arg))
+				if (get_user(val, p))
 					return -EFAULT;
 				if ((val=ad1816_mixer_set (devc, cmd & 0xff, val))<0)
 				        return val;
 				else
-				        return put_user(val, (int *)arg);
+				        return put_user(val, p);
 			}
 		} else { 
 			/* read ioctl */
@@ -909,34 +910,34 @@
 				
 			case SOUND_MIXER_RECSRC:
 				val=devc->recmask;
-				return put_user(val, (int *)arg);
+				return put_user(val, p);
 				break;
 				
 			case SOUND_MIXER_DEVMASK:
 				val=devc->supported_devices;
-				return put_user(val, (int *)arg);
+				return put_user(val, p);
 				break;
 
 			case SOUND_MIXER_STEREODEVS:
 				val=devc->supported_devices & ~(SOUND_MASK_SPEAKER | SOUND_MASK_IMIX);
-				return put_user(val, (int *)arg);
+				return put_user(val, p);
 				break;
 				
 			case SOUND_MIXER_RECMASK:
 				val=devc->supported_rec_devices;
-				return put_user(val, (int *)arg);
+				return put_user(val, p);
 				break;
 				
 			case SOUND_MIXER_CAPS:
 				val=SOUND_CAP_EXCL_INPUT;
-				return put_user(val, (int *)arg);
+				return put_user(val, p);
 				break;
 				
 			default:
 			        if ((val=ad1816_mixer_get (devc, cmd & 0xff))<0)
 				        return val;
 				else
-				        return put_user(val, (int *)arg);
+				        return put_user(val, p);
 			}
 		}
 	} else
diff -Nru a/sound/oss/ad1848.c b/sound/oss/ad1848.c
--- a/sound/oss/ad1848.c	Tue Jun 15 22:20:42 2004
+++ b/sound/oss/ad1848.c	Tue Jun 15 22:20:42 2004
@@ -624,6 +624,7 @@
 			devc->supported_devices = MODE3_MIXER_DEVICES;
 			break;
 		case MD_4232:
+		case MD_4235:
 		case MD_4236:
 			devc->supported_devices = MODE3_MIXER_DEVICES;
 			break;
@@ -672,14 +673,14 @@
 	spin_unlock_irqrestore(&devc->lock,flags);
 }
 
-static int ad1848_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int ad1848_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	ad1848_info *devc = mixer_devs[dev]->devc;
 	int val;
 
 	if (cmd == SOUND_MIXER_PRIVATE1) 
 	{
-		if (get_user(val, (int *)arg))
+		if (get_user(val, (int __user *)arg))
 			return -EFAULT;
 
 		if (val != 0xffff) 
@@ -697,11 +698,11 @@
 			spin_unlock_irqrestore(&devc->lock,flags);
 		}
 		val = devc->mixer_output_port;
-		return put_user(val, (int *)arg);
+		return put_user(val, (int __user *)arg);
 	}
 	if (cmd == SOUND_MIXER_PRIVATE2)
 	{
-		if (get_user(val, (int *)arg))
+		if (get_user(val, (int __user *)arg))
 			return -EFAULT;
 		return(ad1848_control(AD1848_MIXER_REROUTE, val));
 	}
@@ -712,18 +713,18 @@
 			switch (cmd & 0xff) 
 			{
 				case SOUND_MIXER_RECSRC:
-					if (get_user(val, (int *)arg))
+					if (get_user(val, (int __user *)arg))
 						return -EFAULT;
 					val = ad1848_set_recmask(devc, val);
 					break;
 				
 				default:
-					if (get_user(val, (int *)arg))
+					if (get_user(val, (int __user *)arg))
 					return -EFAULT;
 					val = ad1848_mixer_set(devc, cmd & 0xff, val);
 					break;
 			} 
-			return put_user(val, (int *)arg);
+			return put_user(val, (int __user *)arg);
 		}
 		else
 		{
@@ -759,7 +760,7 @@
 					val = ad1848_mixer_get(devc, cmd & 0xff);
 					break;
 			}
-			return put_user(val, (int *)arg);
+			return put_user(val, (int __user *)arg);
 		}
 	}
 	else
diff -Nru a/sound/oss/ad1889.c b/sound/oss/ad1889.c
--- a/sound/oss/ad1889.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/ad1889.c	Tue Jun 15 22:20:39 2004
@@ -437,13 +437,13 @@
 
 /************************* /dev/dsp interfaces ************************* */
 
-static ssize_t ad1889_read(struct file *file, char *buffer, size_t count,
+static ssize_t ad1889_read(struct file *file, char __user *buffer, size_t count,
 	loff_t *ppos)
 {
 	return 0;
 }
 
-static ssize_t ad1889_write(struct file *file, const char *buffer, size_t count,
+static ssize_t ad1889_write(struct file *file, const char __user *buffer, size_t count,
 	loff_t *ppos)
 {
 	ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data;
@@ -617,11 +617,12 @@
 	ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data;
 	struct dmabuf *dmabuf;
 	audio_buf_info abinfo;
+	int __user *p = (int __user *)arg;
 
 	switch (cmd)
 	{
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_RESET:
 		break;
@@ -631,7 +632,7 @@
 
 	case SNDCTL_DSP_SPEED:
 		/* set sampling rate */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val > 5400 && val < 48000)
 		{
@@ -643,7 +644,7 @@
 		return 0;
 
 	case SNDCTL_DSP_STEREO: /* undocumented? */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			val = AD1889_READW(ad1889_dev, AD_DSWSMC);
@@ -667,13 +668,13 @@
 		return 0;
 
 	case SNDCTL_DSP_GETBLKSIZE:
-		return put_user(DMA_SIZE, (int *)arg);
+		return put_user(DMA_SIZE, p);
 
 	case SNDCTL_DSP_GETFMTS:
-		return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
+		return put_user(AFMT_S16_LE|AFMT_U8, p);
 
 	case SNDCTL_DSP_SETFMT:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		if (file->f_mode & FMODE_READ) 
@@ -682,7 +683,7 @@
 		if (file->f_mode & FMODE_WRITE) 
 			ad1889_set_wav_fmt(dev, val);
 
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_CHANNELS:
 		break;
@@ -696,7 +697,7 @@
 
 	case SNDCTL_DSP_SETFRAGMENT:
 		/* not supported; uses fixed fragment sizes */
-		return put_user(DMA_SIZE, (int *)arg);
+		return put_user(DMA_SIZE, p);
 
 	case SNDCTL_DSP_GETOSPACE:
 	case SNDCTL_DSP_GETISPACE:
@@ -709,13 +710,13 @@
 		abinfo.fragstotal = 1;
 		abinfo.fragsize = DMA_SIZE;
 		abinfo.bytes = DMA_SIZE;
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 	case SNDCTL_DSP_NONBLOCK:
 		file->f_flags |= O_NONBLOCK;
 		return 0;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(0, (int *)arg);
+		return put_user(0, p);
 
 	case SNDCTL_DSP_GETTRIGGER:
 	case SNDCTL_DSP_SETTRIGGER:
@@ -732,7 +733,7 @@
 		break;
 
 	case SOUND_PCM_READ_RATE:
-		return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), (int *)arg);
+		return put_user(AD1889_READW(ad1889_dev, AD_DSWAS), p);
 
 	case SOUND_PCM_READ_CHANNELS:
 	case SOUND_PCM_READ_BITS:
diff -Nru a/sound/oss/ali5455.c b/sound/oss/ali5455.c
--- a/sound/oss/ali5455.c	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/ali5455.c	Tue Jun 15 22:20:43 2004
@@ -1579,7 +1579,7 @@
    waiting to be copied to the user's buffer.  It is filled by the dma
    machine and drained by this loop. */
 
-static ssize_t ali_read(struct file *file, char *buffer,
+static ssize_t ali_read(struct file *file, char __user *buffer,
 			size_t count, loff_t * ppos)
 {
 	struct ali_state *state = (struct ali_state *) file->private_data;
@@ -1721,7 +1721,7 @@
 /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to
    the soundcard.  it is drained by the dma machine and filled by this loop. */
 static ssize_t ali_write(struct file *file,
-			 const char *buffer, size_t count, loff_t * ppos)
+			 const char __user *buffer, size_t count, loff_t * ppos)
 {
 	struct ali_state *state = (struct ali_state *) file->private_data;
 	struct ali_card *card = state ? state->card : 0;
@@ -1981,16 +1981,19 @@
 	unsigned int i_scr;
 	int val = 0, ret;
 	struct ac97_codec *codec = state->card->ac97_codec[0];
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
+
 #ifdef DEBUG
 	printk("ali_audio: ali_ioctl, arg=0x%x, cmd=",
-	       arg ? *(int *) arg : 0);
+	       arg ? *p : 0);
 #endif
 	switch (cmd) {
 	case OSS_GETVERSION:
 #ifdef DEBUG
 		printk("OSS_GETVERSION\n");
 #endif
-		return put_user(SOUND_VERSION, (int *) arg);
+		return put_user(SOUND_VERSION, p);
 	case SNDCTL_DSP_RESET:
 #ifdef DEBUG
 		printk("SNDCTL_DSP_RESET\n");
@@ -2058,7 +2061,7 @@
 #ifdef DEBUG
 		printk("SNDCTL_DSP_SPEED\n");
 #endif
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			if (file->f_mode & FMODE_WRITE) {
@@ -2136,7 +2139,7 @@
 				spin_unlock_irqrestore(&state->card->lock, flags);
 			}
 		}
-		return put_user(dmabuf->rate, (int *) arg);
+		return put_user(dmabuf->rate, p);
 	case SNDCTL_DSP_STEREO:	/* set stereo or mono channel */
 #ifdef DEBUG
 		printk("SNDCTL_DSP_STEREO\n");
@@ -2153,7 +2156,7 @@
 		if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING) {
 			stop_spdifout(state);
 		}
-		return put_user(1, (int *) arg);
+		return put_user(1, p);
 	case SNDCTL_DSP_GETBLKSIZE:
 		if (file->f_mode & FMODE_WRITE) {
 			if (codec_independent_spdif_locked > 0) {
@@ -2177,22 +2180,22 @@
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETBLKSIZE %d\n", dmabuf->userfragsize);
 #endif
-		return put_user(dmabuf->userfragsize, (int *) arg);
+		return put_user(dmabuf->userfragsize, p);
 	case SNDCTL_DSP_GETFMTS:	/* Returns a mask of supported sample format */
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETFMTS\n");
 #endif
-		return put_user(AFMT_S16_LE, (int *) arg);
+		return put_user(AFMT_S16_LE, p);
 	case SNDCTL_DSP_SETFMT:	/* Select sample format */
 #ifdef DEBUG
 		printk("SNDCTL_DSP_SETFMT\n");
 #endif
-		return put_user(AFMT_S16_LE, (int *) arg);
+		return put_user(AFMT_S16_LE, p);
 	case SNDCTL_DSP_CHANNELS:	// add support 4,6 channel 
 #ifdef DEBUG
 		printk("SNDCTL_DSP_CHANNELS\n");
 #endif
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val > 0) {
 			if (dmabuf->enable & DAC_RUNNING) {
@@ -2208,7 +2211,7 @@
 				stop_adc(state);
 			}
 		} else {
-			return put_user(state->card->channels, (int *) arg);
+			return put_user(state->card->channels, p);
 		}
 
 		i_scr = inl(state->card->iobase + ALI_SCR);
@@ -2243,7 +2246,7 @@
 			val = ret;
 			break;
 		}
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 	case SNDCTL_DSP_POST:	/* the user has sent all data and is notifying us */
 		/* we update the swptr to the end of the last sg segment then return */
 #ifdef DEBUG
@@ -2270,7 +2273,7 @@
 	case SNDCTL_DSP_SUBDIVIDE:
 		if (dmabuf->subdivision)
 			return -EINVAL;
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -2281,7 +2284,7 @@
 		dmabuf->ready = 0;
 		return 0;
 	case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		dmabuf->ossfragsize = 1 << (val & 0xffff);
 		dmabuf->ossmaxfrags = (val >> 16) & 0xffff;
@@ -2360,7 +2363,7 @@
 		       abinfo.bytes, abinfo.fragsize, abinfo.fragments,
 		       abinfo.fragstotal);
 #endif
-		return copy_to_user((void *) arg, &abinfo,
+		return copy_to_user(argp, &abinfo,
 				    sizeof(abinfo)) ? -EFAULT : 0;
 	case SNDCTL_DSP_GETOPTR:
 		if (!(file->f_mode & FMODE_WRITE))
@@ -2408,7 +2411,7 @@
 		printk("SNDCTL_DSP_GETOPTR %d, %d, %d, %d\n", cinfo.bytes,
 		       cinfo.blocks, cinfo.ptr, dmabuf->count);
 #endif
-		return copy_to_user((void *) arg, &cinfo, sizeof(cinfo))? -EFAULT : 0;
+		return copy_to_user(argp, &cinfo, sizeof(cinfo))? -EFAULT : 0;
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
 			return -EINVAL;
@@ -2425,7 +2428,7 @@
 		       abinfo.bytes, abinfo.fragsize, abinfo.fragments,
 		       abinfo.fragstotal);
 #endif
-		return copy_to_user((void *) arg, &abinfo,
+		return copy_to_user(argp, &abinfo,
 				    sizeof(abinfo)) ? -EFAULT : 0;
 	case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -2447,7 +2450,7 @@
 		printk("SNDCTL_DSP_GETIPTR %d, %d, %d, %d\n", cinfo.bytes,
 		       cinfo.blocks, cinfo.ptr, dmabuf->count);
 #endif
-		return copy_to_user((void *) arg, &cinfo, sizeof(cinfo))? -EFAULT: 0;
+		return copy_to_user(argp, &cinfo, sizeof(cinfo))? -EFAULT: 0;
 	case SNDCTL_DSP_NONBLOCK:
 #ifdef DEBUG
 		printk("SNDCTL_DSP_NONBLOCK\n");
@@ -2459,15 +2462,15 @@
 		printk("SNDCTL_DSP_GETCAPS\n");
 #endif
 		return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER |
-				DSP_CAP_MMAP | DSP_CAP_BIND, (int *) arg);
+				DSP_CAP_MMAP | DSP_CAP_BIND, p);
 	case SNDCTL_DSP_GETTRIGGER:
 		val = 0;
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETTRIGGER 0x%x\n", dmabuf->trigger);
 #endif
-		return put_user(dmabuf->trigger, (int *) arg);
+		return put_user(dmabuf->trigger, p);
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 #if defined(DEBUG) || defined(DEBUG_MMAP)
 		printk("SNDCTL_DSP_SETTRIGGER 0x%x\n", val);
@@ -2586,27 +2589,27 @@
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETODELAY %d\n", dmabuf->count);
 #endif
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 	case SOUND_PCM_READ_RATE:
 #ifdef DEBUG
 		printk("SOUND_PCM_READ_RATE %d\n", dmabuf->rate);
 #endif
-		return put_user(dmabuf->rate, (int *) arg);
+		return put_user(dmabuf->rate, p);
 	case SOUND_PCM_READ_CHANNELS:
 #ifdef DEBUG
 		printk("SOUND_PCM_READ_CHANNELS\n");
 #endif
-		return put_user(2, (int *) arg);
+		return put_user(2, p);
 	case SOUND_PCM_READ_BITS:
 #ifdef DEBUG
 		printk("SOUND_PCM_READ_BITS\n");
 #endif
-		return put_user(AFMT_S16_LE, (int *) arg);
+		return put_user(AFMT_S16_LE, p);
 	case SNDCTL_DSP_SETSPDIF:	/* Set S/PDIF Control register */
 #ifdef DEBUG
 		printk("SNDCTL_DSP_SETSPDIF\n");
 #endif
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		/* Check to make sure the codec supports S/PDIF transmitter */
 		if ((state->card->ac97_features & 4)) {
@@ -2625,12 +2628,12 @@
 		else
 			printk(KERN_WARNING "ali_audio: S/PDIF transmitter not avalible.\n");
 #endif
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 	case SNDCTL_DSP_GETSPDIF:	/* Get S/PDIF Control register */
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETSPDIF\n");
 #endif
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		/* Check to make sure the codec supports S/PDIF transmitter */
 		if (!(state->card->ac97_features & 4)) {
@@ -2642,14 +2645,14 @@
 			val = ali_ac97_get(codec, AC97_SPDIF_CONTROL);
 		}
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 //end add support spdif out
 //add support 4,6 channel
 	case SNDCTL_DSP_GETCHANNELMASK:
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETCHANNELMASK\n");
 #endif
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		/* Based on AC'97 DAC support, not ICH hardware */
 		val = DSP_BIND_FRONT;
@@ -2659,12 +2662,12 @@
 			val |= DSP_BIND_SURR;
 		if (state->card->ac97_features & 0x0140)
 			val |= DSP_BIND_CENTER_LFE;
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 	case SNDCTL_DSP_BIND_CHANNEL:
 #ifdef DEBUG
 		printk("SNDCTL_DSP_BIND_CHANNEL\n");
 #endif
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val == DSP_BIND_QUERY) {
 			val = DSP_BIND_FRONT;	/* Always report this as being enabled */
@@ -2749,7 +2752,7 @@
 					val &= ~DSP_BIND_CENTER_LFE;
 			}
 		}
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 	case SNDCTL_DSP_MAPINBUF:
 	case SNDCTL_DSP_MAPOUTBUF:
 	case SNDCTL_DSP_SETSYNCRO:
diff -Nru a/sound/oss/audio.c b/sound/oss/audio.c
--- a/sound/oss/audio.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/audio.c	Tue Jun 15 22:20:39 2004
@@ -38,7 +38,7 @@
 #define NEUTRAL16	0x00
 
 
-int             dma_ioctl(int dev, unsigned int cmd, caddr_t arg);
+int             dma_ioctl(int dev, unsigned int cmd, void __user *arg);
 
 static int set_format(int dev, int fmt)
 {
@@ -219,7 +219,7 @@
 		buff[i] = table[buff[i]];
 }
 
-int audio_write(int dev, struct file *file, const char *buf, int count)
+int audio_write(int dev, struct file *file, const char __user *buf, int count)
 {
 	int c, p, l, buf_size, used, returned;
 	int err;
@@ -300,7 +300,7 @@
 	return count;
 }
 
-int audio_read(int dev, struct file *file, char *buf, int count)
+int audio_read(int dev, struct file *file, char __user *buf, int count)
 {
 	int             c, p, l;
 	char           *dmabuf;
@@ -365,11 +365,12 @@
 	return count - c;
 }
 
-int audio_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg)
+int audio_ioctl(int dev, struct file *file, unsigned int cmd, void __user *arg)
 {
 	int val, count;
 	unsigned long flags;
 	struct dma_buffparms *dmap;
+	int __user *p = arg;
 
 	dev = dev >> 4;
 
@@ -399,7 +400,7 @@
 				return 0;
 			audio_devs[dev]->dmap_out->flags |= DMA_POST | DMA_DIRTY;
 			sync_output(dev);
-			dma_ioctl(dev, SNDCTL_DSP_POST, (caddr_t) 0);
+			dma_ioctl(dev, SNDCTL_DSP_POST, NULL);
 			return 0;
 
 		case SNDCTL_DSP_RESET:
@@ -412,7 +413,7 @@
 			break;
 	
 		case SNDCTL_DSP_SETFMT:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			val = set_format(dev, val);
 			break;
@@ -449,7 +450,7 @@
 				break;
 			
 		case SOUND_PCM_WRITE_RATE:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			val = audio_devs[dev]->d->set_speed(dev, val);
 			break;
@@ -459,7 +460,7 @@
 			break;
 			
 		case SNDCTL_DSP_STEREO:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (val > 1 || val < 0)
 				return -EINVAL;
@@ -467,7 +468,7 @@
 			break;
 
 		case SOUND_PCM_WRITE_CHANNELS:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			val = audio_devs[dev]->d->set_channels(dev, val);
 			break;
@@ -486,7 +487,7 @@
 			return (audio_devs[dev]->flags & DMA_DUPLEX) ? 0 : -EIO;
 
 		case SNDCTL_DSP_PROFILE:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (audio_devs[dev]->open_mode & OPEN_WRITE)
 				audio_devs[dev]->dmap_out->applic_profile = val;
@@ -522,7 +523,7 @@
 		default:
 			return dma_ioctl(dev, cmd, arg);
 	}
-	return put_user(val, (int *)arg);
+	return put_user(val, p);
 }
 
 void audio_init_devices(void)
@@ -734,7 +735,7 @@
 	return bytes | ((count - 1) << 16);
 }
 
-int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
+int dma_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	struct dma_buffparms *dmap_out = audio_devs[dev]->dmap_out;
 	struct dma_buffparms *dmap_in = audio_devs[dev]->dmap_in;
@@ -748,7 +749,7 @@
 	{
 		case SNDCTL_DSP_SUBDIVIDE:
 			ret = 0;
-			if (get_user(fact, (int *)arg))
+			if (get_user(fact, (int __user *)arg))
 				return -EFAULT;
 			if (audio_devs[dev]->open_mode & OPEN_WRITE)
 				ret = dma_subdivide(dev, dmap_out, fact);
@@ -816,7 +817,7 @@
 			return 0;
 
 		case SNDCTL_DSP_SETTRIGGER:
-			if (get_user(bits, (int *)arg))
+			if (get_user(bits, (int __user *)arg))
 				return -EFAULT;
 			bits &= audio_devs[dev]->open_mode;
 			if (audio_devs[dev]->d->trigger == NULL)
@@ -957,7 +958,7 @@
 
 		case SNDCTL_DSP_SETFRAGMENT:
 			ret = 0;
-			if (get_user(fact, (int *)arg))
+			if (get_user(fact, (int __user *)arg))
 				return -EFAULT;
 			if (audio_devs[dev]->open_mode & OPEN_WRITE)
 				ret = dma_set_fragment(dev, dmap_out, fact);
@@ -978,5 +979,5 @@
 				return -EINVAL;
 			return audio_devs[dev]->d->ioctl(dev, cmd, arg);
 	}
-	return put_user(ret, (int *)arg);
+	return put_user(ret, (int __user *)arg);
 }
diff -Nru a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c
--- a/sound/oss/awe_wave.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/awe_wave.c	Tue Jun 15 22:20:39 2004
@@ -336,14 +336,14 @@
 /* sequencer interface */
 static int awe_open(int dev, int mode);
 static void awe_close(int dev);
-static int awe_ioctl(int dev, unsigned int cmd, caddr_t arg);
+static int awe_ioctl(int dev, unsigned int cmd, void __user * arg);
 static int awe_kill_note(int dev, int voice, int note, int velocity);
 static int awe_start_note(int dev, int v, int note_num, int volume);
 static int awe_set_instr(int dev, int voice, int instr_no);
 static int awe_set_instr_2(int dev, int voice, int instr_no);
 static void awe_reset(int dev);
 static void awe_hw_control(int dev, unsigned char *event);
-static int awe_load_patch(int dev, int format, const char *addr,
+static int awe_load_patch(int dev, int format, const char __user *addr,
 			  int offs, int count, int pmgr_flag);
 static void awe_aftertouch(int dev, int voice, int pressure);
 static void awe_controller(int dev, int voice, int ctrl_num, int value);
@@ -374,21 +374,21 @@
 static int awe_clear_voice(void);
 
 /* load / remove patches */
-static int awe_open_patch(awe_patch_info *patch, const char *addr, int count);
-static int awe_close_patch(awe_patch_info *patch, const char *addr, int count);
-static int awe_unload_patch(awe_patch_info *patch, const char *addr, int count);
-static int awe_load_info(awe_patch_info *patch, const char *addr, int count);
-static int awe_remove_info(awe_patch_info *patch, const char *addr, int count);
-static int awe_load_data(awe_patch_info *patch, const char *addr, int count);
-static int awe_replace_data(awe_patch_info *patch, const char *addr, int count);
-static int awe_load_map(awe_patch_info *patch, const char *addr, int count);
+static int awe_open_patch(awe_patch_info *patch, const char __user *addr, int count);
+static int awe_close_patch(awe_patch_info *patch, const char __user *addr, int count);
+static int awe_unload_patch(awe_patch_info *patch, const char __user *addr, int count);
+static int awe_load_info(awe_patch_info *patch, const char __user *addr, int count);
+static int awe_remove_info(awe_patch_info *patch, const char __user *addr, int count);
+static int awe_load_data(awe_patch_info *patch, const char __user *addr, int count);
+static int awe_replace_data(awe_patch_info *patch, const char __user *addr, int count);
+static int awe_load_map(awe_patch_info *patch, const char __user *addr, int count);
 #ifdef AWE_HAS_GUS_COMPATIBILITY
-static int awe_load_guspatch(const char *addr, int offs, int size, int pmgr_flag);
+static int awe_load_guspatch(const char __user *addr, int offs, int size, int pmgr_flag);
 #endif
-/*static int awe_probe_info(awe_patch_info *patch, const char *addr, int count);*/
-static int awe_probe_data(awe_patch_info *patch, const char *addr, int count);
+/*static int awe_probe_info(awe_patch_info *patch, const char __user *addr, int count);*/
+static int awe_probe_data(awe_patch_info *patch, const char __user *addr, int count);
 static sf_list *check_patch_opened(int type, char *name);
-static int awe_write_wave_data(const char *addr, int offset, awe_sample_list *sp, int channels);
+static int awe_write_wave_data(const char __user *addr, int offset, awe_sample_list *sp, int channels);
 static int awe_create_sf(int type, char *name);
 static void awe_free_sf(sf_list *sf);
 static void add_sf_info(sf_list *sf, awe_voice_list *rec);
@@ -422,10 +422,10 @@
 static int awe_detect_base(int addr);
 static int awe_detect(void);
 static void awe_check_dram(void);
-static int awe_load_chorus_fx(awe_patch_info *patch, const char *addr, int count);
+static int awe_load_chorus_fx(awe_patch_info *patch, const char __user *addr, int count);
 static void awe_set_chorus_mode(int mode);
 static void awe_update_chorus_mode(void);
-static int awe_load_reverb_fx(awe_patch_info *patch, const char *addr, int count);
+static int awe_load_reverb_fx(awe_patch_info *patch, const char __user *addr, int count);
 static void awe_set_reverb_mode(int mode);
 static void awe_update_reverb_mode(void);
 static void awe_equalizer(int bass, int treble);
@@ -1865,7 +1865,7 @@
 /* sequencer I/O control:
  */
 static int
-awe_ioctl(int dev, unsigned int cmd, caddr_t arg)
+awe_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	switch (cmd) {
 	case SNDCTL_SYNTH_INFO:
@@ -1873,7 +1873,7 @@
 			awe_info.nr_voices = awe_max_voices;
 		else
 			awe_info.nr_voices = AWE_MAX_CHANNELS;
-		if (copy_to_user((char*)arg, &awe_info, sizeof(awe_info)))
+		if (copy_to_user(arg, &awe_info, sizeof(awe_info)))
 			return -EFAULT;
 		return 0;
 		break;
@@ -2656,7 +2656,7 @@
  */
 
 static int
-awe_load_patch(int dev, int format, const char *addr,
+awe_load_patch(int dev, int format, const char __user *addr,
 	       int offs, int count, int pmgr_flag)
 {
 	awe_patch_info patch;
@@ -2865,7 +2865,7 @@
 
 /* open patch; create sf list and set opened flag */
 static int
-awe_open_patch(awe_patch_info *patch, const char *addr, int count)
+awe_open_patch(awe_patch_info *patch, const char __user *addr, int count)
 {
 	awe_open_parm parm;
 	int shared;
@@ -2913,7 +2913,7 @@
 
 /* close the patch; if no voice is loaded, remove the patch */
 static int
-awe_close_patch(awe_patch_info *patch, const char *addr, int count)
+awe_close_patch(awe_patch_info *patch, const char __user *addr, int count)
 {
 	if (patch_opened && sftail) {
 		/* if no voice is loaded, release the current patch */
@@ -2929,7 +2929,7 @@
 
 /* remove the latest patch */
 static int
-awe_unload_patch(awe_patch_info *patch, const char *addr, int count)
+awe_unload_patch(awe_patch_info *patch, const char __user *addr, int count)
 {
 	if (current_sf_id > 0 && current_sf_id > locked_sf_id) {
 		awe_reset(0);
@@ -2968,7 +2968,7 @@
 
 /* load voice map */
 static int
-awe_load_map(awe_patch_info *patch, const char *addr, int count)
+awe_load_map(awe_patch_info *patch, const char __user *addr, int count)
 {
 	awe_voice_map map;
 	awe_voice_list *rec, *p;
@@ -3019,7 +3019,7 @@
 #if 0
 /* probe preset in the current list -- nothing to be loaded */
 static int
-awe_probe_info(awe_patch_info *patch, const char *addr, int count)
+awe_probe_info(awe_patch_info *patch, const char __user *addr, int count)
 {
 #ifdef AWE_ALLOW_SAMPLE_SHARING
 	awe_voice_map map;
@@ -3054,7 +3054,7 @@
 
 /* probe sample in the current list -- nothing to be loaded */
 static int
-awe_probe_data(awe_patch_info *patch, const char *addr, int count)
+awe_probe_data(awe_patch_info *patch, const char __user *addr, int count)
 {
 #ifdef AWE_ALLOW_SAMPLE_SHARING
 	if (! patch_opened)
@@ -3100,7 +3100,7 @@
 
 /* load voice information data */
 static int
-awe_load_info(awe_patch_info *patch, const char *addr, int count)
+awe_load_info(awe_patch_info *patch, const char __user *addr, int count)
 {
 	int offset;
 	awe_voice_rec_hdr hdr;
@@ -3188,7 +3188,7 @@
 
 /* remove instrument layers */
 static int
-awe_remove_info(awe_patch_info *patch, const char *addr, int count)
+awe_remove_info(awe_patch_info *patch, const char __user *addr, int count)
 {
 	unsigned char bank, instr;
 	sf_list *sf;
@@ -3208,7 +3208,7 @@
 
 /* load wave sample data */
 static int
-awe_load_data(awe_patch_info *patch, const char *addr, int count)
+awe_load_data(awe_patch_info *patch, const char __user *addr, int count)
 {
 	int offset, size;
 	int rc;
@@ -3260,7 +3260,7 @@
 
 /* replace wave sample data */
 static int
-awe_replace_data(awe_patch_info *patch, const char *addr, int count)
+awe_replace_data(awe_patch_info *patch, const char __user *addr, int count)
 {
 	int offset;
 	int size;
@@ -3322,13 +3322,13 @@
 
 /*----------------------------------------------------------------*/
 
-static const char *readbuf_addr;
+static const char __user *readbuf_addr;
 static int readbuf_offs;
 static int readbuf_flags;
 
 /* initialize read buffer */
 static int
-readbuf_init(const char *addr, int offset, awe_sample_info *sp)
+readbuf_init(const char __user *addr, int offset, awe_sample_info *sp)
 {
 	readbuf_addr = addr;
 	readbuf_offs = offset;
@@ -3344,10 +3344,10 @@
 	/* read from user buffer */
 	if (readbuf_flags & AWE_SAMPLE_8BITS) {
 		unsigned char cc;
-		get_user(cc, (unsigned char*)(readbuf_addr + readbuf_offs + pos));
+		get_user(cc, (unsigned char __user *)(readbuf_addr + readbuf_offs + pos));
 		c = (unsigned short)cc << 8; /* convert 8bit -> 16bit */
 	} else {
-		get_user(c, (unsigned short*)(readbuf_addr + readbuf_offs + pos * 2));
+		get_user(c, (unsigned short __user *)(readbuf_addr + readbuf_offs + pos * 2));
 	}
 	if (readbuf_flags & AWE_SAMPLE_UNSIGNED)
 		c ^= 0x8000; /* unsigned -> signed */
@@ -3365,7 +3365,7 @@
 
 /* loading onto memory - return the actual written size */
 static int 
-awe_write_wave_data(const char *addr, int offset, awe_sample_list *list, int channels)
+awe_write_wave_data(const char __user *addr, int offset, awe_sample_list *list, int channels)
 {
 	int i, truesize, dram_offset;
 	awe_sample_info *sp = &list->v;
@@ -3481,7 +3481,7 @@
 
 /* load GUS patch */
 static int
-awe_load_guspatch(const char *addr, int offs, int size, int pmgr_flag)
+awe_load_guspatch(const char __user *addr, int offs, int size, int pmgr_flag)
 {
 	struct patch_info patch;
 	awe_voice_info *rec;
@@ -4112,7 +4112,7 @@
  * AWE32 mixer device control
  */
 
-static int awe_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg);
+static int awe_mixer_ioctl(int dev, unsigned int cmd, void __user *arg);
 
 static int my_mixerdev = -1;
 
@@ -4137,14 +4137,14 @@
 }
 
 static int
-awe_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+awe_mixer_ioctl(int dev, unsigned int cmd, void __user * arg)
 {
 	int i, level, value;
 
 	if (((cmd >> 8) & 0xff) != 'M')
 		return -EINVAL;
 
-	if (get_user(level, (int *)arg))
+	if (get_user(level, (int __user *)arg))
 		return -EFAULT;
 	level = ((level & 0xff) + (level >> 8)) / 2;
 	DEBUG(0,printk("AWEMix: cmd=%x val=%d\n", cmd & 0xff, level));
@@ -4201,7 +4201,7 @@
 		level = 0;
 		break;
 	}
-	if (put_user(level, (int *)arg))
+	if (put_user(level, (int __user *)arg))
 		return -EFAULT;
 	return level;
 }
@@ -4662,7 +4662,7 @@
 };
 
 static int
-awe_load_chorus_fx(awe_patch_info *patch, const char *addr, int count)
+awe_load_chorus_fx(awe_patch_info *patch, const char __user *addr, int count)
 {
 	if (patch->optarg < AWE_CHORUS_PREDEFINED || patch->optarg >= AWE_CHORUS_NUMBERS) {
 		printk(KERN_WARNING "AWE32 Error: invalid chorus mode %d for uploading\n", patch->optarg);
@@ -4770,7 +4770,7 @@
 };
 
 static int
-awe_load_reverb_fx(awe_patch_info *patch, const char *addr, int count)
+awe_load_reverb_fx(awe_patch_info *patch, const char __user *addr, int count)
 {
 	if (patch->optarg < AWE_REVERB_PREDEFINED || patch->optarg >= AWE_REVERB_NUMBERS) {
 		printk(KERN_WARNING "AWE32 Error: invalid reverb mode %d for uploading\n", patch->optarg);
@@ -4915,7 +4915,7 @@
 
 static int awe_midi_open(int dev, int mode, void (*input)(int,unsigned char), void (*output)(int));
 static void awe_midi_close(int dev);
-static int awe_midi_ioctl(int dev, unsigned cmd, caddr_t arg);
+static int awe_midi_ioctl(int dev, unsigned cmd, void __user * arg);
 static int awe_midi_outputc(int dev, unsigned char midi_byte);
 
 static void init_midi_status(MidiStatus *st);
@@ -5055,7 +5055,7 @@
 
 
 static int
-awe_midi_ioctl (int dev, unsigned cmd, caddr_t arg)
+awe_midi_ioctl (int dev, unsigned cmd, void __user *arg)
 {
 	return -EPERM;
 }
diff -Nru a/sound/oss/btaudio.c b/sound/oss/btaudio.c
--- a/sound/oss/btaudio.c	Tue Jun 15 22:20:38 2004
+++ b/sound/oss/btaudio.c	Tue Jun 15 22:20:38 2004
@@ -327,6 +327,7 @@
 {
 	struct btaudio *bta = file->private_data;
 	int ret,val=0,i=0;
+	void __user *argp = (void __user *)arg;
 
 	if (cmd == SOUND_MIXER_INFO) {
 		mixer_info info;
@@ -334,7 +335,7 @@
                 strlcpy(info.id,"bt878",sizeof(info.id));
                 strlcpy(info.name,"Brooktree Bt878 audio",sizeof(info.name));
                 info.modify_counter = bta->mixcount;
-                if (copy_to_user((void *)arg, &info, sizeof(info)))
+                if (copy_to_user(argp, &info, sizeof(info)))
                         return -EFAULT;
 		return 0;
 	}
@@ -343,16 +344,16 @@
 		memset(&info,0,sizeof(info));
                 strlcpy(info.id,"bt878",sizeof(info.id)-1);
                 strlcpy(info.name,"Brooktree Bt878 audio",sizeof(info.name));
-                if (copy_to_user((void *)arg, &info, sizeof(info)))
+                if (copy_to_user(argp, &info, sizeof(info)))
                         return -EFAULT;
 		return 0;
 	}
 	if (cmd == OSS_GETVERSION)
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, (int __user *)argp);
 
 	/* read */
 	if (_SIOC_DIR(cmd) & _SIOC_WRITE)
-		if (get_user(val, (int *)arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 
 	switch (cmd) {
@@ -421,7 +422,7 @@
 	default:
 		return -EINVAL;
 	}
-	if (put_user(ret, (int *)arg))
+	if (put_user(ret, (int __user *)argp))
 		return -EFAULT;
 	return 0;
 }
@@ -503,7 +504,7 @@
 	return 0;
 }
 
-static ssize_t btaudio_dsp_read(struct file *file, char *buffer,
+static ssize_t btaudio_dsp_read(struct file *file, char __user *buffer,
 				size_t swcount, loff_t *ppos)
 {
 	struct btaudio *bta = file->private_data;
@@ -554,7 +555,7 @@
 		} else if (!bta->analog) {
 			/* stereo => mono (digital audio) */
 			__s16 *src = (__s16*)(bta->buf_cpu + bta->read_offset);
-			__s16 *dst = (__s16*)(buffer + ret);
+			__s16 __user *dst = (__s16 __user *)(buffer + ret);
 			__s16 avg;
 			int n = ndst>>1;
 			if (0 != verify_area(VERIFY_WRITE,dst,ndst)) {
@@ -565,13 +566,13 @@
 			for (; n; n--, dst++) {
 				avg  = (__s16)le16_to_cpu(*src) / 2; src++;
 				avg += (__s16)le16_to_cpu(*src) / 2; src++;
-				__put_user(cpu_to_le16(avg),(__u16*)(dst));
+				__put_user(cpu_to_le16(avg),dst);
 			}
 
 		} else if (8 == bta->bits) {
 			/* copy + byte downsampling (audio A/D) */
 			__u8 *src = bta->buf_cpu + bta->read_offset;
-			__u8 *dst = buffer + ret;
+			__u8 __user *dst = buffer + ret;
 			int n = ndst;
 			if (0 != verify_area(VERIFY_WRITE,dst,ndst)) {
 				if (0 == ret)
@@ -579,12 +580,12 @@
 				break;
 			}
 			for (; n; n--, src += (1 << bta->sampleshift), dst++)
-				__put_user(*src,(__u8*)(dst));
+				__put_user(*src, dst);
 
 		} else {
 			/* copy + word downsampling (audio A/D) */
 			__u16 *src = (__u16*)(bta->buf_cpu + bta->read_offset);
-			__u16 *dst = (__u16*)(buffer + ret);
+			__u16 __user *dst = (__u16 __user *)(buffer + ret);
 			int n = ndst>>1;
 			if (0 != verify_area(VERIFY_WRITE,dst,ndst)) {
 				if (0 == ret)
@@ -592,7 +593,7 @@
 				break;
 			}
 			for (; n; n--, src += (1 << bta->sampleshift), dst++)
-				__put_user(*src,(__u16*)(dst));
+				__put_user(*src, dst);
 		}
 
 		ret     += ndst;
@@ -609,7 +610,7 @@
 	return ret;
 }
 
-static ssize_t btaudio_dsp_write(struct file *file, const char *buffer,
+static ssize_t btaudio_dsp_write(struct file *file, const char __user *buffer,
 				 size_t count, loff_t *ppos)
 {
 	return -EINVAL;
@@ -620,15 +621,17 @@
 {
 	struct btaudio *bta = file->private_data;
 	int s, i, ret, val = 0;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 	
         switch (cmd) {
         case OSS_GETVERSION:
-                return put_user(SOUND_VERSION, (int *)arg);
+                return put_user(SOUND_VERSION, p);
         case SNDCTL_DSP_GETCAPS:
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-		if (get_user(val, (int*)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (bta->analog) {
 			for (s = 0; s < 16; s++)
@@ -656,14 +659,14 @@
 		/* fall through */
         case SOUND_PCM_READ_RATE:
 		if (bta->analog) {
-			return put_user(HWBASE_AD*4/bta->decimation>>bta->sampleshift, (int*)arg);
+			return put_user(HWBASE_AD*4/bta->decimation>>bta->sampleshift, p);
 		} else {
-			return put_user(bta->rate, (int*)arg);
+			return put_user(bta->rate, p);
 		}
 
         case SNDCTL_DSP_STEREO:
 		if (!bta->analog) {
-			if (get_user(val, (int*)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			bta->channels    = (val > 0) ? 2 : 1;
 			bta->sampleshift = (bta->channels == 2) ? 0 : 1;
@@ -681,11 +684,11 @@
 					       "btaudio: stereo=0 channels=1\n");
 			}
 		}
-		return put_user((bta->channels)-1, (int *)arg);
+		return put_user((bta->channels)-1, p);
 
         case SNDCTL_DSP_CHANNELS:
 		if (!bta->analog) {
-			if (get_user(val, (int*)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			bta->channels    = (val > 1) ? 2 : 1;
 			bta->sampleshift = (bta->channels == 2) ? 0 : 1;
@@ -696,16 +699,16 @@
 		}
 		/* fall through */
         case SOUND_PCM_READ_CHANNELS:
-		return put_user(bta->channels, (int *)arg);
+		return put_user(bta->channels, p);
 		
         case SNDCTL_DSP_GETFMTS: /* Returns a mask */
 		if (bta->analog)
-			return put_user(AFMT_S16_LE|AFMT_S8, (int*)arg);
+			return put_user(AFMT_S16_LE|AFMT_S8, p);
 		else
-			return put_user(AFMT_S16_LE, (int*)arg);
+			return put_user(AFMT_S16_LE, p);
 
         case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int*)arg))
+		if (get_user(val, p))
 			return -EFAULT;
                 if (val != AFMT_QUERY) {
 			if (bta->analog)
@@ -722,10 +725,10 @@
 		if (debug)
 			printk(KERN_DEBUG "btaudio: fmt: bits=%d\n",bta->bits);
                 return put_user((bta->bits==16) ? AFMT_S16_LE : AFMT_S8,
-				(int*)arg);
+				p);
 		break;
         case SOUND_PCM_READ_BITS:
-		return put_user(bta->bits, (int*)arg);
+		return put_user(bta->bits, p);
 
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -745,7 +748,7 @@
 			if (0 != (ret = make_risc(bta)))
 				return ret;
 		}
-		return put_user(bta->block_bytes>>bta->sampleshift,(int*)arg);
+		return put_user(bta->block_bytes>>bta->sampleshift,p);
 
         case SNDCTL_DSP_SYNC:
 		/* NOP */
@@ -764,7 +767,7 @@
 			       "returns %d/%d/%d/%d\n",
 			       info.fragsize, info.fragstotal,
 			       info.bytes, info.fragments);
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user(argp, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
diff -Nru a/sound/oss/cmpci.c b/sound/oss/cmpci.c
--- a/sound/oss/cmpci.c	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/cmpci.c	Tue Jun 15 22:20:41 2004
@@ -1,16 +1,13 @@
-/*****************************************************************************/
 /*
  *      cmpci.c  --  C-Media PCI audio driver.
  *
- *      Copyright (C) 1999  ChenLi Tien (cltien@cmedia.com.tw)
- *      		    C-media support (support@cmedia.com.tw)
+ *      Copyright (C) 1999  C-media support (support@cmedia.com.tw)
  *
  *      Based on the PCI drivers by Thomas Sailer (sailer@ife.ee.ethz.ch)
  *
  * 	For update, visit:
- * 		http://members.home.net/puresoft/cmedia.html
  * 		http://www.cmedia.com.tw
- * 	
+ *
  *      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
@@ -77,16 +74,38 @@
  *    08/10/2001 - use set_current_state in some more places
  *
  *	Carlos Eduardo Gorges <carlos@techlinux.com.br>
- *	Fri May 25 2001 
+ *	Fri May 25 2001
  *	- SMP support ( spin[un]lock* revision )
- *	- speaker mixer support 
+ *	- speaker mixer support
  *	Mon Aug 13 2001
  *	- optimizations and cleanups
+ *
  *    03/01/2003 - open_mode fixes from Georg Acher <acher@in.tum.de>
+ *	Simon Braunschmidt <brasimon@web.de>
+ *     Sat Jan 31 2004
+ *	- provide support for opl3 FM by releasing IO range after initialization
  *
+ *    ChenLi Tien <cltien@cmedia.com.tw>
+ *    Mar 9 2004
+ *	- Fix S/PDIF out if spdif_loop enabled
+ *	- Load opl3 driver if enabled (fmio in proper range)
+ *	- Load mpu401 if enabled (mpuio in proper range)
+ *    Apr 5 2004
+ *	- Fix DUAL_DAC dma synchronization bug
+ *	- Check exist FM/MPU401 I/O before activate.
+ *	- Add AFTM_S16_BE format support, so MPlayer/Xine can play AC3/mutlichannel
+ *	  on Mac
+ *	- Change to support kernel 2.6 so only small patch needed
+ *	- All parameters default to 0
+ *	- Add spdif_out to send PCM through S/PDIF out jack
+ *	- Add hw_copy to get 4-spaker output for general PCM/analog output
+ *
+ *    Stefan Thater <stefan.thaeter@gmx.de>
+ *    Apr 5 2004
+ *	- Fix mute single channel for CD/Line-in/AUX-in
  */
 /*****************************************************************************/
-      
+
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/string.h>
@@ -109,11 +128,21 @@
 #include <asm/page.h>
 #include <asm/uaccess.h>
 
-#include "dm.h"
+#ifdef CONFIG_SOUND_CMPCI_MIDI
+#include "sound_config.h"
+#include "mpu401.h"
+#endif
+#ifdef CONFIG_SOUND_CMPCI_FM
+#include "opl3.h"
+#endif
+#ifdef CONFIG_SOUND_CMPCI_JOYSTICK
+#include <linux/gameport.h>
+#endif
 
 /* --------------------------------------------------------------------- */
 #undef OSS_DOCUMENTED_MIXER_SEMANTICS
 #undef DMABYTEIO
+#define	DBG(x) {}
 /* --------------------------------------------------------------------- */
 
 #define CM_MAGIC  ((PCI_VENDOR_ID_CMEDIA<<16)|PCI_DEVICE_ID_CMEDIA_CM8338A)
@@ -142,6 +171,9 @@
 #define CODEC_CMI_CH1_FRAME1		(0x88)
 #define CODEC_CMI_CH1_FRAME2		(0x8C)
 
+#define CODEC_CMI_SPDIF_CTRL		(0x90)
+#define CODEC_CMI_MISC_CTRL2		(0x92)
+
 #define CODEC_CMI_EXT_REG		(0xF0)
 
 /*  Mixer registers for SB16 ******************/
@@ -178,51 +210,173 @@
 #define DSP_MIX_TREBLEIDX_R		((unsigned char)(0x45))
 #define DSP_MIX_BASSIDX_L		((unsigned char)(0x46))
 #define DSP_MIX_BASSIDX_R		((unsigned char)(0x47))
+#define DSP_MIX_EXTENSION		((unsigned char)(0xf0))
+// pseudo register for AUX
+#define	DSP_MIX_AUXVOL_L		((unsigned char)(0x50))
+#define	DSP_MIX_AUXVOL_R		((unsigned char)(0x51))
+
+// I/O length
+#define CM_EXTENT_CODEC	  0x100
+#define CM_EXTENT_MIDI	  0x2
+#define CM_EXTENT_SYNTH	  0x4
+#define CM_EXTENT_GAME	  0x8
+
+// Function Control Register 0 (00h)
+#define CHADC0    	0x01
+#define CHADC1    	0x02
+#define PAUSE0	  	0x04
+#define PAUSE1	  	0x08
+
+// Function Control Register 0+2 (02h)
+#define CHEN0     	0x01
+#define CHEN1     	0x02
+#define RST_CH0	  	0x04
+#define RST_CH1	  	0x08
+
+// Function Control Register 1 (04h)
+#define JYSTK_EN	0x02
+#define UART_EN		0x04
+#define	SPDO2DAC	0x40
+#define	SPDFLOOP	0x80
+
+// Function Control Register 1+1 (05h)
+#define	SPDF_0		0x01
+#define	SPDF_1		0x02
+#define	ASFC		0x1c
+#define	DSFC		0xe0
+#define	SPDIF2DAC	(SPDF_1 << 8 | SPDO2DAC)
+
+// Channel Format Register (08h)
+#define CM_CFMT_STEREO	0x01
+#define CM_CFMT_16BIT	0x02
+#define CM_CFMT_MASK	0x03
+#define	POLVALID	0x20
+#define	INVSPDIFI	0x80
+
+// Channel Format Register+2 (0ah)
+#define SPD24SEL	0x20
+
+// Channel Format Register+3 (0bh)
+#define CHB3D		0x20
+#define CHB3D5C		0x80
+
+// Interrupt Hold/Clear Register+2 (0eh)
+#define	CH0_INT_EN	0x01
+#define	CH1_INT_EN	0x02
+
+// Interrupt Register (10h)
+#define CHINT0		0x01
+#define CHINT1		0x02
+#define	CH0BUSY		0x04
+#define	CH1BUSY		0x08
+
+// Legacy Control/Status Register+1 (15h)
+#define	EXBASEN		0x10
+#define	BASE2LIN	0x20
+#define	CENTR2LIN	0x40
+#define	CB2LIN		(BASE2LIN | CENTR2LIN)
+#define	CHB3D6C		0x80
+
+// Legacy Control/Status Register+2 (16h)
+#define	DAC2SPDO	0x20
+#define	SPDCOPYRHT	0x40
+#define	ENSPDOUT	0x80
+
+// Legacy Control/Status Register+3 (17h)
+#define	FMSEL		0x03
+#define	VSBSEL		0x0c
+#define	VMPU		0x60
+#define	NXCHG		0x80
+
+// Miscellaneous Control Register (18h)
+#define	REAR2LIN	0x20
+#define	MUTECH1		0x40
+#define	ENCENTER	0x80
+
+// Miscellaneous Control Register+1 (19h)
+#define	SELSPDIFI2	0x01
+#define	SPDF_AC97	0x80
+
+// Miscellaneous Control Register+2 (1ah)
+#define	AC3_EN		0x04
+#define	FM_EN		0x08
+#define	SPD32SEL	0x20
+#define	XCHGDAC		0x40
+#define	ENDBDAC		0x80
+
+// Miscellaneous Control Register+3 (1bh)
+#define	SPDIFI48K	0x01
+#define	SPDO5V		0x02
+#define	N4SPK3D		0x04
+#define	RESET		0x40
+#define	PWD		0x80
+#define	SPDIF48K	(SPDIFI48K << 24 | SPDF_AC97 << 8)
+
+// Mixer1 (24h)
+#define	CDPLAY		0x01
+#define	X3DEN		0x02
+#define	REAR2FRONT	0x10
+#define	SPK4		0x20
+#define	WSMUTE		0x40
+#define	FMMUTE		0x80
+
+// Miscellaneous Register (27h)
+#define	SPDVALID	0x02
+#define	CENTR2MIC	0x04
+
+// Miscellaneous Register2 (92h)
+#define	SPD32KFMT	0x10
+
+#define CM_CFMT_DACSHIFT   2
+#define CM_CFMT_ADCSHIFT   0
+#define CM_FREQ_DACSHIFT   5
+#define CM_FREQ_ADCSHIFT   2
+#define	RSTDAC	RST_CH1
+#define	RSTADC	RST_CH0
+#define	ENDAC	CHEN1
+#define	ENADC	CHEN0
+#define	PAUSEDAC	PAUSE1
+#define	PAUSEADC	PAUSE0
+#define CODEC_CMI_ADC_FRAME1	CODEC_CMI_CH0_FRAME1
+#define CODEC_CMI_ADC_FRAME2	CODEC_CMI_CH0_FRAME2
+#define CODEC_CMI_DAC_FRAME1	CODEC_CMI_CH1_FRAME1
+#define CODEC_CMI_DAC_FRAME2	CODEC_CMI_CH1_FRAME2
+#define	DACINT	CHINT1
+#define	ADCINT	CHINT0
+#define	DACBUSY	CH1BUSY
+#define	ADCBUSY	CH0BUSY
+#define	ENDACINT	CH1_INT_EN
+#define	ENADCINT	CH0_INT_EN
 
-#define CM_CH0_RESET			0x04
-#define CM_CH1_RESET			0x08
-#define CM_EXTENT_CODEC			0x100
-#define CM_EXTENT_MIDI			0x2
-#define CM_EXTENT_SYNTH			0x4
-#define CM_INT_CH0			1
-#define CM_INT_CH1			2
-
-#define CM_CFMT_STEREO			0x01
-#define CM_CFMT_16BIT			0x02
-#define CM_CFMT_MASK			0x03
-#define CM_CFMT_DACSHIFT		2
-#define CM_CFMT_ADCSHIFT		0
-
+static const unsigned sample_size[] = { 1, 2, 2, 4 };
 static const unsigned sample_shift[]	= { 0, 1, 1, 2 };
 
-#define CM_ENABLE_CH1      0x2
-#define CM_ENABLE_CH0      0x1
-
-/* MIDI buffer sizes **************************/
+#define SND_DEV_DSP16   5
 
-#define MIDIINBUF  256
-#define MIDIOUTBUF 256
+#define NR_DEVICE 3		/* maximum number of devices */
 
-#define FMODE_MIDI_SHIFT 2
-#define FMODE_MIDI_READ  (FMODE_READ << FMODE_MIDI_SHIFT)
-#define FMODE_MIDI_WRITE (FMODE_WRITE << FMODE_MIDI_SHIFT)
+#define	set_dac1_rate	set_adc_rate
+#define	set_dac1_rate_unlocked	set_adc_rate_unlocked
+#define	stop_dac1	stop_adc
+#define	stop_dac1_unlocked	stop_adc_unlocked
+#define	get_dmadac1	get_dmaadc
 
-#define FMODE_DMFM 0x10
+static unsigned int devindex = 0;
 
-#define SND_DEV_DSP16   5 
+//*********************************************/
 
-#define NR_DEVICE 3		/* maximum number of devices */
+struct cm_state {
+	/* magic */
+	unsigned int magic;
 
-/*********************************************/
+	/* list of cmedia devices */
+	struct list_head devs;
 
-struct cm_state {
-	unsigned int magic;		/* magic */
-	struct cm_state *next;		/* we keep cm cards in a linked list */
+	/* the corresponding pci_dev structure */
+	struct pci_dev *dev;
 
 	int dev_audio;			/* soundcore stuff */
 	int dev_mixer;
-	int dev_midi;
-	int dev_dmfm;
 
 	unsigned int iosb, iobase, iosynth,
 			 iomidi, iogame, irq;	/* hardware resources */
@@ -243,7 +397,7 @@
 
 	struct dmabuf {
 		void *rawbuf;
-		unsigned rawphys;
+		dma_addr_t dmaaddr;
 		unsigned buforder;
 		unsigned numfrag;
 		unsigned fragshift;
@@ -252,38 +406,36 @@
 		int count;
 		unsigned error;		/* over/underrun */
 		wait_queue_head_t wait;
-		
+
 		unsigned fragsize;	/* redundant, but makes calculations easier */
 		unsigned dmasize;
 		unsigned fragsamples;
 		unsigned dmasamples;
-		
+
 		unsigned mapped:1;	/* OSS stuff */
 		unsigned ready:1;
 		unsigned endcleared:1;
+		unsigned enabled:1;
 		unsigned ossfragshift;
 		int ossmaxfrags;
 		unsigned subdivision;
 	} dma_dac, dma_adc;
 
-	struct {			/* midi stuff */
-		unsigned ird, iwr, icnt;
-		unsigned ord, owr, ocnt;
-		wait_queue_head_t iwait;
-		wait_queue_head_t owait;
-		struct timer_list timer;
-		unsigned char ibuf[MIDIINBUF];
-		unsigned char obuf[MIDIOUTBUF];
-	} midi;
-	
-	int	chip_version;		
+#ifdef CONFIG_SOUND_CMPCI_MIDI
+	int midi_devc;
+	struct address_info mpu_data;
+#endif
+#ifdef CONFIG_SOUND_CMPCI_JOYSTICK
+	struct gameport gameport;
+#endif
+
+	int	chip_version;
 	int	max_channels;
-	int	curr_channels;		
-	int	speakers;		/* number of speakers */
+	int	curr_channels;
 	int	capability;		/* HW capability, various for chip versions */
 
 	int	status;			/* HW or SW state */
-	
+
 	int	spdif_counter;		/* spdif frame counter */
 };
 
@@ -311,9 +463,44 @@
 #define	DO_SPDIF_OUT		0x00000100
 #define	DO_SPDIF_IN		0x00000200
 #define	DO_SPDIF_LOOP		0x00000400
+#define	DO_BIGENDIAN_W		0x00001000		/* used in PowerPC */
+#define	DO_BIGENDIAN_R		0x00002000		/* used in PowerPC */
 
-static struct cm_state *devs;
-static unsigned long wavetable_mem;
+static LIST_HEAD(devs);
+
+static	int	mpuio = 0;
+static	int	fmio = 0;
+static	int	joystick = 0;
+static	int	spdif_inverse = 0;
+static	int	spdif_loop = 0;
+static	int	spdif_out = 0;
+static	int	use_line_as_rear = 0;
+static	int	use_line_as_bass = 0;
+static	int	use_mic_as_bass = 0;
+static	int	mic_boost = 0;
+static	int	hw_copy = 0;
+MODULE_PARM(mpuio, "i");
+MODULE_PARM(fmio, "i");
+MODULE_PARM(joystick, "i");
+MODULE_PARM(spdif_inverse, "i");
+MODULE_PARM(spdif_loop, "i");
+MODULE_PARM(spdif_out, "i");
+MODULE_PARM(use_line_as_rear, "i");
+MODULE_PARM(use_line_as_bass, "i");
+MODULE_PARM(use_mic_as_bass, "i");
+MODULE_PARM(mic_boost, "i");
+MODULE_PARM(hw_copy, "i");
+MODULE_PARM_DESC(mpuio, "(0x330, 0x320, 0x310, 0x300) Base of MPU-401, 0 to disable");
+MODULE_PARM_DESC(fmio, "(0x388, 0x3C8, 0x3E0) Base of OPL3, 0 to disable");
+MODULE_PARM_DESC(joystick, "(1/0) Enable joystick interface, still need joystick driver");
+MODULE_PARM_DESC(spdif_inverse, "(1/0) Invert S/PDIF-in signal");
+MODULE_PARM_DESC(spdif_loop, "(1/0) Route S/PDIF-in to S/PDIF-out directly");
+MODULE_PARM_DESC(spdif_out, "(1/0) Send PCM to S/PDIF-out (PCM volume will not function)");
+MODULE_PARM_DESC(use_line_as_rear, "(1/0) Use line-in jack as rear-out");
+MODULE_PARM_DESC(use_line_as_bass, "(1/0) Use line-in jack as bass/center");
+MODULE_PARM_DESC(use_mic_as_bass, "(1/0) Use mic-in jack as bass/center");
+MODULE_PARM_DESC(mic_boost, "(1/0) Enable microphone boost");
+MODULE_PARM_DESC(hw_copy, "Copy front channel to surround channel");
 
 /* --------------------------------------------------------------------- */
 
@@ -324,7 +511,7 @@
 
 	/* num: 2, 4, 16, 256, 65536 */
 	/* exp: 1, 2,  4,   8,    16 */
-	
+
 	while(l--) {
 		if( x >= num[l] ) {
 			if(num[l]>2) x >>= exp;
@@ -356,55 +543,55 @@
 static void set_dmadac1(struct cm_state *s, unsigned int addr, unsigned int count)
 {
 	if (addr)
-	    outl(addr, s->iobase + CODEC_CMI_CH0_FRAME1);
-	outw(count - 1, s->iobase + CODEC_CMI_CH0_FRAME2);
-	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~1, 0);
+	    outl(addr, s->iobase + CODEC_CMI_ADC_FRAME1);
+	outw(count - 1, s->iobase + CODEC_CMI_ADC_FRAME2);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~CHADC0, 0);
 }
 
 static void set_dmaadc(struct cm_state *s, unsigned int addr, unsigned int count)
 {
-	outl(addr, s->iobase + CODEC_CMI_CH0_FRAME1);
-	outw(count - 1, s->iobase + CODEC_CMI_CH0_FRAME2);
-	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~0, 1);
+	outl(addr, s->iobase + CODEC_CMI_ADC_FRAME1);
+	outw(count - 1, s->iobase + CODEC_CMI_ADC_FRAME2);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~0, CHADC0);
 }
 
 static void set_dmadac(struct cm_state *s, unsigned int addr, unsigned int count)
 {
-	outl(addr, s->iobase + CODEC_CMI_CH1_FRAME1);
-	outw(count - 1, s->iobase + CODEC_CMI_CH1_FRAME2);
-	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~2, 0);
+	outl(addr, s->iobase + CODEC_CMI_DAC_FRAME1);
+	outw(count - 1, s->iobase + CODEC_CMI_DAC_FRAME2);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~CHADC1, 0);
 	if (s->status & DO_DUAL_DAC)
 		set_dmadac1(s, 0, count);
 }
 
 static void set_countadc(struct cm_state *s, unsigned count)
 {
-	outw(count - 1, s->iobase + CODEC_CMI_CH0_FRAME2 + 2);
+	outw(count - 1, s->iobase + CODEC_CMI_ADC_FRAME2 + 2);
 }
 
 static void set_countdac(struct cm_state *s, unsigned count)
 {
-	outw(count - 1, s->iobase + CODEC_CMI_CH1_FRAME2 + 2);
+	outw(count - 1, s->iobase + CODEC_CMI_DAC_FRAME2 + 2);
 	if (s->status & DO_DUAL_DAC)
 	    set_countadc(s, count);
 }
 
-static inline unsigned get_dmadac(struct cm_state *s)
+static unsigned get_dmadac(struct cm_state *s)
 {
 	unsigned int curr_addr;
 
-	curr_addr = inw(s->iobase + CODEC_CMI_CH1_FRAME2) + 1;
+	curr_addr = inw(s->iobase + CODEC_CMI_DAC_FRAME2) + 1;
 	curr_addr <<= sample_shift[(s->fmt >> CM_CFMT_DACSHIFT) & CM_CFMT_MASK];
 	curr_addr = s->dma_dac.dmasize - curr_addr;
 
 	return curr_addr;
 }
 
-static inline unsigned get_dmaadc(struct cm_state *s)
+static unsigned get_dmaadc(struct cm_state *s)
 {
 	unsigned int curr_addr;
 
-	curr_addr = inw(s->iobase + CODEC_CMI_CH0_FRAME2) + 1;
+	curr_addr = inw(s->iobase + CODEC_CMI_ADC_FRAME2) + 1;
 	curr_addr <<= sample_shift[(s->fmt >> CM_CFMT_ADCSHIFT) & CM_CFMT_MASK];
 	curr_addr = s->dma_adc.dmasize - curr_addr;
 
@@ -413,30 +600,85 @@
 
 static void wrmixer(struct cm_state *s, unsigned char idx, unsigned char data)
 {
+	unsigned char regval, pseudo;
+
+	// pseudo register
+	if (idx == DSP_MIX_AUXVOL_L) {
+		data >>= 4;
+		data &= 0x0f;
+		regval = inb(s->iobase + CODEC_CMI_AUX_VOL) & ~0x0f;
+		outb(regval | data, s->iobase + CODEC_CMI_AUX_VOL);
+		return;
+	}
+	if (idx == DSP_MIX_AUXVOL_R) {
+		data &= 0xf0;
+		regval = inb(s->iobase + CODEC_CMI_AUX_VOL) & ~0xf0;
+		outb(regval | data, s->iobase + CODEC_CMI_AUX_VOL);
+		return;
+	}
 	outb(idx, s->iobase + CODEC_SB16_ADDR);
 	udelay(10);
+	// pseudo bits
+	if (idx == DSP_MIX_OUTMIXIDX) {
+		pseudo = data & ~0x1f;
+		pseudo >>= 1;
+		regval = inb(s->iobase + CODEC_CMI_MIXER2) & ~0x30;
+		outb(regval | pseudo, s->iobase + CODEC_CMI_MIXER2);
+	}
+	if (idx == DSP_MIX_ADCMIXIDX_L) {
+		pseudo = data & 0x80;
+		pseudo >>= 1;
+		regval = inb(s->iobase + CODEC_CMI_MIXER2) & ~0x40;
+		outb(regval | pseudo, s->iobase + CODEC_CMI_MIXER2);
+	}
+	if (idx == DSP_MIX_ADCMIXIDX_R) {
+		pseudo = data & 0x80;
+		regval = inb(s->iobase + CODEC_CMI_MIXER2) & ~0x80;
+		outb(regval | pseudo, s->iobase + CODEC_CMI_MIXER2);
+	}
 	outb(data, s->iobase + CODEC_SB16_DATA);
 	udelay(10);
 }
 
 static unsigned char rdmixer(struct cm_state *s, unsigned char idx)
 {
-	unsigned char v;
-	unsigned long flags;
-	
-	spin_lock_irqsave(&s->lock, flags);
+	unsigned char v, pseudo;
+
+	// pseudo register
+	if (idx == DSP_MIX_AUXVOL_L) {
+		v = inb(s->iobase + CODEC_CMI_AUX_VOL) & 0x0f;
+		v <<= 4;
+		return v;
+	}
+	if (idx == DSP_MIX_AUXVOL_L) {
+		v = inb(s->iobase + CODEC_CMI_AUX_VOL) & 0xf0;
+		return v;
+	}
 	outb(idx, s->iobase + CODEC_SB16_ADDR);
 	udelay(10);
 	v = inb(s->iobase + CODEC_SB16_DATA);
 	udelay(10);
-	spin_unlock_irqrestore(&s->lock, flags);
+	// pseudo bits
+	if (idx == DSP_MIX_OUTMIXIDX) {
+		pseudo = inb(s->iobase + CODEC_CMI_MIXER2) & 0x30;
+		pseudo <<= 1;
+		v |= pseudo;
+	}
+	if (idx == DSP_MIX_ADCMIXIDX_L) {
+		pseudo = inb(s->iobase + CODEC_CMI_MIXER2) & 0x40;
+		pseudo <<= 1;
+		v |= pseudo;
+	}
+	if (idx == DSP_MIX_ADCMIXIDX_R) {
+		pseudo = inb(s->iobase + CODEC_CMI_MIXER2) & 0x80;
+		v |= pseudo;
+	}
 	return v;
 }
 
 static void set_fmt_unlocked(struct cm_state *s, unsigned char mask, unsigned char data)
 {
-	if (mask)
-	{
+	if (mask && s->chip_version > 0) {	/* 8338 cannot keep this */
 		s->fmt = inb(s->iobase + CODEC_CMI_CHFORMAT);
 		udelay(10);
 	}
@@ -479,24 +721,98 @@
 	{ 48000,	(44100 + 48000) / 2,	48000,			7 }
 };
 
+static void set_spdif_copyright(struct cm_state *s, int spdif_copyright)
+{
+	/* enable SPDIF-in Copyright */
+	maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 2, ~SPDCOPYRHT, spdif_copyright ? SPDCOPYRHT : 0);
+}
+
+static void set_spdif_loop(struct cm_state *s, int spdif_loop)
+{
+	/* enable SPDIF loop */
+	if (spdif_loop) {
+		s->status |= DO_SPDIF_LOOP;
+		/* turn on spdif-in to spdif-out */
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, SPDFLOOP);
+	} else {
+		s->status &= ~DO_SPDIF_LOOP;
+		/* turn off spdif-in to spdif-out */
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~SPDFLOOP, 0);
+	}
+}
+
+static void set_spdif_monitor(struct cm_state *s, int channel)
+{
+	// SPDO2DAC
+	maskw(s->iobase + CODEC_CMI_FUNCTRL1, ~SPDO2DAC, channel == 2 ? SPDO2DAC : 0);
+	// CDPLAY
+	if (s->chip_version >= 39)
+		maskb(s->iobase + CODEC_CMI_MIXER1, ~CDPLAY, channel ? CDPLAY : 0);
+}
+
+static void set_spdifout_level(struct cm_state *s, int level5v)
+{
+	/* SPDO5V */
+	if (s->chip_version > 0)
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 3, ~SPDO5V, level5v ? SPDO5V : 0);
+}
+
+static void set_spdifin_inverse(struct cm_state *s, int spdif_inverse)
+{
+	if (s->chip_version == 0)	/* 8338 has not this feature */
+		return;
+	if (spdif_inverse) {
+		/* turn on spdif-in inverse */
+		if (s->chip_version >= 39)
+			maskb(s->iobase + CODEC_CMI_CHFORMAT, ~0, INVSPDIFI);
+		else
+			maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~0, 1);
+	} else {
+		/* turn off spdif-ininverse */
+		if (s->chip_version >= 39)
+			maskb(s->iobase + CODEC_CMI_CHFORMAT, ~INVSPDIFI, 0);
+		else
+			maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~1, 0);
+	}
+}
+
+static void set_spdifin_channel2(struct cm_state *s, int channel2)
+{
+	/* SELSPDIFI2 */
+	if (s->chip_version >= 39)
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 1, ~SELSPDIFI2, channel2 ? SELSPDIFI2 : 0);
+}
+
+static void set_spdifin_valid(struct cm_state *s, int valid)
+{
+	/* SPDVALID */
+	maskb(s->iobase + CODEC_CMI_MISC, ~SPDVALID, valid ? SPDVALID : 0);
+}
+
 static void set_spdifout_unlocked(struct cm_state *s, unsigned rate)
 {
+	if (rate != 48000 && rate != 44100)
+		rate = 0;
 	if (rate == 48000 || rate == 44100) {
-		// SPDIFI48K SPDF_ACc97
-		maskl(s->iobase + CODEC_CMI_MISC_CTRL, ~0x01008000, rate == 48000 ? 0x01008000 : 0);
+		set_spdif_loop(s, 0);
+		// SPDF_1
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~0, SPDF_1);
+		// SPDIFI48K SPDF_AC97
+		maskl(s->iobase + CODEC_CMI_MISC_CTRL, ~SPDIF48K, rate == 48000 ? SPDIF48K : 0);
+		if (s->chip_version >= 55)
+		// SPD32KFMT
+			maskb(s->iobase + CODEC_CMI_MISC_CTRL2, ~SPD32KFMT, rate == 48000 ? SPD32KFMT : 0);
+		if (s->chip_version > 0)
 		// ENSPDOUT
-		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 2, ~0, 0x80);
-		// SPDF_1 SPD2DAC
-		maskw(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x240);
-		// CDPLAY
-		if (s->chip_version >= 39)
-			maskb(s->iobase + CODEC_CMI_MIXER1, ~0, 1);
+			maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 2, ~0, ENSPDOUT);
+		// monitor SPDIF out
+		set_spdif_monitor(s, 2);
 		s->status |= DO_SPDIF_OUT;
 	} else {
-		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 2, ~0x80, 0);
-		maskw(s->iobase + CODEC_CMI_FUNCTRL1, ~0x240, 0);
-		if (s->chip_version >= 39)
-			maskb(s->iobase + CODEC_CMI_MIXER1, ~1, 0);
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~SPDF_1, 0);
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 2, ~ENSPDOUT, 0);
+		// monitor none
+		set_spdif_monitor(s, 0);
 		s->status &= ~DO_SPDIF_OUT;
 	}
 }
@@ -510,6 +826,29 @@
 	spin_unlock_irqrestore(&s->lock, flags);
 }
 
+static void set_spdifin_unlocked(struct cm_state *s, unsigned rate)
+{
+	if (rate == 48000 || rate == 44100) {
+		// SPDF_1
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~0, SPDF_1);
+		// SPDIFI48K SPDF_AC97
+		maskl(s->iobase + CODEC_CMI_MISC_CTRL, ~SPDIF48K, rate == 48000 ? SPDIF48K : 0);
+		s->status |= DO_SPDIF_IN;
+	} else {
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~SPDF_1, 0);
+		s->status &= ~DO_SPDIF_IN;
+	}
+}
+
+static void set_spdifin(struct cm_state *s, unsigned rate)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&s->lock, flags);
+	set_spdifin_unlocked(s,rate);
+	spin_unlock_irqrestore(&s->lock, flags);
+}
+
 /* find parity for bit 4~30 */
 static unsigned parity(unsigned data)
 {
@@ -528,24 +867,38 @@
 
 static void set_ac3_unlocked(struct cm_state *s, unsigned rate)
 {
+	if (!(s->capability & CAN_AC3))
+		return;
 	/* enable AC3 */
+	if (rate && rate != 44100)
+		rate = 48000;
 	if (rate == 48000 || rate == 44100) {
 		// mute DAC
-		maskb(s->iobase + CODEC_CMI_MIXER1, ~0, 0x40);
-		// AC3EN for 037, 0x10
-		maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~0, 0x10);
+		maskb(s->iobase + CODEC_CMI_MIXER1, ~0, WSMUTE);
+		if (s->chip_version >= 39)
+			maskb(s->iobase + CODEC_CMI_MISC_CTRL, ~0, MUTECH1);
 		// AC3EN for 039, 0x04
-		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0, 0x04);
+		if (s->chip_version >= 39) {
+			maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0, AC3_EN);
+			if (s->chip_version == 55)
+				maskb(s->iobase + CODEC_CMI_SPDIF_CTRL, ~2, 0);
+		// AC3EN for 037, 0x10
+		} else if (s->chip_version == 37)
+			maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~0, 0x10);
 		if (s->capability & CAN_AC3_HW) {
-			// SPD24SEL for 037, 0x02
 			// SPD24SEL for 039, 0x20, but cannot be set
-			maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~0, 0x02);
-			s->status |= DO_AC3_HW;
+			if (s->chip_version == 39)
+				maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~0, SPD24SEL);
+			// SPD24SEL for 037, 0x02
+			else if (s->chip_version == 37)
+				maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~0, 0x02);
 			if (s->chip_version >= 39)
-				maskb(s->iobase + CODEC_CMI_MIXER1, ~1, 0);
+				maskb(s->iobase + CODEC_CMI_MIXER1, ~CDPLAY, 0);
+
+			s->status |= DO_AC3_HW;
 		 } else {
-			// SPD32SEL for 037 & 039, 0x20
-			maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0, 0x20);
+			// SPD32SEL for 037 & 039
+			maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0, SPD32SEL);
 			// set 176K sample rate to fix 033 HW bug
 			if (s->chip_version == 33) {
 				if (rate == 48000)
@@ -556,18 +909,65 @@
 			s->status |= DO_AC3_SW;
 		}
 	} else {
-		maskb(s->iobase + CODEC_CMI_MIXER1, ~0x40, 0);
-		maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~0x32, 0);
-		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0x24, 0);
-		maskb(s->iobase + CODEC_CMI_CHFORMAT + 1, ~0x08, 0);
+		maskb(s->iobase + CODEC_CMI_MIXER1, ~WSMUTE, 0);
+		if (s->chip_version >= 39)
+			maskb(s->iobase + CODEC_CMI_MISC_CTRL, ~MUTECH1, 0);
+		maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~(SPD24SEL|0x12), 0);
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~(SPD32SEL|AC3_EN), 0);
 		if (s->chip_version == 33)
 			maskb(s->iobase + CODEC_CMI_CHFORMAT + 1, ~0x08, 0);
 		if (s->chip_version >= 39)
-			maskb(s->iobase + CODEC_CMI_MIXER1, ~0, 1);
+			maskb(s->iobase + CODEC_CMI_MIXER1, ~0, CDPLAY);
 		s->status &= ~DO_AC3;
 	}
 	s->spdif_counter = 0;
+}
+
+static void set_line_as_rear(struct cm_state *s, int use_line_as_rear)
+{
+	if (!(s->capability & CAN_LINE_AS_REAR))
+		return;
+	if (use_line_as_rear) {
+		maskb(s->iobase + CODEC_CMI_MIXER1, ~0, SPK4);
+		s->status |= DO_LINE_AS_REAR;
+	} else {
+		maskb(s->iobase + CODEC_CMI_MIXER1, ~SPK4, 0);
+		s->status &= ~DO_LINE_AS_REAR;
+	}
+}
+
+static void set_line_as_bass(struct cm_state *s, int use_line_as_bass)
+{
+	if (!(s->capability & CAN_LINE_AS_BASS))
+		return;
+	if (use_line_as_bass) {
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 1, ~0, CB2LIN);
+		s->status |= DO_LINE_AS_BASS;
+	} else {
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 1, ~CB2LIN, 0);
+		s->status &= ~DO_LINE_AS_BASS;
+	}
+}
 
+static void set_mic_as_bass(struct cm_state *s, int use_mic_as_bass)
+{
+	if (!(s->capability & CAN_MIC_AS_BASS))
+		return;
+	if (use_mic_as_bass) {
+		maskb(s->iobase + CODEC_CMI_MISC, ~0, 0x04);
+		s->status |= DO_MIC_AS_BASS;
+	} else {
+		maskb(s->iobase + CODEC_CMI_MISC, ~0x04, 0);
+		s->status &= ~DO_MIC_AS_BASS;
+	}
+}
+
+static void set_hw_copy(struct cm_state *s, int hw_copy)
+{
+    	if (s->max_channels > 2 && hw_copy)
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 3, ~0, N4SPK3D);
+    	else
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 3, ~N4SPK3D, 0);
 }
 
 static void set_ac3(struct cm_state *s, unsigned rate)
@@ -576,21 +976,23 @@
 
 	spin_lock_irqsave(&s->lock, flags);
 	set_spdifout_unlocked(s, rate);
-	set_ac3_unlocked(s,rate);
+	set_ac3_unlocked(s, rate);
 	spin_unlock_irqrestore(&s->lock, flags);
 }
 
-static int trans_ac3(struct cm_state *s, void *dest, const char *source, int size)
+static int trans_ac3(struct cm_state *s, void *dest, const char __user *source, int size)
 {
 	int   i = size / 2;
-	int err;
 	unsigned long data;
+	unsigned short data16;
 	unsigned long *dst = (unsigned long *) dest;
-	unsigned short *src = (unsigned short *)source;
+	unsigned short __user *src = (unsigned short __user *)source;
+	int err;
 
 	do {
-		if ((err = __get_user(data, src++)))
+		if ((err = __get_user(data16, src++)))
 			return err;
+		data = (unsigned long)le16_to_cpu(data16);
 		data <<= 12;			// ok for 16-bit data
 		if (s->spdif_counter == 2 || s->spdif_counter == 3)
 			data |= 0x40000000;	// indicate AC-3 raw data
@@ -602,7 +1004,7 @@
 			data |= 5;		// odd, 'W'
 		else
 			data |= 9;		// even, 'M'
-		*dst++ = data;
+		*dst++ = cpu_to_le32(data);
 		s->spdif_counter++;
 		if (s->spdif_counter == 384)
 			s->spdif_counter = 0;
@@ -628,9 +1030,9 @@
 	    	}
 	}
 	s->rateadc = rate;
-	freq <<= 2;
+	freq <<= CM_FREQ_ADCSHIFT;
 
-	maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~0x1c, freq);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~ASFC, freq);
 }
 
 static void set_adc_rate(struct cm_state *s, unsigned rate)
@@ -651,10 +1053,10 @@
 	    	}
 	}
 	s->rateadc = rate;
-	freq <<= 2;
+	freq <<= CM_FREQ_ADCSHIFT;
 
 	spin_lock_irqsave(&s->lock, flags);
-	maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~0x1c, freq);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~ASFC, freq);
 	spin_unlock_irqrestore(&s->lock, flags);
 }
 
@@ -676,46 +1078,45 @@
 	    	}
 	}
 	s->ratedac = rate;
-	freq <<= 5;
+	freq <<= CM_FREQ_DACSHIFT;
 
 	spin_lock_irqsave(&s->lock, flags);
-	maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~0xe0, freq);
-
+	maskb(s->iobase + CODEC_CMI_FUNCTRL1 + 1, ~DSFC, freq);
+	spin_unlock_irqrestore(&s->lock, flags);
 
-	if (s->curr_channels <=  2)
-		set_spdifout_unlocked(s, rate);
+	if (s->curr_channels <= 2 && spdif_out)
+		set_spdifout(s, rate);
 	if (s->status & DO_DUAL_DAC)
-		set_adc_rate_unlocked(s, rate);
-
-	spin_unlock_irqrestore(&s->lock, flags);
+		set_dac1_rate(s, rate);
 }
 
 /* --------------------------------------------------------------------- */
 static inline void reset_adc(struct cm_state *s)
 {
 	/* reset bus master */
-	outb(s->enable | CM_CH0_RESET, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
+	outb(s->enable | RSTADC, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
 	udelay(10);
-	outb(s->enable & ~CM_CH0_RESET, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
+	outb(s->enable & ~RSTADC, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
 }
 
 static inline void reset_dac(struct cm_state *s)
 {
 	/* reset bus master */
-	outb(s->enable | CM_CH1_RESET, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
-	outb(s->enable & ~CM_CH1_RESET, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
+	outb(s->enable | RSTDAC, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
+	udelay(10);
+	outb(s->enable & ~RSTDAC, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
 	if (s->status & DO_DUAL_DAC)
 		reset_adc(s);
 }
 
 static inline void pause_adc(struct cm_state *s)
 {
-	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~0, 4);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~0, PAUSEADC);
 }
 
 static inline void pause_dac(struct cm_state *s)
 {
-	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~0, 8);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~0, PAUSEDAC);
 	if (s->status & DO_DUAL_DAC)
 		pause_adc(s);
 }
@@ -723,7 +1124,7 @@
 static inline void disable_adc(struct cm_state *s)
 {
 	/* disable channel */
-	s->enable &= ~CM_ENABLE_CH0;
+	s->enable &= ~ENADC;
 	outb(s->enable, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
 	reset_adc(s);
 }
@@ -731,7 +1132,7 @@
 static inline void disable_dac(struct cm_state *s)
 {
 	/* disable channel */
-	s->enable &= ~CM_ENABLE_CH1;
+	s->enable &= ~ENDAC;
 	outb(s->enable, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
 	reset_dac(s);
 	if (s->status & DO_DUAL_DAC)
@@ -740,22 +1141,22 @@
 
 static inline void enable_adc(struct cm_state *s)
 {
-	if (!(s->enable & CM_ENABLE_CH0)) {
+	if (!(s->enable & ENADC)) {
 		/* enable channel */
-		s->enable |= CM_ENABLE_CH0;
+		s->enable |= ENADC;
 		outb(s->enable, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
 	}
-	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~4, 0);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~PAUSEADC, 0);
 }
 
 static inline void enable_dac_unlocked(struct cm_state *s)
 {
-	if (!(s->enable & CM_ENABLE_CH1)) {
+	if (!(s->enable & ENDAC)) {
 		/* enable channel */
-		s->enable |= CM_ENABLE_CH1;
+		s->enable |= ENDAC;
 		outb(s->enable, s->iobase + CODEC_CMI_FUNCTRL0 + 2);
 	}
-	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~8, 0);
+	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~PAUSEDAC, 0);
 
 	if (s->status & DO_DUAL_DAC)
 		enable_adc(s);
@@ -772,9 +1173,9 @@
 
 static inline void stop_adc_unlocked(struct cm_state *s)
 {
-	if (s->enable & CM_ENABLE_CH0) {
+	if (s->enable & ENADC) {
 		/* disable interrupt */
-		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~1, 0);
+		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~ENADCINT, 0);
 		disable_adc(s);
 	}
 }
@@ -791,13 +1192,13 @@
 
 static inline void stop_dac_unlocked(struct cm_state *s)
 {
-	if (s->enable & CM_ENABLE_CH1) {
+	if (s->enable & ENDAC) {
 		/* disable interrupt */
-		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~2, 0);
+		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~ENDACINT, 0);
 		disable_dac(s);
 	}
 	if (s->status & DO_DUAL_DAC)
-		stop_adc_unlocked(s);
+		stop_dac1_unlocked(s);
 }
 
 static inline void stop_dac(struct cm_state *s)
@@ -809,12 +1210,12 @@
 	spin_unlock_irqrestore(&s->lock, flags);
 }
 
-static void start_adc_unlocked(struct cm_state *s)
+static inline void start_adc_unlocked(struct cm_state *s)
 {
 	if ((s->dma_adc.mapped || s->dma_adc.count < (signed)(s->dma_adc.dmasize - 2*s->dma_adc.fragsize))
 	    && s->dma_adc.ready) {
 		/* enable interrupt */
-		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~0, 1);
+		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~0, ENADCINT);
 		enable_adc(s);
 	}
 }
@@ -826,13 +1227,13 @@
 	spin_lock_irqsave(&s->lock, flags);
 	start_adc_unlocked(s);
 	spin_unlock_irqrestore(&s->lock, flags);
-}	
+}
 
 static void start_dac1_unlocked(struct cm_state *s)
 {
 	if ((s->dma_adc.mapped || s->dma_adc.count > 0) && s->dma_adc.ready) {
 		/* enable interrupt */
-//		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~0, 1);
+		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~0, ENADCINT);
  		enable_dac_unlocked(s);
 	}
 }
@@ -841,11 +1242,11 @@
 {
 	if ((s->dma_dac.mapped || s->dma_dac.count > 0) && s->dma_dac.ready) {
 		/* enable interrupt */
-		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~0, 2);
+		maskb(s->iobase + CODEC_CMI_INT_HLDCLR + 2, ~0, ENDACINT);
 		enable_dac_unlocked(s);
 	}
-		if (s->status & DO_DUAL_DAC)
-			start_dac1_unlocked(s);
+	if (s->status & DO_DUAL_DAC)
+		start_dac1_unlocked(s);
 }
 
 static void start_dac(struct cm_state *s)
@@ -855,13 +1256,15 @@
 	spin_lock_irqsave(&s->lock, flags);
 	start_dac_unlocked(s);
 	spin_unlock_irqrestore(&s->lock, flags);
-}	
+}
 
 static int prog_dmabuf(struct cm_state *s, unsigned rec);
 
 static int set_dac_channels(struct cm_state *s, int channels)
 {
 	unsigned long flags;
+	static unsigned int fmmute = 0;
+
 	spin_lock_irqsave(&s->lock, flags);
 
 	if ((channels > 2) && (channels <= s->max_channels)
@@ -869,13 +1272,13 @@
 	    set_spdifout_unlocked(s, 0);
 	    if (s->capability & CAN_MULTI_CH_HW) {
 		// NXCHG
-		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~0, 0x80);
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~0, NXCHG);
 		// CHB3D or CHB3D5C
-	       	maskb(s->iobase + CODEC_CMI_CHFORMAT + 3, ~0xa0, channels > 4 ? 0x80 : 0x20);
+	       	maskb(s->iobase + CODEC_CMI_CHFORMAT + 3, ~(CHB3D5C|CHB3D), channels > 4 ? CHB3D5C : CHB3D);
 		// CHB3D6C
-		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 1, ~0x80, channels == 6 ? 0x80 : 0);
-		// ENCENTER 
-		maskb(s->iobase + CODEC_CMI_MISC_CTRL, ~0x80, channels == 6 ? 0x80 : 0);
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 1, ~CHB3D6C, channels == 6 ? CHB3D6C : 0);
+		// ENCENTER
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL, ~ENCENTER, channels == 6 ? ENCENTER : 0);
 		s->status |= DO_MULTI_CH_HW;
 	    } else if (s->capability & CAN_DUAL_DAC) {
 		unsigned char fmtm = ~0, fmts = 0;
@@ -883,10 +1286,12 @@
 
 		// ENDBDAC, turn on double DAC mode
 		// XCHGDAC, CH0 -> back, CH1->front
-		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0, 0xC0);
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0, ENDBDAC|XCHGDAC);
+		// mute FM
+		fmmute = inb(s->iobase + CODEC_CMI_MIXER1) & FMMUTE;
+		maskb(s->iobase + CODEC_CMI_MIXER1, ~0, FMMUTE);
 		s->status |= DO_DUAL_DAC;
 		// prepare secondary buffer
-
 		spin_unlock_irqrestore(&s->lock, flags);
 		ret = prog_dmabuf(s, 1);
 		if (ret) return ret;
@@ -900,30 +1305,38 @@
 		fmts |= CM_CFMT_16BIT << CM_CFMT_ADCSHIFT;
 		fmts |= CM_CFMT_STEREO << CM_CFMT_DACSHIFT;
 		fmts |= CM_CFMT_STEREO << CM_CFMT_ADCSHIFT;
-		
+
 		set_fmt_unlocked(s, fmtm, fmts);
 		set_adc_rate_unlocked(s, s->ratedac);
-
 	    }
-
-	    if (s->speakers > 2)
-		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 3, ~0x04, 0);
+	    // disable 4 speaker mode (analog duplicate)
+	    set_hw_copy(s, 0);
 	    s->curr_channels = channels;
+
+	    // enable jack redirect
+	    set_line_as_rear(s, use_line_as_rear);
+	    if (channels > 4) {
+		    set_line_as_bass(s, use_line_as_bass);
+		    set_mic_as_bass(s, use_mic_as_bass);
+	    }
 	} else {
 	    if (s->status & DO_MULTI_CH_HW) {
-		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~0x80, 0);
-		maskb(s->iobase + CODEC_CMI_CHFORMAT + 3, ~0xa0, 0);
-		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 1, ~0x80, 0);
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~NXCHG, 0);
+		maskb(s->iobase + CODEC_CMI_CHFORMAT + 3, ~(CHB3D5C|CHB3D), 0);
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 1, ~CHB3D6C, 0);
 	    } else if (s->status & DO_DUAL_DAC) {
-		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0x80, 0);
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~ENDBDAC, 0);
+		maskb(s->iobase + CODEC_CMI_MIXER1, ~FMMUTE, fmmute);
 	    }
-	    // N4SPK3D, enable 4 speaker mode (analog duplicate)
-	    if (s->speakers > 2)
-		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 3, ~0, 0x04);
+	    // enable 4 speaker mode (analog duplicate)
+	    set_hw_copy(s, hw_copy);
 	    s->status &= ~DO_MULTI_CH;
 	    s->curr_channels = s->fmt & (CM_CFMT_STEREO << CM_CFMT_DACSHIFT) ? 2 : 1;
+	    // disable jack redirect
+	    set_line_as_rear(s, hw_copy ? use_line_as_rear : 0);
+	    set_line_as_bass(s, 0);
+	    set_mic_as_bass(s, 0);
 	}
-
 	spin_unlock_irqrestore(&s->lock, flags);
 	return s->curr_channels;
 }
@@ -933,16 +1346,16 @@
 #define DMABUF_DEFAULTORDER (16-PAGE_SHIFT)
 #define DMABUF_MINORDER 1
 
-static void dealloc_dmabuf(struct dmabuf *db)
+static void dealloc_dmabuf(struct cm_state *s, struct dmabuf *db)
 {
 	struct page *pstart, *pend;
-	
+
 	if (db->rawbuf) {
 		/* undo marking the pages as reserved */
 		pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
 		for (pstart = virt_to_page(db->rawbuf); pstart <= pend; pstart++)
 			ClearPageReserved(pstart);
-		free_pages((unsigned long)db->rawbuf, db->buforder);
+		pci_free_consistent(s->dev, PAGE_SIZE << db->buforder, db->rawbuf, db->dmaaddr);
 	}
 	db->rawbuf = NULL;
 	db->mapped = db->ready = 0;
@@ -975,18 +1388,11 @@
 	if (!db->rawbuf) {
 		db->ready = db->mapped = 0;
 		for (order = DMABUF_DEFAULTORDER; order >= DMABUF_MINORDER; order--)
-			if ((db->rawbuf = (void *)__get_free_pages(GFP_KERNEL | GFP_DMA, order)))
+			if ((db->rawbuf = pci_alloc_consistent(s->dev, PAGE_SIZE << order, &db->dmaaddr)))
 				break;
-		if (!db->rawbuf)
+		if (!db->rawbuf || !db->dmaaddr)
 			return -ENOMEM;
 		db->buforder = order;
-		db->rawphys = virt_to_bus(db->rawbuf);
-		if ((db->rawphys ^ (db->rawphys + (PAGE_SIZE << db->buforder) - 1)) & ~0xffff)
-			printk(KERN_DEBUG "cmpci: DMA buffer crosses 64k boundary: busaddr 0x%lx  size %ld\n", 
-			       (long) db->rawphys, PAGE_SIZE << db->buforder);
-		if ((db->rawphys + (PAGE_SIZE << db->buforder) - 1) & ~0xffffff)
-			printk(KERN_DEBUG "cmpci: DMA buffer beyond 16MB: busaddr 0x%lx  size %ld\n", 
-			       (long) db->rawphys, PAGE_SIZE << db->buforder);
 		/* now mark the pages as reserved; otherwise remap_page_range doesn't do what we want */
 		pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
 		for (pstart = virt_to_page(db->rawbuf); pstart <= pend; pstart++)
@@ -1020,17 +1426,18 @@
 	spin_lock_irqsave(&s->lock, flags);
 	if (rec) {
 		if (s->status & DO_DUAL_DAC)
-		    set_dmadac1(s, db->rawphys, db->dmasize >> sample_shift[fmt]);
+		    set_dmadac1(s, db->dmaaddr, db->dmasize >> sample_shift[fmt]);
 		else
-		    set_dmaadc(s, db->rawphys, db->dmasize >> sample_shift[fmt]);
+		    set_dmaadc(s, db->dmaaddr, db->dmasize >> sample_shift[fmt]);
 		/* program sample counts */
 		set_countdac(s, db->fragsamples);
 	} else {
-		set_dmadac(s, db->rawphys, db->dmasize >> sample_shift[fmt]);
+		set_dmadac(s, db->dmaaddr, db->dmasize >> sample_shift[fmt]);
 		/* program sample counts */
 		set_countdac(s, db->fragsamples);
 	}
 	spin_unlock_irqrestore(&s->lock, flags);
+	db->enabled = 1;
 	db->ready = 1;
 	return 0;
 }
@@ -1066,33 +1473,14 @@
 	/* update ADC pointer */
 	if (s->dma_adc.ready) {
 	    if (s->status & DO_DUAL_DAC) {
-		hwptr = get_dmaadc(s) % s->dma_adc.dmasize;
-		diff = (s->dma_adc.dmasize + hwptr - s->dma_adc.hwptr) % s->dma_adc.dmasize;
-		s->dma_adc.hwptr = hwptr;
-		s->dma_adc.total_bytes += diff;
-		if (s->dma_adc.mapped) {
-			s->dma_adc.count += diff;
-			if (s->dma_adc.count >= (signed)s->dma_adc.fragsize)
-				wake_up(&s->dma_adc.wait);
-		} else {
-			s->dma_adc.count -= diff;
-			if (s->dma_adc.count <= 0) {
-				pause_adc(s);
-				s->dma_adc.error++;
-			} else if (s->dma_adc.count <= (signed)s->dma_adc.fragsize && !s->dma_adc.endcleared) {
-				clear_advance(s);
-				s->dma_adc.endcleared = 1;
-			}
-			if (s->dma_dac.count + (signed)s->dma_dac.fragsize <= (signed)s->dma_dac.dmasize)
-				wake_up(&s->dma_adc.wait);
-		}
+		    /* the dac part will finish for this */
 	    } else {
 		hwptr = get_dmaadc(s) % s->dma_adc.dmasize;
 		diff = (s->dma_adc.dmasize + hwptr - s->dma_adc.hwptr) % s->dma_adc.dmasize;
 		s->dma_adc.hwptr = hwptr;
 		s->dma_adc.total_bytes += diff;
 		s->dma_adc.count += diff;
-		if (s->dma_adc.count >= (signed)s->dma_adc.fragsize) 
+		if (s->dma_adc.count >= (signed)s->dma_adc.fragsize)
 			wake_up(&s->dma_adc.wait);
 		if (!s->dma_adc.mapped) {
 			if (s->dma_adc.count > (signed)(s->dma_adc.dmasize - ((3 * s->dma_adc.fragsize) >> 1))) {
@@ -1108,18 +1496,28 @@
 		diff = (s->dma_dac.dmasize + hwptr - s->dma_dac.hwptr) % s->dma_dac.dmasize;
 		s->dma_dac.hwptr = hwptr;
 		s->dma_dac.total_bytes += diff;
+		if (s->status & DO_DUAL_DAC) {
+			s->dma_adc.hwptr = hwptr;
+			s->dma_adc.total_bytes += diff;
+		}
 		if (s->dma_dac.mapped) {
 			s->dma_dac.count += diff;
+			if (s->status & DO_DUAL_DAC)
+				s->dma_adc.count += diff;
 			if (s->dma_dac.count >= (signed)s->dma_dac.fragsize)
 				wake_up(&s->dma_dac.wait);
 		} else {
 			s->dma_dac.count -= diff;
+			if (s->status & DO_DUAL_DAC)
+				s->dma_adc.count -= diff;
 			if (s->dma_dac.count <= 0) {
 				pause_dac(s);
 				s->dma_dac.error++;
 			} else if (s->dma_dac.count <= (signed)s->dma_dac.fragsize && !s->dma_dac.endcleared) {
 				clear_advance(s);
 				s->dma_dac.endcleared = 1;
+				if (s->status & DO_DUAL_DAC)
+					s->dma_adc.endcleared = 1;
 			}
 			if (s->dma_dac.count + (signed)s->dma_dac.fragsize <= (signed)s->dma_dac.dmasize)
 				wake_up(&s->dma_dac.wait);
@@ -1127,44 +1525,12 @@
 	}
 }
 
-#ifdef CONFIG_SOUND_CMPCI_MIDI
-/* hold spinlock for the following! */
-static void cm_handle_midi(struct cm_state *s)
-{
-	unsigned char ch;
-	int wake;
-
-	wake = 0;
-	while (!(inb(s->iomidi+1) & 0x80)) {
-		ch = inb(s->iomidi);
-		if (s->midi.icnt < MIDIINBUF) {
-			s->midi.ibuf[s->midi.iwr] = ch;
-			s->midi.iwr = (s->midi.iwr + 1) % MIDIINBUF;
-			s->midi.icnt++;
-		}
-		wake = 1;
-	}
-	if (wake)
-		wake_up(&s->midi.iwait);
-	wake = 0;
-	while (!(inb(s->iomidi+1) & 0x40) && s->midi.ocnt > 0) {
-		outb(s->midi.obuf[s->midi.ord], s->iomidi);
-		s->midi.ord = (s->midi.ord + 1) % MIDIOUTBUF;
-		s->midi.ocnt--;
-		if (s->midi.ocnt < MIDIOUTBUF-16)
-			wake = 1;
-	}
-	if (wake)
-		wake_up(&s->midi.owait);
-}
-#endif
-
 static irqreturn_t cm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
         struct cm_state *s = (struct cm_state *)dev_id;
 	unsigned int intsrc, intstat;
 	unsigned char mask = 0;
-	
+
 	/* fastpath out, to ease interrupt sharing */
 	intsrc = inl(s->iobase + CODEC_CMI_INT_STATUS);
 	if (!(intsrc & 0x80000000))
@@ -1172,41 +1538,29 @@
 	spin_lock(&s->lock);
 	intstat = inb(s->iobase + CODEC_CMI_INT_HLDCLR + 2);
 	/* acknowledge interrupt */
-	if (intsrc & CM_INT_CH0)
-		mask |= 1;
-	if (intsrc & CM_INT_CH1)
-		mask |= 2;
+	if (intsrc & ADCINT)
+		mask |= ENADCINT;
+	if (intsrc & DACINT)
+		mask |= ENDACINT;
 	outb(intstat & ~mask, s->iobase + CODEC_CMI_INT_HLDCLR + 2);
 	outb(intstat | mask, s->iobase + CODEC_CMI_INT_HLDCLR + 2);
 	cm_update_ptr(s);
+	spin_unlock(&s->lock);
 #ifdef CONFIG_SOUND_CMPCI_MIDI
-	cm_handle_midi(s);
+	if (intsrc & 0x00010000) {	// UART interrupt
+		if (s->midi_devc && intchk_mpu401((void *)s->midi_devc))
+			mpuintr(irq, (void *)s->midi_devc, regs);
+		else
+			inb(s->iomidi);// dummy read
+	}
 #endif
-	spin_unlock(&s->lock);
 	return IRQ_HANDLED;
 }
 
-#ifdef CONFIG_SOUND_CMPCI_MIDI
-static void cm_midi_timer(unsigned long data)
-{
-	struct cm_state *s = (struct cm_state *)data;
-	unsigned long flags;
-	
-	spin_lock_irqsave(&s->lock, flags);
-	cm_handle_midi(s);
-	spin_unlock_irqrestore(&s->lock, flags);
-	s->midi.timer.expires = jiffies+1;
-	add_timer(&s->midi.timer);
-}
-#endif
-
 /* --------------------------------------------------------------------- */
 
 static const char invalid_magic[] = KERN_CRIT "cmpci: invalid magic value\n";
 
-#ifdef CONFIG_SOUND_CMPCI	/* support multiple chips */
-#define VALIDATE_STATE(s)
-#else
 #define VALIDATE_STATE(s)                         \
 ({                                                \
 	if (!(s) || (s)->magic != CM_MAGIC) { \
@@ -1214,7 +1568,6 @@
 		return -ENXIO;                    \
 	}                                         \
 })
-#endif
 
 /* --------------------------------------------------------------------- */
 
@@ -1231,16 +1584,17 @@
 	unsigned rec;
 	unsigned play;
 } mixtable[SOUND_MIXER_NRDEVICES] = {
-	[SOUND_MIXER_CD]     = { DSP_MIX_CDVOLIDX_L,     DSP_MIX_CDVOLIDX_R,     MT_5MUTE,     0x04, 0x02 },
-	[SOUND_MIXER_LINE]   = { DSP_MIX_LINEVOLIDX_L,   DSP_MIX_LINEVOLIDX_R,   MT_5MUTE,     0x10, 0x08 },
+	[SOUND_MIXER_CD]     = { DSP_MIX_CDVOLIDX_L,     DSP_MIX_CDVOLIDX_R,     MT_5MUTE,     0x04, 0x06 },
+	[SOUND_MIXER_LINE]   = { DSP_MIX_LINEVOLIDX_L,   DSP_MIX_LINEVOLIDX_R,   MT_5MUTE,     0x10, 0x18 },
 	[SOUND_MIXER_MIC]    = { DSP_MIX_MICVOLIDX,      DSP_MIX_MICVOLIDX,      MT_5MUTEMONO, 0x01, 0x01 },
 	[SOUND_MIXER_SYNTH]  = { DSP_MIX_FMVOLIDX_L,  	 DSP_MIX_FMVOLIDX_R,     MT_5MUTE,     0x40, 0x00 },
 	[SOUND_MIXER_VOLUME] = { DSP_MIX_MASTERVOLIDX_L, DSP_MIX_MASTERVOLIDX_R, MT_5MUTE,     0x00, 0x00 },
 	[SOUND_MIXER_PCM]    = { DSP_MIX_VOICEVOLIDX_L,  DSP_MIX_VOICEVOLIDX_R,  MT_5MUTE,     0x00, 0x00 },
-	[SOUND_MIXER_SPEAKER]= { DSP_MIX_SPKRVOLIDX,	 DSP_MIX_SPKRVOLIDX,	 MT_5MUTEMONO, 0x01, 0x01 }
+	[SOUND_MIXER_LINE1]  = { DSP_MIX_AUXVOL_L,       DSP_MIX_AUXVOL_R,       MT_5MUTE,     0x80, 0x60 },
+	[SOUND_MIXER_SPEAKER]= { DSP_MIX_SPKRVOLIDX,	 DSP_MIX_SPKRVOLIDX,	 MT_5MUTEMONO, 0x00, 0x01 }
 };
 
-static const unsigned char volidx[SOUND_MIXER_NRDEVICES] = 
+static const unsigned char volidx[SOUND_MIXER_NRDEVICES] =
 {
 	[SOUND_MIXER_CD]     = 1,
 	[SOUND_MIXER_LINE]   = 2,
@@ -1248,15 +1602,32 @@
 	[SOUND_MIXER_SYNTH]  = 4,
 	[SOUND_MIXER_VOLUME] = 5,
 	[SOUND_MIXER_PCM]    = 6,
-	[SOUND_MIXER_SPEAKER]= 7
+	[SOUND_MIXER_LINE1]  = 7,
+	[SOUND_MIXER_SPEAKER]= 8
 };
 
+static unsigned mixer_outmask(struct cm_state *s)
+{
+	unsigned long flags;
+	int i, j, k;
+
+	spin_lock_irqsave(&s->lock, flags);
+	j = rdmixer(s, DSP_MIX_OUTMIXIDX);
+	spin_unlock_irqrestore(&s->lock, flags);
+	for (k = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
+		if (j & mixtable[i].play)
+			k |= 1 << i;
+	return k;
+}
+
 static unsigned mixer_recmask(struct cm_state *s)
 {
+	unsigned long flags;
 	int i, j, k;
 
+	spin_lock_irqsave(&s->lock, flags);
 	j = rdmixer(s, DSP_MIX_ADCMIXIDX_L);
-	j &= 0x7f;
+	spin_unlock_irqrestore(&s->lock, flags);
 	for (k = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 		if (j & mixtable[i].rec)
 			k |= 1 << i;
@@ -1268,6 +1639,8 @@
 	unsigned long flags;
 	int i, val, j;
 	unsigned char l, r, rl, rr;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_STATE(s);
         if (cmd == SOUND_MIXER_INFO) {
@@ -1276,7 +1649,7 @@
 		strlcpy(info.id, "cmpci", sizeof(info.id));
 		strlcpy(info.name, "C-Media PCI", sizeof(info.name));
 		info.modify_counter = s->mix.modcnt;
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user(argp, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
@@ -1285,48 +1658,50 @@
 		memset(&info, 0, sizeof(info));
 		strlcpy(info.id, "cmpci", sizeof(info.id));
 		strlcpy(info.name, "C-Media cmpci", sizeof(info.name));
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user(argp, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
 	if (cmd == OSS_GETVERSION)
-		return put_user(SOUND_VERSION, (int *)arg);
-	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+		return put_user(SOUND_VERSION, p);
+	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
-        if (_IOC_DIR(cmd) == _IOC_READ) {
+        if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
-			return put_user(mixer_recmask(s), (int *)arg);
-			
+			val = mixer_recmask(s);
+			return put_user(val, p);
+
                 case SOUND_MIXER_OUTSRC: /* Arg contains a bit for each recording source */
-			return put_user(mixer_recmask(s), (int *)arg);//need fix
-			
+			val = mixer_outmask(s);
+			return put_user(val, p);
+
                 case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].type)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 
                 case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].rec)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
-			
+			return put_user(val, p);
+
                 case SOUND_MIXER_OUTMASK: /* Arg contains a bit for each supported recording source */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].play)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
-			
+			return put_user(val, p);
+
                  case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].type && mixtable[i].type != MT_4MUTEMONO)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
-			
+			return put_user(val, p);
+
                 case SOUND_MIXER_CAPS:
-			return put_user(0, (int *)arg);
+			return put_user(0, p);
 
 		default:
 			i = _IOC_NR(cmd);
@@ -1334,15 +1709,15 @@
                                 return -EINVAL;
 			if (!volidx[i])
 				return -EINVAL;
-			return put_user(s->mix.vol[volidx[i]-1], (int *)arg);
+			return put_user(s->mix.vol[volidx[i]-1], p);
 		}
 	}
-        if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) 
+        if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE))
 		return -EINVAL;
 	s->mix.modcnt++;
 	switch (_IOC_NR(cmd)) {
 	case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		i = generic_hweight32(val);
 		for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
@@ -1356,12 +1731,12 @@
 		}
 		spin_lock_irqsave(&s->lock, flags);
 		wrmixer(s, DSP_MIX_ADCMIXIDX_L, j);
-		wrmixer(s, DSP_MIX_ADCMIXIDX_R, (j & 1) | (j>>1));
+		wrmixer(s, DSP_MIX_ADCMIXIDX_R, (j & 1) | (j>>1) | (j & 0x80));
 		spin_unlock_irqrestore(&s->lock, flags);
 		return 0;
 
 	case SOUND_MIXER_OUTSRC: /* Arg contains a bit for each recording source */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		for (j = i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
 			if (!(val & (1 << i)))
@@ -1373,15 +1748,15 @@
 			j |= mixtable[i].play;
 		}
 		spin_lock_irqsave(&s->lock, flags);
-		frobindir(s, DSP_MIX_OUTMIXIDX, 0x1f, j);
+		wrmixer(s, DSP_MIX_OUTMIXIDX, j);
 		spin_unlock_irqrestore(&s->lock, flags);
 		return 0;
 
-		default:
+	default:
 		i = _IOC_NR(cmd);
 		if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type)
 			return -EINVAL;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		l = val & 0xff;
 		r = (val >> 8) & 0xff;
@@ -1404,22 +1779,38 @@
 			rl = (l < 4 ? 0 : (l - 5) / 3) & 31;
 			rr = (rl >> 2) & 7;
 			wrmixer(s, mixtable[i].left, rl<<3);
-			maskb(s->iobase + CODEC_CMI_MIXER2, ~0x0e, rr<<1);
+			if (i == SOUND_MIXER_MIC)
+				maskb(s->iobase + CODEC_CMI_MIXER2, ~0x0e, rr<<1);
 			break;
-			
+
 		case MT_5MUTEMONO:
-			r = l;
 			rl = l < 4 ? 0 : (l - 5) / 3;
-			rr = rl >> 2;
  			wrmixer(s, mixtable[i].left, rl<<3);
-			maskb(s->iobase + CODEC_CMI_MIXER2, ~0x0e, rr<<1);
+			l = rdmixer(s, DSP_MIX_OUTMIXIDX) & ~mixtable[i].play;
+			r = rl ? mixtable[i].play : 0;
+			wrmixer(s, DSP_MIX_OUTMIXIDX, l | r);
+			/* for recording */
+			if (i == SOUND_MIXER_MIC) {
+				if (s->chip_version >= 37) {
+					rr = rl >> 1;
+					maskb(s->iobase + CODEC_CMI_MIXER2, ~0x0e, (rr&0x07)<<1);
+					frobindir(s, DSP_MIX_EXTENSION, ~0x01, rr>>3);
+				} else {
+					rr = rl >> 2;
+					maskb(s->iobase + CODEC_CMI_MIXER2, ~0x0e, rr<<1);
+				}
+			}
 			break;
-				
+
 		case MT_5MUTE:
 			rl = l < 4 ? 0 : (l - 5) / 3;
 			rr = r < 4 ? 0 : (r - 5) / 3;
  			wrmixer(s, mixtable[i].left, rl<<3);
 			wrmixer(s, mixtable[i].right, rr<<3);
+			l = rdmixer(s, DSP_MIX_OUTMIXIDX);
+			l &= ~mixtable[i].play;
+			r = (rl|rr) ? mixtable[i].play : 0;
+			wrmixer(s, DSP_MIX_OUTMIXIDX, l | r);
 			break;
 
 		case MT_6MUTE:
@@ -1440,7 +1831,7 @@
 		if (!volidx[i])
 			return -EINVAL;
 		s->mix.vol[volidx[i]-1] = val;
-		return put_user(s->mix.vol[volidx[i]-1], (int *)arg);
+		return put_user(s->mix.vol[volidx[i]-1], p);
 	}
 }
 
@@ -1449,12 +1840,16 @@
 static int cm_open_mixdev(struct inode *inode, struct file *file)
 {
 	int minor = iminor(inode);
-	struct cm_state *s = devs;
+	struct list_head *list;
+	struct cm_state *s;
 
-	while (s && s->dev_mixer != minor)
-		s = s->next;
-	if (!s)
-		return -ENODEV;
+	for (list = devs.next; ; list = list->next) {
+		if (list == &devs)
+			return -ENODEV;
+		s = list_entry(list, struct cm_state, devs);
+		if (s->dev_mixer == minor)
+			break;
+	}
        	VALIDATE_STATE(s);
 	file->private_data = s;
 	return 0;
@@ -1462,10 +1857,8 @@
 
 static int cm_release_mixdev(struct inode *inode, struct file *file)
 {
-	struct cm_state *s;
+	struct cm_state *s = (struct cm_state *)file->private_data;
 
-	s = file->private_data;
-	
 	VALIDATE_STATE(s);
 	return 0;
 }
@@ -1494,9 +1887,9 @@
 
 	if (s->dma_dac.mapped || !s->dma_dac.ready)
 		return 0;
-        set_current_state(TASK_INTERRUPTIBLE);
         add_wait_queue(&s->dma_dac.wait, &wait);
         for (;;) {
+        	__set_current_state(TASK_INTERRUPTIBLE);
                 spin_lock_irqsave(&s->lock, flags);
 		count = s->dma_dac.count;
                 spin_unlock_irqrestore(&s->lock, flags);
@@ -1512,7 +1905,7 @@
 		tmo = 3 * HZ * (count + s->dma_dac.fragsize) / 2 / s->ratedac;
 		tmo >>= sample_shift[(s->fmt >> CM_CFMT_DACSHIFT) & CM_CFMT_MASK];
 		if (!schedule_timeout(tmo + 1))
-			printk(KERN_DEBUG "cmpci: dma timed out??\n");
+			DBG(printk(KERN_DEBUG "cmpci: dma timed out??\n");)
         }
         remove_wait_queue(&s->dma_dac.wait, &wait);
         set_current_state(TASK_RUNNING);
@@ -1523,9 +1916,10 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t cm_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t cm_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct cm_state *s = (struct cm_state *)file->private_data;
+	DECLARE_WAITQUEUE(wait, current);
 	ssize_t ret;
 	unsigned long flags;
 	unsigned swptr;
@@ -1542,37 +1936,71 @@
 		return -EFAULT;
 	ret = 0;
 
+        add_wait_queue(&s->dma_adc.wait, &wait);
 	while (count > 0) {
 		spin_lock_irqsave(&s->lock, flags);
 		swptr = s->dma_adc.swptr;
 		cnt = s->dma_adc.dmasize-swptr;
 		if (s->dma_adc.count < cnt)
 			cnt = s->dma_adc.count;
+		if (cnt <= 0)
+			__set_current_state(TASK_INTERRUPTIBLE);
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (cnt > count)
 			cnt = count;
 		if (cnt <= 0) {
-			start_adc(s);
-			if (file->f_flags & O_NONBLOCK)
-				return ret ? ret : -EAGAIN;
-			if (!interruptible_sleep_on_timeout(&s->dma_adc.wait, HZ)) {
+			if (s->dma_adc.enabled)
+				start_adc(s);
+			if (file->f_flags & O_NONBLOCK) {
+				if (!ret)
+					ret = -EAGAIN;
+				goto out;
+			}
+			if (!schedule_timeout(HZ)) {
 				printk(KERN_DEBUG "cmpci: read: chip lockup? dmasz %u fragsz %u count %i hwptr %u swptr %u\n",
 				       s->dma_adc.dmasize, s->dma_adc.fragsize, s->dma_adc.count,
 				       s->dma_adc.hwptr, s->dma_adc.swptr);
 				spin_lock_irqsave(&s->lock, flags);
 				stop_adc_unlocked(s);
-				set_dmaadc(s, s->dma_adc.rawphys, s->dma_adc.dmasamples);
+				set_dmaadc(s, s->dma_adc.dmaaddr, s->dma_adc.dmasamples);
 				/* program sample counts */
 				set_countadc(s, s->dma_adc.fragsamples);
 				s->dma_adc.count = s->dma_adc.hwptr = s->dma_adc.swptr = 0;
 				spin_unlock_irqrestore(&s->lock, flags);
 			}
-			if (signal_pending(current))
-				return ret ? ret : -ERESTARTSYS;
+			if (signal_pending(current)) {
+				if (!ret)
+					ret = -ERESTARTSYS;
+				goto out;
+			}
 			continue;
 		}
-		if (copy_to_user(buffer, s->dma_adc.rawbuf + swptr, cnt))
-			return ret ? ret : -EFAULT;
+		if (s->status & DO_BIGENDIAN_R) {
+			int	i, err;
+			unsigned char *src;
+			char __user *dst = buffer;
+			unsigned char data[2];
+
+			src = (unsigned char *) (s->dma_adc.rawbuf + swptr);
+			// copy left/right sample at one time
+			for (i = 0; i < cnt / 2; i++) {
+				data[0] = src[1];
+				data[1] = src[0];
+				if ((err = __put_user(data[0], dst++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __put_user(data[1], dst++))) {
+					ret = err;
+					goto out;
+				}
+				src += 2;
+			}
+		} else if (copy_to_user(buffer, s->dma_adc.rawbuf + swptr, cnt)) {
+			if (!ret)
+				ret = -EFAULT;
+			goto out;
+		}
 		swptr = (swptr + cnt) % s->dma_adc.dmasize;
 		spin_lock_irqsave(&s->lock, flags);
 		s->dma_adc.swptr = swptr;
@@ -1580,15 +2008,20 @@
 		count -= cnt;
 		buffer += cnt;
 		ret += cnt;
-		start_adc_unlocked(s);
+		if (s->dma_adc.enabled)
+			start_adc_unlocked(s);
 		spin_unlock_irqrestore(&s->lock, flags);
 	}
+out:
+        remove_wait_queue(&s->dma_adc.wait, &wait);
+	set_current_state(TASK_RUNNING);
 	return ret;
 }
 
-static ssize_t cm_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t cm_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct cm_state *s = (struct cm_state *)file->private_data;
+	DECLARE_WAITQUEUE(wait, current);
 	ssize_t ret;
 	unsigned long flags;
 	unsigned swptr;
@@ -1608,11 +2041,12 @@
 			return -ENXIO;
 		if (!s->dma_adc.ready && (ret = prog_dmabuf(s, 1)))
 			return ret;
-		if (!access_ok(VERIFY_READ, buffer, count))
-			return -EFAULT;
 	}
+	if (!access_ok(VERIFY_READ, buffer, count))
+		return -EFAULT;
 	ret = 0;
 
+        add_wait_queue(&s->dma_dac.wait, &wait);
 	while (count > 0) {
 		spin_lock_irqsave(&s->lock, flags);
 		if (s->dma_dac.count < 0) {
@@ -1633,33 +2067,42 @@
 			if (s->dma_dac.count + cnt > s->dma_dac.dmasize)
 				cnt = s->dma_dac.dmasize - s->dma_dac.count;
 		}
+		if (cnt <= 0)
+			__set_current_state(TASK_INTERRUPTIBLE);
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (cnt > count)
 			cnt = count;
 		if ((s->status & DO_DUAL_DAC) && (cnt > count / 2))
 		    cnt = count / 2;
 		if (cnt <= 0) {
-			start_dac(s);
-			if (file->f_flags & O_NONBLOCK)
-				return ret ? ret : -EAGAIN;
-			if (!interruptible_sleep_on_timeout(&s->dma_dac.wait, HZ)) {
+			if (s->dma_dac.enabled)
+				start_dac(s);
+			if (file->f_flags & O_NONBLOCK) {
+				if (!ret)
+					ret = -EAGAIN;
+				goto out;
+			}
+			if (!schedule_timeout(HZ)) {
 				printk(KERN_DEBUG "cmpci: write: chip lockup? dmasz %u fragsz %u count %i hwptr %u swptr %u\n",
 				       s->dma_dac.dmasize, s->dma_dac.fragsize, s->dma_dac.count,
 				       s->dma_dac.hwptr, s->dma_dac.swptr);
 				spin_lock_irqsave(&s->lock, flags);
 				stop_dac_unlocked(s);
-				set_dmadac(s, s->dma_dac.rawphys, s->dma_dac.dmasamples);
+				set_dmadac(s, s->dma_dac.dmaaddr, s->dma_dac.dmasamples);
 				/* program sample counts */
 				set_countdac(s, s->dma_dac.fragsamples);
 				s->dma_dac.count = s->dma_dac.hwptr = s->dma_dac.swptr = 0;
 				if (s->status & DO_DUAL_DAC)  {
-					set_dmadac1(s, s->dma_adc.rawphys, s->dma_adc.dmasamples);
+					set_dmadac1(s, s->dma_adc.dmaaddr, s->dma_adc.dmasamples);
 					s->dma_adc.count = s->dma_adc.hwptr = s->dma_adc.swptr = 0;
 				}
 				spin_unlock_irqrestore(&s->lock, flags);
 			}
-			if (signal_pending(current))
-				return ret ? ret : -ERESTARTSYS;
+			if (signal_pending(current)) {
+				if (!ret)
+					ret = -ERESTARTSYS;
+				goto out;
+			}
 			continue;
 		}
 		if (s->status & DO_AC3_SW) {
@@ -1668,27 +2111,112 @@
 			// clip exceeded data, caught by 033 and 037
 			if (swptr + 2 * cnt > s->dma_dac.dmasize)
 				cnt = (s->dma_dac.dmasize - swptr) / 2;
-			if ((err = trans_ac3(s, s->dma_dac.rawbuf + swptr, buffer, cnt)))
-				return err;
+			if ((err = trans_ac3(s, s->dma_dac.rawbuf + swptr, buffer, cnt))) {
+				ret = err;
+				goto out;
+			}
 			swptr = (swptr + 2 * cnt) % s->dma_dac.dmasize;
+		} else if ((s->status & DO_DUAL_DAC) && (s->status & DO_BIGENDIAN_W)) {
+			int	i, err;
+			const char __user *src = buffer;
+			unsigned char *dst0, *dst1;
+			unsigned char data[8];
+
+			dst0 = (unsigned char *) (s->dma_dac.rawbuf + swptr);
+			dst1 = (unsigned char *) (s->dma_adc.rawbuf + swptr);
+			// copy left/right sample at one time
+			for (i = 0; i < cnt / 4; i++) {
+				if ((err = __get_user(data[0], src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(data[1], src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(data[2], src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(data[3], src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(data[4], src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(data[5], src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(data[6], src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(data[7], src++))) {
+					ret = err;
+					goto out;
+				}
+				dst0[0] = data[1];
+				dst0[1] = data[0];
+				dst0[2] = data[3];
+				dst0[3] = data[2];
+				dst1[0] = data[5];
+				dst1[1] = data[4];
+				dst1[2] = data[7];
+				dst1[3] = data[6];
+				dst0 += 4;
+				dst1 += 4;
+			}
+			swptr = (swptr + cnt) % s->dma_dac.dmasize;
 		} else if (s->status & DO_DUAL_DAC) {
 			int	i, err;
-			unsigned long *src, *dst0, *dst1;
+			unsigned long __user *src = (unsigned long __user *) buffer;
+			unsigned long *dst0, *dst1;
 
-			src = (unsigned long *) buffer;
 			dst0 = (unsigned long *) (s->dma_dac.rawbuf + swptr);
 			dst1 = (unsigned long *) (s->dma_adc.rawbuf + swptr);
 			// copy left/right sample at one time
-			for (i = 0; i <= cnt / 4; i++) {
-				if ((err = __get_user(*dst0++, src++)))
-					return err;
-				if ((err = __get_user(*dst1++, src++)))
-					return err;
+			for (i = 0; i < cnt / 4; i++) {
+				if ((err = __get_user(*dst0++, src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(*dst1++, src++))) {
+					ret = err;
+					goto out;
+				}
+			}
+			swptr = (swptr + cnt) % s->dma_dac.dmasize;
+		} else if (s->status & DO_BIGENDIAN_W) {
+			int	i, err;
+			const char __user *src = buffer;
+			unsigned char *dst;
+			unsigned char data[2];
+
+			dst = (unsigned char *) (s->dma_dac.rawbuf + swptr);
+			// swap hi/lo bytes for each sample
+			for (i = 0; i < cnt / 2; i++) {
+				if ((err = __get_user(data[0], src++))) {
+					ret = err;
+					goto out;
+				}
+				if ((err = __get_user(data[1], src++))) {
+					ret = err;
+					goto out;
+				}
+				dst[0] = data[1];
+				dst[1] = data[0];
+				dst += 2;
 			}
 			swptr = (swptr + cnt) % s->dma_dac.dmasize;
 		} else {
-			if (copy_from_user(s->dma_dac.rawbuf + swptr, buffer, cnt))
-				return ret ? ret : -EFAULT;
+			if (copy_from_user(s->dma_dac.rawbuf + swptr, buffer, cnt)) {
+				if (!ret)
+					ret = -EFAULT;
+				goto out;
+			}
 			swptr = (swptr + cnt) % s->dma_dac.dmasize;
 		}
 		spin_lock_irqsave(&s->lock, flags);
@@ -1706,8 +2234,12 @@
 			buffer += cnt;
 			ret += cnt;
 		}
-		start_dac(s);
+		if (s->dma_dac.enabled)
+			start_dac(s);
 	}
+out:
+        remove_wait_queue(&s->dma_dac.wait, &wait);
+	set_current_state(TASK_RUNNING);
 	return ret;
 }
 
@@ -1718,10 +2250,16 @@
 	unsigned int mask = 0;
 
 	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
+	if (file->f_mode & FMODE_WRITE) {
+		if (!s->dma_dac.ready && prog_dmabuf(s, 0))
+			return 0;
 		poll_wait(file, &s->dma_dac.wait, wait);
-	if (file->f_mode & FMODE_READ)
+	}
+	if (file->f_mode & FMODE_READ) {
+		if (!s->dma_adc.ready && prog_dmabuf(s, 1))
+			return 0;
 		poll_wait(file, &s->dma_adc.wait, wait);
+	}
 	spin_lock_irqsave(&s->lock, flags);
 	cm_update_ptr(s);
 	if (file->f_mode & FMODE_READ) {
@@ -1730,7 +2268,7 @@
 	}
 	if (file->f_mode & FMODE_WRITE) {
 		if (s->dma_dac.mapped) {
-			if (s->dma_dac.count >= (signed)s->dma_dac.fragsize) 
+			if (s->dma_dac.count >= (signed)s->dma_dac.fragsize)
 				mask |= POLLOUT | POLLWRNORM;
 		} else {
 			if ((signed)s->dma_dac.dmasize >= s->dma_dac.count + (signed)s->dma_dac.fragsize)
@@ -1776,6 +2314,16 @@
 	return ret;
 }
 
+#define SNDCTL_SPDIF_COPYRIGHT	_SIOW('S',  0, int)       // set/reset S/PDIF copy protection
+#define SNDCTL_SPDIF_LOOP	_SIOW('S',  1, int)       // set/reset S/PDIF loop
+#define SNDCTL_SPDIF_MONITOR	_SIOW('S',  2, int)       // set S/PDIF monitor
+#define SNDCTL_SPDIF_LEVEL	_SIOW('S',  3, int)       // set/reset S/PDIF out level
+#define SNDCTL_SPDIF_INV	_SIOW('S',  4, int)       // set/reset S/PDIF in inverse
+#define SNDCTL_SPDIF_SEL2	_SIOW('S',  5, int)       // set S/PDIF in #2
+#define SNDCTL_SPDIF_VALID	_SIOW('S',  6, int)       // set S/PDIF valid
+#define SNDCTL_SPDIFOUT		_SIOW('S',  7, int)       // set S/PDIF out
+#define SNDCTL_SPDIFIN		_SIOW('S',  8, int)       // set S/PDIF out
+
 static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct cm_state *s = (struct cm_state *)file->private_data;
@@ -1784,25 +2332,27 @@
         count_info cinfo;
 	int val, mapped, ret;
 	unsigned char fmtm, fmtd;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_STATE(s);
         mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) ||
 		((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		if (file->f_mode & FMODE_WRITE)
 			return drain_dac(s, 0/*file->f_flags & O_NONBLOCK*/);
 		return 0;
-		
+
 	case SNDCTL_DSP_SETDUPLEX:
 		return 0;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP | DSP_CAP_BIND, (int *)arg);
-		
+		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP | DSP_CAP_BIND, p);
+
         case SNDCTL_DSP_RESET:
 		if (file->f_mode & FMODE_WRITE) {
 			stop_dac(s);
@@ -1819,7 +2369,7 @@
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			if (file->f_mode & FMODE_READ) {
@@ -1837,10 +2387,10 @@
 				set_dac_rate(s, val);
 			}
 		}
-		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
 
         case SNDCTL_DSP_STEREO:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		fmtd = 0;
 		fmtm = ~0;
@@ -1871,7 +2421,7 @@
 		return 0;
 
         case SNDCTL_DSP_CHANNELS:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			fmtd = 0;
@@ -1903,17 +2453,18 @@
 			if ((s->capability & CAN_MULTI_CH)
 			     && (file->f_mode & FMODE_WRITE)) {
 				val = set_dac_channels(s, val);
-				return put_user(val, (int *)arg);
+				return put_user(val, p);
 			}
-		}            
-		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) 
-					   : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, (int *)arg);
-		
+		}
+		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT)
+					   : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, p);
+
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(AFMT_S16_LE|AFMT_U8|AFMT_AC3, (int *)arg);
-		
+                return put_user(AFMT_S16_BE|AFMT_S16_LE|AFMT_U8|
+			((s->capability & CAN_AC3) ? AFMT_AC3 : 0), p);
+
 	case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			fmtd = 0;
@@ -1921,36 +2472,44 @@
 			if (file->f_mode & FMODE_READ) {
 				stop_adc(s);
 				s->dma_adc.ready = 0;
-				if (val == AFMT_S16_LE)
+				if (val == AFMT_S16_BE || val == AFMT_S16_LE)
 					fmtd |= CM_CFMT_16BIT << CM_CFMT_ADCSHIFT;
 				else
 					fmtm &= ~(CM_CFMT_16BIT << CM_CFMT_ADCSHIFT);
+				if (val == AFMT_S16_BE)
+					s->status |= DO_BIGENDIAN_R;
+				else
+					s->status &= ~DO_BIGENDIAN_R;
 			}
 			if (file->f_mode & FMODE_WRITE) {
 				stop_dac(s);
 				s->dma_dac.ready = 0;
-				if (val == AFMT_S16_LE || val == AFMT_AC3)
+				if (val == AFMT_S16_BE || val == AFMT_S16_LE || val == AFMT_AC3)
 					fmtd |= CM_CFMT_16BIT << CM_CFMT_DACSHIFT;
 				else
 					fmtm &= ~(CM_CFMT_16BIT << CM_CFMT_DACSHIFT);
 				if (val == AFMT_AC3) {
 					fmtd |= CM_CFMT_STEREO << CM_CFMT_DACSHIFT;
-					set_ac3(s, s->ratedac);
+					set_ac3(s, 48000);
 				} else
 					set_ac3(s, 0);
 				if (s->status & DO_DUAL_DAC) {
 					s->dma_adc.ready = 0;
-					if (val == AFMT_S16_LE)
+					if (val == AFMT_S16_BE || val == AFMT_S16_LE)
 						fmtd |= CM_CFMT_STEREO << CM_CFMT_ADCSHIFT;
 					else
 						fmtm &= ~(CM_CFMT_STEREO << CM_CFMT_ADCSHIFT);
 				}
+				if (val == AFMT_S16_BE)
+					s->status |= DO_BIGENDIAN_W;
+				else
+					s->status &= ~DO_BIGENDIAN_W;
 			}
 			set_fmt(s, fmtm, fmtd);
 		}
-		if (s->status & DO_AC3) return put_user(AFMT_AC3, (int *)arg);
+		if (s->status & DO_AC3) return put_user(AFMT_AC3, p);
 		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT)
-					   : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? AFMT_S16_LE : AFMT_U8, (int *)arg);
+					   : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? val : AFMT_U8, p);
 
 	case SNDCTL_DSP_POST:
                 return 0;
@@ -1959,27 +2518,30 @@
 		val = 0;
 		if (s->status & DO_DUAL_DAC) {
 			if (file->f_mode & FMODE_WRITE &&
-			 (s->enable & CM_ENABLE_CH1) &&
-			 (s->enable & CM_ENABLE_CH0))
+			 (s->enable & ENDAC) &&
+			 (s->enable & ENADC))
 				val |= PCM_ENABLE_OUTPUT;
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 		}
-		if (file->f_mode & FMODE_READ && s->enable & CM_ENABLE_CH0) 
+		if (file->f_mode & FMODE_READ && s->enable & ENADC)
 			val |= PCM_ENABLE_INPUT;
-		if (file->f_mode & FMODE_WRITE && s->enable & CM_ENABLE_CH1) 
+		if (file->f_mode & FMODE_WRITE && s->enable & ENDAC)
 			val |= PCM_ENABLE_OUTPUT;
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			if (val & PCM_ENABLE_INPUT) {
-				if (!s->dma_adc.ready && (ret =  prog_dmabuf(s, 1)))
+				if (!s->dma_adc.ready && (ret = prog_dmabuf(s, 1)))
 					return ret;
+				s->dma_adc.enabled = 1;
 				start_adc(s);
-			} else
+			} else {
+				s->dma_adc.enabled = 0;
 				stop_adc(s);
+			}
 		}
 		if (file->f_mode & FMODE_WRITE) {
 			if (val & PCM_ENABLE_OUTPUT) {
@@ -1989,16 +2551,19 @@
 					if (!s->dma_adc.ready && (ret = prog_dmabuf(s, 1)))
 						return ret;
 				}
+				s->dma_dac.enabled = 1;
 				start_dac(s);
-			} else
+			} else {
+				s->dma_dac.enabled = 0;
 				stop_dac(s);
+			}
 		}
 		return 0;
 
 	case SNDCTL_DSP_GETOSPACE:
 		if (!(file->f_mode & FMODE_WRITE))
 			return -EINVAL;
-		if (!(s->enable & CM_ENABLE_CH1) && (val = prog_dmabuf(s, 0)) != 0)
+		if (!(s->enable & ENDAC) && (val = prog_dmabuf(s, 0)) != 0)
 			return val;
 		spin_lock_irqsave(&s->lock, flags);
 		cm_update_ptr(s);
@@ -2007,22 +2572,22 @@
                 abinfo.fragstotal = s->dma_dac.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift;
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
 			return -EINVAL;
-		if (!(s->enable & CM_ENABLE_CH0) && (val = prog_dmabuf(s, 1)) != 0)
+		if (!(s->enable & ENADC) && (val = prog_dmabuf(s, 1)) != 0)
 			return val;
 		spin_lock_irqsave(&s->lock, flags);
 		cm_update_ptr(s);
 		abinfo.fragsize = s->dma_adc.fragsize;
                 abinfo.bytes = s->dma_adc.count;
                 abinfo.fragstotal = s->dma_adc.numfrag;
-                abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;      
+                abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
-		
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
                 return 0;
@@ -2034,7 +2599,7 @@
 		cm_update_ptr(s);
                 val = s->dma_dac.count;
 		spin_unlock_irqrestore(&s->lock, flags);
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
         case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -2047,9 +2612,7 @@
 		if (s->dma_adc.mapped)
 			s->dma_adc.count &= s->dma_adc.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
-			return -EFAULT;
-		return 0;
+                return copy_to_user(argp, &cinfo, sizeof(cinfo))  ? -EFAULT : 0;
 
         case SNDCTL_DSP_GETOPTR:
 		if (!(file->f_mode & FMODE_WRITE))
@@ -2066,9 +2629,7 @@
 				s->dma_adc.count &= s->dma_adc.fragsize-1;
 		}
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
-			return -EFAULT;
-		return 0;
+                return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
 
         case SNDCTL_DSP_GETBLKSIZE:
 		if (file->f_mode & FMODE_WRITE) {
@@ -2077,16 +2638,16 @@
 			if (s->status & DO_DUAL_DAC) {
 				if ((val = prog_dmabuf(s, 1)))
 					return val;
-				return put_user(2 * s->dma_dac.fragsize, (int *)arg);
+				return put_user(2 * s->dma_dac.fragsize, p);
 			}
-			return put_user(s->dma_dac.fragsize, (int *)arg);
+			return put_user(s->dma_dac.fragsize, p);
 		}
 		if ((val = prog_dmabuf(s, 1)))
 			return val;
-		return put_user(s->dma_adc.fragsize, (int *)arg);
+		return put_user(s->dma_adc.fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			s->dma_adc.ossfragshift = val & 0xffff;
@@ -2118,7 +2679,7 @@
 		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
 		    (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision))
 			return -EINVAL;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -2132,22 +2693,22 @@
 		return 0;
 
         case SOUND_PCM_READ_RATE:
-		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
 
         case SOUND_PCM_READ_CHANNELS:
-		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, (int *)arg);
+		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_STEREO << CM_CFMT_ADCSHIFT) : (CM_CFMT_STEREO << CM_CFMT_DACSHIFT))) ? 2 : 1, p);
 
         case SOUND_PCM_READ_BITS:
-		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT) : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? 16 : 8, (int *)arg);
+		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (CM_CFMT_16BIT << CM_CFMT_ADCSHIFT) : (CM_CFMT_16BIT << CM_CFMT_DACSHIFT))) ? 16 : 8, p);
 
         case SOUND_PCM_READ_FILTER:
-		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
 
 	case SNDCTL_DSP_GETCHANNELMASK:
-		return put_user(DSP_BIND_FRONT|DSP_BIND_SURR|DSP_BIND_CENTER_LFE|DSP_BIND_SPDIF, (int *)arg);
-		
+		return put_user(DSP_BIND_FRONT|DSP_BIND_SURR|DSP_BIND_CENTER_LFE|DSP_BIND_SPDIF, p);
+
 	case SNDCTL_DSP_BIND_CHANNEL:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val == DSP_BIND_QUERY) {
 			val = DSP_BIND_FRONT;
@@ -2163,6 +2724,11 @@
 			if (file->f_mode & FMODE_READ) {
 				stop_adc(s);
 				s->dma_adc.ready = 0;
+				if (val & DSP_BIND_SPDIF) {
+					set_spdifin(s, s->rateadc);
+					if (!(s->status & DO_SPDIF_OUT))
+						val &= ~DSP_BIND_SPDIF;
+				}
 			}
 			if (file->f_mode & FMODE_WRITE) {
 				stop_dac(s);
@@ -2195,14 +2761,58 @@
 				}
 			}
 		}
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SOUND_PCM_WRITE_FILTER:
 	case SNDCTL_DSP_MAPINBUF:
 	case SNDCTL_DSP_MAPOUTBUF:
         case SNDCTL_DSP_SETSYNCRO:
                 return -EINVAL;
-		
+	case SNDCTL_SPDIF_COPYRIGHT:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdif_copyright(s, val);
+                return 0;
+	case SNDCTL_SPDIF_LOOP:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdif_loop(s, val);
+                return 0;
+	case SNDCTL_SPDIF_MONITOR:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdif_monitor(s, val);
+                return 0;
+	case SNDCTL_SPDIF_LEVEL:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdifout_level(s, val);
+                return 0;
+	case SNDCTL_SPDIF_INV:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdifin_inverse(s, val);
+                return 0;
+	case SNDCTL_SPDIF_SEL2:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdifin_channel2(s, val);
+                return 0;
+	case SNDCTL_SPDIF_VALID:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdifin_valid(s, val);
+                return 0;
+	case SNDCTL_SPDIFOUT:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdifout(s, val ? s->ratedac : 0);
+                return 0;
+	case SNDCTL_SPDIFIN:
+		if (get_user(val, p))
+			return -EFAULT;
+		set_spdifin(s, val ? s->rateadc : 0);
+                return 0;
 	}
 	return mixer_ioctl(s, cmd, arg);
 }
@@ -2210,13 +2820,18 @@
 static int cm_open(struct inode *inode, struct file *file)
 {
 	int minor = iminor(inode);
-	struct cm_state *s = devs;
+	DECLARE_WAITQUEUE(wait, current);
 	unsigned char fmtm = ~0, fmts = 0;
+	struct list_head *list;
+	struct cm_state *s;
 
-	while (s && ((s->dev_audio ^ minor) & ~0xf))
-		s = s->next;
-	if (!s)
-		return -ENODEV;
+	for (list = devs.next; ; list = list->next) {
+		if (list == &devs)
+			return -ENODEV;
+		s = list_entry(list, struct cm_state, devs);
+		if (!((s->dev_audio ^ minor) & ~0xf))
+			break;
+	}
        	VALIDATE_STATE(s);
 	file->private_data = s;
 	/* wait for device to become free */
@@ -2226,31 +2841,39 @@
 			up(&s->open_sem);
 			return -EBUSY;
 		}
+		add_wait_queue(&s->open_wait, &wait);
+		__set_current_state(TASK_INTERRUPTIBLE);
 		up(&s->open_sem);
-		interruptible_sleep_on(&s->open_wait);
+		schedule();
+		remove_wait_queue(&s->open_wait, &wait);
+		set_current_state(TASK_RUNNING);
 		if (signal_pending(current))
 			return -ERESTARTSYS;
 		down(&s->open_sem);
 	}
 	if (file->f_mode & FMODE_READ) {
+		s->status &= ~DO_BIGENDIAN_R;
 		fmtm &= ~((CM_CFMT_STEREO | CM_CFMT_16BIT) << CM_CFMT_ADCSHIFT);
 		if ((minor & 0xf) == SND_DEV_DSP16)
 			fmts |= CM_CFMT_16BIT << CM_CFMT_ADCSHIFT;
 		s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags = s->dma_adc.subdivision = 0;
+		s->dma_adc.enabled = 1;
 		set_adc_rate(s, 8000);
+		// spdif-in is turnned off by default
+		set_spdifin(s, 0);
 	}
 	if (file->f_mode & FMODE_WRITE) {
+		s->status &= ~DO_BIGENDIAN_W;
 		fmtm &= ~((CM_CFMT_STEREO | CM_CFMT_16BIT) << CM_CFMT_DACSHIFT);
 		if ((minor & 0xf) == SND_DEV_DSP16)
 			fmts |= CM_CFMT_16BIT << CM_CFMT_DACSHIFT;
 		s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags = s->dma_dac.subdivision = 0;
+		s->dma_dac.enabled = 1;
 		set_dac_rate(s, 8000);
 		// clear previous multichannel, spdif, ac3 state
 		set_spdifout(s, 0);
-		if (s->deviceid == PCI_DEVICE_ID_CMEDIA_CM8738) {
-			set_ac3(s, 0);
-			set_dac_channels(s, 1);
-		}
+		set_ac3(s, 0);
+		set_dac_channels(s, 1);
 	}
 	set_fmt(s, fmtm, fmts);
 	s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
@@ -2270,20 +2893,24 @@
 	if (file->f_mode & FMODE_WRITE) {
 		stop_dac(s);
 
-		dealloc_dmabuf(&s->dma_dac);
+		dealloc_dmabuf(s, &s->dma_dac);
 		if (s->status & DO_DUAL_DAC)
-			dealloc_dmabuf(&s->dma_adc);
+			dealloc_dmabuf(s, &s->dma_adc);
 
 		if (s->status & DO_MULTI_CH)
-			set_dac_channels(s, 0);
+			set_dac_channels(s, 1);
 		if (s->status & DO_AC3)
 			set_ac3(s, 0);
 		if (s->status & DO_SPDIF_OUT)
 			set_spdifout(s, 0);
+		/* enable SPDIF loop */
+		set_spdif_loop(s, spdif_loop);
+		s->status &= ~DO_BIGENDIAN_W;
 	}
 	if (file->f_mode & FMODE_READ) {
 		stop_adc(s);
-		dealloc_dmabuf(&s->dma_adc);
+		dealloc_dmabuf(s, &s->dma_adc);
+		s->status &= ~DO_BIGENDIAN_R;
 	}
 	s->open_mode &= ~(file->f_mode & (FMODE_READ|FMODE_WRITE));
 	up(&s->open_sem);
@@ -2304,449 +2931,8 @@
 	.release = cm_release,
 };
 
-#ifdef CONFIG_SOUND_CMPCI_MIDI
 /* --------------------------------------------------------------------- */
 
-static ssize_t cm_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
-{
-	struct cm_state *s = (struct cm_state *)file->private_data;
-	DECLARE_WAITQUEUE(wait, current);
-	ssize_t ret;
-	unsigned long flags;
-	unsigned ptr;
-	int cnt;
-
-	VALIDATE_STATE(s);
-	if (ppos != &file->f_pos)
-		return -ESPIPE;
-	if (!access_ok(VERIFY_WRITE, buffer, count))
-		return -EFAULT;
-	ret = 0;
-	add_wait_queue(&s->midi.iwait, &wait);
-	while (count > 0) {
-		spin_lock_irqsave(&s->lock, flags);
-		ptr = s->midi.ird;
-		cnt = MIDIINBUF - ptr;
-		if (s->midi.icnt < cnt)
-			cnt = s->midi.icnt;
-		spin_unlock_irqrestore(&s->lock, flags);
-		if (cnt > count)
-			cnt = count;
-		if (cnt <= 0) {
-			if (file->f_flags & O_NONBLOCK)
-			{
-				if (!ret)
-					ret = -EAGAIN;
-				break;
-			}
-			__set_current_state(TASK_INTERRUPTIBLE);
-			schedule();
-			if (signal_pending(current))
-			{
-				if (!ret)
-					ret = -ERESTARTSYS;
-				break;
-			}
-			continue;
-		}
-		if (copy_to_user(buffer, s->midi.ibuf + ptr, cnt))
-		{
-			if (!ret)
-				ret = -EFAULT;
-			break;
-		}
-		ptr = (ptr + cnt) % MIDIINBUF;
-		spin_lock_irqsave(&s->lock, flags);
-		s->midi.ird = ptr;
-		s->midi.icnt -= cnt;
-		spin_unlock_irqrestore(&s->lock, flags);
-		count -= cnt;
-		buffer += cnt;
-		ret += cnt;
-		break;
-	}
-	__set_current_state(TASK_RUNNING);
-	remove_wait_queue(&s->midi.iwait, &wait);
-	return ret;
-}
-
-static ssize_t cm_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
-{
-	struct cm_state *s = (struct cm_state *)file->private_data;
-	DECLARE_WAITQUEUE(wait, current);
-	ssize_t ret;
-	unsigned long flags;
-	unsigned ptr;
-	int cnt;
-
-	VALIDATE_STATE(s);
-	if (ppos != &file->f_pos)
-		return -ESPIPE;
-	if (!access_ok(VERIFY_READ, buffer, count))
-		return -EFAULT;
-	if (count == 0)
-		return 0;
-	ret = 0;
-	add_wait_queue(&s->midi.owait, &wait);
-	while (count > 0) {
-		spin_lock_irqsave(&s->lock, flags);
-		ptr = s->midi.owr;
-		cnt = MIDIOUTBUF - ptr;
-		if (s->midi.ocnt + cnt > MIDIOUTBUF)
-			cnt = MIDIOUTBUF - s->midi.ocnt;
-		if (cnt <= 0)
-			cm_handle_midi(s);
-		spin_unlock_irqrestore(&s->lock, flags);
-		if (cnt > count)
-			cnt = count;
-		if (cnt <= 0) {
-			if (file->f_flags & O_NONBLOCK)
-			{
-				if (!ret)
-					ret = -EAGAIN;
-				break;
-			}
-			__set_current_state(TASK_INTERRUPTIBLE);
-			schedule();
-			if (signal_pending(current)) {
-				if (!ret)
-					ret = -ERESTARTSYS;
-				break;
-			}
-			continue;
-		}
-		if (copy_from_user(s->midi.obuf + ptr, buffer, cnt))
-		{
-			if (!ret)
-				ret = -EFAULT;
-			break;
-		}
-		ptr = (ptr + cnt) % MIDIOUTBUF;
-		spin_lock_irqsave(&s->lock, flags);
-		s->midi.owr = ptr;
-		s->midi.ocnt += cnt;
-		spin_unlock_irqrestore(&s->lock, flags);
-		count -= cnt;
-		buffer += cnt;
-		ret += cnt;
-		spin_lock_irqsave(&s->lock, flags);
-		cm_handle_midi(s);
-		spin_unlock_irqrestore(&s->lock, flags);
-	}
-	__set_current_state(TASK_RUNNING);
-	remove_wait_queue(&s->midi.owait, &wait);
-	return ret;
-}
-
-static unsigned int cm_midi_poll(struct file *file, struct poll_table_struct *wait)
-{
-	struct cm_state *s = (struct cm_state *)file->private_data;
-	unsigned long flags;
-	unsigned int mask = 0;
-
-	VALIDATE_STATE(s);
-	if (file->f_mode & FMODE_WRITE)
-		poll_wait(file, &s->midi.owait, wait);
-	if (file->f_mode & FMODE_READ)
-		poll_wait(file, &s->midi.iwait, wait);
-	spin_lock_irqsave(&s->lock, flags);
-	if (file->f_mode & FMODE_READ) {
-		if (s->midi.icnt > 0)
-			mask |= POLLIN | POLLRDNORM;
-	}
-	if (file->f_mode & FMODE_WRITE) {
-		if (s->midi.ocnt < MIDIOUTBUF)
-			mask |= POLLOUT | POLLWRNORM;
-	}
-	spin_unlock_irqrestore(&s->lock, flags);
-	return mask;
-}
-
-static int cm_midi_open(struct inode *inode, struct file *file)
-{
-	int minor = iminor(inode);
-	struct cm_state *s = devs;
-	unsigned long flags;
-
-	while (s && s->dev_midi != minor)
-		s = s->next;
-	if (!s)
-		return -ENODEV;
-       	VALIDATE_STATE(s);
-	file->private_data = s;
-	/* wait for device to become free */
-	down(&s->open_sem);
-	while (s->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) {
-		if (file->f_flags & O_NONBLOCK) {
-			up(&s->open_sem);
-			return -EBUSY;
-		}
-		up(&s->open_sem);
-		interruptible_sleep_on(&s->open_wait);
-		if (signal_pending(current))
-			return -ERESTARTSYS;
-		down(&s->open_sem);
-	}
-	spin_lock_irqsave(&s->lock, flags);
-	if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) {
-		s->midi.ird = s->midi.iwr = s->midi.icnt = 0;
-		s->midi.ord = s->midi.owr = s->midi.ocnt = 0;
-		/* enable MPU-401 */
-		maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 4);
-		outb(0xff, s->iomidi+1); /* reset command */
-		if (!(inb(s->iomidi+1) & 0x80))
-			inb(s->iomidi);
-		outb(0x3f, s->iomidi+1); /* uart command */
-		if (!(inb(s->iomidi+1) & 0x80))
-			inb(s->iomidi);
-		s->midi.ird = s->midi.iwr = s->midi.icnt = 0;
-		init_timer(&s->midi.timer);
-		s->midi.timer.expires = jiffies+1;
-		s->midi.timer.data = (unsigned long)s;
-		s->midi.timer.function = cm_midi_timer;
-		add_timer(&s->midi.timer);
-	}
-	if (file->f_mode & FMODE_READ) {
-		s->midi.ird = s->midi.iwr = s->midi.icnt = 0;
-	}
-	if (file->f_mode & FMODE_WRITE) {
-		s->midi.ord = s->midi.owr = s->midi.ocnt = 0;
-	}
-	spin_unlock_irqrestore(&s->lock, flags);
-	s->open_mode |= (file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE);
-	up(&s->open_sem);
-	return 0;
-}
-
-static int cm_midi_release(struct inode *inode, struct file *file)
-{
-	struct cm_state *s = (struct cm_state *)file->private_data;
-	DECLARE_WAITQUEUE(wait, current);
-	unsigned long flags;
-	unsigned count, tmo;
-
-	VALIDATE_STATE(s);
-	lock_kernel();
-
-	if (file->f_mode & FMODE_WRITE) {
-		__set_current_state(TASK_INTERRUPTIBLE);
-		add_wait_queue(&s->midi.owait, &wait);
-		for (;;) {
-			spin_lock_irqsave(&s->lock, flags);
-			count = s->midi.ocnt;
-			spin_unlock_irqrestore(&s->lock, flags);
-			if (count <= 0)
-				break;
-			if (signal_pending(current))
-				break;
-			if (file->f_flags & O_NONBLOCK) {
-				remove_wait_queue(&s->midi.owait, &wait);
-				set_current_state(TASK_RUNNING);
-				unlock_kernel();
-				return -EBUSY;
-			}
-			tmo = (count * HZ) / 3100;
-			if (!schedule_timeout(tmo ? : 1) && tmo)
-				printk(KERN_DEBUG "cmpci: midi timed out??\n");
-		}
-		remove_wait_queue(&s->midi.owait, &wait);
-		set_current_state(TASK_RUNNING);
-	}
-	down(&s->open_sem);
-	s->open_mode &= ~((file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ|FMODE_MIDI_WRITE));
-	spin_lock_irqsave(&s->lock, flags);
-	if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) {
-		del_timer(&s->midi.timer);		
-		outb(0xff, s->iomidi+1); /* reset command */
-		if (!(inb(s->iomidi+1) & 0x80))
-			inb(s->iomidi);
-		/* disable MPU-401 */
-		maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~4, 0);
-	}
-	spin_unlock_irqrestore(&s->lock, flags);
-	up(&s->open_sem);
-	wake_up(&s->open_wait);
-	unlock_kernel();
-	return 0;
-}
-
-static /*const*/ struct file_operations cm_midi_fops = {
-	.owner	 = THIS_MODULE,
-	.llseek	 = no_llseek,
-	.read	 = cm_midi_read,
-	.write	 = cm_midi_write,
-	.poll	 = cm_midi_poll,
-	.open	 = cm_midi_open,
-	.release = cm_midi_release,
-};
-#endif
-
-/* --------------------------------------------------------------------- */
-
-#ifdef CONFIG_SOUND_CMPCI_FM
-static int cm_dmfm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
-	static const unsigned char op_offset[18] = {
-		0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
-		0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
-		0x10, 0x11, 0x12, 0x13, 0x14, 0x15
-	};
-	struct cm_state *s = (struct cm_state *)file->private_data;
-	struct dm_fm_voice v;
-	struct dm_fm_note n;
-	struct dm_fm_params p;
-	unsigned int io;
-	unsigned int regb;
-
-	switch (cmd) {		
-	case FM_IOCTL_RESET:
-		for (regb = 0xb0; regb < 0xb9; regb++) {
-			outb(regb, s->iosynth);
-			outb(0, s->iosynth+1);
-			outb(regb, s->iosynth+2);
-			outb(0, s->iosynth+3);
-		}
-		return 0;
-
-	case FM_IOCTL_PLAY_NOTE:
-		if (copy_from_user(&n, (void *)arg, sizeof(n)))
-			return -EFAULT;
-		if (n.voice >= 18)
-			return -EINVAL;
-		if (n.voice >= 9) {
-			regb = n.voice - 9;
-			io = s->iosynth+2;
-		} else {
-			regb = n.voice;
-			io = s->iosynth;
-		}
-		outb(0xa0 + regb, io);
-		outb(n.fnum & 0xff, io+1);
-		outb(0xb0 + regb, io);
-		outb(((n.fnum >> 8) & 3) | ((n.octave & 7) << 2) | ((n.key_on & 1) << 5), io+1);
-		return 0;
-
-	case FM_IOCTL_SET_VOICE:
-		if (copy_from_user(&v, (void *)arg, sizeof(v)))
-			return -EFAULT;
-		if (v.voice >= 18)
-			return -EINVAL;
-		regb = op_offset[v.voice];
-		io = s->iosynth + ((v.op & 1) << 1);
-		outb(0x20 + regb, io);
-		outb(((v.am & 1) << 7) | ((v.vibrato & 1) << 6) | ((v.do_sustain & 1) << 5) | 
-		     ((v.kbd_scale & 1) << 4) | (v.harmonic & 0xf), io+1);
-		outb(0x40 + regb, io);
-		outb(((v.scale_level & 0x3) << 6) | (v.volume & 0x3f), io+1);
-		outb(0x60 + regb, io);
-		outb(((v.attack & 0xf) << 4) | (v.decay & 0xf), io+1);
-		outb(0x80 + regb, io);
-		outb(((v.sustain & 0xf) << 4) | (v.release & 0xf), io+1);
-		outb(0xe0 + regb, io);
-		outb(v.waveform & 0x7, io+1);
-		if (n.voice >= 9) {
-			regb = n.voice - 9;
-			io = s->iosynth+2;
-		} else {
-			regb = n.voice;
-			io = s->iosynth;
-		}
-		outb(0xc0 + regb, io);
-		outb(((v.right & 1) << 5) | ((v.left & 1) << 4) | ((v.feedback & 7) << 1) |
-		     (v.connection & 1), io+1);
-		return 0;
-		
-	case FM_IOCTL_SET_PARAMS:
-		if (copy_from_user(&p, (void *)arg, sizeof(p)))
-			return -EFAULT;
-		outb(0x08, s->iosynth);
-		outb((p.kbd_split & 1) << 6, s->iosynth+1);
-		outb(0xbd, s->iosynth);
-		outb(((p.am_depth & 1) << 7) | ((p.vib_depth & 1) << 6) | ((p.rhythm & 1) << 5) | ((p.bass & 1) << 4) |
-		     ((p.snare & 1) << 3) | ((p.tomtom & 1) << 2) | ((p.cymbal & 1) << 1) | (p.hihat & 1), s->iosynth+1);
-		return 0;
-
-	case FM_IOCTL_SET_OPL:
-		outb(4, s->iosynth+2);
-		outb(arg, s->iosynth+3);
-		return 0;
-
-	case FM_IOCTL_SET_MODE:
-		outb(5, s->iosynth+2);
-		outb(arg & 1, s->iosynth+3);
-		return 0;
-	}
-	return -EINVAL;
-}
-
-static int cm_dmfm_open(struct inode *inode, struct file *file)
-{
-	int minor = iminor(inode);
-	struct cm_state *s = devs;
-
-	while (s && s->dev_dmfm != minor)
-		s = s->next;
-	if (!s)
-		return -ENODEV;
-       	VALIDATE_STATE(s);
-	file->private_data = s;
-	/* wait for device to become free */
-	down(&s->open_sem);
-	while (s->open_mode & FMODE_DMFM) {
-		if (file->f_flags & O_NONBLOCK) {
-			up(&s->open_sem);
-			return -EBUSY;
-		}
-		up(&s->open_sem);
-		interruptible_sleep_on(&s->open_wait);
-		if (signal_pending(current))
-			return -ERESTARTSYS;
-		down(&s->open_sem);
-	}
-	/* init the stuff */
-	outb(1, s->iosynth);
-	outb(0x20, s->iosynth+1); /* enable waveforms */
-	outb(4, s->iosynth+2);
-	outb(0, s->iosynth+3);  /* no 4op enabled */
-	outb(5, s->iosynth+2);
-	outb(1, s->iosynth+3);  /* enable OPL3 */
-	s->open_mode |= FMODE_DMFM;
-	up(&s->open_sem);
-	return 0;
-}
-
-static int cm_dmfm_release(struct inode *inode, struct file *file)
-{
-	struct cm_state *s = (struct cm_state *)file->private_data;
-	unsigned int regb;
-
-	VALIDATE_STATE(s);
-	lock_kernel();
-	down(&s->open_sem);
-	s->open_mode &= ~FMODE_DMFM;
-	for (regb = 0xb0; regb < 0xb9; regb++) {
-		outb(regb, s->iosynth);
-		outb(0, s->iosynth+1);
-		outb(regb, s->iosynth+2);
-		outb(0, s->iosynth+3);
-	}
-	up(&s->open_sem);
-	wake_up(&s->open_wait);
-	unlock_kernel();
-	return 0;
-}
-
-static /*const*/ struct file_operations cm_dmfm_fops = {
-	.owner	 = THIS_MODULE,
-	.llseek	 = no_llseek,
-	.ioctl	 = cm_dmfm_ioctl,
-	.open	 = cm_dmfm_open,
-	.release = cm_dmfm_release,
-};
-#endif /* CONFIG_SOUND_CMPCI_FM */
-
-
-
 static struct initvol {
 	int mixch;
 	int vol;
@@ -2787,377 +2973,305 @@
 	    if (RegValue & (1 << (26-24))) {
 		ChipVersion = 39;
 	    	if (RegValue & (1 << (24-24)))
-		    s->max_channels  = 6;
+		    s->max_channels = 6;
 	    	else
 		    s->max_channels = 4;
 		s->capability |= CAN_AC3_HW;
 		s->capability |= CAN_DUAL_DAC;
 		s->capability |= CAN_MULTI_CH_HW;
+		s->capability |= CAN_LINE_AS_BASS;
+		s->capability |= CAN_MIC_AS_BASS;
 	    } else {
 		ChipVersion = 55; // 4 or 6 channels
-		s->max_channels  = 6;
+		s->max_channels = 6;
 		s->capability |= CAN_AC3_HW;
 		s->capability |= CAN_DUAL_DAC;
 		s->capability |= CAN_MULTI_CH_HW;
+		s->capability |= CAN_LINE_AS_BASS;
+		s->capability |= CAN_MIC_AS_BASS;
 	    }
 	}
-	// still limited to number of speakers
-	if (s->max_channels > s->speakers)
-		s->max_channels = s->speakers;
+	s->capability |= CAN_LINE_AS_REAR;
 	return ChipVersion;
 }
 
-#ifdef CONFIG_SOUND_CMPCI_MIDI
-static	int	mpuio = CONFIG_SOUND_CMPCI_MPUIO;
-#else
-static	int	mpuio;
-#endif
-#ifdef CONFIG_SOUND_CMPCI_FM
-static	int	fmio = CONFIG_SOUND_CMPCI_FMIO;
-#else
-static	int	fmio;
-#endif
-#ifdef CONFIG_SOUND_CMPCI_SPDIFINVERSE
-static	int	spdif_inverse = 1;
-#else
-static	int	spdif_inverse;
-#endif
-#ifdef CONFIG_SOUND_CMPCI_SPDIFLOOP
-static	int	spdif_loop = 1;
-#else
-static	int	spdif_loop;
-#endif
-#ifdef CONFIG_SOUND_CMPCI_SPEAKERS
-static	int	speakers = CONFIG_SOUND_CMPCI_SPEAKERS;
-#else
-static	int	speakers = 2;
-#endif
-#ifdef CONFIG_SOUND_CMPCI_LINE_REAR
-static	int	use_line_as_rear = 1;
-#else
-static	int	use_line_as_rear;
-#endif
-#ifdef CONFIG_SOUND_CMPCI_LINE_BASS
-static	int	use_line_as_bass = 1;
-#else
-static	int	use_line_as_bass;
-#endif
-#ifdef CONFIG_SOUND_CMPCI_JOYSTICK
-static	int	joystick = 1;
-#else
-static	int	joystick;
-#endif
-MODULE_PARM(mpuio, "i");
-MODULE_PARM(fmio, "i");
-MODULE_PARM(spdif_inverse, "i");
-MODULE_PARM(spdif_loop, "i");
-MODULE_PARM(speakers, "i");
-MODULE_PARM(use_line_as_rear, "i");
-MODULE_PARM(use_line_as_bass, "i");
-MODULE_PARM(joystick, "i");
-MODULE_PARM_DESC(mpuio, "(0x330, 0x320, 0x310, 0x300) Base of MPU-401, 0 to disable");
-MODULE_PARM_DESC(fmio, "(0x388, 0x3C8, 0x3E0) Base of OPL3, 0 to disable");
-MODULE_PARM_DESC(spdif_inverse, "(1/0) Invert S/PDIF-in signal");
-MODULE_PARM_DESC(spdif_loop, "(1/0) Route S/PDIF-in to S/PDIF-out directly");
-MODULE_PARM_DESC(speakers, "(2-6) Number of speakers you connect");
-MODULE_PARM_DESC(use_line_as_rear, "(1/0) Use line-in jack as rear-out");
-MODULE_PARM_DESC(use_line_as_bass, "(1/0) Use line-in jack as bass/center");
-MODULE_PARM_DESC(joystick, "(1/0) Enable joystick interface, still need joystick driver");
-
-static struct pci_device_id cmpci_pci_tbl[] = {
-	{ PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738, 
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
- 	{ PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338A, 
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-	{ PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338B, 
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
-	{ 0 }
-};
-MODULE_DEVICE_TABLE(pci, cmpci_pci_tbl);
+#define	echo_option(x)\
+if (x) strcat(options, "" #x " ")
 
-void initialize_chip(struct pci_dev *pcidev)
+static int __devinit cm_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid)
 {
 	struct cm_state *s;
-	int i, val;
-#if defined(CONFIG_SOUND_CMPCI_MIDI) || defined(CONFIG_SOUND_CMPCI_FM)
-	unsigned char reg_mask = 0;
-#endif
+	mm_segment_t fs;
+	int i, val, ret;
+	unsigned char reg_mask;
 	struct {
 		unsigned short	deviceid;
 		char		*devicename;
-	} devicetable[] =
-	{
+	} devicetable[] = {
 		{ PCI_DEVICE_ID_CMEDIA_CM8338A, "CM8338A" },
 		{ PCI_DEVICE_ID_CMEDIA_CM8338B, "CM8338B" },
 		{ PCI_DEVICE_ID_CMEDIA_CM8738,  "CM8738" },
 		{ PCI_DEVICE_ID_CMEDIA_CM8738B, "CM8738B" },
 	};
 	char	*devicename = "unknown";
-	{
-		if (pci_enable_device(pcidev))
-			return;
-		if (pcidev->irq == 0)
-			return;
-		s = kmalloc(sizeof(*s), GFP_KERNEL);
-		if (!s) {
-			printk(KERN_WARNING "cmpci: out of memory\n");
-			return;
-		}
-		/* search device name */
-		for (i = 0; i < sizeof(devicetable) / sizeof(devicetable[0]); i++) {
-			if (devicetable[i].deviceid == pcidev->device)
-			{
-				devicename = devicetable[i].devicename;
-				break;
-			}
-		}
-		memset(s, 0, sizeof(struct cm_state));
-		init_waitqueue_head(&s->dma_adc.wait);
-		init_waitqueue_head(&s->dma_dac.wait);
-		init_waitqueue_head(&s->open_wait);
-		init_waitqueue_head(&s->midi.iwait);
-		init_waitqueue_head(&s->midi.owait);
-		init_MUTEX(&s->open_sem);
-		spin_lock_init(&s->lock);
-		s->magic = CM_MAGIC;
-		s->iobase = pci_resource_start(pcidev, 0);
-		s->iosynth = fmio;
-		s->iomidi = mpuio;
-		s->status = 0;
-		/* range check */
-		if (speakers < 2)
-			speakers = 2;
-		else if (speakers > 6)
-			speakers = 6;
-		s->speakers = speakers;
-		if (s->iobase == 0)
-			return;
-		s->irq = pcidev->irq;
-
-		if (!request_region(s->iobase, CM_EXTENT_CODEC, "cmpci")) {
-			printk(KERN_ERR "cmpci: io ports %#x-%#x in use\n", s->iobase, s->iobase+CM_EXTENT_CODEC-1);
-			goto err_region5;
+	char	options[256];
+
+	if ((ret = pci_enable_device(pcidev)))
+		return ret;
+	if (!(pci_resource_flags(pcidev, 0) & IORESOURCE_IO))
+		return -ENODEV;
+	if (pcidev->irq == 0)
+		return -ENODEV;
+	i = pci_set_dma_mask(pcidev, 0xffffffff);
+	if (i) {
+		printk(KERN_WARNING "cmpci: architecture does not support 32bit PCI busmaster DMA\n");
+		return i;
+	}
+	s = kmalloc(sizeof(*s), GFP_KERNEL);
+	if (!s) {
+		printk(KERN_WARNING "cmpci: out of memory\n");
+		return -ENOMEM;
+	}
+	/* search device name */
+	for (i = 0; i < sizeof(devicetable) / sizeof(devicetable[0]); i++) {
+		if (devicetable[i].deviceid == pcidev->device) {
+			devicename = devicetable[i].devicename;
+			break;
 		}
+	}
+	memset(s, 0, sizeof(struct cm_state));
+	init_waitqueue_head(&s->dma_adc.wait);
+	init_waitqueue_head(&s->dma_dac.wait);
+	init_waitqueue_head(&s->open_wait);
+	init_MUTEX(&s->open_sem);
+	spin_lock_init(&s->lock);
+	s->magic = CM_MAGIC;
+	s->dev = pcidev;
+	s->iobase = pci_resource_start(pcidev, 0);
+	s->iosynth = fmio;
+	s->iomidi = mpuio;
 #ifdef CONFIG_SOUND_CMPCI_MIDI
-		/* disable MPU-401 */
-		maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0x04, 0);
-		if (s->iomidi) {
-		    if (!request_region(s->iomidi, CM_EXTENT_MIDI, "cmpci Midi")) {
-			printk(KERN_ERR "cmpci: io ports %#x-%#x in use\n", s->iomidi, s->iomidi+CM_EXTENT_MIDI-1);
-			s->iomidi = 0;
-		    } else {
-		        /* set IO based at 0x330 */
-		        switch (s->iomidi) {
-		 	    case 0x330:
-				reg_mask = 0;
-				break;
-			    case 0x320:
-				reg_mask = 0x20;
-				break;
-			    case 0x310:
-				reg_mask = 0x40;
-				break;
-			    case 0x300:
-				reg_mask = 0x60;
-				break;
-			    default:
-				s->iomidi = 0;
-				break;
-		        }
-		        outb((inb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3) & ~0x60) | reg_mask, s->iobase + CODEC_CMI_LEGACY_CTRL + 3);
-			/* enable MPU-401 */
-			if (s->iomidi) {
-			    maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x04);
-			}
-		    }
-		}
+	s->midi_devc = 0;
 #endif
+	s->status = 0;
+	if (s->iobase == 0)
+		return -ENODEV;
+	s->irq = pcidev->irq;
+
+	if (!request_region(s->iobase, CM_EXTENT_CODEC, "cmpci")) {
+		printk(KERN_ERR "cmpci: io ports %#x-%#x in use\n", s->iobase, s->iobase+CM_EXTENT_CODEC-1);
+		ret = -EBUSY;
+		goto err_region5;
+	}
+	/* dump parameters */
+	strcpy(options, "cmpci: ");
+	echo_option(joystick);
+	echo_option(spdif_inverse);
+	echo_option(spdif_loop);
+	echo_option(spdif_out);
+	echo_option(use_line_as_rear);
+	echo_option(use_line_as_bass);
+	echo_option(use_mic_as_bass);
+	echo_option(mic_boost);
+	echo_option(hw_copy);
+	printk(KERN_INFO "%s\n", options);
+
+	/* initialize codec registers */
+	outb(0, s->iobase + CODEC_CMI_INT_HLDCLR + 2);  /* disable ints */
+	outb(0, s->iobase + CODEC_CMI_FUNCTRL0 + 2); /* disable channels */
+	/* reset mixer */
+	wrmixer(s, DSP_MIX_DATARESETIDX, 0);
+
+	/* request irq */
+	if ((ret = request_irq(s->irq, cm_interrupt, SA_SHIRQ, "cmpci", s))) {
+		printk(KERN_ERR "cmpci: irq %u in use\n", s->irq);
+		goto err_irq;
+	}
+	printk(KERN_INFO "cmpci: found %s adapter at io %#x irq %u\n",
+	       devicename, s->iobase, s->irq);
+	/* register devices */
+	if ((s->dev_audio = register_sound_dsp(&cm_audio_fops, -1)) < 0) {
+		ret = s->dev_audio;
+		goto err_dev1;
+	}
+	if ((s->dev_mixer = register_sound_mixer(&cm_mixer_fops, -1)) < 0) {
+		ret = s->dev_mixer;
+		goto err_dev2;
+	}
+	pci_set_master(pcidev);	/* enable bus mastering */
+	/* initialize the chips */
+	fs = get_fs();
+	set_fs(KERNEL_DS);
+	/* set mixer output */
+	frobindir(s, DSP_MIX_OUTMIXIDX, 0x1f, 0x1f);
+	/* set mixer input */
+	val = SOUND_MASK_LINE|SOUND_MASK_SYNTH|SOUND_MASK_CD|SOUND_MASK_MIC;
+	mixer_ioctl(s, SOUND_MIXER_WRITE_RECSRC, (unsigned long)&val);
+	for (i = 0; i < sizeof(initvol)/sizeof(initvol[0]); i++) {
+		val = initvol[i].vol;
+		mixer_ioctl(s, initvol[i].mixch, (unsigned long)&val);
+	}
+	set_fs(fs);
+	/* use channel 1 for playback, channel 0 for record */
+	maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~CHADC1, CHADC0);
+	/* turn off VMIC3 - mic boost */
+	if (mic_boost)
+		maskb(s->iobase + CODEC_CMI_MIXER2, ~1, 0);
+	else
+		maskb(s->iobase + CODEC_CMI_MIXER2, ~0, 1);
+	s->deviceid = pcidev->device;
+
+	if (pcidev->device == PCI_DEVICE_ID_CMEDIA_CM8738
+	 || pcidev->device == PCI_DEVICE_ID_CMEDIA_CM8738B) {
+
+		/* chip version and hw capability check */
+		s->chip_version = query_chip(s);
+		printk(KERN_INFO "cmpci: chip version = 0%d\n", s->chip_version);
+
+		/* set SPDIF-in inverse before enable SPDIF loop */
+		set_spdifin_inverse(s, spdif_inverse);
+
+		/* use SPDIF in #1 */
+		set_spdifin_channel2(s, 0);
+	} else {
+		s->chip_version = 0;
+		/* 8338 will fall here */
+		s->max_channels = 4;
+		s->capability |= CAN_DUAL_DAC;
+		s->capability |= CAN_LINE_AS_REAR;
+	}
+	/* enable SPDIF loop */
+	set_spdif_loop(s, spdif_loop);
+
+	// enable 4 speaker mode (analog duplicate)
+	set_hw_copy(s, hw_copy);
+
+	reg_mask = 0;
 #ifdef CONFIG_SOUND_CMPCI_FM
-		/* disable FM */
-		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~8, 0);
-		if (s->iosynth) {
-		    if (!request_region(s->iosynth, CM_EXTENT_SYNTH, "cmpci FM")) {
-			printk(KERN_ERR "cmpci: io ports %#x-%#x in use\n", s->iosynth, s->iosynth+CM_EXTENT_SYNTH-1);
+	/* disable FM */
+	maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~8, 0);
+	if (s->iosynth) {
+	    /* don't enable OPL3 if there is one */
+	    if (opl3_detect(s->iosynth, NULL)) {
+	    	s->iosynth = 0;
+	    } else {
+		/* set IO based at 0x388 */
+		switch (s->iosynth) {
+		    case 0x388:
+			reg_mask = 0;
+			break;
+		    case 0x3C8:
+			reg_mask = 0x01;
+			break;
+		    case 0x3E0:
+			reg_mask = 0x02;
+			break;
+		    case 0x3E8:
+			reg_mask = 0x03;
+			break;
+		    default:
 			s->iosynth = 0;
-		    } else {
-		        /* set IO based at 0x388 */
-		        switch (s->iosynth) {
-		 	    case 0x388:
-				reg_mask = 0;
-				break;
-			    case 0x3C8:
-				reg_mask = 0x01;
-				break;
-			    case 0x3E0:
-				reg_mask = 0x02;
-				break;
-			    case 0x3E8:
-				reg_mask = 0x03;
-				break;
-			    default:
+			break;
+		}
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~0x03, reg_mask);
+		/* enable FM */
+		if (s->iosynth) {
+			maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0, 8);
+			if (opl3_detect(s->iosynth, NULL))
+				ret = opl3_init(s->iosynth, NULL, THIS_MODULE);
+			else {
+				maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~8, 0);
 				s->iosynth = 0;
-				break;
-		        }
-		        maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~0x03, reg_mask);
-		        /* enable FM */
-			if (s->iosynth) {
-		            maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~0, 8);
 			}
-		    }
 		}
+	    }
+	}
 #endif
-		/* enable joystick */
-		if (joystick)
-			maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x02);
-		else
-			maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0x02, 0);
-		/* initialize codec registers */
-		outb(0, s->iobase + CODEC_CMI_INT_HLDCLR + 2);  /* disable ints */
-		outb(0, s->iobase + CODEC_CMI_FUNCTRL0 + 2); /* disable channels */
-		/* reset mixer */
-		wrmixer(s, DSP_MIX_DATARESETIDX, 0);
-
-		/* request irq */
-		if (request_irq(s->irq, cm_interrupt, SA_SHIRQ, "cmpci", s)) {
-			printk(KERN_ERR "cmpci: irq %u in use\n", s->irq);
-			goto err_irq;
-		}
-		printk(KERN_INFO "cmpci: found %s adapter at io %#06x irq %u\n",
-		       devicename, s->iobase, s->irq);
-		/* register devices */
-		if ((s->dev_audio = register_sound_dsp(&cm_audio_fops, -1)) < 0)
-			goto err_dev1;
-		if ((s->dev_mixer = register_sound_mixer(&cm_mixer_fops, -1)) < 0)
-			goto err_dev2;
 #ifdef CONFIG_SOUND_CMPCI_MIDI
-		if ((s->dev_midi = register_sound_midi(&cm_midi_fops, -1)) < 0)
-			goto err_dev3;
-#endif
-#ifdef CONFIG_SOUND_CMPCI_FM
-		if ((s->dev_dmfm = register_sound_special(&cm_dmfm_fops, 15 /* ?? */)) < 0)
-			goto err_dev4;
-#endif
-		pci_set_master(pcidev);	/* enable bus mastering */
-		/* initialize the chips */
-		/* set mixer output */
-		frobindir(s, DSP_MIX_OUTMIXIDX, 0x1f, 0x1f);
-		/* set mixer input */
-		val = SOUND_MASK_LINE|SOUND_MASK_SYNTH|SOUND_MASK_CD|SOUND_MASK_MIC;
-		mixer_ioctl(s, SOUND_MIXER_WRITE_RECSRC, (unsigned long)&val);
-		for (i = 0; i < sizeof(initvol)/sizeof(initvol[0]); i++) {
-			val = initvol[i].vol;
-			mixer_ioctl(s, initvol[i].mixch, (unsigned long)&val);
-		}
-		/* use channel 0 for record, channel 1 for play */
-		maskb(s->iobase + CODEC_CMI_FUNCTRL0, ~2, 1);
-		s->deviceid = pcidev->device;
-
-		if (pcidev->device == PCI_DEVICE_ID_CMEDIA_CM8738) {
-
-			/* chip version and hw capability check */
-			s->chip_version = query_chip(s);
-			printk(KERN_INFO "cmpci: chip version = 0%d\n", s->chip_version);
-
-			/* seet SPDIF-in inverse before enable SPDIF loop */
-			if (spdif_inverse) {
-				/* turn on spdif-in inverse */
-				maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~0, 1);
-				printk(KERN_INFO "cmpci: Inverse SPDIF-in\n");
-			} else {
-				/* turn off spdif-ininverse */
-				maskb(s->iobase + CODEC_CMI_CHFORMAT + 2, ~1, 0);
-			}
+	/* disable MPU-401 */
+	maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0x04, 0);
+	s->mpu_data.name = "cmpci mpu";
+	s->mpu_data.io_base = s->iomidi;
+	s->mpu_data.irq = -s->irq;	// tell mpu401 to share irq
+	if (probe_mpu401(&s->mpu_data))
+		s->iomidi = 0;
+	if (s->iomidi) {
+		/* set IO based at 0x330 */
+		switch (s->iomidi) {
+		    case 0x330:
+			reg_mask = 0;
+			break;
+		    case 0x320:
+			reg_mask = 0x20;
+			break;
+		    case 0x310:
+			reg_mask = 0x40;
+			break;
+		    case 0x300:
+			reg_mask = 0x60;
+			break;
+		    default:
+			s->iomidi = 0;
+			break;
+		}
+		maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~0x60, reg_mask);
+		/* enable MPU-401 */
+		if (s->iomidi) {
+			int timeout;
 
-			/* enable SPDIF loop */
-			if (spdif_loop) {
-				s->status |= DO_SPDIF_LOOP;
-				/* turn on spdif-in to spdif-out */
-				maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x80);
-				printk(KERN_INFO "cmpci: Enable SPDIF loop\n");
+			maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x04);
+			/* clear all previously received interrupt */
+			for (timeout = 900000; timeout > 0; timeout--) {
+				if ((inb(s->iomidi + 1) && 0x80) == 0)
+					inb(s->iomidi);
+				else
+					break;
+			}
+	    		if (!probe_mpu401(&s->mpu_data)) {
+				s->iomidi = 0;
+				maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x04);
 			} else {
-				s->status &= ~DO_SPDIF_LOOP;
-				/* turn off spdif-in to spdif-out */
-				maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0x80, 0);
-			}
-			if (use_line_as_rear) {
-				s->capability |= CAN_LINE_AS_REAR;
-				s->status |= DO_LINE_AS_REAR;
-				maskb(s->iobase + CODEC_CMI_MIXER1, ~0, 0x20);
-			} else
-				maskb(s->iobase + CODEC_CMI_MIXER1, ~0x20, 0);
-			if (s->chip_version >= 39) {
-				if (use_line_as_bass) {
-					s->capability |= CAN_LINE_AS_BASS;
-					s->status |= DO_LINE_AS_BASS;
-					maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 1, ~0, 0x60);
-				} else
-					maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 1, ~0x60, 0);
+				attach_mpu401(&s->mpu_data, THIS_MODULE);
+				s->midi_devc = s->mpu_data.slots[1];
 			}
-		} else {
-			/* 8338 will fall here */
-			s->max_channels = 2;
 		}
-		/* queue it for later freeing */
-		s->next = devs;
-		devs = s;
-		return;
-
-#ifdef CONFIG_SOUND_CMPCI_FM
-		unregister_sound_special(s->dev_dmfm);
-	err_dev4:
-#endif
-#ifdef CONFIG_SOUND_CMPCI_MIDI
-		unregister_sound_midi(s->dev_midi);
-	err_dev3:
-#endif
-		unregister_sound_mixer(s->dev_mixer);
-	err_dev2:
-		unregister_sound_dsp(s->dev_audio);
-	err_dev1:
-		printk(KERN_ERR "cmpci: cannot register misc device\n");
-		free_irq(s->irq, s);
-	err_irq:
-#ifdef CONFIG_SOUND_CMPCI_FM
-		if (s->iosynth) release_region(s->iosynth, CM_EXTENT_SYNTH);
-#endif
-#ifdef CONFIG_SOUND_CMPCI_MIDI
-		if (s->iomidi) release_region(s->iomidi, CM_EXTENT_MIDI);
-#endif
-		release_region(s->iobase, CM_EXTENT_CODEC);
-	err_region5:
-		kfree(s);
-	}
-	if (!devs) {
-		if (wavetable_mem)
-			free_pages(wavetable_mem, 20-PAGE_SHIFT);
-		return;
 	}
-	return;
-}
-
-static int __init init_cmpci(void)
-{
-	struct pci_dev *pcidev = NULL;
-	int index = 0;
-
-	printk(KERN_INFO "cmpci: version $Revision: 5.64 $ time " __TIME__ " " __DATE__ "\n");
-
-	while (index < NR_DEVICE && (
-	       (pcidev = pci_find_device(PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738, pcidev)))) { 
-		initialize_chip(pcidev);
-		index++;
-	}
-	while (index < NR_DEVICE && (
- 	       (pcidev = pci_find_device(PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338A, pcidev)))) {
-		initialize_chip(pcidev);
-		index++;
-	}
-	while (index < NR_DEVICE && (
-	       (pcidev = pci_find_device(PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338B, pcidev)))) {
-		initialize_chip(pcidev);
-		index++;
+#endif
+#ifdef CONFIG_SOUND_CMPCI_JOYSTICK
+	/* enable joystick */
+	if (joystick) {
+		s->gameport.io = 0x200;
+		if (!request_region(s->gameport.io, CM_EXTENT_GAME, "cmpci GAME")) {
+			printk(KERN_ERR "cmpci: gameport io ports in use\n");
+			s->gameport.io = 0;
+	       	} else {
+			maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x02);
+			gameport_register_port(&s->gameport);
+		}
+	} else {
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0x02, 0);
+		s->gameport.io = 0;
 	}
+#endif
+	/* store it in the driver field */
+	pci_set_drvdata(pcidev, s);
+	/* put it into driver list */
+	list_add_tail(&s->devs, &devs);
+	/* increment devindex */
+	if (devindex < NR_DEVICE-1)
+		devindex++;
 	return 0;
+
+err_dev2:
+	unregister_sound_dsp(s->dev_audio);
+err_dev1:
+	printk(KERN_ERR "cmpci: cannot register misc device\n");
+	free_irq(s->irq, s);
+err_irq:
+	release_region(s->iobase, CM_EXTENT_CODEC);
+err_region5:
+	kfree(s);
+	return ret;
 }
 
 /* --------------------------------------------------------------------- */
@@ -3166,41 +3280,76 @@
 MODULE_DESCRIPTION("CM8x38 Audio Driver");
 MODULE_LICENSE("GPL");
 
-
-static void __exit cleanup_cmpci(void)
+static void __devinit cm_remove(struct pci_dev *dev)
 {
-	struct cm_state *s;
-
-	while ((s = devs)) {
-		devs = devs->next;
-		outb(0, s->iobase + CODEC_CMI_INT_HLDCLR + 2);  /* disable ints */
-		synchronize_irq(s->irq);
-		outb(0, s->iobase + CODEC_CMI_FUNCTRL0 + 2); /* disable channels */
-		free_irq(s->irq, s);
-
-		/* reset mixer */
-		wrmixer(s, DSP_MIX_DATARESETIDX, 0);
+	struct cm_state *s = pci_get_drvdata(dev);
 
-		release_region(s->iobase, CM_EXTENT_CODEC);
-#ifdef CONFIG_SOUND_CMPCI_MIDI
-		if (s->iomidi) release_region(s->iomidi, CM_EXTENT_MIDI);
+	if (!s)
+		return;
+#ifdef CONFIG_SOUND_CMPCI_JOYSTICK
+	if (s->gameport.io) {
+		gameport_unregister_port(&s->gameport);
+		release_region(s->gameport.io, CM_EXTENT_GAME);
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0x02, 0);
+	}
 #endif
 #ifdef CONFIG_SOUND_CMPCI_FM
-		if (s->iosynth) release_region(s->iosynth, CM_EXTENT_SYNTH);
+	if (s->iosynth) {
+		/* disable FM */
+		maskb(s->iobase + CODEC_CMI_MISC_CTRL + 2, ~8, 0);
+	}
 #endif
-		unregister_sound_dsp(s->dev_audio);
-		unregister_sound_mixer(s->dev_mixer);
 #ifdef CONFIG_SOUND_CMPCI_MIDI
-		unregister_sound_midi(s->dev_midi);
-#endif
-#ifdef CONFIG_SOUND_CMPCI_FM
-		unregister_sound_special(s->dev_dmfm);
-#endif
-		kfree(s);
+	if (s->iomidi) {
+		unload_mpu401(&s->mpu_data);
+		/* disable MPU-401 */
+		maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0x04, 0);
 	}
-	if (wavetable_mem)
-		free_pages(wavetable_mem, 20-PAGE_SHIFT);
+#endif
+	set_spdif_loop(s, 0);
+	list_del(&s->devs);
+	outb(0, s->iobase + CODEC_CMI_INT_HLDCLR + 2);  /* disable ints */
+	synchronize_irq(s->irq);
+	outb(0, s->iobase + CODEC_CMI_FUNCTRL0 + 2); /* disable channels */
+	free_irq(s->irq, s);
+
+	/* reset mixer */
+	wrmixer(s, DSP_MIX_DATARESETIDX, 0);
+
+	release_region(s->iobase, CM_EXTENT_CODEC);
+	unregister_sound_dsp(s->dev_audio);
+	unregister_sound_mixer(s->dev_mixer);
+	kfree(s);
+	pci_set_drvdata(dev, NULL);
+}
+
+static struct pci_device_id id_table[] __devinitdata = {
+	{ PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738B, PCI_ANY_ID, PCI_ANY_ID, 0, 0 },
+	{ PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8738, PCI_ANY_ID, PCI_ANY_ID, 0, 0 },
+ 	{ PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338A, PCI_ANY_ID, PCI_ANY_ID, 0, 0 },
+	{ PCI_VENDOR_ID_CMEDIA, PCI_DEVICE_ID_CMEDIA_CM8338B, PCI_ANY_ID, PCI_ANY_ID, 0, 0 },
+	{ 0, }
+};
+
+MODULE_DEVICE_TABLE(pci, id_table);
+
+static struct pci_driver cm_driver = {
+       .name	 = "cmpci",
+       .id_table = id_table,
+       .probe	 = cm_probe,
+       .remove	 = cm_remove
+};
+
+static int __init init_cmpci(void)
+{
+	printk(KERN_INFO "cmpci: version $Revision: 6.82 $ time " __TIME__ " " __DATE__ "\n");
+	return pci_module_init(&cm_driver);
+}
+
+static void __exit cleanup_cmpci(void)
+{
 	printk(KERN_INFO "cmpci: unloading\n");
+	pci_unregister_driver(&cm_driver);
 }
 
 module_init(init_cmpci);
diff -Nru a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c
--- a/sound/oss/cs4281/cs4281m.c	Tue Jun 15 22:21:05 2004
+++ b/sound/oss/cs4281/cs4281m.c	Tue Jun 15 22:21:05 2004
@@ -1694,7 +1694,7 @@
 #define DMABUF_MINORDER 1	// ==> min buffer size = 8K.
 
 
-extern void dealloc_dmabuf(struct cs4281_state *s, struct dmabuf *db)
+void dealloc_dmabuf(struct cs4281_state *s, struct dmabuf *db)
 {
 	struct page *map, *mapend;
 
@@ -2148,6 +2148,7 @@
 		SOUND_MASK_MIC, SOUND_MASK_CD, 0, SOUND_MASK_LINE1,
 		SOUND_MASK_LINE, SOUND_MASK_VOLUME, 0, 0
 	};
+	void __user *argp = (void __user *)arg;
 
 	// Index of mixtable1[] member is Device ID 
 	// and must be <= SOUND_MIXER_NRDEVICES.
@@ -2195,26 +2196,26 @@
 
 		case SOUND_MIXER_CS_GETDBGMASK:
 			return put_user(cs_debugmask,
-					(unsigned long *) arg);
+					(unsigned long __user *) argp);
 
 		case SOUND_MIXER_CS_GETDBGLEVEL:
 			return put_user(cs_debuglevel,
-					(unsigned long *) arg);
+					(unsigned long __user *) argp);
 
 		case SOUND_MIXER_CS_SETDBGMASK:
-			if (get_user(val, (unsigned long *) arg))
+			if (get_user(val, (unsigned long __user *) argp))
 				return -EFAULT;
 			cs_debugmask = val;
 			return 0;
 
 		case SOUND_MIXER_CS_SETDBGLEVEL:
-			if (get_user(val, (unsigned long *) arg))
+			if (get_user(val, (unsigned long __user *) argp))
 				return -EFAULT;
 			cs_debuglevel = val;
 			return 0;
 #ifndef NOT_CS4281_PM
 		case SOUND_MIXER_CS_APM:
-			if (get_user(val, (unsigned long *) arg))
+			if (get_user(val, (unsigned long __user *) argp))
 				return -EFAULT;
 			if(val == CS_IOCTL_CMD_SUSPEND)
 				cs4281_suspend(s);
@@ -2238,7 +2239,7 @@
 
 	if (cmd == SOUND_MIXER_PRIVATE1) {
 		// enable/disable/query mixer preamp 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *) argp))
 			return -EFAULT;
 		if (val != -1) {
 			cs4281_read_ac97(s, BA0_AC97_MIC_VOLUME, &temp1);
@@ -2247,11 +2248,11 @@
 		}
 		cs4281_read_ac97(s, BA0_AC97_MIC_VOLUME, &temp1);
 		val = (temp1 & 0x40) ? 1 : 0;
-		return put_user(val, (int *) arg);
+		return put_user(val, (int __user *) argp);
 	}
 	if (cmd == SOUND_MIXER_PRIVATE2) {
 		// enable/disable/query spatializer 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		if (val != -1) {
 			temp1 = (val & 0x3f) >> 2;
@@ -2262,14 +2263,14 @@
 					  temp1 | 0x2000);
 		}
 		cs4281_read_ac97(s, BA0_AC97_3D_CONTROL, &temp1);
-		return put_user((temp1 << 2) | 3, (int *) arg);
+		return put_user((temp1 << 2) | 3, (int __user *)argp);
 	}
 	if (cmd == SOUND_MIXER_INFO) {
 		mixer_info info;
 		strlcpy(info.id, "CS4281", sizeof(info.id));
 		strlcpy(info.name, "Crystal CS4281", sizeof(info.name));
 		info.modify_counter = s->mix.modcnt;
-		if (copy_to_user((void *) arg, &info, sizeof(info)))
+		if (copy_to_user(argp, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
@@ -2277,12 +2278,12 @@
 		_old_mixer_info info;
 		strlcpy(info.id, "CS4281", sizeof(info.id));
 		strlcpy(info.name, "Crystal CS4281", sizeof(info.name));
-		if (copy_to_user((void *) arg, &info, sizeof(info)))
+		if (copy_to_user(argp, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
 	if (cmd == OSS_GETVERSION)
-		return put_user(SOUND_VERSION, (int *) arg);
+		return put_user(SOUND_VERSION, (int __user *) argp);
 
 	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
 		return -EINVAL;
@@ -2292,9 +2293,8 @@
 	if (_SIOC_DIR(cmd) == _SIOC_READ) {
 		switch (_IOC_NR(cmd)) {
 		case SOUND_MIXER_RECSRC:	// Arg contains a bit for each recording source 
-			cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT,
-					 &temp1);
-			return put_user(mixer_src[temp1 & 7], (int *) arg);
+			cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT, &temp1);
+			return put_user(mixer_src[temp1&7], (int __user *)argp);
 
 		case SOUND_MIXER_DEVMASK:	// Arg contains a bit for each supported device 
 			return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH |
@@ -2302,29 +2302,29 @@
 					SOUND_MASK_LINE1 | SOUND_MASK_MIC |
 					SOUND_MASK_VOLUME |
 					SOUND_MASK_RECLEV |
-					SOUND_MASK_SPEAKER, (int *) arg);
+					SOUND_MASK_SPEAKER, (int __user *)argp);
 
 		case SOUND_MIXER_RECMASK:	// Arg contains a bit for each supported recording source 
 			return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC |
 					SOUND_MASK_CD | SOUND_MASK_VOLUME |
-					SOUND_MASK_LINE1, (int *) arg);
+					SOUND_MASK_LINE1, (int __user *) argp);
 
 		case SOUND_MIXER_STEREODEVS:	// Mixer channels supporting stereo 
 			return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH |
 					SOUND_MASK_CD | SOUND_MASK_LINE |
 					SOUND_MASK_LINE1 | SOUND_MASK_MIC |
 					SOUND_MASK_VOLUME |
-					SOUND_MASK_RECLEV, (int *) arg);
+					SOUND_MASK_RECLEV, (int __user *)argp);
 
 		case SOUND_MIXER_CAPS:
-			return put_user(SOUND_CAP_EXCL_INPUT, (int *) arg);
+			return put_user(SOUND_CAP_EXCL_INPUT, (int __user *)argp);
 
 		default:
 			i = _IOC_NR(cmd);
 			if (i >= SOUND_MIXER_NRDEVICES
 			    || !(vidx = mixtable1[i]))
 				return -EINVAL;
-			return put_user(s->mix.vol[vidx - 1], (int *) arg);
+			return put_user(s->mix.vol[vidx - 1], (int __user *)argp);
 		}
 	}
 	// If ioctl doesn't have both the SIOC_READ and 
@@ -2339,7 +2339,7 @@
 	switch (_IOC_NR(cmd)) {
 
 	case SOUND_MIXER_RECSRC:	// Arg contains a bit for each recording source 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		i = hweight32(val);	// i = # bits on in val.
 		if (i != 1)	// One & only 1 bit must be on.
@@ -2356,7 +2356,7 @@
 		return 0;
 
 	case SOUND_MIXER_VOLUME:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
@@ -2391,10 +2391,10 @@
 #else
 		s->mix.vol[8] = val;
 #endif
-		return put_user(s->mix.vol[8], (int *) arg);
+		return put_user(s->mix.vol[8], (int __user *)argp);
 
 	case SOUND_MIXER_SPEAKER:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
@@ -2421,10 +2421,10 @@
 #else
 		s->mix.vol[6] = val;
 #endif
-		return put_user(s->mix.vol[6], (int *) arg);
+		return put_user(s->mix.vol[6], (int __user *)argp);
 
 	case SOUND_MIXER_RECLEV:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
@@ -2447,10 +2447,10 @@
 #else
 		s->mix.vol[7] = val;
 #endif
-		return put_user(s->mix.vol[7], (int *) arg);
+		return put_user(s->mix.vol[7], (int __user *)argp);
 
 	case SOUND_MIXER_MIC:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
@@ -2477,16 +2477,16 @@
 #else
 		s->mix.vol[5] = val;
 #endif
-		return put_user(s->mix.vol[5], (int *) arg);
+		return put_user(s->mix.vol[5], (int __user *)argp);
 
 
 	case SOUND_MIXER_SYNTH:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
 			l = 100;
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		r = (val >> 8) & 0xff;
 		if (r > 100)
@@ -2512,7 +2512,7 @@
 #else
 		s->mix.vol[4] = val;
 #endif
-		return put_user(s->mix.vol[4], (int *) arg);
+		return put_user(s->mix.vol[4], (int __user *)argp);
 
 
 	default:
@@ -2522,7 +2522,7 @@
 		i = _IOC_NR(cmd);
 		if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i]))
 			return -EINVAL;
-		if (get_user(val, (int *) arg))
+		if (get_user(val, (int __user *)argp))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
@@ -2558,7 +2558,7 @@
 			"write ac97 mixreg[%d]=0x%x mix.vol[]=0x%x\n", 
 				vidx-1,temp1,s->mix.vol[vidx-1]));
 #endif
-		return put_user(s->mix.vol[vidx - 1], (int *) arg);
+		return put_user(s->mix.vol[vidx - 1], (int __user *)argp);
 	}
 }
 
@@ -2817,7 +2817,7 @@
 // issues with 8 bit capture, so the driver always captures data in 16 bit
 // and then if the user requested 8 bit, converts from 16 to 8 bit.
 //
-static unsigned cs_copy_to_user(struct cs4281_state *s, void *dest,
+static unsigned cs_copy_to_user(struct cs4281_state *s, void __user *dest,
 				unsigned *hwsrc, unsigned cnt,
 				unsigned *copied)
 {
@@ -2859,7 +2859,7 @@
 
 // --------------------------------------------------------------------- 
 
-static ssize_t cs4281_read(struct file *file, char *buffer, size_t count,
+static ssize_t cs4281_read(struct file *file, char __user *buffer, size_t count,
 			   loff_t * ppos)
 {
 	struct cs4281_state *s =
@@ -2975,7 +2975,7 @@
 }
 
 
-static ssize_t cs4281_write(struct file *file, const char *buffer,
+static ssize_t cs4281_write(struct file *file, const char __user *buffer,
 			    size_t count, loff_t * ppos)
 {
 	struct cs4281_state *s =
@@ -3161,6 +3161,7 @@
 	audio_buf_info abinfo;
 	count_info cinfo;
 	int val, mapped, ret;
+	int __user *p = (int __user *)arg;
 
 	CS_DBGOUT(CS_FUNCTION, 4, printk(KERN_INFO
 		 "cs4281: cs4281_ioctl(): file=%p cmd=0x%.8x\n", file, cmd));
@@ -3175,7 +3176,7 @@
 		CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO
 			"cs4281: cs4281_ioctl(): SOUND_VERSION=0x%.8x\n",
 				 SOUND_VERSION));
-		return put_user(SOUND_VERSION, (int *) arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO
@@ -3192,7 +3193,7 @@
 	case SNDCTL_DSP_GETCAPS:
 		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME |
 				DSP_CAP_TRIGGER | DSP_CAP_MMAP,
-				(int *) arg);
+				p);
 
 	case SNDCTL_DSP_RESET:
 		CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO
@@ -3216,7 +3217,7 @@
 		return 0;
 
 	case SNDCTL_DSP_SPEED:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO
 			 "cs4281: cs4281_ioctl(): DSP_SPEED val=%d\n", val));
@@ -3257,10 +3258,10 @@
 		else if (file->f_mode & FMODE_READ)
 			val = s->prop_adc.rate;
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_STEREO:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO
 			 "cs4281: cs4281_ioctl(): DSP_STEREO val=%d\n", val));
@@ -3279,7 +3280,7 @@
 		return 0;
 
 	case SNDCTL_DSP_CHANNELS:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO
 			 "cs4281: cs4281_ioctl(): DSP_CHANNELS val=%d\n",
@@ -3310,7 +3311,7 @@
 		else if (file->f_mode & FMODE_READ)
 			val = s->prop_adc.channels;
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_GETFMTS:	// Returns a mask 
 		CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO
@@ -3318,10 +3319,10 @@
 				 AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 |
 				 AFMT_U8));
 		return put_user(AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 |
-				AFMT_U8, (int *) arg);
+				AFMT_U8, p);
 
 	case SNDCTL_DSP_SETFMT:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO
 			 "cs4281: cs4281_ioctl(): DSP_SETFMT val=0x%.8x\n",
@@ -3358,7 +3359,7 @@
 		CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(KERN_INFO
 		  "cs4281: cs4281_ioctl(): DSP_SETFMT return val=0x%.8x\n", 
 			val));
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_POST:
 		CS_DBGOUT(CS_IOCTL, 4, printk(KERN_INFO
@@ -3371,10 +3372,10 @@
 			val |= PCM_ENABLE_INPUT;
 		if (file->f_mode & s->ena & FMODE_WRITE)
 			val |= PCM_ENABLE_OUTPUT;
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			if (val & PCM_ENABLE_INPUT) {
@@ -3416,7 +3417,7 @@
 				abinfo.fragsize,abinfo.bytes,abinfo.fragstotal,
 				abinfo.fragments));
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *) arg, &abinfo,
+		return copy_to_user(p, &abinfo,
 				    sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
@@ -3440,7 +3441,7 @@
 			    abinfo.bytes >> s->dma_adc.fragshift;
 		}
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *) arg, &abinfo,
+		return copy_to_user(p, &abinfo,
 				    sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_NONBLOCK:
@@ -3456,7 +3457,7 @@
 		cs4281_update_ptr(s,CS_FALSE);
 		val = s->dma_dac.count;
 		spin_unlock_irqrestore(&s->lock, flags);
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -3489,7 +3490,7 @@
 		if (s->dma_adc.mapped)
 			s->dma_adc.count &= s->dma_adc.fragsize - 1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(p, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -3515,7 +3516,7 @@
 		if (s->dma_dac.mapped)
 			s->dma_dac.count &= s->dma_dac.fragsize - 1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(p, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -3523,18 +3524,17 @@
 		if (file->f_mode & FMODE_WRITE) {
 			if ((val = prog_dmabuf_dac(s)))
 				return val;
-			return put_user(s->dma_dac.fragsize, (int *) arg);
+			return put_user(s->dma_dac.fragsize, p);
 		}
 		if ((val = prog_dmabuf_adc(s)))
 			return val;
 		if (s->conversion)
-			return put_user(s->dma_adc.fragsize / 2,
-					(int *) arg);
+			return put_user(s->dma_adc.fragsize / 2, p);
 		else
-			return put_user(s->dma_adc.fragsize, (int *) arg);
+			return put_user(s->dma_adc.fragsize, p);
 
 	case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		return 0;	// Say OK, but do nothing.
 
@@ -3542,7 +3542,7 @@
 		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision)
 		    || (file->f_mode & FMODE_WRITE
 			&& s->dma_dac.subdivision)) return -EINVAL;
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -3554,15 +3554,15 @@
 
 	case SOUND_PCM_READ_RATE:
 		if (file->f_mode & FMODE_READ)
-			return put_user(s->prop_adc.rate, (int *) arg);
+			return put_user(s->prop_adc.rate, p);
 		else if (file->f_mode & FMODE_WRITE)
-			return put_user(s->prop_dac.rate, (int *) arg);
+			return put_user(s->prop_dac.rate, p);
 
 	case SOUND_PCM_READ_CHANNELS:
 		if (file->f_mode & FMODE_READ)
-			return put_user(s->prop_adc.channels, (int *) arg);
+			return put_user(s->prop_adc.channels, p);
 		else if (file->f_mode & FMODE_WRITE)
-			return put_user(s->prop_dac.channels, (int *) arg);
+			return put_user(s->prop_dac.channels, p);
 
 	case SOUND_PCM_READ_BITS:
 		if (file->f_mode & FMODE_READ)
@@ -3570,13 +3570,13 @@
 			    put_user(
 				     (s->prop_adc.
 				      fmt & (AFMT_S8 | AFMT_U8)) ? 8 : 16,
-				     (int *) arg);
+				     p);
 		else if (file->f_mode & FMODE_WRITE)
 			return
 			    put_user(
 				     (s->prop_dac.
 				      fmt & (AFMT_S8 | AFMT_U8)) ? 8 : 16,
-				     (int *) arg);
+				     p);
 
 	case SOUND_PCM_WRITE_FILTER:
 	case SNDCTL_DSP_SETSYNCRO:
@@ -3831,7 +3831,7 @@
 
 // --------------------------------------------------------------------- 
 
-static ssize_t cs4281_midi_read(struct file *file, char *buffer,
+static ssize_t cs4281_midi_read(struct file *file, char __user *buffer,
 				size_t count, loff_t * ppos)
 {
 	struct cs4281_state *s =
@@ -3879,7 +3879,7 @@
 }
 
 
-static ssize_t cs4281_midi_write(struct file *file, const char *buffer,
+static ssize_t cs4281_midi_write(struct file *file, const char __user *buffer,
 				 size_t count, loff_t * ppos)
 {
 	struct cs4281_state *s =
diff -Nru a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
--- a/sound/oss/cs46xx.c	Tue Jun 15 22:20:36 2004
+++ b/sound/oss/cs46xx.c	Tue Jun 15 22:20:36 2004
@@ -1717,7 +1717,7 @@
 
 /**********************************************************************/
 
-static ssize_t cs_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t cs_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
         struct cs_card *card = (struct cs_card *)file->private_data;
         ssize_t ret;
@@ -1762,7 +1762,7 @@
 }
 
 
-static ssize_t cs_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t cs_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
         struct cs_card *card = (struct cs_card *)file->private_data;
         ssize_t ret;
@@ -2037,7 +2037,7 @@
  */
 static unsigned cs_copy_to_user(
 	struct cs_state *s, 
-	void *dest, 
+	void __user *dest, 
 	void *hwsrc, 
 	unsigned cnt, 
 	unsigned *copied)
@@ -2046,8 +2046,8 @@
 	void *src = hwsrc;  /* default to the standard destination buffer addr */
 
 	CS_DBGOUT(CS_FUNCTION, 6, printk(KERN_INFO 
-		"cs_copy_to_user()+ fmt=0x%x cnt=%d dest=0x%.8x\n",
-		dmabuf->fmt,(unsigned)cnt,(unsigned)dest) );
+		"cs_copy_to_user()+ fmt=0x%x cnt=%d dest=%p\n",
+		dmabuf->fmt,(unsigned)cnt,dest) );
 
 	if(cnt > dmabuf->dmasize)
 	{
@@ -2074,8 +2074,8 @@
         if (copy_to_user(dest, src, cnt))
 	{
 		CS_DBGOUT(CS_FUNCTION, 2, printk(KERN_ERR 
-			"cs46xx: cs_copy_to_user()- fault dest=0x%x src=0x%x cnt=%d\n",
-				(unsigned)dest,(unsigned)src,cnt) );
+			"cs46xx: cs_copy_to_user()- fault dest=%p src=%p cnt=%d\n",
+				dest,src,cnt) );
 		*copied = 0;
 		return -EFAULT;
 	}
@@ -2087,7 +2087,7 @@
 
 /* in this loop, dmabuf.count signifies the amount of data that is waiting to be copied to
    the user's buffer.  it is filled by the dma machine and drained by this loop. */
-static ssize_t cs_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t cs_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct cs_card *card = (struct cs_card *) file->private_data;
 	struct cs_state *state;
@@ -2165,8 +2165,8 @@
 		CS_DBGOUT(CS_WAVE_READ, 2, printk(KERN_INFO 
 			"_read() copy_to cnt=%d count=%d ", cnt,count) );
 		CS_DBGOUT(CS_WAVE_READ, 8, printk(KERN_INFO 
-			" .dmasize=%d .count=%d buffer=0x%.8x ret=%d\n",
-			dmabuf->dmasize,dmabuf->count,(unsigned)buffer,ret) );
+			" .dmasize=%d .count=%d buffer=%p ret=%d\n",
+			dmabuf->dmasize,dmabuf->count,buffer,ret) );
 
                 if (cs_copy_to_user(state, buffer, 
 			(void *)((unsigned)dmabuf->rawbuf + swptr), cnt, &copied))
@@ -2196,7 +2196,7 @@
 
 /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to
    the soundcard.  it is drained by the dma machine and filled by this loop. */
-static ssize_t cs_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t cs_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct cs_card *card = (struct cs_card *) file->private_data;
 	struct cs_state *state;
@@ -2486,6 +2486,8 @@
 	audio_buf_info abinfo;
 	count_info cinfo;
 	int val, valsave, mapped, ret;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	state = (struct cs_state *)card->states[0];
 	if(state)
@@ -2507,7 +2509,7 @@
 	switch (cmd) 
 	{
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_RESET:
 		/* FIXME: spin_lock ? */
@@ -2550,7 +2552,7 @@
 		return 0;
 
 	case SNDCTL_DSP_SPEED: /* set sample rate */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			if (file->f_mode & FMODE_READ) {
@@ -2582,12 +2584,12 @@
 				file->f_mode & FMODE_WRITE ? "DAC" : "",
 				file->f_mode & FMODE_READ ? "ADC" : "",
 				dmabuf->rate ) );
-			return put_user(dmabuf->rate, (int *)arg);
+			return put_user(dmabuf->rate, p);
 		}
-		return put_user(0, (int *)arg);
+		return put_user(0, p);
 
 	case SNDCTL_DSP_STEREO: /* set stereo or mono channel */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_WRITE) {
 			state = (struct cs_state *)card->states[1];
@@ -2637,7 +2639,7 @@
 				dmabuf = &state->dmabuf;
 				if ((val = prog_dmabuf(state)))
 					return val;
-				return put_user(dmabuf->fragsize, (int *)arg);
+				return put_user(dmabuf->fragsize, p);
 			}
 		}
 		if (file->f_mode & FMODE_READ) {
@@ -2648,16 +2650,16 @@
 				if ((val = prog_dmabuf(state)))
 					return val;
 				return put_user(dmabuf->fragsize/dmabuf->divisor, 
-						(int *)arg);
+						p);
 			}
 		}
-		return put_user(0, (int *)arg);
+		return put_user(0, p);
 
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/
-		return put_user(AFMT_S16_LE | AFMT_U8, (int *)arg);
+		return put_user(AFMT_S16_LE | AFMT_U8, p);
 
 	case SNDCTL_DSP_SETFMT: /* Select sample format */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		CS_DBGOUT(CS_IOCTL | CS_PARMS, 4, printk(
 		    "cs46xx: cs_ioctl() DSP_SETFMT %s %s %s %s\n",
@@ -2730,14 +2732,14 @@
 		if(dmabuf)
 		{
 			if(dmabuf->fmt & CS_FMT_16BIT)
-				return put_user(AFMT_S16_LE, (int *)arg);
+				return put_user(AFMT_S16_LE, p);
 			else
-				return put_user(AFMT_U8, (int *)arg);
+				return put_user(AFMT_U8, p);
 		}
-		return put_user(0, (int *)arg);
+		return put_user(0, p);
 
 	case SNDCTL_DSP_CHANNELS:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			if (file->f_mode & FMODE_WRITE) {
@@ -2776,7 +2778,7 @@
 			}
 		}
 		return put_user((dmabuf->fmt & CS_FMT_STEREO) ? 2 : 1,
-				(int *)arg);
+				p);
 
 	case SNDCTL_DSP_POST:
 		/*
@@ -2793,7 +2795,7 @@
 				dmabuf = &state->dmabuf;
 				if (dmabuf->subdivision)
 					return -EINVAL;
-				if (get_user(val, (int *)arg))
+				if (get_user(val, p))
 					return -EFAULT;
 				if (val != 1 && val != 2)
 					return -EINVAL;
@@ -2807,7 +2809,7 @@
 				dmabuf = &state->dmabuf;
 				if (dmabuf->subdivision)
 					return -EINVAL;
-				if (get_user(val, (int *)arg))
+				if (get_user(val, p))
 					return -EFAULT;
 				if (val != 1 && val != 2)
 					return -EINVAL;
@@ -2817,7 +2819,7 @@
 		return 0;
 
 	case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		if (file->f_mode & FMODE_WRITE) {
@@ -2861,7 +2863,7 @@
 
 			abinfo.fragments = abinfo.bytes >> dmabuf->fragshift;
 			spin_unlock_irqrestore(&state->card->lock, flags);
-			return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+			return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 		}
 		return -ENODEV;
 
@@ -2879,7 +2881,7 @@
 			abinfo.fragstotal = dmabuf->numfrag;
 			abinfo.fragments = abinfo.bytes >> dmabuf->fragshift;
 			spin_unlock_irqrestore(&state->card->lock, flags);
-			return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+			return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 		}
 		return -ENODEV;
 
@@ -2889,7 +2891,7 @@
 
 	case SNDCTL_DSP_GETCAPS:
 		return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP,
-			    (int *)arg);
+			    p);
 
 	case SNDCTL_DSP_GETTRIGGER:
 		val = 0;
@@ -2915,10 +2917,10 @@
 			}
 		}
 		CS_DBGOUT(CS_IOCTL, 2, printk("cs46xx: DSP_GETTRIGGER()- val=0x%x\n",val) );
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			state = (struct cs_state *)card->states[0];
@@ -2961,7 +2963,7 @@
 			cinfo.blocks = dmabuf->count/dmabuf->divisor >> dmabuf->fragshift;
 			cinfo.ptr = dmabuf->hwptr/dmabuf->divisor;
 			spin_unlock_irqrestore(&state->card->lock, flags);
-			if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+			if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 				return -EFAULT;
 			return 0;
 		}
@@ -2996,7 +2998,7 @@
 			    "cs46xx: GETOPTR bytes=%d blocks=%d ptr=%d\n",
 				cinfo.bytes,cinfo.blocks,cinfo.ptr) );
 			spin_unlock_irqrestore(&state->card->lock, flags);
-			if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+			if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 				return -EFAULT;
 			return 0;
 		}
@@ -3019,7 +3021,7 @@
 		}
 		else
 			val = 0;
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SOUND_PCM_READ_RATE:
 		if(file->f_mode & FMODE_READ)
@@ -3029,9 +3031,9 @@
 		if(state)
 		{
 			dmabuf = &state->dmabuf;
-			return put_user(dmabuf->rate, (int *)arg);
+			return put_user(dmabuf->rate, p);
 		}
-		return put_user(0, (int *)arg);
+		return put_user(0, p);
 		
 
 	case SOUND_PCM_READ_CHANNELS:
@@ -3043,9 +3045,9 @@
 		{
 			dmabuf = &state->dmabuf;
 			return put_user((dmabuf->fmt & CS_FMT_STEREO) ? 2 : 1,
-				(int *)arg);
+				p);
 		}
-		return put_user(0, (int *)arg);
+		return put_user(0, p);
 
 	case SOUND_PCM_READ_BITS:
 		if(file->f_mode & FMODE_READ)
@@ -3056,10 +3058,10 @@
 		{
 			dmabuf = &state->dmabuf;
 			return put_user((dmabuf->fmt & CS_FMT_16BIT) ? 
-			  	AFMT_S16_LE : AFMT_U8, (int *)arg);
+			  	AFMT_S16_LE : AFMT_U8, p);
 
 		}
-		return put_user(0, (int *)arg);
+		return put_user(0, p);
 
 	case SNDCTL_DSP_MAPINBUF:
 	case SNDCTL_DSP_MAPOUTBUF:
@@ -4164,6 +4166,7 @@
 	struct ac97_codec *codec = (struct ac97_codec *)file->private_data;
 	struct cs_card *card=NULL;
 	struct list_head *entry;
+	unsigned long __user *p = (long __user *)arg;
 
 #if CSDEBUG_INTERFACE
         int val;
@@ -4178,25 +4181,25 @@
 	    {
 
 		case SOUND_MIXER_CS_GETDBGMASK:
-			return put_user(cs_debugmask, (unsigned long *)arg);
+			return put_user(cs_debugmask, p);
 		
 		case SOUND_MIXER_CS_GETDBGLEVEL:
-			return put_user(cs_debuglevel, (unsigned long *)arg);
+			return put_user(cs_debuglevel, p);
 
 		case SOUND_MIXER_CS_SETDBGMASK:
-			if (get_user(val, (unsigned long *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			cs_debugmask = val;
 			return 0;
 
 		case SOUND_MIXER_CS_SETDBGLEVEL:
-			if (get_user(val, (unsigned long *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			cs_debuglevel = val;
 			return 0;
 
 		case SOUND_MIXER_CS_APM:
-			if (get_user(val, (unsigned long *) arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if(val == CS_IOCTL_CMD_SUSPEND) 
 			{
diff -Nru a/sound/oss/dev_table.h b/sound/oss/dev_table.h
--- a/sound/oss/dev_table.h	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/dev_table.h	Tue Jun 15 22:20:43 2004
@@ -156,7 +156,7 @@
 	struct module *owner;
 	int (*open) (void *devc, int sub_device);
 	void (*close) (void *devc, int sub_device);
-	int (*ioctl) (void *devc, unsigned int cmd, caddr_t arg, int local);
+	int (*ioctl) (void *devc, unsigned int cmd, void __user * arg, int local);
 	void (*reset) (void *devc);
 
 	void *devc;		/* Driver specific info */
@@ -171,14 +171,14 @@
 			      int count, int intrflag);
 	void (*start_input) (int dev, unsigned long buf, 
 			     int count, int intrflag);
-	int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
+	int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
 	int (*prepare_for_input) (int dev, int bufsize, int nbufs);
 	int (*prepare_for_output) (int dev, int bufsize, int nbufs);
 	void (*halt_io) (int dev);
 	int (*local_qlen)(int dev);
 	void (*copy_user) (int dev,
 			char *localbuf, int localoffs,
-                        const char *userbuf, int useroffs,
+                        const char __user *userbuf, int useroffs,
                         int max_in, int max_out,
                         int *used, int *returned,
                         int len);
@@ -247,7 +247,7 @@
 	struct module *owner;
 	char id[16];
 	char name[64];
-	int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
+	int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
 	
 	void *devc;
 	int modify_counter;
@@ -264,13 +264,13 @@
 
 	int (*open) (int dev, int mode);
 	void (*close) (int dev);
-	int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
+	int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
 	int (*kill_note) (int dev, int voice, int note, int velocity);
 	int (*start_note) (int dev, int voice, int note, int velocity);
 	int (*set_instr) (int dev, int voice, int instr);
 	void (*reset) (int dev);
 	void (*hw_control) (int dev, unsigned char *event);
-	int (*load_patch) (int dev, int format, const char *addr,
+	int (*load_patch) (int dev, int format, const char __user *addr,
 	     int offs, int count, int pmgr_flag);
 	void (*aftertouch) (int dev, int voice, int pressure);
 	void (*controller) (int dev, int voice, int ctrl_num, int value);
@@ -317,7 +317,7 @@
 		void (*outputintr)(int dev)
 		);
 	void (*close) (int dev);
-	int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
+	int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
 	int (*outputc) (int dev, unsigned char data);
 	int (*start_read) (int dev);
 	int (*end_read) (int dev);
@@ -348,7 +348,7 @@
 	void (*close)(int dev);
 	int (*event)(int dev, unsigned char *ev);
 	unsigned long (*get_time)(int dev);
-	int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
+	int (*ioctl) (int dev, unsigned int cmd, void __user * arg);
 	void (*arm_timer)(int dev, long time);
 };
 
diff -Nru a/sound/oss/dmabuf.c b/sound/oss/dmabuf.c
--- a/sound/oss/dmabuf.c	Tue Jun 15 22:20:36 2004
+++ b/sound/oss/dmabuf.c	Tue Jun 15 22:20:36 2004
@@ -236,7 +236,7 @@
 	mm_segment_t fs = get_fs();
 
 	set_fs(get_ds());
-	audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_SETFMT, (caddr_t)&bits);
+	audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_SETFMT, (void __user *)&bits);
 	set_fs(fs);
 	return bits;
 }
@@ -246,7 +246,7 @@
 	mm_segment_t fs = get_fs();
 
 	set_fs(get_ds());
-	audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_SPEED, (caddr_t)&speed);
+	audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_SPEED, (void __user *)&speed);
 	set_fs(fs);
 	return speed;
 }
@@ -257,7 +257,7 @@
 	mm_segment_t fs = get_fs();
 
 	set_fs(get_ds());
-	audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_CHANNELS, (caddr_t)&c);
+	audio_devs[dev]->d->ioctl(dev, SNDCTL_DSP_CHANNELS, (void __user *)&c);
 	set_fs(fs);
 	return c;
 }
diff -Nru a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c
--- a/sound/oss/dmasound/dac3550a.c	Tue Jun 15 22:20:38 2004
+++ b/sound/oss/dmasound/dac3550a.c	Tue Jun 15 22:20:38 2004
@@ -9,6 +9,7 @@
 
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
 #include <linux/proc_fs.h>
 #include <linux/ioport.h>
 #include <linux/sysctl.h>
@@ -97,14 +98,14 @@
 	/* Do a short sleep, just to make sure I2C bus is awake and paying
 	 * attention to us
 	 */
-	wait_ms(20);
+	msleep(20);
 	/* Write the sample rate reg the value it needs */
 	i2c_smbus_write_byte_data(daca_client, 1, 8);
 	daca_set_volume(cur_left_vol >> 5, cur_right_vol >> 5);
 	/* Another short delay, just to make sure the other I2C bus writes
 	 * have taken...
 	 */
-	wait_ms(20);
+	msleep(20);
 	/* Write the global config reg - invert right power amp,
 	 * DAC on, use 5-volt mode */
 	i2c_smbus_write_byte_data(daca_client, 3, 0x45);
diff -Nru a/sound/oss/dmasound/dmasound.h b/sound/oss/dmasound/dmasound.h
--- a/sound/oss/dmasound/dmasound.h	Tue Jun 15 22:21:05 2004
+++ b/sound/oss/dmasound/dmasound.h	Tue Jun 15 22:21:05 2004
@@ -267,12 +267,6 @@
 */
 #define BS_VAL 1
 
-static inline void wait_ms(unsigned int ms)
-{
-	current->state = TASK_UNINTERRUPTIBLE;
-	schedule_timeout(1 + ms * HZ / 1000);
-}
-
 #define SW_INPUT_VOLUME_SCALE	4
 #define SW_INPUT_VOLUME_DEFAULT	(128 / SW_INPUT_VOLUME_SCALE)
 
diff -Nru a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
--- a/sound/oss/dmasound/dmasound_awacs.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/dmasound/dmasound_awacs.c	Tue Jun 15 22:20:39 2004
@@ -457,9 +457,9 @@
 			&gpio_headphone_detect_pol);
 
 	write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
-	wait_ms(100);
+	msleep(100);
 	write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
-	wait_ms(100);
+	msleep(100);
   	if (gpio_headphone_irq) {
 		if (request_irq(gpio_headphone_irq,headphone_intr,0,"Headphone detect",0) < 0) {
     			printk(KERN_ERR "tumbler: Can't request headphone interrupt\n");
@@ -653,7 +653,7 @@
 	    machine_is_compatible("PowerBook3,2")) && awacs) {
 		awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1;
 		awacs_write(MASK_ADDR1 | awacs_reg[1]);
-		wait_ms(200);
+		msleep(200);
 	}
 	if (awacs)
 		free_irq(awacs_irq, 0);
@@ -775,10 +775,10 @@
 	/* Sorry for the horrible delays... I hope to get that improved
 	 * by making the whole PM process asynchronous in a future version
 	 */
-	wait_ms(750);
+	msleep(750);
 	awacs_reg[1] |= MASK_CMUTE | MASK_AMUTE;
 	awacs_write(awacs_reg[1] | MASK_RECALIBRATE | MASK_ADDR1);
-	wait_ms(1000);
+	msleep(1000);
 	awacs_write(awacs_reg[1] | MASK_ADDR1);
 }
 
@@ -1405,9 +1405,9 @@
 
 	if (awacs_revision == AWACS_SCREAMER) {
 		awacs_write(awacs_reg[5] + MASK_ADDR5);
-		wait_ms(100);
+		msleep(100);
 		awacs_write(awacs_reg[6] + MASK_ADDR6);
-		wait_ms(2);
+		msleep(2);
 		awacs_write(awacs_reg[1] + MASK_ADDR1);
 		awacs_write(awacs_reg[7] + MASK_ADDR7);
 	}
@@ -1479,7 +1479,7 @@
 		    machine_is_compatible("PowerBook3,2")) && awacs) {
 			awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1;
 			awacs_write(MASK_ADDR1 | awacs_reg[1]);
-			wait_ms(200);
+			msleep(200);
 		}
 		break;
 	case PBOOK_WAKE:
@@ -1487,12 +1487,12 @@
 		pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, awacs_node, 0, 1);
 		if ((machine_is_compatible("PowerBook3,1") ||
 		    machine_is_compatible("PowerBook3,2")) && awacs) {
-			wait_ms(100);
+			msleep(100);
 			awacs_reg[1] &= ~(MASK_PAROUT0 | MASK_PAROUT1);
 			awacs_write(MASK_ADDR1 | awacs_reg[1]);
-			wait_ms(300);
+			msleep(300);
 		} else
-			wait_ms(1000);
+			msleep(1000);
  		/* restore settings */
 		switch (awacs_revision) {
 			case AWACS_TUMBLER:
@@ -1500,14 +1500,14 @@
 				write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol);
 				write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol);
 				write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
-				wait_ms(100);
+				msleep(100);
 				write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
-				wait_ms(150);
+				msleep(150);
 				tas_leave_sleep(); /* Stub for now */
 				headphone_intr(0,0,0);
 				break;
 			case AWACS_DACA:
-				wait_ms(10); /* Check this !!! */
+				msleep(10); /* Check this !!! */
 				daca_leave_sleep();
 				break ;		/* dont know how yet */
 			case AWACS_BURGUNDY:
@@ -2432,7 +2432,7 @@
 	 * release the memory.
 	 */
 
-	wait_ms(100) ; /* give it a (small) chance to act */
+	msleep(100) ; /* give it a (small) chance to act */
 
 	/* apply the sledgehammer approach - just stop it now */
 
diff -Nru a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c
--- a/sound/oss/emu10k1/audio.c	Tue Jun 15 22:20:37 2004
+++ b/sound/oss/emu10k1/audio.c	Tue Jun 15 22:20:37 2004
@@ -50,7 +50,7 @@
 static void calculate_ifrag(struct wiinst *);
 
 /* Audio file operations */
-static ssize_t emu10k1_audio_read(struct file *file, char *buffer, size_t count, loff_t * ppos)
+static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
 {
 	struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data;
 	struct wiinst *wiinst = wave_dev->wiinst;
@@ -112,7 +112,7 @@
 		    || (bytestocopy >= count)) {
 			bytestocopy = min_t(u32, bytestocopy, count);
 
-			emu10k1_wavein_xferdata(wiinst, (u8 *) buffer, &bytestocopy);
+			emu10k1_wavein_xferdata(wiinst, (u8 __user *)buffer, &bytestocopy);
 
 			count -= bytestocopy;
 			buffer += bytestocopy;
@@ -137,7 +137,7 @@
 	return ret;
 }
 
-static ssize_t emu10k1_audio_write(struct file *file, const char *buffer, size_t count, loff_t * ppos)
+static ssize_t emu10k1_audio_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos)
 {
 	struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data;
 	struct woinst *woinst = wave_dev->woinst;
@@ -212,7 +212,7 @@
 
 			bytestocopy = min_t(u32, bytestocopy, count);
 
-			emu10k1_waveout_xferdata(woinst, (u8 *) buffer, &bytestocopy);
+			emu10k1_waveout_xferdata(woinst, (u8 __user *) buffer, &bytestocopy);
 
 			count -= bytestocopy;
 			buffer += bytestocopy * woinst->num_voices;
@@ -254,6 +254,7 @@
 	int val = 0;
 	u32 bytestocopy;
 	unsigned long flags;
+	int __user *p = (int __user *)arg;
 
 	DPF(4, "emu10k1_audio_ioctl()\n");
 
@@ -266,7 +267,7 @@
 	switch (cmd) {
 	case OSS_GETVERSION:
 		DPF(2, "OSS_GETVERSION:\n");
-		return put_user(SOUND_VERSION, (int *) arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_RESET:
 		DPF(2, "SNDCTL_DSP_RESET:\n");
@@ -352,11 +353,11 @@
 		DPF(2, "SNDCTL_DSP_GETCAPS:\n");
 		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME |
 				DSP_CAP_TRIGGER | DSP_CAP_MMAP |
-				DSP_CAP_COPROC| DSP_CAP_MULTI, (int *) arg);
+				DSP_CAP_COPROC| DSP_CAP_MULTI, p);
 	case SNDCTL_DSP_SPEED:
 		DPF(2, "SNDCTL_DSP_SPEED:\n");
 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		DPD(2, "val is %d\n", val);
@@ -402,21 +403,21 @@
 				DPD(2, "set playback sampling rate -> %d\n", val);
 			}
 
-			return put_user(val, (int *) arg);
+			return put_user(val, p);
 		} else {
 			if (file->f_mode & FMODE_READ)
 				val = wiinst->format.samplingrate;
 			else if (file->f_mode & FMODE_WRITE)
 				val = woinst->format.samplingrate;
 
-			return put_user(val, (int *) arg);
+			return put_user(val, p);
 		}
 		break;
 
 	case SNDCTL_DSP_STEREO:
 		DPF(2, "SNDCTL_DSP_STEREO:\n");
 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		DPD(2, " val is %d\n", val);
@@ -460,14 +461,14 @@
 			DPD(2, "set playback stereo -> %d\n", val);
 		}
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 		break;
 
 	case SNDCTL_DSP_CHANNELS:
 		DPF(2, "SNDCTL_DSP_CHANNELS:\n");
 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		DPD(2, " val is %d\n", val);
@@ -510,14 +511,14 @@
 				DPD(2, "set playback number of channels -> %d\n", val);
 			}
 
-			return put_user(val, (int *) arg);
+			return put_user(val, p);
 		} else {
 			if (file->f_mode & FMODE_READ)
 				val = wiinst->format.channels;
 			else if (file->f_mode & FMODE_WRITE)
 				val = woinst->format.channels;
 
-			return put_user(val, (int *) arg);
+			return put_user(val, p);
 		}
 		break;
 
@@ -533,12 +534,12 @@
 						     wave_dev->card->pt.enable_gpr_name) >= 0)
 				val |= AFMT_AC3;
 		}
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_SETFMT:	/* Same as SNDCTL_DSP_SAMPLESIZE */
 		DPF(2, "SNDCTL_DSP_SETFMT:\n");
 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		DPD(2, " val is %d\n", val);
@@ -582,14 +583,14 @@
 				DPD(2, "set playback format -> %d\n", val);
 			}
 
-			return put_user(val, (int *) arg);
+			return put_user(val, p);
 		} else {
 			if (file->f_mode & FMODE_READ)
 				val = wiinst->format.id;
 			else if (file->f_mode & FMODE_WRITE)
 				val = woinst->format.id;
 
-			return put_user(val, (int *) arg);
+			return put_user(val, p);
 		}
 		break;
 
@@ -600,7 +601,7 @@
 		else if (file->f_mode & FMODE_WRITE)
 			val = woinst->format.bitsperchannel;
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SOUND_PCM_READ_RATE:
 
@@ -609,7 +610,7 @@
 		else if (file->f_mode & FMODE_WRITE)
 			val = woinst->format.samplingrate;
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SOUND_PCM_READ_CHANNELS:
 
@@ -618,7 +619,7 @@
 		else if (file->f_mode & FMODE_WRITE)
 			val = woinst->format.channels;
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SOUND_PCM_WRITE_FILTER:
 		DPF(2, "SOUND_PCM_WRITE_FILTER: not implemented\n");
@@ -641,12 +642,12 @@
 		if (file->f_mode & FMODE_READ && (wave_dev->enablebits & PCM_ENABLE_INPUT))
 			val |= PCM_ENABLE_INPUT;
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_SETTRIGGER:
 		DPF(2, "SNDCTL_DSP_SETTRIGGER:\n");
 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		if (file->f_mode & FMODE_WRITE) {
@@ -708,7 +709,7 @@
 			info.fragstotal = woinst->buffer.numfrags * woinst->num_voices;
 			info.fragments = info.bytes / info.fragsize;
 
-			if (copy_to_user((int *) arg, &info, sizeof(info)))
+			if (copy_to_user(p, &info, sizeof(info)))
 				return -EFAULT;
 		}
 		break;
@@ -737,7 +738,7 @@
 			info.fragments = info.bytes / wiinst->buffer.fragment_size;
 			info.fragsize = wiinst->buffer.fragment_size;
 
-			if (copy_to_user((int *) arg, &info, sizeof(info)))
+			if (copy_to_user(p, &info, sizeof(info)))
 				return -EFAULT;
 		}
 		break;
@@ -765,7 +766,7 @@
 		val *= woinst->num_voices;
 		spin_unlock_irqrestore(&woinst->lock, flags);
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_GETIPTR:
 		{
@@ -795,7 +796,7 @@
 
 			spin_unlock_irqrestore(&wiinst->lock, flags);
 
-			if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo)))
+			if (copy_to_user(p, &cinfo, sizeof(cinfo)))
 				return -EFAULT;
 		}
 		break;
@@ -841,7 +842,7 @@
 
 			spin_unlock_irqrestore(&woinst->lock, flags);
 
-			if (copy_to_user((void *) arg, &cinfo, sizeof(cinfo)))
+			if (copy_to_user(p, &cinfo, sizeof(cinfo)))
 				return -EFAULT;
 		}
 		break;
@@ -867,7 +868,7 @@
 			spin_unlock_irqrestore(&wiinst->lock, flags);
 		}
 
-		return put_user(val, (int *) arg);
+		return put_user(val, p);
 
 		break;
 
@@ -892,7 +893,7 @@
 	case SNDCTL_DSP_SETFRAGMENT:
 		DPF(2, "SNDCTL_DSP_SETFRAGMENT:\n");
 
-		if (get_user(val, (int *) arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		DPD(2, "val is %#x\n", val);
@@ -930,7 +931,7 @@
 			if (!buf)
 				return -ENOMEM;
 
-			if (copy_from_user(buf, (copr_buffer *) arg, sizeof(copr_buffer))) {
+			if (copy_from_user(buf, p, sizeof(copr_buffer))) {
 				kfree (buf);
 				return -EFAULT;
 			}
@@ -969,7 +970,7 @@
 				for (i = 0; i < buf->len; i++)
 					((u32 *) buf->data)[i] = sblive_readptr(wave_dev->card, buf->offs + i, buf->flags);
 
-				if (copy_to_user((copr_buffer *) arg, buf, sizeof(copr_buffer))) {
+				if (copy_to_user(p, buf, sizeof(copr_buffer))) {
 					kfree(buf);
 					return -EFAULT;
 				}
diff -Nru a/sound/oss/emu10k1/cardwi.c b/sound/oss/emu10k1/cardwi.c
--- a/sound/oss/emu10k1/cardwi.c	Tue Jun 15 22:20:42 2004
+++ b/sound/oss/emu10k1/cardwi.c	Tue Jun 15 22:20:42 2004
@@ -304,7 +304,7 @@
 	}
 }
 
-static void copy_block(u8 *dst, u8 * src, u32 str, u32 len, u8 cov)
+static void copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov)
 {
 	if (cov == 1)
 		__copy_to_user(dst, src + str, len);
@@ -321,7 +321,7 @@
 	}
 }
 
-void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 * data, u32 * size)
+void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size)
 {
 	struct wavein_buffer *buffer = &wiinst->buffer;
 	u32 sizetocopy, sizetocopy_now, start;
diff -Nru a/sound/oss/emu10k1/cardwi.h b/sound/oss/emu10k1/cardwi.h
--- a/sound/oss/emu10k1/cardwi.h	Tue Jun 15 22:21:02 2004
+++ b/sound/oss/emu10k1/cardwi.h	Tue Jun 15 22:21:02 2004
@@ -83,7 +83,7 @@
 void emu10k1_wavein_start(struct emu10k1_wavedevice *);
 void emu10k1_wavein_stop(struct emu10k1_wavedevice *);
 void emu10k1_wavein_getxfersize(struct wiinst *, u32 *);
-void emu10k1_wavein_xferdata(struct wiinst *, u8 *, u32 *);
+void emu10k1_wavein_xferdata(struct wiinst *, u8 __user *, u32 *);
 int emu10k1_wavein_setformat(struct emu10k1_wavedevice *, struct wave_format *);
 void emu10k1_wavein_update(struct emu10k1_card *, struct wiinst *);
 
diff -Nru a/sound/oss/emu10k1/cardwo.c b/sound/oss/emu10k1/cardwo.c
--- a/sound/oss/emu10k1/cardwo.c	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/emu10k1/cardwo.c	Tue Jun 15 22:20:43 2004
@@ -417,7 +417,7 @@
  * Notice that the voice buffer is actually a set of disjointed memory pages.
  *
  */
-static void copy_block(void **dst, u32 str, u8 *src, u32 len)
+static void copy_block(void **dst, u32 str, u8 __user *src, u32 len)
 {
 	unsigned int pg;
 	unsigned int pgoff;
@@ -451,7 +451,7 @@
  * Notice that the voice buffer is actually a set of disjointed memory pages.
  *
  */
-static void copy_ilv_block(struct woinst *woinst, u32 str, u8 *src, u32 len) 
+static void copy_ilv_block(struct woinst *woinst, u32 str, u8 __user *src, u32 len) 
 {
         unsigned int pg;
 	unsigned int pgoff;
@@ -524,7 +524,7 @@
  * previously added to the buffer are overwritten.
  *
  */
-void emu10k1_waveout_xferdata(struct woinst *woinst, u8 *data, u32 *size)
+void emu10k1_waveout_xferdata(struct woinst *woinst, u8 __user *data, u32 *size)
 {
 	struct waveout_buffer *buffer = &woinst->buffer;
 	struct voice_mem *mem = &woinst->voice[0].mem;
diff -Nru a/sound/oss/emu10k1/cardwo.h b/sound/oss/emu10k1/cardwo.h
--- a/sound/oss/emu10k1/cardwo.h	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/emu10k1/cardwo.h	Tue Jun 15 22:20:43 2004
@@ -82,7 +82,7 @@
 void emu10k1_waveout_start(struct emu10k1_wavedevice *);
 void emu10k1_waveout_stop(struct emu10k1_wavedevice *);
 void emu10k1_waveout_getxfersize(struct woinst*, u32 *);
-void emu10k1_waveout_xferdata(struct woinst*, u8*, u32 *);
+void emu10k1_waveout_xferdata(struct woinst*, u8 __user *, u32 *);
 void emu10k1_waveout_fillsilence(struct woinst*);
 int emu10k1_waveout_setformat(struct emu10k1_wavedevice*, struct wave_format*);
 void emu10k1_waveout_update(struct woinst*);
diff -Nru a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c
--- a/sound/oss/emu10k1/midi.c	Tue Jun 15 22:21:05 2004
+++ b/sound/oss/emu10k1/midi.c	Tue Jun 15 22:21:05 2004
@@ -244,7 +244,7 @@
 	return 0;
 }
 
-static ssize_t emu10k1_midi_read(struct file *file, char *buffer, size_t count, loff_t * pos)
+static ssize_t emu10k1_midi_read(struct file *file, char __user *buffer, size_t count, loff_t * pos)
 {
 	struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data;
 	ssize_t ret = 0;
@@ -319,7 +319,7 @@
 	return ret;
 }
 
-static ssize_t emu10k1_midi_write(struct file *file, const char *buffer, size_t count, loff_t * pos)
+static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t * pos)
 {
 	struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data;
 	struct midi_hdr *midihdr;
diff -Nru a/sound/oss/emu10k1/mixer.c b/sound/oss/emu10k1/mixer.c
--- a/sound/oss/emu10k1/mixer.c	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/emu10k1/mixer.c	Tue Jun 15 22:20:43 2004
@@ -188,6 +188,7 @@
 	u32 size, page;
 	int addr, size_reg, i, ret;
 	unsigned int id, ch;
+	void __user *argp = (void __user *)arg;
 
 	switch (cmd) {
 
@@ -197,7 +198,7 @@
 		if (ctl == NULL)
 			return -ENOMEM;
 
-		if (copy_from_user(ctl, (void *) arg, sizeof(struct mixer_private_ioctl))) {
+		if (copy_from_user(ctl, argp, sizeof(struct mixer_private_ioctl))) {
 			kfree(ctl);
 			return -EFAULT;
 		}
@@ -228,7 +229,7 @@
 		case CMD_READFN0:
 			ctl->val[2] = emu10k1_readfn0(card, ctl->val[0]);
 
-			if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl)))
+			if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl)))
 				ret = -EFAULT;
 
 			break;
@@ -244,7 +245,7 @@
 
 			ctl->val[2] = sblive_readptr(card, ctl->val[0], ctl->val[1]);
 
-			if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl)))
+			if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl)))
 				ret = -EFAULT;
 
 			break;
@@ -282,7 +283,7 @@
 		case CMD_GETRECSRC:
 			ctl->val[0] = card->wavein.recsrc;
 			ctl->val[1] = card->wavein.fxwc;
-			if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl)))
+			if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl)))
 				ret = -EFAULT;
 
 			break;
@@ -297,7 +298,7 @@
 			ctl->val[4] = card->waveout.send_routing[2];
 			ctl->val[5] = card->waveout.send_dcba[2];
 
-			if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl)))
+			if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl)))
 				ret = -EFAULT;
 
 			break;
@@ -320,7 +321,7 @@
 		
 		case CMD_GETPATCH:
 			if (ctl->val[0] == 0) {
-				if (copy_to_user((void *) arg, &card->mgr.rpatch, sizeof(struct dsp_rpatch)))
+				if (copy_to_user(argp, &card->mgr.rpatch, sizeof(struct dsp_rpatch)))
                                 	ret = -EFAULT;
 			} else {
 				if ((ctl->val[0] - 1) / PATCHES_PER_PAGE >= card->mgr.current_pages) {
@@ -328,7 +329,7 @@
 					break;
 				}
 
-				if (copy_to_user((void *) arg, PATCH(&card->mgr, ctl->val[0] - 1), sizeof(struct dsp_patch)))
+				if (copy_to_user(argp, PATCH(&card->mgr, ctl->val[0] - 1), sizeof(struct dsp_patch)))
 					ret = -EFAULT;
 			}
 
@@ -342,7 +343,7 @@
 				break;
 			}
 
-			if (copy_to_user((void *) arg, &card->mgr.gpr[id], sizeof(struct dsp_gpr)))
+			if (copy_to_user(argp, &card->mgr.gpr[id], sizeof(struct dsp_gpr)))
 				ret = -EFAULT;
 
 			break;
@@ -351,7 +352,7 @@
 			addr = emu10k1_find_control_gpr(&card->mgr, (char *) ctl->val, &((char *) ctl->val)[PATCH_NAME_SIZE]);
 			ctl->val[0] = sblive_readptr(card, addr, 0);
 
-			if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl)))
+			if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl)))
 				ret = -EFAULT;
 
 			break;
@@ -430,7 +431,7 @@
 
 			ctl->val[2] = card->mgr.ctrl_gpr[id][ch];
 
-			if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl)))
+			if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl)))
 				ret = -EFAULT;
 
 			break;
@@ -496,7 +497,7 @@
 			if (card->is_audigy)
 				ctl->val[4]=emu10k1_readfn0(card, 0x18);
 
-			if (copy_to_user((void *) arg, ctl, sizeof(struct mixer_private_ioctl)))
+			if (copy_to_user(argp, ctl, sizeof(struct mixer_private_ioctl)))
 				ret = -EFAULT;
 			break;
 
@@ -517,7 +518,7 @@
 
 	case SOUND_MIXER_PRIVATE4:
 
-		if (copy_from_user(&size, (void *) arg, sizeof(size)))
+		if (copy_from_user(&size, argp, sizeof(size)))
 			return -EFAULT;
 
 		DPD(2, "External tram size %#x\n", size);
@@ -581,7 +582,7 @@
 
 	card->ac97->modcnt++;
 
-	if (get_user(val, (int *)arg))
+	if (get_user(val, (int __user *)arg))
 		return -EFAULT;
 
 	/* cleanse input a little */
@@ -634,7 +635,7 @@
 				
 			info.modify_counter = card->ac97->modcnt;
 
-			if (copy_to_user((void *)arg, &info, sizeof(info)))
+			if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 				return -EFAULT;
 
 			return 0;
diff -Nru a/sound/oss/emu10k1/passthrough.c b/sound/oss/emu10k1/passthrough.c
--- a/sound/oss/emu10k1/passthrough.c	Tue Jun 15 22:20:40 2004
+++ b/sound/oss/emu10k1/passthrough.c	Tue Jun 15 22:20:40 2004
@@ -131,7 +131,7 @@
 	return 0;
 }
 
-ssize_t emu10k1_pt_write(struct file *file, const char *buffer, size_t count)
+ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t count)
 {
 	struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data;
 	struct emu10k1_card *card = wave_dev->card;
@@ -177,10 +177,9 @@
 	blocks = (count-bytes_copied)/PT_BLOCKSIZE;
 	blocks_copied = 0;
 	while (blocks > 0) {
-		u16 *bufptr = (u16 *) buffer + (bytes_copied/2);
+		u16 __user *bufptr = (u16 __user *) buffer + (bytes_copied/2);
 		copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE);
-		bufptr = (u16 *) pt->buf;
-		r = pt_putblock(wave_dev, bufptr, nonblock);
+		r = pt_putblock(wave_dev, (u16 *)pt->buf, nonblock);
 		if (r) {
 			if (bytes_copied)
 				return bytes_copied;
diff -Nru a/sound/oss/emu10k1/passthrough.h b/sound/oss/emu10k1/passthrough.h
--- a/sound/oss/emu10k1/passthrough.h	Tue Jun 15 22:20:40 2004
+++ b/sound/oss/emu10k1/passthrough.h	Tue Jun 15 22:20:40 2004
@@ -90,7 +90,7 @@
 #define USE_PT_METHOD2  (card->is_audigy)
 #define USE_PT_METHOD1	!USE_PT_METHOD2
 
-ssize_t emu10k1_pt_write(struct file *file, const char *buf, size_t count);
+ssize_t emu10k1_pt_write(struct file *file, const char __user *buf, size_t count);
 
 int emu10k1_pt_setup(struct emu10k1_wavedevice *wave_dev);
 void emu10k1_pt_stop(struct emu10k1_card *card);
diff -Nru a/sound/oss/es1370.c b/sound/oss/es1370.c
--- a/sound/oss/es1370.c	Tue Jun 15 22:21:05 2004
+++ b/sound/oss/es1370.c	Tue Jun 15 22:21:05 2004
@@ -845,21 +845,22 @@
 	unsigned long flags;
 	int i, val;
 	unsigned char l, r, rl, rr;
+	int __user *p = (int __user *)arg;
 
 	VALIDATE_STATE(s);
 	if (cmd == SOUND_MIXER_PRIVATE1) {
 		/* enable/disable/query mixer preamp */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != -1) {
 			s->mix.micpreamp = !!val;
 			wrcodec(s, 0x19, s->mix.micpreamp);
 		}
-		return put_user(s->mix.micpreamp, (int *)arg);
+		return put_user(s->mix.micpreamp, p);
 	}
 	if (cmd == SOUND_MIXER_PRIVATE2) {
 		/* enable/disable/query use of linein as second lineout */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != -1) {
 			spin_lock_irqsave(&s->lock, flags);
@@ -870,11 +871,11 @@
 			outl(s->ctrl, s->io+ES1370_REG_CONTROL);
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
-		return put_user((s->ctrl & CTRL_XCTL0) ? 1 : 0, (int *)arg);
+		return put_user((s->ctrl & CTRL_XCTL0) ? 1 : 0, p);
 	}
 	if (cmd == SOUND_MIXER_PRIVATE3) {
 		/* enable/disable/query microphone impedance setting */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != -1) {
 			spin_lock_irqsave(&s->lock, flags);
@@ -885,14 +886,14 @@
 			outl(s->ctrl, s->io+ES1370_REG_CONTROL);
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
-		return put_user((s->ctrl & CTRL_XCTL1) ? 1 : 0, (int *)arg);
+		return put_user((s->ctrl & CTRL_XCTL1) ? 1 : 0, p);
 	}
         if (cmd == SOUND_MIXER_INFO) {
 		mixer_info info;
 		strncpy(info.id, "ES1370", sizeof(info.id));
 		strncpy(info.name, "Ensoniq ES1370", sizeof(info.name));
 		info.modify_counter = s->mix.modcnt;
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
@@ -900,49 +901,49 @@
 		_old_mixer_info info;
 		strncpy(info.id, "ES1370", sizeof(info.id));
 		strncpy(info.name, "Ensoniq ES1370", sizeof(info.name));
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
 	if (cmd == OSS_GETVERSION)
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
         if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
-			return put_user(s->mix.recsrc, (int *)arg);
+			return put_user(s->mix.recsrc, p);
 			
                 case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */
 			val = SOUND_MASK_IMIX;
 			for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].avail)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 
                 case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].recmask)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 			
                 case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].stereo)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 			
                 case SOUND_MIXER_CAPS:
-			return put_user(0, (int *)arg);
+			return put_user(0, p);
 		
 		case SOUND_MIXER_IMIX:
-			return put_user(s->mix.imix, (int *)arg);
+			return put_user(s->mix.imix, p);
 
 		default:
 			i = _IOC_NR(cmd);
                         if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].avail)
                                 return -EINVAL;
-			return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg);
+			return put_user(s->mix.vol[mixtable[i].volidx], p);
 		}
 	}
         if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) 
@@ -951,13 +952,13 @@
 	switch (_IOC_NR(cmd)) {
 
 	case SOUND_MIXER_IMIX:
-		if (get_user(s->mix.imix, (int *)arg))
+		if (get_user(s->mix.imix, p))
 			return -EFAULT;
 		set_recsrc(s, s->mix.recsrc);
 		return 0;
 
 	case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		set_recsrc(s, val);
 		return 0;
@@ -966,7 +967,7 @@
 		i = _IOC_NR(cmd);
 		if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].avail)
 			return -EINVAL;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
@@ -1015,7 +1016,7 @@
 #else
 		s->mix.vol[mixtable[i].volidx] = val;
 #endif
-                return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg);
+                return put_user(s->mix.vol[mixtable[i].volidx], p);
 	}
 }
 
@@ -1136,7 +1137,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t es1370_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1370_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1370_state *s = (struct es1370_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1214,7 +1215,7 @@
 	return ret;
 }
 
-static ssize_t es1370_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1370_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1370_state *s = (struct es1370_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1386,13 +1387,15 @@
         count_info cinfo;
 	int count;
 	int val, mapped, ret;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_STATE(s);
         mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) ||
 		((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		if (file->f_mode & FMODE_WRITE)
@@ -1403,7 +1406,7 @@
 		return 0;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
 		
         case SNDCTL_DSP_RESET:
 		if (file->f_mode & FMODE_WRITE) {
@@ -1419,7 +1422,7 @@
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			if (s->open_mode & (~file->f_mode) & (FMODE_READ|FMODE_WRITE))
@@ -1436,10 +1439,10 @@
 			outl(s->ctrl, s->io+ES1370_REG_CONTROL);
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
-		return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), (int *)arg);
+		return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), p);
 		
         case SNDCTL_DSP_STEREO:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			stop_adc(s);
@@ -1466,7 +1469,7 @@
 		return 0;
 
         case SNDCTL_DSP_CHANNELS:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			if (file->f_mode & FMODE_READ) {
@@ -1492,13 +1495,13 @@
 				spin_unlock_irqrestore(&s->lock, flags);
 			}
 		}
-		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg);
+		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p);
 		
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
+                return put_user(AFMT_S16_LE|AFMT_U8, p);
 		
 	case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			if (file->f_mode & FMODE_READ) {
@@ -1525,7 +1528,7 @@
 			}
 		}
 		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 
-				AFMT_S16_LE : AFMT_U8, (int *)arg);
+				AFMT_S16_LE : AFMT_U8, p);
 		
 	case SNDCTL_DSP_POST:
                 return 0;
@@ -1536,10 +1539,10 @@
 			val |= PCM_ENABLE_INPUT;
 		if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) 
 			val |= PCM_ENABLE_OUTPUT;
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 		
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			if (val & PCM_ENABLE_INPUT) {
@@ -1580,7 +1583,7 @@
                 abinfo.fragstotal = s->dma_dac2.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
@@ -1597,7 +1600,7 @@
                 abinfo.fragstotal = s->dma_adc.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 		
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -1614,7 +1617,7 @@
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (count < 0)
 			count = 0;
-		return put_user(count, (int *)arg);
+		return put_user(count, p);
 
         case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -1632,7 +1635,7 @@
 		if (s->dma_adc.mapped)
 			s->dma_adc.count &= s->dma_adc.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1652,7 +1655,7 @@
 		if (s->dma_dac2.mapped)
 			s->dma_dac2.count &= s->dma_dac2.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1660,14 +1663,14 @@
 		if (file->f_mode & FMODE_WRITE) {
 			if ((val = prog_dmabuf_dac2(s)))
 				return val;
-			return put_user(s->dma_dac2.fragsize, (int *)arg);
+			return put_user(s->dma_dac2.fragsize, p);
 		}
 		if ((val = prog_dmabuf_adc(s)))
 			return val;
-		return put_user(s->dma_adc.fragsize, (int *)arg);
+		return put_user(s->dma_adc.fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			s->dma_adc.ossfragshift = val & 0xffff;
@@ -1695,7 +1698,7 @@
 		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
 		    (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision))
 			return -EINVAL;
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -1706,15 +1709,15 @@
 		return 0;
 
         case SOUND_PCM_READ_RATE:
-		return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), (int *)arg);
+		return put_user(DAC2_DIVTOSR((s->ctrl & CTRL_PCLKDIV) >> CTRL_SH_PCLKDIV), p);
 
         case SOUND_PCM_READ_CHANNELS:
 		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ?
-				2 : 1, (int *)arg);
+				2 : 1, p);
 
         case SOUND_PCM_READ_BITS:
 		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 
-				16 : 8, (int *)arg);
+				16 : 8, p);
 
         case SOUND_PCM_WRITE_FILTER:
         case SNDCTL_DSP_SETSYNCRO:
@@ -1828,7 +1831,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t es1370_write_dac(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1370_write_dac(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1370_state *s = (struct es1370_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1961,11 +1964,12 @@
 	int count;
 	unsigned ctrl;
 	int val, ret;
+	int __user *p = (int __user *)arg;
 
 	VALIDATE_STATE(s);
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/);
@@ -1974,7 +1978,7 @@
 		return -EINVAL;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+		return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
 		
         case SNDCTL_DSP_RESET:
 		stop_dac1(s);
@@ -1983,7 +1987,7 @@
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			stop_dac1(s);
@@ -1996,10 +2000,10 @@
 			outl(s->ctrl, s->io+ES1370_REG_CONTROL);
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
-		return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], (int *)arg);
+		return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], p);
 		
         case SNDCTL_DSP_STEREO:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		stop_dac1(s);
 		s->dma_dac1.ready = 0;
@@ -2013,7 +2017,7 @@
 		return 0;
 
         case SNDCTL_DSP_CHANNELS:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			if (s->dma_dac1.mapped)
@@ -2028,13 +2032,13 @@
 			outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL);
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
-		return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg);
+		return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p);
 		
         case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
+                return put_user(AFMT_S16_LE|AFMT_U8, p);
 		
         case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			stop_dac1(s);
@@ -2047,16 +2051,16 @@
 			outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL);
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
-		return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, (int *)arg);
+		return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, p);
 
         case SNDCTL_DSP_POST:
                 return 0;
 
         case SNDCTL_DSP_GETTRIGGER:
-		return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, (int *)arg);
+		return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, p);
 						
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val & PCM_ENABLE_OUTPUT) {
 			if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s)))
@@ -2082,7 +2086,7 @@
                 abinfo.fragstotal = s->dma_dac1.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -2097,7 +2101,7 @@
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (count < 0)
 			count = 0;
-		return put_user(count, (int *)arg);
+		return put_user(count, p);
 
         case SNDCTL_DSP_GETOPTR:
 		if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0)
@@ -2113,17 +2117,17 @@
 		if (s->dma_dac1.mapped)
 			s->dma_dac1.count &= s->dma_dac1.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
         case SNDCTL_DSP_GETBLKSIZE:
 		if ((val = prog_dmabuf_dac1(s)))
 			return val;
-                return put_user(s->dma_dac1.fragsize, (int *)arg);
+                return put_user(s->dma_dac1.fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		s->dma_dac1.ossfragshift = val & 0xffff;
 		s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff;
@@ -2138,7 +2142,7 @@
         case SNDCTL_DSP_SUBDIVIDE:
 		if (s->dma_dac1.subdivision)
 			return -EINVAL;
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -2146,13 +2150,13 @@
 		return 0;
 
         case SOUND_PCM_READ_RATE:
-		return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], (int *)arg);
+		return put_user(dac1_samplerate[(s->ctrl & CTRL_WTSRSEL) >> CTRL_SH_WTSRSEL], p);
 
         case SOUND_PCM_READ_CHANNELS:
-		return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg);
+		return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p);
 
         case SOUND_PCM_READ_BITS:
-		return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, (int *)arg);
+		return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, p);
 
         case SOUND_PCM_WRITE_FILTER:
         case SNDCTL_DSP_SETSYNCRO:
@@ -2251,7 +2255,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t es1370_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1370_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1370_state *s = (struct es1370_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -2314,7 +2318,7 @@
 	return ret;
 }
 
-static ssize_t es1370_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1370_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1370_state *s = (struct es1370_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
diff -Nru a/sound/oss/es1371.c b/sound/oss/es1371.c
--- a/sound/oss/es1371.c	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/es1371.c	Tue Jun 15 22:20:43 2004
@@ -1170,7 +1170,7 @@
 		return 0;
 
 	case SOUND_MIXER_WRITE_PCM:   /* use SRC for PCM volume */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, (int __user *)arg))
 			return -EFAULT;
 		right = ((val >> 8)  & 0xff);
 		left = (val  & 0xff);
@@ -1186,7 +1186,7 @@
 		return 0;
 	
 	case SOUND_MIXER_READ_PCM:
-		return put_user(s->spdif_volume, (int *)arg);
+		return put_user(s->spdif_volume, (int __user *)arg);
 	}
 	return codec->mixer_ioctl(codec, cmd, arg);
 }
@@ -1324,7 +1324,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t es1371_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1371_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1371_state *s = (struct es1371_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1403,7 +1403,7 @@
 	return ret;
 }
 
-static ssize_t es1371_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1371_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1371_state *s = (struct es1371_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1578,13 +1578,15 @@
         count_info cinfo;
 	int count;
 	int val, mapped, ret;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_STATE(s);
         mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) ||
 		((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		if (file->f_mode & FMODE_WRITE)
@@ -1595,7 +1597,7 @@
 		return 0;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
 		
         case SNDCTL_DSP_RESET:
 		if (file->f_mode & FMODE_WRITE) {
@@ -1611,7 +1613,7 @@
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			if (file->f_mode & FMODE_READ) {
@@ -1625,10 +1627,10 @@
 				set_dac2_rate(s, val);
 			}
 		}
-		return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p);
 
         case SNDCTL_DSP_STEREO:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			stop_adc(s);
@@ -1655,7 +1657,7 @@
 		return 0;
 
         case SNDCTL_DSP_CHANNELS:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			if (file->f_mode & FMODE_READ) {
@@ -1681,13 +1683,13 @@
 				spin_unlock_irqrestore(&s->lock, flags);
 			}
 		}
-		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg);
+		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p);
 		
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
+                return put_user(AFMT_S16_LE|AFMT_U8, p);
 		
 	case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			if (file->f_mode & FMODE_READ) {
@@ -1714,7 +1716,7 @@
 			}
 		}
 		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 
-				AFMT_S16_LE : AFMT_U8, (int *)arg);
+				AFMT_S16_LE : AFMT_U8, p);
 		
 	case SNDCTL_DSP_POST:
                 return 0;
@@ -1725,10 +1727,10 @@
 			val |= PCM_ENABLE_INPUT;
 		if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) 
 			val |= PCM_ENABLE_OUTPUT;
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 		
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			if (val & PCM_ENABLE_INPUT) {
@@ -1769,7 +1771,7 @@
                 abinfo.fragstotal = s->dma_dac2.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
@@ -1786,7 +1788,7 @@
                 abinfo.fragstotal = s->dma_adc.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 		
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -1803,7 +1805,7 @@
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (count < 0)
 			count = 0;
-		return put_user(count, (int *)arg);
+		return put_user(count, p);
 
         case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -1821,7 +1823,7 @@
 		if (s->dma_adc.mapped)
 			s->dma_adc.count &= s->dma_adc.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1841,7 +1843,7 @@
 		if (s->dma_dac2.mapped)
 			s->dma_dac2.count &= s->dma_dac2.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1849,14 +1851,14 @@
 		if (file->f_mode & FMODE_WRITE) {
 			if ((val = prog_dmabuf_dac2(s)))
 				return val;
-			return put_user(s->dma_dac2.fragsize, (int *)arg);
+			return put_user(s->dma_dac2.fragsize, p);
 		}
 		if ((val = prog_dmabuf_adc(s)))
 			return val;
-		return put_user(s->dma_adc.fragsize, (int *)arg);
+		return put_user(s->dma_adc.fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			s->dma_adc.ossfragshift = val & 0xffff;
@@ -1884,7 +1886,7 @@
 		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
 		    (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision))
 			return -EINVAL;
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -1895,13 +1897,13 @@
 		return 0;
 
         case SOUND_PCM_READ_RATE:
-		return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p);
 
         case SOUND_PCM_READ_CHANNELS:
-		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, (int *)arg);
+		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p);
 		
         case SOUND_PCM_READ_BITS:
-		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, (int *)arg);
+		return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, p);
 
         case SOUND_PCM_WRITE_FILTER:
         case SNDCTL_DSP_SETSYNCRO:
@@ -2017,7 +2019,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t es1371_write_dac(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1371_write_dac(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1371_state *s = (struct es1371_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -2149,11 +2151,12 @@
         count_info cinfo;
 	int count;
 	int val, ret;
+	int __user *p = (int __user *)arg;
 
 	VALIDATE_STATE(s);
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/);
@@ -2162,7 +2165,7 @@
 		return -EINVAL;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+		return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
 		
         case SNDCTL_DSP_RESET:
 		stop_dac1(s);
@@ -2171,17 +2174,17 @@
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			stop_dac1(s);
 			s->dma_dac1.ready = 0;
 			set_dac1_rate(s, val);
 		}
-		return put_user(s->dac1rate, (int *)arg);
+		return put_user(s->dac1rate, p);
 
         case SNDCTL_DSP_STEREO:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		stop_dac1(s);
 		s->dma_dac1.ready = 0;
@@ -2195,7 +2198,7 @@
 		return 0;
 
         case SNDCTL_DSP_CHANNELS:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			stop_dac1(s);
@@ -2208,13 +2211,13 @@
 			outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
-		return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg);
+		return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p);
 		
         case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
+                return put_user(AFMT_S16_LE|AFMT_U8, p);
 		
         case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			stop_dac1(s);
@@ -2227,16 +2230,16 @@
 			outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
-		return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, (int *)arg);
+		return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, p);
 
         case SNDCTL_DSP_POST:
                 return 0;
 
         case SNDCTL_DSP_GETTRIGGER:
-		return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, (int *)arg);
+		return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, p);
 						
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val & PCM_ENABLE_OUTPUT) {
 			if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s)))
@@ -2262,7 +2265,7 @@
                 abinfo.fragstotal = s->dma_dac1.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -2277,7 +2280,7 @@
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (count < 0)
 			count = 0;
-		return put_user(count, (int *)arg);
+		return put_user(count, p);
 
         case SNDCTL_DSP_GETOPTR:
 		if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0)
@@ -2293,17 +2296,17 @@
 		if (s->dma_dac1.mapped)
 			s->dma_dac1.count &= s->dma_dac1.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
         case SNDCTL_DSP_GETBLKSIZE:
 		if ((val = prog_dmabuf_dac1(s)))
 			return val;
-                return put_user(s->dma_dac1.fragsize, (int *)arg);
+                return put_user(s->dma_dac1.fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		s->dma_dac1.ossfragshift = val & 0xffff;
 		s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff;
@@ -2318,7 +2321,7 @@
         case SNDCTL_DSP_SUBDIVIDE:
 		if (s->dma_dac1.subdivision)
 			return -EINVAL;
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -2326,13 +2329,13 @@
 		return 0;
 
         case SOUND_PCM_READ_RATE:
-		return put_user(s->dac1rate, (int *)arg);
+		return put_user(s->dac1rate, p);
 
         case SOUND_PCM_READ_CHANNELS:
-		return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, (int *)arg);
+		return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p);
 
         case SOUND_PCM_READ_BITS:
-		return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, (int *)arg);
+		return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, p);
 
         case SOUND_PCM_WRITE_FILTER:
         case SNDCTL_DSP_SETSYNCRO:
@@ -2430,7 +2433,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t es1371_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1371_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1371_state *s = (struct es1371_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -2493,7 +2496,7 @@
 	return ret;
 }
 
-static ssize_t es1371_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t es1371_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct es1371_state *s = (struct es1371_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
diff -Nru a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c
--- a/sound/oss/esssolo1.c	Tue Jun 15 22:20:37 2004
+++ b/sound/oss/esssolo1.c	Tue Jun 15 22:20:37 2004
@@ -694,37 +694,38 @@
 	};
 	unsigned char l, r, rl, rr, vidx;
 	int i, val;
+	int __user *p = (int __user *)arg;
 
 	VALIDATE_STATE(s);
 
 	if (cmd == SOUND_MIXER_PRIVATE1) {
 		/* enable/disable/query mixer preamp */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != -1) {
 			val = val ? 0xff : 0xf7;
 			write_mixer(s, 0x7d, (read_mixer(s, 0x7d) | 0x08) & val);
 		}
 		val = (read_mixer(s, 0x7d) & 0x08) ? 1 : 0;
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 	}
 	if (cmd == SOUND_MIXER_PRIVATE2) {
 		/* enable/disable/query spatializer */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != -1) {
 			val &= 0x3f;
 			write_mixer(s, 0x52, val);
 			write_mixer(s, 0x50, val ? 0x08 : 0);
 		}
-		return put_user(read_mixer(s, 0x52), (int *)arg);
+		return put_user(read_mixer(s, 0x52), p);
 	}
         if (cmd == SOUND_MIXER_INFO) {
 		mixer_info info;
 		strncpy(info.id, "Solo1", sizeof(info.id));
 		strncpy(info.name, "ESS Solo1", sizeof(info.name));
 		info.modify_counter = s->mix.modcnt;
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
@@ -732,41 +733,41 @@
 		_old_mixer_info info;
 		strncpy(info.id, "Solo1", sizeof(info.id));
 		strncpy(info.name, "ESS Solo1", sizeof(info.name));
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
 	if (cmd == OSS_GETVERSION)
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
         if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
-			return put_user(mixer_src[read_mixer(s, 0x1c) & 7], (int *)arg);
+			return put_user(mixer_src[read_mixer(s, 0x1c) & 7], p);
 
                 case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */
 			return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | SOUND_MASK_CD |
 					SOUND_MASK_LINE | SOUND_MASK_LINE1 | SOUND_MASK_MIC |
 					SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV |
-					SOUND_MASK_SPEAKER, (int *)arg);
+					SOUND_MASK_SPEAKER, p);
 
                 case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */
-			return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_VOLUME, (int *)arg);
+			return put_user(SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | SOUND_MASK_VOLUME, p);
 
                 case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */
 			return put_user(SOUND_MASK_PCM | SOUND_MASK_SYNTH | SOUND_MASK_CD |
 					SOUND_MASK_LINE | SOUND_MASK_LINE1 | SOUND_MASK_MIC |
-					SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV, (int *)arg);
+					SOUND_MASK_VOLUME | SOUND_MASK_LINE2 | SOUND_MASK_RECLEV, p);
 			
                 case SOUND_MIXER_CAPS:
-			return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg);
+			return put_user(SOUND_CAP_EXCL_INPUT, p);
 
 		default:
 			i = _IOC_NR(cmd);
                         if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i]))
                                 return -EINVAL;
-			return put_user(s->mix.vol[vidx-1], (int *)arg);
+			return put_user(s->mix.vol[vidx-1], p);
 		}
 	}
         if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) 
@@ -788,7 +789,7 @@
 			       0xb4, read_ctrl(s, 0xb4));
 		}
 #endif
-	        if (get_user(val, (int *)arg))
+	        if (get_user(val, p))
 			return -EFAULT;
                 i = hweight32(val);
                 if (i == 0)
@@ -805,7 +806,7 @@
 		return 0;
 
 	case SOUND_MIXER_VOLUME:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
@@ -834,10 +835,10 @@
 #else
                 s->mix.vol[9] = val;
 #endif
-		return put_user(s->mix.vol[9], (int *)arg);
+		return put_user(s->mix.vol[9], p);
 
 	case SOUND_MIXER_SPEAKER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		l = val & 0xff;
 		if (l > 100)
@@ -852,10 +853,10 @@
 #else
                 s->mix.vol[7] = val;
 #endif
-		return put_user(s->mix.vol[7], (int *)arg);
+		return put_user(s->mix.vol[7], p);
 
 	case SOUND_MIXER_RECLEV:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		l = (val << 1) & 0x1fe;
 		if (l > 200)
@@ -877,13 +878,13 @@
 #else
                 s->mix.vol[8] = val;
 #endif
-		return put_user(s->mix.vol[8], (int *)arg);
+		return put_user(s->mix.vol[8], p);
 
 	default:
 		i = _IOC_NR(cmd);
 		if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i]))
 			return -EINVAL;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		l = (val << 1) & 0x1fe;
 		if (l > 200)
@@ -905,7 +906,7 @@
 #else
                 s->mix.vol[vidx-1] = val;
 #endif
-		return put_user(s->mix.vol[vidx-1], (int *)arg);
+		return put_user(s->mix.vol[vidx-1], p);
 	}
 }
 
@@ -999,7 +1000,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t solo1_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t solo1_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct solo1_state *s = (struct solo1_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1095,7 +1096,7 @@
 	return ret;
 }
 
-static ssize_t solo1_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t solo1_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct solo1_state *s = (struct solo1_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1263,13 +1264,15 @@
 	int val, mapped, ret, count;
         int div1, div2;
         unsigned rate1, rate2;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_STATE(s);
         mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) ||
 		((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		if (file->f_mode & FMODE_WRITE)
@@ -1280,7 +1283,7 @@
 		return 0;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
 		
         case SNDCTL_DSP_RESET:
 		if (file->f_mode & FMODE_WRITE) {
@@ -1297,7 +1300,7 @@
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			stop_adc(s);
@@ -1322,10 +1325,10 @@
 			s->clkdiv = div1;
 			prog_codec(s);
 		}
-		return put_user(s->rate, (int *)arg);
+		return put_user(s->rate, p);
 		
         case SNDCTL_DSP_STEREO:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		stop_adc(s);
 		stop_dac(s);
@@ -1336,7 +1339,7 @@
 		return 0;
 
         case SNDCTL_DSP_CHANNELS:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			stop_adc(s);
@@ -1346,13 +1349,13 @@
 			s->channels = (val >= 2) ? 2 : 1;
 			prog_codec(s);
 		}
-		return put_user(s->channels, (int *)arg);
+		return put_user(s->channels, p);
 
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(AFMT_S16_LE|AFMT_U16_LE|AFMT_S8|AFMT_U8, (int *)arg);
+                return put_user(AFMT_S16_LE|AFMT_U16_LE|AFMT_S8|AFMT_U8, p);
 
 	case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			stop_adc(s);
@@ -1365,7 +1368,7 @@
 			s->fmt = val;
 			prog_codec(s);
 		}
-		return put_user(s->fmt, (int *)arg);
+		return put_user(s->fmt, p);
 
 	case SNDCTL_DSP_POST:
                 return 0;
@@ -1376,10 +1379,10 @@
 			val |= PCM_ENABLE_INPUT;
 		if (file->f_mode & s->ena & FMODE_WRITE)
 			val |= PCM_ENABLE_OUTPUT;
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			if (val & PCM_ENABLE_INPUT) {
@@ -1422,7 +1425,7 @@
                 abinfo.fragstotal = s->dma_dac.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
@@ -1436,7 +1439,7 @@
                 abinfo.fragstotal = s->dma_adc.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -1453,7 +1456,7 @@
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (count < 0)
 			count = 0;
-		return put_user(count, (int *)arg);
+		return put_user(count, p);
 
         case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -1468,7 +1471,7 @@
 		if (s->dma_adc.mapped)
 			s->dma_adc.count &= s->dma_adc.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1494,7 +1497,7 @@
 		       cinfo.bytes, cinfo.blocks, cinfo.ptr, s->dma_dac.buforder, s->dma_dac.numfrag, s->dma_dac.fragshift,
 		       s->dma_dac.swptr, s->dma_dac.count, s->dma_dac.fragsize, s->dma_dac.dmasize, s->dma_dac.fragsamples);
 #endif
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1502,14 +1505,14 @@
 		if (file->f_mode & FMODE_WRITE) {
 			if ((val = prog_dmabuf_dac(s)))
 				return val;
-			return put_user(s->dma_dac.fragsize, (int *)arg);
+			return put_user(s->dma_dac.fragsize, p);
 		}
 		if ((val = prog_dmabuf_adc(s)))
 			return val;
-		return put_user(s->dma_adc.fragsize, (int *)arg);
+		return put_user(s->dma_adc.fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			s->dma_adc.ossfragshift = val & 0xffff;
@@ -1537,7 +1540,7 @@
 		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
 		    (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision))
 			return -EINVAL;
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -1548,13 +1551,13 @@
 		return 0;
 
         case SOUND_PCM_READ_RATE:
-		return put_user(s->rate, (int *)arg);
+		return put_user(s->rate, p);
 
         case SOUND_PCM_READ_CHANNELS:
-		return put_user(s->channels, (int *)arg);
+		return put_user(s->channels, p);
 
         case SOUND_PCM_READ_BITS:
-		return put_user((s->fmt & (AFMT_S8|AFMT_U8)) ? 8 : 16, (int *)arg);
+		return put_user((s->fmt & (AFMT_S8|AFMT_U8)) ? 8 : 16, p);
 
         case SOUND_PCM_WRITE_FILTER:
         case SNDCTL_DSP_SETSYNCRO:
@@ -1727,7 +1730,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t solo1_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t solo1_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct solo1_state *s = (struct solo1_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1790,7 +1793,7 @@
 	return ret;
 }
 
-static ssize_t solo1_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t solo1_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct solo1_state *s = (struct solo1_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -2032,7 +2035,7 @@
 		return 0;
 
 	case FM_IOCTL_PLAY_NOTE:
-		if (copy_from_user(&n, (void *)arg, sizeof(n)))
+		if (copy_from_user(&n, (void __user *)arg, sizeof(n)))
 			return -EFAULT;
 		if (n.voice >= 18)
 			return -EINVAL;
@@ -2050,7 +2053,7 @@
 		return 0;
 
 	case FM_IOCTL_SET_VOICE:
-		if (copy_from_user(&v, (void *)arg, sizeof(v)))
+		if (copy_from_user(&v, (void __user *)arg, sizeof(v)))
 			return -EFAULT;
 		if (v.voice >= 18)
 			return -EINVAL;
@@ -2080,7 +2083,7 @@
 		return 0;
 		
 	case FM_IOCTL_SET_PARAMS:
-		if (copy_from_user(&p, (void *)arg, sizeof(p)))
+		if (copy_from_user(&p, (void __user *)arg, sizeof(p)))
 			return -EFAULT;
 		outb(0x08, s->sbbase);
 		outb((p.kbd_split & 1) << 6, s->sbbase+1);
diff -Nru a/sound/oss/forte.c b/sound/oss/forte.c
--- a/sound/oss/forte.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/forte.c	Tue Jun 15 22:20:39 2004
@@ -849,6 +849,8 @@
 	struct forte_chip *chip;
 	struct audio_buf_info abi;
 	struct count_info cinfo;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	chip = file->private_data;
 	
@@ -865,24 +867,24 @@
 	switch (cmd) {
 
 	case OSS_GETVERSION:
-		return put_user (SOUND_VERSION, (int *) arg);
+		return put_user (SOUND_VERSION, p);
 
 	case SNDCTL_DSP_GETCAPS:
 		DPRINTK ("%s: GETCAPS\n", __FUNCTION__);
 
 		ival = FORTE_CAPS; /* DUPLEX */
-		return put_user (ival, (int *) arg);
+		return put_user (ival, p);
 
 	case SNDCTL_DSP_GETFMTS:
 		DPRINTK ("%s: GETFMTS\n", __FUNCTION__);
 
 		ival = FORTE_FMTS; /* U8, 16LE */
-		return put_user (ival, (int *) arg);
+		return put_user (ival, p);
 
 	case SNDCTL_DSP_SETFMT:	/* U8, 16LE */
 		DPRINTK ("%s: SETFMT\n", __FUNCTION__);
 
-		if (get_user (ival, (int *) arg))
+		if (get_user (ival, p))
 			return -EFAULT;
 
 		spin_lock_irq (&chip->lock);
@@ -899,12 +901,12 @@
 
 		spin_unlock_irq (&chip->lock);
 	
-		return put_user (rval, (int *) arg);
+		return put_user (rval, p);
 
 	case SNDCTL_DSP_STEREO:	/* 0 - mono, 1 - stereo */
 		DPRINTK ("%s: STEREO\n", __FUNCTION__);
 
-		if (get_user (ival, (int *) arg))
+		if (get_user (ival, p))
 			return -EFAULT;
 
 		spin_lock_irq (&chip->lock);
@@ -921,12 +923,12 @@
 
 		spin_unlock_irq (&chip->lock);
 
-                return put_user (rval, (int *) arg);
+                return put_user (rval, p);
 
 	case SNDCTL_DSP_CHANNELS: /* 1 - mono, 2 - stereo */
 		DPRINTK ("%s: CHANNELS\n", __FUNCTION__);
 
-		if (get_user (ival, (int *) arg))
+		if (get_user (ival, p))
 			return -EFAULT;
 
 		spin_lock_irq (&chip->lock);
@@ -943,12 +945,12 @@
 
 		spin_unlock_irq (&chip->lock);
 
-                return put_user (rval, (int *) arg);
+                return put_user (rval, p);
 
 	case SNDCTL_DSP_SPEED:
 		DPRINTK ("%s: SPEED\n", __FUNCTION__);
 
-		if (get_user (ival, (int *) arg))
+		if (get_user (ival, p))
                         return -EFAULT;
 
 		spin_lock_irq (&chip->lock);
@@ -965,7 +967,7 @@
 
 		spin_unlock_irq (&chip->lock);
 
-                return put_user(rval, (int*) arg);
+                return put_user(rval, p);
 
 	case SNDCTL_DSP_GETBLKSIZE:
 		DPRINTK ("%s: GETBLKSIZE\n", __FUNCTION__);
@@ -980,7 +982,7 @@
 
 		spin_unlock_irq (&chip->lock);
 
-                return put_user (ival, (int *) arg);
+                return put_user (ival, p);
 
 	case SNDCTL_DSP_RESET:
 		DPRINTK ("%s: RESET\n", __FUNCTION__);
@@ -1022,7 +1024,7 @@
 	case SNDCTL_DSP_SETFRAGMENT:
 		DPRINTK ("%s: SETFRAGMENT\n", __FUNCTION__);
 
-		if (get_user (ival, (int *) arg))
+		if (get_user (ival, p))
 			return -EFAULT;
 
 		spin_lock_irq (&chip->lock);
@@ -1041,7 +1043,7 @@
 
 		spin_unlock_irq (&chip->lock);
 
-		return put_user (ival, (int *) arg);
+		return put_user (ival, p);
                 
         case SNDCTL_DSP_GETISPACE:
 		DPRINTK ("%s: GETISPACE\n", __FUNCTION__);
@@ -1065,7 +1067,7 @@
 
 		spin_unlock_irq (&chip->lock);
 
-		return copy_to_user ((void *) arg, &abi, sizeof (abi)) ? -EFAULT : 0;
+		return copy_to_user (argp, &abi, sizeof (abi)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETIPTR:
 		DPRINTK ("%s: GETIPTR\n", __FUNCTION__);
@@ -1086,7 +1088,7 @@
 
 		spin_unlock_irq (&chip->lock);
 
-		return copy_to_user ((void *) arg, &cinfo, sizeof (cinfo)) ? -EFAULT : 0;
+		return copy_to_user (argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0;
 
         case SNDCTL_DSP_GETOSPACE:
 		if (!wr)
@@ -1114,7 +1116,7 @@
 
 		spin_unlock_irq (&chip->lock);
 		
-		return copy_to_user ((void *) arg, &abi, sizeof (abi)) ? -EFAULT : 0;
+		return copy_to_user (argp, &abi, sizeof (abi)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETOPTR:
 		if (!wr)
@@ -1133,7 +1135,7 @@
 
 		spin_unlock_irq (&chip->lock);
 
-		return copy_to_user ((void *) arg, &cinfo, sizeof (cinfo)) ? -EFAULT : 0;
+		return copy_to_user (argp, &cinfo, sizeof (cinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETODELAY:
 		if (!wr)
@@ -1157,7 +1159,7 @@
 
 		spin_unlock_irq (&chip->lock);
 
-		return put_user (ival, (int *) arg);
+		return put_user (ival, p);
 
 	case SNDCTL_DSP_SETDUPLEX:
 		DPRINTK ("%s: SETDUPLEX\n", __FUNCTION__);
@@ -1167,11 +1169,11 @@
 	case SNDCTL_DSP_GETTRIGGER:
 		DPRINTK ("%s: GETTRIGGER\n", __FUNCTION__);
 		
-		return put_user (chip->trigger, (int *) arg);
+		return put_user (chip->trigger, p);
 		
 	case SNDCTL_DSP_SETTRIGGER:
 
-		if (get_user (ival, (int *) arg))
+		if (get_user (ival, p))
 			return -EFAULT;
 
 		DPRINTK ("%s: SETTRIGGER %d\n", __FUNCTION__, ival);
@@ -1207,15 +1209,15 @@
 		
 	case SOUND_PCM_READ_RATE:
 		DPRINTK ("%s: PCM_READ_RATE\n", __FUNCTION__);		
-		return put_user (chip->play.rate, (int *) arg);
+		return put_user (chip->play.rate, p);
 
 	case SOUND_PCM_READ_CHANNELS:
 		DPRINTK ("%s: PCM_READ_CHANNELS\n", __FUNCTION__);
-		return put_user (chip->play.stereo, (int *) arg);
+		return put_user (chip->play.stereo, p);
 
 	case SOUND_PCM_READ_BITS:
 		DPRINTK ("%s: PCM_READ_BITS\n", __FUNCTION__);		
-		return put_user (chip->play.format, (int *) arg);
+		return put_user (chip->play.format, p);
 
 	case SNDCTL_DSP_NONBLOCK:
 		DPRINTK ("%s: DSP_NONBLOCK\n", __FUNCTION__);		
@@ -1223,7 +1225,7 @@
 		return 0;
 
 	default:
-		DPRINTK ("Unsupported ioctl: %x (%p)\n", cmd, (void *) arg);
+		DPRINTK ("Unsupported ioctl: %x (%p)\n", cmd, argp);
 		break;
 	}
 
@@ -1428,7 +1430,7 @@
  */
 
 static ssize_t 
-forte_dsp_write (struct file *file, const char *buffer, size_t bytes, 
+forte_dsp_write (struct file *file, const char __user *buffer, size_t bytes, 
 		 loff_t *ppos)
 {
 	struct forte_chip *chip;
@@ -1536,7 +1538,7 @@
  */
 
 static ssize_t 
-forte_dsp_read (struct file *file, char *buffer, size_t bytes, 
+forte_dsp_read (struct file *file, char __user *buffer, size_t bytes, 
 		loff_t *ppos)
 {
 	struct forte_chip *chip;
diff -Nru a/sound/oss/gus.h b/sound/oss/gus.h
--- a/sound/oss/gus.h	Tue Jun 15 22:20:44 2004
+++ b/sound/oss/gus.h	Tue Jun 15 22:20:44 2004
@@ -13,7 +13,7 @@
 void gus_write8(int reg, unsigned int data);
 void guswave_dma_irq(void);
 void gus_delay(void);
-int gus_default_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg);
+int gus_default_mixer_ioctl (int dev, unsigned int cmd, void __user *arg);
 void gus_timer_command (unsigned int addr, unsigned int val);
 
 /*	From gus_midi.c */
diff -Nru a/sound/oss/gus_wave.c b/sound/oss/gus_wave.c
--- a/sound/oss/gus_wave.c	Tue Jun 15 22:20:38 2004
+++ b/sound/oss/gus_wave.c	Tue Jun 15 22:20:38 2004
@@ -1045,7 +1045,7 @@
 	return 1;
 }
 
-static int guswave_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int guswave_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 
 	switch (cmd) 
@@ -1622,7 +1622,7 @@
 		DMAbuf_close_dma(gus_devnum);
 }
 
-static int guswave_load_patch(int dev, int format, const char *addr,
+static int guswave_load_patch(int dev, int format, const char __user *addr,
 		   int offs, int count, int pmgr_flag)
 {
 	struct patch_info patch;
@@ -1780,7 +1780,7 @@
 
 			for (i = 0; i < blk_sz; i++)
 			{
-				get_user(*(unsigned char *) &data, (unsigned char *) &((addr)[sizeof_patch + i]));
+				get_user(*(unsigned char *) &data, (unsigned char __user *) &((addr)[sizeof_patch + i]));
 				if (patch.mode & WAVE_UNSIGNED)
 					if (!(patch.mode & WAVE_16_BITS) || (i & 0x01))
 						data ^= 0x80;	/* Convert to signed */
@@ -2082,14 +2082,14 @@
 	return bits;
 }
 
-static int gus_audio_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int gus_audio_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	int val;
 
 	switch (cmd) 
 	{
 		case SOUND_PCM_WRITE_RATE:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, (int __user*)arg))
 				return -EFAULT;
 			val = gus_audio_set_speed(val);
 			break;
@@ -2099,13 +2099,13 @@
 			break;
 
 		case SNDCTL_DSP_STEREO:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, (int __user *)arg))
 				return -EFAULT;
 			val = gus_audio_set_channels(val + 1) - 1;
 			break;
 
 		case SOUND_PCM_WRITE_CHANNELS:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, (int __user *)arg))
 				return -EFAULT;
 			val = gus_audio_set_channels(val);
 			break;
@@ -2115,7 +2115,7 @@
 			break;
 		
 		case SNDCTL_DSP_SETFMT:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, (int __user *)arg))
 				return -EFAULT;
 			val = gus_audio_set_bits(val);
 			break;
@@ -2131,7 +2131,7 @@
 		default:
 			return -EINVAL;
 	}
-	return put_user(val, (int *)arg);
+	return put_user(val, (int __user *)arg);
 }
 
 static void gus_audio_reset(int dev)
@@ -2687,19 +2687,19 @@
 #define MIX_DEVS	(SOUND_MASK_MIC|SOUND_MASK_LINE| \
 			 SOUND_MASK_SYNTH|SOUND_MASK_PCM)
 
-int gus_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+int gus_default_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	int vol, val;
 
 	if (((cmd >> 8) & 0xff) != 'M')
 		return -EINVAL;
 
-	if (!access_ok(VERIFY_WRITE, (int *)arg, sizeof(int)))
+	if (!access_ok(VERIFY_WRITE, arg, sizeof(int)))
 		return -EFAULT;
 
 	if (_SIOC_DIR(cmd) & _SIOC_WRITE) 
 	{
-		if (__get_user(val, (int *) arg))
+		if (__get_user(val, (int __user *) arg))
 			return -EFAULT;
 
 		switch (cmd & 0xff) 
@@ -2810,7 +2810,7 @@
 				return -EINVAL;
 		}
 	}
-	return __put_user(val, (int *)arg);
+	return __put_user(val, (int __user *)arg);
 }
 
 static struct mixer_operations gus_mixer_operations =
diff -Nru a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
--- a/sound/oss/i810_audio.c	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/i810_audio.c	Tue Jun 15 22:20:43 2004
@@ -99,54 +99,14 @@
 #include <linux/spinlock.h>
 #include <linux/smp_lock.h>
 #include <linux/ac97_codec.h>
+#include <linux/bitops.h>
 #include <asm/uaccess.h>
 #include <asm/hardirq.h>
 
-#ifndef PCI_DEVICE_ID_INTEL_82801
-#define PCI_DEVICE_ID_INTEL_82801	0x2415
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_82901
-#define PCI_DEVICE_ID_INTEL_82901	0x2425
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH2
-#define PCI_DEVICE_ID_INTEL_ICH2	0x2445
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH3
-#define PCI_DEVICE_ID_INTEL_ICH3	0x2485
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH4
-#define PCI_DEVICE_ID_INTEL_ICH4	0x24c5
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH5
-#define PCI_DEVICE_ID_INTEL_ICH5	0x24d5
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH6_3
-#define PCI_DEVICE_ID_INTEL_ICH6_3	0x266e
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_440MX
-#define PCI_DEVICE_ID_INTEL_440MX	0x7195
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ESB_5
-#define PCI_DEVICE_ID_INTEL_ESB_5	0x25a6
-#endif
-#ifndef PCI_DEVICE_ID_SI_7012
-#define PCI_DEVICE_ID_SI_7012		0x7012
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO	0x01b1
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO	0x006a
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO	0x00da
-#endif
-#ifndef PCI_DEVICE_ID_AMD_768_AUDIO
-#define PCI_DEVICE_ID_AMD_768_AUDIO	0x7445
-#endif
-#ifndef PCI_DEVICE_ID_AMD_8111_AC97
-#define PCI_DEVICE_ID_AMD_8111_AC97	0x746d
-#endif
+#define DRIVER_VERSION "1.01"
+
+#define MODULOP2(a, b) ((a) & ((b) - 1))
+#define MASKP2(a, b) ((a) & ~((b) - 1))
 
 static int ftsodell;
 static int strict_clocking;
@@ -209,6 +169,7 @@
 
 #define ENUM_ENGINE(PRE,DIG) 									\
 enum {												\
+	PRE##_BASE =	0x##DIG##0,		/* Base Address */				\
 	PRE##_BDBAR =	0x##DIG##0,		/* Buffer Descriptor list Base Address */	\
 	PRE##_CIV =	0x##DIG##4,		/* Current Index Value */			\
 	PRE##_LVI =	0x##DIG##5,		/* Last Valid Index */				\
@@ -256,8 +217,6 @@
 #define INT_GPI		(1<<0)
 #define INT_MASK (INT_SEC|INT_PRI|INT_MC|INT_PO|INT_PI|INT_MO|INT_NI|INT_GPI)
 
-#define DRIVER_VERSION "0.24"
-
 /* magic numbers to protect our data structures */
 #define I810_CARD_MAGIC		0x5072696E /* "Prin" */
 #define I810_STATE_MAGIC	0x63657373 /* "cess" */
@@ -323,19 +282,19 @@
 };
 
 static struct pci_device_id i810_pci_tbl [] = {
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801,
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_5,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, ICH82801AA},
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82901,
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_5,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, ICH82901AB},
 	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_440MX,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTEL440MX},
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH2,
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_4,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH2},
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH3,
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_5,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH3},
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH4,
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_5,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4},
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH5,
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_5,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH5},
 	{PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7012,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, SI7012},
@@ -345,13 +304,13 @@
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE},
 	{PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE},
-	{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_768_AUDIO,
+	{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_OPUS_7445,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD768},
-	{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_AC97,
+	{PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_AUDIO,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, AMD8111},
 	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_5,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4},
-	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_3,
+	{PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_18,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4},
 
 	{0,}
@@ -491,8 +450,12 @@
 /* extract register offset from codec struct */
 #define IO_REG_OFF(codec) (((struct i810_card *) codec->private_data)->ac97_id_map[codec->id])
 
+#define GET_CIV(port) MODULOP2(inb((port) + OFF_CIV), SG_LEN)
+#define GET_LVI(port) MODULOP2(inb((port) + OFF_LVI), SG_LEN)
+
 /* set LVI from CIV */
-#define CIV_TO_LVI(port, off) outb((inb(port+OFF_CIV)+off) & 31, port+OFF_LVI)
+#define CIV_TO_LVI(port, off) \
+	outb(MODULOP2(GET_CIV((port)) + (off), SG_LEN), (port) + OFF_LVI)
 
 static struct i810_card *devs = NULL;
 
@@ -762,7 +725,7 @@
 		port_picb = port + OFF_PICB;
 
 	do {
-		civ = inb(port+OFF_CIV) & 31;
+		civ = GET_CIV(port);
 		offset = inw(port_picb);
 		/* Must have a delay here! */ 
 		if(offset == 0)
@@ -782,7 +745,7 @@
 		 * that we won't have to worry about the chip still being
 		 * out of sync with reality ;-)
 		 */
-	} while (civ != (inb(port+OFF_CIV) & 31) || offset != inw(port_picb));
+	} while (civ != GET_CIV(port) || offset != inw(port_picb));
 		 
 	return (((civ + 1) * dmabuf->fragsize - (bytes * offset))
 		% dmabuf->dmasize);
@@ -992,6 +955,7 @@
 	dmabuf->numfrag = SG_LEN;
 	dmabuf->fragsize = dmabuf->dmasize/dmabuf->numfrag;
 	dmabuf->fragsamples = dmabuf->fragsize >> 1;
+	dmabuf->fragshift = ffs(dmabuf->fragsize) - 1;
 	dmabuf->userfragsize = dmabuf->ossfragsize;
 	dmabuf->userfrags = dmabuf->dmasize/dmabuf->ossfragsize;
 
@@ -999,16 +963,12 @@
 
 	if(dmabuf->ossmaxfrags == 4) {
 		fragint = 8;
-		dmabuf->fragshift = 2;
 	} else if (dmabuf->ossmaxfrags == 8) {
 		fragint = 4;
-		dmabuf->fragshift = 3;
 	} else if (dmabuf->ossmaxfrags == 16) {
 		fragint = 2;
-		dmabuf->fragshift = 4;
 	} else {
 		fragint = 1;
-		dmabuf->fragshift = 5;
 	}
 	/*
 	 *	Now set up the ring 
@@ -1072,41 +1032,41 @@
 {
 	struct dmabuf *dmabuf = &state->dmabuf;
 	int x, port;
-	
+	int trigger;
+	int count, fragsize;
+	void (*start)(struct i810_state *);
+
+	count = dmabuf->count;
 	port = state->card->iobase;
-	if(rec)
+	if (rec) {
 		port += dmabuf->read_channel->port;
-	else
+		trigger = PCM_ENABLE_INPUT;
+		start = __start_adc;
+		count = dmabuf->dmasize - count;
+	} else {
 		port += dmabuf->write_channel->port;
+		trigger = PCM_ENABLE_OUTPUT;
+		start = __start_dac;
+	}
+
+	/* Do not process partial fragments. */
+	fragsize = dmabuf->fragsize;
+	if (count < fragsize)
+		return;
 
-	/* if we are currently stopped, then our CIV is actually set to our
-	 * *last* sg segment and we are ready to wrap to the next.  However,
-	 * if we set our LVI to the last sg segment, then it won't wrap to
-	 * the next sg segment, it won't even get a start.  So, instead, when
-	 * we are stopped, we set both the LVI value and also we increment
-	 * the CIV value to the next sg segment to be played so that when
-	 * we call start_{dac,adc}, things will operate properly
-	 */
 	if (!dmabuf->enable && dmabuf->ready) {
-		if(rec && dmabuf->count < dmabuf->dmasize &&
-		   (dmabuf->trigger & PCM_ENABLE_INPUT))
-		{
-			CIV_TO_LVI(port, 1);
-			__start_adc(state);
-			while( !(inb(port + OFF_CR) & ((1<<4) | (1<<2))) ) ;
-		} else if (!rec && dmabuf->count &&
-			   (dmabuf->trigger & PCM_ENABLE_OUTPUT))
-		{
-			CIV_TO_LVI(port, 1);
-			__start_dac(state);
-			while( !(inb(port + OFF_CR) & ((1<<4) | (1<<2))) ) ;
-		}
+		if (!(dmabuf->trigger & trigger))
+			return;
+
+		start(state);
+		while (!(inb(port + OFF_CR) & ((1<<4) | (1<<2))))
+			;
 	}
 
-	/* swptr - 1 is the tail of our transfer */
-	x = (dmabuf->dmasize + dmabuf->swptr - 1) % dmabuf->dmasize;
-	x /= dmabuf->fragsize;
-	outb(x, port+OFF_LVI);
+	/* MASKP2(swptr, fragsize) - 1 is the tail of our transfer */
+	x = MODULOP2(MASKP2(dmabuf->swptr, fragsize) - 1, dmabuf->dmasize);
+	x >>= dmabuf->fragshift;
+	outb(x, port + OFF_LVI);
 }
 
 static void i810_update_lvi(struct i810_state *state, int rec)
@@ -1126,13 +1086,17 @@
 {
 	struct dmabuf *dmabuf = &state->dmabuf;
 	unsigned hwptr;
+	unsigned fragmask, dmamask;
 	int diff;
 
-	/* error handling and process wake up for DAC */
+	fragmask = MASKP2(~0, dmabuf->fragsize);
+	dmamask = MODULOP2(~0, dmabuf->dmasize);
+
+	/* error handling and process wake up for ADC */
 	if (dmabuf->enable == ADC_RUNNING) {
 		/* update hardware pointer */
-		hwptr = i810_get_dma_addr(state, 1);
-		diff = (dmabuf->dmasize + hwptr - dmabuf->hwptr) % dmabuf->dmasize;
+		hwptr = i810_get_dma_addr(state, 1) & fragmask;
+		diff = (hwptr - dmabuf->hwptr) & dmamask;
 #if defined(DEBUG_INTERRUPTS) || defined(DEBUG_MMAP)
 		printk("ADC HWP %d,%d,%d\n", hwptr, dmabuf->hwptr, diff);
 #endif
@@ -1144,20 +1108,20 @@
 			/* this is normal for the end of a read */
 			/* only give an error if we went past the */
 			/* last valid sg entry */
-			if((inb(state->card->iobase + PI_CIV) & 31) !=
-			   (inb(state->card->iobase + PI_LVI) & 31)) {
+			if (GET_CIV(state->card->iobase + PI_BASE) !=
+			    GET_LVI(state->card->iobase + PI_BASE)) {
 				printk(KERN_WARNING "i810_audio: DMA overrun on read\n");
 				dmabuf->error++;
 			}
 		}
-		if (dmabuf->count > dmabuf->userfragsize)
+		if (diff)
 			wake_up(&dmabuf->wait);
 	}
 	/* error handling and process wake up for DAC */
 	if (dmabuf->enable == DAC_RUNNING) {
 		/* update hardware pointer */
-		hwptr = i810_get_dma_addr(state, 0);
-		diff = (dmabuf->dmasize + hwptr - dmabuf->hwptr) % dmabuf->dmasize;
+		hwptr = i810_get_dma_addr(state, 0) & fragmask;
+		diff = (hwptr - dmabuf->hwptr) & dmamask;
 #if defined(DEBUG_INTERRUPTS) || defined(DEBUG_MMAP)
 		printk("DAC HWP %d,%d,%d\n", hwptr, dmabuf->hwptr, diff);
 #endif
@@ -1169,18 +1133,18 @@
 			/* this is normal for the end of a write */
 			/* only give an error if we went past the */
 			/* last valid sg entry */
-			if((inb(state->card->iobase + PO_CIV) & 31) !=
-			   (inb(state->card->iobase + PO_LVI) & 31)) {
+			if (GET_CIV(state->card->iobase + PO_BASE) !=
+			    GET_LVI(state->card->iobase + PO_BASE)) {
 				printk(KERN_WARNING "i810_audio: DMA overrun on write\n");
 				printk("i810_audio: CIV %d, LVI %d, hwptr %x, "
 					"count %d\n",
-					inb(state->card->iobase + PO_CIV) & 31,
-					inb(state->card->iobase + PO_LVI) & 31,
+					GET_CIV(state->card->iobase + PO_BASE),
+					GET_LVI(state->card->iobase + PO_BASE),
 					dmabuf->hwptr, dmabuf->count);
 				dmabuf->error++;
 			}
 		}
-		if (dmabuf->count < (dmabuf->dmasize-dmabuf->userfragsize))
+		if (diff)
 			wake_up(&dmabuf->wait);
 	}
 }
@@ -1197,7 +1161,6 @@
 		dmabuf->swptr = dmabuf->hwptr;
 	}
 	free = dmabuf->dmasize - dmabuf->count;
-	free -= (dmabuf->hwptr % dmabuf->fragsize);
 	if(free < 0)
 		return(0);
 	return(free);
@@ -1215,12 +1178,27 @@
 		dmabuf->swptr = dmabuf->hwptr;
 	}
 	avail = dmabuf->count;
-	avail -= (dmabuf->hwptr % dmabuf->fragsize);
 	if(avail < 0)
 		return(0);
 	return(avail);
 }
 
+static inline void fill_partial_frag(struct dmabuf *dmabuf)
+{
+	unsigned fragsize;
+	unsigned swptr, len;
+
+	fragsize = dmabuf->fragsize;
+	swptr = dmabuf->swptr;
+	len = fragsize - MODULOP2(dmabuf->swptr, fragsize);
+	if (len == fragsize)
+		return;
+
+	memset(dmabuf->rawbuf + swptr, '\0', len);
+	dmabuf->swptr = MODULOP2(swptr + len, dmabuf->dmasize);
+	dmabuf->count += len;
+}
+
 static int drain_dac(struct i810_state *state, int signals_allowed)
 {
 	DECLARE_WAITQUEUE(wait, current);
@@ -1235,30 +1213,28 @@
 		stop_dac(state);
 		return 0;
 	}
+
+	spin_lock_irqsave(&state->card->lock, flags);
+
+	fill_partial_frag(dmabuf);
+
+	/* 
+	 * This will make sure that our LVI is correct, that our
+	 * pointer is updated, and that the DAC is running.  We
+	 * have to force the setting of dmabuf->trigger to avoid
+	 * any possible deadlocks.
+	 */
+	dmabuf->trigger = PCM_ENABLE_OUTPUT;
+	__i810_update_lvi(state, 0);
+
+	spin_unlock_irqrestore(&state->card->lock, flags);
+
 	add_wait_queue(&dmabuf->wait, &wait);
 	for (;;) {
 
 		spin_lock_irqsave(&state->card->lock, flags);
 		i810_update_ptr(state);
 		count = dmabuf->count;
-		spin_unlock_irqrestore(&state->card->lock, flags);
-
-		if (count <= 0)
-			break;
-
-		/* 
-		 * This will make sure that our LVI is correct, that our
-		 * pointer is updated, and that the DAC is running.  We
-		 * have to force the setting of dmabuf->trigger to avoid
-		 * any possible deadlocks.
-		 */
-		if(!dmabuf->enable) {
-			dmabuf->trigger = PCM_ENABLE_OUTPUT;
-			i810_update_lvi(state,0);
-		}
-                if (signal_pending(current) && signals_allowed) {
-                        break;
-                }
 
 		/* It seems that we have to set the current state to
 		 * TASK_INTERRUPTIBLE every time to make the process
@@ -1269,7 +1245,17 @@
 		 * instead of actually sleeping and waiting for an
 		 * interrupt to wake us up!
 		 */
-		set_current_state(TASK_INTERRUPTIBLE);
+		__set_current_state(signals_allowed ?
+				    TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
+		spin_unlock_irqrestore(&state->card->lock, flags);
+
+		if (count <= 0)
+			break;
+
+                if (signal_pending(current) && signals_allowed) {
+                        break;
+                }
+
 		/*
 		 * set the timeout to significantly longer than it *should*
 		 * take for the DAC to drain the DMA buffer
@@ -1350,11 +1336,10 @@
 			if(status & DMA_INT_DCH)
 				printk("DCH -");
 #endif
-			if(dmabuf->enable & DAC_RUNNING)
-				count = dmabuf->count;
-			else
-				count = dmabuf->dmasize - dmabuf->count;
-			if(count > 0) {
+			count = dmabuf->count;
+			if(dmabuf->enable & ADC_RUNNING)
+				count = dmabuf->dmasize - count;
+			if (count >= (int)dmabuf->fragsize) {
 				outb(inb(port+OFF_CR) | 1, port+OFF_CR);
 #ifdef DEBUG_INTERRUPTS
 				printk(" CONTINUE ");
@@ -1408,7 +1393,7 @@
    waiting to be copied to the user's buffer.  It is filled by the dma
    machine and drained by this loop. */
 
-static ssize_t i810_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t i810_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct i810_state *state = (struct i810_state *)file->private_data;
 	struct i810_card *card=state ? state->card : 0;
@@ -1417,6 +1402,7 @@
 	unsigned long flags;
 	unsigned int swptr;
 	int cnt;
+	int pending;
         DECLARE_WAITQUEUE(waita, current);
 
 #ifdef DEBUG2
@@ -1442,6 +1428,8 @@
 		return -EFAULT;
 	ret = 0;
 
+	pending = 0;
+
         add_wait_queue(&dmabuf->wait, &waita);
 	while (count > 0) {
 		set_current_state(TASK_INTERRUPTIBLE);
@@ -1455,8 +1443,8 @@
                         }
                         continue;
                 }
-		swptr = dmabuf->swptr;
 		cnt = i810_get_available_read_data(state);
+		swptr = dmabuf->swptr;
 		// this is to make the copy_to_user simpler below
 		if(cnt > (dmabuf->dmasize - swptr))
 			cnt = dmabuf->dmasize - swptr;
@@ -1464,15 +1452,6 @@
 
 		if (cnt > count)
 			cnt = count;
-		/* Lop off the last two bits to force the code to always
-		 * write in full samples.  This keeps software that sets
-		 * O_NONBLOCK but doesn't check the return value of the
-		 * write call from getting things out of state where they
-		 * think a full 4 byte sample was written when really only
-		 * a portion was, resulting in odd sound and stereo
-		 * hysteresis.
-		 */
-		cnt &= ~0x3;
 		if (cnt <= 0) {
 			unsigned long tmo;
 			/*
@@ -1526,7 +1505,7 @@
 			goto done;
 		}
 
-		swptr = (swptr + cnt) % dmabuf->dmasize;
+		swptr = MODULOP2(swptr + cnt, dmabuf->dmasize);
 
 		spin_lock_irqsave(&card->lock, flags);
 
@@ -1535,7 +1514,7 @@
                         continue;
                 }
 		dmabuf->swptr = swptr;
-		dmabuf->count -= cnt;
+		pending = dmabuf->count -= cnt;
 		spin_unlock_irqrestore(&card->lock, flags);
 
 		count -= cnt;
@@ -1543,7 +1522,9 @@
 		ret += cnt;
 	}
  done:
-	i810_update_lvi(state,1);
+	pending = dmabuf->dmasize - pending;
+	if (dmabuf->enable || pending >= dmabuf->userfragsize)
+		i810_update_lvi(state, 1);
         set_current_state(TASK_RUNNING);
         remove_wait_queue(&dmabuf->wait, &waita);
 
@@ -1552,7 +1533,7 @@
 
 /* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to
    the soundcard.  it is drained by the dma machine and filled by this loop. */
-static ssize_t i810_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t i810_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct i810_state *state = (struct i810_state *)file->private_data;
 	struct i810_card *card=state ? state->card : 0;
@@ -1560,7 +1541,8 @@
 	ssize_t ret;
 	unsigned long flags;
 	unsigned int swptr = 0;
-	int cnt, x;
+	int pending;
+	int cnt;
         DECLARE_WAITQUEUE(waita, current);
 
 #ifdef DEBUG2
@@ -1585,6 +1567,8 @@
 		return -EFAULT;
 	ret = 0;
 
+	pending = 0;
+
         add_wait_queue(&dmabuf->wait, &waita);
 	while (count > 0) {
 		set_current_state(TASK_INTERRUPTIBLE);
@@ -1599,8 +1583,8 @@
                         continue;
                 }
 
-		swptr = dmabuf->swptr;
 		cnt = i810_get_free_write_space(state);
+		swptr = dmabuf->swptr;
 		/* Bound the maximum size to how much we can copy to the
 		 * dma buffer before we hit the end.  If we have more to
 		 * copy then it will get done in a second pass of this
@@ -1615,15 +1599,6 @@
 #endif
 		if (cnt > count)
 			cnt = count;
-		/* Lop off the last two bits to force the code to always
-		 * write in full samples.  This keeps software that sets
-		 * O_NONBLOCK but doesn't check the return value of the
-		 * write call from getting things out of state where they
-		 * think a full 4 byte sample was written when really only
-		 * a portion was, resulting in odd sound and stereo
-		 * hysteresis.
-		 */
-		cnt &= ~0x3;
 		if (cnt <= 0) {
 			unsigned long tmo;
 			// There is data waiting to be played
@@ -1668,7 +1643,7 @@
 			goto ret;
 		}
 
-		swptr = (swptr + cnt) % dmabuf->dmasize;
+		swptr = MODULOP2(swptr + cnt, dmabuf->dmasize);
 
 		spin_lock_irqsave(&state->card->lock, flags);
                 if (PM_SUSPENDED(card)) {
@@ -1677,19 +1652,16 @@
                 }
 
 		dmabuf->swptr = swptr;
-		dmabuf->count += cnt;
+		pending = dmabuf->count += cnt;
 
 		count -= cnt;
 		buffer += cnt;
 		ret += cnt;
 		spin_unlock_irqrestore(&state->card->lock, flags);
 	}
-	if (swptr % dmabuf->fragsize) {
-		x = dmabuf->fragsize - (swptr % dmabuf->fragsize);
-		memset(dmabuf->rawbuf + swptr, '\0', x);
-	}
 ret:
-	i810_update_lvi(state,0);
+	if (dmabuf->enable || pending >= dmabuf->userfragsize)
+		i810_update_lvi(state, 0);
         set_current_state(TASK_RUNNING);
         remove_wait_queue(&dmabuf->wait, &waita);
 
@@ -1783,9 +1755,11 @@
 	unsigned int i_glob_cnt;
 	int val = 0, ret;
 	struct ac97_codec *codec = state->card->ac97_codec[0];
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 #ifdef DEBUG
-	printk("i810_audio: i810_ioctl, arg=0x%x, cmd=", arg ? *(int *)arg : 0);
+	printk("i810_audio: i810_ioctl, arg=0x%x, cmd=", arg ? *p : 0);
 #endif
 
 	switch (cmd) 
@@ -1794,7 +1768,7 @@
 #ifdef DEBUG
 		printk("OSS_GETVERSION\n");
 #endif
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_RESET:
 #ifdef DEBUG
@@ -1841,7 +1815,7 @@
 #ifdef DEBUG
 		printk("SNDCTL_DSP_SPEED\n");
 #endif
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			if (file->f_mode & FMODE_WRITE) {
@@ -1879,7 +1853,7 @@
 				spin_unlock_irqrestore(&state->card->lock, flags);
 			}
 		}
-		return put_user(dmabuf->rate, (int *)arg);
+		return put_user(dmabuf->rate, p);
 
 	case SNDCTL_DSP_STEREO: /* set stereo or mono channel */
 #ifdef DEBUG
@@ -1891,7 +1865,7 @@
 		if (dmabuf->enable & ADC_RUNNING) {
 			stop_adc(state);
 		}
-		return put_user(1, (int *)arg);
+		return put_user(1, p);
 
 	case SNDCTL_DSP_GETBLKSIZE:
 		if (file->f_mode & FMODE_WRITE) {
@@ -1905,25 +1879,25 @@
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETBLKSIZE %d\n", dmabuf->userfragsize);
 #endif
-		return put_user(dmabuf->userfragsize, (int *)arg);
+		return put_user(dmabuf->userfragsize, p);
 
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETFMTS\n");
 #endif
-		return put_user(AFMT_S16_LE, (int *)arg);
+		return put_user(AFMT_S16_LE, p);
 
 	case SNDCTL_DSP_SETFMT: /* Select sample format */
 #ifdef DEBUG
 		printk("SNDCTL_DSP_SETFMT\n");
 #endif
-		return put_user(AFMT_S16_LE, (int *)arg);
+		return put_user(AFMT_S16_LE, p);
 
 	case SNDCTL_DSP_CHANNELS:
 #ifdef DEBUG
 		printk("SNDCTL_DSP_CHANNELS\n");
 #endif
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		if (val > 0) {
@@ -1934,13 +1908,13 @@
 				stop_adc(state);
 			}
 		} else {
-			return put_user(state->card->channels, (int *)arg);
+			return put_user(state->card->channels, p);
 		}
 
 		/* ICH and ICH0 only support 2 channels */
-		if ( state->card->pci_id == PCI_DEVICE_ID_INTEL_82801 
-		     || state->card->pci_id == PCI_DEVICE_ID_INTEL_82901) 
-			return put_user(2, (int *)arg);
+		if ( state->card->pci_id == PCI_DEVICE_ID_INTEL_82801AA_5
+		     || state->card->pci_id == PCI_DEVICE_ID_INTEL_82801AB_5) 
+			return put_user(2, p);
 	
 		/* Multi-channel support was added with ICH2. Bits in */
 		/* Global Status and Global Control register are now  */
@@ -1985,7 +1959,7 @@
 				break;
 		}
 
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_POST: /* the user has sent all data and is notifying us */
 		/* we update the swptr to the end of the last sg segment then return */
@@ -2004,7 +1978,7 @@
 	case SNDCTL_DSP_SUBDIVIDE:
 		if (dmabuf->subdivision)
 			return -EINVAL;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -2016,7 +1990,7 @@
 		return 0;
 
 	case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		dmabuf->ossfragsize = 1<<(val & 0xffff);
@@ -2089,7 +2063,7 @@
 		printk("SNDCTL_DSP_GETOSPACE %d, %d, %d, %d\n", abinfo.bytes,
 			abinfo.fragsize, abinfo.fragments, abinfo.fragstotal);
 #endif
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETOPTR:
 		if (!(file->f_mode & FMODE_WRITE))
@@ -2111,7 +2085,7 @@
 		printk("SNDCTL_DSP_GETOPTR %d, %d, %d, %d\n", cinfo.bytes,
 			cinfo.blocks, cinfo.ptr, dmabuf->count);
 #endif
-		return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
@@ -2128,7 +2102,7 @@
 		printk("SNDCTL_DSP_GETISPACE %d, %d, %d, %d\n", abinfo.bytes,
 			abinfo.fragsize, abinfo.fragments, abinfo.fragstotal);
 #endif
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -2150,7 +2124,7 @@
 		printk("SNDCTL_DSP_GETIPTR %d, %d, %d, %d\n", cinfo.bytes,
 			cinfo.blocks, cinfo.ptr, dmabuf->count);
 #endif
-		return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_NONBLOCK:
 #ifdef DEBUG
@@ -2164,21 +2138,28 @@
 		printk("SNDCTL_DSP_GETCAPS\n");
 #endif
 	    return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP|DSP_CAP_BIND,
-			    (int *)arg);
+			    p);
 
 	case SNDCTL_DSP_GETTRIGGER:
 		val = 0;
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETTRIGGER 0x%x\n", dmabuf->trigger);
 #endif
-		return put_user(dmabuf->trigger, (int *)arg);
+		return put_user(dmabuf->trigger, p);
 
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 #if defined(DEBUG) || defined(DEBUG_MMAP)
 		printk("SNDCTL_DSP_SETTRIGGER 0x%x\n", val);
 #endif
+		/* silently ignore invalid PCM_ENABLE_xxx bits,
+		 * like the other drivers do
+		 */
+		if (!(file->f_mode & FMODE_READ ))
+			val &= ~PCM_ENABLE_INPUT;
+		if (!(file->f_mode & FMODE_WRITE ))
+			val &= ~PCM_ENABLE_OUTPUT;
 		if((file->f_mode & FMODE_READ) && !(val & PCM_ENABLE_INPUT) && dmabuf->enable == ADC_RUNNING) {
 			stop_adc(state);
 		}
@@ -2186,7 +2167,7 @@
 			stop_dac(state);
 		}
 		dmabuf->trigger = val;
-		if((file->f_mode & FMODE_WRITE) && (val & PCM_ENABLE_OUTPUT) && !(dmabuf->enable & DAC_RUNNING)) {
+		if((val & PCM_ENABLE_OUTPUT) && !(dmabuf->enable & DAC_RUNNING)) {
 			if (!dmabuf->write_channel) {
 				dmabuf->ready = 0;
 				dmabuf->write_channel = state->card->alloc_pcm_channel(state->card);
@@ -2202,12 +2183,12 @@
 				dmabuf->swptr = dmabuf->hwptr;
 				dmabuf->count = i810_get_free_write_space(state);
 				dmabuf->swptr = (dmabuf->swptr + dmabuf->count) % dmabuf->dmasize;
-				__i810_update_lvi(state, 0);
 				spin_unlock_irqrestore(&state->card->lock, flags);
-			} else
-				start_dac(state);
+			}
+			i810_update_lvi(state, 0);
+			start_dac(state);
 		}
-		if((file->f_mode & FMODE_READ) && (val & PCM_ENABLE_INPUT) && !(dmabuf->enable & ADC_RUNNING)) {
+		if((val & PCM_ENABLE_INPUT) && !(dmabuf->enable & ADC_RUNNING)) {
 			if (!dmabuf->read_channel) {
 				dmabuf->ready = 0;
 				dmabuf->read_channel = state->card->alloc_rec_pcm_channel(state->card);
@@ -2244,31 +2225,31 @@
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETODELAY %d\n", dmabuf->count);
 #endif
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SOUND_PCM_READ_RATE:
 #ifdef DEBUG
 		printk("SOUND_PCM_READ_RATE %d\n", dmabuf->rate);
 #endif
-		return put_user(dmabuf->rate, (int *)arg);
+		return put_user(dmabuf->rate, p);
 
 	case SOUND_PCM_READ_CHANNELS:
 #ifdef DEBUG
 		printk("SOUND_PCM_READ_CHANNELS\n");
 #endif
-		return put_user(2, (int *)arg);
+		return put_user(2, p);
 
 	case SOUND_PCM_READ_BITS:
 #ifdef DEBUG
 		printk("SOUND_PCM_READ_BITS\n");
 #endif
-		return put_user(AFMT_S16_LE, (int *)arg);
+		return put_user(AFMT_S16_LE, p);
 
 	case SNDCTL_DSP_SETSPDIF: /* Set S/PDIF Control register */
 #ifdef DEBUG
 		printk("SNDCTL_DSP_SETSPDIF\n");
 #endif
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		/* Check to make sure the codec supports S/PDIF transmitter */
@@ -2291,13 +2272,13 @@
 		else 
 			printk(KERN_WARNING "i810_audio: S/PDIF transmitter not avalible.\n");
 #endif
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_GETSPDIF: /* Get S/PDIF Control register */
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETSPDIF\n");
 #endif
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		/* Check to make sure the codec supports S/PDIF transmitter */
@@ -2310,14 +2291,14 @@
 		} else {
 			val = i810_ac97_get(codec, AC97_SPDIF_CONTROL);
 		}
-		//return put_user((val & 0xcfff), (int *)arg);
-		return put_user(val, (int *)arg);
+		//return put_user((val & 0xcfff), p);
+		return put_user(val, p);
    			
 	case SNDCTL_DSP_GETCHANNELMASK:
 #ifdef DEBUG
 		printk("SNDCTL_DSP_GETCHANNELMASK\n");
 #endif
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		
 		/* Based on AC'97 DAC support, not ICH hardware */
@@ -2330,13 +2311,13 @@
 		if ( state->card->ac97_features & 0x0140 )
 			val |= DSP_BIND_CENTER_LFE;
 
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
 	case SNDCTL_DSP_BIND_CHANNEL:
 #ifdef DEBUG
 		printk("SNDCTL_DSP_BIND_CHANNEL\n");
 #endif
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if ( val == DSP_BIND_QUERY ) {
 			val = DSP_BIND_FRONT; /* Always report this as being enabled */
@@ -2404,7 +2385,7 @@
 					val &= ~DSP_BIND_CENTER_LFE;
 			}
 		}
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 		
 	case SNDCTL_DSP_MAPINBUF:
 	case SNDCTL_DSP_MAPOUTBUF:
@@ -2747,6 +2728,26 @@
 	return i;
 }
 
+static int is_new_ich(u16 pci_id)
+{
+	switch (pci_id) {
+	case PCI_DEVICE_ID_INTEL_82801DB_5:
+	case PCI_DEVICE_ID_INTEL_82801EB_5:
+	case PCI_DEVICE_ID_INTEL_ESB_5:
+	case PCI_DEVICE_ID_INTEL_ICH6_18:
+		return 1;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+static inline int ich_use_mmio(struct i810_card *card)
+{
+	return is_new_ich(card->pci_id) && card->use_mmio;
+}
+
 /**
  *	i810_ac97_power_up_bus	-	bring up AC97 link
  *	@card : ICH audio device to power up
@@ -2796,9 +2797,7 @@
 	 */	
 	/* see i810_ac97_init for the next 7 lines (jsaw) */
 	inw(card->ac97base);
-	if ((card->pci_id == PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH5 ||
-	     card->pci_id == PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH6_3)
-	    && (card->use_mmio)) {
+	if (ich_use_mmio(card)) {
 		primary_codec_id = (int) readl(card->iobase_mmio + SDM) & 0x3;
 		printk(KERN_INFO "i810_audio: Primary codec has ID %d\n",
 		       primary_codec_id);
@@ -2867,9 +2866,7 @@
 		   possible IO channels. Bit 0:1 of SDM then holds the 
 		   last codec ID spoken to. 
 		*/
-		if ((card->pci_id == PCI_DEVICE_ID_INTEL_ICH4 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH5 ||
-		     card->pci_id == PCI_DEVICE_ID_INTEL_ESB_5 || card->pci_id == PCI_DEVICE_ID_INTEL_ICH6_3)
-		    && (card->use_mmio)) {
+		if (ich_use_mmio(card)) {
 			ac97_id = (int) readl(card->iobase_mmio + SDM) & 0x3;
 			printk(KERN_INFO "i810_audio: Connection %d with codec id %d\n",
 			       num_ac97, ac97_id);
@@ -3065,7 +3062,7 @@
 			goto config_out;
 		}
 		dmabuf->count = dmabuf->dmasize;
-		CIV_TO_LVI(card->iobase+dmabuf->write_channel->port, 31);
+		CIV_TO_LVI(card->iobase+dmabuf->write_channel->port, -1);
 		local_irq_save(flags);
 		start_dac(state);
 		offset = i810_get_dma_addr(state, 0);
diff -Nru a/sound/oss/ics2101.c b/sound/oss/ics2101.c
--- a/sound/oss/ics2101.c	Tue Jun 15 22:20:37 2004
+++ b/sound/oss/ics2101.c	Tue Jun 15 22:20:37 2004
@@ -117,14 +117,14 @@
 	return vol;
 }
 
-static int ics2101_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int ics2101_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	int val;
 	
 	if (((cmd >> 8) & 0xff) == 'M') {
 		if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
 			
-			if (get_user(val, (int *)arg))
+			if (get_user(val, (int __user *)arg))
 				return -EFAULT;
 			switch (cmd & 0xff) {
 			case SOUND_MIXER_RECSRC:
@@ -153,7 +153,7 @@
 			default:
 				return -EINVAL;
 			}
-			return put_user(val, (int *)arg);
+			return put_user(val, (int __user *)arg);
 		} else {
 			switch (cmd & 0xff) {
 				/*
@@ -201,7 +201,7 @@
 			default:
 				return -EINVAL;
 			}
-			return put_user(val, (int *)arg);
+			return put_user(val, (int __user *)arg);
 		}
 	}
 	return -EINVAL;
diff -Nru a/sound/oss/kahlua.c b/sound/oss/kahlua.c
--- a/sound/oss/kahlua.c	Tue Jun 15 22:20:59 2004
+++ b/sound/oss/kahlua.c	Tue Jun 15 22:20:59 2004
@@ -218,7 +218,7 @@
 
 static void __devexit kahlua_cleanup_module(void)
 {
-	return pci_unregister_driver(&kahlua_driver);
+	pci_unregister_driver(&kahlua_driver);
 }
 
 
diff -Nru a/sound/oss/maestro.c b/sound/oss/maestro.c
--- a/sound/oss/maestro.c	Tue Jun 15 22:20:44 2004
+++ b/sound/oss/maestro.c	Tue Jun 15 22:20:44 2004
@@ -2025,7 +2025,9 @@
 static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long arg)
 {
 	int i, val=0;
-       unsigned long flags;
+	unsigned long flags;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_CARD(card);
         if (cmd == SOUND_MIXER_INFO) {
@@ -2034,7 +2036,7 @@
 		strlcpy(info.id, card_names[card->card_type], sizeof(info.id));
 		strlcpy(info.name, card_names[card->card_type], sizeof(info.name));
 		info.modify_counter = card->mix.modcnt;
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user(argp, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
@@ -2043,12 +2045,12 @@
 		memset(&info, 0, sizeof(info));
 		strlcpy(info.id, card_names[card->card_type], sizeof(info.id));
 		strlcpy(info.name, card_names[card->card_type], sizeof(info.name));
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user(argp, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
 	if (cmd == OSS_GETVERSION)
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
@@ -2098,7 +2100,7 @@
 
 			break;
 		}
-		return put_user(val,(int *)arg);
+		return put_user(val, p);
 	}
 	
         if (_IOC_DIR(cmd) != (_IOC_WRITE|_IOC_READ))
@@ -2106,7 +2108,7 @@
 	
 	card->mix.modcnt++;
 
-	if (get_user(val, (int *)arg))
+	if (get_user(val, p))
 		return -EFAULT;
 
 	switch (_IOC_NR(cmd)) {
@@ -2262,7 +2264,7 @@
 	to be copied to the user's buffer.  it is filled by the interrupt
 	handler and drained by this loop. */
 static ssize_t 
-ess_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+ess_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct ess_state *s = (struct ess_state *)file->private_data;
 	ssize_t ret;
@@ -2361,7 +2363,7 @@
 }
 
 static ssize_t 
-ess_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+ess_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct ess_state *s = (struct ess_state *)file->private_data;
 	ssize_t ret;
@@ -2539,6 +2541,8 @@
         count_info cinfo;
 	int val, mapped, ret;
 	unsigned char fmtm, fmtd;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 /*	printk("maestro: ess_ioctl: cmd %d\n", cmd);*/
 	
@@ -2547,7 +2551,7 @@
 		((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		if (file->f_mode & FMODE_WRITE)
@@ -2559,7 +2563,7 @@
 		return 0;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
 		
         case SNDCTL_DSP_RESET:
 		if (file->f_mode & FMODE_WRITE) {
@@ -2575,7 +2579,7 @@
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			if (file->f_mode & FMODE_READ) {
@@ -2589,10 +2593,10 @@
 				set_dac_rate(s, val);
 			}
 		}
-		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
 		
         case SNDCTL_DSP_STEREO:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		fmtd = 0;
 		fmtm = ~0;
@@ -2616,7 +2620,7 @@
 		return 0;
 
         case SNDCTL_DSP_CHANNELS:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			fmtd = 0;
@@ -2640,13 +2644,13 @@
 			set_fmt(s, fmtm, fmtd);
 		}
 		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) 
-					   : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg);
+					   : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p);
 		
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(AFMT_U8|AFMT_S16_LE, (int *)arg);
+                return put_user(AFMT_U8|AFMT_S16_LE, p);
 		
 	case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			fmtd = 0;
@@ -2678,7 +2682,7 @@
 			: (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 
 				AFMT_S16_LE : 
 				AFMT_U8, 
-			(int *)arg);
+			p);
 		
 	case SNDCTL_DSP_POST:
                 return 0;
@@ -2689,10 +2693,10 @@
 			val |= PCM_ENABLE_INPUT;
 		if ((file->f_mode & FMODE_WRITE) && (s->enable & DAC_RUNNING)) 
 			val |= PCM_ENABLE_OUTPUT;
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 		
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			if (val & PCM_ENABLE_INPUT) {
@@ -2724,7 +2728,7 @@
                 abinfo.fragstotal = s->dma_dac.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
@@ -2738,7 +2742,7 @@
                 abinfo.fragstotal = s->dma_adc.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 		
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -2753,7 +2757,7 @@
 		ess_update_ptr(s);
                 val = s->dma_dac.count;
 		spin_unlock_irqrestore(&s->lock, flags);
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
         case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -2768,7 +2772,7 @@
 		if (s->dma_adc.mapped)
 			s->dma_adc.count &= s->dma_adc.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -2785,7 +2789,7 @@
 		if (s->dma_dac.mapped)
 			s->dma_dac.count &= s->dma_dac.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -2793,14 +2797,14 @@
 		if (file->f_mode & FMODE_WRITE) {
 			if ((val = prog_dmabuf(s, 0)))
 				return val;
-			return put_user(s->dma_dac.fragsize, (int *)arg);
+			return put_user(s->dma_dac.fragsize, p);
 		}
 		if ((val = prog_dmabuf(s, 1)))
 			return val;
-		return put_user(s->dma_adc.fragsize, (int *)arg);
+		return put_user(s->dma_adc.fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		M_printk("maestro: SETFRAGMENT: %0x\n",val);
 		if (file->f_mode & FMODE_READ) {
@@ -2829,7 +2833,7 @@
 		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
 		    (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision))
 			return -EINVAL;
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -2840,15 +2844,15 @@
 		return 0;
 
         case SOUND_PCM_READ_RATE:
-		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
 
         case SOUND_PCM_READ_CHANNELS:
 		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) 
-					   : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg);
+					   : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p);
 
         case SOUND_PCM_READ_BITS:
 		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_16BIT << ESS_ADC_SHIFT) 
-					   : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, (int *)arg);
+					   : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, p);
 
         case SOUND_PCM_WRITE_FILTER:
         case SNDCTL_DSP_SETSYNCRO:
diff -Nru a/sound/oss/maestro3.c b/sound/oss/maestro3.c
--- a/sound/oss/maestro3.c	Tue Jun 15 22:20:58 2004
+++ b/sound/oss/maestro3.c	Tue Jun 15 22:20:58 2004
@@ -1324,7 +1324,7 @@
     return 0;
 }
 
-static ssize_t m3_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t m3_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
     struct m3_state *s = (struct m3_state *)file->private_data;
     ssize_t ret;
@@ -1405,7 +1405,7 @@
     return ret;
 }
 
-static ssize_t m3_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t m3_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
     struct m3_state *s = (struct m3_state *)file->private_data;
     ssize_t ret;
@@ -1584,6 +1584,8 @@
     count_info cinfo;
     int val, mapped, ret;
     unsigned char fmtm, fmtd;
+    void __user *argp = (void __user *)arg;
+    int __user *p = argp;
 
     VALIDATE_STATE(s);
 
@@ -1594,7 +1596,7 @@
 
     switch (cmd) {
     case OSS_GETVERSION:
-        return put_user(SOUND_VERSION, (int *)arg);
+        return put_user(SOUND_VERSION, p);
 
     case SNDCTL_DSP_SYNC:
         if (file->f_mode & FMODE_WRITE)
@@ -1606,7 +1608,7 @@
         return 0;
 
     case SNDCTL_DSP_GETCAPS:
-        return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+        return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
         
     case SNDCTL_DSP_RESET:
         spin_lock_irqsave(&card->lock, flags);
@@ -1624,7 +1626,7 @@
         return 0;
 
     case SNDCTL_DSP_SPEED:
-        get_user_ret(val, (int *)arg, -EFAULT);
+        get_user_ret(val, p, -EFAULT);
         spin_lock_irqsave(&card->lock, flags);
         if (val >= 0) {
             if (file->f_mode & FMODE_READ) {
@@ -1639,10 +1641,10 @@
             }
         }
         spin_unlock_irqrestore(&card->lock, flags);
-        return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+        return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
         
     case SNDCTL_DSP_STEREO:
-        get_user_ret(val, (int *)arg, -EFAULT);
+        get_user_ret(val, p, -EFAULT);
         spin_lock_irqsave(&card->lock, flags);
         fmtd = 0;
         fmtm = ~0;
@@ -1667,7 +1669,7 @@
         return 0;
 
     case SNDCTL_DSP_CHANNELS:
-        get_user_ret(val, (int *)arg, -EFAULT);
+        get_user_ret(val, p, -EFAULT);
         spin_lock_irqsave(&card->lock, flags);
         if (val != 0) {
             fmtd = 0;
@@ -1692,13 +1694,13 @@
         }
         spin_unlock_irqrestore(&card->lock, flags);
         return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) 
-                       : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg);
+                       : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p);
         
     case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-        return put_user(AFMT_U8|AFMT_S16_LE, (int *)arg);
+        return put_user(AFMT_U8|AFMT_S16_LE, p);
         
     case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-        get_user_ret(val, (int *)arg, -EFAULT);
+        get_user_ret(val, p, -EFAULT);
         spin_lock_irqsave(&card->lock, flags);
         if (val != AFMT_QUERY) {
             fmtd = 0;
@@ -1727,7 +1729,7 @@
             : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 
                 AFMT_S16_LE : 
                 AFMT_U8, 
-            (int *)arg);
+            p);
         
     case SNDCTL_DSP_POST:
         return 0;
@@ -1738,10 +1740,10 @@
             val |= PCM_ENABLE_INPUT;
         if ((file->f_mode & FMODE_WRITE) && (s->enable & DAC_RUNNING)) 
             val |= PCM_ENABLE_OUTPUT;
-        return put_user(val, (int *)arg);
+        return put_user(val, p);
         
     case SNDCTL_DSP_SETTRIGGER:
-        get_user_ret(val, (int *)arg, -EFAULT);
+        get_user_ret(val, p, -EFAULT);
         if (file->f_mode & FMODE_READ) {
             if (val & PCM_ENABLE_INPUT) {
                 if (!s->dma_adc.ready && (ret =  prog_dmabuf(s, 1)))
@@ -1772,7 +1774,7 @@
         abinfo.fragstotal = s->dma_dac.numfrag;
         abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift;      
         spin_unlock_irqrestore(&card->lock, flags);
-        return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+        return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
     case SNDCTL_DSP_GETISPACE:
         if (!(file->f_mode & FMODE_READ))
@@ -1786,7 +1788,7 @@
         abinfo.fragstotal = s->dma_adc.numfrag;
         abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;      
         spin_unlock_irqrestore(&card->lock, flags);
-        return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+        return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
         
     case SNDCTL_DSP_NONBLOCK:
         file->f_flags |= O_NONBLOCK;
@@ -1799,7 +1801,7 @@
         m3_update_ptr(s);
         val = s->dma_dac.count;
         spin_unlock_irqrestore(&card->lock, flags);
-        return put_user(val, (int *)arg);
+        return put_user(val, p);
 
     case SNDCTL_DSP_GETIPTR:
         if (!(file->f_mode & FMODE_READ))
@@ -1812,7 +1814,7 @@
         if (s->dma_adc.mapped)
             s->dma_adc.count &= s->dma_adc.fragsize-1;
         spin_unlock_irqrestore(&card->lock, flags);
-	if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+	if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 		return -EFAULT;
 	return 0;
 
@@ -1827,7 +1829,7 @@
         if (s->dma_dac.mapped)
             s->dma_dac.count &= s->dma_dac.fragsize-1;
         spin_unlock_irqrestore(&card->lock, flags);
-	if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+	if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 		return -EFAULT;
 	return 0;
 
@@ -1835,14 +1837,14 @@
         if (file->f_mode & FMODE_WRITE) {
             if ((val = prog_dmabuf(s, 0)))
                 return val;
-            return put_user(s->dma_dac.fragsize, (int *)arg);
+            return put_user(s->dma_dac.fragsize, p);
         }
         if ((val = prog_dmabuf(s, 1)))
             return val;
-        return put_user(s->dma_adc.fragsize, (int *)arg);
+        return put_user(s->dma_adc.fragsize, p);
 
     case SNDCTL_DSP_SETFRAGMENT:
-        get_user_ret(val, (int *)arg, -EFAULT);
+        get_user_ret(val, p, -EFAULT);
         spin_lock_irqsave(&card->lock, flags);
         if (file->f_mode & FMODE_READ) {
             s->dma_adc.ossfragshift = val & 0xffff;
@@ -1871,7 +1873,7 @@
         if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
             (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision))
             return -EINVAL;
-                get_user_ret(val, (int *)arg, -EFAULT);
+                get_user_ret(val, p, -EFAULT);
         if (val != 1 && val != 2 && val != 4)
             return -EINVAL;
         if (file->f_mode & FMODE_READ)
@@ -1881,15 +1883,15 @@
         return 0;
 
     case SOUND_PCM_READ_RATE:
-        return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+        return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
 
     case SOUND_PCM_READ_CHANNELS:
         return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_STEREO << ESS_ADC_SHIFT) 
-                       : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, (int *)arg);
+                       : (ESS_FMT_STEREO << ESS_DAC_SHIFT))) ? 2 : 1, p);
 
     case SOUND_PCM_READ_BITS:
         return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (ESS_FMT_16BIT << ESS_ADC_SHIFT) 
-                       : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, (int *)arg);
+                       : (ESS_FMT_16BIT << ESS_DAC_SHIFT))) ? 16 : 8, p);
 
     case SOUND_PCM_WRITE_FILTER:
     case SNDCTL_DSP_SETSYNCRO:
diff -Nru a/sound/oss/maui.c b/sound/oss/maui.c
--- a/sound/oss/maui.c	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/maui.c	Tue Jun 15 22:20:43 2004
@@ -53,7 +53,7 @@
 #define STAT_RX_AVAIL	0x02
 #define STAT_RX_IENA	0x01
 
-static int      (*orig_load_patch) (int dev, int format, const char *addr,
+static int      (*orig_load_patch)(int dev, int format, const char __user *addr,
 			      int offs, int count, int pmgr_flag) = NULL;
 
 #include "maui_boot.h"
@@ -242,7 +242,7 @@
 	return 0;
 }
 
-static int maui_load_patch(int dev, int format, const char *addr,
+static int maui_load_patch(int dev, int format, const char __user *addr,
 		int offs, int count, int pmgr_flag)
 {
 
@@ -282,7 +282,7 @@
 	for (i = 0; i < left; i++) {
 		unsigned char   data;
 
-		if(get_user(*(unsigned char *) &data, (unsigned char *) &((addr)[hdr_size + i])))
+		if(get_user(*(unsigned char *) &data, (unsigned char __user *) &((addr)[hdr_size + i])))
 			return -EFAULT;
 		if (i == 0 && !(data & 0x80))
 			return -EINVAL;
diff -Nru a/sound/oss/midi_synth.c b/sound/oss/midi_synth.c
--- a/sound/oss/midi_synth.c	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/midi_synth.c	Tue Jun 15 22:20:41 2004
@@ -256,7 +256,7 @@
 	 */
 }
 
-int midi_synth_ioctl(int dev, unsigned int cmd, caddr_t arg)
+int midi_synth_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	/*
 	 * int orig_dev = synth_devs[dev]->midi_dev;
@@ -466,7 +466,7 @@
 }
 
 int
-midi_synth_load_patch(int dev, int format, const char *addr,
+midi_synth_load_patch(int dev, int format, const char __user *addr,
 		      int offs, int count, int pmgr_flag)
 {
 	int             orig_dev = synth_devs[dev]->midi_dev;
@@ -514,7 +514,7 @@
 	{
 		unsigned char   data;
 
-		get_user(*(unsigned char *) &data, (unsigned char *) &((addr)[hdr_size + i]));
+		get_user(*(unsigned char *) &data, (unsigned char __user *) &((addr)[hdr_size + i]));
 
 		eox_seen = (i > 0 && data & 0x80);	/* End of sysex */
 
diff -Nru a/sound/oss/midi_synth.h b/sound/oss/midi_synth.h
--- a/sound/oss/midi_synth.h	Tue Jun 15 22:20:37 2004
+++ b/sound/oss/midi_synth.h	Tue Jun 15 22:20:37 2004
@@ -1,5 +1,5 @@
 int midi_synth_ioctl (int dev,
-	    unsigned int cmd, caddr_t arg);
+	    unsigned int cmd, void __user * arg);
 int midi_synth_kill_note (int dev, int channel, int note, int velocity);
 int midi_synth_set_instr (int dev, int channel, int instr_no);
 int midi_synth_start_note (int dev, int channel, int note, int volume);
@@ -7,7 +7,7 @@
 int midi_synth_open (int dev, int mode);
 void midi_synth_close (int dev);
 void midi_synth_hw_control (int dev, unsigned char *event);
-int midi_synth_load_patch (int dev, int format, const char * addr,
+int midi_synth_load_patch (int dev, int format, const char __user * addr,
 		 int offs, int count, int pmgr_flag);
 void midi_synth_panning (int dev, int channel, int pressure);
 void midi_synth_aftertouch (int dev, int channel, int pressure);
diff -Nru a/sound/oss/midibuf.c b/sound/oss/midibuf.c
--- a/sound/oss/midibuf.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/midibuf.c	Tue Jun 15 22:20:39 2004
@@ -256,7 +256,7 @@
 	module_put(midi_devs[dev]->owner);
 }
 
-int MIDIbuf_write(int dev, struct file *file, const char *buf, int count)
+int MIDIbuf_write(int dev, struct file *file, const char __user *buf, int count)
 {
 	int c, n, i;
 	unsigned char tmp_data;
@@ -310,7 +310,7 @@
 }
 
 
-int MIDIbuf_read(int dev, struct file *file, char *buf, int count)
+int MIDIbuf_read(int dev, struct file *file, char __user *buf, int count)
 {
 	int n, c = 0;
 	unsigned char tmp_data;
@@ -359,7 +359,7 @@
 }
 
 int MIDIbuf_ioctl(int dev, struct file *file,
-		  unsigned int cmd, caddr_t arg)
+		  unsigned int cmd, void __user *arg)
 {
 	int val;
 
@@ -377,13 +377,13 @@
 		switch (cmd) 
 		{
 			case SNDCTL_MIDI_PRETIME:
-				if (get_user(val, (int *)arg))
+				if (get_user(val, (int __user *)arg))
 					return -EFAULT;
 				if (val < 0)
 					val = 0;
 				val = (HZ * val) / 10;
 				parms[dev].prech_timeout = val;
-				return put_user(val, (int *)arg);
+				return put_user(val, (int __user *)arg);
 			
 			default:
 				if (!midi_devs[dev]->ioctl)
diff -Nru a/sound/oss/mpu401.c b/sound/oss/mpu401.c
--- a/sound/oss/mpu401.c	Tue Jun 15 22:21:02 2004
+++ b/sound/oss/mpu401.c	Tue Jun 15 22:21:02 2004
@@ -728,7 +728,7 @@
 	return 0;
 }
 
-static int mpu401_ioctl(int dev, unsigned cmd, caddr_t arg)
+static int mpu401_ioctl(int dev, unsigned cmd, void __user *arg)
 {
 	struct mpu_config *devc;
 	mpu_command_rec rec;
@@ -742,7 +742,7 @@
 				printk(KERN_WARNING "mpu401: Intelligent mode not supported by the HW\n");
 				return -EINVAL;
 			}
-			if (get_user(val, (int *)arg))
+			if (get_user(val, (int __user *)arg))
 				return -EFAULT;
 			set_uart_mode(dev, devc, !val);
 			return 0;
@@ -772,8 +772,7 @@
 				 */
 }
 
-static int mpu_synth_ioctl(int dev,
-		unsigned int cmd, caddr_t arg)
+static int mpu_synth_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	int midi_dev;
 	struct mpu_config *devc;
@@ -789,8 +788,7 @@
 	{
 
 		case SNDCTL_SYNTH_INFO:
-			if (copy_to_user((&((char *) arg)[0]),
-					(char *) &mpu_synth_info[midi_dev],
+			if (copy_to_user(arg, &mpu_synth_info[midi_dev],
 					sizeof(struct synth_info)))
 				return -EFAULT;
 			return 0;
@@ -1508,17 +1506,19 @@
 	return curr_ticks;
 }
 
-static int mpu_timer_ioctl(int dev, unsigned int command, caddr_t arg)
+static int mpu_timer_ioctl(int dev, unsigned int command, void __user *arg)
 {
 	int midi_dev = sound_timer_devs[dev]->devlink;
+	int __user *p = (int __user *)arg;
 
 	switch (command)
 	{
 		case SNDCTL_TMR_SOURCE:
 			{
 				int parm;
-	
-				parm = *(int *) arg;
+
+				if (get_user(parm, p))
+					return -EFAULT;
 				parm &= timer_caps;
 
 				if (parm != 0)
@@ -1530,7 +1530,9 @@
 					else if (timer_mode & TMR_MODE_SMPTE)
 						mpu_cmd(midi_dev, 0x3d, 0);		/* Use SMPTE sync */
 				}
-				return (*(int *) arg = timer_mode);
+				if (put_user(timer_mode, p))
+					return -EFAULT;
+				return timer_mode;
 			}
 			break;
 
@@ -1554,11 +1556,13 @@
 		case SNDCTL_TMR_TIMEBASE:
 			{
 				int val;
-
-				val = *(int *) arg;
+				if (get_user(val, p))
+					return -EFAULT;
 				if (val)
 					set_timebase(midi_dev, val);
-				return (*(int *) arg = curr_timebase);
+				if (put_user(curr_timebase, p))
+					return -EFAULT;
+				return curr_timebase;
 			}
 			break;
 
@@ -1567,7 +1571,8 @@
 				int val;
 				int ret;
 
-				val = *(int *) arg;
+				if (get_user(val, p))
+					return -EFAULT;
 
 				if (val)
 				{
@@ -1582,26 +1587,35 @@
 					}
 					curr_tempo = val;
 				}
-				return (*(int *) arg = curr_tempo);
+				if (put_user(curr_tempo, p))
+					return -EFAULT;
+				return curr_tempo;
 			}
 			break;
 
 		case SNDCTL_SEQ_CTRLRATE:
 			{
 				int val;
+				if (get_user(val, p))
+					return -EFAULT;
 
-				val = *(int *) arg;
 				if (val != 0)		/* Can't change */
 					return -EINVAL;
-				return (*(int *) arg = ((curr_tempo * curr_timebase) + 30) / 60);
+				val = ((curr_tempo * curr_timebase) + 30)/60;
+				if (put_user(val, p))
+					return -EFAULT;
+				return val;
 			}
 			break;
 
 		case SNDCTL_SEQ_GETTIME:
-			return (*(int *) arg = curr_ticks);
+			if (put_user(curr_ticks, p))
+				return -EFAULT;
+			return curr_ticks;
 
 		case SNDCTL_TMR_METRONOME:
-			metronome_mode = *(int *) arg;
+			if (get_user(metronome_mode, p))
+				return -EFAULT;
 			setup_metronome(midi_dev);
 			return 0;
 
diff -Nru a/sound/oss/msnd.c b/sound/oss/msnd.c
--- a/sound/oss/msnd.c	Tue Jun 15 22:20:38 2004
+++ b/sound/oss/msnd.c	Tue Jun 15 22:20:38 2004
@@ -59,9 +59,6 @@
 
 	devs[i] = dev;
 	++num_devs;
-
-	MOD_INC_USE_COUNT;
-
 	return 0;
 }
 
@@ -80,8 +77,6 @@
 
 	devs[i] = NULL;
 	--num_devs;
-
-	MOD_DEC_USE_COUNT;
 }
 
 int msnd_get_num_devs(void)
@@ -144,13 +139,10 @@
 	f->len = f->tail = f->head = 0;
 }
 
-int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user)
+int msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len)
 {
 	int count = 0;
 
-	if (f->len == f->n)
-		return 0;
-
 	while ((count < len) && (f->len != f->n)) {
 
 		int nwritten;
@@ -166,11 +158,7 @@
 				nwritten = len - count;
 		}
 
-		if (user) {
-			if (copy_from_user(f->data + f->tail, buf, nwritten))
-				return -EFAULT;
-		} else
-			isa_memcpy_fromio(f->data + f->tail, (unsigned long) buf, nwritten);
+		isa_memcpy_fromio(f->data + f->tail, (unsigned long) buf, nwritten);
 
 		count += nwritten;
 		buf += nwritten;
@@ -182,13 +170,10 @@
 	return count;
 }
 
-int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len, int user)
+int msnd_fifo_read(msnd_fifo *f, char *buf, size_t len)
 {
 	int count = 0;
 
-	if (f->len == 0)
-		return f->len;
-
 	while ((count < len) && (f->len > 0)) {
 
 		int nread;
@@ -204,11 +189,7 @@
 				nread = len - count;
 		}
 
-		if (user) {
-			if (copy_to_user(buf, f->data + f->head, nread))
-				return -EFAULT;
-		} else
-			isa_memcpy_toio((unsigned long) buf, f->data + f->head, nread);
+		isa_memcpy_toio((unsigned long) buf, f->data + f->head, nread);
 
 		count += nread;
 		buf += nread;
diff -Nru a/sound/oss/msnd.h b/sound/oss/msnd.h
--- a/sound/oss/msnd.h	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/msnd.h	Tue Jun 15 22:20:41 2004
@@ -266,8 +266,8 @@
 void				msnd_fifo_free(msnd_fifo *f);
 int				msnd_fifo_alloc(msnd_fifo *f, size_t n);
 void				msnd_fifo_make_empty(msnd_fifo *f);
-int				msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len, int user);
-int				msnd_fifo_read(msnd_fifo *f, char *buf, size_t len, int user);
+int				msnd_fifo_write(msnd_fifo *f, const char *buf, size_t len);
+int				msnd_fifo_read(msnd_fifo *f, char *buf, size_t len);
 
 int				msnd_wait_TXDE(multisound_dev_t *dev);
 int				msnd_wait_HC0(multisound_dev_t *dev);
diff -Nru a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
--- a/sound/oss/msnd_pinnacle.c	Tue Jun 15 22:20:42 2004
+++ b/sound/oss/msnd_pinnacle.c	Tue Jun 15 22:20:42 2004
@@ -212,6 +212,7 @@
 	LPDAQD lpDAQ, lpDARQ;
         audio_buf_info abinfo;
 	unsigned long flags;
+	int __user *p = (int __user *)arg;
 
 	lpDAQ = dev.base + DAPQ_DATA_BUFF;
 	lpDARQ = dev.base + DARQ_DATA_BUFF;
@@ -238,7 +239,7 @@
                 abinfo.fragstotal = dev.DAPF.n / abinfo.fragsize;
                 abinfo.fragments = abinfo.bytes / abinfo.fragsize;
 		spin_unlock_irqrestore(&dev.lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
@@ -249,7 +250,7 @@
                 abinfo.fragstotal = dev.DARF.n / abinfo.fragsize;
                 abinfo.fragments = abinfo.bytes / abinfo.fragsize;
 		spin_unlock_irqrestore(&dev.lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_RESET:
 		dev.nresets = 0;
@@ -262,18 +263,18 @@
 
 	case SNDCTL_DSP_GETBLKSIZE:
 		tmp = dsp_get_frag_size();
-		if (put_user(tmp, (int *)arg))
+		if (put_user(tmp, p))
                         return -EFAULT;
 		return 0;
 
 	case SNDCTL_DSP_GETFMTS:
 		val = AFMT_S16_LE | AFMT_U8;
-		if (put_user(val, (int *)arg))
+		if (put_user(val, p))
 			return -EFAULT;
 		return 0;
 
 	case SNDCTL_DSP_SETFMT:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		if (file->f_mode & FMODE_WRITE)
@@ -285,7 +286,7 @@
 				? dev.rec_sample_size
 				: dsp_set_format(file, val);
 
-		if (put_user(data, (int *)arg))
+		if (put_user(data, p))
 			return -EFAULT;
 		return 0;
 
@@ -299,12 +300,12 @@
 
 	case SNDCTL_DSP_GETCAPS:
 		val = DSP_CAP_DUPLEX | DSP_CAP_BATCH;
-		if (put_user(val, (int *)arg))
+		if (put_user(val, p))
 			return -EFAULT;
 		return 0;
 
 	case SNDCTL_DSP_SPEED:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		if (val < 8000)
@@ -326,13 +327,13 @@
 		if (file->f_mode & FMODE_READ)
 			dev.rec_sample_rate = data;
 
-		if (put_user(data, (int *)arg))
+		if (put_user(data, p))
 			return -EFAULT;
 		return 0;
 
 	case SNDCTL_DSP_CHANNELS:
 	case SNDCTL_DSP_STEREO:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 
 		if (cmd == SNDCTL_DSP_CHANNELS) {
@@ -369,7 +370,7 @@
 		if (file->f_mode & FMODE_READ)
 			dev.rec_channels = data;
 
-		if (put_user(val, (int *)arg))
+		if (put_user(val, p))
 			return -EFAULT;
 		return 0;
 	}
@@ -565,13 +566,13 @@
 		mixer_info info;
 		set_mixer_info();
 		info.modify_counter = dev.mixer_mod_count;
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	} else if (cmd == SOUND_OLD_MIXER_INFO) {
 		_old_mixer_info info;
 		set_mixer_info();
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	} else if (cmd == SOUND_MIXER_PRIVATE1) {
@@ -584,19 +585,19 @@
 		if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
 			switch (cmd & 0xff) {
 			case SOUND_MIXER_RECSRC:
-				if (get_user(val, (int *)arg))
+				if (get_user(val, (int __user *)arg))
 					return -EFAULT;
 				val = set_recsrc(val);
 				break;
 
 			default:
-				if (get_user(val, (int *)arg))
+				if (get_user(val, (int __user *)arg))
 					return -EFAULT;
 				val = mixer_set(cmd & 0xff, val);
 				break;
 			}
 			++dev.mixer_mod_count;
-			return put_user(val, (int *)arg);
+			return put_user(val, (int __user *)arg);
 		} else {
 			switch (cmd & 0xff) {
 			case SOUND_MIXER_RECSRC:
@@ -638,7 +639,7 @@
 			}
 		}
 
-		return put_user(val, (int *)arg); 
+		return put_user(val, (int __user *)arg); 
 	}
 
 	return -EINVAL;
@@ -650,7 +651,7 @@
 
 	if (cmd == OSS_GETVERSION) {
 		int sound_version = SOUND_VERSION;
-		return put_user(sound_version, (int *)arg);
+		return put_user(sound_version, (int __user *)arg);
 	}
 
 	if (minor == dev.dsp_minor)
@@ -809,7 +810,7 @@
 
 static __inline__ int pack_DARQ_to_DARF(register int bank)
 {
-	register int size, n, timeout = 3;
+	register int size, timeout = 3;
 	register WORD wTmp;
 	LPDAQD DAQD;
 
@@ -830,13 +831,10 @@
 	/* Read data from the head (unprotected bank 1 access okay
            since this is only called inside an interrupt) */
 	outb(HPBLKSEL_1, dev.io + HP_BLKS);
-	if ((n = msnd_fifo_write(
+	msnd_fifo_write(
 		&dev.DARF,
 		(char *)(dev.base + bank * DAR_BUFF_SIZE),
-		size, 0)) <= 0) {
-		outb(HPBLKSEL_0, dev.io + HP_BLKS);
-		return n;
-	}
+		size);
 	outb(HPBLKSEL_0, dev.io + HP_BLKS);
 
 	return 1;
@@ -858,21 +856,16 @@
 		if (protect) {
 			/* Critical section: protect fifo in non-interrupt */
 			spin_lock_irqsave(&dev.lock, flags);
-			if ((n = msnd_fifo_read(
+			n = msnd_fifo_read(
 				&dev.DAPF,
 				(char *)(dev.base + bank_num * DAP_BUFF_SIZE),
-				DAP_BUFF_SIZE, 0)) < 0) {
-				spin_unlock_irqrestore(&dev.lock, flags);
-				return n;
-			}
+				DAP_BUFF_SIZE);
 			spin_unlock_irqrestore(&dev.lock, flags);
 		} else {
-			if ((n = msnd_fifo_read(
+			n = msnd_fifo_read(
 				&dev.DAPF,
 				(char *)(dev.base + bank_num * DAP_BUFF_SIZE),
-				DAP_BUFF_SIZE, 0)) < 0) {
-				return n;
-			}
+				DAP_BUFF_SIZE);
 		}
 		if (!n)
 			break;
@@ -896,33 +889,46 @@
 	return nbanks;
 }
 
-static int dsp_read(char *buf, size_t len)
+static int dsp_read(char __user *buf, size_t len)
 {
 	int count = len;
+	char *page = (char *)__get_free_page(PAGE_SIZE);
+
+	if (!page)
+		return -ENOMEM;
 
 	while (count > 0) {
-		int n;
+		int n, k;
 		unsigned long flags;
 
+		k = PAGE_SIZE;
+		if (k > count)
+			k = count;
+
 		/* Critical section: protect fifo in non-interrupt */
 		spin_lock_irqsave(&dev.lock, flags);
-		if ((n = msnd_fifo_read(&dev.DARF, buf, count, 1)) < 0) {
-			printk(KERN_WARNING LOGNAME ": FIFO read error\n");
-			spin_unlock_irqrestore(&dev.lock, flags);
-			return n;
-		}
+		n = msnd_fifo_read(&dev.DARF, page, k);
 		spin_unlock_irqrestore(&dev.lock, flags);
+		if (copy_to_user(buf, page, n)) {
+			free_page((unsigned long)page);
+			return -EFAULT;
+		}
 		buf += n;
 		count -= n;
 
+		if (n == k && count)
+			continue;
+
 		if (!test_bit(F_READING, &dev.flags) && dev.mode & FMODE_READ) {
 			dev.last_recbank = -1;
 			if (chk_send_dsp_cmd(&dev, HDEX_RECORD_START) == 0)
 				set_bit(F_READING, &dev.flags);
 		}
 
-		if (dev.rec_ndelay)
+		if (dev.rec_ndelay) {
+			free_page((unsigned long)page);
 			return count == len ? -EAGAIN : len - count;
+		}
 
 		if (count > 0) {
 			set_bit(F_READBLOCK, &dev.flags);
@@ -931,41 +937,57 @@
 				get_rec_delay_jiffies(DAR_BUFF_SIZE)))
 				clear_bit(F_READING, &dev.flags);
 			clear_bit(F_READBLOCK, &dev.flags);
-			if (signal_pending(current))
+			if (signal_pending(current)) {
+				free_page((unsigned long)page);
 				return -EINTR;
+			}
 		}
 	}
-
+	free_page((unsigned long)page);
 	return len - count;
 }
 
-static int dsp_write(const char *buf, size_t len)
+static int dsp_write(const char __user *buf, size_t len)
 {
 	int count = len;
+	char *page = (char *)__get_free_page(GFP_KERNEL);
+
+	if (!page)
+		return -ENOMEM;
 
 	while (count > 0) {
-		int n;
+		int n, k;
 		unsigned long flags;
 
+		k = PAGE_SIZE;
+		if (k > count)
+			k = count;
+
+		if (copy_from_user(page, buf, k)) {
+			free_page((unsigned long)page);
+			return -EFAULT;
+		}
+
 		/* Critical section: protect fifo in non-interrupt */
 		spin_lock_irqsave(&dev.lock, flags);
-		if ((n = msnd_fifo_write(&dev.DAPF, buf, count, 1)) < 0) {
-			printk(KERN_WARNING LOGNAME ": FIFO write error\n");
-			spin_unlock_irqrestore(&dev.lock, flags);
-			return n;
-		}
+		n = msnd_fifo_write(&dev.DAPF, page, k);
 		spin_unlock_irqrestore(&dev.lock, flags);
 		buf += n;
 		count -= n;
 
+		if (count && n == k)
+			continue;
+
 		if (!test_bit(F_WRITING, &dev.flags) && (dev.mode & FMODE_WRITE)) {
 			dev.last_playbank = -1;
 			if (pack_DAPF_to_DAPQ(1) > 0)
 				set_bit(F_WRITING, &dev.flags);
 		}
 
-		if (dev.play_ndelay)
+		if (dev.play_ndelay) {
+			free_page((unsigned long)page);
 			return count == len ? -EAGAIN : len - count;
+		}
 
 		if (count > 0) {
 			set_bit(F_WRITEBLOCK, &dev.flags);
@@ -973,15 +995,18 @@
 				&dev.writeblock,
 				get_play_delay_jiffies(DAP_BUFF_SIZE));
 			clear_bit(F_WRITEBLOCK, &dev.flags);
-			if (signal_pending(current))
+			if (signal_pending(current)) {
+				free_page((unsigned long)page);
 				return -EINTR;
+			}
 		}
 	}
 
+	free_page((unsigned long)page);
 	return len - count;
 }
 
-static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *off)
+static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off)
 {
 	int minor = iminor(file->f_dentry->d_inode);
 	if (minor == dev.dsp_minor)
@@ -990,7 +1015,7 @@
 		return -EINVAL;
 }
 
-static ssize_t dev_write(struct file *file, const char *buf, size_t count, loff_t *off)
+static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
 {
 	int minor = iminor(file->f_dentry->d_inode);
 	if (minor == dev.dsp_minor)
diff -Nru a/sound/oss/nm256_audio.c b/sound/oss/nm256_audio.c
--- a/sound/oss/nm256_audio.c	Tue Jun 15 22:20:40 2004
+++ b/sound/oss/nm256_audio.c	Tue Jun 15 22:20:40 2004
@@ -52,6 +52,7 @@
 /* These belong in linux/pci.h. */
 #define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
 #define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
+#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016
 
 /* List of cards.  */
 static struct nm256_info *nmcard_list;
@@ -928,7 +929,7 @@
  * mixer ioctl to the AC97 driver.
  */
 static int
-nm256_default_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg)
+nm256_default_mixer_ioctl (int dev, unsigned int cmd, void __user *arg)
 {
     struct nm256_info *card = nm256_find_card_for_mixer (dev);
     if (card != NULL)
@@ -1275,6 +1276,8 @@
 	return nm256_install(pcidev, REV_NM256AV, "256AV");
     if (pcidev->device == PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO)
 	return nm256_install(pcidev, REV_NM256ZX, "256ZX");
+    if (pcidev->device == PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO)
+	return nm256_install(pcidev, REV_NM256ZX, "256XL+");
     return -1; /* should not come here ... */
 }
 
@@ -1415,7 +1418,7 @@
 
 /* Standard ioctl handler. */
 static int
-nm256_audio_ioctl(int dev, unsigned int cmd, caddr_t arg)
+nm256_audio_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
     int ret;
     u32 oldinfo;
@@ -1439,7 +1442,7 @@
     switch (cmd)
 	{
 	case SOUND_PCM_WRITE_RATE:
-	    if (get_user(ret, (int *) arg))
+	    if (get_user(ret, (int __user *) arg))
 		return -EFAULT;
 
 	    if (ret != 0) {
@@ -1458,7 +1461,7 @@
 	    break;
 
 	case SNDCTL_DSP_STEREO:
-	    if (get_user(ret, (int *) arg))
+	    if (get_user(ret, (int __user *) arg))
 		return -EFAULT;
 
 	    card->sinfo[w].stereo = ret ? 1 : 0;
@@ -1469,7 +1472,7 @@
 	    break;
 
 	case SOUND_PCM_WRITE_CHANNELS:
-	    if (get_user(ret, (int *) arg))
+	    if (get_user(ret, (int __user *) arg))
 		return -EFAULT;
 
 	    if (ret < 1 || ret > 3)
@@ -1487,7 +1490,7 @@
 	    break;
 
 	case SNDCTL_DSP_SETFMT:
-	    if (get_user(ret, (int *) arg))
+	    if (get_user(ret, (int __user *) arg))
 		return -EFAULT;
 
 	    if (ret != 0) {
@@ -1508,7 +1511,7 @@
 	default:
 	    return -EINVAL;
 	}
-    return put_user(ret, (int *) arg);
+    return put_user(ret, (int __user *) arg);
 }
 
 /*
@@ -1661,6 +1664,8 @@
 	{PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO,
 	PCI_ANY_ID, PCI_ANY_ID, 0, 0},
 	{PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO,
+	PCI_ANY_ID, PCI_ANY_ID, 0, 0},
+	{PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO,
 	PCI_ANY_ID, PCI_ANY_ID, 0, 0},
 	{0,}
 };
diff -Nru a/sound/oss/opl3.c b/sound/oss/opl3.c
--- a/sound/oss/opl3.c	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/opl3.c	Tue Jun 15 22:20:41 2004
@@ -110,7 +110,7 @@
 	devc->v_alloc->max_voice = devc->nr_voice = 12;
 }
 
-static int opl3_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int opl3_ioctl(int dev, unsigned int cmd, void __user * arg)
 {
 	struct sbi_instrument ins;
 	
@@ -822,7 +822,7 @@
 {
 }
 
-static int opl3_load_patch(int dev, int format, const char *addr,
+static int opl3_load_patch(int dev, int format, const char __user *addr,
 		int offs, int count, int pmgr_flag)
 {
 	struct sbi_instrument ins;
@@ -833,7 +833,11 @@
 		return -EINVAL;
 	}
 
-	if(copy_from_user(&((char *) &ins)[offs], &(addr)[offs], sizeof(ins) - offs))
+	/*
+	 * What the fuck is going on here?  We leave junk in the beginning
+	 * of ins and then check the field pretty close to that beginning?
+	 */
+	if(copy_from_user(&((char *) &ins)[offs], addr + offs, sizeof(ins) - offs))
 		return -EFAULT;
 
 	if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR)
diff -Nru a/sound/oss/opl3sa2.c b/sound/oss/opl3sa2.c
--- a/sound/oss/opl3sa2.c	Tue Jun 15 22:20:36 2004
+++ b/sound/oss/opl3sa2.c	Tue Jun 15 22:20:36 2004
@@ -389,9 +389,10 @@
 }
 
 
-static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int opl3sa2_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	int retval, value, cmdf = cmd & 0xff;
+	int __user *p = (int __user *)arg;
 
 	opl3sa2_state_t* devc = &opl3sa2_state[dev];
 	
@@ -416,23 +417,23 @@
 	if (_SIOC_DIR (cmd) & _SIOC_WRITE) {
 		switch (cmdf) {
 			case SOUND_MIXER_VOLUME:
-				retval = get_user(value, (unsigned int *) arg);
+				retval = get_user(value, (unsigned __user *) arg);
 				if (retval)
 					break;
 				arg_to_vol_stereo(value, &devc->volume_l, &devc->volume_r);
 				opl3sa2_set_volume(devc, devc->volume_l, devc->volume_r);
 				value = ret_vol_stereo(devc->volume_l, devc->volume_r);
-				retval = put_user(value, (int *) arg);
+				retval = put_user(value, p);
 				break;
 		  
 			case SOUND_MIXER_MIC:
-				retval = get_user(value, (unsigned int *) arg);
+				retval = get_user(value, (unsigned __user *) arg);
 				if (retval)
 					break;
 				arg_to_vol_mono(value, &devc->mic);
 				opl3sa2_set_mic(devc, devc->mic);
 				value = ret_vol_mono(devc->mic);
-				retval = put_user(value, (int *) arg);
+				retval = put_user(value, p);
 				break;
 
 			default:
@@ -445,35 +446,35 @@
 		 */
 		switch (cmdf) {
 			case SOUND_MIXER_DEVMASK:
-				retval = put_user(SOUND_MASK_VOLUME | SOUND_MASK_MIC, (int *) arg);
+				retval = put_user(SOUND_MASK_VOLUME | SOUND_MASK_MIC, p);
 				break;
 		  
 			case SOUND_MIXER_STEREODEVS:
-				retval = put_user(SOUND_MASK_VOLUME, (int *) arg);
+				retval = put_user(SOUND_MASK_VOLUME, p);
 				break;
 		  
 			case SOUND_MIXER_RECMASK:
 				/* No recording devices */
-				retval = put_user(0, (int *) arg);
+				retval = put_user(0, p);
 				break;
 
 			case SOUND_MIXER_CAPS:
-				retval = put_user(SOUND_CAP_EXCL_INPUT, (int *) arg);
+				retval = put_user(SOUND_CAP_EXCL_INPUT, p);
 				break;
 
 			case SOUND_MIXER_RECSRC:
 				/* No recording source */
-				retval = put_user(0, (int *) arg);
+				retval = put_user(0, p);
 				break;
 
 			case SOUND_MIXER_VOLUME:
 				value = ret_vol_stereo(devc->volume_l, devc->volume_r);
-				retval = put_user(value, (int *) arg);
+				retval = put_user(value, p);
 				break;
 			  
 			case SOUND_MIXER_MIC:
 				value = ret_vol_mono(devc->mic);
-				put_user(value, (int *) arg);
+				put_user(value, p);
 				break;
 
 			default:
@@ -485,7 +486,7 @@
 /* opl3sa2_mixer_ioctl end */
 
 
-static int opl3sa3_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int opl3sa3_mixer_ioctl(int dev, unsigned int cmd, void __user * arg)
 {
 	int value, retval, cmdf = cmd & 0xff;
 
@@ -494,17 +495,17 @@
 	switch (cmdf) {
 	case SOUND_MIXER_BASS:
 		value = ret_vol_stereo(devc->bass_l, devc->bass_r);
-		retval = put_user(value, (int *) arg);
+		retval = put_user(value, (int __user *) arg);
 		break;
 		
 	case SOUND_MIXER_TREBLE:
 		value = ret_vol_stereo(devc->treble_l, devc->treble_r);
-		retval = put_user(value, (int *) arg);
+		retval = put_user(value, (int __user *) arg);
 		break;
 
 	case SOUND_MIXER_DIGITAL1:
 		value = ret_vol_stereo(devc->wide_l, devc->wide_r);
-		retval = put_user(value, (int *) arg);
+		retval = put_user(value, (int __user *) arg);
 		break;
 
 	default:
diff -Nru a/sound/oss/os.h b/sound/oss/os.h
--- a/sound/oss/os.h	Tue Jun 15 22:21:05 2004
+++ b/sound/oss/os.h	Tue Jun 15 22:21:05 2004
@@ -42,7 +42,7 @@
 
 #define USE_AUTOINIT_DMA
 
-extern caddr_t sound_mem_blocks[1024];
+extern void *sound_mem_blocks[1024];
 extern int sound_nblocks;
 
 #undef PSEUDO_DMA_AUTOINIT
diff -Nru a/sound/oss/pas2_mixer.c b/sound/oss/pas2_mixer.c
--- a/sound/oss/pas2_mixer.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/pas2_mixer.c	Tue Jun 15 22:20:39 2004
@@ -215,13 +215,14 @@
 	set_mode(0x04 | 0x01);
 }
 
-static int pas_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int pas_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	int level,v ;
+	int __user *p = (int __user *)arg;
 
 	DEB(printk("pas2_mixer.c: int pas_mixer_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
 	if (cmd == SOUND_MIXER_PRIVATE1) { /* Set loudness bit */
-		if (get_user(level, (int *)arg))
+		if (get_user(level, p))
 			return -EFAULT;
 		if (level == -1)  /* Return current settings */
 			level = (mode_control & 0x04);
@@ -232,10 +233,10 @@
 			set_mode(mode_control);
 		}
 		level = !!level;
-		return put_user(level, (int *)arg);
+		return put_user(level, p);
 	}
 	if (cmd == SOUND_MIXER_PRIVATE2) { /* Set enhance bit */
-		if (get_user(level, (int *)arg))
+		if (get_user(level, p))
 			return -EFAULT;
 		if (level == -1) { /* Return current settings */
 			if (!(mode_control & 0x03))
@@ -255,10 +256,10 @@
 				i = (i + 1) * 20;
 			level = i;
 		}
-		return put_user(level, (int *)arg);
+		return put_user(level, p);
 	}
 	if (cmd == SOUND_MIXER_PRIVATE3) { /* Set mute bit */
-		if (get_user(level, (int *)arg))
+		if (get_user(level, p))
 			return -EFAULT;
 		if (level == -1)	/* Return current settings */
 			level = !(pas_read(0x0B8A) & 0x20);
@@ -270,10 +271,10 @@
 
 			level = !(pas_read(0x0B8A) & 0x20);
 		}
-		return put_user(level, (int *)arg);
+		return put_user(level, p);
 	}
 	if (((cmd >> 8) & 0xff) == 'M') {
-		if (get_user(v, (int *)arg))
+		if (get_user(v, p))
 			return -EFAULT;
 		if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
 			v = pas_mixer_set(cmd & 0xff, v);
@@ -304,7 +305,7 @@
 				break;
 			}
 		}
-		return put_user(v, (int *)arg);
+		return put_user(v, p);
 	}
 	return -EINVAL;
 }
diff -Nru a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c
--- a/sound/oss/pas2_pcm.c	Tue Jun 15 22:20:38 2004
+++ b/sound/oss/pas2_pcm.c	Tue Jun 15 22:20:38 2004
@@ -17,6 +17,7 @@
 
 #include <linux/init.h>
 #include <linux/spinlock.h>
+#include <asm/timex.h>
 #include "sound_config.h"
 
 #include "pas2.h"
@@ -62,13 +63,13 @@
 
 	if (pcm_channels & 2)
 	{
-		foo = (596590 + (arg / 2)) / arg;
-		arg = (596590 + (foo / 2)) / foo;
+		foo = ((CLOCK_TICK_RATE / 2) + (arg / 2)) / arg;
+		arg = ((CLOCK_TICK_RATE / 2) + (foo / 2)) / foo;
 	}
 	else
 	{
-		foo = (1193180 + (arg / 2)) / arg;
-		arg = (1193180 + (foo / 2)) / foo;
+		foo = (CLOCK_TICK_RATE + (arg / 2)) / arg;
+		arg = (CLOCK_TICK_RATE + (foo / 2)) / foo;
 	}
 
 	pcm_speed = arg;
@@ -150,16 +151,17 @@
 	return pcm_bits;
 }
 
-static int pas_audio_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int pas_audio_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	int val, ret;
+	int __user *p = arg;
 
 	DEB(printk("pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
 
 	switch (cmd) 
 	{
 	case SOUND_PCM_WRITE_RATE:
-		if (get_user(val, (int *)arg)) 
+		if (get_user(val, p)) 
 			return -EFAULT;
 		ret = pcm_set_speed(val);
 		break;
@@ -169,13 +171,13 @@
 		break;
 		
 	case SNDCTL_DSP_STEREO:
-		if (get_user(val, (int *)arg)) 
+		if (get_user(val, p)) 
 			return -EFAULT;
 		ret = pcm_set_channels(val + 1) - 1;
 		break;
 
 	case SOUND_PCM_WRITE_CHANNELS:
-		if (get_user(val, (int *)arg)) 
+		if (get_user(val, p)) 
 			return -EFAULT;
 		ret = pcm_set_channels(val);
 		break;
@@ -185,7 +187,7 @@
 		break;
 
 	case SNDCTL_DSP_SETFMT:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		ret = pcm_set_bits(val);
 		break;
@@ -197,7 +199,7 @@
 	default:
 		return -EINVAL;
 	}
-	return put_user(ret, (int *)arg);
+	return put_user(ret, p);
 }
 
 static void pas_audio_reset(int dev)
diff -Nru a/sound/oss/pss.c b/sound/oss/pss.c
--- a/sound/oss/pss.c	Tue Jun 15 22:21:05 2004
+++ b/sound/oss/pss.c	Tue Jun 15 22:21:05 2004
@@ -453,20 +453,36 @@
 	}
 }
 
-static void arg_to_volume_mono(unsigned int volume, int *aleft)
+static int set_volume_mono(unsigned __user *p, int *aleft)
 {
 	int left;
+	unsigned volume;
+	if (get_user(volume, p))
+		return -EFAULT;
 	
-	left = volume & 0x00ff;
+	left = volume & 0xff;
 	if (left > 100)
 		left = 100;
 	*aleft = left;
+	return 0;
 }
 
-static void arg_to_volume_stereo(unsigned int volume, int *aleft, int *aright)
+static int set_volume_stereo(unsigned __user *p, int *aleft, int *aright)
 {
-	arg_to_volume_mono(volume, aleft);
-	arg_to_volume_mono(volume >> 8, aright);
+	int left, right;
+	unsigned volume;
+	if (get_user(volume, p))
+		return -EFAULT;
+
+	left = volume & 0xff;
+	if (left > 100)
+		left = 100;
+	right = (volume >> 8) & 0xff;
+	if (right > 100)
+		right = 100;
+	*aleft = left;
+	*aright = right;
+	return 0;
 }
 
 static int ret_vol_mono(int left)
@@ -479,7 +495,7 @@
 	return ((right << 8) | left);
 }
 
-static int call_ad_mixer(pss_confdata *devc,unsigned int cmd, caddr_t arg)
+static int call_ad_mixer(pss_confdata *devc,unsigned int cmd, void __user *arg)
 {
 	if (devc->ad_mixer_dev != NO_WSS_MIXER) 
 		return mixer_devs[devc->ad_mixer_dev]->ioctl(devc->ad_mixer_dev, cmd, arg);
@@ -487,7 +503,7 @@
 		return -EINVAL;
 }
 
-static int pss_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg)
+static int pss_mixer_ioctl (int dev, unsigned int cmd, void __user *arg)
 {
 	pss_confdata *devc = mixer_devs[dev]->devc;
 	int cmdf = cmd & 0xff;
@@ -513,33 +529,38 @@
 					return call_ad_mixer(devc, cmd, arg);
 				else
 				{
-					if (*(int *)arg != 0)
+					int v;
+					if (get_user(v, (int __user *)arg))
+						return -EFAULT;
+					if (v != 0)
 						return -EINVAL;
 					return 0;
 				}
 			case SOUND_MIXER_VOLUME:
-				arg_to_volume_stereo(*(unsigned int *)arg, &devc->mixer.volume_l,
-					&devc->mixer.volume_r); 
+				if (set_volume_stereo(arg,
+					&devc->mixer.volume_l,
+					&devc->mixer.volume_r))
+					return -EFAULT;
 				set_master_volume(devc, devc->mixer.volume_l,
 					devc->mixer.volume_r);
 				return ret_vol_stereo(devc->mixer.volume_l,
 					devc->mixer.volume_r);
 		  
 			case SOUND_MIXER_BASS:
-				arg_to_volume_mono(*(unsigned int *)arg,
-					&devc->mixer.bass);
+				if (set_volume_mono(arg, &devc->mixer.bass))
+					return -EFAULT;
 				set_bass(devc, devc->mixer.bass);
 				return ret_vol_mono(devc->mixer.bass);
 		  
 			case SOUND_MIXER_TREBLE:
-				arg_to_volume_mono(*(unsigned int *)arg,
-					&devc->mixer.treble);
+				if (set_volume_mono(arg, &devc->mixer.treble))
+					return -EFAULT;
 				set_treble(devc, devc->mixer.treble);
 				return ret_vol_mono(devc->mixer.treble);
 		  
 			case SOUND_MIXER_SYNTH:
-				arg_to_volume_mono(*(unsigned int *)arg,
-					&devc->mixer.synth);
+				if (set_volume_mono(arg, &devc->mixer.synth))
+					return -EFAULT;
 				set_synth_volume(devc, devc->mixer.synth);
 				return ret_vol_mono(devc->mixer.synth);
 		  
@@ -549,54 +570,67 @@
 	}
 	else			
 	{
+		int val, and_mask = 0, or_mask = 0;
 		/*
 		 * Return parameters
 		 */
 		switch (cmdf)
 		{
-
 			case SOUND_MIXER_DEVMASK:
 				if (call_ad_mixer(devc, cmd, arg) == -EINVAL)
-					*(int *)arg = 0; /* no mixer devices */
-				return (*(int *)arg |= SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE | SOUND_MASK_SYNTH);
+					break;
+				and_mask = ~0;
+				or_mask = SOUND_MASK_VOLUME | SOUND_MASK_BASS | SOUND_MASK_TREBLE | SOUND_MASK_SYNTH;
+				break;
 		  
 			case SOUND_MIXER_STEREODEVS:
 				if (call_ad_mixer(devc, cmd, arg) == -EINVAL)
-					*(int *)arg = 0; /* no stereo devices */
-				return (*(int *)arg |= SOUND_MASK_VOLUME);
+					break;
+				and_mask = ~0;
+				or_mask = SOUND_MASK_VOLUME;
+				break;
 		  
 			case SOUND_MIXER_RECMASK:
 				if (devc->ad_mixer_dev != NO_WSS_MIXER)
 					return call_ad_mixer(devc, cmd, arg);
-				else
-					return (*(int *)arg = 0); /* no record devices */
+				break;
 
 			case SOUND_MIXER_CAPS:
 				if (devc->ad_mixer_dev != NO_WSS_MIXER)
 					return call_ad_mixer(devc, cmd, arg);
-				else
-					return (*(int *)arg = SOUND_CAP_EXCL_INPUT);
+				or_mask = SOUND_CAP_EXCL_INPUT;
+				break;
 
 			case SOUND_MIXER_RECSRC:
 				if (devc->ad_mixer_dev != NO_WSS_MIXER)
 					return call_ad_mixer(devc, cmd, arg);
-				else
-					return (*(int *)arg = 0); /* no record source */
+				break;
 
 			case SOUND_MIXER_VOLUME:
-				return (*(int *)arg = ret_vol_stereo(devc->mixer.volume_l, devc->mixer.volume_r));
+				or_mask =  ret_vol_stereo(devc->mixer.volume_l, devc->mixer.volume_r);
+				break;
 			  
 			case SOUND_MIXER_BASS:
-				return (*(int *)arg = ret_vol_mono(devc->mixer.bass));
+				or_mask =  ret_vol_mono(devc->mixer.bass);
+				break;
 			  
 			case SOUND_MIXER_TREBLE:
-				return (*(int *)arg = ret_vol_mono(devc->mixer.treble));
+				or_mask = ret_vol_mono(devc->mixer.treble);
+				break;
 			  
 			case SOUND_MIXER_SYNTH:
-				return (*(int *)arg = ret_vol_mono(devc->mixer.synth));
+				or_mask = ret_vol_mono(devc->mixer.synth);
+				break;
 			default:
 				return -EINVAL;
 		}
+		if (get_user(val, (int __user *)arg))
+			return -EFAULT;
+		val &= and_mask;
+		val |= or_mask;
+		if (put_user(val, (int __user *)arg))
+			return -EFAULT;
+		return val;
 	}
 }
 
@@ -803,7 +837,7 @@
 	return 0;
 }
 
-static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, caddr_t arg, int local)
+static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, int local)
 {
 	copr_buffer *buf;
 	copr_msg *mbuf;
diff -Nru a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c
--- a/sound/oss/rme96xx.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/rme96xx.c	Tue Jun 15 22:20:39 2004
@@ -661,13 +661,13 @@
 }
 
 
-inline int rme96xx_copyfromuser(struct dmabuf* dma,const char* buffer,int count,int hop)
+inline int rme96xx_copyfromuser(struct dmabuf* dma,const char __user * buffer,int count,int hop)
 {
 	int swptr = dma->writeptr;
 	switch (dma->format) {
 	case AFMT_S32_BLOCKED:
 	{
-	     char* buf = (char*)buffer;
+	     char __user * buf = (char __user *)buffer;
 	     int cnt = count/dma->outchannels;
 	     int i;
 	     for (i=0;i < dma->outchannels;i++) {
@@ -686,7 +686,7 @@
 	     int i,j;
 	     int cnt = count/dma->outchannels;
 	     for (i=0;i < dma->outchannels + dma->mono;i++) {
-		     short* sbuf = (short*)buffer + i*(!dma->mono);
+		     short __user * sbuf = (short __user *)buffer + i*(!dma->mono);
 		     short* hwbuf =(short*) &dma->s->playbuf[(dma->outoffset + i)*RME96xx_DMA_MAX_SAMPLES];	     
 		     hwbuf+=(swptr>>1);
 		     for (j=0;j<(cnt>>1);j++) {
@@ -710,13 +710,13 @@
 }
 
 /* The count argument is the number of bytes */
-inline int rme96xx_copytouser(struct dmabuf* dma,const char* buffer,int count,int hop)
+inline int rme96xx_copytouser(struct dmabuf* dma,const char __user* buffer,int count,int hop)
 {
 	int swptr = dma->readptr;
 	switch (dma->format) {
 	case AFMT_S32_BLOCKED:
 	{
-	     char* buf = (char*)buffer;
+	     char __user * buf = (char __user *)buffer;
 	     int cnt = count/dma->inchannels;
 	     int i;
 
@@ -736,7 +736,7 @@
 	     int i,j;
 	     int cnt = count/dma->inchannels;
 	     for (i=0;i < dma->inchannels;i++) {
-		  short* sbuf = (short*)buffer + i;
+		  short __user * sbuf = (short __user *)buffer + i;
 		  short* hwbuf =(short*) &dma->s->recbuf[(dma->inoffset + i)*RME96xx_DMA_MAX_SAMPLES];	     
 		  hwbuf+=(swptr>>1);
 		  for (j=0;j<(cnt>>1);j++) {
@@ -1121,7 +1121,6 @@
 
 static int rme96xx_ioctl(struct inode *in, struct file *file, unsigned int cmd, unsigned long arg)
 {
-
 	struct dmabuf * dma = (struct dmabuf *)file->private_data; 
 	rme96xx_info *s = dma->s;
 	unsigned long flags;
@@ -1129,6 +1128,8 @@
         count_info cinfo;
 	int count;
 	int val = 0;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_STATE(s);
 
@@ -1136,7 +1137,7 @@
 
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 #if 0
@@ -1149,14 +1150,14 @@
 		return 0;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
 		
         case SNDCTL_DSP_RESET:
 //		rme96xx_clearbufs(dma);
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 /* generally it's not a problem if we change the speed 
@@ -1195,10 +1196,10 @@
 			spin_unlock_irqrestore(&s->lock, flags);
 		}
 		DBG(printk("speed set to %d\n",val));
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 		
         case SNDCTL_DSP_STEREO: /* this plays a mono file on two channels */
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		
 		if (!val) {
@@ -1216,7 +1217,7 @@
 		return 0;
         case SNDCTL_DSP_CHANNELS:
 		/* remember to check for resonable offset/channel pairs here */
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 
 		if (file->f_mode & FMODE_WRITE) { 			
@@ -1236,14 +1237,14 @@
 
 		dma->mono=0;
 
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 		
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(RME96xx_FMT, (int *)arg);
+                return put_user(RME96xx_FMT, p);
 		
 	case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
 		DBG(printk("setting to format %x\n",val)); 
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			if (val & RME96xx_FMT)
@@ -1257,7 +1258,7 @@
 				break;
 			}
 		}
-		return put_user(dma->format, (int *)arg);
+		return put_user(dma->format, p);
 		
 	case SNDCTL_DSP_POST:
                 return 0;
@@ -1270,10 +1271,10 @@
 		if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN) 
 			val |= PCM_ENABLE_OUTPUT;
 #endif
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 		
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 #if 0
 		if (file->f_mode & FMODE_READ) {
@@ -1309,7 +1310,7 @@
                 abinfo.fragstotal = 2;
                 abinfo.fragments = (count > s->fragsize); 
 
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
@@ -1323,7 +1324,7 @@
                 abinfo.bytes = (count*dma->inchannels)>>dma->formatshift;
                 abinfo.fragstotal = 2;
                 abinfo.fragments = count > s->fragsize; 
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 		
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -1339,7 +1340,7 @@
 		if (count < 0)
 			count += s->fragsize<<1;
 
-		return put_user(count, (int *)arg);
+		return put_user(count, p);
 
 
 /* check out how to use mmaped mode (can only be blocked !!!) */
@@ -1359,7 +1360,7 @@
 			dma->readptr &= s->fragsize<<1;
 		spin_unlock_irqrestore(&s->lock,flags);
 
-                if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+                if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1378,14 +1379,14 @@
 		if (dma->mmapped)
 			dma->writeptr &= s->fragsize<<1;
 		spin_unlock_irqrestore(&s->lock,flags);
-                if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+                if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
         case SNDCTL_DSP_GETBLKSIZE:
-	     return put_user(s->fragsize, (int *)arg);
+	     return put_user(s->fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		val&=0xffff;
 		val -= 7;
@@ -1399,7 +1400,7 @@
 		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
 		    (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision))
 			return -EINVAL;
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -1413,10 +1414,10 @@
         case SOUND_PCM_READ_RATE:
 		/* HP20020201 */
 		s->rate = rme96xx_get_sample_rate_status(s);
-		return put_user(s->rate, (int *)arg);
+		return put_user(s->rate, p);
 
         case SOUND_PCM_READ_CHANNELS:
-		return put_user(dma->outchannels, (int *)arg);
+		return put_user(dma->outchannels, p);
 
         case SOUND_PCM_READ_BITS:
 		switch (dma->format) {
@@ -1427,7 +1428,7 @@
 				val = 16;
 				break;
 		}
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 
         case SOUND_PCM_WRITE_FILTER:
         case SNDCTL_DSP_SETSYNCRO:
@@ -1529,7 +1530,7 @@
 }
 
 
-static ssize_t rme96xx_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t rme96xx_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct dmabuf *dma = (struct dmabuf *)file->private_data;
 	ssize_t ret = 0;
@@ -1597,7 +1598,7 @@
 	return ret;
 }
 
-static ssize_t rme96xx_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t rme96xx_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 { 
 	struct dmabuf *dma = (struct dmabuf *)file->private_data;
 	ssize_t ret = 0;
@@ -1793,6 +1794,8 @@
 	rme96xx_info *s = (rme96xx_info *)file->private_data;
 	u32 status;
 	int spdifrate;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	status = readl(s->iobase + RME96xx_status_register);
 	/* hack to convert rev 1.5 SPDIF rate to "crystalrate" format   HP 20020201 */
@@ -1802,7 +1805,7 @@
 	VALIDATE_STATE(s);
 	if (cmd == SOUND_MIXER_PRIVATE1) {
 		rme_mixer mixer;
-		if (copy_from_user(&mixer,(void*)arg,sizeof(mixer)))
+		if (copy_from_user(&mixer,argp,sizeof(mixer)))
 			return -EFAULT;
 		
 		mixer.devnr &= RME96xx_MASK_DEVS;
@@ -1825,14 +1828,14 @@
 		mixer.o_offset = s->dma[mixer.devnr].outoffset;
 		mixer.i_offset = s->dma[mixer.devnr].inoffset;
 
-		return copy_to_user((void *)arg, &mixer, sizeof(mixer)) ? -EFAULT : 0;
+		return copy_to_user(argp, &mixer, sizeof(mixer)) ? -EFAULT : 0;
 	}
 	if (cmd == SOUND_MIXER_PRIVATE2) {
-		return put_user(status, (int *)arg);
+		return put_user(status, p);
 	}
 	if (cmd == SOUND_MIXER_PRIVATE3) {
 		u32 control;
-		if (copy_from_user(&control,(void*)arg,sizeof(control)))
+		if (copy_from_user(&control,argp,sizeof(control)))
 			return -EFAULT;
 		if (file->f_mode & FMODE_WRITE) {
 			s->control_register &= ~RME96xx_mixer_allowed;
@@ -1840,7 +1843,7 @@
 			writel(control,s->iobase + RME96xx_control_register);
 		}
 
-	     return put_user(s->control_register, (int *)arg);
+	     return put_user(s->control_register, p);
 	}
 	return -1;
 }
diff -Nru a/sound/oss/sb_audio.c b/sound/oss/sb_audio.c
--- a/sound/oss/sb_audio.c	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/sb_audio.c	Tue Jun 15 22:20:43 2004
@@ -836,7 +836,7 @@
 static void
 sb16_copy_from_user(int dev,
 		char *localbuf, int localoffs,
-		const char *userbuf, int useroffs,
+		const char __user *userbuf, int useroffs,
 		int max_in, int max_out,
 		int *used, int *returned,
 		int len)
diff -Nru a/sound/oss/sb_card.c b/sound/oss/sb_card.c
--- a/sound/oss/sb_card.c	Tue Jun 15 22:20:42 2004
+++ b/sound/oss/sb_card.c	Tue Jun 15 22:20:42 2004
@@ -181,6 +181,13 @@
 		scc->mpucnf.io_base = pnp_port_start(dev,1);
 		return;
 	}
+	if(!strncmp("tBA",scc->card_id,3)) {
+		scc->conf.io_base   = pnp_port_start(dev,0);
+		scc->conf.irq       = pnp_irq(dev,0);
+		scc->conf.dma       = pnp_dma(dev,0);
+		scc->conf.dma2      = pnp_dma(dev,1);
+		return;
+	}
 	if(!strncmp("ESS",scc->card_id,3)) {
 		scc->conf.io_base   = pnp_port_start(dev,0);
 		scc->conf.irq       = pnp_irq(dev,0);
diff -Nru a/sound/oss/sb_card.h b/sound/oss/sb_card.h
--- a/sound/oss/sb_card.h	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/sb_card.h	Tue Jun 15 22:20:41 2004
@@ -140,6 +140,8 @@
 	{.id = "RTL3000", .driver_data = 0, .devs = { {.id="@@@2001"},
 						     {.id="@X@2001"},
 						     {.id="@H@0001"}, } },
+	/* Sound Blaster 16 (Virtual PC 2004) */
+	{.id = "tBA03b0", .driver_data = 0, .devs = { {.id="PNPb003"}, } },
 	/* -end- */
 	{.id = "", }
 };
diff -Nru a/sound/oss/sb_common.c b/sound/oss/sb_common.c
--- a/sound/oss/sb_common.c	Tue Jun 15 22:20:36 2004
+++ b/sound/oss/sb_common.c	Tue Jun 15 22:20:36 2004
@@ -943,7 +943,10 @@
 {
 	unsigned long flags;
 
-	if (devc->model == MDL_ESS) return ess_setmixer (devc, port, value);
+	if (devc->model == MDL_ESS) {
+		ess_setmixer (devc, port, value);
+		return;
+	}
 
 	spin_lock_irqsave(&devc->lock, flags);
 
diff -Nru a/sound/oss/sb_midi.c b/sound/oss/sb_midi.c
--- a/sound/oss/sb_midi.c	Tue Jun 15 22:20:36 2004
+++ b/sound/oss/sb_midi.c	Tue Jun 15 22:20:36 2004
@@ -118,7 +118,7 @@
 	return 0;
 }
 
-static int sb_midi_ioctl(int dev, unsigned cmd, caddr_t arg)
+static int sb_midi_ioctl(int dev, unsigned cmd, void __user *arg)
 {
         return -EINVAL;
 }
diff -Nru a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c
--- a/sound/oss/sb_mixer.c	Tue Jun 15 22:20:37 2004
+++ b/sound/oss/sb_mixer.c	Tue Jun 15 22:20:37 2004
@@ -528,10 +528,11 @@
 	return devc->outmask;
 }
 
-static int sb_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int sb_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	sb_devc *devc = mixer_devs[dev]->devc;
 	int val, ret;
+	int __user *p = arg;
 
 	/*
 	 * Use ioctl(fd, SOUND_MIXER_AGC, &mode) to turn AGC off (0) or on (1).
@@ -541,7 +542,7 @@
 	if (devc->model == MDL_SB16) {
 		if (cmd == SOUND_MIXER_AGC) 
 		{
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			sb_setmixer(devc, 0x43, (~val) & 0x01);
 			return 0;
@@ -552,14 +553,14 @@
 			   At least my 4.13 havn't 3DSE, 4.16 has it. */
 			if (devc->minor < 15)
 				return -EINVAL;
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (val == 0 || val == 1)
 				sb_chgmixer(devc, AWE_3DSE, 0x01, val);
 			else if (val == 2)
 			{
 				ret = sb_getmixer(devc, AWE_3DSE)&0x01;
-				return put_user(ret, (int *)arg);
+				return put_user(ret, p);
 			}
 			else
 				return -EINVAL;
@@ -570,7 +571,7 @@
 	{
 		if (_SIOC_DIR(cmd) & _SIOC_WRITE) 
 		{
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			switch (cmd & 0xff) 
 			{
@@ -625,7 +626,7 @@
 				ret = sb_mixer_get(devc, cmd & 0xff);
 				break;
 		}
-		return put_user(ret, (int *)arg); 
+		return put_user(ret, p); 
 	} else
 		return -EINVAL;
 }
diff -Nru a/sound/oss/sequencer.c b/sound/oss/sequencer.c
--- a/sound/oss/sequencer.c	Tue Jun 15 22:20:40 2004
+++ b/sound/oss/sequencer.c	Tue Jun 15 22:20:40 2004
@@ -82,7 +82,7 @@
 #error Too many synthesizer devices enabled.
 #endif
 
-int sequencer_read(int dev, struct file *file, char *buf, int count)
+int sequencer_read(int dev, struct file *file, char __user *buf, int count)
 {
 	int c = count, p = 0;
 	int ev_len;
@@ -207,7 +207,7 @@
 	seq_copy_to_input(event_rec, len);
 }
 
-int sequencer_write(int dev, struct file *file, const char *buf, int count)
+int sequencer_write(int dev, struct file *file, const char __user *buf, int count)
 {
 	unsigned char event_rec[EV_SZ], ev_code;
 	int p = 0, c, ev_size;
@@ -1320,13 +1320,14 @@
 	 */
 }
 
-int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, caddr_t arg)
+int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, void __user *arg)
 {
 	int midi_dev, orig_dev, val, err;
 	int mode = translate_mode(file);
 	struct synth_info inf;
 	struct seq_event_rec event_rec;
 	unsigned long flags;
+	int __user *p = arg;
 
 	orig_dev = dev = dev >> 4;
 
@@ -1346,7 +1347,7 @@
 		case SNDCTL_TMR_SELECT:
 			if (seq_mode != SEQ_2)
 				return -EINVAL;
-			if (get_user(pending_timer, (int *)arg))
+			if (get_user(pending_timer, p))
 				return -EFAULT;
 			if (pending_timer < 0 || pending_timer >= num_sound_timers || sound_timer_devs[pending_timer] == NULL)
 			{
@@ -1372,7 +1373,7 @@
 			return 0;
 
 		case SNDCTL_SEQ_TESTMIDI:
-			if (__get_user(midi_dev, (int *)arg))
+			if (__get_user(midi_dev, p))
 				return -EFAULT;
 			if (midi_dev < 0 || midi_dev >= max_mididev || !midi_devs[midi_dev])
 				return -ENXIO;
@@ -1409,7 +1410,7 @@
 			if (seq_mode == SEQ_2)
 				return tmr->ioctl(tmr_no, cmd, arg);
 
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (val != 0)
 				return -EINVAL;
@@ -1419,7 +1420,7 @@
 		case SNDCTL_SEQ_RESETSAMPLES:
 		case SNDCTL_SYNTH_REMOVESAMPLE:
 		case SNDCTL_SYNTH_CONTROL:
-			if (get_user(dev, (int *)arg))
+			if (get_user(dev, p))
 				return -EFAULT;
 			if (dev < 0 || dev >= num_synths || synth_devs[dev] == NULL)
 				return -ENXIO;
@@ -1436,7 +1437,7 @@
 			break;
 
 		case SNDCTL_SYNTH_MEMAVL:
-			if (get_user(dev, (int *)arg))
+			if (get_user(dev, p))
 				return -EFAULT;
 			if (dev < 0 || dev >= num_synths || synth_devs[dev] == NULL)
 				return -ENXIO;
@@ -1446,7 +1447,7 @@
 			break;
 
 		case SNDCTL_FM_4OP_ENABLE:
-			if (get_user(dev, (int *)arg))
+			if (get_user(dev, p))
 				return -EFAULT;
 			if (dev < 0 || dev >= num_synths || synth_devs[dev] == NULL)
 				return -ENXIO;
@@ -1456,7 +1457,7 @@
 			return 0;
 
 		case SNDCTL_SYNTH_INFO:
-			if (get_user(dev, (int *)(&(((struct synth_info *)arg)->device))))
+			if (get_user(dev, &((struct synth_info __user *)arg)->device))
 				return -EFAULT;
 			if (dev < 0 || dev >= max_synthdev)
 				return -ENXIO;
@@ -1466,7 +1467,7 @@
 
 		/* Like SYNTH_INFO but returns ID in the name field */
 		case SNDCTL_SYNTH_ID:
-			if (get_user(dev, (int *)(&(((struct synth_info *)arg)->device))))
+			if (get_user(dev, &((struct synth_info __user *)arg)->device))
 				return -EFAULT;
 			if (dev < 0 || dev >= max_synthdev)
 				return -ENXIO;
@@ -1486,7 +1487,7 @@
 			return 0;
 
 		case SNDCTL_MIDI_INFO:
-			if (get_user(dev, (int *)(&(((struct midi_info *)arg)->device))))
+			if (get_user(dev, &((struct midi_info __user *)arg)->device))
 				return -EFAULT;
 			if (dev < 0 || dev >= max_mididev || !midi_devs[dev])
 				return -ENXIO;
@@ -1494,7 +1495,7 @@
 			return copy_to_user(arg, &midi_devs[dev]->info, sizeof(struct midi_info))?-EFAULT:0;
 
 		case SNDCTL_SEQ_THRESHOLD:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (val < 1)
 				val = 1;
@@ -1504,7 +1505,7 @@
 			return 0;
 
 		case SNDCTL_MIDI_PRETIME:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (val < 0)
 				val = 0;
@@ -1523,7 +1524,7 @@
 				return -EINVAL;
 			return synth_devs[0]->ioctl(0, cmd, arg);
 	}
-	return put_user(val, (int *)arg);
+	return put_user(val, p);
 }
 
 /* No kernel lock - we're using the global irq lock here */
diff -Nru a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
--- a/sound/oss/sonicvibes.c	Tue Jun 15 22:20:40 2004
+++ b/sound/oss/sonicvibes.c	Tue Jun 15 22:20:40 2004
@@ -1042,6 +1042,7 @@
 	unsigned long flags;
 	int i, val;
 	unsigned char l, r, rl, rr;
+	int __user *p = (int __user *)arg;
 
 	VALIDATE_STATE(s);
         if (cmd == SOUND_MIXER_INFO) {
@@ -1050,7 +1051,7 @@
 		strlcpy(info.id, "SonicVibes", sizeof(info.id));
 		strlcpy(info.name, "S3 SonicVibes", sizeof(info.name));
 		info.modify_counter = s->mix.modcnt;
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
@@ -1059,14 +1060,14 @@
 		memset(&info, 0, sizeof(info));
 		strlcpy(info.id, "SonicVibes", sizeof(info.id));
 		strlcpy(info.name, "S3 SonicVibes", sizeof(info.name));
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
 			return -EFAULT;
 		return 0;
 	}
 	if (cmd == OSS_GETVERSION)
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 	if (cmd == SOUND_MIXER_PRIVATE1) {  /* SRS settings */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		spin_lock_irqsave(&s->lock, flags);
 		if (val & 1) {
@@ -1086,47 +1087,47 @@
 		r = rdindir(s, SV_CISRSCENTER);
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (l & 0x80)
-			return put_user(0, (int *)arg);
-		return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, (int *)arg);
+			return put_user(0, p);
+		return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, p);
 	}
 	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
         if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
-			return put_user(mixer_recmask(s), (int *)arg);
+			return put_user(mixer_recmask(s), p);
 			
                 case SOUND_MIXER_DEVMASK: /* Arg contains a bit for each supported device */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].type)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 
                 case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].rec)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 			
                 case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */
 			for (val = i = 0; i < SOUND_MIXER_NRDEVICES; i++)
 				if (mixtable[i].type && mixtable[i].type != MT_4MUTEMONO)
 					val |= 1 << i;
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 			
                 case SOUND_MIXER_CAPS:
-			return put_user(SOUND_CAP_EXCL_INPUT, (int *)arg);
+			return put_user(SOUND_CAP_EXCL_INPUT, p);
 
 		default:
 			i = _IOC_NR(cmd);
                         if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type)
                                 return -EINVAL;
 #ifdef OSS_DOCUMENTED_MIXER_SEMANTICS
-			return return_mixval(s, i, (int *)arg);
+			return return_mixval(s, i, p);
 #else /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 			if (!volidx[i])
 				return -EINVAL;
-			return put_user(s->mix.vol[volidx[i]-1], (int *)arg);
+			return put_user(s->mix.vol[volidx[i]-1], p);
 #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 		}
 	}
@@ -1135,7 +1136,7 @@
 	s->mix.modcnt++;
 	switch (_IOC_NR(cmd)) {
 	case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		i = hweight32(val);
 		if (i == 0)
@@ -1160,7 +1161,7 @@
 		i = _IOC_NR(cmd);
 		if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type)
 			return -EINVAL;
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		l = val & 0xff;
 		r = (val >> 8) & 0xff;
@@ -1224,12 +1225,12 @@
 		}
 		spin_unlock_irqrestore(&s->lock, flags);
 #ifdef OSS_DOCUMENTED_MIXER_SEMANTICS
-                return return_mixval(s, i, (int *)arg);
+                return return_mixval(s, i, p);
 #else /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 		if (!volidx[i])
 			return -EINVAL;
 		s->mix.vol[volidx[i]-1] = val;
-		return put_user(s->mix.vol[volidx[i]-1], (int *)arg);
+		return put_user(s->mix.vol[volidx[i]-1], p);
 #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 	}
 }
@@ -1314,7 +1315,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t sv_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t sv_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct sv_state *s = (struct sv_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1399,7 +1400,7 @@
 	return ret;
 }
 
-static ssize_t sv_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t sv_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct sv_state *s = (struct sv_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -1570,13 +1571,15 @@
 	int count;
 	int val, mapped, ret;
 	unsigned char fmtm, fmtd;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_STATE(s);
         mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) ||
 		((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_SYNC:
 		if (file->f_mode & FMODE_WRITE)
@@ -1587,7 +1590,7 @@
 		return 0;
 
 	case SNDCTL_DSP_GETCAPS:
-		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
+		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
 		
         case SNDCTL_DSP_RESET:
 		if (file->f_mode & FMODE_WRITE) {
@@ -1603,7 +1606,7 @@
 		return 0;
 
         case SNDCTL_DSP_SPEED:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val >= 0) {
 			if (file->f_mode & FMODE_READ) {
@@ -1617,10 +1620,10 @@
 				set_dac_rate(s, val);
 			}
 		}
-		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
 		
         case SNDCTL_DSP_STEREO:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		fmtd = 0;
 		fmtm = ~0;
@@ -1644,7 +1647,7 @@
 		return 0;
 
         case SNDCTL_DSP_CHANNELS:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 0) {
 			fmtd = 0;
@@ -1668,13 +1671,13 @@
 			set_fmt(s, fmtm, fmtd);
 		}
 		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_STEREO << SV_CFMT_CSHIFT) 
-					   : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, (int *)arg);
+					   : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, p);
 		
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-                return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
+                return put_user(AFMT_S16_LE|AFMT_U8, p);
 		
 	case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (val != AFMT_QUERY) {
 			fmtd = 0;
@@ -1698,7 +1701,7 @@
 			set_fmt(s, fmtm, fmtd);
 		}
 		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_16BIT << SV_CFMT_CSHIFT) 
-					   : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? AFMT_S16_LE : AFMT_U8, (int *)arg);
+					   : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? AFMT_S16_LE : AFMT_U8, p);
 		
 	case SNDCTL_DSP_POST:
                 return 0;
@@ -1709,10 +1712,10 @@
 			val |= PCM_ENABLE_INPUT;
 		if (file->f_mode & FMODE_WRITE && s->enable & SV_CENABLE_PE) 
 			val |= PCM_ENABLE_OUTPUT;
-		return put_user(val, (int *)arg);
+		return put_user(val, p);
 		
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			if (val & PCM_ENABLE_INPUT) {
@@ -1753,7 +1756,7 @@
                 abinfo.fragstotal = s->dma_dac.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		if (!(file->f_mode & FMODE_READ))
@@ -1770,7 +1773,7 @@
                 abinfo.fragstotal = s->dma_adc.numfrag;
                 abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;      
 		spin_unlock_irqrestore(&s->lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 		
         case SNDCTL_DSP_NONBLOCK:
                 file->f_flags |= O_NONBLOCK;
@@ -1787,7 +1790,7 @@
 		spin_unlock_irqrestore(&s->lock, flags);
 		if (count < 0)
 			count = 0;
-		return put_user(count, (int *)arg);
+		return put_user(count, p);
 
         case SNDCTL_DSP_GETIPTR:
 		if (!(file->f_mode & FMODE_READ))
@@ -1805,7 +1808,7 @@
 		if (s->dma_adc.mapped)
 			s->dma_adc.count &= s->dma_adc.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-		if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+		if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1825,7 +1828,7 @@
 		if (s->dma_dac.mapped)
 			s->dma_dac.count &= s->dma_dac.fragsize-1;
 		spin_unlock_irqrestore(&s->lock, flags);
-                if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
+                if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
 			return -EFAULT;
 		return 0;
 
@@ -1833,14 +1836,14 @@
 		if (file->f_mode & FMODE_WRITE) {
 			if ((val = prog_dmabuf(s, 0)))
 				return val;
-			return put_user(s->dma_dac.fragsize, (int *)arg);
+			return put_user(s->dma_dac.fragsize, p);
 		}
 		if ((val = prog_dmabuf(s, 1)))
 			return val;
-		return put_user(s->dma_adc.fragsize, (int *)arg);
+		return put_user(s->dma_adc.fragsize, p);
 
         case SNDCTL_DSP_SETFRAGMENT:
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (file->f_mode & FMODE_READ) {
 			s->dma_adc.ossfragshift = val & 0xffff;
@@ -1868,7 +1871,7 @@
 		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
 		    (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision))
 			return -EINVAL;
-                if (get_user(val, (int *)arg))
+                if (get_user(val, p))
 			return -EFAULT;
 		if (val != 1 && val != 2 && val != 4)
 			return -EINVAL;
@@ -1879,15 +1882,15 @@
 		return 0;
 
         case SOUND_PCM_READ_RATE:
-		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, (int *)arg);
+		return put_user((file->f_mode & FMODE_READ) ? s->rateadc : s->ratedac, p);
 
         case SOUND_PCM_READ_CHANNELS:
 		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_STEREO << SV_CFMT_CSHIFT) 
-					   : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, (int *)arg);
+					   : (SV_CFMT_STEREO << SV_CFMT_ASHIFT))) ? 2 : 1, p);
 
         case SOUND_PCM_READ_BITS:
 		return put_user((s->fmt & ((file->f_mode & FMODE_READ) ? (SV_CFMT_16BIT << SV_CFMT_CSHIFT) 
-					   : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? 16 : 8, (int *)arg);
+					   : (SV_CFMT_16BIT << SV_CFMT_ASHIFT))) ? 16 : 8, p);
 
         case SOUND_PCM_WRITE_FILTER:
         case SNDCTL_DSP_SETSYNCRO:
@@ -1992,7 +1995,7 @@
 
 /* --------------------------------------------------------------------- */
 
-static ssize_t sv_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t sv_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct sv_state *s = (struct sv_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -2055,7 +2058,7 @@
 	return ret;
 }
 
-static ssize_t sv_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t sv_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct sv_state *s = (struct sv_state *)file->private_data;
 	DECLARE_WAITQUEUE(wait, current);
@@ -2297,7 +2300,7 @@
 		return 0;
 
 	case FM_IOCTL_PLAY_NOTE:
-		if (copy_from_user(&n, (void *)arg, sizeof(n)))
+		if (copy_from_user(&n, (void __user *)arg, sizeof(n)))
 			return -EFAULT;
 		if (n.voice >= 18)
 			return -EINVAL;
@@ -2315,7 +2318,7 @@
 		return 0;
 
 	case FM_IOCTL_SET_VOICE:
-		if (copy_from_user(&v, (void *)arg, sizeof(v)))
+		if (copy_from_user(&v, (void __user *)arg, sizeof(v)))
 			return -EFAULT;
 		if (v.voice >= 18)
 			return -EINVAL;
@@ -2345,7 +2348,7 @@
 		return 0;
 		
 	case FM_IOCTL_SET_PARAMS:
-		if (copy_from_user(&p, (void *)arg, sizeof(p)))
+		if (copy_from_user(&p, (void *__user )arg, sizeof(p)))
 			return -EFAULT;
 		outb(0x08, s->iosynth);
 		outb((p.kbd_split & 1) << 6, s->iosynth+1);
diff -Nru a/sound/oss/sound_calls.h b/sound/oss/sound_calls.h
--- a/sound/oss/sound_calls.h	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/sound_calls.h	Tue Jun 15 22:20:41 2004
@@ -9,7 +9,7 @@
 int DMAbuf_rmchars(int dev, int buff_no, int c);
 int DMAbuf_start_output(int dev, int buff_no, int l);
 int DMAbuf_move_wrpointer(int dev, int l);
-/* int DMAbuf_ioctl(int dev, unsigned int cmd, caddr_t arg, int local); */
+/* int DMAbuf_ioctl(int dev, unsigned int cmd, void __user *arg, int local); */
 void DMAbuf_init(int dev, int dma1, int dma2);
 void DMAbuf_deinit(int dev);
 int DMAbuf_start_dma (int dev, unsigned long physaddr, int count, int dma_mode);
@@ -31,25 +31,25 @@
  *	System calls for /dev/dsp and /dev/audio (audio.c)
  */
 
-int audio_read (int dev, struct file *file, char *buf, int count);
-int audio_write (int dev, struct file *file, const char *buf, int count);
+int audio_read (int dev, struct file *file, char __user *buf, int count);
+int audio_write (int dev, struct file *file, const char __user *buf, int count);
 int audio_open (int dev, struct file *file);
 void audio_release (int dev, struct file *file);
 int audio_ioctl (int dev, struct file *file,
-	   unsigned int cmd, caddr_t arg);
+	   unsigned int cmd, void __user *arg);
 void audio_init_devices (void);
 void reorganize_buffers (int dev, struct dma_buffparms *dmap, int recording);
-int dma_ioctl (int dev, unsigned int cmd, caddr_t arg);
+int dma_ioctl (int dev, unsigned int cmd, void __user *arg);
 
 /*
  *	System calls for the /dev/sequencer
  */
 
-int sequencer_read (int dev, struct file *file, char *buf, int count);
-int sequencer_write (int dev, struct file *file, const char *buf, int count);
+int sequencer_read (int dev, struct file *file, char __user *buf, int count);
+int sequencer_write (int dev, struct file *file, const char __user *buf, int count);
 int sequencer_open (int dev, struct file *file);
 void sequencer_release (int dev, struct file *file);
-int sequencer_ioctl (int dev, struct file *file, unsigned int cmd, caddr_t arg);
+int sequencer_ioctl (int dev, struct file *file, unsigned int cmd, void __user *arg);
 unsigned int sequencer_poll(int dev, struct file *file, poll_table * wait);
 
 void sequencer_init (void);
@@ -65,11 +65,11 @@
  *	System calls for the /dev/midi
  */
 
-int MIDIbuf_read (int dev, struct file *file, char *buf, int count);
-int MIDIbuf_write (int dev, struct file *file, const char *buf, int count);
+int MIDIbuf_read (int dev, struct file *file, char __user *buf, int count);
+int MIDIbuf_write (int dev, struct file *file, const char __user *buf, int count);
 int MIDIbuf_open (int dev, struct file *file);
 void MIDIbuf_release (int dev, struct file *file);
-int MIDIbuf_ioctl (int dev, struct file *file, unsigned int cmd, caddr_t arg);
+int MIDIbuf_ioctl (int dev, struct file *file, unsigned int cmd, void __user *arg);
 unsigned int MIDIbuf_poll(int dev, struct file *file, poll_table * wait);
 int MIDIbuf_avail(int dev);
 
diff -Nru a/sound/oss/sound_timer.c b/sound/oss/sound_timer.c
--- a/sound/oss/sound_timer.c	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/sound_timer.c	Tue Jun 15 22:20:41 2004
@@ -177,8 +177,9 @@
 	return curr_ticks;
 }
 
-static int timer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int timer_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
+	int __user *p = arg;
 	int val;
 
 	switch (cmd) 
@@ -201,7 +202,7 @@
 			return 0;
 
 		case SNDCTL_TMR_TIMEBASE:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (val) 
 			{
@@ -215,7 +216,7 @@
 			break;
 
 		case SNDCTL_TMR_TEMPO:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (val) 
 			{
@@ -233,7 +234,7 @@
 			break;
 
 		case SNDCTL_SEQ_CTRLRATE:
-			if (get_user(val, (int *)arg))
+			if (get_user(val, p))
 				return -EFAULT;
 			if (val != 0)	/* Can't change */
 				return -EINVAL;
@@ -248,7 +249,7 @@
 		default:
 			return -EINVAL;
 	}
-	return put_user(val, (int *)arg);
+	return put_user(val, p);
 }
 
 static void timer_arm(int dev, long time)
diff -Nru a/sound/oss/soundcard.c b/sound/oss/soundcard.c
--- a/sound/oss/soundcard.c	Tue Jun 15 22:20:40 2004
+++ b/sound/oss/soundcard.c	Tue Jun 15 22:20:40 2004
@@ -55,7 +55,7 @@
 /*
  * Table for permanently allocated memory (used when unloading the module)
  */
-caddr_t         sound_mem_blocks[1024];
+void *          sound_mem_blocks[1024];
 int             sound_nblocks = 0;
 
 /* Persistent DMA buffers */
@@ -110,7 +110,7 @@
 	return mixer_vols[n].levels;
 }
 
-static int set_mixer_levels(caddr_t arg)
+static int set_mixer_levels(void __user * arg)
 {
         /* mixer_vol_table is 174 bytes, so IMHO no reason to not allocate it on the stack */
 	mixer_vol_table buf;   
@@ -123,11 +123,11 @@
 	return 0;
 }
 
-static int get_mixer_levels(caddr_t arg)
+static int get_mixer_levels(void __user * arg)
 {
 	int n;
 
-	if (__get_user(n, (int *)(&(((mixer_vol_table *)arg)->num))))
+	if (__get_user(n, (int __user *)(&(((mixer_vol_table *__user )arg)->num))))
 		return -EFAULT;
 	if (n < 0 || n >= num_mixer_volumes)
 		return -EINVAL;
@@ -139,7 +139,7 @@
 /* 4K page size but our output routines use some slack for overruns */
 #define PROC_BLOCK_SIZE (3*1024)
 
-static ssize_t sound_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 {
 	int dev = iminor(file->f_dentry->d_inode);
 	int ret = -EINVAL;
@@ -172,7 +172,7 @@
 	return ret;
 }
 
-static ssize_t sound_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
 	int dev = iminor(file->f_dentry->d_inode);
 	int ret = -EINVAL;
@@ -282,7 +282,7 @@
 	return 0;
 }
 
-static int get_mixer_info(int dev, caddr_t arg)
+static int get_mixer_info(int dev, void __user *arg)
 {
 	mixer_info info;
 	memset(&info, 0, sizeof(info));
@@ -294,7 +294,7 @@
 	return 0;
 }
 
-static int get_old_mixer_info(int dev, caddr_t arg)
+static int get_old_mixer_info(int dev, void __user *arg)
 {
 	_old_mixer_info info;
 	memset(&info, 0, sizeof(info));
@@ -305,7 +305,7 @@
 	return 0;
 }
 
-static int sound_mixer_ioctl(int mixdev, unsigned int cmd, caddr_t arg)
+static int sound_mixer_ioctl(int mixdev, unsigned int cmd, void __user *arg)
 {
  	if (mixdev < 0 || mixdev >= MAX_MIXER_DEV)
  		return -ENXIO;
@@ -331,24 +331,25 @@
 {
 	int err, len = 0, dtype;
 	int dev = iminor(inode);
+	void __user *p = (void __user *)arg;
 
 	if (_SIOC_DIR(cmd) != _SIOC_NONE && _SIOC_DIR(cmd) != 0) {
 		/*
 		 * Have to validate the address given by the process.
 		 */
 		len = _SIOC_SIZE(cmd);
-		if (len < 1 || len > 65536 || arg == 0)
+		if (len < 1 || len > 65536 || !p)
 			return -EFAULT;
 		if (_SIOC_DIR(cmd) & _SIOC_WRITE)
-			if ((err = verify_area(VERIFY_READ, (void *)arg, len)) < 0)
+			if ((err = verify_area(VERIFY_READ, p, len)) < 0)
 				return err;
 		if (_SIOC_DIR(cmd) & _SIOC_READ)
-			if ((err = verify_area(VERIFY_WRITE, (void *)arg, len)) < 0)
+			if ((err = verify_area(VERIFY_WRITE, p, len)) < 0)
 				return err;
 	}
 	DEB(printk("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg));
 	if (cmd == OSS_GETVERSION)
-		return __put_user(SOUND_VERSION, (int *)arg);
+		return __put_user(SOUND_VERSION, (int __user *)p);
 	
 	if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 &&   /* Mixer ioctl */
 	    (dev & 0x0f) != SND_DEV_CTL) {              
@@ -358,32 +359,32 @@
 		case SND_DEV_DSP16:
 		case SND_DEV_AUDIO:
 			return sound_mixer_ioctl(audio_devs[dev >> 4]->mixer_dev,
-						 cmd, (caddr_t)arg);
+						 cmd, p);
 			
 		default:
-			return sound_mixer_ioctl(dev >> 4, cmd, (caddr_t)arg);
+			return sound_mixer_ioctl(dev >> 4, cmd, p);
 		}
 	}
 	switch (dev & 0x0f) {
 	case SND_DEV_CTL:
 		if (cmd == SOUND_MIXER_GETLEVELS)
-			return get_mixer_levels((caddr_t)arg);
+			return get_mixer_levels(p);
 		if (cmd == SOUND_MIXER_SETLEVELS)
-			return set_mixer_levels((caddr_t)arg);
-		return sound_mixer_ioctl(dev >> 4, cmd, (caddr_t)arg);
+			return set_mixer_levels(p);
+		return sound_mixer_ioctl(dev >> 4, cmd, p);
 
 	case SND_DEV_SEQ:
 	case SND_DEV_SEQ2:
-		return sequencer_ioctl(dev, file, cmd, (caddr_t)arg);
+		return sequencer_ioctl(dev, file, cmd, p);
 
 	case SND_DEV_DSP:
 	case SND_DEV_DSP16:
 	case SND_DEV_AUDIO:
-		return audio_ioctl(dev, file, cmd, (caddr_t)arg);
+		return audio_ioctl(dev, file, cmd, p);
 		break;
 
 	case SND_DEV_MIDIN:
-		return MIDIbuf_ioctl(dev, file, cmd, (caddr_t)arg);
+		return MIDIbuf_ioctl(dev, file, cmd, p);
 		break;
 
 	}
diff -Nru a/sound/oss/sscape.c b/sound/oss/sscape.c
--- a/sound/oss/sscape.c	Tue Jun 15 22:20:42 2004
+++ b/sound/oss/sscape.c	Tue Jun 15 22:20:42 2004
@@ -555,7 +555,7 @@
 	return 0;
 }
 
-static int sscape_coproc_ioctl(void *dev_info, unsigned int cmd, caddr_t arg, int local)
+static int sscape_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, int local)
 {
 	copr_buffer *buf;
 	int err;
diff -Nru a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
--- a/sound/oss/sys_timer.c	Tue Jun 15 22:20:40 2004
+++ b/sound/oss/sys_timer.c	Tue Jun 15 22:20:40 2004
@@ -191,13 +191,14 @@
 }
 
 /* same as sound_timer.c:timer_ioctl!? */
-static int def_tmr_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int def_tmr_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
+	int __user *p = arg;
 	int val;
 
 	switch (cmd) {
 	case SNDCTL_TMR_SOURCE:
-		return __put_user(TMR_INTERNAL, (int *)arg);
+		return __put_user(TMR_INTERNAL, p);
 
 	case SNDCTL_TMR_START:
 		tmr_reset();
@@ -213,7 +214,7 @@
 		return 0;
 
 	case SNDCTL_TMR_TIMEBASE:
-		if (__get_user(val, (int *)arg))
+		if (__get_user(val, p))
 			return -EFAULT;
 		if (val) {
 			if (val < 1)
@@ -222,10 +223,10 @@
 				val = 1000;
 			curr_timebase = val;
 		}
-		return __put_user(curr_timebase, (int *)arg);
+		return __put_user(curr_timebase, p);
 
 	case SNDCTL_TMR_TEMPO:
-		if (__get_user(val, (int *)arg))
+		if (__get_user(val, p))
 			return -EFAULT;
 		if (val) {
 			if (val < 8)
@@ -238,18 +239,18 @@
 			curr_tempo = val;
 			reprogram_timer();
 		}
-		return __put_user(curr_tempo, (int *)arg);
+		return __put_user(curr_tempo, p);
 
 	case SNDCTL_SEQ_CTRLRATE:
-		if (__get_user(val, (int *)arg))
+		if (__get_user(val, p))
 			return -EFAULT;
 		if (val != 0)	/* Can't change */
 			return -EINVAL;
 		val = ((curr_tempo * curr_timebase) + 30) / 60;
-		return __put_user(val, (int *)arg);
+		return __put_user(val, p);
 		
 	case SNDCTL_SEQ_GETTIME:
-		return __put_user(curr_ticks, (int *)arg);
+		return __put_user(curr_ticks, p);
 		
 	case SNDCTL_TMR_METRONOME:
 		/* NOP */
diff -Nru a/sound/oss/trident.c b/sound/oss/trident.c
--- a/sound/oss/trident.c	Tue Jun 15 22:20:43 2004
+++ b/sound/oss/trident.c	Tue Jun 15 22:20:43 2004
@@ -497,7 +497,8 @@
 static void ali_disable_spdif_in(struct trident_card *card);
 static void ali_disable_special_channel(struct trident_card *card, int ch);
 static void ali_setup_spdif_out(struct trident_card *card, int flag);
-static int ali_write_5_1(struct trident_state *state, const char *buffer, 
+static int ali_write_5_1(struct trident_state *state,
+			 const char __user *buffer, 
 			 int cnt_for_multi_channel, unsigned int *copy_count, 
 			 unsigned int *state_cnt);
 static int ali_allocate_other_states_resources(struct trident_state *state, 
@@ -1861,7 +1862,7 @@
 /* to be copied to the user's buffer.  it is filled by the dma machine and */ 
 /* drained by this loop. */
 static ssize_t
-trident_read(struct file *file, char *buffer, size_t count, loff_t * ppos)
+trident_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
 {
 	struct trident_state *state = (struct trident_state *)file->private_data;
 	struct dmabuf *dmabuf = &state->dmabuf;
@@ -1976,7 +1977,7 @@
    the soundcard.  it is drained by the dma machine and filled by this loop. */
 
 static ssize_t
-trident_write(struct file *file, const char *buffer, size_t count, loff_t * ppos)
+trident_write(struct file *file, const char __user *buffer, size_t count, loff_t * ppos)
 {
 	struct trident_state *state = (struct trident_state *)file->private_data;
 	struct dmabuf *dmabuf = &state->dmabuf;
@@ -2247,8 +2248,9 @@
 	audio_buf_info abinfo;
 	count_info cinfo;
 	int val, mapped, ret = 0;
-
 	struct trident_card *card = state->card;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	VALIDATE_STATE(state);
 
@@ -2256,11 +2258,11 @@
 	mapped = ((file->f_mode & (FMODE_WRITE | FMODE_READ)) && dmabuf->mapped);
 
 	pr_debug("trident: trident_ioctl, command = %2d, arg = 0x%08x\n",
-		 _IOC_NR(cmd), arg ? *(int *) arg : 0);
+		 _IOC_NR(cmd), arg ? *p : 0);
 
 	switch (cmd) {
 	case OSS_GETVERSION:
-		ret = put_user(SOUND_VERSION, (int *) arg);
+		ret = put_user(SOUND_VERSION, p);
 		break;
 
 	case SNDCTL_DSP_RESET:
@@ -2287,7 +2289,7 @@
 		break;
 
 	case SNDCTL_DSP_SPEED:	/* set smaple rate */
-		if (get_user(val, (int *) arg)) {
+		if (get_user(val, p)) {
 			ret = -EFAULT;
 			break;
 		}
@@ -2307,11 +2309,11 @@
 				spin_unlock_irqrestore(&state->card->lock, flags);
 			}
 		}
-		ret = put_user(dmabuf->rate, (int *) arg);
+		ret = put_user(dmabuf->rate, p);
 		break;
 
 	case SNDCTL_DSP_STEREO:	/* set stereo or mono channel */
-		if (get_user(val, (int *) arg)) {
+		if (get_user(val, p)) {
 			ret = -EFAULT;
 			break;
 		}
@@ -2342,14 +2344,14 @@
 			if ((val = prog_dmabuf_playback(state)))
 				ret = val;
 			else
-				ret = put_user(dmabuf->fragsize, (int *) arg);
+				ret = put_user(dmabuf->fragsize, p);
 			break;
 		}
 		if (file->f_mode & FMODE_READ) {
 			if ((val = prog_dmabuf_record(state)))
 				ret = val;
 			else
-				ret = put_user(dmabuf->fragsize, (int *) arg);
+				ret = put_user(dmabuf->fragsize, p);
 			break;
 		}
 		/* neither READ nor WRITE? is this even possible? */
@@ -2359,11 +2361,11 @@
 
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format */
 		ret = put_user(AFMT_S16_LE | AFMT_U16_LE | AFMT_S8 | 
-			       AFMT_U8, (int *) arg);
+			       AFMT_U8, p);
 		break;
 
 	case SNDCTL_DSP_SETFMT:	/* Select sample format */
-		if (get_user(val, (int *) arg)) {
+		if (get_user(val, p)) {
 			ret = -EFAULT;
 			break;
 		}
@@ -2390,11 +2392,11 @@
 		}
 		unlock_set_fmt(state);
 		ret = put_user((dmabuf->fmt & TRIDENT_FMT_16BIT) ? AFMT_S16_LE : 
-			       AFMT_U8, (int *) arg);
+			       AFMT_U8, p);
 		break;
 
 	case SNDCTL_DSP_CHANNELS:
-		if (get_user(val, (int *) arg)) {
+		if (get_user(val, p)) {
 			ret = -EFAULT;
 			break;
 		}
@@ -2458,7 +2460,7 @@
 			}
 			unlock_set_fmt(state);
 		}
-		ret = put_user(val, (int *) arg);
+		ret = put_user(val, p);
 		break;
 
 	case SNDCTL_DSP_POST:
@@ -2470,7 +2472,7 @@
 			ret = -EINVAL;
 			break;
 		}
-		if (get_user(val, (int *) arg)) {
+		if (get_user(val, p)) {
 			ret = -EFAULT;
 			break;
 		}
@@ -2482,7 +2484,7 @@
 		break;
 
 	case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(val, (int *) arg)) {
+		if (get_user(val, p)) {
 			ret = -EFAULT;
 			break;
 		}
@@ -2514,7 +2516,7 @@
 		abinfo.fragstotal = dmabuf->numfrag;
 		abinfo.fragments = abinfo.bytes >> dmabuf->fragshift;
 		spin_unlock_irqrestore(&state->card->lock, flags);
-		ret = copy_to_user((void *) arg, &abinfo, sizeof (abinfo)) ? 
+		ret = copy_to_user(argp, &abinfo, sizeof (abinfo)) ? 
 			-EFAULT : 0;
 		break;
 
@@ -2534,7 +2536,7 @@
 		abinfo.fragstotal = dmabuf->numfrag;
 		abinfo.fragments = abinfo.bytes >> dmabuf->fragshift;
 		spin_unlock_irqrestore(&state->card->lock, flags);
-		ret = copy_to_user((void *) arg, &abinfo, sizeof (abinfo)) ? 
+		ret = copy_to_user(argp, &abinfo, sizeof (abinfo)) ? 
 			-EFAULT : 0;
 		break;
 
@@ -2544,7 +2546,7 @@
 
 	case SNDCTL_DSP_GETCAPS:
 		ret = put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | 
-			       DSP_CAP_MMAP | DSP_CAP_BIND, (int *) arg);
+			       DSP_CAP_MMAP | DSP_CAP_BIND, p);
 		break;
 
 	case SNDCTL_DSP_GETTRIGGER:
@@ -2553,11 +2555,11 @@
 			val |= PCM_ENABLE_INPUT;
 		if ((file->f_mode & FMODE_WRITE) && dmabuf->enable)
 			val |= PCM_ENABLE_OUTPUT;
-		ret = put_user(val, (int *) arg);
+		ret = put_user(val, p);
 		break;
 
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *) arg)) {
+		if (get_user(val, p)) {
 			ret = -EFAULT;
 			break;
 		}
@@ -2599,7 +2601,7 @@
 		if (dmabuf->mapped)
 			dmabuf->count &= dmabuf->fragsize - 1;
 		spin_unlock_irqrestore(&state->card->lock, flags);
-		ret = copy_to_user((void *) arg, &cinfo, sizeof (cinfo)) ? 
+		ret = copy_to_user(argp, &cinfo, sizeof (cinfo)) ? 
 			-EFAULT : 0;
 		break;
 
@@ -2622,7 +2624,7 @@
 		if (dmabuf->mapped)
 			dmabuf->count &= dmabuf->fragsize - 1;
 		spin_unlock_irqrestore(&state->card->lock, flags);
-		ret = copy_to_user((void *) arg, &cinfo, sizeof (cinfo)) ? 
+		ret = copy_to_user(argp, &cinfo, sizeof (cinfo)) ? 
 			-EFAULT : 0;
 		break;
 
@@ -2643,26 +2645,26 @@
 		trident_update_ptr(state);
 		val = dmabuf->count;
 		spin_unlock_irqrestore(&state->card->lock, flags);
-		ret = put_user(val, (int *) arg);
+		ret = put_user(val, p);
 		break;
 
 	case SOUND_PCM_READ_RATE:
-		ret = put_user(dmabuf->rate, (int *) arg);
+		ret = put_user(dmabuf->rate, p);
 		break;
 
 	case SOUND_PCM_READ_CHANNELS:
 		ret = put_user((dmabuf->fmt & TRIDENT_FMT_STEREO) ? 2 : 1, 
-			       (int *) arg);
+			       p);
 		break;
 
 	case SOUND_PCM_READ_BITS:
 		ret = put_user((dmabuf->fmt & TRIDENT_FMT_16BIT) ? AFMT_S16_LE : 
-			       AFMT_U8, (int *) arg);
+			       AFMT_U8, p);
 		break;
 
 	case SNDCTL_DSP_GETCHANNELMASK:
 		ret = put_user(DSP_BIND_FRONT | DSP_BIND_SURR | 
-			       DSP_BIND_CENTER_LFE,  (int *) arg);
+			       DSP_BIND_CENTER_LFE,  p);
 		break;
 
 	case SNDCTL_DSP_BIND_CHANNEL:
@@ -2671,7 +2673,7 @@
 			break;
 		}
 
-		if (get_user(val, (int *) arg)) {
+		if (get_user(val, p)) {
 			ret = -EFAULT;
 			break;
 		}
@@ -2688,7 +2690,7 @@
 							      SRC_ENABLE);
 			dmabuf->channel->attribute |= mask2attr[ffs(val)];
 		}
-		ret = put_user(val, (int *) arg);
+		ret = put_user(val, p);
 		break;
 
 	case SNDCTL_DSP_MAPINBUF:
@@ -3878,14 +3880,14 @@
 state DMA is protected by a spinlock.
 */
 static int
-ali_write_5_1(struct trident_state *state, const char *buf, 
+ali_write_5_1(struct trident_state *state, const char __user *buf, 
 	      int cnt_for_multi_channel, unsigned int *copy_count, 
 	      unsigned int *state_cnt)
 {
 
 	struct dmabuf *dmabuf = &state->dmabuf;
 	struct dmabuf *dmabuf_temp;
-	const char *buffer = buf;
+	const char __user *buffer = buf;
 	unsigned swptr, other_dma_nums, sample_s;
 	unsigned int i, loop;
 
@@ -4018,7 +4020,7 @@
 
 struct proc_dir_entry *res;
 static int
-ali_write_proc(struct file *file, const char *buffer, unsigned long count, void *data)
+ali_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data)
 {
 	struct trident_card *card = (struct trident_card *) data;
 	unsigned long flags;
@@ -4294,7 +4296,7 @@
 	switch (mode) {
 	case GAMEPORT_MODE_COOKED:
 		outb(0x80, TRID_REG(card, T4D_GAME_CR));
-		wait_ms(20);
+		msleep(20);
 		return 0;
 	case GAMEPORT_MODE_RAW:
 		outb(0x00, TRID_REG(card, T4D_GAME_CR));
diff -Nru a/sound/oss/v_midi.c b/sound/oss/v_midi.c
--- a/sound/oss/v_midi.c	Tue Jun 15 22:20:37 2004
+++ b/sound/oss/v_midi.c	Tue Jun 15 22:20:37 2004
@@ -120,7 +120,7 @@
 
 /* why -EPERM and not -EINVAL?? */
 
-static inline int v_midi_ioctl (int dev, unsigned cmd, caddr_t arg)
+static inline int v_midi_ioctl (int dev, unsigned cmd, void __user *arg)
 {
 	return -EPERM;
 }
diff -Nru a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
--- a/sound/oss/via82cxxx_audio.c	Tue Jun 15 22:20:38 2004
+++ b/sound/oss/via82cxxx_audio.c	Tue Jun 15 22:20:38 2004
@@ -349,8 +349,8 @@
 static int via_init_one (struct pci_dev *dev, const struct pci_device_id *id);
 static void __devexit via_remove_one (struct pci_dev *pdev);
 
-static ssize_t via_dsp_read(struct file *file, char *buffer, size_t count, loff_t *ppos);
-static ssize_t via_dsp_write(struct file *file, const char *buffer, size_t count, loff_t *ppos);
+static ssize_t via_dsp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos);
+static ssize_t via_dsp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos);
 static unsigned int via_dsp_poll(struct file *file, struct poll_table_struct *wait);
 static int via_dsp_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
 static int via_dsp_open (struct inode *inode, struct file *file);
@@ -2254,11 +2254,11 @@
 
 
 static ssize_t via_dsp_do_read (struct via_info *card,
-				char *userbuf, size_t count,
+				char __user *userbuf, size_t count,
 				int nonblock)
 {
         DECLARE_WAITQUEUE(wait, current);
-	const char *orig_userbuf = userbuf;
+	const char __user *orig_userbuf = userbuf;
 	struct via_channel *chan = &card->ch_in;
 	size_t size;
 	int n, tmp;
@@ -2388,7 +2388,7 @@
 }
 
 
-static ssize_t via_dsp_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+static ssize_t via_dsp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct via_info *card;
 	int nonblock = (file->f_flags & O_NONBLOCK);
@@ -2431,11 +2431,11 @@
 
 
 static ssize_t via_dsp_do_write (struct via_info *card,
-				 const char *userbuf, size_t count,
+				 const char __user *userbuf, size_t count,
 				 int nonblock)
 {
         DECLARE_WAITQUEUE(wait, current);
-	const char *orig_userbuf = userbuf;
+	const char __user *orig_userbuf = userbuf;
 	struct via_channel *chan = &card->ch_out;
 	volatile struct via_sgd_table *sgtable = chan->sgtable;
 	size_t size;
@@ -2576,7 +2576,7 @@
 }
 
 
-static ssize_t via_dsp_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+static ssize_t via_dsp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct via_info *card;
 	ssize_t rc;
@@ -2779,7 +2779,7 @@
 
 static int via_dsp_ioctl_space (struct via_info *card,
 				struct via_channel *chan,
-				void *arg)
+				void __user *arg)
 {
 	audio_buf_info info;
 
@@ -2824,7 +2824,7 @@
 
 static int via_dsp_ioctl_ptr (struct via_info *card,
 				struct via_channel *chan,
-				void *arg)
+				void __user *arg)
 {
 	count_info info;
 
@@ -2900,6 +2900,8 @@
 	struct via_info *card;
 	struct via_channel *chan;
 	int nonblock = (file->f_flags & O_NONBLOCK);
+	int __user *ip = (int __user *)arg;
+	void __user *p = (void __user *)arg;
 
 	assert (file != NULL);
 	card = file->private_data;
@@ -2920,18 +2922,18 @@
 	/* OSS API version.  XXX unverified */
 	case OSS_GETVERSION:
 		DPRINTK ("ioctl OSS_GETVERSION, EXIT, returning SOUND_VERSION\n");
-		rc = put_user (SOUND_VERSION, (int *)arg);
+		rc = put_user (SOUND_VERSION, ip);
 		break;
 
 	/* list of supported PCM data formats */
 	case SNDCTL_DSP_GETFMTS:
 		DPRINTK ("DSP_GETFMTS, EXIT, returning AFMT U8|S16_LE\n");
-                rc = put_user (AFMT_U8 | AFMT_S16_LE, (int *)arg);
+                rc = put_user (AFMT_U8 | AFMT_S16_LE, ip);
 		break;
 
 	/* query or set current channel's PCM data format */
 	case SNDCTL_DSP_SETFMT:
-		if (get_user(val, (int *)arg)) {
+		if (get_user(val, ip)) {
 			rc = -EFAULT;
 			break;
 		}
@@ -2957,12 +2959,12 @@
 				val = AFMT_U8;
 		}
 		DPRINTK ("SETFMT EXIT, returning %d\n", val);
-                rc = put_user (val, (int *)arg);
+                rc = put_user (val, ip);
 		break;
 
 	/* query or set number of channels (1=mono, 2=stereo, 4/6 for multichannel) */
         case SNDCTL_DSP_CHANNELS:
-		if (get_user(val, (int *)arg)) {
+		if (get_user(val, ip)) {
 			rc = -EFAULT;
 			break;
 		}
@@ -2987,12 +2989,12 @@
 				val = card->ch_out.channels;
 		}
 		DPRINTK ("CHANNELS EXIT, returning %d\n", val);
-                rc = put_user (val, (int *)arg);
+                rc = put_user (val, ip);
 		break;
 
 	/* enable (val is not zero) or disable (val == 0) stereo */
         case SNDCTL_DSP_STEREO:
-		if (get_user(val, (int *)arg)) {
+		if (get_user(val, ip)) {
 			rc = -EFAULT;
 			break;
 		}
@@ -3010,12 +3012,12 @@
 		val = rc - 1;
 
 		DPRINTK ("STEREO EXIT, returning %d\n", val);
-		rc = put_user(val, (int *) arg);
+		rc = put_user(val, ip);
 		break;
 
 	/* query or set sampling rate */
         case SNDCTL_DSP_SPEED:
-		if (get_user(val, (int *)arg)) {
+		if (get_user(val, ip)) {
 			rc = -EFAULT;
 			break;
 		}
@@ -3045,7 +3047,7 @@
 				val = 0;
 		}
 		DPRINTK ("SPEED EXIT, returning %d\n", val);
-                rc = put_user (val, (int *)arg);
+                rc = put_user (val, ip);
 		break;
 
 	/* wait until all buffers have been played, and then stop device */
@@ -3086,7 +3088,7 @@
 	/* obtain bitmask of device capabilities, such as mmap, full duplex, etc. */
 	case SNDCTL_DSP_GETCAPS:
 		DPRINTK ("DSP_GETCAPS\n");
-		rc = put_user(VIA_DSP_CAP, (int *)arg);
+		rc = put_user(VIA_DSP_CAP, ip);
 		break;
 
 	/* obtain buffer fragment size */
@@ -3095,10 +3097,10 @@
 
 		if (rd) {
 			via_chan_set_buffering(card, &card->ch_in, -1);
-			rc = put_user(card->ch_in.frag_size, (int *)arg);
+			rc = put_user(card->ch_in.frag_size, ip);
 		} else if (wr) {
 			via_chan_set_buffering(card, &card->ch_out, -1);
-			rc = put_user(card->ch_out.frag_size, (int *)arg);
+			rc = put_user(card->ch_out.frag_size, ip);
 		}
 		break;
 
@@ -3106,28 +3108,28 @@
 	case SNDCTL_DSP_GETISPACE:
 		DPRINTK ("DSP_GETISPACE\n");
 		if (rd)
-			rc = via_dsp_ioctl_space (card, &card->ch_in, (void*) arg);
+			rc = via_dsp_ioctl_space (card, &card->ch_in, p);
 		break;
 
 	/* obtain information about output buffering */
 	case SNDCTL_DSP_GETOSPACE:
 		DPRINTK ("DSP_GETOSPACE\n");
 		if (wr)
-			rc = via_dsp_ioctl_space (card, &card->ch_out, (void*) arg);
+			rc = via_dsp_ioctl_space (card, &card->ch_out, p);
 		break;
 
 	/* obtain information about input hardware pointer */
 	case SNDCTL_DSP_GETIPTR:
 		DPRINTK ("DSP_GETIPTR\n");
 		if (rd)
-			rc = via_dsp_ioctl_ptr (card, &card->ch_in, (void*) arg);
+			rc = via_dsp_ioctl_ptr (card, &card->ch_in, p);
 		break;
 
 	/* obtain information about output hardware pointer */
 	case SNDCTL_DSP_GETOPTR:
 		DPRINTK ("DSP_GETOPTR\n");
 		if (wr)
-			rc = via_dsp_ioctl_ptr (card, &card->ch_out, (void*) arg);
+			rc = via_dsp_ioctl_ptr (card, &card->ch_out, p);
 		break;
 
 	/* return number of bytes remaining to be played by DMA engine */
@@ -3157,7 +3159,7 @@
 		assert (val <= (chan->frag_size * chan->frag_number));
 
 		DPRINTK ("GETODELAY EXIT, val = %d bytes\n", val);
-                rc = put_user (val, (int *)arg);
+                rc = put_user (val, ip);
 		break;
 		}
 
@@ -3166,7 +3168,7 @@
 	 * occur in the future
 	 */
 	case SNDCTL_DSP_SETTRIGGER:
-		if (get_user(val, (int *)arg)) {
+		if (get_user(val, ip)) {
 			rc = -EFAULT;
 			break;
 		}
@@ -3190,7 +3192,7 @@
 			val |= PCM_ENABLE_INPUT;
 		if ((file->f_mode & FMODE_WRITE) && card->ch_out.is_enabled)
 			val |= PCM_ENABLE_OUTPUT;
-		rc = put_user(val, (int *)arg);
+		rc = put_user(val, ip);
 		break;
 
 	/* Enable full duplex.  Since we do this as soon as we are opened
@@ -3205,7 +3207,7 @@
 
 	/* set fragment size.  implemented as a successful no-op for now */
 	case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(val, (int *)arg)) {
+		if (get_user(val, ip)) {
 			rc = -EFAULT;
 			break;
 		}
@@ -3241,7 +3243,7 @@
 	/* not implemented */
 	default:
 		DPRINTK ("unhandled ioctl, cmd==%u, arg==%p\n",
-			 cmd, (void*) arg);
+			 cmd, p);
 		break;
 	}
 
diff -Nru a/sound/oss/vidc.c b/sound/oss/vidc.c
--- a/sound/oss/vidc.c	Tue Jun 15 22:20:36 2004
+++ b/sound/oss/vidc.c	Tue Jun 15 22:20:36 2004
@@ -116,7 +116,7 @@
 #undef SCALE
 }
 
-static int vidc_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+static int vidc_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
 {
 	unsigned int val;
 	unsigned int mdev;
@@ -127,7 +127,7 @@
 	mdev = _SIOC_NR(cmd);
 
 	if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
-		if (get_user(val, (unsigned int *)arg))
+		if (get_user(val, (unsigned int __user *)arg))
 			return -EFAULT;
 
 		if (mdev < SOUND_MIXER_NRDEVICES)
@@ -167,7 +167,7 @@
 			return -EINVAL;
 	}
 
-	return put_user(val, (unsigned int *)arg) ? -EFAULT : 0;
+	return put_user(val, (unsigned int __user *)arg) ? -EFAULT : 0;
 }
 
 static unsigned int vidc_audio_set_format(int dev, unsigned int fmt)
diff -Nru a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c
--- a/sound/oss/vwsnd.c	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/vwsnd.c	Tue Jun 15 22:20:41 2004
@@ -240,9 +240,9 @@
 /* low-level lithium data */
 
 typedef struct lithium {
-	caddr_t		page0;		/* virtual addresses */
-	caddr_t		page1;
-	caddr_t		page2;
+	void *		page0;		/* virtual addresses */
+	void *		page1;
+	void *		page2;
 	spinlock_t	lock;		/* protects codec and UST/MSC access */
 } lithium_t;
 
@@ -659,7 +659,7 @@
 static void li_shutdown_dma(dma_chan_t *chan)
 {
 	lithium_t *lith = chan->lith;
-	caddr_t lith1 = lith->page1;
+	void * lith1 = lith->page1;
 
 	DBGEV("(chan=0x%p)\n", chan);
 	
@@ -698,7 +698,7 @@
 static void li_deactivate_dma(dma_chan_t *chan)
 {
 	lithium_t *lith = chan->lith;
-	caddr_t lith2 = lith->page2;
+	void * lith2 = lith->page2;
 
 	chan->ctlval &= ~(LI_CCTL_DMA_ENABLE | LI_CCTL_RPTR | LI_CCTL_WPTR);
 	DBGPV("ctlval = 0x%lx\n", chan->ctlval);
@@ -1480,10 +1480,10 @@
 	int		hwbuf_size;
 	unsigned long	hwbuf_paddr;
 	unsigned long	hwbuf_vaddr;
-	caddr_t		hwbuf;		/* hwbuf == hwbuf_vaddr */
+	void *		hwbuf;		/* hwbuf == hwbuf_vaddr */
 	int		hwbuf_max;	/* max bytes to preload */
 
-	caddr_t		swbuf;
+	void *		swbuf;
 	unsigned int	swbuf_size;	/* size in bytes */
 	unsigned int	swb_u_idx;	/* index of next user byte */
 	unsigned int	swb_i_idx;	/* index of next intr byte */
@@ -3083,7 +3083,7 @@
 
 /* mixer_read_ioctl handles all read ioctls on the mixer device. */
 
-static int mixer_read_ioctl(vwsnd_dev_t *devc, unsigned int nr, caddr_t arg)
+static int mixer_read_ioctl(vwsnd_dev_t *devc, unsigned int nr, void __user *arg)
 {
 	int val = -1;
 
@@ -3145,19 +3145,19 @@
 	default:
 		return -EINVAL;
 	}
-	return put_user(val, (int *) arg);
+	return put_user(val, (int __user *) arg);
 }
 
 /* mixer_write_ioctl handles all write ioctls on the mixer device. */
 
-static int mixer_write_ioctl(vwsnd_dev_t *devc, unsigned int nr, caddr_t arg)
+static int mixer_write_ioctl(vwsnd_dev_t *devc, unsigned int nr, void __user *arg)
 {
 	int val;
 	int err;
 
 	DBGEV("(devc=0x%p, nr=0x%x, arg=0x%p)\n", devc, nr, arg);
 
-	err = get_user(val, (int *) arg);
+	err = get_user(val, (int __user *) arg);
 	if (err)
 		return -EFAULT;
 	switch (nr) {
@@ -3196,7 +3196,7 @@
 	}
 	if (val < 0)
 		return val;
-	return put_user(val, (int *) arg);
+	return put_user(val, (int __user *) arg);
 }
 
 /* This is the ioctl entry to the mixer driver. */
@@ -3216,9 +3216,9 @@
 	down(&devc->mix_sema);
 	{
 		if ((cmd & ~nrmask) == MIXER_READ(0))
-			retval = mixer_read_ioctl(devc, nr, (caddr_t) arg);
+			retval = mixer_read_ioctl(devc, nr, (void __user *) arg);
 		else if ((cmd & ~nrmask) == MIXER_WRITE(0))
-			retval = mixer_write_ioctl(devc, nr, (caddr_t) arg);
+			retval = mixer_write_ioctl(devc, nr, (void __user *) arg);
 		else
 			retval = -EINVAL;
 	}
@@ -3313,7 +3313,7 @@
 	devc->rport.hwbuf_vaddr = __get_free_pages(GFP_KERNEL, HWBUF_ORDER);
 	if (!devc->rport.hwbuf_vaddr)
 		goto fail2;
-	devc->rport.hwbuf = (caddr_t) devc->rport.hwbuf_vaddr;
+	devc->rport.hwbuf = (void *) devc->rport.hwbuf_vaddr;
 	devc->rport.hwbuf_paddr = virt_to_phys(devc->rport.hwbuf);
 
 	/*
@@ -3336,7 +3336,7 @@
 	devc->wport.hwbuf_vaddr = __get_free_pages(GFP_KERNEL, HWBUF_ORDER);
 	if (!devc->wport.hwbuf_vaddr)
 		goto fail3;
-	devc->wport.hwbuf = (caddr_t) devc->wport.hwbuf_vaddr;
+	devc->wport.hwbuf = (void *) devc->wport.hwbuf_vaddr;
 	devc->wport.hwbuf_paddr = virt_to_phys(devc->wport.hwbuf);
 	DBGP("wport hwbuf = 0x%p\n", devc->wport.hwbuf);
 
diff -Nru a/sound/oss/waveartist.c b/sound/oss/waveartist.c
--- a/sound/oss/waveartist.c	Tue Jun 15 22:20:39 2004
+++ b/sound/oss/waveartist.c	Tue Jun 15 22:20:39 2004
@@ -153,7 +153,7 @@
 #else
 static struct timer_list vnc_timer;
 static void vnc_configure_mixer(wavnc_info *devc, unsigned int input_mask);
-static int vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg);
+static int vnc_private_ioctl(int dev, unsigned int cmd, int __user *arg);
 static void vnc_slider_tick(unsigned long data);
 #endif
 
@@ -515,7 +515,7 @@
 }
 
 static int
-waveartist_ioctl(int dev, unsigned int cmd, caddr_t arg)
+waveartist_ioctl(int dev, unsigned int cmd, void __user * arg)
 {
 	return -EINVAL;
 }
@@ -1125,7 +1125,7 @@
 }
 
 static int
-waveartist_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
+waveartist_mixer_ioctl(int dev, unsigned int cmd, void __user * arg)
 {
 	wavnc_info *devc = (wavnc_info *)audio_devs[dev]->devc;
 	int ret = 0, val, nr;
@@ -1149,7 +1149,7 @@
 	nr = cmd & 0xff;
 
 	if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
-		if (get_user(val, (int *)arg))
+		if (get_user(val, (int __user *)arg))
 			return -EFAULT;
 
 		switch (nr) {
@@ -1196,7 +1196,7 @@
 		}
 
 		if (ret >= 0)
-			ret = put_user(ret, (int *)arg) ? -EFAULT : 0;
+			ret = put_user(ret, (int __user *)arg) ? -EFAULT : 0;
 	}
 
 	return ret;
@@ -1804,7 +1804,7 @@
 }
 
 static int
-vnc_private_ioctl(int dev, unsigned int cmd, caddr_t arg)
+vnc_private_ioctl(int dev, unsigned int cmd, int __user * arg)
 {
 	wavnc_info *devc = (wavnc_info *)audio_devs[dev]->devc;
 	int val;
@@ -1815,7 +1815,7 @@
 		u_int prev_spkr_mute, prev_line_mute, prev_auto_state;
 		int val;
 
-		if (get_user(val, (int *)arg))
+		if (get_user(val, arg))
 			return -EFAULT;
 
 		/* check if parameter is logical */
@@ -1845,7 +1845,7 @@
 	}
 
 	case SOUND_MIXER_PRIVATE2:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, arg))
 			return -EFAULT;
 
 		switch (val) {
@@ -1870,7 +1870,7 @@
 		unsigned long	flags;
 		int		mixer_reg[15], i, val;
 
-		if (get_user(val, (int *)arg))
+		if (get_user(val, arg))
 			return -EFAULT;
 		if (copy_from_user(mixer_reg, (void *)val, sizeof(mixer_reg)))
 			return -EFAULT;
@@ -1917,7 +1917,7 @@
 		      (devc->telephone_detect ? VNC_PHONE_DETECT       : 0) |
 		      (devc->no_autoselect    ? VNC_DISABLE_AUTOSWITCH : 0);
 
-		return put_user(val, (int *)arg) ? -EFAULT : 0;
+		return put_user(val, arg) ? -EFAULT : 0;
 	}
 
 	if (_SIOC_DIR(cmd) & _SIOC_WRITE) {
@@ -1936,7 +1936,7 @@
 		if ((cmd & 0xff) == SOUND_MIXER_SPEAKER) {
 			unsigned int val, l, r;
 
-			if (get_user(val, (int *)arg))
+			if (get_user(val, arg))
 				return -EFAULT;
 
 			l = val & 0x7f;
diff -Nru a/sound/oss/wavfront.c b/sound/oss/wavfront.c
--- a/sound/oss/wavfront.c	Tue Jun 15 22:20:41 2004
+++ b/sound/oss/wavfront.c	Tue Jun 15 22:20:41 2004
@@ -114,7 +114,7 @@
 #define OSS_SUPPORT_LEVEL          0x1  /* just /dev/sequencer for now */
 
 #if    OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ
-static int (*midi_load_patch) (int devno, int format, const char *addr,
+static int (*midi_load_patch) (int devno, int format, const char __user *addr,
 			       int offs, int count, int pmgr_flag) = NULL;
 #endif /* OSS_SUPPORT_SEQ */
 
@@ -996,7 +996,7 @@
 
 static int
 wavefront_send_sample (wavefront_patch_info *header,
-		       UINT16 *dataptr,
+		       UINT16 __user *dataptr,
 		       int data_is_unsigned)
 
 {
@@ -1011,7 +1011,7 @@
 
 	UINT16 sample_short;
 	UINT32 length;
-	UINT16 *data_end = 0;
+	UINT16 __user *data_end = 0;
 	unsigned int i;
 	const int max_blksize = 4096/2;
 	unsigned int written;
@@ -1024,11 +1024,11 @@
 	int initial_skip = 0;
 
 	DPRINT (WF_DEBUG_LOAD_PATCH, "sample %sdownload for slot %d, "
-				      "type %d, %d bytes from 0x%x\n",
+				      "type %d, %d bytes from %p\n",
 				      header->size ? "" : "header ", 
 				      header->number, header->subkey,
 				      header->size,
-				      (int) header->dataptr);
+				      header->dataptr);
 
 	if (header->number == WAVEFRONT_FIND_FREE_SAMPLE_SLOT) {
 		int x;
@@ -1512,7 +1512,7 @@
 }
 
 static int
-wavefront_load_gus_patch (int devno, int format, const char *addr,
+wavefront_load_gus_patch (int devno, int format, const char __user *addr,
 			  int offs, int count, int pmgr_flag)
 {
 	struct patch_info guspatch;
@@ -1636,7 +1636,7 @@
 	/* Now ship it down */
 
 	wavefront_send_sample (&samp, 
-			       (unsigned short *) &(addr)[sizeof_patch],
+			       (unsigned short __user *) &(addr)[sizeof_patch],
 			       (guspatch.mode & WAVE_UNSIGNED) ? 1:0);
 	wavefront_send_patch (&pat);
 	wavefront_send_program (&prog);
@@ -1656,7 +1656,7 @@
 }
 
 static int
-wavefront_load_patch (const char *addr)
+wavefront_load_patch (const char __user *addr)
 
 
 {
@@ -1680,7 +1680,7 @@
 	case WF_ST_SAMPLE:  /* sample or sample_header, based on patch->size */
 
 		if (copy_from_user((unsigned char *) &header.hdr.s,
-				   (unsigned char *) header.hdrptr,
+				   (unsigned char __user *) header.hdrptr,
 				   sizeof (wavefront_sample)))
 			return -EFAULT;
 
@@ -1688,8 +1688,7 @@
 
 	case WF_ST_MULTISAMPLE:
 
-		if (copy_from_user((unsigned char *) &header.hdr.s,
-				   (unsigned char *) header.hdrptr,
+		if (copy_from_user(&header.hdr.s, header.hdrptr,
 				   sizeof(wavefront_multisample)))
 			return -EFAULT;
 
@@ -1698,32 +1697,28 @@
 
 	case WF_ST_ALIAS:
 
-		if (copy_from_user((unsigned char *) &header.hdr.a,
-				   (unsigned char *) header.hdrptr,
+		if (copy_from_user(&header.hdr.a, header.hdrptr,
 				   sizeof (wavefront_alias)))
 			return -EFAULT;
 
 		return wavefront_send_alias (&header);
 
 	case WF_ST_DRUM:
-		if (copy_from_user((unsigned char *) &header.hdr.d, 
-				   (unsigned char *) header.hdrptr,
+		if (copy_from_user(&header.hdr.d, header.hdrptr,
 				   sizeof (wavefront_drum)))
 			return -EFAULT;
 
 		return wavefront_send_drum (&header);
 
 	case WF_ST_PATCH:
-		if (copy_from_user((unsigned char *) &header.hdr.p, 
-				   (unsigned char *) header.hdrptr,
+		if (copy_from_user(&header.hdr.p, header.hdrptr,
 				   sizeof (wavefront_patch)))
 			return -EFAULT;
 
 		return wavefront_send_patch (&header);
 
 	case WF_ST_PROGRAM:
-		if (copy_from_user((unsigned char *) &header.hdr.pr, 
-				   (unsigned char *) header.hdrptr,
+		if (copy_from_user(&header.hdr.pr, header.hdrptr,
 				   sizeof (wavefront_program)))
 			return -EFAULT;
 
@@ -1940,18 +1935,18 @@
 	switch (cmd) {
 
 	case WFCTL_WFCMD:
-		if (copy_from_user(&wc, (void *) arg, sizeof (wc)))
+		if (copy_from_user(&wc, (void __user *) arg, sizeof (wc)))
 			return -EFAULT;
 		
 		if ((err = wavefront_synth_control (cmd, &wc)) == 0) {
-			if (copy_to_user ((void *) arg, &wc, sizeof (wc)))
+			if (copy_to_user ((void __user *) arg, &wc, sizeof (wc)))
 				return -EFAULT;
 		}
 
 		return err;
 		
 	case WFCTL_LOAD_SPP:
-		return wavefront_load_patch ((const char *) arg);
+		return wavefront_load_patch ((const char __user *) arg);
 		
 	default:
 		printk (KERN_WARNING LOGNAME "invalid ioctl %#x\n", cmd);
@@ -1998,7 +1993,7 @@
 }
 
 static int
-wavefront_oss_ioctl (int devno, unsigned int cmd, caddr_t arg)
+wavefront_oss_ioctl (int devno, unsigned int cmd, void __user * arg)
 
 {
 	wavefront_control wc;
@@ -2006,8 +2001,7 @@
 
 	switch (cmd) {
 	case SNDCTL_SYNTH_INFO:
-		if(copy_to_user(&((char *) arg)[0], &wavefront_info,
-			sizeof (wavefront_info)))
+		if(copy_to_user(arg, &wavefront_info, sizeof (wavefront_info)))
 			return -EFAULT;
 		return 0;
 
@@ -2043,7 +2037,7 @@
 }
 
 int
-wavefront_oss_load_patch (int devno, int format, const char *addr,
+wavefront_oss_load_patch (int devno, int format, const char __user *addr,
 			  int offs, int count, int pmgr_flag)
 {
 
@@ -3003,7 +2997,7 @@
 				return -(EINVAL);
 			}
 			if (copy_from_user(page_data,
-					   (unsigned char *)r->data[3],
+					   (unsigned char __user *)r->data[3],
 					   r->data[2]))
 				return -EFAULT;
 			pd = page_data;
diff -Nru a/sound/oss/wf_midi.c b/sound/oss/wf_midi.c
--- a/sound/oss/wf_midi.c	Tue Jun 15 22:20:37 2004
+++ b/sound/oss/wf_midi.c	Tue Jun 15 22:20:37 2004
@@ -537,7 +537,7 @@
 	return 0;
 }
 
-static int wf_mpu_ioctl (int dev, unsigned cmd, caddr_t arg)
+static int wf_mpu_ioctl (int dev, unsigned cmd, void __user *arg)
 {
 	printk (KERN_WARNING
 		"WF-MPU: Intelligent mode not supported by hardware.\n");
@@ -573,8 +573,7 @@
 static struct synth_info wf_mpu_synth_info[2];
 
 static int
-wf_mpu_synth_ioctl (int dev,
-		    unsigned int cmd, caddr_t arg)
+wf_mpu_synth_ioctl (int dev, unsigned int cmd, void __user *arg)
 {
 	int             midi_dev;
 	int index;
@@ -595,7 +594,7 @@
 	switch (cmd) {
 
 	case SNDCTL_SYNTH_INFO:
-		if(copy_to_user (&((char *) arg)[0],
+		if (copy_to_user(arg,
 			      &wf_mpu_synth_info[index],
 			      sizeof (struct synth_info)))
 			return -EFAULT;
diff -Nru a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c
--- a/sound/oss/ymfpci.c	Tue Jun 15 22:20:42 2004
+++ b/sound/oss/ymfpci.c	Tue Jun 15 22:20:42 2004
@@ -1220,7 +1220,7 @@
  * machine and drained by this loop.
  */
 static ssize_t
-ymf_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
+ymf_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct ymf_state *state = (struct ymf_state *)file->private_data;
 	struct ymf_dmabuf *dmabuf = &state->rpcm.dmabuf;
@@ -1335,7 +1335,7 @@
 }
 
 static ssize_t
-ymf_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
+ymf_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
 	struct ymf_state *state = (struct ymf_state *)file->private_data;
 	struct ymf_dmabuf *dmabuf = &state->wpcm.dmabuf;
@@ -1568,11 +1568,13 @@
 	count_info cinfo;
 	int redzone;
 	int val;
+	void __user *argp = (void __user *)arg;
+	int __user *p = argp;
 
 	switch (cmd) {
 	case OSS_GETVERSION:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(GETVER) arg 0x%lx\n", cmd, arg);
-		return put_user(SOUND_VERSION, (int *)arg);
+		return put_user(SOUND_VERSION, p);
 
 	case SNDCTL_DSP_RESET:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(RESET)\n", cmd);
@@ -1614,7 +1616,7 @@
 		return 0;
 
 	case SNDCTL_DSP_SPEED: /* set smaple rate */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		YMFDBGX("ymf_ioctl: cmd 0x%x(SPEED) sp %d\n", cmd, val);
 		if (val >= 8000 && val <= 48000) {
@@ -1637,7 +1639,7 @@
 				spin_unlock_irqrestore(&state->unit->reg_lock, flags);
 			}
 		}
-		return put_user(state->format.rate, (int *)arg);
+		return put_user(state->format.rate, p);
 
 	/*
 	 * OSS manual does not mention SNDCTL_DSP_STEREO at all.
@@ -1646,7 +1648,7 @@
 	 * However, mpg123 calls it. I wonder, why Michael Hipp used it.
 	 */
 	case SNDCTL_DSP_STEREO: /* set stereo or mono channel */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		YMFDBGX("ymf_ioctl: cmd 0x%x(STEREO) st %d\n", cmd, val);
 		if (file->f_mode & FMODE_WRITE) {
@@ -1676,23 +1678,23 @@
 				return val;
 			val = state->wpcm.dmabuf.fragsize;
 			YMFDBGX("ymf_ioctl: GETBLK w %d\n", val);
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 		}
 		if (file->f_mode & FMODE_READ) {
 			if ((val = prog_dmabuf(state, 1)))
 				return val;
 			val = state->rpcm.dmabuf.fragsize;
 			YMFDBGX("ymf_ioctl: GETBLK r %d\n", val);
-			return put_user(val, (int *)arg);
+			return put_user(val, p);
 		}
 		return -EINVAL;
 
 	case SNDCTL_DSP_GETFMTS: /* Returns a mask of supported sample format*/
 		YMFDBGX("ymf_ioctl: cmd 0x%x(GETFMTS)\n", cmd);
-		return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
+		return put_user(AFMT_S16_LE|AFMT_U8, p);
 
 	case SNDCTL_DSP_SETFMT: /* Select sample format */
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		YMFDBGX("ymf_ioctl: cmd 0x%x(SETFMT) fmt %d\n", cmd, val);
 		if (val == AFMT_S16_LE || val == AFMT_U8) {
@@ -1715,10 +1717,10 @@
 				spin_unlock_irqrestore(&state->unit->reg_lock, flags);
 			}
 		}
-		return put_user(state->format.format, (int *)arg);
+		return put_user(state->format.format, p);
 
 	case SNDCTL_DSP_CHANNELS:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		YMFDBGX("ymf_ioctl: cmd 0x%x(CHAN) ch %d\n", cmd, val);
 		if (val != 0) {
@@ -1745,7 +1747,7 @@
 				}
 			}
 		}
-		return put_user(state->format.voices, (int *)arg);
+		return put_user(state->format.voices, p);
 
 	case SNDCTL_DSP_POST:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(POST)\n", cmd);
@@ -1768,7 +1770,7 @@
 		return 0;
 
 	case SNDCTL_DSP_SETFRAGMENT:
-		if (get_user(val, (int *)arg))
+		if (get_user(val, p))
 			return -EFAULT;
 		YMFDBGX("ymf_ioctl: cmd 0x%x(SETFRAG) fr 0x%04x:%04x(%d:%d)\n",
 		    cmd,
@@ -1799,7 +1801,7 @@
 		abinfo.fragstotal = dmabuf->numfrag;
 		abinfo.fragments = abinfo.bytes >> dmabuf->fragshift;
 		spin_unlock_irqrestore(&state->unit->reg_lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETISPACE:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(GETISPACE)\n", cmd);
@@ -1814,7 +1816,7 @@
 		abinfo.fragstotal = dmabuf->numfrag;
 		abinfo.fragments = abinfo.bytes >> dmabuf->fragshift;
 		spin_unlock_irqrestore(&state->unit->reg_lock, flags);
-		return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_NONBLOCK:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(NONBLOCK)\n", cmd);
@@ -1824,8 +1826,8 @@
 	case SNDCTL_DSP_GETCAPS:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(GETCAPS)\n", cmd);
 		/* return put_user(DSP_CAP_REALTIME|DSP_CAP_TRIGGER|DSP_CAP_MMAP,
-			    (int *)arg); */
-		return put_user(0, (int *)arg);
+			    p); */
+		return put_user(0, p);
 
 	case SNDCTL_DSP_GETIPTR:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(GETIPTR)\n", cmd);
@@ -1839,7 +1841,7 @@
 		spin_unlock_irqrestore(&state->unit->reg_lock, flags);
 		YMFDBGX("ymf_ioctl: GETIPTR ptr %d bytes %d\n",
 		    cinfo.ptr, cinfo.bytes);
-		return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_GETOPTR:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(GETOPTR)\n", cmd);
@@ -1853,7 +1855,7 @@
 		spin_unlock_irqrestore(&state->unit->reg_lock, flags);
 		YMFDBGX("ymf_ioctl: GETOPTR ptr %d bytes %d\n",
 		    cinfo.ptr, cinfo.bytes);
-		return copy_to_user((void *)arg, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
+		return copy_to_user(argp, &cinfo, sizeof(cinfo)) ? -EFAULT : 0;
 
 	case SNDCTL_DSP_SETDUPLEX:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(SETDUPLEX)\n", cmd);
@@ -1861,15 +1863,15 @@
 
 	case SOUND_PCM_READ_RATE:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(READ_RATE)\n", cmd);
-		return put_user(state->format.rate, (int *)arg);
+		return put_user(state->format.rate, p);
 
 	case SOUND_PCM_READ_CHANNELS:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(READ_CH)\n", cmd);
-		return put_user(state->format.voices, (int *)arg);
+		return put_user(state->format.voices, p);
 
 	case SOUND_PCM_READ_BITS:
 		YMFDBGX("ymf_ioctl: cmd 0x%x(READ_BITS)\n", cmd);
-		return put_user(AFMT_S16_LE, (int *)arg);
+		return put_user(AFMT_S16_LE, p);
 
 	case SNDCTL_DSP_MAPINBUF:
 	case SNDCTL_DSP_MAPOUTBUF:
diff -Nru a/sound/parisc/harmony.c b/sound/parisc/harmony.c
--- a/sound/parisc/harmony.c	Tue Jun 15 22:20:39 2004
+++ b/sound/parisc/harmony.c	Tue Jun 15 22:20:39 2004
@@ -56,11 +56,7 @@
  * also controls for enabling/disabling internal speaker and line
  * input.
  *
- * Buffers used by this driver are all DMA consistent. Since harmony is
- * not "real" pci device, we use a fake struct pci_dev for
- * pci_alloc_consistent().
- * (note that some machines -712 for ex.- don't implement DMA consistent
- * memory, so we will need to use kmalloc instead)
+ * Buffers used by this driver are all DMA consistent.
  */
 
 #include <linux/delay.h>
@@ -70,11 +66,11 @@
 #include <linux/slab.h>
 #include <linux/time.h>
 #include <linux/wait.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/rawmidi.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/info.h>
 #include <asm/hardware.h>
@@ -100,16 +96,14 @@
 #define MAX_PCM_SUBSTREAMS	4
 #define MAX_MIDI_DEVICES	0
 
-#define BUFFER_SIZE			4096
-#define MAX_BUFS			10
+#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 MAX_BUFFER_SIZE		(MAX_BUFS * BUFFER_SIZE)
-#define HARMONY_BUF_SIZE	BUFFER_SIZE
-
 #define HARMONY_CNTL_C		0x80000000
 
 #define HARMONY_DSTATUS_PN	0x00000200
@@ -140,6 +134,17 @@
 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;
+static int boot_devs;
+
+module_param_array(index, int, boot_devs, 0444);
+MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard.");
+MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
+module_param_array(id, charp, boot_devs, 0444);
+MODULE_PARM_DESC(id, "ID string for Sun CS4231 soundcard.");
+MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
+module_param_array(enable, bool, boot_devs, 0444);
+MODULE_PARM_DESC(enable, "Enable Sun CS4231 soundcard.");
+MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 
 /* Register offset (from base hpa) */
 #define REG_ID		0x00
@@ -191,21 +196,18 @@
 	int cap_stopped;
 	int cap_total;
 
-	struct pci_dev *fake_pci_dev; /* The fake pci_dev needed for 
-					pci_* functions under ccio. */
+	struct parisc_device *pa_dev;
+
+	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 */
-
-	unsigned char *graveyard_addr;
-	dma_addr_t graveyard_dma;
+	struct snd_dma_buffer graveyard_dma;
 	int graveyard_count;
 	
 	/* same thing for silence buffer */
-	unsigned char *silence_addr;
-	dma_addr_t silence_dma;
+	struct snd_dma_buffer silence_dma;
 	int silence_count;
-	struct snd_dma_device dma_dev;
 
 	/* alsa stuff */
 	snd_card_t *card;
@@ -264,6 +266,15 @@
 #define HARMONY_SR_33KHZ	0x16
 #define HARMONY_SR_6KHZ		0x17
 
+/* bits corresponding to the entries of snd_card_harmony_rates */
+static unsigned int rate_bits[14] = {
+	HARMONY_SR_5KHZ, HARMONY_SR_6KHZ, HARMONY_SR_8KHZ,
+	HARMONY_SR_9KHZ, HARMONY_SR_11KHZ, HARMONY_SR_16KHZ,
+	HARMONY_SR_18KHZ, HARMONY_SR_22KHZ, HARMONY_SR_27KHZ,
+	HARMONY_SR_32KHZ, HARMONY_SR_33KHZ, HARMONY_SR_37KHZ,
+	HARMONY_SR_44KHZ, HARMONY_SR_48KHZ
+};
+
 /* snd_card_harmony_rate_bits
  * @rate:	index of current data rate in list
  * returns: harmony hex code for registers
@@ -273,26 +284,9 @@
 	unsigned int idx;
 	
 	for (idx = 0; idx <= RATES; idx++)
-		if (snd_card_harmony_rates[idx] == rate) break;
-	
-	switch (idx) {
-		case 0: return HARMONY_SR_5KHZ;
-		case 1: return HARMONY_SR_6KHZ;
-		case 2: return HARMONY_SR_8KHZ;
-		case 3: return HARMONY_SR_9KHZ;
-		case 4: return HARMONY_SR_11KHZ;
-		case 5: return HARMONY_SR_16KHZ;
-		case 6: return HARMONY_SR_18KHZ;
-		case 7: return HARMONY_SR_22KHZ;
-		case 8: return HARMONY_SR_27KHZ;
-		case 9: return HARMONY_SR_32KHZ;
-		case 10: return HARMONY_SR_33KHZ;
-		case 11: return HARMONY_SR_37KHZ;
-		case 12: return HARMONY_SR_44KHZ;
-		case 13: return HARMONY_SR_48KHZ;
-		default:  /* fallback */
-				return HARMONY_SR_44KHZ;
-	}
+		if (snd_card_harmony_rates[idx] == rate)
+			return rate_bits[idx];
+	return HARMONY_SR_44KHZ; /* fallback */
 }
 
 /*
@@ -317,27 +311,6 @@
 }
 
 /*
- * silence a buffer
- * XXX: alsa could probably do this by itself
- * XXX: memset hpmc, commented.
- */
-
-void snd_harmony_silence(snd_card_harmony_t *harmony,
-		void *addr, int length)
-{
-	u8 silence_char;
-	
-	switch(harmony->data_format) {
-			case HARMONY_DF_8BIT_ULAW: silence_char = 0x55; break;
-			case HARMONY_DF_8BIT_ALAW: silence_char = 0xff; break;
-			case HARMONY_DF_16BIT_LINEAR:
-			default:
-									   silence_char = 0;
-	}
-	//memset(addr, silence_char, length);
-}
-
-/*
  * interruption controls routines
  */
 
@@ -385,9 +358,9 @@
 			snd_pcm_period_elapsed(harmony->playback_substream);
 			harmony->ply_total++;
 		} else {
-			gsc_writel(harmony->silence_dma + 
-					(HARMONY_BUF_SIZE*harmony->silence_count),
-					hpa+REG_PNXTADD);
+			gsc_writel(harmony->silence_dma.addr + 
+				   (HARMONY_BUF_SIZE*harmony->silence_count),
+				   hpa+REG_PNXTADD);
 			harmony->silence_count++;
 			harmony->silence_count %= SILENCE_BUFS;
 		}
@@ -406,9 +379,9 @@
 			harmony->cap_total++;
 		} else {
 			/* graveyard buffer */
-			gsc_writel(harmony->graveyard_dma +
-						(HARMONY_BUF_SIZE*harmony->graveyard_count),
-						hpa+REG_RNXTADD);
+			gsc_writel(harmony->graveyard_dma.addr +
+				   (HARMONY_BUF_SIZE*harmony->graveyard_count),
+				   hpa+REG_RNXTADD);
 			harmony->graveyard_count++;
 			harmony->graveyard_count %= GRAVEYARD_BUFS;
 		}
@@ -465,26 +438,8 @@
 {
 	snd_info_entry_t *entry;
 	
-	if ((entry = snd_info_create_card_entry(harmony->card, "harmony", harmony->card->proc_root)) != NULL) {
-		entry->content = SNDRV_INFO_CONTENT_TEXT;
-		entry->private_data = harmony;
-		entry->mode = S_IFREG | S_IRUGO | S_IWUSR;
-		entry->c.text.read_size = 2048;	 /* should be enough */
-		entry->c.text.read = snd_harmony_proc_read;
-		if (snd_info_register(entry) < 0) {
-			snd_info_free_entry(entry);
-			entry = NULL;
-		}
-	}
-	harmony->proc_entry = entry;
-}
-
-static void snd_harmony_proc_done(snd_card_harmony_t *harmony)
-{
-	if (harmony->proc_entry) {
-		snd_info_unregister(harmony->proc_entry);
-		harmony->proc_entry = NULL;
-	}
+	if (! snd_card_proc_new(harmony->card, "harmony", &entry))
+		snd_info_set_text_ops(entry, harmony, 2048, snd_harmony_proc_read);
 }
 
 /* 
@@ -563,6 +518,30 @@
 	return 0;
 }
 
+/* set data format */
+static int snd_harmony_set_data_format(snd_card_harmony_t *harmony, int pcm_format)
+{
+	int old_format = harmony->data_format;
+	int new_format = old_format;
+	switch (pcm_format) {
+	case SNDRV_PCM_FORMAT_S16_BE:
+		new_format = HARMONY_DF_16BIT_LINEAR;
+		break;
+	case SNDRV_PCM_FORMAT_A_LAW:
+		new_format = HARMONY_DF_8BIT_ALAW;
+		break;
+	case SNDRV_PCM_FORMAT_MU_LAW:
+		new_format = HARMONY_DF_8BIT_ULAW;
+		break;
+	}
+	/* 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;
+}
+
 static int snd_card_harmony_playback_prepare(snd_pcm_substream_t * substream)
 {
 	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
@@ -577,12 +556,13 @@
 	harmony->sample_rate = snd_card_harmony_rate_bits(runtime->rate);
 
 	/* data format */
-	if (snd_pcm_format_width(runtime->format) == 16) harmony->data_format = HARMONY_DF_16BIT_LINEAR;
-	else harmony->data_format = HARMONY_DF_8BIT_ULAW;
-	
+	harmony->data_format = snd_harmony_set_data_format(haromny, runtime->format);
+
 	/* number of channels */
-	if (runtime->channels == 2) harmony->stereo_select = HARMONY_SS_STEREO;
-	else harmony->stereo_select = HARMONY_SS_MONO;
+	if (runtime->channels == 2)
+		harmony->stereo_select = HARMONY_SS_STEREO;
+	else
+		harmony->stereo_select = HARMONY_SS_MONO;
 	
 	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);
@@ -607,12 +587,13 @@
 	harmony->sample_rate = snd_card_harmony_rate_bits(runtime->rate);
 	
 	/* data format */
-	if (snd_pcm_format_width(runtime->format) == 16) harmony->data_format = HARMONY_DF_16BIT_LINEAR;
-	else harmony->data_format = HARMONY_DF_8BIT_ULAW;
+	harmony->data_format = snd_harmony_set_data_format(haromny, 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;
+	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;
@@ -709,13 +690,6 @@
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
 	
-	/*
-	 * harmony is not "real" pci, but we need a pci_dev
-	 * to alloc PCI DMA pages
-	 */
-	substream->runtime->dma_private = harmony->fake_pci_dev;
-//	substream->dma_type = SNDRV_PCM_DMA_TYPE_PCI;
-	
 	harmony->playback_substream = substream;
 	runtime->hw = snd_card_harmony_playback;
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraint_rates);
@@ -732,14 +706,6 @@
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
 	
-	
-	/*
-	 * harmony is not "real" pci, but we need a pci_dev
-	 * to alloc PCI DMA pages
-	 */
-	substream->runtime->dma_private = harmony->fake_pci_dev;
-//	substream->dma_type = SNDRV_PCM_DMA_TYPE_PCI;
-
 	harmony->capture_substream = substream;
 	runtime->hw = snd_card_harmony_capture;
 	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraint_rates);
@@ -752,7 +718,6 @@
 static int snd_card_harmony_playback_close(snd_pcm_substream_t * substream)
 {
 	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	snd_pcm_lib_free_pages(substream);
 	
 	harmony->playback_substream = NULL;
 	harmony->ply_size 			= 0;
@@ -769,8 +734,6 @@
 {
 	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
 	
-	snd_pcm_lib_free_pages(substream);
-	
 	harmony->capture_substream = NULL;
 	harmony->cap_size 			= 0;
 	harmony->cap_buf			= 0;
@@ -785,12 +748,11 @@
 static int snd_card_harmony_hw_params(snd_pcm_substream_t *substream, 
 	                   snd_pcm_hw_params_t * hw_params)
 {
-	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
 	
 	err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
 	DPRINTK(KERN_INFO PFX "HW Params returned %d, dma_addr %lx\n", err,
-			(unsigned long)runtime->dma_addr);
+			(unsigned long)substream->runtime->dma_addr);
 	return err;
 }
 
@@ -847,15 +809,19 @@
 	harmony->pcm = pcm;
 	
 	/* initialize graveyard buffer */
-	harmony->dma_dev.type = SNDRV_DMA_TYPE_PCI;
-	harmony->dma_dev.dev = snd_dma_pci_data(harmony->fake_pci_dev); 
-	harmony->graveyard_addr = snd_dma_alloc_pages(&chip->dma_dev,
-			HARMONY_BUF_SIZE*GRAVEYARD_BUFS, &harmony->graveyard_dma);
+	harmony->dma_dev.type = SNDRV_DMA_TYPE_DEV;
+	harmony->dma_dev.dev = &harmony->pa_dev->dev;
+	err = snd_dma_alloc_pages(&harmony->dma_dev, HARMONY_BUF_SIZE*GRAVEYARD_BUFS,
+				  &harmony->graveyard_dma);
+	if (err < 0)
+		return err;
 	harmony->graveyard_count = 0;
 	
 	/* initialize silence buffers */
-	harmony->silence_addr = snd_dma_alloc_pages(&chip->dma_dev,
-			HARMONY_BUF_SIZE*SILENCE_BUFS, &harmony->silence_dma);
+	err = snd_dma_alloc_pages(&harmony->dma_dev, HARMONY_BUF_SIZE*SILENCE_BUFS,
+				  &harmony->silence_dma);
+	if (err < 0)
+		return err;
 	harmony->silence_count = 0;
 
 	harmony->ply_stopped = harmony->cap_stopped = 1;
@@ -865,8 +831,8 @@
 	harmony->graveyard_count = 0;
 	
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
-					      snd_dma_pci_data(harmony->fake_pci_dev),
-					      64 * 1024, 128 * 1024);
+					      &harmony->pa_dev->dev,
+					      MAX_BUFFER_SIZE, MAX_BUFFER_SIZE);
 
 	return 0;
 }
@@ -963,7 +929,7 @@
 HARMONY_VOLUME("PCM Playback Volume", 6, 0, 0x3f, 1),
 };
 
-static void snd_harmony_reset_codec(snd_card_harmony_t *harmony)
+static void __init snd_harmony_reset_codec(snd_card_harmony_t *harmony)
 {
  	snd_harmony_wait_cntl(harmony);
 	gsc_writel(1, harmony->hpa+REG_RESET);
@@ -985,7 +951,7 @@
 }
 
 
-int __init snd_card_harmony_mixer_init(snd_card_harmony_t *harmony)
+static int __init snd_card_harmony_mixer_init(snd_card_harmony_t *harmony)
 {
 	snd_card_t *card = harmony->card;
 	int idx, err;
@@ -1009,10 +975,11 @@
 	
 	harmony->card = card;
 	
+	harmony->pa_dev = pa_dev;
+
 	/* Set the HPA of harmony */
 	harmony->hpa = pa_dev->hpa;
 	
-
 	harmony->irq = pa_dev->irq;
 	if (!harmony->irq) {
 		printk(KERN_ERR PFX "no irq found\n");
@@ -1038,8 +1005,6 @@
 		return -EBUSY;
 	}
 	
-	/* a fake pci_dev is needed for pci_* functions under ccio */
-	harmony->fake_pci_dev = ccio_get_fake(pa_dev);
 	return 0;
 }
 	
@@ -1050,7 +1015,7 @@
 	snd_card_t *card;
 	int err;
 	
-    if (dev >= SNDRV_CARDS)
+	if (dev >= SNDRV_CARDS)
 		return -ENODEV;
 	if (!enable[dev]) {
 		dev++;
@@ -1064,6 +1029,8 @@
 	if (card == NULL)
 		return -ENOMEM;
 	chip = (struct snd_card_harmony *)card->private_data;
+	spin_lock_init(&chip->control_lock);
+	spin_lock_init(&chip->mixer_lock);
 	
 	if ((err = snd_card_harmony_create(card, pa_dev, chip)) < 0) {
 		printk(KERN_ERR PFX "Creation failed\n");
@@ -1144,7 +1111,6 @@
 		{	
 			DPRINTK(KERN_INFO PFX "Freeing card %d\n", idx);
 			harmony = snd_harmony_cards[idx]->private_data;
-			snd_harmony_proc_done(harmony);
 			free_irq(harmony->irq, snd_card_harmony_interrupt);
 			printk(KERN_INFO PFX "Card unloaded %d, irq=%d\n", idx, harmony->irq);
 			snd_card_free(snd_harmony_cards[idx]);
diff -Nru a/sound/pci/Kconfig b/sound/pci/Kconfig
--- a/sound/pci/Kconfig	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/Kconfig	Tue Jun 15 22:20:39 2004
@@ -16,11 +16,11 @@
 	  Say 'Y' or 'M' to include support for ALI PCI Audio M5451 sound core.
 
 config SND_ATIIXP
-	tristate "ATI IXP 150/200/250"
+	tristate "ATI IXP 150/200/250/300"
 	depends on SND
 	select SND_AC97_CODEC
 	help
-	  Say 'Y' or 'M' to include support for ATI IXP 150/200/250 AC97 controller.
+	  Say 'Y' or 'M' to include support for ATI IXP 150/200/250/300 AC97 controller.
 
 config SND_AU8810
         tristate "Aureal Advantage"
@@ -29,6 +29,9 @@
 	select SND_AC97_CODEC
         help
           Say 'Y' or 'M' to include support for Aureal Advantage soundcards.
+          Supported features: Hardware Mixer, SRC, EQ and SPDIF output.
+          3D support code is in place, but not yet useable. For more info, 
+          email the ALSA developer list, or mjander@users.sourceforge.net.
  
 config SND_AU8820
         tristate "Aureal Vortex"
@@ -37,6 +40,8 @@
 	select SND_AC97_CODEC
         help
           Say 'Y' or 'M' to include support for Aureal Vortex soundcards.
+          Supported features: Hardware Mixer and SRC. For more info, email 
+          the ALSA developer list, or mjander@users.sourceforge.net.
  
 config SND_AU8830
         tristate "Aureal Vortex 2"
@@ -45,6 +50,9 @@
 	select SND_AC97_CODEC
         help
           Say 'Y' or 'M' to include support for Aureal Vortex 2 soundcards.
+          Supported features: Hardware Mixer, SRC, EQ and SPDIF output.
+          3D support code is in place, but not yet useable. For more info, 
+          email the ALSA developer list, or mjander@users.sourceforge.net.
  
 config SND_AZT3328
 	tristate "Aztech AZF3328 / PCI168 (EXPERIMENTAL)"
@@ -262,15 +270,15 @@
 	  TerraTec - EWX 24/96, EWS 88MT, EWS 88D, DMX 6Fire.
 
 config SND_ICE1724
-	tristate "ICE/VT1724 (Envy24HT)"
+	tristate "ICE/VT1724/1720 (Envy24HT/PT)"
 	depends on SND
 	select SND_MPU401_UART
 	select SND_AC97_CODEC
 	help
-	  Say 'Y' or 'M' to include support for ICE/VT1724 (Envy24HT) based
+	  Say 'Y' or 'M' to include support for ICE/VT1724/1720 (Envy24HT/PT) based
 	  soundcards.
 	  Currently supported hardware is: MidiMan M Audio - Revolution 7.1,
-	  AMP Ltd AUDIO2000.
+	  AMP Ltd AUDIO2000, Terratec Aureon 5.1 Sky/7.1, AudioTrak Prodigy 7.1.
 
 config SND_INTEL8X0
 	tristate "Intel i8x0/MX440, SiS 7012; Ali 5455; NForce Audio; AMD768/8111"
diff -Nru a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
--- a/sound/pci/ac97/ac97_codec.c	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/ac97/ac97_codec.c	Tue Jun 15 22:20:39 2004
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
@@ -42,7 +43,7 @@
 
 static int enable_loopback;
 
-MODULE_PARM(enable_loopback, "i");
+module_param(enable_loopback, bool, 0444);
 MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control");
 MODULE_PARM_SYNTAX(enable_loopback, SNDRV_BOOLEAN_FALSE_DESC);
 
@@ -299,6 +300,16 @@
 	return ac97->bus->read(ac97, reg);
 }
 
+/* read a register - return the cached value if already read */
+static inline unsigned short snd_ac97_read_cache(ac97_t *ac97, unsigned short reg)
+{
+	if (! test_bit(reg, ac97->reg_accessed)) {
+		ac97->regs[reg] = ac97->bus->read(ac97, reg);
+		// set_bit(reg, ac97->reg_accessed);
+	}
+	return ac97->regs[reg];
+}
+
 /**
  * snd_ac97_write_cache - write a value on the given register and update the cache
  * @ac97: the ac97 instance
@@ -370,7 +381,7 @@
 	if (!snd_ac97_valid_reg(ac97, reg))
 		return -EINVAL;
 	spin_lock(&ac97->reg_lock);
-	old = ac97->regs[reg];
+	old = snd_ac97_read_cache(ac97, reg);
 	new = (old & ~mask) | value;
 	change = old != new;
 	if (change) {
@@ -385,25 +396,26 @@
 static int snd_ac97_ad18xx_update_pcm_bits(ac97_t *ac97, int codec, unsigned short mask, unsigned short value)
 {
 	int change;
-	unsigned short old, new;
+	unsigned short old, new, cfg;
 
 	down(&ac97->spec.ad18xx.mutex);
 	spin_lock(&ac97->reg_lock);
 	old = ac97->spec.ad18xx.pcmreg[codec];
 	new = (old & ~mask) | value;
+	cfg = snd_ac97_read_cache(ac97, AC97_AD_SERIAL_CFG);
 	change = old != new;
 	if (change) {
 		ac97->spec.ad18xx.pcmreg[codec] = new;
 		spin_unlock(&ac97->reg_lock);
 		/* select single codec */
 		ac97->bus->write(ac97, AC97_AD_SERIAL_CFG,
-				 (ac97->regs[AC97_AD_SERIAL_CFG] & ~0x7000) |
+				 (cfg & ~0x7000) |
 				 ac97->spec.ad18xx.unchained[codec] | ac97->spec.ad18xx.chained[codec]);
 		/* update PCM bits */
 		ac97->bus->write(ac97, AC97_PCM, new);
 		/* select all codecs */
 		ac97->bus->write(ac97, AC97_AD_SERIAL_CFG,
-				 ac97->regs[AC97_AD_SERIAL_CFG] | 0x7000);
+				 cfg | 0x7000);
 	} else
 		spin_unlock(&ac97->reg_lock);
 	up(&ac97->spec.ad18xx.mutex);
@@ -435,7 +447,7 @@
 	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
 	unsigned short val;
 	
-	val = ac97->regs[AC97_REC_SEL];
+	val = snd_ac97_read_cache(ac97, AC97_REC_SEL);
 	ucontrol->value.enumerated.item[0] = (val >> 8) & 7;
 	ucontrol->value.enumerated.item[1] = (val >> 0) & 7;
 	return 0;
@@ -493,7 +505,7 @@
 	int shift = (kcontrol->private_value >> 8) & 0xff;
 	int invert = (kcontrol->private_value >> 24) & 0xff;
 	
-	val = (ac97->regs[reg] >> shift) & 1;
+	val = (snd_ac97_read_cache(ac97, reg) >> shift) & 1;
 	if (invert)
 		val ^= 1;
 	ucontrol->value.enumerated.item[0] = val;
@@ -535,7 +547,7 @@
 	int mask = (kcontrol->private_value >> 16) & 0xff;
 	int invert = (kcontrol->private_value >> 24) & 0xff;
 	
-	ucontrol->value.integer.value[0] = (ac97->regs[reg] >> shift) & mask;
+	ucontrol->value.integer.value[0] = (snd_ac97_read_cache(ac97, reg) >> shift) & mask;
 	if (invert)
 		ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
 	return 0;
@@ -582,8 +594,8 @@
 	int invert = (kcontrol->private_value >> 24) & 0xff;
 	
 	spin_lock(&ac97->reg_lock);
-	ucontrol->value.integer.value[0] = (ac97->regs[reg] >> shift_left) & mask;
-	ucontrol->value.integer.value[1] = (ac97->regs[reg] >> shift_right) & mask;
+	ucontrol->value.integer.value[0] = (snd_ac97_read_cache(ac97, reg) >> shift_left) & mask;
+	ucontrol->value.integer.value[1] = (snd_ac97_read_cache(ac97, reg) >> shift_right) & mask;
 	spin_unlock(&ac97->reg_lock);
 	if (invert) {
 		ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
@@ -796,7 +808,7 @@
 					       AC97_CXR_SPDIF_MASK | AC97_CXR_COPYRGT,
 					       v);
 	} else {
-		unsigned short extst = ac97->regs[AC97_EXTENDED_STATUS];
+		unsigned short extst = snd_ac97_read_cache(ac97, AC97_EXTENDED_STATUS);
 		snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0); /* turn off */
 
 		change |= snd_ac97_update_bits(ac97, AC97_SPDIF, 0x3fff, val);
@@ -822,13 +834,13 @@
 	mask <<= shift;
 	value <<= shift;
 	spin_lock(&ac97->reg_lock);
-	old = ac97->regs[reg];
+	old = snd_ac97_read_cache(ac97, reg);
 	new = (old & ~mask) | value;
 	spin_unlock(&ac97->reg_lock);
 
 	if (old != new) {
 		int change;
-		unsigned short extst = ac97->regs[AC97_EXTENDED_STATUS];
+		unsigned short extst = snd_ac97_read_cache(ac97, AC97_EXTENDED_STATUS);
 		snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0); /* turn off */
 		change = snd_ac97_update_bits(ac97, reg, mask, value);
 		if (extst & AC97_EA_SPDIF)
@@ -868,14 +880,14 @@
 		.info = snd_ac97_info_single,
 		.get = snd_ac97_get_single,
 		.put = snd_ac97_put_spsa,
-		.private_value = AC97_EXTENDED_STATUS | (4 << 8) | (3 << 16) | (0 << 24),
+		.private_value = AC97_SINGLE_VALUE(AC97_EXTENDED_STATUS, 4, 3, 0)
 	},
 };
 
 #define AD18XX_PCM_BITS(xname, codec, lshift, rshift, mask) \
 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_ac97_ad18xx_pcm_info_bits, \
   .get = snd_ac97_ad18xx_pcm_get_bits, .put = snd_ac97_ad18xx_pcm_put_bits, \
-  .private_value = (codec) | ((lshift) << 8) | ((rshift) << 12) | ((mask) << 24) }
+  .private_value = (codec) | ((lshift) << 8) | ((rshift) << 12) | ((mask) << 16) }
 
 static int snd_ac97_ad18xx_pcm_info_bits(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
 {
@@ -987,6 +999,8 @@
  *
  */
 
+static void snd_ac97_powerdown(ac97_t *ac97);
+
 static int snd_ac97_bus_free(ac97_bus_t *bus)
 {
 	if (bus) {
@@ -1022,6 +1036,7 @@
 static int snd_ac97_dev_free(snd_device_t *device)
 {
 	ac97_t *ac97 = snd_magic_cast(ac97_t, device->device_data, return -ENXIO);
+	snd_ac97_powerdown(ac97); /* for avoiding click noises during shut down */
 	return snd_ac97_free(ac97);
 }
 
@@ -1572,6 +1587,26 @@
 	*r_result = result;
 }
 
+/* check AC97_SPDIF register to accept which sample rates */
+static unsigned int snd_ac97_determine_spdif_rates(ac97_t *ac97)
+{
+	unsigned int result = 0;
+	int i;
+	static unsigned short ctl_bits[] = {
+		AC97_SC_SPSR_44K, AC97_SC_SPSR_32K, AC97_SC_SPSR_48K
+	};
+	static unsigned int rate_bits[] = {
+		SNDRV_PCM_RATE_44100, SNDRV_PCM_RATE_32000, SNDRV_PCM_RATE_48000
+	};
+
+	for (i = 0; i < (int)ARRAY_SIZE(ctl_bits); i++) {
+		snd_ac97_update_bits(ac97, AC97_SPDIF, AC97_SC_SPSR_MASK, ctl_bits[i]);
+		if ((snd_ac97_read(ac97, AC97_SPDIF) & AC97_SC_SPSR_MASK) == ctl_bits[i])
+			result |= rate_bits[i];
+	}
+	return result;
+}
+
 void snd_ac97_get_name(ac97_t *ac97, unsigned int id, char *name, int modem)
 {
 	const ac97_codec_id_t *pid;
@@ -1889,9 +1924,7 @@
 		else if (ac97->id == AC97_ID_CM9739)
 			ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000;
 		else
-			ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000 |
-						SNDRV_PCM_RATE_44100 |
-						SNDRV_PCM_RATE_32000;
+			ac97->rates[AC97_RATES_SPDIF] = snd_ac97_determine_spdif_rates(ac97);
 	}
 	if (ac97->ext_id & AC97_EI_VRM) {	/* MIC VRA support */
 		snd_ac97_determine_rates(ac97, AC97_PCM_MIC_ADC_RATE, 0, &ac97->rates[AC97_RATES_MIC_ADC]);
@@ -1949,12 +1982,12 @@
 	}
 	/* make sure the proper powerdown bits are cleared */
 	if (ac97->scaps) {
-		reg = snd_ac97_read(ac97, AC97_EXTENDED_ID);
+		reg = snd_ac97_read(ac97, AC97_EXTENDED_STATUS);
 		if (ac97->scaps & AC97_SCAP_SURROUND_DAC) 
 			reg &= ~AC97_EA_PRJ;
 		if (ac97->scaps & AC97_SCAP_CENTER_LFE_DAC) 
 			reg &= ~(AC97_EA_PRI | AC97_EA_PRK);
-		snd_ac97_write_cache(ac97, AC97_EXTENDED_ID, reg);
+		snd_ac97_write_cache(ac97, AC97_EXTENDED_STATUS, reg);
 	}
 	snd_ac97_proc_init(ac97);
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ac97, &ops)) < 0) {
@@ -1965,17 +1998,24 @@
 	return 0;
 }
 
-#ifdef CONFIG_PM
-/**
- * snd_ac97_suspend - General suspend function for AC97 codec
- * @ac97: the ac97 instance
+
+/*
+ * Power down the chip.
  *
- * Suspends the codec, power down the chip.
+ * MASTER and HEADPHONE registers are muted but the register cache values
+ * are not changed, so that the values can be restored in snd_ac97_resume().
  */
-void snd_ac97_suspend(ac97_t *ac97)
+static void snd_ac97_powerdown(ac97_t *ac97)
 {
-	unsigned short power = (ac97->regs[AC97_POWERDOWN] ^ 0x8000) & ~0x8000;	/* invert EAPD */
+	unsigned short power;
+
+	if (ac97_is_audio(ac97)) {
+		/* some codecs have stereo mute bits */
+		snd_ac97_write(ac97, AC97_MASTER, 0x9f9f);
+		snd_ac97_write(ac97, AC97_HEADPHONE, 0x9f9f);
+	}
 
+	power = ac97->regs[AC97_POWERDOWN] | 0x8000;	/* EAPD */
 	power |= 0x4000;	/* Headphone amplifier powerdown */
 	power |= 0x0300;	/* ADC & DAC powerdown */
 	snd_ac97_write(ac97, AC97_POWERDOWN, power);
@@ -1983,8 +2023,24 @@
 	power |= 0x0400;	/* Analog Mixer powerdown (Vref on) */
 	snd_ac97_write(ac97, AC97_POWERDOWN, power);
 	udelay(100);
+#if 0
+	/* FIXME: this causes click noises on some boards at resume */
 	power |= 0x3800;	/* AC-link powerdown, internal Clk disable */
 	snd_ac97_write(ac97, AC97_POWERDOWN, power);
+#endif
+}
+
+
+#ifdef CONFIG_PM
+/**
+ * snd_ac97_suspend - General suspend function for AC97 codec
+ * @ac97: the ac97 instance
+ *
+ * Suspends the codec, power down the chip.
+ */
+void snd_ac97_suspend(ac97_t *ac97)
+{
+	snd_ac97_powerdown(ac97);
 }
 
 /**
@@ -2267,6 +2323,7 @@
 EXPORT_SYMBOL(snd_ac97_set_rate);
 #ifdef CONFIG_PM
 EXPORT_SYMBOL(snd_ac97_resume);
+EXPORT_SYMBOL(snd_ac97_suspend);
 #endif
 
 /*
diff -Nru a/sound/pci/ac97/ac97_local.h b/sound/pci/ac97/ac97_local.h
--- a/sound/pci/ac97/ac97_local.h	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/ac97/ac97_local.h	Tue Jun 15 22:20:39 2004
@@ -22,10 +22,11 @@
  *
  */
 
+#define AC97_SINGLE_VALUE(reg,shift,mask,invert) ((reg) | ((shift) << 8) | ((mask) << 16) | ((invert) << 24))
 #define AC97_SINGLE(xname, reg, shift, mask, invert) \
 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_ac97_info_single, \
   .get = snd_ac97_get_single, .put = snd_ac97_put_single, \
-  .private_value = (reg) | ((shift) << 8) | ((mask) << 16) | ((invert) << 24) }
+  .private_value =  AC97_SINGLE_VALUE(reg, shift, mask, invert) }
 
 /* ac97_codec.c */
 extern const char *snd_ac97_stereo_enhancements[];
diff -Nru a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
--- a/sound/pci/ac97/ac97_patch.c	Tue Jun 15 22:21:02 2004
+++ b/sound/pci/ac97/ac97_patch.c	Tue Jun 15 22:21:02 2004
@@ -447,18 +447,198 @@
 	return 0;
 }
 
+static int snd_ac97_stac9758_output_jack_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+	static char *texts[5] = { "Input/Disabled", "Front Output",
+		"Rear Output", "Center/LFE Output", "Mixer Output" };
+
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+	uinfo->count = 1;
+	uinfo->value.enumerated.items = 5;
+	if (uinfo->value.enumerated.item > 4)
+		uinfo->value.enumerated.item = 4;
+	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+	return 0;
+}
+
+static int snd_ac97_stac9758_output_jack_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t* ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	int shift = kcontrol->private_value;
+	unsigned short val;
+
+	val = ac97->regs[AC97_SIGMATEL_OUTSEL];
+	if (!((val >> shift) & 4))
+		ucontrol->value.enumerated.item[0] = 0;
+	else
+		ucontrol->value.enumerated.item[0] = 1 + ((val >> shift) & 3);
+	return 0;
+}
+
+static int snd_ac97_stac9758_output_jack_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	int shift = kcontrol->private_value;
+	unsigned short val;
+
+	if (ucontrol->value.enumerated.item[0] > 4)
+		return -EINVAL;
+	if (ucontrol->value.enumerated.item[0] == 0)
+		val = 0;
+	else
+		val = 4 | (ucontrol->value.enumerated.item[0] - 1);
+	return snd_ac97_update_bits(ac97, AC97_SIGMATEL_OUTSEL,
+				    7 << shift, val << shift);
+}
+
+static int snd_ac97_stac9758_input_jack_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+	static char *texts[7] = { "Mic2 Jack", "Mic1 Jack", "Line In Jack",
+		"Front Jack", "Rear Jack", "Center/LFE Jack", "Mute" };
+
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+	uinfo->count = 1;
+	uinfo->value.enumerated.items = 7;
+	if (uinfo->value.enumerated.item > 6)
+		uinfo->value.enumerated.item = 6;
+	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+	return 0;
+}
+
+static int snd_ac97_stac9758_input_jack_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t* ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	int shift = kcontrol->private_value;
+	unsigned short val;
+
+	val = ac97->regs[AC97_SIGMATEL_INSEL];
+	ucontrol->value.enumerated.item[0] = (val >> shift) & 7;
+	return 0;
+}
+
+static int snd_ac97_stac9758_input_jack_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	int shift = kcontrol->private_value;
+
+	return snd_ac97_update_bits(ac97, AC97_SIGMATEL_INSEL, 7 << shift,
+				    ucontrol->value.enumerated.item[0] << shift);
+}
+
+static int snd_ac97_stac9758_phonesel_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+	static char *texts[3] = { "None", "Front Jack", "Rear Jack" };
+
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+	uinfo->count = 1;
+	uinfo->value.enumerated.items = 3;
+	if (uinfo->value.enumerated.item > 2)
+		uinfo->value.enumerated.item = 2;
+	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+	return 0;
+}
+
+static int snd_ac97_stac9758_phonesel_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t* ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+
+	ucontrol->value.enumerated.item[0] = ac97->regs[AC97_SIGMATEL_IOMISC] & 3;
+	return 0;
+}
+
+static int snd_ac97_stac9758_phonesel_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+
+	return snd_ac97_update_bits(ac97, AC97_SIGMATEL_IOMISC, 3,
+				    ucontrol->value.enumerated.item[0]);
+}
+
+#define STAC9758_OUTPUT_JACK(xname, shift) \
+{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
+	.info = snd_ac97_stac9758_output_jack_info, \
+	.get = snd_ac97_stac9758_output_jack_get, \
+	.put = snd_ac97_stac9758_output_jack_put, \
+	.private_value = shift }
+#define STAC9758_INPUT_JACK(xname, shift) \
+{	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
+	.info = snd_ac97_stac9758_input_jack_info, \
+	.get = snd_ac97_stac9758_input_jack_get, \
+	.put = snd_ac97_stac9758_input_jack_put, \
+	.private_value = shift }
+static const snd_kcontrol_new_t snd_ac97_sigmatel_stac9758_controls[] = {
+	STAC9758_OUTPUT_JACK("Mic1 Jack", 1),
+	STAC9758_OUTPUT_JACK("LineIn Jack", 4),
+	STAC9758_OUTPUT_JACK("Front Jack", 7),
+	STAC9758_OUTPUT_JACK("Rear Jack", 10),
+	STAC9758_OUTPUT_JACK("Center/LFE Jack", 13),
+	STAC9758_INPUT_JACK("Mic Input Source", 0),
+	STAC9758_INPUT_JACK("Line Input Source", 8),
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Headphone Amp",
+		.info = snd_ac97_stac9758_phonesel_info,
+		.get = snd_ac97_stac9758_phonesel_get,
+		.put = snd_ac97_stac9758_phonesel_put
+	},
+	AC97_SINGLE("Exchange Center/LFE", AC97_SIGMATEL_IOMISC, 4, 1, 0),
+	AC97_SINGLE("Headphone +3dB Boost", AC97_SIGMATEL_IOMISC, 8, 1, 0)
+};
+
+static int patch_sigmatel_stac9758_specific(ac97_t *ac97)
+{
+	int err;
+
+	err = patch_sigmatel_stac97xx_specific(ac97);
+	if (err < 0)
+		return err;
+	err = patch_build_controls(ac97, snd_ac97_sigmatel_stac9758_controls,
+				   ARRAY_SIZE(snd_ac97_sigmatel_stac9758_controls));
+	if (err < 0)
+		return err;
+	return 0;
+}
+
+static struct snd_ac97_build_ops patch_sigmatel_stac9758_ops = {
+	.build_3d	= patch_sigmatel_stac9700_3d,
+	.build_specific	= patch_sigmatel_stac9758_specific
+};
+
 int patch_sigmatel_stac9758(ac97_t * ac97)
 {
+	static unsigned short regs[4] = {
+		AC97_SIGMATEL_OUTSEL,
+		AC97_SIGMATEL_IOMISC,
+		AC97_SIGMATEL_INSEL,
+		AC97_SIGMATEL_VARIOUS
+	};
+	static unsigned short def_regs[4] = {
+		/* OUTSEL */ 0xd794,
+		/* IOMISC */ 0x2001,
+		/* INSEL */ 0x0201,
+		/* VARIOUS */ 0x0040
+	};
+	static unsigned short m675_regs[4] = {
+		/* OUTSEL */ 0x9040,
+		/* IOMISC */ 0x2102,
+		/* INSEL */ 0x0203,
+		/* VARIOUS */ 0x0041
+	};
+	unsigned short *pregs = def_regs;
+	int i;
+
+	/* Gateway M675 notebook */
+	if (ac97->pci && 
+	    ac97->subsystem_vendor == 0x107b &&
+	    ac97->subsystem_device == 0x0601)
+	    	pregs = m675_regs;
+
 	// patch for SigmaTel
-	ac97->build_ops = &patch_sigmatel_stac9700_ops;
-	// turn on stereo speaker, headphone and line-out
-	snd_ac97_write_cache(ac97, AC97_SIGMATEL_OUTSEL, 0x9040);
-	// headphone select and boost
-	snd_ac97_write_cache(ac97, AC97_SIGMATEL_IOMISC, 0x2102);
-	// enable mic
-	snd_ac97_write_cache(ac97, AC97_SIGMATEL_INSEL, 0x0203);
-	// enable stereo mic
-	snd_ac97_write_cache(ac97, AC97_SIGMATEL_VARIOUS, 0x0001);
+	ac97->build_ops = &patch_sigmatel_stac9758_ops;
+	for (i = 0; i < 4; i++)
+		snd_ac97_write_cache(ac97, regs[i], pregs[i]);
+
+	ac97->flags |= AC97_STEREO_MUTES;
 	return 0;
 }
 
@@ -1027,6 +1207,8 @@
 			     AC97_AD198X_MSPLT |
 			     AC97_AD198X_AC97NC);
 	ac97->flags |= AC97_STEREO_MUTES;
+	/* on AD1985 rev. 3, AC'97 revision bits are zero */
+	ac97->ext_id = (ac97->ext_id & ~AC97_EI_REV_MASK) | AC97_EI_REV_23;
 	return 0;
 }
 
@@ -1088,6 +1270,7 @@
 		.info = snd_ac97_info_single,
 		.get = snd_ac97_alc650_mic_get,
 		.put = snd_ac97_alc650_mic_put,
+		.private_value = AC97_SINGLE_VALUE(0, 0, 1, 0) /* only mask needed */
 	},
 };
 
@@ -1188,6 +1371,7 @@
 		.info = snd_ac97_info_single,
 		.get = snd_ac97_alc655_mic_get,
 		.put = snd_ac97_alc655_mic_put,
+		.private_value = AC97_SINGLE_VALUE(0, 0, 1, 0) /* only mask needed */
 	},
 };
 
@@ -1358,8 +1542,34 @@
 	/* BIT 8: SPD32 - 32bit SPDIF - not supported yet */
 };
 
+static int snd_ac97_cm9739_center_mic_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	if (ac97->regs[AC97_CM9739_MULTI_CHAN] & 0x1000)
+		ucontrol->value.integer.value[0] = 1;
+	else
+		ucontrol->value.integer.value[0] = 0;
+	return 0;
+}
+
+static int snd_ac97_cm9739_center_mic_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	return snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 0x3000,
+				    ucontrol->value.integer.value[0] ? 
+				    0x1000 : 0x2000);
+}
+
 static const snd_kcontrol_new_t snd_ac97_cm9739_controls[] = {
 	AC97_SINGLE("Line-In As Surround", AC97_CM9739_MULTI_CHAN, 10, 1, 0),
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Mic As Center/LFE",
+		.info = snd_ac97_info_single,
+		.get = snd_ac97_cm9739_center_mic_get,
+		.put = snd_ac97_cm9739_center_mic_put,
+		.private_value = AC97_SINGLE_VALUE(0, 0, 1, 0) /* only mask needed */
+	},
 };
 
 static int patch_cm9739_specific(ac97_t * ac97)
@@ -1394,10 +1604,13 @@
 	}
 
 	/* set-up multi channel */
-	/* bit 13: enable internal vref output for mic */
-	/* bit 12: enable center/lfe */
 	/* bit 14: 0 = SPDIF, 1 = EAPD */
-	val = (1 << 12) | (1 << 13);
+	/* bit 13: enable internal vref output for mic */
+	/* bit 12: disable center/lfe (swithable) */
+	/* bit 10: disable surround/line (switchable) */
+	/* bit 9: mix 2 surround off */
+	/* bit 0: dB */
+	val = (1 << 13);
 	if (! (ac97->ext_id & AC97_EI_SPDIF))
 		val |= (1 << 14);
 	snd_ac97_write_cache(ac97, AC97_CM9739_MULTI_CHAN, val);
diff -Nru a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c
--- a/sound/pci/ac97/ac97_pcm.c	Tue Jun 15 22:20:37 2004
+++ b/sound/pci/ac97/ac97_pcm.c	Tue Jun 15 22:20:37 2004
@@ -210,7 +210,7 @@
 	}
 
 	spin_lock(&ac97->reg_lock);
-	old = ac97->regs[reg] & mask;
+	old = snd_ac97_read(ac97, reg) & mask;
 	spin_unlock(&ac97->reg_lock);
 	if (old != bits) {
 		snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0);
diff -Nru a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c
--- a/sound/pci/ac97/ac97_proc.c	Tue Jun 15 22:21:05 2004
+++ b/sound/pci/ac97/ac97_proc.c	Tue Jun 15 22:21:05 2004
@@ -34,6 +34,40 @@
  * proc interface
  */
 
+static void snd_ac97_proc_read_functions(ac97_t *ac97, snd_info_buffer_t *buffer)
+{
+	int header = 0, function;
+	unsigned short info, sense_info;
+	static const char *function_names[12] = {
+		"Master Out", "AUX Out", "Center/LFE Out", "SPDIF Out",
+		"Phone In", "Mic 1", "Mic 2", "Line In", "CD In", "Video In",
+		"Aux In", "Mono Out"
+	};
+	static const char *locations[8] = {
+		"Rear I/O Panel", "Front Panel", "Motherboard", "Dock/External",
+		"reserved", "reserved", "reserved", "NC/unused"
+	};
+
+	for (function = 0; function < 12; ++function) {
+		snd_ac97_write(ac97, AC97_FUNC_SELECT, function << 1);
+		info = snd_ac97_read(ac97, AC97_FUNC_INFO);
+		if (!(info & 0x0001))
+			continue;
+		if (!header) {
+			snd_iprintf(buffer, "\n                    Gain     Inverted  Buffer delay  Location\n");
+			header = 1;
+		}
+		sense_info = snd_ac97_read(ac97, AC97_SENSE_INFO);
+		snd_iprintf(buffer, "%-17s: %3d.%d dBV    %c      %2d/fs         %s\n",
+			    function_names[function],
+			    (info & 0x8000 ? -1 : 1) * ((info & 0x7000) >> 12) * 3 / 2,
+			    ((info & 0x0800) >> 11) * 5,
+			    info & 0x0400 ? 'X' : '-',
+			    (info & 0x03e0) >> 5,
+			    locations[sense_info >> 13]);
+	}
+}
+
 static void snd_ac97_proc_read_main(ac97_t *ac97, snd_info_buffer_t * buffer, int subidx)
 {
 	char name[64];
@@ -47,6 +81,21 @@
 	if ((ac97->scaps & AC97_SCAP_AUDIO) == 0)
 		goto __modem;
 
+	if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) {
+		val = snd_ac97_read(ac97, AC97_INT_PAGING);
+		snd_ac97_update_bits(ac97, AC97_INT_PAGING,
+				     AC97_PAGE_MASK, AC97_PAGE_1);
+		tmp = snd_ac97_read(ac97, AC97_CODEC_CLASS_REV);
+		snd_iprintf(buffer, "Revision         : 0x%02x\n", tmp & 0xff);
+		snd_iprintf(buffer, "Compat. Class    : 0x%02x\n", (tmp >> 8) & 0x1f);
+		snd_iprintf(buffer, "Subsys. Vendor ID: 0x%04x\n",
+			    snd_ac97_read(ac97, AC97_PCI_SVID));
+		snd_iprintf(buffer, "Subsys. ID       : 0x%04x\n\n",
+			    snd_ac97_read(ac97, AC97_PCI_SID));
+		snd_ac97_update_bits(ac97, AC97_INT_PAGING,
+				     AC97_PAGE_MASK, val & AC97_PAGE_MASK);
+	}
+
 	// val = snd_ac97_read(ac97, AC97_RESET);
 	val = ac97->caps;
 	snd_iprintf(buffer, "Capabilities     :%s%s%s%s%s%s\n",
@@ -185,6 +234,14 @@
 			}
 		}
 	}
+	if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) {
+		val = snd_ac97_read(ac97, AC97_INT_PAGING);
+		snd_ac97_update_bits(ac97, AC97_INT_PAGING,
+				     AC97_PAGE_MASK, AC97_PAGE_1);
+		snd_ac97_proc_read_functions(ac97, buffer);
+		snd_ac97_update_bits(ac97, AC97_INT_PAGING,
+				     AC97_PAGE_MASK, val & AC97_PAGE_MASK);
+	}
 
 
       __modem:
@@ -264,6 +321,23 @@
 	}
 }
 
+#ifdef CONFIG_SND_DEBUG
+/* direct register write for debugging */
+static void snd_ac97_proc_regs_write(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
+{
+	ac97_t *ac97 = snd_magic_cast(ac97_t, entry->private_data, return);
+	char line[64];
+	unsigned int reg, val;
+	while (!snd_info_get_line(buffer, line, sizeof(line))) {
+		if (sscanf(line, "%x %x", &reg, &val) != 2)
+			continue;
+		/* register must be odd */
+		if (reg < 0x80 && (reg & 1) == 0 && val <= 0xffff)
+			snd_ac97_write_cache(ac97, reg, val);
+	}
+}
+#endif
+
 static void snd_ac97_proc_regs_read_main(ac97_t *ac97, snd_info_buffer_t * buffer, int subidx)
 {
 	int reg, val;
@@ -319,6 +393,11 @@
 	sprintf(name, "%s#%d-%d+regs", prefix, ac97->addr, ac97->num);
 	if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) {
 		snd_info_set_text_ops(entry, ac97, 1024, snd_ac97_proc_regs_read);
+#ifdef CONFIG_SND_DEBUG
+		entry->mode |= S_IWUSR;
+		entry->c.text.write_size = 1024;
+		entry->c.text.write = snd_ac97_proc_regs_write;
+#endif
 		if (snd_info_register(entry) < 0) {
 			snd_info_free_entry(entry);
 			entry = NULL;
diff -Nru a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
--- a/sound/pci/ali5451/ali5451.c	Tue Jun 15 22:21:03 2004
+++ b/sound/pci/ali5451/ali5451.c	Tue Jun 15 22:21:03 2004
@@ -25,8 +25,6 @@
  *
  */
 
-#define __SNDRV_OSS_COMPAT__
-
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/delay.h>
@@ -34,12 +32,12 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
 #include <sound/ac97_codec.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Matt Wu <Matt_Wu@acersoftech.com.cn>");
@@ -53,20 +51,21 @@
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32};
 static int spdif[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ALI M5451 PCI Audio.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable ALI 5451 PCI Audio.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(pcm_channels, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(pcm_channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_channels, "PCM Channels");
 MODULE_PARM_SYNTAX(pcm_channels, SNDRV_ENABLED ",default:32,allows:{{1,32}}");
-MODULE_PARM(spdif, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(spdif, bool, boot_devs, 0444);
 MODULE_PARM_DESC(spdif, "Support SPDIF I/O");
 MODULE_PARM_SYNTAX(spdif, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 
@@ -1906,14 +1905,18 @@
 }
 
 #ifdef CONFIG_PM
-static void ali_suspend(ali_t *chip)
+static int ali_suspend(snd_card_t *card, unsigned int state)
 {
+	ali_t *chip = snd_magic_cast(ali_t, card->pm_private_data, return -EINVAL);
 	ali_image_t *im;
 	int i, j;
 
 	im = chip->image;
 	if (! im)
-		return;
+		return 0;
+
+	snd_pcm_suspend_all(chip->pcm);
+	snd_ac97_suspend(chip->ac97);
 
 	spin_lock_irq(&chip->reg_lock);
 	
@@ -1940,16 +1943,18 @@
 	outl(0xffffffff, ALI_REG(chip, ALI_STOP));
 
 	spin_unlock_irq(&chip->reg_lock);
+	return 0;
 }
 
-static void ali_resume(ali_t *chip)
+static int ali_resume(snd_card_t *card, unsigned int state)
 {
+	ali_t *chip = snd_magic_cast(ali_t, card->pm_private_data, return -EINVAL);
 	ali_image_t *im;
 	int i, j;
 
 	im = chip->image;
 	if (! im)
-		return;
+		return 0;
 
 	pci_enable_device(chip->pci);
 
@@ -1967,27 +1972,15 @@
 		outl(im->regs[i], ALI_REG(chip, i*4));
 	}
 	
-	snd_ac97_resume(chip->ac97);
-	
 	// start HW channel
 	outl(im->regs[ALI_START >> 2], ALI_REG(chip, ALI_START));
 	// restore IRQ enable bits
 	outl(im->regs[ALI_MISCINT >> 2], ALI_REG(chip, ALI_MISCINT));
 	
 	spin_unlock_irq(&chip->reg_lock);
-	return;
-}
 
-static int snd_ali_suspend(struct pci_dev *dev, u32 state)
-{
-	ali_t *chip = snd_magic_cast(ali_t, pci_get_drvdata(dev), return -ENXIO);
-	ali_suspend(chip);
-	return 0;
-}
-static int snd_ali_resume(struct pci_dev *dev)
-{
-	ali_t *chip = snd_magic_cast(ali_t, pci_get_drvdata(dev), return -ENXIO);
-	ali_resume(chip);
+	snd_ac97_resume(chip->ac97);
+	
 	return 0;
 }
 #endif /* CONFIG_PM */
@@ -2203,7 +2196,9 @@
 #ifdef CONFIG_PM
 	codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL);
 	if (! codec->image)
-		snd_printk("can't allocate apm buffer\n");
+		snd_printk(KERN_WARNING "can't allocate apm buffer\n");
+	else
+		snd_card_set_pm_callback(card, ali_suspend, ali_resume, codec);
 #endif
 
 	snd_ali_enable_address_interrupt(codec);
@@ -2263,16 +2258,14 @@
 		snd_card_free(card);
 		return err;
 	}
-	pci_set_drvdata(pci, codec);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_ali_remove(struct pci_dev *pci)
 {
-	ali_t *chip = snd_magic_cast(ali_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -2281,23 +2274,12 @@
 	.id_table = snd_ali_ids,
 	.probe = snd_ali_probe,
 	.remove = __devexit_p(snd_ali_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_ali_suspend,
-	.resume = snd_ali_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };                                
 
 static int __init alsa_card_ali_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "ALi pci audio not found or device busy.\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_ali_exit(void)
@@ -2307,25 +2289,3 @@
 
 module_init(alsa_card_ali_init)
 module_exit(alsa_card_ali_exit)
-
-#ifndef MODULE
-
-/* format is: snd-ali5451=enable,index,id,pcm_channels */
-
-static int __init alsa_card_ali_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_channels[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-ali5451=", alsa_card_ali_setup);
-
-#endif /* ifndef */
diff -Nru a/sound/pci/als4000.c b/sound/pci/als4000.c
--- a/sound/pci/als4000.c	Tue Jun 15 22:21:03 2004
+++ b/sound/pci/als4000.c	Tue Jun 15 22:21:03 2004
@@ -64,13 +64,13 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/rawmidi.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
 #include <sound/sb.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Bart Hartgers <bart@etpmod.phys.tue.nl>");
@@ -89,18 +89,19 @@
 #ifdef SUPPORT_JOYSTICK
 static int joystick_port[SNDRV_CARDS];
 #endif
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ALS4000 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ALS4000 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable ALS4000 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_INDEX_DESC);
 #ifdef SUPPORT_JOYSTICK
-MODULE_PARM(joystick_port, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick_port, int, boot_devs, 0444);
 MODULE_PARM_DESC(joystick_port, "Joystick port address for ALS4000 soundcard. (0 = disabled)");
 MODULE_PARM_SYNTAX(joystick_port, SNDRV_ENABLED);
 #endif
@@ -755,15 +756,7 @@
 
 static int __init alsa_card_als4000_init(void)
 {
-	int err;
-	
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "no ALS4000 based soundcards found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_als4000_exit(void)
@@ -773,28 +766,3 @@
 
 module_init(alsa_card_als4000_init)
 module_exit(alsa_card_als4000_exit)
-
-#ifndef MODULE
-
-/* format is: snd-als4000=enable,index,id,joystick_port */
-
-static int __init alsa_card_als4000_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2
-#ifdef SUPPORT_JOYSTICK
-	       && get_option(&str,&joystick_port[nr_dev]) == 2
-#endif
-	       );
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-als4000=", alsa_card_als4000_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/atiixp.c b/sound/pci/atiixp.c
--- a/sound/pci/atiixp.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/atiixp.c	Tue Jun 15 22:20:41 2004
@@ -26,39 +26,40 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/info.h>
 #include <sound/ac97_codec.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
 MODULE_DESCRIPTION("ATI IXP AC97 controller");
 MODULE_LICENSE("GPL");
 MODULE_CLASSES("{sound}");
-MODULE_DEVICES("{{ATI,IXP150/200/250}}");
+MODULE_DEVICES("{{ATI,IXP150/200/250/300}}");
 
 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_PNP;	/* Enable this card */
 static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
 static int spdif_aclink[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ATI IXP controller.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ATI IXP controller.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable audio part of ATI IXP controller.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ac97_clock, int, boot_devs, 0444);
 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
 MODULE_PARM_SYNTAX(ac97_clock, SNDRV_ENABLED ",default:48000");
-MODULE_PARM(spdif_aclink, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(spdif_aclink, bool, boot_devs, 0444);
 MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link.");
 MODULE_PARM_SYNTAX(spdif_aclink, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
 
@@ -223,7 +224,12 @@
 /*
  * stream enum
  */
-enum { ATI_DMA_PLAYBACK, ATI_DMA_CAPTURE, ATI_DMA_SPDIF };
+enum { ATI_DMA_PLAYBACK, ATI_DMA_CAPTURE, ATI_DMA_SPDIF, NUM_ATI_DMAS }; /* DMAs */
+enum { ATI_PCM_OUT, ATI_PCM_IN, ATI_PCM_SPDIF, NUM_ATI_PCMS }; /* AC97 pcm slots */
+enum { ATI_PCMDEV_ANALOG, ATI_PCMDEV_DIGITAL, NUM_ATI_PCMDEVS }; /* pcm devices */
+
+#define NUM_ATI_CODECS	3
+
 
 /*
  * constants and callbacks for each DMA type
@@ -231,6 +237,7 @@
 struct snd_atiixp_dma_ops {
 	int type;			/* ATI_DMA_XXX */
 	unsigned int llp_offset;	/* LINKPTR offset */
+	unsigned int dt_cur;		/* DT_CUR offset */
 	void (*enable_dma)(atiixp_t *chip, int on);	/* called from open callback */
 	void (*enable_transfer)(atiixp_t *chip, int on); /* called from trigger (START/STOP) */
 	void (*flush_dma)(atiixp_t *chip);		/* called from trigger (STOP only) */
@@ -246,9 +253,10 @@
 	snd_pcm_substream_t *substream;	/* assigned PCM substream */
 	unsigned int buf_addr, buf_bytes;	/* DMA buffer address, bytes */
 	unsigned int period_bytes, periods;
+	int opened;
 	int running;
-	struct ac97_pcm *pcm;
 	int pcm_open_flag;
+	int ac97_pcm_type;	/* index # of ac97_pcm to access, -1 = not used */
 };
 
 /*
@@ -264,25 +272,34 @@
 	int irq;
 	
 	ac97_bus_t *ac97_bus;
-	ac97_t *ac97[3];		/* IXP can have up to 3 codecs */
+	ac97_t *ac97[NUM_ATI_CODECS];
 
 	spinlock_t reg_lock;
 	spinlock_t ac97_lock;
 
-	atiixp_dma_t dmas[3];		/* playback, capture, spdif */
+	atiixp_dma_t dmas[NUM_ATI_DMAS];
+	struct ac97_pcm *pcms[NUM_ATI_PCMS];
+	snd_pcm_t *pcmdevs[NUM_ATI_PCMDEVS];
 
 	int max_channels;		/* max. channels for PCM out */
 
 	unsigned int codec_not_ready_bits;	/* for codec detection */
 
 	int spdif_over_aclink;		/* passed from the module option */
+	struct semaphore open_mutex;	/* playback open mutex */
+
+#ifdef CONFIG_PM
+	u32 pci_state[16];
+#endif
 };
 
 
 /*
  */
 static struct pci_device_id snd_atiixp_ids[] = {
-	{ 0x1002, 0x4341, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ 0x1002, 0x4341, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB200 */
+	{ 0x1002, 0x4361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SB300 */
+	{ 0, }
 };
 
 MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
@@ -393,7 +410,7 @@
 		addr += period_bytes;
 	}
 
-	writel(cpu_to_le32((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN),
+	writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
 	       chip->remap_addr + dma->ops->llp_offset);
 
 	dma->period_bytes = period_bytes;
@@ -452,7 +469,9 @@
 			return data >> ATI_REG_PHYS_IN_DATA_SHIFT;
 		udelay(1);
 	} while (--timeout);
-	snd_printk(KERN_WARNING "atiixp: codec read timeout\n");
+	/* time out may happen during reset */
+	if (reg < 0x7c)
+		snd_printk(KERN_WARNING "atiixp: codec read timeout (reg %x)\n", reg);
 	return 0xffff;
 }
 
@@ -527,13 +546,11 @@
 	return 0;
 }
 
-#if 0 /* for P/M */
+#ifdef CONFIG_PM
 static int snd_atiixp_aclink_down(atiixp_t *chip)
 {
-	unsigned long flags;
-
-	if (atiixp_read(chip, MODEM_MIRROR) & ATI_REG_MODEM_MIRROR_RUNNING)
-		return -EBUSY;
+	// if (atiixp_read(chip, MODEM_MIRROR) & 0x1) /* modem running, too? */
+	//	return -EBUSY;
 	atiixp_update(chip, CMD,
 		     ATI_REG_CMD_POWERDOWN | ATI_REG_CMD_AC_RESET,
 		     ATI_REG_CMD_POWERDOWN);
@@ -585,12 +602,16 @@
 {
 	unsigned int reg;
 
-	/* enable burst mode */
+	/* set up spdif, enable burst mode */
 	reg = atiixp_read(chip, CMD);
 	reg |= 0x02 << ATI_REG_CMD_SPDF_THRESHOLD_SHIFT;
 	reg |= ATI_REG_CMD_BURST_EN;
 	atiixp_write(chip, CMD, reg);
 
+	reg = atiixp_read(chip, SPDF_CMD);
+	reg &= ~(ATI_REG_SPDF_CMD_LFSR|ATI_REG_SPDF_CMD_SINGLE_CH);
+	atiixp_write(chip, SPDF_CMD, reg);
+
 	/* clear all interrupt source */
 	atiixp_write(chip, ISR, 0xffffffff);
 	/* enable irqs */
@@ -635,7 +656,7 @@
 	unsigned long flags;
 
 	spin_lock_irqsave(&chip->reg_lock, flags);
-	curptr = readl(chip->remap_addr + dma->ops->llp_offset + 12); /* XXX_DMA_DT_CUR */
+	curptr = readl(chip->remap_addr + dma->ops->dt_cur);
 	if (curptr < dma->buf_addr) {
 		snd_printdd("curptr = %x, base = %x\n", curptr, dma->buf_addr);
 		curptr = 0;
@@ -657,7 +678,7 @@
 {
 	if (! dma->substream || ! dma->running)
 		return;
-	snd_printd(KERN_DEBUG "atiixp: XRUN detected (DMA %d)\n", dma->ops->type);
+	snd_printdd("atiixp: XRUN detected (DMA %d)\n", dma->ops->type);
 	snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN);
 }
 
@@ -800,15 +821,10 @@
 {
 	unsigned int data;
 	data = atiixp_read(chip, CMD);
-	if (on) {
+	if (on)
 		data |= ATI_REG_CMD_SPDF_OUT_EN;
-		if (chip->spdif_over_aclink)
-			data |= ATI_REG_CMD_SEND_EN;
-	}  else {
+	else
 		data &= ~ATI_REG_CMD_SPDF_OUT_EN;
-		if (chip->spdif_over_aclink)
-			data &= ~ATI_REG_CMD_SEND_EN;
-	}
 	atiixp_write(chip, CMD, data);
 }
 
@@ -835,25 +851,25 @@
 static int snd_atiixp_spdif_prepare(snd_pcm_substream_t *substream)
 {
 	atiixp_t *chip = snd_pcm_substream_chip(substream);
-	unsigned int data;
 
 	spin_lock(&chip->reg_lock);
 	if (chip->spdif_over_aclink) {
+		unsigned int data;
 		/* enable slots 10/11 */
 		atiixp_update(chip, CMD, ATI_REG_CMD_SPDF_CONFIG_MASK,
 			      ATI_REG_CMD_SPDF_CONFIG_01);
-		data = atiixp_read(chip, OUT_DMA_SLOT);
+		data = atiixp_read(chip, OUT_DMA_SLOT) & ~ATI_REG_OUT_DMA_SLOT_MASK;
 		data |= ATI_REG_OUT_DMA_SLOT_BIT(10) |
 			ATI_REG_OUT_DMA_SLOT_BIT(11);
 		data |= 0x04 << ATI_REG_OUT_DMA_THRESHOLD_SHIFT;
 		atiixp_write(chip, OUT_DMA_SLOT, data);
+		atiixp_update(chip, CMD, ATI_REG_CMD_INTERLEAVE_OUT,
+			      substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE ?
+			      ATI_REG_CMD_INTERLEAVE_OUT : 0);
 	} else {
 		atiixp_update(chip, CMD, ATI_REG_CMD_SPDF_CONFIG_MASK, 0);
+		atiixp_update(chip, CMD, ATI_REG_CMD_INTERLEAVE_SPDF, 0);
 	}
-
-	atiixp_update(chip, CMD, ATI_REG_CMD_INTERLEAVE_SPDF,
-		      substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE ?
-		      ATI_REG_CMD_INTERLEAVE_SPDF : 0);
 	spin_unlock(&chip->reg_lock);
 	return 0;
 }
@@ -938,17 +954,18 @@
 	if (err < 0)
 		return err;
 
-	if (dma->pcm) {
+	if (dma->ac97_pcm_type >= 0) {
+		struct ac97_pcm *pcm = chip->pcms[dma->ac97_pcm_type];
 		/* PCM is bound to AC97 codec(s)
 		 * set up the AC97 codecs
 		 */
 		if (dma->pcm_open_flag) {
-			snd_ac97_pcm_close(dma->pcm);
+			snd_ac97_pcm_close(pcm);
 			dma->pcm_open_flag = 0;
 		}
-		err = snd_ac97_pcm_open(dma->pcm, params_rate(hw_params),
+		err = snd_ac97_pcm_open(pcm, params_rate(hw_params),
 					params_channels(hw_params),
-					dma->pcm->r[0].slots);
+					pcm->r[0].slots);
 		if (err >= 0)
 			dma->pcm_open_flag = 1;
 	}
@@ -962,7 +979,8 @@
 	atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
 
 	if (dma->pcm_open_flag) {
-		snd_ac97_pcm_close(dma->pcm);
+		struct ac97_pcm *pcm = chip->pcms[dma->ac97_pcm_type];
+		snd_ac97_pcm_close(pcm);
 		dma->pcm_open_flag = 0;
 	}
 	atiixp_clear_dma_packets(chip, dma, substream);
@@ -992,7 +1010,7 @@
 	.periods_max =		ATI_MAX_DESCRIPTORS,
 };
 
-static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma)
+static int snd_atiixp_pcm_open(snd_pcm_substream_t *substream, atiixp_dma_t *dma, int pcm_type)
 {
 	atiixp_t *chip = snd_pcm_substream_chip(substream);
 	snd_pcm_runtime_t *runtime = substream->runtime;
@@ -1001,15 +1019,17 @@
 
 	snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
 
+	if (dma->opened)
+		return -EBUSY;
 	dma->substream = substream;
 	runtime->hw = snd_atiixp_pcm_hw;
-	if (dma->pcm) {
-		runtime->hw.rates = dma->pcm->rates;
+	dma->ac97_pcm_type = pcm_type;
+	if (pcm_type >= 0) {
+		runtime->hw.rates = chip->pcms[pcm_type]->rates;
 		snd_pcm_limit_hw_rates(runtime);
 	} else {
-		/* SPDIF */
-		runtime->hw.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_32000;
-		runtime->hw.rate_min = 32000;
+		/* direct SPDIF */
+		runtime->hw.formats = SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE;
 	}
 	if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
 		return err;
@@ -1019,6 +1039,7 @@
 	spin_lock_irqsave(&chip->reg_lock, flags);
 	dma->ops->enable_dma(chip, 1);
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
+	dma->opened = 1;
 
 	return 0;
 }
@@ -1032,6 +1053,7 @@
 	dma->ops->enable_dma(chip, 0);
 	spin_unlock_irq(&chip->reg_lock);
 	dma->substream = NULL;
+	dma->opened = 0;
 	return 0;
 }
 
@@ -1042,26 +1064,33 @@
 	atiixp_t *chip = snd_pcm_substream_chip(substream);
 	int err;
 
-	err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
+	down(&chip->open_mutex);
+	err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 0);
+	up(&chip->open_mutex);
+	if (err < 0)
+		return err;
 	substream->runtime->hw.channels_max = chip->max_channels;
 	if (chip->max_channels > 2)
 		/* channels must be even */
 		snd_pcm_hw_constraint_step(substream->runtime, 0,
 					   SNDRV_PCM_HW_PARAM_CHANNELS, 2);
-
 	return 0;
 }
 
 static int snd_atiixp_playback_close(snd_pcm_substream_t *substream)
 {
 	atiixp_t *chip = snd_pcm_substream_chip(substream);
-	return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
+	int err;
+	down(&chip->open_mutex);
+	err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
+	up(&chip->open_mutex);
+	return err;
 }
 
 static int snd_atiixp_capture_open(snd_pcm_substream_t *substream)
 {
 	atiixp_t *chip = snd_pcm_substream_chip(substream);
-	return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE]);
+	return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE], 1);
 }
 
 static int snd_atiixp_capture_close(snd_pcm_substream_t *substream)
@@ -1073,13 +1102,27 @@
 static int snd_atiixp_spdif_open(snd_pcm_substream_t *substream)
 {
 	atiixp_t *chip = snd_pcm_substream_chip(substream);
-	return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_SPDIF]);
+	int err;
+	down(&chip->open_mutex);
+	if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */
+		err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 2);
+	else
+		err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_SPDIF], -1);
+	up(&chip->open_mutex);
+	return err;
 }
 
 static int snd_atiixp_spdif_close(snd_pcm_substream_t *substream)
 {
 	atiixp_t *chip = snd_pcm_substream_chip(substream);
-	return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_SPDIF]);
+	int err;
+	down(&chip->open_mutex);
+	if (chip->spdif_over_aclink)
+		err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]);
+	else
+		err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_SPDIF]);
+	up(&chip->open_mutex);
+	return err;
 }
 
 /* AC97 playback */
@@ -1157,6 +1200,7 @@
 static atiixp_dma_ops_t snd_atiixp_playback_dma_ops = {
 	.type = ATI_DMA_PLAYBACK,
 	.llp_offset = ATI_REG_OUT_DMA_LINKPTR,
+	.dt_cur = ATI_REG_OUT_DMA_DT_CUR,
 	.enable_dma = atiixp_out_enable_dma,
 	.enable_transfer = atiixp_out_enable_transfer,
 	.flush_dma = atiixp_out_flush_dma,
@@ -1165,6 +1209,7 @@
 static atiixp_dma_ops_t snd_atiixp_capture_dma_ops = {
 	.type = ATI_DMA_CAPTURE,
 	.llp_offset = ATI_REG_IN_DMA_LINKPTR,
+	.dt_cur = ATI_REG_IN_DMA_DT_CUR,
 	.enable_dma = atiixp_in_enable_dma,
 	.enable_transfer = atiixp_in_enable_transfer,
 	.flush_dma = atiixp_in_flush_dma,
@@ -1173,6 +1218,7 @@
 static atiixp_dma_ops_t snd_atiixp_spdif_dma_ops = {
 	.type = ATI_DMA_SPDIF,
 	.llp_offset = ATI_REG_SPDF_DMA_LINKPTR,
+	.dt_cur = ATI_REG_SPDF_DMA_DT_CUR,
 	.enable_dma = atiixp_spdif_enable_dma,
 	.enable_transfer = atiixp_spdif_enable_transfer,
 	.flush_dma = atiixp_spdif_flush_dma,
@@ -1188,7 +1234,8 @@
 	/* initialize constants */
 	chip->dmas[ATI_DMA_PLAYBACK].ops = &snd_atiixp_playback_dma_ops;
 	chip->dmas[ATI_DMA_CAPTURE].ops = &snd_atiixp_capture_dma_ops;
-	chip->dmas[ATI_DMA_SPDIF].ops = &snd_atiixp_spdif_dma_ops;
+	if (! chip->spdif_over_aclink)
+		chip->dmas[ATI_DMA_SPDIF].ops = &snd_atiixp_spdif_dma_ops;
 
 	/* assign AC97 pcm */
 	if (chip->spdif_over_aclink)
@@ -1198,49 +1245,55 @@
 	err = snd_ac97_pcm_assign(pbus, num_pcms, atiixp_pcm_defs);
 	if (err < 0)
 		return err;
+	for (i = 0; i < num_pcms; i++)
+		chip->pcms[i] = &pbus->pcms[i];
 
 	chip->max_channels = 2;
-	if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_PCM_SLEFT)) {
-		if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE))
+	if (pbus->pcms[ATI_PCM_OUT].r[0].slots & (1 << AC97_SLOT_PCM_SLEFT)) {
+		if (pbus->pcms[ATI_PCM_OUT].r[0].slots & (1 << AC97_SLOT_LFE))
 			chip->max_channels = 6;
 		else
 			chip->max_channels = 4;
 	}
 
-	chip->dmas[ATI_DMA_PLAYBACK].pcm = &pbus->pcms[0];
-	chip->dmas[ATI_DMA_CAPTURE].pcm = &pbus->pcms[1];
-	if (chip->spdif_over_aclink)
-		chip->dmas[ATI_DMA_SPDIF].pcm = &pbus->pcms[2];
-
 	/* PCM #0: analog I/O */
-	err = snd_pcm_new(chip->card, "ATI IXP AC97", 0, 1, 1, &pcm);
+	err = snd_pcm_new(chip->card, "ATI IXP AC97", ATI_PCMDEV_ANALOG, 1, 1, &pcm);
 	if (err < 0)
 		return err;
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_playback_ops);
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_atiixp_capture_ops);
 	pcm->private_data = chip;
 	strcpy(pcm->name, "ATI IXP AC97");
+	chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm;
 
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
 					      snd_dma_pci_data(chip->pci), 64*1024, 128*1024);
 
 	/* no SPDIF support on codec? */
-	if (chip->dmas[ATI_DMA_SPDIF].pcm && ! chip->dmas[ATI_DMA_SPDIF].pcm->rates)
+	if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates)
 		return 0;
 		
+	/* FIXME: non-48k sample rate doesn't work on my test machine with AD1888 */
+	if (chip->pcms[ATI_PCM_SPDIF])
+		chip->pcms[ATI_PCM_SPDIF]->rates = SNDRV_PCM_RATE_48000;
+
 	/* PCM #1: spdif playback */
-	err = snd_pcm_new(chip->card, "ATI IXP IEC958", 1, 1, 0, &pcm);
+	err = snd_pcm_new(chip->card, "ATI IXP IEC958", ATI_PCMDEV_DIGITAL, 1, 0, &pcm);
 	if (err < 0)
 		return err;
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_spdif_ops);
 	pcm->private_data = chip;
-	strcpy(pcm->name, "ATI IXP IEC958");
+	if (chip->spdif_over_aclink)
+		strcpy(pcm->name, "ATI IXP IEC958 (AC97)");
+	else
+		strcpy(pcm->name, "ATI IXP IEC958 (Direct)");
+	chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm;
 
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
 					      snd_dma_pci_data(chip->pci), 64*1024, 128*1024);
 
 	/* pre-select AC97 SPDIF slots 10/11 */
-	for (i = 0; i < 3; i++) {
+	for (i = 0; i < NUM_ATI_CODECS; i++) {
 		if (chip->ac97[i])
 			snd_ac97_update_bits(chip->ac97[i], AC97_EXTENDED_STATUS, 0x03 << 4, 0x03 << 4);
 	}
@@ -1272,10 +1325,12 @@
 		snd_atiixp_xrun_dma(chip,  &chip->dmas[ATI_DMA_CAPTURE]);
 	else if (status & ATI_REG_ISR_IN_STATUS)
 		snd_atiixp_update_dma(chip, &chip->dmas[ATI_DMA_CAPTURE]);
-	if (status & ATI_REG_ISR_SPDF_XRUN)
-		snd_atiixp_xrun_dma(chip,  &chip->dmas[ATI_DMA_SPDIF]);
-	else if (status & ATI_REG_ISR_SPDF_STATUS)
-		snd_atiixp_update_dma(chip, &chip->dmas[ATI_DMA_SPDIF]);
+	if (! chip->spdif_over_aclink) {
+		if (status & ATI_REG_ISR_SPDF_XRUN)
+			snd_atiixp_xrun_dma(chip,  &chip->dmas[ATI_DMA_SPDIF]);
+		else if (status & ATI_REG_ISR_SPDF_STATUS)
+			snd_atiixp_update_dma(chip, &chip->dmas[ATI_DMA_SPDIF]);
+	}
 
 	/* for codec detection */
 	if (status & CODEC_CHECK_BITS) {
@@ -1303,7 +1358,8 @@
 	ac97_bus_t bus, *pbus;
 	ac97_t ac97;
 	int i, err;
-	static unsigned int codec_skip[3] = {
+	int codec_count;
+	static unsigned int codec_skip[NUM_ATI_CODECS] = {
 		ATI_REG_ISR_CODEC0_NOT_READY,
 		ATI_REG_ISR_CODEC1_NOT_READY,
 		ATI_REG_ISR_CODEC2_NOT_READY,
@@ -1321,15 +1377,34 @@
 		return err;
 	chip->ac97_bus = pbus;
 
-	for (i = 0; i < 3; i++) {
+	codec_count = 0;
+	for (i = 0; i < NUM_ATI_CODECS; i++) {
 		if (chip->codec_not_ready_bits & codec_skip[i])
 			continue;
 		memset(&ac97, 0, sizeof(ac97));
 		ac97.private_data = chip;
 		ac97.pci = chip->pci;
 		ac97.num = i;
-		if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0)
-			return err;
+		ac97.scaps = AC97_SCAP_SKIP_MODEM;
+		if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) {
+			if (chip->codec_not_ready_bits)
+				/* codec(s) was detected but not available.
+				 * return the error
+				 */
+				return err;
+			else {
+				/* codec(s) was NOT detected, so just ignore here */
+				chip->ac97[i] = NULL; /* to be sure */
+				snd_printd("atiixp: codec %d not found\n", i);
+				continue;
+			}
+		}
+		codec_count++;
+	}
+
+	if (! codec_count) {
+		snd_printk(KERN_ERR "atiixp: no codec available\n");
+		return -ENODEV;
 	}
 
 	/* snd_ac97_tune_hardware(chip->ac97, ac97_quirks); */
@@ -1338,6 +1413,53 @@
 }
 
 
+#ifdef CONFIG_PM
+/*
+ * power management
+ */
+static int snd_atiixp_suspend(snd_card_t *card, unsigned int state)
+{
+	atiixp_t *chip = snd_magic_cast(atiixp_t, card->pm_private_data, return -EINVAL);
+	int i;
+
+	for (i = 0; i < NUM_ATI_PCMDEVS; i++)
+		if (chip->pcmdevs[i])
+			snd_pcm_suspend_all(chip->pcmdevs[i]);
+	for (i = 0; i < NUM_ATI_CODECS; i++)
+		if (chip->ac97[i])
+			snd_ac97_suspend(chip->ac97[i]);
+	snd_atiixp_aclink_down(chip);
+	snd_atiixp_chip_stop(chip);
+
+	pci_save_state(chip->pci, chip->pci_state);
+	pci_set_power_state(chip->pci, 3);
+	pci_disable_device(chip->pci);
+	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
+}
+
+static int snd_atiixp_resume(snd_card_t *card, unsigned int state)
+{
+	atiixp_t *chip = snd_magic_cast(atiixp_t, card->pm_private_data, return -EINVAL);
+	int i;
+
+	pci_enable_device(chip->pci);
+	pci_restore_state(chip->pci, chip->pci_state);
+	pci_set_power_state(chip->pci, 0);
+
+	snd_atiixp_aclink_reset(chip);
+	snd_atiixp_chip_start(chip);
+
+	for (i = 0; i < NUM_ATI_CODECS; i++)
+		if (chip->ac97[i])
+			snd_ac97_resume(chip->ac97[i]);
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+	return 0;
+}
+#endif /* CONFIG_PM */
+
+
 /*
  * proc interface for register dump
  */
@@ -1412,24 +1534,25 @@
 
 	spin_lock_init(&chip->reg_lock);
 	spin_lock_init(&chip->ac97_lock);
+	init_MUTEX(&chip->open_mutex);
 	chip->card = card;
 	chip->pci = pci;
 	chip->irq = -1;
 	chip->addr = pci_resource_start(pci, 0);
 	if ((chip->res = request_mem_region(chip->addr, ATI_MEM_REGION, "ATI IXP AC97")) == NULL) {
-		snd_printk("unable to grab I/O memory 0x%lx\n", chip->addr);
+		snd_printk(KERN_ERR "unable to grab I/O memory 0x%lx\n", chip->addr);
 		snd_atiixp_free(chip);
 		return -EBUSY;
 	}
 	chip->remap_addr = (unsigned long) ioremap_nocache(chip->addr, ATI_MEM_REGION);
 	if (chip->remap_addr == 0) {
-		snd_printk("AC'97 space ioremap problem\n");
+		snd_printk(KERN_ERR "AC'97 space ioremap problem\n");
 		snd_atiixp_free(chip);
 		return -EIO;
 	}
 
 	if (request_irq(pci->irq, snd_atiixp_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) {
-		snd_printk("unable to grab IRQ %d\n", pci->irq);
+		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
 		snd_atiixp_free(chip);
 		return -EBUSY;
 	}
@@ -1471,7 +1594,7 @@
 
 	pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
 
-	strcpy(card->driver, "ATIIXP");
+	strcpy(card->driver, spdif_aclink[dev] ? "ATIIXP" : "ATIIXP-SPDMA");
 	strcpy(card->shortname, "ATI IXP");
 	if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
 		goto __error;
@@ -1494,10 +1617,12 @@
 	sprintf(card->longname, "%s rev %x at 0x%lx, irq %i",
 		card->shortname, revision, chip->addr, chip->irq);
 
+	snd_card_set_pm_callback(card, snd_atiixp_suspend, snd_atiixp_resume, chip);
+
 	if ((err = snd_card_register(card)) < 0)
 		goto __error;
 
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 
@@ -1508,9 +1633,7 @@
 
 static void __devexit snd_atiixp_remove(struct pci_dev *pci)
 {
-	atiixp_t *chip = snd_magic_cast(atiixp_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -1519,21 +1642,13 @@
 	.id_table = snd_atiixp_ids,
 	.probe = snd_atiixp_probe,
 	.remove = __devexit_p(snd_atiixp_remove),
+	SND_PCI_PM_CALLBACKS
 };
 
 
 static int __init alsa_card_atiixp_init(void)
 {
-	int err;
-
-        if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "ATI IXP AC97 controller not found or device busy\n");
-#endif
-                return err;
-        }
-
-        return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_atiixp_exit(void)
@@ -1543,27 +1658,3 @@
 
 module_init(alsa_card_atiixp_init)
 module_exit(alsa_card_atiixp_exit)
-
-#ifndef MODULE
-
-/* format is: snd-atiixp=enable,index,id,ac97_clock,spdif_aclink */
-
-static int __init alsa_card_atiixp_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&ac97_clock[nr_dev]) == 2 &&
-	       get_option(&str,&spdif_aclink[nr_dev]) == 2
-	       );
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-atiixp=", alsa_card_atiixp_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/au88x0/au8810.h b/sound/pci/au88x0/au8810.h
--- a/sound/pci/au88x0/au8810.h	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/au88x0/au8810.h	Tue Jun 15 22:20:42 2004
@@ -7,7 +7,7 @@
 #define CARD_NAME "Aureal Advantage 3D Sound Processor"
 #define CARD_NAME_SHORT "au8810"
 
-#define NR_ADB		0x20
+#define NR_ADB		0x10
 #define NR_WT		0x00
 #define NR_SRC		0x10
 #define NR_A3D		0x10
@@ -51,13 +51,14 @@
 /* ADB */
 #define VORTEX_ADB_SR 0x28400	/* Samplerates enable/disable */
 #define VORTEX_ADB_RTBASE 0x28000
-#define VORTEX_ADB_RTBASE_SIZE (VORTEX_ADB_CHNBASE - VORTEX_ADB_RTBASE)
+#define VORTEX_ADB_RTBASE_COUNT 173
 #define VORTEX_ADB_CHNBASE 0x282b4
-#define VORTEX_ADB_CHNBASE_SIZE (ADB_MASK - VORTEX_ADB_RTBASE_SIZE)
+#define VORTEX_ADB_CHNBASE_COUNT 24
 #define 	ROUTE_MASK	0xffff
 #define		SOURCE_MASK	0xff00
 #define     ADB_MASK   0xff
 #define		ADB_SHIFT 0x8
+
 /* ADB address */
 #define		OFFSET_ADBDMA	0x00
 #define		OFFSET_SRCIN	0x40
@@ -69,10 +70,12 @@
 #define		OFFSET_SPORTIN	0x78	/* ch 0x13 */
 #define		OFFSET_SPORTOUT	0x90
 #define		OFFSET_SPDIFOUT	0x92	/* ch 0x14 check this! */
-#define		OFFSET_EQIN		0xa0
+#define		OFFSET_EQIN	0xa0
 #define		OFFSET_EQOUT	0x7e	/* 2 routes on ch 0x11 */
 #define		OFFSET_XTALKOUT	0x66	/* crosstalk canceller (source) */
 #define		OFFSET_XTALKIN	0x96	/* crosstalk canceller (sink) */
+#define		OFFSET_A3DIN	0x70	/* ADB sink. */
+#define		OFFSET_A3DOUT	0xA6	/* ADB source. 2 routes per slice = 8 */
 #define		OFFSET_EFXIN	0x80	/* ADB sink. */
 #define		OFFSET_EFXOUT	0x68	/* ADB source. */
 
@@ -89,8 +92,8 @@
 #define ADB_SPDIFOUT(x)	(x + OFFSET_SPDIFOUT)
 #define ADB_EQIN(x) (x + OFFSET_EQIN)
 #define ADB_EQOUT(x) (x + OFFSET_EQOUT)
-#define ADB_A3DOUT(x) (x + 0x50)	/* A3D blocks */
-#define ADB_A3DIN(x) (x + 0x70)
+#define ADB_A3DOUT(x) (x + OFFSET_A3DOUT)	/* 0x10 A3D blocks */
+#define ADB_A3DIN(x) (x + OFFSET_A3DIN)
 #define ADB_XTALKIN(x) (x + OFFSET_XTALKIN)
 #define ADB_XTALKOUT(x) (x + OFFSET_XTALKOUT)
 
@@ -120,20 +123,31 @@
 #define		VOL_MAX 0x7f	/* FIXME: Not confirmed! Just guessed. */
 
 /* SRC */
-#define VORTEX_SRCBLOCK_SR	0x26cc0
-#define VORTEX_SRC_CHNBASE	0x26c40
-#define VORTEX_SRC_RTBASE	0x26c00
-#define VORTEX_SRC_SOURCE	0x26cc4
-#define VORTEX_SRC_SOURCESIZE 0x26cc8
-#define VORTEX_SRC_CONVRATIO 0x26e40
-#define VORTEX_SRC_DRIFT0	0x26e80
-#define VORTEX_SRC_DRIFT1	0x26ec0
-#define VORTEX_SRC_DRIFT2	0x26f40
-#define VORTEX_SRC_U0		0x26e00
-#define VORTEX_SRC_U1		0x26f00
-#define VORTEX_SRC_U2		0x26f80
-#define VORTEX_SRC_DATA		0x26800	/* 0xc800 */
-#define VORTEX_SRC_DATA0	0x26000
+#define VORTEX_SRC_CHNBASE		0x26c40
+#define VORTEX_SRC_RTBASE		0x26c00
+#define VORTEX_SRCBLOCK_SR		0x26cc0
+#define VORTEX_SRC_SOURCE		0x26cc4
+#define VORTEX_SRC_SOURCESIZE	0x26cc8
+/* Params
+	0x26e00	: 1 U0
+	0x26e40	: 2 CR
+	0x26e80	: 3 U3
+	0x26ec0	: 4 DRIFT1
+	0x26f00 : 5 U1
+	0x26f40	: 6 DRIFT2
+	0x26f80	: 7 U2 : Target rate, direction
+*/
+
+#define VORTEX_SRC_CONVRATIO	0x26e40
+#define VORTEX_SRC_DRIFT0		0x26e80
+#define VORTEX_SRC_DRIFT1		0x26ec0
+#define VORTEX_SRC_DRIFT2		0x26f40
+#define VORTEX_SRC_U0			0x26e00
+#define		U0_SLOWLOCK		0x200
+#define VORTEX_SRC_U1			0x26f00
+#define VORTEX_SRC_U2			0x26f80
+#define VORTEX_SRC_DATA			0x26800	/* 0xc800 */
+#define VORTEX_SRC_DATA0		0x26000
 
 /* FIFO */
 #define VORTEX_FIFO_ADBCTRL 0x16100	/* Control bits. */
@@ -150,33 +164,37 @@
 //#define       FIFO_MASK       0x1f    /* at shift left 0xb */
 //#define               FIFO_SIZE       0x20
 #define 	FIFO_BITS	0x03880000
-#define VORTEX_FIFO_ADBDATA 0x14000
-#define VORTEX_FIFO_WTDATA 0x10000
+#define VORTEX_FIFO_ADBDATA	0x14000
+#define VORTEX_FIFO_WTDATA	0x10000
 
 /* CODEC */
-#define VORTEX_CODEC_CTRL 0x29184
-#define VORTEX_CODEC_EN 0x29190
+#define VORTEX_CODEC_CTRL	0x29184
+#define VORTEX_CODEC_EN		0x29190
 #define		EN_CODEC0	0x00000300
+#define 	EN_AC98		0x00000c00 /* Modem AC98 slots. */
 #define		EN_CODEC1	0x00003000
 #define		EN_CODEC	(EN_CODEC0 | EN_CODEC1)
 #define		EN_SPORT	0x00030000
 #define		EN_SPDIF	0x000c0000
-#define VORTEX_CODEC_CHN 0x29080
-#define VORTEX_CODEC_WRITE 0x00800000
-#define VORTEX_CODEC_ADDSHIFT 16
-#define VORTEX_CODEC_ADDMASK 0x7f0000	/* 0x000f0000 */
-#define VORTEX_CODEC_DATSHIFT 0
-#define VORTEX_CODEC_DATMASK 0xffff
-#define VORTEX_CODEC_IO 0x29188
+
+#define VORTEX_CODEC_CHN 	0x29080
+#define VORTEX_CODEC_WRITE	0x00800000
+#define VORTEX_CODEC_ADDSHIFT 	16
+#define VORTEX_CODEC_ADDMASK	0x7f0000	/* 0x000f0000 */
+#define VORTEX_CODEC_DATSHIFT	0
+#define VORTEX_CODEC_DATMASK	0xffff
+#define VORTEX_CODEC_IO		0x29188
 
 /* SPDIF */
-#define VORTEX_SPDIF_FLAGS		0x2205c
-#define VORTEX_SPDIF_CFG0		0x291D0
-#define VORTEX_SPDIF_CFG1		0x291D4
+#define VORTEX_SPDIF_FLAGS	0x2205c
+#define VORTEX_SPDIF_CFG0	0x291D0
+#define VORTEX_SPDIF_CFG1	0x291D4
 #define VORTEX_SPDIF_SMPRATE	0x29194
 
 /* Sample timer */
-#define VORTEX_SMP_TIME  0x29198
+#define VORTEX_SMP_TIME		0x29198
+
+#define VORTEX_MODEM_CTRL	0x291ac
 
 /* IRQ */
 #define VORTEX_IRQ_SOURCE 0x2a000	/* Interrupt source flags. */
@@ -193,19 +211,19 @@
 #define 	CTRL_IRQ_ENABLE	0x00004000
 
 /* write: Timer period config / read: TIMER IRQ ack. */
-#define VORTEX_IRQ_STAT 0x2919c
+#define VORTEX_IRQ_STAT		0x2919c
 
 /* DMA */
-#define VORTEX_ENGINE_CTRL 0x27ae8
-#define 	ENGINE_INIT 0x1380000
+#define VORTEX_ENGINE_CTRL	0x27ae8
+#define 	ENGINE_INIT	0x1380000
 
-		     /* MIDI *//* GAME. */
-#define VORTEX_MIDI_DATA 0x28800
-#define VORTEX_MIDI_CMD 0x28804	/* Write command / Read status */
+/* MIDI *//* GAME. */
+#define VORTEX_MIDI_DATA	0x28800
+#define VORTEX_MIDI_CMD		0x28804	/* Write command / Read status */
 
-#define VORTEX_CTRL2 0x2880c
+#define VORTEX_CTRL2		0x2880c
 #define		CTRL2_GAME_ADCMODE 0x40
-#define VORTEX_GAME_LEGACY 0x28808
-#define VORTEX_GAME_AXIS 0x28810
+#define VORTEX_GAME_LEGACY	0x28808
+#define VORTEX_GAME_AXIS	0x28810
 #define		AXIS_SIZE 4
 #define		AXIS_RANGE 0x1fff
diff -Nru a/sound/pci/au88x0/au8820.c b/sound/pci/au88x0/au8820.c
--- a/sound/pci/au88x0/au8820.c	Tue Jun 15 22:20:43 2004
+++ b/sound/pci/au88x0/au8820.c	Tue Jun 15 22:20:43 2004
@@ -1,7 +1,7 @@
 #include "au8820.h"
 #include "au88x0.h"
 static struct pci_device_id snd_vortex_ids[] = {
-	{PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX,
+	{PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX_1,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,},
 	{0,}
 };
diff -Nru a/sound/pci/au88x0/au8820.h b/sound/pci/au88x0/au8820.h
--- a/sound/pci/au88x0/au8820.h	Tue Jun 15 22:20:37 2004
+++ b/sound/pci/au88x0/au8820.h	Tue Jun 15 22:20:37 2004
@@ -48,9 +48,9 @@
 /* ADB */
 #define VORTEX_ADB_SR 0x10a00	/* Samplerates enable/disable */
 #define VORTEX_ADB_RTBASE 0x10800
-#define VORTEX_ADB_RTBASE_SIZE (VORTEX_ADB_CHNBASE - VORTEX_ADB_RTBASE)
+#define VORTEX_ADB_RTBASE_COUNT 103
 #define VORTEX_ADB_CHNBASE 0x1099c
-#define VORTEX_ADB_CHNBASE_SIZE (ADB_MASK - VORTEX_ADB_RTBASE_SIZE)
+#define VORTEX_ADB_CHNBASE_COUNT 22
 #define 	ROUTE_MASK	0x3fff
 #define     ADB_MASK   0x7f
 #define		ADB_SHIFT 0x7
diff -Nru a/sound/pci/au88x0/au8830.c b/sound/pci/au88x0/au8830.c
--- a/sound/pci/au88x0/au8830.c	Tue Jun 15 22:20:37 2004
+++ b/sound/pci/au88x0/au8830.c	Tue Jun 15 22:20:37 2004
@@ -1,7 +1,7 @@
 #include "au8830.h"
 #include "au88x0.h"
 static struct pci_device_id snd_vortex_ids[] = {
-	{PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX2,
+	{PCI_VENDOR_ID_AUREAL, PCI_DEVICE_ID_AUREAL_VORTEX_2,
 	 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,},
 	{0,}
 };
diff -Nru a/sound/pci/au88x0/au8830.h b/sound/pci/au88x0/au8830.h
--- a/sound/pci/au88x0/au8830.h	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/au88x0/au8830.h	Tue Jun 15 22:20:39 2004
@@ -45,7 +45,7 @@
 #define VORTEX_ADBDMA_START 0x27c00	/* Which subbuffer starts */
 
 #define VORTEX_ADBDMA_STATUS 0x27A90	/* stored at AdbDma->this_10 / 2 DWORD in size. */
-/* Starting at MSB, each pair seem to be the current DMA page. */
+/* Starting at the MSB, each pair of bits seem to be the current DMA page. */
 /* This current page bits are consistent (same value) with VORTEX_ADBDMA_STAT) */
 
 /* DMA */
@@ -65,9 +65,9 @@
 /* ADB */
 #define VORTEX_ADB_SR 0x28400	/* Samplerates enable/disable */
 #define VORTEX_ADB_RTBASE 0x28000
-#define VORTEX_ADB_RTBASE_SIZE (VORTEX_ADB_CHNBASE - VORTEX_ADB_RTBASE)
+#define VORTEX_ADB_RTBASE_COUNT 173
 #define VORTEX_ADB_CHNBASE 0x282b4
-#define VORTEX_ADB_CHNBASE_SIZE (ADB_MASK - VORTEX_ADB_RTBASE_SIZE)
+#define VORTEX_ADB_CHNBASE_COUNT 24
 #define 	ROUTE_MASK	0xffff
 #define		SOURCE_MASK	0xff00
 #define     ADB_MASK   0xff
@@ -147,7 +147,7 @@
 #define VORTEX_SRC_RTBASE		0x26c00
 #define VORTEX_SRCBLOCK_SR		0x26cc0
 #define VORTEX_SRC_SOURCE		0x26cc4
-#define VORTEX_SRC_SOURCESIZE	0x26cc4
+#define VORTEX_SRC_SOURCESIZE	0x26cc8
 /* Params
 	0x26e00	: 1 U0
 	0x26e40	: 2 CR
diff -Nru a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
--- a/sound/pci/au88x0/au88x0.c	Tue Jun 15 22:20:40 2004
+++ b/sound/pci/au88x0/au88x0.c	Tue Jun 15 22:20:40 2004
@@ -19,7 +19,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
-#define SNDRV_GET_ID
+#include <linux/moduleparam.h>
 #include <sound/initval.h>
 
 // module parameters (see "Module Parameters")
@@ -27,17 +27,18 @@
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
 static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 };
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(pcifix, "1-255i");
+module_param_array(pcifix, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcifix, "Enable VIA-workaround for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(pcifix,
 		   SNDRV_ENABLED
@@ -48,80 +49,72 @@
 MODULE_LICENSE("GPL");
 MODULE_DEVICES("{{Aureal Semiconductor Inc., Aureal Vortex Sound Processor}}");
 
-#ifndef MODULE
-/* format is: snd-mychip=enable,index,id */
-static int __init alsa_card_vortex_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str, &enable[nr_dev]) == 2 &&
-	       get_option(&str, &index[nr_dev]) == 2 &&
-	       get_id(&str, &id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-au88x0=", alsa_card_vortex_setup);
-#endif				/* ifndef MODULE */
-
 MODULE_DEVICE_TABLE(pci, snd_vortex_ids);
 
-static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
+static void vortex_fix_latency(struct pci_dev *vortex)
 {
-	struct pci_dev *via = NULL;
 	int rc;
-
-	/* autodetect if workarounds are required */
-	while ((via = pci_find_device(PCI_VENDOR_ID_VIA,
-				      PCI_DEVICE_ID_VIA_8365_1, via))) {
-		if (fix == 255) {
+	if (!(rc = pci_write_config_byte(vortex, 0x40, 0xff))) {
 			printk(KERN_INFO CARD_NAME
-			       ": detected VIA KT133/KM133. activating workaround...\n");
-			fix = 3;	// do latency and via bridge workaround
-		}
-		break;
+			       ": vortex latency is 0xff\n");
+	} else {
+		printk(KERN_WARNING CARD_NAME
+				": could not set vortex latency: pci error 0x%x\n", rc);
 	}
+}
 
-	/* do not do anything if autodetection was enabled and found no VIA */
-	if (fix == 255)
-		return;
+static void vortex_fix_agp_bridge(struct pci_dev *via)
+{
+	int rc;
+	u8 value;
 
-	/* fix vortex latency */
-	if (fix & 0x01) {
-		if (!(rc = pci_write_config_byte(vortex, 0x40, 0xff))) {
-			printk(KERN_INFO CARD_NAME
-			       ": vortex latency is 0xff\n");
-		} else {
-			printk(KERN_WARNING CARD_NAME
-			       ": could not set vortex latency: pci error 0x%x\n",
-			       rc);
-		}
+	/*
+	 * only set the bit (Extend PCI#2 Internal Master for
+	 * Efficient Handling of Dummy Requests) if the can
+	 * read the config and it is not already set
+	 */
+
+	if (!(rc = pci_read_config_byte(via, 0x42, &value))
+			&& ((value & 0x10)
+				|| !(rc = pci_write_config_byte(via, 0x42, value | 0x10)))) {
+		printk(KERN_INFO CARD_NAME
+				": bridge config is 0x%x\n", value | 0x10);
+	} else {
+		printk(KERN_WARNING CARD_NAME
+				": could not set vortex latency: pci error 0x%x\n", rc);
 	}
+}
 
-	/* fix via agp bridge */
-	if (via && (fix & 0x02)) {
-		u8 value;
-
-		/*
-		 * only set the bit (Extend PCI#2 Internal Master for
-		 * Efficient Handling of Dummy Requests) if the can
-		 * read the config and it is not already set
-		 */
-
-		if (!(rc = pci_read_config_byte(via, 0x42, &value))
-		    && ((value & 0x10)
-			|| !(rc =
-			     pci_write_config_byte(via, 0x42, value | 0x10)))) {
+static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
+{
+	struct pci_dev *via;
 
-			printk(KERN_INFO CARD_NAME
-			       ": bridge config is 0x%x\n", value | 0x10);
-		} else {
-			printk(KERN_WARNING CARD_NAME
-			       ": could not set vortex latency: pci error 0x%x\n",
-			       rc);
+	/* autodetect if workarounds are required */
+	if (fix == 255) {
+		/* VIA KT133 */
+		via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL);
+		/* VIA Apollo */
+		if (via == NULL) {
+			via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL);
+		}
+		/* AMD Irongate */
+		if (via == NULL) {
+			via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
 		}
+		if (via) {
+			printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n");
+			vortex_fix_latency(vortex);
+			vortex_fix_agp_bridge(via);
+		}
+	} else {
+		if (fix & 0x1)
+			vortex_fix_latency(vortex);
+		if ((fix & 0x2) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL)))
+			vortex_fix_agp_bridge(via);
+		if ((fix & 0x4) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL)))
+			vortex_fix_agp_bridge(via);
+		if ((fix & 0x8) && (via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
+			vortex_fix_agp_bridge(via);
 	}
 }
 
@@ -370,7 +363,7 @@
 		return err;
 	}
 	// (7)
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	vortex_connect_default(chip, 1);
 	vortex_enable_int(chip);
@@ -380,16 +373,8 @@
 // destructor -- see "Destructor" sub-section
 static void __devexit snd_vortex_remove(struct pci_dev *pci)
 {
-	vortex_t *vortex = snd_magic_cast(vortex_t,
-					  pci_get_drvdata(pci), return);
-
-	if (vortex) {
-		// Release ALSA stuff.
-		snd_card_free(vortex->card);
-		// Free Vortex struct.
-		pci_set_drvdata(pci, NULL);
-	} else
-		printk("snd_vortex_remove called more than one time!\n");
+	snd_card_free(pci_get_drvdata(pci));
+	pci_set_drvdata(pci, NULL);
 }
 
 // pci_driver definition
@@ -403,16 +388,7 @@
 // initialization of the module
 static int __init alsa_card_vortex_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Aureal soundcard not found "
-		       "or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 // clean up the module
diff -Nru a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h
--- a/sound/pci/au88x0/au88x0.h	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/au88x0/au88x0.h	Tue Jun 15 22:20:41 2004
@@ -17,6 +17,7 @@
 #ifndef __SOUND_AU88X0_H
 #define __SOUND_AU88X0_H
 
+#ifdef __KERNEL__
 #include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/pci.h>
@@ -28,6 +29,8 @@
 #include <sound/hwdep.h>
 #include <sound/ac97_codec.h>
 
+#endif
+
 #ifndef CHIP_AU8820
 #include "au88x0_eq.h"
 #include "au88x0_a3d.h"
@@ -69,20 +72,19 @@
 #define IRQ_MODEM	0x4000
 
 /* ADB Resource */
-#define VORTEX_RESOURCE_DMA		0x00000000
-#define VORTEX_RESOURCE_SRC		0x00000001
+#define VORTEX_RESOURCE_DMA	0x00000000
+#define VORTEX_RESOURCE_SRC	0x00000001
 #define VORTEX_RESOURCE_MIXIN	0x00000002
 #define VORTEX_RESOURCE_MIXOUT	0x00000003
-#define VORTEX_RESOURCE_A3D		0x00000004
+#define VORTEX_RESOURCE_A3D	0x00000004
 #define VORTEX_RESOURCE_LAST	0x00000005
 
 /* Check for SDAC bit in "Extended audio ID" AC97 register */
-#define VORTEX_IS_QUAD(x) ((x->codec == NULL) ?  0 : (x->codec->ext_id|0x80))
+#define VORTEX_IS_QUAD(x) ((x->codec == NULL) ?  0 : (x->codec->ext_id&0x80))
 /* Check if chip has bug. */
 #define IS_BAD_CHIP(x) (\
-	(x->rev < 3 && x->device == PCI_DEVICE_ID_AUREAL_VORTEX) || \
-	(x->rev < 0xfe && x->device == PCI_DEVICE_ID_AUREAL_VORTEX2) || \
-	(x->rev < 0xfe && x->device == PCI_DEVICE_ID_AUREAL_ADVANTAGE))
+	(x->rev == 0xfe && x->device == PCI_DEVICE_ID_AUREAL_VORTEX_2) || \
+	(x->rev == 0xfe && x->device == PCI_DEVICE_ID_AUREAL_ADVANTAGE))
 
 
 /* PCM devices */
diff -Nru a/sound/pci/au88x0/au88x0_a3d.c b/sound/pci/au88x0/au88x0_a3d.c
--- a/sound/pci/au88x0/au88x0_a3d.c	Tue Jun 15 22:20:40 2004
+++ b/sound/pci/au88x0/au88x0_a3d.c	Tue Jun 15 22:20:40 2004
@@ -617,6 +617,12 @@
 static void vortex_Vort3D_connect(vortex_t * v, int en)
 {
 	int i;
+	
+// Disable AU8810 routes, since they seem to be wrong (in au8810.h).
+#ifdef CHIP_AU8810
+	return;
+#endif
+	
 #if 1
 	/* Alloc Xtalk mixin resources */
 	v->mixxtlk[0] =
diff -Nru a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
--- a/sound/pci/au88x0/au88x0_core.c	Tue Jun 15 22:21:02 2004
+++ b/sound/pci/au88x0/au88x0_core.c	Tue Jun 15 22:21:02 2004
@@ -72,6 +72,7 @@
             into au88x0_pcm.c .
  06-06-2003 Buffer shifter bugfix. Mixer volume fix.
  07-12-2003 A3D routing finally fixed. Believed to be OK.
+ 25-03-2004 Many thanks to Claudia, for such valuable bug reports.
  
 */
 
@@ -772,7 +773,9 @@
 	return 1;
 }
 
- /*FIFO*/ static void
+ /*FIFO*/ 
+
+static void
 vortex_fifo_clearadbdata(vortex_t * vortex, int fifo, int x)
 {
 	for (x--; x >= 0; x--)
@@ -1345,31 +1348,29 @@
 	dma->nr_periods = count;
 	dma->sgbuf = sgbuf;
 
-	psize--;
-
 	dma->cfg0 = 0;
 	dma->cfg1 = 0;
 	switch (count) {
 		/* Four or more pages */
 	default:
 	case 4:
-		dma->cfg1 |= 0x88000000 | 0x44000000 | 0x30000000 | psize;
-		hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4),
+		dma->cfg1 |= 0x88000000 | 0x44000000 | 0x30000000 | (psize-1);
+		hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4) + 0xc,
 			snd_sgbuf_get_addr(sgbuf, psize * 3));
 		/* 3 pages */
 	case 3:
 		dma->cfg0 |= 0x12000000;
-		dma->cfg1 |= 0x80000000 | 0x40000000 | (psize << 0xc);
-		hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4),
+		dma->cfg1 |= 0x80000000 | 0x40000000 | ((psize-1) << 0xc);
+		hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4)  + 0x8,
 			snd_sgbuf_get_addr(sgbuf, psize * 2));
 		/* 2 pages */
 	case 2:
-		dma->cfg0 |= 0x88000000 | 0x44000000 | 0x10000000 | psize;
-		hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4),
+		dma->cfg0 |= 0x88000000 | 0x44000000 | 0x10000000 | (psize-1);
+		hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4) + 0x4,
 			snd_sgbuf_get_addr(sgbuf, psize));
 		/* 1 page */
 	case 1:
-		dma->cfg0 |= 0x80000000 | 0x40000000 | (psize << 0xc);
+		dma->cfg0 |= 0x80000000 | 0x40000000 | ((psize-1) << 0xc);
 		hwwrite(vortex->mmio, VORTEX_WTDMA_BUFBASE + (wtdma << 4),
 			snd_sgbuf_get_addr(sgbuf, 0));
 		break;
@@ -1575,11 +1576,11 @@
 	/* it looks like we are writing more than we need to...
 	 * if we write what we are supposed to it breaks things... */
 	hwwrite(vortex->mmio, VORTEX_ADB_SR, 0);
-	for (i = 0; i < VORTEX_ADB_RTBASE_SIZE; i++)
+	for (i = 0; i < VORTEX_ADB_RTBASE_COUNT; i++)
 		hwwrite(vortex->mmio, VORTEX_ADB_RTBASE + (i << 2),
 			hwread(vortex->mmio,
 			       VORTEX_ADB_RTBASE + (i << 2)) | ROUTE_MASK);
-	for (i = 0; i < VORTEX_ADB_CHNBASE_SIZE; i++) {
+	for (i = 0; i < VORTEX_ADB_CHNBASE_COUNT; i++) {
 		hwwrite(vortex->mmio, VORTEX_ADB_CHNBASE + (i << 2),
 			hwread(vortex->mmio,
 			       VORTEX_ADB_CHNBASE + (i << 2)) | ROUTE_MASK);
@@ -1922,6 +1923,9 @@
 	// Connect front channels through EQ.
 	vortex_connection_mix_adb(vortex, en, 0x11, mixers[0], ADB_EQIN(0));
 	vortex_connection_mix_adb(vortex, en, 0x11, mixers[1], ADB_EQIN(1));
+	/* Lower volume, since EQ has some gain. */
+	vortex_mix_setvolumebyte(vortex, mixers[0], 0);
+	vortex_mix_setvolumebyte(vortex, mixers[1], 0);
 	vortex_route(vortex, en, 0x11, ADB_EQOUT(0), ADB_CODECOUT(0));
 	vortex_route(vortex, en, 0x11, ADB_EQOUT(1), ADB_CODECOUT(1));
 
@@ -2007,9 +2011,11 @@
 }
 
 /* Default Connections  */
+static int
+vortex_adb_allocroute(vortex_t * vortex, int dma, int nr_ch, int dir, int type);
+
 static void vortex_connect_default(vortex_t * vortex, int en)
 {
-	// FIXME: check if checkout was succesful.
 	// Connect AC97 codec.
 	vortex->mixplayb[0] = vortex_adb_checkinout(vortex, vortex->fixed_res, en,
 				  VORTEX_RESOURCE_MIXOUT);
@@ -2044,7 +2050,7 @@
 #ifndef CHIP_AU8810
 	vortex_wt_connect(vortex, en);
 #endif
-	// A3D (crosstalk canceler and A3D slices).
+	// A3D (crosstalk canceler and A3D slices). AU8810 disabled for now.
 #ifndef CHIP_AU8820
 	vortex_Vort3D_connect(vortex, en);
 #endif
@@ -2053,18 +2059,7 @@
 	// Connect DSP interface for SQ3500 turbo (not here i think...)
 
 	// Connect AC98 modem codec
- 	
- 	/* Fast Play Workaround. Revision 0xFE does not seem to need it. */
- 	printk(KERN_INFO "vortex: revision = 0x%x, device = %d\n", vortex->rev, vortex->device);
- 	if (IS_BAD_CHIP(vortex)) {
- 		printk(KERN_INFO "vortex: Erratum workaround enabled.\n");
- #ifndef CHIP_AU8820
- 		vortex->fixed_res[VORTEX_RESOURCE_DMA] = 0x00000001;
- #endif
- 		// Channel swapping workaround. We are nuking registers somewhere, or
- 		// its a hardware bug.
- 		vortex->fixed_res[VORTEX_RESOURCE_SRC] = 0x00000001;
- 	}
+	
 }
 
 /*
@@ -2081,7 +2076,7 @@
 {
 	stream_t *stream;
 	int i, en;
-
+	
 	if ((nr_ch == 3)
 	    || ((dir == SNDRV_PCM_STREAM_CAPTURE) && (nr_ch > 2)))
 		return -EBUSY;
@@ -2105,7 +2100,6 @@
 	stream->dir = dir;
 	stream->type = type;
 
-	// FIXME: check for success of checkout or checkin.
 	/* PLAYBACK ROUTES. */
 	if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
 		int src[4], mix[4], ch_top;
@@ -2165,8 +2159,7 @@
 		for (i = 0; i < nr_ch; i++) {
 			if (stream->type == VORTEX_PCM_ADB) {
 				vortex_connection_adbdma_src(vortex, en,
-							     src[nr_ch - 1], 
-							     //src[0], 
+							     src[nr_ch - 1],
 							     dma,
 							     src[i]);
 				vortex_connection_src_mixin(vortex, en,
@@ -2188,7 +2181,7 @@
 #ifndef CHIP_AU8820
 			if (stream->type == VORTEX_PCM_A3D) {
 				vortex_connection_adbdma_src(vortex, en,
-							     src[0], 
+							     src[nr_ch - 1], 
 								 dma,
 							     src[i]);
 				vortex_route(vortex, en, 0x11, ADB_SRCOUT(src[i]), ADB_A3DIN(a3d));
@@ -2237,7 +2230,7 @@
 				     ADB_SPDIFOUT(1));
 		}
 #endif
-		/* CAPTURE ROUTES. */
+	/* CAPTURE ROUTES. */
 	} else {
 		int src[2], mix[2];
 
@@ -2271,7 +2264,7 @@
 			vortex_connection_mixin_mix(vortex, en,
 						    MIX_CAPT(1), mix[0], 0);
 			vortex_connection_src_adbdma(vortex, en,
-						     src[nr_ch - 1],
+						     src[0],
 						     src[0], dma);
 		} else {
 			vortex_connection_mixin_mix(vortex, en,
@@ -2279,7 +2272,7 @@
 			vortex_connection_mix_src(vortex, en, 0x11, mix[1],
 						  src[1]);
 			vortex_connection_src_src_adbdma(vortex, en,
-							 src[0], src[0],
+							 src[1], src[0],
 							 src[1], dma);
 		}
 	}
diff -Nru a/sound/pci/au88x0/au88x0_eq.c b/sound/pci/au88x0/au88x0_eq.c
--- a/sound/pci/au88x0/au88x0_eq.c	Tue Jun 15 22:20:58 2004
+++ b/sound/pci/au88x0/au88x0_eq.c	Tue Jun 15 22:20:58 2004
@@ -710,11 +710,13 @@
 static void vortex_Eqlzr_SetBypass(vortex_t * vortex, long bp)
 {
 	eqlzr_t *eq = &(vortex->eq);
-
+	
 	if ((eq->this28) && (bp == 0)) {
+		/* EQ enabled */
 		vortex_Eqlzr_SetAllBandsFromActiveCoeffSet(vortex);
 		vortex_EqHw_SetBypassGain(vortex, eq->this08, eq->this08);
 	} else {
+		/* EQ disabled. */
 		vortex_EqHw_SetLeftGainsTarget(vortex, (u16 *) (eq->this14));
 		vortex_EqHw_SetRightGainsTarget(vortex, (u16 *) (eq->this14));
 		vortex_EqHw_SetBypassGain(vortex, eq->this0c, eq->this0c);
diff -Nru a/sound/pci/au88x0/au88x0_game.c b/sound/pci/au88x0/au88x0_game.c
--- a/sound/pci/au88x0/au88x0_game.c	Tue Jun 15 22:20:37 2004
+++ b/sound/pci/au88x0/au88x0_game.c	Tue Jun 15 22:20:37 2004
@@ -32,6 +32,7 @@
 
 #include <sound/driver.h>
 #include <linux/time.h>
+#include <linux/delay.h>
 #include <linux/init.h>
 #include <sound/core.h>
 #include "au88x0.h"
@@ -41,8 +42,6 @@
 
 #define VORTEX_GAME_DWAIT	20	/* 20 ms */
 
-static struct gameport gameport;
-
 static unsigned char vortex_game_read(struct gameport *gameport)
 {
 	vortex_t *vortex = gameport->driver;
@@ -81,7 +80,7 @@
 		hwwrite(vortex->mmio, VORTEX_CTRL2,
 			hwread(vortex->mmio,
 			       VORTEX_CTRL2) | CTRL2_GAME_ADCMODE);
-		wait_ms(VORTEX_GAME_DWAIT);
+		msleep(VORTEX_GAME_DWAIT);
 		return 0;
 	case GAMEPORT_MODE_RAW:
 		hwwrite(vortex->mmio, VORTEX_CTRL2,
@@ -97,8 +96,10 @@
 
 static int vortex_gameport_register(vortex_t * vortex)
 {
-	vortex->gameport = &gameport;
-
+	if ((vortex->gameport = snd_kcalloc(sizeof(struct gameport), GFP_KERNEL)) == NULL) {
+		return -1;
+	};
+	
 	vortex->gameport->driver = vortex;
 	vortex->gameport->fuzz = 64;
 
@@ -117,8 +118,10 @@
 
 static int vortex_gameport_unregister(vortex_t * vortex)
 {
-	if (vortex->gameport != NULL)
+	if (vortex->gameport != NULL) {
 		gameport_unregister_port(vortex->gameport);
+		kfree(vortex->gameport);
+	}
 	return 0;
 }
 
diff -Nru a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
--- a/sound/pci/au88x0/au88x0_pcm.c	Tue Jun 15 22:20:40 2004
+++ b/sound/pci/au88x0/au88x0_pcm.c	Tue Jun 15 22:20:40 2004
@@ -18,8 +18,7 @@
  * Vortex PCM ALSA driver.
  *
  * Supports ADB and WT DMA. Unfortunately, WT channels do not run yet.
- * It remains stuck,and DMA transfers do not happen.
- *
+ * It remains stuck,and DMA transfers do not happen. 
  */
 
 #include <sound/driver.h>
@@ -124,7 +123,7 @@
 	vortex_t *vortex = snd_pcm_substream_chip(substream);
 	snd_pcm_runtime_t *runtime = substream->runtime;
 	int err;
-
+	
 	/* Force equal size periods */
 	if ((err =
 	     snd_pcm_hw_constraint_integer(runtime,
@@ -232,12 +231,13 @@
 	}
 #ifndef CHIP_AU8810
 	else {
-		/*if (stream != NULL)
+		/* if (stream != NULL)
 		   vortex_wt_allocroute(chip, substream->number, 0); */
 		vortex_wt_allocroute(chip, substream->number,
 				     params_channels(hw_params));
 		stream = substream->runtime->private_data =
 		    &chip->dma_wt[substream->number];
+		stream->dma = substream->number;
 		stream->substream = substream;
 		vortex_wtdma_setbuffers(chip, substream->number, sgbuf,
 					params_period_bytes(hw_params),
@@ -325,7 +325,7 @@
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		// do something to stop the PCM engine
-		//printk(KERN_INFO "vortex: stop %d\n", dma)
+		//printk(KERN_INFO "vortex: stop %d\n", dma);
 		stream->fifo_enabled = 0;
 		if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT)
 			vortex_adbdma_pausefifo(chip, dma);
@@ -502,18 +502,13 @@
 	if (idx == VORTEX_PCM_ADB)
 		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
 				&snd_vortex_playback_ops);
-
+	
 	/* pre-allocation of Scatter-Gather buffers */
 	
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
-										  snd_dma_pci_data(chip->pci_dev),
-										  0x10000, 0x10000);
-	
-	// The above should be used, as soon as ALSA gets updated.
-	/*
-	snd_pcm_lib_preallocate_sg_pages_for_all(chip->pci_dev, pcm,
-						 0x10000, 0x10000);
-	*/
+					      snd_dma_pci_data(chip->pci_dev),
+					      0x10000, 0x10000);
+
 	if (VORTEX_PCM_TYPE(pcm) == VORTEX_PCM_SPDIF) {
 		snd_kcontrol_t *kcontrol;
 
diff -Nru a/sound/pci/au88x0/au88x0_synth.c b/sound/pci/au88x0/au88x0_synth.c
--- a/sound/pci/au88x0/au88x0_synth.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/au88x0/au88x0_synth.c	Tue Jun 15 22:20:42 2004
@@ -36,6 +36,7 @@
 
 /* WT */
 
+/* Put 2 WT channels together for one stereo interlaced channel. */
 static void vortex_wt_setstereo(vortex_t * vortex, u32 wt, u32 stereo)
 {
 	int temp;
@@ -47,6 +48,7 @@
 	hwwrite(vortex->mmio, WT_STEREO(wt), temp);
 }
 
+/* Join to mixdown route. */
 static void vortex_wt_setdsout(vortex_t * vortex, u32 wt, int en)
 {
 	int temp;
@@ -60,7 +62,7 @@
 	hwwrite(vortex->mmio, WT_DSREG((wt >= 0x20) ? 1 : 0), temp);
 }
 
-// WT routing is still a mistery.
+/* Setup WT route. */
 static int vortex_wt_allocroute(vortex_t * vortex, int wt, int nr_ch)
 {
 	wt_voice_t *voice = &(vortex->wt_voice[wt]);
@@ -68,13 +70,15 @@
 
 	//FIXME: WT audio routing.
 	if (nr_ch) {
-		vortex_fifo_wtinitialize(vortex, wt, 2);
+		vortex_fifo_wtinitialize(vortex, wt, 1);
 		vortex_fifo_setwtvalid(vortex, wt, 1);
 		vortex_wt_setstereo(vortex, wt, nr_ch - 1);
 	} else
 		vortex_fifo_setwtvalid(vortex, wt, 0);
-
-	vortex_wt_setdsout(vortex, wt, 0);
+	
+	/* Set mixdown mode. */
+	vortex_wt_setdsout(vortex, wt, 1);
+	/* Set other parameter registers. */
 	hwwrite(vortex->mmio, WT_SRAMP(0), 0x880000);
 	//hwwrite(vortex->mmio, WT_GMODE(0), 0xffffffff);
 #ifdef CHIP_AU8830
@@ -87,7 +91,7 @@
 
 	temp = hwread(vortex->mmio, WT_PARM(wt, 3));
 	printk("vortex: WT PARM3: %x\n", temp);
-	hwwrite(vortex->mmio, WT_PARM(wt, 3), temp);
+	//hwwrite(vortex->mmio, WT_PARM(wt, 3), temp);
 
 	hwwrite(vortex->mmio, WT_DELAY(wt, 0), 0);
 	hwwrite(vortex->mmio, WT_DELAY(wt, 1), 0);
@@ -106,6 +110,7 @@
 	return 0;
 }
 
+
 static void vortex_wt_connect(vortex_t * vortex, int en)
 {
 	int i, ii, mix;
@@ -129,15 +134,12 @@
 				     ADB_WTOUT(i, ii + 0x20), ADB_MIXIN(mix));
 
 			vortex_connection_mixin_mix(vortex, en, mix,
-						    vortex->mixplayb[ii %
-								     2], 0);
+						    vortex->mixplayb[ii % 2], 0);
 			if (VORTEX_IS_QUAD(vortex))
 				vortex_connection_mixin_mix(vortex, en,
 							    mix,
-							    vortex->
-							    mixplayb[2 +
-								     (ii %
-								      2)], 0);
+							    vortex->mixplayb[2 +
+								     (ii % 2)], 0);
 		}
 	}
 	for (i = 0; i < NR_WT; i++) {
diff -Nru a/sound/pci/azt3328.c b/sound/pci/azt3328.c
--- a/sound/pci/azt3328.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/azt3328.c	Tue Jun 15 22:20:41 2004
@@ -98,13 +98,13 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/rawmidi.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include "azt3328.h"
 
@@ -166,18 +166,19 @@
 #ifdef SUPPORT_JOYSTICK
 static int joystick[SNDRV_CARDS];
 #endif
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for AZF3328 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable AZF3328 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_INDEX_DESC);
 #ifdef SUPPORT_JOYSTICK
-MODULE_PARM(joystick, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick, bool, boot_devs, 0444);
 MODULE_PARM_DESC(joystick, "Enable joystick for AZF3328 soundcard.");
 MODULE_PARM_SYNTAX(joystick, SNDRV_BOOLEAN_FALSE_DESC);
 #endif
@@ -1267,6 +1268,10 @@
         if (chip->irq < 0)
                 goto __end_hw;
 
+	/* reset (close) mixer */
+	snd_azf3328_mixer_set_mute(chip, IDX_MIXER_PLAY_MASTER, 1); /* first mute master volume */
+	snd_azf3328_mixer_write(chip, IDX_MIXER_RESET, 0x0, WORD_VALUE);
+
         /* interrupt setup - mask everything */
 	/* FIXME */
 
@@ -1540,7 +1545,7 @@
 	snd_azf3328_config_joystick(chip, joystick[dev]);
 #endif
 
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 
 	snd_azf3328_dbgcallleave();
@@ -1549,16 +1554,8 @@
 
 static void __devexit snd_azf3328_remove(struct pci_dev *pci)
 {
-        azf3328_t *chip = snd_magic_cast(azf3328_t, pci_get_drvdata(pci), return);
-	
 	snd_azf3328_dbgcallenter();
-
-	/* reset (close) mixer */
-	snd_azf3328_mixer_set_mute(chip, IDX_MIXER_PLAY_MASTER, 1); /* first mute master volume */
-	snd_azf3328_mixer_write(chip, IDX_MIXER_RESET, 0x0, WORD_VALUE);
-
-        if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 	snd_azf3328_dbgcallleave();
 }
@@ -1573,18 +1570,10 @@
 static int __init alsa_card_azf3328_init(void)
 {
 	int err;
-	
 	snd_azf3328_dbgcallenter();
-
-	if ((err = pci_module_init(&driver)) < 0)
-	{
-#ifdef MODULE
-		printk(KERN_ERR "azt3328: no AZF3328 based soundcards found or device busy\n");
-#endif
-		return err;
-	}
+	err = pci_module_init(&driver);
 	snd_azf3328_dbgcallleave();
-	return 0;
+	return err;
 }
 
 static void __exit alsa_card_azf3328_exit(void)
@@ -1596,31 +1585,3 @@
 
 module_init(alsa_card_azf3328_init)
 module_exit(alsa_card_azf3328_exit)
-
-#ifndef MODULE
-
-/* format is: snd-azf3328=enable,index,id,joystick */
-
-static int __init alsa_card_azf3328_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	snd_azf3328_dbgcallenter();
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2
-#ifdef SUPPORT_JOYSTICK
-	       && get_option(&str,&joystick[nr_dev]) == 2
-#endif
-	       );
-	nr_dev++;
-	snd_azf3328_dbgcallleave();
-	return 1;
-}
-
-__setup("snd-azt3328=", alsa_card_azf3328_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/bt87x.c b/sound/pci/bt87x.c
--- a/sound/pci/bt87x.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/bt87x.c	Tue Jun 15 22:20:41 2004
@@ -26,13 +26,13 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <asm/io.h>
 #include <asm/bitops.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/control.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
@@ -46,17 +46,18 @@
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
 static int digital_rate[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* digital input rate */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Bt87x soundcard");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Bt87x soundcard");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Bt87x soundcard");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(digital_rate, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(digital_rate, int, boot_devs, 0444);
 MODULE_PARM_DESC(digital_rate, "Digital input rate for Bt87x soundcard");
 MODULE_PARM_SYNTAX(digital_rate, SNDRV_ENABLED);
 
@@ -808,7 +809,7 @@
 	if (err < 0)
 		goto _error;
 
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	++dev;
 	return 0;
 
@@ -819,9 +820,7 @@
 
 static void __devexit snd_bt87x_remove(struct pci_dev *pci)
 {
-	bt87x_t *chip = snd_magic_cast(bt87x_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -851,16 +850,7 @@
 
 static int __init alsa_card_bt87x_init(void)
 {
-	int err;
-
-	err = pci_module_init(&driver);
-	if (err < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Bt87x soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_bt87x_exit(void)
@@ -870,24 +860,3 @@
 
 module_init(alsa_card_bt87x_init)
 module_exit(alsa_card_bt87x_exit)
-
-#ifndef MODULE
-
-/* format is: snd-bt87x=enable,index,id */
-
-static int __init alsa_card_bt87x_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-bt87x=", alsa_card_bt87x_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/cmipci.c b/sound/pci/cmipci.c
--- a/sound/pci/cmipci.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/cmipci.c	Tue Jun 15 22:20:42 2004
@@ -20,10 +20,6 @@
 /* Does not work. Warning may block system in capture mode */
 /* #define USE_VAR48KRATE */
 
-/* Define this if you want soft ac3 encoding */
-#define DO_SOFT_AC3
-#define USE_AES_IEC958
-
 #include <sound/driver.h>
 #include <asm/io.h>
 #include <linux/delay.h>
@@ -32,6 +28,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -41,7 +38,6 @@
 #include <sound/opl3.h>
 #include <sound/sb.h>
 #include <sound/asoundef.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
@@ -62,35 +58,31 @@
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable switches */
 static long mpu_port[SNDRV_CARDS];
 static long fm_port[SNDRV_CARDS];
-#ifdef DO_SOFT_AC3
 static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
-#endif
 #ifdef SUPPORT_JOYSTICK
 static int joystick_port[SNDRV_CARDS];
 #endif
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for C-Media PCI soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for C-Media PCI soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable C-Media PCI soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_ENABLED ",allows:{{0},{0x330},{0x320},{0x310},{0x300}},dialog:list");
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM port.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_ENABLED ",allows:{{0},{0x388},{0x3c8},{0x3e0},{0x3e8}},dialog:list");
-#ifdef DO_SOFT_AC3
-MODULE_PARM(soft_ac3, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(soft_ac3, bool, boot_devs, 0444);
 MODULE_PARM_DESC(soft_ac3, "Sofware-conversion of raw SPDIF packets (model 033 only).");
-MODULE_PARM_SYNTAX(soft_ac3, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
-#endif
 #ifdef SUPPORT_JOYSTICK
-MODULE_PARM(joystick_port, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick_port, int, boot_devs, 0444);
 MODULE_PARM_DESC(joystick_port, "Joystick port address.");
 MODULE_PARM_SYNTAX(joystick_port, SNDRV_ENABLED ",allows:{{0},{1},{0x200},{0x201}},dialog:list");
 #endif
@@ -426,7 +418,6 @@
 	unsigned int is_dac;		/* is dac? */
 	int bytes_per_frame;
 	int shift;
-	int ac3_shift;	/* extra shift: 1 on soft ac3 mode */
 };
 
 /* mixer elements toggled/resumed during ac3 playback */
@@ -472,10 +463,6 @@
 
 	unsigned int dig_status;
 	unsigned int dig_pcm_status;
-#ifdef USE_AES_IEC958
-	snd_ctl_elem_value_t *spdif_channel;
-#endif
-	snd_kcontrol_t *spdif_pcm_ctl;
 
 	snd_pcm_hardware_t *hw_info[3]; /* for playbacks */
 
@@ -784,8 +771,6 @@
 	/* buffer and period sizes in frame */
 	rec->dma_size = runtime->buffer_size << rec->shift;
 	rec->period_size = runtime->period_size << rec->shift;
-	rec->dma_size <<= rec->ac3_shift;
-	rec->period_size <<= rec->ac3_shift;
 	if (runtime->channels > 2) {
 		/* multi-channels */
 		rec->dma_size = (rec->dma_size * runtime->channels) / 2;
@@ -911,7 +896,6 @@
 	ptr = snd_cmipci_read(cm, reg) - rec->offset;
 	ptr = bytes_to_frames(substream->runtime, ptr);
 #endif
-	ptr >>= rec->ac3_shift;
 	if (substream->runtime->channels > 2)
 		ptr = (ptr * 2) / substream->runtime->channels;
 	return ptr;
@@ -953,358 +937,6 @@
 	return snd_cmipci_pcm_pointer(cm, &cm->channel[CM_CH_CAPT], substream);
 }
 
-#ifdef DO_SOFT_AC3
-/*
- * special tricks for soft ac3 transfer:
- *
- * we compose an iec958 subframe from 16bit ac3 sample and
- * write the raw subframe via 32bit data mode.
- */
-
-# ifndef USE_AES_IEC958
-
-/* find parity for bit 4~30 */
-static unsigned int parity(unsigned int data)
-{
-	unsigned int parity = 0;
-	int counter = 4;
-
-	data >>= 4;	/* start from bit 4 */
-	while (counter <= 30) {
-		if (data & 1)
-			parity++;
-		data >>= 1;
-		counter++;
-	}
-	return parity & 1;
-}
-
-/*
- * compose 32bit iec958 subframe with non-audio data.
- * bit 0-3  = preamble
- *     4-7  = aux (=0)
- *     8-27 = data (12-27 for 16bit)
- *     28   = validity (=0)
- *     29   = user data (=0)
- *     30   = channel status
- *     31   = parity
- *
- * channel status is assumed as consumer, non-audio
- * thus all 0 except bit 1
- */
-inline static u32 convert_ac3_32bit(cmipci_t *cm, u32 val)
-{
-	u32 data = (u32)val << 12;
-
-	if (cm->spdif_counter == 2 || cm->spdif_counter == 3) /* bit 1 */
-		data |= 0x40000000;	/* indicate AC-3 raw data */
-	if (parity(data))		/* parity bit 4-30 */
-		data |= 0x80000000;
-	if (cm->spdif_counter == 0)
-		data |= 3;		/* preamble 'M' */
-	else if (cm->spdif_counter & 1)
-		data |= 5;		/* odd, 'W' */
-	else
-		data |= 9;		/* even, 'M' */
-
-	cm->spdif_counter++;
-	if (cm->spdif_counter == 384)
-		cm->spdif_counter = 0;
-
-	return data;
-}
-
-# else  /* if USE_AES_IEC958 */
-
-/*
- * The bitstream handling
- */
-typedef struct iec958_stru_bitstream {
-	u32 *data;		/* Holds the current position */
-	u32  left;		/* Bits left in current 32bit frame */
-	u32  word;		/* The 32bit frame of the current position */
-	u32  bits;		/* All bits together */
-	int   err;		/* Error condition */
-} iec958_bitstream_t ;
-
-static iec958_bitstream_t bs;
-
-/* Initialize ptr on the buffer */
-static void iec958_init_bitstream(u8 *buf, u32 size)
-{
-	bs.data = (u32 *)buf;		/* Set initial position */
-	bs.word = *bs.data;		/* The first 32bit frame */
-	bs.left = 32;			/* has exactly 32bits */
-	bs.bits = size;
-	bs.err = 0;
-}
-
-/* Remove ptr on the buffer */
-static void iec958_clear_bitstream(void)
-{
-	bs.data = NULL;
-	bs.left = 0;
-	bs.err = 0;
-}
-
-/* Get bits from bitstream (max 32) */
-static inline u32 iec958_getbits(u32 bits)
-{
-	u32 res;
-
-	if (bs.bits < bits) {
-		bits = bs.bits;
-		bs.err = 1;
-	}
-	if (bits > 32) {
-		bits = 32;
-		bs.err = 1;
-	}
-	bs.bits -= bits;
-
-#  ifdef WORDS_BIGENDIAN
-	if (bits < bs.left) {		/* Within 32bit frame */
-		res = (bs.word << (32 - bs.left)) >> (32 - bits);
-		bs.left -= bits;
-		goto out;
-	}				/* We may cross the frame boundary */
-	res   = (bs.word << (32 - bs.left)) >> (32 - bs.left);
-	bits -= bs.left;
-
-	bs.word = *(++bs.data);		/* Next 32bit frame */
-
-	if (bits)			/* Add remaining bits, if any */
-		res = (res << bits) | (bs.word >> (32 - bits));
-
-#  else  /* not WORDS_BIGENDIAN */
-
-	if (bits < bs.left) {		/* Within 32bit frame */
-		res = (bs.word << (32 - bits)) >> (32 - bits);
-		bs.word >>= bits;
-		bs.left -= bits;
-		goto out;
-	}				/* We may cross the frame boundary */
-	res   = bs.word;
-	bits -= bs.left;
-
-	bs.word = *(++bs.data);		/* Next 32bit frame */
-
-	if (bits) {			/* Add remaining bits, if any */
-		res = res | (((bs.word << (32 - bits)) >> (32 - bits)) << bits);
-		bs.word >>= bits;
-	}
-#  endif /* not WORDS_BIGENDIAN */
-
-	bs.left = (32 - bits);
-out:
-	return res;
-}
-
-static inline u32 iec958_bits_avail(void)
-{
-	return bs.bits;
-}
-
-static inline int iec958_error(void)
-{
-	return bs.err;
-}
-
-/*
- * Determine parity for time slots 4 upto 30
- * to be sure that bit 4 upt 31 will carry
- * an even number of ones and zeros.
- */
-static u32 iec958_parity(u32 data)
-{
-	u32 parity = 0;
-	int counter = 4;
-
-	data >>= 4;     /* start from bit 4 */
-	while (counter++ <= 30) {
-		if (data & 0x00000001)
-			parity++;
-		data >>= 1;
-	}
-	return (parity & 0x00000001);
-}
-
-/*
- * Compose 32bit iec958 subframe, two sub frames
- * build one frame with two channels.
- *
- * bit 0-3  = preamble
- *     4-7  = AUX (=0)
- *     8-27 = data (12-27 for 16bit, 8-27 for 20bit, and 24bit without AUX)
- *     28   = validity (0 for valid data, else 'in error')
- *     29   = user data (0)
- *     30   = channel status (24 bytes for 192 frames)
- *     31   = parity
- */
-
-static inline u32 iec958_subframe(cmipci_t *cm, snd_ctl_elem_value_t * ucontrol)
-{
-	u32 data;
-	u32 byte = cm->spdif_counter >> 4;
-	u32 mask = 1 << ((cm->spdif_counter >> 1) - (byte << 3));
-	u8 * status = ucontrol->value.iec958.status;
-
-	if (status[2] & IEC958_AES2_PRO_SBITS_24) {
-		/* Does this work for LE systems ??? */
-		if (status[2] & IEC958_AES2_PRO_WORDLEN_24_20) {
-			data = iec958_getbits(24);
-			data <<= 4;
-		} else {
-			data = iec958_getbits(20);
-			data <<= 8;
-		}
-	} else {
-		if (status[2] & IEC958_AES2_PRO_WORDLEN_24_20) {
-			/* Does this work for LE systems ??? */
-			data = iec958_getbits(20);
-			data <<= 8;
-		} else {
-			data = iec958_getbits(16);
-			data <<= 12;
-		}
-	}
-
-	/*
-	 * Set one of the 192 bits of the channel status (AES3 and higher)
-	 */
-	if (status[byte] & mask)
-		data |= 0x40000000;
-
-	if (iec958_parity(data))	/* parity bit 4-30 */
-		data |= 0x80000000;
-
-	/* Preamble */
-	if      (!cm->spdif_counter)
-		data |= 0x03;		/* Block start, 'Z' */
-	else if (cm->spdif_counter % 2)
-		data |= 0x05;		/* odd sub frame, 'Y' */
-	else
-		data |= 0x09;		/* even sub frame, 'X' */
-
-	/*
-	 * sub frame counter: 2 sub frame are one audio frame
-	 * and 192 frames are one block
-	 */
-	cm->spdif_counter = (++cm->spdif_counter) % 384;
-
-	return data;
-}
-# endif /* if USE_AES_IEC958 */
-
-static int snd_cmipci_ac3_copy(snd_pcm_substream_t *subs, int channel,
-			       snd_pcm_uframes_t pos, void *src,
-			       snd_pcm_uframes_t count)
-{
-	cmipci_t *cm = snd_pcm_substream_chip(subs);
-	u32 *dst;
-	snd_pcm_uframes_t offset;
-	snd_pcm_runtime_t *runtime = subs->runtime;
-#ifndef USE_AES_IEC958
-	u16 *srcp = src, val;
-#else
-	char buf[480];         /* bits can be divided by 20, 24, 16 */
-	size_t bytes = frames_to_bytes(runtime, count);
-#endif
-
-
-	if (!cm->channel[CM_CH_PLAY].ac3_shift) {
-		if (copy_from_user(runtime->dma_area +
-				   frames_to_bytes(runtime, pos), src,
-				   frames_to_bytes(runtime, count)))
-			return -EFAULT;
-		return 0;
-	}
-
-	if (! access_ok(VERIFY_READ, src, count))
-		return -EFAULT;
-
-	/* frame = 16bit stereo */
-	offset = (pos << 1) % (cm->channel[CM_CH_PLAY].dma_size << 2);
-	dst = (u32*)(runtime->dma_area + offset);
-# ifndef USE_AES_IEC958
-	count /= 2;
-	while (count-- > 0) {
-		get_user(val, srcp);
-		srcp++;
-		*dst++ = convert_ac3_32bit(cm, val);
-	}
-# else
-	while (bytes) {
-		size_t c = bytes;
-
-		if (c > sizeof(buf))
-			c = sizeof(buf);
-
-		if (copy_from_user(buf, src, c))
-			return -EFAULT;
-		bytes -= c;
-		src   += c;
-
-		iec958_init_bitstream(buf, c*8);
-		while (iec958_bits_avail()) {
-			*(dst++) = iec958_subframe(cm, cm->spdif_channel);
-			if (iec958_error())
-				return -EINVAL;
-		}
-		iec958_clear_bitstream();
-	}
-# endif
-	return 0;
-}
-
-static int snd_cmipci_ac3_silence(snd_pcm_substream_t *subs, int channel,
-				  snd_pcm_uframes_t pos,
-				  snd_pcm_uframes_t count)
-{
-	cmipci_t *cm = snd_pcm_substream_chip(subs);
-	u32 *dst;
-	snd_pcm_uframes_t offset;
-	snd_pcm_runtime_t *runtime = subs->runtime;
-# ifdef USE_AES_IEC958
-	char buf[480];		/* bits can be divided by 20, 24, 16 */
-	size_t bytes = frames_to_bytes(runtime, count);
-# endif
-	if (! cm->channel[CM_CH_PLAY].ac3_shift)
-		return snd_pcm_format_set_silence(runtime->format,
-						  runtime->dma_area + frames_to_bytes(runtime, pos), count);
-	
-	/* frame = 16bit stereo */
-	offset = (pos << 1) % (cm->channel[CM_CH_PLAY].dma_size << 2);
-	dst = (u32*)(subs->runtime->dma_area + offset);
-# ifndef USE_AES_IEC958
-	count /= 2;
-	while (count-- > 0) {
-		*dst++ = convert_ac3_32bit(cm, 0);
-	}
-# else
-	while (bytes) {
-		size_t c = bytes;
-
-		if (c > sizeof(buf))
-			c = sizeof(buf);
-
-		/* Q: Does this function know about 24bit silence? */
-		if (snd_pcm_format_set_silence(runtime->format, buf, bytes_to_frames(runtime, c)))
-			return -EINVAL;
-
-		iec958_init_bitstream(buf, c*8);
-		while (iec958_bits_avail()) {
-			*(dst++) = iec958_subframe(cm, cm->spdif_channel);
-			if (iec958_error())
-				return -EINVAL;
-		}
-		iec958_clear_bitstream();
-	}
-# endif
-	return 0;
-}
-#endif /* DO_SOFT_AC3 */
-
 
 /*
  * hw preparation for spdif
@@ -1404,9 +1036,6 @@
 	spin_lock_irqsave(&chip->reg_lock, flags);
 	for (i = 0; i < 4; i++)
 		ucontrol->value.iec958.status[i] = (chip->dig_pcm_status >> (i * 8)) & 0xff;
-#ifdef USE_AES_IEC958
-	ucontrol = chip->spdif_channel;
-#endif
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
 	return 0;
 }
@@ -1425,9 +1054,6 @@
 		val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8);
 	change = val != chip->dig_pcm_status;
 	chip->dig_pcm_status = val;
-#ifdef USE_AES_IEC958
-	chip->spdif_channel = ucontrol;
-#endif
 	spin_unlock_irqrestore(&chip->reg_lock, flags);
 	return change;
 }
@@ -1504,9 +1130,6 @@
 /* spinlock held! */
 static void setup_ac3(cmipci_t *cm, snd_pcm_substream_t *subs, int do_ac3, int rate)
 {
-	cm->channel[CM_CH_PLAY].ac3_shift = 0;
-	cm->spdif_counter = 0;
-
 	if (do_ac3) {
 		/* AC3EN for 037 */
 		snd_cmipci_set_bit(cm, CM_REG_CHFORMAT, CM_AC3EN1);
@@ -1519,9 +1142,6 @@
 			snd_cmipci_set_bit(cm, CM_REG_CHFORMAT, CM_SPD24SEL);
 			snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_SPD32SEL);
 		} else { /* can_ac3_sw */
-#ifdef DO_SOFT_AC3
-			/* FIXME: ugly hack! */
-			subs->runtime->buffer_size /= 2;
 			/* SPD32SEL for 037 & 039, 0x20 */
 			snd_cmipci_set_bit(cm, CM_REG_MISC_CTRL, CM_SPD32SEL);
 			/* set 176K sample rate to fix 033 HW bug */
@@ -1532,8 +1152,6 @@
 					snd_cmipci_clear_bit(cm, CM_REG_CHFORMAT, CM_PLAYBACK_SRATE_176K);
 				}
 			}
-			cm->channel[CM_CH_PLAY].ac3_shift = 1; /* use 32bit */
-#endif /* DO_SOFT_AC3 */
 		}
 
 	} else {
@@ -1550,11 +1168,9 @@
 				snd_cmipci_clear_bit(cm, CM_REG_CHFORMAT, CM_SPD24SEL);
 			}
 		} else {
-#ifdef DO_SOFT_AC3
 			snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_SPD32SEL);
 			snd_cmipci_clear_bit(cm, CM_REG_CHFORMAT, CM_SPD24SEL);
 			snd_cmipci_clear_bit(cm, CM_REG_CHFORMAT, CM_PLAYBACK_SRATE_176K);
-#endif /* DO_SOFT_AC3 */
 		}
 	}
 }
@@ -1604,15 +1220,12 @@
 {
 	cmipci_t *cm = snd_pcm_substream_chip(substream);
 	int rate = substream->runtime->rate;
-	int do_spdif, do_ac3;
+	int do_spdif, do_ac3 = 0;
 	do_spdif = ((rate == 44100 || rate == 48000) &&
 		    substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE &&
 		    substream->runtime->channels == 2);
-	do_ac3 = cm->dig_pcm_status & IEC958_AES0_NONAUDIO;
-#ifdef DO_SOFT_AC3
-	if (do_ac3 && cm->can_ac3_sw)
-		do_spdif = 0;
-#endif
+	if (do_spdif && cm->can_ac3_hw) 
+		do_ac3 = cm->dig_pcm_status & IEC958_AES0_NONAUDIO;
 	setup_spdif_playback(cm, substream, do_spdif, do_ac3);
 	return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_PLAY], substream);
 }
@@ -1621,7 +1234,12 @@
 static int snd_cmipci_playback_spdif_prepare(snd_pcm_substream_t *substream)
 {
 	cmipci_t *cm = snd_pcm_substream_chip(substream);
-	setup_spdif_playback(cm, substream, 1, cm->dig_pcm_status & IEC958_AES0_NONAUDIO);
+	int do_ac3;
+	if (cm->can_ac3_hw) 
+		do_ac3 = cm->dig_pcm_status & IEC958_AES0_NONAUDIO;
+	else
+		do_ac3 = 1; /* doesn't matter */
+	setup_spdif_playback(cm, substream, 1, do_ac3);
 	return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_PLAY], substream);
 }
 
@@ -1768,8 +1386,9 @@
 /* spdif playback on channel A */
 static snd_pcm_hardware_t snd_cmipci_playback_spdif =
 {
-	.info =			(SNDRV_PCM_INFO_INTERLEAVED |
-				 SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE),
+	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
+				 SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE |
+				 SNDRV_PCM_INFO_MMAP_VALID),
 	.formats =		SNDRV_PCM_FMTBIT_S16_LE,
 	.rates =		SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000,
 	.rate_min =		44100,
@@ -1784,6 +1403,26 @@
 	.fifo_size =		0,
 };
 
+/* spdif playback on channel A (32bit, IEC958 subframes) */
+static snd_pcm_hardware_t snd_cmipci_playback_iec958_subframe =
+{
+	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
+				 SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE |
+				 SNDRV_PCM_INFO_MMAP_VALID),
+	.formats =		SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE,
+	.rates =		SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000,
+	.rate_min =		44100,
+	.rate_max =		48000,
+	.channels_min =		2,
+	.channels_max =		2,
+	.buffer_bytes_max =	(128*1024),
+	.period_bytes_min =	64,
+	.period_bytes_max =	(128*1024),
+	.periods_min =		2,
+	.periods_max =		1024,
+	.fifo_size =		0,
+};
+
 /* spdif capture on channel B */
 static snd_pcm_hardware_t snd_cmipci_capture_spdif =
 {
@@ -1921,13 +1560,13 @@
 
 	if ((err = open_device_check(cm, CM_OPEN_SPDIF_PLAYBACK, substream)) < 0) /* use channel A */
 		return err;
-	runtime->hw = snd_cmipci_playback_spdif;
-#ifdef DO_SOFT_AC3
-	if (cm->can_ac3_hw)
-#endif
-		runtime->hw.info |= SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID;
-	if (cm->chip_version >= 37)
-		runtime->hw.formats |= SNDRV_PCM_FMTBIT_S32_LE;
+	if (cm->can_ac3_hw) {
+		runtime->hw = snd_cmipci_playback_spdif;
+		if (cm->chip_version >= 37)
+			runtime->hw.formats |= SNDRV_PCM_FMTBIT_S32_LE;
+	} else {
+		runtime->hw = snd_cmipci_playback_iec958_subframe;
+	}
 	snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0, 0x40000);
 	cm->dig_pcm_status = cm->dig_status;
 	return 0;
@@ -2034,21 +1673,6 @@
 	.pointer =	snd_cmipci_playback_pointer,
 };
 
-#ifdef DO_SOFT_AC3
-static snd_pcm_ops_t snd_cmipci_playback_spdif_soft_ops = {
-	.open =		snd_cmipci_playback_spdif_open,
-	.close =	snd_cmipci_playback_spdif_close,
-	.ioctl =	snd_pcm_lib_ioctl,
-	.hw_params =	snd_cmipci_hw_params,
-	.hw_free =	snd_cmipci_playback_hw_free,
-	.prepare =	snd_cmipci_playback_spdif_prepare,	/* set up rate */
-	.trigger =	snd_cmipci_playback_trigger,
-	.pointer =	snd_cmipci_playback_pointer,
-	.copy =		snd_cmipci_ac3_copy,
-	.silence =	snd_cmipci_ac3_silence,
-};
-#endif
-
 static snd_pcm_ops_t snd_cmipci_capture_spdif_ops = {
 	.open =		snd_cmipci_capture_spdif_open,
 	.close =	snd_cmipci_capture_spdif_close,
@@ -2125,14 +1749,7 @@
 	if (err < 0)
 		return err;
 
-#ifdef DO_SOFT_AC3
-	if (cm->can_ac3_hw)
-		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cmipci_playback_spdif_ops);
-	else
-		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cmipci_playback_spdif_soft_ops);
-#else
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cmipci_playback_spdif_ops);
-#endif
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cmipci_capture_spdif_ops);
 
 	pcm->private_data = cm;
@@ -2770,16 +2387,17 @@
 			if (err < 0)
 				return err;
 		}
-		if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_default, cm))) < 0)
-			return err;
-		kctl->id.device = pcm_spdif_device;
-		if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_mask, cm))) < 0)
-			return err;
-		kctl->id.device = pcm_spdif_device;
-		if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_stream, cm))) < 0)
-			return err;
-		kctl->id.device = pcm_spdif_device;
-		cm->spdif_pcm_ctl = kctl;
+		if (cm->can_ac3_hw) {
+			if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_default, cm))) < 0)
+				return err;
+			kctl->id.device = pcm_spdif_device;
+			if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_mask, cm))) < 0)
+				return err;
+			kctl->id.device = pcm_spdif_device;
+			if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_cmipci_spdif_stream, cm))) < 0)
+				return err;
+			kctl->id.device = pcm_spdif_device;
+		}
 		if (cm->chip_version <= 37) {
 			sw = snd_cmipci_old_mixer_switches;
 			for (idx = 0; idx < num_controls(snd_cmipci_old_mixer_switches); idx++, sw++) {
@@ -2917,6 +2535,8 @@
 	if (cm->can_multi_ch)
 		sprintf(cm->card->driver + strlen(cm->card->driver),
 			"-MC%d", cm->max_channels);
+	else if (cm->can_ac3_sw)
+		strcpy(cm->card->driver + strlen(cm->card->driver), "-SWIEC");
 }
 
 
@@ -3013,9 +2633,7 @@
 
 	cm->chip_version = 0;
 	cm->max_channels = 2;
-#ifdef DO_SOFT_AC3
 	cm->do_soft_ac3 = soft_ac3[dev];
-#endif
 
 	query_chip(cm);
 
@@ -3264,15 +2882,7 @@
 	
 static int __init alsa_card_cmipci_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "C-Media PCI soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_cmipci_exit(void)
@@ -3282,34 +2892,3 @@
 
 module_init(alsa_card_cmipci_init)
 module_exit(alsa_card_cmipci_exit)
-
-#ifndef MODULE
-
-/* format is: snd-cmipci=enable,index,id,
-			 mpu_port,fm_port,soft_ac3,joystick_port */
-
-static int __init alsa_card_cmipci_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2
-#ifdef DO_SOFT_AC3
-	       && get_option(&str,&soft_ac3[nr_dev]) == 2
-#endif
-#ifdef SUPPORT_JOYSTICK
-	       && get_option(&str,&joystick_port[nr_dev]) == 2
-#endif
-	       );
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-cmipci=", alsa_card_cmipci_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/cs4281.c b/sound/pci/cs4281.c
--- a/sound/pci/cs4281.c	Tue Jun 15 22:21:03 2004
+++ b/sound/pci/cs4281.c	Tue Jun 15 22:21:03 2004
@@ -27,13 +27,13 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/rawmidi.h>
 #include <sound/ac97_codec.h>
 #include <sound/opl3.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 
@@ -47,17 +47,18 @@
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable switches */
 static int dual_codec[SNDRV_CARDS];	/* dual codec */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for CS4281 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for CS4281 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable CS4281 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(dual_codec, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dual_codec, bool, boot_devs, 0444);
 MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled).");
 MODULE_PARM_SYNTAX(dual_codec, SNDRV_ENABLED ",allows:{{0,3}}");
 
@@ -1184,7 +1185,7 @@
 }
 
 static long snd_cs4281_BA0_read(snd_info_entry_t *entry, void *file_private_data,
-				struct file *file, char *buf, long count)
+				struct file *file, char __user *buf, long count)
 {
 	long size;
 	cs4281_t *chip = snd_magic_cast(cs4281_t, entry->private_data, return -ENXIO);
@@ -1201,7 +1202,7 @@
 }
 
 static long snd_cs4281_BA1_read(snd_info_entry_t *entry, void *file_private_data,
-				struct file *file, char *buf, long count)
+				struct file *file, char __user *buf, long count)
 {
 	long size;
 	cs4281_t *chip = snd_magic_cast(cs4281_t, entry->private_data, return -ENXIO);
@@ -1395,7 +1396,8 @@
 
 static int snd_cs4281_chip_init(cs4281_t *chip); /* defined below */
 #ifdef CONFIG_PM
-static int snd_cs4281_set_power_state(snd_card_t *card, unsigned int power_state);
+static int cs4281_suspend(snd_card_t *card, unsigned int state);
+static int cs4281_resume(snd_card_t *card, unsigned int state);
 #endif
 
 static int __devinit snd_cs4281_create(snd_card_t * card,
@@ -1461,10 +1463,7 @@
 
 	snd_cs4281_proc_init(chip);
 
-#ifdef CONFIG_PM
-	card->set_power_state = snd_cs4281_set_power_state;
-	card->power_state_private_data = chip;
-#endif
+	snd_card_set_pm_callback(card, cs4281_suspend, cs4281_resume, chip);
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
 		snd_cs4281_free(chip);
@@ -1481,7 +1480,9 @@
 {
 	unsigned int tmp;
 	int timeout;
+	int retry_count = 2;
 
+      __retry:
 	tmp = snd_cs4281_peekBA0(chip, BA0_CFLR);
 	if (tmp != BA0_CFLR_DEFAULT) {
 		snd_cs4281_pokeBA0(chip, BA0_CFLR, BA0_CFLR_DEFAULT);
@@ -1629,6 +1630,8 @@
 		snd_cs4281_delay_long();
 	} while (timeout-- > 0);
 
+	if (--retry_count > 0)
+		goto __retry;
 	snd_printk(KERN_ERR "never read ISV3 and ISV4 from AC'97\n");
 	return -EIO;
 
@@ -1999,15 +2002,14 @@
 		return err;
 	}
 
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_cs4281_remove(struct pci_dev *pci)
 {
-	cs4281_t *chip = pci_get_drvdata(pci);
-	snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -2036,17 +2038,19 @@
 
 #define CLKCR1_CKRA                             0x00010000L
 
-static void cs4281_suspend(cs4281_t *chip)
+static int cs4281_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	cs4281_t *chip = snd_magic_cast(cs4281_t, card->pm_private_data, return -EINVAL);
 	u32 ulCLK;
 	unsigned int i;
 
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
-
 	snd_pcm_suspend_all(chip->pcm);
 
+	if (chip->ac97)
+		snd_ac97_suspend(chip->ac97);
+	if (chip->ac97_secondary)
+		snd_ac97_suspend(chip->ac97_secondary);
+
 	ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1);
 	ulCLK |= CLKCR1_CKRA;
 	snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK);
@@ -2076,17 +2080,15 @@
 	snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void cs4281_resume(cs4281_t *chip)
+static int cs4281_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	cs4281_t *chip = snd_magic_cast(cs4281_t, card->pm_private_data, return -EINVAL);
 	unsigned int i;
 	u32 ulCLK;
 
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
-
 	pci_enable_device(chip->pci);
 
 	ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1);
@@ -2110,41 +2112,8 @@
 	snd_cs4281_pokeBA0(chip, BA0_CLKCR1, ulCLK);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int snd_cs4281_suspend(struct pci_dev *dev, u32 state)
-{
-	cs4281_t *chip = snd_magic_cast(cs4281_t, pci_get_drvdata(dev), return -ENXIO);
-	cs4281_suspend(chip);
-	return 0;
-}
-static int snd_cs4281_resume(struct pci_dev *dev)
-{
-	cs4281_t *chip = snd_magic_cast(cs4281_t, pci_get_drvdata(dev), return -ENXIO);
-	cs4281_resume(chip);
 	return 0;
 }
-
-/* callback */
-static int snd_cs4281_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	cs4281_t *chip = snd_magic_cast(cs4281_t, card->power_state_private_data, return -ENXIO);
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		cs4281_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		cs4281_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
 #endif /* CONFIG_PM */
 
 static struct pci_driver driver = {
@@ -2152,23 +2121,12 @@
 	.id_table = snd_cs4281_ids,
 	.probe = snd_cs4281_probe,
 	.remove = __devexit_p(snd_cs4281_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_cs4281_suspend,
-	.resume = snd_cs4281_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };
 	
 static int __init alsa_card_cs4281_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "CS4281 soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_cs4281_exit(void)
@@ -2178,24 +2136,3 @@
 
 module_init(alsa_card_cs4281_init)
 module_exit(alsa_card_cs4281_exit)
-
-#ifndef MODULE
-
-/* format is: snd-cs4281=enable,index,id */
-
-static int __init alsa_card_cs4281_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-cs4281=", alsa_card_cs4281_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
--- a/sound/pci/cs46xx/cs46xx.c	Tue Jun 15 22:21:04 2004
+++ b/sound/pci/cs46xx/cs46xx.c	Tue Jun 15 22:21:04 2004
@@ -29,9 +29,9 @@
 #include <linux/pci.h>
 #include <linux/time.h>
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/cs46xx.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -52,23 +52,24 @@
 static int external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 static int thinkpad[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 static int mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for the CS46xx soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for the CS46xx soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable CS46xx soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(external_amp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(external_amp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(external_amp, "Force to enable external amplifer.");
 MODULE_PARM_SYNTAX(external_amp, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
-MODULE_PARM(thinkpad, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(thinkpad, bool, boot_devs, 0444);
 MODULE_PARM_DESC(thinkpad, "Force to enable Thinkpad's CLKRUN control.");
 MODULE_PARM_SYNTAX(thinkpad, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
-MODULE_PARM(mmap_valid, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mmap_valid, bool, boot_devs, 0444);
 MODULE_PARM_DESC(mmap_valid, "Support OSS mmap.");
 MODULE_PARM_SYNTAX(mmap_valid, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
 
@@ -157,31 +158,14 @@
 		return err;
 	}
 
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int snd_card_cs46xx_suspend(struct pci_dev *pci, u32 state)
-{
-	cs46xx_t *chip = snd_magic_cast(cs46xx_t, pci_get_drvdata(pci), return -ENXIO);
-	snd_cs46xx_suspend(chip);
-	return 0;
-}
-static int snd_card_cs46xx_resume(struct pci_dev *pci)
-{
-	cs46xx_t *chip = snd_magic_cast(cs46xx_t, pci_get_drvdata(pci), return -ENXIO);
-	snd_cs46xx_resume(chip);
-	return 0;
-}
-#endif
-
 static void __devexit snd_card_cs46xx_remove(struct pci_dev *pci)
 {
-	cs46xx_t *chip = snd_magic_cast(cs46xx_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -190,23 +174,12 @@
 	.id_table = snd_cs46xx_ids,
 	.probe = snd_card_cs46xx_probe,
 	.remove = __devexit_p(snd_card_cs46xx_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_card_cs46xx_suspend,
-	.resume = snd_card_cs46xx_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };
 
 static int __init alsa_card_cs46xx_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Sound Fusion CS46xx soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_cs46xx_exit(void)
@@ -216,27 +189,3 @@
 
 module_init(alsa_card_cs46xx_init)
 module_exit(alsa_card_cs46xx_exit)
-
-#ifndef MODULE
-
-/* format is: snd-cs46xx=enable,index,id,mmap_valid,external_amp,thinkpad */
-
-static int __init alsa_card_cs46xx_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&mmap_valid[nr_dev]) == 2 &&
-	       get_option(&str,&external_amp[nr_dev]) == 2 &&
-	       get_option(&str,&thinkpad[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-cs46xx=", alsa_card_cs46xx_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
--- a/sound/pci/cs46xx/cs46xx_lib.c	Tue Jun 15 22:20:36 2004
+++ b/sound/pci/cs46xx/cs46xx_lib.c	Tue Jun 15 22:20:36 2004
@@ -2866,7 +2866,7 @@
  */
 
 static long snd_cs46xx_io_read(snd_info_entry_t *entry, void *file_private_data,
-			       struct file *file, char *buf, long count)
+			       struct file *file, char __user *buf, long count)
 {
 	long size;
 	snd_cs46xx_region_t *region = (snd_cs46xx_region_t *)entry->private_data;
@@ -3784,17 +3784,19 @@
  * APM support
  */
 #ifdef CONFIG_PM
-void snd_cs46xx_suspend(cs46xx_t *chip)
+static int snd_cs46xx_suspend(snd_card_t *card, unsigned int state)
 {
+	cs46xx_t *chip = snd_magic_cast(cs46xx_t, card->pm_private_data, return -EINVAL);
 	int amp_saved;
 
-	snd_card_t *card = chip->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
 	snd_pcm_suspend_all(chip->pcm);
 	// chip->ac97_powerdown = snd_cs46xx_codec_read(chip, AC97_POWER_CONTROL);
 	// chip->ac97_general_purpose = snd_cs46xx_codec_read(chip, BA0_AC97_GENERAL_PURPOSE);
+
+	snd_ac97_suspend(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]);
+	if (chip->ac97[CS46XX_SECONDARY_CODEC_INDEX])
+		snd_ac97_suspend(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]);
+
 	amp_saved = chip->amplifier;
 	/* turn off amp */
 	chip->amplifier_ctrl(chip, -chip->amplifier);
@@ -3803,16 +3805,14 @@
 	chip->active_ctrl(chip, -chip->amplifier);
 	chip->amplifier = amp_saved; /* restore the status */
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-void snd_cs46xx_resume(cs46xx_t *chip)
+static int snd_cs46xx_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	cs46xx_t *chip = snd_magic_cast(cs46xx_t, card->pm_private_data, return -EINVAL);
 	int amp_saved;
 
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
-
 	pci_enable_device(chip->pci);
 	amp_saved = chip->amplifier;
 	chip->amplifier = 0;
@@ -3832,6 +3832,8 @@
 #endif
 
 	snd_ac97_resume(chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]);
+	if (chip->ac97[CS46XX_SECONDARY_CODEC_INDEX])
+		snd_ac97_resume(chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]);
 
 	if (amp_saved)
 		chip->amplifier_ctrl(chip, 1); /* turn amp on */
@@ -3839,25 +3841,6 @@
 		chip->active_ctrl(chip, -1); /* disable CLKRUN */
 	chip->amplifier = amp_saved;
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int snd_cs46xx_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	cs46xx_t *chip = snd_magic_cast(cs46xx_t, card->power_state_private_data, return -ENXIO);
-
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		snd_cs46xx_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		snd_cs46xx_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
 #endif /* CONFIG_PM */
@@ -4010,10 +3993,7 @@
 
 	snd_cs46xx_proc_init(card, chip);
 
-#ifdef CONFIG_PM
-	card->set_power_state = snd_cs46xx_set_power_state;
-	card->power_state_private_data = chip;
-#endif
+	snd_card_set_pm_callback(card, snd_cs46xx_suspend, snd_cs46xx_resume, chip);
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
 		snd_cs46xx_free(chip);
diff -Nru a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
--- a/sound/pci/emu10k1/emu10k1.c	Tue Jun 15 22:20:35 2004
+++ b/sound/pci/emu10k1/emu10k1.c	Tue Jun 15 22:20:35 2004
@@ -23,9 +23,9 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/time.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/emu10k1.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -49,32 +49,33 @@
 static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64};
 static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
 static int enable_ir[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for the EMU10K1 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for the EMU10K1 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable the EMU10K1 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(extin, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(extin, int, boot_devs, 0444);
 MODULE_PARM_DESC(extin, "Available external inputs for FX8010. Zero=default.");
 MODULE_PARM_SYNTAX(extin, SNDRV_ENABLED "allows:{{0,0x0ffff}},base:16");
-MODULE_PARM(extout, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(extout, int, boot_devs, 0444);
 MODULE_PARM_DESC(extout, "Available external outputs for FX8010. Zero=default.");
 MODULE_PARM_SYNTAX(extout, SNDRV_ENABLED "allows:{{0,0x0ffff}},base:16");
-MODULE_PARM(seq_ports, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(seq_ports, int, boot_devs, 0444);
 MODULE_PARM_DESC(seq_ports, "Allocated sequencer ports for internal synthesizer.");
 MODULE_PARM_SYNTAX(seq_ports, SNDRV_ENABLED "allows:{{0,32}}");
-MODULE_PARM(max_synth_voices, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(max_synth_voices, int, boot_devs, 0444);
 MODULE_PARM_DESC(max_synth_voices, "Maximum number of voices for WaveTable.");
 MODULE_PARM_SYNTAX(max_synth_voices, SNDRV_ENABLED);
-MODULE_PARM(max_buffer_size, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(max_buffer_size, int, boot_devs, 0444);
 MODULE_PARM_DESC(max_buffer_size, "Maximum sample buffer size in MB.");
 MODULE_PARM_SYNTAX(max_buffer_size, SNDRV_ENABLED);
-MODULE_PARM(enable_ir, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable_ir, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable_ir, "Enable IR.");
 MODULE_PARM_SYNTAX(enable_ir, SNDRV_ENABLE_DESC);
 
@@ -211,15 +212,7 @@
 
 static int __init alsa_card_emu10k1_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "EMU10K1/Audigy soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_emu10k1_exit(void)
@@ -229,27 +222,3 @@
 
 module_init(alsa_card_emu10k1_init)
 module_exit(alsa_card_emu10k1_exit)
-
-#ifndef MODULE
-
-/* format is: snd-emu10k1=enable,index,id,
-			  seq_ports,max_synth_voices */
-
-static int __init alsa_card_emu10k1_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&seq_ports[nr_dev]) == 2 &&
-	       get_option(&str,&max_synth_voices[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-emu10k1=", alsa_card_emu10k1_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
--- a/sound/pci/emu10k1/emu10k1_main.c	Tue Jun 15 22:21:04 2004
+++ b/sound/pci/emu10k1/emu10k1_main.c	Tue Jun 15 22:21:04 2004
@@ -690,7 +690,7 @@
 	if (extin_mask == 0)
 		extin_mask = 0x3fcf;
 	if (extout_mask == 0)
-		extout_mask = 0x1fff;
+		extout_mask = 0x7fff;
 	emu->fx8010.extin_mask = extin_mask;
 	emu->fx8010.extout_mask = extout_mask;
 
diff -Nru a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
--- a/sound/pci/emu10k1/emufx.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/emu10k1/emufx.c	Tue Jun 15 22:20:41 2004
@@ -120,8 +120,8 @@
 	/* 0x0a */ "PCM Capture Left",
 	/* 0x0b */ "PCM Capture Right",
 	/* 0x0c */ "MIC Capture",
-	/* 0x0d */ NULL,
-	/* 0x0e */ NULL,
+	/* 0x0d */ "AC97 Surround Left",
+	/* 0x0e */ "AC97 Surround Right",
 	/* 0x0f */ NULL,
 	/* 0x10 */ NULL,
 	/* 0x11 */ "Analog Center",
@@ -898,8 +898,10 @@
 static int snd_emu10k1_verify_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
 	unsigned int i;
-	snd_ctl_elem_id_t *_id, id;
-	emu10k1_fx8010_control_gpr_t *_gctl, gctl;
+	snd_ctl_elem_id_t __user *_id;
+	snd_ctl_elem_id_t id;
+	emu10k1_fx8010_control_gpr_t __user *_gctl;
+	emu10k1_fx8010_control_gpr_t gctl;
 	
 	for (i = 0, _id = icode->gpr_del_controls;
 	     i < icode->gpr_del_control_count; i++, _id++) {
@@ -946,7 +948,8 @@
 static void snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
 	unsigned int i, j;
-	emu10k1_fx8010_control_gpr_t *_gctl, gctl;
+	emu10k1_fx8010_control_gpr_t __user *_gctl;
+	emu10k1_fx8010_control_gpr_t gctl;
 	snd_emu10k1_fx8010_ctl_t *ctl, nctl;
 	snd_kcontrol_new_t knew;
 	snd_kcontrol_t *kctl;
@@ -1012,7 +1015,8 @@
 static void snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode)
 {
 	unsigned int i;
-	snd_ctl_elem_id_t *_id, id;
+	snd_ctl_elem_id_t id;
+	snd_ctl_elem_id_t __user *_id;
 	snd_emu10k1_fx8010_ctl_t *ctl;
 	snd_card_t *card = emu->card;
 	
@@ -1031,7 +1035,8 @@
 {
 	unsigned int i = 0, j;
 	unsigned int total = 0;
-	emu10k1_fx8010_control_gpr_t *_gctl, gctl;
+	emu10k1_fx8010_control_gpr_t gctl;
+	emu10k1_fx8010_control_gpr_t __user *_gctl;
 	snd_emu10k1_fx8010_ctl_t *ctl;
 	snd_ctl_elem_id_t *id;
 	struct list_head *list;
@@ -2113,22 +2118,26 @@
 		for (z = 0; z < 2; z++)
 			OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_REAR_L + z), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 2 + z), C_00000000, C_00000000);
 
-	if (emu->fx8010.extout_mask & (1<<EXTOUT_CENTER)) {
+	if (emu->fx8010.extout_mask & ((1<<EXTOUT_AC97_REAR_L)|(1<<EXTOUT_AC97_REAR_R)))
+		for (z = 0; z < 2; z++)
+			OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_REAR_L + z), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 2 + z), C_00000000, C_00000000);
+
+	if (emu->fx8010.extout_mask & (1<<EXTOUT_AC97_CENTER)) {
 #ifndef EMU10K1_CENTER_LFE_FROM_FRONT
-		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_CENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 4), C_00000000, C_00000000);
+		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_CENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 4), C_00000000, C_00000000);
 		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ACENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 4), C_00000000, C_00000000);
 #else
-		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_CENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 0), C_00000000, C_00000000);
+		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_CENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 0), C_00000000, C_00000000);
 		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ACENTER), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 0), C_00000000, C_00000000);
 #endif
 	}
 
-	if (emu->fx8010.extout_mask & (1<<EXTOUT_LFE)) {
+	if (emu->fx8010.extout_mask & (1<<EXTOUT_AC97_LFE)) {
 #ifndef EMU10K1_CENTER_LFE_FROM_FRONT
-		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_LFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), C_00000000, C_00000000);
+		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_LFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), C_00000000, C_00000000);
 		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ALFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), C_00000000, C_00000000);
 #else
-		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_LFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 1), C_00000000, C_00000000);
+		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_AC97_LFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 1), C_00000000, C_00000000);
 		OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ALFE), GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 1), C_00000000, C_00000000);
 #endif
 	}
@@ -2293,6 +2302,7 @@
 	emu10k1_fx8010_code_t *icode;
 	emu10k1_fx8010_pcm_t *ipcm;
 	unsigned int addr;
+	void __user *argp = (void __user *)arg;
 	int res;
 	
 	switch (cmd) {
@@ -2304,7 +2314,7 @@
 			kfree(info);
 			return res;
 		}
-		if (copy_to_user((void *)arg, info, sizeof(*info))) {
+		if (copy_to_user(argp, info, sizeof(*info))) {
 			kfree(info);
 			return -EFAULT;
 		}
@@ -2316,7 +2326,7 @@
 		icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL);
 		if (icode == NULL)
 			return -ENOMEM;
-		if (copy_from_user(icode, (void *)arg, sizeof(*icode))) {
+		if (copy_from_user(icode, argp, sizeof(*icode))) {
 			kfree(icode);
 			return -EFAULT;
 		}
@@ -2327,12 +2337,12 @@
 		icode = (emu10k1_fx8010_code_t *)kmalloc(sizeof(*icode), GFP_KERNEL);
 		if (icode == NULL)
 			return -ENOMEM;
-		if (copy_from_user(icode, (void *)arg, sizeof(*icode))) {
+		if (copy_from_user(icode, argp, sizeof(*icode))) {
 			kfree(icode);
 			return -EFAULT;
 		}
 		res = snd_emu10k1_icode_peek(emu, icode);
-		if (res == 0 && copy_to_user((void *)arg, icode, sizeof(*icode))) {
+		if (res == 0 && copy_to_user(argp, icode, sizeof(*icode))) {
 			kfree(icode);
 			return -EFAULT;
 		}
@@ -2344,7 +2354,7 @@
 		ipcm = (emu10k1_fx8010_pcm_t *)kmalloc(sizeof(*ipcm), GFP_KERNEL);
 		if (ipcm == NULL)
 			return -ENOMEM;
-		if (copy_from_user(ipcm, (void *)arg, sizeof(*ipcm))) {
+		if (copy_from_user(ipcm, argp, sizeof(*ipcm))) {
 			kfree(ipcm);
 			return -EFAULT;
 		}
@@ -2357,12 +2367,12 @@
 		ipcm = (emu10k1_fx8010_pcm_t *)snd_kcalloc(sizeof(*ipcm), GFP_KERNEL);
 		if (ipcm == NULL)
 			return -ENOMEM;
-		if (copy_from_user(ipcm, (void *)arg, sizeof(*ipcm))) {
+		if (copy_from_user(ipcm, argp, sizeof(*ipcm))) {
 			kfree(ipcm);
 			return -EFAULT;
 		}
 		res = snd_emu10k1_ipcm_peek(emu, ipcm);
-		if (res == 0 && copy_to_user((void *)arg, ipcm, sizeof(*ipcm))) {
+		if (res == 0 && copy_to_user(argp, ipcm, sizeof(*ipcm))) {
 			kfree(ipcm);
 			return -EFAULT;
 		}
@@ -2373,7 +2383,7 @@
 			return -EINVAL;
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-		if (get_user(addr, (unsigned int *)arg))
+		if (get_user(addr, (unsigned int __user *)argp))
 			return -EFAULT;
 		down(&emu->fx8010.lock);
 		res = snd_emu10k1_fx8010_tram_setup(emu, addr);
@@ -2411,7 +2421,7 @@
 	case SNDRV_EMU10K1_IOCTL_SINGLE_STEP:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-		if (get_user(addr, (unsigned int *)arg))
+		if (get_user(addr, (unsigned int __user *)argp))
 			return -EFAULT;
 		if (addr > 0x1ff)
 			return -EINVAL;
@@ -2430,7 +2440,7 @@
 			addr = snd_emu10k1_ptr_read(emu, A_DBG, 0);
 		else
 			addr = snd_emu10k1_ptr_read(emu, DBG, 0);
-		if (put_user(addr, (unsigned int *)arg))
+		if (put_user(addr, (unsigned int __user *)argp))
 			return -EFAULT;
 		return 0;
 	}
diff -Nru a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
--- a/sound/pci/emu10k1/emumixer.c	Tue Jun 15 22:20:44 2004
+++ b/sound/pci/emu10k1/emumixer.c	Tue Jun 15 22:20:44 2004
@@ -34,6 +34,8 @@
 
 #define chip_t emu10k1_t
 
+#define AC97_ID_STAC9758	0x83847658
+
 static int snd_emu10k1_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
 {
 	uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
@@ -531,6 +533,15 @@
 			snd_ac97_write(emu->ac97, AC97_REC_SEL, 0x0000);
 			c = audigy_remove_ctls;
 		} else {
+			/*
+			 * Credits for cards based on STAC9758:
+			 *   James Courtier-Dutton <James@superbug.demon.co.uk>
+			 *   Voluspa <voluspa@comhem.se>
+			 */
+			if (emu->ac97->id == AC97_ID_STAC9758) {
+				emu->rear_ac97 = 1;
+				snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE|AC97SLOT_REAR_LEFT|AC97SLOT_REAR_RIGHT);
+			}
 			/* remove unused AC97 controls */
 			snd_ac97_write(emu->ac97, AC97_SURROUND_MASTER, 0x0202);
 			snd_ac97_write(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202);
diff -Nru a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
--- a/sound/pci/emu10k1/emuproc.c	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/emu10k1/emuproc.c	Tue Jun 15 22:20:39 2004
@@ -191,7 +191,7 @@
 #define TOTAL_SIZE_CODE		(0x200*8)
 
 static long snd_emu10k1_fx8010_read(snd_info_entry_t *entry, void *file_private_data,
-				    struct file *file, char *buf, long count)
+				    struct file *file, char __user *buf, long count)
 {
 	long size;
 	emu10k1_t *emu = snd_magic_cast(emu10k1_t, entry->private_data, return -ENXIO);
diff -Nru a/sound/pci/ens1370.c b/sound/pci/ens1370.c
--- a/sound/pci/ens1370.c	Tue Jun 15 22:20:44 2004
+++ b/sound/pci/ens1370.c	Tue Jun 15 22:20:44 2004
@@ -27,6 +27,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -36,7 +37,6 @@
 #else
 #include <sound/ak4531_codec.h>
 #endif
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/asoundef.h>
 
@@ -86,23 +86,24 @@
 static int joystick[SNDRV_CARDS];
 #endif
 #endif
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Ensoniq AudioPCI soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Ensoniq AudioPCI soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Ensoniq AudioPCI soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 #ifdef SUPPORT_JOYSTICK
 #ifdef CHIP1371
-MODULE_PARM(joystick_port, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick_port, int, boot_devs, 0444);
 MODULE_PARM_DESC(joystick_port, "Joystick port address.");
 MODULE_PARM_SYNTAX(joystick_port, SNDRV_ENABLED ",allows:{{0},{1},{0x200},{0x208},{0x210},{0x218}},dialog:list");
 #else
-MODULE_PARM(joystick, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick, bool, boot_devs, 0444);
 MODULE_PARM_DESC(joystick, "Enable joystick.");
 MODULE_PARM_SYNTAX(joystick, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 #endif
@@ -2371,15 +2372,7 @@
 	
 static int __init alsa_card_ens137x_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Ensoniq AudioPCI soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_ens137x_exit(void)
@@ -2389,36 +2382,3 @@
 
 module_init(alsa_card_ens137x_init)
 module_exit(alsa_card_ens137x_exit)
-
-#ifndef MODULE
-
-/* format is: snd-ens1370=enable,index,id,joystick */
-
-static int __init alsa_card_ens137x_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2
-#ifdef SUPPORT_JOYSTICK
-#ifdef CHIP1371
-	       && get_option(&str,&joystick_port[nr_dev]) == 2
-#else
-	       && get_option(&str,&joystick[nr_dev]) == 2
-#endif
-#endif
-	       );
-	nr_dev++;
-	return 1;
-}
-
-#if defined(CHIP1370)
-__setup("snd-ens1370=", alsa_card_ens137x_setup);
-#elif defined(CHIP1371)
-__setup("snd-ens1371=", alsa_card_ens137x_setup);
-#endif
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/es1938.c b/sound/pci/es1938.c
--- a/sound/pci/es1938.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/es1938.c	Tue Jun 15 22:20:42 2004
@@ -53,12 +53,12 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/opl3.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/io.h>
@@ -84,14 +84,15 @@
 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_PNP;	/* Enable this card */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ESS Solo-1 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ESS Solo-1 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable ESS Solo-1 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 
@@ -821,7 +822,7 @@
 static int snd_es1938_capture_copy(snd_pcm_substream_t *substream,
 				   int channel,
 				   snd_pcm_uframes_t pos,
-				   void *dst,
+				   void __user *dst,
 				   snd_pcm_uframes_t count)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
@@ -835,7 +836,7 @@
 	} else {
 		if (copy_to_user(dst, runtime->dma_area + pos + 1, count - 1))
 			return -EFAULT;
-		if (put_user(runtime->dma_area[0], ((unsigned char *)dst) + count - 1))
+		if (put_user(runtime->dma_area[0], ((unsigned char __user *)dst) + count - 1))
 			return -EFAULT;
 	}
 	return 0;
@@ -1700,15 +1701,7 @@
 
 static int __init alsa_card_es1938_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "ESS Solo-1 soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_es1938_exit(void)
@@ -1718,24 +1711,3 @@
 
 module_init(alsa_card_es1938_init)
 module_exit(alsa_card_es1938_exit)
-
-#ifndef MODULE
-
-/* format is: snd-es1938=enable,index,id */
-
-static int __init alsa_card_es1938_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-es1938=", alsa_card_es1938_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/es1968.c b/sound/pci/es1968.c
--- a/sound/pci/es1968.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/es1968.c	Tue Jun 15 22:20:42 2004
@@ -102,11 +102,11 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/mpu401.h>
 #include <sound/ac97_codec.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #define chip_t es1968_t
@@ -138,36 +138,37 @@
 #ifdef SUPPORT_JOYSTICK
 static int joystick[SNDRV_CARDS];
 #endif
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(total_bufsize, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(total_bufsize, int, boot_devs, 0444);
 MODULE_PARM_DESC(total_bufsize, "Total buffer size in kB.");
 MODULE_PARM_SYNTAX(total_bufsize, SNDRV_ENABLED ",allows:{{1,4096}},skill:advanced");
-MODULE_PARM(pcm_substreams_p, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_substreams_p, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_substreams_p, "PCM Playback substreams for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(pcm_substreams_p, SNDRV_ENABLED ",allows:{{1,8}}");
-MODULE_PARM(pcm_substreams_c, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_substreams_c, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_substreams_c, "PCM Capture substreams for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(pcm_substreams_c, SNDRV_ENABLED ",allows:{{0,8}}");
-MODULE_PARM(clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(clock, int, boot_devs, 0444);
 MODULE_PARM_DESC(clock, "Clock on " CARD_NAME " soundcard.  (0 = auto-detect)");
 MODULE_PARM_SYNTAX(clock, SNDRV_ENABLED);
-MODULE_PARM(use_pm, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(use_pm, int, boot_devs, 0444);
 MODULE_PARM_DESC(use_pm, "Toggle power-management.  (0 = off, 1 = on, 2 = auto)");
-MODULE_PARM_SYNTAX(use_pm, SNDRV_ENABLED ",allows:{{0,1,2}},skill:advanced");
-MODULE_PARM(enable_mpu, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+MODULE_PARM_SYNTAX(use_pm, SNDRV_ENABLED ",allows:{{0,1,2}},default:2,skill:advanced");
+module_param_array(enable_mpu, int, boot_devs, 0444);
 MODULE_PARM_DESC(enable_mpu, "Enable MPU401.  (0 = off, 1 = on, 2 = auto)");
-MODULE_PARM_SYNTAX(enable_mpu, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
+MODULE_PARM_SYNTAX(enable_mpu, SNDRV_ENABLED ",allows:{{0,2}},default:2");
 #ifdef SUPPORT_JOYSTICK
-MODULE_PARM(joystick, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick, bool, boot_devs, 0444);
 MODULE_PARM_DESC(joystick, "Enable joystick.");
 MODULE_PARM_SYNTAX(joystick, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 #endif
@@ -2415,30 +2416,27 @@
 /*
  * PM support
  */
-static void es1968_suspend(es1968_t *chip)
+static int es1968_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	es1968_t *chip = snd_magic_cast(es1968_t, card->pm_private_data, return -EINVAL);
 
 	if (! chip->do_pm)
-		return;
-
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
+		return 0;
 
 	snd_pcm_suspend_all(chip->pcm);
+	snd_ac97_suspend(chip->ac97);
 	snd_es1968_bob_stop(chip);
+	snd_es1968_set_acpi(chip, ACPI_D3);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void es1968_resume(es1968_t *chip)
+static int es1968_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	es1968_t *chip = snd_magic_cast(es1968_t, card->pm_private_data, return -EINVAL);
 
 	if (! chip->do_pm)
-		return;
-
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
+		return 0;
 
 	/* restore all our config */
 	pci_enable_device(chip->pci);
@@ -2460,47 +2458,17 @@
 		snd_es1968_bob_start(chip);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int snd_es1968_suspend(struct pci_dev *dev, u32 state)
-{
-	es1968_t *chip = snd_magic_cast(es1968_t, pci_get_drvdata(dev), return -ENXIO);
-	es1968_suspend(chip);
 	return 0;
 }
-static int snd_es1968_resume(struct pci_dev *dev)
-{
-	es1968_t *chip = snd_magic_cast(es1968_t, pci_get_drvdata(dev), return -ENXIO);
-	es1968_resume(chip);
-	return 0;
-}
-
-/* callback */
-static int snd_es1968_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	es1968_t *chip = snd_magic_cast(es1968_t, card->power_state_private_data, return -ENXIO);
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		es1968_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		es1968_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
 #endif /* CONFIG_PM */
 
 static int snd_es1968_free(es1968_t *chip)
 {
-	if (chip->res_io_port)
-		snd_es1968_reset(chip);
+	if (chip->res_io_port) {
+		synchronize_irq(chip->irq);
+		outw(1, chip->io_port + 0x04); /* clear WP interrupts */
+		outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */
+	}
 
 #ifdef SUPPORT_JOYSTICK
 	if (chip->res_joystick) {
@@ -2534,6 +2502,7 @@
 };
 
 static struct ess_device_list pm_whitelist[] __devinitdata = {
+	{ TYPE_MAESTRO2E, 0x0e11 },	/* Compaq Armada */
 	{ TYPE_MAESTRO2E, 0x1028 },
 	{ TYPE_MAESTRO2E, 0x103c },
 	{ TYPE_MAESTRO2E, 0x1179 },
@@ -2636,12 +2605,8 @@
 
 	snd_es1968_chip_init(chip);
 
-#ifdef CONFIG_PM
-	if (chip->do_pm) {
-		card->set_power_state = snd_es1968_set_power_state;
-		card->power_state_private_data = chip;
-	}
-#endif
+	if (chip->do_pm)
+		snd_card_set_pm_callback(card, es1968_suspend, es1968_resume, chip);
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
 		snd_es1968_free(chip);
@@ -2763,16 +2728,14 @@
 		snd_card_free(card);
 		return err;
 	}
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_es1968_remove(struct pci_dev *pci)
 {
-	es1968_t *chip = snd_magic_cast(es1968_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -2781,71 +2744,18 @@
 	.id_table = snd_es1968_ids,
 	.probe = snd_es1968_probe,
 	.remove = __devexit_p(snd_es1968_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_es1968_suspend,
-	.resume = snd_es1968_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };
 
 static int __init alsa_card_es1968_init(void)
 {
-	int err;
-
-        if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "ESS Maestro soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_es1968_exit(void)
 {
-#if 0 // do we really need this?
-	unregister_reboot_notifier(&snd_es1968_nb);
-#endif
 	pci_unregister_driver(&driver);
 }
 
 module_init(alsa_card_es1968_init)
 module_exit(alsa_card_es1968_exit)
-
-#ifndef MODULE
-
-/* format is: snd-es1968=enable,index,id,
-			 total_bufsize,
-			 pcm_substreams_p,
-			 pcm_substreams_c,
-			 clock,
-			 use_pm,
-			 enable_mpu,
-			 joystick
-*/
-
-static int __init alsa_card_es1968_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&total_bufsize[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_substreams_p[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_substreams_c[nr_dev]) == 2 &&
-	       get_option(&str,&clock[nr_dev]) == 2 &&
-	       get_option(&str,&use_pm[nr_dev]) == 2 &&
-	       get_option(&str,&enable_mpu[nr_dev]) == 2
-#ifdef SUPPORT_JOYSTICK
-	       && get_option(&str,&joystick[nr_dev]) == 2
-#endif
-	       );
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-es1968=", alsa_card_es1968_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/fm801.c b/sound/pci/fm801.c
--- a/sound/pci/fm801.c	Tue Jun 15 22:20:43 2004
+++ b/sound/pci/fm801.c	Tue Jun 15 22:20:43 2004
@@ -25,12 +25,12 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/io.h>
@@ -60,17 +60,18 @@
  *  High 16-bits are video (radio) device number + 1
  */
 static int tea575x_tuner[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 };
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for the FM801 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for the FM801 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable FM801 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(tea575x_tuner, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(tea575x_tuner, bool, boot_devs, 0444);
 MODULE_PARM_DESC(tea575x_tuner, "Enable TEA575x tuner.");
 MODULE_PARM_SYNTAX(tea575x_tuner, SNDRV_ENABLE_DESC);
 
@@ -1482,15 +1483,7 @@
 
 static int __init alsa_card_fm801_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "ForteMedia FM801 soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_fm801_exit(void)
@@ -1500,25 +1493,3 @@
 
 module_init(alsa_card_fm801_init)
 module_exit(alsa_card_fm801_exit)
-
-#ifndef MODULE
-
-/* format is: snd-fm801=enable,index,id,tea575x_tuner */
-
-static int __init alsa_card_fm801_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&tea575x_tuner[nr_dev]));
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-fm801=", alsa_card_fm801_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/ice1712/Makefile b/sound/pci/ice1712/Makefile
--- a/sound/pci/ice1712/Makefile	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/ice1712/Makefile	Tue Jun 15 22:20:39 2004
@@ -5,7 +5,7 @@
 
 snd-ice17xx-ak4xxx-objs := ak4xxx.o
 snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o
-snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o prodigy.o
+snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o
 
 # Toplevel Module Dependency
 obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o snd-ice17xx-ak4xxx.o
diff -Nru a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c
--- a/sound/pci/ice1712/amp.c	Tue Jun 15 22:20:40 2004
+++ b/sound/pci/ice1712/amp.c	Tue Jun 15 22:20:40 2004
@@ -54,10 +54,11 @@
 /* entry point */
 struct snd_ice1712_card_info snd_vt1724_amp_cards[] __devinitdata = {
 	{
-		VT1724_SUBDEVICE_AUDIO2000,
-		"AMP Ltd AUDIO2000",
-		snd_vt1724_amp_init,
-		snd_vt1724_amp_add_controls,
+		.subvendor = VT1724_SUBDEVICE_AUDIO2000,
+		.name = "AMP Ltd AUDIO2000",
+		.model = "amp2000",
+		.chip_init = snd_vt1724_amp_init,
+		.build_controls = snd_vt1724_amp_add_controls,
 	},
 	{ } /* terminator */
 };
diff -Nru a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
--- a/sound/pci/ice1712/aureon.c	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/ice1712/aureon.c	Tue Jun 15 22:20:39 2004
@@ -38,6 +38,25 @@
  *   the analog mixing but not easily controllable (it's not connected
  *   directly from envy24ht chip).  so let's leave it as it is.
  *
+ *
+ *   Lowlevel functions for AudioTrak Prodigy 7.1 (and possibly 192) cards
+ *      Copyright (c) 2003 Dimitromanolakis Apostolos <apostol@cs.utoronto.ca>
+ *
+ *   version 0.82: Stable / not all features work yet (no communication with AC97 secondary)
+ *       added 64x/128x oversampling switch (should be 64x only for 96khz)
+ *       fixed some recording labels (still need to check the rest)
+ *       recording is working probably thanks to correct wm8770 initialization
+ *
+ *   version 0.5: Initial release:
+ *           working: analog output, mixer, headphone amplifier switch
+ *       not working: prety much everything else, at least i could verify that
+ *                    we have no digital output, no capture, pretty bad clicks and poops
+ *                    on mixer switch and other coll stuff.
+ *
+ * - Prodigy boards are equipped with AC97 STAC9744 chip , too.  it's used to do
+ *   the analog mixing but not easily controllable (it's not connected
+ *   directly from envy24ht chip).  so let's leave it as it is.
+ *
  */      
 
 #include <sound/driver.h>
@@ -77,12 +96,18 @@
 static void aureon_spi_write(ice1712_t *ice, unsigned int cs, unsigned int data, int bits)
 {
 	unsigned int tmp;
+	unsigned int cscs;
 	int i;
 
 	tmp = snd_ice1712_gpio_read(ice);
 
+	if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)
+		cscs = PRODIGY_CS8415_CS;
+	else
+		cscs = AUREON_CS8415_CS;
+
 	snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_WM_DATA|AUREON_WM_CLK|
-					 AUREON_WM_CS|AUREON_CS8415_CS));
+					 AUREON_WM_CS|cscs));
 	tmp |= AUREON_WM_RW;
 	tmp &= ~cs;
 	snd_ice1712_gpio_write(ice, tmp);
@@ -135,6 +160,47 @@
 }
 
 /*
+ * DAC mute control
+ */
+static int wm_dac_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+	uinfo->count = 1;
+	uinfo->value.integer.min = 0;
+	uinfo->value.integer.max = 1;
+	return 0;
+}
+
+static int wm_dac_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+	unsigned short val;
+
+	down(&ice->gpio_mutex);
+	val = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE);
+	ucontrol->value.integer.value[0] = ~val>>4 & 0x1;
+	up(&ice->gpio_mutex);
+	return 0;
+}
+
+static int wm_dac_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+	unsigned short new, old;
+	int change;
+
+	snd_ice1712_save_gpio_status(ice);
+	old = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE);
+	new = (~ucontrol->value.integer.value[0]<<4&0x10) | (old&~0x10);
+	change = (new != old);
+	if (change)
+		wm_put(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE, new);
+	snd_ice1712_restore_gpio_status(ice);
+
+	return change;
+}
+
+/*
  * DAC volume attenuation mixer control
  */
 static int wm_dac_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
@@ -192,6 +258,47 @@
 }
 
 /*
+ * ADC mute control
+ */
+static int wm_adc_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+	uinfo->count = 1;
+	uinfo->value.integer.min = 0;
+	uinfo->value.integer.max = 1;
+	return 0;
+}
+
+static int wm_adc_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+	unsigned short val;
+
+	down(&ice->gpio_mutex);
+	val = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN);
+	ucontrol->value.integer.value[0] = ~val>>5 & 0x1;
+	up(&ice->gpio_mutex);
+	return 0;
+}
+
+static int wm_adc_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+	unsigned short new, old;
+	int change;
+
+	snd_ice1712_save_gpio_status(ice);
+	old = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN);
+	new = (~ucontrol->value.integer.value[0]<<5&0x20) | (old&~0x20);
+	change = (new != old);
+	if (change)
+		wm_put(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN, new);
+	snd_ice1712_restore_gpio_status(ice);
+
+	return change;
+}
+
+/*
  * ADC gain mixer control
  */
 static int wm_adc_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
@@ -227,10 +334,10 @@
 	snd_ice1712_save_gpio_status(ice);
 	idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_ADC_GAIN;
 	nvol = ucontrol->value.integer.value[0];
-	ovol = wm_get(ice, idx) & 0x1f;
-	change = (ovol != nvol);
+	ovol = wm_get(ice, idx);
+	change = ((ovol & 0x1f)  != nvol);
 	if (change)
-		wm_put(ice, idx, nvol);
+		wm_put(ice, idx, nvol | (ovol & ~0x1f));
 	snd_ice1712_restore_gpio_status(ice);
 	return change;
 }
@@ -241,18 +348,15 @@
 static int wm_adc_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
 {
 	static char *texts[] = {
-		"CD Left",
-		"CD Right",
-		"Aux Left",
-		"Aux Right",
-		"Line Left",
-		"Line Right",
-		"Mic Left",
-		"Mic Right",
+		"CD",		//AIN1
+		"Aux",		//AIN2
+		"Line",		//AIN3
+		"Mic",		//AIN4
+		"AC97"		//AIN5
 	};
 	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-	uinfo->count = 2;
-	uinfo->value.enumerated.items = 8;
+	uinfo->count = 1;
+	uinfo->value.enumerated.items = 5;
 	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
 		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
 	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
@@ -291,6 +395,127 @@
 }
 
 /*
+ * Headphone Amplifier
+ */
+static int aureon_set_headphone_amp(ice1712_t *ice, int enable)
+{
+	unsigned int tmp, tmp2;
+
+	tmp2 = tmp = snd_ice1712_gpio_read(ice);
+	if (enable)
+		tmp |= AUREON_HP_SEL;
+	else
+		tmp &= ~ AUREON_HP_SEL;
+	if (tmp != tmp2) {
+		snd_ice1712_gpio_write(ice, tmp);
+		return 1;
+	}
+	return 0;
+}
+
+static int aureon_get_headphone_amp(ice1712_t *ice)
+{
+	unsigned int tmp = snd_ice1712_gpio_read(ice);
+
+	return ( tmp & AUREON_HP_SEL )!= 0;
+}
+
+static int aureon_bool_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+	uinfo->count = 1;
+	uinfo->value.integer.min = 0;
+	uinfo->value.integer.max = 1;
+	return 0;
+}
+
+static int aureon_hpamp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+
+	ucontrol->value.integer.value[0] = aureon_get_headphone_amp(ice);
+	return 0;
+}
+
+
+static int aureon_hpamp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+
+	return aureon_set_headphone_amp(ice,ucontrol->value.integer.value[0]);
+}
+
+/*
+ * Deemphasis
+ */
+static int aureon_deemp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+	ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf;
+	return 0;
+}
+
+static int aureon_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+	int temp, temp2;
+	temp2 = temp = wm_get(ice, WM_DAC_CTRL2);
+	if (ucontrol->value.integer.value[0])
+		temp |= 0xf;
+	else
+		temp &= ~0xf;
+	if (temp != temp2) {
+		wm_put(ice, WM_DAC_CTRL2, temp);
+		return 1;
+	}
+	return 0;
+}
+
+/*
+ * ADC Oversampling
+ */
+static int aureon_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
+{
+	static char *texts[2] = { "128x", "64x"	};
+
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+	uinfo->count = 1;
+	uinfo->value.enumerated.items = 2;
+
+	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
+		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
+	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+
+        return 0;
+}
+
+static int aureon_oversampling_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+	ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8;
+	return 0;
+}
+
+static int aureon_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	int temp, temp2;
+	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
+
+	temp2 = temp = wm_get(ice, WM_MASTER);
+
+	if (ucontrol->value.enumerated.item[0])
+		temp |= 0x8;
+	else
+		temp &= ~0x8;
+
+	if (temp != temp2) {
+		wm_put(ice, WM_MASTER, temp);
+		return 1;
+	}
+	return 0;
+}
+
+/*
  * mixers
  */
 
@@ -315,6 +540,13 @@
 static snd_kcontrol_new_t wm_controls[] __devinitdata = {
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Master Playback Switch",
+		.info = wm_dac_mute_info,
+		.get = wm_dac_mute_get,
+		.put = wm_dac_mute_put,
+	},
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 		.name = "Master Playback Volume",
 		.info = wm_dac_vol_info,
 		.get = wm_dac_vol_get,
@@ -323,6 +555,15 @@
 	},
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "ADC Switch",
+		.count = 2,
+		.info = wm_adc_mute_info,
+		.get = wm_adc_mute_get,
+		.put = wm_adc_mute_put,
+
+	},
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 		.name = "ADC Volume",
 		.count = 2,
 		.info = wm_adc_vol_info,
@@ -336,6 +577,27 @@
 		.get = wm_adc_mux_get,
 		.put = wm_adc_mux_put,
 	},
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Headphone Amplifier Switch",
+		.info = aureon_bool_info,
+		.get = aureon_hpamp_get,
+		.put = aureon_hpamp_put
+	},
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "DAC Deemphasis Switch",
+		.info = aureon_bool_info,
+		.get = aureon_deemp_get,
+		.put = aureon_deemp_put
+	},
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "ADC Oversampling",
+		.info = aureon_oversampling_info,
+		.get = aureon_oversampling_get,
+		.put = aureon_oversampling_put
+	},
 };
 
 
@@ -365,7 +627,7 @@
  */
 static int __devinit aureon_init(ice1712_t *ice)
 {
-	static unsigned short wm_inits[] = {
+	static unsigned short wm_inits_aureon[] = {
 		/* These come first to reduce init pop noise */
 		0x1b, 0x000,		/* ADC Mux */
 		0x1c, 0x009,		/* Out Mux1 */
@@ -399,20 +661,66 @@
 		0x15, 0x000,		/* no deemphasis, no ZFLG */
 		0x19, 0x000,		/* -12dB ADC/L */
 		0x1a, 0x000,		/* -12dB ADC/R */
+		(unsigned short)-1
+	};
+	static unsigned short wm_inits_prodigy[] = {
+
+		/* These come first to reduce init pop noise */
+		0x1b, 0x000,		/* ADC Mux */
+		0x1c, 0x009,		/* Out Mux1 */
+		0x1d, 0x009,		/* Out Mux2 */
+
+		0x18, 0x000,		/* All power-up */
+
+		0x16, 0x022,		/* I2S, normal polarity, 24bit, high-pass on */
+		0x17, 0x006,		/* 128fs, slave mode */
+
+		0x00, 0,		/* DAC1 analog mute */
+		0x01, 0,		/* DAC2 analog mute */
+		0x02, 0,		/* DAC3 analog mute */
+		0x03, 0,		/* DAC4 analog mute */
+		0x04, 0,		/* DAC5 analog mute */
+		0x05, 0,		/* DAC6 analog mute */
+		0x06, 0,		/* DAC7 analog mute */
+		0x07, 0,		/* DAC8 analog mute */
+		0x08, 0x100,		/* master analog mute */
+
+		0x09, 0x7f,		/* DAC1 digital full */
+		0x0a, 0x7f,		/* DAC2 digital full */
+		0x0b, 0x7f,		/* DAC3 digital full */
+		0x0c, 0x7f,		/* DAC4 digital full */
+		0x0d, 0x7f,		/* DAC5 digital full */
+		0x0e, 0x7f,		/* DAC6 digital full */
+		0x0f, 0x7f,		/* DAC7 digital full */
+		0x10, 0x7f,		/* DAC8 digital full */
+		0x11, 0x1FF,		/* master digital full */
+
+		0x12, 0x000,		/* phase normal */
+		0x13, 0x090,		/* unmute DAC L/R */
+		0x14, 0x000,		/* all unmute */
+		0x15, 0x000,		/* no deemphasis, no ZFLG */
+
+		0x19, 0x000,		/* -12dB ADC/L */
+		0x1a, 0x000,		/* -12dB ADC/R */
+		(unsigned short)-1
+
 	};
 	static unsigned short cs_inits[] = {
 		0x0441, /* RUN */
 		0x0100, /* no mute */
 		0x0200, /* */
 		0x0600, /* slave, 24bit */
+		(unsigned short)-1
 	};
 	unsigned int tmp;
-	unsigned int i;
+	unsigned short *p;
+	unsigned int cscs;
 
 	if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) {
 		ice->num_total_dacs = 6;
 		ice->num_total_adcs = 6;
 	} else {
+		/* aureon 7.1 and prodigy 7.1 */
 		ice->num_total_dacs = 8;
 		ice->num_total_adcs = 8;
 	}
@@ -423,16 +731,22 @@
 		return -ENOMEM;
 	ice->akm_codecs = 1;
 
+	if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)
+		cscs = PRODIGY_CS8415_CS;
+	else
+		cscs = AUREON_CS8415_CS;
+
 	snd_ice1712_gpio_set_dir(ice, 0xbfffff); /* fix this for the time being */
 
 	/* reset the wm codec as the SPI mode */
 	snd_ice1712_save_gpio_status(ice);
-	snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RESET|AUREON_WM_CS|AUREON_CS8415_CS));
+	snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RESET|AUREON_WM_CS|
+					 cscs|AUREON_HP_SEL));
 	tmp = snd_ice1712_gpio_read(ice);
 	tmp &= ~AUREON_WM_RESET;
 	snd_ice1712_gpio_write(ice, tmp);
 	udelay(1);
-	tmp |= AUREON_WM_CS | AUREON_CS8415_CS;
+	tmp |= AUREON_WM_CS | cscs;
 	snd_ice1712_gpio_write(ice, tmp);
 	udelay(1);
 	tmp |= AUREON_WM_RESET;
@@ -440,13 +754,19 @@
 	udelay(1);
 
 	/* initialize WM8770 codec */
-	for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2)
-		wm_put(ice, wm_inits[i], wm_inits[i+1]);
+	if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)
+		p = wm_inits_prodigy;
+	else
+		p = wm_inits_aureon;
+	for (; *p != (unsigned short)-1; p += 2)
+		wm_put(ice, p[0], p[1]);
 
 	/* initialize CS8415A codec */
-	for (i = 0; i < ARRAY_SIZE(cs_inits); i++)
-		aureon_spi_write(ice, AUREON_CS8415_CS,
-				 cs_inits[i] | 0x200000, 24);
+	for (p = cs_inits; *p != (unsigned short)-1; p++)
+		aureon_spi_write(ice, cscs,
+				 *p | 0x200000, 24);
+
+	aureon_set_headphone_amp(ice, 1);
 
 	snd_ice1712_restore_gpio_status(ice);
 
@@ -460,7 +780,7 @@
  */
 
 static unsigned char aureon51_eeprom[] __devinitdata = {
-	0x12,	/* SYSCONF: clock 512, mpu401, spdif-in/ADC, 3DACs */
+	0x2a,	/* SYSCONF: clock 512, mpu401, spdif-in/ADC, 3DACs */
 	0x80,	/* ACLINK: I2S */
 	0xf8,	/* I2S: vol, 96k, 24bit, 192k */
 	0xc3,	/* SPDIF: out-en, out-int, spdif-in */
@@ -476,7 +796,23 @@
 };
 
 static unsigned char aureon71_eeprom[] __devinitdata = {
-	0x13,	/* SYSCONF: clock 512, mpu401, spdif-in/ADC, 4DACs */
+	0x2b,	/* SYSCONF: clock 512, mpu401, spdif-in/ADC, 4DACs */
+	0x80,	/* ACLINK: I2S */
+	0xf8,	/* I2S: vol, 96k, 24bit, 192k */
+	0xc3,	/* SPDIF: out-en, out-int, spdif-in */
+	0xff,	/* GPIO_DIR */
+	0xff,	/* GPIO_DIR1 */
+	0xbf,	/* GPIO_DIR2 */
+	0x00,	/* GPIO_MASK */
+	0x00,	/* GPIO_MASK1 */
+	0x00,	/* GPIO_MASK2 */
+	0x00,	/* GPIO_STATE */
+	0x00,	/* GPIO_STATE1 */
+	0x00,	/* GPIO_STATE2 */
+};
+
+static unsigned char prodigy71_eeprom[] __devinitdata = {
+	0x2b,	/* SYSCONF: clock 512, mpu401, spdif-in/ADC, 4DACs */
 	0x80,	/* ACLINK: I2S */
 	0xf8,	/* I2S: vol, 96k, 24bit, 192k */
 	0xc3,	/* SPDIF: out-en, out-int, spdif-in */
@@ -496,6 +832,7 @@
 	{
 		.subvendor = VT1724_SUBDEVICE_AUREON51_SKY,
 		.name = "Terratec Aureon 5.1-Sky",
+		.model = "aureon51",
 		.chip_init = aureon_init,
 		.build_controls = aureon_add_controls,
 		.eeprom_size = sizeof(aureon51_eeprom),
@@ -504,10 +841,29 @@
 	{
 		.subvendor = VT1724_SUBDEVICE_AUREON71_SPACE,
 		.name = "Terratec Aureon 7.1-Space",
+		.model = "aureon71",
 		.chip_init = aureon_init,
 		.build_controls = aureon_add_controls,
 		.eeprom_size = sizeof(aureon71_eeprom),
 		.eeprom_data = aureon71_eeprom,
+	},
+ 	{
+ 		.subvendor = VT1724_SUBDEVICE_AUREON71_UNIVERSE,
+ 		.name = "Terratec Aureon 7.1-Universe",
+		/* model not needed - identical with 7.1-Space */
+ 		.chip_init = aureon_init,
+ 		.build_controls = aureon_add_controls,
+ 		.eeprom_size = sizeof(aureon71_eeprom),
+ 		.eeprom_data = aureon71_eeprom,
+	},
+	{
+		.subvendor = VT1724_SUBDEVICE_PRODIGY71,
+		.name = "Audiotrak Prodigy 7.1",
+		.model = "prodigy71",
+		.chip_init = aureon_init,
+		.build_controls = aureon_add_controls,
+		.eeprom_size = sizeof(prodigy71_eeprom),
+		.eeprom_data = prodigy71_eeprom,
 	},
 	{ } /* terminator */
 };
diff -Nru a/sound/pci/ice1712/aureon.h b/sound/pci/ice1712/aureon.h
--- a/sound/pci/ice1712/aureon.h	Tue Jun 15 22:21:04 2004
+++ b/sound/pci/ice1712/aureon.h	Tue Jun 15 22:21:04 2004
@@ -25,10 +25,14 @@
  */      
 
 #define  AUREON_DEVICE_DESC 	       "{Terratec,Aureon 5.1 Sky},"\
-				       "{Terratec,Aureon 7.1 Space},"
+				       "{Terratec,Aureon 7.1 Space},"\
+				       "{Terratec,Aureon 7.1 Universe}," \
+					"{AudioTrak,Prodigy 7.1},"
 
 #define VT1724_SUBDEVICE_AUREON51_SKY	0x3b154711	/* Aureon 5.1 Sky */
 #define VT1724_SUBDEVICE_AUREON71_SPACE	0x3b154511	/* Aureon 7.1 Space */
+#define VT1724_SUBDEVICE_AUREON71_UNIVERSE	0x3b155311	/* Aureon 7.1 Universe */
+#define VT1724_SUBDEVICE_PRODIGY71	0x33495345	/* PRODIGY 7.1 */
 
 extern struct snd_ice1712_card_info  snd_vt1724_aureon_cards[];
 
@@ -43,5 +47,9 @@
 #define AUREON_DIGITAL_SEL1	(1 << 15)
 #define AUREON_HP_SEL		(1 << 14)
 #define AUREON_WM_CS		(1 << 12)
+
+/* Prodigy has different pin assignment for chip select */
+#define PRODIGY_CS8415_CS	(1 << 23)
+#define PRODIGY_CS8415_CDTO	(1 << 22)
 
 #endif /* __SOUND_AUREON_H */
diff -Nru a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
--- a/sound/pci/ice1712/delta.c	Tue Jun 15 22:20:37 2004
+++ b/sound/pci/ice1712/delta.c	Tue Jun 15 22:20:37 2004
@@ -692,56 +692,64 @@
 /* entry point */
 struct snd_ice1712_card_info snd_ice1712_delta_cards[] __devinitdata = {
 	{
-		ICE1712_SUBDEVICE_DELTA1010,
-		"M Audio Delta 1010",
-		snd_ice1712_delta_init,
-		snd_ice1712_delta_add_controls,
-	},
-	{
-		ICE1712_SUBDEVICE_DELTADIO2496,
-		"M Audio Delta DiO 2496",
-		snd_ice1712_delta_init,
-		snd_ice1712_delta_add_controls,
-		1, /* NO MPU */
-	},
-	{
-		ICE1712_SUBDEVICE_DELTA66,
-		"M Audio Delta 66",
-		snd_ice1712_delta_init,
-		snd_ice1712_delta_add_controls,
-		1, /* NO MPU */
-	},
-	{
-		ICE1712_SUBDEVICE_DELTA44,
-		"M Audio Delta 44",
-		snd_ice1712_delta_init,
-		snd_ice1712_delta_add_controls,
-		1, /* NO MPU */
-	},
-	{
-		ICE1712_SUBDEVICE_AUDIOPHILE,
-		"M Audio Audiophile 24/96",
-		snd_ice1712_delta_init,
-		snd_ice1712_delta_add_controls,
-	},
-	{
-		ICE1712_SUBDEVICE_DELTA410,
-		"M Audio Delta 410",
-		snd_ice1712_delta_init,
-		snd_ice1712_delta_add_controls,
-	},
-	{
-		ICE1712_SUBDEVICE_DELTA1010LT,
-		"M Audio Delta 1010LT",
-		snd_ice1712_delta_init,
-		snd_ice1712_delta_add_controls,
-	},
-	{
-		ICE1712_SUBDEVICE_VX442,
-		"Digigram VX442",
-		snd_ice1712_delta_init,
-		snd_ice1712_delta_add_controls,
-		1, /* NO MPU */
+		.subvendor = ICE1712_SUBDEVICE_DELTA1010,
+		.name = "M Audio Delta 1010",
+		.model = "delta1010",
+		.chip_init = snd_ice1712_delta_init,
+		.build_controls = snd_ice1712_delta_add_controls,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_DELTADIO2496,
+		.name = "M Audio Delta DiO 2496",
+		.model = "dio2496",
+		.chip_init = snd_ice1712_delta_init,
+		.build_controls = snd_ice1712_delta_add_controls,
+		.no_mpu401 = 1,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_DELTA66,
+		.name = "M Audio Delta 66",
+		.model = "delta66",
+		.chip_init = snd_ice1712_delta_init,
+		.build_controls = snd_ice1712_delta_add_controls,
+		.no_mpu401 = 1,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_DELTA44,
+		.name = "M Audio Delta 44",
+		.model = "delta44",
+		.chip_init = snd_ice1712_delta_init,
+		.build_controls = snd_ice1712_delta_add_controls,
+		.no_mpu401 = 1,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_AUDIOPHILE,
+		.name = "M Audio Audiophile 24/96",
+		.model = "audiophile",
+		.chip_init = snd_ice1712_delta_init,
+		.build_controls = snd_ice1712_delta_add_controls,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_DELTA410,
+		.name = "M Audio Delta 410",
+		.model = "delta410",
+		.chip_init = snd_ice1712_delta_init,
+		.build_controls = snd_ice1712_delta_add_controls,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_DELTA1010LT,
+		.name = "M Audio Delta 1010LT",
+		.model = "delta1010lt",
+		.chip_init = snd_ice1712_delta_init,
+		.build_controls = snd_ice1712_delta_add_controls,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_VX442,
+		.name = "Digigram VX442",
+		.model = "vx442",
+		.chip_init = snd_ice1712_delta_init,
+		.build_controls = snd_ice1712_delta_add_controls,
+		.no_mpu401 = 1,
 	},
 	{ } /* terminator */
 };
diff -Nru a/sound/pci/ice1712/envy24ht.h b/sound/pci/ice1712/envy24ht.h
--- a/sound/pci/ice1712/envy24ht.h	Tue Jun 15 22:21:05 2004
+++ b/sound/pci/ice1712/envy24ht.h	Tue Jun 15 22:21:05 2004
@@ -209,4 +209,7 @@
 #define VT1724_MT_PDMA1_COUNT		0x76	/* word */
 
 
+unsigned char snd_vt1724_read_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr);
+void snd_vt1724_write_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr, unsigned char data);
+
 #endif /* __SOUND_VT1724_H */
diff -Nru a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c
--- a/sound/pci/ice1712/ews.c	Tue Jun 15 22:20:38 2004
+++ b/sound/pci/ice1712/ews.c	Tue Jun 15 22:20:38 2004
@@ -971,34 +971,39 @@
 /* entry point */
 struct snd_ice1712_card_info snd_ice1712_ews_cards[] __devinitdata = {
 	{
-		ICE1712_SUBDEVICE_EWX2496,
-		"TerraTec EWX24/96",
-		snd_ice1712_ews_init,
-		snd_ice1712_ews_add_controls,
+		.subvendor = ICE1712_SUBDEVICE_EWX2496,
+		.name = "TerraTec EWX24/96",
+		.model = "ewx2496",
+		.chip_init = snd_ice1712_ews_init,
+		.build_controls = snd_ice1712_ews_add_controls,
 	},
 	{
-		ICE1712_SUBDEVICE_EWS88MT,
-		"TerraTec EWS88MT",
-		snd_ice1712_ews_init,
-		snd_ice1712_ews_add_controls,
+		.subvendor = ICE1712_SUBDEVICE_EWS88MT,
+		.name = "TerraTec EWS88MT",
+		.model = "ews88mt",
+		.chip_init = snd_ice1712_ews_init,
+		.build_controls = snd_ice1712_ews_add_controls,
 	},
 	{
-		ICE1712_SUBDEVICE_EWS88MT_NEW,
-		"TerraTec EWS88MT",
-		snd_ice1712_ews_init,
-		snd_ice1712_ews_add_controls,
+		.subvendor = ICE1712_SUBDEVICE_EWS88MT_NEW,
+		.name = "TerraTec EWS88MT",
+		.model = "ews88mt_new",
+		.chip_init = snd_ice1712_ews_init,
+		.build_controls = snd_ice1712_ews_add_controls,
 	},
 	{
-		ICE1712_SUBDEVICE_EWS88D,
-		"TerraTec EWS88D",
-		snd_ice1712_ews_init,
-		snd_ice1712_ews_add_controls,
+		.subvendor = ICE1712_SUBDEVICE_EWS88D,
+		.name = "TerraTec EWS88D",
+		.model = "ews88d",
+		.chip_init = snd_ice1712_ews_init,
+		.build_controls = snd_ice1712_ews_add_controls,
 	},
 	{
-		ICE1712_SUBDEVICE_DMX6FIRE,
-		"TerraTec DMX6Fire",
-		snd_ice1712_ews_init,
-		snd_ice1712_ews_add_controls,
+		.subvendor = ICE1712_SUBDEVICE_DMX6FIRE,
+		.name = "TerraTec DMX6Fire",
+		.model = "dmx6fire",
+		.chip_init = snd_ice1712_ews_init,
+		.build_controls = snd_ice1712_ews_add_controls,
 	},
 	{ } /* terminator */
 };
diff -Nru a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c
--- a/sound/pci/ice1712/hoontech.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/ice1712/hoontech.c	Tue Jun 15 22:20:41 2004
@@ -83,6 +83,7 @@
 		ICE1712_STDSP24_2_CHN4(ice->hoontech_boxbits, 0);
 	ICE1712_STDSP24_2_MIDI1(ice->hoontech_boxbits, activate);
 	snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
+	snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[3]);
 
 	ICE1712_STDSP24_1_CHN1(ice->hoontech_boxbits, 1);
 	ICE1712_STDSP24_1_CHN2(ice->hoontech_boxbits, 1);
@@ -117,7 +118,7 @@
 	up(&ice->gpio_mutex);
 }
 
-static void __devinit snd_ice1712_stdsp24_box_midi(ice1712_t *ice, int box, int master, int slave)
+static void __devinit snd_ice1712_stdsp24_box_midi(ice1712_t *ice, int box, int master)
 {
 	down(&ice->gpio_mutex);
 
@@ -128,23 +129,26 @@
 	ICE1712_STDSP24_2_MIDIIN(ice->hoontech_boxbits, 1);
 	ICE1712_STDSP24_2_MIDI1(ice->hoontech_boxbits, master);
 	snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
+	snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[3]);
 
 	udelay(100);
 	
 	ICE1712_STDSP24_2_MIDIIN(ice->hoontech_boxbits, 0);
 	snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
 	
-	udelay(100);
+	mdelay(10);
 	
 	ICE1712_STDSP24_2_MIDIIN(ice->hoontech_boxbits, 1);
 	snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[2]);
 
-	udelay(100);
+	up(&ice->gpio_mutex);
+}
 
-	/* MIDI2 is direct */
-	ICE1712_STDSP24_3_MIDI2(ice->hoontech_boxbits, slave);
+static void __devinit snd_ice1712_stdsp24_midi2(ice1712_t *ice, int activate)
+{
+	down(&ice->gpio_mutex);
+	ICE1712_STDSP24_3_MIDI2(ice->hoontech_boxbits, activate);
 	snd_ice1712_stdsp24_gpio_write(ice, ice->hoontech_boxbits[3]);
-
 	up(&ice->gpio_mutex);
 }
 
@@ -204,25 +208,118 @@
 		for (chn = 0; chn < 4; chn++)
 			snd_ice1712_stdsp24_box_channel(ice, box, chn, (ice->hoontech_boxconfig[box] & (1 << chn)) ? 1 : 0);
 		snd_ice1712_stdsp24_box_midi(ice, box,
-				(ice->hoontech_boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0,
-				(ice->hoontech_boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2) ? 1 : 0);
+				(ice->hoontech_boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0);
+		if (ice->hoontech_boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2)
+			snd_ice1712_stdsp24_midi2(ice, 1);
 	}
 
 	return 0;
 }
 
+/*
+ * AK4524 access
+ */
+
+/* start callback for STDSP24 with modified hardware */
+static void stdsp24_ak4524_lock(akm4xxx_t *ak, int chip)
+{
+	ice1712_t *ice = ak->private_data[0];
+	unsigned char tmp;
+	snd_ice1712_save_gpio_status(ice);
+	tmp =	ICE1712_STDSP24_SERIAL_DATA |
+		ICE1712_STDSP24_SERIAL_CLOCK |
+		ICE1712_STDSP24_AK4524_CS;
+	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION,
+			  ice->gpio.direction | tmp);
+	snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp);
+}
+
+static int __devinit snd_ice1712_value_init(ice1712_t *ice)
+{
+	/* Hoontech STDSP24 with modified hardware */
+	static akm4xxx_t akm_stdsp24_mv __devinitdata = {
+		.num_adcs = 2,
+		.num_dacs = 2,
+		.type = SND_AK4524,
+		.ops = {
+			.lock = stdsp24_ak4524_lock
+		}
+	};
+
+	static struct snd_ak4xxx_private akm_stdsp24_mv_priv __devinitdata = {
+		.caddr = 2,
+		.cif = 1, /* CIF high */
+		.data_mask = ICE1712_STDSP24_SERIAL_DATA,
+		.clk_mask = ICE1712_STDSP24_SERIAL_CLOCK,
+		.cs_mask = ICE1712_STDSP24_AK4524_CS,
+		.cs_addr = ICE1712_STDSP24_AK4524_CS,
+		.cs_none = 0,
+		.add_flags = 0,
+	};
+
+	int err;
+	akm4xxx_t *ak;
+
+	/* set the analog DACs */
+	ice->num_total_dacs = 2;
+
+	/* set the analog ADCs */
+	ice->num_total_adcs = 2;
+	
+	/* analog section */
+	ak = ice->akm = kmalloc(sizeof(akm4xxx_t), GFP_KERNEL);
+	if (! ak)
+		return -ENOMEM;
+	ice->akm_codecs = 1;
+
+	err = snd_ice1712_akm4xxx_init(ak, &akm_stdsp24_mv, &akm_stdsp24_mv_priv, ice);
+	if (err < 0)
+		return err;
+
+	/* ak4524 controls */
+	err = snd_ice1712_akm4xxx_build_controls(ice);
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
+static int __devinit snd_ice1712_ez8_init(ice1712_t *ice)
+{
+	ice->gpio.write_mask = ice->eeprom.gpiomask;
+	ice->gpio.direction = ice->eeprom.gpiodir;
+	snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ice->eeprom.gpiomask);
+	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->eeprom.gpiodir);
+	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ice->eeprom.gpiostate);
+	return 0;
+}
+
 
 /* entry point */
 struct snd_ice1712_card_info snd_ice1712_hoontech_cards[] __devinitdata = {
 	{
-		ICE1712_SUBDEVICE_STDSP24,
-		"Hoontech SoundTrack Audio DSP24",
-		snd_ice1712_hoontech_init,
+		.subvendor = ICE1712_SUBDEVICE_STDSP24,
+		.name = "Hoontech SoundTrack Audio DSP24",
+		.model = "dsp24",
+		.chip_init = snd_ice1712_hoontech_init,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_STDSP24_VALUE,	/* a dummy id */
+		.name = "Hoontech SoundTrack Audio DSP24 Value",
+		.model = "dsp24_value",
+		.chip_init = snd_ice1712_value_init,
+	},
+	{
+		.subvendor = ICE1712_SUBDEVICE_STDSP24_MEDIA7_1,
+		.name = "Hoontech STA DSP24 Media 7.1",
+		.model = "dsp24_71",
+		.chip_init = snd_ice1712_hoontech_init,
 	},
 	{
-		ICE1712_SUBDEVICE_STDSP24_MEDIA7_1,
-		"Hoontech STA DSP24 Media 7.1",
-		snd_ice1712_hoontech_init,
+		.subvendor = ICE1712_SUBDEVICE_EVENT_EZ8,	/* a dummy id */
+		.name = "Event Electronics EZ8",
+		.model = "ez8",
+		.chip_init = snd_ice1712_ez8_init,
 	},
 	{ } /* terminator */
 };
diff -Nru a/sound/pci/ice1712/hoontech.h b/sound/pci/ice1712/hoontech.h
--- a/sound/pci/ice1712/hoontech.h	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/ice1712/hoontech.h	Tue Jun 15 22:20:42 2004
@@ -25,12 +25,15 @@
  */      
 
 #define  HOONTECH_DEVICE_DESC \
-	"{Hoontech SoundTrack DSP 24}," \
-	"{Hoontech SoundTrack DSP 24 Value}," \
-	"{Hoontech SoundTrack DSP 24 Media 7.1}," \
+	"{Hoontech,SoundTrack DSP 24}," \
+	"{Hoontech,SoundTrack DSP 24 Value}," \
+	"{Hoontech,SoundTrack DSP 24 Media 7.1}," \
+	"{Event Electronics,EZ8},"
 
 #define ICE1712_SUBDEVICE_STDSP24		0x12141217	/* Hoontech SoundTrack Audio DSP 24 */
+#define ICE1712_SUBDEVICE_STDSP24_VALUE		0x00010010	/* A dummy id for Hoontech SoundTrack Audio DSP 24 Value */
 #define ICE1712_SUBDEVICE_STDSP24_MEDIA7_1	0x16141217	/* Hoontech ST Audio DSP24 Media 7.1 */
+#define ICE1712_SUBDEVICE_EVENT_EZ8		0x00010001	/* A dummy id for EZ8 */
 
 extern struct snd_ice1712_card_info snd_ice1712_hoontech_cards[];
 
@@ -64,5 +67,11 @@
 #define ICE1712_STDSP24_BOX_CHN4	(1<<3)	/* input channel 4 */
 #define ICE1712_STDSP24_BOX_MIDI1	(1<<8)
 #define ICE1712_STDSP24_BOX_MIDI2	(1<<9)
+
+/* Hoontech SoundTrack Audio DSP 24 Value definitions for modified hardware */
+
+#define ICE1712_STDSP24_AK4524_CS	0x03	/* AK4524 chip select; low = active */
+#define ICE1712_STDSP24_SERIAL_DATA	0x0c	/* ak4524 data */
+#define ICE1712_STDSP24_SERIAL_CLOCK	0x30	/* ak4524 clock */
 
 #endif /* __SOUND_HOONTECH_H */
diff -Nru a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
--- a/sound/pci/ice1712/ice1712.c	Tue Jun 15 22:20:38 2004
+++ b/sound/pci/ice1712/ice1712.c	Tue Jun 15 22:20:38 2004
@@ -41,6 +41,9 @@
  *  2003.02.20  Taksahi Iwai <tiwai@suse.de>
  *	Split vt1724 part to an independent driver.
  *	The GPIO is accessed through the callback functions now.
+ *
+ * 2004.03.31 Doug McLain <nostar@comcast.net>
+ *    Added support for Event Electronics EZ8 card to hoontech.c.
  */
 
 
@@ -51,11 +54,11 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/cs8427.h>
 #include <sound/info.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <sound/asoundef.h>
@@ -81,24 +84,28 @@
 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_PNP;		/* Enable this card */
-static int omni[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0};	/* Delta44 & 66 Omni I/O support */
+static char *model[SNDRV_CARDS];
+static int omni[SNDRV_CARDS];	/* Delta44 & 66 Omni I/O support */
 static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transciever reset timeout value in msec */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ICE1712 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ICE1712 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable ICE1712 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(omni, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(omni, bool, boot_devs, 0444);
 MODULE_PARM_DESC(omni, "Enable Midiman M-Audio Delta Omni I/O support.");
 MODULE_PARM_SYNTAX(omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
-MODULE_PARM(cs8427_timeout, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(cs8427_timeout, int, boot_devs, 0444);
 MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec resolution.");
 MODULE_PARM_SYNTAX(cs8427_timeout, SNDRV_ENABLED ", allows:{{1,1000}},default=500,skill:advanced");
+module_param_array(model, charp, boot_devs, 0444);
+MODULE_PARM_DESC(model, "Use the given board model.");
 
 #ifndef PCI_VENDOR_ID_ICE
 #define PCI_VENDOR_ID_ICE		0x1412
@@ -1898,6 +1905,74 @@
 	.put = snd_ice1712_pro_internal_clock_put
 };
 
+static int snd_ice1712_pro_internal_clock_default_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+{
+	static char *texts[] = {
+		"8000",		/* 0: 6 */
+		"9600",		/* 1: 3 */
+		"11025",	/* 2: 10 */
+		"12000",	/* 3: 2 */
+		"16000",	/* 4: 5 */
+		"22050",	/* 5: 9 */
+		"24000",	/* 6: 1 */
+		"32000",	/* 7: 4 */
+		"44100",	/* 8: 8 */
+		"48000",	/* 9: 0 */
+		"64000",	/* 10: 15 */
+		"88200",	/* 11: 11 */
+		"96000",	/* 12: 7 */
+		// "IEC958 Input",	/* 13: -- */
+	};
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+	uinfo->count = 1;
+	uinfo->value.enumerated.items = 13;
+	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
+		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
+	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+	return 0;
+}
+
+static int snd_ice1712_pro_internal_clock_default_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+{
+	int val;
+	static unsigned int xrate[13] = {
+		8000, 9600, 11025, 12000, 1600, 22050, 24000,
+		32000, 44100, 48000, 64000, 88200, 96000
+	};
+
+	for (val = 0; val < 13; val++) {
+		if (xrate[val] == PRO_RATE_DEFAULT)
+			break;
+	}
+
+	ucontrol->value.enumerated.item[0] = val;
+	return 0;
+}
+
+static int snd_ice1712_pro_internal_clock_default_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+{
+	static unsigned int xrate[13] = {
+		8000, 9600, 11025, 12000, 1600, 22050, 24000,
+		32000, 44100, 48000, 64000, 88200, 96000
+	};
+	unsigned char oval;
+	int change = 0;
+
+	oval = PRO_RATE_DEFAULT;
+	PRO_RATE_DEFAULT = xrate[ucontrol->value.integer.value[0] % 13];
+	change = PRO_RATE_DEFAULT != oval;
+
+	return change;
+}
+
+static snd_kcontrol_new_t snd_ice1712_pro_internal_clock_default __devinitdata = {
+	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+	.name = "Multi Track Internal Clock Default",
+	.info = snd_ice1712_pro_internal_clock_default_info,
+	.get = snd_ice1712_pro_internal_clock_default_get,
+	.put = snd_ice1712_pro_internal_clock_default_put
+};
+
 static int snd_ice1712_pro_rate_locking_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
 {
 	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
@@ -2213,6 +2288,16 @@
  *
  */
 
+/*
+ * list of available boards
+ */
+static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
+	snd_ice1712_hoontech_cards,
+	snd_ice1712_delta_cards,
+	snd_ice1712_ews_cards,
+	0,
+};
+
 static unsigned char __devinit snd_ice1712_read_i2c(ice1712_t *ice,
 						 unsigned char dev,
 						 unsigned char addr)
@@ -2225,7 +2310,7 @@
 	return inb(ICEREG(ice, I2C_DATA));
 }
 
-static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice)
+static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice, const char *modelname)
 {
 	int dev = 0xa0;		/* EEPROM device address */
 	unsigned int i, size;
@@ -2234,10 +2319,23 @@
 		snd_printk("ICE1712 has not detected EEPROM\n");
 		return -EIO;
 	}
-	ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) |
-				(snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | 
-				(snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | 
-				(snd_ice1712_read_i2c(ice, dev, 0x03) << 24);
+	if (modelname && *modelname) {
+		struct snd_ice1712_card_info **tbl, *c;
+		for (tbl = card_tables; *tbl; tbl++) {
+			for (c = *tbl; c->subvendor; c++) {
+				if (c->model && !strcmp(modelname, c->model)) {
+					/* use the given subvendor */
+					printk(KERN_INFO "ice1712: Using board model %s\n", c->name);
+					ice->eeprom.subvendor = c->subvendor;
+					break;
+				}
+			}
+		}
+	} else
+		ice->eeprom.subvendor = (snd_ice1712_read_i2c(ice, dev, 0x00) << 0) |
+			(snd_ice1712_read_i2c(ice, dev, 0x01) << 8) | 
+			(snd_ice1712_read_i2c(ice, dev, 0x02) << 16) | 
+			(snd_ice1712_read_i2c(ice, dev, 0x03) << 24);
 	ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04);
 	if (ice->eeprom.size < 6)
 		ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */
@@ -2335,6 +2433,9 @@
 	err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock, ice));
 	if (err < 0)
 		return err;
+	err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_internal_clock_default, ice));
+	if (err < 0)
+		return err;
 
 	err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_pro_rate_locking, ice));
 	if (err < 0)
@@ -2407,6 +2508,7 @@
 
 static int __devinit snd_ice1712_create(snd_card_t * card,
 					struct pci_dev *pci,
+					const char *modelname,
 					int omni,
 					int cs8427_timeout,
 					ice1712_t ** r_ice1712)
@@ -2491,7 +2593,7 @@
 	
 	ice->irq = pci->irq;
 
-	if (snd_ice1712_read_eeprom(ice) < 0) {
+	if (snd_ice1712_read_eeprom(ice, modelname) < 0) {
 		snd_ice1712_free(ice);
 		return -EIO;
 	}
@@ -2526,14 +2628,6 @@
 
 static struct snd_ice1712_card_info no_matched __devinitdata;
 
-static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
-	snd_ice1712_hoontech_cards,
-	snd_ice1712_delta_cards,
-	snd_ice1712_ews_cards,
-	0,
-};
-
-
 static int __devinit snd_ice1712_probe(struct pci_dev *pci,
 				       const struct pci_device_id *pci_id)
 {
@@ -2557,7 +2651,7 @@
 	strcpy(card->driver, "ICE1712");
 	strcpy(card->shortname, "ICEnsemble ICE1712");
 	
-	if ((err = snd_ice1712_create(card, pci, omni[dev], cs8427_timeout[dev], &ice)) < 0) {
+	if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev], cs8427_timeout[dev], &ice)) < 0) {
 		snd_card_free(card);
 		return err;
 	}
@@ -2566,6 +2660,8 @@
 		for (c = *tbl; c->subvendor; c++) {
 			if (c->subvendor == ice->eeprom.subvendor) {
 				strcpy(card->shortname, c->name);
+				if (c->driver) /* specific driver? */
+					strcpy(card->driver, c->driver);
 				if (c->chip_init) {
 					if ((err = c->chip_init(ice)) < 0) {
 						snd_card_free(card);
@@ -2659,15 +2755,7 @@
 
 static int __init alsa_card_ice1712_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "ICE1712 soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_ice1712_exit(void)
@@ -2677,24 +2765,3 @@
 
 module_init(alsa_card_ice1712_init)
 module_exit(alsa_card_ice1712_exit)
-
-#ifndef MODULE
-
-/* format is: snd-ice1712=enable,index,id */
-
-static int __init alsa_card_ice1712_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-ice1712=", alsa_card_ice1712_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
--- a/sound/pci/ice1712/ice1712.h	Tue Jun 15 22:20:36 2004
+++ b/sound/pci/ice1712/ice1712.h	Tue Jun 15 22:20:36 2004
@@ -329,6 +329,10 @@
 	unsigned int pro_volumes[20];
 	unsigned int omni: 1;		/* Delta Omni I/O */
 	unsigned int vt1724: 1;
+	unsigned int vt1720: 1;
+	unsigned int has_spdif: 1;	/* VT1720/4 - has SPDIF I/O */
+	unsigned int force_pdma4: 1;	/* VT1720/4 - PDMA4 as non-spdif */
+	unsigned int force_rdma1: 1;	/* VT1720/4 - RDMA1 as non-spdif */
 	unsigned int num_total_dacs;	/* total DACs */
 	unsigned int num_total_adcs;	/* total ADCs */
 	unsigned char hoontech_boxbits[4];
@@ -460,6 +464,8 @@
 struct snd_ice1712_card_info {
 	unsigned int subvendor;
 	char *name;
+	char *model;
+	char *driver;
 	int (*chip_init)(ice1712_t *);
 	int (*build_controls)(ice1712_t *);
 	int no_mpu401: 1;
diff -Nru a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
--- a/sound/pci/ice1712/ice1724.c	Tue Jun 15 22:20:40 2004
+++ b/sound/pci/ice1712/ice1724.c	Tue Jun 15 22:20:40 2004
@@ -1,5 +1,6 @@
 /*
  *   ALSA driver for VT1724 ICEnsemble ICE1724 / VIA VT1724 (Envy24HT)
+ *                   VIA VT1720 (Envy24PT)
  *
  *	Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz>
  *                    2002 James Stafford <jstafford@ampltd.com>
@@ -28,10 +29,10 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <sound/asoundef.h>
@@ -43,35 +44,39 @@
 #include "amp.h"
 #include "revo.h"
 #include "aureon.h"
-#include "prodigy.h"
 
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
-MODULE_DESCRIPTION("ICEnsemble ICE1724 (Envy24HT)");
+MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)");
 MODULE_LICENSE("GPL");
 MODULE_CLASSES("{sound}");
 MODULE_DEVICES("{"
 	       REVO_DEVICE_DESC
 	       AMP_AUDIO2000_DEVICE_DESC
 	       AUREON_DEVICE_DESC
-	       PRODIGY_DEVICE_DESC
+		"{VIA,VT1720},"
 		"{VIA,VT1724},"
 		"{ICEnsemble,Generic ICE1724},"
-		"{ICEnsemble,Generic Envy24HT}}");
+		"{ICEnsemble,Generic Envy24HT}"
+		"{ICEnsemble,Generic Envy24PT}}");
 
 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_PNP;		/* Enable this card */
+static char *model[SNDRV_CARDS];
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for ICE1724 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for ICE1724 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable ICE1724 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
+module_param_array(model, charp, boot_devs, 0444);
+MODULE_PARM_DESC(model, "Use the given board model.");
 
 #ifndef PCI_VENDOR_ID_ICE
 #define PCI_VENDOR_ID_ICE		0x1412
@@ -80,6 +85,7 @@
 #define PCI_DEVICE_ID_VT1724		0x1724
 #endif
 
+/* Both VT1720 and VT1724 have the same PCI IDs */
 static struct pci_device_id snd_vt1724_ids[] = {
 	{ PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_VT1724, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ 0, }
@@ -228,6 +234,17 @@
 			status &= ~(VT1724_IRQ_MPU_RX|VT1724_IRQ_MPU_TX);
 		}
 		if (status & VT1724_IRQ_MTPCM) {
+			/*
+			 * Multi-track PCM
+			 * PCM assignment are:
+			 * Playback DMA0 (M/C) = playback_pro_substream
+			 * Playback DMA1 = playback_con_substream_ds[0]
+			 * Playback DMA2 = playback_con_substream_ds[1]
+			 * Playback DMA3 = playback_con_substream_ds[2]
+			 * Playback DMA4 (SPDIF) = playback_con_substream
+			 * Record DMA0 = capture_pro_substream
+			 * Record DMA1 = capture_con_substream
+			 */
 			unsigned char mtstat = inb(ICEMT1724(ice, IRQ));
 			if (mtstat & VT1724_MULTI_PDMA0) {
 				if (ice->playback_pro_substream)
@@ -288,6 +305,12 @@
 	.mask = 0,
 };
 
+static snd_pcm_hw_constraint_list_t hw_constraints_rates_48 = {
+	.count = ARRAY_SIZE(rates) - 5, /* up to 48000 */
+	.list = rates,
+	.mask = 0,
+};
+
 static snd_pcm_hw_constraint_list_t hw_constraints_rates_192 = {
 	.count = ARRAY_SIZE(rates),
 	.list = rates,
@@ -423,6 +446,15 @@
 		if (ice->akm[i].ops.set_rate_val)
 			ice->akm[i].ops.set_rate_val(&ice->akm[i], rate);
 	}
+
+	/* set up AC97 registers if needed */
+	if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & 0x80) && ice->ac97) {
+		snd_ac97_set_rate(ice->ac97, AC97_PCM_FRONT_DAC_RATE, rate);
+		snd_ac97_set_rate(ice->ac97, AC97_PCM_SURR_DAC_RATE, rate);
+		snd_ac97_set_rate(ice->ac97, AC97_PCM_LFE_DAC_RATE, rate);
+		snd_ac97_set_rate(ice->ac97, AC97_SPDIF, rate);
+		snd_ac97_set_rate(ice->ac97, AC97_PCM_LR_ADC_RATE, rate);
+	}
 }
 
 static int snd_vt1724_pcm_hw_params(snd_pcm_substream_t * substream,
@@ -435,6 +467,7 @@
 	down(&ice->open_mutex);
 	/* mark surround channels */
 	if (substream == ice->playback_pro_substream) {
+		/* PDMA0 can be multi-channel up to 8 */
 		chs = chs / 2 - 1;
 		for (i = 0; i < chs; i++) {
 			if (ice->pcm_reserved[i] && ice->pcm_reserved[i] != substream) {
@@ -449,6 +482,7 @@
 		}
 	} else {
 		for (i = 0; i < 3; i++) {
+			/* check individual playback stream */
 			if (ice->playback_con_substream_ds[i] == substream) {
 				if (ice->pcm_reserved[i] && ice->pcm_reserved[i] != substream) {
 					up(&ice->open_mutex);
@@ -609,7 +643,7 @@
 				 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_SYNC_START),
 	.formats =		SNDRV_PCM_FMTBIT_S32_LE,
 	.rates =		SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_192000,
-	.rate_min =		4000,
+	.rate_min =		8000,
 	.rate_max =		192000,
 	.channels_min =		2,
 	.channels_max =		8,
@@ -620,6 +654,25 @@
 	.periods_max =		1024,
 };
 
+static snd_pcm_hardware_t snd_vt1724_spdif =
+{
+	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
+				 SNDRV_PCM_INFO_BLOCK_TRANSFER |
+				 SNDRV_PCM_INFO_MMAP_VALID |
+				 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_SYNC_START),
+	.formats =		SNDRV_PCM_FMTBIT_S32_LE,
+	.rates =	        SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
+	.rate_min =		32000,
+	.rate_max =		48000,
+	.channels_min =		2,
+	.channels_max =		2,
+	.buffer_bytes_max =	(1UL << 18),	/* 16bits dword */
+	.period_bytes_min =	2 * 4 * 2,
+	.period_bytes_max =	(1UL << 18),
+	.periods_min =		2,
+	.periods_max =		1024,
+};
+
 static snd_pcm_hardware_t snd_vt1724_2ch_stereo =
 {
 	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
@@ -628,7 +681,7 @@
 				 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_SYNC_START),
 	.formats =		SNDRV_PCM_FMTBIT_S32_LE,
 	.rates =		SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_192000,
-	.rate_min =		4000,
+	.rate_min =		8000,
 	.rate_max =		192000,
 	.channels_min =		2,
 	.channels_max =		2,
@@ -639,6 +692,41 @@
 	.periods_max =		1024,
 };
 
+/*
+ * set rate constraints
+ */
+static int set_rate_constraints(ice1712_t *ice, snd_pcm_substream_t *substream)
+{
+	snd_pcm_runtime_t *runtime = substream->runtime;
+	if (ice->eeprom.data[ICE_EEP2_ACLINK] & 0x80) {
+		/* I2S */
+		if (ice->eeprom.data[ICE_EEP2_I2S] & 0x08)
+			return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192);
+		else {
+			runtime->hw.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_96000;
+			runtime->hw.rate_max = 96000;
+			return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_96);
+		}
+	} else if (ice->ac97) {
+		/* ACLINK */
+		int ratec;
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+			ratec = AC97_RATES_FRONT_DAC;
+		else
+			ratec = AC97_RATES_ADC;
+		runtime->hw.rates = ice->ac97->rates[ratec];
+		runtime->hw.rate_max = 48000;
+		if (runtime->hw.rates == SNDRV_PCM_RATE_48000) {
+			runtime->hw.rate_min = 48000;
+			return 0;
+		} else {
+			runtime->hw.rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000;
+			return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_48);
+		}
+	}
+	return 0;
+}
+
 /* multi-channel playback needs alignment 8x32bit regarless of the channels
  * actually used
  */
@@ -655,12 +743,7 @@
 	runtime->hw = snd_vt1724_playback_pro;
 	snd_pcm_set_sync(substream);
 	snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
-	if ((ice->eeprom.data[ICE_EEP2_ACLINK] & 0x80) &&
-	    (ice->eeprom.data[ICE_EEP2_I2S] & 0x08))
-		snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192);
-	else
-		snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_96);
-
+	set_rate_constraints(ice, substream);
 	down(&ice->open_mutex);
 	/* calculate the currently available channels */
 	for (chs = 0; chs < 3; chs++) {
@@ -689,11 +772,7 @@
 	runtime->hw = snd_vt1724_2ch_stereo;
 	snd_pcm_set_sync(substream);
 	snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
-	if ((ice->eeprom.data[ICE_EEP2_ACLINK] & 0x80) &&
-	    (ice->eeprom.data[ICE_EEP2_I2S] & 0x08))
-		snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192);
-	else
-		snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_96);
+	set_rate_constraints(ice, substream);
 	return 0;
 }
 
@@ -812,11 +891,13 @@
 
 	runtime->private_data = (void*)VT1724_PDMA4_START; /* irq/status/trigger bit */
 	ice->playback_con_substream = substream;
-	runtime->hw = snd_vt1724_2ch_stereo;
+	if (ice->force_pdma4) {
+		runtime->hw = snd_vt1724_2ch_stereo;
+		set_rate_constraints(ice, substream);
+	} else
+		runtime->hw = snd_vt1724_spdif;
 	snd_pcm_set_sync(substream);
 	snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
-
-	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192);
 	return 0;
 }
 
@@ -838,10 +919,13 @@
 
 	runtime->private_data = (void*)VT1724_RDMA1_START; /* irq/status/trigger bit */
 	ice->capture_con_substream = substream;
-	runtime->hw = snd_vt1724_2ch_stereo;
+	if (ice->force_rdma1) {
+		runtime->hw = snd_vt1724_2ch_stereo;
+		set_rate_constraints(ice, substream);
+	} else
+		runtime->hw = snd_vt1724_spdif;
 	snd_pcm_set_sync(substream);
 	snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
-	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_96);
 	return 0;
 }
 
@@ -881,22 +965,31 @@
 
 static int __devinit snd_vt1724_pcm_spdif(ice1712_t * ice, int device)
 {
+	char *name;
 	snd_pcm_t *pcm;
 	int play, capt;
 	int err;
 
-	if (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_OUT_INT)
+	if (ice->force_pdma4 ||
+	    (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_OUT_INT)) {
 		play = 1;
-	else
+		ice->has_spdif = 1;
+	} else
 		play = 0;
-	if (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_IN)
+	if (ice->force_rdma1 ||
+	    (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_IN)) {
 		capt = 1;
-	else
+		ice->has_spdif = 1;
+	} else
 		capt = 0;
 	if (! play && ! capt)
 		return 0; /* no spdif device */
 
-	err = snd_pcm_new(ice->card, "ICE1724 IEC958", device, play, capt, &pcm);
+	if (ice->force_pdma4 || ice->force_rdma1)
+		name = "ICE1724 Secondary";
+	else
+		name = "IEC1724 IEC958";
+	err = snd_pcm_new(ice->card, name, device, play, capt, &pcm);
 	if (err < 0)
 		return err;
 
@@ -909,7 +1002,7 @@
 
 	pcm->private_data = ice;
 	pcm->info_flags = 0;
-	strcpy(pcm->name, "ICE1724 IEC958");
+	strcpy(pcm->name, name);
 
 	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
 					      snd_dma_pci_data(ice->pci), 64*1024, 64*1024);
@@ -983,8 +1076,7 @@
 	runtime->hw = snd_vt1724_2ch_stereo;
 	snd_pcm_set_sync(substream);
 	snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24);
-
-	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192);
+	set_rate_constraints(ice, substream);
 	return 0;
 }
 
@@ -1723,7 +1815,6 @@
 	snd_vt1724_revo_cards,
 	snd_vt1724_amp_cards, 
 	snd_vt1724_aureon_cards,
-	snd_vt1724_prodigy_cards,
 	0,
 };
 
@@ -1731,9 +1822,7 @@
 /*
  */
 
-static unsigned char __devinit snd_vt1724_read_i2c(ice1712_t *ice,
-						 unsigned char dev,
-						 unsigned char addr)
+unsigned char snd_vt1724_read_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr)
 {
 	long t = 0x10000;
 
@@ -1743,49 +1832,71 @@
 	return inb(ICEREG1724(ice, I2C_DATA));
 }
 
-static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice)
+void snd_vt1724_write_i2c(ice1712_t *ice, unsigned char dev, unsigned char addr, unsigned char data)
 {
-	int dev = 0xa0;		/* EEPROM device address */
+	long t = 0x10000;
+
+	outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
+	outb(data, ICEREG1724(ice, I2C_DATA));
+	outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR));
+	while (t-- > 0 && (inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY)) ;
+}
+
+static int __devinit snd_vt1724_read_eeprom(ice1712_t *ice, const char *modelname)
+{
+	const int dev = 0xa0;		/* EEPROM device address */
 	unsigned int i, size;
 	struct snd_ice1712_card_info **tbl, *c;
 
-	if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) {
-		snd_printk(KERN_WARNING "ICE1724 has not detected EEPROM\n");
-		// return -EIO;
-	}
-	ice->eeprom.subvendor = (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) |
+	if (! modelname || ! *modelname) {
+		ice->eeprom.subvendor = 0;
+		if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) != 0)
+			ice->eeprom.subvendor = (snd_vt1724_read_i2c(ice, dev, 0x00) << 0) |
 				(snd_vt1724_read_i2c(ice, dev, 0x01) << 8) | 
 				(snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | 
 				(snd_vt1724_read_i2c(ice, dev, 0x03) << 24);
-
-	/* if the EEPROM is given by the driver, use it */
+		if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) {
+			/* invalid subvendor from EEPROM, try the PCI subststem ID instead */
+			u16 vendor, device;
+			pci_read_config_word(ice->pci, PCI_SUBSYSTEM_VENDOR_ID, &vendor);
+			pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device);
+			ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device);
+			if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) {
+				printk(KERN_ERR "ice1724: No valid ID is found\n");
+				return -ENXIO;
+			}
+		}
+	}
 	for (tbl = card_tables; *tbl; tbl++) {
 		for (c = *tbl; c->subvendor; c++) {
-			if (c->subvendor == ice->eeprom.subvendor) {
-				if (! c->eeprom_size || ! c->eeprom_data)
-					goto found;
-				snd_printdd("using the defined eeprom..\n");
-				ice->eeprom.version = 2;
-				ice->eeprom.size = c->eeprom_size + 6;
-				memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
-				goto read_skipped;
-			}
+			if (modelname && c->model && ! strcmp(modelname, c->model)) {
+				printk(KERN_INFO "ice1724: Using board model %s\n", c->name);
+				ice->eeprom.subvendor = c->subvendor;
+			} else if (c->subvendor != ice->eeprom.subvendor)
+				continue;
+			if (! c->eeprom_size || ! c->eeprom_data)
+				goto found;
+			/* if the EEPROM is given by the driver, use it */
+			snd_printdd("using the defined eeprom..\n");
+			ice->eeprom.version = 2;
+			ice->eeprom.size = c->eeprom_size + 6;
+			memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
+			goto read_skipped;
 		}
 	}
+	printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n", ice->eeprom.subvendor);
 
  found:
 	ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04);
 	if (ice->eeprom.size < 6)
 		ice->eeprom.size = 32;
 	else if (ice->eeprom.size > 32) {
-		snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size);
+		printk(KERN_ERR "ice1724: Invalid EEPROM (size = %i)\n", ice->eeprom.size);
 		return -EIO;
 	}
 	ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05);
-	if (ice->eeprom.version != 2) {
-		snd_printk("invalid EEPROM version %i\n", ice->eeprom.version);
-		// return -EIO;
-	}
+	if (ice->eeprom.version != 2)
+		printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", ice->eeprom.version);
 	size = ice->eeprom.size - 6;
 	for (i = 0; i < size; i++)
 		ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6);
@@ -1819,6 +1930,9 @@
 
 	outb(0, ICEREG1724(ice, POWERDOWN));
 
+	/* read back to check the availability of SPDIF out */
+	ice->eeprom.data[ICE_EEP2_SPDIF] = inb(ICEREG1724(ice, SPDIF_CFG));
+
 	return 0;
 }
 
@@ -1880,7 +1994,10 @@
 
 	if (ice->num_total_dacs > 0) {
 		snd_kcontrol_new_t tmp = snd_vt1724_mixer_pro_analog_route;
-		tmp.count = ice->num_total_dacs;
+		if (ice->vt1720)
+			tmp.count = 2;
+		else
+			tmp.count = ice->num_total_dacs;
 		err = snd_ctl_add(ice->card, snd_ctl_new1(&tmp, ice));
 		if (err < 0)
 			return err;
@@ -1927,6 +2044,7 @@
 
 static int __devinit snd_vt1724_create(snd_card_t * card,
 				       struct pci_dev *pci,
+				       const char *modelname,
 				       ice1712_t ** r_ice1712)
 {
 	ice1712_t *ice;
@@ -1982,7 +2100,7 @@
 
 	ice->irq = pci->irq;
 
-	if (snd_vt1724_read_eeprom(ice) < 0) {
+	if (snd_vt1724_read_eeprom(ice, modelname) < 0) {
 		snd_vt1724_free(ice);
 		return -EIO;
 	}
@@ -2041,7 +2159,7 @@
 	strcpy(card->driver, "ICE1724");
 	strcpy(card->shortname, "ICEnsemble ICE1724");
 	
-	if ((err = snd_vt1724_create(card, pci, &ice)) < 0) {
+	if ((err = snd_vt1724_create(card, pci, model[dev], &ice)) < 0) {
 		snd_card_free(card);
 		return err;
 	}
@@ -2050,6 +2168,8 @@
 		for (c = *tbl; c->subvendor; c++) {
 			if (c->subvendor == ice->eeprom.subvendor) {
 				strcpy(card->shortname, c->name);
+				if (c->driver) /* specific driver? */
+					strcpy(card->driver, c->driver);
 				if (c->chip_init) {
 					if ((err = c->chip_init(ice)) < 0) {
 						snd_card_free(card);
@@ -2088,7 +2208,7 @@
 		return err;
 	}
 
-	if (ice->pcm) { /* has SPDIF I/O */
+	if (ice->pcm && ice->has_spdif) { /* has SPDIF I/O */
 		if ((err = snd_vt1724_spdif_build_controls(ice)) < 0) {
 			snd_card_free(card);
 			return err;
@@ -2141,15 +2261,7 @@
 
 static int __init alsa_card_ice1724_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "ICE1724 soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_ice1724_exit(void)
@@ -2159,24 +2271,3 @@
 
 module_init(alsa_card_ice1724_init)
 module_exit(alsa_card_ice1724_exit)
-
-#ifndef MODULE
-
-/* format is: snd-ice1724=enable,index,id */
-
-static int __init alsa_card_ice1724_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-ice1724=", alsa_card_ice1724_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/ice1712/prodigy.c b/sound/pci/ice1712/prodigy.c
--- a/sound/pci/ice1712/prodigy.c	Tue Jun 15 22:21:02 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,663 +0,0 @@
-/*
- *   ALSA driver for ICEnsemble VT1724 (Envy24HT)
- *
- *   Lowlevel functions for AudioTrak Prodigy 7.1 (and possibly 192) cards
- *      Copyright (c) 2003 Dimitromanolakis Apostolos <apostol@cs.utoronto.ca>
- *	based on the aureon.c code (c) 2003 by Takashi Iwai <tiwai@suse.de>
- *
- *   version 0.82: Stable / not all features work yet (no communication with AC97 secondary)
- *       added 64x/128x oversampling switch (should be 64x only for 96khz)
- *       fixed some recording labels (still need to check the rest)
- *       recording is working probably thanks to correct wm8770 initialization
- *
- *   version 0.5: Initial release:
- *           working: analog output, mixer, headphone amplifier switch
- *       not working: prety much everything else, at least i could verify that
- *                    we have no digital output, no capture, pretty bad clicks and poops
- *                    on mixer switch and other coll stuff.
- *
- *   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
- *
- *
- * NOTES:
- *
- *
- *
- * - we reuse the akm4xxx_t record for storing the wm8770 codec data.
- *   both wm and akm codecs are pretty similar, so we can integrate
- *   both controls in the future, once if wm codecs are reused in
- *   many boards.
- *
- * - writing over SPI is implemented but reading is not yet.
- *   the SPDIF-in channel status, etc. can be read from CS chip.
- *
- * - DAC digital volumes are not implemented in the mixer.
- *   if they show better response than DAC analog volumes, we can use them
- *   instead.
- *
- * - Prodigy boards are equipped with AC97 STAC9744 chip , too.  it's used to do
- *   the analog mixing but not easily controllable (it's not connected
- *   directly from envy24ht chip).  so let's leave it as it is.
- *
- */
-
-#define REVISION 0.82b
-
-#include <sound/driver.h>
-#include <asm/io.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <sound/core.h>
-
-#include "ice1712.h"
-#include "envy24ht.h"
-#include "prodigy.h"
-
-
-static int prodigy_set_headphone_amp(ice1712_t *ice, int enable)
-{
-	unsigned int tmp, tmp2;
-
-	tmp2 = tmp = snd_ice1712_gpio_read(ice);
-	if (enable)
-		tmp |= PRODIGY_HP_AMP_EN;
-	else
-		tmp &= ~ PRODIGY_HP_AMP_EN;
-	if (tmp != tmp2) {
-		snd_ice1712_gpio_write(ice, tmp);
-		return 1;
-	}
-	return 0;
-}
-
-
-static int prodigy_get_headphone_amp(ice1712_t *ice)
-{
-	unsigned int tmp = snd_ice1712_gpio_read(ice);
-
-	return ( tmp & PRODIGY_HP_AMP_EN )!= 0;
-}
-
-
-/*
- * write data in the SPI mode
- */
-static void prodigy_spi_write(ice1712_t *ice, unsigned int cs, unsigned int data, int bits)
-{
-	unsigned int tmp;
-	int i;
-
-	tmp = snd_ice1712_gpio_read(ice);
-
-	snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_WM_RW|PRODIGY_WM_DATA|PRODIGY_WM_CLK|
-					 PRODIGY_WM_CS|PRODIGY_CS8415_CS|PRODIGY_HP_AMP_EN));
-	tmp |= PRODIGY_WM_RW;
-	tmp &= ~cs;
-	snd_ice1712_gpio_write(ice, tmp);
-	udelay(1);
-
-	for (i = bits - 1; i >= 0; i--) {
-		tmp &= ~PRODIGY_WM_CLK;
-		snd_ice1712_gpio_write(ice, tmp);
-		udelay(1);
-		if (data & (1 << i))
-			tmp |= PRODIGY_WM_DATA;
-		else
-			tmp &= ~PRODIGY_WM_DATA;
-		snd_ice1712_gpio_write(ice, tmp);
-		udelay(1);
-		tmp |= PRODIGY_WM_CLK;
-		snd_ice1712_gpio_write(ice, tmp);
-		udelay(1);
-	}
-
-	tmp &= ~PRODIGY_WM_CLK;
-	tmp |= cs;
-	snd_ice1712_gpio_write(ice, tmp);
-	udelay(1);
-	tmp |= PRODIGY_WM_CLK;
-	snd_ice1712_gpio_write(ice, tmp);
-	udelay(1);
-}
-
-
-/*
- * get the current register value of WM codec
- */
-static unsigned short wm_get(ice1712_t *ice, int reg)
-{
-	reg <<= 1;
-	return ((unsigned short)ice->akm[0].images[reg] << 8) |
-		ice->akm[0].images[reg + 1];
-}
-
-/*
- * set the register value of WM codec and remember it
- */
-static void wm_put(ice1712_t *ice, int reg, unsigned short val)
-{
-	prodigy_spi_write(ice, PRODIGY_WM_CS, (reg << 9) | (val & 0x1ff), 16);
-	reg <<= 1;
-	ice->akm[0].images[reg] = val >> 8;
-	ice->akm[0].images[reg + 1] = val;
-}
-
-
-/*********************************
- ********* Controls section ******
- *********************************/
-
-#define PRODIGY_CON_HPAMP \
-        {                                            \
-                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,      \
-                .name =  "Headphone Amplifier", \
-                .info =  prodigy_hpamp_info,         \
-                .get =   prodigy_hpamp_get, \
-                .put =   prodigy_hpamp_put  \
-        }
-
-static int prodigy_hpamp_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
-{
-	static char *texts[2] = {
-		"Off", "On"
-	};
-
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-	uinfo->count = 1;
-	uinfo->value.enumerated.items = 2;
-
-	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
-		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
-	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
-
-        return 0;
-}
-
-
-static int prodigy_hpamp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-
-	ucontrol->value.integer.value[0] = prodigy_get_headphone_amp(ice);
-	return 0;
-}
-
-
-static int prodigy_hpamp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-
-	return prodigy_set_headphone_amp(ice,ucontrol->value.integer.value[0]);
-}
-
-
-
-#define PRODIGY_CON_DEEMP \
-        {                                            \
-                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,      \
-                .name =  "DAC De-emphasis", \
-                .info =  prodigy_deemp_info,         \
-                .get =   prodigy_deemp_get, \
-                .put =   prodigy_deemp_put  \
-        }
-
-static int prodigy_deemp_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
-{
-	static char *texts[2] = { "Off", "On" };
-
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-	uinfo->count = 1;
-	uinfo->value.enumerated.items = 2;
-
-	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
-		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
-	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
-
-        return 0;
-}
-
-static int prodigy_deemp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	ucontrol->value.integer.value[0] = (wm_get(ice, 0x15) & 0xf) == 0xf;
-	return 0;
-}
-
-static int prodigy_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	int temp, temp2;
-	temp2 = temp = wm_get(ice, 0x15);
-	temp = (temp & ~0xf) | ((ucontrol->value.integer.value[0])*0xf);
-	if (temp != temp2) {
-		wm_put(ice,0x15,temp);
-		return 1;
-	}
-	return 0;
-}
-
-
-#define PRODIGY_CON_OVERSAMPLING \
-        {                                            \
-                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,      \
-                .name =  "ADC Oversampling", \
-                .info =  prodigy_oversampling_info,         \
-                .get =   prodigy_oversampling_get, \
-                .put =   prodigy_oversampling_put  \
-        }
-
-static int prodigy_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
-{
-	static char *texts[2] = { "128x", "64x"	};
-
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-	uinfo->count = 1;
-	uinfo->value.enumerated.items = 2;
-
-	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
-		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
-	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
-
-        return 0;
-}
-
-static int prodigy_oversampling_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	ucontrol->value.integer.value[0] = (wm_get(ice, 0x17) & 0x8) == 0x8;
-	return 0;
-}
-
-static int prodigy_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	int temp, temp2;
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-
-	temp2 = temp = wm_get(ice, 0x17);
-
-	if( ucontrol->value.integer.value[0] ) {
-		temp |= 0x8;
-	} else {
-		temp &= ~0x8;
-	}
-
-	if (temp != temp2) {
-		wm_put(ice,0x17,temp);
-		return 1;
-	}
-	return 0;
-}
-
-
-
-
-/*
- * DAC volume attenuation mixer control
- */
-static int wm_dac_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
-{
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-	uinfo->count = 1;
-	uinfo->value.integer.min = 0;		/* mute */
-	uinfo->value.integer.max = 101;		/* 0dB */
-	return 0;
-}
-
-static int wm_dac_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	int idx;
-	unsigned short vol;
-
-	down(&ice->gpio_mutex);
-	if (kcontrol->private_value)
-		idx = WM_DAC_MASTER_ATTEN;
-	else
-		idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_DAC_ATTEN;
-	vol = wm_get(ice, idx) & 0x7f;
-	if (vol <= 0x1a)
-		ucontrol->value.integer.value[0] = 0;
-	else
-		ucontrol->value.integer.value[0] = vol - 0x1a;
-	up(&ice->gpio_mutex);
-
-	return 0;
-}
-
-static int wm_dac_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	int idx;
-	unsigned short ovol, nvol;
-	int change;
-
-	snd_ice1712_save_gpio_status(ice);
-	if (kcontrol->private_value)
-		idx = WM_DAC_MASTER_ATTEN;
-	else
-		idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_DAC_ATTEN;
-	nvol = ucontrol->value.integer.value[0] + 0x1a;
-	ovol = wm_get(ice, idx) & 0x7f;
-	change = (ovol != nvol);
-	if (change) {
-		if (nvol <= 0x1a && ovol <= 0x1a)
-			change = 0;
-		else
-			wm_put(ice, idx, nvol | 0x180); /* update on zero detect */
-	}
-	snd_ice1712_restore_gpio_status(ice);
-	return change;
-}
-
-/*
- * ADC gain mixer control
- */
-static int wm_adc_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
-{
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
-	uinfo->count = 1;
-	uinfo->value.integer.min = 0;		/* -12dB */
-	uinfo->value.integer.max = 0x1f;	/* 19dB */
-	return 0;
-}
-
-static int wm_adc_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	int idx;
-	unsigned short vol;
-
-	down(&ice->gpio_mutex);
-	idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_ADC_GAIN;
-	vol = wm_get(ice, idx) & 0x1f;
-	ucontrol->value.integer.value[0] = vol;
-	up(&ice->gpio_mutex);
-	return 0;
-}
-
-static int wm_adc_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	int idx;
-	unsigned short ovol, nvol;
-	int change;
-
-	snd_ice1712_save_gpio_status(ice);
-	idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_ADC_GAIN;
-	nvol = ucontrol->value.integer.value[0];
-	ovol = wm_get(ice, idx) & 0x1f;
-	change = (ovol != nvol);
-	if (change)
-		wm_put(ice, idx, nvol);
-	snd_ice1712_restore_gpio_status(ice);
-	return change;
-}
-
-/*
- * ADC input mux mixer control
- */
-static int wm_adc_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
-{
-	static char *texts[] = {
-		"CD Left",
-		"CD Right",
-		"Line Left",
-		"Line Right",
-		"Aux Left",
-		"Aux Right",
-		"Mic Left",
-		"Mic Right",
-	};
-	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
-	uinfo->count = 2;
-	uinfo->value.enumerated.items = 8;
-	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
-		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
-	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
-	return 0;
-}
-
-static int wm_adc_mux_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	unsigned short val;
-
-	down(&ice->gpio_mutex);
-	val = wm_get(ice, WM_ADC_MUX);
-	ucontrol->value.integer.value[0] = val & 7;
-	ucontrol->value.integer.value[1] = (val >> 4) & 7;
-	up(&ice->gpio_mutex);
-	return 0;
-}
-
-static int wm_adc_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol)
-{
-	ice1712_t *ice = snd_kcontrol_chip(kcontrol);
-	unsigned short oval, nval;
-	int change;
-
-	snd_ice1712_save_gpio_status(ice);
-	oval = wm_get(ice, WM_ADC_MUX);
-	nval = oval & ~0x77;
-	nval |= ucontrol->value.integer.value[0] & 7;
-	nval |= (ucontrol->value.integer.value[1] & 7) << 4;
-	change = (oval != nval);
-	if (change)
-		wm_put(ice, WM_ADC_MUX, nval);
-	snd_ice1712_restore_gpio_status(ice);
-	return 0;
-}
-
-/*
- * mixers
- */
-
-static snd_kcontrol_new_t prodigy71_dac_control __devinitdata = {
-	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-	.name = "DAC Volume",
-	.count = 8,
-	.info = wm_dac_vol_info,
-	.get = wm_dac_vol_get,
-	.put = wm_dac_vol_put,
-};
-
-static snd_kcontrol_new_t wm_controls[] __devinitdata = {
-	{
-		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name = "Master Playback Volume",
-		.info = wm_dac_vol_info,
-		.get = wm_dac_vol_get,
-		.put = wm_dac_vol_put,
-		.private_value = 1,
-	},
-	{
-		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name = "ADC Volume",
-		.count = 2,
-		.info = wm_adc_vol_info,
-		.get = wm_adc_vol_get,
-		.put = wm_adc_vol_put,
-	},
-	{
-		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
-		.name = "Capture Route",
-		.info = wm_adc_mux_info,
-		.get = wm_adc_mux_get,
-		.put = wm_adc_mux_put,
-	},
-	PRODIGY_CON_HPAMP ,
-	PRODIGY_CON_DEEMP ,
-	PRODIGY_CON_OVERSAMPLING
-};
-
-
-static int __devinit prodigy_add_controls(ice1712_t *ice)
-{
-	unsigned int i;
-	int err;
-
-	err = snd_ctl_add(ice->card, snd_ctl_new1(&prodigy71_dac_control, ice));
-	if (err < 0)
-		return err;
-
-	for (i = 0; i < ARRAY_SIZE(wm_controls); i++) {
-		err = snd_ctl_add(ice->card, snd_ctl_new1(&wm_controls[i], ice));
-		if (err < 0)
-			return err;
-	}
-	return 0;
-}
-
-
-/*
- * initialize the chip
- */
-static int __devinit prodigy_init(ice1712_t *ice)
-{
-	static unsigned short wm_inits[] = {
-
-		/* These come first to reduce init pop noise */
-		0x1b, 0x000,		/* ADC Mux */
-		0x1c, 0x009,		/* Out Mux1 */
-		0x1d, 0x009,		/* Out Mux2 */
-
-		0x18, 0x000,		/* All power-up */
-
-		0x16, 0x022,		/* I2S, normal polarity, 24bit, high-pass on */
-		0x17, 0x006,		/* 128fs, slave mode */
-
-		0x00, 0,		/* DAC1 analog mute */
-		0x01, 0,		/* DAC2 analog mute */
-		0x02, 0,		/* DAC3 analog mute */
-		0x03, 0,		/* DAC4 analog mute */
-		0x04, 0,		/* DAC5 analog mute */
-		0x05, 0,		/* DAC6 analog mute */
-		0x06, 0,		/* DAC7 analog mute */
-		0x07, 0,		/* DAC8 analog mute */
-		0x08, 0x100,		/* master analog mute */
-
-		0x09, 0x7f,		/* DAC1 digital full */
-		0x0a, 0x7f,		/* DAC2 digital full */
-		0x0b, 0x7f,		/* DAC3 digital full */
-		0x0c, 0x7f,		/* DAC4 digital full */
-		0x0d, 0x7f,		/* DAC5 digital full */
-		0x0e, 0x7f,		/* DAC6 digital full */
-		0x0f, 0x7f,		/* DAC7 digital full */
-		0x10, 0x7f,		/* DAC8 digital full */
-		0x11, 0x1FF,		/* master digital full */
-
-		0x12, 0x000,		/* phase normal */
-		0x13, 0x090,		/* unmute DAC L/R */
-		0x14, 0x000,		/* all unmute */
-		0x15, 0x000,		/* no deemphasis, no ZFLG */
-
-		0x19, 0x000,		/* -12dB ADC/L */
-		0x1a, 0x000		/* -12dB ADC/R */
-
-	};
-
-	static unsigned short cs_inits[] = {
-		0x0441, /* RUN */
-		0x0100, /* no mute */
-		0x0200, /* */
-		0x0600, /* slave, 24bit */
-	};
-
-	unsigned int tmp;
-	unsigned int i;
-
-	printk(KERN_INFO "ice1724: AudioTrak Prodigy 7.1 driver rev. 0.82b\n");
-	printk(KERN_INFO "ice1724:   This driver is in beta stage. Forsuccess/failure reporting contact\n");
-	printk(KERN_INFO "ice1724:   Apostolos Dimitromanolakis <apostol@cs.utoronto.ca>\n");
-
-	ice->num_total_dacs = 8;
-	ice->num_total_adcs = 8;
-
-	/* to remeber the register values */
-	ice->akm = snd_kcalloc(sizeof(akm4xxx_t), GFP_KERNEL);
-	if (! ice->akm)
-		return -ENOMEM;
-	ice->akm_codecs = 1;
-
-	snd_ice1712_gpio_set_dir(ice, 0xbfffff); /* fix this for the time being */
-
-	/* reset the wm codec as the SPI mode */
-	snd_ice1712_save_gpio_status(ice);
-	snd_ice1712_gpio_set_mask(ice,~( PRODIGY_WM_RESET|PRODIGY_WM_CS|
-		PRODIGY_CS8415_CS|PRODIGY_HP_AMP_EN ));
-
-	tmp = snd_ice1712_gpio_read(ice);
-	tmp &= ~PRODIGY_WM_RESET;
-	snd_ice1712_gpio_write(ice, tmp);
-	udelay(1);
-	tmp |= PRODIGY_WM_CS | PRODIGY_CS8415_CS;
-	snd_ice1712_gpio_write(ice, tmp);
-	udelay(1);
-	tmp |= PRODIGY_WM_RESET;
-	snd_ice1712_gpio_write(ice, tmp);
-	udelay(1);
-
-	/* initialize WM8770 codec */
-	for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2)
-		wm_put(ice, wm_inits[i], wm_inits[i+1]);
-
-	/* initialize CS8415A codec */
-	for (i = 0; i < ARRAY_SIZE(cs_inits); i++)
-		prodigy_spi_write(ice, PRODIGY_CS8415_CS,
-				 cs_inits[i] | 0x200000, 24);
-
-
-	prodigy_set_headphone_amp(ice, 1);
-
-	snd_ice1712_restore_gpio_status(ice);
-
-	return 0;
-}
-
-/*
- * Prodigy boards don't provide the EEPROM data except for the vendor IDs.
- * hence the driver needs to sets up it properly.
- */
-
-static unsigned char prodigy71_eeprom[] __devinitdata = {
-	0x2b,	/* SYSCONF: clock 512, mpu401, spdif-in/ADC, 4DACs */
-	0x80,	/* ACLINK: I2S */
-	0xf8,	/* I2S: vol, 96k, 24bit, 192k */
-	0xc3,	/* SPDIF: out-en, out-int, spdif-in */
-	0xff,	/* GPIO_DIR */
-	0xff,	/* GPIO_DIR1 */
-	0xbf,	/* GPIO_DIR2 */
-	0x00,	/* GPIO_MASK */
-	0x00,	/* GPIO_MASK1 */
-	0x00,	/* GPIO_MASK2 */
-	0x00,	/* GPIO_STATE */
-	0x00,	/* GPIO_STATE1 */
-	0x00,	/* GPIO_STATE2 */
-};
-
-/* entry point */
-struct snd_ice1712_card_info snd_vt1724_prodigy_cards[] __devinitdata = {
-	{
-		.subvendor = VT1724_SUBDEVICE_PRODIGY71,
-		.name = "Audiotrak Prodigy 7.1",
-		.chip_init = prodigy_init,
-		.build_controls = prodigy_add_controls,
-		.eeprom_size = sizeof(prodigy71_eeprom),
-		.eeprom_data = prodigy71_eeprom,
-	},
-	{ } /* terminator */
-};
diff -Nru a/sound/pci/ice1712/prodigy.h b/sound/pci/ice1712/prodigy.h
--- a/sound/pci/ice1712/prodigy.h	Tue Jun 15 22:20:35 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,67 +0,0 @@
-#ifndef __SOUND_PRODIGY_H
-#define __SOUND_PRODIGY_H
-
-/*
- *   ALSA driver for VIA VT1724 (Envy24HT)
- *
- *   Lowlevel functions for Terratec PRODIGY cards
- *
- *	Copyright (c) 2003 Takashi Iwai <tiwai@suse.de>
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *
- */      
-
-#define  PRODIGY_DEVICE_DESC 	       "{AudioTrak,Prodigy 7.1},"
-
-#define VT1724_SUBDEVICE_PRODIGY71	0x33495345	/* PRODIGY 7.1 */
-
-extern struct snd_ice1712_card_info  snd_vt1724_prodigy_cards[];
-
-/* GPIO bits */
-#define PRODIGY_CS8415_CS	(1 << 23)
-#define PRODIGY_CS8415_CDTO	(1 << 22)
-#define PRODIGY_WM_RESET	(1 << 20)
-#define PRODIGY_WM_CLK		(1 << 19)
-#define PRODIGY_WM_DATA		(1 << 18)
-#define PRODIGY_WM_RW		(1 << 17)
-#define PRODIGY_AC97_RESET	(1 << 16)
-#define PRODIGY_DIGITAL_SEL1	(1 << 15)
-// #define PRODIGY_HP_SEL		(1 << 14)
-#define PRODIGY_WM_CS		(1 << 12)
-
-#define PRODIGY_HP_AMP_EN	(1 << 14)
-
-
-/* WM8770 registers */
-#define WM_DAC_ATTEN		0x00	/* DAC1-8 analog attenuation */
-#define WM_DAC_MASTER_ATTEN	0x08	/* DAC master analog attenuation */
-#define WM_DAC_DIG_ATTEN	0x09	/* DAC1-8 digital attenuation */
-#define WM_DAC_DIG_MATER_ATTEN	0x11	/* DAC master digital attenuation */
-#define WM_PHASE_SWAP		0x12	/* DAC phase */
-#define WM_DAC_CTRL1		0x13	/* DAC control bits */
-#define WM_MUTE			0x14	/* mute controls */
-#define WM_DAC_CTRL2		0x15	/* de-emphasis and zefo-flag */
-#define WM_INT_CTRL		0x16	/* interface control */
-#define WM_MASTER		0x17	/* master clock and mode */
-#define WM_POWERDOWN		0x18	/* power-down controls */
-#define WM_ADC_GAIN		0x19	/* ADC gain L(19)/R(1a) */
-#define WM_ADC_MUX		0x1b	/* input MUX */
-#define WM_OUT_MUX1		0x1c	/* output MUX */
-#define WM_OUT_MUX2		0x1e	/* output MUX */
-#define WM_RESET		0x1f	/* software reset */
-
-
-#endif /* __SOUND_PRODIGY_H */
diff -Nru a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c
--- a/sound/pci/ice1712/revo.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/ice1712/revo.c	Tue Jun 15 22:20:41 2004
@@ -171,10 +171,11 @@
 /* entry point */
 struct snd_ice1712_card_info snd_vt1724_revo_cards[] __devinitdata = {
 	{
-		VT1724_SUBDEVICE_REVOLUTION71,
-		"M Audio Revolution-7.1",
-		revo_init,
-		revo_add_controls,
+		.subvendor = VT1724_SUBDEVICE_REVOLUTION71,
+		.name = "M Audio Revolution-7.1",
+		.model = "revo71",
+		.chip_init = revo_init,
+		.build_controls = revo_add_controls,
 	},
 	{ } /* terminator */
 };
diff -Nru a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
--- a/sound/pci/intel8x0.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/intel8x0.c	Tue Jun 15 22:20:41 2004
@@ -34,12 +34,12 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
 #include <sound/info.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 /* for 440MX workaround */
 #include <asm/pgtable.h>
@@ -81,29 +81,30 @@
 #ifdef SUPPORT_MIDI
 static int mpu_port[SNDRV_CARDS]; /* disabled */
 #endif
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Intel i8x0 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Intel i8x0 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ac97_clock, int, boot_devs, 0444);
 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
 MODULE_PARM_SYNTAX(ac97_clock, SNDRV_ENABLED ",default:0");
-MODULE_PARM(ac97_quirk, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ac97_quirk, int, boot_devs, 0444);
 MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
 MODULE_PARM_SYNTAX(ac97_quirk, SNDRV_ENABLED ",allows:{{-1,4}},dialog:list,default:-1");
 #ifdef SUPPORT_JOYSTICK
-MODULE_PARM(joystick, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick, bool, boot_devs, 0444);
 MODULE_PARM_DESC(joystick, "Enable joystick for Intel i8x0 soundcard.");
 MODULE_PARM_SYNTAX(joystick, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 #endif
 #ifdef SUPPORT_MIDI
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mpu_port, int, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU401 port # for Intel i8x0 driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_ENABLED ",allows:{{0},{0x330},{0x300}},dialog:list");
 #endif
@@ -235,6 +236,7 @@
 #define   ICH_P2INT		0x02000000	/* ICH4: PCM2-In interrupt */
 #define   ICH_M2INT		0x01000000	/* ICH4: Mic2-In interrupt */
 #define   ICH_SAMPLE_CAP	0x00c00000	/* ICH4: sample capability bits (RO) */
+#define   ICH_SAMPLE_16_20	0x00400000	/* ICH4: 16- and 20-bit samples */
 #define   ICH_MULTICHAN_CAP	0x00300000	/* ICH4: multi-channel capability bits (RO) */
 #define   ICH_MD3		0x00020000	/* modem power down semaphore */
 #define   ICH_AD3		0x00010000	/* audio power down semaphore */
@@ -378,6 +380,7 @@
         unsigned int fragsize;
         unsigned int fragsize1;
         unsigned int position;
+	unsigned int pos_shift;
         int frags;
         int lvi;
         int lvi_frag;
@@ -441,10 +444,9 @@
 	struct snd_dma_buffer bdbars;
 	u32 int_sta_reg;		/* interrupt status register */
 	u32 int_sta_mask;		/* interrupt status mask */
-	unsigned int pcm_pos_shift;
-	
+
 #ifdef CONFIG_PM
-	int in_suspend;
+	u32 pci_state[64 / sizeof(u32)];
 #endif
 };
 
@@ -719,10 +721,10 @@
 		for (idx = 0; idx < (ICH_REG_LVI_MASK + 1) * 2; idx += 4) {
 			bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf);
 			bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */
-						     ichdev->fragsize1 >> chip->pcm_pos_shift);
+						     ichdev->fragsize1 >> ichdev->pos_shift);
 			bdbar[idx + 2] = cpu_to_le32(ichdev->physbuf + (ichdev->size >> 1));
 			bdbar[idx + 3] = cpu_to_le32(0x80000000 | /* interrupt on completion */
-						     ichdev->fragsize1 >> chip->pcm_pos_shift);
+						     ichdev->fragsize1 >> ichdev->pos_shift);
 		}
 		ichdev->frags = 2;
 	} else {
@@ -731,7 +733,7 @@
 		for (idx = 0; idx < (ICH_REG_LVI_MASK + 1) * 2; idx += 2) {
 			bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + (((idx >> 1) * ichdev->fragsize) % ichdev->size));
 			bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */
-						     ichdev->fragsize >> chip->pcm_pos_shift);
+						     ichdev->fragsize >> ichdev->pos_shift);
 			// printk("bdbar[%i] = 0x%x [0x%x]\n", idx + 0, bdbar[idx + 0], bdbar[idx + 1]);
 		}
 		ichdev->frags = ichdev->size / ichdev->fragsize;
@@ -773,11 +775,14 @@
 static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev)
 {
 	unsigned long port = ichdev->reg_offset;
-	int civ, i, step;
+	int status, civ, i, step;
 	int ack = 0;
 
+	status = igetbyte(chip, port + ichdev->roff_sr);
 	civ = igetbyte(chip, port + ICH_REG_OFF_CIV);
-	if (civ == ichdev->civ) {
+	if (!(status & ICH_BCIS)) {
+		step = 0;
+	} else if (civ == ichdev->civ) {
 		// snd_printd("civ same %d\n", civ);
 		step = 1;
 		ichdev->civ++;
@@ -811,7 +816,8 @@
 		snd_pcm_period_elapsed(ichdev->substream);
 		spin_lock(&chip->reg_lock);
 	}
-	iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI);
+	iputbyte(chip, port + ichdev->roff_sr,
+		 status & (ICH_FIFOE | ICH_BCIS | ICH_LVBCI));
 }
 
 static irqreturn_t snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -981,7 +987,8 @@
 	return snd_pcm_lib_free_pages(substream);
 }
 
-static void snd_intel8x0_setup_multi_channels(intel8x0_t *chip, int channels)
+static void snd_intel8x0_setup_pcm_out(intel8x0_t *chip,
+				       int channels, int sample_bits)
 {
 	unsigned int cnt;
 	switch (chip->device_type) {
@@ -1005,7 +1012,7 @@
 		break;
 	default:
 		cnt = igetdword(chip, ICHREG(GLOB_CNT));
-		cnt &= ~ICH_PCM_246_MASK;
+		cnt &= ~(ICH_PCM_246_MASK | ICH_PCM_20BIT);
 		if (chip->multi4 && channels == 4)
 			cnt |= ICH_PCM_4;
 		else if (chip->multi6 && channels == 6)
@@ -1016,6 +1023,9 @@
 			 */
 			iputdword(chip, ICHREG(GLOB_CNT), (cnt & 0xcfffff));
 			mdelay(50); /* grrr... */
+		} else if (chip->device_type == DEVICE_INTEL_ICH4) {
+			if (sample_bits > 16)
+				cnt |= ICH_PCM_20BIT;
 		}
 		iputdword(chip, ICHREG(GLOB_CNT), cnt);
 		break;
@@ -1033,8 +1043,12 @@
 	ichdev->fragsize = snd_pcm_lib_period_bytes(substream);
 	if (ichdev->ichd == ICHD_PCMOUT) {
 		spin_lock(&chip->reg_lock);
-		snd_intel8x0_setup_multi_channels(chip, runtime->channels);
+		snd_intel8x0_setup_pcm_out(chip, runtime->channels,
+					   runtime->sample_bits);
 		spin_unlock(&chip->reg_lock);
+		if (chip->device_type == DEVICE_INTEL_ICH4) {
+			ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1;
+		}
 	}
 	snd_intel8x0_setup_periods(chip, ichdev);
 	return 0;
@@ -1047,7 +1061,7 @@
 	unsigned long flags;
 	size_t ptr1, ptr;
 
-	ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << chip->pcm_pos_shift;
+	ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << ichdev->pos_shift;
 	if (ptr1 != 0)
 		ptr = ichdev->fragsize1 - ptr1;
 	else
@@ -1142,6 +1156,8 @@
 		runtime->hw.channels_max = 4;
 		snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels4);
 	}
+	if (chip->smp20bit)
+		runtime->hw.formats |= SNDRV_PCM_FMTBIT_S32_LE;
 	return 0;
 }
 
@@ -1844,6 +1860,7 @@
 	memset(&ac97, 0, sizeof(ac97));
 	ac97.private_data = chip;
 	ac97.private_free = snd_intel8x0_mixer_free_ac97;
+	ac97.scaps = AC97_SCAP_SKIP_MODEM;
 	if (chip->device_type != DEVICE_ALI) {
 		glob_sta = igetdword(chip, ICHREG(GLOB_STA));
 		bus.write = snd_intel8x0_codec_write;
@@ -1892,7 +1909,8 @@
 	for (i = 0; i < codecs; i++) {
 		ac97.num = i;
 		if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) {
-			snd_printk(KERN_ERR "Unable to initialize codec #%d\n", i);
+			if (err != -EACCES)
+				snd_printk(KERN_ERR "Unable to initialize codec #%d\n", i);
 			if (i == 0)
 				goto __err;
 			continue;
@@ -1946,6 +1964,10 @@
 		if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE))
 			chip->multi6 = 1;
 	}
+	if (chip->device_type == DEVICE_INTEL_ICH4) {
+		if ((igetdword(chip, ICHREG(GLOB_STA)) & ICH_SAMPLE_CAP) == ICH_SAMPLE_16_20)
+			chip->smp20bit = 1;
+	}
 	if (chip->device_type == DEVICE_NFORCE) {
 		/* 48kHz only */
 		chip->ichd[spdif_idx].pcm->rates = SNDRV_PCM_RATE_48000;
@@ -2184,74 +2206,54 @@
 /*
  * power management
  */
-static void intel8x0_suspend(intel8x0_t *chip)
+static int intel8x0_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	intel8x0_t *chip = snd_magic_cast(intel8x0_t, card->pm_private_data, return -EINVAL);
 	int i;
 
-	if (chip->in_suspend ||
-	    card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
-
-	chip->in_suspend = 1;
 	for (i = 0; i < chip->pcm_devs; i++)
 		snd_pcm_suspend_all(chip->pcm[i]);
+	for (i = 0; i < 3; i++)
+		if (chip->ac97[i])
+			snd_ac97_suspend(chip->ac97[i]);
+	pci_save_state(chip->pci, chip->pci_state);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void intel8x0_resume(intel8x0_t *chip)
+static int intel8x0_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	intel8x0_t *chip = snd_magic_cast(intel8x0_t, card->pm_private_data, return -EINVAL);
 	int i;
 
-	if (! chip->in_suspend ||
-	    card->power_state == SNDRV_CTL_POWER_D0)
-		return;
-
+	pci_restore_state(chip->pci, chip->pci_state);
 	pci_enable_device(chip->pci);
 	pci_set_master(chip->pci);
 	snd_intel8x0_chip_init(chip, 0);
+
+	/* refill nocache */
+	if (chip->fix_nocache)
+		fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1);
+
 	for (i = 0; i < 3; i++)
 		if (chip->ac97[i])
 			snd_ac97_resume(chip->ac97[i]);
 
-	chip->in_suspend = 0;
-	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int snd_intel8x0_suspend(struct pci_dev *dev, u32 state)
-{
-	intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(dev), return -ENXIO);
-	intel8x0_suspend(chip);
-	return 0;
-}
-static int snd_intel8x0_resume(struct pci_dev *dev)
-{
-	intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(dev), return -ENXIO);
-	intel8x0_resume(chip);
-	return 0;
-}
-
-/* callback */
-static int snd_intel8x0_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	intel8x0_t *chip = snd_magic_cast(intel8x0_t, card->power_state_private_data, return -ENXIO);
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		intel8x0_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		intel8x0_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
+	/* refill nocache */
+	if (chip->fix_nocache) {
+		for (i = 0; i < chip->bdbars_count; i++) {
+			ichdev_t *ichdev = &chip->ichd[i];
+			if (ichdev->substream) {
+				snd_pcm_runtime_t *runtime = ichdev->substream->runtime;
+				if (runtime->dma_area)
+					fill_nocache(runtime->dma_area, runtime->dma_bytes, 1);
+			}
+		}
 	}
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 	return 0;
 }
-
 #endif /* CONFIG_PM */
 
 #define INTEL8X0_TESTBUF_SIZE	32768	/* enough large for one shot */
@@ -2305,7 +2307,7 @@
 	spin_lock_irqsave(&chip->reg_lock, flags);
 	/* check the position */
 	pos = ichdev->fragsize1;
-	pos -= igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << chip->pcm_pos_shift;
+	pos -= igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << ichdev->pos_shift;
 	pos += ichdev->position;
 	do_gettimeofday(&stop_time);
 	/* stop */
@@ -2546,9 +2548,9 @@
 		}
 		if (device_type == DEVICE_ALI)
 			ichdev->ali_slot = (ichdev->reg_offset - 0x40) / 0x10;
+		/* SIS7012 handles the pcm data in bytes, others are in samples */
+		ichdev->pos_shift = (device_type == DEVICE_SIS) ? 0 : 1;
 	}
-	/* SIS7012 handles the pcm data in bytes, others are in words */
-	chip->pcm_pos_shift = (device_type == DEVICE_SIS) ? 0 : 1;
 
 	memset(&chip->dma_dev, 0, sizeof(chip->dma_dev));
 	chip->dma_dev.type = SNDRV_DMA_TYPE_DEV;
@@ -2581,10 +2583,7 @@
 		return err;
 	}
 
-#ifdef CONFIG_PM
-	card->set_power_state = snd_intel8x0_set_power_state;
-	card->power_state_private_data = chip;
-#endif
+	snd_card_set_pm_callback(card, intel8x0_suspend, intel8x0_resume, chip);
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
 		snd_intel8x0_free(chip);
@@ -2692,16 +2691,14 @@
 		snd_card_free(card);
 		return err;
 	}
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_intel8x0_remove(struct pci_dev *pci)
 {
-	intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -2710,10 +2707,7 @@
 	.id_table = snd_intel8x0_ids,
 	.probe = snd_intel8x0_probe,
 	.remove = __devexit_p(snd_intel8x0_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_intel8x0_suspend,
-	.resume = snd_intel8x0_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };
 
 
@@ -2817,12 +2811,9 @@
 {
 	int err;
 
-        if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Intel ICH soundcard not found or device busy\n");
-#endif
+        if ((err = pci_module_init(&driver)) < 0)
                 return err;
-        }
+
 #if defined(SUPPORT_JOYSTICK) || defined(SUPPORT_MIDI)
 	if (pci_module_init(&joystick_driver) < 0) {
 		snd_printdd(KERN_INFO "no joystick found\n");
@@ -2847,33 +2838,3 @@
 
 module_init(alsa_card_intel8x0_init)
 module_exit(alsa_card_intel8x0_exit)
-
-#ifndef MODULE
-
-/* format is: snd-intel8x0=enable,index,id,ac97_clock,ac97_quirk,mpu_port,joystick */
-
-static int __init alsa_card_intel8x0_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&ac97_clock[nr_dev]) == 2 &&
-	       get_option(&str,&ac97_quirk[nr_dev]) == 2
-#ifdef SUPPORT_MIDI
-	       && get_option(&str,&mpu_port[nr_dev]) == 2
-#endif
-#ifdef SUPPORT_JOYSTICK
-	       && get_option(&str,&joystick[nr_dev]) == 2
-#endif
-	       );
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-intel8x0=", alsa_card_intel8x0_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
--- a/sound/pci/intel8x0m.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/intel8x0m.c	Tue Jun 15 22:20:41 2004
@@ -31,12 +31,12 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
 #include <sound/info.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -56,17 +56,18 @@
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
 static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Intel i8x0 modemcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Intel i8x0 modemcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Intel i8x0 modemcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ac97_clock, int, boot_devs, 0444);
 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
 MODULE_PARM_SYNTAX(ac97_clock, SNDRV_ENABLED ",default:0");
 
@@ -266,10 +267,6 @@
 	u32 int_sta_reg;		/* interrupt status register */
 	u32 int_sta_mask;		/* interrupt status mask */
 	unsigned int pcm_pos_shift;
-	
-#ifdef CONFIG_PM
-	int in_suspend;
-#endif
 };
 
 static struct pci_device_id snd_intel8x0m_ids[] = {
@@ -905,6 +902,7 @@
 	memset(&ac97, 0, sizeof(ac97));
 	ac97.private_data = chip;
 	ac97.private_free = snd_intel8x0_mixer_free_ac97;
+	ac97.scaps = AC97_SCAP_SKIP_AUDIO;
 
 	glob_sta = igetdword(chip, ICHREG(GLOB_STA));
 	bus.write = snd_intel8x0_codec_write;
@@ -1081,72 +1079,31 @@
 /*
  * power management
  */
-static void intel8x0_suspend(intel8x0_t *chip)
+static int intel8x0m_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	intel8x0_t *chip = snd_magic_cast(intel8x0_t, card->pm_private_data, return -EINVAL);
 	int i;
 
-	if (chip->in_suspend ||
-	    card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
-
-	chip->in_suspend = 1;
 	for (i = 0; i < chip->pcm_devs; i++)
 		snd_pcm_suspend_all(chip->pcm[i]);
+	if (chip->ac97)
+		snd_ac97_suspend(chip->ac97);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void intel8x0_resume(intel8x0_t *chip)
+static int intel8x0m_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
-
-	if (! chip->in_suspend ||
-	    card->power_state == SNDRV_CTL_POWER_D0)
-		return;
-
+	intel8x0_t *chip = snd_magic_cast(intel8x0_t, card->pm_private_data, return -EINVAL);
 	pci_enable_device(chip->pci);
 	pci_set_master(chip->pci);
 	snd_intel8x0_chip_init(chip, 0);
 	if (chip->ac97)
 		snd_ac97_resume(chip->ac97);
 
-	chip->in_suspend = 0;
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int snd_intel8x0m_suspend(struct pci_dev *dev, u32 state)
-{
-	intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(dev), return -ENXIO);
-	intel8x0_suspend(chip);
-	return 0;
-}
-static int snd_intel8x0m_resume(struct pci_dev *dev)
-{
-	intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(dev), return -ENXIO);
-	intel8x0_resume(chip);
 	return 0;
 }
-
-/* callback */
-static int snd_intel8x0_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	intel8x0_t *chip = snd_magic_cast(intel8x0_t, card->power_state_private_data, return -ENXIO);
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		intel8x0_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		intel8x0_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
-	return 0;
-}
-
 #endif /* CONFIG_PM */
 
 static void snd_intel8x0m_proc_read(snd_info_entry_t * entry,
@@ -1338,10 +1295,7 @@
 		return err;
 	}
 
-#ifdef CONFIG_PM
-	card->set_power_state = snd_intel8x0_set_power_state;
-	card->power_state_private_data = chip;
-#endif
+	snd_card_set_pm_callback(card, intel8x0m_suspend, intel8x0m_resume, chip);
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
 		snd_intel8x0_free(chip);
@@ -1436,16 +1390,14 @@
 		snd_card_free(card);
 		return err;
 	}
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_intel8x0m_remove(struct pci_dev *pci)
 {
-	intel8x0_t *chip = snd_magic_cast(intel8x0_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -1454,25 +1406,13 @@
 	.id_table = snd_intel8x0m_ids,
 	.probe = snd_intel8x0m_probe,
 	.remove = __devexit_p(snd_intel8x0m_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_intel8x0m_suspend,
-	.resume = snd_intel8x0m_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };
 
 
 static int __init alsa_card_intel8x0m_init(void)
 {
-	int err;
-
-        if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Intel ICH modemcard not found or device busy\n");
-#endif
-                return err;
-        }
-
-        return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_intel8x0m_exit(void)
@@ -1482,26 +1422,3 @@
 
 module_init(alsa_card_intel8x0m_init)
 module_exit(alsa_card_intel8x0m_exit)
-
-#ifndef MODULE
-
-/* format is: snd-intel8x0=enable,index,id,ac97_clock,mpu_port,joystick */
-
-static int __init alsa_card_intel8x0m_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&ac97_clock[nr_dev]) == 2
-	       );
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-intel8x0m=", alsa_card_intel8x0m_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
--- a/sound/pci/korg1212/korg1212.c	Tue Jun 15 22:20:36 2004
+++ b/sound/pci/korg1212/korg1212.c	Tue Jun 15 22:20:36 2004
@@ -26,13 +26,13 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/wait.h>
+#include <linux/moduleparam.h>
 
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/io.h>
@@ -417,14 +417,15 @@
 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; /* Enable this card */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Korg 1212 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Korg 1212 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Korg 1212 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 MODULE_AUTHOR("Haroldo Gamal <gamal@alternex.com.br>");
@@ -1327,7 +1328,7 @@
 	return 0;
 }
 
-static int snd_korg1212_copy_to(korg1212_t *korg1212, void *dst, int pos, int count, int offset, int size)
+static int snd_korg1212_copy_to(korg1212_t *korg1212, void __user *dst, int pos, int count, int offset, int size)
 {
 	KorgAudioFrame * src =  korg1212->recordDataBufsPtr[0].bufferData + pos;
 	int i, rc;
@@ -1345,7 +1346,7 @@
 			return -EFAULT;
 		}
 #endif
-		rc = copy_to_user((void*) dst + offset, src, size);
+		rc = copy_to_user(dst + offset, src, size);
 		if (rc) {
 #if K1212_DEBUG_LEVEL > 0
 			K1212_DEBUG_PRINTK("K1212_DEBUG: snd_korg1212_copy_to USER EFAULT src=%p dst=%p iter=%d\n", src, dst, i);
@@ -1359,7 +1360,7 @@
 	return 0;
 }
 
-static int snd_korg1212_copy_from(korg1212_t *korg1212, void *src, int pos, int count, int offset, int size)
+static int snd_korg1212_copy_from(korg1212_t *korg1212, void __user *src, int pos, int count, int offset, int size)
 {
 	KorgAudioFrame * dst =  korg1212->playDataBufsPtr[0].bufferData + pos;
 	int i, rc;
@@ -1670,7 +1671,7 @@
 static int snd_korg1212_playback_copy(snd_pcm_substream_t *substream,
                         int channel, /* not used (interleaved data) */
                         snd_pcm_uframes_t pos,
-                        void *src,
+                        void __user *src,
                         snd_pcm_uframes_t count)
 {
         korg1212_t *korg1212 = _snd_pcm_substream_chip(substream);
@@ -1700,7 +1701,7 @@
 static int snd_korg1212_capture_copy(snd_pcm_substream_t *substream,
                         int channel, /* not used (interleaved data) */
                         snd_pcm_uframes_t pos,
-                        void *dst,
+                        void __user *dst,
                         snd_pcm_uframes_t count)
 {
         korg1212_t *korg1212 = _snd_pcm_substream_chip(substream);
@@ -2504,15 +2505,14 @@
 		snd_card_free(card);
 		return err;
 	}
-	pci_set_drvdata(pci, korg1212);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_korg1212_remove(struct pci_dev *pci)
 {
-	korg1212_t *korg1212 = pci_get_drvdata(pci);
-	snd_card_free(korg1212->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -2525,15 +2525,7 @@
 
 static int __init alsa_card_korg1212_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "No Korg 1212IO cards found\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_korg1212_exit(void)
@@ -2543,25 +2535,3 @@
 
 module_init(alsa_card_korg1212_init)
 module_exit(alsa_card_korg1212_exit)
-
-#ifndef MODULE
-
-/* format is: snd-korg1212=enable,index,id */
-
-static int __init alsa_card_korg1212_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-korg1212=", alsa_card_korg1212_setup);
-
-#endif /* ifndef MODULE */
-
diff -Nru a/sound/pci/maestro3.c b/sound/pci/maestro3.c
--- a/sound/pci/maestro3.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/maestro3.c	Tue Jun 15 22:20:41 2004
@@ -39,13 +39,13 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/mpu401.h>
 #include <sound/ac97_codec.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Zach Brown <zab@zabbo.net>, Takashi Iwai <tiwai@suse.de>");
@@ -63,20 +63,21 @@
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */
 static int external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
 static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable this soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(external_amp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(external_amp, bool, boot_devs, 0444);
 MODULE_PARM_DESC(external_amp, "Enable external amp for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(external_amp, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
-MODULE_PARM(amp_gpio, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(amp_gpio, int, boot_devs, 0444);
 MODULE_PARM_DESC(amp_gpio, "GPIO pin number for external amp. (default = -1)");
 MODULE_PARM_SYNTAX(amp_gpio, SNDRV_ENABLED);
 
@@ -2410,18 +2411,16 @@
  * APM support
  */
 #ifdef CONFIG_PM
-
-static void m3_suspend(m3_t *chip)
+static int m3_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	m3_t *chip = snd_magic_cast(m3_t, card->pm_private_data, return -EINVAL);
 	int i, index;
 
 	if (chip->suspend_mem == NULL)
-		return;
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
+		return 0;
 
 	snd_pcm_suspend_all(chip->pcm);
+	snd_ac97_suspend(chip->ac97);
 
 	big_mdelay(10); /* give the assp a chance to idle.. */
 
@@ -2440,17 +2439,16 @@
 	snd_m3_outw(chip, 0xffff, 0x54);
 	snd_m3_outw(chip, 0xffff, 0x56);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void m3_resume(m3_t *chip)
+static int m3_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	m3_t *chip = snd_magic_cast(m3_t, card->pm_private_data, return -EINVAL);
 	int i, index;
 
 	if (chip->suspend_mem == NULL)
-		return;
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
+		return 0;
 
 	/* first lets just bring everything back. .*/
 	snd_m3_outw(chip, 0, 0x54);
@@ -2481,41 +2479,8 @@
 	snd_m3_amp_enable(chip, 1);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int snd_m3_suspend(struct pci_dev *pci, u32 state)
-{
-	m3_t *chip = snd_magic_cast(m3_t, pci_get_drvdata(pci), return -ENXIO);
-	m3_suspend(chip);
-	return 0;
-}
-static int snd_m3_resume(struct pci_dev *pci)
-{
-	m3_t *chip = snd_magic_cast(m3_t, pci_get_drvdata(pci), return -ENXIO);
-	m3_resume(chip);
-	return 0;
-}
-
-/* callback */
-static int snd_m3_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	m3_t *chip = snd_magic_cast(m3_t, card->power_state_private_data, return -ENXIO);
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		m3_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		m3_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
-
 #endif /* CONFIG_PM */
 
 
@@ -2651,11 +2616,9 @@
 #ifdef CONFIG_PM
 	chip->suspend_mem = vmalloc(sizeof(u16) * (REV_B_CODE_MEMORY_LENGTH + REV_B_DATA_MEMORY_LENGTH));
 	if (chip->suspend_mem == NULL)
-		snd_printk("can't allocate apm buffer\n");
-	else {
-		card->set_power_state = snd_m3_set_power_state;
-		card->power_state_private_data = chip;
-	}
+		snd_printk(KERN_WARNING "can't allocate apm buffer\n");
+	else
+		snd_card_set_pm_callback(card, m3_suspend, m3_resume, chip);
 #endif
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
@@ -2738,16 +2701,14 @@
 		printk(KERN_WARNING "maestro3: no midi support.\n");
 #endif
 
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_m3_remove(struct pci_dev *pci)
 {
-	m3_t *chip = snd_magic_cast(m3_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -2756,23 +2717,12 @@
 	.id_table = snd_m3_ids,
 	.probe = snd_m3_probe,
 	.remove = __devexit_p(snd_m3_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_m3_suspend,
-	.resume = snd_m3_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };
 	
 static int __init alsa_card_m3_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Maestro3/Allegro soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_m3_exit(void)
@@ -2782,26 +2732,3 @@
 
 module_init(alsa_card_m3_init)
 module_exit(alsa_card_m3_exit)
-
-#ifndef MODULE
-
-/* format is: snd-maestro3=enable,index,id,external_amp,amp_gpio */
-
-static int __init alsa_card_maestro3_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&external_amp[nr_dev]) == 2 &&
-	       get_option(&str,&amp_gpio[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-maestro3=", alsa_card_maestro3_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
--- a/sound/pci/mixart/mixart.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/mixart/mixart.c	Tue Jun 15 22:20:42 2004
@@ -25,8 +25,8 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -48,16 +48,17 @@
 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_PNP;     /* Enable this card */
+static int boot_devs;
 
 #define chip_t mixart_t
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Digigram " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Digigram " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 
@@ -1153,7 +1154,7 @@
   mixart_BA0 proc interface for BAR 0 - read callback
  */
 static long snd_mixart_BA0_read(snd_info_entry_t *entry, void *file_private_data,
-				struct file *file, char *buf, long count)
+				struct file *file, char __user *buf, long count)
 {
 	mixart_mgr_t *mgr = snd_magic_cast(mixart_mgr_t, entry->private_data, return -ENXIO);
 
@@ -1172,7 +1173,7 @@
   mixart_BA1 proc interface for BAR 1 - read callback
  */
 static long snd_mixart_BA1_read(snd_info_entry_t *entry, void *file_private_data,
-				struct file *file, char *buf, long count)
+				struct file *file, char __user *buf, long count)
 {
 	mixart_mgr_t *mgr = snd_magic_cast(mixart_mgr_t, entry->private_data, return -ENXIO);
 
@@ -1432,15 +1433,7 @@
 
 static int __init alsa_card_mixart_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		snd_printk(KERN_ERR "Digigram miXart soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_mixart_exit(void)
@@ -1450,24 +1443,3 @@
 
 module_init(alsa_card_mixart_init)
 module_exit(alsa_card_mixart_exit)
-
-#ifndef MODULE
-
-/* format is: snd-mixart=enable,index,id */
-
-static int __init alsa_card_mixart_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-mixart=", alsa_card_mixart_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
--- a/sound/pci/nm256/nm256.c	Tue Jun 15 22:20:44 2004
+++ b/sound/pci/nm256/nm256.c	Tue Jun 15 22:20:44 2004
@@ -31,12 +31,12 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/ac97_codec.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #define CARD_NAME "NeoMagic 256AV/ZX"
@@ -62,32 +62,33 @@
 static int buffer_top[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* not specified */
 static int use_cache[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* disabled */
 static int vaio_hack[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* disabled */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable this soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(playback_bufsize, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(playback_bufsize, int, boot_devs, 0444);
 MODULE_PARM_DESC(playback_bufsize, "DAC frame size in kB for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(playback_bufsize, SNDRV_ENABLED);
-MODULE_PARM(capture_bufsize, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(capture_bufsize, int, boot_devs, 0444);
 MODULE_PARM_DESC(capture_bufsize, "ADC frame size in kB for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(capture_bufsize, SNDRV_ENABLED);
-MODULE_PARM(force_ac97, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(force_ac97, bool, boot_devs, 0444);
 MODULE_PARM_DESC(force_ac97, "Force to use AC97 codec for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(force_ac97, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
-MODULE_PARM(buffer_top, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(buffer_top, int, boot_devs, 0444);
 MODULE_PARM_DESC(buffer_top, "Set the top address of audio buffer for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(buffer_top, SNDRV_ENABLED);
-MODULE_PARM(use_cache, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(use_cache, bool, boot_devs, 0444);
 MODULE_PARM_DESC(use_cache, "Enable the cache for coefficient table access.");
 MODULE_PARM_SYNTAX(use_cache, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
-MODULE_PARM(vaio_hack, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(vaio_hack, bool, boot_devs, 0444);
 MODULE_PARM_DESC(vaio_hack, "Enable workaround for Sony VAIO notebooks.");
 MODULE_PARM_SYNTAX(vaio_hack, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 
@@ -274,11 +275,15 @@
 #ifndef PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO
 #define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
 #endif
+#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO
+#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016
+#endif
 
 
 static struct pci_device_id snd_nm256_ids[] = {
 	{PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+	{PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{0,},
 };
 
@@ -679,7 +684,7 @@
 snd_nm256_playback_copy(snd_pcm_substream_t *substream,
 			int channel, /* not used (interleaved data) */
 			snd_pcm_uframes_t pos,
-			void *src,
+			void __user *src,
 			snd_pcm_uframes_t count)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
@@ -1283,24 +1288,20 @@
  * APM event handler, so the card is properly reinitialized after a power
  * event.
  */
-static void nm256_suspend(nm256_t *chip)
+static int nm256_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
+	nm256_t *chip = snd_magic_cast(nm256_t, card->pm_private_data, return -EINVAL);
 
 	snd_pcm_suspend_all(chip->pcm);
+	snd_ac97_suspend(chip->ac97);
 	chip->coeffs_current = 0;
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void nm256_resume(nm256_t *chip)
+static int nm256_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
+	nm256_t *chip = snd_magic_cast(nm256_t, card->pm_private_data, return -EINVAL);
 
 	/* Perform a full reset on the hardware */
 	pci_enable_device(chip->pci);
@@ -1310,41 +1311,8 @@
 	snd_ac97_resume(chip->ac97);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int snd_nm256_suspend(struct pci_dev *dev, u32 state)
-{
-	nm256_t *chip = snd_magic_cast(nm256_t, pci_get_drvdata(dev), return -ENXIO);
-	nm256_suspend(chip);
-	return 0;
-}
-static int snd_nm256_resume(struct pci_dev *dev)
-{
-	nm256_t *chip = snd_magic_cast(nm256_t, pci_get_drvdata(dev), return -ENXIO);
-	nm256_resume(chip);
-	return 0;
-}
-
-/* callback */
-static int snd_nm256_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	nm256_t *chip = snd_magic_cast(nm256_t, card->power_state_private_data, return -ENXIO);
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		nm256_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		nm256_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
-
 #endif /* CONFIG_PM */
 
 static int snd_nm256_free(nm256_t *chip)
@@ -1552,10 +1520,7 @@
 
 	// pci_set_master(pci); /* needed? */
 	
-#ifdef CONFIG_PM
-	card->set_power_state = snd_nm256_set_power_state;
-	card->power_state_private_data = chip;
-#endif
+	snd_card_set_pm_callback(card, nm256_suspend, nm256_resume, chip);
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0)
 		goto __error;
@@ -1571,6 +1536,21 @@
 }
 
 
+struct nm256_quirk {
+	unsigned short vendor;
+	unsigned short device;
+	int type;
+};
+
+#define NM_BLACKLISTED	1
+
+static struct nm256_quirk nm256_quirks[] __devinitdata = {
+	/* HP omnibook 4150 has cs4232 codec internally */
+	{ .vendor = 0x103c, .device = 0x0007, .type = NM_BLACKLISTED },
+	{ } /* terminator */
+};
+
+
 static int __devinit snd_nm256_probe(struct pci_dev *pci,
 				     const struct pci_device_id *pci_id)
 {
@@ -1579,6 +1559,8 @@
 	nm256_t *chip;
 	int err;
 	unsigned int xbuffer_top;
+	struct nm256_quirk *q;
+	u16 subsystem_vendor, subsystem_device;
 
 	if ((err = pci_enable_device(pci)) < 0)
 		return err;
@@ -1590,6 +1572,18 @@
 		return -ENOENT;
 	}
 
+	pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor);
+	pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsystem_device);
+
+	for (q = nm256_quirks; q->vendor; q++) {
+		if (q->vendor == subsystem_vendor && q->device == subsystem_device) {
+			if (q->type == NM_BLACKLISTED) {
+				printk(KERN_INFO "nm256: The device is blacklisted.  Loading stopped\n");
+				return -ENODEV;
+			}
+		}
+	}
+
 	card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
 	if (card == NULL)
 		return -ENOMEM;
@@ -1601,6 +1595,9 @@
 	case PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO:
 		strcpy(card->driver, "NM256ZX");
 		break;
+	case PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO:
+		strcpy(card->driver, "NM256XL+");
+		break;
 	default:
 		snd_printk("invalid device id 0x%x\n", pci->device);
 		snd_card_free(card);
@@ -1641,16 +1638,14 @@
 		return err;
 	}
 
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_nm256_remove(struct pci_dev *pci)
 {
-	nm256_t *chip = snd_magic_cast(nm256_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -1660,23 +1655,13 @@
 	.id_table = snd_nm256_ids,
 	.probe = snd_nm256_probe,
 	.remove = __devexit_p(snd_nm256_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_nm256_suspend,
-	.resume = snd_nm256_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };
 
 
 static int __init alsa_card_nm256_init(void)
 {
-	int err;
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "NeoMagic 256 audio soundchip not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_nm256_exit(void)
@@ -1686,31 +1671,3 @@
 
 module_init(alsa_card_nm256_init)
 module_exit(alsa_card_nm256_exit)
-
-#ifndef MODULE
-
-/* format is: snd-nm256=enable,index,id,
-			playback_bufsize,capture_bufsize,
-			force_ac97,buffer_top,use_cache */
-
-static int __init alsa_card_nm256_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&playback_bufsize[nr_dev]) == 2 &&
-	       get_option(&str,&capture_bufsize[nr_dev]) == 2 &&
-	       get_option(&str,&force_ac97[nr_dev]) == 2 &&
-	       get_option(&str,&buffer_top[nr_dev]) == 2 &&
-	       get_option(&str,&use_cache[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-nm256=", alsa_card_nm256_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/rme32.c b/sound/pci/rme32.c
--- a/sound/pci/rme32.c	Tue Jun 15 22:21:05 2004
+++ b/sound/pci/rme32.c	Tue Jun 15 22:21:05 2004
@@ -61,6 +61,7 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 
 #include <sound/core.h>
 #include <sound/info.h>
@@ -68,7 +69,6 @@
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/asoundef.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/io.h>
@@ -76,14 +76,15 @@
 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_PNP;	/* Enable this card */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for RME Digi32 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for RME Digi32 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable RME Digi32 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 MODULE_AUTHOR("Martin Langer <martin-langer@gmx.de>");
@@ -297,7 +298,7 @@
 
 static int snd_rme32_playback_copy(snd_pcm_substream_t * substream, int channel,	/* not used (interleaved data) */
 				   snd_pcm_uframes_t pos,
-				   void *src, snd_pcm_uframes_t count)
+				   void __user *src, snd_pcm_uframes_t count)
 {
 	rme32_t *rme32 = _snd_pcm_substream_chip(substream);
 	count <<= rme32->playback_frlog;
@@ -310,7 +311,7 @@
 
 static int snd_rme32_capture_copy(snd_pcm_substream_t * substream, int channel,	/* not used (interleaved data) */
 				  snd_pcm_uframes_t pos,
-				  void *dst, snd_pcm_uframes_t count)
+				  void __user *dst, snd_pcm_uframes_t count)
 {
 	rme32_t *rme32 = _snd_pcm_substream_chip(substream);
 	count <<= rme32->capture_frlog;
@@ -1995,15 +1996,7 @@
 
 static int __init alsa_card_rme32_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		snd_printk("No RME Digi32 cards found\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_rme32_exit(void)
@@ -2013,22 +2006,3 @@
 
 module_init(alsa_card_rme32_init)
 module_exit(alsa_card_rme32_exit)
-
-#ifndef MODULE
-
-static int __init alsa_card_rme32_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void) (get_option(&str, &enable[nr_dev]) == 2 &&
-		get_option(&str, &index[nr_dev]) == 2 &&
-		get_id(&str, &id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-rme32=", alsa_card_rme32_setup);
-
-#endif				/* ifndef MODULE */
diff -Nru a/sound/pci/rme96.c b/sound/pci/rme96.c
--- a/sound/pci/rme96.c	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/rme96.c	Tue Jun 15 22:20:39 2004
@@ -29,6 +29,7 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 
 #include <sound/core.h>
 #include <sound/info.h>
@@ -36,7 +37,6 @@
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/asoundef.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/io.h>
@@ -57,14 +57,15 @@
 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_PNP;	/* Enable this card */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for RME Digi96 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable RME Digi96 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 
@@ -360,7 +361,7 @@
 snd_rme96_playback_copy(snd_pcm_substream_t *substream,
 			int channel, /* not used (interleaved data) */
 			snd_pcm_uframes_t pos,
-			void *src,
+			void __user *src,
 			snd_pcm_uframes_t count)
 {
 	rme96_t *rme96 = _snd_pcm_substream_chip(substream);
@@ -375,7 +376,7 @@
 snd_rme96_capture_copy(snd_pcm_substream_t *substream,
 		       int channel, /* not used (interleaved data) */
 		       snd_pcm_uframes_t pos,
-		       void *dst,
+		       void __user *dst,
 		       snd_pcm_uframes_t count)
 {
 	rme96_t *rme96 = _snd_pcm_substream_chip(substream);
@@ -2565,15 +2566,7 @@
 
 static int __init alsa_card_rme96_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "No RME Digi96 cards found\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_rme96_exit(void)
@@ -2583,24 +2576,3 @@
 
 module_init(alsa_card_rme96_init)
 module_exit(alsa_card_rme96_exit)
-
-#ifndef MODULE
-
-/* format is: snd-rme96=enable,index,id */
-
-static int __init alsa_card_rme96_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-rme96=", alsa_card_rme96_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
--- a/sound/pci/rme9652/hdsp.c	Tue Jun 15 22:20:38 2004
+++ b/sound/pci/rme9652/hdsp.c	Tue Jun 15 22:20:38 2004
@@ -27,6 +27,7 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
+#include <linux/moduleparam.h>
 
 #include <sound/core.h>
 #include <sound/control.h>
@@ -35,7 +36,6 @@
 #include <sound/asoundef.h>
 #include <sound/rawmidi.h>
 #include <sound/hwdep.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/hdsp.h>
 
@@ -48,20 +48,21 @@
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
 static int precise_ptr[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* Enable precise pointer */
 static int line_outs_monitor[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0}; /* Send all inputs/playback to line outs */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for RME Hammerfall DSP interface.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for RME Hammerfall DSP interface.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable/disable specific Hammerfall DSP soundcards.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(precise_ptr, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(precise_ptr, bool, boot_devs, 0444);
 MODULE_PARM_DESC(precise_ptr, "Enable precise pointer (doesn't work reliably).");
 MODULE_PARM_SYNTAX(precise_ptr, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
-MODULE_PARM(line_outs_monitor,"1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(line_outs_monitor, bool, boot_devs, 0444);
 MODULE_PARM_DESC(line_outs_monitor, "Send all input and playback streams to line outs by default.");
 MODULE_PARM_SYNTAX(line_outs_monitor, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 MODULE_AUTHOR("Paul Davis <paul@linuxaudiosystems.com>, Marcus Andersson, Thomas Charbonnel <thomas@undata.org>");
@@ -634,6 +635,7 @@
 	case 0xa:
 		return (64 * out) + (32 + (in));
 	case 0x96:
+	case 0x97:
 		return (32 * out) + (16 + (in));
 	default:
 		return (52 * out) + (26 + (in));
@@ -646,6 +648,7 @@
 	case 0xa:
 		return (64 * out) + in;
 	case 0x96:
+	case 0x97:
 		return (32 * out) + in;
 	default:
 		return (52 * out) + in;
@@ -1247,9 +1250,9 @@
 {
 	/* the hardware already does the relevant bit-mask with 0xff */
 	if (id) {
-		return hdsp_write(hdsp, HDSP_midiDataOut1, val);
+		hdsp_write(hdsp, HDSP_midiDataOut1, val);
 	} else {
-		return hdsp_write(hdsp, HDSP_midiDataOut0, val);
+		hdsp_write(hdsp, HDSP_midiDataOut0, val);
 	}
 }
 
@@ -3831,7 +3834,7 @@
 }
 
 static int snd_hdsp_playback_copy(snd_pcm_substream_t *substream, int channel,
-				  snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count)
+				  snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count)
 {
 	hdsp_t *hdsp = _snd_pcm_substream_chip(substream);
 	char *channel_buf;
@@ -3846,7 +3849,7 @@
 }
 
 static int snd_hdsp_capture_copy(snd_pcm_substream_t *substream, int channel,
-				 snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count)
+				 snd_pcm_uframes_t pos, void __user *dst, snd_pcm_uframes_t count)
 {
 	hdsp_t *hdsp = _snd_pcm_substream_chip(substream);
 	char *channel_buf;
@@ -4120,10 +4123,10 @@
 		return -EIO;
 	}
 
-	spin_lock_irq(&hdsp->lock);
+	spin_lock(&hdsp->lock);
 	if (!hdsp->running)
 		hdsp_reset_hw_pointer(hdsp);
-	spin_unlock_irq(&hdsp->lock);
+	spin_unlock(&hdsp->lock);
 	return result;
 }
 
@@ -4528,10 +4531,11 @@
 static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int cmd, unsigned long arg)
 {
 	hdsp_t *hdsp = (hdsp_t *)hw->private_data;	
+	void __user *argp = (void __user *)arg;
 
 	switch (cmd) {
 	case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: {
-		hdsp_peak_rms_t *peak_rms;
+		hdsp_peak_rms_t __user *peak_rms;
 		int i;
 		
 		if (hdsp->io_type == H9652) {
@@ -4539,38 +4543,38 @@
 			int doublespeed = 0;
 			if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DoubleSpeedStatus)
 				doublespeed = 1;
-			peak_rms = (hdsp_peak_rms_t *)arg;
+			peak_rms = (hdsp_peak_rms_t __user *)arg;
 			for (i = 0; i < 26; ++i) {
 				if (!(doublespeed && (i & 4))) {
-					if (copy_to_user_fromio((void *)peak_rms->input_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-i*4, 4) != 0)
+					if (copy_to_user_fromio((void __user *)peak_rms->input_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-i*4, 4) != 0)
 						return -EFAULT;
-					if (copy_to_user_fromio((void *)peak_rms->playback_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-(doublespeed ? 14 : 26)*4-i*4, 4) != 0)
+					if (copy_to_user_fromio((void __user *)peak_rms->playback_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-(doublespeed ? 14 : 26)*4-i*4, 4) != 0)
 						return -EFAULT;
-					if (copy_to_user_fromio((void *)peak_rms->output_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-2*(doublespeed ? 14 : 26)*4-i*4, 4) != 0)
+					if (copy_to_user_fromio((void __user *)peak_rms->output_peaks+i*4, hdsp->iobase+HDSP_9652_peakBase-2*(doublespeed ? 14 : 26)*4-i*4, 4) != 0)
 						return -EFAULT;
 					rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+i*8) & 0xFFFFFF00;
 					rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+i*8+4) & 0xFFFFFF00;
 					rms_high += (rms_low >> 24);
 					rms_low <<= 8;
-					if (copy_to_user((void *)peak_rms->input_rms+i*8, &rms_low, 4) != 0)
+					if (copy_to_user((void __user *)peak_rms->input_rms+i*8, &rms_low, 4) != 0)
 						return -EFAULT;
-					if (copy_to_user((void *)peak_rms->input_rms+i*8+4, &rms_high, 4) != 0)
+					if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, &rms_high, 4) != 0)
 						return -EFAULT;					
 					rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+(doublespeed ? 14 : 26)*8+i*8) & 0xFFFFFF00;
 					rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+(doublespeed ? 14 : 26)*8+i*8+4) & 0xFFFFFF00;
 					rms_high += (rms_low >> 24);
 					rms_low <<= 8;
-					if (copy_to_user((void *)peak_rms->playback_rms+i*8, &rms_low, 4) != 0)
+					if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, &rms_low, 4) != 0)
 						return -EFAULT;
-					if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, &rms_high, 4) != 0)
+					if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, &rms_high, 4) != 0)
 						return -EFAULT;					
 					rms_low = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+2*(doublespeed ? 14 : 26)*8+i*8) & 0xFFFFFF00;
 					rms_high = *(u32 *)(hdsp->iobase+HDSP_9652_rmsBase+2*(doublespeed ? 14 : 26)*8+i*8+4) & 0xFFFFFF00;
 					rms_high += (rms_low >> 24);
 					rms_low <<= 8;
-					if (copy_to_user((void *)peak_rms->output_rms+i*8, &rms_low, 4) != 0)
+					if (copy_to_user((void __user *)peak_rms->output_rms+i*8, &rms_low, 4) != 0)
 						return -EFAULT;
-					if (copy_to_user((void *)peak_rms->output_rms+i*8+4, &rms_high, 4) != 0)
+					if (copy_to_user((void __user *)peak_rms->output_rms+i*8+4, &rms_high, 4) != 0)
 						return -EFAULT;					
 				}
 			}
@@ -4583,25 +4587,25 @@
 			if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DoubleSpeedStatus)
 				doublespeed = 1;
 			m = (hdsp_9632_meters_t *)(hdsp->iobase+HDSP_9632_metersBase);
-			peak_rms = (hdsp_peak_rms_t *)arg;
+			peak_rms = (hdsp_peak_rms_t __user *)arg;
 			for (i = 0, j = 0; i < 16; ++i, ++j) {
-				if (copy_to_user((void *)peak_rms->input_peaks+i*4, &(m->input_peak[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->input_peaks+i*4, &(m->input_peak[j]), 4) != 0)
 					return -EFAULT;
-				if (copy_to_user((void *)peak_rms->playback_peaks+i*4, &(m->playback_peak[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->playback_peaks+i*4, &(m->playback_peak[j]), 4) != 0)
 					return -EFAULT;
-				if (copy_to_user((void *)peak_rms->output_peaks+i*4, &(m->output_peak[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->output_peaks+i*4, &(m->output_peak[j]), 4) != 0)
 					return -EFAULT;
-				if (copy_to_user((void *)peak_rms->input_rms+i*8, &(m->input_rms_low[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->input_rms+i*8, &(m->input_rms_low[j]), 4) != 0)
 					return -EFAULT;
-				if (copy_to_user((void *)peak_rms->playback_rms+i*8, &(m->playback_rms_low[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, &(m->playback_rms_low[j]), 4) != 0)
 					return -EFAULT;
-				if (copy_to_user((void *)peak_rms->output_rms+i*8, &(m->output_rms_low[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->output_rms+i*8, &(m->output_rms_low[j]), 4) != 0)
 					return -EFAULT;
-				if (copy_to_user((void *)peak_rms->input_rms+i*8+4, &(m->input_rms_high[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, &(m->input_rms_high[j]), 4) != 0)
 					return -EFAULT;
-				if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, &(m->playback_rms_high[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, &(m->playback_rms_high[j]), 4) != 0)
 					return -EFAULT;
-				if (copy_to_user((void *)peak_rms->output_rms+i*8+4, &(m->output_rms_high[j]), 4) != 0)
+				if (copy_to_user((void __user *)peak_rms->output_rms+i*8+4, &(m->output_rms_high[j]), 4) != 0)
 					return -EFAULT;
 				if (doublespeed && i == 3) i += 4;
 			}
@@ -4611,25 +4615,25 @@
 			snd_printk("firmware needs to be uploaded to the card.\n");	
 			return -EINVAL;
 		}
-		peak_rms = (hdsp_peak_rms_t *)arg;
+		peak_rms = (hdsp_peak_rms_t __user *)arg;
 		for (i = 0; i < 26; ++i) {
-		    if (copy_to_user((void *)peak_rms->playback_peaks+i*4, (void *)hdsp->iobase+HDSP_playbackPeakLevel+i*4, 4) != 0)
+		    if (copy_to_user((void __user *)peak_rms->playback_peaks+i*4, (void *)hdsp->iobase+HDSP_playbackPeakLevel+i*4, 4) != 0)
 			    return -EFAULT;
-		    if (copy_to_user((void *)peak_rms->input_peaks+i*4, (void *)hdsp->iobase+HDSP_inputPeakLevel+i*4, 4) != 0)
+		    if (copy_to_user((void __user *)peak_rms->input_peaks+i*4, (void *)hdsp->iobase+HDSP_inputPeakLevel+i*4, 4) != 0)
 			    return -EFAULT;
 		}
 		for (i = 0; i < 26; ++i) {
-			if (copy_to_user((void *)peak_rms->playback_rms+i*8+4, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8, 4) != 0)
+			if (copy_to_user((void __user *)peak_rms->playback_rms+i*8+4, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8, 4) != 0)
 				return -EFAULT;
-			if (copy_to_user((void *)peak_rms->playback_rms+i*8, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8+4, 4) != 0)
+			if (copy_to_user((void __user *)peak_rms->playback_rms+i*8, (void *)hdsp->iobase+HDSP_playbackRmsLevel+i*8+4, 4) != 0)
 				return -EFAULT;
-			if (copy_to_user((void *)peak_rms->input_rms+i*8+4, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8, 4) != 0)
+			if (copy_to_user((void __user *)peak_rms->input_rms+i*8+4, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8, 4) != 0)
 				return -EFAULT;
-			if (copy_to_user((void *)peak_rms->input_rms+i*8, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8+4, 4) != 0)
+			if (copy_to_user((void __user *)peak_rms->input_rms+i*8, (void *)hdsp->iobase+HDSP_inputRmsLevel+i*8+4, 4) != 0)
 				return -EFAULT;
 		}
 		for (i = 0; i < 28; ++i) {
-		    if (copy_to_user((void *)peak_rms->output_peaks+i*4, (void *)hdsp->iobase+HDSP_outputPeakLevel+i*4, 4) != 0)
+		    if (copy_to_user((void __user *)peak_rms->output_peaks+i*4, (void *)hdsp->iobase+HDSP_outputPeakLevel+i*4, 4) != 0)
 			    return -EFAULT;
 		}
 		break;
@@ -4677,7 +4681,7 @@
 			info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp);
 		}
 		spin_unlock_irqrestore(&hdsp->lock, flags);
-		if (copy_to_user((void *)arg, &info, sizeof(info)))
+		if (copy_to_user(argp, &info, sizeof(info)))
 			return -EFAULT;
 		break;
 	}
@@ -4687,7 +4691,7 @@
 		if (hdsp->io_type != H9632) return -EINVAL;
 		h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS;
 		h9632_aeb.aebo = hdsp->ss_out_channels - H9632_SS_CHANNELS;
-		if (copy_to_user((void *)arg, &h9632_aeb, sizeof(h9632_aeb)))
+		if (copy_to_user(argp, &h9632_aeb, sizeof(h9632_aeb)))
 			return -EFAULT;
 		break;
 	}
@@ -4703,14 +4707,14 @@
 		}
 		hdsp_version.io_type = hdsp->io_type;
 		hdsp_version.firmware_rev = hdsp->firmware_rev;
-		if ((err = copy_to_user((void *)arg, &hdsp_version, sizeof(hdsp_version)))) {
+		if ((err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))) {
 		    	return -EFAULT;
 		}
 		break;
 	}
 	case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: {
-		hdsp_firmware_t *firmware;
-		unsigned long *firmware_data;
+		hdsp_firmware_t __user *firmware;
+		unsigned long __user *firmware_data;
 		int err;
 		
 		if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL;
@@ -4718,7 +4722,7 @@
 		if (hdsp->io_type == Undefined) return -EINVAL;
 
 		snd_printk("initializing firmware upload\n");
-		firmware = (hdsp_firmware_t *)arg;
+		firmware = (hdsp_firmware_t __user *)argp;
 
 		if (get_user(firmware_data, &firmware->firmware_data)) {
 			return -EFAULT;
@@ -4751,9 +4755,7 @@
 		break;
 	}
 	case SNDRV_HDSP_IOCTL_GET_MIXER: {
-		hdsp_mixer_t *mixer;
-		
-		mixer = (hdsp_mixer_t *)arg;
+		hdsp_mixer_t __user *mixer = (hdsp_mixer_t __user *)argp;
 		if (copy_to_user(mixer->matrix, hdsp->mixer_matrix, sizeof(unsigned short)*HDSP_MATRIX_MIXER_SIZE))
 			return -EFAULT;
 		break;
@@ -5018,6 +5020,7 @@
 		is_9652 = 1;
 		break;
 	case 0x96:
+	case 0x97:
 		hdsp->card_name = "RME HDSP 9632";
 		hdsp->max_channels = 16;
 		is_9632 = 1;
@@ -5198,14 +5201,7 @@
 
 static int __init alsa_card_hdsp_init(void)
 {
-	if (pci_module_init(&driver) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "RME Hammerfall-DSP: no cards found\n");
-#endif
-		return -ENODEV;
-	}
-
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_hdsp_exit(void)
@@ -5215,24 +5211,3 @@
 
 module_init(alsa_card_hdsp_init)
 module_exit(alsa_card_hdsp_exit)
-
-#ifndef MODULE
-
-/* format is: snd-hdsp=enable,index,id */
-
-static int __init alsa_card_hdsp_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-hdsp=", alsa_card_hdsp_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
--- a/sound/pci/rme9652/rme9652.c	Tue Jun 15 22:20:40 2004
+++ b/sound/pci/rme9652/rme9652.c	Tue Jun 15 22:20:40 2004
@@ -26,13 +26,13 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
 #include <sound/asoundef.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/current.h>
@@ -42,17 +42,18 @@
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
 static int precise_ptr[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* Enable precise pointer */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for RME Digi9652 (Hammerfall) soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for RME Digi9652 (Hammerfall) soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable/disable specific RME96{52,36} soundcards.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(precise_ptr, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(precise_ptr, bool, boot_devs, 0444);
 MODULE_PARM_DESC(precise_ptr, "Enable precise pointer (doesn't work reliably).");
 MODULE_PARM_SYNTAX(precise_ptr, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 MODULE_AUTHOR("Paul Davis <pbd@op.net>, Winfried Ritsch");
@@ -2010,7 +2011,7 @@
 }
 
 static int snd_rme9652_playback_copy(snd_pcm_substream_t *substream, int channel,
-				     snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count)
+				     snd_pcm_uframes_t pos, void __user *src, snd_pcm_uframes_t count)
 {
 	rme9652_t *rme9652 = _snd_pcm_substream_chip(substream);
 	char *channel_buf;
@@ -2027,7 +2028,7 @@
 }
 
 static int snd_rme9652_capture_copy(snd_pcm_substream_t *substream, int channel,
-				    snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count)
+				    snd_pcm_uframes_t pos, void __user *dst, snd_pcm_uframes_t count)
 {
 	rme9652_t *rme9652 = _snd_pcm_substream_chip(substream);
 	char *channel_buf;
@@ -2262,10 +2263,10 @@
 	rme9652_t *rme9652 = _snd_pcm_substream_chip(substream);
 	int result = 0;
 
-	spin_lock_irq(&rme9652->lock);
+	spin_lock(&rme9652->lock);
 	if (!rme9652->running)
 		rme9652_reset_hw_pointer(rme9652);
-	spin_unlock_irq(&rme9652->lock);
+	spin_unlock(&rme9652->lock);
 	return result;
 }
 
@@ -2748,14 +2749,7 @@
 
 static int __init alsa_card_hammerfall_init(void)
 {
-	if (pci_module_init(&driver) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "RME Digi9652/Digi9636: no cards found\n");
-#endif
-		return -ENODEV;
-	}
-
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_hammerfall_exit(void)
@@ -2765,24 +2759,3 @@
 
 module_init(alsa_card_hammerfall_init)
 module_exit(alsa_card_hammerfall_exit)
-
-#ifndef MODULE
-
-/* format is: snd-rme9652=enable,index,id */
-
-static int __init alsa_card_rme9652_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-rme9652=", alsa_card_rme9652_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
--- a/sound/pci/sonicvibes.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/sonicvibes.c	Tue Jun 15 22:20:42 2004
@@ -29,6 +29,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -36,7 +37,6 @@
 #include <sound/control.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/io.h>
@@ -60,23 +60,24 @@
 static int reverb[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 static int mge[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 static unsigned int dmaio = 0x7a00;	/* DDMA i/o address */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for S3 SonicVibes soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for S3 SonicVibes soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable S3 SonicVibes soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(reverb, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(reverb, bool, boot_devs, 0444);
 MODULE_PARM_DESC(reverb, "Enable reverb (SRAM is present) for S3 SonicVibes soundcard.");
 MODULE_PARM_SYNTAX(reverb, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
-MODULE_PARM(mge, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mge, bool, boot_devs, 0444);
 MODULE_PARM_DESC(mge, "MIC Gain Enable for S3 SonicVibes soundcard.");
 MODULE_PARM_SYNTAX(mge, SNDRV_ENABLED "," SNDRV_ENABLE_DESC);
-MODULE_PARM(dmaio, "i");
+module_param(dmaio, uint, 0444);
 MODULE_PARM_DESC(dmaio, "DDMA i/o base address for S3 SonicVibes soundcard.");
 MODULE_PARM_SYNTAX(dmaio, "global," SNDRV_PORT_DESC);
 
@@ -1535,15 +1536,7 @@
 
 static int __init alsa_card_sonicvibes_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "S3 SonicVibes soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_sonicvibes_exit(void)
@@ -1553,28 +1546,3 @@
 
 module_init(alsa_card_sonicvibes_init)
 module_exit(alsa_card_sonicvibes_exit)
-
-#ifndef MODULE
-
-/* format is: snd-sonicvibes=enable,index,id,
-			     reverb,mge,dmaio */
-
-static int __init alsa_card_sonicvibes_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&reverb[nr_dev]) == 2 &&
-	       get_option(&str,&mge[nr_dev]) == 2 &&
-	       get_option(&str,(int *)&dmaio) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-sonicvibes=", alsa_card_sonicvibes_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
--- a/sound/pci/trident/trident.c	Tue Jun 15 22:20:35 2004
+++ b/sound/pci/trident/trident.c	Tue Jun 15 22:20:35 2004
@@ -25,9 +25,9 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/time.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/trident.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, <audio@tridentmicro.com>");
@@ -52,20 +52,21 @@
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32};
 static int wavetable_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8192};
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Trident 4DWave PCI soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Trident 4DWave PCI soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Trident 4DWave PCI soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(pcm_channels, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pcm_channels, int, boot_devs, 0444);
 MODULE_PARM_DESC(pcm_channels, "Number of hardware channels assigned for PCM.");
 MODULE_PARM_SYNTAX(pcm_channels, SNDRV_ENABLED ",default:32,allows:{{1,32}}");
-MODULE_PARM(wavetable_size, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(wavetable_size, int, boot_devs, 0444);
 MODULE_PARM_DESC(wavetable_size, "Maximum memory size in kB for wavetable synth.");
 MODULE_PARM_SYNTAX(wavetable_size, SNDRV_ENABLED ",default:8192,skill:advanced");
 
@@ -169,56 +170,28 @@
 		snd_card_free(card);
 		return err;
 	}
-	pci_set_drvdata(pci, trident);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
 static void __devexit snd_trident_remove(struct pci_dev *pci)
 {
-	trident_t *trident = snd_magic_cast(trident_t, pci_get_drvdata(pci), return);
-	if (trident)
-		snd_card_free(trident->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
-#ifdef CONFIG_PM
-static int snd_card_trident_suspend(struct pci_dev *pci, u32 state)
-{
-	trident_t *chip = snd_magic_cast(trident_t, pci_get_drvdata(pci), return -ENXIO);
-	snd_trident_suspend(chip);
-	return 0;
-}
-static int snd_card_trident_resume(struct pci_dev *pci)
-{
-	trident_t *chip = snd_magic_cast(trident_t, pci_get_drvdata(pci), return -ENXIO);
-	snd_trident_resume(chip);
-	return 0;
-}
-#endif
-
 static struct pci_driver driver = {
 	.name = "Trident4DWaveAudio",
 	.id_table = snd_trident_ids,
 	.probe = snd_trident_probe,
 	.remove = __devexit_p(snd_trident_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_card_trident_suspend,
-	.resume = snd_card_trident_resume,
-#endif
+	SND_PCI_PM_CALLBACKS
 };
 
 static int __init alsa_card_trident_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Trident 4DWave PCI soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_trident_exit(void)
@@ -228,27 +201,3 @@
 
 module_init(alsa_card_trident_init)
 module_exit(alsa_card_trident_exit)
-
-#ifndef MODULE
-
-/* format is: snd-trident=enable,index,id,
-			  pcm_channels,wavetable_size */
-
-static int __init alsa_card_trident_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option(&str,&pcm_channels[nr_dev]) == 2 &&
-	       get_option(&str,&wavetable_size[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-trident=", alsa_card_trident_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
--- a/sound/pci/trident/trident_main.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/trident/trident_main.c	Tue Jun 15 22:20:42 2004
@@ -50,7 +50,8 @@
 static int snd_trident_pcm_mixer_free(trident_t *trident, snd_trident_voice_t * voice, snd_pcm_substream_t *substream);
 static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 #ifdef CONFIG_PM
-static int snd_trident_set_power_state(snd_card_t *card, unsigned int power_state);
+static int snd_trident_suspend(snd_card_t *card, unsigned int state);
+static int snd_trident_resume(snd_card_t *card, unsigned int state);
 #endif
 static int snd_trident_sis_reset(trident_t *trident);
 
@@ -3646,10 +3647,8 @@
 
 	snd_trident_enable_eso(trident);
 
-#ifdef CONFIG_PM
-	card->set_power_state = snd_trident_set_power_state;
-	card->power_state_private_data = trident;
-#endif
+	
+	snd_card_set_pm_callback(card, snd_trident_suspend, snd_trident_resume, trident);
 
 	snd_trident_proc_init(trident);
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, trident, &ops)) < 0) {
@@ -3949,19 +3948,21 @@
 }
 
 #ifdef CONFIG_PM
-
-void snd_trident_suspend(trident_t *trident)
+static int snd_trident_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = trident->card;
+	trident_t *trident = snd_magic_cast(trident_t, card->pm_private_data, return -EINVAL);
 
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
 	trident->in_suspend = 1;
 	snd_pcm_suspend_all(trident->pcm);
 	if (trident->foldback)
 		snd_pcm_suspend_all(trident->foldback);
 	if (trident->spdif)
 		snd_pcm_suspend_all(trident->spdif);
+
+	snd_ac97_suspend(trident->ac97);
+	if (trident->ac97_sec)
+		snd_ac97_suspend(trident->ac97_sec);
+
 	switch (trident->device) {
 	case TRIDENT_DEVICE_ID_DX:
 	case TRIDENT_DEVICE_ID_NX:
@@ -3970,14 +3971,12 @@
 		break;
 	}
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-void snd_trident_resume(trident_t *trident)
+static int snd_trident_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = trident->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
+	trident_t *trident = snd_magic_cast(trident_t, card->pm_private_data, return -EINVAL);
 
 	pci_enable_device(trident->pci);
 	if (pci_set_dma_mask(trident->pci, 0x3fffffff) < 0 ||
@@ -3998,6 +3997,8 @@
 	}
 
 	snd_ac97_resume(trident->ac97);
+	if (trident->ac97_sec)
+		snd_ac97_resume(trident->ac97_sec);
 
 	/* restore some registers */
 	outl(trident->musicvol_wavevol, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL));
@@ -4006,28 +4007,8 @@
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 	trident->in_suspend = 0;
+	return 0;
 }
-
-static int snd_trident_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	trident_t *chip = snd_magic_cast(trident_t, card->power_state_private_data, return -ENXIO);
-        
-	switch (power_state) {
-        case SNDRV_CTL_POWER_D0:
-        case SNDRV_CTL_POWER_D1:
-        case SNDRV_CTL_POWER_D2:
-        	snd_trident_resume(chip);
-                break;
-	case SNDRV_CTL_POWER_D3hot:
-        case SNDRV_CTL_POWER_D3cold:
-		snd_trident_suspend(chip);
-		break;
-        default:
-	        return -EINVAL;
-        }
-        return 0;
-}
-
 #endif /* CONFIG_PM */
 
 EXPORT_SYMBOL(snd_trident_alloc_voice);
diff -Nru a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c
--- a/sound/pci/trident/trident_memory.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pci/trident/trident_memory.c	Tue Jun 15 22:20:42 2004
@@ -471,7 +471,7 @@
 /*
  * copy_from_user(blk + offset, data, size)
  */
-int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char *data, int size)
+int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size)
 {
 	int page, nextofs, end_offset, temp, temp1;
 
diff -Nru a/sound/pci/trident/trident_synth.c b/sound/pci/trident/trident_synth.c
--- a/sound/pci/trident/trident_synth.c	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/trident/trident_synth.c	Tue Jun 15 22:20:39 2004
@@ -504,7 +504,7 @@
  */
 
 static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t * instr,
-					 char *data, long len, int atomic)
+					 char __user *data, long len, int atomic)
 {
 	trident_t *trident = snd_magic_cast(trident_t, private_data, return -ENXIO);
 	int size = instr->size;
@@ -557,7 +557,7 @@
 }
 
 static int snd_trident_simple_get_sample(void *private_data, simple_instrument_t * instr,
-					 char *data, long len, int atomic)
+					 char __user *data, long len, int atomic)
 {
 	//trident_t *trident = snd_magic_cast(trident_t, private_data, return -ENXIO);
 	int size = instr->size;
diff -Nru a/sound/pci/via82xx.c b/sound/pci/via82xx.c
--- a/sound/pci/via82xx.c	Tue Jun 15 22:20:44 2004
+++ b/sound/pci/via82xx.c	Tue Jun 15 22:20:44 2004
@@ -51,13 +51,13 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/info.h>
 #include <sound/ac97_codec.h>
 #include <sound/mpu401.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #if 0
@@ -84,31 +84,32 @@
 static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
 static int ac97_quirk[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = AC97_TUNE_DEFAULT};
 static int dxs_support[SNDRV_CARDS];
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for VIA 82xx bridge.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable audio part of VIA 82xx bridge.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 port. (VT82C686x only)");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_PORT_DESC);
 #ifdef SUPPORT_JOYSTICK
-MODULE_PARM(joystick, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(joystick, bool, boot_devs, 0444);
 MODULE_PARM_DESC(joystick, "Enable joystick. (VT82C686x only)");
 MODULE_PARM_SYNTAX(joystick, SNDRV_ENABLE_DESC "," SNDRV_BOOLEAN_FALSE_DESC);
 #endif
-MODULE_PARM(ac97_clock, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ac97_clock, int, boot_devs, 0444);
 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
 MODULE_PARM_SYNTAX(ac97_clock, SNDRV_ENABLED ",default:48000");
-MODULE_PARM(ac97_quirk, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ac97_quirk, int, boot_devs, 0444);
 MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
 MODULE_PARM_SYNTAX(ac97_quirk, SNDRV_ENABLED ",allows:{{-1,4}},dialog:list,default:-1");
-MODULE_PARM(dxs_support, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(dxs_support, int, boot_devs, 0444);
 MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA)");
 MODULE_PARM_SYNTAX(dxs_support, SNDRV_ENABLED ",allows:{{0,4}},dialog:list");
 
@@ -368,6 +369,14 @@
 
 	unsigned char old_legacy;
 	unsigned char old_legacy_cfg;
+#ifdef CONFIG_PM
+	unsigned char legacy_saved;
+	unsigned char legacy_cfg_saved;
+	unsigned char spdif_ctrl_saved;
+	unsigned char capture_src_saved[2];
+	unsigned int mpu_port_saved;
+	u32 pci_state[16];
+#endif
 
 	unsigned char playback_volume[4][2]; /* for VIA8233/C/8235; default = 0 */
 
@@ -384,6 +393,7 @@
 	unsigned int no_vra: 1;		/* no need to set VRA on DXS channels */
 	unsigned int spdif_on: 1;	/* only spdif rates work to external DACs */
 
+	snd_pcm_t *pcms[2];
 	snd_rawmidi_t *rmidi;
 
 	ac97_bus_t *ac97_bus;
@@ -1289,6 +1299,7 @@
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
 	pcm->private_data = chip;
 	strcpy(pcm->name, chip->card->shortname);
+	chip->pcms[0] = pcm;
 	/* set up playbacks */
 	for (i = 0; i < 4; i++)
 		init_viadev(chip, i, 0x10 * i, 0);
@@ -1307,6 +1318,7 @@
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
 	pcm->private_data = chip;
 	strcpy(pcm->name, chip->card->shortname);
+	chip->pcms[1] = pcm;
 	/* set up playback */
 	init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 0);
 	/* set up capture */
@@ -1341,6 +1353,7 @@
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via8233_capture_ops);
 	pcm->private_data = chip;
 	strcpy(pcm->name, chip->card->shortname);
+	chip->pcms[0] = pcm;
 	/* set up playback */
 	init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 0);
 	/* capture */
@@ -1357,6 +1370,7 @@
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via8233_playback_ops);
 	pcm->private_data = chip;
 	strcpy(pcm->name, chip->card->shortname);
+	chip->pcms[1] = pcm;
 	/* set up playback */
 	init_viadev(chip, chip->playback_devno, 0x30, 0);
 
@@ -1387,6 +1401,7 @@
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via686_capture_ops);
 	pcm->private_data = chip;
 	strcpy(pcm->name, chip->card->shortname);
+	chip->pcms[0] = pcm;
 	init_viadev(chip, 0, VIA_REG_PLAYBACK_STATUS, 0);
 	init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 1);
 
@@ -1404,8 +1419,11 @@
 
 static int snd_via8233_capture_source_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
 {
+	/* formerly they were "Line" and "Mic", but it looks like that they
+	 * have nothing to do with the actual physical connections...
+	 */
 	static char *texts[2] = {
-		"Line", "Mic"
+		"Input1", "Input2"
 	};
 	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
 	uinfo->count = 1;
@@ -1584,6 +1602,12 @@
 		.name = "Mitac Mobo",
 		.type = AC97_TUNE_ALC_JACK
 	},
+	{
+		.vendor = 0x161f,
+		.device = 0x202b,
+		.name = "Arima Notebook",
+		.type = AC97_TUNE_HP_ONLY,
+	},
 	{ } /* terminator */
 };
 
@@ -1667,6 +1691,9 @@
 		if (mpu_port[dev] >= 0x200) {	/* force MIDI */
 			mpu_port[dev] &= 0xfffc;
 			pci_write_config_dword(chip->pci, 0x18, mpu_port[dev] | 0x01);
+#ifdef CONFIG_PM
+			chip->mpu_port_saved = mpu_port[dev];
+#endif
 		} else {
 			mpu_port[dev] = pci_resource_start(chip->pci, 2);
 		}
@@ -1725,6 +1752,11 @@
 		gameport_register_port(&chip->gameport);
 #endif
 
+#ifdef CONFIG_PM
+	chip->legacy_saved = legacy;
+	chip->legacy_cfg_saved = legacy_cfg;
+#endif
+
 	return 0;
 }
 
@@ -1865,6 +1897,74 @@
 	return 0;
 }
 
+#ifdef CONFIG_PM
+/*
+ * power management
+ */
+static int snd_via82xx_suspend(snd_card_t *card, unsigned int state)
+{
+	via82xx_t *chip = snd_magic_cast(via82xx_t, card->pm_private_data, return -EINVAL);
+	int i;
+
+	for (i = 0; i < 2; i++)
+		if (chip->pcms[i])
+			snd_pcm_suspend_all(chip->pcms[i]);
+	for (i = 0; i < chip->num_devs; i++)
+		snd_via82xx_channel_reset(chip, &chip->devs[i]);
+	synchronize_irq(chip->irq);
+	snd_ac97_suspend(chip->ac97);
+
+	/* save misc values */
+	if (chip->chip_type != TYPE_VIA686) {
+		pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &chip->spdif_ctrl_saved);
+		chip->capture_src_saved[0] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL);
+		chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10);
+	}
+
+	pci_save_state(chip->pci, chip->pci_state);
+	pci_set_power_state(chip->pci, 3);
+	pci_disable_device(chip->pci);
+	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
+}
+
+static int snd_via82xx_resume(snd_card_t *card, unsigned int state)
+{
+	via82xx_t *chip = snd_magic_cast(via82xx_t, card->pm_private_data, return -EINVAL);
+	int idx, i;
+
+	pci_enable_device(chip->pci);
+	pci_restore_state(chip->pci, chip->pci_state);
+	pci_set_power_state(chip->pci, 0);
+
+	snd_via82xx_chip_init(chip);
+
+	if (chip->chip_type == TYPE_VIA686) {
+		if (chip->mpu_port_saved)
+			pci_write_config_dword(chip->pci, 0x18, chip->mpu_port_saved | 0x01);
+		pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, chip->legacy_saved);
+		pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, chip->legacy_cfg_saved);
+	} else {
+		pci_write_config_byte(chip->pci, VIA8233_SPDIF_CTRL, chip->spdif_ctrl_saved);
+		outb(chip->capture_src_saved[0], chip->port + VIA_REG_CAPTURE_CHANNEL);
+		outb(chip->capture_src_saved[1], chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10);
+		for (idx = 0; idx < 4; idx++) {
+			unsigned long port = chip->port + 0x10 * idx;
+			for (i = 0; i < 2; i++)
+				outb(chip->playback_volume[idx][i], port + VIA_REG_OFS_PLAYBACK_VOLUME_L + i);
+		}
+	}
+
+	snd_ac97_resume(chip->ac97);
+
+	for (i = 0; i < chip->num_devs; i++)
+		snd_via82xx_channel_reset(chip, &chip->devs[i]);
+
+	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+	return 0;
+}
+#endif /* CONFIG_PM */
+
 static int snd_via82xx_free(via82xx_t *chip)
 {
 	unsigned int i;
@@ -2010,7 +2110,8 @@
 	static struct dxs_whitelist whitelist[] = {
 		{ .vendor = 0x1005, .device = 0x4710, .action = VIA_DXS_ENABLE }, /* Avance Logic Mobo */
 		{ .vendor = 0x1019, .device = 0x0996, .action = VIA_DXS_48K },
-		{ .vendor = 0x1043, .device = 0x8095, .action = VIA_DXS_ENABLE }, /* ASUS A7V8X */
+		{ .vendor = 0x1019, .device = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */
+		{ .vendor = 0x1043, .device = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/
 		{ .vendor = 0x1043, .device = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */
 		{ .vendor = 0x1043, .device = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/ 
 		{ .vendor = 0x10cf, .device = 0x118e, .action = VIA_DXS_ENABLE }, /* FSC laptop */
@@ -2025,6 +2126,8 @@
 		{ .vendor = 0x1462, .device = 0x7120, .action = VIA_DXS_ENABLE }, /* MSI KT4V */
 		{ .vendor = 0x1462, .device = 0x5901, .action = VIA_DXS_NO_VRA }, /* MSI KT6 Delta-SR */
 		{ .vendor = 0x1584, .device = 0x8120, .action = VIA_DXS_ENABLE }, /* Gericom/Targa/Vobis/Uniwill laptop */
+		{ .vendor = 0x161f, .device = 0x202b, .action = VIA_DXS_NO_VRA }, /* Amira Note book */
+		{ .vendor = 0x161f, .device = 0x2032, .action = VIA_DXS_48K }, /* m680x machines */
 		{ .vendor = 0x1631, .device = 0xe004, .action = VIA_DXS_ENABLE }, /* Easy Note 3174, Packard Bell */
 		{ .vendor = 0x1695, .device = 0x3005, .action = VIA_DXS_ENABLE }, /* EPoX EP-8K9A */
 		{ .vendor = 0x1849, .device = 0x3059, .action = VIA_DXS_NO_VRA }, /* ASRock K7VM2 */
@@ -2145,6 +2248,9 @@
 		if ((err = snd_via8233_init_misc(chip, dev)) < 0)
 			goto __error;
 	}
+
+	snd_card_set_pm_callback(card, snd_via82xx_suspend, snd_via82xx_resume, chip);
+
 	/* disable interrupts */
 	for (i = 0; i < chip->num_devs; i++)
 		snd_via82xx_channel_reset(chip, &chip->devs[i]);
@@ -2178,19 +2284,12 @@
 	.id_table = snd_via82xx_ids,
 	.probe = snd_via82xx_probe,
 	.remove = __devexit_p(snd_via82xx_remove),
+	SND_PCI_PM_CALLBACKS
 };
 
 static int __init alsa_card_via82xx_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "VIA 82xx soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_via82xx_exit(void)
@@ -2200,33 +2299,3 @@
 
 module_init(alsa_card_via82xx_init)
 module_exit(alsa_card_via82xx_exit)
-
-#ifndef MODULE
-
-/* format is: snd-via82xx=enable,index,id,
-			  mpu_port,joystick,
-			  ac97_quirk,ac97_clock,dxs_support */
-
-static int __init alsa_card_via82xx_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2 &&
-#ifdef SUPPORT_JOYSTICK
-	       get_option(&str,&joystick[nr_dev]) == 2 &&
-#endif
-	       get_option(&str,&ac97_quirk[nr_dev]) == 2 &&
-	       get_option(&str,&ac97_clock[nr_dev]) == 2 &&
-	       get_option(&str,&dxs_support[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-via82xx=", alsa_card_via82xx_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
--- a/sound/pci/vx222/vx222.c	Tue Jun 15 22:20:41 2004
+++ b/sound/pci/vx222/vx222.c	Tue Jun 15 22:20:41 2004
@@ -23,8 +23,8 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include "vx222.h"
 
@@ -43,20 +43,21 @@
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
 static int mic[SNDRV_CARDS]; /* microphone */
 static int ibl[SNDRV_CARDS]; /* microphone */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Digigram " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Digigram " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(mic, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(mic, bool, boot_devs, 0444);
 MODULE_PARM_DESC(mic, "Enable Microphone.");
 MODULE_PARM_SYNTAX(mic, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
-MODULE_PARM(ibl, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ibl, int, boot_devs, 0444);
 MODULE_PARM_DESC(ibl, "Capture IBL size.");
 MODULE_PARM_SYNTAX(ibl, SNDRV_ENABLED);
 
@@ -272,15 +273,7 @@
 
 static int __init alsa_card_vx222_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Digigram VX222 soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_vx222_exit(void)
@@ -290,24 +283,3 @@
 
 module_init(alsa_card_vx222_init)
 module_exit(alsa_card_vx222_exit)
-
-#ifndef MODULE
-
-/* format is: snd-vx222=enable,index,id */
-
-static int __init alsa_card_vx222_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-vx222=", alsa_card_vx222_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
--- a/sound/pci/vx222/vx222_ops.c	Tue Jun 15 22:20:36 2004
+++ b/sound/pci/vx222/vx222_ops.c	Tue Jun 15 22:20:36 2004
@@ -357,7 +357,8 @@
 {
 	unsigned int i;
 	unsigned int port;
-	unsigned char *image, data;
+	unsigned char data;
+	unsigned char __user *image;
 
 	/* XILINX reset (wait at least 1 milisecond between reset on and off). */
 	vx_outl(chip, CNTRL, VX_CNTRL_REGISTER_VALUE | VX_XILINX_RESET_MASK);
diff -Nru a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
--- a/sound/pci/ymfpci/ymfpci.c	Tue Jun 15 22:20:39 2004
+++ b/sound/pci/ymfpci/ymfpci.c	Tue Jun 15 22:20:39 2004
@@ -23,11 +23,11 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/time.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/ymfpci.h>
 #include <sound/mpu401.h>
 #include <sound/opl3.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -50,28 +50,29 @@
 static long joystick_port[SNDRV_CARDS];
 #endif
 static int rear_switch[SNDRV_CARDS];
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for the Yamaha DS-XG PCI soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for the Yamaha DS-XG PCI soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Yamaha DS-XG soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(mpu_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(mpu_port, "MPU-401 Port.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_ENABLED);
-MODULE_PARM(fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(fm_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(fm_port, "FM OPL-3 Port.");
 MODULE_PARM_SYNTAX(fm_port, SNDRV_ENABLED);
 #ifdef SUPPORT_JOYSTICK
-MODULE_PARM(joystick_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
+module_param_array(joystick_port, long, boot_devs, 0444);
 MODULE_PARM_DESC(joystick_port, "Joystick port address");
 MODULE_PARM_SYNTAX(joystick_port, SNDRV_ENABLED);
 #endif
-MODULE_PARM(rear_switch, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(rear_switch, bool, boot_devs, 0444);
 MODULE_PARM_DESC(rear_switch, "Enable shared rear/line-in switch");
 MODULE_PARM_SYNTAX(rear_switch, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 
@@ -311,31 +312,14 @@
 		snd_card_free(card);
 		return err;
 	}
-	pci_set_drvdata(pci, chip);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int snd_card_ymfpci_suspend(struct pci_dev *pci, u32 state)
-{
-	ymfpci_t *chip = snd_magic_cast(ymfpci_t, pci_get_drvdata(pci), return -ENXIO);
-	snd_ymfpci_suspend(chip);
-	return 0;
-}
-static int snd_card_ymfpci_resume(struct pci_dev *pci)
-{
-	ymfpci_t *chip = snd_magic_cast(ymfpci_t, pci_get_drvdata(pci), return -ENXIO);
-	snd_ymfpci_resume(chip);
-	return 0;
-}
-#endif
-
 static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci)
 {
-	ymfpci_t *chip = snd_magic_cast(ymfpci_t, pci_get_drvdata(pci), return);
-	if (chip)
-		snd_card_free(chip->card);
+	snd_card_free(pci_get_drvdata(pci));
 	pci_set_drvdata(pci, NULL);
 }
 
@@ -344,23 +328,12 @@
 	.id_table = snd_ymfpci_ids,
 	.probe = snd_card_ymfpci_probe,
 	.remove = __devexit_p(snd_card_ymfpci_remove),
-#ifdef CONFIG_PM
-	.suspend = snd_card_ymfpci_suspend,
-	.resume = snd_card_ymfpci_resume,
-#endif	
+	SND_PCI_PM_CALLBACKS
 };
 
 static int __init alsa_card_ymfpci_init(void)
 {
-	int err;
-
-	if ((err = pci_module_init(&driver)) < 0) {
-#ifdef MODULE
-		printk(KERN_ERR "Yamaha DS-XG PCI soundcard not found or device busy\n");
-#endif
-		return err;
-	}
-	return 0;
+	return pci_module_init(&driver);
 }
 
 static void __exit alsa_card_ymfpci_exit(void)
@@ -370,27 +343,3 @@
 
 module_init(alsa_card_ymfpci_init)
 module_exit(alsa_card_ymfpci_exit)
-
-#ifndef MODULE
-
-/* format is: snd-ymfpci=enable,index,id,
-			 fm_port,mpu_port */
-
-static int __init alsa_card_ymfpci_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&enable[nr_dev]) == 2 &&
-	       get_option(&str,&index[nr_dev]) == 2 &&
-	       get_id(&str,&id[nr_dev]) == 2 &&
-	       get_option_long(&str,&fm_port[nr_dev]) == 2 &&
-	       get_option_long(&str,&mpu_port[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-ymfpci=", alsa_card_ymfpci_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
--- a/sound/pci/ymfpci/ymfpci_main.c	Tue Jun 15 22:20:44 2004
+++ b/sound/pci/ymfpci/ymfpci_main.c	Tue Jun 15 22:20:44 2004
@@ -2157,33 +2157,30 @@
 };
 #define YDSXGR_NUM_SAVED_REGS	ARRAY_SIZE(saved_regs_index)
 
-void snd_ymfpci_suspend(ymfpci_t *chip)
+static int snd_ymfpci_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	ymfpci_t *chip = snd_magic_cast(ymfpci_t, card->pm_private_data, return -EINVAL);
 	unsigned int i;
 	
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
 	snd_pcm_suspend_all(chip->pcm);
 	snd_pcm_suspend_all(chip->pcm2);
 	snd_pcm_suspend_all(chip->pcm_spdif);
 	snd_pcm_suspend_all(chip->pcm_4ch);
+	snd_ac97_suspend(chip->ac97);
 	for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
 		chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]);
 	chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE);
 	snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
 	snd_ymfpci_disable_dsp(chip);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-void snd_ymfpci_resume(ymfpci_t *chip)
+static int snd_ymfpci_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	ymfpci_t *chip = snd_magic_cast(ymfpci_t, card->pm_private_data, return -EINVAL);
 	unsigned int i;
 
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
-
 	pci_enable_device(chip->pci);
 	pci_set_master(chip->pci);
 	snd_ymfpci_aclink_reset(chip->pci);
@@ -2205,25 +2202,6 @@
 		spin_unlock_irqrestore(&chip->reg_lock, flags);
 	}
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-static int snd_ymfpci_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	ymfpci_t *chip = snd_magic_cast(ymfpci_t, card->power_state_private_data, return -ENXIO);
-
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		snd_ymfpci_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		snd_ymfpci_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
 #endif /* CONFIG_PM */
@@ -2304,8 +2282,7 @@
 		snd_ymfpci_free(chip);
 		return -ENOMEM;
 	}
-	card->set_power_state = snd_ymfpci_set_power_state;
-	card->power_state_private_data = chip;
+	snd_card_set_pm_callback(card, snd_ymfpci_suspend, snd_ymfpci_resume, chip);
 #endif
 
 	snd_ymfpci_proc_init(card, chip);
diff -Nru a/sound/pcmcia/Kconfig b/sound/pcmcia/Kconfig
--- a/sound/pcmcia/Kconfig	Tue Jun 15 22:20:40 2004
+++ b/sound/pcmcia/Kconfig	Tue Jun 15 22:20:40 2004
@@ -20,6 +20,7 @@
 config SND_PDAUDIOCF
 	tristate "Sound Core PDAudioCF"
 	depends on SND && PCMCIA && ISA
+	select SND_PCM
 	help
 	  Say 'Y' or 'M' to include support for Sound Core PDAudioCF soundcard.
 
diff -Nru a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c	Tue Jun 15 22:20:38 2004
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c	Tue Jun 15 22:20:38 2004
@@ -21,6 +21,7 @@
 #include <sound/driver.h>
 #include <sound/core.h>
 #include <linux/slab.h>
+#include <linux/moduleparam.h>
 #include <pcmcia/version.h>
 #include <pcmcia/ciscode.h>
 #include <pcmcia/cisreg.h>
@@ -44,19 +45,20 @@
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable switches */
 static unsigned int irq_mask = 0xffff;
 static int irq_list[4] = { -1 };
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(irq_mask, "i");
+module_param(irq_mask, int, 0444);
 MODULE_PARM_DESC(irq_mask, "IRQ bitmask for " CARD_NAME " soundcard.");
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq_list, "List of Available interrupts for " CARD_NAME " soundcard.");
  
 
@@ -242,10 +244,7 @@
 	if (err < 0)
 		return err;
 
-#ifdef CONFIG_PM
-	card->power_state_private_data = pdacf;
-	card->set_power_state = snd_pdacf_set_power_state;
-#endif
+	snd_card_set_pm_callback(card, snd_pdacf_suspend, snd_pdacf_resume, pdacf);
 
 	if ((err = snd_card_register(card)) < 0)
 		return err;
@@ -370,7 +369,7 @@
 		link->state |= DEV_SUSPEND;
 		if (chip) {
 			snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n");
-			snd_pdacf_suspend(chip);
+			snd_pdacf_suspend(chip->card, 0);
 		}
 		/* Fall through... */
 	case CS_EVENT_RESET_PHYSICAL:
@@ -389,7 +388,7 @@
 			pcmcia_request_configuration(link->handle, &link->conf);
 			if (chip) {
 				snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n");
-				snd_pdacf_resume(chip);
+				snd_pdacf_resume(chip->card, 0);
 			}
 		}
 		snd_printdd(KERN_DEBUG "resume done!\n");
diff -Nru a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.h	Tue Jun 15 22:20:36 2004
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h	Tue Jun 15 22:20:36 2004
@@ -136,12 +136,11 @@
 int snd_pdacf_ak4117_create(pdacf_t *pdacf);
 void snd_pdacf_powerdown(pdacf_t *chip);
 #ifdef CONFIG_PM
-void snd_pdacf_suspend(pdacf_t *chip);
-void snd_pdacf_resume(pdacf_t *chip);
-int snd_pdacf_set_power_state(snd_card_t *card, unsigned int power_state);
+int snd_pdacf_suspend(snd_card_t *card, unsigned int state);
+int snd_pdacf_resume(snd_card_t *card, unsigned int state);
 #endif
 int snd_pdacf_pcm_new(pdacf_t *chip);
-void pdacf_interrupt(int irq, void *dev, struct pt_regs *regs);
+irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs);
 void pdacf_tasklet(unsigned long private_data);
 void pdacf_reinit(pdacf_t *chip, int resume);
 
diff -Nru a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c	Tue Jun 15 22:20:38 2004
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c	Tue Jun 15 22:20:38 2004
@@ -255,13 +255,11 @@
 
 #ifdef CONFIG_PM
 
-void snd_pdacf_suspend(pdacf_t *chip)
+int snd_pdacf_suspend(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	pdacf_t *chip = snd_magic_cast(pdacf_t, card->pm_private_data, return -EINVAL);
 	u16 val;
 	
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
 	snd_pcm_suspend_all(chip->pcm);
 	/* disable interrupts, but use direct write to preserve old register value in chip->regmap */
 	val = inw(chip->port + PDAUDIOCF_REG_IER);
@@ -270,6 +268,7 @@
 	chip->chip_status |= PDAUDIOCF_STAT_IS_SUSPENDED;	/* ignore interrupts from now */
 	snd_pdacf_powerdown(chip);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
 static inline int check_signal(pdacf_t *chip)
@@ -277,13 +276,11 @@
 	return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0;
 }
 
-void snd_pdacf_resume(pdacf_t *chip)
+int snd_pdacf_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
+	pdacf_t *chip = snd_magic_cast(pdacf_t, card->pm_private_data, return -EINVAL);
 	int timeout = 40;
 
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
 	pdacf_reinit(chip, 1);
 	/* wait for AK4117's PLL */
 	while (timeout-- > 0 &&
@@ -291,26 +288,6 @@
 		mdelay(1);
 	chip->chip_status &= ~PDAUDIOCF_STAT_IS_SUSPENDED;
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-}
-
-int snd_pdacf_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	pdacf_t *chip = snd_magic_cast(pdacf_t, card->power_state_private_data, return -ENXIO);
-
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		snd_pdacf_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		snd_pdacf_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
-
 #endif
diff -Nru a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c	Tue Jun 15 22:20:42 2004
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c	Tue Jun 15 22:20:42 2004
@@ -26,15 +26,15 @@
 /*
  *
  */
-void pdacf_interrupt(int irq, void *dev, struct pt_regs *regs)
+irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs)
 {
-	pdacf_t *chip = snd_magic_cast(pdacf_t, dev, return);
+	pdacf_t *chip = snd_magic_cast(pdacf_t, dev, return IRQ_NONE);
 	unsigned short stat;
 
 	if ((chip->chip_status & (PDAUDIOCF_STAT_IS_STALE|
 				  PDAUDIOCF_STAT_IS_CONFIGURED|
 				  PDAUDIOCF_STAT_IS_SUSPENDED)) != PDAUDIOCF_STAT_IS_CONFIGURED)
-		return;
+		return IRQ_HANDLED;	/* IRQ_NONE here? */
 
 	stat = inw(chip->port + PDAUDIOCF_REG_ISR);
 	if (stat & (PDAUDIOCF_IRQLVL|PDAUDIOCF_IRQOVR)) {
@@ -47,6 +47,7 @@
 	}
 	if (regs != NULL)
 		snd_ak4117_check_rate_and_errors(chip->ak4117, 0);
+	return IRQ_HANDLED;
 }
 
 static inline void pdacf_transfer_mono16(u16 *dst, u16 xor, unsigned int size, unsigned long rdp_port)
diff -Nru a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c
--- a/sound/pcmcia/vx/vxp_ops.c	Tue Jun 15 22:20:38 2004
+++ b/sound/pcmcia/vx/vxp_ops.c	Tue Jun 15 22:20:38 2004
@@ -152,7 +152,8 @@
 	unsigned int i;
 	int c;
 	int regCSUER, regRUER;
-	unsigned char *image, data;
+	unsigned char __user *image;
+	unsigned char data;
 
 	/* Switch to programmation mode */
 	chip->regDIALOG |= VXP_DLG_XILINX_REPROG_MASK;
diff -Nru a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
--- a/sound/pcmcia/vx/vxpocket.c	Tue Jun 15 22:20:37 2004
+++ b/sound/pcmcia/vx/vxpocket.c	Tue Jun 15 22:20:37 2004
@@ -32,6 +32,7 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <pcmcia/version.h>
 #include "vxpocket.h"
@@ -58,21 +59,22 @@
 static unsigned int irq_mask = 0xffff;
 static int irq_list[4] = { -1 };
 static int ibl[SNDRV_CARDS];
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(irq_mask, "i");
+module_param(irq_mask, int, 0444);
 MODULE_PARM_DESC(irq_mask, "IRQ bitmask for " CARD_NAME " soundcard.");
-MODULE_PARM(irq_list, "1-4i");
+module_param_array(irq_list, int, boot_devs, 0444);
 MODULE_PARM_DESC(irq_list, "List of Available interrupts for " CARD_NAME " soundcard.");
-MODULE_PARM(ibl, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(ibl, int, boot_devs, 0444);
 MODULE_PARM_DESC(ibl, "Capture IBL size for " CARD_NAME " soundcard.");
 MODULE_PARM_SYNTAX(ibl, SNDRV_ENABLED);
  
diff -Nru a/sound/ppc/keywest.c b/sound/ppc/keywest.c
--- a/sound/ppc/keywest.c	Tue Jun 15 22:21:03 2004
+++ b/sound/ppc/keywest.c	Tue Jun 15 22:21:03 2004
@@ -79,12 +79,7 @@
 
 	new_client->id = keywest_ctx->id++; /* Automatically unique */
 	keywest_ctx->client = new_client;
-
-	if ((err = keywest_ctx->init_client(keywest_ctx)) < 0) {
-		snd_printk(KERN_ERR "tumbler: cannot initialize the MCS\n");
-		goto __err;
-	}
-
+	
 	/* Tell the i2c layer a new client has arrived */
 	if (i2c_attach_client(new_client)) {
 		snd_printk(KERN_ERR "tumbler: cannot attach i2c client\n");
@@ -119,6 +114,17 @@
 		i2c_del_driver(&keywest_driver);
 		keywest_ctx = NULL;
 	}
+}
+
+int __init snd_pmac_tumbler_post_init(void)
+{
+	int err;
+	
+	if ((err = keywest_ctx->init_client(keywest_ctx)) < 0) {
+		snd_printk(KERN_ERR "tumbler: %i :cannot initialize the MCS\n", err);
+		return err;
+	}
+	return 0;
 }
 
 /* exported */
diff -Nru a/sound/ppc/pmac.c b/sound/ppc/pmac.c
--- a/sound/ppc/pmac.c	Tue Jun 15 22:21:05 2004
+++ b/sound/ppc/pmac.c	Tue Jun 15 22:21:05 2004
@@ -42,7 +42,8 @@
 #if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK)
 static int snd_pmac_register_sleep_notifier(pmac_t *chip);
 static int snd_pmac_unregister_sleep_notifier(pmac_t *chip);
-static int snd_pmac_set_power_state(snd_card_t *card, unsigned int power_state);
+static int snd_pmac_suspend(snd_card_t *card, unsigned int state);
+static int snd_pmac_resume(snd_card_t *card, unsigned int state);
 #endif
 
 
@@ -687,7 +688,7 @@
 static irqreturn_t
 snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs)
 {
-	pmac_t *chip = snd_magic_cast(pmac_t, devid, return);
+	pmac_t *chip = snd_magic_cast(pmac_t, devid, return IRQ_NONE);
 	snd_pmac_pcm_update(chip, &chip->playback);
 	return IRQ_HANDLED;
 }
@@ -696,7 +697,7 @@
 static irqreturn_t
 snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs)
 {
-	pmac_t *chip = snd_magic_cast(pmac_t, devid, return);
+	pmac_t *chip = snd_magic_cast(pmac_t, devid, return IRQ_NONE);
 	snd_pmac_pcm_update(chip, &chip->capture);
 	return IRQ_HANDLED;
 }
@@ -705,7 +706,7 @@
 static irqreturn_t
 snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs)
 {
-	pmac_t *chip = snd_magic_cast(pmac_t, devid, return);
+	pmac_t *chip = snd_magic_cast(pmac_t, devid, return IRQ_NONE);
 	int ctrl = in_le32(&chip->awacs->control);
 
 	/*printk("pmac: control interrupt.. 0x%x\n", ctrl);*/
@@ -1170,9 +1171,8 @@
 
 #if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK)
 	/* add sleep notifier */
-	snd_pmac_register_sleep_notifier(chip);
-	card->set_power_state = snd_pmac_set_power_state;
-	card->power_state_private_data = chip;
+	if (! snd_pmac_register_sleep_notifier(chip))
+		snd_card_set_pm_callback(chip->card, snd_pmac_suspend, snd_pmac_resume, chip);
 #endif
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0)
@@ -1197,13 +1197,10 @@
  * Save state when going to sleep, restore it afterwards.
  */
 
-static void snd_pmac_suspend(pmac_t *chip)
+static int snd_pmac_suspend(snd_card_t *card, unsigned int state)
 {
+	pmac_t *chip = snd_magic_cast(pmac_t, card->pm_private_data, return -EINVAL);
 	unsigned long flags;
-	snd_card_t *card = chip->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D3hot)
-		return;
 
 	if (chip->suspend)
 		chip->suspend(chip);
@@ -1219,14 +1216,12 @@
 		disable_irq(chip->rx_irq);
 	snd_pmac_sound_feature(chip, 0);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+	return 0;
 }
 
-static void snd_pmac_resume(pmac_t *chip)
+static int snd_pmac_resume(snd_card_t *card, unsigned int state)
 {
-	snd_card_t *card = chip->card;
-
-	if (card->power_state == SNDRV_CTL_POWER_D0)
-		return;
+	pmac_t *chip = snd_magic_cast(pmac_t, card->pm_private_data, return -EINVAL);
 
 	snd_pmac_sound_feature(chip, 1);
 	if (chip->resume)
@@ -1248,6 +1243,7 @@
 		enable_irq(chip->rx_irq);
 
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+	return 0;
 }
 
 /* the chip is stored statically by snd_pmac_register_sleep_notifier
@@ -1264,10 +1260,10 @@
 
 	switch (when) {
 	case PBOOK_SLEEP_NOW:
-		snd_pmac_suspend(chip);
+		snd_pmac_suspend(chip->card, 0);
 		break;
 	case PBOOK_WAKE:
-		snd_pmac_resume(chip);
+		snd_pmac_resume(chip->card, 0);
 		break;
 	}
 	return PBOOK_SLEEP_OK;
@@ -1280,45 +1276,18 @@
 static int __init snd_pmac_register_sleep_notifier(pmac_t *chip)
 {
 	/* should be protected here.. */
-	if (sleeping_pmac) {
-		snd_printd("sleep notifier already reigistered\n");
-		return -EBUSY;
-	}
+	snd_assert(! sleeping_pmac, return -EBUSY);
 	sleeping_pmac = chip;
 	pmu_register_sleep_notifier(&snd_pmac_sleep_notifier);
-	chip->sleep_registered = 1;
 	return 0;
 }
 						    
 static int snd_pmac_unregister_sleep_notifier(pmac_t *chip)
 {
-	if (! chip->sleep_registered)
-		return 0;
 	/* should be protected here.. */
-	if (sleeping_pmac != chip)
-		return -ENODEV;
+	snd_assert(sleeping_pmac == chip, return -ENODEV);
 	pmu_unregister_sleep_notifier(&snd_pmac_sleep_notifier);
 	sleeping_pmac = NULL;
-	return 0;
-}
-
-/* callback */
-static int snd_pmac_set_power_state(snd_card_t *card, unsigned int power_state)
-{
-	pmac_t *chip = snd_magic_cast(pmac_t, card->power_state_private_data, return -ENXIO);
-	switch (power_state) {
-	case SNDRV_CTL_POWER_D0:
-	case SNDRV_CTL_POWER_D1:
-	case SNDRV_CTL_POWER_D2:
-		snd_pmac_resume(chip);
-		break;
-	case SNDRV_CTL_POWER_D3hot:
-	case SNDRV_CTL_POWER_D3cold:
-		snd_pmac_suspend(chip);
-		break;
-	default:
-		return -EINVAL;
-	}
 	return 0;
 }
 
diff -Nru a/sound/ppc/pmac.h b/sound/ppc/pmac.h
--- a/sound/ppc/pmac.h	Tue Jun 15 22:20:42 2004
+++ b/sound/ppc/pmac.h	Tue Jun 15 22:20:42 2004
@@ -162,7 +162,6 @@
 	void (*update_automute)(pmac_t *chip, int do_notify);
 	int (*detect_headphone)(pmac_t *chip);
 #ifdef CONFIG_PMAC_PBOOK
-	unsigned int sleep_registered : 1;
 	void (*suspend)(pmac_t *chip);
 	void (*resume)(pmac_t *chip);
 #endif
@@ -180,6 +179,7 @@
 int snd_pmac_burgundy_init(pmac_t *chip);
 int snd_pmac_daca_init(pmac_t *chip);
 int snd_pmac_tumbler_init(pmac_t *chip);
+int snd_pmac_tumbler_post_init(void);
 
 /* i2c functions */
 typedef struct snd_pmac_keywest {
diff -Nru a/sound/ppc/powermac.c b/sound/ppc/powermac.c
--- a/sound/ppc/powermac.c	Tue Jun 15 22:21:05 2004
+++ b/sound/ppc/powermac.c	Tue Jun 15 22:21:05 2004
@@ -20,8 +20,8 @@
 
 #include <sound/driver.h>
 #include <linux/init.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include "pmac.h"
 #include "awacs.h"
@@ -41,17 +41,17 @@
 static int enable_beep = 1;
 #endif
 
-MODULE_PARM(index, "i");
+module_param(index, int, 0444);
 MODULE_PARM_DESC(index, "Index value for " CHIP_NAME " soundchip.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "s");
+module_param(id, charp, 0444);
 MODULE_PARM_DESC(id, "ID string for " CHIP_NAME " soundchip.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-/* MODULE_PARM(enable, "i");
+/* module_param(enable, bool, 0444);
    MODULE_PARM_DESC(enable, "Enable this soundchip.");
    MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC); */
 #ifdef PMAC_SUPPORT_PCM_BEEP
-MODULE_PARM(enable_beep, "i");
+module_param(enable_beep, bool, 0444);
 MODULE_PARM_DESC(enable_beep, "Enable beep using PCM.");
 MODULE_PARM_SYNTAX(enable_beep, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
 #endif
@@ -104,7 +104,7 @@
 		sprintf(card->shortname, "PowerMac %s", name_ext);
 		sprintf(card->longname, "%s (Dev %d) Sub-frame %d",
 			card->shortname, chip->device_id, chip->subframe);
-		if ((err = snd_pmac_tumbler_init(chip)) < 0)
+		if ( snd_pmac_tumbler_init(chip) < 0 || snd_pmac_tumbler_post_init() < 0)
 			goto __error;
 		break;
 	case PMAC_AWACS:
@@ -175,26 +175,3 @@
 
 module_init(alsa_card_pmac_init)
 module_exit(alsa_card_pmac_exit)
-
-#ifndef MODULE
-
-/* format is: snd-pmac=enable,index,id,enable_beep
- */
-
-static int __init alsa_card_pmac_setup(char *str)
-{
-	int __attribute__ ((__unused__)) enable = 1;
-
-	(void)(get_option(&str,&enable) == 2 &&
-	       get_option(&str,&index) == 2 &&
-	       get_id(&str,&id) == 2
-#ifdef PMAC_SUPPORT_PCM_BEEP
-	       && get_option(&str,&enable_beep) == 2
-#endif
-	       );
-	return 1;
-}
-
-__setup("snd-pmac=", alsa_card_pmac_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
--- a/sound/ppc/tumbler.c	Tue Jun 15 22:20:36 2004
+++ b/sound/ppc/tumbler.c	Tue Jun 15 22:20:36 2004
@@ -684,6 +684,8 @@
 
 static int snapper_set_capture_source(pmac_tumbler_t *mix)
 {
+	if (! mix->i2c.client)
+		return -ENODEV;
 	return snd_pmac_keywest_write_byte(&mix->i2c, TAS_REG_ACS,
 					   mix->capture_source ? 2 : 0);
 }
@@ -870,7 +872,7 @@
 /* interrupt - headphone plug changed */
 static irqreturn_t headphone_intr(int irq, void *devid, struct pt_regs *regs)
 {
-	pmac_t *chip = snd_magic_cast(pmac_t, devid, return);
+	pmac_t *chip = snd_magic_cast(pmac_t, devid, return IRQ_NONE);
 	if (chip->update_automute && chip->initialized) {
 		chip->update_automute(chip, 1);
 		return IRQ_HANDLED;
diff -Nru a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
--- a/sound/sparc/amd7930.c	Tue Jun 15 22:20:37 2004
+++ b/sound/sparc/amd7930.c	Tue Jun 15 22:20:37 2004
@@ -34,13 +34,13 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/moduleparam.h>
 
 #include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
 #include <sound/control.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include <asm/io.h>
@@ -50,14 +50,15 @@
 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_PNP;	/* Enable this card */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Sun AMD7930 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Sun AMD7930 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Sun AMD7930 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 MODULE_AUTHOR("Thomas K. Dyas and David S. Miller");
@@ -1152,24 +1153,3 @@
 
 module_init(amd7930_init);
 module_exit(amd7930_exit);
-
-#ifndef MODULE
-
-/* format is: snd-sun-amd7930=index,id,enable */
-
-static int __init alsa_card_sun_amd7930_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&index[nr_dev]) == 2 &&
-	       get_option(&str,&id[nr_dev]) == 2 &&
-	       get_id(&str,&enable[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-sun-amd7930=", alsa_card_sun_amd7930_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
--- a/sound/sparc/cs4231.c	Tue Jun 15 22:20:36 2004
+++ b/sound/sparc/cs4231.c	Tue Jun 15 22:20:36 2004
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/moduleparam.h>
 
 #include <sound/driver.h>
 #include <sound/core.h>
@@ -22,7 +23,6 @@
 #include <sound/info.h>
 #include <sound/control.h>
 #include <sound/timer.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 #include <sound/pcm_params.h>
 
@@ -49,14 +49,15 @@
 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_PNP;	/* Enable this card */
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for Sun CS4231 soundcard.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable Sun CS4231 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
 MODULE_AUTHOR("Jaroslav Kysela, Derrick J. Brashear and David S. Miller");
@@ -2251,24 +2252,3 @@
 
 module_init(cs4231_init);
 module_exit(cs4231_exit);
-
-#ifndef MODULE
-
-/* format is: snd-sun-cs4231=index,id,enable */
-
-static int __init alsa_card_sun_cs4231_setup(char *str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str,&index[nr_dev]) == 2 &&
-	       get_option(&str,&id[nr_dev]) == 2 &&
-	       get_id(&str,&enable[nr_dev]) == 2);
-	nr_dev++;
-	return 1;
-}
-
-__setup("snd-sun-cs4231=", alsa_card_sun_cs4231_setup);
-
-#endif /* ifndef MODULE */
diff -Nru a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c
--- a/sound/synth/emux/emux_oss.c	Tue Jun 15 22:20:39 2004
+++ b/sound/synth/emux/emux_oss.c	Tue Jun 15 22:20:39 2004
@@ -34,7 +34,7 @@
 static int snd_emux_open_seq_oss(snd_seq_oss_arg_t *arg, void *closure);
 static int snd_emux_close_seq_oss(snd_seq_oss_arg_t *arg);
 static int snd_emux_ioctl_seq_oss(snd_seq_oss_arg_t *arg, unsigned int cmd, unsigned long ioarg);
-static int snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char *buf, int offs, int count);
+static int snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format, const char __user *buf, int offs, int count);
 static int snd_emux_reset_seq_oss(snd_seq_oss_arg_t *arg);
 static int snd_emux_event_oss_input(snd_seq_event_t *ev, int direct, void *private, int atomic, int hop);
 static void reset_port_mode(snd_emux_port_t *port, int midi_mode);
@@ -201,7 +201,7 @@
  */
 static int
 snd_emux_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
-			    const char *buf, int offs, int count)
+			    const char __user *buf, int offs, int count)
 {
 	snd_emux_t *emu;
 	snd_emux_port_t *p;
diff -Nru a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c
--- a/sound/synth/emux/soundfont.c	Tue Jun 15 22:20:43 2004
+++ b/sound/synth/emux/soundfont.c	Tue Jun 15 22:20:43 2004
@@ -34,7 +34,7 @@
 
 /* Prototypes for static functions */
 
-static int open_patch(snd_sf_list_t *sflist, const char *data, int count, int client);
+static int open_patch(snd_sf_list_t *sflist, const char __user *data, int count, int client);
 static snd_soundfont_t *newsf(snd_sf_list_t *sflist, int type, char *name);
 static int is_identical_font(snd_soundfont_t *sf, int type, unsigned char *name);
 static int close_patch(snd_sf_list_t *sflist);
diff -Nru a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
--- a/sound/usb/usbaudio.c	Tue Jun 15 22:20:43 2004
+++ b/sound/usb/usbaudio.c	Tue Jun 15 22:20:43 2004
@@ -45,11 +45,11 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/usb.h>
+#include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
-#define SNDRV_GET_ID
 #include <sound/initval.h>
 
 #include "usbaudio.h"
@@ -69,26 +69,27 @@
 static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Product ID for this card */
 static int nrpacks = 4;		/* max. number of packets per urb */
 static int async_unlink = 1;
+static int boot_devs;
 
-MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(index, int, boot_devs, 0444);
 MODULE_PARM_DESC(index, "Index value for the USB audio adapter.");
 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC);
-MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
+module_param_array(id, charp, boot_devs, 0444);
 MODULE_PARM_DESC(id, "ID string for the USB audio adapter.");
 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC);
-MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(enable, bool, boot_devs, 0444);
 MODULE_PARM_DESC(enable, "Enable USB audio adapter.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-MODULE_PARM(vid, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(vid, int, boot_devs, 0444);
 MODULE_PARM_DESC(vid, "Vendor ID for the USB audio device.");
 MODULE_PARM_SYNTAX(vid, SNDRV_ENABLED ",allows:{{-1,0xffff}},base:16");
-MODULE_PARM(pid, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+module_param_array(pid, int, boot_devs, 0444);
 MODULE_PARM_DESC(pid, "Product ID for the USB audio device.");
 MODULE_PARM_SYNTAX(pid, SNDRV_ENABLED ",allows:{{-1,0xffff}},base:16");
-MODULE_PARM(nrpacks, "i");
+module_param(nrpacks, int, 0444);
 MODULE_PARM_DESC(nrpacks, "Max. number of packets per URB.");
 MODULE_PARM_SYNTAX(nrpacks, SNDRV_ENABLED ",allows:{{1,10}}");
-MODULE_PARM(async_unlink, "i");
+module_param(async_unlink, bool, 0444);
 MODULE_PARM_DESC(async_unlink, "Use async unlink mode.");
 MODULE_PARM_SYNTAX(async_unlink, SNDRV_BOOLEAN_TRUE_DESC);
 
@@ -1146,7 +1147,7 @@
 	/* if endpoint has pitch control, enable it */
 	if (fmt->attributes & EP_CS_ATTR_PITCH_CONTROL) {
 		data[0] = 1;
-		if ((err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR,
+		if ((err = snd_usb_ctl_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) {
 			snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH\n",
@@ -1172,14 +1173,14 @@
 		data[0] = rate;
 		data[1] = rate >> 8;
 		data[2] = rate >> 16;
-		if ((err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR,
+		if ((err = snd_usb_ctl_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) {
 			snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d to ep 0x%x\n",
 				   dev->devnum, iface, fmt->altsetting, rate, ep);
 			return err;
 		}
-		if ((err = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR,
+		if ((err = snd_usb_ctl_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) {
 			snd_printk(KERN_ERR "%d:%d:%d: cannot get freq at ep 0x%x\n",
@@ -1231,7 +1232,7 @@
 				   dev->devnum, fmt->iface, fmt->altsetting);
 			return -EIO;
 		}
-		snd_printdd(KERN_INFO "setting usb interface %d:%d\n", fmt->iface, fmt->altset_idx);
+		snd_printdd(KERN_INFO "setting usb interface %d:%d\n", fmt->iface, fmt->altsetting);
 		subs->interface = fmt->iface;
 		subs->format = fmt->altset_idx;
 	}
@@ -1884,6 +1885,32 @@
 	return NULL;
 }
 
+/*
+ * Wrapper for usb_control_msg().
+ * Allocates a temp buffer to prevent dmaing from/to the stack.
+ */
+int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
+		    __u8 requesttype, __u16 value, __u16 index, void *data,
+		    __u16 size, int timeout)
+{
+	int err;
+	void *buf = NULL;
+
+	if (size > 0) {
+		buf = kmalloc(size, GFP_KERNEL);
+		if (!buf)
+			return -ENOMEM;
+		memcpy(buf, data, size);
+	}
+	err = usb_control_msg(dev, pipe, request, requesttype,
+			      value, index, buf, size, timeout);
+	if (size > 0) {
+		memcpy(data, buf, size);
+		kfree(buf);
+	}
+	return err;
+}
+
 
 /*
  * entry point for linux usb interface
@@ -1926,7 +1953,7 @@
 		struct audioformat *fp;
 		fp = list_entry(p, struct audioformat, list);
 		snd_iprintf(buffer, "  Interface %d\n", fp->iface);
-		snd_iprintf(buffer, "    Altset %d\n", fp->altset_idx);
+		snd_iprintf(buffer, "    Altset %d\n", fp->altsetting);
 		snd_iprintf(buffer, "    Format: %s\n", snd_pcm_format_name(fp->format));
 		snd_iprintf(buffer, "    Channels: %d\n", fp->channels);
 		snd_iprintf(buffer, "    Endpoint: %d %s (%s)\n",
@@ -2640,6 +2667,7 @@
 	struct audioformat *fp;
 	struct usb_host_interface *alts;
 	int stream, err;
+	int *rate_table = NULL;
 
 	fp = kmalloc(sizeof(*fp), GFP_KERNEL);
 	if (! fp) {
@@ -2647,16 +2675,30 @@
 		return -ENOMEM;
 	}
 	memcpy(fp, quirk->data, sizeof(*fp));
+	if (fp->nr_rates > 0) {
+		rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL);
+		if (!rate_table) {
+			kfree(fp);
+			return -ENOMEM;
+		}
+		memcpy(rate_table, fp->rate_table, sizeof(int) * fp->nr_rates);
+		fp->rate_table = rate_table;
+	}
+
 	stream = (fp->endpoint & USB_DIR_IN)
 		? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
 	err = add_audio_endpoint(chip, stream, fp);
 	if (err < 0) {
 		kfree(fp);
+		if (rate_table)
+			kfree(rate_table);
 		return err;
 	}
 	if (fp->iface != get_iface_desc(&iface->altsetting[0])->bInterfaceNumber ||
 	    fp->altset_idx >= iface->num_altsetting) {
 		kfree(fp);
+		if (rate_table)
+			kfree(rate_table);
 		return -EINVAL;
 	}
 	alts = &iface->altsetting[fp->altset_idx];
@@ -2700,6 +2742,83 @@
 	return 0;
 }
 
+/*
+ * Create a stream for an Edirol UA-700 interface.  The only way
+ * to detect the sample rate is by looking at wMaxPacketSize.
+ */
+static int create_ua700_quirk(snd_usb_audio_t *chip, struct usb_interface *iface)
+{
+	static const struct audioformat ua700_format = {
+		.format = SNDRV_PCM_FORMAT_S24_3LE,
+		.channels = 2,
+		.fmt_type = USB_FORMAT_TYPE_I,
+		.altsetting = 1,
+		.altset_idx = 1,
+		.rates = SNDRV_PCM_RATE_CONTINUOUS,
+	};
+	struct usb_host_interface *alts;
+	struct usb_interface_descriptor *altsd;
+	struct audioformat *fp;
+	int stream, err;
+
+	/* both PCM and MIDI interfaces have 2 altsettings */
+	if (iface->num_altsetting != 2)
+		return -ENXIO;
+	alts = &iface->altsetting[1];
+	altsd = get_iface_desc(alts);
+
+	if (altsd->bNumEndpoints == 2) {
+		static const snd_usb_midi_endpoint_info_t ep = {
+			.out_cables = 0x0003,
+			.in_cables  = 0x0003
+		};
+		static const snd_usb_audio_quirk_t quirk = {
+			.type = QUIRK_MIDI_FIXED_ENDPOINT,
+			.data = &ep
+		};
+		return snd_usb_create_midi_interface(chip, iface, &quirk);
+	}
+
+	if (altsd->bNumEndpoints != 1)
+		return -ENXIO;
+
+	fp = kmalloc(sizeof(*fp), GFP_KERNEL);
+	if (!fp)
+		return -ENOMEM;
+	memcpy(fp, &ua700_format, sizeof(*fp));
+
+	fp->iface = altsd->bInterfaceNumber;
+	fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
+	fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
+	fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize;
+
+	switch (fp->maxpacksize) {
+	case 0x120:
+		fp->rate_max = fp->rate_min = 44100;
+		break;
+	case 0x138:
+		fp->rate_max = fp->rate_min = 48000;
+		break;
+	case 0x258:
+		fp->rate_max = fp->rate_min = 96000;
+		break;
+	default:
+		snd_printk(KERN_ERR "unknown sample rate\n");
+		kfree(fp);
+		return -ENXIO;
+	}
+
+	stream = (fp->endpoint & USB_DIR_IN)
+		? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
+	err = add_audio_endpoint(chip, stream, fp);
+	if (err < 0) {
+		kfree(fp);
+		return err;
+	}
+	usb_set_interface(chip->dev, fp->iface, 0);
+	return 0;
+}
+
 static int snd_usb_create_quirk(snd_usb_audio_t *chip,
 				struct usb_interface *iface,
 				const snd_usb_audio_quirk_t *quirk);
@@ -2747,7 +2866,7 @@
 	    get_cfg_desc(config)->wTotalLength == EXTIGY_FIRMWARE_SIZE_NEW) {
 		snd_printdd("sending Extigy boot sequence...\n");
 		/* Send message to force it to reconnect with full interface. */
-		err = usb_control_msg(dev, usb_sndctrlpipe(dev,0),
+		err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0),
 				      0x10, 0x43, 0x0001, 0x000a, NULL, 0, HZ);
 		if (err < 0) snd_printdd("error sending boot message: %d\n", err);
 		err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
@@ -2787,6 +2906,8 @@
 	case QUIRK_AUDIO_STANDARD_INTERFACE:
 	case QUIRK_MIDI_STANDARD_INTERFACE:
 		return create_standard_interface_quirk(chip, iface, quirk);
+	case QUIRK_AUDIO_EDIROL_UA700:
+		return create_ua700_quirk(chip, iface);
 	default:
 		snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
 		return -ENXIO;
@@ -3124,26 +3245,3 @@
 
 module_init(snd_usb_audio_init);
 module_exit(snd_usb_audio_cleanup);
-
-#ifndef MODULE
-/*
- * format is snd-usb-audio=enable,index,id,vid,pid
- */
-static int __init snd_usb_audio_module_setup(char* str)
-{
-	static unsigned __initdata nr_dev = 0;
-
-	if (nr_dev >= SNDRV_CARDS)
-		return 0;
-	(void)(get_option(&str, &enable[nr_dev]) == 2 &&
-	       get_option(&str, &index[nr_dev]) == 2 &&
-	       get_id(&str, &id[nr_dev]) == 2 &&
-	       get_option(&str, &vid[nr_dev]) == 2 &&
-	       get_option(&str, &pid[nr_dev]) == 2);
-	++nr_dev;
-	return 1;
-}
-
-__setup("snd-usb-audio=", snd_usb_audio_module_setup);
-
-#endif /* !MODULE */
diff -Nru a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
--- a/sound/usb/usbaudio.h	Tue Jun 15 22:20:42 2004
+++ b/sound/usb/usbaudio.h	Tue Jun 15 22:20:42 2004
@@ -154,6 +154,7 @@
 #define QUIRK_AUDIO_FIXED_ENDPOINT	4
 #define QUIRK_AUDIO_STANDARD_INTERFACE	5
 #define QUIRK_MIDI_STANDARD_INTERFACE	6
+#define QUIRK_AUDIO_EDIROL_UA700	7
 
 typedef struct snd_usb_audio_quirk snd_usb_audio_quirk_t;
 typedef struct snd_usb_midi_endpoint_info snd_usb_midi_endpoint_info_t;
@@ -185,6 +186,8 @@
 
 /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */
 
+/* for QUIRK_AUDIO_EDIROL_UA700, data is NULL */
+
 /*
  */
 
@@ -196,6 +199,8 @@
 
 void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype);
 void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype);
+
+int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout);
 
 int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif);
 
diff -Nru a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
--- a/sound/usb/usbmixer.c	Tue Jun 15 22:20:38 2004
+++ b/sound/usb/usbmixer.c	Tue Jun 15 22:20:38 2004
@@ -301,7 +301,7 @@
 	int timeout = 10;
  
 	while (timeout-- > 0) {
-		if (usb_control_msg(cval->chip->dev, usb_rcvctrlpipe(cval->chip->dev, 0),
+		if (snd_usb_ctl_msg(cval->chip->dev, usb_rcvctrlpipe(cval->chip->dev, 0),
 				    request,
 				    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
 				    validx, cval->ctrlif | (cval->id << 8),
@@ -339,7 +339,7 @@
 	buf[0] = value_set & 0xff;
 	buf[1] = (value_set >> 8) & 0xff;
 	while (timeout -- > 0)
-		if (usb_control_msg(cval->chip->dev, usb_sndctrlpipe(cval->chip->dev, 0),
+		if (snd_usb_ctl_msg(cval->chip->dev, usb_sndctrlpipe(cval->chip->dev, 0),
 				    request,
 				    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
 				    validx, cval->ctrlif | (cval->id << 8),
diff -Nru a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
--- a/sound/usb/usbquirks.h	Tue Jun 15 22:20:39 2004
+++ b/sound/usb/usbquirks.h	Tue Jun 15 22:20:39 2004
@@ -113,7 +113,7 @@
 		.product_name = "UA-100",
 		.ifnum = QUIRK_ANY_INTERFACE,
 		.type = QUIRK_COMPOSITE,
-		.data = & (const snd_usb_audio_quirk_t[]) {
+		.data = (const snd_usb_audio_quirk_t[]) {
 			{
 				.ifnum = 0,
 				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
@@ -274,7 +274,7 @@
 		.product_name = "SC-D70",
 		.ifnum = QUIRK_ANY_INTERFACE,
 		.type = QUIRK_COMPOSITE,
-		.data = & (const snd_usb_audio_quirk_t[]) {
+		.data = (const snd_usb_audio_quirk_t[]) {
 			{
 				.ifnum = 0,
 				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
@@ -338,7 +338,7 @@
 		.product_name = "UA-5",
 		.ifnum = QUIRK_ANY_INTERFACE,
 		.type = QUIRK_COMPOSITE,
-		.data = & (const snd_usb_audio_quirk_t[]) {
+		.data = (const snd_usb_audio_quirk_t[]) {
 			{
 				.ifnum = 1,
 				.type = QUIRK_AUDIO_STANDARD_INTERFACE
@@ -443,7 +443,7 @@
 		.product_name = "UA-20",
 		.ifnum = QUIRK_ANY_INTERFACE,
 		.type = QUIRK_COMPOSITE,
-		.data = & (const snd_usb_audio_quirk_t[]) {
+		.data = (const snd_usb_audio_quirk_t[]) {
 			{
 				.ifnum = 1,
 				.type = QUIRK_AUDIO_STANDARD_INTERFACE
@@ -488,16 +488,34 @@
 		}
 	}
 },
-{
+{	/*
+	 * This quirk is for the "Advanced" modes of the Edirol UA-700.
+	 * If the sample format switch is not in an advanced setting, the
+	 * UA-700 has ID 0x0582/0x002c and is standard compliant (no quirks),
+	 * but offers only 16-bit PCM and no MIDI.
+	 */
 	USB_DEVICE_VENDOR_SPEC(0x0582, 0x002b),
 	.driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
 		.vendor_name = "EDIROL",
 		.product_name = "UA-700",
-		.ifnum = 3,
-		.type = QUIRK_MIDI_FIXED_ENDPOINT,
-		.data = & (const snd_usb_midi_endpoint_info_t) {
-			.out_cables = 0x0003,
-			.in_cables  = 0x0003
+		.ifnum = QUIRK_ANY_INTERFACE,
+		.type = QUIRK_COMPOSITE,
+		.data = (const snd_usb_audio_quirk_t[]) {
+			{
+				.ifnum = 1,
+				.type = QUIRK_AUDIO_EDIROL_UA700
+			},
+			{
+				.ifnum = 2,
+				.type = QUIRK_AUDIO_EDIROL_UA700
+			},
+			{
+				.ifnum = 3,
+				.type = QUIRK_AUDIO_EDIROL_UA700
+			},
+			{
+				.ifnum = -1
+			}
 		}
 	}
 },
@@ -580,6 +598,62 @@
 	}
 },
 {
+	USB_DEVICE(0x0582, 0x0044),
+	.driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
+		.vendor_name = "Roland",
+		.product_name = "UA-1000",
+		.ifnum = QUIRK_ANY_INTERFACE,
+		.type = QUIRK_COMPOSITE,
+		.data = (const snd_usb_audio_quirk_t[]) {
+			{
+				.ifnum = 1,
+				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
+				.data = & (const struct audioformat) {
+					.format = SNDRV_PCM_FORMAT_S24,
+					.channels = 12,
+					.iface = 1,
+					.altsetting = 1,
+					.altset_idx = 1,
+					.attributes = 0,
+					.endpoint = 0x81,
+					.ep_attr = 0x01,
+					.rates = SNDRV_PCM_RATE_CONTINUOUS,
+					.rate_min = 48000,
+					.rate_max = 48000,
+				}
+			},
+			{
+				.ifnum = 2,
+				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
+				.data = & (const struct audioformat) {
+					.format = SNDRV_PCM_FORMAT_S24,
+					.channels = 10,
+					.iface = 2,
+					.altsetting = 1,
+					.altset_idx = 1,
+					.attributes = 0,
+					.endpoint = 0x02,
+					.ep_attr = 0x01,
+					.rates = SNDRV_PCM_RATE_CONTINUOUS,
+					.rate_min = 48000,
+					.rate_max = 48000,
+				}
+			},
+			{
+				.ifnum = 3,
+				.type = QUIRK_MIDI_FIXED_ENDPOINT,
+				.data = & (const snd_usb_midi_endpoint_info_t) {
+					.out_cables = 0x0003,
+					.in_cables  = 0x0003
+				}
+			},
+			{
+				.ifnum = -1
+			}
+		}
+	}
+},
+{
 	USB_DEVICE(0x0582, 0x0048),
 	.driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) {
 		.vendor_name = "EDIROL",
@@ -629,7 +703,7 @@
 		.product_name = "UA-3FX",
 		.ifnum = QUIRK_ANY_INTERFACE,
 		.type = QUIRK_COMPOSITE,
-		.data = & (const snd_usb_audio_quirk_t[]) {
+		.data = (const snd_usb_audio_quirk_t[]) {
 			{
 				.ifnum = 1,
 				.type = QUIRK_AUDIO_STANDARD_INTERFACE
